screg_1185.h revision 1.4 1 1.4 tsutsui /* $NetBSD: screg_1185.h,v 1.4 2003/04/19 14:56:06 tsutsui Exp $ */
2 1.1 tsubai /*
3 1.1 tsubai * Copyright (c) 1992, 1993
4 1.1 tsubai * The Regents of the University of California. All rights reserved.
5 1.1 tsubai *
6 1.1 tsubai * This code is derived from software contributed to Berkeley by
7 1.1 tsubai * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
8 1.1 tsubai *
9 1.1 tsubai * Redistribution and use in source and binary forms, with or without
10 1.1 tsubai * modification, are permitted provided that the following conditions
11 1.1 tsubai * are met:
12 1.1 tsubai * 1. Redistributions of source code must retain the above copyright
13 1.1 tsubai * notice, this list of conditions and the following disclaimer.
14 1.1 tsubai * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 tsubai * notice, this list of conditions and the following disclaimer in the
16 1.1 tsubai * documentation and/or other materials provided with the distribution.
17 1.1 tsubai * 3. All advertising materials mentioning features or use of this software
18 1.1 tsubai * must display the following acknowledgement:
19 1.1 tsubai * This product includes software developed by the University of
20 1.1 tsubai * California, Berkeley and its contributors.
21 1.1 tsubai * 4. Neither the name of the University nor the names of its contributors
22 1.1 tsubai * may be used to endorse or promote products derived from this software
23 1.1 tsubai * without specific prior written permission.
24 1.1 tsubai *
25 1.1 tsubai * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1 tsubai * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1 tsubai * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1 tsubai * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1 tsubai * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1 tsubai * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1 tsubai * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1 tsubai * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1 tsubai * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1 tsubai * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1 tsubai * SUCH DAMAGE.
36 1.1 tsubai *
37 1.1 tsubai * from: $Hdr: screg_1185.h,v 4.300 91/06/09 06:22:14 root Rel41 $ SONY
38 1.1 tsubai *
39 1.1 tsubai * @(#)screg_1185.h 8.1 (Berkeley) 6/11/93
40 1.1 tsubai */
41 1.1 tsubai
42 1.1 tsubai /*
43 1.1 tsubai * Copyright (c) 1989- by SONY Corporation.
44 1.1 tsubai */
45 1.1 tsubai
46 1.1 tsubai /*
47 1.4 tsutsui * screg_1185.h ver 0.0
48 1.1 tsubai * for SCSI I/F Chip CXD1185Q
49 1.1 tsubai */
50 1.1 tsubai
51 1.1 tsubai /*
52 1.1 tsubai * SCSI I/F Chip CXD1185Q Register address assignment
53 1.1 tsubai */
54 1.3 thorpej #ifdef __mips__
55 1.1 tsubai # define SCSI_BASE 0xbfe00100
56 1.1 tsubai #else
57 1.1 tsubai # define SCSI_BASE 0xe1900000
58 1.1 tsubai #endif
59 1.1 tsubai
60 1.1 tsubai #ifndef U_CHAR
61 1.3 thorpej #ifdef __mips__
62 1.1 tsubai #define U_CHAR volatile u_char
63 1.1 tsubai #else
64 1.1 tsubai #define U_CHAR u_char
65 1.1 tsubai #endif
66 1.1 tsubai #endif
67 1.1 tsubai
68 1.1 tsubai #define sc_statr *( (U_CHAR *)(SCSI_BASE + 0x0) )
69 1.1 tsubai #define sc_comr *( (U_CHAR *)(SCSI_BASE + 0x0) )
70 1.1 tsubai #define sc_datr *( (U_CHAR *)(SCSI_BASE + 0x1) )
71 1.1 tsubai #define sc_intrq1 *( (U_CHAR *)(SCSI_BASE + 0x2) )
72 1.1 tsubai #define sc_intrq2 *( (U_CHAR *)(SCSI_BASE + 0x3) )
73 1.1 tsubai #define sc_envir *( (U_CHAR *)(SCSI_BASE + 0x3) )
74 1.1 tsubai #define sc_cmonr *( (U_CHAR *)(SCSI_BASE + 0x4) )
75 1.1 tsubai #define sc_timer *( (U_CHAR *)(SCSI_BASE + 0x4) )
76 1.1 tsubai #define sc_ffstr *( (U_CHAR *)(SCSI_BASE + 0x5) )
77 1.1 tsubai #define sc_idenr *( (U_CHAR *)(SCSI_BASE + 0x6) )
78 1.1 tsubai #define sc_tclow *( (U_CHAR *)(SCSI_BASE + 0x7) )
79 1.1 tsubai #define sc_tcmid *( (U_CHAR *)(SCSI_BASE + 0x8) )
80 1.1 tsubai #define sc_tchi *( (U_CHAR *)(SCSI_BASE + 0x9) )
81 1.1 tsubai #define sc_intok1 *( (U_CHAR *)(SCSI_BASE + 0xa) )
82 1.1 tsubai #define sc_intok2 *( (U_CHAR *)(SCSI_BASE + 0xb) )
83 1.1 tsubai #define sc_moder *( (U_CHAR *)(SCSI_BASE + 0xc) )
84 1.1 tsubai #define sc_syncr *( (U_CHAR *)(SCSI_BASE + 0xd) )
85 1.1 tsubai #define sc_busconr *( (U_CHAR *)(SCSI_BASE + 0xe) )
86 1.1 tsubai #define sc_ioptr *( (U_CHAR *)(SCSI_BASE + 0xf) )
87 1.1 tsubai
88 1.1 tsubai /*
89 1.1 tsubai * CXD1185Q Register bit assignment
90 1.1 tsubai */
91 1.1 tsubai
92 1.1 tsubai /* sc_statr (status register) bit define
93 1.1 tsubai */
94 1.1 tsubai #define R0_MRST 0x80
95 1.1 tsubai #define R0_MDBP 0x40
96 1.1 tsubai #define R0_INIT 0x10
97 1.1 tsubai #define R0_TARG 8
98 1.1 tsubai #define R0_TRBZ 4
99 1.1 tsubai #define R0_MIRQ 2
100 1.1 tsubai #define R0_CIP 1
101 1.1 tsubai
102 1.1 tsubai /* sc_comr (command register) bit define
103 1.1 tsubai */
104 1.1 tsubai #define R0_DMA 0x20
105 1.1 tsubai #define R0_TRBE 0x10
106 1.1 tsubai
107 1.1 tsubai /* sc_intrq1 (interrupt request register 1) bit define
108 1.1 tsubai */
109 1.1 tsubai #define R2_STO 0x10
110 1.1 tsubai #define R2_RSL 8
111 1.1 tsubai #define R2_SWA 4
112 1.1 tsubai #define R2_SWOA 2
113 1.1 tsubai #define R2_ARBF 1
114 1.1 tsubai
115 1.1 tsubai /* sc_intrq2 (interrupt request register 2) bit define
116 1.1 tsubai */
117 1.1 tsubai #define R3_FNC 0x80
118 1.1 tsubai #define R3_DCNT 0x40
119 1.1 tsubai #define R3_SRST 0x20
120 1.1 tsubai #define R3_PHC 0x10
121 1.1 tsubai #define R3_DATN 8
122 1.1 tsubai #define R3_DPE 4
123 1.1 tsubai #define R3_SPE 2
124 1.1 tsubai #define R3_RMSG 1
125 1.1 tsubai
126 1.1 tsubai /* sc_envir (environment register) bit define
127 1.1 tsubai */
128 1.1 tsubai #define R3_DIFE 0x80
129 1.1 tsubai #define R3_SDPM 0x40
130 1.1 tsubai #define R3_DPEN 0x20
131 1.1 tsubai #define R3_SIRM 0x10
132 1.1 tsubai #define R3_FS_MASK 3
133 1.1 tsubai
134 1.1 tsubai /* sc_cmonr (scsi control monitor register) bit define
135 1.1 tsubai */
136 1.1 tsubai #define R4_MBSY 0x80
137 1.1 tsubai #define R4_MSEL 0x40
138 1.1 tsubai #define R4_MMSG 0x20
139 1.1 tsubai #define R4_MCD 0x10
140 1.1 tsubai #define R4_MIO 8
141 1.1 tsubai #define R4_MREQ 4
142 1.1 tsubai #define R4_MACK 2
143 1.1 tsubai #define R4_MATN 1
144 1.1 tsubai
145 1.1 tsubai /* sc_ffstr (FIFO status register) bit define
146 1.1 tsubai */
147 1.1 tsubai #define R5_FIE 0x80
148 1.1 tsubai #define R5_FIF 0x10
149 1.1 tsubai #define R5_FIFOREM 0x1f
150 1.1 tsubai
151 1.1 tsubai /* sc_idenr (scsi identify register) bit define
152 1.1 tsubai */
153 1.1 tsubai #define R6_OID_MASK 0x07
154 1.1 tsubai #define R6_SID_MASK 0xe0
155 1.1 tsubai #define R6_TID_MASK 0xe0
156 1.1 tsubai
157 1.1 tsubai /* sc_intok1 (interrupt enable register 1) bit define
158 1.1 tsubai */
159 1.1 tsubai #define Ra_STO 0x10
160 1.1 tsubai #define Ra_RSL 8
161 1.1 tsubai #define Ra_SWA 4
162 1.1 tsubai #define Ra_SWOA 2
163 1.1 tsubai #define Ra_ARBF 1
164 1.1 tsubai
165 1.1 tsubai /* sc_intok2 (interrupt enable register 2) bit define
166 1.1 tsubai */
167 1.1 tsubai #define Rb_FNC 0x80
168 1.1 tsubai #define Rb_DCNT 0x40
169 1.1 tsubai #define Rb_SRST 0x20
170 1.1 tsubai #define Rb_PHC 0x10
171 1.1 tsubai #define Rb_DATN 8
172 1.1 tsubai #define Rb_DPE 4
173 1.1 tsubai #define Rb_SPE 2
174 1.1 tsubai #define Rb_RMSG 1
175 1.1 tsubai
176 1.1 tsubai /* sc_moder (mode register) bit define
177 1.1 tsubai */
178 1.1 tsubai #define Rc_HDPE 0x80
179 1.1 tsubai #define Rc_HSPE 0x40
180 1.1 tsubai #define Rc_HATN 0x20
181 1.1 tsubai #define Rc_TMSL 0x10
182 1.1 tsubai #define Rc_SPHI 8
183 1.1 tsubai #define Rc_BDMA 1
184 1.1 tsubai
185 1.1 tsubai /* sc_syncr (synchronous transfer control register) bit define
186 1.1 tsubai */
187 1.1 tsubai #define Rd_TPD_MASK 0xf0
188 1.1 tsubai #define Rd_TOF_MASK 0x0f
189 1.1 tsubai #define MIN_TP 62 /* minimum transfer period 4ns * 25 */
190 1.1 tsubai #define MAX_OFFSET 15
191 1.1 tsubai
192 1.1 tsubai /* sc_busconr (scsi bus control register) bit define
193 1.1 tsubai */
194 1.1 tsubai #define Re_ABSY 0x80
195 1.1 tsubai #define Re_ASEL 0x40
196 1.1 tsubai #define Re_AMSG 0x20
197 1.1 tsubai #define Re_ACD 0x10
198 1.1 tsubai #define Re_AIO 8
199 1.1 tsubai #define Re_AREQ 4
200 1.1 tsubai #define Re_AACK 2
201 1.1 tsubai #define Re_AATN 1
202 1.1 tsubai
203 1.1 tsubai /* sc_ioptr (I/O port) bit define
204 1.1 tsubai */
205 1.1 tsubai #define Rf_PCN_MASK 0xf0
206 1.1 tsubai # define Rf_PCN3 0x80
207 1.1 tsubai # define Rf_PCN2 0x40
208 1.1 tsubai # define Rf_PCN1 0x20
209 1.1 tsubai # define Rf_PCN0 0x10
210 1.1 tsubai #define Rf_PRT_MASK 0x0f
211 1.1 tsubai # define Rf_PRT3 8
212 1.1 tsubai # define Rf_PRT2 4
213 1.1 tsubai # define Rf_PRT1 2
214 1.1 tsubai # define Rf_PRT0 1
215 1.1 tsubai
216 1.1 tsubai
217 1.1 tsubai /*
218 1.1 tsubai * CXD1185Q commands
219 1.1 tsubai */
220 1.1 tsubai /* category 0
221 1.1 tsubai */
222 1.1 tsubai #define SCMD_NOP 0x00
223 1.1 tsubai #define SCMD_CHIP_RST 0x01
224 1.1 tsubai #define SCMD_AST_RST 0x02
225 1.1 tsubai #define SCMD_FLSH_FIFO 0x03
226 1.1 tsubai #define SCMD_AST_CTRL 0x04
227 1.1 tsubai #define SCMD_NGT_CTRL 0x05
228 1.1 tsubai #define SCMD_AST_DATA 0x06
229 1.1 tsubai #define SCMD_NGT_DATA 0x07
230 1.1 tsubai
231 1.1 tsubai /* category 1
232 1.1 tsubai */
233 1.1 tsubai #define SCMD_RESEL 0x40
234 1.1 tsubai #define SCMD_SEL 0x41
235 1.1 tsubai #define SCMD_SEL_ATN 0x42
236 1.1 tsubai #define SCMD_ENB_SEL 0x43
237 1.1 tsubai #define SCMD_DIS_SEL 0x44
238 1.1 tsubai
239 1.1 tsubai /* category 2
240 1.1 tsubai */
241 1.1 tsubai #define SCMD_SEND_MES 0x80
242 1.1 tsubai #define SCMD_SEND_STAT 0x81
243 1.1 tsubai #define SCMD_SEND_DATA 0x82
244 1.1 tsubai #define SCMD_DISCONNECT 0x83
245 1.1 tsubai #define SCMD_RCV_MOUT 0x84
246 1.1 tsubai #define SCMD_RCV_CMD 0x85
247 1.1 tsubai #define SCMD_RCV_DATA 0x86
248 1.1 tsubai
249 1.1 tsubai /* category 3
250 1.1 tsubai */
251 1.1 tsubai #define SCMD_TR_INFO 0xc0
252 1.1 tsubai #define SCMD_TR_PAD 0xc1
253 1.1 tsubai #define SCMD_NGT_ACK 0xc2
254 1.1 tsubai #define SCMD_AST_ATN 0xc3
255 1.1 tsubai #define SCMD_NGT_ATN 0xc4
256 1.1 tsubai
257 1.1 tsubai
258 1.1 tsubai /*
259 1.1 tsubai * scsi parameter definition
260 1.1 tsubai */
261 1.1 tsubai /* SCSI bus ID
262 1.1 tsubai */
263 1.1 tsubai #define SC_OWNID 0x7
264 1.1 tsubai #define SC_TG_SHIFT 5
265 1.1 tsubai
266 1.1 tsubai /* scsi bus phase
267 1.1 tsubai */
268 1.1 tsubai #define SC_PMASK (R4_MMSG|R4_MCD|R4_MIO)
269 1.1 tsubai # define DAT_OUT 0
270 1.1 tsubai # define DAT_IN R4_MIO
271 1.1 tsubai # define COM_OUT R4_MCD
272 1.1 tsubai # define STAT_IN (R4_MCD|R4_MIO)
273 1.1 tsubai # define MES_OUT (R4_MMSG|R4_MCD)
274 1.1 tsubai # define MES_IN (R4_MMSG|R4_MCD|R4_MIO)
275 1.1 tsubai
276 1.1 tsubai /* scsi command types define
277 1.1 tsubai */
278 1.1 tsubai #define CMD_TYPEMASK 0xe0
279 1.1 tsubai # define CMD_T0 0 /* 6 byte commands */
280 1.1 tsubai # define CMD_T1 0x20 /* 10 byte commands */
281 1.1 tsubai # define CMD_T5 0xa0 /* 12 byte commands */
282 1.1 tsubai # define CMD_T6 0xc0
283 1.1 tsubai # define CMD_T7 0xe0
284 1.1 tsubai
285 1.1 tsubai #define MAXNSCSI 1
286