From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) by mx.groups.io with SMTP id smtpd.web11.1671.1574897140910119714 for ; Wed, 27 Nov 2019 15:25:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kQtyDwOx; spf=pass (domain: nvidia.com, ip: 216.228.121.64, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 27 Nov 2019 15:25:34 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 27 Nov 2019 15:25:40 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 27 Nov 2019 15:25:40 -0800 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 27 Nov 2019 23:25:40 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 27 Nov 2019 23:25:40 +0000 Received: from jbrasen-ux.nvidia.com (Not Verified[10.28.48.132]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Wed, 27 Nov 2019 15:25:39 -0800 From: "Jeff Brasen" To: CC: , , , , , Subject: [PATCH v2 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable Date: Wed, 27 Nov 2019 16:25:09 -0700 Message-ID: <21cbc55c9d35ac799e4978a5dbdf4de3e650dace.1574896889.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1574897134; bh=wqhhhmZUJ/0DctCKEnzHcpvR73sDkCsoe15r3Q0X5hE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=kQtyDwOxtXaQ2r4VeJLvm9CDHWhCjkeFRWGy9zfjicsOnHLZrxmG1aN2hpKPCAToo 2BE/IlFHb/QD6Z20ve8e3rxF2UlG+7eHgE7aTGJ/lmJ+HeQTimCcaoEqs25DAOsJzF pgKJvLaYo3/J6JO3hhc2VWveLeaALzwLMjRX12JiKjoLtkPP3VAGQSFKgD9tJ6EF8h /OyvRLG1ru+IMe/XzSH6Uyv47djMabkVP0NzBIprlheTCR3i1txDWzAyHnchihNDI9 HJfGy3txUB/hxBmqIOLw0paDE4gjfU5i2a4R8Z2RDOXAXZlWKx2YmGgQ/qvaBp7jHQ SrMwNAI4coJHQ== Content-Type: text/plain Add support for initializing and setting the UEFI 2.8 global variable RuntimeServicesSupported based on the value of a PCD. Change-Id: I8fbd404d492ff8278466edde8aa37d203537318c Signed-off-by: Jeff Brasen --- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +++++++++++++++++++++++++++++++- MdePkg/MdePkg.dec | 18 ++++++++++++++++ MdePkg/MdePkg.uni | 17 ++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf index 9310b4d..52ec04f 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -90,6 +90,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel ## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdRuntimeServicesSupported ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand ## CONSUMES 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[] = { 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 }; CHAR16 *mBdsLoadOptionName[] = { @@ -626,6 +627,33 @@ BdsFormalizeOSIndicationVariable ( /** + Formalize RuntimeServicesSupported variable. + +**/ +VOID +BdsFormalizeRuntimeServicesSupportedVariable ( + VOID + ) +{ + EFI_STATUS Status; + UINT16 RuntimeServicesSupported; + + RuntimeServicesSupported = PcdGet16 (PcdRuntimeServicesSupported); + Status = 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 calling 3rd party code shouldn't fail. + // + ASSERT_EFI_ERROR (Status); +} + +/** + Validate variables. **/ @@ -645,6 +673,11 @@ BdsFormalizeEfiGlobalVariable ( // Validate OSIndication related variable. // BdsFormalizeOSIndicationVariable (); + + // + // Validate Runtime Services Supported variable. + // + BdsFormalizeRuntimeServicesSupportedVariable (); } /** diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index d022cc5..cdcb2f9 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -2297,5 +2297,23 @@ # @Prompt Boot Timeout (s) gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0xffff|UINT16|0x0000002c + ## 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. + gEfiMdePkgTokenSpaceGuid.PcdRuntimeServicesSupported|0x3FFF|UINT16|0x0000002e + [UserExtensions.TianoCore."ExtraFiles"] MdePkgExtra.uni diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni index 5c1fa24..1edf681 100644 --- a/MdePkg/MdePkg.uni +++ b/MdePkg/MdePkg.uni @@ -413,3 +413,20 @@ #string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultReceiveFifoDepth_HELP #language en-US "Indicates the receive FIFO depth of UART controller.

" +#string STR_gEfiMdePkgTokenSpaceGuid_PcdRuntimeServicesSupported_PROMPT #language en-US "Supported Runtime Services bitmask" + +#string STR_gEfiMdePkgTokenSpaceGuid_PcdRuntimeServicesSupported_HELP #language en-US "Bitmask of supported runtime services

\n" + "BIT0 - GetTime
\n" + "BIT1 - SetTime
\n" + "BIT2 - GetWakeupTime
\n" + "BIT3 - SetWakeupTime
\n" + "BIT4 - GetVariable
\n" + "BIT5 - GetNextVariableName
\n" + "BIT6 - SetVariable
\n" + "BIT7 - SetVirtualAddressMap
\n" + "BIT8 - ConvertPointer
\n" + "BIT9 - GetNextHighMonotonicCount
\n" + "BIT10 - ResetSystem
\n" + "BIT11 - UpdateCapsule
\n" + "BIT12 - QueryCapsuleCapabilities
\n" + "BIT13 - QueryVariableInfo
" -- 2.7.4