OneCore⢠Storage SDK Release 11.2
User Space FC/FCoE Target RAMD Driver (Uspace ocs_fc_ramd)
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
scsi_cmds.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011-2015, Emulex
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 are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
*
11
* 2. Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
*
15
* 3. Neither the name of the copyright holder nor the names of its contributors
16
* may be used to endorse or promote products derived from this software
17
* without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
* POSSIBILITY OF SUCH DAMAGE.
30
*
31
*/
32
33
/**
34
* @file
35
* Define all SCSI command byte values
36
*/
37
38
39
// scsi_cmds.h - borrowed from bridge f/w
40
#if !defined(__SCSI_CMDS_H__)
41
#define __SCSI_CMDS_H__
42
#define SCSI_ATA_PASSTHRU12 0xA1
43
#define SCSI_ATA_PASSTHRU16 0x85
44
#define SCSI_E6_SMART_DUMP 0xE6
45
#define SCSI_F7_DUMP_CLEAR_RET_TRIGR 0xF7
46
#define SCSI_CHANGE_DEFINITION 0x40
47
#define SCSI_FORMAT_UNIT 0x04
48
#define SCSI_INQUIRY 0x12
49
#define SCSI_LOCK_UNLOCK_CACHE10 0x36
50
#define SCSI_LOCK_UNLOCK_CACHE16 0x92
51
#define SCSI_LOG_SELECT 0x4C
52
#define SCSI_LOG_SENSE 0x4D
53
#define SCSI_MODE_SELECT10 0x55
54
#define SCSI_MODE_SELECT6 0x15
55
#define SCSI_MODE_SENSE10 0x5A
56
#define SCSI_MODE_SENSE6 0x1A
57
#define SCSI_MOVE_MEDIUM 0xA7
58
#define SCSI_PERSISTENT_RESERVE_IN 0x5E
59
#define SCSI_PERSISTENT_RESERVE_OUT 0x5F
60
#define SCSI_PRE_FETCH10 0x34
61
#define SCSI_PRE_FETCH16 0x90
62
#define SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
63
#define SCSI_READ_ATTRIBUTE 0x8C
64
#define SCSI_READ_BUFFER 0x3C
65
#define SCSI_READ_CAPACITY10 0x25
66
#define SCSI_READ_DEFECT_DATA10 0x37
67
#define SCSI_READ_DEFECT_DATA12 0xB7
68
#define SCSI_READ_ELEMENT_STATUS 0xB4
69
#define SCSI_READ_LONG10 0x3E
70
#define SCSI_READ10 0x28
71
#define SCSI_READ12 0xA8
72
#define SCSI_READ16 0x88
73
#define SCSI_READ6 0x08
74
#define SCSI_REASSIGN_BLOCKS 0x07
75
#define SCSI_REBUILD16 0x81
76
#define SCSI_RECV_DIAGNOSTIC_RESULTS 0x1C
77
#define SCSI_REGENERATE16 0x82
78
#define SCSI_RELEASE10 0x57
79
#define SCSI_RELEASE6 0x17
80
#define SCSI_REPORT_LUNS 0xA0
81
#define SCSI_MAINTENANCE_IN 0xA3
82
#define SCSI_MAINTENANCE_OUT 0xA4
83
#define SCSI_READ_MEDIA_SERIAL_NUMBER 0xAB
84
#define SCSI_REQUEST_SENSE 0x03
85
#define SCSI_RESERVE10 0x56
86
#define SCSI_RESERVE6 0x16
87
#define SCSI_REZERO_UNIT 0x01
88
#define SCSI_SECURITY_PROTOCOL_IN 0xA2
89
#define SCSI_SECURITY_PROTOCOL_OUT 0xB5
90
#define SCSI_SEEK6 0x0B
91
#define SCSI_SEEK10 0x2B
92
#define SCSI_SEND_DIAGNOSTIC 0x1D
93
#define SCSI_SERVICE_ACTION_IN16 0x9E
94
#define SCSI_SERVICE_ACTION_OUT16 0x9F
95
#define SCSI_SET_LIMITS10 0x33
96
#define SCSI_SET_LIMITS12 0xB3
97
#define SCSI_START_STOP_UNIT 0x1B
98
#define SCSI_SYNCHRONIZE_CACHE10 0x35
99
#define SCSI_SYNCHRONIZE_CACHE16 0x91
100
#define SCSI_TEST_UNIT_READY 0x00
101
#define SCSI_UNMAP 0x42
102
#define SCSI_VARIABLE_LEN_CDB 0x7F
103
#define SCSI_VERIFY10 0x2F
104
#define SCSI_VERIFY12 0xAF
105
#define SCSI_VERIFY16 0x8F
106
#define SCSI_WRITE_AND_VERIFY10 0x2E
107
#define SCSI_WRITE_AND_VERIFY12 0xAE
108
#define SCSI_WRITE_AND_VERIFY16 0x8E
109
#define SCSI_WRITE_BUFFER 0x3B
110
#define SCSI_WRITE_LONG10 0x3F
111
#define SCSI_WRITE_SAME10 0x41
112
#define SCSI_WRITE_SAME16 0x93
113
#define SCSI_WRITE10 0x2A
114
#define SCSI_WRITE12 0xAA
115
#define SCSI_WRITE16 0x8A
116
#define SCSI_WRITE6 0x0A
117
#define SCSI_XDREAD10 0x52
118
#define SCSI_XDWRITE_EXTENDED16 0x80
119
#define SCSI_XDWRITE10 0x50
120
#define SCSI_XDWRITEREAD10 0x53
121
#define SCSI_XPWRITE10 0x51
122
123
#ifdef EMC_SKIP_MASK_LONG_ENABLE
124
#define SCSI_EMC_SKIP_MASK_LONG 0xCA
125
#endif
126
127
#ifdef ENABLE_SCSI_PASSTHRU_FRAMEWORK
128
#define SCSI_SAMSUNG_VU_CMD_D0 0xD0
129
#define SCSI_SAMSUNG_VU_CMD_DA 0xDA
130
#endif
131
132
#ifdef E7_ADD_DEFECT_LIST_ENABLE
133
#define SCSI_E7_ADD_DEFECT_LIST 0xE7
134
#endif
135
136
#ifdef EMC_SKIP_MASK_ENABLE
137
#define SCSI_EMC_SKIP_MASK 0xEA
138
#endif
139
140
#ifdef IBM_SKIP_MASK_ENABLE
141
#define SCSI_IBM_SKIP_MASK_READ 0xE8
142
#define SCSI_IBM_SKIP_MASK_WRITE 0xEA
143
#endif
144
145
#ifdef IBM_READ10_STATE_SAVE
146
#define READ10_STATE_SAVE_MASK 0xFFFFFF00
147
#endif
148
149
#define SCSI_INVALID_CDB 0xFF
150
151
#define SCSI_READ6_WRITE6_MAX_XFER_LEN 256
152
153
/* Service Action definitions op code: 0x7F */
154
#define SCSI_VAR_CMD_SVC_ACT_READ32 0x09
155
#define SCSI_VAR_CMD_SVC_ACT_VERIFY32 0x0A
156
#define SCSI_VAR_CMD_SVC_ACT_WRITE32 0x0B
157
#define SCSI_VAR_CMD_SVC_ACT_WRITE_VERIFY32 0x0C
158
#define SCSI_VAR_CMD_SVC_ACT_WRITE_SAME32 0x0D
159
160
/* Service Action definitions op code: 0x9E */
161
#define SCSI_SVC_ACTION16_READ_CAPACITY 0x10
162
#define SCSI_SVC_ACTION16_READ_LONG 0x11
163
#define SCSI_SVC_ACTION16_GET_LBA_STATUS 0x12
164
#define SCSI_SVC_ACTION16_REPORT_REFERRALS 0x13
165
166
/* Service Action definitions op code: 0x9F */
167
#define SCSI_SVC_ACTION16_WRITE_LONG 0x11
168
169
170
/* MAINTENANCE IN op code 0xA3 service actions */
171
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_IDENTIFYING_INFORMATION 0x05
172
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_TARGET_PORT_GROUPS 0x0A
173
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_ALIASES 0x0B
174
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_SUPPORTED_OPERATION_CODES 0x0C
175
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0D
176
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_PRIORITY 0x0E
177
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_REPORT_TIMESTAMP 0x0F
178
#define SCSI_MAINTENANCE_IN_SERVICE_ACTION_MANAGEMENT_PROTOCOL_IN 0x10
179
180
/* MAINTENANCE OUT op code 0xA4 service actions */
181
#define SCSI_MAINTENANCE_OUT_SERVICE_ACTION_SET_IDENTIFYING_INFORMATION 0x06
182
#define SCSI_MAINTENANCE_OUT_SERVICE_ACTION_SET_TARGET_PORT_GROUPS 0x0A
183
#define SCSI_MAINTENANCE_OUT_SERVICE_ACTION_CHANGE_ALIASES 0x0B
184
#define SCSI_MAINTENANCE_OUT_SERVICE_ACTION_SET_PRIORITY 0x0E
185
#define SCSI_MAINTENANCE_OUT_SERVICE_ACTION_SET_TIMESTAMP 0x0F
186
#define SCSI_MAINTENANCE_OUT_SERVICE_ACTION_MANAGEMENT_PROTOCOL_OUT 0x10
187
188
189
/* CDB command/sizes bit positions */
190
/* ubit16 */
191
/* | CDB SIZE | IO CMD TYPE | */
192
/* ======================================================================| */
193
/* | 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 | */
194
/* | RV RV RV 32 16 12 10 6 | RV UN SM WS WV V W R | */
195
/* ======================================================================| */
196
/* RV=reserved, SM=Skip Mask, WS=Write Same, WV=Write/Verify, V=Verify, W=Write, R=Read */
197
/* UN = Write Same Unmap */
198
199
#define SCSI_CDB_CMD_READ (1 << 0)
200
#define SCSI_CDB_CMD_WRITE (1 << 1)
201
#define SCSI_CDB_CMD_VERIFY (1 << 2)
202
#define SCSI_CDB_CMD_WRITE_VERIFY (1 << 3)
203
#define SCSI_CDB_CMD_WRITE_SAME (1 << 4)
204
#define SCSI_CDB_CMD_SKIP_MASK (1 << 5)
205
#define SCSI_CDB_CMD_WRITE_SAME_UNMAP (1 << 6)
206
#define SCSI_6_BYTE_CDB (1 << 8)
207
#define SCSI_10_BYTE_CDB (1 << 9)
208
#define SCSI_12_BYTE_CDB (1 << 10)
209
#define SCSI_16_BYTE_CDB (1 << 11)
210
#define SCSI_32_BYTE_CDB (1 << 12)
211
212
#define SCSI_CDB_READ_WRITE_MASK (SCSI_CDB_CMD_READ | SCSI_CDB_CMD_WRITE)
213
#define SCSI_CDB_WRVERIFY_VERIFY_MASK (SCSI_CDB_CMD_WRITE_VERIFY | SCSI_CDB_CMD_VERIFY)
214
#define SCSI_CDB_10_16_32_BYTE_MASK (SCSI_10_BYTE_CDB | SCSI_16_BYTE_CDB | SCSI_32_BYTE_CDB)
215
#define SCSI_CDB_WRITE_CMDS_MASK (SCSI_CDB_CMD_WRITE | SCSI_CDB_CMD_WRITE_VERIFY | SCSI_CDB_CMD_WRITE_SAME)
216
217
218
219
220
/* control definitions */
221
#define SCSI_LINK 0x01
222
#define SCSI_NACA 0x04
223
#define VS_CONTROL_MASK 0xC0
224
#define SCSI_CONTROL_BYTE_MASK 0xC7
225
226
/* flag definitions */
227
#define SCSI_DPO 0x10
228
#define SCSI_FUA 0x08
229
#define SCSI_CORRCT 0x02
230
#define SCSI_EBP 0x04
231
#define SCSI_BLKVFY 0x04
232
#define SCSI_BYTCHK 0x02
233
#define SCSI_FUA_NV 0x02
234
235
/* EDC definitions */
236
#define SCSI_PROTECT_SHIFT 5
237
#define SCSI_PROTECT_MASK (0x7<<SCSI_PROTECT_SHIFT)
238
#define SCSI_PROTECT0 0
239
#define SCSI_PROTECT1 1
240
#define SCSI_PROTECT2 2
241
#define SCSI_PROTECT3 3
242
#define SCSI_PROTECT4 4
243
#define SCSI_PROTECT5 5
244
245
// EMC defines CDB byte 1, bit 7 as the "low priority" bit for Read (10), Write (10),
246
// Write Verify (10), Verify (10), and EMC Skip Mask. NOTE: this conflicts with the
247
// PROTECT fields for most of those commands.
248
#define EMC_SCSI_LOW_PRIORITY 0x80
249
250
251
// Report Support Opcodes
252
#define SCSI_RPT_SUPT_OP_CODES_CMD_TO_DESC_LEN 0x000A
253
#define SCSI_RPT_SUPT_OP_CODES_DATA_HDR_LEN 4
254
#define SCSI_RPT_SUPT_OP_CODES_OPTION_00 0
255
#define SCSI_RPT_SUPT_OP_CODES_OPTION_01 1
256
#define SCSI_RPT_SUPT_OP_CODES_OPTION_02 2
257
#define SCSI_RPT_SUPT_OP_CODES_NO_INFO 0
258
#define SCSI_RPT_SUPT_OP_CODES_NO_SUPPORT 1
259
#define SCSI_RPT_SUPT_OP_CODES_STD_SUPPORT 3
260
#define SCSI_RPT_SUPT_OP_CODES_VS_SUPPORT 5
261
#define SCSI_RPT_SUPT_OP_CODES_TIMEOUT_DESC_LEN 12
262
263
/* SCSI command status */
264
#define SCSI_STATUS_GOOD 0x00
265
#define SCSI_STATUS_CHECK_CONDITION 0x02
266
#define SCSI_STATUS_CONDITION_MET 0x04
267
#define SCSI_STATUS_BUSY 0x08
268
#define SCSI_STATUS_RESERVATION_CONFLICT 0x18
269
#define SCSI_STATUS_TASK_SET_FULL 0x28
270
#define SCSI_STATUS_ACA_ACTIVE 0x30
271
#define SCSI_STATUS_TASK_ABORTED 0x40
272
273
274
#endif // __SCSI_CMDS_H__
common
ocs
scsi_cmds.h