mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
UefiCpuPkg/PiSmmCpuDxeSmm: Combine INIT-SIPI-SIPI.
In S3 resume path, current implementation do 2 separate INIT-SIPI-SIPI, this is not necessary. This change combine these 2 INIT-SIPI-SIPI to 1 and add CpuPause between them. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
b6e0f0c6d1
commit
7677b4db62
@ -39,6 +39,11 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
SPIN_LOCK *mMemoryMappedLock = NULL;
|
SPIN_LOCK *mMemoryMappedLock = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Signal that SMM BASE relocation is complete.
|
||||||
|
//
|
||||||
|
volatile BOOLEAN mInitApsAfterSmmBaseReloc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get starting address and size of the rendezvous entry for APs.
|
Get starting address and size of the rendezvous entry for APs.
|
||||||
Information for fixing a jump instruction in the code is also returned.
|
Information for fixing a jump instruction in the code is also returned.
|
||||||
@ -342,17 +347,21 @@ SetProcessorRegister (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
AP initialization before SMBASE relocation in the S3 boot path.
|
AP initialization before then after SMBASE relocation in the S3 boot path.
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EarlyMPRendezvousProcedure (
|
MPRendezvousProcedure (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CPU_REGISTER_TABLE *RegisterTableList;
|
CPU_REGISTER_TABLE *RegisterTableList;
|
||||||
UINT32 InitApicId;
|
UINT32 InitApicId;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
UINTN TopOfStack;
|
||||||
|
UINT8 Stack[128];
|
||||||
|
|
||||||
LoadMtrrData (mAcpiCpuData.MtrrTable);
|
LoadMtrrData (mAcpiCpuData.MtrrTable);
|
||||||
|
|
||||||
@ -368,25 +377,18 @@ EarlyMPRendezvousProcedure (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Count down the number with lock mechanism.
|
// Count down the number with lock mechanism.
|
||||||
//
|
//
|
||||||
InterlockedDecrement (&mNumberToFinish);
|
InterlockedDecrement (&mNumberToFinish);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
AP initialization after SMBASE relocation in the S3 boot path.
|
// Wait for BSP to signal SMM Base relocation done.
|
||||||
**/
|
//
|
||||||
VOID
|
while (!mInitApsAfterSmmBaseReloc) {
|
||||||
MPRendezvousProcedure (
|
CpuPause ();
|
||||||
VOID
|
}
|
||||||
)
|
|
||||||
{
|
|
||||||
CPU_REGISTER_TABLE *RegisterTableList;
|
|
||||||
UINT32 InitApicId;
|
|
||||||
UINTN Index;
|
|
||||||
UINTN TopOfStack;
|
|
||||||
UINT8 Stack[128];
|
|
||||||
|
|
||||||
ProgramVirtualWireMode ();
|
ProgramVirtualWireMode ();
|
||||||
DisableLvtInterrupts ();
|
DisableLvtInterrupts ();
|
||||||
@ -500,7 +502,12 @@ EarlyInitializeCpu (
|
|||||||
PrepareApStartupVector (mAcpiCpuData.StartupVector);
|
PrepareApStartupVector (mAcpiCpuData.StartupVector);
|
||||||
|
|
||||||
mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1;
|
mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1;
|
||||||
mExchangeInfo->ApFunction = (VOID *) (UINTN) EarlyMPRendezvousProcedure;
|
mExchangeInfo->ApFunction = (VOID *) (UINTN) MPRendezvousProcedure;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Execute code for before SmmBaseReloc. Note: This flag is maintained across S3 boots.
|
||||||
|
//
|
||||||
|
mInitApsAfterSmmBaseReloc = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Send INIT IPI - SIPI to all APs
|
// Send INIT IPI - SIPI to all APs
|
||||||
@ -538,17 +545,11 @@ InitializeCpu (
|
|||||||
}
|
}
|
||||||
|
|
||||||
mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1;
|
mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1;
|
||||||
//
|
|
||||||
// StackStart was updated when APs were waken up in EarlyInitializeCpu.
|
|
||||||
// Re-initialize StackAddress to original beginning address.
|
|
||||||
//
|
|
||||||
mExchangeInfo->StackStart = (VOID *) (UINTN) mAcpiCpuData.StackAddress;
|
|
||||||
mExchangeInfo->ApFunction = (VOID *) (UINTN) MPRendezvousProcedure;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Send INIT IPI - SIPI to all APs
|
// Signal that SMM base relocation is complete and to continue initialization.
|
||||||
//
|
//
|
||||||
SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector);
|
mInitApsAfterSmmBaseReloc = TRUE;
|
||||||
|
|
||||||
while (mNumberToFinish > 0) {
|
while (mNumberToFinish > 0) {
|
||||||
CpuPause ();
|
CpuPause ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user