diff options
author | Kun Qin <kuqin@microsoft.com> | 2025-04-04 16:43:53 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-06-19 06:17:18 +0000 |
commit | aedcb46e6fd260ab39cf0fc63a85c7f8da8aa476 (patch) | |
tree | ffc311c27174d823b7408a25377db1a58d1be163 | |
parent | cf4534c9daf2ead4ce530d374f0a06a95bd98693 (diff) | |
download | edk2-aedcb46e6fd260ab39cf0fc63a85c7f8da8aa476.zip edk2-aedcb46e6fd260ab39cf0fc63a85c7f8da8aa476.tar.gz edk2-aedcb46e6fd260ab39cf0fc63a85c7f8da8aa476.tar.bz2 |
OvmfPkg: QemuFlashFvbServicesRuntimeDxe: Abstract out SMM/DXE functions
This update refactors QemuFlashFvbServicesRuntimeDxe to abstract out
direct calls to SMM and DXE specific functions.
Specifically, dynamic PCD usage and gBS references have been moved to SMM
specific files.
The constructor functionality has been relocated to a common
implementation and is invoked from their respective entry points.
These changes lay the groundwork for supporting a Standalone MM-based
solution in the future.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
4 files changed, 30 insertions, 5 deletions
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c index b34298f..83051a5 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c @@ -27,9 +27,7 @@ #include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
-#include <Library/DxeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
#include "FwBlockService.h"
#include "QemuFlash.h"
@@ -976,7 +974,6 @@ FvbInitialize ( EFI_PHYSICAL_ADDRESS BaseAddress;
UINTN Length;
UINTN NumOfBlocks;
- RETURN_STATUS PcdStatus;
if (EFI_ERROR (QemuFlashInitialize ())) {
//
@@ -1129,7 +1126,8 @@ FvbInitialize ( //
InstallVirtualAddressChangeHandler ();
- PcdStatus = PcdSetBoolS (PcdOvmfFlashVariablesEnable, TRUE);
- ASSERT_RETURN_ERROR (PcdStatus);
+ // Abstract dynamic PCD set to support Standalone MM
+ UpdateQemuFlashVariablesEnable ();
+
return EFI_SUCCESS;
}
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h index 639ad04..dda3bc5 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h @@ -194,4 +194,9 @@ SetPcdFlashNvStorageBaseAddresses ( VOID
);
+VOID
+UpdateQemuFlashVariablesEnable (
+ VOID
+ );
+
#endif
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c index 61e1f2e..27812fc 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c @@ -244,3 +244,14 @@ SetPcdFlashNvStorageBaseAddresses ( );
ASSERT_RETURN_ERROR (PcdStatus);
}
+
+VOID
+UpdateQemuFlashVariablesEnable (
+ VOID
+ )
+{
+ RETURN_STATUS PcdStatus;
+
+ PcdStatus = PcdSetBoolS (PcdOvmfFlashVariablesEnable, TRUE);
+ ASSERT_RETURN_ERROR (PcdStatus);
+}
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c index 19bd5aa..6acd4b7 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c @@ -84,3 +84,14 @@ SetPcdFlashNvStorageBaseAddresses ( // Do nothing.
//
}
+
+VOID
+UpdateQemuFlashVariablesEnable (
+ VOID
+ )
+{
+ RETURN_STATUS PcdStatus;
+
+ PcdStatus = PcdSetBoolS (PcdOvmfFlashVariablesEnable, TRUE);
+ ASSERT_RETURN_ERROR (PcdStatus);
+}
|