]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuMp.c
UefiCpuPkg/MpService: put AP to busy state when execution
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.c
index 25b6fcb056efc5dcb268b12faf3a4fc60f5971ec..25c909193e41062f6615f8c11356ed26c86bdc71 100644 (file)
@@ -1176,11 +1176,14 @@ ProcessorToIdleState (
   }\r
 \r
   //\r
-  // Avoid forcibly reset AP caused the AP State is not updated.\r
+  // Avoid forcibly reset AP caused the timeout AP State is not\r
+  // updated.\r
   //\r
   GetMpSpinLock (CpuData);\r
+  if (CpuData->State == CpuStateBusy) {\r
+    CpuData->Procedure = NULL;\r
+  }\r
   CpuData->State = CpuStateIdle;\r
-  CpuData->Procedure = NULL;\r
   ReleaseMpSpinLock (CpuData);\r
 \r
   while (TRUE) {\r
@@ -1190,6 +1193,8 @@ ProcessorToIdleState (
     ReleaseMpSpinLock (CpuData);\r
 \r
     if (Procedure != NULL) {\r
+      SetApState (CpuData, CpuStateBusy);\r
+\r
       Procedure (ProcedureArgument);\r
 \r
       GetMpSpinLock (CpuData);\r