xref: /freebsd/sys/dev/isci/scil/intel_scsi.h (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
4  * This file is provided under a dual BSD/GPLv2 license.  When using or
5  * redistributing this file, you may do so under either license.
6  *
7  * GPL LICENSE SUMMARY
8  *
9  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of version 2 of the GNU General Public License as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23  * The full GNU General Public License is included in this distribution
24  * in the file called LICENSE.GPL.
25  *
26  * BSD LICENSE
27  *
28  * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions
33  * are met:
34  *
35  *   * Redistributions of source code must retain the above copyright
36  *     notice, this list of conditions and the following disclaimer.
37  *   * Redistributions in binary form must reproduce the above copyright
38  *     notice, this list of conditions and the following disclaimer in
39  *     the documentation and/or other materials provided with the
40  *     distribution.
41  *
42  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  *
54  * $FreeBSD$
55  */
56 /**
57  * @file
58  * @brief This file defines all of the SCSI related constants, enumerations,
59  *        and types.  Please note that this file does not necessarily contain
60  *        an exhaustive list of all constants, commands, sub-commands, etc.
61  */
62 
63 #ifndef _SCSI_H__
64 #define _SCSI_H__
65 
66 
67 //******************************************************************************
68 //* C O N S T A N T S   A N D   M A C R O S
69 //******************************************************************************
70 
71 /**
72  * @enum _SCSI_TASK_MGMT_REQUEST_CODES
73  *
74  * @brief This enumberation contains the constants to be used for SCSI task
75  *        management request codes.  SAM does not specify any particular
76  *        values for these codes so constants used here are the same as
77  *        those specified in SAS.
78  */
79 typedef enum _SCSI_TASK_MGMT_REQUEST_CODES
80 {
81    SCSI_TASK_REQUEST_ABORT_TASK           = 0x01,
82    SCSI_TASK_REQUEST_ABORT_TASK_SET       = 0x02,
83    SCSI_TASK_REQUEST_CLEAR_TASK_SET       = 0x04,
84    SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET   = 0x08,
85    SCSI_TASK_REQUEST_I_T_NEXUS_RESET      = 0x10,
86    SCSI_TASK_REQUEST_CLEAR_ACA            = 0x40,
87    SCSI_TASK_REQUEST_QUERY_TASK           = 0x80,
88    SCSI_TASK_REQUEST_QUERY_TASK_SET       = 0x81,
89    SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION = 0x82,
90 
91 } SCSI_TASK_MGMT_REQUEST_CODES;
92 
93 /**
94  * @enum _SCSI_TASK_MGMT_RESPONSE_CODES
95  *
96  * @brief This enumeration contains all of the SCSI task management response
97  *        codes.
98  */
99 typedef enum _SCSI_TASK_MGMT_RESPONSE_CODES
100 {
101    SCSI_TASK_MGMT_FUNC_COMPLETE      = 0,
102    SCSI_INVALID_FRAME                = 2,
103    SCSI_TASK_MGMT_FUNC_NOT_SUPPORTED = 4,
104    SCSI_TASK_MGMT_FUNC_FAILED        = 5,
105    SCSI_TASK_MGMT_FUNC_SUCCEEDED     = 8,
106    SCSI_INVALID_LUN                  = 9
107 } SCSI_TASK_MGMT_RESPONSE_CODES;
108 
109 /**
110  * @enum _SCSI_SENSE_RESPONSE_CODE
111  *
112  * @brief this enumeration depicts the types of sense data responses as
113  *      per SPC-3.
114  */
115 typedef enum _SCSI_SENSE_RESPONSE_CODE
116 {
117    SCSI_FIXED_CURRENT_RESPONSE_CODE       = 0x70,
118    SCSI_FIXED_DEFERRED_RESPONSE_CODE      = 0x71,
119    SCSI_DESCRIPTOR_CURRENT_RESPONSE_CODE  = 0x72,
120    SCSI_DESCRIPTOR_DEFERRED_RESPONSE_CODE = 0x73
121 
122 } SCSI_SENSE_RESPONSE_CODE;
123 
124 /**
125  * @enum _SCSI_SENSE_DATA_DESCRIPTOR_TYPE
126  *
127  * @brief this enumeration depicts the types of sense data descriptor as
128  *      per SPC-4.
129  */
130 typedef enum _SCSI_SENSE_DATA_DESCRIPTOR_TYPE
131 {
132     SCSI_INFORMATION_DESCRIPTOR_TYPE                = 0x00,
133     SCSI_CMD_SPECIFIC_DESCRIPTOR_TYPE            = 0x01,
134     SCSI_KEY_SPECIFIC_DESCRIPTOR_TYPE                = 0x02,
135     SCSI_FIELD_REPLACEABLE_UNIT_DESCRIPTOR_TYPE        = 0x03,
136     SCSI_STREAM_CMD_DESCRIPTOR_TYPE                     = 0x04,
137     SCSI_BLOCK_DESCRIPTOR_TYPE                         = 0x05,
138     SCSI_OSD_OBJ_IDENTIFICATION_DESCRIPTOR_TYPE      = 0x06,
139     SCSI_OSC_RESPONSE_INTEGRITY_DESCRIPTOR_TYPE      = 0x07,
140     SCSI_OSD_ATTR_IDENTIFICATION_DESCRIPTOR_TYPE     = 0x08,
141     SCSI_ATA_STATUS_RETURN_DESCRIPTOR_TYPE            = 0x09,
142     SCSI_PROGRESS_INDICATION_DESCRIPTOR_TYPE        = 0x0a,
143     SCSI_USER_DATA_SEGEMNT_REF_DESCRIPTOR_TYPE        = 0x0b
144 } SCSI_SENSE_DATA_DESCRIPTOR_TYPE;
145 
146 #define SCSI_CMD_SPECIFIC_DESCRIPTOR_ADDITIONAL_LENGTH    0x0a
147 #define SCSI_CMD_SPECIFIC_DESCRIPTOR_LENGTH                0x0c
148 #define SCSI_INFORMATION_DESCRIPTOR_ADDITIONAL_LENGTH    0x0a
149 #define SCSI_INFORMATION_DESCRIPTOR_LENGTH                0x0c
150 #define SCSI_BLOCK_DESCRIPTOR_ADDITIONAL_LENGTH            0x2
151 #define SCSI_BLOCK_DESCRIPTOR_LENGTH                    0x4
152 
153 #define SCSI_SENSE_DATA_DESC_BIT    0x01
154 
155 // This constant represents the valid bit located in byte 0 of a FIXED
156 // format sense data.
157 #define SCSI_FIXED_SENSE_DATA_VALID_BIT   0x80
158 
159 #define SCSI_FIXED_SENSE_DATA_BASE_LENGTH 18
160 
161 // This value is used in the DATAPRES field of the SCSI Response IU.
162 #define SCSI_RESPONSE_DATA_PRES_SENSE_DATA 0x02
163 
164 /**
165  * @name SCSI_SENSE_KEYS
166  *
167  * These constants delineate all of the SCSI protocol sense key constants
168  */
169 /*@{*/
170 #define SCSI_SENSE_NO_SENSE        0x00
171 #define SCSI_SENSE_RECOVERED_ERROR 0x01
172 #define SCSI_SENSE_NOT_READY       0x02
173 #define SCSI_SENSE_MEDIUM_ERROR    0x03
174 #define SCSI_SENSE_HARDWARE_ERROR  0x04
175 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
176 #define SCSI_SENSE_UNIT_ATTENTION  0x06
177 #define SCSI_SENSE_DATA_PROTECT    0x07
178 #define SCSI_SENSE_BLANK_CHECK     0x08
179 #define SCSI_SENSE_VENDOR_SPECIFIC 0x09
180 #define SCSI_SENSE_COPY_ABORTED    0x0A
181 #define SCSI_SENSE_ABORTED_COMMAND 0x0B
182 #define SCSI_SENSE_VOLUME_OVERFLOW 0x0D
183 #define SCSI_SENSE_MISCOMPARE      0x0E
184 /*@}*/
185 
186 /**
187  * @name SCSI_ADDITIONAL_SENSE_CODES
188  *
189  * These constants delineate all of the SCSI protocol additional sense
190  * code constants.
191  */
192 /*@{*/
193 #define SCSI_ASC_NO_ADDITIONAL_SENSE             0x00
194 #define SCSI_ASC_INITIALIZING_COMMAND_REQUIRED   0x04
195 #define SCSI_ASC_LUN_SELF_TEST_IN_PROGRESS       0x04
196 #define SCSI_ASC_LUN_FORMAT_IN_PROGRESS          0x04
197 #define SCSI_ASC_LUN_NOT_RESPOND_TO_SELECTION    0x05
198 #define SCSI_ASC_UNRECOVERED_READ_ERROR          0x11
199 #define SCSI_ASC_INVALID_COMMAND_OPERATION_CODE  0x20
200 #define SCSI_ASC_LBA_OUT_OF_RANGE                0x21
201 #define SCSI_ASC_INVALID_FIELD_IN_CDB            0x24
202 #define SCSI_ASC_LOGICAL_UNIT_NOT_SUPPORTED      0x25
203 #define SCSI_ASC_INVALID_FIELD_IN_PARM_LIST      0x26
204 #define SCSI_ASC_WRITE_PROTECTED                 0x27
205 #define SCSI_ASC_NOT_READY_TO_READY_CHANGE       0x28
206 #define SCSI_ASC_MEDIUM_FORMAT_CORRUPTED         0x31
207 #define SCSI_ASC_ENCLOSURE_SERVICES_UNAVAILABLE  0x35
208 #define SCSI_ASC_SAVING_PARMS_NOT_SUPPORTED      0x39
209 #define SCSI_ASC_MEDIUM_NOT_PRESENT              0x3A
210 #define SCSI_ASC_INTERNAL_TARGET_FAILURE         0x44
211 #define SCSI_ASC_IU_CRC_ERROR_DETECTED           0x47
212 #define SCSI_ASC_MEDIUM_REMOVAL_REQUEST          0x5A
213 #define SCSI_ASC_COMMAND_SEQUENCE_ERROR          0x2C
214 #define SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED      0x53
215 #define SCSI_ASC_HARDWARE_IMPENDING_FAILURE      0x5D
216 #define SCSI_ASC_POWER_STATE_CHANGE              0x5E
217 #define SCSI_DIAGNOSTIC_FAILURE_ON_COMPONENT     0x40
218 #define SCSI_ASC_LOGICAL_UNIT_FAILED             0x4C
219 #define SCSI_ASC_ATA_DEVICE_FEATURE_NOT_ENABLED  0x67
220 #define SCSI_ASC_MICROCODE_HAS_CHANGED           0x3F
221 /*@}*/
222 
223 /**
224  * @name SCSI_ADDITIONAL_SENSE_CODE_QUALIFIERS
225  *
226  * This enumeration contains all of the used SCSI protocol additional
227  * sense code qualifier constants.
228  */
229 /*@{*/
230 #define SCSI_ASCQ_NO_ADDITIONAL_SENSE                            0x00
231 #define SCSI_ASCQ_INVALID_FIELD_IN_CDB                           0x00
232 #define SCSI_ASCQ_INVALID_FIELD_IN_PARM_LIST                     0x00
233 #define SCSI_ASCQ_LUN_NOT_RESPOND_TO_SELECTION                   0x00
234 #define SCSI_ASCQ_INTERNAL_TARGET_FAILURE                        0x00
235 #define SCSI_ASCQ_LBA_OUT_OF_RANGE                               0x00
236 #define SCSI_ASCQ_MEDIUM_NOT_PRESENT                             0x00
237 #define SCSI_ASCQ_NOT_READY_TO_READY_CHANGE                      0x00
238 #define SCSI_ASCQ_WRITE_PROTECTED                                0x00
239 #define SCSI_ASCQ_UNRECOVERED_READ_ERROR                         0x00
240 #define SCSI_ASCQ_SAVING_PARMS_NOT_SUPPORTED                     0x00
241 #define SCSI_ASCQ_INVALID_COMMAND_OPERATION_CODE                 0x00
242 #define SCSI_ASCQ_MEDIUM_REMOVAL_REQUEST                         0x01
243 #define SCSI_ASCQ_INITIALIZING_COMMAND_REQUIRED                  0x02
244 #define SCSI_ASCQ_IU_CRC_ERROR_DETECTED                          0x03
245 #define SCSI_ASCQ_LUN_FORMAT_IN_PROGRESS                         0x04
246 #define SCSI_ASCQ_LUN_SELF_TEST_IN_PROGRESS                      0x09
247 #define SCSI_ASCQ_GENERAL_HARD_DRIVE_FAILURE                     0x10
248 #define SCSI_ASCQ_IDLE_CONDITION_ACTIVATE_BY_COMMAND             0x03
249 #define SCSI_ASCQ_STANDBY_CONDITION_ACTIVATE_BY_COMMAND          0x04
250 #define SCSI_ASCQ_POWER_STATE_CHANGE_TO_IDLE                     0x42
251 #define SCSI_ASCQ_POWER_STATE_CHANGE_TO_STANDBY                  0x43
252 #define SCSI_ASCQ_ATA_DEVICE_FEATURE_NOT_ENABLED                 0x0B
253 #define SCSI_ASCQ_UNRECOVERED_READ_ERROR_AUTO_REALLOCATE_FAIL    0x04
254 #define SCSI_ASCQ_ATA_PASS_THROUGH_INFORMATION_AVAILABLE         0x1D
255 #define SCSI_ASCQ_MICROCODE_HAS_CHANGED                          0x01
256 /*@}*/
257 
258 /**
259  * @name SCSI_STATUS_CODES
260  *
261  * These constants define all of the used SCSI status values.
262  */
263 /*@{*/
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_TASKFULL        0x28
269 #define SCSI_STATUS_ACA             0x30
270 #define SCSI_STATUS_ABORT           0x40
271 /*@}*/
272 
273 /**
274  * @name SCSI_OPERATION_CODES
275  *
276  * These constants delineate all of the SCSI command/operation codes.
277  */
278 /*@{*/
279 #define SCSI_INQUIRY                0x12
280 #define SCSI_READ_CAPACITY_10       0x25
281 #define SCSI_SERVICE_ACTION_IN_16   0x9E
282 #define SCSI_TEST_UNIT_READY        0x00
283 #define SCSI_START_STOP_UNIT        0x1B
284 #define SCSI_SYNCHRONIZE_CACHE_10   0x35
285 #define SCSI_SYNCHRONIZE_CACHE_16   0x91
286 #define SCSI_REQUEST_SENSE          0x03
287 #define SCSI_REPORT_LUNS            0xA0
288 #define SCSI_REASSIGN_BLOCKS        0x07
289 #define SCSI_READ_6                 0x08
290 #define SCSI_READ_10                0x28
291 #define SCSI_READ_12                0xA8
292 #define SCSI_READ_16                0x88
293 #define SCSI_WRITE_6                0x0A
294 #define SCSI_WRITE_10               0x2A
295 #define SCSI_WRITE_12               0xAA
296 #define SCSI_WRITE_16               0x8A
297 #define SCSI_VERIFY_10              0x2F
298 #define SCSI_VERIFY_12              0xAF
299 #define SCSI_VERIFY_16              0x8F
300 #define SCSI_SEEK_6                 0x01
301 #define SCSI_SEEK_10                0x02
302 #define SCSI_WRITE_VERIFY           0x2E
303 #define SCSI_FORMAT_UNIT            0x04
304 #define SCSI_READ_BUFFER            0x3C
305 #define SCSI_WRITE_BUFFER           0x3B
306 #define SCSI_SEND_DIAGNOSTIC        0x1D
307 #define SCSI_RECEIVE_DIAGNOSTIC     0x1C
308 #define SCSI_MODE_SENSE_6           0x1A
309 #define SCSI_MODE_SENSE_10          0x5A
310 #define SCSI_MODE_SELECT_6          0x15
311 #define SCSI_MODE_SELECT_10         0x55
312 #define SCSI_MAINTENANCE_IN         0xA3
313 #define SCSI_LOG_SENSE              0x4D
314 #define SCSI_LOG_SELECT             0x4C
315 #define SCSI_RESERVE_6              0x16
316 #define SCSI_RESERVE_10             0x56
317 #define SCSI_RELEASE_6              0x17
318 #define SCSI_RELEASE_10             0x57
319 #define SCSI_ATA_PASSTHRU_12        0xA1
320 #define SCSI_ATA_PASSTHRU_16        0x85
321 #define SCSI_WRITE_LONG_10          0x3F
322 #define SCSI_WRITE_LONG_16          0x9F
323 #define SCSI_PERSISTENT_RESERVE_IN  0x5E
324 #define SCSI_PERSISTENT_RESERVE_OUT 0x5F
325 #define SCSI_SECURITY_PROTOCOL_IN   0xA2
326 #define SCSI_SECURITY_PROTOCOL_OUT  0xB5
327 #define SCSI_UNMAP                  0x42
328 #define SCSI_WRITE_AND_VERIFY_10    0x2E
329 #define SCSI_WRITE_AND_VERIFY_12    0xAE
330 #define SCSI_WRITE_AND_VERIFY_16    0x8E
331 /*@}*/
332 
333 /**
334  * @name SCSI_SERVICE_ACTION_IN_CODES
335  *
336  * Service action in operations.
337  */
338 /*@{*/
339 #define SCSI_SERVICE_ACTION_IN_CODES_READ_CAPACITY_16     0x10
340 /*@}*/
341 
342 /**
343 *
344 * Service action mask.
345  */
346 /*@{*/
347 #define SCSI_SERVICE_ACTION_MASK 0x1f
348 /*@}*/
349 
350 /**
351  * @name SCSI_MAINTENANCE_IN_SERVICE_ACTION_CODES
352  *
353  * MAINTENANCE IN service action codes.
354  */
355 /*@{*/
356 #define SCSI_REPORT_TASK_MGMT  0x0D
357 #define SCSI_REPORT_OP_CODES   0x0C
358 /*@}*/
359 
360 /**
361  * @name SCSI_MODE_PAGE_CONTROLS
362  *
363  * These constants delineate all of the used SCSI Mode Page control
364  * values.
365  */
366 /*@{*/
367 #define SCSI_MODE_SENSE_PC_CURRENT     0x0
368 #define SCSI_MODE_SENSE_PC_CHANGEABLE  0x1
369 #define SCSI_MODE_SENSE_PC_DEFAULT     0x2
370 #define SCSI_MODE_SENSE_PC_SAVED       0x3
371 /*@}*/
372 
373 #define SCSI_MODE_SENSE_PC_SHIFT           0x06
374 #define SCSI_MODE_SENSE_PAGE_CODE_ENABLE   0x3F
375 #define SCSI_MODE_SENSE_DBD_ENABLE         0x08
376 #define SCSI_MODE_SENSE_LLBAA_ENABLE       0x10
377 
378 #define SCSI_MODE_PAGE_CONTROL_D_SENSE_DISABLE  0x0
379 #define SCSI_MODE_PAGE_CONTROL_D_SENSE_ENABLE    0x1
380 /**
381  * @name SCSI_MODE_PAGE_CODES
382  *
383  * These constants delineate all of the used SCSI Mode Page codes.
384  */
385 /*@{*/
386 #define SCSI_MODE_PAGE_READ_WRITE_ERROR           0x01
387 #define SCSI_MODE_PAGE_DISCONNECT_RECONNECT       0x02
388 #define SCSI_MODE_PAGE_CACHING                    0x08
389 #define SCSI_MODE_PAGE_CONTROL                    0x0A
390 #define SCSI_MODE_PAGE_PROTOCOL_SPECIFIC_PORT     0x19
391 #define SCSI_MODE_PAGE_POWER_CONDITION            0x1A
392 #define SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL 0x1C
393 #define SCSI_MODE_PAGE_ALL_PAGES                  0x3F
394 /*@}*/
395 
396 #define SCSI_MODE_SENSE_ALL_SUB_PAGES_CODE         0xFF
397 #define SCSI_MODE_SENSE_NO_SUB_PAGES_CODE          0x0
398 #define SCSI_MODE_SENSE_PROTOCOL_PORT_NUM_SUBPAGES 0x1
399 #define SCSI_MODE_PAGE_CACHE_PAGE_WCE_BIT          0x04
400 #define SCSI_MODE_PAGE_CACHE_PAGE_DRA_BIT          0x20
401 #define SCSI_MODE_PAGE_DEXCPT_ENABLE               0x08
402 #define SCSI_MODE_SENSE_HEADER_FUA_ENABLE          0x10
403 #define SCSI_MODE_PAGE_POWER_CONDITION_STANDBY     0x1
404 #define SCSI_MODE_PAGE_POWER_CONDITION_IDLE        0x2
405 
406 #define SCSI_MODE_SENSE_6_HEADER_LENGTH              4
407 #define SCSI_MODE_SENSE_10_HEADER_LENGTH             8
408 #define SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH  8
409 #define SCSI_MODE_SENSE_LLBA_BLOCK_DESCRIPTOR_LENGTH 16
410 
411 #define SCSI_MODE_PAGE_INFORMATIONAL_EXCP_DXCPT_ENABLE 0x08
412 #define SCSI_MODE_PAGE_19_SAS_ID         0x6
413 #define SCSI_MODE_PAGE_19_SUB1_PAGE_NUM  0x1
414 #define SCSI_MODE_PAGE_19_SUB1_PC        0x59
415 
416 #define SCSI_MODE_HEADER_MEDIUM_TYPE_SBC 0x00
417 
418 //Mode Select constrains related masks value
419 #define SCSI_MODE_SELECT_PF_BIT                       0x1
420 #define SCSI_MODE_SELECT_PF_MASK                      0x10
421 #define SCSI_MODE_SELECT_MODE_PAGE_MRIE_BYTE          0x6
422 #define SCSI_MODE_SELECT_MODE_PAGE_MRIE_MASK          0x0F
423 #define SCSI_MODE_SELECT_MODE_PAGE_SPF_MASK           0x40
424 #define SCSI_MODE_SELECT_MODE_PAGE_01_AWRE_MASK       0x80
425 #define SCSI_MODE_SELECT_MODE_PAGE_01_ARRE_MASK       0x40
426 #define SCSI_MODE_SELECT_MODE_PAGE_01_RC_ERBITS_MASK  0x1F
427 #define SCSI_MODE_SELECT_MODE_PAGE_08_FSW_LBCSS_NVDIS 0xC1
428 #define SCSI_MODE_SELECT_MODE_PAGE_1C_PERF_TEST       0x84
429 #define SCSI_MODE_SELECT_MODE_PAGE_0A_TST_TMF_RLEC    0xF1
430 #define SCSI_MODE_SELECT_MODE_PAGE_0A_MODIFIER        0xE0
431 #define SCSI_MODE_SELECT_MODE_PAGE_0A_UA_SWP          0x38
432 #define SCSI_MODE_SELECT_MODE_PAGE_0A_TAS_AUTO        0x47
433 #define SCSI_MODE_SELECT_MODE_PAGE_D_SENSE            0x4
434 
435 #define SCSI_CONTROL_BYTE_NACA_BIT_ENABLE  0x04
436 #define SCSI_MOVE_FUA_BIT_ENABLE           0x08
437 #define SCSI_READ_CAPACITY_PMI_BIT_ENABLE  0x01
438 #define SCSI_READ_CAPACITY_10_DATA_LENGTH  8
439 #define SCSI_READ_CAPACITY_16_DATA_LENGTH  32
440 
441 // Inquiry constants
442 #define SCSI_INQUIRY_EVPD_ENABLE          0x01
443 #define SCSI_INQUIRY_PAGE_CODE_OFFSET     0x02
444 #define SCSI_INQUIRY_SUPPORTED_PAGES_PAGE 0x00
445 #define SCSI_INQUIRY_UNIT_SERIAL_NUM_PAGE 0x80
446 #define SCSI_INQUIRY_DEVICE_ID_PAGE       0x83
447 #define SCSI_INQUIRY_ATA_INFORMATION_PAGE 0x89
448 #define SCSI_INQUIRY_BLOCK_DEVICE_PAGE    0xB1
449 #define SCSI_INQUIRY_BLOCK_DEVICE_LENGTH  0x3C
450 #define SCSI_INQUIRY_STANDARD_ALLOCATION_LENGTH 0x24 //36
451 
452 #define SCSI_REQUEST_SENSE_ALLOCATION_LENGTH   0xFC  //252
453 
454 /** Defines the log page codes that are use in gathing Smart data
455 */
456 #define SCSI_LOG_PAGE_SUPPORTED_PAGES       0x00
457 #define SCSI_LOG_PAGE_INFORMATION_EXCEPTION 0x2F
458 #define SCSI_LOG_PAGE_SELF_TEST             0x10
459 
460 /**
461  * @name SCSI_INQUIRY_VPD
462  *
463  * The following are constants used with vital product data inquiry pages.
464  * Values are already shifted into the proper nibble location.
465  */
466 /*@{*/
467 #define SCSI_PIV_ENABLE                 0x80
468 #define SCSI_LUN_ASSOCIATION            0x00
469 #define SCSI_TARGET_PORT_ASSOCIATION    0x10
470 
471 #define SCSI_VEN_UNIQUE_IDENTIFIER_TYPE 0x00
472 #define SCSI_NAA_IDENTIFIER_TYPE        0x03
473 
474 #define SCSI_T10_IDENTIFIER_TYPE        0x01
475 #define SCSI_BINARY_CODE_SET            0x01
476 #define SCSI_ASCII_CODE_SET             0x02
477 #define SCSI_FC_PROTOCOL_IDENTIFIER     0x00
478 #define SCSI_SAS_PROTOCOL_IDENTIFIER    0x60
479 /*@}*/
480 
481 #define SCSI_VERIFY_BYTCHK_ENABLED      0x02
482 
483 #define SCSI_SYNCHRONIZE_CACHE_IMMED_ENABLED 0x02
484 /**
485  * @name SCSI_START_STOP_UNIT_POWER_CONDITION_CODES
486  *
487  * The following are SCSI Start Stop Unit command Power Condition codes.
488  */
489 /*@{*/
490 #define SCSI_START_STOP_UNIT_POWER_CONDITION_START_VALID       0x0
491 #define SCSI_START_STOP_UNIT_POWER_CONDITION_ACTIVE            0x1
492 #define SCSI_START_STOP_UNIT_POWER_CONDITION_IDLE              0x2
493 #define SCSI_START_STOP_UNIT_POWER_CONDITION_STANDBY           0x3
494 #define SCSI_START_STOP_UNIT_POWER_CONDITION_LU_CONTROL        0x7
495 #define SCSI_START_STOP_UNIT_POWER_CONDITION_FORCE_S_CONTROL   0xB
496 /*@}*/
497 
498 #define SCSI_START_STOP_UNIT_IMMED_MASK            0x1
499 #define SCSI_START_STOP_UNIT_IMMED_SHIFT           0
500 
501 #define SCSI_START_STOP_UNIT_START_BIT_MASK        0x1
502 #define SCSI_START_STOP_UNIT_START_BIT_SHIFT       0
503 
504 #define SCSI_START_STOP_UNIT_LOEJ_BIT_MASK         0x2
505 #define SCSI_START_STOP_UNIT_LOEJ_BIT_SHIFT        1
506 
507 #define SCSI_START_STOP_UNIT_NO_FLUSH_MASK         0x4
508 #define SCSI_START_STOP_UNIT_NO_FLUSH_SHIFT        2
509 
510 #define SCSI_START_STOP_UNIT_POWER_CONDITION_MODIFIER_MASK   0xF
511 #define SCSI_START_STOP_UNIT_POWER_CONDITION_MODIFIER_SHIFT  0
512 
513 #define SCSI_START_STOP_UNIT_POWER_CONDITION_MASK  0xF0
514 #define SCSI_START_STOP_UNIT_POWER_CONDITION_SHIFT 4
515 
516 #define SCSI_LOG_SENSE_PC_FIELD_MASK      0xC0
517 #define SCSI_LOG_SENSE_PC_FIELD_SHIFT     6
518 
519 #define SCSI_LOG_SENSE_PAGE_CODE_FIELD_MASK      0x3F
520 #define SCSI_LOG_SENSE_PAGE_CODE_FIELD_SHIFT     0
521 
522 /**
523  * @name MRIE - Method of reporting informational exceptions codes
524  */
525 /*@{*/
526 #define NO_REPORTING_INFO_EXCEPTION_CONDITION      0x0
527 #define ASYNCHRONOUS_EVENT_REPORTING               0x1
528 #define ESTABLISH_UNIT_ATTENTION_CONDITION         0x2
529 #define CONDITIONALLY_GENERATE_RECOVERED_ERROR     0x3
530 #define UNCONDITIONALLY_GENERATE_RECOVERED_ERROR   0x4
531 #define GENERATE_NO_SENSE                          0x5
532 #define REPORT_INFO_EXCEPTION_CONDITION_ON_REQUEST 0x6
533 /*@}*/
534 
535 #define SCSI_INFORMATION_EXCEPTION_DEXCPT_BIT      0x08
536 
537 //Reassign Blocks masks
538 #define SCSI_REASSIGN_BLOCKS_LONGLBA_BIT           0x02
539 #define SCSI_REASSIGN_BLOCKS_LONGLIST_BIT          0x01
540 
541 #endif // _SCSI_H_
542 
543