From 2b20a34fd5e4d7d9cabc6668e22f3e96ab3ad54e Mon Sep 17 00:00:00 2001 From: lixianglai Date: Thu, 9 Dec 2021 19:28:01 +0800 Subject: 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 Reviewed-by: Gerd Hoffmann Reviewed-by: Jiewen Yao --- OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c') diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c index 99558e97eb..4fc715dc36 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); -- cgit v1.2.3