1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * This header file contains public constants 2 * This header file contains public constants and structures used by 4 * both the SCSI initiator and the SCSI target 3 * both the SCSI initiator and the SCSI target code. 5 * 4 * 6 * For documentation on the OPCODES, MESSAGES, 5 * For documentation on the OPCODES, MESSAGES, and SENSE values, 7 * please consult the SCSI standard. 6 * please consult the SCSI standard. 8 */ 7 */ 9 8 10 #ifndef _SCSI_PROTO_H_ 9 #ifndef _SCSI_PROTO_H_ 11 #define _SCSI_PROTO_H_ 10 #define _SCSI_PROTO_H_ 12 11 13 #include <linux/build_bug.h> << 14 #include <linux/types.h> 12 #include <linux/types.h> 15 13 16 /* 14 /* 17 * SCSI opcodes 15 * SCSI opcodes 18 */ 16 */ 19 17 20 #define TEST_UNIT_READY 0x00 18 #define TEST_UNIT_READY 0x00 21 #define REZERO_UNIT 0x01 19 #define REZERO_UNIT 0x01 22 #define REQUEST_SENSE 0x03 20 #define REQUEST_SENSE 0x03 23 #define FORMAT_UNIT 0x04 21 #define FORMAT_UNIT 0x04 24 #define READ_BLOCK_LIMITS 0x05 22 #define READ_BLOCK_LIMITS 0x05 25 #define REASSIGN_BLOCKS 0x07 23 #define REASSIGN_BLOCKS 0x07 26 #define INITIALIZE_ELEMENT_STATUS 0x07 24 #define INITIALIZE_ELEMENT_STATUS 0x07 27 #define READ_6 0x08 25 #define READ_6 0x08 28 #define WRITE_6 0x0a 26 #define WRITE_6 0x0a 29 #define SEEK_6 0x0b 27 #define SEEK_6 0x0b 30 #define READ_REVERSE 0x0f 28 #define READ_REVERSE 0x0f 31 #define WRITE_FILEMARKS 0x10 29 #define WRITE_FILEMARKS 0x10 32 #define SPACE 0x11 30 #define SPACE 0x11 33 #define INQUIRY 0x12 31 #define INQUIRY 0x12 34 #define RECOVER_BUFFERED_DATA 0x14 32 #define RECOVER_BUFFERED_DATA 0x14 35 #define MODE_SELECT 0x15 33 #define MODE_SELECT 0x15 36 #define RESERVE 0x16 34 #define RESERVE 0x16 37 #define RELEASE 0x17 35 #define RELEASE 0x17 38 #define COPY 0x18 36 #define COPY 0x18 39 #define ERASE 0x19 37 #define ERASE 0x19 40 #define MODE_SENSE 0x1a 38 #define MODE_SENSE 0x1a 41 #define START_STOP 0x1b 39 #define START_STOP 0x1b 42 #define RECEIVE_DIAGNOSTIC 0x1c 40 #define RECEIVE_DIAGNOSTIC 0x1c 43 #define SEND_DIAGNOSTIC 0x1d 41 #define SEND_DIAGNOSTIC 0x1d 44 #define ALLOW_MEDIUM_REMOVAL 0x1e 42 #define ALLOW_MEDIUM_REMOVAL 0x1e 45 43 46 #define READ_FORMAT_CAPACITIES 0x23 44 #define READ_FORMAT_CAPACITIES 0x23 47 #define SET_WINDOW 0x24 45 #define SET_WINDOW 0x24 48 #define READ_CAPACITY 0x25 46 #define READ_CAPACITY 0x25 49 #define READ_10 0x28 47 #define READ_10 0x28 50 #define WRITE_10 0x2a 48 #define WRITE_10 0x2a 51 #define SEEK_10 0x2b 49 #define SEEK_10 0x2b 52 #define POSITION_TO_ELEMENT 0x2b 50 #define POSITION_TO_ELEMENT 0x2b 53 #define WRITE_VERIFY 0x2e 51 #define WRITE_VERIFY 0x2e 54 #define VERIFY 0x2f 52 #define VERIFY 0x2f 55 #define SEARCH_HIGH 0x30 53 #define SEARCH_HIGH 0x30 56 #define SEARCH_EQUAL 0x31 54 #define SEARCH_EQUAL 0x31 57 #define SEARCH_LOW 0x32 55 #define SEARCH_LOW 0x32 58 #define SET_LIMITS 0x33 56 #define SET_LIMITS 0x33 59 #define PRE_FETCH 0x34 57 #define PRE_FETCH 0x34 60 #define READ_POSITION 0x34 58 #define READ_POSITION 0x34 61 #define SYNCHRONIZE_CACHE 0x35 59 #define SYNCHRONIZE_CACHE 0x35 62 #define LOCK_UNLOCK_CACHE 0x36 60 #define LOCK_UNLOCK_CACHE 0x36 63 #define READ_DEFECT_DATA 0x37 61 #define READ_DEFECT_DATA 0x37 64 #define MEDIUM_SCAN 0x38 62 #define MEDIUM_SCAN 0x38 65 #define COMPARE 0x39 63 #define COMPARE 0x39 66 #define COPY_VERIFY 0x3a 64 #define COPY_VERIFY 0x3a 67 #define WRITE_BUFFER 0x3b 65 #define WRITE_BUFFER 0x3b 68 #define READ_BUFFER 0x3c 66 #define READ_BUFFER 0x3c 69 #define UPDATE_BLOCK 0x3d 67 #define UPDATE_BLOCK 0x3d 70 #define READ_LONG 0x3e 68 #define READ_LONG 0x3e 71 #define WRITE_LONG 0x3f 69 #define WRITE_LONG 0x3f 72 #define CHANGE_DEFINITION 0x40 70 #define CHANGE_DEFINITION 0x40 73 #define WRITE_SAME 0x41 71 #define WRITE_SAME 0x41 74 #define UNMAP 0x42 72 #define UNMAP 0x42 75 #define READ_TOC 0x43 73 #define READ_TOC 0x43 76 #define READ_HEADER 0x44 74 #define READ_HEADER 0x44 77 #define GET_EVENT_STATUS_NOTIFICATION 0x4a 75 #define GET_EVENT_STATUS_NOTIFICATION 0x4a 78 #define LOG_SELECT 0x4c 76 #define LOG_SELECT 0x4c 79 #define LOG_SENSE 0x4d 77 #define LOG_SENSE 0x4d 80 #define XDWRITEREAD_10 0x53 78 #define XDWRITEREAD_10 0x53 81 #define MODE_SELECT_10 0x55 79 #define MODE_SELECT_10 0x55 82 #define RESERVE_10 0x56 80 #define RESERVE_10 0x56 83 #define RELEASE_10 0x57 81 #define RELEASE_10 0x57 84 #define MODE_SENSE_10 0x5a 82 #define MODE_SENSE_10 0x5a 85 #define PERSISTENT_RESERVE_IN 0x5e 83 #define PERSISTENT_RESERVE_IN 0x5e 86 #define PERSISTENT_RESERVE_OUT 0x5f 84 #define PERSISTENT_RESERVE_OUT 0x5f 87 #define VARIABLE_LENGTH_CMD 0x7f 85 #define VARIABLE_LENGTH_CMD 0x7f 88 #define REPORT_LUNS 0xa0 86 #define REPORT_LUNS 0xa0 89 #define SECURITY_PROTOCOL_IN 0xa2 87 #define SECURITY_PROTOCOL_IN 0xa2 90 #define MAINTENANCE_IN 0xa3 88 #define MAINTENANCE_IN 0xa3 91 #define MAINTENANCE_OUT 0xa4 89 #define MAINTENANCE_OUT 0xa4 92 #define MOVE_MEDIUM 0xa5 90 #define MOVE_MEDIUM 0xa5 93 #define EXCHANGE_MEDIUM 0xa6 91 #define EXCHANGE_MEDIUM 0xa6 94 #define READ_12 0xa8 92 #define READ_12 0xa8 95 #define SERVICE_ACTION_OUT_12 0xa9 93 #define SERVICE_ACTION_OUT_12 0xa9 96 #define WRITE_12 0xaa 94 #define WRITE_12 0xaa 97 #define READ_MEDIA_SERIAL_NUMBER 0xab /* Obsol 95 #define READ_MEDIA_SERIAL_NUMBER 0xab /* Obsolete with SPC-2 */ 98 #define SERVICE_ACTION_IN_12 0xab 96 #define SERVICE_ACTION_IN_12 0xab 99 #define WRITE_VERIFY_12 0xae 97 #define WRITE_VERIFY_12 0xae 100 #define VERIFY_12 0xaf 98 #define VERIFY_12 0xaf 101 #define SEARCH_HIGH_12 0xb0 99 #define SEARCH_HIGH_12 0xb0 102 #define SEARCH_EQUAL_12 0xb1 100 #define SEARCH_EQUAL_12 0xb1 103 #define SEARCH_LOW_12 0xb2 101 #define SEARCH_LOW_12 0xb2 104 #define SECURITY_PROTOCOL_OUT 0xb5 102 #define SECURITY_PROTOCOL_OUT 0xb5 105 #define READ_ELEMENT_STATUS 0xb8 103 #define READ_ELEMENT_STATUS 0xb8 106 #define SEND_VOLUME_TAG 0xb6 104 #define SEND_VOLUME_TAG 0xb6 107 #define WRITE_LONG_2 0xea 105 #define WRITE_LONG_2 0xea 108 #define EXTENDED_COPY 0x83 106 #define EXTENDED_COPY 0x83 109 #define RECEIVE_COPY_RESULTS 0x84 107 #define RECEIVE_COPY_RESULTS 0x84 110 #define ACCESS_CONTROL_IN 0x86 108 #define ACCESS_CONTROL_IN 0x86 111 #define ACCESS_CONTROL_OUT 0x87 109 #define ACCESS_CONTROL_OUT 0x87 112 #define READ_16 0x88 110 #define READ_16 0x88 113 #define COMPARE_AND_WRITE 0x89 111 #define COMPARE_AND_WRITE 0x89 114 #define WRITE_16 0x8a 112 #define WRITE_16 0x8a 115 #define READ_ATTRIBUTE 0x8c 113 #define READ_ATTRIBUTE 0x8c 116 #define WRITE_ATTRIBUTE 0x8d 114 #define WRITE_ATTRIBUTE 0x8d 117 #define WRITE_VERIFY_16 0x8e 115 #define WRITE_VERIFY_16 0x8e 118 #define VERIFY_16 0x8f 116 #define VERIFY_16 0x8f 119 #define SYNCHRONIZE_CACHE_16 0x91 117 #define SYNCHRONIZE_CACHE_16 0x91 120 #define WRITE_SAME_16 0x93 118 #define WRITE_SAME_16 0x93 121 #define ZBC_OUT 0x94 119 #define ZBC_OUT 0x94 122 #define ZBC_IN 0x95 120 #define ZBC_IN 0x95 123 #define WRITE_ATOMIC_16 0x9c << 124 #define SERVICE_ACTION_BIDIRECTIONAL 0x9d 121 #define SERVICE_ACTION_BIDIRECTIONAL 0x9d 125 #define SERVICE_ACTION_IN_16 0x9e 122 #define SERVICE_ACTION_IN_16 0x9e 126 #define SERVICE_ACTION_OUT_16 0x9f 123 #define SERVICE_ACTION_OUT_16 0x9f 127 /* values for service action in */ 124 /* values for service action in */ 128 #define SAI_READ_CAPACITY_16 0x10 125 #define SAI_READ_CAPACITY_16 0x10 129 #define SAI_GET_LBA_STATUS 0x12 126 #define SAI_GET_LBA_STATUS 0x12 130 #define SAI_REPORT_REFERRALS 0x13 127 #define SAI_REPORT_REFERRALS 0x13 131 #define SAI_GET_STREAM_STATUS 0x16 !! 128 /* values for VARIABLE_LENGTH_CMD service action codes >> 129 * see spc4r17 Section D.3.5, table D.7 and D.8 */ >> 130 #define VLC_SA_RECEIVE_CREDENTIAL 0x1800 132 /* values for maintenance in */ 131 /* values for maintenance in */ 133 #define MI_REPORT_IDENTIFYING_INFORMATION 0x05 132 #define MI_REPORT_IDENTIFYING_INFORMATION 0x05 134 #define MI_REPORT_TARGET_PGS 0x0a 133 #define MI_REPORT_TARGET_PGS 0x0a 135 #define MI_REPORT_ALIASES 0x0b 134 #define MI_REPORT_ALIASES 0x0b 136 #define MI_REPORT_SUPPORTED_OPERATION_CODES 0x 135 #define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c 137 #define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FU 136 #define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d 138 #define MI_REPORT_PRIORITY 0x0e 137 #define MI_REPORT_PRIORITY 0x0e 139 #define MI_REPORT_TIMESTAMP 0x0f 138 #define MI_REPORT_TIMESTAMP 0x0f 140 #define MI_MANAGEMENT_PROTOCOL_IN 0x10 139 #define MI_MANAGEMENT_PROTOCOL_IN 0x10 141 /* value for MI_REPORT_TARGET_PGS ext header * 140 /* value for MI_REPORT_TARGET_PGS ext header */ 142 #define MI_EXT_HDR_PARAM_FMT 0x20 141 #define MI_EXT_HDR_PARAM_FMT 0x20 143 /* values for maintenance out */ 142 /* values for maintenance out */ 144 #define MO_SET_IDENTIFYING_INFORMATION 0x06 143 #define MO_SET_IDENTIFYING_INFORMATION 0x06 145 #define MO_SET_TARGET_PGS 0x0a 144 #define MO_SET_TARGET_PGS 0x0a 146 #define MO_CHANGE_ALIASES 0x0b 145 #define MO_CHANGE_ALIASES 0x0b 147 #define MO_SET_PRIORITY 0x0e 146 #define MO_SET_PRIORITY 0x0e 148 #define MO_SET_TIMESTAMP 0x0f 147 #define MO_SET_TIMESTAMP 0x0f 149 #define MO_MANAGEMENT_PROTOCOL_OUT 0x10 148 #define MO_MANAGEMENT_PROTOCOL_OUT 0x10 150 /* values for ZBC_IN */ 149 /* values for ZBC_IN */ 151 #define ZI_REPORT_ZONES 0x00 150 #define ZI_REPORT_ZONES 0x00 152 /* values for ZBC_OUT */ 151 /* values for ZBC_OUT */ 153 #define ZO_CLOSE_ZONE 0x01 152 #define ZO_CLOSE_ZONE 0x01 154 #define ZO_FINISH_ZONE 0x02 153 #define ZO_FINISH_ZONE 0x02 155 #define ZO_OPEN_ZONE 0x03 154 #define ZO_OPEN_ZONE 0x03 156 #define ZO_RESET_WRITE_POINTER 0x04 155 #define ZO_RESET_WRITE_POINTER 0x04 157 /* values for PR in service action */ << 158 #define READ_KEYS 0x00 << 159 #define READ_RESERVATION 0x01 << 160 #define REPORT_CAPABILITES 0x02 << 161 #define READ_FULL_STATUS 0x03 << 162 /* values for variable length command */ 156 /* values for variable length command */ 163 #define XDREAD_32 0x03 157 #define XDREAD_32 0x03 164 #define XDWRITE_32 0x04 158 #define XDWRITE_32 0x04 165 #define XPWRITE_32 0x06 159 #define XPWRITE_32 0x06 166 #define XDWRITEREAD_32 0x07 160 #define XDWRITEREAD_32 0x07 167 #define READ_32 0x09 161 #define READ_32 0x09 168 #define VERIFY_32 0x0a 162 #define VERIFY_32 0x0a 169 #define WRITE_32 0x0b 163 #define WRITE_32 0x0b 170 #define WRITE_VERIFY_32 0x0c << 171 #define WRITE_SAME_32 0x0d 164 #define WRITE_SAME_32 0x0d 172 #define ATA_32 0x1ff0 << 173 165 174 /* Values for T10/04-262r7 */ 166 /* Values for T10/04-262r7 */ 175 #define ATA_16 0x85 /* 16- 167 #define ATA_16 0x85 /* 16-byte pass-thru */ 176 #define ATA_12 0xa1 /* 12- 168 #define ATA_12 0xa1 /* 12-byte pass-thru */ 177 169 178 /* Vendor specific CDBs start here */ 170 /* Vendor specific CDBs start here */ 179 #define VENDOR_SPECIFIC_CDB 0xc0 171 #define VENDOR_SPECIFIC_CDB 0xc0 180 172 181 /* 173 /* 182 * SCSI command lengths 174 * SCSI command lengths 183 */ 175 */ 184 176 185 #define SCSI_MAX_VARLEN_CDB_SIZE 260 177 #define SCSI_MAX_VARLEN_CDB_SIZE 260 186 178 187 /* defined in T10 SCSI Primary Commands-2 (SPC 179 /* defined in T10 SCSI Primary Commands-2 (SPC2) */ 188 struct scsi_varlen_cdb_hdr { 180 struct scsi_varlen_cdb_hdr { 189 __u8 opcode; /* opcode always = 181 __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ 190 __u8 control; 182 __u8 control; 191 __u8 misc[5]; 183 __u8 misc[5]; 192 __u8 additional_cdb_length; /* 184 __u8 additional_cdb_length; /* total cdb length - 8 */ 193 __be16 service_action; 185 __be16 service_action; 194 /* service specific data follows */ 186 /* service specific data follows */ 195 }; 187 }; 196 188 197 /* 189 /* 198 * SCSI Architecture Model (SAM) Status codes 190 * SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft 199 * T10/1561-D Revision 4 Draft dated 7th Nove 191 * T10/1561-D Revision 4 Draft dated 7th November 2002. 200 */ 192 */ 201 enum sam_status { !! 193 #define SAM_STAT_GOOD 0x00 202 SAM_STAT_GOOD !! 194 #define SAM_STAT_CHECK_CONDITION 0x02 203 SAM_STAT_CHECK_CONDITION !! 195 #define SAM_STAT_CONDITION_MET 0x04 204 SAM_STAT_CONDITION_MET !! 196 #define SAM_STAT_BUSY 0x08 205 SAM_STAT_BUSY !! 197 #define SAM_STAT_INTERMEDIATE 0x10 206 SAM_STAT_INTERMEDIATE !! 198 #define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14 207 SAM_STAT_INTERMEDIATE_CONDITION_MET !! 199 #define SAM_STAT_RESERVATION_CONFLICT 0x18 208 SAM_STAT_RESERVATION_CONFLICT !! 200 #define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */ 209 SAM_STAT_COMMAND_TERMINATED !! 201 #define SAM_STAT_TASK_SET_FULL 0x28 210 SAM_STAT_TASK_SET_FULL !! 202 #define SAM_STAT_ACA_ACTIVE 0x30 211 SAM_STAT_ACA_ACTIVE !! 203 #define SAM_STAT_TASK_ABORTED 0x40 212 SAM_STAT_TASK_ABORTED !! 204 213 }; !! 205 /* >> 206 * Status codes. These are deprecated as they are shifted 1 bit right >> 207 * from those found in the SCSI standards. This causes confusion for >> 208 * applications that are ported to several OSes. Prefer SAM Status codes >> 209 * above. >> 210 */ 214 211 215 #define STATUS_MASK 0xfe !! 212 #define GOOD 0x00 >> 213 #define CHECK_CONDITION 0x01 >> 214 #define CONDITION_GOOD 0x02 >> 215 #define BUSY 0x04 >> 216 #define INTERMEDIATE_GOOD 0x08 >> 217 #define INTERMEDIATE_C_GOOD 0x0a >> 218 #define RESERVATION_CONFLICT 0x0c >> 219 #define COMMAND_TERMINATED 0x11 >> 220 #define QUEUE_FULL 0x14 >> 221 #define ACA_ACTIVE 0x18 >> 222 #define TASK_ABORTED 0x20 >> 223 >> 224 #define STATUS_MASK 0xfe 216 225 217 /* 226 /* 218 * SENSE KEYS 227 * SENSE KEYS 219 */ 228 */ >> 229 220 #define NO_SENSE 0x00 230 #define NO_SENSE 0x00 221 #define RECOVERED_ERROR 0x01 231 #define RECOVERED_ERROR 0x01 222 #define NOT_READY 0x02 232 #define NOT_READY 0x02 223 #define MEDIUM_ERROR 0x03 233 #define MEDIUM_ERROR 0x03 224 #define HARDWARE_ERROR 0x04 234 #define HARDWARE_ERROR 0x04 225 #define ILLEGAL_REQUEST 0x05 235 #define ILLEGAL_REQUEST 0x05 226 #define UNIT_ATTENTION 0x06 236 #define UNIT_ATTENTION 0x06 227 #define DATA_PROTECT 0x07 237 #define DATA_PROTECT 0x07 228 #define BLANK_CHECK 0x08 238 #define BLANK_CHECK 0x08 229 #define VENDOR_SPECIFIC 0x09 << 230 #define COPY_ABORTED 0x0a 239 #define COPY_ABORTED 0x0a 231 #define ABORTED_COMMAND 0x0b 240 #define ABORTED_COMMAND 0x0b 232 #define VOLUME_OVERFLOW 0x0d 241 #define VOLUME_OVERFLOW 0x0d 233 #define MISCOMPARE 0x0e 242 #define MISCOMPARE 0x0e 234 #define COMPLETED 0x0f !! 243 235 244 236 /* 245 /* 237 * DEVICE TYPES 246 * DEVICE TYPES 238 * Please keep them in 0x%02x format for $MOD 247 * Please keep them in 0x%02x format for $MODALIAS to work 239 */ 248 */ 240 249 241 #define TYPE_DISK 0x00 250 #define TYPE_DISK 0x00 242 #define TYPE_TAPE 0x01 251 #define TYPE_TAPE 0x01 243 #define TYPE_PRINTER 0x02 252 #define TYPE_PRINTER 0x02 244 #define TYPE_PROCESSOR 0x03 /* HP scan 253 #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ 245 #define TYPE_WORM 0x04 /* Treated 254 #define TYPE_WORM 0x04 /* Treated as ROM by our system */ 246 #define TYPE_ROM 0x05 255 #define TYPE_ROM 0x05 247 #define TYPE_SCANNER 0x06 256 #define TYPE_SCANNER 0x06 248 #define TYPE_MOD 0x07 /* Magneto 257 #define TYPE_MOD 0x07 /* Magneto-optical disk - 249 * - treat 258 * - treated as TYPE_DISK */ 250 #define TYPE_MEDIUM_CHANGER 0x08 259 #define TYPE_MEDIUM_CHANGER 0x08 251 #define TYPE_COMM 0x09 /* Communi 260 #define TYPE_COMM 0x09 /* Communications device */ 252 #define TYPE_RAID 0x0c 261 #define TYPE_RAID 0x0c 253 #define TYPE_ENCLOSURE 0x0d /* Enclosu 262 #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ 254 #define TYPE_RBC 0x0e 263 #define TYPE_RBC 0x0e 255 #define TYPE_OSD 0x11 264 #define TYPE_OSD 0x11 256 #define TYPE_ZBC 0x14 265 #define TYPE_ZBC 0x14 257 #define TYPE_WLUN 0x1e /* well-kn 266 #define TYPE_WLUN 0x1e /* well-known logical unit */ 258 #define TYPE_NO_LUN 0x7f 267 #define TYPE_NO_LUN 0x7f 259 268 260 /* SCSI protocols; these are taken from SPC-3 269 /* SCSI protocols; these are taken from SPC-3 section 7.5 */ 261 enum scsi_protocol { 270 enum scsi_protocol { 262 SCSI_PROTOCOL_FCP = 0, /* Fibre Chann 271 SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ 263 SCSI_PROTOCOL_SPI = 1, /* parallel SC 272 SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ 264 SCSI_PROTOCOL_SSA = 2, /* Serial Stor 273 SCSI_PROTOCOL_SSA = 2, /* Serial Storage Architecture - Obsolete */ 265 SCSI_PROTOCOL_SBP = 3, /* firewire */ 274 SCSI_PROTOCOL_SBP = 3, /* firewire */ 266 SCSI_PROTOCOL_SRP = 4, /* Infiniband 275 SCSI_PROTOCOL_SRP = 4, /* Infiniband RDMA */ 267 SCSI_PROTOCOL_ISCSI = 5, 276 SCSI_PROTOCOL_ISCSI = 5, 268 SCSI_PROTOCOL_SAS = 6, 277 SCSI_PROTOCOL_SAS = 6, 269 SCSI_PROTOCOL_ADT = 7, /* Media Chang 278 SCSI_PROTOCOL_ADT = 7, /* Media Changers */ 270 SCSI_PROTOCOL_ATA = 8, 279 SCSI_PROTOCOL_ATA = 8, 271 SCSI_PROTOCOL_UNSPEC = 0xf, /* No spec 280 SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */ 272 }; 281 }; 273 282 274 /* 283 /* 275 * ScsiLun: 8 byte LUN. 284 * ScsiLun: 8 byte LUN. 276 */ 285 */ 277 struct scsi_lun { 286 struct scsi_lun { 278 __u8 scsi_lun[8]; 287 __u8 scsi_lun[8]; 279 }; 288 }; 280 289 281 /* SBC-5 IO advice hints group descriptor */ << 282 struct scsi_io_group_descriptor { << 283 #if defined(__BIG_ENDIAN) << 284 u8 io_advice_hints_mode: 2; << 285 u8 reserved1: 3; << 286 u8 st_enble: 1; << 287 u8 cs_enble: 1; << 288 u8 ic_enable: 1; << 289 #elif defined(__LITTLE_ENDIAN) << 290 u8 ic_enable: 1; << 291 u8 cs_enble: 1; << 292 u8 st_enble: 1; << 293 u8 reserved1: 3; << 294 u8 io_advice_hints_mode: 2; << 295 #else << 296 #error << 297 #endif << 298 u8 reserved2[3]; << 299 /* Logical block markup descriptor */ << 300 #if defined(__BIG_ENDIAN) << 301 u8 acdlu: 1; << 302 u8 reserved3: 1; << 303 u8 rlbsr: 2; << 304 u8 lbm_descriptor_type: 4; << 305 #elif defined(__LITTLE_ENDIAN) << 306 u8 lbm_descriptor_type: 4; << 307 u8 rlbsr: 2; << 308 u8 reserved3: 1; << 309 u8 acdlu: 1; << 310 #else << 311 #error << 312 #endif << 313 u8 params[2]; << 314 u8 reserved4; << 315 u8 reserved5[8]; << 316 }; << 317 << 318 static_assert(sizeof(struct scsi_io_group_desc << 319 << 320 /* SCSI stream status descriptor */ << 321 struct scsi_stream_status { << 322 #if defined(__BIG_ENDIAN) << 323 u8 perm: 1; << 324 u8 reserved1: 7; << 325 #elif defined(__LITTLE_ENDIAN) << 326 u8 reserved1: 7; << 327 u8 perm: 1; << 328 #else << 329 #error << 330 #endif << 331 u8 reserved2; << 332 __be16 stream_identifier; << 333 #if defined(__BIG_ENDIAN) << 334 u8 reserved3: 2; << 335 u8 rel_lifetime: 6; << 336 #elif defined(__LITTLE_ENDIAN) << 337 u8 rel_lifetime: 6; << 338 u8 reserved3: 2; << 339 #else << 340 #error << 341 #endif << 342 u8 reserved4[3]; << 343 }; << 344 << 345 static_assert(sizeof(struct scsi_stream_status << 346 << 347 /* GET STREAM STATUS parameter data */ << 348 struct scsi_stream_status_header { << 349 __be32 len; /* length in bytes of << 350 u16 reserved; << 351 __be16 number_of_open_streams; << 352 DECLARE_FLEX_ARRAY(struct scsi_stream_ << 353 }; << 354 << 355 static_assert(sizeof(struct scsi_stream_status << 356 << 357 /* SPC asymmetric access states */ 290 /* SPC asymmetric access states */ 358 #define SCSI_ACCESS_STATE_OPTIMAL 0x00 291 #define SCSI_ACCESS_STATE_OPTIMAL 0x00 359 #define SCSI_ACCESS_STATE_ACTIVE 0x01 292 #define SCSI_ACCESS_STATE_ACTIVE 0x01 360 #define SCSI_ACCESS_STATE_STANDBY 0x02 293 #define SCSI_ACCESS_STATE_STANDBY 0x02 361 #define SCSI_ACCESS_STATE_UNAVAILABLE 0x03 294 #define SCSI_ACCESS_STATE_UNAVAILABLE 0x03 362 #define SCSI_ACCESS_STATE_LBA 0x04 295 #define SCSI_ACCESS_STATE_LBA 0x04 363 #define SCSI_ACCESS_STATE_OFFLINE 0x0e 296 #define SCSI_ACCESS_STATE_OFFLINE 0x0e 364 #define SCSI_ACCESS_STATE_TRANSITIONING 0x0f 297 #define SCSI_ACCESS_STATE_TRANSITIONING 0x0f 365 298 366 /* Values for REPORT TARGET GROUP STATES */ 299 /* Values for REPORT TARGET GROUP STATES */ 367 #define SCSI_ACCESS_STATE_MASK 0x0f 300 #define SCSI_ACCESS_STATE_MASK 0x0f 368 #define SCSI_ACCESS_STATE_PREFERRED 0x80 301 #define SCSI_ACCESS_STATE_PREFERRED 0x80 369 302 370 /* Reporting options for REPORT ZONES */ 303 /* Reporting options for REPORT ZONES */ 371 enum zbc_zone_reporting_options { 304 enum zbc_zone_reporting_options { 372 ZBC_ZONE_REPORTING_OPTION_ALL !! 305 ZBC_ZONE_REPORTING_OPTION_ALL = 0, 373 ZBC_ZONE_REPORTING_OPTION_EMPTY !! 306 ZBC_ZONE_REPORTING_OPTION_EMPTY, 374 ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPE !! 307 ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN, 375 ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPE !! 308 ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN, 376 ZBC_ZONE_REPORTING_OPTION_CLOSED !! 309 ZBC_ZONE_REPORTING_OPTION_CLOSED, 377 ZBC_ZONE_REPORTING_OPTION_FULL !! 310 ZBC_ZONE_REPORTING_OPTION_FULL, 378 ZBC_ZONE_REPORTING_OPTION_READONLY !! 311 ZBC_ZONE_REPORTING_OPTION_READONLY, 379 ZBC_ZONE_REPORTING_OPTION_OFFLINE !! 312 ZBC_ZONE_REPORTING_OPTION_OFFLINE, 380 /* 0x08 to 0x0f are reserved */ !! 313 ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP = 0x10, 381 ZBC_ZONE_REPORTING_OPTION_NEED_RESET_W !! 314 ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE, 382 ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE !! 315 ZBC_ZONE_REPORTING_OPTION_NON_WP = 0x3f, 383 /* 0x12 to 0x3e are reserved */ << 384 ZBC_ZONE_REPORTING_OPTION_NON_WP << 385 }; 316 }; 386 317 387 #define ZBC_REPORT_ZONE_PARTIAL 0x80 318 #define ZBC_REPORT_ZONE_PARTIAL 0x80 388 << 389 /* Zone types of REPORT ZONES zone descriptors << 390 enum zbc_zone_type { << 391 ZBC_ZONE_TYPE_CONV = 0x1, << 392 ZBC_ZONE_TYPE_SEQWRITE_REQ = 0x2, << 393 ZBC_ZONE_TYPE_SEQWRITE_PREF = 0x3, << 394 ZBC_ZONE_TYPE_SEQ_OR_BEFORE_REQ = 0x4, << 395 ZBC_ZONE_TYPE_GAP = 0x5, << 396 /* 0x6 to 0xf are reserved */ << 397 }; << 398 << 399 /* Zone conditions of REPORT ZONES zone descri << 400 enum zbc_zone_cond { << 401 ZBC_ZONE_COND_NO_WP = 0x0, << 402 ZBC_ZONE_COND_EMPTY = 0x1, << 403 ZBC_ZONE_COND_IMP_OPEN = 0x2, << 404 ZBC_ZONE_COND_EXP_OPEN = 0x3, << 405 ZBC_ZONE_COND_CLOSED = 0x4, << 406 /* 0x5 to 0xc are reserved */ << 407 ZBC_ZONE_COND_READONLY = 0xd, << 408 ZBC_ZONE_COND_FULL = 0xe, << 409 ZBC_ZONE_COND_OFFLINE = 0xf, << 410 }; << 411 << 412 enum zbc_zone_alignment_method { << 413 ZBC_CONSTANT_ZONE_LENGTH = 0x1, << 414 ZBC_CONSTANT_ZONE_START_OFFSET = 0x8, << 415 }; << 416 << 417 /* Version descriptor values for INQUIRY */ << 418 enum scsi_version_descriptor { << 419 SCSI_VERSION_DESCRIPTOR_FCP4 = 0x0a << 420 SCSI_VERSION_DESCRIPTOR_ISCSI = 0x09 << 421 SCSI_VERSION_DESCRIPTOR_SAM5 = 0x00 << 422 SCSI_VERSION_DESCRIPTOR_SAS3 = 0x0c << 423 SCSI_VERSION_DESCRIPTOR_SBC3 = 0x04 << 424 SCSI_VERSION_DESCRIPTOR_SBP3 = 0x09 << 425 SCSI_VERSION_DESCRIPTOR_SPC4 = 0x04 << 426 SCSI_VERSION_DESCRIPTOR_SRP = 0x09 << 427 }; << 428 << 429 enum scsi_support_opcode { << 430 SCSI_SUPPORT_NO_INFO = 0, << 431 SCSI_SUPPORT_NOT_SUPPORTED = 1, << 432 SCSI_SUPPORT_FULL = 3, << 433 SCSI_SUPPORT_VENDOR = 5, << 434 }; << 435 << 436 #define SCSI_CONTROL_MASK 0 << 437 #define SCSI_GROUP_NUMBER_MASK 0 << 438 319 439 #endif /* _SCSI_PROTO_H_ */ 320 #endif /* _SCSI_PROTO_H_ */ 440 321
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.