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 /*
23309bed43SCharles Binford - Sun Microsystems - Wichita  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
24b77b9231SDan McDonald  *
25b77b9231SDan McDonald  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_COMMANDS_H
297c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_COMMANDS_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Standard SCSI Command Definitions
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * Macros to determine known command sizes
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate #define	CDB_GROUPID(cmd)	((cmd >> 5) & 0x7)
417c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_0	0
427c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_1	1
437c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_2	2
447c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_3	3
457c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_4	4
467c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_5	5
477c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_6	6
487c478bd9Sstevel@tonic-gate #define	CDB_GROUPID_7	7
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #define	CDB_GROUP0	6	/*  6-byte cdb's */
517c478bd9Sstevel@tonic-gate #define	CDB_GROUP1	10	/* 10-byte cdb's */
527c478bd9Sstevel@tonic-gate #define	CDB_GROUP2	10	/* 10-byte cdb's */
537c478bd9Sstevel@tonic-gate #define	CDB_GROUP3	0	/* reserved */
547c478bd9Sstevel@tonic-gate #define	CDB_GROUP4	16	/* 16-byte cdb's */
557c478bd9Sstevel@tonic-gate #define	CDB_GROUP5	12	/* 12-byte cdb's */
567c478bd9Sstevel@tonic-gate #define	CDB_GROUP6	0	/* reserved */
577c478bd9Sstevel@tonic-gate #define	CDB_GROUP7	0	/* reserved */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * Generic Command Definitions
6130a83a24Scth  * NOTE: CDROM commands are defined in cdio.h
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Group 0 Commands (CDB range 0x00 - 0x1F)
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate #define	SCMD_GROUP0		0x00
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * Group 0 commands, All Devices
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate #define	SCMD_TEST_UNIT_READY	0x00
737c478bd9Sstevel@tonic-gate #define	SCMD_REQUEST_SENSE	0x03
747c478bd9Sstevel@tonic-gate #define	SCMD_INQUIRY		0x12
757c478bd9Sstevel@tonic-gate #define	SCMD_COPY		0x18
767c478bd9Sstevel@tonic-gate #define	SCMD_GDIAG		0x1C	/* receive diagnostic results */
777c478bd9Sstevel@tonic-gate #define	SCMD_SDIAG		0x1D	/* send diagnostic results */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Group 0 commands, Direct Access Devices
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
837c478bd9Sstevel@tonic-gate #define	SCMD_REZERO_UNIT	0x01
847c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
857c478bd9Sstevel@tonic-gate #define	SCMD_FORMAT		0x04
867c478bd9Sstevel@tonic-gate #define	SCMD_REASSIGN_BLOCK	0x07
877c478bd9Sstevel@tonic-gate #define	SCMD_READ		0x08
887c478bd9Sstevel@tonic-gate #define	SCMD_WRITE		0x0a
897c478bd9Sstevel@tonic-gate #define	SCMD_SEEK		0x0b
907c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
917c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SELECT	0x15
927c478bd9Sstevel@tonic-gate #define	SCMD_RESERVE		0x16
937c478bd9Sstevel@tonic-gate #define	SCMD_RELEASE		0x17
947c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
957c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SENSE		0x1a
967c478bd9Sstevel@tonic-gate #define	SCMD_START_STOP		0x1b
977c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
987c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
997c478bd9Sstevel@tonic-gate #define	SCMD_DOORLOCK		0x1E	/* Prevent/Allow Medium Removal */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  * Group 0 commands, Sequential Access Devices
1037c478bd9Sstevel@tonic-gate  */
1047c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1057c478bd9Sstevel@tonic-gate #define	SCMD_REWIND		0x01	/* Note similarity to SCMD_REZERO */
1067c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1077c478bd9Sstevel@tonic-gate #define	SCMD_READ_BLKLIM	0x05
1087c478bd9Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1097c478bd9Sstevel@tonic-gate /*	SCMD_WRITE		0x0a	*/
1107c478bd9Sstevel@tonic-gate #define	SCMD_TRK_SEL		0x0b	/* Note similarity to SCMD_SEEK */
1117c478bd9Sstevel@tonic-gate #define	SCMD_READ_REVERSE	0x0f
1127c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_FILE_MARK	0x10
1137c478bd9Sstevel@tonic-gate #define	SCMD_SPACE		0x11
1147c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1157c478bd9Sstevel@tonic-gate #define	SCMD_VERIFY_G0		0x13
1167c478bd9Sstevel@tonic-gate #define	SCMD_RECOVER_BUF	0x14
1177c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1187c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1197c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1207c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1217c478bd9Sstevel@tonic-gate #define	SCMD_ERASE		0x19
1227c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1237c478bd9Sstevel@tonic-gate #define	SCMD_LOAD		0x1b	/* Note similarity to SCMD_START_STOP */
1247c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1257c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1267c478bd9Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1e	*/
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate /*
1307c478bd9Sstevel@tonic-gate  * Group 0 commands, Printer Devices
1317c478bd9Sstevel@tonic-gate  */
1327c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1337c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1347c478bd9Sstevel@tonic-gate /*	SCMD_FORMAT		0x04	*/
1357c478bd9Sstevel@tonic-gate #define	SCMD_PRINT		0x0a	/* Note similarity to SCMD_WRITE */
1367c478bd9Sstevel@tonic-gate #define	SCMD_SLEW_PRINT		0x0b	/* ? similar to SCMD_SEEK ? */
1377c478bd9Sstevel@tonic-gate #define	SCMD_FLUSH_PRINT_BUF	0x10	/* ? similar to SCMD_WRITE_FILE_MARK */
1387c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1397c478bd9Sstevel@tonic-gate /*	SCMD_RECOVER_BUF	0x14	*/
1407c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1417c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1427c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1437c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1447c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1457c478bd9Sstevel@tonic-gate #define	SCMD_STOP_PRINT		0x1b	/* Note similarity to SCMD_START_STOP */
1467c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1477c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate /*
1507c478bd9Sstevel@tonic-gate  * Group 0 commands, Processor Devices
1517c478bd9Sstevel@tonic-gate  */
1527c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1537c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1547c478bd9Sstevel@tonic-gate #define	SCMD_RECEIVE		0x08	/* Note similarity to SCMD_READ */
1557c478bd9Sstevel@tonic-gate #define	SCMD_SEND		0x0a	/* Note similarity to SCMD_WRITE */
1567c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1577c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1587c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1597c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1c	*/
1607c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1d	*/
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate  * Group 0 commands, WORM Devices
1647c478bd9Sstevel@tonic-gate  */
1657c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1667c478bd9Sstevel@tonic-gate /*	SCMD_REZERO_UNIT	0x01	*/
1677c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1687c478bd9Sstevel@tonic-gate /*	SCMD_REASSIGN_BLOCK	0x07	*/
1697c478bd9Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1707c478bd9Sstevel@tonic-gate /*	SCMD_WRITE		0x0a	*/
1717c478bd9Sstevel@tonic-gate /*	SCMD_SEEK		0x0b	*/
1727c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1737c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1747c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1757c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1767c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1777c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1787c478bd9Sstevel@tonic-gate /*	SCMD_START_STOP		0x1b	*/
1797c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
1807c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
1817c478bd9Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1E	*/
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /*
1847c478bd9Sstevel@tonic-gate  * Group 0 commands, Read Only Devices
1857c478bd9Sstevel@tonic-gate  */
1867c478bd9Sstevel@tonic-gate /*	SCMD_TEST_UNIT_READY	0x00	*/
1877c478bd9Sstevel@tonic-gate /*	SCMD_REZERO_UNIT	0x01	*/
1887c478bd9Sstevel@tonic-gate /*	SCMD_REQUEST_SENSE	0x03	*/
1897c478bd9Sstevel@tonic-gate /*	SCMD_REASSIGN_BLOCK	0x07	*/
1907c478bd9Sstevel@tonic-gate /*	SCMD_READ		0x08	*/
1917c478bd9Sstevel@tonic-gate /*	SCMD_SEEK		0x0b	*/
1927c478bd9Sstevel@tonic-gate /*	SCMD_INQUIRY		0x12	*/
1937c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SELECT	0x15	*/
1947c478bd9Sstevel@tonic-gate /*	SCMD_RESERVE		0x16	*/
1957c478bd9Sstevel@tonic-gate /*	SCMD_RELEASE		0x17	*/
1967c478bd9Sstevel@tonic-gate /*	SCMD_COPY		0x18	*/
1977c478bd9Sstevel@tonic-gate /*	SCMD_MODE_SENSE		0x1a	*/
1987c478bd9Sstevel@tonic-gate /*	SCMD_START_STOP		0x1b	*/
1997c478bd9Sstevel@tonic-gate /*	SCMD_GDIAG		0x1C	*/
2007c478bd9Sstevel@tonic-gate /*	SCMD_SDIAG		0x1D	*/
2017c478bd9Sstevel@tonic-gate /*	SCMD_DOORLOCK		0x1E	*/
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate /*
2047c478bd9Sstevel@tonic-gate  * Group 1 Commands (CDB range 0x20 - 0x3F)
2057c478bd9Sstevel@tonic-gate  */
2067c478bd9Sstevel@tonic-gate #define	SCMD_GROUP1		0x20
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /*
2097c478bd9Sstevel@tonic-gate  * Group 1 Commands, All Devices
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate #define	SCMD_COMPARE		0x39
2127c478bd9Sstevel@tonic-gate #define	SCMD_COPY_VERIFY	0x3A
21330a83a24Scth #define	SCMD_PERSISTENT_RESERVE_IN		0x5E
21430a83a24Scth #define	SCMD_PERSISTENT_RESERVE_OUT		0x5F
21530a83a24Scth #define	SCMD_PRIN		SCMD_PERSISTENT_RESERVE_IN
21630a83a24Scth #define	SCMD_PROUT		SCMD_PERSISTENT_RESERVE_OUT
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate /*
2197c478bd9Sstevel@tonic-gate  * Group 1 Commands, Direct Access Devices
2207c478bd9Sstevel@tonic-gate  */
2217c478bd9Sstevel@tonic-gate #define	SCMD_READ_FORMAT_CAP	0x23
2227c478bd9Sstevel@tonic-gate #define	SCMD_READ_CAPACITY	0x25
2237c478bd9Sstevel@tonic-gate #define	SCMD_READ_G1		0x28	/* Note that only the group changed */
2247c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_G1		0x2a	/* Note that only the group changed */
2257c478bd9Sstevel@tonic-gate #define	SCMD_SEEK_G1		0x2b	/* Note that only the group changed */
2267c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_VERIFY	0x2e
2277c478bd9Sstevel@tonic-gate #define	SCMD_VERIFY		0x2f
2287c478bd9Sstevel@tonic-gate #define	SCMD_SEARCH_HIGH	0x30
2297c478bd9Sstevel@tonic-gate #define	SCMD_SEARCH_EQUAL	0x31
2307c478bd9Sstevel@tonic-gate #define	SCMD_SEARCH_LOW		0x32
2317c478bd9Sstevel@tonic-gate #define	SCMD_SET_LIMITS		0x33
23230a83a24Scth #define	SCMD_SYNCHRONIZE_CACHE	0x35
2337c478bd9Sstevel@tonic-gate #define	SCMD_READ_DEFECT_LIST	0x37
2347c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_BUFFER	0x3B
2357c478bd9Sstevel@tonic-gate #define	SCMD_READ_BUFFER	0x3c
2367c478bd9Sstevel@tonic-gate #define	SCMD_READ_LONG		0x3E
2377c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_LONG		0x3F
238b77b9231SDan McDonald #define	SCMD_WRITE_SAME_G1	0x41
239b77b9231SDan McDonald #define	SCMD_UNMAP		0x42
240b77b9231SDan McDonald #define	SCMD_GET_CONFIGURATION	0x46
241b77b9231SDan McDonald #define	SCMD_LOG_SELECT_G1	0x4c
242b77b9231SDan McDonald #define	SCMD_LOG_SENSE_G1	0x4d
2437c478bd9Sstevel@tonic-gate #define	SCMD_RESERVE_G1		0x56
2447c478bd9Sstevel@tonic-gate #define	SCMD_RELEASE_G1		0x57
2457c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SELECT_G1	0x55
2467c478bd9Sstevel@tonic-gate #define	SCMD_MODE_SENSE_G1	0x5A
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*
2507c478bd9Sstevel@tonic-gate  * Group 1 Commands, Sequential Access Devices
2517c478bd9Sstevel@tonic-gate  */
2527c478bd9Sstevel@tonic-gate #define	SCMD_LOCATE		0x2B	/* Note similarity to SCMD_SEEK_G1 */
2537c478bd9Sstevel@tonic-gate #define	SCMD_READ_POSITION	0x34
2547c478bd9Sstevel@tonic-gate #define	SCMD_REPORT_DENSITIES	0x44
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate /*
2577c478bd9Sstevel@tonic-gate  * Group 1 Commands, Printer Devices
2587c478bd9Sstevel@tonic-gate  */
2597c478bd9Sstevel@tonic-gate /* (None Defined) */
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /*
2627c478bd9Sstevel@tonic-gate  * Group 1 Commands, Processor Devices
2637c478bd9Sstevel@tonic-gate  */
2647c478bd9Sstevel@tonic-gate /* (None Defined) */
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate /*
2677c478bd9Sstevel@tonic-gate  * Group 1 Commands, WORM Devices
2687c478bd9Sstevel@tonic-gate  */
2697c478bd9Sstevel@tonic-gate /*	SCMD_READ_CAPACITY	0x25	*/
2707c478bd9Sstevel@tonic-gate /*	SCMD_READ_G1		0x28	*/
2717c478bd9Sstevel@tonic-gate /*	SCMD_WRITE_G1		0x2a	*/
2727c478bd9Sstevel@tonic-gate /*	SCMD_SEEK_G1		0x2b	*/
2737c478bd9Sstevel@tonic-gate /*	SCMD_WRITE_VERIFY	0x2e	*/
2747c478bd9Sstevel@tonic-gate /*	SCMD_VERIFY		0x2f	*/
2757c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_HIGH	0x30	*/
2767c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_EQUAL	0x31	*/
2777c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_LOW		0x32	*/
2787c478bd9Sstevel@tonic-gate /*	SCMD_SET_LIMITS		0x33	*/
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate /*
2817c478bd9Sstevel@tonic-gate  * Group 1 Commands, Read Only Devices
2827c478bd9Sstevel@tonic-gate  */
2837c478bd9Sstevel@tonic-gate /*	SCMD_READ_CAPACITY	0x25	*/
2847c478bd9Sstevel@tonic-gate /*	SCMD_READ_G1		0x28	*/
2857c478bd9Sstevel@tonic-gate /*	SCMD_SEEK_G1		0x2b	*/
2867c478bd9Sstevel@tonic-gate /*	SCMD_VERIFY		0x2f	*/
2877c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_HIGH	0x30	*/
2887c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_EQUAL	0x31	*/
2897c478bd9Sstevel@tonic-gate /*	SCMD_SEARCH_LOW		0x32	*/
2907c478bd9Sstevel@tonic-gate /*	SCMD_SET_LIMITS		0x33	*/
2917c478bd9Sstevel@tonic-gate 
29297ddcdceSArtem Kachitchkine /*
29397ddcdceSArtem Kachitchkine  * Group 1 Commands, MMC Devices
29497ddcdceSArtem Kachitchkine  */
29597ddcdceSArtem Kachitchkine 
29697ddcdceSArtem Kachitchkine /* GET EVENT STATUS NOTIFICATION, MMC-3 5.6 */
29797ddcdceSArtem Kachitchkine #define	SCMD_GET_EVENT_STATUS_NOTIFICATION	0x4a
29897ddcdceSArtem Kachitchkine 
29997ddcdceSArtem Kachitchkine /* event header */
30097ddcdceSArtem Kachitchkine #define	SD_GESN_HEADER_LEN			4
30197ddcdceSArtem Kachitchkine #define	SD_GESN_HEADER_NEA			0x80	/* byte 2 */
30297ddcdceSArtem Kachitchkine #define	SD_GESN_HEADER_CLASS			0x07	/* byte 2 */
30397ddcdceSArtem Kachitchkine 
30497ddcdceSArtem Kachitchkine /* media class event class and event data that follows the header */
30597ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_CLASS			4
30697ddcdceSArtem Kachitchkine 
30797ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_DATA_LEN			4
30897ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_CODE		0x0f	/* byte 0 */
30997ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_STATUS_PRESENT	0x02	/* byte 1 */
31097ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_STATUS_TRAY_OPEN	0x01	/* byte 1 */
31197ddcdceSArtem Kachitchkine 
31297ddcdceSArtem Kachitchkine /* media event code */
31397ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_NOCHG		0
31497ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_EJECTREQUEST	1
31597ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_NEWMEDIA		2
31697ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_MEDIAREMOVAL	3
31797ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_MEDIACHANGED	4
31897ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_BGFORMATCOMPLETED	5
31997ddcdceSArtem Kachitchkine #define	SD_GESN_MEDIA_EVENT_BGFORMATRESTARTED	6
32097ddcdceSArtem Kachitchkine 
32197ddcdceSArtem Kachitchkine 
322305d694fStaylor /*
323305d694fStaylor  * Group 3 Commands
324305d694fStaylor  */
325305d694fStaylor #define	SCMD_VAR_LEN		0x7f
326305d694fStaylor 
3277c478bd9Sstevel@tonic-gate /*
3287c478bd9Sstevel@tonic-gate  * Group 4 Commands, All Devices
3297c478bd9Sstevel@tonic-gate  */
3307c478bd9Sstevel@tonic-gate #define	SCMD_GROUP4		0x80
3317c478bd9Sstevel@tonic-gate #define	SCMD_EXTENDED_COPY	0x83
332*61dfa509SRick McNeal #define	SCMD_RECV_COPY_RESULTS	0x84
3338a16ae8fSmcneal #define	SCMD_VERIFY_G4		0x8f
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate /*
3367c478bd9Sstevel@tonic-gate  * Group 4 Commands, Direct Access Devices
3377c478bd9Sstevel@tonic-gate  */
3387c478bd9Sstevel@tonic-gate #define	SCMD_READ_G4		0x88
3397c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_G4		0x8a
340309bed43SCharles Binford - Sun Microsystems - Wichita #define	SCMD_WRITE_VERIFY_G4	0x8e
341b77b9231SDan McDonald #define	SCMD_WRITE_SAME_G4	0x93
3427c478bd9Sstevel@tonic-gate #define	SCMD_SVC_ACTION_IN_G4	0x9e
3437c478bd9Sstevel@tonic-gate #define	SCMD_SVC_ACTION_OUT_G4	0x9f
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate /*
3467c478bd9Sstevel@tonic-gate  * Group 4 Service Actions for Service Action In (16)
3477c478bd9Sstevel@tonic-gate  */
3487c478bd9Sstevel@tonic-gate #define	SSVC_ACTION_READ_CAPACITY_G4	0x10
3497c478bd9Sstevel@tonic-gate #define	SSVC_ACTION_READ_LONG_G4	0x11
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate /*
3527c478bd9Sstevel@tonic-gate  * Group 4 Service Actions for Service Action Out (16)
3537c478bd9Sstevel@tonic-gate  */
3547c478bd9Sstevel@tonic-gate #define	SSVC_ACTION_WRITE_LONG_G4	0x11
3557c478bd9Sstevel@tonic-gate 
3565988135dSrralphs /*
3575988135dSrralphs  * Group 4 Commands, Sequential Access Devics
3585988135dSrralphs  */
359f218e94bSrralphs #define	SCMD_WRITE_FILE_MARK_G4	0x80
360f218e94bSrralphs #define	SCMD_READ_REVERSE_G4	0x81
361*61dfa509SRick McNeal #define	SCMD_COMPARE_AND_WRITE	0x89
3625988135dSrralphs #define	SCMD_READ_ATTRIBUTE	0x8c
3635988135dSrralphs #define	SCMD_WRITE_ATTRIBUTE	0x8d
364f218e94bSrralphs #define	SCMD_SPACE_G4		0x91
365c6914c10Srralphs #define	SCMD_LOCATE_G4		0x92
3665988135dSrralphs 
3677c478bd9Sstevel@tonic-gate /*
3680205780bSrralphs  * Group 5 commands.
3697c478bd9Sstevel@tonic-gate  */
3707c478bd9Sstevel@tonic-gate #define	SCMD_GROUP5		0xA0
37130a83a24Scth #define	SCMD_REPORT_LUNS	0xA0
372f218e94bSrralphs #define	SCMD_SECURITY_PROTO_IN	0xA2
373f218e94bSrralphs #define	SCMD_MAINTENANCE_IN	0xA3
374f218e94bSrralphs #define	SCMD_MAINTENANCE_OUT	0xA4
3757c478bd9Sstevel@tonic-gate #define	SCMD_READ_G5		0xA8
3767c478bd9Sstevel@tonic-gate #define	SCMD_WRITE_G5		0xAA
377f218e94bSrralphs #define	SCMD_SVC_ACTION_OUT_G5	0xA9
378f218e94bSrralphs #define	SCMD_SVC_ACTION_IN_G5	0xAB
3797c478bd9Sstevel@tonic-gate #define	SCMD_GET_PERFORMANCE	0xAC
380309bed43SCharles Binford - Sun Microsystems - Wichita #define	SCMD_WRITE_VERIFY_G5	0xAE
3818a16ae8fSmcneal #define	SCMD_VERIFY_G5		0xAF
382f218e94bSrralphs #define	SCMD_SECURITY_PROTO_OUT	0xB5
3837c478bd9Sstevel@tonic-gate 
3840205780bSrralphs /*
3850205780bSrralphs  * Group 5 Service Actions for Maintenance In (12)
3860205780bSrralphs  */
3870205780bSrralphs #define	SSVC_ACTION_GET_TARGET_PORT_GROUPS	0x0a
3880205780bSrralphs #define	SSVC_ACTION_GET_SUPPORTED_OPERATIONS	0x0c
3890205780bSrralphs #define	SSVC_SCTION_GET_SUPPORTED_MANAGEMENT	0x0d
3900205780bSrralphs #define	SSVC_ACTION_GET_TIMESTAMP		0x0f
39130a83a24Scth 
3920205780bSrralphs /*
3930205780bSrralphs  * Group 5 Service Actions for Maintenance Out (12)
3940205780bSrralphs  */
3950205780bSrralphs #define	SSVC_ACTION_SET_DEVICE_IDENTIFIER	0x06
3960205780bSrralphs #define	SSVC_ACTION_SET_PRIORITY		0x0e
3970205780bSrralphs #define	SSVC_ACTION_SET_TARGET_PORT_GROUPS	0x0a
3980205780bSrralphs #define	SSVC_ACTION_SET_TIMESTAMP		0x0f
3990205780bSrralphs 
4000205780bSrralphs /*
4010205780bSrralphs  * Group 5 Service Actions for Service Action In (12)
4020205780bSrralphs  */
4030205780bSrralphs #define	SSVC_ACTION_READ_MEDIA_SERIAL		0x01
40430a83a24Scth /*
40530a83a24Scth  * scsi_key_strings for SCMD_ definitions
40630a83a24Scth  *	NOTE: see SCSI_CMDS_KEY_STRINGS_CDIO in cdio.h for additional
40730a83a24Scth  *	command-to-string translations.
40830a83a24Scth  */
40930a83a24Scth #define	SCSI_CMDS_KEY_STRINGS						\
41030a83a24Scth /* 0x00 */ SCMD_TEST_UNIT_READY,	"test_unit_ready",		\
41130a83a24Scth /* 0x01 */ SCMD_REWIND |						\
41230a83a24Scth 		SCMD_REZERO_UNIT,	"rezero/rewind",		\
41330a83a24Scth /* 0x03 */ SCMD_REQUEST_SENSE,		"request_sense",		\
41430a83a24Scth /* 0x04 */ SCMD_FORMAT,			"format",			\
41530a83a24Scth /* 0x05 */ SCMD_READ_BLKLIM,		"read_block_limits",		\
41630a83a24Scth /* 0x07 */ SCMD_REASSIGN_BLOCK,		"reassign",			\
41730a83a24Scth /* 0x08 */ SCMD_READ |							\
41830a83a24Scth 		SCMD_RECEIVE,		"read",				\
41930a83a24Scth /* 0x0a */ SCMD_PRINT |							\
42030a83a24Scth 		SCMD_SEND |						\
42130a83a24Scth 		SCMD_WRITE,		"write",			\
42230a83a24Scth /* 0x0b */ SCMD_SEEK |							\
42330a83a24Scth 		SCMD_SLEW_PRINT |					\
42430a83a24Scth 		SCMD_TRK_SEL,		"seek",				\
42530a83a24Scth /* 0x0f */ SCMD_READ_REVERSE,		"read_reverse",			\
42630a83a24Scth /* 0x10 */ SCMD_WRITE_FILE_MARK |					\
42730a83a24Scth 		SCMD_FLUSH_PRINT_BUF,	"write_file_mark",		\
42830a83a24Scth /* 0x11 */ SCMD_SPACE,			"space",			\
42930a83a24Scth /* 0x12 */ SCMD_INQUIRY,		"inquiry",			\
43030a83a24Scth /* 0x13 */ SCMD_VERIFY_G0,		"verify",			\
43130a83a24Scth /* 0x14 */ SCMD_RECOVER_BUF,		"recover_buffer_data",		\
43230a83a24Scth /* 0x15 */ SCMD_MODE_SELECT,		"mode_select",			\
43330a83a24Scth /* 0x16 */ SCMD_RESERVE,		"reserve",			\
43430a83a24Scth /* 0x17 */ SCMD_RELEASE,		"release",			\
43530a83a24Scth /* 0x18 */ SCMD_COPY,			"copy",				\
43630a83a24Scth /* 0x19 */ SCMD_ERASE,			"erase_tape",			\
43730a83a24Scth /* 0x1a */ SCMD_MODE_SENSE,		"mode_sense",			\
43830a83a24Scth /* 0x1b */ SCMD_LOAD |							\
43930a83a24Scth 		SCMD_START_STOP |					\
44030a83a24Scth 		SCMD_STOP_PRINT,	"load/start/stop",		\
44130a83a24Scth /* 0x1c */ SCMD_GDIAG,			"get_diagnostic_results",	\
44230a83a24Scth /* 0x1d */ SCMD_SDIAG,			"send_diagnostic_command",	\
44330a83a24Scth /* 0x1e */ SCMD_DOORLOCK,		"door_lock",			\
44430a83a24Scth /* 0x23 */ SCMD_READ_FORMAT_CAP,	"read_format_capacity",		\
44530a83a24Scth /* 0x25 */ SCMD_READ_CAPACITY,		"read_capacity",		\
44630a83a24Scth /* 0x28 */ SCMD_READ_G1,		"read(10)",			\
44730a83a24Scth /* 0x2a */ SCMD_WRITE_G1,		"write(10)",			\
44830a83a24Scth /* 0x2b */ SCMD_SEEK_G1 |						\
44930a83a24Scth 		SCMD_LOCATE,		"seek(10)",			\
45030a83a24Scth /* 0x2e */ SCMD_WRITE_VERIFY,		"write_verify",			\
45130a83a24Scth /* 0x2f */ SCMD_VERIFY,			"verify(10)",			\
45230a83a24Scth /* 0x30 */ SCMD_SEARCH_HIGH,		"search_data_high",		\
45330a83a24Scth /* 0x31 */ SCMD_SEARCH_EQUAL,		"search_data_equal",		\
45430a83a24Scth /* 0x32 */ SCMD_SEARCH_LOW,		"search_data_low",		\
45530a83a24Scth /* 0x33 */ SCMD_SET_LIMITS,		"set_limits",			\
45630a83a24Scth /* 0x34 */ SCMD_READ_POSITION,		"read_position",		\
45730a83a24Scth /* 0x35 */ SCMD_SYNCHRONIZE_CACHE,	"synchronize_cache",		\
45830a83a24Scth /* 0x37 */ SCMD_READ_DEFECT_LIST,	"read_defect_data",		\
45930a83a24Scth /* 0x39 */ SCMD_COMPARE,		"compare",			\
46030a83a24Scth /* 0x3a */ SCMD_COPY_VERIFY,		"copy_verify",			\
46130a83a24Scth /* 0x3b */ SCMD_WRITE_BUFFER,		"write_buffer",			\
46230a83a24Scth /* 0x3c */ SCMD_READ_BUFFER,		"read_buffer",			\
46330a83a24Scth /* 0x3e */ SCMD_READ_LONG,		"read_long",			\
46430a83a24Scth /* 0x3f */ SCMD_WRITE_LONG,		"write_long",			\
465b77b9231SDan McDonald /* 0x41 */ SCMD_WRITE_SAME_G1,		"write_same(10)",		\
466b77b9231SDan McDonald /* 0x42 */ SCMD_UNMAP,			"unmap",			\
46730a83a24Scth /* 0x44 */ SCMD_REPORT_DENSITIES |					\
46830a83a24Scth 		/* SCMD_READ_HEADER (from cdio.h) | */			\
46930a83a24Scth 		0,			"report_densities/read_header",	\
470b77b9231SDan McDonald /* 0x46 */ SCMD_GET_CONFIGURATION,	"get_configuration",		\
47130a83a24Scth /* 0x4c */ SCMD_LOG_SELECT_G1,		"log_select",			\
47230a83a24Scth /* 0x4d */ SCMD_LOG_SENSE_G1,		"log_sense",			\
47330a83a24Scth /* 0x55 */ SCMD_MODE_SELECT_G1,		"mode_select(10)",		\
47430a83a24Scth /* 0x56 */ SCMD_RESERVE_G1,		"reserve(10)",			\
47530a83a24Scth /* 0x57 */ SCMD_RELEASE_G1,		"release(10)",			\
47630a83a24Scth /* 0x5a */ SCMD_MODE_SENSE_G1,		"mode_sense(10)",		\
47730a83a24Scth /* 0x5e */ SCMD_PERSISTENT_RESERVE_IN,	"persistent_reserve_in",	\
47830a83a24Scth /* 0x5f */ SCMD_PERSISTENT_RESERVE_OUT,	"persistent_reserve_out",	\
479f218e94bSrralphs /* 0x80 */ SCMD_WRITE_FILE_MARK_G4,	"write_file_mark(16)",		\
480f218e94bSrralphs /* 0x81 */ SCMD_READ_REVERSE_G4,	"read_reverse(16)",		\
48130a83a24Scth /* 0x83 */ SCMD_EXTENDED_COPY,		"extended_copy",		\
48230a83a24Scth /* 0x88 */ SCMD_READ_G4,		"read(16)",			\
48330a83a24Scth /* 0x8a */ SCMD_WRITE_G4,		"write(16)",			\
4845988135dSrralphs /* 0x8c */ SCMD_READ_ATTRIBUTE,		"read_attribute",		\
4855988135dSrralphs /* 0x8d */ SCMD_WRITE_ATTRIBUTE,	"write_attribute",		\
486309bed43SCharles Binford - Sun Microsystems - Wichita /* 0x8e */ SCMD_WRITE_VERIFY_G4,	"write_verify(16)",		\
487c6914c10Srralphs /* 0x8f */ SCMD_VERIFY_G4,		"verify(16)",			\
488f218e94bSrralphs /* 0x91 */ SCMD_SPACE_G4,		"space(16)",			\
489c6914c10Srralphs /* 0x92 */ SCMD_LOCATE_G4,		"locate(16)",			\
490b77b9231SDan McDonald /* 0x92 */ SCMD_WRITE_SAME_G4,		"write_same(16)",		\
491f218e94bSrralphs /* 0x9e */ SCMD_SVC_ACTION_IN_G4,	"service_action_in(16)",	\
492f218e94bSrralphs /* 0x9f */ SCMD_SVC_ACTION_OUT_G4,	"service_action_out(16)",	\
49330a83a24Scth /* 0xa0 */ SCMD_REPORT_LUNS,		"report_luns",			\
494f218e94bSrralphs /* 0xa2 */ SCMD_SECURITY_PROTO_IN,	"security_protocol_in",		\
495f218e94bSrralphs /* 0xa3 */ SCMD_MAINTENANCE_IN,		"maintenance_in",		\
496f218e94bSrralphs /* 0xa4 */ SCMD_MAINTENANCE_OUT,	"maintenance_out",		\
49730a83a24Scth /* 0xa8 */ SCMD_READ_G5,		"read(12)",			\
498f218e94bSrralphs /* 0xa9 */ SCMD_SVC_ACTION_OUT_G5,	"service_action_out(12)",	\
49930a83a24Scth /* 0xaa */ SCMD_WRITE_G5,		"write(12)",			\
500f218e94bSrralphs /* 0xab */ SCMD_SVC_ACTION_IN_G5,	"service_action_in(12)",	\
501c6914c10Srralphs /* 0xac */ SCMD_GET_PERFORMANCE,	"get_performance",		\
502309bed43SCharles Binford - Sun Microsystems - Wichita /* 0xAE */ SCMD_WRITE_VERIFY_G5,	"write_verify(12)",		\
503f218e94bSrralphs /* 0xAF */ SCMD_VERIFY_G5,		"verify(12)",			\
504f218e94bSrralphs /* 0xb5 */ SCMD_SECURITY_PROTO_OUT,	"security_protocol_out"		\
50530a83a24Scth 	/* see cdio.h for additional command-to-string translations */
50630a83a24Scth 
50730a83a24Scth /* XXX not a command code, does not belong here */
50830a83a24Scth #define	ATAPI_CAPABILITIES	0x2A
50930a83a24Scth 
5107c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
5117c478bd9Sstevel@tonic-gate }
5127c478bd9Sstevel@tonic-gate #endif
5137c478bd9Sstevel@tonic-gate 
5147c478bd9Sstevel@tonic-gate /*
5157c478bd9Sstevel@tonic-gate  * Below are inclusions of files describing various command structures
5167c478bd9Sstevel@tonic-gate  * of interest.
5177c478bd9Sstevel@tonic-gate  */
5187c478bd9Sstevel@tonic-gate #include <sys/scsi/generic/inquiry.h>
5197c478bd9Sstevel@tonic-gate #include <sys/scsi/generic/sense.h>
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate /*
5227c478bd9Sstevel@tonic-gate  * Private Vendor Unique Commands - Each implementation provides this.
5237c478bd9Sstevel@tonic-gate  */
5247c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/commands.h>
5257c478bd9Sstevel@tonic-gate 
5267c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_COMMANDS_H */
527