xref: /onnv-gate/usr/src/uts/common/sys/scsi/generic/commands.h (revision 12278:6d20da30d725)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52314Smcneal  * Common Development and Distribution License (the "License").
62314Smcneal  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
212314Smcneal 
220Sstevel@tonic-gate /*
23*12278SCharles.Binford@Sun.COM  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_COMMANDS_H
270Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_COMMANDS_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  * Standard SCSI Command Definitions
350Sstevel@tonic-gate  *
360Sstevel@tonic-gate  * Macros to determine known command sizes
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate #define	CDB_GROUPID(cmd)	((cmd >> 5) & 0x7)
390Sstevel@tonic-gate #define	CDB_GROUPID_0	0
400Sstevel@tonic-gate #define	CDB_GROUPID_1	1
410Sstevel@tonic-gate #define	CDB_GROUPID_2	2
420Sstevel@tonic-gate #define	CDB_GROUPID_3	3
430Sstevel@tonic-gate #define	CDB_GROUPID_4	4
440Sstevel@tonic-gate #define	CDB_GROUPID_5	5
450Sstevel@tonic-gate #define	CDB_GROUPID_6	6
460Sstevel@tonic-gate #define	CDB_GROUPID_7	7
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #define	CDB_GROUP0	6	/*  6-byte cdb's */
490Sstevel@tonic-gate #define	CDB_GROUP1	10	/* 10-byte cdb's */
500Sstevel@tonic-gate #define	CDB_GROUP2	10	/* 10-byte cdb's */
510Sstevel@tonic-gate #define	CDB_GROUP3	0	/* reserved */
520Sstevel@tonic-gate #define	CDB_GROUP4	16	/* 16-byte cdb's */
530Sstevel@tonic-gate #define	CDB_GROUP5	12	/* 12-byte cdb's */
540Sstevel@tonic-gate #define	CDB_GROUP6	0	/* reserved */
550Sstevel@tonic-gate #define	CDB_GROUP7	0	/* reserved */
560Sstevel@tonic-gate 
570Sstevel@tonic-gate /*
580Sstevel@tonic-gate  * Generic Command Definitions
59173Scth  * NOTE: CDROM commands are defined in cdio.h
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate 
620Sstevel@tonic-gate /*
630Sstevel@tonic-gate  * Group 0 Commands (CDB range 0x00 - 0x1F)
640Sstevel@tonic-gate  */
650Sstevel@tonic-gate #define	SCMD_GROUP0		0x00
660Sstevel@tonic-gate 
670Sstevel@tonic-gate /*
680Sstevel@tonic-gate  * Group 0 commands, All Devices
690Sstevel@tonic-gate  */
700Sstevel@tonic-gate #define	SCMD_TEST_UNIT_READY	0x00
710Sstevel@tonic-gate #define	SCMD_REQUEST_SENSE	0x03
720Sstevel@tonic-gate #define	SCMD_INQUIRY		0x12
730Sstevel@tonic-gate #define	SCMD_COPY		0x18
740Sstevel@tonic-gate #define	SCMD_GDIAG		0x1C	/* receive diagnostic results */
750Sstevel@tonic-gate #define	SCMD_SDIAG		0x1D	/* send diagnostic results */
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /*
780Sstevel@tonic-gate  * Group 0 commands, Direct Access Devices
790Sstevel@tonic-gate  */
800Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
810Sstevel@tonic-gate #define	SCMD_REZERO_UNIT	0x01
820Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
830Sstevel@tonic-gate #define	SCMD_FORMAT		0x04
840Sstevel@tonic-gate #define	SCMD_REASSIGN_BLOCK	0x07
850Sstevel@tonic-gate #define	SCMD_READ		0x08
860Sstevel@tonic-gate #define	SCMD_WRITE		0x0a
870Sstevel@tonic-gate #define	SCMD_SEEK		0x0b
880Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
890Sstevel@tonic-gate #define	SCMD_MODE_SELECT	0x15
900Sstevel@tonic-gate #define	SCMD_RESERVE		0x16
910Sstevel@tonic-gate #define	SCMD_RELEASE		0x17
920Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
930Sstevel@tonic-gate #define	SCMD_MODE_SENSE		0x1a
940Sstevel@tonic-gate #define	SCMD_START_STOP		0x1b
950Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
960Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
970Sstevel@tonic-gate #define	SCMD_DOORLOCK		0x1E	/* Prevent/Allow Medium Removal */
980Sstevel@tonic-gate 
990Sstevel@tonic-gate /*
1000Sstevel@tonic-gate  * Group 0 commands, Sequential Access Devices
1010Sstevel@tonic-gate  */
1020Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1030Sstevel@tonic-gate #define	SCMD_REWIND		0x01	/* Note similarity to SCMD_REZERO */
1040Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1050Sstevel@tonic-gate #define	SCMD_READ_BLKLIM	0x05
1060Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1070Sstevel@tonic-gate /*	SCMD_WRITE		0x0a	*/
1080Sstevel@tonic-gate #define	SCMD_TRK_SEL		0x0b	/* Note similarity to SCMD_SEEK */
1090Sstevel@tonic-gate #define	SCMD_READ_REVERSE	0x0f
1100Sstevel@tonic-gate #define	SCMD_WRITE_FILE_MARK	0x10
1110Sstevel@tonic-gate #define	SCMD_SPACE		0x11
1120Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1130Sstevel@tonic-gate #define	SCMD_VERIFY_G0		0x13
1140Sstevel@tonic-gate #define	SCMD_RECOVER_BUF	0x14
1150Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1160Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1170Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1180Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1190Sstevel@tonic-gate #define	SCMD_ERASE		0x19
1200Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1210Sstevel@tonic-gate #define	SCMD_LOAD		0x1b	/* Note similarity to SCMD_START_STOP */
1220Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1230Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1240Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1e	*/
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate /*
1280Sstevel@tonic-gate  * Group 0 commands, Printer Devices
1290Sstevel@tonic-gate  */
1300Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1310Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1320Sstevel@tonic-gate /*	SCMD_FORMAT		0x04	*/
1330Sstevel@tonic-gate #define	SCMD_PRINT		0x0a	/* Note similarity to SCMD_WRITE */
1340Sstevel@tonic-gate #define	SCMD_SLEW_PRINT		0x0b	/* ? similar to SCMD_SEEK ? */
1350Sstevel@tonic-gate #define	SCMD_FLUSH_PRINT_BUF	0x10	/* ? similar to SCMD_WRITE_FILE_MARK */
1360Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1370Sstevel@tonic-gate /*	SCMD_RECOVER_BUF	0x14	*/
1380Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1390Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1400Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1410Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1420Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1430Sstevel@tonic-gate #define	SCMD_STOP_PRINT		0x1b	/* Note similarity to SCMD_START_STOP */
1440Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1450Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate /*
1480Sstevel@tonic-gate  * Group 0 commands, Processor Devices
1490Sstevel@tonic-gate  */
1500Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1510Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1520Sstevel@tonic-gate #define	SCMD_RECEIVE		0x08	/* Note similarity to SCMD_READ */
1530Sstevel@tonic-gate #define	SCMD_SEND		0x0a	/* Note similarity to SCMD_WRITE */
1540Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1550Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1560Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1570Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1580Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate /*
1610Sstevel@tonic-gate  * Group 0 commands, WORM Devices
1620Sstevel@tonic-gate  */
1630Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1640Sstevel@tonic-gate /*	SCMD_REZERO_UNIT	0x01	*/
1650Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1660Sstevel@tonic-gate /*	SCMD_REASSIGN_BLOCK	0x07	*/
1670Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1680Sstevel@tonic-gate /*	SCMD_WRITE		0x0a	*/
1690Sstevel@tonic-gate /*	SCMD_SEEK		0x0b	*/
1700Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1710Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1720Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1730Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1740Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1750Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1760Sstevel@tonic-gate /*	SCMD_START_STOP		0x1b	*/
1770Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
1780Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
1790Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1E	*/
1800Sstevel@tonic-gate 
1810Sstevel@tonic-gate /*
1820Sstevel@tonic-gate  * Group 0 commands, Read Only Devices
1830Sstevel@tonic-gate  */
1840Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1850Sstevel@tonic-gate /*	SCMD_REZERO_UNIT	0x01	*/
1860Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1870Sstevel@tonic-gate /*	SCMD_REASSIGN_BLOCK	0x07	*/
1880Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1890Sstevel@tonic-gate /*	SCMD_SEEK		0x0b	*/
1900Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1910Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1920Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1930Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1940Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1950Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1960Sstevel@tonic-gate /*	SCMD_START_STOP		0x1b	*/
1970Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
1980Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
1990Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1E	*/
2000Sstevel@tonic-gate 
2010Sstevel@tonic-gate /*
2020Sstevel@tonic-gate  * Group 1 Commands (CDB range 0x20 - 0x3F)
2030Sstevel@tonic-gate  */
2040Sstevel@tonic-gate #define	SCMD_GROUP1		0x20
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate /*
2070Sstevel@tonic-gate  * Group 1 Commands, All Devices
2080Sstevel@tonic-gate  */
2090Sstevel@tonic-gate #define	SCMD_COMPARE		0x39
2100Sstevel@tonic-gate #define	SCMD_COPY_VERIFY	0x3A
211173Scth #define	SCMD_PERSISTENT_RESERVE_IN		0x5E
212173Scth #define	SCMD_PERSISTENT_RESERVE_OUT		0x5F
213173Scth #define	SCMD_PRIN		SCMD_PERSISTENT_RESERVE_IN
214173Scth #define	SCMD_PROUT		SCMD_PERSISTENT_RESERVE_OUT
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate /*
2170Sstevel@tonic-gate  * Group 1 Commands, Direct Access Devices
2180Sstevel@tonic-gate  */
2190Sstevel@tonic-gate #define	SCMD_READ_FORMAT_CAP	0x23
2200Sstevel@tonic-gate #define	SCMD_READ_CAPACITY	0x25
2210Sstevel@tonic-gate #define	SCMD_READ_G1		0x28	/* Note that only the group changed */
2220Sstevel@tonic-gate #define	SCMD_WRITE_G1		0x2a	/* Note that only the group changed */
2230Sstevel@tonic-gate #define	SCMD_SEEK_G1		0x2b	/* Note that only the group changed */
2240Sstevel@tonic-gate #define	SCMD_WRITE_VERIFY	0x2e
2250Sstevel@tonic-gate #define	SCMD_VERIFY		0x2f
2260Sstevel@tonic-gate #define	SCMD_SEARCH_HIGH	0x30
2270Sstevel@tonic-gate #define	SCMD_SEARCH_EQUAL	0x31
2280Sstevel@tonic-gate #define	SCMD_SEARCH_LOW		0x32
2290Sstevel@tonic-gate #define	SCMD_SET_LIMITS		0x33
230173Scth #define	SCMD_SYNCHRONIZE_CACHE	0x35
2310Sstevel@tonic-gate #define	SCMD_READ_DEFECT_LIST	0x37
2320Sstevel@tonic-gate #define	SCMD_WRITE_BUFFER	0x3B
2330Sstevel@tonic-gate #define	SCMD_READ_BUFFER	0x3c
2340Sstevel@tonic-gate #define	SCMD_READ_LONG		0x3E
2350Sstevel@tonic-gate #define	SCMD_WRITE_LONG		0x3F
2360Sstevel@tonic-gate #define	SCMD_RESERVE_G1		0x56
2370Sstevel@tonic-gate #define	SCMD_RELEASE_G1		0x57
2380Sstevel@tonic-gate #define	SCMD_MODE_SELECT_G1	0x55
2390Sstevel@tonic-gate #define	SCMD_MODE_SENSE_G1	0x5A
2400Sstevel@tonic-gate #define	SCMD_GET_CONFIGURATION	0x46
2410Sstevel@tonic-gate #define	SCMD_LOG_SELECT_G1	0x4C
2420Sstevel@tonic-gate #define	SCMD_LOG_SENSE_G1	0x4d
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate 
2450Sstevel@tonic-gate /*
2460Sstevel@tonic-gate  * Group 1 Commands, Sequential Access Devices
2470Sstevel@tonic-gate  */
2480Sstevel@tonic-gate #define	SCMD_LOCATE		0x2B	/* Note similarity to SCMD_SEEK_G1 */
2490Sstevel@tonic-gate #define	SCMD_READ_POSITION	0x34
2500Sstevel@tonic-gate #define	SCMD_REPORT_DENSITIES	0x44
2510Sstevel@tonic-gate 
2520Sstevel@tonic-gate /*
2530Sstevel@tonic-gate  * Group 1 Commands, Printer Devices
2540Sstevel@tonic-gate  */
2550Sstevel@tonic-gate /* (None Defined) */
2560Sstevel@tonic-gate 
2570Sstevel@tonic-gate /*
2580Sstevel@tonic-gate  * Group 1 Commands, Processor Devices
2590Sstevel@tonic-gate  */
2600Sstevel@tonic-gate /* (None Defined) */
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate /*
2630Sstevel@tonic-gate  * Group 1 Commands, WORM Devices
2640Sstevel@tonic-gate  */
2650Sstevel@tonic-gate /*	SCMD_READ_CAPACITY	0x25	*/
2660Sstevel@tonic-gate /*	SCMD_READ_G1		0x28	*/
2670Sstevel@tonic-gate /*	SCMD_WRITE_G1		0x2a	*/
2680Sstevel@tonic-gate /*	SCMD_SEEK_G1		0x2b	*/
2690Sstevel@tonic-gate /*	SCMD_WRITE_VERIFY	0x2e	*/
2700Sstevel@tonic-gate /*	SCMD_VERIFY		0x2f	*/
2710Sstevel@tonic-gate /*	SCMD_SEARCH_HIGH	0x30	*/
2720Sstevel@tonic-gate /*	SCMD_SEARCH_EQUAL	0x31	*/
2730Sstevel@tonic-gate /*	SCMD_SEARCH_LOW		0x32	*/
2740Sstevel@tonic-gate /*	SCMD_SET_LIMITS		0x33	*/
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate /*
2770Sstevel@tonic-gate  * Group 1 Commands, Read Only Devices
2780Sstevel@tonic-gate  */
2790Sstevel@tonic-gate /*	SCMD_READ_CAPACITY	0x25	*/
2800Sstevel@tonic-gate /*	SCMD_READ_G1		0x28	*/
2810Sstevel@tonic-gate /*	SCMD_SEEK_G1		0x2b	*/
2820Sstevel@tonic-gate /*	SCMD_VERIFY		0x2f	*/
2830Sstevel@tonic-gate /*	SCMD_SEARCH_HIGH	0x30	*/
2840Sstevel@tonic-gate /*	SCMD_SEARCH_EQUAL	0x31	*/
2850Sstevel@tonic-gate /*	SCMD_SEARCH_LOW		0x32	*/
2860Sstevel@tonic-gate /*	SCMD_SET_LIMITS		0x33	*/
2870Sstevel@tonic-gate 
2880Sstevel@tonic-gate /*
28910459SArtem.Kachitchkin@Sun.COM  * Group 1 Commands, MMC Devices
29010459SArtem.Kachitchkin@Sun.COM  */
29110459SArtem.Kachitchkin@Sun.COM 
29210459SArtem.Kachitchkin@Sun.COM /* GET EVENT STATUS NOTIFICATION, MMC-3 5.6 */
29310459SArtem.Kachitchkin@Sun.COM #define	SCMD_GET_EVENT_STATUS_NOTIFICATION	0x4a
29410459SArtem.Kachitchkin@Sun.COM 
29510459SArtem.Kachitchkin@Sun.COM /* event header */
29610459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_HEADER_LEN			4
29710459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_HEADER_NEA			0x80	/* byte 2 */
29810459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_HEADER_CLASS			0x07	/* byte 2 */
29910459SArtem.Kachitchkin@Sun.COM 
30010459SArtem.Kachitchkin@Sun.COM /* media class event class and event data that follows the header */
30110459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_CLASS			4
30210459SArtem.Kachitchkin@Sun.COM 
30310459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_DATA_LEN			4
30410459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_CODE		0x0f	/* byte 0 */
30510459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_STATUS_PRESENT	0x02	/* byte 1 */
30610459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_STATUS_TRAY_OPEN	0x01	/* byte 1 */
30710459SArtem.Kachitchkin@Sun.COM 
30810459SArtem.Kachitchkin@Sun.COM /* media event code */
30910459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_NOCHG		0
31010459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_EJECTREQUEST	1
31110459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_NEWMEDIA		2
31210459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_MEDIAREMOVAL	3
31310459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_MEDIACHANGED	4
31410459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_BGFORMATCOMPLETED	5
31510459SArtem.Kachitchkin@Sun.COM #define	SD_GESN_MEDIA_EVENT_BGFORMATRESTARTED	6
31610459SArtem.Kachitchkin@Sun.COM 
31710459SArtem.Kachitchkin@Sun.COM 
31810459SArtem.Kachitchkin@Sun.COM /*
319447Staylor  * Group 3 Commands
320447Staylor  */
321447Staylor #define	SCMD_VAR_LEN		0x7f
322447Staylor 
323447Staylor /*
3240Sstevel@tonic-gate  * Group 4 Commands, All Devices
3250Sstevel@tonic-gate  */
3260Sstevel@tonic-gate #define	SCMD_GROUP4		0x80
3270Sstevel@tonic-gate #define	SCMD_EXTENDED_COPY	0x83
3282684Smcneal #define	SCMD_VERIFY_G4		0x8f
3290Sstevel@tonic-gate 
3300Sstevel@tonic-gate /*
3310Sstevel@tonic-gate  * Group 4 Commands, Direct Access Devices
3320Sstevel@tonic-gate  */
3330Sstevel@tonic-gate #define	SCMD_READ_G4		0x88
3340Sstevel@tonic-gate #define	SCMD_WRITE_G4		0x8a
335*12278SCharles.Binford@Sun.COM #define	SCMD_WRITE_VERIFY_G4	0x8e
3360Sstevel@tonic-gate #define	SCMD_SVC_ACTION_IN_G4	0x9e
3370Sstevel@tonic-gate #define	SCMD_SVC_ACTION_OUT_G4	0x9f
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate /*
3400Sstevel@tonic-gate  * Group 4 Service Actions for Service Action In (16)
3410Sstevel@tonic-gate  */
3420Sstevel@tonic-gate #define	SSVC_ACTION_READ_CAPACITY_G4	0x10
3430Sstevel@tonic-gate #define	SSVC_ACTION_READ_LONG_G4	0x11
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate /*
3460Sstevel@tonic-gate  * Group 4 Service Actions for Service Action Out (16)
3470Sstevel@tonic-gate  */
3480Sstevel@tonic-gate #define	SSVC_ACTION_WRITE_LONG_G4	0x11
3490Sstevel@tonic-gate 
3500Sstevel@tonic-gate /*
3512537Srralphs  * Group 4 Commands, Sequential Access Devics
3522537Srralphs  */
3535628Srralphs #define	SCMD_WRITE_FILE_MARK_G4	0x80
3545628Srralphs #define	SCMD_READ_REVERSE_G4	0x81
3552537Srralphs #define	SCMD_READ_ATTRIBUTE	0x8c
3562537Srralphs #define	SCMD_WRITE_ATTRIBUTE	0x8d
3575628Srralphs #define	SCMD_SPACE_G4		0x91
3584549Srralphs #define	SCMD_LOCATE_G4		0x92
3592537Srralphs 
3602537Srralphs /*
3616941Srralphs  * Group 5 commands.
3620Sstevel@tonic-gate  */
3630Sstevel@tonic-gate #define	SCMD_GROUP5		0xA0
364173Scth #define	SCMD_REPORT_LUNS	0xA0
3655628Srralphs #define	SCMD_SECURITY_PROTO_IN	0xA2
3665628Srralphs #define	SCMD_MAINTENANCE_IN	0xA3
3675628Srralphs #define	SCMD_MAINTENANCE_OUT	0xA4
3680Sstevel@tonic-gate #define	SCMD_READ_G5		0xA8
3690Sstevel@tonic-gate #define	SCMD_WRITE_G5		0xAA
3705628Srralphs #define	SCMD_SVC_ACTION_OUT_G5	0xA9
3715628Srralphs #define	SCMD_SVC_ACTION_IN_G5	0xAB
3720Sstevel@tonic-gate #define	SCMD_GET_PERFORMANCE	0xAC
373*12278SCharles.Binford@Sun.COM #define	SCMD_WRITE_VERIFY_G5	0xAE
3742684Smcneal #define	SCMD_VERIFY_G5		0xAF
3755628Srralphs #define	SCMD_SECURITY_PROTO_OUT	0xB5
376173Scth 
3776941Srralphs /*
3786941Srralphs  * Group 5 Service Actions for Maintenance In (12)
3796941Srralphs  */
3806941Srralphs #define	SSVC_ACTION_GET_TARGET_PORT_GROUPS	0x0a
3816941Srralphs #define	SSVC_ACTION_GET_SUPPORTED_OPERATIONS	0x0c
3826941Srralphs #define	SSVC_SCTION_GET_SUPPORTED_MANAGEMENT	0x0d
3836941Srralphs #define	SSVC_ACTION_GET_TIMESTAMP		0x0f
3840Sstevel@tonic-gate 
385173Scth /*
3866941Srralphs  * Group 5 Service Actions for Maintenance Out (12)
3876941Srralphs  */
3886941Srralphs #define	SSVC_ACTION_SET_DEVICE_IDENTIFIER	0x06
3896941Srralphs #define	SSVC_ACTION_SET_PRIORITY		0x0e
3906941Srralphs #define	SSVC_ACTION_SET_TARGET_PORT_GROUPS	0x0a
3916941Srralphs #define	SSVC_ACTION_SET_TIMESTAMP		0x0f
3926941Srralphs 
3936941Srralphs /*
3946941Srralphs  * Group 5 Service Actions for Service Action In (12)
3956941Srralphs  */
3966941Srralphs #define	SSVC_ACTION_READ_MEDIA_SERIAL		0x01
3976941Srralphs /*
398173Scth  * scsi_key_strings for SCMD_ definitions
399173Scth  *	NOTE: see SCSI_CMDS_KEY_STRINGS_CDIO in cdio.h for additional
400173Scth  *	command-to-string translations.
401173Scth  */
402173Scth #define	SCSI_CMDS_KEY_STRINGS						\
403173Scth /* 0x00 */ SCMD_TEST_UNIT_READY,	"test_unit_ready",		\
404173Scth /* 0x01 */ SCMD_REWIND |						\
405173Scth 		SCMD_REZERO_UNIT,	"rezero/rewind",		\
406173Scth /* 0x03 */ SCMD_REQUEST_SENSE,		"request_sense",		\
407173Scth /* 0x04 */ SCMD_FORMAT,			"format",			\
408173Scth /* 0x05 */ SCMD_READ_BLKLIM,		"read_block_limits",		\
409173Scth /* 0x07 */ SCMD_REASSIGN_BLOCK,		"reassign",			\
410173Scth /* 0x08 */ SCMD_READ |							\
411173Scth 		SCMD_RECEIVE,		"read",				\
412173Scth /* 0x0a */ SCMD_PRINT |							\
413173Scth 		SCMD_SEND |						\
414173Scth 		SCMD_WRITE,		"write",			\
415173Scth /* 0x0b */ SCMD_SEEK |							\
416173Scth 		SCMD_SLEW_PRINT |					\
417173Scth 		SCMD_TRK_SEL,		"seek",				\
418173Scth /* 0x0f */ SCMD_READ_REVERSE,		"read_reverse",			\
419173Scth /* 0x10 */ SCMD_WRITE_FILE_MARK |					\
420173Scth 		SCMD_FLUSH_PRINT_BUF,	"write_file_mark",		\
421173Scth /* 0x11 */ SCMD_SPACE,			"space",			\
422173Scth /* 0x12 */ SCMD_INQUIRY,		"inquiry",			\
423173Scth /* 0x13 */ SCMD_VERIFY_G0,		"verify",			\
424173Scth /* 0x14 */ SCMD_RECOVER_BUF,		"recover_buffer_data",		\
425173Scth /* 0x15 */ SCMD_MODE_SELECT,		"mode_select",			\
426173Scth /* 0x16 */ SCMD_RESERVE,		"reserve",			\
427173Scth /* 0x17 */ SCMD_RELEASE,		"release",			\
428173Scth /* 0x18 */ SCMD_COPY,			"copy",				\
429173Scth /* 0x19 */ SCMD_ERASE,			"erase_tape",			\
430173Scth /* 0x1a */ SCMD_MODE_SENSE,		"mode_sense",			\
431173Scth /* 0x1b */ SCMD_LOAD |							\
432173Scth 		SCMD_START_STOP |					\
433173Scth 		SCMD_STOP_PRINT,	"load/start/stop",		\
434173Scth /* 0x1c */ SCMD_GDIAG,			"get_diagnostic_results",	\
435173Scth /* 0x1d */ SCMD_SDIAG,			"send_diagnostic_command",	\
436173Scth /* 0x1e */ SCMD_DOORLOCK,		"door_lock",			\
437173Scth /* 0x23 */ SCMD_READ_FORMAT_CAP,	"read_format_capacity",		\
438173Scth /* 0x25 */ SCMD_READ_CAPACITY,		"read_capacity",		\
439173Scth /* 0x28 */ SCMD_READ_G1,		"read(10)",			\
440173Scth /* 0x2a */ SCMD_WRITE_G1,		"write(10)",			\
441173Scth /* 0x2b */ SCMD_SEEK_G1 |						\
442173Scth 		SCMD_LOCATE,		"seek(10)",			\
443173Scth /* 0x2e */ SCMD_WRITE_VERIFY,		"write_verify",			\
444173Scth /* 0x2f */ SCMD_VERIFY,			"verify(10)",			\
445173Scth /* 0x30 */ SCMD_SEARCH_HIGH,		"search_data_high",		\
446173Scth /* 0x31 */ SCMD_SEARCH_EQUAL,		"search_data_equal",		\
447173Scth /* 0x32 */ SCMD_SEARCH_LOW,		"search_data_low",		\
448173Scth /* 0x33 */ SCMD_SET_LIMITS,		"set_limits",			\
449173Scth /* 0x34 */ SCMD_READ_POSITION,		"read_position",		\
450173Scth /* 0x35 */ SCMD_SYNCHRONIZE_CACHE,	"synchronize_cache",		\
451173Scth /* 0x37 */ SCMD_READ_DEFECT_LIST,	"read_defect_data",		\
452173Scth /* 0x39 */ SCMD_COMPARE,		"compare",			\
453173Scth /* 0x3a */ SCMD_COPY_VERIFY,		"copy_verify",			\
454173Scth /* 0x3b */ SCMD_WRITE_BUFFER,		"write_buffer",			\
455173Scth /* 0x3c */ SCMD_READ_BUFFER,		"read_buffer",			\
456173Scth /* 0x3e */ SCMD_READ_LONG,		"read_long",			\
457173Scth /* 0x3f */ SCMD_WRITE_LONG,		"write_long",			\
458173Scth /* 0x44 */ SCMD_REPORT_DENSITIES |					\
459173Scth 		/* SCMD_READ_HEADER (from cdio.h) | */			\
460173Scth 		0,			"report_densities/read_header",	\
461173Scth /* 0x4c */ SCMD_LOG_SELECT_G1,		"log_select",			\
462173Scth /* 0x4d */ SCMD_LOG_SENSE_G1,		"log_sense",			\
463173Scth /* 0x55 */ SCMD_MODE_SELECT_G1,		"mode_select(10)",		\
464173Scth /* 0x56 */ SCMD_RESERVE_G1,		"reserve(10)",			\
465173Scth /* 0x57 */ SCMD_RELEASE_G1,		"release(10)",			\
466173Scth /* 0x5a */ SCMD_MODE_SENSE_G1,		"mode_sense(10)",		\
467173Scth /* 0x5e */ SCMD_PERSISTENT_RESERVE_IN,	"persistent_reserve_in",	\
468173Scth /* 0x5f */ SCMD_PERSISTENT_RESERVE_OUT,	"persistent_reserve_out",	\
4695628Srralphs /* 0x80 */ SCMD_WRITE_FILE_MARK_G4,	"write_file_mark(16)",		\
4705628Srralphs /* 0x81 */ SCMD_READ_REVERSE_G4,	"read_reverse(16)",		\
471173Scth /* 0x83 */ SCMD_EXTENDED_COPY,		"extended_copy",		\
472173Scth /* 0x88 */ SCMD_READ_G4,		"read(16)",			\
473173Scth /* 0x8a */ SCMD_WRITE_G4,		"write(16)",			\
4742537Srralphs /* 0x8c */ SCMD_READ_ATTRIBUTE,		"read_attribute",		\
4752537Srralphs /* 0x8d */ SCMD_WRITE_ATTRIBUTE,	"write_attribute",		\
476*12278SCharles.Binford@Sun.COM /* 0x8e */ SCMD_WRITE_VERIFY_G4,	"write_verify(16)",		\
4774549Srralphs /* 0x8f */ SCMD_VERIFY_G4,		"verify(16)",			\
4785628Srralphs /* 0x91 */ SCMD_SPACE_G4,		"space(16)",			\
4794549Srralphs /* 0x92 */ SCMD_LOCATE_G4,		"locate(16)",			\
4805628Srralphs /* 0x9e */ SCMD_SVC_ACTION_IN_G4,	"service_action_in(16)",	\
4815628Srralphs /* 0x9f */ SCMD_SVC_ACTION_OUT_G4,	"service_action_out(16)",	\
482173Scth /* 0xa0 */ SCMD_REPORT_LUNS,		"report_luns",			\
4835628Srralphs /* 0xa2 */ SCMD_SECURITY_PROTO_IN,	"security_protocol_in",		\
4845628Srralphs /* 0xa3 */ SCMD_MAINTENANCE_IN,		"maintenance_in",		\
4855628Srralphs /* 0xa4 */ SCMD_MAINTENANCE_OUT,	"maintenance_out",		\
486173Scth /* 0xa8 */ SCMD_READ_G5,		"read(12)",			\
4875628Srralphs /* 0xa9 */ SCMD_SVC_ACTION_OUT_G5,	"service_action_out(12)",	\
488173Scth /* 0xaa */ SCMD_WRITE_G5,		"write(12)",			\
4895628Srralphs /* 0xab */ SCMD_SVC_ACTION_IN_G5,	"service_action_in(12)",	\
4904549Srralphs /* 0xac */ SCMD_GET_PERFORMANCE,	"get_performance",		\
491*12278SCharles.Binford@Sun.COM /* 0xAE */ SCMD_WRITE_VERIFY_G5,	"write_verify(12)",		\
4925628Srralphs /* 0xAF */ SCMD_VERIFY_G5,		"verify(12)",			\
4935628Srralphs /* 0xb5 */ SCMD_SECURITY_PROTO_OUT,	"security_protocol_out"		\
494173Scth 	/* see cdio.h for additional command-to-string translations */
495173Scth 
496173Scth /* XXX not a command code, does not belong here */
497173Scth #define	ATAPI_CAPABILITIES	0x2A
4980Sstevel@tonic-gate 
4990Sstevel@tonic-gate #ifdef	__cplusplus
5000Sstevel@tonic-gate }
5010Sstevel@tonic-gate #endif
5020Sstevel@tonic-gate 
5030Sstevel@tonic-gate /*
5040Sstevel@tonic-gate  * Below are inclusions of files describing various command structures
5050Sstevel@tonic-gate  * of interest.
5060Sstevel@tonic-gate  */
5070Sstevel@tonic-gate #include <sys/scsi/generic/inquiry.h>
5080Sstevel@tonic-gate #include <sys/scsi/generic/sense.h>
5090Sstevel@tonic-gate 
5100Sstevel@tonic-gate /*
5110Sstevel@tonic-gate  * Private Vendor Unique Commands - Each implementation provides this.
5120Sstevel@tonic-gate  */
5130Sstevel@tonic-gate #include <sys/scsi/impl/commands.h>
5140Sstevel@tonic-gate 
5150Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_COMMANDS_H */
516