diff options
author | Jeff Fan <jeff.fan@intel.com> | 2015-12-18 05:49:28 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-12-18 05:49:28 +0000 |
commit | 18be815babcb4537128753b40b60aa257a6ece88 (patch) | |
tree | 26f6028e936a685bfaa3fc608c9c148edbcf06e1 /UefiCpuPkg/CpuMpPei/CpuMpPei.c | |
parent | 6be91122b1b3303f6c97a9545a300021acc3e9c1 (diff) | |
download | edk2-platforms-18be815babcb4537128753b40b60aa257a6ece88.tar.xz |
UefiCpuPkg/CpuMpPei: Prepare for monitor buffer
Get AP loop mode to prepare for the monitor buffer required for ApInMwaitLoop
and ApInRunLoop.
(Sync patch r19344 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19361 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/CpuMpPei/CpuMpPei.c')
-rw-r--r-- | UefiCpuPkg/CpuMpPei/CpuMpPei.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index ac609a01f8..b8fa5118b4 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -589,6 +589,10 @@ PrepareAPStartupVector ( UINTN WakeupBuffer;
UINTN WakeupBufferSize;
MP_ASSEMBLY_ADDRESS_MAP AddressMap;
+ UINT8 ApLoopMode;
+ UINT16 MonitorFilterSize;
+ UINT8 *MonitorBuffer;
+ UINTN Index;
AsmGetAddressMap (&AddressMap);
WakeupBufferSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
@@ -597,11 +601,14 @@ PrepareAPStartupVector ( DEBUG ((EFI_D_INFO, "CpuMpPei: WakeupBuffer = 0x%x\n", WakeupBuffer));
//
- // Allocate Pages for APs stack, CPU MP Data and backup buffer for wakeup buffer
+ // Allocate Pages for APs stack, CPU MP Data, backup buffer for wakeup buffer,
+ // and monitor buffer if required.
//
MaxCpuCount = PcdGet32(PcdCpuMaxLogicalProcessorNumber);
BufferSize = PcdGet32 (PcdCpuApStackSize) * MaxCpuCount + sizeof (PEI_CPU_MP_DATA)
+ WakeupBufferSize + sizeof (PEI_CPU_DATA) * MaxCpuCount;
+ ApLoopMode = GetApLoopMode (&MonitorFilterSize);
+ BufferSize += MonitorFilterSize * MaxCpuCount;
Status = PeiServicesAllocatePages (
EfiBootServicesData,
EFI_SIZE_TO_PAGES (BufferSize),
@@ -627,7 +634,21 @@ PrepareAPStartupVector ( InitializeSpinLock(&PeiCpuMpData->MpLock);
SaveVolatileRegisters (&PeiCpuMpData->CpuData[0].VolatileRegisters);
CopyMem (&PeiCpuMpData->AddressMap, &AddressMap, sizeof (MP_ASSEMBLY_ADDRESS_MAP));
-
+ //
+ // Initialize AP loop mode
+ //
+ PeiCpuMpData->ApLoopMode = ApLoopMode;
+ DEBUG ((EFI_D_INFO, "AP Loop Mode is %d\n", PeiCpuMpData->ApLoopMode));
+ MonitorBuffer = (UINT8 *)(PeiCpuMpData->CpuData + MaxCpuCount);
+ if (PeiCpuMpData->ApLoopMode != ApInHltLoop) {
+ //
+ // Set up APs wakeup signal buffer
+ //
+ for (Index = 0; Index < MaxCpuCount; Index++) {
+ PeiCpuMpData->CpuData[Index].StartupApSignal =
+ (UINT32 *)(MonitorBuffer + MonitorFilterSize * Index);
+ }
+ }
//
// Backup original data and copy AP reset code in it
//
|