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