diff options
author | Stefan Fritsch <sf@cvs.openbsd.org> | 2019-05-26 15:22:32 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@cvs.openbsd.org> | 2019-05-26 15:22:32 +0000 |
commit | 314c3aa12aeba0d9b4e0cd5acc3f3a4ab08cfc2f (patch) | |
tree | 2bfc4cd9325c0732d125861f8488c74c81e8e8cf /sys/dev/pci/virtio_pcireg.h | |
parent | 1da50a23005f8259346d47c7a13043333c88142c (diff) |
Support virtio 1.0 for virtio_pci
virtio 1.0 for virtio_mmio it not yet implemented, but 0.9 devices
continue to work.
Diffstat (limited to 'sys/dev/pci/virtio_pcireg.h')
-rw-r--r-- | sys/dev/pci/virtio_pcireg.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/sys/dev/pci/virtio_pcireg.h b/sys/dev/pci/virtio_pcireg.h index dc838f38d59..f47ec9c6e7a 100644 --- a/sys/dev/pci/virtio_pcireg.h +++ b/sys/dev/pci/virtio_pcireg.h @@ -35,5 +35,62 @@ #define VIRTIO_MSI_NO_VECTOR 0xffff +/* + * Virtio 1.0 specific + */ + +struct virtio_pci_cap { + uint8_t cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */ + uint8_t cap_next; /* Generic PCI field: next ptr. */ + uint8_t cap_len; /* Generic PCI field: capability length */ + uint8_t cfg_type; /* Identifies the structure. */ + uint8_t bar; /* Where to find it. */ + uint8_t padding[3]; /* Pad to full dword. */ + uint32_t offset; /* Offset within bar. */ + uint32_t length; /* Length of the structure, in bytes. */ +} __packed; + +/* Common configuration */ +#define VIRTIO_PCI_CAP_COMMON_CFG 1 +/* Notifications */ +#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 +/* ISR Status */ +#define VIRTIO_PCI_CAP_ISR_CFG 3 +/* Device specific configuration */ +#define VIRTIO_PCI_CAP_DEVICE_CFG 4 +/* PCI configuration access */ +#define VIRTIO_PCI_CAP_PCI_CFG 5 + +struct virtio_pci_notify_cap { + struct virtio_pci_cap cap; + uint32_t notify_off_multiplier; /* Multiplier for queue_notify_off. */ +} __packed; + +struct virtio_pci_cfg_cap { + struct virtio_pci_cap cap; + uint8_t pci_cfg_data[4]; /* Data for BAR access. */ +} __packed; + +struct virtio_pci_common_cfg { + /* About the whole device. */ + uint32_t device_feature_select; /* read-write */ + uint32_t device_feature; /* read-only for driver */ + uint32_t driver_feature_select; /* read-write */ + uint32_t driver_feature; /* read-write */ + uint16_t config_msix_vector; /* read-write */ + uint16_t num_queues; /* read-only for driver */ + uint8_t device_status; /* read-write */ + uint8_t config_generation; /* read-only for driver */ + + /* About a specific virtqueue. */ + uint16_t queue_select; /* read-write */ + uint16_t queue_size; /* read-write, power of 2, or 0. */ + uint16_t queue_msix_vector; /* read-write */ + uint16_t queue_enable; /* read-write */ + uint16_t queue_notify_off; /* read-only for driver */ + uint64_t queue_desc; /* read-write */ + uint64_t queue_avail; /* read-write */ + uint64_t queue_used; /* read-write */ +} __packed; #endif /* _DEV_PCI_VIRTIO_PCIREG_H_ */ |