aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/ahci.c24
-rw-r--r--hw/ide/cmd646.c14
-rw-r--r--hw/ide/ich.c17
-rw-r--r--hw/ide/isa.c30
-rw-r--r--hw/ide/piix.c44
-rw-r--r--hw/ide/qdev.c93
-rw-r--r--hw/ide/via.c14
7 files changed, 135 insertions, 101 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8869fd6b42..c87a6ca515 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1239,27 +1239,31 @@ static int sysbus_ahci_init(SysBusDevice *dev)
return 0;
}
+static Property sysbus_ahci_properties[] = {
+ DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void sysbus_ahci_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
sbc->init = sysbus_ahci_init;
+ dc->vmsd = &vmstate_sysbus_ahci;
+ dc->props = sysbus_ahci_properties;
}
-static DeviceInfo sysbus_ahci_info = {
- .name = "sysbus-ahci",
- .size = sizeof(SysbusAHCIState),
- .vmsd = &vmstate_sysbus_ahci,
- .class_init = sysbus_ahci_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo sysbus_ahci_info = {
+ .name = "sysbus-ahci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysbusAHCIState),
+ .class_init = sysbus_ahci_class_init,
};
static void sysbus_ahci_register(void)
{
- sysbus_qdev_register(&sysbus_ahci_info);
+ type_register_static(&sysbus_ahci_info);
}
device_init(sysbus_ahci_register);
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 9c673bb12b..a119500f40 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -332,6 +332,7 @@ static Property cmd646_ide_properties[] = {
static void cmd646_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_cmd646_ide_initfn;
@@ -340,17 +341,18 @@ static void cmd646_ide_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_CMD_646;
k->revision = 0x07;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->props = cmd646_ide_properties;
}
-static DeviceInfo cmd646_ide_info = {
- .name = "cmd646-ide",
- .size = sizeof(PCIIDEState),
- .props = cmd646_ide_properties,
- .class_init = cmd646_ide_class_init,
+static TypeInfo cmd646_ide_info = {
+ .name = "cmd646-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = cmd646_ide_class_init,
};
static void cmd646_ide_register(void)
{
- pci_qdev_register(&cmd646_ide_info);
+ type_register_static(&cmd646_ide_info);
}
device_init(cmd646_ide_register);
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 1cae9f17b1..0e819f6bd1 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -148,6 +148,7 @@ static void pci_ich9_write_config(PCIDevice *pci, uint32_t addr,
static void ich_ahci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_ich9_ahci_init;
@@ -157,18 +158,20 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801IR;
k->revision = 0x02;
k->class_id = PCI_CLASS_STORAGE_SATA;
+ dc->alias = "ahci";
+ dc->vmsd = &vmstate_ahci;
}
-static DeviceInfo ich_ahci_info = {
- .name = "ich9-ahci",
- .alias = "ahci",
- .size = sizeof(AHCIPCIState),
- .vmsd = &vmstate_ahci,
- .class_init = ich_ahci_class_init,
+static TypeInfo ich_ahci_info = {
+ .name = "ich9-ahci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(AHCIPCIState),
+ .class_init = ich_ahci_class_init,
};
static void ich_ahci_register(void)
{
- pci_qdev_register(&ich_ahci_info);
+ type_register_static(&ich_ahci_info);
+ type_register_static_alias(&ich_ahci_info, "ahci");
}
device_init(ich_ahci_register);
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 464473adb0..a0bcb43eba 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -94,29 +94,33 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
return dev;
}
+static Property isa_ide_properties[] = {
+ DEFINE_PROP_HEX32("iobase", ISAIDEState, iobase, 0x1f0),
+ DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6),
+ DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, 14),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void isa_ide_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = isa_ide_initfn;
+ dc->fw_name = "ide";
+ dc->reset = isa_ide_reset;
+ dc->props = isa_ide_properties;
}
-static DeviceInfo isa_ide_info = {
- .name = "isa-ide",
- .fw_name = "ide",
- .size = sizeof(ISAIDEState),
- .class_init = isa_ide_class_initfn,
- .reset = isa_ide_reset,
- .props = (Property[]) {
- DEFINE_PROP_HEX32("iobase", ISAIDEState, iobase, 0x1f0),
- DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6),
- DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, 14),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo isa_ide_info = {
+ .name = "isa-ide",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAIDEState),
+ .class_init = isa_ide_class_initfn,
};
static void isa_ide_register_devices(void)
{
- isa_qdev_register(&isa_ide_info);
+ type_register_static(&isa_ide_info);
}
device_init(isa_ide_register_devices)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 832a507a4f..bf4465bb49 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -239,6 +239,7 @@ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
static void piix3_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -247,35 +248,39 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
}
-static DeviceInfo piix3_ide_info = {
- .name = "piix3-ide",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = piix3_ide_class_init,
+static TypeInfo piix3_ide_info = {
+ .name = "piix3-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = piix3_ide_class_init,
};
static void piix3_ide_xen_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_piix_ide_initfn;
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
+ dc->unplug = pci_piix3_xen_ide_unplug;
}
-static DeviceInfo piix3_ide_xen_info = {
- .name = "piix3-ide-xen",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = piix3_ide_xen_class_init,
- .unplug = pci_piix3_xen_ide_unplug,
+static TypeInfo piix3_ide_xen_info = {
+ .name = "piix3-ide-xen",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = piix3_ide_xen_class_init,
};
static void piix4_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -284,19 +289,20 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
}
-static DeviceInfo piix4_ide_info = {
- .name = "piix4-ide",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = piix4_ide_class_init,
+static TypeInfo piix4_ide_info = {
+ .name = "piix4-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = piix4_ide_class_init,
};
static void piix_ide_register(void)
{
- pci_qdev_register(&piix3_ide_info);
- pci_qdev_register(&piix3_ide_xen_info);
- pci_qdev_register(&piix4_ide_info);
+ type_register_static(&piix3_ide_info);
+ type_register_static(&piix3_ide_xen_info);
+ type_register_static(&piix4_ide_info);
}
device_init(piix_ide_register);
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index b507e3481e..1335615d17 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -91,13 +91,6 @@ err:
return -1;
}
-static void ide_qdev_register(DeviceInfo *info)
-{
- info->init = ide_qdev_init;
- info->bus_info = &ide_bus_info;
- qdev_register_subclass(info, TYPE_IDE_DEVICE);
-}
-
IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
{
DeviceState *dev;
@@ -182,73 +175,93 @@ static int ide_drive_initfn(IDEDevice *dev)
DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \
DEFINE_PROP_STRING("serial", IDEDrive, dev.serial)
+static Property ide_hd_properties[] = {
+ DEFINE_IDE_DEV_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void ide_hd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->init = ide_hd_initfn;
+ dc->fw_name = "drive";
+ dc->desc = "virtual IDE disk";
+ dc->props = ide_hd_properties;
}
-static DeviceInfo ide_hd_info = {
- .name = "ide-hd",
- .fw_name = "drive",
- .desc = "virtual IDE disk",
- .size = sizeof(IDEDrive),
- .class_init = ide_hd_class_init,
- .props = (Property[]) {
- DEFINE_IDE_DEV_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ide_hd_info = {
+ .name = "ide-hd",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_hd_class_init,
+};
+
+static Property ide_cd_properties[] = {
+ DEFINE_IDE_DEV_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
};
static void ide_cd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->init = ide_cd_initfn;
+ dc->fw_name = "drive";
+ dc->desc = "virtual IDE CD-ROM";
+ dc->props = ide_cd_properties;
}
-static DeviceInfo ide_cd_info = {
- .name = "ide-cd",
- .fw_name = "drive",
- .desc = "virtual IDE CD-ROM",
- .size = sizeof(IDEDrive),
- .class_init = ide_cd_class_init,
- .props = (Property[]) {
- DEFINE_IDE_DEV_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ide_cd_info = {
+ .name = "ide-cd",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_cd_class_init,
+};
+
+static Property ide_drive_properties[] = {
+ DEFINE_IDE_DEV_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
};
static void ide_drive_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->init = ide_drive_initfn;
+ dc->fw_name = "drive";
+ dc->desc = "virtual IDE disk or CD-ROM (legacy)";
+ dc->props = ide_drive_properties;
}
-static DeviceInfo ide_drive_info = {
- .name = "ide-drive", /* legacy -device ide-drive */
- .fw_name = "drive",
- .desc = "virtual IDE disk or CD-ROM (legacy)",
- .size = sizeof(IDEDrive),
- .class_init = ide_drive_class_init,
- .props = (Property[]) {
- DEFINE_IDE_DEV_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ide_drive_info = {
+ .name = "ide-drive",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_drive_class_init,
};
+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;
+}
+
static TypeInfo ide_device_type_info = {
.name = TYPE_IDE_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(IDEDevice),
.abstract = true,
.class_size = sizeof(IDEDeviceClass),
+ .class_init = ide_device_class_init,
};
static void ide_dev_register(void)
{
- ide_qdev_register(&ide_hd_info);
- ide_qdev_register(&ide_cd_info);
- ide_qdev_register(&ide_drive_info);
+ type_register_static(&ide_hd_info);
+ type_register_static(&ide_cd_info);
+ type_register_static(&ide_drive_info);
type_register_static(&ide_device_type_info);
}
device_init(ide_dev_register);
diff --git a/hw/ide/via.c b/hw/ide/via.c
index ef70864465..b4ca6f27b3 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -215,6 +215,7 @@ void vt82c686b_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
static void via_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = vt82c686b_ide_initfn;
@@ -223,17 +224,18 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_IDE;
k->revision = 0x06;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
}
-static DeviceInfo via_ide_info = {
- .name = "via-ide",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = via_ide_class_init,
+static TypeInfo via_ide_info = {
+ .name = "via-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = via_ide_class_init,
};
static void via_ide_register(void)
{
- pci_qdev_register(&via_ide_info);
+ type_register_static(&via_ide_info);
}
device_init(via_ide_register);