UefiCpuPkg/MpInitLib: Keep compatible with former AP counting solution.

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>
This commit is contained in:
Eric Dong 2017-10-26 13:55:21 +08:00
parent bf5a306ab5
commit 861218740d
1 changed files with 13 additions and 8 deletions

View File

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