From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by mx.groups.io with SMTP id smtpd.web09.418.1573839771309403346 for ; Fri, 15 Nov 2019 09:42:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=UIwqhI0Z; spf=pass (domain: nvidia.com, ip: 216.228.121.65, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 15 Nov 2019 09:42:51 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 15 Nov 2019 09:42:51 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 15 Nov 2019 09:42:51 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 15 Nov 2019 17:42:50 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 15 Nov 2019 17:42:50 +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 ; Fri, 15 Nov 2019 09:42:50 -0800 From: "Jeff Brasen" To: , CC: Jeff Brasen , , , , , Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable Date: Fri, 15 Nov 2019 10:42:37 -0700 Message-ID: <7be9cf3d3ebaf8e367763ef72e1473c690cfdd5a.1573839532.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=1573839771; bh=l8D8QvzVNTJ2CwRafvyWBIIt7WC6pxv7ENv/BHxYe/o=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=UIwqhI0Z4aooqLZm50p/j5bx0ph6nVx5DqwEtYE+zvg5vXAzGnAu0rpkfc9NyMq8v OO8tdI1tQsNTnDihf7Fst1RQOMjoziCiQKXGongQRvMpUOdKvSJ/ujpLHn3Nt8LQ3U Jew7kIzClM2R4hZYOQfQjDc7zwXiN26D/UzCthF63p+UCkmHrGcyqVES0Ejwca/g7N vLrK5KIRAaIWd8MsXxb8h2Jw10vzI9DewFE9Byf2KIoG78c3yzNrdIpcip1Pntf5a/ pXummkFPP8ELtoC1BcEiMiOB69dbzpQRjhQ52Fy55kyTC59nYlxGRJ0xMB0gepw7RR 1oC6iWSrF5u+g== Content-Type: text/plain Add support for initializing and setting the UEFI 2.8 global variable RuntimeServicesSupported based on the value of a PCD. 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(-) 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. gEfiMdeModulePkgTokenSpaceGuid.PcdCodRelocationDevPath|{0xFF}|VOID*|0x0000002f + ## 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|UINT16|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 [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[] = { 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 (); } /** -- 2.7.4