/** @file\r
SMM Core Main Entry Point\r
\r
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
distribution. The full text of the license may be found at\r
//\r
BOOLEAN mDuringS3Resume = FALSE;\r
\r
+//\r
+// Flag to determine if platform enabled S3.\r
+// Get the value from PcdAcpiS3Enable.\r
+//\r
+BOOLEAN mAcpiS3Enable = FALSE;\r
+\r
//\r
// Table of SMI Handlers that are registered by the SMM Core when it is initialized\r
//\r
{ SmmExitBootServicesHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },\r
{ SmmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },\r
{ SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, TRUE },\r
+ { NULL, NULL, NULL, FALSE }\r
+};\r
+\r
+//\r
+// Table of SMI Handlers that are registered by the SMM Core when it is initialized\r
+//\r
+SMM_CORE_SMI_HANDLERS mSmmCoreS3SmiHandlers[] = {\r
{ SmmS3SmmInitDoneHandler, &gEdkiiS3SmmInitDoneGuid, NULL, FALSE },\r
{ SmmEndOfS3ResumeHandler, &gEdkiiEndOfS3ResumeGuid, NULL, FALSE },\r
{ NULL, NULL, NULL, FALSE }\r
NULL\r
);\r
\r
- //\r
- // Locate SmmSxDispatch2 protocol.\r
- //\r
- Status = SmmLocateProtocol (\r
- &gEfiSmmSxDispatch2ProtocolGuid,\r
- NULL,\r
- (VOID **)&SxDispatch\r
- );\r
- if (!EFI_ERROR (Status) && (SxDispatch != NULL)) {\r
+ if (mAcpiS3Enable) {\r
//\r
- // Register a S3 entry callback function to\r
- // determine if it will be during S3 resume.\r
+ // Locate SmmSxDispatch2 protocol.\r
//\r
- EntryRegisterContext.Type = SxS3;\r
- EntryRegisterContext.Phase = SxEntry;\r
- Status = SxDispatch->Register (\r
- SxDispatch,\r
- SmmS3EntryCallBack,\r
- &EntryRegisterContext,\r
- &S3EntryHandle\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ Status = SmmLocateProtocol (\r
+ &gEfiSmmSxDispatch2ProtocolGuid,\r
+ NULL,\r
+ (VOID **)&SxDispatch\r
+ );\r
+ if (!EFI_ERROR (Status) && (SxDispatch != NULL)) {\r
+ //\r
+ // Register a S3 entry callback function to\r
+ // determine if it will be during S3 resume.\r
+ //\r
+ EntryRegisterContext.Type = SxS3;\r
+ EntryRegisterContext.Phase = SxEntry;\r
+ Status = SxDispatch->Register (\r
+ SxDispatch,\r
+ SmmS3EntryCallBack,\r
+ &EntryRegisterContext,\r
+ &S3EntryHandle\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
}\r
\r
return EFI_SUCCESS;\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
+ mAcpiS3Enable = PcdGetBool (PcdAcpiS3Enable);\r
+ if (mAcpiS3Enable) {\r
+ //\r
+ // Register all S3 related SMI Handlers required by the SMM Core\r
+ //\r
+ for (Index = 0; mSmmCoreS3SmiHandlers[Index].HandlerType != NULL; Index++) {\r
+ Status = SmiHandlerRegister (\r
+ mSmmCoreS3SmiHandlers[Index].Handler,\r
+ mSmmCoreS3SmiHandlers[Index].HandlerType,\r
+ &mSmmCoreS3SmiHandlers[Index].DispatchHandle\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+ }\r
+\r
RegisterSmramProfileHandler ();\r
SmramProfileInstallProtocol ();\r
\r