aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio-pci.h')
-rw-r--r--hw/virtio-pci.h23
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);