UefiCpuPkg/MpInitLib: Keep compatible with former AP counting solution.
authorEric Dong <eric.dong@intel.com>
Thu, 26 Oct 2017 05:55:21 +0000 (13:55 +0800)
committerEric Dong <eric.dong@intel.com>
Fri, 27 Oct 2017 01:34:38 +0000 (09:34 +0800)
For some special platforms (such as Ovmf), it is possible
that, some APs start up *and finish* before the remaining
APs start up *at all*. In this case, the enhance
solution by changes 0594ec41 not works as expected.

This change remove check CpuMpData->CpuCount logic to let old
solution still workable if platform owner still set a long
time for PcdCpuApInitTimeOutInMicroSeconds. It's platform
owner's response to decide which solution to use.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jeff Fan <vanjeff_919@hotmail.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>

index 48f930b701473de77cabd58d4f929fc4c6091ea1..18060fd0998c0323b37c1a0a8a30bd437ca626a0 100644 (file)
@@ -936,15 +936,20 @@ WakeUpAP (
     if (CpuMpData->InitFlag == ApInitConfig) {\r
-      // Wait for one potential AP waken up in one specified period\r
+      // Here support two methods to collect AP count through adjust\r
+      // PcdCpuApInitTimeOutInMicroSeconds values.\r
-      if (CpuMpData->CpuCount == 0) {\r
-        TimedWaitForApFinish (\r
-          CpuMpData,\r
-          PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,\r
-          PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)\r
-          );\r
-      }\r
+      // one way is set a value to just let the first AP to start the\r
+      // initialization, then through the later while loop to wait all Aps\r
+      // finsh the initialization.\r
+      // The other way is set a value to let all APs finished the initialzation.\r
+      // In this case, the later while loop is useless.\r
+      //\r
+      TimedWaitForApFinish (\r
+        CpuMpData,\r
+        PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,\r
+        PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)\r
+        );\r
       while (CpuMpData->MpCpuExchangeInfo->NumApsExecuting != 0) {\r