1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.6 2000/12/12 17:17:13 dawes Exp $ */
2 /*
3  * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
4  *                      Precision Insight, Inc., Cedar Park, Texas, and
5  *                      VA Linux Systems Inc., Fremont, California.
6  *
7  * All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation on the rights to use, copy, modify, merge,
13  * publish, distribute, sublicense, and/or sell copies of the Software,
14  * and to permit persons to whom the Software is furnished to do so,
15  * subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice (including the
18  * next paragraph) shall be included in all copies or substantial
19  * portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24  * NON-INFRINGEMENT.  IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
25  * SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  */
30 
31 /*
32  * Authors:
33  *   Rickard E. Faith <faith@valinux.com>
34  *   Kevin E. Martin <martin@valinux.com>
35  *   Gareth Hughes <gareth@valinux.com>
36  *
37  * References:
38  *
39  *   RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
40  *   Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
41  *   1999.
42  *
43  *   RAGE 128 Software Development Manual (Technical Reference Manual P/N
44  *   SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
45  *
46  */
47 
48 #ifndef _R128_REG_H_
49 #define _R128_REG_H_
50 
51 #define R128_TIMEOUT 2000000
52 
53 #define MMIO_IN8(dummy, addr)  (*(unsigned char *)(MMIO_POINTER + addr))
54 #define MMIO_IN16(dummy, addr)  (*(unsigned short *)(MMIO_POINTER + addr))
55 #define MMIO_IN32(dummy, addr)  (*(unsigned int *)(MMIO_POINTER + addr))
56 
57 #define MMIO_OUT8(dummy, addr, val)  (*(unsigned char *)(MMIO_POINTER + addr) = val)
58 #define MMIO_OUT16(dummy, addr, val)  (*(unsigned short *)(MMIO_POINTER + addr) = val)
59 #define MMIO_OUT32(dummy, addr, val)  (*(unsigned int *)(MMIO_POINTER + addr) = val)
60 
61 				/* Memory mapped register access macros */
62 #define INREG8(addr)        MMIO_IN8(R128MMIO, addr)
63 #define INREG16(addr)       MMIO_IN16(R128MMIO, addr)
64 #define INREG(addr)         MMIO_IN32(R128MMIO, addr)
65 #define OUTREG8(addr, val)  MMIO_OUT8(R128MMIO, addr, val)
66 #define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val)
67 #define OUTREG(addr, val)   MMIO_OUT32(R128MMIO, addr, val)
68 
69 #define ADDRREG(addr)       ((volatile CARD32 *)(R128MMIO + (addr)))
70 
71 #if 0
72 #define R128_BIOS8(v)  (VBIOS[v])
73 #define R128_BIOS16(v) (VBIOS[v] | \
74 			(VBIOS[(v) + 1] << 8))
75 #define R128_BIOS32(v) (VBIOS[v] | \
76 			(VBIOS[(v) + 1] << 8) | \
77 			(VBIOS[(v) + 2] << 16) | \
78 			(VBIOS[(v) + 3] << 24))
79 #endif
80 
81 #define OUTREGP(addr, val, mask)   \
82     do {                           \
83 	CARD32 tmp = INREG(addr);  \
84 	tmp &= (mask);             \
85 	tmp |= (val);              \
86 	OUTREG(addr, tmp);         \
87     } while (0)
88 
89 #define INPLL(addr) R128INPLL(addr)
90 
91 #define OUTPLL(addr, val)                                                 \
92     do {                                                                  \
93 	OUTREG8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x1f) | R128_PLL_WR_EN); \
94 	OUTREG(R128_CLOCK_CNTL_DATA, val);                                \
95     } while (0)
96 
97 #define OUTPLLP(addr, val, mask)                                   \
98     do {                                                                  \
99 	CARD32 tmp = INPLL(addr);                                  \
100 	tmp &= (mask);                                                    \
101 	tmp |= (val);                                                     \
102 	OUTPLL(addr, tmp);                                                \
103     } while (0)
104 
105 #define OUTPAL_START(idx)                                                 \
106     do {                                                                  \
107 	OUTREG8(R128_PALETTE_INDEX, (idx));                               \
108     } while (0)
109 
110 #define OUTPAL_NEXT(r, g, b)                                              \
111     do {                                                                  \
112 	OUTREG(R128_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b));        \
113     } while (0)
114 
115 #define OUTPAL_NEXT_CARD32(v)                                             \
116     do {                                                                  \
117 	OUTREG(R128_PALETTE_DATA, (v & 0x00ffffff));                      \
118     } while (0)
119 
120 #define OUTPAL(idx, r, g, b)                                              \
121     do {                                                                  \
122 	OUTPAL_START((idx));                                              \
123 	OUTPAL_NEXT((r), (g), (b));                                       \
124     } while (0)
125 
126 #define INPAL_START(idx)                                                  \
127     do {                                                                  \
128 	OUTREG(R128_PALETTE_INDEX, (idx) << 16);                          \
129     } while (0)
130 
131 #define INPAL_NEXT() INREG(R128_PALETTE_DATA)
132 
133 #define PAL_SELECT(idx)                                                   \
134     do {                                                                  \
135 	if (idx) {                                                        \
136 	    OUTREG(R128_DAC_CNTL, INREG(R128_DAC_CNTL) |                  \
137 		   R128_DAC_PALETTE_ACC_CTL);                             \
138 	} else {                                                          \
139 	    OUTREG(R128_DAC_CNTL, INREG(R128_DAC_CNTL) &                  \
140 		   ~R128_DAC_PALETTE_ACC_CTL);                            \
141 	}                                                                 \
142     } while (0)
143 
144 #define R128_ADAPTER_ID                   0x0f2c /* PCI */
145 #define R128_AGP_APER_OFFSET              0x0178
146 #define R128_AGP_BASE                     0x0170
147 #define R128_AGP_CNTL                     0x0174
148 #       define R128_AGP_APER_SIZE_256MB   (0x00 << 0)
149 #       define R128_AGP_APER_SIZE_128MB   (0x20 << 0)
150 #       define R128_AGP_APER_SIZE_64MB    (0x30 << 0)
151 #       define R128_AGP_APER_SIZE_32MB    (0x38 << 0)
152 #       define R128_AGP_APER_SIZE_16MB    (0x3c << 0)
153 #       define R128_AGP_APER_SIZE_8MB     (0x3e << 0)
154 #       define R128_AGP_APER_SIZE_4MB     (0x3f << 0)
155 #       define R128_AGP_APER_SIZE_MASK    (0x3f << 0)
156 #define R128_AGP_CNTL_B                   0x0b44
157 #define R128_AGP_COMMAND                  0x0f58 /* PCI */
158 #define R128_AGP_PLL_CNTL                 0x0010 /* PLL */
159 #define R128_AGP_STATUS                   0x0f54 /* PCI */
160 #       define R128_AGP_1X_MODE           0x01
161 #       define R128_AGP_2X_MODE           0x02
162 #       define R128_AGP_4X_MODE           0x04
163 #       define R128_AGP_MODE_MASK         0x07
164 #define R128_AMCGPIO_A_REG                0x01a0
165 #define R128_AMCGPIO_EN_REG               0x01a8
166 #define R128_AMCGPIO_MASK                 0x0194
167 #define R128_AMCGPIO_Y_REG                0x01a4
168 #define R128_ATTRDR                       0x03c1 /* VGA */
169 #define R128_ATTRDW                       0x03c0 /* VGA */
170 #define R128_ATTRX                        0x03c0 /* VGA */
171 #define R128_AUX_SC_CNTL                  0x1660
172 #       define R128_AUX1_SC_EN            (1 << 0)
173 #       define R128_AUX1_SC_MODE_OR       (0 << 1)
174 #       define R128_AUX1_SC_MODE_NAND     (1 << 1)
175 #       define R128_AUX2_SC_EN            (1 << 2)
176 #       define R128_AUX2_SC_MODE_OR       (0 << 3)
177 #       define R128_AUX2_SC_MODE_NAND     (1 << 3)
178 #       define R128_AUX3_SC_EN            (1 << 4)
179 #       define R128_AUX3_SC_MODE_OR       (0 << 5)
180 #       define R128_AUX3_SC_MODE_NAND     (1 << 5)
181 #define R128_AUX1_SC_BOTTOM               0x1670
182 #define R128_AUX1_SC_LEFT                 0x1664
183 #define R128_AUX1_SC_RIGHT                0x1668
184 #define R128_AUX1_SC_TOP                  0x166c
185 #define R128_AUX2_SC_BOTTOM               0x1680
186 #define R128_AUX2_SC_LEFT                 0x1674
187 #define R128_AUX2_SC_RIGHT                0x1678
188 #define R128_AUX2_SC_TOP                  0x167c
189 #define R128_AUX3_SC_BOTTOM               0x1690
190 #define R128_AUX3_SC_LEFT                 0x1684
191 #define R128_AUX3_SC_RIGHT                0x1688
192 #define R128_AUX3_SC_TOP                  0x168c
193 #define R128_AUX_WINDOW_HORZ_CNTL         0x02d8
194 #define R128_AUX_WINDOW_VERT_CNTL         0x02dc
195 
196 #define R128_BASE_CODE                    0x0f0b
197 #define R128_BIOS_0_SCRATCH               0x0010
198 #define R128_BIOS_1_SCRATCH               0x0014
199 #define R128_BIOS_2_SCRATCH               0x0018
200 #define R128_BIOS_3_SCRATCH               0x001c
201 #define R128_BIOS_ROM                     0x0f30 /* PCI */
202 #define R128_BIST                         0x0f0f /* PCI */
203 #define R128_BRUSH_DATA0                  0x1480
204 #define R128_BRUSH_DATA1                  0x1484
205 #define R128_BRUSH_DATA10                 0x14a8
206 #define R128_BRUSH_DATA11                 0x14ac
207 #define R128_BRUSH_DATA12                 0x14b0
208 #define R128_BRUSH_DATA13                 0x14b4
209 #define R128_BRUSH_DATA14                 0x14b8
210 #define R128_BRUSH_DATA15                 0x14bc
211 #define R128_BRUSH_DATA16                 0x14c0
212 #define R128_BRUSH_DATA17                 0x14c4
213 #define R128_BRUSH_DATA18                 0x14c8
214 #define R128_BRUSH_DATA19                 0x14cc
215 #define R128_BRUSH_DATA2                  0x1488
216 #define R128_BRUSH_DATA20                 0x14d0
217 #define R128_BRUSH_DATA21                 0x14d4
218 #define R128_BRUSH_DATA22                 0x14d8
219 #define R128_BRUSH_DATA23                 0x14dc
220 #define R128_BRUSH_DATA24                 0x14e0
221 #define R128_BRUSH_DATA25                 0x14e4
222 #define R128_BRUSH_DATA26                 0x14e8
223 #define R128_BRUSH_DATA27                 0x14ec
224 #define R128_BRUSH_DATA28                 0x14f0
225 #define R128_BRUSH_DATA29                 0x14f4
226 #define R128_BRUSH_DATA3                  0x148c
227 #define R128_BRUSH_DATA30                 0x14f8
228 #define R128_BRUSH_DATA31                 0x14fc
229 #define R128_BRUSH_DATA32                 0x1500
230 #define R128_BRUSH_DATA33                 0x1504
231 #define R128_BRUSH_DATA34                 0x1508
232 #define R128_BRUSH_DATA35                 0x150c
233 #define R128_BRUSH_DATA36                 0x1510
234 #define R128_BRUSH_DATA37                 0x1514
235 #define R128_BRUSH_DATA38                 0x1518
236 #define R128_BRUSH_DATA39                 0x151c
237 #define R128_BRUSH_DATA4                  0x1490
238 #define R128_BRUSH_DATA40                 0x1520
239 #define R128_BRUSH_DATA41                 0x1524
240 #define R128_BRUSH_DATA42                 0x1528
241 #define R128_BRUSH_DATA43                 0x152c
242 #define R128_BRUSH_DATA44                 0x1530
243 #define R128_BRUSH_DATA45                 0x1534
244 #define R128_BRUSH_DATA46                 0x1538
245 #define R128_BRUSH_DATA47                 0x153c
246 #define R128_BRUSH_DATA48                 0x1540
247 #define R128_BRUSH_DATA49                 0x1544
248 #define R128_BRUSH_DATA5                  0x1494
249 #define R128_BRUSH_DATA50                 0x1548
250 #define R128_BRUSH_DATA51                 0x154c
251 #define R128_BRUSH_DATA52                 0x1550
252 #define R128_BRUSH_DATA53                 0x1554
253 #define R128_BRUSH_DATA54                 0x1558
254 #define R128_BRUSH_DATA55                 0x155c
255 #define R128_BRUSH_DATA56                 0x1560
256 #define R128_BRUSH_DATA57                 0x1564
257 #define R128_BRUSH_DATA58                 0x1568
258 #define R128_BRUSH_DATA59                 0x156c
259 #define R128_BRUSH_DATA6                  0x1498
260 #define R128_BRUSH_DATA60                 0x1570
261 #define R128_BRUSH_DATA61                 0x1574
262 #define R128_BRUSH_DATA62                 0x1578
263 #define R128_BRUSH_DATA63                 0x157c
264 #define R128_BRUSH_DATA7                  0x149c
265 #define R128_BRUSH_DATA8                  0x14a0
266 #define R128_BRUSH_DATA9                  0x14a4
267 #define R128_BRUSH_SCALE                  0x1470
268 #define R128_BRUSH_Y_X                    0x1474
269 #define R128_BUS_CNTL                     0x0030
270 #       define R128_BUS_MASTER_DIS         (1 << 6)
271 #       define R128_BUS_RD_DISCARD_EN      (1 << 24)
272 #       define R128_BUS_RD_ABORT_EN        (1 << 25)
273 #       define R128_BUS_MSTR_DISCONNECT_EN (1 << 28)
274 #       define R128_BUS_WRT_BURST          (1 << 29)
275 #       define R128_BUS_READ_BURST         (1 << 30)
276 #define R128_BUS_CNTL1                    0x0034
277 #       define R128_BUS_WAIT_ON_LOCK_EN    (1 << 4)
278 
279 #define R128_CACHE_CNTL                   0x1724
280 #define R128_CACHE_LINE                   0x0f0c /* PCI */
281 #define R128_CAP0_TRIG_CNTL               0x0950 /* ? */
282 #define R128_CAP1_TRIG_CNTL               0x09c0 /* ? */
283 #define R128_CAPABILITIES_ID              0x0f50 /* PCI */
284 #define R128_CAPABILITIES_PTR             0x0f34 /* PCI */
285 #define R128_CLK_PIN_CNTL                 0x0001 /* PLL */
286 #define R128_CLOCK_CNTL_DATA              0x000c
287 #define R128_CLOCK_CNTL_INDEX             0x0008
288 #       define R128_PLL_WR_EN             (1 << 7)
289 #       define R128_PLL_DIV_SEL           (3 << 8)
290 #define R128_CLR_CMP_CLR_3D               0x1a24
291 #define R128_CLR_CMP_CLR_DST              0x15c8
292 #define R128_CLR_CMP_CLR_SRC              0x15c4
293 #define R128_CLR_CMP_CNTL                 0x15c0
294 #       define R128_SRC_CMP_EQ_COLOR      (4 <<  0)
295 #       define R128_SRC_CMP_NEQ_COLOR     (5 <<  0)
296 #       define R128_CLR_CMP_SRC_SOURCE    (1 << 24)
297 #define R128_CLR_CMP_MASK                 0x15cc
298 #       define R128_CLR_CMP_MSK           0xffffffff
299 #define R128_CLR_CMP_MASK_3D              0x1A28
300 #define R128_COMMAND                      0x0f04 /* PCI */
301 #define R128_COMPOSITE_SHADOW_ID          0x1a0c
302 #define R128_CONFIG_APER_0_BASE           0x0100
303 #define R128_CONFIG_APER_1_BASE           0x0104
304 #define R128_CONFIG_APER_SIZE             0x0108
305 #define R128_CONFIG_BONDS                 0x00e8
306 #define R128_CONFIG_CNTL                  0x00e0
307 #       define APER_0_BIG_ENDIAN_16BPP_SWAP (1 << 0)
308 #       define APER_0_BIG_ENDIAN_32BPP_SWAP (2 << 0)
309 #	define R128_CFG_VGA_RAM_EN	  (1 << 8)
310 #define R128_CONFIG_MEMSIZE               0x00f8
311 #define R128_CONFIG_MEMSIZE_EMBEDDED      0x0114
312 #define R128_CONFIG_REG_1_BASE            0x010c
313 #define R128_CONFIG_REG_APER_SIZE         0x0110
314 #define R128_CONFIG_XSTRAP                0x00e4
315 #define R128_CONSTANT_COLOR_C             0x1d34
316 #       define R128_CONSTANT_COLOR_MASK   0x00ffffff
317 #       define R128_CONSTANT_COLOR_ONE    0x00ffffff
318 #       define R128_CONSTANT_COLOR_ZERO   0x00000000
319 #define R128_CRC_CMDFIFO_ADDR             0x0740
320 #define R128_CRC_CMDFIFO_DOUT             0x0744
321 #define R128_CRTC_CRNT_FRAME              0x0214
322 #define R128_CRTC_DEBUG                   0x021c
323 #define R128_CRTC_EXT_CNTL                0x0054
324 #       define R128_CRTC_VGA_XOVERSCAN    (1 <<  0)
325 #       define R128_VGA_ATI_LINEAR        (1 <<  3)
326 #       define R128_XCRT_CNT_EN           (1 <<  6)
327 #       define R128_CRTC_HSYNC_DIS        (1 <<  8)
328 #       define R128_CRTC_VSYNC_DIS        (1 <<  9)
329 #       define R128_CRTC_DISPLAY_DIS      (1 << 10)
330 #       define R128_CRTC_CRT_ON           (1 << 15)
331 #	define R128_VGA_MEM_PS_EN	  (1 << 19)
332 #define R128_CRTC_EXT_CNTL_DPMS_BYTE      0x0055
333 #       define R128_CRTC_HSYNC_DIS_BYTE   (1 <<  0)
334 #       define R128_CRTC_VSYNC_DIS_BYTE   (1 <<  1)
335 #       define R128_CRTC_DISPLAY_DIS_BYTE (1 <<  2)
336 #define R128_CRTC_GEN_CNTL                0x0050
337 #       define R128_CRTC_DBL_SCAN_EN      (1 <<  0)
338 #       define R128_CRTC_INTERLACE_EN     (1 <<  1)
339 #       define R128_CRTC_CSYNC_EN         (1 <<  4)
340 #       define R128_CRTC_CUR_EN           (1 << 16)
341 #       define R128_CRTC_CUR_MODE_MASK    (7 << 17)
342 #       define R128_CRTC_ICON_EN          (1 << 20)
343 #       define R128_CRTC_EXT_DISP_EN      (1 << 24)
344 #       define R128_CRTC_EN               (1 << 25)
345 #       define R128_CRTC_DISP_REQ_EN_B    (1 << 26)
346 #define R128_CRTC_GUI_TRIG_VLINE          0x0218
347 #define R128_CRTC_H_SYNC_STRT_WID         0x0204
348 #       define R128_CRTC_H_SYNC_STRT_PIX        (0x07  <<  0)
349 #       define R128_CRTC_H_SYNC_STRT_CHAR       (0x1ff <<  3)
350 #       define R128_CRTC_H_SYNC_STRT_CHAR_SHIFT 3
351 #       define R128_CRTC_H_SYNC_WID             (0x3f  << 16)
352 #       define R128_CRTC_H_SYNC_WID_SHIFT       16
353 #       define R128_CRTC_H_SYNC_POL             (1     << 23)
354 #define R128_CRTC_H_TOTAL_DISP            0x0200
355 #       define R128_CRTC_H_TOTAL          (0x01ff << 0)
356 #       define R128_CRTC_H_TOTAL_SHIFT    0
357 #       define R128_CRTC_H_DISP           (0x00ff << 16)
358 #       define R128_CRTC_H_DISP_SHIFT     16
359 #define R128_CRTC_OFFSET                  0x0224
360 #define R128_CRTC_OFFSET_CNTL             0x0228
361 #define R128_CRTC_PITCH                   0x022c
362 #define R128_CRTC_STATUS                  0x005c
363 #       define R128_CRTC_VBLANK_SAVE      (1 <<  1)
364 #define R128_CRTC_V_SYNC_STRT_WID         0x020c
365 #       define R128_CRTC_V_SYNC_STRT       (0x7ff <<  0)
366 #       define R128_CRTC_V_SYNC_STRT_SHIFT 0
367 #       define R128_CRTC_V_SYNC_WID        (0x1f  << 16)
368 #       define R128_CRTC_V_SYNC_WID_SHIFT  16
369 #       define R128_CRTC_V_SYNC_POL        (1     << 23)
370 #define R128_CRTC_V_TOTAL_DISP            0x0208
371 #       define R128_CRTC_V_TOTAL          (0x07ff << 0)
372 #       define R128_CRTC_V_TOTAL_SHIFT    0
373 #       define R128_CRTC_V_DISP           (0x07ff << 16)
374 #       define R128_CRTC_V_DISP_SHIFT     16
375 #define R128_CRTC_VLINE_CRNT_VLINE        0x0210
376 #       define R128_CRTC_CRNT_VLINE_MASK  (0x7ff << 16)
377 #define R128_CRTC2_CRNT_FRAME             0x0314
378 #define R128_CRTC2_DEBUG                  0x031c
379 #define R128_CRTC2_GEN_CNTL               0x03f8
380 #define R128_CRTC2_GUI_TRIG_VLINE         0x0318
381 #define R128_CRTC2_H_SYNC_STRT_WID        0x0304
382 #define R128_CRTC2_H_TOTAL_DISP           0x0300
383 #define R128_CRTC2_OFFSET                 0x0324
384 #define R128_CRTC2_OFFSET_CNTL            0x0328
385 #define R128_CRTC2_PITCH                  0x032c
386 #define R128_CRTC2_STATUS                 0x03fc
387 #define R128_CRTC2_V_SYNC_STRT_WID        0x030c
388 #define R128_CRTC2_V_TOTAL_DISP           0x0308
389 #define R128_CRTC2_VLINE_CRNT_VLINE       0x0310
390 #define R128_CRTC8_DATA                   0x03d5 /* VGA, 0x3b5 */
391 #define R128_CRTC8_IDX                    0x03d4 /* VGA, 0x3b4 */
392 #define R128_CUR_CLR0                     0x026c
393 #define R128_CUR_CLR1                     0x0270
394 #define R128_CUR_HORZ_VERT_OFF            0x0268
395 #define R128_CUR_HORZ_VERT_POSN           0x0264
396 #define R128_CUR_OFFSET                   0x0260
397 #       define R128_CUR_LOCK              (1 << 31)
398 
399 #define R128_DAC_CNTL                     0x0058
400 #       define R128_DAC_RANGE_CNTL        (3 <<  0)
401 #       define R128_DAC_BLANKING          (1 <<  2)
402 #       define R128_DAC_CRT_SEL_CRTC2     (1 <<  4)
403 #       define R128_DAC_PALETTE_ACC_CTL   (1 <<  5)
404 #       define R128_DAC_8BIT_EN           (1 <<  8)
405 #       define R128_DAC_VGA_ADR_EN        (1 << 13)
406 #       define R128_DAC_MASK_ALL          (0xff << 24)
407 #define R128_DAC_CRC_SIG                  0x02cc
408 #define R128_DAC_DATA                     0x03c9 /* VGA */
409 #define R128_DAC_MASK                     0x03c6 /* VGA */
410 #define R128_DAC_R_INDEX                  0x03c7 /* VGA */
411 #define R128_DAC_W_INDEX                  0x03c8 /* VGA */
412 #define R128_DDA_CONFIG                   0x02e0
413 #define R128_DDA_ON_OFF                   0x02e4
414 #define R128_DEFAULT_OFFSET               0x16e0
415 #define R128_DEFAULT_PITCH                0x16e4
416 #define R128_DEFAULT_SC_BOTTOM_RIGHT      0x16e8
417 #       define R128_DEFAULT_SC_RIGHT_MAX  (0x1fff <<  0)
418 #       define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
419 #define R128_DESTINATION_3D_CLR_CMP_VAL   0x1820
420 #define R128_DESTINATION_3D_CLR_CMP_MSK   0x1824
421 #define R128_DEVICE_ID                    0x0f02 /* PCI */
422 #define R128_DP_BRUSH_BKGD_CLR            0x1478
423 #define R128_DP_BRUSH_FRGD_CLR            0x147c
424 #define R128_DP_CNTL                      0x16c0
425 #       define R128_DST_X_LEFT_TO_RIGHT   (1 <<  0)
426 #       define R128_DST_Y_TOP_TO_BOTTOM   (1 <<  1)
427 #define R128_DP_CNTL_XDIR_YDIR_YMAJOR     0x16d0
428 #       define R128_DST_Y_MAJOR             (1 <<  2)
429 #       define R128_DST_Y_DIR_TOP_TO_BOTTOM (1 << 15)
430 #       define R128_DST_X_DIR_LEFT_TO_RIGHT (1 << 31)
431 #define R128_DP_DATATYPE                  0x16c4
432 #       define R128_HOST_BIG_ENDIAN_EN    (1 << 29)
433 #define R128_DP_GUI_MASTER_CNTL           0x146c
434 #       define R128_GMC_SRC_PITCH_OFFSET_CNTL (1    <<  0)
435 #       define R128_GMC_DST_PITCH_OFFSET_CNTL (1    <<  1)
436 #       define R128_GMC_SRC_CLIPPING          (1    <<  2)
437 #       define R128_GMC_DST_CLIPPING          (1    <<  3)
438 #       define R128_GMC_BRUSH_DATATYPE_MASK   (0x0f <<  4)
439 #       define R128_GMC_BRUSH_8X8_MONO_FG_BG  (0    <<  4)
440 #       define R128_GMC_BRUSH_8X8_MONO_FG_LA  (1    <<  4)
441 #       define R128_GMC_BRUSH_1X8_MONO_FG_BG  (4    <<  4)
442 #       define R128_GMC_BRUSH_1X8_MONO_FG_LA  (5    <<  4)
443 #       define R128_GMC_BRUSH_32x1_MONO_FG_BG (6    <<  4)
444 #       define R128_GMC_BRUSH_32x1_MONO_FG_LA (7    <<  4)
445 #       define R128_GMC_BRUSH_32x32_MONO_FG_BG (8    <<  4)
446 #       define R128_GMC_BRUSH_32x32_MONO_FG_LA (9    <<  4)
447 #       define R128_GMC_BRUSH_8x8_COLOR       (10   <<  4)
448 #       define R128_GMC_BRUSH_1X8_COLOR       (12   <<  4)
449 #       define R128_GMC_BRUSH_SOLID_COLOR     (13   <<  4)
450 #       define R128_GMC_BRUSH_NONE            (15   <<  4)
451 #       define R128_GMC_DST_8BPP_CI           (2    <<  8)
452 #       define R128_GMC_DST_15BPP             (3    <<  8)
453 #       define R128_GMC_DST_16BPP             (4    <<  8)
454 #       define R128_GMC_DST_24BPP             (5    <<  8)
455 #       define R128_GMC_DST_32BPP             (6    <<  8)
456 #       define R128_GMC_DST_8BPP_RGB          (7    <<  8)
457 #       define R128_GMC_DST_Y8                (8    <<  8)
458 #       define R128_GMC_DST_RGB8              (9    <<  8)
459 #       define R128_GMC_DST_VYUY              (11   <<  8)
460 #       define R128_GMC_DST_YVYU              (12   <<  8)
461 #       define R128_GMC_DST_AYUV444           (14   <<  8)
462 #       define R128_GMC_DST_ARGB4444          (15   <<  8)
463 #       define R128_GMC_DST_DATATYPE_MASK     (0x0f <<  8)
464 #       define R128_GMC_DST_DATATYPE_SHIFT    8
465 #       define R128_GMC_SRC_DATATYPE_MASK       (3    << 12)
466 #       define R128_GMC_SRC_DATATYPE_MONO_FG_BG (0    << 12)
467 #       define R128_GMC_SRC_DATATYPE_MONO_FG_LA (1    << 12)
468 #       define R128_GMC_SRC_DATATYPE_COLOR      (3    << 12)
469 #       define R128_GMC_BYTE_PIX_ORDER        (1    << 14)
470 #       define R128_GMC_BYTE_MSB_TO_LSB       (0    << 14)
471 #       define R128_GMC_BYTE_LSB_TO_MSB       (1    << 14)
472 #       define R128_GMC_CONVERSION_TEMP       (1    << 15)
473 #       define R128_GMC_CONVERSION_TEMP_6500  (0    << 15)
474 #       define R128_GMC_CONVERSION_TEMP_9300  (1    << 15)
475 #       define R128_GMC_ROP3_MASK             (0xff << 16)
476 #       define R128_DP_SRC_SOURCE_MASK        (7    << 24)
477 #       define R128_DP_SRC_SOURCE_MEMORY      (2    << 24)
478 #       define R128_DP_SRC_SOURCE_HOST_DATA   (3    << 24)
479 #       define R128_GMC_3D_FCN_EN             (1    << 27)
480 #       define R128_GMC_CLR_CMP_CNTL_DIS      (1    << 28)
481 #       define R128_GMC_AUX_CLIP_DIS          (1    << 29)
482 #       define R128_GMC_WR_MSK_DIS            (1    << 30)
483 #       define R128_GMC_LD_BRUSH_Y_X          (1    << 31)
484 #       define R128_ROP3_ZERO             0x00000000
485 #       define R128_ROP3_DSa              0x00880000
486 #       define R128_ROP3_SDna             0x00440000
487 #       define R128_ROP3_S                0x00cc0000
488 #       define R128_ROP3_DSna             0x00220000
489 #       define R128_ROP3_D                0x00aa0000
490 #       define R128_ROP3_DSx              0x00660000
491 #       define R128_ROP3_DSo              0x00ee0000
492 #       define R128_ROP3_DSon             0x00110000
493 #       define R128_ROP3_DSxn             0x00990000
494 #       define R128_ROP3_Dn               0x00550000
495 #       define R128_ROP3_SDno             0x00dd0000
496 #       define R128_ROP3_Sn               0x00330000
497 #       define R128_ROP3_DSno             0x00bb0000
498 #       define R128_ROP3_DSan             0x00770000
499 #       define R128_ROP3_ONE              0x00ff0000
500 #       define R128_ROP3_DPa              0x00a00000
501 #       define R128_ROP3_PDna             0x00500000
502 #       define R128_ROP3_P                0x00f00000
503 #       define R128_ROP3_DPna             0x000a0000
504 #       define R128_ROP3_D                0x00aa0000
505 #       define R128_ROP3_DPx              0x005a0000
506 #       define R128_ROP3_DPo              0x00fa0000
507 #       define R128_ROP3_DPon             0x00050000
508 #       define R128_ROP3_PDxn             0x00a50000
509 #       define R128_ROP3_PDno             0x00f50000
510 #       define R128_ROP3_Pn               0x000f0000
511 #       define R128_ROP3_DPno             0x00af0000
512 #       define R128_ROP3_DPan             0x005f0000
513 
514 
515 #define R128_DP_GUI_MASTER_CNTL_C         0x1c84
516 #define R128_DP_MIX                       0x16c8
517 #define R128_DP_SRC_BKGD_CLR              0x15dc
518 #define R128_DP_SRC_FRGD_CLR              0x15d8
519 #define R128_DP_WRITE_MASK                0x16cc
520 #define R128_DST_BRES_DEC                 0x1630
521 #define R128_DST_BRES_ERR                 0x1628
522 #define R128_DST_BRES_INC                 0x162c
523 #define R128_DST_BRES_LNTH                0x1634
524 #define R128_DST_BRES_LNTH_SUB            0x1638
525 #define R128_DST_HEIGHT                   0x1410
526 #define R128_DST_HEIGHT_WIDTH             0x143c
527 #define R128_DST_HEIGHT_WIDTH_8           0x158c
528 #define R128_DST_HEIGHT_WIDTH_BW          0x15b4
529 #define R128_DST_HEIGHT_Y                 0x15a0
530 #define R128_DST_OFFSET                   0x1404
531 #define R128_DST_PITCH                    0x1408
532 #define R128_DST_PITCH_OFFSET             0x142c
533 #define R128_DST_PITCH_OFFSET_C           0x1c80
534 #       define R128_PITCH_SHIFT               21
535 #       define R128_DST_TILE                 (1 << 31)
536 #define R128_DST_WIDTH                    0x140c
537 #define R128_DST_WIDTH_HEIGHT             0x1598
538 #define R128_DST_WIDTH_X                  0x1588
539 #define R128_DST_WIDTH_X_INCY             0x159c
540 #define R128_DST_X                        0x141c
541 #define R128_DST_X_SUB                    0x15a4
542 #define R128_DST_X_Y                      0x1594
543 #define R128_DST_Y                        0x1420
544 #define R128_DST_Y_SUB                    0x15a8
545 #define R128_DST_Y_X                      0x1438
546 
547 #define R128_EXT_MEM_CNTL                 0x0144
548 
549 #define R128_FCP_CNTL                     0x0012 /* PLL */
550 #define R128_FLUSH_1                      0x1704
551 #define R128_FLUSH_2                      0x1708
552 #define R128_FLUSH_3                      0x170c
553 #define R128_FLUSH_4                      0x1710
554 #define R128_FLUSH_5                      0x1714
555 #define R128_FLUSH_6                      0x1718
556 #define R128_FLUSH_7                      0x171c
557 #define R128_FOG_3D_TABLE_START           0x1810
558 #define R128_FOG_3D_TABLE_END             0x1814
559 #define R128_FOG_3D_TABLE_DENSITY         0x181c
560 #define R128_FOG_TABLE_INDEX              0x1a14
561 #define R128_FOG_TABLE_DATA               0x1a18
562 #define R128_FP_CRTC_H_TOTAL_DISP         0x0250
563 #define R128_FP_CRTC_V_TOTAL_DISP         0x0254
564 #define R128_FP_GEN_CNTL                  0x0284
565 #       define R128_FP_FPON                  (1 << 0)
566 #       define R128_FP_TDMS_EN               (1 <<  2)
567 #       define R128_FP_DETECT_SENSE          (1 <<  8)
568 #       define R128_FP_SEL_CRTC2             (1 << 13)
569 #       define R128_FP_CRTC_DONT_SHADOW_VPAR (1 << 16)
570 #       define R128_FP_CRTC_USE_SHADOW_VEND  (1 << 18)
571 #       define R128_FP_CRTC_HORZ_DIV2_EN     (1 << 20)
572 #       define R128_FP_CRTC_HOR_CRT_DIV2_DIS (1 << 21)
573 #       define R128_FP_USE_SHADOW_EN         (1 << 24)
574 #define R128_FP_H_SYNC_STRT_WID           0x02c4
575 #define R128_FP_HORZ_STRETCH              0x028c
576 #       define R128_HORZ_STRETCH_RATIO_MASK  0xffff
577 #       define R128_HORZ_STRETCH_RATIO_SHIFT 0
578 #       define R128_HORZ_STRETCH_RATIO_MAX   4096
579 #       define R128_HORZ_PANEL_SIZE          (0xff   << 16)
580 #       define R128_HORZ_PANEL_SHIFT         16
581 #       define R128_HORZ_STRETCH_PIXREP      (0      << 25)
582 #       define R128_HORZ_STRETCH_BLEND       (1      << 25)
583 #       define R128_HORZ_STRETCH_ENABLE      (1      << 26)
584 #       define R128_HORZ_FP_LOOP_STRETCH     (0x7    << 27)
585 #       define R128_HORZ_STRETCH_RESERVED    (1      << 30)
586 #       define R128_HORZ_AUTO_RATIO_FIX_EN   (1      << 31)
587 
588 #define R128_FP_PANEL_CNTL                0x0288
589 #       define R128_FP_DIGON              (1 << 0)
590 #       define R128_FP_BLON               (1 << 1)
591 #define R128_FP_V_SYNC_STRT_WID           0x02c8
592 #define R128_FP_VERT_STRETCH              0x0290
593 #       define R128_VERT_PANEL_SIZE          (0x7ff <<  0)
594 #       define R128_VERT_PANEL_SHIFT         0
595 #       define R128_VERT_STRETCH_RATIO_MASK  0x3ff
596 #       define R128_VERT_STRETCH_RATIO_SHIFT 11
597 #       define R128_VERT_STRETCH_RATIO_MAX   1024
598 #       define R128_VERT_STRETCH_ENABLE      (1     << 24)
599 #       define R128_VERT_STRETCH_LINEREP     (0     << 25)
600 #       define R128_VERT_STRETCH_BLEND       (1     << 25)
601 #       define R128_VERT_AUTO_RATIO_EN       (1     << 26)
602 #       define R128_VERT_STRETCH_RESERVED    0xf8e00000
603 
604 #define R128_GEN_INT_CNTL                 0x0040
605 #define R128_GEN_INT_STATUS               0x0044
606 #       define R128_VSYNC_INT_AK          (1 <<  2)
607 #       define R128_VSYNC_INT             (1 <<  2)
608 #define R128_GEN_RESET_CNTL               0x00f0
609 #       define R128_SOFT_RESET_GUI          (1 <<  0)
610 #       define R128_SOFT_RESET_VCLK         (1 <<  8)
611 #       define R128_SOFT_RESET_PCLK         (1 <<  9)
612 #       define R128_SOFT_RESET_DISPENG_XCLK (1 << 11)
613 #       define R128_SOFT_RESET_MEMCTLR_XCLK (1 << 12)
614 #define R128_GENENB                       0x03c3 /* VGA */
615 #define R128_GENFC_RD                     0x03ca /* VGA */
616 #define R128_GENFC_WT                     0x03da /* VGA, 0x03ba */
617 #define R128_GENMO_RD                     0x03cc /* VGA */
618 #define R128_GENMO_WT                     0x03c2 /* VGA */
619 #define R128_GENS0                        0x03c2 /* VGA */
620 #define R128_GENS1                        0x03da /* VGA, 0x03ba */
621 #define R128_GPIO_MONID                   0x0068
622 #       define R128_GPIO_MONID_A_0        (1 <<  0)
623 #       define R128_GPIO_MONID_A_1        (1 <<  1)
624 #       define R128_GPIO_MONID_A_2        (1 <<  2)
625 #       define R128_GPIO_MONID_A_3        (1 <<  3)
626 #       define R128_GPIO_MONID_Y_0        (1 <<  8)
627 #       define R128_GPIO_MONID_Y_1        (1 <<  9)
628 #       define R128_GPIO_MONID_Y_2        (1 << 10)
629 #       define R128_GPIO_MONID_Y_3        (1 << 11)
630 #       define R128_GPIO_MONID_EN_0       (1 << 16)
631 #       define R128_GPIO_MONID_EN_1       (1 << 17)
632 #       define R128_GPIO_MONID_EN_2       (1 << 18)
633 #       define R128_GPIO_MONID_EN_3       (1 << 19)
634 #       define R128_GPIO_MONID_MASK_0     (1 << 24)
635 #       define R128_GPIO_MONID_MASK_1     (1 << 25)
636 #       define R128_GPIO_MONID_MASK_2     (1 << 26)
637 #       define R128_GPIO_MONID_MASK_3     (1 << 27)
638 #define R128_GPIO_MONIDB                  0x006c
639 #define R128_GRPH8_DATA                   0x03cf /* VGA */
640 #define R128_GRPH8_IDX                    0x03ce /* VGA */
641 #define R128_GUI_DEBUG0                   0x16a0
642 #define R128_GUI_DEBUG1                   0x16a4
643 #define R128_GUI_DEBUG2                   0x16a8
644 #define R128_GUI_DEBUG3                   0x16ac
645 #define R128_GUI_DEBUG4                   0x16b0
646 #define R128_GUI_DEBUG5                   0x16b4
647 #define R128_GUI_DEBUG6                   0x16b8
648 #define R128_GUI_PROBE                    0x16bc
649 #define R128_GUI_SCRATCH_REG0             0x15e0
650 #define R128_GUI_SCRATCH_REG1             0x15e4
651 #define R128_GUI_SCRATCH_REG2             0x15e8
652 #define R128_GUI_SCRATCH_REG3             0x15ec
653 #define R128_GUI_SCRATCH_REG4             0x15f0
654 #define R128_GUI_SCRATCH_REG5             0x15f4
655 #define R128_GUI_STAT                     0x1740
656 #       define R128_GUI_FIFOCNT_MASK      0x0fff
657 #       define R128_GUI_ACTIVE            (1 << 31)
658 
659 #define R128_HEADER                       0x0f0e /* PCI */
660 #define R128_HOST_DATA0                   0x17c0
661 #define R128_HOST_DATA1                   0x17c4
662 #define R128_HOST_DATA2                   0x17c8
663 #define R128_HOST_DATA3                   0x17cc
664 #define R128_HOST_DATA4                   0x17d0
665 #define R128_HOST_DATA5                   0x17d4
666 #define R128_HOST_DATA6                   0x17d8
667 #define R128_HOST_DATA7                   0x17dc
668 #define R128_HOST_DATA_LAST               0x17e0
669 #define R128_HOST_PATH_CNTL               0x0130
670 #define R128_HTOTAL_CNTL                  0x0009 /* PLL */
671 #define R128_HW_DEBUG                     0x0128
672 #define R128_HW_DEBUG2                    0x011c
673 
674 #define R128_I2C_CNTL_1                   0x0094 /* ? */
675 #define R128_INTERRUPT_LINE               0x0f3c /* PCI */
676 #define R128_INTERRUPT_PIN                0x0f3d /* PCI */
677 #define R128_IO_BASE                      0x0f14 /* PCI */
678 
679 #define R128_LATENCY                      0x0f0d /* PCI */
680 #define R128_LEAD_BRES_DEC                0x1608
681 #define R128_LEAD_BRES_ERR                0x1600
682 #define R128_LEAD_BRES_INC                0x1604
683 #define R128_LEAD_BRES_LNTH               0x161c
684 #define R128_LEAD_BRES_LNTH_SUB           0x1624
685 #define R128_LVDS_GEN_CNTL                0x02d0
686 #       define R128_LVDS_ON               (1   <<  0)
687 #       define R128_LVDS_BLON             (1   << 19)
688 #       define R128_LVDS_SEL_CRTC2        (1   << 23)
689 #       define R128_HSYNC_DELAY_SHIFT     28
690 #       define R128_HSYNC_DELAY_MASK      (0xf << 28)
691 
692 #define R128_MAX_LATENCY                  0x0f3f /* PCI */
693 #define R128_MCLK_CNTL                    0x000f /* PLL */
694 #       define R128_FORCE_GCP             (1 << 16)
695 #       define R128_FORCE_PIPE3D_CP       (1 << 17)
696 #       define R128_FORCE_RCP             (1 << 18)
697 #define R128_MDGPIO_A_REG                 0x01ac
698 #define R128_MDGPIO_EN_REG                0x01b0
699 #define R128_MDGPIO_MASK                  0x0198
700 #define R128_MDGPIO_Y_REG                 0x01b4
701 #define R128_MEM_ADDR_CONFIG              0x0148
702 #define R128_MEM_BASE                     0x0f10 /* PCI */
703 #define R128_MEM_CNTL                     0x0140
704 #define R128_MEM_INIT_LAT_TIMER           0x0154
705 #define R128_MEM_INTF_CNTL                0x014c
706 #define R128_MEM_SDRAM_MODE_REG           0x0158
707 #define R128_MEM_STR_CNTL                 0x0150
708 #define R128_MEM_VGA_RP_SEL               0x003c
709 #define R128_MEM_VGA_WP_SEL               0x0038
710 #define R128_MIN_GRANT                    0x0f3e /* PCI */
711 #define R128_MM_DATA                      0x0004
712 #define R128_MM_INDEX                     0x0000
713 #define R128_MPLL_CNTL                    0x000e /* PLL */
714 #define R128_MPP_TB_CONFIG                0x01c0 /* ? */
715 #define R128_MPP_GP_CONFIG                0x01c8 /* ? */
716 
717 #define R128_N_VIF_COUNT                  0x0248
718 
719 #define R128_OVR_CLR                      0x0230
720 #define R128_OVR_WID_LEFT_RIGHT           0x0234
721 #define R128_OVR_WID_TOP_BOTTOM           0x0238
722 
723 /* first overlay unit (there is only one) */
724 
725 #define R128_OV0_Y_X_START                0x0400
726 #define R128_OV0_Y_X_END                  0x0404
727 #define R128_OV0_EXCLUSIVE_HORZ           0x0408
728 #       define  R128_EXCL_HORZ_START_MASK        0x000000ff
729 #       define  R128_EXCL_HORZ_END_MASK          0x0000ff00
730 #       define  R128_EXCL_HORZ_BACK_PORCH_MASK   0x00ff0000
731 #       define  R128_EXCL_HORZ_EXCLUSIVE_EN      0x80000000
732 #define R128_OV0_EXCLUSIVE_VERT           0x040C
733 #       define  R128_EXCL_VERT_START_MASK        0x000003ff
734 #       define  R128_EXCL_VERT_END_MASK          0x03ff0000
735 #define R128_OV0_REG_LOAD_CNTL            0x0410
736 #       define  R128_REG_LD_CTL_LOCK                 0x00000001L
737 #       define  R128_REG_LD_CTL_VBLANK_DURING_LOCK   0x00000002L
738 #       define  R128_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L
739 #       define  R128_REG_LD_CTL_LOCK_READBACK        0x00000008L
740 #define R128_OV0_SCALE_CNTL               0x0420
741 #       define  R128_SCALER_PIX_EXPAND           0x00000001L
742 #       define  R128_SCALER_Y2R_TEMP             0x00000002L
743 #       define  R128_SCALER_HORZ_PICK_NEAREST    0x00000003L
744 #       define  R128_SCALER_VERT_PICK_NEAREST    0x00000004L
745 #       define  R128_SCALER_SIGNED_UV            0x00000010L
746 #       define  R128_SCALER_GAMMA_SEL_MASK       0x00000060L
747 #       define  R128_SCALER_GAMMA_SEL_BRIGHT     0x00000000L
748 #       define  R128_SCALER_GAMMA_SEL_G22        0x00000020L
749 #       define  R128_SCALER_GAMMA_SEL_G18        0x00000040L
750 #       define  R128_SCALER_GAMMA_SEL_G14        0x00000060L
751 #       define  R128_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L
752 #       define  R128_SCALER_SURFAC_FORMAT        0x00000f00L
753 #       define  R128_SCALER_SOURCE_15BPP         0x00000300L
754 #       define  R128_SCALER_SOURCE_16BPP         0x00000400L
755 #       define  R128_SCALER_SOURCE_32BPP         0x00000600L
756 #       define  R128_SCALER_SOURCE_YUV9          0x00000900L
757 #       define  R128_SCALER_SOURCE_YUV12         0x00000A00L
758 #       define  R128_SCALER_SOURCE_VYUY422       0x00000B00L
759 #       define  R128_SCALER_SOURCE_YVYU422       0x00000C00L
760 #       define  R128_SCALER_SMART_SWITCH         0x00008000L
761 #       define  R128_SCALER_BURST_PER_PLANE      0x00ff0000L
762 #       define  R128_SCALER_DOUBLE_BUFFER        0x01000000L
763 #       define  R128_SCALER_DIS_LIMIT            0x08000000L
764 #       define  R128_SCALER_PRG_LOAD_START       0x10000000L
765 #       define  R128_SCALER_INT_EMU              0x20000000L
766 #       define  R128_SCALER_ENABLE               0x40000000L
767 #       define  R128_SCALER_SOFT_RESET           0x80000000L
768 #define R128_OV0_V_INC                    0x0424
769 #define R128_OV0_P1_V_ACCUM_INIT          0x0428
770 #       define  R128_OV0_P1_MAX_LN_IN_PER_LN_OUT        0x00000003L
771 #       define  R128_OV0_P1_V_ACCUM_INIT_MASK           0x01ff8000L
772 #define R128_OV0_P23_V_ACCUM_INIT         0x042C
773 #define R128_OV0_P1_BLANK_LINES_AT_TOP    0x0430
774 #       define  R128_P1_BLNK_LN_AT_TOP_M1_MASK   0x00000fffL
775 #       define  R128_P1_ACTIVE_LINES_M1          0x0fff0000L
776 #define R128_OV0_P23_BLANK_LINES_AT_TOP   0x0434
777 #       define  R128_P23_BLNK_LN_AT_TOP_M1_MASK  0x000007ffL
778 #       define  R128_P23_ACTIVE_LINES_M1         0x07ff0000L
779 #define R128_OV0_VID_BUF0_BASE_ADRS       0x0440
780 #       define  R128_VIF_BUF0_PITCH_SEL          0x00000001L
781 #       define  R128_VIF_BUF0_TILE_ADRS          0x00000002L
782 #       define  R128_VIF_BUF0_BASE_ADRS_MASK     0x03fffff0L
783 #       define  R128_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L
784 #define R128_OV0_VID_BUF1_BASE_ADRS       0x0444
785 #       define  R128_VIF_BUF1_PITCH_SEL          0x00000001L
786 #       define  R128_VIF_BUF1_TILE_ADRS          0x00000002L
787 #       define  R128_VIF_BUF1_BASE_ADRS_MASK     0x03fffff0L
788 #       define  R128_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L
789 #define R128_OV0_VID_BUF2_BASE_ADRS       0x0448
790 #       define  R128_VIF_BUF2_PITCH_SEL          0x00000001L
791 #       define  R128_VIF_BUF2_TILE_ADRS          0x00000002L
792 #       define  R128_VIF_BUF2_BASE_ADRS_MASK     0x03fffff0L
793 #       define  R128_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L
794 #define R128_OV0_VID_BUF3_BASE_ADRS       0x044C
795 #define R128_OV0_VID_BUF4_BASE_ADRS       0x0450
796 #define R128_OV0_VID_BUF5_BASE_ADRS       0x0454
797 #define R128_OV0_VID_BUF_PITCH0_VALUE     0x0460
798 #define R128_OV0_VID_BUF_PITCH1_VALUE     0x0464
799 #define R128_OV0_AUTO_FLIP_CNTL           0x0470
800 #define R128_OV0_DEINTERLACE_PATTERN      0x0474
801 #define R128_OV0_H_INC                    0x0480
802 #define R128_OV0_STEP_BY                  0x0484
803 #define R128_OV0_P1_H_ACCUM_INIT          0x0488
804 #define R128_OV0_P23_H_ACCUM_INIT         0x048C
805 #define R128_OV0_P1_X_START_END           0x0494
806 #define R128_OV0_P2_X_START_END           0x0498
807 #define R128_OV0_P3_X_START_END           0x049C
808 #define R128_OV0_FILTER_CNTL              0x04A0
809 #define R128_OV0_FOUR_TAP_COEF_0          0x04B0
810 #define R128_OV0_FOUR_TAP_COEF_1          0x04B4
811 #define R128_OV0_FOUR_TAP_COEF_2          0x04B8
812 #define R128_OV0_FOUR_TAP_COEF_3          0x04BC
813 #define R128_OV0_FOUR_TAP_COEF_4          0x04C0
814 #define R128_OV0_COLOUR_CNTL              0x04E0
815 #define R128_OV0_VIDEO_KEY_CLR            0x04E4
816 #define R128_OV0_VIDEO_KEY_MSK            0x04E8
817 #define R128_OV0_GRAPHICS_KEY_CLR         0x04EC
818 #define R128_OV0_GRAPHICS_KEY_MSK         0x04F0
819 #define R128_OV0_KEY_CNTL                 0x04F4
820 #       define  R128_VIDEO_KEY_FN_MASK           0x00000007L
821 #       define  R128_VIDEO_KEY_FN_FALSE          0x00000000L
822 #       define  R128_VIDEO_KEY_FN_TRUE           0x00000001L
823 #       define  R128_VIDEO_KEY_FN_EQ             0x00000004L
824 #       define  R128_VIDEO_KEY_FN_NE             0x00000005L
825 #       define  R128_GRAPHIC_KEY_FN_MASK         0x00000070L
826 #       define  R128_GRAPHIC_KEY_FN_FALSE        0x00000000L
827 #       define  R128_GRAPHIC_KEY_FN_TRUE         0x00000010L
828 #       define  R128_GRAPHIC_KEY_FN_EQ           0x00000040L
829 #       define  R128_GRAPHIC_KEY_FN_NE           0x00000050L
830 #       define  R128_CMP_MIX_MASK                0x00000100L
831 #       define  R128_CMP_MIX_OR                  0x00000000L
832 #       define  R128_CMP_MIX_AND                 0x00000100L
833 #define R128_OV0_TEST                     0x04F8
834 
835 
836 #define R128_PALETTE_DATA                 0x00b4
837 #define R128_PALETTE_INDEX                0x00b0
838 #define R128_PC_DEBUG_MODE                0x1760
839 #define R128_PC_GUI_CTLSTAT               0x1748
840 #define R128_PC_GUI_MODE                  0x1744
841 #       define R128_PC_IGNORE_UNIFY       (1 << 5)
842 #define R128_PC_MISC_CNTL                 0x0188
843 #define R128_PC_NGUI_CTLSTAT              0x0184
844 #       define R128_PC_FLUSH_GUI          (3 << 0)
845 #       define R128_PC_RI_GUI             (1 << 2)
846 #       define R128_PC_FLUSH_ALL          0x00ff
847 #       define R128_PC_BUSY               (1 << 31)
848 #define R128_PC_NGUI_MODE                 0x0180
849 #define R128_PCI_GART_PAGE                0x017c
850 #define R128_PLANE_3D_MASK_C              0x1d44
851 #define R128_PLL_TEST_CNTL                0x0013 /* PLL */
852 #define R128_PMI_CAP_ID                   0x0f5c /* PCI */
853 #define R128_PMI_DATA                     0x0f63 /* PCI */
854 #define R128_PMI_NXT_CAP_PTR              0x0f5d /* PCI */
855 #define R128_PMI_PMC_REG                  0x0f5e /* PCI */
856 #define R128_PMI_PMCSR_REG                0x0f60 /* PCI */
857 #define R128_PMI_REGISTER                 0x0f5c /* PCI */
858 #define R128_PPLL_CNTL                    0x0002 /* PLL */
859 #       define R128_PPLL_RESET                (1 <<  0)
860 #       define R128_PPLL_SLEEP                (1 <<  1)
861 #       define R128_PPLL_ATOMIC_UPDATE_EN     (1 << 16)
862 #       define R128_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
863 #define R128_PPLL_DIV_0                   0x0004 /* PLL */
864 #define R128_PPLL_DIV_1                   0x0005 /* PLL */
865 #define R128_PPLL_DIV_2                   0x0006 /* PLL */
866 #define R128_PPLL_DIV_3                   0x0007 /* PLL */
867 #       define R128_PPLL_FB3_DIV_MASK     0x07ff
868 #       define R128_PPLL_POST3_DIV_MASK   0x00070000
869 #define R128_PPLL_REF_DIV                 0x0003 /* PLL */
870 #       define R128_PPLL_REF_DIV_MASK     0x03ff
871 #       define R128_PPLL_ATOMIC_UPDATE_R  (1 << 15) /* same as _W */
872 #       define R128_PPLL_ATOMIC_UPDATE_W  (1 << 15) /* same as _R */
873 #define R128_PWR_MNGMT_CNTL_STATUS        0x0f60 /* PCI */
874 #define R128_REG_BASE                     0x0f18 /* PCI */
875 #define R128_REGPROG_INF                  0x0f09 /* PCI */
876 #define R128_REVISION_ID                  0x0f08 /* PCI */
877 
878 #define R128_SC_BOTTOM                    0x164c
879 #define R128_SC_BOTTOM_RIGHT              0x16f0
880 #define R128_SC_BOTTOM_RIGHT_C            0x1c8c
881 #define R128_SC_LEFT                      0x1640
882 #define R128_SC_RIGHT                     0x1644
883 #define R128_SC_TOP                       0x1648
884 #define R128_SC_TOP_LEFT                  0x16ec
885 #define R128_SC_TOP_LEFT_C                0x1c88
886 #define R128_SEQ8_DATA                    0x03c5 /* VGA */
887 #define R128_SEQ8_IDX                     0x03c4 /* VGA */
888 #define R128_SNAPSHOT_F_COUNT             0x0244
889 #define R128_SNAPSHOT_VH_COUNTS           0x0240
890 #define R128_SNAPSHOT_VIF_COUNT           0x024c
891 #define R128_SRC_OFFSET                   0x15ac
892 #define R128_SRC_PITCH                    0x15b0
893 #define R128_SRC_PITCH_OFFSET             0x1428
894 #define R128_SRC_SC_BOTTOM                0x165c
895 #define R128_SRC_SC_BOTTOM_RIGHT          0x16f4
896 #define R128_SRC_SC_RIGHT                 0x1654
897 #define R128_SRC_X                        0x1414
898 #define R128_SRC_X_Y                      0x1590
899 #define R128_SRC_Y                        0x1418
900 #define R128_SRC_Y_X                      0x1434
901 #define R128_STATUS                       0x0f06 /* PCI */
902 #define R128_SUBPIC_CNTL                  0x0540 /* ? */
903 #define R128_SUB_CLASS                    0x0f0a /* PCI */
904 #define R128_SURFACE_DELAY                0x0b00
905 #define R128_SURFACE0_INFO                0x0b0c
906 #define R128_SURFACE0_LOWER_BOUND         0x0b04
907 #define R128_SURFACE0_UPPER_BOUND         0x0b08
908 #define R128_SURFACE1_INFO                0x0b1c
909 #define R128_SURFACE1_LOWER_BOUND         0x0b14
910 #define R128_SURFACE1_UPPER_BOUND         0x0b18
911 #define R128_SURFACE2_INFO                0x0b2c
912 #define R128_SURFACE2_LOWER_BOUND         0x0b24
913 #define R128_SURFACE2_UPPER_BOUND         0x0b28
914 #define R128_SURFACE3_INFO                0x0b3c
915 #define R128_SURFACE3_LOWER_BOUND         0x0b34
916 #define R128_SURFACE3_UPPER_BOUND         0x0b38
917 #define R128_SW_SEMAPHORE                 0x013c
918 
919 #define R128_TEST_DEBUG_CNTL              0x0120
920 #define R128_TEST_DEBUG_MUX               0x0124
921 #define R128_TEST_DEBUG_OUT               0x012c
922 #define R128_TMDS_CRC                     0x02a0
923 #define R128_TRAIL_BRES_DEC               0x1614
924 #define R128_TRAIL_BRES_ERR               0x160c
925 #define R128_TRAIL_BRES_INC               0x1610
926 #define R128_TRAIL_X                      0x1618
927 #define R128_TRAIL_X_SUB                  0x1620
928 
929 #define R128_VCLK_ECP_CNTL                0x0008 /* PLL */
930 #define R128_VENDOR_ID                    0x0f00 /* PCI */
931 #define R128_VGA_DDA_CONFIG               0x02e8
932 #define R128_VGA_DDA_ON_OFF               0x02ec
933 #define R128_VID_BUFFER_CONTROL           0x0900
934 #define R128_VIDEOMUX_CNTL                0x0190
935 #define R128_VIPH_CONTROL                 0x01D0 /* ? */
936 
937 #define R128_WAIT_UNTIL                   0x1720
938 
939 #define R128_X_MPLL_REF_FB_DIV            0x000a /* PLL */
940 #define R128_XCLK_CNTL                    0x000d /* PLL */
941 #define R128_XDLL_CNTL                    0x000c /* PLL */
942 #define R128_XPLL_CNTL                    0x000b /* PLL */
943 
944 				/* Registers for CCE and Microcode Engine */
945 #define R128_PM4_MICROCODE_ADDR           0x07d4
946 #define R128_PM4_MICROCODE_RADDR          0x07d8
947 #define R128_PM4_MICROCODE_DATAH          0x07dc
948 #define R128_PM4_MICROCODE_DATAL          0x07e0
949 
950 #define R128_PM4_BUFFER_OFFSET            0x0700
951 #define R128_PM4_BUFFER_CNTL              0x0704
952 #       define R128_PM4_NONPM4                 (0  << 28)
953 #       define R128_PM4_192PIO                 (1  << 28)
954 #       define R128_PM4_192BM                  (2  << 28)
955 #       define R128_PM4_128PIO_64INDBM         (3  << 28)
956 #       define R128_PM4_128BM_64INDBM          (4  << 28)
957 #       define R128_PM4_64PIO_128INDBM         (5  << 28)
958 #       define R128_PM4_64BM_128INDBM          (6  << 28)
959 #       define R128_PM4_64PIO_64VCBM_64INDBM   (7  << 28)
960 #       define R128_PM4_64BM_64VCBM_64INDBM    (8  << 28)
961 #       define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28)
962 #define R128_PM4_BUFFER_WM_CNTL           0x0708
963 #       define R128_WMA_SHIFT                  0
964 #       define R128_WMB_SHIFT                  8
965 #       define R128_WMC_SHIFT                 16
966 #       define R128_WB_WM_SHIFT               24
967 #define R128_PM4_BUFFER_DL_RPTR_ADDR      0x070c
968 #define R128_PM4_BUFFER_DL_RPTR           0x0710
969 #define R128_PM4_BUFFER_DL_WPTR           0x0714
970 #       define R128_PM4_BUFFER_DL_DONE    (1 << 31)
971 #define R128_PM4_BUFFER_DL_WPTR_DELAY     0x0718
972 #       define R128_PRE_WRITE_TIMER_SHIFT      0
973 #       define R128_PRE_WRITE_LIMIT_SHIFT     23
974 #define R128_PM4_VC_FPU_SETUP             0x071c
975 #       define R128_FRONT_DIR_CW          (0 <<  0)
976 #       define R128_FRONT_DIR_CCW         (1 <<  0)
977 #       define R128_FRONT_DIR_MASK        (1 <<  0)
978 #       define R128_BACKFACE_CULL         (0 <<  1)
979 #       define R128_BACKFACE_POINTS       (1 <<  1)
980 #       define R128_BACKFACE_LINES        (2 <<  1)
981 #       define R128_BACKFACE_SOLID        (3 <<  1)
982 #       define R128_BACKFACE_MASK         (3 <<  1)
983 #       define R128_FRONTFACE_CULL        (0 <<  3)
984 #       define R128_FRONTFACE_POINTS      (1 <<  3)
985 #       define R128_FRONTFACE_LINES       (2 <<  3)
986 #       define R128_FRONTFACE_SOLID       (3 <<  3)
987 #       define R128_FRONTFACE_MASK        (3 <<  3)
988 #       define R128_FPU_COLOR_SOLID       (0 <<  5)
989 #       define R128_FPU_COLOR_FLAT        (1 <<  5)
990 #       define R128_FPU_COLOR_GOURAUD     (2 <<  5)
991 #       define R128_FPU_COLOR_GOURAUD2    (3 <<  5)
992 #       define R128_FPU_COLOR_MASK        (3 <<  5)
993 #       define R128_FPU_SUB_PIX_2BITS     (0 <<  7)
994 #       define R128_FPU_SUB_PIX_4BITS     (1 <<  7)
995 #       define R128_FPU_MODE_2D           (0 <<  8)
996 #       define R128_FPU_MODE_3D           (1 <<  8)
997 #       define R128_TRAP_BITS_DISABLE     (1 <<  9)
998 #       define R128_EDGE_ANTIALIAS        (1 << 10)
999 #       define R128_SUPERSAMPLE           (1 << 11)
1000 #       define R128_XFACTOR_2             (0 << 12)
1001 #       define R128_XFACTOR_4             (1 << 12)
1002 #       define R128_YFACTOR_2             (0 << 13)
1003 #       define R128_YFACTOR_4             (1 << 13)
1004 #       define R128_FLAT_SHADE_VERTEX_D3D (0 << 14)
1005 #       define R128_FLAT_SHADE_VERTEX_OGL (1 << 14)
1006 #       define R128_FPU_ROUND_TRUNCATE    (0 << 15)
1007 #       define R128_FPU_ROUND_NEAREST     (1 << 15)
1008 #       define R128_WM_SEL_8DW            (0 << 16)
1009 #       define R128_WM_SEL_16DW           (1 << 16)
1010 #       define R128_WM_SEL_32DW           (2 << 16)
1011 #define R128_PM4_VC_DEBUG_CONFIG          0x07a4
1012 #define R128_PM4_VC_STAT                  0x07a8
1013 #define R128_PM4_VC_TIMESTAMP0            0x07b0
1014 #define R128_PM4_VC_TIMESTAMP1            0x07b4
1015 #define R128_PM4_STAT                     0x07b8
1016 #       define R128_PM4_FIFOCNT_MASK      0x0fff
1017 #       define R128_PM4_BUSY              (1 << 16)
1018 #       define R128_PM4_GUI_ACTIVE        (1 << 31)
1019 #define R128_PM4_BUFFER_ADDR              0x07f0
1020 #define R128_PM4_MICRO_CNTL               0x07fc
1021 #       define R128_PM4_MICRO_FREERUN     (1 << 30)
1022 #define R128_PM4_FIFO_DATA_EVEN           0x1000
1023 #define R128_PM4_FIFO_DATA_ODD            0x1004
1024 
1025 #define R128_SCALE_3D_CNTL                0x1a00
1026 #       define R128_SCALE_DITHER_ERR_DIFF         (0  <<  1)
1027 #       define R128_SCALE_DITHER_TABLE            (1  <<  1)
1028 #       define R128_TEX_CACHE_SIZE_FULL           (0  <<  2)
1029 #       define R128_TEX_CACHE_SIZE_HALF           (1  <<  2)
1030 #       define R128_DITHER_INIT_CURR              (0  <<  3)
1031 #       define R128_DITHER_INIT_RESET             (1  <<  3)
1032 #       define R128_ROUND_24BIT                   (1  <<  4)
1033 #       define R128_TEX_CACHE_DISABLE             (1  <<  5)
1034 #       define R128_SCALE_3D_NOOP                 (0  <<  6)
1035 #       define R128_SCALE_3D_SCALE                (1  <<  6)
1036 #       define R128_SCALE_3D_TEXMAP_SHADE         (2  <<  6)
1037 #       define R128_SCALE_PIX_BLEND               (0  <<  8)
1038 #       define R128_SCALE_PIX_REPLICATE           (1  <<  8)
1039 #       define R128_TEX_CACHE_SPLIT               (1  <<  9)
1040 #       define R128_APPLE_YUV_MODE                (1  << 10)
1041 #       define R128_TEX_CACHE_PALLETE_MODE        (1  << 11)
1042 #       define R128_ALPHA_COMB_ADD_CLAMP          (0  << 12)
1043 #       define R128_ALPHA_COMB_ADD_NCLAMP         (1  << 12)
1044 #       define R128_ALPHA_COMB_SUB_DST_SRC_CLAMP  (2  << 12)
1045 #       define R128_ALPHA_COMB_SUB_DST_SRC_NCLAMP (3  << 12)
1046 #       define R128_FOG_TABLE                     (1  << 14)
1047 #       define R128_SIGNED_DST_CLAMP              (1  << 15)
1048 #       define R128_ALPHA_BLEND_SRC_ZERO          (0  << 16)
1049 #       define R128_ALPHA_BLEND_SRC_ONE           (1  << 16)
1050 #       define R128_ALPHA_BLEND_SRC_SRCCOLOR      (2  << 16)
1051 #       define R128_ALPHA_BLEND_SRC_INVSRCCOLOR   (3  << 16)
1052 #       define R128_ALPHA_BLEND_SRC_SRCALPHA      (4  << 16)
1053 #       define R128_ALPHA_BLEND_SRC_INVSRCALPHA   (5  << 16)
1054 #       define R128_ALPHA_BLEND_SRC_DSTALPHA      (6  << 16)
1055 #       define R128_ALPHA_BLEND_SRC_INVDSTALPHA   (7  << 16)
1056 #       define R128_ALPHA_BLEND_SRC_DSTCOLOR      (8  << 16)
1057 #       define R128_ALPHA_BLEND_SRC_INVDSTCOLOR   (9  << 16)
1058 #       define R128_ALPHA_BLEND_SRC_SAT           (10 << 16)
1059 #       define R128_ALPHA_BLEND_SRC_BLEND         (11 << 16)
1060 #       define R128_ALPHA_BLEND_SRC_INVBLEND      (12 << 16)
1061 #       define R128_ALPHA_BLEND_DST_ZERO          (0  << 20)
1062 #       define R128_ALPHA_BLEND_DST_ONE           (1  << 20)
1063 #       define R128_ALPHA_BLEND_DST_SRCCOLOR      (2  << 20)
1064 #       define R128_ALPHA_BLEND_DST_INVSRCCOLOR   (3  << 20)
1065 #       define R128_ALPHA_BLEND_DST_SRCALPHA      (4  << 20)
1066 #       define R128_ALPHA_BLEND_DST_INVSRCALPHA   (5  << 20)
1067 #       define R128_ALPHA_BLEND_DST_DSTALPHA      (6  << 20)
1068 #       define R128_ALPHA_BLEND_DST_INVDSTALPHA   (7  << 20)
1069 #       define R128_ALPHA_BLEND_DST_DSTCOLOR      (8  << 20)
1070 #       define R128_ALPHA_BLEND_DST_INVDSTCOLOR   (9  << 20)
1071 #       define R128_ALPHA_TEST_NEVER              (0  << 24)
1072 #       define R128_ALPHA_TEST_LESS               (1  << 24)
1073 #       define R128_ALPHA_TEST_LESSEQUAL          (2  << 24)
1074 #       define R128_ALPHA_TEST_EQUAL              (3  << 24)
1075 #       define R128_ALPHA_TEST_GREATEREQUAL       (4  << 24)
1076 #       define R128_ALPHA_TEST_GREATER            (5  << 24)
1077 #       define R128_ALPHA_TEST_NEQUAL             (6  << 24)
1078 #       define R128_ALPHA_TEST_ALWAYS             (7  << 24)
1079 #       define R128_COMPOSITE_SHADOW_CMP_EQUAL    (0  << 28)
1080 #       define R128_COMPOSITE_SHADOW_CMP_NEQUAL   (1  << 28)
1081 #       define R128_COMPOSITE_SHADOW              (1  << 29)
1082 #       define R128_TEX_MAP_ALPHA_IN_TEXTURE      (1  << 30)
1083 #       define R128_TEX_CACHE_LINE_SIZE_8QW       (0  << 31)
1084 #       define R128_TEX_CACHE_LINE_SIZE_4QW       (1  << 31)
1085 #define R128_SCALE_3D_DATATYPE            0x1a20
1086 
1087 #define R128_SETUP_CNTL                   0x1bc4
1088 #       define R128_DONT_START_TRIANGLE   (1 <<  0)
1089 #       define R128_Z_BIAS                (0 <<  1)
1090 #       define R128_DONT_START_ANY_ON     (1 <<  2)
1091 #       define R128_COLOR_SOLID_COLOR     (0 <<  3)
1092 #       define R128_COLOR_FLAT_VERT_1     (1 <<  3)
1093 #       define R128_COLOR_FLAT_VERT_2     (2 <<  3)
1094 #       define R128_COLOR_FLAT_VERT_3     (3 <<  3)
1095 #       define R128_COLOR_GOURAUD         (4 <<  3)
1096 #       define R128_PRIM_TYPE_TRI         (0 <<  7)
1097 #       define R128_PRIM_TYPE_LINE        (1 <<  7)
1098 #       define R128_PRIM_TYPE_POINT       (2 <<  7)
1099 #       define R128_PRIM_TYPE_POLY_EDGE   (3 <<  7)
1100 #       define R128_TEXTURE_ST_MULT_W     (0 <<  9)
1101 #       define R128_TEXTURE_ST_DIRECT     (1 <<  9)
1102 #       define R128_STARTING_VERTEX_1     (1 << 14)
1103 #       define R128_STARTING_VERTEX_2     (2 << 14)
1104 #       define R128_STARTING_VERTEX_3     (3 << 14)
1105 #       define R128_ENDING_VERTEX_1       (1 << 16)
1106 #       define R128_ENDING_VERTEX_2       (2 << 16)
1107 #       define R128_ENDING_VERTEX_3       (3 << 16)
1108 #       define R128_SU_POLY_LINE_LAST     (0 << 18)
1109 #       define R128_SU_POLY_LINE_NOT_LAST (1 << 18)
1110 #       define R128_SUB_PIX_2BITS         (0 << 19)
1111 #       define R128_SUB_PIX_4BITS         (1 << 19)
1112 #       define R128_SET_UP_CONTINUE       (1 << 31)
1113 
1114 #define R128_WINDOW_XY_OFFSET             0x1bcc
1115 #       define R128_WINDOW_Y_SHIFT        4
1116 #       define R128_WINDOW_X_SHIFT        20
1117 
1118 #define R128_Z_OFFSET_C                   0x1c90
1119 #define R128_Z_PITCH_C                    0x1c94
1120 #       define R128_Z_TILE                    (1 << 16)
1121 #define R128_Z_STEN_CNTL_C                0x1c98
1122 #       define R128_Z_PIX_WIDTH_16            (0 <<  1)
1123 #       define R128_Z_PIX_WIDTH_24            (1 <<  1)
1124 #       define R128_Z_PIX_WIDTH_32            (2 <<  1)
1125 #       define R128_Z_PIX_WIDTH_MASK          (3 <<  1)
1126 #       define R128_Z_TEST_NEVER              (0 <<  4)
1127 #       define R128_Z_TEST_LESS               (1 <<  4)
1128 #       define R128_Z_TEST_LESSEQUAL          (2 <<  4)
1129 #       define R128_Z_TEST_EQUAL              (3 <<  4)
1130 #       define R128_Z_TEST_GREATEREQUAL       (4 <<  4)
1131 #       define R128_Z_TEST_GREATER            (5 <<  4)
1132 #       define R128_Z_TEST_NEQUAL             (6 <<  4)
1133 #       define R128_Z_TEST_ALWAYS             (7 <<  4)
1134 #       define R128_Z_TEST_MASK               (7 <<  4)
1135 #       define R128_STENCIL_TEST_NEVER        (0 << 12)
1136 #       define R128_STENCIL_TEST_LESS         (1 << 12)
1137 #       define R128_STENCIL_TEST_LESSEQUAL    (2 << 12)
1138 #       define R128_STENCIL_TEST_EQUAL        (3 << 12)
1139 #       define R128_STENCIL_TEST_GREATEREQUAL (4 << 12)
1140 #       define R128_STENCIL_TEST_GREATER      (5 << 12)
1141 #       define R128_STENCIL_TEST_NEQUAL       (6 << 12)
1142 #       define R128_STENCIL_TEST_ALWAYS       (7 << 12)
1143 #       define R128_STENCIL_S_FAIL_KEEP       (0 << 16)
1144 #       define R128_STENCIL_S_FAIL_ZERO       (1 << 16)
1145 #       define R128_STENCIL_S_FAIL_REPLACE    (2 << 16)
1146 #       define R128_STENCIL_S_FAIL_INC        (3 << 16)
1147 #       define R128_STENCIL_S_FAIL_DEC        (4 << 16)
1148 #       define R128_STENCIL_S_FAIL_INV        (5 << 16)
1149 #       define R128_STENCIL_ZPASS_KEEP        (0 << 20)
1150 #       define R128_STENCIL_ZPASS_ZERO        (1 << 20)
1151 #       define R128_STENCIL_ZPASS_REPLACE     (2 << 20)
1152 #       define R128_STENCIL_ZPASS_INC         (3 << 20)
1153 #       define R128_STENCIL_ZPASS_DEC         (4 << 20)
1154 #       define R128_STENCIL_ZPASS_INV         (5 << 20)
1155 #       define R128_STENCIL_ZFAIL_KEEP        (0 << 24)
1156 #       define R128_STENCIL_ZFAIL_ZERO        (1 << 24)
1157 #       define R128_STENCIL_ZFAIL_REPLACE     (2 << 24)
1158 #       define R128_STENCIL_ZFAIL_INC         (3 << 24)
1159 #       define R128_STENCIL_ZFAIL_DEC         (4 << 24)
1160 #       define R128_STENCIL_ZFAIL_INV         (5 << 24)
1161 #define R128_TEX_CNTL_C                   0x1c9c
1162 #       define R128_Z_ENABLE                   (1 <<  0)
1163 #       define R128_Z_WRITE_ENABLE             (1 <<  1)
1164 #       define R128_STENCIL_ENABLE             (1 <<  3)
1165 #       define R128_SHADE_ENABLE               (0 <<  4)
1166 #       define R128_TEXMAP_ENABLE              (1 <<  4)
1167 #       define R128_SEC_TEXMAP_ENABLE          (1 <<  5)
1168 #       define R128_FOG_ENABLE                 (1 <<  7)
1169 #       define R128_DITHER_ENABLE              (1 <<  8)
1170 #       define R128_ALPHA_ENABLE               (1 <<  9)
1171 #       define R128_ALPHA_TEST_ENABLE          (1 << 10)
1172 #       define R128_SPEC_LIGHT_ENABLE          (1 << 11)
1173 #       define R128_TEX_CHROMA_KEY_ENABLE      (1 << 12)
1174 #       define R128_ALPHA_IN_TEX_COMPLETE_A    (0 << 13)
1175 #       define R128_ALPHA_IN_TEX_LSB_A         (1 << 13)
1176 #       define R128_LIGHT_DIS                  (0 << 14)
1177 #       define R128_LIGHT_COPY                 (1 << 14)
1178 #       define R128_LIGHT_MODULATE             (2 << 14)
1179 #       define R128_LIGHT_ADD                  (3 << 14)
1180 #       define R128_LIGHT_BLEND_CONSTANT       (4 << 14)
1181 #       define R128_LIGHT_BLEND_TEXTURE        (5 << 14)
1182 #       define R128_LIGHT_BLEND_VERTEX         (6 << 14)
1183 #       define R128_LIGHT_BLEND_CONST_COLOR    (7 << 14)
1184 #       define R128_ALPHA_LIGHT_DIS            (0 << 18)
1185 #       define R128_ALPHA_LIGHT_COPY           (1 << 18)
1186 #       define R128_ALPHA_LIGHT_MODULATE       (2 << 18)
1187 #       define R128_ALPHA_LIGHT_ADD            (3 << 18)
1188 #       define R128_ANTI_ALIAS                 (1 << 21)
1189 #       define R128_TEX_CACHE_FLUSH            (1 << 23)
1190 #       define R128_LOD_BIAS_SHIFT             24
1191 #       define R128_LOD_BIAS_MASK              (0xff << 24)
1192 #define R128_MISC_3D_STATE_CNTL_REG       0x1ca0
1193 #       define R128_REF_ALPHA_MASK                  0xff
1194 #       define R128_MISC_SCALE_3D_NOOP              (0  <<  8)
1195 #       define R128_MISC_SCALE_3D_SCALE             (1  <<  8)
1196 #       define R128_MISC_SCALE_3D_TEXMAP_SHADE      (2  <<  8)
1197 #       define R128_MISC_SCALE_PIX_BLEND            (0  << 10)
1198 #       define R128_MISC_SCALE_PIX_REPLICATE        (1  << 10)
1199 #       define R128_ALPHA_COMB_ADD_CLAMP            (0  << 12)
1200 #       define R128_ALPHA_COMB_ADD_NO_CLAMP         (1  << 12)
1201 #       define R128_ALPHA_COMB_SUB_SRC_DST_CLAMP    (2  << 12)
1202 #       define R128_ALPHA_COMB_SUB_SRC_DST_NO_CLAMP (3  << 12)
1203 #       define R128_FOG_VERTEX                      (0  << 14)
1204 #       define R128_FOG_TABLE                       (1  << 14)
1205 #       define R128_ALPHA_BLEND_SRC_ZERO            (0  << 16)
1206 #       define R128_ALPHA_BLEND_SRC_ONE             (1  << 16)
1207 #       define R128_ALPHA_BLEND_SRC_SRCCOLOR        (2  << 16)
1208 #       define R128_ALPHA_BLEND_SRC_INVSRCCOLOR     (3  << 16)
1209 #       define R128_ALPHA_BLEND_SRC_SRCALPHA        (4  << 16)
1210 #       define R128_ALPHA_BLEND_SRC_INVSRCALPHA     (5  << 16)
1211 #       define R128_ALPHA_BLEND_SRC_DESTALPHA       (6  << 16)
1212 #       define R128_ALPHA_BLEND_SRC_INVDESTALPHA    (7  << 16)
1213 #       define R128_ALPHA_BLEND_SRC_DESTCOLOR       (8  << 16)
1214 #       define R128_ALPHA_BLEND_SRC_INVDESTCOLOR    (9  << 16)
1215 #       define R128_ALPHA_BLEND_SRC_SRCALPHASAT     (10 << 16)
1216 #       define R128_ALPHA_BLEND_SRC_BOTHSRCALPHA    (11 << 16)
1217 #       define R128_ALPHA_BLEND_SRC_BOTHINVSRCALPHA (12 << 16)
1218 #       define R128_ALPHA_BLEND_SRC_MASK            (15 << 16)
1219 #       define R128_ALPHA_BLEND_DST_ZERO            (0  << 20)
1220 #       define R128_ALPHA_BLEND_DST_ONE             (1  << 20)
1221 #       define R128_ALPHA_BLEND_DST_SRCCOLOR        (2  << 20)
1222 #       define R128_ALPHA_BLEND_DST_INVSRCCOLOR     (3  << 20)
1223 #       define R128_ALPHA_BLEND_DST_SRCALPHA        (4  << 20)
1224 #       define R128_ALPHA_BLEND_DST_INVSRCALPHA     (5  << 20)
1225 #       define R128_ALPHA_BLEND_DST_DESTALPHA       (6  << 20)
1226 #       define R128_ALPHA_BLEND_DST_INVDESTALPHA    (7  << 20)
1227 #       define R128_ALPHA_BLEND_DST_DESTCOLOR       (8  << 20)
1228 #       define R128_ALPHA_BLEND_DST_INVDESTCOLOR    (9  << 20)
1229 #       define R128_ALPHA_BLEND_DST_SRCALPHASAT     (10 << 20)
1230 #       define R128_ALPHA_BLEND_DST_MASK            (15 << 20)
1231 #       define R128_ALPHA_TEST_NEVER                (0  << 24)
1232 #       define R128_ALPHA_TEST_LESS                 (1  << 24)
1233 #       define R128_ALPHA_TEST_LESSEQUAL            (2  << 24)
1234 #       define R128_ALPHA_TEST_EQUAL                (3  << 24)
1235 #       define R128_ALPHA_TEST_GREATEREQUAL         (4  << 24)
1236 #       define R128_ALPHA_TEST_GREATER              (5  << 24)
1237 #       define R128_ALPHA_TEST_NEQUAL               (6  << 24)
1238 #       define R128_ALPHA_TEST_ALWAYS               (7  << 24)
1239 #       define R128_ALPHA_TEST_MASK                 (7  << 24)
1240 #define R128_TEXTURE_CLR_CMP_CLR_C        0x1ca4
1241 #define R128_TEXTURE_CLR_CMP_MSK_C        0x1ca8
1242 #define R128_FOG_COLOR_C                  0x1cac
1243 #       define R128_FOG_BLUE_SHIFT             0
1244 #       define R128_FOG_GREEN_SHIFT            8
1245 #       define R128_FOG_RED_SHIFT             16
1246 #define R128_PRIM_TEX_CNTL_C              0x1cb0
1247 #       define R128_MIN_BLEND_NEAREST          (0  <<  1)
1248 #       define R128_MIN_BLEND_LINEAR           (1  <<  1)
1249 #       define R128_MIN_BLEND_MIPNEAREST       (2  <<  1)
1250 #       define R128_MIN_BLEND_MIPLINEAR        (3  <<  1)
1251 #       define R128_MIN_BLEND_LINEARMIPNEAREST (4  <<  1)
1252 #       define R128_MIN_BLEND_LINEARMIPLINEAR  (5  <<  1)
1253 #       define R128_MIN_BLEND_MASK             (7  <<  1)
1254 #       define R128_MAG_BLEND_NEAREST          (0  <<  4)
1255 #       define R128_MAG_BLEND_LINEAR           (1  <<  4)
1256 #       define R128_MAG_BLEND_MASK             (7  <<  4)
1257 #       define R128_MIP_MAP_DISABLE            (1  <<  7)
1258 #       define R128_TEX_CLAMP_S_WRAP           (0  <<  8)
1259 #       define R128_TEX_CLAMP_S_MIRROR         (1  <<  8)
1260 #       define R128_TEX_CLAMP_S_CLAMP          (2  <<  8)
1261 #       define R128_TEX_CLAMP_S_BORDER_COLOR   (3  <<  8)
1262 #       define R128_TEX_CLAMP_S_MASK           (3  <<  8)
1263 #       define R128_TEX_WRAP_S                 (1  << 10)
1264 #       define R128_TEX_CLAMP_T_WRAP           (0  << 11)
1265 #       define R128_TEX_CLAMP_T_MIRROR         (1  << 11)
1266 #       define R128_TEX_CLAMP_T_CLAMP          (2  << 11)
1267 #       define R128_TEX_CLAMP_T_BORDER_COLOR   (3  << 11)
1268 #       define R128_TEX_CLAMP_T_MASK           (3  << 11)
1269 #       define R128_TEX_WRAP_T                 (1  << 13)
1270 #       define R128_TEX_PERSPECTIVE_DISABLE    (1  << 14)
1271 #       define R128_DATATYPE_VQ                (0  << 16)
1272 #       define R128_DATATYPE_CI4               (1  << 16)
1273 #       define R128_DATATYPE_CI8               (2  << 16)
1274 #       define R128_DATATYPE_ARGB1555          (3  << 16)
1275 #       define R128_DATATYPE_RGB565            (4  << 16)
1276 #       define R128_DATATYPE_RGB888            (5  << 16)
1277 #       define R128_DATATYPE_ARGB8888          (6  << 16)
1278 #       define R128_DATATYPE_RGB332            (7  << 16)
1279 #       define R128_DATATYPE_Y8                (8  << 16)
1280 #       define R128_DATATYPE_RGB8              (9  << 16)
1281 #       define R128_DATATYPE_CI16              (10 << 16)
1282 #       define R128_DATATYPE_YUV422            (11 << 16)
1283 #       define R128_DATATYPE_YUV422_2          (12 << 16)
1284 #       define R128_DATATYPE_AYUV444           (14 << 16)
1285 #       define R128_DATATYPE_ARGB4444          (15 << 16)
1286 #       define R128_PALLETE_EITHER             (0  << 20)
1287 #       define R128_PALLETE_1                  (1  << 20)
1288 #       define R128_PALLETE_2                  (2  << 20)
1289 #       define R128_PSEUDOCOLOR_DT_RGB565      (0  << 24)
1290 #       define R128_PSEUDOCOLOR_DT_ARGB1555    (1  << 24)
1291 #       define R128_PSEUDOCOLOR_DT_ARGB4444    (2  << 24)
1292 #define R128_PRIM_TEXTURE_COMBINE_CNTL_C  0x1cb4
1293 #       define R128_COMB_DIS                 (0  <<  0)
1294 #       define R128_COMB_COPY                (1  <<  0)
1295 #       define R128_COMB_COPY_INP            (2  <<  0)
1296 #       define R128_COMB_MODULATE            (3  <<  0)
1297 #       define R128_COMB_MODULATE2X          (4  <<  0)
1298 #       define R128_COMB_MODULATE4X          (5  <<  0)
1299 #       define R128_COMB_ADD                 (6  <<  0)
1300 #       define R128_COMB_ADD_SIGNED          (7  <<  0)
1301 #       define R128_COMB_BLEND_VERTEX        (8  <<  0)
1302 #       define R128_COMB_BLEND_TEXTURE       (9  <<  0)
1303 #       define R128_COMB_BLEND_CONST         (10 <<  0)
1304 #       define R128_COMB_BLEND_PREMULT       (11 <<  0)
1305 #       define R128_COMB_BLEND_PREV          (12 <<  0)
1306 #       define R128_COMB_BLEND_PREMULT_INV   (13 <<  0)
1307 #       define R128_COMB_ADD_SIGNED2X        (14 <<  0)
1308 #       define R128_COMB_BLEND_CONST_COLOR   (15 <<  0)
1309 #       define R128_COMB_MASK                (15 <<  0)
1310 #       define R128_COLOR_FACTOR_TEX         (4  <<  4)
1311 #       define R128_COLOR_FACTOR_NTEX        (5  <<  4)
1312 #       define R128_COLOR_FACTOR_ALPHA       (6  <<  4)
1313 #       define R128_COLOR_FACTOR_NALPHA      (7  <<  4)
1314 #       define R128_COLOR_FACTOR_MASK        (15 <<  4)
1315 #       define R128_INPUT_FACTOR_CONST_COLOR (2  << 10)
1316 #       define R128_INPUT_FACTOR_CONST_ALPHA (3  << 10)
1317 #       define R128_INPUT_FACTOR_INT_COLOR   (4  << 10)
1318 #       define R128_INPUT_FACTOR_INT_ALPHA   (5  << 10)
1319 #       define R128_INPUT_FACTOR_MASK        (15 << 10)
1320 #       define R128_COMB_ALPHA_DIS           (0  << 14)
1321 #       define R128_COMB_ALPHA_COPY          (1  << 14)
1322 #       define R128_COMB_ALPHA_COPY_INP      (2  << 14)
1323 #       define R128_COMB_ALPHA_MODULATE      (3  << 14)
1324 #       define R128_COMB_ALPHA_MODULATE2X    (4  << 14)
1325 #       define R128_COMB_ALPHA_MODULATE4X    (5  << 14)
1326 #       define R128_COMB_ALPHA_ADD           (6  << 14)
1327 #       define R128_COMB_ALPHA_ADD_SIGNED    (7  << 14)
1328 #       define R128_COMB_ALPHA_ADD_SIGNED2X  (14 << 14)
1329 #       define R128_COMB_ALPHA_MASK          (15 << 14)
1330 #       define R128_ALPHA_FACTOR_TEX_ALPHA   (6  << 18)
1331 #       define R128_ALPHA_FACTOR_NTEX_ALPHA  (7  << 18)
1332 #       define R128_ALPHA_FACTOR_MASK        (15 << 18)
1333 #       define R128_INP_FACTOR_A_CONST_ALPHA (1  << 25)
1334 #       define R128_INP_FACTOR_A_INT_ALPHA   (2  << 25)
1335 #       define R128_INP_FACTOR_A_MASK        (7  << 25)
1336 #define R128_TEX_SIZE_PITCH_C             0x1cb8
1337 #       define R128_TEX_PITCH_SHIFT           0
1338 #       define R128_TEX_SIZE_SHIFT            4
1339 #       define R128_TEX_HEIGHT_SHIFT          8
1340 #       define R128_TEX_MIN_SIZE_SHIFT       12
1341 #       define R128_SEC_TEX_PITCH_SHIFT      16
1342 #       define R128_SEC_TEX_SIZE_SHIFT       20
1343 #       define R128_SEC_TEX_HEIGHT_SHIFT     24
1344 #       define R128_SEC_TEX_MIN_SIZE_SHIFT   28
1345 #       define R128_TEX_PITCH_MASK           (0x0f <<  0)
1346 #       define R128_TEX_SIZE_MASK            (0x0f <<  4)
1347 #       define R128_TEX_HEIGHT_MASK          (0x0f <<  8)
1348 #       define R128_TEX_MIN_SIZE_MASK        (0x0f << 12)
1349 #       define R128_SEC_TEX_PITCH_MASK       (0x0f << 16)
1350 #       define R128_SEC_TEX_SIZE_MASK        (0x0f << 20)
1351 #       define R128_SEC_TEX_HEIGHT_MASK      (0x0f << 24)
1352 #       define R128_SEC_TEX_MIN_SIZE_MASK    (0x0f << 28)
1353 #       define R128_TEX_SIZE_PITCH_SHIFT      0
1354 #       define R128_SEC_TEX_SIZE_PITCH_SHIFT 16
1355 #       define R128_TEX_SIZE_PITCH_MASK      (0xffff <<  0)
1356 #       define R128_SEC_TEX_SIZE_PITCH_MASK  (0xffff << 16)
1357 #define R128_PRIM_TEX_0_OFFSET_C          0x1cbc
1358 #define R128_PRIM_TEX_1_OFFSET_C          0x1cc0
1359 #define R128_PRIM_TEX_2_OFFSET_C          0x1cc4
1360 #define R128_PRIM_TEX_3_OFFSET_C          0x1cc8
1361 #define R128_PRIM_TEX_4_OFFSET_C          0x1ccc
1362 #define R128_PRIM_TEX_5_OFFSET_C          0x1cd0
1363 #define R128_PRIM_TEX_6_OFFSET_C          0x1cd4
1364 #define R128_PRIM_TEX_7_OFFSET_C          0x1cd8
1365 #define R128_PRIM_TEX_8_OFFSET_C          0x1cdc
1366 #define R128_PRIM_TEX_9_OFFSET_C          0x1ce0
1367 #define R128_PRIM_TEX_10_OFFSET_C         0x1ce4
1368 #       define R128_TEX_NO_TILE           (0 << 30)
1369 #       define R128_TEX_TILED_BY_HOST     (1 << 30)
1370 #       define R128_TEX_TILED_BY_STORAGE  (2 << 30)
1371 #       define R128_TEX_TILED_BY_STORAGE2 (3 << 30)
1372 
1373 #define R128_SEC_TEX_CNTL_C               0x1d00
1374 #       define R128_SEC_SELECT_PRIM_ST    (0  <<  0)
1375 #       define R128_SEC_SELECT_SEC_ST     (1  <<  0)
1376 #define R128_SEC_TEX_COMBINE_CNTL_C       0x1d04
1377 #       define R128_INPUT_FACTOR_PREV_COLOR (8  << 10)
1378 #       define R128_INPUT_FACTOR_PREV_ALPHA (9  << 10)
1379 #       define R128_INP_FACTOR_A_PREV_ALPHA (4  << 25)
1380 #define R128_SEC_TEX_0_OFFSET_C           0x1d08
1381 #define R128_SEC_TEX_1_OFFSET_C           0x1d0c
1382 #define R128_SEC_TEX_2_OFFSET_C           0x1d10
1383 #define R128_SEC_TEX_3_OFFSET_C           0x1d14
1384 #define R128_SEC_TEX_4_OFFSET_C           0x1d18
1385 #define R128_SEC_TEX_5_OFFSET_C           0x1d1c
1386 #define R128_SEC_TEX_6_OFFSET_C           0x1d20
1387 #define R128_SEC_TEX_7_OFFSET_C           0x1d24
1388 #define R128_SEC_TEX_8_OFFSET_C           0x1d28
1389 #define R128_SEC_TEX_9_OFFSET_C           0x1d2c
1390 #define R128_SEC_TEX_10_OFFSET_C          0x1d30
1391 #define R128_CONSTANT_COLOR_C             0x1d34
1392 #       define R128_CONSTANT_BLUE_SHIFT        0
1393 #       define R128_CONSTANT_GREEN_SHIFT       8
1394 #       define R128_CONSTANT_RED_SHIFT        16
1395 #       define R128_CONSTANT_ALPHA_SHIFT      24
1396 #define R128_PRIM_TEXTURE_BORDER_COLOR_C  0x1d38
1397 #       define R128_PRIM_TEX_BORDER_BLUE_SHIFT   0
1398 #       define R128_PRIM_TEX_BORDER_GREEN_SHIFT  8
1399 #       define R128_PRIM_TEX_BORDER_RED_SHIFT   16
1400 #       define R128_PRIM_TEX_BORDER_ALPHA_SHIFT 24
1401 #define R128_SEC_TEXTURE_BORDER_COLOR_C   0x1d3c
1402 #       define R128_SEC_TEX_BORDER_BLUE_SHIFT   0
1403 #       define R128_SEC_TEX_BORDER_GREEN_SHIFT  8
1404 #       define R128_SEC_TEX_BORDER_RED_SHIFT   16
1405 #       define R128_SEC_TEX_BORDER_ALPHA_SHIFT 24
1406 #define R128_STEN_REF_MASK_C              0x1d40
1407 #       define R128_STEN_REFERENCE_SHIFT       0
1408 #       define R128_STEN_MASK_SHIFT           16
1409 #       define R128_STEN_WRITE_MASK_SHIFT     24
1410 #define R128_PLANE_3D_MASK_C              0x1d44
1411 #define R128_TEX_CACHE_STAT_COUNT         0x1974
1412 
1413 
1414 				/* Constants */
1415 #define R128_AGP_TEX_OFFSET               0x02000000
1416 
1417 #define R128_LAST_FRAME_REG               R128_GUI_SCRATCH_REG0
1418 
1419 				/* CCE packet types */
1420 #define R128_CCE_PACKET0                         0x00000000
1421 #define R128_CCE_PACKET0_ONE_REG_WR              0x00008000
1422 #define R128_CCE_PACKET1                         0x40000000
1423 #define R128_CCE_PACKET2                         0x80000000
1424 #define R128_CCE_PACKET3                         0xC0000000
1425 #define R128_CCE_PACKET3_NOP                     0xC0001000
1426 #define R128_CCE_PACKET3_PAINT                   0xC0001100
1427 #define R128_CCE_PACKET3_BITBLT                  0xC0001200
1428 #define R128_CCE_PACKET3_SMALLTEXT               0xC0001300
1429 #define R128_CCE_PACKET3_HOSTDATA_BLT            0xC0001400
1430 #define R128_CCE_PACKET3_POLYLINE                0xC0001500
1431 #define R128_CCE_PACKET3_SCALING                 0xC0001600
1432 #define R128_CCE_PACKET3_TRANS_SCALING           0xC0001700
1433 #define R128_CCE_PACKET3_POLYSCANLINES           0xC0001800
1434 #define R128_CCE_PACKET3_NEXT_CHAR               0xC0001900
1435 #define R128_CCE_PACKET3_PAINT_MULTI             0xC0001A00
1436 #define R128_CCE_PACKET3_BITBLT_MULTI            0xC0001B00
1437 #define R128_CCE_PACKET3_PLY_NEXTSCAN            0xC0001D00
1438 #define R128_CCE_PACKET3_SET_SCISSORS            0xC0001E00
1439 #define R128_CCE_PACKET3_SET_MODE24BPP           0xC0001F00
1440 #define R128_CCE_PACKET3_CNTL_PAINT              0xC0009100
1441 #define R128_CCE_PACKET3_CNTL_BITBLT             0xC0009200
1442 #define R128_CCE_PACKET3_CNTL_SMALLTEXT          0xC0009300
1443 #define R128_CCE_PACKET3_CNTL_HOSTDATA_BLT       0xC0009400
1444 #define R128_CCE_PACKET3_CNTL_POLYLINE           0xC0009500
1445 #define R128_CCE_PACKET3_CNTL_SCALING            0xC0009600
1446 #define R128_CCE_PACKET3_CNTL_TRANS_SCALING      0xC0009700
1447 #define R128_CCE_PACKET3_CNTL_POLYSCANLINES      0xC0009800
1448 #define R128_CCE_PACKET3_CNTL_NEXT_CHAR          0xC0009900
1449 #define R128_CCE_PACKET3_CNTL_PAINT_MULTI        0xC0009A00
1450 #define R128_CCE_PACKET3_CNTL_BITBLT_MULTI       0xC0009B00
1451 #define R128_CCE_PACKET3_CNTL_TRANS_BITBLT       0xC0009C00
1452 #define R128_CCE_PACKET3_3D_SAVE_CONTEXT         0xC0002000
1453 #define R128_CCE_PACKET3_3D_PLAY_CONTEXT         0xC0002100
1454 #define R128_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM   0xC0002300
1455 #define R128_CCE_PACKET3_3D_RNDR_GEN_PRIM        0xC0002500
1456 #define R128_CCE_PACKET3_LOAD_PALETTE            0xC0002C00
1457 #define R128_CCE_PACKET3_PURGE                   0xC0002D00
1458 #define R128_CCE_PACKET3_NEXT_VERTEX_BUNDLE      0xC0002E00
1459 #       define R128_CCE_PACKET_MASK              0xC0000000
1460 #       define R128_CCE_PACKET_COUNT_MASK        0x3fff0000
1461 #       define R128_CCE_PACKET_MAX_DWORDS        (1 << 12)
1462 #       define R128_CCE_PACKET0_REG_MASK         0x000007ff
1463 #       define R128_CCE_PACKET1_REG0_MASK        0x000007ff
1464 #       define R128_CCE_PACKET1_REG1_MASK        0x003ff800
1465 
1466 #define R128_CCE_VC_FRMT_RHW                     0x00000001
1467 #define R128_CCE_VC_FRMT_DIFFUSE_BGR             0x00000002
1468 #define R128_CCE_VC_FRMT_DIFFUSE_A               0x00000004
1469 #define R128_CCE_VC_FRMT_DIFFUSE_ARGB            0x00000008
1470 #define R128_CCE_VC_FRMT_SPEC_BGR                0x00000010
1471 #define R128_CCE_VC_FRMT_SPEC_F                  0x00000020
1472 #define R128_CCE_VC_FRMT_SPEC_FRGB               0x00000040
1473 #define R128_CCE_VC_FRMT_S_T                     0x00000080
1474 #define R128_CCE_VC_FRMT_S2_T2                   0x00000100
1475 #define R128_CCE_VC_FRMT_RHW2                    0x00000200
1476 
1477 #define R128_CCE_VC_CNTL_PRIM_TYPE_NONE          0x00000000
1478 #define R128_CCE_VC_CNTL_PRIM_TYPE_POINT         0x00000001
1479 #define R128_CCE_VC_CNTL_PRIM_TYPE_LINE          0x00000002
1480 #define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE     0x00000003
1481 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST      0x00000004
1482 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN       0x00000005
1483 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP     0x00000006
1484 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2     0x00000007
1485 #define R128_CCE_VC_CNTL_PRIM_WALK_IND           0x00000010
1486 #define R128_CCE_VC_CNTL_PRIM_WALK_LIST          0x00000020
1487 #define R128_CCE_VC_CNTL_PRIM_WALK_RING          0x00000030
1488 #define R128_CCE_VC_CNTL_NUM_SHIFT               16
1489 
1490 #endif
1491