summaryrefslogtreecommitdiff
path: root/OvmfPkg/EmuVariableFvbRuntimeDxe
diff options
context:
space:
mode:
authorlixianglai <lixianglai@loongson.cn>2021-12-09 19:28:01 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-11 16:13:07 +0000
commit2b20a34fd5e4d7d9cabc6668e22f3e96ab3ad54e (patch)
tree25381b49d1cd6415a000e238a692761ffec838a7 /OvmfPkg/EmuVariableFvbRuntimeDxe
parentf6df289a1c43f60143bba530a823d3fd2eba6223 (diff)
downloadedk2-2b20a34fd5e4d7d9cabc6668e22f3e96ab3ad54e.zip
edk2-2b20a34fd5e4d7d9cabc6668e22f3e96ab3ad54e.tar.gz
edk2-2b20a34fd5e4d7d9cabc6668e22f3e96ab3ad54e.tar.bz2
OvmfPkg-EmuVariableFvbRuntimeDxe: Support Access To Memory Above 4G
In FvbInitialize Function, PcdFlashNvStorageVariableBase64 PcdFlashNvStorageFtwWorkingBase PcdFlashNvStorageFtwSpareBase will not exceed 0x100000000, Due to truncation and variable type limitations. That leads to the NV variable cannot be saved to the memory above 4G. Modify as follows: 1.Remove the forced type conversion of UINT32. 2.Use UINT64 type variables. Signed-off-by: xianglai li <lixianglai@loongson.cn> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'OvmfPkg/EmuVariableFvbRuntimeDxe')
-rw-r--r--OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c14
-rw-r--r--OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf4
2 files changed, 9 insertions, 9 deletions
diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
index 99558e9..4fc715d 100644
--- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
+++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
@@ -782,16 +782,16 @@ FvbInitialize (
InitializeFvAndVariableStoreHeaders (Ptr);
}
- PcdStatus = PcdSet64S (PcdFlashNvStorageVariableBase64, (UINT32)(UINTN)Ptr);
+ PcdStatus = PcdSet64S (PcdFlashNvStorageVariableBase64, (UINTN)Ptr);
ASSERT_RETURN_ERROR (PcdStatus);
//
// Initialize the Fault Tolerant Write data area
//
SubPtr = (VOID *)((UINT8 *)Ptr + PcdGet32 (PcdFlashNvStorageVariableSize));
- PcdStatus = PcdSet32S (
- PcdFlashNvStorageFtwWorkingBase,
- (UINT32)(UINTN)SubPtr
+ PcdStatus = PcdSet64S (
+ PcdFlashNvStorageFtwWorkingBase64,
+ (UINTN)SubPtr
);
ASSERT_RETURN_ERROR (PcdStatus);
@@ -800,9 +800,9 @@ FvbInitialize (
//
SubPtr = (VOID *)((UINT8 *)Ptr +
EMU_FVB_NUM_SPARE_BLOCKS * EMU_FVB_BLOCK_SIZE);
- PcdStatus = PcdSet32S (
- PcdFlashNvStorageFtwSpareBase,
- (UINT32)(UINTN)SubPtr
+ PcdStatus = PcdSet64S (
+ PcdFlashNvStorageFtwSpareBase64,
+ (UINTN)SubPtr
);
ASSERT_RETURN_ERROR (PcdStatus);
diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
index 225ea27..0811545 100644
--- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
+++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
@@ -59,8 +59,8 @@
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
[Depex]