Revision: 19361
http://sourceforge.net/p/edk2/code/19361
Author: vanjeff
Date: 2015-12-18 05:49:28 +0000 (Fri, 18 Dec 2015)
Log Message:
-----------
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 <[email protected]>
Cc: Michael Kinney <[email protected]>
Cc: Jordan Justen <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <[email protected]>
Tested-by: Michael Kinney <[email protected]>
Reviewed-by: Michael Kinney <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/19344
Modified Paths:
--------------
branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.c
branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.h
Modified: branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.c
===================================================================
--- branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.c 2015-12-18 05:48:45 UTC
(rev 19360)
+++ branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.c 2015-12-18 05:49:28 UTC
(rev 19361)
@@ -589,6 +589,10 @@
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 @@
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,8 +634,22 @@
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
//
BackupAndPrepareWakeupBuffer(PeiCpuMpData);
Modified: branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.h
===================================================================
--- branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.h 2015-12-18 05:48:45 UTC
(rev 19360)
+++ branches/UDK2015/UefiCpuPkg/CpuMpPei/CpuMpPei.h 2015-12-18 05:49:28 UTC
(rev 19361)
@@ -134,6 +134,7 @@
} CPU_VOLATILE_REGISTERS;
typedef struct {
+ volatile UINT32 *StartupApSignal;
UINT32 ApicId;
EFI_HEALTH_FLAGS Health;
CPU_STATE State;
@@ -163,6 +164,8 @@
CPU_EXCHANGE_ROLE_INFO BSPInfo;
CPU_EXCHANGE_ROLE_INFO APInfo;
MTRR_SETTINGS MtrrTable;
+ UINT8 ApLoopMode;
+ UINT8 ApTargetCState;
PEI_CPU_DATA *CpuData;
volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;
};
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits