5 * $Id: aha152x.h,v 1.7 1997/01/19 23:07:11 davem Exp $
8 #if defined(__KERNEL__)
10 #include <linux/blk.h>
14 int aha152x_detect(Scsi_Host_Template
*);
15 int aha152x_command(Scsi_Cmnd
*);
16 int aha152x_queue(Scsi_Cmnd
*, void (*done
)(Scsi_Cmnd
*));
17 int aha152x_abort(Scsi_Cmnd
*);
18 int aha152x_release(struct Scsi_Host
*shpnt
);
19 int aha152x_reset(Scsi_Cmnd
*, unsigned int);
20 int aha152x_biosparam(Disk
*, kdev_t
, int*);
21 int aha152x_proc_info(char *buffer
, char **start
, off_t offset
, int length
, int hostno
, int inout
);
23 /* number of queueable commands
24 (unless we support more than 1 cmd_per_lun this should do) */
25 #define AHA152X_MAXQUEUE 7
27 #define AHA152X_REVID "Adaptec 152x SCSI driver; $Revision: 1.7 $"
29 extern struct proc_dir_entry proc_scsi_aha152x
;
31 /* Initial value of Scsi_Host entry */
32 #define AHA152X { proc_dir: &proc_scsi_aha152x, \
33 proc_info: aha152x_proc_info, \
34 name: AHA152X_REVID, \
35 detect: aha152x_detect, \
36 command: aha152x_command, \
37 queuecommand: aha152x_queue, \
38 abort: aha152x_abort, \
39 reset: aha152x_reset, \
40 release: aha152x_release, \
42 bios_param: aha152x_biosparam, \
45 sg_tablesize: SG_ALL, \
48 unchecked_isa_dma: 0, \
49 use_clustering: DISABLE_CLUSTERING }
54 #define SCSISEQ (shpnt->io_port+0x00) /* SCSI sequence control */
55 #define SXFRCTL0 (shpnt->io_port+0x01) /* SCSI transfer control 0 */
56 #define SXFRCTL1 (shpnt->io_port+0x02) /* SCSI transfer control 1 */
57 #define SCSISIG (shpnt->io_port+0x03) /* SCSI signal in/out */
58 #define SCSIRATE (shpnt->io_port+0x04) /* SCSI rate control */
59 #define SELID (shpnt->io_port+0x05) /* selection/reselection ID */
60 #define SCSIID SELID /* SCSI ID */
61 #define SCSIDAT (shpnt->io_port+0x06) /* SCSI latched data */
62 #define SCSIBUS (shpnt->io_port+0x07) /* SCSI data bus */
63 #define STCNT0 (shpnt->io_port+0x08) /* SCSI transfer count 0 */
64 #define STCNT1 (shpnt->io_port+0x09) /* SCSI transfer count 1 */
65 #define STCNT2 (shpnt->io_port+0x0a) /* SCSI transfer count 2 */
66 #define SSTAT0 (shpnt->io_port+0x0b) /* SCSI interrupt status 0 */
67 #define SSTAT1 (shpnt->io_port+0x0c) /* SCSI interrupt status 1 */
68 #define SSTAT2 (shpnt->io_port+0x0d) /* SCSI interrupt status 2 */
69 #define SCSITEST (shpnt->io_port+0x0e) /* SCSI test control */
70 #define SSTAT3 SCSITEST /* SCSI interrupt status 3 */
71 #define SSTAT4 (shpnt->io_port+0x0f) /* SCSI status 4 */
72 #define SIMODE0 (shpnt->io_port+0x10) /* SCSI interrupt mode 0 */
73 #define SIMODE1 (shpnt->io_port+0x11) /* SCSI interrupt mode 1 */
74 #define DMACNTRL0 (shpnt->io_port+0x12) /* DMA control 0 */
75 #define DMACNTRL1 (shpnt->io_port+0x13) /* DMA control 1 */
76 #define DMASTAT (shpnt->io_port+0x14) /* DMA status */
77 #define FIFOSTAT (shpnt->io_port+0x15) /* FIFO status */
78 #define DATAPORT (shpnt->io_port+0x16) /* DATA port */
79 #define BRSTCNTRL (shpnt->io_port+0x18) /* burst control */
80 #define PORTA (shpnt->io_port+0x1a) /* PORT A */
81 #define PORTB (shpnt->io_port+0x1b) /* PORT B */
82 #define REV (shpnt->io_port+0x1c) /* revision */
83 #define STACK (shpnt->io_port+0x1d) /* stack */
84 #define TEST (shpnt->io_port+0x1e) /* test register */
86 /* used in aha152x_porttest */
87 #define O_PORTA 0x1a /* PORT A */
88 #define O_PORTB 0x1b /* PORT B */
89 #define O_DMACNTRL1 0x13 /* DMA control 1 */
90 #define O_STACK 0x1d /* stack */
93 /* bits and bitmasks to ports */
95 /* SCSI sequence control */
100 #define ENAUTOATNO 0x08
101 #define ENAUTOATNI 0x04
102 #define ENAUTOATNP 0x02
103 #define SCSIRSTO 0x01
105 /* SCSI transfer control 0 */
109 #define CLRSTCNT 0x10
113 /* SCSI transfer control 1 */
114 #define BITBUCKET 0x80
117 #define STIMESEL 0x18 /* mask */
119 #define ENSTIMER 0x04
120 #define BYTEALIGN 0x02
133 #define P_MASK (MSGI|CDI|IOI)
135 #define P_DATAI (IOI)
137 #define P_STATUS (CDI|IOI)
138 #define P_MSGO (MSGI|CDI)
139 #define P_MSGI (MSGI|CDI|IOI)
141 /* SCSI signal OUT */
151 /* SCSI rate control */
152 #define SXFR 0x70 /* mask */
154 #define SOFS 0x0f /* mask */
161 /* SCSI transfer count */
162 #define GETSTCNT() ( (GETPORT(STCNT2)<<16) \
163 + (GETPORT(STCNT1)<< 8) \
166 #define SETSTCNT(X) { SETPORT(STCNT2, ((X) & 0xFF0000) >> 16); \
167 SETPORT(STCNT1, ((X) & 0x00FF00) >> 8); \
168 SETPORT(STCNT0, ((X) & 0x0000FF) ); }
170 /* SCSI interrupt status */
180 #define SETSDONE 0x80
181 #define CLRSELDO 0x40
182 #define CLRSELDI 0x20
183 #define CLRSELINGO 0x10
184 #define CLRSWRAP 0x08
185 #define CLRSDONE 0x04
186 #define CLRSPIORDY 0x02
187 #define CLRDMADONE 0x01
192 #define SCSIRSTI 0x20
193 #define PHASEMIS 0x10
195 #define SCSIPERR 0x04
196 #define PHASECHG 0x02
199 #define CLRSELTIMO 0x80
201 #define CLRSCSIRSTI 0x20
202 #define CLRBUSFREE 0x08
203 #define CLRSCSIPERR 0x04
204 #define CLRPHASECHG 0x02
205 #define CLRREQINIT 0x01
211 #define SFCNT 0x07 /* mask */
214 #define SCSICNT 0xf0 /* mask */
216 #define OFFCNT 0x0f /* mask */
218 /* SCSI TEST control */
228 #define CLRSYNCERR 0x04
229 #define CLRFWERR 0x02
230 #define CLRFRERR 0x01
232 /* SCSI interrupt mode 0 */
235 #define ENSELINGO 0x10
238 #define ENSPIORDY 0x02
239 #define ENDMADONE 0x01
241 /* SCSI interrupt mode 1 */
242 #define ENSELTIMO 0x80
243 #define ENATNTARG 0x40
244 #define ENSCSIRST 0x20
245 #define ENPHASEMIS 0x10
246 #define ENBUSFREE 0x08
247 #define ENSCSIPERR 0x04
248 #define ENPHASECHG 0x02
249 #define ENREQINIT 0x01
255 #define WRITE_READ 0x08
262 #define STK 0x07 /* mask */
268 #define DFIFOFULL 0x10
269 #define DFIFOEMP 0x08
284 /* On the AHA-152x board PORTA and PORTB contain
285 some information about the board's configuration. */
288 unsigned reserved
:2; /* reserved */
289 unsigned tardisc
:1; /* Target disconnect: 0=disabled, 1=enabled */
290 unsigned syncneg
:1; /* Initial sync neg: 0=disabled, 1=enabled */
291 unsigned msgclasses
:2; /* Message classes
297 unsigned boot
:1; /* boot: 0=disabled, 1=enabled */
298 unsigned dma
:1; /* Transfer mode: 0=PIO; 1=DMA */
299 unsigned id
:3; /* SCSI-id */
300 unsigned irq
:2; /* IRQ-Channel: 0,3=12, 1=10, 2=11 */
301 unsigned dmachan
:2; /* DMA-Channel: 0=0, 1=5, 2=6, 3=7 */
302 unsigned parity
:1; /* SCSI-parity: 1=enabled 0=disabled */
307 #define cf_parity fields.parity
308 #define cf_dmachan fields.dmachan
309 #define cf_irq fields.irq
310 #define cf_id fields.id
311 #define cf_dma fields.dma
312 #define cf_boot fields.boot
313 #define cf_msgclasses fields.msgclasses
314 #define cf_syncneg fields.syncneg
315 #define cf_tardisc fields.tardisc
318 /* Some macros to manipulate ports and their bits */
320 #define SETPORT(PORT, VAL) outb( (VAL), (PORT) )
321 #define SETPORTP(PORT, VAL) outb_p( (VAL), (PORT) )
322 #define SETPORTW(PORT, VAL) outw( (VAL), (PORT) )
324 #define GETPORT(PORT) inb( PORT )
325 #define GETPORTW(PORT) inw( PORT )
327 #define SETBITS(PORT, BITS) outb( (inb(PORT) | (BITS)), (PORT) )
328 #define CLRBITS(PORT, BITS) outb( (inb(PORT) & ~(BITS)), (PORT) )
329 #define CLRSETBITS(PORT, CLR, SET) outb( (inb(PORT) & ~(CLR)) | (SET) , (PORT) )
331 #define TESTHI(PORT, BITS) ((inb(PORT) & (BITS)) == BITS)
332 #define TESTLO(PORT, BITS) ((inb(PORT) & (BITS)) == 0)
336 debug_skipports
= 0x0001,
337 debug_queue
= 0x0002,
339 debug_selection
= 0x0008,
342 debug_status
= 0x0040,
344 debug_datai
= 0x0100,
345 debug_datao
= 0x0200,
346 debug_abort
= 0x0400,
348 debug_biosparam
= 0x1000,
349 debug_phases
= 0x2000,
350 debug_queues
= 0x4000,
351 debug_reset
= 0x8000,
355 #endif /* _AHA152X_H */