aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/virtio_blk.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/virtio_blk.h')
-rw-r--r--include/linux/virtio_blk.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 8dab9f2b8832..15cb666581d7 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -5,9 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
7 7
8/* The ID for virtio_block */
9#define VIRTIO_ID_BLOCK 2
10
11/* Feature bits */ 8/* Feature bits */
12#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
13#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
@@ -17,6 +14,7 @@
17#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 14#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
18#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 15#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
19#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */ 16#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
20 18
21#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */ 19#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
22 20
@@ -38,6 +36,17 @@ struct virtio_blk_config {
38 __u8 identify[VIRTIO_BLK_ID_BYTES]; 36 __u8 identify[VIRTIO_BLK_ID_BYTES];
39} __attribute__((packed)); 37} __attribute__((packed));
40 38
39/*
40 * Command types
41 *
42 * Usage is a bit tricky as some bits are used as flags and some are not.
43 *
44 * Rules:
45 * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
46 * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
47 * and may not be combined with any of the other flags.
48 */
49
41/* These two define direction. */ 50/* These two define direction. */
42#define VIRTIO_BLK_T_IN 0 51#define VIRTIO_BLK_T_IN 0
43#define VIRTIO_BLK_T_OUT 1 52#define VIRTIO_BLK_T_OUT 1
@@ -45,6 +54,9 @@ struct virtio_blk_config {
45/* This bit says it's a scsi command, not an actual read or write. */ 54/* This bit says it's a scsi command, not an actual read or write. */
46#define VIRTIO_BLK_T_SCSI_CMD 2 55#define VIRTIO_BLK_T_SCSI_CMD 2
47 56
57/* Cache flush command */
58#define VIRTIO_BLK_T_FLUSH 4
59
48/* Barrier before this op. */ 60/* Barrier before this op. */
49#define VIRTIO_BLK_T_BARRIER 0x80000000 61#define VIRTIO_BLK_T_BARRIER 0x80000000
50 62