isa: QOM'ify ISABus

Rename its parent field and use ISA_BUS() where necessary.

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-06-07 14:11:07 +02:00
parent d2628b7d18
commit 2ae0e48d5f
7 changed files with 13 additions and 11 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -25,7 +25,10 @@ typedef struct ISADeviceClass {
} ISADeviceClass;
struct ISABus {
BusState qbus;
/*< private >*/
BusState parent_obj;
/*< public >*/
MemoryRegion *address_space_io;
qemu_irq *irqs;
};