xref: /openbmc/linux/include/scsi/scsi_proto.h (revision b790a56d66eaac4a1ac6c558575fd0a694b06159)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2c5f1ac8bSBart Van Assche /*
3c5f1ac8bSBart Van Assche  * This header file contains public constants and structures used by
4c5f1ac8bSBart Van Assche  * both the SCSI initiator and the SCSI target code.
5c5f1ac8bSBart Van Assche  *
6c5f1ac8bSBart Van Assche  * For documentation on the OPCODES, MESSAGES, and SENSE values,
7c5f1ac8bSBart Van Assche  * please consult the SCSI standard.
8c5f1ac8bSBart Van Assche  */
9c5f1ac8bSBart Van Assche 
10c5f1ac8bSBart Van Assche #ifndef _SCSI_PROTO_H_
11c5f1ac8bSBart Van Assche #define _SCSI_PROTO_H_
12c5f1ac8bSBart Van Assche 
13c5f1ac8bSBart Van Assche #include <linux/types.h>
14c5f1ac8bSBart Van Assche 
15c5f1ac8bSBart Van Assche /*
16c5f1ac8bSBart Van Assche  *      SCSI opcodes
17c5f1ac8bSBart Van Assche  */
18c5f1ac8bSBart Van Assche 
19c5f1ac8bSBart Van Assche #define TEST_UNIT_READY       0x00
20c5f1ac8bSBart Van Assche #define REZERO_UNIT           0x01
21c5f1ac8bSBart Van Assche #define REQUEST_SENSE         0x03
22c5f1ac8bSBart Van Assche #define FORMAT_UNIT           0x04
23c5f1ac8bSBart Van Assche #define READ_BLOCK_LIMITS     0x05
24c5f1ac8bSBart Van Assche #define REASSIGN_BLOCKS       0x07
25c5f1ac8bSBart Van Assche #define INITIALIZE_ELEMENT_STATUS 0x07
26c5f1ac8bSBart Van Assche #define READ_6                0x08
27c5f1ac8bSBart Van Assche #define WRITE_6               0x0a
28c5f1ac8bSBart Van Assche #define SEEK_6                0x0b
29c5f1ac8bSBart Van Assche #define READ_REVERSE          0x0f
30c5f1ac8bSBart Van Assche #define WRITE_FILEMARKS       0x10
31c5f1ac8bSBart Van Assche #define SPACE                 0x11
32c5f1ac8bSBart Van Assche #define INQUIRY               0x12
33c5f1ac8bSBart Van Assche #define RECOVER_BUFFERED_DATA 0x14
34c5f1ac8bSBart Van Assche #define MODE_SELECT           0x15
35c5f1ac8bSBart Van Assche #define RESERVE               0x16
36c5f1ac8bSBart Van Assche #define RELEASE               0x17
37c5f1ac8bSBart Van Assche #define COPY                  0x18
38c5f1ac8bSBart Van Assche #define ERASE                 0x19
39c5f1ac8bSBart Van Assche #define MODE_SENSE            0x1a
40c5f1ac8bSBart Van Assche #define START_STOP            0x1b
41c5f1ac8bSBart Van Assche #define RECEIVE_DIAGNOSTIC    0x1c
42c5f1ac8bSBart Van Assche #define SEND_DIAGNOSTIC       0x1d
43c5f1ac8bSBart Van Assche #define ALLOW_MEDIUM_REMOVAL  0x1e
44c5f1ac8bSBart Van Assche 
45c5f1ac8bSBart Van Assche #define READ_FORMAT_CAPACITIES 0x23
46c5f1ac8bSBart Van Assche #define SET_WINDOW            0x24
47c5f1ac8bSBart Van Assche #define READ_CAPACITY         0x25
48c5f1ac8bSBart Van Assche #define READ_10               0x28
49c5f1ac8bSBart Van Assche #define WRITE_10              0x2a
50c5f1ac8bSBart Van Assche #define SEEK_10               0x2b
51c5f1ac8bSBart Van Assche #define POSITION_TO_ELEMENT   0x2b
52c5f1ac8bSBart Van Assche #define WRITE_VERIFY          0x2e
53c5f1ac8bSBart Van Assche #define VERIFY                0x2f
54c5f1ac8bSBart Van Assche #define SEARCH_HIGH           0x30
55c5f1ac8bSBart Van Assche #define SEARCH_EQUAL          0x31
56c5f1ac8bSBart Van Assche #define SEARCH_LOW            0x32
57c5f1ac8bSBart Van Assche #define SET_LIMITS            0x33
58c5f1ac8bSBart Van Assche #define PRE_FETCH             0x34
59c5f1ac8bSBart Van Assche #define READ_POSITION         0x34
60c5f1ac8bSBart Van Assche #define SYNCHRONIZE_CACHE     0x35
61c5f1ac8bSBart Van Assche #define LOCK_UNLOCK_CACHE     0x36
62c5f1ac8bSBart Van Assche #define READ_DEFECT_DATA      0x37
63c5f1ac8bSBart Van Assche #define MEDIUM_SCAN           0x38
64c5f1ac8bSBart Van Assche #define COMPARE               0x39
65c5f1ac8bSBart Van Assche #define COPY_VERIFY           0x3a
66c5f1ac8bSBart Van Assche #define WRITE_BUFFER          0x3b
67c5f1ac8bSBart Van Assche #define READ_BUFFER           0x3c
68c5f1ac8bSBart Van Assche #define UPDATE_BLOCK          0x3d
69c5f1ac8bSBart Van Assche #define READ_LONG             0x3e
70c5f1ac8bSBart Van Assche #define WRITE_LONG            0x3f
71c5f1ac8bSBart Van Assche #define CHANGE_DEFINITION     0x40
72c5f1ac8bSBart Van Assche #define WRITE_SAME            0x41
73c5f1ac8bSBart Van Assche #define UNMAP		      0x42
74c5f1ac8bSBart Van Assche #define READ_TOC              0x43
75c5f1ac8bSBart Van Assche #define READ_HEADER           0x44
76c5f1ac8bSBart Van Assche #define GET_EVENT_STATUS_NOTIFICATION 0x4a
77c5f1ac8bSBart Van Assche #define LOG_SELECT            0x4c
78c5f1ac8bSBart Van Assche #define LOG_SENSE             0x4d
79c5f1ac8bSBart Van Assche #define XDWRITEREAD_10        0x53
80c5f1ac8bSBart Van Assche #define MODE_SELECT_10        0x55
81c5f1ac8bSBart Van Assche #define RESERVE_10            0x56
82c5f1ac8bSBart Van Assche #define RELEASE_10            0x57
83c5f1ac8bSBart Van Assche #define MODE_SENSE_10         0x5a
84c5f1ac8bSBart Van Assche #define PERSISTENT_RESERVE_IN 0x5e
85c5f1ac8bSBart Van Assche #define PERSISTENT_RESERVE_OUT 0x5f
86c5f1ac8bSBart Van Assche #define VARIABLE_LENGTH_CMD   0x7f
87c5f1ac8bSBart Van Assche #define REPORT_LUNS           0xa0
88c5f1ac8bSBart Van Assche #define SECURITY_PROTOCOL_IN  0xa2
89c5f1ac8bSBart Van Assche #define MAINTENANCE_IN        0xa3
90c5f1ac8bSBart Van Assche #define MAINTENANCE_OUT       0xa4
91c5f1ac8bSBart Van Assche #define MOVE_MEDIUM           0xa5
92c5f1ac8bSBart Van Assche #define EXCHANGE_MEDIUM       0xa6
93c5f1ac8bSBart Van Assche #define READ_12               0xa8
94c5f1ac8bSBart Van Assche #define SERVICE_ACTION_OUT_12 0xa9
95c5f1ac8bSBart Van Assche #define WRITE_12              0xaa
96c5f1ac8bSBart Van Assche #define READ_MEDIA_SERIAL_NUMBER 0xab /* Obsolete with SPC-2 */
97c5f1ac8bSBart Van Assche #define SERVICE_ACTION_IN_12  0xab
98c5f1ac8bSBart Van Assche #define WRITE_VERIFY_12       0xae
99c5f1ac8bSBart Van Assche #define VERIFY_12	      0xaf
100c5f1ac8bSBart Van Assche #define SEARCH_HIGH_12        0xb0
101c5f1ac8bSBart Van Assche #define SEARCH_EQUAL_12       0xb1
102c5f1ac8bSBart Van Assche #define SEARCH_LOW_12         0xb2
103c5f1ac8bSBart Van Assche #define SECURITY_PROTOCOL_OUT 0xb5
104c5f1ac8bSBart Van Assche #define READ_ELEMENT_STATUS   0xb8
105c5f1ac8bSBart Van Assche #define SEND_VOLUME_TAG       0xb6
106c5f1ac8bSBart Van Assche #define WRITE_LONG_2          0xea
107c5f1ac8bSBart Van Assche #define EXTENDED_COPY         0x83
108c5f1ac8bSBart Van Assche #define RECEIVE_COPY_RESULTS  0x84
109c5f1ac8bSBart Van Assche #define ACCESS_CONTROL_IN     0x86
110c5f1ac8bSBart Van Assche #define ACCESS_CONTROL_OUT    0x87
111c5f1ac8bSBart Van Assche #define READ_16               0x88
112c5f1ac8bSBart Van Assche #define COMPARE_AND_WRITE     0x89
113c5f1ac8bSBart Van Assche #define WRITE_16              0x8a
114c5f1ac8bSBart Van Assche #define READ_ATTRIBUTE        0x8c
115c5f1ac8bSBart Van Assche #define WRITE_ATTRIBUTE	      0x8d
116c2d26f18SBryant G. Ly #define WRITE_VERIFY_16	      0x8e
117c5f1ac8bSBart Van Assche #define VERIFY_16	      0x8f
118c5f1ac8bSBart Van Assche #define SYNCHRONIZE_CACHE_16  0x91
119c5f1ac8bSBart Van Assche #define WRITE_SAME_16	      0x93
1200008f1e7SHannes Reinecke #define ZBC_OUT		      0x94
1210008f1e7SHannes Reinecke #define ZBC_IN		      0x95
122c5f1ac8bSBart Van Assche #define SERVICE_ACTION_BIDIRECTIONAL 0x9d
123c5f1ac8bSBart Van Assche #define SERVICE_ACTION_IN_16  0x9e
124c5f1ac8bSBart Van Assche #define SERVICE_ACTION_OUT_16 0x9f
125c5f1ac8bSBart Van Assche /* values for service action in */
126c5f1ac8bSBart Van Assche #define	SAI_READ_CAPACITY_16  0x10
127c5f1ac8bSBart Van Assche #define SAI_GET_LBA_STATUS    0x12
128c5f1ac8bSBart Van Assche #define SAI_REPORT_REFERRALS  0x13
129c5f1ac8bSBart Van Assche /* values for maintenance in */
130c5f1ac8bSBart Van Assche #define MI_REPORT_IDENTIFYING_INFORMATION 0x05
131c5f1ac8bSBart Van Assche #define MI_REPORT_TARGET_PGS  0x0a
132c5f1ac8bSBart Van Assche #define MI_REPORT_ALIASES     0x0b
133c5f1ac8bSBart Van Assche #define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c
134c5f1ac8bSBart Van Assche #define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d
135c5f1ac8bSBart Van Assche #define MI_REPORT_PRIORITY    0x0e
136c5f1ac8bSBart Van Assche #define MI_REPORT_TIMESTAMP   0x0f
137c5f1ac8bSBart Van Assche #define MI_MANAGEMENT_PROTOCOL_IN 0x10
138c5f1ac8bSBart Van Assche /* value for MI_REPORT_TARGET_PGS ext header */
139c5f1ac8bSBart Van Assche #define MI_EXT_HDR_PARAM_FMT  0x20
140c5f1ac8bSBart Van Assche /* values for maintenance out */
141c5f1ac8bSBart Van Assche #define MO_SET_IDENTIFYING_INFORMATION 0x06
142c5f1ac8bSBart Van Assche #define MO_SET_TARGET_PGS     0x0a
143c5f1ac8bSBart Van Assche #define MO_CHANGE_ALIASES     0x0b
144c5f1ac8bSBart Van Assche #define MO_SET_PRIORITY       0x0e
145c5f1ac8bSBart Van Assche #define MO_SET_TIMESTAMP      0x0f
146c5f1ac8bSBart Van Assche #define MO_MANAGEMENT_PROTOCOL_OUT 0x10
1470008f1e7SHannes Reinecke /* values for ZBC_IN */
1480008f1e7SHannes Reinecke #define ZI_REPORT_ZONES	      0x00
1490008f1e7SHannes Reinecke /* values for ZBC_OUT */
1500008f1e7SHannes Reinecke #define ZO_CLOSE_ZONE	      0x01
1510008f1e7SHannes Reinecke #define ZO_FINISH_ZONE	      0x02
1520008f1e7SHannes Reinecke #define ZO_OPEN_ZONE	      0x03
1530008f1e7SHannes Reinecke #define ZO_RESET_WRITE_POINTER 0x04
154c5f1ac8bSBart Van Assche /* values for variable length command */
155c5f1ac8bSBart Van Assche #define XDREAD_32	      0x03
156c5f1ac8bSBart Van Assche #define XDWRITE_32	      0x04
157c5f1ac8bSBart Van Assche #define XPWRITE_32	      0x06
158c5f1ac8bSBart Van Assche #define XDWRITEREAD_32	      0x07
159c5f1ac8bSBart Van Assche #define READ_32		      0x09
160c5f1ac8bSBart Van Assche #define VERIFY_32	      0x0a
161c5f1ac8bSBart Van Assche #define WRITE_32	      0x0b
162e5dc9a70SDamien Le Moal #define WRITE_VERIFY_32	      0x0c
163c5f1ac8bSBart Van Assche #define WRITE_SAME_32	      0x0d
164b1ffbf85SMinwoo Im #define ATA_32		      0x1ff0
165c5f1ac8bSBart Van Assche 
166c5f1ac8bSBart Van Assche /* Values for T10/04-262r7 */
167c5f1ac8bSBart Van Assche #define	ATA_16		      0x85	/* 16-byte pass-thru */
168c5f1ac8bSBart Van Assche #define	ATA_12		      0xa1	/* 12-byte pass-thru */
169c5f1ac8bSBart Van Assche 
170c5f1ac8bSBart Van Assche /* Vendor specific CDBs start here */
171c5f1ac8bSBart Van Assche #define VENDOR_SPECIFIC_CDB 0xc0
172c5f1ac8bSBart Van Assche 
173c5f1ac8bSBart Van Assche /*
174c5f1ac8bSBart Van Assche  *	SCSI command lengths
175c5f1ac8bSBart Van Assche  */
176c5f1ac8bSBart Van Assche 
177c5f1ac8bSBart Van Assche #define SCSI_MAX_VARLEN_CDB_SIZE 260
178c5f1ac8bSBart Van Assche 
179c5f1ac8bSBart Van Assche /* defined in T10 SCSI Primary Commands-2 (SPC2) */
180c5f1ac8bSBart Van Assche struct scsi_varlen_cdb_hdr {
181c5f1ac8bSBart Van Assche 	__u8 opcode;        /* opcode always == VARIABLE_LENGTH_CMD */
182c5f1ac8bSBart Van Assche 	__u8 control;
183c5f1ac8bSBart Van Assche 	__u8 misc[5];
184c5f1ac8bSBart Van Assche 	__u8 additional_cdb_length;         /* total cdb length - 8 */
185c5f1ac8bSBart Van Assche 	__be16 service_action;
186c5f1ac8bSBart Van Assche 	/* service specific data follows */
187c5f1ac8bSBart Van Assche };
188c5f1ac8bSBart Van Assche 
189c5f1ac8bSBart Van Assche /*
190c5f1ac8bSBart Van Assche  *  SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
191c5f1ac8bSBart Van Assche  *  T10/1561-D Revision 4 Draft dated 7th November 2002.
192c5f1ac8bSBart Van Assche  */
193c5f1ac8bSBart Van Assche #define SAM_STAT_GOOD            0x00
194c5f1ac8bSBart Van Assche #define SAM_STAT_CHECK_CONDITION 0x02
195c5f1ac8bSBart Van Assche #define SAM_STAT_CONDITION_MET   0x04
196c5f1ac8bSBart Van Assche #define SAM_STAT_BUSY            0x08
197c5f1ac8bSBart Van Assche #define SAM_STAT_INTERMEDIATE    0x10
198c5f1ac8bSBart Van Assche #define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14
199c5f1ac8bSBart Van Assche #define SAM_STAT_RESERVATION_CONFLICT 0x18
200c5f1ac8bSBart Van Assche #define SAM_STAT_COMMAND_TERMINATED 0x22	/* obsolete in SAM-3 */
201c5f1ac8bSBart Van Assche #define SAM_STAT_TASK_SET_FULL   0x28
202c5f1ac8bSBart Van Assche #define SAM_STAT_ACA_ACTIVE      0x30
203c5f1ac8bSBart Van Assche #define SAM_STAT_TASK_ABORTED    0x40
204c5f1ac8bSBart Van Assche 
205c5f1ac8bSBart Van Assche /*
206c5f1ac8bSBart Van Assche  *  Status codes. These are deprecated as they are shifted 1 bit right
207c5f1ac8bSBart Van Assche  *  from those found in the SCSI standards. This causes confusion for
208c5f1ac8bSBart Van Assche  *  applications that are ported to several OSes. Prefer SAM Status codes
209c5f1ac8bSBart Van Assche  *  above.
210c5f1ac8bSBart Van Assche  */
211c5f1ac8bSBart Van Assche 
212c5f1ac8bSBart Van Assche #define GOOD                 0x00
213c5f1ac8bSBart Van Assche #define CHECK_CONDITION      0x01
214c5f1ac8bSBart Van Assche #define CONDITION_GOOD       0x02
215c5f1ac8bSBart Van Assche #define BUSY                 0x04
216c5f1ac8bSBart Van Assche #define INTERMEDIATE_GOOD    0x08
217c5f1ac8bSBart Van Assche #define INTERMEDIATE_C_GOOD  0x0a
218c5f1ac8bSBart Van Assche #define RESERVATION_CONFLICT 0x0c
219c5f1ac8bSBart Van Assche #define COMMAND_TERMINATED   0x11
220c5f1ac8bSBart Van Assche #define QUEUE_FULL           0x14
221c5f1ac8bSBart Van Assche #define ACA_ACTIVE           0x18
222c5f1ac8bSBart Van Assche #define TASK_ABORTED         0x20
223c5f1ac8bSBart Van Assche 
224c5f1ac8bSBart Van Assche #define STATUS_MASK          0xfe
225c5f1ac8bSBart Van Assche 
226c5f1ac8bSBart Van Assche /*
227c5f1ac8bSBart Van Assche  *  SENSE KEYS
228c5f1ac8bSBart Van Assche  */
229c5f1ac8bSBart Van Assche 
230c5f1ac8bSBart Van Assche #define NO_SENSE            0x00
231c5f1ac8bSBart Van Assche #define RECOVERED_ERROR     0x01
232c5f1ac8bSBart Van Assche #define NOT_READY           0x02
233c5f1ac8bSBart Van Assche #define MEDIUM_ERROR        0x03
234c5f1ac8bSBart Van Assche #define HARDWARE_ERROR      0x04
235c5f1ac8bSBart Van Assche #define ILLEGAL_REQUEST     0x05
236c5f1ac8bSBart Van Assche #define UNIT_ATTENTION      0x06
237c5f1ac8bSBart Van Assche #define DATA_PROTECT        0x07
238c5f1ac8bSBart Van Assche #define BLANK_CHECK         0x08
2399c661a49SHannes Reinecke #define VENDOR_SPECIFIC     0x09
240c5f1ac8bSBart Van Assche #define COPY_ABORTED        0x0a
241c5f1ac8bSBart Van Assche #define ABORTED_COMMAND     0x0b
242c5f1ac8bSBart Van Assche #define VOLUME_OVERFLOW     0x0d
243c5f1ac8bSBart Van Assche #define MISCOMPARE          0x0e
244c5f1ac8bSBart Van Assche 
245c5f1ac8bSBart Van Assche 
246c5f1ac8bSBart Van Assche /*
247c5f1ac8bSBart Van Assche  *  DEVICE TYPES
248c5f1ac8bSBart Van Assche  *  Please keep them in 0x%02x format for $MODALIAS to work
249c5f1ac8bSBart Van Assche  */
250c5f1ac8bSBart Van Assche 
251c5f1ac8bSBart Van Assche #define TYPE_DISK           0x00
252c5f1ac8bSBart Van Assche #define TYPE_TAPE           0x01
253c5f1ac8bSBart Van Assche #define TYPE_PRINTER        0x02
254c5f1ac8bSBart Van Assche #define TYPE_PROCESSOR      0x03    /* HP scanners use this */
255c5f1ac8bSBart Van Assche #define TYPE_WORM           0x04    /* Treated as ROM by our system */
256c5f1ac8bSBart Van Assche #define TYPE_ROM            0x05
257c5f1ac8bSBart Van Assche #define TYPE_SCANNER        0x06
258c5f1ac8bSBart Van Assche #define TYPE_MOD            0x07    /* Magneto-optical disk -
259c5f1ac8bSBart Van Assche 				     * - treated as TYPE_DISK */
260c5f1ac8bSBart Van Assche #define TYPE_MEDIUM_CHANGER 0x08
261c5f1ac8bSBart Van Assche #define TYPE_COMM           0x09    /* Communications device */
262c5f1ac8bSBart Van Assche #define TYPE_RAID           0x0c
263c5f1ac8bSBart Van Assche #define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
264c5f1ac8bSBart Van Assche #define TYPE_RBC	    0x0e
265c5f1ac8bSBart Van Assche #define TYPE_OSD            0x11
266c5f1ac8bSBart Van Assche #define TYPE_ZBC            0x14
267c5f1ac8bSBart Van Assche #define TYPE_WLUN           0x1e    /* well-known logical unit */
268c5f1ac8bSBart Van Assche #define TYPE_NO_LUN         0x7f
269c5f1ac8bSBart Van Assche 
270c5f1ac8bSBart Van Assche /* SCSI protocols; these are taken from SPC-3 section 7.5 */
271c5f1ac8bSBart Van Assche enum scsi_protocol {
272c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_FCP = 0,	/* Fibre Channel */
273c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_SPI = 1,	/* parallel SCSI */
274c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_SSA = 2,	/* Serial Storage Architecture - Obsolete */
275c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_SBP = 3,	/* firewire */
276c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_SRP = 4,	/* Infiniband RDMA */
277c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_ISCSI = 5,
278c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_SAS = 6,
279c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_ADT = 7,	/* Media Changers */
280c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_ATA = 8,
281c5f1ac8bSBart Van Assche 	SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
282c5f1ac8bSBart Van Assche };
283c5f1ac8bSBart Van Assche 
284c5f1ac8bSBart Van Assche /*
285c5f1ac8bSBart Van Assche  * ScsiLun: 8 byte LUN.
286c5f1ac8bSBart Van Assche  */
287c5f1ac8bSBart Van Assche struct scsi_lun {
288c5f1ac8bSBart Van Assche 	__u8 scsi_lun[8];
289c5f1ac8bSBart Van Assche };
290c5f1ac8bSBart Van Assche 
29177c9df96SHannes Reinecke /* SPC asymmetric access states */
29277c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_OPTIMAL     0x00
29377c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_ACTIVE      0x01
29477c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_STANDBY     0x02
29577c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_UNAVAILABLE 0x03
29677c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_LBA         0x04
29777c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_OFFLINE     0x0e
29877c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_TRANSITIONING 0x0f
29977c9df96SHannes Reinecke 
30077c9df96SHannes Reinecke /* Values for REPORT TARGET GROUP STATES */
30177c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_MASK        0x0f
30277c9df96SHannes Reinecke #define SCSI_ACCESS_STATE_PREFERRED   0x80
303c5f1ac8bSBart Van Assche 
30489d94756SHannes Reinecke /* Reporting options for REPORT ZONES */
30589d94756SHannes Reinecke enum zbc_zone_reporting_options {
306aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_ALL		= 0x00,
307aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_EMPTY		= 0x01,
308aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN	= 0x02,
309aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN	= 0x03,
310aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_CLOSED	= 0x04,
311aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_FULL		= 0x05,
312aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_READONLY	= 0x06,
313aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_OFFLINE	= 0x07,
314aa8a8456SDamien Le Moal 	/* 0x08 to 0x0f are reserved */
31589d94756SHannes Reinecke 	ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP	= 0x10,
316aa8a8456SDamien Le Moal 	ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE	= 0x11,
317aa8a8456SDamien Le Moal 	/* 0x12 to 0x3e are reserved */
31889d94756SHannes Reinecke 	ZBC_ZONE_REPORTING_OPTION_NON_WP	= 0x3f,
31989d94756SHannes Reinecke };
32089d94756SHannes Reinecke 
32189d94756SHannes Reinecke #define ZBC_REPORT_ZONE_PARTIAL 0x80
32289d94756SHannes Reinecke 
323aa8a8456SDamien Le Moal /* Zone types of REPORT ZONES zone descriptors */
324aa8a8456SDamien Le Moal enum zbc_zone_type {
325aa8a8456SDamien Le Moal 	ZBC_ZONE_TYPE_CONV		= 0x1,
326aa8a8456SDamien Le Moal 	ZBC_ZONE_TYPE_SEQWRITE_REQ	= 0x2,
327aa8a8456SDamien Le Moal 	ZBC_ZONE_TYPE_SEQWRITE_PREF	= 0x3,
328aa8a8456SDamien Le Moal 	/* 0x4 to 0xf are reserved */
329aa8a8456SDamien Le Moal };
330aa8a8456SDamien Le Moal 
331aa8a8456SDamien Le Moal /* Zone conditions of REPORT ZONES zone descriptors */
332aa8a8456SDamien Le Moal enum zbc_zone_cond {
333aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_NO_WP		= 0x0,
334aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_EMPTY		= 0x1,
335aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_IMP_OPEN		= 0x2,
336aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_EXP_OPEN		= 0x3,
337aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_CLOSED		= 0x4,
338aa8a8456SDamien Le Moal 	/* 0x5 to 0xc are reserved */
339aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_READONLY		= 0xd,
340aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_FULL		= 0xe,
341aa8a8456SDamien Le Moal 	ZBC_ZONE_COND_OFFLINE		= 0xf,
342aa8a8456SDamien Le Moal };
343aa8a8456SDamien Le Moal 
344*b790a56dSKonstantin Shelekhin /* Version descriptor values for INQUIRY */
345*b790a56dSKonstantin Shelekhin enum scsi_version_descriptor {
346*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_FCP4	= 0x0a40,
347*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_ISCSI	= 0x0960,
348*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_SAM5	= 0x00a0,
349*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_SAS3	= 0x0c60,
350*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_SBC3	= 0x04c0,
351*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_SBP3	= 0x0980,
352*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_SPC4	= 0x0460,
353*b790a56dSKonstantin Shelekhin 	SCSI_VERSION_DESCRIPTOR_SRP	= 0x0940
354*b790a56dSKonstantin Shelekhin };
355*b790a56dSKonstantin Shelekhin 
356c5f1ac8bSBart Van Assche #endif /* _SCSI_PROTO_H_ */
357