xref: /netbsd-src/sys/arch/sgimips/gio/newportreg.h (revision 01a177fdbfebecc66494d8566902d23e79ded635)
1 /*	$NetBSD: newportreg.h,v 1.9 2019/05/16 23:42:23 macallan Exp $	*/
2 
3 /*
4  * Copyright (c) 2003 Ilpo Ruotsalainen
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * <<Id: LICENSE_GC,v 1.1 2001/10/01 23:24:05 cgd Exp>>
30  */
31 
32 #ifndef _ARCH_SGIMIPS_GIO_NEWPORTREG_H_
33 #define _ARCH_SGIMIPS_GIO_NEWPORTREG_H_
34 
35 /* REX3 */
36 
37 #define NEWPORT_REX3_OFFSET		0xf0000
38 
39 #define REX3_REG_DRAWMODE1		0x0000
40 #define  REX3_DRAWMODE1_PLANES_MASK	0x00000007
41 #define   REX3_DRAWMODE1_PLANES_NONE	0x00000000
42 #define   REX3_DRAWMODE1_PLANES_RGB	0x00000001
43 #define   REX3_DRAWMODE1_PLANES_CI	0x00000001
44 #define   REX3_DRAWMODE1_PLANES_RGBA	0x00000002
45 #define   REX3_DRAWMODE1_PLANES_OLAY	0x00000004
46 #define   REX3_DRAWMODE1_PLANES_PUP	0x00000005
47 #define   REX3_DRAWMODE1_PLANES_CID	0x00000006
48 #define  REX3_DRAWMODE1_DD_MASK		0x00000018
49 #define   REX3_DRAWMODE1_DD_DD4		0x00000000
50 #define   REX3_DRAWMODE1_DD_DD8		0x00000008
51 #define   REX3_DRAWMODE1_DD_DD12	0x00000010
52 #define   REX3_DRAWMODE1_DD_DD24	0x00000018
53 #define  REX3_DRAWMODE1_DBLSRC		0x00000020
54 #define  REX3_DRAWMODE1_YFLIP		0x00000040
55 #define  REX3_DRAWMODE1_RWPACKED	0x00000080
56 #define  REX3_DRAWMODE1_HD_MASK		0x00000300
57 #define   REX3_DRAWMODE1_HD_HD4		0x00000000
58 #define   REX3_DRAWMODE1_HD_HD8		0x00000100
59 #define   REX3_DRAWMODE1_HD_HD12	0x00000200
60 #define   REX3_DRAWMODE1_HD_HD24	0x00000300
61 #define  REX3_DRAWMODE1_RWDOUBLE	0x00000400
62 #define  REX3_DRAWMODE1_SWAPENDIAN	0x00000800
63 #define  REX3_DRAWMODE1_COMPARE_MASK	0x00007000
64 #define   REX3_DRAWMODE1_COMPARE_LT	0x00001000
65 #define   REX3_DRAWMODE1_COMPARE_EQ	0x00002000
66 #define   REX3_DRAWMODE1_COMPARE_GT	0x00004000
67 #define  REX3_DRAWMODE1_RGBMODE		0x00008000
68 #define  REX3_DRAWMODE1_DITHER		0x00010000
69 #define  REX3_DRAWMODE1_FASTCLEAR	0x00020000
70 #define  REX3_DRAWMODE1_BLEND		0x00040000
71 #define  REX3_DRAWMODE1_SFACTOR_MASK	0x00380000
72 #define   REX3_DRAWMODE1_SFACTOR_ZERO	0x00000000
73 #define   REX3_DRAWMODE1_SFACTOR_ONE	0x00080000
74 #define   REX3_DRAWMODE1_SFACTOR_DC	0x00100000
75 #define   REX3_DRAWMODE1_SFACTOR_MDC	0x00180000
76 #define   REX3_DRAWMODE1_SFACTOR_SA	0x00200000
77 #define   REX3_DRAWMODE1_SFACTOR_MSA	0x00280000
78 #define  REX3_DRAWMODE1_DFACTOR_MASK	0x01c00000
79 #define   REX3_DRAWMODE1_DFACTOR_ZERO	0x00000000
80 #define   REX3_DRAWMODE1_DFACTOR_ONE	0x00400000
81 #define   REX3_DRAWMODE1_DFACTOR_SC	0x00800000
82 #define   REX3_DRAWMODE1_DFACTOR_MSC	0x00c00000
83 #define   REX3_DRAWMODE1_DFACTOR_SA	0x01000000
84 #define   REX3_DRAWMODE1_DFACTOR_MSA	0x01400000
85 #define  REX3_DRAWMODE1_BACKBLEND	0x02000000
86 #define  REX3_DRAWMODE1_PREFETCH	0x04000000
87 #define  REX3_DRAWMODE1_BLENDALPHA	0x08000000
88 #define  REX3_DRAWMODE1_LOGICOP_MASK	0xf0000000
89 #define   REX3_DRAWMODE1_LO_ZERO	0x00000000
90 #define   REX3_DRAWMODE1_LO_AND		0x10000000
91 #define   REX3_DRAWMODE1_LO_ANDR	0x20000000
92 #define   REX3_DRAWMODE1_LO_SRC		0x30000000
93 #define   REX3_DRAWMODE1_LO_ANDI	0x40000000
94 #define   REX3_DRAWMODE1_LO_DST		0x50000000
95 #define   REX3_DRAWMODE1_LO_XOR		0x60000000
96 #define   REX3_DRAWMODE1_LO_OR		0x70000000
97 #define   REX3_DRAWMODE1_LO_NOR		0x80000000
98 #define   REX3_DRAWMODE1_LO_XNOR	0x90000000
99 #define   REX3_DRAWMODE1_LO_NDST	0xa0000000
100 #define   REX3_DRAWMODE1_LO_ORR		0xb0000000
101 #define   REX3_DRAWMODE1_LO_NSRC	0xc0000000
102 #define   REX3_DRAWMODE1_LO_ORI		0xd0000000
103 #define   REX3_DRAWMODE1_LO_NAND	0xe0000000
104 #define   REX3_DRAWMODE1_LO_ONE		0xf0000000
105 
106 #define REX3_REG_DRAWMODE0		0x0004
107 #define  REX3_DRAWMODE0_OPCODE_MASK	0x00000003
108 #define   REX3_DRAWMODE0_OPCODE_NOOP	0x00000000
109 #define   REX3_DRAWMODE0_OPCODE_READ	0x00000001
110 #define   REX3_DRAWMODE0_OPCODE_DRAW	0x00000002
111 #define   REX3_DRAWMODE0_OPCODE_SCR2SCR	0x00000003
112 #define  REX3_DRAWMODE0_ADRMODE_MASK	0x0000001c
113 #define   REX3_DRAWMODE0_ADRMODE_SPAN	0x00000000
114 #define   REX3_DRAWMODE0_ADRMODE_BLOCK	0x00000004
115 #define   REX3_DRAWMODE0_ADRMODE_I_LINE	0x00000008
116 #define   REX3_DRAWMODE0_ADRMODE_F_LINE	0x0000000c
117 #define   REX3_DRAWMODE0_ADRMODE_A_LINE	0x00000010
118 #define  REX3_DRAWMODE0_DOSETUP		0x00000020
119 #define  REX3_DRAWMODE0_COLORHOST	0x00000040
120 #define  REX3_DRAWMODE0_ALPHAHOST	0x00000080
121 #define  REX3_DRAWMODE0_STOPONX		0x00000100
122 #define  REX3_DRAWMODE0_STOPONY		0x00000200
123 #define  REX3_DRAWMODE0_SKIPFIRST	0x00000400
124 #define  REX3_DRAWMODE0_SKIPLAST	0x00000800
125 #define  REX3_DRAWMODE0_ENZPATTERN	0x00001000
126 #define  REX3_DRAWMODE0_ENLSPATTERN	0x00002000
127 #define  REX3_DRAWMODE0_LSADVLAST	0x00004000
128 #define  REX3_DRAWMODE0_LENGTH32	0x00008000
129 #define  REX3_DRAWMODE0_ZPOPAQUE	0x00010000
130 #define  REX3_DRAWMODE0_LSOPAQUE	0x00020000
131 #define  REX3_DRAWMODE0_SHADE		0x00040000
132 #define  REX3_DRAWMODE0_LRONLY		0x00080000
133 #define  REX3_DRAWMODE0_XYOFFSET	0x00100000
134 #define  REX3_DRAWMODE0_CICLAMP		0x00200000
135 #define  REX3_DRAWMODE0_ENDPTFILTER	0x00400000
136 #define  REX3_DRAWMODE0_YSTRIDE		0x00800000
137 #define REX3_REG_LSMODE			0x0008
138 
139 #define REX3_REG_LSPATTERN		0x000c
140 
141 #define REX3_REG_LSPATSAVE		0x0010
142 
143 #define REX3_REG_ZPATTERN		0x0014
144 
145 #define REX3_REG_COLORBACK		0x0018
146 #define REX3_REG_COLORVRAM		0x001c
147 
148 #define REX3_REG_ALPHAREF		0x0020
149 #define REX3_REG_STALL0			0x0024	/* stall until engine is idle */
150 
151 #define REX3_REG_SMASK0X		0x0028	/* min/max 16.16 */
152 #define REX3_REG_SMASK0Y		0x002c	/* min/max 16.16 */
153 
154 #define REX3_REG_SETUP			0x0030
155 
156 #define REX3_REG_XSTART			0x0100
157 
158 #define REX3_REG_XYMOVE			0x0114
159 #define  REX3_XYMOVE_XSHIFT		16
160 
161 #define REX3_REG_XSTARTI		0x0148
162 
163 #define REX3_REG_XYSTARTI		0x0150
164 #define  REX3_XYSTARTI_XSHIFT		16
165 
166 #define REX3_REG_XYENDI			0x0154
167 #define  REX3_XYENDI_XSHIFT		16
168 
169 #define REX3_REG_WRMASK			0x0220
170 
171 #define REX3_REG_COLORI			0x0224
172 
173 #define REX3_REG_HOSTRW0		0x0230
174 #define REX3_REG_HOSTRW1		0x0234
175 
176 #define REX3_REG_DCBMODE		0x0238
177 #define  REX3_DCBMODE_DW_MASK		0x00000003
178 #define   REX3_DCBMODE_DW_4		0x00000000
179 #define   REX3_DCBMODE_DW_1		0x00000001
180 #define   REX3_DCBMODE_DW_2		0x00000002
181 #define   REX3_DCBMODE_DW_3		0x00000003
182 #define  REX3_DCBMODE_ENDATAPACK	0x00000004
183 #define  REX3_DCBMODE_ENCRSINC		0x00000008
184 #define  REX3_DCBMODE_DCBCRS_MASK	0x00000070
185 #define   REX3_DCBMODE_DCBCRS_SHIFT	4
186 #define  REX3_DCBMODE_DCBADDR_MASK	0x00000780
187 #define   REX3_DCBMODE_DCBADDR_SHIFT	7
188 #define  REX3_DCBMODE_ENSYNCACK		0x00000800
189 #define  REX3_DCBMODE_ENASYNCACK	0x00001000
190 #define  REX3_DCBMODE_CSWIDTH_MASK	0x0003e000
191 #define  REX3_DCBMODE_CSWIDTH_SHIFT	13
192 #define  REX3_DCBMODE_CSHOLD_MASK	0x007c0000
193 #define  REX3_DCBMODE_CSHOLD_SHIFT	18
194 #define  REX3_DCBMODE_CSSETUP_MASK	0x0f800000
195 #define  REX3_DCBMODE_CSSETUP_SHIFT	23
196 #define  REX3_DCBMODE_SWAPENDIAN	0x10000000
197 
198 #define REX3_REG_DCBDATA0		0x0240
199 #define REX3_REG_DCBDATA1		0x0244
200 
201 /* Not really a register, but in the same space */
202 #define REX3_REG_GO			0x0800
203 
204 /* clipping regions, enable/disable in REG_CLIPMODE */
205 #define REX3_REG_SMASK1X		0x1300	/* min/max 16.16 */
206 #define REX3_REG_SMASK1Y		0x1304	/* min/max 16.16 */
207 #define REX3_REG_SMASK2X		0x1308	/* min/max 16.16 */
208 #define REX3_REG_SMASK2Y		0x130c	/* min/max 16.16 */
209 #define REX3_REG_SMASK3X		0x1310	/* min/max 16.16 */
210 #define REX3_REG_SMASK3Y		0x1314	/* min/max 16.16 */
211 #define REX3_REG_SMASK4X		0x1318	/* min/max 16.16 */
212 #define REX3_REG_SMASK4Y		0x131c	/* min/max 16.16 */
213 
214 #define REX3_REG_TOPSCAN		0x1320
215 #define REX3_REG_XYWIN			0x1324
216 #define REX3_REG_CLIPMODE		0x1328
217 #define  REX3_CLIPMODE_SMASK0		0x0001
218 #define  REX3_CLIPMODE_SMASK1		0x0002
219 #define  REX3_CLIPMODE_SMASK2		0x0004
220 #define  REX3_CLIPMODE_SMASK3		0x0008
221 #define  REX3_CLIPMODE_SMASK4		0x0010
222 #define  REX3_CLIPMODE_CIDMATCH0	0x0200
223 #define  REX3_CLIPMODE_CIDMATCH1	0x0400
224 #define  REX3_CLIPMODE_CIDMATCH2	0x0800
225 #define  REX3_CLIPMODE_CIDMATCH3	0x1000
226 
227 #define REX3_REG_STALL1			0x132c
228 #define REX3_REG_CONFIG			0x1330
229 
230 #define REX3_REG_STATUS			0x1338
231 #define  REX3_STATUS_GFXBUSY		0x00000008
232 #define  REX3_STATUS_PIPELEVEL_MASK	0x00001f80
233 
234 /* VC2 */
235 
236 #define VC2_DCBCRS_INDEX		0
237 #define VC2_DCBCRS_IREG			1
238 #define VC2_DCBCRS_RAM			3
239 
240 #define VC2_IREG_VIDEO_ENTRY		0x00
241 
242 #define VC2_IREG_CURSOR_ENTRY		0x01
243 
244 #define VC2_IREG_CURSOR_X		0x02
245 
246 #define VC2_IREG_CURSOR_Y		0x03
247 
248 #define VC2_IREG_SCANLINE_LENGTH	0x06
249 
250 #define VC2_IREG_RAM_ADDRESS		0x07
251 
252 #define VC2_IREG_CONTROL		0x10
253 #define  VC2_CONTROL_VINTR_ENABLE	0x0001
254 #define  VC2_CONTROL_DISPLAY_ENABLE	0x0002
255 #define  VC2_CONTROL_VTIMING_ENABLE	0x0004
256 #define  VC2_CONTROL_DID_ENABLE		0x0008
257 #define  VC2_CONTROL_CURSORFUNC_ENABLE	0x0010
258 #define  VC2_CONTROL_GENSYNC_ENABLE	0x0020
259 #define  VC2_CONTROL_INTERLACE		0x0040
260 #define  VC2_CONTROL_CURSOR_ENABLE	0x0080
261 #define  VC2_CONTROL_CROSSHAIR_CURSOR	0x0100
262 #define  VC2_CONTROL_LARGE_CURSOR	0x0200
263 #define  VC2_CONTROL_GENLOCK_1		0x0400
264 
265 #define VC2_IREG_CONFIG			0x1f
266 #define VC2_IREG_CONFIG_SOFTRESET	0x01	/* active low */
267 #define VC2_IREG_CONFIG_SLOWCLOCK	0x02
268 #define VC2_IREG_CONFIG_CURSORERROR	0x04
269 #define VC2_IREG_CONFIG_DIDERROR	0x08
270 #define VC2_IREG_CONFIG_VTGERROR	0x10
271 #define VC2_IREG_CONFIG_REVISION	0x70
272 
273 /* CMAP */
274 
275 #define CMAP_DCBCRS_ADDRESS_LOW		0
276 #define CMAP_DCBCRS_ADDRESS_HIGH	1
277 #define CMAP_DCBCRS_PALETTE		2
278 #define CMAP_DCBCRS_REVISION		6
279 
280 /* XMAP9 */
281 
282 #define XMAP9_DCBCRS_CONFIG		0
283 #define  XMAP9_CONFIG_PUP_ENABLE	0x01
284 #define  XMAP9_CONFIG_ODD_PIXEL		0x02
285 #define  XMAP9_CONFIG_8BIT_SYSTEM	0x04
286 #define  XMAP9_CONFIG_SLOW_PCLK		0x08
287 #define  XMAP9_CONFIG_RGBMAP_CI		0x00
288 #define  XMAP9_CONFIG_RGBMAP_0		0x10
289 #define  XMAP9_CONFIG_RGBMAP_1		0x20
290 #define  XMAP9_CONFIG_RGBMAP_2		0x30
291 #define  XMAP9_CONFIG_EXPRESS_MODE	0x40
292 #define  XMAP9_CONFIG_VIDEO_ENABLE	0x80
293 #define XMAP9_DCBCRS_REVISION		1
294 #define XMAP9_DCBCRS_FIFOAVAIL		2
295 #define XMAP9_DCBCRS_CURSOR_CMAP	3
296 #define XMAP9_DCBCRS_PUP_CMAP		4
297 #define XMAP9_DCBCRS_MODE_SETUP		5
298 #define  XMAP9_MODE_GAMMA_BYPASS	0x000004
299 #define  XMAP9_MODE_PIXMODE_CI		0x000000
300 #define  XMAP9_MODE_PIXMODE_RGB0	0x000100
301 #define  XMAP9_MODE_PIXMODE_RGB1	0x000200
302 #define  XMAP9_MODE_PIXMODE_RGB2	0x000300
303 #define  XMAP9_MODE_PIXSIZE_8BPP	0x000400
304 #define  XMAP9_MODE_PIXSIZE_24BPP	0x000c00
305 #define XMAP9_DCBCRS_MODE_SELECT	7
306 
307 /* DCB addresses */
308 
309 #define NEWPORT_DCBADDR_VC2		0
310 #define NEWPORT_DCBADDR_CMAP_BOTH	1
311 #define NEWPORT_DCBADDR_CMAP_0		2
312 #define NEWPORT_DCBADDR_CMAP_1		3
313 #define NEWPORT_DCBADDR_XMAP_BOTH	4
314 #define NEWPORT_DCBADDR_XMAP_0		5
315 #define NEWPORT_DCBADDR_XMAP_1		6
316 #define NEWPORT_DCBADDR_RAMDAC		7
317 #define NEWPORT_DCBADDR_VIDEO_CC1	8
318 #define NEWPORT_DCBADDR_VIDEO_AB1	9
319 
320 #endif
321