[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 10/32] intc/openpic: Convert to QOM realize
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 10/32] intc/openpic: Convert to QOM realize |
Date: |
Sun, 30 Jun 2013 03:44:47 +0200 |
From: Andreas Färber <address@hidden>
Split qdev initfn into instance_init and realize functions.
Change one occurrence of "klass" while at it.
Signed-off-by: Andreas Färber <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/intc/openpic.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index fc2d104..a26c641 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -1527,8 +1527,16 @@ static void map_list(OpenPICState *opp, const MemReg
*list, int *count)
}
}
-static int openpic_init(SysBusDevice *dev)
+static void openpic_init(Object *obj)
{
+ OpenPICState *opp = OPENPIC(obj);
+
+ memory_region_init(&opp->mem, "openpic", 0x40000);
+}
+
+static void openpic_realize(DeviceState *dev, Error **errp)
+{
+ SysBusDevice *d = SYS_BUS_DEVICE(dev);
OpenPICState *opp = OPENPIC(dev);
int i, j;
int list_count = 0;
@@ -1562,8 +1570,6 @@ static int openpic_init(SysBusDevice *dev)
{NULL}
};
- memory_region_init(&opp->mem, "openpic", 0x40000);
-
switch (opp->model) {
case OPENPIC_MODEL_FSL_MPIC_20:
default:
@@ -1606,9 +1612,9 @@ static int openpic_init(SysBusDevice *dev)
opp->brr1 = -1;
opp->mpic_mode_mask = GCR_MODE_MIXED;
- /* Only UP supported today */
if (opp->nb_cpus != 1) {
- return -EINVAL;
+ error_setg(errp, "Only UP supported today");
+ return;
}
map_list(opp, list_le, &list_count);
@@ -1618,17 +1624,15 @@ static int openpic_init(SysBusDevice *dev)
for (i = 0; i < opp->nb_cpus; i++) {
opp->dst[i].irqs = g_new(qemu_irq, OPENPIC_OUTPUT_NB);
for (j = 0; j < OPENPIC_OUTPUT_NB; j++) {
- sysbus_init_irq(dev, &opp->dst[i].irqs[j]);
+ sysbus_init_irq(d, &opp->dst[i].irqs[j]);
}
}
- register_savevm(DEVICE(opp), "openpic", 0, 2,
+ register_savevm(dev, "openpic", 0, 2,
openpic_save, openpic_load, opp);
- sysbus_init_mmio(dev, &opp->mem);
- qdev_init_gpio_in(&dev->qdev, openpic_set_irq, opp->max_irq);
-
- return 0;
+ sysbus_init_mmio(d, &opp->mem);
+ qdev_init_gpio_in(dev, openpic_set_irq, opp->max_irq);
}
static Property openpic_properties[] = {
@@ -1637,12 +1641,11 @@ static Property openpic_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
-static void openpic_class_init(ObjectClass *klass, void *data)
+static void openpic_class_init(ObjectClass *oc, void *data)
{
- DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(oc);
- k->init = openpic_init;
+ dc->realize = openpic_realize;
dc->props = openpic_properties;
dc->reset = openpic_reset;
}
@@ -1651,6 +1654,7 @@ static const TypeInfo openpic_info = {
.name = TYPE_OPENPIC,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(OpenPICState),
+ .instance_init = openpic_init,
.class_init = openpic_class_init,
};
--
1.8.1.4
- [Qemu-ppc] [PATCH 01/32] KVM: Don't assume that mpstate exists with in-kernel PIC always, (continued)
- [Qemu-ppc] [PATCH 01/32] KVM: Don't assume that mpstate exists with in-kernel PIC always, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 26/32] PPC: Fix GDB read on code area for PPC6xx, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 07/32] PPC: Add non-kvm stub file, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 12/32] mpc8544_guts: Fix MemoryRegion name, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 13/32] mpc8544_guts: QOM'ify, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 29/32] PPC: Newworld: Add uninorth token register, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 09/32] intc/openpic: QOM'ify, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 14/32] mpc8544_guts: Turn qdev initfn into instance_init, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 19/32] pseries: Fix compiler warning (conversion of pointer to integral value), Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 05/32] PPC: e500: factor out mpic init code, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 10/32] intc/openpic: Convert to QOM realize,
Alexander Graf <=
- [Qemu-ppc] [PATCH 22/32] Graphics: Switch to 800x600x32 as default mode, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 23/32] booke_ppc: limit booke timer to max when timeout overflow, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 11/32] intc/openpic_kvm: Fix QOM and build issues, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 30/32] PPC: Newworld: Add second uninorth control register set, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 28/32] PPC: Add clock-frequency export for Mac machines, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 21/32] pseries: Update MAINTAINERS information, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 04/32] openpic: factor out some common defines into openpic.h, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 20/32] target-ppc kvm: save cr register, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 17/32] target-ppc: Change default machine for 64-bit, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 25/32] PPC: Add dump_mmu() for 6xx, Alexander Graf, 2013/06/29