UefiCpuPkg: Refactor the logic for placing APs in HltLoop.

Refactor the logic for placing APs in HltLoop into a separate function.

Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
Xie, Yuanhao 2023-06-28 16:47:20 +08:00 committed by mergify[bot]
parent 63923a5642
commit 88f436883b
1 changed files with 24 additions and 11 deletions

View File

@ -636,6 +636,28 @@ InitializeApData (
SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);
}
/**
This function place APs in Halt loop.
@param[in] CpuMpData Pointer to CPU MP Data
**/
VOID
PlaceAPInHltLoop (
IN CPU_MP_DATA *CpuMpData
)
{
while (TRUE) {
DisableInterrupts ();
if (CpuMpData->UseSevEsAPMethod) {
SevEsPlaceApHlt (CpuMpData);
} else {
CpuSleep ();
}
CpuPause ();
}
}
/**
This function will be called from AP reset code if BSP uses WakeUpAP.
@ -812,19 +834,10 @@ ApWakeupFunction (
// Place AP is specified loop mode
//
if (CpuMpData->ApLoopMode == ApInHltLoop) {
PlaceAPInHltLoop (CpuMpData);
//
// Place AP in HLT-loop
// Never run here
//
while (TRUE) {
DisableInterrupts ();
if (CpuMpData->UseSevEsAPMethod) {
SevEsPlaceApHlt (CpuMpData);
} else {
CpuSleep ();
}
CpuPause ();
}
}
while (TRUE) {