edk2/MdeModulePkg/Library/VariableStorageRouterBaseLib
Yeoreum Yun 0637e4054e MdeModulePkg/Library: introduce VariableStorageRouterLib
This patch set introduce VariableStorageLib which can redirect
variable service request to other than classic variable storage
using FVB in non-volatile storage according to platform implementation.

If platform redirect to platform specific storage
for variables, it can implement its own VariableStorage protocol
or VariableStorageRouterLib to add additional behavior.

For example, If a platform wants to keep to use FVB for variable,
It can use VariableStorageRouterBaseLib with VariableStorageFvb SMM
driver or If a platform want to do platform specific action before/after
handling variable storage with FVB, it could implements its own
VariableStorageLib with VariableStorage FVB protocol.

Below is the example overviews:

1. Default FVB backend

The default implementation uses VariableStorageRouterBaseLib, which forwards
every storage request to the FVB-based VariableStorage Protocol implementation.
This preserves the current VariableService behaviour without requiring platform
changes:

      OS or UEFI (Normal world)       |    StandaloneMm (Secure world)
--------------------------------------|--------------------------------
                                      |
                                      |       +----------------+
  +------------------+                |       |     Flash      |
  |  SetVariable()   |                |       |  (FVB based)   |
  |  GetVariable()   |                |       +----------------+
  +------------------+                |                 |
           |                          |                 |
           |                          |  +----------------------------+
           |                          |  | VariableStorageFvb Driver  |
           |                          |  | (VariableStorage Protocol) |
           |                          |  +----------------------------+
           |                          |                 |
           |                          |  +------------------------------+
           |                          |  |   VariableStorageRouterLib   |
+-----------------------+             |  |(VariableStorageRouterBaseLib)|
| VariableSmmRuntimeDxe |             |  +------------------------------+
+-----------------------+             |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
  +---------------------+      MmCommunication       +------------------+
  |  MmCommunicationDxe | <------------------------->|  VariableSmmDxe  |
  +---------------------+                            +------------------+

2. Platform-specific storage backend

Platforms may replace the FVB backend with a platform-defined VariableStorage
Protocol implementation while using VariableStorageRouterBaseLib to forward
storage requests to the platform-defined VariableStorage Protocol.

The example below shows a platform accessing flash managed by a dedicated
management controller through a platform-defined VariableStorage Protocol
implementation that proxies storage requests to the management controller.

      OS or UEFI (Normal world)       |     StandaloneMm (Secure world)
--------------------------------------|------------------------------------
                                      |                  +--------------+
                                      |                  |  +---------+ |
  +------------------+                |                  |  |  Flash  | |
  |  SetVariable()   |                |              --->|  | (Proxy) | |
  |  GetVariable()   |                |              |   |  +---------+ |
  +------------------+                |              |   |      MC      |
           |                          |              |   +--------------+
           |                          |    +----------------------------+
           |                          |    |     VariableStorageProxy   |
           |                          |    | (VariableStorage Protocol) |
           |                          |    +----------------------------+
           |                          |              |
           |                          |  +-------------------------------+
           |                          |  |   VariableStorageRouterLib    |
+-----------------------+             |  | (VariableStorageRouterBaseib) |
| VariableSmmRuntimeDxe |             |  +-------------------------------+
+-----------------------+             |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
           |                          |                       |
  +---------------------+      MmCommunication       +------------------+
  |  MmCommunicationDxe | <------------------------->|  VariableSmmDxe  |
  +---------------------+                            +------------------+

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-07-29 13:02:10 +01:00
..
VariableStorageRouterBase.c MdeModulePkg/Library: introduce VariableStorageRouterLib 2026-07-29 13:02:10 +01:00
VariableStorageRouterBaseLib.uni MdeModulePkg/Library: introduce VariableStorageRouterLib 2026-07-29 13:02:10 +01:00
VariableStorageRouterBaseStandaloneMmLib.c MdeModulePkg/Library: introduce VariableStorageRouterLib 2026-07-29 13:02:10 +01:00
VariableStorageRouterBaseStandaloneMmLib.inf MdeModulePkg/Library: introduce VariableStorageRouterLib 2026-07-29 13:02:10 +01:00
VariableStorageRouterBaseTraditionalMmLib.c MdeModulePkg/Library: introduce VariableStorageRouterLib 2026-07-29 13:02:10 +01:00
VariableStorageRouterBaseTraditionalMmLib.inf MdeModulePkg/Library: introduce VariableStorageRouterLib 2026-07-29 13:02:10 +01:00