]> xenbits.xensource.com Git - seabios.git/commitdiff
pci: map 64-bit BARs at location provided by emulator
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 26 Nov 2013 11:48:20 +0000 (12:48 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 29 Nov 2013 08:34:32 +0000 (09:34 +0100)
Currently 64-bit PCI BARs are unconditionally mapped by BIOS right
over 4G + RamSizeOver4G location, which doesn't allow to reserve
extra space before 64-bit PCI window. For memory hotplug an extra
RAM space might be reserved after present 64-bit RAM end and BIOS
should map 64-bit PCI BARs after it.

Introduce "etc/reserved-memory-end" romfile to provide BIOS a hint
where it should start mapping of 64-bit PCI BARs. If romfile is
missing, BIOS reverts to legacy behavior and starts mapping after
high memory.

Based-on-patch-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
src/fw/pciinit.c

index 77a515b5d29b0eb4049dbb5e1686e556f779d85a..a24b8ff94f3a09c866258521a124f28fd3349fd1 100644 (file)
@@ -19,6 +19,8 @@
 #include "string.h" // memset
 #include "util.h" // pci_setup
 #include "x86.h" // outb
+#include "byteorder.h" // le64_to_cpu
+#include "romfile.h" // romfile_loadint
 
 #define PCI_DEVICE_MEM_MIN    (1<<12)  // 4k == page size
 #define PCI_BRIDGE_MEM_MIN    (1<<21)  // 2M == hugepage size
@@ -784,7 +786,9 @@ static void pci_bios_map_devices(struct pci_bus *busses)
         u64 align_mem = pci_region_align(&r64_mem);
         u64 align_pref = pci_region_align(&r64_pref);
 
-        r64_mem.base = 0x100000000LL + RamSizeOver4G;
+        r64_mem.base = le64_to_cpu(romfile_loadint("etc/reserved-memory-end", 0));
+        if (r64_mem.base < 0x100000000LL + RamSizeOver4G)
+            r64_mem.base = 0x100000000LL + RamSizeOver4G;
         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;