ascreg.h revision 1.2 1 1.2 agc /* $NetBSD: ascreg.h,v 1.2 2003/08/07 16:26:29 agc Exp $ */
2 1.2 agc
3 1.2 agc /*
4 1.2 agc * Copyright (c) 1982, 1990 The Regents of the University of California.
5 1.2 agc * All rights reserved.
6 1.2 agc *
7 1.2 agc * Redistribution and use in source and binary forms, with or without
8 1.2 agc * modification, are permitted provided that the following conditions
9 1.2 agc * are met:
10 1.2 agc * 1. Redistributions of source code must retain the above copyright
11 1.2 agc * notice, this list of conditions and the following disclaimer.
12 1.2 agc * 2. Redistributions in binary form must reproduce the above copyright
13 1.2 agc * notice, this list of conditions and the following disclaimer in the
14 1.2 agc * documentation and/or other materials provided with the distribution.
15 1.2 agc * 3. Neither the name of the University nor the names of its contributors
16 1.2 agc * may be used to endorse or promote products derived from this software
17 1.2 agc * without specific prior written permission.
18 1.2 agc *
19 1.2 agc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.2 agc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.2 agc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.2 agc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.2 agc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.2 agc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.2 agc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.2 agc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.2 agc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.2 agc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.2 agc * SUCH DAMAGE.
30 1.2 agc *
31 1.2 agc * from:ahscreg.h,v 1.2 1994/10/26 02:02:46
32 1.2 agc */
33 1.1 reinoud
34 1.1 reinoud /*
35 1.1 reinoud * Copyright (c) 1996 Mark Brinicombe
36 1.1 reinoud * Copyright (c) 1994 Christian E. Hopps
37 1.1 reinoud *
38 1.1 reinoud * Redistribution and use in source and binary forms, with or without
39 1.1 reinoud * modification, are permitted provided that the following conditions
40 1.1 reinoud * are met:
41 1.1 reinoud * 1. Redistributions of source code must retain the above copyright
42 1.1 reinoud * notice, this list of conditions and the following disclaimer.
43 1.1 reinoud * 2. Redistributions in binary form must reproduce the above copyright
44 1.1 reinoud * notice, this list of conditions and the following disclaimer in the
45 1.1 reinoud * documentation and/or other materials provided with the distribution.
46 1.1 reinoud * 3. All advertising materials mentioning features or use of this software
47 1.1 reinoud * must display the following acknowledgement:
48 1.1 reinoud * This product includes software developed by the University of
49 1.1 reinoud * California, Berkeley and its contributors.
50 1.1 reinoud * 4. Neither the name of the University nor the names of its contributors
51 1.1 reinoud * may be used to endorse or promote products derived from this software
52 1.1 reinoud * without specific prior written permission.
53 1.1 reinoud *
54 1.1 reinoud * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 1.1 reinoud * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 1.1 reinoud * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 1.1 reinoud * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 1.1 reinoud * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 1.1 reinoud * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 1.1 reinoud * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 1.1 reinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 1.1 reinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 1.1 reinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 1.1 reinoud * SUCH DAMAGE.
65 1.1 reinoud *
66 1.1 reinoud * from:ahscreg.h,v 1.2 1994/10/26 02:02:46
67 1.1 reinoud */
68 1.1 reinoud
69 1.1 reinoud #ifndef _ASCREG_H_
70 1.1 reinoud #define _ASCREG_H_
71 1.1 reinoud
72 1.1 reinoud /*
73 1.1 reinoud * Hardware layout of the A3000 SDMAC. This also contains the
74 1.1 reinoud * registers for the sbic chip, but in favor of separating DMA and
75 1.1 reinoud * scsi, the scsi-driver doesn't make use of this dependency
76 1.1 reinoud */
77 1.1 reinoud
78 1.1 reinoud #define v_char volatile char
79 1.1 reinoud #define v_int volatile int
80 1.1 reinoud #define vu_char volatile u_char
81 1.1 reinoud #define vu_short volatile u_short
82 1.1 reinoud #define vu_int volatile u_int
83 1.1 reinoud
84 1.1 reinoud struct sdmac {
85 1.1 reinoud short pad0;
86 1.1 reinoud vu_short DAWR; /* DACK Width Register WO */
87 1.1 reinoud vu_int WTC; /* Word Transfer Count Register RW */
88 1.1 reinoud short pad1;
89 1.1 reinoud vu_short CNTR; /* Control Register RW */
90 1.1 reinoud vu_int ACR; /* Address Count Register RW */
91 1.1 reinoud short pad2;
92 1.1 reinoud vu_short ST_DMA; /* Start DMA Transfers RW-Strobe */
93 1.1 reinoud short pad3;
94 1.1 reinoud vu_short FLUSH; /* Flush FIFO RW-Strobe */
95 1.1 reinoud short pad4;
96 1.1 reinoud vu_short CINT; /* Clear Interrupts RW-Strobe */
97 1.1 reinoud short pad5;
98 1.1 reinoud vu_short ISTR; /* Interrupt Status Register RO */
99 1.1 reinoud int pad6[7];
100 1.1 reinoud short pad7;
101 1.1 reinoud vu_short SP_DMA; /* Stop DMA Transfers RW-Strobe */
102 1.1 reinoud char pad8;
103 1.1 reinoud vu_char SASR; /* sbic asr */
104 1.1 reinoud char pad9;
105 1.1 reinoud vu_char SCMD; /* sbic data */
106 1.1 reinoud };
107 1.1 reinoud
108 1.1 reinoud /*
109 1.1 reinoud * value to go into DAWR
110 1.1 reinoud */
111 1.1 reinoud #define DAWR_AHSC 3 /* according to A3000T service-manual */
112 1.1 reinoud
113 1.1 reinoud /*
114 1.1 reinoud * bits defined for CNTR
115 1.1 reinoud */
116 1.1 reinoud #define CNTR_TCEN (1<<5) /* Terminal Count Enable */
117 1.1 reinoud #define CNTR_PREST (1<<4) /* Perp Reset (not implemented :-((( ) */
118 1.1 reinoud #define CNTR_PDMD (1<<3) /* Perp Device Mode Select (1=SCSI,0=XT/AT) */
119 1.1 reinoud #define CNTR_INTEN (1<<2) /* Interrupt Enable */
120 1.1 reinoud #define CNTR_DDIR (1<<1) /* Device Direction. 1==rd host, wr perp */
121 1.1 reinoud #define CNTR_IO_DX (1<<0) /* IORDY & CSX1 Polarity Select */
122 1.1 reinoud
123 1.1 reinoud /*
124 1.1 reinoud * bits defined for ISTR
125 1.1 reinoud */
126 1.1 reinoud #define ISTR_INTX (1<<8) /* XT/AT Interrupt pending */
127 1.1 reinoud #define ISTR_INT_F (1<<7) /* Interrupt Follow */
128 1.1 reinoud #define ISTR_INTS (1<<6) /* SCSI Peripheral Interrupt */
129 1.1 reinoud #define ISTR_E_INT (1<<5) /* End-Of-Process Interrupt */
130 1.1 reinoud #define ISTR_INT_P (1<<4) /* Interrupt Pending */
131 1.1 reinoud #define ISTR_UE_INT (1<<3) /* Under-Run FIFO Error Interrupt */
132 1.1 reinoud #define ISTR_OE_INT (1<<2) /* Over-Run FIFO Error Interrupt */
133 1.1 reinoud #define ISTR_FF_FLG (1<<1) /* FIFO-Full Flag */
134 1.1 reinoud #define ISTR_FE_FLG (1<<0) /* FIFO-Empty Flag */
135 1.1 reinoud
136 1.1 reinoud #define DMAGO_READ 0x01
137 1.1 reinoud
138 1.1 reinoud
139 1.1 reinoud /* Addresses relative to podule base */
140 1.1 reinoud
141 1.1 reinoud #define ASC_INTSTATUS 0x2000
142 1.1 reinoud #define ASC_CLRINT 0x2000
143 1.1 reinoud #define ASC_PAGEREG 0x3000
144 1.1 reinoud
145 1.1 reinoud /* Addresses relative to module base */
146 1.1 reinoud
147 1.1 reinoud #define ASC_DMAC 0x3000
148 1.1 reinoud #define ASC_SBIC 0x2000
149 1.1 reinoud #define ASC_SRAM 0x0000
150 1.1 reinoud
151 1.1 reinoud #define ASC_SBIC_SPACE 8
152 1.1 reinoud
153 1.1 reinoud #define ASC_SRAM_BLKSIZE 0x1000
154 1.1 reinoud
155 1.1 reinoud #define IS_IRQREQ 0x01
156 1.1 reinoud #define IS_DMAC_IRQ 0x02
157 1.1 reinoud #define IS_SBIC_IRQ 0x08
158 1.1 reinoud
159 1.1 reinoud #if 0
160 1.1 reinoud /* SBIC Commands */
161 1.1 reinoud
162 1.1 reinoud #define SBIC_CMD_Reset 0x00 /* Reset the SBIC */
163 1.1 reinoud #define SBIC_Abort 0x01 /* Abort command */
164 1.1 reinoud #define SBIC_Sel_tx_wATN 0x08 /* Select and Transfer with ATN */
165 1.1 reinoud #define SBIC_Sel_tx_woATN 0x09 /* Select and Transfer without ATN */
166 1.1 reinoud
167 1.1 reinoud /* SBIC status codes */
168 1.1 reinoud
169 1.1 reinoud #define SBIC_ResetOk 0x00
170 1.1 reinoud #define SBIC_ResetAFOk 0x01
171 1.1 reinoud
172 1.1 reinoud /* SBIC registers bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 */
173 1.1 reinoud
174 1.1 reinoud #define SBIC_OWNID 0x00 /* RW FS1 FS0 0 EHP EAF ID2 ID1 ID0 */
175 1.1 reinoud #define SBIC_CONTROL 0x01 /* RW DM2 DM1 DM0 HHP EDI IDI HA HSP */
176 1.1 reinoud #define SBIC_TIMEREG 0x02 /* RW timeout period value = Tper*Ficlk/80d */
177 1.1 reinoud #define SBIC_CDB1TSECT 0x03 /* RW CDB byte 1 & Total sectors per track */
178 1.1 reinoud #define SBIC_CDB2THEAD 0x04 /* RW CDB byte 2 & Total number of heads */
179 1.1 reinoud #define SBIC_CDB3TCYL1 0x05 /* RW CDB byte 3 & Total no. of cylinders MSB */
180 1.1 reinoud #define SBIC_CDB4TCYL2 0x06 /* RW CDB byte 4 & Total no. of cylinders LSB */
181 1.1 reinoud #define SBIC_CDB5LADR1 0x07 /* RW CDB byte 5 & Logical addr to translate */
182 1.1 reinoud #define SBIC_CBD6LADR2 0x08 /* RW CDB byte 6 & Logical addr to translate */
183 1.1 reinoud #define SBIC_CDB7LADR3 0x09 /* RW CDB byte 7 & Logical addr to translate */
184 1.1 reinoud #define SBIC_CDB8LADR4 0x0A /* RW CDB byte 8 & Logical addr to translate */
185 1.1 reinoud #define SBIC_CDB9SECT 0x0B /* RW CDB byte 9 & Translation sector result */
186 1.1 reinoud #define SBIC_CDB10HEAD 0x0C /* RW CDB byte 10 & Translation head result */
187 1.1 reinoud #define SBIC_CDB11CYL1 0x0D /* RW CDB byte 11 & Translation cyl result MSB*/
188 1.1 reinoud #define SBIC_CDB12CYL2 0x0E /* RW CDB byte 12 & Translation cyl result LSB*/
189 1.1 reinoud #define SBIC_TARGETLUN 0x0F /* RW TLV DOK 0 0 0 TL2 TL1 TL0 */
190 1.1 reinoud #define SBIC_COMPHASE 0x10 /* RW Command Phase Register for multi-phase */
191 1.1 reinoud #define SBIC_SYNCTX 0x11 /* RW 0 TP2 TP1 TP0 OF3 OF2 OF1 OF0 */
192 1.1 reinoud #define SBIC_TXCOUNT1 0x12 /* RW Transfer count MSB */
193 1.1 reinoud #define SBIC_TXCOUNT2 0x13 /* RW Transfer count */
194 1.1 reinoud #define SBIC_TXCOUNT3 0x14 /* RW Transfer count LSB */
195 1.1 reinoud #define SBIC_DESTID 0x15 /* RW SCC DPD 0 0 0 DI2 DI1 DI0 */
196 1.1 reinoud #define SBIC_SOURCEID 0x16 /* RW ER ES DSP 0 SIV SI2 SI1 SI0 */
197 1.1 reinoud #define SBIC_SCSISTAT 0x17 /* RO **Interrupt type*** **Int. qualifier** */
198 1.1 reinoud #define SBIC_COMMAND 0x18 /* RW SBT *********Command code************* */
199 1.1 reinoud #define SBIC_DATA 0x19 /* RW Access to data i/o FIFO for polled use */
200 1.1 reinoud
201 1.1 reinoud #define SBIC_ADDRREG 0x00
202 1.1 reinoud #define SBIC_DATAREG 0x04
203 1.1 reinoud #define SBIC_AUX_STATUS 0x00
204 1.1 reinoud
205 1.1 reinoud /*
206 1.1 reinoud * My ID register, and/or CDB Size
207 1.1 reinoud */
208 1.1 reinoud
209 1.1 reinoud #define SBIC_ID_FS_8_10 0x00 /* Input clock is 8-10 Mhz */
210 1.1 reinoud /* 11 Mhz is invalid */
211 1.1 reinoud #define SBIC_ID_FS_12_15 0x40 /* Input clock is 12-15 Mhz */
212 1.1 reinoud #define SBIC_ID_FS_16_20 0x80 /* Input clock is 16-20 Mhz */
213 1.1 reinoud #define SBIC_ID_EHP 0x10 /* Enable host parity */
214 1.1 reinoud #define SBIC_ID_EAF 0x08 /* Enable Advanced Features */
215 1.1 reinoud #define SBIC_ID_MASK 0x07
216 1.1 reinoud #define SBIC_ID_CBDSIZE_MASK 0x0f /* if unk SCSI cmd group */
217 1.1 reinoud
218 1.1 reinoud /*
219 1.1 reinoud * Control register
220 1.1 reinoud */
221 1.1 reinoud
222 1.1 reinoud #define SBIC_CTL_DMA 0x80 /* Single byte dma */
223 1.1 reinoud #define SBIC_CTL_DBA_DMA 0x40 /* direct buffer acces (bus master)*/
224 1.1 reinoud #define SBIC_CTL_BURST_DMA 0x20 /* continuous mode (8237) */
225 1.1 reinoud #define SBIC_CTL_NO_DMA 0x00 /* Programmed I/O */
226 1.1 reinoud #define SBIC_CTL_HHP 0x10 /* Halt on host parity error */
227 1.1 reinoud #define SBIC_CTL_EDI 0x08 /* Ending disconnect interrupt */
228 1.1 reinoud #define SBIC_CTL_IDI 0x04 /* Intermediate disconnect interrupt*/
229 1.1 reinoud #define SBIC_CTL_HA 0x02 /* Halt on ATN */
230 1.1 reinoud #define SBIC_CTL_HSP 0x01 /* Halt on SCSI parity error */
231 1.1 reinoud
232 1.1 reinoud /*
233 1.1 reinoud * Destination ID register
234 1.1 reinoud */
235 1.1 reinoud
236 1.1 reinoud #define SBIC_DID_DPD 0x40 /* Data Phase Direction */
237 1.1 reinoud
238 1.1 reinoud /*
239 1.1 reinoud * Auxiliary Status Register
240 1.1 reinoud */
241 1.1 reinoud
242 1.1 reinoud #define SBIC_ASR_INT 0x80 /* Interrupt pending */
243 1.1 reinoud #define SBIC_ASR_LCI 0x40 /* Last command ignored */
244 1.1 reinoud #define SBIC_ASR_BSY 0x20 /* Busy, only cmd/data/asr readable */
245 1.1 reinoud #define SBIC_ASR_CIP 0x10 /* Busy, cmd unavail also */
246 1.1 reinoud #define SBIC_ASR_xxx 0x0c
247 1.1 reinoud #define SBIC_ASR_PE 0x02 /* Parity error (even) */
248 1.1 reinoud #define SBIC_ASR_DBR 0x01 /* Data Buffer Ready */
249 1.1 reinoud
250 1.1 reinoud /* DMAC constants */
251 1.1 reinoud
252 1.1 reinoud #define DMAC_Bits 0x01
253 1.1 reinoud #define DMAC_Ctrl1 0x60
254 1.1 reinoud #define DMAC_Ctrl2 0x01
255 1.1 reinoud #define DMAC_CLEAR_MASK 0x0E
256 1.1 reinoud #define DMAC_SET_MASK 0x0F
257 1.1 reinoud #define DMAC_DMA_RD_MODE 0x04
258 1.1 reinoud #define DMAC_DMA_WR_MODE 0x08
259 1.1 reinoud
260 1.1 reinoud /* DMAC registers */
261 1.1 reinoud
262 1.1 reinoud #define DMAC_INITIALISE 0x0000 /* WO ---- ---- ---- ---- ---- ---- 16B RES */
263 1.1 reinoud #define DMAC_CHANNEL 0x0200 /* R ---- ---- ---- BASE SEL3 SEL2 SEL1 SEL0 */
264 1.1 reinoud /* W ---- ---- ---- ---- ---- BASE *SELECT** */
265 1.1 reinoud #define DMAC_TXCNTLO 0x0004 /* RW C7 C6 C5 C4 C3 C2 C1 C0 */
266 1.1 reinoud #define DMAC_TXCNTHI 0x0204 /* RW C15 C14 C13 C12 C11 C10 C9 C8 */
267 1.1 reinoud #define DMAC_TXADRLO 0x0008 /* RW A7 A6 A5 A4 A3 A2 A1 A0 */
268 1.1 reinoud #define DMAC_TXADRMD 0x0208 /* RW A15 A14 A13 A12 A11 A10 A9 A8 */
269 1.1 reinoud #define DMAC_TXADRHI 0x000C /* RW A23 A22 A21 A20 A19 A18 A17 A16 */
270 1.1 reinoud #define DMAC_DEVCON1 0x0010 /* RW AKL RQL EXW ROT CMP DDMA AHLD MTM */
271 1.1 reinoud #define DMAC_DEVCON2 0x0210 /* RW ---- ---- ---- ---- ---- ---- WEV BHLD */
272 1.1 reinoud #define DMAC_MODECON 0x0014 /* RW **TMODE** ADIR AUTI **TDIR*** ---- WORD */
273 1.1 reinoud #define DMAC_STATUS 0x0214 /* RO RQ3 RQ2 RQ1 RQ0 TC3 TC2 TC1 TC0 */
274 1.1 reinoud #if 0
275 1.1 reinoud templo = dmac + 0x0018;/* RO T7 T6 T5 T4 T3 T2 T1 T0 */
276 1.1 reinoud temphi = dmac + 0x0218;/* RO T15 T14 T13 T12 T11 T10 T9 T8 */
277 1.1 reinoud #endif
278 1.1 reinoud #define DMAC_REQREG 0x001C /* RW ---- ---- ---- ---- SRQ3 SRQ2 SRQ1 SRQ0 */
279 1.1 reinoud #define DMAC_MASKREG 0x021C /* RW ---- ---- ---- ---- M3 M2 M1 M0 */
280 1.1 reinoud
281 1.1 reinoud #ifndef _LOCORE
282 1.1 reinoud #define WriteSBIC(a, d) \
283 1.1 reinoud WriteByte(sbic_base + SBIC_ADDRREG, a); \
284 1.1 reinoud WriteByte(sbic_base + SBIC_DATAREG, d);
285 1.1 reinoud
286 1.1 reinoud /*
287 1.1 reinoud #define ReadSBIC(a) \
288 1.1 reinoud (WriteByte(sbic_base, a), ReadWord(sbic_base + 4) & 0xff)
289 1.1 reinoud */
290 1.1 reinoud #define ReadSBIC(a) \
291 1.1 reinoud ReadSBIC1(sbic_base, a)
292 1.1 reinoud
293 1.1 reinoud
294 1.1 reinoud static __inline int
295 1.1 reinoud ReadSBIC1(sbic_base, a)
296 1.1 reinoud u_int sbic_base;
297 1.1 reinoud int a;
298 1.1 reinoud {
299 1.1 reinoud WriteByte(sbic_base + SBIC_ADDRREG, a);
300 1.1 reinoud return(ReadByte(sbic_base + SBIC_DATAREG));
301 1.1 reinoud }
302 1.1 reinoud
303 1.1 reinoud
304 1.1 reinoud #define WriteDMAC(a, d) WriteByte(dmac_base + a, d)
305 1.1 reinoud #define ReadDMAC(a) ReadByte(dmac_base + a)
306 1.1 reinoud #endif
307 1.1 reinoud
308 1.1 reinoud
309 1.1 reinoud #endif
310 1.1 reinoud #endif /* _ASCREG_H_ */
311