1
2
3
4
5
6
7
8
9
10
11
12 #ifndef _EATA_GENERIC_H
13 #define _EATA_GENERIC_H
14
15
16
17
18
19
20
21 #ifndef TRUE
22 #define TRUE 1
23 #endif
24 #ifndef FALSE
25 #define FALSE 0
26 #endif
27
28 #define min(a,b) ((a<b)?(a):(b))
29
30 #define R_LIMIT 0x20000
31
32 #define MAXISA 4
33 #define MAXEISA 16
34 #define MAXPCI 16
35 #define MAXIRQ 16
36 #define MAXTARGET 16
37 #define MAXCHANNEL 3
38
39 #define IS_ISA 'I'
40 #define IS_EISA 'E'
41 #define IS_PCI 'P'
42
43 #define BROKEN_INQUIRY 1
44
45 #define BUSMASTER 0xff
46 #define PIO 0xfe
47
48 #define EATA_SIGNATURE 0x45415441
49
50 #define DPT_ID1 0x12
51 #define DPT_ID2 0x14
52
53 #define ATT_ID1 0x06
54 #define ATT_ID2 0x94
55 #define ATT_ID3 0x0
56
57 #define NEC_ID1 0x38
58 #define NEC_ID2 0xa3
59 #define NEC_ID3 0x82
60
61
62 #define EATA_CP_SIZE 44
63
64 #define MAX_PCI_DEVICES 32
65 #define MAX_METHOD_2 16
66 #define MAX_PCI_BUS 16
67
68 #define SG_SIZE 64
69 #define SG_SIZE_BIG 252
70
71 #define TYPE_DISK_QUEUE 16
72 #define TYPE_TAPE_QUEUE 4
73 #define TYPE_ROM_QUEUE 4
74 #define TYPE_OTHER_QUEUE 2
75
76 #define FREE 0
77 #define OK 0
78 #define NO_TIMEOUT 0
79 #define USED 1
80 #define TIMEOUT 2
81 #define RESET 4
82 #define LOCKED 8
83 #define ABORTED 16
84
85 #define READ 0
86 #define WRITE 1
87 #define OTHER 2
88
89 #define HD(cmd) ((hostdata *)&(cmd->host->hostdata))
90 #define CD(cmd) ((struct eata_ccb *)(cmd->host_scribble))
91 #define SD(host) ((hostdata *)&(host->hostdata))
92
93 #define DELAY(x) { __u32 i; ulong flags; \
94 save_flags(flags); sti(); \
95 i = jiffies + (x * HZ); \
96 while (jiffies < i) barrier(); \
97 restore_flags(flags); }
98
99
100
101
102 #define PCI_REG_DPTconfig 0x40
103 #define PCI_REG_PumpModeAddress 0x44
104 #define PCI_REG_PumpModeData 0x48
105 #define PCI_REG_ConfigParam1 0x50
106 #define PCI_REG_ConfigParam2 0x54
107
108
109 #define EATA_CMD_PIO_SETUPTEST 0xc6
110 #define EATA_CMD_PIO_READ_CONFIG 0xf0
111 #define EATA_CMD_PIO_SET_CONFIG 0xf1
112 #define EATA_CMD_PIO_SEND_CP 0xf2
113 #define EATA_CMD_PIO_RECEIVE_SP 0xf3
114 #define EATA_CMD_PIO_TRUNC 0xf4
115
116 #define EATA_CMD_RESET 0xf9
117 #define EATA_CMD_IMMEDIATE 0xfa
118
119 #define EATA_CMD_DMA_READ_CONFIG 0xfd
120 #define EATA_CMD_DMA_SET_CONFIG 0xfe
121 #define EATA_CMD_DMA_SEND_CP 0xff
122
123 #define ECS_EMULATE_SENSE 0xd4
124
125 #define EATA_GENERIC_ABORT 0x00
126 #define EATA_SPECIFIC_RESET 0x01
127 #define EATA_BUS_RESET 0x02
128 #define EATA_SPECIFIC_ABORT 0x03
129 #define EATA_QUIET_INTR 0x04
130 #define EATA_COLD_BOOT_HBA 0x06
131 #define EATA_FORCE_IO 0x07
132
133
134 #define HA_WCOMMAND 0x07
135 #define HA_WIFC 0x06
136 #define HA_WCODE 0x05
137 #define HA_WCODE2 0x04
138 #define HA_WDMAADDR 0x02
139 #define HA_RAUXSTAT 0x08
140 #define HA_RSTATUS 0x07
141 #define HA_RDATA 0x00
142 #define HA_WDATA 0x00
143
144 #define HA_ABUSY 0x01
145 #define HA_AIRQ 0x02
146 #define HA_SERROR 0x01
147 #define HA_SMORE 0x02
148 #define HA_SCORR 0x04
149 #define HA_SDRQ 0x08
150 #define HA_SSC 0x10
151 #define HA_SFAULT 0x20
152 #define HA_SREADY 0x40
153 #define HA_SBUSY 0x80
154 #define HA_SDRDY HA_SSC+HA_SREADY+HA_SDRQ
155
156
157
158
159
160 #define HA_NO_ERROR 0x00
161 #define HA_ERR_SEL_TO 0x01
162 #define HA_ERR_CMD_TO 0x02
163 #define HA_BUS_RESET 0x03
164 #define HA_INIT_POWERUP 0x04
165 #define HA_UNX_BUSPHASE 0x05
166 #define HA_UNX_BUS_FREE 0x06
167 #define HA_BUS_PARITY 0x07
168 #define HA_SCSI_HUNG 0x08
169 #define HA_UNX_MSGRJCT 0x09
170 #define HA_RESET_STUCK 0x0a
171 #define HA_RSENSE_FAIL 0x0b
172 #define HA_PARITY_ERR 0x0c
173 #define HA_CP_ABORT_NA 0x0d
174 #define HA_CP_ABORTED 0x0e
175 #define HA_CP_RESET_NA 0x0f
176 #define HA_CP_RESET 0x10
177 #define HA_ECC_ERR 0x11
178 #define HA_PCI_PARITY 0x12
179 #define HA_PCI_MABORT 0x13
180 #define HA_PCI_TABORT 0x14
181 #define HA_PCI_STABORT 0x15
182
183
184
185
186
187 struct reg_bit {
188 __u8 error:1;
189 __u8 more:1;
190 __u8 corr:1;
191 __u8 drq:1;
192 __u8 sc:1;
193 __u8 fault:1;
194 __u8 ready:1;
195 __u8 busy:1;
196 };
197
198 struct reg_abit {
199 __u8 abusy:1;
200 __u8 irq:1;
201 __u8 dummy:6;
202 };
203
204 struct eata_register {
205 __u8 data_reg[2];
206 __u8 cp_addr[4];
207 union {
208 __u8 command;
209 struct reg_bit status;
210 __u8 statusbyte;
211 } ovr;
212 struct reg_abit aux_stat;
213 };
214
215 struct get_conf {
216 __u32 len;
217 __u32 signature;
218 __u8 version2:4,
219 version:4;
220 __u8 OCS_enabled:1,
221 TAR_support:1,
222 TRNXFR:1,
223
224 MORE_support:1,
225 DMA_support:1,
226
227 DMA_valid:1,
228 ATA:1,
229 HAA_valid:1;
230
231 __u16 cppadlen;
232
233 __u8 scsi_id[4];
234
235 __u32 cplen;
236 __u32 splen;
237
238 __u16 queuesiz;
239 __u16 dummy;
240 __u16 SGsiz;
241 __u8 IRQ:4,
242 IRQ_TR:1,
243 SECOND:1,
244 DMA_channel:2;
245 __u8 sync;
246
247 __u8 DSBLE:1,
248 FORCADR:1,
249 SG_64K:1,
250 SG_UAE:1,
251 :4;
252 __u8 MAX_ID:5,
253 MAX_CHAN:3;
254 __u8 MAX_LUN;
255 __u8 :3,
256 AUTOTRM:1,
257 M1_inst:1,
258 ID_qest:1,
259 is_PCI:1,
260 is_EISA:1;
261 __u8 RAIDNUM;
262 __u8 unused[474];
263 };
264
265 struct eata_sg_list
266 {
267 __u32 data;
268 __u32 len;
269 };
270
271 struct eata_ccb {
272
273 __u8 SCSI_Reset:1,
274 HBA_Init:1,
275 Auto_Req_Sen:1,
276 scatter:1,
277 Resrvd:1,
278 Interpret:1,
279 DataOut:1,
280 DataIn:1;
281 __u8 reqlen;
282
283 __u8 unused[3];
284 __u8 FWNEST:1,
285 unused2:7;
286 __u8 Phsunit:1,
287 I_AT:1,
288 I_HBA_C:1,
289 unused3:5;
290
291 __u8 cp_id:5,
292 cp_channel:3;
293 __u8 cp_lun:3,
294 :2,
295 cp_luntar:1,
296 cp_dispri:1,
297 cp_identify:1;
298 __u8 cp_msg1;
299 __u8 cp_msg2;
300 __u8 cp_msg3;
301 __u8 cp_cdb[12];
302 __u32 cp_datalen;
303
304 void *cp_viraddr;
305 __u32 cp_dataDMA;
306
307 __u32 cp_statDMA;
308 __u32 cp_reqDMA;
309
310
311 __u32 timestamp;
312 __u32 timeout;
313 __u8 sizeindex;
314 __u8 rw_latency;
315 __u8 retries;
316 __u8 status;
317 Scsi_Cmnd *cmd;
318 struct eata_sg_list *sg_list;
319 };
320
321
322 struct eata_sp {
323 __u8 hba_stat:7,
324 EOC:1;
325 __u8 scsi_stat;
326 __u8 reserved[2];
327 __u32 residue_len;
328 struct eata_ccb *ccb;
329 __u8 msg[12];
330 };
331
332 typedef struct hstd {
333 __u8 vendor[9];
334 __u8 name[18];
335 __u8 revision[6];
336 __u8 EATA_revision;
337 __u32 firmware_revision;
338 __u8 HBA_number;
339 __u8 bustype;
340 __u8 channel;
341 __u8 state;
342 __u8 primary;
343 __u8 more_support:1,
344 immediate_support:1,
345 broken_INQUIRY:1;
346
347 __u8 do_latency;
348 __u32 reads[13];
349 __u32 writes[13];
350 __u32 reads_lat[12][4];
351 __u32 writes_lat[12][4];
352 __u32 all_lat[4];
353
354 __u8 t_state[MAXCHANNEL][MAXTARGET];
355
356 __u32 t_timeout[MAXCHANNEL][MAXTARGET];
357 __u8 resetlevel[MAXCHANNEL];
358 __u32 last_ccb;
359 __u32 cplen;
360 __u16 cppadlen;
361 __u16 queuesize;
362 __u16 sgsize;
363 __u16 devflags;
364 __u8 hostid;
365 __u8 moresupport;
366 struct Scsi_Host *next;
367 struct Scsi_Host *prev;
368 struct eata_sp sp;
369 struct eata_ccb ccb[0];
370 }hostdata;
371
372
373 struct drive_geom_emul {
374 __u8 trans;
375 __u8 channel;
376 __u8 HBA;
377 __u8 id;
378 __u8 lun;
379 __u32 heads;
380 __u32 sectors;
381 __u32 cylinder;
382 };
383
384 struct geom_emul {
385 __u8 bios_drives;
386 struct drive_geom_emul drv[2];
387 };
388
389 #endif
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407