1 /* $NetBSD: scsi_cmd_codes.h,v 1.16 2007/12/05 07:23:03 agc Exp $ */
4 * Copyright © 2006 Alistair Crooks. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote
15 * products derived from this software without specific prior written
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef SCSI_CMD_CODES_H_
31 #define SCSI_CMD_CODES_H_
33 /* information taken from SPC3, T10/1416-D Revision 23, from www.t10.org */
36 TEST_UNIT_READY
= 0x00,
44 STOP_START_UNIT
= 0x1b,
52 MODE_SELECT_10
= 0x55,
56 PERSISTENT_RESERVE_IN
= 0x5e,
57 PERSISTENT_RESERVE_OUT
= 0x5f,
61 #define SIX_BYTE_COMMAND(op) ((op) <= 0x1f)
62 #define TEN_BYTE_COMMAND(op) ((op) > 0x1f && (op) <= 0x5f)
65 ISCSI_MODE_SENSE_LEN
= 11
68 /* miscellaneous definitions */
70 DISK_PERIPHERAL_DEVICE
= 0x0,
72 INQUIRY_EVPD_BIT
= 0x01,
74 INQUIRY_UNIT_SERIAL_NUMBER_VPD
= 0x80,
75 INQUIRY_DEVICE_IDENTIFICATION_VPD
= 0x83,
76 INQUIRY_SUPPORTED_VPD_PAGES
= 0x0,
77 INQUIRY_DEVICE_PIV
= 0x1,
79 INQUIRY_IDENTIFIER_TYPE_T10
= 0x1,
80 INQUIRY_IDENTIFIER_TYPE_EUI64
= 0x2,
81 INQUIRY_IDENTIFIER_TYPE_NAA
= 0x3,
83 INQUIRY_DEVICE_ASSOCIATION_LOGICAL_UNIT
= 0x0,
84 INQUIRY_DEVICE_ASSOCIATION_TARGET_PORT
= 0x1,
85 INQUIRY_DEVICE_ASSOCIATION_TARGET_DEVICE
= 0x2,
87 INQUIRY_DEVICE_CODESET_UTF8
= 0x3,
88 INQUIRY_DEVICE_ISCSI_PROTOCOL
= 0x5,
89 INQUIRY_DEVICE_T10_VENDOR
= 0x1,
90 INQUIRY_DEVICE_IDENTIFIER_SCSI_NAME
= 0x8,
92 EXTENDED_INQUIRY_DATA_VPD
= 0x86,
93 EXTENDED_INQUIRY_REF_TAG_OWNER
= 0x08,
94 EXTENDED_INQUIRY_GUARD_CHECK
= 0x04,
95 EXTENDED_INQUIRY_APPLICATION_CHECK
= 0x02,
96 EXTENDED_INQUIRY_REFERENCE_CHECK
= 0x01,
98 EXTENDED_INQUIRY_GROUP_SUPPORT
= 0x10,
99 EXTENDED_INQUIRY_PRIORITY_SUPPORT
= 0x8,
100 EXTENDED_INQUIRY_QUEUE_HEAD_SUPPORT
= 0x4,
101 EXTENDED_INQUIRY_ORDERED_SUPPORT
= 0x2,
102 EXTENDED_INQUIRY_SIMPLE_SUPPORT
= 0x1,
104 PERSISTENT_RESERVE_IN_SERVICE_ACTION_MASK
= 0x1f,
105 PERSISTENT_RESERVE_IN_READ_KEYS
= 0x0,
106 PERSISTENT_RESERVE_IN_READ_RESERVATION
= 0x1,
107 PERSISTENT_RESERVE_IN_REPORT_CAPABILITIES
= 0x2,
108 PERSISTENT_RESERVE_IN_READ_FULL_STATUS
= 0x3,
110 PERSISTENT_RESERVE_IN_CRH
= 0x10,
111 PERSISTENT_RESERVE_IN_SIP_C
= 0x8,
112 PERSISTENT_RESERVE_IN_ATP_C
= 0x4,
113 PERSISTENT_RESERVE_IN_PTPL_C
= 0x1, /* persistence through power loss */
114 PERSISTENT_RESERVE_IN_TMV
= 0x80, /* Type Mask Valid */
115 PERSISTENT_RESERVE_IN_PTPL_A
= 0x01, /* persistence through power loss activated */
117 PERSISTENT_RESERVE_IN_WR_EX_AR
= 0x80,
118 PERSISTENT_RESERVE_IN_EX_AC_RD
= 0x40,
119 PERSISTENT_RESERVE_IN_WR_AC_RD
= 0x20,
120 PERSISTENT_RESERVE_IN_EX_AC
= 0x08,
121 PERSISTENT_RESERVE_IN_WR_EX
= 0x02,
122 PERSISTENT_RESERVE_IN_EX_AC_AR
= 0x01,
127 SCSI_VERSION_SPC
= 0x03,
128 SCSI_VERSION_SPC2
= 0x04,
129 SCSI_VERSION_SPC3
= 0x05,
131 /* used in MODE_SENSE_10 */
132 DISABLE_BLOCK_DESCRIPTORS
= 0x08,
133 LONG_LBA_ACCEPTED
= 0x10,
134 PAGE_CONTROL_MASK
= 0xc0,
135 PAGE_CONTROL_CURRENT_VALUES
= 0x0,
136 PAGE_CONTROL_CHANGEABLE_VALUES
= 0x40,
137 PAGE_CONTROL_DEFAULT_VALUES
= 0x80,
138 PAGE_CONTROL_SAVAED_VALUES
= 0xc0,
139 PAGE_CODE_MASK
= 0x3f,
141 ASC_LUN_UNSUPPORTED
= 0x25,
142 ASCQ_LUN_UNSUPPORTED
= 0x0,
144 SCSI_SKEY_ILLEGAL_REQUEST
= 0x05
147 /* device return codes */
150 SCSI_CHECK_CONDITION
= 0x02
153 #endif /* !SCSI_CMD_CODES_H_ */