siireg.h revision 1.2 1 1.2 ad /* $NetBSD: siireg.h,v 1.2 2006/07/29 19:10:57 ad Exp $ */
2 1.2 ad
3 1.2 ad /*
4 1.2 ad * Copyright (c) 1992, 1993
5 1.2 ad * The Regents of the University of California. All rights reserved.
6 1.2 ad *
7 1.2 ad * This code is derived from software contributed to Berkeley by
8 1.2 ad * Ralph Campbell.
9 1.2 ad *
10 1.2 ad * Redistribution and use in source and binary forms, with or without
11 1.2 ad * modification, are permitted provided that the following conditions
12 1.2 ad * are met:
13 1.2 ad * 1. Redistributions of source code must retain the above copyright
14 1.2 ad * notice, this list of conditions and the following disclaimer.
15 1.2 ad * 2. Redistributions in binary form must reproduce the above copyright
16 1.2 ad * notice, this list of conditions and the following disclaimer in the
17 1.2 ad * documentation and/or other materials provided with the distribution.
18 1.2 ad * 3. Neither the name of the University nor the names of its contributors
19 1.2 ad * may be used to endorse or promote products derived from this software
20 1.2 ad * without specific prior written permission.
21 1.2 ad *
22 1.2 ad * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 1.2 ad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.2 ad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.2 ad * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 1.2 ad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.2 ad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.2 ad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.2 ad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.2 ad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.2 ad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.2 ad * SUCH DAMAGE.
33 1.2 ad *
34 1.2 ad * @(#)siireg.h 8.1 (Berkeley) 6/10/93
35 1.2 ad *
36 1.2 ad * sii.h --
37 1.2 ad *
38 1.2 ad * SII registers.
39 1.2 ad *
40 1.2 ad * Copyright (C) 1989 Digital Equipment Corporation.
41 1.2 ad * Permission to use, copy, modify, and distribute this software and
42 1.2 ad * its documentation for any purpose and without fee is hereby granted,
43 1.2 ad * provided that the above copyright notice appears in all copies.
44 1.2 ad * Digital Equipment Corporation makes no representations about the
45 1.2 ad * suitability of this software for any purpose. It is provided "as is"
46 1.2 ad * without express or implied warranty.
47 1.2 ad *
48 1.2 ad * from: Header: /sprite/src/kernel/dev/ds3100.md/RCS/sii.h,
49 1.2 ad * v 1.2 89/08/15 19:53:04 rab Exp SPRITE (DECWRL)
50 1.2 ad */
51 1.2 ad
52 1.2 ad #ifndef _SII
53 1.2 ad #define _SII
54 1.2 ad
55 1.2 ad /*
56 1.2 ad * SII hardware registers
57 1.2 ad */
58 1.2 ad typedef volatile struct {
59 1.2 ad u_short sdb; /* SCSI Data Bus and Parity */
60 1.2 ad u_short pad0;
61 1.2 ad u_short sc1; /* SCSI Control Signals One */
62 1.2 ad u_short pad1;
63 1.2 ad u_short sc2; /* SCSI Control Signals Two */
64 1.2 ad u_short pad2;
65 1.2 ad u_short csr; /* Control/Status register */
66 1.2 ad u_short pad3;
67 1.2 ad u_short id; /* Bus ID register */
68 1.2 ad u_short pad4;
69 1.2 ad u_short slcsr; /* Select Control and Status Register */
70 1.2 ad u_short pad5;
71 1.2 ad u_short destat; /* Selection Detector Status Register */
72 1.2 ad u_short pad6;
73 1.2 ad u_short dstmo; /* DSSI Timeout Register */
74 1.2 ad u_short pad7;
75 1.2 ad u_short data; /* Data Register */
76 1.2 ad u_short pad8;
77 1.2 ad u_short dmctrl; /* DMA Control Register */
78 1.2 ad u_short pad9;
79 1.2 ad u_short dmlotc; /* DMA Length of Transfer Counter */
80 1.2 ad u_short pad10;
81 1.2 ad u_short dmaddrl; /* DMA Address Register Low */
82 1.2 ad u_short pad11;
83 1.2 ad u_short dmaddrh; /* DMA Address Register High */
84 1.2 ad u_short pad12;
85 1.2 ad u_short dmabyte; /* DMA Initial Byte Register */
86 1.2 ad u_short pad13;
87 1.2 ad u_short stlp; /* DSSI Short Target List Pointer */
88 1.2 ad u_short pad14;
89 1.2 ad u_short ltlp; /* DSSI Long Target List Pointer */
90 1.2 ad u_short pad15;
91 1.2 ad u_short ilp; /* DSSI Initiator List Pointer */
92 1.2 ad u_short pad16;
93 1.2 ad u_short dsctrl; /* DSSI Control Register */
94 1.2 ad u_short pad17;
95 1.2 ad u_short cstat; /* Connection Status Register */
96 1.2 ad u_short pad18;
97 1.2 ad u_short dstat; /* Data Transfer Status Register */
98 1.2 ad u_short pad19;
99 1.2 ad u_short comm; /* Command Register */
100 1.2 ad u_short pad20;
101 1.2 ad u_short dictrl; /* Diagnostic Control Register */
102 1.2 ad u_short pad21;
103 1.2 ad u_short clock; /* Diagnostic Clock Register */
104 1.2 ad u_short pad22;
105 1.2 ad u_short bhdiag; /* Bus Handler Diagnostic Register */
106 1.2 ad u_short pad23;
107 1.2 ad u_short sidiag; /* SCSI IO Diagnostic Register */
108 1.2 ad u_short pad24;
109 1.2 ad u_short dmdiag; /* Data Mover Diagnostic Register */
110 1.2 ad u_short pad25;
111 1.2 ad u_short mcdiag; /* Main Control Diagnostic Register */
112 1.2 ad u_short pad26;
113 1.2 ad } SIIRegs;
114 1.2 ad
115 1.2 ad /*
116 1.2 ad * SC1 - SCSI Control Signals One
117 1.2 ad */
118 1.2 ad #define SII_SC1_MSK 0x1ff /* All possible signals on the bus */
119 1.2 ad #define SII_SC1_SEL 0x80 /* SCSI SEL signal active on bus */
120 1.2 ad #define SII_SC1_ATN 0x08 /* SCSI ATN signal active on bus */
121 1.2 ad
122 1.2 ad /*
123 1.2 ad * SC2 - SCSI Control Signals Two
124 1.2 ad */
125 1.2 ad #define SII_SC2_IGS 0x8 /* SCSI drivers for initiator mode */
126 1.2 ad
127 1.2 ad /*
128 1.2 ad * CSR - Control/Status Register
129 1.2 ad */
130 1.2 ad #define SII_HPM 0x10 /* SII in on an arbitrated SCSI bus */
131 1.2 ad #define SII_RSE 0x08 /* 1 = respond to reselections */
132 1.2 ad #define SII_SLE 0x04 /* 1 = respond to selections */
133 1.2 ad #define SII_PCE 0x02 /* 1 = report parity errors */
134 1.2 ad #define SII_IE 0x01 /* 1 = enable interrupts */
135 1.2 ad
136 1.2 ad /*
137 1.2 ad * ID - Bus ID Register
138 1.2 ad */
139 1.2 ad #define SII_ID_IO 0x8000 /* I/O */
140 1.2 ad
141 1.2 ad /*
142 1.2 ad * DESTAT - Selection Detector Status Register
143 1.2 ad */
144 1.2 ad #define SII_IDMSK 0x7 /* ID of target reselected the SII */
145 1.2 ad
146 1.2 ad /*
147 1.2 ad * DMCTRL - DMA Control Register
148 1.2 ad */
149 1.2 ad #define SII_ASYNC 0x00 /* REQ/ACK Offset for async mode */
150 1.2 ad #define SII_SYNC 0x03 /* REQ/ACK Offset for sync mode */
151 1.2 ad
152 1.2 ad /*
153 1.2 ad * DMLOTC - DMA Length Of Transfer Counter
154 1.2 ad */
155 1.2 ad #define SII_TCMSK 0x1fff /* transfer count mask */
156 1.2 ad
157 1.2 ad /*
158 1.2 ad * CSTAT - Connection Status Register
159 1.2 ad */
160 1.2 ad #define SII_CI 0x8000 /* composite interrupt bit for CSTAT */
161 1.2 ad #define SII_DI 0x4000 /* composite interrupt bit for DSTAT */
162 1.2 ad #define SII_RST 0x2000 /* 1 if reset is asserted on SCSI bus */
163 1.2 ad #define SII_BER 0x1000 /* Bus error */
164 1.2 ad #define SII_OBC 0x0800 /* Out_en Bit Cleared (DSSI mode) */
165 1.2 ad #define SII_TZ 0x0400 /* Target pointer Zero (STLP or LTLP is zero) */
166 1.2 ad #define SII_BUF 0x0200 /* Buffer service - outbound pkt to non-DSSI */
167 1.2 ad #define SII_LDN 0x0100 /* List element Done */
168 1.2 ad #define SII_SCH 0x0080 /* State Change */
169 1.2 ad #define SII_CON 0x0040 /* SII is Connected to another device */
170 1.2 ad #define SII_DST 0x0020 /* SII was Destination of current transfer */
171 1.2 ad #define SII_TGT 0x0010 /* SII is operating as a Target */
172 1.2 ad #define SII_STATE_MSK 0x0070 /* State Mask */
173 1.2 ad #define SII_SWA 0x0008 /* Selected With Attention */
174 1.2 ad #define SII_SIP 0x0004 /* Selection In Progress */
175 1.2 ad #define SII_LST 0x0002 /* Lost arbitration */
176 1.2 ad
177 1.2 ad /*
178 1.2 ad * DSTAT - Data Transfer Status Register
179 1.2 ad */
180 1.2 ad #define SII_DNE 0x2000 /* DMA transfer Done */
181 1.2 ad #define SII_TCZ 0x1000 /* Transfer Count register is Zero */
182 1.2 ad #define SII_TBE 0x0800 /* Transmit Buffer Empty */
183 1.2 ad #define SII_IBF 0x0400 /* Input Buffer Full */
184 1.2 ad #define SII_IPE 0x0200 /* Incoming Parity Error */
185 1.2 ad #define SII_OBB 0x0100 /* Odd Byte Boundry */
186 1.2 ad #define SII_MIS 0x0010 /* Phase Mismatch */
187 1.2 ad #define SII_ATN 0x0008 /* ATN set by initiator if in Target mode */
188 1.2 ad #define SII_MSG 0x0004 /* current bus state of MSG */
189 1.2 ad #define SII_CD 0x0002 /* current bus state of C/D */
190 1.2 ad #define SII_IO 0x0001 /* current bus state of I/O */
191 1.2 ad #define SII_PHASE_MSK 0x0007 /* Phase Mask */
192 1.2 ad
193 1.2 ad /*
194 1.2 ad * The different phases.
195 1.2 ad */
196 1.2 ad #define SII_MSG_IN_PHASE 0x7
197 1.2 ad #define SII_MSG_OUT_PHASE 0x6
198 1.2 ad #define SII_STATUS_PHASE 0x3
199 1.2 ad #define SII_CMD_PHASE 0x2
200 1.2 ad #define SII_DATA_IN_PHASE 0x1
201 1.2 ad #define SII_DATA_OUT_PHASE 0x0
202 1.2 ad
203 1.2 ad /*
204 1.2 ad * COMM - Command Register
205 1.2 ad */
206 1.2 ad #define SII_DMA 0x8000 /* DMA mode */
207 1.2 ad #define SII_DO_RST 0x4000 /* Assert reset on SCSI bus for 25 usecs */
208 1.2 ad #define SII_RSL 0x1000 /* 0 = select, 1 = reselect desired device */
209 1.2 ad
210 1.2 ad /* Commands: I - Initiator, T - Target, D - Disconnected */
211 1.2 ad #define SII_INXFER 0x0800 /* Information Transfer command (I,T) */
212 1.2 ad #define SII_SELECT 0x0400 /* Select command (D) */
213 1.2 ad #define SII_REQDATA 0x0200 /* Request Data command (T) */
214 1.2 ad #define SII_DISCON 0x0100 /* Disconnect command (I,T,D) */
215 1.2 ad #define SII_CHRESET 0x0080 /* Chip Reset command (I,T,D) */
216 1.2 ad
217 1.2 ad /* Command state bits same as connection status register */
218 1.2 ad /* Command phase bits same as data transfer status register */
219 1.2 ad
220 1.2 ad /*
221 1.2 ad * DICTRL - Diagnostic Control Register
222 1.2 ad */
223 1.2 ad #define SII_PRE 0x4 /* Enable the SII to drive the SCSI bus */
224 1.2 ad
225 1.2 ad #define SII_WAIT_COUNT 10000 /* Delay count used for the SII chip */
226 1.2 ad /*
227 1.2 ad * Max DMA transfer length for SII
228 1.2 ad * The SII chip only has a 13 bit counter. If 8192 is used as the max count,
229 1.2 ad * you can't tell the difference between a count of zero and 8192.
230 1.2 ad * 8190 is used instead of 8191 so the count is even.
231 1.2 ad */
232 1.2 ad #define SII_MAX_DMA_XFER_LENGTH 8192
233 1.2 ad
234 1.2 ad #endif /* _SII */
235