Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / dev / disk / nsp / nspreg.h
1 /*      $FreeBSD: src/sys/dev/nsp/nspreg.h,v 1.1.2.2 2001/07/22 00:21:39 non Exp $      */
2 /*      $DragonFly: src/sys/dev/disk/nsp/nspreg.h,v 1.2 2003/06/17 04:28:28 dillon Exp $        */
3 /*      $NecBSD: nspreg.h,v 1.4.3 2001/06/29 06:27:53 honda Exp $       */
4 /*      $NetBSD$        */
5
6 /*
7  * [NetBSD for NEC PC-98 series]
8  *  Copyright (c) 1998
9  *      NetBSD/pc98 porting staff. All rights reserved.
10  * 
11  *  Redistribution and use in source and binary forms, with or without
12  *  modification, are permitted provided that the following conditions
13  *  are met:
14  *  1. Redistributions of source code must retain the above copyright
15  *     notice, this list of conditions and the following disclaimer.
16  *  2. Redistributions in binary form must reproduce the above copyright
17  *     notice, this list of conditions and the following disclaimer in the
18  *     documentation and/or other materials provided with the distribution.
19  *  3. The name of the author may not be used to endorse or promote products
20  *     derived from this software without specific prior written permission.
21  * 
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 #ifndef _NSPREG_H_
36 #define _NSPREG_H_
37
38 /* base registers */
39 #define nsp_irqcr       0
40 #define IRQCR_RESCL     0x01
41 #define IRQCR_PHCL      0x02
42 #define IRQCR_TIMERCL   0x04
43 #define IRQCR_FIFOCL    0x08
44 #define IRQCR_SCSIIDIS  0x10
45 #define IRQCR_EXTIDIS   0x20
46 #define IRQCR_TIMERIDIS 0x40
47 #define IRQCR_FIFOIDIS  0x80
48 #define IRQCR_ALLMASK   0xff
49 #define IRQCR_IRQDIS    0xf0
50
51 #define nsp_irqsr       0
52 #define IRQSR_SCSI      0x01
53 #define IRQSR_EXT       0x02
54 #define IRQSR_TIMER     0x04
55 #define IRQSR_FIFO      0x08
56 #define IRQSR_MASK      0x0f
57
58 #define nsp_ifselr      1
59 #define IFSELR_IFSEL    0x01
60 #define IFSELR_REGSEL   0x04
61
62 #define nsp_fifosr      1
63 #define FIFOSR_CHIPREVM 0x0f
64 #define FIFOSR_CHIPIDM  0x70
65 #define FIFOSR_FULLEMP  0x80
66
67 #define nsp_idxr        2
68 #define nsp_datar       3
69 #define nsp_fifodr      4
70
71 /* indexed registers */
72 #define NSPR_EXTBUSC    0x10
73
74 #define NSPR_CLKDIVR    0x11
75 #define CLKDIVR_40M     0x02
76 #define CLKDIVR_20M     0x01
77
78 #define NSPR_TERMPWRC   0x13
79 #define TERMPWRC_POWON  0x01
80
81 #define NSPR_SCIENR     0x15
82 #define SCIENR_SCCHG    0x01
83 #define SCIENR_RESEL    0x10
84 #define SCIENR_FIFO     0x20
85 #define SCIENR_RST      0x40
86
87 #define NSPR_IRQPHS     0x16
88 #define IRQPHS_LMSG     0x01
89 #define IRQPHS_LIO      0x02
90 #define IRQPHS_LCD      0x04
91 #define IRQPHS_LBF      0x08
92 #define IRQPHS_PCHG     0x10
93 #define IRQPHS_RSEL     0x20
94 #define IRQPHS_FIFO     0x40
95 #define IRQPHS_RST      0x80
96 #define IRQPHS_PHMASK   (IRQPHS_LCD | IRQPHS_LMSG | IRQPHS_LIO)
97
98 #define NSPR_TIMERCNT   0x17
99
100 #define NSPR_SCBUSCR    0x18
101 #define SCBUSCR_SEL     0x01
102 #define SCBUSCR_RST     0x02
103 #define SCBUSCR_DOUT    0x04
104 #define SCBUSCR_ATN     0x08
105 #define SCBUSCR_ACK     0x10
106 #define SCBUSCR_BSY     0x20
107 #define SCBUSCR_ADIR    0x40
108 #define SCBUSCR_ACKEN   0x80
109
110 #define NSPR_SCBUSMON   0x19
111 #define SCBUSMON_MSG    0x01
112 #define SCBUSMON_IO     0x02
113 #define SCBUSMON_CD     0x04
114 #define SCBUSMON_BSY    0x08
115 #define SCBUSMON_ACK    0x10
116 #define SCBUSMON_REQ    0x20
117 #define SCBUSMON_SEL    0x40
118 #define SCBUSMON_ATN    0x80
119
120 #define NSPR_SETARBIT   0x1A
121
122 #define NSPR_ARBITS     0x1A
123 #define ARBITS_EXEC     0x01
124 #define ARBITS_CLR      0x02
125 #define ARBITS_WIN      0x02
126 #define ARBITS_FAIL     0x04
127 #define ARBITS_RESEL    0x08
128
129 #define NSPR_PARITYR    0x1B    /* (W/R) */
130 #define PARITYR_ENABLE  0x01
131 #define PARITYR_CLEAR   0x02
132 #define PARITYR_PE      0x02
133
134 #define NSPR_CMDCR      0x1C    /* (W) */
135 #define CMDCR_PTCLR     0x01
136 #define CMDCR_EXEC      0x02
137
138 #define NSPR_RESELR     0x1C    /* (R) */
139 #define NSPR_CMDDR      0x1D    /* (W/R) */
140
141 #define NSPR_PTCLRR     0x1E    /* (W) */
142 #define PTCLRR_PT       0x01
143 #define PTCLRR_ACK      0x02
144 #define PTCLRR_REQ      0x04
145 #define PTCLRR_HOST     0x08
146 #define PTCLRR_RSS      0x30
147 #define PTCLRR_RSS_ACK  0x00
148 #define PTCLRR_RSS_REQ  0x10
149 #define PTCLRR_RSS_HOST 0x20
150
151 #define NSPR_XFERCR     0x1E    /* (R) */
152
153 #define NSPR_XFERMR     0x20
154 #define XFERMR_MEM8     0x01
155 #define XFERMR_MEM32    0x02
156 #define XFERMR_ADR24    0x04
157 #define XFERMR_ADR32    0x08
158 #define XFERMR_IO8      0x10
159 #define XFERMR_IO32     0x20
160 #define XFERMR_XEN      0x40
161 #define XFERMR_FIFOEN   0x80
162
163 #define NSPR_SYNCR      0x21
164 #define SYNCR_OFFM      0x0f
165 #define SYNCR_PERM      0xf0
166 #define SYNCR_PERS      4
167
168 #define NSPR_DATA       0x22
169 #define NSPR_DATAACK    0x23
170 #define NSPR_OCR        0x26
171 #define OCR_ROMEN       0x01
172 #define OCR_TERMPWROUT  0x02
173 #define OCR_TERMPWRS    0x04
174
175 #define NSPR_ACKWIDTH   0x27
176
177 /* SCBUSMON phase defs */
178 #define SCBUSMON_FREE   0
179 #define SCBUSMON_CMD \
180         (SCBUSMON_BSY | SCBUSMON_CD | SCBUSMON_REQ)
181 #define SCBUSMON_MSGIN \
182         (SCBUSMON_BSY | SCBUSMON_MSG | SCBUSMON_IO | SCBUSMON_CD | SCBUSMON_REQ)
183 #define SCBUSMON_MSGOUT \
184         (SCBUSMON_BSY | SCBUSMON_MSG | SCBUSMON_CD | SCBUSMON_REQ)
185 #define SCBUSMON_DATAIN \
186         (SCBUSMON_BSY | SCBUSMON_IO | SCBUSMON_REQ)
187 #define SCBUSMON_DATAOUT \
188         (SCBUSMON_BSY | SCBUSMON_REQ)
189 #define SCBUSMON_STATUS \
190         (SCBUSMON_BSY | SCBUSMON_IO | SCBUSMON_CD | SCBUSMON_REQ)
191 #define SCBUSMON_RESELECT \
192         (SCBUSMON_SEL | SCBUSMON_IO)
193 #define SCBUSMON_PHMASK \
194         (SCBUSMON_SEL | SCBUSMON_CD | SCBUSMON_MSG | SCBUSMON_IO)
195
196 /* Data phase */
197 #define NSP_IS_PHASE_DATA(ph) \
198         ((((ph) & SCBUSMON_PHMASK) & ~SCBUSMON_IO) == 0)
199 #define NSP_IS_IRQPHS_DATA(ph) \
200         ((((ph) & IRQPHS_PHMASK) & ~SCBUSMON_IO) == 0)
201
202 /* SCSI phase */
203 #define PHASE_CMD       (SCBUSMON_CMD & SCBUSMON_PHMASK)
204 #define PHASE_DATAIN    (SCBUSMON_DATAIN & SCBUSMON_PHMASK)
205 #define PHASE_DATAOUT   (SCBUSMON_DATAOUT & SCBUSMON_PHMASK)
206 #define PHASE_STATUS    (SCBUSMON_STATUS & SCBUSMON_PHMASK)
207 #define PHASE_MSGIN     (SCBUSMON_MSGIN & SCBUSMON_PHMASK)
208 #define PHASE_MSGOUT    (SCBUSMON_MSGOUT & SCBUSMON_PHMASK)
209 #define PHASE_SEL       (SCBUSMON_SEL | SCBUSMON_IO)
210
211 #define IRQPHS_CMD      (IRQPHS_LCD)
212 #define IRQPHS_DATAIN   (IRQPHS_LIO)
213 #define IRQPHS_DATAOUT  (0)
214 #define IRQPHS_STATUS   (IRQPHS_LCD | IRQPHS_LIO)
215 #define IRQPHS_MSGIN    (IRQPHS_LCD | IRQPHS_LMSG | IRQPHS_LIO)
216 #define IRQPHS_MSGOUT   (IRQPHS_LCD | IRQPHS_LMSG)
217
218 /* Size */
219 #define NSP_MEMSIZE     NBPG
220 #define NSP_IOSIZE      16
221 #define NSP_BUFFER_SIZE 512
222 #endif  /* !_NSPREG_H_ */