]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/CpuRuntimeDxe/MpService.c
EmulatorPkg: Fix Visual Studio build for IA32 & X64
[mirror_edk2.git] / EmulatorPkg / CpuRuntimeDxe / MpService.c
index b5b1d156c011ccc83d3e4c97c4b0c2126fac4c43..bffc82b0479fed4fbe2233111e194997645711f1 100644 (file)
@@ -28,7 +28,7 @@
   APs to help test system memory in parallel with other device initialization.\r
   Diagnostics applications may also use this protocol for multi-processor.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 Portitions Copyright (c) 2011, Apple Inc. All rights reserved.\r
 This program and the accompanying materials are licensed and made available under\r
 the terms and conditions of the BSD License that accompanies this distribution.\r
@@ -374,7 +374,6 @@ CpuMpServicesStartupAllAps (
 {\r
   EFI_STATUS            Status;\r
   PROCESSOR_DATA_BLOCK  *ProcessorData;\r
-  UINTN                 ListIndex;\r
   UINTN                 Number;\r
   UINTN                 NextNumber;\r
   PROCESSOR_STATE       APInitialState;\r
@@ -411,7 +410,6 @@ CpuMpServicesStartupAllAps (
 \r
   Timeout = TimeoutInMicroseconds;\r
 \r
-  ListIndex                   = 0;\r
   ProcessorData               = NULL;\r
 \r
   gMPSystem.FinishCount   = 0;\r
@@ -650,7 +648,6 @@ CpuMpServicesStartupThisAP (
   OUT BOOLEAN                   *Finished               OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS      Status;\r
   INTN            Timeout;\r
 \r
   if (!IsBSP ()) {\r
@@ -685,13 +682,13 @@ CpuMpServicesStartupThisAP (
   SetApProcedure (&gMPSystem.ProcessorData[ProcessorNumber], Procedure, ProcedureArgument);\r
 \r
   if (WaitEvent != NULL) {\r
-      // Non Blocking\r
-      gMPSystem.WaitEvent = WaitEvent;\r
-      Status = gBS->SetTimer (\r
-                      gMPSystem.ProcessorData[ProcessorNumber].CheckThisAPEvent,\r
-                      TimerPeriodic,\r
-                      gPollInterval\r
-                      );\r
+    // Non Blocking\r
+    gMPSystem.WaitEvent = WaitEvent;\r
+    gBS->SetTimer (\r
+           gMPSystem.ProcessorData[ProcessorNumber].CheckThisAPEvent,\r
+           TimerPeriodic,\r
+           gPollInterval\r
+           );\r
     return EFI_SUCCESS;\r
   }\r
 \r
@@ -1155,17 +1152,13 @@ FillInProcessorInformation (
   IN     UINTN                ProcessorNumber\r
   )\r
 {\r
-  PROCESSOR_DATA_BLOCK            *ProcessorData;\r
-\r
-  ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];\r
-\r
   gMPSystem.ProcessorData[ProcessorNumber].Info.ProcessorId  = gThread->Self ();\r
   gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag   = PROCESSOR_ENABLED_BIT | PROCESSOR_HEALTH_STATUS_BIT;\r
   if (BSP) {\r
     gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_AS_BSP_BIT;\r
   }\r
 \r
-  gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = ProcessorNumber;\r
+  gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = (UINT32) ProcessorNumber;\r
   gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Core    = 0;\r
   gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Thread  = 0;\r
   gMPSystem.ProcessorData[ProcessorNumber].State = BSP ? CPU_STATE_BUSY : CPU_STATE_IDLE;\r
@@ -1315,35 +1308,33 @@ CpuReadToBootFunction (
 \r
 EFI_STATUS\r
 CpuMpServicesInit (\r
-  VOID\r
+  OUT UINTN *MaxCpus\r
   )\r
 {\r
   EFI_STATUS              Status;\r
   EFI_HANDLE              Handle;\r
   EMU_IO_THUNK_PROTOCOL   *IoThunk;\r
-  UINTN                   MaxCpus;\r
-\r
-  MaxCpus = 1; // BSP\r
 \r
+  *MaxCpus = 1; // BSP\r
   IoThunk = GetIoThunkInstance (&gEmuThreadThunkProtocolGuid, 0);\r
   if (IoThunk != NULL) {\r
     Status = IoThunk->Open (IoThunk);\r
     if (!EFI_ERROR (Status)) {\r
       if (IoThunk->ConfigString != NULL) {\r
-        MaxCpus += StrDecimalToUintn (IoThunk->ConfigString);\r
+        *MaxCpus += StrDecimalToUintn (IoThunk->ConfigString);\r
         gThread = IoThunk->Interface;\r
       }\r
     }\r
   }\r
 \r
-  if (MaxCpus == 1) {\r
+  if (*MaxCpus == 1) {\r
     // We are not MP so nothing to do\r
     return EFI_SUCCESS;\r
   }\r
 \r
-  gPollInterval = PcdGet64 (PcdEmuMpServicesPollingInterval);\r
+  gPollInterval = (UINTN) PcdGet64 (PcdEmuMpServicesPollingInterval);\r
 \r
-  Status  = InitializeMpSystemData (MaxCpus);\r
+  Status  = InitializeMpSystemData (*MaxCpus);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r