Re: [PATCH v2 1/8] MdeModulePkg: Add Variable Flash Info HOB

Guo Dong

Thanks for the update. It looks good to me.
Hopefully the variable modules would report errors gracefully if the variable HOB doesn't meet the expectation.


-----Original Message-----
From: Michael Kubacki <mikuback@...>
Sent: Monday, April 11, 2022 10:48 AM
To:; Dong, Guo <guo.dong@...>
Cc: Wang, Jian J <>; Wu, Hao A <hao.a.wu@...>; Gao, Liming <gaoliming@...>
Subject: Re: [edk2-devel] [PATCH v2 1/8] MdeModulePkg: Add Variable Flash Info HOB

I renamed the fields and added comments to the interface file in the v3 patch series.


That patch series includes all feedback I have received. Maintainers, please review that series as soon as possible.


On 4/10/2022 7:22 PM, Guo Dong wrote:

Does the range (NvStorageBaseAddress, NvStorageLength) includes FTW spare range and FTW working range?
If not, maybe rename them as (NvVariableBaseAddress, NvVariableLength) to make it clear.

For these 3 ranges, are there any other requirements (e.g. base address must be 4KB aligned, or FtwSpaceLength >= NvVariablelength)?
If yes, had better add to this interface file to make the HOB producer easy to build the HOB.


-----Original Message-----
From: <> On Behalf Of Michael
Sent: Friday, April 8, 2022 2:17 PM
Cc: Wang, Jian J <>; Wu, Hao A
<hao.a.wu@...>; Gao, Liming <gaoliming@...>
Subject: [edk2-devel] [PATCH v2 1/8] MdeModulePkg: Add Variable Flash
Info HOB

From: Michael Kubacki <michael.kubacki@...>


Adds a new GUID that is used to identify a HOB that passes variable flash information to UEFI variable drivers in HOB consumption phases such as DXE, Traditional MM, and Standalone MM.

This information was previously passed directly with PCDs such as
and gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize.

However, the Standalone MM variable driver instance does not have direct access to the PCD database. Therefore, this HOB will first be considered as the source for variable flash information and if platforms do not produce the HOB, reading the information from the PCDs directly will be a backup to provide backward compatibility.

Cc: Jian J Wang <>
Cc: Hao A Wu <hao.a.wu@...>
Cc: Liming Gao <gaoliming@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
MdeModulePkg/Include/Guid/VariableFlashInfo.h | 39 ++++++++++++++++++++
MdeModulePkg/MdeModulePkg.dec | 4 ++
2 files changed, 43 insertions(+)

diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h
new file mode 100644
index 000000000000..e526e362aab9
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/VariableFlashInfo.h
@@ -0,0 +1,39 @@
+/** @file
+ This file defines the GUID and data structure used to pass
+information about
+ a variable store mapped on flash (i.e. a MMIO firmware volume) to the DXE and MM environment.
+ Copyright (c) Microsoft Corporation.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+ { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20,
+0xfc, 0x90 }}
+extern EFI_GUID gVariableFlashInfoHobGuid;
+#pragma pack (push, 1)
+/// This structure can be used to describe UEFI variable /// flash
+typedef struct {
+ UINT32 Version;
+ EFI_PHYSICAL_ADDRESS NvStorageBaseAddress;
+ UINT64 NvStorageLength;
+ UINT64 FtwSpareLength;
+ EFI_PHYSICAL_ADDRESS FtwWorkingBaseAddress;
+ UINT64 FtwWorkingLength;
+#pragma pack (pop)
diff --git a/MdeModulePkg/MdeModulePkg.dec
b/MdeModulePkg/MdeModulePkg.dec index cf79292ec877..4e82f5836096
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -226,6 +226,10 @@ [Guids]
# Include/Guid/SmmVariableCommon.h
gSmmVariableWriteGuid = { 0x93ba1826, 0xdffb, 0x45dd, { 0x82,
0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 }}

+ ## Guid of the variable flash information HOB.
+ # Include/Guid/VariableFlashInfo.h gVariableFlashInfoHobGuid = {
+ 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20,
+ 0xfc, 0x90 }}
## Performance protocol guid that also acts as the performance HOB guid and performance variable GUID
# Include/Guid/Performance.h
gPerformanceProtocolGuid = { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9E, 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 } }

-=-=-=-=-=-= Links: You receive all messages sent to this group.
View/Reply Online (#88650):
Mute This Topic:
Group Owner:
Unsubscribe: [guo.dong@...]

Join { to automatically receive all group messages.