diff options
Diffstat (limited to 'include/linux/virtio_blk.h')
-rw-r--r-- | include/linux/virtio_blk.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index 8dab9f2b883..fd294c56d57 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
@@ -3,11 +3,9 @@ | |||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/virtio_ids.h> | ||
6 | #include <linux/virtio_config.h> | 7 | #include <linux/virtio_config.h> |
7 | 8 | ||
8 | /* The ID for virtio_block */ | ||
9 | #define VIRTIO_ID_BLOCK 2 | ||
10 | |||
11 | /* Feature bits */ | 9 | /* Feature bits */ |
12 | #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ | 10 | #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ |
13 | #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ | 11 | #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ |
@@ -16,9 +14,7 @@ | |||
16 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ | 14 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ |
17 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ | 15 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ |
18 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ | 16 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ |
19 | #define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */ | 17 | #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ |
20 | |||
21 | #define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */ | ||
22 | 18 | ||
23 | struct virtio_blk_config { | 19 | struct virtio_blk_config { |
24 | /* The capacity (in 512-byte sectors). */ | 20 | /* The capacity (in 512-byte sectors). */ |
@@ -35,9 +31,19 @@ struct virtio_blk_config { | |||
35 | } geometry; | 31 | } geometry; |
36 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ | 32 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ |
37 | __u32 blk_size; | 33 | __u32 blk_size; |
38 | __u8 identify[VIRTIO_BLK_ID_BYTES]; | ||
39 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
40 | 35 | ||
36 | /* | ||
37 | * Command types | ||
38 | * | ||
39 | * Usage is a bit tricky as some bits are used as flags and some are not. | ||
40 | * | ||
41 | * Rules: | ||
42 | * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or | ||
43 | * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own | ||
44 | * and may not be combined with any of the other flags. | ||
45 | */ | ||
46 | |||
41 | /* These two define direction. */ | 47 | /* These two define direction. */ |
42 | #define VIRTIO_BLK_T_IN 0 | 48 | #define VIRTIO_BLK_T_IN 0 |
43 | #define VIRTIO_BLK_T_OUT 1 | 49 | #define VIRTIO_BLK_T_OUT 1 |
@@ -45,6 +51,9 @@ struct virtio_blk_config { | |||
45 | /* This bit says it's a scsi command, not an actual read or write. */ | 51 | /* This bit says it's a scsi command, not an actual read or write. */ |
46 | #define VIRTIO_BLK_T_SCSI_CMD 2 | 52 | #define VIRTIO_BLK_T_SCSI_CMD 2 |
47 | 53 | ||
54 | /* Cache flush command */ | ||
55 | #define VIRTIO_BLK_T_FLUSH 4 | ||
56 | |||
48 | /* Barrier before this op. */ | 57 | /* Barrier before this op. */ |
49 | #define VIRTIO_BLK_T_BARRIER 0x80000000 | 58 | #define VIRTIO_BLK_T_BARRIER 0x80000000 |
50 | 59 | ||