sg.h revision 525ce914edf136d2bd02ac8c404d56c52e737f4d
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>
22typedef struct sg_iovec {
23  void __user * iov_base;
24  size_t iov_len;
25} sg_iovec_t;
26typedef struct sg_io_hdr {
27  int interface_id;
28  int dxfer_direction;
29  unsigned char cmd_len;
30  unsigned char mx_sb_len;
31  unsigned short iovec_count;
32  unsigned int dxfer_len;
33  void __user * dxferp;
34  unsigned char __user * cmdp;
35  void __user * sbp;
36  unsigned int timeout;
37  unsigned int flags;
38  int pack_id;
39  void __user * usr_ptr;
40  unsigned char status;
41  unsigned char masked_status;
42  unsigned char msg_status;
43  unsigned char sb_len_wr;
44  unsigned short host_status;
45  unsigned short driver_status;
46  int resid;
47  unsigned int duration;
48  unsigned int info;
49} sg_io_hdr_t;
50#define SG_INTERFACE_ID_ORIG 'S'
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)
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
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
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
67#define SG_INFO_DIRECT_IO 0x2
68#define SG_INFO_MIXED_IO 0x4
69typedef struct sg_scsi_id {
70  int host_no;
71  int channel;
72  int scsi_id;
73  int lun;
74  int scsi_type;
75  short h_cmd_per_lun;
76  short d_queue_depth;
77  int unused[2];
78} sg_scsi_id_t;
79typedef struct sg_req_info {
80  char req_state;
81  char orphan;
82  char sg_io_owned;
83  char problem;
84  int pack_id;
85  void __user * usr_ptr;
86  unsigned int duration;
87  int unused;
88} sg_req_info_t;
89#define SG_EMULATED_HOST 0x2203
90#define SG_SET_TRANSFORM 0x2204
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
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
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
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
107#define SG_SCSI_RESET_TARGET 4
108#define SG_SCSI_RESET_NO_ESCALATE 0x100
109#define SG_IO 0x2285
110#define SG_GET_REQUEST_TABLE 0x2286
111#define SG_SET_KEEP_ORPHAN 0x2287
112#define SG_GET_KEEP_ORPHAN 0x2288
113#define SG_GET_ACCESS_COUNT 0x2289
114#define SG_SCATTER_SZ (8 * 4096)
115#define SG_DEFAULT_RETRIES 0
116#define SG_DEF_FORCE_PACK_ID 0
117#define SG_DEF_KEEP_ORPHAN 0
118#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
119#define SG_MAX_QUEUE 16
120#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
121typedef struct sg_io_hdr Sg_io_hdr;
122typedef struct sg_io_vec Sg_io_vec;
123typedef struct sg_scsi_id Sg_scsi_id;
124typedef struct sg_req_info Sg_req_info;
125#define SG_MAX_SENSE 16
126struct sg_header {
127  int pack_len;
128  int reply_len;
129  int pack_id;
130  int result;
131  unsigned int twelve_byte : 1;
132  unsigned int target_status : 5;
133  unsigned int host_status : 8;
134  unsigned int driver_status : 8;
135  unsigned int other_flags : 10;
136  unsigned char sense_buffer[SG_MAX_SENSE];
137};
138#define SG_SET_TIMEOUT 0x2201
139#define SG_GET_TIMEOUT 0x2202
140#define SG_GET_COMMAND_Q 0x2270
141#define SG_SET_COMMAND_Q 0x2271
142#define SG_SET_DEBUG 0x227e
143#define SG_NEXT_CMD_LEN 0x2283
144#define SG_DEFAULT_TIMEOUT (60 * HZ)
145#define SG_DEF_COMMAND_Q 0
146#define SG_DEF_UNDERRUN_FLAG 0
147#endif
148