aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index a46578d685..c122395401 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -27,19 +27,28 @@
static char *idebus_get_fw_dev_path(DeviceState *dev);
-static struct BusInfo ide_bus_info = {
- .name = "IDE",
- .size = sizeof(IDEBus),
- .get_fw_dev_path = idebus_get_fw_dev_path,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
- DEFINE_PROP_END_OF_LIST(),
- },
+static Property ide_props[] = {
+ DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
+static void ide_bus_class_init(ObjectClass *klass, void *data)
+{
+ BusClass *k = BUS_CLASS(klass);
+
+ k->get_fw_dev_path = idebus_get_fw_dev_path;
+}
+
+static const TypeInfo ide_bus_info = {
+ .name = TYPE_IDE_BUS,
+ .parent = TYPE_BUS,
+ .instance_size = sizeof(IDEBus),
+ .class_init = ide_bus_class_init,
};
void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
{
- qbus_create_inplace(&idebus->qbus, &ide_bus_info, dev, NULL);
+ qbus_create_inplace(&idebus->qbus, TYPE_IDE_BUS, dev, NULL);
idebus->bus_id = bus_id;
}
@@ -248,7 +257,8 @@ static void ide_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
k->init = ide_qdev_init;
- k->bus_info = &ide_bus_info;
+ k->bus_type = TYPE_IDE_BUS;
+ k->props = ide_props;
}
static TypeInfo ide_device_type_info = {
@@ -262,6 +272,7 @@ static TypeInfo ide_device_type_info = {
static void ide_register_types(void)
{
+ type_register_static(&ide_bus_info);
type_register_static(&ide_hd_info);
type_register_static(&ide_cd_info);
type_register_static(&ide_drive_info);