aboutsummaryrefslogtreecommitdiff
path: root/lib/libvirtio/virtio.h
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2016-02-01 11:18:05 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-02-08 16:40:39 +1100
commitff9b0bd159ddb843d32f24e66a43fe99c920a00b (patch)
tree8a3802ed50ab33f441daf393f0e012d90535b45f /lib/libvirtio/virtio.h
parent5ed17500f03913f3f125ecde14aa041c6235ba08 (diff)
downloadSLOF-ff9b0bd159ddb843d32f24e66a43fe99c920a00b.zip
SLOF-ff9b0bd159ddb843d32f24e66a43fe99c920a00b.tar.gz
SLOF-ff9b0bd159ddb843d32f24e66a43fe99c920a00b.tar.bz2
virtio: add virtio 1.0 related struct and defines
Traditionally, struct virtio_device is shared between SLOF and C code. This still remains shared with the addition of virtio_cap structure as well. Now both virtio_device and virtio_cap structures are shared. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libvirtio/virtio.h')
-rw-r--r--lib/libvirtio/virtio.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/libvirtio/virtio.h b/lib/libvirtio/virtio.h
index 75de5ec..ebfc726 100644
--- a/lib/libvirtio/virtio.h
+++ b/lib/libvirtio/virtio.h
@@ -20,8 +20,17 @@
#define VIRTIO_STAT_ACKNOWLEDGE 1
#define VIRTIO_STAT_DRIVER 2
#define VIRTIO_STAT_DRIVER_OK 4
+#define VIRTIO_STAT_FEATURES_OK 8
+#define VIRTIO_STAT_NEEDS_RESET 64
#define VIRTIO_STAT_FAILED 128
+#define BIT(x) (1UL << (x))
+
+/* VIRTIO 1.0 Device independent feature bits */
+#define VIRTIO_F_RING_INDIRECT_DESC BIT(28)
+#define VIRTIO_F_RING_EVENT_IDX BIT(29)
+#define VIRTIO_F_VERSION_1 BIT(32)
+
#define VIRTIO_TIMEOUT 5000 /* 5 sec timeout */
/* Definitions for vring_desc.flags */
@@ -61,9 +70,26 @@ struct vring_used {
struct vring_used_elem ring[];
};
+/* Structure shared with SLOF and is 16bytes */
+struct virtio_cap {
+ void *addr;
+ uint8_t bar;
+ uint8_t is_io;
+ uint8_t cap_id;
+ uint8_t pad[5];
+} __attribute__ ((packed));
+
struct virtio_device {
void *base; /* base address */
-};
+ uint32_t is_modern; /* Indicates whether to use virtio 1.0 */
+ struct virtio_cap legacy;
+ struct virtio_cap common;
+ struct virtio_cap notify;
+ struct virtio_cap isr;
+ struct virtio_cap device;
+ struct virtio_cap pci;
+ uint32_t notify_off_mul;
+} __attribute__ ((packed));
struct vqs {
uint64_t id; /* Queue ID */