UefiCpuPkg MpInitLib: Save/restore original WakeupBuffer for DxeMpLib

Current code always allocates/frees < 1MB WakeupBuffer for DxeMpLib
until ExitBootService, but the allocation may be failed at late
phase of the boot.

This patch is to always save/restore original WakeupBuffer for
DxeMpLib, it is aligned with the solution for PeiMpLib at
9293d6e42e, then AllocateResetVector()
and FreeResetVector() will be common and moved to MpLib.c.
Only difference is GetWakeupBuffer() that will be in PeiMpLib or
DxeMpLib respectively.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Star Zeng
2017-08-04 10:05:20 +08:00
parent 4ad5f59715
commit a6b3d753f9
4 changed files with 109 additions and 168 deletions

View File

@ -187,42 +187,6 @@ GetWakeupBuffer (
return (UINTN) -1;
}
/**
Allocate reset vector buffer.
@param[in, out] CpuMpData The pointer to CPU MP Data structure.
**/
VOID
AllocateResetVector (
IN OUT CPU_MP_DATA *CpuMpData
)
{
UINTN ApResetVectorSize;
if (CpuMpData->WakeupBuffer == (UINTN) -1) {
ApResetVectorSize = CpuMpData->AddressMap.RendezvousFunnelSize +
sizeof (MP_CPU_EXCHANGE_INFO);
CpuMpData->WakeupBuffer = GetWakeupBuffer (ApResetVectorSize);
CpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN)
(CpuMpData->WakeupBuffer + CpuMpData->AddressMap.RendezvousFunnelSize);
}
BackupAndPrepareWakeupBuffer (CpuMpData);
}
/**
Free AP reset vector buffer.
@param[in] CpuMpData The pointer to CPU MP Data structure.
**/
VOID
FreeResetVector (
IN CPU_MP_DATA *CpuMpData
)
{
RestoreWakeupBuffer (CpuMpData);
}
/**
Checks APs status and updates APs status if needed.