1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */
2 /**************************************************************************
4 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sub license, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
15 The above copyright notice and this permission notice (including the
16 next paragraph) shall be included in all copies or substantial portions
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
30 * Register names and fields for Intel graphics.
35 * Keith Whitwell <keith@tungstengraphics.com>
36 * Eric Anholt <eric@anholt.net>
38 * based on the i740 driver by
39 * Kevin E. Martin <kevin@precisioninsight.com>
47 /* I/O register offsets
49 #define SRX 0x3C4 /* p208 */
50 #define GRX 0x3CE /* p213 */
51 #define ARX 0x3C0 /* p224 */
53 /* VGA Color Palette Registers */
54 #define DACMASK 0x3C6 /* p232 */
55 #define DACSTATE 0x3C7 /* p232 */
56 #define DACRX 0x3C7 /* p233 */
57 #define DACWX 0x3C8 /* p233 */
58 #define DACDATA 0x3C9 /* p233 */
60 /* CRT Controller Registers (CRX) */
61 #define START_ADDR_HI 0x0C /* p246 */
62 #define START_ADDR_LO 0x0D /* p247 */
63 #define VERT_SYNC_END 0x11 /* p249 */
64 #define EXT_VERT_TOTAL 0x30 /* p257 */
65 #define EXT_VERT_DISPLAY 0x31 /* p258 */
66 #define EXT_VERT_SYNC_START 0x32 /* p259 */
67 #define EXT_VERT_BLANK_START 0x33 /* p260 */
68 #define EXT_HORIZ_TOTAL 0x35 /* p261 */
69 #define EXT_HORIZ_BLANK 0x39 /* p261 */
70 #define EXT_START_ADDR 0x40 /* p262 */
71 #define EXT_START_ADDR_ENABLE 0x80
72 #define EXT_OFFSET 0x41 /* p263 */
73 #define EXT_START_ADDR_HI 0x42 /* p263 */
74 #define INTERLACE_CNTL 0x70 /* p264 */
75 #define INTERLACE_ENABLE 0x80
76 #define INTERLACE_DISABLE 0x00
78 /* Miscellaneous Output Register
80 #define MSR_R 0x3CC /* p207 */
81 #define MSR_W 0x3C2 /* p207 */
82 #define IO_ADDR_SELECT 0x01
84 #define MDA_BASE 0x3B0 /* p207 */
85 #define CGA_BASE 0x3D0 /* p207 */
87 /* CR80 - IO Control, p264
90 #define EXTENDED_ATTR_CNTL 0x02
91 #define EXTENDED_CRTC_CNTL 0x01
93 /* GR10 - Address mapping, p221
95 #define ADDRESS_MAPPING 0x10
96 #define PAGE_TO_LOCAL_MEM_ENABLE 0x10
97 #define GTT_MEM_MAP_ENABLE 0x08
98 #define PACKED_MODE_ENABLE 0x04
99 #define LINEAR_MODE_ENABLE 0x02
100 #define PAGE_MAPPING_ENABLE 0x01
102 #define HOTKEY_VBIOS_SWITCH_BLOCK 0x80
103 #define HOTKEY_SWITCH 0x20
104 #define HOTKEY_TOGGLE 0x10
106 /* Blitter control, p378
108 #define BITBLT_CNTL 0x7000c
109 #define COLEXP_MODE 0x30
110 #define COLEXP_8BPP 0x00
111 #define COLEXP_16BPP 0x10
112 #define COLEXP_24BPP 0x20
113 #define COLEXP_RESERVED 0x30
114 #define BITBLT_STATUS 0x01
116 #define CHDECMISC 0x10111
118 #define C0DRB0 0x10200
119 #define C0DRB1 0x10202
120 #define C0DRB2 0x10204
121 #define C0DRB3 0x10206
122 #define C0DRA01 0x10208
123 #define C0DRA23 0x1020a
124 #define C1DRB0 0x10600
125 #define C1DRB1 0x10602
126 #define C1DRB2 0x10604
127 #define C1DRB3 0x10606
128 #define C1DRA01 0x10608
129 #define C1DRA23 0x1060a
133 #define DISPLAY_CNTL 0x70008
134 #define VGA_WRAP_MODE 0x02
135 #define VGA_WRAP_AT_256KB 0x00
136 #define VGA_NO_WRAP 0x02
137 #define GUI_MODE 0x01
138 #define STANDARD_VGA_MODE 0x00
139 #define HIRES_MODE 0x01
143 #define PIXPIPE_CONFIG_0 0x70009
144 #define DAC_8_BIT 0x80
145 #define DAC_6_BIT 0x00
146 #define HW_CURSOR_ENABLE 0x10
147 #define EXTENDED_PALETTE 0x01
151 #define PIXPIPE_CONFIG_1 0x7000a
152 #define DISPLAY_COLOR_MODE 0x0F
153 #define DISPLAY_VGA_MODE 0x00
154 #define DISPLAY_8BPP_MODE 0x02
155 #define DISPLAY_15BPP_MODE 0x04
156 #define DISPLAY_16BPP_MODE 0x05
157 #define DISPLAY_24BPP_MODE 0x06
158 #define DISPLAY_32BPP_MODE 0x07
162 #define PIXPIPE_CONFIG_2 0x7000b
163 #define DISPLAY_GAMMA_ENABLE 0x08
164 #define DISPLAY_GAMMA_DISABLE 0x00
165 #define OVERLAY_GAMMA_ENABLE 0x04
166 #define OVERLAY_GAMMA_DISABLE 0x00
171 #define DISPLAY_BASE 0x70020
172 #define DISPLAY_BASE_MASK 0x03fffffc
175 /* Cursor control registers, pp383-384
177 /* Desktop (845G, 865G) */
178 #define CURSOR_CONTROL 0x70080
179 #define CURSOR_ENABLE 0x80000000
180 #define CURSOR_GAMMA_ENABLE 0x40000000
181 #define CURSOR_STRIDE_MASK 0x30000000
182 #define CURSOR_FORMAT_SHIFT 24
183 #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
184 #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
185 #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
186 #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
187 #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
188 #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
190 /* Mobile and i810 */
191 #define CURSOR_A_CONTROL CURSOR_CONTROL
192 #define CURSOR_ORIGIN_SCREEN 0x00 /* i810 only */
193 #define CURSOR_ORIGIN_DISPLAY 0x1 /* i810 only */
194 #define CURSOR_MODE 0x27
195 #define CURSOR_MODE_DISABLE 0x00
196 #define CURSOR_MODE_32_4C_AX 0x01 /* i810 only */
197 #define CURSOR_MODE_64_3C 0x04
198 #define CURSOR_MODE_64_4C_AX 0x05
199 #define CURSOR_MODE_64_4C 0x06
200 #define CURSOR_MODE_64_32B_AX 0x07
201 #define CURSOR_MODE_64_ARGB_AX (0x20 | CURSOR_MODE_64_32B_AX)
202 #define MCURSOR_PIPE_SELECT (1 << 28)
203 #define MCURSOR_PIPE_A 0x00
204 #define MCURSOR_PIPE_B (1 << 28)
205 #define MCURSOR_GAMMA_ENABLE (1 << 26)
206 #define MCURSOR_MEM_TYPE_LOCAL (1 << 25)
209 #define CURSOR_BASEADDR 0x70084
210 #define CURSOR_A_BASE CURSOR_BASEADDR
211 #define CURSOR_BASEADDR_MASK 0x1FFFFF00
212 #define CURSOR_A_POSITION 0x70088
213 #define CURSOR_POS_SIGN 0x8000
214 #define CURSOR_POS_MASK 0x007FF
215 #define CURSOR_X_SHIFT 0
216 #define CURSOR_Y_SHIFT 16
217 #define CURSOR_X_LO 0x70088
218 #define CURSOR_X_HI 0x70089
219 #define CURSOR_X_POS 0x00
220 #define CURSOR_X_NEG 0x80
221 #define CURSOR_Y_LO 0x7008A
222 #define CURSOR_Y_HI 0x7008B
223 #define CURSOR_Y_POS 0x00
224 #define CURSOR_Y_NEG 0x80
226 #define CURSOR_A_PALETTE0 0x70090
227 #define CURSOR_A_PALETTE1 0x70094
228 #define CURSOR_A_PALETTE2 0x70098
229 #define CURSOR_A_PALETTE3 0x7009C
231 #define CURSOR_SIZE 0x700A0
232 #define CURSOR_SIZE_MASK 0x3FF
233 #define CURSOR_SIZE_HSHIFT 0
234 #define CURSOR_SIZE_VSHIFT 12
236 #define CURSOR_B_CONTROL 0x700C0
237 #define CURSOR_B_BASE 0x700C4
238 #define CURSOR_B_POSITION 0x700C8
239 #define CURSOR_B_PALETTE0 0x700D0
240 #define CURSOR_B_PALETTE1 0x700D4
241 #define CURSOR_B_PALETTE2 0x700D8
242 #define CURSOR_B_PALETTE3 0x700DC
245 /* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
246 * not sure they refer to local (graphics) memory.
248 * These details are for the local memory control registers,
249 * (pp301-310). The test machines are not equiped with local memory,
250 * so nothing is tested. Only a single row seems to be supported.
252 #define DRAM_ROW_TYPE 0x3000
253 #define DRAM_ROW_0 0x01
254 #define DRAM_ROW_0_SDRAM 0x01
255 #define DRAM_ROW_0_EMPTY 0x00
256 #define DRAM_ROW_CNTL_LO 0x3001
257 #define DRAM_PAGE_MODE_CTRL 0x10
258 #define DRAM_RAS_TO_CAS_OVRIDE 0x08
259 #define DRAM_CAS_LATENCY 0x04
260 #define DRAM_RAS_TIMING 0x02
261 #define DRAM_RAS_PRECHARGE 0x01
262 #define DRAM_ROW_CNTL_HI 0x3002
263 #define DRAM_REFRESH_RATE 0x18
264 #define DRAM_REFRESH_DISABLE 0x00
265 #define DRAM_REFRESH_60HZ 0x08
266 #define DRAM_REFRESH_FAST_TEST 0x10
267 #define DRAM_REFRESH_RESERVED 0x18
268 #define DRAM_SMS 0x07
269 #define DRAM_SMS_NORMAL 0x00
270 #define DRAM_SMS_NOP_ENABLE 0x01
271 #define DRAM_SMS_ABPCE 0x02
272 #define DRAM_SMS_MRCE 0x03
273 #define DRAM_SMS_CBRCE 0x04
277 #define DPMS_SYNC_SELECT 0x5002
278 #define VSYNC_CNTL 0x08
279 #define VSYNC_ON 0x00
280 #define VSYNC_OFF 0x08
281 #define HSYNC_CNTL 0x02
282 #define HSYNC_ON 0x00
283 #define HSYNC_OFF 0x02
293 # define GPIO_CLOCK_DIR_MASK (1 << 0)
294 # define GPIO_CLOCK_DIR_IN (0 << 1)
295 # define GPIO_CLOCK_DIR_OUT (1 << 1)
296 # define GPIO_CLOCK_VAL_MASK (1 << 2)
297 # define GPIO_CLOCK_VAL_OUT (1 << 3)
298 # define GPIO_CLOCK_VAL_IN (1 << 4)
299 # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
300 # define GPIO_DATA_DIR_MASK (1 << 8)
301 # define GPIO_DATA_DIR_IN (0 << 9)
302 # define GPIO_DATA_DIR_OUT (1 << 9)
303 # define GPIO_DATA_VAL_MASK (1 << 10)
304 # define GPIO_DATA_VAL_OUT (1 << 11)
305 # define GPIO_DATA_VAL_IN (1 << 12)
306 # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
308 /* GMBus registers for hardware-assisted (non-bitbanging) I2C access */
309 #define GMBUS0 0x5100
310 #define GMBUS1 0x5104
311 #define GMBUS2 0x5108
312 #define GMBUS3 0x510c
313 #define GMBUS4 0x5110
314 #define GMBUS5 0x5120
318 #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
319 #define VCLK2_VCO_N 0x600a
320 #define VCLK2_VCO_DIV_SEL 0x6012
322 #define VCLK_DIVISOR_VGA0 0x6000
323 #define VCLK_DIVISOR_VGA1 0x6004
324 #define VCLK_POST_DIV 0x6010
325 /** Selects a post divisor of 4 instead of 2. */
326 # define VGA1_PD_P2_DIV_4 (1 << 15)
327 /** Overrides the p2 post divisor field */
328 # define VGA1_PD_P1_DIV_2 (1 << 13)
329 # define VGA1_PD_P1_SHIFT 8
330 /** P1 value is 2 greater than this field */
331 # define VGA1_PD_P1_MASK (0x1f << 8)
332 /** Selects a post divisor of 4 instead of 2. */
333 # define VGA0_PD_P2_DIV_4 (1 << 7)
334 /** Overrides the p2 post divisor field */
335 # define VGA0_PD_P1_DIV_2 (1 << 5)
336 # define VGA0_PD_P1_SHIFT 0
337 /** P1 value is 2 greater than this field */
338 # define VGA0_PD_P1_MASK (0x1f << 0)
340 #define POST_DIV_SELECT 0x70
341 #define POST_DIV_1 0x00
342 #define POST_DIV_2 0x10
343 #define POST_DIV_4 0x20
344 #define POST_DIV_8 0x30
345 #define POST_DIV_16 0x40
346 #define POST_DIV_32 0x50
347 #define VCO_LOOP_DIV_BY_4M 0x00
348 #define VCO_LOOP_DIV_BY_16M 0x04
351 /* Instruction Parser Mode Register
355 #define INST_PM 0x20c0
356 #define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
357 #define SYNC_PACKET_FLUSH_ENABLE 0x10
358 #define TWO_D_INST_DISABLE 0x08
359 #define THREE_D_INST_DISABLE 0x04
360 #define STATE_VAR_UPDATE_DISABLE 0x02
361 #define PAL_STIP_DISABLE 0x01
364 #define MEMMODE 0x20dc
367 /* Instruction parser error register. p279
372 #define INST_DONE 0x2090
373 # define IDCT_DONE (1 << 30)
374 # define IQ_DONE (1 << 29)
375 # define PR_DONE (1 << 28)
376 # define VLD_DONE (1 << 27)
377 # define IP_DONE (1 << 26)
378 # define FBC_DONE (1 << 25)
379 # define BINNER_DONE (1 << 24)
380 # define SF_DONE (1 << 23)
381 # define SE_DONE (1 << 22)
382 # define WM_DONE (1 << 21)
383 # define IZ_DONE (1 << 20)
384 # define PERSPECTIVE_INTERP_DONE (1 << 19)
385 # define DISPATCHER_DONE (1 << 18)
386 # define PROJECTION_DONE (1 << 17)
387 # define DEPENDENT_ADDRESS_DONE (1 << 16)
388 # define QUAD_CACHE_DONE (1 << 15)
389 # define TEXTURE_FETCH_DONE (1 << 14)
390 # define TEXTURE_DECOMPRESS_DONE (1 << 13)
391 # define SAMPLER_CACHE_DONE (1 << 12)
392 # define FILTER_DONE (1 << 11)
393 # define BYPASS_FIFO_DONE (1 << 10)
394 # define PS_DONE (1 << 9)
395 # define CC_DONE (1 << 8)
396 # define MAP_FILTER_DONE (1 << 7)
397 # define MAP_L2_IDLE (1 << 6)
398 # define RING_2_ENABLE (1 << 2)
399 # define RING_1_ENABLE (1 << 1)
400 # define RING_0_ENABLE (1 << 0)
402 # define I830_GMBUS_DONE (1 << 26)
403 # define I830_FBC_DONE (1 << 25)
404 # define I830_BINNER_DONE (1 << 24)
405 # define I830_MPEG_DONE (1 << 23)
406 # define I830_MECO_DONE (1 << 22)
407 # define I830_MCD_DONE (1 << 21)
408 # define I830_MCSTP_DONE (1 << 20)
409 # define I830_CC_DONE (1 << 19)
410 # define I830_DG_DONE (1 << 18)
411 # define I830_DCMP_DONE (1 << 17)
412 # define I830_FTCH_DONE (1 << 16)
413 # define I830_IT_DONE (1 << 15)
414 # define I830_MG_DONE (1 << 14)
415 # define I830_MEC_DONE (1 << 13)
416 # define I830_PC_DONE (1 << 12)
417 # define I830_QCC_DONE (1 << 11)
418 # define I830_TB_DONE (1 << 10)
419 # define I830_WM_DONE (1 << 9)
420 # define I830_EF_DONE (1 << 8)
421 # define I830_BLITTER_DONE (1 << 7)
422 # define I830_MAP_L2_DONE (1 << 6)
423 # define I830_SECONDARY_RING_3_DONE (1 << 5)
424 # define I830_SECONDARY_RING_2_DONE (1 << 4)
425 # define I830_SECONDARY_RING_1_DONE (1 << 3)
426 # define I830_SECONDARY_RING_0_DONE (1 << 2)
427 # define I830_PRIMARY_RING_1_DONE (1 << 1)
428 # define I830_PRIMARY_RING_0_DONE (1 << 0)
432 #define SCPD0 0x209c /* debug */
433 #define INST_PS 0x20c4
434 #define IPEIR_I965 0x2064 /* i965 */
435 #define IPEHR_I965 0x2068 /* i965 */
436 #define INST_DONE_I965 0x206c
437 # define I965_ROW_0_EU_0_DONE (1 << 31)
438 # define I965_ROW_0_EU_1_DONE (1 << 30)
439 # define I965_ROW_0_EU_2_DONE (1 << 29)
440 # define I965_ROW_0_EU_3_DONE (1 << 28)
441 # define I965_ROW_1_EU_0_DONE (1 << 27)
442 # define I965_ROW_1_EU_1_DONE (1 << 26)
443 # define I965_ROW_1_EU_2_DONE (1 << 25)
444 # define I965_ROW_1_EU_3_DONE (1 << 24)
445 # define I965_SF_DONE (1 << 23)
446 # define I965_SE_DONE (1 << 22)
447 # define I965_WM_DONE (1 << 21)
448 # define I965_DISPATCHER_DONE (1 << 18)
449 # define I965_PROJECTION_DONE (1 << 17)
450 # define I965_DG_DONE (1 << 16)
451 # define I965_QUAD_CACHE_DONE (1 << 15)
452 # define I965_TEXTURE_FETCH_DONE (1 << 14)
453 # define I965_TEXTURE_DECOMPRESS_DONE (1 << 13)
454 # define I965_SAMPLER_CACHE_DONE (1 << 12)
455 # define I965_FILTER_DONE (1 << 11)
456 # define I965_BYPASS_DONE (1 << 10)
457 # define I965_PS_DONE (1 << 9)
458 # define I965_CC_DONE (1 << 8)
459 # define I965_MAP_FILTER_DONE (1 << 7)
460 # define I965_MAP_L2_IDLE (1 << 6)
461 # define I965_MA_ROW_0_DONE (1 << 5)
462 # define I965_MA_ROW_1_DONE (1 << 4)
463 # define I965_IC_ROW_0_DONE (1 << 3)
464 # define I965_IC_ROW_1_DONE (1 << 2)
465 # define I965_CP_DONE (1 << 1)
466 # define I965_RING_0_ENABLE (1 << 0)
468 # define ILK_ROW_0_EU_0_DONE (1 << 31)
469 # define ILK_ROW_0_EU_1_DONE (1 << 30)
470 # define ILK_ROW_0_EU_2_DONE (1 << 29)
471 # define ILK_ROW_0_EU_3_DONE (1 << 28)
472 # define ILK_ROW_1_EU_0_DONE (1 << 27)
473 # define ILK_ROW_1_EU_1_DONE (1 << 26)
474 # define ILK_ROW_1_EU_2_DONE (1 << 25)
475 # define ILK_ROW_1_EU_3_DONE (1 << 24)
476 # define ILK_ROW_2_EU_0_DONE (1 << 23)
477 # define ILK_ROW_2_EU_1_DONE (1 << 22)
478 # define ILK_ROW_2_EU_2_DONE (1 << 21)
479 # define ILK_ROW_2_EU_3_DONE (1 << 20)
480 # define ILK_VCP_DONE (1 << 19)
481 # define ILK_ROW_0_MATH_DONE (1 << 18)
482 # define ILK_ROW_1_MATH_DONE (1 << 17)
483 # define ILK_ROW_2_MATH_DONE (1 << 16)
484 # define ILK_VC1_DONE (1 << 15)
485 # define ILK_ROW_0_MA_DONE (1 << 14)
486 # define ILK_ROW_1_MA_DONE (1 << 13)
487 # define ILK_ROW_2_MA_DONE (1 << 12)
488 # define ILK_ROW_0_ISC_DONE (1 << 11)
489 # define ILK_ROW_1_ISC_DONE (1 << 10)
490 # define ILK_ROW_2_ISC_DONE (1 << 9)
491 # define ILK_VFE_DONE (1 << 8)
492 # define ILK_TD_DONE (1 << 7)
493 # define ILK_SVTS_DONE (1 << 6)
494 # define ILK_TS_DONE (1 << 5)
495 # define ILK_GW_DONE (1 << 4)
496 # define ILK_AI_DONE (1 << 3)
497 # define ILK_AC_DONE (1 << 2)
498 # define ILK_AM_DONE (1 << 1)
500 #define GEN6_INSTDONE_1 0x206c
501 # define GEN6_MA_3_DONE (1 << 31)
502 # define GEN6_EU_32_DONE (1 << 30)
503 # define GEN6_EU_31_DONE (1 << 29)
504 # define GEN6_EU_30_DONE (1 << 28)
505 # define GEN6_MA_2_DONE (1 << 27)
506 # define GEN6_EU_22_DONE (1 << 26)
507 # define GEN6_EU_21_DONE (1 << 25)
508 # define GEN6_EU_20_DONE (1 << 24)
509 # define GEN6_MA_1_DONE (1 << 23)
510 # define GEN6_EU_12_DONE (1 << 22)
511 # define GEN6_EU_11_DONE (1 << 21)
512 # define GEN6_EU_10_DONE (1 << 20)
513 # define GEN6_MA_0_DONE (1 << 19)
514 # define GEN6_EU_02_DONE (1 << 18)
515 # define GEN6_EU_01_DONE (1 << 17)
516 # define GEN6_EU_00_DONE (1 << 16)
517 # define GEN6_IC_3_DONE (1 << 15)
518 # define GEN6_IC_2_DONE (1 << 14)
519 # define GEN6_IC_1_DONE (1 << 13)
520 # define GEN6_IC_0_DONE (1 << 12)
521 # define GEN6_ISC_10_DONE (1 << 11)
522 # define GEN6_ISC_32_DONE (1 << 10)
523 # define GEN6_VSC_DONE (1 << 9)
524 # define GEN6_IEF_DONE (1 << 8)
525 # define GEN6_VFE_DONE (1 << 7)
526 # define GEN6_TD_DONE (1 << 6)
527 # define GEN6_TS_DONE (1 << 4)
528 # define GEN6_GW_DONE (1 << 3)
529 # define GEN6_HIZ_DONE (1 << 2)
530 # define GEN6_AVS_DONE (1 << 1)
532 #define INST_PS_I965 0x2070
534 /* Current active ring head address:
536 #define ACTHD_I965 0x2074
539 /* Current primary/secondary DMA fetch addresses:
541 #define DMA_FADD_P 0x2078
542 #define DMA_FADD_S 0x20d4
543 #define INST_DONE_1 0x207c
544 # define I965_GW_CS_DONE_CR (1 << 19)
545 # define I965_SVSM_CS_DONE_CR (1 << 18)
546 # define I965_SVDW_CS_DONE_CR (1 << 17)
547 # define I965_SVDR_CS_DONE_CR (1 << 16)
548 # define I965_SVRW_CS_DONE_CR (1 << 15)
549 # define I965_SVRR_CS_DONE_CR (1 << 14)
550 # define I965_SVTW_CS_DONE_CR (1 << 13)
551 # define I965_MASM_CS_DONE_CR (1 << 12)
552 # define I965_MASF_CS_DONE_CR (1 << 11)
553 # define I965_MAW_CS_DONE_CR (1 << 10)
554 # define I965_EM1_CS_DONE_CR (1 << 9)
555 # define I965_EM0_CS_DONE_CR (1 << 8)
556 # define I965_UC1_CS_DONE (1 << 7)
557 # define I965_UC0_CS_DONE (1 << 6)
558 # define I965_URB_CS_DONE (1 << 5)
559 # define I965_ISC_CS_DONE (1 << 4)
560 # define I965_CL_CS_DONE (1 << 3)
561 # define I965_GS_CS_DONE (1 << 2)
562 # define I965_VS0_CS_DONE (1 << 1)
563 # define I965_VF_CS_DONE (1 << 0)
565 # define G4X_BCS_DONE (1 << 31)
566 # define G4X_CS_DONE (1 << 30)
567 # define G4X_MASF_DONE (1 << 29)
568 # define G4X_SVDW_DONE (1 << 28)
569 # define G4X_SVDR_DONE (1 << 27)
570 # define G4X_SVRW_DONE (1 << 26)
571 # define G4X_SVRR_DONE (1 << 25)
572 # define G4X_ISC_DONE (1 << 24)
573 # define G4X_MT_DONE (1 << 23)
574 # define G4X_RC_DONE (1 << 22)
575 # define G4X_DAP_DONE (1 << 21)
576 # define G4X_MAWB_DONE (1 << 20)
577 # define G4X_MT_IDLE (1 << 19)
578 # define G4X_GBLT_BUSY (1 << 18)
579 # define G4X_SVSM_DONE (1 << 17)
580 # define G4X_MASM_DONE (1 << 16)
581 # define G4X_QC_DONE (1 << 15)
582 # define G4X_FL_DONE (1 << 14)
583 # define G4X_SC_DONE (1 << 13)
584 # define G4X_DM_DONE (1 << 12)
585 # define G4X_FT_DONE (1 << 11)
586 # define G4X_DG_DONE (1 << 10)
587 # define G4X_SI_DONE (1 << 9)
588 # define G4X_SO_DONE (1 << 8)
589 # define G4X_PL_DONE (1 << 7)
590 # define G4X_WIZ_DONE (1 << 6)
591 # define G4X_URB_DONE (1 << 5)
592 # define G4X_SF_DONE (1 << 4)
593 # define G4X_CL_DONE (1 << 3)
594 # define G4X_GS_DONE (1 << 2)
595 # define G4X_VS0_DONE (1 << 1)
596 # define G4X_VF_DONE (1 << 0)
598 #define GEN6_INSTDONE_2 0x207c
599 # define GEN6_GAM_DONE (1 << 31)
600 # define GEN6_CS_DONE (1 << 30)
601 # define GEN6_WMBE_DONE (1 << 29)
602 # define GEN6_SVRW_DONE (1 << 28)
603 # define GEN6_RCC_DONE (1 << 27)
604 # define GEN6_SVG_DONE (1 << 26)
605 # define GEN6_ISC_DONE (1 << 25)
606 # define GEN6_MT_DONE (1 << 24)
607 # define GEN6_RCPFE_DONE (1 << 23)
608 # define GEN6_RCPBE_DONE (1 << 22)
609 # define GEN6_VDI_DONE (1 << 21)
610 # define GEN6_RCZ_DONE (1 << 20)
611 # define GEN6_DAP_DONE (1 << 19)
612 # define GEN6_PSD_DONE (1 << 18)
613 # define GEN6_IZ_DONE (1 << 17)
614 # define GEN6_WMFE_DONE (1 << 16)
615 # define GEN6_SVSM_DONE (1 << 15)
616 # define GEN6_QC_DONE (1 << 14)
617 # define GEN6_FL_DONE (1 << 13)
618 # define GEN6_SC_DONE (1 << 12)
619 # define GEN6_DM_DONE (1 << 11)
620 # define GEN6_FT_DONE (1 << 10)
621 # define GEN6_DG_DONE (1 << 9)
622 # define GEN6_SI_DONE (1 << 8)
623 # define GEN6_SO_DONE (1 << 7)
624 # define GEN6_PL_DONE (1 << 6)
625 # define GEN6_VME_DONE (1 << 5)
626 # define GEN6_SF_DONE (1 << 4)
627 # define GEN6_CL_DONE (1 << 3)
628 # define GEN6_GS_DONE (1 << 2)
629 # define GEN6_VS0_DONE (1 << 1)
630 # define GEN6_VF_DONE (1 << 0)
632 #define CACHE_MODE_0 0x2120
633 #define CACHE_MODE_1 0x2124
634 #define MI_MODE 0x209c
635 #define MI_DISPLAY_POWER_DOWN 0x20e0
636 #define MI_ARB_STATE 0x20e4
637 #define MI_RDRET_STATE 0x20fc
639 /* Start addresses for each of the primary rings:
641 #define PR0_STR 0x20f0
642 #define PR1_STR 0x20f4
643 #define PR2_STR 0x20f8
645 #define WIZ_CTL 0x7c00
646 #define WIZ_CTL_SINGLE_SUBSPAN (1<<6)
647 #define WIZ_CTL_IGNORE_STALLS (1<<5)
649 #define SVG_WORK_CTL 0x7408
651 #define TS_CTL 0x7e00
652 #define TS_MUX_ERR_CODE (0<<8)
653 #define TS_MUX_URB_0 (1<<8)
654 #define TS_MUX_DISPATCH_ID_0 (10<<8)
655 #define TS_MUX_ERR_CODE_VALID (15<<8)
656 #define TS_MUX_TID_0 (16<<8)
657 #define TS_MUX_EUID_0 (18<<8)
658 #define TS_MUX_FFID_0 (22<<8)
659 #define TS_MUX_EOT (26<<8)
660 #define TS_MUX_SIDEBAND_0 (27<<8)
661 #define TS_SNAP_ALL_CHILD (1<<2)
662 #define TS_SNAP_ALL_ROOT (1<<1)
663 #define TS_SNAP_ENABLE (1<<0)
665 #define TS_DEBUG_DATA 0x7e0c
667 #define TD_CTL 0x8000
668 #define TD_CTL2 0x8004
671 #define ECOSKPD 0x21d0
676 #define IA_VERTICES_COUNT_QW 0x2310
677 #define IA_PRIMITIVES_COUNT_QW 0x2318
678 #define VS_INVOCATION_COUNT_QW 0x2320
679 #define GS_INVOCATION_COUNT_QW 0x2328
680 #define GS_PRIMITIVES_COUNT_QW 0x2330
681 #define CL_INVOCATION_COUNT_QW 0x2338
682 #define CL_PRIMITIVES_COUNT_QW 0x2340
683 #define PS_INVOCATION_COUNT_QW 0x2348
684 #define PS_DEPTH_COUNT_QW 0x2350
685 #define TIMESTAMP_QW 0x2358
686 #define CLKCMP_QW 0x2360
693 /* General error reporting regs, p296
698 # define ERR_VERTEX_MAX (1 << 5) /* lpt/cst */
699 # define ERR_PGTBL_ERROR (1 << 4)
700 # define ERR_DISPLAY_OVERLAY_UNDERRUN (1 << 3)
701 # define ERR_MAIN_MEMORY_REFRESH (1 << 1)
702 # define ERR_INSTRUCTION_ERROR (1 << 0)
705 /* Interrupt Control Registers
706 * - new bits for i810
707 * - new register hwstam (mask)
709 #define HWS_PGA 0x2080
710 #define PWRCTXA 0x2088 /* 965GM+ only */
711 #define PWRCTX_EN (1<<0)
712 #define HWSTAM 0x2098 /* p290 */
713 #define IER 0x20a0 /* p291 */
714 #define IIR 0x20a4 /* p292 */
715 #define IMR 0x20a8 /* p293 */
716 #define ISR 0x20ac /* p294 */
717 #define HW_ERROR 0x8000
718 #define SYNC_STATUS_TOGGLE 0x1000
719 #define DPY_0_FLIP_PENDING 0x0800
720 #define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
721 #define OVL_0_FLIP_PENDING 0x0200
722 #define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
723 #define DPY_0_VBLANK 0x0080
724 #define DPY_0_EVENT 0x0040
725 #define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
726 #define DPY_1_EVENT 0x0010 /* not implemented on i810 */
727 #define HOST_PORT_EVENT 0x0008 /* */
728 #define CAPTURE_EVENT 0x0004 /* */
729 #define USER_DEFINED 0x0002
730 #define BREAKPOINT 0x0001
733 #define INTR_RESERVED (0x6000 | \
734 DPY_1_FLIP_PENDING | \
735 OVL_1_FLIP_PENDING | \
741 /* FIFO Watermark and Burst Length Control Register
743 * - different offset and contents on i810 (p299) (fewer bits per field)
744 * - some overlay fields added
745 * - what does it all mean?
747 #define FWATER_BLC 0x20d8
748 #define FWATER_BLC2 0x20dc
749 #define MM_BURST_LENGTH 0x00700000
750 #define MM_FIFO_WATERMARK 0x0001F000
751 #define LM_BURST_LENGTH 0x00000700
752 #define LM_FIFO_WATERMARK 0x0000001F
755 /* Fence/Tiling ranges [0..7]
760 #define FENCE_NEW 0x3000
761 #define FENCE_NEW_NR 16
763 #define FENCE_LINEAR 0
764 #define FENCE_XMAJOR 1
765 #define FENCE_YMAJOR 2
767 #define I915G_FENCE_START_MASK 0x0ff00000
769 #define I830_FENCE_START_MASK 0x07f80000
771 #define FENCE_START_MASK 0x03F80000
772 #define FENCE_X_MAJOR 0x00000000
773 #define FENCE_Y_MAJOR 0x00001000
774 #define FENCE_SIZE_MASK 0x00000700
775 #define FENCE_SIZE_512K 0x00000000
776 #define FENCE_SIZE_1M 0x00000100
777 #define FENCE_SIZE_2M 0x00000200
778 #define FENCE_SIZE_4M 0x00000300
779 #define FENCE_SIZE_8M 0x00000400
780 #define FENCE_SIZE_16M 0x00000500
781 #define FENCE_SIZE_32M 0x00000600
782 #define FENCE_SIZE_64M 0x00000700
783 #define I915G_FENCE_SIZE_1M 0x00000000
784 #define I915G_FENCE_SIZE_2M 0x00000100
785 #define I915G_FENCE_SIZE_4M 0x00000200
786 #define I915G_FENCE_SIZE_8M 0x00000300
787 #define I915G_FENCE_SIZE_16M 0x00000400
788 #define I915G_FENCE_SIZE_32M 0x00000500
789 #define I915G_FENCE_SIZE_64M 0x00000600
790 #define I915G_FENCE_SIZE_128M 0x00000700
791 #define I965_FENCE_X_MAJOR 0x00000000
792 #define I965_FENCE_Y_MAJOR 0x00000002
793 #define FENCE_PITCH_1 0x00000000
794 #define FENCE_PITCH_2 0x00000010
795 #define FENCE_PITCH_4 0x00000020
796 #define FENCE_PITCH_8 0x00000030
797 #define FENCE_PITCH_16 0x00000040
798 #define FENCE_PITCH_32 0x00000050
799 #define FENCE_PITCH_64 0x00000060
800 #define FENCE_VALID 0x00000001
803 /* Registers to control page table, p274
805 #define PGETBL_CTL 0x2020
806 #define PGETBL_ADDR_MASK 0xFFFFF000
807 #define PGETBL_ENABLE_MASK 0x00000001
808 #define PGETBL_ENABLED 0x00000001
809 /** Added in 965G, this field has the actual size of the global GTT */
810 #define PGETBL_SIZE_MASK 0x0000000e
811 #define PGETBL_SIZE_512KB (0 << 1)
812 #define PGETBL_SIZE_256KB (1 << 1)
813 #define PGETBL_SIZE_128KB (2 << 1)
814 #define PGETBL_SIZE_1MB (3 << 1)
815 #define PGETBL_SIZE_2MB (4 << 1)
816 #define PGETBL_SIZE_1_5MB (5 << 1)
817 #define G33_PGETBL_SIZE_MASK (3 << 8)
818 #define G33_PGETBL_SIZE_1M (1 << 8)
819 #define G33_PGETBL_SIZE_2M (2 << 8)
821 #define I830_PTE_BASE 0x10000
822 #define PTE_ADDRESS_MASK 0xfffff000
823 #define PTE_ADDRESS_MASK_HIGH 0x000000f0 /* i915+ */
824 #define PTE_MAPPING_TYPE_UNCACHED (0 << 1)
825 #define PTE_MAPPING_TYPE_DCACHE (1 << 1) /* i830 only */
826 #define PTE_MAPPING_TYPE_CACHED (3 << 1)
827 #define PTE_MAPPING_TYPE_MASK (3 << 1)
828 #define PTE_VALID (1 << 0)
830 /** @defgroup PGE_ERR
833 /** Page table debug register for i845 */
834 #define PGE_ERR 0x2024
835 #define PGE_ERR_ADDR_MASK 0xFFFFF000
836 #define PGE_ERR_ID_MASK 0x00000038
837 #define PGE_ERR_CAPTURE 0x00000000
838 #define PGE_ERR_OVERLAY 0x00000008
839 #define PGE_ERR_DISPLAY 0x00000010
840 #define PGE_ERR_HOST 0x00000018
841 #define PGE_ERR_RENDER 0x00000020
842 #define PGE_ERR_BLITTER 0x00000028
843 #define PGE_ERR_MAPPING 0x00000030
844 #define PGE_ERR_CMD_PARSER 0x00000038
845 #define PGE_ERR_TYPE_MASK 0x00000007
846 #define PGE_ERR_INV_TABLE 0x00000000
847 #define PGE_ERR_INV_PTE 0x00000001
848 #define PGE_ERR_MIXED_TYPES 0x00000002
849 #define PGE_ERR_PAGE_MISS 0x00000003
850 #define PGE_ERR_ILLEGAL_TRX 0x00000004
851 #define PGE_ERR_LOCAL_MEM 0x00000005
852 #define PGE_ERR_TILED 0x00000006
855 /** @defgroup PGTBL_ER
858 /** Page table debug register for i945 */
859 # define PGTBL_ER 0x2024
860 # define PGTBL_ERR_MT_TILING (1 << 27)
861 # define PGTBL_ERR_MT_GTT_PTE (1 << 26)
862 # define PGTBL_ERR_LC_TILING (1 << 25)
863 # define PGTBL_ERR_LC_GTT_PTE (1 << 24)
864 # define PGTBL_ERR_BIN_VERTEXDATA_GTT_PTE (1 << 23)
865 # define PGTBL_ERR_BIN_INSTRUCTION_GTT_PTE (1 << 22)
866 # define PGTBL_ERR_CS_VERTEXDATA_GTT_PTE (1 << 21)
867 # define PGTBL_ERR_CS_INSTRUCTION_GTT_PTE (1 << 20)
868 # define PGTBL_ERR_CS_GTT (1 << 19)
869 # define PGTBL_ERR_OVERLAY_TILING (1 << 18)
870 # define PGTBL_ERR_OVERLAY_GTT_PTE (1 << 16)
871 # define PGTBL_ERR_DISPC_TILING (1 << 14)
872 # define PGTBL_ERR_DISPC_GTT_PTE (1 << 12)
873 # define PGTBL_ERR_DISPB_TILING (1 << 10)
874 # define PGTBL_ERR_DISPB_GTT_PTE (1 << 8)
875 # define PGTBL_ERR_DISPA_TILING (1 << 6)
876 # define PGTBL_ERR_DISPA_GTT_PTE (1 << 4)
877 # define PGTBL_ERR_HOST_PTE_DATA (1 << 1)
878 # define PGTBL_ERR_HOST_GTT_PTE (1 << 0)
881 /* Ring buffer registers, p277, overview p19
883 #define LP_RING 0x2030
884 #define HP_RING 0x2040
886 #define RING_TAIL 0x00
887 #define TAIL_ADDR 0x000FFFF8
888 #define I830_TAIL_MASK 0x001FFFF8
890 #define RING_HEAD 0x04
891 #define HEAD_WRAP_COUNT 0xFFE00000
892 #define HEAD_WRAP_ONE 0x00200000
893 #define HEAD_ADDR 0x001FFFFC
894 #define I830_HEAD_MASK 0x001FFFFC
896 #define RING_START 0x08
897 #define START_ADDR 0x03FFFFF8
898 #define I830_RING_START_MASK 0xFFFFF000
900 #define RING_LEN 0x0C
901 #define RING_NR_PAGES 0x001FF000
902 #define I830_RING_NR_PAGES 0x001FF000
903 #define RING_REPORT_MASK 0x00000006
904 #define RING_REPORT_64K 0x00000002
905 #define RING_REPORT_128K 0x00000004
906 #define RING_NO_REPORT 0x00000000
907 #define RING_VALID_MASK 0x00000001
908 #define RING_VALID 0x00000001
909 #define RING_INVALID 0x00000000
913 /* BitBlt Instructions
915 * There are many more masks & ranges yet to add.
917 #define BR00_BITBLT_CLIENT 0x40000000
918 #define BR00_OP_COLOR_BLT 0x10000000
919 #define BR00_OP_SRC_COPY_BLT 0x10C00000
920 #define BR00_OP_FULL_BLT 0x11400000
921 #define BR00_OP_MONO_SRC_BLT 0x11800000
922 #define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
923 #define BR00_OP_MONO_PAT_BLT 0x11C00000
924 #define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
925 #define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
928 #define BR00_TPCY_DISABLE 0x00000000
929 #define BR00_TPCY_ENABLE 0x00000010
931 #define BR00_TPCY_ROP 0x00000000
932 #define BR00_TPCY_NO_ROP 0x00000020
933 #define BR00_TPCY_EQ 0x00000000
934 #define BR00_TPCY_NOT_EQ 0x00000040
936 #define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
938 #define BR00_PAT_VERT_ALIGN 0x000000e0
940 #define BR00_LENGTH 0x0000000F
942 #define BR09_DEST_ADDR 0x03FFFFFF
944 #define BR11_SOURCE_PITCH 0x00003FFF
946 #define BR12_SOURCE_ADDR 0x03FFFFFF
948 #define BR13_SOLID_PATTERN 0x80000000
949 #define BR13_RIGHT_TO_LEFT 0x40000000
950 #define BR13_LEFT_TO_RIGHT 0x00000000
951 #define BR13_MONO_TRANSPCY 0x20000000
952 #define BR13_MONO_PATN_TRANS 0x10000000
953 #define BR13_USE_DYN_DEPTH 0x04000000
954 #define BR13_DYN_8BPP 0x00000000
955 #define BR13_DYN_16BPP 0x01000000
956 #define BR13_DYN_24BPP 0x02000000
957 #define BR13_ROP_MASK 0x00FF0000
958 #define BR13_DEST_PITCH 0x0000FFFF
959 #define BR13_PITCH_SIGN_BIT 0x00008000
961 #define BR14_DEST_HEIGHT 0xFFFF0000
962 #define BR14_DEST_WIDTH 0x0000FFFF
964 #define BR15_PATTERN_ADDR 0x03FFFFFF
966 #define BR16_SOLID_PAT_COLOR 0x00FFFFFF
967 #define BR16_BACKGND_PAT_CLR 0x00FFFFFF
969 #define BR17_FGND_PAT_CLR 0x00FFFFFF
971 #define BR18_SRC_BGND_CLR 0x00FFFFFF
972 #define BR19_SRC_FGND_CLR 0x00FFFFFF
975 /* Instruction parser instructions
978 #define INST_PARSER_CLIENT 0x00000000
979 #define INST_OP_FLUSH 0x02000000
980 #define INST_FLUSH_MAP_CACHE 0x00000001
983 #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
986 /* Registers in the i810 host-pci bridge pci config space which affect
987 * the i810 graphics operations.
989 #define SMRAM_MISCC 0x70
990 #define GMS 0x000000c0
991 #define GMS_DISABLE 0x00000000
992 #define GMS_ENABLE_BARE 0x00000040
993 #define GMS_ENABLE_512K 0x00000080
994 #define GMS_ENABLE_1M 0x000000c0
995 #define USMM 0x00000030
996 #define USMM_DISABLE 0x00000000
997 #define USMM_TSEG_ZERO 0x00000010
998 #define USMM_TSEG_512K 0x00000020
999 #define USMM_TSEG_1M 0x00000030
1000 #define GFX_MEM_WIN_SIZE 0x00010000
1001 #define GFX_MEM_WIN_32M 0x00010000
1002 #define GFX_MEM_WIN_64M 0x00000000
1004 /* Overkill? I don't know. Need to figure out top of mem to make the
1005 * SMRAM calculations come out. Linux seems to have problems
1006 * detecting it all on its own, so this seems a reasonable double
1007 * check to any user supplied 'mem=...' boot param.
1009 * ... unfortunately this reg doesn't work according to spec on the
1012 #define WHTCFG_PAMR_DRP 0x50
1013 #define SYS_DRAM_ROW_0_SHIFT 16
1014 #define SYS_DRAM_ROW_1_SHIFT 20
1015 #define DRAM_MASK 0x0f
1016 #define DRAM_VALUE_0 0
1017 #define DRAM_VALUE_1 8
1018 /* No 2 value defined */
1019 #define DRAM_VALUE_3 16
1020 #define DRAM_VALUE_4 16
1021 #define DRAM_VALUE_5 24
1022 #define DRAM_VALUE_6 32
1023 #define DRAM_VALUE_7 32
1024 #define DRAM_VALUE_8 48
1025 #define DRAM_VALUE_9 64
1026 #define DRAM_VALUE_A 64
1027 #define DRAM_VALUE_B 96
1028 #define DRAM_VALUE_C 128
1029 #define DRAM_VALUE_D 128
1030 #define DRAM_VALUE_E 192
1031 #define DRAM_VALUE_F 256 /* nice one, geezer */
1032 #define LM_FREQ_MASK 0x10
1033 #define LM_FREQ_133 0x10
1034 #define LM_FREQ_100 0x00
1039 /* These are 3d state registers, but the state is invarient, so we let
1040 * the X server handle it:
1045 /* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
1047 #define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
1048 #define CC1_UPDATE_KILL_WRITE (1<<28)
1049 #define CC1_ENABLE_KILL_WRITE (1<<27)
1050 #define CC1_DISABLE_KILL_WRITE 0
1051 #define CC1_UPDATE_COLOR_IDX (1<<26)
1052 #define CC1_UPDATE_CHROMA_LOW (1<<25)
1053 #define CC1_UPDATE_CHROMA_HI (1<<24)
1054 #define CC1_CHROMA_LOW_MASK ((1<<24)-1)
1055 #define CC2_COLOR_IDX_SHIFT 24
1056 #define CC2_COLOR_IDX_MASK (0xff<<24)
1057 #define CC2_CHROMA_HI_MASK ((1<<24)-1)
1060 #define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
1061 #define CS_UPDATE_LOAD (1<<17)
1062 #define CS_UPDATE_USE (1<<16)
1063 #define CS_UPDATE_LOAD (1<<17)
1064 #define CS_LOAD_CTX0 0
1065 #define CS_LOAD_CTX1 (1<<8)
1066 #define CS_USE_CTX0 0
1067 #define CS_USE_CTX1 (1<<0)
1069 /* I810 LCD/TV registers */
1070 #define LCD_TV_HTOTAL 0x60000
1071 #define LCD_TV_C 0x60018
1072 #define LCD_TV_OVRACT 0x6001C
1074 #define LCD_TV_ENABLE (1 << 31)
1075 #define LCD_TV_VGAMOD (1 << 28)
1077 /* I830 CRTC registers */
1078 #define HTOTAL_A 0x60000
1079 #define HBLANK_A 0x60004
1080 #define HSYNC_A 0x60008
1081 #define VTOTAL_A 0x6000c
1082 #define VBLANK_A 0x60010
1083 #define VSYNC_A 0x60014
1084 #define PIPEASRC 0x6001c
1085 #define BCLRPAT_A 0x60020
1086 #define VSYNCSHIFT_A 0x60028
1088 #define HTOTAL_B 0x61000
1089 #define HBLANK_B 0x61004
1090 #define HSYNC_B 0x61008
1091 #define VTOTAL_B 0x6100c
1092 #define VBLANK_B 0x61010
1093 #define VSYNC_B 0x61014
1094 #define PIPEBSRC 0x6101c
1095 #define BCLRPAT_B 0x61020
1096 #define VSYNCSHIFT_B 0x61028
1098 #define PP_STATUS 0x61200
1099 # define PP_ON (1 << 31)
1101 * Indicates that all dependencies of the panel are on:
1105 * - LVDS/DVOB/DVOC on
1107 # define PP_READY (1 << 30)
1108 # define PP_SEQUENCE_NONE (0 << 28)
1109 # define PP_SEQUENCE_ON (1 << 28)
1110 # define PP_SEQUENCE_OFF (2 << 28)
1111 # define PP_SEQUENCE_MASK 0x30000000
1113 #define PP_CONTROL 0x61204
1114 # define POWER_DOWN_ON_RESET (1 << 1)
1115 # define POWER_TARGET_ON (1 << 0)
1117 #define PP_ON_DELAYS 0x61208
1118 #define PP_OFF_DELAYS 0x6120c
1119 #define PP_DIVISOR 0x61210
1121 #define PFIT_CONTROL 0x61230
1122 # define PFIT_ENABLE (1 << 31)
1124 # define VERT_INTERP_DISABLE (0 << 10)
1125 # define VERT_INTERP_BILINEAR (1 << 10)
1126 # define VERT_INTERP_MASK (3 << 10)
1127 # define VERT_AUTO_SCALE (1 << 9)
1128 # define HORIZ_INTERP_DISABLE (0 << 6)
1129 # define HORIZ_INTERP_BILINEAR (1 << 6)
1130 # define HORIZ_INTERP_MASK (3 << 6)
1131 # define HORIZ_AUTO_SCALE (1 << 5)
1132 # define PANEL_8TO6_DITHER_ENABLE (1 << 3)
1134 # define PFIT_PIPE_MASK (3 << 29)
1135 # define PFIT_PIPE_SHIFT 29
1136 # define PFIT_SCALING_MODE_MASK (7 << 26)
1137 # define PFIT_SCALING_AUTO (0 << 26)
1138 # define PFIT_SCALING_PROGRAMMED (1 << 26)
1139 # define PFIT_SCALING_PILLAR (2 << 26)
1140 # define PFIT_SCALING_LETTER (3 << 26)
1141 # define PFIT_FILTER_SELECT_MASK (3 << 24)
1142 # define PFIT_FILTER_FUZZY (0 << 24)
1143 # define PFIT_FILTER_CRISP (1 << 24)
1144 # define PFIT_FILTER_MEDIAN (2 << 24)
1146 #define PFIT_PGM_RATIOS 0x61234
1148 # define PFIT_VERT_SCALE_SHIFT 20
1149 # define PFIT_VERT_SCALE_MASK 0xfff00000
1150 # define PFIT_HORIZ_SCALE_SHIFT 4
1151 # define PFIT_HORIZ_SCALE_MASK 0x0000fff0
1153 # define PFIT_VERT_SCALE_SHIFT_965 16
1154 # define PFIT_VERT_SCALE_MASK_965 0x1fff0000
1155 # define PFIT_HORIZ_SCALE_SHIFT_965 0
1156 # define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
1158 #define DPLL_A 0x06014
1159 #define DPLL_B 0x06018
1160 # define DPLL_VCO_ENABLE (1 << 31)
1161 # define DPLL_DVO_HIGH_SPEED (1 << 30)
1162 # define DPLL_SYNCLOCK_ENABLE (1 << 29)
1163 # define DPLL_VGA_MODE_DIS (1 << 28)
1164 # define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
1165 # define DPLLB_MODE_LVDS (2 << 26) /* i915 */
1166 # define DPLL_MODE_MASK (3 << 26)
1167 # define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
1168 # define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
1169 # define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
1170 # define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
1171 # define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
1172 # define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
1173 # define DPLL_FPA01_P1_POST_DIV_MASK_IGD 0x00ff8000 /* IGD */
1175 * The i830 generation, in DAC/serial mode, defines p1 as two plus this
1176 * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
1178 # define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
1180 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
1181 * this field (only one bit may be set).
1183 # define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
1184 # define DPLL_FPA01_P1_POST_DIV_SHIFT 16
1185 # define DPLL_FPA01_P1_POST_DIV_SHIFT_IGD 15
1186 # define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required in DVO non-gang */
1187 # define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
1188 # define PLL_REF_INPUT_DREFCLK (0 << 13)
1189 # define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
1190 # define PLL_REF_INPUT_SUPER_SSC (1 << 13) /* Ironlake: 120M SSC */
1191 # define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
1192 # define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
1193 # define PLL_REF_INPUT_MASK (3 << 13)
1194 # define PLL_REF_INPUT_DMICLK (5 << 13) /* Ironlake: DMI refclk */
1195 # define PLL_LOAD_PULSE_PHASE_SHIFT 9
1197 * Parallel to Serial Load Pulse phase selection.
1198 * Selects the phase for the 10X DPLL clock for the PCIe
1199 * digital display port. The range is 4 to 13; 10 or more
1200 * is just a flip delay. The default is 6
1202 # define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
1203 # define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
1205 # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
1206 # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
1207 # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1)<< PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT)
1208 # define DPLL_FPA1_P1_POST_DIV_SHIFT 0
1209 # define DPLL_FPA1_P1_POST_DIV_MASK 0xff
1212 * SDVO multiplier for 945G/GM. Not used on 965.
1214 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
1216 # define SDVO_MULTIPLIER_MASK 0x000000ff
1217 # define SDVO_MULTIPLIER_SHIFT_HIRES 4
1218 # define SDVO_MULTIPLIER_SHIFT_VGA 0
1220 /** @defgroup DPLL_MD
1223 /** Pipe A SDVO/UDI clock multiplier/divider register for G965. */
1224 #define DPLL_A_MD 0x0601c
1225 /** Pipe B SDVO/UDI clock multiplier/divider register for G965. */
1226 #define DPLL_B_MD 0x06020
1228 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
1230 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
1232 # define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
1233 # define DPLL_MD_UDI_DIVIDER_SHIFT 24
1234 /** UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
1235 # define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
1236 # define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
1238 * SDVO/UDI pixel multiplier.
1240 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
1241 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
1242 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
1243 * dummy bytes in the datastream at an increased clock rate, with both sides of
1244 * the link knowing how many bytes are fill.
1246 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
1247 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
1248 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
1249 * through an SDVO command.
1251 * This register field has values of multiplication factor minus 1, with
1252 * a maximum multiplier of 5 for SDVO.
1254 # define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
1255 # define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
1256 /** SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
1257 * This best be set to the default value (3) or the CRT won't work. No,
1258 * I don't entirely understand what this does...
1260 # define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
1261 # define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
1264 #define DPLL_TEST 0x606c
1265 # define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
1266 # define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
1267 # define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
1268 # define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
1269 # define DPLLB_TEST_N_BYPASS (1 << 19)
1270 # define DPLLB_TEST_M_BYPASS (1 << 18)
1271 # define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
1272 # define DPLLA_TEST_N_BYPASS (1 << 3)
1273 # define DPLLA_TEST_M_BYPASS (1 << 2)
1274 # define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
1276 #define D_STATE 0x6104
1277 #define DSPCLK_GATE_D 0x6200
1278 # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
1279 # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
1280 # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
1281 # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
1282 # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
1283 # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
1284 # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
1285 # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
1286 # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
1287 # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
1288 # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
1289 # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
1290 # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
1291 # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
1292 # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
1293 # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
1294 # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
1295 # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
1296 # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
1297 # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
1298 # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
1299 # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
1300 # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
1301 # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
1302 # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
1303 # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
1304 # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
1305 # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
1307 * This bit must be set on the 830 to prevent hangs when turning off the
1310 # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
1311 # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
1312 # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
1313 # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
1314 # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
1316 #define RENCLK_GATE_D1 0x6204
1317 # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
1318 # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
1319 # define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
1320 # define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
1321 # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
1322 # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
1323 # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
1324 # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
1325 # define MAG_CLOCK_GATE_DISABLE (1 << 5)
1326 /** This bit must be unset on 855,865 */
1327 # define MECI_CLOCK_GATE_DISABLE (1 << 4)
1328 # define DCMP_CLOCK_GATE_DISABLE (1 << 3)
1329 # define MEC_CLOCK_GATE_DISABLE (1 << 2)
1330 # define MECO_CLOCK_GATE_DISABLE (1 << 1)
1331 /** This bit must be set on 855,865. */
1332 # define SV_CLOCK_GATE_DISABLE (1 << 0)
1333 # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
1334 # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
1335 # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
1336 # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
1337 # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
1338 # define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
1339 # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
1340 # define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
1341 # define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
1342 # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
1343 # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
1344 # define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
1345 # define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
1346 # define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
1347 # define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
1348 # define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
1349 # define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
1351 # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
1352 /** This bit must always be set on 965G/965GM */
1353 # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
1354 # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
1355 # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
1356 # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
1357 # define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
1358 # define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
1359 /** This bit must always be set on 965G */
1360 # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
1361 # define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
1362 # define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
1363 # define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
1364 # define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
1365 # define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
1366 # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
1367 # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
1368 # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
1369 # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
1370 # define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
1371 # define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
1372 # define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
1373 # define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
1374 # define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
1375 # define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
1376 # define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
1377 # define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
1378 # define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
1380 #define RENCLK_GATE_D2 0x6208
1381 #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
1382 #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
1383 #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
1384 #define RAMCLK_GATE_D 0x6210 /* CRL only */
1385 #define DEUC 0x6214 /* CRL only */
1388 * This is a PCI config space register to manipulate backlight brightness
1389 * It is used when the BLM_LEGACY_MODE is turned on. When enabled, the first
1390 * byte of this config register sets brightness within the range from
1393 #define LEGACY_BACKLIGHT_BRIGHTNESS 0xf4
1395 #define BLC_PWM_CTL 0x61254
1396 #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
1397 #define BACKLIGHT_MODULATION_FREQ_SHIFT2 (16)
1399 * This is the most significant 15 bits of the number of backlight cycles in a
1400 * complete cycle of the modulated backlight control.
1402 * The actual value is this field multiplied by two.
1404 #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
1405 #define BACKLIGHT_MODULATION_FREQ_MASK2 (0xffff << 16)
1406 #define BLM_LEGACY_MODE (1 << 16)
1409 * This is the number of cycles out of the backlight modulation cycle for which
1410 * the backlight is on.
1412 * This field must be no greater than the number of cycles in the complete
1413 * backlight modulation cycle.
1415 #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
1416 #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
1418 /* On 965+ backlight control is in another register */
1419 #define BLC_PWM_CTL2 0x61250
1420 #define BLM_LEGACY_MODE2 (1 << 30)
1422 #define BLM_CTL 0x61260
1423 #define BLM_THRESHOLD_0 0x61270
1424 #define BLM_THRESHOLD_1 0x61274
1425 #define BLM_THRESHOLD_2 0x61278
1426 #define BLM_THRESHOLD_3 0x6127c
1427 #define BLM_THRESHOLD_4 0x61280
1428 #define BLM_THRESHOLD_5 0x61284
1430 #define BLM_ACCUMULATOR_0 0x61290
1431 #define BLM_ACCUMULATOR_1 0x61294
1432 #define BLM_ACCUMULATOR_2 0x61298
1433 #define BLM_ACCUMULATOR_3 0x6129c
1434 #define BLM_ACCUMULATOR_4 0x612a0
1435 #define BLM_ACCUMULATOR_5 0x612a4
1437 #define FPA0 0x06040
1438 #define FPA1 0x06044
1439 #define FPB0 0x06048
1440 #define FPB1 0x0604c
1441 # define FP_N_DIV_MASK 0x003f0000
1442 # define FP_N_IGD_DIV_MASK 0x00ff0000
1443 # define FP_N_DIV_SHIFT 16
1444 # define FP_M1_DIV_MASK 0x00003f00
1445 # define FP_M1_DIV_SHIFT 8
1446 # define FP_M2_DIV_MASK 0x0000003f
1447 # define FP_M2_IGD_DIV_MASK 0x000000ff
1448 # define FP_M2_DIV_SHIFT 0
1450 #define PORT_HOTPLUG_EN 0x61110
1451 # define HDMIB_HOTPLUG_INT_EN (1 << 29)
1452 # define HDMIC_HOTPLUG_INT_EN (1 << 28)
1453 # define HDMID_HOTPLUG_INT_EN (1 << 27)
1454 # define SDVOB_HOTPLUG_INT_EN (1 << 26)
1455 # define SDVOC_HOTPLUG_INT_EN (1 << 25)
1456 # define TV_HOTPLUG_INT_EN (1 << 18)
1457 # define CRT_HOTPLUG_INT_EN (1 << 9)
1458 # define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
1459 /* must use period 64 on GM45 according to docs */
1460 # define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
1461 # define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
1462 # define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
1463 # define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
1464 # define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
1465 # define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
1466 # define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
1467 # define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
1468 # define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
1469 # define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
1470 # define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
1471 # define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
1472 # define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
1473 # define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */
1475 #define PORT_HOTPLUG_STAT 0x61114
1476 # define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
1477 # define HDMIC_HOTPLUG_INT_STATUS (1 << 28)
1478 # define HDMID_HOTPLUG_INT_STATUS (1 << 27)
1479 # define CRT_HOTPLUG_INT_STATUS (1 << 11)
1480 # define TV_HOTPLUG_INT_STATUS (1 << 10)
1481 # define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
1482 # define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
1483 # define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
1484 # define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
1485 # define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
1486 # define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
1488 #define SDVOB 0x61140
1489 #define SDVOC 0x61160
1490 #define SDVO_ENABLE (1 << 31)
1491 #define SDVO_PIPE_B_SELECT (1 << 30)
1492 #define SDVO_STALL_SELECT (1 << 29)
1493 #define SDVO_INTERRUPT_ENABLE (1 << 26)
1495 * 915G/GM SDVO pixel multiplier.
1497 * Programmed value is multiplier - 1, up to 5x.
1499 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
1501 #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
1502 #define SDVO_PORT_MULTIPLY_SHIFT 23
1503 #define SDVO_PHASE_SELECT_MASK (15 << 19)
1504 #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
1505 #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
1506 #define SDVOC_GANG_MODE (1 << 16)
1507 #define SDVO_ENCODING_SDVO (0x0 << 10)
1508 #define SDVO_ENCODING_HDMI (0x2 << 10)
1509 /** Requird for HDMI operation */
1510 #define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
1511 #define SDVO_BORDER_ENABLE (1 << 7)
1512 #define SDVO_AUDIO_ENABLE (1 << 6)
1513 /** New with 965, default is to be set */
1514 #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
1515 /** New with 965, default is to be set */
1516 #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
1517 /** 915/945 only, read-only bit */
1518 #define SDVOB_PCIE_CONCURRENCY (1 << 3)
1519 #define SDVO_DETECTED (1 << 2)
1520 /* Bits to be preserved when writing */
1521 #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14))
1522 #define SDVOC_PRESERVE_MASK (1 << 17)
1524 #define UDIB_SVB_SHB_CODES 0x61144
1525 #define UDIB_SHA_BLANK_CODES 0x61148
1526 #define UDIB_START_END_FILL_CODES 0x6114c
1529 #define SDVOUDI 0x61150
1531 #define I830_HTOTAL_MASK 0xfff0000
1532 #define I830_HACTIVE_MASK 0x7ff
1534 #define I830_HBLANKEND_MASK 0xfff0000
1535 #define I830_HBLANKSTART_MASK 0xfff
1537 #define I830_HSYNCEND_MASK 0xfff0000
1538 #define I830_HSYNCSTART_MASK 0xfff
1540 #define I830_VTOTAL_MASK 0xfff0000
1541 #define I830_VACTIVE_MASK 0x7ff
1543 #define I830_VBLANKEND_MASK 0xfff0000
1544 #define I830_VBLANKSTART_MASK 0xfff
1546 #define I830_VSYNCEND_MASK 0xfff0000
1547 #define I830_VSYNCSTART_MASK 0xfff
1549 #define I830_PIPEA_HORZ_MASK 0x7ff0000
1550 #define I830_PIPEA_VERT_MASK 0x7ff
1552 #define ADPA 0x61100
1553 #define ADPA_DAC_ENABLE (1<<31)
1554 #define ADPA_DAC_DISABLE 0
1555 #define ADPA_PIPE_SELECT_MASK (1<<30)
1556 #define ADPA_PIPE_A_SELECT 0
1557 #define ADPA_PIPE_B_SELECT (1<<30)
1558 #define ADPA_USE_VGA_HVPOLARITY (1<<15)
1559 #define ADPA_SETS_HVPOLARITY 0
1560 #define ADPA_VSYNC_CNTL_DISABLE (1<<11)
1561 #define ADPA_VSYNC_CNTL_ENABLE 0
1562 #define ADPA_HSYNC_CNTL_DISABLE (1<<10)
1563 #define ADPA_HSYNC_CNTL_ENABLE 0
1564 #define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
1565 #define ADPA_VSYNC_ACTIVE_LOW 0
1566 #define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
1567 #define ADPA_HSYNC_ACTIVE_LOW 0
1569 #define PCH_eDP_A 0x64000
1570 #define PCH_DP_B 0xe4100
1571 #define PCH_DP_C 0xe4200
1572 #define PCH_DP_D 0xe4300
1574 #define DVOA 0x61120
1575 #define DVOB 0x61140
1576 #define DVOC 0x61160
1577 #define DVO_ENABLE (1 << 31)
1578 #define DVO_PIPE_B_SELECT (1 << 30)
1579 #define DVO_PIPE_STALL_UNUSED (0 << 28)
1580 #define DVO_PIPE_STALL (1 << 28)
1581 #define DVO_PIPE_STALL_TV (2 << 28)
1582 #define DVO_PIPE_STALL_MASK (3 << 28)
1583 #define DVO_USE_VGA_SYNC (1 << 15)
1584 #define DVO_DATA_ORDER_I740 (0 << 14)
1585 #define DVO_DATA_ORDER_FP (1 << 14)
1586 #define DVO_VSYNC_DISABLE (1 << 11)
1587 #define DVO_HSYNC_DISABLE (1 << 10)
1588 #define DVO_VSYNC_TRISTATE (1 << 9)
1589 #define DVO_HSYNC_TRISTATE (1 << 8)
1590 #define DVO_BORDER_ENABLE (1 << 7)
1591 #define DVO_DATA_ORDER_GBRG (1 << 6)
1592 #define DVO_DATA_ORDER_RGGB (0 << 6)
1593 #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
1594 #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
1595 #define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
1596 #define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
1597 #define DVO_BLANK_ACTIVE_HIGH (1 << 2)
1598 #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
1599 #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
1600 #define DVO_PRESERVE_MASK (0x7<<24)
1602 #define DVOA_SRCDIM 0x61124
1603 #define DVOB_SRCDIM 0x61144
1604 #define DVOC_SRCDIM 0x61164
1605 #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
1606 #define DVO_SRCDIM_VERTICAL_SHIFT 0
1612 * This register controls the LVDS output enable, pipe selection, and data
1615 * All of the clock/data pairs are force powered down by power sequencing.
1617 #define LVDS 0x61180
1619 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
1620 * the DPLL semantics change when the LVDS is assigned to that pipe.
1622 # define LVDS_PORT_EN (1 << 31)
1623 /** Selects pipe B for LVDS data. Must be set on pre-965. */
1624 # define LVDS_PIPEB_SELECT (1 << 30)
1626 /* on 965, dithering is enabled in this register, not PFIT_CONTROL */
1627 # define LVDS_DITHER_ENABLE (1 << 25)
1630 * Selects between .0 and .1 formats:
1632 * 0 = 1x18.0, 2x18.0, 1x24.0 or 2x24.0
1633 * 1 = 1x24.1 or 2x24.1
1635 # define LVDS_DATA_FORMAT_DOT_ONE (1 << 24)
1637 /* Using LE instead of HS on second channel control signal */
1638 # define LVDS_LE_CONTROL_ENABLE (1 << 23)
1640 /* Using LF instead of VS on second channel control signal */
1641 # define LVDS_LF_CONTROL_ENABLE (1 << 22)
1643 /* invert vsync signal polarity */
1644 # define LVDS_VSYNC_POLARITY_INVERT (1 << 21)
1646 /* invert hsync signal polarity */
1647 # define LVDS_HSYNC_POLARITY_INVERT (1 << 20)
1649 /* invert display enable signal polarity */
1650 # define LVDS_DE_POLARITY_INVERT (1 << 19)
1653 * Control signals for second channel, ignored in single channel modes
1656 /* send DE, HS, VS on second channel */
1657 # define LVDS_SECOND_CHANNEL_DE_HS_VS (0 << 17)
1659 # define LVDS_SECOND_CHANNEL_RESERVED (1 << 17)
1661 /* Send zeros instead of DE, HS, VS on second channel */
1662 # define LVDS_SECOND_CHANNEL_ZEROS (2 << 17)
1664 /* Set DE=0, HS=LE, VS=LF on second channel */
1665 # define LVDS_SECOND_CHANNEL_HS_VS (3 << 17)
1668 * Send duplicate data for channel reserved bits, otherwise send zeros
1670 # define LVDS_CHANNEL_DUP_RESERVED (1 << 16)
1673 * Enable border for unscaled (or aspect-scaled) display
1675 # define LVDS_BORDER_ENABLE (1 << 15)
1678 * Tri-state the LVDS buffers when powered down, otherwise
1679 * they are set to 0V
1681 # define LVDS_POWER_DOWN_TRI_STATE (1 << 10)
1684 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
1687 # define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
1688 # define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
1689 # define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
1691 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
1692 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
1695 # define LVDS_A3_POWER_MASK (3 << 6)
1696 # define LVDS_A3_POWER_DOWN (0 << 6)
1697 # define LVDS_A3_POWER_UP (3 << 6)
1699 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
1702 # define LVDS_CLKB_POWER_MASK (3 << 4)
1703 # define LVDS_CLKB_POWER_DOWN (0 << 4)
1704 # define LVDS_CLKB_POWER_UP (3 << 4)
1707 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
1708 * setting for whether we are in dual-channel mode. The B3 pair will
1709 * additionally only be powered up when LVDS_A3_POWER_UP is set.
1711 # define LVDS_B0B3_POWER_MASK (3 << 2)
1712 # define LVDS_B0B3_POWER_DOWN (0 << 2)
1713 # define LVDS_B0B3_POWER_UP (3 << 2)
1717 #define DP_B 0x64100
1718 #define DPB_AUX_CH_CTL 0x64110
1719 #define DPB_AUX_CH_DATA1 0x64114
1720 #define DPB_AUX_CH_DATA2 0x64118
1721 #define DPB_AUX_CH_DATA3 0x6411c
1722 #define DPB_AUX_CH_DATA4 0x64120
1723 #define DPB_AUX_CH_DATA5 0x64124
1725 #define DP_C 0x64200
1726 #define DPC_AUX_CH_CTL 0x64210
1727 #define DPC_AUX_CH_DATA1 0x64214
1728 #define DPC_AUX_CH_DATA2 0x64218
1729 #define DPC_AUX_CH_DATA3 0x6421c
1730 #define DPC_AUX_CH_DATA4 0x64220
1731 #define DPC_AUX_CH_DATA5 0x64224
1733 #define DP_D 0x64300
1734 #define DPD_AUX_CH_CTL 0x64310
1735 #define DPD_AUX_CH_DATA1 0x64314
1736 #define DPD_AUX_CH_DATA2 0x64318
1737 #define DPD_AUX_CH_DATA3 0x6431c
1738 #define DPD_AUX_CH_DATA4 0x64320
1739 #define DPD_AUX_CH_DATA5 0x64324
1742 * Two channel clock control. Turn this on if you need clkb for two channel mode
1743 * Overridden by global LVDS power sequencing
1747 # define LVDS_CLKB_POWER_DOWN (0 << 4)
1749 /* powered up, but clkb forced to 0 */
1750 # define LVDS_CLKB_POWER_PARTIAL (1 << 4)
1752 /* clock B running */
1753 # define LVDS_CLKB_POWER_UP (3 << 4)
1756 * Two channel mode B0-B2 control. Sets state when power is on.
1757 * Set to POWER_DOWN in single channel mode, other settings enable
1758 * two channel mode. The CLKB power control controls whether that clock
1759 * is enabled during two channel mode.
1762 /* Everything is off, including B3 and CLKB */
1763 # define LVDS_B_POWER_DOWN (0 << 2)
1765 /* B0, B1, B2 and data lines forced to 0. timing is active */
1766 # define LVDS_B_POWER_PARTIAL (1 << 2)
1768 /* data lines active (both timing and colour) */
1769 # define LVDS_B_POWER_UP (3 << 2)
1771 /** @defgroup TV_CTL
1774 #define TV_CTL 0x68000
1775 /** Enables the TV encoder */
1776 # define TV_ENC_ENABLE (1 << 31)
1777 /** Sources the TV encoder input from pipe B instead of A. */
1778 # define TV_ENC_PIPEB_SELECT (1 << 30)
1779 /** Outputs composite video (DAC A only) */
1780 # define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
1781 /** Outputs SVideo video (DAC B/C) */
1782 # define TV_ENC_OUTPUT_SVIDEO (1 << 28)
1783 /** Outputs Component video (DAC A/B/C) */
1784 # define TV_ENC_OUTPUT_COMPONENT (2 << 28)
1785 /** Outputs Composite and SVideo (DAC A/B/C) */
1786 # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
1787 # define TV_TRILEVEL_SYNC (1 << 21)
1788 /** Enables slow sync generation (945GM only) */
1789 # define TV_SLOW_SYNC (1 << 20)
1790 /** Selects 4x oversampling for 480i and 576p */
1791 # define TV_OVERSAMPLE_4X (0 << 18)
1792 /** Selects 2x oversampling for 720p and 1080i */
1793 # define TV_OVERSAMPLE_2X (1 << 18)
1794 /** Selects no oversampling for 1080p */
1795 # define TV_OVERSAMPLE_NONE (2 << 18)
1796 /** Selects 8x oversampling */
1797 # define TV_OVERSAMPLE_8X (3 << 18)
1798 /** Selects progressive mode rather than interlaced */
1799 # define TV_PROGRESSIVE (1 << 17)
1800 /** Sets the colorburst to PAL mode. Required for non-M PAL modes. */
1801 # define TV_PAL_BURST (1 << 16)
1802 /** Field for setting delay of Y compared to C */
1803 # define TV_YC_SKEW_MASK (7 << 12)
1804 /** Enables a fix for 480p/576p standard definition modes on the 915GM only */
1805 # define TV_ENC_SDP_FIX (1 << 11)
1807 * Enables a fix for the 915GM only.
1809 * Not sure what it does.
1811 # define TV_ENC_C0_FIX (1 << 10)
1812 /** Bits that must be preserved by software */
1813 # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
1814 # define TV_FUSE_STATE_MASK (3 << 4)
1815 /** Read-only state that reports all features enabled */
1816 # define TV_FUSE_STATE_ENABLED (0 << 4)
1817 /** Read-only state that reports that Macrovision is disabled in hardware*/
1818 # define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
1819 /** Read-only state that reports that TV-out is disabled in hardware. */
1820 # define TV_FUSE_STATE_DISABLED (2 << 4)
1821 /** Normal operation */
1822 # define TV_TEST_MODE_NORMAL (0 << 0)
1823 /** Encoder test pattern 1 - combo pattern */
1824 # define TV_TEST_MODE_PATTERN_1 (1 << 0)
1825 /** Encoder test pattern 2 - full screen vertical 75% color bars */
1826 # define TV_TEST_MODE_PATTERN_2 (2 << 0)
1827 /** Encoder test pattern 3 - full screen horizontal 75% color bars */
1828 # define TV_TEST_MODE_PATTERN_3 (3 << 0)
1829 /** Encoder test pattern 4 - random noise */
1830 # define TV_TEST_MODE_PATTERN_4 (4 << 0)
1831 /** Encoder test pattern 5 - linear color ramps */
1832 # define TV_TEST_MODE_PATTERN_5 (5 << 0)
1834 * This test mode forces the DACs to 50% of full output.
1836 * This is used for load detection in combination with TVDAC_SENSE_MASK
1838 # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
1839 # define TV_TEST_MODE_MASK (7 << 0)
1842 /** @defgroup TV_DAC
1845 #define TV_DAC 0x68004
1847 * Reports that DAC state change logic has reported change (RO).
1849 * This gets cleared when TV_DAC_STATE_EN is cleared
1851 # define TVDAC_STATE_CHG (1 << 31)
1852 # define TVDAC_SENSE_MASK (7 << 28)
1853 /** Reports that DAC A voltage is above the detect threshold */
1854 # define TVDAC_A_SENSE (1 << 30)
1855 /** Reports that DAC B voltage is above the detect threshold */
1856 # define TVDAC_B_SENSE (1 << 29)
1857 /** Reports that DAC C voltage is above the detect threshold */
1858 # define TVDAC_C_SENSE (1 << 28)
1860 * Enables DAC state detection logic, for load-based TV detection.
1862 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
1863 * to off, for load detection to work.
1865 # define TVDAC_STATE_CHG_EN (1 << 27)
1866 /** Sets the DAC A sense value to high */
1867 # define TVDAC_A_SENSE_CTL (1 << 26)
1868 /** Sets the DAC B sense value to high */
1869 # define TVDAC_B_SENSE_CTL (1 << 25)
1870 /** Sets the DAC C sense value to high */
1871 # define TVDAC_C_SENSE_CTL (1 << 24)
1872 /** Overrides the ENC_ENABLE and DAC voltage levels */
1873 # define DAC_CTL_OVERRIDE (1 << 7)
1874 /** Sets the slew rate. Must be preserved in software */
1875 # define ENC_TVDAC_SLEW_FAST (1 << 6)
1876 # define DAC_A_1_3_V (0 << 4)
1877 # define DAC_A_1_1_V (1 << 4)
1878 # define DAC_A_0_7_V (2 << 4)
1879 # define DAC_A_OFF (3 << 4)
1880 # define DAC_B_1_3_V (0 << 2)
1881 # define DAC_B_1_1_V (1 << 2)
1882 # define DAC_B_0_7_V (2 << 2)
1883 # define DAC_B_OFF (3 << 2)
1884 # define DAC_C_1_3_V (0 << 0)
1885 # define DAC_C_1_1_V (1 << 0)
1886 # define DAC_C_0_7_V (2 << 0)
1887 # define DAC_C_OFF (3 << 0)
1891 * CSC coefficients are stored in a floating point format with 9 bits of
1892 * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
1893 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
1894 * -1 (0x3) being the only legal negative value.
1896 #define TV_CSC_Y 0x68010
1897 # define TV_RY_MASK 0x07ff0000
1898 # define TV_RY_SHIFT 16
1899 # define TV_GY_MASK 0x00000fff
1900 # define TV_GY_SHIFT 0
1902 #define TV_CSC_Y2 0x68014
1903 # define TV_BY_MASK 0x07ff0000
1904 # define TV_BY_SHIFT 16
1906 * Y attenuation for component video.
1908 * Stored in 1.9 fixed point.
1910 # define TV_AY_MASK 0x000003ff
1911 # define TV_AY_SHIFT 0
1913 #define TV_CSC_U 0x68018
1914 # define TV_RU_MASK 0x07ff0000
1915 # define TV_RU_SHIFT 16
1916 # define TV_GU_MASK 0x000007ff
1917 # define TV_GU_SHIFT 0
1919 #define TV_CSC_U2 0x6801c
1920 # define TV_BU_MASK 0x07ff0000
1921 # define TV_BU_SHIFT 16
1923 * U attenuation for component video.
1925 * Stored in 1.9 fixed point.
1927 # define TV_AU_MASK 0x000003ff
1928 # define TV_AU_SHIFT 0
1930 #define TV_CSC_V 0x68020
1931 # define TV_RV_MASK 0x0fff0000
1932 # define TV_RV_SHIFT 16
1933 # define TV_GV_MASK 0x000007ff
1934 # define TV_GV_SHIFT 0
1936 #define TV_CSC_V2 0x68024
1937 # define TV_BV_MASK 0x07ff0000
1938 # define TV_BV_SHIFT 16
1940 * V attenuation for component video.
1942 * Stored in 1.9 fixed point.
1944 # define TV_AV_MASK 0x000007ff
1945 # define TV_AV_SHIFT 0
1947 /** @defgroup TV_CSC_KNOBS
1950 #define TV_CLR_KNOBS 0x68028
1951 /** 2s-complement brightness adjustment */
1952 # define TV_BRIGHTNESS_MASK 0xff000000
1953 # define TV_BRIGHTNESS_SHIFT 24
1954 /** Contrast adjustment, as a 2.6 unsigned floating point number */
1955 # define TV_CONTRAST_MASK 0x00ff0000
1956 # define TV_CONTRAST_SHIFT 16
1957 /** Saturation adjustment, as a 2.6 unsigned floating point number */
1958 # define TV_SATURATION_MASK 0x0000ff00
1959 # define TV_SATURATION_SHIFT 8
1960 /** Hue adjustment, as an integer phase angle in degrees */
1961 # define TV_HUE_MASK 0x000000ff
1962 # define TV_HUE_SHIFT 0
1965 /** @defgroup TV_CLR_LEVEL
1968 #define TV_CLR_LEVEL 0x6802c
1969 /** Controls the DAC level for black */
1970 # define TV_BLACK_LEVEL_MASK 0x01ff0000
1971 # define TV_BLACK_LEVEL_SHIFT 16
1972 /** Controls the DAC level for blanking */
1973 # define TV_BLANK_LEVEL_MASK 0x000001ff
1974 # define TV_BLANK_LEVEL_SHIFT 0
1977 /** @defgroup TV_H_CTL_1
1980 #define TV_H_CTL_1 0x68030
1981 /** Number of pixels in the hsync. */
1982 # define TV_HSYNC_END_MASK 0x1fff0000
1983 # define TV_HSYNC_END_SHIFT 16
1984 /** Total number of pixels minus one in the line (display and blanking). */
1985 # define TV_HTOTAL_MASK 0x00001fff
1986 # define TV_HTOTAL_SHIFT 0
1989 /** @defgroup TV_H_CTL_2
1992 #define TV_H_CTL_2 0x68034
1993 /** Enables the colorburst (needed for non-component color) */
1994 # define TV_BURST_ENA (1 << 31)
1995 /** Offset of the colorburst from the start of hsync, in pixels minus one. */
1996 # define TV_HBURST_START_SHIFT 16
1997 # define TV_HBURST_START_MASK 0x1fff0000
1998 /** Length of the colorburst */
1999 # define TV_HBURST_LEN_SHIFT 0
2000 # define TV_HBURST_LEN_MASK 0x0001fff
2003 /** @defgroup TV_H_CTL_3
2006 #define TV_H_CTL_3 0x68038
2007 /** End of hblank, measured in pixels minus one from start of hsync */
2008 # define TV_HBLANK_END_SHIFT 16
2009 # define TV_HBLANK_END_MASK 0x1fff0000
2010 /** Start of hblank, measured in pixels minus one from start of hsync */
2011 # define TV_HBLANK_START_SHIFT 0
2012 # define TV_HBLANK_START_MASK 0x0001fff
2015 /** @defgroup TV_V_CTL_1
2018 #define TV_V_CTL_1 0x6803c
2020 # define TV_NBR_END_SHIFT 16
2021 # define TV_NBR_END_MASK 0x07ff0000
2023 # define TV_VI_END_F1_SHIFT 8
2024 # define TV_VI_END_F1_MASK 0x00003f00
2026 # define TV_VI_END_F2_SHIFT 0
2027 # define TV_VI_END_F2_MASK 0x0000003f
2030 /** @defgroup TV_V_CTL_2
2033 #define TV_V_CTL_2 0x68040
2034 /** Length of vsync, in half lines */
2035 # define TV_VSYNC_LEN_MASK 0x07ff0000
2036 # define TV_VSYNC_LEN_SHIFT 16
2037 /** Offset of the start of vsync in field 1, measured in one less than the
2038 * number of half lines.
2040 # define TV_VSYNC_START_F1_MASK 0x00007f00
2041 # define TV_VSYNC_START_F1_SHIFT 8
2043 * Offset of the start of vsync in field 2, measured in one less than the
2044 * number of half lines.
2046 # define TV_VSYNC_START_F2_MASK 0x0000007f
2047 # define TV_VSYNC_START_F2_SHIFT 0
2050 /** @defgroup TV_V_CTL_3
2053 #define TV_V_CTL_3 0x68044
2054 /** Enables generation of the equalization signal */
2055 # define TV_EQUAL_ENA (1 << 31)
2056 /** Length of vsync, in half lines */
2057 # define TV_VEQ_LEN_MASK 0x007f0000
2058 # define TV_VEQ_LEN_SHIFT 16
2059 /** Offset of the start of equalization in field 1, measured in one less than
2060 * the number of half lines.
2062 # define TV_VEQ_START_F1_MASK 0x0007f00
2063 # define TV_VEQ_START_F1_SHIFT 8
2065 * Offset of the start of equalization in field 2, measured in one less than
2066 * the number of half lines.
2068 # define TV_VEQ_START_F2_MASK 0x000007f
2069 # define TV_VEQ_START_F2_SHIFT 0
2072 /** @defgroup TV_V_CTL_4
2075 #define TV_V_CTL_4 0x68048
2077 * Offset to start of vertical colorburst, measured in one less than the
2078 * number of lines from vertical start.
2080 # define TV_VBURST_START_F1_MASK 0x003f0000
2081 # define TV_VBURST_START_F1_SHIFT 16
2083 * Offset to the end of vertical colorburst, measured in one less than the
2084 * number of lines from the start of NBR.
2086 # define TV_VBURST_END_F1_MASK 0x000000ff
2087 # define TV_VBURST_END_F1_SHIFT 0
2090 /** @defgroup TV_V_CTL_5
2093 #define TV_V_CTL_5 0x6804c
2095 * Offset to start of vertical colorburst, measured in one less than the
2096 * number of lines from vertical start.
2098 # define TV_VBURST_START_F2_MASK 0x003f0000
2099 # define TV_VBURST_START_F2_SHIFT 16
2101 * Offset to the end of vertical colorburst, measured in one less than the
2102 * number of lines from the start of NBR.
2104 # define TV_VBURST_END_F2_MASK 0x000000ff
2105 # define TV_VBURST_END_F2_SHIFT 0
2108 /** @defgroup TV_V_CTL_6
2111 #define TV_V_CTL_6 0x68050
2113 * Offset to start of vertical colorburst, measured in one less than the
2114 * number of lines from vertical start.
2116 # define TV_VBURST_START_F3_MASK 0x003f0000
2117 # define TV_VBURST_START_F3_SHIFT 16
2119 * Offset to the end of vertical colorburst, measured in one less than the
2120 * number of lines from the start of NBR.
2122 # define TV_VBURST_END_F3_MASK 0x000000ff
2123 # define TV_VBURST_END_F3_SHIFT 0
2126 /** @defgroup TV_V_CTL_7
2129 #define TV_V_CTL_7 0x68054
2131 * Offset to start of vertical colorburst, measured in one less than the
2132 * number of lines from vertical start.
2134 # define TV_VBURST_START_F4_MASK 0x003f0000
2135 # define TV_VBURST_START_F4_SHIFT 16
2137 * Offset to the end of vertical colorburst, measured in one less than the
2138 * number of lines from the start of NBR.
2140 # define TV_VBURST_END_F4_MASK 0x000000ff
2141 # define TV_VBURST_END_F4_SHIFT 0
2144 /** @defgroup TV_SC_CTL_1
2147 #define TV_SC_CTL_1 0x68060
2148 /** Turns on the first subcarrier phase generation DDA */
2149 # define TV_SC_DDA1_EN (1 << 31)
2150 /** Turns on the first subcarrier phase generation DDA */
2151 # define TV_SC_DDA2_EN (1 << 30)
2152 /** Turns on the first subcarrier phase generation DDA */
2153 # define TV_SC_DDA3_EN (1 << 29)
2154 /** Sets the subcarrier DDA to reset frequency every other field */
2155 # define TV_SC_RESET_EVERY_2 (0 << 24)
2156 /** Sets the subcarrier DDA to reset frequency every fourth field */
2157 # define TV_SC_RESET_EVERY_4 (1 << 24)
2158 /** Sets the subcarrier DDA to reset frequency every eighth field */
2159 # define TV_SC_RESET_EVERY_8 (2 << 24)
2160 /** Sets the subcarrier DDA to never reset the frequency */
2161 # define TV_SC_RESET_NEVER (3 << 24)
2162 /** Sets the peak amplitude of the colorburst.*/
2163 # define TV_BURST_LEVEL_MASK 0x00ff0000
2164 # define TV_BURST_LEVEL_SHIFT 16
2165 /** Sets the increment of the first subcarrier phase generation DDA */
2166 # define TV_SCDDA1_INC_MASK 0x00000fff
2167 # define TV_SCDDA1_INC_SHIFT 0
2170 /** @defgroup TV_SC_CTL_2
2173 #define TV_SC_CTL_2 0x68064
2174 /** Sets the rollover for the second subcarrier phase generation DDA */
2175 # define TV_SCDDA2_SIZE_MASK 0x7fff0000
2176 # define TV_SCDDA2_SIZE_SHIFT 16
2177 /** Sets the increent of the second subcarrier phase generation DDA */
2178 # define TV_SCDDA2_INC_MASK 0x00007fff
2179 # define TV_SCDDA2_INC_SHIFT 0
2182 /** @defgroup TV_SC_CTL_3
2185 #define TV_SC_CTL_3 0x68068
2186 /** Sets the rollover for the third subcarrier phase generation DDA */
2187 # define TV_SCDDA3_SIZE_MASK 0x7fff0000
2188 # define TV_SCDDA3_SIZE_SHIFT 16
2189 /** Sets the increent of the third subcarrier phase generation DDA */
2190 # define TV_SCDDA3_INC_MASK 0x00007fff
2191 # define TV_SCDDA3_INC_SHIFT 0
2194 /** @defgroup TV_WIN_POS
2197 #define TV_WIN_POS 0x68070
2198 /** X coordinate of the display from the start of horizontal active */
2199 # define TV_XPOS_MASK 0x1fff0000
2200 # define TV_XPOS_SHIFT 16
2201 /** Y coordinate of the display from the start of vertical active (NBR) */
2202 # define TV_YPOS_MASK 0x00000fff
2203 # define TV_YPOS_SHIFT 0
2206 /** @defgroup TV_WIN_SIZE
2209 #define TV_WIN_SIZE 0x68074
2210 /** Horizontal size of the display window, measured in pixels*/
2211 # define TV_XSIZE_MASK 0x1fff0000
2212 # define TV_XSIZE_SHIFT 16
2214 * Vertical size of the display window, measured in pixels.
2216 * Must be even for interlaced modes.
2218 # define TV_YSIZE_MASK 0x00000fff
2219 # define TV_YSIZE_SHIFT 0
2222 /** @defgroup TV_FILTER_CTL_1
2225 #define TV_FILTER_CTL_1 0x68080
2227 * Enables automatic scaling calculation.
2229 * If set, the rest of the registers are ignored, and the calculated values can
2230 * be read back from the register.
2232 # define TV_AUTO_SCALE (1 << 31)
2234 * Disables the vertical filter.
2236 * This is required on modes more than 1024 pixels wide */
2237 # define TV_V_FILTER_BYPASS (1 << 29)
2238 /** Enables adaptive vertical filtering */
2239 # define TV_VADAPT (1 << 28)
2240 # define TV_VADAPT_MODE_MASK (3 << 26)
2241 /** Selects the least adaptive vertical filtering mode */
2242 # define TV_VADAPT_MODE_LEAST (0 << 26)
2243 /** Selects the moderately adaptive vertical filtering mode */
2244 # define TV_VADAPT_MODE_MODERATE (1 << 26)
2245 /** Selects the most adaptive vertical filtering mode */
2246 # define TV_VADAPT_MODE_MOST (3 << 26)
2248 * Sets the horizontal scaling factor.
2250 * This should be the fractional part of the horizontal scaling factor divided
2251 * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
2253 * (src width - 1) / ((oversample * dest width) - 1)
2255 # define TV_HSCALE_FRAC_MASK 0x00003fff
2256 # define TV_HSCALE_FRAC_SHIFT 0
2259 /** @defgroup TV_FILTER_CTL_2
2262 #define TV_FILTER_CTL_2 0x68084
2264 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
2266 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
2268 # define TV_VSCALE_INT_MASK 0x00038000
2269 # define TV_VSCALE_INT_SHIFT 15
2271 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
2273 * \sa TV_VSCALE_INT_MASK
2275 # define TV_VSCALE_FRAC_MASK 0x00007fff
2276 # define TV_VSCALE_FRAC_SHIFT 0
2279 /** @defgroup TV_FILTER_CTL_3
2282 #define TV_FILTER_CTL_3 0x68088
2284 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
2286 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
2288 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
2290 # define TV_VSCALE_IP_INT_MASK 0x00038000
2291 # define TV_VSCALE_IP_INT_SHIFT 15
2293 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
2295 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
2297 * \sa TV_VSCALE_IP_INT_MASK
2299 # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
2300 # define TV_VSCALE_IP_FRAC_SHIFT 0
2303 /** @defgroup TV_CC_CONTROL
2306 #define TV_CC_CONTROL 0x68090
2307 # define TV_CC_ENABLE (1 << 31)
2309 * Specifies which field to send the CC data in.
2311 * CC data is usually sent in field 0.
2313 # define TV_CC_FID_MASK (1 << 27)
2314 # define TV_CC_FID_SHIFT 27
2315 /** Sets the horizontal position of the CC data. Usually 135. */
2316 # define TV_CC_HOFF_MASK 0x03ff0000
2317 # define TV_CC_HOFF_SHIFT 16
2318 /** Sets the vertical position of the CC data. Usually 21 */
2319 # define TV_CC_LINE_MASK 0x0000003f
2320 # define TV_CC_LINE_SHIFT 0
2323 /** @defgroup TV_CC_DATA
2326 #define TV_CC_DATA 0x68094
2327 # define TV_CC_RDY (1 << 31)
2328 /** Second word of CC data to be transmitted. */
2329 # define TV_CC_DATA_2_MASK 0x007f0000
2330 # define TV_CC_DATA_2_SHIFT 16
2331 /** First word of CC data to be transmitted. */
2332 # define TV_CC_DATA_1_MASK 0x0000007f
2333 # define TV_CC_DATA_1_SHIFT 0
2338 #define TV_H_LUMA_0 0x68100
2339 #define TV_H_LUMA_59 0x681ec
2340 #define TV_H_CHROMA_0 0x68200
2341 #define TV_H_CHROMA_59 0x682ec
2342 #define TV_V_LUMA_0 0x68300
2343 #define TV_V_LUMA_42 0x683a8
2344 #define TV_V_CHROMA_0 0x68400
2345 #define TV_V_CHROMA_42 0x684a8
2348 #define PIPEA_DSL 0x70000
2350 #define PIPEACONF 0x70008
2351 #define PIPEACONF_ENABLE (1<<31)
2352 #define PIPEACONF_DISABLE 0
2353 #define PIPEACONF_DOUBLE_WIDE (1<<30)
2354 #define I965_PIPECONF_ACTIVE (1<<30)
2355 #define PIPEACONF_SINGLE_WIDE 0
2356 #define PIPEACONF_PIPE_UNLOCKED 0
2357 #define PIPEACONF_PIPE_LOCKED (1<<25)
2358 #define PIPEACONF_PALETTE 0
2359 #define PIPEACONF_GAMMA (1<<24)
2360 #define PIPECONF_FORCE_BORDER (1<<25)
2361 #define PIPECONF_PROGRESSIVE (0 << 21)
2362 #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
2363 #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
2364 /* ironlake: gamma */
2365 #define PIPECONF_PALETTE_8BIT (0<<24)
2366 #define PIPECONF_PALETTE_10BIT (1<<24)
2367 #define PIPECONF_PALETTE_12BIT (2<<24)
2368 #define PIPECONF_FORCE_BORDER (1<<25)
2369 #define PIPECONF_PROGRESSIVE (0 << 21)
2370 #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
2371 #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
2373 #define PIPECONF_MSA_TIMING_DELAY (0<<18) /* for eDP */
2374 #define PIPECONF_NO_DYNAMIC_RATE_CHANGE (0 << 16)
2375 #define PIPECONF_NO_ROTATION (0<<14)
2376 #define PIPECONF_FULL_COLOR_RANGE (0<<13)
2377 #define PIPECONF_CE_COLOR_RANGE (1<<13)
2378 #define PIPECONF_COLOR_SPACE_RGB (0<<11)
2379 #define PIPECONF_COLOR_SPACE_YUV601 (1<<11)
2380 #define PIPECONF_COLOR_SPACE_YUV709 (2<<11)
2381 #define PIPECONF_CONNECT_DEFAULT (0<<9)
2382 #define PIPECONF_8BPP (0<<5)
2383 #define PIPECONF_10BPP (1<<5)
2384 #define PIPECONF_6BPP (2<<5)
2385 #define PIPECONF_12BPP (3<<5)
2386 #define PIPECONF_ENABLE_DITHER (1<<4)
2387 #define PIPECONF_DITHER_SPATIAL (0<<2)
2388 #define PIPECONF_DITHER_ST1 (1<<2)
2389 #define PIPECONF_DITHER_ST2 (2<<2)
2390 #define PIPECONF_DITHER_TEMPORAL (3<<2)
2392 #define PIPEAGCMAXRED 0x70010
2393 #define PIPEAGCMAXGREEN 0x70014
2394 #define PIPEAGCMAXBLUE 0x70018
2395 #define PIPEASTAT 0x70024
2396 # define FIFO_UNDERRUN (1 << 31)
2397 # define CRC_ERROR_ENABLE (1 << 29)
2398 # define CRC_DONE_ENABLE (1 << 28)
2399 # define GMBUS_EVENT_ENABLE (1 << 27)
2400 # define VSYNC_INT_ENABLE (1 << 25)
2401 # define DLINE_COMPARE_ENABLE (1 << 24)
2402 # define DPST_EVENT_ENABLE (1 << 23)
2403 # define LBLC_EVENT_ENABLE (1 << 22)
2404 # define OFIELD_INT_ENABLE (1 << 21)
2405 # define EFIELD_INT_ENABLE (1 << 20)
2406 # define SVBLANK_INT_ENABLE (1 << 18)
2407 # define VBLANK_INT_ENABLE (1 << 17)
2408 # define OREG_UPDATE_ENABLE (1 << 16)
2409 # define CRC_ERROR_INT_STATUS (1 << 13)
2410 # define CRC_DONE_INT_STATUS (1 << 12)
2411 # define GMBUS_INT_STATUS (1 << 11)
2412 # define VSYNC_INT_STATUS (1 << 9)
2413 # define DLINE_COMPARE_STATUS (1 << 8)
2414 # define DPST_EVENT_STATUS (1 << 7)
2415 # define LBLC_EVENT_STATUS (1 << 6)
2416 # define OFIELD_INT_STATUS (1 << 5)
2417 # define EFIELD_INT_STATUS (1 << 4)
2418 # define SVBLANK_INT_STATUS (1 << 2)
2419 # define VBLANK_INT_STATUS (1 << 1)
2420 # define OREG_UPDATE_STATUS (1 << 0)
2423 #define DSPARB 0x70030
2424 #define DSPARB_CSTART_SHIFT 7
2425 #define DSPARB_BSTART_SHIFT 0
2426 #define DSPARB_BEND_SHIFT 9 /* on 855 */
2427 #define DSPARB_AEND_SHIFT 0
2428 #define DSPFW1 0x70034
2429 #define DSPFW2 0x70038
2430 #define DSPFW3 0x7003c
2432 * The two pipe frame counter registers are not synchronized, so
2433 * reading a stable value is somewhat tricky. The following code
2437 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT;
2438 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> PIPE_FRAME_LOW_SHIFT);
2439 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT);
2440 * } while (high1 != high2);
2441 * frame = (high1 << 8) | low1;
2443 #define PIPEAFRAMEHIGH 0x70040
2444 #define PIPE_FRAME_HIGH_MASK 0x0000ffff
2445 #define PIPE_FRAME_HIGH_SHIFT 0
2446 #define PIPEAFRAMEPIXEL 0x70044
2447 #define PIPE_FRAME_LOW_MASK 0xff000000
2448 #define PIPE_FRAME_LOW_SHIFT 24
2450 * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register
2451 * and is 24 bits wide.
2453 #define PIPE_PIXEL_MASK 0x00ffffff
2454 #define PIPE_PIXEL_SHIFT 0
2457 * Computing GMCH M and N values.
2459 * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
2461 * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
2463 * The GMCH value is used internally
2465 #define PIPEA_GMCH_DATA_M 0x70050
2467 /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
2468 #define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
2469 #define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
2471 #define PIPE_GMCH_DATA_M_MASK (0xffffff)
2473 #define PIPEA_GMCH_DATA_N 0x70054
2474 #define PIPE_GMCH_DATA_N_MASK (0xffffff)
2477 * Computing Link M and N values.
2479 * Link M / N = pixel_clock / ls_clk
2481 * (the DP spec calls pixel_clock the 'strm_clk')
2483 * The Link value is transmitted in the Main Stream
2484 * Attributes and VB-ID.
2487 #define PIPEA_DP_LINK_M 0x70060
2488 #define PIPEA_DP_LINK_M_MASK (0xffffff)
2490 #define PIPEA_DP_LINK_N 0x70064
2491 #define PIPEA_DP_LINK_N_MASK (0xffffff)
2493 #define PIPEB_DSL 0x71000
2495 #define PIPEBCONF 0x71008
2496 #define PIPEBCONF_ENABLE (1<<31)
2497 #define PIPEBCONF_DISABLE 0
2498 #define PIPEBCONF_DOUBLE_WIDE (1<<30)
2499 #define PIPEBCONF_DISABLE 0
2500 #define PIPEBCONF_GAMMA (1<<24)
2501 #define PIPEBCONF_PALETTE 0
2503 #define PIPEBGCMAXRED 0x71010
2504 #define PIPEBGCMAXGREEN 0x71014
2505 #define PIPEBGCMAXBLUE 0x71018
2506 #define PIPEBSTAT 0x71024
2507 #define PIPEBFRAMEHIGH 0x71040
2508 #define PIPEBFRAMEPIXEL 0x71044
2510 #define PIPEB_GMCH_DATA_M 0x71050
2511 #define PIPEB_GMCH_DATA_N 0x71054
2512 #define PIPEB_DP_LINK_M 0x71060
2513 #define PIPEB_DP_LINK_N 0x71064
2515 #define DSPACNTR 0x70180
2516 #define DSPBCNTR 0x71180
2517 #define DISPLAY_PLANE_ENABLE (1<<31)
2518 #define DISPLAY_PLANE_DISABLE 0
2519 #define DISPLAY_PLANE_TILED (1<<10)
2520 #define DISPPLANE_GAMMA_ENABLE (1<<30)
2521 #define DISPPLANE_GAMMA_DISABLE 0
2522 #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
2523 #define DISPPLANE_8BPP (0x2<<26)
2524 #define DISPPLANE_15_16BPP (0x4<<26)
2525 #define DISPPLANE_16BPP (0x5<<26)
2526 #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
2527 #define DISPPLANE_32BPP (0x7<<26)
2528 #define DISPPLANE_STEREO_ENABLE (1<<25)
2529 #define DISPPLANE_STEREO_DISABLE 0
2530 #define DISPPLANE_SEL_PIPE_MASK (1<<24)
2531 #define DISPPLANE_SEL_PIPE_A 0
2532 #define DISPPLANE_SEL_PIPE_B (1<<24)
2533 #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
2534 #define DISPPLANE_SRC_KEY_DISABLE 0
2535 #define DISPPLANE_LINE_DOUBLE (1<<20)
2536 #define DISPPLANE_NO_LINE_DOUBLE 0
2537 #define DISPPLANE_STEREO_POLARITY_FIRST 0
2538 #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
2540 #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
2541 #define DISPPLANE_ALPHA_TRANS_DISABLE 0
2542 #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
2543 #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
2545 #define DSPABASE 0x70184
2546 #define DSPASTRIDE 0x70188
2548 #define DSPBBASE 0x71184
2549 #define DSPBADDR DSPBBASE
2550 #define DSPBSTRIDE 0x71188
2552 #define DSPAKEYVAL 0x70194
2553 #define DSPAKEYMASK 0x70198
2555 #define DSPAPOS 0x7018C /* reserved */
2556 #define DSPASIZE 0x70190
2557 #define DSPBPOS 0x7118C
2558 #define DSPBSIZE 0x71190
2560 #define DSPASURF 0x7019C
2561 #define DSPATILEOFF 0x701A4
2563 #define DSPBSURF 0x7119C
2564 #define DSPBTILEOFF 0x711A4
2566 #define VGACNTRL 0x71400
2567 # define VGA_DISP_DISABLE (1 << 31)
2568 # define VGA_2X_MODE (1 << 30)
2569 # define VGA_PIPE_B_SELECT (1 << 29)
2571 /* Various masks for reserved bits, etc. */
2572 #define I830_FWATER1_MASK (~((1<<11)|(1<<10)|(1<<9)| \
2573 (1<<8)|(1<<26)|(1<<25)|(1<<24)|(1<<5)|(1<<4)|(1<<3)| \
2574 (1<<2)|(1<<1)|1|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)))
2575 #define I830_FWATER2_MASK ~(0)
2577 #define DV0A_RESERVED ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1)
2578 #define DV0B_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1)
2579 #define VGA0_N_DIVISOR_MASK ((1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2580 #define VGA0_M1_DIVISOR_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
2581 #define VGA0_M2_DIVISOR_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2582 #define VGA0_M1M2N_RESERVED ~(VGA0_N_DIVISOR_MASK|VGA0_M1_DIVISOR_MASK|VGA0_M2_DIVISOR_MASK)
2583 #define VGA0_POSTDIV_MASK ((1<<7)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2584 #define VGA1_POSTDIV_MASK ((1<<15)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
2585 #define VGA_POSTDIV_RESERVED ~(VGA0_POSTDIV_MASK|VGA1_POSTDIV_MASK|(1<<7)|(1<<15))
2586 #define DPLLA_POSTDIV_MASK ((1<<23)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2587 #define DPLLA_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<22)|(1<<15)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2588 #define ADPA_RESERVED ((1<<2)|(1<<1)|1|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2589 #define SUPER_WORD 32
2590 #define BURST_A_MASK ((1<<11)|(1<<10)|(1<<9)|(1<<8))
2591 #define BURST_B_MASK ((1<<26)|(1<<25)|(1<<24))
2592 #define WATER_A_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2593 #define WATER_B_MASK ((1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2594 #define WATER_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<7)|(1<<6))
2595 #define PIPEACONF_RESERVED ((1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff)
2596 #define PIPEBCONF_RESERVED ((1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff)
2597 #define DSPACNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0xffff)
2598 #define DSPBCNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0x7ffe)
2600 #define I830_GMCH_CTRL 0x52
2602 #define I830_GMCH_ENABLED 0x4
2603 #define I830_GMCH_MEM_MASK 0x1
2604 #define I830_GMCH_MEM_64M 0x1
2605 #define I830_GMCH_MEM_128M 0
2607 #define I830_GMCH_GMS_MASK 0x70
2608 #define I830_GMCH_GMS_DISABLED 0x00
2609 #define I830_GMCH_GMS_LOCAL 0x10
2610 #define I830_GMCH_GMS_STOLEN_512 0x20
2611 #define I830_GMCH_GMS_STOLEN_1024 0x30
2612 #define I830_GMCH_GMS_STOLEN_8192 0x40
2614 #define I830_RDRAM_CHANNEL_TYPE 0x03010
2615 #define I830_RDRAM_ND(x) (((x) & 0x20) >> 5)
2616 #define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3)
2618 #define I855_GMCH_GMS_MASK (0xF << 4)
2619 #define I855_GMCH_GMS_DISABLED 0x00
2620 #define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
2621 #define I855_GMCH_GMS_STOLEN_4M (0x2 << 4)
2622 #define I855_GMCH_GMS_STOLEN_8M (0x3 << 4)
2623 #define I855_GMCH_GMS_STOLEN_16M (0x4 << 4)
2624 #define I855_GMCH_GMS_STOLEN_32M (0x5 << 4)
2625 #define I915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
2626 #define I915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
2627 #define G33_GMCH_GMS_STOLEN_128M (0x8 << 4)
2628 #define G33_GMCH_GMS_STOLEN_256M (0x9 << 4)
2629 #define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4)
2630 #define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4)
2631 #define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
2632 #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
2635 #define I85X_CAPID 0x44
2636 #define I85X_VARIANT_MASK 0x7
2637 #define I85X_VARIANT_SHIFT 5
2638 #define I855_GME 0x0
2640 #define I852_GME 0x2
2643 #define I915_GCFGC 0xf0
2644 #define I915_LOW_FREQUENCY_ENABLE (1 << 7)
2645 #define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
2646 #define I915_DISPLAY_CLOCK_333_MHZ (4 << 4)
2647 #define I915_DISPLAY_CLOCK_MASK (7 << 4)
2649 #define I855_HPLLCC 0xc0
2650 #define I855_CLOCK_CONTROL_MASK (3 << 0)
2651 #define I855_CLOCK_133_200 (0 << 0)
2652 #define I855_CLOCK_100_200 (1 << 0)
2653 #define I855_CLOCK_100_133 (2 << 0)
2654 #define I855_CLOCK_166_250 (3 << 0)
2657 #define COLOR_BLT_CMD ((2<<29)|(0x40<<22)|(0x3))
2658 #define COLOR_BLT_WRITE_ALPHA (1<<21)
2659 #define COLOR_BLT_WRITE_RGB (1<<20)
2661 #define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|(0x4))
2662 #define XY_COLOR_BLT_WRITE_ALPHA (1<<21)
2663 #define XY_COLOR_BLT_WRITE_RGB (1<<20)
2664 #define XY_COLOR_BLT_TILED (1<<11)
2666 #define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1)
2668 #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
2669 #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
2670 #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
2671 #define XY_SRC_COPY_BLT_SRC_TILED (1<<15)
2672 #define XY_SRC_COPY_BLT_DST_TILED (1<<11)
2674 #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|0x4)
2675 #define SRC_COPY_BLT_WRITE_ALPHA (1<<21)
2676 #define SRC_COPY_BLT_WRITE_RGB (1<<20)
2678 #define XY_PAT_BLT_IMMEDIATE ((2<<29)|(0x72<<22))
2680 #define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22)|0x7)
2681 #define XY_MONO_PAT_VERT_SEED ((1<<10)|(1<<9)|(1<<8))
2682 #define XY_MONO_PAT_HORT_SEED ((1<<14)|(1<<13)|(1<<12))
2683 #define XY_MONO_PAT_BLT_WRITE_ALPHA (1<<21)
2684 #define XY_MONO_PAT_BLT_WRITE_RGB (1<<20)
2686 #define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22)|(0x6))
2687 #define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21)
2688 #define XY_MONO_SRC_BLT_WRITE_RGB (1<<20)
2690 #define STATE3D_FOG_MODE ((3<<29)|(0x1d<<24)|(0x89<<16)|2)
2691 #define FOG_MODE_VERTEX (1<<31)
2693 #define DISABLE_TEX_TRANSFORM (1<<28)
2694 #define TEXTURE_SET(x) (x<<29)
2696 #define STATE3D_VERTEX_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8b<<16))
2697 #define DISABLE_VIEWPORT_TRANSFORM (1<<31)
2698 #define DISABLE_PERSPECTIVE_DIVIDE (1<<29)
2700 #define MI_STORE_DWORD_IMM ((0x20<<23)|2)
2701 #define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */
2703 #define MI_SET_CONTEXT (0x18<<23)
2704 #define CTXT_NO_RESTORE (1)
2705 #define CTXT_PALETTE_SAVE_DISABLE (1<<3)
2706 #define CTXT_PALETTE_RESTORE_DISABLE (1<<2)
2709 #define MI_VERTEX_BUFFER (0x17<<23)
2710 #define MI_VERTEX_BUFFER_IDX(x) (x<<20)
2711 #define MI_VERTEX_BUFFER_PITCH(x) (x<<13)
2712 #define MI_VERTEX_BUFFER_WIDTH(x) (x<<6)
2714 #define MI_VERTEX_BUFFER_DISABLE (1)
2717 #define MI_OVERLAY_FLIP (0x11<<23)
2718 #define MI_OVERLAY_FLIP_CONTINUE (0<<21)
2719 #define MI_OVERLAY_FLIP_ON (1<<21)
2720 #define MI_OVERLAY_FLIP_OFF (2<<21)
2722 /* Wait for Events */
2723 #define MI_WAIT_FOR_EVENT (0x03<<23)
2724 #define MI_WAIT_FOR_PIPEB_SVBLANK (1<<18)
2725 #define MI_WAIT_FOR_PIPEA_SVBLANK (1<<17)
2726 #define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
2727 #define MI_WAIT_FOR_PIPEB_VBLANK (1<<7)
2728 #define MI_WAIT_FOR_PIPEA_VBLANK (1<<3)
2729 #define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW (1<<5)
2730 #define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW (1<<1)
2732 #define MI_LOAD_SCAN_LINES_INCL (0x12<<23)
2735 #define MI_FLUSH (0x04<<23)
2736 #define MI_WRITE_DIRTY_STATE (1<<4)
2737 #define MI_END_SCENE (1<<3)
2738 #define MI_GLOBAL_SNAPSHOT_COUNT_RESET (1<<3)
2739 #define MI_INHIBIT_RENDER_CACHE_FLUSH (1<<2)
2740 #define MI_STATE_INSTRUCTION_CACHE_FLUSH (1<<1)
2741 #define MI_INVALIDATE_MAP_CACHE (1<<0)
2742 /* broadwater flush bits */
2743 #define BRW_MI_GLOBAL_SNAPSHOT_RESET (1 << 3)
2746 #define MI_NOOP 0x00
2747 #define MI_NOOP_WRITE_ID (1<<22)
2748 #define MI_NOOP_ID_MASK (1<<22 - 1)
2750 #define STATE3D_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x01<<16))
2753 #define MI_BATCH_BUFFER ((0x30 << 23) | 1)
2754 #define MI_BATCH_BUFFER_START (0x31 << 23)
2755 #define MI_BATCH_BUFFER_END (0xA << 23)
2756 #define MI_BATCH_NON_SECURE (1)
2757 #define MI_BATCH_NON_SECURE_I965 (1 << 8)
2759 /* STATE3D_FOG_MODE stuff */
2760 #define ENABLE_FOG_SOURCE (1<<27)
2761 #define ENABLE_FOG_CONST (1<<24)
2762 #define ENABLE_FOG_DENSITY (1<<23)
2765 * New regs for broadwater -- we need to split this file up sensibly somehow.
2767 #define BRW_3D(Pipeline,Opcode,Subopcode) ((3 << 29) | \
2768 ((Pipeline) << 27) | \
2769 ((Opcode) << 24) | \
2770 ((Subopcode) << 16))
2772 #define BRW_URB_FENCE BRW_3D(0, 0, 0)
2773 #define BRW_CS_URB_STATE BRW_3D(0, 0, 1)
2774 #define BRW_CONSTANT_BUFFER BRW_3D(0, 0, 2)
2775 #define BRW_STATE_PREFETCH BRW_3D(0, 0, 3)
2777 #define BRW_STATE_BASE_ADDRESS BRW_3D(0, 1, 1)
2778 #define BRW_STATE_SIP BRW_3D(0, 1, 2)
2779 #define BRW_PIPELINE_SELECT BRW_3D(0, 1, 4)
2781 #define NEW_PIPELINE_SELECT BRW_3D(1, 1, 4)
2783 #define BRW_MEDIA_STATE_POINTERS BRW_3D(2, 0, 0)
2784 #define BRW_MEDIA_OBJECT BRW_3D(2, 1, 0)
2786 #define BRW_3DSTATE_PIPELINED_POINTERS BRW_3D(3, 0, 0)
2787 #define BRW_3DSTATE_BINDING_TABLE_POINTERS BRW_3D(3, 0, 1)
2788 #define BRW_3DSTATE_VERTEX_BUFFERS BRW_3D(3, 0, 8)
2789 #define BRW_3DSTATE_VERTEX_ELEMENTS BRW_3D(3, 0, 9)
2790 #define BRW_3DSTATE_INDEX_BUFFER BRW_3D(3, 0, 0xa)
2791 #define BRW_3DSTATE_VF_STATISTICS BRW_3D(3, 0, 0xb)
2793 #define BRW_3DSTATE_DRAWING_RECTANGLE BRW_3D(3, 1, 0)
2794 #define BRW_3DSTATE_CONSTANT_COLOR BRW_3D(3, 1, 1)
2795 #define BRW_3DSTATE_SAMPLER_PALETTE_LOAD BRW_3D(3, 1, 2)
2796 #define BRW_3DSTATE_CHROMA_KEY BRW_3D(3, 1, 4)
2797 #define BRW_3DSTATE_DEPTH_BUFFER BRW_3D(3, 1, 5)
2798 #define BRW_3DSTATE_POLY_STIPPLE_OFFSET BRW_3D(3, 1, 6)
2799 #define BRW_3DSTATE_POLY_STIPPLE_PATTERN BRW_3D(3, 1, 7)
2800 #define BRW_3DSTATE_LINE_STIPPLE BRW_3D(3, 1, 8)
2801 #define BRW_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP BRW_3D(3, 1, 9)
2802 /* These two are BLC and CTG only, not BW or CL */
2803 #define BRW_3DSTATE_AA_LINE_PARAMS BRW_3D(3, 1, 0xa)
2804 #define BRW_3DSTATE_GS_SVB_INDEX BRW_3D(3, 1, 0xb)
2806 #define BRW_PIPE_CONTROL BRW_3D(3, 2, 0)
2808 #define BRW_3DPRIMITIVE BRW_3D(3, 3, 0)
2810 #define PIPELINE_SELECT_3D 0
2811 #define PIPELINE_SELECT_MEDIA 1
2813 #define UF0_CS_REALLOC (1 << 13)
2814 #define UF0_VFE_REALLOC (1 << 12)
2815 #define UF0_SF_REALLOC (1 << 11)
2816 #define UF0_CLIP_REALLOC (1 << 10)
2817 #define UF0_GS_REALLOC (1 << 9)
2818 #define UF0_VS_REALLOC (1 << 8)
2819 #define UF1_CLIP_FENCE_SHIFT 20
2820 #define UF1_GS_FENCE_SHIFT 10
2821 #define UF1_VS_FENCE_SHIFT 0
2822 #define UF2_CS_FENCE_SHIFT 20
2823 #define UF2_VFE_FENCE_SHIFT 10
2824 #define UF2_SF_FENCE_SHIFT 0
2826 /* for BRW_STATE_BASE_ADDRESS */
2827 #define BASE_ADDRESS_MODIFY (1 << 0)
2829 /* for BRW_3DSTATE_PIPELINED_POINTERS */
2830 #define BRW_GS_DISABLE 0
2831 #define BRW_GS_ENABLE 1
2832 #define BRW_CLIP_DISABLE 0
2833 #define BRW_CLIP_ENABLE 1
2835 /* for BRW_PIPE_CONTROL */
2836 #define BRW_PIPE_CONTROL_NOWRITE (0 << 14)
2837 #define BRW_PIPE_CONTROL_WRITE_QWORD (1 << 14)
2838 #define BRW_PIPE_CONTROL_WRITE_DEPTH (2 << 14)
2839 #define BRW_PIPE_CONTROL_WRITE_TIME (3 << 14)
2840 #define BRW_PIPE_CONTROL_DEPTH_STALL (1 << 13)
2841 #define BRW_PIPE_CONTROL_WC_FLUSH (1 << 12)
2842 #define BRW_PIPE_CONTROL_IS_FLUSH (1 << 11)
2843 #define BRW_PIPE_CONTROL_NOTIFY_ENABLE (1 << 8)
2844 #define BRW_PIPE_CONTROL_GLOBAL_GTT (1 << 2)
2845 #define BRW_PIPE_CONTROL_LOCAL_PGTT (0 << 2)
2847 /* VERTEX_BUFFER_STATE Structure */
2848 #define VB0_BUFFER_INDEX_SHIFT 27
2849 #define VB0_VERTEXDATA (0 << 26)
2850 #define VB0_INSTANCEDATA (1 << 26)
2851 #define VB0_BUFFER_PITCH_SHIFT 0
2853 /* VERTEX_ELEMENT_STATE Structure */
2854 #define VE0_VERTEX_BUFFER_INDEX_SHIFT 27
2855 #define VE0_VALID (1 << 26)
2856 #define VE0_FORMAT_SHIFT 16
2857 #define VE0_OFFSET_SHIFT 0
2858 #define VE1_VFCOMPONENT_0_SHIFT 28
2859 #define VE1_VFCOMPONENT_1_SHIFT 24
2860 #define VE1_VFCOMPONENT_2_SHIFT 20
2861 #define VE1_VFCOMPONENT_3_SHIFT 16
2862 #define VE1_DESTINATION_ELEMENT_OFFSET_SHIFT 0
2864 /* 3DPRIMITIVE bits */
2865 #define BRW_3DPRIMITIVE_VERTEX_SEQUENTIAL (0 << 15)
2866 #define BRW_3DPRIMITIVE_VERTEX_RANDOM (1 << 15)
2867 /* Primitive types are in brw_defines.h */
2868 #define BRW_3DPRIMITIVE_TOPOLOGY_SHIFT 10
2870 #define BRW_SVG_CTL 0x7400
2872 #define BRW_SVG_CTL_GS_BA (0 << 8)
2873 #define BRW_SVG_CTL_SS_BA (1 << 8)
2874 #define BRW_SVG_CTL_IO_BA (2 << 8)
2875 #define BRW_SVG_CTL_GS_AUB (3 << 8)
2876 #define BRW_SVG_CTL_IO_AUB (4 << 8)
2877 #define BRW_SVG_CTL_SIP (5 << 8)
2879 #define BRW_SVG_RDATA 0x7404
2880 #define BRW_SVG_WORK_CTL 0x7408
2882 #define BRW_VF_CTL 0x7500
2884 #define BRW_VF_CTL_SNAPSHOT_COMPLETE (1 << 31)
2885 #define BRW_VF_CTL_SNAPSHOT_MUX_SELECT_THREADID (0 << 8)
2886 #define BRW_VF_CTL_SNAPSHOT_MUX_SELECT_VF_DEBUG (1 << 8)
2887 #define BRW_VF_CTL_SNAPSHOT_TYPE_VERTEX_SEQUENCE (0 << 4)
2888 #define BRW_VF_CTL_SNAPSHOT_TYPE_VERTEX_INDEX (1 << 4)
2889 #define BRW_VF_CTL_SKIP_INITIAL_PRIMITIVES (1 << 3)
2890 #define BRW_VF_CTL_MAX_PRIMITIVES_LIMIT_ENABLE (1 << 2)
2891 #define BRW_VF_CTL_VERTEX_RANGE_LIMIT_ENABLE (1 << 1)
2892 #define BRW_VF_CTL_SNAPSHOT_ENABLE (1 << 0)
2894 #define BRW_VF_STRG_VAL 0x7504
2895 #define BRW_VF_STR_VL_OVR 0x7508
2896 #define BRW_VF_VC_OVR 0x750c
2897 #define BRW_VF_STR_PSKIP 0x7510
2898 #define BRW_VF_MAX_PRIM 0x7514
2899 #define BRW_VF_RDATA 0x7518
2901 #define BRW_VS_CTL 0x7600
2902 #define BRW_VS_CTL_SNAPSHOT_COMPLETE (1 << 31)
2903 #define BRW_VS_CTL_SNAPSHOT_MUX_VERTEX_0 (0 << 8)
2904 #define BRW_VS_CTL_SNAPSHOT_MUX_VERTEX_1 (1 << 8)
2905 #define BRW_VS_CTL_SNAPSHOT_MUX_VALID_COUNT (2 << 8)
2906 #define BRW_VS_CTL_SNAPSHOT_MUX_VS_KERNEL_POINTER (3 << 8)
2907 #define BRW_VS_CTL_SNAPSHOT_ALL_THREADS (1 << 2)
2908 #define BRW_VS_CTL_THREAD_SNAPSHOT_ENABLE (1 << 1)
2909 #define BRW_VS_CTL_SNAPSHOT_ENABLE (1 << 0)
2911 #define BRW_VS_STRG_VAL 0x7604
2912 #define BRW_VS_RDATA 0x7608
2914 #define BRW_SF_CTL 0x7b00
2915 #define BRW_SF_CTL_SNAPSHOT_COMPLETE (1 << 31)
2916 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_0_FF_ID (0 << 8)
2917 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_0_REL_COUNT (1 << 8)
2918 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_1_FF_ID (2 << 8)
2919 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_1_REL_COUNT (3 << 8)
2920 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_2_FF_ID (4 << 8)
2921 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_2_REL_COUNT (5 << 8)
2922 #define BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_COUNT (6 << 8)
2923 #define BRW_SF_CTL_SNAPSHOT_MUX_SF_KERNEL_POINTER (7 << 8)
2924 #define BRW_SF_CTL_MIN_MAX_PRIMITIVE_RANGE_ENABLE (1 << 4)
2925 #define BRW_SF_CTL_DEBUG_CLIP_RECTANGLE_ENABLE (1 << 3)
2926 #define BRW_SF_CTL_SNAPSHOT_ALL_THREADS (1 << 2)
2927 #define BRW_SF_CTL_THREAD_SNAPSHOT_ENABLE (1 << 1)
2928 #define BRW_SF_CTL_SNAPSHOT_ENABLE (1 << 0)
2930 #define BRW_SF_STRG_VAL 0x7b04
2931 #define BRW_SF_RDATA 0x7b18
2933 #define BRW_WIZ_CTL 0x7c00
2934 #define BRW_WIZ_CTL_SNAPSHOT_COMPLETE (1 << 31)
2935 #define BRW_WIZ_CTL_SUBSPAN_INSTANCE_SHIFT 16
2936 #define BRW_WIZ_CTL_SNAPSHOT_MUX_WIZ_KERNEL_POINTER (0 << 8)
2937 #define BRW_WIZ_CTL_SNAPSHOT_MUX_SUBSPAN_INSTANCE (1 << 8)
2938 #define BRW_WIZ_CTL_SNAPSHOT_MUX_PRIMITIVE_SEQUENCE (2 << 8)
2939 #define BRW_WIZ_CTL_SINGLE_SUBSPAN_DISPATCH (1 << 6)
2940 #define BRW_WIZ_CTL_IGNORE_COLOR_SCOREBOARD_STALLS (1 << 5)
2941 #define BRW_WIZ_CTL_ENABLE_SUBSPAN_INSTANCE_COMPARE (1 << 4)
2942 #define BRW_WIZ_CTL_USE_UPSTREAM_SNAPSHOT_FLAG (1 << 3)
2943 #define BRW_WIZ_CTL_SNAPSHOT_ALL_THREADS (1 << 2)
2944 #define BRW_WIZ_CTL_THREAD_SNAPSHOT_ENABLE (1 << 1)
2945 #define BRW_WIZ_CTL_SNAPSHOT_ENABLE (1 << 0)
2947 #define BRW_WIZ_STRG_VAL 0x7c04
2948 #define BRW_WIZ_RDATA 0x7c18
2950 #define BRW_TS_CTL 0x7e00
2951 #define BRW_TS_CTL_SNAPSHOT_COMPLETE (1 << 31)
2952 #define BRW_TS_CTL_SNAPSHOT_MESSAGE_ERROR (0 << 8)
2953 #define BRW_TS_CTL_SNAPSHOT_INTERFACE_DESCRIPTOR (3 << 8)
2954 #define BRW_TS_CTL_SNAPSHOT_ALL_CHILD_THREADS (1 << 2)
2955 #define BRW_TS_CTL_SNAPSHOT_ALL_ROOT_THREADS (1 << 1)
2956 #define BRW_TS_CTL_SNAPSHOT_ENABLE (1 << 0)
2958 #define BRW_TS_STRG_VAL 0x7e04
2959 #define BRW_TS_RDATA 0x7e08
2961 #define BRW_TD_CTL 0x8000
2962 #define BRW_TD_CTL_MUX_SHIFT 8
2963 #define BRW_TD_CTL_EXTERNAL_HALT_R0_DEBUG_MATCH (1 << 7)
2964 #define BRW_TD_CTL_FORCE_EXTERNAL_HALT (1 << 6)
2965 #define BRW_TD_CTL_EXCEPTION_MASK_OVERRIDE (1 << 5)
2966 #define BRW_TD_CTL_FORCE_THREAD_BREAKPOINT_ENABLE (1 << 4)
2967 #define BRW_TD_CTL_BREAKPOINT_ENABLE (1 << 2)
2968 #define BRW_TD_CTL2 0x8004
2969 #define BRW_TD_CTL2_ILLEGAL_OPCODE_EXCEPTION_OVERRIDE (1 << 28)
2970 #define BRW_TD_CTL2_MASKSTACK_EXCEPTION_OVERRIDE (1 << 26)
2971 #define BRW_TD_CTL2_SOFTWARE_EXCEPTION_OVERRIDE (1 << 25)
2972 #define BRW_TD_CTL2_ACTIVE_THREAD_LIMIT_SHIFT 16
2973 #define BRW_TD_CTL2_ACTIVE_THREAD_LIMIT_ENABLE (1 << 8)
2974 #define BRW_TD_CTL2_THREAD_SPAWNER_EXECUTION_MASK_ENABLE (1 << 7)
2975 #define BRW_TD_CTL2_WIZ_EXECUTION_MASK_ENABLE (1 << 6)
2976 #define BRW_TD_CTL2_SF_EXECUTION_MASK_ENABLE (1 << 5)
2977 #define BRW_TD_CTL2_CLIPPER_EXECUTION_MASK_ENABLE (1 << 4)
2978 #define BRW_TD_CTL2_GS_EXECUTION_MASK_ENABLE (1 << 3)
2979 #define BRW_TD_CTL2_VS_EXECUTION_MASK_ENABLE (1 << 0)
2980 #define BRW_TD_VF_VS_EMSK 0x8008
2981 #define BRW_TD_GS_EMSK 0x800c
2982 #define BRW_TD_CLIP_EMSK 0x8010
2983 #define BRW_TD_SF_EMSK 0x8014
2984 #define BRW_TD_WIZ_EMSK 0x8018
2985 #define BRW_TD_0_6_EHTRG_VAL 0x801c
2986 #define BRW_TD_0_7_EHTRG_VAL 0x8020
2987 #define BRW_TD_0_6_EHTRG_MSK 0x8024
2988 #define BRW_TD_0_7_EHTRG_MSK 0x8028
2989 #define BRW_TD_RDATA 0x802c
2990 #define BRW_TD_TS_EMSK 0x8030
2992 #define BRW_EU_CTL 0x8800
2993 #define BRW_EU_CTL_SELECT_SHIFT 16
2994 #define BRW_EU_CTL_DATA_MUX_SHIFT 8
2995 #define BRW_EU_ATT_0 0x8810
2996 #define BRW_EU_ATT_1 0x8814
2997 #define BRW_EU_ATT_DATA_0 0x8820
2998 #define BRW_EU_ATT_DATA_1 0x8824
2999 #define BRW_EU_ATT_CLR_0 0x8830
3000 #define BRW_EU_ATT_CLR_1 0x8834
3001 #define BRW_EU_RDATA 0x8840
3003 /* End regs for broadwater */
3005 #define MAX_DISPLAY_PIPES 2
3019 /* What's connected to the pipes (as reported by the BIOS) */
3020 #define PIPE_ACTIVE_MASK 0xff
3021 #define PIPE_CRT_ACTIVE (1 << CrtIndex)
3022 #define PIPE_TV_ACTIVE (1 << TvIndex)
3023 #define PIPE_DFP_ACTIVE (1 << DfpIndex)
3024 #define PIPE_LCD_ACTIVE (1 << LfpIndex)
3025 #define PIPE_CRT2_ACTIVE (1 << Crt2Index)
3026 #define PIPE_TV2_ACTIVE (1 << Tv2Index)
3027 #define PIPE_DFP2_ACTIVE (1 << Dfp2Index)
3028 #define PIPE_LCD2_ACTIVE (1 << Lfp2Index)
3030 #define PIPE_SIZED_DISP_MASK (PIPE_DFP_ACTIVE | \
3034 #define PIPE_A_SHIFT 0
3035 #define PIPE_B_SHIFT 8
3036 #define PIPE_SHIFT(n) ((n) == 0 ? \
3037 PIPE_A_SHIFT : PIPE_B_SHIFT)
3040 * Some BIOS scratch area registers. The 845 (and 830?) store the amount
3041 * of video memory available to the BIOS in SWF1.
3044 #define SWF0 0x71410
3045 #define SWF1 0x71414
3046 #define SWF2 0x71418
3047 #define SWF3 0x7141c
3048 #define SWF4 0x71420
3049 #define SWF5 0x71424
3050 #define SWF6 0x71428
3053 * 855 scratch registers.
3055 #define SWF00 0x70410
3056 #define SWF01 0x70414
3057 #define SWF02 0x70418
3058 #define SWF03 0x7041c
3059 #define SWF04 0x70420
3060 #define SWF05 0x70424
3061 #define SWF06 0x70428
3071 #define SWF30 0x72414
3072 #define SWF31 0x72418
3073 #define SWF32 0x7241c
3076 * Overlay registers. These are overlay registers accessed via MMIO.
3077 * Those loaded via the overlay register page are defined in i830_video.c.
3079 #define OVADD 0x30000
3081 #define DOVSTA 0x30008
3082 #define OC_BUF (0x3<<20)
3084 #define OGAMC5 0x30010
3085 #define OGAMC4 0x30014
3086 #define OGAMC3 0x30018
3087 #define OGAMC2 0x3001c
3088 #define OGAMC1 0x30020
3089 #define OGAMC0 0x30024
3095 #define PALETTE_A 0x0a000
3096 #define PALETTE_B 0x0a800
3098 /* Framebuffer compression */
3099 #define FBC_CFB_BASE 0x03200 /* 4k page aligned */
3100 #define FBC_LL_BASE 0x03204 /* 4k page aligned */
3101 #define FBC_CONTROL 0x03208
3102 #define FBC_CTL_EN (1<<31)
3103 #define FBC_CTL_PERIODIC (1<<30)
3104 #define FBC_CTL_INTERVAL_SHIFT (16)
3105 #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
3106 #define FBC_CTL_STRIDE_SHIFT (5)
3107 #define FBC_CTL_FENCENO (1<<0)
3108 #define FBC_COMMAND 0x0320c
3109 #define FBC_CMD_COMPRESS (1<<0)
3110 #define FBC_STATUS 0x03210
3111 #define FBC_STAT_COMPRESSING (1<<31)
3112 #define FBC_STAT_COMPRESSED (1<<30)
3113 #define FBC_STAT_MODIFIED (1<<29)
3114 #define FBC_STAT_CURRENT_LINE (1<<0)
3115 #define FBC_CONTROL2 0x03214
3116 #define FBC_CTL_FENCE_DBL (0<<4)
3117 #define FBC_CTL_IDLE_IMM (0<<2)
3118 #define FBC_CTL_IDLE_FULL (1<<2)
3119 #define FBC_CTL_IDLE_LINE (2<<2)
3120 #define FBC_CTL_IDLE_DEBUG (3<<2)
3121 #define FBC_CTL_CPU_FENCE (1<<1)
3122 #define FBC_CTL_PLANEA (0<<0)
3123 #define FBC_CTL_PLANEB (1<<0)
3124 #define FBC_FENCE_OFF 0x0321b
3125 #define FBC_MOD_NUM 0x03220
3126 #define FBC_TAG_DEBUG 0x03300
3128 #define FBC_LL_SIZE (1536)
3129 #define FBC_LL_PAD (32)
3131 /* Framebuffer compression version 2 */
3132 #define DPFC_CB_BASE 0x3200
3133 #define DPFC_CONTROL 0x3208
3134 #define DPFC_CTL_EN (1<<31)
3135 #define DPFC_CTL_PLANEA (0<<30)
3136 #define DPFC_CTL_PLANEB (1<<30)
3137 #define DPFC_CTL_FENCE_EN (1<<29)
3138 #define DPFC_CTL_LIMIT_1X (0<<6)
3139 #define DPFC_CTL_LIMIT_2X (1<<6)
3140 #define DPFC_CTL_LIMIT_4X (2<<6)
3141 #define DPFC_RECOMP_CTL 0x320c
3142 #define DPFC_RECOMP_STALL_EN (1<<27)
3143 #define DPFC_RECOMP_STALL_WM_SHIFT (16)
3144 #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
3145 #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
3146 #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
3147 #define DPFC_STATUS 0x3210
3148 #define DPFC_INVAL_SEG_SHIFT (16)
3149 #define DPFC_INVAL_SEG_MASK (0x07ff0000)
3150 #define DPFC_COMP_SEG_SHIFT (0)
3151 #define DPFC_COMP_SEG_MASK (0x000003ff)
3152 #define DPFC_STATUS2 0x3214
3153 #define DPFC_FENCE_YOFF 0x3218
3155 #define PEG_BAND_GAP_DATA 0x14d68
3157 #define MCHBAR_RENDER_STANDBY 0x111B8
3158 #define RENDER_STANDBY_ENABLE (1 << 30)
3163 /* warmup time in us */
3164 #define WARMUP_PCH_REF_CLK_SSC_MOD 1
3165 #define WARMUP_PCH_FDI_RECEIVER_PLL 25
3166 #define WARMUP_PCH_DPLL 50
3167 #define WARMUP_CPU_DP_PLL 20
3168 #define WARMUP_CPU_FDI_TRANSMITTER_PLL 10
3169 #define WARMUP_DMI_LATENCY 20
3170 #define FDI_TRAIN_PATTERN_1_TIME 0.5
3171 #define FDI_TRAIN_PATTERN_2_TIME 1.5
3172 #define FDI_ONE_IDLE_PATTERN_TIME 31
3174 #define CPU_VGACNTRL 0x41000
3176 #define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030
3177 #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
3178 #define DIGITAL_PORTA_SHORT_PULSE_2MS (0 << 2)
3179 #define DIGITAL_PORTA_SHORT_PULSE_4_5MS (1 << 2)
3180 #define DIGITAL_PORTA_SHORT_PULSE_6MS (2 << 2)
3181 #define DIGITAL_PORTA_SHORT_PULSE_100MS (3 << 2)
3182 #define DIGITAL_PORTA_NO_DETECT (0 << 0)
3183 #define DIGITAL_PORTA_LONG_PULSE_DETECT_MASK (1 << 1)
3184 #define DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK (1 << 0)
3186 /* refresh rate hardware control */
3187 #define RR_HW_CTL 0x45300
3188 #define RR_HW_LOW_POWER_FRAMES_MASK 0xff
3189 #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
3191 #define FDI_PLL_BIOS_0 0x46000
3192 #define FDI_PLL_BIOS_1 0x46004
3193 #define FDI_PLL_BIOS_2 0x46008
3194 #define DISPLAY_PORT_PLL_BIOS_0 0x4600c
3195 #define DISPLAY_PORT_PLL_BIOS_1 0x46010
3196 #define DISPLAY_PORT_PLL_BIOS_2 0x46014
3198 #define FDI_PLL_FREQ_CTL 0x46030
3199 #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
3200 #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
3201 #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
3203 #define PIPEA_DATA_M1 0x60030
3204 #define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */
3205 #define TU_SIZE_MASK 0x7e000000
3206 #define PIPEA_DATA_M1_OFFSET 0
3207 #define PIPEA_DATA_N1 0x60034
3208 #define PIPEA_DATA_N1_OFFSET 0
3210 #define PIPEA_DATA_M2 0x60038
3211 #define PIPEA_DATA_M2_OFFSET 0
3212 #define PIPEA_DATA_N2 0x6003c
3213 #define PIPEA_DATA_N2_OFFSET 0
3215 #define PIPEA_LINK_M1 0x60040
3216 #define PIPEA_LINK_M1_OFFSET 0
3217 #define PIPEA_LINK_N1 0x60044
3218 #define PIPEA_LINK_N1_OFFSET 0
3220 #define PIPEA_LINK_M2 0x60048
3221 #define PIPEA_LINK_M2_OFFSET 0
3222 #define PIPEA_LINK_N2 0x6004c
3223 #define PIPEA_LINK_N2_OFFSET 0
3225 /* PIPEB timing regs are same start from 0x61000 */
3227 #define PIPEB_DATA_M1 0x61030
3228 #define PIPEB_DATA_M1_OFFSET 0
3229 #define PIPEB_DATA_N1 0x61034
3230 #define PIPEB_DATA_N1_OFFSET 0
3232 #define PIPEB_DATA_M2 0x61038
3233 #define PIPEB_DATA_M2_OFFSET 0
3234 #define PIPEB_DATA_N2 0x6103c
3235 #define PIPEB_DATA_N2_OFFSET 0
3237 #define PIPEB_LINK_M1 0x61040
3238 #define PIPEB_LINK_M1_OFFSET 0
3239 #define PIPEB_LINK_N1 0x61044
3240 #define PIPEB_LINK_N1_OFFSET 0
3242 #define PIPEB_LINK_M2 0x61048
3243 #define PIPEB_LINK_M2_OFFSET 0
3244 #define PIPEB_LINK_N2 0x6104c
3245 #define PIPEB_LINK_N2_OFFSET 0
3247 /* PIPECONF for pipe A/B addr is same */
3249 /* cusor A is only connected to pipe A,
3250 cursor B is connected to pipe B. Otherwise no change. */
3252 /* Plane A/B, DSPACNTR/DSPBCNTR addr not changed */
3254 /* CPU panel fitter */
3255 #define PFA_CTL_1 0x68080
3256 #define PFB_CTL_1 0x68880
3257 #define PF_ENABLE (1<<31)
3258 #define PFA_CTL_2 0x68084
3259 #define PFB_CTL_2 0x68884
3260 #define PFA_CTL_3 0x68088
3261 #define PFB_CTL_3 0x68888
3262 #define PFA_CTL_4 0x68090
3263 #define PFB_CTL_4 0x68890
3265 #define PFA_WIN_POS 0x68070
3266 #define PFB_WIN_POS 0x68870
3267 #define PFA_WIN_SIZE 0x68074
3268 #define PFB_WIN_SIZE 0x68874
3270 /* legacy palette */
3271 #define LGC_PALETTE_A 0x4a000
3272 #define LGC_PALETTE_B 0x4a800
3275 #define DE_MASTER_IRQ_CONTROL (1 << 31)
3276 #define DE_SPRITEB_FLIP_DONE (1 << 29)
3277 #define DE_SPRITEA_FLIP_DONE (1 << 28)
3278 #define DE_PLANEB_FLIP_DONE (1 << 27)
3279 #define DE_PLANEA_FLIP_DONE (1 << 26)
3280 #define DE_PCU_EVENT (1 << 25)
3281 #define DE_GTT_FAULT (1 << 24)
3282 #define DE_POISON (1 << 23)
3283 #define DE_PERFORM_COUNTER (1 << 22)
3284 #define DE_PCH_EVENT (1 << 21)
3285 #define DE_AUX_CHANNEL_A (1 << 20)
3286 #define DE_DP_A_HOTPLUG (1 << 19)
3287 #define DE_GSE (1 << 18)
3288 #define DE_PIPEB_VBLANK (1 << 15)
3289 #define DE_PIPEB_EVEN_FIELD (1 << 14)
3290 #define DE_PIPEB_ODD_FIELD (1 << 13)
3291 #define DE_PIPEB_LINE_COMPARE (1 << 12)
3292 #define DE_PIPEB_VSYNC (1 << 11)
3293 #define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
3294 #define DE_PIPEA_VBLANK (1 << 7)
3295 #define DE_PIPEA_EVEN_FIELD (1 << 6)
3296 #define DE_PIPEA_ODD_FIELD (1 << 5)
3297 #define DE_PIPEA_LINE_COMPARE (1 << 4)
3298 #define DE_PIPEA_VSYNC (1 << 3)
3299 #define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
3301 #define DEISR 0x44000
3302 #define DEIMR 0x44004
3303 #define DEIIR 0x44008
3304 #define DEIER 0x4400c
3307 #define GT_SYNC_STATUS (1 << 2)
3308 #define GT_USER_INTERRUPT (1 << 0)
3310 #define GTISR 0x44010
3311 #define GTIMR 0x44014
3312 #define GTIIR 0x44018
3313 #define GTIER 0x4401c
3317 /* south display engine interrupt */
3318 #define SDE_CRT_HOTPLUG (1 << 11)
3319 #define SDE_PORTD_HOTPLUG (1 << 10)
3320 #define SDE_PORTC_HOTPLUG (1 << 9)
3321 #define SDE_PORTB_HOTPLUG (1 << 8)
3322 #define SDE_SDVOB_HOTPLUG (1 << 6)
3324 #define SDEISR 0xc4000
3325 #define SDEIMR 0xc4004
3326 #define SDEIIR 0xc4008
3327 #define SDEIER 0xc400c
3329 /* digital port hotplug */
3330 #define PCH_PORT_HOTPLUG 0xc4030
3331 #define PORTD_HOTPLUG_ENABLE (1 << 20)
3332 #define PORTD_PULSE_DURATION_2ms (0)
3333 #define PORTD_PULSE_DURATION_4_5ms (1 << 18)
3334 #define PORTD_PULSE_DURATION_6ms (2 << 18)
3335 #define PORTD_PULSE_DURATION_100ms (3 << 18)
3336 #define PORTD_HOTPLUG_NO_DETECT (0)
3337 #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
3338 #define PORTD_HOTPLUG_LONG_DETECT (1 << 17)
3339 #define PORTC_HOTPLUG_ENABLE (1 << 12)
3340 #define PORTC_PULSE_DURATION_2ms (0)
3341 #define PORTC_PULSE_DURATION_4_5ms (1 << 10)
3342 #define PORTC_PULSE_DURATION_6ms (2 << 10)
3343 #define PORTC_PULSE_DURATION_100ms (3 << 10)
3344 #define PORTC_HOTPLUG_NO_DETECT (0)
3345 #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
3346 #define PORTC_HOTPLUG_LONG_DETECT (1 << 9)
3347 #define PORTB_HOTPLUG_ENABLE (1 << 4)
3348 #define PORTB_PULSE_DURATION_2ms (0)
3349 #define PORTB_PULSE_DURATION_4_5ms (1 << 2)
3350 #define PORTB_PULSE_DURATION_6ms (2 << 2)
3351 #define PORTB_PULSE_DURATION_100ms (3 << 2)
3352 #define PORTB_HOTPLUG_NO_DETECT (0)
3353 #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
3354 #define PORTB_HOTPLUG_LONG_DETECT (1 << 1)
3356 #define PCH_GPIOA 0xc5010
3357 #define PCH_GPIOB 0xc5014
3358 #define PCH_GPIOC 0xc5018
3359 #define PCH_GPIOD 0xc501c
3360 #define PCH_GPIOE 0xc5020
3361 #define PCH_GPIOF 0xc5024
3362 #define PCH_GMBUS0 0xc5100
3363 #define PCH_GMBUS1 0xc5104
3364 #define PCH_GMBUS2 0xc5108
3365 #define PCH_GMBUS3 0xc510c
3366 #define PCH_GMBUS4 0xc5110
3367 #define PCH_GMBUS5 0xc5120
3369 #define PCH_DPLL_A 0xc6014
3370 #define PCH_DPLL_B 0xc6018
3372 #define PCH_FPA0 0xc6040
3373 #define PCH_FPA1 0xc6044
3374 #define PCH_FPB0 0xc6048
3375 #define PCH_FPB1 0xc604c
3377 #define PCH_DPLL_TEST 0xc606c
3379 #define PCH_DREF_CONTROL 0xC6200
3380 #define DREF_CONTROL_MASK 0x7fc3
3381 #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
3382 #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
3383 #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13)
3384 #define DREF_SSC_SOURCE_DISABLE (0<<11)
3385 #define DREF_SSC_SOURCE_ENABLE (2<<11)
3386 #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
3387 #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
3388 #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
3389 #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
3390 #define DREF_SSC4_DOWNSPREAD (0<<6)
3391 #define DREF_SSC4_CENTERSPREAD (1<<6)
3392 #define DREF_SSC1_DISABLE (0<<1)
3393 #define DREF_SSC1_ENABLE (1<<1)
3394 #define DREF_SSC4_DISABLE (0)
3395 #define DREF_SSC4_ENABLE (1)
3397 #define PCH_RAWCLK_FREQ 0xc6204
3398 #define FDL_TP1_TIMER_SHIFT 12
3399 #define FDL_TP1_TIMER_MASK (3<<12)
3400 #define FDL_TP2_TIMER_SHIFT 10
3401 #define FDL_TP2_TIMER_MASK (3<<10)
3402 #define RAWCLK_FREQ_MASK 0x3ff
3404 #define PCH_DPLL_TMR_CFG 0xc6208
3406 #define PCH_SSC4_PARMS 0xc6210
3407 #define PCH_SSC4_AUX_PARMS 0xc6214
3410 #define PCH_DPLL_ANALOG_CTL 0xc6300
3412 #define PCH_DPLL_SEL 0xc7000
3413 #define TRANSA_DPLL_ENABLE (1<<3)
3414 #define TRANSA_DPLLA_SEL (0)
3415 #define TRANSA_DPLLB_SEL (1<<0)
3416 #define TRANSB_DPLL_ENABLE (1<<7)
3417 #define TRANSB_DPLLA_SEL (0<<4)
3418 #define TRANSB_DPLLB_SEL (1<<4)
3419 #define TRANSC_DPLL_ENABLE (1<<11)
3420 #define TRANSC_DPLLA_SEL (0<<8)
3421 #define TRANSC_DPLLB_SEL (1<<8)
3425 #define TRANS_HTOTAL_A 0xe0000
3426 #define TRANS_HTOTAL_SHIFT 16
3427 #define TRANS_HACTIVE_SHIFT 0
3428 #define TRANS_HBLANK_A 0xe0004
3429 #define TRANS_HBLANK_END_SHIFT 16
3430 #define TRANS_HBLANK_START_SHIFT 0
3431 #define TRANS_HSYNC_A 0xe0008
3432 #define TRANS_HSYNC_END_SHIFT 16
3433 #define TRANS_HSYNC_START_SHIFT 0
3434 #define TRANS_VTOTAL_A 0xe000c
3435 #define TRANS_VTOTAL_SHIFT 16
3436 #define TRANS_VACTIVE_SHIFT 0
3437 #define TRANS_VBLANK_A 0xe0010
3438 #define TRANS_VBLANK_END_SHIFT 16
3439 #define TRANS_VBLANK_START_SHIFT 0
3440 #define TRANS_VSYNC_A 0xe0014
3441 #define TRANS_VSYNC_END_SHIFT 16
3442 #define TRANS_VSYNC_START_SHIFT 0
3444 #define TRANSA_DATA_M1 0xe0030
3445 #define TRANSA_DATA_N1 0xe0034
3446 #define TRANSA_DATA_M2 0xe0038
3447 #define TRANSA_DATA_N2 0xe003c
3448 #define TRANSA_DP_LINK_M1 0xe0040
3449 #define TRANSA_DP_LINK_N1 0xe0044
3450 #define TRANSA_DP_LINK_M2 0xe0048
3451 #define TRANSA_DP_LINK_N2 0xe004c
3453 #define TRANS_HTOTAL_B 0xe1000
3454 #define TRANS_HBLANK_B 0xe1004
3455 #define TRANS_HSYNC_B 0xe1008
3456 #define TRANS_VTOTAL_B 0xe100c
3457 #define TRANS_VBLANK_B 0xe1010
3458 #define TRANS_VSYNC_B 0xe1014
3460 #define TRANSB_DATA_M1 0xe1030
3461 #define TRANSB_DATA_N1 0xe1034
3462 #define TRANSB_DATA_M2 0xe1038
3463 #define TRANSB_DATA_N2 0xe103c
3464 #define TRANSB_DP_LINK_M1 0xe1040
3465 #define TRANSB_DP_LINK_N1 0xe1044
3466 #define TRANSB_DP_LINK_M2 0xe1048
3467 #define TRANSB_DP_LINK_N2 0xe104c
3469 #define TRANS_HTOTAL_C 0xe2000
3470 #define TRANS_HBLANK_C 0xe2004
3471 #define TRANS_HSYNC_C 0xe2008
3472 #define TRANS_VTOTAL_C 0xe200c
3473 #define TRANS_VBLANK_C 0xe2010
3474 #define TRANS_VSYNC_C 0xe2014
3476 #define TRANSC_DATA_M1 0xe2030
3477 #define TRANSC_DATA_N1 0xe2034
3478 #define TRANSC_DATA_M2 0xe2038
3479 #define TRANSC_DATA_N2 0xe203c
3480 #define TRANSC_DP_LINK_M1 0xe2040
3481 #define TRANSC_DP_LINK_N1 0xe2044
3482 #define TRANSC_DP_LINK_M2 0xe2048
3483 #define TRANSC_DP_LINK_N2 0xe204c
3485 #define TRANSACONF 0xf0008
3486 #define TRANSBCONF 0xf1008
3487 #define TRANSCCONF 0xf2008
3488 #define TRANS_DISABLE (0<<31)
3489 #define TRANS_ENABLE (1<<31)
3490 #define TRANS_STATE_MASK (1<<30)
3491 #define TRANS_STATE_DISABLE (0<<30)
3492 #define TRANS_STATE_ENABLE (1<<30)
3493 #define TRANS_FSYNC_DELAY_HB1 (0<<27)
3494 #define TRANS_FSYNC_DELAY_HB2 (1<<27)
3495 #define TRANS_FSYNC_DELAY_HB3 (2<<27)
3496 #define TRANS_FSYNC_DELAY_HB4 (3<<27)
3497 #define TRANS_DP_AUDIO_ONLY (1<<26)
3498 #define TRANS_DP_VIDEO_AUDIO (0<<26)
3499 #define TRANS_PROGRESSIVE (0<<21)
3500 #define TRANS_8BPC (0<<5)
3501 #define TRANS_10BPC (1<<5)
3502 #define TRANS_6BPC (2<<5)
3503 #define TRANS_12BPC (3<<5)
3505 #define FDI_RXA_CHICKEN 0xc200c
3506 #define FDI_RXB_CHICKEN 0xc2010
3507 #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
3510 #define FDI_TXA_CTL 0x60100
3511 #define FDI_TXB_CTL 0x61100
3512 #define FDI_TX_DISABLE (0<<31)
3513 #define FDI_TX_ENABLE (1<<31)
3514 #define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
3515 #define FDI_LINK_TRAIN_PATTERN_2 (1<<28)
3516 #define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28)
3517 #define FDI_LINK_TRAIN_NONE (3<<28)
3518 #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25)
3519 #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25)
3520 #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25)
3521 #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25)
3522 #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)
3523 #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)
3524 #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22)
3525 #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22)
3526 /* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.
3527 SNB has different settings. */
3528 /* SNB A-stepping */
3529 #define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
3530 #define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
3531 #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
3532 #define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
3533 /* SNB B-stepping */
3534 #define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
3535 #define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
3536 #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
3537 #define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
3538 #define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f<<22)
3539 #define FDI_DP_PORT_WIDTH_X1 (0<<19)
3540 #define FDI_DP_PORT_WIDTH_X2 (1<<19)
3541 #define FDI_DP_PORT_WIDTH_X3 (2<<19)
3542 #define FDI_DP_PORT_WIDTH_X4 (3<<19)
3543 #define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18)
3544 /* Ironlake: hardwired to 1 */
3545 #define FDI_TX_PLL_ENABLE (1<<14)
3546 /* both Tx and Rx */
3547 #define FDI_SCRAMBLING_ENABLE (0<<7)
3548 #define FDI_SCRAMBLING_DISABLE (1<<7)
3550 /* FDI_RX, FDI_X is hard-wired to Transcoder_X */
3551 #define FDI_RXA_CTL 0xf000c
3552 #define FDI_RXB_CTL 0xf100c
3553 #define FDI_RXC_CTL 0xf200c
3554 #define FDI_RX_ENABLE (1<<31)
3555 #define FDI_RX_DISABLE (0<<31)
3556 /* train, dp width same as FDI_TX */
3557 #define FDI_DP_PORT_WIDTH_X8 (7<<19)
3558 #define FDI_8BPC (0<<16)
3559 #define FDI_10BPC (1<<16)
3560 #define FDI_6BPC (2<<16)
3561 #define FDI_12BPC (3<<16)
3562 #define FDI_LINK_REVERSE_OVERWRITE (1<<15)
3563 #define FDI_DMI_LINK_REVERSE_MASK (1<<14)
3564 #define FDI_RX_PLL_ENABLE (1<<13)
3565 #define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
3566 #define FDI_FE_ERR_CORRECT_ENABLE (1<<10)
3567 #define FDI_FS_ERR_REPORT_ENABLE (1<<9)
3568 #define FDI_FE_ERR_REPORT_ENABLE (1<<8)
3569 #define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6)
3570 #define FDI_SEL_RAWCLK (0<<4)
3571 #define FDI_SEL_PCDCLK (1<<4)
3573 #define FDI_AUTO_TRAINING (1<<10)
3574 #define FDI_LINK_TRAIN_PATTERN_1_CPT (0<<8)
3575 #define FDI_LINK_TRAIN_PATTERN_2_CPT (1<<8)
3576 #define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2<<8)
3577 #define FDI_LINK_TRAIN_NORMAL_CPT (3<<8)
3578 #define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3<<8)
3580 #define FDI_RXA_MISC 0xf0010
3581 #define FDI_RXB_MISC 0xf1010
3582 #define FDI_RXC_MISC 0xf2010
3583 #define FDI_RXA_TUSIZE1 0xf0030
3584 #define FDI_RXA_TUSIZE2 0xf0038
3585 #define FDI_RXB_TUSIZE1 0xf1030
3586 #define FDI_RXB_TUSIZE2 0xf1038
3587 #define FDI_RXC_TUSIZE1 0xf2030
3588 #define FDI_RXC_TUSIZE2 0xf2038
3590 /* FDI_RX interrupt register format */
3591 #define FDI_RX_INTER_LANE_ALIGN (1<<10)
3592 #define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */
3593 #define FDI_RX_BIT_LOCK (1<<8) /* train 1 */
3594 #define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7)
3595 #define FDI_RX_FS_CODE_ERR (1<<6)
3596 #define FDI_RX_FE_CODE_ERR (1<<5)
3597 #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4)
3598 #define FDI_RX_HDCP_LINK_FAIL (1<<3)
3599 #define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2)
3600 #define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
3601 #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
3603 #define FDI_RXA_IIR 0xf0014
3604 #define FDI_RXA_IMR 0xf0018
3605 #define FDI_RXB_IIR 0xf1014
3606 #define FDI_RXB_IMR 0xf1018
3608 #define FDI_PLL_CTL_1 0xfe000
3609 #define FDI_PLL_CTL_2 0xfe004
3612 #define PCH_ADPA 0xe1100
3613 #define ADPA_TRANS_SELECT_MASK (1<<30)
3614 #define ADPA_TRANS_A_SELECT 0
3615 #define ADPA_TRANS_B_SELECT (1<<30)
3617 #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
3618 #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24)
3619 #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24)
3620 #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24)
3621 #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24)
3622 #define ADPA_CRT_HOTPLUG_ENABLE (1<<23)
3623 #define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22)
3624 #define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22)
3625 #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21)
3626 #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21)
3627 #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20)
3628 #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20)
3629 #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18)
3630 #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18)
3631 #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18)
3632 #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18)
3633 #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17)
3634 #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17)
3635 #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
3636 /* polarity control not changed */
3639 #define HDMIB 0xe1140
3640 #define PORT_ENABLE (1 << 31)
3641 #define TRANSCODER_A (0)
3642 #define TRANSCODER_B (1 << 30)
3643 #define COLOR_FORMAT_8bpc (0)
3644 #define COLOR_FORMAT_12bpc (3 << 26)
3645 #define SDVOB_HOTPLUG_ENABLE (1 << 23)
3646 #define SDVO_ENCODING (0)
3647 #define TMDS_ENCODING (2 << 10)
3648 #define NULL_PACKET_VSYNC_ENABLE (1 << 9)
3649 #define SDVOB_BORDER_ENABLE (1 << 7)
3650 #define AUDIO_ENABLE (1 << 6)
3651 #define VSYNC_ACTIVE_HIGH (1 << 4)
3652 #define HSYNC_ACTIVE_HIGH (1 << 3)
3653 #define PORT_DETECTED (1 << 2)
3655 #define HDMIC 0xe1150
3656 #define HDMID 0xe1160
3657 #define PCH_LVDS 0xe1180
3659 #define BLC_PWM_CPU_CTL2 0x48250
3660 #define PWM_ENABLE (1 << 31)
3661 #define PWM_PIPE_A (0 << 29)
3662 #define PWM_PIPE_B (1 << 29)
3663 #define BLC_PWM_CPU_CTL 0x48254
3665 #define BLC_PWM_PCH_CTL1 0xc8250
3666 #define PWM_PCH_ENABLE (1 << 31)
3667 #define PWM_POLARITY_ACTIVE_LOW (1 << 29)
3668 #define PWM_POLARITY_ACTIVE_HIGH (0 << 29)
3669 #define PWM_POLARITY_ACTIVE_LOW2 (1 << 28)
3670 #define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
3672 #define BLC_PWM_PCH_CTL2 0xc8254
3674 #define PCH_PP_STATUS 0xc7200
3675 #define PCH_PP_CONTROL 0xc7204
3676 #define EDP_FORCE_VDD (1 << 3)
3677 #define EDP_BLC_ENABLE (1 << 2)
3678 #define PANEL_POWER_RESET (1 << 1)
3679 #define PANEL_POWER_OFF (0 << 0)
3680 #define PANEL_POWER_ON (1 << 0)
3681 #define PCH_PP_ON_DELAYS 0xc7208
3682 #define EDP_PANEL (1 << 30)
3683 #define PCH_PP_OFF_DELAYS 0xc720c
3684 #define PCH_PP_DIVISOR 0xc7210
3686 #define AUD_CONFIG 0x62000
3687 #define AUD_DEBUG 0x62010
3688 #define AUD_VID_DID 0x62020
3689 #define AUD_RID 0x62024
3690 #define AUD_SUBN_CNT 0x62028
3691 #define AUD_FUNC_GRP 0x62040
3692 #define AUD_SUBN_CNT2 0x62044
3693 #define AUD_GRP_CAP 0x62048
3694 #define AUD_PWRST 0x6204c
3695 #define AUD_SUPPWR 0x62050
3696 #define AUD_SID 0x62054
3697 #define AUD_OUT_CWCAP 0x62070
3698 #define AUD_OUT_PCMSIZE 0x62074
3699 #define AUD_OUT_STR 0x62078
3700 #define AUD_OUT_DIG_CNVT 0x6207c
3701 #define AUD_OUT_CH_STR 0x62080
3702 #define AUD_OUT_STR_DESC 0x62084
3703 #define AUD_PINW_CAP 0x620a0
3704 #define AUD_PIN_CAP 0x620a4
3705 #define AUD_PINW_CONNLNG 0x620a8
3706 #define AUD_PINW_CONNLST 0x620ac
3707 #define AUD_PINW_CNTR 0x620b0
3708 #define AUD_PINW_UNSOLRESP 0x620b8
3709 #define AUD_CNTL_ST 0x620b4
3710 #define AUD_PINW_CONFIG 0x620bc
3711 #define AUD_HDMIW_STATUS 0x620d4
3712 #define AUD_HDMIW_HDMIEDID 0x6210c
3713 #define AUD_HDMIW_INFOFR 0x62118
3714 #define AUD_CONV_CHCNT 0x62120
3715 #define AUD_CTS_ENABLE 0x62128
3717 #define VIDEO_DIP_CTL 0x61170
3718 #define VIDEO_DIP_DATA 0x61178
3721 #define TRANS_DP_CTL_A 0xe0300
3722 #define TRANS_DP_CTL_B 0xe1300
3723 #define TRANS_DP_CTL_C 0xe2300
3724 #define TRANS_DP_OUTPUT_ENABLE (1<<31)
3725 #define TRANS_DP_PORT_SEL_B (0<<29)
3726 #define TRANS_DP_PORT_SEL_C (1<<29)
3727 #define TRANS_DP_PORT_SEL_D (2<<29)
3728 #define TRANS_DP_PORT_SEL_MASK (3<<29)
3729 #define TRANS_DP_AUDIO_ONLY (1<<26)
3730 #define TRANS_DP_ENH_FRAMING (1<<18)
3731 #define TRANS_DP_8BPC (0<<9)
3732 #define TRANS_DP_10BPC (1<<9)
3733 #define TRANS_DP_6BPC (2<<9)
3734 #define TRANS_DP_12BPC (3<<9)
3735 #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
3736 #define TRANS_DP_VSYNC_ACTIVE_LOW 0
3737 #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
3738 #define TRANS_DP_HSYNC_ACTIVE_LOW 0
3741 #endif /* _I810_REG_H */