mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
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>
45 lines
1.2 KiB
INI
45 lines
1.2 KiB
INI
## @file
|
|
# Variable Storage Base Library which uses FVB.
|
|
#
|
|
# Copyright (c) 2026, Arm Ltd. All rights reserved.<BR>
|
|
#
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
#
|
|
##
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x0001001B
|
|
BASE_NAME = VariableStorageRouterBaseLib
|
|
MODULE_UNI_FILE = VariableStorageRouterBaseLib.uni
|
|
FILE_GUID = 5481529a-380d-11f1-8961-ab5d0e6d80c1
|
|
MODULE_TYPE = MM_STANDALONE
|
|
VERSION_STRING = 1.0
|
|
LIBRARY_CLASS = VariableStorageLib|MM_STANDALONE
|
|
PI_SPECIFICATION_VERSION = 0x00010032
|
|
CONSTRUCTOR = VariableStorageRouterBaseLibConstructor
|
|
|
|
#
|
|
# The following information is for reference only and not required by the build tools.
|
|
#
|
|
# VALID_ARCHITECTURES = IA32 X64 AARCH64
|
|
#
|
|
|
|
[Sources]
|
|
VariableStorageRouterBase.c
|
|
VariableStorageRouterBaseStandaloneMmLib.c
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
MdeModulePkg/MdeModulePkg.dec
|
|
|
|
[LibraryClasses]
|
|
BaseLib
|
|
BaseMemoryLib
|
|
DebugLib
|
|
MmServicesTableLib
|
|
|
|
[Protocols]
|
|
gEdkiiVariableStorageProtocolGuid ## COUNSUMES
|
|
|
|
[Depex]
|
|
gEdkiiVariableStorageProtocolGuid
|