UefiCpuPkg: Use Top of each AP's stack to save CpuMpData
To remove the dependency of CPU register, 4/8 byte at the top of the stack is occupied for CpuMpData. BIST information is also taken care here. This modification is only for PEI phase, since in DXE phase CpuMpData is accessed via global variable. Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
76cf3d35e6
commit
9ab2b34dd4
@@ -89,7 +89,7 @@ EnableDebugAgent (
|
||||
/**
|
||||
Get pointer to CPU MP Data structure.
|
||||
For BSP, the pointer is retrieved from HOB.
|
||||
For AP, the structure is just after IDT.
|
||||
For AP, the structure is stored in the top of each AP's stack.
|
||||
|
||||
@return The pointer to CPU MP Data structure.
|
||||
**/
|
||||
@@ -100,15 +100,17 @@ GetCpuMpData (
|
||||
{
|
||||
CPU_MP_DATA *CpuMpData;
|
||||
MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr;
|
||||
IA32_DESCRIPTOR Idtr;
|
||||
UINTN ApTopOfStack;
|
||||
AP_STACK_DATA *ApStackData;
|
||||
|
||||
ApicBaseMsr.Uint64 = AsmReadMsr64 (MSR_IA32_APIC_BASE);
|
||||
if (ApicBaseMsr.Bits.BSP == 1) {
|
||||
CpuMpData = GetCpuMpDataFromGuidedHob ();
|
||||
ASSERT (CpuMpData != NULL);
|
||||
} else {
|
||||
AsmReadIdtr (&Idtr);
|
||||
CpuMpData = (CPU_MP_DATA *)(Idtr.Base + Idtr.Limit + 1);
|
||||
ApTopOfStack = ALIGN_VALUE ((UINTN)&ApTopOfStack, (UINTN)PcdGet32 (PcdCpuApStackSize));
|
||||
ApStackData = (AP_STACK_DATA *)((UINTN)ApTopOfStack- sizeof (AP_STACK_DATA));
|
||||
CpuMpData = (CPU_MP_DATA *)ApStackData->MpData;
|
||||
}
|
||||
|
||||
return CpuMpData;
|
||||
|
Reference in New Issue
Block a user