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_S_OK 0
74 #define VIRTIO_SCSI_S_OVERRUN 1
75 #define VIRTIO_SCSI_S_ABORTED 2
76 #define VIRTIO_SCSI_S_BAD_TARGET 3
77 #define VIRTIO_SCSI_S_RESET 4
78 #define VIRTIO_SCSI_S_BUSY 5
79 #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6
80 #define VIRTIO_SCSI_S_TARGET_FAILURE 7
81 #define VIRTIO_SCSI_S_NEXUS_FAILURE 8
82 #define VIRTIO_SCSI_S_FAILURE 9
83 #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10
84 #define VIRTIO_SCSI_S_FUNCTION_REJECTED 11
85 #define VIRTIO_SCSI_S_INCORRECT_LUN 12
87 /* Controlq type codes. */
88 #define VIRTIO_SCSI_T_TMF 0
89 #define VIRTIO_SCSI_T_AN_QUERY 1
90 #define VIRTIO_SCSI_T_AN_SUBSCRIBE 2
92 /* Valid TMF subtypes. */
93 #define VIRTIO_SCSI_T_TMF_ABORT_TASK 0
94 #define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1
95 #define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2
96 #define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3
97 #define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4
98 #define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5
99 #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6
100 #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7
103 #define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000
104 #define VIRTIO_SCSI_T_NO_EVENT 0
105 #define VIRTIO_SCSI_T_TRANSPORT_RESET 1
106 #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
108 #define VIRTIO_SCSI_S_SIMPLE 0
109 #define VIRTIO_SCSI_S_ORDERED 1
110 #define VIRTIO_SCSI_S_HEAD 2
111 #define VIRTIO_SCSI_S_ACA 3
114 #endif /* _LINUX_VIRTIO_SCSI_H */