blob: 29ea51e53007d6d54b08288132de35717057e7cc [file] [log] [blame]
Christopher Ferris60481732015-09-17 21:22:44 -07001/****************************************************************************
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 {
Christopher Ferris60481732015-09-17 21:22:44 -070023 void __user * iov_base;
24 size_t iov_len;
25} sg_iovec_t;
26typedef struct sg_io_hdr {
Christopher Ferris60481732015-09-17 21:22:44 -070027 int interface_id;
28 int dxfer_direction;
29 unsigned char cmd_len;
30 unsigned char mx_sb_len;
Christopher Ferris60481732015-09-17 21:22:44 -070031 unsigned short iovec_count;
32 unsigned int dxfer_len;
33 void __user * dxferp;
34 unsigned char __user * cmdp;
Christopher Ferris60481732015-09-17 21:22:44 -070035 void __user * sbp;
36 unsigned int timeout;
37 unsigned int flags;
38 int pack_id;
Christopher Ferris60481732015-09-17 21:22:44 -070039 void __user * usr_ptr;
40 unsigned char status;
41 unsigned char masked_status;
42 unsigned char msg_status;
Christopher Ferris60481732015-09-17 21:22:44 -070043 unsigned char sb_len_wr;
44 unsigned short host_status;
45 unsigned short driver_status;
46 int resid;
Christopher Ferris60481732015-09-17 21:22:44 -070047 unsigned int duration;
48 unsigned int info;
49} sg_io_hdr_t;
50#define SG_INTERFACE_ID_ORIG 'S'
Christopher Ferris60481732015-09-17 21:22:44 -070051#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 Ferris60481732015-09-17 21:22:44 -070055#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 Ferris60481732015-09-17 21:22:44 -070059#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 Ferris60481732015-09-17 21:22:44 -070063#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 Ferris60481732015-09-17 21:22:44 -070067#define SG_INFO_DIRECT_IO 0x2
68#define SG_INFO_MIXED_IO 0x4
69typedef struct sg_scsi_id {
70 int host_no;
Christopher Ferris60481732015-09-17 21:22:44 -070071 int channel;
72 int scsi_id;
73 int lun;
74 int scsi_type;
Christopher Ferris60481732015-09-17 21:22:44 -070075 short h_cmd_per_lun;
76 short d_queue_depth;
77 int unused[2];
78} sg_scsi_id_t;
Christopher Ferris60481732015-09-17 21:22:44 -070079typedef struct sg_req_info {
80 char req_state;
81 char orphan;
82 char sg_io_owned;
Christopher Ferris60481732015-09-17 21:22:44 -070083 char problem;
84 int pack_id;
85 void __user * usr_ptr;
86 unsigned int duration;
Christopher Ferris60481732015-09-17 21:22:44 -070087 int unused;
88} sg_req_info_t;
89#define SG_EMULATED_HOST 0x2203
90#define SG_SET_TRANSFORM 0x2204
Christopher Ferris60481732015-09-17 21:22:44 -070091#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 Ferris60481732015-09-17 21:22:44 -070095#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 Ferris60481732015-09-17 21:22:44 -070099#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 Ferris60481732015-09-17 21:22:44 -0700103#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 Ferris60481732015-09-17 21:22:44 -0700107#define SG_SCSI_RESET_TARGET 4
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700108#define SG_SCSI_RESET_NO_ESCALATE 0x100
Christopher Ferris60481732015-09-17 21:22:44 -0700109#define SG_IO 0x2285
110#define SG_GET_REQUEST_TABLE 0x2286
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700111#define SG_SET_KEEP_ORPHAN 0x2287
Christopher Ferris60481732015-09-17 21:22:44 -0700112#define SG_GET_KEEP_ORPHAN 0x2288
113#define SG_GET_ACCESS_COUNT 0x2289
114#define SG_SCATTER_SZ (8 * 4096)
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700115#define SG_DEFAULT_RETRIES 0
Christopher Ferris60481732015-09-17 21:22:44 -0700116#define SG_DEF_FORCE_LOW_DMA 0
117#define SG_DEF_FORCE_PACK_ID 0
118#define SG_DEF_KEEP_ORPHAN 0
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700119#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
Christopher Ferris60481732015-09-17 21:22:44 -0700120#define SG_MAX_QUEUE 16
121#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
122typedef struct sg_io_hdr Sg_io_hdr;
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700123typedef struct sg_io_vec Sg_io_vec;
Christopher Ferris60481732015-09-17 21:22:44 -0700124typedef struct sg_scsi_id Sg_scsi_id;
125typedef struct sg_req_info Sg_req_info;
126#define SG_MAX_SENSE 16
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700127struct sg_header {
Christopher Ferris60481732015-09-17 21:22:44 -0700128 int pack_len;
129 int reply_len;
130 int pack_id;
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700131 int result;
Christopher Ferris60481732015-09-17 21:22:44 -0700132 unsigned int twelve_byte : 1;
133 unsigned int target_status : 5;
134 unsigned int host_status : 8;
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700135 unsigned int driver_status : 8;
Christopher Ferris60481732015-09-17 21:22:44 -0700136 unsigned int other_flags : 10;
137 unsigned char sense_buffer[SG_MAX_SENSE];
138};
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700139#define SG_SET_TIMEOUT 0x2201
Christopher Ferris60481732015-09-17 21:22:44 -0700140#define SG_GET_TIMEOUT 0x2202
141#define SG_GET_COMMAND_Q 0x2270
142#define SG_SET_COMMAND_Q 0x2271
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700143#define SG_SET_DEBUG 0x227e
Christopher Ferris60481732015-09-17 21:22:44 -0700144#define SG_NEXT_CMD_LEN 0x2283
145#define SG_DEFAULT_TIMEOUT (60 * HZ)
146#define SG_DEF_COMMAND_Q 0
Christopher Ferris5956b4e2016-07-20 12:28:56 -0700147#define SG_DEF_UNDERRUN_FLAG 0
Christopher Ferris60481732015-09-17 21:22:44 -0700148#endif