17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
536c5fee3Smcneal  * Common Development and Distribution License (the "License").
636c5fee3Smcneal  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
2136c5fee3Smcneal 
227c478bd9Sstevel@tonic-gate /*
23*97ddcdceSArtem Kachitchkine  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_COMMANDS_H
287c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_COMMANDS_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Standard SCSI Command Definitions
367c478bd9Sstevel@tonic-gate  *
377c478bd9Sstevel@tonic-gate  * Macros to determine known command sizes
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate #define	CDB_GROUPID(cmd)	((cmd >> 5) & 0x7)
407c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_0	0
417c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_1	1
427c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_2	2
437c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_3	3
447c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_4	4
457c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_5	5
467c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_6	6
477c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_7	7
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #define	CDB_GROUP0	6	/*  6-byte cdb's */
507c478bd9Sstevel@tonic-gate #define	CDB_GROUP1	10	/* 10-byte cdb's */
517c478bd9Sstevel@tonic-gate #define	CDB_GROUP2	10	/* 10-byte cdb's */
527c478bd9Sstevel@tonic-gate #define	CDB_GROUP3	0	/* reserved */
537c478bd9Sstevel@tonic-gate #define	CDB_GROUP4	16	/* 16-byte cdb's */
547c478bd9Sstevel@tonic-gate #define	CDB_GROUP5	12	/* 12-byte cdb's */
557c478bd9Sstevel@tonic-gate #define	CDB_GROUP6	0	/* reserved */
567c478bd9Sstevel@tonic-gate #define	CDB_GROUP7	0	/* reserved */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Generic Command Definitions
6030a83a24Scth  * NOTE: CDROM commands are defined in cdio.h
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Group 0 Commands (CDB range 0x00 - 0x1F)
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	SCMD_GROUP0		0x00
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Group 0 commands, All Devices
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #define	SCMD_TEST_UNIT_READY	0x00
727c478bd9Sstevel@tonic-gate #define	SCMD_REQUEST_SENSE	0x03
737c478bd9Sstevel@tonic-gate #define	SCMD_INQUIRY		0x12
747c478bd9Sstevel@tonic-gate #define	SCMD_COPY		0x18
757c478bd9Sstevel@tonic-gate #define	SCMD_GDIAG		0x1C	/* receive diagnostic results */
767c478bd9Sstevel@tonic-gate #define	SCMD_SDIAG		0x1D	/* send diagnostic results */
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*
797c478bd9Sstevel@tonic-gate  * Group 0 commands, Direct Access Devices
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
827c478bd9Sstevel@tonic-gate #define	SCMD_REZERO_UNIT	0x01
837c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
847c478bd9Sstevel@tonic-gate #define	SCMD_FORMAT		0x04
857c478bd9Sstevel@tonic-gate #define	SCMD_REASSIGN_BLOCK	0x07
867c478bd9Sstevel@tonic-gate #define	SCMD_READ		0x08
877c478bd9Sstevel@tonic-gate #define	SCMD_WRITE		0x0a
887c478bd9Sstevel@tonic-gate #define	SCMD_SEEK		0x0b
897c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
907c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SELECT	0x15
917c478bd9Sstevel@tonic-gate #define	SCMD_RESERVE		0x16
927c478bd9Sstevel@tonic-gate #define	SCMD_RELEASE		0x17
937c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
947c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SENSE		0x1a
957c478bd9Sstevel@tonic-gate #define	SCMD_START_STOP		0x1b
967c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
977c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
987c478bd9Sstevel@tonic-gate #define	SCMD_DOORLOCK		0x1E	/* Prevent/Allow Medium Removal */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * Group 0 commands, Sequential Access Devices
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1047c478bd9Sstevel@tonic-gate #define	SCMD_REWIND		0x01	/* Note similarity to SCMD_REZERO */
1057c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1067c478bd9Sstevel@tonic-gate #define	SCMD_READ_BLKLIM	0x05
1077c478bd9Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1087c478bd9Sstevel@tonic-gate /*	SCMD_WRITE		0x0a	*/
1097c478bd9Sstevel@tonic-gate #define	SCMD_TRK_SEL		0x0b	/* Note similarity to SCMD_SEEK */
1107c478bd9Sstevel@tonic-gate #define	SCMD_READ_REVERSE	0x0f
1117c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_FILE_MARK	0x10
1127c478bd9Sstevel@tonic-gate #define	SCMD_SPACE		0x11
1137c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1147c478bd9Sstevel@tonic-gate #define	SCMD_VERIFY_G0		0x13
1157c478bd9Sstevel@tonic-gate #define	SCMD_RECOVER_BUF	0x14
1167c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1177c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1187c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1197c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1207c478bd9Sstevel@tonic-gate #define	SCMD_ERASE		0x19
1217c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1227c478bd9Sstevel@tonic-gate #define	SCMD_LOAD		0x1b	/* Note similarity to SCMD_START_STOP */
1237c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1247c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1257c478bd9Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1e	*/
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * Group 0 commands, Printer Devices
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1327c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1337c478bd9Sstevel@tonic-gate /*	SCMD_FORMAT		0x04	*/
1347c478bd9Sstevel@tonic-gate #define	SCMD_PRINT		0x0a	/* Note similarity to SCMD_WRITE */
1357c478bd9Sstevel@tonic-gate #define	SCMD_SLEW_PRINT		0x0b	/* ? similar to SCMD_SEEK ? */
1367c478bd9Sstevel@tonic-gate #define	SCMD_FLUSH_PRINT_BUF	0x10	/* ? similar to SCMD_WRITE_FILE_MARK */
1377c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1387c478bd9Sstevel@tonic-gate /*	SCMD_RECOVER_BUF	0x14	*/
1397c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1407c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1417c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1427c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1437c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1447c478bd9Sstevel@tonic-gate #define	SCMD_STOP_PRINT		0x1b	/* Note similarity to SCMD_START_STOP */
1457c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1467c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /*
1497c478bd9Sstevel@tonic-gate  * Group 0 commands, Processor Devices
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1527c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1537c478bd9Sstevel@tonic-gate #define	SCMD_RECEIVE		0x08	/* Note similarity to SCMD_READ */
1547c478bd9Sstevel@tonic-gate #define	SCMD_SEND		0x0a	/* Note similarity to SCMD_WRITE */
1557c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1567c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1577c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1587c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1597c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate /*
1627c478bd9Sstevel@tonic-gate  * Group 0 commands, WORM Devices
1637c478bd9Sstevel@tonic-gate  */
1647c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1657c478bd9Sstevel@tonic-gate /*	SCMD_REZERO_UNIT	0x01	*/
1667c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1677c478bd9Sstevel@tonic-gate /*	SCMD_REASSIGN_BLOCK	0x07	*/
1687c478bd9Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1697c478bd9Sstevel@tonic-gate /*	SCMD_WRITE		0x0a	*/
1707c478bd9Sstevel@tonic-gate /*	SCMD_SEEK		0x0b	*/
1717c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1727c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1737c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1747c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1757c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1767c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1777c478bd9Sstevel@tonic-gate /*	SCMD_START_STOP		0x1b	*/
1787c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
1797c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
1807c478bd9Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1E	*/
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate /*
1837c478bd9Sstevel@tonic-gate  * Group 0 commands, Read Only Devices
1847c478bd9Sstevel@tonic-gate  */
1857c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1867c478bd9Sstevel@tonic-gate /*	SCMD_REZERO_UNIT	0x01	*/
1877c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1887c478bd9Sstevel@tonic-gate /*	SCMD_REASSIGN_BLOCK	0x07	*/
1897c478bd9Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1907c478bd9Sstevel@tonic-gate /*	SCMD_SEEK		0x0b	*/
1917c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1927c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1937c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1947c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1957c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1967c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1977c478bd9Sstevel@tonic-gate /*	SCMD_START_STOP		0x1b	*/
1987c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
1997c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
2007c478bd9Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1E	*/
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate /*
2037c478bd9Sstevel@tonic-gate  * Group 1 Commands (CDB range 0x20 - 0x3F)
2047c478bd9Sstevel@tonic-gate  */
2057c478bd9Sstevel@tonic-gate #define	SCMD_GROUP1		0x20
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate /*
2087c478bd9Sstevel@tonic-gate  * Group 1 Commands, All Devices
2097c478bd9Sstevel@tonic-gate  */
2107c478bd9Sstevel@tonic-gate #define	SCMD_COMPARE		0x39
2117c478bd9Sstevel@tonic-gate #define	SCMD_COPY_VERIFY	0x3A
21230a83a24Scth #define	SCMD_PERSISTENT_RESERVE_IN		0x5E
21330a83a24Scth #define	SCMD_PERSISTENT_RESERVE_OUT		0x5F
21430a83a24Scth #define	SCMD_PRIN		SCMD_PERSISTENT_RESERVE_IN
21530a83a24Scth #define	SCMD_PROUT		SCMD_PERSISTENT_RESERVE_OUT
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate /*
2187c478bd9Sstevel@tonic-gate  * Group 1 Commands, Direct Access Devices
2197c478bd9Sstevel@tonic-gate  */
2207c478bd9Sstevel@tonic-gate #define	SCMD_READ_FORMAT_CAP	0x23
2217c478bd9Sstevel@tonic-gate #define	SCMD_READ_CAPACITY	0x25
2227c478bd9Sstevel@tonic-gate #define	SCMD_READ_G1		0x28	/* Note that only the group changed */
2237c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_G1		0x2a	/* Note that only the group changed */
2247c478bd9Sstevel@tonic-gate #define	SCMD_SEEK_G1		0x2b	/* Note that only the group changed */
2257c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_VERIFY	0x2e
2267c478bd9Sstevel@tonic-gate #define	SCMD_VERIFY		0x2f
2277c478bd9Sstevel@tonic-gate #define	SCMD_SEARCH_HIGH	0x30
2287c478bd9Sstevel@tonic-gate #define	SCMD_SEARCH_EQUAL	0x31
2297c478bd9Sstevel@tonic-gate #define	SCMD_SEARCH_LOW		0x32
2307c478bd9Sstevel@tonic-gate #define	SCMD_SET_LIMITS		0x33
23130a83a24Scth #define	SCMD_SYNCHRONIZE_CACHE	0x35
2327c478bd9Sstevel@tonic-gate #define	SCMD_READ_DEFECT_LIST	0x37
2337c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_BUFFER	0x3B
2347c478bd9Sstevel@tonic-gate #define	SCMD_READ_BUFFER	0x3c
2357c478bd9Sstevel@tonic-gate #define	SCMD_READ_LONG		0x3E
2367c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_LONG		0x3F
2377c478bd9Sstevel@tonic-gate #define	SCMD_RESERVE_G1		0x56
2387c478bd9Sstevel@tonic-gate #define	SCMD_RELEASE_G1		0x57
2397c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SELECT_G1	0x55
2407c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SENSE_G1	0x5A
2417c478bd9Sstevel@tonic-gate #define	SCMD_GET_CONFIGURATION	0x46
2427c478bd9Sstevel@tonic-gate #define	SCMD_LOG_SELECT_G1	0x4C
2437c478bd9Sstevel@tonic-gate #define	SCMD_LOG_SENSE_G1	0x4d
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * Group 1 Commands, Sequential Access Devices
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate #define	SCMD_LOCATE		0x2B	/* Note similarity to SCMD_SEEK_G1 */
2507c478bd9Sstevel@tonic-gate #define	SCMD_READ_POSITION	0x34
2517c478bd9Sstevel@tonic-gate #define	SCMD_REPORT_DENSITIES	0x44
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate /*
2547c478bd9Sstevel@tonic-gate  * Group 1 Commands, Printer Devices
2557c478bd9Sstevel@tonic-gate  */
2567c478bd9Sstevel@tonic-gate /* (None Defined) */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate /*
2597c478bd9Sstevel@tonic-gate  * Group 1 Commands, Processor Devices
2607c478bd9Sstevel@tonic-gate  */
2617c478bd9Sstevel@tonic-gate /* (None Defined) */
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate /*
2647c478bd9Sstevel@tonic-gate  * Group 1 Commands, WORM Devices
2657c478bd9Sstevel@tonic-gate  */
2667c478bd9Sstevel@tonic-gate /*	SCMD_READ_CAPACITY	0x25	*/
2677c478bd9Sstevel@tonic-gate /*	SCMD_READ_G1		0x28	*/
2687c478bd9Sstevel@tonic-gate /*	SCMD_WRITE_G1		0x2a	*/
2697c478bd9Sstevel@tonic-gate /*	SCMD_SEEK_G1		0x2b	*/
2707c478bd9Sstevel@tonic-gate /*	SCMD_WRITE_VERIFY	0x2e	*/
2717c478bd9Sstevel@tonic-gate /*	SCMD_VERIFY		0x2f	*/
2727c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_HIGH	0x30	*/
2737c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_EQUAL	0x31	*/
2747c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_LOW		0x32	*/
2757c478bd9Sstevel@tonic-gate /*	SCMD_SET_LIMITS		0x33	*/
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate /*
2787c478bd9Sstevel@tonic-gate  * Group 1 Commands, Read Only Devices
2797c478bd9Sstevel@tonic-gate  */
2807c478bd9Sstevel@tonic-gate /*	SCMD_READ_CAPACITY	0x25	*/
2817c478bd9Sstevel@tonic-gate /*	SCMD_READ_G1		0x28	*/
2827c478bd9Sstevel@tonic-gate /*	SCMD_SEEK_G1		0x2b	*/
2837c478bd9Sstevel@tonic-gate /*	SCMD_VERIFY		0x2f	*/
2847c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_HIGH	0x30	*/
2857c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_EQUAL	0x31	*/
2867c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_LOW		0x32	*/
2877c478bd9Sstevel@tonic-gate /*	SCMD_SET_LIMITS		0x33	*/
2887c478bd9Sstevel@tonic-gate 
289*97ddcdceSArtem Kachitchkine /*
290*97ddcdceSArtem Kachitchkine  * Group 1 Commands, MMC Devices
291*97ddcdceSArtem Kachitchkine  */
292*97ddcdceSArtem Kachitchkine 
293*97ddcdceSArtem Kachitchkine /* GET EVENT STATUS NOTIFICATION, MMC-3 5.6 */
294*97ddcdceSArtem Kachitchkine #define	SCMD_GET_EVENT_STATUS_NOTIFICATION	0x4a
295*97ddcdceSArtem Kachitchkine 
296*97ddcdceSArtem Kachitchkine /* event header */
297*97ddcdceSArtem Kachitchkine #define	SD_GESN_HEADER_LEN			4
298*97ddcdceSArtem Kachitchkine #define	SD_GESN_HEADER_NEA			0x80	/* byte 2 */
299*97ddcdceSArtem Kachitchkine #define	SD_GESN_HEADER_CLASS			0x07	/* byte 2 */
300*97ddcdceSArtem Kachitchkine 
301*97ddcdceSArtem Kachitchkine /* media class event class and event data that follows the header */
302*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_CLASS			4
303*97ddcdceSArtem Kachitchkine 
304*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_DATA_LEN			4
305*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_CODE		0x0f	/* byte 0 */
306*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_STATUS_PRESENT	0x02	/* byte 1 */
307*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_STATUS_TRAY_OPEN	0x01	/* byte 1 */
308*97ddcdceSArtem Kachitchkine 
309*97ddcdceSArtem Kachitchkine /* media event code */
310*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_NOCHG		0
311*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_EJECTREQUEST	1
312*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_NEWMEDIA		2
313*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_MEDIAREMOVAL	3
314*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_MEDIACHANGED	4
315*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_BGFORMATCOMPLETED	5
316*97ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_BGFORMATRESTARTED	6
317*97ddcdceSArtem Kachitchkine 
318*97ddcdceSArtem Kachitchkine 
319305d694fStaylor /*
320305d694fStaylor  * Group 3 Commands
321305d694fStaylor  */
322305d694fStaylor #define	SCMD_VAR_LEN		0x7f
323305d694fStaylor 
3247c478bd9Sstevel@tonic-gate /*
3257c478bd9Sstevel@tonic-gate  * Group 4 Commands, All Devices
3267c478bd9Sstevel@tonic-gate  */
3277c478bd9Sstevel@tonic-gate #define	SCMD_GROUP4		0x80
3287c478bd9Sstevel@tonic-gate #define	SCMD_EXTENDED_COPY	0x83
3298a16ae8fSmcneal #define	SCMD_VERIFY_G4		0x8f
3307c478bd9Sstevel@tonic-gate 
3317c478bd9Sstevel@tonic-gate /*
3327c478bd9Sstevel@tonic-gate  * Group 4 Commands, Direct Access Devices
3337c478bd9Sstevel@tonic-gate  */
3347c478bd9Sstevel@tonic-gate #define	SCMD_READ_G4		0x88
3357c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_G4		0x8a
3367c478bd9Sstevel@tonic-gate #define	SCMD_SVC_ACTION_IN_G4	0x9e
3377c478bd9Sstevel@tonic-gate #define	SCMD_SVC_ACTION_OUT_G4	0x9f
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate /*
3407c478bd9Sstevel@tonic-gate  * Group 4 Service Actions for Service Action In (16)
3417c478bd9Sstevel@tonic-gate  */
3427c478bd9Sstevel@tonic-gate #define	SSVC_ACTION_READ_CAPACITY_G4	0x10
3437c478bd9Sstevel@tonic-gate #define	SSVC_ACTION_READ_LONG_G4	0x11
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate /*
3467c478bd9Sstevel@tonic-gate  * Group 4 Service Actions for Service Action Out (16)
3477c478bd9Sstevel@tonic-gate  */
3487c478bd9Sstevel@tonic-gate #define	SSVC_ACTION_WRITE_LONG_G4	0x11
3497c478bd9Sstevel@tonic-gate 
3505988135dSrralphs /*
3515988135dSrralphs  * Group 4 Commands, Sequential Access Devics
3525988135dSrralphs  */
353f218e94bSrralphs #define	SCMD_WRITE_FILE_MARK_G4	0x80
354f218e94bSrralphs #define	SCMD_READ_REVERSE_G4	0x81
3555988135dSrralphs #define	SCMD_READ_ATTRIBUTE	0x8c
3565988135dSrralphs #define	SCMD_WRITE_ATTRIBUTE	0x8d
357f218e94bSrralphs #define	SCMD_SPACE_G4		0x91
358c6914c10Srralphs #define	SCMD_LOCATE_G4		0x92
3595988135dSrralphs 
3607c478bd9Sstevel@tonic-gate /*
3610205780bSrralphs  * Group 5 commands.
3627c478bd9Sstevel@tonic-gate  */
3637c478bd9Sstevel@tonic-gate #define	SCMD_GROUP5		0xA0
36430a83a24Scth #define	SCMD_REPORT_LUNS	0xA0
365f218e94bSrralphs #define	SCMD_SECURITY_PROTO_IN	0xA2
366f218e94bSrralphs #define	SCMD_MAINTENANCE_IN	0xA3
367f218e94bSrralphs #define	SCMD_MAINTENANCE_OUT	0xA4
3687c478bd9Sstevel@tonic-gate #define	SCMD_READ_G5		0xA8
3697c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_G5		0xAA
370f218e94bSrralphs #define	SCMD_SVC_ACTION_OUT_G5	0xA9
371f218e94bSrralphs #define	SCMD_SVC_ACTION_IN_G5	0xAB
3727c478bd9Sstevel@tonic-gate #define	SCMD_GET_PERFORMANCE	0xAC
3738a16ae8fSmcneal #define	SCMD_VERIFY_G5		0xAF
374f218e94bSrralphs #define	SCMD_SECURITY_PROTO_OUT	0xB5
3757c478bd9Sstevel@tonic-gate 
3760205780bSrralphs /*
3770205780bSrralphs  * Group 5 Service Actions for Maintenance In (12)
3780205780bSrralphs  */
3790205780bSrralphs #define	SSVC_ACTION_GET_TARGET_PORT_GROUPS	0x0a
3800205780bSrralphs #define	SSVC_ACTION_GET_SUPPORTED_OPERATIONS	0x0c
3810205780bSrralphs #define	SSVC_SCTION_GET_SUPPORTED_MANAGEMENT	0x0d
3820205780bSrralphs #define	SSVC_ACTION_GET_TIMESTAMP		0x0f
38330a83a24Scth 
3840205780bSrralphs /*
3850205780bSrralphs  * Group 5 Service Actions for Maintenance Out (12)
3860205780bSrralphs  */
3870205780bSrralphs #define	SSVC_ACTION_SET_DEVICE_IDENTIFIER	0x06
3880205780bSrralphs #define	SSVC_ACTION_SET_PRIORITY		0x0e
3890205780bSrralphs #define	SSVC_ACTION_SET_TARGET_PORT_GROUPS	0x0a
3900205780bSrralphs #define	SSVC_ACTION_SET_TIMESTAMP		0x0f
3910205780bSrralphs 
3920205780bSrralphs /*
3930205780bSrralphs  * Group 5 Service Actions for Service Action In (12)
3940205780bSrralphs  */
3950205780bSrralphs #define	SSVC_ACTION_READ_MEDIA_SERIAL		0x01
39630a83a24Scth /*
39730a83a24Scth  * scsi_key_strings for SCMD_ definitions
39830a83a24Scth  *	NOTE: see SCSI_CMDS_KEY_STRINGS_CDIO in cdio.h for additional
39930a83a24Scth  *	command-to-string translations.
40030a83a24Scth  */
40130a83a24Scth #define	SCSI_CMDS_KEY_STRINGS						\
40230a83a24Scth /* 0x00 */ SCMD_TEST_UNIT_READY,	"test_unit_ready",		\
40330a83a24Scth /* 0x01 */ SCMD_REWIND |						\
40430a83a24Scth 		SCMD_REZERO_UNIT,	"rezero/rewind",		\
40530a83a24Scth /* 0x03 */ SCMD_REQUEST_SENSE,		"request_sense",		\
40630a83a24Scth /* 0x04 */ SCMD_FORMAT,			"format",			\
40730a83a24Scth /* 0x05 */ SCMD_READ_BLKLIM,		"read_block_limits",		\
40830a83a24Scth /* 0x07 */ SCMD_REASSIGN_BLOCK,		"reassign",			\
40930a83a24Scth /* 0x08 */ SCMD_READ |							\
41030a83a24Scth 		SCMD_RECEIVE,		"read",				\
41130a83a24Scth /* 0x0a */ SCMD_PRINT |							\
41230a83a24Scth 		SCMD_SEND |						\
41330a83a24Scth 		SCMD_WRITE,		"write",			\
41430a83a24Scth /* 0x0b */ SCMD_SEEK |							\
41530a83a24Scth 		SCMD_SLEW_PRINT |					\
41630a83a24Scth 		SCMD_TRK_SEL,		"seek",				\
41730a83a24Scth /* 0x0f */ SCMD_READ_REVERSE,		"read_reverse",			\
41830a83a24Scth /* 0x10 */ SCMD_WRITE_FILE_MARK |					\
41930a83a24Scth 		SCMD_FLUSH_PRINT_BUF,	"write_file_mark",		\
42030a83a24Scth /* 0x11 */ SCMD_SPACE,			"space",			\
42130a83a24Scth /* 0x12 */ SCMD_INQUIRY,		"inquiry",			\
42230a83a24Scth /* 0x13 */ SCMD_VERIFY_G0,		"verify",			\
42330a83a24Scth /* 0x14 */ SCMD_RECOVER_BUF,		"recover_buffer_data",		\
42430a83a24Scth /* 0x15 */ SCMD_MODE_SELECT,		"mode_select",			\
42530a83a24Scth /* 0x16 */ SCMD_RESERVE,		"reserve",			\
42630a83a24Scth /* 0x17 */ SCMD_RELEASE,		"release",			\
42730a83a24Scth /* 0x18 */ SCMD_COPY,			"copy",				\
42830a83a24Scth /* 0x19 */ SCMD_ERASE,			"erase_tape",			\
42930a83a24Scth /* 0x1a */ SCMD_MODE_SENSE,		"mode_sense",			\
43030a83a24Scth /* 0x1b */ SCMD_LOAD |							\
43130a83a24Scth 		SCMD_START_STOP |					\
43230a83a24Scth 		SCMD_STOP_PRINT,	"load/start/stop",		\
43330a83a24Scth /* 0x1c */ SCMD_GDIAG,			"get_diagnostic_results",	\
43430a83a24Scth /* 0x1d */ SCMD_SDIAG,			"send_diagnostic_command",	\
43530a83a24Scth /* 0x1e */ SCMD_DOORLOCK,		"door_lock",			\
43630a83a24Scth /* 0x23 */ SCMD_READ_FORMAT_CAP,	"read_format_capacity",		\
43730a83a24Scth /* 0x25 */ SCMD_READ_CAPACITY,		"read_capacity",		\
43830a83a24Scth /* 0x28 */ SCMD_READ_G1,		"read(10)",			\
43930a83a24Scth /* 0x2a */ SCMD_WRITE_G1,		"write(10)",			\
44030a83a24Scth /* 0x2b */ SCMD_SEEK_G1 |						\
44130a83a24Scth 		SCMD_LOCATE,		"seek(10)",			\
44230a83a24Scth /* 0x2e */ SCMD_WRITE_VERIFY,		"write_verify",			\
44330a83a24Scth /* 0x2f */ SCMD_VERIFY,			"verify(10)",			\
44430a83a24Scth /* 0x30 */ SCMD_SEARCH_HIGH,		"search_data_high",		\
44530a83a24Scth /* 0x31 */ SCMD_SEARCH_EQUAL,		"search_data_equal",		\
44630a83a24Scth /* 0x32 */ SCMD_SEARCH_LOW,		"search_data_low",		\
44730a83a24Scth /* 0x33 */ SCMD_SET_LIMITS,		"set_limits",			\
44830a83a24Scth /* 0x34 */ SCMD_READ_POSITION,		"read_position",		\
44930a83a24Scth /* 0x35 */ SCMD_SYNCHRONIZE_CACHE,	"synchronize_cache",		\
45030a83a24Scth /* 0x37 */ SCMD_READ_DEFECT_LIST,	"read_defect_data",		\
45130a83a24Scth /* 0x39 */ SCMD_COMPARE,		"compare",			\
45230a83a24Scth /* 0x3a */ SCMD_COPY_VERIFY,		"copy_verify",			\
45330a83a24Scth /* 0x3b */ SCMD_WRITE_BUFFER,		"write_buffer",			\
45430a83a24Scth /* 0x3c */ SCMD_READ_BUFFER,		"read_buffer",			\
45530a83a24Scth /* 0x3e */ SCMD_READ_LONG,		"read_long",			\
45630a83a24Scth /* 0x3f */ SCMD_WRITE_LONG,		"write_long",			\
45730a83a24Scth /* 0x44 */ SCMD_REPORT_DENSITIES |					\
45830a83a24Scth 		/* SCMD_READ_HEADER (from cdio.h) | */			\
45930a83a24Scth 		0,			"report_densities/read_header",	\
46030a83a24Scth /* 0x4c */ SCMD_LOG_SELECT_G1,		"log_select",			\
46130a83a24Scth /* 0x4d */ SCMD_LOG_SENSE_G1,		"log_sense",			\
46230a83a24Scth /* 0x55 */ SCMD_MODE_SELECT_G1,		"mode_select(10)",		\
46330a83a24Scth /* 0x56 */ SCMD_RESERVE_G1,		"reserve(10)",			\
46430a83a24Scth /* 0x57 */ SCMD_RELEASE_G1,		"release(10)",			\
46530a83a24Scth /* 0x5a */ SCMD_MODE_SENSE_G1,		"mode_sense(10)",		\
46630a83a24Scth /* 0x5e */ SCMD_PERSISTENT_RESERVE_IN,	"persistent_reserve_in",	\
46730a83a24Scth /* 0x5f */ SCMD_PERSISTENT_RESERVE_OUT,	"persistent_reserve_out",	\
468f218e94bSrralphs /* 0x80 */ SCMD_WRITE_FILE_MARK_G4,	"write_file_mark(16)",		\
469f218e94bSrralphs /* 0x81 */ SCMD_READ_REVERSE_G4,	"read_reverse(16)",		\
47030a83a24Scth /* 0x83 */ SCMD_EXTENDED_COPY,		"extended_copy",		\
47130a83a24Scth /* 0x88 */ SCMD_READ_G4,		"read(16)",			\
47230a83a24Scth /* 0x8a */ SCMD_WRITE_G4,		"write(16)",			\
4735988135dSrralphs /* 0x8c */ SCMD_READ_ATTRIBUTE,		"read_attribute",		\
4745988135dSrralphs /* 0x8d */ SCMD_WRITE_ATTRIBUTE,	"write_attribute",		\
475c6914c10Srralphs /* 0x8f */ SCMD_VERIFY_G4,		"verify(16)",			\
476f218e94bSrralphs /* 0x91 */ SCMD_SPACE_G4,		"space(16)",			\
477c6914c10Srralphs /* 0x92 */ SCMD_LOCATE_G4,		"locate(16)",			\
478f218e94bSrralphs /* 0x9e */ SCMD_SVC_ACTION_IN_G4,	"service_action_in(16)",	\
479f218e94bSrralphs /* 0x9f */ SCMD_SVC_ACTION_OUT_G4,	"service_action_out(16)",	\
48030a83a24Scth /* 0xa0 */ SCMD_REPORT_LUNS,		"report_luns",			\
481f218e94bSrralphs /* 0xa2 */ SCMD_SECURITY_PROTO_IN,	"security_protocol_in",		\
482f218e94bSrralphs /* 0xa3 */ SCMD_MAINTENANCE_IN,		"maintenance_in",		\
483f218e94bSrralphs /* 0xa4 */ SCMD_MAINTENANCE_OUT,	"maintenance_out",		\
48430a83a24Scth /* 0xa8 */ SCMD_READ_G5,		"read(12)",			\
485f218e94bSrralphs /* 0xa9 */ SCMD_SVC_ACTION_OUT_G5,	"service_action_out(12)",	\
48630a83a24Scth /* 0xaa */ SCMD_WRITE_G5,		"write(12)",			\
487f218e94bSrralphs /* 0xab */ SCMD_SVC_ACTION_IN_G5,	"service_action_in(12)",	\
488c6914c10Srralphs /* 0xac */ SCMD_GET_PERFORMANCE,	"get_performance",		\
489f218e94bSrralphs /* 0xAF */ SCMD_VERIFY_G5,		"verify(12)",			\
490f218e94bSrralphs /* 0xb5 */ SCMD_SECURITY_PROTO_OUT,	"security_protocol_out"		\
49130a83a24Scth 	/* see cdio.h for additional command-to-string translations */
49230a83a24Scth 
49330a83a24Scth /* XXX not a command code, does not belong here */
49430a83a24Scth #define	ATAPI_CAPABILITIES	0x2A
49530a83a24Scth 
4967c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4977c478bd9Sstevel@tonic-gate }
4987c478bd9Sstevel@tonic-gate #endif
4997c478bd9Sstevel@tonic-gate 
5007c478bd9Sstevel@tonic-gate /*
5017c478bd9Sstevel@tonic-gate  * Below are inclusions of files describing various command structures
5027c478bd9Sstevel@tonic-gate  * of interest.
5037c478bd9Sstevel@tonic-gate  */
5047c478bd9Sstevel@tonic-gate #include <sys/scsi/generic/inquiry.h>
5057c478bd9Sstevel@tonic-gate #include <sys/scsi/generic/sense.h>
5067c478bd9Sstevel@tonic-gate 
5077c478bd9Sstevel@tonic-gate /*
5087c478bd9Sstevel@tonic-gate  * Private Vendor Unique Commands - Each implementation provides this.
5097c478bd9Sstevel@tonic-gate  */
5107c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/commands.h>
5117c478bd9Sstevel@tonic-gate 
5127c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_COMMANDS_H */
513