* [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler() @ 2017-12-15 1:40 Star Zeng [not found] ` <0C09AFA07DD0434D9E2A0C6AEB0483103B9C3E5E@shsmsx102.ccr.corp.intel.com> 0 siblings, 1 reply; 2+ messages in thread From: Star Zeng @ 2017-12-15 1:40 UTC (permalink / raw) To: edk2-devel; +Cc: Star Zeng, Jiewen Yao 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> --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 65 +++++++++++++++++---------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c index f136b5d5693b..d2f0207b5c83 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; } -- 2.7.0.windows.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
[parent not found: <0C09AFA07DD0434D9E2A0C6AEB0483103B9C3E5E@shsmsx102.ccr.corp.intel.com>]
* Re: [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler() [not found] ` <0C09AFA07DD0434D9E2A0C6AEB0483103B9C3E5E@shsmsx102.ccr.corp.intel.com> @ 2017-12-15 2:01 ` Yao, Jiewen 0 siblings, 0 replies; 2+ messages in thread From: Yao, Jiewen @ 2017-12-15 2:01 UTC (permalink / raw) To: Zeng, Star, edk2-devel@lists.01.org Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Star > Zeng > Sent: Friday, December 15, 2017 9:40 AM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com> > Subject: [edk2] [PATCH] 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> > --- > MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 65 > +++++++++++++++++---------------- > 1 file changed, 33 insertions(+), 32 deletions(-) > > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > index f136b5d5693b..d2f0207b5c83 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; > } > > -- > 2.7.0.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-15 1:57 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-12-15 1:40 [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler() Star Zeng [not found] ` <0C09AFA07DD0434D9E2A0C6AEB0483103B9C3E5E@shsmsx102.ccr.corp.intel.com> 2017-12-15 2:01 ` Yao, Jiewen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox