| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 1 | /**************************************************************************** | 
|  | 2 | **************************************************************************** | 
|  | 3 | *** | 
|  | 4 | ***   This header was automatically generated from a Linux kernel header | 
|  | 5 | ***   of the same name, to make information necessary for userspace to | 
|  | 6 | ***   call into the kernel available to libc.  It contains only constants, | 
|  | 7 | ***   structures, and macros generated from the original header, and thus, | 
|  | 8 | ***   contains no copyrightable information. | 
|  | 9 | *** | 
|  | 10 | ***   To edit the content of this header, modify the corresponding | 
|  | 11 | ***   source file (e.g. under external/kernel-headers/original/) then | 
|  | 12 | ***   run bionic/libc/kernel/tools/update_all.py | 
|  | 13 | *** | 
|  | 14 | ***   Any manual change here will be lost the next time this script will | 
|  | 15 | ***   be run. You've been warned! | 
|  | 16 | *** | 
|  | 17 | **************************************************************************** | 
|  | 18 | ****************************************************************************/ | 
|  | 19 | #ifndef _SCSI_GENERIC_H | 
|  | 20 | #define _SCSI_GENERIC_H | 
|  | 21 | #include <linux/compiler.h> | 
|  | 22 | typedef struct sg_iovec { | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 23 | void __user * iov_base; | 
|  | 24 | size_t iov_len; | 
|  | 25 | } sg_iovec_t; | 
|  | 26 | typedef struct sg_io_hdr { | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 27 | int interface_id; | 
|  | 28 | int dxfer_direction; | 
|  | 29 | unsigned char cmd_len; | 
|  | 30 | unsigned char mx_sb_len; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 31 | unsigned short iovec_count; | 
|  | 32 | unsigned int dxfer_len; | 
|  | 33 | void __user * dxferp; | 
|  | 34 | unsigned char __user * cmdp; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 35 | void __user * sbp; | 
|  | 36 | unsigned int timeout; | 
|  | 37 | unsigned int flags; | 
|  | 38 | int pack_id; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 39 | void __user * usr_ptr; | 
|  | 40 | unsigned char status; | 
|  | 41 | unsigned char masked_status; | 
|  | 42 | unsigned char msg_status; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 43 | unsigned char sb_len_wr; | 
|  | 44 | unsigned short host_status; | 
|  | 45 | unsigned short driver_status; | 
|  | 46 | int resid; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 47 | unsigned int duration; | 
|  | 48 | unsigned int info; | 
|  | 49 | } sg_io_hdr_t; | 
|  | 50 | #define SG_INTERFACE_ID_ORIG 'S' | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 51 | #define SG_DXFER_NONE (- 1) | 
|  | 52 | #define SG_DXFER_TO_DEV (- 2) | 
|  | 53 | #define SG_DXFER_FROM_DEV (- 3) | 
|  | 54 | #define SG_DXFER_TO_FROM_DEV (- 4) | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 55 | #define SG_DXFER_UNKNOWN (- 5) | 
|  | 56 | #define SG_FLAG_DIRECT_IO 1 | 
|  | 57 | #define SG_FLAG_UNUSED_LUN_INHIBIT 2 | 
|  | 58 | #define SG_FLAG_MMAP_IO 4 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 59 | #define SG_FLAG_NO_DXFER 0x10000 | 
|  | 60 | #define SG_FLAG_Q_AT_TAIL 0x10 | 
|  | 61 | #define SG_FLAG_Q_AT_HEAD 0x20 | 
|  | 62 | #define SG_INFO_OK_MASK 0x1 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 63 | #define SG_INFO_OK 0x0 | 
|  | 64 | #define SG_INFO_CHECK 0x1 | 
|  | 65 | #define SG_INFO_DIRECT_IO_MASK 0x6 | 
|  | 66 | #define SG_INFO_INDIRECT_IO 0x0 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 67 | #define SG_INFO_DIRECT_IO 0x2 | 
|  | 68 | #define SG_INFO_MIXED_IO 0x4 | 
|  | 69 | typedef struct sg_scsi_id { | 
|  | 70 | int host_no; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 71 | int channel; | 
|  | 72 | int scsi_id; | 
|  | 73 | int lun; | 
|  | 74 | int scsi_type; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 75 | short h_cmd_per_lun; | 
|  | 76 | short d_queue_depth; | 
|  | 77 | int unused[2]; | 
|  | 78 | } sg_scsi_id_t; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 79 | typedef struct sg_req_info { | 
|  | 80 | char req_state; | 
|  | 81 | char orphan; | 
|  | 82 | char sg_io_owned; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 83 | char problem; | 
|  | 84 | int pack_id; | 
|  | 85 | void __user * usr_ptr; | 
|  | 86 | unsigned int duration; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 87 | int unused; | 
|  | 88 | } sg_req_info_t; | 
|  | 89 | #define SG_EMULATED_HOST 0x2203 | 
|  | 90 | #define SG_SET_TRANSFORM 0x2204 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 91 | #define SG_GET_TRANSFORM 0x2205 | 
|  | 92 | #define SG_SET_RESERVED_SIZE 0x2275 | 
|  | 93 | #define SG_GET_RESERVED_SIZE 0x2272 | 
|  | 94 | #define SG_GET_SCSI_ID 0x2276 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 95 | #define SG_SET_FORCE_LOW_DMA 0x2279 | 
|  | 96 | #define SG_GET_LOW_DMA 0x227a | 
|  | 97 | #define SG_SET_FORCE_PACK_ID 0x227b | 
|  | 98 | #define SG_GET_PACK_ID 0x227c | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 99 | #define SG_GET_NUM_WAITING 0x227d | 
|  | 100 | #define SG_GET_SG_TABLESIZE 0x227F | 
|  | 101 | #define SG_GET_VERSION_NUM 0x2282 | 
|  | 102 | #define SG_SCSI_RESET 0x2284 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 103 | #define SG_SCSI_RESET_NOTHING 0 | 
|  | 104 | #define SG_SCSI_RESET_DEVICE 1 | 
|  | 105 | #define SG_SCSI_RESET_BUS 2 | 
|  | 106 | #define SG_SCSI_RESET_HOST 3 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 107 | #define SG_SCSI_RESET_TARGET 4 | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 108 | #define SG_SCSI_RESET_NO_ESCALATE 0x100 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 109 | #define SG_IO 0x2285 | 
|  | 110 | #define SG_GET_REQUEST_TABLE 0x2286 | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 111 | #define SG_SET_KEEP_ORPHAN 0x2287 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 112 | #define SG_GET_KEEP_ORPHAN 0x2288 | 
|  | 113 | #define SG_GET_ACCESS_COUNT 0x2289 | 
|  | 114 | #define SG_SCATTER_SZ (8 * 4096) | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 115 | #define SG_DEFAULT_RETRIES 0 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 116 | #define SG_DEF_FORCE_PACK_ID 0 | 
|  | 117 | #define SG_DEF_KEEP_ORPHAN 0 | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 118 | #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 119 | #define SG_MAX_QUEUE 16 | 
|  | 120 | #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE | 
|  | 121 | typedef struct sg_io_hdr Sg_io_hdr; | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 122 | typedef struct sg_io_vec Sg_io_vec; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 123 | typedef struct sg_scsi_id Sg_scsi_id; | 
|  | 124 | typedef struct sg_req_info Sg_req_info; | 
|  | 125 | #define SG_MAX_SENSE 16 | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 126 | struct sg_header { | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 127 | int pack_len; | 
|  | 128 | int reply_len; | 
|  | 129 | int pack_id; | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 130 | int result; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 131 | unsigned int twelve_byte : 1; | 
|  | 132 | unsigned int target_status : 5; | 
|  | 133 | unsigned int host_status : 8; | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 134 | unsigned int driver_status : 8; | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 135 | unsigned int other_flags : 10; | 
|  | 136 | unsigned char sense_buffer[SG_MAX_SENSE]; | 
|  | 137 | }; | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 138 | #define SG_SET_TIMEOUT 0x2201 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 139 | #define SG_GET_TIMEOUT 0x2202 | 
|  | 140 | #define SG_GET_COMMAND_Q 0x2270 | 
|  | 141 | #define SG_SET_COMMAND_Q 0x2271 | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 142 | #define SG_SET_DEBUG 0x227e | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 143 | #define SG_NEXT_CMD_LEN 0x2283 | 
|  | 144 | #define SG_DEFAULT_TIMEOUT (60 * HZ) | 
|  | 145 | #define SG_DEF_COMMAND_Q 0 | 
| Christopher Ferris | 5956b4e | 2016-07-20 12:28:56 -0700 | [diff] [blame] | 146 | #define SG_DEF_UNDERRUN_FLAG 0 | 
| Christopher Ferris | 6048173 | 2015-09-17 21:22:44 -0700 | [diff] [blame] | 147 | #endif |