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