Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/pciinit.c | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/pciinit.c b/src/pciinit.c index 537eed0..5ae141f 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -344,12 +344,14 @@ static const struct pci_device_id pci_class_tbl[] = { PCI_DEVICE_CLASS(PCI_VENDOR_ID_APPLE, 0x0017, 0xff00, apple_macio_init), PCI_DEVICE_CLASS(PCI_VENDOR_ID_APPLE, 0x0022, 0xff00, apple_macio_init),
+#if 0 /* PCI bridge */ PCI_DEVICE_CLASS(PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, pci_bios_init_device_bridge),
/* default */ PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID, pci_bios_allocate_regions), +#endif
PCI_DEVICE_END, }; @@ -608,6 +610,8 @@ static void pci_bios_map_device(struct pci_bus *bus, u16 bdf) return; } struct pci_bus *s = busses + secbus; + u32 limit; + s->io_base = pci_bios_bus_get_addr (bus, PCI_BASE_ADDRESS_SPACE_IO, s->io_size); s->mem_base = pci_bios_bus_get_addr @@ -616,7 +620,25 @@ static void pci_bios_map_device(struct pci_bus *bus, u16 bdf) (bus, PCI_BASE_ADDRESS_MEM_PREFETCH, s->prefmem_size); dprintf(1, "PCI: init bases bus %d (secondary)\n", secbus); pci_bios_init_bus_bases(s); - /* TODO: commit assignments */ + + limit = s->io_base + s->io_size - 1; + pci_config_writeb(bdf, PCI_IO_BASE, s->io_base >> PCI_IO_SHIFT); + pci_config_writew(bdf, PCI_IO_BASE_UPPER16, 0); + pci_config_writeb(bdf, PCI_IO_LIMIT, limit >> PCI_IO_SHIFT); + pci_config_writew(bdf, PCI_IO_LIMIT_UPPER16, 0); + + limit = s->mem_base + s->mem_size - 1; + pci_config_writew(bdf, PCI_MEMORY_BASE, s->mem_base >> PCI_MEMORY_SHIFT); + pci_config_writew(bdf, PCI_MEMORY_LIMIT, limit >> PCI_MEMORY_SHIFT); + + limit = s->prefmem_base + s->prefmem_size - 1; + pci_config_writew(bdf, PCI_PREF_MEMORY_BASE, + s->prefmem_base >> PCI_PREF_MEMORY_SHIFT); + pci_config_writew(bdf, PCI_PREF_MEMORY_LIMIT, + limit >> PCI_PREF_MEMORY_SHIFT); + pci_config_writel(bdf, PCI_PREF_BASE_UPPER32, 0); + pci_config_writel(bdf, PCI_PREF_LIMIT_UPPER32, 0); + pci_bios_map_device_in_bus(secbus); return; } @@ -632,7 +654,7 @@ static void pci_bios_map_device(struct pci_bus *bus, u16 bdf) dprintf(1, " bar %d, addr %x, size %x [%s]\n", i, addr, size, val & PCI_BASE_ADDRESS_SPACE_IO ? "io" : "mem"); - /* TODO: commit assignments */ + pci_set_io_region_addr(bdf, i, addr);
if (!(val & PCI_BASE_ADDRESS_SPACE_IO) && (val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) { @@ -777,9 +799,12 @@ pci_setup(void) pci_bios_init_root_regions(); pci_bios_map_device_in_bus(0 /* host bus */);
+#if 0 dprintf(1, "=== PCI old allocation pass ===\n"); foreachpci(bdf, max) { pci_init_device(pci_isa_bridge_tbl, bdf, NULL); } +#endif + pci_bios_init_device_in_bus(0 /* host bus */); }