aic6360reg.h revision 1.1.2.2 1 1.1.2.2 thorpej /* $NetBSD: aic6360reg.h,v 1.1.2.2 1997/10/14 10:22:19 thorpej Exp $ */
2 1.1.2.2 thorpej
3 1.1.2.2 thorpej /*
4 1.1.2.2 thorpej * Copyright (c) 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
5 1.1.2.2 thorpej *
6 1.1.2.2 thorpej * Redistribution and use in source and binary forms, with or without
7 1.1.2.2 thorpej * modification, are permitted provided that the following conditions
8 1.1.2.2 thorpej * are met:
9 1.1.2.2 thorpej * 1. Redistributions of source code must retain the above copyright
10 1.1.2.2 thorpej * notice, this list of conditions and the following disclaimer.
11 1.1.2.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
12 1.1.2.2 thorpej * notice, this list of conditions and the following disclaimer in the
13 1.1.2.2 thorpej * documentation and/or other materials provided with the distribution.
14 1.1.2.2 thorpej * 3. All advertising materials mentioning features or use of this software
15 1.1.2.2 thorpej * must display the following acknowledgement:
16 1.1.2.2 thorpej * This product includes software developed by Charles M. Hannum.
17 1.1.2.2 thorpej * 4. The name of the author may not be used to endorse or promote products
18 1.1.2.2 thorpej * derived from this software without specific prior written permission.
19 1.1.2.2 thorpej *
20 1.1.2.2 thorpej * Copyright (c) 1994 Jarle Greipsland
21 1.1.2.2 thorpej * All rights reserved.
22 1.1.2.2 thorpej *
23 1.1.2.2 thorpej * Redistribution and use in source and binary forms, with or without
24 1.1.2.2 thorpej * modification, are permitted provided that the following conditions
25 1.1.2.2 thorpej * are met:
26 1.1.2.2 thorpej * 1. Redistributions of source code must retain the above copyright
27 1.1.2.2 thorpej * notice, this list of conditions and the following disclaimer.
28 1.1.2.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
29 1.1.2.2 thorpej * notice, this list of conditions and the following disclaimer in the
30 1.1.2.2 thorpej * documentation and/or other materials provided with the distribution.
31 1.1.2.2 thorpej * 3. The name of the author may not be used to endorse or promote products
32 1.1.2.2 thorpej * derived from this software without specific prior written permission.
33 1.1.2.2 thorpej *
34 1.1.2.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
35 1.1.2.2 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36 1.1.2.2 thorpej * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37 1.1.2.2 thorpej * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
38 1.1.2.2 thorpej * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 1.1.2.2 thorpej * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
40 1.1.2.2 thorpej * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41 1.1.2.2 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
42 1.1.2.2 thorpej * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43 1.1.2.2 thorpej * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 1.1.2.2 thorpej * POSSIBILITY OF SUCH DAMAGE.
45 1.1.2.2 thorpej */
46 1.1.2.2 thorpej
47 1.1.2.2 thorpej /*
48 1.1.2.2 thorpej * Acknowledgements: Many of the algorithms used in this driver are
49 1.1.2.2 thorpej * inspired by the work of Julian Elischer (julian (at) tfs.com) and
50 1.1.2.2 thorpej * Charles Hannum (mycroft (at) duality.gnu.ai.mit.edu). Thanks a million!
51 1.1.2.2 thorpej */
52 1.1.2.2 thorpej
53 1.1.2.2 thorpej /* Definitions, most of them has turned out to be unneccesary, but here they
54 1.1.2.2 thorpej * are anyway.
55 1.1.2.2 thorpej */
56 1.1.2.2 thorpej
57 1.1.2.2 thorpej /* AIC6360 definitions */
58 1.1.2.2 thorpej #define SCSISEQ 0x00 /* SCSI sequence control */
59 1.1.2.2 thorpej #define SXFRCTL0 0x01 /* SCSI transfer control 0 */
60 1.1.2.2 thorpej #define SXFRCTL1 0x02 /* SCSI transfer control 1 */
61 1.1.2.2 thorpej #define SCSISIG 0x03 /* SCSI signal in/out */
62 1.1.2.2 thorpej #define SCSIRATE 0x04 /* SCSI rate control */
63 1.1.2.2 thorpej #define SCSIID 0x05 /* SCSI ID */
64 1.1.2.2 thorpej #define SELID 0x05 /* Selection/Reselection ID */
65 1.1.2.2 thorpej #define SCSIDAT 0x06 /* SCSI Latched Data */
66 1.1.2.2 thorpej #define SCSIBUS 0x07 /* SCSI Data Bus*/
67 1.1.2.2 thorpej #define STCNT0 0x08 /* SCSI transfer count */
68 1.1.2.2 thorpej #define STCNT1 0x09
69 1.1.2.2 thorpej #define STCNT2 0x0a
70 1.1.2.2 thorpej #define CLRSINT0 0x0b /* Clear SCSI interrupts 0 */
71 1.1.2.2 thorpej #define SSTAT0 0x0b /* SCSI interrupt status 0 */
72 1.1.2.2 thorpej #define CLRSINT1 0x0c /* Clear SCSI interrupts 1 */
73 1.1.2.2 thorpej #define SSTAT1 0x0c /* SCSI status 1 */
74 1.1.2.2 thorpej #define SSTAT2 0x0d /* SCSI status 2 */
75 1.1.2.2 thorpej #define SCSITEST 0x0e /* SCSI test control */
76 1.1.2.2 thorpej #define SSTAT3 0x0e /* SCSI status 3 */
77 1.1.2.2 thorpej #define CLRSERR 0x0f /* Clear SCSI errors */
78 1.1.2.2 thorpej #define SSTAT4 0x0f /* SCSI status 4 */
79 1.1.2.2 thorpej #define SIMODE0 0x10 /* SCSI interrupt mode 0 */
80 1.1.2.2 thorpej #define SIMODE1 0x11 /* SCSI interrupt mode 1 */
81 1.1.2.2 thorpej #define DMACNTRL0 0x12 /* DMA control 0 */
82 1.1.2.2 thorpej #define DMACNTRL1 0x13 /* DMA control 1 */
83 1.1.2.2 thorpej #define DMASTAT 0x14 /* DMA status */
84 1.1.2.2 thorpej #define FIFOSTAT 0x15 /* FIFO status */
85 1.1.2.2 thorpej #define DMADATA 0x16 /* DMA data */
86 1.1.2.2 thorpej #define DMADATAL 0x16 /* DMA data low byte */
87 1.1.2.2 thorpej #define DMADATAH 0x17 /* DMA data high byte */
88 1.1.2.2 thorpej #define BRSTCNTRL 0x18 /* Burst Control */
89 1.1.2.2 thorpej #define DMADATALONG 0x18
90 1.1.2.2 thorpej #define PORTA 0x1a /* Port A */
91 1.1.2.2 thorpej #define PORTB 0x1b /* Port B */
92 1.1.2.2 thorpej #define REV 0x1c /* Revision (001 for 6360) */
93 1.1.2.2 thorpej #define STACK 0x1d /* Stack */
94 1.1.2.2 thorpej #define TEST 0x1e /* Test register */
95 1.1.2.2 thorpej #define ID 0x1f /* ID register */
96 1.1.2.2 thorpej
97 1.1.2.2 thorpej #define IDSTRING "(C)1991ADAPTECAIC6360 "
98 1.1.2.2 thorpej
99 1.1.2.2 thorpej /* What all the bits do */
100 1.1.2.2 thorpej
101 1.1.2.2 thorpej /* SCSISEQ */
102 1.1.2.2 thorpej #define TEMODEO 0x80
103 1.1.2.2 thorpej #define ENSELO 0x40
104 1.1.2.2 thorpej #define ENSELI 0x20
105 1.1.2.2 thorpej #define ENRESELI 0x10
106 1.1.2.2 thorpej #define ENAUTOATNO 0x08
107 1.1.2.2 thorpej #define ENAUTOATNI 0x04
108 1.1.2.2 thorpej #define ENAUTOATNP 0x02
109 1.1.2.2 thorpej #define SCSIRSTO 0x01
110 1.1.2.2 thorpej
111 1.1.2.2 thorpej /* SXFRCTL0 */
112 1.1.2.2 thorpej #define SCSIEN 0x80
113 1.1.2.2 thorpej #define DMAEN 0x40
114 1.1.2.2 thorpej #define CHEN 0x20
115 1.1.2.2 thorpej #define CLRSTCNT 0x10
116 1.1.2.2 thorpej #define SPIOEN 0x08
117 1.1.2.2 thorpej #define CLRCH 0x02
118 1.1.2.2 thorpej
119 1.1.2.2 thorpej /* SXFRCTL1 */
120 1.1.2.2 thorpej #define BITBUCKET 0x80
121 1.1.2.2 thorpej #define SWRAPEN 0x40
122 1.1.2.2 thorpej #define ENSPCHK 0x20
123 1.1.2.2 thorpej #define STIMESEL1 0x10
124 1.1.2.2 thorpej #define STIMESEL0 0x08
125 1.1.2.2 thorpej #define STIMO_256ms 0x00
126 1.1.2.2 thorpej #define STIMO_128ms 0x08
127 1.1.2.2 thorpej #define STIMO_64ms 0x10
128 1.1.2.2 thorpej #define STIMO_32ms 0x18
129 1.1.2.2 thorpej #define ENSTIMER 0x04
130 1.1.2.2 thorpej #define BYTEALIGN 0x02
131 1.1.2.2 thorpej
132 1.1.2.2 thorpej /* SCSISIG (in) */
133 1.1.2.2 thorpej #define CDI 0x80
134 1.1.2.2 thorpej #define IOI 0x40
135 1.1.2.2 thorpej #define MSGI 0x20
136 1.1.2.2 thorpej #define ATNI 0x10
137 1.1.2.2 thorpej #define SELI 0x08
138 1.1.2.2 thorpej #define BSYI 0x04
139 1.1.2.2 thorpej #define REQI 0x02
140 1.1.2.2 thorpej #define ACKI 0x01
141 1.1.2.2 thorpej
142 1.1.2.2 thorpej /* Important! The 3 most significant bits of this register, in initiator mode,
143 1.1.2.2 thorpej * represents the "expected" SCSI bus phase and can be used to trigger phase
144 1.1.2.2 thorpej * mismatch and phase change interrupts. But more important: If there is a
145 1.1.2.2 thorpej * phase mismatch the chip will not transfer any data! This is actually a nice
146 1.1.2.2 thorpej * feature as it gives us a bit more control over what is happening when we are
147 1.1.2.2 thorpej * bursting data (in) through the FIFOs and the phase suddenly changes from
148 1.1.2.2 thorpej * DATA IN to STATUS or MESSAGE IN. The transfer will stop and wait for the
149 1.1.2.2 thorpej * proper phase to be set in this register instead of dumping the bits into the
150 1.1.2.2 thorpej * FIFOs.
151 1.1.2.2 thorpej */
152 1.1.2.2 thorpej /* SCSISIG (out) */
153 1.1.2.2 thorpej #define CDO 0x80
154 1.1.2.2 thorpej #define IOO 0x40
155 1.1.2.2 thorpej #define MSGO 0x20
156 1.1.2.2 thorpej #define ATNO 0x10
157 1.1.2.2 thorpej #define SELO 0x08
158 1.1.2.2 thorpej #define BSYO 0x04
159 1.1.2.2 thorpej #define REQO 0x02
160 1.1.2.2 thorpej #define ACKO 0x01
161 1.1.2.2 thorpej
162 1.1.2.2 thorpej /* Information transfer phases */
163 1.1.2.2 thorpej #define PH_DATAOUT (0)
164 1.1.2.2 thorpej #define PH_DATAIN (IOI)
165 1.1.2.2 thorpej #define PH_CMD (CDI)
166 1.1.2.2 thorpej #define PH_STAT (CDI | IOI)
167 1.1.2.2 thorpej #define PH_MSGOUT (MSGI | CDI)
168 1.1.2.2 thorpej #define PH_MSGIN (MSGI | CDI | IOI)
169 1.1.2.2 thorpej
170 1.1.2.2 thorpej #define PH_MASK (MSGI | CDI | IOI)
171 1.1.2.2 thorpej
172 1.1.2.2 thorpej #define PH_INVALID 0xff
173 1.1.2.2 thorpej
174 1.1.2.2 thorpej /* SCSIRATE */
175 1.1.2.2 thorpej #define SXFR2 0x40
176 1.1.2.2 thorpej #define SXFR1 0x20
177 1.1.2.2 thorpej #define SXFR0 0x10
178 1.1.2.2 thorpej #define SOFS3 0x08
179 1.1.2.2 thorpej #define SOFS2 0x04
180 1.1.2.2 thorpej #define SOFS1 0x02
181 1.1.2.2 thorpej #define SOFS0 0x01
182 1.1.2.2 thorpej
183 1.1.2.2 thorpej /* SCSI ID */
184 1.1.2.2 thorpej #define OID2 0x40
185 1.1.2.2 thorpej #define OID1 0x20
186 1.1.2.2 thorpej #define OID0 0x10
187 1.1.2.2 thorpej #define OID_S 4 /* shift value */
188 1.1.2.2 thorpej #define TID2 0x04
189 1.1.2.2 thorpej #define TID1 0x02
190 1.1.2.2 thorpej #define TID0 0x01
191 1.1.2.2 thorpej #define SCSI_ID_MASK 0x7
192 1.1.2.2 thorpej
193 1.1.2.2 thorpej /* SCSI selection/reselection ID (both target *and* initiator) */
194 1.1.2.2 thorpej #define SELID7 0x80
195 1.1.2.2 thorpej #define SELID6 0x40
196 1.1.2.2 thorpej #define SELID5 0x20
197 1.1.2.2 thorpej #define SELID4 0x10
198 1.1.2.2 thorpej #define SELID3 0x08
199 1.1.2.2 thorpej #define SELID2 0x04
200 1.1.2.2 thorpej #define SELID1 0x02
201 1.1.2.2 thorpej #define SELID0 0x01
202 1.1.2.2 thorpej
203 1.1.2.2 thorpej /* CLRSINT0 Clears what? (interrupt and/or status bit) */
204 1.1.2.2 thorpej #define SETSDONE 0x80
205 1.1.2.2 thorpej #define CLRSELDO 0x40 /* I */
206 1.1.2.2 thorpej #define CLRSELDI 0x20 /* I+ */
207 1.1.2.2 thorpej #define CLRSELINGO 0x10 /* I */
208 1.1.2.2 thorpej #define CLRSWRAP 0x08 /* I+S */
209 1.1.2.2 thorpej #define CLRSDONE 0x04 /* I+S */
210 1.1.2.2 thorpej #define CLRSPIORDY 0x02 /* I */
211 1.1.2.2 thorpej #define CLRDMADONE 0x01 /* I */
212 1.1.2.2 thorpej
213 1.1.2.2 thorpej /* SSTAT0 Howto clear */
214 1.1.2.2 thorpej #define TARGET 0x80
215 1.1.2.2 thorpej #define SELDO 0x40 /* Selfclearing */
216 1.1.2.2 thorpej #define SELDI 0x20 /* Selfclearing when CLRSELDI is set */
217 1.1.2.2 thorpej #define SELINGO 0x10 /* Selfclearing */
218 1.1.2.2 thorpej #define SWRAP 0x08 /* CLRSWAP */
219 1.1.2.2 thorpej #define SDONE 0x04 /* Not used in initiator mode */
220 1.1.2.2 thorpej #define SPIORDY 0x02 /* Selfclearing (op on SCSIDAT) */
221 1.1.2.2 thorpej #define DMADONE 0x01 /* Selfclearing (all FIFOs empty & T/C */
222 1.1.2.2 thorpej
223 1.1.2.2 thorpej /* CLRSINT1 Clears what? */
224 1.1.2.2 thorpej #define CLRSELTIMO 0x80 /* I+S */
225 1.1.2.2 thorpej #define CLRATNO 0x40
226 1.1.2.2 thorpej #define CLRSCSIRSTI 0x20 /* I+S */
227 1.1.2.2 thorpej #define CLRBUSFREE 0x08 /* I+S */
228 1.1.2.2 thorpej #define CLRSCSIPERR 0x04 /* I+S */
229 1.1.2.2 thorpej #define CLRPHASECHG 0x02 /* I+S */
230 1.1.2.2 thorpej #define CLRREQINIT 0x01 /* I+S */
231 1.1.2.2 thorpej
232 1.1.2.2 thorpej /* SSTAT1 How to clear? When set?*/
233 1.1.2.2 thorpej #define SELTO 0x80 /* C select out timeout */
234 1.1.2.2 thorpej #define ATNTARG 0x40 /* Not used in initiator mode */
235 1.1.2.2 thorpej #define SCSIRSTI 0x20 /* C RST asserted */
236 1.1.2.2 thorpej #define PHASEMIS 0x10 /* Selfclearing */
237 1.1.2.2 thorpej #define BUSFREE 0x08 /* C bus free condition */
238 1.1.2.2 thorpej #define SCSIPERR 0x04 /* C parity error on inbound data */
239 1.1.2.2 thorpej #define PHASECHG 0x02 /* C phase in SCSISIG doesn't match */
240 1.1.2.2 thorpej #define REQINIT 0x01 /* C or ACK asserting edge of REQ */
241 1.1.2.2 thorpej
242 1.1.2.2 thorpej /* SSTAT2 */
243 1.1.2.2 thorpej #define SOFFSET 0x20
244 1.1.2.2 thorpej #define SEMPTY 0x10
245 1.1.2.2 thorpej #define SFULL 0x08
246 1.1.2.2 thorpej #define SFCNT2 0x04
247 1.1.2.2 thorpej #define SFCNT1 0x02
248 1.1.2.2 thorpej #define SFCNT0 0x01
249 1.1.2.2 thorpej
250 1.1.2.2 thorpej /* SCSITEST */
251 1.1.2.2 thorpej #define SCTESTU 0x08
252 1.1.2.2 thorpej #define SCTESTD 0x04
253 1.1.2.2 thorpej #define STCTEST 0x01
254 1.1.2.2 thorpej
255 1.1.2.2 thorpej /* SSTAT3 */
256 1.1.2.2 thorpej #define SCSICNT3 0x80
257 1.1.2.2 thorpej #define SCSICNT2 0x40
258 1.1.2.2 thorpej #define SCSICNT1 0x20
259 1.1.2.2 thorpej #define SCSICNT0 0x10
260 1.1.2.2 thorpej #define OFFCNT3 0x08
261 1.1.2.2 thorpej #define OFFCNT2 0x04
262 1.1.2.2 thorpej #define OFFCNT1 0x02
263 1.1.2.2 thorpej #define OFFCNT0 0x01
264 1.1.2.2 thorpej
265 1.1.2.2 thorpej /* CLRSERR */
266 1.1.2.2 thorpej #define CLRSYNCERR 0x04
267 1.1.2.2 thorpej #define CLRFWERR 0x02
268 1.1.2.2 thorpej #define CLRFRERR 0x01
269 1.1.2.2 thorpej
270 1.1.2.2 thorpej /* SSTAT4 */
271 1.1.2.2 thorpej #define SYNCERR 0x04
272 1.1.2.2 thorpej #define FWERR 0x02
273 1.1.2.2 thorpej #define FRERR 0x01
274 1.1.2.2 thorpej
275 1.1.2.2 thorpej /* SIMODE0 */
276 1.1.2.2 thorpej #define ENSELDO 0x40
277 1.1.2.2 thorpej #define ENSELDI 0x20
278 1.1.2.2 thorpej #define ENSELINGO 0x10
279 1.1.2.2 thorpej #define ENSWRAP 0x08
280 1.1.2.2 thorpej #define ENSDONE 0x04
281 1.1.2.2 thorpej #define ENSPIORDY 0x02
282 1.1.2.2 thorpej #define ENDMADONE 0x01
283 1.1.2.2 thorpej
284 1.1.2.2 thorpej /* SIMODE1 */
285 1.1.2.2 thorpej #define ENSELTIMO 0x80
286 1.1.2.2 thorpej #define ENATNTARG 0x40
287 1.1.2.2 thorpej #define ENSCSIRST 0x20
288 1.1.2.2 thorpej #define ENPHASEMIS 0x10
289 1.1.2.2 thorpej #define ENBUSFREE 0x08
290 1.1.2.2 thorpej #define ENSCSIPERR 0x04
291 1.1.2.2 thorpej #define ENPHASECHG 0x02
292 1.1.2.2 thorpej #define ENREQINIT 0x01
293 1.1.2.2 thorpej
294 1.1.2.2 thorpej /* DMACNTRL0 */
295 1.1.2.2 thorpej #define ENDMA 0x80
296 1.1.2.2 thorpej #define B8MODE 0x40
297 1.1.2.2 thorpej #define DMA 0x20
298 1.1.2.2 thorpej #define DWORDPIO 0x10
299 1.1.2.2 thorpej #define WRITE 0x08
300 1.1.2.2 thorpej #define INTEN 0x04
301 1.1.2.2 thorpej #define RSTFIFO 0x02
302 1.1.2.2 thorpej #define SWINT 0x01
303 1.1.2.2 thorpej
304 1.1.2.2 thorpej /* DMACNTRL1 */
305 1.1.2.2 thorpej #define PWRDWN 0x80
306 1.1.2.2 thorpej #define ENSTK32 0x40
307 1.1.2.2 thorpej #define STK4 0x10
308 1.1.2.2 thorpej #define STK3 0x08
309 1.1.2.2 thorpej #define STK2 0x04
310 1.1.2.2 thorpej #define STK1 0x02
311 1.1.2.2 thorpej #define STK0 0x01
312 1.1.2.2 thorpej
313 1.1.2.2 thorpej /* DMASTAT */
314 1.1.2.2 thorpej #define ATDONE 0x80
315 1.1.2.2 thorpej #define WORDRDY 0x40
316 1.1.2.2 thorpej #define INTSTAT 0x20
317 1.1.2.2 thorpej #define DFIFOFULL 0x10
318 1.1.2.2 thorpej #define DFIFOEMP 0x08
319 1.1.2.2 thorpej #define DFIFOHF 0x04
320 1.1.2.2 thorpej #define DWORDRDY 0x02
321 1.1.2.2 thorpej
322 1.1.2.2 thorpej /* BRSTCNTRL */
323 1.1.2.2 thorpej #define BON3 0x80
324 1.1.2.2 thorpej #define BON2 0x40
325 1.1.2.2 thorpej #define BON1 0x20
326 1.1.2.2 thorpej #define BON0 0x10
327 1.1.2.2 thorpej #define BOFF3 0x08
328 1.1.2.2 thorpej #define BOFF2 0x04
329 1.1.2.2 thorpej #define BOFF1 0x02
330 1.1.2.2 thorpej #define BOFF0 0x01
331 1.1.2.2 thorpej
332 1.1.2.2 thorpej /* TEST */
333 1.1.2.2 thorpej #define BOFFTMR 0x40
334 1.1.2.2 thorpej #define BONTMR 0x20
335 1.1.2.2 thorpej #define STCNTH 0x10
336 1.1.2.2 thorpej #define STCNTM 0x08
337 1.1.2.2 thorpej #define STCNTL 0x04
338 1.1.2.2 thorpej #define SCSIBLK 0x02
339 1.1.2.2 thorpej #define DMABLK 0x01
340