From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: chasel.chiu@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Mon, 30 Sep 2019 17:19:12 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 17:19:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,569,1559545200"; d="scan'208";a="342821533" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by orsmga004.jf.intel.com with ESMTP; 30 Sep 2019 17:19:10 -0700 Received: from pgsmsx112.gar.corp.intel.com ([169.254.3.2]) by KMSMSX152.gar.corp.intel.com ([169.254.11.65]) with mapi id 14.03.0439.000; Tue, 1 Oct 2019 08:19:09 +0800 From: "Chiu, Chasel" To: "devel@edk2.groups.io" CC: "Wu, Hao A" , "Dong, Eric" , "Desimone, Nathaniel L" , "Gao, Liming" , Laszlo Ersek , "Chiu, Chasel" Subject: Re: [edk2-devel] [PATCH v3] MdeModulePkg: Enable/Disable S3BootScript dynamically. Thread-Topic: [edk2-devel] [PATCH v3] MdeModulePkg: Enable/Disable S3BootScript dynamically. Thread-Index: AQHVdQhcr2m8oDfV1U2pLCaE90ZFRKdE8Xlw Date: Tue, 1 Oct 2019 00:19:08 +0000 Message-ID: <3C3EFB470A303B4AB093197B6777CCEC504EE442@PGSMSX112.gar.corp.intel.com> References: <15C83C366689EC81.3061@groups.io> In-Reply-To: <15C83C366689EC81.3061@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzRlNDdiOGEtZmMxYy00NWM0LThjMTctZjc5MDYwOWUwZDMxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOUhyVmN1a2hhUU0yY1haZzJIUU5QOGVHVW84K2pPWTNvSytoUEtEWTUwTEd3WHU3QnltSEFaRmRDZ2JLVWljaSJ9 x-ctpclassification: CTP_NT x-originating-ip: [172.30.20.206] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Change pushed: ed9db1b91ceba7d3a24743d4d9314c6fbe11c4b3 Thanks! Chasel > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Chiu, > Chasel > Sent: Friday, September 27, 2019 3:51 PM > To: devel@edk2.groups.io > Cc: Wu, Hao A ; Dong, Eric ; > Desimone, Nathaniel L ; Gao, Liming > ; Laszlo Ersek > Subject: [edk2-devel] [PATCH v3] MdeModulePkg: Enable/Disable > S3BootScript dynamically. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2212 >=20 > In binary model the same binary may have to support both > S3 enabled and disabled scenarios, however not all DXE drivers linking > PiDxeS3BootScriptLib can return error to invoke library DESTRUCTOR for > releasing resource. >=20 > To support this usage model below PCD is used to skip S3BootScript > functions when PCD set to FALSE: > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable >=20 > Test: Verified on internal platform and S3BootScript > functions can be skipped by PCD during boot time. >=20 > Cc: Hao A Wu > Cc: Eric Dong > Cc: Nate DeSimone > Cc: Liming Gao > Cc: Laszlo Ersek > Signed-off-by: Chasel Chiu > --- > MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c | 17 > ++++++++++++++++- > MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf | 4 > ++-- > 2 files changed, 18 insertions(+), 3 deletions(-) >=20 > diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > index c116727531..9106e7d0f9 100644 > --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > @@ -1,7 +1,7 @@ > /** @file > Save the S3 data to S3 boot script. >=20 > - Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved. > + Copyright (c) 2006 - 2019, Intel Corporation. All rights > + reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -124,6 +124,7 @@ VOID > *mRegistrationSmmReadyToLock =3D NULL; > BOOLEAN mS3BootScriptTableAllocated =3D > FALSE; > BOOLEAN mS3BootScriptTableSmmAllocated > =3D FALSE; > EFI_SMM_SYSTEM_TABLE2 *mBootScriptSmst =3D NULL; > +BOOLEAN mAcpiS3Enable =3D TRUE; >=20 > /** > This is an internal function to add a terminate node the entry, recal= culate > the table @@ -436,6 +437,12 @@ S3BootScriptLibInitialize ( > BOOLEAN InSmm; > EFI_PHYSICAL_ADDRESS Buffer; >=20 > + if (!PcdGetBool (PcdAcpiS3Enable)) { > + mAcpiS3Enable =3D FALSE; > + DEBUG ((DEBUG_INFO, "%a: Skip S3BootScript because ACPI S3 > disabled.\n", gEfiCallerBaseName)); > + return RETURN_SUCCESS; > + } > + > S3TablePtr =3D > (SCRIPT_TABLE_PRIVATE_DATA*)(UINTN)PcdGet64(PcdS3BootScriptTablePrivat > eDataPtr); > // > // The Boot script private data is not be initialized. create it @@ -= 562,6 > +569,10 @@ S3BootScriptLibDeinitialize ( { > EFI_STATUS Status; >=20 > + if (!mAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > DEBUG ((EFI_D_INFO, "%a() in %a module\n", __FUNCTION__, > gEfiCallerBaseName)); >=20 > if (mEventDxeSmmReadyToLock !=3D NULL) { @@ -810,6 +821,10 @@ > S3BootScriptGetEntryAddAddress ( { > UINT8* NewEntryPtr; >=20 > + if (!mAcpiS3Enable) { > + return NULL; > + } > + > if (mS3BootScriptTablePtr->SmmLocked) { > // > // We need check InSmm, because after SmmReadyToLock, only SMM > driver is allowed to write boot script. > diff --git > a/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf > b/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf > index 517ea69568..2b894c99da 100644 > --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf > +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf > @@ -1,7 +1,7 @@ > ## @file > # DXE S3 boot script Library. > # > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved. > +# Copyright (c) 2006 - 2019, Intel Corporation. All rights > +reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -65,4 +65,4 @@ > ## SOMETIMES_PRODUCES >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateSmmDataPtr >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptRuntimeTableReservePa > geNumber ## CONSUMES > - > + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable > ## CONSUMES > -- > 2.13.3.windows.1 >=20 >=20 >=20