mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 05:34:31 +02:00
UefiCpuPkg/CpuMpPei: Prepare for monitor buffer
Get AP loop mode to prepare for the monitor buffer required for ApInMwaitLoop and ApInRunLoop. 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/trunk/edk2@19344 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4de216c016
commit
e001e11f90
@ -589,6 +589,10 @@ PrepareAPStartupVector (
|
|||||||
UINTN WakeupBuffer;
|
UINTN WakeupBuffer;
|
||||||
UINTN WakeupBufferSize;
|
UINTN WakeupBufferSize;
|
||||||
MP_ASSEMBLY_ADDRESS_MAP AddressMap;
|
MP_ASSEMBLY_ADDRESS_MAP AddressMap;
|
||||||
|
UINT8 ApLoopMode;
|
||||||
|
UINT16 MonitorFilterSize;
|
||||||
|
UINT8 *MonitorBuffer;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
AsmGetAddressMap (&AddressMap);
|
AsmGetAddressMap (&AddressMap);
|
||||||
WakeupBufferSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
|
WakeupBufferSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
|
||||||
@ -597,11 +601,14 @@ PrepareAPStartupVector (
|
|||||||
DEBUG ((EFI_D_INFO, "CpuMpPei: WakeupBuffer = 0x%x\n", WakeupBuffer));
|
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);
|
MaxCpuCount = PcdGet32(PcdCpuMaxLogicalProcessorNumber);
|
||||||
BufferSize = PcdGet32 (PcdCpuApStackSize) * MaxCpuCount + sizeof (PEI_CPU_MP_DATA)
|
BufferSize = PcdGet32 (PcdCpuApStackSize) * MaxCpuCount + sizeof (PEI_CPU_MP_DATA)
|
||||||
+ WakeupBufferSize + sizeof (PEI_CPU_DATA) * MaxCpuCount;
|
+ WakeupBufferSize + sizeof (PEI_CPU_DATA) * MaxCpuCount;
|
||||||
|
ApLoopMode = GetApLoopMode (&MonitorFilterSize);
|
||||||
|
BufferSize += MonitorFilterSize * MaxCpuCount;
|
||||||
Status = PeiServicesAllocatePages (
|
Status = PeiServicesAllocatePages (
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
EFI_SIZE_TO_PAGES (BufferSize),
|
EFI_SIZE_TO_PAGES (BufferSize),
|
||||||
@ -627,7 +634,21 @@ PrepareAPStartupVector (
|
|||||||
InitializeSpinLock(&PeiCpuMpData->MpLock);
|
InitializeSpinLock(&PeiCpuMpData->MpLock);
|
||||||
SaveVolatileRegisters (&PeiCpuMpData->CpuData[0].VolatileRegisters);
|
SaveVolatileRegisters (&PeiCpuMpData->CpuData[0].VolatileRegisters);
|
||||||
CopyMem (&PeiCpuMpData->AddressMap, &AddressMap, sizeof (MP_ASSEMBLY_ADDRESS_MAP));
|
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
|
// Backup original data and copy AP reset code in it
|
||||||
//
|
//
|
||||||
|
@ -134,6 +134,7 @@ typedef struct {
|
|||||||
} CPU_VOLATILE_REGISTERS;
|
} CPU_VOLATILE_REGISTERS;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
volatile UINT32 *StartupApSignal;
|
||||||
UINT32 ApicId;
|
UINT32 ApicId;
|
||||||
EFI_HEALTH_FLAGS Health;
|
EFI_HEALTH_FLAGS Health;
|
||||||
CPU_STATE State;
|
CPU_STATE State;
|
||||||
@ -163,6 +164,8 @@ struct _PEI_CPU_MP_DATA {
|
|||||||
CPU_EXCHANGE_ROLE_INFO BSPInfo;
|
CPU_EXCHANGE_ROLE_INFO BSPInfo;
|
||||||
CPU_EXCHANGE_ROLE_INFO APInfo;
|
CPU_EXCHANGE_ROLE_INFO APInfo;
|
||||||
MTRR_SETTINGS MtrrTable;
|
MTRR_SETTINGS MtrrTable;
|
||||||
|
UINT8 ApLoopMode;
|
||||||
|
UINT8 ApTargetCState;
|
||||||
PEI_CPU_DATA *CpuData;
|
PEI_CPU_DATA *CpuData;
|
||||||
volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;
|
volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user