// SMM Relocation variables\r
//\r
volatile BOOLEAN *mRebased;\r
-volatile BOOLEAN mIsBsp;\r
\r
///\r
/// Handle for the SMM CPU Protocol\r
\r
EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[EXCEPTION_VECTOR_NUMBER];\r
\r
+UINT32 mBspApicId = 0;\r
+\r
//\r
// SMM stack information\r
//\r
VOID\r
)\r
{\r
- UINT32 ApicId;\r
- UINTN Index;\r
+ UINT32 ApicId;\r
+ UINTN Index;\r
+ BOOLEAN IsBsp;\r
\r
//\r
// Update SMM IDT entries' code segment and load IDT\r
AsmWriteIdtr (&gcSmiIdtr);\r
ApicId = GetApicId ();\r
\r
+ IsBsp = (BOOLEAN)(mBspApicId == ApicId);\r
+\r
ASSERT (mNumberOfCpus <= mMaxNumberOfCpus);\r
\r
for (Index = 0; Index < mNumberOfCpus; Index++) {\r
//\r
SmmCpuFeaturesInitializeProcessor (\r
Index,\r
- mIsBsp,\r
+ IsBsp,\r
gSmmCpuPrivate->ProcessorInfo,\r
&mCpuHotPlugData\r
);\r
// Check XD and BTS features on each processor on normal boot\r
//\r
CheckFeatureSupported ();\r
- } else if (mIsBsp) {\r
+ } else if (IsBsp) {\r
//\r
// BSP rebase is already done above.\r
// Initialize private data during S3 resume\r
SMRAM_SAVE_STATE_MAP BakBuf2;\r
SMRAM_SAVE_STATE_MAP *CpuStatePtr;\r
UINT8 *U8Ptr;\r
- UINT32 ApicId;\r
UINTN Index;\r
UINTN BspIndex;\r
\r
//\r
// Retrieve the local APIC ID of current processor\r
//\r
- ApicId = GetApicId ();\r
+ mBspApicId = GetApicId ();\r
\r
//\r
// Relocate SM bases for all APs\r
// This is APs' 1st SMI - rebase will be done here, and APs' default SMI handler will be overridden by gcSmmInitTemplate\r
//\r
- mIsBsp = FALSE;\r
BspIndex = (UINTN)-1;\r
for (Index = 0; Index < mNumberOfCpus; Index++) {\r
mRebased[Index] = FALSE;\r
- if (ApicId != (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId) {\r
+ if (mBspApicId != (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId) {\r
SendSmiIpi ((UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId);\r
//\r
// Wait for this AP to finish its 1st SMI\r
// Relocate BSP's SMM base\r
//\r
ASSERT (BspIndex != (UINTN)-1);\r
- mIsBsp = TRUE;\r
- SendSmiIpi (ApicId);\r
+ SendSmiIpi (mBspApicId);\r
//\r
// Wait for the BSP to finish its 1st SMI\r
//\r