4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 #ifndef _SYS_SCSI_GENERIC_COMMANDS_H
  27 #define _SYS_SCSI_GENERIC_COMMANDS_H
  28 
  29 #ifdef  __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 /*
  34  * Standard SCSI Command Definitions
  35  *
  36  * Macros to determine known command sizes
  37  */
  38 #define CDB_GROUPID(cmd)        ((cmd >> 5) & 0x7)
  39 #define CDB_GROUPID_0   0
  40 #define CDB_GROUPID_1   1
  41 #define CDB_GROUPID_2   2
  42 #define CDB_GROUPID_3   3
  43 #define CDB_GROUPID_4   4
 
 216 /*
 217  * Group 1 Commands, Direct Access Devices
 218  */
 219 #define SCMD_READ_FORMAT_CAP    0x23
 220 #define SCMD_READ_CAPACITY      0x25
 221 #define SCMD_READ_G1            0x28    /* Note that only the group changed */
 222 #define SCMD_WRITE_G1           0x2a    /* Note that only the group changed */
 223 #define SCMD_SEEK_G1            0x2b    /* Note that only the group changed */
 224 #define SCMD_WRITE_VERIFY       0x2e
 225 #define SCMD_VERIFY             0x2f
 226 #define SCMD_SEARCH_HIGH        0x30
 227 #define SCMD_SEARCH_EQUAL       0x31
 228 #define SCMD_SEARCH_LOW         0x32
 229 #define SCMD_SET_LIMITS         0x33
 230 #define SCMD_SYNCHRONIZE_CACHE  0x35
 231 #define SCMD_READ_DEFECT_LIST   0x37
 232 #define SCMD_WRITE_BUFFER       0x3B
 233 #define SCMD_READ_BUFFER        0x3c
 234 #define SCMD_READ_LONG          0x3E
 235 #define SCMD_WRITE_LONG         0x3F
 236 #define SCMD_RESERVE_G1         0x56
 237 #define SCMD_RELEASE_G1         0x57
 238 #define SCMD_MODE_SELECT_G1     0x55
 239 #define SCMD_MODE_SENSE_G1      0x5A
 240 #define SCMD_GET_CONFIGURATION  0x46
 241 #define SCMD_LOG_SELECT_G1      0x4C
 242 #define SCMD_LOG_SENSE_G1       0x4d
 243 
 244 
 245 /*
 246  * Group 1 Commands, Sequential Access Devices
 247  */
 248 #define SCMD_LOCATE             0x2B    /* Note similarity to SCMD_SEEK_G1 */
 249 #define SCMD_READ_POSITION      0x34
 250 #define SCMD_REPORT_DENSITIES   0x44
 251 
 252 /*
 253  * Group 1 Commands, Printer Devices
 254  */
 255 /* (None Defined) */
 256 
 257 /*
 258  * Group 1 Commands, Processor Devices
 259  */
 260 /* (None Defined) */
 261 
 262 /*
 
 
 316 
 317 
 318 /*
 319  * Group 3 Commands
 320  */
 321 #define SCMD_VAR_LEN            0x7f
 322 
 323 /*
 324  * Group 4 Commands, All Devices
 325  */
 326 #define SCMD_GROUP4             0x80
 327 #define SCMD_EXTENDED_COPY      0x83
 328 #define SCMD_VERIFY_G4          0x8f
 329 
 330 /*
 331  * Group 4 Commands, Direct Access Devices
 332  */
 333 #define SCMD_READ_G4            0x88
 334 #define SCMD_WRITE_G4           0x8a
 335 #define SCMD_WRITE_VERIFY_G4    0x8e
 336 #define SCMD_SVC_ACTION_IN_G4   0x9e
 337 #define SCMD_SVC_ACTION_OUT_G4  0x9f
 338 
 339 /*
 340  * Group 4 Service Actions for Service Action In (16)
 341  */
 342 #define SSVC_ACTION_READ_CAPACITY_G4    0x10
 343 #define SSVC_ACTION_READ_LONG_G4        0x11
 344 
 345 /*
 346  * Group 4 Service Actions for Service Action Out (16)
 347  */
 348 #define SSVC_ACTION_WRITE_LONG_G4       0x11
 349 
 350 /*
 351  * Group 4 Commands, Sequential Access Devics
 352  */
 353 #define SCMD_WRITE_FILE_MARK_G4 0x80
 354 #define SCMD_READ_REVERSE_G4    0x81
 355 #define SCMD_READ_ATTRIBUTE     0x8c
 
 
 438 /* 0x25 */ SCMD_READ_CAPACITY,          "read_capacity",                \
 439 /* 0x28 */ SCMD_READ_G1,                "read(10)",                     \
 440 /* 0x2a */ SCMD_WRITE_G1,               "write(10)",                    \
 441 /* 0x2b */ SCMD_SEEK_G1 |                                               \
 442                 SCMD_LOCATE,            "seek(10)",                     \
 443 /* 0x2e */ SCMD_WRITE_VERIFY,           "write_verify",                 \
 444 /* 0x2f */ SCMD_VERIFY,                 "verify(10)",                   \
 445 /* 0x30 */ SCMD_SEARCH_HIGH,            "search_data_high",             \
 446 /* 0x31 */ SCMD_SEARCH_EQUAL,           "search_data_equal",            \
 447 /* 0x32 */ SCMD_SEARCH_LOW,             "search_data_low",              \
 448 /* 0x33 */ SCMD_SET_LIMITS,             "set_limits",                   \
 449 /* 0x34 */ SCMD_READ_POSITION,          "read_position",                \
 450 /* 0x35 */ SCMD_SYNCHRONIZE_CACHE,      "synchronize_cache",            \
 451 /* 0x37 */ SCMD_READ_DEFECT_LIST,       "read_defect_data",             \
 452 /* 0x39 */ SCMD_COMPARE,                "compare",                      \
 453 /* 0x3a */ SCMD_COPY_VERIFY,            "copy_verify",                  \
 454 /* 0x3b */ SCMD_WRITE_BUFFER,           "write_buffer",                 \
 455 /* 0x3c */ SCMD_READ_BUFFER,            "read_buffer",                  \
 456 /* 0x3e */ SCMD_READ_LONG,              "read_long",                    \
 457 /* 0x3f */ SCMD_WRITE_LONG,             "write_long",                   \
 458 /* 0x44 */ SCMD_REPORT_DENSITIES |                                      \
 459                 /* SCMD_READ_HEADER (from cdio.h) | */                  \
 460                 0,                      "report_densities/read_header", \
 461 /* 0x4c */ SCMD_LOG_SELECT_G1,          "log_select",                   \
 462 /* 0x4d */ SCMD_LOG_SENSE_G1,           "log_sense",                    \
 463 /* 0x55 */ SCMD_MODE_SELECT_G1,         "mode_select(10)",              \
 464 /* 0x56 */ SCMD_RESERVE_G1,             "reserve(10)",                  \
 465 /* 0x57 */ SCMD_RELEASE_G1,             "release(10)",                  \
 466 /* 0x5a */ SCMD_MODE_SENSE_G1,          "mode_sense(10)",               \
 467 /* 0x5e */ SCMD_PERSISTENT_RESERVE_IN,  "persistent_reserve_in",        \
 468 /* 0x5f */ SCMD_PERSISTENT_RESERVE_OUT, "persistent_reserve_out",       \
 469 /* 0x80 */ SCMD_WRITE_FILE_MARK_G4,     "write_file_mark(16)",          \
 470 /* 0x81 */ SCMD_READ_REVERSE_G4,        "read_reverse(16)",             \
 471 /* 0x83 */ SCMD_EXTENDED_COPY,          "extended_copy",                \
 472 /* 0x88 */ SCMD_READ_G4,                "read(16)",                     \
 473 /* 0x8a */ SCMD_WRITE_G4,               "write(16)",                    \
 474 /* 0x8c */ SCMD_READ_ATTRIBUTE,         "read_attribute",               \
 475 /* 0x8d */ SCMD_WRITE_ATTRIBUTE,        "write_attribute",              \
 476 /* 0x8e */ SCMD_WRITE_VERIFY_G4,        "write_verify(16)",             \
 477 /* 0x8f */ SCMD_VERIFY_G4,              "verify(16)",                   \
 478 /* 0x91 */ SCMD_SPACE_G4,               "space(16)",                    \
 479 /* 0x92 */ SCMD_LOCATE_G4,              "locate(16)",                   \
 480 /* 0x9e */ SCMD_SVC_ACTION_IN_G4,       "service_action_in(16)",        \
 481 /* 0x9f */ SCMD_SVC_ACTION_OUT_G4,      "service_action_out(16)",       \
 482 /* 0xa0 */ SCMD_REPORT_LUNS,            "report_luns",                  \
 483 /* 0xa2 */ SCMD_SECURITY_PROTO_IN,      "security_protocol_in",         \
 484 /* 0xa3 */ SCMD_MAINTENANCE_IN,         "maintenance_in",               \
 485 /* 0xa4 */ SCMD_MAINTENANCE_OUT,        "maintenance_out",              \
 486 /* 0xa8 */ SCMD_READ_G5,                "read(12)",                     \
 487 /* 0xa9 */ SCMD_SVC_ACTION_OUT_G5,      "service_action_out(12)",       \
 488 /* 0xaa */ SCMD_WRITE_G5,               "write(12)",                    \
 489 /* 0xab */ SCMD_SVC_ACTION_IN_G5,       "service_action_in(12)",        \
 490 /* 0xac */ SCMD_GET_PERFORMANCE,        "get_performance",              \
 491 /* 0xAE */ SCMD_WRITE_VERIFY_G5,        "write_verify(12)",             \
 492 /* 0xAF */ SCMD_VERIFY_G5,              "verify(12)",                   \
 493 /* 0xb5 */ SCMD_SECURITY_PROTO_OUT,     "security_protocol_out"         \
 494         /* see cdio.h for additional command-to-string translations */
 495 
 496 /* XXX not a command code, does not belong here */
 497 #define ATAPI_CAPABILITIES      0x2A
 498 
 499 #ifdef  __cplusplus
  | 
 
 
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  24  *
  25  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  26  */
  27 
  28 #ifndef _SYS_SCSI_GENERIC_COMMANDS_H
  29 #define _SYS_SCSI_GENERIC_COMMANDS_H
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 /*
  36  * Standard SCSI Command Definitions
  37  *
  38  * Macros to determine known command sizes
  39  */
  40 #define CDB_GROUPID(cmd)        ((cmd >> 5) & 0x7)
  41 #define CDB_GROUPID_0   0
  42 #define CDB_GROUPID_1   1
  43 #define CDB_GROUPID_2   2
  44 #define CDB_GROUPID_3   3
  45 #define CDB_GROUPID_4   4
 
 218 /*
 219  * Group 1 Commands, Direct Access Devices
 220  */
 221 #define SCMD_READ_FORMAT_CAP    0x23
 222 #define SCMD_READ_CAPACITY      0x25
 223 #define SCMD_READ_G1            0x28    /* Note that only the group changed */
 224 #define SCMD_WRITE_G1           0x2a    /* Note that only the group changed */
 225 #define SCMD_SEEK_G1            0x2b    /* Note that only the group changed */
 226 #define SCMD_WRITE_VERIFY       0x2e
 227 #define SCMD_VERIFY             0x2f
 228 #define SCMD_SEARCH_HIGH        0x30
 229 #define SCMD_SEARCH_EQUAL       0x31
 230 #define SCMD_SEARCH_LOW         0x32
 231 #define SCMD_SET_LIMITS         0x33
 232 #define SCMD_SYNCHRONIZE_CACHE  0x35
 233 #define SCMD_READ_DEFECT_LIST   0x37
 234 #define SCMD_WRITE_BUFFER       0x3B
 235 #define SCMD_READ_BUFFER        0x3c
 236 #define SCMD_READ_LONG          0x3E
 237 #define SCMD_WRITE_LONG         0x3F
 238 #define SCMD_WRITE_SAME_G1      0x41
 239 #define SCMD_UNMAP              0x42
 240 #define SCMD_GET_CONFIGURATION  0x46
 241 #define SCMD_LOG_SELECT_G1      0x4c
 242 #define SCMD_LOG_SENSE_G1       0x4d
 243 #define SCMD_RESERVE_G1         0x56
 244 #define SCMD_RELEASE_G1         0x57
 245 #define SCMD_MODE_SELECT_G1     0x55
 246 #define SCMD_MODE_SENSE_G1      0x5A
 247 
 248 
 249 /*
 250  * Group 1 Commands, Sequential Access Devices
 251  */
 252 #define SCMD_LOCATE             0x2B    /* Note similarity to SCMD_SEEK_G1 */
 253 #define SCMD_READ_POSITION      0x34
 254 #define SCMD_REPORT_DENSITIES   0x44
 255 
 256 /*
 257  * Group 1 Commands, Printer Devices
 258  */
 259 /* (None Defined) */
 260 
 261 /*
 262  * Group 1 Commands, Processor Devices
 263  */
 264 /* (None Defined) */
 265 
 266 /*
 
 
 320 
 321 
 322 /*
 323  * Group 3 Commands
 324  */
 325 #define SCMD_VAR_LEN            0x7f
 326 
 327 /*
 328  * Group 4 Commands, All Devices
 329  */
 330 #define SCMD_GROUP4             0x80
 331 #define SCMD_EXTENDED_COPY      0x83
 332 #define SCMD_VERIFY_G4          0x8f
 333 
 334 /*
 335  * Group 4 Commands, Direct Access Devices
 336  */
 337 #define SCMD_READ_G4            0x88
 338 #define SCMD_WRITE_G4           0x8a
 339 #define SCMD_WRITE_VERIFY_G4    0x8e
 340 #define SCMD_WRITE_SAME_G4      0x93
 341 #define SCMD_SVC_ACTION_IN_G4   0x9e
 342 #define SCMD_SVC_ACTION_OUT_G4  0x9f
 343 
 344 /*
 345  * Group 4 Service Actions for Service Action In (16)
 346  */
 347 #define SSVC_ACTION_READ_CAPACITY_G4    0x10
 348 #define SSVC_ACTION_READ_LONG_G4        0x11
 349 
 350 /*
 351  * Group 4 Service Actions for Service Action Out (16)
 352  */
 353 #define SSVC_ACTION_WRITE_LONG_G4       0x11
 354 
 355 /*
 356  * Group 4 Commands, Sequential Access Devics
 357  */
 358 #define SCMD_WRITE_FILE_MARK_G4 0x80
 359 #define SCMD_READ_REVERSE_G4    0x81
 360 #define SCMD_READ_ATTRIBUTE     0x8c
 
 
 443 /* 0x25 */ SCMD_READ_CAPACITY,          "read_capacity",                \
 444 /* 0x28 */ SCMD_READ_G1,                "read(10)",                     \
 445 /* 0x2a */ SCMD_WRITE_G1,               "write(10)",                    \
 446 /* 0x2b */ SCMD_SEEK_G1 |                                               \
 447                 SCMD_LOCATE,            "seek(10)",                     \
 448 /* 0x2e */ SCMD_WRITE_VERIFY,           "write_verify",                 \
 449 /* 0x2f */ SCMD_VERIFY,                 "verify(10)",                   \
 450 /* 0x30 */ SCMD_SEARCH_HIGH,            "search_data_high",             \
 451 /* 0x31 */ SCMD_SEARCH_EQUAL,           "search_data_equal",            \
 452 /* 0x32 */ SCMD_SEARCH_LOW,             "search_data_low",              \
 453 /* 0x33 */ SCMD_SET_LIMITS,             "set_limits",                   \
 454 /* 0x34 */ SCMD_READ_POSITION,          "read_position",                \
 455 /* 0x35 */ SCMD_SYNCHRONIZE_CACHE,      "synchronize_cache",            \
 456 /* 0x37 */ SCMD_READ_DEFECT_LIST,       "read_defect_data",             \
 457 /* 0x39 */ SCMD_COMPARE,                "compare",                      \
 458 /* 0x3a */ SCMD_COPY_VERIFY,            "copy_verify",                  \
 459 /* 0x3b */ SCMD_WRITE_BUFFER,           "write_buffer",                 \
 460 /* 0x3c */ SCMD_READ_BUFFER,            "read_buffer",                  \
 461 /* 0x3e */ SCMD_READ_LONG,              "read_long",                    \
 462 /* 0x3f */ SCMD_WRITE_LONG,             "write_long",                   \
 463 /* 0x41 */ SCMD_WRITE_SAME_G1,          "write_same(10)",               \
 464 /* 0x42 */ SCMD_UNMAP,                  "unmap",                        \
 465 /* 0x44 */ SCMD_REPORT_DENSITIES |                                      \
 466                 /* SCMD_READ_HEADER (from cdio.h) | */                  \
 467                 0,                      "report_densities/read_header", \
 468 /* 0x4c */ SCMD_LOG_SELECT_G1,          "log_select",                   \
 469 /* 0x4d */ SCMD_LOG_SENSE_G1,           "log_sense",                    \
 470 /* 0x55 */ SCMD_MODE_SELECT_G1,         "mode_select(10)",              \
 471 /* 0x56 */ SCMD_RESERVE_G1,             "reserve(10)",                  \
 472 /* 0x57 */ SCMD_RELEASE_G1,             "release(10)",                  \
 473 /* 0x5a */ SCMD_MODE_SENSE_G1,          "mode_sense(10)",               \
 474 /* 0x5e */ SCMD_PERSISTENT_RESERVE_IN,  "persistent_reserve_in",        \
 475 /* 0x5f */ SCMD_PERSISTENT_RESERVE_OUT, "persistent_reserve_out",       \
 476 /* 0x80 */ SCMD_WRITE_FILE_MARK_G4,     "write_file_mark(16)",          \
 477 /* 0x81 */ SCMD_READ_REVERSE_G4,        "read_reverse(16)",             \
 478 /* 0x83 */ SCMD_EXTENDED_COPY,          "extended_copy",                \
 479 /* 0x88 */ SCMD_READ_G4,                "read(16)",                     \
 480 /* 0x8a */ SCMD_WRITE_G4,               "write(16)",                    \
 481 /* 0x8c */ SCMD_READ_ATTRIBUTE,         "read_attribute",               \
 482 /* 0x8d */ SCMD_WRITE_ATTRIBUTE,        "write_attribute",              \
 483 /* 0x8e */ SCMD_WRITE_VERIFY_G4,        "write_verify(16)",             \
 484 /* 0x8f */ SCMD_VERIFY_G4,              "verify(16)",                   \
 485 /* 0x91 */ SCMD_SPACE_G4,               "space(16)",                    \
 486 /* 0x92 */ SCMD_LOCATE_G4,              "locate(16)",                   \
 487 /* 0x92 */ SCMD_WRITE_SAME_G4,          "write_same(16)",               \
 488 /* 0x9e */ SCMD_SVC_ACTION_IN_G4,       "service_action_in(16)",        \
 489 /* 0x9f */ SCMD_SVC_ACTION_OUT_G4,      "service_action_out(16)",       \
 490 /* 0xa0 */ SCMD_REPORT_LUNS,            "report_luns",                  \
 491 /* 0xa2 */ SCMD_SECURITY_PROTO_IN,      "security_protocol_in",         \
 492 /* 0xa3 */ SCMD_MAINTENANCE_IN,         "maintenance_in",               \
 493 /* 0xa4 */ SCMD_MAINTENANCE_OUT,        "maintenance_out",              \
 494 /* 0xa8 */ SCMD_READ_G5,                "read(12)",                     \
 495 /* 0xa9 */ SCMD_SVC_ACTION_OUT_G5,      "service_action_out(12)",       \
 496 /* 0xaa */ SCMD_WRITE_G5,               "write(12)",                    \
 497 /* 0xab */ SCMD_SVC_ACTION_IN_G5,       "service_action_in(12)",        \
 498 /* 0xac */ SCMD_GET_PERFORMANCE,        "get_performance",              \
 499 /* 0xAE */ SCMD_WRITE_VERIFY_G5,        "write_verify(12)",             \
 500 /* 0xAF */ SCMD_VERIFY_G5,              "verify(12)",                   \
 501 /* 0xb5 */ SCMD_SECURITY_PROTO_OUT,     "security_protocol_out"         \
 502         /* see cdio.h for additional command-to-string translations */
 503 
 504 /* XXX not a command code, does not belong here */
 505 #define ATAPI_CAPABILITIES      0x2A
 506 
 507 #ifdef  __cplusplus
  |