summaryrefslogtreecommitdiffstats
path: root/sys/dev/nsp/nspreg.h
blob: 81512c91a60995b74018101cdc372b6f48b97fd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*	$FreeBSD$	*/
/*	$NecBSD: nspreg.h,v 1.4.14.3 2001/06/29 06:27:53 honda Exp $	*/
/*	$NetBSD$	*/

/*-
 * [NetBSD for NEC PC-98 series]
 *  Copyright (c) 1998
 *	NetBSD/pc98 porting staff. All rights reserved.
 * 
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *  3. The name of the author may not be used to endorse or promote products
 *     derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef	_NSPREG_H_
#define	_NSPREG_H_

/* base registers */
#define	nsp_irqcr	0
#define	IRQCR_RESCL	0x01
#define	IRQCR_PHCL	0x02
#define	IRQCR_TIMERCL	0x04
#define	IRQCR_FIFOCL	0x08
#define	IRQCR_SCSIIDIS	0x10
#define	IRQCR_EXTIDIS	0x20
#define	IRQCR_TIMERIDIS	0x40
#define	IRQCR_FIFOIDIS	0x80
#define	IRQCR_ALLMASK	0xff
#define	IRQCR_IRQDIS	0xf0

#define	nsp_irqsr	0
#define	IRQSR_SCSI	0x01
#define	IRQSR_EXT	0x02
#define	IRQSR_TIMER	0x04
#define	IRQSR_FIFO	0x08
#define	IRQSR_MASK	0x0f

#define	nsp_ifselr	1
#define	IFSELR_IFSEL	0x01
#define	IFSELR_REGSEL	0x04

#define	nsp_fifosr	1
#define	FIFOSR_CHIPREVM	0x0f
#define	FIFOSR_CHIPIDM	0x70
#define	FIFOSR_FULLEMP	0x80

#define	nsp_idxr	2
#define	nsp_datar	3
#define	nsp_fifodr	4

/* indexed registers */
#define	NSPR_EXTBUSC	0x10

#define	NSPR_CLKDIVR	0x11
#define	CLKDIVR_40M	0x02
#define	CLKDIVR_20M	0x01

#define	NSPR_TERMPWRC	0x13
#define	TERMPWRC_POWON	0x01

#define	NSPR_SCIENR	0x15
#define	SCIENR_SCCHG	0x01
#define	SCIENR_RESEL	0x10
#define	SCIENR_FIFO	0x20
#define	SCIENR_RST	0x40

#define	NSPR_IRQPHS	0x16
#define	IRQPHS_LMSG	0x01
#define	IRQPHS_LIO	0x02
#define	IRQPHS_LCD	0x04
#define	IRQPHS_LBF	0x08
#define	IRQPHS_PCHG	0x10
#define	IRQPHS_RSEL	0x20
#define	IRQPHS_FIFO	0x40
#define	IRQPHS_RST	0x80
#define	IRQPHS_PHMASK   (IRQPHS_LCD | IRQPHS_LMSG | IRQPHS_LIO)

#define	NSPR_TIMERCNT	0x17

#define NSPR_SCBUSCR	0x18
#define	SCBUSCR_SEL	0x01
#define	SCBUSCR_RST	0x02
#define	SCBUSCR_DOUT	0x04
#define	SCBUSCR_ATN	0x08
#define	SCBUSCR_ACK	0x10
#define	SCBUSCR_BSY	0x20
#define	SCBUSCR_ADIR	0x40
#define	SCBUSCR_ACKEN	0x80

#define	NSPR_SCBUSMON	0x19
#define	SCBUSMON_MSG	0x01
#define	SCBUSMON_IO	0x02
#define	SCBUSMON_CD	0x04
#define	SCBUSMON_BSY	0x08
#define	SCBUSMON_ACK	0x10
#define	SCBUSMON_REQ	0x20
#define	SCBUSMON_SEL	0x40
#define SCBUSMON_ATN	0x80

#define	NSPR_SETARBIT	0x1A

#define	NSPR_ARBITS	0x1A
#define	ARBITS_EXEC	0x01
#define	ARBITS_CLR	0x02
#define	ARBITS_WIN	0x02
#define	ARBITS_FAIL	0x04
#define	ARBITS_RESEL	0x08

#define	NSPR_PARITYR	0x1B	/* (W/R) */
#define	PARITYR_ENABLE	0x01
#define	PARITYR_CLEAR	0x02
#define	PARITYR_PE	0x02

#define	NSPR_CMDCR	0x1C	/* (W) */
#define	CMDCR_PTCLR	0x01
#define	CMDCR_EXEC	0x02

