1 /* $NetBSD: machfbreg.h,v 1.1 2002/10/24 18:15:57 junyoung Exp $ */
4 * Copyright 2005, 2006 by Michael Lorenz.
6 * Permission to use, copy, modify, distribute, and sell this software and
7 * its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appear in all copies and that
9 * both that copyright notice and this permission notice appear in
10 * supporting documentation, and that the name of Kevin E. Martin not be
11 * used in advertising or publicity pertaining to distribution of the
12 * software without specific, written prior permission. Kevin E. Martin
13 * makes no representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied warranty.
16 * KEVIN E. MARTIN, RICKARD E. FAITH, AND TIAGO GONS DISCLAIM ALL
17 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
19 * AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
28 * stolen wholesale from Andreas Drewke's (andreas_dr@gmx.de) Voodoo3 driver
35 /* membase0 register offsets */
38 #define SIPMONITOR 0x08
39 #define LFBMEMORYCONFIG 0x0c
40 #define MISCINIT0 0x10
41 #define MISCINIT1 0x14
42 #define DRAMINIT0 0x18
43 #define DRAMINIT1 0x1c
45 #define TMUGBEINIT 0x24
48 #define DRAMCOMMAND 0x30
52 #define PLLCTRL0 0x40 /* video clock */
53 #define PLLCTRL1 0x44 /* memory clock */
55 /* PLL ctrl 0 and 1 registers:
56 * freq = (( N + 2 ) * Fref) / (( M + 2 ) * ( 2^K ))
57 * with Fref usually 14.31818MHz
63 #define PLLCTRL2 0x48 /* test modes for AGP */
66 #define DAC_MODE_1_2 0x1 /* DAC in 2:1 mode. 1:1 mode when 0 */
67 #define DAC_MODE_LOCK_VSYNC 0x02 /* lock vsync */
68 #define DAC_MODE_VSYNC_VAL 0x04 /* vsync output when locked */
69 #define DAC_MODE_LOCK_HSYNC 0x08 /* lock hsync */
70 #define DAC_MODE_HSYNC_VAL 0x10 /* hsync output when locked */
74 #define RGBMAXDELTA 0x58
75 #define VIDPROCCFG 0x5c
76 #define HWCURPATADDR 0x60
80 #define VIDINFORMAT 0x70
81 #define VIDINSTATUS 0x74
82 #define VIDSERPARPORT 0x78
84 #define VSP_TVOUT_RESET 0x80000000 /* 0 forces TVout reset */
85 #define VSP_GPIO2_IN 0x40000000
86 #define VSP_GPIO1_OUT 0x20000000
87 #define VSP_VMI_RESET_N 0x10000000 /* 0 forces a VMI reset */
88 #define VSP_SDA1_IN 0x08000000 /* i2c bus on the feature connector */
89 #define VSP_SCL1_IN 0x04000000
90 #define VSP_SDA1_OUT 0x02000000
91 #define VSP_SCL1_OUT 0x01000000
92 #define VSP_ENABLE_IIC1 0x00800000 /* 1 enables I2C bus 1 */
93 #define VSP_SDA0_IN 0x00400000 /* i2c bus on the monitor connector */
94 #define VSP_SCL0_IN 0x00200000
95 #define VSP_SDA0_OUT 0x00100000
96 #define VSP_SCL0_OUT 0x00080000
97 #define VSP_ENABLE_IIC0 0x00040000 /* 1 enables I2C bus 0 */
98 #define VSP_VMI_ADDRESS 0x0003c000 /* mask */
99 #define VSP_VMI_DATA 0x00003fc0 /* mask */
100 #define VSP_VMI_DISABLE 0x00000020 /* 0 enables VMI output */
101 #define VSP_VMI_RDY_N 0x00000010
102 #define VSP_RW_N 0x00000008
103 #define VSP_DS_N 0x00000004
104 #define VSP_CS_N 0x00000002
105 #define VSP_HOST_ENABLE 0x00000001 /* 1 enables VMI host control*/
107 #define VIDINXDELTA 0x7c
108 #define VIDININITERR 0x80
109 #define VIDINYDELTA 0x84
110 #define VIDPIXBUFTHOLD 0x88
111 #define VIDCHRMIN 0x8c
112 #define VIDCHRMAX 0x90
113 #define VIDCURLIN 0x94
114 #define VIDSCREENSIZE 0x98
115 #define VIDOVRSTARTCRD 0x9c
116 #define VIDOVRENDCRD 0xa0
117 #define VIDOVRDUDX 0xa4
118 #define VIDOVRDUDXOFF 0xa8
119 #define VIDOVRDVDY 0xac
122 #define VIDOVRDVDYOFF 0xe0
123 #define VIDDESKSTART 0xe4
124 #define VIDDESKSTRIDE 0xe8
126 * desktop and overlay strides in pixels
127 * desktop stride: reg & 0x00007fff
128 * overlay stride: reg & 0x7fff0000
131 #define VIDINADDR0 0xec
132 #define VIDINADDR1 0xf0
133 #define VIDINADDR2 0xf4
134 #define VIDINSTRIDE 0xf8
135 #define VIDCUROVRSTART 0xfc
136 #define VIDOVERLAYSTARTCOORDS 0x9c
137 #define VIDOVERLAYENDSCREENCOORDS 0xa0
138 #define VIDOVERLAYDUDX 0xa4
139 #define VIDOVERLAYDUDXOFFSETSRCWIDTH 0xa8
140 #define VIDOVERLAYDVDY 0xac
141 #define VIDOVERLAYDVDYOFFSET 0xe0
143 #define SST_3D_OFFSET 0x200000
144 #define SST_3D_LEFTOVERLAYBUF SST_3D_OFFSET+0x250
146 #define V3_STATUS (0x00100000)
147 #define INTCTRL (0x00100000 + 0x04)
148 #define CLIP0MIN (0x00100000 + 0x08)
149 #define CLIP0MAX (0x00100000 + 0x0c)
150 #define DSTBASE (0x00100000 + 0x10)
151 #define DSTFORMAT (0x00100000 + 0x14)
152 #define SRCBASE (0x00100000 + 0x34)
153 #define COMMANDEXTRA_2D (0x00100000 + 0x38)
154 #define CLIP1MIN (0x00100000 + 0x4c)
155 #define CLIP1MAX (0x00100000 + 0x50)
156 #define SRCFORMAT (0x00100000 + 0x54)
157 #define SRCSIZE (0x00100000 + 0x58)
158 #define SRCXY (0x00100000 + 0x5c)
159 #define COLORBACK (0x00100000 + 0x60)
160 #define COLORFORE (0x00100000 + 0x64)
161 #define DSTSIZE (0x00100000 + 0x68)
162 #define DSTXY (0x00100000 + 0x6c)
163 #define COMMAND_2D (0x00100000 + 0x70)
165 * ROP0 : reg & 0xff000000
166 * select clip 1 : 0x00800000
167 * Y pattern offset : 0x00700000
168 * X pattern offset : 0x000e0000
169 * mono transparent : 0x00010000
170 * pattern expand : 0x00002000
171 * stipple line : 0x00001000
172 * adjust dstx : 0x00000800 xdst will contain xdst+xwidth
173 * adjust dsty : 0x00000400
174 * line reversible : 0x00000200
175 * start now : 0x00000100 run immediately instead of wait for launch area
176 * command : 0x0000000f
179 #define LAUNCH_2D (0x00100000 + 0x80)
181 #define COMMAND_3D (0x00200000 + 0x120)
183 /* register bitfields (not all, only as needed) */
185 #define BIT(x) (1UL << (x))
187 /* COMMAND_2D reg. values */
188 #define ROP_COPY 0xcc // src
189 #define ROP_INVERT 0x55 // NOT dst
190 #define ROP_XOR 0x66 // src XOR dst
192 #define AUTOINC_DSTX BIT(10)
193 #define AUTOINC_DSTY BIT(11)
194 #define COMMAND_2D_FILLRECT 0x05
195 #define COMMAND_2D_S2S_BITBLT 0x01 // screen to screen
196 #define COMMAND_2D_H2S_BITBLT 0x03 // host to screen
197 #define SST_2D_GO BIT(8)
199 #define COMMAND_3D_NOP 0x00
200 #define STATUS_RETRACE BIT(6)
201 #define STATUS_BUSY BIT(9)
202 #define MISCINIT1_CLUT_INV BIT(0)
203 #define MISCINIT1_2DBLOCK_DIS BIT(15)
204 #define DRAMINIT0_SGRAM_NUM BIT(26)
205 #define DRAMINIT0_SGRAM_TYPE BIT(27)
206 #define DRAMINIT1_MEM_SDRAM BIT(30)
207 #define VGAINIT0_VGA_DISABLE BIT(0)
208 #define VGAINIT0_EXT_TIMING BIT(1)
209 #define VGAINIT0_8BIT_DAC BIT(2)
210 #define VGAINIT0_EXT_ENABLE BIT(6)
211 #define VGAINIT0_WAKEUP_3C3 BIT(8)
212 #define VGAINIT0_LEGACY_DISABLE BIT(9)
213 #define VGAINIT0_ALT_READBACK BIT(10)
214 #define VGAINIT0_FAST_BLINK BIT(11)
215 #define VGAINIT0_EXTSHIFTOUT BIT(12)
216 #define VGAINIT0_DECODE_3C6 BIT(13)
217 #define VGAINIT0_SGRAM_HBLANK_DISABLE BIT(22)
218 #define VGAINIT1_MASK 0x1fffff
219 #define VIDCFG_VIDPROC_ENABLE BIT(0)
220 #define VIDCFG_CURS_X11 BIT(1)
221 #define VIDCFG_HALF_MODE BIT(4)
222 #define VIDCFG_CHROMA_KEY BIT(5)
223 #define VIDCFG_CHROMA_KEY_INVERSION BIT(6)
224 #define VIDCFG_DESK_ENABLE BIT(7)
225 #define VIDCFG_OVL_ENABLE BIT(8)
226 #define VIDCFG_OVL_NOT_VIDEO_IN BIT(9)
227 #define VIDCFG_CLUT_BYPASS BIT(10)
228 #define VIDCFG_OVL_CLUT_BYPASS BIT(11)
229 #define VIDCFG_OVL_HSCALE BIT(14)
230 #define VIDCFG_OVL_VSCALE BIT(15)
231 #define VIDCFG_OVL_FILTER_SHIFT 16
232 #define VIDCFG_OVL_FILTER_POINT 0
233 #define VIDCFG_OVL_FILTER_2X2 1
234 #define VIDCFG_OVL_FILTER_4X4 2
235 #define VIDCFG_OVL_FILTER_BILIN 3
236 #define VIDCFG_OVL_FMT_SHIFT 21
237 #define VIDCFG_OVL_FMT_RGB565 1
238 #define VIDCFG_OVL_FMT_YUV411 4
239 #define VIDCFG_OVL_FMT_YUYV422 5
240 #define VIDCFG_OVL_FMT_UYVY422 6
241 #define VIDCFG_OVL_FMT_RGB565_DITHER 7
243 #define VIDCFG_2X BIT(26)
244 #define VIDCFG_HWCURSOR_ENABLE BIT(27)
245 #define VIDCFG_PIXFMT_SHIFT 18
246 #define DACMODE_2X BIT(0)
247 #define VIDPROCCFGMASK 0xa2e3eb6c
248 #define VIDPROCDEFAULT 134481025
250 #define VIDCHROMAMIN 0x8c
251 #define VIDCHROMAMAX 0x90
252 #define VIDDESKTOPOVERLAYSTRIDE 0xe8
254 #define CRTC_INDEX 0x3d4
255 #define CRTC_DATA 0x3d5
256 #define SEQ_INDEX 0x3c4
257 #define SEQ_DATA 0x3c5
259 #define GRA_INDEX 0x3ce
260 #define GRA_DATA 0x3cf
265 #define CRTC_HTOTAL 0 /* lower 8 bit of display width in chars -5 */
266 #define CRTC_HDISP_ENABLE_END 1 /* no. of visible chars per line -1 */
267 #define CRTC_HDISP_BLANK_START 2 /* characters per line before blanking */
268 #define CRTC_HDISP_BLANK_END 3 /* no. o blank chars, skew, compatibility read */
269 #define CRTC_HDISP_SYNC_START 4 /* character count when sync becomes active */
270 #define CRTC_HDISP_SYNC_END 5 /* sync end, skew, blank end */
271 #define CRTC_VDISP_TOTAL 6 /* number of scanlines -2 */
272 #define CRTC_OVERFLOW 7 /* various overflow bits */
273 #define CRTC_PRESET_ROW_SCAN 8 /* horizontal soft scrolling in character mode */
274 #define CRTC_MAX_SCAN_LINE 9 /* scanlines per character */
275 #define CRTC_CURSOR_START 10 /* text cursor start line */
276 #define CRTC_CURSOR_END 11 /* text cursor end line */
277 #define CRTC_SCREEN_START_HIGH 12 /* offset in display memory */
278 #define CRTC_SCREEN_START_LOW 13
279 #define CRTC_CURSOR_POS_HIGH 14
280 #define CRTC_CURSOR_POS_LOW 15
281 #define CRTC_VSYNC_START 16
282 #define CRTC_VSYNC_END 17
283 #define CRTC_VDISP_ENABLE_END 18
284 #define CRTC_OFFSET 19 /* textmode stride */
285 #define CRTC_UNDERLINE_LOC 20
286 #define CRTC_VDISP_BLANK_START 21
287 #define CRTC_VDISP_BLANK_END 22
288 #define CRTC_MODE_CONTROL 23
289 #define CRTC_LINE_COMPARE 24
290 #define CRTC_HDISP_EXT 26
291 #define CRTC_VDISP_EXT 27
292 #define CRTC_PCI_READBACK 28
293 #define CRTC_SCRATCH_1 29
294 #define CRTC_SCRATCH_2 30
295 #define CRTC_SCRATCH_3 31
296 #define CRTC_VDISP_PRELOAD_LOW 32
297 #define CRTC_VDISP_PRELOAD_HIGH 33
298 #define CRTC_LATCHES_READBACK 34
299 #define CRTC_ATTR_READBACK 36 /* bit 7 = 0 : attr. ctrlr reads index, 1 -> data */
300 #define CRTC_ATTR_INDEX 38