]> xenbits.xensource.com Git - osstest/seabios.git/commitdiff
move 64bit pci window to end of address space
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 9 Sep 2022 08:16:31 +0000 (10:16 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 24 Aug 2023 08:56:21 +0000 (10:56 +0200)
When the size of the physical address space is known (PhysBits is not
zero) move the 64bit pci io window to the end of the address space.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
src/fw/pciinit.c

index badf13d3233b6158b2d1ac2f5cc07400e5079f58..0fcd2be598a23b8c3ff0d46eca10a741f54782ae 100644 (file)
@@ -1128,6 +1128,14 @@ static void pci_bios_map_devices(struct pci_bus *busses)
         r64_mem.base = le64_to_cpu(romfile_loadint("etc/reserved-memory-end", 0));
         if (r64_mem.base < 0x100000000LL + RamSizeOver4G)
             r64_mem.base = 0x100000000LL + RamSizeOver4G;
+        if (CPUPhysBits) {
+            u64 top = 1LL << CPUPhysBits;
+            u64 size = (ALIGN(sum_mem, (1LL<<30)) +
+                        ALIGN(sum_pref, (1LL<<30)));
+            if (r64_mem.base < top - size) {
+                r64_mem.base = top - size;
+            }
+        }
         r64_mem.base = ALIGN(r64_mem.base, align_mem);
         r64_mem.base = ALIGN(r64_mem.base, (1LL<<30));    // 1G hugepage
         r64_pref.base = r64_mem.base + sum_mem;