diff options
author | Avi Kivity <avi@redhat.com> | 2011-08-08 16:09:04 +0300 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-08 10:15:53 -0500 |
commit | aee97b840fd0362594c954af750491fafad66a3d (patch) | |
tree | 38d92eebc7f845fece1358ef1aeecf6f9741d138 | |
parent | 309cb471c80e5909710d1ee3c3b50d481496d189 (diff) |
pci: pass I/O address space to new PCI bus
This lets us register BARs in the I/O address space.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | hw/apb_pci.c | 1 | ||||
-rw-r--r-- | hw/bonito.c | 1 | ||||
-rw-r--r-- | hw/grackle_pci.c | 8 | ||||
-rw-r--r-- | hw/gt64xxx.c | 4 | ||||
-rw-r--r-- | hw/pc.h | 4 | ||||
-rw-r--r-- | hw/pc_piix.c | 6 | ||||
-rw-r--r-- | hw/pci.c | 18 | ||||
-rw-r--r-- | hw/pci.h | 10 | ||||
-rw-r--r-- | hw/piix_pci.c | 14 | ||||
-rw-r--r-- | hw/ppc4xx_pci.c | 1 | ||||
-rw-r--r-- | hw/ppc_mac.h | 11 | ||||
-rw-r--r-- | hw/ppc_newworld.c | 4 | ||||
-rw-r--r-- | hw/ppc_oldworld.c | 4 | ||||
-rw-r--r-- | hw/ppc_prep.c | 2 | ||||
-rw-r--r-- | hw/ppce500_pci.c | 7 | ||||
-rw-r--r-- | hw/prep_pci.c | 8 | ||||
-rw-r--r-- | hw/prep_pci.h | 4 | ||||
-rw-r--r-- | hw/sh_pci.c | 4 | ||||
-rw-r--r-- | hw/unin_pci.c | 16 | ||||
-rw-r--r-- | hw/versatile_pci.c | 2 |
20 files changed, 91 insertions, 38 deletions
diff --git a/hw/apb_pci.c b/hw/apb_pci.c index 8b9939c06..163822617 100644 --- a/hw/apb_pci.c +++ b/hw/apb_pci.c @@ -348,6 +348,7 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base, d->bus = pci_register_bus(&d->busdev.qdev, "pci", pci_apb_set_irq, pci_pbm_map_irq, d, get_system_memory(), + get_system_io(), 0, 32); pci_bus_set_mem_base(d->bus, mem_base); diff --git a/hw/bonito.c b/hw/bonito.c index 5f62dda6e..8708e9568 100644 --- a/hw/bonito.c +++ b/hw/bonito.c @@ -775,6 +775,7 @@ PCIBus *bonito_init(qemu_irq *pic) pcihost = FROM_SYSBUS(BonitoState, sysbus_from_qdev(dev)); b = pci_register_bus(&pcihost->busdev.qdev, "pci", pci_bonito_set_irq, pci_bonito_map_irq, pic, get_system_memory(), + get_system_io(), 0x28, 32); pcihost->bus = b; qdev_init_nofail(dev); diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c index da67cf9b3..9a823e1c0 100644 --- a/hw/grackle_pci.c +++ b/hw/grackle_pci.c @@ -62,7 +62,8 @@ static void pci_grackle_reset(void *opaque) } PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, - MemoryRegion *address_space) + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io) { DeviceState *dev; SysBusDevice *s; @@ -75,7 +76,10 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci", pci_grackle_set_irq, pci_grackle_map_irq, - pic, address_space, 0, 4); + pic, + address_space_mem, + address_space_io, + 0, 4); pci_create_simple(d->host_state.bus, 0, "grackle"); diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c index 65e63ddab..d5415580e 100644 --- a/hw/gt64xxx.c +++ b/hw/gt64xxx.c @@ -1093,7 +1093,9 @@ PCIBus *gt64120_register(qemu_irq *pic) d = FROM_SYSBUS(GT64120State, s); d->pci.bus = pci_register_bus(&d->busdev.qdev, "pci", gt64120_pci_set_irq, gt64120_pci_map_irq, - pic, get_system_memory(), + pic, + get_system_memory(), + get_system_io(), PCI_DEVFN(18, 0), 4); d->ISD_handle = cpu_register_io_memory(gt64120_read, gt64120_write, d, DEVICE_NATIVE_ENDIAN); @@ -179,7 +179,9 @@ struct PCII440FXState; typedef struct PCII440FXState PCII440FXState; PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, - qemu_irq *pic, MemoryRegion *address_space, + qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, ram_addr_t ram_size); void i440fx_init_memory_mappings(PCII440FXState *d); diff --git a/hw/pc_piix.c b/hw/pc_piix.c index c0a2abe4b..7dd5008dc 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -69,6 +69,7 @@ static void ioapic_init(IsaIrqState *isa_irq_state) /* PC hardware initialisation */ static void pc_init1(MemoryRegion *system_memory, + MemoryRegion *system_io, ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, @@ -129,7 +130,7 @@ static void pc_init1(MemoryRegion *system_memory, if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq, - system_memory, ram_size); + system_memory, system_io, ram_size); } else { pci_bus = NULL; i440fx_state = NULL; @@ -218,6 +219,7 @@ static void pc_init_pci(ram_addr_t ram_size, const char *cpu_model) { pc_init1(get_system_memory(), + get_system_io(), ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, cpu_model, 1, 1); @@ -231,6 +233,7 @@ static void pc_init_pci_no_kvmclock(ram_addr_t ram_size, const char *cpu_model) { pc_init1(get_system_memory(), + get_system_io(), ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, cpu_model, 1, 0); @@ -246,6 +249,7 @@ static void pc_init_isa(ram_addr_t ram_size, if (cpu_model == NULL) cpu_model = "486"; pc_init1(get_system_memory(), + get_system_io(), ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, cpu_model, 0, 1); @@ -264,13 +264,14 @@ int pci_find_domain(const PCIBus *bus) void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, const char *name, - MemoryRegion *address_space, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, uint8_t devfn_min) { qbus_create_inplace(&bus->qbus, &pci_bus_info, parent, name); assert(PCI_FUNC(devfn_min) == 0); bus->devfn_min = devfn_min; - bus->address_space = address_space; + bus->address_space = address_space_mem; /* host bridge */ QLIST_INIT(&bus->child); @@ -280,13 +281,16 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, } PCIBus *pci_bus_new(DeviceState *parent, const char *name, - MemoryRegion *address_space, uint8_t devfn_min) + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, + uint8_t devfn_min) { PCIBus *bus; bus = qemu_mallocz(sizeof(*bus)); bus->qbus.qdev_allocated = 1; - pci_bus_new_inplace(bus, parent, name, address_space, devfn_min); + pci_bus_new_inplace(bus, parent, name, address_space_mem, + address_space_io, devfn_min); return bus; } @@ -315,12 +319,14 @@ void pci_bus_set_mem_base(PCIBus *bus, target_phys_addr_t base) PCIBus *pci_register_bus(DeviceState *parent, const char *name, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, void *irq_opaque, - MemoryRegion *address_space, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, uint8_t devfn_min, int nirq) { PCIBus *bus; - bus = pci_bus_new(parent, name, address_space, devfn_min); + bus = pci_bus_new(parent, name, address_space_mem, + address_space_io, devfn_min); pci_bus_irqs(bus, set_irq, map_irq, irq_opaque, nirq); return bus; } @@ -239,10 +239,13 @@ typedef int (*pci_hotplug_fn)(DeviceState *qdev, PCIDevice *pci_dev, PCIHotplugState state); void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, const char *name, - MemoryRegion *address_space, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, uint8_t devfn_min); PCIBus *pci_bus_new(DeviceState *parent, const char *name, - MemoryRegion *address_space, uint8_t devfn_min); + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, + uint8_t devfn_min); void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, void *irq_opaque, int nirq); int pci_bus_get_irq_level(PCIBus *bus, int irq_num); @@ -250,7 +253,8 @@ void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug, DeviceState *dev); PCIBus *pci_register_bus(DeviceState *parent, const char *name, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, void *irq_opaque, - MemoryRegion *address_space, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, uint8_t devfn_min, int nirq); void pci_device_reset(PCIDevice *dev); void pci_bus_reset(PCIBus *bus); diff --git a/hw/piix_pci.c b/hw/piix_pci.c index 80d666535..28a3ee2e9 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -242,7 +242,8 @@ static PCIBus *i440fx_common_init(const char *device_name, PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic, - MemoryRegion *address_space, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, ram_addr_t ram_size) { DeviceState *dev; @@ -253,8 +254,9 @@ static PCIBus *i440fx_common_init(const char *device_name, dev = qdev_create(NULL, "i440FX-pcihost"); s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev)); - s->address_space = address_space; - b = pci_bus_new(&s->busdev.qdev, NULL, s->address_space, 0); + s->address_space = address_space_mem; + b = pci_bus_new(&s->busdev.qdev, NULL, s->address_space, + address_space_io, 0); s->bus = b; qdev_init_nofail(dev); @@ -291,13 +293,15 @@ static PCIBus *i440fx_common_init(const char *device_name, } PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, - qemu_irq *pic, MemoryRegion *address_space, + qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, ram_addr_t ram_size) { PCIBus *b; b = i440fx_common_init("i440FX", pi440fx_state, piix3_devfn, pic, - address_space, ram_size); + address_space_mem, address_space_io, ram_size); return b; } diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c index 15c24f6e7..c7696b07d 100644 --- a/hw/ppc4xx_pci.c +++ b/hw/ppc4xx_pci.c @@ -348,6 +348,7 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4], ppc4xx_pci_map_irq, pci_irqs, get_system_memory(), + get_system_io(), 0, 4); controller->pci_dev = pci_register_device(controller->pci_state.bus, diff --git a/hw/ppc_mac.h b/hw/ppc_mac.h index 6fad20a74..25a227483 100644 --- a/hw/ppc_mac.h +++ b/hw/ppc_mac.h @@ -55,11 +55,16 @@ qemu_irq *heathrow_pic_init(int *pmem_index, /* Grackle PCI */ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, - MemoryRegion *address_space); + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io); /* UniNorth PCI */ -PCIBus *pci_pmac_init(qemu_irq *pic, MemoryRegion *address_space); -PCIBus *pci_pmac_u3_init(qemu_irq *pic, MemoryRegion *address_space); +PCIBus *pci_pmac_init(qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io); +PCIBus *pci_pmac_u3_init(qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io); /* Mac NVRAM */ typedef struct MacIONVRAMState MacIONVRAMState; diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index 2c0fae8ef..94a21f9ec 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -318,10 +318,10 @@ static void ppc_core99_init (ram_addr_t ram_size, pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL); if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) { /* 970 gets a U3 bus */ - pci_bus = pci_pmac_u3_init(pic, get_system_memory()); + pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99_U3; } else { - pci_bus = pci_pmac_init(pic, get_system_memory()); + pci_bus = pci_pmac_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99; } /* init basic PC hardware */ diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index 585afd6c4..0f99eefaf 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -234,7 +234,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, hw_error("Only 6xx bus is supported on heathrow machine\n"); } pic = heathrow_pic_init(&pic_mem_index, 1, heathrow_irqs); - pci_bus = pci_grackle_init(0xfec00000, pic, get_system_memory()); + pci_bus = pci_grackle_init(0xfec00000, pic, + get_system_memory(), + get_system_io()); pci_vga_init(pci_bus); escc_mem_index = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0], diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 91ebe07dc..38d8573d1 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -649,7 +649,7 @@ static void ppc_prep_init (ram_addr_t ram_size, hw_error("Only 6xx bus is supported on PREP machine\n"); } i8259 = i8259_init(first_cpu->irq_inputs[PPC6xx_INPUT_INT]); - pci_bus = pci_prep_init(i8259, get_system_memory()); + pci_bus = pci_prep_init(i8259, get_system_memory(), get_system_io()); /* Hmm, prep has no pci-isa bridge ??? */ isa_bus_new(NULL); isa_bus_irqs(i8259); diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c index 134453965..6a9f97975 100644 --- a/hw/ppce500_pci.c +++ b/hw/ppce500_pci.c @@ -282,7 +282,8 @@ static int e500_pcihost_initfn(SysBusDevice *dev) PPCE500PCIState *s; PCIBus *b; int i; - MemoryRegion *address_space = get_system_memory(); + MemoryRegion *address_space_mem = get_system_memory(); + MemoryRegion *address_space_io = get_system_io(); h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev)); s = DO_UPCAST(PPCE500PCIState, pci_state, h); @@ -292,8 +293,8 @@ static int e500_pcihost_initfn(SysBusDevice *dev) } b = pci_register_bus(&s->pci_state.busdev.qdev, NULL, mpc85xx_pci_set_irq, - mpc85xx_pci_map_irq, s->irq, address_space, - PCI_DEVFN(0x11, 0), 4); + mpc85xx_pci_map_irq, s->irq, address_space_mem, + address_space_io, PCI_DEVFN(0x11, 0), 4); s->pci_state.bus = b; pci_create_simple(b, 0, "e500-host-bridge"); diff --git a/hw/prep_pci.c b/hw/prep_pci.c index da02f0ea8..58619ddf7 100644 --- a/hw/prep_pci.c +++ b/hw/prep_pci.c @@ -110,7 +110,9 @@ static void prep_set_irq(void *opaque, int irq_num, int level) qemu_set_irq(pic[(irq_num & 1) ? 11 : 9] , level); } -PCIBus *pci_prep_init(qemu_irq *pic, MemoryRegion *address_space) +PCIBus *pci_prep_init(qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io) { PREPPCIState *s; PCIDevice *d; @@ -119,7 +121,9 @@ PCIBus *pci_prep_init(qemu_irq *pic, MemoryRegion *address_space) s = qemu_mallocz(sizeof(PREPPCIState)); s->bus = pci_register_bus(NULL, "pci", prep_set_irq, prep_map_irq, pic, - address_space, 0, 4); + address_space_mem, + address_space_io, + 0, 4); pci_host_conf_register_ioport(0xcf8, s); diff --git a/hw/prep_pci.h b/hw/prep_pci.h index a27368b99..b6b481a51 100644 --- a/hw/prep_pci.h +++ b/hw/prep_pci.h @@ -4,6 +4,8 @@ #include "qemu-common.h" #include "memory.h" -PCIBus *pci_prep_init(qemu_irq *pic, MemoryRegion *address_space); +PCIBus *pci_prep_init(qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io); #endif diff --git a/hw/sh_pci.c b/hw/sh_pci.c index 0ef93a062..cd8650143 100644 --- a/hw/sh_pci.c +++ b/hw/sh_pci.c @@ -128,7 +128,9 @@ static int sh_pci_init_device(SysBusDevice *dev) } s->bus = pci_register_bus(&s->busdev.qdev, "pci", sh_pci_set_irq, sh_pci_map_irq, - s->irq, get_system_memory(), + s->irq, + get_system_memory(), + get_system_io(), PCI_DEVFN(0, 0), 4); s->memconfig = cpu_register_io_memory(sh_pci_reg.r, sh_pci_reg.w, s, DEVICE_NATIVE_ENDIAN); diff --git a/hw/unin_pci.c b/hw/unin_pci.c index b499523c9..f896f8c76 100644 --- a/hw/unin_pci.c +++ b/hw/unin_pci.c @@ -201,7 +201,9 @@ static int pci_unin_internal_init_device(SysBusDevice *dev) return 0; } -PCIBus *pci_pmac_init(qemu_irq *pic, MemoryRegion *address_space) +PCIBus *pci_pmac_init(qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io) { DeviceState *dev; SysBusDevice *s; @@ -215,7 +217,9 @@ PCIBus *pci_pmac_init(qemu_irq *pic, MemoryRegion *address_space) d = FROM_SYSBUS(UNINState, s); d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci", pci_unin_set_irq, pci_unin_map_irq, - pic, address_space, + pic, + address_space_mem, + address_space_io, PCI_DEVFN(11, 0), 4); #if 0 @@ -253,7 +257,9 @@ PCIBus *pci_pmac_init(qemu_irq *pic, MemoryRegion *address_space) return d->host_state.bus; } -PCIBus *pci_pmac_u3_init(qemu_irq *pic, MemoryRegion *address_space) +PCIBus *pci_pmac_u3_init(qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io) { DeviceState *dev; SysBusDevice *s; @@ -268,7 +274,9 @@ PCIBus *pci_pmac_u3_init(qemu_irq *pic, MemoryRegion *address_space) d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci", pci_unin_set_irq, pci_unin_map_irq, - pic, address_space, + pic, + address_space_mem, + address_space_io, PCI_DEVFN(11, 0), 4); sysbus_mmio_map(s, 0, 0xf0800000); diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c index cffe38718..e1d5c0bf5 100644 --- a/hw/versatile_pci.c +++ b/hw/versatile_pci.c @@ -112,7 +112,7 @@ static int pci_vpb_init(SysBusDevice *dev) } bus = pci_register_bus(&dev->qdev, "pci", pci_vpb_set_irq, pci_vpb_map_irq, s->irq, - get_system_memory(), + get_system_memory(), get_system_io(), PCI_DEVFN(11, 0), 4); /* ??? Register memory space. */ |