]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/include/spdk/scsi_spec.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / include / spdk / scsi_spec.h
1 /*-
2 * BSD LICENSE
3 *
4 * Copyright (c) Intel Corporation.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 /**
35 * \file
36 * SCSI specification definitions
37 */
38
39 #ifndef SPDK_SCSI_SPEC_H
40 #define SPDK_SCSI_SPEC_H
41
42 #include "spdk/stdinc.h"
43
44 #include "spdk/assert.h"
45
46 enum spdk_scsi_group_code {
47 SPDK_SCSI_6BYTE_CMD = 0x00,
48 SPDK_SCSI_10BYTE_CMD = 0x20,
49 SPDK_SCSI_10BYTE_CMD2 = 0x40,
50 SPDK_SCSI_16BYTE_CMD = 0x80,
51 SPDK_SCSI_12BYTE_CMD = 0xa0,
52 };
53
54 #define SPDK_SCSI_GROUP_MASK 0xe0
55 #define SPDK_SCSI_OPCODE_MASK 0x1f
56
57 enum spdk_scsi_status {
58 SPDK_SCSI_STATUS_GOOD = 0x00,
59 SPDK_SCSI_STATUS_CHECK_CONDITION = 0x02,
60 SPDK_SCSI_STATUS_CONDITION_MET = 0x04,
61 SPDK_SCSI_STATUS_BUSY = 0x08,
62 SPDK_SCSI_STATUS_INTERMEDIATE = 0x10,
63 SPDK_SCSI_STATUS_INTERMEDIATE_CONDITION_MET = 0x14,
64 SPDK_SCSI_STATUS_RESERVATION_CONFLICT = 0x18,
65 SPDK_SCSI_STATUS_Obsolete = 0x22,
66 SPDK_SCSI_STATUS_TASK_SET_FULL = 0x28,
67 SPDK_SCSI_STATUS_ACA_ACTIVE = 0x30,
68 SPDK_SCSI_STATUS_TASK_ABORTED = 0x40,
69 };
70
71 enum spdk_scsi_sense {
72 SPDK_SCSI_SENSE_NO_SENSE = 0x00,
73 SPDK_SCSI_SENSE_RECOVERED_ERROR = 0x01,
74 SPDK_SCSI_SENSE_NOT_READY = 0x02,
75 SPDK_SCSI_SENSE_MEDIUM_ERROR = 0x03,
76 SPDK_SCSI_SENSE_HARDWARE_ERROR = 0x04,
77 SPDK_SCSI_SENSE_ILLEGAL_REQUEST = 0x05,
78 SPDK_SCSI_SENSE_UNIT_ATTENTION = 0x06,
79 SPDK_SCSI_SENSE_DATA_PROTECT = 0x07,
80 SPDK_SCSI_SENSE_BLANK_CHECK = 0x08,
81 SPDK_SCSI_SENSE_VENDOR_SPECIFIC = 0x09,
82 SPDK_SCSI_SENSE_COPY_ABORTED = 0x0a,
83 SPDK_SCSI_SENSE_ABORTED_COMMAND = 0x0b,
84 SPDK_SCSI_SENSE_VOLUME_OVERFLOW = 0x0d,
85 SPDK_SCSI_SENSE_MISCOMPARE = 0x0e,
86 };
87
88 enum spdk_scsi_asc {
89 SPDK_SCSI_ASC_NO_ADDITIONAL_SENSE = 0x00,
90 SPDK_SCSI_ASC_PERIPHERAL_DEVICE_WRITE_FAULT = 0x03,
91 SPDK_SCSI_ASC_LOGICAL_UNIT_NOT_READY = 0x04,
92 SPDK_SCSI_ASC_WARNING = 0x0b,
93 SPDK_SCSI_ASC_LOGICAL_BLOCK_GUARD_CHECK_FAILED = 0x10,
94 SPDK_SCSI_ASC_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED = 0x10,
95 SPDK_SCSI_ASC_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED = 0x10,
96 SPDK_SCSI_ASC_UNRECOVERED_READ_ERROR = 0x11,
97 SPDK_SCSI_ASC_MISCOMPARE_DURING_VERIFY_OPERATION = 0x1d,
98 SPDK_SCSI_ASC_INVALID_COMMAND_OPERATION_CODE = 0x20,
99 SPDK_SCSI_ASC_ACCESS_DENIED = 0x20,
100 SPDK_SCSI_ASC_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE = 0x21,
101 SPDK_SCSI_ASC_INVALID_FIELD_IN_CDB = 0x24,
102 SPDK_SCSI_ASC_LOGICAL_UNIT_NOT_SUPPORTED = 0x25,
103 SPDK_SCSI_ASC_WRITE_PROTECTED = 0x27,
104 SPDK_SCSI_ASC_FORMAT_COMMAND_FAILED = 0x31,
105 SPDK_SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED = 0x39,
106 SPDK_SCSI_ASC_INTERNAL_TARGET_FAILURE = 0x44,
107 };
108
109 enum spdk_scsi_ascq {
110 SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE = 0x00,
111 SPDK_SCSI_ASCQ_BECOMING_READY = 0x01,
112 SPDK_SCSI_ASCQ_FORMAT_COMMAND_FAILED = 0x01,
113 SPDK_SCSI_ASCQ_LOGICAL_BLOCK_GUARD_CHECK_FAILED = 0x01,
114 SPDK_SCSI_ASCQ_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED = 0x02,
115 SPDK_SCSI_ASCQ_NO_ACCESS_RIGHTS = 0x02,
116 SPDK_SCSI_ASCQ_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED = 0x03,
117 SPDK_SCSI_ASCQ_POWER_LOSS_EXPECTED = 0x08,
118 SPDK_SCSI_ASCQ_INVALID_LU_IDENTIFIER = 0x09,
119 };
120
121 enum spdk_spc_opcode {
122 /* SPC3 related */
123 SPDK_SPC_ACCESS_CONTROL_IN = 0x86,
124 SPDK_SPC_ACCESS_CONTROL_OUT = 0x87,
125 SPDK_SPC_EXTENDED_COPY = 0x83,
126 SPDK_SPC_INQUIRY = 0x12,
127 SPDK_SPC_LOG_SELECT = 0x4c,
128 SPDK_SPC_LOG_SENSE = 0x4d,
129 SPDK_SPC_MODE_SELECT_6 = 0x15,
130 SPDK_SPC_MODE_SELECT_10 = 0x55,
131 SPDK_SPC_MODE_SENSE_6 = 0x1a,
132 SPDK_SPC_MODE_SENSE_10 = 0x5a,
133 SPDK_SPC_PERSISTENT_RESERVE_IN = 0x5e,
134 SPDK_SPC_PERSISTENT_RESERVE_OUT = 0x5f,
135 SPDK_SPC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e,
136 SPDK_SPC_READ_ATTRIBUTE = 0x8c,
137 SPDK_SPC_READ_BUFFER = 0x3c,
138 SPDK_SPC_RECEIVE_COPY_RESULTS = 0x84,
139 SPDK_SPC_RECEIVE_DIAGNOSTIC_RESULTS = 0x1c,
140 SPDK_SPC_REPORT_LUNS = 0xa0,
141 SPDK_SPC_REQUEST_SENSE = 0x03,
142 SPDK_SPC_SEND_DIAGNOSTIC = 0x1d,
143 SPDK_SPC_TEST_UNIT_READY = 0x00,
144 SPDK_SPC_WRITE_ATTRIBUTE = 0x8d,
145 SPDK_SPC_WRITE_BUFFER = 0x3b,
146
147 SPDK_SPC_SERVICE_ACTION_IN_12 = 0xab,
148 SPDK_SPC_SERVICE_ACTION_OUT_12 = 0xa9,
149 SPDK_SPC_SERVICE_ACTION_IN_16 = 0x9e,
150 SPDK_SPC_SERVICE_ACTION_OUT_16 = 0x9f,
151
152 SPDK_SPC_VARIABLE_LENGTH = 0x7f,
153
154 SPDK_SPC_MO_CHANGE_ALIASES = 0x0b,
155 SPDK_SPC_MO_SET_DEVICE_IDENTIFIER = 0x06,
156 SPDK_SPC_MO_SET_PRIORITY = 0x0e,
157 SPDK_SPC_MO_SET_TARGET_PORT_GROUPS = 0x0a,
158 SPDK_SPC_MO_SET_TIMESTAMP = 0x0f,
159 SPDK_SPC_MI_REPORT_ALIASES = 0x0b,
160 SPDK_SPC_MI_REPORT_DEVICE_IDENTIFIER = 0x05,
161 SPDK_SPC_MI_REPORT_PRIORITY = 0x0e,
162 SPDK_SPC_MI_REPORT_SUPPORTED_OPERATION_CODES = 0x0c,
163 SPDK_SPC_MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS = 0x0d,
164 SPDK_SPC_MI_REPORT_TARGET_PORT_GROUPS = 0x0a,
165 SPDK_SPC_MI_REPORT_TIMESTAMP = 0x0f,
166
167 /* SPC2 related (Obsolete) */
168 SPDK_SPC2_RELEASE_6 = 0x17,
169 SPDK_SPC2_RELEASE_10 = 0x57,
170 SPDK_SPC2_RESERVE_6 = 0x16,
171 SPDK_SPC2_RESERVE_10 = 0x56,
172 };
173
174 enum spdk_scc_opcode {
175 SPDK_SCC_MAINTENANCE_IN = 0xa3,
176 SPDK_SCC_MAINTENANCE_OUT = 0xa4,
177 };
178
179 enum spdk_sbc_opcode {
180 SPDK_SBC_COMPARE_AND_WRITE = 0x89,
181 SPDK_SBC_FORMAT_UNIT = 0x04,
182 SPDK_SBC_GET_LBA_STATUS = 0x0012009e,
183 SPDK_SBC_ORWRITE_16 = 0x8b,
184 SPDK_SBC_PRE_FETCH_10 = 0x34,
185 SPDK_SBC_PRE_FETCH_16 = 0x90,
186 SPDK_SBC_READ_6 = 0x08,
187 SPDK_SBC_READ_10 = 0x28,
188 SPDK_SBC_READ_12 = 0xa8,
189 SPDK_SBC_READ_16 = 0x88,
190 SPDK_SBC_READ_ATTRIBUTE = 0x8c,
191 SPDK_SBC_READ_BUFFER = 0x3c,
192 SPDK_SBC_READ_CAPACITY_10 = 0x25,
193 SPDK_SBC_READ_DEFECT_DATA_10 = 0x37,
194 SPDK_SBC_READ_DEFECT_DATA_12 = 0xb7,
195 SPDK_SBC_READ_LONG_10 = 0x3e,
196 SPDK_SBC_REASSIGN_BLOCKS = 0x07,
197 SPDK_SBC_SANITIZE = 0x48,
198 SPDK_SBC_START_STOP_UNIT = 0x1b,
199 SPDK_SBC_SYNCHRONIZE_CACHE_10 = 0x35,
200 SPDK_SBC_SYNCHRONIZE_CACHE_16 = 0x91,
201 SPDK_SBC_UNMAP = 0x42,
202 SPDK_SBC_VERIFY_10 = 0x2f,
203 SPDK_SBC_VERIFY_12 = 0xaf,
204 SPDK_SBC_VERIFY_16 = 0x8f,
205 SPDK_SBC_WRITE_6 = 0x0a,
206 SPDK_SBC_WRITE_10 = 0x2a,
207 SPDK_SBC_WRITE_12 = 0xaa,
208 SPDK_SBC_WRITE_16 = 0x8a,
209 SPDK_SBC_WRITE_AND_VERIFY_10 = 0x2e,
210 SPDK_SBC_WRITE_AND_VERIFY_12 = 0xae,
211 SPDK_SBC_WRITE_AND_VERIFY_16 = 0x8e,
212 SPDK_SBC_WRITE_LONG_10 = 0x3f,
213 SPDK_SBC_WRITE_SAME_10 = 0x41,
214 SPDK_SBC_WRITE_SAME_16 = 0x93,
215 SPDK_SBC_XDREAD_10 = 0x52,
216 SPDK_SBC_XDWRITE_10 = 0x50,
217 SPDK_SBC_XDWRITEREAD_10 = 0x53,
218 SPDK_SBC_XPWRITE_10 = 0x51,
219
220 SPDK_SBC_SAI_READ_CAPACITY_16 = 0x10,
221 SPDK_SBC_SAI_READ_LONG_16 = 0x11,
222 SPDK_SBC_SAO_WRITE_LONG_16 = 0x11,
223
224 SPDK_SBC_VL_READ_32 = 0x0009,
225 SPDK_SBC_VL_VERIFY_32 = 0x000a,
226 SPDK_SBC_VL_WRITE_32 = 0x000b,
227 SPDK_SBC_VL_WRITE_AND_VERIFY_32 = 0x000c,
228 SPDK_SBC_VL_WRITE_SAME_32 = 0x000d,
229 SPDK_SBC_VL_XDREAD_32 = 0x0003,
230 SPDK_SBC_VL_XDWRITE_32 = 0x0004,
231 SPDK_SBC_VL_XDWRITEREAD_32 = 0x0007,
232 SPDK_SBC_VL_XPWRITE_32 = 0x0006,
233 };
234
235 #define SPDK_SBC_START_STOP_UNIT_START_BIT (1 << 0)
236
237 enum spdk_mmc_opcode {
238 /* MMC6 */
239 SPDK_MMC_READ_DISC_STRUCTURE = 0xad,
240
241 /* MMC4 */
242 SPDK_MMC_BLANK = 0xa1,
243 SPDK_MMC_CLOSE_TRACK_SESSION = 0x5b,
244 SPDK_MMC_ERASE_10 = 0x2c,
245 SPDK_MMC_FORMAT_UNIT = 0x04,
246 SPDK_MMC_GET_CONFIGURATION = 0x46,
247 SPDK_MMC_GET_EVENT_STATUS_NOTIFICATION = 0x4a,
248 SPDK_MMC_GET_PERFORMANCE = 0xac,
249 SPDK_MMC_INQUIRY = 0x12,
250 SPDK_MMC_LOAD_UNLOAD_MEDIUM = 0xa6,
251 SPDK_MMC_MECHANISM_STATUS = 0xbd,
252 SPDK_MMC_MODE_SELECT_10 = 0x55,
253 SPDK_MMC_MODE_SENSE_10 = 0x5a,
254 SPDK_MMC_PAUSE_RESUME = 0x4b,
255 SPDK_MMC_PLAY_AUDIO_10 = 0x45,
256 SPDK_MMC_PLAY_AUDIO_12 = 0xa5,
257 SPDK_MMC_PLAY_AUDIO_MSF = 0x47,
258 SPDK_MMC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e,
259 SPDK_MMC_READ_10 = 0x28,
260 SPDK_MMC_READ_12 = 0xa8,
261 SPDK_MMC_READ_BUFFER = 0x3c,
262 SPDK_MMC_READ_BUFFER_CAPACITY = 0x5c,
263 SPDK_MMC_READ_CAPACITY = 0x25,
264 SPDK_MMC_READ_CD = 0xbe,
265 SPDK_MMC_READ_CD_MSF = 0xb9,
266 SPDK_MMC_READ_DISC_INFORMATION = 0x51,
267 SPDK_MMC_READ_DVD_STRUCTURE = 0xad,
268 SPDK_MMC_READ_FORMAT_CAPACITIES = 0x23,
269 SPDK_MMC_READ_SUB_CHANNEL = 0x42,
270 SPDK_MMC_READ_TOC_PMA_ATIP = 0x43,
271 SPDK_MMC_READ_TRACK_INFORMATION = 0x52,
272 SPDK_MMC_REPAIR_TRACK = 0x58,
273 SPDK_MMC_REPORT_KEY = 0xa4,
274 SPDK_MMC_REQUEST_SENSE = 0x03,
275 SPDK_MMC_RESERVE_TRACK = 0x53,
276 SPDK_MMC_SCAN = 0xba,
277 SPDK_MMC_SEEK_10 = 0x2b,
278 SPDK_MMC_SEND_CUE_SHEET = 0x5d,
279 SPDK_MMC_SEND_DVD_STRUCTURE = 0xbf,
280 SPDK_MMC_SEND_KEY = 0xa3,
281 SPDK_MMC_SEND_OPC_INFORMATION = 0x54,
282 SPDK_MMC_SET_CD_SPEED = 0xbb,
283 SPDK_MMC_SET_READ_AHEAD = 0xa7,
284 SPDK_MMC_SET_STREAMING = 0xb6,
285 SPDK_MMC_START_STOP_UNIT = 0x1b,
286 SPDK_MMC_STOP_PLAY_SCAN = 0x4e,
287 SPDK_MMC_SYNCHRONIZE_CACHE = 0x35,
288 SPDK_MMC_TEST_UNIT_READY = 0x00,
289 SPDK_MMC_VERIFY_10 = 0x2f,
290 SPDK_MMC_WRITE_10 = 0xa2,
291 SPDK_MMC_WRITE_12 = 0xaa,
292 SPDK_MMC_WRITE_AND_VERIFY_10 = 0x2e,
293 SPDK_MMC_WRITE_BUFFER = 0x3b,
294 };
295
296 enum spdk_ssc_opcode {
297 SPDK_SSC_ERASE_6 = 0x19,
298 SPDK_SSC_FORMAT_MEDIUM = 0x04,
299 SPDK_SSC_LOAD_UNLOAD = 0x1b,
300 SPDK_SSC_LOCATE_10 = 0x2b,
301 SPDK_SSC_LOCATE_16 = 0x92,
302 SPDK_SSC_MOVE_MEDIUM_ATTACHED = 0xa7,
303 SPDK_SSC_READ_6 = 0x08,
304 SPDK_SSC_READ_BLOCK_LIMITS = 0x05,
305 SPDK_SSC_READ_ELEMENT_STATUS_ATTACHED = 0xb4,
306 SPDK_SSC_READ_POSITION = 0x34,
307 SPDK_SSC_READ_REVERSE_6 = 0x0f,
308 SPDK_SSC_RECOVER_BUFFERED_DATA = 0x14,
309 SPDK_SSC_REPORT_DENSITY_SUPPORT = 0x44,
310 SPDK_SSC_REWIND = 0x01,
311 SPDK_SSC_SET_CAPACITY = 0x0b,
312 SPDK_SSC_SPACE_6 = 0x11,
313 SPDK_SSC_SPACE_16 = 0x91,
314 SPDK_SSC_VERIFY_6 = 0x13,
315 SPDK_SSC_WRITE_6 = 0x0a,
316 SPDK_SSC_WRITE_FILEMARKS_6 = 0x10,
317 };
318
319 enum spdk_spc_vpd {
320 SPDK_SPC_VPD_DEVICE_IDENTIFICATION = 0x83,
321 SPDK_SPC_VPD_EXTENDED_INQUIRY_DATA = 0x86,
322 SPDK_SPC_VPD_MANAGEMENT_NETWORK_ADDRESSES = 0x85,
323 SPDK_SPC_VPD_MODE_PAGE_POLICY = 0x87,
324 SPDK_SPC_VPD_SCSI_PORTS = 0x88,
325 SPDK_SPC_VPD_SOFTWARE_INTERFACE_IDENTIFICATION = 0x84,
326 SPDK_SPC_VPD_SUPPORTED_VPD_PAGES = 0x00,
327 SPDK_SPC_VPD_UNIT_SERIAL_NUMBER = 0x80,
328 SPDK_SPC_VPD_BLOCK_LIMITS = 0xb0,
329 SPDK_SPC_VPD_BLOCK_DEV_CHARS = 0xb1,
330 SPDK_SPC_VPD_BLOCK_THIN_PROVISION = 0xb2,
331 };
332
333 enum spdk_spc_peripheral_qualifier {
334 SPDK_SPC_PERIPHERAL_QUALIFIER_CONNECTED = 0,
335 SPDK_SPC_PERIPHERAL_QUALIFIER_NOT_CONNECTED = 1,
336 SPDK_SPC_PERIPHERAL_QUALIFIER_NOT_CAPABLE = 3,
337 };
338
339 enum {
340 SPDK_SPC_PERIPHERAL_DEVICE_TYPE_DISK = 0x00,
341 SPDK_SPC_PERIPHERAL_DEVICE_TYPE_TAPE = 0x01,
342 SPDK_SPC_PERIPHERAL_DEVICE_TYPE_DVD = 0x05,
343 SPDK_SPC_PERIPHERAL_DEVICE_TYPE_CHANGER = 0x08,
344
345 SPDK_SPC_VERSION_NONE = 0x00,
346 SPDK_SPC_VERSION_SPC = 0x03,
347 SPDK_SPC_VERSION_SPC2 = 0x04,
348 SPDK_SPC_VERSION_SPC3 = 0x05,
349 SPDK_SPC_VERSION_SPC4 = 0x06,
350
351 SPDK_SPC_PROTOCOL_IDENTIFIER_FC = 0x00,
352 SPDK_SPC_PROTOCOL_IDENTIFIER_PSCSI = 0x01,
353 SPDK_SPC_PROTOCOL_IDENTIFIER_SSA = 0x02,
354 SPDK_SPC_PROTOCOL_IDENTIFIER_IEEE1394 = 0x03,
355 SPDK_SPC_PROTOCOL_IDENTIFIER_RDMA = 0x04,
356 SPDK_SPC_PROTOCOL_IDENTIFIER_ISCSI = 0x05,
357 SPDK_SPC_PROTOCOL_IDENTIFIER_SAS = 0x06,
358 SPDK_SPC_PROTOCOL_IDENTIFIER_ADT = 0x07,
359 SPDK_SPC_PROTOCOL_IDENTIFIER_ATA = 0x08,
360
361 SPDK_SPC_VPD_CODE_SET_BINARY = 0x01,
362 SPDK_SPC_VPD_CODE_SET_ASCII = 0x02,
363 SPDK_SPC_VPD_CODE_SET_UTF8 = 0x03,
364
365 SPDK_SPC_VPD_ASSOCIATION_LOGICAL_UNIT = 0x00,
366 SPDK_SPC_VPD_ASSOCIATION_TARGET_PORT = 0x01,
367 SPDK_SPC_VPD_ASSOCIATION_TARGET_DEVICE = 0x02,
368
369 SPDK_SPC_VPD_IDENTIFIER_TYPE_VENDOR_SPECIFIC = 0x00,
370 SPDK_SPC_VPD_IDENTIFIER_TYPE_T10_VENDOR_ID = 0x01,
371 SPDK_SPC_VPD_IDENTIFIER_TYPE_EUI64 = 0x02,
372 SPDK_SPC_VPD_IDENTIFIER_TYPE_NAA = 0x03,
373 SPDK_SPC_VPD_IDENTIFIER_TYPE_RELATIVE_TARGET_PORT = 0x04,
374 SPDK_SPC_VPD_IDENTIFIER_TYPE_TARGET_PORT_GROUP = 0x05,
375 SPDK_SPC_VPD_IDENTIFIER_TYPE_LOGICAL_UNIT_GROUP = 0x06,
376 SPDK_SPC_VPD_IDENTIFIER_TYPE_MD5_LOGICAL_UNIT = 0x07,
377 SPDK_SPC_VPD_IDENTIFIER_TYPE_SCSI_NAME = 0x08,
378 };
379
380 struct spdk_scsi_cdb_inquiry {
381 uint8_t opcode;
382 uint8_t evpd;
383 uint8_t page_code;
384 uint8_t alloc_len[2];
385 uint8_t control;
386 };
387 SPDK_STATIC_ASSERT(sizeof(struct spdk_scsi_cdb_inquiry) == 6, "incorrect CDB size");
388
389 struct spdk_scsi_cdb_inquiry_data {
390 uint8_t peripheral_device_type : 5;
391 uint8_t peripheral_qualifier : 3;
392 uint8_t rmb;
393 uint8_t version;
394 uint8_t response;
395 uint8_t add_len;
396 uint8_t flags;
397 uint8_t flags2;
398 uint8_t flags3;
399 uint8_t t10_vendor_id[8];
400 uint8_t product_id[16];
401 uint8_t product_rev[4];
402 uint8_t vendor[20];
403 uint8_t ius;
404 uint8_t reserved;
405 uint8_t desc[];
406 };
407
408 struct spdk_scsi_vpd_page {
409 uint8_t peripheral_device_type : 5;
410 uint8_t peripheral_qualifier : 3;
411 uint8_t page_code;
412 uint8_t alloc_len[2];
413 uint8_t params[];
414 };
415
416 #define SPDK_SCSI_VEXT_REF_CHK 0x01
417 #define SPDK_SCSI_VEXT_APP_CHK 0x02
418 #define SPDK_SCSI_VEXT_GRD_CHK 0x04
419 #define SPDK_SCSI_VEXT_SIMPSUP 0x01
420 #define SPDK_SCSI_VEXT_ORDSUP 0x02
421 #define SPDK_SCSI_VEXT_HEADSUP 0x04
422 #define SPDK_SCSI_VEXT_PRIOR_SUP 0x08
423 #define SPDK_SCSI_VEXT_GROUP_SUP 0x10
424 #define SPDK_SCSI_VEXT_UASK_SUP 0x20
425 #define SPDK_SCSI_VEXT_V_SUP 0x01
426 #define SPDK_SCSI_VEXT_NV_SUP 0x02
427 #define SPDK_SCSI_VEXT_CRD_SUP 0x04
428 #define SPDK_SCSI_VEXT_WU_SUP 0x08
429
430 struct spdk_scsi_vpd_ext_inquiry {
431 uint8_t peripheral;
432 uint8_t page_code;
433 uint8_t alloc_len[2];
434 uint8_t check;
435 uint8_t sup;
436 uint8_t sup2;
437 uint8_t luiclr;
438 uint8_t cbcs;
439 uint8_t micro_dl;
440 uint8_t reserved[54];
441 };
442
443 #define SPDK_SPC_VPD_DESIG_PIV 0x80
444
445 /* designation descriptor */
446 struct spdk_scsi_desig_desc {
447 uint8_t code_set : 4;
448 uint8_t protocol_id : 4;
449 uint8_t type : 4;
450 uint8_t association : 2;
451 uint8_t reserved0 : 1;
452 uint8_t piv : 1;
453 uint8_t reserved1;
454 uint8_t len;
455 uint8_t desig[];
456 };
457 SPDK_STATIC_ASSERT(sizeof(struct spdk_scsi_desig_desc) == 4, "Invalid size");
458
459 /* mode page policy descriptor */
460 struct spdk_scsi_mpage_policy_desc {
461 uint8_t page_code;
462 uint8_t sub_page_code;
463 uint8_t policy;
464 uint8_t reserved;
465 };
466
467 /* target port descriptor */
468 struct spdk_scsi_tgt_port_desc {
469 uint8_t code_set;
470 uint8_t desig_type;
471 uint8_t reserved;
472 uint8_t len;
473 uint8_t designator[];
474 };
475
476 /* SCSI port designation descriptor */
477 struct spdk_scsi_port_desc {
478 uint16_t reserved;
479 uint16_t rel_port_id;
480 uint16_t reserved2;
481 uint16_t init_port_len;
482 uint16_t init_port_id;
483 uint16_t reserved3;
484 uint16_t tgt_desc_len;
485 uint8_t tgt_desc[];
486 };
487
488 /* SCSI UNMAP block descriptor */
489 struct spdk_scsi_unmap_bdesc {
490 /* UNMAP LOGICAL BLOCK ADDRESS */
491 uint64_t lba;
492
493 /* NUMBER OF LOGICAL BLOCKS */
494 uint32_t block_count;
495
496 /* RESERVED */
497 uint32_t reserved;
498 };
499
500 #define SPDK_SCSI_UNMAP_LBPU 1 << 7
501 #define SPDK_SCSI_UNMAP_LBPWS 1 << 6
502 #define SPDK_SCSI_UNMAP_LBPWS10 1 << 5
503
504 #define SPDK_SCSI_UNMAP_FULL_PROVISIONING 0x00
505 #define SPDK_SCSI_UNMAP_RESOURCE_PROVISIONING 0x01
506 #define SPDK_SCSI_UNMAP_THIN_PROVISIONING 0x02
507
508 #endif /* SPDK_SCSI_SPEC_H */