From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 30AEA2216D8C6 for ; Thu, 14 Dec 2017 17:57:21 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2017 18:02:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,402,1508828400"; d="scan'208";a="13642863" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 14 Dec 2017 18:02:03 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 14 Dec 2017 18:02:02 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 14 Dec 2017 18:02:02 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Fri, 15 Dec 2017 10:01:36 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler() Thread-Index: AQHTdUW0r3R5S4FsD0WVLeGFT+f8gKNDIDeAgACGXjA= Date: Fri, 15 Dec 2017 02:01:35 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA49622@shsmsx102.ccr.corp.intel.com> References: <1513302024-10760-1-git-send-email-star.zeng@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B9C3E5E@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B9C3E5E@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTIzMzIzZjMtYTI4ZC00NzBhLWFhZDAtM2Y1NTAwMzkwZTVlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiI3dGR3dDNBdWNIQmJzVzc5ditXYnZtWEFMUWtwYyt0XC9EK0lQNHhnbDRLdUFyMkl6TXhpQXI4aVNhXC9zZnUwa3QifQ== x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Dec 2017 01:57:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of St= ar > Zeng > Sent: Friday, December 15, 2017 9:40 AM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Zeng, Star > Subject: [edk2] [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in > SmmEndOfDxeHandler() >=20 > As some implementation of SMM Child Dispatcher (including SxDispatch) may > deny the handler registration after SmmReadyToLock, using SxDispatch in > SmmReadyToBootHandler() will be too late. >=20 > This patch updates code to use SxDispatch in SmmEndOfDxeHandler() instead= of > SmmReadyToBootHandler(). >=20 > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 65 > +++++++++++++++++---------------- > 1 file changed, 33 insertions(+), 32 deletions(-) >=20 > 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; >=20 > // > // Install SMM Ready To Boot protocol. > @@ -313,31 +310,7 @@ SmmReadyToBootHandler ( >=20 > SmiHandlerUnRegister (DispatchHandle); >=20 > - // > - // Locate SmmSxDispatch2 protocol. > - // > - Status =3D SmmLocateProtocol ( > - &gEfiSmmSxDispatch2ProtocolGuid, > - NULL, > - (VOID **)&SxDispatch > - ); > - if (!EFI_ERROR (Status) && (SxDispatch !=3D NULL)) { > - // > - // Register a S3 entry callback function to > - // determine if it will be during S3 resume. > - // > - EntryRegisterContext.Type =3D SxS3; > - EntryRegisterContext.Phase =3D SxEntry; > - Status =3D SxDispatch->Register ( > - SxDispatch, > - SmmS3EntryCallBack, > - &EntryRegisterContext, > - &S3EntryHandle > - ); > - ASSERT_EFI_ERROR (Status); > - } > - > - return EFI_SUCCESS; > + return Status; > } >=20 > /** > @@ -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; >=20 > 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 =3D SmmLocateProtocol ( > + &gEfiSmmSxDispatch2ProtocolGuid, > + NULL, > + (VOID **)&SxDispatch > + ); > + if (!EFI_ERROR (Status) && (SxDispatch !=3D NULL)) { > + // > + // Register a S3 entry callback function to > + // determine if it will be during S3 resume. > + // > + EntryRegisterContext.Type =3D SxS3; > + EntryRegisterContext.Phase =3D SxEntry; > + Status =3D SxDispatch->Register ( > + SxDispatch, > + SmmS3EntryCallBack, > + &EntryRegisterContext, > + &S3EntryHandle > + ); > + ASSERT_EFI_ERROR (Status); > + } > + > + return EFI_SUCCESS; > } >=20 > /** > @@ -526,7 +528,6 @@ SmmEndOfS3ResumeHandler ( > ASSERT_EFI_ERROR (Status); >=20 > mDuringS3Resume =3D FALSE; > - > return Status; > } >=20 > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel