@@ -32,6 +32,7 @@
#include "hw/mips/bootloader.h"
#include "hw/mips/cpudevs.h"
#include "hw/pci/pci.h"
+#include "hw/pci-host/bonito.h"
#include "hw/loader.h"
#include "hw/ide/pci.h"
#include "hw/qdev-properties.h"
@@ -292,7 +293,10 @@ static void mips_fuloong2e_init(MachineState *machine)
cpu_mips_clock_init(cpu);
/* North bridge, Bonito --> IP2 */
- pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
+ dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[2]);
+ pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
/* South bridge -> IP5 */
pci_dev = pci_create_simple_multifunction(pci_bus,
@@ -44,7 +44,6 @@
#include "qemu/error-report.h"
#include "hw/pci/pci.h"
#include "hw/irq.h"
-#include "hw/mips/mips.h"
#include "hw/pci-host/bonito.h"
#include "hw/pci/pci_host.h"
#include "migration/vmstate.h"
@@ -750,20 +749,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp)
pci_set_byte(dev->config + PCI_MAX_LAT, 0x00);
}
-PCIBus *bonito_init(qemu_irq *pic)
-{
- DeviceState *dev;
- PCIHostState *phb;
-
- dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE);
- phb = PCI_HOST_BRIDGE(dev);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, *pic);
-
- return phb->bus;
-}
-
static void bonito_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -9,9 +9,6 @@
#include "exec/memory.h"
-/* bonito.c */
-PCIBus *bonito_init(qemu_irq *pic);
-
/* rc4030.c */
typedef struct rc4030DMAState *rc4030_dma;
void rc4030_dma_read(void *dma, uint8_t *buf, int len);
This helper is trivial and is called once, directly open-code it. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/mips/fuloong2e.c | 6 +++++- hw/pci-host/bonito.c | 15 --------------- include/hw/mips/mips.h | 3 --- 3 files changed, 5 insertions(+), 19 deletions(-)