Re: [PATCH v1 0/3] Add Variable Flash Info HOB

Wu, Hao A

Sorry for a question:
GetVariableFlashInfo() seems being defined multiple times across modules, do you see value in abstracting it as a library API?

Best Regards,
Hao Wu

-----Original Message-----
From: <> On Behalf Of Michael
Sent: Thursday, April 7, 2022 12:27 AM
Cc: Wang, Jian J <>; Wu, Hao A <hao.a.wu@...>;
Gao, Liming <gaoliming@...>
Subject: [edk2-devel] [PATCH v1 0/3] Add Variable Flash Info HOB

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


The UEFI variable drivers such as VariableRuntimeDxe, VariableSmm,
VariableStandaloneMm, etc. (and their dependent protocol/library
stack), typically acquire UEFI variable store flash information
with PCDs declared in MdeModulePkg.

For example:

These PCDs work as-is in the StandaloneMm driver if they are not
dynamic such as Dynamic or DynamicEx because PCD services are not
readily available in the Standalone MM environment. Platforms that
use Standalone MM today, must define these PCDs as FixedAtBuild in
their platform build. However, the PCDs do allow platforms to treat
the PCDs as Dynamic/DynamicEx and being able to support that is
currently a gap for Standalone MM.

This patch series introduces a HOB that can be produced by the
platform to provide the same information. The HOB list is
available to Standalone MM.

The PCD declarations are left as-is in MdeModulePkg for backward
compatibility. This means unless a platform wants to use the HOB,
their code will continue to work with no change (they do not need
to produce the HOB). Only if the HOB is found, is its value used
instead of the PCDs.

Cc: Jian J Wang <>
Cc: Hao A Wu <hao.a.wu@...>
Cc: Liming Gao <gaoliming@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...

Michael Kubacki (3):
MdeModulePkg: Add Variable Flash Info HOB
MdeModulePkg/Variable: Consume Variable Info HOB
MdeModulePkg/FaultTolerantWrite: Consume Variable Info HOB

MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c |
111 +++++++++++++++++---
| 7 +-
| 92 ++++++++++++++--
MdeModulePkg/Universal/Variable/Pei/Variable.c | 66
MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 42
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c |
25 ++++-
| 20 +++-
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c |
20 +++-
MdeModulePkg/Include/Guid/VariableFlashInfo.h | 36
MdeModulePkg/MdeModulePkg.dec | 4 +
| 9 +-
| 11 +-
| 11 +-

eMm.inf | 11 +-
| 10 +-
MdeModulePkg/Universal/Variable/Pei/Variable.h | 2 +
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf | 6 +-
MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h | 17
| 6 +-
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf |
6 +-
| 6 +-
21 files changed, 455 insertions(+), 63 deletions(-)
create mode 100644 MdeModulePkg/Include/Guid/VariableFlashInfo.h


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

Join { to automatically receive all group messages.