summaryrefslogtreecommitdiff
path: root/sys/dev/pv
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2019-01-10 18:11:43 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2019-01-10 18:11:43 +0000
commitea1860100232ec52094cfb42caf494ef52bb6093 (patch)
tree68cee71e6fcda4e1863f9fb87c4d2976d5d67dca /sys/dev/pv
parentb21bced0ec1a3fcd0d444f29d6b7fe36ed3753ea (diff)
Move some PCI-specific defines to a new virtio_pcireg.h file
Also add some virtio 1.0 status and feature bits
Diffstat (limited to 'sys/dev/pv')
-rw-r--r--sys/dev/pv/virtioreg.h50
1 files changed, 19 insertions, 31 deletions
diff --git a/sys/dev/pv/virtioreg.h b/sys/dev/pv/virtioreg.h
index d316523be74..1eb215419f6 100644
--- a/sys/dev/pv/virtioreg.h
+++ b/sys/dev/pv/virtioreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtioreg.h,v 1.1 2017/01/21 11:23:06 reyk Exp $ */
+/* $OpenBSD: virtioreg.h,v 1.2 2019/01/10 18:11:42 sf Exp $ */
/* $NetBSD: virtioreg.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */
/*
@@ -64,8 +64,8 @@
*/
-#ifndef _DEV_PCI_VIRTIOREG_H_
-#define _DEV_PCI_VIRTIOREG_H_
+#ifndef _DEV_PV_VIRTIOREG_H_
+#define _DEV_PV_VIRTIOREG_H_
#include <sys/types.h>
@@ -82,33 +82,21 @@
#define PCI_PRODUCT_VIRTIO_MAC80211 10
#define PCI_PRODUCT_VIRTIO_VMMCI 65535 /* private id */
-/* Virtio header */
-#define VIRTIO_CONFIG_DEVICE_FEATURES 0 /* 32bit */
-#define VIRTIO_CONFIG_GUEST_FEATURES 4 /* 32bit */
-#define VIRTIO_F_NOTIFY_ON_EMPTY (1<<24)
-#define VIRTIO_F_RING_INDIRECT_DESC (1<<28)
-#define VIRTIO_F_RING_EVENT_IDX (1<<29)
-#define VIRTIO_F_BAD_FEATURE (1<<30)
-#define VIRTIO_CONFIG_QUEUE_ADDRESS 8 /* 32bit */
-#define VIRTIO_CONFIG_QUEUE_SIZE 12 /* 16bit */
-#define VIRTIO_CONFIG_QUEUE_SELECT 14 /* 16bit */
-#define VIRTIO_CONFIG_QUEUE_NOTIFY 16 /* 16bit */
-#define VIRTIO_CONFIG_DEVICE_STATUS 18 /* 8bit */
-#define VIRTIO_CONFIG_DEVICE_STATUS_RESET 0
-#define VIRTIO_CONFIG_DEVICE_STATUS_ACK 1
-#define VIRTIO_CONFIG_DEVICE_STATUS_DRIVER 2
-#define VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK 4
-#define VIRTIO_CONFIG_DEVICE_STATUS_FAILED 128
-#define VIRTIO_CONFIG_ISR_STATUS 19 /* 8bit */
-#define VIRTIO_CONFIG_ISR_CONFIG_CHANGE 2
-#define VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI 20
-/* Only if MSIX is enabled: */
-#define VIRTIO_MSI_CONFIG_VECTOR 20 /* 16bit, optional */
-#define VIRTIO_MSI_QUEUE_VECTOR 22 /* 16bit, optional */
-#define VIRTIO_CONFIG_DEVICE_CONFIG_MSI 24
-
-#define VIRTIO_MSI_NO_VECTOR 0xffff
-
+/* device-independent feature bits */
+#define VIRTIO_F_NOTIFY_ON_EMPTY 24
+#define VIRTIO_F_RING_INDIRECT_DESC 28
+#define VIRTIO_F_RING_EVENT_IDX 29
+#define VIRTIO_F_BAD_FEATURE 30
+#define VIRTIO_F_VERSION_1 32
+
+/* device status bits */
+#define VIRTIO_CONFIG_DEVICE_STATUS_RESET 0
+#define VIRTIO_CONFIG_DEVICE_STATUS_ACK 1
+#define VIRTIO_CONFIG_DEVICE_STATUS_DRIVER 2
+#define VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK 4
+#define VIRTIO_CONFIG_DEVICE_STATUS_FEATURES_OK 8
+#define VIRTIO_CONFIG_DEVICE_STATUS_DEVICE_NEEDS_RESET 64
+#define VIRTIO_CONFIG_DEVICE_STATUS_FAILED 128
/* Virtqueue */
/* This marks a buffer as continuing via the next field. */
@@ -195,4 +183,4 @@ struct vring_used {
#define VIRTIO_PAGE_SIZE (4096)
-#endif /* _DEV_PCI_VIRTIOREG_H_ */
+#endif /* _DEV_PV_VIRTIOREG_H_ */