aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_pci_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio/virtio_pci_common.h')
-rw-r--r--drivers/virtio/virtio_pci_common.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
index 5a497289b7e9..28ee4e56badf 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -53,12 +53,32 @@ struct virtio_pci_device {
53 struct virtio_device vdev; 53 struct virtio_device vdev;
54 struct pci_dev *pci_dev; 54 struct pci_dev *pci_dev;
55 55
56 /* In legacy mode, these two point to within ->legacy. */
57 /* Where to read and clear interrupt */
58 u8 __iomem *isr;
59
60 /* Modern only fields */
61 /* The IO mapping for the PCI config space (non-legacy mode) */
62 struct virtio_pci_common_cfg __iomem *common;
63 /* Device-specific data (non-legacy mode) */
64 void __iomem *device;
65 /* Base of vq notifications (non-legacy mode). */
66 void __iomem *notify_base;
67
68 /* So we can sanity-check accesses. */
69 size_t notify_len;
70 size_t device_len;
71
72 /* Capability for when we need to map notifications per-vq. */
73 int notify_map_cap;
74
75 /* Multiply queue_notify_off by this value. (non-legacy mode). */
76 u32 notify_offset_multiplier;
77
78 /* Legacy only field */
56 /* the IO mapping for the PCI config space */ 79 /* the IO mapping for the PCI config space */
57 void __iomem *ioaddr; 80 void __iomem *ioaddr;
58 81
59 /* the IO mapping for ISR operation */
60 void __iomem *isr;
61
62 /* a list of queues so we can dispatch IRQs */ 82 /* a list of queues so we can dispatch IRQs */
63 spinlock_t lock; 83 spinlock_t lock;
64 struct list_head virtqueues; 84 struct list_head virtqueues;
@@ -127,8 +147,19 @@ const char *vp_bus_name(struct virtio_device *vdev);
127 */ 147 */
128int vp_set_vq_affinity(struct virtqueue *vq, int cpu); 148int vp_set_vq_affinity(struct virtqueue *vq, int cpu);
129 149
130int virtio_pci_legacy_probe(struct pci_dev *pci_dev, 150#if IS_ENABLED(CONFIG_VIRTIO_PCI_LEGACY)
131 const struct pci_device_id *id); 151int virtio_pci_legacy_probe(struct virtio_pci_device *);
132void virtio_pci_legacy_remove(struct pci_dev *pci_dev); 152void virtio_pci_legacy_remove(struct virtio_pci_device *);
153#else
154static inline int virtio_pci_legacy_probe(struct virtio_pci_device *vp_dev)
155{
156 return -ENODEV;
157}
158static inline void virtio_pci_legacy_remove(struct virtio_pci_device *vp_dev)
159{
160}
161#endif
162int virtio_pci_modern_probe(struct virtio_pci_device *);
163void virtio_pci_modern_remove(struct virtio_pci_device *);
133 164
134#endif 165#endif