xref: /titanic_44/usr/src/uts/common/sys/scsi/generic/commands.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_SCSI_GENERIC_COMMANDS_H
28 #define	_SYS_SCSI_GENERIC_COMMANDS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Standard SCSI Command Definitions
38  *
39  * Macros to determine known command sizes
40  */
41 
42 #define	CDB_GROUPID(cmd)	((cmd >> 5) & 0x7)
43 #define	CDB_GROUPID_0	0
44 #define	CDB_GROUPID_1	1
45 #define	CDB_GROUPID_2	2
46 #define	CDB_GROUPID_3	3
47 #define	CDB_GROUPID_4	4
48 #define	CDB_GROUPID_5	5
49 #define	CDB_GROUPID_6	6
50 #define	CDB_GROUPID_7	7
51 
52 #define	CDB_GROUP0	6	/*  6-byte cdb's */
53 #define	CDB_GROUP1	10	/* 10-byte cdb's */
54 #define	CDB_GROUP2	10	/* 10-byte cdb's */
55 #define	CDB_GROUP3	0	/* reserved */
56 #define	CDB_GROUP4	16	/* 16-byte cdb's */
57 #define	CDB_GROUP5	12	/* 12-byte cdb's */
58 #define	CDB_GROUP6	0	/* reserved */
59 #define	CDB_GROUP7	0	/* reserved */
60 
61 /*
62  * Generic Command Definitions
63  */
64 
65 /*
66  * Group 0 Commands (CDB range 0x00 - 0x1F)
67  */
68 
69 #define	SCMD_GROUP0		0x00
70 
71 /*
72  * Group 0 commands, All Devices
73  */
74 
75 #define	SCMD_TEST_UNIT_READY	0x00
76 #define	SCMD_REQUEST_SENSE	0x03
77 #define	SCMD_INQUIRY		0x12
78 #define	SCMD_COPY		0x18
79 #define	SCMD_GDIAG		0x1C	/* receive diagnostic results */
80 #define	SCMD_SDIAG		0x1D	/* send diagnostic results */
81 
82 /*
83  * Group 0 commands, Direct Access Devices
84  */
85 
86 /*	SCMD_TEST_UNIT_READY	0x00	*/
87 #define	SCMD_REZERO_UNIT	0x01
88 /*	SCMD_REQUEST_SENSE	0x03	*/
89 #define	SCMD_FORMAT		0x04
90 #define	SCMD_REASSIGN_BLOCK	0x07
91 #define	SCMD_READ		0x08
92 #define	SCMD_WRITE		0x0a
93 #define	SCMD_SEEK		0x0b
94 /*	SCMD_INQUIRY		0x12	*/
95 #define	SCMD_MODE_SELECT	0x15
96 #define	SCMD_RESERVE		0x16
97 #define	SCMD_RELEASE		0x17
98 /*	SCMD_COPY		0x18	*/
99 #define	SCMD_MODE_SENSE		0x1a
100 #define	SCMD_START_STOP		0x1b
101 /*	SCMD_GDIAG		0x1C	*/
102 /*	SCMD_SDIAG		0x1D	*/
103 #define	SCMD_DOORLOCK		0x1E	/* Prevent/Allow Medium Removal */
104 
105 /*
106  * Group 0 commands, Sequential Access Devices
107  */
108 
109 /*	SCMD_TEST_UNIT_READY	0x00	*/
110 #define	SCMD_REWIND		0x01	/* Note similarity to SCMD_REZERO */
111 /*	SCMD_REQUEST_SENSE	0x03	*/
112 #define	SCMD_READ_BLKLIM	0x05
113 /*	SCMD_READ		0x08	*/
114 /*	SCMD_WRITE		0x0a	*/
115 #define	SCMD_TRK_SEL		0x0b	/* Note similarity to SCMD_SEEK */
116 #define	SCMD_READ_REVERSE	0x0f
117 #define	SCMD_WRITE_FILE_MARK	0x10
118 #define	SCMD_SPACE		0x11
119 /*	SCMD_INQUIRY		0x12	*/
120 #define	SCMD_VERIFY_G0		0x13
121 #define	SCMD_RECOVER_BUF	0x14
122 /*	SCMD_MODE_SELECT	0x15	*/
123 /*	SCMD_RESERVE		0x16	*/
124 /*	SCMD_RELEASE		0x17	*/
125 /*	SCMD_COPY		0x18	*/
126 #define	SCMD_ERASE		0x19
127 /*	SCMD_MODE_SENSE		0x1a	*/
128 #define	SCMD_LOAD		0x1b	/* Note similarity to SCMD_START_STOP */
129 /*	SCMD_GDIAG		0x1c	*/
130 /*	SCMD_SDIAG		0x1d	*/
131 /*	SCMD_DOORLOCK		0x1e	*/
132 
133 
134 /*
135  * Group 0 commands, Printer Devices
136  */
137 
138 /*	SCMD_TEST_UNIT_READY	0x00	*/
139 /*	SCMD_REQUEST_SENSE	0x03	*/
140 /*	SCMD_FORMAT		0x04	*/
141 #define	SCMD_PRINT		0x0a	/* Note similarity to SCMD_WRITE */
142 #define	SCMD_SLEW_PRINT		0x0b	/* ? similar to SCMD_SEEK ? */
143 #define	SCMD_FLUSH_PRINT_BUF	0x10	/* ? similar to SCMD_WRITE_FILE_MARK */
144 /*	SCMD_INQUIRY		0x12	*/
145 /*	SCMD_RECOVER_BUF	0x14	*/
146 /*	SCMD_MODE_SELECT	0x15	*/
147 /*	SCMD_RESERVE		0x16	*/
148 /*	SCMD_RELEASE		0x17	*/
149 /*	SCMD_COPY		0x18	*/
150 /*	SCMD_MODE_SENSE		0x1a	*/
151 #define	SCMD_STOP_PRINT		0x1b	/* Note similarity to SCMD_START_STOP */
152 /*	SCMD_GDIAG		0x1c	*/
153 /*	SCMD_SDIAG		0x1d	*/
154 
155 /*
156  * Group 0 commands, Processor Devices
157  */
158 /*	SCMD_TEST_UNIT_READY	0x00	*/
159 /*	SCMD_REQUEST_SENSE	0x03	*/
160 #define	SCMD_RECEIVE		0x08	/* Note similarity to SCMD_READ */
161 #define	SCMD_SEND		0x0a	/* Note similarity to SCMD_WRITE */
162 /*	SCMD_INQUIRY		0x12	*/
163 /*	SCMD_COPY		0x18	*/
164 /*	SCMD_MODE_SENSE		0x1a	*/
165 /*	SCMD_GDIAG		0x1c	*/
166 /*	SCMD_SDIAG		0x1d	*/
167 
168 /*
169  * Group 0 commands, WORM Devices
170  */
171 
172 /*	SCMD_TEST_UNIT_READY	0x00	*/
173 /*	SCMD_REZERO_UNIT	0x01	*/
174 /*	SCMD_REQUEST_SENSE	0x03	*/
175 /*	SCMD_REASSIGN_BLOCK	0x07	*/
176 /*	SCMD_READ		0x08	*/
177 /*	SCMD_WRITE		0x0a	*/
178 /*	SCMD_SEEK		0x0b	*/
179 /*	SCMD_INQUIRY		0x12	*/
180 /*	SCMD_MODE_SELECT	0x15	*/
181 /*	SCMD_RESERVE		0x16	*/
182 /*	SCMD_RELEASE		0x17	*/
183 /*	SCMD_COPY		0x18	*/
184 /*	SCMD_MODE_SENSE		0x1a	*/
185 /*	SCMD_START_STOP		0x1b	*/
186 /*	SCMD_GDIAG		0x1C	*/
187 /*	SCMD_SDIAG		0x1D	*/
188 /*	SCMD_DOORLOCK		0x1E	*/
189 
190 /*
191  * Group 0 commands, Read Only Devices
192  */
193 
194 /*	SCMD_TEST_UNIT_READY	0x00	*/
195 /*	SCMD_REZERO_UNIT	0x01	*/
196 /*	SCMD_REQUEST_SENSE	0x03	*/
197 /*	SCMD_REASSIGN_BLOCK	0x07	*/
198 /*	SCMD_READ		0x08	*/
199 /*	SCMD_SEEK		0x0b	*/
200 /*	SCMD_INQUIRY		0x12	*/
201 /*	SCMD_MODE_SELECT	0x15	*/
202 /*	SCMD_RESERVE		0x16	*/
203 /*	SCMD_RELEASE		0x17	*/
204 /*	SCMD_COPY		0x18	*/
205 /*	SCMD_MODE_SENSE		0x1a	*/
206 /*	SCMD_START_STOP		0x1b	*/
207 /*	SCMD_GDIAG		0x1C	*/
208 /*	SCMD_SDIAG		0x1D	*/
209 /*	SCMD_DOORLOCK		0x1E	*/
210 
211 /*
212  * Group 1 Commands (CDB range 0x20 - 0x3F)
213  */
214 
215 #define	SCMD_GROUP1		0x20
216 
217 /*
218  * Group 1 Commands, All Devices
219  */
220 
221 #define	SCMD_COMPARE		0x39
222 #define	SCMD_COPY_VERIFY	0x3A
223 #define	SCMD_PRIN		0x5E
224 #define	SCMD_PROUT		0x5F
225 
226 /*
227  * Group 1 Commands, Direct Access Devices
228  */
229 
230 #define	SCMD_READ_FORMAT_CAP	0x23
231 #define	SCMD_READ_CAPACITY	0x25
232 #define	SCMD_READ_G1		0x28	/* Note that only the group changed */
233 #define	SCMD_WRITE_G1		0x2a	/* Note that only the group changed */
234 #define	SCMD_SEEK_G1		0x2b	/* Note that only the group changed */
235 #define	SCMD_WRITE_VERIFY	0x2e
236 #define	SCMD_VERIFY		0x2f
237 #define	SCMD_SEARCH_HIGH	0x30
238 #define	SCMD_SEARCH_EQUAL	0x31
239 #define	SCMD_SEARCH_LOW		0x32
240 #define	SCMD_SET_LIMITS		0x33
241 #define	SCMD_READ_DEFECT_LIST	0x37
242 #define	SCMD_WRITE_BUFFER	0x3B
243 #define	SCMD_READ_BUFFER	0x3c
244 #define	SCMD_READ_LONG		0x3E
245 #define	SCMD_WRITE_LONG		0x3F
246 #define	SCMD_RESERVE_G1		0x56
247 #define	SCMD_RELEASE_G1		0x57
248 #define	SCMD_MODE_SELECT_G1	0x55
249 #define	SCMD_MODE_SENSE_G1	0x5A
250 #define	SCMD_GET_CONFIGURATION	0x46
251 #define	SCMD_LOG_SELECT_G1	0x4C
252 #define	SCMD_LOG_SENSE_G1	0x4d
253 
254 
255 /*
256  * The following have been included for the ATAPI devices
257  */
258 #define	ATAPI_SET_CD_SPEED	0xBB
259 #define	ATAPI_CAPABILITIES	0x2A
260 
261 /*
262  * Group 1 Commands, Sequential Access Devices
263  */
264 
265 #define	SCMD_LOCATE		0x2B	/* Note similarity to SCMD_SEEK_G1 */
266 #define	SCMD_READ_POSITION	0x34
267 #define	SCMD_REPORT_DENSITIES	0x44
268 
269 
270 /*
271  * Group 1 Commands, Printer Devices
272  */
273 
274 /* (None Defined) */
275 
276 /*
277  * Group 1 Commands, Processor Devices
278  */
279 
280 /* (None Defined) */
281 
282 /*
283  * Group 1 Commands, WORM Devices
284  */
285 
286 /*	SCMD_READ_CAPACITY	0x25	*/
287 /*	SCMD_READ_G1		0x28	*/
288 /*	SCMD_WRITE_G1		0x2a	*/
289 /*	SCMD_SEEK_G1		0x2b	*/
290 /*	SCMD_WRITE_VERIFY	0x2e	*/
291 /*	SCMD_VERIFY		0x2f	*/
292 /*	SCMD_SEARCH_HIGH	0x30	*/
293 /*	SCMD_SEARCH_EQUAL	0x31	*/
294 /*	SCMD_SEARCH_LOW		0x32	*/
295 /*	SCMD_SET_LIMITS		0x33	*/
296 
297 /*
298  * Group 1 Commands, Read Only Devices
299  */
300 
301 /*	SCMD_READ_CAPACITY	0x25	*/
302 /*	SCMD_READ_G1		0x28	*/
303 /*	SCMD_SEEK_G1		0x2b	*/
304 /*	SCMD_VERIFY		0x2f	*/
305 /*	SCMD_SEARCH_HIGH	0x30	*/
306 /*	SCMD_SEARCH_EQUAL	0x31	*/
307 /*	SCMD_SEARCH_LOW		0x32	*/
308 /*	SCMD_SET_LIMITS		0x33	*/
309 
310 /*
311  * Group 4 Commands, All Devices
312  */
313 #define	SCMD_GROUP4		0x80
314 #define	SCMD_EXTENDED_COPY	0x83
315 
316 /*
317  * Group 4 Commands, Direct Access Devices
318  */
319 #define	SCMD_READ_G4		0x88
320 #define	SCMD_WRITE_G4		0x8a
321 #define	SCMD_SVC_ACTION_IN_G4	0x9e
322 #define	SCMD_SVC_ACTION_OUT_G4	0x9f
323 
324 /*
325  * Group 4 Service Actions for Service Action In (16)
326  */
327 #define	SSVC_ACTION_READ_CAPACITY_G4	0x10
328 #define	SSVC_ACTION_READ_LONG_G4	0x11
329 
330 /*
331  * Group 4 Service Actions for Service Action Out (16)
332  */
333 #define	SSVC_ACTION_WRITE_LONG_G4	0x11
334 
335 /*
336  * Define for Group 5 command.
337  */
338 #define	SCMD_GROUP5		0xA0
339 #define	SCMD_READ_G5		0xA8
340 #define	SCMD_WRITE_G5		0xAA
341 #define	SCMD_GET_PERFORMANCE	0xAC
342 #define	SCMD_REPORT_LUNS	0xA0
343 
344 
345 #ifdef	__cplusplus
346 }
347 #endif
348 
349 
350 /*
351  * Below are inclusions of files describing various command structures
352  * of interest.
353  */
354 
355 #include <sys/scsi/generic/inquiry.h>
356 #include <sys/scsi/generic/sense.h>
357 
358 /*
359  * Private Vendor Unique Commands - Each implementation provides this.
360  */
361 
362 #include <sys/scsi/impl/commands.h>
363 
364 #endif	/* _SYS_SCSI_GENERIC_COMMANDS_H */
365