diff options
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r-- | hw/virtio-pci.c | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 126fb087be..93fff54782 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -818,6 +818,7 @@ static Property virtio_blk_properties[] = { static void virtio_blk_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = virtio_blk_init_pci; @@ -826,15 +827,15 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data) k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK; k->revision = VIRTIO_PCI_ABI_VERSION; k->class_id = PCI_CLASS_STORAGE_SCSI; + dc->reset = virtio_pci_reset; + dc->props = virtio_blk_properties; } -static DeviceInfo virtio_blk_info = { - .name = "virtio-blk-pci", - .alias = "virtio-blk", - .size = sizeof(VirtIOPCIProxy), - .props = virtio_blk_properties, - .reset = virtio_pci_reset, - .class_init = virtio_blk_class_init, +static TypeInfo virtio_blk_info = { + .name = "virtio-blk-pci", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(VirtIOPCIProxy), + .class_init = virtio_blk_class_init, }; static Property virtio_net_properties[] = { @@ -850,6 +851,7 @@ static Property virtio_net_properties[] = { static void virtio_net_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = virtio_net_init_pci; @@ -859,15 +861,15 @@ static void virtio_net_class_init(ObjectClass *klass, void *data) k->device_id = PCI_DEVICE_ID_VIRTIO_NET; k->revision = VIRTIO_PCI_ABI_VERSION; k->class_id = PCI_CLASS_NETWORK_ETHERNET; + dc->reset = virtio_pci_reset; + dc->props = virtio_net_properties; } -static DeviceInfo virtio_net_info = { - .name = "virtio-net-pci", - .alias = "virtio-net", - .size = sizeof(VirtIOPCIProxy), - .props = virtio_net_properties, - .reset = virtio_pci_reset, - .class_init = virtio_net_class_init, +static TypeInfo virtio_net_info = { + .name = "virtio-net-pci", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(VirtIOPCIProxy), + .class_init = virtio_net_class_init, }; static Property virtio_serial_properties[] = { @@ -881,6 +883,7 @@ static Property virtio_serial_properties[] = { static void virtio_serial_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = virtio_serial_init_pci; @@ -889,15 +892,15 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data) k->device_id = PCI_DEVICE_ID_VIRTIO_CONSOLE; k->revision = VIRTIO_PCI_ABI_VERSION; k->class_id = PCI_CLASS_COMMUNICATION_OTHER; + dc->reset = virtio_pci_reset; + dc->props = virtio_serial_properties; } -static DeviceInfo virtio_serial_info = { - .name = "virtio-serial-pci", - .alias = "virtio-serial", - .size = sizeof(VirtIOPCIProxy), - .props = virtio_serial_properties, - .reset = virtio_pci_reset, - .class_init = virtio_serial_class_init, +static TypeInfo virtio_serial_info = { + .name = "virtio-serial-pci", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(VirtIOPCIProxy), + .class_init = virtio_serial_class_init, }; static Property virtio_balloon_properties[] = { @@ -907,6 +910,7 @@ static Property virtio_balloon_properties[] = { static void virtio_balloon_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = virtio_balloon_init_pci; @@ -915,23 +919,23 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data) k->device_id = PCI_DEVICE_ID_VIRTIO_BALLOON; k->revision = VIRTIO_PCI_ABI_VERSION; k->class_id = PCI_CLASS_MEMORY_RAM; + dc->reset = virtio_pci_reset; + dc->props = virtio_balloon_properties; } -static DeviceInfo virtio_balloon_info = { - .name = "virtio-balloon-pci", - .alias = "virtio-balloon", - .size = sizeof(VirtIOPCIProxy), - .props = virtio_balloon_properties, - .reset = virtio_pci_reset, - .class_init = virtio_balloon_class_init, +static TypeInfo virtio_balloon_info = { + .name = "virtio-balloon-pci", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(VirtIOPCIProxy), + .class_init = virtio_balloon_class_init, }; static void virtio_pci_register_devices(void) { - pci_qdev_register(&virtio_blk_info); - pci_qdev_register(&virtio_net_info); - pci_qdev_register(&virtio_serial_info); - pci_qdev_register(&virtio_balloon_info); + type_register_static(&virtio_blk_info); + type_register_static(&virtio_net_info); + type_register_static(&virtio_serial_info); + type_register_static(&virtio_balloon_info); } device_init(virtio_pci_register_devices) |