mb89352reg.h revision 1.4 1 1.4 wiz /* $NetBSD: mb89352reg.h,v 1.4 2004/01/04 16:19:44 wiz Exp $ */
2 1.1 minoura /* NecBSD: mb89352reg.h,v 1.3 1998/03/14 07:04:34 kmatsuda Exp */
3 1.1 minoura
4 1.1 minoura /*-
5 1.3 agc * Copyright (c) 1990, 1993
6 1.3 agc * The Regents of the University of California. All rights reserved.
7 1.3 agc *
8 1.3 agc * This code is derived from software contributed to The NetBSD Foundation
9 1.3 agc * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
10 1.3 agc *
11 1.3 agc * This code is derived from software contributed to Berkeley by
12 1.3 agc * Van Jacobson of Lawrence Berkeley Laboratory.
13 1.3 agc *
14 1.3 agc * Redistribution and use in source and binary forms, with or without
15 1.3 agc * modification, are permitted provided that the following conditions
16 1.3 agc * are met:
17 1.3 agc * 1. Redistributions of source code must retain the above copyright
18 1.3 agc * notice, this list of conditions and the following disclaimer.
19 1.3 agc * 2. Redistributions in binary form must reproduce the above copyright
20 1.3 agc * notice, this list of conditions and the following disclaimer in the
21 1.3 agc * documentation and/or other materials provided with the distribution.
22 1.3 agc * 3. Neither the name of the University nor the names of its contributors
23 1.3 agc * may be used to endorse or promote products derived from this software
24 1.3 agc * without specific prior written permission.
25 1.3 agc *
26 1.3 agc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.3 agc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.3 agc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.3 agc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.3 agc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.3 agc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.3 agc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.3 agc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.3 agc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.3 agc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.3 agc * SUCH DAMAGE.
37 1.3 agc *
38 1.3 agc * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
39 1.3 agc */
40 1.3 agc
41 1.3 agc /*-
42 1.1 minoura * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
43 1.1 minoura * All rights reserved.
44 1.1 minoura *
45 1.1 minoura * This code is derived from software contributed to The NetBSD Foundation
46 1.1 minoura * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
47 1.1 minoura *
48 1.1 minoura * This code is derived from software contributed to Berkeley by
49 1.1 minoura * Van Jacobson of Lawrence Berkeley Laboratory.
50 1.1 minoura *
51 1.1 minoura * Redistribution and use in source and binary forms, with or without
52 1.1 minoura * modification, are permitted provided that the following conditions
53 1.1 minoura * are met:
54 1.1 minoura * 1. Redistributions of source code must retain the above copyright
55 1.1 minoura * notice, this list of conditions and the following disclaimer.
56 1.1 minoura * 2. Redistributions in binary form must reproduce the above copyright
57 1.1 minoura * notice, this list of conditions and the following disclaimer in the
58 1.1 minoura * documentation and/or other materials provided with the distribution.
59 1.1 minoura * 3. All advertising materials mentioning features or use of this software
60 1.1 minoura * must display the following acknowledgement:
61 1.1 minoura * This product includes software developed by the University of
62 1.1 minoura * California, Berkeley and its contributors.
63 1.1 minoura * 4. Neither the name of the University nor the names of its contributors
64 1.1 minoura * may be used to endorse or promote products derived from this software
65 1.1 minoura * without specific prior written permission.
66 1.1 minoura *
67 1.1 minoura * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
68 1.1 minoura * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
69 1.1 minoura * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
70 1.1 minoura * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
71 1.1 minoura * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
72 1.1 minoura * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
73 1.1 minoura * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
74 1.1 minoura * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
75 1.1 minoura * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
76 1.1 minoura * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
77 1.1 minoura * SUCH DAMAGE.
78 1.1 minoura *
79 1.1 minoura * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
80 1.1 minoura */
81 1.1 minoura /*
82 1.1 minoura * [NetBSD for NEC PC-98 series]
83 1.1 minoura * Copyright (c) 1996, 1997, 1998
84 1.1 minoura * NetBSD/pc98 porting staff. All rights reserved.
85 1.1 minoura * Copyright (c) 1996, 1997, 1998
86 1.1 minoura * Kouichi Matsuda. All rights reserved.
87 1.1 minoura */
88 1.1 minoura
89 1.1 minoura /*
90 1.4 wiz * FUJITSU MB89352A SCSI Protocol Controller Hardware Description.
91 1.1 minoura */
92 1.1 minoura
93 1.1 minoura /* Definitions, most of them has turned out to be unneccesary, but here they
94 1.1 minoura * are anyway.
95 1.1 minoura */
96 1.1 minoura
97 1.1 minoura #define BDID 0x00 /* Bus Device ID (R/W) */
98 1.1 minoura #define SCTL 0x01 /* SPC Control register (R/W) */
99 1.1 minoura #define SCMD 0x02 /* Command Register (R/W) */
100 1.1 minoura #define TMOD 0x03 /* Transmit Mode Register (synch models) */
101 1.1 minoura #define INTS 0x04 /* Interrupt sense (R); Interrupt Reset (W) */
102 1.1 minoura #define PSNS 0x05 /* Phase Sence (R); SPC Diagnostic Control (W) */
103 1.1 minoura #define SSTS 0x06 /* SPC status (R/O) */
104 1.1 minoura #define SERR 0x07 /* SPC error status (R/O) */
105 1.1 minoura #define PCTL 0x08 /* Phase Control (R/W) */
106 1.1 minoura #define MBC 0x09 /* Modified Byte Counter (R/O) */
107 1.1 minoura #define DREG 0x0a /* Data Register (R/W) */
108 1.1 minoura #define TEMP 0x0b /* Temporary Register (R/W) */
109 1.1 minoura #define TCH 0x0c /* Transfer Counter High (R/W) */
110 1.1 minoura #define TCM 0x0d /* Transfer Counter Middle (R/W) */
111 1.1 minoura #define TCL 0x0e /* Transfer Counter Low (R/W) */
112 1.1 minoura #define EXBF 0x0f /* External Buffer (synch models) */
113 1.1 minoura
114 1.1 minoura /* What all the bits do */
115 1.1 minoura
116 1.1 minoura /* SCSI_BDID */
117 1.1 minoura /* SCSI selection/reselection ID (both target *and* initiator) */
118 1.1 minoura #define SELID7 0x80
119 1.1 minoura #define SELID6 0x40
120 1.1 minoura #define SELID5 0x20
121 1.1 minoura #define SELID4 0x10
122 1.1 minoura #define SELID3 0x08
123 1.1 minoura #define SELID2 0x04
124 1.1 minoura #define SELID1 0x02
125 1.1 minoura #define SELID0 0x01
126 1.1 minoura
127 1.1 minoura /* SCSI_SCTL */
128 1.2 tsutsui #define SCTL_DISABLE 0x80
129 1.2 tsutsui #define SCTL_CTRLRST 0x40
130 1.2 tsutsui #define SCTL_DIAG 0x20
131 1.2 tsutsui #define SCTL_ABRT_ENAB 0x10
132 1.2 tsutsui #define SCTL_PARITY_ENAB 0x08
133 1.2 tsutsui #define SCTL_SEL_ENAB 0x04
134 1.2 tsutsui #define SCTL_RESEL_ENAB 0x02
135 1.2 tsutsui #define SCTL_INTR_ENAB 0x01
136 1.1 minoura
137 1.1 minoura /* SCSI_SCMD */
138 1.2 tsutsui #define SCMD_RST 0x10
139 1.2 tsutsui #define SCMD_ICPT_XFR 0x08
140 1.2 tsutsui #define SCMD_PROG_XFR 0x04
141 1.2 tsutsui #define SCMD_PAD 0x01 /* if initiator */
142 1.2 tsutsui #define SCMD_PERR_STOP 0x01 /* if target */
143 1.1 minoura /* command codes */
144 1.2 tsutsui #define SCMD_BUS_REL 0x00
145 1.2 tsutsui #define SCMD_SELECT 0x20
146 1.2 tsutsui #define SCMD_RST_ATN 0x40
147 1.2 tsutsui #define SCMD_SET_ATN 0x60
148 1.2 tsutsui #define SCMD_XFR 0x80
149 1.2 tsutsui #define SCMD_XFR_PAUSE 0xa0
150 1.2 tsutsui #define SCMD_RST_ACK 0xc0
151 1.2 tsutsui #define SCMD_SET_ACK 0xe0
152 1.1 minoura
153 1.1 minoura /* SCSI_TMOD */
154 1.2 tsutsui #define TMOD_SYNC 0x80
155 1.1 minoura
156 1.1 minoura /* SCSI_INTS */
157 1.2 tsutsui #define INTS_SEL 0x80
158 1.2 tsutsui #define INTS_RESEL 0x40
159 1.2 tsutsui #define INTS_DISCON 0x20
160 1.2 tsutsui #define INTS_CMD_DONE 0x10
161 1.2 tsutsui #define INTS_SRV_REQ 0x08
162 1.2 tsutsui #define INTS_TIMEOUT 0x04
163 1.2 tsutsui #define INTS_HARD_ERR 0x02
164 1.2 tsutsui #define INTS_RST 0x01
165 1.1 minoura
166 1.1 minoura /* SCSI_PSNS */
167 1.2 tsutsui #define PSNS_REQ 0x80
168 1.2 tsutsui #define PSNS_ACK 0x40
169 1.2 tsutsui #define PSNS_ATN 0x20
170 1.2 tsutsui #define PSNS_SEL 0x10
171 1.2 tsutsui #define PSNS_BSY 0x08
172 1.1 minoura
173 1.1 minoura /* PSNS */
174 1.1 minoura #define REQI 0x80
175 1.1 minoura #define ACKI 0x40
176 1.1 minoura #define ATNI 0x20
177 1.1 minoura #define SELI 0x10
178 1.1 minoura #define BSYI 0x08
179 1.1 minoura #define MSGI 0x04
180 1.1 minoura #define CDI 0x02
181 1.1 minoura #define IOI 0x01
182 1.1 minoura
183 1.1 minoura /* Important! The 3 most significant bits of this register, in initiator mode,
184 1.1 minoura * represents the "expected" SCSI bus phase and can be used to trigger phase
185 1.1 minoura * mismatch and phase change interrupts. But more important: If there is a
186 1.1 minoura * phase mismatch the chip will not transfer any data! This is actually a nice
187 1.1 minoura * feature as it gives us a bit more control over what is happening when we are
188 1.1 minoura * bursting data (in) through the FIFOs and the phase suddenly changes from
189 1.1 minoura * DATA IN to STATUS or MESSAGE IN. The transfer will stop and wait for the
190 1.1 minoura * proper phase to be set in this register instead of dumping the bits into the
191 1.1 minoura * FIFOs.
192 1.1 minoura */
193 1.1 minoura #if 0
194 1.1 minoura #define REQO 0x80
195 1.1 minoura #define ACKO 0x40
196 1.1 minoura #define ATNO 0x20
197 1.1 minoura #define SELO 0x10
198 1.1 minoura #define BSYO 0x08
199 1.1 minoura #endif
200 1.1 minoura /* PCTL */
201 1.1 minoura #define MSGO 0x04
202 1.1 minoura #define CDO 0x02
203 1.1 minoura #define IOO 0x01
204 1.1 minoura
205 1.1 minoura /* Information transfer phases */
206 1.1 minoura #define PH_DATAOUT (0)
207 1.1 minoura #define PH_DATAIN (IOI)
208 1.1 minoura #define PH_CMD (CDI)
209 1.1 minoura #define PH_STAT (CDI | IOI)
210 1.1 minoura #define PH_MSGOUT (MSGI | CDI)
211 1.1 minoura #define PH_MSGIN (MSGI | CDI | IOI)
212 1.1 minoura
213 1.1 minoura #define PH_MASK (MSGI | CDI | IOI)
214 1.1 minoura
215 1.2 tsutsui #define PH_INVALID 0xff
216 1.1 minoura
217 1.1 minoura /* SCSI_SSTS */
218 1.2 tsutsui #define SSTS_INITIATOR 0x80
219 1.2 tsutsui #define SSTS_TARGET 0x40
220 1.2 tsutsui #define SSTS_BUSY 0x20
221 1.2 tsutsui #define SSTS_XFR 0x10
222 1.2 tsutsui #define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR)
223 1.2 tsutsui #define SSTS_RST 0x08
224 1.2 tsutsui #define SSTS_TCZERO 0x04
225 1.2 tsutsui #define SSTS_DREG_FULL 0x02
226 1.2 tsutsui #define SSTS_DREG_EMPTY 0x01
227 1.1 minoura
228 1.1 minoura /* SCSI_SERR */
229 1.2 tsutsui #define SERR_SCSI_PAR 0x80
230 1.2 tsutsui #define SERR_SPC_PAR 0x40
231 1.2 tsutsui #define SERR_TC_PAR 0x08
232 1.2 tsutsui #define SERR_PHASE_ERR 0x04
233 1.2 tsutsui #define SERR_SHORT_XFR 0x02
234 1.2 tsutsui #define SERR_OFFSET 0x01
235 1.1 minoura
236 1.1 minoura /* SCSI_PCTL */
237 1.2 tsutsui #define PCTL_BFINT_ENAB 0x80
238