summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/PiSmmCore
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2017-12-14 16:20:32 +0800
committerStar Zeng <star.zeng@intel.com>2017-12-15 10:38:11 +0800
commitb36acb21c0ff7e8502627a71673d37e996aeb4b6 (patch)
tree065148ca1940acebcb6b4e2ef9a23ce68d738146 /MdeModulePkg/Core/PiSmmCore
parent27dc016c3f004c9e390057e93a48bd4a498fcc4c (diff)
downloadedk2-b36acb21c0ff7e8502627a71673d37e996aeb4b6.tar.gz
edk2-b36acb21c0ff7e8502627a71673d37e996aeb4b6.tar.bz2
edk2-b36acb21c0ff7e8502627a71673d37e996aeb4b6.zip
MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler()
As some implementation of SMM Child Dispatcher (including SxDispatch) may deny the handler registration after SmmReadyToLock, using SxDispatch in SmmReadyToBootHandler() will be too late. This patch updates code to use SxDispatch in SmmEndOfDxeHandler() instead of SmmReadyToBootHandler(). Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Core/PiSmmCore')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmCore.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index f136b5d569..d2f0207b5c 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -296,9 +296,6 @@ SmmReadyToBootHandler (
{
EFI_STATUS Status;
EFI_HANDLE SmmHandle;
- EFI_SMM_SX_DISPATCH2_PROTOCOL *SxDispatch;
- EFI_SMM_SX_REGISTER_CONTEXT EntryRegisterContext;
- EFI_HANDLE S3EntryHandle;
//
// Install SMM Ready To Boot protocol.
@@ -313,31 +310,7 @@ SmmReadyToBootHandler (
SmiHandlerUnRegister (DispatchHandle);
- //
- // Locate SmmSxDispatch2 protocol.
- //
- Status = SmmLocateProtocol (
- &gEfiSmmSxDispatch2ProtocolGuid,
- NULL,
- (VOID **)&SxDispatch
- );
- if (!EFI_ERROR (Status) && (SxDispatch != NULL)) {
- //
- // Register a S3 entry callback function to
- // 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 Status;
}
/**
@@ -452,10 +425,14 @@ SmmEndOfDxeHandler (
IN OUT UINTN *CommBufferSize OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_HANDLE SmmHandle;
+ EFI_STATUS Status;
+ EFI_HANDLE SmmHandle;
+ EFI_SMM_SX_DISPATCH2_PROTOCOL *SxDispatch;
+ EFI_SMM_SX_REGISTER_CONTEXT EntryRegisterContext;
+ EFI_HANDLE S3EntryHandle;
DEBUG ((EFI_D_INFO, "SmmEndOfDxeHandler\n"));
+
//
// Install SMM EndOfDxe protocol
//
@@ -466,7 +443,32 @@ SmmEndOfDxeHandler (
EFI_NATIVE_INTERFACE,
NULL
);
- return Status;
+
+ //
+ // Locate SmmSxDispatch2 protocol.
+ //
+ Status = SmmLocateProtocol (
+ &gEfiSmmSxDispatch2ProtocolGuid,
+ NULL,
+ (VOID **)&SxDispatch
+ );
+ if (!EFI_ERROR (Status) && (SxDispatch != NULL)) {
+ //
+ // Register a S3 entry callback function to
+ // 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;
}
/**
@@ -526,7 +528,6 @@ SmmEndOfS3ResumeHandler (
ASSERT_EFI_ERROR (Status);
mDuringS3Resume = FALSE;
-
return Status;
}