xref: /netbsd-src/sys/dev/pci/pm2reg.h (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: pm2reg.h,v 1.4 2010/03/16 21:27:02 macallan Exp $	*/
2 
3 /*
4  * Copyright (c) 2009 Michael Lorenz
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  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 /*
29  * register definitions for Permedia 2 graphics controllers
30  */
31 
32 
33 #ifndef PM2_REG_H
34 #define PM2_REG_H
35 
36 #define PM2_RESET	0x00000000	/* any write initiates a chip reset */
37 #define		PM2_RESET_BUSY	0x80000000	/* reset in progress */
38 
39 #define PM2_INPUT_FIFO_SPACE	0x00000018
40 #define PM2_OUTPUT_FIFO_WORDS	0x00000020
41 
42 #define PM2_APERTURE1_CONTROL	0x00000050
43 #define PM2_APERTURE2_CONTROL	0x00000058
44 #define		PM2_AP_BYTESWAP		0x00000001
45 #define		PM2_AP_HALFWORDSWAP	0x00000002
46 #define		PM2_AP_PACKED16_EN	0x00000008
47 #define		PM2_AP_PACKED16_READ_B	0x00000010 /* Buffer A otherwise */
48 #define		PM2_AP_PACKED16_WRITE_B	0x00000020 /* A otherwise */
49 #define		PM2_AP_PACKED16_WRT_DBL	0x00000040
50 #define		PM2_AP_PACKED16_R31	0x00000080 /* read buffer selected by
51 						    * visibility bit in memory
52 						    */
53 #define		PM2_AP_SVGA		0x00000100
54 #define		PM2_AP_ROM		0x00000200
55 
56 #define PM2_BYPASS_MASK		0x00001100
57 #define PM2_FB_WRITE_MASK	0x00001140
58 
59 #define PM2_OUTPUT_FIFO		0x00002000
60 
61 #define PM2_SCREEN_BASE		0x00003000 /* in 64bit units */
62 #define PM2_SCREEN_STRIDE	0x00003008 /* in 64bit units */
63 
64 /* RAMDAC */
65 #define PM2_DAC_PAL_WRITE_IDX	0x00004000
66 #define PM2_DAC_DATA		0x00004008
67 #define PM2_DAC_MASK		0x00004010
68 #define PM2_DAC_PAL_READ	0x00004018
69 #define PM2_DAC_CURSOR_PAL	0x00004020
70 #define PM2_DAC_CURSOR_DATA	0x00004028
71 #define PM2_DAC_INDEX_DATA	0x00004050
72 #define PM2_DAC_CURSOR_RAM	0x00004058
73 #define PM2_DAC_CURSOR_X_LOW	0x00004060
74 #define PM2_DAC_CURSOR_X_HIGH	0x00004068
75 #define PM2_DAC_CURSOR_Y_LOW	0x00004070
76 #define PM2_DAC_CURSOR_Y_HIGH	0x00004078
77 
78 /* drawing engine */
79 #define PM2_RE_STARTXDOM	0x00008000
80 #define	PM2_RE_DXDOM		0x00008008
81 #define PM2_RE_STARTXSUB	0x00008010
82 #define PM2_RE_STARTY		0x00008020
83 #define PM2_RE_DY		0x00008028
84 #define PM2_RE_COUNT		0x00008030
85 #define PM2_RE_BITMASK		0x00008068 /* for colour expansion */
86 #define PM2_RE_COLOUR		0x000087f0
87 #define PM2_RE_CONFIG		0x00008d90
88 #define		PM2RECFG_READ_SRC	0x00000001
89 #define		PM2RECFG_READ_DST	0x00000002
90 #define		PM2RECFG_PACKED		0x00000004
91 #define		PM2RECFG_WRITE_EN	0x00000008
92 #define		PM2RECFG_DDA_EN		0x00000010
93 #define		PM2RECFG_ROP_EN		0x00000020
94 #define		PM2RECFG_ROP_MASK	0x000003c0
95 #define		PM2RECFG_ROP_SHIFT	6
96 
97 #define PM2_RE_CONST_COLOUR	0x000087e8
98 #define PM2_RE_BUFFER_OFFSET	0x00008a90 /* distance between src and dst */
99 #define PM2_RE_SOURCE_BASE	0x00008d80 /* write after windowbase */
100 #define PM2_RE_SOURCE_DELTA	0x00008d88 /* offset in coordinates */
101 #define PM2_RE_SOURCE_OFFSET	0x00008a88 /* same in pixels */
102 #define PM2_RE_WINDOW_BASE	0x00008ab0
103 #define PM2_RE_WINDOW_ORIGIN	0x000081c8
104 #define PM2_RE_WRITE_MODE	0x00008ab8
105 #define		PM2WM_WRITE_EN		0x00000001
106 #define		PM2WM_TO_HOST		0x00000008
107 
108 #define PM2_RE_MODE		0x000080a0
109 #define		PM2RM_MASK_MIRROR	0x00000001 /* mask is right-to-left */
110 #define		PM2RM_MASK_INVERT	0x00000002
111 #define		PM2RM_MASK_OPAQUE	0x00000040 /* BG in TEXEL0 */
112 #define		PM2RM_MASK_SWAP		0x00000180
113 #define		PM2RM_MASK_PAD		0x00000200 /* new line new mask */
114 #define		PM2RM_MASK_OFFSET	0x00007c00
115 #define		PM2RM_HOST_SWAP		0x00018000
116 #define		PM2RM_LIMITS_EN		0x00040000
117 #define		PM2RM_MASK_REL_X	0x00080000
118 
119 #define PM2_RE_RECT_START	0x000080d0
120 #define PM2_RE_RECT_SIZE	0x000080d8
121 #define PM2_RE_RENDER		0x00008038 /* write starts command */
122 #define		PM2RE_STIPPLE		0x00000001
123 #define		PM2RE_FASTFILL		0x00000008
124 #define		PM2RE_LINE		0x00000000
125 #define		PM2RE_TRAPEZOID		0x00000040
126 #define		PM2RE_POINT		0x00000080
127 #define		PM2RE_RECTANGLE		0x000000c0
128 #define		PM2RE_SYNC_ON_MASK	0x00000800 /* wait for write to bitmask
129 						      register */
130 #define		PM2RE_SYNC_ON_HOST	0x00001000 /* wait for host data */
131 #define		PM2RE_TEXTURE_EN	0x00002000
132 #define		PM2RE_INC_X		0x00200000 /* drawing direction */
133 #define		PM2RE_INC_Y		0x00400000
134 #define	PM2_RE_TEXEL0		0x00008600 /* background colour */
135 #define PM2_RE_STATUS		0x00000068
136 #define		PM2ST_BUSY	0x80000000
137 #define PM2_RE_SYNC		0x00008c40
138 #define PM2_RE_FILTER_MODE	0x00008c00
139 #define		PM2FLT_PASS_SYNC	0x00000400
140 #define PM2_RE_DDA_MODE		0x000087e0
141 #define		PM2DDA_ENABLE		0x00000001
142 #define		PM2DDA_GOURAUD		0x00000002 /* flat otherwise */
143 #define PM2_RE_BLOCK_COLOUR	0x00008ac8
144 #define PM2_RE_STIPPLE_MODE	0x000081a0
145 #define 	PM2ST_ENABLE		0x00000001
146 #define 	PM2ST_XOFFSET_MASK	0x00000380
147 #define 	PM2ST_YOFFSET_MASK	0x00007000
148 #define 	PM2ST_INVERT		0x00020000
149 #define 	PM2ST_MIRROR_X		0x00040000
150 #define 	PM2ST_MIRROR_Y		0x00080000
151 #define 	PM2ST_OPAQUE		0x00100000
152 #define PM2_HW_WRITEMASK	0x00008ac0
153 #define PM2_SW_WRITEMASK	0x00008820
154 #define PM2_FB_READMODE		0x00008a80
155 #define		PM2FB_PP0_MASK	0x00000007
156 #define		PM2FB_PP1_MASK	0x00000038
157 #define		PM2FB_PP2_MASK	0x000001c0
158 #define		PM2FB_READ_SRC	0x00000200
159 #define		PM2FB_READ_DST	0x00000400
160 #define		PM2FB_FBCOLOR	0x00008000 /* for uploads */
161 #define		PM2FB_ORIGIN_BL	0x00010000 /* window origin, TL otherwise */
162 #define		PM2FB_PATCH_EN	0x00020000
163 #define		PM2FB_PACKED	0x00040000
164 #define		PM2FB_OFFSET_M	0x00380000
165 #define		PM2FB_PM_PATCH	0x00000000
166 #define		PM2FB_PM_SUB	0x02000000
167 #define		PM2FB_PM_SUBP	0x04000000
168 
169 #define PM2_RE_SCISSOR_MODE	0x00008180
170 #define		PM2SC_USER_EN		0x00000001 /* from scissor reg */
171 #define		PM2SC_SCREEN_EN		0x00000002 /* screensize reg */
172 #define PM2_RE_SCREENSIZE	0x00008198
173 #define PM2_RE_SCISSOR_MINYX	0x00008188
174 #define PM2_RE_SCISSOR_MAXYX	0x00008190
175 #define PM2_RE_TEXMAP_FORMAT	0x00008588
176 #define PM2_RE_DITHER_MODE	0x00008818
177 #define PM2_RE_ALPHA_MODE	0x00008810
178 #define PM2_RE_TEX_COLOUR_MODE	0x00008680
179 #define PM2_RE_TEX_READ_MODE	0x00008670
180 #define PM2_RE_TEX_LUT_MODE	0x00008678
181 #define PM2_RE_TEX_ADDRESS_MODE	0x00008380
182 #define PM2_RE_YUV_MODE		0x00008f00
183 #define PM2_RE_DEPTH_MODE	0x000089a0
184 #define PM2_RE_DEPTH		0x000089a8
185 #define PM2_RE_STENCIL_MODE	0x00008988
186 #define PM2_RE_ROP_MODE		0x00008828
187 
188 #endif /* PM2_REG_H */
189