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/m48t59.c | |
parent | 212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff) | |
download | qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.zip qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.gz qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.bz2 |
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/m48t59.c')
-rw-r--r-- | hw/m48t59.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/hw/m48t59.c b/hw/m48t59.c index bd610f0..c35867d 100644 --- a/hw/m48t59.c +++ b/hw/m48t59.c @@ -720,24 +720,28 @@ static int m48t59_init1(SysBusDevice *dev) return 0; } +static Property m48t59_isa_properties[] = { + DEFINE_PROP_UINT32("size", M48t59ISAState, state.size, -1), + DEFINE_PROP_UINT32("type", M48t59ISAState, state.type, -1), + DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void m48t59_init_class_isa1(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); ic->init = m48t59_init_isa1; + dc->no_user = 1; + dc->reset = m48t59_reset_isa; + dc->props = m48t59_isa_properties; } -static DeviceInfo m48t59_isa_info = { - .class_init = m48t59_init_class_isa1, - .name = "m48t59_isa", - .size = sizeof(M48t59ISAState), - .reset = m48t59_reset_isa, - .no_user = 1, - .props = (Property[]) { - DEFINE_PROP_UINT32("size", M48t59ISAState, state.size, -1), - DEFINE_PROP_UINT32("type", M48t59ISAState, state.type, -1), - DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base, 0), - DEFINE_PROP_END_OF_LIST(), - } +static TypeInfo m48t59_isa_info = { + .name = "m48t59_isa", + .parent = TYPE_ISA_DEVICE, + .instance_size = sizeof(M48t59ISAState), + .class_init = m48t59_init_class_isa1, }; static Property m48t59_properties[] = { @@ -749,23 +753,25 @@ static Property m48t59_properties[] = { static void m48t59_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = m48t59_init1; + dc->reset = m48t59_reset_sysbus; + dc->props = m48t59_properties; } -static DeviceInfo m48t59_info = { - .name = "m48t59", - .size = sizeof(M48t59SysBusState), - .reset = m48t59_reset_sysbus, - .props = m48t59_properties, - .class_init = m48t59_class_init, +static TypeInfo m48t59_info = { + .name = "m48t59", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(M48t59SysBusState), + .class_init = m48t59_class_init, }; static void m48t59_register_devices(void) { - sysbus_register_withprop(&m48t59_info); - isa_qdev_register(&m48t59_isa_info); + type_register_static(&m48t59_info); + type_register_static(&m48t59_isa_info); } device_init(m48t59_register_devices) |