\r
EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[EXCEPTION_VECTOR_NUMBER];\r
\r
-///\r
-/// SMM CPU Save State Protocol instance\r
-///\r
-EFI_SMM_CPU_SAVE_STATE_PROTOCOL mSmmCpuSaveState = {\r
- NULL\r
-};\r
-\r
//\r
// SMM stack information\r
//\r
}\r
\r
//\r
- // Do below CPU things for native platform only\r
+ // Skip initialization if mAcpiCpuData is not valid\r
//\r
- if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {\r
+ if (mAcpiCpuData.NumberOfCpus > 0) {\r
//\r
- // Skip initialization if mAcpiCpuData is not valid\r
+ // First time microcode load and restore MTRRs\r
//\r
- if (mAcpiCpuData.NumberOfCpus > 0) {\r
- //\r
- // First time microcode load and restore MTRRs\r
- //\r
- EarlyInitializeCpu ();\r
- }\r
+ EarlyInitializeCpu ();\r
}\r
\r
//\r
SmmRelocateBases ();\r
\r
//\r
- // Do below CPU things for native platform only\r
+ // Skip initialization if mAcpiCpuData is not valid\r
//\r
- if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {\r
+ if (mAcpiCpuData.NumberOfCpus > 0) {\r
//\r
- // Skip initialization if mAcpiCpuData is not valid\r
+ // Restore MSRs for BSP and all APs\r
//\r
- if (mAcpiCpuData.NumberOfCpus > 0) {\r
- //\r
- // Restore MSRs for BSP and all APs\r
- //\r
- InitializeCpu ();\r
- }\r
+ InitializeCpu ();\r
}\r
\r
//\r
//\r
mAcpiCpuData.NumberOfCpus = 0;\r
\r
- //\r
- // If FrameworkCompatibilitySspport is enabled, then do not copy CPU S3 Data into SMRAM\r
- //\r
- if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {\r
- goto Done;\r
- }\r
-\r
//\r
// If PcdCpuS3DataAddress was never set, then do not copy CPU S3 Data into SMRAM\r
//\r
\r
mSmmCpuPrivateData.SmmCoreEntryContext.CpuSaveStateSize = gSmmCpuPrivate->CpuSaveStateSize;\r
mSmmCpuPrivateData.SmmCoreEntryContext.CpuSaveState = gSmmCpuPrivate->CpuSaveState;\r
- mSmmCpuSaveState.CpuSaveState = (EFI_SMM_CPU_STATE **)gSmmCpuPrivate->CpuSaveState;\r
\r
//\r
// Allocate buffer for pointers to array in CPU_HOT_PLUG_DATA.\r
Status = InitializeSmmCpuServices (mSmmCpuHandle);\r
ASSERT_EFI_ERROR (Status);\r
\r
- if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {\r
- //\r
- // Install Framework SMM Save State Protocol into UEFI protocol database for backward compatibility\r
- //\r
- Status = SystemTable->BootServices->InstallMultipleProtocolInterfaces (\r
- &gSmmCpuPrivate->SmmCpuHandle,\r
- &gEfiSmmCpuSaveStateProtocolGuid,\r
- &mSmmCpuSaveState,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- //\r
- // The SmmStartupThisAp service in Framework SMST should always be non-null.\r
- // Update SmmStartupThisAp pointer in PI SMST here so that PI/Framework SMM thunk\r
- // can have it ready when constructing Framework SMST.\r
- //\r
- gSmst->SmmStartupThisAp = SmmStartupThisAp;\r
- }\r
-\r
//\r
// register SMM Ready To Lock Protocol notification\r
//\r
NewSmmFeatureControlMsr = SmmFeatureControlMsr;\r
if (mSmmCodeAccessCheckEnable) {\r
NewSmmFeatureControlMsr |= SMM_CODE_CHK_EN_BIT;\r
- }\r
- if (FeaturePcdGet (PcdCpuSmmFeatureControlMsrLock)) {\r
- NewSmmFeatureControlMsr |= SMM_FEATURE_CONTROL_LOCK_BIT;\r
+ if (FeaturePcdGet (PcdCpuSmmFeatureControlMsrLock)) {\r
+ NewSmmFeatureControlMsr |= SMM_FEATURE_CONTROL_LOCK_BIT;\r
+ }\r
}\r
\r
//\r
//\r
// Check to see if the Feature Control MSR is supported on this CPU\r
//\r
- Index = gSmst->CurrentlyExecutingCpu;\r
+ Index = gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu;\r
if (!SmmCpuFeaturesIsSmmRegisterSupported (Index, SmmRegFeatureControl)) {\r
mSmmCodeAccessCheckEnable = FALSE;\r
return;\r
//\r
if ((AsmReadMsr64 (EFI_MSR_SMM_MCA_CAP) & SMM_CODE_ACCESS_CHK_BIT) == 0) {\r
mSmmCodeAccessCheckEnable = FALSE;\r
- }\r
-\r
- //\r
- // If the SMM Code Access Check feature is disabled and the Feature Control MSR\r
- // is not being locked, then no additional work is required\r
- //\r
- if (!mSmmCodeAccessCheckEnable && !FeaturePcdGet (PcdCpuSmmFeatureControlMsrLock)) {\r
return;\r
}\r
\r
// Enable SMM Code Access Check feature for the APs.\r
//\r
for (Index = 0; Index < gSmst->NumberOfCpus; Index++) {\r
- if (Index != gSmst->CurrentlyExecutingCpu) {\r
+ if (Index != gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu) {\r
\r
//\r
// Acquire Config SMM Code Access Check spin lock. The AP will release the\r