1 #ifndef _LINUX_VIRTIO_SCSI_H
2 #define _LINUX_VIRTIO_SCSI_H
3 /* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
6 #define VIRTIO_SCSI_CDB_SIZE 32
7 #define VIRTIO_SCSI_SENSE_SIZE 96
9 /* SCSI command request, followed by data-out */
10 struct virtio_scsi_cmd_req {
11 u8 lun[8]; /* Logical Unit Number */
12 u64 tag; /* Command identifier */
13 u8 task_attr; /* Task attribute */
16 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
19 /* Response, followed by sense data and data-in */
20 struct virtio_scsi_cmd_resp {
21 u32 sense_len; /* Sense data length */
22 u32 resid; /* Residual bytes in data buffer */
23 u16 status_qualifier; /* Status qualifier */
24 u8 status; /* Command completion status */
25 u8 response; /* Response values */
26 u8 sense[VIRTIO_SCSI_SENSE_SIZE];
29 /* Task Management Request */
30 struct virtio_scsi_ctrl_tmf_req {
37 struct virtio_scsi_ctrl_tmf_resp {
41 /* Asynchronous notification query/subscription */
42 struct virtio_scsi_ctrl_an_req {
48 struct virtio_scsi_ctrl_an_resp {
53 struct virtio_scsi_event {
59 struct virtio_scsi_config {
73 #define VIRTIO_SCSI_F_INOUT 0
74 #define VIRTIO_SCSI_F_HOTPLUG 1
77 #define VIRTIO_SCSI_S_OK 0
78 #define VIRTIO_SCSI_S_OVERRUN 1
79 #define VIRTIO_SCSI_S_ABORTED 2
80 #define VIRTIO_SCSI_S_BAD_TARGET 3
81 #define VIRTIO_SCSI_S_RESET 4
82 #define VIRTIO_SCSI_S_BUSY 5
83 #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6
84 #define VIRTIO_SCSI_S_TARGET_FAILURE 7
85 #define VIRTIO_SCSI_S_NEXUS_FAILURE 8
86 #define VIRTIO_SCSI_S_FAILURE 9
87 #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10
88 #define VIRTIO_SCSI_S_FUNCTION_REJECTED 11
89 #define VIRTIO_SCSI_S_INCORRECT_LUN 12
91 /* Controlq type codes. */
92 #define VIRTIO_SCSI_T_TMF 0
93 #define VIRTIO_SCSI_T_AN_QUERY 1
94 #define VIRTIO_SCSI_T_AN_SUBSCRIBE 2
96 /* Valid TMF subtypes. */
97 #define VIRTIO_SCSI_T_TMF_ABORT_TASK 0
98 #define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1
99 #define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2
100 #define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3
101 #define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4
102 #define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5
103 #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6
104 #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7
107 #define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000
108 #define VIRTIO_SCSI_T_NO_EVENT 0
109 #define VIRTIO_SCSI_T_TRANSPORT_RESET 1
110 #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
112 /* Reasons of transport reset event */
113 #define VIRTIO_SCSI_EVT_RESET_HARD 0
114 #define VIRTIO_SCSI_EVT_RESET_RESCAN 1
115 #define VIRTIO_SCSI_EVT_RESET_REMOVED 2
117 #define VIRTIO_SCSI_S_SIMPLE 0
118 #define VIRTIO_SCSI_S_ORDERED 1
119 #define VIRTIO_SCSI_S_HEAD 2
120 #define VIRTIO_SCSI_S_ACA 3
123 #endif /* _LINUX_VIRTIO_SCSI_H */