qdev: prepare source tree for code conversion

These are various small stylistic changes which help make things more
consistent such that the automated conversion script can be simpler.

It's not necessary to agree or disagree with these style changes because all
of this code is going to be rewritten by the patch monkey script anyway.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-12-06 19:32:44 -06:00
parent 3dde52d2fe
commit e855761ca8
15 changed files with 304 additions and 312 deletions

View File

@ -172,8 +172,7 @@ static PCIDeviceInfo virtio_9p_info = {
.revision = VIRTIO_PCI_ABI_VERSION, .revision = VIRTIO_PCI_ABI_VERSION,
.class_id = 0x2, .class_id = 0x2,
.qdev.props = (Property[]) { .qdev.props = (Property[]) {
DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag), DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag),

View File

@ -1041,13 +1041,8 @@ static PCIDeviceInfo es1370_info = {
.vendor_id = PCI_VENDOR_ID_ENSONIQ, .vendor_id = PCI_VENDOR_ID_ENSONIQ,
.device_id = PCI_DEVICE_ID_ENSONIQ_ES1370, .device_id = PCI_DEVICE_ID_ENSONIQ_ES1370,
.class_id = PCI_CLASS_MULTIMEDIA_AUDIO, .class_id = PCI_CLASS_MULTIMEDIA_AUDIO,
#if 1
.subsystem_vendor_id = 0x4942, .subsystem_vendor_id = 0x4942,
.subsystem_id = 0x4c4c, .subsystem_id = 0x4c4c,
#else
.subsystem_vendor_id = 0x1274,
.subsystem_id = 0x1371,
#endif
}; };
static void es1370_register (void) static void es1370_register (void)

View File

@ -325,27 +325,24 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
pci_ide_create_devs(dev, hd_table); pci_ide_create_devs(dev, hd_table);
} }
static PCIDeviceInfo cmd646_ide_info[] = { static PCIDeviceInfo cmd646_ide_info = {
{
.qdev.name = "cmd646-ide", .qdev.name = "cmd646-ide",
.qdev.size = sizeof(PCIIDEState), .qdev.size = sizeof(PCIIDEState),
.init = pci_cmd646_ide_initfn, .init = pci_cmd646_ide_initfn,
.exit = pci_cmd646_ide_exitfn, .exit = pci_cmd646_ide_exitfn,
.vendor_id = PCI_VENDOR_ID_CMD, .vendor_id = PCI_VENDOR_ID_CMD,
.device_id = PCI_DEVICE_ID_CMD_646, .device_id = PCI_DEVICE_ID_CMD_646,
.revision = 0x07, // IDE controller revision /* IDE controller revision */
.revision = 0x07,
.class_id = PCI_CLASS_STORAGE_IDE, .class_id = PCI_CLASS_STORAGE_IDE,
.qdev.props = (Property[]) { .qdev.props = (Property[]) {
DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0), DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}, },
},{
/* end of list */
}
}; };
static void cmd646_ide_register(void) static void cmd646_ide_register(void)
{ {
pci_qdev_register_many(cmd646_ide_info); pci_qdev_register(&cmd646_ide_info);
} }
device_init(cmd646_ide_register); device_init(cmd646_ide_register);

View File

