]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: Move timeout delay to WakupAp()
authorJeff Fan <jeff.fan@intel.com>
Wed, 24 Aug 2016 13:37:14 +0000 (21:37 +0800)
committerJeff Fan <jeff.fan@intel.com>
Thu, 25 Aug 2016 08:12:32 +0000 (16:12 +0800)
After sending the 1st broadcast INIT-SIPI-SIPI, BSP will collect APs count after
one specified timeout delay. However, WakupAp() will restore reset vector
immediately after sending 1st broadcast INIT-SIPI-SIPI. Some processors may not
complete executing reset vector code.

This fix is to move MicroSecondDelay() from CollectProcessorCount() to the place
that is after sending 1st broadcast INIT-SIPI-SIPI and before FreeResetVector()
in WakupAp().

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
UefiCpuPkg/Library/MpInitLib/MpLib.c

index fbe2e8b8c459e3acae2e03029879bf7329a87f4a..47a971bf97a535388db4e7564adb7c77f82866cc 100644 (file)
@@ -513,10 +513,6 @@ CollectProcessorCount (
   CpuMpData->InitFlag     = ApInitConfig;\r
   CpuMpData->X2ApicEnable = FALSE;\r
   WakeUpAP (CpuMpData, TRUE, 0, NULL, NULL);\r
-  //\r
-  // Wait for AP task to complete and then exit.\r
-  //\r
-  MicroSecondDelay (PcdGet32(PcdCpuApInitTimeOutInMicroSeconds));\r
   CpuMpData->InitFlag = ApInitDone;\r
   ASSERT (CpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber));\r
   //\r
@@ -863,7 +859,12 @@ WakeUpAP (
       //\r
       SendInitSipiSipiAllExcludingSelf ((UINT32) ExchangeInfo->BufferStart);\r
     }\r
-    if (CpuMpData->InitFlag != ApInitConfig) {\r
+    if (CpuMpData->InitFlag == ApInitConfig) {\r
+      //\r
+      // Wait for all potential APs waken up in one specified period\r
+      //\r
+      MicroSecondDelay (PcdGet32(PcdCpuApInitTimeOutInMicroSeconds));\r
+    } else {\r
       //\r
       // Wait all APs waken up if this is not the 1st broadcast of SIPI\r
       //\r