summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-05-23 13:44:13 +0800
committerJeff Fan <jeff.fan@intel.com>2016-05-30 09:41:02 +0800
commit265fff39483bc2e1550bbb9546b9c330e6118e25 (patch)
treea0a207d8ad567c0a4524c5dcc1a2442edb2e21f8 /MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
parentebaafbe62c70309d0ceb44a0c4199093d0a823c4 (diff)
downloadedk2-265fff39483bc2e1550bbb9546b9c330e6118e25.tar.gz
edk2-265fff39483bc2e1550bbb9546b9c330e6118e25.tar.bz2
edk2-265fff39483bc2e1550bbb9546b9c330e6118e25.zip
MdeModulePkg/PiSmmIpl: Check order of EndOfDxe and DxeSmmReadyToLock
According to PI specification, EndOfDxe Event should be signaled before DxeSmmReadyToLock protocol installation. This update is ASSERT if EndOfDxe Event is not signaled when DxeSmmReadyToLock protocol installed. And do REPORT_STATUS_CODE() also. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 50c3b34dfd..acfcc83e4f 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -1,7 +1,7 @@
/** @file
SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -38,6 +38,7 @@
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/PcdLib.h>
+#include <Library/ReportStatusCodeLib.h>
#include "PiSmmCorePrivateData.h"
@@ -163,6 +164,20 @@ SmmIplGuidedEventNotify (
);
/**
+ Event notification that is fired when EndOfDxe Event Group is signaled.
+
+ @param Event The Event that is being processed, not used.
+ @param Context Event Context, not used.
+
+**/
+VOID
+EFIAPI
+SmmIplEndOfDxeEventNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
@@ -243,6 +258,7 @@ EFI_SMM_CONTROL2_PROTOCOL *mSmmControl2;
EFI_SMM_ACCESS2_PROTOCOL *mSmmAccess;
EFI_SMRAM_DESCRIPTOR *mCurrentSmramRange;
BOOLEAN mSmmLocked = FALSE;
+BOOLEAN mEndOfDxe = FALSE;
EFI_PHYSICAL_ADDRESS mSmramCacheBase;
UINT64 mSmramCacheSize;
@@ -271,6 +287,10 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
//
{ FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplGuidedEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },
//
+ // Declare event notification on EndOfDxe event. This is used to set EndOfDxe event signaled flag.
+ //
+ { FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplEndOfDxeEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },
+ //
// Declare event notification on the DXE Dispatch Event Group. This event is signaled by the DXE Core
// each time the DXE Core dispatcher has completed its work. When this event is signalled, the SMM Core
// if notified, so the SMM Core can dispatch SMM drivers.
@@ -557,6 +577,23 @@ SmmIplGuidedEventNotify (
}
/**
+ Event notification that is fired when EndOfDxe Event Group is signaled.
+
+ @param Event The Event that is being processed, not used.
+ @param Context Event Context, not used.
+
+**/
+VOID
+EFIAPI
+SmmIplEndOfDxeEventNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ mEndOfDxe = TRUE;
+}
+
+/**
Event notification that is fired when DxeDispatch Event Group is signaled.
@param Event The Event that is being processed, not used.
@@ -711,6 +748,15 @@ SmmIplReadyToLockEventNotify (
DEBUG ((DEBUG_WARN, "SMM IPL! DXE SMM Ready To Lock Protocol not installed before Ready To Boot signal\n"));
}
+ if (!mEndOfDxe) {
+ DEBUG ((DEBUG_ERROR, "EndOfDxe Event must be signaled before DxeSmmReadyToLock Protocol installation!\n"));
+ REPORT_STATUS_CODE (
+ EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED,
+ (EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)
+ );
+ ASSERT (FALSE);
+ }
+
//
// Lock the SMRAM (Note: Locking SMRAM may not be supported on all platforms)
//