1
2 #ifndef _GDTH_IOCTL_H
3 #define _GDTH_IOCTL_H
4
5
6
7
8
9
10 #define GDTIOCTL_MASK ('J'<<8)
11 #define GDTIOCTL_GENERAL (GDTIOCTL_MASK | 0)
12 #define GDTIOCTL_DRVERS (GDTIOCTL_MASK | 1)
13 #define GDTIOCTL_CTRTYPE (GDTIOCTL_MASK | 2)
14 #define GDTIOCTL_OSVERS (GDTIOCTL_MASK | 3)
15 #define GDTIOCTL_HDRLIST (GDTIOCTL_MASK | 4)
16 #define GDTIOCTL_CTRCNT (GDTIOCTL_MASK | 5)
17 #define GDTIOCTL_LOCKDRV (GDTIOCTL_MASK | 6)
18 #define GDTIOCTL_LOCKCHN (GDTIOCTL_MASK | 7)
19 #define GDTIOCTL_EVENT (GDTIOCTL_MASK | 8)
20 #define GDTIOCTL_SCSI (GDTIOCTL_MASK | 9)
21 #define GDTIOCTL_RESET_BUS (GDTIOCTL_MASK |10)
22 #define GDTIOCTL_RESCAN (GDTIOCTL_MASK |11)
23 #define GDTIOCTL_RESET_DRV (GDTIOCTL_MASK |12)
24
25 #define GDTIOCTL_MAGIC 0xaffe0004
26 #define EVENT_SIZE 294
27 #define GDTH_MAXSG 32
28
29 #define MAX_LDRIVES 255
30 #define MAX_HDRIVES MAX_LDRIVES
31
32
33 typedef struct {
34 u32 sg_ptr;
35 u32 sg_len;
36 } __attribute__((packed)) gdth_sg_str;
37
38
39 typedef struct {
40 u64 sg_ptr;
41 u32 sg_len;
42 } __attribute__((packed)) gdth_sg64_str;
43
44
45 typedef struct {
46 u32 BoardNode;
47 u32 CommandIndex;
48 u16 OpCode;
49 union {
50 struct {
51 u16 DeviceNo;
52 u32 BlockNo;
53 u32 BlockCnt;
54 u32 DestAddr;
55 u32 sg_canz;
56 gdth_sg_str sg_lst[GDTH_MAXSG];
57 } __attribute__((packed)) cache;
58 struct {
59 u16 DeviceNo;
60 u64 BlockNo;
61 u32 BlockCnt;
62 u64 DestAddr;
63 u32 sg_canz;
64 gdth_sg64_str sg_lst[GDTH_MAXSG];
65 } __attribute__((packed)) cache64;
66 struct {
67 u16 param_size;
68 u32 subfunc;
69 u32 channel;
70 u64 p_param;
71 } __attribute__((packed)) ioctl;
72 struct {
73 u16 reserved;
74 union {
75 struct {
76 u32 msg_handle;
77 u64 msg_addr;
78 } __attribute__((packed)) msg;
79 u8 data[12];
80 } su;
81 } __attribute__((packed)) screen;
82 struct {
83 u16 reserved;
84 u32 direction;
85 u32 mdisc_time;
86 u32 mcon_time;
87 u32 sdata;
88 u32 sdlen;
89 u32 clen;
90 u8 cmd[12];
91 u8 target;
92 u8 lun;
93 u8 bus;
94 u8 priority;
95 u32 sense_len;
96 u32 sense_data;
97 u32 link_p;
98 u32 sg_ranz;
99 gdth_sg_str sg_lst[GDTH_MAXSG];
100 } __attribute__((packed)) raw;
101 struct {
102 u16 reserved;
103 u32 direction;
104 u32 mdisc_time;
105 u32 mcon_time;
106 u64 sdata;
107 u32 sdlen;
108 u32 clen;
109 u8 cmd[16];
110 u8 target;
111 u8 lun;
112 u8 bus;
113 u8 priority;
114 u32 sense_len;
115 u64 sense_data;
116 u32 sg_ranz;
117 gdth_sg64_str sg_lst[GDTH_MAXSG];
118 } __attribute__((packed)) raw64;
119 } u;
120
121 u8 Service;
122 u8 reserved;
123 u16 Status;
124 u32 Info;
125 void *RequestBuffer;
126 } __attribute__((packed)) gdth_cmd_str;
127
128
129 #define ES_ASYNC 1
130 #define ES_DRIVER 2
131 #define ES_TEST 3
132 #define ES_SYNC 4
133 typedef struct {
134 u16 size;
135 union {
136 char stream[16];
137 struct {
138 u16 ionode;
139 u16 service;
140 u32 index;
141 } __attribute__((packed)) driver;
142 struct {
143 u16 ionode;
144 u16 service;
145 u16 status;
146 u32 info;
147 u8 scsi_coord[3];
148 } __attribute__((packed)) async;
149 struct {
150 u16 ionode;
151 u16 service;
152 u16 status;
153 u32 info;
154 u16 hostdrive;
155 u8 scsi_coord[3];
156 u8 sense_key;
157 } __attribute__((packed)) sync;
158 struct {
159 u32 l1, l2, l3, l4;
160 } __attribute__((packed)) test;
161 } eu;
162 u32 severity;
163 u8 event_string[256];
164 } __attribute__((packed)) gdth_evt_data;
165
166 typedef struct {
167 u32 first_stamp;
168 u32 last_stamp;
169 u16 same_count;
170 u16 event_source;
171 u16 event_idx;
172 u8 application;
173 u8 reserved;
174 gdth_evt_data event_data;
175 } __attribute__((packed)) gdth_evt_str;
176
177
178 typedef struct {
179 u16 ionode;
180 u16 timeout;
181 u32 info;
182 u16 status;
183 unsigned long data_len;
184 unsigned long sense_len;
185 gdth_cmd_str command;
186 } gdth_ioctl_general;
187
188
189 typedef struct {
190 u16 ionode;
191 u8 lock;
192 u8 drive_cnt;
193 u16 drives[MAX_HDRIVES];
194 } gdth_ioctl_lockdrv;
195
196
197 typedef struct {
198 u16 ionode;
199 u8 lock;
200 u8 channel;
201 } gdth_ioctl_lockchn;
202
203
204 typedef struct {
205 u8 version;
206 u8 subversion;
207 u16 revision;
208 } gdth_ioctl_osvers;
209
210
211 typedef struct {
212 u16 ionode;
213 u8 type;
214 u16 info;
215 u16 oem_id;
216 u16 bios_ver;
217 u16 access;
218 u16 ext_type;
219 u16 device_id;
220 u16 sub_device_id;
221 } gdth_ioctl_ctrtype;
222
223
224 typedef struct {
225 u16 ionode;
226 int erase;
227 int handle;
228 gdth_evt_str event;
229 } gdth_ioctl_event;
230
231
232 typedef struct {
233 u16 ionode;
234 u8 flag;
235 u16 hdr_no;
236 struct {
237 u8 bus;
238 u8 target;
239 u8 lun;
240 u8 cluster_type;
241 } hdr_list[MAX_HDRIVES];
242 } gdth_ioctl_rescan;
243
244
245 typedef struct {
246 u16 ionode;
247 u16 number;
248 u16 status;
249 } gdth_ioctl_reset;
250
251 #endif