From: "Jeff Brasen" <jbrasen@nvidia.com>
To: <edk2-devel@lists.01.org>, <devel@edk2.groups.io>
Cc: Jeff Brasen <jbrasen@nvidia.com>, <liming.gao@intel.com>,
<michael.d.kinney@intel.com>, <hao.a.wu@intel.com>,
<ray.ni@intel.com>, <zhichao.gao@intel.com>
Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
Date: Fri, 15 Nov 2019 10:42:37 -0700 [thread overview]
Message-ID: <7be9cf3d3ebaf8e367763ef72e1473c690cfdd5a.1573839532.git.jbrasen@nvidia.com> (raw)
In-Reply-To: <cover.1573839532.git.jbrasen@nvidia.com>
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 <jbrasen@nvidia.com>
---
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<BR>
+ # 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
next prev parent reply other threads:[~2019-11-15 17:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-15 17:42 [PATCH 0/3] Support for RuntimeServicesSupported global variable Jeff Brasen
2019-11-15 17:42 ` [PATCH 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations Jeff Brasen
2019-11-21 5:44 ` Ni, Ray
2019-11-15 17:42 ` [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable Jeff Brasen
2019-11-21 5:45 ` Ni, Ray
2019-11-21 6:24 ` Zeng, Star
2019-11-15 17:42 ` Jeff Brasen [this message]
2019-11-21 5:42 ` [PATCH 3/3] MdeModulePkg/BdsDxe: Set " Ni, Ray
2019-11-21 6:12 ` Gao, Zhichao
2019-11-21 11:26 ` [edk2-devel] " Wang, Sunny (HPS SW)
2019-11-21 11:51 ` Ni, Ray
2019-11-22 8:10 ` Wang, Sunny (HPS SW)
2019-11-19 14:19 ` [PATCH 0/3] Support for RuntimeServicesSupported global variable Liming Gao
2019-11-19 18:50 ` Jeff Brasen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7be9cf3d3ebaf8e367763ef72e1473c690cfdd5a.1573839532.git.jbrasen@nvidia.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox