Add a piix4 memory setup function to make the control flow more clear.
Set the new mtrr_base variable to the start of the 32bit pci window to make sure the mtrr entry added covers the I/O window.
Make the 32bit pci window start at 0x80000000, 0xc0000000 or 0xe000000 (depending on the memory installed) so we can cover the whole window with a single mtrr entry.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/pciinit.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/pciinit.c b/src/pciinit.c index 0b4a9e4..137c667 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -597,10 +597,29 @@ static void pci_region_map_entries(struct pci_bus *busses, struct pci_region *r) } }
+void i440fx_mem_addr_init(struct pci_device *dev, void *arg) +{ + if (RamSize <= 0x80000000) + pcimem_start = 0x80000000; + else if (RamSize <= 0xc0000000) + pcimem_start = 0xc0000000; + + mtrr_base = pcimem_start; +} + +static const struct pci_device_id pci_mem_addr_tbl[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, + i440fx_mem_addr_init), + PCI_DEVICE_END, +}; + static void pci_bios_map_devices(struct pci_bus *busses) { pcimem_start = RamSize;
+ /* chipset specific memory setup */ + pci_find_init_device(pci_mem_addr_tbl, NULL); + if (pci_bios_init_root_regions(busses)) { struct pci_region r64_mem, r64_pref; r64_mem.list = NULL;