[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 31/55] i440fx-pcihost: Use QOM realize for i440fx-pci
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 31/55] i440fx-pcihost: Use QOM realize for i440fx-pcihost |
Date: |
Tue, 23 Jul 2013 01:46:12 +0200 |
From: Hu Tao <address@hidden>
Signed-off-by: Hu Tao <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/pci-host/piix.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 541c8b7..3908860 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -203,21 +203,26 @@ static const VMStateDescription vmstate_i440fx = {
}
};
-static int i440fx_pcihost_initfn(SysBusDevice *dev)
+static void i440fx_pcihost_initfn(Object *obj)
{
- PCIHostState *s = PCI_HOST_BRIDGE(dev);
+ PCIHostState *s = PCI_HOST_BRIDGE(obj);
- memory_region_init_io(&s->conf_mem, OBJECT(dev), &pci_host_conf_le_ops, s,
+ memory_region_init_io(&s->conf_mem, obj, &pci_host_conf_le_ops, s,
"pci-conf-idx", 4);
- sysbus_add_io(dev, 0xcf8, &s->conf_mem);
- sysbus_init_ioports(&s->busdev, 0xcf8, 4);
-
- memory_region_init_io(&s->data_mem, OBJECT(dev), &pci_host_data_le_ops, s,
+ memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
"pci-conf-data", 4);
- sysbus_add_io(dev, 0xcfc, &s->data_mem);
- sysbus_init_ioports(&s->busdev, 0xcfc, 4);
+}
- return 0;
+static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
+{
+ PCIHostState *s = PCI_HOST_BRIDGE(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+
+ sysbus_add_io(sbd, 0xcf8, &s->conf_mem);
+ sysbus_init_ioports(sbd, 0xcf8, 4);
+
+ sysbus_add_io(sbd, 0xcfc, &s->data_mem);
+ sysbus_init_ioports(sbd, 0xcfc, 4);
}
static int i440fx_initfn(PCIDevice *dev)
@@ -647,11 +652,10 @@ static const char
*i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
hc->root_bus_path = i440fx_pcihost_root_bus_path;
- k->init = i440fx_pcihost_initfn;
+ dc->realize = i440fx_pcihost_realize;
dc->fw_name = "pci";
dc->no_user = 1;
}
@@ -660,6 +664,7 @@ static const TypeInfo i440fx_pcihost_info = {
.name = "i440FX-pcihost",
.parent = TYPE_PCI_HOST_BRIDGE,
.instance_size = sizeof(I440FXState),
+ .instance_init = i440fx_pcihost_initfn,
.class_init = i440fx_pcihost_class_init,
};
--
1.8.1.4
- [Qemu-devel] [PULL 18/55] acpi/piix4: QOM parent field cleanup, (continued)
- [Qemu-devel] [PULL 18/55] acpi/piix4: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 21/55] display/vmware_vga: QOM casting sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 22/55] display/vmware_vga: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 23/55] misc/ivshmem: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 25/55] xen/xen_platform: QOM casting sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 26/55] xen/xen_platform: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 27/55] sysbus: Document SysBusDeviceClass::init and realize semantics, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 24/55] misc/ivshmem: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 29/55] ohci: Use QOM realize for OHCI, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 28/55] ohci: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 31/55] i440fx-pcihost: Use QOM realize for i440fx-pcihost,
Andreas Färber <=
- [Qemu-devel] [PULL 33/55] q35: Use QOM realize for q35 host bridge, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 30/55] i440fx: Use type-safe cast instead of direct access of parent dev, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 35/55] pflash-cfi01: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 34/55] fdc: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 32/55] q35: Use type-safe cast instead of direct access of parent dev, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 36/55] pflash-cfi02: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 38/55] fwcfg: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 37/55] ahci: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 39/55] scsi/esp: QOM'ify some more, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 41/55] kvm/clock: QOM'ify some more, Andreas Färber, 2013/07/22