1 /* $NetBSD: aic6360reg.h,v 1.1.52.3 2004/09/21 13:27:50 skrll Exp $ */
4 * Copyright (c) 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Charles M. Hannum.
17 * 4. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
20 * Copyright (c) 1994 Jarle Greipsland
21 * All rights reserved.
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
26 * 1. Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. The name of the author may not be used to endorse or promote products
32 * derived from this software without specific prior written permission.
34 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
38 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
42 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 * POSSIBILITY OF SUCH DAMAGE.
48 * Acknowledgements: Many of the algorithms used in this driver are
49 * inspired by the work of Julian Elischer (julian@tfs.com) and
50 * Charles Hannum (mycroft@duality.gnu.ai.mit.edu). Thanks a million!
53 /* Definitions, most of them have turned out to be unnecessary, but here they
57 /* AIC6360 definitions */
58 #define SCSISEQ 0x00 /* SCSI sequence control */
59 #define SXFRCTL0 0x01 /* SCSI transfer control 0 */
60 #define SXFRCTL1 0x02 /* SCSI transfer control 1 */
61 #define SCSISIG 0x03 /* SCSI signal in/out */
62 #define SCSIRATE 0x04 /* SCSI rate control */
63 #define SCSIID 0x05 /* SCSI ID */
64 #define SELID 0x05 /* Selection/Reselection ID */
65 #define SCSIDAT 0x06 /* SCSI Latched Data */
66 #define SCSIBUS 0x07 /* SCSI Data Bus*/
67 #define STCNT0 0x08 /* SCSI transfer count */
70 #define CLRSINT0 0x0b /* Clear SCSI interrupts 0 */
71 #define SSTAT0 0x0b /* SCSI interrupt status 0 */
72 #define CLRSINT1 0x0c /* Clear SCSI interrupts 1 */
73 #define SSTAT1 0x0c /* SCSI status 1 */
74 #define SSTAT2 0x0d /* SCSI status 2 */
75 #define SCSITEST 0x0e /* SCSI test control */
76 #define SSTAT3 0x0e /* SCSI status 3 */
77 #define CLRSERR 0x0f /* Clear SCSI errors */
78 #define SSTAT4 0x0f /* SCSI status 4 */
79 #define SIMODE0 0x10 /* SCSI interrupt mode 0 */
80 #define SIMODE1 0x11 /* SCSI interrupt mode 1 */
81 #define DMACNTRL0 0x12 /* DMA control 0 */
82 #define DMACNTRL1 0x13 /* DMA control 1 */
83 #define DMASTAT 0x14 /* DMA status */
84 #define FIFOSTAT 0x15 /* FIFO status */
85 #define DMADATA 0x16 /* DMA data */
86 #define DMADATAL 0x16 /* DMA data low byte */
87 #define DMADATAH 0x17 /* DMA data high byte */
88 #define BRSTCNTRL 0x18 /* Burst Control */
89 #define DMADATALONG 0x18
90 #define PORTA 0x1a /* Port A */
91 #define PORTB 0x1b /* Port B */
92 #define REV 0x1c /* Revision (001 for 6360) */
93 #define STACK 0x1d /* Stack */
94 #define TEST 0x1e /* Test register */
95 #define ID 0x1f /* ID register */
97 #define IDSTRING "(C)1991ADAPTECAIC6360 "
99 /* What all the bits do */
105 #define ENRESELI 0x10
106 #define ENAUTOATNO 0x08
107 #define ENAUTOATNI 0x04
108 #define ENAUTOATNP 0x02
109 #define SCSIRSTO 0x01
115 #define CLRSTCNT 0x10
120 #define BITBUCKET 0x80
123 #define STIMESEL1 0x10
124 #define STIMESEL0 0x08
125 #define STIMO_256ms 0x00
126 #define STIMO_128ms 0x08
127 #define STIMO_64ms 0x10
128 #define STIMO_32ms 0x18
129 #define ENSTIMER 0x04
130 #define BYTEALIGN 0x02
142 /* Important! The 3 most significant bits of this register, in initiator mode,
143 * represents the "expected" SCSI bus phase and can be used to trigger phase
144 * mismatch and phase change interrupts. But more important: If there is a
145 * phase mismatch the chip will not transfer any data! This is actually a nice
146 * feature as it gives us a bit more control over what is happening when we are
147 * bursting data (in) through the FIFOs and the phase suddenly changes from
148 * DATA IN to STATUS or MESSAGE IN. The transfer will stop and wait for the
149 * proper phase to be set in this register instead of dumping the bits into the
162 /* Information transfer phases */
163 #define PH_DATAOUT (0)
164 #define PH_DATAIN (IOI)
166 #define PH_STAT (CDI | IOI)
167 #define PH_MSGOUT (MSGI | CDI)
168 #define PH_MSGIN (MSGI | CDI | IOI)
170 #define PH_MASK (MSGI | CDI | IOI)
172 #define PH_INVALID 0xff
187 #define OID_S 4 /* shift value */
191 #define SCSI_ID_MASK 0x7
193 /* SCSI selection/reselection ID (both target *and* initiator) */
203 /* CLRSINT0 Clears what? (interrupt and/or status bit) */
204 #define SETSDONE 0x80
205 #define CLRSELDO 0x40 /* I */
206 #define CLRSELDI 0x20 /* I+ */
207 #define CLRSELINGO 0x10 /* I */
208 #define CLRSWRAP 0x08 /* I+S */
209 #define CLRSDONE 0x04 /* I+S */
210 #define CLRSPIORDY 0x02 /* I */
211 #define CLRDMADONE 0x01 /* I */
213 /* SSTAT0 Howto clear */
215 #define SELDO 0x40 /* Selfclearing */
216 #define SELDI 0x20 /* Selfclearing when CLRSELDI is set */
217 #define SELINGO 0x10 /* Selfclearing */
218 #define SWRAP 0x08 /* CLRSWAP */
219 #define SDONE 0x04 /* Not used in initiator mode */
220 #define SPIORDY 0x02 /* Selfclearing (op on SCSIDAT) */
221 #define DMADONE 0x01 /* Selfclearing (all FIFOs empty & T/C */
223 /* CLRSINT1 Clears what? */
224 #define CLRSELTIMO 0x80 /* I+S */
226 #define CLRSCSIRSTI 0x20 /* I+S */
227 #define CLRBUSFREE 0x08 /* I+S */
228 #define CLRSCSIPERR 0x04 /* I+S */
229 #define CLRPHASECHG 0x02 /* I+S */
230 #define CLRREQINIT 0x01 /* I+S */
232 /* SSTAT1 How to clear? When set?*/
233 #define SELTO 0x80 /* C select out timeout */
234 #define ATNTARG 0x40 /* Not used in initiator mode */
235 #define SCSIRSTI 0x20 /* C RST asserted */
236 #define PHASEMIS 0x10 /* Selfclearing */
237 #define BUSFREE 0x08 /* C bus free condition */
238 #define SCSIPERR 0x04 /* C parity error on inbound data */
239 #define PHASECHG 0x02 /* C phase in SCSISIG doesn't match */
240 #define REQINIT 0x01 /* C or ACK asserting edge of REQ */
256 #define SCSICNT3 0x80
257 #define SCSICNT2 0x40
258 #define SCSICNT1 0x20
259 #define SCSICNT0 0x10
266 #define CLRSYNCERR 0x04
267 #define CLRFWERR 0x02
268 #define CLRFRERR 0x01
278 #define ENSELINGO 0x10
281 #define ENSPIORDY 0x02
282 #define ENDMADONE 0x01
285 #define ENSELTIMO 0x80
286 #define ENATNTARG 0x40
287 #define ENSCSIRST 0x20
288 #define ENPHASEMIS 0x10
289 #define ENBUSFREE 0x08
290 #define ENSCSIPERR 0x04
291 #define ENPHASECHG 0x02
292 #define ENREQINIT 0x01
298 #define DWORDPIO 0x10
317 #define DFIFOFULL 0x10
318 #define DFIFOEMP 0x08
320 #define DWORDRDY 0x02