[edk2-devel] [PATCH v4 3/7] OvmfPkg/RiscVVirt: VirtNorFlashPlatformLib: Fix wrong flash size

Tuan Phan tphan at ventanamicro.com
Fri Jun 23 18:39:30 UTC 2023


The size should be for single region, not the whole firmware FD.

Signed-off-by: Tuan Phan <tphan at ventanamicro.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin at intel.com>
Reviewed-by: Sunil V L <sunilvl at ventanamicro.com>
---
 .../Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c b/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c
index fdc2ccb6294e..33f3a01b06f4 100644
--- a/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c
+++ b/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c
@@ -24,7 +24,8 @@ VIRT_NOR_FLASH_DESCRIPTION  mNorFlashDevice =
 {
   FixedPcdGet32 (PcdOvmfFdBaseAddress),
   FixedPcdGet64 (PcdFlashNvStorageVariableBase),
-  FixedPcdGet32 (PcdOvmfFirmwareFdSize),
+  FixedPcdGet32 (PcdOvmfFirmwareFdSize) -
+  (FixedPcdGet64 (PcdFlashNvStorageVariableBase) - FixedPcdGet32 (PcdOvmfFdBaseAddress)),
   QEMU_NOR_BLOCK_SIZE
 };
 
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106305): https://edk2.groups.io/g/devel/message/106305
Mute This Topic: https://groups.io/mt/99724473/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list