osiopreg.h Source File

Back to the index.

osiopreg.h
Go to the documentation of this file.
1 /* $OpenBSD: osiopreg.h,v 1.5 2005/11/21 21:52:47 miod Exp $ */
2 /* $NetBSD: osiopreg.h,v 1.1 2001/04/30 04:47:51 tsutsui Exp $ */
3 
4 /*
5  * Copyright (c) 1990 The Regents of the University of California.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * Van Jacobson of Lawrence Berkeley Laboratory.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  * may be used to endorse or promote products derived from this software
21  * without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  * @(#)siopreg.h 7.3 (Berkeley) 2/5/91
36  */
37 
38 /*
39  * NCR 53C710 SCSI interface hardware description.
40  *
41  * From the Mach scsi driver for the 53C710 and amiga siop driver
42  */
43 
44 /* GXemul: little-endian is used here, and swapped at runtime instead! */
45 /* byte lane definitions */
46 /* #if BYTE_ORDER == LITTLE_ENDIAN */
47 #define BL0 0
48 #define BL1 1
49 #define BL2 2
50 #define BL3 3
51 /* #else */
52 /* #define BL0 3 */
53 /* #define BL1 2 */
54 /* #define BL2 1 */
55 /* #define BL3 0 */
56 /* #endif */
57 
58 #define OSIOP_SCNTL0 (0x00+BL0) /* rw: SCSI control reg 0 */
59 #define OSIOP_SCNTL1 (0x00+BL1) /* rw: SCSI control reg 1 */
60 #define OSIOP_SDID (0x00+BL2) /* rw: SCSI destination ID */
61 #define OSIOP_SIEN (0x00+BL3) /* rw: SCSI interrupt enable */
62 
63 #define OSIOP_SCID (0x04+BL0) /* rw: SCSI Chip ID reg */
64 #define OSIOP_SXFER (0x04+BL1) /* rw: SCSI Transfer reg */
65 #define OSIOP_SODL (0x04+BL2) /* rw: SCSI Output Data Latch */
66 #define OSIOP_SOCL (0x04+BL3) /* rw: SCSI Output Control Latch */
67 
68 #define OSIOP_SFBR (0x08+BL0) /* ro: SCSI First Byte Received */
69 #define OSIOP_SIDL (0x08+BL1) /* ro: SCSI Input Data Latch */
70 #define OSIOP_SBDL (0x08+BL2) /* ro: SCSI Bus Data Lines */
71 #define OSIOP_SBCL (0x08+BL3) /* rw: SCSI Bus Control Lines */
72 
73 #define OSIOP_DSTAT (0x0c+BL0) /* ro: DMA status */
74 #define OSIOP_SSTAT0 (0x0c+BL1) /* ro: SCSI status reg 0 */
75 #define OSIOP_SSTAT1 (0x0c+BL2) /* ro: SCSI status reg 1 */
76 #define OSIOP_SSTAT2 (0x0c+BL3) /* ro: SCSI status reg 2 */
77 
78 #define OSIOP_DSA 0x10 /* rw: Data Structure Address */
79 
80 #define OSIOP_CTEST0 (0x14+BL0) /* ro: Chip test register 0 */
81 #define OSIOP_CTEST1 (0x14+BL1) /* ro: Chip test register 1 */
82 #define OSIOP_CTEST2 (0x14+BL2) /* ro: Chip test register 2 */
83 #define OSIOP_CTEST3 (0x14+BL3) /* ro: Chip test register 3 */
84 
85 #define OSIOP_CTEST4 (0x18+BL0) /* rw: Chip test register 4 */
86 #define OSIOP_CTEST5 (0x18+BL1) /* rw: Chip test register 5 */
87 #define OSIOP_CTEST6 (0x18+BL2) /* rw: Chip test register 6 */
88 #define OSIOP_CTEST7 (0x18+BL3) /* rw: Chip test register 7 */
89 
90 #define OSIOP_TEMP 0x1c /* rw: Temporary Stack reg */
91 
92 #define OSIOP_DFIFO (0x20+BL0) /* rw: DMA FIFO */
93 #define OSIOP_ISTAT (0x20+BL1) /* rw: Interrupt Status reg */
94 #define OSIOP_CTEST8 (0x20+BL2) /* rw: Chip test register 8 */
95 #define OSIOP_LCRC (0x20+BL3) /* rw: LCRC value */
96 
97 #define OSIOP_DBC 0x24 /* rw: DMA Counter reg (longword) */
98 #define OSIOP_DBC0 (0x24+BL0) /* rw: DMA Byte Counter reg 0 */
99 #define OSIOP_DBC1 (0x24+BL1) /* rw: DMA Byte Counter reg 1 */
100 #define OSIOP_DBC2 (0x24+BL2) /* rw: DMA Byte Counter reg 2 */
101 #define OSIOP_DCMD (0x24+BL3) /* rw: DMA Command Register */
102 
103 #define OSIOP_DNAD 0x28 /* rw: DMA Next Data Address */
104 
105 #define OSIOP_DSP 0x2c /* rw: DMA SCRIPTS Pointer reg */
106 
107 #define OSIOP_DSPS 0x30 /* rw: DMA SCRIPTS Pointer Save reg */
108 
109 #define OSIOP_SCRATCH 0x34 /* rw: Scratch register */
110 
111 #define OSIOP_DMODE (0x38+BL0) /* rw: DMA Mode reg */
112 #define OSIOP_DIEN (0x38+BL1) /* rw: DMA Interrupt Enable */
113 #define OSIOP_DWT (0x38+BL2) /* rw: DMA Watchdog Timer */
114 #define OSIOP_DCNTL (0x38+BL3) /* rw: DMA Control reg */
115 
116 #define OSIOP_ADDER 0x3c /* ro: Adder Sum Output */
117 
118 #define OSIOP_NREGS 0x40
119 
120 
121 /*
122  * Register defines
123  */
124 
125 /* Scsi control register 0 (scntl0) */
126 
127 #define OSIOP_SCNTL0_ARB 0xc0 /* Arbitration mode */
128 #define OSIOP_ARB_SIMPLE 0x00
129 #define OSIOP_ARB_FULL 0xc0
130 #define OSIOP_SCNTL0_START 0x20 /* Start Sequence */
131 #define OSIOP_SCNTL0_WATN 0x10 /* (Select) With ATN */
132 #define OSIOP_SCNTL0_EPC 0x08 /* Enable Parity Checking */
133 #define OSIOP_SCNTL0_EPG 0x04 /* Enable Parity Generation */
134 #define OSIOP_SCNTL0_AAP 0x02 /* Assert ATN on Parity Error */
135 #define OSIOP_SCNTL0_TRG 0x01 /* Target Mode */
136 
137 /* Scsi control register 1 (scntl1) */
138 
139 #define OSIOP_SCNTL1_EXC 0x80 /* Extra Clock Cycle of data setup */
140 #define OSIOP_SCNTL1_ADB 0x40 /* Assert Data Bus */
141 #define OSIOP_SCNTL1_ESR 0x20 /* Enable Selection/Reselection */
142 #define OSIOP_SCNTL1_CON 0x10 /* Connected */
143 #define OSIOP_SCNTL1_RST 0x08 /* Assert RST */
144 #define OSIOP_SCNTL1_AESP 0x04 /* Assert even SCSI parity */
145 #define OSIOP_SCNTL1_PAR 0x04 /* Force bad Parity */
146 #define OSIOP_SCNTL1_RES0 0x02 /* Reserved */
147 #define OSIOP_SCNTL1_RES1 0x01 /* Reserved */
148 
149 /* Scsi interrupt enable register (sien) */
150 
151 #define OSIOP_SIEN_M_A 0x80 /* Phase Mismatch or ATN active */
152 #define OSIOP_SIEN_FCMP 0x40 /* Function Complete */
153 #define OSIOP_SIEN_STO 0x20 /* (Re)Selection timeout */
154 #define OSIOP_SIEN_SEL 0x10 /* (Re)Selected */
155 #define OSIOP_SIEN_SGE 0x08 /* SCSI Gross Error */
156 #define OSIOP_SIEN_UDC 0x04 /* Unexpected Disconnect */
157 #define OSIOP_SIEN_RST 0x02 /* RST asserted */
158 #define OSIOP_SIEN_PAR 0x01 /* Parity Error */
159 
160 /* Scsi chip ID (scid) */
161 
162 #define OSIOP_SCID_VALUE(i) (1 << (i))
163 
164 /* Scsi transfer register (sxfer) */
165 
166 #define OSIOP_SXFER_DHP 0x80 /* Disable Halt on Parity error/
167  ATN asserted */
168 #define OSIOP_SXFER_TP 0x70 /* Synch Transfer Period */
169  /* see specs for formulas:
170  Period = TCP * (4 + XFERP )
171  TCP = 1 + CLK + 1..2;
172  */
173 #define OSIOP_SXFER_MO 0x0f /* Synch Max Offset */
174 #define OSIOP_MAX_OFFSET 8
175 
176 /* Scsi output data latch register (sodl) */
177 
178 /* Scsi output control latch register (socl) */
179 
180 #define OSIOP_REQ 0x80 /* SCSI signal <x> asserted */
181 #define OSIOP_ACK 0x40
182 #define OSIOP_BSY 0x20
183 #define OSIOP_SEL 0x10
184 #define OSIOP_ATN 0x08
185 #define OSIOP_MSG 0x04
186 #define OSIOP_CD 0x02
187 #define OSIOP_IO 0x01
188 
189 #define OSIOP_PHASE(x) ((x) & (OSIOP_MSG|OSIOP_CD|OSIOP_IO))
190 #define DATA_OUT_PHASE 0x00
191 #define DATA_IN_PHASE OSIOP_IO
192 #define COMMAND_PHASE OSIOP_CD
193 #define STATUS_PHASE (OSIOP_CD|OSIOP_IO)
194 #define MSG_OUT_PHASE (OSIOP_MSG|OSIOP_CD)
195 #define MSG_IN_PHASE (OSIOP_MSG|OSIOP_CD|OSIOP_IO)
196 
197 /* Scsi first byte received register (sfbr) */
198 
199 /* Scsi input data latch register (sidl) */
200 
201 /* Scsi bus data lines register (sbdl) */
202 
203 /* Scsi bus control lines register (sbcl). Same as socl */
204 
205 #define OSIOP_SBCL_SSCF1 0x02 /* wo */
206 #define OSIOP_SBCL_SSCF0 0x01 /* wo */
207 
208 /* DMA status register (dstat) */
209 
210 #define OSIOP_DSTAT_DFE 0x80 /* DMA FIFO empty */
211 #define OSIOP_DSTAT_RES 0x40
212 #define OSIOP_DSTAT_BF 0x20 /* Bus fault */
213 #define OSIOP_DSTAT_ABRT 0x10 /* Aborted */
214 #define OSIOP_DSTAT_SSI 0x08 /* SCRIPT Single Step */
215 #define OSIOP_DSTAT_SIR 0x04 /* SCRIPT Interrupt Instruction */
216 #define OSIOP_DSTAT_WTD 0x02 /* Watchdog Timeout Detected */
217 #define OSIOP_DSTAT_IID 0x01 /* Invalid Instruction Detected */
218 
219 /* Scsi status register 0 (sstat0) */
220 
221 #define OSIOP_SSTAT0_M_A 0x80 /* Phase Mismatch or ATN active */
222 #define OSIOP_SSTAT0_FCMP 0x40 /* Function Complete */
223 #define OSIOP_SSTAT0_STO 0x20 /* (Re)Selection timeout */
224 #define OSIOP_SSTAT0_SEL 0x10 /* (Re)Selected */
225 #define OSIOP_SSTAT0_SGE 0x08 /* SCSI Gross Error */
226 #define OSIOP_SSTAT0_UDC 0x04 /* Unexpected Disconnect */
227 #define OSIOP_SSTAT0_RST 0x02 /* RST asserted */
228 #define OSIOP_SSTAT0_PAR 0x01 /* Parity Error */
229 
230 /* Scsi status register 1 (sstat1) */
231 
232 #define OSIOP_SSTAT1_ILF 0x80 /* Input latch (sidl) full */
233 #define OSIOP_SSTAT1_ORF 0x40 /* output reg (sodr) full */
234 #define OSIOP_SSTAT1_OLF 0x20 /* output latch (sodl) full */
235 #define OSIOP_SSTAT1_AIP 0x10 /* Arbitration in progress */
236 #define OSIOP_SSTAT1_LOA 0x08 /* Lost arbitration */
237 #define OSIOP_SSTAT1_WOA 0x04 /* Won arbitration */
238 #define OSIOP_SSTAT1_RST 0x02 /* SCSI RST current value */
239 #define OSIOP_SSTAT1_SDP 0x01 /* SCSI SDP current value */
240 
241 /* Scsi status register 2 (sstat2) */
242 
243 #define OSIOP_SSTAT2_FF 0xf0 /* SCSI FIFO flags (bytecount) */
244 #define OSIOP_SCSI_FIFO_DEEP 8
245 #define OSIOP_SSTAT2_SDP 0x08 /* Latched (on REQ) SCSI SDP */
246 #define OSIOP_SSTAT2_MSG 0x04 /* Latched SCSI phase */
247 #define OSIOP_SSTAT2_CD 0x02
248 #define OSIOP_SSTAT2_IO 0x01
249 
250 /* Chip test register 0 (ctest0) */
251 
252 #define OSIOP_CTEST0_RES0 0x80
253 #define OSIOP_CTEST0_BTD 0x40 /* Byte-to-byte Timer Disable */
254 #define OSIOP_CTEST0_GRP 0x20 /* Generate Receive Parity */
255 #define OSIOP_CTEST0_EAN 0x10 /* Enable Active Negation */
256 #define OSIOP_CTEST0_HSC 0x08 /* Halt SCSI clock */
257 #define OSIOP_CTEST0_ERF 0x04 /* Extend REQ/ACK Filtering */
258 #define OSIOP_CTEST0_RES1 0x02
259 #define OSIOP_CTEST0_DDIR 0x01 /* Xfer direction (1-> from SCSI bus) */
260 
261 
262 /* Chip test register 1 (ctest1) */
263 
264 #define OSIOP_CTEST1_FMT 0xf0 /* Byte empty in DMA FIFO bottom
265  (high->byte3) */
266 #define OSIOP_CTEST1_FFL 0x0f /* Byte full in DMA FIFO top, same */
267 
268 /* Chip test register 2 (ctest2) */
269 
270 #define OSIOP_CTEST2_RES 0x80
271 #define OSIOP_CTEST2_SIGP 0x40 /* Signal process */
272 #define OSIOP_CTEST2_SOFF 0x20 /* Synch Offset compare
273  (1-> zero Init, max Tgt */
274 #define OSIOP_CTEST2_SFP 0x10 /* SCSI FIFO Parity */
275 #define OSIOP_CTEST2_DFP 0x08 /* DMA FIFO Parity */
276 #define OSIOP_CTEST2_TEOP 0x04 /* True EOP (a-la 5380) */
277 #define OSIOP_CTEST2_DREQ 0x02 /* DREQ status */
278 #define OSIOP_CTEST2_DACK 0x01 /* DACK status */
279 
280 /* Chip test register 3 (ctest3) read-only, top of SCSI FIFO */
281 
282 /* Chip test register 4 (ctest4) */
283 
284 #define OSIOP_CTEST4_MUX 0x80 /* Host bus multiplex mode */
285 #define OSIOP_CTEST4_ZMOD 0x40 /* High-impedance outputs */
286 #define OSIOP_CTEST4_SZM 0x20 /* ditto, SCSI "outputs" */
287 #define OSIOP_CTEST4_SLBE 0x10 /* SCSI loopback enable */
288 #define OSIOP_CTEST4_SFWR 0x08 /* SCSI FIFO write enable (from sodl) */
289 #define OSIOP_CTEST4_FBL 0x07 /* DMA FIFO Byte Lane select
290  (from ctest6) 4->0, .. 7->3 */
291 
292 /* Chip test register 5 (ctest5) */
293 
294 #define OSIOP_CTEST5_ADCK 0x80 /* Clock Address Incrementor */
295 #define OSIOP_CTEST5_BBCK 0x40 /* Clock Byte counter */
296 #define OSIOP_CTEST5_ROFF 0x20 /* Reset SCSI offset */
297 #define OSIOP_CTEST5_MASR 0x10 /* Master set/reset pulses
298  (of bits 3-0) */
299 #define OSIOP_CTEST5_DDIR 0x08 /* (re)set internal DMA direction */
300 #define OSIOP_CTEST5_EOP 0x04 /* (re)set internal EOP */
301 #define OSIOP_CTEST5_DREQ 0x02 /* (re)set internal REQ */
302 #define OSIOP_CTEST5_DACK 0x01 /* (re)set internal ACK */
303 
304 /* Chip test register 6 (ctest6) DMA FIFO access */
305 
306 /* Chip test register 7 (ctest7) */
307 
308 #define OSIOP_CTEST7_CDIS 0x80 /* Cache burst disable */
309 #define OSIOP_CTEST7_SC1 0x40 /* Snoop control 1 */
310 #define OSIOP_CTEST7_SC0 0x20 /* Snoop control 0 */
311 #define OSIOP_CTEST7_STD 0x10 /* Selection timeout disable */
312 #define OSIOP_CTEST7_DFP 0x08 /* DMA FIFO parity bit */
313 #define OSIOP_CTEST7_EVP 0x04 /* Even parity (to host bus) */
314 #define OSIOP_CTEST7_TT1 0x02 /* Transfer type bit */
315 #define OSIOP_CTEST7_DIFF 0x01 /* Differential mode */
316 
317 /* DMA FIFO register (dfifo) */
318 
319 #define OSIOP_DFIFO_FLF 0x80 /* Flush (spill) DMA FIFO */
320 #define OSIOP_DFIFO_BO 0x7f /* FIFO byte offset counter */
321 
322 /* Interrupt status register (istat) */
323 
324 #define OSIOP_ISTAT_ABRT 0x80 /* Abort operation */
325 #define OSIOP_ISTAT_RST 0x40 /* Software reset */
326 #define OSIOP_ISTAT_SIGP 0x20 /* Signal process */
327 #define OSIOP_ISTAT_RES 0x10
328 #define OSIOP_ISTAT_CON 0x08 /* Connected */
329 #define OSIOP_ISTAT_RES1 0x04
330 #define OSIOP_ISTAT_SIP 0x02 /* SCSI Interrupt pending */
331 #define OSIOP_ISTAT_DIP 0x01 /* DMA Interrupt pending */
332 
333 /* Chip test register 8 (ctest8) */
334 
335 #define OSIOP_CTEST8_V 0xf0 /* Chip revision level */
336 #define OSIOP_CTEST8_FLF 0x08 /* Flush DMA FIFO */
337 #define OSIOP_CTEST8_CLF 0x04 /* Clear DMA and SCSI FIFOs */
338 #define OSIOP_CTEST8_FM 0x02 /* Fetch pin mode */
339 #define OSIOP_CTEST8_SM 0x01 /* Snoop pins mode */
340 
341 /* DMA Mode register (dmode) */
342 
343 #define OSIOP_DMODE_BL_MASK 0xc0 /* DMA burst length */
344 #define OSIOP_DMODE_BL8 0xc0 /* 8 bytes */
345 #define OSIOP_DMODE_BL4 0x80 /* 4 bytes */
346 #define OSIOP_DMODE_BL2 0x40 /* 2 bytes */
347 #define OSIOP_DMODE_BL1 0x00 /* 1 byte */
348 #define OSIOP_DMODE_FC 0x30 /* Function code */
349 #define OSIOP_DMODE_PD 0x08 /* Program/data */
350 #define OSIOP_DMODE_FAM 0x04 /* fixed address mode */
351 #define OSIOP_DMODE_U0 0x02 /* User programmable transfer type */
352 #define OSIOP_DMODE_MAN 0x01 /* SCRIPTS in Manual start mode */
353 
354 /* DMA interrupt enable register (dien) */
355 
356 #define OSIOP_DIEN_RES 0xc0
357 #define OSIOP_DIEN_BF 0x20 /* On Bus Fault */
358 #define OSIOP_DIEN_ABRT 0x10 /* On Abort */
359 #define OSIOP_DIEN_SSI 0x08 /* On SCRIPTS sstep */
360 #define OSIOP_DIEN_SIR 0x04 /* On SCRIPTS intr instruction */
361 #define OSIOP_DIEN_WTD 0x02 /* On watchdog timeout */
362 #define OSIOP_DIEN_IID 0x01 /* On illegal instruction detected */
363 
364 /* DMA control register (dcntl) */
365 
366 #define OSIOP_DCNTL_CF_MASK 0xc0 /* Clock frequency dividers: */
367 #define OSIOP_DCNTL_CF_2 0x00 /* 0 --> 37.51..50.00 MHz, div=2 */
368 #define OSIOP_DCNTL_CF_1_5 0x40 /* 1 --> 25.01..37.50 MHz, div=1.5 */
369 #define OSIOP_DCNTL_CF_1 0x80 /* 2 --> 16.67..25.00 MHz, div=1 */
370 #define OSIOP_DCNTL_CF_3 0xc0 /* 3 --> 50.01..66.67 MHz, div=3 */
371 #define OSIOP_DCNTL_EA 0x20 /* Enable ACK */
372 #define OSIOP_DCNTL_SSM 0x10 /* Single step mode */
373 #define OSIOP_DCNTL_LLM 0x08 /* Enable SCSI Low-level mode */
374 #define OSIOP_DCNTL_STD 0x04 /* Start DMA operation */
375 #define OSIOP_DCNTL_FA 0x02 /* Fast arbitration */
376 #define OSIOP_DCNTL_COM 0x01 /* 53C700 Compatibility */

Generated on Sun Sep 30 2018 16:05:18 for GXemul by doxygen 1.8.13