📄 scsi_cmds.h
字号:
uint8 top_LBA; uint8 high_LBA; uint8 mid_LBA; uint8 low_LBA; uint8 top_length; // 0 = no block uint8 high_length; uint8 mid_length; uint8 low_length; uint8 res10; uint8 control;} scsi_cmd_rw_12;// REQUEST SENSEtypedef struct scsi_cmd_request_sense { uint8 opcode; LBITFIELD8_2( res1_0 : 5, LUN : 3 ); uint8 res2[2]; uint8 alloc_length; uint8 control;} scsi_cmd_request_sense;// sense data structures#define SCSIS_CURR_ERROR 0x70#define SCSIS_DEFERRED_ERROR 0x71typedef struct scsi_sense { LBITFIELD8_2( error_code : 7, valid : 1 // 0 = not conforming to standard ); uint8 segment_number; // for COPY/COPY AND VERIFY/COMPARE LBITFIELD8_5( sense_key : 4, res2_4 : 1, ILI : 1, // incorrect length indicator - req. block // length doesn't match physical block length EOM : 1, // serial devices only Filemark : 1 // optional for random access ); uint8 highest_inf; // device-type or command specific uint8 high_inf; // device-type 0, 4, 5, 7: block address uint8 mid_inf; // device-type 1, 2, 3: req length - act. length uint8 low_inf; // (and others for sequential dev. and COPY cmds uint8 add_sense_length; // total length = this + 7 uint8 highest_cmd_inf; uint8 high_cmd_inf; uint8 mid_cmd_inf; uint8 low_cmd_inf; uint8 asc; uint8 ascq; // this can be zero if unsupported uint8 unit_code; // != 0 to specify internal device unit union { struct { LBITFIELD8_2( high_key_spec : 7, SKSV : 1 // 1 = sense key specific (byte 15-17) valid ); uint8 mid_key_spec; uint8 low_key_spec; } raw; // ILLEGAL REQUEST struct { LBITFIELD8_5( bit_pointer : 3, // points to (highest) invalid bit of parameter BPV : 1, // 1 = bit_pointer is valid res15_4 : 2, c_d : 2, // 1 = error command, 0 = error in data SKSV : 1 // s.a. ); uint8 high_field_pointer; // points to (highest) invalid byte of parameter uint8 low_field_pointer; // (!using big endian, this means the first byte!) } ill_request; // access error (RECOVERED, HARDWARE or MEDIUM ERROR) struct { LBITFIELD8_2( res15_0 : 7, SKSV : 1 ); uint8 high_retry_cnt; uint8 low_retry_cnt; } acc_error; // format progress (if sense key = NOT READY) struct { LBITFIELD8_2( res15_0 : 7, SKSV : 1 ); uint8 high_progress; // 0 = start, 0xffff = almost finished uint8 low_progress; } format_progress; } sense_key_spec; // starting with offset 18 there are additional sense byte} scsi_sense;// PREVENT ALLOWtypedef struct scsi_cmd_prevent_allow { uint8 opcode; LBITFIELD8_2( res1_0 : 5, LUN : 3 ); uint8 res2[2]; LBITFIELD8_2( prevent : 1, res4_1 : 7 ); uint8 control;} scsi_cmd_prevent_allow;// START STOP UNITtypedef struct scsi_cmd_ssu { uint8 opcode; LBITFIELD8_3( immed : 1, // 1 - return immediately, 0 - waiting until completed res1_1 : 4, LUN : 3 ); uint8 res2[2]; LBITFIELD8_3( start : 1, // 1 - load+start, i.e. allow, 0 - eject+stop, i.e. deny LoEj : 1, // 1 - include loading/ejecting, 0 - only to allow/deny res4_2 : 6 ); uint8 control;} scsi_cmd_ssu;// MODE SELECT (6)typedef struct scsi_cmd_mode_select_6 { uint8 opcode; LBITFIELD8_4( SP : 1, // 1 = save pages to non-volatile memory res1_1 : 3, PF : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format LUN : 3 ); uint8 res2[2]; uint8 param_list_length; // data size uint8 control;} scsi_cmd_mode_select_6;// MODE SENSE (6)typedef struct scsi_cmd_mode_sense_6 { uint8 opcode; LBITFIELD8_4( res1_0 : 3, DBD : 1, // disable block descriptors res1_4 : 1, LUN : 3 ); LBITFIELD8_2( page_code : 6, PC : 2 // page control field ); uint8 res3; uint8 allocation_length; // maximum amount of data uint8 control;} scsi_cmd_mode_sense_6;// MODE SELECT (10)typedef struct scsi_cmd_mode_select_10 { uint8 opcode; LBITFIELD8_4( SP : 1, // 1 = save pages to non-volatile memory res1_1 : 3, PF : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format LUN : 3 ); uint8 res2[5]; uint8 high_param_list_length; // data size uint8 low_param_list_length; uint8 control;} scsi_cmd_mode_select_10;// MODE SENSE (10)typedef struct scsi_cmd_mode_sense_10 { uint8 opcode; LBITFIELD8_4( res1_0 : 3, DBD : 1, // disable block descriptors res1_4 : 1, LUN : 3 ); LBITFIELD8_2( page_code : 6, PC : 2 // page control field ); uint8 res3[4]; uint8 high_allocation_length; // maximum amount of data uint8 low_allocation_length; uint8 control;} scsi_cmd_mode_sense_10;// possible contents of PC#define SCSI_MODE_SENE_PC_CURRENT 0#define SCSI_MODE_SENE_PC_CHANGABLE 1 // changable field are filled with "1"#define SCSI_MODE_SENE_PC_DEFAULT 2#define SCSI_MODE_SENE_PC_SAVED 3// special mode page indicating to return all mode pages#define SCSI_MODEPAGE_ALL 0x3f// header of mode data; followed by block descriptors and mode pagestypedef struct scsi_mode_param_header_6 { uint8 mode_data_len; // total length excluding this byte uint8 medium_type; uint8 dev_spec_parameter; uint8 block_desc_len; // total length of all transmitted block descriptors} scsi_mode_param_header_6;typedef struct scsi_mode_param_header_10 { uint8 high_mode_data_len; // total length excluding this byte uint8 low_mode_data_len; uint8 medium_type; uint8 dev_spec_parameter; uint8 res4[2]; uint8 high_block_desc_len; // total length of all transmitted block descriptors uint8 low_block_desc_len;} scsi_mode_param_header_10;// content of dev_spec_parameter for direct access devicestypedef struct scsi_mode_param_dev_spec_da { LBITFIELD8_4( res0_0 : 4, DPOFUA : 1, // 1 = supports DPO and FUA, see READ (10) (sense only) res0_6 : 1, WP : 1 // write protected (sense only) );} scsi_mode_param_dev_spec_da;typedef struct scsi_mode_param_block_desc { uint8 density; // density code of area uint8 high_numblocks; // size of this area in blocks uint8 med_numblocks; // 0 = all remaining blocks uint8 low_numblocks; uint8 res4; uint8 high_blocklen; // block size uint8 med_blocklen; uint8 low_blocklen;} scsi_mode_param_block_desc;// header of a mode pagestypedef struct scsi_modepage_header { LBITFIELD8_3( page_code : 6, res0_6 : 1, PS : 1 // 1 = page can be saved (only valid for MODE SENSE) ); uint8 page_length; // size of page excluding this common header} scsi_modepage_header;// control mode page#define SCSI_MODEPAGE_CONTROL 0xatypedef struct scsi_modepage_contr { scsi_modepage_header header; LBITFIELD8_2( RLEC : 1, // Report Log Exception Condition res2_1 : 7 ); LBITFIELD8_4( DQue : 1, // disable Queuing QErr : 1, // abort queued commands on contingent allegiance condition res3_2 : 2, QAM : 4 // Queue Algorithm Modifier ); LBITFIELD8_5( EAENP : 1, // error AEN permission; true = send AEN on deferred error // false = generate UA condition after deferred error UAAENP : 1, // unit attention AEN permission; true = send AEN, // false = generate UA condition (for everything but init.) RAENP : 1, // ready AEN permission; true = send async event notification // (AEN) instead of generating an Unit Attention (UA) Condition // after initialization res4_3 : 4, EECA : 1 // enable Extended Contingent Allegiance ); uint8 res5; uint8 high_AEN_holdoff; // ready AEN hold off period - delay in ms between uint8 low_AEN_holdoff; // initialization and AEN} scsi_modepage_contr;// values for QAM#define SCSI_QAM_RESTRICTED 0#define SCSI_QAM_UNRESTRICTED 1// 2 - 7 reserved, 8 - 0xf vendor-specific// TURtypedef struct scsi_cmd_tur { uint8 opcode; LBITFIELD8_2( res1_0 : 5, LUN : 3 ); uint8 res3[3]; uint8 control;} scsi_cmd_tur;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -