From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 A6B9921A00AE6 for ; Mon, 18 Mar 2019 18:51:18 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 18:51:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,496,1544515200"; d="scan'208";a="328480186" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 18 Mar 2019 18:51:17 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 18 Mar 2019 18:51:17 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 18 Mar 2019 18:51:17 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.134]) with mapi id 14.03.0415.000; Tue, 19 Mar 2019 09:51:15 +0800 From: "Wu, Hao A" To: "Dong, Eric" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] MdeModulePkg/PiSmmCore: Control S3 related functionality with flag. Thread-Index: AQHU0vgw5Z89J3/htE2PYL15yQyh9qYSReqw Date: Tue, 19 Mar 2019 01:51:14 +0000 Message-ID: References: <20190305020658.23408-1-eric.dong@intel.com> In-Reply-To: <20190305020658.23408-1-eric.dong@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdeModulePkg/PiSmmCore: Control S3 related functionality with flag. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 01:51:18 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Eric Dong > Sent: Tuesday, March 05, 2019 10:07 AM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch] MdeModulePkg/PiSmmCore: Control S3 related > functionality with flag. >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1590 >=20 > Use PcdAcpiS3Enable to control whether need to enable S3 related > functionality The above line does not pass the PatchCheck.py tool. Please help to re-format it. Also, please help to update the copyright year for the modified files. With the above things handled, Reviewed-by: Hao Wu Best Regards, Hao Wu > in Pi SMM Core. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong > --- > MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 70 > ++++++++++++++++++++++--------- > MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf | 1 + > 2 files changed, 51 insertions(+), 20 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > index d0bc65b564..bd19803c37 100644 > --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > @@ -77,6 +77,12 @@ BOOLEAN mInLegacyBoot =3D FALSE; > // > BOOLEAN mDuringS3Resume =3D FALSE; >=20 > +// > +// Flag to determine if platform enabled S3. > +// Get the value from PcdAcpiS3Enable. > +// > +BOOLEAN mAcpiS3Enable =3D FALSE; > + > // > // Table of SMI Handlers that are registered by the SMM Core when it is > initialized > // > @@ -87,6 +93,13 @@ SMM_CORE_SMI_HANDLERS > mSmmCoreSmiHandlers[] =3D { > { SmmExitBootServicesHandler, &gEfiEventExitBootServicesGuid, NUL= L, > FALSE }, > { SmmReadyToBootHandler, &gEfiEventReadyToBootGuid, NUL= L, > FALSE }, > { SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NUL= L, > TRUE }, > + { NULL, NULL, NUL= L, FALSE } > +}; > + > +// > +// Table of SMI Handlers that are registered by the SMM Core when it is > initialized > +// > +SMM_CORE_SMI_HANDLERS mSmmCoreS3SmiHandlers[] =3D { > { SmmS3SmmInitDoneHandler, &gEdkiiS3SmmInitDoneGuid, NUL= L, > FALSE }, > { SmmEndOfS3ResumeHandler, &gEdkiiEndOfS3ResumeGuid, NUL= L, > FALSE }, > { NULL, NULL, NUL= L, FALSE } > @@ -445,28 +458,30 @@ SmmEndOfDxeHandler ( > NULL > ); >=20 > - // > - // Locate SmmSxDispatch2 protocol. > - // > - Status =3D SmmLocateProtocol ( > - &gEfiSmmSxDispatch2ProtocolGuid, > - NULL, > - (VOID **)&SxDispatch > - ); > - if (!EFI_ERROR (Status) && (SxDispatch !=3D NULL)) { > + if (mAcpiS3Enable) { > // > - // Register a S3 entry callback function to > - // determine if it will be during S3 resume. > + // Locate SmmSxDispatch2 protocol. > // > - EntryRegisterContext.Type =3D SxS3; > - EntryRegisterContext.Phase =3D SxEntry; > - Status =3D SxDispatch->Register ( > - SxDispatch, > - SmmS3EntryCallBack, > - &EntryRegisterContext, > - &S3EntryHandle > - ); > - ASSERT_EFI_ERROR (Status); > + 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); > + } > } >=20 > return EFI_SUCCESS; > @@ -883,6 +898,21 @@ SmmMain ( > ASSERT_EFI_ERROR (Status); > } >=20 > + mAcpiS3Enable =3D PcdGetBool (PcdAcpiS3Enable); > + if (mAcpiS3Enable) { > + // > + // Register all S3 related SMI Handlers required by the SMM Core > + // > + for (Index =3D 0; mSmmCoreS3SmiHandlers[Index].HandlerType !=3D NULL= ; > Index++) { > + Status =3D SmiHandlerRegister ( > + mSmmCoreS3SmiHandlers[Index].Handler, > + mSmmCoreS3SmiHandlers[Index].HandlerType, > + &mSmmCoreS3SmiHandlers[Index].DispatchHandle > + ); > + ASSERT_EFI_ERROR (Status); > + } > + } > + > RegisterSmramProfileHandler (); > SmramProfileInstallProtocol (); >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > index f3ece22121..9a31cb79d6 100644 > --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf > @@ -101,6 +101,7 @@ > gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType = ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType = ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask > ## CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable = ## > CONSUMES >=20 > [Guids] > gAprioriGuid ## SOMETIMES_CONSUMES = ## File > -- > 2.15.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel