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