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