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