* [PATCH 0/3] Support for RuntimeServicesSupported global variable
@ 2019-11-15 17:42 Jeff Brasen
2019-11-15 17:42 ` [PATCH 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations Jeff Brasen
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Jeff Brasen @ 2019-11-15 17:42 UTC (permalink / raw)
To: edk2-devel, devel
Cc: Jeff Brasen, liming.gao, michael.d.kinney, hao.a.wu, ray.ni,
zhichao.gao
Add support for the new UEFI 2.8 runtime services supported variable
that is used to indicate which runtime services a platform supports.
Also, add support for initializing this variable based on a PCD.
Jeff Brasen (3):
MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
.../VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++++++
MdeModulePkg/MdeModulePkg.dec | 18 +++++++++++
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 +
MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +++++++++++++++++++++-
MdePkg/Include/Guid/GlobalVariable.h | 7 +++++
MdePkg/Include/Uefi/UefiSpec.h | 18 +++++++++++
6 files changed, 89 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
2019-11-15 17:42 [PATCH 0/3] Support for RuntimeServicesSupported global variable Jeff Brasen
@ 2019-11-15 17:42 ` 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
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Jeff Brasen @ 2019-11-15 17:42 UTC (permalink / raw)
To: edk2-devel, devel
Cc: Jeff Brasen, liming.gao, michael.d.kinney, hao.a.wu, ray.ni,
zhichao.gao
Add bitmask values for the value of the RuntimeServicesSupported
variable defined in the UEFI 2.8 specification. This is used to describe
what services the platform supports while in runtime.
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
MdePkg/Include/Uefi/UefiSpec.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
index 444aa35..7e2b719 100644
--- a/MdePkg/Include/Uefi/UefiSpec.h
+++ b/MdePkg/Include/Uefi/UefiSpec.h
@@ -1783,6 +1783,24 @@ EFI_STATUS
#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
//
+// Bitmasks of supported runtime functions for RuntimeServicesSupported variable
+//
+#define EFI_RT_SUPPORTED_GET_TIME 0x0001
+#define EFI_RT_SUPPORTED_SET_TIME 0x0002
+#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004
+#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME 0x0008
+#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010
+#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020
+#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040
+#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP 0x0080
+#define EFI_RT_SUPPORTED_CONVERT_POINTER 0x0100
+#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200
+#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400
+#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800
+#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000
+#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO 0x2000
+
+//
// EFI Runtime Services Table
//
#define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
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-15 17:42 ` Jeff Brasen
2019-11-21 5:45 ` Ni, Ray
2019-11-15 17:42 ` [PATCH 3/3] MdeModulePkg/BdsDxe: Set " Jeff Brasen
2019-11-19 14:19 ` [PATCH 0/3] Support for RuntimeServicesSupported global variable Liming Gao
3 siblings, 1 reply; 14+ messages in thread
From: Jeff Brasen @ 2019-11-15 17:42 UTC (permalink / raw)
To: edk2-devel, devel
Cc: Jeff Brasen, liming.gao, michael.d.kinney, hao.a.wu, ray.ni,
zhichao.gao
Add support for new global variable defined in the UEFI 2.8
specification. This provides a bitmask of which calls are
implemented by the firmware during runtime services.
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
.../Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++++++++++
MdePkg/Include/Guid/GlobalVariable.h | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
index e3bf04a..4264892 100644
--- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
+++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
@@ -553,6 +553,17 @@ UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList[] = {
},
NULL
},
+ {
+ EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME,
+ {
+ VAR_CHECK_VARIABLE_PROPERTY_REVISION,
+ VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
+ VARIABLE_ATTRIBUTE_BS_RT,
+ sizeof (UINT16),
+ sizeof (UINT16)
+ },
+ NULL
+ },
};
UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList2[] = {
diff --git a/MdePkg/Include/Guid/GlobalVariable.h b/MdePkg/Include/Guid/GlobalVariable.h
index 7abc103..06a8a12 100644
--- a/MdePkg/Include/Guid/GlobalVariable.h
+++ b/MdePkg/Include/Guid/GlobalVariable.h
@@ -182,5 +182,12 @@ extern EFI_GUID gEfiGlobalVariableGuid;
/// Its attribute is BS+RT.
///
#define EFI_VENDOR_KEYS_VARIABLE_NAME L"VendorKeys"
+///
+/// Bitmask of which calls are implemented by the firmware during runtime services.
+/// RT access is required only if GetVariable() is implemented by runtime services.
+/// Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME L"RuntimeServicesSupported"
#endif
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
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-15 17:42 ` [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable Jeff Brasen
@ 2019-11-15 17:42 ` Jeff Brasen
2019-11-21 5:42 ` Ni, Ray
2019-11-19 14:19 ` [PATCH 0/3] Support for RuntimeServicesSupported global variable Liming Gao
3 siblings, 1 reply; 14+ messages in thread
From: Jeff Brasen @ 2019-11-15 17:42 UTC (permalink / raw)
To: edk2-devel, devel
Cc: Jeff Brasen, liming.gao, michael.d.kinney, hao.a.wu, ray.ni,
zhichao.gao
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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] Support for RuntimeServicesSupported global variable
2019-11-15 17:42 [PATCH 0/3] Support for RuntimeServicesSupported global variable Jeff Brasen
` (2 preceding siblings ...)
2019-11-15 17:42 ` [PATCH 3/3] MdeModulePkg/BdsDxe: Set " Jeff Brasen
@ 2019-11-19 14:19 ` Liming Gao
2019-11-19 18:50 ` Jeff Brasen
3 siblings, 1 reply; 14+ messages in thread
From: Liming Gao @ 2019-11-19 14:19 UTC (permalink / raw)
To: Jeff Brasen, edk2-devel@lists.01.org, devel@edk2.groups.io
Cc: Kinney, Michael D, Wu, Hao A, Ni, Ray, Gao, Zhichao
Jeff:
This patch set is a new feature support. Now, edk2 enters into soft feature freeze. No feature is allowed to be added. So, this feature will not catch edk2 2019 stable tag.
Thanks
Liming
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 16, 2019 1:43 AM
> To: edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao
> A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [PATCH 0/3] Support for RuntimeServicesSupported global variable
>
> Add support for the new UEFI 2.8 runtime services supported variable
> that is used to indicate which runtime services a platform supports.
> Also, add support for initializing this variable based on a PCD.
>
> Jeff Brasen (3):
> MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
> MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
> MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
>
> .../VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++++++
> MdeModulePkg/MdeModulePkg.dec | 18 +++++++++++
> MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 +
> MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +++++++++++++++++++++-
> MdePkg/Include/Guid/GlobalVariable.h | 7 +++++
> MdePkg/Include/Uefi/UefiSpec.h | 18 +++++++++++
> 6 files changed, 89 insertions(+), 1 deletion(-)
>
> --
> 2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] Support for RuntimeServicesSupported global variable
2019-11-19 14:19 ` [PATCH 0/3] Support for RuntimeServicesSupported global variable Liming Gao
@ 2019-11-19 18:50 ` Jeff Brasen
0 siblings, 0 replies; 14+ messages in thread
From: Jeff Brasen @ 2019-11-19 18:50 UTC (permalink / raw)
To: Gao, Liming, edk2-devel@lists.01.org, devel@edk2.groups.io
Cc: Kinney, Michael D, Wu, Hao A, Ni, Ray, Gao, Zhichao
[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]
Not a problem, I expected that, just wanted to get this up for review so it can go in after the freeze is over.
Thanks,
Jeff
________________________________
From: Gao, Liming <liming.gao@intel.com>
Sent: Tuesday, November 19, 2019 7:19 AM
To: Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org <edk2-devel@lists.01.org>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: RE: [PATCH 0/3] Support for RuntimeServicesSupported global variable
Jeff:
This patch set is a new feature support. Now, edk2 enters into soft feature freeze. No feature is allowed to be added. So, this feature will not catch edk2 2019 stable tag.
Thanks
Liming
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 16, 2019 1:43 AM
> To: edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao
> A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [PATCH 0/3] Support for RuntimeServicesSupported global variable
>
> Add support for the new UEFI 2.8 runtime services supported variable
> that is used to indicate which runtime services a platform supports.
> Also, add support for initializing this variable based on a PCD.
>
> Jeff Brasen (3):
> MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
> MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
> MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
>
> .../VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++++++
> MdeModulePkg/MdeModulePkg.dec | 18 +++++++++++
> MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 +
> MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +++++++++++++++++++++-
> MdePkg/Include/Guid/GlobalVariable.h | 7 +++++
> MdePkg/Include/Uefi/UefiSpec.h | 18 +++++++++++
> 6 files changed, 89 insertions(+), 1 deletion(-)
>
> --
> 2.7.4
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
[-- Attachment #2: Type: text/html, Size: 4500 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
2019-11-15 17:42 ` [PATCH 3/3] MdeModulePkg/BdsDxe: Set " Jeff Brasen
@ 2019-11-21 5:42 ` Ni, Ray
2019-11-21 6:12 ` Gao, Zhichao
0 siblings, 1 reply; 14+ messages in thread
From: Ni, Ray @ 2019-11-21 5:42 UTC (permalink / raw)
To: Jeff Brasen, edk2-devel@lists.01.org, devel@edk2.groups.io
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Gao, Zhichao
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] section only?
Thanks,
Ray
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 16, 2019 1:43 AM
> To: edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming <liming.gao@intel.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> RuntimeServicesSupported variable
>
> 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}|VOI
> D*|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
> |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
>
> [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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
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
0 siblings, 0 replies; 14+ messages in thread
From: Ni, Ray @ 2019-11-21 5:44 UTC (permalink / raw)
To: Jeff Brasen, edk2-devel@lists.01.org, devel@edk2.groups.io
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Gao, Zhichao
Jeff,
I feel the BIT definitions can be together with the
RuntimeServicesSuppported variable.
But I found the EFI_OS_INDICATIONS_XXX macros are already in
UefiSpec.h.
So I am fine with that.
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 16, 2019 1:43 AM
> To: edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming <liming.gao@intel.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Subject: [PATCH 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8
> RuntimeServicesSuppported definations
>
> Add bitmask values for the value of the RuntimeServicesSupported variable
> defined in the UEFI 2.8 specification. This is used to describe what services
> the platform supports while in runtime.
>
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
> MdePkg/Include/Uefi/UefiSpec.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h
> b/MdePkg/Include/Uefi/UefiSpec.h index 444aa35..7e2b719 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -1783,6 +1783,24 @@ EFI_STATUS
> #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY
> 0x0000000000000040
>
> //
> +// Bitmasks of supported runtime functions for RuntimeServicesSupported
> +variable //
> +#define EFI_RT_SUPPORTED_GET_TIME 0x0001
> +#define EFI_RT_SUPPORTED_SET_TIME 0x0002
> +#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004
> +#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME 0x0008
> +#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010
> +#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020
> +#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040
> +#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP 0x0080
> +#define EFI_RT_SUPPORTED_CONVERT_POINTER 0x0100
> +#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT
> 0x0200
> +#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400
> +#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800
> +#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000
> +#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO 0x2000
> +
> +//
> // EFI Runtime Services Table
> //
> #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I','
> ','S','Y','S','T')
> --
> 2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
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
0 siblings, 1 reply; 14+ messages in thread
From: Ni, Ray @ 2019-11-21 5:45 UTC (permalink / raw)
To: Jeff Brasen, edk2-devel@lists.01.org, devel@edk2.groups.io
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Gao, Zhichao,
Zeng, Star
Reviewed-by: Ray Ni <ray.ni@intel.com>
+ VarCheck expert Star Zeng.
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 16, 2019 1:43 AM
> To: edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming <liming.gao@intel.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Subject: [PATCH 2/3] MdePkg/MdeModule: Add support for
> RuntimeServicesSupported variable
>
> Add support for new global variable defined in the UEFI 2.8 specification. This
> provides a bitmask of which calls are implemented by the firmware during
> runtime services.
>
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
> .../Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11
> +++++++++++
> MdePkg/Include/Guid/GlobalVariable.h | 7 +++++++
> 2 files changed, 18 insertions(+)
>
> diff --git
> a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> index e3bf04a..4264892 100644
> --- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> +++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> @@ -553,6 +553,17 @@ UEFI_DEFINED_VARIABLE_ENTRY
> mGlobalVariableList[] = {
> },
> NULL
> },
> + {
> + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME,
> + {
> + VAR_CHECK_VARIABLE_PROPERTY_REVISION,
> + VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
> + VARIABLE_ATTRIBUTE_BS_RT,
> + sizeof (UINT16),
> + sizeof (UINT16)
> + },
> + NULL
> + },
> };
>
> UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList2[] = { diff --git
> a/MdePkg/Include/Guid/GlobalVariable.h
> b/MdePkg/Include/Guid/GlobalVariable.h
> index 7abc103..06a8a12 100644
> --- a/MdePkg/Include/Guid/GlobalVariable.h
> +++ b/MdePkg/Include/Guid/GlobalVariable.h
> @@ -182,5 +182,12 @@ extern EFI_GUID gEfiGlobalVariableGuid; /// Its
> attribute is BS+RT.
> ///
> #define EFI_VENDOR_KEYS_VARIABLE_NAME L"VendorKeys"
> +///
> +/// Bitmask of which calls are implemented by the firmware during runtime
> services.
> +/// RT access is required only if GetVariable() is implemented by runtime
> services.
> +/// Should be treated as read-only.
> +/// Its attribute is BS+RT.
> +///
> +#define EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME
> L"RuntimeServicesSupported"
>
> #endif
> --
> 2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
2019-11-21 5:42 ` Ni, Ray
@ 2019-11-21 6:12 ` Gao, Zhichao
2019-11-21 11:26 ` [edk2-devel] " Wang, Sunny (HPS SW)
0 siblings, 1 reply; 14+ messages in thread
From: Gao, Zhichao @ 2019-11-21 6:12 UTC (permalink / raw)
To: Ni, Ray, Jeff Brasen, edk2-devel@lists.01.org,
devel@edk2.groups.io
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A
Agree with Ray, and we should update the uni file at the same time when add the new pcd.
Thanks,
Zhichao
> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Thursday, November 21, 2019 11:13 AM
> To: Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org;
> devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao,
> Zhichao <zhichao.gao@intel.com>
> Subject: RE: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> RuntimeServicesSupported variable
>
> 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] section
> only?
>
> Thanks,
> Ray
>
> > -----Original Message-----
> > From: Jeff Brasen <jbrasen@nvidia.com>
> > Sent: Saturday, November 16, 2019 1:43 AM
> > To: edk2-devel@lists.01.org; devel@edk2.groups.io
> > Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming
> > <liming.gao@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> > <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported
> > variable
> >
> > 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}|VOI
> > D*|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
> > |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
> >
> > [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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
2019-11-21 5:45 ` Ni, Ray
@ 2019-11-21 6:24 ` Zeng, Star
0 siblings, 0 replies; 14+ messages in thread
From: Zeng, Star @ 2019-11-21 6:24 UTC (permalink / raw)
To: Ni, Ray, Jeff Brasen, edk2-devel@lists.01.org,
devel@edk2.groups.io
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Gao, Zhichao,
Zeng, Star
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Ni, Ray
Sent: Thursday, November 21, 2019 1:46 PM
To: Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org; devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
Reviewed-by: Ray Ni <ray.ni@intel.com>
+ VarCheck expert Star Zeng.
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 16, 2019 1:43 AM
> To: edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming <liming.gao@intel.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Subject: [PATCH 2/3] MdePkg/MdeModule: Add support for
> RuntimeServicesSupported variable
>
> Add support for new global variable defined in the UEFI 2.8 specification. This
> provides a bitmask of which calls are implemented by the firmware during
> runtime services.
>
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
> .../Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11
> +++++++++++
> MdePkg/Include/Guid/GlobalVariable.h | 7 +++++++
> 2 files changed, 18 insertions(+)
>
> diff --git
> a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> index e3bf04a..4264892 100644
> --- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> +++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
> @@ -553,6 +553,17 @@ UEFI_DEFINED_VARIABLE_ENTRY
> mGlobalVariableList[] = {
> },
> NULL
> },
> + {
> + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME,
> + {
> + VAR_CHECK_VARIABLE_PROPERTY_REVISION,
> + VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
> + VARIABLE_ATTRIBUTE_BS_RT,
> + sizeof (UINT16),
> + sizeof (UINT16)
> + },
> + NULL
> + },
> };
>
> UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList2[] = { diff --git
> a/MdePkg/Include/Guid/GlobalVariable.h
> b/MdePkg/Include/Guid/GlobalVariable.h
> index 7abc103..06a8a12 100644
> --- a/MdePkg/Include/Guid/GlobalVariable.h
> +++ b/MdePkg/Include/Guid/GlobalVariable.h
> @@ -182,5 +182,12 @@ extern EFI_GUID gEfiGlobalVariableGuid; /// Its
> attribute is BS+RT.
> ///
> #define EFI_VENDOR_KEYS_VARIABLE_NAME L"VendorKeys"
> +///
> +/// Bitmask of which calls are implemented by the firmware during runtime
> services.
> +/// RT access is required only if GetVariable() is implemented by runtime
> services.
> +/// Should be treated as read-only.
> +/// Its attribute is BS+RT.
> +///
> +#define EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME
> L"RuntimeServicesSupported"
>
> #endif
> --
> 2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
2019-11-21 6:12 ` Gao, Zhichao
@ 2019-11-21 11:26 ` Wang, Sunny (HPS SW)
2019-11-21 11:51 ` Ni, Ray
0 siblings, 1 reply; 14+ messages in thread
From: Wang, Sunny (HPS SW) @ 2019-11-21 11:26 UTC (permalink / raw)
To: devel@edk2.groups.io, zhichao.gao@intel.com, Ni, Ray, Jeff Brasen,
edk2-devel@lists.01.org
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Spottswood, Jason,
Wang, Sunny (HPS SW)
Hi Ray,
May I know why we need to put this PCD to [PcdsFixedAtBuild, PcdsPatchableInModule] section only? If the reason is the security concern, Locking the variable (value of PCD) at the EndOfDxe should be secure enough. For the platforms that want to make it more secure (don't want the PCD to be modified), they can override the PCD type in their .dsc file.
I can imagine that there are still some use cases that need to modify the PCD during boot. Can we put this PCD in [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] to make it more flexible?
Regards,
Sunny Wang
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Gao, Zhichao
Sent: Thursday, November 21, 2019 2:12 PM
To: Ni, Ray <ray.ni@intel.com>; Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org; devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
Subject: Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
Agree with Ray, and we should update the uni file at the same time when add the new pcd.
Thanks,
Zhichao
> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Thursday, November 21, 2019 11:13 AM
> To: Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org;
> devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao,
> Zhichao <zhichao.gao@intel.com>
> Subject: RE: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> RuntimeServicesSupported variable
>
> 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]
> section only?
>
> Thanks,
> Ray
>
> > -----Original Message-----
> > From: Jeff Brasen <jbrasen@nvidia.com>
> > Sent: Saturday, November 16, 2019 1:43 AM
> > To: edk2-devel@lists.01.org; devel@edk2.groups.io
> > Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming
> > <liming.gao@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni,
> > Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> > RuntimeServicesSupported variable
> >
> > 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}|VOI
> > D*|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
> > |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
> >
> > [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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
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)
0 siblings, 1 reply; 14+ messages in thread
From: Ni, Ray @ 2019-11-21 11:51 UTC (permalink / raw)
To: devel@edk2.groups.io, sunnywang@hpe.com, Gao, Zhichao,
Jeff Brasen, edk2-devel@lists.01.org
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Spottswood, Jason
Sunny,
I am fine to put it to dynamic section if there are real requirements.
I thought if the platform doesn't support runtime services, it always doesn't support.
Thanks,
Ray
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wang, Sunny (HPS SW)
> Sent: Thursday, November 21, 2019 7:27 PM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Jeff Brasen
> <jbrasen@nvidia.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Spottswood, Jason <jason.spottswood@hpe.com>; Wang, Sunny (HPS SW) <sunnywang@hpe.com>
> Subject: Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
>
> Hi Ray,
>
> May I know why we need to put this PCD to [PcdsFixedAtBuild, PcdsPatchableInModule] section only? If the reason is the
> security concern, Locking the variable (value of PCD) at the EndOfDxe should be secure enough. For the platforms that
> want to make it more secure (don't want the PCD to be modified), they can override the PCD type in their .dsc file.
> I can imagine that there are still some use cases that need to modify the PCD during boot. Can we put this PCD in
> [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] to make it more flexible?
>
> Regards,
> Sunny Wang
>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Gao, Zhichao
> Sent: Thursday, November 21, 2019 2:12 PM
> To: Ni, Ray <ray.ni@intel.com>; Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>
> Subject: Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
>
> Agree with Ray, and we should update the uni file at the same time when add the new pcd.
>
> Thanks,
> Zhichao
>
> > -----Original Message-----
> > From: Ni, Ray <ray.ni@intel.com>
> > Sent: Thursday, November 21, 2019 11:13 AM
> > To: Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org;
> > devel@edk2.groups.io
> > Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao,
> > Zhichao <zhichao.gao@intel.com>
> > Subject: RE: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> > RuntimeServicesSupported variable
> >
> > 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]
> > section only?
> >
> > Thanks,
> > Ray
> >
> > > -----Original Message-----
> > > From: Jeff Brasen <jbrasen@nvidia.com>
> > > Sent: Saturday, November 16, 2019 1:43 AM
> > > To: edk2-devel@lists.01.org; devel@edk2.groups.io
> > > Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming
> > > <liming.gao@intel.com>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni,
> > > Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > > Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> > > RuntimeServicesSupported variable
> > >
> > > 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}|VOI
> > > D*|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
> > > |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
> > >
> > > [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
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
2019-11-21 11:51 ` Ni, Ray
@ 2019-11-22 8:10 ` Wang, Sunny (HPS SW)
0 siblings, 0 replies; 14+ messages in thread
From: Wang, Sunny (HPS SW) @ 2019-11-22 8:10 UTC (permalink / raw)
To: Ni, Ray, devel@edk2.groups.io, Gao, Zhichao, Jeff Brasen,
edk2-devel@lists.01.org
Cc: Gao, Liming, Kinney, Michael D, Wu, Hao A, Spottswood, Jason
Thanks for the clarification, Ray.
Regards,
Sunny Wang
-----Original Message-----
From: Ni, Ray [mailto:ray.ni@intel.com]
Sent: Thursday, November 21, 2019 7:51 PM
To: devel@edk2.groups.io; Wang, Sunny (HPS SW) <sunnywang@hpe.com>; Gao, Zhichao <zhichao.gao@intel.com>; Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Spottswood, Jason <jason.spottswood@hpe.com>
Subject: RE: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
Importance: High
Sunny,
I am fine to put it to dynamic section if there are real requirements.
I thought if the platform doesn't support runtime services, it always doesn't support.
Thanks,
Ray
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wang,
> Sunny (HPS SW)
> Sent: Thursday, November 21, 2019 7:27 PM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Jeff Brasen <jbrasen@nvidia.com>;
> edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Spottswood, Jason <jason.spottswood@hpe.com>; Wang, Sunny (HPS SW)
> <sunnywang@hpe.com>
> Subject: Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> RuntimeServicesSupported variable
>
> Hi Ray,
>
> May I know why we need to put this PCD to [PcdsFixedAtBuild,
> PcdsPatchableInModule] section only? If the reason is the security
> concern, Locking the variable (value of PCD) at the EndOfDxe should be secure enough. For the platforms that want to make it more secure (don't want the PCD to be modified), they can override the PCD type in their .dsc file.
> I can imagine that there are still some use cases that need to modify
> the PCD during boot. Can we put this PCD in [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] to make it more flexible?
>
> Regards,
> Sunny Wang
>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Thursday, November 21, 2019 2:12 PM
> To: Ni, Ray <ray.ni@intel.com>; Jeff Brasen <jbrasen@nvidia.com>;
> edk2-devel@lists.01.org; devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
> Subject: Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> RuntimeServicesSupported variable
>
> Agree with Ray, and we should update the uni file at the same time when add the new pcd.
>
> Thanks,
> Zhichao
>
> > -----Original Message-----
> > From: Ni, Ray <ray.ni@intel.com>
> > Sent: Thursday, November 21, 2019 11:13 AM
> > To: Jeff Brasen <jbrasen@nvidia.com>; edk2-devel@lists.01.org;
> > devel@edk2.groups.io
> > Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao,
> > Zhichao <zhichao.gao@intel.com>
> > Subject: RE: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> > RuntimeServicesSupported variable
> >
> > 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] section only?
> >
> > Thanks,
> > Ray
> >
> > > -----Original Message-----
> > > From: Jeff Brasen <jbrasen@nvidia.com>
> > > Sent: Saturday, November 16, 2019 1:43 AM
> > > To: edk2-devel@lists.01.org; devel@edk2.groups.io
> > > Cc: Jeff Brasen <jbrasen@nvidia.com>; Gao, Liming
> > > <liming.gao@intel.com>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni,
> > > Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > > Subject: [PATCH 3/3] MdeModulePkg/BdsDxe: Set
> > > RuntimeServicesSupported variable
> > >
> > > 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}|VOI
> > > D*|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
> > > |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
> > >
> > > [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
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-11-22 8:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/3] MdeModulePkg/BdsDxe: Set " Jeff Brasen
2019-11-21 5:42 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox