]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/gpu/drm/i915/i915_reg.h
drm/i915: wait for actual vblank, not just 20ms
[net-next-2.6.git] / drivers / gpu / drm / i915 / i915_reg.h
CommitLineData
585fb111
JB
1/* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
2 * All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef _I915_REG_H_
26#define _I915_REG_H_
27
585fb111
JB
28/*
29 * The Bridge device's PCI config space has information about the
30 * fb aperture size and the amount of pre-reserved memory.
31 */
32#define INTEL_GMCH_CTRL 0x52
28d52043 33#define INTEL_GMCH_VGA_DISABLE (1 << 1)
585fb111
JB
34#define INTEL_GMCH_ENABLED 0x4
35#define INTEL_GMCH_MEM_MASK 0x1
36#define INTEL_GMCH_MEM_64M 0x1
37#define INTEL_GMCH_MEM_128M 0
38
241fa85b 39#define INTEL_GMCH_GMS_MASK (0xf << 4)
585fb111
JB
40#define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
41#define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4)
42#define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4)
43#define INTEL_855_GMCH_GMS_STOLEN_8M (0x3 << 4)
44#define INTEL_855_GMCH_GMS_STOLEN_16M (0x4 << 4)
45#define INTEL_855_GMCH_GMS_STOLEN_32M (0x5 << 4)
46
47#define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
48#define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
241fa85b
EA
49#define INTEL_GMCH_GMS_STOLEN_128M (0x8 << 4)
50#define INTEL_GMCH_GMS_STOLEN_256M (0x9 << 4)
51#define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4)
52#define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4)
53#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
54#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
585fb111 55
14bc490b
ZW
56#define SNB_GMCH_CTRL 0x50
57#define SNB_GMCH_GMS_STOLEN_MASK 0xF8
58#define SNB_GMCH_GMS_STOLEN_32M (1 << 3)
59#define SNB_GMCH_GMS_STOLEN_64M (2 << 3)
60#define SNB_GMCH_GMS_STOLEN_96M (3 << 3)
61#define SNB_GMCH_GMS_STOLEN_128M (4 << 3)
62#define SNB_GMCH_GMS_STOLEN_160M (5 << 3)
63#define SNB_GMCH_GMS_STOLEN_192M (6 << 3)
64#define SNB_GMCH_GMS_STOLEN_224M (7 << 3)
65#define SNB_GMCH_GMS_STOLEN_256M (8 << 3)
66#define SNB_GMCH_GMS_STOLEN_288M (9 << 3)
67#define SNB_GMCH_GMS_STOLEN_320M (0xa << 3)
68#define SNB_GMCH_GMS_STOLEN_352M (0xb << 3)
69#define SNB_GMCH_GMS_STOLEN_384M (0xc << 3)
70#define SNB_GMCH_GMS_STOLEN_416M (0xd << 3)
71#define SNB_GMCH_GMS_STOLEN_448M (0xe << 3)
72#define SNB_GMCH_GMS_STOLEN_480M (0xf << 3)
73#define SNB_GMCH_GMS_STOLEN_512M (0x10 << 3)
74
585fb111
JB
75/* PCI config space */
76
77#define HPLLCC 0xc0 /* 855 only */
652c393a 78#define GC_CLOCK_CONTROL_MASK (0xf << 0)
585fb111
JB
79#define GC_CLOCK_133_200 (0 << 0)
80#define GC_CLOCK_100_200 (1 << 0)
81#define GC_CLOCK_100_133 (2 << 0)
82#define GC_CLOCK_166_250 (3 << 0)
f97108d1 83#define GCFGC2 0xda
585fb111
JB
84#define GCFGC 0xf0 /* 915+ only */
85#define GC_LOW_FREQUENCY_ENABLE (1 << 7)
86#define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
87#define GC_DISPLAY_CLOCK_333_MHZ (4 << 4)
88#define GC_DISPLAY_CLOCK_MASK (7 << 4)
652c393a
JB
89#define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
90#define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)
91#define GM45_GC_RENDER_CLOCK_320_MHZ (9 << 0)
92#define GM45_GC_RENDER_CLOCK_400_MHZ (0xb << 0)
93#define GM45_GC_RENDER_CLOCK_533_MHZ (0xc << 0)
94#define I965_GC_RENDER_CLOCK_MASK (0xf << 0)
95#define I965_GC_RENDER_CLOCK_267_MHZ (2 << 0)
96#define I965_GC_RENDER_CLOCK_333_MHZ (3 << 0)
97#define I965_GC_RENDER_CLOCK_444_MHZ (4 << 0)
98#define I965_GC_RENDER_CLOCK_533_MHZ (5 << 0)
99#define I945_GC_RENDER_CLOCK_MASK (7 << 0)
100#define I945_GC_RENDER_CLOCK_166_MHZ (0 << 0)
101#define I945_GC_RENDER_CLOCK_200_MHZ (1 << 0)
102#define I945_GC_RENDER_CLOCK_250_MHZ (3 << 0)
103#define I945_GC_RENDER_CLOCK_400_MHZ (5 << 0)
104#define I915_GC_RENDER_CLOCK_MASK (7 << 0)
105#define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
106#define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
107#define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
585fb111 108#define LBB 0xf4
11ed50ec
BG
109#define GDRST 0xc0
110#define GDRST_FULL (0<<2)
111#define GDRST_RENDER (1<<2)
112#define GDRST_MEDIA (3<<2)
585fb111
JB
113
114/* VGA stuff */
115
116#define VGA_ST01_MDA 0x3ba
117#define VGA_ST01_CGA 0x3da
118
119#define VGA_MSR_WRITE 0x3c2
120#define VGA_MSR_READ 0x3cc
121#define VGA_MSR_MEM_EN (1<<1)
122#define VGA_MSR_CGA_MODE (1<<0)
123
124#define VGA_SR_INDEX 0x3c4
125#define VGA_SR_DATA 0x3c5
126
127#define VGA_AR_INDEX 0x3c0
128#define VGA_AR_VID_EN (1<<5)
129#define VGA_AR_DATA_WRITE 0x3c0
130#define VGA_AR_DATA_READ 0x3c1
131
132#define VGA_GR_INDEX 0x3ce
133#define VGA_GR_DATA 0x3cf
134/* GR05 */
135#define VGA_GR_MEM_READ_MODE_SHIFT 3
136#define VGA_GR_MEM_READ_MODE_PLANE 1
137/* GR06 */
138#define VGA_GR_MEM_MODE_MASK 0xc
139#define VGA_GR_MEM_MODE_SHIFT 2
140#define VGA_GR_MEM_A0000_AFFFF 0
141#define VGA_GR_MEM_A0000_BFFFF 1
142#define VGA_GR_MEM_B0000_B7FFF 2
143#define VGA_GR_MEM_B0000_BFFFF 3
144
145#define VGA_DACMASK 0x3c6
146#define VGA_DACRX 0x3c7
147#define VGA_DACWX 0x3c8
148#define VGA_DACDATA 0x3c9
149
150#define VGA_CR_INDEX_MDA 0x3b4
151#define VGA_CR_DATA_MDA 0x3b5
152#define VGA_CR_INDEX_CGA 0x3d4
153#define VGA_CR_DATA_CGA 0x3d5
154
155/*
156 * Memory interface instructions used by the kernel
157 */
158#define MI_INSTR(opcode, flags) (((opcode) << 23) | (flags))
159
160#define MI_NOOP MI_INSTR(0, 0)
161#define MI_USER_INTERRUPT MI_INSTR(0x02, 0)
162#define MI_WAIT_FOR_EVENT MI_INSTR(0x03, 0)
02e792fb 163#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
585fb111
JB
164#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
165#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
166#define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
167#define MI_FLUSH MI_INSTR(0x04, 0)
168#define MI_READ_FLUSH (1 << 0)
169#define MI_EXE_FLUSH (1 << 1)
170#define MI_NO_WRITE_FLUSH (1 << 2)
171#define MI_SCENE_COUNT (1 << 3) /* just increment scene count */
172#define MI_END_SCENE (1 << 4) /* flush binner and incr scene count */
1cafd347 173#define MI_INVALIDATE_ISP (1 << 5) /* invalidate indirect state pointers */
585fb111
JB
174#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)
175#define MI_REPORT_HEAD MI_INSTR(0x07, 0)
02e792fb
DV
176#define MI_OVERLAY_FLIP MI_INSTR(0x11,0)
177#define MI_OVERLAY_CONTINUE (0x0<<21)
178#define MI_OVERLAY_ON (0x1<<21)
179#define MI_OVERLAY_OFF (0x2<<21)
585fb111 180#define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0)
6b95a207 181#define MI_DISPLAY_FLIP MI_INSTR(0x14, 2)
1afe3e9d 182#define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1)
6b95a207 183#define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20)
aa40d6bb
ZN
184#define MI_SET_CONTEXT MI_INSTR(0x18, 0)
185#define MI_MM_SPACE_GTT (1<<8)
186#define MI_MM_SPACE_PHYSICAL (0<<8)
187#define MI_SAVE_EXT_STATE_EN (1<<3)
188#define MI_RESTORE_EXT_STATE_EN (1<<2)
189#define MI_RESTORE_INHIBIT (1<<0)
585fb111
JB
190#define MI_STORE_DWORD_IMM MI_INSTR(0x20, 1)
191#define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */
192#define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
193#define MI_STORE_DWORD_INDEX_SHIFT 2
194#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 1)
195#define MI_BATCH_BUFFER MI_INSTR(0x30, 1)
196#define MI_BATCH_NON_SECURE (1)
197#define MI_BATCH_NON_SECURE_I965 (1<<8)
198#define MI_BATCH_BUFFER_START MI_INSTR(0x31, 0)
199
200/*
201 * 3D instructions used by the kernel
202 */
203#define GFX_INSTR(opcode, flags) ((0x3 << 29) | ((opcode) << 24) | (flags))
204
205#define GFX_OP_RASTER_RULES ((0x3<<29)|(0x7<<24))
206#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
207#define SC_UPDATE_SCISSOR (0x1<<1)
208#define SC_ENABLE_MASK (0x1<<0)
209#define SC_ENABLE (0x1<<0)
210#define GFX_OP_LOAD_INDIRECT ((0x3<<29)|(0x1d<<24)|(0x7<<16))
211#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
212#define SCI_YMIN_MASK (0xffff<<16)
213#define SCI_XMIN_MASK (0xffff<<0)
214#define SCI_YMAX_MASK (0xffff<<16)
215#define SCI_XMAX_MASK (0xffff<<0)
216#define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19))
217#define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
218#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
219#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
220#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4)
221#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
222#define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1)
223#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
224#define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2)
225#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4)
226#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
227#define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5)
228#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
229#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
230#define BLT_DEPTH_8 (0<<24)
231#define BLT_DEPTH_16_565 (1<<24)
232#define BLT_DEPTH_16_1555 (2<<24)
233#define BLT_DEPTH_32 (3<<24)
234#define BLT_ROP_GXCOPY (0xcc<<16)
235#define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */
236#define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */
237#define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
238#define ASYNC_FLIP (1<<22)
239#define DISPLAY_PLANE_A (0<<20)
240#define DISPLAY_PLANE_B (1<<20)
e552eb70
JB
241#define GFX_OP_PIPE_CONTROL ((0x3<<29)|(0x3<<27)|(0x2<<24)|2)
242#define PIPE_CONTROL_QW_WRITE (1<<14)
243#define PIPE_CONTROL_DEPTH_STALL (1<<13)
244#define PIPE_CONTROL_WC_FLUSH (1<<12)
245#define PIPE_CONTROL_IS_FLUSH (1<<11) /* MBZ on Ironlake */
246#define PIPE_CONTROL_TC_FLUSH (1<<10) /* GM45+ only */
247#define PIPE_CONTROL_ISP_DIS (1<<9)
248#define PIPE_CONTROL_NOTIFY (1<<8)
249#define PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
250#define PIPE_CONTROL_STALL_EN (1<<1) /* in addr word, Ironlake+ only */
585fb111
JB
251
252/*
de151cf6 253 * Fence registers
585fb111 254 */
de151cf6 255#define FENCE_REG_830_0 0x2000
dc529a4f 256#define FENCE_REG_945_8 0x3000
de151cf6
JB
257#define I830_FENCE_START_MASK 0x07f80000
258#define I830_FENCE_TILING_Y_SHIFT 12
0f973f27 259#define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
de151cf6
JB
260#define I830_FENCE_PITCH_SHIFT 4
261#define I830_FENCE_REG_VALID (1<<0)
c36a2a6d 262#define I915_FENCE_MAX_PITCH_VAL 4
e76a16de 263#define I830_FENCE_MAX_PITCH_VAL 6
8d7773a3 264#define I830_FENCE_MAX_SIZE_VAL (1<<8)
de151cf6
JB
265
266#define I915_FENCE_START_MASK 0x0ff00000
0f973f27 267#define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
585fb111 268
de151cf6
JB
269#define FENCE_REG_965_0 0x03000
270#define I965_FENCE_PITCH_SHIFT 2
271#define I965_FENCE_TILING_Y_SHIFT 1
272#define I965_FENCE_REG_VALID (1<<0)
8d7773a3 273#define I965_FENCE_MAX_PITCH_VAL 0x0400
de151cf6 274
4e901fdc
EA
275#define FENCE_REG_SANDYBRIDGE_0 0x100000
276#define SANDYBRIDGE_FENCE_PITCH_SHIFT 32
277
de151cf6
JB
278/*
279 * Instruction and interrupt control regs
280 */
63eeaf38 281#define PGTBL_ER 0x02024
585fb111
JB
282#define PRB0_TAIL 0x02030
283#define PRB0_HEAD 0x02034
284#define PRB0_START 0x02038
285#define PRB0_CTL 0x0203c
286#define TAIL_ADDR 0x001FFFF8
287#define HEAD_WRAP_COUNT 0xFFE00000
288#define HEAD_WRAP_ONE 0x00200000
289#define HEAD_ADDR 0x001FFFFC
290#define RING_NR_PAGES 0x001FF000
291#define RING_REPORT_MASK 0x00000006
292#define RING_REPORT_64K 0x00000002
293#define RING_REPORT_128K 0x00000004
294#define RING_NO_REPORT 0x00000000
295#define RING_VALID_MASK 0x00000001
296#define RING_VALID 0x00000001
297#define RING_INVALID 0x00000000
298#define PRB1_TAIL 0x02040 /* 915+ only */
299#define PRB1_HEAD 0x02044 /* 915+ only */
300#define PRB1_START 0x02048 /* 915+ only */
301#define PRB1_CTL 0x0204c /* 915+ only */
63eeaf38
JB
302#define IPEIR_I965 0x02064
303#define IPEHR_I965 0x02068
304#define INSTDONE_I965 0x0206c
305#define INSTPS 0x02070 /* 965+ only */
306#define INSTDONE1 0x0207c /* 965+ only */
585fb111
JB
307#define ACTHD_I965 0x02074
308#define HWS_PGA 0x02080
f6e450a6 309#define HWS_PGA_GEN6 0x04080
585fb111
JB
310#define HWS_ADDRESS_MASK 0xfffff000
311#define HWS_START_ADDRESS_SHIFT 4
97f5ab66
JB
312#define PWRCTXA 0x2088 /* 965GM+ only */
313#define PWRCTX_EN (1<<0)
585fb111 314#define IPEIR 0x02088
63eeaf38
JB
315#define IPEHR 0x0208c
316#define INSTDONE 0x02090
585fb111
JB
317#define NOPID 0x02094
318#define HWSTAM 0x02098
71cf39b1
EA
319
320#define MI_MODE 0x0209c
321# define VS_TIMER_DISPATCH (1 << 6)
322
585fb111
JB
323#define SCPD0 0x0209c /* 915+ only */
324#define IER 0x020a0
325#define IIR 0x020a4
326#define IMR 0x020a8
327#define ISR 0x020ac
328#define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18)
329#define I915_DISPLAY_PORT_INTERRUPT (1<<17)
330#define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15)
f97108d1 331#define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14) /* p-state */
585fb111
JB
332#define I915_HWB_OOM_INTERRUPT (1<<13)
333#define I915_SYNC_STATUS_INTERRUPT (1<<12)
334#define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
335#define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
336#define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9)
337#define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
338#define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7)
339#define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
340#define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
341#define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
342#define I915_DEBUG_INTERRUPT (1<<2)
343#define I915_USER_INTERRUPT (1<<1)
344#define I915_ASLE_INTERRUPT (1<<0)
d1b851fc 345#define I915_BSD_USER_INTERRUPT (1<<25)
585fb111
JB
346#define EIR 0x020b0
347#define EMR 0x020b4
348#define ESR 0x020b8
63eeaf38
JB
349#define GM45_ERROR_PAGE_TABLE (1<<5)
350#define GM45_ERROR_MEM_PRIV (1<<4)
351#define I915_ERROR_PAGE_TABLE (1<<4)
352#define GM45_ERROR_CP_PRIV (1<<3)
353#define I915_ERROR_MEMORY_REFRESH (1<<1)
354#define I915_ERROR_INSTRUCTION (1<<0)
585fb111 355#define INSTPM 0x020c0
ee980b80 356#define INSTPM_SELF_EN (1<<12) /* 915GM only */
585fb111
JB
357#define ACTHD 0x020c8
358#define FW_BLC 0x020d8
7662c8bd 359#define FW_BLC2 0x020dc
585fb111 360#define FW_BLC_SELF 0x020e0 /* 915+ only */
ee980b80
LP
361#define FW_BLC_SELF_EN_MASK (1<<31)
362#define FW_BLC_SELF_FIFO_MASK (1<<16) /* 945 only */
363#define FW_BLC_SELF_EN (1<<15) /* 945 only */
7662c8bd
SL
364#define MM_BURST_LENGTH 0x00700000
365#define MM_FIFO_WATERMARK 0x0001F000
366#define LM_BURST_LENGTH 0x00000700
367#define LM_FIFO_WATERMARK 0x0000001F
585fb111 368#define MI_ARB_STATE 0x020e4 /* 915+ only */
45503ded
KP
369#define MI_ARB_MASK_SHIFT 16 /* shift for enable bits */
370
371/* Make render/texture TLB fetches lower priorty than associated data
372 * fetches. This is not turned on by default
373 */
374#define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15)
375
376/* Isoch request wait on GTT enable (Display A/B/C streams).
377 * Make isoch requests stall on the TLB update. May cause
378 * display underruns (test mode only)
379 */
380#define MI_ARB_ISOCH_WAIT_GTT (1 << 14)
381
382/* Block grant count for isoch requests when block count is
383 * set to a finite value.
384 */
385#define MI_ARB_BLOCK_GRANT_MASK (3 << 12)
386#define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */
387#define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */
388#define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */
389#define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */
390
391/* Enable render writes to complete in C2/C3/C4 power states.
392 * If this isn't enabled, render writes are prevented in low
393 * power states. That seems bad to me.
394 */
395#define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11)
396
397/* This acknowledges an async flip immediately instead
398 * of waiting for 2TLB fetches.
399 */
400#define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10)
401
402/* Enables non-sequential data reads through arbiter
403 */
404#define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9)
405
406/* Disable FSB snooping of cacheable write cycles from binner/render
407 * command stream
408 */
409#define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8)
410
411/* Arbiter time slice for non-isoch streams */
412#define MI_ARB_TIME_SLICE_MASK (7 << 5)
413#define MI_ARB_TIME_SLICE_1 (0 << 5)
414#define MI_ARB_TIME_SLICE_2 (1 << 5)
415#define MI_ARB_TIME_SLICE_4 (2 << 5)
416#define MI_ARB_TIME_SLICE_6 (3 << 5)
417#define MI_ARB_TIME_SLICE_8 (4 << 5)
418#define MI_ARB_TIME_SLICE_10 (5 << 5)
419#define MI_ARB_TIME_SLICE_14 (6 << 5)
420#define MI_ARB_TIME_SLICE_16 (7 << 5)
421
422/* Low priority grace period page size */
423#define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */
424#define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4)
425
426/* Disable display A/B trickle feed */
427#define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2)
428
429/* Set display plane priority */
430#define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
431#define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
432
585fb111
JB
433#define CACHE_MODE_0 0x02120 /* 915+ only */
434#define CM0_MASK_SHIFT 16
435#define CM0_IZ_OPT_DISABLE (1<<6)
436#define CM0_ZR_OPT_DISABLE (1<<5)
437#define CM0_DEPTH_EVICT_DISABLE (1<<4)
438#define CM0_COLOR_EVICT_DISABLE (1<<3)
439#define CM0_DEPTH_WRITE_DISABLE (1<<1)
440#define CM0_RC_OP_FLUSH_DISABLE (1<<0)
9df30794 441#define BB_ADDR 0x02140 /* 8 bytes */
585fb111 442#define GFX_FLSH_CNTL 0x02170 /* 915+ only */
1afe3e9d
JB
443#define ECOSKPD 0x021d0
444#define ECO_GATING_CX_ONLY (1<<3)
445#define ECO_FLIP_DONE (1<<0)
585fb111 446
a1786bd2
ZW
447/* GEN6 interrupt control */
448#define GEN6_RENDER_HWSTAM 0x2098
449#define GEN6_RENDER_IMR 0x20a8
450#define GEN6_RENDER_CONTEXT_SWITCH_INTERRUPT (1 << 8)
451#define GEN6_RENDER_PPGTT_PAGE_FAULT (1 << 7)
7aa69d2e 452#define GEN6_RENDER_TIMEOUT_COUNTER_EXPIRED (1 << 6)
a1786bd2
ZW
453#define GEN6_RENDER_L3_PARITY_ERROR (1 << 5)
454#define GEN6_RENDER_PIPE_CONTROL_NOTIFY_INTERRUPT (1 << 4)
455#define GEN6_RENDER_COMMAND_PARSER_MASTER_ERROR (1 << 3)
456#define GEN6_RENDER_SYNC_STATUS (1 << 2)
457#define GEN6_RENDER_DEBUG_INTERRUPT (1 << 1)
458#define GEN6_RENDER_USER_INTERRUPT (1 << 0)
459
460#define GEN6_BLITTER_HWSTAM 0x22098
461#define GEN6_BLITTER_IMR 0x220a8
462#define GEN6_BLITTER_MI_FLUSH_DW_NOTIFY_INTERRUPT (1 << 26)
463#define GEN6_BLITTER_COMMAND_PARSER_MASTER_ERROR (1 << 25)
464#define GEN6_BLITTER_SYNC_STATUS (1 << 24)
465#define GEN6_BLITTER_USER_INTERRUPT (1 << 22)
d1b851fc
ZN
466/*
467 * BSD (bit stream decoder instruction and interrupt control register defines
468 * (G4X and Ironlake only)
469 */
470
471#define BSD_RING_TAIL 0x04030
472#define BSD_RING_HEAD 0x04034
473#define BSD_RING_START 0x04038
474#define BSD_RING_CTL 0x0403c
475#define BSD_RING_ACTHD 0x04074
476#define BSD_HWS_PGA 0x04080
de151cf6 477
585fb111
JB
478/*
479 * Framebuffer compression (915+ only)
480 */
481
482#define FBC_CFB_BASE 0x03200 /* 4k page aligned */
483#define FBC_LL_BASE 0x03204 /* 4k page aligned */
484#define FBC_CONTROL 0x03208
485#define FBC_CTL_EN (1<<31)
486#define FBC_CTL_PERIODIC (1<<30)
487#define FBC_CTL_INTERVAL_SHIFT (16)
488#define FBC_CTL_UNCOMPRESSIBLE (1<<14)
49677901 489#define FBC_CTL_C3_IDLE (1<<13)
585fb111
JB
490#define FBC_CTL_STRIDE_SHIFT (5)
491#define FBC_CTL_FENCENO (1<<0)
492#define FBC_COMMAND 0x0320c
493#define FBC_CMD_COMPRESS (1<<0)
494#define FBC_STATUS 0x03210
495#define FBC_STAT_COMPRESSING (1<<31)
496#define FBC_STAT_COMPRESSED (1<<30)
497#define FBC_STAT_MODIFIED (1<<29)
498#define FBC_STAT_CURRENT_LINE (1<<0)
499#define FBC_CONTROL2 0x03214
500#define FBC_CTL_FENCE_DBL (0<<4)
501#define FBC_CTL_IDLE_IMM (0<<2)
502#define FBC_CTL_IDLE_FULL (1<<2)
503#define FBC_CTL_IDLE_LINE (2<<2)
504#define FBC_CTL_IDLE_DEBUG (3<<2)
505#define FBC_CTL_CPU_FENCE (1<<1)
506#define FBC_CTL_PLANEA (0<<0)
507#define FBC_CTL_PLANEB (1<<0)
508#define FBC_FENCE_OFF 0x0321b
80824003 509#define FBC_TAG 0x03300
585fb111
JB
510
511#define FBC_LL_SIZE (1536)
512
74dff282
JB
513/* Framebuffer compression for GM45+ */
514#define DPFC_CB_BASE 0x3200
515#define DPFC_CONTROL 0x3208
516#define DPFC_CTL_EN (1<<31)
517#define DPFC_CTL_PLANEA (0<<30)
518#define DPFC_CTL_PLANEB (1<<30)
519#define DPFC_CTL_FENCE_EN (1<<29)
520#define DPFC_SR_EN (1<<10)
521#define DPFC_CTL_LIMIT_1X (0<<6)
522#define DPFC_CTL_LIMIT_2X (1<<6)
523#define DPFC_CTL_LIMIT_4X (2<<6)
524#define DPFC_RECOMP_CTL 0x320c
525#define DPFC_RECOMP_STALL_EN (1<<27)
526#define DPFC_RECOMP_STALL_WM_SHIFT (16)
527#define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
528#define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
529#define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
530#define DPFC_STATUS 0x3210
531#define DPFC_INVAL_SEG_SHIFT (16)
532#define DPFC_INVAL_SEG_MASK (0x07ff0000)
533#define DPFC_COMP_SEG_SHIFT (0)
534#define DPFC_COMP_SEG_MASK (0x000003ff)
535#define DPFC_STATUS2 0x3214
536#define DPFC_FENCE_YOFF 0x3218
537#define DPFC_CHICKEN 0x3224
538#define DPFC_HT_MODIFY (1<<31)
539
b52eb4dc
ZY
540/* Framebuffer compression for Ironlake */
541#define ILK_DPFC_CB_BASE 0x43200
542#define ILK_DPFC_CONTROL 0x43208
543/* The bit 28-8 is reserved */
544#define DPFC_RESERVED (0x1FFFFF00)
545#define ILK_DPFC_RECOMP_CTL 0x4320c
546#define ILK_DPFC_STATUS 0x43210
547#define ILK_DPFC_FENCE_YOFF 0x43218
548#define ILK_DPFC_CHICKEN 0x43224
549#define ILK_FBC_RT_BASE 0x2128
550#define ILK_FBC_RT_VALID (1<<0)
551
552#define ILK_DISPLAY_CHICKEN1 0x42000
553#define ILK_FBCQ_DIS (1<<22)
554
585fb111
JB
555/*
556 * GPIO regs
557 */
558#define GPIOA 0x5010
559#define GPIOB 0x5014
560#define GPIOC 0x5018
561#define GPIOD 0x501c
562#define GPIOE 0x5020
563#define GPIOF 0x5024
564#define GPIOG 0x5028
565#define GPIOH 0x502c
566# define GPIO_CLOCK_DIR_MASK (1 << 0)
567# define GPIO_CLOCK_DIR_IN (0 << 1)
568# define GPIO_CLOCK_DIR_OUT (1 << 1)
569# define GPIO_CLOCK_VAL_MASK (1 << 2)
570# define GPIO_CLOCK_VAL_OUT (1 << 3)
571# define GPIO_CLOCK_VAL_IN (1 << 4)
572# define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
573# define GPIO_DATA_DIR_MASK (1 << 8)
574# define GPIO_DATA_DIR_IN (0 << 9)
575# define GPIO_DATA_DIR_OUT (1 << 9)
576# define GPIO_DATA_VAL_MASK (1 << 10)
577# define GPIO_DATA_VAL_OUT (1 << 11)
578# define GPIO_DATA_VAL_IN (1 << 12)
579# define GPIO_DATA_PULLUP_DISABLE (1 << 13)
580
f0217c42
EA
581#define GMBUS0 0x5100
582#define GMBUS1 0x5104
583#define GMBUS2 0x5108
584#define GMBUS3 0x510c
585#define GMBUS4 0x5110
586#define GMBUS5 0x5120
587
585fb111
JB
588/*
589 * Clock control & power management
590 */
591
592#define VGA0 0x6000
593#define VGA1 0x6004
594#define VGA_PD 0x6010
595#define VGA0_PD_P2_DIV_4 (1 << 7)
596#define VGA0_PD_P1_DIV_2 (1 << 5)
597#define VGA0_PD_P1_SHIFT 0
598#define VGA0_PD_P1_MASK (0x1f << 0)
599#define VGA1_PD_P2_DIV_4 (1 << 15)
600#define VGA1_PD_P1_DIV_2 (1 << 13)
601#define VGA1_PD_P1_SHIFT 8
602#define VGA1_PD_P1_MASK (0x1f << 8)
603#define DPLL_A 0x06014
604#define DPLL_B 0x06018
605#define DPLL_VCO_ENABLE (1 << 31)
606#define DPLL_DVO_HIGH_SPEED (1 << 30)
607#define DPLL_SYNCLOCK_ENABLE (1 << 29)
608#define DPLL_VGA_MODE_DIS (1 << 28)
609#define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
610#define DPLLB_MODE_LVDS (2 << 26) /* i915 */
611#define DPLL_MODE_MASK (3 << 26)
612#define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
613#define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
614#define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
615#define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
616#define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
617#define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
f2b115e6 618#define DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW 0x00ff8000 /* Pineview */
585fb111 619
585fb111
JB
620#define SRX_INDEX 0x3c4
621#define SRX_DATA 0x3c5
622#define SR01 1
623#define SR01_SCREEN_OFF (1<<5)
624
625#define PPCR 0x61204
626#define PPCR_ON (1<<0)
627
628#define DVOB 0x61140
629#define DVOB_ON (1<<31)
630#define DVOC 0x61160
631#define DVOC_ON (1<<31)
632#define LVDS 0x61180
633#define LVDS_ON (1<<31)
634
635#define ADPA 0x61100
636#define ADPA_DPMS_MASK (~(3<<10))
637#define ADPA_DPMS_ON (0<<10)
638#define ADPA_DPMS_SUSPEND (1<<10)
639#define ADPA_DPMS_STANDBY (2<<10)
640#define ADPA_DPMS_OFF (3<<10)
641
642#define RING_TAIL 0x00
643#define TAIL_ADDR 0x001FFFF8
644#define RING_HEAD 0x04
645#define HEAD_WRAP_COUNT 0xFFE00000
646#define HEAD_WRAP_ONE 0x00200000
647#define HEAD_ADDR 0x001FFFFC
648#define RING_START 0x08
649#define START_ADDR 0xFFFFF000
650#define RING_LEN 0x0C
651#define RING_NR_PAGES 0x001FF000
652#define RING_REPORT_MASK 0x00000006
653#define RING_REPORT_64K 0x00000002
654#define RING_REPORT_128K 0x00000004
655#define RING_NO_REPORT 0x00000000
656#define RING_VALID_MASK 0x00000001
657#define RING_VALID 0x00000001
658#define RING_INVALID 0x00000000
659
660/* Scratch pad debug 0 reg:
661 */
662#define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
663/*
664 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
665 * this field (only one bit may be set).
666 */
667#define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
668#define DPLL_FPA01_P1_POST_DIV_SHIFT 16
f2b115e6 669#define DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW 15
585fb111
JB
670/* i830, required in DVO non-gang */
671#define PLL_P2_DIVIDE_BY_4 (1 << 23)
672#define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
673#define PLL_REF_INPUT_DREFCLK (0 << 13)
674#define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
675#define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
676#define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
677#define PLL_REF_INPUT_MASK (3 << 13)
678#define PLL_LOAD_PULSE_PHASE_SHIFT 9
f2b115e6 679/* Ironlake */
b9055052
ZW
680# define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
681# define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
682# define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1) << 9)
683# define DPLL_FPA1_P1_POST_DIV_SHIFT 0
684# define DPLL_FPA1_P1_POST_DIV_MASK 0xff
685
585fb111
JB
686/*
687 * Parallel to Serial Load Pulse phase selection.
688 * Selects the phase for the 10X DPLL clock for the PCIe
689 * digital display port. The range is 4 to 13; 10 or more
690 * is just a flip delay. The default is 6
691 */
692#define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
693#define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
694/*
695 * SDVO multiplier for 945G/GM. Not used on 965.
696 */
697#define SDVO_MULTIPLIER_MASK 0x000000ff
698#define SDVO_MULTIPLIER_SHIFT_HIRES 4
699#define SDVO_MULTIPLIER_SHIFT_VGA 0
700#define DPLL_A_MD 0x0601c /* 965+ only */
701/*
702 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
703 *
704 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
705 */
706#define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
707#define DPLL_MD_UDI_DIVIDER_SHIFT 24
708/* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
709#define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
710#define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
711/*
712 * SDVO/UDI pixel multiplier.
713 *
714 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
715 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
716 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
717 * dummy bytes in the datastream at an increased clock rate, with both sides of
718 * the link knowing how many bytes are fill.
719 *
720 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
721 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
722 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
723 * through an SDVO command.
724 *
725 * This register field has values of multiplication factor minus 1, with
726 * a maximum multiplier of 5 for SDVO.
727 */
728#define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
729#define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
730/*
731 * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
732 * This best be set to the default value (3) or the CRT won't work. No,
733 * I don't entirely understand what this does...
734 */
735#define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
736#define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
737#define DPLL_B_MD 0x06020 /* 965+ only */
738#define FPA0 0x06040
739#define FPA1 0x06044
740#define FPB0 0x06048
741#define FPB1 0x0604c
742#define FP_N_DIV_MASK 0x003f0000
f2b115e6 743#define FP_N_PINEVIEW_DIV_MASK 0x00ff0000
585fb111
JB
744#define FP_N_DIV_SHIFT 16
745#define FP_M1_DIV_MASK 0x00003f00
746#define FP_M1_DIV_SHIFT 8
747#define FP_M2_DIV_MASK 0x0000003f
f2b115e6 748#define FP_M2_PINEVIEW_DIV_MASK 0x000000ff
585fb111
JB
749#define FP_M2_DIV_SHIFT 0
750#define DPLL_TEST 0x606c
751#define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
752#define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
753#define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
754#define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
755#define DPLLB_TEST_N_BYPASS (1 << 19)
756#define DPLLB_TEST_M_BYPASS (1 << 18)
757#define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
758#define DPLLA_TEST_N_BYPASS (1 << 3)
759#define DPLLA_TEST_M_BYPASS (1 << 2)
760#define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
761#define D_STATE 0x6104
652c393a
JB
762#define DSTATE_PLL_D3_OFF (1<<3)
763#define DSTATE_GFX_CLOCK_GATING (1<<1)
764#define DSTATE_DOT_CLOCK_GATING (1<<0)
765#define DSPCLK_GATE_D 0x6200
766# define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
767# define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
768# define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
769# define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
770# define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
771# define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
772# define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
773# define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
774# define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
775# define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
776# define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
777# define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
778# define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
779# define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
780# define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
781# define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
782# define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
783# define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
784# define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
785# define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
786# define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
787# define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
788# define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
789# define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
790# define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
791# define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
792# define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
793# define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
794/**
795 * This bit must be set on the 830 to prevent hangs when turning off the
796 * overlay scaler.
797 */
798# define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
799# define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
800# define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
801# define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
802# define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
803
804#define RENCLK_GATE_D1 0x6204
805# define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
806# define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
807# define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
808# define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
809# define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
810# define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
811# define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
812# define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
813# define MAG_CLOCK_GATE_DISABLE (1 << 5)
814/** This bit must be unset on 855,865 */
815# define MECI_CLOCK_GATE_DISABLE (1 << 4)
816# define DCMP_CLOCK_GATE_DISABLE (1 << 3)
817# define MEC_CLOCK_GATE_DISABLE (1 << 2)
818# define MECO_CLOCK_GATE_DISABLE (1 << 1)
819/** This bit must be set on 855,865. */
820# define SV_CLOCK_GATE_DISABLE (1 << 0)
821# define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
822# define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
823# define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
824# define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
825# define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
826# define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
827# define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
828# define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
829# define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
830# define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
831# define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
832# define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
833# define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
834# define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
835# define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
836# define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
837# define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
838
839# define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
840/** This bit must always be set on 965G/965GM */
841# define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
842# define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
843# define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
844# define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
845# define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
846# define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
847/** This bit must always be set on 965G */
848# define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
849# define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
850# define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
851# define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
852# define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
853# define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
854# define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
855# define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
856# define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
857# define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
858# define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
859# define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
860# define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
861# define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
862# define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
863# define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
864# define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
865# define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
866# define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
867
868#define RENCLK_GATE_D2 0x6208
869#define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
870#define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
871#define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
872#define RAMCLK_GATE_D 0x6210 /* CRL only */
873#define DEUC 0x6214 /* CRL only */
585fb111
JB
874
875/*
876 * Palette regs
877 */
878
879#define PALETTE_A 0x0a000
880#define PALETTE_B 0x0a800
881
673a394b
EA
882/* MCH MMIO space */
883
884/*
885 * MCHBAR mirror.
886 *
887 * This mirrors the MCHBAR MMIO space whose location is determined by
888 * device 0 function 0's pci config register 0x44 or 0x48 and matches it in
889 * every way. It is not accessible from the CP register read instructions.
890 *
891 */
892#define MCHBAR_MIRROR_BASE 0x10000
893
894/** 915-945 and GM965 MCH register controlling DRAM channel access */
895#define DCC 0x10200
896#define DCC_ADDRESSING_MODE_SINGLE_CHANNEL (0 << 0)
897#define DCC_ADDRESSING_MODE_DUAL_CHANNEL_ASYMMETRIC (1 << 0)
898#define DCC_ADDRESSING_MODE_DUAL_CHANNEL_INTERLEAVED (2 << 0)
899#define DCC_ADDRESSING_MODE_MASK (3 << 0)
900#define DCC_CHANNEL_XOR_DISABLE (1 << 10)
a7f014f2 901#define DCC_CHANNEL_XOR_BIT_17 (1 << 9)
673a394b 902
95534263
LP
903/** Pineview MCH register contains DDR3 setting */
904#define CSHRDDR3CTL 0x101a8
905#define CSHRDDR3CTL_DDR3 (1 << 2)
906
673a394b
EA
907/** 965 MCH register controlling DRAM channel configuration */
908#define C0DRB3 0x10206
909#define C1DRB3 0x10606
910
b11248df
KP
911/* Clocking configuration register */
912#define CLKCFG 0x10c00
7662c8bd 913#define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */
b11248df
KP
914#define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
915#define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
916#define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */
917#define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */
918#define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */
7662c8bd 919/* Note, below two are guess */
b11248df 920#define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */
7662c8bd 921#define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */
b11248df 922#define CLKCFG_FSB_MASK (7 << 0)
7662c8bd
SL
923#define CLKCFG_MEM_533 (1 << 4)
924#define CLKCFG_MEM_667 (2 << 4)
925#define CLKCFG_MEM_800 (3 << 4)
926#define CLKCFG_MEM_MASK (7 << 4)
927
7648fa99
JB
928#define TR1 0x11006
929#define TSFS 0x11020
930#define TSFS_SLOPE_MASK 0x0000ff00
931#define TSFS_SLOPE_SHIFT 8
932#define TSFS_INTR_MASK 0x000000ff
933
f97108d1
JB
934#define CRSTANDVID 0x11100
935#define PXVFREQ_BASE 0x11110 /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
936#define PXVFREQ_PX_MASK 0x7f000000
937#define PXVFREQ_PX_SHIFT 24
938#define VIDFREQ_BASE 0x11110
939#define VIDFREQ1 0x11110 /* VIDFREQ1-4 (0x1111c) (Cantiga) */
940#define VIDFREQ2 0x11114
941#define VIDFREQ3 0x11118
942#define VIDFREQ4 0x1111c
943#define VIDFREQ_P0_MASK 0x1f000000
944#define VIDFREQ_P0_SHIFT 24
945#define VIDFREQ_P0_CSCLK_MASK 0x00f00000
946#define VIDFREQ_P0_CSCLK_SHIFT 20
947#define VIDFREQ_P0_CRCLK_MASK 0x000f0000
948#define VIDFREQ_P0_CRCLK_SHIFT 16
949#define VIDFREQ_P1_MASK 0x00001f00
950#define VIDFREQ_P1_SHIFT 8
951#define VIDFREQ_P1_CSCLK_MASK 0x000000f0
952#define VIDFREQ_P1_CSCLK_SHIFT 4
953#define VIDFREQ_P1_CRCLK_MASK 0x0000000f
954#define INTTOEXT_BASE_ILK 0x11300
955#define INTTOEXT_BASE 0x11120 /* INTTOEXT1-8 (0x1113c) */
956#define INTTOEXT_MAP3_SHIFT 24
957#define INTTOEXT_MAP3_MASK (0x1f << INTTOEXT_MAP3_SHIFT)
958#define INTTOEXT_MAP2_SHIFT 16
959#define INTTOEXT_MAP2_MASK (0x1f << INTTOEXT_MAP2_SHIFT)
960#define INTTOEXT_MAP1_SHIFT 8
961#define INTTOEXT_MAP1_MASK (0x1f << INTTOEXT_MAP1_SHIFT)
962#define INTTOEXT_MAP0_SHIFT 0
963#define INTTOEXT_MAP0_MASK (0x1f << INTTOEXT_MAP0_SHIFT)
964#define MEMSWCTL 0x11170 /* Ironlake only */
965#define MEMCTL_CMD_MASK 0xe000
966#define MEMCTL_CMD_SHIFT 13
967#define MEMCTL_CMD_RCLK_OFF 0
968#define MEMCTL_CMD_RCLK_ON 1
969#define MEMCTL_CMD_CHFREQ 2
970#define MEMCTL_CMD_CHVID 3
971#define MEMCTL_CMD_VMMOFF 4
972#define MEMCTL_CMD_VMMON 5
973#define MEMCTL_CMD_STS (1<<12) /* write 1 triggers command, clears
974 when command complete */
975#define MEMCTL_FREQ_MASK 0x0f00 /* jitter, from 0-15 */
976#define MEMCTL_FREQ_SHIFT 8
977#define MEMCTL_SFCAVM (1<<7)
978#define MEMCTL_TGT_VID_MASK 0x007f
979#define MEMIHYST 0x1117c
980#define MEMINTREN 0x11180 /* 16 bits */
981#define MEMINT_RSEXIT_EN (1<<8)
982#define MEMINT_CX_SUPR_EN (1<<7)
983#define MEMINT_CONT_BUSY_EN (1<<6)
984#define MEMINT_AVG_BUSY_EN (1<<5)
985#define MEMINT_EVAL_CHG_EN (1<<4)
986#define MEMINT_MON_IDLE_EN (1<<3)
987#define MEMINT_UP_EVAL_EN (1<<2)
988#define MEMINT_DOWN_EVAL_EN (1<<1)
989#define MEMINT_SW_CMD_EN (1<<0)
990#define MEMINTRSTR 0x11182 /* 16 bits */
991#define MEM_RSEXIT_MASK 0xc000
992#define MEM_RSEXIT_SHIFT 14
993#define MEM_CONT_BUSY_MASK 0x3000
994#define MEM_CONT_BUSY_SHIFT 12
995#define MEM_AVG_BUSY_MASK 0x0c00
996#define MEM_AVG_BUSY_SHIFT 10
997#define MEM_EVAL_CHG_MASK 0x0300
998#define MEM_EVAL_BUSY_SHIFT 8
999#define MEM_MON_IDLE_MASK 0x00c0
1000#define MEM_MON_IDLE_SHIFT 6
1001#define MEM_UP_EVAL_MASK 0x0030
1002#define MEM_UP_EVAL_SHIFT 4
1003#define MEM_DOWN_EVAL_MASK 0x000c
1004#define MEM_DOWN_EVAL_SHIFT 2
1005#define MEM_SW_CMD_MASK 0x0003
1006#define MEM_INT_STEER_GFX 0
1007#define MEM_INT_STEER_CMR 1
1008#define MEM_INT_STEER_SMI 2
1009#define MEM_INT_STEER_SCI 3
1010#define MEMINTRSTS 0x11184
1011#define MEMINT_RSEXIT (1<<7)
1012#define MEMINT_CONT_BUSY (1<<6)
1013#define MEMINT_AVG_BUSY (1<<5)
1014#define MEMINT_EVAL_CHG (1<<4)
1015#define MEMINT_MON_IDLE (1<<3)
1016#define MEMINT_UP_EVAL (1<<2)
1017#define MEMINT_DOWN_EVAL (1<<1)
1018#define MEMINT_SW_CMD (1<<0)
1019#define MEMMODECTL 0x11190
1020#define MEMMODE_BOOST_EN (1<<31)
1021#define MEMMODE_BOOST_FREQ_MASK 0x0f000000 /* jitter for boost, 0-15 */
1022#define MEMMODE_BOOST_FREQ_SHIFT 24
1023#define MEMMODE_IDLE_MODE_MASK 0x00030000
1024#define MEMMODE_IDLE_MODE_SHIFT 16
1025#define MEMMODE_IDLE_MODE_EVAL 0
1026#define MEMMODE_IDLE_MODE_CONT 1
1027#define MEMMODE_HWIDLE_EN (1<<15)
1028#define MEMMODE_SWMODE_EN (1<<14)
1029#define MEMMODE_RCLK_GATE (1<<13)
1030#define MEMMODE_HW_UPDATE (1<<12)
1031#define MEMMODE_FSTART_MASK 0x00000f00 /* starting jitter, 0-15 */
1032#define MEMMODE_FSTART_SHIFT 8
1033#define MEMMODE_FMAX_MASK 0x000000f0 /* max jitter, 0-15 */
1034#define MEMMODE_FMAX_SHIFT 4
1035#define MEMMODE_FMIN_MASK 0x0000000f /* min jitter, 0-15 */
1036#define RCBMAXAVG 0x1119c
1037#define MEMSWCTL2 0x1119e /* Cantiga only */
1038#define SWMEMCMD_RENDER_OFF (0 << 13)
1039#define SWMEMCMD_RENDER_ON (1 << 13)
1040#define SWMEMCMD_SWFREQ (2 << 13)
1041#define SWMEMCMD_TARVID (3 << 13)
1042#define SWMEMCMD_VRM_OFF (4 << 13)
1043#define SWMEMCMD_VRM_ON (5 << 13)
1044#define CMDSTS (1<<12)
1045#define SFCAVM (1<<11)
1046#define SWFREQ_MASK 0x0380 /* P0-7 */
1047#define SWFREQ_SHIFT 7
1048#define TARVID_MASK 0x001f
1049#define MEMSTAT_CTG 0x111a0
1050#define RCBMINAVG 0x111a0
1051#define RCUPEI 0x111b0
1052#define RCDNEI 0x111b4
b5b72e89 1053#define MCHBAR_RENDER_STANDBY 0x111b8
97f5ab66
JB
1054#define RCX_SW_EXIT (1<<23)
1055#define RSX_STATUS_MASK 0x00700000
f97108d1
JB
1056#define VIDCTL 0x111c0
1057#define VIDSTS 0x111c8
1058#define VIDSTART 0x111cc /* 8 bits */
1059#define MEMSTAT_ILK 0x111f8
1060#define MEMSTAT_VID_MASK 0x7f00
1061#define MEMSTAT_VID_SHIFT 8
1062#define MEMSTAT_PSTATE_MASK 0x00f8
1063#define MEMSTAT_PSTATE_SHIFT 3
1064#define MEMSTAT_MON_ACTV (1<<2)
1065#define MEMSTAT_SRC_CTL_MASK 0x0003
1066#define MEMSTAT_SRC_CTL_CORE 0
1067#define MEMSTAT_SRC_CTL_TRB 1
1068#define MEMSTAT_SRC_CTL_THM 2
1069#define MEMSTAT_SRC_CTL_STDBY 3
1070#define RCPREVBSYTUPAVG 0x113b8
1071#define RCPREVBSYTDNAVG 0x113bc
7648fa99
JB
1072#define SDEW 0x1124c
1073#define CSIEW0 0x11250
1074#define CSIEW1 0x11254
1075#define CSIEW2 0x11258
1076#define PEW 0x1125c
1077#define DEW 0x11270
1078#define MCHAFE 0x112c0
1079#define CSIEC 0x112e0
1080#define DMIEC 0x112e4
1081#define DDREC 0x112e8
1082#define PEG0EC 0x112ec
1083#define PEG1EC 0x112f0
1084#define GFXEC 0x112f4
1085#define RPPREVBSYTUPAVG 0x113b8
1086#define RPPREVBSYTDNAVG 0x113bc
1087#define ECR 0x11600
1088#define ECR_GPFE (1<<31)
1089#define ECR_IMONE (1<<30)
1090#define ECR_CAP_MASK 0x0000001f /* Event range, 0-31 */
1091#define OGW0 0x11608
1092#define OGW1 0x1160c
1093#define EG0 0x11610
1094#define EG1 0x11614
1095#define EG2 0x11618
1096#define EG3 0x1161c
1097#define EG4 0x11620
1098#define EG5 0x11624
1099#define EG6 0x11628
1100#define EG7 0x1162c
1101#define PXW 0x11664
1102#define PXWL 0x11680
1103#define LCFUSE02 0x116c0
1104#define LCFUSE_HIV_MASK 0x000000ff
1105#define CSIPLL0 0x12c10
1106#define DDRMPLL1 0X12c20
7d57382e
EA
1107#define PEG_BAND_GAP_DATA 0x14d68
1108
aa40d6bb
ZN
1109/*
1110 * Logical Context regs
1111 */
1112#define CCID 0x2180
1113#define CCID_EN (1<<0)
585fb111
JB
1114/*
1115 * Overlay regs
1116 */
1117
1118#define OVADD 0x30000
1119#define DOVSTA 0x30008
1120#define OC_BUF (0x3<<20)
1121#define OGAMC5 0x30010
1122#define OGAMC4 0x30014
1123#define OGAMC3 0x30018
1124#define OGAMC2 0x3001c
1125#define OGAMC1 0x30020
1126#define OGAMC0 0x30024
1127
1128/*
1129 * Display engine regs
1130 */
1131
1132/* Pipe A timing regs */
1133#define HTOTAL_A 0x60000
1134#define HBLANK_A 0x60004
1135#define HSYNC_A 0x60008
1136#define VTOTAL_A 0x6000c
1137#define VBLANK_A 0x60010
1138#define VSYNC_A 0x60014
1139#define PIPEASRC 0x6001c
1140#define BCLRPAT_A 0x60020
1141
1142/* Pipe B timing regs */
1143#define HTOTAL_B 0x61000
1144#define HBLANK_B 0x61004
1145#define HSYNC_B 0x61008
1146#define VTOTAL_B 0x6100c
1147#define VBLANK_B 0x61010
1148#define VSYNC_B 0x61014
1149#define PIPEBSRC 0x6101c
1150#define BCLRPAT_B 0x61020
1151
1152/* VGA port control */
1153#define ADPA 0x61100
1154#define ADPA_DAC_ENABLE (1<<31)
1155#define ADPA_DAC_DISABLE 0
1156#define ADPA_PIPE_SELECT_MASK (1<<30)
1157#define ADPA_PIPE_A_SELECT 0
1158#define ADPA_PIPE_B_SELECT (1<<30)
1159#define ADPA_USE_VGA_HVPOLARITY (1<<15)
1160#define ADPA_SETS_HVPOLARITY 0
1161#define ADPA_VSYNC_CNTL_DISABLE (1<<11)
1162#define ADPA_VSYNC_CNTL_ENABLE 0
1163#define ADPA_HSYNC_CNTL_DISABLE (1<<10)
1164#define ADPA_HSYNC_CNTL_ENABLE 0
1165#define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
1166#define ADPA_VSYNC_ACTIVE_LOW 0
1167#define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
1168#define ADPA_HSYNC_ACTIVE_LOW 0
1169#define ADPA_DPMS_MASK (~(3<<10))
1170#define ADPA_DPMS_ON (0<<10)
1171#define ADPA_DPMS_SUSPEND (1<<10)
1172#define ADPA_DPMS_STANDBY (2<<10)
1173#define ADPA_DPMS_OFF (3<<10)
1174
1175/* Hotplug control (945+ only) */
1176#define PORT_HOTPLUG_EN 0x61110
7d57382e 1177#define HDMIB_HOTPLUG_INT_EN (1 << 29)
040d87f1 1178#define DPB_HOTPLUG_INT_EN (1 << 29)
7d57382e 1179#define HDMIC_HOTPLUG_INT_EN (1 << 28)
040d87f1 1180#define DPC_HOTPLUG_INT_EN (1 << 28)
7d57382e 1181#define HDMID_HOTPLUG_INT_EN (1 << 27)
040d87f1 1182#define DPD_HOTPLUG_INT_EN (1 << 27)
585fb111
JB
1183#define SDVOB_HOTPLUG_INT_EN (1 << 26)
1184#define SDVOC_HOTPLUG_INT_EN (1 << 25)
1185#define TV_HOTPLUG_INT_EN (1 << 18)
1186#define CRT_HOTPLUG_INT_EN (1 << 9)
1187#define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
771cb081
ZY
1188#define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
1189/* must use period 64 on GM45 according to docs */
1190#define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
1191#define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
1192#define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
1193#define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
1194#define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
1195#define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
1196#define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
1197#define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
1198#define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
1199#define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
1200#define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
1201#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
585fb111
JB
1202
1203#define PORT_HOTPLUG_STAT 0x61114
7d57382e 1204#define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
040d87f1 1205#define DPB_HOTPLUG_INT_STATUS (1 << 29)
7d57382e 1206#define HDMIC_HOTPLUG_INT_STATUS (1 << 28)
040d87f1 1207#define DPC_HOTPLUG_INT_STATUS (1 << 28)
7d57382e 1208#define HDMID_HOTPLUG_INT_STATUS (1 << 27)
040d87f1 1209#define DPD_HOTPLUG_INT_STATUS (1 << 27)
585fb111
JB
1210#define CRT_HOTPLUG_INT_STATUS (1 << 11)
1211#define TV_HOTPLUG_INT_STATUS (1 << 10)
1212#define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
1213#define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
1214#define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
1215#define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
1216#define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
1217#define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
1218
1219/* SDVO port control */
1220#define SDVOB 0x61140
1221#define SDVOC 0x61160
1222#define SDVO_ENABLE (1 << 31)
1223#define SDVO_PIPE_B_SELECT (1 << 30)
1224#define SDVO_STALL_SELECT (1 << 29)
1225#define SDVO_INTERRUPT_ENABLE (1 << 26)
1226/**
1227 * 915G/GM SDVO pixel multiplier.
1228 *
1229 * Programmed value is multiplier - 1, up to 5x.
1230 *
1231 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
1232 */
1233#define SDVO_PORT_MULTIPLY_MASK (7 << 23)
1234#define SDVO_PORT_MULTIPLY_SHIFT 23
1235#define SDVO_PHASE_SELECT_MASK (15 << 19)
1236#define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
1237#define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
1238#define SDVOC_GANG_MODE (1 << 16)
7d57382e
EA
1239#define SDVO_ENCODING_SDVO (0x0 << 10)
1240#define SDVO_ENCODING_HDMI (0x2 << 10)
1241/** Requird for HDMI operation */
1242#define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
585fb111 1243#define SDVO_BORDER_ENABLE (1 << 7)
7d57382e
EA
1244#define SDVO_AUDIO_ENABLE (1 << 6)
1245/** New with 965, default is to be set */
1246#define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
1247/** New with 965, default is to be set */
1248#define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
585fb111
JB
1249#define SDVOB_PCIE_CONCURRENCY (1 << 3)
1250#define SDVO_DETECTED (1 << 2)
1251/* Bits to be preserved when writing */
1252#define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | (1 << 26))
1253#define SDVOC_PRESERVE_MASK ((1 << 17) | (1 << 26))
1254
1255/* DVO port control */
1256#define DVOA 0x61120
1257#define DVOB 0x61140
1258#define DVOC 0x61160
1259#define DVO_ENABLE (1 << 31)
1260#define DVO_PIPE_B_SELECT (1 << 30)
1261#define DVO_PIPE_STALL_UNUSED (0 << 28)
1262#define DVO_PIPE_STALL (1 << 28)
1263#define DVO_PIPE_STALL_TV (2 << 28)
1264#define DVO_PIPE_STALL_MASK (3 << 28)
1265#define DVO_USE_VGA_SYNC (1 << 15)
1266#define DVO_DATA_ORDER_I740 (0 << 14)
1267#define DVO_DATA_ORDER_FP (1 << 14)
1268#define DVO_VSYNC_DISABLE (1 << 11)
1269#define DVO_HSYNC_DISABLE (1 << 10)
1270#define DVO_VSYNC_TRISTATE (1 << 9)
1271#define DVO_HSYNC_TRISTATE (1 << 8)
1272#define DVO_BORDER_ENABLE (1 << 7)
1273#define DVO_DATA_ORDER_GBRG (1 << 6)
1274#define DVO_DATA_ORDER_RGGB (0 << 6)
1275#define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
1276#define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
1277#define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
1278#define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
1279#define DVO_BLANK_ACTIVE_HIGH (1 << 2)
1280#define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
1281#define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
1282#define DVO_PRESERVE_MASK (0x7<<24)
1283#define DVOA_SRCDIM 0x61124
1284#define DVOB_SRCDIM 0x61144
1285#define DVOC_SRCDIM 0x61164
1286#define DVO_SRCDIM_HORIZONTAL_SHIFT 12
1287#define DVO_SRCDIM_VERTICAL_SHIFT 0
1288
1289/* LVDS port control */
1290#define LVDS 0x61180
1291/*
1292 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
1293 * the DPLL semantics change when the LVDS is assigned to that pipe.
1294 */
1295#define LVDS_PORT_EN (1 << 31)
1296/* Selects pipe B for LVDS data. Must be set on pre-965. */
1297#define LVDS_PIPEB_SELECT (1 << 30)
898822ce
ZY
1298/* LVDS dithering flag on 965/g4x platform */
1299#define LVDS_ENABLE_DITHER (1 << 25)
a3e17eb8
ZY
1300/* Enable border for unscaled (or aspect-scaled) display */
1301#define LVDS_BORDER_ENABLE (1 << 15)
585fb111
JB
1302/*
1303 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
1304 * pixel.
1305 */
1306#define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
1307#define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
1308#define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
1309/*
1310 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
1311 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
1312 * on.
1313 */
1314#define LVDS_A3_POWER_MASK (3 << 6)
1315#define LVDS_A3_POWER_DOWN (0 << 6)
1316#define LVDS_A3_POWER_UP (3 << 6)
1317/*
1318 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
1319 * is set.
1320 */
1321#define LVDS_CLKB_POWER_MASK (3 << 4)
1322#define LVDS_CLKB_POWER_DOWN (0 << 4)
1323#define LVDS_CLKB_POWER_UP (3 << 4)
1324/*
1325 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
1326 * setting for whether we are in dual-channel mode. The B3 pair will
1327 * additionally only be powered up when LVDS_A3_POWER_UP is set.
1328 */
1329#define LVDS_B0B3_POWER_MASK (3 << 2)
1330#define LVDS_B0B3_POWER_DOWN (0 << 2)
1331#define LVDS_B0B3_POWER_UP (3 << 2)
1332
1333/* Panel power sequencing */
1334#define PP_STATUS 0x61200
1335#define PP_ON (1 << 31)
1336/*
1337 * Indicates that all dependencies of the panel are on:
1338 *
1339 * - PLL enabled
1340 * - pipe enabled
1341 * - LVDS/DVOB/DVOC on
1342 */
1343#define PP_READY (1 << 30)
1344#define PP_SEQUENCE_NONE (0 << 28)
1345#define PP_SEQUENCE_ON (1 << 28)
1346#define PP_SEQUENCE_OFF (2 << 28)
1347#define PP_SEQUENCE_MASK 0x30000000
1348#define PP_CONTROL 0x61204
1349#define POWER_TARGET_ON (1 << 0)
1350#define PP_ON_DELAYS 0x61208
1351#define PP_OFF_DELAYS 0x6120c
1352#define PP_DIVISOR 0x61210
1353
1354/* Panel fitting */
1355#define PFIT_CONTROL 0x61230
1356#define PFIT_ENABLE (1 << 31)
1357#define PFIT_PIPE_MASK (3 << 29)
1358#define PFIT_PIPE_SHIFT 29
1359#define VERT_INTERP_DISABLE (0 << 10)
1360#define VERT_INTERP_BILINEAR (1 << 10)
1361#define VERT_INTERP_MASK (3 << 10)
1362#define VERT_AUTO_SCALE (1 << 9)
1363#define HORIZ_INTERP_DISABLE (0 << 6)
1364#define HORIZ_INTERP_BILINEAR (1 << 6)
1365#define HORIZ_INTERP_MASK (3 << 6)
1366#define HORIZ_AUTO_SCALE (1 << 5)
1367#define PANEL_8TO6_DITHER_ENABLE (1 << 3)
3fbe18d6
ZY
1368#define PFIT_FILTER_FUZZY (0 << 24)
1369#define PFIT_SCALING_AUTO (0 << 26)
1370#define PFIT_SCALING_PROGRAMMED (1 << 26)
1371#define PFIT_SCALING_PILLAR (2 << 26)
1372#define PFIT_SCALING_LETTER (3 << 26)
585fb111
JB
1373#define PFIT_PGM_RATIOS 0x61234
1374#define PFIT_VERT_SCALE_MASK 0xfff00000
1375#define PFIT_HORIZ_SCALE_MASK 0x0000fff0
3fbe18d6
ZY
1376/* Pre-965 */
1377#define PFIT_VERT_SCALE_SHIFT 20
1378#define PFIT_VERT_SCALE_MASK 0xfff00000
1379#define PFIT_HORIZ_SCALE_SHIFT 4
1380#define PFIT_HORIZ_SCALE_MASK 0x0000fff0
1381/* 965+ */
1382#define PFIT_VERT_SCALE_SHIFT_965 16
1383#define PFIT_VERT_SCALE_MASK_965 0x1fff0000
1384#define PFIT_HORIZ_SCALE_SHIFT_965 0
1385#define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
1386
585fb111
JB
1387#define PFIT_AUTO_RATIOS 0x61238
1388
1389/* Backlight control */
1390#define BLC_PWM_CTL 0x61254
1391#define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
1392#define BLC_PWM_CTL2 0x61250 /* 965+ only */
8ee1c3db 1393#define BLM_COMBINATION_MODE (1 << 30)
585fb111
JB
1394/*
1395 * This is the most significant 15 bits of the number of backlight cycles in a
1396 * complete cycle of the modulated backlight control.
1397 *
1398 * The actual value is this field multiplied by two.
1399 */
1400#define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
1401#define BLM_LEGACY_MODE (1 << 16)
1402/*
1403 * This is the number of cycles out of the backlight modulation cycle for which
1404 * the backlight is on.
1405 *
1406 * This field must be no greater than the number of cycles in the complete
1407 * backlight modulation cycle.
1408 */
1409#define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
1410#define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
1411
0eb96d6e
JB
1412#define BLC_HIST_CTL 0x61260
1413
585fb111
JB
1414/* TV port control */
1415#define TV_CTL 0x68000
1416/** Enables the TV encoder */
1417# define TV_ENC_ENABLE (1 << 31)
1418/** Sources the TV encoder input from pipe B instead of A. */
1419# define TV_ENC_PIPEB_SELECT (1 << 30)
1420/** Outputs composite video (DAC A only) */
1421# define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
1422/** Outputs SVideo video (DAC B/C) */
1423# define TV_ENC_OUTPUT_SVIDEO (1 << 28)
1424/** Outputs Component video (DAC A/B/C) */
1425# define TV_ENC_OUTPUT_COMPONENT (2 << 28)
1426/** Outputs Composite and SVideo (DAC A/B/C) */
1427# define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
1428# define TV_TRILEVEL_SYNC (1 << 21)
1429/** Enables slow sync generation (945GM only) */
1430# define TV_SLOW_SYNC (1 << 20)
1431/** Selects 4x oversampling for 480i and 576p */
1432# define TV_OVERSAMPLE_4X (0 << 18)
1433/** Selects 2x oversampling for 720p and 1080i */
1434# define TV_OVERSAMPLE_2X (1 << 18)
1435/** Selects no oversampling for 1080p */
1436# define TV_OVERSAMPLE_NONE (2 << 18)
1437/** Selects 8x oversampling */
1438# define TV_OVERSAMPLE_8X (3 << 18)
1439/** Selects progressive mode rather than interlaced */
1440# define TV_PROGRESSIVE (1 << 17)
1441/** Sets the colorburst to PAL mode. Required for non-M PAL modes. */
1442# define TV_PAL_BURST (1 << 16)
1443/** Field for setting delay of Y compared to C */
1444# define TV_YC_SKEW_MASK (7 << 12)
1445/** Enables a fix for 480p/576p standard definition modes on the 915GM only */
1446# define TV_ENC_SDP_FIX (1 << 11)
1447/**
1448 * Enables a fix for the 915GM only.
1449 *
1450 * Not sure what it does.
1451 */
1452# define TV_ENC_C0_FIX (1 << 10)
1453/** Bits that must be preserved by software */
d2d9f232 1454# define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
585fb111
JB
1455# define TV_FUSE_STATE_MASK (3 << 4)
1456/** Read-only state that reports all features enabled */
1457# define TV_FUSE_STATE_ENABLED (0 << 4)
1458/** Read-only state that reports that Macrovision is disabled in hardware*/
1459# define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
1460/** Read-only state that reports that TV-out is disabled in hardware. */
1461# define TV_FUSE_STATE_DISABLED (2 << 4)
1462/** Normal operation */
1463# define TV_TEST_MODE_NORMAL (0 << 0)
1464/** Encoder test pattern 1 - combo pattern */
1465# define TV_TEST_MODE_PATTERN_1 (1 << 0)
1466/** Encoder test pattern 2 - full screen vertical 75% color bars */
1467# define TV_TEST_MODE_PATTERN_2 (2 << 0)
1468/** Encoder test pattern 3 - full screen horizontal 75% color bars */
1469# define TV_TEST_MODE_PATTERN_3 (3 << 0)
1470/** Encoder test pattern 4 - random noise */
1471# define TV_TEST_MODE_PATTERN_4 (4 << 0)
1472/** Encoder test pattern 5 - linear color ramps */
1473# define TV_TEST_MODE_PATTERN_5 (5 << 0)
1474/**
1475 * This test mode forces the DACs to 50% of full output.
1476 *
1477 * This is used for load detection in combination with TVDAC_SENSE_MASK
1478 */
1479# define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
1480# define TV_TEST_MODE_MASK (7 << 0)
1481
1482#define TV_DAC 0x68004
1483/**
1484 * Reports that DAC state change logic has reported change (RO).
1485 *
1486 * This gets cleared when TV_DAC_STATE_EN is cleared
1487*/
1488# define TVDAC_STATE_CHG (1 << 31)
1489# define TVDAC_SENSE_MASK (7 << 28)
1490/** Reports that DAC A voltage is above the detect threshold */
1491# define TVDAC_A_SENSE (1 << 30)
1492/** Reports that DAC B voltage is above the detect threshold */
1493# define TVDAC_B_SENSE (1 << 29)
1494/** Reports that DAC C voltage is above the detect threshold */
1495# define TVDAC_C_SENSE (1 << 28)
1496/**
1497 * Enables DAC state detection logic, for load-based TV detection.
1498 *
1499 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
1500 * to off, for load detection to work.
1501 */
1502# define TVDAC_STATE_CHG_EN (1 << 27)
1503/** Sets the DAC A sense value to high */
1504# define TVDAC_A_SENSE_CTL (1 << 26)
1505/** Sets the DAC B sense value to high */
1506# define TVDAC_B_SENSE_CTL (1 << 25)
1507/** Sets the DAC C sense value to high */
1508# define TVDAC_C_SENSE_CTL (1 << 24)
1509/** Overrides the ENC_ENABLE and DAC voltage levels */
1510# define DAC_CTL_OVERRIDE (1 << 7)
1511/** Sets the slew rate. Must be preserved in software */
1512# define ENC_TVDAC_SLEW_FAST (1 << 6)
1513# define DAC_A_1_3_V (0 << 4)
1514# define DAC_A_1_1_V (1 << 4)
1515# define DAC_A_0_7_V (2 << 4)
cb66c692 1516# define DAC_A_MASK (3 << 4)
585fb111
JB
1517# define DAC_B_1_3_V (0 << 2)
1518# define DAC_B_1_1_V (1 << 2)
1519# define DAC_B_0_7_V (2 << 2)
cb66c692 1520# define DAC_B_MASK (3 << 2)
585fb111
JB
1521# define DAC_C_1_3_V (0 << 0)
1522# define DAC_C_1_1_V (1 << 0)
1523# define DAC_C_0_7_V (2 << 0)
cb66c692 1524# define DAC_C_MASK (3 << 0)
585fb111
JB
1525
1526/**
1527 * CSC coefficients are stored in a floating point format with 9 bits of
1528 * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
1529 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
1530 * -1 (0x3) being the only legal negative value.
1531 */
1532#define TV_CSC_Y 0x68010
1533# define TV_RY_MASK 0x07ff0000
1534# define TV_RY_SHIFT 16
1535# define TV_GY_MASK 0x00000fff
1536# define TV_GY_SHIFT 0
1537
1538#define TV_CSC_Y2 0x68014
1539# define TV_BY_MASK 0x07ff0000
1540# define TV_BY_SHIFT 16
1541/**
1542 * Y attenuation for component video.
1543 *
1544 * Stored in 1.9 fixed point.
1545 */
1546# define TV_AY_MASK 0x000003ff
1547# define TV_AY_SHIFT 0
1548
1549#define TV_CSC_U 0x68018
1550# define TV_RU_MASK 0x07ff0000
1551# define TV_RU_SHIFT 16
1552# define TV_GU_MASK 0x000007ff
1553# define TV_GU_SHIFT 0
1554
1555#define TV_CSC_U2 0x6801c
1556# define TV_BU_MASK 0x07ff0000
1557# define TV_BU_SHIFT 16
1558/**
1559 * U attenuation for component video.
1560 *
1561 * Stored in 1.9 fixed point.
1562 */
1563# define TV_AU_MASK 0x000003ff
1564# define TV_AU_SHIFT 0
1565
1566#define TV_CSC_V 0x68020
1567# define TV_RV_MASK 0x0fff0000
1568# define TV_RV_SHIFT 16
1569# define TV_GV_MASK 0x000007ff
1570# define TV_GV_SHIFT 0
1571
1572#define TV_CSC_V2 0x68024
1573# define TV_BV_MASK 0x07ff0000
1574# define TV_BV_SHIFT 16
1575/**
1576 * V attenuation for component video.
1577 *
1578 * Stored in 1.9 fixed point.
1579 */
1580# define TV_AV_MASK 0x000007ff
1581# define TV_AV_SHIFT 0
1582
1583#define TV_CLR_KNOBS 0x68028
1584/** 2s-complement brightness adjustment */
1585# define TV_BRIGHTNESS_MASK 0xff000000
1586# define TV_BRIGHTNESS_SHIFT 24
1587/** Contrast adjustment, as a 2.6 unsigned floating point number */
1588# define TV_CONTRAST_MASK 0x00ff0000
1589# define TV_CONTRAST_SHIFT 16
1590/** Saturation adjustment, as a 2.6 unsigned floating point number */
1591# define TV_SATURATION_MASK 0x0000ff00
1592# define TV_SATURATION_SHIFT 8
1593/** Hue adjustment, as an integer phase angle in degrees */
1594# define TV_HUE_MASK 0x000000ff
1595# define TV_HUE_SHIFT 0
1596
1597#define TV_CLR_LEVEL 0x6802c
1598/** Controls the DAC level for black */
1599# define TV_BLACK_LEVEL_MASK 0x01ff0000
1600# define TV_BLACK_LEVEL_SHIFT 16
1601/** Controls the DAC level for blanking */
1602# define TV_BLANK_LEVEL_MASK 0x000001ff
1603# define TV_BLANK_LEVEL_SHIFT 0
1604
1605#define TV_H_CTL_1 0x68030
1606/** Number of pixels in the hsync. */
1607# define TV_HSYNC_END_MASK 0x1fff0000
1608# define TV_HSYNC_END_SHIFT 16
1609/** Total number of pixels minus one in the line (display and blanking). */
1610# define TV_HTOTAL_MASK 0x00001fff
1611# define TV_HTOTAL_SHIFT 0
1612
1613#define TV_H_CTL_2 0x68034
1614/** Enables the colorburst (needed for non-component color) */
1615# define TV_BURST_ENA (1 << 31)
1616/** Offset of the colorburst from the start of hsync, in pixels minus one. */
1617# define TV_HBURST_START_SHIFT 16
1618# define TV_HBURST_START_MASK 0x1fff0000
1619/** Length of the colorburst */
1620# define TV_HBURST_LEN_SHIFT 0
1621# define TV_HBURST_LEN_MASK 0x0001fff
1622
1623#define TV_H_CTL_3 0x68038
1624/** End of hblank, measured in pixels minus one from start of hsync */
1625# define TV_HBLANK_END_SHIFT 16
1626# define TV_HBLANK_END_MASK 0x1fff0000
1627/** Start of hblank, measured in pixels minus one from start of hsync */
1628# define TV_HBLANK_START_SHIFT 0
1629# define TV_HBLANK_START_MASK 0x0001fff
1630
1631#define TV_V_CTL_1 0x6803c
1632/** XXX */
1633# define TV_NBR_END_SHIFT 16
1634# define TV_NBR_END_MASK 0x07ff0000
1635/** XXX */
1636# define TV_VI_END_F1_SHIFT 8
1637# define TV_VI_END_F1_MASK 0x00003f00
1638/** XXX */
1639# define TV_VI_END_F2_SHIFT 0
1640# define TV_VI_END_F2_MASK 0x0000003f
1641
1642#define TV_V_CTL_2 0x68040
1643/** Length of vsync, in half lines */
1644# define TV_VSYNC_LEN_MASK 0x07ff0000
1645# define TV_VSYNC_LEN_SHIFT 16
1646/** Offset of the start of vsync in field 1, measured in one less than the
1647 * number of half lines.
1648 */
1649# define TV_VSYNC_START_F1_MASK 0x00007f00
1650# define TV_VSYNC_START_F1_SHIFT 8
1651/**
1652 * Offset of the start of vsync in field 2, measured in one less than the
1653 * number of half lines.
1654 */
1655# define TV_VSYNC_START_F2_MASK 0x0000007f
1656# define TV_VSYNC_START_F2_SHIFT 0
1657
1658#define TV_V_CTL_3 0x68044
1659/** Enables generation of the equalization signal */
1660# define TV_EQUAL_ENA (1 << 31)
1661/** Length of vsync, in half lines */
1662# define TV_VEQ_LEN_MASK 0x007f0000
1663# define TV_VEQ_LEN_SHIFT 16
1664/** Offset of the start of equalization in field 1, measured in one less than
1665 * the number of half lines.
1666 */
1667# define TV_VEQ_START_F1_MASK 0x0007f00
1668# define TV_VEQ_START_F1_SHIFT 8
1669/**
1670 * Offset of the start of equalization in field 2, measured in one less than
1671 * the number of half lines.
1672 */
1673# define TV_VEQ_START_F2_MASK 0x000007f
1674# define TV_VEQ_START_F2_SHIFT 0
1675
1676#define TV_V_CTL_4 0x68048
1677/**
1678 * Offset to start of vertical colorburst, measured in one less than the
1679 * number of lines from vertical start.
1680 */
1681# define TV_VBURST_START_F1_MASK 0x003f0000
1682# define TV_VBURST_START_F1_SHIFT 16
1683/**
1684 * Offset to the end of vertical colorburst, measured in one less than the
1685 * number of lines from the start of NBR.
1686 */
1687# define TV_VBURST_END_F1_MASK 0x000000ff
1688# define TV_VBURST_END_F1_SHIFT 0
1689
1690#define TV_V_CTL_5 0x6804c
1691/**
1692 * Offset to start of vertical colorburst, measured in one less than the
1693 * number of lines from vertical start.
1694 */
1695# define TV_VBURST_START_F2_MASK 0x003f0000
1696# define TV_VBURST_START_F2_SHIFT 16
1697/**
1698 * Offset to the end of vertical colorburst, measured in one less than the
1699 * number of lines from the start of NBR.
1700 */
1701# define TV_VBURST_END_F2_MASK 0x000000ff
1702# define TV_VBURST_END_F2_SHIFT 0
1703
1704#define TV_V_CTL_6 0x68050
1705/**
1706 * Offset to start of vertical colorburst, measured in one less than the
1707 * number of lines from vertical start.
1708 */
1709# define TV_VBURST_START_F3_MASK 0x003f0000
1710# define TV_VBURST_START_F3_SHIFT 16
1711/**
1712 * Offset to the end of vertical colorburst, measured in one less than the
1713 * number of lines from the start of NBR.
1714 */
1715# define TV_VBURST_END_F3_MASK 0x000000ff
1716# define TV_VBURST_END_F3_SHIFT 0
1717
1718#define TV_V_CTL_7 0x68054
1719/**
1720 * Offset to start of vertical colorburst, measured in one less than the
1721 * number of lines from vertical start.
1722 */
1723# define TV_VBURST_START_F4_MASK 0x003f0000
1724# define TV_VBURST_START_F4_SHIFT 16
1725/**
1726 * Offset to the end of vertical colorburst, measured in one less than the
1727 * number of lines from the start of NBR.
1728 */
1729# define TV_VBURST_END_F4_MASK 0x000000ff
1730# define TV_VBURST_END_F4_SHIFT 0
1731
1732#define TV_SC_CTL_1 0x68060
1733/** Turns on the first subcarrier phase generation DDA */
1734# define TV_SC_DDA1_EN (1 << 31)
1735/** Turns on the first subcarrier phase generation DDA */
1736# define TV_SC_DDA2_EN (1 << 30)
1737/** Turns on the first subcarrier phase generation DDA */
1738# define TV_SC_DDA3_EN (1 << 29)
1739/** Sets the subcarrier DDA to reset frequency every other field */
1740# define TV_SC_RESET_EVERY_2 (0 << 24)
1741/** Sets the subcarrier DDA to reset frequency every fourth field */
1742# define TV_SC_RESET_EVERY_4 (1 << 24)
1743/** Sets the subcarrier DDA to reset frequency every eighth field */
1744# define TV_SC_RESET_EVERY_8 (2 << 24)
1745/** Sets the subcarrier DDA to never reset the frequency */
1746# define TV_SC_RESET_NEVER (3 << 24)
1747/** Sets the peak amplitude of the colorburst.*/
1748# define TV_BURST_LEVEL_MASK 0x00ff0000
1749# define TV_BURST_LEVEL_SHIFT 16
1750/** Sets the increment of the first subcarrier phase generation DDA */
1751# define TV_SCDDA1_INC_MASK 0x00000fff
1752# define TV_SCDDA1_INC_SHIFT 0
1753
1754#define TV_SC_CTL_2 0x68064
1755/** Sets the rollover for the second subcarrier phase generation DDA */
1756# define TV_SCDDA2_SIZE_MASK 0x7fff0000
1757# define TV_SCDDA2_SIZE_SHIFT 16
1758/** Sets the increent of the second subcarrier phase generation DDA */
1759# define TV_SCDDA2_INC_MASK 0x00007fff
1760# define TV_SCDDA2_INC_SHIFT 0
1761
1762#define TV_SC_CTL_3 0x68068
1763/** Sets the rollover for the third subcarrier phase generation DDA */
1764# define TV_SCDDA3_SIZE_MASK 0x7fff0000
1765# define TV_SCDDA3_SIZE_SHIFT 16
1766/** Sets the increent of the third subcarrier phase generation DDA */
1767# define TV_SCDDA3_INC_MASK 0x00007fff
1768# define TV_SCDDA3_INC_SHIFT 0
1769
1770#define TV_WIN_POS 0x68070
1771/** X coordinate of the display from the start of horizontal active */
1772# define TV_XPOS_MASK 0x1fff0000
1773# define TV_XPOS_SHIFT 16
1774/** Y coordinate of the display from the start of vertical active (NBR) */
1775# define TV_YPOS_MASK 0x00000fff
1776# define TV_YPOS_SHIFT 0
1777
1778#define TV_WIN_SIZE 0x68074
1779/** Horizontal size of the display window, measured in pixels*/
1780# define TV_XSIZE_MASK 0x1fff0000
1781# define TV_XSIZE_SHIFT 16
1782/**
1783 * Vertical size of the display window, measured in pixels.
1784 *
1785 * Must be even for interlaced modes.
1786 */
1787# define TV_YSIZE_MASK 0x00000fff
1788# define TV_YSIZE_SHIFT 0
1789
1790#define TV_FILTER_CTL_1 0x68080
1791/**
1792 * Enables automatic scaling calculation.
1793 *
1794 * If set, the rest of the registers are ignored, and the calculated values can
1795 * be read back from the register.
1796 */
1797# define TV_AUTO_SCALE (1 << 31)
1798/**
1799 * Disables the vertical filter.
1800 *
1801 * This is required on modes more than 1024 pixels wide */
1802# define TV_V_FILTER_BYPASS (1 << 29)
1803/** Enables adaptive vertical filtering */
1804# define TV_VADAPT (1 << 28)
1805# define TV_VADAPT_MODE_MASK (3 << 26)
1806/** Selects the least adaptive vertical filtering mode */
1807# define TV_VADAPT_MODE_LEAST (0 << 26)
1808/** Selects the moderately adaptive vertical filtering mode */
1809# define TV_VADAPT_MODE_MODERATE (1 << 26)
1810/** Selects the most adaptive vertical filtering mode */
1811# define TV_VADAPT_MODE_MOST (3 << 26)
1812/**
1813 * Sets the horizontal scaling factor.
1814 *
1815 * This should be the fractional part of the horizontal scaling factor divided
1816 * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
1817 *
1818 * (src width - 1) / ((oversample * dest width) - 1)
1819 */
1820# define TV_HSCALE_FRAC_MASK 0x00003fff
1821# define TV_HSCALE_FRAC_SHIFT 0
1822
1823#define TV_FILTER_CTL_2 0x68084
1824/**
1825 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
1826 *
1827 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
1828 */
1829# define TV_VSCALE_INT_MASK 0x00038000
1830# define TV_VSCALE_INT_SHIFT 15
1831/**
1832 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
1833 *
1834 * \sa TV_VSCALE_INT_MASK
1835 */
1836# define TV_VSCALE_FRAC_MASK 0x00007fff
1837# define TV_VSCALE_FRAC_SHIFT 0
1838
1839#define TV_FILTER_CTL_3 0x68088
1840/**
1841 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
1842 *
1843 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
1844 *
1845 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
1846 */
1847# define TV_VSCALE_IP_INT_MASK 0x00038000
1848# define TV_VSCALE_IP_INT_SHIFT 15
1849/**
1850 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
1851 *
1852 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
1853 *
1854 * \sa TV_VSCALE_IP_INT_MASK
1855 */
1856# define TV_VSCALE_IP_FRAC_MASK 0x00007fff
1857# define TV_VSCALE_IP_FRAC_SHIFT 0
1858
1859#define TV_CC_CONTROL 0x68090
1860# define TV_CC_ENABLE (1 << 31)
1861/**
1862 * Specifies which field to send the CC data in.
1863 *
1864 * CC data is usually sent in field 0.
1865 */
1866# define TV_CC_FID_MASK (1 << 27)
1867# define TV_CC_FID_SHIFT 27
1868/** Sets the horizontal position of the CC data. Usually 135. */
1869# define TV_CC_HOFF_MASK 0x03ff0000
1870# define TV_CC_HOFF_SHIFT 16
1871/** Sets the vertical position of the CC data. Usually 21 */
1872# define TV_CC_LINE_MASK 0x0000003f
1873# define TV_CC_LINE_SHIFT 0
1874
1875#define TV_CC_DATA 0x68094
1876# define TV_CC_RDY (1 << 31)
1877/** Second word of CC data to be transmitted. */
1878# define TV_CC_DATA_2_MASK 0x007f0000
1879# define TV_CC_DATA_2_SHIFT 16
1880/** First word of CC data to be transmitted. */
1881# define TV_CC_DATA_1_MASK 0x0000007f
1882# define TV_CC_DATA_1_SHIFT 0
1883
1884#define TV_H_LUMA_0 0x68100
1885#define TV_H_LUMA_59 0x681ec
1886#define TV_H_CHROMA_0 0x68200
1887#define TV_H_CHROMA_59 0x682ec
1888#define TV_V_LUMA_0 0x68300
1889#define TV_V_LUMA_42 0x683a8
1890#define TV_V_CHROMA_0 0x68400
1891#define TV_V_CHROMA_42 0x684a8
1892
040d87f1 1893/* Display Port */
32f9d658 1894#define DP_A 0x64000 /* eDP */
040d87f1
KP
1895#define DP_B 0x64100
1896#define DP_C 0x64200
1897#define DP_D 0x64300
1898
1899#define DP_PORT_EN (1 << 31)
1900#define DP_PIPEB_SELECT (1 << 30)
1901
1902/* Link training mode - select a suitable mode for each stage */
1903#define DP_LINK_TRAIN_PAT_1 (0 << 28)
1904#define DP_LINK_TRAIN_PAT_2 (1 << 28)
1905#define DP_LINK_TRAIN_PAT_IDLE (2 << 28)
1906#define DP_LINK_TRAIN_OFF (3 << 28)
1907#define DP_LINK_TRAIN_MASK (3 << 28)
1908#define DP_LINK_TRAIN_SHIFT 28
1909
8db9d77b
ZW
1910/* CPT Link training mode */
1911#define DP_LINK_TRAIN_PAT_1_CPT (0 << 8)
1912#define DP_LINK_TRAIN_PAT_2_CPT (1 << 8)
1913#define DP_LINK_TRAIN_PAT_IDLE_CPT (2 << 8)
1914#define DP_LINK_TRAIN_OFF_CPT (3 << 8)
1915#define DP_LINK_TRAIN_MASK_CPT (7 << 8)
1916#define DP_LINK_TRAIN_SHIFT_CPT 8
1917
040d87f1
KP
1918/* Signal voltages. These are mostly controlled by the other end */
1919#define DP_VOLTAGE_0_4 (0 << 25)
1920#define DP_VOLTAGE_0_6 (1 << 25)
1921#define DP_VOLTAGE_0_8 (2 << 25)
1922#define DP_VOLTAGE_1_2 (3 << 25)
1923#define DP_VOLTAGE_MASK (7 << 25)
1924#define DP_VOLTAGE_SHIFT 25
1925
1926/* Signal pre-emphasis levels, like voltages, the other end tells us what
1927 * they want
1928 */
1929#define DP_PRE_EMPHASIS_0 (0 << 22)
1930#define DP_PRE_EMPHASIS_3_5 (1 << 22)
1931#define DP_PRE_EMPHASIS_6 (2 << 22)
1932#define DP_PRE_EMPHASIS_9_5 (3 << 22)
1933#define DP_PRE_EMPHASIS_MASK (7 << 22)
1934#define DP_PRE_EMPHASIS_SHIFT 22
1935
1936/* How many wires to use. I guess 3 was too hard */
1937#define DP_PORT_WIDTH_1 (0 << 19)
1938#define DP_PORT_WIDTH_2 (1 << 19)
1939#define DP_PORT_WIDTH_4 (3 << 19)
1940#define DP_PORT_WIDTH_MASK (7 << 19)
1941
1942/* Mystic DPCD version 1.1 special mode */
1943#define DP_ENHANCED_FRAMING (1 << 18)
1944
32f9d658
ZW
1945/* eDP */
1946#define DP_PLL_FREQ_270MHZ (0 << 16)
1947#define DP_PLL_FREQ_160MHZ (1 << 16)
1948#define DP_PLL_FREQ_MASK (3 << 16)
1949
040d87f1
KP
1950/** locked once port is enabled */
1951#define DP_PORT_REVERSAL (1 << 15)
1952
32f9d658
ZW
1953/* eDP */
1954#define DP_PLL_ENABLE (1 << 14)
1955
040d87f1
KP
1956/** sends the clock on lane 15 of the PEG for debug */
1957#define DP_CLOCK_OUTPUT_ENABLE (1 << 13)
1958
1959#define DP_SCRAMBLING_DISABLE (1 << 12)
f2b115e6 1960#define DP_SCRAMBLING_DISABLE_IRONLAKE (1 << 7)
040d87f1
KP
1961
1962/** limit RGB values to avoid confusing TVs */
1963#define DP_COLOR_RANGE_16_235 (1 << 8)
1964
1965/** Turn on the audio link */
1966#define DP_AUDIO_OUTPUT_ENABLE (1 << 6)
1967
1968/** vs and hs sync polarity */
1969#define DP_SYNC_VS_HIGH (1 << 4)
1970#define DP_SYNC_HS_HIGH (1 << 3)
1971
1972/** A fantasy */
1973#define DP_DETECTED (1 << 2)
1974
1975/** The aux channel provides a way to talk to the
1976 * signal sink for DDC etc. Max packet size supported
1977 * is 20 bytes in each direction, hence the 5 fixed
1978 * data registers
1979 */
32f9d658
ZW
1980#define DPA_AUX_CH_CTL 0x64010
1981#define DPA_AUX_CH_DATA1 0x64014
1982#define DPA_AUX_CH_DATA2 0x64018
1983#define DPA_AUX_CH_DATA3 0x6401c
1984#define DPA_AUX_CH_DATA4 0x64020
1985#define DPA_AUX_CH_DATA5 0x64024
1986
040d87f1
KP
1987#define DPB_AUX_CH_CTL 0x64110
1988#define DPB_AUX_CH_DATA1 0x64114
1989#define DPB_AUX_CH_DATA2 0x64118
1990#define DPB_AUX_CH_DATA3 0x6411c
1991#define DPB_AUX_CH_DATA4 0x64120
1992#define DPB_AUX_CH_DATA5 0x64124
1993
1994#define DPC_AUX_CH_CTL 0x64210
1995#define DPC_AUX_CH_DATA1 0x64214
1996#define DPC_AUX_CH_DATA2 0x64218
1997#define DPC_AUX_CH_DATA3 0x6421c
1998#define DPC_AUX_CH_DATA4 0x64220
1999#define DPC_AUX_CH_DATA5 0x64224
2000
2001#define DPD_AUX_CH_CTL 0x64310
2002#define DPD_AUX_CH_DATA1 0x64314
2003#define DPD_AUX_CH_DATA2 0x64318
2004#define DPD_AUX_CH_DATA3 0x6431c
2005#define DPD_AUX_CH_DATA4 0x64320
2006#define DPD_AUX_CH_DATA5 0x64324
2007
2008#define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
2009#define DP_AUX_CH_CTL_DONE (1 << 30)
2010#define DP_AUX_CH_CTL_INTERRUPT (1 << 29)
2011#define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28)
2012#define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26)
2013#define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26)
2014#define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26)
2015#define DP_AUX_CH_CTL_TIME_OUT_1600us (3 << 26)
2016#define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26)
2017#define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25)
2018#define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
2019#define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20
2020#define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16)
2021#define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16
2022#define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15)
2023#define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14)
2024#define DP_AUX_CH_CTL_SYNC_TEST (1 << 13)
2025#define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12)
2026#define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)
2027#define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)
2028#define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0
2029
2030/*
2031 * Computing GMCH M and N values for the Display Port link
2032 *
2033 * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
2034 *
2035 * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
2036 *
2037 * The GMCH value is used internally
2038 *
2039 * bytes_per_pixel is the number of bytes coming out of the plane,
2040 * which is after the LUTs, so we want the bytes for our color format.
2041 * For our current usage, this is always 3, one byte for R, G and B.
2042 */
2043#define PIPEA_GMCH_DATA_M 0x70050
2044#define PIPEB_GMCH_DATA_M 0x71050
2045
2046/* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
2047#define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
2048#define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
2049
2050#define PIPE_GMCH_DATA_M_MASK (0xffffff)
2051
2052#define PIPEA_GMCH_DATA_N 0x70054
2053#define PIPEB_GMCH_DATA_N 0x71054
2054#define PIPE_GMCH_DATA_N_MASK (0xffffff)
2055
2056/*
2057 * Computing Link M and N values for the Display Port link
2058 *
2059 * Link M / N = pixel_clock / ls_clk
2060 *
2061 * (the DP spec calls pixel_clock the 'strm_clk')
2062 *
2063 * The Link value is transmitted in the Main Stream
2064 * Attributes and VB-ID.
2065 */
2066
2067#define PIPEA_DP_LINK_M 0x70060
2068#define PIPEB_DP_LINK_M 0x71060
2069#define PIPEA_DP_LINK_M_MASK (0xffffff)
2070
2071#define PIPEA_DP_LINK_N 0x70064
2072#define PIPEB_DP_LINK_N 0x71064
2073#define PIPEA_DP_LINK_N_MASK (0xffffff)
2074
585fb111
JB
2075/* Display & cursor control */
2076
898822ce 2077/* dithering flag on Ironlake */
0a31a448
AJ
2078#define PIPE_ENABLE_DITHER (1 << 4)
2079#define PIPE_DITHER_TYPE_MASK (3 << 2)
2080#define PIPE_DITHER_TYPE_SPATIAL (0 << 2)
2081#define PIPE_DITHER_TYPE_ST01 (1 << 2)
585fb111
JB
2082/* Pipe A */
2083#define PIPEADSL 0x70000
9d0498a2 2084#define DSL_LINEMASK 0x00000fff
585fb111
JB
2085#define PIPEACONF 0x70008
2086#define PIPEACONF_ENABLE (1<<31)
2087#define PIPEACONF_DISABLE 0
2088#define PIPEACONF_DOUBLE_WIDE (1<<30)
2089#define I965_PIPECONF_ACTIVE (1<<30)
2090#define PIPEACONF_SINGLE_WIDE 0
2091#define PIPEACONF_PIPE_UNLOCKED 0
2092#define PIPEACONF_PIPE_LOCKED (1<<25)
2093#define PIPEACONF_PALETTE 0
2094#define PIPEACONF_GAMMA (1<<24)
2095#define PIPECONF_FORCE_BORDER (1<<25)
2096#define PIPECONF_PROGRESSIVE (0 << 21)
2097#define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
2098#define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
652c393a 2099#define PIPECONF_CXSR_DOWNCLOCK (1<<16)
585fb111
JB
2100#define PIPEASTAT 0x70024
2101#define PIPE_FIFO_UNDERRUN_STATUS (1UL<<31)
2102#define PIPE_CRC_ERROR_ENABLE (1UL<<29)
2103#define PIPE_CRC_DONE_ENABLE (1UL<<28)
2104#define PIPE_GMBUS_EVENT_ENABLE (1UL<<27)
2105#define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL<<26)
2106#define PIPE_VSYNC_INTERRUPT_ENABLE (1UL<<25)
2107#define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
2108#define PIPE_DPST_EVENT_ENABLE (1UL<<23)
2109#define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
2110#define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
2111#define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
2112#define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL<<18) /* pre-965 */
2113#define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
2114#define PIPE_VBLANK_INTERRUPT_ENABLE (1UL<<17)
2115#define PIPE_OVERLAY_UPDATED_ENABLE (1UL<<16)
2116#define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
2117#define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
2118#define PIPE_GMBUS_INTERRUPT_STATUS (1UL<<11)
2119#define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL<<10)
2120#define PIPE_VSYNC_INTERRUPT_STATUS (1UL<<9)
2121#define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
2122#define PIPE_DPST_EVENT_STATUS (1UL<<7)
2123#define PIPE_LEGACY_BLC_EVENT_STATUS (1UL<<6)
2124#define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
2125#define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
2126#define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL<<2) /* pre-965 */
2127#define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
2128#define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
2129#define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
58a27471
ZW
2130#define PIPE_BPC_MASK (7 << 5) /* Ironlake */
2131#define PIPE_8BPC (0 << 5)
2132#define PIPE_10BPC (1 << 5)
2133#define PIPE_6BPC (2 << 5)
2134#define PIPE_12BPC (3 << 5)
585fb111
JB
2135
2136#define DSPARB 0x70030
2137#define DSPARB_CSTART_MASK (0x7f << 7)
2138#define DSPARB_CSTART_SHIFT 7
2139#define DSPARB_BSTART_MASK (0x7f)
2140#define DSPARB_BSTART_SHIFT 0
7662c8bd
SL
2141#define DSPARB_BEND_SHIFT 9 /* on 855 */
2142#define DSPARB_AEND_SHIFT 0
2143
2144#define DSPFW1 0x70034
0e442c60 2145#define DSPFW_SR_SHIFT 23
d4294342 2146#define DSPFW_SR_MASK (0x1ff<<23)
0e442c60 2147#define DSPFW_CURSORB_SHIFT 16
d4294342 2148#define DSPFW_CURSORB_MASK (0x3f<<16)
0e442c60 2149#define DSPFW_PLANEB_SHIFT 8
d4294342
ZY
2150#define DSPFW_PLANEB_MASK (0x7f<<8)
2151#define DSPFW_PLANEA_MASK (0x7f)
7662c8bd 2152#define DSPFW2 0x70038
0e442c60 2153#define DSPFW_CURSORA_MASK 0x00003f00
21bd770b 2154#define DSPFW_CURSORA_SHIFT 8
d4294342 2155#define DSPFW_PLANEC_MASK (0x7f)
7662c8bd 2156#define DSPFW3 0x7003c
0e442c60
JB
2157#define DSPFW_HPLL_SR_EN (1<<31)
2158#define DSPFW_CURSOR_SR_SHIFT 24
f2b115e6 2159#define PINEVIEW_SELF_REFRESH_EN (1<<30)
d4294342
ZY
2160#define DSPFW_CURSOR_SR_MASK (0x3f<<24)
2161#define DSPFW_HPLL_CURSOR_SHIFT 16
2162#define DSPFW_HPLL_CURSOR_MASK (0x3f<<16)
2163#define DSPFW_HPLL_SR_MASK (0x1ff)
7662c8bd
SL
2164
2165/* FIFO watermark sizes etc */
0e442c60 2166#define G4X_FIFO_LINE_SIZE 64
7662c8bd
SL
2167#define I915_FIFO_LINE_SIZE 64
2168#define I830_FIFO_LINE_SIZE 32
0e442c60
JB
2169
2170#define G4X_FIFO_SIZE 127
1b07e04e
ZY
2171#define I965_FIFO_SIZE 512
2172#define I945_FIFO_SIZE 127
7662c8bd 2173#define I915_FIFO_SIZE 95
dff33cfc 2174#define I855GM_FIFO_SIZE 127 /* In cachelines */
7662c8bd 2175#define I830_FIFO_SIZE 95
0e442c60
JB
2176
2177#define G4X_MAX_WM 0x3f
7662c8bd
SL
2178#define I915_MAX_WM 0x3f
2179
f2b115e6
AJ
2180#define PINEVIEW_DISPLAY_FIFO 512 /* in 64byte unit */
2181#define PINEVIEW_FIFO_LINE_SIZE 64
2182#define PINEVIEW_MAX_WM 0x1ff
2183#define PINEVIEW_DFT_WM 0x3f
2184#define PINEVIEW_DFT_HPLLOFF_WM 0
2185#define PINEVIEW_GUARD_WM 10
2186#define PINEVIEW_CURSOR_FIFO 64
2187#define PINEVIEW_CURSOR_MAX_WM 0x3f
2188#define PINEVIEW_CURSOR_DFT_WM 0
2189#define PINEVIEW_CURSOR_GUARD_WM 5
7662c8bd 2190
4fe5e611
ZY
2191#define I965_CURSOR_FIFO 64
2192#define I965_CURSOR_MAX_WM 32
2193#define I965_CURSOR_DFT_WM 8
7f8a8569
ZW
2194
2195/* define the Watermark register on Ironlake */
2196#define WM0_PIPEA_ILK 0x45100
2197#define WM0_PIPE_PLANE_MASK (0x7f<<16)
2198#define WM0_PIPE_PLANE_SHIFT 16
2199#define WM0_PIPE_SPRITE_MASK (0x3f<<8)
2200#define WM0_PIPE_SPRITE_SHIFT 8
2201#define WM0_PIPE_CURSOR_MASK (0x1f)
2202
2203#define WM0_PIPEB_ILK 0x45104
2204#define WM1_LP_ILK 0x45108
2205#define WM1_LP_SR_EN (1<<31)
2206#define WM1_LP_LATENCY_SHIFT 24
2207#define WM1_LP_LATENCY_MASK (0x7f<<24)
2208#define WM1_LP_SR_MASK (0x1ff<<8)
2209#define WM1_LP_SR_SHIFT 8
2210#define WM1_LP_CURSOR_MASK (0x3f)
2211
2212/* Memory latency timer register */
2213#define MLTR_ILK 0x11222
2214/* the unit of memory self-refresh latency time is 0.5us */
2215#define ILK_SRLT_MASK 0x3f
2216
2217/* define the fifo size on Ironlake */
2218#define ILK_DISPLAY_FIFO 128
2219#define ILK_DISPLAY_MAXWM 64
2220#define ILK_DISPLAY_DFTWM 8
c936f44d
ZY
2221#define ILK_CURSOR_FIFO 32
2222#define ILK_CURSOR_MAXWM 16
2223#define ILK_CURSOR_DFTWM 8
7f8a8569
ZW
2224
2225#define ILK_DISPLAY_SR_FIFO 512
2226#define ILK_DISPLAY_MAX_SRWM 0x1ff
2227#define ILK_DISPLAY_DFT_SRWM 0x3f
2228#define ILK_CURSOR_SR_FIFO 64
2229#define ILK_CURSOR_MAX_SRWM 0x3f
2230#define ILK_CURSOR_DFT_SRWM 8
2231
2232#define ILK_FIFO_LINE_SIZE 64
2233
585fb111
JB
2234/*
2235 * The two pipe frame counter registers are not synchronized, so
2236 * reading a stable value is somewhat tricky. The following code
2237 * should work:
2238 *
2239 * do {
2240 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
2241 * PIPE_FRAME_HIGH_SHIFT;
2242 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
2243 * PIPE_FRAME_LOW_SHIFT);
2244 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
2245 * PIPE_FRAME_HIGH_SHIFT);
2246 * } while (high1 != high2);
2247 * frame = (high1 << 8) | low1;
2248 */
2249#define PIPEAFRAMEHIGH 0x70040
2250#define PIPE_FRAME_HIGH_MASK 0x0000ffff
2251#define PIPE_FRAME_HIGH_SHIFT 0
2252#define PIPEAFRAMEPIXEL 0x70044
2253#define PIPE_FRAME_LOW_MASK 0xff000000
2254#define PIPE_FRAME_LOW_SHIFT 24
2255#define PIPE_PIXEL_MASK 0x00ffffff
2256#define PIPE_PIXEL_SHIFT 0
9880b7a5
JB
2257/* GM45+ just has to be different */
2258#define PIPEA_FRMCOUNT_GM45 0x70040
2259#define PIPEA_FLIPCOUNT_GM45 0x70044
585fb111
JB
2260
2261/* Cursor A & B regs */
2262#define CURACNTR 0x70080
14b60391
JB
2263/* Old style CUR*CNTR flags (desktop 8xx) */
2264#define CURSOR_ENABLE 0x80000000
2265#define CURSOR_GAMMA_ENABLE 0x40000000
2266#define CURSOR_STRIDE_MASK 0x30000000
2267#define CURSOR_FORMAT_SHIFT 24
2268#define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
2269#define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
2270#define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
2271#define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
2272#define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
2273#define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
2274/* New style CUR*CNTR flags */
2275#define CURSOR_MODE 0x27
585fb111
JB
2276#define CURSOR_MODE_DISABLE 0x00
2277#define CURSOR_MODE_64_32B_AX 0x07
2278#define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
14b60391
JB
2279#define MCURSOR_PIPE_SELECT (1 << 28)
2280#define MCURSOR_PIPE_A 0x00
2281#define MCURSOR_PIPE_B (1 << 28)
585fb111
JB
2282#define MCURSOR_GAMMA_ENABLE (1 << 26)
2283#define CURABASE 0x70084
2284#define CURAPOS 0x70088
2285#define CURSOR_POS_MASK 0x007FF
2286#define CURSOR_POS_SIGN 0x8000
2287#define CURSOR_X_SHIFT 0
2288#define CURSOR_Y_SHIFT 16
14b60391 2289#define CURSIZE 0x700a0
585fb111
JB
2290#define CURBCNTR 0x700c0
2291#define CURBBASE 0x700c4
2292#define CURBPOS 0x700c8
2293
2294/* Display A control */
2295#define DSPACNTR 0x70180
2296#define DISPLAY_PLANE_ENABLE (1<<31)
2297#define DISPLAY_PLANE_DISABLE 0
2298#define DISPPLANE_GAMMA_ENABLE (1<<30)
2299#define DISPPLANE_GAMMA_DISABLE 0
2300#define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
2301#define DISPPLANE_8BPP (0x2<<26)
2302#define DISPPLANE_15_16BPP (0x4<<26)
2303#define DISPPLANE_16BPP (0x5<<26)
2304#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
2305#define DISPPLANE_32BPP (0x7<<26)
a4f45cf1 2306#define DISPPLANE_32BPP_30BIT_NO_ALPHA (0xa<<26)
585fb111
JB
2307#define DISPPLANE_STEREO_ENABLE (1<<25)
2308#define DISPPLANE_STEREO_DISABLE 0
2309#define DISPPLANE_SEL_PIPE_MASK (1<<24)
2310#define DISPPLANE_SEL_PIPE_A 0
2311#define DISPPLANE_SEL_PIPE_B (1<<24)
2312#define DISPPLANE_SRC_KEY_ENABLE (1<<22)
2313#define DISPPLANE_SRC_KEY_DISABLE 0
2314#define DISPPLANE_LINE_DOUBLE (1<<20)
2315#define DISPPLANE_NO_LINE_DOUBLE 0
2316#define DISPPLANE_STEREO_POLARITY_FIRST 0
2317#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
f2b115e6 2318#define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* Ironlake */
f544847f 2319#define DISPPLANE_TILED (1<<10)
585fb111
JB
2320#define DSPAADDR 0x70184
2321#define DSPASTRIDE 0x70188
2322#define DSPAPOS 0x7018C /* reserved */
2323#define DSPASIZE 0x70190
2324#define DSPASURF 0x7019C /* 965+ only */
2325#define DSPATILEOFF 0x701A4 /* 965+ only */
2326
2327/* VBIOS flags */
2328#define SWF00 0x71410
2329#define SWF01 0x71414
2330#define SWF02 0x71418
2331#define SWF03 0x7141c
2332#define SWF04 0x71420
2333#define SWF05 0x71424
2334#define SWF06 0x71428
2335#define SWF10 0x70410
2336#define SWF11 0x70414
2337#define SWF14 0x71420
2338#define SWF30 0x72414
2339#define SWF31 0x72418
2340#define SWF32 0x7241c
2341
2342/* Pipe B */
2343#define PIPEBDSL 0x71000
2344#define PIPEBCONF 0x71008
2345#define PIPEBSTAT 0x71024
2346#define PIPEBFRAMEHIGH 0x71040
2347#define PIPEBFRAMEPIXEL 0x71044
9880b7a5
JB
2348#define PIPEB_FRMCOUNT_GM45 0x71040
2349#define PIPEB_FLIPCOUNT_GM45 0x71044
2350
585fb111
JB
2351
2352/* Display B control */
2353#define DSPBCNTR 0x71180
2354#define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
2355#define DISPPLANE_ALPHA_TRANS_DISABLE 0
2356#define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
2357#define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
2358#define DSPBADDR 0x71184
2359#define DSPBSTRIDE 0x71188
2360#define DSPBPOS 0x7118C
2361#define DSPBSIZE 0x71190
2362#define DSPBSURF 0x7119C
2363#define DSPBTILEOFF 0x711A4
2364
2365/* VBIOS regs */
2366#define VGACNTRL 0x71400
2367# define VGA_DISP_DISABLE (1 << 31)
2368# define VGA_2X_MODE (1 << 30)
2369# define VGA_PIPE_B_SELECT (1 << 29)
2370
f2b115e6 2371/* Ironlake */
b9055052
ZW
2372
2373#define CPU_VGACNTRL 0x41000
2374
2375#define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030
2376#define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
2377#define DIGITAL_PORTA_SHORT_PULSE_2MS (0 << 2)
2378#define DIGITAL_PORTA_SHORT_PULSE_4_5MS (1 << 2)
2379#define DIGITAL_PORTA_SHORT_PULSE_6MS (2 << 2)
2380#define DIGITAL_PORTA_SHORT_PULSE_100MS (3 << 2)
2381#define DIGITAL_PORTA_NO_DETECT (0 << 0)
2382#define DIGITAL_PORTA_LONG_PULSE_DETECT_MASK (1 << 1)
2383#define DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK (1 << 0)
2384
2385/* refresh rate hardware control */
2386#define RR_HW_CTL 0x45300
2387#define RR_HW_LOW_POWER_FRAMES_MASK 0xff
2388#define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
2389
2390#define FDI_PLL_BIOS_0 0x46000
2391#define FDI_PLL_BIOS_1 0x46004
2392#define FDI_PLL_BIOS_2 0x46008
2393#define DISPLAY_PORT_PLL_BIOS_0 0x4600c
2394#define DISPLAY_PORT_PLL_BIOS_1 0x46010
2395#define DISPLAY_PORT_PLL_BIOS_2 0x46014
2396
8956c8bb
EA
2397#define PCH_DSPCLK_GATE_D 0x42020
2398# define DPFDUNIT_CLOCK_GATE_DISABLE (1 << 7)
2399# define DPARBUNIT_CLOCK_GATE_DISABLE (1 << 5)
2400
2401#define PCH_3DCGDIS0 0x46020
2402# define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
2403# define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
2404
b9055052
ZW
2405#define FDI_PLL_FREQ_CTL 0x46030
2406#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
2407#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
2408#define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
2409
2410
2411#define PIPEA_DATA_M1 0x60030
2412#define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */
2413#define TU_SIZE_MASK 0x7e000000
2414#define PIPEA_DATA_M1_OFFSET 0
2415#define PIPEA_DATA_N1 0x60034
2416#define PIPEA_DATA_N1_OFFSET 0
2417
2418#define PIPEA_DATA_M2 0x60038
2419#define PIPEA_DATA_M2_OFFSET 0
2420#define PIPEA_DATA_N2 0x6003c
2421#define PIPEA_DATA_N2_OFFSET 0
2422
2423#define PIPEA_LINK_M1 0x60040
2424#define PIPEA_LINK_M1_OFFSET 0
2425#define PIPEA_LINK_N1 0x60044
2426#define PIPEA_LINK_N1_OFFSET 0
2427
2428#define PIPEA_LINK_M2 0x60048
2429#define PIPEA_LINK_M2_OFFSET 0
2430#define PIPEA_LINK_N2 0x6004c
2431#define PIPEA_LINK_N2_OFFSET 0
2432
2433/* PIPEB timing regs are same start from 0x61000 */
2434
2435#define PIPEB_DATA_M1 0x61030
2436#define PIPEB_DATA_M1_OFFSET 0
2437#define PIPEB_DATA_N1 0x61034
2438#define PIPEB_DATA_N1_OFFSET 0
2439
2440#define PIPEB_DATA_M2 0x61038
2441#define PIPEB_DATA_M2_OFFSET 0
2442#define PIPEB_DATA_N2 0x6103c
2443#define PIPEB_DATA_N2_OFFSET 0
2444
2445#define PIPEB_LINK_M1 0x61040
2446#define PIPEB_LINK_M1_OFFSET 0
2447#define PIPEB_LINK_N1 0x61044
2448#define PIPEB_LINK_N1_OFFSET 0
2449
2450#define PIPEB_LINK_M2 0x61048
2451#define PIPEB_LINK_M2_OFFSET 0
2452#define PIPEB_LINK_N2 0x6104c
2453#define PIPEB_LINK_N2_OFFSET 0
2454
2455/* CPU panel fitter */
2456#define PFA_CTL_1 0x68080
2457#define PFB_CTL_1 0x68880
2458#define PF_ENABLE (1<<31)
b1f60b70
ZW
2459#define PF_FILTER_MASK (3<<23)
2460#define PF_FILTER_PROGRAMMED (0<<23)
2461#define PF_FILTER_MED_3x3 (1<<23)
2462#define PF_FILTER_EDGE_ENHANCE (2<<23)
2463#define PF_FILTER_EDGE_SOFTEN (3<<23)
249c0e64
ZW
2464#define PFA_WIN_SZ 0x68074
2465#define PFB_WIN_SZ 0x68874
8dd81a38
ZW
2466#define PFA_WIN_POS 0x68070
2467#define PFB_WIN_POS 0x68870
b9055052
ZW
2468
2469/* legacy palette */
2470#define LGC_PALETTE_A 0x4a000
2471#define LGC_PALETTE_B 0x4a800
2472
2473/* interrupts */
2474#define DE_MASTER_IRQ_CONTROL (1 << 31)
2475#define DE_SPRITEB_FLIP_DONE (1 << 29)
2476#define DE_SPRITEA_FLIP_DONE (1 << 28)
2477#define DE_PLANEB_FLIP_DONE (1 << 27)
2478#define DE_PLANEA_FLIP_DONE (1 << 26)
2479#define DE_PCU_EVENT (1 << 25)
2480#define DE_GTT_FAULT (1 << 24)
2481#define DE_POISON (1 << 23)
2482#define DE_PERFORM_COUNTER (1 << 22)
2483#define DE_PCH_EVENT (1 << 21)
2484#define DE_AUX_CHANNEL_A (1 << 20)
2485#define DE_DP_A_HOTPLUG (1 << 19)
2486#define DE_GSE (1 << 18)
2487#define DE_PIPEB_VBLANK (1 << 15)
2488#define DE_PIPEB_EVEN_FIELD (1 << 14)
2489#define DE_PIPEB_ODD_FIELD (1 << 13)
2490#define DE_PIPEB_LINE_COMPARE (1 << 12)
2491#define DE_PIPEB_VSYNC (1 << 11)
2492#define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
2493#define DE_PIPEA_VBLANK (1 << 7)
2494#define DE_PIPEA_EVEN_FIELD (1 << 6)
2495#define DE_PIPEA_ODD_FIELD (1 << 5)
2496#define DE_PIPEA_LINE_COMPARE (1 << 4)
2497#define DE_PIPEA_VSYNC (1 << 3)
2498#define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
2499
2500#define DEISR 0x44000
2501#define DEIMR 0x44004
2502#define DEIIR 0x44008
2503#define DEIER 0x4400c
2504
2505/* GT interrupt */
e552eb70 2506#define GT_PIPE_NOTIFY (1 << 4)
b9055052
ZW
2507#define GT_SYNC_STATUS (1 << 2)
2508#define GT_USER_INTERRUPT (1 << 0)
d1b851fc
ZN
2509#define GT_BSD_USER_INTERRUPT (1 << 5)
2510
b9055052
ZW
2511
2512#define GTISR 0x44010
2513#define GTIMR 0x44014
2514#define GTIIR 0x44018
2515#define GTIER 0x4401c
2516
7f8a8569
ZW
2517#define ILK_DISPLAY_CHICKEN2 0x42004
2518#define ILK_DPARB_GATE (1<<22)
2519#define ILK_VSDPFD_FULL (1<<21)
2520#define ILK_DSPCLK_GATE 0x42020
2521#define ILK_DPARB_CLK_GATE (1<<5)
b52eb4dc
ZY
2522/* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */
2523#define ILK_CLK_FBC (1<<7)
2524#define ILK_DPFC_DIS1 (1<<8)
2525#define ILK_DPFC_DIS2 (1<<9)
7f8a8569 2526
553bd149
ZW
2527#define DISP_ARB_CTL 0x45000
2528#define DISP_TILE_SURFACE_SWIZZLING (1<<13)
7f8a8569 2529#define DISP_FBC_WM_DIS (1<<15)
553bd149 2530
b9055052
ZW
2531/* PCH */
2532
2533/* south display engine interrupt */
2534#define SDE_CRT_HOTPLUG (1 << 11)
2535#define SDE_PORTD_HOTPLUG (1 << 10)
2536#define SDE_PORTC_HOTPLUG (1 << 9)
2537#define SDE_PORTB_HOTPLUG (1 << 8)
2538#define SDE_SDVOB_HOTPLUG (1 << 6)
c650156a 2539#define SDE_HOTPLUG_MASK (0xf << 8)
8db9d77b
ZW
2540/* CPT */
2541#define SDE_CRT_HOTPLUG_CPT (1 << 19)
2542#define SDE_PORTD_HOTPLUG_CPT (1 << 23)
2543#define SDE_PORTC_HOTPLUG_CPT (1 << 22)
2544#define SDE_PORTB_HOTPLUG_CPT (1 << 21)
b9055052
ZW
2545
2546#define SDEISR 0xc4000
2547#define SDEIMR 0xc4004
2548#define SDEIIR 0xc4008
2549#define SDEIER 0xc400c
2550
2551/* digital port hotplug */
2552#define PCH_PORT_HOTPLUG 0xc4030
2553#define PORTD_HOTPLUG_ENABLE (1 << 20)
2554#define PORTD_PULSE_DURATION_2ms (0)
2555#define PORTD_PULSE_DURATION_4_5ms (1 << 18)
2556#define PORTD_PULSE_DURATION_6ms (2 << 18)
2557#define PORTD_PULSE_DURATION_100ms (3 << 18)
2558#define PORTD_HOTPLUG_NO_DETECT (0)
2559#define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
2560#define PORTD_HOTPLUG_LONG_DETECT (1 << 17)
2561#define PORTC_HOTPLUG_ENABLE (1 << 12)
2562#define PORTC_PULSE_DURATION_2ms (0)
2563#define PORTC_PULSE_DURATION_4_5ms (1 << 10)
2564#define PORTC_PULSE_DURATION_6ms (2 << 10)
2565#define PORTC_PULSE_DURATION_100ms (3 << 10)
2566#define PORTC_HOTPLUG_NO_DETECT (0)
2567#define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
2568#define PORTC_HOTPLUG_LONG_DETECT (1 << 9)
2569#define PORTB_HOTPLUG_ENABLE (1 << 4)
2570#define PORTB_PULSE_DURATION_2ms (0)
2571#define PORTB_PULSE_DURATION_4_5ms (1 << 2)
2572#define PORTB_PULSE_DURATION_6ms (2 << 2)
2573#define PORTB_PULSE_DURATION_100ms (3 << 2)
2574#define PORTB_HOTPLUG_NO_DETECT (0)
2575#define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
2576#define PORTB_HOTPLUG_LONG_DETECT (1 << 1)
2577
2578#define PCH_GPIOA 0xc5010
2579#define PCH_GPIOB 0xc5014
2580#define PCH_GPIOC 0xc5018
2581#define PCH_GPIOD 0xc501c
2582#define PCH_GPIOE 0xc5020
2583#define PCH_GPIOF 0xc5024
2584
f0217c42
EA
2585#define PCH_GMBUS0 0xc5100
2586#define PCH_GMBUS1 0xc5104
2587#define PCH_GMBUS2 0xc5108
2588#define PCH_GMBUS3 0xc510c
2589#define PCH_GMBUS4 0xc5110
2590#define PCH_GMBUS5 0xc5120
2591
b9055052
ZW
2592#define PCH_DPLL_A 0xc6014
2593#define PCH_DPLL_B 0xc6018
2594
2595#define PCH_FPA0 0xc6040
2596#define PCH_FPA1 0xc6044
2597#define PCH_FPB0 0xc6048
2598#define PCH_FPB1 0xc604c
2599
2600#define PCH_DPLL_TEST 0xc606c
2601
2602#define PCH_DREF_CONTROL 0xC6200
2603#define DREF_CONTROL_MASK 0x7fc3
2604#define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
2605#define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
2606#define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13)
2607#define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13)
2608#define DREF_SSC_SOURCE_DISABLE (0<<11)
2609#define DREF_SSC_SOURCE_ENABLE (2<<11)
c038e51e 2610#define DREF_SSC_SOURCE_MASK (3<<11)
b9055052
ZW
2611#define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
2612#define DREF_NONSPREAD_CK505_ENABLE (1<<9)
2613#define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
c038e51e 2614#define DREF_NONSPREAD_SOURCE_MASK (3<<9)
b9055052
ZW
2615#define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
2616#define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
2617#define DREF_SSC4_DOWNSPREAD (0<<6)
2618#define DREF_SSC4_CENTERSPREAD (1<<6)
2619#define DREF_SSC1_DISABLE (0<<1)
2620#define DREF_SSC1_ENABLE (1<<1)
2621#define DREF_SSC4_DISABLE (0)
2622#define DREF_SSC4_ENABLE (1)
2623
2624#define PCH_RAWCLK_FREQ 0xc6204
2625#define FDL_TP1_TIMER_SHIFT 12
2626#define FDL_TP1_TIMER_MASK (3<<12)
2627#define FDL_TP2_TIMER_SHIFT 10
2628#define FDL_TP2_TIMER_MASK (3<<10)
2629#define RAWCLK_FREQ_MASK 0x3ff
2630
2631#define PCH_DPLL_TMR_CFG 0xc6208
2632
2633#define PCH_SSC4_PARMS 0xc6210
2634#define PCH_SSC4_AUX_PARMS 0xc6214
2635
8db9d77b
ZW
2636#define PCH_DPLL_SEL 0xc7000
2637#define TRANSA_DPLL_ENABLE (1<<3)
2638#define TRANSA_DPLLB_SEL (1<<0)
2639#define TRANSA_DPLLA_SEL 0
2640#define TRANSB_DPLL_ENABLE (1<<7)
2641#define TRANSB_DPLLB_SEL (1<<4)
2642#define TRANSB_DPLLA_SEL (0)
2643#define TRANSC_DPLL_ENABLE (1<<11)
2644#define TRANSC_DPLLB_SEL (1<<8)
2645#define TRANSC_DPLLA_SEL (0)
2646
b9055052
ZW
2647/* transcoder */
2648
2649#define TRANS_HTOTAL_A 0xe0000
2650#define TRANS_HTOTAL_SHIFT 16
2651#define TRANS_HACTIVE_SHIFT 0
2652#define TRANS_HBLANK_A 0xe0004
2653#define TRANS_HBLANK_END_SHIFT 16
2654#define TRANS_HBLANK_START_SHIFT 0
2655#define TRANS_HSYNC_A 0xe0008
2656#define TRANS_HSYNC_END_SHIFT 16
2657#define TRANS_HSYNC_START_SHIFT 0
2658#define TRANS_VTOTAL_A 0xe000c
2659#define TRANS_VTOTAL_SHIFT 16
2660#define TRANS_VACTIVE_SHIFT 0
2661#define TRANS_VBLANK_A 0xe0010
2662#define TRANS_VBLANK_END_SHIFT 16
2663#define TRANS_VBLANK_START_SHIFT 0
2664#define TRANS_VSYNC_A 0xe0014
2665#define TRANS_VSYNC_END_SHIFT 16
2666#define TRANS_VSYNC_START_SHIFT 0
2667
2668#define TRANSA_DATA_M1 0xe0030
2669#define TRANSA_DATA_N1 0xe0034
2670#define TRANSA_DATA_M2 0xe0038
2671#define TRANSA_DATA_N2 0xe003c
2672#define TRANSA_DP_LINK_M1 0xe0040
2673#define TRANSA_DP_LINK_N1 0xe0044
2674#define TRANSA_DP_LINK_M2 0xe0048
2675#define TRANSA_DP_LINK_N2 0xe004c
2676
2677#define TRANS_HTOTAL_B 0xe1000
2678#define TRANS_HBLANK_B 0xe1004
2679#define TRANS_HSYNC_B 0xe1008
2680#define TRANS_VTOTAL_B 0xe100c
2681#define TRANS_VBLANK_B 0xe1010
2682#define TRANS_VSYNC_B 0xe1014
2683
2684#define TRANSB_DATA_M1 0xe1030
2685#define TRANSB_DATA_N1 0xe1034
2686#define TRANSB_DATA_M2 0xe1038
2687#define TRANSB_DATA_N2 0xe103c
2688#define TRANSB_DP_LINK_M1 0xe1040
2689#define TRANSB_DP_LINK_N1 0xe1044
2690#define TRANSB_DP_LINK_M2 0xe1048
2691#define TRANSB_DP_LINK_N2 0xe104c
2692
2693#define TRANSACONF 0xf0008
2694#define TRANSBCONF 0xf1008
2695#define TRANS_DISABLE (0<<31)
2696#define TRANS_ENABLE (1<<31)
2697#define TRANS_STATE_MASK (1<<30)
2698#define TRANS_STATE_DISABLE (0<<30)
2699#define TRANS_STATE_ENABLE (1<<30)
2700#define TRANS_FSYNC_DELAY_HB1 (0<<27)
2701#define TRANS_FSYNC_DELAY_HB2 (1<<27)
2702#define TRANS_FSYNC_DELAY_HB3 (2<<27)
2703#define TRANS_FSYNC_DELAY_HB4 (3<<27)
2704#define TRANS_DP_AUDIO_ONLY (1<<26)
2705#define TRANS_DP_VIDEO_AUDIO (0<<26)
2706#define TRANS_PROGRESSIVE (0<<21)
2707#define TRANS_8BPC (0<<5)
2708#define TRANS_10BPC (1<<5)
2709#define TRANS_6BPC (2<<5)
2710#define TRANS_12BPC (3<<5)
2711
2712#define FDI_RXA_CHICKEN 0xc200c
2713#define FDI_RXB_CHICKEN 0xc2010
2714#define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
2715
2716/* CPU: FDI_TX */
2717#define FDI_TXA_CTL 0x60100
2718#define FDI_TXB_CTL 0x61100
2719#define FDI_TX_DISABLE (0<<31)
2720#define FDI_TX_ENABLE (1<<31)
2721#define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
2722#define FDI_LINK_TRAIN_PATTERN_2 (1<<28)
2723#define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28)
2724#define FDI_LINK_TRAIN_NONE (3<<28)
2725#define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25)
2726#define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25)
2727#define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25)
2728#define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25)
2729#define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)
2730#define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)
2731#define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22)
2732#define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22)
8db9d77b
ZW
2733/* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.
2734 SNB has different settings. */
2735/* SNB A-stepping */
2736#define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
2737#define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
2738#define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
2739#define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
2740/* SNB B-stepping */
2741#define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
2742#define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
2743#define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
2744#define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
2745#define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f<<22)
b9055052
ZW
2746#define FDI_DP_PORT_WIDTH_X1 (0<<19)
2747#define FDI_DP_PORT_WIDTH_X2 (1<<19)
2748#define FDI_DP_PORT_WIDTH_X3 (2<<19)
2749#define FDI_DP_PORT_WIDTH_X4 (3<<19)
2750#define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18)
f2b115e6 2751/* Ironlake: hardwired to 1 */
b9055052
ZW
2752#define FDI_TX_PLL_ENABLE (1<<14)
2753/* both Tx and Rx */
2754#define FDI_SCRAMBLING_ENABLE (0<<7)
2755#define FDI_SCRAMBLING_DISABLE (1<<7)
2756
2757/* FDI_RX, FDI_X is hard-wired to Transcoder_X */
2758#define FDI_RXA_CTL 0xf000c
2759#define FDI_RXB_CTL 0xf100c
2760#define FDI_RX_ENABLE (1<<31)
2761#define FDI_RX_DISABLE (0<<31)
2762/* train, dp width same as FDI_TX */
2763#define FDI_DP_PORT_WIDTH_X8 (7<<19)
2764#define FDI_8BPC (0<<16)
2765#define FDI_10BPC (1<<16)
2766#define FDI_6BPC (2<<16)
2767#define FDI_12BPC (3<<16)
2768#define FDI_LINK_REVERSE_OVERWRITE (1<<15)
2769#define FDI_DMI_LINK_REVERSE_MASK (1<<14)
2770#define FDI_RX_PLL_ENABLE (1<<13)
2771#define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
2772#define FDI_FE_ERR_CORRECT_ENABLE (1<<10)
2773#define FDI_FS_ERR_REPORT_ENABLE (1<<9)
2774#define FDI_FE_ERR_REPORT_ENABLE (1<<8)
2775#define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6)
2776#define FDI_SEL_RAWCLK (0<<4)
2777#define FDI_SEL_PCDCLK (1<<4)
8db9d77b
ZW
2778/* CPT */
2779#define FDI_AUTO_TRAINING (1<<10)
2780#define FDI_LINK_TRAIN_PATTERN_1_CPT (0<<8)
2781#define FDI_LINK_TRAIN_PATTERN_2_CPT (1<<8)
2782#define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2<<8)
2783#define FDI_LINK_TRAIN_NORMAL_CPT (3<<8)
2784#define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3<<8)
b9055052
ZW
2785
2786#define FDI_RXA_MISC 0xf0010
2787#define FDI_RXB_MISC 0xf1010
2788#define FDI_RXA_TUSIZE1 0xf0030
2789#define FDI_RXA_TUSIZE2 0xf0038
2790#define FDI_RXB_TUSIZE1 0xf1030
2791#define FDI_RXB_TUSIZE2 0xf1038
2792
2793/* FDI_RX interrupt register format */
2794#define FDI_RX_INTER_LANE_ALIGN (1<<10)
2795#define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */
2796#define FDI_RX_BIT_LOCK (1<<8) /* train 1 */
2797#define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7)
2798#define FDI_RX_FS_CODE_ERR (1<<6)
2799#define FDI_RX_FE_CODE_ERR (1<<5)
2800#define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4)
2801#define FDI_RX_HDCP_LINK_FAIL (1<<3)
2802#define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2)
2803#define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
2804#define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
2805
2806#define FDI_RXA_IIR 0xf0014
2807#define FDI_RXA_IMR 0xf0018
2808#define FDI_RXB_IIR 0xf1014
2809#define FDI_RXB_IMR 0xf1018
2810
2811#define FDI_PLL_CTL_1 0xfe000
2812#define FDI_PLL_CTL_2 0xfe004
2813
2814/* CRT */
2815#define PCH_ADPA 0xe1100
2816#define ADPA_TRANS_SELECT_MASK (1<<30)
2817#define ADPA_TRANS_A_SELECT 0
2818#define ADPA_TRANS_B_SELECT (1<<30)
2819#define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
2820#define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24)
2821#define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24)
2822#define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24)
2823#define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24)
2824#define ADPA_CRT_HOTPLUG_ENABLE (1<<23)
2825#define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22)
2826#define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22)
2827#define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21)
2828#define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21)
2829#define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20)
2830#define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20)
2831#define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18)
2832#define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18)
2833#define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18)
2834#define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18)
2835#define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17)
2836#define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17)
2837#define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
2838
2839/* or SDVOB */
2840#define HDMIB 0xe1140
2841#define PORT_ENABLE (1 << 31)
2842#define TRANSCODER_A (0)
2843#define TRANSCODER_B (1 << 30)
2844#define COLOR_FORMAT_8bpc (0)
2845#define COLOR_FORMAT_12bpc (3 << 26)
2846#define SDVOB_HOTPLUG_ENABLE (1 << 23)
2847#define SDVO_ENCODING (0)
2848#define TMDS_ENCODING (2 << 10)
2849#define NULL_PACKET_VSYNC_ENABLE (1 << 9)
467b200d
ZW
2850/* CPT */
2851#define HDMI_MODE_SELECT (1 << 9)
2852#define DVI_MODE_SELECT (0)
b9055052
ZW
2853#define SDVOB_BORDER_ENABLE (1 << 7)
2854#define AUDIO_ENABLE (1 << 6)
2855#define VSYNC_ACTIVE_HIGH (1 << 4)
2856#define HSYNC_ACTIVE_HIGH (1 << 3)
2857#define PORT_DETECTED (1 << 2)
2858
461ed3ca
ZY
2859/* PCH SDVOB multiplex with HDMIB */
2860#define PCH_SDVOB HDMIB
2861
b9055052
ZW
2862#define HDMIC 0xe1150
2863#define HDMID 0xe1160
2864
2865#define PCH_LVDS 0xe1180
2866#define LVDS_DETECTED (1 << 1)
2867
2868#define BLC_PWM_CPU_CTL2 0x48250
2869#define PWM_ENABLE (1 << 31)
2870#define PWM_PIPE_A (0 << 29)
2871#define PWM_PIPE_B (1 << 29)
2872#define BLC_PWM_CPU_CTL 0x48254
2873
2874#define BLC_PWM_PCH_CTL1 0xc8250
2875#define PWM_PCH_ENABLE (1 << 31)
2876#define PWM_POLARITY_ACTIVE_LOW (1 << 29)
2877#define PWM_POLARITY_ACTIVE_HIGH (0 << 29)
2878#define PWM_POLARITY_ACTIVE_LOW2 (1 << 28)
2879#define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
2880
2881#define BLC_PWM_PCH_CTL2 0xc8254
2882
2883#define PCH_PP_STATUS 0xc7200
2884#define PCH_PP_CONTROL 0xc7204
4a655f04 2885#define PANEL_UNLOCK_REGS (0xabcd << 16)
b9055052
ZW
2886#define EDP_FORCE_VDD (1 << 3)
2887#define EDP_BLC_ENABLE (1 << 2)
2888#define PANEL_POWER_RESET (1 << 1)
2889#define PANEL_POWER_OFF (0 << 0)
2890#define PANEL_POWER_ON (1 << 0)
2891#define PCH_PP_ON_DELAYS 0xc7208
2892#define EDP_PANEL (1 << 30)
2893#define PCH_PP_OFF_DELAYS 0xc720c
2894#define PCH_PP_DIVISOR 0xc7210
2895
5eb08b69
ZW
2896#define PCH_DP_B 0xe4100
2897#define PCH_DPB_AUX_CH_CTL 0xe4110
2898#define PCH_DPB_AUX_CH_DATA1 0xe4114
2899#define PCH_DPB_AUX_CH_DATA2 0xe4118
2900#define PCH_DPB_AUX_CH_DATA3 0xe411c
2901#define PCH_DPB_AUX_CH_DATA4 0xe4120
2902#define PCH_DPB_AUX_CH_DATA5 0xe4124
2903
2904#define PCH_DP_C 0xe4200
2905#define PCH_DPC_AUX_CH_CTL 0xe4210
2906#define PCH_DPC_AUX_CH_DATA1 0xe4214
2907#define PCH_DPC_AUX_CH_DATA2 0xe4218
2908#define PCH_DPC_AUX_CH_DATA3 0xe421c
2909#define PCH_DPC_AUX_CH_DATA4 0xe4220
2910#define PCH_DPC_AUX_CH_DATA5 0xe4224
2911
2912#define PCH_DP_D 0xe4300
2913#define PCH_DPD_AUX_CH_CTL 0xe4310
2914#define PCH_DPD_AUX_CH_DATA1 0xe4314
2915#define PCH_DPD_AUX_CH_DATA2 0xe4318
2916#define PCH_DPD_AUX_CH_DATA3 0xe431c
2917#define PCH_DPD_AUX_CH_DATA4 0xe4320
2918#define PCH_DPD_AUX_CH_DATA5 0xe4324
2919
8db9d77b
ZW
2920/* CPT */
2921#define PORT_TRANS_A_SEL_CPT 0
2922#define PORT_TRANS_B_SEL_CPT (1<<29)
2923#define PORT_TRANS_C_SEL_CPT (2<<29)
2924#define PORT_TRANS_SEL_MASK (3<<29)
2925
2926#define TRANS_DP_CTL_A 0xe0300
2927#define TRANS_DP_CTL_B 0xe1300
2928#define TRANS_DP_CTL_C 0xe2300
2929#define TRANS_DP_OUTPUT_ENABLE (1<<31)
2930#define TRANS_DP_PORT_SEL_B (0<<29)
2931#define TRANS_DP_PORT_SEL_C (1<<29)
2932#define TRANS_DP_PORT_SEL_D (2<<29)
2933#define TRANS_DP_PORT_SEL_MASK (3<<29)
2934#define TRANS_DP_AUDIO_ONLY (1<<26)
2935#define TRANS_DP_ENH_FRAMING (1<<18)
2936#define TRANS_DP_8BPC (0<<9)
2937#define TRANS_DP_10BPC (1<<9)
2938#define TRANS_DP_6BPC (2<<9)
2939#define TRANS_DP_12BPC (3<<9)
2940#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
2941#define TRANS_DP_VSYNC_ACTIVE_LOW 0
2942#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
2943#define TRANS_DP_HSYNC_ACTIVE_LOW 0
94113cec 2944#define TRANS_DP_SYNC_MASK (3<<3)
8db9d77b
ZW
2945
2946/* SNB eDP training params */
2947/* SNB A-stepping */
2948#define EDP_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
2949#define EDP_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
2950#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
2951#define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
2952/* SNB B-stepping */
2953#define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
2954#define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
2955#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
2956#define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
2957#define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22)
2958
585fb111 2959#endif /* _I915_REG_H_ */