@ -146,8 +146,7 @@ static void pci_ich9_write_config(PCIDevice *pci, uint32_t addr,
msi_write_config(pci, addr, val, len); msi_write_config(pci, addr, val, len);
} }
static PCIDeviceInfo ich_ahci_info[] = { static PCIDeviceInfo ich_ahci_info = {
{
.qdev.name = "ich9-ahci", .qdev.name = "ich9-ahci",
.qdev.alias = "ahci", .qdev.alias = "ahci",
.qdev.size = sizeof(AHCIPCIState), .qdev.size = sizeof(AHCIPCIState),
@ -159,13 +158,10 @@ static PCIDeviceInfo ich_ahci_info[] = {
.device_id = PCI_DEVICE_ID_INTEL_82801IR, .device_id = PCI_DEVICE_ID_INTEL_82801IR,
.revision = 0x02, .revision = 0x02,
.class_id = PCI_CLASS_STORAGE_SATA, .class_id = PCI_CLASS_STORAGE_SATA,
},{
/* end of list */
}
}; };
static void ich_ahci_register(void) static void ich_ahci_register(void)
{ {
pci_qdev_register_many(ich_ahci_info); pci_qdev_register(&ich_ahci_info);
} }
device_init(ich_ahci_register); device_init(ich_ahci_register);

View File

@ -237,8 +237,7 @@ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
return dev; return dev;
} }
static PCIDeviceInfo piix_ide_info[] = { static PCIDeviceInfo piix3_ide_info = {
{
.qdev.name = "piix3-ide", .qdev.name = "piix3-ide",
.qdev.size = sizeof(PCIIDEState), .qdev.size = sizeof(PCIIDEState),
.qdev.no_user = 1, .qdev.no_user = 1,
@ -248,7 +247,9 @@ static PCIDeviceInfo piix_ide_info[] = {
.vendor_id = PCI_VENDOR_ID_INTEL, .vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = PCI_DEVICE_ID_INTEL_82371SB_1, .device_id = PCI_DEVICE_ID_INTEL_82371SB_1,
.class_id = PCI_CLASS_STORAGE_IDE, .class_id = PCI_CLASS_STORAGE_IDE,
},{ };
static PCIDeviceInfo piix3_ide_xen_info = {
.qdev.name = "piix3-ide-xen", .qdev.name = "piix3-ide-xen",
.qdev.size = sizeof(PCIIDEState), .qdev.size = sizeof(PCIIDEState),
.qdev.no_user = 1, .qdev.no_user = 1,
@ -257,7 +258,9 @@ static PCIDeviceInfo piix_ide_info[] = {
.vendor_id = PCI_VENDOR_ID_INTEL, .vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = PCI_DEVICE_ID_INTEL_82371SB_1, .device_id = PCI_DEVICE_ID_INTEL_82371SB_1,
.class_id = PCI_CLASS_STORAGE_IDE, .class_id = PCI_CLASS_STORAGE_IDE,
},{ };
static PCIDeviceInfo piix4_ide_info = {
.qdev.name = "piix4-ide", .qdev.name = "piix4-ide",
.qdev.size = sizeof(PCIIDEState), .qdev.size = sizeof(PCIIDEState),
.qdev.no_user = 1, .qdev.no_user = 1,
@ -267,13 +270,12 @@ static PCIDeviceInfo piix_ide_info[] = {
.vendor_id = PCI_VENDOR_ID_INTEL, .vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = PCI_DEVICE_ID_INTEL_82371AB, .device_id = PCI_DEVICE_ID_INTEL_82371AB,
.class_id = PCI_CLASS_STORAGE_IDE, .class_id = PCI_CLASS_STORAGE_IDE,
},{
/* end of list */
}
}; };
static void piix_ide_register(void) static void piix_ide_register(void)
{ {
pci_qdev_register_many(piix_ide_info); pci_qdev_register(&piix3_ide_info);
pci_qdev_register(&piix3_ide_xen_info);
pci_qdev_register(&piix4_ide_info);
} }
device_init(piix_ide_register); device_init(piix_ide_register);

View File

@ -50,7 +50,7 @@ typedef struct mv88w8618_audio_state {
uint32_t play_pos; uint32_t play_pos;
uint32_t last_free; uint32_t last_free;
uint32_t clock_div; uint32_t clock_div;
DeviceState *wm; void *wm;
} mv88w8618_audio_state; } mv88w8618_audio_state;
static void mv88w8618_audio_callback(void *opaque, int free_out, int free_in) static void mv88w8618_audio_callback(void *opaque, int free_out, int free_in)
@ -279,11 +279,7 @@ static SysBusDeviceInfo mv88w8618_audio_info = {
.qdev.reset = mv88w8618_audio_reset, .qdev.reset = mv88w8618_audio_reset,
.qdev.vmsd = &mv88w8618_audio_vmsd, .qdev.vmsd = &mv88w8618_audio_vmsd,
.qdev.props = (Property[]) { .qdev.props = (Property[]) {
{ DEFINE_PROP_PTR("wm8750", mv88w8618_audio_state, wm),
.name = "wm8750",
.info = &qdev_prop_ptr,
.offset = offsetof(mv88w8618_audio_state, wm),
},
{/* end of list */} {/* end of list */}
} }
}; };

View File

@ -102,8 +102,7 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
return d->devfn; return d->devfn;
} }
static PCIDeviceInfo piix4_info[] = { static PCIDeviceInfo piix4_info = {
{
.qdev.name = "PIIX4", .qdev.name = "PIIX4",
.qdev.desc = "ISA bridge", .qdev.desc = "ISA bridge",
.qdev.size = sizeof(PIIX4State), .qdev.size = sizeof(PIIX4State),
@ -112,15 +111,13 @@ static PCIDeviceInfo piix4_info[] = {
.no_hotplug = 1, .no_hotplug = 1,
.init = piix4_initfn, .init = piix4_initfn,
.vendor_id = PCI_VENDOR_ID_INTEL, .vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = PCI_DEVICE_ID_INTEL_82371AB_0, // 82371AB/EB/MB PIIX4 PCI-to-ISA bridge /* 82371AB/EB/MB PIIX4 PCI-to-ISA bridge */
.device_id = PCI_DEVICE_ID_INTEL_82371AB_0,
.class_id = PCI_CLASS_BRIDGE_ISA, .class_id = PCI_CLASS_BRIDGE_ISA,
},{
/* end of list */
}
}; };
static void piix4_register(void) static void piix4_register(void)
{ {
pci_qdev_register_many(piix4_info); pci_qdev_register(&piix4_info);
} }
device_init(piix4_register); device_init(piix4_register);

View File

@ -502,8 +502,7 @@ static int piix3_initfn(PCIDevice *dev)
return 0; return 0;
} }
static PCIDeviceInfo i440fx_info[] = { static PCIDeviceInfo i440fx_info = {
{
.qdev.name = "i440FX", .qdev.name = "i440FX",
.qdev.desc = "Host bridge", .qdev.desc = "Host bridge",
.qdev.size = sizeof(PCII440FXState), .qdev.size = sizeof(PCII440FXState),
@ -516,7 +515,9 @@ static PCIDeviceInfo i440fx_info[] = {
.device_id = PCI_DEVICE_ID_INTEL_82441, .device_id = PCI_DEVICE_ID_INTEL_82441,
.revision = 0x02, .revision = 0x02,
.class_id = PCI_CLASS_BRIDGE_HOST, .class_id = PCI_CLASS_BRIDGE_HOST,
},{ };
static PCIDeviceInfo piix3_info = {
.qdev.name = "PIIX3", .qdev.name = "PIIX3",
.qdev.desc = "ISA bridge", .qdev.desc = "ISA bridge",
.qdev.size = sizeof(PIIX3State), .qdev.size = sizeof(PIIX3State),
@ -528,7 +529,9 @@ static PCIDeviceInfo i440fx_info[] = {
.vendor_id = PCI_VENDOR_ID_INTEL, .vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1) .device_id = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
.class_id = PCI_CLASS_BRIDGE_ISA, .class_id = PCI_CLASS_BRIDGE_ISA,
},{ };
static PCIDeviceInfo piix3_xen_info = {
.qdev.name = "PIIX3-xen", .qdev.name = "PIIX3-xen",
.qdev.desc = "ISA bridge", .qdev.desc = "ISA bridge",
.qdev.size = sizeof(PIIX3State), .qdev.size = sizeof(PIIX3State),
@ -540,9 +543,6 @@ static PCIDeviceInfo i440fx_info[] = {
.vendor_id = PCI_VENDOR_ID_INTEL, .vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1) .device_id = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
.class_id = PCI_CLASS_BRIDGE_ISA, .class_id = PCI_CLASS_BRIDGE_ISA,
},{
/* end of list */
}
}; };
static SysBusDeviceInfo i440fx_pcihost_info = { static SysBusDeviceInfo i440fx_pcihost_info = {
@ -555,7 +555,9 @@ static SysBusDeviceInfo i440fx_pcihost_info = {
static void i440fx_register(void) static void i440fx_register(void)
{ {
pci_qdev_register(&i440fx_info);
pci_qdev_register(&piix3_info);
pci_qdev_register(&piix3_xen_info);
sysbus_register_withprop(&i440fx_pcihost_info); sysbus_register_withprop(&i440fx_pcihost_info);
pci_qdev_register_many(i440fx_info);
} }
device_init(i440fx_register); device_init(i440fx_register);

View File

@ -1824,7 +1824,7 @@ static Property qxl_properties[] = {
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
static PCIDeviceInfo qxl_info_primary = { static PCIDeviceInfo qxl_primary_info = {
.qdev.name = "qxl-vga", .qdev.name = "qxl-vga",
.qdev.desc = "Spice QXL GPU (primary, vga compatible)", .qdev.desc = "Spice QXL GPU (primary, vga compatible)",
.qdev.size = sizeof(PCIQXLDevice), .qdev.size = sizeof(PCIQXLDevice),
@ -1839,7 +1839,7 @@ static PCIDeviceInfo qxl_info_primary = {
.qdev.props = qxl_properties, .qdev.props = qxl_properties,
}; };
static PCIDeviceInfo qxl_info_secondary = { static PCIDeviceInfo qxl_secondary_info = {
.qdev.name = "qxl", .qdev.name = "qxl",
.qdev.desc = "Spice QXL GPU (secondary)", .qdev.desc = "Spice QXL GPU (secondary)",
.qdev.size = sizeof(PCIQXLDevice), .qdev.size = sizeof(PCIQXLDevice),
@ -1854,8 +1854,8 @@ static PCIDeviceInfo qxl_info_secondary = {
static void qxl_register(void) static void qxl_register(void)
{ {
pci_qdev_register(&qxl_info_primary); pci_qdev_register(&qxl_primary_info);
pci_qdev_register(&qxl_info_secondary); pci_qdev_register(&qxl_secondary_info);
} }
device_init(qxl_register); device_init(qxl_register);

View File

@ -474,7 +474,7 @@ static target_ulong h_multicast_ctrl(CPUState *env, sPAPREnvironment *spapr,
return H_SUCCESS; return H_SUCCESS;
} }
static VIOsPAPRDeviceInfo spapr_vlan = { static VIOsPAPRDeviceInfo spapr_vlan_info = {
.init = spapr_vlan_init, .init = spapr_vlan_init,
.devnode = spapr_vlan_devnode, .devnode = spapr_vlan_devnode,
.dt_name = "l-lan", .dt_name = "l-lan",
@ -492,12 +492,12 @@ static VIOsPAPRDeviceInfo spapr_vlan = {
static void spapr_vlan_register(void) static void spapr_vlan_register(void)
{ {
spapr_vio_bus_register_withprop(&spapr_vlan);
spapr_register_hypercall(H_REGISTER_LOGICAL_LAN, h_register_logical_lan); spapr_register_hypercall(H_REGISTER_LOGICAL_LAN, h_register_logical_lan);
spapr_register_hypercall(H_FREE_LOGICAL_LAN, h_free_logical_lan); spapr_register_hypercall(H_FREE_LOGICAL_LAN, h_free_logical_lan);
spapr_register_hypercall(H_SEND_LOGICAL_LAN, h_send_logical_lan); spapr_register_hypercall(H_SEND_LOGICAL_LAN, h_send_logical_lan);
spapr_register_hypercall(H_ADD_LOGICAL_LAN_BUFFER, spapr_register_hypercall(H_ADD_LOGICAL_LAN_BUFFER,
h_add_logical_lan_buffer); h_add_logical_lan_buffer);
spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl); spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl);
spapr_vio_bus_register_withprop(&spapr_vlan_info);
} }
device_init(spapr_vlan_register); device_init(spapr_vlan_register);

View File

@ -947,7 +947,7 @@ static int spapr_vscsi_devnode(VIOsPAPRDevice *dev, void *fdt, int node_off)
return 0; return 0;
} }
static VIOsPAPRDeviceInfo spapr_vscsi = { static VIOsPAPRDeviceInfo spapr_vscsi_info = {
.init = spapr_vscsi_init, .init = spapr_vscsi_init,
.devnode = spapr_vscsi_devnode, .devnode = spapr_vscsi_devnode,
.dt_name = "v-scsi", .dt_name = "v-scsi",
@ -964,6 +964,6 @@ static VIOsPAPRDeviceInfo spapr_vscsi = {
static void spapr_vscsi_register(void) static void spapr_vscsi_register(void)
{ {
spapr_vio_bus_register_withprop(&spapr_vscsi); spapr_vio_bus_register_withprop(&spapr_vscsi_info);
} }
device_init(spapr_vscsi_register); device_init(spapr_vscsi_register);

View File

@ -135,7 +135,7 @@ void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev)
qdev_init_nofail(dev); qdev_init_nofail(dev);
} }
static VIOsPAPRDeviceInfo spapr_vty = { static VIOsPAPRDeviceInfo spapr_vty_info = {
.init = spapr_vty_init, .init = spapr_vty_init,
.dt_name = "vty", .dt_name = "vty",
.dt_type = "serial", .dt_type = "serial",
@ -163,7 +163,7 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
selected = NULL; selected = NULL;
QTAILQ_FOREACH(iter, &bus->bus.children, sibling) { QTAILQ_FOREACH(iter, &bus->bus.children, sibling) {
/* Only look at VTY devices */ /* Only look at VTY devices */
if (qdev_get_info(iter) != &spapr_vty.qdev) { if (qdev_get_info(iter) != &spapr_vty_info.qdev) {
continue; continue;
} }
@ -203,8 +203,8 @@ static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg)
static void spapr_vty_register(void) static void spapr_vty_register(void)
{ {
spapr_vio_bus_register_withprop(&spapr_vty);
spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char); spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char);
spapr_register_hypercall(H_GET_TERM_CHAR, h_get_term_char); spapr_register_hypercall(H_GET_TERM_CHAR, h_get_term_char);
spapr_vio_bus_register_withprop(&spapr_vty_info);
} }
device_init(spapr_vty_register); device_init(spapr_vty_register);

View File

@ -2263,8 +2263,7 @@ static Property ehci_properties[] = {
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
static PCIDeviceInfo ehci_info[] = { static PCIDeviceInfo ehci_info = {
{
.qdev.name = "usb-ehci", .qdev.name = "usb-ehci",
.qdev.size = sizeof(EHCIState), .qdev.size = sizeof(EHCIState),
.qdev.vmsd = &vmstate_ehci, .qdev.vmsd = &vmstate_ehci,
@ -2274,7 +2273,9 @@ static PCIDeviceInfo ehci_info[] = {
.revision = 0x10, .revision = 0x10,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = ehci_properties, .qdev.props = ehci_properties,
},{ };
static PCIDeviceInfo ich9_ehci_info = {
.qdev.name = "ich9-usb-ehci1", .qdev.name = "ich9-usb-ehci1",
.qdev.size = sizeof(EHCIState), .qdev.size = sizeof(EHCIState),
.qdev.vmsd = &vmstate_ehci, .qdev.vmsd = &vmstate_ehci,
@ -2284,9 +2285,6 @@ static PCIDeviceInfo ehci_info[] = {
.revision = 0x03, .revision = 0x03,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = ehci_properties, .qdev.props = ehci_properties,
},{
/* end of list */
}
}; };
static int usb_ehci_initfn(PCIDevice *dev) static int usb_ehci_initfn(PCIDevice *dev)
@ -2362,7 +2360,8 @@ static int usb_ehci_initfn(PCIDevice *dev)
static void ehci_register(void) static void ehci_register(void)
{ {
pci_qdev_register_many(ehci_info); pci_qdev_register(&ehci_info);
pci_qdev_register(&ich9_ehci_info);
} }
device_init(ehci_register); device_init(ehci_register);

View File

@ -1192,8 +1192,7 @@ static Property uhci_properties[] = {
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
static PCIDeviceInfo uhci_info[] = { static PCIDeviceInfo piix3_uhci_info = {
{
.qdev.name = "piix3-usb-uhci", .qdev.name = "piix3-usb-uhci",
.qdev.size = sizeof(UHCIState), .qdev.size = sizeof(UHCIState),
.qdev.vmsd = &vmstate_uhci, .qdev.vmsd = &vmstate_uhci,
@ -1204,7 +1203,9 @@ static PCIDeviceInfo uhci_info[] = {
.revision = 0x01, .revision = 0x01,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = uhci_properties, .qdev.props = uhci_properties,
},{ };
static PCIDeviceInfo piix4_uhci_info = {
.qdev.name = "piix4-usb-uhci", .qdev.name = "piix4-usb-uhci",
.qdev.size = sizeof(UHCIState), .qdev.size = sizeof(UHCIState),
.qdev.vmsd = &vmstate_uhci, .qdev.vmsd = &vmstate_uhci,
@ -1215,7 +1216,9 @@ static PCIDeviceInfo uhci_info[] = {
.revision = 0x01, .revision = 0x01,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = uhci_properties, .qdev.props = uhci_properties,
},{ };
static PCIDeviceInfo vt82c686b_uhci_info = {
.qdev.name = "vt82c686b-usb-uhci", .qdev.name = "vt82c686b-usb-uhci",
.qdev.size = sizeof(UHCIState), .qdev.size = sizeof(UHCIState),
.qdev.vmsd = &vmstate_uhci, .qdev.vmsd = &vmstate_uhci,
@ -1226,7 +1229,9 @@ static PCIDeviceInfo uhci_info[] = {
.revision = 0x01, .revision = 0x01,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = uhci_properties, .qdev.props = uhci_properties,
},{ };
static PCIDeviceInfo ich9_uhci1_info = {
.qdev.name = "ich9-usb-uhci1", .qdev.name = "ich9-usb-uhci1",
.qdev.size = sizeof(UHCIState), .qdev.size = sizeof(UHCIState),
.qdev.vmsd = &vmstate_uhci, .qdev.vmsd = &vmstate_uhci,
@ -1236,7 +1241,9 @@ static PCIDeviceInfo uhci_info[] = {
.revision = 0x03, .revision = 0x03,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = uhci_properties, .qdev.props = uhci_properties,
},{ };
static PCIDeviceInfo ich9_uhci2_info = {
.qdev.name = "ich9-usb-uhci2", .qdev.name = "ich9-usb-uhci2",
.qdev.size = sizeof(UHCIState), .qdev.size = sizeof(UHCIState),
.qdev.vmsd = &vmstate_uhci, .qdev.vmsd = &vmstate_uhci,
@ -1246,7 +1253,9 @@ static PCIDeviceInfo uhci_info[] = {
.revision = 0x03, .revision = 0x03,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = uhci_properties, .qdev.props = uhci_properties,
},{ };
static PCIDeviceInfo ich9_uhci3_info = {
.qdev.name = "ich9-usb-uhci3", .qdev.name = "ich9-usb-uhci3",
.qdev.size = sizeof(UHCIState), .qdev.size = sizeof(UHCIState),
.qdev.vmsd = &vmstate_uhci, .qdev.vmsd = &vmstate_uhci,
@ -1256,14 +1265,16 @@ static PCIDeviceInfo uhci_info[] = {
.revision = 0x03, .revision = 0x03,
.class_id = PCI_CLASS_SERIAL_USB, .class_id = PCI_CLASS_SERIAL_USB,
.qdev.props = uhci_properties, .qdev.props = uhci_properties,
},{
/* end of list */
}
}; };
static void uhci_register(void) static void uhci_register(void)
{ {
pci_qdev_register_many(uhci_info); pci_qdev_register(&piix3_uhci_info);
pci_qdev_register(&piix4_uhci_info);
pci_qdev_register(&vt82c686b_uhci_info);
pci_qdev_register(&ich9_uhci1_info);
pci_qdev_register(&ich9_uhci2_info);
pci_qdev_register(&ich9_uhci3_info);
} }
device_init(uhci_register); device_init(uhci_register);

View File

@ -806,8 +806,7 @@ static int virtio_balloon_exit_pci(PCIDevice *pci_dev)
return virtio_exit_pci(pci_dev); return virtio_exit_pci(pci_dev);
} }
static PCIDeviceInfo virtio_info[] = { static PCIDeviceInfo virtio_blk_info = {
{
.qdev.name = "virtio-blk-pci", .qdev.name = "virtio-blk-pci",
.qdev.alias = "virtio-blk", .qdev.alias = "virtio-blk",
.qdev.size = sizeof(VirtIOPCIProxy), .qdev.size = sizeof(VirtIOPCIProxy),
@ -821,14 +820,15 @@ static PCIDeviceInfo virtio_info[] = {
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0), DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, block), DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, block),
DEFINE_PROP_STRING("serial", VirtIOPCIProxy, block_serial), DEFINE_PROP_STRING("serial", VirtIOPCIProxy, block_serial),
DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features), DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}, },
.qdev.reset = virtio_pci_reset, .qdev.reset = virtio_pci_reset,
},{ };
static PCIDeviceInfo virtio_net_info = {
.qdev.name = "virtio-net-pci", .qdev.name = "virtio-net-pci",
.qdev.alias = "virtio-net", .qdev.alias = "virtio-net",
.qdev.size = sizeof(VirtIOPCIProxy), .qdev.size = sizeof(VirtIOPCIProxy),
@ -840,20 +840,19 @@ static PCIDeviceInfo virtio_info[] = {
.revision = VIRTIO_PCI_ABI_VERSION, .revision = VIRTIO_PCI_ABI_VERSION,
.class_id = PCI_CLASS_NETWORK_ETHERNET, .class_id = PCI_CLASS_NETWORK_ETHERNET,
.qdev.props = (Property[]) { .qdev.props = (Property[]) {
DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false),
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false),
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3),
DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features), DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_NIC_PROPERTIES(VirtIOPCIProxy, nic), DEFINE_NIC_PROPERTIES(VirtIOPCIProxy, nic),
DEFINE_PROP_UINT32("x-txtimer", VirtIOPCIProxy, DEFINE_PROP_UINT32("x-txtimer", VirtIOPCIProxy, net.txtimer, TX_TIMER_INTERVAL),
net.txtimer, TX_TIMER_INTERVAL), DEFINE_PROP_INT32("x-txburst", VirtIOPCIProxy, net.txburst, TX_BURST),
DEFINE_PROP_INT32("x-txburst", VirtIOPCIProxy,
net.txburst, TX_BURST),
DEFINE_PROP_STRING("tx", VirtIOPCIProxy, net.tx), DEFINE_PROP_STRING("tx", VirtIOPCIProxy, net.tx),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}, },
.qdev.reset = virtio_pci_reset, .qdev.reset = virtio_pci_reset,
},{ };
static PCIDeviceInfo virtio_serial_info = {
.qdev.name = "virtio-serial-pci", .qdev.name = "virtio-serial-pci",
.qdev.alias = "virtio-serial", .qdev.alias = "virtio-serial",
.qdev.size = sizeof(VirtIOPCIProxy), .qdev.size = sizeof(VirtIOPCIProxy),
@ -864,18 +863,17 @@ static PCIDeviceInfo virtio_info[] = {
.revision = VIRTIO_PCI_ABI_VERSION, .revision = VIRTIO_PCI_ABI_VERSION,
.class_id = PCI_CLASS_COMMUNICATION_OTHER, .class_id = PCI_CLASS_COMMUNICATION_OTHER,
.qdev.props = (Property[]) { .qdev.props = (Property[]) {
DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, DEV_NVECTORS_UNSPECIFIED),
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
DEV_NVECTORS_UNSPECIFIED),
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0), DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, serial.max_virtserial_ports, 31),
serial.max_virtserial_ports, 31),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}, },
.qdev.reset = virtio_pci_reset, .qdev.reset = virtio_pci_reset,
},{ };
static PCIDeviceInfo virtio_balloon_info = {
.qdev.name = "virtio-balloon-pci", .qdev.name = "virtio-balloon-pci",
.qdev.alias = "virtio-balloon", .qdev.alias = "virtio-balloon",
.qdev.size = sizeof(VirtIOPCIProxy), .qdev.size = sizeof(VirtIOPCIProxy),
@ -890,14 +888,14 @@ static PCIDeviceInfo virtio_info[] = {
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}, },
.qdev.reset = virtio_pci_reset, .qdev.reset = virtio_pci_reset,
},{
/* end of list */
}
}; };
static void virtio_pci_register_devices(void) static void virtio_pci_register_devices(void)
{ {
pci_qdev_register_many(virtio_info); pci_qdev_register(&virtio_blk_info);
pci_qdev_register(&virtio_net_info);
pci_qdev_register(&virtio_serial_info);
pci_qdev_register(&virtio_balloon_info);
} }
device_init(virtio_pci_register_devices) device_init(virtio_pci_register_devices)