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