diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-24 13:12:29 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-27 10:50:50 -0600 |
commit | 999e12bbe85c5dcf49bef13bce4f97399c7105f4 (patch) | |
tree | 73b6ed8633a73134e9f728baa1ed2b1dab58b5b0 /hw/integratorcp.c | |
parent | 40021f08882aaef93c66c8c740087b6d3031b63a (diff) |
sysbus: apic: ioapic: convert to QEMU Object Model
This converts three devices because apic and ioapic are subclasses of sysbus.
Converting subclasses independently of their base class is prohibitively hard.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/integratorcp.c')
-rw-r--r-- | hw/integratorcp.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/hw/integratorcp.c b/hw/integratorcp.c index e5712fc3e7..130accf908 100644 --- a/hw/integratorcp.c +++ b/hw/integratorcp.c @@ -518,19 +518,41 @@ static void integratorcp_machine_init(void) machine_init(integratorcp_machine_init); -static SysBusDeviceInfo core_info = { - .init = integratorcm_init, - .qdev.name = "integrator_core", - .qdev.size = sizeof(integratorcm_state), - .qdev.props = (Property[]) { - DEFINE_PROP_UINT32("memsz", integratorcm_state, memsz, 0), - DEFINE_PROP_END_OF_LIST(), - } +static Property core_properties[] = { + DEFINE_PROP_UINT32("memsz", integratorcm_state, memsz, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void core_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = integratorcm_init; +} + +static DeviceInfo core_info = { + .name = "integrator_core", + .size = sizeof(integratorcm_state), + .props = core_properties, + .class_init = core_class_init, +}; + +static void icp_pic_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); + + sdc->init = icp_pic_init; +} + +static DeviceInfo icp_pic_info = { + .name = "integrator_pic", + .size = sizeof(icp_pic_state), + .class_init = icp_pic_class_init, }; static void integratorcp_register_devices(void) { - sysbus_register_dev("integrator_pic", sizeof(icp_pic_state), icp_pic_init); + sysbus_qdev_register(&icp_pic_info); sysbus_register_withprop(&core_info); } |