#define	NSPR_RESELR	0x1C	/* (R) */
#define	NSPR_CMDDR	0x1D	/* (W/R) */

#define	NSPR_PTCLRR	0x1E	/* (W) */
#define	PTCLRR_PT	0x01
#define	PTCLRR_ACK	0x02
#define	PTCLRR_REQ	0x04
#define	PTCLRR_HOST	0x08
#define	PTCLRR_RSS	0x30
#define	PTCLRR_RSS_ACK	0x00
#define	PTCLRR_RSS_REQ	0x10
#define	PTCLRR_RSS_HOST	0x20

#define	NSPR_XFERCR	0x1E	/* (R) */

#define	NSPR_XFERMR	0x20
#define	XFERMR_MEM8	0x01
#define	XFERMR_MEM32	0x02
#define	XFERMR_ADR24	0x04
#define	XFERMR_ADR32	0x08
#define	XFERMR_IO8	0x10
#define	XFERMR_IO32	0x20
#define	XFERMR_XEN	0x40
#define	XFERMR_FIFOEN	0x80

#define	NSPR_SYNCR	0x21
#define	SYNCR_OFFM	0x0f
#define	SYNCR_PERM	0xf0
#define	SYNCR_PERS	4

#define	NSPR_DATA	0x22
#define	NSPR_DATAACK	0x23
#define	NSPR_OCR	0x26
#define	OCR_ROMEN	0x01
#define	OCR_TERMPWROUT	0x02
#define	OCR_TERMPWRS	0x04

#define NSPR_ACKWIDTH	0x27

/* SCBUSMON phase defs */
#define	SCBUSMON_FREE	0
#define	SCBUSMON_CMD \
	(SCBUSMON_BSY | SCBUSMON_CD | SCBUSMON_REQ)
#define	SCBUSMON_MSGIN \
	(SCBUSMON_BSY | SCBUSMON_MSG | SCBUSMON_IO | SCBUSMON_CD | SCBUSMON_REQ)
#define	SCBUSMON_MSGOUT \
	(SCBUSMON_BSY | SCBUSMON_MSG | SCBUSMON_CD | SCBUSMON_REQ)
#define	SCBUSMON_DATAIN \
	(SCBUSMON_BSY | SCBUSMON_IO | SCBUSMON_REQ)
#define	SCBUSMON_DATAOUT \
	(SCBUSMON_BSY | SCBUSMON_REQ)
#define	SCBUSMON_STATUS \
	(SCBUSMON_BSY | SCBUSMON_IO | SCBUSMON_CD | SCBUSMON_REQ)
#define	SCBUSMON_RESELECT \
	(SCBUSMON_SEL | SCBUSMON_IO)
#define	SCBUSMON_PHMASK \
	(SCBUSMON_SEL | SCBUSMON_CD | SCBUSMON_MSG | SCBUSMON_IO)

/* Data phase */
#define	NSP_IS_PHASE_DATA(ph) \
	((((ph) & SCBUSMON_PHMASK) & ~SCBUSMON_IO) == 0)
#define	NSP_IS_IRQPHS_DATA(ph) \
	((((ph) & IRQPHS_PHMASK) & ~SCBUSMON_IO) == 0)

/* SCSI phase */
#define	PHASE_CMD	(SCBUSMON_CMD & SCBUSMON_PHMASK)
#define	PHASE_DATAIN	(SCBUSMON_DATAIN & SCBUSMON_PHMASK)
#define	PHASE_DATAOUT	(SCBUSMON_DATAOUT & SCBUSMON_PHMASK)
#define	PHASE_STATUS	(SCBUSMON_STATUS & SCBUSMON_PHMASK)
#define	PHASE_MSGIN	(SCBUSMON_MSGIN & SCBUSMON_PHMASK)
#define	PHASE_MSGOUT	(SCBUSMON_MSGOUT & SCBUSMON_PHMASK)
#define	PHASE_SEL	(SCBUSMON_SEL | SCBUSMON_IO)

#define	IRQPHS_CMD	(IRQPHS_LCD)
#define	IRQPHS_DATAIN	(IRQPHS_LIO)
#define	IRQPHS_DATAOUT	(0)
#define	IRQPHS_STATUS	(IRQPHS_LCD | IRQPHS_LIO)
#define	IRQPHS_MSGIN	(IRQPHS_LCD | IRQPHS_LMSG | IRQPHS_LIO)
#define	IRQPHS_MSGOUT	(IRQPHS_LCD | IRQPHS_LMSG)

/* Size */
#define	NSP_MEMSIZE	NBPG
#define	NSP_IOSIZE	16
#define	NSP_BUFFER_SIZE	512
#endif	/* !_NSPREG_H_ */
OpenPOWER on IntegriCloud