diff options
author | Jeff Fan <jeff.fan@intel.com> | 2016-05-23 13:44:13 +0800 |
---|---|---|
committer | Jeff Fan <jeff.fan@intel.com> | 2016-05-30 09:41:02 +0800 |
commit | 265fff39483bc2e1550bbb9546b9c330e6118e25 (patch) | |
tree | a0a207d8ad567c0a4524c5dcc1a2442edb2e21f8 /MdeModulePkg/Core | |
parent | ebaafbe62c70309d0ceb44a0c4199093d0a823c4 (diff) | |
download | edk2-platforms-265fff39483bc2e1550bbb9546b9c330e6118e25.tar.xz |
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')
-rw-r--r-- | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 48 | ||||
-rw-r--r-- | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 3 |
2 files changed, 49 insertions, 2 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)
//
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf index 6f027a6056..07a765b5d2 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf @@ -1,7 +1,7 @@ ## @file
# This module provide an SMM CIS compliant implementation of SMM IPL.
#
-# 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
@@ -50,6 +50,7 @@ UefiRuntimeLib
DxeServicesLib
PcdLib
+ ReportStatusCodeLib
[Protocols]
gEfiSmmBase2ProtocolGuid ## PRODUCES
|