add mips64 port
[musl.git] / include / scsi / sg.h
bloba7ac247e3ffade1a20770e2bc90119c7756eaf83
1 #ifndef _SCSI_SG_H
2 #define _SCSI_SG_H
4 #define SG_DXFER_NONE -1
5 #define SG_DXFER_TO_DEV -2
6 #define SG_DXFER_FROM_DEV -3
7 #define SG_DXFER_TO_FROM_DEV -4
8 #define SG_FLAG_DIRECT_IO 1
9 #define SG_FLAG_LUN_INHIBIT 2
10 #define SG_FLAG_NO_DXFER 0x10000
11 #define SG_INFO_OK_MASK 0x1
12 #define SG_INFO_OK 0x0
13 #define SG_INFO_CHECK 0x1
14 #define SG_INFO_DIRECT_IO_MASK 0x6
15 #define SG_INFO_INDIRECT_IO 0x0
16 #define SG_INFO_DIRECT_IO 0x2
17 #define SG_INFO_MIXED_IO 0x4
18 #define SG_EMULATED_HOST 0x2203
19 #define SG_SET_TRANSFORM 0x2204
20 #define SG_GET_TRANSFORM 0x2205
21 #define SG_SET_RESERVED_SIZE 0x2275
22 #define SG_GET_RESERVED_SIZE 0x2272
23 #define SG_GET_SCSI_ID 0x2276
24 #define SG_SET_FORCE_LOW_DMA 0x2279
25 #define SG_GET_LOW_DMA 0x227a
26 #define SG_SET_FORCE_PACK_ID 0x227b
27 #define SG_GET_PACK_ID 0x227c
28 #define SG_GET_NUM_WAITING 0x227d
29 #define SG_GET_SG_TABLESIZE 0x227F
30 #define SG_GET_VERSION_NUM 0x2282
31 #define SG_SCSI_RESET 0x2284
32 #define SG_SCSI_RESET_NOTHING 0
33 #define SG_SCSI_RESET_DEVICE 1
34 #define SG_SCSI_RESET_BUS 2
35 #define SG_SCSI_RESET_HOST 3
36 #define SG_IO 0x2285
37 #define SG_GET_REQUEST_TABLE 0x2286
38 #define SG_SET_KEEP_ORPHAN 0x2287
39 #define SG_GET_KEEP_ORPHAN 0x2288
40 #define SG_SCATTER_SZ (8 * 4096)
41 #define SG_DEFAULT_RETRIES 1
42 #define SG_DEF_FORCE_LOW_DMA 0
43 #define SG_DEF_FORCE_PACK_ID 0
44 #define SG_DEF_KEEP_ORPHAN 0
45 #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
46 #define SG_MAX_QUEUE 16
47 #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
48 #define SG_MAX_SENSE 16
49 #define SG_SET_TIMEOUT 0x2201
50 #define SG_GET_TIMEOUT 0x2202
51 #define SG_GET_COMMAND_Q 0x2270
52 #define SG_SET_COMMAND_Q 0x2271
53 #define SG_SET_DEBUG 0x227e
54 #define SG_NEXT_CMD_LEN 0x2283
55 #define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
56 #define SG_DEF_COMMAND_Q 0
57 #define SG_DEF_UNDERRUN_FLAG 0
59 typedef struct sg_iovec {
60 void *iov_base;
61 unsigned long iov_len;
62 } sg_iovec_t;
64 typedef struct sg_io_hdr {
65 int interface_id;
66 int dxfer_direction;
67 unsigned char cmd_len;
68 unsigned char mx_sb_len;
69 unsigned short iovec_count;
70 unsigned dxfer_len;
71 void *dxferp;
72 unsigned char *cmdp;
73 unsigned char *sbp;
74 unsigned timeout;
75 unsigned flags;
76 int pack_id;
77 void *usr_ptr;
78 unsigned char status;
79 unsigned char masked_status;
80 unsigned char msg_status;
81 unsigned char sb_len_wr;
82 unsigned short host_status;
83 unsigned short driver_status;
84 int resid;
85 unsigned int duration;
86 unsigned int info;
87 } sg_io_hdr_t;
89 struct sg_scsi_id {
90 int host_no;
91 int channel;
92 int scsi_id;
93 int lun;
94 int scsi_type;
95 short h_cmd_per_lun;
96 short d_queue_depth;
97 int unused[2];
100 typedef struct sg_req_info {
101 char req_state;
102 char orphan;
103 char sg_io_owned;
104 char problem;
105 int pack_id;
106 void *usr_ptr;
107 unsigned duration;
108 int unused;
109 } sg_req_info_t;
111 typedef struct sg_io_hdr Sg_io_hdr;
112 typedef struct sg_io_vec Sg_io_vec;
113 typedef struct sg_scsi_id Sg_scsi_id;
114 typedef struct sg_req_info Sg_req_info;
116 struct sg_header {
117 int pack_len;
118 int reply_len;
119 int pack_id;
120 int result;
121 unsigned twelve_byte:1;
122 unsigned target_status:5;
123 unsigned host_status:8;
124 unsigned driver_status:8;
125 unsigned other_flags:10;
126 unsigned char sense_buffer[SG_MAX_SENSE];
129 #endif