1 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
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.
29 * DOC: The i915 register macro definition style guide
31 * Follow the style described here for new macros, and while changing existing
32 * macros. Do **not** mass change existing definitions just to update the style.
37 * Keep helper macros near the top. For example, _PIPE() and friends.
39 * Prefix macros that generally should not be used outside of this file with
40 * underscore '_'. For example, _PIPE() and friends, single instances of
41 * registers that are defined solely for the use by function-like macros.
43 * Avoid using the underscore prefixed macros outside of this file. There are
44 * exceptions, but keep them to a minimum.
46 * There are two basic types of register definitions: Single registers and
47 * register groups. Register groups are registers which have two or more
48 * instances, for example one per pipe, port, transcoder, etc. Register groups
49 * should be defined using function-like macros.
51 * For single registers, define the register offset first, followed by register
54 * For register groups, define the register instance offsets first, prefixed
55 * with underscore, followed by a function-like macro choosing the right
56 * instance based on the parameter, followed by register contents.
58 * Define the register contents (i.e. bit and bit field macros) from most
59 * significant to least significant bit. Indent the register content macros
60 * using two extra spaces between ``#define`` and the macro name.
62 * For bit fields, define a ``_MASK`` and a ``_SHIFT`` macro. Define bit field
63 * contents so that they are already shifted in place, and can be directly
64 * OR'd. For convenience, function-like macros may be used to define bit fields,
65 * but do note that the macros may be needed to read as well as write the
68 * Define bits using ``(1 << N)`` instead of ``BIT(N)``. We may change this in
69 * the future, but this is the prevailing style. Do **not** add ``_BIT`` suffix
72 * Group the register and its contents together without blank lines, separate
73 * from other registers and their contents with one blank line.
75 * Indent macro values from macro names using TABs. Align values vertically. Use
76 * braces in macro values as needed to avoid unintended precedence after macro
77 * substitution. Use spaces in macro values according to kernel coding
78 * style. Use lower case in hexadecimal values.
83 * Try to name registers according to the specs. If the register name changes in
84 * the specs from platform to another, stick to the original name.
86 * Try to re-use existing register macro definitions. Only add new macros for
87 * new register offsets, or when the register contents have changed enough to
88 * warrant a full redefinition.
90 * When a register macro changes for a new platform, prefix the new macro using
91 * the platform acronym or generation. For example, ``SKL_`` or ``GEN8_``. The
92 * prefix signifies the start platform/generation using the register.
94 * When a bit (field) macro changes or gets added for a new platform, while
95 * retaining the existing register macro, add a platform acronym or generation
96 * suffix to the name. For example, ``_SKL`` or ``_GEN8``.
101 * (Note that the values in the example are indented using spaces instead of
102 * TABs to avoid misalignment in generated documentation. Use TABs in the
105 * #define _FOO_A 0xf000
106 * #define _FOO_B 0xf001
107 * #define FOO(pipe) _MMIO_PIPE(pipe, _FOO_A, _FOO_B)
108 * #define FOO_ENABLE (1 << 31)
109 * #define FOO_MODE_MASK (0xf << 16)
110 * #define FOO_MODE_SHIFT 16
111 * #define FOO_MODE_BAR (0 << 16)
112 * #define FOO_MODE_BAZ (1 << 16)
113 * #define FOO_MODE_QUX_SNB (2 << 16)
115 * #define BAR _MMIO(0xb000)
116 * #define GEN8_BAR _MMIO(0xb888)
123 #define _MMIO(r) ((const i915_reg_t){ .reg = (r) })
125 #define INVALID_MMIO_REG _MMIO(0)
127 static inline uint32_t i915_mmio_reg_offset(i915_reg_t reg)
132 static inline bool i915_mmio_reg_equal(i915_reg_t a, i915_reg_t b)
134 return i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b);
137 static inline bool i915_mmio_reg_valid(i915_reg_t reg)
139 return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
142 #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
144 #define _PIPE(pipe, a, b) ((a) + (pipe) * ((b) - (a)))
145 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
146 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
147 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
148 #define _TRANS(tran, a, b) ((a) + (tran) * ((b) - (a)))
149 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
150 #define _PORT(port, a, b) ((a) + (port) * ((b) - (a)))
151 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
152 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
153 #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
154 #define _PLL(pll, a, b) ((a) + (pll) * ((b) - (a)))
155 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
156 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
157 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
159 #define __MASKED_FIELD(mask, value) ((mask) << 16 | (value))
160 #define _MASKED_FIELD(mask, value) ({ \
161 if (__builtin_constant_p(mask)) \
162 BUILD_BUG_ON_MSG(((mask) & 0xffff0000), "Incorrect mask"); \
163 if (__builtin_constant_p(value)) \
164 BUILD_BUG_ON_MSG((value) & 0xffff0000, "Incorrect value"); \
165 if (__builtin_constant_p(mask) && __builtin_constant_p(value)) \
166 BUILD_BUG_ON_MSG((value) & ~(mask), \
167 "Incorrect value for mask"); \
168 __MASKED_FIELD(mask, value); })
169 #define _MASKED_BIT_ENABLE(a) ({ typeof(a) _a = (a); _MASKED_FIELD(_a, _a); })
170 #define _MASKED_BIT_DISABLE(a) (_MASKED_FIELD((a), 0))
185 #define RENDER_CLASS 0
186 #define VIDEO_DECODE_CLASS 1
187 #define VIDEO_ENHANCEMENT_CLASS 2
188 #define COPY_ENGINE_CLASS 3
189 #define OTHER_CLASS 4
190 #define MAX_ENGINE_CLASS 4
192 #define OTHER_GTPM_INSTANCE 1
193 #define MAX_ENGINE_INSTANCE 3
195 /* PCI config space */
197 #define MCHBAR_I915 0x44
198 #define MCHBAR_I965 0x48
199 #define MCHBAR_SIZE (4 * 4096)
202 #define DEVEN_MCHBAR_EN (1 << 28)
204 /* BSM in include/drm/i915_drm.h */
206 #define HPLLCC 0xc0 /* 85x only */
207 #define GC_CLOCK_CONTROL_MASK (0x7 << 0)
208 #define GC_CLOCK_133_200 (0 << 0)
209 #define GC_CLOCK_100_200 (1 << 0)
210 #define GC_CLOCK_100_133 (2 << 0)
211 #define GC_CLOCK_133_266 (3 << 0)
212 #define GC_CLOCK_133_200_2 (4 << 0)
213 #define GC_CLOCK_133_266_2 (5 << 0)
214 #define GC_CLOCK_166_266 (6 << 0)
215 #define GC_CLOCK_166_250 (7 << 0)
217 #define I915_GDRST 0xc0 /* PCI config register */
218 #define GRDOM_FULL (0 << 2)
219 #define GRDOM_RENDER (1 << 2)
220 #define GRDOM_MEDIA (3 << 2)
221 #define GRDOM_MASK (3 << 2)
222 #define GRDOM_RESET_STATUS (1 << 1)
223 #define GRDOM_RESET_ENABLE (1 << 0)
225 /* BSpec only has register offset, PCI device and bit found empirically */
226 #define I830_CLOCK_GATE 0xc8 /* device 0 */
227 #define I830_L2_CACHE_CLOCK_GATE_DISABLE (1 << 2)
229 #define GCDGMBUS 0xcc
232 #define GCFGC 0xf0 /* 915+ only */
233 #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
234 #define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
235 #define GC_DISPLAY_CLOCK_333_320_MHZ (4 << 4)
236 #define GC_DISPLAY_CLOCK_267_MHZ_PNV (0 << 4)
237 #define GC_DISPLAY_CLOCK_333_MHZ_PNV (1 << 4)
238 #define GC_DISPLAY_CLOCK_444_MHZ_PNV (2 << 4)
239 #define GC_DISPLAY_CLOCK_200_MHZ_PNV (5 << 4)
240 #define GC_DISPLAY_CLOCK_133_MHZ_PNV (6 << 4)
241 #define GC_DISPLAY_CLOCK_167_MHZ_PNV (7 << 4)
242 #define GC_DISPLAY_CLOCK_MASK (7 << 4)
243 #define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
244 #define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)
245 #define GM45_GC_RENDER_CLOCK_320_MHZ (9 << 0)
246 #define GM45_GC_RENDER_CLOCK_400_MHZ (0xb << 0)
247 #define GM45_GC_RENDER_CLOCK_533_MHZ (0xc << 0)
248 #define I965_GC_RENDER_CLOCK_MASK (0xf << 0)
249 #define I965_GC_RENDER_CLOCK_267_MHZ (2 << 0)
250 #define I965_GC_RENDER_CLOCK_333_MHZ (3 << 0)
251 #define I965_GC_RENDER_CLOCK_444_MHZ (4 << 0)
252 #define I965_GC_RENDER_CLOCK_533_MHZ (5 << 0)
253 #define I945_GC_RENDER_CLOCK_MASK (7 << 0)
254 #define I945_GC_RENDER_CLOCK_166_MHZ (0 << 0)
255 #define I945_GC_RENDER_CLOCK_200_MHZ (1 << 0)
256 #define I945_GC_RENDER_CLOCK_250_MHZ (3 << 0)
257 #define I945_GC_RENDER_CLOCK_400_MHZ (5 << 0)
258 #define I915_GC_RENDER_CLOCK_MASK (7 << 0)
259 #define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
260 #define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
261 #define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
267 #define SWSCI_SCISEL (1 << 15)
268 #define SWSCI_GSSCIE (1 << 0)
270 #define LBPC 0xf4 /* legacy/combination backlight modes, also called LBB */
273 #define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)
274 #define ILK_GRDOM_FULL (0 << 1)
275 #define ILK_GRDOM_RENDER (1 << 1)
276 #define ILK_GRDOM_MEDIA (3 << 1)
277 #define ILK_GRDOM_MASK (3 << 1)
278 #define ILK_GRDOM_RESET_ENABLE (1 << 0)
280 #define GEN6_MBCUNIT_SNPCR _MMIO(0x900c) /* for LLC config */
281 #define GEN6_MBC_SNPCR_SHIFT 21
282 #define GEN6_MBC_SNPCR_MASK (3 << 21)
283 #define GEN6_MBC_SNPCR_MAX (0 << 21)
284 #define GEN6_MBC_SNPCR_MED (1 << 21)
285 #define GEN6_MBC_SNPCR_LOW (2 << 21)
286 #define GEN6_MBC_SNPCR_MIN (3 << 21) /* only 1/16th of the cache is shared */
288 #define VLV_G3DCTL _MMIO(0x9024)
289 #define VLV_GSCKGCTL _MMIO(0x9028)
291 #define GEN6_MBCTL _MMIO(0x0907c)
292 #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4)
293 #define GEN6_MBCTL_CTX_FETCH_NEEDED (1 << 3)
294 #define GEN6_MBCTL_BME_UPDATE_ENABLE (1 << 2)
295 #define GEN6_MBCTL_MAE_UPDATE_ENABLE (1 << 1)
296 #define GEN6_MBCTL_BOOT_FETCH_MECH (1 << 0)
298 #define GEN6_GDRST _MMIO(0x941c)
299 #define GEN6_GRDOM_FULL (1 << 0)
300 #define GEN6_GRDOM_RENDER (1 << 1)
301 #define GEN6_GRDOM_MEDIA (1 << 2)
302 #define GEN6_GRDOM_BLT (1 << 3)
303 #define GEN6_GRDOM_VECS (1 << 4)
304 #define GEN9_GRDOM_GUC (1 << 5)
305 #define GEN8_GRDOM_MEDIA2 (1 << 7)
306 /* GEN11 changed all bit defs except for FULL & RENDER */
307 #define GEN11_GRDOM_FULL GEN6_GRDOM_FULL
308 #define GEN11_GRDOM_RENDER GEN6_GRDOM_RENDER
309 #define GEN11_GRDOM_BLT (1 << 2)
310 #define GEN11_GRDOM_GUC (1 << 3)
311 #define GEN11_GRDOM_MEDIA (1 << 5)
312 #define GEN11_GRDOM_MEDIA2 (1 << 6)
313 #define GEN11_GRDOM_MEDIA3 (1 << 7)
314 #define GEN11_GRDOM_MEDIA4 (1 << 8)
315 #define GEN11_GRDOM_VECS (1 << 13)
316 #define GEN11_GRDOM_VECS2 (1 << 14)
318 #define RING_PP_DIR_BASE(engine) _MMIO((engine)->mmio_base + 0x228)
319 #define RING_PP_DIR_BASE_READ(engine) _MMIO((engine)->mmio_base + 0x518)
320 #define RING_PP_DIR_DCLV(engine) _MMIO((engine)->mmio_base + 0x220)
321 #define PP_DIR_DCLV_2G 0xffffffff
323 #define GEN8_RING_PDP_UDW(engine, n) _MMIO((engine)->mmio_base + 0x270 + (n) * 8 + 4)
324 #define GEN8_RING_PDP_LDW(engine, n) _MMIO((engine)->mmio_base + 0x270 + (n) * 8)
326 #define GEN8_R_PWR_CLK_STATE _MMIO(0x20C8)
327 #define GEN8_RPCS_ENABLE (1 << 31)
328 #define GEN8_RPCS_S_CNT_ENABLE (1 << 18)
329 #define GEN8_RPCS_S_CNT_SHIFT 15
330 #define GEN8_RPCS_S_CNT_MASK (0x7 << GEN8_RPCS_S_CNT_SHIFT)
331 #define GEN8_RPCS_SS_CNT_ENABLE (1 << 11)
332 #define GEN8_RPCS_SS_CNT_SHIFT 8
333 #define GEN8_RPCS_SS_CNT_MASK (0x7 << GEN8_RPCS_SS_CNT_SHIFT)
334 #define GEN8_RPCS_EU_MAX_SHIFT 4
335 #define GEN8_RPCS_EU_MAX_MASK (0xf << GEN8_RPCS_EU_MAX_SHIFT)
336 #define GEN8_RPCS_EU_MIN_SHIFT 0
337 #define GEN8_RPCS_EU_MIN_MASK (0xf << GEN8_RPCS_EU_MIN_SHIFT)
339 #define WAIT_FOR_RC6_EXIT _MMIO(0x20CC)
341 #define HSW_SELECTIVE_READ_ADDRESSING_SHIFT 2
342 #define HSW_SELECTIVE_READ_ADDRESSING_MASK (0x3 << HSW_SLECTIVE_READ_ADDRESSING_SHIFT)
343 #define HSW_SELECTIVE_WRITE_ADDRESS_SHIFT 4
344 #define HSW_SELECTIVE_WRITE_ADDRESS_MASK (0x7 << HSW_SELECTIVE_WRITE_ADDRESS_SHIFT)
346 #define HSW_WAIT_FOR_RC6_EXIT_ENABLE (1 << 0)
347 #define HSW_RCS_CONTEXT_ENABLE (1 << 7)
348 #define HSW_RCS_INHIBIT (1 << 8)
350 #define GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT 4
351 #define GEN8_SELECTIVE_WRITE_ADDRESS_MASK (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
352 #define GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT 4
353 #define GEN8_SELECTIVE_WRITE_ADDRESS_MASK (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
354 #define GEN8_SELECTIVE_WRITE_ADDRESSING_ENABLE (1 << 6)
355 #define GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT 9
356 #define GEN8_SELECTIVE_READ_SUBSLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT)
357 #define GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT 11
358 #define GEN8_SELECTIVE_READ_SLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT)
359 #define GEN8_SELECTIVE_READ_ADDRESSING_ENABLE (1 << 13)
361 #define GAM_ECOCHK _MMIO(0x4090)
362 #define BDW_DISABLE_HDC_INVALIDATION (1 << 25)
363 #define ECOCHK_SNB_BIT (1 << 10)
364 #define ECOCHK_DIS_TLB (1 << 8)
365 #define HSW_ECOCHK_ARB_PRIO_SOL (1 << 6)
366 #define ECOCHK_PPGTT_CACHE64B (0x3 << 3)
367 #define ECOCHK_PPGTT_CACHE4B (0x0 << 3)
368 #define ECOCHK_PPGTT_GFDT_IVB (0x1 << 4)
369 #define ECOCHK_PPGTT_LLC_IVB (0x1 << 3)
370 #define ECOCHK_PPGTT_UC_HSW (0x1 << 3)
371 #define ECOCHK_PPGTT_WT_HSW (0x2 << 3)
372 #define ECOCHK_PPGTT_WB_HSW (0x3 << 3)
374 #define GAC_ECO_BITS _MMIO(0x14090)
375 #define ECOBITS_SNB_BIT (1 << 13)
376 #define ECOBITS_PPGTT_CACHE64B (3 << 8)
377 #define ECOBITS_PPGTT_CACHE4B (0 << 8)
379 #define GAB_CTL _MMIO(0x24000)
380 #define GAB_CTL_CONT_AFTER_PAGEFAULT (1 << 8)
382 #define GEN6_STOLEN_RESERVED _MMIO(0x1082C0)
383 #define GEN6_STOLEN_RESERVED_ADDR_MASK (0xFFF << 20)
384 #define GEN7_STOLEN_RESERVED_ADDR_MASK (0x3FFF << 18)
385 #define GEN6_STOLEN_RESERVED_SIZE_MASK (3 << 4)
386 #define GEN6_STOLEN_RESERVED_1M (0 << 4)
387 #define GEN6_STOLEN_RESERVED_512K (1 << 4)
388 #define GEN6_STOLEN_RESERVED_256K (2 << 4)
389 #define GEN6_STOLEN_RESERVED_128K (3 << 4)
390 #define GEN7_STOLEN_RESERVED_SIZE_MASK (1 << 5)
391 #define GEN7_STOLEN_RESERVED_1M (0 << 5)
392 #define GEN7_STOLEN_RESERVED_256K (1 << 5)
393 #define GEN8_STOLEN_RESERVED_SIZE_MASK (3 << 7)
394 #define GEN8_STOLEN_RESERVED_1M (0 << 7)
395 #define GEN8_STOLEN_RESERVED_2M (1 << 7)
396 #define GEN8_STOLEN_RESERVED_4M (2 << 7)
397 #define GEN8_STOLEN_RESERVED_8M (3 << 7)
398 #define GEN6_STOLEN_RESERVED_ENABLE (1 << 0)
402 #define VGA_ST01_MDA 0x3ba
403 #define VGA_ST01_CGA 0x3da
405 #define _VGA_MSR_WRITE _MMIO(0x3c2)
406 #define VGA_MSR_WRITE 0x3c2
407 #define VGA_MSR_READ 0x3cc
408 #define VGA_MSR_MEM_EN (1 << 1)
409 #define VGA_MSR_CGA_MODE (1 << 0)
411 #define VGA_SR_INDEX 0x3c4
413 #define VGA_SR_DATA 0x3c5
415 #define VGA_AR_INDEX 0x3c0
416 #define VGA_AR_VID_EN (1 << 5)
417 #define VGA_AR_DATA_WRITE 0x3c0
418 #define VGA_AR_DATA_READ 0x3c1
420 #define VGA_GR_INDEX 0x3ce
421 #define VGA_GR_DATA 0x3cf
423 #define VGA_GR_MEM_READ_MODE_SHIFT 3
424 #define VGA_GR_MEM_READ_MODE_PLANE 1
426 #define VGA_GR_MEM_MODE_MASK 0xc
427 #define VGA_GR_MEM_MODE_SHIFT 2
428 #define VGA_GR_MEM_A0000_AFFFF 0
429 #define VGA_GR_MEM_A0000_BFFFF 1
430 #define VGA_GR_MEM_B0000_B7FFF 2
431 #define VGA_GR_MEM_B0000_BFFFF 3
433 #define VGA_DACMASK 0x3c6
434 #define VGA_DACRX 0x3c7
435 #define VGA_DACWX 0x3c8
436 #define VGA_DACDATA 0x3c9
438 #define VGA_CR_INDEX_MDA 0x3b4
439 #define VGA_CR_DATA_MDA 0x3b5
440 #define VGA_CR_INDEX_CGA 0x3d4
441 #define VGA_CR_DATA_CGA 0x3d5
443 #define MI_PREDICATE_SRC0 _MMIO(0x2400)
444 #define MI_PREDICATE_SRC0_UDW _MMIO(0x2400 + 4)
445 #define MI_PREDICATE_SRC1 _MMIO(0x2408)
446 #define MI_PREDICATE_SRC1_UDW _MMIO(0x2408 + 4)
448 #define MI_PREDICATE_RESULT_2 _MMIO(0x2214)
449 #define LOWER_SLICE_ENABLED (1 << 0)
450 #define LOWER_SLICE_DISABLED (0 << 0)
453 * Registers used only by the command parser
455 #define BCS_SWCTRL _MMIO(0x22200)
457 #define GPGPU_THREADS_DISPATCHED _MMIO(0x2290)
458 #define GPGPU_THREADS_DISPATCHED_UDW _MMIO(0x2290 + 4)
459 #define HS_INVOCATION_COUNT _MMIO(0x2300)
460 #define HS_INVOCATION_COUNT_UDW _MMIO(0x2300 + 4)
461 #define DS_INVOCATION_COUNT _MMIO(0x2308)
462 #define DS_INVOCATION_COUNT_UDW _MMIO(0x2308 + 4)
463 #define IA_VERTICES_COUNT _MMIO(0x2310)
464 #define IA_VERTICES_COUNT_UDW _MMIO(0x2310 + 4)
465 #define IA_PRIMITIVES_COUNT _MMIO(0x2318)
466 #define IA_PRIMITIVES_COUNT_UDW _MMIO(0x2318 + 4)
467 #define VS_INVOCATION_COUNT _MMIO(0x2320)
468 #define VS_INVOCATION_COUNT_UDW _MMIO(0x2320 + 4)
469 #define GS_INVOCATION_COUNT _MMIO(0x2328)
470 #define GS_INVOCATION_COUNT_UDW _MMIO(0x2328 + 4)
471 #define GS_PRIMITIVES_COUNT _MMIO(0x2330)
472 #define GS_PRIMITIVES_COUNT_UDW _MMIO(0x2330 + 4)
473 #define CL_INVOCATION_COUNT _MMIO(0x2338)
474 #define CL_INVOCATION_COUNT_UDW _MMIO(0x2338 + 4)
475 #define CL_PRIMITIVES_COUNT _MMIO(0x2340)
476 #define CL_PRIMITIVES_COUNT_UDW _MMIO(0x2340 + 4)
477 #define PS_INVOCATION_COUNT _MMIO(0x2348)
478 #define PS_INVOCATION_COUNT_UDW _MMIO(0x2348 + 4)
479 #define PS_DEPTH_COUNT _MMIO(0x2350)
480 #define PS_DEPTH_COUNT_UDW _MMIO(0x2350 + 4)
482 /* There are the 4 64-bit counter registers, one for each stream output */
483 #define GEN7_SO_NUM_PRIMS_WRITTEN(n) _MMIO(0x5200 + (n) * 8)
484 #define GEN7_SO_NUM_PRIMS_WRITTEN_UDW(n) _MMIO(0x5200 + (n) * 8 + 4)
486 #define GEN7_SO_PRIM_STORAGE_NEEDED(n) _MMIO(0x5240 + (n) * 8)
487 #define GEN7_SO_PRIM_STORAGE_NEEDED_UDW(n) _MMIO(0x5240 + (n) * 8 + 4)
489 #define GEN7_3DPRIM_END_OFFSET _MMIO(0x2420)
490 #define GEN7_3DPRIM_START_VERTEX _MMIO(0x2430)
491 #define GEN7_3DPRIM_VERTEX_COUNT _MMIO(0x2434)
492 #define GEN7_3DPRIM_INSTANCE_COUNT _MMIO(0x2438)
493 #define GEN7_3DPRIM_START_INSTANCE _MMIO(0x243C)
494 #define GEN7_3DPRIM_BASE_VERTEX _MMIO(0x2440)
496 #define GEN7_GPGPU_DISPATCHDIMX _MMIO(0x2500)
497 #define GEN7_GPGPU_DISPATCHDIMY _MMIO(0x2504)
498 #define GEN7_GPGPU_DISPATCHDIMZ _MMIO(0x2508)
500 /* There are the 16 64-bit CS General Purpose Registers */
501 #define HSW_CS_GPR(n) _MMIO(0x2600 + (n) * 8)
502 #define HSW_CS_GPR_UDW(n) _MMIO(0x2600 + (n) * 8 + 4)
504 #define GEN7_OACONTROL _MMIO(0x2360)
505 #define GEN7_OACONTROL_CTX_MASK 0xFFFFF000
506 #define GEN7_OACONTROL_TIMER_PERIOD_MASK 0x3F
507 #define GEN7_OACONTROL_TIMER_PERIOD_SHIFT 6
508 #define GEN7_OACONTROL_TIMER_ENABLE (1 << 5)
509 #define GEN7_OACONTROL_FORMAT_A13 (0 << 2)
510 #define GEN7_OACONTROL_FORMAT_A29 (1 << 2)
511 #define GEN7_OACONTROL_FORMAT_A13_B8_C8 (2 << 2)
512 #define GEN7_OACONTROL_FORMAT_A29_B8_C8 (3 << 2)
513 #define GEN7_OACONTROL_FORMAT_B4_C8 (4 << 2)
514 #define GEN7_OACONTROL_FORMAT_A45_B8_C8 (5 << 2)
515 #define GEN7_OACONTROL_FORMAT_B4_C8_A16 (6 << 2)
516 #define GEN7_OACONTROL_FORMAT_C4_B8 (7 << 2)
517 #define GEN7_OACONTROL_FORMAT_SHIFT 2
518 #define GEN7_OACONTROL_PER_CTX_ENABLE (1 << 1)
519 #define GEN7_OACONTROL_ENABLE (1 << 0)
521 #define GEN8_OACTXID _MMIO(0x2364)
523 #define GEN8_OA_DEBUG _MMIO(0x2B04)
524 #define GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS (1 << 5)
525 #define GEN9_OA_DEBUG_INCLUDE_CLK_RATIO (1 << 6)
526 #define GEN9_OA_DEBUG_DISABLE_GO_1_0_REPORTS (1 << 2)
527 #define GEN9_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS (1 << 1)
529 #define GEN8_OACONTROL _MMIO(0x2B00)
530 #define GEN8_OA_REPORT_FORMAT_A12 (0 << 2)
531 #define GEN8_OA_REPORT_FORMAT_A12_B8_C8 (2 << 2)
532 #define GEN8_OA_REPORT_FORMAT_A36_B8_C8 (5 << 2)
533 #define GEN8_OA_REPORT_FORMAT_C4_B8 (7 << 2)
534 #define GEN8_OA_REPORT_FORMAT_SHIFT 2
535 #define GEN8_OA_SPECIFIC_CONTEXT_ENABLE (1 << 1)
536 #define GEN8_OA_COUNTER_ENABLE (1 << 0)
538 #define GEN8_OACTXCONTROL _MMIO(0x2360)
539 #define GEN8_OA_TIMER_PERIOD_MASK 0x3F
540 #define GEN8_OA_TIMER_PERIOD_SHIFT 2
541 #define GEN8_OA_TIMER_ENABLE (1 << 1)
542 #define GEN8_OA_COUNTER_RESUME (1 << 0)
544 #define GEN7_OABUFFER _MMIO(0x23B0) /* R/W */
545 #define GEN7_OABUFFER_OVERRUN_DISABLE (1 << 3)
546 #define GEN7_OABUFFER_EDGE_TRIGGER (1 << 2)
547 #define GEN7_OABUFFER_STOP_RESUME_ENABLE (1 << 1)
548 #define GEN7_OABUFFER_RESUME (1 << 0)
550 #define GEN8_OABUFFER_UDW _MMIO(0x23b4)
551 #define GEN8_OABUFFER _MMIO(0x2b14)
552 #define GEN8_OABUFFER_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
554 #define GEN7_OASTATUS1 _MMIO(0x2364)
555 #define GEN7_OASTATUS1_TAIL_MASK 0xffffffc0
556 #define GEN7_OASTATUS1_COUNTER_OVERFLOW (1 << 2)
557 #define GEN7_OASTATUS1_OABUFFER_OVERFLOW (1 << 1)
558 #define GEN7_OASTATUS1_REPORT_LOST (1 << 0)
560 #define GEN7_OASTATUS2 _MMIO(0x2368)
561 #define GEN7_OASTATUS2_HEAD_MASK 0xffffffc0
562 #define GEN7_OASTATUS2_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
564 #define GEN8_OASTATUS _MMIO(0x2b08)
565 #define GEN8_OASTATUS_OVERRUN_STATUS (1 << 3)
566 #define GEN8_OASTATUS_COUNTER_OVERFLOW (1 << 2)
567 #define GEN8_OASTATUS_OABUFFER_OVERFLOW (1 << 1)
568 #define GEN8_OASTATUS_REPORT_LOST (1 << 0)
570 #define GEN8_OAHEADPTR _MMIO(0x2B0C)
571 #define GEN8_OAHEADPTR_MASK 0xffffffc0
572 #define GEN8_OATAILPTR _MMIO(0x2B10)
573 #define GEN8_OATAILPTR_MASK 0xffffffc0
575 #define OABUFFER_SIZE_128K (0 << 3)
576 #define OABUFFER_SIZE_256K (1 << 3)
577 #define OABUFFER_SIZE_512K (2 << 3)
578 #define OABUFFER_SIZE_1M (3 << 3)
579 #define OABUFFER_SIZE_2M (4 << 3)
580 #define OABUFFER_SIZE_4M (5 << 3)
581 #define OABUFFER_SIZE_8M (6 << 3)
582 #define OABUFFER_SIZE_16M (7 << 3)
585 * Flexible, Aggregate EU Counter Registers.
586 * Note: these aren't contiguous
588 #define EU_PERF_CNTL0 _MMIO(0xe458)
589 #define EU_PERF_CNTL1 _MMIO(0xe558)
590 #define EU_PERF_CNTL2 _MMIO(0xe658)
591 #define EU_PERF_CNTL3 _MMIO(0xe758)
592 #define EU_PERF_CNTL4 _MMIO(0xe45c)
593 #define EU_PERF_CNTL5 _MMIO(0xe55c)
594 #define EU_PERF_CNTL6 _MMIO(0xe65c)
600 #define OASTARTTRIG1 _MMIO(0x2710)
601 #define OASTARTTRIG1_THRESHOLD_COUNT_MASK_MBZ 0xffff0000
602 #define OASTARTTRIG1_THRESHOLD_MASK 0xffff
604 #define OASTARTTRIG2 _MMIO(0x2714)
605 #define OASTARTTRIG2_INVERT_A_0 (1 << 0)
606 #define OASTARTTRIG2_INVERT_A_1 (1 << 1)
607 #define OASTARTTRIG2_INVERT_A_2 (1 << 2)
608 #define OASTARTTRIG2_INVERT_A_3 (1 << 3)
609 #define OASTARTTRIG2_INVERT_A_4 (1 << 4)
610 #define OASTARTTRIG2_INVERT_A_5 (1 << 5)
611 #define OASTARTTRIG2_INVERT_A_6 (1 << 6)
612 #define OASTARTTRIG2_INVERT_A_7 (1 << 7)
613 #define OASTARTTRIG2_INVERT_A_8 (1 << 8)
614 #define OASTARTTRIG2_INVERT_A_9 (1 << 9)
615 #define OASTARTTRIG2_INVERT_A_10 (1 << 10)
616 #define OASTARTTRIG2_INVERT_A_11 (1 << 11)
617 #define OASTARTTRIG2_INVERT_A_12 (1 << 12)
618 #define OASTARTTRIG2_INVERT_A_13 (1 << 13)
619 #define OASTARTTRIG2_INVERT_A_14 (1 << 14)
620 #define OASTARTTRIG2_INVERT_A_15 (1 << 15)
621 #define OASTARTTRIG2_INVERT_B_0 (1 << 16)
622 #define OASTARTTRIG2_INVERT_B_1 (1 << 17)
623 #define OASTARTTRIG2_INVERT_B_2 (1 << 18)
624 #define OASTARTTRIG2_INVERT_B_3 (1 << 19)
625 #define OASTARTTRIG2_INVERT_C_0 (1 << 20)
626 #define OASTARTTRIG2_INVERT_C_1 (1 << 21)
627 #define OASTARTTRIG2_INVERT_D_0 (1 << 22)
628 #define OASTARTTRIG2_THRESHOLD_ENABLE (1 << 23)
629 #define OASTARTTRIG2_START_TRIG_FLAG_MBZ (1 << 24)
630 #define OASTARTTRIG2_EVENT_SELECT_0 (1 << 28)
631 #define OASTARTTRIG2_EVENT_SELECT_1 (1 << 29)
632 #define OASTARTTRIG2_EVENT_SELECT_2 (1 << 30)
633 #define OASTARTTRIG2_EVENT_SELECT_3 (1 << 31)
635 #define OASTARTTRIG3 _MMIO(0x2718)
636 #define OASTARTTRIG3_NOA_SELECT_MASK 0xf
637 #define OASTARTTRIG3_NOA_SELECT_8_SHIFT 0
638 #define OASTARTTRIG3_NOA_SELECT_9_SHIFT 4
639 #define OASTARTTRIG3_NOA_SELECT_10_SHIFT 8
640 #define OASTARTTRIG3_NOA_SELECT_11_SHIFT 12
641 #define OASTARTTRIG3_NOA_SELECT_12_SHIFT 16
642 #define OASTARTTRIG3_NOA_SELECT_13_SHIFT 20
643 #define OASTARTTRIG3_NOA_SELECT_14_SHIFT 24
644 #define OASTARTTRIG3_NOA_SELECT_15_SHIFT 28
646 #define OASTARTTRIG4 _MMIO(0x271c)
647 #define OASTARTTRIG4_NOA_SELECT_MASK 0xf
648 #define OASTARTTRIG4_NOA_SELECT_0_SHIFT 0
649 #define OASTARTTRIG4_NOA_SELECT_1_SHIFT 4
650 #define OASTARTTRIG4_NOA_SELECT_2_SHIFT 8
651 #define OASTARTTRIG4_NOA_SELECT_3_SHIFT 12
652 #define OASTARTTRIG4_NOA_SELECT_4_SHIFT 16
653 #define OASTARTTRIG4_NOA_SELECT_5_SHIFT 20
654 #define OASTARTTRIG4_NOA_SELECT_6_SHIFT 24
655 #define OASTARTTRIG4_NOA_SELECT_7_SHIFT 28
657 #define OASTARTTRIG5 _MMIO(0x2720)
658 #define OASTARTTRIG5_THRESHOLD_COUNT_MASK_MBZ 0xffff0000
659 #define OASTARTTRIG5_THRESHOLD_MASK 0xffff
661 #define OASTARTTRIG6 _MMIO(0x2724)
662 #define OASTARTTRIG6_INVERT_A_0 (1 << 0)
663 #define OASTARTTRIG6_INVERT_A_1 (1 << 1)
664 #define OASTARTTRIG6_INVERT_A_2 (1 << 2)
665 #define OASTARTTRIG6_INVERT_A_3 (1 << 3)
666 #define OASTARTTRIG6_INVERT_A_4 (1 << 4)
667 #define OASTARTTRIG6_INVERT_A_5 (1 << 5)
668 #define OASTARTTRIG6_INVERT_A_6 (1 << 6)
669 #define OASTARTTRIG6_INVERT_A_7 (1 << 7)
670 #define OASTARTTRIG6_INVERT_A_8 (1 << 8)
671 #define OASTARTTRIG6_INVERT_A_9 (1 << 9)
672 #define OASTARTTRIG6_INVERT_A_10 (1 << 10)
673 #define OASTARTTRIG6_INVERT_A_11 (1 << 11)
674 #define OASTARTTRIG6_INVERT_A_12 (1 << 12)
675 #define OASTARTTRIG6_INVERT_A_13 (1 << 13)
676 #define OASTARTTRIG6_INVERT_A_14 (1 << 14)
677 #define OASTARTTRIG6_INVERT_A_15 (1 << 15)
678 #define OASTARTTRIG6_INVERT_B_0 (1 << 16)
679 #define OASTARTTRIG6_INVERT_B_1 (1 << 17)
680 #define OASTARTTRIG6_INVERT_B_2 (1 << 18)
681 #define OASTARTTRIG6_INVERT_B_3 (1 << 19)
682 #define OASTARTTRIG6_INVERT_C_0 (1 << 20)
683 #define OASTARTTRIG6_INVERT_C_1 (1 << 21)
684 #define OASTARTTRIG6_INVERT_D_0 (1 << 22)
685 #define OASTARTTRIG6_THRESHOLD_ENABLE (1 << 23)
686 #define OASTARTTRIG6_START_TRIG_FLAG_MBZ (1 << 24)
687 #define OASTARTTRIG6_EVENT_SELECT_4 (1 << 28)
688 #define OASTARTTRIG6_EVENT_SELECT_5 (1 << 29)
689 #define OASTARTTRIG6_EVENT_SELECT_6 (1 << 30)
690 #define OASTARTTRIG6_EVENT_SELECT_7 (1 << 31)
692 #define OASTARTTRIG7 _MMIO(0x2728)
693 #define OASTARTTRIG7_NOA_SELECT_MASK 0xf
694 #define OASTARTTRIG7_NOA_SELECT_8_SHIFT 0
695 #define OASTARTTRIG7_NOA_SELECT_9_SHIFT 4
696 #define OASTARTTRIG7_NOA_SELECT_10_SHIFT 8
697 #define OASTARTTRIG7_NOA_SELECT_11_SHIFT 12
698 #define OASTARTTRIG7_NOA_SELECT_12_SHIFT 16
699 #define OASTARTTRIG7_NOA_SELECT_13_SHIFT 20
700 #define OASTARTTRIG7_NOA_SELECT_14_SHIFT 24
701 #define OASTARTTRIG7_NOA_SELECT_15_SHIFT 28
703 #define OASTARTTRIG8 _MMIO(0x272c)
704 #define OASTARTTRIG8_NOA_SELECT_MASK 0xf
705 #define OASTARTTRIG8_NOA_SELECT_0_SHIFT 0
706 #define OASTARTTRIG8_NOA_SELECT_1_SHIFT 4
707 #define OASTARTTRIG8_NOA_SELECT_2_SHIFT 8
708 #define OASTARTTRIG8_NOA_SELECT_3_SHIFT 12
709 #define OASTARTTRIG8_NOA_SELECT_4_SHIFT 16
710 #define OASTARTTRIG8_NOA_SELECT_5_SHIFT 20
711 #define OASTARTTRIG8_NOA_SELECT_6_SHIFT 24
712 #define OASTARTTRIG8_NOA_SELECT_7_SHIFT 28
714 #define OAREPORTTRIG1 _MMIO(0x2740)
715 #define OAREPORTTRIG1_THRESHOLD_MASK 0xffff
716 #define OAREPORTTRIG1_EDGE_LEVEL_TRIGER_SELECT_MASK 0xffff0000 /* 0=level */
718 #define OAREPORTTRIG2 _MMIO(0x2744)
719 #define OAREPORTTRIG2_INVERT_A_0 (1 << 0)
720 #define OAREPORTTRIG2_INVERT_A_1 (1 << 1)
721 #define OAREPORTTRIG2_INVERT_A_2 (1 << 2)
722 #define OAREPORTTRIG2_INVERT_A_3 (1 << 3)
723 #define OAREPORTTRIG2_INVERT_A_4 (1 << 4)
724 #define OAREPORTTRIG2_INVERT_A_5 (1 << 5)
725 #define OAREPORTTRIG2_INVERT_A_6 (1 << 6)
726 #define OAREPORTTRIG2_INVERT_A_7 (1 << 7)
727 #define OAREPORTTRIG2_INVERT_A_8 (1 << 8)
728 #define OAREPORTTRIG2_INVERT_A_9 (1 << 9)
729 #define OAREPORTTRIG2_INVERT_A_10 (1 << 10)
730 #define OAREPORTTRIG2_INVERT_A_11 (1 << 11)
731 #define OAREPORTTRIG2_INVERT_A_12 (1 << 12)
732 #define OAREPORTTRIG2_INVERT_A_13 (1 << 13)
733 #define OAREPORTTRIG2_INVERT_A_14 (1 << 14)
734 #define OAREPORTTRIG2_INVERT_A_15 (1 << 15)
735 #define OAREPORTTRIG2_INVERT_B_0 (1 << 16)
736 #define OAREPORTTRIG2_INVERT_B_1 (1 << 17)
737 #define OAREPORTTRIG2_INVERT_B_2 (1 << 18)
738 #define OAREPORTTRIG2_INVERT_B_3 (1 << 19)
739 #define OAREPORTTRIG2_INVERT_C_0 (1 << 20)
740 #define OAREPORTTRIG2_INVERT_C_1 (1 << 21)
741 #define OAREPORTTRIG2_INVERT_D_0 (1 << 22)
742 #define OAREPORTTRIG2_THRESHOLD_ENABLE (1 << 23)
743 #define OAREPORTTRIG2_REPORT_TRIGGER_ENABLE (1 << 31)
745 #define OAREPORTTRIG3 _MMIO(0x2748)
746 #define OAREPORTTRIG3_NOA_SELECT_MASK 0xf
747 #define OAREPORTTRIG3_NOA_SELECT_8_SHIFT 0
748 #define OAREPORTTRIG3_NOA_SELECT_9_SHIFT 4
749 #define OAREPORTTRIG3_NOA_SELECT_10_SHIFT 8
750 #define OAREPORTTRIG3_NOA_SELECT_11_SHIFT 12
751 #define OAREPORTTRIG3_NOA_SELECT_12_SHIFT 16
752 #define OAREPORTTRIG3_NOA_SELECT_13_SHIFT 20
753 #define OAREPORTTRIG3_NOA_SELECT_14_SHIFT 24
754 #define OAREPORTTRIG3_NOA_SELECT_15_SHIFT 28
756 #define OAREPORTTRIG4 _MMIO(0x274c)
757 #define OAREPORTTRIG4_NOA_SELECT_MASK 0xf
758 #define OAREPORTTRIG4_NOA_SELECT_0_SHIFT 0
759 #define OAREPORTTRIG4_NOA_SELECT_1_SHIFT 4
760 #define OAREPORTTRIG4_NOA_SELECT_2_SHIFT 8
761 #define OAREPORTTRIG4_NOA_SELECT_3_SHIFT 12
762 #define OAREPORTTRIG4_NOA_SELECT_4_SHIFT 16
763 #define OAREPORTTRIG4_NOA_SELECT_5_SHIFT 20
764 #define OAREPORTTRIG4_NOA_SELECT_6_SHIFT 24
765 #define OAREPORTTRIG4_NOA_SELECT_7_SHIFT 28
767 #define OAREPORTTRIG5 _MMIO(0x2750)
768 #define OAREPORTTRIG5_THRESHOLD_MASK 0xffff
769 #define OAREPORTTRIG5_EDGE_LEVEL_TRIGER_SELECT_MASK 0xffff0000 /* 0=level */
771 #define OAREPORTTRIG6 _MMIO(0x2754)
772 #define OAREPORTTRIG6_INVERT_A_0 (1 << 0)
773 #define OAREPORTTRIG6_INVERT_A_1 (1 << 1)
774 #define OAREPORTTRIG6_INVERT_A_2 (1 << 2)
775 #define OAREPORTTRIG6_INVERT_A_3 (1 << 3)
776 #define OAREPORTTRIG6_INVERT_A_4 (1 << 4)
777 #define OAREPORTTRIG6_INVERT_A_5 (1 << 5)
778 #define OAREPORTTRIG6_INVERT_A_6 (1 << 6)
779 #define OAREPORTTRIG6_INVERT_A_7 (1 << 7)
780 #define OAREPORTTRIG6_INVERT_A_8 (1 << 8)
781 #define OAREPORTTRIG6_INVERT_A_9 (1 << 9)
782 #define OAREPORTTRIG6_INVERT_A_10 (1 << 10)
783 #define OAREPORTTRIG6_INVERT_A_11 (1 << 11)
784 #define OAREPORTTRIG6_INVERT_A_12 (1 << 12)
785 #define OAREPORTTRIG6_INVERT_A_13 (1 << 13)
786 #define OAREPORTTRIG6_INVERT_A_14 (1 << 14)
787 #define OAREPORTTRIG6_INVERT_A_15 (1 << 15)
788 #define OAREPORTTRIG6_INVERT_B_0 (1 << 16)
789 #define OAREPORTTRIG6_INVERT_B_1 (1 << 17)
790 #define OAREPORTTRIG6_INVERT_B_2 (1 << 18)
791 #define OAREPORTTRIG6_INVERT_B_3 (1 << 19)
792 #define OAREPORTTRIG6_INVERT_C_0 (1 << 20)
793 #define OAREPORTTRIG6_INVERT_C_1 (1 << 21)
794 #define OAREPORTTRIG6_INVERT_D_0 (1 << 22)
795 #define OAREPORTTRIG6_THRESHOLD_ENABLE (1 << 23)
796 #define OAREPORTTRIG6_REPORT_TRIGGER_ENABLE (1 << 31)
798 #define OAREPORTTRIG7 _MMIO(0x2758)
799 #define OAREPORTTRIG7_NOA_SELECT_MASK 0xf
800 #define OAREPORTTRIG7_NOA_SELECT_8_SHIFT 0
801 #define OAREPORTTRIG7_NOA_SELECT_9_SHIFT 4
802 #define OAREPORTTRIG7_NOA_SELECT_10_SHIFT 8
803 #define OAREPORTTRIG7_NOA_SELECT_11_SHIFT 12
804 #define OAREPORTTRIG7_NOA_SELECT_12_SHIFT 16
805 #define OAREPORTTRIG7_NOA_SELECT_13_SHIFT 20
806 #define OAREPORTTRIG7_NOA_SELECT_14_SHIFT 24
807 #define OAREPORTTRIG7_NOA_SELECT_15_SHIFT 28
809 #define OAREPORTTRIG8 _MMIO(0x275c)
810 #define OAREPORTTRIG8_NOA_SELECT_MASK 0xf
811 #define OAREPORTTRIG8_NOA_SELECT_0_SHIFT 0
812 #define OAREPORTTRIG8_NOA_SELECT_1_SHIFT 4
813 #define OAREPORTTRIG8_NOA_SELECT_2_SHIFT 8
814 #define OAREPORTTRIG8_NOA_SELECT_3_SHIFT 12
815 #define OAREPORTTRIG8_NOA_SELECT_4_SHIFT 16
816 #define OAREPORTTRIG8_NOA_SELECT_5_SHIFT 20
817 #define OAREPORTTRIG8_NOA_SELECT_6_SHIFT 24
818 #define OAREPORTTRIG8_NOA_SELECT_7_SHIFT 28
821 #define OACEC_COMPARE_LESS_OR_EQUAL 6
822 #define OACEC_COMPARE_NOT_EQUAL 5
823 #define OACEC_COMPARE_LESS_THAN 4
824 #define OACEC_COMPARE_GREATER_OR_EQUAL 3
825 #define OACEC_COMPARE_EQUAL 2
826 #define OACEC_COMPARE_GREATER_THAN 1
827 #define OACEC_COMPARE_ANY_EQUAL 0
829 #define OACEC_COMPARE_VALUE_MASK 0xffff
830 #define OACEC_COMPARE_VALUE_SHIFT 3
832 #define OACEC_SELECT_NOA (0 << 19)
833 #define OACEC_SELECT_PREV (1 << 19)
834 #define OACEC_SELECT_BOOLEAN (2 << 19)
837 #define OACEC_MASK_MASK 0xffff
838 #define OACEC_CONSIDERATIONS_MASK 0xffff
839 #define OACEC_CONSIDERATIONS_SHIFT 16
841 #define OACEC0_0 _MMIO(0x2770)
842 #define OACEC0_1 _MMIO(0x2774)
843 #define OACEC1_0 _MMIO(0x2778)
844 #define OACEC1_1 _MMIO(0x277c)
845 #define OACEC2_0 _MMIO(0x2780)
846 #define OACEC2_1 _MMIO(0x2784)
847 #define OACEC3_0 _MMIO(0x2788)
848 #define OACEC3_1 _MMIO(0x278c)
849 #define OACEC4_0 _MMIO(0x2790)
850 #define OACEC4_1 _MMIO(0x2794)
851 #define OACEC5_0 _MMIO(0x2798)
852 #define OACEC5_1 _MMIO(0x279c)
853 #define OACEC6_0 _MMIO(0x27a0)
854 #define OACEC6_1 _MMIO(0x27a4)
855 #define OACEC7_0 _MMIO(0x27a8)
856 #define OACEC7_1 _MMIO(0x27ac)
858 /* OA perf counters */
859 #define OA_PERFCNT1_LO _MMIO(0x91B8)
860 #define OA_PERFCNT1_HI _MMIO(0x91BC)
861 #define OA_PERFCNT2_LO _MMIO(0x91C0)
862 #define OA_PERFCNT2_HI _MMIO(0x91C4)
863 #define OA_PERFCNT3_LO _MMIO(0x91C8)
864 #define OA_PERFCNT3_HI _MMIO(0x91CC)
865 #define OA_PERFCNT4_LO _MMIO(0x91D8)
866 #define OA_PERFCNT4_HI _MMIO(0x91DC)
868 #define OA_PERFMATRIX_LO _MMIO(0x91C8)
869 #define OA_PERFMATRIX_HI _MMIO(0x91CC)
871 /* RPM unit config (Gen8+) */
872 #define RPM_CONFIG0 _MMIO(0x0D00)
873 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
874 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (1 << GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
875 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 0
876 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 1
877 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
878 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
879 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 0
880 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 1
881 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ 2
882 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ 3
883 #define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT 1
884 #define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK (0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT)
886 #define RPM_CONFIG1 _MMIO(0x0D04)
887 #define GEN10_GT_NOA_ENABLE (1 << 9)
889 /* GPM unit config (Gen9+) */
890 #define CTC_MODE _MMIO(0xA26C)
891 #define CTC_SOURCE_PARAMETER_MASK 1
892 #define CTC_SOURCE_CRYSTAL_CLOCK 0
893 #define CTC_SOURCE_DIVIDE_LOGIC 1
894 #define CTC_SHIFT_PARAMETER_SHIFT 1
895 #define CTC_SHIFT_PARAMETER_MASK (0x3 << CTC_SHIFT_PARAMETER_SHIFT)
897 /* RCP unit config (Gen8+) */
898 #define RCP_CONFIG _MMIO(0x0D08)
901 #define HSW_MBVID2_NOA0 _MMIO(0x9E80)
902 #define HSW_MBVID2_NOA1 _MMIO(0x9E84)
903 #define HSW_MBVID2_NOA2 _MMIO(0x9E88)
904 #define HSW_MBVID2_NOA3 _MMIO(0x9E8C)
905 #define HSW_MBVID2_NOA4 _MMIO(0x9E90)
906 #define HSW_MBVID2_NOA5 _MMIO(0x9E94)
907 #define HSW_MBVID2_NOA6 _MMIO(0x9E98)
908 #define HSW_MBVID2_NOA7 _MMIO(0x9E9C)
909 #define HSW_MBVID2_NOA8 _MMIO(0x9EA0)
910 #define HSW_MBVID2_NOA9 _MMIO(0x9EA4)
912 #define HSW_MBVID2_MISR0 _MMIO(0x9EC0)
915 #define NOA_CONFIG(i) _MMIO(0x0D0C + (i) * 4)
917 #define MICRO_BP0_0 _MMIO(0x9800)
918 #define MICRO_BP0_2 _MMIO(0x9804)
919 #define MICRO_BP0_1 _MMIO(0x9808)
921 #define MICRO_BP1_0 _MMIO(0x980C)
922 #define MICRO_BP1_2 _MMIO(0x9810)
923 #define MICRO_BP1_1 _MMIO(0x9814)
925 #define MICRO_BP2_0 _MMIO(0x9818)
926 #define MICRO_BP2_2 _MMIO(0x981C)
927 #define MICRO_BP2_1 _MMIO(0x9820)
929 #define MICRO_BP3_0 _MMIO(0x9824)
930 #define MICRO_BP3_2 _MMIO(0x9828)
931 #define MICRO_BP3_1 _MMIO(0x982C)
933 #define MICRO_BP_TRIGGER _MMIO(0x9830)
934 #define MICRO_BP3_COUNT_STATUS01 _MMIO(0x9834)
935 #define MICRO_BP3_COUNT_STATUS23 _MMIO(0x9838)
936 #define MICRO_BP_FIRED_ARMED _MMIO(0x983C)
938 #define GDT_CHICKEN_BITS _MMIO(0x9840)
939 #define GT_NOA_ENABLE 0x00000080
941 #define NOA_DATA _MMIO(0x986C)
942 #define NOA_WRITE _MMIO(0x9888)
944 #define _GEN7_PIPEA_DE_LOAD_SL 0x70068
945 #define _GEN7_PIPEB_DE_LOAD_SL 0x71068
946 #define GEN7_PIPE_DE_LOAD_SL(pipe) _MMIO_PIPE(pipe, _GEN7_PIPEA_DE_LOAD_SL, _GEN7_PIPEB_DE_LOAD_SL)
951 #define DEBUG_RESET_I830 _MMIO(0x6070)
952 #define DEBUG_RESET_FULL (1 << 7)
953 #define DEBUG_RESET_RENDER (1 << 8)
954 #define DEBUG_RESET_DISPLAY (1 << 9)
959 #define VLV_IOSF_DOORBELL_REQ _MMIO(VLV_DISPLAY_BASE + 0x2100)
960 #define IOSF_DEVFN_SHIFT 24
961 #define IOSF_OPCODE_SHIFT 16
962 #define IOSF_PORT_SHIFT 8
963 #define IOSF_BYTE_ENABLES_SHIFT 4
964 #define IOSF_BAR_SHIFT 1
965 #define IOSF_SB_BUSY (1 << 0)
966 #define IOSF_PORT_BUNIT 0x03
967 #define IOSF_PORT_PUNIT 0x04
968 #define IOSF_PORT_NC 0x11
969 #define IOSF_PORT_DPIO 0x12
970 #define IOSF_PORT_GPIO_NC 0x13
971 #define IOSF_PORT_CCK 0x14
972 #define IOSF_PORT_DPIO_2 0x1a
973 #define IOSF_PORT_FLISDSI 0x1b
974 #define IOSF_PORT_GPIO_SC 0x48
975 #define IOSF_PORT_GPIO_SUS 0xa8
976 #define IOSF_PORT_CCU 0xa9
977 #define CHV_IOSF_PORT_GPIO_N 0x13
978 #define CHV_IOSF_PORT_GPIO_SE 0x48
979 #define CHV_IOSF_PORT_GPIO_E 0xa8
980 #define CHV_IOSF_PORT_GPIO_SW 0xb2
981 #define VLV_IOSF_DATA _MMIO(VLV_DISPLAY_BASE + 0x2104)
982 #define VLV_IOSF_ADDR _MMIO(VLV_DISPLAY_BASE + 0x2108)
984 /* See configdb bunit SB addr map */
985 #define BUNIT_REG_BISOC 0x11
987 #define PUNIT_REG_DSPFREQ 0x36
988 #define DSPFREQSTAT_SHIFT_CHV 24
989 #define DSPFREQSTAT_MASK_CHV (0x1f << DSPFREQSTAT_SHIFT_CHV)
990 #define DSPFREQGUAR_SHIFT_CHV 8
991 #define DSPFREQGUAR_MASK_CHV (0x1f << DSPFREQGUAR_SHIFT_CHV)
992 #define DSPFREQSTAT_SHIFT 30
993 #define DSPFREQSTAT_MASK (0x3 << DSPFREQSTAT_SHIFT)
994 #define DSPFREQGUAR_SHIFT 14
995 #define DSPFREQGUAR_MASK (0x3 << DSPFREQGUAR_SHIFT)
996 #define DSP_MAXFIFO_PM5_STATUS (1 << 22) /* chv */
997 #define DSP_AUTO_CDCLK_GATE_DISABLE (1 << 7) /* chv */
998 #define DSP_MAXFIFO_PM5_ENABLE (1 << 6) /* chv */
999 #define _DP_SSC(val, pipe) ((val) << (2 * (pipe)))
1000 #define DP_SSC_MASK(pipe) _DP_SSC(0x3, (pipe))
1001 #define DP_SSC_PWR_ON(pipe) _DP_SSC(0x0, (pipe))
1002 #define DP_SSC_CLK_GATE(pipe) _DP_SSC(0x1, (pipe))
1003 #define DP_SSC_RESET(pipe) _DP_SSC(0x2, (pipe))
1004 #define DP_SSC_PWR_GATE(pipe) _DP_SSC(0x3, (pipe))
1005 #define _DP_SSS(val, pipe) ((val) << (2 * (pipe) + 16))
1006 #define DP_SSS_MASK(pipe) _DP_SSS(0x3, (pipe))
1007 #define DP_SSS_PWR_ON(pipe) _DP_SSS(0x0, (pipe))
1008 #define DP_SSS_CLK_GATE(pipe) _DP_SSS(0x1, (pipe))
1009 #define DP_SSS_RESET(pipe) _DP_SSS(0x2, (pipe))
1010 #define DP_SSS_PWR_GATE(pipe) _DP_SSS(0x3, (pipe))
1013 * i915_power_well_id:
1015 * Platform specific IDs used to look up power wells and - except for custom
1016 * power wells - to define request/status register flag bit positions. As such
1017 * the set of IDs on a given platform must be unique and except for custom
1018 * power wells their value must stay fixed.
1020 enum i915_power_well_id {
1023 * - custom power well
1025 I830_DISP_PW_PIPES = 0,
1029 * - PUNIT_REG_PWRGT_CTRL (bit: id*2),
1030 * PUNIT_REG_PWRGT_STATUS (bit: id*2) (PUNIT HAS v0.8)
1032 PUNIT_POWER_WELL_RENDER = 0,
1033 PUNIT_POWER_WELL_MEDIA = 1,
1034 PUNIT_POWER_WELL_DISP2D = 3,
1035 PUNIT_POWER_WELL_DPIO_CMN_BC = 5,
1036 PUNIT_POWER_WELL_DPIO_TX_B_LANES_01 = 6,
1037 PUNIT_POWER_WELL_DPIO_TX_B_LANES_23 = 7,
1038 PUNIT_POWER_WELL_DPIO_TX_C_LANES_01 = 8,
1039 PUNIT_POWER_WELL_DPIO_TX_C_LANES_23 = 9,
1040 PUNIT_POWER_WELL_DPIO_RX0 = 10,
1041 PUNIT_POWER_WELL_DPIO_RX1 = 11,
1042 PUNIT_POWER_WELL_DPIO_CMN_D = 12,
1043 /* - custom power well */
1044 CHV_DISP_PW_PIPE_A, /* 13 */
1048 * - HSW_PWR_WELL_CTL_DRIVER(0) (status bit: id*2, req bit: id*2+1)
1050 HSW_DISP_PW_GLOBAL = 15,
1054 * - HSW_PWR_WELL_CTL_DRIVER(0) (status bit: id*2, req bit: id*2+1)
1056 SKL_DISP_PW_MISC_IO = 0,
1057 SKL_DISP_PW_DDI_A_E,
1058 GLK_DISP_PW_DDI_A = SKL_DISP_PW_DDI_A_E,
1059 CNL_DISP_PW_DDI_A = SKL_DISP_PW_DDI_A_E,
1063 CNL_DISP_PW_DDI_F = 6,
1065 GLK_DISP_PW_AUX_A = 8,
1068 CNL_DISP_PW_AUX_A = GLK_DISP_PW_AUX_A,
1069 CNL_DISP_PW_AUX_B = GLK_DISP_PW_AUX_B,
1070 CNL_DISP_PW_AUX_C = GLK_DISP_PW_AUX_C,
1077 /* - custom power wells */
1081 GLK_DPIO_CMN_C, /* 19 */
1084 * Multiple platforms.
1085 * Must start following the highest ID of any platform.
1086 * - custom power wells
1088 I915_DISP_PW_ALWAYS_ON = 20,
1091 #define PUNIT_REG_PWRGT_CTRL 0x60
1092 #define PUNIT_REG_PWRGT_STATUS 0x61
1093 #define PUNIT_PWRGT_MASK(power_well) (3 << ((power_well) * 2))
1094 #define PUNIT_PWRGT_PWR_ON(power_well) (0 << ((power_well) * 2))
1095 #define PUNIT_PWRGT_CLK_GATE(power_well) (1 << ((power_well) * 2))
1096 #define PUNIT_PWRGT_RESET(power_well) (2 << ((power_well) * 2))
1097 #define PUNIT_PWRGT_PWR_GATE(power_well) (3 << ((power_well) * 2))
1099 #define PUNIT_REG_GPU_LFM 0xd3
1100 #define PUNIT_REG_GPU_FREQ_REQ 0xd4
1101 #define PUNIT_REG_GPU_FREQ_STS 0xd8
1102 #define GPLLENABLE (1 << 4)
1103 #define GENFREQSTATUS (1 << 0)
1104 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ 0xdc
1105 #define PUNIT_REG_CZ_TIMESTAMP 0xce
1107 #define PUNIT_FUSE_BUS2 0xf6 /* bits 47:40 */
1108 #define PUNIT_FUSE_BUS1 0xf5 /* bits 55:48 */
1110 #define FB_GFX_FMAX_AT_VMAX_FUSE 0x136
1111 #define FB_GFX_FREQ_FUSE_MASK 0xff
1112 #define FB_GFX_FMAX_AT_VMAX_2SS4EU_FUSE_SHIFT 24
1113 #define FB_GFX_FMAX_AT_VMAX_2SS6EU_FUSE_SHIFT 16
1114 #define FB_GFX_FMAX_AT_VMAX_2SS8EU_FUSE_SHIFT 8
1116 #define FB_GFX_FMIN_AT_VMIN_FUSE 0x137
1117 #define FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT 8
1119 #define PUNIT_REG_DDR_SETUP2 0x139
1120 #define FORCE_DDR_FREQ_REQ_ACK (1 << 8)
1121 #define FORCE_DDR_LOW_FREQ (1 << 1)
1122 #define FORCE_DDR_HIGH_FREQ (1 << 0)
1124 #define PUNIT_GPU_STATUS_REG 0xdb
1125 #define PUNIT_GPU_STATUS_MAX_FREQ_SHIFT 16
1126 #define PUNIT_GPU_STATUS_MAX_FREQ_MASK 0xff
1127 #define PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT 8
1128 #define PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK 0xff
1130 #define PUNIT_GPU_DUTYCYCLE_REG 0xdf
1131 #define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_SHIFT 8
1132 #define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_MASK 0xff
1134 #define IOSF_NC_FB_GFX_FREQ_FUSE 0x1c
1135 #define FB_GFX_MAX_FREQ_FUSE_SHIFT 3
1136 #define FB_GFX_MAX_FREQ_FUSE_MASK 0x000007f8
1137 #define FB_GFX_FGUARANTEED_FREQ_FUSE_SHIFT 11
1138 #define FB_GFX_FGUARANTEED_FREQ_FUSE_MASK 0x0007f800
1139 #define IOSF_NC_FB_GFX_FMAX_FUSE_HI 0x34
1140 #define FB_FMAX_VMIN_FREQ_HI_MASK 0x00000007
1141 #define IOSF_NC_FB_GFX_FMAX_FUSE_LO 0x30
1142 #define FB_FMAX_VMIN_FREQ_LO_SHIFT 27
1143 #define FB_FMAX_VMIN_FREQ_LO_MASK 0xf8000000
1145 #define VLV_TURBO_SOC_OVERRIDE 0x04
1146 #define VLV_OVERRIDE_EN 1
1147 #define VLV_SOC_TDP_EN (1 << 1)
1148 #define VLV_BIAS_CPU_125_SOC_875 (6 << 2)
1149 #define CHV_BIAS_CPU_50_SOC_50 (3 << 2)
1151 /* vlv2 north clock has */
1152 #define CCK_FUSE_REG 0x8
1153 #define CCK_FUSE_HPLL_FREQ_MASK 0x3
1154 #define CCK_REG_DSI_PLL_FUSE 0x44
1155 #define CCK_REG_DSI_PLL_CONTROL 0x48
1156 #define DSI_PLL_VCO_EN (1 << 31)
1157 #define DSI_PLL_LDO_GATE (1 << 30)
1158 #define DSI_PLL_P1_POST_DIV_SHIFT 17
1159 #define DSI_PLL_P1_POST_DIV_MASK (0x1ff << 17)
1160 #define DSI_PLL_P2_MUX_DSI0_DIV2 (1 << 13)
1161 #define DSI_PLL_P3_MUX_DSI1_DIV2 (1 << 12)
1162 #define DSI_PLL_MUX_MASK (3 << 9)
1163 #define DSI_PLL_MUX_DSI0_DSIPLL (0 << 10)
1164 #define DSI_PLL_MUX_DSI0_CCK (1 << 10)
1165 #define DSI_PLL_MUX_DSI1_DSIPLL (0 << 9)
1166 #define DSI_PLL_MUX_DSI1_CCK (1 << 9)
1167 #define DSI_PLL_CLK_GATE_MASK (0xf << 5)
1168 #define DSI_PLL_CLK_GATE_DSI0_DSIPLL (1 << 8)
1169 #define DSI_PLL_CLK_GATE_DSI1_DSIPLL (1 << 7)
1170 #define DSI_PLL_CLK_GATE_DSI0_CCK (1 << 6)
1171 #define DSI_PLL_CLK_GATE_DSI1_CCK (1 << 5)
1172 #define DSI_PLL_LOCK (1 << 0)
1173 #define CCK_REG_DSI_PLL_DIVIDER 0x4c
1174 #define DSI_PLL_LFSR (1 << 31)
1175 #define DSI_PLL_FRACTION_EN (1 << 30)
1176 #define DSI_PLL_FRAC_COUNTER_SHIFT 27
1177 #define DSI_PLL_FRAC_COUNTER_MASK (7 << 27)
1178 #define DSI_PLL_USYNC_CNT_SHIFT 18
1179 #define DSI_PLL_USYNC_CNT_MASK (0x1ff << 18)
1180 #define DSI_PLL_N1_DIV_SHIFT 16
1181 #define DSI_PLL_N1_DIV_MASK (3 << 16)
1182 #define DSI_PLL_M1_DIV_SHIFT 0
1183 #define DSI_PLL_M1_DIV_MASK (0x1ff << 0)
1184 #define CCK_CZ_CLOCK_CONTROL 0x62
1185 #define CCK_GPLL_CLOCK_CONTROL 0x67
1186 #define CCK_DISPLAY_CLOCK_CONTROL 0x6b
1187 #define CCK_DISPLAY_REF_CLOCK_CONTROL 0x6c
1188 #define CCK_TRUNK_FORCE_ON (1 << 17)
1189 #define CCK_TRUNK_FORCE_OFF (1 << 16)
1190 #define CCK_FREQUENCY_STATUS (0x1f << 8)
1191 #define CCK_FREQUENCY_STATUS_SHIFT 8
1192 #define CCK_FREQUENCY_VALUES (0x1f << 0)
1194 /* DPIO registers */
1195 #define DPIO_DEVFN 0
1197 #define DPIO_CTL _MMIO(VLV_DISPLAY_BASE + 0x2110)
1198 #define DPIO_MODSEL1 (1 << 3) /* if ref clk b == 27 */
1199 #define DPIO_MODSEL0 (1 << 2) /* if ref clk a == 27 */
1200 #define DPIO_SFR_BYPASS (1 << 1)
1201 #define DPIO_CMNRST (1 << 0)
1203 #define DPIO_PHY(pipe) ((pipe) >> 1)
1204 #define DPIO_PHY_IOSF_PORT(phy) (dev_priv->dpio_phy_iosf_port[phy])
1207 * Per pipe/PLL DPIO regs
1209 #define _VLV_PLL_DW3_CH0 0x800c
1210 #define DPIO_POST_DIV_SHIFT (28) /* 3 bits */
1211 #define DPIO_POST_DIV_DAC 0
1212 #define DPIO_POST_DIV_HDMIDP 1 /* DAC 225-400M rate */
1213 #define DPIO_POST_DIV_LVDS1 2
1214 #define DPIO_POST_DIV_LVDS2 3
1215 #define DPIO_K_SHIFT (24) /* 4 bits */
1216 #define DPIO_P1_SHIFT (21) /* 3 bits */
1217 #define DPIO_P2_SHIFT (16) /* 5 bits */
1218 #define DPIO_N_SHIFT (12) /* 4 bits */
1219 #define DPIO_ENABLE_CALIBRATION (1 << 11)
1220 #define DPIO_M1DIV_SHIFT (8) /* 3 bits */
1221 #define DPIO_M2DIV_MASK 0xff
1222 #define _VLV_PLL_DW3_CH1 0x802c
1223 #define VLV_PLL_DW3(ch) _PIPE(ch, _VLV_PLL_DW3_CH0, _VLV_PLL_DW3_CH1)
1225 #define _VLV_PLL_DW5_CH0 0x8014
1226 #define DPIO_REFSEL_OVERRIDE 27
1227 #define DPIO_PLL_MODESEL_SHIFT 24 /* 3 bits */
1228 #define DPIO_BIAS_CURRENT_CTL_SHIFT 21 /* 3 bits, always 0x7 */
1229 #define DPIO_PLL_REFCLK_SEL_SHIFT 16 /* 2 bits */
1230 #define DPIO_PLL_REFCLK_SEL_MASK 3
1231 #define DPIO_DRIVER_CTL_SHIFT 12 /* always set to 0x8 */
1232 #define DPIO_CLK_BIAS_CTL_SHIFT 8 /* always set to 0x5 */
1233 #define _VLV_PLL_DW5_CH1 0x8034
1234 #define VLV_PLL_DW5(ch) _PIPE(ch, _VLV_PLL_DW5_CH0, _VLV_PLL_DW5_CH1)
1236 #define _VLV_PLL_DW7_CH0 0x801c
1237 #define _VLV_PLL_DW7_CH1 0x803c
1238 #define VLV_PLL_DW7(ch) _PIPE(ch, _VLV_PLL_DW7_CH0, _VLV_PLL_DW7_CH1)
1240 #define _VLV_PLL_DW8_CH0 0x8040
1241 #define _VLV_PLL_DW8_CH1 0x8060
1242 #define VLV_PLL_DW8(ch) _PIPE(ch, _VLV_PLL_DW8_CH0, _VLV_PLL_DW8_CH1)
1244 #define VLV_PLL_DW9_BCAST 0xc044
1245 #define _VLV_PLL_DW9_CH0 0x8044
1246 #define _VLV_PLL_DW9_CH1 0x8064
1247 #define VLV_PLL_DW9(ch) _PIPE(ch, _VLV_PLL_DW9_CH0, _VLV_PLL_DW9_CH1)
1249 #define _VLV_PLL_DW10_CH0 0x8048
1250 #define _VLV_PLL_DW10_CH1 0x8068
1251 #define VLV_PLL_DW10(ch) _PIPE(ch, _VLV_PLL_DW10_CH0, _VLV_PLL_DW10_CH1)
1253 #define _VLV_PLL_DW11_CH0 0x804c
1254 #define _VLV_PLL_DW11_CH1 0x806c
1255 #define VLV_PLL_DW11(ch) _PIPE(ch, _VLV_PLL_DW11_CH0, _VLV_PLL_DW11_CH1)
1257 /* Spec for ref block start counts at DW10 */
1258 #define VLV_REF_DW13 0x80ac
1260 #define VLV_CMN_DW0 0x8100
1263 * Per DDI channel DPIO regs
1266 #define _VLV_PCS_DW0_CH0 0x8200
1267 #define _VLV_PCS_DW0_CH1 0x8400
1268 #define DPIO_PCS_TX_LANE2_RESET (1 << 16)
1269 #define DPIO_PCS_TX_LANE1_RESET (1 << 7)
1270 #define DPIO_LEFT_TXFIFO_RST_MASTER2 (1 << 4)
1271 #define DPIO_RIGHT_TXFIFO_RST_MASTER2 (1 << 3)
1272 #define VLV_PCS_DW0(ch) _PORT(ch, _VLV_PCS_DW0_CH0, _VLV_PCS_DW0_CH1)
1274 #define _VLV_PCS01_DW0_CH0 0x200
1275 #define _VLV_PCS23_DW0_CH0 0x400
1276 #define _VLV_PCS01_DW0_CH1 0x2600
1277 #define _VLV_PCS23_DW0_CH1 0x2800
1278 #define VLV_PCS01_DW0(ch) _PORT(ch, _VLV_PCS01_DW0_CH0, _VLV_PCS01_DW0_CH1)
1279 #define VLV_PCS23_DW0(ch) _PORT(ch, _VLV_PCS23_DW0_CH0, _VLV_PCS23_DW0_CH1)
1281 #define _VLV_PCS_DW1_CH0 0x8204
1282 #define _VLV_PCS_DW1_CH1 0x8404
1283 #define CHV_PCS_REQ_SOFTRESET_EN (1 << 23)
1284 #define DPIO_PCS_CLK_CRI_RXEB_EIOS_EN (1 << 22)
1285 #define DPIO_PCS_CLK_CRI_RXDIGFILTSG_EN (1 << 21)
1286 #define DPIO_PCS_CLK_DATAWIDTH_SHIFT (6)
1287 #define DPIO_PCS_CLK_SOFT_RESET (1 << 5)
1288 #define VLV_PCS_DW1(ch) _PORT(ch, _VLV_PCS_DW1_CH0, _VLV_PCS_DW1_CH1)
1290 #define _VLV_PCS01_DW1_CH0 0x204
1291 #define _VLV_PCS23_DW1_CH0 0x404
1292 #define _VLV_PCS01_DW1_CH1 0x2604
1293 #define _VLV_PCS23_DW1_CH1 0x2804
1294 #define VLV_PCS01_DW1(ch) _PORT(ch, _VLV_PCS01_DW1_CH0, _VLV_PCS01_DW1_CH1)
1295 #define VLV_PCS23_DW1(ch) _PORT(ch, _VLV_PCS23_DW1_CH0, _VLV_PCS23_DW1_CH1)
1297 #define _VLV_PCS_DW8_CH0 0x8220
1298 #define _VLV_PCS_DW8_CH1 0x8420
1299 #define CHV_PCS_USEDCLKCHANNEL_OVRRIDE (1 << 20)
1300 #define CHV_PCS_USEDCLKCHANNEL (1 << 21)
1301 #define VLV_PCS_DW8(ch) _PORT(ch, _VLV_PCS_DW8_CH0, _VLV_PCS_DW8_CH1)
1303 #define _VLV_PCS01_DW8_CH0 0x0220
1304 #define _VLV_PCS23_DW8_CH0 0x0420
1305 #define _VLV_PCS01_DW8_CH1 0x2620
1306 #define _VLV_PCS23_DW8_CH1 0x2820
1307 #define VLV_PCS01_DW8(port) _PORT(port, _VLV_PCS01_DW8_CH0, _VLV_PCS01_DW8_CH1)
1308 #define VLV_PCS23_DW8(port) _PORT(port, _VLV_PCS23_DW8_CH0, _VLV_PCS23_DW8_CH1)
1310 #define _VLV_PCS_DW9_CH0 0x8224
1311 #define _VLV_PCS_DW9_CH1 0x8424
1312 #define DPIO_PCS_TX2MARGIN_MASK (0x7 << 13)
1313 #define DPIO_PCS_TX2MARGIN_000 (0 << 13)
1314 #define DPIO_PCS_TX2MARGIN_101 (1 << 13)
1315 #define DPIO_PCS_TX1MARGIN_MASK (0x7 << 10)
1316 #define DPIO_PCS_TX1MARGIN_000 (0 << 10)
1317 #define DPIO_PCS_TX1MARGIN_101 (1 << 10)
1318 #define VLV_PCS_DW9(ch) _PORT(ch, _VLV_PCS_DW9_CH0, _VLV_PCS_DW9_CH1)
1320 #define _VLV_PCS01_DW9_CH0 0x224
1321 #define _VLV_PCS23_DW9_CH0 0x424
1322 #define _VLV_PCS01_DW9_CH1 0x2624
1323 #define _VLV_PCS23_DW9_CH1 0x2824
1324 #define VLV_PCS01_DW9(ch) _PORT(ch, _VLV_PCS01_DW9_CH0, _VLV_PCS01_DW9_CH1)
1325 #define VLV_PCS23_DW9(ch) _PORT(ch, _VLV_PCS23_DW9_CH0, _VLV_PCS23_DW9_CH1)
1327 #define _CHV_PCS_DW10_CH0 0x8228
1328 #define _CHV_PCS_DW10_CH1 0x8428
1329 #define DPIO_PCS_SWING_CALC_TX0_TX2 (1 << 30)
1330 #define DPIO_PCS_SWING_CALC_TX1_TX3 (1 << 31)
1331 #define DPIO_PCS_TX2DEEMP_MASK (0xf << 24)
1332 #define DPIO_PCS_TX2DEEMP_9P5 (0 << 24)
1333 #define DPIO_PCS_TX2DEEMP_6P0 (2 << 24)
1334 #define DPIO_PCS_TX1DEEMP_MASK (0xf << 16)
1335 #define DPIO_PCS_TX1DEEMP_9P5 (0 << 16)
1336 #define DPIO_PCS_TX1DEEMP_6P0 (2 << 16)
1337 #define CHV_PCS_DW10(ch) _PORT(ch, _CHV_PCS_DW10_CH0, _CHV_PCS_DW10_CH1)
1339 #define _VLV_PCS01_DW10_CH0 0x0228
1340 #define _VLV_PCS23_DW10_CH0 0x0428
1341 #define _VLV_PCS01_DW10_CH1 0x2628
1342 #define _VLV_PCS23_DW10_CH1 0x2828
1343 #define VLV_PCS01_DW10(port) _PORT(port, _VLV_PCS01_DW10_CH0, _VLV_PCS01_DW10_CH1)
1344 #define VLV_PCS23_DW10(port) _PORT(port, _VLV_PCS23_DW10_CH0, _VLV_PCS23_DW10_CH1)
1346 #define _VLV_PCS_DW11_CH0 0x822c
1347 #define _VLV_PCS_DW11_CH1 0x842c
1348 #define DPIO_TX2_STAGGER_MASK(x) ((x) << 24)
1349 #define DPIO_LANEDESKEW_STRAP_OVRD (1 << 3)
1350 #define DPIO_LEFT_TXFIFO_RST_MASTER (1 << 1)
1351 #define DPIO_RIGHT_TXFIFO_RST_MASTER (1 << 0)
1352 #define VLV_PCS_DW11(ch) _PORT(ch, _VLV_PCS_DW11_CH0, _VLV_PCS_DW11_CH1)
1354 #define _VLV_PCS01_DW11_CH0 0x022c
1355 #define _VLV_PCS23_DW11_CH0 0x042c
1356 #define _VLV_PCS01_DW11_CH1 0x262c
1357 #define _VLV_PCS23_DW11_CH1 0x282c
1358 #define VLV_PCS01_DW11(ch) _PORT(ch, _VLV_PCS01_DW11_CH0, _VLV_PCS01_DW11_CH1)
1359 #define VLV_PCS23_DW11(ch) _PORT(ch, _VLV_PCS23_DW11_CH0, _VLV_PCS23_DW11_CH1)
1361 #define _VLV_PCS01_DW12_CH0 0x0230
1362 #define _VLV_PCS23_DW12_CH0 0x0430
1363 #define _VLV_PCS01_DW12_CH1 0x2630
1364 #define _VLV_PCS23_DW12_CH1 0x2830
1365 #define VLV_PCS01_DW12(ch) _PORT(ch, _VLV_PCS01_DW12_CH0, _VLV_PCS01_DW12_CH1)
1366 #define VLV_PCS23_DW12(ch) _PORT(ch, _VLV_PCS23_DW12_CH0, _VLV_PCS23_DW12_CH1)
1368 #define _VLV_PCS_DW12_CH0 0x8230
1369 #define _VLV_PCS_DW12_CH1 0x8430
1370 #define DPIO_TX2_STAGGER_MULT(x) ((x) << 20)
1371 #define DPIO_TX1_STAGGER_MULT(x) ((x) << 16)
1372 #define DPIO_TX1_STAGGER_MASK(x) ((x) << 8)
1373 #define DPIO_LANESTAGGER_STRAP_OVRD (1 << 6)
1374 #define DPIO_LANESTAGGER_STRAP(x) ((x) << 0)
1375 #define VLV_PCS_DW12(ch) _PORT(ch, _VLV_PCS_DW12_CH0, _VLV_PCS_DW12_CH1)
1377 #define _VLV_PCS_DW14_CH0 0x8238
1378 #define _VLV_PCS_DW14_CH1 0x8438
1379 #define VLV_PCS_DW14(ch) _PORT(ch, _VLV_PCS_DW14_CH0, _VLV_PCS_DW14_CH1)
1381 #define _VLV_PCS_DW23_CH0 0x825c
1382 #define _VLV_PCS_DW23_CH1 0x845c
1383 #define VLV_PCS_DW23(ch) _PORT(ch, _VLV_PCS_DW23_CH0, _VLV_PCS_DW23_CH1)
1385 #define _VLV_TX_DW2_CH0 0x8288
1386 #define _VLV_TX_DW2_CH1 0x8488
1387 #define DPIO_SWING_MARGIN000_SHIFT 16
1388 #define DPIO_SWING_MARGIN000_MASK (0xff << DPIO_SWING_MARGIN000_SHIFT)
1389 #define DPIO_UNIQ_TRANS_SCALE_SHIFT 8
1390 #define VLV_TX_DW2(ch) _PORT(ch, _VLV_TX_DW2_CH0, _VLV_TX_DW2_CH1)
1392 #define _VLV_TX_DW3_CH0 0x828c
1393 #define _VLV_TX_DW3_CH1 0x848c
1394 /* The following bit for CHV phy */
1395 #define DPIO_TX_UNIQ_TRANS_SCALE_EN (1 << 27)
1396 #define DPIO_SWING_MARGIN101_SHIFT 16
1397 #define DPIO_SWING_MARGIN101_MASK (0xff << DPIO_SWING_MARGIN101_SHIFT)
1398 #define VLV_TX_DW3(ch) _PORT(ch, _VLV_TX_DW3_CH0, _VLV_TX_DW3_CH1)
1400 #define _VLV_TX_DW4_CH0 0x8290
1401 #define _VLV_TX_DW4_CH1 0x8490
1402 #define DPIO_SWING_DEEMPH9P5_SHIFT 24
1403 #define DPIO_SWING_DEEMPH9P5_MASK (0xff << DPIO_SWING_DEEMPH9P5_SHIFT)
1404 #define DPIO_SWING_DEEMPH6P0_SHIFT 16
1405 #define DPIO_SWING_DEEMPH6P0_MASK (0xff << DPIO_SWING_DEEMPH6P0_SHIFT)
1406 #define VLV_TX_DW4(ch) _PORT(ch, _VLV_TX_DW4_CH0, _VLV_TX_DW4_CH1)
1408 #define _VLV_TX3_DW4_CH0 0x690
1409 #define _VLV_TX3_DW4_CH1 0x2a90
1410 #define VLV_TX3_DW4(ch) _PORT(ch, _VLV_TX3_DW4_CH0, _VLV_TX3_DW4_CH1)
1412 #define _VLV_TX_DW5_CH0 0x8294
1413 #define _VLV_TX_DW5_CH1 0x8494
1414 #define DPIO_TX_OCALINIT_EN (1 << 31)
1415 #define VLV_TX_DW5(ch) _PORT(ch, _VLV_TX_DW5_CH0, _VLV_TX_DW5_CH1)
1417 #define _VLV_TX_DW11_CH0 0x82ac
1418 #define _VLV_TX_DW11_CH1 0x84ac
1419 #define VLV_TX_DW11(ch) _PORT(ch, _VLV_TX_DW11_CH0, _VLV_TX_DW11_CH1)
1421 #define _VLV_TX_DW14_CH0 0x82b8
1422 #define _VLV_TX_DW14_CH1 0x84b8
1423 #define VLV_TX_DW14(ch) _PORT(ch, _VLV_TX_DW14_CH0, _VLV_TX_DW14_CH1)
1425 /* CHV dpPhy registers */
1426 #define _CHV_PLL_DW0_CH0 0x8000
1427 #define _CHV_PLL_DW0_CH1 0x8180
1428 #define CHV_PLL_DW0(ch) _PIPE(ch, _CHV_PLL_DW0_CH0, _CHV_PLL_DW0_CH1)
1430 #define _CHV_PLL_DW1_CH0 0x8004
1431 #define _CHV_PLL_DW1_CH1 0x8184
1432 #define DPIO_CHV_N_DIV_SHIFT 8
1433 #define DPIO_CHV_M1_DIV_BY_2 (0 << 0)
1434 #define CHV_PLL_DW1(ch) _PIPE(ch, _CHV_PLL_DW1_CH0, _CHV_PLL_DW1_CH1)
1436 #define _CHV_PLL_DW2_CH0 0x8008
1437 #define _CHV_PLL_DW2_CH1 0x8188
1438 #define CHV_PLL_DW2(ch) _PIPE(ch, _CHV_PLL_DW2_CH0, _CHV_PLL_DW2_CH1)
1440 #define _CHV_PLL_DW3_CH0 0x800c
1441 #define _CHV_PLL_DW3_CH1 0x818c
1442 #define DPIO_CHV_FRAC_DIV_EN (1 << 16)
1443 #define DPIO_CHV_FIRST_MOD (0 << 8)
1444 #define DPIO_CHV_SECOND_MOD (1 << 8)
1445 #define DPIO_CHV_FEEDFWD_GAIN_SHIFT 0
1446 #define DPIO_CHV_FEEDFWD_GAIN_MASK (0xF << 0)
1447 #define CHV_PLL_DW3(ch) _PIPE(ch, _CHV_PLL_DW3_CH0, _CHV_PLL_DW3_CH1)
1449 #define _CHV_PLL_DW6_CH0 0x8018
1450 #define _CHV_PLL_DW6_CH1 0x8198
1451 #define DPIO_CHV_GAIN_CTRL_SHIFT 16
1452 #define DPIO_CHV_INT_COEFF_SHIFT 8
1453 #define DPIO_CHV_PROP_COEFF_SHIFT 0
1454 #define CHV_PLL_DW6(ch) _PIPE(ch, _CHV_PLL_DW6_CH0, _CHV_PLL_DW6_CH1)
1456 #define _CHV_PLL_DW8_CH0 0x8020
1457 #define _CHV_PLL_DW8_CH1 0x81A0
1458 #define DPIO_CHV_TDC_TARGET_CNT_SHIFT 0
1459 #define DPIO_CHV_TDC_TARGET_CNT_MASK (0x3FF << 0)
1460 #define CHV_PLL_DW8(ch) _PIPE(ch, _CHV_PLL_DW8_CH0, _CHV_PLL_DW8_CH1)
1462 #define _CHV_PLL_DW9_CH0 0x8024
1463 #define _CHV_PLL_DW9_CH1 0x81A4
1464 #define DPIO_CHV_INT_LOCK_THRESHOLD_SHIFT 1 /* 3 bits */
1465 #define DPIO_CHV_INT_LOCK_THRESHOLD_MASK (7 << 1)
1466 #define DPIO_CHV_INT_LOCK_THRESHOLD_SEL_COARSE 1 /* 1: coarse & 0 : fine */
1467 #define CHV_PLL_DW9(ch) _PIPE(ch, _CHV_PLL_DW9_CH0, _CHV_PLL_DW9_CH1)
1469 #define _CHV_CMN_DW0_CH0 0x8100
1470 #define DPIO_ALLDL_POWERDOWN_SHIFT_CH0 19
1471 #define DPIO_ANYDL_POWERDOWN_SHIFT_CH0 18
1472 #define DPIO_ALLDL_POWERDOWN (1 << 1)
1473 #define DPIO_ANYDL_POWERDOWN (1 << 0)
1475 #define _CHV_CMN_DW5_CH0 0x8114
1476 #define CHV_BUFRIGHTENA1_DISABLE (0 << 20)
1477 #define CHV_BUFRIGHTENA1_NORMAL (1 << 20)
1478 #define CHV_BUFRIGHTENA1_FORCE (3 << 20)
1479 #define CHV_BUFRIGHTENA1_MASK (3 << 20)
1480 #define CHV_BUFLEFTENA1_DISABLE (0 << 22)
1481 #define CHV_BUFLEFTENA1_NORMAL (1 << 22)
1482 #define CHV_BUFLEFTENA1_FORCE (3 << 22)
1483 #define CHV_BUFLEFTENA1_MASK (3 << 22)
1485 #define _CHV_CMN_DW13_CH0 0x8134
1486 #define _CHV_CMN_DW0_CH1 0x8080
1487 #define DPIO_CHV_S1_DIV_SHIFT 21
1488 #define DPIO_CHV_P1_DIV_SHIFT 13 /* 3 bits */
1489 #define DPIO_CHV_P2_DIV_SHIFT 8 /* 5 bits */
1490 #define DPIO_CHV_K_DIV_SHIFT 4
1491 #define DPIO_PLL_FREQLOCK (1 << 1)
1492 #define DPIO_PLL_LOCK (1 << 0)
1493 #define CHV_CMN_DW13(ch) _PIPE(ch, _CHV_CMN_DW13_CH0, _CHV_CMN_DW0_CH1)
1495 #define _CHV_CMN_DW14_CH0 0x8138
1496 #define _CHV_CMN_DW1_CH1 0x8084
1497 #define DPIO_AFC_RECAL (1 << 14)
1498 #define DPIO_DCLKP_EN (1 << 13)
1499 #define CHV_BUFLEFTENA2_DISABLE (0 << 17) /* CL2 DW1 only */
1500 #define CHV_BUFLEFTENA2_NORMAL (1 << 17) /* CL2 DW1 only */
1501 #define CHV_BUFLEFTENA2_FORCE (3 << 17) /* CL2 DW1 only */
1502 #define CHV_BUFLEFTENA2_MASK (3 << 17) /* CL2 DW1 only */
1503 #define CHV_BUFRIGHTENA2_DISABLE (0 << 19) /* CL2 DW1 only */
1504 #define CHV_BUFRIGHTENA2_NORMAL (1 << 19) /* CL2 DW1 only */
1505 #define CHV_BUFRIGHTENA2_FORCE (3 << 19) /* CL2 DW1 only */
1506 #define CHV_BUFRIGHTENA2_MASK (3 << 19) /* CL2 DW1 only */
1507 #define CHV_CMN_DW14(ch) _PIPE(ch, _CHV_CMN_DW14_CH0, _CHV_CMN_DW1_CH1)
1509 #define _CHV_CMN_DW19_CH0 0x814c
1510 #define _CHV_CMN_DW6_CH1 0x8098
1511 #define DPIO_ALLDL_POWERDOWN_SHIFT_CH1 30 /* CL2 DW6 only */
1512 #define DPIO_ANYDL_POWERDOWN_SHIFT_CH1 29 /* CL2 DW6 only */
1513 #define DPIO_DYNPWRDOWNEN_CH1 (1 << 28) /* CL2 DW6 only */
1514 #define CHV_CMN_USEDCLKCHANNEL (1 << 13)
1516 #define CHV_CMN_DW19(ch) _PIPE(ch, _CHV_CMN_DW19_CH0, _CHV_CMN_DW6_CH1)
1518 #define CHV_CMN_DW28 0x8170
1519 #define DPIO_CL1POWERDOWNEN (1 << 23)
1520 #define DPIO_DYNPWRDOWNEN_CH0 (1 << 22)
1521 #define DPIO_SUS_CLK_CONFIG_ON (0 << 0)
1522 #define DPIO_SUS_CLK_CONFIG_CLKREQ (1 << 0)
1523 #define DPIO_SUS_CLK_CONFIG_GATE (2 << 0)
1524 #define DPIO_SUS_CLK_CONFIG_GATE_CLKREQ (3 << 0)
1526 #define CHV_CMN_DW30 0x8178
1527 #define DPIO_CL2_LDOFUSE_PWRENB (1 << 6)
1528 #define DPIO_LRC_BYPASS (1 << 3)
1530 #define _TXLANE(ch, lane, offset) ((ch ? 0x2400 : 0) + \
1531 (lane) * 0x200 + (offset))
1533 #define CHV_TX_DW0(ch, lane) _TXLANE(ch, lane, 0x80)
1534 #define CHV_TX_DW1(ch, lane) _TXLANE(ch, lane, 0x84)
1535 #define CHV_TX_DW2(ch, lane) _TXLANE(ch, lane, 0x88)
1536 #define CHV_TX_DW3(ch, lane) _TXLANE(ch, lane, 0x8c)
1537 #define CHV_TX_DW4(ch, lane) _TXLANE(ch, lane, 0x90)
1538 #define CHV_TX_DW5(ch, lane) _TXLANE(ch, lane, 0x94)
1539 #define CHV_TX_DW6(ch, lane) _TXLANE(ch, lane, 0x98)
1540 #define CHV_TX_DW7(ch, lane) _TXLANE(ch, lane, 0x9c)
1541 #define CHV_TX_DW8(ch, lane) _TXLANE(ch, lane, 0xa0)
1542 #define CHV_TX_DW9(ch, lane) _TXLANE(ch, lane, 0xa4)
1543 #define CHV_TX_DW10(ch, lane) _TXLANE(ch, lane, 0xa8)
1544 #define CHV_TX_DW11(ch, lane) _TXLANE(ch, lane, 0xac)
1545 #define DPIO_FRC_LATENCY_SHFIT 8
1546 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
1547 #define DPIO_UPAR_SHIFT 30
1549 /* BXT PHY registers */
1550 #define _BXT_PHY0_BASE 0x6C000
1551 #define _BXT_PHY1_BASE 0x162000
1552 #define _BXT_PHY2_BASE 0x163000
1553 #define BXT_PHY_BASE(phy) _PHY3((phy), _BXT_PHY0_BASE, \
1557 #define _BXT_PHY(phy, reg) \
1558 _MMIO(BXT_PHY_BASE(phy) - _BXT_PHY0_BASE + (reg))
1560 #define _BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \
1561 (BXT_PHY_BASE(phy) + _PIPE((ch), (reg_ch0) - _BXT_PHY0_BASE, \
1562 (reg_ch1) - _BXT_PHY0_BASE))
1563 #define _MMIO_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \
1564 _MMIO(_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1))
1566 #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)
1567 #define MIPIO_RST_CTRL (1 << 2)
1569 #define _BXT_PHY_CTL_DDI_A 0x64C00
1570 #define _BXT_PHY_CTL_DDI_B 0x64C10
1571 #define _BXT_PHY_CTL_DDI_C 0x64C20
1572 #define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10)
1573 #define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9)
1574 #define BXT_PHY_LANE_ENABLED (1 << 8)
1575 #define BXT_PHY_CTL(port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
1578 #define _PHY_CTL_FAMILY_EDP 0x64C80
1579 #define _PHY_CTL_FAMILY_DDI 0x64C90
1580 #define _PHY_CTL_FAMILY_DDI_C 0x64CA0
1581 #define COMMON_RESET_DIS (1 << 31)
1582 #define BXT_PHY_CTL_FAMILY(phy) _MMIO_PHY3((phy), _PHY_CTL_FAMILY_DDI, \
1583 _PHY_CTL_FAMILY_EDP, \
1584 _PHY_CTL_FAMILY_DDI_C)
1586 /* BXT PHY PLL registers */
1587 #define _PORT_PLL_A 0x46074
1588 #define _PORT_PLL_B 0x46078
1589 #define _PORT_PLL_C 0x4607c
1590 #define PORT_PLL_ENABLE (1 << 31)
1591 #define PORT_PLL_LOCK (1 << 30)
1592 #define PORT_PLL_REF_SEL (1 << 27)
1593 #define PORT_PLL_POWER_ENABLE (1 << 26)
1594 #define PORT_PLL_POWER_STATE (1 << 25)
1595 #define BXT_PORT_PLL_ENABLE(port) _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
1597 #define _PORT_PLL_EBB_0_A 0x162034
1598 #define _PORT_PLL_EBB_0_B 0x6C034
1599 #define _PORT_PLL_EBB_0_C 0x6C340
1600 #define PORT_PLL_P1_SHIFT 13
1601 #define PORT_PLL_P1_MASK (0x07 << PORT_PLL_P1_SHIFT)
1602 #define PORT_PLL_P1(x) ((x) << PORT_PLL_P1_SHIFT)
1603 #define PORT_PLL_P2_SHIFT 8
1604 #define PORT_PLL_P2_MASK (0x1f << PORT_PLL_P2_SHIFT)
1605 #define PORT_PLL_P2(x) ((x) << PORT_PLL_P2_SHIFT)
1606 #define BXT_PORT_PLL_EBB_0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
1607 _PORT_PLL_EBB_0_B, \
1610 #define _PORT_PLL_EBB_4_A 0x162038
1611 #define _PORT_PLL_EBB_4_B 0x6C038
1612 #define _PORT_PLL_EBB_4_C 0x6C344
1613 #define PORT_PLL_10BIT_CLK_ENABLE (1 << 13)
1614 #define PORT_PLL_RECALIBRATE (1 << 14)
1615 #define BXT_PORT_PLL_EBB_4(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
1616 _PORT_PLL_EBB_4_B, \
1619 #define _PORT_PLL_0_A 0x162100
1620 #define _PORT_PLL_0_B 0x6C100
1621 #define _PORT_PLL_0_C 0x6C380
1623 #define PORT_PLL_M2_MASK 0xFF
1625 #define PORT_PLL_N_SHIFT 8
1626 #define PORT_PLL_N_MASK (0x0F << PORT_PLL_N_SHIFT)
1627 #define PORT_PLL_N(x) ((x) << PORT_PLL_N_SHIFT)
1629 #define PORT_PLL_M2_FRAC_MASK 0x3FFFFF
1631 #define PORT_PLL_M2_FRAC_ENABLE (1 << 16)
1633 #define PORT_PLL_PROP_COEFF_MASK 0xF
1634 #define PORT_PLL_INT_COEFF_MASK (0x1F << 8)
1635 #define PORT_PLL_INT_COEFF(x) ((x) << 8)
1636 #define PORT_PLL_GAIN_CTL_MASK (0x07 << 16)
1637 #define PORT_PLL_GAIN_CTL(x) ((x) << 16)
1639 #define PORT_PLL_TARGET_CNT_MASK 0x3FF
1641 #define PORT_PLL_LOCK_THRESHOLD_SHIFT 1
1642 #define PORT_PLL_LOCK_THRESHOLD_MASK (0x7 << PORT_PLL_LOCK_THRESHOLD_SHIFT)
1644 #define PORT_PLL_DCO_AMP_OVR_EN_H (1 << 27)
1645 #define PORT_PLL_DCO_AMP_DEFAULT 15
1646 #define PORT_PLL_DCO_AMP_MASK 0x3c00
1647 #define PORT_PLL_DCO_AMP(x) ((x) << 10)
1648 #define _PORT_PLL_BASE(phy, ch) _BXT_PHY_CH(phy, ch, \
1651 #define BXT_PORT_PLL(phy, ch, idx) _MMIO(_PORT_PLL_BASE(phy, ch) + \
1654 /* BXT PHY common lane registers */
1655 #define _PORT_CL1CM_DW0_A 0x162000
1656 #define _PORT_CL1CM_DW0_BC 0x6C000
1657 #define PHY_POWER_GOOD (1 << 16)
1658 #define PHY_RESERVED (1 << 7)
1659 #define BXT_PORT_CL1CM_DW0(phy) _BXT_PHY((phy), _PORT_CL1CM_DW0_BC)
1661 #define CNL_PORT_CL1CM_DW5 _MMIO(0x162014)
1662 #define CL_POWER_DOWN_ENABLE (1 << 4)
1663 #define SUS_CLOCK_CONFIG (3 << 0)
1665 #define _ICL_PORT_CL_DW5_A 0x162014
1666 #define _ICL_PORT_CL_DW5_B 0x6C014
1667 #define ICL_PORT_CL_DW5(port) _MMIO_PORT(port, _ICL_PORT_CL_DW5_A, \
1670 #define _PORT_CL1CM_DW9_A 0x162024
1671 #define _PORT_CL1CM_DW9_BC 0x6C024
1672 #define IREF0RC_OFFSET_SHIFT 8
1673 #define IREF0RC_OFFSET_MASK (0xFF << IREF0RC_OFFSET_SHIFT)
1674 #define BXT_PORT_CL1CM_DW9(phy) _BXT_PHY((phy), _PORT_CL1CM_DW9_BC)
1676 #define _PORT_CL1CM_DW10_A 0x162028
1677 #define _PORT_CL1CM_DW10_BC 0x6C028
1678 #define IREF1RC_OFFSET_SHIFT 8
1679 #define IREF1RC_OFFSET_MASK (0xFF << IREF1RC_OFFSET_SHIFT)
1680 #define BXT_PORT_CL1CM_DW10(phy) _BXT_PHY((phy), _PORT_CL1CM_DW10_BC)
1682 #define _PORT_CL1CM_DW28_A 0x162070
1683 #define _PORT_CL1CM_DW28_BC 0x6C070
1684 #define OCL1_POWER_DOWN_EN (1 << 23)
1685 #define DW28_OLDO_DYN_PWR_DOWN_EN (1 << 22)
1686 #define SUS_CLK_CONFIG 0x3
1687 #define BXT_PORT_CL1CM_DW28(phy) _BXT_PHY((phy), _PORT_CL1CM_DW28_BC)
1689 #define _PORT_CL1CM_DW30_A 0x162078
1690 #define _PORT_CL1CM_DW30_BC 0x6C078
1691 #define OCL2_LDOFUSE_PWR_DIS (1 << 6)
1692 #define BXT_PORT_CL1CM_DW30(phy) _BXT_PHY((phy), _PORT_CL1CM_DW30_BC)
1694 #define _CNL_PORT_PCS_DW1_GRP_AE 0x162304
1695 #define _CNL_PORT_PCS_DW1_GRP_B 0x162384
1696 #define _CNL_PORT_PCS_DW1_GRP_C 0x162B04
1697 #define _CNL_PORT_PCS_DW1_GRP_D 0x162B84
1698 #define _CNL_PORT_PCS_DW1_GRP_F 0x162A04
1699 #define _CNL_PORT_PCS_DW1_LN0_AE 0x162404
1700 #define _CNL_PORT_PCS_DW1_LN0_B 0x162604
1701 #define _CNL_PORT_PCS_DW1_LN0_C 0x162C04
1702 #define _CNL_PORT_PCS_DW1_LN0_D 0x162E04
1703 #define _CNL_PORT_PCS_DW1_LN0_F 0x162804
1704 #define CNL_PORT_PCS_DW1_GRP(port) _MMIO(_PICK(port, \
1705 _CNL_PORT_PCS_DW1_GRP_AE, \
1706 _CNL_PORT_PCS_DW1_GRP_B, \
1707 _CNL_PORT_PCS_DW1_GRP_C, \
1708 _CNL_PORT_PCS_DW1_GRP_D, \
1709 _CNL_PORT_PCS_DW1_GRP_AE, \
1710 _CNL_PORT_PCS_DW1_GRP_F))
1712 #define CNL_PORT_PCS_DW1_LN0(port) _MMIO(_PICK(port, \
1713 _CNL_PORT_PCS_DW1_LN0_AE, \
1714 _CNL_PORT_PCS_DW1_LN0_B, \
1715 _CNL_PORT_PCS_DW1_LN0_C, \
1716 _CNL_PORT_PCS_DW1_LN0_D, \
1717 _CNL_PORT_PCS_DW1_LN0_AE, \
1718 _CNL_PORT_PCS_DW1_LN0_F))
1719 #define _ICL_PORT_PCS_DW1_GRP_A 0x162604
1720 #define _ICL_PORT_PCS_DW1_GRP_B 0x6C604
1721 #define _ICL_PORT_PCS_DW1_LN0_A 0x162804
1722 #define _ICL_PORT_PCS_DW1_LN0_B 0x6C804
1723 #define ICL_PORT_PCS_DW1_GRP(port) _MMIO_PORT(port,\
1724 _ICL_PORT_PCS_DW1_GRP_A, \
1725 _ICL_PORT_PCS_DW1_GRP_B)
1726 #define ICL_PORT_PCS_DW1_LN0(port) _MMIO_PORT(port, \
1727 _ICL_PORT_PCS_DW1_LN0_A, \
1728 _ICL_PORT_PCS_DW1_LN0_B)
1729 #define COMMON_KEEPER_EN (1 << 26)
1731 /* CNL Port TX registers */
1732 #define _CNL_PORT_TX_AE_GRP_OFFSET 0x162340
1733 #define _CNL_PORT_TX_B_GRP_OFFSET 0x1623C0
1734 #define _CNL_PORT_TX_C_GRP_OFFSET 0x162B40
1735 #define _CNL_PORT_TX_D_GRP_OFFSET 0x162BC0
1736 #define _CNL_PORT_TX_F_GRP_OFFSET 0x162A40
1737 #define _CNL_PORT_TX_AE_LN0_OFFSET 0x162440
1738 #define _CNL_PORT_TX_B_LN0_OFFSET 0x162640
1739 #define _CNL_PORT_TX_C_LN0_OFFSET 0x162C40
1740 #define _CNL_PORT_TX_D_LN0_OFFSET 0x162E40
1741 #define _CNL_PORT_TX_F_LN0_OFFSET 0x162840
1742 #define _CNL_PORT_TX_DW_GRP(port, dw) (_PICK((port), \
1743 _CNL_PORT_TX_AE_GRP_OFFSET, \
1744 _CNL_PORT_TX_B_GRP_OFFSET, \
1745 _CNL_PORT_TX_B_GRP_OFFSET, \
1746 _CNL_PORT_TX_D_GRP_OFFSET, \
1747 _CNL_PORT_TX_AE_GRP_OFFSET, \
1748 _CNL_PORT_TX_F_GRP_OFFSET) + \
1750 #define _CNL_PORT_TX_DW_LN0(port, dw) (_PICK((port), \
1751 _CNL_PORT_TX_AE_LN0_OFFSET, \
1752 _CNL_PORT_TX_B_LN0_OFFSET, \
1753 _CNL_PORT_TX_B_LN0_OFFSET, \
1754 _CNL_PORT_TX_D_LN0_OFFSET, \
1755 _CNL_PORT_TX_AE_LN0_OFFSET, \
1756 _CNL_PORT_TX_F_LN0_OFFSET) + \
1759 #define CNL_PORT_TX_DW2_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 2))
1760 #define CNL_PORT_TX_DW2_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 2))
1761 #define _ICL_PORT_TX_DW2_GRP_A 0x162688
1762 #define _ICL_PORT_TX_DW2_GRP_B 0x6C688
1763 #define _ICL_PORT_TX_DW2_LN0_A 0x162888
1764 #define _ICL_PORT_TX_DW2_LN0_B 0x6C888
1765 #define ICL_PORT_TX_DW2_GRP(port) _MMIO_PORT(port, \
1766 _ICL_PORT_TX_DW2_GRP_A, \
1767 _ICL_PORT_TX_DW2_GRP_B)
1768 #define ICL_PORT_TX_DW2_LN0(port) _MMIO_PORT(port, \
1769 _ICL_PORT_TX_DW2_LN0_A, \
1770 _ICL_PORT_TX_DW2_LN0_B)
1771 #define SWING_SEL_UPPER(x) (((x) >> 3) << 15)
1772 #define SWING_SEL_UPPER_MASK (1 << 15)
1773 #define SWING_SEL_LOWER(x) (((x) & 0x7) << 11)
1774 #define SWING_SEL_LOWER_MASK (0x7 << 11)
1775 #define RCOMP_SCALAR(x) ((x) << 0)
1776 #define RCOMP_SCALAR_MASK (0xFF << 0)
1778 #define _CNL_PORT_TX_DW4_LN0_AE 0x162450
1779 #define _CNL_PORT_TX_DW4_LN1_AE 0x1624D0
1780 #define CNL_PORT_TX_DW4_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 4))
1781 #define CNL_PORT_TX_DW4_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4))
1782 #define CNL_PORT_TX_DW4_LN(port, ln) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4) + \
1783 ((ln) * (_CNL_PORT_TX_DW4_LN1_AE - \
1784 _CNL_PORT_TX_DW4_LN0_AE)))
1785 #define _ICL_PORT_TX_DW4_GRP_A 0x162690
1786 #define _ICL_PORT_TX_DW4_GRP_B 0x6C690
1787 #define _ICL_PORT_TX_DW4_LN0_A 0x162890
1788 #define _ICL_PORT_TX_DW4_LN1_A 0x162990
1789 #define _ICL_PORT_TX_DW4_LN0_B 0x6C890
1790 #define ICL_PORT_TX_DW4_GRP(port) _MMIO_PORT(port, \
1791 _ICL_PORT_TX_DW4_GRP_A, \
1792 _ICL_PORT_TX_DW4_GRP_B)
1793 #define ICL_PORT_TX_DW4_LN(port, ln) _MMIO(_PORT(port, \
1794 _ICL_PORT_TX_DW4_LN0_A, \
1795 _ICL_PORT_TX_DW4_LN0_B) + \
1796 ((ln) * (_ICL_PORT_TX_DW4_LN1_A - \
1797 _ICL_PORT_TX_DW4_LN0_A)))
1798 #define LOADGEN_SELECT (1 << 31)
1799 #define POST_CURSOR_1(x) ((x) << 12)
1800 #define POST_CURSOR_1_MASK (0x3F << 12)
1801 #define POST_CURSOR_2(x) ((x) << 6)
1802 #define POST_CURSOR_2_MASK (0x3F << 6)
1803 #define CURSOR_COEFF(x) ((x) << 0)
1804 #define CURSOR_COEFF_MASK (0x3F << 0)
1806 #define CNL_PORT_TX_DW5_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 5))
1807 #define CNL_PORT_TX_DW5_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 5))
1808 #define _ICL_PORT_TX_DW5_GRP_A 0x162694
1809 #define _ICL_PORT_TX_DW5_GRP_B 0x6C694
1810 #define _ICL_PORT_TX_DW5_LN0_A 0x162894
1811 #define _ICL_PORT_TX_DW5_LN0_B 0x6C894
1812 #define ICL_PORT_TX_DW5_GRP(port) _MMIO_PORT(port, \
1813 _ICL_PORT_TX_DW5_GRP_A, \
1814 _ICL_PORT_TX_DW5_GRP_B)
1815 #define ICL_PORT_TX_DW5_LN0(port) _MMIO_PORT(port, \
1816 _ICL_PORT_TX_DW5_LN0_A, \
1817 _ICL_PORT_TX_DW5_LN0_B)
1818 #define TX_TRAINING_EN (1 << 31)
1819 #define TAP2_DISABLE (1 << 30)
1820 #define TAP3_DISABLE (1 << 29)
1821 #define SCALING_MODE_SEL(x) ((x) << 18)
1822 #define SCALING_MODE_SEL_MASK (0x7 << 18)
1823 #define RTERM_SELECT(x) ((x) << 3)
1824 #define RTERM_SELECT_MASK (0x7 << 3)
1826 #define CNL_PORT_TX_DW7_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 7))
1827 #define CNL_PORT_TX_DW7_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 7))
1828 #define N_SCALAR(x) ((x) << 24)
1829 #define N_SCALAR_MASK (0x7F << 24)
1831 #define _ICL_MG_PHY_PORT_LN(port, ln, ln0p1, ln0p2, ln1p1) \
1832 _MMIO(_PORT((port) - PORT_C, ln0p1, ln0p2) + (ln) * ((ln1p1) - (ln0p1)))
1834 #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT1 0x16812C
1835 #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT1 0x16852C
1836 #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT2 0x16912C
1837 #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT2 0x16952C
1838 #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT3 0x16A12C
1839 #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT3 0x16A52C
1840 #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT4 0x16B12C
1841 #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT4 0x16B52C
1842 #define ICL_PORT_MG_TX1_LINK_PARAMS(port, ln) \
1843 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT1, \
1844 _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT2, \
1845 _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT1)
1847 #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT1 0x1680AC
1848 #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT1 0x1684AC
1849 #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT2 0x1690AC
1850 #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT2 0x1694AC
1851 #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT3 0x16A0AC
1852 #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT3 0x16A4AC
1853 #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT4 0x16B0AC
1854 #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT4 0x16B4AC
1855 #define ICL_PORT_MG_TX2_LINK_PARAMS(port, ln) \
1856 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT1, \
1857 _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT2, \
1858 _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT1)
1859 #define CRI_USE_FS32 (1 << 5)
1861 #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT1 0x16814C
1862 #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT1 0x16854C
1863 #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT2 0x16914C
1864 #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT2 0x16954C
1865 #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT3 0x16A14C
1866 #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT3 0x16A54C
1867 #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT4 0x16B14C
1868 #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT4 0x16B54C
1869 #define ICL_PORT_MG_TX1_PISO_READLOAD(port, ln) \
1870 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT1, \
1871 _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT2, \
1872 _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT1)
1874 #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT1 0x1680CC
1875 #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT1 0x1684CC
1876 #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT2 0x1690CC
1877 #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT2 0x1694CC
1878 #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT3 0x16A0CC
1879 #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT3 0x16A4CC
1880 #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT4 0x16B0CC
1881 #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT4 0x16B4CC
1882 #define ICL_PORT_MG_TX2_PISO_READLOAD(port, ln) \
1883 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT1, \
1884 _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT2, \
1885 _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT1)
1886 #define CRI_CALCINIT (1 << 1)
1888 #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT1 0x168148
1889 #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT1 0x168548
1890 #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT2 0x169148
1891 #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT2 0x169548
1892 #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT3 0x16A148
1893 #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT3 0x16A548
1894 #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT4 0x16B148
1895 #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT4 0x16B548
1896 #define ICL_PORT_MG_TX1_SWINGCTRL(port, ln) \
1897 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT1, \
1898 _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT2, \
1899 _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT1)
1901 #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT1 0x1680C8
1902 #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT1 0x1684C8
1903 #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT2 0x1690C8
1904 #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT2 0x1694C8
1905 #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT3 0x16A0C8
1906 #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT3 0x16A4C8
1907 #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT4 0x16B0C8
1908 #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT4 0x16B4C8
1909 #define ICL_PORT_MG_TX2_SWINGCTRL(port, ln) \
1910 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT1, \
1911 _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT2, \
1912 _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT1)
1913 #define CRI_TXDEEMPH_OVERRIDE_17_12(x) ((x) << 0)
1914 #define CRI_TXDEEMPH_OVERRIDE_17_12_MASK (0x3F << 0)
1916 #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT1 0x168144
1917 #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT1 0x168544
1918 #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT2 0x169144
1919 #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT2 0x169544
1920 #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT3 0x16A144
1921 #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT3 0x16A544
1922 #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT4 0x16B144
1923 #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT4 0x16B544
1924 #define ICL_PORT_MG_TX1_DRVCTRL(port, ln) \
1925 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_DRVCTRL_TX1LN0_PORT1, \
1926 _ICL_MG_TX_DRVCTRL_TX1LN0_PORT2, \
1927 _ICL_MG_TX_DRVCTRL_TX1LN1_PORT1)
1929 #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT1 0x1680C4
1930 #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT1 0x1684C4
1931 #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT2 0x1690C4
1932 #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT2 0x1694C4
1933 #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT3 0x16A0C4
1934 #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT3 0x16A4C4
1935 #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT4 0x16B0C4
1936 #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT4 0x16B4C4
1937 #define ICL_PORT_MG_TX2_DRVCTRL(port, ln) \
1938 _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_DRVCTRL_TX2LN0_PORT1, \
1939 _ICL_MG_TX_DRVCTRL_TX2LN0_PORT2, \
1940 _ICL_MG_TX_DRVCTRL_TX2LN1_PORT1)
1941 #define CRI_TXDEEMPH_OVERRIDE_11_6(x) ((x) << 24)
1942 #define CRI_TXDEEMPH_OVERRIDE_11_6_MASK (0x3F << 24)
1943 #define CRI_TXDEEMPH_OVERRIDE_EN (1 << 22)
1944 #define CRI_TXDEEMPH_OVERRIDE_5_0(x) ((x) << 16)
1945 #define CRI_TXDEEMPH_OVERRIDE_5_0_MASK (0x3F << 16)
1947 /* The spec defines this only for BXT PHY0, but lets assume that this
1948 * would exist for PHY1 too if it had a second channel.
1950 #define _PORT_CL2CM_DW6_A 0x162358
1951 #define _PORT_CL2CM_DW6_BC 0x6C358
1952 #define BXT_PORT_CL2CM_DW6(phy) _BXT_PHY((phy), _PORT_CL2CM_DW6_BC)
1953 #define DW6_OLDO_DYN_PWR_DOWN_EN (1 << 28)
1955 #define CNL_PORT_COMP_DW0 _MMIO(0x162100)
1956 #define COMP_INIT (1 << 31)
1957 #define CNL_PORT_COMP_DW1 _MMIO(0x162104)
1958 #define CNL_PORT_COMP_DW3 _MMIO(0x16210c)
1959 #define PROCESS_INFO_DOT_0 (0 << 26)
1960 #define PROCESS_INFO_DOT_1 (1 << 26)
1961 #define PROCESS_INFO_DOT_4 (2 << 26)
1962 #define PROCESS_INFO_MASK (7 << 26)
1963 #define PROCESS_INFO_SHIFT 26
1964 #define VOLTAGE_INFO_0_85V (0 << 24)
1965 #define VOLTAGE_INFO_0_95V (1 << 24)
1966 #define VOLTAGE_INFO_1_05V (2 << 24)
1967 #define VOLTAGE_INFO_MASK (3 << 24)
1968 #define VOLTAGE_INFO_SHIFT 24
1969 #define CNL_PORT_COMP_DW9 _MMIO(0x162124)
1970 #define CNL_PORT_COMP_DW10 _MMIO(0x162128)
1972 #define _ICL_PORT_COMP_DW0_A 0x162100
1973 #define _ICL_PORT_COMP_DW0_B 0x6C100
1974 #define ICL_PORT_COMP_DW0(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW0_A, \
1975 _ICL_PORT_COMP_DW0_B)
1976 #define _ICL_PORT_COMP_DW1_A 0x162104
1977 #define _ICL_PORT_COMP_DW1_B 0x6C104
1978 #define ICL_PORT_COMP_DW1(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW1_A, \
1979 _ICL_PORT_COMP_DW1_B)
1980 #define _ICL_PORT_COMP_DW3_A 0x16210C
1981 #define _ICL_PORT_COMP_DW3_B 0x6C10C
1982 #define ICL_PORT_COMP_DW3(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW3_A, \
1983 _ICL_PORT_COMP_DW3_B)
1984 #define _ICL_PORT_COMP_DW9_A 0x162124
1985 #define _ICL_PORT_COMP_DW9_B 0x6C124
1986 #define ICL_PORT_COMP_DW9(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW9_A, \
1987 _ICL_PORT_COMP_DW9_B)
1988 #define _ICL_PORT_COMP_DW10_A 0x162128
1989 #define _ICL_PORT_COMP_DW10_B 0x6C128
1990 #define ICL_PORT_COMP_DW10(port) _MMIO_PORT(port, \
1991 _ICL_PORT_COMP_DW10_A, \
1992 _ICL_PORT_COMP_DW10_B)
1994 /* ICL PHY DFLEX registers */
1995 #define PORT_TX_DFLEXDPMLE1 _MMIO(0x1638C0)
1996 #define DFLEXDPMLE1_DPMLETC_MASK(n) (0xf << (4 * (n)))
1997 #define DFLEXDPMLE1_DPMLETC(n, x) ((x) << (4 * (n)))
1999 /* BXT PHY Ref registers */
2000 #define _PORT_REF_DW3_A 0x16218C
2001 #define _PORT_REF_DW3_BC 0x6C18C
2002 #define GRC_DONE (1 << 22)
2003 #define BXT_PORT_REF_DW3(phy) _BXT_PHY((phy), _PORT_REF_DW3_BC)
2005 #define _PORT_REF_DW6_A 0x162198
2006 #define _PORT_REF_DW6_BC 0x6C198
2007 #define GRC_CODE_SHIFT 24
2008 #define GRC_CODE_MASK (0xFF << GRC_CODE_SHIFT)
2009 #define GRC_CODE_FAST_SHIFT 16
2010 #define GRC_CODE_FAST_MASK (0xFF << GRC_CODE_FAST_SHIFT)
2011 #define GRC_CODE_SLOW_SHIFT 8
2012 #define GRC_CODE_SLOW_MASK (0xFF << GRC_CODE_SLOW_SHIFT)
2013 #define GRC_CODE_NOM_MASK 0xFF
2014 #define BXT_PORT_REF_DW6(phy) _BXT_PHY((phy), _PORT_REF_DW6_BC)
2016 #define _PORT_REF_DW8_A 0x1621A0
2017 #define _PORT_REF_DW8_BC 0x6C1A0
2018 #define GRC_DIS (1 << 15)
2019 #define GRC_RDY_OVRD (1 << 1)
2020 #define BXT_PORT_REF_DW8(phy) _BXT_PHY((phy), _PORT_REF_DW8_BC)
2022 /* BXT PHY PCS registers */
2023 #define _PORT_PCS_DW10_LN01_A 0x162428
2024 #define _PORT_PCS_DW10_LN01_B 0x6C428
2025 #define _PORT_PCS_DW10_LN01_C 0x6C828
2026 #define _PORT_PCS_DW10_GRP_A 0x162C28
2027 #define _PORT_PCS_DW10_GRP_B 0x6CC28
2028 #define _PORT_PCS_DW10_GRP_C 0x6CE28
2029 #define BXT_PORT_PCS_DW10_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2030 _PORT_PCS_DW10_LN01_B, \
2031 _PORT_PCS_DW10_LN01_C)
2032 #define BXT_PORT_PCS_DW10_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2033 _PORT_PCS_DW10_GRP_B, \
2034 _PORT_PCS_DW10_GRP_C)
2036 #define TX2_SWING_CALC_INIT (1 << 31)
2037 #define TX1_SWING_CALC_INIT (1 << 30)
2039 #define _PORT_PCS_DW12_LN01_A 0x162430
2040 #define _PORT_PCS_DW12_LN01_B 0x6C430
2041 #define _PORT_PCS_DW12_LN01_C 0x6C830
2042 #define _PORT_PCS_DW12_LN23_A 0x162630
2043 #define _PORT_PCS_DW12_LN23_B 0x6C630
2044 #define _PORT_PCS_DW12_LN23_C 0x6CA30
2045 #define _PORT_PCS_DW12_GRP_A 0x162c30
2046 #define _PORT_PCS_DW12_GRP_B 0x6CC30
2047 #define _PORT_PCS_DW12_GRP_C 0x6CE30
2048 #define LANESTAGGER_STRAP_OVRD (1 << 6)
2049 #define LANE_STAGGER_MASK 0x1F
2050 #define BXT_PORT_PCS_DW12_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2051 _PORT_PCS_DW12_LN01_B, \
2052 _PORT_PCS_DW12_LN01_C)
2053 #define BXT_PORT_PCS_DW12_LN23(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2054 _PORT_PCS_DW12_LN23_B, \
2055 _PORT_PCS_DW12_LN23_C)
2056 #define BXT_PORT_PCS_DW12_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2057 _PORT_PCS_DW12_GRP_B, \
2058 _PORT_PCS_DW12_GRP_C)
2060 /* BXT PHY TX registers */
2061 #define _BXT_LANE_OFFSET(lane) (((lane) >> 1) * 0x200 + \
2062 ((lane) & 1) * 0x80)
2064 #define _PORT_TX_DW2_LN0_A 0x162508
2065 #define _PORT_TX_DW2_LN0_B 0x6C508
2066 #define _PORT_TX_DW2_LN0_C 0x6C908
2067 #define _PORT_TX_DW2_GRP_A 0x162D08
2068 #define _PORT_TX_DW2_GRP_B 0x6CD08
2069 #define _PORT_TX_DW2_GRP_C 0x6CF08
2070 #define BXT_PORT_TX_DW2_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2071 _PORT_TX_DW2_LN0_B, \
2073 #define BXT_PORT_TX_DW2_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2074 _PORT_TX_DW2_GRP_B, \
2076 #define MARGIN_000_SHIFT 16
2077 #define MARGIN_000 (0xFF << MARGIN_000_SHIFT)
2078 #define UNIQ_TRANS_SCALE_SHIFT 8
2079 #define UNIQ_TRANS_SCALE (0xFF << UNIQ_TRANS_SCALE_SHIFT)
2081 #define _PORT_TX_DW3_LN0_A 0x16250C
2082 #define _PORT_TX_DW3_LN0_B 0x6C50C
2083 #define _PORT_TX_DW3_LN0_C 0x6C90C
2084 #define _PORT_TX_DW3_GRP_A 0x162D0C
2085 #define _PORT_TX_DW3_GRP_B 0x6CD0C
2086 #define _PORT_TX_DW3_GRP_C 0x6CF0C
2087 #define BXT_PORT_TX_DW3_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2088 _PORT_TX_DW3_LN0_B, \
2090 #define BXT_PORT_TX_DW3_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2091 _PORT_TX_DW3_GRP_B, \
2093 #define SCALE_DCOMP_METHOD (1 << 26)
2094 #define UNIQUE_TRANGE_EN_METHOD (1 << 27)
2096 #define _PORT_TX_DW4_LN0_A 0x162510
2097 #define _PORT_TX_DW4_LN0_B 0x6C510
2098 #define _PORT_TX_DW4_LN0_C 0x6C910
2099 #define _PORT_TX_DW4_GRP_A 0x162D10
2100 #define _PORT_TX_DW4_GRP_B 0x6CD10
2101 #define _PORT_TX_DW4_GRP_C 0x6CF10
2102 #define BXT_PORT_TX_DW4_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2103 _PORT_TX_DW4_LN0_B, \
2105 #define BXT_PORT_TX_DW4_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2106 _PORT_TX_DW4_GRP_B, \
2108 #define DEEMPH_SHIFT 24
2109 #define DE_EMPHASIS (0xFF << DEEMPH_SHIFT)
2111 #define _PORT_TX_DW5_LN0_A 0x162514
2112 #define _PORT_TX_DW5_LN0_B 0x6C514
2113 #define _PORT_TX_DW5_LN0_C 0x6C914
2114 #define _PORT_TX_DW5_GRP_A 0x162D14
2115 #define _PORT_TX_DW5_GRP_B 0x6CD14
2116 #define _PORT_TX_DW5_GRP_C 0x6CF14
2117 #define BXT_PORT_TX_DW5_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2118 _PORT_TX_DW5_LN0_B, \
2120 #define BXT_PORT_TX_DW5_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2121 _PORT_TX_DW5_GRP_B, \
2123 #define DCC_DELAY_RANGE_1 (1 << 9)
2124 #define DCC_DELAY_RANGE_2 (1 << 8)
2126 #define _PORT_TX_DW14_LN0_A 0x162538
2127 #define _PORT_TX_DW14_LN0_B 0x6C538
2128 #define _PORT_TX_DW14_LN0_C 0x6C938
2129 #define LATENCY_OPTIM_SHIFT 30
2130 #define LATENCY_OPTIM (1 << LATENCY_OPTIM_SHIFT)
2131 #define BXT_PORT_TX_DW14_LN(phy, ch, lane) \
2132 _MMIO(_BXT_PHY_CH(phy, ch, _PORT_TX_DW14_LN0_B, \
2133 _PORT_TX_DW14_LN0_C) + \
2134 _BXT_LANE_OFFSET(lane))
2136 /* UAIMI scratch pad register 1 */
2137 #define UAIMI_SPR1 _MMIO(0x4F074)
2138 /* SKL VccIO mask */
2139 #define SKL_VCCIO_MASK 0x1
2140 /* SKL balance leg register */
2141 #define DISPIO_CR_TX_BMU_CR0 _MMIO(0x6C00C)
2142 /* I_boost values */
2143 #define BALANCE_LEG_SHIFT(port) (8 + 3 * (port))
2144 #define BALANCE_LEG_MASK(port) (7 << (8 + 3 * (port)))
2145 /* Balance leg disable bits */
2146 #define BALANCE_LEG_DISABLE_SHIFT 23
2147 #define BALANCE_LEG_DISABLE(port) (1 << (23 + (port)))
2151 * [0-7] @ 0x2000 gen2,gen3
2152 * [8-15] @ 0x3000 945,g33,pnv
2154 * [0-15] @ 0x3000 gen4,gen5
2156 * [0-15] @ 0x100000 gen6,vlv,chv
2157 * [0-31] @ 0x100000 gen7+
2159 #define FENCE_REG(i) _MMIO(0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4)
2160 #define I830_FENCE_START_MASK 0x07f80000
2161 #define I830_FENCE_TILING_Y_SHIFT 12
2162 #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
2163 #define I830_FENCE_PITCH_SHIFT 4
2164 #define I830_FENCE_REG_VALID (1 << 0)
2165 #define I915_FENCE_MAX_PITCH_VAL 4
2166 #define I830_FENCE_MAX_PITCH_VAL 6
2167 #define I830_FENCE_MAX_SIZE_VAL (1 << 8)
2169 #define I915_FENCE_START_MASK 0x0ff00000
2170 #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
2172 #define FENCE_REG_965_LO(i) _MMIO(0x03000 + (i) * 8)
2173 #define FENCE_REG_965_HI(i) _MMIO(0x03000 + (i) * 8 + 4)
2174 #define I965_FENCE_PITCH_SHIFT 2
2175 #define I965_FENCE_TILING_Y_SHIFT 1
2176 #define I965_FENCE_REG_VALID (1 << 0)
2177 #define I965_FENCE_MAX_PITCH_VAL 0x0400
2179 #define FENCE_REG_GEN6_LO(i) _MMIO(0x100000 + (i) * 8)
2180 #define FENCE_REG_GEN6_HI(i) _MMIO(0x100000 + (i) * 8 + 4)
2181 #define GEN6_FENCE_PITCH_SHIFT 32
2182 #define GEN7_FENCE_MAX_PITCH_VAL 0x0800
2185 /* control register for cpu gtt access */
2186 #define TILECTL _MMIO(0x101000)
2187 #define TILECTL_SWZCTL (1 << 0)
2188 #define TILECTL_TLBPF (1 << 1)
2189 #define TILECTL_TLB_PREFETCH_DIS (1 << 2)
2190 #define TILECTL_BACKSNOOP_DIS (1 << 3)
2193 * Instruction and interrupt control regs
2195 #define PGTBL_CTL _MMIO(0x02020)
2196 #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */
2197 #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */
2198 #define PGTBL_ER _MMIO(0x02024)
2199 #define PRB0_BASE (0x2030 - 0x30)
2200 #define PRB1_BASE (0x2040 - 0x30) /* 830,gen3 */
2201 #define PRB2_BASE (0x2050 - 0x30) /* gen3 */
2202 #define SRB0_BASE (0x2100 - 0x30) /* gen2 */
2203 #define SRB1_BASE (0x2110 - 0x30) /* gen2 */
2204 #define SRB2_BASE (0x2120 - 0x30) /* 830 */
2205 #define SRB3_BASE (0x2130 - 0x30) /* 830 */
2206 #define RENDER_RING_BASE 0x02000
2207 #define BSD_RING_BASE 0x04000
2208 #define GEN6_BSD_RING_BASE 0x12000
2209 #define GEN8_BSD2_RING_BASE 0x1c000
2210 #define GEN11_BSD_RING_BASE 0x1c0000
2211 #define GEN11_BSD2_RING_BASE 0x1c4000
2212 #define GEN11_BSD3_RING_BASE 0x1d0000
2213 #define GEN11_BSD4_RING_BASE 0x1d4000
2214 #define VEBOX_RING_BASE 0x1a000
2215 #define GEN11_VEBOX_RING_BASE 0x1c8000
2216 #define GEN11_VEBOX2_RING_BASE 0x1d8000
2217 #define BLT_RING_BASE 0x22000
2218 #define RING_TAIL(base) _MMIO((base) + 0x30)
2219 #define RING_HEAD(base) _MMIO((base) + 0x34)
2220 #define RING_START(base) _MMIO((base) + 0x38)
2221 #define RING_CTL(base) _MMIO((base) + 0x3c)
2222 #define RING_CTL_SIZE(size) ((size) - PAGE_SIZE) /* in bytes -> pages */
2223 #define RING_SYNC_0(base) _MMIO((base) + 0x40)
2224 #define RING_SYNC_1(base) _MMIO((base) + 0x44)
2225 #define RING_SYNC_2(base) _MMIO((base) + 0x48)
2226 #define GEN6_RVSYNC (RING_SYNC_0(RENDER_RING_BASE))
2227 #define GEN6_RBSYNC (RING_SYNC_1(RENDER_RING_BASE))
2228 #define GEN6_RVESYNC (RING_SYNC_2(RENDER_RING_BASE))
2229 #define GEN6_VBSYNC (RING_SYNC_0(GEN6_BSD_RING_BASE))
2230 #define GEN6_VRSYNC (RING_SYNC_1(GEN6_BSD_RING_BASE))
2231 #define GEN6_VVESYNC (RING_SYNC_2(GEN6_BSD_RING_BASE))
2232 #define GEN6_BRSYNC (RING_SYNC_0(BLT_RING_BASE))
2233 #define GEN6_BVSYNC (RING_SYNC_1(BLT_RING_BASE))
2234 #define GEN6_BVESYNC (RING_SYNC_2(BLT_RING_BASE))
2235 #define GEN6_VEBSYNC (RING_SYNC_0(VEBOX_RING_BASE))
2236 #define GEN6_VERSYNC (RING_SYNC_1(VEBOX_RING_BASE))
2237 #define GEN6_VEVSYNC (RING_SYNC_2(VEBOX_RING_BASE))
2238 #define GEN6_NOSYNC INVALID_MMIO_REG
2239 #define RING_PSMI_CTL(base) _MMIO((base) + 0x50)
2240 #define RING_MAX_IDLE(base) _MMIO((base) + 0x54)
2241 #define RING_HWS_PGA(base) _MMIO((base) + 0x80)
2242 #define RING_HWS_PGA_GEN6(base) _MMIO((base) + 0x2080)
2243 #define RING_RESET_CTL(base) _MMIO((base) + 0xd0)
2244 #define RESET_CTL_REQUEST_RESET (1 << 0)
2245 #define RESET_CTL_READY_TO_RESET (1 << 1)
2246 #define RING_SEMA_WAIT_POLL(base) _MMIO((base) + 0x24c)
2248 #define HSW_GTT_CACHE_EN _MMIO(0x4024)
2249 #define GTT_CACHE_EN_ALL 0xF0007FFF
2250 #define GEN7_WR_WATERMARK _MMIO(0x4028)
2251 #define GEN7_GFX_PRIO_CTRL _MMIO(0x402C)
2252 #define ARB_MODE _MMIO(0x4030)
2253 #define ARB_MODE_SWIZZLE_SNB (1 << 4)
2254 #define ARB_MODE_SWIZZLE_IVB (1 << 5)
2255 #define GEN7_GFX_PEND_TLB0 _MMIO(0x4034)
2256 #define GEN7_GFX_PEND_TLB1 _MMIO(0x4038)
2257 /* L3, CVS, ZTLB, RCC, CASC LRA min, max values */
2258 #define GEN7_LRA_LIMITS(i) _MMIO(0x403C + (i) * 4)
2259 #define GEN7_LRA_LIMITS_REG_NUM 13
2260 #define GEN7_MEDIA_MAX_REQ_COUNT _MMIO(0x4070)
2261 #define GEN7_GFX_MAX_REQ_COUNT _MMIO(0x4074)
2263 #define GAMTARBMODE _MMIO(0x04a08)
2264 #define ARB_MODE_BWGTLB_DISABLE (1 << 9)
2265 #define ARB_MODE_SWIZZLE_BDW (1 << 1)
2266 #define RENDER_HWS_PGA_GEN7 _MMIO(0x04080)
2267 #define RING_FAULT_REG(engine) _MMIO(0x4094 + 0x100 * (engine)->hw_id)
2268 #define GEN8_RING_FAULT_REG _MMIO(0x4094)
2269 #define GEN8_RING_FAULT_ENGINE_ID(x) (((x) >> 12) & 0x7)
2270 #define RING_FAULT_GTTSEL_MASK (1 << 11)
2271 #define RING_FAULT_SRCID(x) (((x) >> 3) & 0xff)
2272 #define RING_FAULT_FAULT_TYPE(x) (((x) >> 1) & 0x3)
2273 #define RING_FAULT_VALID (1 << 0)
2274 #define DONE_REG _MMIO(0x40b0)
2275 #define GEN8_PRIVATE_PAT_LO _MMIO(0x40e0)
2276 #define GEN8_PRIVATE_PAT_HI _MMIO(0x40e0 + 4)
2277 #define GEN10_PAT_INDEX(index) _MMIO(0x40e0 + (index) * 4)
2278 #define BSD_HWS_PGA_GEN7 _MMIO(0x04180)
2279 #define BLT_HWS_PGA_GEN7 _MMIO(0x04280)
2280 #define VEBOX_HWS_PGA_GEN7 _MMIO(0x04380)
2281 #define RING_ACTHD(base) _MMIO((base) + 0x74)
2282 #define RING_ACTHD_UDW(base) _MMIO((base) + 0x5c)
2283 #define RING_NOPID(base) _MMIO((base) + 0x94)
2284 #define RING_IMR(base) _MMIO((base) + 0xa8)
2285 #define RING_HWSTAM(base) _MMIO((base) + 0x98)
2286 #define RING_TIMESTAMP(base) _MMIO((base) + 0x358)
2287 #define RING_TIMESTAMP_UDW(base) _MMIO((base) + 0x358 + 4)
2288 #define TAIL_ADDR 0x001FFFF8
2289 #define HEAD_WRAP_COUNT 0xFFE00000
2290 #define HEAD_WRAP_ONE 0x00200000
2291 #define HEAD_ADDR 0x001FFFFC
2292 #define RING_NR_PAGES 0x001FF000
2293 #define RING_REPORT_MASK 0x00000006
2294 #define RING_REPORT_64K 0x00000002
2295 #define RING_REPORT_128K 0x00000004
2296 #define RING_NO_REPORT 0x00000000
2297 #define RING_VALID_MASK 0x00000001
2298 #define RING_VALID 0x00000001
2299 #define RING_INVALID 0x00000000
2300 #define RING_WAIT_I8XX (1 << 0) /* gen2, PRBx_HEAD */
2301 #define RING_WAIT (1 << 11) /* gen3+, PRBx_CTL */
2302 #define RING_WAIT_SEMAPHORE (1 << 10) /* gen6+ */
2304 #define RING_FORCE_TO_NONPRIV(base, i) _MMIO(((base) + 0x4D0) + (i) * 4)
2305 #define RING_MAX_NONPRIV_SLOTS 12
2307 #define GEN7_TLB_RD_ADDR _MMIO(0x4700)
2309 #define GEN9_GAMT_ECO_REG_RW_IA _MMIO(0x4ab0)
2310 #define GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS (1 << 18)
2312 #define GEN8_GAMW_ECO_DEV_RW_IA _MMIO(0x4080)
2313 #define GAMW_ECO_ENABLE_64K_IPS_FIELD 0xF
2315 #define GAMT_CHKN_BIT_REG _MMIO(0x4ab8)
2316 #define GAMT_CHKN_DISABLE_L3_COH_PIPE (1 << 31)
2317 #define GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING (1 << 28)
2318 #define GAMT_CHKN_DISABLE_I2M_CYCLE_ON_WR_PORT (1 << 24)
2321 #define PRB0_TAIL _MMIO(0x2030)
2322 #define PRB0_HEAD _MMIO(0x2034)
2323 #define PRB0_START _MMIO(0x2038)
2324 #define PRB0_CTL _MMIO(0x203c)
2325 #define PRB1_TAIL _MMIO(0x2040) /* 915+ only */
2326 #define PRB1_HEAD _MMIO(0x2044) /* 915+ only */
2327 #define PRB1_START _MMIO(0x2048) /* 915+ only */
2328 #define PRB1_CTL _MMIO(0x204c) /* 915+ only */
2330 #define IPEIR_I965 _MMIO(0x2064)
2331 #define IPEHR_I965 _MMIO(0x2068)
2332 #define GEN7_SC_INSTDONE _MMIO(0x7100)
2333 #define GEN7_SAMPLER_INSTDONE _MMIO(0xe160)
2334 #define GEN7_ROW_INSTDONE _MMIO(0xe164)
2335 #define GEN8_MCR_SELECTOR _MMIO(0xfdc)
2336 #define GEN8_MCR_SLICE(slice) (((slice) & 3) << 26)
2337 #define GEN8_MCR_SLICE_MASK GEN8_MCR_SLICE(3)
2338 #define GEN8_MCR_SUBSLICE(subslice) (((subslice) & 3) << 24)
2339 #define GEN8_MCR_SUBSLICE_MASK GEN8_MCR_SUBSLICE(3)
2340 #define GEN11_MCR_SLICE(slice) (((slice) & 0xf) << 27)
2341 #define GEN11_MCR_SLICE_MASK GEN11_MCR_SLICE(0xf)
2342 #define GEN11_MCR_SUBSLICE(subslice) (((subslice) & 0x7) << 24)
2343 #define GEN11_MCR_SUBSLICE_MASK GEN11_MCR_SUBSLICE(0x7)
2344 #define RING_IPEIR(base) _MMIO((base) + 0x64)
2345 #define RING_IPEHR(base) _MMIO((base) + 0x68)
2347 * On GEN4, only the render ring INSTDONE exists and has a different
2348 * layout than the GEN7+ version.
2349 * The GEN2 counterpart of this register is GEN2_INSTDONE.
2351 #define RING_INSTDONE(base) _MMIO((base) + 0x6c)
2352 #define RING_INSTPS(base) _MMIO((base) + 0x70)
2353 #define RING_DMA_FADD(base) _MMIO((base) + 0x78)
2354 #define RING_DMA_FADD_UDW(base) _MMIO((base) + 0x60) /* gen8+ */
2355 #define RING_INSTPM(base) _MMIO((base) + 0xc0)
2356 #define RING_MI_MODE(base) _MMIO((base) + 0x9c)
2357 #define INSTPS _MMIO(0x2070) /* 965+ only */
2358 #define GEN4_INSTDONE1 _MMIO(0x207c) /* 965+ only, aka INSTDONE_2 on SNB */
2359 #define ACTHD_I965 _MMIO(0x2074)
2360 #define HWS_PGA _MMIO(0x2080)
2361 #define HWS_ADDRESS_MASK 0xfffff000
2362 #define HWS_START_ADDRESS_SHIFT 4
2363 #define PWRCTXA _MMIO(0x2088) /* 965GM+ only */
2364 #define PWRCTX_EN (1 << 0)
2365 #define IPEIR _MMIO(0x2088)
2366 #define IPEHR _MMIO(0x208c)
2367 #define GEN2_INSTDONE _MMIO(0x2090)
2368 #define NOPID _MMIO(0x2094)
2369 #define HWSTAM _MMIO(0x2098)
2370 #define DMA_FADD_I8XX _MMIO(0x20d0)
2371 #define RING_BBSTATE(base) _MMIO((base) + 0x110)
2372 #define RING_BB_PPGTT (1 << 5)
2373 #define RING_SBBADDR(base) _MMIO((base) + 0x114) /* hsw+ */
2374 #define RING_SBBSTATE(base) _MMIO((base) + 0x118) /* hsw+ */
2375 #define RING_SBBADDR_UDW(base) _MMIO((base) + 0x11c) /* gen8+ */
2376 #define RING_BBADDR(base) _MMIO((base) + 0x140)
2377 #define RING_BBADDR_UDW(base) _MMIO((base) + 0x168) /* gen8+ */
2378 #define RING_BB_PER_CTX_PTR(base) _MMIO((base) + 0x1c0) /* gen8+ */
2379 #define RING_INDIRECT_CTX(base) _MMIO((base) + 0x1c4) /* gen8+ */
2380 #define RING_INDIRECT_CTX_OFFSET(base) _MMIO((base) + 0x1c8) /* gen8+ */
2381 #define RING_CTX_TIMESTAMP(base) _MMIO((base) + 0x3a8) /* gen8+ */
2383 #define ERROR_GEN6 _MMIO(0x40a0)
2384 #define GEN7_ERR_INT _MMIO(0x44040)
2385 #define ERR_INT_POISON (1 << 31)
2386 #define ERR_INT_MMIO_UNCLAIMED (1 << 13)
2387 #define ERR_INT_PIPE_CRC_DONE_C (1 << 8)
2388 #define ERR_INT_FIFO_UNDERRUN_C (1 << 6)
2389 #define ERR_INT_PIPE_CRC_DONE_B (1 << 5)
2390 #define ERR_INT_FIFO_UNDERRUN_B (1 << 3)
2391 #define ERR_INT_PIPE_CRC_DONE_A (1 << 2)
2392 #define ERR_INT_PIPE_CRC_DONE(pipe) (1 << (2 + (pipe) * 3))
2393 #define ERR_INT_FIFO_UNDERRUN_A (1 << 0)
2394 #define ERR_INT_FIFO_UNDERRUN(pipe) (1 << ((pipe) * 3))
2396 #define GEN8_FAULT_TLB_DATA0 _MMIO(0x4b10)
2397 #define GEN8_FAULT_TLB_DATA1 _MMIO(0x4b14)
2398 #define FAULT_VA_HIGH_BITS (0xf << 0)
2399 #define FAULT_GTT_SEL (1 << 4)
2401 #define FPGA_DBG _MMIO(0x42300)
2402 #define FPGA_DBG_RM_NOCLAIM (1 << 31)
2404 #define CLAIM_ER _MMIO(VLV_DISPLAY_BASE + 0x2028)
2405 #define CLAIM_ER_CLR (1 << 31)
2406 #define CLAIM_ER_OVERFLOW (1 << 16)
2407 #define CLAIM_ER_CTR_MASK 0xffff
2409 #define DERRMR _MMIO(0x44050)
2410 /* Note that HBLANK events are reserved on bdw+ */
2411 #define DERRMR_PIPEA_SCANLINE (1 << 0)
2412 #define DERRMR_PIPEA_PRI_FLIP_DONE (1 << 1)
2413 #define DERRMR_PIPEA_SPR_FLIP_DONE (1 << 2)
2414 #define DERRMR_PIPEA_VBLANK (1 << 3)
2415 #define DERRMR_PIPEA_HBLANK (1 << 5)
2416 #define DERRMR_PIPEB_SCANLINE (1 << 8)
2417 #define DERRMR_PIPEB_PRI_FLIP_DONE (1 << 9)
2418 #define DERRMR_PIPEB_SPR_FLIP_DONE (1 << 10)
2419 #define DERRMR_PIPEB_VBLANK (1 << 11)
2420 #define DERRMR_PIPEB_HBLANK (1 << 13)
2421 /* Note that PIPEC is not a simple translation of PIPEA/PIPEB */
2422 #define DERRMR_PIPEC_SCANLINE (1 << 14)
2423 #define DERRMR_PIPEC_PRI_FLIP_DONE (1 << 15)
2424 #define DERRMR_PIPEC_SPR_FLIP_DONE (1 << 20)
2425 #define DERRMR_PIPEC_VBLANK (1 << 21)
2426 #define DERRMR_PIPEC_HBLANK (1 << 22)
2429 /* GM45+ chicken bits -- debug workaround bits that may be required
2430 * for various sorts of correct behavior. The top 16 bits of each are
2431 * the enables for writing to the corresponding low bit.
2433 #define _3D_CHICKEN _MMIO(0x2084)
2434 #define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
2435 #define _3D_CHICKEN2 _MMIO(0x208c)
2437 #define FF_SLICE_CHICKEN _MMIO(0x2088)
2438 #define FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX (1 << 1)
2440 /* Disables pipelining of read flushes past the SF-WIZ interface.
2441 * Required on all Ironlake steppings according to the B-Spec, but the
2442 * particular danger of not doing so is not specified.
2444 # define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14)
2445 #define _3D_CHICKEN3 _MMIO(0x2090)
2446 #define _3D_CHICKEN_SF_PROVOKING_VERTEX_FIX (1 << 12)
2447 #define _3D_CHICKEN_SF_DISABLE_OBJEND_CULL (1 << 10)
2448 #define _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE (1 << 5)
2449 #define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5)
2450 #define _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x) ((x) << 1) /* gen8+ */
2451 #define _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH (1 << 1) /* gen6 */
2453 #define MI_MODE _MMIO(0x209c)
2454 # define VS_TIMER_DISPATCH (1 << 6)
2455 # define MI_FLUSH_ENABLE (1 << 12)
2456 # define ASYNC_FLIP_PERF_DISABLE (1 << 14)
2457 # define MODE_IDLE (1 << 9)
2458 # define STOP_RING (1 << 8)
2460 #define GEN6_GT_MODE _MMIO(0x20d0)
2461 #define GEN7_GT_MODE _MMIO(0x7008)
2462 #define GEN6_WIZ_HASHING(hi, lo) (((hi) << 9) | ((lo) << 7))
2463 #define GEN6_WIZ_HASHING_8x8 GEN6_WIZ_HASHING(0, 0)
2464 #define GEN6_WIZ_HASHING_8x4 GEN6_WIZ_HASHING(0, 1)
2465 #define GEN6_WIZ_HASHING_16x4 GEN6_WIZ_HASHING(1, 0)
2466 #define GEN6_WIZ_HASHING_MASK GEN6_WIZ_HASHING(1, 1)
2467 #define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
2468 #define GEN9_IZ_HASHING_MASK(slice) (0x3 << ((slice) * 2))
2469 #define GEN9_IZ_HASHING(slice, val) ((val) << ((slice) * 2))
2471 /* chicken reg for WaConextSwitchWithConcurrentTLBInvalidate */
2472 #define GEN9_CSFE_CHICKEN1_RCS _MMIO(0x20D4)
2473 #define GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE (1 << 2)
2475 /* WaClearTdlStateAckDirtyBits */
2476 #define GEN8_STATE_ACK _MMIO(0x20F0)
2477 #define GEN9_STATE_ACK_SLICE1 _MMIO(0x20F8)
2478 #define GEN9_STATE_ACK_SLICE2 _MMIO(0x2100)
2479 #define GEN9_STATE_ACK_TDL0 (1 << 12)
2480 #define GEN9_STATE_ACK_TDL1 (1 << 13)
2481 #define GEN9_STATE_ACK_TDL2 (1 << 14)
2482 #define GEN9_STATE_ACK_TDL3 (1 << 15)
2483 #define GEN9_SUBSLICE_TDL_ACK_BITS \
2484 (GEN9_STATE_ACK_TDL3 | GEN9_STATE_ACK_TDL2 | \
2485 GEN9_STATE_ACK_TDL1 | GEN9_STATE_ACK_TDL0)
2487 #define GFX_MODE _MMIO(0x2520)
2488 #define GFX_MODE_GEN7 _MMIO(0x229c)
2489 #define RING_MODE_GEN7(engine) _MMIO((engine)->mmio_base + 0x29c)
2490 #define GFX_RUN_LIST_ENABLE (1 << 15)
2491 #define GFX_INTERRUPT_STEERING (1 << 14)
2492 #define GFX_TLB_INVALIDATE_EXPLICIT (1 << 13)
2493 #define GFX_SURFACE_FAULT_ENABLE (1 << 12)
2494 #define GFX_REPLAY_MODE (1 << 11)
2495 #define GFX_PSMI_GRANULARITY (1 << 10)
2496 #define GFX_PPGTT_ENABLE (1 << 9)
2497 #define GEN8_GFX_PPGTT_48B (1 << 7)
2499 #define GFX_FORWARD_VBLANK_MASK (3 << 5)
2500 #define GFX_FORWARD_VBLANK_NEVER (0 << 5)
2501 #define GFX_FORWARD_VBLANK_ALWAYS (1 << 5)
2502 #define GFX_FORWARD_VBLANK_COND (2 << 5)
2504 #define GEN11_GFX_DISABLE_LEGACY_MODE (1 << 3)
2506 #define VLV_DISPLAY_BASE 0x180000
2507 #define VLV_MIPI_BASE VLV_DISPLAY_BASE
2508 #define BXT_MIPI_BASE 0x60000
2510 #define VLV_GU_CTL0 _MMIO(VLV_DISPLAY_BASE + 0x2030)
2511 #define VLV_GU_CTL1 _MMIO(VLV_DISPLAY_BASE + 0x2034)
2512 #define SCPD0 _MMIO(0x209c) /* 915+ only */
2513 #define IER _MMIO(0x20a0)
2514 #define IIR _MMIO(0x20a4)
2515 #define IMR _MMIO(0x20a8)
2516 #define ISR _MMIO(0x20ac)
2517 #define VLV_GUNIT_CLOCK_GATE _MMIO(VLV_DISPLAY_BASE + 0x2060)
2518 #define GINT_DIS (1 << 22)
2519 #define GCFG_DIS (1 << 8)
2520 #define VLV_GUNIT_CLOCK_GATE2 _MMIO(VLV_DISPLAY_BASE + 0x2064)
2521 #define VLV_IIR_RW _MMIO(VLV_DISPLAY_BASE + 0x2084)
2522 #define VLV_IER _MMIO(VLV_DISPLAY_BASE + 0x20a0)
2523 #define VLV_IIR _MMIO(VLV_DISPLAY_BASE + 0x20a4)
2524 #define VLV_IMR _MMIO(VLV_DISPLAY_BASE + 0x20a8)
2525 #define VLV_ISR _MMIO(VLV_DISPLAY_BASE + 0x20ac)
2526 #define VLV_PCBR _MMIO(VLV_DISPLAY_BASE + 0x2120)
2527 #define VLV_PCBR_ADDR_SHIFT 12
2529 #define DISPLAY_PLANE_FLIP_PENDING(plane) (1 << (11 - (plane))) /* A and B only */
2530 #define EIR _MMIO(0x20b0)
2531 #define EMR _MMIO(0x20b4)
2532 #define ESR _MMIO(0x20b8)
2533 #define GM45_ERROR_PAGE_TABLE (1 << 5)
2534 #define GM45_ERROR_MEM_PRIV (1 << 4)
2535 #define I915_ERROR_PAGE_TABLE (1 << 4)
2536 #define GM45_ERROR_CP_PRIV (1 << 3)
2537 #define I915_ERROR_MEMORY_REFRESH (1 << 1)
2538 #define I915_ERROR_INSTRUCTION (1 << 0)
2539 #define INSTPM _MMIO(0x20c0)
2540 #define INSTPM_SELF_EN (1 << 12) /* 915GM only */
2541 #define INSTPM_AGPBUSY_INT_EN (1 << 11) /* gen3: when disabled, pending interrupts
2542 will not assert AGPBUSY# and will only
2543 be delivered when out of C3. */
2544 #define INSTPM_FORCE_ORDERING (1 << 7) /* GEN6+ */
2545 #define INSTPM_TLB_INVALIDATE (1 << 9)
2546 #define INSTPM_SYNC_FLUSH (1 << 5)
2547 #define ACTHD _MMIO(0x20c8)
2548 #define MEM_MODE _MMIO(0x20cc)
2549 #define MEM_DISPLAY_B_TRICKLE_FEED_DISABLE (1 << 3) /* 830 only */
2550 #define MEM_DISPLAY_A_TRICKLE_FEED_DISABLE (1 << 2) /* 830/845 only */
2551 #define MEM_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2) /* 85x only */
2552 #define FW_BLC _MMIO(0x20d8)
2553 #define FW_BLC2 _MMIO(0x20dc)
2554 #define FW_BLC_SELF _MMIO(0x20e0) /* 915+ only */
2555 #define FW_BLC_SELF_EN_MASK (1 << 31)
2556 #define FW_BLC_SELF_FIFO_MASK (1 << 16) /* 945 only */
2557 #define FW_BLC_SELF_EN (1 << 15) /* 945 only */
2558 #define MM_BURST_LENGTH 0x00700000
2559 #define MM_FIFO_WATERMARK 0x0001F000
2560 #define LM_BURST_LENGTH 0x00000700
2561 #define LM_FIFO_WATERMARK 0x0000001F
2562 #define MI_ARB_STATE _MMIO(0x20e4) /* 915+ only */
2564 #define MBUS_ABOX_CTL _MMIO(0x45038)
2565 #define MBUS_ABOX_BW_CREDIT_MASK (3 << 20)
2566 #define MBUS_ABOX_BW_CREDIT(x) ((x) << 20)
2567 #define MBUS_ABOX_B_CREDIT_MASK (0xF << 16)
2568 #define MBUS_ABOX_B_CREDIT(x) ((x) << 16)
2569 #define MBUS_ABOX_BT_CREDIT_POOL2_MASK (0x1F << 8)
2570 #define MBUS_ABOX_BT_CREDIT_POOL2(x) ((x) << 8)
2571 #define MBUS_ABOX_BT_CREDIT_POOL1_MASK (0x1F << 0)
2572 #define MBUS_ABOX_BT_CREDIT_POOL1(x) ((x) << 0)
2574 #define _PIPEA_MBUS_DBOX_CTL 0x7003C
2575 #define _PIPEB_MBUS_DBOX_CTL 0x7103C
2576 #define PIPE_MBUS_DBOX_CTL(pipe) _MMIO_PIPE(pipe, _PIPEA_MBUS_DBOX_CTL, \
2577 _PIPEB_MBUS_DBOX_CTL)
2578 #define MBUS_DBOX_BW_CREDIT_MASK (3 << 14)
2579 #define MBUS_DBOX_BW_CREDIT(x) ((x) << 14)
2580 #define MBUS_DBOX_B_CREDIT_MASK (0x1F << 8)
2581 #define MBUS_DBOX_B_CREDIT(x) ((x) << 8)
2582 #define MBUS_DBOX_A_CREDIT_MASK (0xF << 0)
2583 #define MBUS_DBOX_A_CREDIT(x) ((x) << 0)
2585 #define MBUS_UBOX_CTL _MMIO(0x4503C)
2586 #define MBUS_BBOX_CTL_S1 _MMIO(0x45040)
2587 #define MBUS_BBOX_CTL_S2 _MMIO(0x45044)
2589 /* Make render/texture TLB fetches lower priorty than associated data
2590 * fetches. This is not turned on by default
2592 #define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15)
2594 /* Isoch request wait on GTT enable (Display A/B/C streams).
2595 * Make isoch requests stall on the TLB update. May cause
2596 * display underruns (test mode only)
2598 #define MI_ARB_ISOCH_WAIT_GTT (1 << 14)
2600 /* Block grant count for isoch requests when block count is
2601 * set to a finite value.
2603 #define MI_ARB_BLOCK_GRANT_MASK (3 << 12)
2604 #define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */
2605 #define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */
2606 #define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */
2607 #define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */
2609 /* Enable render writes to complete in C2/C3/C4 power states.
2610 * If this isn't enabled, render writes are prevented in low
2611 * power states. That seems bad to me.
2613 #define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11)
2615 /* This acknowledges an async flip immediately instead
2616 * of waiting for 2TLB fetches.
2618 #define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10)
2620 /* Enables non-sequential data reads through arbiter
2622 #define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9)
2624 /* Disable FSB snooping of cacheable write cycles from binner/render
2627 #define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8)
2629 /* Arbiter time slice for non-isoch streams */
2630 #define MI_ARB_TIME_SLICE_MASK (7 << 5)
2631 #define MI_ARB_TIME_SLICE_1 (0 << 5)
2632 #define MI_ARB_TIME_SLICE_2 (1 << 5)
2633 #define MI_ARB_TIME_SLICE_4 (2 << 5)
2634 #define MI_ARB_TIME_SLICE_6 (3 << 5)
2635 #define MI_ARB_TIME_SLICE_8 (4 << 5)
2636 #define MI_ARB_TIME_SLICE_10 (5 << 5)
2637 #define MI_ARB_TIME_SLICE_14 (6 << 5)
2638 #define MI_ARB_TIME_SLICE_16 (7 << 5)
2640 /* Low priority grace period page size */
2641 #define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */
2642 #define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4)
2644 /* Disable display A/B trickle feed */
2645 #define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2)
2647 /* Set display plane priority */
2648 #define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
2649 #define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
2651 #define MI_STATE _MMIO(0x20e4) /* gen2 only */
2652 #define MI_AGPBUSY_INT_EN (1 << 1) /* 85x only */
2653 #define MI_AGPBUSY_830_MODE (1 << 0) /* 85x only */
2655 #define CACHE_MODE_0 _MMIO(0x2120) /* 915+ only */
2656 #define CM0_PIPELINED_RENDER_FLUSH_DISABLE (1 << 8)
2657 #define CM0_IZ_OPT_DISABLE (1 << 6)
2658 #define CM0_ZR_OPT_DISABLE (1 << 5)
2659 #define CM0_STC_EVICT_DISABLE_LRA_SNB (1 << 5)
2660 #define CM0_DEPTH_EVICT_DISABLE (1 << 4)
2661 #define CM0_COLOR_EVICT_DISABLE (1 << 3)
2662 #define CM0_DEPTH_WRITE_DISABLE (1 << 1)
2663 #define CM0_RC_OP_FLUSH_DISABLE (1 << 0)
2664 #define GFX_FLSH_CNTL _MMIO(0x2170) /* 915+ only */
2665 #define GFX_FLSH_CNTL_GEN6 _MMIO(0x101008)
2666 #define GFX_FLSH_CNTL_EN (1 << 0)
2667 #define ECOSKPD _MMIO(0x21d0)
2668 #define ECO_GATING_CX_ONLY (1 << 3)
2669 #define ECO_FLIP_DONE (1 << 0)
2671 #define CACHE_MODE_0_GEN7 _MMIO(0x7000) /* IVB+ */
2672 #define RC_OP_FLUSH_ENABLE (1 << 0)
2673 #define HIZ_RAW_STALL_OPT_DISABLE (1 << 2)
2674 #define CACHE_MODE_1 _MMIO(0x7004) /* IVB+ */
2675 #define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1 << 6)
2676 #define GEN8_4x4_STC_OPTIMIZATION_DISABLE (1 << 6)
2677 #define GEN9_PARTIAL_RESOLVE_IN_VC_DISABLE (1 << 1)
2679 #define GEN10_CACHE_MODE_SS _MMIO(0xe420)
2680 #define FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
2682 #define GEN6_BLITTER_ECOSKPD _MMIO(0x221d0)
2683 #define GEN6_BLITTER_LOCK_SHIFT 16
2684 #define GEN6_BLITTER_FBC_NOTIFY (1 << 3)
2686 #define GEN6_RC_SLEEP_PSMI_CONTROL _MMIO(0x2050)
2687 #define GEN6_PSMI_SLEEP_MSG_DISABLE (1 << 0)
2688 #define GEN8_RC_SEMA_IDLE_MSG_DISABLE (1 << 12)
2689 #define GEN8_FF_DOP_CLOCK_GATE_DISABLE (1 << 10)
2691 #define GEN6_RCS_PWR_FSM _MMIO(0x22ac)
2692 #define GEN9_RCS_FE_FSM2 _MMIO(0x22a4)
2694 /* Fuse readout registers for GT */
2695 #define HSW_PAVP_FUSE1 _MMIO(0x911C)
2696 #define HSW_F1_EU_DIS_SHIFT 16
2697 #define HSW_F1_EU_DIS_MASK (0x3 << HSW_F1_EU_DIS_SHIFT)
2698 #define HSW_F1_EU_DIS_10EUS 0
2699 #define HSW_F1_EU_DIS_8EUS 1
2700 #define HSW_F1_EU_DIS_6EUS 2
2702 #define CHV_FUSE_GT _MMIO(VLV_DISPLAY_BASE + 0x2168)
2703 #define CHV_FGT_DISABLE_SS0 (1 << 10)
2704 #define CHV_FGT_DISABLE_SS1 (1 << 11)
2705 #define CHV_FGT_EU_DIS_SS0_R0_SHIFT 16
2706 #define CHV_FGT_EU_DIS_SS0_R0_MASK (0xf << CHV_FGT_EU_DIS_SS0_R0_SHIFT)
2707 #define CHV_FGT_EU_DIS_SS0_R1_SHIFT 20
2708 #define CHV_FGT_EU_DIS_SS0_R1_MASK (0xf << CHV_FGT_EU_DIS_SS0_R1_SHIFT)
2709 #define CHV_FGT_EU_DIS_SS1_R0_SHIFT 24
2710 #define CHV_FGT_EU_DIS_SS1_R0_MASK (0xf << CHV_FGT_EU_DIS_SS1_R0_SHIFT)
2711 #define CHV_FGT_EU_DIS_SS1_R1_SHIFT 28
2712 #define CHV_FGT_EU_DIS_SS1_R1_MASK (0xf << CHV_FGT_EU_DIS_SS1_R1_SHIFT)
2714 #define GEN8_FUSE2 _MMIO(0x9120)
2715 #define GEN8_F2_SS_DIS_SHIFT 21
2716 #define GEN8_F2_SS_DIS_MASK (0x7 << GEN8_F2_SS_DIS_SHIFT)
2717 #define GEN8_F2_S_ENA_SHIFT 25
2718 #define GEN8_F2_S_ENA_MASK (0x7 << GEN8_F2_S_ENA_SHIFT)
2720 #define GEN9_F2_SS_DIS_SHIFT 20
2721 #define GEN9_F2_SS_DIS_MASK (0xf << GEN9_F2_SS_DIS_SHIFT)
2723 #define GEN10_F2_S_ENA_SHIFT 22
2724 #define GEN10_F2_S_ENA_MASK (0x3f << GEN10_F2_S_ENA_SHIFT)
2725 #define GEN10_F2_SS_DIS_SHIFT 18
2726 #define GEN10_F2_SS_DIS_MASK (0xf << GEN10_F2_SS_DIS_SHIFT)
2728 #define GEN10_MIRROR_FUSE3 _MMIO(0x9118)
2729 #define GEN10_L3BANK_PAIR_COUNT 4
2730 #define GEN10_L3BANK_MASK 0x0F
2732 #define GEN8_EU_DISABLE0 _MMIO(0x9134)
2733 #define GEN8_EU_DIS0_S0_MASK 0xffffff
2734 #define GEN8_EU_DIS0_S1_SHIFT 24
2735 #define GEN8_EU_DIS0_S1_MASK (0xff << GEN8_EU_DIS0_S1_SHIFT)
2737 #define GEN8_EU_DISABLE1 _MMIO(0x9138)
2738 #define GEN8_EU_DIS1_S1_MASK 0xffff
2739 #define GEN8_EU_DIS1_S2_SHIFT 16
2740 #define GEN8_EU_DIS1_S2_MASK (0xffff << GEN8_EU_DIS1_S2_SHIFT)
2742 #define GEN8_EU_DISABLE2 _MMIO(0x913c)
2743 #define GEN8_EU_DIS2_S2_MASK 0xff
2745 #define GEN9_EU_DISABLE(slice) _MMIO(0x9134 + (slice) * 0x4)
2747 #define GEN10_EU_DISABLE3 _MMIO(0x9140)
2748 #define GEN10_EU_DIS_SS_MASK 0xff
2750 #define GEN11_GT_VEBOX_VDBOX_DISABLE _MMIO(0x9140)
2751 #define GEN11_GT_VDBOX_DISABLE_MASK 0xff
2752 #define GEN11_GT_VEBOX_DISABLE_SHIFT 16
2753 #define GEN11_GT_VEBOX_DISABLE_MASK (0xff << GEN11_GT_VEBOX_DISABLE_SHIFT)
2755 #define GEN11_EU_DISABLE _MMIO(0x9134)
2756 #define GEN11_EU_DIS_MASK 0xFF
2758 #define GEN11_GT_SLICE_ENABLE _MMIO(0x9138)
2759 #define GEN11_GT_S_ENA_MASK 0xFF
2761 #define GEN11_GT_SUBSLICE_DISABLE _MMIO(0x913C)
2763 #define GEN6_BSD_SLEEP_PSMI_CONTROL _MMIO(0x12050)
2764 #define GEN6_BSD_SLEEP_MSG_DISABLE (1 << 0)
2765 #define GEN6_BSD_SLEEP_FLUSH_DISABLE (1 << 2)
2766 #define GEN6_BSD_SLEEP_INDICATOR (1 << 3)
2767 #define GEN6_BSD_GO_INDICATOR (1 << 4)
2769 /* On modern GEN architectures interrupt control consists of two sets
2770 * of registers. The first set pertains to the ring generating the
2771 * interrupt. The second control is for the functional block generating the
2772 * interrupt. These are PM, GT, DE, etc.
2774 * Luckily *knocks on wood* all the ring interrupt bits match up with the
2775 * GT interrupt bits, so we don't need to duplicate the defines.
2777 * These defines should cover us well from SNB->HSW with minor exceptions
2778 * it can also work on ILK.
2780 #define GT_BLT_FLUSHDW_NOTIFY_INTERRUPT (1 << 26)
2781 #define GT_BLT_CS_ERROR_INTERRUPT (1 << 25)
2782 #define GT_BLT_USER_INTERRUPT (1 << 22)
2783 #define GT_BSD_CS_ERROR_INTERRUPT (1 << 15)
2784 #define GT_BSD_USER_INTERRUPT (1 << 12)
2785 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 (1 << 11) /* hsw+; rsvd on snb, ivb, vlv */
2786 #define GT_CONTEXT_SWITCH_INTERRUPT (1 << 8)
2787 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT (1 << 5) /* !snb */
2788 #define GT_RENDER_PIPECTL_NOTIFY_INTERRUPT (1 << 4)
2789 #define GT_RENDER_CS_MASTER_ERROR_INTERRUPT (1 << 3)
2790 #define GT_RENDER_SYNC_STATUS_INTERRUPT (1 << 2)
2791 #define GT_RENDER_DEBUG_INTERRUPT (1 << 1)
2792 #define GT_RENDER_USER_INTERRUPT (1 << 0)
2794 #define PM_VEBOX_CS_ERROR_INTERRUPT (1 << 12) /* hsw+ */
2795 #define PM_VEBOX_USER_INTERRUPT (1 << 10) /* hsw+ */
2797 #define GT_PARITY_ERROR(dev_priv) \
2798 (GT_RENDER_L3_PARITY_ERROR_INTERRUPT | \
2799 (IS_HASWELL(dev_priv) ? GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 : 0))
2801 /* These are all the "old" interrupts */
2802 #define ILK_BSD_USER_INTERRUPT (1 << 5)
2804 #define I915_PM_INTERRUPT (1 << 31)
2805 #define I915_ISP_INTERRUPT (1 << 22)
2806 #define I915_LPE_PIPE_B_INTERRUPT (1 << 21)
2807 #define I915_LPE_PIPE_A_INTERRUPT (1 << 20)
2808 #define I915_MIPIC_INTERRUPT (1 << 19)
2809 #define I915_MIPIA_INTERRUPT (1 << 18)
2810 #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1 << 18)
2811 #define I915_DISPLAY_PORT_INTERRUPT (1 << 17)
2812 #define I915_DISPLAY_PIPE_C_HBLANK_INTERRUPT (1 << 16)
2813 #define I915_MASTER_ERROR_INTERRUPT (1 << 15)
2814 #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1 << 15)
2815 #define I915_DISPLAY_PIPE_B_HBLANK_INTERRUPT (1 << 14)
2816 #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1 << 14) /* p-state */
2817 #define I915_DISPLAY_PIPE_A_HBLANK_INTERRUPT (1 << 13)
2818 #define I915_HWB_OOM_INTERRUPT (1 << 13)
2819 #define I915_LPE_PIPE_C_INTERRUPT (1 << 12)
2820 #define I915_SYNC_STATUS_INTERRUPT (1 << 12)
2821 #define I915_MISC_INTERRUPT (1 << 11)
2822 #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1 << 11)
2823 #define I915_DISPLAY_PIPE_C_VBLANK_INTERRUPT (1 << 10)
2824 #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1 << 10)
2825 #define I915_DISPLAY_PIPE_C_EVENT_INTERRUPT (1 << 9)
2826 #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1 << 9)
2827 #define I915_DISPLAY_PIPE_C_DPBM_INTERRUPT (1 << 8)
2828 #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1 << 8)
2829 #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1 << 7)
2830 #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1 << 6)
2831 #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1 << 5)
2832 #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1 << 4)
2833 #define I915_DISPLAY_PIPE_A_DPBM_INTERRUPT (1 << 3)
2834 #define I915_DISPLAY_PIPE_B_DPBM_INTERRUPT (1 << 2)
2835 #define I915_DEBUG_INTERRUPT (1 << 2)
2836 #define I915_WINVALID_INTERRUPT (1 << 1)
2837 #define I915_USER_INTERRUPT (1 << 1)
2838 #define I915_ASLE_INTERRUPT (1 << 0)
2839 #define I915_BSD_USER_INTERRUPT (1 << 25)
2841 #define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000)
2842 #define I915_HDMI_LPE_AUDIO_SIZE 0x1000
2844 /* DisplayPort Audio w/ LPE */
2845 #define VLV_AUD_CHICKEN_BIT_REG _MMIO(VLV_DISPLAY_BASE + 0x62F38)
2846 #define VLV_CHICKEN_BIT_DBG_ENABLE (1 << 0)
2848 #define _VLV_AUD_PORT_EN_B_DBG (VLV_DISPLAY_BASE + 0x62F20)
2849 #define _VLV_AUD_PORT_EN_C_DBG (VLV_DISPLAY_BASE + 0x62F30)
2850 #define _VLV_AUD_PORT_EN_D_DBG (VLV_DISPLAY_BASE + 0x62F34)
2851 #define VLV_AUD_PORT_EN_DBG(port) _MMIO_PORT3((port) - PORT_B, \
2852 _VLV_AUD_PORT_EN_B_DBG, \
2853 _VLV_AUD_PORT_EN_C_DBG, \
2854 _VLV_AUD_PORT_EN_D_DBG)
2855 #define VLV_AMP_MUTE (1 << 1)
2857 #define GEN6_BSD_RNCID _MMIO(0x12198)
2859 #define GEN7_FF_THREAD_MODE _MMIO(0x20a0)
2860 #define GEN7_FF_SCHED_MASK 0x0077070
2861 #define GEN8_FF_DS_REF_CNT_FFME (1 << 19)
2862 #define GEN7_FF_TS_SCHED_HS1 (0x5 << 16)
2863 #define GEN7_FF_TS_SCHED_HS0 (0x3 << 16)
2864 #define GEN7_FF_TS_SCHED_LOAD_BALANCE (0x1 << 16)
2865 #define GEN7_FF_TS_SCHED_HW (0x0 << 16) /* Default */
2866 #define GEN7_FF_VS_REF_CNT_FFME (1 << 15)
2867 #define GEN7_FF_VS_SCHED_HS1 (0x5 << 12)
2868 #define GEN7_FF_VS_SCHED_HS0 (0x3 << 12)
2869 #define GEN7_FF_VS_SCHED_LOAD_BALANCE (0x1 << 12) /* Default */
2870 #define GEN7_FF_VS_SCHED_HW (0x0 << 12)
2871 #define GEN7_FF_DS_SCHED_HS1 (0x5 << 4)
2872 #define GEN7_FF_DS_SCHED_HS0 (0x3 << 4)
2873 #define GEN7_FF_DS_SCHED_LOAD_BALANCE (0x1 << 4) /* Default */
2874 #define GEN7_FF_DS_SCHED_HW (0x0 << 4)
2877 * Framebuffer compression (915+ only)
2880 #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */
2881 #define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */
2882 #define FBC_CONTROL _MMIO(0x3208)
2883 #define FBC_CTL_EN (1 << 31)
2884 #define FBC_CTL_PERIODIC (1 << 30)
2885 #define FBC_CTL_INTERVAL_SHIFT (16)
2886 #define FBC_CTL_UNCOMPRESSIBLE (1 << 14)
2887 #define FBC_CTL_C3_IDLE (1 << 13)
2888 #define FBC_CTL_STRIDE_SHIFT (5)
2889 #define FBC_CTL_FENCENO_SHIFT (0)
2890 #define FBC_COMMAND _MMIO(0x320c)
2891 #define FBC_CMD_COMPRESS (1 << 0)
2892 #define FBC_STATUS _MMIO(0x3210)
2893 #define FBC_STAT_COMPRESSING (1 << 31)
2894 #define FBC_STAT_COMPRESSED (1 << 30)
2895 #define FBC_STAT_MODIFIED (1 << 29)
2896 #define FBC_STAT_CURRENT_LINE_SHIFT (0)
2897 #define FBC_CONTROL2 _MMIO(0x3214)
2898 #define FBC_CTL_FENCE_DBL (0 << 4)
2899 #define FBC_CTL_IDLE_IMM (0 << 2)
2900 #define FBC_CTL_IDLE_FULL (1 << 2)
2901 #define FBC_CTL_IDLE_LINE (2 << 2)
2902 #define FBC_CTL_IDLE_DEBUG (3 << 2)
2903 #define FBC_CTL_CPU_FENCE (1 << 1)
2904 #define FBC_CTL_PLANE(plane) ((plane) << 0)
2905 #define FBC_FENCE_OFF _MMIO(0x3218) /* BSpec typo has 321Bh */
2906 #define FBC_TAG(i) _MMIO(0x3300 + (i) * 4)
2908 #define FBC_LL_SIZE (1536)
2910 #define FBC_LLC_READ_CTRL _MMIO(0x9044)
2911 #define FBC_LLC_FULLY_OPEN (1 << 30)
2913 /* Framebuffer compression for GM45+ */
2914 #define DPFC_CB_BASE _MMIO(0x3200)
2915 #define DPFC_CONTROL _MMIO(0x3208)
2916 #define DPFC_CTL_EN (1 << 31)
2917 #define DPFC_CTL_PLANE(plane) ((plane) << 30)
2918 #define IVB_DPFC_CTL_PLANE(plane) ((plane) << 29)
2919 #define DPFC_CTL_FENCE_EN (1 << 29)
2920 #define IVB_DPFC_CTL_FENCE_EN (1 << 28)
2921 #define DPFC_CTL_PERSISTENT_MODE (1 << 25)
2922 #define DPFC_SR_EN (1 << 10)
2923 #define DPFC_CTL_LIMIT_1X (0 << 6)
2924 #define DPFC_CTL_LIMIT_2X (1 << 6)
2925 #define DPFC_CTL_LIMIT_4X (2 << 6)
2926 #define DPFC_RECOMP_CTL _MMIO(0x320c)
2927 #define DPFC_RECOMP_STALL_EN (1 << 27)
2928 #define DPFC_RECOMP_STALL_WM_SHIFT (16)
2929 #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
2930 #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
2931 #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
2932 #define DPFC_STATUS _MMIO(0x3210)
2933 #define DPFC_INVAL_SEG_SHIFT (16)
2934 #define DPFC_INVAL_SEG_MASK (0x07ff0000)
2935 #define DPFC_COMP_SEG_SHIFT (0)
2936 #define DPFC_COMP_SEG_MASK (0x000007ff)
2937 #define DPFC_STATUS2 _MMIO(0x3214)
2938 #define DPFC_FENCE_YOFF _MMIO(0x3218)
2939 #define DPFC_CHICKEN _MMIO(0x3224)
2940 #define DPFC_HT_MODIFY (1 << 31)
2942 /* Framebuffer compression for Ironlake */
2943 #define ILK_DPFC_CB_BASE _MMIO(0x43200)
2944 #define ILK_DPFC_CONTROL _MMIO(0x43208)
2945 #define FBC_CTL_FALSE_COLOR (1 << 10)
2946 /* The bit 28-8 is reserved */
2947 #define DPFC_RESERVED (0x1FFFFF00)
2948 #define ILK_DPFC_RECOMP_CTL _MMIO(0x4320c)
2949 #define ILK_DPFC_STATUS _MMIO(0x43210)
2950 #define ILK_DPFC_COMP_SEG_MASK 0x7ff
2951 #define IVB_FBC_STATUS2 _MMIO(0x43214)
2952 #define IVB_FBC_COMP_SEG_MASK 0x7ff
2953 #define BDW_FBC_COMP_SEG_MASK 0xfff
2954 #define ILK_DPFC_FENCE_YOFF _MMIO(0x43218)
2955 #define ILK_DPFC_CHICKEN _MMIO(0x43224)
2956 #define ILK_DPFC_DISABLE_DUMMY0 (1 << 8)
2957 #define ILK_DPFC_NUKE_ON_ANY_MODIFICATION (1 << 23)
2958 #define ILK_FBC_RT_BASE _MMIO(0x2128)
2959 #define ILK_FBC_RT_VALID (1 << 0)
2960 #define SNB_FBC_FRONT_BUFFER (1 << 1)
2962 #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
2963 #define ILK_FBCQ_DIS (1 << 22)
2964 #define ILK_PABSTRETCH_DIS (1 << 21)
2968 * Framebuffer compression for Sandybridge
2970 * The following two registers are of type GTTMMADR
2972 #define SNB_DPFC_CTL_SA _MMIO(0x100100)
2973 #define SNB_CPU_FENCE_ENABLE (1 << 29)
2974 #define DPFC_CPU_FENCE_OFFSET _MMIO(0x100104)
2976 /* Framebuffer compression for Ivybridge */
2977 #define IVB_FBC_RT_BASE _MMIO(0x7020)
2979 #define IPS_CTL _MMIO(0x43408)
2980 #define IPS_ENABLE (1 << 31)
2982 #define MSG_FBC_REND_STATE _MMIO(0x50380)
2983 #define FBC_REND_NUKE (1 << 2)
2984 #define FBC_REND_CACHE_CLEAN (1 << 1)
2989 #define GPIOA _MMIO(0x5010)
2990 #define GPIOB _MMIO(0x5014)
2991 #define GPIOC _MMIO(0x5018)
2992 #define GPIOD _MMIO(0x501c)
2993 #define GPIOE _MMIO(0x5020)
2994 #define GPIOF _MMIO(0x5024)
2995 #define GPIOG _MMIO(0x5028)
2996 #define GPIOH _MMIO(0x502c)
2997 #define GPIOJ _MMIO(0x5034)
2998 #define GPIOK _MMIO(0x5038)
2999 #define GPIOL _MMIO(0x503C)
3000 #define GPIOM _MMIO(0x5040)
3001 # define GPIO_CLOCK_DIR_MASK (1 << 0)
3002 # define GPIO_CLOCK_DIR_IN (0 << 1)
3003 # define GPIO_CLOCK_DIR_OUT (1 << 1)
3004 # define GPIO_CLOCK_VAL_MASK (1 << 2)
3005 # define GPIO_CLOCK_VAL_OUT (1 << 3)
3006 # define GPIO_CLOCK_VAL_IN (1 << 4)
3007 # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
3008 # define GPIO_DATA_DIR_MASK (1 << 8)
3009 # define GPIO_DATA_DIR_IN (0 << 9)
3010 # define GPIO_DATA_DIR_OUT (1 << 9)
3011 # define GPIO_DATA_VAL_MASK (1 << 10)
3012 # define GPIO_DATA_VAL_OUT (1 << 11)
3013 # define GPIO_DATA_VAL_IN (1 << 12)
3014 # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
3016 #define GMBUS0 _MMIO(dev_priv->gpio_mmio_base + 0x5100) /* clock/port select */
3017 #define GMBUS_AKSV_SELECT (1 << 11)
3018 #define GMBUS_RATE_100KHZ (0 << 8)
3019 #define GMBUS_RATE_50KHZ (1 << 8)
3020 #define GMBUS_RATE_400KHZ (2 << 8) /* reserved on Pineview */
3021 #define GMBUS_RATE_1MHZ (3 << 8) /* reserved on Pineview */
3022 #define GMBUS_HOLD_EXT (1 << 7) /* 300ns hold time, rsvd on Pineview */
3023 #define GMBUS_PIN_DISABLED 0
3024 #define GMBUS_PIN_SSC 1
3025 #define GMBUS_PIN_VGADDC 2
3026 #define GMBUS_PIN_PANEL 3
3027 #define GMBUS_PIN_DPD_CHV 3 /* HDMID_CHV */
3028 #define GMBUS_PIN_DPC 4 /* HDMIC */
3029 #define GMBUS_PIN_DPB 5 /* SDVO, HDMIB */
3030 #define GMBUS_PIN_DPD 6 /* HDMID */
3031 #define GMBUS_PIN_RESERVED 7 /* 7 reserved */
3032 #define GMBUS_PIN_1_BXT 1 /* BXT+ (atom) and CNP+ (big core) */
3033 #define GMBUS_PIN_2_BXT 2
3034 #define GMBUS_PIN_3_BXT 3
3035 #define GMBUS_PIN_4_CNP 4
3036 #define GMBUS_PIN_9_TC1_ICP 9
3037 #define GMBUS_PIN_10_TC2_ICP 10
3038 #define GMBUS_PIN_11_TC3_ICP 11
3039 #define GMBUS_PIN_12_TC4_ICP 12
3041 #define GMBUS_NUM_PINS 13 /* including 0 */
3042 #define GMBUS1 _MMIO(dev_priv->gpio_mmio_base + 0x5104) /* command/status */
3043 #define GMBUS_SW_CLR_INT (1 << 31)
3044 #define GMBUS_SW_RDY (1 << 30)
3045 #define GMBUS_ENT (1 << 29) /* enable timeout */
3046 #define GMBUS_CYCLE_NONE (0 << 25)
3047 #define GMBUS_CYCLE_WAIT (1 << 25)
3048 #define GMBUS_CYCLE_INDEX (2 << 25)
3049 #define GMBUS_CYCLE_STOP (4 << 25)
3050 #define GMBUS_BYTE_COUNT_SHIFT 16
3051 #define GMBUS_BYTE_COUNT_MAX 256U
3052 #define GMBUS_SLAVE_INDEX_SHIFT 8
3053 #define GMBUS_SLAVE_ADDR_SHIFT 1
3054 #define GMBUS_SLAVE_READ (1 << 0)
3055 #define GMBUS_SLAVE_WRITE (0 << 0)
3056 #define GMBUS2 _MMIO(dev_priv->gpio_mmio_base + 0x5108) /* status */
3057 #define GMBUS_INUSE (1 << 15)
3058 #define GMBUS_HW_WAIT_PHASE (1 << 14)
3059 #define GMBUS_STALL_TIMEOUT (1 << 13)
3060 #define GMBUS_INT (1 << 12)
3061 #define GMBUS_HW_RDY (1 << 11)
3062 #define GMBUS_SATOER (1 << 10)
3063 #define GMBUS_ACTIVE (1 << 9)
3064 #define GMBUS3 _MMIO(dev_priv->gpio_mmio_base + 0x510c) /* data buffer bytes 3-0 */
3065 #define GMBUS4 _MMIO(dev_priv->gpio_mmio_base + 0x5110) /* interrupt mask (Pineview+) */
3066 #define GMBUS_SLAVE_TIMEOUT_EN (1 << 4)
3067 #define GMBUS_NAK_EN (1 << 3)
3068 #define GMBUS_IDLE_EN (1 << 2)
3069 #define GMBUS_HW_WAIT_EN (1 << 1)
3070 #define GMBUS_HW_RDY_EN (1 << 0)
3071 #define GMBUS5 _MMIO(dev_priv->gpio_mmio_base + 0x5120) /* byte index */
3072 #define GMBUS_2BYTE_INDEX_EN (1 << 31)
3075 * Clock control & power management
3077 #define _DPLL_A (dev_priv->info.display_mmio_offset + 0x6014)
3078 #define _DPLL_B (dev_priv->info.display_mmio_offset + 0x6018)
3079 #define _CHV_DPLL_C (dev_priv->info.display_mmio_offset + 0x6030)
3080 #define DPLL(pipe) _MMIO_PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
3082 #define VGA0 _MMIO(0x6000)
3083 #define VGA1 _MMIO(0x6004)
3084 #define VGA_PD _MMIO(0x6010)
3085 #define VGA0_PD_P2_DIV_4 (1 << 7)
3086 #define VGA0_PD_P1_DIV_2 (1 << 5)
3087 #define VGA0_PD_P1_SHIFT 0
3088 #define VGA0_PD_P1_MASK (0x1f << 0)
3089 #define VGA1_PD_P2_DIV_4 (1 << 15)
3090 #define VGA1_PD_P1_DIV_2 (1 << 13)
3091 #define VGA1_PD_P1_SHIFT 8
3092 #define VGA1_PD_P1_MASK (0x1f << 8)
3093 #define DPLL_VCO_ENABLE (1 << 31)
3094 #define DPLL_SDVO_HIGH_SPEED (1 << 30)
3095 #define DPLL_DVO_2X_MODE (1 << 30)
3096 #define DPLL_EXT_BUFFER_ENABLE_VLV (1 << 30)
3097 #define DPLL_SYNCLOCK_ENABLE (1 << 29)
3098 #define DPLL_REF_CLK_ENABLE_VLV (1 << 29)
3099 #define DPLL_VGA_MODE_DIS (1 << 28)
3100 #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
3101 #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
3102 #define DPLL_MODE_MASK (3 << 26)
3103 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
3104 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
3105 #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
3106 #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
3107 #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
3108 #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
3109 #define DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW 0x00ff8000 /* Pineview */
3110 #define DPLL_LOCK_VLV (1 << 15)
3111 #define DPLL_INTEGRATED_CRI_CLK_VLV (1 << 14)
3112 #define DPLL_INTEGRATED_REF_CLK_VLV (1 << 13)
3113 #define DPLL_SSC_REF_CLK_CHV (1 << 13)
3114 #define DPLL_PORTC_READY_MASK (0xf << 4)
3115 #define DPLL_PORTB_READY_MASK (0xf)
3117 #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
3119 /* Additional CHV pll/phy registers */
3120 #define DPIO_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x6240)
3121 #define DPLL_PORTD_READY_MASK (0xf)
3122 #define DISPLAY_PHY_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x60100)
3123 #define PHY_CH_POWER_DOWN_OVRD_EN(phy, ch) (1 << (2 * (phy) + (ch) + 27))
3124 #define PHY_LDO_DELAY_0NS 0x0
3125 #define PHY_LDO_DELAY_200NS 0x1
3126 #define PHY_LDO_DELAY_600NS 0x2
3127 #define PHY_LDO_SEQ_DELAY(delay, phy) ((delay) << (2 * (phy) + 23))
3128 #define PHY_CH_POWER_DOWN_OVRD(mask, phy, ch) ((mask) << (8 * (phy) + 4 * (ch) + 11))
3129 #define PHY_CH_SU_PSR 0x1
3130 #define PHY_CH_DEEP_PSR 0x7
3131 #define PHY_CH_POWER_MODE(mode, phy, ch) ((mode) << (6 * (phy) + 3 * (ch) + 2))
3132 #define PHY_COM_LANE_RESET_DEASSERT(phy) (1 << (phy))
3133 #define DISPLAY_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x60104)
3134 #define PHY_POWERGOOD(phy) (((phy) == DPIO_PHY0) ? (1 << 31) : (1 << 30))
3135 #define PHY_STATUS_CMN_LDO(phy, ch) (1 << (6 - (6 * (phy) + 3 * (ch))))
3136 #define PHY_STATUS_SPLINE_LDO(phy, ch, spline) (1 << (8 - (6 * (phy) + 3 * (ch) + (spline))))
3139 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
3140 * this field (only one bit may be set).
3142 #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
3143 #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
3144 #define DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW 15
3145 /* i830, required in DVO non-gang */
3146 #define PLL_P2_DIVIDE_BY_4 (1 << 23)
3147 #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
3148 #define PLL_REF_INPUT_DREFCLK (0 << 13)
3149 #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
3150 #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
3151 #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
3152 #define PLL_REF_INPUT_MASK (3 << 13)
3153 #define PLL_LOAD_PULSE_PHASE_SHIFT 9
3155 # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
3156 # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
3157 # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x) - 1) << 9)
3158 # define DPLL_FPA1_P1_POST_DIV_SHIFT 0
3159 # define DPLL_FPA1_P1_POST_DIV_MASK 0xff
3162 * Parallel to Serial Load Pulse phase selection.
3163 * Selects the phase for the 10X DPLL clock for the PCIe
3164 * digital display port. The range is 4 to 13; 10 or more
3165 * is just a flip delay. The default is 6
3167 #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
3168 #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
3170 * SDVO multiplier for 945G/GM. Not used on 965.
3172 #define SDVO_MULTIPLIER_MASK 0x000000ff
3173 #define SDVO_MULTIPLIER_SHIFT_HIRES 4
3174 #define SDVO_MULTIPLIER_SHIFT_VGA 0
3176 #define _DPLL_A_MD (dev_priv->info.display_mmio_offset + 0x601c)
3177 #define _DPLL_B_MD (dev_priv->info.display_mmio_offset + 0x6020)
3178 #define _CHV_DPLL_C_MD (dev_priv->info.display_mmio_offset + 0x603c)
3179 #define DPLL_MD(pipe) _MMIO_PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
3182 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
3184 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
3186 #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
3187 #define DPLL_MD_UDI_DIVIDER_SHIFT 24
3188 /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
3189 #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
3190 #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
3192 * SDVO/UDI pixel multiplier.
3194 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus