siopreg.h revision 1.5 1 1.5 cgd /* $NetBSD: siopreg.h,v 1.5 1994/10/26 02:04:58 cgd Exp $ */
2 1.5 cgd
3 1.1 mw /*
4 1.1 mw * Copyright (c) 1990 The Regents of the University of California.
5 1.1 mw * All rights reserved.
6 1.1 mw *
7 1.1 mw * This code is derived from software contributed to Berkeley by
8 1.1 mw * Van Jacobson of Lawrence Berkeley Laboratory.
9 1.1 mw *
10 1.1 mw * Redistribution and use in source and binary forms, with or without
11 1.1 mw * modification, are permitted provided that the following conditions
12 1.1 mw * are met:
13 1.1 mw * 1. Redistributions of source code must retain the above copyright
14 1.1 mw * notice, this list of conditions and the following disclaimer.
15 1.1 mw * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 mw * notice, this list of conditions and the following disclaimer in the
17 1.1 mw * documentation and/or other materials provided with the distribution.
18 1.1 mw * 3. All advertising materials mentioning features or use of this software
19 1.1 mw * must display the following acknowledgement:
20 1.1 mw * This product includes software developed by the University of
21 1.1 mw * California, Berkeley and its contributors.
22 1.1 mw * 4. Neither the name of the University nor the names of its contributors
23 1.1 mw * may be used to endorse or promote products derived from this software
24 1.1 mw * without specific prior written permission.
25 1.1 mw *
26 1.1 mw * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.1 mw * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.1 mw * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.1 mw * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.1 mw * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.1 mw * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.1 mw * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 mw * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 mw * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 mw * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 mw * SUCH DAMAGE.
37 1.1 mw *
38 1.2 chopps * @(#)siopreg.h 7.3 (Berkeley) 2/5/91
39 1.1 mw */
40 1.1 mw
41 1.1 mw /*
42 1.1 mw * NCR 53C710 SCSI interface hardware description.
43 1.1 mw *
44 1.2 chopps * Using parts of the Mach scsi driver for the 53C700
45 1.1 mw */
46 1.1 mw
47 1.1 mw typedef struct {
48 1.1 mw volatile unsigned char siop_sien; /* rw: SCSI Interrupt Enable */
49 1.1 mw volatile unsigned char siop_sdid; /* rw: SCSI Destination ID */
50 1.1 mw volatile unsigned char siop_scntl1; /* rw: SCSI control reg 1 */
51 1.1 mw volatile unsigned char siop_scntl0; /* rw: SCSI control reg 0 */
52 1.1 mw volatile unsigned char siop_socl; /* rw: SCSI Output Control Latch */
53 1.1 mw volatile unsigned char siop_sodl; /* rw: SCSI Output Data Latch */
54 1.1 mw volatile unsigned char siop_sxfer; /* rw: SCSI Transfer reg */
55 1.1 mw volatile unsigned char siop_scid; /* rw: SCSI Chip ID reg */
56 1.1 mw volatile unsigned char siop_sbcl; /* ro: SCSI Bus Control Lines */
57 1.1 mw volatile unsigned char siop_sbdl; /* ro: SCSI Bus Data Lines */
58 1.1 mw volatile unsigned char siop_sidl; /* ro: SCSI Input Data Latch */
59 1.1 mw volatile unsigned char siop_sfbr; /* ro: SCSI First Byte Received */
60 1.1 mw volatile unsigned char siop_sstat2; /* ro: SCSI status reg 2 */
61 1.1 mw volatile unsigned char siop_sstat1; /* ro: SCSI status reg 1 */
62 1.1 mw volatile unsigned char siop_sstat0; /* ro: SCSI status reg 0 */
63 1.1 mw volatile unsigned char siop_dstat; /* ro: DMA status */
64 1.1 mw volatile unsigned long siop_dsa; /* rw: Data Structure Address */
65 1.1 mw volatile unsigned char siop_ctest3; /* ro: Chip test register 3 */
66 1.1 mw volatile unsigned char siop_ctest2; /* ro: Chip test register 2 */
67 1.1 mw volatile unsigned char siop_ctest1; /* ro: Chip test register 1 */
68 1.1 mw volatile unsigned char siop_ctest0; /* ro: Chip test register 0 */
69 1.1 mw volatile unsigned char siop_ctest7; /* rw: Chip test register 7 */
70 1.1 mw volatile unsigned char siop_ctest6; /* rw: Chip test register 6 */
71 1.1 mw volatile unsigned char siop_ctest5; /* rw: Chip test register 5 */
72 1.1 mw volatile unsigned char siop_ctest4; /* rw: Chip test register 4 */
73 1.1 mw volatile unsigned long siop_temp; /* rw: Temporary Stack reg */
74 1.1 mw volatile unsigned char siop_lcrc; /* rw: LCRC value */
75 1.1 mw volatile unsigned char siop_ctest8; /* rw: Chip test register 8 */
76 1.1 mw volatile unsigned char siop_istat; /* rw: Interrupt Status reg */
77 1.1 mw volatile unsigned char siop_dfifo; /* rw: DMA FIFO */
78 1.1 mw volatile unsigned char siop_dcmd; /* rw: DMA Command Register */
79 1.1 mw volatile unsigned char siop_dbc2; /* rw: DMA Byte Counter reg */
80 1.1 mw volatile unsigned char siop_dbc1;
81 1.1 mw volatile unsigned char siop_dbc0;
82 1.1 mw volatile unsigned long siop_dnad; /* rw: DMA Next Address */
83 1.1 mw volatile unsigned long siop_dsp; /* rw: DMA SCRIPTS Pointer reg */
84 1.1 mw volatile unsigned long siop_dsps; /* rw: DMA SCRIPTS Pointer Save reg */
85 1.1 mw volatile unsigned long siop_scratch; /* rw: Scratch Register */
86 1.1 mw volatile unsigned char siop_dcntl; /* rw: DMA Control reg */
87 1.1 mw volatile unsigned char siop_dwt; /* rw: DMA Watchdog Timer */
88 1.1 mw volatile unsigned char siop_dien; /* rw: DMA Interrupt Enable */
89 1.1 mw volatile unsigned char siop_dmode; /* rw: DMA Mode reg */
90 1.1 mw volatile unsigned long siop_addr;
91 1.1 mw
92 1.1 mw } siop_regmap_t;
93 1.4 chopps typedef volatile siop_regmap_t *siop_regmap_p;
94 1.1 mw
95 1.1 mw /*
96 1.1 mw * Register defines
97 1.1 mw */
98 1.1 mw
99 1.1 mw /* Scsi control register 0 (scntl0) */
100 1.1 mw
101 1.1 mw #define SIOP_SCNTL0_ARB 0xc0 /* Arbitration mode */
102 1.1 mw # define SIOP_ARB_SIMPLE 0x00
103 1.1 mw # define SIOP_ARB_FULL 0xc0
104 1.1 mw #define SIOP_SCNTL0_START 0x20 /* Start Sequence */
105 1.1 mw #define SIOP_SCNTL0_WATN 0x10 /* (Select) With ATN */
106 1.1 mw #define SIOP_SCNTL0_EPC 0x08 /* Enable Parity Checking */
107 1.1 mw #define SIOP_SCNTL0_EPG 0x04 /* Enable Parity Generation */
108 1.1 mw #define SIOP_SCNTL0_AAP 0x02 /* Assert ATN on Parity Error */
109 1.1 mw #define SIOP_SCNTL0_TRG 0x01 /* Target Mode */
110 1.1 mw
111 1.1 mw /* Scsi control register 1 (scntl1) */
112 1.1 mw
113 1.1 mw #define SIOP_SCNTL1_EXC 0x80 /* Extra Clock Cycle of data setup */
114 1.1 mw #define SIOP_SCNTL1_ADB 0x40 /* Assert Data Bus */
115 1.1 mw #define SIOP_SCNTL1_ESR 0x20 /* Enable Selection/Reselection */
116 1.1 mw #define SIOP_SCNTL1_CON 0x10 /* Connected */
117 1.1 mw #define SIOP_SCNTL1_RST 0x08 /* Assert RST */
118 1.1 mw #define SIOP_SCNTL1_PAR 0x04 /* Force bad Parity */
119 1.1 mw #define SIOP_SCNTL1_SND 0x02 /* Start Send operation */
120 1.1 mw #define SIOP_SCNTL1_RCV 0x01 /* Start Receive operation */
121 1.1 mw
122 1.1 mw /* Scsi interrupt enable register (sien) */
123 1.1 mw
124 1.1 mw #define SIOP_SIEN_M_A 0x80 /* Phase Mismatch or ATN active */
125 1.1 mw #define SIOP_SIEN_FC 0x40 /* Function Complete */
126 1.1 mw #define SIOP_SIEN_STO 0x20 /* (Re)Selection timeout */
127 1.1 mw #define SIOP_SIEN_SEL 0x10 /* (Re)Selected */
128 1.1 mw #define SIOP_SIEN_SGE 0x08 /* SCSI Gross Error */
129 1.1 mw #define SIOP_SIEN_UDC 0x04 /* Unexpected Disconnect */
130 1.1 mw #define SIOP_SIEN_RST 0x02 /* RST asserted */
131 1.1 mw #define SIOP_SIEN_PAR 0x01 /* Parity Error */
132 1.1 mw
133 1.1 mw /* Scsi chip ID (scid) */
134 1.1 mw
135 1.1 mw #define SIOP_SCID_VALUE(i) (1<<i)
136 1.1 mw
137 1.1 mw /* Scsi transfer register (sxfer) */
138 1.1 mw
139 1.1 mw #define SIOP_SXFER_DHP 0x80 /* Disable Halt on Parity error/ ATN asserted */
140 1.1 mw #define SIOP_SXFER_TP 0x70 /* Synch Transfer Period */
141 1.1 mw /* see specs for formulas:
142 1.1 mw Period = TCP * (4 + XFERP )
143 1.1 mw TCP = 1 + CLK + 1..2;
144 1.1 mw */
145 1.1 mw #define SIOP_SXFER_MO 0x0f /* Synch Max Offset */
146 1.1 mw # define SIOP_MAX_OFFSET 8
147 1.1 mw
148 1.1 mw /* Scsi output data latch register (sodl) */
149 1.1 mw
150 1.1 mw /* Scsi output control latch register (socl) */
151 1.1 mw
152 1.1 mw #define SIOP_REQ 0x80 /* SCSI signal <x> asserted */
153 1.1 mw #define SIOP_ACK 0x40
154 1.1 mw #define SIOP_BSY 0x20
155 1.1 mw #define SIOP_SEL 0x10
156 1.1 mw #define SIOP_ATN 0x08
157 1.1 mw #define SIOP_MSG 0x04
158 1.1 mw #define SIOP_CD 0x02
159 1.1 mw #define SIOP_IO 0x01
160 1.1 mw
161 1.1 mw #define SIOP_PHASE(socl) SCSI_PHASE(socl)
162 1.1 mw
163 1.1 mw /* Scsi first byte received register (sfbr) */
164 1.1 mw
165 1.1 mw /* Scsi input data latch register (sidl) */
166 1.1 mw
167 1.1 mw /* Scsi bus data lines register (sbdl) */
168 1.1 mw
169 1.1 mw /* Scsi bus control lines register (sbcl). Same as socl */
170 1.1 mw
171 1.1 mw /* DMA status register (dstat) */
172 1.1 mw
173 1.1 mw #define SIOP_DSTAT_DFE 0x80 /* DMA FIFO empty */
174 1.1 mw #define SIOP_DSTAT_RES 0x60
175 1.1 mw #define SIOP_DSTAT_ABRT 0x10 /* Aborted */
176 1.1 mw #define SIOP_DSTAT_SSI 0x08 /* SCRIPT Single Step */
177 1.1 mw #define SIOP_DSTAT_SIR 0x04 /* SCRIPT Interrupt Instruction */
178 1.1 mw #define SIOP_DSTAT_WTD 0x02 /* Watchdog Timeout Detected */
179 1.1 mw #define SIOP_DSTAT_OPC 0x01 /* Invalid SCRIPTS Opcode */
180 1.1 mw
181 1.1 mw /* Scsi status register 0 (sstat0) */
182 1.1 mw
183 1.1 mw #define SIOP_SSTAT0_M_A 0x80 /* Phase Mismatch or ATN active */
184 1.1 mw #define SIOP_SSTAT0_FC 0x40 /* Function Complete */
185 1.1 mw #define SIOP_SSTAT0_STO 0x20 /* (Re)Selection timeout */
186 1.1 mw #define SIOP_SSTAT0_SEL 0x10 /* (Re)Selected */
187 1.1 mw #define SIOP_SSTAT0_SGE 0x08 /* SCSI Gross Error */
188 1.1 mw #define SIOP_SSTAT0_UDC 0x04 /* Unexpected Disconnect */
189 1.1 mw #define SIOP_SSTAT0_RST 0x02 /* RST asserted */
190 1.1 mw #define SIOP_SSTAT0_PAR 0x01 /* Parity Error */
191 1.1 mw
192 1.1 mw /* Scsi status register 1 (sstat1) */
193 1.1 mw
194 1.1 mw #define SIOP_SSTAT1_ILF 0x80 /* Input latch (sidl) full */
195 1.1 mw #define SIOP_SSTAT1_ORF 0x40 /* output reg (sodr) full */
196 1.1 mw #define SIOP_SSTAT1_OLF 0x20 /* output latch (sodl) full */
197 1.1 mw #define SIOP_SSTAT1_AIP 0x10 /* Arbitration in progress */
198 1.1 mw #define SIOP_SSTAT1_LOA 0x08 /* Lost arbitration */
199 1.1 mw #define SIOP_SSTAT1_WOA 0x04 /* Won arbitration */
200 1.1 mw #define SIOP_SSTAT1_RST 0x02 /* SCSI RST current value */
201 1.1 mw #define SIOP_SSTAT1_SDP 0x01 /* SCSI SDP current value */
202 1.1 mw
203 1.1 mw /* Scsi status register 2 (sstat2) */
204 1.1 mw
205 1.1 mw #define SIOP_SSTAT2_FF 0xf0 /* SCSI FIFO flags (bytecount) */
206 1.1 mw # define SIOP_SCSI_FIFO_DEEP 8
207 1.1 mw #define SIOP_SSTAT2_SDP 0x08 /* Latched (on REQ) SCSI SDP */
208 1.1 mw #define SIOP_SSTAT2_MSG 0x04 /* Latched SCSI phase */
209 1.1 mw #define SIOP_SSTAT2_CD 0x02
210 1.1 mw #define SIOP_SSTAT2_IO 0x01
211 1.1 mw
212 1.1 mw /* Chip test register 0 (ctest0) */
213 1.1 mw
214 1.1 mw #define SIOP_CTEST0_RES 0xfc
215 1.1 mw #define SIOP_CTEST0_RTRG 0x02 /* Real Target mode */
216 1.1 mw #define SIOP_CTEST0_DDIR 0x01 /* Xfer direction (1-> from SCSI bus) */
217 1.1 mw
218 1.1 mw /* Chip test register 1 (ctest1) */
219 1.1 mw
220 1.1 mw #define SIOP_CTEST1_FMT 0xf0 /* Byte empty in DMA FIFO bottom (high->byte3) */
221 1.1 mw #define SIOP_CTEST1_FFL 0x0f /* Byte full in DMA FIFO top, same */
222 1.1 mw
223 1.1 mw /* Chip test register 2 (ctest2) */
224 1.1 mw
225 1.1 mw #define SIOP_CTEST2_RES 0xc0
226 1.1 mw #define SIOP_CTEST2_SOFF 0x20 /* Synch Offset compare (1-> zero Init, max Tgt */
227 1.1 mw #define SIOP_CTEST2_SFP 0x10 /* SCSI FIFO Parity */
228 1.1 mw #define SIOP_CTEST2_DFP 0x08 /* DMA FIFO Parity */
229 1.1 mw #define SIOP_CTEST2_TEOP 0x04 /* True EOP (a-la 5380) */
230 1.1 mw #define SIOP_CTEST2_DREQ 0x02 /* DREQ status */
231 1.1 mw #define SIOP_CTEST2_DACK 0x01 /* DACK status */
232 1.1 mw
233 1.1 mw /* Chip test register 3 (ctest3) read-only, top of SCSI FIFO */
234 1.1 mw
235 1.1 mw /* Chip test register 4 (ctest4) */
236 1.1 mw
237 1.1 mw #define SIOP_CTEST4_RES 0x80
238 1.1 mw #define SIOP_CTEST4_ZMOD 0x40 /* High-impedance outputs */
239 1.1 mw #define SIOP_CTEST4_SZM 0x20 /* ditto, SCSI "outputs" */
240 1.1 mw #define SIOP_CTEST4_SLBE 0x10 /* SCSI loobpack enable */
241 1.1 mw #define SIOP_CTEST4_SFWR 0x08 /* SCSI FIFO write enable (from sodl) */
242 1.1 mw #define SIOP_CTEST4_FBL 0x07 /* DMA FIFO Byte Lane select (from ctest6)
243 1.1 mw 4->0, .. 7->3 */
244 1.1 mw
245 1.1 mw /* Chip test register 5 (ctest5) */
246 1.1 mw
247 1.1 mw #define SIOP_CTEST5_ADCK 0x80 /* Clock Address Incrementor */
248 1.1 mw #define SIOP_CTEST5_BBCK 0x40 /* Clock Byte counter */
249 1.1 mw #define SIOP_CTEST5_ROFF 0x20 /* Reset SCSI offset */
250 1.1 mw #define SIOP_CTEST5_MASR 0x10 /* Master set/reset pulses (of bits 3-0) */
251 1.1 mw #define SIOP_CTEST5_DDIR 0x08 /* (re)set internal DMA direction */
252 1.1 mw #define SIOP_CTEST5_EOP 0x04 /* (re)set internal EOP */
253 1.1 mw #define SIOP_CTEST5_DREQ 0x02 /* (re)set internal REQ */
254 1.1 mw #define SIOP_CTEST5_DACK 0x01 /* (re)set internal ACK */
255 1.1 mw
256 1.1 mw /* Chip test register 6 (ctest6) DMA FIFO access */
257 1.1 mw
258 1.1 mw /* Chip test register 7 (ctest7) */
259 1.1 mw
260 1.1 mw #define SIOP_CTEST7_RES 0xe0
261 1.1 mw #define SIOP_CTEST7_STD 0x10 /* Disable selection timeout */
262 1.1 mw #define SIOP_CTEST7_DFP 0x08 /* DMA FIFO parity bit */
263 1.1 mw #define SIOP_CTEST7_EVP 0x04 /* Even parity (to host bus) */
264 1.1 mw #define SIOP_CTEST7_DC 0x02 /* Drive DC pin low on SCRIPT fetches */
265 1.1 mw #define SIOP_CTEST7_DIFF 0x01 /* Differential mode */
266 1.1 mw
267 1.1 mw /* DMA FIFO register (dfifo) */
268 1.1 mw
269 1.1 mw #define SIOP_DFIFO_FLF 0x80 /* Flush (spill) DMA FIFO */
270 1.1 mw #define SIOP_DFIFO_CLF 0x40 /* Clear DMA and SCSI FIFOs */
271 1.1 mw #define SIOP_DFIFO_BO 0x3f /* FIFO byte offset counter */
272 1.1 mw
273 1.1 mw /* Interrupt status register (istat) */
274 1.1 mw
275 1.1 mw #define SIOP_ISTAT_ABRT 0x80 /* Abort operation */
276 1.1 mw #define SIOP_ISTAT_RES 0x70
277 1.1 mw #define SIOP_ISTAT_CON 0x08 /* Connected */
278 1.1 mw #define SIOP_ISTAT_PRE 0x04 /* Pointer register empty */
279 1.1 mw #define SIOP_ISTAT_SIP 0x02 /* SCSI Interrupt pending */
280 1.1 mw #define SIOP_ISTAT_DIP 0x01 /* DMA Interrupt pending */
281 1.1 mw
282 1.1 mw
283 1.1 mw /* DMA Mode register (dmode) */
284 1.1 mw
285 1.1 mw #define SIOP_DMODE_BL_MASK 0xc0 /* 0->1 1->2 2->4 3->8 */
286 1.1 mw #define SIOP_DMODE_BW16 0x20 /* Bus Width is 16 bits */
287 1.1 mw #define SIOP_DMODE_286 0x10 /* 286 mode */
288 1.1 mw #define SIOP_DMODE_IO_M 0x08 /* xfer data to memory or I/O space */
289 1.1 mw #define SIOP_DMODE_FAM 0x04 /* fixed address mode */
290 1.1 mw #define SIOP_DMODE_PIPE 0x02 /* SCRIPTS in Pipeline mode */
291 1.1 mw #define SIOP_DMODE_MAN 0x01 /* SCRIPTS in Manual start mode */
292 1.1 mw
293 1.1 mw /* DMA interrupt enable register (dien) */
294 1.1 mw
295 1.1 mw #define SIOP_DIEN_RES 0xe0
296 1.1 mw #define SIOP_DIEN_ABRT 0x10 /* On Abort */
297 1.1 mw #define SIOP_DIEN_SSI 0x08 /* On SCRIPTS sstep */
298 1.1 mw #define SIOP_DIEN_SIR 0x04 /* On SCRIPTS intr instruction */
299 1.1 mw #define SIOP_DIEN_WTD 0x02 /* On watchdog timeout */
300 1.1 mw #define SIOP_DIEN_OPC 0x01 /* On SCRIPTS illegal opcode */
301 1.1 mw
302 1.1 mw /* DMA control register (dcntl) */
303 1.1 mw
304 1.1 mw #define SIOP_DCNTL_CF_MASK 0xc0 /* Clock frequency dividers:
305 1.1 mw 0 --> 37.51..50.00 Mhz, div=2
306 1.1 mw 1 --> 25.01..37.50 Mhz, div=1.5
307 1.1 mw 2 --> 16.67..25.00 Mhz, div=1
308 1.4 chopps 3 --> 50.01..66.00 Mhz, div=3
309 1.1 mw */
310 1.1 mw #define SIOP_DCNTL_S16 0x20 /* SCRIPTS fetches 16bits at a time */
311 1.1 mw #define SIOP_DCNTL_SSM 0x10 /* Single step mode */
312 1.1 mw #define SIOP_DCNTL_LLM 0x08 /* Enable Low-level mode */
313 1.1 mw #define SIOP_DCNTL_STD 0x04 /* Start SCRIPTS operation */
314 1.1 mw #define SIOP_DCNTL_RES 0x02
315 1.1 mw #define SIOP_DCNTL_RST 0x01 /* Software reset */
316