summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/QemuFlashFvbServicesRuntimeDxe
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-03-10 23:27:36 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-03-12 21:14:46 +0000
commitcd99d07d537fdc6447dac3de0cdf4bd5293e5ce6 (patch)
tree07ca14ad20d5d5b633aebb9e4f55fbdf0f06117f /OvmfPkg/QemuFlashFvbServicesRuntimeDxe
parentd6961bb47ac049ea52acc3c01886b21cdcc1f2d1 (diff)
downloadedk2-cd99d07d537fdc6447dac3de0cdf4bd5293e5ce6.tar.gz
edk2-cd99d07d537fdc6447dac3de0cdf4bd5293e5ce6.tar.bz2
edk2-cd99d07d537fdc6447dac3de0cdf4bd5293e5ce6.zip
OvmfPkg/QemuFlashFvbServices: factor out SetPcdFlashNvStorageBaseAddresses
Extract the dynamic setting of the - PcdFlashNvStorageVariableBase64 - PcdFlashNvStorageFtwWorkingBase - PcdFlashNvStorageFtwSpareBase addresses to a helper function. For now, the helper function is identical (duplicated) between the SMM flash driver and the runtime DXE flash driver. In subsequent patches, this will change. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=386 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200310222739.26717-3-lersek@redhat.com> Acked-by: Leif Lindholm <leif@nuviainc.com>
Diffstat (limited to 'OvmfPkg/QemuFlashFvbServicesRuntimeDxe')
-rw-r--r--OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c19
-rw-r--r--OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h5
-rw-r--r--OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c27
-rw-r--r--OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c27
4 files changed, 60 insertions, 18 deletions
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
index b7b99129a8..76a7853de0 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
@@ -1051,24 +1051,7 @@ FvbInitialize (
MarkIoMemoryRangeForRuntimeAccess (BaseAddress, Length);
- //
- // Set several PCD values to point to flash
- //
- PcdStatus = PcdSet64S (
- PcdFlashNvStorageVariableBase64,
- (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase)
- );
- ASSERT_RETURN_ERROR (PcdStatus);
- PcdStatus = PcdSet32S (
- PcdFlashNvStorageFtwWorkingBase,
- PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase)
- );
- ASSERT_RETURN_ERROR (PcdStatus);
- PcdStatus = PcdSet32S (
- PcdFlashNvStorageFtwSpareBase,
- PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase)
- );
- ASSERT_RETURN_ERROR (PcdStatus);
+ SetPcdFlashNvStorageBaseAddresses ();
FwhInstance = (EFI_FW_VOL_INSTANCE *)
(
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h
index a12577182d..d064aee6ef 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.h
@@ -190,4 +190,9 @@ MarkIoMemoryRangeForRuntimeAccess (
IN UINTN Length
);
+VOID
+SetPcdFlashNvStorageBaseAddresses (
+ VOID
+ );
+
#endif
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c
index 69b20916bc..e60978fa12 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c
@@ -216,3 +216,30 @@ MarkIoMemoryRangeForRuntimeAccess (
return Status;
}
+
+VOID
+SetPcdFlashNvStorageBaseAddresses (
+ VOID
+ )
+{
+ RETURN_STATUS PcdStatus;
+
+ //
+ // Set several PCD values to point to flash
+ //
+ PcdStatus = PcdSet64S (
+ PcdFlashNvStorageVariableBase64,
+ (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase)
+ );
+ ASSERT_RETURN_ERROR (PcdStatus);
+ PcdStatus = PcdSet32S (
+ PcdFlashNvStorageFtwWorkingBase,
+ PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase)
+ );
+ ASSERT_RETURN_ERROR (PcdStatus);
+ PcdStatus = PcdSet32S (
+ PcdFlashNvStorageFtwSpareBase,
+ PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase)
+ );
+ ASSERT_RETURN_ERROR (PcdStatus);
+}
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c
index 1b74fc17b1..33bc3e1137 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c
@@ -74,3 +74,30 @@ MarkIoMemoryRangeForRuntimeAccess (
return EFI_SUCCESS;
}
+
+VOID
+SetPcdFlashNvStorageBaseAddresses (
+ VOID
+ )
+{
+ RETURN_STATUS PcdStatus;
+
+ //
+ // Set several PCD values to point to flash
+ //
+ PcdStatus = PcdSet64S (
+ PcdFlashNvStorageVariableBase64,
+ (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase)
+ );
+ ASSERT_RETURN_ERROR (PcdStatus);
+ PcdStatus = PcdSet32S (
+ PcdFlashNvStorageFtwWorkingBase,
+ PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase)
+ );
+ ASSERT_RETURN_ERROR (PcdStatus);
+ PcdStatus = PcdSet32S (
+ PcdFlashNvStorageFtwSpareBase,
+ PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase)
+ );
+ ASSERT_RETURN_ERROR (PcdStatus);
+}