|
@@ -37,6 +37,66 @@
|
37
|
37
|
/* Virtio ABI version, this must match exactly */
|
38
|
38
|
#define VIRTIO_PCI_ABI_VERSION 0
|
39
|
39
|
|
|
40
|
+/* PCI capability types: */
|
|
41
|
+#define VIRTIO_PCI_CAP_COMMON_CFG 1 /* Common configuration */
|
|
42
|
+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 /* Notifications */
|
|
43
|
+#define VIRTIO_PCI_CAP_ISR_CFG 3 /* ISR access */
|
|
44
|
+#define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* Device specific configuration */
|
|
45
|
+#define VIRTIO_PCI_CAP_PCI_CFG 5 /* PCI configuration access */
|
|
46
|
+
|
|
47
|
+#define __u8 uint8_t
|
|
48
|
+#define __le16 uint16_t
|
|
49
|
+#define __le32 uint32_t
|
|
50
|
+#define __le64 uint64_t
|
|
51
|
+
|
|
52
|
+/* This is the PCI capability header: */
|
|
53
|
+struct virtio_pci_cap {
|
|
54
|
+ __u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */
|
|
55
|
+ __u8 cap_next; /* Generic PCI field: next ptr. */
|
|
56
|
+ __u8 cap_len; /* Generic PCI field: capability length */
|
|
57
|
+ __u8 cfg_type; /* Identifies the structure. */
|
|
58
|
+ __u8 bar; /* Where to find it. */
|
|
59
|
+ __u8 padding[3]; /* Pad to full dword. */
|
|
60
|
+ __le32 offset; /* Offset within bar. */
|
|
61
|
+ __le32 length; /* Length of the structure, in bytes. */
|
|
62
|
+};
|
|
63
|
+
|
|
64
|
+struct virtio_pci_notify_cap {
|
|
65
|
+ struct virtio_pci_cap cap;
|
|
66
|
+ __le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */
|
|
67
|
+};
|
|
68
|
+
|
|
69
|
+struct virtio_pci_cfg_cap {
|
|
70
|
+ struct virtio_pci_cap cap;
|
|
71
|
+ __u8 pci_cfg_data[4]; /* Data for BAR access. */
|
|
72
|
+};
|
|
73
|
+
|
|
74
|
+/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
|
|
75
|
+struct virtio_pci_common_cfg {
|
|
76
|
+ /* About the whole device. */
|
|
77
|
+ __le32 device_feature_select; /* read-write */
|
|
78
|
+ __le32 device_feature; /* read-only */
|
|
79
|
+ __le32 guest_feature_select; /* read-write */
|
|
80
|
+ __le32 guest_feature; /* read-write */
|
|
81
|
+ __le16 msix_config; /* read-write */
|
|
82
|
+ __le16 num_queues; /* read-only */
|
|
83
|
+ __u8 device_status; /* read-write */
|
|
84
|
+ __u8 config_generation; /* read-only */
|
|
85
|
+
|
|
86
|
+ /* About a specific virtqueue. */
|
|
87
|
+ __le16 queue_select; /* read-write */
|
|
88
|
+ __le16 queue_size; /* read-write, power of 2. */
|
|
89
|
+ __le16 queue_msix_vector; /* read-write */
|
|
90
|
+ __le16 queue_enable; /* read-write */
|
|
91
|
+ __le16 queue_notify_off; /* read-only */
|
|
92
|
+ __le32 queue_desc_lo; /* read-write */
|
|
93
|
+ __le32 queue_desc_hi; /* read-write */
|
|
94
|
+ __le32 queue_avail_lo; /* read-write */
|
|
95
|
+ __le32 queue_avail_hi; /* read-write */
|
|
96
|
+ __le32 queue_used_lo; /* read-write */
|
|
97
|
+ __le32 queue_used_hi; /* read-write */
|
|
98
|
+};
|
|
99
|
+
|
40
|
100
|
static inline u32 vp_get_features(unsigned int ioaddr)
|
41
|
101
|
{
|
42
|
102
|
return inl(ioaddr + VIRTIO_PCI_HOST_FEATURES);
|