mga driver, brought over by Jon Smirl
[mesa.git] / src / mesa / drivers / dri / mga / server / mga_reg.h
1 /* $XConsortium: mgareg.h /main/2 1996/10/25 10:33:21 kaleb $ */
2
3
4
5 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.18 2001/09/26 12:59:18 alanh Exp $ */
6
7
8
9 /*
10 * MGA Millennium (MGA2064W) functions
11 * MGA Mystique (MGA1064SG) functions
12 *
13 * Copyright 1996 The XFree86 Project, Inc.
14 *
15 * Authors
16 * Dirk Hohndel
17 * hohndel@XFree86.Org
18 * David Dawes
19 * dawes@XFree86.Org
20 * Contributors:
21 * Guy DESBIEF, Aix-en-provence, France
22 * g.desbief@aix.pacwan.net
23 * MGA1064SG Mystique register file
24 */
25
26
27 #ifndef _MGA_REG_H_
28 #define _MGA_REG_H_
29
30 #define MGAREG_DWGCTL 0x1c00
31 #define MGAREG_MACCESS 0x1c04
32 #define MGA_MACCESS_PW16 0x00000001
33 #define MGA_MACCESS_PW32 0x00000002
34 /* the following is a mystique only register */
35 #define MGAREG_MCTLWTST 0x1c08
36 #define MGAREG_ZORG 0x1c0c
37
38 #define MGAREG_PAT0 0x1c10
39 #define MGAREG_PAT1 0x1c14
40 #define MGAREG_PLNWT 0x1c1c
41
42 #define MGAREG_BCOL 0x1c20
43 #define MGAREG_FCOL 0x1c24
44
45 #define MGAREG_SRC0 0x1c30
46 #define MGAREG_SRC1 0x1c34
47 #define MGAREG_SRC2 0x1c38
48 #define MGAREG_SRC3 0x1c3c
49
50 #define MGAREG_XYSTRT 0x1c40
51 #define MGAREG_XYEND 0x1c44
52
53 #define MGAREG_SHIFT 0x1c50
54 /* the following is a mystique only register */
55 #define MGAREG_DMAPAD 0x1c54
56 #define MGAREG_SGN 0x1c58
57 #define MGAREG_LEN 0x1c5c
58
59 #define MGAREG_AR0 0x1c60
60 #define MGAREG_AR1 0x1c64
61 #define MGAREG_AR2 0x1c68
62 #define MGAREG_AR3 0x1c6c
63 #define MGAREG_AR4 0x1c70
64 #define MGAREG_AR5 0x1c74
65 #define MGAREG_AR6 0x1c78
66
67 #define MGAREG_CXBNDRY 0x1c80
68 #define MGAREG_FXBNDRY 0x1c84
69 #define MGAREG_YDSTLEN 0x1c88
70 #define MGAREG_PITCH 0x1c8c
71
72 #define MGAREG_YDST 0x1c90
73 #define MGAREG_YDSTORG 0x1c94
74 #define MGAREG_YTOP 0x1c98
75 #define MGAREG_YBOT 0x1c9c
76
77 #define MGAREG_CXLEFT 0x1ca0
78 #define MGAREG_CXRIGHT 0x1ca4
79 #define MGAREG_FXLEFT 0x1ca8
80 #define MGAREG_FXRIGHT 0x1cac
81
82 #define MGAREG_XDST 0x1cb0
83
84 #define MGAREG_DR0 0x1cc0
85 #define MGAREG_DR1 0x1cc4
86 #define MGAREG_DR2 0x1cc8
87 #define MGAREG_DR3 0x1ccc
88
89 #define MGAREG_DR4 0x1cd0
90 #define MGAREG_DR5 0x1cd4
91 #define MGAREG_DR6 0x1cd8
92 #define MGAREG_DR7 0x1cdc
93
94 #define MGAREG_DR8 0x1ce0
95 #define MGAREG_DR9 0x1ce4
96 #define MGAREG_DR10 0x1ce8
97 #define MGAREG_DR11 0x1cec
98
99 #define MGAREG_DR12 0x1cf0
100 #define MGAREG_DR13 0x1cf4
101 #define MGAREG_DR14 0x1cf8
102 #define MGAREG_DR15 0x1cfc
103
104 #define MGAREG_SRCORG 0x2cb4
105 #define MGAREG_DSTORG 0x2cb8
106
107 /* add or or this to one of the previous "power registers" to start
108 the drawing engine */
109
110 #define MGAREG_EXEC 0x0100
111
112 #define MGAREG_FIFOSTATUS 0x1e10
113 #define MGAREG_Status 0x1e14
114 #define MGAREG_ICLEAR 0x1e18
115 #define MGAREG_IEN 0x1e1c
116
117 #define MGAREG_VCOUNT 0x1e20
118
119 #define MGAREG_Reset 0x1e40
120
121 #define MGAREG_OPMODE 0x1e54
122
123 /* Warp Registers */
124 #define MGAREG_WIADDR 0x1dc0
125 #define MGAREG_WIADDR2 0x1dd8
126 #define MGAREG_WGETMSB 0x1dc8
127 #define MGAREG_WVRTXSZ 0x1dcc
128 #define MGAREG_WACCEPTSEQ 0x1dd4
129 #define MGAREG_WMISC 0x1e70
130
131 /* OPMODE register additives */
132
133 #define MGAOPM_DMA_GENERAL (0x00 << 2)
134 #define MGAOPM_DMA_BLIT (0x01 << 2)
135 #define MGAOPM_DMA_VECTOR (0x10 << 2)
136
137 /* DWGCTL register additives */
138
139 /* Lines */
140
141 #define MGADWG_LINE_OPEN 0x00
142 #define MGADWG_AUTOLINE_OPEN 0x01
143 #define MGADWG_LINE_CLOSE 0x02
144 #define MGADWG_AUTOLINE_CLOSE 0x03
145
146 /* Trapezoids */
147 #define MGADWG_TRAP 0x04
148 #define MGADWG_TEXTURE_TRAP 0x05
149
150 /* BitBlts */
151
152 #define MGADWG_BITBLT 0x08
153 #define MGADWG_FBITBLT 0x0c
154 #define MGADWG_ILOAD 0x09
155 #define MGADWG_ILOAD_SCALE 0x0d
156 #define MGADWG_ILOAD_FILTER 0x0f
157 #define MGADWG_ILOAD_HIQH 0x07
158 #define MGADWG_ILOAD_HIQHV 0x0e
159 #define MGADWG_IDUMP 0x0a
160
161 /* atype access to WRAM */
162
163 #define MGADWG_RPL ( 0x00 << 4 )
164 #define MGADWG_RSTR ( 0x01 << 4 )
165 #define MGADWG_ZI ( 0x03 << 4 )
166 #define MGADWG_BLK ( 0x04 << 4 )
167 #define MGADWG_I ( 0x07 << 4 )
168
169 /* specifies whether bit blits are linear or xy */
170 #define MGADWG_LINEAR ( 0x01 << 7 )
171
172 /* z drawing mode. use MGADWG_NOZCMP for always */
173
174 #define MGADWG_NOZCMP ( 0x00 << 8 )
175 #define MGADWG_ZE ( 0x02 << 8 )
176 #define MGADWG_ZNE ( 0x03 << 8 )
177 #define MGADWG_ZLT ( 0x04 << 8 )
178 #define MGADWG_ZLTE ( 0x05 << 8 )
179 #define MGADWG_GT ( 0x06 << 8 )
180 #define MGADWG_GTE ( 0x07 << 8 )
181
182 /* use this to force colour expansion circuitry to do its stuff */
183
184 #define MGADWG_SOLID ( 0x01 << 11 )
185
186 /* ar register at zero */
187
188 #define MGADWG_ARZERO ( 0x01 << 12 )
189
190 #define MGADWG_SGNZERO ( 0x01 << 13 )
191
192 #define MGADWG_SHIFTZERO ( 0x01 << 14 )
193
194 /* See table on 4-43 for bop ALU operations */
195
196 /* See table on 4-44 for translucidity masks */
197
198 #define MGADWG_BMONOLEF ( 0x00 << 25 )
199 #define MGADWG_BMONOWF ( 0x04 << 25 )
200 #define MGADWG_BPLAN ( 0x01 << 25 )
201
202 /* note that if bfcol is specified and you're doing a bitblt, it causes
203 a fbitblt to be performed, so check that you obey the fbitblt rules */
204
205 #define MGADWG_BFCOL ( 0x02 << 25 )
206 #define MGADWG_BUYUV ( 0x0e << 25 )
207 #define MGADWG_BU32BGR ( 0x03 << 25 )
208 #define MGADWG_BU32RGB ( 0x07 << 25 )
209 #define MGADWG_BU24BGR ( 0x0b << 25 )
210 #define MGADWG_BU24RGB ( 0x0f << 25 )
211
212 #define MGADWG_PATTERN ( 0x01 << 29 )
213 #define MGADWG_TRANSC ( 0x01 << 30 )
214 #define MGAREG_MISC_WRITE 0x3c2
215 #define MGAREG_MISC_READ 0x3cc
216 #define MGAREG_MISC_IOADSEL (0x1 << 0)
217 #define MGAREG_MISC_RAMMAPEN (0x1 << 1)
218 #define MGAREG_MISC_CLK_SEL_VGA25 (0x0 << 2)
219 #define MGAREG_MISC_CLK_SEL_VGA28 (0x1 << 2)
220 #define MGAREG_MISC_CLK_SEL_MGA_PIX (0x2 << 2)
221 #define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2)
222 #define MGAREG_MISC_VIDEO_DIS (0x1 << 4)
223 #define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5)
224
225 /* MMIO VGA registers */
226 #define MGAREG_SEQ_INDEX 0x1fc4
227 #define MGAREG_SEQ_DATA 0x1fc5
228 #define MGAREG_CRTC_INDEX 0x1fd4
229 #define MGAREG_CRTC_DATA 0x1fd5
230 #define MGAREG_CRTCEXT_INDEX 0x1fde
231 #define MGAREG_CRTCEXT_DATA 0x1fdf
232
233
234
235 /* MGA bits for registers PCI_OPTION_REG */
236 #define MGA1064_OPT_SYS_CLK_PCI ( 0x00 << 0 )
237 #define MGA1064_OPT_SYS_CLK_PLL ( 0x01 << 0 )
238 #define MGA1064_OPT_SYS_CLK_EXT ( 0x02 << 0 )
239 #define MGA1064_OPT_SYS_CLK_MSK ( 0x03 << 0 )
240
241 #define MGA1064_OPT_SYS_CLK_DIS ( 0x01 << 2 )
242 #define MGA1064_OPT_G_CLK_DIV_1 ( 0x01 << 3 )
243 #define MGA1064_OPT_M_CLK_DIV_1 ( 0x01 << 4 )
244
245 #define MGA1064_OPT_SYS_PLL_PDN ( 0x01 << 5 )
246 #define MGA1064_OPT_VGA_ION ( 0x01 << 8 )
247
248 /* MGA registers in PCI config space */
249 #define PCI_MGA_INDEX 0x44
250 #define PCI_MGA_DATA 0x48
251 #define PCI_MGA_OPTION2 0x50
252 #define PCI_MGA_OPTION3 0x54
253
254 #define RAMDAC_OFFSET 0x3c00
255
256 /* TVP3026 direct registers */
257
258 #define TVP3026_INDEX 0x00
259 #define TVP3026_WADR_PAL 0x00
260 #define TVP3026_COL_PAL 0x01
261 #define TVP3026_PIX_RD_MSK 0x02
262 #define TVP3026_RADR_PAL 0x03
263 #define TVP3026_CUR_COL_ADDR 0x04
264 #define TVP3026_CUR_COL_DATA 0x05
265 #define TVP3026_DATA 0x0a
266 #define TVP3026_CUR_RAM 0x0b
267 #define TVP3026_CUR_XLOW 0x0c
268 #define TVP3026_CUR_XHI 0x0d
269 #define TVP3026_CUR_YLOW 0x0e
270 #define TVP3026_CUR_YHI 0x0f
271
272 /* TVP3026 indirect registers */
273
274 #define TVP3026_SILICON_REV 0x01
275 #define TVP3026_CURSOR_CTL 0x06
276 #define TVP3026_LATCH_CTL 0x0f
277 #define TVP3026_TRUE_COLOR_CTL 0x18
278 #define TVP3026_MUX_CTL 0x19
279 #define TVP3026_CLK_SEL 0x1a
280 #define TVP3026_PAL_PAGE 0x1c
281 #define TVP3026_GEN_CTL 0x1d
282 #define TVP3026_MISC_CTL 0x1e
283 #define TVP3026_GEN_IO_CTL 0x2a
284 #define TVP3026_GEN_IO_DATA 0x2b
285 #define TVP3026_PLL_ADDR 0x2c
286 #define TVP3026_PIX_CLK_DATA 0x2d
287 #define TVP3026_MEM_CLK_DATA 0x2e
288 #define TVP3026_LOAD_CLK_DATA 0x2f
289 #define TVP3026_KEY_RED_LOW 0x32
290 #define TVP3026_KEY_RED_HI 0x33
291 #define TVP3026_KEY_GREEN_LOW 0x34
292 #define TVP3026_KEY_GREEN_HI 0x35
293 #define TVP3026_KEY_BLUE_LOW 0x36
294 #define TVP3026_KEY_BLUE_HI 0x37
295 #define TVP3026_KEY_CTL 0x38
296 #define TVP3026_MCLK_CTL 0x39
297 #define TVP3026_SENSE_TEST 0x3a
298 #define TVP3026_TEST_DATA 0x3b
299 #define TVP3026_CRC_LSB 0x3c
300 #define TVP3026_CRC_MSB 0x3d
301 #define TVP3026_CRC_CTL 0x3e
302 #define TVP3026_ID 0x3f
303 #define TVP3026_RESET 0xff
304
305
306 /* MGA1064 DAC Register file */
307 /* MGA1064 direct registers */
308
309 #define MGA1064_INDEX 0x00
310 #define MGA1064_WADR_PAL 0x00
311 #define MGA1064_COL_PAL 0x01
312 #define MGA1064_PIX_RD_MSK 0x02
313 #define MGA1064_RADR_PAL 0x03
314 #define MGA1064_DATA 0x0a
315
316 #define MGA1064_CUR_XLOW 0x0c
317 #define MGA1064_CUR_XHI 0x0d
318 #define MGA1064_CUR_YLOW 0x0e
319 #define MGA1064_CUR_YHI 0x0f
320
321 /* MGA1064 indirect registers */
322 #define MGA1064_DVI_PIPE_CTL 0x03
323 #define MGA1064_CURSOR_BASE_ADR_LOW 0x04
324 #define MGA1064_CURSOR_BASE_ADR_HI 0x05
325 #define MGA1064_CURSOR_CTL 0x06
326 #define MGA1064_CURSOR_COL0_RED 0x08
327 #define MGA1064_CURSOR_COL0_GREEN 0x09
328 #define MGA1064_CURSOR_COL0_BLUE 0x0a
329
330 #define MGA1064_CURSOR_COL1_RED 0x0c
331 #define MGA1064_CURSOR_COL1_GREEN 0x0d
332 #define MGA1064_CURSOR_COL1_BLUE 0x0e
333
334 #define MGA1064_CURSOR_COL2_RED 0x010
335 #define MGA1064_CURSOR_COL2_GREEN 0x011
336 #define MGA1064_CURSOR_COL2_BLUE 0x012
337
338 #define MGA1064_VREF_CTL 0x018
339
340 #define MGA1064_MUL_CTL 0x19
341 #define MGA1064_MUL_CTL_8bits 0x0
342 #define MGA1064_MUL_CTL_15bits 0x01
343 #define MGA1064_MUL_CTL_16bits 0x02
344 #define MGA1064_MUL_CTL_24bits 0x03
345 #define MGA1064_MUL_CTL_32bits 0x04
346 #define MGA1064_MUL_CTL_2G8V16bits 0x05
347 #define MGA1064_MUL_CTL_G16V16bits 0x06
348 #define MGA1064_MUL_CTL_32_24bits 0x07
349
350 #define MGAGDAC_XVREFCTRL 0x18
351 #define MGA1064_PIX_CLK_CTL 0x1a
352 #define MGA1064_PIX_CLK_CTL_CLK_DIS ( 0x01 << 2 )
353 #define MGA1064_PIX_CLK_CTL_CLK_POW_DOWN ( 0x01 << 3 )
354 #define MGA1064_PIX_CLK_CTL_SEL_PCI ( 0x00 << 0 )
355 #define MGA1064_PIX_CLK_CTL_SEL_PLL ( 0x01 << 0 )
356 #define MGA1064_PIX_CLK_CTL_SEL_EXT ( 0x02 << 0 )
357 #define MGA1064_PIX_CLK_CTL_SEL_MSK ( 0x03 << 0 )
358
359 #define MGA1064_GEN_CTL 0x1d
360 #define MGA1064_MISC_CTL 0x1e
361 #define MGA1064_MISC_CTL_DAC_POW_DN ( 0x01 << 0 )
362 #define MGA1064_MISC_CTL_VGA ( 0x01 << 1 )
363 #define MGA1064_MISC_CTL_DIS_CON ( 0x03 << 1 )
364 #define MGA1064_MISC_CTL_MAFC ( 0x02 << 1 )
365 #define MGA1064_MISC_CTL_VGA8 ( 0x01 << 3 )
366 #define MGA1064_MISC_CTL_DAC_RAM_CS ( 0x01 << 4 )
367
368 #define MGA1064_GEN_IO_CTL 0x2a
369 #define MGA1064_GEN_IO_DATA 0x2b
370 #define MGA1064_SYS_PLL_M 0x2c
371 #define MGA1064_SYS_PLL_N 0x2d
372 #define MGA1064_SYS_PLL_P 0x2e
373 #define MGA1064_SYS_PLL_STAT 0x2f
374 #define MGA1064_ZOOM_CTL 0x38
375 #define MGA1064_SENSE_TST 0x3a
376
377 #define MGA1064_CRC_LSB 0x3c
378 #define MGA1064_CRC_MSB 0x3d
379 #define MGA1064_CRC_CTL 0x3e
380 #define MGA1064_COL_KEY_MSK_LSB 0x40
381 #define MGA1064_COL_KEY_MSK_MSB 0x41
382 #define MGA1064_COL_KEY_LSB 0x42
383 #define MGA1064_COL_KEY_MSB 0x43
384 #define MGA1064_PIX_PLLA_M 0x44
385 #define MGA1064_PIX_PLLA_N 0x45
386 #define MGA1064_PIX_PLLA_P 0x46
387 #define MGA1064_PIX_PLLB_M 0x48
388 #define MGA1064_PIX_PLLB_N 0x49
389 #define MGA1064_PIX_PLLB_P 0x4a
390 #define MGA1064_PIX_PLLC_M 0x4c
391 #define MGA1064_PIX_PLLC_N 0x4d
392 #define MGA1064_PIX_PLLC_P 0x4e
393
394 #define MGA1064_PIX_PLL_STAT 0x4f
395
396 /*Added for G450 dual head*/
397 /* Supported PLL*/
398 #define __PIXEL_PLL 1
399 #define __SYSTEM_PLL 2
400 #define __VIDEO_PLL 3
401
402 #define MGA1064_VID_PLL_P 0x8D
403 #define MGA1064_VID_PLL_M 0x8E
404 #define MGA1064_VID_PLL_N 0x8F
405
406 #define MGA1064_DISP_CTL 0x8a
407 #define MGA1064_SYNC_CTL 0x8b
408 #define MGA1064_PWR_CTL 0xa0
409 #define MGA1064_PAN_CTL 0xa2
410
411 /* Using crtc2 */
412 #define MGAREG2_C2CTL 0x10
413 #define MGAREG2_C2HPARAM 0x14
414 #define MGAREG2_C2HSYNC 0x18
415 #define MGAREG2_C2VPARAM 0x1c
416 #define MGAREG2_C2VSYNC 0x20
417 #define MGAREG2_C2STARTADD0 0x28
418
419 #define MGAREG2_C2OFFSET 0x40
420 #define MGAREG2_C2DATACTL 0x4c
421
422 #define MGAREG_C2CTL 0x3c10
423 #define MGAREG_C2HPARAM 0x3c14
424 #define MGAREG_C2HSYNC 0x3c18
425 #define MGAREG_C2VPARAM 0x3c1c
426 #define MGAREG_C2VSYNC 0x3c20
427 #define MGAREG_C2STARTADD0 0x3c28
428
429 #define MGAREG_C2OFFSET 0x3c40
430 #define MGAREG_C2DATACTL 0x3c4c
431
432 #define MGA1064_DISP_CTL 0x8a
433 #define MGA1064_SYNC_CTL 0x8b
434 #define MGA1064_PWR_CTL 0xa0
435
436 /* video register */
437
438 #define MGAREG_BESA1C3ORG 0x3d60
439 #define MGAREG_BESA1CORG 0x3d10
440 #define MGAREG_BESA1ORG 0x3d00
441 #define MGAREG_BESCTL 0x3d20
442 #define MGAREG_BESGLOBCTL 0x3dc0
443 #define MGAREG_BESHCOORD 0x3d28
444 #define MGAREG_BESHISCAL 0x3d30
445 #define MGAREG_BESHSRCEND 0x3d3c
446 #define MGAREG_BESHSRCLST 0x3d50
447 #define MGAREG_BESHSRCST 0x3d38
448 #define MGAREG_BESLUMACTL 0x3d40
449 #define MGAREG_BESPITCH 0x3d24
450 #define MGAREG_BESV1SRCLST 0x3d54
451 #define MGAREG_BESV1WGHT 0x3d48
452 #define MGAREG_BESVCOORD 0x3d2c
453 #define MGAREG_BESVISCAL 0x3d34
454
455 /* texture engine registers */
456
457 #define MGAREG_TMR0 0x2c00
458 #define MGAREG_TMR1 0x2c04
459 #define MGAREG_TMR2 0x2c08
460 #define MGAREG_TMR3 0x2c0c
461 #define MGAREG_TMR4 0x2c10
462 #define MGAREG_TMR5 0x2c14
463 #define MGAREG_TMR6 0x2c18
464 #define MGAREG_TMR7 0x2c1c
465 #define MGAREG_TMR8 0x2c20
466 #define MGAREG_TEXORG 0x2c24
467 #define MGAREG_TEXWIDTH 0x2c28
468 #define MGAREG_TEXHEIGHT 0x2c2c
469 #define MGAREG_TEXCTL 0x2c30
470 #define MGAREG_TEXCTL2 0x2c3c
471 #define MGAREG_TEXTRANS 0x2c34
472 #define MGAREG_TEXTRANSHIGH 0x2c38
473 #define MGAREG_TEXFILTER 0x2c58
474 #define MGAREG_ALPHASTART 0x2c70
475 #define MGAREG_ALPHAXINC 0x2c74
476 #define MGAREG_ALPHAYINC 0x2c78
477 #define MGAREG_ALPHACTRL 0x2c7c
478 #define MGAREG_DWGSYNC 0x2c4c
479
480 #define MGAREG_AGP_PLL 0x1e4c
481 #define MGA_AGP2XPLL_ENABLE 0x1
482 #define MGA_AGP2XPLL_DISABLE 0x0
483
484 #endif