mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
d6961bb47a
commit
cd99d07d53
|
@ -1051,24 +1051,7 @@ FvbInitialize (
|
||||||
|
|
||||||
MarkIoMemoryRangeForRuntimeAccess (BaseAddress, Length);
|
MarkIoMemoryRangeForRuntimeAccess (BaseAddress, Length);
|
||||||
|
|
||||||
//
|
SetPcdFlashNvStorageBaseAddresses ();
|
||||||
// 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);
|
|
||||||
|
|
||||||
FwhInstance = (EFI_FW_VOL_INSTANCE *)
|
FwhInstance = (EFI_FW_VOL_INSTANCE *)
|
||||||
(
|
(
|
||||||
|
|
|
@ -190,4 +190,9 @@ MarkIoMemoryRangeForRuntimeAccess (
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetPcdFlashNvStorageBaseAddresses (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -216,3 +216,30 @@ MarkIoMemoryRangeForRuntimeAccess (
|
||||||
|
|
||||||
return Status;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -74,3 +74,30 @@ MarkIoMemoryRangeForRuntimeAccess (
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue