mac_newworld: move wiring of macio IRQs to macio_newworld_realize()
Since the macio device has a link to the PIC device, we can now wire up the IRQs directly via qdev GPIOs rather than having to use an intermediate array. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
040b27c0b9
commit
0fcd2a814a
|
@ -279,11 +279,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
||||||
{
|
{
|
||||||
MacIOState *s = MACIO(d);
|
MacIOState *s = MACIO(d);
|
||||||
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
|
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
|
||||||
|
DeviceState *pic_dev = DEVICE(ns->pic);
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
SysBusDevice *sysbus_dev;
|
SysBusDevice *sysbus_dev;
|
||||||
MemoryRegion *timer_memory = NULL;
|
MemoryRegion *timer_memory = NULL;
|
||||||
int i;
|
|
||||||
int cur_irq = 0;
|
|
||||||
|
|
||||||
macio_common_realize(d, &err);
|
macio_common_realize(d, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -292,11 +291,14 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
|
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, ns->irqs[cur_irq++]);
|
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||||
|
NEWWORLD_CUDA_IRQ));
|
||||||
|
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->escc);
|
sysbus_dev = SYS_BUS_DEVICE(&s->escc);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, ns->irqs[cur_irq++]);
|
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||||
sysbus_connect_irq(sysbus_dev, 1, ns->irqs[cur_irq++]);
|
NEWWORLD_ESCCB_IRQ));
|
||||||
|
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
||||||
|
NEWWORLD_ESCCA_IRQ));
|
||||||
|
|
||||||
/* OpenPIC */
|
/* OpenPIC */
|
||||||
sysbus_dev = SYS_BUS_DEVICE(ns->pic);
|
sysbus_dev = SYS_BUS_DEVICE(ns->pic);
|
||||||
|
@ -304,15 +306,22 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||||
|
|
||||||
/* IDE buses */
|
/* IDE buses */
|
||||||
for (i = 0; i < ARRAY_SIZE(ns->ide); i++) {
|
macio_realize_ide(s, &ns->ide[0],
|
||||||
qemu_irq irq0 = ns->irqs[cur_irq++];
|
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ),
|
||||||
qemu_irq irq1 = ns->irqs[cur_irq++];
|
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_DMA_IRQ),
|
||||||
|
0x16, &err);
|
||||||
|
if (err) {
|
||||||
|
error_propagate(errp, err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
macio_realize_ide(s, &ns->ide[i], irq0, irq1, 0x16 + (i * 4), &err);
|
macio_realize_ide(s, &ns->ide[1],
|
||||||
if (err) {
|
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_IRQ),
|
||||||
error_propagate(errp, err);
|
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_DMA_IRQ),
|
||||||
return;
|
0x1a, &err);
|
||||||
}
|
if (err) {
|
||||||
|
error_propagate(errp, err);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer */
|
/* Timer */
|
||||||
|
@ -328,8 +337,6 @@ static void macio_newworld_init(Object *obj)
|
||||||
NewWorldMacIOState *ns = NEWWORLD_MACIO(obj);
|
NewWorldMacIOState *ns = NEWWORLD_MACIO(obj);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
qdev_init_gpio_out(DEVICE(obj), ns->irqs, ARRAY_SIZE(ns->irqs));
|
|
||||||
|
|
||||||
object_property_add_link(obj, "pic", TYPE_OPENPIC,
|
object_property_add_link(obj, "pic", TYPE_OPENPIC,
|
||||||
(Object **) &ns->pic,
|
(Object **) &ns->pic,
|
||||||
qdev_prop_allow_set_link_before_realize,
|
qdev_prop_allow_set_link_before_realize,
|
||||||
|
|
|
@ -375,20 +375,6 @@ static void ppc_core99_init(MachineState *machine)
|
||||||
/* MacIO */
|
/* MacIO */
|
||||||
macio = NEWWORLD_MACIO(pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO));
|
macio = NEWWORLD_MACIO(pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO));
|
||||||
dev = DEVICE(macio);
|
dev = DEVICE(macio);
|
||||||
qdev_connect_gpio_out(dev, 0,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_CUDA_IRQ));
|
|
||||||
qdev_connect_gpio_out(dev, 1,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCB_IRQ));
|
|
||||||
qdev_connect_gpio_out(dev, 2,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCA_IRQ));
|
|
||||||
qdev_connect_gpio_out(dev, 3,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ));
|
|
||||||
qdev_connect_gpio_out(dev, 4,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_DMA_IRQ));
|
|
||||||
qdev_connect_gpio_out(dev, 5,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_IRQ));
|
|
||||||
qdev_connect_gpio_out(dev, 6,
|
|
||||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_DMA_IRQ));
|
|
||||||
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
||||||
object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic",
|
object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic",
|
||||||
&error_abort);
|
&error_abort);
|
||||||
|
|
|
@ -71,7 +71,6 @@ typedef struct NewWorldMacIOState {
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
|
|
||||||
OpenPICState *pic;
|
OpenPICState *pic;
|
||||||
qemu_irq irqs[7];
|
|
||||||
MACIOIDEState ide[2];
|
MACIOIDEState ide[2];
|
||||||
} NewWorldMacIOState;
|
} NewWorldMacIOState;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue