]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c
ArmVirtPkg/NorFlashQemuLib: disregard our primary FV
[mirror_edk2.git] / ArmVirtPkg / Library / NorFlashQemuLib / NorFlashQemuLib.c
index 2678f57eaaad0915cee88268a10e19b430d2d429..d238e39a59f101315e0b1e3a4f01c7b4adaba9ad 100644 (file)
@@ -75,13 +75,22 @@ NorFlashPlatformGetDevices (
       Size = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));\r
       Reg += 4;\r
 \r
+      PropSize -= 4 * sizeof (UINT32);\r
+\r
+      //\r
+      // Disregard any flash devices that overlap with the primary FV.\r
+      // The firmware is not updatable from inside the guest anyway.\r
+      //\r
+      if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&\r
+          (Base + Size) > PcdGet64 (PcdFvBaseAddress)) {\r
+        continue;\r
+      }\r
+\r
       mNorFlashDevices[Num].DeviceBaseAddress = (UINTN)Base;\r
       mNorFlashDevices[Num].RegionBaseAddress = (UINTN)Base;\r
       mNorFlashDevices[Num].Size              = (UINTN)Size;\r
       mNorFlashDevices[Num].BlockSize         = QEMU_NOR_BLOCK_SIZE;\r
       Num++;\r
-\r
-      PropSize -= 4 * sizeof (UINT32);\r
     }\r
   }\r
 \r