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