From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.20081.1574314971527808573 for ; Wed, 20 Nov 2019 21:42:51 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2019 21:42:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,224,1571727600"; d="scan'208";a="381619551" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga005.jf.intel.com with ESMTP; 20 Nov 2019 21:42:50 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 20 Nov 2019 21:42:50 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 20 Nov 2019 21:42:49 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.149]) with mapi id 14.03.0439.000; Thu, 21 Nov 2019 13:42:48 +0800 From: "Ni, Ray" To: Jeff Brasen , "edk2-devel@lists.01.org" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Kinney, Michael D" , "Wu, Hao A" , "Gao, Zhichao" Subject: Re: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable Thread-Topic: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable Thread-Index: AQHVm9wetSi4710/CUulr4wj2XD1bqeVJGjQ Date: Thu, 21 Nov 2019 05:42:47 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C367F0D@SHSMSX104.ccr.corp.intel.com> References: <7be9cf3d3ebaf8e367763ef72e1473c690cfdd5a.1573839532.git.jbrasen@nvidia.com> In-Reply-To: <7be9cf3d3ebaf8e367763ef72e1473c690cfdd5a.1573839532.git.jbrasen@nvidia.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jeff, I suggest you add the PCD definition to MdePkg.dec because this PCD just maps to the spec defined variable RuntimeServicesSupported. And can you put this PCD to [PcdsFixedAtBuild, PcdsPatchableInModule] secti= on only? Thanks, Ray > -----Original Message----- > From: Jeff Brasen > Sent: Saturday, November 16, 2019 1:43 AM > To: edk2-devel@lists.01.org; devel@edk2.groups.io > Cc: Jeff Brasen ; Gao, Liming ; > Kinney, Michael D ; Wu, Hao A > ; Ni, Ray ; Gao, Zhichao > > Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set > RuntimeServicesSupported variable >=20 > Add support for initializing and setting the UEFI 2.8 global variable > RuntimeServicesSupported based on the value of a PCD. >=20 > Signed-off-by: Jeff Brasen > --- > MdeModulePkg/MdeModulePkg.dec | 18 ++++++++++++++++ > MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 > +++++++++++++++++++++++++++++++- > 3 files changed, 53 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..a1767e4 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -2003,6 +2003,24 @@ > # @Prompt Capsule On Disk relocation device path. >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdCodRelocationDevPath|{0xFF}|VOI > D*|0x0000002f >=20 > + ## Bitmask of supported runtime services
# BIT0 - GetTime # > + BIT1 - SetTime # BIT2 - GetWakeupTime # BIT3 - SetWakeupTime # > + BIT4 - GetVariable # BIT5 - GetNextVariableName # BIT6 - > + SetVariable # BIT7 - SetVirtualAddressMap # BIT8 - > + ConvertPointer # BIT9 - GetNextHighMonotonicCount # BIT10 - > + ResetSystem # BIT11 - UpdateCapsule # BIT12 - > + QueryCapsuleCapabilites # BIT13 - QueryVariableInfo # @Prompt > + Supported Runtime services bitmask. > + > + > gEfiMdeModulePkgTokenSpaceGuid.PcdRuntimeServicesSupported|0x3FFF > |UINT > + 16|0x00000030 > + > [PcdsPatchableInModule] > ## Specify memory size with page number for PEI code when > # Loading Module at Fixed Address feature is enabled. > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > index 9310b4d..e4ba9be 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > @@ -97,6 +97,7 @@ > gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleOnDiskSupport ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdRuntimeServicesSupported > ## CONSUMES >=20 > [Depex] > TRUE > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > index d387dbe..16bc593 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > @@ -40,7 +40,8 @@ CHAR16 *mReadOnlyVariables[] =3D { > EFI_LANG_CODES_VARIABLE_NAME, > EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, > EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME, > - EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME > + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, > + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME > }; >=20 > CHAR16 *mBdsLoadOptionName[] =3D { > @@ -626,6 +627,33 @@ BdsFormalizeOSIndicationVariable ( >=20 > /** >=20 > + Formalize RuntimeServicesSupported variable. > + > +**/ > +VOID > +BdsFormalizeRuntimeServicesSupportedVariable ( > + VOID > + ) > +{ > + EFI_STATUS Status; > + UINT16 RuntimeServicesSupported; > + > + RuntimeServicesSupported =3D PcdGet16 (PcdRuntimeServicesSupported); > + Status =3D gRT->SetVariable ( > + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME, > + &gEfiGlobalVariableGuid, > + EFI_VARIABLE_BOOTSERVICE_ACCESS | > EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof(RuntimeServicesSupported), > + &RuntimeServicesSupported > + ); > + // > + // Platform needs to make sure setting volatile variable before callin= g 3rd > party code shouldn't fail. > + // > + ASSERT_EFI_ERROR (Status); > +} > + > +/** > + > Validate variables. >=20 > **/ > @@ -645,6 +673,11 @@ BdsFormalizeEfiGlobalVariable ( > // Validate OSIndication related variable. > // > BdsFormalizeOSIndicationVariable (); > + > + // > + // Validate Runtime Services Supported variable. > + // > + BdsFormalizeRuntimeServicesSupportedVariable (); > } >=20 > /** > -- > 2.7.4