diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-07 21:34:16 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-02-03 10:41:06 -0600 |
commit | 39bffca2030950ef6efe57c2fac8327a45ae1015 (patch) | |
tree | 325262f44978e6116c9e43f688c900e08ee83738 /hw/sun4m.c | |
parent | 212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff) | |
download | qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.gz |
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then
rebased it into a single step which avoids repeatedly touching every file in
the tree.
The first step was a sed-based addition of the parent type to the subclass
registration functions.
The second step was another sed-based removal of subclass registration functions
while also adding virtual functions from the base class into a class_init
function as appropriate.
Finally, a python script was used to convert the DeviceInfo structures and
qdev_register_subclass functions to TypeInfo structures, class_init functions,
and type_register_static calls.
We are almost fully converted to QOM after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/sun4m.c')
-rw-r--r-- | hw/sun4m.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/hw/sun4m.c b/hw/sun4m.c index f2ff0bda9c..b79d14c35a 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -616,15 +616,16 @@ static void idreg_class_init(ObjectClass *klass, void *data) k->init = idreg_init1; } -static DeviceInfo idreg_info = { - .name = "macio_idreg", - .size = sizeof(IDRegState), - .class_init = idreg_class_init, +static TypeInfo idreg_info = { + .name = "macio_idreg", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(IDRegState), + .class_init = idreg_class_init, }; static void idreg_register_devices(void) { - sysbus_register_withprop(&idreg_info); + type_register_static(&idreg_info); } device_init(idreg_register_devices); @@ -664,15 +665,16 @@ static void afx_class_init(ObjectClass *klass, void *data) k->init = afx_init1; } -static DeviceInfo afx_info = { - .name = "tcx_afx", - .size = sizeof(AFXState), - .class_init = afx_class_init, +static TypeInfo afx_info = { + .name = "tcx_afx", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(AFXState), + .class_init = afx_class_init, }; static void afx_register_devices(void) { - sysbus_register_withprop(&afx_info); + type_register_static(&afx_info); } device_init(afx_register_devices); @@ -740,21 +742,23 @@ static Property prom_properties[] = { static void prom_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = prom_init1; + dc->props = prom_properties; } -static DeviceInfo prom_info = { - .name = "openprom", - .size = sizeof(PROMState), - .props = prom_properties, - .class_init = prom_class_init, +static TypeInfo prom_info = { + .name = "openprom", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PROMState), + .class_init = prom_class_init, }; static void prom_register_devices(void) { - sysbus_register_withprop(&prom_info); + type_register_static(&prom_info); } device_init(prom_register_devices); @@ -809,21 +813,23 @@ static Property ram_properties[] = { static void ram_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = ram_init1; + dc->props = ram_properties; } -static DeviceInfo ram_info = { - .name = "memory", - .size = sizeof(RamDevice), - .props = ram_properties, - .class_init = ram_class_init, +static TypeInfo ram_info = { + .name = "memory", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(RamDevice), + .class_init = ram_class_init, }; static void ram_register_devices(void) { - sysbus_register_withprop(&ram_info); + type_register_static(&ram_info); } device_init(ram_register_devices); |