Annotation of embedaddon/istgt/src/istgt_scsi.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2008-2011 Daisuke Aoyama <aoyama@peach.ne.jp>.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17: * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24: * SUCH DAMAGE.
25: *
26: */
27:
28: #ifndef ISTGT_SCSI_H
29: #define ISTGT_SCSI_H
30:
31: typedef enum {
32: ISTGT_SCSI_STATUS_GOOD = 0x00,
33: ISTGT_SCSI_STATUS_CHECK_CONDITION = 0x02,
34: ISTGT_SCSI_STATUS_CONDITION_MET = 0x04,
35: ISTGT_SCSI_STATUS_BUSY = 0x08,
36: ISTGT_SCSI_STATUS_INTERMEDIATE = 0x10,
37: ISTGT_SCSI_STATUS_INTERMEDIATE_CONDITION_MET = 0x14,
38: ISTGT_SCSI_STATUS_RESERVATION_CONFLICT = 0x18,
39: ISTGT_SCSI_STATUS_Obsolete = 0x22,
40: ISTGT_SCSI_STATUS_TASK_SET_FULL = 0x28,
41: ISTGT_SCSI_STATUS_ACA_ACTIVE = 0x30,
42: ISTGT_SCSI_STATUS_TASK_ABORTED = 0x40,
43: } ISTGT_SCSI_STATUS;
44:
45: typedef enum {
46: ISTGT_SCSI_SENSE_NO_SENSE = 0x00,
47: ISTGT_SCSI_SENSE_RECOVERED_ERROR =0x01,
48: ISTGT_SCSI_SENSE_NOT_READY = 0x02,
49: ISTGT_SCSI_SENSE_MEDIUM_ERROR = 0x03,
50: ISTGT_SCSI_SENSE_HARDWARE_ERROR = 0x04,
51: ISTGT_SCSI_SENSE_ILLEGAL_REQUEST = 0x05,
52: ISTGT_SCSI_SENSE_UNIT_ATTENTION = 0x06,
53: ISTGT_SCSI_SENSE_DATA_PROTECT = 0x07,
54: ISTGT_SCSI_SENSE_BLANK_CHECK = 0x08,
55: ISTGT_SCSI_SENSE_VENDOR_SPECIFIC = 0x09,
56: ISTGT_SCSI_SENSE_COPY_ABORTED = 0x0a,
57: ISTGT_SCSI_SENSE_ABORTED_COMMAND = 0x0b,
58: ISTGT_SCSI_SENSE_VOLUME_OVERFLOW = 0x0d,
59: ISTGT_SCSI_SENSE_MISCOMPARE = 0x0e,
60: } ISTGT_SCSI_SENSE;
61:
62: typedef enum {
63: /* SPC3 related */
64: SPC_ACCESS_CONTROL_IN = 0x86,
65: SPC_ACCESS_CONTROL_OUT = 0x87,
66: //SPC_CHANGE_ALIASES = 0x000b00a4,
67: SPC_EXTENDED_COPY = 0x83,
68: SPC_INQUIRY = 0x12,
69: SPC_LOG_SELECT = 0x4c,
70: SPC_LOG_SENSE = 0x4d,
71: SPC_MODE_SELECT_6 = 0x15,
72: SPC_MODE_SELECT_10 = 0x55,
73: SPC_MODE_SENSE_6 = 0x1a,
74: SPC_MODE_SENSE_10 = 0x5a,
75: SPC_PERSISTENT_RESERVE_IN = 0x5e,
76: SPC_PERSISTENT_RESERVE_OUT = 0x5f,
77: SPC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e,
78: SPC_READ_ATTRIBUTE = 0x8c,
79: SPC_READ_BUFFER = 0x3c,
80: //SPC_READ_MEDIA_SERIAL_NUMBER = 0x000100ab,
81: SPC_RECEIVE_COPY_RESULTS = 0x84,
82: SPC_RECEIVE_DIAGNOSTIC_RESULTS = 0x1c,
83: //SPC_REPORT_ALIASES = 0x000b00a3,
84: //SPC_REPORT_DEVICE_IDENTIFIER = 0x000500a3,
85: SPC_REPORT_LUNS = 0xa0,
86: //SPC_REPORT_PRIORITY = 0x000e00a3,
87: //SPC_REPORT_SUPPORTED_OPERATION_CODES = 0x000c00a3,
88: //SPC_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS = 0x000d00a3,
89: //SPC_REPORT_TARGET_PORT_GROUPS = 0x000a00a3,
90: //SPC_REPORT_TIMESTAMP = 0x000f00a3,
91: SPC_REQUEST_SENSE = 0x03,
92: SPC_SEND_DIAGNOSTIC = 0x1d,
93: //SPC_SET_DEVICE_IDENTIFIER = 0x000600a4,
94: //SPC_SET_PRIORITY = 0x000e00a4,
95: //SPC_SET_TARGET_PORT_GROUPS = 0x000a00a4,
96: //SPC_SET_TIMESTAMP = 0x000f00a4,
97: SPC_TEST_UNIT_READY = 0x00,
98: SPC_WRITE_ATTRIBUTE = 0x8d,
99: SPC_WRITE_BUFFER = 0x3b,
100:
101: SPC_SERVICE_ACTION_IN_12 = 0xab,
102: SPC_SERVICE_ACTION_OUT_12 = 0xa9,
103: SPC_SERVICE_ACTION_IN_16 = 0x9e,
104: SPC_SERVICE_ACTION_OUT_16 = 0x9f,
105:
106: SPC_VARIABLE_LENGTH = 0x7f,
107:
108: SPC_MO_CHANGE_ALIASES = 0x0b,
109: SPC_MO_SET_DEVICE_IDENTIFIER = 0x06,
110: SPC_MO_SET_PRIORITY = 0x0e,
111: SPC_MO_SET_TARGET_PORT_GROUPS = 0x0a,
112: SPC_MO_SET_TIMESTAMP = 0x0f,
113: SPC_MI_REPORT_ALIASES = 0x0b,
114: SPC_MI_REPORT_DEVICE_IDENTIFIER = 0x05,
115: SPC_MI_REPORT_PRIORITY = 0x0e,
116: SPC_MI_REPORT_SUPPORTED_OPERATION_CODES = 0x0c,
117: SPC_MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS = 0x0d,
118: SPC_MI_REPORT_TARGET_PORT_GROUPS = 0x0a,
119: SPC_MI_REPORT_TIMESTAMP = 0x0f,
120:
121: /* SPC2 related (Obsolete) */
122: SPC2_RELEASE_6 = 0x17,
123: SPC2_RELEASE_10 = 0x57,
124: SPC2_RESERVE_6 = 0x16,
125: SPC2_RESERVE_10 = 0x56,
126: } SPC_OPCODE;
127:
128: typedef enum {
129: SCC_MAINTENANCE_IN = 0xa3,
130: SCC_MAINTENANCE_OUT = 0xa4,
131: } SCC_OPCODE;
132:
133: typedef enum {
134: SBC_COMPARE_AND_WRITE = 0x89,
135: SBC_FORMAT_UNIT = 0x04,
136: SBC_GET_LBA_STATUS = 0x0012009e,
137: SBC_ORWRITE_16 = 0x8b,
138: //SBC_ORWRITE_32 = 0x000e007f,
139: SBC_PRE_FETCH_10 = 0x34,
140: SBC_PRE_FETCH_16 = 0x90,
141: SBC_READ_6 = 0x08,
142: SBC_READ_10 = 0x28,
143: SBC_READ_12 = 0xa8,
144: SBC_READ_16 = 0x88,
145: //SBC_READ_32 = 0x0009007f,
146: SBC_READ_ATTRIBUTE = 0x8c,
147: SBC_READ_BUFFER = 0x3c,
148: SBC_READ_CAPACITY_10 = 0x25,
149: //SBC_READ_CAPACITY_16 = 0x0010009e,
150: SBC_READ_DEFECT_DATA_10 = 0x37,
151: SBC_READ_DEFECT_DATA_12 = 0xb7,
152: SBC_READ_LONG_10 = 0x3e,
153: //SBC_READ_LONG_16 = 0x0011009e,
154: SBC_REASSIGN_BLOCKS = 0x07,
155: //SBC_REPORT_REFERRALS = 0x0013009e,
156: SBC_SANITIZE = 0x48,
157: SBC_START_STOP_UNIT = 0x1b,
158: SBC_SYNCHRONIZE_CACHE_10 = 0x35,
159: SBC_SYNCHRONIZE_CACHE_16 = 0x91,
160: SBC_UNMAP = 0x42,
161: SBC_VERIFY_10 = 0x2f,
162: SBC_VERIFY_12 = 0xaf,
163: SBC_VERIFY_16 = 0x8f,
164: //SBC_VERIFY_32 = 0x000a007f,
165: SBC_WRITE_6 = 0x0a,
166: SBC_WRITE_10 = 0x2a,
167: SBC_WRITE_12 = 0xaa,
168: SBC_WRITE_16 = 0x8a,
169: //SBC_WRITE_32 = 0x000b007f,
170: SBC_WRITE_AND_VERIFY_10 = 0x2e,
171: SBC_WRITE_AND_VERIFY_12 = 0xae,
172: SBC_WRITE_AND_VERIFY_16 = 0x8e,
173: //SBC_WRITE_AND_VERIFY_32 = 0x000c007f,
174: SBC_WRITE_LONG_10 = 0x3f,
175: //SBC_WRITE_LONG_16 = 0x0011009f,
176: SBC_WRITE_SAME_10 = 0x41,
177: SBC_WRITE_SAME_16 = 0x93,
178: //SBC_WRITE_SAME_32 = 0x000d007f,
179: SBC_XDREAD_10 = 0x52,
180: //SBC_XDREAD_32 = 0x0003007f,
181: SBC_XDWRITE_10 = 0x50,
182: //SBC_XDWRITE_32 = 0x0004007f,
183: SBC_XDWRITEREAD_10 = 0x53,
184: //SBC_XDWRITEREAD_32 = 0x0007007f,
185: SBC_XPWRITE_10 = 0x51,
186: //SBC_XPWRITE_32 = 0x0006007f,
187:
188: SBC_SAI_READ_CAPACITY_16 = 0x10,
189: SBC_SAI_READ_LONG_16 = 0x11,
190: SBC_SAO_WRITE_LONG_16 = 0x11,
191:
192: SBC_VL_READ_32 = 0x0009,
193: SBC_VL_VERIFY_32 = 0x000a,
194: SBC_VL_WRITE_32 = 0x000b,
195: SBC_VL_WRITE_AND_VERIFY_32 = 0x000c,
196: SBC_VL_WRITE_SAME_32 = 0x000d,
197: SBC_VL_XDREAD_32 = 0x0003,
198: SBC_VL_XDWRITE_32 = 0x0004,
199: SBC_VL_XDWRITEREAD_32 = 0x0007,
200: SBC_VL_XPWRITE_32 = 0x0006,
201: } SBC_OPCODE;
202:
203: typedef enum {
204: /* MMC6 */
205: MMC_READ_DISC_STRUCTURE = 0xad,
206:
207: /* MMC4 */
208: MMC_BLANK = 0xa1,
209: MMC_CLOSE_TRACK_SESSION = 0x5b,
210: MMC_ERASE_10 = 0x2c,
211: MMC_FORMAT_UNIT = 0x04,
212: MMC_GET_CONFIGURATION = 0x46,
213: MMC_GET_EVENT_STATUS_NOTIFICATION = 0x4a,
214: MMC_GET_PERFORMANCE = 0xac,
215: MMC_INQUIRY = 0x12,
216: MMC_LOAD_UNLOAD_MEDIUM = 0xa6,
217: MMC_MECHANISM_STATUS = 0xbd,
218: MMC_MODE_SELECT_10 = 0x55,
219: MMC_MODE_SENSE_10 = 0x5a,
220: MMC_PAUSE_RESUME = 0x4b,
221: MMC_PLAY_AUDIO_10 = 0x45,
222: MMC_PLAY_AUDIO_12 = 0xa5,
223: MMC_PLAY_AUDIO_MSF = 0x47,
224: MMC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e,
225: MMC_READ_10 = 0x28,
226: MMC_READ_12 = 0xa8,
227: MMC_READ_BUFFER = 0x3c,
228: MMC_READ_BUFFER_CAPACITY = 0x5c,
229: MMC_READ_CAPACITY = 0x25,
230: MMC_READ_CD = 0xbe,
231: MMC_READ_CD_MSF = 0xb9,
232: MMC_READ_DISC_INFORMATION = 0x51,
233: MMC_READ_DVD_STRUCTURE = 0xad,
234: MMC_READ_FORMAT_CAPACITIES = 0x23,
235: MMC_READ_SUB_CHANNEL = 0x42,
236: MMC_READ_TOC_PMA_ATIP = 0x43,
237: MMC_READ_TRACK_INFORMATION = 0x52,
238: MMC_REPAIR_TRACK = 0x58,
239: MMC_REPORT_KEY = 0xa4,
240: MMC_REQUEST_SENSE = 0x03,
241: MMC_RESERVE_TRACK = 0x53,
242: MMC_SCAN = 0xba,
243: MMC_SEEK_10 = 0x2b,
244: MMC_SEND_CUE_SHEET = 0x5d,
245: MMC_SEND_DVD_STRUCTURE = 0xbf,
246: MMC_SEND_KEY = 0xa3,
247: MMC_SEND_OPC_INFORMATION = 0x54,
248: MMC_SET_CD_SPEED = 0xbb,
249: MMC_SET_READ_AHEAD = 0xa7,
250: MMC_SET_STREAMING = 0xb6,
251: MMC_START_STOP_UNIT = 0x1b,
252: MMC_STOP_PLAY_SCAN = 0x4e,
253: MMC_SYNCHRONIZE_CACHE = 0x35,
254: MMC_TEST_UNIT_READY = 0x00,
255: MMC_VERIFY_10 = 0x2f,
256: MMC_WRITE_10 = 0xa2,
257: MMC_WRITE_12 = 0xaa,
258: MMC_WRITE_AND_VERIFY_10 = 0x2e,
259: MMC_WRITE_BUFFER = 0x3b,
260: } MMC_OPCODE;
261:
262: typedef enum {
263: SSC_ERASE_6 = 0x19,
264: SSC_FORMAT_MEDIUM = 0x04,
265: SSC_LOAD_UNLOAD = 0x1b,
266: SSC_LOCATE_10 = 0x2b,
267: SSC_LOCATE_16 = 0x92,
268: SSC_MOVE_MEDIUM_ATTACHED = 0xa7,
269: SSC_READ_6 = 0x08,
270: SSC_READ_BLOCK_LIMITS = 0x05,
271: SSC_READ_ELEMENT_STATUS_ATTACHED = 0xb4,
272: SSC_READ_POSITION = 0x34,
273: SSC_READ_REVERSE_6 = 0x0f,
274: SSC_RECOVER_BUFFERED_DATA = 0x14,
275: SSC_REPORT_DENSITY_SUPPORT = 0x44,
276: SSC_REWIND = 0x01,
277: SSC_SET_CAPACITY = 0x0b,
278: SSC_SPACE_6 = 0x11,
279: SSC_SPACE_16 = 0x91,
280: SSC_VERIFY_6 = 0x13,
281: SSC_WRITE_6 = 0x0a,
282: SSC_WRITE_FILEMARKS_6 = 0x10,
283: } SSC_OPCODE;
284:
285: typedef enum {
286: SPC_VPD_DEVICE_IDENTIFICATION = 0x83,
287: SPC_VPD_EXTENDED_INQUIRY_DATA = 0x86,
288: SPC_VPD_MANAGEMENT_NETWORK_ADDRESSES = 0x85,
289: SPC_VPD_MODE_PAGE_POLICY = 0x87,
290: SPC_VPD_SCSI_PORTS = 0x88,
291: SPC_VPD_SOFTWARE_INTERFACE_IDENTIFICATION = 0x84,
292: SPC_VPD_SUPPORTED_VPD_PAGES = 0x00,
293: SPC_VPD_UNIT_SERIAL_NUMBER = 0x80,
294: } SPC_VPD;
295:
296: enum {
297: SPC_PERIPHERAL_DEVICE_TYPE_DISK = 0x00,
298: SPC_PERIPHERAL_DEVICE_TYPE_TAPE = 0x01,
299: SPC_PERIPHERAL_DEVICE_TYPE_DVD = 0x05,
300: SPC_PERIPHERAL_DEVICE_TYPE_CHANGER = 0x08,
301:
302: SPC_VERSION_NONE = 0x00,
303: SPC_VERSION_SPC = 0x03,
304: SPC_VERSION_SPC2 = 0x04,
305: SPC_VERSION_SPC3 = 0x05,
306: SPC_VERSION_SPC4 = 0x06,
307:
308: SPC_PROTOCOL_IDENTIFIER_FC = 0x00,
309: SPC_PROTOCOL_IDENTIFIER_PSCSI = 0x01,
310: SPC_PROTOCOL_IDENTIFIER_SSA = 0x02,
311: SPC_PROTOCOL_IDENTIFIER_IEEE1394 = 0x03,
312: SPC_PROTOCOL_IDENTIFIER_RDMA = 0x04,
313: SPC_PROTOCOL_IDENTIFIER_ISCSI = 0x05,
314: SPC_PROTOCOL_IDENTIFIER_SAS = 0x06,
315: SPC_PROTOCOL_IDENTIFIER_ADT = 0x07,
316: SPC_PROTOCOL_IDENTIFIER_ATA = 0x08,
317:
318: SPC_VPD_CODE_SET_BINARY = 0x01,
319: SPC_VPD_CODE_SET_ASCII = 0x02,
320: SPC_VPD_CODE_SET_UTF8 = 0x03,
321:
322: SPC_VPD_ASSOCIATION_LOGICAL_UNIT = 0x00,
323: SPC_VPD_ASSOCIATION_TARGET_PORT = 0x01,
324: SPC_VPD_ASSOCIATION_TARGET_DEVICE = 0x02,
325:
326: SPC_VPD_IDENTIFIER_TYPE_VENDOR_SPECIFIC = 0x00,
327: SPC_VPD_IDENTIFIER_TYPE_T10_VENDOR_ID = 0x01,
328: SPC_VPD_IDENTIFIER_TYPE_EUI64 = 0x02,
329: SPC_VPD_IDENTIFIER_TYPE_NAA = 0x03,
330: SPC_VPD_IDENTIFIER_TYPE_RELATIVE_TARGET_PORT = 0x04,
331: SPC_VPD_IDENTIFIER_TYPE_TARGET_PORT_GROUP = 0x05,
332: SPC_VPD_IDENTIFIER_TYPE_LOGICAL_UNIT_GROUP = 0x06,
333: SPC_VPD_IDENTIFIER_TYPE_MD5_LOGICAL_UNIT = 0x07,
334: SPC_VPD_IDENTIFIER_TYPE_SCSI_NAME = 0x08,
335: };
336:
337: #endif /* ISTGT_SCSI_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>