]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: Rollback old change 2a5997f8.
authorDong, Eric <eric.dong@intel.com>
Fri, 2 Nov 2018 08:27:48 +0000 (16:27 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Mon, 5 Nov 2018 02:39:13 +0000 (10:39 +0800)
In some special cases, after BSP sends Init-sipi-sipi signal
AP needs more time to start the Ap procedure. In this case
BSP may think AP has finished its task but in fact AP hasn't began
yet.

Rollback former change to keep the status which only be used
when AP really finished task.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
UefiCpuPkg/Library/MpInitLib/MpLib.c
UefiCpuPkg/Library/MpInitLib/MpLib.h

index 85ca4a2946d9184a841a46a06406c8e9a0c3c32f..7f4d6e60bd9af92fd6ed765108f8dcf70cfd0e37 100644 (file)
@@ -696,7 +696,7 @@ ApWakeupFunction (
             }\r
           }\r
         }\r
-        SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);\r
+        SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateFinished);\r
       }\r
     }\r
 \r
@@ -1370,10 +1370,11 @@ CheckThisAP (
   //\r
   // If the AP finishes for StartupThisAP(), return EFI_SUCCESS.\r
   //\r
-  if (GetApState(CpuData) == CpuStateIdle) {\r
+  if (GetApState(CpuData) == CpuStateFinished) {\r
     if (CpuData->Finished != NULL) {\r
       *(CpuData->Finished) = TRUE;\r
     }\r
+    SetApState (CpuData, CpuStateIdle);\r
     return EFI_SUCCESS;\r
   } else {\r
     //\r
@@ -1434,9 +1435,10 @@ CheckAllAPs (
     // Only BSP and corresponding AP access this unit of CPU Data. This means the AP will not modify the\r
     // value of state after setting the it to CpuStateIdle, so BSP can safely make use of its value.\r
     //\r
-    if (GetApState(CpuData) == CpuStateIdle) {\r
+    if (GetApState(CpuData) == CpuStateFinished) {\r
       CpuMpData->RunningCount --;\r
       CpuMpData->CpuData[ProcessorNumber].Waiting = FALSE;\r
+      SetApState(CpuData, CpuStateIdle);\r
 \r
       //\r
       // If in Single Thread mode, then search for the next waiting AP for execution.\r
@@ -1937,7 +1939,7 @@ SwitchBSPWorker (
   //\r
   // Wait for old BSP finished AP task\r
   //\r
-  while (GetApState (&CpuMpData->CpuData[CallerNumber]) != CpuStateIdle) {\r
+  while (GetApState (&CpuMpData->CpuData[CallerNumber]) != CpuStateFinished) {\r
     CpuPause ();\r
   }\r
 \r
index 773db76b612eb7ffb68d80a4fafc90563776b753..5f6986c240eb81cf87242b1bd09dc55b041a0244 100644 (file)
@@ -89,6 +89,7 @@ typedef enum {
   CpuStateIdle,\r
   CpuStateReady,\r
   CpuStateBusy,\r
+  CpuStateFinished,\r
   CpuStateDisabled\r
 } CPU_STATE;\r
 \r