diff options
author | Andreas Färber <afaerber@suse.de> | 2013-04-27 22:18:40 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-29 08:27:47 -0500 |
commit | 29bb5317cb7b23422b2612025d56055bbf0bbd02 (patch) | |
tree | aaa01076cc271286ac563c63310e5fdd2ee38ee0 /hw/intc/i8259.c | |
parent | eb1440e7ec522784f4351bb5e88436cc3cd9abd7 (diff) |
i8259: QOM cleanups
Eliminate DO_UPCAST() for PICCommonState. Prepares for ISA realizefn.
Also give the i8259_common type registration functions unique names
while at it.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id: 1367093935-29091-6-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/intc/i8259.c')
-rw-r--r-- | hw/intc/i8259.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index ce14bd0f94..fef00fca75 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -182,7 +182,7 @@ static void pic_intack(PICCommonState *s, int irq) int pic_read_irq(DeviceState *d) { - PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, d); + PICCommonState *s = PIC_COMMON(d); int irq, irq2, intno; irq = pic_get_irq(s); @@ -229,7 +229,7 @@ static void pic_init_reset(PICCommonState *s) static void pic_reset(DeviceState *dev) { - PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, dev); + PICCommonState *s = PIC_COMMON(dev); s->elcr = 0; pic_init_reset(s); @@ -361,7 +361,7 @@ static uint64_t pic_ioport_read(void *opaque, hwaddr addr, int pic_get_output(DeviceState *d) { - PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, d); + PICCommonState *s = PIC_COMMON(d); return (pic_get_irq(s) >= 0); } @@ -400,11 +400,13 @@ static const MemoryRegionOps pic_elcr_ioport_ops = { static void pic_init(PICCommonState *s) { + DeviceState *dev = DEVICE(s); + memory_region_init_io(&s->base_io, &pic_base_ioport_ops, s, "pic", 2); memory_region_init_io(&s->elcr_io, &pic_elcr_ioport_ops, s, "elcr", 1); - qdev_init_gpio_out(&s->dev.qdev, s->int_out, ARRAY_SIZE(s->int_out)); - qdev_init_gpio_in(&s->dev.qdev, pic_set_irq, 8); + qdev_init_gpio_out(dev, s->int_out, ARRAY_SIZE(s->int_out)); + qdev_init_gpio_in(dev, pic_set_irq, 8); } void pic_info(Monitor *mon, const QDict *qdict) @@ -416,7 +418,7 @@ void pic_info(Monitor *mon, const QDict *qdict) return; } for (i = 0; i < 2; i++) { - s = i == 0 ? DO_UPCAST(PICCommonState, dev.qdev, isa_pic) : slave_pic; + s = i == 0 ? PIC_COMMON(isa_pic) : slave_pic; monitor_printf(mon, "pic%d: irr=%02x imr=%02x isr=%02x hprio=%d " "irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n", i, s->irr, s->imr, s->isr, s->priority_add, @@ -467,7 +469,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq) irq_set[i + 8] = qdev_get_gpio_in(&dev->qdev, i); } - slave_pic = DO_UPCAST(PICCommonState, dev, dev); + slave_pic = PIC_COMMON(dev); return irq_set; } |