/** @file\r
SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM\r
\r
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, 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
#include <Library/UefiLib.h>\r
#include <Library/UefiRuntimeLib.h>\r
#include <Library/PcdLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
\r
#include "PiSmmCorePrivateData.h"\r
\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Event notification that is fired when EndOfDxe Event Group is signaled.\r
+\r
+ @param Event The Event that is being processed, not used.\r
+ @param Context Event Context, not used.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+SmmIplEndOfDxeEventNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ );\r
+\r
/**\r
Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.\r
\r
EFI_SMM_ACCESS2_PROTOCOL *mSmmAccess;\r
EFI_SMRAM_DESCRIPTOR *mCurrentSmramRange;\r
BOOLEAN mSmmLocked = FALSE;\r
+BOOLEAN mEndOfDxe = FALSE;\r
EFI_PHYSICAL_ADDRESS mSmramCacheBase;\r
UINT64 mSmramCacheSize;\r
\r
//\r
{ FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplGuidedEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },\r
//\r
+ // Declare event notification on EndOfDxe event. This is used to set EndOfDxe event signaled flag.\r
+ //\r
+ { FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplEndOfDxeEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },\r
+ //\r
// Declare event notification on the DXE Dispatch Event Group. This event is signaled by the DXE Core\r
// each time the DXE Core dispatcher has completed its work. When this event is signalled, the SMM Core\r
// if notified, so the SMM Core can dispatch SMM drivers.\r
SmmCommunicationCommunicate (&mSmmCommunication, &mCommunicateHeader, &Size);\r
}\r
\r
+/**\r
+ Event notification that is fired when EndOfDxe Event Group is signaled.\r
+\r
+ @param Event The Event that is being processed, not used.\r
+ @param Context Event Context, not used.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+SmmIplEndOfDxeEventNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ mEndOfDxe = TRUE;\r
+}\r
+\r
/**\r
Event notification that is fired when DxeDispatch Event Group is signaled.\r
\r
DEBUG ((DEBUG_WARN, "SMM IPL! DXE SMM Ready To Lock Protocol not installed before Ready To Boot signal\n"));\r
}\r
\r
+ if (!mEndOfDxe) {\r
+ DEBUG ((DEBUG_ERROR, "EndOfDxe Event must be signaled before DxeSmmReadyToLock Protocol installation!\n"));\r
+ REPORT_STATUS_CODE (\r
+ EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED,\r
+ (EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)\r
+ );\r
+ ASSERT (FALSE);\r
+ }\r
+\r
//\r
// Lock the SMRAM (Note: Locking SMRAM may not be supported on all platforms)\r
//\r