diff options
author | Andreas Färber <andreas.faerber@web.de> | 2012-01-03 02:42:46 +0100 |
---|---|---|
committer | Andreas Färber <andreas.faerber@web.de> | 2012-01-20 00:27:12 +0100 |
commit | 8ca8c7bce027d0f4aaa8ca108ebae37021361b98 (patch) | |
tree | acdb23f34691db3411c04539598ce5358b88fb93 /hw/ppc_prep.c | |
parent | 7e5610ff72b0d12feb24d1e973e4be303f422eb6 (diff) |
prep: qdev'ify Raven host bridge (SysBus)
Drop pci_prep_init() in favor of extended device state. Inspired by
patches from Hervé and Alex.
Assign the 4 IRQs from the board after device instantiation. This moves
the knowledge out of prep_pci and allows for future machines with
different IRQ wiring (IBM 40P). Suggested by Alex.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Cc: Hervé Poussineau <hpoussin@reactos.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ppc_prep.c')
-rw-r--r-- | hw/ppc_prep.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 1cc0ae01f6..62d0e36413 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -29,7 +29,7 @@ #include "sysemu.h" #include "isa.h" #include "pci.h" -#include "prep_pci.h" +#include "pci_host.h" #include "usb-ohci.h" #include "ppc.h" #include "boards.h" @@ -522,6 +522,9 @@ static void ppc_prep_init (ram_addr_t ram_size, MemoryRegion *bios = g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base; long kernel_size, initrd_size; + DeviceState *dev; + SysBusDevice *sys; + PCIHostState *pcihost; PCIBus *pci_bus; ISABus *isa_bus; qemu_irq *i8259; @@ -633,7 +636,23 @@ static void ppc_prep_init (ram_addr_t ram_size, /* Hmm, prep has no pci-isa bridge ??? */ isa_bus = isa_bus_new(NULL, get_system_io()); i8259 = i8259_init(isa_bus, first_cpu->irq_inputs[PPC6xx_INPUT_INT]); - pci_bus = pci_prep_init(i8259, get_system_memory(), get_system_io()); + + dev = qdev_create(NULL, "raven-pcihost"); + sys = sysbus_from_qdev(dev); + pcihost = DO_UPCAST(PCIHostState, busdev, sys); + pcihost->address_space = get_system_memory(); + qdev_init_nofail(dev); + qdev_property_add_child(qdev_get_root(), "raven", dev, NULL); + pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); + if (pci_bus == NULL) { + fprintf(stderr, "Couldn't create PCI host controller.\n"); + exit(1); + } + sysbus_connect_irq(&pcihost->busdev, 0, i8259[9]); + sysbus_connect_irq(&pcihost->busdev, 1, i8259[11]); + sysbus_connect_irq(&pcihost->busdev, 2, i8259[9]); + sysbus_connect_irq(&pcihost->busdev, 3, i8259[11]); + isa_bus_irqs(isa_bus, i8259); // pci_bus = i440fx_init(); /* Register 8 MB of ISA IO space (needed for non-contiguous map) */ |