1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _SCSI_GENERIC_H 8 #define _SCSI_GENERIC_H 9 #include <linux/compiler.h> 10 typedef struct sg_iovec { 11 void * iov_base; 12 size_t iov_len; 13 } sg_iovec_t; 14 typedef struct sg_io_hdr { 15 int interface_id; 16 int dxfer_direction; 17 unsigned char cmd_len; 18 unsigned char mx_sb_len; 19 unsigned short iovec_count; 20 unsigned int dxfer_len; 21 void * dxferp; 22 unsigned char * cmdp; 23 void * sbp; 24 unsigned int timeout; 25 unsigned int flags; 26 int pack_id; 27 void * usr_ptr; 28 unsigned char status; 29 unsigned char masked_status; 30 unsigned char msg_status; 31 unsigned char sb_len_wr; 32 unsigned short host_status; 33 unsigned short driver_status; 34 int resid; 35 unsigned int duration; 36 unsigned int info; 37 } sg_io_hdr_t; 38 #define SG_INTERFACE_ID_ORIG 'S' 39 #define SG_DXFER_NONE (- 1) 40 #define SG_DXFER_TO_DEV (- 2) 41 #define SG_DXFER_FROM_DEV (- 3) 42 #define SG_DXFER_TO_FROM_DEV (- 4) 43 #define SG_DXFER_UNKNOWN (- 5) 44 #define SG_FLAG_DIRECT_IO 1 45 #define SG_FLAG_UNUSED_LUN_INHIBIT 2 46 #define SG_FLAG_MMAP_IO 4 47 #define SG_FLAG_NO_DXFER 0x10000 48 #define SG_FLAG_Q_AT_TAIL 0x10 49 #define SG_FLAG_Q_AT_HEAD 0x20 50 #define SG_INFO_OK_MASK 0x1 51 #define SG_INFO_OK 0x0 52 #define SG_INFO_CHECK 0x1 53 #define SG_INFO_DIRECT_IO_MASK 0x6 54 #define SG_INFO_INDIRECT_IO 0x0 55 #define SG_INFO_DIRECT_IO 0x2 56 #define SG_INFO_MIXED_IO 0x4 57 #define DRIVER_SENSE 0x08 58 #define driver_byte(result) (((result) >> 24) & 0xff) 59 #define GOOD 0x00 60 #define CHECK_CONDITION 0x01 61 #define CONDITION_GOOD 0x02 62 #define BUSY 0x04 63 #define INTERMEDIATE_GOOD 0x08 64 #define INTERMEDIATE_C_GOOD 0x0a 65 #define RESERVATION_CONFLICT 0x0c 66 #define COMMAND_TERMINATED 0x11 67 #define QUEUE_FULL 0x14 68 #define ACA_ACTIVE 0x18 69 #define TASK_ABORTED 0x20 70 #define sg_status_byte(result) (((result) >> 1) & 0x7f) 71 typedef struct sg_scsi_id { 72 int host_no; 73 int channel; 74 int scsi_id; 75 int lun; 76 int scsi_type; 77 short h_cmd_per_lun; 78 short d_queue_depth; 79 int unused[2]; 80 } sg_scsi_id_t; 81 typedef struct sg_req_info { 82 char req_state; 83 char orphan; 84 char sg_io_owned; 85 char problem; 86 int pack_id; 87 void * usr_ptr; 88 unsigned int duration; 89 int unused; 90 } sg_req_info_t; 91 #define SG_EMULATED_HOST 0x2203 92 #define SG_SET_TRANSFORM 0x2204 93 #define SG_GET_TRANSFORM 0x2205 94 #define SG_SET_RESERVED_SIZE 0x2275 95 #define SG_GET_RESERVED_SIZE 0x2272 96 #define SG_GET_SCSI_ID 0x2276 97 #define SG_SET_FORCE_LOW_DMA 0x2279 98 #define SG_GET_LOW_DMA 0x227a 99 #define SG_SET_FORCE_PACK_ID 0x227b 100 #define SG_GET_PACK_ID 0x227c 101 #define SG_GET_NUM_WAITING 0x227d 102 #define SG_GET_SG_TABLESIZE 0x227F 103 #define SG_GET_VERSION_NUM 0x2282 104 #define SG_SCSI_RESET 0x2284 105 #define SG_SCSI_RESET_NOTHING 0 106 #define SG_SCSI_RESET_DEVICE 1 107 #define SG_SCSI_RESET_BUS 2 108 #define SG_SCSI_RESET_HOST 3 109 #define SG_SCSI_RESET_TARGET 4 110 #define SG_SCSI_RESET_NO_ESCALATE 0x100 111 #define SG_IO 0x2285 112 #define SG_GET_REQUEST_TABLE 0x2286 113 #define SG_SET_KEEP_ORPHAN 0x2287 114 #define SG_GET_KEEP_ORPHAN 0x2288 115 #define SG_GET_ACCESS_COUNT 0x2289 116 #define SG_SCATTER_SZ (8 * 4096) 117 #define SG_DEFAULT_RETRIES 0 118 #define SG_DEF_FORCE_PACK_ID 0 119 #define SG_DEF_KEEP_ORPHAN 0 120 #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ 121 #define SG_MAX_QUEUE 16 122 #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE 123 typedef struct sg_io_hdr Sg_io_hdr; 124 typedef struct sg_io_vec Sg_io_vec; 125 typedef struct sg_scsi_id Sg_scsi_id; 126 typedef struct sg_req_info Sg_req_info; 127 #define SG_MAX_SENSE 16 128 struct sg_header { 129 int pack_len; 130 int reply_len; 131 int pack_id; 132 int result; 133 unsigned int twelve_byte : 1; 134 unsigned int target_status : 5; 135 unsigned int host_status : 8; 136 unsigned int driver_status : 8; 137 unsigned int other_flags : 10; 138 unsigned char sense_buffer[SG_MAX_SENSE]; 139 }; 140 #define SG_SET_TIMEOUT 0x2201 141 #define SG_GET_TIMEOUT 0x2202 142 #define SG_GET_COMMAND_Q 0x2270 143 #define SG_SET_COMMAND_Q 0x2271 144 #define SG_SET_DEBUG 0x227e 145 #define SG_NEXT_CMD_LEN 0x2283 146 #define SG_DEFAULT_TIMEOUT (60 * HZ) 147 #define SG_DEF_COMMAND_Q 0 148 #define SG_DEF_UNDERRUN_FLAG 0 149 #endif 150