#ifndef _SYS_SCSI_GENERIC_COMMANDS_H
#define _SYS_SCSI_GENERIC_COMMANDS_H
#ifdef __cplusplus
extern "C" {
#endif
#define CDB_GROUPID(cmd) ((cmd >> 5) & 0x7)
#define CDB_GROUPID_0 0
#define CDB_GROUPID_1 1
#define CDB_GROUPID_2 2
#define CDB_GROUPID_3 3
#define CDB_GROUPID_4 4
#define CDB_GROUPID_5 5
#define CDB_GROUPID_6 6
#define CDB_GROUPID_7 7
#define CDB_GROUP0 6
#define CDB_GROUP1 10
#define CDB_GROUP2 10
#define CDB_GROUP3 0
#define CDB_GROUP4 16
#define CDB_GROUP5 12
#define CDB_GROUP6 0
#define CDB_GROUP7 0
#define SCMD_GROUP0 0x00
#define SCMD_TEST_UNIT_READY 0x00
#define SCMD_REQUEST_SENSE 0x03
#define SCMD_INQUIRY 0x12
#define SCMD_COPY 0x18
#define SCMD_GDIAG 0x1C
#define SCMD_SDIAG 0x1D
#define SCMD_REZERO_UNIT 0x01
#define SCMD_FORMAT 0x04
#define SCMD_REASSIGN_BLOCK 0x07
#define SCMD_READ 0x08
#define SCMD_WRITE 0x0a
#define SCMD_SEEK 0x0b
#define SCMD_MODE_SELECT 0x15
#define SCMD_RESERVE 0x16
#define SCMD_RELEASE 0x17
#define SCMD_MODE_SENSE 0x1a
#define SCMD_START_STOP 0x1b
#define SCMD_DOORLOCK 0x1E
#define SCMD_REWIND 0x01
#define SCMD_READ_BLKLIM 0x05
#define SCMD_TRK_SEL 0x0b
#define SCMD_READ_REVERSE 0x0f
#define SCMD_WRITE_FILE_MARK 0x10
#define SCMD_SPACE 0x11
#define SCMD_VERIFY_G0 0x13
#define SCMD_RECOVER_BUF 0x14
#define SCMD_ERASE 0x19
#define SCMD_LOAD 0x1b
#define SCMD_PRINT 0x0a
#define SCMD_SLEW_PRINT 0x0b
#define SCMD_FLUSH_PRINT_BUF 0x10
#define SCMD_STOP_PRINT 0x1b
#define SCMD_RECEIVE 0x08
#define SCMD_SEND 0x0a
#define SCMD_GROUP1 0x20
#define SCMD_COMPARE 0x39
#define SCMD_COPY_VERIFY 0x3A
#define SCMD_PERSISTENT_RESERVE_IN 0x5E
#define SCMD_PERSISTENT_RESERVE_OUT 0x5F
#define SCMD_PRIN SCMD_PERSISTENT_RESERVE_IN
#define SCMD_PROUT SCMD_PERSISTENT_RESERVE_OUT
#define SCMD_READ_FORMAT_CAP 0x23
#define SCMD_READ_CAPACITY 0x25
#define SCMD_READ_G1 0x28
#define SCMD_WRITE_G1 0x2a
#define SCMD_SEEK_G1 0x2b
#define SCMD_WRITE_VERIFY 0x2e
#define SCMD_VERIFY 0x2f
#define SCMD_SEARCH_HIGH 0x30
#define SCMD_SEARCH_EQUAL 0x31
#define SCMD_SEARCH_LOW 0x32
#define SCMD_SET_LIMITS 0x33
#define SCMD_SYNCHRONIZE_CACHE 0x35
#define SCMD_READ_DEFECT_LIST 0x37
#define SCMD_WRITE_BUFFER 0x3B
#define SCMD_READ_BUFFER 0x3c
#define SCMD_READ_LONG 0x3E
#define SCMD_WRITE_LONG 0x3F
#define SCMD_WRITE_SAME_G1 0x41
#define SCMD_UNMAP 0x42
#define SCMD_GET_CONFIGURATION 0x46
#define SCMD_LOG_SELECT_G1 0x4c
#define SCMD_LOG_SENSE_G1 0x4d
#define SCMD_RESERVE_G1 0x56
#define SCMD_RELEASE_G1 0x57
#define SCMD_MODE_SELECT_G1 0x55
#define SCMD_MODE_SENSE_G1 0x5A
#define SCMD_LOCATE 0x2B
#define SCMD_READ_POSITION 0x34
#define SCMD_REPORT_DENSITIES 0x44
#define SCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define SD_GESN_HEADER_LEN 4
#define SD_GESN_HEADER_NEA 0x80
#define SD_GESN_HEADER_CLASS 0x07
#define SD_GESN_MEDIA_CLASS 4
#define SD_GESN_MEDIA_DATA_LEN 4
#define SD_GESN_MEDIA_EVENT_CODE 0x0f
#define SD_GESN_MEDIA_EVENT_STATUS_PRESENT 0x02
#define SD_GESN_MEDIA_EVENT_STATUS_TRAY_OPEN 0x01
#define SD_GESN_MEDIA_EVENT_NOCHG 0
#define SD_GESN_MEDIA_EVENT_EJECTREQUEST 1
#define SD_GESN_MEDIA_EVENT_NEWMEDIA 2
#define SD_GESN_MEDIA_EVENT_MEDIAREMOVAL 3
#define SD_GESN_MEDIA_EVENT_MEDIACHANGED 4
#define SD_GESN_MEDIA_EVENT_BGFORMATCOMPLETED 5
#define SD_GESN_MEDIA_EVENT_BGFORMATRESTARTED 6
#define SCMD_VAR_LEN 0x7f
#define SCMD_GROUP4 0x80
#define SCMD_EXTENDED_COPY 0x83
#define SCMD_RECV_COPY_RESULTS 0x84
#define SCMD_VERIFY_G4 0x8f
#define SCMD_READ_G4 0x88
#define SCMD_WRITE_G4 0x8a
#define SCMD_WRITE_VERIFY_G4 0x8e
#define SCMD_WRITE_SAME_G4 0x93
#define SCMD_SVC_ACTION_IN_G4 0x9e
#define SCMD_SVC_ACTION_OUT_G4 0x9f
#define SSVC_ACTION_READ_CAPACITY_G4 0x10
#define SSVC_ACTION_READ_LONG_G4 0x11
#define SSVC_ACTION_WRITE_LONG_G4 0x11
#define SCMD_WRITE_FILE_MARK_G4 0x80
#define SCMD_READ_REVERSE_G4 0x81
#define SCMD_COMPARE_AND_WRITE 0x89
#define SCMD_READ_ATTRIBUTE 0x8c
#define SCMD_WRITE_ATTRIBUTE 0x8d
#define SCMD_SPACE_G4 0x91
#define SCMD_LOCATE_G4 0x92
#define SCMD_GROUP5 0xA0
#define SCMD_REPORT_LUNS 0xA0
#define SCMD_SECURITY_PROTO_IN 0xA2
#define SCMD_MAINTENANCE_IN 0xA3
#define SCMD_MAINTENANCE_OUT 0xA4
#define SCMD_READ_G5 0xA8
#define SCMD_WRITE_G5 0xAA
#define SCMD_SVC_ACTION_OUT_G5 0xA9
#define SCMD_SVC_ACTION_IN_G5 0xAB
#define SCMD_GET_PERFORMANCE 0xAC
#define SCMD_WRITE_VERIFY_G5 0xAE
#define SCMD_VERIFY_G5 0xAF
#define SCMD_SECURITY_PROTO_OUT 0xB5
#define SSVC_ACTION_GET_TARGET_PORT_GROUPS 0x0a
#define SSVC_ACTION_GET_SUPPORTED_OPERATIONS 0x0c
#define SSVC_SCTION_GET_SUPPORTED_MANAGEMENT 0x0d
#define SSVC_ACTION_GET_TIMESTAMP 0x0f
#define SSVC_ACTION_SET_DEVICE_IDENTIFIER 0x06
#define SSVC_ACTION_SET_PRIORITY 0x0e
#define SSVC_ACTION_SET_TARGET_PORT_GROUPS 0x0a
#define SSVC_ACTION_SET_TIMESTAMP 0x0f
#define SSVC_ACTION_READ_MEDIA_SERIAL 0x01
#define SCSI_CMDS_KEY_STRINGS \
SCMD_TEST_UNIT_READY, "test_unit_ready", \
SCMD_REWIND | \
SCMD_REZERO_UNIT, "rezero/rewind", \
SCMD_REQUEST_SENSE, "request_sense", \
SCMD_FORMAT, "format", \
SCMD_READ_BLKLIM, "read_block_limits", \
SCMD_REASSIGN_BLOCK, "reassign", \
SCMD_READ | \
SCMD_RECEIVE, "read", \
SCMD_PRINT | \
SCMD_SEND | \
SCMD_WRITE, "write", \
SCMD_SEEK | \
SCMD_SLEW_PRINT | \
SCMD_TRK_SEL, "seek", \
SCMD_READ_REVERSE, "read_reverse", \
SCMD_WRITE_FILE_MARK | \
SCMD_FLUSH_PRINT_BUF, "write_file_mark", \
SCMD_SPACE, "space", \
SCMD_INQUIRY, "inquiry", \
SCMD_VERIFY_G0, "verify", \
SCMD_RECOVER_BUF, "recover_buffer_data", \
SCMD_MODE_SELECT, "mode_select", \
SCMD_RESERVE, "reserve", \
SCMD_RELEASE, "release", \
SCMD_COPY, "copy", \
SCMD_ERASE, "erase_tape", \
SCMD_MODE_SENSE, "mode_sense", \
SCMD_LOAD | \
SCMD_START_STOP | \
SCMD_STOP_PRINT, "load/start/stop", \
SCMD_GDIAG, "get_diagnostic_results", \
SCMD_SDIAG, "send_diagnostic_command", \
SCMD_DOORLOCK, "door_lock", \
SCMD_READ_FORMAT_CAP, "read_format_capacity", \
SCMD_READ_CAPACITY, "read_capacity", \
SCMD_READ_G1, "read(10)", \
SCMD_WRITE_G1, "write(10)", \
SCMD_SEEK_G1 | \
SCMD_LOCATE, "seek(10)", \
SCMD_WRITE_VERIFY, "write_verify", \
SCMD_VERIFY, "verify(10)", \
SCMD_SEARCH_HIGH, "search_data_high", \
SCMD_SEARCH_EQUAL, "search_data_equal", \
SCMD_SEARCH_LOW, "search_data_low", \
SCMD_SET_LIMITS, "set_limits", \
SCMD_READ_POSITION, "read_position", \
SCMD_SYNCHRONIZE_CACHE, "synchronize_cache", \
SCMD_READ_DEFECT_LIST, "read_defect_data", \
SCMD_COMPARE, "compare", \
SCMD_COPY_VERIFY, "copy_verify", \
SCMD_WRITE_BUFFER, "write_buffer", \
SCMD_READ_BUFFER, "read_buffer", \
SCMD_READ_LONG, "read_long", \
SCMD_WRITE_LONG, "write_long", \
SCMD_WRITE_SAME_G1, "write_same(10)", \
SCMD_UNMAP, "unmap", \
SCMD_REPORT_DENSITIES | \
\
0, "report_densities/read_header", \
SCMD_GET_CONFIGURATION, "get_configuration", \
SCMD_LOG_SELECT_G1, "log_select", \
SCMD_LOG_SENSE_G1, "log_sense", \
SCMD_MODE_SELECT_G1, "mode_select(10)", \
SCMD_RESERVE_G1, "reserve(10)", \
SCMD_RELEASE_G1, "release(10)", \
SCMD_MODE_SENSE_G1, "mode_sense(10)", \
SCMD_PERSISTENT_RESERVE_IN, "persistent_reserve_in", \
SCMD_PERSISTENT_RESERVE_OUT, "persistent_reserve_out", \
SCMD_WRITE_FILE_MARK_G4, "write_file_mark(16)", \
SCMD_READ_REVERSE_G4, "read_reverse(16)", \
SCMD_EXTENDED_COPY, "extended_copy", \
SCMD_READ_G4, "read(16)", \
SCMD_WRITE_G4, "write(16)", \
SCMD_READ_ATTRIBUTE, "read_attribute", \
SCMD_WRITE_ATTRIBUTE, "write_attribute", \
SCMD_WRITE_VERIFY_G4, "write_verify(16)", \
SCMD_VERIFY_G4, "verify(16)", \
SCMD_SPACE_G4, "space(16)", \
SCMD_LOCATE_G4, "locate(16)", \
SCMD_WRITE_SAME_G4, "write_same(16)", \
SCMD_SVC_ACTION_IN_G4, "service_action_in(16)", \
SCMD_SVC_ACTION_OUT_G4, "service_action_out(16)", \
SCMD_REPORT_LUNS, "report_luns", \
SCMD_SECURITY_PROTO_IN, "security_protocol_in", \
SCMD_MAINTENANCE_IN, "maintenance_in", \
SCMD_MAINTENANCE_OUT, "maintenance_out", \
SCMD_READ_G5, "read(12)", \
SCMD_SVC_ACTION_OUT_G5, "service_action_out(12)", \
SCMD_WRITE_G5, "write(12)", \
SCMD_SVC_ACTION_IN_G5, "service_action_in(12)", \
SCMD_GET_PERFORMANCE, "get_performance", \
SCMD_WRITE_VERIFY_G5, "write_verify(12)", \
SCMD_VERIFY_G5, "verify(12)", \
SCMD_SECURITY_PROTO_OUT, "security_protocol_out" \
#define ATAPI_CAPABILITIES 0x2A
#ifdef __cplusplus
}
#endif
#include <sys/scsi/generic/inquiry.h>
#include <sys/scsi/generic/sense.h>
#include <sys/scsi/impl/commands.h>
#endif