diff options
author | KONRAD Frederic | 2013-01-15 00:08:04 +0100 |
---|---|---|
committer | Anthony Liguori | 2013-01-21 20:23:13 +0100 |
commit | 085bccb72c280f36f651556ef5169f5faca31d87 (patch) | |
tree | d6cc0cbca383270668cc833336b136b2fea232be /hw/virtio-pci.h | |
parent | virtio-pci-bus: introduce virtio-pci-bus. (diff) | |
download | qemu-085bccb72c280f36f651556ef5169f5faca31d87.tar.gz qemu-085bccb72c280f36f651556ef5169f5faca31d87.tar.xz qemu-085bccb72c280f36f651556ef5169f5faca31d87.zip |
virtio-pci: refactor virtio-pci device.
Create the virtio-pci device which is abstract. This transport device will
create a virtio-pci-bus, so one VirtIODevice can be connected.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-pci.h')
-rw-r--r-- | hw/virtio-pci.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/hw/virtio-pci.h b/hw/virtio-pci.h index d11e6225de..d24957cc25 100644 --- a/hw/virtio-pci.h +++ b/hw/virtio-pci.h @@ -23,6 +23,8 @@ #include "virtio-scsi.h" #include "virtio-bus.h" +typedef struct VirtIOPCIProxy VirtIOPCIProxy; + /* virtio-pci-bus */ typedef struct VirtioBusState VirtioPCIBusState; @@ -47,7 +49,23 @@ typedef struct { unsigned int users; } VirtIOIRQFD; -typedef struct { +/* + * virtio-pci: This is the PCIDevice which has a virtio-pci-bus. + */ +#define TYPE_VIRTIO_PCI "virtio-pci" +#define VIRTIO_PCI_GET_CLASS(obj) \ + OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI) +#define VIRTIO_PCI_CLASS(klass) \ + OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI) +#define VIRTIO_PCI(obj) \ + OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI) + +typedef struct VirtioPCIClass { + PCIDeviceClass parent_class; + int (*init)(VirtIOPCIProxy *vpci_dev); +} VirtioPCIClass; + +struct VirtIOPCIProxy { PCIDevice pci_dev; VirtIODevice *vdev; MemoryRegion bar; @@ -68,7 +86,8 @@ typedef struct { bool ioeventfd_started; VirtIOIRQFD *vector_irqfd; int nvqs_with_notifiers; -} VirtIOPCIProxy; + VirtioBusState bus; +}; void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev); void virtio_pci_reset(DeviceState *d); |