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