1
2
3
4
5
6
7
8
9 #ifndef _EATA_DMA_H
10 #define _EATA_DMA_H
11
12 #include "../block/blk.h"
13 #include "scsi.h"
14 #include "hosts.h"
15 #include <linux/scsicam.h>
16
17 #define VER_MAJOR 2
18 #define VER_MINOR 1
19 #define VER_SUB "0h"
20
21
22
23
24
25
26
27 #define HARDCODED 0
28
29 #define ID0 0
30
31
32
33 #define HEADS0 13
34 #define SECTORS0 38
35 #define CYLINDER0 719
36
37 #define ID1 1
38 #define HEADS1 16
39 #define SECTORS1 62
40 #define CYLINDER1 1024
41
42
43
44
45
46 #define CHECKPAL 0
47
48
49
50
51
52 #define DEBUG_EATA 1
53 #define DPT_DEBUG 0
54 #define DBG_DELAY 0
55
56
57
58 #define DBG_PROBE 0
59 #define DBG_PCI 0
60 #define DBG_EISA 0
61 #define DBG_ISA 0
62 #define DBG_BLINK 0
63 #define DBG_PIO 0
64 #define DBG_COM 0
65 #define DBG_QUEUE 0
66 #define DBG_INTR 0
67 #define DBG_INTR2 0
68 #define DBG_REGISTER 0
69 #define DBG_ABNORM 1
70
71 #if DEBUG_EATA
72 #define DBG(x, y) if ((x)) {y;}
73 #else
74 #define DBG(x, y)
75 #endif
76
77
78 #define EATA_DMA { \
79 NULL, NULL, \
80 "EATA (Extended Attachment) driver", \
81 eata_detect, \
82 NULL, \
83 eata_info, \
84 eata_command, \
85 eata_queue, \
86 eata_abort, \
87 eata_reset, \
88 NULL, \
89 scsicam_bios_param, \
90 0, \
91 0, \
92 0, \
93 0, \
94 0, \
95 1, \
96 ENABLE_CLUSTERING }
97
98 int eata_detect(Scsi_Host_Template *);
99 const char *eata_info(struct Scsi_Host *);
100 int eata_command(Scsi_Cmnd *);
101 int eata_queue(Scsi_Cmnd *, void *(done)(Scsi_Cmnd *));
102 int eata_abort(Scsi_Cmnd *);
103 int eata_reset(Scsi_Cmnd *);
104
105
106
107
108
109
110 #ifndef TRUE
111 # define TRUE 1
112 #endif
113 #ifndef FALSE
114 # define FALSE 0
115 #endif
116
117 #define R_LIMIT 0x20000
118
119 #define MAXISA 4
120 #define MAXEISA 16
121 #define MAXPCI 16
122 #define MAXIRQ 16
123 #define MAXTARGET 8
124
125 #define MAX_PCI_DEVICES 32
126 #define MAX_METHOD_2 16
127 #define MAX_PCI_BUS 16
128
129 #define SG_SIZE 64
130 #define C_P_L_DIV 8
131 #define C_P_L_CURRENT_MAX 2
132
133 #define FREE 0
134 #define USED 1
135 #define TIMEOUT 2
136 #define RESET 4
137 #define LOCKED 8
138
139 #define HD(cmd) ((hostdata *)&(cmd->host->hostdata))
140 #define CD(cmd) ((struct eata_ccb *)(cmd->host_scribble))
141 #define SD(host) ((hostdata *)&(host->hostdata))
142
143 #define DELAY(x) { int i; i = jiffies + x; while (jiffies < i); }
144 #define DEL2(x) { ulong i; for (i = 0; i < 0xffff*x; i++); }
145
146
147
148
149 #define PCI_REG_DPTconfig 0x40
150 #define PCI_REG_PumpModeAddress 0x44
151 #define PCI_REG_PumpModeData 0x48
152 #define PCI_REG_ConfigParam1 0x50
153 #define PCI_REG_ConfigParam2 0x54
154
155
156 #define EATA_CMD_PIO_READ_CONFIG 0xf0
157 #define EATA_CMD_PIO_SET_CONFIG 0xf1
158 #define EATA_CMD_PIO_SEND_CP 0xf2
159 #define EATA_CMD_PIO_RECEIVE_SP 0xf3
160 #define EATA_CMD_PIO_TRUNC 0xf4
161
162 #define EATA_CMD_RESET 0xf9
163
164 #define EATA_CMD_DMA_READ_CONFIG 0xfd
165 #define EATA_CMD_DMA_SET_CONFIG 0xfe
166 #define EATA_CMD_DMA_SEND_CP 0xff
167
168 #define ECS_EMULATE_SENSE 0xd4
169
170 #define HA_WCOMMAND 0x07
171 #define HA_WDMAADDR 0x02
172 #define HA_RAUXSTAT 0x08
173 #define HA_RSTATUS 0x07
174 #define HA_RDATA 0x00
175
176 #define HA_ABUSY 0x01
177 #define HA_AIRQ 0x02
178 #define HA_SERROR 0x01
179 #define HA_SMORE 0x02
180 #define HA_SCORR 0x04
181 #define HA_SDRQ 0x08
182 #define HA_SSC 0x10
183 #define HA_SFAULT 0x20
184 #define HA_SREADY 0x40
185 #define HA_SBUSY 0x80
186 #define HA_SDRDY HA_SSC+HA_SREADY+HA_SDRQ
187
188
189
190
191
192 struct reg_bit {
193 unchar error:1;
194 unchar more:1;
195 unchar corr:1;
196 unchar drq:1;
197 unchar sc:1;
198 unchar fault:1;
199 unchar ready:1;
200 unchar busy:1;
201 };
202
203 struct reg_abit {
204 unchar abusy:1;
205 unchar irq:1;
206 unchar dummy:6;
207 };
208
209 struct eata_register {
210 unchar data_reg[2];
211 unchar cp_addr[4];
212 union {
213 unchar command;
214 struct reg_bit status;
215 unchar statusunchar;
216 } ovr;
217 struct reg_abit aux_stat;
218 };
219
220
221
222
223
224 struct eata_sg_list
225 {
226 ulong data;
227 ulong len;
228 };
229
230 struct get_conf {
231 ulong len;
232 unchar sig[4];
233 unchar version2:4,
234 version:4;
235 unchar OCS_enabled:1,
236 TAR_support:1,
237 TRNXFR:1,
238
239 MORE_support:1,
240 DMA_support:1,
241
242 DMA_valid:1,
243 ATA:1,
244 HAA_valid:1;
245
246 ushort cppadlen;
247
248 unchar scsi_id[4];
249
250 ulong cplen;
251 ulong splen;
252
253 ushort queuesiz;
254 ushort dummy;
255 ushort SGsiz;
256 unchar IRQ:4,
257 IRQ_TR:1,
258 SECOND:1,
259 DMA_channel:2;
260 unchar sync;
261
262 unchar DSBLE:1,
263 FORCADR:1,
264 :6;
265 unchar MAX_ID:5,
266 MAX_CHAN:3;
267 unchar MAX_LUN;
268 unchar :5,
269 ID_qest:1,
270 is_PCI:1,
271 is_EISA:1;
272 unchar unused[478];
273 };
274
275 struct eata_ccb {
276
277 unchar SCSI_Reset:1,
278 HBA_Init:1,
279 Auto_Req_Sen:1,
280 scatter:1,
281 Resrvd:1,
282 Interpret:1,
283 DataOut:1,
284 DataIn:1;
285 unchar reqlen;
286
287 unchar unused[3];
288 unchar FWNEST:1,
289 unused2:7;
290 unchar Phsunit:1,
291 I_AT:1,
292 I_HBA_C:1,
293 unused3:5;
294
295 unchar cp_id;
296 unchar cp_lun:3,
297 :2,
298 cp_luntar:1,
299 cp_dispri:1,
300 cp_identify:1;
301 unchar cp_msg1;
302 unchar cp_msg2;
303 unchar cp_msg3;
304 unchar cp_cdb[12];
305 ulong cp_datalen;
306
307 void *cp_viraddr;
308 ulong cp_dataDMA;
309
310 ulong cp_statDMA;
311 ulong cp_reqDMA;
312
313
314 ulong timeout;
315 unchar retries;
316 unchar status;
317 struct eata_sg_list sg_list[SG_SIZE];
318 Scsi_Cmnd *cmd;
319 };
320
321
322 struct eata_sp
323 {
324 unchar hba_stat:7,
325 EOC:1;
326 unchar scsi_stat;
327 unchar reserved[2];
328 ulong residue_len;
329 struct eata_ccb *ccb;
330 unchar msg[12];
331 };
332
333 typedef struct hstd{
334 char vendor[9];
335 char name[18];
336 char revision[6];
337 char EATA_revision;
338 unchar bustype;
339 unchar channel;
340 unchar state;
341 unchar t_state[MAXTARGET];
342 uint t_timeout[MAXTARGET];
343 unchar primary;
344 uint last_ccb;
345 struct Scsi_Host *next;
346 struct Scsi_Host *prev;
347 struct eata_sp sp;
348 struct eata_ccb ccb[0];
349 }hostdata;
350
351
352
353
354 struct drive_geom_emul {
355 unchar trans;
356 unchar channel;
357 unchar HBA;
358 unchar id;
359 unchar lun;
360 uint heads;
361 uint sectors;
362 uint cylinder;
363 };
364
365 struct geom_emul {
366 int bios_drives;
367 struct drive_geom_emul drv[2];
368 };
369
370 struct lun_map {
371 unchar id:5,
372 chan:3;
373 unchar lun;
374 };
375
376 typedef struct emul_pp {
377 unchar p_code:6,
378 null:1,
379 p_save:1;
380 unchar p_length;
381 ushort cylinder;
382 unchar heads;
383 unchar sectors;
384 unchar null2;
385 unchar s_lunmap:4,
386 ems:1;
387 ushort drive_type;
388 struct lun_map lunmap[4];
389 }emulpp;
390
391
392
393 #endif