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/sun4m.c | |
parent | 40021f08882aaef93c66c8c740087b6d3031b63a (diff) | |
download | qemu-999e12bbe85c5dcf49bef13bce4f97399c7105f4.zip qemu-999e12bbe85c5dcf49bef13bce4f97399c7105f4.tar.gz qemu-999e12bbe85c5dcf49bef13bce4f97399c7105f4.tar.bz2 |
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/sun4m.c')
-rw-r--r-- | hw/sun4m.c | 78 |
1 files changed, 55 insertions, 23 deletions
@@ -609,10 +609,17 @@ static int idreg_init1(SysBusDevice *dev) return 0; } -static SysBusDeviceInfo idreg_info = { - .init = idreg_init1, - .qdev.name = "macio_idreg", - .qdev.size = sizeof(IDRegState), +static void idreg_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = idreg_init1; +} + +static DeviceInfo idreg_info = { + .name = "macio_idreg", + .size = sizeof(IDRegState), + .class_init = idreg_class_init, }; static void idreg_register_devices(void) @@ -650,10 +657,17 @@ static int afx_init1(SysBusDevice *dev) return 0; } -static SysBusDeviceInfo afx_info = { - .init = afx_init1, - .qdev.name = "tcx_afx", - .qdev.size = sizeof(AFXState), +static void afx_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = afx_init1; +} + +static DeviceInfo afx_info = { + .name = "tcx_afx", + .size = sizeof(AFXState), + .class_init = afx_class_init, }; static void afx_register_devices(void) @@ -720,13 +734,22 @@ static int prom_init1(SysBusDevice *dev) return 0; } -static SysBusDeviceInfo prom_info = { - .init = prom_init1, - .qdev.name = "openprom", - .qdev.size = sizeof(PROMState), - .qdev.props = (Property[]) { - {/* end of property list */} - } +static Property prom_properties[] = { + {/* end of property list */}, +}; + +static void prom_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = prom_init1; +} + +static DeviceInfo prom_info = { + .name = "openprom", + .size = sizeof(PROMState), + .props = prom_properties, + .class_init = prom_class_init, }; static void prom_register_devices(void) @@ -779,14 +802,23 @@ static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size, sysbus_mmio_map(s, 0, addr); } -static SysBusDeviceInfo ram_info = { - .init = ram_init1, - .qdev.name = "memory", - .qdev.size = sizeof(RamDevice), - .qdev.props = (Property[]) { - DEFINE_PROP_UINT64("size", RamDevice, size, 0), - DEFINE_PROP_END_OF_LIST(), - } +static Property ram_properties[] = { + DEFINE_PROP_UINT64("size", RamDevice, size, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void ram_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = ram_init1; +} + +static DeviceInfo ram_info = { + .name = "memory", + .size = sizeof(RamDevice), + .props = ram_properties, + .class_init = ram_class_init, }; static void ram_register_devices(void) |