[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 036/197] qom: make pcidevice part of the hierarch
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH v3 036/197] qom: make pcidevice part of the hierarchy |
Date: |
Mon, 12 Dec 2011 14:18:32 -0600 |
---
hw/pci.c | 18 ++++++++++++++++--
hw/pci.h | 12 ++++++++++++
hw/qdev.c | 5 +++++
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 9992ea2..04fd95f 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -89,7 +89,6 @@ static const VMStateDescription vmstate_pcibus = {
VMSTATE_END_OF_LIST()
}
};
-
static int pci_bar(PCIDevice *d, int reg)
{
uint8_t type;
@@ -1550,7 +1549,7 @@ void pci_qdev_register(PCIDeviceInfo *info)
info->qdev.unplug = pci_unplug_device;
info->qdev.exit = pci_unregister_device;
info->qdev.bus_info = &pci_bus_info;
- qdev_register(&info->qdev);
+ qdev_register_subclass(&info->qdev, TYPE_PCI_DEVICE);
}
void pci_qdev_register_many(PCIDeviceInfo *info)
@@ -2038,3 +2037,18 @@ MemoryRegion *pci_address_space_io(PCIDevice *dev)
{
return dev->bus->address_space_io;
}
+
+static TypeInfo pci_device_type_info = {
+ .name = TYPE_PCI_DEVICE,
+ .parent = TYPE_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .abstract = true,
+ .class_size = sizeof(PCIDeviceClass),
+};
+
+static void pci_register_devices(void)
+{
+ type_register_static(&pci_device_type_info);
+}
+
+device_init(pci_register_devices);
diff --git a/hw/pci.h b/hw/pci.h
index 625e717..00c9897 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -127,6 +127,18 @@ enum {
QEMU_PCI_CAP_SERR = (1 << QEMU_PCI_CAP_SERR_BITNR),
};
+#define TYPE_PCI_DEVICE "pci-device"
+#define PCI_DEVICE(obj) \
+ OBJECT_CHECK(PCIDevice, (obj), TYPE_PCI_DEVICE)
+#define PCI_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(PCIDeviceClass, (klass), TYPE_PCI_DEVICE)
+#define PCI_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE)
+
+typedef struct PCIDeviceClass {
+ DeviceClass parent_class;
+} PCIDeviceClass;
+
struct PCIDevice {
DeviceState qdev;
/* PCI config space */
diff --git a/hw/qdev.c b/hw/qdev.c
index e0c4a40..09f8b4c 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -111,6 +111,11 @@ static DeviceInfo *qdev_find_info(BusInfo *bus_info, const
char *name)
return NULL;
}
+/* FIXME: need to figure out somethign to do with bus.
+ *
+ * The general problem is that we don't want to take a bus argument on
+ * create. there's simply no way to pass it to instance init.
+ */
static DeviceState *qdev_create_from_info(BusState *bus, DeviceInfo *info)
{
DeviceState *dev;
--
1.7.4.1
- [Qemu-devel] [PATCH v3 018/197] qom: add test tools (v2), (continued)
- [Qemu-devel] [PATCH v3 018/197] qom: add test tools (v2), Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 020/197] qom: add vga node to the pc composition tree, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 021/197] qom: add string property type, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 022/197] qdev: add a qdev_get_type() function and expose as a 'type' property, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 023/197] pc: fill out most of the composition tree, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 024/197] i440fx: split out piix3 device, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 025/197] i440fx: rename piix_pci -> i440fx, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 033/197] a little better approach to this, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 034/197] qdev: add isa-device as a subclass of device, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 035/197] isa: more isa stuff, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 036/197] qom: make pcidevice part of the hierarchy,
Anthony Liguori <=
- [Qemu-devel] [PATCH v3 039/197] virtio-serial-port, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 040/197] get rid of more DO_UPCAST, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 042/197] isa: move methods from isadeviceinfo to isadeviceclass, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 045/197] usb: get rid of info pointer, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 047/197] usb: use a factory instead of doing silly things for legacy, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 046/197] usb: promote all of the methods for USBDevice to class methods, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 049/197] usb-hid: simply class initialization a bit, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 051/197] drop info link in SCSIDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 048/197] usb: kill USBDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 052/197] move methods out of SCSIDeviceInfo into SCSIDeviceClass, Anthony Liguori, 2011/12/12