mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 14:44:28 +02:00
MdeModulePkg/PiSmmCore: Control S3 related functionality through flag.
https://bugzilla.tianocore.org/show_bug.cgi?id=1590 Use PcdAcpiS3Enable to control whether need to enable S3 related functionality in Pi SMM Core. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
6c27a4d337
commit
bb2c9ccb33
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
SMM Core Main Entry Point
|
SMM Core Main Entry Point
|
||||||
|
|
||||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
@ -77,6 +77,12 @@ BOOLEAN mInLegacyBoot = FALSE;
|
|||||||
//
|
//
|
||||||
BOOLEAN mDuringS3Resume = FALSE;
|
BOOLEAN mDuringS3Resume = FALSE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flag to determine if platform enabled S3.
|
||||||
|
// Get the value from PcdAcpiS3Enable.
|
||||||
|
//
|
||||||
|
BOOLEAN mAcpiS3Enable = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Table of SMI Handlers that are registered by the SMM Core when it is initialized
|
// Table of SMI Handlers that are registered by the SMM Core when it is initialized
|
||||||
//
|
//
|
||||||
@ -87,6 +93,13 @@ SMM_CORE_SMI_HANDLERS mSmmCoreSmiHandlers[] = {
|
|||||||
{ SmmExitBootServicesHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },
|
{ SmmExitBootServicesHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },
|
||||||
{ SmmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
|
{ SmmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
|
||||||
{ SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, TRUE },
|
{ SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, TRUE },
|
||||||
|
{ NULL, NULL, NULL, FALSE }
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Table of SMI Handlers that are registered by the SMM Core when it is initialized
|
||||||
|
//
|
||||||
|
SMM_CORE_SMI_HANDLERS mSmmCoreS3SmiHandlers[] = {
|
||||||
{ SmmS3SmmInitDoneHandler, &gEdkiiS3SmmInitDoneGuid, NULL, FALSE },
|
{ SmmS3SmmInitDoneHandler, &gEdkiiS3SmmInitDoneGuid, NULL, FALSE },
|
||||||
{ SmmEndOfS3ResumeHandler, &gEdkiiEndOfS3ResumeGuid, NULL, FALSE },
|
{ SmmEndOfS3ResumeHandler, &gEdkiiEndOfS3ResumeGuid, NULL, FALSE },
|
||||||
{ NULL, NULL, NULL, FALSE }
|
{ NULL, NULL, NULL, FALSE }
|
||||||
@ -445,28 +458,30 @@ SmmEndOfDxeHandler (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
if (mAcpiS3Enable) {
|
||||||
// Locate SmmSxDispatch2 protocol.
|
|
||||||
//
|
|
||||||
Status = SmmLocateProtocol (
|
|
||||||
&gEfiSmmSxDispatch2ProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **)&SxDispatch
|
|
||||||
);
|
|
||||||
if (!EFI_ERROR (Status) && (SxDispatch != NULL)) {
|
|
||||||
//
|
//
|
||||||
// Register a S3 entry callback function to
|
// Locate SmmSxDispatch2 protocol.
|
||||||
// determine if it will be during S3 resume.
|
|
||||||
//
|
//
|
||||||
EntryRegisterContext.Type = SxS3;
|
Status = SmmLocateProtocol (
|
||||||
EntryRegisterContext.Phase = SxEntry;
|
&gEfiSmmSxDispatch2ProtocolGuid,
|
||||||
Status = SxDispatch->Register (
|
NULL,
|
||||||
SxDispatch,
|
(VOID **)&SxDispatch
|
||||||
SmmS3EntryCallBack,
|
);
|
||||||
&EntryRegisterContext,
|
if (!EFI_ERROR (Status) && (SxDispatch != NULL)) {
|
||||||
&S3EntryHandle
|
//
|
||||||
);
|
// Register a S3 entry callback function to
|
||||||
ASSERT_EFI_ERROR (Status);
|
// determine if it will be during S3 resume.
|
||||||
|
//
|
||||||
|
EntryRegisterContext.Type = SxS3;
|
||||||
|
EntryRegisterContext.Phase = SxEntry;
|
||||||
|
Status = SxDispatch->Register (
|
||||||
|
SxDispatch,
|
||||||
|
SmmS3EntryCallBack,
|
||||||
|
&EntryRegisterContext,
|
||||||
|
&S3EntryHandle
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -883,6 +898,21 @@ SmmMain (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mAcpiS3Enable = PcdGetBool (PcdAcpiS3Enable);
|
||||||
|
if (mAcpiS3Enable) {
|
||||||
|
//
|
||||||
|
// Register all S3 related SMI Handlers required by the SMM Core
|
||||||
|
//
|
||||||
|
for (Index = 0; mSmmCoreS3SmiHandlers[Index].HandlerType != NULL; Index++) {
|
||||||
|
Status = SmiHandlerRegister (
|
||||||
|
mSmmCoreS3SmiHandlers[Index].Handler,
|
||||||
|
mSmmCoreS3SmiHandlers[Index].HandlerType,
|
||||||
|
&mSmmCoreS3SmiHandlers[Index].DispatchHandle
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RegisterSmramProfileHandler ();
|
RegisterSmramProfileHandler ();
|
||||||
SmramProfileInstallProtocol ();
|
SmramProfileInstallProtocol ();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# This module provide an SMM CIS compliant implementation of SMM Core.
|
# This module provide an SMM CIS compliant implementation of SMM Core.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -101,6 +101,7 @@
|
|||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gAprioriGuid ## SOMETIMES_CONSUMES ## File
|
gAprioriGuid ## SOMETIMES_CONSUMES ## File
|
||||||
|
Loading…
x
Reference in New Issue
Block a user