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>
This commit is contained in:
Anthony Liguori 2011-12-07 21:34:16 -06:00
parent 212ad11168
commit 39bffca203
243 changed files with 3169 additions and 2543 deletions

View file

@ -1845,44 +1845,50 @@ static Property ohci_pci_properties[] = {
static void ohci_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ohci_initfn_pci;
k->vendor_id = PCI_VENDOR_ID_APPLE;
k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
k->class_id = PCI_CLASS_SERIAL_USB;
dc->desc = "Apple USB Controller";
dc->props = ohci_pci_properties;
}
static DeviceInfo ohci_pci_info = {
.name = "pci-ohci",
.desc = "Apple USB Controller",
.size = sizeof(OHCIPCIState),
.props = ohci_pci_properties,
.class_init = ohci_pci_class_init,
static TypeInfo ohci_pci_info = {
.name = "pci-ohci",
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(OHCIPCIState),
.class_init = ohci_pci_class_init,
};
static Property ohci_sysbus_properties[] = {
DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
DEFINE_PROP_END_OF_LIST(),
};
static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
sbc->init = ohci_init_pxa;
dc->desc = "OHCI USB Controller";
dc->props = ohci_sysbus_properties;
}
static DeviceInfo ohci_sysbus_info = {
.name = "sysbus-ohci",
.desc = "OHCI USB Controller",
.size = sizeof(OHCISysBusState),
.class_init = ohci_sysbus_class_init,
.props = (Property[]) {
DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
DEFINE_PROP_END_OF_LIST(),
}
static TypeInfo ohci_sysbus_info = {
.name = "sysbus-ohci",
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(OHCISysBusState),
.class_init = ohci_sysbus_class_init,
};
static void ohci_register(void)
{
pci_qdev_register(&ohci_pci_info);
sysbus_register_withprop(&ohci_sysbus_info);
type_register_static(&ohci_pci_info);
type_register_static(&ohci_sysbus_info);
}
device_init(ohci_register);