UefiCpuPkg/PiSmmCpuDxeSmm: Consume PcdAcpiS3Enable to control the code

if PcdAcpiS3Enable is disabled, then skip S3 related logic.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Star Zeng 2016-07-20 10:24:58 +08:00 committed by Michael Kinney
parent 0bdc9e75c0
commit b10d5ddc03
4 changed files with 37 additions and 0 deletions

View File

@ -75,6 +75,8 @@ BOOLEAN mSmmS3Flag = FALSE;
// //
SMM_S3_RESUME_STATE *mSmmS3ResumeState = NULL; SMM_S3_RESUME_STATE *mSmmS3ResumeState = NULL;
BOOLEAN mAcpiS3Enable = TRUE;
/** /**
Get MSR spin lock by MSR index. Get MSR spin lock by MSR index.
@ -548,6 +550,10 @@ RestoreSmmConfigurationInS3 (
VOID VOID
) )
{ {
if (!mAcpiS3Enable) {
return;
}
// //
// Restore SMM Configuration in S3 boot path. // Restore SMM Configuration in S3 boot path.
// //
@ -726,6 +732,10 @@ InitSmmS3ResumeState (
EFI_SMRAM_DESCRIPTOR *SmramDescriptor; EFI_SMRAM_DESCRIPTOR *SmramDescriptor;
SMM_S3_RESUME_STATE *SmmS3ResumeState; SMM_S3_RESUME_STATE *SmmS3ResumeState;
if (!mAcpiS3Enable) {
return;
}
GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid); GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid);
if (GuidHob != NULL) { if (GuidHob != NULL) {
SmramDescriptor = (EFI_SMRAM_DESCRIPTOR *) GET_GUID_HOB_DATA (GuidHob); SmramDescriptor = (EFI_SMRAM_DESCRIPTOR *) GET_GUID_HOB_DATA (GuidHob);
@ -817,6 +827,10 @@ GetAcpiCpuData (
IA32_DESCRIPTOR *Gdtr; IA32_DESCRIPTOR *Gdtr;
IA32_DESCRIPTOR *Idtr; IA32_DESCRIPTOR *Idtr;
if (!mAcpiS3Enable) {
return;
}
// //
// Prevent use of mAcpiCpuData by initialize NumberOfCpus to 0 // Prevent use of mAcpiCpuData by initialize NumberOfCpus to 0
// //
@ -883,3 +897,15 @@ GetAcpiCpuData (
CopyMem (mIdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1); CopyMem (mIdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
CopyMem (mMachineCheckHandlerForAp, (VOID *)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase, mAcpiCpuData.ApMachineCheckHandlerSize); CopyMem (mMachineCheckHandlerForAp, (VOID *)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase, mAcpiCpuData.ApMachineCheckHandlerSize);
} }
/**
Get ACPI S3 enable flag.
**/
VOID
GetAcpiS3EnableFlag (
VOID
)
{
mAcpiS3Enable = PcdGetBool (PcdAcpiS3Enable);
}

View File

@ -910,6 +910,7 @@ PiCpuSmmEntry (
// //
InitSmmProfile (Cr3); InitSmmProfile (Cr3);
GetAcpiS3EnableFlag ();
InitSmmS3ResumeState (Cr3); InitSmmS3ResumeState (Cr3);
DEBUG ((EFI_D_INFO, "SMM CPU Module exit from SMRAM with EFI_SUCCESS\n")); DEBUG ((EFI_D_INFO, "SMM CPU Module exit from SMRAM with EFI_SUCCESS\n"));

View File

@ -816,4 +816,13 @@ RestoreSmmConfigurationInS3 (
VOID VOID
); );
/**
Get ACPI S3 enable flag.
**/
VOID
GetAcpiS3EnableFlag (
VOID
);
#endif #endif

View File

@ -153,6 +153,7 @@
gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugDataAddress ## SOMETIMES_PRODUCES gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugDataAddress ## SOMETIMES_PRODUCES
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
[Depex] [Depex]
gEfiMpServiceProtocolGuid gEfiMpServiceProtocolGuid