From 2ae0e48d5fd2cb7c5bc5c392edf2dc33ac2959d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 7 Jun 2013 14:11:07 +0200 Subject: [PATCH] isa: QOM'ify ISABus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename its parent field and use ISA_BUS() where necessary. Signed-off-by: Andreas Färber --- hw/isa/i82378.c | 2 +- hw/isa/isa-bus.c | 8 ++++---- hw/isa/piix4.c | 2 +- hw/isa/vt82c686.c | 2 +- hw/ppc/prep.c | 2 +- hw/sparc64/sun4u.c | 3 +-- include/hw/isa/isa.h | 5 ++++- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index cced9aff26..278e178173 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -168,7 +168,7 @@ static void i82378_request_pic_irq(void *opaque, int irq, int level) static void i82378_init(DeviceState *dev, I82378State *s) { - ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0")); + ISABus *isabus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); ISADevice *pit; ISADevice *isa; qemu_irq *out0_irq; diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index f12b15da32..7aa9b89b5c 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -55,7 +55,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io) qdev_init_nofail(dev); } - isabus = FROM_QBUS(ISABus, qbus_create(TYPE_ISA_BUS, dev, NULL)); + isabus = ISA_BUS(qbus_create(TYPE_ISA_BUS, dev, NULL)); isabus->address_space_io = address_space_io; return isabus; } @@ -76,7 +76,7 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs) */ qemu_irq isa_get_irq(ISADevice *dev, int isairq) { - assert(!dev || DO_UPCAST(ISABus, qbus, dev->qdev.parent_bus) == isabus); + assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus); if (isairq < 0 || isairq > 15) { hw_error("isa irq %d invalid", isairq); } @@ -135,7 +135,7 @@ ISADevice *isa_create(ISABus *bus, const char *name) hw_error("Tried to create isa device %s with no isa bus present.", name); } - dev = qdev_create(&bus->qbus, name); + dev = qdev_create(BUS(bus), name); return ISA_DEVICE(dev); } @@ -147,7 +147,7 @@ ISADevice *isa_try_create(ISABus *bus, const char *name) hw_error("Tried to create isa device %s with no isa bus present.", name); } - dev = qdev_try_create(&bus->qbus, name); + dev = qdev_try_create(BUS(bus), name); return ISA_DEVICE(dev); } diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index d750413a7e..1a1d4518ce 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -98,7 +98,7 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn) PCIDevice *d; d = pci_create_simple_multifunction(bus, devfn, true, "PIIX4"); - *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0")); + *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); return d->devfn; } diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 52619276bd..391d90d14a 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -450,7 +450,7 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn) d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B"); - return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0")); + return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); } static void via_class_init(ObjectClass *klass, void *data) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index be8a50ec4a..9e770ab350 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -601,7 +601,7 @@ static void ppc_prep_init(QEMUMachineInitArgs *args) sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11)); sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11)); - isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&pci->qdev, "isa.0")); + isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0")); /* Super I/O (parallel + serial ports) */ isa = isa_create(isa_bus, TYPE_PC87312); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 2c2a111711..a6a3b76a76 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -585,8 +585,7 @@ pci_ebus_init(PCIBus *bus, int devfn, qemu_irq *irqs) ISABus *isa_bus; pci_dev = pci_create_simple(bus, devfn, "ebus"); - isa_bus = DO_UPCAST(ISABus, qbus, - qdev_get_child_bus(&pci_dev->qdev, "isa.0")); + isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); isa_irq = qemu_allocate_irqs(isa_irq_handler, irqs, 16); isa_bus_irqs(isa_bus, isa_irq); return isa_bus; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 1f6ff55605..da731d7bc7 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -25,7 +25,10 @@ typedef struct ISADeviceClass { } ISADeviceClass; struct ISABus { - BusState qbus; + /*< private >*/ + BusState parent_obj; + /*< public >*/ + MemoryRegion *address_space_io; qemu_irq *irqs; };