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.
28 #include <linux/bitfield.h>
29 #include <linux/bits.h>
32 * DOC: The i915 register macro definition style guide
34 * Follow the style described here for new macros, and while changing existing
35 * macros. Do **not** mass change existing definitions just to update the style.
40 * Keep helper macros near the top. For example, _PIPE() and friends.
42 * Prefix macros that generally should not be used outside of this file with
43 * underscore '_'. For example, _PIPE() and friends, single instances of
44 * registers that are defined solely for the use by function-like macros.
46 * Avoid using the underscore prefixed macros outside of this file. There are
47 * exceptions, but keep them to a minimum.
49 * There are two basic types of register definitions: Single registers and
50 * register groups. Register groups are registers which have two or more
51 * instances, for example one per pipe, port, transcoder, etc. Register groups
52 * should be defined using function-like macros.
54 * For single registers, define the register offset first, followed by register
57 * For register groups, define the register instance offsets first, prefixed
58 * with underscore, followed by a function-like macro choosing the right
59 * instance based on the parameter, followed by register contents.
61 * Define the register contents (i.e. bit and bit field macros) from most
62 * significant to least significant bit. Indent the register content macros
63 * using two extra spaces between ``#define`` and the macro name.
65 * Define bit fields using ``REG_GENMASK(h, l)``. Define bit field contents
66 * using ``REG_FIELD_PREP(mask, value)``. This will define the values already
67 * shifted in place, so they can be directly OR'd together. For convenience,
68 * function-like macros may be used to define bit fields, but do note that the
69 * macros may be needed to read as well as write the register contents.
71 * Define bits using ``REG_BIT(N)``. Do **not** add ``_BIT`` suffix to the name.
73 * Group the register and its contents together without blank lines, separate
74 * from other registers and their contents with one blank line.
76 * Indent macro values from macro names using TABs. Align values vertically. Use
77 * braces in macro values as needed to avoid unintended precedence after macro
78 * substitution. Use spaces in macro values according to kernel coding
79 * style. Use lower case in hexadecimal values.
84 * Try to name registers according to the specs. If the register name changes in
85 * the specs from platform to another, stick to the original name.
87 * Try to re-use existing register macro definitions. Only add new macros for
88 * new register offsets, or when the register contents have changed enough to
89 * warrant a full redefinition.
91 * When a register macro changes for a new platform, prefix the new macro using
92 * the platform acronym or generation. For example, ``SKL_`` or ``GEN8_``. The
93 * prefix signifies the start platform/generation using the register.
95 * When a bit (field) macro changes or gets added for a new platform, while
96 * retaining the existing register macro, add a platform acronym or generation
97 * suffix to the name. For example, ``_SKL`` or ``_GEN8``.
102 * (Note that the values in the example are indented using spaces instead of
103 * TABs to avoid misalignment in generated documentation. Use TABs in the
106 * #define _FOO_A 0xf000
107 * #define _FOO_B 0xf001
108 * #define FOO(pipe) _MMIO_PIPE(pipe, _FOO_A, _FOO_B)
109 * #define FOO_ENABLE REG_BIT(31)
110 * #define FOO_MODE_MASK REG_GENMASK(19, 16)
111 * #define FOO_MODE_BAR REG_FIELD_PREP(FOO_MODE_MASK, 0)
112 * #define FOO_MODE_BAZ REG_FIELD_PREP(FOO_MODE_MASK, 1)
113 * #define FOO_MODE_QUX_SNB REG_FIELD_PREP(FOO_MODE_MASK, 2)
115 * #define BAR _MMIO(0xb000)
116 * #define GEN8_BAR _MMIO(0xb888)
120 * REG_BIT() - Prepare a u32 bit value
121 * @__n: 0-based bit number
123 * Local wrapper for BIT() to force u32, with compile time checks.
125 * @return: Value with bit @__n set.
127 #define REG_BIT(__n) \
129 BUILD_BUG_ON_ZERO(__is_constexpr(__n) && \
130 ((__n) < 0 || (__n) > 31))))
133 * REG_GENMASK() - Prepare a continuous u32 bitmask
134 * @__high: 0-based high bit
135 * @__low: 0-based low bit
137 * Local wrapper for GENMASK() to force u32, with compile time checks.
139 * @return: Continuous bitmask from @__high to @__low, inclusive.
141 #define REG_GENMASK(__high, __low) \
142 ((u32)(GENMASK(__high, __low) + \
143 BUILD_BUG_ON_ZERO(__is_constexpr(__high) && \
144 __is_constexpr(__low) && \
145 ((__low) < 0 || (__high) > 31 || (__low) > (__high)))))
148 * Local integer constant expression version of is_power_of_2().
150 #define IS_POWER_OF_2(__x) ((__x) && (((__x) & ((__x) - 1)) == 0))
153 * REG_FIELD_PREP() - Prepare a u32 bitfield value
154 * @__mask: shifted mask defining the field's length and position
155 * @__val: value to put in the field
157 * Local copy of FIELD_PREP() to generate an integer constant expression, force
158 * u32 and for consistency with REG_FIELD_GET(), REG_BIT() and REG_GENMASK().
160 * @return: @__val masked and shifted into the field defined by @__mask.
162 #define REG_FIELD_PREP(__mask, __val) \
163 ((u32)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) + \
164 BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) + \
165 BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U32_MAX) + \
166 BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
167 BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
170 * REG_FIELD_GET() - Extract a u32 bitfield value
171 * @__mask: shifted mask defining the field's length and position
172 * @__val: value to extract the bitfield value from
174 * Local wrapper for FIELD_GET() to force u32 and for consistency with
175 * REG_FIELD_PREP(), REG_BIT() and REG_GENMASK().
177 * @return: Masked and shifted value of the field defined by @__mask in @__val.
179 #define REG_FIELD_GET(__mask, __val) ((u32)FIELD_GET(__mask, __val))
185 #define _MMIO(r) ((const i915_reg_t){ .reg = (r) })
187 #define INVALID_MMIO_REG _MMIO(0)
189 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
194 static inline bool i915_mmio_reg_equal(i915_reg_t a, i915_reg_t b)
196 return i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b);
199 static inline bool i915_mmio_reg_valid(i915_reg_t reg)
201 return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
204 #define VLV_DISPLAY_BASE 0x180000
205 #define VLV_MIPI_BASE VLV_DISPLAY_BASE
206 #define BXT_MIPI_BASE 0x60000
208 #define DISPLAY_MMIO_BASE(dev_priv) (INTEL_INFO(dev_priv)->display_mmio_offset)
211 * Given the first two numbers __a and __b of arbitrarily many evenly spaced
212 * numbers, pick the 0-based __index'th value.
214 * Always prefer this over _PICK() if the numbers are evenly spaced.
216 #define _PICK_EVEN(__index, __a, __b) ((__a) + (__index) * ((__b) - (__a)))
219 * Given the arbitrary numbers in varargs, pick the 0-based __index'th number.
221 * Always prefer _PICK_EVEN() over this if the numbers are evenly spaced.
223 #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
226 * Named helper wrappers around _PICK_EVEN() and _PICK().
228 #define _PIPE(pipe, a, b) _PICK_EVEN(pipe, a, b)
229 #define _PLANE(plane, a, b) _PICK_EVEN(plane, a, b)
230 #define _TRANS(tran, a, b) _PICK_EVEN(tran, a, b)
231 #define _PORT(port, a, b) _PICK_EVEN(port, a, b)
232 #define _PLL(pll, a, b) _PICK_EVEN(pll, a, b)
233 #define _PHY(phy, a, b) _PICK_EVEN(phy, a, b)
235 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
236 #define _MMIO_PLANE(plane, a, b) _MMIO(_PLANE(plane, a, b))
237 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
238 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
239 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
240 #define _MMIO_PHY(phy, a, b) _MMIO(_PHY(phy, a, b))
242 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
244 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
245 #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
246 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
247 #define _MMIO_PLL3(pll, ...) _MMIO(_PICK(pll, __VA_ARGS__))
251 * Device info offset array based helpers for groups of registers with unevenly
252 * spaced base offsets.
254 #define _MMIO_PIPE2(pipe, reg) _MMIO(INTEL_INFO(dev_priv)->pipe_offsets[pipe] - \
255 INTEL_INFO(dev_priv)->pipe_offsets[PIPE_A] + (reg) + \
256 DISPLAY_MMIO_BASE(dev_priv))
257 #define _TRANS2(tran, reg) (INTEL_INFO(dev_priv)->trans_offsets[(tran)] - \
258 INTEL_INFO(dev_priv)->trans_offsets[TRANSCODER_A] + (reg) + \
259 DISPLAY_MMIO_BASE(dev_priv))
260 #define _MMIO_TRANS2(tran, reg) _MMIO(_TRANS2(tran, reg))
261 #define _CURSOR2(pipe, reg) _MMIO(INTEL_INFO(dev_priv)->cursor_offsets[(pipe)] - \
262 INTEL_INFO(dev_priv)->cursor_offsets[PIPE_A] + (reg) + \
263 DISPLAY_MMIO_BASE(dev_priv))
265 #define __MASKED_FIELD(mask, value) ((mask) << 16 | (value))
266 #define _MASKED_FIELD(mask, value) ({ \
267 if (__builtin_constant_p(mask)) \
268 BUILD_BUG_ON_MSG(((mask) & 0xffff0000), "Incorrect mask"); \
269 if (__builtin_constant_p(value)) \
270 BUILD_BUG_ON_MSG((value) & 0xffff0000, "Incorrect value"); \
271 if (__builtin_constant_p(mask) && __builtin_constant_p(value)) \
272 BUILD_BUG_ON_MSG((value) & ~(mask), \
273 "Incorrect value for mask"); \
274 __MASKED_FIELD(mask, value); })
275 #define _MASKED_BIT_ENABLE(a) ({ typeof(a) _a = (a); _MASKED_FIELD(_a, _a); })
276 #define _MASKED_BIT_DISABLE(a) (_MASKED_FIELD((a), 0))
278 /* PCI config space */
280 #define MCHBAR_I915 0x44
281 #define MCHBAR_I965 0x48
282 #define MCHBAR_SIZE (4 * 4096)
285 #define DEVEN_MCHBAR_EN (1 << 28)
287 /* BSM in include/drm/i915_drm.h */
289 #define HPLLCC 0xc0 /* 85x only */
290 #define GC_CLOCK_CONTROL_MASK (0x7 << 0)
291 #define GC_CLOCK_133_200 (0 << 0)
292 #define GC_CLOCK_100_200 (1 << 0)
293 #define GC_CLOCK_100_133 (2 << 0)
294 #define GC_CLOCK_133_266 (3 << 0)
295 #define GC_CLOCK_133_200_2 (4 << 0)
296 #define GC_CLOCK_133_266_2 (5 << 0)
297 #define GC_CLOCK_166_266 (6 << 0)
298 #define GC_CLOCK_166_250 (7 << 0)
300 #define I915_GDRST 0xc0 /* PCI config register */
301 #define GRDOM_FULL (0 << 2)
302 #define GRDOM_RENDER (1 << 2)
303 #define GRDOM_MEDIA (3 << 2)
304 #define GRDOM_MASK (3 << 2)
305 #define GRDOM_RESET_STATUS (1 << 1)
306 #define GRDOM_RESET_ENABLE (1 << 0)
308 /* BSpec only has register offset, PCI device and bit found empirically */
309 #define I830_CLOCK_GATE 0xc8 /* device 0 */
310 #define I830_L2_CACHE_CLOCK_GATE_DISABLE (1 << 2)
312 #define GCDGMBUS 0xcc
315 #define GCFGC 0xf0 /* 915+ only */
316 #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
317 #define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
318 #define GC_DISPLAY_CLOCK_333_320_MHZ (4 << 4)
319 #define GC_DISPLAY_CLOCK_267_MHZ_PNV (0 << 4)
320 #define GC_DISPLAY_CLOCK_333_MHZ_PNV (1 << 4)
321 #define GC_DISPLAY_CLOCK_444_MHZ_PNV (2 << 4)
322 #define GC_DISPLAY_CLOCK_200_MHZ_PNV (5 << 4)
323 #define GC_DISPLAY_CLOCK_133_MHZ_PNV (6 << 4)
324 #define GC_DISPLAY_CLOCK_167_MHZ_PNV (7 << 4)
325 #define GC_DISPLAY_CLOCK_MASK (7 << 4)
326 #define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
327 #define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)
328 #define GM45_GC_RENDER_CLOCK_320_MHZ (9 << 0)
329 #define GM45_GC_RENDER_CLOCK_400_MHZ (0xb << 0)
330 #define GM45_GC_RENDER_CLOCK_533_MHZ (0xc << 0)
331 #define I965_GC_RENDER_CLOCK_MASK (0xf << 0)
332 #define I965_GC_RENDER_CLOCK_267_MHZ (2 << 0)
333 #define I965_GC_RENDER_CLOCK_333_MHZ (3 << 0)
334 #define I965_GC_RENDER_CLOCK_444_MHZ (4 << 0)
335 #define I965_GC_RENDER_CLOCK_533_MHZ (5 << 0)
336 #define I945_GC_RENDER_CLOCK_MASK (7 << 0)
337 #define I945_GC_RENDER_CLOCK_166_MHZ (0 << 0)
338 #define I945_GC_RENDER_CLOCK_200_MHZ (1 << 0)
339 #define I945_GC_RENDER_CLOCK_250_MHZ (3 << 0)
340 #define I945_GC_RENDER_CLOCK_400_MHZ (5 << 0)
341 #define I915_GC_RENDER_CLOCK_MASK (7 << 0)
342 #define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
343 #define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
344 #define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
350 #define SWSCI_SCISEL (1 << 15)
351 #define SWSCI_GSSCIE (1 << 0)
353 #define LBPC 0xf4 /* legacy/combination backlight modes, also called LBB */
356 #define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)
357 #define ILK_GRDOM_FULL (0 << 1)
358 #define ILK_GRDOM_RENDER (1 << 1)
359 #define ILK_GRDOM_MEDIA (3 << 1)
360 #define ILK_GRDOM_MASK (3 << 1)
361 #define ILK_GRDOM_RESET_ENABLE (1 << 0)
363 #define GEN6_MBCUNIT_SNPCR _MMIO(0x900c) /* for LLC config */
364 #define GEN6_MBC_SNPCR_SHIFT 21
365 #define GEN6_MBC_SNPCR_MASK (3 << 21)
366 #define GEN6_MBC_SNPCR_MAX (0 << 21)
367 #define GEN6_MBC_SNPCR_MED (1 << 21)
368 #define GEN6_MBC_SNPCR_LOW (2 << 21)
369 #define GEN6_MBC_SNPCR_MIN (3 << 21) /* only 1/16th of the cache is shared */
371 #define VLV_G3DCTL _MMIO(0x9024)
372 #define VLV_GSCKGCTL _MMIO(0x9028)
374 #define GEN6_MBCTL _MMIO(0x0907c)
375 #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4)
376 #define GEN6_MBCTL_CTX_FETCH_NEEDED (1 << 3)
377 #define GEN6_MBCTL_BME_UPDATE_ENABLE (1 << 2)
378 #define GEN6_MBCTL_MAE_UPDATE_ENABLE (1 << 1)
379 #define GEN6_MBCTL_BOOT_FETCH_MECH (1 << 0)
381 #define GEN6_GDRST _MMIO(0x941c)
382 #define GEN6_GRDOM_FULL (1 << 0)
383 #define GEN6_GRDOM_RENDER (1 << 1)
384 #define GEN6_GRDOM_MEDIA (1 << 2)
385 #define GEN6_GRDOM_BLT (1 << 3)
386 #define GEN6_GRDOM_VECS (1 << 4)
387 #define GEN9_GRDOM_GUC (1 << 5)
388 #define GEN8_GRDOM_MEDIA2 (1 << 7)
389 /* GEN11 changed all bit defs except for FULL & RENDER */
390 #define GEN11_GRDOM_FULL GEN6_GRDOM_FULL
391 #define GEN11_GRDOM_RENDER GEN6_GRDOM_RENDER
392 #define GEN11_GRDOM_BLT (1 << 2)
393 #define GEN11_GRDOM_GUC (1 << 3)
394 #define GEN11_GRDOM_MEDIA (1 << 5)
395 #define GEN11_GRDOM_MEDIA2 (1 << 6)
396 #define GEN11_GRDOM_MEDIA3 (1 << 7)
397 #define GEN11_GRDOM_MEDIA4 (1 << 8)
398 #define GEN11_GRDOM_MEDIA5 (1 << 9)
399 #define GEN11_GRDOM_MEDIA6 (1 << 10)
400 #define GEN11_GRDOM_MEDIA7 (1 << 11)
401 #define GEN11_GRDOM_MEDIA8 (1 << 12)
402 #define GEN11_GRDOM_VECS (1 << 13)
403 #define GEN11_GRDOM_VECS2 (1 << 14)
404 #define GEN11_GRDOM_VECS3 (1 << 15)
405 #define GEN11_GRDOM_VECS4 (1 << 16)
406 #define GEN11_GRDOM_SFC0 (1 << 17)
407 #define GEN11_GRDOM_SFC1 (1 << 18)
408 #define GEN11_GRDOM_SFC2 (1 << 19)
409 #define GEN11_GRDOM_SFC3 (1 << 20)
411 #define GEN11_VCS_SFC_RESET_BIT(instance) (GEN11_GRDOM_SFC0 << ((instance) >> 1))
412 #define GEN11_VECS_SFC_RESET_BIT(instance) (GEN11_GRDOM_SFC0 << (instance))
414 #define GEN11_VCS_SFC_FORCED_LOCK(engine) _MMIO((engine)->mmio_base + 0x88C)
415 #define GEN11_VCS_SFC_FORCED_LOCK_BIT (1 << 0)
416 #define GEN11_VCS_SFC_LOCK_STATUS(engine) _MMIO((engine)->mmio_base + 0x890)
417 #define GEN11_VCS_SFC_USAGE_BIT (1 << 0)
418 #define GEN11_VCS_SFC_LOCK_ACK_BIT (1 << 1)
420 #define GEN11_VECS_SFC_FORCED_LOCK(engine) _MMIO((engine)->mmio_base + 0x201C)
421 #define GEN11_VECS_SFC_FORCED_LOCK_BIT (1 << 0)
422 #define GEN11_VECS_SFC_LOCK_ACK(engine) _MMIO((engine)->mmio_base + 0x2018)
423 #define GEN11_VECS_SFC_LOCK_ACK_BIT (1 << 0)
424 #define GEN11_VECS_SFC_USAGE(engine) _MMIO((engine)->mmio_base + 0x2014)
425 #define GEN11_VECS_SFC_USAGE_BIT (1 << 0)
427 #define GEN12_HCP_SFC_FORCED_LOCK(engine) _MMIO((engine)->mmio_base + 0x2910)
428 #define GEN12_HCP_SFC_FORCED_LOCK_BIT REG_BIT(0)
429 #define GEN12_HCP_SFC_LOCK_STATUS(engine) _MMIO((engine)->mmio_base + 0x2914)
430 #define GEN12_HCP_SFC_LOCK_ACK_BIT REG_BIT(1)
431 #define GEN12_HCP_SFC_USAGE_BIT REG_BIT(0)
433 #define GEN12_SFC_DONE(n) _MMIO(0x1cc000 + (n) * 0x1000)
434 #define GEN12_SFC_DONE_MAX 4
436 #define RING_PP_DIR_BASE(base) _MMIO((base) + 0x228)
437 #define RING_PP_DIR_BASE_READ(base) _MMIO((base) + 0x518)
438 #define RING_PP_DIR_DCLV(base) _MMIO((base) + 0x220)
439 #define PP_DIR_DCLV_2G 0xffffffff
441 #define GEN8_RING_PDP_UDW(base, n) _MMIO((base) + 0x270 + (n) * 8 + 4)
442 #define GEN8_RING_PDP_LDW(base, n) _MMIO((base) + 0x270 + (n) * 8)
444 #define GEN8_R_PWR_CLK_STATE _MMIO(0x20C8)
445 #define GEN8_RPCS_ENABLE (1 << 31)
446 #define GEN8_RPCS_S_CNT_ENABLE (1 << 18)
447 #define GEN8_RPCS_S_CNT_SHIFT 15
448 #define GEN8_RPCS_S_CNT_MASK (0x7 << GEN8_RPCS_S_CNT_SHIFT)
449 #define GEN11_RPCS_S_CNT_SHIFT 12
450 #define GEN11_RPCS_S_CNT_MASK (0x3f << GEN11_RPCS_S_CNT_SHIFT)
451 #define GEN8_RPCS_SS_CNT_ENABLE (1 << 11)
452 #define GEN8_RPCS_SS_CNT_SHIFT 8
453 #define GEN8_RPCS_SS_CNT_MASK (0x7 << GEN8_RPCS_SS_CNT_SHIFT)
454 #define GEN8_RPCS_EU_MAX_SHIFT 4
455 #define GEN8_RPCS_EU_MAX_MASK (0xf << GEN8_RPCS_EU_MAX_SHIFT)
456 #define GEN8_RPCS_EU_MIN_SHIFT 0
457 #define GEN8_RPCS_EU_MIN_MASK (0xf << GEN8_RPCS_EU_MIN_SHIFT)
459 #define WAIT_FOR_RC6_EXIT _MMIO(0x20CC)
461 #define HSW_SELECTIVE_READ_ADDRESSING_SHIFT 2
462 #define HSW_SELECTIVE_READ_ADDRESSING_MASK (0x3 << HSW_SLECTIVE_READ_ADDRESSING_SHIFT)
463 #define HSW_SELECTIVE_WRITE_ADDRESS_SHIFT 4
464 #define HSW_SELECTIVE_WRITE_ADDRESS_MASK (0x7 << HSW_SELECTIVE_WRITE_ADDRESS_SHIFT)
466 #define HSW_WAIT_FOR_RC6_EXIT_ENABLE (1 << 0)
467 #define HSW_RCS_CONTEXT_ENABLE (1 << 7)
468 #define HSW_RCS_INHIBIT (1 << 8)
470 #define GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT 4
471 #define GEN8_SELECTIVE_WRITE_ADDRESS_MASK (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
472 #define GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT 4
473 #define GEN8_SELECTIVE_WRITE_ADDRESS_MASK (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
474 #define GEN8_SELECTIVE_WRITE_ADDRESSING_ENABLE (1 << 6)
475 #define GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT 9
476 #define GEN8_SELECTIVE_READ_SUBSLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT)
477 #define GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT 11
478 #define GEN8_SELECTIVE_READ_SLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT)
479 #define GEN8_SELECTIVE_READ_ADDRESSING_ENABLE (1 << 13)
481 #define GAM_ECOCHK _MMIO(0x4090)
482 #define BDW_DISABLE_HDC_INVALIDATION (1 << 25)
483 #define ECOCHK_SNB_BIT (1 << 10)
484 #define ECOCHK_DIS_TLB (1 << 8)
485 #define HSW_ECOCHK_ARB_PRIO_SOL (1 << 6)
486 #define ECOCHK_PPGTT_CACHE64B (0x3 << 3)
487 #define ECOCHK_PPGTT_CACHE4B (0x0 << 3)
488 #define ECOCHK_PPGTT_GFDT_IVB (0x1 << 4)
489 #define ECOCHK_PPGTT_LLC_IVB (0x1 << 3)
490 #define ECOCHK_PPGTT_UC_HSW (0x1 << 3)
491 #define ECOCHK_PPGTT_WT_HSW (0x2 << 3)
492 #define ECOCHK_PPGTT_WB_HSW (0x3 << 3)
494 #define GEN8_RC6_CTX_INFO _MMIO(0x8504)
496 #define GAC_ECO_BITS _MMIO(0x14090)
497 #define ECOBITS_SNB_BIT (1 << 13)
498 #define ECOBITS_PPGTT_CACHE64B (3 << 8)
499 #define ECOBITS_PPGTT_CACHE4B (0 << 8)
501 #define GEN12_GAMCNTRL_CTRL _MMIO(0xcf54)
502 #define INVALIDATION_BROADCAST_MODE_DIS REG_BIT(12)
503 #define GLOBAL_INVALIDATION_MODE REG_BIT(2)
505 #define GEN12_GAMSTLB_CTRL _MMIO(0xcf4c)
506 #define CONTROL_BLOCK_CLKGATE_DIS REG_BIT(12)
507 #define EGRESS_BLOCK_CLKGATE_DIS REG_BIT(11)
508 #define TAG_BLOCK_CLKGATE_DIS REG_BIT(7)
510 #define GEN12_MERT_MOD_CTRL _MMIO(0xcf28)
511 #define FORCE_MISS_FTLB REG_BIT(3)
513 #define GAB_CTL _MMIO(0x24000)
514 #define GAB_CTL_CONT_AFTER_PAGEFAULT (1 << 8)
516 #define GU_CNTL _MMIO(0x101010)
517 #define LMEM_INIT REG_BIT(7)
519 #define GEN6_STOLEN_RESERVED _MMIO(0x1082C0)
520 #define GEN6_STOLEN_RESERVED_ADDR_MASK (0xFFF << 20)
521 #define GEN7_STOLEN_RESERVED_ADDR_MASK (0x3FFF << 18)
522 #define GEN6_STOLEN_RESERVED_SIZE_MASK (3 << 4)
523 #define GEN6_STOLEN_RESERVED_1M (0 << 4)
524 #define GEN6_STOLEN_RESERVED_512K (1 << 4)
525 #define GEN6_STOLEN_RESERVED_256K (2 << 4)
526 #define GEN6_STOLEN_RESERVED_128K (3 << 4)
527 #define GEN7_STOLEN_RESERVED_SIZE_MASK (1 << 5)
528 #define GEN7_STOLEN_RESERVED_1M (0 << 5)
529 #define GEN7_STOLEN_RESERVED_256K (1 << 5)
530 #define GEN8_STOLEN_RESERVED_SIZE_MASK (3 << 7)
531 #define GEN8_STOLEN_RESERVED_1M (0 << 7)
532 #define GEN8_STOLEN_RESERVED_2M (1 << 7)
533 #define GEN8_STOLEN_RESERVED_4M (2 << 7)
534 #define GEN8_STOLEN_RESERVED_8M (3 << 7)
535 #define GEN6_STOLEN_RESERVED_ENABLE (1 << 0)
536 #define GEN11_STOLEN_RESERVED_ADDR_MASK (0xFFFFFFFFFFFULL << 20)
540 #define VGA_ST01_MDA 0x3ba
541 #define VGA_ST01_CGA 0x3da
543 #define _VGA_MSR_WRITE _MMIO(0x3c2)
544 #define VGA_MSR_WRITE 0x3c2
545 #define VGA_MSR_READ 0x3cc
546 #define VGA_MSR_MEM_EN (1 << 1)
547 #define VGA_MSR_CGA_MODE (1 << 0)
549 #define VGA_SR_INDEX 0x3c4
551 #define VGA_SR_DATA 0x3c5
553 #define VGA_AR_INDEX 0x3c0
554 #define VGA_AR_VID_EN (1 << 5)
555 #define VGA_AR_DATA_WRITE 0x3c0
556 #define VGA_AR_DATA_READ 0x3c1
558 #define VGA_GR_INDEX 0x3ce
559 #define VGA_GR_DATA 0x3cf
561 #define VGA_GR_MEM_READ_MODE_SHIFT 3
562 #define VGA_GR_MEM_READ_MODE_PLANE 1
564 #define VGA_GR_MEM_MODE_MASK 0xc
565 #define VGA_GR_MEM_MODE_SHIFT 2
566 #define VGA_GR_MEM_A0000_AFFFF 0
567 #define VGA_GR_MEM_A0000_BFFFF 1
568 #define VGA_GR_MEM_B0000_B7FFF 2
569 #define VGA_GR_MEM_B0000_BFFFF 3
571 #define VGA_DACMASK 0x3c6
572 #define VGA_DACRX 0x3c7
573 #define VGA_DACWX 0x3c8
574 #define VGA_DACDATA 0x3c9
576 #define VGA_CR_INDEX_MDA 0x3b4
577 #define VGA_CR_DATA_MDA 0x3b5
578 #define VGA_CR_INDEX_CGA 0x3d4
579 #define VGA_CR_DATA_CGA 0x3d5
581 #define MI_PREDICATE_SRC0 _MMIO(0x2400)
582 #define MI_PREDICATE_SRC0_UDW _MMIO(0x2400 + 4)
583 #define MI_PREDICATE_SRC1 _MMIO(0x2408)
584 #define MI_PREDICATE_SRC1_UDW _MMIO(0x2408 + 4)
585 #define MI_PREDICATE_DATA _MMIO(0x2410)
586 #define MI_PREDICATE_RESULT _MMIO(0x2418)
587 #define MI_PREDICATE_RESULT_1 _MMIO(0x241c)
588 #define MI_PREDICATE_RESULT_2 _MMIO(0x2214)
589 #define LOWER_SLICE_ENABLED (1 << 0)
590 #define LOWER_SLICE_DISABLED (0 << 0)
593 * Registers used only by the command parser
595 #define BCS_SWCTRL _MMIO(0x22200)
596 #define BCS_SRC_Y REG_BIT(0)
597 #define BCS_DST_Y REG_BIT(1)
599 /* There are 16 GPR registers */
600 #define BCS_GPR(n) _MMIO(0x22600 + (n) * 8)
601 #define BCS_GPR_UDW(n) _MMIO(0x22600 + (n) * 8 + 4)
603 #define GPGPU_THREADS_DISPATCHED _MMIO(0x2290)
604 #define GPGPU_THREADS_DISPATCHED_UDW _MMIO(0x2290 + 4)
605 #define HS_INVOCATION_COUNT _MMIO(0x2300)
606 #define HS_INVOCATION_COUNT_UDW _MMIO(0x2300 + 4)
607 #define DS_INVOCATION_COUNT _MMIO(0x2308)
608 #define DS_INVOCATION_COUNT_UDW _MMIO(0x2308 + 4)
609 #define IA_VERTICES_COUNT _MMIO(0x2310)
610 #define IA_VERTICES_COUNT_UDW _MMIO(0x2310 + 4)
611 #define IA_PRIMITIVES_COUNT _MMIO(0x2318)
612 #define IA_PRIMITIVES_COUNT_UDW _MMIO(0x2318 + 4)
613 #define VS_INVOCATION_COUNT _MMIO(0x2320)
614 #define VS_INVOCATION_COUNT_UDW _MMIO(0x2320 + 4)
615 #define GS_INVOCATION_COUNT _MMIO(0x2328)
616 #define GS_INVOCATION_COUNT_UDW _MMIO(0x2328 + 4)
617 #define GS_PRIMITIVES_COUNT _MMIO(0x2330)
618 #define GS_PRIMITIVES_COUNT_UDW _MMIO(0x2330 + 4)
619 #define CL_INVOCATION_COUNT _MMIO(0x2338)
620 #define CL_INVOCATION_COUNT_UDW _MMIO(0x2338 + 4)
621 #define CL_PRIMITIVES_COUNT _MMIO(0x2340)
622 #define CL_PRIMITIVES_COUNT_UDW _MMIO(0x2340 + 4)
623 #define PS_INVOCATION_COUNT _MMIO(0x2348)
624 #define PS_INVOCATION_COUNT_UDW _MMIO(0x2348 + 4)
625 #define PS_DEPTH_COUNT _MMIO(0x2350)
626 #define PS_DEPTH_COUNT_UDW _MMIO(0x2350 + 4)
628 /* There are the 4 64-bit counter registers, one for each stream output */
629 #define GEN7_SO_NUM_PRIMS_WRITTEN(n) _MMIO(0x5200 + (n) * 8)
630 #define GEN7_SO_NUM_PRIMS_WRITTEN_UDW(n) _MMIO(0x5200 + (n) * 8 + 4)
632 #define GEN7_SO_PRIM_STORAGE_NEEDED(n) _MMIO(0x5240 + (n) * 8)
633 #define GEN7_SO_PRIM_STORAGE_NEEDED_UDW(n) _MMIO(0x5240 + (n) * 8 + 4)
635 #define GEN7_3DPRIM_END_OFFSET _MMIO(0x2420)
636 #define GEN7_3DPRIM_START_VERTEX _MMIO(0x2430)
637 #define GEN7_3DPRIM_VERTEX_COUNT _MMIO(0x2434)
638 #define GEN7_3DPRIM_INSTANCE_COUNT _MMIO(0x2438)
639 #define GEN7_3DPRIM_START_INSTANCE _MMIO(0x243C)
640 #define GEN7_3DPRIM_BASE_VERTEX _MMIO(0x2440)
642 #define GEN7_GPGPU_DISPATCHDIMX _MMIO(0x2500)
643 #define GEN7_GPGPU_DISPATCHDIMY _MMIO(0x2504)
644 #define GEN7_GPGPU_DISPATCHDIMZ _MMIO(0x2508)
646 /* There are the 16 64-bit CS General Purpose Registers */
647 #define HSW_CS_GPR(n) _MMIO(0x2600 + (n) * 8)
648 #define HSW_CS_GPR_UDW(n) _MMIO(0x2600 + (n) * 8 + 4)
650 #define GEN7_OACONTROL _MMIO(0x2360)
651 #define GEN7_OACONTROL_CTX_MASK 0xFFFFF000
652 #define GEN7_OACONTROL_TIMER_PERIOD_MASK 0x3F
653 #define GEN7_OACONTROL_TIMER_PERIOD_SHIFT 6
654 #define GEN7_OACONTROL_TIMER_ENABLE (1 << 5)
655 #define GEN7_OACONTROL_FORMAT_A13 (0 << 2)
656 #define GEN7_OACONTROL_FORMAT_A29 (1 << 2)
657 #define GEN7_OACONTROL_FORMAT_A13_B8_C8 (2 << 2)
658 #define GEN7_OACONTROL_FORMAT_A29_B8_C8 (3 << 2)
659 #define GEN7_OACONTROL_FORMAT_B4_C8 (4 << 2)
660 #define GEN7_OACONTROL_FORMAT_A45_B8_C8 (5 << 2)
661 #define GEN7_OACONTROL_FORMAT_B4_C8_A16 (6 << 2)
662 #define GEN7_OACONTROL_FORMAT_C4_B8 (7 << 2)
663 #define GEN7_OACONTROL_FORMAT_SHIFT 2
664 #define GEN7_OACONTROL_PER_CTX_ENABLE (1 << 1)
665 #define GEN7_OACONTROL_ENABLE (1 << 0)
667 #define GEN8_OACTXID _MMIO(0x2364)
669 #define GEN8_OA_DEBUG _MMIO(0x2B04)
670 #define GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS (1 << 5)
671 #define GEN9_OA_DEBUG_INCLUDE_CLK_RATIO (1 << 6)
672 #define GEN9_OA_DEBUG_DISABLE_GO_1_0_REPORTS (1 << 2)
673 #define GEN9_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS (1 << 1)
675 #define GEN8_OACONTROL _MMIO(0x2B00)
676 #define GEN8_OA_REPORT_FORMAT_A12 (0 << 2)
677 #define GEN8_OA_REPORT_FORMAT_A12_B8_C8 (2 << 2)
678 #define GEN8_OA_REPORT_FORMAT_A36_B8_C8 (5 << 2)
679 #define GEN8_OA_REPORT_FORMAT_C4_B8 (7 << 2)
680 #define GEN8_OA_REPORT_FORMAT_SHIFT 2
681 #define GEN8_OA_SPECIFIC_CONTEXT_ENABLE (1 << 1)
682 #define GEN8_OA_COUNTER_ENABLE (1 << 0)
684 #define GEN8_OACTXCONTROL _MMIO(0x2360)
685 #define GEN8_OA_TIMER_PERIOD_MASK 0x3F
686 #define GEN8_OA_TIMER_PERIOD_SHIFT 2
687 #define GEN8_OA_TIMER_ENABLE (1 << 1)
688 #define GEN8_OA_COUNTER_RESUME (1 << 0)
690 #define GEN7_OABUFFER _MMIO(0x23B0) /* R/W */
691 #define GEN7_OABUFFER_OVERRUN_DISABLE (1 << 3)
692 #define GEN7_OABUFFER_EDGE_TRIGGER (1 << 2)
693 #define GEN7_OABUFFER_STOP_RESUME_ENABLE (1 << 1)
694 #define GEN7_OABUFFER_RESUME (1 << 0)
696 #define GEN8_OABUFFER_UDW _MMIO(0x23b4)
697 #define GEN8_OABUFFER _MMIO(0x2b14)
698 #define GEN8_OABUFFER_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
700 #define GEN7_OASTATUS1 _MMIO(0x2364)
701 #define GEN7_OASTATUS1_TAIL_MASK 0xffffffc0
702 #define GEN7_OASTATUS1_COUNTER_OVERFLOW (1 << 2)
703 #define GEN7_OASTATUS1_OABUFFER_OVERFLOW (1 << 1)
704 #define GEN7_OASTATUS1_REPORT_LOST (1 << 0)
706 #define GEN7_OASTATUS2 _MMIO(0x2368)
707 #define GEN7_OASTATUS2_HEAD_MASK 0xffffffc0
708 #define GEN7_OASTATUS2_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
710 #define GEN8_OASTATUS _MMIO(0x2b08)
711 #define GEN8_OASTATUS_TAIL_POINTER_WRAP (1 << 17)
712 #define GEN8_OASTATUS_HEAD_POINTER_WRAP (1 << 16)
713 #define GEN8_OASTATUS_OVERRUN_STATUS (1 << 3)
714 #define GEN8_OASTATUS_COUNTER_OVERFLOW (1 << 2)
715 #define GEN8_OASTATUS_OABUFFER_OVERFLOW (1 << 1)
716 #define GEN8_OASTATUS_REPORT_LOST (1 << 0)
718 #define GEN8_OAHEADPTR _MMIO(0x2B0C)
719 #define GEN8_OAHEADPTR_MASK 0xffffffc0
720 #define GEN8_OATAILPTR _MMIO(0x2B10)
721 #define GEN8_OATAILPTR_MASK 0xffffffc0
723 #define OABUFFER_SIZE_128K (0 << 3)
724 #define OABUFFER_SIZE_256K (1 << 3)
725 #define OABUFFER_SIZE_512K (2 << 3)
726 #define OABUFFER_SIZE_1M (3 << 3)
727 #define OABUFFER_SIZE_2M (4 << 3)
728 #define OABUFFER_SIZE_4M (5 << 3)
729 #define OABUFFER_SIZE_8M (6 << 3)
730 #define OABUFFER_SIZE_16M (7 << 3)
732 #define GEN12_OA_TLB_INV_CR _MMIO(0xceec)
734 #define GEN12_SQCM _MMIO(0x8724)
735 #define EN_32B_ACCESS REG_BIT(30)
738 #define GEN12_OAR_OACONTROL _MMIO(0x2960)
739 #define GEN12_OAR_OACONTROL_COUNTER_FORMAT_SHIFT 1
740 #define GEN12_OAR_OACONTROL_COUNTER_ENABLE (1 << 0)
742 #define GEN12_OACTXCONTROL _MMIO(0x2360)
743 #define GEN12_OAR_OASTATUS _MMIO(0x2968)
746 #define GEN12_OAG_OAHEADPTR _MMIO(0xdb00)
747 #define GEN12_OAG_OAHEADPTR_MASK 0xffffffc0
748 #define GEN12_OAG_OATAILPTR _MMIO(0xdb04)
749 #define GEN12_OAG_OATAILPTR_MASK 0xffffffc0
751 #define GEN12_OAG_OABUFFER _MMIO(0xdb08)
752 #define GEN12_OAG_OABUFFER_BUFFER_SIZE_MASK (0x7)
753 #define GEN12_OAG_OABUFFER_BUFFER_SIZE_SHIFT (3)
754 #define GEN12_OAG_OABUFFER_MEMORY_SELECT (1 << 0) /* 0: PPGTT, 1: GGTT */
756 #define GEN12_OAG_OAGLBCTXCTRL _MMIO(0x2b28)
757 #define GEN12_OAG_OAGLBCTXCTRL_TIMER_PERIOD_SHIFT 2
758 #define GEN12_OAG_OAGLBCTXCTRL_TIMER_ENABLE (1 << 1)
759 #define GEN12_OAG_OAGLBCTXCTRL_COUNTER_RESUME (1 << 0)
761 #define GEN12_OAG_OACONTROL _MMIO(0xdaf4)
762 #define GEN12_OAG_OACONTROL_OA_COUNTER_FORMAT_SHIFT 2
763 #define GEN12_OAG_OACONTROL_OA_COUNTER_ENABLE (1 << 0)
765 #define GEN12_OAG_OA_DEBUG _MMIO(0xdaf8)
766 #define GEN12_OAG_OA_DEBUG_INCLUDE_CLK_RATIO (1 << 6)
767 #define GEN12_OAG_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS (1 << 5)
768 #define GEN12_OAG_OA_DEBUG_DISABLE_GO_1_0_REPORTS (1 << 2)
769 #define GEN12_OAG_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS (1 << 1)
771 #define GEN12_OAG_OASTATUS _MMIO(0xdafc)
772 #define GEN12_OAG_OASTATUS_COUNTER_OVERFLOW (1 << 2)
773 #define GEN12_OAG_OASTATUS_BUFFER_OVERFLOW (1 << 1)
774 #define GEN12_OAG_OASTATUS_REPORT_LOST (1 << 0)
777 * Flexible, Aggregate EU Counter Registers.
778 * Note: these aren't contiguous
780 #define EU_PERF_CNTL0 _MMIO(0xe458)
781 #define EU_PERF_CNTL1 _MMIO(0xe558)
782 #define EU_PERF_CNTL2 _MMIO(0xe658)
783 #define EU_PERF_CNTL3 _MMIO(0xe758)
784 #define EU_PERF_CNTL4 _MMIO(0xe45c)
785 #define EU_PERF_CNTL5 _MMIO(0xe55c)
786 #define EU_PERF_CNTL6 _MMIO(0xe65c)
788 #define RT_CTRL _MMIO(0xe530)
789 #define DIS_NULL_QUERY REG_BIT(10)
795 #define OASTARTTRIG1 _MMIO(0x2710)
796 #define OASTARTTRIG1_THRESHOLD_COUNT_MASK_MBZ 0xffff0000
797 #define OASTARTTRIG1_THRESHOLD_MASK 0xffff
799 #define OASTARTTRIG2 _MMIO(0x2714)
800 #define OASTARTTRIG2_INVERT_A_0 (1 << 0)
801 #define OASTARTTRIG2_INVERT_A_1 (1 << 1)
802 #define OASTARTTRIG2_INVERT_A_2 (1 << 2)
803 #define OASTARTTRIG2_INVERT_A_3 (1 << 3)
804 #define OASTARTTRIG2_INVERT_A_4 (1 << 4)
805 #define OASTARTTRIG2_INVERT_A_5 (1 << 5)
806 #define OASTARTTRIG2_INVERT_A_6 (1 << 6)
807 #define OASTARTTRIG2_INVERT_A_7 (1 << 7)
808 #define OASTARTTRIG2_INVERT_A_8 (1 << 8)
809 #define OASTARTTRIG2_INVERT_A_9 (1 << 9)
810 #define OASTARTTRIG2_INVERT_A_10 (1 << 10)
811 #define OASTARTTRIG2_INVERT_A_11 (1 << 11)
812 #define OASTARTTRIG2_INVERT_A_12 (1 << 12)
813 #define OASTARTTRIG2_INVERT_A_13 (1 << 13)
814 #define OASTARTTRIG2_INVERT_A_14 (1 << 14)
815 #define OASTARTTRIG2_INVERT_A_15 (1 << 15)
816 #define OASTARTTRIG2_INVERT_B_0 (1 << 16)
817 #define OASTARTTRIG2_INVERT_B_1 (1 << 17)
818 #define OASTARTTRIG2_INVERT_B_2 (1 << 18)
819 #define OASTARTTRIG2_INVERT_B_3 (1 << 19)
820 #define OASTARTTRIG2_INVERT_C_0 (1 << 20)
821 #define OASTARTTRIG2_INVERT_C_1 (1 << 21)
822 #define OASTARTTRIG2_INVERT_D_0 (1 << 22)
823 #define OASTARTTRIG2_THRESHOLD_ENABLE (1 << 23)
824 #define OASTARTTRIG2_START_TRIG_FLAG_MBZ (1 << 24)
825 #define OASTARTTRIG2_EVENT_SELECT_0 (1 << 28)
826 #define OASTARTTRIG2_EVENT_SELECT_1 (1 << 29)
827 #define OASTARTTRIG2_EVENT_SELECT_2 (1 << 30)
828 #define OASTARTTRIG2_EVENT_SELECT_3 (1 << 31)
830 #define OASTARTTRIG3 _MMIO(0x2718)
831 #define OASTARTTRIG3_NOA_SELECT_MASK 0xf
832 #define OASTARTTRIG3_NOA_SELECT_8_SHIFT 0
833 #define OASTARTTRIG3_NOA_SELECT_9_SHIFT 4
834 #define OASTARTTRIG3_NOA_SELECT_10_SHIFT 8
835 #define OASTARTTRIG3_NOA_SELECT_11_SHIFT 12
836 #define OASTARTTRIG3_NOA_SELECT_12_SHIFT 16
837 #define OASTARTTRIG3_NOA_SELECT_13_SHIFT 20
838 #define OASTARTTRIG3_NOA_SELECT_14_SHIFT 24
839 #define OASTARTTRIG3_NOA_SELECT_15_SHIFT 28
841 #define OASTARTTRIG4 _MMIO(0x271c)
842 #define OASTARTTRIG4_NOA_SELECT_MASK 0xf
843 #define OASTARTTRIG4_NOA_SELECT_0_SHIFT 0
844 #define OASTARTTRIG4_NOA_SELECT_1_SHIFT 4
845 #define OASTARTTRIG4_NOA_SELECT_2_SHIFT 8
846 #define OASTARTTRIG4_NOA_SELECT_3_SHIFT 12
847 #define OASTARTTRIG4_NOA_SELECT_4_SHIFT 16
848 #define OASTARTTRIG4_NOA_SELECT_5_SHIFT 20
849 #define OASTARTTRIG4_NOA_SELECT_6_SHIFT 24
850 #define OASTARTTRIG4_NOA_SELECT_7_SHIFT 28
852 #define OASTARTTRIG5 _MMIO(0x2720)
853 #define OASTARTTRIG5_THRESHOLD_COUNT_MASK_MBZ 0xffff0000
854 #define OASTARTTRIG5_THRESHOLD_MASK 0xffff
856 #define OASTARTTRIG6 _MMIO(0x2724)
857 #define OASTARTTRIG6_INVERT_A_0 (1 << 0)
858 #define OASTARTTRIG6_INVERT_A_1 (1 << 1)
859 #define OASTARTTRIG6_INVERT_A_2 (1 << 2)
860 #define OASTARTTRIG6_INVERT_A_3 (1 << 3)
861 #define OASTARTTRIG6_INVERT_A_4 (1 << 4)
862 #define OASTARTTRIG6_INVERT_A_5 (1 << 5)
863 #define OASTARTTRIG6_INVERT_A_6 (1 << 6)
864 #define OASTARTTRIG6_INVERT_A_7 (1 << 7)
865 #define OASTARTTRIG6_INVERT_A_8 (1 << 8)
866 #define OASTARTTRIG6_INVERT_A_9 (1 << 9)
867 #define OASTARTTRIG6_INVERT_A_10 (1 << 10)
868 #define OASTARTTRIG6_INVERT_A_11 (1 << 11)
869 #define OASTARTTRIG6_INVERT_A_12 (1 << 12)
870 #define OASTARTTRIG6_INVERT_A_13 (1 << 13)
871 #define OASTARTTRIG6_INVERT_A_14 (1 << 14)
872 #define OASTARTTRIG6_INVERT_A_15 (1 << 15)
873 #define OASTARTTRIG6_INVERT_B_0 (1 << 16)
874 #define OASTARTTRIG6_INVERT_B_1 (1 << 17)
875 #define OASTARTTRIG6_INVERT_B_2 (1 << 18)
876 #define OASTARTTRIG6_INVERT_B_3 (1 << 19)
877 #define OASTARTTRIG6_INVERT_C_0 (1 << 20)
878 #define OASTARTTRIG6_INVERT_C_1 (1 << 21)
879 #define OASTARTTRIG6_INVERT_D_0 (1 << 22)
880 #define OASTARTTRIG6_THRESHOLD_ENABLE (1 << 23)
881 #define OASTARTTRIG6_START_TRIG_FLAG_MBZ (1 << 24)
882 #define OASTARTTRIG6_EVENT_SELECT_4 (1 << 28)
883 #define OASTARTTRIG6_EVENT_SELECT_5 (1 << 29)
884 #define OASTARTTRIG6_EVENT_SELECT_6 (1 << 30)
885 #define OASTARTTRIG6_EVENT_SELECT_7 (1 << 31)
887 #define OASTARTTRIG7 _MMIO(0x2728)
888 #define OASTARTTRIG7_NOA_SELECT_MASK 0xf
889 #define OASTARTTRIG7_NOA_SELECT_8_SHIFT 0
890 #define OASTARTTRIG7_NOA_SELECT_9_SHIFT 4
891 #define OASTARTTRIG7_NOA_SELECT_10_SHIFT 8
892 #define OASTARTTRIG7_NOA_SELECT_11_SHIFT 12
893 #define OASTARTTRIG7_NOA_SELECT_12_SHIFT 16
894 #define OASTARTTRIG7_NOA_SELECT_13_SHIFT 20
895 #define OASTARTTRIG7_NOA_SELECT_14_SHIFT 24
896 #define OASTARTTRIG7_NOA_SELECT_15_SHIFT 28
898 #define OASTARTTRIG8 _MMIO(0x272c)
899 #define OASTARTTRIG8_NOA_SELECT_MASK 0xf
900 #define OASTARTTRIG8_NOA_SELECT_0_SHIFT 0
901 #define OASTARTTRIG8_NOA_SELECT_1_SHIFT 4
902 #define OASTARTTRIG8_NOA_SELECT_2_SHIFT 8
903 #define OASTARTTRIG8_NOA_SELECT_3_SHIFT 12
904 #define OASTARTTRIG8_NOA_SELECT_4_SHIFT 16
905 #define OASTARTTRIG8_NOA_SELECT_5_SHIFT 20
906 #define OASTARTTRIG8_NOA_SELECT_6_SHIFT 24
907 #define OASTARTTRIG8_NOA_SELECT_7_SHIFT 28
909 #define OAREPORTTRIG1 _MMIO(0x2740)
910 #define OAREPORTTRIG1_THRESHOLD_MASK 0xffff
911 #define OAREPORTTRIG1_EDGE_LEVEL_TRIGGER_SELECT_MASK 0xffff0000 /* 0=level */
913 #define OAREPORTTRIG2 _MMIO(0x2744)
914 #define OAREPORTTRIG2_INVERT_A_0 (1 << 0)
915 #define OAREPORTTRIG2_INVERT_A_1 (1 << 1)
916 #define OAREPORTTRIG2_INVERT_A_2 (1 << 2)
917 #define OAREPORTTRIG2_INVERT_A_3 (1 << 3)
918 #define OAREPORTTRIG2_INVERT_A_4 (1 << 4)
919 #define OAREPORTTRIG2_INVERT_A_5 (1 << 5)
920 #define OAREPORTTRIG2_INVERT_A_6 (1 << 6)
921 #define OAREPORTTRIG2_INVERT_A_7 (1 << 7)
922 #define OAREPORTTRIG2_INVERT_A_8 (1 << 8)
923 #define OAREPORTTRIG2_INVERT_A_9 (1 << 9)
924 #define OAREPORTTRIG2_INVERT_A_10 (1 << 10)
925 #define OAREPORTTRIG2_INVERT_A_11 (1 << 11)
926 #define OAREPORTTRIG2_INVERT_A_12 (1 << 12)
927 #define OAREPORTTRIG2_INVERT_A_13 (1 << 13)
928 #define OAREPORTTRIG2_INVERT_A_14 (1 << 14)
929 #define OAREPORTTRIG2_INVERT_A_15 (1 << 15)
930 #define OAREPORTTRIG2_INVERT_B_0 (1 << 16)
931 #define OAREPORTTRIG2_INVERT_B_1 (1 << 17)
932 #define OAREPORTTRIG2_INVERT_B_2 (1 << 18)
933 #define OAREPORTTRIG2_INVERT_B_3 (1 << 19)
934 #define OAREPORTTRIG2_INVERT_C_0 (1 << 20)
935 #define OAREPORTTRIG2_INVERT_C_1 (1 << 21)
936 #define OAREPORTTRIG2_INVERT_D_0 (1 << 22)
937 #define OAREPORTTRIG2_THRESHOLD_ENABLE (1 << 23)
938 #define OAREPORTTRIG2_REPORT_TRIGGER_ENABLE (1 << 31)
940 #define OAREPORTTRIG3 _MMIO(0x2748)
941 #define OAREPORTTRIG3_NOA_SELECT_MASK 0xf
942 #define OAREPORTTRIG3_NOA_SELECT_8_SHIFT 0
943 #define OAREPORTTRIG3_NOA_SELECT_9_SHIFT 4
944 #define OAREPORTTRIG3_NOA_SELECT_10_SHIFT 8
945 #define OAREPORTTRIG3_NOA_SELECT_11_SHIFT 12
946 #define OAREPORTTRIG3_NOA_SELECT_12_SHIFT 16
947 #define OAREPORTTRIG3_NOA_SELECT_13_SHIFT 20
948 #define OAREPORTTRIG3_NOA_SELECT_14_SHIFT 24
949 #define OAREPORTTRIG3_NOA_SELECT_15_SHIFT 28
951 #define OAREPORTTRIG4 _MMIO(0x274c)
952 #define OAREPORTTRIG4_NOA_SELECT_MASK 0xf
953 #define OAREPORTTRIG4_NOA_SELECT_0_SHIFT 0
954 #define OAREPORTTRIG4_NOA_SELECT_1_SHIFT 4
955 #define OAREPORTTRIG4_NOA_SELECT_2_SHIFT 8
956 #define OAREPORTTRIG4_NOA_SELECT_3_SHIFT 12
957 #define OAREPORTTRIG4_NOA_SELECT_4_SHIFT 16
958 #define OAREPORTTRIG4_NOA_SELECT_5_SHIFT 20
959 #define OAREPORTTRIG4_NOA_SELECT_6_SHIFT 24
960 #define OAREPORTTRIG4_NOA_SELECT_7_SHIFT 28
962 #define OAREPORTTRIG5 _MMIO(0x2750)
963 #define OAREPORTTRIG5_THRESHOLD_MASK 0xffff
964 #define OAREPORTTRIG5_EDGE_LEVEL_TRIGGER_SELECT_MASK 0xffff0000 /* 0=level */
966 #define OAREPORTTRIG6 _MMIO(0x2754)
967 #define OAREPORTTRIG6_INVERT_A_0 (1 << 0)
968 #define OAREPORTTRIG6_INVERT_A_1 (1 << 1)
969 #define OAREPORTTRIG6_INVERT_A_2 (1 << 2)
970 #define OAREPORTTRIG6_INVERT_A_3 (1 << 3)
971 #define OAREPORTTRIG6_INVERT_A_4 (1 << 4)
972 #define OAREPORTTRIG6_INVERT_A_5 (1 << 5)
973 #define OAREPORTTRIG6_INVERT_A_6 (1 << 6)
974 #define OAREPORTTRIG6_INVERT_A_7 (1 << 7)
975 #define OAREPORTTRIG6_INVERT_A_8 (1 << 8)
976 #define OAREPORTTRIG6_INVERT_A_9 (1 << 9)
977 #define OAREPORTTRIG6_INVERT_A_10 (1 << 10)
978 #define OAREPORTTRIG6_INVERT_A_11 (1 << 11)
979 #define OAREPORTTRIG6_INVERT_A_12 (1 << 12)
980 #define OAREPORTTRIG6_INVERT_A_13 (1 << 13)
981 #define OAREPORTTRIG6_INVERT_A_14 (1 << 14)
982 #define OAREPORTTRIG6_INVERT_A_15 (1 << 15)
983 #define OAREPORTTRIG6_INVERT_B_0 (1 << 16)
984 #define OAREPORTTRIG6_INVERT_B_1 (1 << 17)
985 #define OAREPORTTRIG6_INVERT_B_2 (1 << 18)
986 #define OAREPORTTRIG6_INVERT_B_3 (1 << 19)
987 #define OAREPORTTRIG6_INVERT_C_0 (1 << 20)
988 #define OAREPORTTRIG6_INVERT_C_1 (1 << 21)
989 #define OAREPORTTRIG6_INVERT_D_0 (1 << 22)
990 #define OAREPORTTRIG6_THRESHOLD_ENABLE (1 << 23)
991 #define OAREPORTTRIG6_REPORT_TRIGGER_ENABLE (1 << 31)
993 #define OAREPORTTRIG7 _MMIO(0x2758)
994 #define OAREPORTTRIG7_NOA_SELECT_MASK 0xf
995 #define OAREPORTTRIG7_NOA_SELECT_8_SHIFT 0
996 #define OAREPORTTRIG7_NOA_SELECT_9_SHIFT 4
997 #define OAREPORTTRIG7_NOA_SELECT_10_SHIFT 8
998 #define OAREPORTTRIG7_NOA_SELECT_11_SHIFT 12
999 #define OAREPORTTRIG7_NOA_SELECT_12_SHIFT 16
1000 #define OAREPORTTRIG7_NOA_SELECT_13_SHIFT 20
1001 #define OAREPORTTRIG7_NOA_SELECT_14_SHIFT 24
1002 #define OAREPORTTRIG7_NOA_SELECT_15_SHIFT 28
1004 #define OAREPORTTRIG8 _MMIO(0x275c)
1005 #define OAREPORTTRIG8_NOA_SELECT_MASK 0xf
1006 #define OAREPORTTRIG8_NOA_SELECT_0_SHIFT 0
1007 #define OAREPORTTRIG8_NOA_SELECT_1_SHIFT 4
1008 #define OAREPORTTRIG8_NOA_SELECT_2_SHIFT 8
1009 #define OAREPORTTRIG8_NOA_SELECT_3_SHIFT 12
1010 #define OAREPORTTRIG8_NOA_SELECT_4_SHIFT 16
1011 #define OAREPORTTRIG8_NOA_SELECT_5_SHIFT 20
1012 #define OAREPORTTRIG8_NOA_SELECT_6_SHIFT 24
1013 #define OAREPORTTRIG8_NOA_SELECT_7_SHIFT 28
1015 /* Same layout as OASTARTTRIGX */
1016 #define GEN12_OAG_OASTARTTRIG1 _MMIO(0xd900)
1017 #define GEN12_OAG_OASTARTTRIG2 _MMIO(0xd904)
1018 #define GEN12_OAG_OASTARTTRIG3 _MMIO(0xd908)
1019 #define GEN12_OAG_OASTARTTRIG4 _MMIO(0xd90c)
1020 #define GEN12_OAG_OASTARTTRIG5 _MMIO(0xd910)
1021 #define GEN12_OAG_OASTARTTRIG6 _MMIO(0xd914)
1022 #define GEN12_OAG_OASTARTTRIG7 _MMIO(0xd918)
1023 #define GEN12_OAG_OASTARTTRIG8 _MMIO(0xd91c)
1025 /* Same layout as OAREPORTTRIGX */
1026 #define GEN12_OAG_OAREPORTTRIG1 _MMIO(0xd920)
1027 #define GEN12_OAG_OAREPORTTRIG2 _MMIO(0xd924)
1028 #define GEN12_OAG_OAREPORTTRIG3 _MMIO(0xd928)
1029 #define GEN12_OAG_OAREPORTTRIG4 _MMIO(0xd92c)
1030 #define GEN12_OAG_OAREPORTTRIG5 _MMIO(0xd930)
1031 #define GEN12_OAG_OAREPORTTRIG6 _MMIO(0xd934)
1032 #define GEN12_OAG_OAREPORTTRIG7 _MMIO(0xd938)
1033 #define GEN12_OAG_OAREPORTTRIG8 _MMIO(0xd93c)
1036 #define OACEC_COMPARE_LESS_OR_EQUAL 6
1037 #define OACEC_COMPARE_NOT_EQUAL 5
1038 #define OACEC_COMPARE_LESS_THAN 4
1039 #define OACEC_COMPARE_GREATER_OR_EQUAL 3
1040 #define OACEC_COMPARE_EQUAL 2
1041 #define OACEC_COMPARE_GREATER_THAN 1
1042 #define OACEC_COMPARE_ANY_EQUAL 0
1044 #define OACEC_COMPARE_VALUE_MASK 0xffff
1045 #define OACEC_COMPARE_VALUE_SHIFT 3
1047 #define OACEC_SELECT_NOA (0 << 19)
1048 #define OACEC_SELECT_PREV (1 << 19)
1049 #define OACEC_SELECT_BOOLEAN (2 << 19)
1051 /* 11-bit array 0: pass-through, 1: negated */
1052 #define GEN12_OASCEC_NEGATE_MASK 0x7ff
1053 #define GEN12_OASCEC_NEGATE_SHIFT 21
1056 #define OACEC_MASK_MASK 0xffff
1057 #define OACEC_CONSIDERATIONS_MASK 0xffff
1058 #define OACEC_CONSIDERATIONS_SHIFT 16
1060 #define OACEC0_0 _MMIO(0x2770)
1061 #define OACEC0_1 _MMIO(0x2774)
1062 #define OACEC1_0 _MMIO(0x2778)
1063 #define OACEC1_1 _MMIO(0x277c)
1064 #define OACEC2_0 _MMIO(0x2780)
1065 #define OACEC2_1 _MMIO(0x2784)
1066 #define OACEC3_0 _MMIO(0x2788)
1067 #define OACEC3_1 _MMIO(0x278c)
1068 #define OACEC4_0 _MMIO(0x2790)
1069 #define OACEC4_1 _MMIO(0x2794)
1070 #define OACEC5_0 _MMIO(0x2798)
1071 #define OACEC5_1 _MMIO(0x279c)
1072 #define OACEC6_0 _MMIO(0x27a0)
1073 #define OACEC6_1 _MMIO(0x27a4)
1074 #define OACEC7_0 _MMIO(0x27a8)
1075 #define OACEC7_1 _MMIO(0x27ac)
1077 /* Same layout as CECX_Y */
1078 #define GEN12_OAG_CEC0_0 _MMIO(0xd940)
1079 #define GEN12_OAG_CEC0_1 _MMIO(0xd944)
1080 #define GEN12_OAG_CEC1_0 _MMIO(0xd948)
1081 #define GEN12_OAG_CEC1_1 _MMIO(0xd94c)
1082 #define GEN12_OAG_CEC2_0 _MMIO(0xd950)
1083 #define GEN12_OAG_CEC2_1 _MMIO(0xd954)
1084 #define GEN12_OAG_CEC3_0 _MMIO(0xd958)
1085 #define GEN12_OAG_CEC3_1 _MMIO(0xd95c)
1086 #define GEN12_OAG_CEC4_0 _MMIO(0xd960)
1087 #define GEN12_OAG_CEC4_1 _MMIO(0xd964)
1088 #define GEN12_OAG_CEC5_0 _MMIO(0xd968)
1089 #define GEN12_OAG_CEC5_1 _MMIO(0xd96c)
1090 #define GEN12_OAG_CEC6_0 _MMIO(0xd970)
1091 #define GEN12_OAG_CEC6_1 _MMIO(0xd974)
1092 #define GEN12_OAG_CEC7_0 _MMIO(0xd978)
1093 #define GEN12_OAG_CEC7_1 _MMIO(0xd97c)
1095 /* Same layout as CECX_Y + negate 11-bit array */
1096 #define GEN12_OAG_SCEC0_0 _MMIO(0xdc00)
1097 #define GEN12_OAG_SCEC0_1 _MMIO(0xdc04)
1098 #define GEN12_OAG_SCEC1_0 _MMIO(0xdc08)
1099 #define GEN12_OAG_SCEC1_1 _MMIO(0xdc0c)
1100 #define GEN12_OAG_SCEC2_0 _MMIO(0xdc10)
1101 #define GEN12_OAG_SCEC2_1 _MMIO(0xdc14)
1102 #define GEN12_OAG_SCEC3_0 _MMIO(0xdc18)
1103 #define GEN12_OAG_SCEC3_1 _MMIO(0xdc1c)
1104 #define GEN12_OAG_SCEC4_0 _MMIO(0xdc20)
1105 #define GEN12_OAG_SCEC4_1 _MMIO(0xdc24)
1106 #define GEN12_OAG_SCEC5_0 _MMIO(0xdc28)
1107 #define GEN12_OAG_SCEC5_1 _MMIO(0xdc2c)
1108 #define GEN12_OAG_SCEC6_0 _MMIO(0xdc30)
1109 #define GEN12_OAG_SCEC6_1 _MMIO(0xdc34)
1110 #define GEN12_OAG_SCEC7_0 _MMIO(0xdc38)
1111 #define GEN12_OAG_SCEC7_1 _MMIO(0xdc3c)
1113 /* OA perf counters */
1114 #define OA_PERFCNT1_LO _MMIO(0x91B8)
1115 #define OA_PERFCNT1_HI _MMIO(0x91BC)
1116 #define OA_PERFCNT2_LO _MMIO(0x91C0)
1117 #define OA_PERFCNT2_HI _MMIO(0x91C4)
1118 #define OA_PERFCNT3_LO _MMIO(0x91C8)
1119 #define OA_PERFCNT3_HI _MMIO(0x91CC)
1120 #define OA_PERFCNT4_LO _MMIO(0x91D8)
1121 #define OA_PERFCNT4_HI _MMIO(0x91DC)
1123 #define OA_PERFMATRIX_LO _MMIO(0x91C8)
1124 #define OA_PERFMATRIX_HI _MMIO(0x91CC)
1126 /* RPM unit config (Gen8+) */
1127 #define RPM_CONFIG0 _MMIO(0x0D00)
1128 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
1129 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (1 << GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
1130 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 0
1131 #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 1
1132 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
1133 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
1134 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 0
1135 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 1
1136 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ 2
1137 #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ 3
1138 #define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT 1
1139 #define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK (0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT)
1141 #define RPM_CONFIG1 _MMIO(0x0D04)
1142 #define GEN10_GT_NOA_ENABLE (1 << 9)
1144 /* GPM unit config (Gen9+) */
1145 #define CTC_MODE _MMIO(0xA26C)
1146 #define CTC_SOURCE_PARAMETER_MASK 1
1147 #define CTC_SOURCE_CRYSTAL_CLOCK 0
1148 #define CTC_SOURCE_DIVIDE_LOGIC 1
1149 #define CTC_SHIFT_PARAMETER_SHIFT 1
1150 #define CTC_SHIFT_PARAMETER_MASK (0x3 << CTC_SHIFT_PARAMETER_SHIFT)
1152 /* RCP unit config (Gen8+) */
1153 #define RCP_CONFIG _MMIO(0x0D08)
1156 #define HSW_MBVID2_NOA0 _MMIO(0x9E80)
1157 #define HSW_MBVID2_NOA1 _MMIO(0x9E84)
1158 #define HSW_MBVID2_NOA2 _MMIO(0x9E88)
1159 #define HSW_MBVID2_NOA3 _MMIO(0x9E8C)
1160 #define HSW_MBVID2_NOA4 _MMIO(0x9E90)
1161 #define HSW_MBVID2_NOA5 _MMIO(0x9E94)
1162 #define HSW_MBVID2_NOA6 _MMIO(0x9E98)
1163 #define HSW_MBVID2_NOA7 _MMIO(0x9E9C)
1164 #define HSW_MBVID2_NOA8 _MMIO(0x9EA0)
1165 #define HSW_MBVID2_NOA9 _MMIO(0x9EA4)
1167 #define HSW_MBVID2_MISR0 _MMIO(0x9EC0)
1170 #define NOA_CONFIG(i) _MMIO(0x0D0C + (i) * 4)
1172 #define MICRO_BP0_0 _MMIO(0x9800)
1173 #define MICRO_BP0_2 _MMIO(0x9804)
1174 #define MICRO_BP0_1 _MMIO(0x9808)
1176 #define MICRO_BP1_0 _MMIO(0x980C)
1177 #define MICRO_BP1_2 _MMIO(0x9810)
1178 #define MICRO_BP1_1 _MMIO(0x9814)
1180 #define MICRO_BP2_0 _MMIO(0x9818)
1181 #define MICRO_BP2_2 _MMIO(0x981C)
1182 #define MICRO_BP2_1 _MMIO(0x9820)
1184 #define MICRO_BP3_0 _MMIO(0x9824)
1185 #define MICRO_BP3_2 _MMIO(0x9828)
1186 #define MICRO_BP3_1 _MMIO(0x982C)
1188 #define MICRO_BP_TRIGGER _MMIO(0x9830)
1189 #define MICRO_BP3_COUNT_STATUS01 _MMIO(0x9834)
1190 #define MICRO_BP3_COUNT_STATUS23 _MMIO(0x9838)
1191 #define MICRO_BP_FIRED_ARMED _MMIO(0x983C)
1193 #define GEN12_OAA_DBG_REG _MMIO(0xdc44)
1194 #define GEN12_OAG_OA_PESS _MMIO(0x2b2c)
1195 #define GEN12_OAG_SPCTR_CNF _MMIO(0xdc40)
1197 #define GDT_CHICKEN_BITS _MMIO(0x9840)
1198 #define GT_NOA_ENABLE 0x00000080
1200 #define NOA_DATA _MMIO(0x986C)
1201 #define NOA_WRITE _MMIO(0x9888)
1202 #define GEN10_NOA_WRITE_HIGH _MMIO(0x9884)
1204 #define _GEN7_PIPEA_DE_LOAD_SL 0x70068
1205 #define _GEN7_PIPEB_DE_LOAD_SL 0x71068
1206 #define GEN7_PIPE_DE_LOAD_SL(pipe) _MMIO_PIPE(pipe, _GEN7_PIPEA_DE_LOAD_SL, _GEN7_PIPEB_DE_LOAD_SL)
1211 #define DEBUG_RESET_I830 _MMIO(0x6070)
1212 #define DEBUG_RESET_FULL (1 << 7)
1213 #define DEBUG_RESET_RENDER (1 << 8)
1214 #define DEBUG_RESET_DISPLAY (1 << 9)
1219 #define VLV_IOSF_DOORBELL_REQ _MMIO(VLV_DISPLAY_BASE + 0x2100)
1220 #define IOSF_DEVFN_SHIFT 24
1221 #define IOSF_OPCODE_SHIFT 16
1222 #define IOSF_PORT_SHIFT 8
1223 #define IOSF_BYTE_ENABLES_SHIFT 4
1224 #define IOSF_BAR_SHIFT 1
1225 #define IOSF_SB_BUSY (1 << 0)
1226 #define IOSF_PORT_BUNIT 0x03
1227 #define IOSF_PORT_PUNIT 0x04
1228 #define IOSF_PORT_NC 0x11
1229 #define IOSF_PORT_DPIO 0x12
1230 #define IOSF_PORT_GPIO_NC 0x13
1231 #define IOSF_PORT_CCK 0x14
1232 #define IOSF_PORT_DPIO_2 0x1a
1233 #define IOSF_PORT_FLISDSI 0x1b
1234 #define IOSF_PORT_GPIO_SC 0x48
1235 #define IOSF_PORT_GPIO_SUS 0xa8
1236 #define IOSF_PORT_CCU 0xa9
1237 #define CHV_IOSF_PORT_GPIO_N 0x13
1238 #define CHV_IOSF_PORT_GPIO_SE 0x48
1239 #define CHV_IOSF_PORT_GPIO_E 0xa8
1240 #define CHV_IOSF_PORT_GPIO_SW 0xb2
1241 #define VLV_IOSF_DATA _MMIO(VLV_DISPLAY_BASE + 0x2104)
1242 #define VLV_IOSF_ADDR _MMIO(VLV_DISPLAY_BASE + 0x2108)
1244 /* See configdb bunit SB addr map */
1245 #define BUNIT_REG_BISOC 0x11
1247 /* PUNIT_REG_*SSPM0 */
1248 #define _SSPM0_SSC(val) ((val) << 0)
1249 #define SSPM0_SSC_MASK _SSPM0_SSC(0x3)
1250 #define SSPM0_SSC_PWR_ON _SSPM0_SSC(0x0)
1251 #define SSPM0_SSC_CLK_GATE _SSPM0_SSC(0x1)
1252 #define SSPM0_SSC_RESET _SSPM0_SSC(0x2)
1253 #define SSPM0_SSC_PWR_GATE _SSPM0_SSC(0x3)
1254 #define _SSPM0_SSS(val) ((val) << 24)
1255 #define SSPM0_SSS_MASK _SSPM0_SSS(0x3)
1256 #define SSPM0_SSS_PWR_ON _SSPM0_SSS(0x0)
1257 #define SSPM0_SSS_CLK_GATE _SSPM0_SSS(0x1)
1258 #define SSPM0_SSS_RESET _SSPM0_SSS(0x2)
1259 #define SSPM0_SSS_PWR_GATE _SSPM0_SSS(0x3)
1261 /* PUNIT_REG_*SSPM1 */
1262 #define SSPM1_FREQSTAT_SHIFT 24
1263 #define SSPM1_FREQSTAT_MASK (0x1f << SSPM1_FREQSTAT_SHIFT)
1264 #define SSPM1_FREQGUAR_SHIFT 8
1265 #define SSPM1_FREQGUAR_MASK (0x1f << SSPM1_FREQGUAR_SHIFT)
1266 #define SSPM1_FREQ_SHIFT 0
1267 #define SSPM1_FREQ_MASK (0x1f << SSPM1_FREQ_SHIFT)
1269 #define PUNIT_REG_VEDSSPM0 0x32
1270 #define PUNIT_REG_VEDSSPM1 0x33
1272 #define PUNIT_REG_DSPSSPM 0x36
1273 #define DSPFREQSTAT_SHIFT_CHV 24
1274 #define DSPFREQSTAT_MASK_CHV (0x1f << DSPFREQSTAT_SHIFT_CHV)
1275 #define DSPFREQGUAR_SHIFT_CHV 8
1276 #define DSPFREQGUAR_MASK_CHV (0x1f << DSPFREQGUAR_SHIFT_CHV)
1277 #define DSPFREQSTAT_SHIFT 30
1278 #define DSPFREQSTAT_MASK (0x3 << DSPFREQSTAT_SHIFT)
1279 #define DSPFREQGUAR_SHIFT 14
1280 #define DSPFREQGUAR_MASK (0x3 << DSPFREQGUAR_SHIFT)
1281 #define DSP_MAXFIFO_PM5_STATUS (1 << 22) /* chv */
1282 #define DSP_AUTO_CDCLK_GATE_DISABLE (1 << 7) /* chv */
1283 #define DSP_MAXFIFO_PM5_ENABLE (1 << 6) /* chv */
1284 #define _DP_SSC(val, pipe) ((val) << (2 * (pipe)))
1285 #define DP_SSC_MASK(pipe) _DP_SSC(0x3, (pipe))
1286 #define DP_SSC_PWR_ON(pipe) _DP_SSC(0x0, (pipe))
1287 #define DP_SSC_CLK_GATE(pipe) _DP_SSC(0x1, (pipe))
1288 #define DP_SSC_RESET(pipe) _DP_SSC(0x2, (pipe))
1289 #define DP_SSC_PWR_GATE(pipe) _DP_SSC(0x3, (pipe))
1290 #define _DP_SSS(val, pipe) ((val) << (2 * (pipe) + 16))
1291 #define DP_SSS_MASK(pipe) _DP_SSS(0x3, (pipe))
1292 #define DP_SSS_PWR_ON(pipe) _DP_SSS(0x0, (pipe))
1293 #define DP_SSS_CLK_GATE(pipe) _DP_SSS(0x1, (pipe))
1294 #define DP_SSS_RESET(pipe) _DP_SSS(0x2, (pipe))
1295 #define DP_SSS_PWR_GATE(pipe) _DP_SSS(0x3, (pipe))
1297 #define PUNIT_REG_ISPSSPM0 0x39
1298 #define PUNIT_REG_ISPSSPM1 0x3a
1300 #define PUNIT_REG_PWRGT_CTRL 0x60
1301 #define PUNIT_REG_PWRGT_STATUS 0x61
1302 #define PUNIT_PWRGT_MASK(pw_idx) (3 << ((pw_idx) * 2))
1303 #define PUNIT_PWRGT_PWR_ON(pw_idx) (0 << ((pw_idx) * 2))
1304 #define PUNIT_PWRGT_CLK_GATE(pw_idx) (1 << ((pw_idx) * 2))
1305 #define PUNIT_PWRGT_RESET(pw_idx) (2 << ((pw_idx) * 2))
1306 #define PUNIT_PWRGT_PWR_GATE(pw_idx) (3 << ((pw_idx) * 2))
1308 #define PUNIT_PWGT_IDX_RENDER 0
1309 #define PUNIT_PWGT_IDX_MEDIA 1
1310 #define PUNIT_PWGT_IDX_DISP2D 3
1311 #define PUNIT_PWGT_IDX_DPIO_CMN_BC 5
1312 #define PUNIT_PWGT_IDX_DPIO_TX_B_LANES_01 6
1313 #define PUNIT_PWGT_IDX_DPIO_TX_B_LANES_23 7
1314 #define PUNIT_PWGT_IDX_DPIO_TX_C_LANES_01 8
1315 #define PUNIT_PWGT_IDX_DPIO_TX_C_LANES_23 9
1316 #define PUNIT_PWGT_IDX_DPIO_RX0 10
1317 #define PUNIT_PWGT_IDX_DPIO_RX1 11
1318 #define PUNIT_PWGT_IDX_DPIO_CMN_D 12
1320 #define PUNIT_REG_GPU_LFM 0xd3
1321 #define PUNIT_REG_GPU_FREQ_REQ 0xd4
1322 #define PUNIT_REG_GPU_FREQ_STS 0xd8
1323 #define GPLLENABLE (1 << 4)
1324 #define GENFREQSTATUS (1 << 0)
1325 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ 0xdc
1326 #define PUNIT_REG_CZ_TIMESTAMP 0xce
1328 #define PUNIT_FUSE_BUS2 0xf6 /* bits 47:40 */
1329 #define PUNIT_FUSE_BUS1 0xf5 /* bits 55:48 */
1331 #define FB_GFX_FMAX_AT_VMAX_FUSE 0x136
1332 #define FB_GFX_FREQ_FUSE_MASK 0xff
1333 #define FB_GFX_FMAX_AT_VMAX_2SS4EU_FUSE_SHIFT 24
1334 #define FB_GFX_FMAX_AT_VMAX_2SS6EU_FUSE_SHIFT 16
1335 #define FB_GFX_FMAX_AT_VMAX_2SS8EU_FUSE_SHIFT 8
1337 #define FB_GFX_FMIN_AT_VMIN_FUSE 0x137
1338 #define FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT 8
1340 #define PUNIT_REG_DDR_SETUP2 0x139
1341 #define FORCE_DDR_FREQ_REQ_ACK (1 << 8)
1342 #define FORCE_DDR_LOW_FREQ (1 << 1)
1343 #define FORCE_DDR_HIGH_FREQ (1 << 0)
1345 #define PUNIT_GPU_STATUS_REG 0xdb
1346 #define PUNIT_GPU_STATUS_MAX_FREQ_SHIFT 16
1347 #define PUNIT_GPU_STATUS_MAX_FREQ_MASK 0xff
1348 #define PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT 8
1349 #define PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK 0xff
1351 #define PUNIT_GPU_DUTYCYCLE_REG 0xdf
1352 #define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_SHIFT 8
1353 #define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_MASK 0xff
1355 #define IOSF_NC_FB_GFX_FREQ_FUSE 0x1c
1356 #define FB_GFX_MAX_FREQ_FUSE_SHIFT 3
1357 #define FB_GFX_MAX_FREQ_FUSE_MASK 0x000007f8
1358 #define FB_GFX_FGUARANTEED_FREQ_FUSE_SHIFT 11
1359 #define FB_GFX_FGUARANTEED_FREQ_FUSE_MASK 0x0007f800
1360 #define IOSF_NC_FB_GFX_FMAX_FUSE_HI 0x34
1361 #define FB_FMAX_VMIN_FREQ_HI_MASK 0x00000007
1362 #define IOSF_NC_FB_GFX_FMAX_FUSE_LO 0x30
1363 #define FB_FMAX_VMIN_FREQ_LO_SHIFT 27
1364 #define FB_FMAX_VMIN_FREQ_LO_MASK 0xf8000000
1366 #define VLV_TURBO_SOC_OVERRIDE 0x04
1367 #define VLV_OVERRIDE_EN 1
1368 #define VLV_SOC_TDP_EN (1 << 1)
1369 #define VLV_BIAS_CPU_125_SOC_875 (6 << 2)
1370 #define CHV_BIAS_CPU_50_SOC_50 (3 << 2)
1372 /* vlv2 north clock has */
1373 #define CCK_FUSE_REG 0x8
1374 #define CCK_FUSE_HPLL_FREQ_MASK 0x3
1375 #define CCK_REG_DSI_PLL_FUSE 0x44
1376 #define CCK_REG_DSI_PLL_CONTROL 0x48
1377 #define DSI_PLL_VCO_EN (1 << 31)
1378 #define DSI_PLL_LDO_GATE (1 << 30)
1379 #define DSI_PLL_P1_POST_DIV_SHIFT 17
1380 #define DSI_PLL_P1_POST_DIV_MASK (0x1ff << 17)
1381 #define DSI_PLL_P2_MUX_DSI0_DIV2 (1 << 13)
1382 #define DSI_PLL_P3_MUX_DSI1_DIV2 (1 << 12)
1383 #define DSI_PLL_MUX_MASK (3 << 9)
1384 #define DSI_PLL_MUX_DSI0_DSIPLL (0 << 10)
1385 #define DSI_PLL_MUX_DSI0_CCK (1 << 10)
1386 #define DSI_PLL_MUX_DSI1_DSIPLL (0 << 9)
1387 #define DSI_PLL_MUX_DSI1_CCK (1 << 9)
1388 #define DSI_PLL_CLK_GATE_MASK (0xf << 5)
1389 #define DSI_PLL_CLK_GATE_DSI0_DSIPLL (1 << 8)
1390 #define DSI_PLL_CLK_GATE_DSI1_DSIPLL (1 << 7)
1391 #define DSI_PLL_CLK_GATE_DSI0_CCK (1 << 6)
1392 #define DSI_PLL_CLK_GATE_DSI1_CCK (1 << 5)
1393 #define DSI_PLL_LOCK (1 << 0)
1394 #define CCK_REG_DSI_PLL_DIVIDER 0x4c
1395 #define DSI_PLL_LFSR (1 << 31)
1396 #define DSI_PLL_FRACTION_EN (1 << 30)
1397 #define DSI_PLL_FRAC_COUNTER_SHIFT 27
1398 #define DSI_PLL_FRAC_COUNTER_MASK (7 << 27)
1399 #define DSI_PLL_USYNC_CNT_SHIFT 18
1400 #define DSI_PLL_USYNC_CNT_MASK (0x1ff << 18)
1401 #define DSI_PLL_N1_DIV_SHIFT 16
1402 #define DSI_PLL_N1_DIV_MASK (3 << 16)
1403 #define DSI_PLL_M1_DIV_SHIFT 0
1404 #define DSI_PLL_M1_DIV_MASK (0x1ff << 0)
1405 #define CCK_CZ_CLOCK_CONTROL 0x62
1406 #define CCK_GPLL_CLOCK_CONTROL 0x67
1407 #define CCK_DISPLAY_CLOCK_CONTROL 0x6b
1408 #define CCK_DISPLAY_REF_CLOCK_CONTROL 0x6c
1409 #define CCK_TRUNK_FORCE_ON (1 << 17)
1410 #define CCK_TRUNK_FORCE_OFF (1 << 16)
1411 #define CCK_FREQUENCY_STATUS (0x1f << 8)
1412 #define CCK_FREQUENCY_STATUS_SHIFT 8
1413 #define CCK_FREQUENCY_VALUES (0x1f << 0)
1415 /* DPIO registers */
1416 #define DPIO_DEVFN 0
1418 #define DPIO_CTL _MMIO(VLV_DISPLAY_BASE + 0x2110)
1419 #define DPIO_MODSEL1 (1 << 3) /* if ref clk b == 27 */
1420 #define DPIO_MODSEL0 (1 << 2) /* if ref clk a == 27 */
1421 #define DPIO_SFR_BYPASS (1 << 1)
1422 #define DPIO_CMNRST (1 << 0)
1424 #define DPIO_PHY(pipe) ((pipe) >> 1)
1427 * Per pipe/PLL DPIO regs
1429 #define _VLV_PLL_DW3_CH0 0x800c
1430 #define DPIO_POST_DIV_SHIFT (28) /* 3 bits */
1431 #define DPIO_POST_DIV_DAC 0
1432 #define DPIO_POST_DIV_HDMIDP 1 /* DAC 225-400M rate */
1433 #define DPIO_POST_DIV_LVDS1 2
1434 #define DPIO_POST_DIV_LVDS2 3
1435 #define DPIO_K_SHIFT (24) /* 4 bits */
1436 #define DPIO_P1_SHIFT (21) /* 3 bits */
1437 #define DPIO_P2_SHIFT (16) /* 5 bits */
1438 #define DPIO_N_SHIFT (12) /* 4 bits */
1439 #define DPIO_ENABLE_CALIBRATION (1 << 11)
1440 #define DPIO_M1DIV_SHIFT (8) /* 3 bits */
1441 #define DPIO_M2DIV_MASK 0xff
1442 #define _VLV_PLL_DW3_CH1 0x802c
1443 #define VLV_PLL_DW3(ch) _PIPE(ch, _VLV_PLL_DW3_CH0, _VLV_PLL_DW3_CH1)
1445 #define _VLV_PLL_DW5_CH0 0x8014
1446 #define DPIO_REFSEL_OVERRIDE 27
1447 #define DPIO_PLL_MODESEL_SHIFT 24 /* 3 bits */
1448 #define DPIO_BIAS_CURRENT_CTL_SHIFT 21 /* 3 bits, always 0x7 */
1449 #define DPIO_PLL_REFCLK_SEL_SHIFT 16 /* 2 bits */
1450 #define DPIO_PLL_REFCLK_SEL_MASK 3
1451 #define DPIO_DRIVER_CTL_SHIFT 12 /* always set to 0x8 */
1452 #define DPIO_CLK_BIAS_CTL_SHIFT 8 /* always set to 0x5 */
1453 #define _VLV_PLL_DW5_CH1 0x8034
1454 #define VLV_PLL_DW5(ch) _PIPE(ch, _VLV_PLL_DW5_CH0, _VLV_PLL_DW5_CH1)
1456 #define _VLV_PLL_DW7_CH0 0x801c
1457 #define _VLV_PLL_DW7_CH1 0x803c
1458 #define VLV_PLL_DW7(ch) _PIPE(ch, _VLV_PLL_DW7_CH0, _VLV_PLL_DW7_CH1)
1460 #define _VLV_PLL_DW8_CH0 0x8040
1461 #define _VLV_PLL_DW8_CH1 0x8060
1462 #define VLV_PLL_DW8(ch) _PIPE(ch, _VLV_PLL_DW8_CH0, _VLV_PLL_DW8_CH1)
1464 #define VLV_PLL_DW9_BCAST 0xc044
1465 #define _VLV_PLL_DW9_CH0 0x8044
1466 #define _VLV_PLL_DW9_CH1 0x8064
1467 #define VLV_PLL_DW9(ch) _PIPE(ch, _VLV_PLL_DW9_CH0, _VLV_PLL_DW9_CH1)
1469 #define _VLV_PLL_DW10_CH0 0x8048
1470 #define _VLV_PLL_DW10_CH1 0x8068
1471 #define VLV_PLL_DW10(ch) _PIPE(ch, _VLV_PLL_DW10_CH0, _VLV_PLL_DW10_CH1)
1473 #define _VLV_PLL_DW11_CH0 0x804c
1474 #define _VLV_PLL_DW11_CH1 0x806c
1475 #define VLV_PLL_DW11(ch) _PIPE(ch, _VLV_PLL_DW11_CH0, _VLV_PLL_DW11_CH1)
1477 /* Spec for ref block start counts at DW10 */
1478 #define VLV_REF_DW13 0x80ac
1480 #define VLV_CMN_DW0 0x8100
1483 * Per DDI channel DPIO regs
1486 #define _VLV_PCS_DW0_CH0 0x8200
1487 #define _VLV_PCS_DW0_CH1 0x8400
1488 #define DPIO_PCS_TX_LANE2_RESET (1 << 16)
1489 #define DPIO_PCS_TX_LANE1_RESET (1 << 7)
1490 #define DPIO_LEFT_TXFIFO_RST_MASTER2 (1 << 4)
1491 #define DPIO_RIGHT_TXFIFO_RST_MASTER2 (1 << 3)
1492 #define VLV_PCS_DW0(ch) _PORT(ch, _VLV_PCS_DW0_CH0, _VLV_PCS_DW0_CH1)
1494 #define _VLV_PCS01_DW0_CH0 0x200
1495 #define _VLV_PCS23_DW0_CH0 0x400
1496 #define _VLV_PCS01_DW0_CH1 0x2600
1497 #define _VLV_PCS23_DW0_CH1 0x2800
1498 #define VLV_PCS01_DW0(ch) _PORT(ch, _VLV_PCS01_DW0_CH0, _VLV_PCS01_DW0_CH1)
1499 #define VLV_PCS23_DW0(ch) _PORT(ch, _VLV_PCS23_DW0_CH0, _VLV_PCS23_DW0_CH1)
1501 #define _VLV_PCS_DW1_CH0 0x8204
1502 #define _VLV_PCS_DW1_CH1 0x8404
1503 #define CHV_PCS_REQ_SOFTRESET_EN (1 << 23)
1504 #define DPIO_PCS_CLK_CRI_RXEB_EIOS_EN (1 << 22)
1505 #define DPIO_PCS_CLK_CRI_RXDIGFILTSG_EN (1 << 21)
1506 #define DPIO_PCS_CLK_DATAWIDTH_SHIFT (6)
1507 #define DPIO_PCS_CLK_SOFT_RESET (1 << 5)
1508 #define VLV_PCS_DW1(ch) _PORT(ch, _VLV_PCS_DW1_CH0, _VLV_PCS_DW1_CH1)
1510 #define _VLV_PCS01_DW1_CH0 0x204
1511 #define _VLV_PCS23_DW1_CH0 0x404
1512 #define _VLV_PCS01_DW1_CH1 0x2604
1513 #define _VLV_PCS23_DW1_CH1 0x2804
1514 #define VLV_PCS01_DW1(ch) _PORT(ch, _VLV_PCS01_DW1_CH0, _VLV_PCS01_DW1_CH1)
1515 #define VLV_PCS23_DW1(ch) _PORT(ch, _VLV_PCS23_DW1_CH0, _VLV_PCS23_DW1_CH1)
1517 #define _VLV_PCS_DW8_CH0 0x8220
1518 #define _VLV_PCS_DW8_CH1 0x8420
1519 #define CHV_PCS_USEDCLKCHANNEL_OVRRIDE (1 << 20)
1520 #define CHV_PCS_USEDCLKCHANNEL (1 << 21)
1521 #define VLV_PCS_DW8(ch) _PORT(ch, _VLV_PCS_DW8_CH0, _VLV_PCS_DW8_CH1)
1523 #define _VLV_PCS01_DW8_CH0 0x0220
1524 #define _VLV_PCS23_DW8_CH0 0x0420
1525 #define _VLV_PCS01_DW8_CH1 0x2620
1526 #define _VLV_PCS23_DW8_CH1 0x2820
1527 #define VLV_PCS01_DW8(port) _PORT(port, _VLV_PCS01_DW8_CH0, _VLV_PCS01_DW8_CH1)
1528 #define VLV_PCS23_DW8(port) _PORT(port, _VLV_PCS23_DW8_CH0, _VLV_PCS23_DW8_CH1)
1530 #define _VLV_PCS_DW9_CH0 0x8224
1531 #define _VLV_PCS_DW9_CH1 0x8424
1532 #define DPIO_PCS_TX2MARGIN_MASK (0x7 << 13)
1533 #define DPIO_PCS_TX2MARGIN_000 (0 << 13)
1534 #define DPIO_PCS_TX2MARGIN_101 (1 << 13)
1535 #define DPIO_PCS_TX1MARGIN_MASK (0x7 << 10)
1536 #define DPIO_PCS_TX1MARGIN_000 (0 << 10)
1537 #define DPIO_PCS_TX1MARGIN_101 (1 << 10)
1538 #define VLV_PCS_DW9(ch) _PORT(ch, _VLV_PCS_DW9_CH0, _VLV_PCS_DW9_CH1)
1540 #define _VLV_PCS01_DW9_CH0 0x224
1541 #define _VLV_PCS23_DW9_CH0 0x424
1542 #define _VLV_PCS01_DW9_CH1 0x2624
1543 #define _VLV_PCS23_DW9_CH1 0x2824
1544 #define VLV_PCS01_DW9(ch) _PORT(ch, _VLV_PCS01_DW9_CH0, _VLV_PCS01_DW9_CH1)
1545 #define VLV_PCS23_DW9(ch) _PORT(ch, _VLV_PCS23_DW9_CH0, _VLV_PCS23_DW9_CH1)
1547 #define _CHV_PCS_DW10_CH0 0x8228
1548 #define _CHV_PCS_DW10_CH1 0x8428
1549 #define DPIO_PCS_SWING_CALC_TX0_TX2 (1 << 30)
1550 #define DPIO_PCS_SWING_CALC_TX1_TX3 (1 << 31)
1551 #define DPIO_PCS_TX2DEEMP_MASK (0xf << 24)
1552 #define DPIO_PCS_TX2DEEMP_9P5 (0 << 24)
1553 #define DPIO_PCS_TX2DEEMP_6P0 (2 << 24)
1554 #define DPIO_PCS_TX1DEEMP_MASK (0xf << 16)
1555 #define DPIO_PCS_TX1DEEMP_9P5 (0 << 16)
1556 #define DPIO_PCS_TX1DEEMP_6P0 (2 << 16)
1557 #define CHV_PCS_DW10(ch) _PORT(ch, _CHV_PCS_DW10_CH0, _CHV_PCS_DW10_CH1)
1559 #define _VLV_PCS01_DW10_CH0 0x0228
1560 #define _VLV_PCS23_DW10_CH0 0x0428
1561 #define _VLV_PCS01_DW10_CH1 0x2628
1562 #define _VLV_PCS23_DW10_CH1 0x2828
1563 #define VLV_PCS01_DW10(port) _PORT(port, _VLV_PCS01_DW10_CH0, _VLV_PCS01_DW10_CH1)
1564 #define VLV_PCS23_DW10(port) _PORT(port, _VLV_PCS23_DW10_CH0, _VLV_PCS23_DW10_CH1)
1566 #define _VLV_PCS_DW11_CH0 0x822c
1567 #define _VLV_PCS_DW11_CH1 0x842c
1568 #define DPIO_TX2_STAGGER_MASK(x) ((x) << 24)
1569 #define DPIO_LANEDESKEW_STRAP_OVRD (1 << 3)
1570 #define DPIO_LEFT_TXFIFO_RST_MASTER (1 << 1)
1571 #define DPIO_RIGHT_TXFIFO_RST_MASTER (1 << 0)
1572 #define VLV_PCS_DW11(ch) _PORT(ch, _VLV_PCS_DW11_CH0, _VLV_PCS_DW11_CH1)
1574 #define _VLV_PCS01_DW11_CH0 0x022c
1575 #define _VLV_PCS23_DW11_CH0 0x042c
1576 #define _VLV_PCS01_DW11_CH1 0x262c
1577 #define _VLV_PCS23_DW11_CH1 0x282c
1578 #define VLV_PCS01_DW11(ch) _PORT(ch, _VLV_PCS01_DW11_CH0, _VLV_PCS01_DW11_CH1)
1579 #define VLV_PCS23_DW11(ch) _PORT(ch, _VLV_PCS23_DW11_CH0, _VLV_PCS23_DW11_CH1)
1581 #define _VLV_PCS01_DW12_CH0 0x0230
1582 #define _VLV_PCS23_DW12_CH0 0x0430
1583 #define _VLV_PCS01_DW12_CH1 0x2630
1584 #define _VLV_PCS23_DW12_CH1 0x2830
1585 #define VLV_PCS01_DW12(ch) _PORT(ch, _VLV_PCS01_DW12_CH0, _VLV_PCS01_DW12_CH1)
1586 #define VLV_PCS23_DW12(ch) _PORT(ch, _VLV_PCS23_DW12_CH0, _VLV_PCS23_DW12_CH1)
1588 #define _VLV_PCS_DW12_CH0 0x8230
1589 #define _VLV_PCS_DW12_CH1 0x8430
1590 #define DPIO_TX2_STAGGER_MULT(x) ((x) << 20)
1591 #define DPIO_TX1_STAGGER_MULT(x) ((x) << 16)
1592 #define DPIO_TX1_STAGGER_MASK(x) ((x) << 8)
1593 #define DPIO_LANESTAGGER_STRAP_OVRD (1 << 6)
1594 #define DPIO_LANESTAGGER_STRAP(x) ((x) << 0)
1595 #define VLV_PCS_DW12(ch) _PORT(ch, _VLV_PCS_DW12_CH0, _VLV_PCS_DW12_CH1)
1597 #define _VLV_PCS_DW14_CH0 0x8238
1598 #define _VLV_PCS_DW14_CH1 0x8438
1599 #define VLV_PCS_DW14(ch) _PORT(ch, _VLV_PCS_DW14_CH0, _VLV_PCS_DW14_CH1)
1601 #define _VLV_PCS_DW23_CH0 0x825c
1602 #define _VLV_PCS_DW23_CH1 0x845c
1603 #define VLV_PCS_DW23(ch) _PORT(ch, _VLV_PCS_DW23_CH0, _VLV_PCS_DW23_CH1)
1605 #define _VLV_TX_DW2_CH0 0x8288
1606 #define _VLV_TX_DW2_CH1 0x8488
1607 #define DPIO_SWING_MARGIN000_SHIFT 16
1608 #define DPIO_SWING_MARGIN000_MASK (0xff << DPIO_SWING_MARGIN000_SHIFT)
1609 #define DPIO_UNIQ_TRANS_SCALE_SHIFT 8
1610 #define VLV_TX_DW2(ch) _PORT(ch, _VLV_TX_DW2_CH0, _VLV_TX_DW2_CH1)
1612 #define _VLV_TX_DW3_CH0 0x828c
1613 #define _VLV_TX_DW3_CH1 0x848c
1614 /* The following bit for CHV phy */
1615 #define DPIO_TX_UNIQ_TRANS_SCALE_EN (1 << 27)
1616 #define DPIO_SWING_MARGIN101_SHIFT 16
1617 #define DPIO_SWING_MARGIN101_MASK (0xff << DPIO_SWING_MARGIN101_SHIFT)
1618 #define VLV_TX_DW3(ch) _PORT(ch, _VLV_TX_DW3_CH0, _VLV_TX_DW3_CH1)
1620 #define _VLV_TX_DW4_CH0 0x8290
1621 #define _VLV_TX_DW4_CH1 0x8490
1622 #define DPIO_SWING_DEEMPH9P5_SHIFT 24
1623 #define DPIO_SWING_DEEMPH9P5_MASK (0xff << DPIO_SWING_DEEMPH9P5_SHIFT)
1624 #define DPIO_SWING_DEEMPH6P0_SHIFT 16
1625 #define DPIO_SWING_DEEMPH6P0_MASK (0xff << DPIO_SWING_DEEMPH6P0_SHIFT)
1626 #define VLV_TX_DW4(ch) _PORT(ch, _VLV_TX_DW4_CH0, _VLV_TX_DW4_CH1)
1628 #define _VLV_TX3_DW4_CH0 0x690
1629 #define _VLV_TX3_DW4_CH1 0x2a90
1630 #define VLV_TX3_DW4(ch) _PORT(ch, _VLV_TX3_DW4_CH0, _VLV_TX3_DW4_CH1)
1632 #define _VLV_TX_DW5_CH0 0x8294
1633 #define _VLV_TX_DW5_CH1 0x8494
1634 #define DPIO_TX_OCALINIT_EN (1 << 31)
1635 #define VLV_TX_DW5(ch) _PORT(ch, _VLV_TX_DW5_CH0, _VLV_TX_DW5_CH1)
1637 #define _VLV_TX_DW11_CH0 0x82ac
1638 #define _VLV_TX_DW11_CH1 0x84ac
1639 #define VLV_TX_DW11(ch) _PORT(ch, _VLV_TX_DW11_CH0, _VLV_TX_DW11_CH1)
1641 #define _VLV_TX_DW14_CH0 0x82b8
1642 #define _VLV_TX_DW14_CH1 0x84b8
1643 #define VLV_TX_DW14(ch) _PORT(ch, _VLV_TX_DW14_CH0, _VLV_TX_DW14_CH1)
1645 /* CHV dpPhy registers */
1646 #define _CHV_PLL_DW0_CH0 0x8000
1647 #define _CHV_PLL_DW0_CH1 0x8180
1648 #define CHV_PLL_DW0(ch) _PIPE(ch, _CHV_PLL_DW0_CH0, _CHV_PLL_DW0_CH1)
1650 #define _CHV_PLL_DW1_CH0 0x8004
1651 #define _CHV_PLL_DW1_CH1 0x8184
1652 #define DPIO_CHV_N_DIV_SHIFT 8
1653 #define DPIO_CHV_M1_DIV_BY_2 (0 << 0)
1654 #define CHV_PLL_DW1(ch) _PIPE(ch, _CHV_PLL_DW1_CH0, _CHV_PLL_DW1_CH1)
1656 #define _CHV_PLL_DW2_CH0 0x8008
1657 #define _CHV_PLL_DW2_CH1 0x8188
1658 #define CHV_PLL_DW2(ch) _PIPE(ch, _CHV_PLL_DW2_CH0, _CHV_PLL_DW2_CH1)
1660 #define _CHV_PLL_DW3_CH0 0x800c
1661 #define _CHV_PLL_DW3_CH1 0x818c
1662 #define DPIO_CHV_FRAC_DIV_EN (1 << 16)
1663 #define DPIO_CHV_FIRST_MOD (0 << 8)
1664 #define DPIO_CHV_SECOND_MOD (1 << 8)
1665 #define DPIO_CHV_FEEDFWD_GAIN_SHIFT 0
1666 #define DPIO_CHV_FEEDFWD_GAIN_MASK (0xF << 0)
1667 #define CHV_PLL_DW3(ch) _PIPE(ch, _CHV_PLL_DW3_CH0, _CHV_PLL_DW3_CH1)
1669 #define _CHV_PLL_DW6_CH0 0x8018
1670 #define _CHV_PLL_DW6_CH1 0x8198
1671 #define DPIO_CHV_GAIN_CTRL_SHIFT 16
1672 #define DPIO_CHV_INT_COEFF_SHIFT 8
1673 #define DPIO_CHV_PROP_COEFF_SHIFT 0
1674 #define CHV_PLL_DW6(ch) _PIPE(ch, _CHV_PLL_DW6_CH0, _CHV_PLL_DW6_CH1)
1676 #define _CHV_PLL_DW8_CH0 0x8020
1677 #define _CHV_PLL_DW8_CH1 0x81A0
1678 #define DPIO_CHV_TDC_TARGET_CNT_SHIFT 0
1679 #define DPIO_CHV_TDC_TARGET_CNT_MASK (0x3FF << 0)
1680 #define CHV_PLL_DW8(ch) _PIPE(ch, _CHV_PLL_DW8_CH0, _CHV_PLL_DW8_CH1)
1682 #define _CHV_PLL_DW9_CH0 0x8024
1683 #define _CHV_PLL_DW9_CH1 0x81A4
1684 #define DPIO_CHV_INT_LOCK_THRESHOLD_SHIFT 1 /* 3 bits */
1685 #define DPIO_CHV_INT_LOCK_THRESHOLD_MASK (7 << 1)
1686 #define DPIO_CHV_INT_LOCK_THRESHOLD_SEL_COARSE 1 /* 1: coarse & 0 : fine */
1687 #define CHV_PLL_DW9(ch) _PIPE(ch, _CHV_PLL_DW9_CH0, _CHV_PLL_DW9_CH1)
1689 #define _CHV_CMN_DW0_CH0 0x8100
1690 #define DPIO_ALLDL_POWERDOWN_SHIFT_CH0 19
1691 #define DPIO_ANYDL_POWERDOWN_SHIFT_CH0 18
1692 #define DPIO_ALLDL_POWERDOWN (1 << 1)
1693 #define DPIO_ANYDL_POWERDOWN (1 << 0)
1695 #define _CHV_CMN_DW5_CH0 0x8114
1696 #define CHV_BUFRIGHTENA1_DISABLE (0 << 20)
1697 #define CHV_BUFRIGHTENA1_NORMAL (1 << 20)
1698 #define CHV_BUFRIGHTENA1_FORCE (3 << 20)
1699 #define CHV_BUFRIGHTENA1_MASK (3 << 20)
1700 #define CHV_BUFLEFTENA1_DISABLE (0 << 22)
1701 #define CHV_BUFLEFTENA1_NORMAL (1 << 22)
1702 #define CHV_BUFLEFTENA1_FORCE (3 << 22)
1703 #define CHV_BUFLEFTENA1_MASK (3 << 22)
1705 #define _CHV_CMN_DW13_CH0 0x8134
1706 #define _CHV_CMN_DW0_CH1 0x8080
1707 #define DPIO_CHV_S1_DIV_SHIFT 21
1708 #define DPIO_CHV_P1_DIV_SHIFT 13 /* 3 bits */
1709 #define DPIO_CHV_P2_DIV_SHIFT 8 /* 5 bits */
1710 #define DPIO_CHV_K_DIV_SHIFT 4
1711 #define DPIO_PLL_FREQLOCK (1 << 1)
1712 #define DPIO_PLL_LOCK (1 << 0)
1713 #define CHV_CMN_DW13(ch) _PIPE(ch, _CHV_CMN_DW13_CH0, _CHV_CMN_DW0_CH1)
1715 #define _CHV_CMN_DW14_CH0 0x8138
1716 #define _CHV_CMN_DW1_CH1 0x8084
1717 #define DPIO_AFC_RECAL (1 << 14)
1718 #define DPIO_DCLKP_EN (1 << 13)
1719 #define CHV_BUFLEFTENA2_DISABLE (0 << 17) /* CL2 DW1 only */
1720 #define CHV_BUFLEFTENA2_NORMAL (1 << 17) /* CL2 DW1 only */
1721 #define CHV_BUFLEFTENA2_FORCE (3 << 17) /* CL2 DW1 only */
1722 #define CHV_BUFLEFTENA2_MASK (3 << 17) /* CL2 DW1 only */
1723 #define CHV_BUFRIGHTENA2_DISABLE (0 << 19) /* CL2 DW1 only */
1724 #define CHV_BUFRIGHTENA2_NORMAL (1 << 19) /* CL2 DW1 only */
1725 #define CHV_BUFRIGHTENA2_FORCE (3 << 19) /* CL2 DW1 only */
1726 #define CHV_BUFRIGHTENA2_MASK (3 << 19) /* CL2 DW1 only */
1727 #define CHV_CMN_DW14(ch) _PIPE(ch, _CHV_CMN_DW14_CH0, _CHV_CMN_DW1_CH1)
1729 #define _CHV_CMN_DW19_CH0 0x814c
1730 #define _CHV_CMN_DW6_CH1 0x8098
1731 #define DPIO_ALLDL_POWERDOWN_SHIFT_CH1 30 /* CL2 DW6 only */
1732 #define DPIO_ANYDL_POWERDOWN_SHIFT_CH1 29 /* CL2 DW6 only */
1733 #define DPIO_DYNPWRDOWNEN_CH1 (1 << 28) /* CL2 DW6 only */
1734 #define CHV_CMN_USEDCLKCHANNEL (1 << 13)
1736 #define CHV_CMN_DW19(ch) _PIPE(ch, _CHV_CMN_DW19_CH0, _CHV_CMN_DW6_CH1)
1738 #define CHV_CMN_DW28 0x8170
1739 #define DPIO_CL1POWERDOWNEN (1 << 23)
1740 #define DPIO_DYNPWRDOWNEN_CH0 (1 << 22)
1741 #define DPIO_SUS_CLK_CONFIG_ON (0 << 0)
1742 #define DPIO_SUS_CLK_CONFIG_CLKREQ (1 << 0)
1743 #define DPIO_SUS_CLK_CONFIG_GATE (2 << 0)
1744 #define DPIO_SUS_CLK_CONFIG_GATE_CLKREQ (3 << 0)
1746 #define CHV_CMN_DW30 0x8178
1747 #define DPIO_CL2_LDOFUSE_PWRENB (1 << 6)
1748 #define DPIO_LRC_BYPASS (1 << 3)
1750 #define _TXLANE(ch, lane, offset) ((ch ? 0x2400 : 0) + \
1751 (lane) * 0x200 + (offset))
1753 #define CHV_TX_DW0(ch, lane) _TXLANE(ch, lane, 0x80)
1754 #define CHV_TX_DW1(ch, lane) _TXLANE(ch, lane, 0x84)
1755 #define CHV_TX_DW2(ch, lane) _TXLANE(ch, lane, 0x88)
1756 #define CHV_TX_DW3(ch, lane) _TXLANE(ch, lane, 0x8c)
1757 #define CHV_TX_DW4(ch, lane) _TXLANE(ch, lane, 0x90)
1758 #define CHV_TX_DW5(ch, lane) _TXLANE(ch, lane, 0x94)
1759 #define CHV_TX_DW6(ch, lane) _TXLANE(ch, lane, 0x98)
1760 #define CHV_TX_DW7(ch, lane) _TXLANE(ch, lane, 0x9c)
1761 #define CHV_TX_DW8(ch, lane) _TXLANE(ch, lane, 0xa0)
1762 #define CHV_TX_DW9(ch, lane) _TXLANE(ch, lane, 0xa4)
1763 #define CHV_TX_DW10(ch, lane) _TXLANE(ch, lane, 0xa8)
1764 #define CHV_TX_DW11(ch, lane) _TXLANE(ch, lane, 0xac)
1765 #define DPIO_FRC_LATENCY_SHFIT 8
1766 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
1767 #define DPIO_UPAR_SHIFT 30
1769 /* BXT PHY registers */
1770 #define _BXT_PHY0_BASE 0x6C000
1771 #define _BXT_PHY1_BASE 0x162000
1772 #define _BXT_PHY2_BASE 0x163000
1773 #define BXT_PHY_BASE(phy) _PHY3((phy), _BXT_PHY0_BASE, \
1777 #define _BXT_PHY(phy, reg) \
1778 _MMIO(BXT_PHY_BASE(phy) - _BXT_PHY0_BASE + (reg))
1780 #define _BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \
1781 (BXT_PHY_BASE(phy) + _PIPE((ch), (reg_ch0) - _BXT_PHY0_BASE, \
1782 (reg_ch1) - _BXT_PHY0_BASE))
1783 #define _MMIO_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \
1784 _MMIO(_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1))
1786 #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)
1787 #define MIPIO_RST_CTRL (1 << 2)
1789 #define _BXT_PHY_CTL_DDI_A 0x64C00
1790 #define _BXT_PHY_CTL_DDI_B 0x64C10
1791 #define _BXT_PHY_CTL_DDI_C 0x64C20
1792 #define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10)
1793 #define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9)
1794 #define BXT_PHY_LANE_ENABLED (1 << 8)
1795 #define BXT_PHY_CTL(port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
1798 #define _PHY_CTL_FAMILY_EDP 0x64C80
1799 #define _PHY_CTL_FAMILY_DDI 0x64C90
1800 #define _PHY_CTL_FAMILY_DDI_C 0x64CA0
1801 #define COMMON_RESET_DIS (1 << 31)
1802 #define BXT_PHY_CTL_FAMILY(phy) _MMIO_PHY3((phy), _PHY_CTL_FAMILY_DDI, \
1803 _PHY_CTL_FAMILY_EDP, \
1804 _PHY_CTL_FAMILY_DDI_C)
1806 /* BXT PHY PLL registers */
1807 #define _PORT_PLL_A 0x46074
1808 #define _PORT_PLL_B 0x46078
1809 #define _PORT_PLL_C 0x4607c
1810 #define PORT_PLL_ENABLE (1 << 31)
1811 #define PORT_PLL_LOCK (1 << 30)
1812 #define PORT_PLL_REF_SEL (1 << 27)
1813 #define PORT_PLL_POWER_ENABLE (1 << 26)
1814 #define PORT_PLL_POWER_STATE (1 << 25)
1815 #define BXT_PORT_PLL_ENABLE(port) _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
1817 #define _PORT_PLL_EBB_0_A 0x162034
1818 #define _PORT_PLL_EBB_0_B 0x6C034
1819 #define _PORT_PLL_EBB_0_C 0x6C340
1820 #define PORT_PLL_P1_SHIFT 13
1821 #define PORT_PLL_P1_MASK (0x07 << PORT_PLL_P1_SHIFT)
1822 #define PORT_PLL_P1(x) ((x) << PORT_PLL_P1_SHIFT)
1823 #define PORT_PLL_P2_SHIFT 8
1824 #define PORT_PLL_P2_MASK (0x1f << PORT_PLL_P2_SHIFT)
1825 #define PORT_PLL_P2(x) ((x) << PORT_PLL_P2_SHIFT)
1826 #define BXT_PORT_PLL_EBB_0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
1827 _PORT_PLL_EBB_0_B, \
1830 #define _PORT_PLL_EBB_4_A 0x162038
1831 #define _PORT_PLL_EBB_4_B 0x6C038
1832 #define _PORT_PLL_EBB_4_C 0x6C344
1833 #define PORT_PLL_10BIT_CLK_ENABLE (1 << 13)
1834 #define PORT_PLL_RECALIBRATE (1 << 14)
1835 #define BXT_PORT_PLL_EBB_4(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
1836 _PORT_PLL_EBB_4_B, \
1839 #define _PORT_PLL_0_A 0x162100
1840 #define _PORT_PLL_0_B 0x6C100
1841 #define _PORT_PLL_0_C 0x6C380
1843 #define PORT_PLL_M2_MASK 0xFF
1845 #define PORT_PLL_N_SHIFT 8
1846 #define PORT_PLL_N_MASK (0x0F << PORT_PLL_N_SHIFT)
1847 #define PORT_PLL_N(x) ((x) << PORT_PLL_N_SHIFT)
1849 #define PORT_PLL_M2_FRAC_MASK 0x3FFFFF
1851 #define PORT_PLL_M2_FRAC_ENABLE (1 << 16)
1853 #define PORT_PLL_PROP_COEFF_MASK 0xF
1854 #define PORT_PLL_INT_COEFF_MASK (0x1F << 8)
1855 #define PORT_PLL_INT_COEFF(x) ((x) << 8)
1856 #define PORT_PLL_GAIN_CTL_MASK (0x07 << 16)
1857 #define PORT_PLL_GAIN_CTL(x) ((x) << 16)
1859 #define PORT_PLL_TARGET_CNT_MASK 0x3FF
1861 #define PORT_PLL_LOCK_THRESHOLD_SHIFT 1
1862 #define PORT_PLL_LOCK_THRESHOLD_MASK (0x7 << PORT_PLL_LOCK_THRESHOLD_SHIFT)
1864 #define PORT_PLL_DCO_AMP_OVR_EN_H (1 << 27)
1865 #define PORT_PLL_DCO_AMP_DEFAULT 15
1866 #define PORT_PLL_DCO_AMP_MASK 0x3c00
1867 #define PORT_PLL_DCO_AMP(x) ((x) << 10)
1868 #define _PORT_PLL_BASE(phy, ch) _BXT_PHY_CH(phy, ch, \
1871 #define BXT_PORT_PLL(phy, ch, idx) _MMIO(_PORT_PLL_BASE(phy, ch) + \
1874 /* BXT PHY common lane registers */
1875 #define _PORT_CL1CM_DW0_A 0x162000
1876 #define _PORT_CL1CM_DW0_BC 0x6C000
1877 #define PHY_POWER_GOOD (1 << 16)
1878 #define PHY_RESERVED (1 << 7)
1879 #define BXT_PORT_CL1CM_DW0(phy) _BXT_PHY((phy), _PORT_CL1CM_DW0_BC)
1881 #define _PORT_CL1CM_DW9_A 0x162024
1882 #define _PORT_CL1CM_DW9_BC 0x6C024
1883 #define IREF0RC_OFFSET_SHIFT 8
1884 #define IREF0RC_OFFSET_MASK (0xFF << IREF0RC_OFFSET_SHIFT)
1885 #define BXT_PORT_CL1CM_DW9(phy) _BXT_PHY((phy), _PORT_CL1CM_DW9_BC)
1887 #define _PORT_CL1CM_DW10_A 0x162028
1888 #define _PORT_CL1CM_DW10_BC 0x6C028
1889 #define IREF1RC_OFFSET_SHIFT 8
1890 #define IREF1RC_OFFSET_MASK (0xFF << IREF1RC_OFFSET_SHIFT)
1891 #define BXT_PORT_CL1CM_DW10(phy) _BXT_PHY((phy), _PORT_CL1CM_DW10_BC)
1893 #define _PORT_CL1CM_DW28_A 0x162070
1894 #define _PORT_CL1CM_DW28_BC 0x6C070
1895 #define OCL1_POWER_DOWN_EN (1 << 23)
1896 #define DW28_OLDO_DYN_PWR_DOWN_EN (1 << 22)
1897 #define SUS_CLK_CONFIG 0x3
1898 #define BXT_PORT_CL1CM_DW28(phy) _BXT_PHY((phy), _PORT_CL1CM_DW28_BC)
1900 #define _PORT_CL1CM_DW30_A 0x162078
1901 #define _PORT_CL1CM_DW30_BC 0x6C078
1902 #define OCL2_LDOFUSE_PWR_DIS (1 << 6)
1903 #define BXT_PORT_CL1CM_DW30(phy) _BXT_PHY((phy), _PORT_CL1CM_DW30_BC)
1906 * ICL Port/COMBO-PHY Registers
1908 #define _ICL_COMBOPHY_A 0x162000
1909 #define _ICL_COMBOPHY_B 0x6C000
1910 #define _EHL_COMBOPHY_C 0x160000
1911 #define _RKL_COMBOPHY_D 0x161000
1912 #define _ADL_COMBOPHY_E 0x16B000
1914 #define _ICL_COMBOPHY(phy) _PICK(phy, _ICL_COMBOPHY_A, \
1920 /* ICL Port CL_DW registers */
1921 #define _ICL_PORT_CL_DW(dw, phy) (_ICL_COMBOPHY(phy) + \
1924 #define ICL_PORT_CL_DW5(phy) _MMIO(_ICL_PORT_CL_DW(5, phy))
1925 #define CL_POWER_DOWN_ENABLE (1 << 4)
1926 #define SUS_CLOCK_CONFIG (3 << 0)
1928 #define ICL_PORT_CL_DW10(phy) _MMIO(_ICL_PORT_CL_DW(10, phy))
1929 #define PG_SEQ_DELAY_OVERRIDE_MASK (3 << 25)
1930 #define PG_SEQ_DELAY_OVERRIDE_SHIFT 25
1931 #define PG_SEQ_DELAY_OVERRIDE_ENABLE (1 << 24)
1932 #define PWR_UP_ALL_LANES (0x0 << 4)
1933 #define PWR_DOWN_LN_3_2_1 (0xe << 4)
1934 #define PWR_DOWN_LN_3_2 (0xc << 4)
1935 #define PWR_DOWN_LN_3 (0x8 << 4)
1936 #define PWR_DOWN_LN_2_1_0 (0x7 << 4)
1937 #define PWR_DOWN_LN_1_0 (0x3 << 4)
1938 #define PWR_DOWN_LN_3_1 (0xa << 4)
1939 #define PWR_DOWN_LN_3_1_0 (0xb << 4)
1940 #define PWR_DOWN_LN_MASK (0xf << 4)
1941 #define PWR_DOWN_LN_SHIFT 4
1942 #define EDP4K2K_MODE_OVRD_EN (1 << 3)
1943 #define EDP4K2K_MODE_OVRD_OPTIMIZED (1 << 2)
1945 #define ICL_PORT_CL_DW12(phy) _MMIO(_ICL_PORT_CL_DW(12, phy))
1946 #define ICL_LANE_ENABLE_AUX (1 << 0)
1948 /* ICL Port COMP_DW registers */
1949 #define _ICL_PORT_COMP 0x100
1950 #define _ICL_PORT_COMP_DW(dw, phy) (_ICL_COMBOPHY(phy) + \
1951 _ICL_PORT_COMP + 4 * (dw))
1953 #define ICL_PORT_COMP_DW0(phy) _MMIO(_ICL_PORT_COMP_DW(0, phy))
1954 #define COMP_INIT (1 << 31)
1956 #define ICL_PORT_COMP_DW1(phy) _MMIO(_ICL_PORT_COMP_DW(1, phy))
1958 #define ICL_PORT_COMP_DW3(phy) _MMIO(_ICL_PORT_COMP_DW(3, phy))
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
1970 #define ICL_PORT_COMP_DW8(phy) _MMIO(_ICL_PORT_COMP_DW(8, phy))
1971 #define IREFGEN (1 << 24)
1973 #define ICL_PORT_COMP_DW9(phy) _MMIO(_ICL_PORT_COMP_DW(9, phy))
1975 #define ICL_PORT_COMP_DW10(phy) _MMIO(_ICL_PORT_COMP_DW(10, phy))
1977 /* ICL Port PCS registers */
1978 #define _ICL_PORT_PCS_AUX 0x300
1979 #define _ICL_PORT_PCS_GRP 0x600
1980 #define _ICL_PORT_PCS_LN(ln) (0x800 + (ln) * 0x100)
1981 #define _ICL_PORT_PCS_DW_AUX(dw, phy) (_ICL_COMBOPHY(phy) + \
1982 _ICL_PORT_PCS_AUX + 4 * (dw))
1983 #define _ICL_PORT_PCS_DW_GRP(dw, phy) (_ICL_COMBOPHY(phy) + \
1984 _ICL_PORT_PCS_GRP + 4 * (dw))
1985 #define _ICL_PORT_PCS_DW_LN(dw, ln, phy) (_ICL_COMBOPHY(phy) + \
1986 _ICL_PORT_PCS_LN(ln) + 4 * (dw))
1987 #define ICL_PORT_PCS_DW1_AUX(phy) _MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
1988 #define ICL_PORT_PCS_DW1_GRP(phy) _MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
1989 #define ICL_PORT_PCS_DW1_LN(ln, phy) _MMIO(_ICL_PORT_PCS_DW_LN(1, ln, phy))
1990 #define DCC_MODE_SELECT_MASK (0x3 << 20)
1991 #define DCC_MODE_SELECT_CONTINUOSLY (0x3 << 20)
1992 #define COMMON_KEEPER_EN (1 << 26)
1993 #define LATENCY_OPTIM_MASK (0x3 << 2)
1994 #define LATENCY_OPTIM_VAL(x) ((x) << 2)
1996 /* ICL Port TX registers */
1997 #define _ICL_PORT_TX_AUX 0x380
1998 #define _ICL_PORT_TX_GRP 0x680
1999 #define _ICL_PORT_TX_LN(ln) (0x880 + (ln) * 0x100)
2001 #define _ICL_PORT_TX_DW_AUX(dw, phy) (_ICL_COMBOPHY(phy) + \
2002 _ICL_PORT_TX_AUX + 4 * (dw))
2003 #define _ICL_PORT_TX_DW_GRP(dw, phy) (_ICL_COMBOPHY(phy) + \
2004 _ICL_PORT_TX_GRP + 4 * (dw))
2005 #define _ICL_PORT_TX_DW_LN(dw, ln, phy) (_ICL_COMBOPHY(phy) + \
2006 _ICL_PORT_TX_LN(ln) + 4 * (dw))
2008 #define ICL_PORT_TX_DW2_AUX(phy) _MMIO(_ICL_PORT_TX_DW_AUX(2, phy))
2009 #define ICL_PORT_TX_DW2_GRP(phy) _MMIO(_ICL_PORT_TX_DW_GRP(2, phy))
2010 #define ICL_PORT_TX_DW2_LN(ln, phy) _MMIO(_ICL_PORT_TX_DW_LN(2, ln, phy))
2011 #define SWING_SEL_UPPER(x) (((x) >> 3) << 15)
2012 #define SWING_SEL_UPPER_MASK (1 << 15)
2013 #define SWING_SEL_LOWER(x) (((x) & 0x7) << 11)
2014 #define SWING_SEL_LOWER_MASK (0x7 << 11)
2015 #define FRC_LATENCY_OPTIM_MASK (0x7 << 8)
2016 #define FRC_LATENCY_OPTIM_VAL(x) ((x) << 8)
2017 #define RCOMP_SCALAR(x) ((x) << 0)
2018 #define RCOMP_SCALAR_MASK (0xFF << 0)
2020 #define ICL_PORT_TX_DW4_AUX(phy) _MMIO(_ICL_PORT_TX_DW_AUX(4, phy))
2021 #define ICL_PORT_TX_DW4_GRP(phy) _MMIO(_ICL_PORT_TX_DW_GRP(4, phy))
2022 #define ICL_PORT_TX_DW4_LN(ln, phy) _MMIO(_ICL_PORT_TX_DW_LN(4, ln, phy))
2023 #define LOADGEN_SELECT (1 << 31)
2024 #define POST_CURSOR_1(x) ((x) << 12)
2025 #define POST_CURSOR_1_MASK (0x3F << 12)
2026 #define POST_CURSOR_2(x) ((x) << 6)
2027 #define POST_CURSOR_2_MASK (0x3F << 6)
2028 #define CURSOR_COEFF(x) ((x) << 0)
2029 #define CURSOR_COEFF_MASK (0x3F << 0)
2031 #define ICL_PORT_TX_DW5_AUX(phy) _MMIO(_ICL_PORT_TX_DW_AUX(5, phy))
2032 #define ICL_PORT_TX_DW5_GRP(phy) _MMIO(_ICL_PORT_TX_DW_GRP(5, phy))
2033 #define ICL_PORT_TX_DW5_LN(ln, phy) _MMIO(_ICL_PORT_TX_DW_LN(5, ln, phy))
2034 #define TX_TRAINING_EN (1 << 31)
2035 #define TAP2_DISABLE (1 << 30)
2036 #define TAP3_DISABLE (1 << 29)
2037 #define SCALING_MODE_SEL(x) ((x) << 18)
2038 #define SCALING_MODE_SEL_MASK (0x7 << 18)
2039 #define RTERM_SELECT(x) ((x) << 3)
2040 #define RTERM_SELECT_MASK (0x7 << 3)
2042 #define ICL_PORT_TX_DW7_AUX(phy) _MMIO(_ICL_PORT_TX_DW_AUX(7, phy))
2043 #define ICL_PORT_TX_DW7_GRP(phy) _MMIO(_ICL_PORT_TX_DW_GRP(7, phy))
2044 #define ICL_PORT_TX_DW7_LN(ln, phy) _MMIO(_ICL_PORT_TX_DW_LN(7, ln, phy))
2045 #define N_SCALAR(x) ((x) << 24)
2046 #define N_SCALAR_MASK (0x7F << 24)
2048 #define ICL_PORT_TX_DW8_AUX(phy) _MMIO(_ICL_PORT_TX_DW_AUX(8, phy))
2049 #define ICL_PORT_TX_DW8_GRP(phy) _MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
2050 #define ICL_PORT_TX_DW8_LN(ln, phy) _MMIO(_ICL_PORT_TX_DW_LN(8, ln, phy))
2051 #define ICL_PORT_TX_DW8_ODCC_CLK_SEL REG_BIT(31)
2052 #define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK REG_GENMASK(30, 29)
2053 #define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2 REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
2055 #define _ICL_DPHY_CHKN_REG 0x194
2056 #define ICL_DPHY_CHKN(port) _MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
2057 #define ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP REG_BIT(7)
2059 #define MG_PHY_PORT_LN(ln, tc_port, ln0p1, ln0p2, ln1p1) \
2060 _MMIO(_PORT(tc_port, ln0p1, ln0p2) + (ln) * ((ln1p1) - (ln0p1)))
2062 #define MG_TX_LINK_PARAMS_TX1LN0_PORT1 0x16812C
2063 #define MG_TX_LINK_PARAMS_TX1LN1_PORT1 0x16852C
2064 #define MG_TX_LINK_PARAMS_TX1LN0_PORT2 0x16912C
2065 #define MG_TX_LINK_PARAMS_TX1LN1_PORT2 0x16952C
2066 #define MG_TX_LINK_PARAMS_TX1LN0_PORT3 0x16A12C
2067 #define MG_TX_LINK_PARAMS_TX1LN1_PORT3 0x16A52C
2068 #define MG_TX_LINK_PARAMS_TX1LN0_PORT4 0x16B12C
2069 #define MG_TX_LINK_PARAMS_TX1LN1_PORT4 0x16B52C
2070 #define MG_TX1_LINK_PARAMS(ln, tc_port) \
2071 MG_PHY_PORT_LN(ln, tc_port, MG_TX_LINK_PARAMS_TX1LN0_PORT1, \
2072 MG_TX_LINK_PARAMS_TX1LN0_PORT2, \
2073 MG_TX_LINK_PARAMS_TX1LN1_PORT1)
2075 #define MG_TX_LINK_PARAMS_TX2LN0_PORT1 0x1680AC
2076 #define MG_TX_LINK_PARAMS_TX2LN1_PORT1 0x1684AC
2077 #define MG_TX_LINK_PARAMS_TX2LN0_PORT2 0x1690AC
2078 #define MG_TX_LINK_PARAMS_TX2LN1_PORT2 0x1694AC
2079 #define MG_TX_LINK_PARAMS_TX2LN0_PORT3 0x16A0AC
2080 #define MG_TX_LINK_PARAMS_TX2LN1_PORT3 0x16A4AC
2081 #define MG_TX_LINK_PARAMS_TX2LN0_PORT4 0x16B0AC
2082 #define MG_TX_LINK_PARAMS_TX2LN1_PORT4 0x16B4AC
2083 #define MG_TX2_LINK_PARAMS(ln, tc_port) \
2084 MG_PHY_PORT_LN(ln, tc_port, MG_TX_LINK_PARAMS_TX2LN0_PORT1, \
2085 MG_TX_LINK_PARAMS_TX2LN0_PORT2, \
2086 MG_TX_LINK_PARAMS_TX2LN1_PORT1)
2087 #define CRI_USE_FS32 (1 << 5)
2089 #define MG_TX_PISO_READLOAD_TX1LN0_PORT1 0x16814C
2090 #define MG_TX_PISO_READLOAD_TX1LN1_PORT1 0x16854C
2091 #define MG_TX_PISO_READLOAD_TX1LN0_PORT2 0x16914C
2092 #define MG_TX_PISO_READLOAD_TX1LN1_PORT2 0x16954C
2093 #define MG_TX_PISO_READLOAD_TX1LN0_PORT3 0x16A14C
2094 #define MG_TX_PISO_READLOAD_TX1LN1_PORT3 0x16A54C
2095 #define MG_TX_PISO_READLOAD_TX1LN0_PORT4 0x16B14C
2096 #define MG_TX_PISO_READLOAD_TX1LN1_PORT4 0x16B54C
2097 #define MG_TX1_PISO_READLOAD(ln, tc_port) \
2098 MG_PHY_PORT_LN(ln, tc_port, MG_TX_PISO_READLOAD_TX1LN0_PORT1, \
2099 MG_TX_PISO_READLOAD_TX1LN0_PORT2, \
2100 MG_TX_PISO_READLOAD_TX1LN1_PORT1)
2102 #define MG_TX_PISO_READLOAD_TX2LN0_PORT1 0x1680CC
2103 #define MG_TX_PISO_READLOAD_TX2LN1_PORT1 0x1684CC
2104 #define MG_TX_PISO_READLOAD_TX2LN0_PORT2 0x1690CC
2105 #define MG_TX_PISO_READLOAD_TX2LN1_PORT2 0x1694CC
2106 #define MG_TX_PISO_READLOAD_TX2LN0_PORT3 0x16A0CC
2107 #define MG_TX_PISO_READLOAD_TX2LN1_PORT3 0x16A4CC
2108 #define MG_TX_PISO_READLOAD_TX2LN0_PORT4 0x16B0CC
2109 #define MG_TX_PISO_READLOAD_TX2LN1_PORT4 0x16B4CC
2110 #define MG_TX2_PISO_READLOAD(ln, tc_port) \
2111 MG_PHY_PORT_LN(ln, tc_port, MG_TX_PISO_READLOAD_TX2LN0_PORT1, \
2112 MG_TX_PISO_READLOAD_TX2LN0_PORT2, \
2113 MG_TX_PISO_READLOAD_TX2LN1_PORT1)
2114 #define CRI_CALCINIT (1 << 1)
2116 #define MG_TX_SWINGCTRL_TX1LN0_PORT1 0x168148
2117 #define MG_TX_SWINGCTRL_TX1LN1_PORT1 0x168548
2118 #define MG_TX_SWINGCTRL_TX1LN0_PORT2 0x169148
2119 #define MG_TX_SWINGCTRL_TX1LN1_PORT2 0x169548
2120 #define MG_TX_SWINGCTRL_TX1LN0_PORT3 0x16A148
2121 #define MG_TX_SWINGCTRL_TX1LN1_PORT3 0x16A548
2122 #define MG_TX_SWINGCTRL_TX1LN0_PORT4 0x16B148
2123 #define MG_TX_SWINGCTRL_TX1LN1_PORT4 0x16B548
2124 #define MG_TX1_SWINGCTRL(ln, tc_port) \
2125 MG_PHY_PORT_LN(ln, tc_port, MG_TX_SWINGCTRL_TX1LN0_PORT1, \
2126 MG_TX_SWINGCTRL_TX1LN0_PORT2, \
2127 MG_TX_SWINGCTRL_TX1LN1_PORT1)
2129 #define MG_TX_SWINGCTRL_TX2LN0_PORT1 0x1680C8
2130 #define MG_TX_SWINGCTRL_TX2LN1_PORT1 0x1684C8
2131 #define MG_TX_SWINGCTRL_TX2LN0_PORT2 0x1690C8
2132 #define MG_TX_SWINGCTRL_TX2LN1_PORT2 0x1694C8
2133 #define MG_TX_SWINGCTRL_TX2LN0_PORT3 0x16A0C8
2134 #define MG_TX_SWINGCTRL_TX2LN1_PORT3 0x16A4C8
2135 #define MG_TX_SWINGCTRL_TX2LN0_PORT4 0x16B0C8
2136 #define MG_TX_SWINGCTRL_TX2LN1_PORT4 0x16B4C8
2137 #define MG_TX2_SWINGCTRL(ln, tc_port) \
2138 MG_PHY_PORT_LN(ln, tc_port, MG_TX_SWINGCTRL_TX2LN0_PORT1, \
2139 MG_TX_SWINGCTRL_TX2LN0_PORT2, \
2140 MG_TX_SWINGCTRL_TX2LN1_PORT1)
2141 #define CRI_TXDEEMPH_OVERRIDE_17_12(x) ((x) << 0)
2142 #define CRI_TXDEEMPH_OVERRIDE_17_12_MASK (0x3F << 0)
2144 #define MG_TX_DRVCTRL_TX1LN0_TXPORT1 0x168144
2145 #define MG_TX_DRVCTRL_TX1LN1_TXPORT1 0x168544
2146 #define MG_TX_DRVCTRL_TX1LN0_TXPORT2 0x169144
2147 #define MG_TX_DRVCTRL_TX1LN1_TXPORT2 0x169544
2148 #define MG_TX_DRVCTRL_TX1LN0_TXPORT3 0x16A144
2149 #define MG_TX_DRVCTRL_TX1LN1_TXPORT3 0x16A544
2150 #define MG_TX_DRVCTRL_TX1LN0_TXPORT4 0x16B144
2151 #define MG_TX_DRVCTRL_TX1LN1_TXPORT4 0x16B544
2152 #define MG_TX1_DRVCTRL(ln, tc_port) \
2153 MG_PHY_PORT_LN(ln, tc_port, MG_TX_DRVCTRL_TX1LN0_TXPORT1, \
2154 MG_TX_DRVCTRL_TX1LN0_TXPORT2, \
2155 MG_TX_DRVCTRL_TX1LN1_TXPORT1)
2157 #define MG_TX_DRVCTRL_TX2LN0_PORT1 0x1680C4
2158 #define MG_TX_DRVCTRL_TX2LN1_PORT1 0x1684C4
2159 #define MG_TX_DRVCTRL_TX2LN0_PORT2 0x1690C4
2160 #define MG_TX_DRVCTRL_TX2LN1_PORT2 0x1694C4
2161 #define MG_TX_DRVCTRL_TX2LN0_PORT3 0x16A0C4
2162 #define MG_TX_DRVCTRL_TX2LN1_PORT3 0x16A4C4
2163 #define MG_TX_DRVCTRL_TX2LN0_PORT4 0x16B0C4
2164 #define MG_TX_DRVCTRL_TX2LN1_PORT4 0x16B4C4
2165 #define MG_TX2_DRVCTRL(ln, tc_port) \
2166 MG_PHY_PORT_LN(ln, tc_port, MG_TX_DRVCTRL_TX2LN0_PORT1, \
2167 MG_TX_DRVCTRL_TX2LN0_PORT2, \
2168 MG_TX_DRVCTRL_TX2LN1_PORT1)
2169 #define CRI_TXDEEMPH_OVERRIDE_11_6(x) ((x) << 24)
2170 #define CRI_TXDEEMPH_OVERRIDE_11_6_MASK (0x3F << 24)
2171 #define CRI_TXDEEMPH_OVERRIDE_EN (1 << 22)
2172 #define CRI_TXDEEMPH_OVERRIDE_5_0(x) ((x) << 16)
2173 #define CRI_TXDEEMPH_OVERRIDE_5_0_MASK (0x3F << 16)
2174 #define CRI_LOADGEN_SEL(x) ((x) << 12)
2175 #define CRI_LOADGEN_SEL_MASK (0x3 << 12)
2177 #define MG_CLKHUB_LN0_PORT1 0x16839C
2178 #define MG_CLKHUB_LN1_PORT1 0x16879C
2179 #define MG_CLKHUB_LN0_PORT2 0x16939C
2180 #define MG_CLKHUB_LN1_PORT2 0x16979C
2181 #define MG_CLKHUB_LN0_PORT3 0x16A39C
2182 #define MG_CLKHUB_LN1_PORT3 0x16A79C
2183 #define MG_CLKHUB_LN0_PORT4 0x16B39C
2184 #define MG_CLKHUB_LN1_PORT4 0x16B79C
2185 #define MG_CLKHUB(ln, tc_port) \
2186 MG_PHY_PORT_LN(ln, tc_port, MG_CLKHUB_LN0_PORT1, \
2187 MG_CLKHUB_LN0_PORT2, \
2188 MG_CLKHUB_LN1_PORT1)
2189 #define CFG_LOW_RATE_LKREN_EN (1 << 11)
2191 #define MG_TX_DCC_TX1LN0_PORT1 0x168110
2192 #define MG_TX_DCC_TX1LN1_PORT1 0x168510
2193 #define MG_TX_DCC_TX1LN0_PORT2 0x169110
2194 #define MG_TX_DCC_TX1LN1_PORT2 0x169510
2195 #define MG_TX_DCC_TX1LN0_PORT3 0x16A110
2196 #define MG_TX_DCC_TX1LN1_PORT3 0x16A510
2197 #define MG_TX_DCC_TX1LN0_PORT4 0x16B110
2198 #define MG_TX_DCC_TX1LN1_PORT4 0x16B510
2199 #define MG_TX1_DCC(ln, tc_port) \
2200 MG_PHY_PORT_LN(ln, tc_port, MG_TX_DCC_TX1LN0_PORT1, \
2201 MG_TX_DCC_TX1LN0_PORT2, \
2202 MG_TX_DCC_TX1LN1_PORT1)
2203 #define MG_TX_DCC_TX2LN0_PORT1 0x168090
2204 #define MG_TX_DCC_TX2LN1_PORT1 0x168490
2205 #define MG_TX_DCC_TX2LN0_PORT2 0x169090
2206 #define MG_TX_DCC_TX2LN1_PORT2 0x169490
2207 #define MG_TX_DCC_TX2LN0_PORT3 0x16A090
2208 #define MG_TX_DCC_TX2LN1_PORT3 0x16A490
2209 #define MG_TX_DCC_TX2LN0_PORT4 0x16B090
2210 #define MG_TX_DCC_TX2LN1_PORT4 0x16B490
2211 #define MG_TX2_DCC(ln, tc_port) \
2212 MG_PHY_PORT_LN(ln, tc_port, MG_TX_DCC_TX2LN0_PORT1, \
2213 MG_TX_DCC_TX2LN0_PORT2, \
2214 MG_TX_DCC_TX2LN1_PORT1)
2215 #define CFG_AMI_CK_DIV_OVERRIDE_VAL(x) ((x) << 25)
2216 #define CFG_AMI_CK_DIV_OVERRIDE_VAL_MASK (0x3 << 25)
2217 #define CFG_AMI_CK_DIV_OVERRIDE_EN (1 << 24)
2219 #define MG_DP_MODE_LN0_ACU_PORT1 0x1683A0
2220 #define MG_DP_MODE_LN1_ACU_PORT1 0x1687A0
2221 #define MG_DP_MODE_LN0_ACU_PORT2 0x1693A0
2222 #define MG_DP_MODE_LN1_ACU_PORT2 0x1697A0
2223 #define MG_DP_MODE_LN0_ACU_PORT3 0x16A3A0
2224 #define MG_DP_MODE_LN1_ACU_PORT3 0x16A7A0
2225 #define MG_DP_MODE_LN0_ACU_PORT4 0x16B3A0
2226 #define MG_DP_MODE_LN1_ACU_PORT4 0x16B7A0
2227 #define MG_DP_MODE(ln, tc_port) \
2228 MG_PHY_PORT_LN(ln, tc_port, MG_DP_MODE_LN0_ACU_PORT1, \
2229 MG_DP_MODE_LN0_ACU_PORT2, \
2230 MG_DP_MODE_LN1_ACU_PORT1)
2231 #define MG_DP_MODE_CFG_DP_X2_MODE (1 << 7)
2232 #define MG_DP_MODE_CFG_DP_X1_MODE (1 << 6)
2235 * DG2 SNPS PHY registers (TC1 = PHY_E)
2237 #define _SNPS_PHY_A_BASE 0x168000
2238 #define _SNPS_PHY_B_BASE 0x169000
2239 #define _SNPS_PHY(phy) _PHY(phy, \
2242 #define _SNPS2(phy, reg) (_SNPS_PHY(phy) - \
2243 _SNPS_PHY_A_BASE + (reg))
2244 #define _MMIO_SNPS(phy, reg) _MMIO(_SNPS2(phy, reg))
2245 #define _MMIO_SNPS_LN(ln, phy, reg) _MMIO(_SNPS2(phy, \
2246 (reg) + (ln) * 0x10))
2248 #define SNPS_PHY_MPLLB_CP(phy) _MMIO_SNPS(phy, 0x168000)
2249 #define SNPS_PHY_MPLLB_CP_INT REG_GENMASK(31, 25)
2250 #define SNPS_PHY_MPLLB_CP_INT_GS REG_GENMASK(23, 17)
2251 #define SNPS_PHY_MPLLB_CP_PROP REG_GENMASK(15, 9)
2252 #define SNPS_PHY_MPLLB_CP_PROP_GS REG_GENMASK(7, 1)
2254 #define SNPS_PHY_MPLLB_DIV(phy) _MMIO_SNPS(phy, 0x168004)
2255 #define SNPS_PHY_MPLLB_FORCE_EN REG_BIT(31)
2256 #define SNPS_PHY_MPLLB_DIV_CLK_EN REG_BIT(30)
2257 #define SNPS_PHY_MPLLB_DIV5_CLK_EN REG_BIT(29)
2258 #define SNPS_PHY_MPLLB_V2I REG_GENMASK(27, 26)
2259 #define SNPS_PHY_MPLLB_FREQ_VCO REG_GENMASK(25, 24)
2260 #define SNPS_PHY_MPLLB_DIV_MULTIPLIER REG_GENMASK(23, 16)
2261 #define SNPS_PHY_MPLLB_PMIX_EN REG_BIT(10)
2262 #define SNPS_PHY_MPLLB_DP2_MODE REG_BIT(9)
2263 #define SNPS_PHY_MPLLB_WORD_DIV2_EN REG_BIT(8)
2264 #define SNPS_PHY_MPLLB_TX_CLK_DIV REG_GENMASK(7, 5)
2266 #define SNPS_PHY_MPLLB_FRACN1(phy) _MMIO_SNPS(phy, 0x168008)
2267 #define SNPS_PHY_MPLLB_FRACN_EN REG_BIT(31)
2268 #define SNPS_PHY_MPLLB_FRACN_CGG_UPDATE_EN REG_BIT(30)
2269 #define SNPS_PHY_MPLLB_FRACN_DEN REG_GENMASK(15, 0)
2271 #define SNPS_PHY_MPLLB_FRACN2(phy) _MMIO_SNPS(phy, 0x16800C)
2272 #define SNPS_PHY_MPLLB_FRACN_REM REG_GENMASK(31, 16)
2273 #define SNPS_PHY_MPLLB_FRACN_QUOT REG_GENMASK(15, 0)
2275 #define SNPS_PHY_MPLLB_SSCEN(phy) _MMIO_SNPS(phy, 0x168014)
2276 #define SNPS_PHY_MPLLB_SSC_EN REG_BIT(31)
2277 #define SNPS_PHY_MPLLB_SSC_UP_SPREAD REG_BIT(30)
2278 #define SNPS_PHY_MPLLB_SSC_PEAK REG_GENMASK(29, 10)
2280 #define SNPS_PHY_MPLLB_SSCSTEP(phy) _MMIO_SNPS(phy, 0x168018)
2281 #define SNPS_PHY_MPLLB_SSC_STEPSIZE REG_GENMASK(31, 11)
2283 #define SNPS_PHY_MPLLB_DIV2(phy) _MMIO_SNPS(phy, 0x16801C)
2284 #define SNPS_PHY_MPLLB_HDMI_PIXEL_CLK_DIV REG_GENMASK(19, 18)
2285 #define SNPS_PHY_MPLLB_HDMI_DIV REG_GENMASK(17, 15)
2286 #define SNPS_PHY_MPLLB_REF_CLK_DIV REG_GENMASK(14, 12)
2287 #define SNPS_PHY_MPLLB_MULTIPLIER REG_GENMASK(11, 0)
2289 #define SNPS_PHY_REF_CONTROL(phy) _MMIO_SNPS(phy, 0x168188)
2290 #define SNPS_PHY_REF_CONTROL_REF_RANGE REG_GENMASK(31, 27)
2292 #define SNPS_PHY_TX_REQ(phy) _MMIO_SNPS(phy, 0x168200)
2293 #define SNPS_PHY_TX_REQ_LN_DIS_PWR_STATE_PSR REG_GENMASK(31, 30)
2295 #define SNPS_PHY_TX_EQ(ln, phy) _MMIO_SNPS_LN(ln, phy, 0x168300)
2296 #define SNPS_PHY_TX_EQ_MAIN REG_GENMASK(23, 18)
2297 #define SNPS_PHY_TX_EQ_POST REG_GENMASK(15, 10)
2298 #define SNPS_PHY_TX_EQ_PRE REG_GENMASK(7, 2)
2300 /* The spec defines this only for BXT PHY0, but lets assume that this
2301 * would exist for PHY1 too if it had a second channel.
2303 #define _PORT_CL2CM_DW6_A 0x162358
2304 #define _PORT_CL2CM_DW6_BC 0x6C358
2305 #define BXT_PORT_CL2CM_DW6(phy) _BXT_PHY((phy), _PORT_CL2CM_DW6_BC)
2306 #define DW6_OLDO_DYN_PWR_DOWN_EN (1 << 28)
2308 #define FIA1_BASE 0x163000
2309 #define FIA2_BASE 0x16E000
2310 #define FIA3_BASE 0x16F000
2311 #define _FIA(fia) _PICK((fia), FIA1_BASE, FIA2_BASE, FIA3_BASE)
2312 #define _MMIO_FIA(fia, off) _MMIO(_FIA(fia) + (off))
2314 /* ICL PHY DFLEX registers */
2315 #define PORT_TX_DFLEXDPMLE1(fia) _MMIO_FIA((fia), 0x008C0)
2316 #define DFLEXDPMLE1_DPMLETC_MASK(idx) (0xf << (4 * (idx)))
2317 #define DFLEXDPMLE1_DPMLETC_ML0(idx) (1 << (4 * (idx)))
2318 #define DFLEXDPMLE1_DPMLETC_ML1_0(idx) (3 << (4 * (idx)))
2319 #define DFLEXDPMLE1_DPMLETC_ML3(idx) (8 << (4 * (idx)))
2320 #define DFLEXDPMLE1_DPMLETC_ML3_2(idx) (12 << (4 * (idx)))
2321 #define DFLEXDPMLE1_DPMLETC_ML3_0(idx) (15 << (4 * (idx)))
2323 /* BXT PHY Ref registers */
2324 #define _PORT_REF_DW3_A 0x16218C
2325 #define _PORT_REF_DW3_BC 0x6C18C
2326 #define GRC_DONE (1 << 22)
2327 #define BXT_PORT_REF_DW3(phy) _BXT_PHY((phy), _PORT_REF_DW3_BC)
2329 #define _PORT_REF_DW6_A 0x162198
2330 #define _PORT_REF_DW6_BC 0x6C198
2331 #define GRC_CODE_SHIFT 24
2332 #define GRC_CODE_MASK (0xFF << GRC_CODE_SHIFT)
2333 #define GRC_CODE_FAST_SHIFT 16
2334 #define GRC_CODE_FAST_MASK (0xFF << GRC_CODE_FAST_SHIFT)
2335 #define GRC_CODE_SLOW_SHIFT 8
2336 #define GRC_CODE_SLOW_MASK (0xFF << GRC_CODE_SLOW_SHIFT)
2337 #define GRC_CODE_NOM_MASK 0xFF
2338 #define BXT_PORT_REF_DW6(phy) _BXT_PHY((phy), _PORT_REF_DW6_BC)
2340 #define _PORT_REF_DW8_A 0x1621A0
2341 #define _PORT_REF_DW8_BC 0x6C1A0
2342 #define GRC_DIS (1 << 15)
2343 #define GRC_RDY_OVRD (1 << 1)
2344 #define BXT_PORT_REF_DW8(phy) _BXT_PHY((phy), _PORT_REF_DW8_BC)
2346 /* BXT PHY PCS registers */
2347 #define _PORT_PCS_DW10_LN01_A 0x162428
2348 #define _PORT_PCS_DW10_LN01_B 0x6C428
2349 #define _PORT_PCS_DW10_LN01_C 0x6C828
2350 #define _PORT_PCS_DW10_GRP_A 0x162C28
2351 #define _PORT_PCS_DW10_GRP_B 0x6CC28
2352 #define _PORT_PCS_DW10_GRP_C 0x6CE28
2353 #define BXT_PORT_PCS_DW10_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2354 _PORT_PCS_DW10_LN01_B, \
2355 _PORT_PCS_DW10_LN01_C)
2356 #define BXT_PORT_PCS_DW10_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2357 _PORT_PCS_DW10_GRP_B, \
2358 _PORT_PCS_DW10_GRP_C)
2360 #define TX2_SWING_CALC_INIT (1 << 31)
2361 #define TX1_SWING_CALC_INIT (1 << 30)
2363 #define _PORT_PCS_DW12_LN01_A 0x162430
2364 #define _PORT_PCS_DW12_LN01_B 0x6C430
2365 #define _PORT_PCS_DW12_LN01_C 0x6C830
2366 #define _PORT_PCS_DW12_LN23_A 0x162630
2367 #define _PORT_PCS_DW12_LN23_B 0x6C630
2368 #define _PORT_PCS_DW12_LN23_C 0x6CA30
2369 #define _PORT_PCS_DW12_GRP_A 0x162c30
2370 #define _PORT_PCS_DW12_GRP_B 0x6CC30
2371 #define _PORT_PCS_DW12_GRP_C 0x6CE30
2372 #define LANESTAGGER_STRAP_OVRD (1 << 6)
2373 #define LANE_STAGGER_MASK 0x1F
2374 #define BXT_PORT_PCS_DW12_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2375 _PORT_PCS_DW12_LN01_B, \
2376 _PORT_PCS_DW12_LN01_C)
2377 #define BXT_PORT_PCS_DW12_LN23(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2378 _PORT_PCS_DW12_LN23_B, \
2379 _PORT_PCS_DW12_LN23_C)
2380 #define BXT_PORT_PCS_DW12_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2381 _PORT_PCS_DW12_GRP_B, \
2382 _PORT_PCS_DW12_GRP_C)
2384 /* BXT PHY TX registers */
2385 #define _BXT_LANE_OFFSET(lane) (((lane) >> 1) * 0x200 + \
2386 ((lane) & 1) * 0x80)
2388 #define _PORT_TX_DW2_LN0_A 0x162508
2389 #define _PORT_TX_DW2_LN0_B 0x6C508
2390 #define _PORT_TX_DW2_LN0_C 0x6C908
2391 #define _PORT_TX_DW2_GRP_A 0x162D08
2392 #define _PORT_TX_DW2_GRP_B 0x6CD08
2393 #define _PORT_TX_DW2_GRP_C 0x6CF08
2394 #define BXT_PORT_TX_DW2_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2395 _PORT_TX_DW2_LN0_B, \
2397 #define BXT_PORT_TX_DW2_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2398 _PORT_TX_DW2_GRP_B, \
2400 #define MARGIN_000_SHIFT 16
2401 #define MARGIN_000 (0xFF << MARGIN_000_SHIFT)
2402 #define UNIQ_TRANS_SCALE_SHIFT 8
2403 #define UNIQ_TRANS_SCALE (0xFF << UNIQ_TRANS_SCALE_SHIFT)
2405 #define _PORT_TX_DW3_LN0_A 0x16250C
2406 #define _PORT_TX_DW3_LN0_B 0x6C50C
2407 #define _PORT_TX_DW3_LN0_C 0x6C90C
2408 #define _PORT_TX_DW3_GRP_A 0x162D0C
2409 #define _PORT_TX_DW3_GRP_B 0x6CD0C
2410 #define _PORT_TX_DW3_GRP_C 0x6CF0C
2411 #define BXT_PORT_TX_DW3_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2412 _PORT_TX_DW3_LN0_B, \
2414 #define BXT_PORT_TX_DW3_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2415 _PORT_TX_DW3_GRP_B, \
2417 #define SCALE_DCOMP_METHOD (1 << 26)
2418 #define UNIQUE_TRANGE_EN_METHOD (1 << 27)
2420 #define _PORT_TX_DW4_LN0_A 0x162510
2421 #define _PORT_TX_DW4_LN0_B 0x6C510
2422 #define _PORT_TX_DW4_LN0_C 0x6C910
2423 #define _PORT_TX_DW4_GRP_A 0x162D10
2424 #define _PORT_TX_DW4_GRP_B 0x6CD10
2425 #define _PORT_TX_DW4_GRP_C 0x6CF10
2426 #define BXT_PORT_TX_DW4_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2427 _PORT_TX_DW4_LN0_B, \
2429 #define BXT_PORT_TX_DW4_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2430 _PORT_TX_DW4_GRP_B, \
2432 #define DEEMPH_SHIFT 24
2433 #define DE_EMPHASIS (0xFF << DEEMPH_SHIFT)
2435 #define _PORT_TX_DW5_LN0_A 0x162514
2436 #define _PORT_TX_DW5_LN0_B 0x6C514
2437 #define _PORT_TX_DW5_LN0_C 0x6C914
2438 #define _PORT_TX_DW5_GRP_A 0x162D14
2439 #define _PORT_TX_DW5_GRP_B 0x6CD14
2440 #define _PORT_TX_DW5_GRP_C 0x6CF14
2441 #define BXT_PORT_TX_DW5_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2442 _PORT_TX_DW5_LN0_B, \
2444 #define BXT_PORT_TX_DW5_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
2445 _PORT_TX_DW5_GRP_B, \
2447 #define DCC_DELAY_RANGE_1 (1 << 9)
2448 #define DCC_DELAY_RANGE_2 (1 << 8)
2450 #define _PORT_TX_DW14_LN0_A 0x162538
2451 #define _PORT_TX_DW14_LN0_B 0x6C538
2452 #define _PORT_TX_DW14_LN0_C 0x6C938
2453 #define LATENCY_OPTIM_SHIFT 30
2454 #define LATENCY_OPTIM (1 << LATENCY_OPTIM_SHIFT)
2455 #define BXT_PORT_TX_DW14_LN(phy, ch, lane) \
2456 _MMIO(_BXT_PHY_CH(phy, ch, _PORT_TX_DW14_LN0_B, \
2457 _PORT_TX_DW14_LN0_C) + \
2458 _BXT_LANE_OFFSET(lane))
2460 /* UAIMI scratch pad register 1 */
2461 #define UAIMI_SPR1 _MMIO(0x4F074)
2462 /* SKL VccIO mask */
2463 #define SKL_VCCIO_MASK 0x1
2464 /* SKL balance leg register */
2465 #define DISPIO_CR_TX_BMU_CR0 _MMIO(0x6C00C)
2466 /* I_boost values */
2467 #define BALANCE_LEG_SHIFT(port) (8 + 3 * (port))
2468 #define BALANCE_LEG_MASK(port) (7 << (8 + 3 * (port)))
2469 /* Balance leg disable bits */
2470 #define BALANCE_LEG_DISABLE_SHIFT 23
2471 #define BALANCE_LEG_DISABLE(port) (1 << (23 + (port)))
2475 * [0-7] @ 0x2000 gen2,gen3
2476 * [8-15] @ 0x3000 945,g33,pnv
2478 * [0-15] @ 0x3000 gen4,gen5
2480 * [0-15] @ 0x100000 gen6,vlv,chv
2481 * [0-31] @ 0x100000 gen7+
2483 #define FENCE_REG(i) _MMIO(0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4)
2484 #define I830_FENCE_START_MASK 0x07f80000
2485 #define I830_FENCE_TILING_Y_SHIFT 12
2486 #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
2487 #define I830_FENCE_PITCH_SHIFT 4
2488 #define I830_FENCE_REG_VALID (1 << 0)
2489 #define I915_FENCE_MAX_PITCH_VAL 4
2490 #define I830_FENCE_MAX_PITCH_VAL 6
2491 #define I830_FENCE_MAX_SIZE_VAL (1 << 8)
2493 #define I915_FENCE_START_MASK 0x0ff00000
2494 #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
2496 #define FENCE_REG_965_LO(i) _MMIO(0x03000 + (i) * 8)
2497 #define FENCE_REG_965_HI(i) _MMIO(0x03000 + (i) * 8 + 4)
2498 #define I965_FENCE_PITCH_SHIFT 2
2499 #define I965_FENCE_TILING_Y_SHIFT 1
2500 #define I965_FENCE_REG_VALID (1 << 0)
2501 #define I965_FENCE_MAX_PITCH_VAL 0x0400
2503 #define FENCE_REG_GEN6_LO(i) _MMIO(0x100000 + (i) * 8)
2504 #define FENCE_REG_GEN6_HI(i) _MMIO(0x100000 + (i) * 8 + 4)
2505 #define GEN6_FENCE_PITCH_SHIFT 32
2506 #define GEN7_FENCE_MAX_PITCH_VAL 0x0800
2509 /* control register for cpu gtt access */
2510 #define TILECTL _MMIO(0x101000)
2511 #define TILECTL_SWZCTL (1 << 0)
2512 #define TILECTL_TLBPF (1 << 1)
2513 #define TILECTL_TLB_PREFETCH_DIS (1 << 2)
2514 #define TILECTL_BACKSNOOP_DIS (1 << 3)
2517 * Instruction and interrupt control regs
2519 #define PGTBL_CTL _MMIO(0x02020)
2520 #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */
2521 #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */
2522 #define PGTBL_ER _MMIO(0x02024)
2523 #define PRB0_BASE (0x2030 - 0x30)
2524 #define PRB1_BASE (0x2040 - 0x30) /* 830,gen3 */
2525 #define PRB2_BASE (0x2050 - 0x30) /* gen3 */
2526 #define SRB0_BASE (0x2100 - 0x30) /* gen2 */
2527 #define SRB1_BASE (0x2110 - 0x30) /* gen2 */
2528 #define SRB2_BASE (0x2120 - 0x30) /* 830 */
2529 #define SRB3_BASE (0x2130 - 0x30) /* 830 */
2530 #define RENDER_RING_BASE 0x02000
2531 #define BSD_RING_BASE 0x04000
2532 #define GEN6_BSD_RING_BASE 0x12000
2533 #define GEN8_BSD2_RING_BASE 0x1c000
2534 #define GEN11_BSD_RING_BASE 0x1c0000
2535 #define GEN11_BSD2_RING_BASE 0x1c4000
2536 #define GEN11_BSD3_RING_BASE 0x1d0000
2537 #define GEN11_BSD4_RING_BASE 0x1d4000
2538 #define XEHP_BSD5_RING_BASE 0x1e0000
2539 #define XEHP_BSD6_RING_BASE 0x1e4000
2540 #define XEHP_BSD7_RING_BASE 0x1f0000
2541 #define XEHP_BSD8_RING_BASE 0x1f4000
2542 #define VEBOX_RING_BASE 0x1a000
2543 #define GEN11_VEBOX_RING_BASE 0x1c8000
2544 #define GEN11_VEBOX2_RING_BASE 0x1d8000
2545 #define XEHP_VEBOX3_RING_BASE 0x1e8000
2546 #define XEHP_VEBOX4_RING_BASE 0x1f8000
2547 #define BLT_RING_BASE 0x22000
2548 #define RING_TAIL(base) _MMIO((base) + 0x30)
2549 #define RING_HEAD(base) _MMIO((base) + 0x34)
2550 #define RING_START(base) _MMIO((base) + 0x38)
2551 #define RING_CTL(base) _MMIO((base) + 0x3c)
2552 #define RING_CTL_SIZE(size) ((size) - PAGE_SIZE) /* in bytes -> pages */
2553 #define RING_SYNC_0(base) _MMIO((base) + 0x40)
2554 #define RING_SYNC_1(base) _MMIO((base) + 0x44)
2555 #define RING_SYNC_2(base) _MMIO((base) + 0x48)
2556 #define GEN6_RVSYNC (RING_SYNC_0(RENDER_RING_BASE))
2557 #define GEN6_RBSYNC (RING_SYNC_1(RENDER_RING_BASE))
2558 #define GEN6_RVESYNC (RING_SYNC_2(RENDER_RING_BASE))
2559 #define GEN6_VBSYNC (RING_SYNC_0(GEN6_BSD_RING_BASE))
2560 #define GEN6_VRSYNC (RING_SYNC_1(GEN6_BSD_RING_BASE))
2561 #define GEN6_VVESYNC (RING_SYNC_2(GEN6_BSD_RING_BASE))
2562 #define GEN6_BRSYNC (RING_SYNC_0(BLT_RING_BASE))
2563 #define GEN6_BVSYNC (RING_SYNC_1(BLT_RING_BASE))
2564 #define GEN6_BVESYNC (RING_SYNC_2(BLT_RING_BASE))
2565 #define GEN6_VEBSYNC (RING_SYNC_0(VEBOX_RING_BASE))
2566 #define GEN6_VERSYNC (RING_SYNC_1(VEBOX_RING_BASE))
2567 #define GEN6_VEVSYNC (RING_SYNC_2(VEBOX_RING_BASE))
2568 #define GEN6_NOSYNC INVALID_MMIO_REG
2569 #define RING_PSMI_CTL(base) _MMIO((base) + 0x50)
2570 #define RING_MAX_IDLE(base) _MMIO((base) + 0x54)
2571 #define RING_HWS_PGA(base) _MMIO((base) + 0x80)
2572 #define RING_ID(base) _MMIO((base) + 0x8c)
2573 #define RING_HWS_PGA_GEN6(base) _MMIO((base) + 0x2080)
2575 #define RING_CMD_CCTL(base) _MMIO((base) + 0xc4)
2577 * CMD_CCTL read/write fields take a MOCS value and _not_ a table index.
2578 * The lsb of each can be considered a separate enabling bit for encryption.
2579 * 6:0 == default MOCS value for reads => 6:1 == table index for reads.
2580 * 13:7 == default MOCS value for writes => 13:8 == table index for writes.
2581 * 15:14 == Reserved => 31:30 are set to 0.
2583 #define CMD_CCTL_WRITE_OVERRIDE_MASK REG_GENMASK(13, 7)
2584 #define CMD_CCTL_READ_OVERRIDE_MASK REG_GENMASK(6, 0)
2585 #define CMD_CCTL_MOCS_MASK (CMD_CCTL_WRITE_OVERRIDE_MASK | \
2586 CMD_CCTL_READ_OVERRIDE_MASK)
2587 #define CMD_CCTL_MOCS_OVERRIDE(write, read) \
2588 (REG_FIELD_PREP(CMD_CCTL_WRITE_OVERRIDE_MASK, (write) << 1) | \
2589 REG_FIELD_PREP(CMD_CCTL_READ_OVERRIDE_MASK, (read) << 1))
2591 #define BLIT_CCTL(base) _MMIO((base) + 0x204)
2592 #define BLIT_CCTL_DST_MOCS_MASK REG_GENMASK(14, 8)
2593 #define BLIT_CCTL_SRC_MOCS_MASK REG_GENMASK(6, 0)
2594 #define BLIT_CCTL_MASK (BLIT_CCTL_DST_MOCS_MASK | \
2595 BLIT_CCTL_SRC_MOCS_MASK)
2596 #define BLIT_CCTL_MOCS(dst, src) \
2597 (REG_FIELD_PREP(BLIT_CCTL_DST_MOCS_MASK, (dst) << 1) | \
2598 REG_FIELD_PREP(BLIT_CCTL_SRC_MOCS_MASK, (src) << 1))
2600 #define RING_RESET_CTL(base) _MMIO((base) + 0xd0)
2601 #define RESET_CTL_CAT_ERROR REG_BIT(2)
2602 #define RESET_CTL_READY_TO_RESET REG_BIT(1)
2603 #define RESET_CTL_REQUEST_RESET REG_BIT(0)
2605 #define RING_SEMA_WAIT_POLL(base) _MMIO((base) + 0x24c)
2607 #define HSW_GTT_CACHE_EN _MMIO(0x4024)
2608 #define GTT_CACHE_EN_ALL 0xF0007FFF
2609 #define GEN7_WR_WATERMARK _MMIO(0x4028)
2610 #define GEN7_GFX_PRIO_CTRL _MMIO(0x402C)
2611 #define ARB_MODE _MMIO(0x4030)
2612 #define ARB_MODE_SWIZZLE_SNB (1 << 4)
2613 #define ARB_MODE_SWIZZLE_IVB (1 << 5)
2614 #define GEN7_GFX_PEND_TLB0 _MMIO(0x4034)
2615 #define GEN7_GFX_PEND_TLB1 _MMIO(0x4038)
2616 /* L3, CVS, ZTLB, RCC, CASC LRA min, max values */
2617 #define GEN7_LRA_LIMITS(i) _MMIO(0x403C + (i) * 4)
2618 #define GEN7_LRA_LIMITS_REG_NUM 13
2619 #define GEN7_MEDIA_MAX_REQ_COUNT _MMIO(0x4070)
2620 #define GEN7_GFX_MAX_REQ_COUNT _MMIO(0x4074)
2622 #define GAMTARBMODE _MMIO(0x04a08)
2623 #define ARB_MODE_BWGTLB_DISABLE (1 << 9)
2624 #define ARB_MODE_SWIZZLE_BDW (1 << 1)
2625 #define RENDER_HWS_PGA_GEN7 _MMIO(0x04080)
2627 #define _RING_FAULT_REG_RCS 0x4094
2628 #define _RING_FAULT_REG_VCS 0x4194
2629 #define _RING_FAULT_REG_BCS 0x4294
2630 #define _RING_FAULT_REG_VECS 0x4394
2631 #define RING_FAULT_REG(engine) _MMIO(_PICK((engine)->class, \
2632 _RING_FAULT_REG_RCS, \
2633 _RING_FAULT_REG_VCS, \
2634 _RING_FAULT_REG_VECS, \
2635 _RING_FAULT_REG_BCS))
2636 #define GEN8_RING_FAULT_REG _MMIO(0x4094)
2637 #define GEN12_RING_FAULT_REG _MMIO(0xcec4)
2638 #define GEN8_RING_FAULT_ENGINE_ID(x) (((x) >> 12) & 0x7)
2639 #define RING_FAULT_GTTSEL_MASK (1 << 11)
2640 #define RING_FAULT_SRCID(x) (((x) >> 3) & 0xff)
2641 #define RING_FAULT_FAULT_TYPE(x) (((x) >> 1) & 0x3)
2642 #define RING_FAULT_VALID (1 << 0)
2643 #define DONE_REG _MMIO(0x40b0)
2644 #define GEN12_GAM_DONE _MMIO(0xcf68)
2645 #define GEN8_PRIVATE_PAT_LO _MMIO(0x40e0)
2646 #define GEN8_PRIVATE_PAT_HI _MMIO(0x40e0 + 4)
2647 #define GEN10_PAT_INDEX(index) _MMIO(0x40e0 + (index) * 4)
2648 #define GEN12_PAT_INDEX(index) _MMIO(0x4800 + (index) * 4)
2649 #define BSD_HWS_PGA_GEN7 _MMIO(0x04180)
2650 #define GEN12_GFX_CCS_AUX_NV _MMIO(0x4208)
2651 #define GEN12_VD0_AUX_NV _MMIO(0x4218)
2652 #define GEN12_VD1_AUX_NV _MMIO(0x4228)
2653 #define GEN12_VD2_AUX_NV _MMIO(0x4298)
2654 #define GEN12_VD3_AUX_NV _MMIO(0x42A8)
2655 #define GEN12_VE0_AUX_NV _MMIO(0x4238)
2656 #define GEN12_VE1_AUX_NV _MMIO(0x42B8)
2657 #define AUX_INV REG_BIT(0)
2658 #define BLT_HWS_PGA_GEN7 _MMIO(0x04280)
2659 #define VEBOX_HWS_PGA_GEN7 _MMIO(0x04380)
2660 #define RING_ACTHD(base) _MMIO((base) + 0x74)
2661 #define RING_ACTHD_UDW(base) _MMIO((base) + 0x5c)
2662 #define RING_NOPID(base) _MMIO((base) + 0x94)
2663 #define RING_IMR(base) _MMIO((base) + 0xa8)
2664 #define RING_HWSTAM(base) _MMIO((base) + 0x98)
2665 #define RING_TIMESTAMP(base) _MMIO((base) + 0x358)
2666 #define RING_TIMESTAMP_UDW(base) _MMIO((base) + 0x358 + 4)
2667 #define TAIL_ADDR 0x001FFFF8
2668 #define HEAD_WRAP_COUNT 0xFFE00000
2669 #define HEAD_WRAP_ONE 0x00200000
2670 #define HEAD_ADDR 0x001FFFFC
2671 #define RING_NR_PAGES 0x001FF000
2672 #define RING_REPORT_MASK 0x00000006
2673 #define RING_REPORT_64K 0x00000002
2674 #define RING_REPORT_128K 0x00000004
2675 #define RING_NO_REPORT 0x00000000
2676 #define RING_VALID_MASK 0x00000001
2677 #define RING_VALID 0x00000001
2678 #define RING_INVALID 0x00000000
2679 #define RING_WAIT_I8XX (1 << 0) /* gen2, PRBx_HEAD */
2680 #define RING_WAIT (1 << 11) /* gen3+, PRBx_CTL */
2681 #define RING_WAIT_SEMAPHORE (1 << 10) /* gen6+ */
2683 #define GUCPMTIMESTAMP _MMIO(0xC3E8)
2685 /* There are 16 64-bit CS General Purpose Registers per-engine on Gen8+ */
2686 #define GEN8_RING_CS_GPR(base, n) _MMIO((base) + 0x600 + (n) * 8)
2687 #define GEN8_RING_CS_GPR_UDW(base, n) _MMIO((base) + 0x600 + (n) * 8 + 4)
2689 #define RING_FORCE_TO_NONPRIV(base, i) _MMIO(((base) + 0x4D0) + (i) * 4)
2690 #define RING_FORCE_TO_NONPRIV_ADDRESS_MASK REG_GENMASK(25, 2)
2691 #define RING_FORCE_TO_NONPRIV_ACCESS_RW (0 << 28) /* CFL+ & Gen11+ */
2692 #define RING_FORCE_TO_NONPRIV_ACCESS_RD (1 << 28)
2693 #define RING_FORCE_TO_NONPRIV_ACCESS_WR (2 << 28)
2694 #define RING_FORCE_TO_NONPRIV_ACCESS_INVALID (3 << 28)
2695 #define RING_FORCE_TO_NONPRIV_ACCESS_MASK (3 << 28)
2696 #define RING_FORCE_TO_NONPRIV_RANGE_1 (0 << 0) /* CFL+ & Gen11+ */
2697 #define RING_FORCE_TO_NONPRIV_RANGE_4 (1 << 0)
2698 #define RING_FORCE_TO_NONPRIV_RANGE_16 (2 << 0)
2699 #define RING_FORCE_TO_NONPRIV_RANGE_64 (3 << 0)
2700 #define RING_FORCE_TO_NONPRIV_RANGE_MASK (3 << 0)
2701 #define RING_FORCE_TO_NONPRIV_MASK_VALID \
2702 (RING_FORCE_TO_NONPRIV_RANGE_MASK \
2703 | RING_FORCE_TO_NONPRIV_ACCESS_MASK)
2704 #define RING_MAX_NONPRIV_SLOTS 12
2706 #define GEN7_TLB_RD_ADDR _MMIO(0x4700)
2708 #define GEN9_GAMT_ECO_REG_RW_IA _MMIO(0x4ab0)
2709 #define GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS (1 << 18)
2711 #define GEN8_GAMW_ECO_DEV_RW_IA _MMIO(0x4080)
2712 #define GAMW_ECO_ENABLE_64K_IPS_FIELD 0xF
2713 #define GAMW_ECO_DEV_CTX_RELOAD_DISABLE (1 << 7)
2715 #define GAMT_CHKN_BIT_REG _MMIO(0x4ab8)
2716 #define GAMT_CHKN_DISABLE_L3_COH_PIPE (1 << 31)
2717 #define GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING (1 << 28)
2718 #define GAMT_CHKN_DISABLE_I2M_CYCLE_ON_WR_PORT (1 << 24)
2721 #define PRB0_TAIL _MMIO(0x2030)
2722 #define PRB0_HEAD _MMIO(0x2034)
2723 #define PRB0_START _MMIO(0x2038)
2724 #define PRB0_CTL _MMIO(0x203c)
2725 #define PRB1_TAIL _MMIO(0x2040) /* 915+ only */
2726 #define PRB1_HEAD _MMIO(0x2044) /* 915+ only */
2727 #define PRB1_START _MMIO(0x2048) /* 915+ only */
2728 #define PRB1_CTL _MMIO(0x204c) /* 915+ only */
2730 #define IPEIR_I965 _MMIO(0x2064)
2731 #define IPEHR_I965 _MMIO(0x2068)
2732 #define GEN7_SC_INSTDONE _MMIO(0x7100)
2733 #define GEN12_SC_INSTDONE_EXTRA _MMIO(0x7104)
2734 #define GEN12_SC_INSTDONE_EXTRA2 _MMIO(0x7108)
2735 #define GEN7_SAMPLER_INSTDONE _MMIO(0xe160)
2736 #define GEN7_ROW_INSTDONE _MMIO(0xe164)
2737 #define XEHPG_INSTDONE_GEOM_SVG _MMIO(0x666c)
2738 #define MCFG_MCR_SELECTOR _MMIO(0xfd0)
2739 #define SF_MCR_SELECTOR _MMIO(0xfd8)
2740 #define GEN8_MCR_SELECTOR _MMIO(0xfdc)
2741 #define GEN8_MCR_SLICE(slice) (((slice) & 3) << 26)
2742 #define GEN8_MCR_SLICE_MASK GEN8_MCR_SLICE(3)
2743 #define GEN8_MCR_SUBSLICE(subslice) (((subslice) & 3) << 24)
2744 #define GEN8_MCR_SUBSLICE_MASK GEN8_MCR_SUBSLICE(3)
2745 #define GEN11_MCR_SLICE(slice) (((slice) & 0xf) << 27)
2746 #define GEN11_MCR_SLICE_MASK GEN11_MCR_SLICE(0xf)
2747 #define GEN11_MCR_SUBSLICE(subslice) (((subslice) & 0x7) << 24)
2748 #define GEN11_MCR_SUBSLICE_MASK GEN11_MCR_SUBSLICE(0x7)
2749 #define RING_IPEIR(base) _MMIO((base) + 0x64)
2750 #define RING_IPEHR(base) _MMIO((base) + 0x68)
2751 #define RING_EIR(base) _MMIO((base) + 0xb0)
2752 #define RING_EMR(base) _MMIO((base) + 0xb4)
2753 #define RING_ESR(base) _MMIO((base) + 0xb8)
2755 * On GEN4, only the render ring INSTDONE exists and has a different
2756 * layout than the GEN7+ version.
2757 * The GEN2 counterpart of this register is GEN2_INSTDONE.
2759 #define RING_INSTDONE(base) _MMIO((base) + 0x6c)
2760 #define RING_INSTPS(base) _MMIO((base) + 0x70)
2761 #define RING_DMA_FADD(base) _MMIO((base) + 0x78)
2762 #define RING_DMA_FADD_UDW(base) _MMIO((base) + 0x60) /* gen8+ */
2763 #define RING_INSTPM(base) _MMIO((base) + 0xc0)
2764 #define RING_MI_MODE(base) _MMIO((base) + 0x9c)
2765 #define RING_CMD_BUF_CCTL(base) _MMIO((base) + 0x84)
2766 #define INSTPS _MMIO(0x2070) /* 965+ only */
2767 #define GEN4_INSTDONE1 _MMIO(0x207c) /* 965+ only, aka INSTDONE_2 on SNB */
2768 #define ACTHD_I965 _MMIO(0x2074)
2769 #define HWS_PGA _MMIO(0x2080)
2770 #define HWS_ADDRESS_MASK 0xfffff000
2771 #define HWS_START_ADDRESS_SHIFT 4
2772 #define PWRCTXA _MMIO(0x2088) /* 965GM+ only */
2773 #define PWRCTX_EN (1 << 0)
2774 #define IPEIR(base) _MMIO((base) + 0x88)
2775 #define IPEHR(base) _MMIO((base) + 0x8c)
2776 #define GEN2_INSTDONE _MMIO(0x2090)
2777 #define NOPID _MMIO(0x2094)
2778 #define HWSTAM _MMIO(0x2098)
2779 #define DMA_FADD_I8XX(base) _MMIO((base) + 0xd0)
2780 #define RING_BBSTATE(base) _MMIO((base) + 0x110)
2781 #define RING_BB_PPGTT (1 << 5)
2782 #define RING_SBBADDR(base) _MMIO((base) + 0x114) /* hsw+ */
2783 #define RING_SBBSTATE(base) _MMIO((base) + 0x118) /* hsw+ */
2784 #define RING_SBBADDR_UDW(base) _MMIO((base) + 0x11c) /* gen8+ */
2785 #define RING_BBADDR(base) _MMIO((base) + 0x140)
2786 #define RING_BBADDR_UDW(base) _MMIO((base) + 0x168) /* gen8+ */
2787 #define RING_BB_PER_CTX_PTR(base) _MMIO((base) + 0x1c0) /* gen8+ */
2788 #define RING_INDIRECT_CTX(base) _MMIO((base) + 0x1c4) /* gen8+ */
2789 #define RING_INDIRECT_CTX_OFFSET(base) _MMIO((base) + 0x1c8) /* gen8+ */
2790 #define RING_CTX_TIMESTAMP(base) _MMIO((base) + 0x3a8) /* gen8+ */
2792 #define VDBOX_CGCTL3F10(base) _MMIO((base) + 0x3f10)
2793 #define IECPUNIT_CLKGATE_DIS REG_BIT(22)
2795 #define VDBOX_CGCTL3F18(base) _MMIO((base) + 0x3f18)
2796 #define ALNUNIT_CLKGATE_DIS REG_BIT(13)
2798 #define ERROR_GEN6 _MMIO(0x40a0)
2799 #define GEN7_ERR_INT _MMIO(0x44040)
2800 #define ERR_INT_POISON (1 << 31)
2801 #define ERR_INT_MMIO_UNCLAIMED (1 << 13)
2802 #define ERR_INT_PIPE_CRC_DONE_C (1 << 8)
2803 #define ERR_INT_FIFO_UNDERRUN_C (1 << 6)
2804 #define ERR_INT_PIPE_CRC_DONE_B (1 << 5)
2805 #define ERR_INT_FIFO_UNDERRUN_B (1 << 3)
2806 #define ERR_INT_PIPE_CRC_DONE_A (1 << 2)
2807 #define ERR_INT_PIPE_CRC_DONE(pipe) (1 << (2 + (pipe) * 3))
2808 #define ERR_INT_FIFO_UNDERRUN_A (1 << 0)
2809 #define ERR_INT_FIFO_UNDERRUN(pipe) (1 << ((pipe) * 3))
2811 #define GEN8_FAULT_TLB_DATA0 _MMIO(0x4b10)
2812 #define GEN8_FAULT_TLB_DATA1 _MMIO(0x4b14)
2813 #define GEN12_FAULT_TLB_DATA0 _MMIO(0xceb8)
2814 #define GEN12_FAULT_TLB_DATA1 _MMIO(0xcebc)
2815 #define FAULT_VA_HIGH_BITS (0xf << 0)
2816 #define FAULT_GTT_SEL (1 << 4)
2818 #define GEN12_AUX_ERR_DBG _MMIO(0x43f4)
2820 #define FPGA_DBG _MMIO(0x42300)
2821 #define FPGA_DBG_RM_NOCLAIM (1 << 31)
2823 #define CLAIM_ER _MMIO(VLV_DISPLAY_BASE + 0x2028)
2824 #define CLAIM_ER_CLR (1 << 31)
2825 #define CLAIM_ER_OVERFLOW (1 << 16)
2826 #define CLAIM_ER_CTR_MASK 0xffff
2828 #define DERRMR _MMIO(0x44050)
2829 /* Note that HBLANK events are reserved on bdw+ */
2830 #define DERRMR_PIPEA_SCANLINE (1 << 0)
2831 #define DERRMR_PIPEA_PRI_FLIP_DONE (1 << 1)
2832 #define DERRMR_PIPEA_SPR_FLIP_DONE (1 << 2)
2833 #define DERRMR_PIPEA_VBLANK (1 << 3)
2834 #define DERRMR_PIPEA_HBLANK (1 << 5)
2835 #define DERRMR_PIPEB_SCANLINE (1 << 8)
2836 #define DERRMR_PIPEB_PRI_FLIP_DONE (1 << 9)
2837 #define DERRMR_PIPEB_SPR_FLIP_DONE (1 << 10)
2838 #define DERRMR_PIPEB_VBLANK (1 << 11)
2839 #define DERRMR_PIPEB_HBLANK (1 << 13)
2840 /* Note that PIPEC is not a simple translation of PIPEA/PIPEB */
2841 #define DERRMR_PIPEC_SCANLINE (1 << 14)
2842 #define DERRMR_PIPEC_PRI_FLIP_DONE (1 << 15)
2843 #define DERRMR_PIPEC_SPR_FLIP_DONE (1 << 20)
2844 #define DERRMR_PIPEC_VBLANK (1 << 21)
2845 #define DERRMR_PIPEC_HBLANK (1 << 22)
2848 /* GM45+ chicken bits -- debug workaround bits that may be required
2849 * for various sorts of correct behavior. The top 16 bits of each are
2850 * the enables for writing to the corresponding low bit.
2852 #define _3D_CHICKEN _MMIO(0x2084)
2853 #define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
2854 #define _3D_CHICKEN2 _MMIO(0x208c)
2856 #define FF_SLICE_CHICKEN _MMIO(0x2088)
2857 #define FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX (1 << 1)
2859 /* Disables pipelining of read flushes past the SF-WIZ interface.
2860 * Required on all Ironlake steppings according to the B-Spec, but the
2861 * particular danger of not doing so is not specified.
2863 # define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14)
2864 #define _3D_CHICKEN3 _MMIO(0x2090)
2865 #define _3D_CHICKEN_SF_PROVOKING_VERTEX_FIX (1 << 12)
2866 #define _3D_CHICKEN_SF_DISABLE_OBJEND_CULL (1 << 10)
2867 #define _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE (1 << 5)
2868 #define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5)
2869 #define _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x) ((x) << 1) /* gen8+ */
2870 #define _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH (1 << 1) /* gen6 */
2872 #define MI_MODE _MMIO(0x209c)
2873 # define VS_TIMER_DISPATCH (1 << 6)
2874 # define MI_FLUSH_ENABLE (1 << 12)
2875 # define TGL_NESTED_BB_EN (1 << 12)
2876 # define ASYNC_FLIP_PERF_DISABLE (1 << 14)
2877 # define MODE_IDLE (1 << 9)
2878 # define STOP_RING (1 << 8)
2880 #define GEN6_GT_MODE _MMIO(0x20d0)
2881 #define GEN7_GT_MODE _MMIO(0x7008)
2882 #define GEN6_WIZ_HASHING(hi, lo) (((hi) << 9) | ((lo) << 7))
2883 #define GEN6_WIZ_HASHING_8x8 GEN6_WIZ_HASHING(0, 0)
2884 #define GEN6_WIZ_HASHING_8x4 GEN6_WIZ_HASHING(0, 1)
2885 #define GEN6_WIZ_HASHING_16x4 GEN6_WIZ_HASHING(1, 0)
2886 #define GEN6_WIZ_HASHING_MASK GEN6_WIZ_HASHING(1, 1)
2887 #define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
2888 #define GEN9_IZ_HASHING_MASK(slice) (0x3 << ((slice) * 2))
2889 #define GEN9_IZ_HASHING(slice, val) ((val) << ((slice) * 2))
2891 /* chicken reg for WaConextSwitchWithConcurrentTLBInvalidate */
2892 #define GEN9_CSFE_CHICKEN1_RCS _MMIO(0x20D4)
2893 #define GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE (1 << 2)
2894 #define GEN11_ENABLE_32_PLANE_MODE (1 << 7)
2896 #define SCCGCTL94DC _MMIO(0x94dc)
2897 #define CG3DDISURB REG_BIT(14)
2899 #define MLTICTXCTL _MMIO(0xb170)
2900 #define TDONRENDER REG_BIT(2)
2902 #define L3SQCREG1_CCS0 _MMIO(0xb200)
2903 #define FLUSHALLNONCOH REG_BIT(5)
2905 /* WaClearTdlStateAckDirtyBits */
2906 #define GEN8_STATE_ACK _MMIO(0x20F0)
2907 #define GEN9_STATE_ACK_SLICE1 _MMIO(0x20F8)
2908 #define GEN9_STATE_ACK_SLICE2 _MMIO(0x2100)
2909 #define GEN9_STATE_ACK_TDL0 (1 << 12)
2910 #define GEN9_STATE_ACK_TDL1 (1 << 13)
2911 #define GEN9_STATE_ACK_TDL2 (1 << 14)
2912 #define GEN9_STATE_ACK_TDL3 (1 << 15)
2913 #define GEN9_SUBSLICE_TDL_ACK_BITS \
2914 (GEN9_STATE_ACK_TDL3 | GEN9_STATE_ACK_TDL2 | \
2915 GEN9_STATE_ACK_TDL1 | GEN9_STATE_ACK_TDL0)
2917 #define GFX_MODE _MMIO(0x2520)
2918 #define GFX_MODE_GEN7 _MMIO(0x229c)
2919 #define RING_MODE_GEN7(base) _MMIO((base) + 0x29c)
2920 #define GFX_RUN_LIST_ENABLE (1 << 15)
2921 #define GFX_INTERRUPT_STEERING (1 << 14)
2922 #define GFX_TLB_INVALIDATE_EXPLICIT (1 << 13)
2923 #define GFX_SURFACE_FAULT_ENABLE (1 << 12)
2924 #define GFX_REPLAY_MODE (1 << 11)
2925 #define GFX_PSMI_GRANULARITY (1 << 10)
2926 #define GFX_PPGTT_ENABLE (1 << 9)
2927 #define GEN8_GFX_PPGTT_48B (1 << 7)
2929 #define GFX_FORWARD_VBLANK_MASK (3 << 5)
2930 #define GFX_FORWARD_VBLANK_NEVER (0 << 5)
2931 #define GFX_FORWARD_VBLANK_ALWAYS (1 << 5)
2932 #define GFX_FORWARD_VBLANK_COND (2 << 5)
2934 #define GEN11_GFX_DISABLE_LEGACY_MODE (1 << 3)
2936 #define VLV_GU_CTL0 _MMIO(VLV_DISPLAY_BASE + 0x2030)
2937 #define VLV_GU_CTL1 _MMIO(VLV_DISPLAY_BASE + 0x2034)
2938 #define SCPD0 _MMIO(0x209c) /* 915+ only */
2939 #define SCPD_FBC_IGNORE_3D (1 << 6)
2940 #define CSTATE_RENDER_CLOCK_GATE_DISABLE (1 << 5)
2941 #define GEN2_IER _MMIO(0x20a0)
2942 #define GEN2_IIR _MMIO(0x20a4)
2943 #define GEN2_IMR _MMIO(0x20a8)
2944 #define GEN2_ISR _MMIO(0x20ac)
2945 #define VLV_GUNIT_CLOCK_GATE _MMIO(VLV_DISPLAY_BASE + 0x2060)
2946 #define GINT_DIS (1 << 22)
2947 #define GCFG_DIS (1 << 8)
2948 #define VLV_GUNIT_CLOCK_GATE2 _MMIO(VLV_DISPLAY_BASE + 0x2064)
2949 #define VLV_IIR_RW _MMIO(VLV_DISPLAY_BASE + 0x2084)
2950 #define VLV_IER _MMIO(VLV_DISPLAY_BASE + 0x20a0)
2951 #define VLV_IIR _MMIO(VLV_DISPLAY_BASE + 0x20a4)
2952 #define VLV_IMR _MMIO(VLV_DISPLAY_BASE + 0x20a8)
2953 #define VLV_ISR _MMIO(VLV_DISPLAY_BASE + 0x20ac)
2954 #define VLV_PCBR _MMIO(VLV_DISPLAY_BASE + 0x2120)
2955 #define VLV_PCBR_ADDR_SHIFT 12
2957 #define DISPLAY_PLANE_FLIP_PENDING(plane) (1 << (11 - (plane))) /* A and B only */
2958 #define EIR _MMIO(0x20b0)
2959 #define EMR _MMIO(0x20b4)
2960 #define ESR _MMIO(0x20b8)
2961 #define GM45_ERROR_PAGE_TABLE (1 << 5)
2962 #define GM45_ERROR_MEM_PRIV (1 << 4)
2963 #define I915_ERROR_PAGE_TABLE (1 << 4)
2964 #define GM45_ERROR_CP_PRIV (1 << 3)
2965 #define I915_ERROR_MEMORY_REFRESH (1 << 1)
2966 #define I915_ERROR_INSTRUCTION (1 << 0)
2967 #define INSTPM _MMIO(0x20c0)
2968 #define INSTPM_SELF_EN (1 << 12) /* 915GM only */
2969 #define INSTPM_AGPBUSY_INT_EN (1 << 11) /* gen3: when disabled, pending interrupts
2970 will not assert AGPBUSY# and will only
2971 be delivered when out of C3. */
2972 #define INSTPM_FORCE_ORDERING (1 << 7) /* GEN6+ */
2973 #define INSTPM_TLB_INVALIDATE (1 << 9)
2974 #define INSTPM_SYNC_FLUSH (1 << 5)
2975 #define ACTHD(base) _MMIO((base) + 0xc8)
2976 #define MEM_MODE _MMIO(0x20cc)
2977 #define MEM_DISPLAY_B_TRICKLE_FEED_DISABLE (1 << 3) /* 830 only */
2978 #define MEM_DISPLAY_A_TRICKLE_FEED_DISABLE (1 << 2) /* 830/845 only */
2979 #define MEM_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2) /* 85x only */
2980 #define FW_BLC _MMIO(0x20d8)
2981 #define FW_BLC2 _MMIO(0x20dc)
2982 #define FW_BLC_SELF _MMIO(0x20e0) /* 915+ only */
2983 #define FW_BLC_SELF_EN_MASK (1 << 31)
2984 #define FW_BLC_SELF_FIFO_MASK (1 << 16) /* 945 only */
2985 #define FW_BLC_SELF_EN (1 << 15) /* 945 only */
2986 #define MM_BURST_LENGTH 0x00700000
2987 #define MM_FIFO_WATERMARK 0x0001F000
2988 #define LM_BURST_LENGTH 0x00000700
2989 #define LM_FIFO_WATERMARK 0x0000001F
2990 #define MI_ARB_STATE _MMIO(0x20e4) /* 915+ only */
2992 #define _MBUS_ABOX0_CTL 0x45038
2993 #define _MBUS_ABOX1_CTL 0x45048
2994 #define _MBUS_ABOX2_CTL 0x4504C
2995 #define MBUS_ABOX_CTL(x) _MMIO(_PICK(x, _MBUS_ABOX0_CTL, \
2998 #define MBUS_ABOX_BW_CREDIT_MASK (3 << 20)
2999 #define MBUS_ABOX_BW_CREDIT(x) ((x) << 20)
3000 #define MBUS_ABOX_B_CREDIT_MASK (0xF << 16)
3001 #define MBUS_ABOX_B_CREDIT(x) ((x) << 16)
3002 #define MBUS_ABOX_BT_CREDIT_POOL2_MASK (0x1F << 8)
3003 #define MBUS_ABOX_BT_CREDIT_POOL2(x) ((x) << 8)
3004 #define MBUS_ABOX_BT_CREDIT_POOL1_MASK (0x1F << 0)
3005 #define MBUS_ABOX_BT_CREDIT_POOL1(x) ((x) << 0)
3007 #define _PIPEA_MBUS_DBOX_CTL 0x7003C
3008 #define _PIPEB_MBUS_DBOX_CTL 0x7103C
3009 #define PIPE_MBUS_DBOX_CTL(pipe) _MMIO_PIPE(pipe, _PIPEA_MBUS_DBOX_CTL, \
3010 _PIPEB_MBUS_DBOX_CTL)
3011 #define MBUS_DBOX_BW_CREDIT_MASK (3 << 14)
3012 #define MBUS_DBOX_BW_CREDIT(x) ((x) << 14)
3013 #define MBUS_DBOX_B_CREDIT_MASK (0x1F << 8)
3014 #define MBUS_DBOX_B_CREDIT(x) ((x) << 8)
3015 #define MBUS_DBOX_A_CREDIT_MASK (0xF << 0)
3016 #define MBUS_DBOX_A_CREDIT(x) ((x) << 0)
3018 #define MBUS_UBOX_CTL _MMIO(0x4503C)
3019 #define MBUS_BBOX_CTL_S1 _MMIO(0x45040)
3020 #define MBUS_BBOX_CTL_S2 _MMIO(0x45044)
3022 #define MBUS_CTL _MMIO(0x4438C)
3023 #define MBUS_JOIN REG_BIT(31)
3024 #define MBUS_HASHING_MODE_MASK REG_BIT(30)
3025 #define MBUS_HASHING_MODE_2x2 REG_FIELD_PREP(MBUS_HASHING_MODE_MASK, 0)
3026 #define MBUS_HASHING_MODE_1x4 REG_FIELD_PREP(MBUS_HASHING_MODE_MASK, 1)
3027 #define MBUS_JOIN_PIPE_SELECT_MASK REG_GENMASK(28, 26)
3028 #define MBUS_JOIN_PIPE_SELECT(pipe) REG_FIELD_PREP(MBUS_JOIN_PIPE_SELECT_MASK, pipe)
3029 #define MBUS_JOIN_PIPE_SELECT_NONE MBUS_JOIN_PIPE_SELECT(7)
3031 #define HDPORT_STATE _MMIO(0x45050)
3032 #define HDPORT_DPLL_USED_MASK REG_GENMASK(15, 12)
3033 #define HDPORT_DDI_USED(phy) REG_BIT(2 * (phy) + 1)
3034 #define HDPORT_ENABLED REG_BIT(0)
3036 /* Make render/texture TLB fetches lower priorty than associated data
3037 * fetches. This is not turned on by default
3039 #define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15)
3041 /* Isoch request wait on GTT enable (Display A/B/C streams).
3042 * Make isoch requests stall on the TLB update. May cause
3043 * display underruns (test mode only)
3045 #define MI_ARB_ISOCH_WAIT_GTT (1 << 14)
3047 /* Block grant count for isoch requests when block count is
3048 * set to a finite value.
3050 #define MI_ARB_BLOCK_GRANT_MASK (3 << 12)
3051 #define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */
3052 #define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */
3053 #define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */
3054 #define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */
3056 /* Enable render writes to complete in C2/C3/C4 power states.
3057 * If this isn't enabled, render writes are prevented in low
3058 * power states. That seems bad to me.
3060 #define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11)
3062 /* This acknowledges an async flip immediately instead
3063 * of waiting for 2TLB fetches.
3065 #define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10)
3067 /* Enables non-sequential data reads through arbiter
3069 #define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9)
3071 /* Disable FSB snooping of cacheable write cycles from binner/render
3074 #define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8)
3076 /* Arbiter time slice for non-isoch streams */
3077 #define MI_ARB_TIME_SLICE_MASK (7 << 5)
3078 #define MI_ARB_TIME_SLICE_1 (0 << 5)
3079 #define MI_ARB_TIME_SLICE_2 (1 << 5)
3080 #define MI_ARB_TIME_SLICE_4 (2 << 5)
3081 #define MI_ARB_TIME_SLICE_6 (3 << 5)
3082 #define MI_ARB_TIME_SLICE_8 (4 << 5)
3083 #define MI_ARB_TIME_SLICE_10 (5 << 5)
3084 #define MI_ARB_TIME_SLICE_14 (6 << 5)
3085 #define MI_ARB_TIME_SLICE_16 (7 << 5)
3087 /* Low priority grace period page size */
3088 #define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */
3089 #define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4)
3091 /* Disable display A/B trickle feed */
3092 #define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2)
3094 /* Set display plane priority */
3095 #define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
3096 #define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
3098 #define MI_STATE _MMIO(0x20e4) /* gen2 only */
3099 #define MI_AGPBUSY_INT_EN (1 << 1) /* 85x only */
3100 #define MI_AGPBUSY_830_MODE (1 << 0) /* 85x only */
3102 #define CACHE_MODE_0 _MMIO(0x2120) /* 915+ only */
3103 #define CM0_PIPELINED_RENDER_FLUSH_DISABLE (1 << 8)
3104 #define CM0_IZ_OPT_DISABLE (1 << 6)
3105 #define CM0_ZR_OPT_DISABLE (1 << 5)
3106 #define CM0_STC_EVICT_DISABLE_LRA_SNB (1 << 5)
3107 #define CM0_DEPTH_EVICT_DISABLE (1 << 4)
3108 #define CM0_COLOR_EVICT_DISABLE (1 << 3)
3109 #define CM0_DEPTH_WRITE_DISABLE (1 << 1)
3110 #define CM0_RC_OP_FLUSH_DISABLE (1 << 0)
3111 #define GFX_FLSH_CNTL _MMIO(0x2170) /* 915+ only */
3112 #define GFX_FLSH_CNTL_GEN6 _MMIO(0x101008)
3113 #define GFX_FLSH_CNTL_EN (1 << 0)
3114 #define ECOSKPD _MMIO(0x21d0)
3115 #define ECO_CONSTANT_BUFFER_SR_DISABLE REG_BIT(4)
3116 #define ECO_GATING_CX_ONLY (1 << 3)
3117 #define ECO_FLIP_DONE (1 << 0)
3119 #define CACHE_MODE_0_GEN7 _MMIO(0x7000) /* IVB+ */
3120 #define RC_OP_FLUSH_ENABLE (1 << 0)
3121 #define HIZ_RAW_STALL_OPT_DISABLE (1 << 2)
3122 #define CACHE_MODE_1 _MMIO(0x7004) /* IVB+ */
3123 #define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1 << 6)
3124 #define GEN8_4x4_STC_OPTIMIZATION_DISABLE (1 << 6)
3125 #define GEN9_PARTIAL_RESOLVE_IN_VC_DISABLE (1 << 1)
3127 #define GEN6_BLITTER_ECOSKPD _MMIO(0x221d0)
3128 #define GEN6_BLITTER_LOCK_SHIFT 16
3129 #define GEN6_BLITTER_FBC_NOTIFY (1 << 3)
3131 #define GEN6_RC_SLEEP_PSMI_CONTROL _MMIO(0x2050)
3132 #define GEN6_PSMI_SLEEP_MSG_DISABLE (1 << 0)
3133 #define GEN12_WAIT_FOR_EVENT_POWER_DOWN_DISABLE REG_BIT(7)
3134 #define GEN8_RC_SEMA_IDLE_MSG_DISABLE (1 << 12)
3135 #define GEN8_FF_DOP_CLOCK_GATE_DISABLE (1 << 10)
3137 #define GEN6_RCS_PWR_FSM _MMIO(0x22ac)
3138 #define GEN9_RCS_FE_FSM2 _MMIO(0x22a4)
3140 #define GEN10_CACHE_MODE_SS _MMIO(0xe420)
3141 #define ENABLE_PREFETCH_INTO_IC REG_BIT(3)
3142 #define FLOAT_BLEND_OPTIMIZATION_ENABLE REG_BIT(4)
3144 /* Fuse readout registers for GT */
3145 #define HSW_PAVP_FUSE1 _MMIO(0x911C)
3146 #define XEHP_SFC_ENABLE_MASK REG_GENMASK(27, 24)
3147 #define HSW_F1_EU_DIS_MASK REG_GENMASK(17, 16)
3148 #define HSW_F1_EU_DIS_10EUS 0
3149 #define HSW_F1_EU_DIS_8EUS 1
3150 #define HSW_F1_EU_DIS_6EUS 2
3152 #define CHV_FUSE_GT _MMIO(VLV_DISPLAY_BASE + 0x2168)
3153 #define CHV_FGT_DISABLE_SS0 (1 << 10)
3154 #define CHV_FGT_DISABLE_SS1 (1 << 11)
3155 #define CHV_FGT_EU_DIS_SS0_R0_SHIFT 16
3156 #define CHV_FGT_EU_DIS_SS0_R0_MASK (0xf << CHV_FGT_EU_DIS_SS0_R0_SHIFT)
3157 #define CHV_FGT_EU_DIS_SS0_R1_SHIFT 20
3158 #define CHV_FGT_EU_DIS_SS0_R1_MASK (0xf << CHV_FGT_EU_DIS_SS0_R1_SHIFT)
3159 #define CHV_FGT_EU_DIS_SS1_R0_SHIFT 24
3160 #define CHV_FGT_EU_DIS_SS1_R0_MASK (0xf << CHV_FGT_EU_DIS_SS1_R0_SHIFT)
3161 #define CHV_FGT_EU_DIS_SS1_R1_SHIFT 28
3162 #define CHV_FGT_EU_DIS_SS1_R1_MASK (0xf << CHV_FGT_EU_DIS_SS1_R1_SHIFT)
3164 #define GEN8_FUSE2 _MMIO(0x9120)
3165 #define GEN8_F2_SS_DIS_SHIFT 21
3166 #define GEN8_F2_SS_DIS_MASK (0x7 << GEN8_F2_SS_DIS_SHIFT)
3167 #define GEN8_F2_S_ENA_SHIFT 25
3168 #define GEN8_F2_S_ENA_MASK (0x7 << GEN8_F2_S_ENA_SHIFT)
3170 #define GEN9_F2_SS_DIS_SHIFT 20
3171 #define GEN9_F2_SS_DIS_MASK (0xf << GEN9_F2_SS_DIS_SHIFT)
3173 #define GEN10_F2_S_ENA_SHIFT 22
3174 #define GEN10_F2_S_ENA_MASK (0x3f << GEN10_F2_S_ENA_SHIFT)
3175 #define GEN10_F2_SS_DIS_SHIFT 18
3176 #define GEN10_F2_SS_DIS_MASK (0xf << GEN10_F2_SS_DIS_SHIFT)
3178 #define GEN10_MIRROR_FUSE3 _MMIO(0x9118)
3179 #define GEN10_L3BANK_PAIR_COUNT 4
3180 #define GEN10_L3BANK_MASK 0x0F
3181 /* on Xe_HP the same fuses indicates mslices instead of L3 banks */
3182 #define GEN12_MAX_MSLICES 4
3183 #define GEN12_MEML3_EN_MASK 0x0F
3185 #define GEN8_EU_DISABLE0 _MMIO(0x9134)
3186 #define GEN8_EU_DIS0_S0_MASK 0xffffff
3187 #define GEN8_EU_DIS0_S1_SHIFT 24
3188 #define GEN8_EU_DIS0_S1_MASK (0xff << GEN8_EU_DIS0_S1_SHIFT)
3190 #define GEN8_EU_DISABLE1 _MMIO(0x9138)
3191 #define GEN8_EU_DIS1_S1_MASK 0xffff
3192 #define GEN8_EU_DIS1_S2_SHIFT 16
3193 #define GEN8_EU_DIS1_S2_MASK (0xffff << GEN8_EU_DIS1_S2_SHIFT)
3195 #define GEN8_EU_DISABLE2 _MMIO(0x913c)
3196 #define GEN8_EU_DIS2_S2_MASK 0xff
3198 #define GEN9_EU_DISABLE(slice) _MMIO(0x9134 + (slice) * 0x4)
3200 #define GEN10_EU_DISABLE3 _MMIO(0x9140)
3201 #define GEN10_EU_DIS_SS_MASK 0xff
3203 #define GEN11_GT_VEBOX_VDBOX_DISABLE _MMIO(0x9140)
3204 #define GEN11_GT_VDBOX_DISABLE_MASK 0xff
3205 #define GEN11_GT_VEBOX_DISABLE_SHIFT 16
3206 #define GEN11_GT_VEBOX_DISABLE_MASK (0x0f << GEN11_GT_VEBOX_DISABLE_SHIFT)
3208 #define GEN11_EU_DISABLE _MMIO(0x9134)
3209 #define GEN11_EU_DIS_MASK 0xFF
3211 #define GEN11_GT_SLICE_ENABLE _MMIO(0x9138)
3212 #define GEN11_GT_S_ENA_MASK 0xFF
3214 #define GEN11_GT_SUBSLICE_DISABLE _MMIO(0x913C)
3216 #define GEN12_GT_GEOMETRY_DSS_ENABLE _MMIO(0x913C)
3217 #define GEN12_GT_COMPUTE_DSS_ENABLE _MMIO(0x9144)
3219 #define XEHP_EU_ENABLE _MMIO(0x9134)
3220 #define XEHP_EU_ENA_MASK 0xFF
3222 #define GEN6_BSD_SLEEP_PSMI_CONTROL _MMIO(0x12050)
3223 #define GEN6_BSD_SLEEP_MSG_DISABLE (1 << 0)
3224 #define GEN6_BSD_SLEEP_FLUSH_DISABLE (1 << 2)
3225 #define GEN6_BSD_SLEEP_INDICATOR (1 << 3)
3226 #define GEN6_BSD_GO_INDICATOR (1 << 4)
3228 /* On modern GEN architectures interrupt control consists of two sets
3229 * of registers. The first set pertains to the ring generating the
3230 * interrupt. The second control is for the functional block generating the
3231 * interrupt. These are PM, GT, DE, etc.
3233 * Luckily *knocks on wood* all the ring interrupt bits match up with the
3234 * GT interrupt bits, so we don't need to duplicate the defines.
3236 * These defines should cover us well from SNB->HSW with minor exceptions
3237 * it can also work on ILK.
3239 #define GT_BLT_FLUSHDW_NOTIFY_INTERRUPT (1 << 26)
3240 #define GT_BLT_CS_ERROR_INTERRUPT (1 << 25)
3241 #define GT_BLT_USER_INTERRUPT (1 << 22)
3242 #define GT_BSD_CS_ERROR_INTERRUPT (1 << 15)
3243 #define GT_BSD_USER_INTERRUPT (1 << 12)
3244 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 (1 << 11) /* hsw+; rsvd on snb, ivb, vlv */
3245 #define GT_WAIT_SEMAPHORE_INTERRUPT REG_BIT(11) /* bdw+ */
3246 #define GT_CONTEXT_SWITCH_INTERRUPT (1 << 8)
3247 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT (1 << 5) /* !snb */
3248 #define GT_RENDER_PIPECTL_NOTIFY_INTERRUPT (1 << 4)
3249 #define GT_CS_MASTER_ERROR_INTERRUPT REG_BIT(3)
3250 #define GT_RENDER_SYNC_STATUS_INTERRUPT (1 << 2)
3251 #define GT_RENDER_DEBUG_INTERRUPT (1 << 1)
3252 #define GT_RENDER_USER_INTERRUPT (1 << 0)
3254 #define PM_VEBOX_CS_ERROR_INTERRUPT (1 << 12) /* hsw+ */
3255 #define PM_VEBOX_USER_INTERRUPT (1 << 10) /* hsw+ */
3257 #define GT_PARITY_ERROR(dev_priv) \
3258 (GT_RENDER_L3_PARITY_ERROR_INTERRUPT | \
3259 (IS_HASWELL(dev_priv) ? GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 : 0))
3261 /* These are all the "old" interrupts */
3262 #define ILK_BSD_USER_INTERRUPT (1 << 5)
3264 #define I915_PM_INTERRUPT (1 << 31)
3265 #define I915_ISP_INTERRUPT (1 << 22)
3266 #define I915_LPE_PIPE_B_INTERRUPT (1 << 21)
3267 #define I915_LPE_PIPE_A_INTERRUPT (1 << 20)
3268 #define I915_MIPIC_INTERRUPT (1 << 19)
3269 #define I915_MIPIA_INTERRUPT (1 << 18)
3270 #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1 << 18)
3271 #define I915_DISPLAY_PORT_INTERRUPT (1 << 17)
3272 #define I915_DISPLAY_PIPE_C_HBLANK_INTERRUPT (1 << 16)
3273 #define I915_MASTER_ERROR_INTERRUPT (1 << 15)
3274 #define I915_DISPLAY_PIPE_B_HBLANK_INTERRUPT (1 << 14)
3275 #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1 << 14) /* p-state */
3276 #define I915_DISPLAY_PIPE_A_HBLANK_INTERRUPT (1 << 13)
3277 #define I915_HWB_OOM_INTERRUPT (1 << 13)
3278 #define I915_LPE_PIPE_C_INTERRUPT (1 << 12)
3279 #define I915_SYNC_STATUS_INTERRUPT (1 << 12)
3280 #define I915_MISC_INTERRUPT (1 << 11)
3281 #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1 << 11)
3282 #define I915_DISPLAY_PIPE_C_VBLANK_INTERRUPT (1 << 10)
3283 #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1 << 10)
3284 #define I915_DISPLAY_PIPE_C_EVENT_INTERRUPT (1 << 9)
3285 #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1 << 9)
3286 #define I915_DISPLAY_PIPE_C_DPBM_INTERRUPT (1 << 8)
3287 #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1 << 8)
3288 #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1 << 7)
3289 #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1 << 6)
3290 #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1 << 5)
3291 #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1 << 4)
3292 #define I915_DISPLAY_PIPE_A_DPBM_INTERRUPT (1 << 3)
3293 #define I915_DISPLAY_PIPE_B_DPBM_INTERRUPT (1 << 2)
3294 #define I915_DEBUG_INTERRUPT (1 << 2)
3295 #define I915_WINVALID_INTERRUPT (1 << 1)
3296 #define I915_USER_INTERRUPT (1 << 1)
3297 #define I915_ASLE_INTERRUPT (1 << 0)
3298 #define I915_BSD_USER_INTERRUPT (1 << 25)
3300 #define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000)
3301 #define I915_HDMI_LPE_AUDIO_SIZE 0x1000
3303 /* DisplayPort Audio w/ LPE */
3304 #define VLV_AUD_CHICKEN_BIT_REG _MMIO(VLV_DISPLAY_BASE + 0x62F38)
3305 #define VLV_CHICKEN_BIT_DBG_ENABLE (1 << 0)
3307 #define _VLV_AUD_PORT_EN_B_DBG (VLV_DISPLAY_BASE + 0x62F20)
3308 #define _VLV_AUD_PORT_EN_C_DBG (VLV_DISPLAY_BASE + 0x62F30)
3309 #define _VLV_AUD_PORT_EN_D_DBG (VLV_DISPLAY_BASE + 0x62F34)
3310 #define VLV_AUD_PORT_EN_DBG(port) _MMIO_PORT3((port) - PORT_B, \
3311 _VLV_AUD_PORT_EN_B_DBG, \
3312 _VLV_AUD_PORT_EN_C_DBG, \
3313 _VLV_AUD_PORT_EN_D_DBG)
3314 #define VLV_AMP_MUTE (1 << 1)
3316 #define GEN6_BSD_RNCID _MMIO(0x12198)
3318 #define GEN7_FF_THREAD_MODE _MMIO(0x20a0)
3319 #define GEN7_FF_SCHED_MASK 0x0077070
3320 #define GEN8_FF_DS_REF_CNT_FFME (1 << 19)
3321 #define GEN12_FF_TESSELATION_DOP_GATE_DISABLE BIT(19)
3322 #define GEN7_FF_TS_SCHED_HS1 (0x5 << 16)
3323 #define GEN7_FF_TS_SCHED_HS0 (0x3 << 16)
3324 #define GEN7_FF_TS_SCHED_LOAD_BALANCE (0x1 << 16)
3325 #define GEN7_FF_TS_SCHED_HW (0x0 << 16) /* Default */
3326 #define GEN7_FF_VS_REF_CNT_FFME (1 << 15)
3327 #define GEN7_FF_VS_SCHED_HS1 (0x5 << 12)
3328 #define GEN7_FF_VS_SCHED_HS0 (0x3 << 12)
3329 #define GEN7_FF_VS_SCHED_LOAD_BALANCE (0x1 << 12) /* Default */
3330 #define GEN7_FF_VS_SCHED_HW (0x0 << 12)
3331 #define GEN7_FF_DS_SCHED_HS1 (0x5 << 4)
3332 #define GEN7_FF_DS_SCHED_HS0 (0x3 << 4)
3333 #define GEN7_FF_DS_SCHED_LOAD_BALANCE (0x1 << 4) /* Default */
3334 #define GEN7_FF_DS_SCHED_HW (0x0 << 4)
3337 * Framebuffer compression (915+ only)
3340 #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */
3341 #define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */
3342 #define FBC_CONTROL _MMIO(0x3208)
3343 #define FBC_CTL_EN REG_BIT(31)
3344 #define FBC_CTL_PERIODIC REG_BIT(30)
3345 #define FBC_CTL_INTERVAL_MASK REG_GENMASK(29, 16)
3346 #define FBC_CTL_INTERVAL(x) REG_FIELD_PREP(FBC_CTL_INTERVAL_MASK, (x))
3347 #define FBC_CTL_STOP_ON_MOD REG_BIT(15)
3348 #define FBC_CTL_UNCOMPRESSIBLE REG_BIT(14) /* i915+ */
3349 #define FBC_CTL_C3_IDLE REG_BIT(13) /* i945gm */
3350 #define FBC_CTL_STRIDE_MASK REG_GENMASK(12, 5)
3351 #define FBC_CTL_STRIDE(x) REG_FIELD_PREP(FBC_CTL_STRIDE_MASK, (x))
3352 #define FBC_CTL_FENCENO_MASK REG_GENMASK(3, 0)
3353 #define FBC_CTL_FENCENO(x) REG_FIELD_PREP(FBC_CTL_FENCENO_MASK, (x))
3354 #define FBC_COMMAND _MMIO(0x320c)
3355 #define FBC_CMD_COMPRESS (1 << 0)
3356 #define FBC_STATUS _MMIO(0x3210)
3357 #define FBC_STAT_COMPRESSING (1 << 31)
3358 #define FBC_STAT_COMPRESSED (1 << 30)
3359 #define FBC_STAT_MODIFIED (1 << 29)
3360 #define FBC_STAT_CURRENT_LINE_SHIFT (0)
3361 #define FBC_CONTROL2 _MMIO(0x3214)
3362 #define FBC_CTL_FENCE_DBL (0 << 4)
3363 #define FBC_CTL_IDLE_IMM (0 << 2)
3364 #define FBC_CTL_IDLE_FULL (1 << 2)
3365 #define FBC_CTL_IDLE_LINE (2 << 2)
3366 #define FBC_CTL_IDLE_DEBUG (3 << 2)
3367 #define FBC_CTL_CPU_FENCE (1 << 1)
3368 #define FBC_CTL_PLANE(plane) ((plane) << 0)
3369 #define FBC_FENCE_OFF _MMIO(0x3218) /* BSpec typo has 321Bh */
3370 #define FBC_TAG(i) _MMIO(0x3300 + (i) * 4)
3372 #define FBC_LL_SIZE (1536)
3374 #define FBC_LLC_READ_CTRL _MMIO(0x9044)
3375 #define FBC_LLC_FULLY_OPEN (1 << 30)
3377 /* Framebuffer compression for GM45+ */
3378 #define DPFC_CB_BASE _MMIO(0x3200)
3379 #define DPFC_CONTROL _MMIO(0x3208)
3380 #define DPFC_CTL_EN (1 << 31)
3381 #define DPFC_CTL_PLANE(plane) ((plane) << 30)
3382 #define IVB_DPFC_CTL_PLANE(plane) ((plane) << 29)
3383 #define DPFC_CTL_FENCE_EN (1 << 29)
3384 #define IVB_DPFC_CTL_FENCE_EN (1 << 28)
3385 #define DPFC_CTL_PERSISTENT_MODE (1 << 25)
3386 #define DPFC_SR_EN (1 << 10)
3387 #define DPFC_CTL_LIMIT_1X (0 << 6)
3388 #define DPFC_CTL_LIMIT_2X (1 << 6)
3389 #define DPFC_CTL_LIMIT_4X (2 << 6)
3390 #define DPFC_RECOMP_CTL _MMIO(0x320c)
3391 #define DPFC_RECOMP_STALL_EN (1 << 27)
3392 #define DPFC_RECOMP_STALL_WM_SHIFT (16)
3393 #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
3394 #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
3395 #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
3396 #define DPFC_STATUS _MMIO(0x3210)
3397 #define DPFC_INVAL_SEG_SHIFT (16)
3398 #define DPFC_INVAL_SEG_MASK (0x07ff0000)
3399 #define DPFC_COMP_SEG_SHIFT (0)
3400 #define DPFC_COMP_SEG_MASK (0x000007ff)
3401 #define DPFC_STATUS2 _MMIO(0x3214)
3402 #define DPFC_FENCE_YOFF _MMIO(0x3218)
3403 #define DPFC_CHICKEN _MMIO(0x3224)
3404 #define DPFC_HT_MODIFY (1 << 31)
3406 /* Framebuffer compression for Ironlake */
3407 #define ILK_DPFC_CB_BASE _MMIO(0x43200)
3408 #define ILK_DPFC_CONTROL _MMIO(0x43208)
3409 #define FBC_CTL_FALSE_COLOR (1 << 10)
3410 /* The bit 28-8 is reserved */
3411 #define DPFC_RESERVED (0x1FFFFF00)
3412 #define ILK_DPFC_RECOMP_CTL _MMIO(0x4320c)
3413 #define ILK_DPFC_STATUS _MMIO(0x43210)
3414 #define ILK_DPFC_COMP_SEG_MASK 0x7ff
3415 #define IVB_FBC_STATUS2 _MMIO(0x43214)
3416 #define IVB_FBC_COMP_SEG_MASK 0x7ff
3417 #define BDW_FBC_COMP_SEG_MASK 0xfff
3418 #define ILK_DPFC_FENCE_YOFF _MMIO(0x43218)
3419 #define ILK_DPFC_CHICKEN _MMIO(0x43224)
3420 #define ILK_DPFC_DISABLE_DUMMY0 (1 << 8)
3421 #define ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL (1 << 14)
3422 #define ILK_DPFC_NUKE_ON_ANY_MODIFICATION (1 << 23)
3423 #define GLK_FBC_STRIDE _MMIO(0x43228)
3424 #define FBC_STRIDE_OVERRIDE REG_BIT(15)
3425 #define FBC_STRIDE_MASK REG_GENMASK(14, 0)
3426 #define FBC_STRIDE(x) REG_FIELD_PREP(FBC_STRIDE_MASK, (x))
3427 #define ILK_FBC_RT_BASE _MMIO(0x2128)
3428 #define ILK_FBC_RT_VALID (1 << 0)
3429 #define SNB_FBC_FRONT_BUFFER (1 << 1)
3431 #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
3432 #define ILK_FBCQ_DIS (1 << 22)
3433 #define ILK_PABSTRETCH_DIS REG_BIT(21)
3434 #define ILK_SABSTRETCH_DIS REG_BIT(20)
3435 #define IVB_PRI_STRETCH_MAX_MASK REG_GENMASK(21, 20)
3436 #define IVB_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 0)
3437 #define IVB_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 1)
3438 #define IVB_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 2)
3439 #define IVB_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 3)
3440 #define IVB_SPR_STRETCH_MAX_MASK REG_GENMASK(19, 18)
3441 #define IVB_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 0)
3442 #define IVB_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 1)
3443 #define IVB_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 2)
3444 #define IVB_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 3)
3448 * Framebuffer compression for Sandybridge
3450 * The following two registers are of type GTTMMADR
3452 #define SNB_DPFC_CTL_SA _MMIO(0x100100)
3453 #define SNB_CPU_FENCE_ENABLE (1 << 29)
3454 #define DPFC_CPU_FENCE_OFFSET _MMIO(0x100104)
3456 /* Framebuffer compression for Ivybridge */
3457 #define IVB_FBC_RT_BASE _MMIO(0x7020)
3458 #define IVB_FBC_RT_BASE_UPPER _MMIO(0x7024)
3460 #define IPS_CTL _MMIO(0x43408)
3461 #define IPS_ENABLE (1 << 31)
3463 #define MSG_FBC_REND_STATE _MMIO(0x50380)
3464 #define FBC_REND_NUKE (1 << 2)
3465 #define FBC_REND_CACHE_CLEAN (1 << 1)
3470 #define GPIO(gpio) _MMIO(dev_priv->gpio_mmio_base + 0x5010 + \
3473 # define GPIO_CLOCK_DIR_MASK (1 << 0)
3474 # define GPIO_CLOCK_DIR_IN (0 << 1)
3475 # define GPIO_CLOCK_DIR_OUT (1 << 1)
3476 # define GPIO_CLOCK_VAL_MASK (1 << 2)
3477 # define GPIO_CLOCK_VAL_OUT (1 << 3)
3478 # define GPIO_CLOCK_VAL_IN (1 << 4)
3479 # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
3480 # define GPIO_DATA_DIR_MASK (1 << 8)
3481 # define GPIO_DATA_DIR_IN (0 << 9)
3482 # define GPIO_DATA_DIR_OUT (1 << 9)
3483 # define GPIO_DATA_VAL_MASK (1 << 10)
3484 # define GPIO_DATA_VAL_OUT (1 << 11)
3485 # define GPIO_DATA_VAL_IN (1 << 12)
3486 # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
3488 #define GMBUS0 _MMIO(dev_priv->gpio_mmio_base + 0x5100) /* clock/port select */
3489 #define GMBUS_AKSV_SELECT (1 << 11)
3490 #define GMBUS_RATE_100KHZ (0 << 8)
3491 #define GMBUS_RATE_50KHZ (1 << 8)
3492 #define GMBUS_RATE_400KHZ (2 << 8) /* reserved on Pineview */
3493 #define GMBUS_RATE_1MHZ (3 << 8) /* reserved on Pineview */
3494 #define GMBUS_HOLD_EXT (1 << 7) /* 300ns hold time, rsvd on Pineview */
3495 #define GMBUS_BYTE_CNT_OVERRIDE (1 << 6)
3497 #define GMBUS1 _MMIO(dev_priv->gpio_mmio_base + 0x5104) /* command/status */
3498 #define GMBUS_SW_CLR_INT (1 << 31)
3499 #define GMBUS_SW_RDY (1 << 30)
3500 #define GMBUS_ENT (1 << 29) /* enable timeout */
3501 #define GMBUS_CYCLE_NONE (0 << 25)
3502 #define GMBUS_CYCLE_WAIT (1 << 25)
3503 #define GMBUS_CYCLE_INDEX (2 << 25)
3504 #define GMBUS_CYCLE_STOP (4 << 25)
3505 #define GMBUS_BYTE_COUNT_SHIFT 16
3506 #define GMBUS_BYTE_COUNT_MAX 256U
3507 #define GEN9_GMBUS_BYTE_COUNT_MAX 511U
3508 #define GMBUS_SLAVE_INDEX_SHIFT 8
3509 #define GMBUS_SLAVE_ADDR_SHIFT 1
3510 #define GMBUS_SLAVE_READ (1 << 0)
3511 #define GMBUS_SLAVE_WRITE (0 << 0)
3512 #define GMBUS2 _MMIO(dev_priv->gpio_mmio_base + 0x5108) /* status */
3513 #define GMBUS_INUSE (1 << 15)
3514 #define GMBUS_HW_WAIT_PHASE (1 << 14)
3515 #define GMBUS_STALL_TIMEOUT (1 << 13)
3516 #define GMBUS_INT (1 << 12)
3517 #define GMBUS_HW_RDY (1 << 11)
3518 #define GMBUS_SATOER (1 << 10)
3519 #define GMBUS_ACTIVE (1 << 9)
3520 #define GMBUS3 _MMIO(dev_priv->gpio_mmio_base + 0x510c) /* data buffer bytes 3-0 */
3521 #define GMBUS4 _MMIO(dev_priv->gpio_mmio_base + 0x5110) /* interrupt mask (Pineview+) */
3522 #define GMBUS_SLAVE_TIMEOUT_EN (1 << 4)
3523 #define GMBUS_NAK_EN (1 << 3)
3524 #define GMBUS_IDLE_EN (1 << 2)
3525 #define GMBUS_HW_WAIT_EN (1 << 1)
3526 #define GMBUS_HW_RDY_EN (1 << 0)
3527 #define GMBUS5 _MMIO(dev_priv->gpio_mmio_base + 0x5120) /* byte index */
3528 #define GMBUS_2BYTE_INDEX_EN (1 << 31)
3531 * Clock control & power management
3533 #define _DPLL_A (DISPLAY_MMIO_BASE(dev_priv) + 0x6014)
3534 #define _DPLL_B (DISPLAY_MMIO_BASE(dev_priv) + 0x6018)
3535 #define _CHV_DPLL_C (DISPLAY_MMIO_BASE(dev_priv) + 0x6030)
3536 #define DPLL(pipe) _MMIO_PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
3538 #define VGA0 _MMIO(0x6000)
3539 #define VGA1 _MMIO(0x6004)
3540 #define VGA_PD _MMIO(0x6010)
3541 #define VGA0_PD_P2_DIV_4 (1 << 7)
3542 #define VGA0_PD_P1_DIV_2 (1 << 5)
3543 #define VGA0_PD_P1_SHIFT 0
3544 #define VGA0_PD_P1_MASK (0x1f << 0)
3545 #define VGA1_PD_P2_DIV_4 (1 << 15)
3546 #define VGA1_PD_P1_DIV_2 (1 << 13)
3547 #define VGA1_PD_P1_SHIFT 8
3548 #define VGA1_PD_P1_MASK (0x1f << 8)
3549 #define DPLL_VCO_ENABLE (1 << 31)
3550 #define DPLL_SDVO_HIGH_SPEED (1 << 30)
3551 #define DPLL_DVO_2X_MODE (1 << 30)
3552 #define DPLL_EXT_BUFFER_ENABLE_VLV (1 << 30)
3553 #define DPLL_SYNCLOCK_ENABLE (1 << 29)
3554 #define DPLL_REF_CLK_ENABLE_VLV (1 << 29)
3555 #define DPLL_VGA_MODE_DIS (1 << 28)
3556 #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
3557 #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
3558 #define DPLL_MODE_MASK (3 << 26)
3559 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
3560 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
3561 #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
3562 #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
3563 #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
3564 #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
3565 #define DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW 0x00ff8000 /* Pineview */
3566 #define DPLL_LOCK_VLV (1 << 15)
3567 #define DPLL_INTEGRATED_CRI_CLK_VLV (1 << 14)
3568 #define DPLL_INTEGRATED_REF_CLK_VLV (1 << 13)
3569 #define DPLL_SSC_REF_CLK_CHV (1 << 13)
3570 #define DPLL_PORTC_READY_MASK (0xf << 4)
3571 #define DPLL_PORTB_READY_MASK (0xf)
3573 #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
3575 /* Additional CHV pll/phy registers */
3576 #define DPIO_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x6240)
3577 #define DPLL_PORTD_READY_MASK (0xf)
3578 #define DISPLAY_PHY_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x60100)
3579 #define PHY_CH_POWER_DOWN_OVRD_EN(phy, ch) (1 << (2 * (phy) + (ch) + 27))
3580 #define PHY_LDO_DELAY_0NS 0x0
3581 #define PHY_LDO_DELAY_200NS 0x1
3582 #define PHY_LDO_DELAY_600NS 0x2
3583 #define PHY_LDO_SEQ_DELAY(delay, phy) ((delay) << (2 * (phy) + 23))
3584 #define PHY_CH_POWER_DOWN_OVRD(mask, phy, ch) ((mask) << (8 * (phy) + 4 * (ch) + 11))
3585 #define PHY_CH_SU_PSR 0x1
3586 #define PHY_CH_DEEP_PSR 0x7
3587 #define PHY_CH_POWER_MODE(mode, phy, ch) ((mode) << (6 * (phy) + 3 * (ch) + 2))
3588 #define PHY_COM_LANE_RESET_DEASSERT(phy) (1 << (phy))
3589 #define DISPLAY_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x60104)
3590 #define PHY_POWERGOOD(phy) (((phy) == DPIO_PHY0) ? (1 << 31) : (1 << 30))
3591 #define PHY_STATUS_CMN_LDO(phy, ch) (1 << (6 - (6 * (phy) + 3 * (ch))))
3592 #define PHY_STATUS_SPLINE_LDO(phy, ch, spline) (1 << (8 - (6 * (phy) + 3 * (ch) + (spline))))
3595 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
3596 * this field (only one bit may be set).
3598 #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
3599 #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
3600 #define DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW 15
3601 /* i830, required in DVO non-gang */
3602 #define PLL_P2_DIVIDE_BY_4 (1 << 23)
3603 #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
3604 #define PLL_REF_INPUT_DREFCLK (0 << 13)
3605 #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
3606 #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
3607 #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
3608 #define PLL_REF_INPUT_MASK (3 << 13)
3609 #define PLL_LOAD_PULSE_PHASE_SHIFT 9
3611 # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
3612 # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
3613 # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x) - 1) << 9)
3614 # define DPLL_FPA1_P1_POST_DIV_SHIFT 0
3615 # define DPLL_FPA1_P1_POST_DIV_MASK 0xff
3618 * Parallel to Serial Load Pulse phase selection.
3619 * Selects the phase for the 10X DPLL clock for the PCIe
3620 * digital display port. The range is 4 to 13; 10 or more
3621 * is just a flip delay. The default is 6
3623 #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
3624 #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
3626 * SDVO multiplier for 945G/GM. Not used on 965.
3628 #define SDVO_MULTIPLIER_MASK 0x000000ff
3629 #define SDVO_MULTIPLIER_SHIFT_HIRES 4
3630 #define SDVO_MULTIPLIER_SHIFT_VGA 0
3632 #define _DPLL_A_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x601c)
3633 #define _DPLL_B_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x6020)
3634 #define _CHV_DPLL_C_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x603c)
3635 #define DPLL_MD(pipe) _MMIO_PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
3638 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
3640 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
3642 #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
3643 #define DPLL_MD_UDI_DIVIDER_SHIFT 24
3644 /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
3645 #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
3646 #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
3648 * SDVO/UDI pixel multiplier.
3650 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
3651 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
3652 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
3653 * dummy bytes in the datastream at an increased clock rate, with both sides of
3654 * the link knowing how many bytes are fill.
3656 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
3657 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
3658 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
3659 * through an SDVO command.
3661 * This register field has values of multiplication factor minus 1, with
3662 * a maximum multiplier of 5 for SDVO.
3664 #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
3665 #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
3667 * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
3668 * This best be set to the default value (3) or the CRT won't work. No,
3669 * I don't entirely understand what this does...
3671 #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
3672 #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
3674 #define RAWCLK_FREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6024)
3676 #define _FPA0 0x6040
3677 #define _FPA1 0x6044
3678 #define _FPB0 0x6048
3679 #define _FPB1 0x604c
3680 #define FP0(pipe) _MMIO_PIPE(pipe, _FPA0, _FPB0)
3681 #define FP1(pipe) _MMIO_PIPE(pipe, _FPA1, _FPB1)
3682 #define FP_N_DIV_MASK 0x003f0000
3683 #define FP_N_PINEVIEW_DIV_MASK 0x00ff0000
3684 #define FP_N_DIV_SHIFT 16
3685 #define FP_M1_DIV_MASK 0x00003f00
3686 #define FP_M1_DIV_SHIFT 8
3687 #define FP_M2_DIV_MASK 0x0000003f
3688 #define FP_M2_PINEVIEW_DIV_MASK 0x000000ff
3689 #define FP_M2_DIV_SHIFT 0
3690 #define DPLL_TEST _MMIO(0x606c)
3691 #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
3692 #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
3693 #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
3694 #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
3695 #define DPLLB_TEST_N_BYPASS (1 << 19)
3696 #define DPLLB_TEST_M_BYPASS (1 << 18)
3697 #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
3698 #define DPLLA_TEST_N_BYPASS (1 << 3)
3699 #define DPLLA_TEST_M_BYPASS (1 << 2)
3700 #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
3701 #define D_STATE _MMIO(0x6104)
3702 #define DSTATE_GFX_RESET_I830 (1 << 6)
3703 #define DSTATE_PLL_D3_OFF (1 << 3)
3704 #define DSTATE_GFX_CLOCK_GATING (1 << 1)
3705 #define DSTATE_DOT_CLOCK_GATING (1 << 0)
3706 #define DSPCLK_GATE_D _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x6200)
3707 # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
3708 # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
3709 # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
3710 # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
3711 # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
3712 # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
3713 # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
3714 # define PNV_GMBUSUNIT_CLOCK_GATE_DISABLE (1 << 24) /* pnv */
3715 # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
3716 # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
3717 # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
3718 # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
3719 # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
3720 # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
3721 # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
3722 # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
3723 # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
3724 # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
3725 # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
3726 # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
3727 # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
3728 # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
3729 # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
3730 # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
3731 # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
3732 # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
3733 # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
3734 # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
3735 # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
3737 * This bit must be set on the 830 to prevent hangs when turning off the
3740 # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
3741 # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
3742 # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
3743 # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
3744 # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
3746 #define RENCLK_GATE_D1 _MMIO(0x6204)
3747 # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
3748 # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
3749 # define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
3750 # define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
3751 # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
3752 # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
3753 # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
3754 # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
3755 # define MAG_CLOCK_GATE_DISABLE (1 << 5)
3756 /* This bit must be unset on 855,865 */
3757 # define MECI_CLOCK_GATE_DISABLE (1 << 4)
3758 # define DCMP_CLOCK_GATE_DISABLE (1 << 3)
3759 # define MEC_CLOCK_GATE_DISABLE (1 << 2)
3760 # define MECO_CLOCK_GATE_DISABLE (1 << 1)
3761 /* This bit must be set on 855,865. */
3762 # define SV_CLOCK_GATE_DISABLE (1 << 0)
3763 # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
3764 # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
3765 # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
3766 # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
3767 # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
3768 # define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
3769 # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
3770 # define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
3771 # define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
3772 # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
3773 # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
3774 # define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
3775 # define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
3776 # define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
3777 # define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
3778 # define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
3779 # define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
3781 # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
3782 /* This bit must always be set on 965G/965GM */
3783 # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
3784 # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
3785 # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
3786 # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
3787 # define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
3788 # define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
3789 /* This bit must always be set on 965G */
3790 # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
3791 # define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
3792 # define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
3793 # define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
3794 # define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
3795 # define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
3796 # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
3797 # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
3798 # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
3799 # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
3800 # define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
3801 # define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
3802 # define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
3803 # define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
3804 # define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
3805 # define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
3806 # define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
3807 # define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
3808 # define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
3810 #define RENCLK_GATE_D2 _MMIO(0x6208)
3811 #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
3812 #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
3813 #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
3815 #define VDECCLK_GATE_D _MMIO(0x620C) /* g4x only */
3816 #define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4)
3818 #define RAMCLK_GATE_D _MMIO(0x6210) /* CRL only */
3819 #define DEUC _MMIO(0x6214) /* CRL only */
3821 #define FW_BLC_SELF_VLV _MMIO(VLV_DISPLAY_BASE + 0x6500)
3822 #define FW_CSPWRDWNEN (1 << 15)
3824 #define MI_ARB_VLV _MMIO(VLV_DISPLAY_BASE + 0x6504)
3826 #define CZCLK_CDCLK_FREQ_RATIO _MMIO(VLV_DISPLAY_BASE + 0x6508)
3827 #define CDCLK_FREQ_SHIFT 4
3828 #define CDCLK_FREQ_MASK (0x1f << CDCLK_FREQ_SHIFT)
3829 #define CZCLK_FREQ_MASK 0xf
3831 #define GCI_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x650C)
3832 #define PFI_CREDIT_63 (9 << 28) /* chv only */
3833 #define PFI_CREDIT_31 (8 << 28) /* chv only */
3834 #define PFI_CREDIT(x) (((x) - 8) << 28) /* 8-15 */
3835 #define PFI_CREDIT_RESEND (1 << 27)
3836 #define VGA_FAST_MODE_DISABLE (1 << 14)
3838 #define GMBUSFREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6510)
3843 #define _PALETTE_A 0xa000
3844 #define _PALETTE_B 0xa800
3845 #define _CHV_PALETTE_C 0xc000
3846 #define PALETTE_RED_MASK REG_GENMASK(23, 16)
3847 #define PALETTE_GREEN_MASK REG_GENMASK(15, 8)
3848 #define PALETTE_BLUE_MASK REG_GENMASK(7, 0)
3849 #define PALETTE(pipe, i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + \
3850 _PICK((pipe), _PALETTE_A, \
3851 _PALETTE_B, _CHV_PALETTE_C) + \
3854 /* MCH MMIO space */
3859 * This mirrors the MCHBAR MMIO space whose location is determined by
3860 * device 0 function 0's pci config register 0x44 or 0x48 and matches it in
3861 * every way. It is not accessible from the CP register read instructions.
3863 * Starting from Haswell, you can't write registers using the MCHBAR mirror,
3866 #define MCHBAR_MIRROR_BASE 0x10000
3868 #define MCHBAR_MIRROR_BASE_SNB 0x140000
3870 #define CTG_STOLEN_RESERVED _MMIO(MCHBAR_MIRROR_BASE + 0x34)
3871 #define ELK_STOLEN_RESERVED _MMIO(MCHBAR_MIRROR_BASE + 0x48)
3872 #define G4X_STOLEN_RESERVED_ADDR1_MASK (0xFFFF << 16)
3873 #define G4X_STOLEN_RESERVED_ADDR2_MASK (0xFFF << 4)
3874 #define G4X_STOLEN_RESERVED_ENABLE (1 << 0)
3876 /* Memory controller frequency in MCHBAR for Haswell (possible SNB+) */
3877 #define DCLK _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5e04)
3879 /* 915-945 and GM965 MCH register controlling DRAM channel access */
3880 #define DCC _MMIO(MCHBAR_MIRROR_BASE + 0x200)
3881 #define DCC_ADDRESSING_MODE_SINGLE_CHANNEL (0 << 0)
3882 #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_ASYMMETRIC (1 << 0)
3883 #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_INTERLEAVED (2 << 0)
3884 #define DCC_ADDRESSING_MODE_MASK (3 << 0)
3885 #define DCC_CHANNEL_XOR_DISABLE (1 << 10)
3886 #define DCC_CHANNEL_XOR_BIT_17 (1 << 9)
3887 #define DCC2 _MMIO(MCHBAR_MIRROR_BASE + 0x204)
3888 #define DCC2_MODIFIED_ENHANCED_DISABLE (1 << 20)
3890 /* Pineview MCH register contains DDR3 setting */
3891 #define CSHRDDR3CTL _MMIO(MCHBAR_MIRROR_BASE + 0x1a8)
3892 #define CSHRDDR3CTL_DDR3 (1 << 2)
3894 /* 965 MCH register controlling DRAM channel configuration */
3895 #define C0DRB3_BW _MMIO(MCHBAR_MIRROR_BASE + 0x206)
3896 #define C1DRB3_BW _MMIO(MCHBAR_MIRROR_BASE + 0x606)
3898 /* snb MCH registers for reading the DRAM channel configuration */
3899 #define MAD_DIMM_C0 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5004)
3900 #define MAD_DIMM_C1 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5008)
3901 #define MAD_DIMM_C2 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x500C)
3902 #define MAD_DIMM_ECC_MASK (0x3 << 24)
3903 #define MAD_DIMM_ECC_OFF (0x0 << 24)
3904 #define MAD_DIMM_ECC_IO_ON_LOGIC_OFF (0x1 << 24)
3905 #define MAD_DIMM_ECC_IO_OFF_LOGIC_ON (0x2 << 24)
3906 #define MAD_DIMM_ECC_ON (0x3 << 24)
3907 #define MAD_DIMM_ENH_INTERLEAVE (0x1 << 22)
3908 #define MAD_DIMM_RANK_INTERLEAVE (0x1 << 21)
3909 #define MAD_DIMM_B_WIDTH_X16 (0x1 << 20) /* X8 chips if unset */
3910 #define MAD_DIMM_A_WIDTH_X16 (0x1 << 19) /* X8 chips if unset */
3911 #define MAD_DIMM_B_DUAL_RANK (0x1 << 18)
3912 #define MAD_DIMM_A_DUAL_RANK (0x1 << 17)
3913 #define MAD_DIMM_A_SELECT (0x1 << 16)
3914 /* DIMM sizes are in multiples of 256mb. */
3915 #define MAD_DIMM_B_SIZE_SHIFT 8
3916 #define MAD_DIMM_B_SIZE_MASK (0xff << MAD_DIMM_B_SIZE_SHIFT)
3917 #define MAD_DIMM_A_SIZE_SHIFT 0
3918 #define MAD_DIMM_A_SIZE_MASK (0xff << MAD_DIMM_A_SIZE_SHIFT)
3920 /* snb MCH registers for priority tuning */
3921 #define MCH_SSKPD _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5d10)
3922 #define MCH_SSKPD_WM0_MASK 0x3f
3923 #define MCH_SSKPD_WM0_VAL 0xc
3925 /* Clocking configuration register */
3926 #define CLKCFG _MMIO(MCHBAR_MIRROR_BASE + 0xc00)
3927 #define CLKCFG_FSB_400 (0 << 0) /* hrawclk 100 */
3928 #define CLKCFG_FSB_400_ALT (5 << 0) /* hrawclk 100 */
3929 #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
3930 #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
3931 #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */
3932 #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */
3933 #define CLKCFG_FSB_1067_ALT (0 << 0) /* hrawclk 266 */
3934 #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */
3935 #define CLKCFG_FSB_1333_ALT (4 << 0) /* hrawclk 333 */
3936 #define CLKCFG_FSB_1600_ALT (6 << 0) /* hrawclk 400 */
3937 #define CLKCFG_FSB_MASK (7 << 0)
3938 #define CLKCFG_MEM_533 (1 << 4)
3939 #define CLKCFG_MEM_667 (2 << 4)
3940 #define CLKCFG_MEM_800 (3 << 4)
3941 #define CLKCFG_MEM_MASK (7 << 4)
3943 #define HPLLVCO _MMIO(MCHBAR_MIRROR_BASE + 0xc38)
3944 #define HPLLVCO_MOBILE _MMIO(MCHBAR_MIRROR_BASE + 0xc0f)
3946 #define TSC1 _MMIO(0x11001)
3947 #define TSE (1 << 0)
3948 #define TR1 _MMIO(0x11006)
3949 #define TSFS _MMIO(0x11020)
3950 #define TSFS_SLOPE_MASK 0x0000ff00
3951 #define TSFS_SLOPE_SHIFT 8
3952 #define TSFS_INTR_MASK 0x000000ff
3954 #define CRSTANDVID _MMIO(0x11100)
3955 #define PXVFREQ(fstart) _MMIO(0x11110 + (fstart) * 4) /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
3956 #define PXVFREQ_PX_MASK 0x7f000000
3957 #define PXVFREQ_PX_SHIFT 24
3958 #define VIDFREQ_BASE _MMIO(0x11110)
3959 #define VIDFREQ1 _MMIO(0x11110) /* VIDFREQ1-4 (0x1111c) (Cantiga) */
3960 #define VIDFREQ2 _MMIO(0x11114)
3961 #define VIDFREQ3 _MMIO(0x11118)
3962 #define VIDFREQ4 _MMIO(0x1111c)
3963 #define VIDFREQ_P0_MASK 0x1f000000
3964 #define VIDFREQ_P0_SHIFT 24
3965 #define VIDFREQ_P0_CSCLK_MASK 0x00f00000
3966 #define VIDFREQ_P0_CSCLK_SHIFT 20
3967 #define VIDFREQ_P0_CRCLK_MASK 0x000f0000
3968 #define VIDFREQ_P0_CRCLK_SHIFT 16
3969 #define VIDFREQ_P1_MASK 0x00001f00
3970 #define VIDFREQ_P1_SHIFT 8
3971 #define VIDFREQ_P1_CSCLK_MASK 0x000000f0
3972 #define VIDFREQ_P1_CSCLK_SHIFT 4
3973 #define VIDFREQ_P1_CRCLK_MASK 0x0000000f
3974 #define INTTOEXT_BASE_ILK _MMIO(0x11300)
3975 #define INTTOEXT_BASE _MMIO(0x11120) /* INTTOEXT1-8 (0x1113c) */
3976 #define INTTOEXT_MAP3_SHIFT 24
3977 #define INTTOEXT_MAP3_MASK (0x1f << INTTOEXT_MAP3_SHIFT)
3978 #define INTTOEXT_MAP2_SHIFT 16
3979 #define INTTOEXT_MAP2_MASK (0x1f << INTTOEXT_MAP2_SHIFT)
3980 #define INTTOEXT_MAP1_SHIFT 8
3981 #define INTTOEXT_MAP1_MASK (0x1f << INTTOEXT_MAP1_SHIFT)
3982 #define INTTOEXT_MAP0_SHIFT 0
3983 #define INTTOEXT_MAP0_MASK (0x1f << INTTOEXT_MAP0_SHIFT)
3984 #define MEMSWCTL _MMIO(0x11170) /* Ironlake only */
3985 #define MEMCTL_CMD_MASK 0xe000
3986 #define MEMCTL_CMD_SHIFT 13
3987 #define MEMCTL_CMD_RCLK_OFF 0
3988 #define MEMCTL_CMD_RCLK_ON 1
3989 #define MEMCTL_CMD_CHFREQ 2
3990 #define MEMCTL_CMD_CHVID 3
3991 #define MEMCTL_CMD_VMMOFF 4
3992 #define MEMCTL_CMD_VMMON 5
3993 #define MEMCTL_CMD_STS (1 << 12) /* write 1 triggers command, clears
3994 when command complete */
3995 #define MEMCTL_FREQ_MASK 0x0f00 /* jitter, from 0-15 */
3996 #define MEMCTL_FREQ_SHIFT 8
3997 #define MEMCTL_SFCAVM (1 << 7)
3998 #define MEMCTL_TGT_VID_MASK 0x007f
3999 #define MEMIHYST _MMIO(0x1117c)
4000 #define MEMINTREN _MMIO(0x11180) /* 16 bits */
4001 #define MEMINT_RSEXIT_EN (1 << 8)
4002 #define MEMINT_CX_SUPR_EN (1 << 7)
4003 #define MEMINT_CONT_BUSY_EN (1 << 6)
4004 #define MEMINT_AVG_BUSY_EN (1 << 5)
4005 #define MEMINT_EVAL_CHG_EN (1 << 4)
4006 #define MEMINT_MON_IDLE_EN (1 << 3)
4007 #define MEMINT_UP_EVAL_EN (1 << 2)
4008 #define MEMINT_DOWN_EVAL_EN (1 << 1)
4009 #define MEMINT_SW_CMD_EN (1 << 0)
4010 #define MEMINTRSTR _MMIO(0x11182) /* 16 bits */
4011 #define MEM_RSEXIT_MASK 0xc000
4012 #define MEM_RSEXIT_SHIFT 14
4013 #define MEM_CONT_BUSY_MASK 0x3000
4014 #define MEM_CONT_BUSY_SHIFT 12
4015 #define MEM_AVG_BUSY_MASK 0x0c00
4016 #define MEM_AVG_BUSY_SHIFT 10
4017 #define MEM_EVAL_CHG_MASK 0x0300
4018 #define MEM_EVAL_BUSY_SHIFT 8
4019 #define MEM_MON_IDLE_MASK 0x00c0
4020 #define MEM_MON_IDLE_SHIFT 6
4021 #define MEM_UP_EVAL_MASK 0x0030
4022 #define MEM_UP_EVAL_SHIFT 4
4023 #define MEM_DOWN_EVAL_MASK 0x000c
4024 #define MEM_DOWN_EVAL_SHIFT 2
4025 #define MEM_SW_CMD_MASK 0x0003
4026 #define MEM_INT_STEER_GFX 0
4027 #define MEM_INT_STEER_CMR 1
4028 #define MEM_INT_STEER_SMI 2
4029 #define MEM_INT_STEER_SCI 3
4030 #define MEMINTRSTS _MMIO(0x11184)
4031 #define MEMINT_RSEXIT (1 << 7)
4032 #define MEMINT_CONT_BUSY (1 << 6)
4033 #define MEMINT_AVG_BUSY (1 << 5)
4034 #define MEMINT_EVAL_CHG (1 << 4)
4035 #define MEMINT_MON_IDLE (1 << 3)
4036 #define MEMINT_UP_EVAL (1 << 2)
4037 #define MEMINT_DOWN_EVAL (1 << 1)
4038 #define MEMINT_SW_CMD (1 << 0)
4039 #define MEMMODECTL _MMIO(0x11190)
4040 #define MEMMODE_BOOST_EN (1 << 31)
4041 #define MEMMODE_BOOST_FREQ_MASK 0x0f000000 /* jitter for boost, 0-15 */
4042 #define MEMMODE_BOOST_FREQ_SHIFT 24
4043 #define MEMMODE_IDLE_MODE_MASK 0x00030000
4044 #define MEMMODE_IDLE_MODE_SHIFT 16
4045 #define MEMMODE_IDLE_MODE_EVAL 0
4046 #define MEMMODE_IDLE_MODE_CONT 1
4047 #define MEMMODE_HWIDLE_EN (1 << 15)
4048 #define MEMMODE_SWMODE_EN (1 << 14)
4049 #define MEMMODE_RCLK_GATE (1 << 13)
4050 #define MEMMODE_HW_UPDATE (1 << 12)
4051 #define MEMMODE_FSTART_MASK 0x00000f00 /* starting jitter, 0-15 */
4052 #define MEMMODE_FSTART_SHIFT 8
4053 #define MEMMODE_FMAX_MASK 0x000000f0 /* max jitter, 0-15 */
4054 #define MEMMODE_FMAX_SHIFT 4
4055 #define MEMMODE_FMIN_MASK 0x0000000f /* min jitter, 0-15 */
4056 #define RCBMAXAVG _MMIO(0x1119c)
4057 #define MEMSWCTL2 _MMIO(0x1119e) /* Cantiga only */
4058 #define SWMEMCMD_RENDER_OFF (0 << 13)
4059 #define SWMEMCMD_RENDER_ON (1 << 13)
4060 #define SWMEMCMD_SWFREQ (2 << 13)
4061 #define SWMEMCMD_TARVID (3 << 13)
4062 #define SWMEMCMD_VRM_OFF (4 << 13)
4063 #define SWMEMCMD_VRM_ON (5 << 13)
4064 #define CMDSTS (1 << 12)
4065 #define SFCAVM (1 << 11)
4066 #define SWFREQ_MASK 0x0380 /* P0-7 */
4067 #define SWFREQ_SHIFT 7
4068 #define TARVID_MASK 0x001f
4069 #define MEMSTAT_CTG _MMIO(0x111a0)
4070 #define RCBMINAVG _MMIO(0x111a0)
4071 #define RCUPEI _MMIO(0x111b0)
4072 #define RCDNEI _MMIO(0x111b4)
4073 #define RSTDBYCTL _MMIO(0x111b8)
4074 #define RS1EN (1 << 31)
4075 #define RS2EN (1 << 30)
4076 #define RS3EN (1 << 29)
4077 #define D3RS3EN (1 << 28) /* Display D3 imlies RS3 */
4078 #define SWPROMORSX (1 << 27) /* RSx promotion timers ignored */
4079 #define RCWAKERW (1 << 26) /* Resetwarn from PCH causes wakeup */
4080 #define DPRSLPVREN (1 << 25) /* Fast voltage ramp enable */
4081 #define GFXTGHYST (1 << 24) /* Hysteresis to allow trunk gating */
4082 #define RCX_SW_EXIT (1 << 23) /* Leave RSx and prevent re-entry */
4083 #define RSX_STATUS_MASK (7 << 20)
4084 #define RSX_STATUS_ON (0 << 20)
4085 #define RSX_STATUS_RC1 (1 << 20)
4086 #define RSX_STATUS_RC1E (2 << 20)
4087 #define RSX_STATUS_RS1 (3 << 20)
4088 #define RSX_STATUS_RS2 (4 << 20) /* aka rc6 */
4089 #define RSX_STATUS_RSVD (5 << 20) /* deep rc6 unsupported on ilk */
4090 #define RSX_STATUS_RS3 (6 << 20) /* rs3 unsupported on ilk */
4091 #define RSX_STATUS_RSVD2 (7 << 20)
4092 #define UWRCRSXE (1 << 19) /* wake counter limit prevents rsx */
4093 #define RSCRP (1 << 18) /* rs requests control on rs1/2 reqs */
4094 #define JRSC (1 << 17) /* rsx coupled to cpu c-state */
4095 #define RS2INC0 (1 << 16) /* allow rs2 in cpu c0 */
4096 #define RS1CONTSAV_MASK (3 << 14)
4097 #define RS1CONTSAV_NO_RS1 (0 << 14) /* rs1 doesn't save/restore context */
4098 #define RS1CONTSAV_RSVD (1 << 14)
4099 #define RS1CONTSAV_SAVE_RS1 (2 << 14) /* rs1 saves context */
4100 #define RS1CONTSAV_FULL_RS1 (3 << 14) /* rs1 saves and restores context */
4101 #define NORMSLEXLAT_MASK (3 << 12)
4102 #define SLOW_RS123 (0 << 12)
4103 #define SLOW_RS23 (1 << 12)
4104 #define SLOW_RS3 (2 << 12)
4105 #define NORMAL_RS123 (3 << 12)
4106 #define RCMODE_TIMEOUT (1 << 11) /* 0 is eval interval method */
4107 #define IMPROMOEN (1 << 10) /* promo is immediate or delayed until next idle interval (only for timeout method above) */
4108 #define RCENTSYNC (1 << 9) /* rs coupled to cpu c-state (3/6/7) */
4109 #define STATELOCK (1 << 7) /* locked to rs_cstate if 0 */
4110 #define RS_CSTATE_MASK (3 << 4)
4111 #define RS_CSTATE_C367_RS1 (0 << 4)
4112 #define RS_CSTATE_C36_RS1_C7_RS2 (1 << 4)
4113 #define RS_CSTATE_RSVD (2 << 4)
4114 #define RS_CSTATE_C367_RS2 (3 << 4)
4115 #define REDSAVES (1 << 3) /* no context save if was idle during rs0 */
4116 #define REDRESTORES (1 << 2) /* no restore if was idle during rs0 */
4117 #define VIDCTL _MMIO(0x111c0)
4118 #define VIDSTS _MMIO(0x111c8)
4119 #define VIDSTART _MMIO(0x111cc) /* 8 bits */
4120 #define MEMSTAT_ILK _MMIO(0x111f8)
4121 #define MEMSTAT_VID_MASK 0x7f00
4122 #define MEMSTAT_VID_SHIFT 8
4123 #define MEMSTAT_PSTATE_MASK 0x00f8
4124 #define MEMSTAT_PSTATE_SHIFT 3
4125 #define MEMSTAT_MON_ACTV (1 << 2)
4126 #define MEMSTAT_SRC_CTL_MASK 0x0003
4127 #define MEMSTAT_SRC_CTL_CORE 0
4128 #define MEMSTAT_SRC_CTL_TRB 1
4129 #define MEMSTAT_SRC_CTL_THM 2
4130 #define MEMSTAT_SRC_CTL_STDBY 3
4131 #define RCPREVBSYTUPAVG _MMIO(0x113b8)
4132 #define RCPREVBSYTDNAVG _MMIO(0x113bc)
4133 #define PMMISC _MMIO(0x11214)
4134 #define MCPPCE_EN (1 << 0) /* enable PM_MSG from PCH->MPC */
4135 #define SDEW _MMIO(0x1124c)
4136 #define CSIEW0 _MMIO(0x11250)
4137 #define CSIEW1 _MMIO(0x11254)
4138 #define CSIEW2 _MMIO(0x11258)
4139 #define PEW(i) _MMIO(0x1125c + (i) * 4) /* 5 registers */
4140 #define DEW(i) _MMIO(0x11270 + (i) * 4) /* 3 registers */
4141 #define MCHAFE _MMIO(0x112c0)
4142 #define CSIEC _MMIO(0x112e0)
4143 #define DMIEC _MMIO(0x112e4)
4144 #define DDREC _MMIO(0x112e8)
4145 #define PEG0EC _MMIO(0x112ec)
4146 #define PEG1EC _MMIO(0x112f0)
4147 #define GFXEC _MMIO(0x112f4)
4148 #define RPPREVBSYTUPAVG _MMIO(0x113b8)
4149 #define RPPREVBSYTDNAVG _MMIO(0x113bc)
4150 #define ECR _MMIO(0x11600)
4151 #define ECR_GPFE (1 << 31)
4152 #define ECR_IMONE (1 << 30)
4153 #define ECR_CAP_MASK 0x0000001f /* Event range, 0-31 */
4154 #define OGW0 _MMIO(0x11608)
4155 #define OGW1 _MMIO(0x1160c)
4156 #define EG0 _MMIO(0x11610)
4157 #define EG1 _MMIO(0x11614)
4158 #define EG2 _MMIO(0x11618)
4159 #define EG3 _MMIO(0x1161c)
4160 #define EG4 _MMIO(0x11620)
4161 #define EG5 _MMIO(0x11624)
4162 #define EG6 _MMIO(0x11628)
4163 #define EG7 _MMIO(0x1162c)
4164 #define PXW(i) _MMIO(0x11664 + (i) * 4) /* 4 registers */
4165 #define PXWL(i) _MMIO(0x11680 + (i) * 8) /* 8 registers */
4166 #define LCFUSE02 _MMIO(0x116c0)
4167 #define LCFUSE_HIV_MASK 0x000000ff
4168 #define CSIPLL0 _MMIO(0x12c10)
4169 #define DDRMPLL1 _MMIO(0X12c20)
4170 #define PEG_BAND_GAP_DATA _MMIO(0x14d68)
4172 #define GEN6_GT_THREAD_STATUS_REG _MMIO(0x13805c)
4173 #define GEN6_GT_THREAD_STATUS_CORE_MASK 0x7
4175 #define GEN6_GT_PERF_STATUS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5948)
4176 #define BXT_GT_PERF_STATUS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x7070)
4177 #define GEN6_RP_STATE_LIMITS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5994)
4178 #define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
4179 #define RP0_CAP_MASK REG_GENMASK(7, 0)
4180 #define RP1_CAP_MASK REG_GENMASK(15, 8)
4181 #define RPN_CAP_MASK REG_GENMASK(23, 16)
4182 #define BXT_RP_STATE_CAP _MMIO(0x138170)
4183 #define GEN9_RP_STATE_LIMITS _MMIO(0x138148)
4184 #define XEHPSDV_RP_STATE_CAP _MMIO(0x250014)
4187 * Logical Context regs
4189 #define CCID(base) _MMIO((base) + 0x180)
4190 #define CCID_EN BIT(0)
4191 #define CCID_EXTENDED_STATE_RESTORE BIT(2)
4192 #define CCID_EXTENDED_STATE_SAVE BIT(3)
4194 * Notes on SNB/IVB/VLV context size:
4195 * - Power context is saved elsewhere (LLC or stolen)
4196 * - Ring/execlist context is saved on SNB, not on IVB
4197 * - Extended context size already includes render context size
4198 * - We always need to follow the extended context size.
4199 * SNB BSpec has comments indicating that we should use the
4200 * render context size instead if execlists are disabled, but
4201 * based on empirical testing that's just nonsense.
4202 * - Pipelined/VF state is saved on SNB/IVB respectively
4203 * - GT1 size just indicates how much of render context
4204 * doesn't need saving on GT1
4206 #define CXT_SIZE _MMIO(0x21a0)
4207 #define GEN6_CXT_POWER_SIZE(cxt_reg) (((cxt_reg) >> 24) & 0x3f)
4208 #define GEN6_CXT_RING_SIZE(cxt_reg) (((cxt_reg) >> 18) & 0x3f)
4209 #define GEN6_CXT_RENDER_SIZE(cxt_reg) (((cxt_reg) >> 12) & 0x3f)
4210 #define GEN6_CXT_EXTENDED_SIZE(cxt_reg) (((cxt_reg) >> 6) & 0x3f)
4211 #define GEN6_CXT_PIPELINE_SIZE(cxt_reg) (((cxt_reg) >> 0) & 0x3f)
4212 #define GEN6_CXT_TOTAL_SIZE(cxt_reg) (GEN6_CXT_RING_SIZE(cxt_reg) + \
4213 GEN6_CXT_EXTENDED_SIZE(cxt_reg) + \
4214 GEN6_CXT_PIPELINE_SIZE(cxt_reg))
4215 #define GEN7_CXT_SIZE _MMIO(0x21a8)
4216 #define GEN7_CXT_POWER_SIZE(ctx_reg) (((ctx_reg) >> 25) & 0x7f)
4217 #define GEN7_CXT_RING_SIZE(ctx_reg) (((ctx_reg) >> 22) & 0x7)
4218 #define GEN7_CXT_RENDER_SIZE(ctx_reg) (((ctx_reg) >> 16) & 0x3f)
4219 #define GEN7_CXT_EXTENDED_SIZE(ctx_reg) (((ctx_reg) >> 9) & 0x7f)
4220 #define GEN7_CXT_GT1_SIZE(ctx_reg) (((ctx_reg) >> 6) & 0x7)
4221 #define GEN7_CXT_VFSTATE_SIZE(ctx_reg) (((ctx_reg) >> 0) & 0x3f)
4222 #define GEN7_CXT_TOTAL_SIZE(ctx_reg) (GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \
4223 GEN7_CXT_VFSTATE_SIZE(ctx_reg))
4226 INTEL_ADVANCED_CONTEXT = 0,
4227 INTEL_LEGACY_32B_CONTEXT,
4228 INTEL_ADVANCED_AD_CONTEXT,
4229 INTEL_LEGACY_64B_CONTEXT
4234 FAULT_AND_HALT, /* Debug only */
4236 FAULT_AND_CONTINUE /* Unsupported */
4239 #define CTX_GTT_ADDRESS_MASK GENMASK(31, 12)
4240 #define GEN8_CTX_VALID (1 << 0)
4241 #define GEN8_CTX_FORCE_PD_RESTORE (1 << 1)
4242 #define GEN8_CTX_FORCE_RESTORE (1 << 2)
4243 #define GEN8_CTX_L3LLC_COHERENT (1 << 5)
4244 #define GEN8_CTX_PRIVILEGE (1 << 8)
4245 #define GEN8_CTX_ADDRESSING_MODE_SHIFT 3
4247 #define GEN8_CTX_ID_SHIFT 32
4248 #define GEN8_CTX_ID_WIDTH 21
4249 #define GEN11_SW_CTX_ID_SHIFT 37
4250 #define GEN11_SW_CTX_ID_WIDTH 11
4251 #define GEN11_ENGINE_CLASS_SHIFT 61
4252 #define GEN11_ENGINE_CLASS_WIDTH 3
4253 #define GEN11_ENGINE_INSTANCE_SHIFT 48
4254 #define GEN11_ENGINE_INSTANCE_WIDTH 6
4256 #define XEHP_SW_CTX_ID_SHIFT 39
4257 #define XEHP_SW_CTX_ID_WIDTH 16
4258 #define XEHP_SW_COUNTER_SHIFT 58
4259 #define XEHP_SW_COUNTER_WIDTH 6
4261 #define CHV_CLK_CTL1 _MMIO(0x101100)
4262 #define VLV_CLK_CTL2 _MMIO(0x101104)
4263 #define CLK_CTL2_CZCOUNT_30NS_SHIFT 28
4269 #define OVADD _MMIO(0x30000)
4270 #define DOVSTA _MMIO(0x30008)
4271 #define OC_BUF (0x3 << 20)
4272 #define OGAMC5 _MMIO(0x30010)
4273 #define OGAMC4 _MMIO(0x30014)
4274 #define OGAMC3 _MMIO(0x30018)
4275 #define OGAMC2 _MMIO(0x3001c)
4276 #define OGAMC1 _MMIO(0x30020)
4277 #define OGAMC0 _MMIO(0x30024)
4280 * GEN9 clock gating regs
4282 #define GEN9_CLKGATE_DIS_0 _MMIO(0x46530)
4283 #define DARBF_GATING_DIS (1 << 27)
4284 #define PWM2_GATING_DIS (1 << 14)
4285 #define PWM1_GATING_DIS (1 << 13)
4287 #define GEN9_CLKGATE_DIS_3 _MMIO(0x46538)
4288 #define TGL_VRH_GATING_DIS REG_BIT(31)
4289 #define DPT_GATING_DIS REG_BIT(22)
4291 #define GEN9_CLKGATE_DIS_4 _MMIO(0x4653C)
4292 #define BXT_GMBUS_GATING_DIS (1 << 14)
4294 #define GEN9_CLKGATE_DIS_5 _MMIO(0x46540)
4295 #define DPCE_GATING_DIS REG_BIT(17)
4297 #define _CLKGATE_DIS_PSL_A 0x46520
4298 #define _CLKGATE_DIS_PSL_B 0x46524
4299 #define _CLKGATE_DIS_PSL_C 0x46528
4300 #define DUPS1_GATING_DIS (1 << 15)
4301 #define DUPS2_GATING_DIS (1 << 19)
4302 #define DUPS3_GATING_DIS (1 << 23)
4303 #define CURSOR_GATING_DIS REG_BIT(28)
4304 #define DPF_GATING_DIS (1 << 10)
4305 #define DPF_RAM_GATING_DIS (1 << 9)
4306 #define DPFR_GATING_DIS (1 << 8)
4308 #define CLKGATE_DIS_PSL(pipe) \
4309 _MMIO_PIPE(pipe, _CLKGATE_DIS_PSL_A, _CLKGATE_DIS_PSL_B)
4312 * GEN10 clock gating regs
4315 #define UNSLCGCTL9440 _MMIO(0x9440)
4316 #define GAMTLBOACS_CLKGATE_DIS REG_BIT(28)
4317 #define GAMTLBVDBOX5_CLKGATE_DIS REG_BIT(27)
4318 #define GAMTLBVDBOX6_CLKGATE_DIS REG_BIT(26)
4319 #define GAMTLBVDBOX3_CLKGATE_DIS REG_BIT(24)
4320 #define GAMTLBVDBOX4_CLKGATE_DIS REG_BIT(23)
4321 #define GAMTLBVDBOX7_CLKGATE_DIS REG_BIT(22)
4322 #define GAMTLBVDBOX2_CLKGATE_DIS REG_BIT(21)
4323 #define GAMTLBVDBOX0_CLKGATE_DIS REG_BIT(17)
4324 #define GAMTLBKCR_CLKGATE_DIS REG_BIT(16)
4325 #define GAMTLBGUC_CLKGATE_DIS REG_BIT(15)
4326 #define GAMTLBBLT_CLKGATE_DIS REG_BIT(14)
4327 #define GAMTLBVDBOX1_CLKGATE_DIS REG_BIT(6)
4329 #define UNSLCGCTL9444 _MMIO(0x9444)
4330 #define GAMTLBGFXA0_CLKGATE_DIS REG_BIT(30)
4331 #define GAMTLBGFXA1_CLKGATE_DIS REG_BIT(29)
4332 #define GAMTLBCOMPA0_CLKGATE_DIS REG_BIT(28)
4333 #define GAMTLBCOMPA1_CLKGATE_DIS REG_BIT(27)
4334 #define GAMTLBCOMPB0_CLKGATE_DIS REG_BIT(26)
4335 #define GAMTLBCOMPB1_CLKGATE_DIS REG_BIT(25)
4336 #define GAMTLBCOMPC0_CLKGATE_DIS REG_BIT(24)
4337 #define GAMTLBCOMPC1_CLKGATE_DIS REG_BIT(23)
4338 #define GAMTLBCOMPD0_CLKGATE_DIS REG_BIT(22)
4339 #define GAMTLBCOMPD1_CLKGATE_DIS REG_BIT(21)
4340 #define GAMTLBMERT_CLKGATE_DIS REG_BIT(20)
4341 #define GAMTLBVEBOX3_CLKGATE_DIS REG_BIT(19)
4342 #define GAMTLBVEBOX2_CLKGATE_DIS REG_BIT(18)
4343 #define GAMTLBVEBOX1_CLKGATE_DIS REG_BIT(17)
4344 #define GAMTLBVEBOX0_CLKGATE_DIS REG_BIT(16)
4345 #define LTCDD_CLKGATE_DIS REG_BIT(10)
4347 #define SLICE_UNIT_LEVEL_CLKGATE _MMIO(0x94d4)
4348 #define SARBUNIT_CLKGATE_DIS (1 << 5)
4349 #define RCCUNIT_CLKGATE_DIS (1 << 7)
4350 #define MSCUNIT_CLKGATE_DIS (1 << 10)
4351 #define NODEDSS_CLKGATE_DIS REG_BIT(12)
4352 #define L3_CLKGATE_DIS REG_BIT(16)
4353 #define L3_CR2X_CLKGATE_DIS REG_BIT(17)
4355 #define SUBSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9524)
4356 #define DSS_ROUTER_CLKGATE_DIS REG_BIT(28)
4357 #define GWUNIT_CLKGATE_DIS REG_BIT(16)
4359 #define SUBSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x9528)
4360 #define CPSSUNIT_CLKGATE_DIS REG_BIT(9)
4362 #define SSMCGCTL9530 _MMIO(0x9530)
4363 #define RTFUNIT_CLKGATE_DIS REG_BIT(18)
4365 #define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434)
4366 #define VFUNIT_CLKGATE_DIS REG_BIT(20)
4367 #define TSGUNIT_CLKGATE_DIS REG_BIT(17) /* XEHPSDV */
4368 #define CG3DDISCFEG_CLKGATE_DIS REG_BIT(17) /* DG2 */
4369 #define GAMEDIA_CLKGATE_DIS REG_BIT(11)
4370 #define HSUNIT_CLKGATE_DIS REG_BIT(8)
4371 #define VSUNIT_CLKGATE_DIS REG_BIT(3)
4373 #define UNSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x94e4)
4374 #define VSUNIT_CLKGATE_DIS_TGL REG_BIT(19)
4375 #define PSDUNIT_CLKGATE_DIS REG_BIT(5)
4377 #define INF_UNIT_LEVEL_CLKGATE _MMIO(0x9560)
4378 #define CGPSF_CLKGATE_DIS (1 << 3)
4381 * Display engine regs
4384 /* Pipe A CRC regs */
4385 #define _PIPE_CRC_CTL_A 0x60050
4386 #define PIPE_CRC_ENABLE (1 << 31)
4387 /* skl+ source selection */
4388 #define PIPE_CRC_SOURCE_PLANE_1_SKL (0 << 28)
4389 #define PIPE_CRC_SOURCE_PLANE_2_SKL (2 << 28)
4390 #define PIPE_CRC_SOURCE_DMUX_SKL (4 << 28)
4391 #define PIPE_CRC_SOURCE_PLANE_3_SKL (6 << 28)
4392 #define PIPE_CRC_SOURCE_PLANE_4_SKL (7 << 28)
4393 #define PIPE_CRC_SOURCE_PLANE_5_SKL (5 << 28)
4394 #define PIPE_CRC_SOURCE_PLANE_6_SKL (3 << 28)
4395 #define PIPE_CRC_SOURCE_PLANE_7_SKL (1 << 28)
4396 /* ivb+ source selection */
4397 #define PIPE_CRC_SOURCE_PRIMARY_IVB (0 << 29)
4398 #define PIPE_CRC_SOURCE_SPRITE_IVB (1 << 29)
4399 #define PIPE_CRC_SOURCE_PF_IVB (2 << 29)
4400 /* ilk+ source selection */
4401 #define PIPE_CRC_SOURCE_PRIMARY_ILK (0 << 28)
4402 #define PIPE_CRC_SOURCE_SPRITE_ILK (1 << 28)
4403 #define PIPE_CRC_SOURCE_PIPE_ILK (2 << 28)
4404 /* embedded DP port on the north display block, reserved on ivb */
4405 #define PIPE_CRC_SOURCE_PORT_A_ILK (4 << 28)
4406 #define PIPE_CRC_SOURCE_FDI_ILK (5 << 28) /* reserved on ivb */
4407 /* vlv source selection */
4408 #define PIPE_CRC_SOURCE_PIPE_VLV (0 << 27)
4409 #define PIPE_CRC_SOURCE_HDMIB_VLV (1 << 27)
4410 #define PIPE_CRC_SOURCE_HDMIC_VLV (2 << 27)
4411 /* with DP port the pipe source is invalid */
4412 #define PIPE_CRC_SOURCE_DP_D_VLV (3 << 27)
4413 #define PIPE_CRC_SOURCE_DP_B_VLV (6 << 27)
4414 #define PIPE_CRC_SOURCE_DP_C_VLV (7 << 27)
4415 /* gen3+ source selection */
4416 #define PIPE_CRC_SOURCE_PIPE_I9XX (0 << 28)
4417 #define PIPE_CRC_SOURCE_SDVOB_I9XX (1 << 28)
4418 #define PIPE_CRC_SOURCE_SDVOC_I9XX (2 << 28)
4419 /* with DP/TV port the pipe source is invalid */
4420 #define PIPE_CRC_SOURCE_DP_D_G4X (3 << 28)
4421 #define PIPE_CRC_SOURCE_TV_PRE (4 << 28)
4422 #define PIPE_CRC_SOURCE_TV_POST (5 << 28)
4423 #define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28)
4424 #define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28)
4425 /* gen2 doesn't have source selection bits */
4426 #define PIPE_CRC_INCLUDE_BORDER_I8XX (1 << 30)
4428 #define _PIPE_CRC_RES_1_A_IVB 0x60064
4429 #define _PIPE_CRC_RES_2_A_IVB 0x60068
4430 #define _PIPE_CRC_RES_3_A_IVB 0x6006c
4431 #define _PIPE_CRC_RES_4_A_IVB 0x60070
4432 #define _PIPE_CRC_RES_5_A_IVB 0x60074
4434 #define _PIPE_CRC_RES_RED_A 0x60060
4435 #define _PIPE_CRC_RES_GREEN_A 0x60064
4436 #define _PIPE_CRC_RES_BLUE_A 0x60068
4437 #define _PIPE_CRC_RES_RES1_A_I915 0x6006c
4438 #define _PIPE_CRC_RES_RES2_A_G4X 0x60080
4440 /* Pipe B CRC regs */
4441 #define _PIPE_CRC_RES_1_B_IVB 0x61064
4442 #define _PIPE_CRC_RES_2_B_IVB 0x61068
4443 #define _PIPE_CRC_RES_3_B_IVB 0x6106c
4444 #define _PIPE_CRC_RES_4_B_IVB 0x61070
4445 #define _PIPE_CRC_RES_5_B_IVB 0x61074
4447 #define PIPE_CRC_CTL(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_CTL_A)
4448 #define PIPE_CRC_RES_1_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_1_A_IVB)
4449 #define PIPE_CRC_RES_2_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_2_A_IVB)
4450 #define PIPE_CRC_RES_3_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_3_A_IVB)
4451 #define PIPE_CRC_RES_4_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_4_A_IVB)
4452 #define PIPE_CRC_RES_5_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_5_A_IVB)
4454 #define PIPE_CRC_RES_RED(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RED_A)
4455 #define PIPE_CRC_RES_GREEN(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_GREEN_A)
4456 #define PIPE_CRC_RES_BLUE(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_BLUE_A)
4457 #define PIPE_CRC_RES_RES1_I915(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES1_A_I915)
4458 #define PIPE_CRC_RES_RES2_G4X(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES2_A_G4X)
4460 /* Pipe A timing regs */
4461 #define _HTOTAL_A 0x60000
4462 #define _HBLANK_A 0x60004
4463 #define _HSYNC_A 0x60008
4464 #define _VTOTAL_A 0x6000c
4465 #define _VBLANK_A 0x60010
4466 #define _VSYNC_A 0x60014
4467 #define _EXITLINE_A 0x60018
4468 #define _PIPEASRC 0x6001c
4469 #define _BCLRPAT_A 0x60020
4470 #define _VSYNCSHIFT_A 0x60028
4471 #define _PIPE_MULT_A 0x6002c
4473 /* Pipe B timing regs */
4474 #define _HTOTAL_B 0x61000
4475 #define _HBLANK_B 0x61004
4476 #define _HSYNC_B 0x61008
4477 #define _VTOTAL_B 0x6100c
4478 #define _VBLANK_B 0x61010
4479 #define _VSYNC_B 0x61014
4480 #define _PIPEBSRC 0x6101c
4481 #define _BCLRPAT_B 0x61020
4482 #define _VSYNCSHIFT_B 0x61028
4483 #define _PIPE_MULT_B 0x6102c
4485 /* DSI 0 timing regs */
4486 #define _HTOTAL_DSI0 0x6b000
4487 #define _HSYNC_DSI0 0x6b008
4488 #define _VTOTAL_DSI0 0x6b00c
4489 #define _VSYNC_DSI0 0x6b014
4490 #define _VSYNCSHIFT_DSI0 0x6b028
4492 /* DSI 1 timing regs */
4493 #define _HTOTAL_DSI1 0x6b800
4494 #define _HSYNC_DSI1 0x6b808
4495 #define _VTOTAL_DSI1 0x6b80c
4496 #define _VSYNC_DSI1 0x6b814
4497 #define _VSYNCSHIFT_DSI1 0x6b828
4499 #define TRANSCODER_A_OFFSET 0x60000
4500 #define TRANSCODER_B_OFFSET 0x61000
4501 #define TRANSCODER_C_OFFSET 0x62000
4502 #define CHV_TRANSCODER_C_OFFSET 0x63000
4503 #define TRANSCODER_D_OFFSET 0x63000
4504 #define TRANSCODER_EDP_OFFSET 0x6f000
4505 #define TRANSCODER_DSI0_OFFSET 0x6b000
4506 #define TRANSCODER_DSI1_OFFSET 0x6b800
4508 #define HTOTAL(trans) _MMIO_TRANS2(trans, _HTOTAL_A)
4509 #define HBLANK(trans) _MMIO_TRANS2(trans, _HBLANK_A)
4510 #define HSYNC(trans) _MMIO_TRANS2(trans, _HSYNC_A)
4511 #define VTOTAL(trans) _MMIO_TRANS2(trans, _VTOTAL_A)
4512 #define VBLANK(trans) _MMIO_TRANS2(trans, _VBLANK_A)
4513 #define VSYNC(trans) _MMIO_TRANS2(trans, _VSYNC_A)
4514 #define BCLRPAT(trans) _MMIO_TRANS2(trans, _BCLRPAT_A)
4515 #define VSYNCSHIFT(trans) _MMIO_TRANS2(trans, _VSYNCSHIFT_A)
4516 #define PIPESRC(trans) _MMIO_TRANS2(trans, _PIPEASRC)
4517 #define PIPE_MULT(trans) _MMIO_TRANS2(trans, _PIPE_MULT_A)
4519 #define EXITLINE(trans) _MMIO_TRANS2(trans, _EXITLINE_A)
4520 #define EXITLINE_ENABLE REG_BIT(31)
4521 #define EXITLINE_MASK REG_GENMASK(12, 0)
4522 #define EXITLINE_SHIFT 0
4525 #define _TRANS_VRR_CTL_A 0x60420
4526 #define _TRANS_VRR_CTL_B 0x61420
4527 #define _TRANS_VRR_CTL_C 0x62420
4528 #define _TRANS_VRR_CTL_D 0x63420
4529 #define TRANS_VRR_CTL(trans) _MMIO_TRANS2(trans, _TRANS_VRR_CTL_A)
4530 #define VRR_CTL_VRR_ENABLE REG_BIT(31)
4531 #define VRR_CTL_IGN_MAX_SHIFT REG_BIT(30)
4532 #define VRR_CTL_FLIP_LINE_EN REG_BIT(29)
4533 #define VRR_CTL_PIPELINE_FULL_MASK REG_GENMASK(10, 3)
4534 #define VRR_CTL_PIPELINE_FULL(x) REG_FIELD_PREP(VRR_CTL_PIPELINE_FULL_MASK, (x))
4535 #define VRR_CTL_PIPELINE_FULL_OVERRIDE REG_BIT(0)
4536 #define XELPD_VRR_CTL_VRR_GUARDBAND_MASK REG_GENMASK(15, 0)
4537 #define XELPD_VRR_CTL_VRR_GUARDBAND(x) REG_FIELD_PREP(XELPD_VRR_CTL_VRR_GUARDBAND_MASK, (x))
4539 #define _TRANS_VRR_VMAX_A 0x60424
4540 #define _TRANS_VRR_VMAX_B 0x61424
4541 #define _TRANS_VRR_VMAX_C 0x62424
4542 #define _TRANS_VRR_VMAX_D 0x63424
4543 #define TRANS_VRR_VMAX(trans) _MMIO_TRANS2(trans, _TRANS_VRR_VMAX_A)
4544 #define VRR_VMAX_MASK REG_GENMASK(19, 0)
4546 #define _TRANS_VRR_VMIN_A 0x60434
4547 #define _TRANS_VRR_VMIN_B 0x61434
4548 #define _TRANS_VRR_VMIN_C 0x62434
4549 #define _TRANS_VRR_VMIN_D 0x63434
4550 #define TRANS_VRR_VMIN(trans) _MMIO_TRANS2(trans, _TRANS_VRR_VMIN_A)
4551 #define VRR_VMIN_MASK REG_GENMASK(15, 0)
4553 #define _TRANS_VRR_VMAXSHIFT_A 0x60428
4554 #define _TRANS_VRR_VMAXSHIFT_B 0x61428
4555 #define _TRANS_VRR_VMAXSHIFT_C 0x62428
4556 #define _TRANS_VRR_VMAXSHIFT_D 0x63428
4557 #define TRANS_VRR_VMAXSHIFT(trans) _MMIO_TRANS2(trans, \
4558 _TRANS_VRR_VMAXSHIFT_A)
4559 #define VRR_VMAXSHIFT_DEC_MASK REG_GENMASK(29, 16)
4560 #define VRR_VMAXSHIFT_DEC REG_BIT(16)
4561 #define VRR_VMAXSHIFT_INC_MASK REG_GENMASK(12, 0)
4563 #define _TRANS_VRR_STATUS_A 0x6042C
4564 #define _TRANS_VRR_STATUS_B 0x6142C
4565 #define _TRANS_VRR_STATUS_C 0x6242C
4566 #define _TRANS_VRR_STATUS_D 0x6342C
4567 #define TRANS_VRR_STATUS(trans) _MMIO_TRANS2(trans, _TRANS_VRR_STATUS_A)
4568 #define VRR_STATUS_VMAX_REACHED REG_BIT(31)
4569 #define VRR_STATUS_NOFLIP_TILL_BNDR REG_BIT(30)
4570 #define VRR_STATUS_FLIP_BEF_BNDR REG_BIT(29)
4571 #define VRR_STATUS_NO_FLIP_FRAME REG_BIT(28)
4572 #define VRR_STATUS_VRR_EN_LIVE REG_BIT(27)
4573 #define VRR_STATUS_FLIPS_SERVICED REG_BIT(26)
4574 #define VRR_STATUS_VBLANK_MASK REG_GENMASK(22, 20)
4575 #define STATUS_FSM_IDLE REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 0)
4576 #define STATUS_FSM_WAIT_TILL_FDB REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 1)
4577 #define STATUS_FSM_WAIT_TILL_FS REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 2)
4578 #define STATUS_FSM_WAIT_TILL_FLIP REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 3)
4579 #define STATUS_FSM_PIPELINE_FILL REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 4)
4580 #define STATUS_FSM_ACTIVE REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 5)
4581 #define STATUS_FSM_LEGACY_VBLANK REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 6)
4583 #define _TRANS_VRR_VTOTAL_PREV_A 0x60480
4584 #define _TRANS_VRR_VTOTAL_PREV_B 0x61480
4585 #define _TRANS_VRR_VTOTAL_PREV_C 0x62480
4586 #define _TRANS_VRR_VTOTAL_PREV_D 0x63480
4587 #define TRANS_VRR_VTOTAL_PREV(trans) _MMIO_TRANS2(trans, \
4588 _TRANS_VRR_VTOTAL_PREV_A)
4589 #define VRR_VTOTAL_FLIP_BEFR_BNDR REG_BIT(31)
4590 #define VRR_VTOTAL_FLIP_AFTER_BNDR REG_BIT(30)
4591 #define VRR_VTOTAL_FLIP_AFTER_DBLBUF REG_BIT(29)
4592 #define VRR_VTOTAL_PREV_FRAME_MASK REG_GENMASK(19, 0)
4594 #define _TRANS_VRR_FLIPLINE_A 0x60438
4595 #define _TRANS_VRR_FLIPLINE_B 0x61438
4596 #define _TRANS_VRR_FLIPLINE_C 0x62438
4597 #define _TRANS_VRR_FLIPLINE_D 0x63438
4598 #define TRANS_VRR_FLIPLINE(trans) _MMIO_TRANS2(trans, \
4599 _TRANS_VRR_FLIPLINE_A)
4600 #define VRR_FLIPLINE_MASK REG_GENMASK(19, 0)
4602 #define _TRANS_VRR_STATUS2_A 0x6043C
4603 #define _TRANS_VRR_STATUS2_B 0x6143C
4604 #define _TRANS_VRR_STATUS2_C 0x6243C
4605 #define _TRANS_VRR_STATUS2_D 0x6343C
4606 #define TRANS_VRR_STATUS2(trans) _MMIO_TRANS2(trans, _TRANS_VRR_STATUS2_A)
4607 #define VRR_STATUS2_VERT_LN_CNT_MASK REG_GENMASK(19, 0)
4609 #define _TRANS_PUSH_A 0x60A70
4610 #define _TRANS_PUSH_B 0x61A70
4611 #define _TRANS_PUSH_C 0x62A70
4612 #define _TRANS_PUSH_D 0x63A70
4613 #define TRANS_PUSH(trans) _MMIO_TRANS2(trans, _TRANS_PUSH_A)
4614 #define TRANS_PUSH_EN REG_BIT(31)
4615 #define TRANS_PUSH_SEND REG_BIT(30)
4618 * HSW+ eDP PSR registers
4620 * HSW PSR registers are relative to DDIA(_DDI_BUF_CTL_A + 0x800) with just one
4623 #define _SRD_CTL_A 0x60800
4624 #define _SRD_CTL_EDP 0x6f800
4625 #define EDP_PSR_CTL(tran) _MMIO(_TRANS2(tran, _SRD_CTL_A))
4626 #define EDP_PSR_ENABLE (1 << 31)
4627 #define BDW_PSR_SINGLE_FRAME (1 << 30)
4628 #define EDP_PSR_RESTORE_PSR_ACTIVE_CTX_MASK (1 << 29) /* SW can't modify */
4629 #define EDP_PSR_LINK_STANDBY (1 << 27)
4630 #define EDP_PSR_MIN_LINK_ENTRY_TIME_MASK (3 << 25)
4631 #define EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES (0 << 25)
4632 #define EDP_PSR_MIN_LINK_ENTRY_TIME_4_LINES (1 << 25)
4633 #define EDP_PSR_MIN_LINK_ENTRY_TIME_2_LINES (2 << 25)
4634 #define EDP_PSR_MIN_LINK_ENTRY_TIME_0_LINES (3 << 25)
4635 #define EDP_PSR_MAX_SLEEP_TIME_SHIFT 20
4636 #define EDP_PSR_SKIP_AUX_EXIT (1 << 12)
4637 #define EDP_PSR_TP1_TP2_SEL (0 << 11)
4638 #define EDP_PSR_TP1_TP3_SEL (1 << 11)
4639 #define EDP_PSR_CRC_ENABLE (1 << 10) /* BDW+ */
4640 #define EDP_PSR_TP2_TP3_TIME_500us (0 << 8)
4641 #define EDP_PSR_TP2_TP3_TIME_100us (1 << 8)
4642 #define EDP_PSR_TP2_TP3_TIME_2500us (2 << 8)
4643 #define EDP_PSR_TP2_TP3_TIME_0us (3 << 8)
4644 #define EDP_PSR_TP4_TIME_0US (3 << 6) /* ICL+ */
4645 #define EDP_PSR_TP1_TIME_500us (0 << 4)
4646 #define EDP_PSR_TP1_TIME_100us (1 << 4)
4647 #define EDP_PSR_TP1_TIME_2500us (2 << 4)
4648 #define EDP_PSR_TP1_TIME_0us (3 << 4)
4649 #define EDP_PSR_IDLE_FRAME_SHIFT 0
4652 * Until TGL, IMR/IIR are fixed at 0x648xx. On TGL+ those registers are relative
4653 * to transcoder and bits defined for each one as if using no shift (i.e. as if
4654 * it was for TRANSCODER_EDP)
4656 #define EDP_PSR_IMR _MMIO(0x64834)
4657 #define EDP_PSR_IIR _MMIO(0x64838)
4658 #define _PSR_IMR_A 0x60814
4659 #define _PSR_IIR_A 0x60818
4660 #define TRANS_PSR_IMR(tran) _MMIO_TRANS2(tran, _PSR_IMR_A)
4661 #define TRANS_PSR_IIR(tran) _MMIO_TRANS2(tran, _PSR_IIR_A)
4662 #define _EDP_PSR_TRANS_SHIFT(trans) ((trans) == TRANSCODER_EDP ? \
4663 0 : ((trans) - TRANSCODER_A + 1) * 8)
4664 #define EDP_PSR_TRANS_MASK(trans) (0x7 << _EDP_PSR_TRANS_SHIFT(trans))
4665 #define EDP_PSR_ERROR(trans) (0x4 << _EDP_PSR_TRANS_SHIFT(trans))
4666 #define EDP_PSR_POST_EXIT(trans) (0x2 << _EDP_PSR_TRANS_SHIFT(trans))
4667 #define EDP_PSR_PRE_ENTRY(trans) (0x1 << _EDP_PSR_TRANS_SHIFT(trans))
4669 #define _SRD_AUX_DATA_A 0x60814
4670 #define _SRD_AUX_DATA_EDP 0x6f814
4671 #define EDP_PSR_AUX_DATA(tran, i) _MMIO(_TRANS2(tran, _SRD_AUX_DATA_A) + (i) + 4) /* 5 registers */
4673 #define _SRD_STATUS_A 0x60840
4674 #define _SRD_STATUS_EDP 0x6f840
4675 #define EDP_PSR_STATUS(tran) _MMIO(_TRANS2(tran, _SRD_STATUS_A))
4676 #define EDP_PSR_STATUS_STATE_MASK (7 << 29)
4677 #define EDP_PSR_STATUS_STATE_SHIFT 29
4678 #define EDP_PSR_STATUS_STATE_IDLE (0 << 29)
4679 #define EDP_PSR_STATUS_STATE_SRDONACK (1 << 29)
4680 #define EDP_PSR_STATUS_STATE_SRDENT (2 << 29)
4681 #define EDP_PSR_STATUS_STATE_BUFOFF (3 << 29)
4682 #define EDP_PSR_STATUS_STATE_BUFON (4 << 29)
4683 #define EDP_PSR_STATUS_STATE_AUXACK (5 << 29)
4684 #define EDP_PSR_STATUS_STATE_SRDOFFACK (6 << 29)
4685 #define EDP_PSR_STATUS_LINK_MASK (3 << 26)
4686 #define EDP_PSR_STATUS_LINK_FULL_OFF (0 << 26)
4687 #define EDP_PSR_STATUS_LINK_FULL_ON (1 << 26)
4688 #define EDP_PSR_STATUS_LINK_STANDBY (2 << 26)
4689 #define EDP_PSR_STATUS_MAX_SLEEP_TIMER_SHIFT 20
4690 #define EDP_PSR_STATUS_MAX_SLEEP_TIMER_MASK 0x1f
4691 #define EDP_PSR_STATUS_COUNT_SHIFT 16
4692 #define EDP_PSR_STATUS_COUNT_MASK 0xf
4693 #define EDP_PSR_STATUS_AUX_ERROR (1 << 15)
4694 #define EDP_PSR_STATUS_AUX_SENDING (1 << 12)
4695 #define EDP_PSR_STATUS_SENDING_IDLE (1 << 9)
4696 #define EDP_PSR_STATUS_SENDING_TP2_TP3 (1 << 8)
4697 #define EDP_PSR_STATUS_SENDING_TP1 (1 << 4)
4698 #define EDP_PSR_STATUS_IDLE_MASK 0xf
4700 #define _SRD_PERF_CNT_A 0x60844
4701 #define _SRD_PERF_CNT_EDP 0x6f844
4702 #define EDP_PSR_PERF_CNT(tran) _MMIO(_TRANS2(tran, _SRD_PERF_CNT_A))
4703 #define EDP_PSR_PERF_CNT_MASK 0xffffff
4705 /* PSR_MASK on SKL+ */
4706 #define _SRD_DEBUG_A 0x60860
4707 #define _SRD_DEBUG_EDP 0x6f860
4708 #define EDP_PSR_DEBUG(tran) _MMIO(_TRANS2(tran, _SRD_DEBUG_A))
4709 #define EDP_PSR_DEBUG_MASK_MAX_SLEEP (1 << 28)
4710 #define EDP_PSR_DEBUG_MASK_LPSP (1 << 27)
4711 #define EDP_PSR_DEBUG_MASK_MEMUP (1 << 26)
4712 #define EDP_PSR_DEBUG_MASK_HPD (1 << 25)
4713 #define EDP_PSR_DEBUG_MASK_DISP_REG_WRITE (1 << 16) /* Reserved in ICL+ */
4714 #define EDP_PSR_DEBUG_EXIT_ON_PIXEL_UNDERRUN (1 << 15) /* SKL+ */
4716 #define _PSR2_CTL_A 0x60900
4717 #define _PSR2_CTL_EDP 0x6f900
4718 #define EDP_PSR2_CTL(tran) _MMIO_TRANS2(tran, _PSR2_CTL_A)
4719 #define EDP_PSR2_ENABLE (1 << 31)
4720 #define EDP_SU_TRACK_ENABLE (1 << 30) /* up to adl-p */
4721 #define TGL_EDP_PSR2_BLOCK_COUNT_NUM_2 (0 << 28)
4722 #define TGL_EDP_PSR2_BLOCK_COUNT_NUM_3 (1 << 28)
4723 #define EDP_Y_COORDINATE_ENABLE REG_BIT(25) /* display 10, 11 and 12 */
4724 #define EDP_PSR2_SU_SDP_SCANLINE REG_BIT(25) /* display 13+ */
4725 #define EDP_MAX_SU_DISABLE_TIME(t) ((t) << 20)
4726 #define EDP_MAX_SU_DISABLE_TIME_MASK (0x1f << 20)
4727 #define EDP_PSR2_IO_BUFFER_WAKE_MAX_LINES 8
4728 #define EDP_PSR2_IO_BUFFER_WAKE(lines) ((EDP_PSR2_IO_BUFFER_WAKE_MAX_LINES - (lines)) << 13)
4729 #define EDP_PSR2_IO_BUFFER_WAKE_MASK (3 << 13)
4730 #define TGL_EDP_PSR2_IO_BUFFER_WAKE_MIN_LINES 5
4731 #define TGL_EDP_PSR2_IO_BUFFER_WAKE_SHIFT 13
4732 #define TGL_EDP_PSR2_IO_BUFFER_WAKE(lines) (((lines) - TGL_EDP_PSR2_IO_BUFFER_WAKE_MIN_LINES) << TGL_EDP_PSR2_IO_BUFFER_WAKE_SHIFT)
4733 #define TGL_EDP_PSR2_IO_BUFFER_WAKE_MASK (7 << 13)
4734 #define EDP_PSR2_FAST_WAKE_MAX_LINES 8
4735 #define EDP_PSR2_FAST_WAKE(lines) ((EDP_PSR2_FAST_WAKE_MAX_LINES - (lines)) << 11)
4736 #define EDP_PSR2_FAST_WAKE_MASK (3 << 11)
4737 #define TGL_EDP_PSR2_FAST_WAKE_MIN_LINES 5
4738 #define TGL_EDP_PSR2_FAST_WAKE_MIN_SHIFT 10
4739 #define TGL_EDP_PSR2_FAST_WAKE(lines) (((lines) - TGL_EDP_PSR2_FAST_WAKE_MIN_LINES) << TGL_EDP_PSR2_FAST_WAKE_MIN_SHIFT)
4740 #define TGL_EDP_PSR2_FAST_WAKE_MASK (7 << 10)
4741 #define EDP_PSR2_TP2_TIME_500us (0 << 8)
4742 #define EDP_PSR2_TP2_TIME_100us (1 << 8)
4743 #define EDP_PSR2_TP2_TIME_2500us (2 << 8)
4744 #define EDP_PSR2_TP2_TIME_50us (3 << 8)
4745 #define EDP_PSR2_TP2_TIME_MASK (3 << 8)
4746 #define EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
4747 #define EDP_PSR2_FRAME_BEFORE_SU_MASK (0xf << 4)
4748 #define EDP_PSR2_FRAME_BEFORE_SU(a) ((a) << 4)
4749 #define EDP_PSR2_IDLE_FRAME_MASK 0xf
4750 #define EDP_PSR2_IDLE_FRAME_SHIFT 0
4752 #define _PSR_EVENT_TRANS_A 0x60848
4753 #define _PSR_EVENT_TRANS_B 0x61848
4754 #define _PSR_EVENT_TRANS_C 0x62848
4755 #define _PSR_EVENT_TRANS_D 0x63848
4756 #define _PSR_EVENT_TRANS_EDP 0x6f848
4757 #define PSR_EVENT(tran) _MMIO_TRANS2(tran, _PSR_EVENT_TRANS_A)
4758 #define PSR_EVENT_PSR2_WD_TIMER_EXPIRE (1 << 17)
4759 #define PSR_EVENT_PSR2_DISABLED (1 << 16)
4760 #define PSR_EVENT_SU_DIRTY_FIFO_UNDERRUN (1 << 15)
4761 #define PSR_EVENT_SU_CRC_FIFO_UNDERRUN (1 << 14)
4762 #define PSR_EVENT_GRAPHICS_RESET (1 << 12)
4763 #define PSR_EVENT_PCH_INTERRUPT (1 << 11)
4764 #define PSR_EVENT_MEMORY_UP (1 << 10)
4765 #define PSR_EVENT_FRONT_BUFFER_MODIFY (1 << 9)
4766 #define PSR_EVENT_WD_TIMER_EXPIRE (1 << 8)
4767 #define PSR_EVENT_PIPE_REGISTERS_UPDATE (1 << 6)
4768 #define PSR_EVENT_REGISTER_UPDATE (1 << 5) /* Reserved in ICL+ */
4769 #define PSR_EVENT_HDCP_ENABLE (1 << 4)
4770 #define PSR_EVENT_KVMR_SESSION_ENABLE (1 << 3)
4771 #define PSR_EVENT_VBI_ENABLE (1 << 2)
4772 #define PSR_EVENT_LPSP_MODE_EXIT (1 << 1)
4773 #define PSR_EVENT_PSR_DISABLE (1 << 0)
4775 #define _PSR2_STATUS_A 0x60940
4776 #define _PSR2_STATUS_EDP 0x6f940
4777 #define EDP_PSR2_STATUS(tran) _MMIO_TRANS2(tran, _PSR2_STATUS_A)
4778 #define EDP_PSR2_STATUS_STATE_MASK (0xf << 28)
4779 #define EDP_PSR2_STATUS_STATE_SHIFT 28
4781 #define _PSR2_SU_STATUS_A 0x60914
4782 #define _PSR2_SU_STATUS_EDP 0x6f914
4783 #define _PSR2_SU_STATUS(tran, index) _MMIO(_TRANS2(tran, _PSR2_SU_STATUS_A) + (index) * 4)
4784 #define PSR2_SU_STATUS(tran, frame) (_PSR2_SU_STATUS(tran, (frame) / 3))
4785 #define PSR2_SU_STATUS_SHIFT(frame) (((frame) % 3) * 10)
4786 #define PSR2_SU_STATUS_MASK(frame) (0x3ff << PSR2_SU_STATUS_SHIFT(frame))
4787 #define PSR2_SU_STATUS_FRAMES 8
4789 #define _PSR2_MAN_TRK_CTL_A 0x60910
4790 #define _PSR2_MAN_TRK_CTL_EDP 0x6f910
4791 #define PSR2_MAN_TRK_CTL(tran) _MMIO_TRANS2(tran, _PSR2_MAN_TRK_CTL_A)
4792 #define PSR2_MAN_TRK_CTL_ENABLE REG_BIT(31)
4793 #define PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK REG_GENMASK(30, 21)
4794 #define PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(val) REG_FIELD_PREP(PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK, val)
4795 #define PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK REG_GENMASK(20, 11)
4796 #define PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(val) REG_FIELD_PREP(PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK, val)
4797 #define PSR2_MAN_TRK_CTL_SF_SINGLE_FULL_FRAME REG_BIT(3)
4798 #define PSR2_MAN_TRK_CTL_SF_CONTINUOS_FULL_FRAME REG_BIT(2)
4799 #define PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE REG_BIT(1)
4800 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK REG_GENMASK(28, 16)
4801 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(val) REG_FIELD_PREP(ADLP_PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK, val)
4802 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK REG_GENMASK(12, 0)
4803 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(val) REG_FIELD_PREP(ADLP_PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK, val)
4804 #define ADLP_PSR2_MAN_TRK_CTL_SF_SINGLE_FULL_FRAME REG_BIT(14)
4805 #define ADLP_PSR2_MAN_TRK_CTL_SF_CONTINUOS_FULL_FRAME REG_BIT(13)
4807 /* Icelake DSC Rate Control Range Parameter Registers */
4808 #define DSCA_RC_RANGE_PARAMETERS_0 _MMIO(0x6B240)
4809 #define DSCA_RC_RANGE_PARAMETERS_0_UDW _MMIO(0x6B240 + 4)
4810 #define DSCC_RC_RANGE_PARAMETERS_0 _MMIO(0x6BA40)
4811 #define DSCC_RC_RANGE_PARAMETERS_0_UDW _MMIO(0x6BA40 + 4)
4812 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_PB (0x78208)
4813 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PB (0x78208 + 4)
4814 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_PB (0x78308)
4815 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PB (0x78308 + 4)
4816 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_PC (0x78408)
4817 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PC (0x78408 + 4)
4818 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_PC (0x78508)
4819 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PC (0x78508 + 4)
4820 #define ICL_DSC0_RC_RANGE_PARAMETERS_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4821 _ICL_DSC0_RC_RANGE_PARAMETERS_0_PB, \
4822 _ICL_DSC0_RC_RANGE_PARAMETERS_0_PC)
4823 #define ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4824 _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PB, \
4825 _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PC)
4826 #define ICL_DSC1_RC_RANGE_PARAMETERS_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4827 _ICL_DSC1_RC_RANGE_PARAMETERS_0_PB, \
4828 _ICL_DSC1_RC_RANGE_PARAMETERS_0_PC)
4829 #define ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4830 _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PB, \
4831 _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PC)
4832 #define RC_BPG_OFFSET_SHIFT 10
4833 #define RC_MAX_QP_SHIFT 5
4834 #define RC_MIN_QP_SHIFT 0
4836 #define DSCA_RC_RANGE_PARAMETERS_1 _MMIO(0x6B248)
4837 #define DSCA_RC_RANGE_PARAMETERS_1_UDW _MMIO(0x6B248 + 4)
4838 #define DSCC_RC_RANGE_PARAMETERS_1 _MMIO(0x6BA48)
4839 #define DSCC_RC_RANGE_PARAMETERS_1_UDW _MMIO(0x6BA48 + 4)
4840 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_PB (0x78210)
4841 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PB (0x78210 + 4)
4842 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_PB (0x78310)
4843 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PB (0x78310 + 4)
4844 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_PC (0x78410)
4845 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PC (0x78410 + 4)
4846 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_PC (0x78510)
4847 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PC (0x78510 + 4)
4848 #define ICL_DSC0_RC_RANGE_PARAMETERS_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4849 _ICL_DSC0_RC_RANGE_PARAMETERS_1_PB, \
4850 _ICL_DSC0_RC_RANGE_PARAMETERS_1_PC)
4851 #define ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4852 _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PB, \
4853 _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PC)
4854 #define ICL_DSC1_RC_RANGE_PARAMETERS_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4855 _ICL_DSC1_RC_RANGE_PARAMETERS_1_PB, \
4856 _ICL_DSC1_RC_RANGE_PARAMETERS_1_PC)
4857 #define ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4858 _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PB, \
4859 _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PC)
4861 #define DSCA_RC_RANGE_PARAMETERS_2 _MMIO(0x6B250)
4862 #define DSCA_RC_RANGE_PARAMETERS_2_UDW _MMIO(0x6B250 + 4)
4863 #define DSCC_RC_RANGE_PARAMETERS_2 _MMIO(0x6BA50)
4864 #define DSCC_RC_RANGE_PARAMETERS_2_UDW _MMIO(0x6BA50 + 4)
4865 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_PB (0x78218)
4866 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PB (0x78218 + 4)
4867 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_PB (0x78318)
4868 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PB (0x78318 + 4)
4869 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_PC (0x78418)
4870 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PC (0x78418 + 4)
4871 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_PC (0x78518)
4872 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PC (0x78518 + 4)
4873 #define ICL_DSC0_RC_RANGE_PARAMETERS_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4874 _ICL_DSC0_RC_RANGE_PARAMETERS_2_PB, \
4875 _ICL_DSC0_RC_RANGE_PARAMETERS_2_PC)
4876 #define ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4877 _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PB, \
4878 _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PC)
4879 #define ICL_DSC1_RC_RANGE_PARAMETERS_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4880 _ICL_DSC1_RC_RANGE_PARAMETERS_2_PB, \
4881 _ICL_DSC1_RC_RANGE_PARAMETERS_2_PC)
4882 #define ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4883 _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PB, \
4884 _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PC)
4886 #define DSCA_RC_RANGE_PARAMETERS_3 _MMIO(0x6B258)
4887 #define DSCA_RC_RANGE_PARAMETERS_3_UDW _MMIO(0x6B258 + 4)
4888 #define DSCC_RC_RANGE_PARAMETERS_3 _MMIO(0x6BA58)
4889 #define DSCC_RC_RANGE_PARAMETERS_3_UDW _MMIO(0x6BA58 + 4)
4890 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_PB (0x78220)
4891 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PB (0x78220 + 4)
4892 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_PB (0x78320)
4893 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PB (0x78320 + 4)
4894 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_PC (0x78420)
4895 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PC (0x78420 + 4)
4896 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_PC (0x78520)
4897 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PC (0x78520 + 4)
4898 #define ICL_DSC0_RC_RANGE_PARAMETERS_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4899 _ICL_DSC0_RC_RANGE_PARAMETERS_3_PB, \
4900 _ICL_DSC0_RC_RANGE_PARAMETERS_3_PC)
4901 #define ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4902 _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PB, \
4903 _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PC)
4904 #define ICL_DSC1_RC_RANGE_PARAMETERS_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4905 _ICL_DSC1_RC_RANGE_PARAMETERS_3_PB, \
4906 _ICL_DSC1_RC_RANGE_PARAMETERS_3_PC)
4907 #define ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
4908 _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PB, \
4909 _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PC)
4911 /* VGA port control */
4912 #define ADPA _MMIO(0x61100)
4913 #define PCH_ADPA _MMIO(0xe1100)
4914 #define VLV_ADPA _MMIO(VLV_DISPLAY_BASE + 0x61100)
4916 #define ADPA_DAC_ENABLE (1 << 31)
4917 #define ADPA_DAC_DISABLE 0
4918 #define ADPA_PIPE_SEL_SHIFT 30
4919 #define ADPA_PIPE_SEL_MASK (1 << 30)
4920 #define ADPA_PIPE_SEL(pipe) ((pipe) << 30)
4921 #define ADPA_PIPE_SEL_SHIFT_CPT 29
4922 #define ADPA_PIPE_SEL_MASK_CPT (3 << 29)
4923 #define ADPA_PIPE_SEL_CPT(pipe) ((pipe) << 29)
4924 #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
4925 #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0 << 24)
4926 #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3 << 24)
4927 #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3 << 24)
4928 #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2 << 24)
4929 #define ADPA_CRT_HOTPLUG_ENABLE (1 << 23)
4930 #define ADPA_CRT_HOTPLUG_PERIOD_64 (0 << 22)
4931 #define ADPA_CRT_HOTPLUG_PERIOD_128 (1 << 22)
4932 #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0 << 21)
4933 #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1 << 21)
4934 #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0 << 20)
4935 #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1 << 20)
4936 #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0 << 18)
4937 #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1 << 18)
4938 #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2 << 18)
4939 #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3 << 18)
4940 #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0 << 17)
4941 #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1 << 17)
4942 #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1 << 16)
4943 #define ADPA_USE_VGA_HVPOLARITY (1 << 15)
4944 #define ADPA_SETS_HVPOLARITY 0
4945 #define ADPA_VSYNC_CNTL_DISABLE (1 << 10)
4946 #define ADPA_VSYNC_CNTL_ENABLE 0
4947 #define ADPA_HSYNC_CNTL_DISABLE (1 << 11)
4948 #define ADPA_HSYNC_CNTL_ENABLE 0
4949 #define ADPA_VSYNC_ACTIVE_HIGH (1 << 4)
4950 #define ADPA_VSYNC_ACTIVE_LOW 0
4951 #define ADPA_HSYNC_ACTIVE_HIGH (1 << 3)
4952 #define ADPA_HSYNC_ACTIVE_LOW 0
4953 #define ADPA_DPMS_MASK (~(3 << 10))
4954 #define ADPA_DPMS_ON (0 << 10)
4955 #define ADPA_DPMS_SUSPEND (1 << 10)
4956 #define ADPA_DPMS_STANDBY (2 << 10)
4957 #define ADPA_DPMS_OFF (3 << 10)
4960 /* Hotplug control (945+ only) */
4961 #define PORT_HOTPLUG_EN _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61110)
4962 #define PORTB_HOTPLUG_INT_EN (1 << 29)
4963 #define PORTC_HOTPLUG_INT_EN (1 << 28)
4964 #define PORTD_HOTPLUG_INT_EN (1 << 27)
4965 #define SDVOB_HOTPLUG_INT_EN (1 << 26)
4966 #define SDVOC_HOTPLUG_INT_EN (1 << 25)
4967 #define TV_HOTPLUG_INT_EN (1 << 18)
4968 #define CRT_HOTPLUG_INT_EN (1 << 9)
4969 #define HOTPLUG_INT_EN_MASK (PORTB_HOTPLUG_INT_EN | \
4970 PORTC_HOTPLUG_INT_EN | \
4971 PORTD_HOTPLUG_INT_EN | \
4972 SDVOC_HOTPLUG_INT_EN | \
4973 SDVOB_HOTPLUG_INT_EN | \
4975 #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
4976 #define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
4977 /* must use period 64 on GM45 according to docs */
4978 #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
4979 #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
4980 #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
4981 #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
4982 #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
4983 #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
4984 #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
4985 #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
4986 #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
4987 #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
4988 #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
4989 #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
4991 #define PORT_HOTPLUG_STAT _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61114)
4993 * HDMI/DP bits are g4x+
4995 * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused.
4996 * Please check the detailed lore in the commit message for for experimental
4999 /* Bspec says GM45 should match G4X/VLV/CHV, but reality disagrees */
5000 #define PORTD_HOTPLUG_LIVE_STATUS_GM45 (1 << 29)
5001 #define PORTC_HOTPLUG_LIVE_STATUS_GM45 (1 << 28)
5002 #define PORTB_HOTPLUG_LIVE_STATUS_GM45 (1 << 27)
5003 /* G4X/VLV/CHV DP/HDMI bits again match Bspec */
5004 #define PORTD_HOTPLUG_LIVE_STATUS_G4X (1 << 27)
5005 #define PORTC_HOTPLUG_LIVE_STATUS_G4X (1 << 28)
5006 #define PORTB_HOTPLUG_LIVE_STATUS_G4X (1 << 29)
5007 #define PORTD_HOTPLUG_INT_STATUS (3 << 21)
5008 #define PORTD_HOTPLUG_INT_LONG_PULSE (2 << 21)
5009 #define PORTD_HOTPLUG_INT_SHORT_PULSE (1 << 21)
5010 #define PORTC_HOTPLUG_INT_STATUS (3 << 19)
5011 #define PORTC_HOTPLUG_INT_LONG_PULSE (2 << 19)
5012 #define PORTC_HOTPLUG_INT_SHORT_PULSE (1 << 19)
5013 #define PORTB_HOTPLUG_INT_STATUS (3 << 17)
5014 #define PORTB_HOTPLUG_INT_LONG_PULSE (2 << 17)
5015 #define PORTB_HOTPLUG_INT_SHORT_PLUSE (1 << 17)
5016 /* CRT/TV common between gen3+ */
5017 #define CRT_HOTPLUG_INT_STATUS (1 << 11)
5018 #define TV_HOTPLUG_INT_STATUS (1 << 10)
5019 #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
5020 #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
5021 #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
5022 #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
5023 #define DP_AUX_CHANNEL_D_INT_STATUS_G4X (1 << 6)
5024 #define DP_AUX_CHANNEL_C_INT_STATUS_G4X (1 << 5)
5025 #define DP_AUX_CHANNEL_B_INT_STATUS_G4X (1 << 4)
5026 #define DP_AUX_CHANNEL_MASK_INT_STATUS_G4X (7 << 4)
5028 /* SDVO is different across gen3/4 */
5029 #define SDVOC_HOTPLUG_INT_STATUS_G4X (1 << 3)
5030 #define SDVOB_HOTPLUG_INT_STATUS_G4X (1 << 2)
5032 * Bspec seems to be seriously misleaded about the SDVO hpd bits on i965g/gm,
5033 * since reality corrobates that they're the same as on gen3. But keep these
5034 * bits here (and the comment!) to help any other lost wanderers back onto the
5037 #define SDVOC_HOTPLUG_INT_STATUS_I965 (3 << 4)
5038 #define SDVOB_HOTPLUG_INT_STATUS_I965 (3 << 2)
5039 #define SDVOC_HOTPLUG_INT_STATUS_I915 (1 << 7)
5040 #define SDVOB_HOTPLUG_INT_STATUS_I915 (1 << 6)
5041 #define HOTPLUG_INT_STATUS_G4X (CRT_HOTPLUG_INT_STATUS | \
5042 SDVOB_HOTPLUG_INT_STATUS_G4X | \
5043 SDVOC_HOTPLUG_INT_STATUS_G4X | \
5044 PORTB_HOTPLUG_INT_STATUS | \
5045 PORTC_HOTPLUG_INT_STATUS | \
5046 PORTD_HOTPLUG_INT_STATUS)
5048 #define HOTPLUG_INT_STATUS_I915 (CRT_HOTPLUG_INT_STATUS | \
5049 SDVOB_HOTPLUG_INT_STATUS_I915 | \
5050 SDVOC_HOTPLUG_INT_STATUS_I915 | \
5051 PORTB_HOTPLUG_INT_STATUS | \
5052 PORTC_HOTPLUG_INT_STATUS | \
5053 PORTD_HOTPLUG_INT_STATUS)
5055 /* SDVO and HDMI port control.
5056 * The same register may be used for SDVO or HDMI */
5057 #define _GEN3_SDVOB 0x61140
5058 #define _GEN3_SDVOC 0x61160
5059 #define GEN3_SDVOB _MMIO(_GEN3_SDVOB)
5060 #define GEN3_SDVOC _MMIO(_GEN3_SDVOC)
5061 #define GEN4_HDMIB GEN3_SDVOB
5062 #define GEN4_HDMIC GEN3_SDVOC
5063 #define VLV_HDMIB _MMIO(VLV_DISPLAY_BASE + 0x61140)
5064 #define VLV_HDMIC _MMIO(VLV_DISPLAY_BASE + 0x61160)
5065 #define CHV_HDMID _MMIO(VLV_DISPLAY_BASE + 0x6116C)
5066 #define PCH_SDVOB _MMIO(0xe1140)
5067 #define PCH_HDMIB PCH_SDVOB
5068 #define PCH_HDMIC _MMIO(0xe1150)
5069 #define PCH_HDMID _MMIO(0xe1160)
5071 #define PORT_DFT_I9XX _MMIO(0x61150)
5072 #define DC_BALANCE_RESET (1 << 25)
5073 #define PORT_DFT2_G4X _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61154)
5074 #define DC_BALANCE_RESET_VLV (1 << 31)
5075 #define PIPE_SCRAMBLE_RESET_MASK ((1 << 14) | (0x3 << 0))
5076 #define PIPE_C_SCRAMBLE_RESET (1 << 14) /* chv */
5077 #define PIPE_B_SCRAMBLE_RESET (1 << 1)
5078 #define PIPE_A_SCRAMBLE_RESET (1 << 0)
5080 /* Gen 3 SDVO bits: */
5081 #define SDVO_ENABLE (1 << 31)
5082 #define SDVO_PIPE_SEL_SHIFT 30
5083 #define SDVO_PIPE_SEL_MASK (1 << 30)
5084 #define SDVO_PIPE_SEL(pipe) ((pipe) << 30)
5085 #define SDVO_STALL_SELECT (1 << 29)
5086 #define SDVO_INTERRUPT_ENABLE (1 << 26)
5088 * 915G/GM SDVO pixel multiplier.
5089 * Programmed value is multiplier - 1, up to 5x.
5090 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
5092 #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
5093 #define SDVO_PORT_MULTIPLY_SHIFT 23
5094 #define SDVO_PHASE_SELECT_MASK (15 << 19)
5095 #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
5096 #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
5097 #define SDVOC_GANG_MODE (1 << 16) /* Port C only */
5098 #define SDVO_BORDER_ENABLE (1 << 7) /* SDVO only */
5099 #define SDVOB_PCIE_CONCURRENCY (1 << 3) /* Port B only */
5100 #define SDVO_DETECTED (1 << 2)
5101 /* Bits to be preserved when writing */
5102 #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | \
5103 SDVO_INTERRUPT_ENABLE)
5104 #define SDVOC_PRESERVE_MASK ((1 << 17) | SDVO_INTERRUPT_ENABLE)
5106 /* Gen 4 SDVO/HDMI bits: */
5107 #define SDVO_COLOR_FORMAT_8bpc (0 << 26)
5108 #define SDVO_COLOR_FORMAT_MASK (7 << 26)
5109 #define SDVO_ENCODING_SDVO (0 << 10)
5110 #define SDVO_ENCODING_HDMI (2 << 10)
5111 #define HDMI_MODE_SELECT_HDMI (1 << 9) /* HDMI only */
5112 #define HDMI_MODE_SELECT_DVI (0 << 9) /* HDMI only */
5113 #define HDMI_COLOR_RANGE_16_235 (1 << 8) /* HDMI only */
5114 #define HDMI_AUDIO_ENABLE (1 << 6) /* HDMI only */
5115 /* VSYNC/HSYNC bits new with 965, default is to be set */
5116 #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
5117 #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
5119 /* Gen 5 (IBX) SDVO/HDMI bits: */
5120 #define HDMI_COLOR_FORMAT_12bpc (3 << 26) /* HDMI only */
5121 #define SDVOB_HOTPLUG_ENABLE (1 << 23) /* SDVO only */
5123 /* Gen 6 (CPT) SDVO/HDMI bits: */
5124 #define SDVO_PIPE_SEL_SHIFT_CPT 29
5125 #define SDVO_PIPE_SEL_MASK_CPT (3 << 29)
5126 #define SDVO_PIPE_SEL_CPT(pipe) ((pipe) << 29)
5128 /* CHV SDVO/HDMI bits: */
5129 #define SDVO_PIPE_SEL_SHIFT_CHV 24
5130 #define SDVO_PIPE_SEL_MASK_CHV (3 << 24)
5131 #define SDVO_PIPE_SEL_CHV(pipe) ((pipe) << 24)
5134 /* DVO port control */
5135 #define _DVOA 0x61120
5136 #define DVOA _MMIO(_DVOA)
5137 #define _DVOB 0x61140
5138 #define DVOB _MMIO(_DVOB)
5139 #define _DVOC 0x61160
5140 #define DVOC _MMIO(_DVOC)
5141 #define DVO_ENABLE (1 << 31)
5142 #define DVO_PIPE_SEL_SHIFT 30
5143 #define DVO_PIPE_SEL_MASK (1 << 30)
5144 #define DVO_PIPE_SEL(pipe) ((pipe) << 30)
5145 #define DVO_PIPE_STALL_UNUSED (0 << 28)
5146 #define DVO_PIPE_STALL (1 << 28)
5147 #define DVO_PIPE_STALL_TV (2 << 28)
5148 #define DVO_PIPE_STALL_MASK (3 << 28)
5149 #define DVO_USE_VGA_SYNC (1 << 15)
5150 #define DVO_DATA_ORDER_I740 (0 << 14)
5151 #define DVO_DATA_ORDER_FP (1 << 14)
5152 #define DVO_VSYNC_DISABLE (1 << 11)
5153 #define DVO_HSYNC_DISABLE (1 << 10)
5154 #define DVO_VSYNC_TRISTATE (1 << 9)
5155 #define DVO_HSYNC_TRISTATE (1 << 8)
5156 #define DVO_BORDER_ENABLE (1 << 7)
5157 #define DVO_DATA_ORDER_GBRG (1 << 6)
5158 #define DVO_DATA_ORDER_RGGB (0 << 6)
5159 #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
5160 #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
5161 #define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
5162 #define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
5163 #define DVO_BLANK_ACTIVE_HIGH (1 << 2)
5164 #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
5165 #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
5166 #define DVO_PRESERVE_MASK (0x7 << 24)
5167 #define DVOA_SRCDIM _MMIO(0x61124)
5168 #define DVOB_SRCDIM _MMIO(0x61144)
5169 #define DVOC_SRCDIM _MMIO(0x61164)
5170 #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
5171 #define DVO_SRCDIM_VERTICAL_SHIFT 0
5173 /* LVDS port control */
5174 #define LVDS _MMIO(0x61180)
5176 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
5177 * the DPLL semantics change when the LVDS is assigned to that pipe.
5179 #define LVDS_PORT_EN (1 << 31)
5180 /* Selects pipe B for LVDS data. Must be set on pre-965. */
5181 #define LVDS_PIPE_SEL_SHIFT 30
5182 #define LVDS_PIPE_SEL_MASK (1 << 30)
5183 #define LVDS_PIPE_SEL(pipe) ((pipe) << 30)
5184 #define LVDS_PIPE_SEL_SHIFT_CPT 29
5185 #define LVDS_PIPE_SEL_MASK_CPT (3 << 29)
5186 #define LVDS_PIPE_SEL_CPT(pipe) ((pipe) << 29)
5187 /* LVDS dithering flag on 965/g4x platform */
5188 #define LVDS_ENABLE_DITHER (1 << 25)
5189 /* LVDS sync polarity flags. Set to invert (i.e. negative) */
5190 #define LVDS_VSYNC_POLARITY (1 << 21)
5191 #define LVDS_HSYNC_POLARITY (1 << 20)
5193 /* Enable border for unscaled (or aspect-scaled) display */
5194 #define LVDS_BORDER_ENABLE (1 << 15)
5196 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
5199 #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
5200 #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
5201 #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
5203 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
5204 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
5207 #define LVDS_A3_POWER_MASK (3 << 6)
5208 #define LVDS_A3_POWER_DOWN (0 << 6)
5209 #define LVDS_A3_POWER_UP (3 << 6)
5211 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
5214 #define LVDS_CLKB_POWER_MASK (3 << 4)
5215 #define LVDS_CLKB_POWER_DOWN (0 << 4)
5216 #define LVDS_CLKB_POWER_UP (3 << 4)
5218 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
5219 * setting for whether we are in dual-channel mode. The B3 pair will
5220 * additionally only be powered up when LVDS_A3_POWER_UP is set.
5222 #define LVDS_B0B3_POWER_MASK (3 << 2)
5223 #define LVDS_B0B3_POWER_DOWN (0 << 2)
5224 #define LVDS_B0B3_POWER_UP (3 << 2)
5226 /* Video Data Island Packet control */
5227 #define VIDEO_DIP_DATA _MMIO(0x61178)
5228 /* Read the description of VIDEO_DIP_DATA (before Haswell) or VIDEO_DIP_ECC
5229 * (Haswell and newer) to see which VIDEO_DIP_DATA byte corresponds to each byte
5230 * of the infoframe structure specified by CEA-861. */
5231 #define VIDEO_DIP_DATA_SIZE 32
5232 #define VIDEO_DIP_GMP_DATA_SIZE 36
5233 #define VIDEO_DIP_VSC_DATA_SIZE 36
5234 #define VIDEO_DIP_PPS_DATA_SIZE 132
5235 #define VIDEO_DIP_CTL _MMIO(0x61170)
5237 #define VIDEO_DIP_ENABLE (1 << 31)
5238 #define VIDEO_DIP_PORT(port) ((port) << 29)
5239 #define VIDEO_DIP_PORT_MASK (3 << 29)
5240 #define VIDEO_DIP_ENABLE_GCP (1 << 25) /* ilk+ */
5241 #define VIDEO_DIP_ENABLE_AVI (1 << 21)
5242 #define VIDEO_DIP_ENABLE_VENDOR (2 << 21)
5243 #define VIDEO_DIP_ENABLE_GAMUT (4 << 21) /* ilk+ */
5244 #define VIDEO_DIP_ENABLE_SPD (8 << 21)
5245 #define VIDEO_DIP_SELECT_AVI (0 << 19)
5246 #define VIDEO_DIP_SELECT_VENDOR (1 << 19)
5247 #define VIDEO_DIP_SELECT_GAMUT (2 << 19)
5248 #define VIDEO_DIP_SELECT_SPD (3 << 19)
5249 #define VIDEO_DIP_SELECT_MASK (3 << 19)
5250 #define VIDEO_DIP_FREQ_ONCE (0 << 16)
5251 #define VIDEO_DIP_FREQ_VSYNC (1 << 16)
5252 #define VIDEO_DIP_FREQ_2VSYNC (2 << 16)
5253 #define VIDEO_DIP_FREQ_MASK (3 << 16)
5254 /* HSW and later: */
5255 #define VIDEO_DIP_ENABLE_DRM_GLK (1 << 28)
5256 #define PSR_VSC_BIT_7_SET (1 << 27)
5257 #define VSC_SELECT_MASK (0x3 << 25)
5258 #define VSC_SELECT_SHIFT 25
5259 #define VSC_DIP_HW_HEA_DATA (0 << 25)
5260 #define VSC_DIP_HW_HEA_SW_DATA (1 << 25)
5261 #define VSC_DIP_HW_DATA_SW_HEA (2 << 25)
5262 #define VSC_DIP_SW_HEA_DATA (3 << 25)
5263 #define VDIP_ENABLE_PPS (1 << 24)
5264 #define VIDEO_DIP_ENABLE_VSC_HSW (1 << 20)
5265 #define VIDEO_DIP_ENABLE_GCP_HSW (1 << 16)
5266 #define VIDEO_DIP_ENABLE_AVI_HSW (1 << 12)
5267 #define VIDEO_DIP_ENABLE_VS_HSW (1 << 8)
5268 #define VIDEO_DIP_ENABLE_GMP_HSW (1 << 4)
5269 #define VIDEO_DIP_ENABLE_SPD_HSW (1 << 0)
5271 /* Panel power sequencing */
5272 #define PPS_BASE 0x61200
5273 #define VLV_PPS_BASE (VLV_DISPLAY_BASE + PPS_BASE)
5274 #define PCH_PPS_BASE 0xC7200
5276 #define _MMIO_PPS(pps_idx, reg) _MMIO(dev_priv->pps_mmio_base - \
5277 PPS_BASE + (reg) + \
5280 #define _PP_STATUS 0x61200
5281 #define PP_STATUS(pps_idx) _MMIO_PPS(pps_idx, _PP_STATUS)
5282 #define PP_ON REG_BIT(31)
5284 * Indicates that all dependencies of the panel are on:
5288 * - LVDS/DVOB/DVOC on
5290 #define PP_READY REG_BIT(30)
5291 #define PP_SEQUENCE_MASK REG_GENMASK(29, 28)
5292 #define PP_SEQUENCE_NONE REG_FIELD_PREP(PP_SEQUENCE_MASK, 0)
5293 #define PP_SEQUENCE_POWER_UP REG_FIELD_PREP(PP_SEQUENCE_MASK, 1)
5294 #define PP_SEQUENCE_POWER_DOWN REG_FIELD_PREP(PP_SEQUENCE_MASK, 2)
5295 #define PP_CYCLE_DELAY_ACTIVE REG_BIT(27)
5296 #define PP_SEQUENCE_STATE_MASK REG_GENMASK(3, 0)
5297 #define PP_SEQUENCE_STATE_OFF_IDLE REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x0)
5298 #define PP_SEQUENCE_STATE_OFF_S0_1 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x1)
5299 #define PP_SEQUENCE_STATE_OFF_S0_2 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x2)
5300 #define PP_SEQUENCE_STATE_OFF_S0_3 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x3)
5301 #define PP_SEQUENCE_STATE_ON_IDLE REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x8)
5302 #define PP_SEQUENCE_STATE_ON_S1_1 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x9)
5303 #define PP_SEQUENCE_STATE_ON_S1_2 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0xa)
5304 #define PP_SEQUENCE_STATE_ON_S1_3 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0xb)
5305 #define PP_SEQUENCE_STATE_RESET REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0xf)
5307 #define _PP_CONTROL 0x61204
5308 #define PP_CONTROL(pps_idx) _MMIO_PPS(pps_idx, _PP_CONTROL)
5309 #define PANEL_UNLOCK_MASK REG_GENMASK(31, 16)
5310 #define PANEL_UNLOCK_REGS REG_FIELD_PREP(PANEL_UNLOCK_MASK, 0xabcd)
5311 #define BXT_POWER_CYCLE_DELAY_MASK REG_GENMASK(8, 4)
5312 #define EDP_FORCE_VDD REG_BIT(3)
5313 #define EDP_BLC_ENABLE REG_BIT(2)
5314 #define PANEL_POWER_RESET REG_BIT(1)
5315 #define PANEL_POWER_ON REG_BIT(0)
5317 #define _PP_ON_DELAYS 0x61208
5318 #define PP_ON_DELAYS(pps_idx) _MMIO_PPS(pps_idx, _PP_ON_DELAYS)
5319 #define PANEL_PORT_SELECT_MASK REG_GENMASK(31, 30)
5320 #define PANEL_PORT_SELECT_LVDS REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 0)
5321 #define PANEL_PORT_SELECT_DPA REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 1)
5322 #define PANEL_PORT_SELECT_DPC REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 2)
5323 #define PANEL_PORT_SELECT_DPD REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 3)
5324 #define PANEL_PORT_SELECT_VLV(port) REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, port)
5325 #define PANEL_POWER_UP_DELAY_MASK REG_GENMASK(28, 16)
5326 #define PANEL_LIGHT_ON_DELAY_MASK REG_GENMASK(12, 0)
5328 #define _PP_OFF_DELAYS 0x6120C
5329 #define PP_OFF_DELAYS(pps_idx) _MMIO_PPS(pps_idx, _PP_OFF_DELAYS)
5330 #define PANEL_POWER_DOWN_DELAY_MASK REG_GENMASK(28, 16)
5331 #define PANEL_LIGHT_OFF_DELAY_MASK REG_GENMASK(12, 0)
5333 #define _PP_DIVISOR 0x61210
5334 #define PP_DIVISOR(pps_idx) _MMIO_PPS(pps_idx, _PP_DIVISOR)
5335 #define PP_REFERENCE_DIVIDER_MASK REG_GENMASK(31, 8)
5336 #define PANEL_POWER_CYCLE_DELAY_MASK REG_GENMASK(4, 0)
5339 #define PFIT_CONTROL _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61230)
5340 #define PFIT_ENABLE (1 << 31)
5341 #define PFIT_PIPE_MASK (3 << 29)
5342 #define PFIT_PIPE_SHIFT 29
5343 #define PFIT_PIPE(pipe) ((pipe) << 29)
5344 #define VERT_INTERP_DISABLE (0 << 10)
5345 #define VERT_INTERP_BILINEAR (1 << 10)
5346 #define VERT_INTERP_MASK (3 << 10)
5347 #define VERT_AUTO_SCALE (1 << 9)
5348 #define HORIZ_INTERP_DISABLE (0 << 6)
5349 #define HORIZ_INTERP_BILINEAR (1 << 6)
5350 #define HORIZ_INTERP_MASK (3 << 6)
5351 #define HORIZ_AUTO_SCALE (1 << 5)
5352 #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
5353 #define PFIT_FILTER_FUZZY (0 << 24)
5354 #define PFIT_SCALING_AUTO (0 << 26)
5355 #define PFIT_SCALING_PROGRAMMED (1 << 26)
5356 #define PFIT_SCALING_PILLAR (2 << 26)
5357 #define PFIT_SCALING_LETTER (3 << 26)
5358 #define PFIT_PGM_RATIOS _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61234)
5360 #define PFIT_VERT_SCALE_SHIFT 20
5361 #define PFIT_VERT_SCALE_MASK 0xfff00000
5362 #define PFIT_HORIZ_SCALE_SHIFT 4
5363 #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
5365 #define PFIT_VERT_SCALE_SHIFT_965 16
5366 #define PFIT_VERT_SCALE_MASK_965 0x1fff0000
5367 #define PFIT_HORIZ_SCALE_SHIFT_965 0
5368 #define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
5370 #define PFIT_AUTO_RATIOS _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61238)
5372 #define _VLV_BLC_PWM_CTL2_A (DISPLAY_MMIO_BASE(dev_priv) + 0x61250)
5373 #define _VLV_BLC_PWM_CTL2_B (DISPLAY_MMIO_BASE(dev_priv) + 0x61350)
5374 #define VLV_BLC_PWM_CTL2(pipe) _MMIO_PIPE(pipe, _VLV_BLC_PWM_CTL2_A, \
5375 _VLV_BLC_PWM_CTL2_B)
5377 #define _VLV_BLC_PWM_CTL_A (DISPLAY_MMIO_BASE(dev_priv) + 0x61254)
5378 #define _VLV_BLC_PWM_CTL_B (DISPLAY_MMIO_BASE(dev_priv) + 0x61354)
5379 #define VLV_BLC_PWM_CTL(pipe) _MMIO_PIPE(pipe, _VLV_BLC_PWM_CTL_A, \
5382 #define _VLV_BLC_HIST_CTL_A (DISPLAY_MMIO_BASE(dev_priv) + 0x61260)
5383 #define _VLV_BLC_HIST_CTL_B (DISPLAY_MMIO_BASE(dev_priv) + 0x61360)
5384 #define VLV_BLC_HIST_CTL(pipe) _MMIO_PIPE(pipe, _VLV_BLC_HIST_CTL_A, \
5385 _VLV_BLC_HIST_CTL_B)
5387 /* Backlight control */
5388 #define BLC_PWM_CTL2 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61250) /* 965+ only */
5389 #define BLM_PWM_ENABLE (1 << 31)
5390 #define BLM_COMBINATION_MODE (1 << 30) /* gen4 only */
5391 #define BLM_PIPE_SELECT (1 << 29)
5392 #define BLM_PIPE_SELECT_IVB (3 << 29)
5393 #define BLM_PIPE_A (0 << 29)
5394 #define BLM_PIPE_B (1 << 29)
5395 #define BLM_PIPE_C (2 << 29) /* ivb + */
5396 #define BLM_TRANSCODER_A BLM_PIPE_A /* hsw */
5397 #define BLM_TRANSCODER_B BLM_PIPE_B
5398 #define BLM_TRANSCODER_C BLM_PIPE_C
5399 #define BLM_TRANSCODER_EDP (3 << 29)
5400 #define BLM_PIPE(pipe) ((pipe) << 29)
5401 #define BLM_POLARITY_I965 (1 << 28) /* gen4 only */
5402 #define BLM_PHASE_IN_INTERUPT_STATUS (1 << 26)
5403 #define BLM_PHASE_IN_ENABLE (1 << 25)
5404 #define BLM_PHASE_IN_INTERUPT_ENABL (1 << 24)
5405 #define BLM_PHASE_IN_TIME_BASE_SHIFT (16)
5406 #define BLM_PHASE_IN_TIME_BASE_MASK (0xff << 16)
5407 #define BLM_PHASE_IN_COUNT_SHIFT (8)
5408 #define BLM_PHASE_IN_COUNT_MASK (0xff << 8)
5409 #define BLM_PHASE_IN_INCR_SHIFT (0)
5410 #define BLM_PHASE_IN_INCR_MASK (0xff << 0)
5411 #define BLC_PWM_CTL _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61254)
5413 * This is the most significant 15 bits of the number of backlight cycles in a
5414 * complete cycle of the modulated backlight control.
5416 * The actual value is this field multiplied by two.
5418 #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
5419 #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
5420 #define BLM_LEGACY_MODE (1 << 16) /* gen2 only */
5422 * This is the number of cycles out of the backlight modulation cycle for which
5423 * the backlight is on.
5425 * This field must be no greater than the number of cycles in the complete
5426 * backlight modulation cycle.
5428 #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
5429 #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
5430 #define BACKLIGHT_DUTY_CYCLE_MASK_PNV (0xfffe)
5431 #define BLM_POLARITY_PNV (1 << 0) /* pnv only */
5433 #define BLC_HIST_CTL _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61260)
5434 #define BLM_HISTOGRAM_ENABLE (1 << 31)
5436 /* New registers for PCH-split platforms. Safe where new bits show up, the
5437 * register layout machtes with gen4 BLC_PWM_CTL[12]. */
5438 #define BLC_PWM_CPU_CTL2 _MMIO(0x48250)
5439 #define BLC_PWM_CPU_CTL _MMIO(0x48254)
5441 #define HSW_BLC_PWM2_CTL _MMIO(0x48350)
5443 /* PCH CTL1 is totally different, all but the below bits are reserved. CTL2 is
5444 * like the normal CTL from gen4 and earlier. Hooray for confusing naming. */
5445 #define BLC_PWM_PCH_CTL1 _MMIO(0xc8250)
5446 #define BLM_PCH_PWM_ENABLE (1 << 31)
5447 #define BLM_PCH_OVERRIDE_ENABLE (1 << 30)
5448 #define BLM_PCH_POLARITY (1 << 29)
5449 #define BLC_PWM_PCH_CTL2 _MMIO(0xc8254)
5451 #define UTIL_PIN_CTL _MMIO(0x48400)
5452 #define UTIL_PIN_ENABLE (1 << 31)
5453 #define UTIL_PIN_PIPE_MASK (3 << 29)
5454 #define UTIL_PIN_PIPE(x) ((x) << 29)
5455 #define UTIL_PIN_MODE_MASK (0xf << 24)
5456 #define UTIL_PIN_MODE_DATA (0 << 24)
5457 #define UTIL_PIN_MODE_PWM (1 << 24)
5458 #define UTIL_PIN_MODE_VBLANK (4 << 24)
5459 #define UTIL_PIN_MODE_VSYNC (5 << 24)
5460 #define UTIL_PIN_MODE_EYE_LEVEL (8 << 24)
5461 #define UTIL_PIN_OUTPUT_DATA (1 << 23)
5462 #define UTIL_PIN_POLARITY (1 << 22)
5463 #define UTIL_PIN_DIRECTION_INPUT (1 << 19)
5464 #define UTIL_PIN_INPUT_DATA (1 << 16)
5466 /* BXT backlight register definition. */
5467 #define _BXT_BLC_PWM_CTL1 0xC8250
5468 #define BXT_BLC_PWM_ENABLE (1 << 31)
5469 #define BXT_BLC_PWM_POLARITY (1 << 29)
5470 #define _BXT_BLC_PWM_FREQ1 0xC8254
5471 #define _BXT_BLC_PWM_DUTY1 0xC8258
5473 #define _BXT_BLC_PWM_CTL2 0xC8350
5474 #define _BXT_BLC_PWM_FREQ2 0xC8354
5475 #define _BXT_BLC_PWM_DUTY2 0xC8358
5477 #define BXT_BLC_PWM_CTL(controller) _MMIO_PIPE(controller, \
5478 _BXT_BLC_PWM_CTL1, _BXT_BLC_PWM_CTL2)
5479 #define BXT_BLC_PWM_FREQ(controller) _MMIO_PIPE(controller, \
5480 _BXT_BLC_PWM_FREQ1, _BXT_BLC_PWM_FREQ2)
5481 #define BXT_BLC_PWM_DUTY(controller) _MMIO_PIPE(controller, \
5482 _BXT_BLC_PWM_DUTY1, _BXT_BLC_PWM_DUTY2)
5484 #define PCH_GTC_CTL _MMIO(0xe7000)
5485 #define PCH_GTC_ENABLE (1 << 31)
5487 /* TV port control */
5488 #define TV_CTL _MMIO(0x68000)
5489 /* Enables the TV encoder */
5490 # define TV_ENC_ENABLE (1 << 31)
5491 /* Sources the TV encoder input from pipe B instead of A. */
5492 # define TV_ENC_PIPE_SEL_SHIFT 30
5493 # define TV_ENC_PIPE_SEL_MASK (1 << 30)
5494 # define TV_ENC_PIPE_SEL(pipe) ((pipe) << 30)
5495 /* Outputs composite video (DAC A only) */
5496 # define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
5497 /* Outputs SVideo video (DAC B/C) */
5498 # define TV_ENC_OUTPUT_SVIDEO (1 << 28)
5499 /* Outputs Component video (DAC A/B/C) */
5500 # define TV_ENC_OUTPUT_COMPONENT (2 << 28)
5501 /* Outputs Composite and SVideo (DAC A/B/C) */
5502 # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
5503 # define TV_TRILEVEL_SYNC (1 << 21)
5504 /* Enables slow sync generation (945GM only) */
5505 # define TV_SLOW_SYNC (1 << 20)
5506 /* Selects 4x oversampling for 480i and 576p */
5507 # define TV_OVERSAMPLE_4X (0 << 18)
5508 /* Selects 2x oversampling for 720p and 1080i */
5509 # define TV_OVERSAMPLE_2X (1 << 18)
5510 /* Selects no oversampling for 1080p */
5511 # define TV_OVERSAMPLE_NONE (2 << 18)
5512 /* Selects 8x oversampling */
5513 # define TV_OVERSAMPLE_8X (3 << 18)
5514 # define TV_OVERSAMPLE_MASK (3 << 18)
5515 /* Selects progressive mode rather than interlaced */
5516 # define TV_PROGRESSIVE (1 << 17)
5517 /* Sets the colorburst to PAL mode. Required for non-M PAL modes. */
5518 # define TV_PAL_BURST (1 << 16)
5519 /* Field for setting delay of Y compared to C */
5520 # define TV_YC_SKEW_MASK (7 << 12)
5521 /* Enables a fix for 480p/576p standard definition modes on the 915GM only */
5522 # define TV_ENC_SDP_FIX (1 << 11)
5524 * Enables a fix for the 915GM only.
5526 * Not sure what it does.
5528 # define TV_ENC_C0_FIX (1 << 10)
5529 /* Bits that must be preserved by software */
5530 # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
5531 # define TV_FUSE_STATE_MASK (3 << 4)
5532 /* Read-only state that reports all features enabled */
5533 # define TV_FUSE_STATE_ENABLED (0 << 4)
5534 /* Read-only state that reports that Macrovision is disabled in hardware*/
5535 # define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
5536 /* Read-only state that reports that TV-out is disabled in hardware. */
5537 # define TV_FUSE_STATE_DISABLED (2 << 4)
5538 /* Normal operation */
5539 # define TV_TEST_MODE_NORMAL (0 << 0)
5540 /* Encoder test pattern 1 - combo pattern */
5541 # define TV_TEST_MODE_PATTERN_1 (1 << 0)
5542 /* Encoder test pattern 2 - full screen vertical 75% color bars */
5543 # define TV_TEST_MODE_PATTERN_2 (2 << 0)
5544 /* Encoder test pattern 3 - full screen horizontal 75% color bars */
5545 # define TV_TEST_MODE_PATTERN_3 (3 << 0)
5546 /* Encoder test pattern 4 - random noise */
5547 # define TV_TEST_MODE_PATTERN_4 (4 << 0)
5548 /* Encoder test pattern 5 - linear color ramps */
5549 # define TV_TEST_MODE_PATTERN_5 (5 << 0)
5551 * This test mode forces the DACs to 50% of full output.
5553 * This is used for load detection in combination with TVDAC_SENSE_MASK
5555 # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
5556 # define TV_TEST_MODE_MASK (7 << 0)
5558 #define TV_DAC _MMIO(0x68004)
5559 # define TV_DAC_SAVE 0x00ffff00
5561 * Reports that DAC state change logic has reported change (RO).
5563 * This gets cleared when TV_DAC_STATE_EN is cleared
5565 # define TVDAC_STATE_CHG (1 << 31)
5566 # define TVDAC_SENSE_MASK (7 << 28)
5567 /* Reports that DAC A voltage is above the detect threshold */
5568 # define TVDAC_A_SENSE (1 << 30)
5569 /* Reports that DAC B voltage is above the detect threshold */
5570 # define TVDAC_B_SENSE (1 << 29)
5571 /* Reports that DAC C voltage is above the detect threshold */
5572 # define TVDAC_C_SENSE (1 << 28)
5574 * Enables DAC state detection logic, for load-based TV detection.
5576 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
5577 * to off, for load detection to work.
5579 # define TVDAC_STATE_CHG_EN (1 << 27)
5580 /* Sets the DAC A sense value to high */
5581 # define TVDAC_A_SENSE_CTL (1 << 26)
5582 /* Sets the DAC B sense value to high */
5583 # define TVDAC_B_SENSE_CTL (1 << 25)
5584 /* Sets the DAC C sense value to high */
5585 # define TVDAC_C_SENSE_CTL (1 << 24)
5586 /* Overrides the ENC_ENABLE and DAC voltage levels */
5587 # define DAC_CTL_OVERRIDE (1 << 7)
5588 /* Sets the slew rate. Must be preserved in software */
5589 # define ENC_TVDAC_SLEW_FAST (1 << 6)
5590 # define DAC_A_1_3_V (0 << 4)
5591 # define DAC_A_1_1_V (1 << 4)
5592 # define DAC_A_0_7_V (2 << 4)
5593 # define DAC_A_MASK (3 << 4)
5594 # define DAC_B_1_3_V (0 << 2)
5595 # define DAC_B_1_1_V (1 << 2)
5596 # define DAC_B_0_7_V (2 << 2)
5597 # define DAC_B_MASK (3 << 2)
5598 # define DAC_C_1_3_V (0 << 0)
5599 # define DAC_C_1_1_V (1 << 0)
5600 # define DAC_C_0_7_V (2 << 0)
5601 # define DAC_C_MASK (3 << 0)
5604 * CSC coefficients are stored in a floating point format with 9 bits of
5605 * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
5606 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
5607 * -1 (0x3) being the only legal negative value.
5609 #define TV_CSC_Y _MMIO(0x68010)
5610 # define TV_RY_MASK 0x07ff0000
5611 # define TV_RY_SHIFT 16
5612 # define TV_GY_MASK 0x00000fff
5613 # define TV_GY_SHIFT 0
5615 #define TV_CSC_Y2 _MMIO(0x68014)
5616 # define TV_BY_MASK 0x07ff0000
5617 # define TV_BY_SHIFT 16
5619 * Y attenuation for component video.
5621 * Stored in 1.9 fixed point.
5623 # define TV_AY_MASK 0x000003ff
5624 # define TV_AY_SHIFT 0
5626 #define TV_CSC_U _MMIO(0x68018)
5627 # define TV_RU_MASK 0x07ff0000
5628 # define TV_RU_SHIFT 16
5629 # define TV_GU_MASK 0x000007ff
5630 # define TV_GU_SHIFT 0
5632 #define TV_CSC_U2 _MMIO(0x6801c)
5633 # define TV_BU_MASK 0x07ff0000
5634 # define TV_BU_SHIFT 16
5636 * U attenuation for component video.
5638 * Stored in 1.9 fixed point.
5640 # define TV_AU_MASK 0x000003ff
5641 # define TV_AU_SHIFT 0
5643 #define TV_CSC_V _MMIO(0x68020)
5644 # define TV_RV_MASK 0x0fff0000
5645 # define TV_RV_SHIFT 16
5646 # define TV_GV_MASK 0x000007ff
5647 # define TV_GV_SHIFT 0
5649 #define TV_CSC_V2 _MMIO(0x68024)
5650 # define TV_BV_MASK 0x07ff0000
5651 # define TV_BV_SHIFT 16
5653 * V attenuation for component video.
5655 * Stored in 1.9 fixed point.
5657 # define TV_AV_MASK 0x000007ff
5658 # define TV_AV_SHIFT 0
5660 #define TV_CLR_KNOBS _MMIO(0x68028)
5661 /* 2s-complement brightness adjustment */
5662 # define TV_BRIGHTNESS_MASK 0xff000000
5663 # define TV_BRIGHTNESS_SHIFT 24
5664 /* Contrast adjustment, as a 2.6 unsigned floating point number */
5665 # define TV_CONTRAST_MASK 0x00ff0000
5666 # define TV_CONTRAST_SHIFT 16
5667 /* Saturation adjustment, as a 2.6 unsigned floating point number */
5668 # define TV_SATURATION_MASK 0x0000ff00
5669 # define TV_SATURATION_SHIFT 8
5670 /* Hue adjustment, as an integer phase angle in degrees */
5671 # define TV_HUE_MASK 0x000000ff
5672 # define TV_HUE_SHIFT 0
5674 #define TV_CLR_LEVEL _MMIO(0x6802c)
5675 /* Controls the DAC level for black */
5676 # define TV_BLACK_LEVEL_MASK 0x01ff0000
5677 # define TV_BLACK_LEVEL_SHIFT 16
5678 /* Controls the DAC level for blanking */
5679 # define TV_BLANK_LEVEL_MASK 0x000001ff
5680 # define TV_BLANK_LEVEL_SHIFT 0
5682 #define TV_H_CTL_1 _MMIO(0x68030)
5683 /* Number of pixels in the hsync. */
5684 # define TV_HSYNC_END_MASK 0x1fff0000
5685 # define TV_HSYNC_END_SHIFT 16
5686 /* Total number of pixels minus one in the line (display and blanking). */
5687 # define TV_HTOTAL_MASK 0x00001fff
5688 # define TV_HTOTAL_SHIFT 0
5690 #define TV_H_CTL_2 _MMIO(0x68034)
5691 /* Enables the colorburst (needed for non-component color) */
5692 # define TV_BURST_ENA (1 << 31)
5693 /* Offset of the colorburst from the start of hsync, in pixels minus one. */
5694 # define TV_HBURST_START_SHIFT 16
5695 # define TV_HBURST_START_MASK 0x1fff0000
5696 /* Length of the colorburst */
5697 # define TV_HBURST_LEN_SHIFT 0
5698 # define TV_HBURST_LEN_MASK 0x0001fff
5700 #define TV_H_CTL_3 _MMIO(0x68038)
5701 /* End of hblank, measured in pixels minus one from start of hsync */
5702 # define TV_HBLANK_END_SHIFT 16
5703 # define TV_HBLANK_END_MASK 0x1fff0000
5704 /* Start of hblank, measured in pixels minus one from start of hsync */
5705 # define TV_HBLANK_START_SHIFT 0
5706 # define TV_HBLANK_START_MASK 0x0001fff
5708 #define TV_V_CTL_1 _MMIO(0x6803c)
5710 # define TV_NBR_END_SHIFT 16
5711 # define TV_NBR_END_MASK 0x07ff0000
5713 # define TV_VI_END_F1_SHIFT 8
5714 # define TV_VI_END_F1_MASK 0x00003f00
5716 # define TV_VI_END_F2_SHIFT 0
5717 # define TV_VI_END_F2_MASK 0x0000003f
5719 #define TV_V_CTL_2 _MMIO(0x68040)
5720 /* Length of vsync, in half lines */
5721 # define TV_VSYNC_LEN_MASK 0x07ff0000
5722 # define TV_VSYNC_LEN_SHIFT 16
5723 /* Offset of the start of vsync in field 1, measured in one less than the
5724 * number of half lines.
5726 # define TV_VSYNC_START_F1_MASK 0x00007f00
5727 # define TV_VSYNC_START_F1_SHIFT 8
5729 * Offset of the start of vsync in field 2, measured in one less than the
5730 * number of half lines.
5732 # define TV_VSYNC_START_F2_MASK 0x0000007f
5733 # define TV_VSYNC_START_F2_SHIFT 0
5735 #define TV_V_CTL_3 _MMIO(0x68044)
5736 /* Enables generation of the equalization signal */
5737 # define TV_EQUAL_ENA (1 << 31)
5738 /* Length of vsync, in half lines */
5739 # define TV_VEQ_LEN_MASK 0x007f0000
5740 # define TV_VEQ_LEN_SHIFT 16
5741 /* Offset of the start of equalization in field 1, measured in one less than
5742 * the number of half lines.
5744 # define TV_VEQ_START_F1_MASK 0x0007f00
5745 # define TV_VEQ_START_F1_SHIFT 8
5747 * Offset of the start of equalization in field 2, measured in one less than
5748 * the number of half lines.
5750 # define TV_VEQ_START_F2_MASK 0x000007f
5751 # define TV_VEQ_START_F2_SHIFT 0
5753 #define TV_V_CTL_4 _MMIO(0x68048)
5755 * Offset to start of vertical colorburst, measured in one less than the
5756 * number of lines from vertical start.
5758 # define TV_VBURST_START_F1_MASK 0x003f0000
5759 # define TV_VBURST_START_F1_SHIFT 16
5761 * Offset to the end of vertical colorburst, measured in one less than the
5762 * number of lines from the start of NBR.
5764 # define TV_VBURST_END_F1_MASK 0x000000ff
5765 # define TV_VBURST_END_F1_SHIFT 0
5767 #define TV_V_CTL_5 _MMIO(0x6804c)
5769 * Offset to start of vertical colorburst, measured in one less than the
5770 * number of lines from vertical start.
5772 # define TV_VBURST_START_F2_MASK 0x003f0000
5773 # define TV_VBURST_START_F2_SHIFT 16
5775 * Offset to the end of vertical colorburst, measured in one less than the
5776 * number of lines from the start of NBR.
5778 # define TV_VBURST_END_F2_MASK 0x000000ff
5779 # define TV_VBURST_END_F2_SHIFT 0
5781 #define TV_V_CTL_6 _MMIO(0x68050)
5783 * Offset to start of vertical colorburst, measured in one less than the
5784 * number of lines from vertical start.
5786 # define TV_VBURST_START_F3_MASK 0x003f0000
5787 # define TV_VBURST_START_F3_SHIFT 16
5789 * Offset to the end of vertical colorburst, measured in one less than the
5790 * number of lines from the start of NBR.
5792 # define TV_VBURST_END_F3_MASK 0x000000ff
5793 # define TV_VBURST_END_F3_SHIFT 0
5795 #define TV_V_CTL_7 _MMIO(0x68054)
5797 * Offset to start of vertical colorburst, measured in one less than the
5798 * number of lines from vertical start.
5800 # define TV_VBURST_START_F4_MASK 0x003f0000
5801 # define TV_VBURST_START_F4_SHIFT 16
5803 * Offset to the end of vertical colorburst, measured in one less than the
5804 * number of lines from the start of NBR.
5806 # define TV_VBURST_END_F4_MASK 0x000000ff
5807 # define TV_VBURST_END_F4_SHIFT 0
5809 #define TV_SC_CTL_1 _MMIO(0x68060)
5810 /* Turns on the first subcarrier phase generation DDA */
5811 # define TV_SC_DDA1_EN (1 << 31)
5812 /* Turns on the first subcarrier phase generation DDA */
5813 # define TV_SC_DDA2_EN (1 << 30)
5814 /* Turns on the first subcarrier phase generation DDA */
5815 # define TV_SC_DDA3_EN (1 << 29)
5816 /* Sets the subcarrier DDA to reset frequency every other field */
5817 # define TV_SC_RESET_EVERY_2 (0 << 24)
5818 /* Sets the subcarrier DDA to reset frequency every fourth field */
5819 # define TV_SC_RESET_EVERY_4 (1 << 24)
5820 /* Sets the subcarrier DDA to reset frequency every eighth field */
5821 # define TV_SC_RESET_EVERY_8 (2 << 24)
5822 /* Sets the subcarrier DDA to never reset the frequency */
5823 # define TV_SC_RESET_NEVER (3 << 24)
5824 /* Sets the peak amplitude of the colorburst.*/
5825 # define TV_BURST_LEVEL_MASK 0x00ff0000
5826 # define TV_BURST_LEVEL_SHIFT 16
5827 /* Sets the increment of the first subcarrier phase generation DDA */
5828 # define TV_SCDDA1_INC_MASK 0x00000fff
5829 # define TV_SCDDA1_INC_SHIFT 0
5831 #define TV_SC_CTL_2 _MMIO(0x68064)
5832 /* Sets the rollover for the second subcarrier phase generation DDA */
5833 # define TV_SCDDA2_SIZE_MASK 0x7fff0000
5834 # define TV_SCDDA2_SIZE_SHIFT 16
5835 /* Sets the increent of the second subcarrier phase generation DDA */
5836 # define TV_SCDDA2_INC_MASK 0x00007fff
5837 # define TV_SCDDA2_INC_SHIFT 0
5839 #define TV_SC_CTL_3 _MMIO(0x68068)
5840 /* Sets the rollover for the third subcarrier phase generation DDA */
5841 # define TV_SCDDA3_SIZE_MASK 0x7fff0000
5842 # define TV_SCDDA3_SIZE_SHIFT 16
5843 /* Sets the increent of the third subcarrier phase generation DDA */
5844 # define TV_SCDDA3_INC_MASK 0x00007fff
5845 # define TV_SCDDA3_INC_SHIFT 0
5847 #define TV_WIN_POS _MMIO(0x68070)
5848 /* X coordinate of the display from the start of horizontal active */
5849 # define TV_XPOS_MASK 0x1fff0000
5850 # define TV_XPOS_SHIFT 16
5851 /* Y coordinate of the display from the start of vertical active (NBR) */
5852 # define TV_YPOS_MASK 0x00000fff
5853 # define TV_YPOS_SHIFT 0
5855 #define TV_WIN_SIZE _MMIO(0x68074)
5856 /* Horizontal size of the display window, measured in pixels*/
5857 # define TV_XSIZE_MASK 0x1fff0000
5858 # define TV_XSIZE_SHIFT 16
5860 * Vertical size of the display window, measured in pixels.
5862 * Must be even for interlaced modes.
5864 # define TV_YSIZE_MASK 0x00000fff
5865 # define TV_YSIZE_SHIFT 0
5867 #define TV_FILTER_CTL_1 _MMIO(0x68080)
5869 * Enables automatic scaling calculation.
5871 * If set, the rest of the registers are ignored, and the calculated values can
5872 * be read back from the register.
5874 # define TV_AUTO_SCALE (1 << 31)
5876 * Disables the vertical filter.
5878 * This is required on modes more than 1024 pixels wide */
5879 # define TV_V_FILTER_BYPASS (1 << 29)
5880 /* Enables adaptive vertical filtering */
5881 # define TV_VADAPT (1 << 28)
5882 # define TV_VADAPT_MODE_MASK (3 << 26)
5883 /* Selects the least adaptive vertical filtering mode */
5884 # define TV_VADAPT_MODE_LEAST (0 << 26)
5885 /* Selects the moderately adaptive vertical filtering mode */
5886 # define TV_VADAPT_MODE_MODERATE (1 << 26)
5887 /* Selects the most adaptive vertical filtering mode */
5888 # define TV_VADAPT_MODE_MOST (3 << 26)
5890 * Sets the horizontal scaling factor.
5892 * This should be the fractional part of the horizontal scaling factor divided
5893 * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
5895 * (src width - 1) / ((oversample * dest width) - 1)
5897 # define TV_HSCALE_FRAC_MASK 0x00003fff
5898 # define TV_HSCALE_FRAC_SHIFT 0
5900 #define TV_FILTER_CTL_2 _MMIO(0x68084)
5902 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
5904 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
5906 # define TV_VSCALE_INT_MASK 0x00038000
5907 # define TV_VSCALE_INT_SHIFT 15
5909 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
5911 * \sa TV_VSCALE_INT_MASK
5913 # define TV_VSCALE_FRAC_MASK 0x00007fff
5914 # define TV_VSCALE_FRAC_SHIFT 0
5916 #define TV_FILTER_CTL_3 _MMIO(0x68088)
5918 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
5920 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
5922 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
5924 # define TV_VSCALE_IP_INT_MASK 0x00038000
5925 # define TV_VSCALE_IP_INT_SHIFT 15
5927 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
5929 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
5931 * \sa TV_VSCALE_IP_INT_MASK
5933 # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
5934 # define TV_VSCALE_IP_FRAC_SHIFT 0
5936 #define TV_CC_CONTROL _MMIO(0x68090)
5937 # define TV_CC_ENABLE (1 << 31)
5939 * Specifies which field to send the CC data in.
5941 * CC data is usually sent in field 0.
5943 # define TV_CC_FID_MASK (1 << 27)
5944 # define TV_CC_FID_SHIFT 27
5945 /* Sets the horizontal position of the CC data. Usually 135. */
5946 # define TV_CC_HOFF_MASK 0x03ff0000
5947 # define TV_CC_HOFF_SHIFT 16
5948 /* Sets the vertical position of the CC data. Usually 21 */
5949 # define TV_CC_LINE_MASK 0x0000003f
5950 # define TV_CC_LINE_SHIFT 0
5952 #define TV_CC_DATA _MMIO(0x68094)
5953 # define TV_CC_RDY (1 << 31)
5954 /* Second word of CC data to be transmitted. */
5955 # define TV_CC_DATA_2_MASK 0x007f0000
5956 # define TV_CC_DATA_2_SHIFT 16
5957 /* First word of CC data to be transmitted. */
5958 # define TV_CC_DATA_1_MASK 0x0000007f
5959 # define TV_CC_DATA_1_SHIFT 0
5961 #define TV_H_LUMA(i) _MMIO(0x68100 + (i) * 4) /* 60 registers */
5962 #define TV_H_CHROMA(i) _MMIO(0x68200 + (i) * 4) /* 60 registers */
5963 #define TV_V_LUMA(i) _MMIO(0x68300 + (i) * 4) /* 43 registers */
5964 #define TV_V_CHROMA(i) _MMIO(0x68400 + (i) * 4) /* 43 registers */
5967 #define DP_A _MMIO(0x64000) /* eDP */
5968 #define DP_B _MMIO(0x64100)
5969 #define DP_C _MMIO(0x64200)
5970 #define DP_D _MMIO(0x64300)
5972 #define VLV_DP_B _MMIO(VLV_DISPLAY_BASE + 0x64100)
5973 #define VLV_DP_C _MMIO(VLV_DISPLAY_BASE + 0x64200)
5974 #define CHV_DP_D _MMIO(VLV_DISPLAY_BASE + 0x64300)
5976 #define DP_PORT_EN (1 << 31)
5977 #define DP_PIPE_SEL_SHIFT 30
5978 #define DP_PIPE_SEL_MASK (1 << 30)
5979 #define DP_PIPE_SEL(pipe) ((pipe) << 30)
5980 #define DP_PIPE_SEL_SHIFT_IVB 29
5981 #define DP_PIPE_SEL_MASK_IVB (3 << 29)
5982 #define DP_PIPE_SEL_IVB(pipe) ((pipe) << 29)
5983 #define DP_PIPE_SEL_SHIFT_CHV 16
5984 #define DP_PIPE_SEL_MASK_CHV (3 << 16)
5985 #define DP_PIPE_SEL_CHV(pipe) ((pipe) << 16)
5987 /* Link training mode - select a suitable mode for each stage */
5988 #define DP_LINK_TRAIN_PAT_1 (0 << 28)
5989 #define DP_LINK_TRAIN_PAT_2 (1 << 28)
5990 #define DP_LINK_TRAIN_PAT_IDLE (2 << 28)
5991 #define DP_LINK_TRAIN_OFF (3 << 28)
5992 #define DP_LINK_TRAIN_MASK (3 << 28)
5993 #define DP_LINK_TRAIN_SHIFT 28
5995 /* CPT Link training mode */
5996 #define DP_LINK_TRAIN_PAT_1_CPT (0 << 8)
5997 #define DP_LINK_TRAIN_PAT_2_CPT (1 << 8)
5998 #define DP_LINK_TRAIN_PAT_IDLE_CPT (2 << 8)
5999 #define DP_LINK_TRAIN_OFF_CPT (3 << 8)
6000 #define DP_LINK_TRAIN_MASK_CPT (7 << 8)
6001 #define DP_LINK_TRAIN_SHIFT_CPT 8
6003 /* Signal voltages. These are mostly controlled by the other end */
6004 #define DP_VOLTAGE_0_4 (0 << 25)
6005 #define DP_VOLTAGE_0_6 (1 << 25)
6006 #define DP_VOLTAGE_0_8 (2 << 25)
6007 #define DP_VOLTAGE_1_2 (3 << 25)
6008 #define DP_VOLTAGE_MASK (7 << 25)
6009 #define DP_VOLTAGE_SHIFT 25
6011 /* Signal pre-emphasis levels, like voltages, the other end tells us what
6014 #define DP_PRE_EMPHASIS_0 (0 << 22)
6015 #define DP_PRE_EMPHASIS_3_5 (1 << 22)
6016 #define DP_PRE_EMPHASIS_6 (2 << 22)
6017 #define DP_PRE_EMPHASIS_9_5 (3 << 22)
6018 #define DP_PRE_EMPHASIS_MASK (7 << 22)
6019 #define DP_PRE_EMPHASIS_SHIFT 22
6021 /* How many wires to use. I guess 3 was too hard */
6022 #define DP_PORT_WIDTH(width) (((width) - 1) << 19)
6023 #define DP_PORT_WIDTH_MASK (7 << 19)
6024 #define DP_PORT_WIDTH_SHIFT 19
6026 /* Mystic DPCD version 1.1 special mode */
6027 #define DP_ENHANCED_FRAMING (1 << 18)
6030 #define DP_PLL_FREQ_270MHZ (0 << 16)
6031 #define DP_PLL_FREQ_162MHZ (1 << 16)
6032 #define DP_PLL_FREQ_MASK (3 << 16)
6034 /* locked once port is enabled */
6035 #define DP_PORT_REVERSAL (1 << 15)
6038 #define DP_PLL_ENABLE (1 << 14)
6040 /* sends the clock on lane 15 of the PEG for debug */
6041 #define DP_CLOCK_OUTPUT_ENABLE (1 << 13)
6043 #define DP_SCRAMBLING_DISABLE (1 << 12)
6044 #define DP_SCRAMBLING_DISABLE_IRONLAKE (1 << 7)
6046 /* limit RGB values to avoid confusing TVs */
6047 #define DP_COLOR_RANGE_16_235 (1 << 8)
6049 /* Turn on the audio link */
6050 #define DP_AUDIO_OUTPUT_ENABLE (1 << 6)
6052 /* vs and hs sync polarity */
6053 #define DP_SYNC_VS_HIGH (1 << 4)
6054 #define DP_SYNC_HS_HIGH (1 << 3)
6057 #define DP_DETECTED (1 << 2)
6059 /* The aux channel provides a way to talk to the
6060 * signal sink for DDC etc. Max packet size supported
6061 * is 20 bytes in each direction, hence the 5 fixed
6064 #define _DPA_AUX_CH_CTL (DISPLAY_MMIO_BASE(dev_priv) + 0x64010)
6065 #define _DPA_AUX_CH_DATA1 (DISPLAY_MMIO_BASE(dev_priv) + 0x64014)
6067 #define _DPB_AUX_CH_CTL (DISPLAY_MMIO_BASE(dev_priv) + 0x64110)
6068 #define _DPB_AUX_CH_DATA1 (DISPLAY_MMIO_BASE(dev_priv) + 0x64114)
6070 #define DP_AUX_CH_CTL(aux_ch) _MMIO_PORT(aux_ch, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
6071 #define DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT(aux_ch, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
6073 #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
6074 #define DP_AUX_CH_CTL_DONE (1 << 30)
6075 #define DP_AUX_CH_CTL_INTERRUPT (1 << 29)
6076 #define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28)
6077 #define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26)
6078 #define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26)
6079 #define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26)
6080 #define DP_AUX_CH_CTL_TIME_OUT_MAX (3 << 26) /* Varies per platform */
6081 #define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26)
6082 #define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25)
6083 #define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
6084 #define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20
6085 #define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16)
6086 #define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16
6087 #define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15)
6088 #define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14)
6089 #define DP_AUX_CH_CTL_SYNC_TEST (1 << 13)
6090 #define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12)
6091 #define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)
6092 #define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)
6093 #define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0
6094 #define DP_AUX_CH_CTL_PSR_DATA_AUX_REG_SKL (1 << 14)
6095 #define DP_AUX_CH_CTL_FS_DATA_AUX_REG_SKL (1 << 13)
6096 #define DP_AUX_CH_CTL_GTC_DATA_AUX_REG_SKL (1 << 12)
6097 #define DP_AUX_CH_CTL_TBT_IO (1 << 11)
6098 #define DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL_MASK (0x1f << 5)
6099 #define DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(c) (((c) - 1) << 5)
6100 #define DP_AUX_CH_CTL_SYNC_PULSE_SKL(c) ((c) - 1)
6103 * Computing GMCH M and N values for the Display Port link
6105 * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
6107 * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
6109 * The GMCH value is used internally
6111 * bytes_per_pixel is the number of bytes coming out of the plane,
6112 * which is after the LUTs, so we want the bytes for our color format.
6113 * For our current usage, this is always 3, one byte for R, G and B.
6115 #define _PIPEA_DATA_M_G4X 0x70050
6116 #define _PIPEB_DATA_M_G4X 0x71050
6118 /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
6119 #define TU_SIZE(x) (((x) - 1) << 25) /* default size 64 */
6120 #define TU_SIZE_SHIFT 25
6121 #define TU_SIZE_MASK (0x3f << 25)
6123 #define DATA_LINK_M_N_MASK (0xffffff)
6124 #define DATA_LINK_N_MAX (0x800000)
6126 #define _PIPEA_DATA_N_G4X 0x70054
6127 #define _PIPEB_DATA_N_G4X 0x71054
6128 #define PIPE_GMCH_DATA_N_MASK (0xffffff)
6131 * Computing Link M and N values for the Display Port link
6133 * Link M / N = pixel_clock / ls_clk
6135 * (the DP spec calls pixel_clock the 'strm_clk')
6137 * The Link value is transmitted in the Main Stream
6138 * Attributes and VB-ID.
6141 #define _PIPEA_LINK_M_G4X 0x70060
6142 #define _PIPEB_LINK_M_G4X 0x71060
6143 #define PIPEA_DP_LINK_M_MASK (0xffffff)
6145 #define _PIPEA_LINK_N_G4X 0x70064
6146 #define _PIPEB_LINK_N_G4X 0x71064
6147 #define PIPEA_DP_LINK_N_MASK (0xffffff)
6149 #define PIPE_DATA_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_M_G4X, _PIPEB_DATA_M_G4X)
6150 #define PIPE_DATA_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_N_G4X, _PIPEB_DATA_N_G4X)
6151 #define PIPE_LINK_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_M_G4X, _PIPEB_LINK_M_G4X)
6152 #define PIPE_LINK_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_N_G4X, _PIPEB_LINK_N_G4X)
6154 /* Display & cursor control */
6157 #define _PIPEADSL 0x70000
6158 #define DSL_LINEMASK_GEN2 0x00000fff
6159 #define DSL_LINEMASK_GEN3 0x00001fff
6160 #define _PIPEACONF 0x70008
6161 #define PIPECONF_ENABLE (1 << 31)
6162 #define PIPECONF_DISABLE 0
6163 #define PIPECONF_DOUBLE_WIDE (1 << 30)
6164 #define I965_PIPECONF_ACTIVE (1 << 30)
6165 #define PIPECONF_DSI_PLL_LOCKED (1 << 29) /* vlv & pipe A only */
6166 #define PIPECONF_FRAME_START_DELAY_MASK (3 << 27) /* pre-hsw */
6167 #define PIPECONF_FRAME_START_DELAY(x) ((x) << 27) /* pre-hsw: 0-3 */
6168 #define PIPECONF_SINGLE_WIDE 0
6169 #define PIPECONF_PIPE_UNLOCKED 0
6170 #define PIPECONF_PIPE_LOCKED (1 << 25)
6171 #define PIPECONF_FORCE_BORDER (1 << 25)
6172 #define PIPECONF_GAMMA_MODE_MASK_I9XX (1 << 24) /* gmch */
6173 #define PIPECONF_GAMMA_MODE_MASK_ILK (3 << 24) /* ilk-ivb */
6174 #define PIPECONF_GAMMA_MODE_8BIT (0 << 24) /* gmch,ilk-ivb */
6175 #define PIPECONF_GAMMA_MODE_10BIT (1 << 24) /* gmch,ilk-ivb */
6176 #define PIPECONF_GAMMA_MODE_12BIT (2 << 24) /* ilk-ivb */
6177 #define PIPECONF_GAMMA_MODE_SPLIT (3 << 24) /* ivb */
6178 #define PIPECONF_GAMMA_MODE(x) ((x) << 24) /* pass in GAMMA_MODE_MODE_* */
6179 #define PIPECONF_GAMMA_MODE_SHIFT 24
6180 #define PIPECONF_INTERLACE_MASK (7 << 21)
6181 #define PIPECONF_INTERLACE_MASK_HSW (3 << 21)
6182 /* Note that pre-gen3 does not support interlaced display directly. Panel
6183 * fitting must be disabled on pre-ilk for interlaced. */
6184 #define PIPECONF_PROGRESSIVE (0 << 21)
6185 #define PIPECONF_INTERLACE_W_SYNC_SHIFT_PANEL (4 << 21) /* gen4 only */
6186 #define PIPECONF_INTERLACE_W_SYNC_SHIFT (5 << 21) /* gen4 only */
6187 #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
6188 #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) /* gen3 only */
6189 /* Ironlake and later have a complete new set of values for interlaced. PFIT
6190 * means panel fitter required, PF means progressive fetch, DBL means power
6191 * saving pixel doubling. */
6192 #define PIPECONF_PFIT_PF_INTERLACED_ILK (1 << 21)
6193 #define PIPECONF_INTERLACED_ILK (3 << 21)
6194 #define PIPECONF_INTERLACED_DBL_ILK (4 << 21) /* ilk/snb only */
6195 #define PIPECONF_PFIT_PF_INTERLACED_DBL_ILK (5 << 21) /* ilk/snb only */
6196 #define PIPECONF_INTERLACE_MODE_MASK (7 << 21)
6197 #define PIPECONF_EDP_RR_MODE_SWITCH (1 << 20)
6198 #define PIPECONF_CXSR_DOWNCLOCK (1 << 16)
6199 #define PIPECONF_EDP_RR_MODE_SWITCH_VLV (1 << 14)
6200 #define PIPECONF_COLOR_RANGE_SELECT (1 << 13)
6201 #define PIPECONF_OUTPUT_COLORSPACE_MASK (3 << 11) /* ilk-ivb */
6202 #define PIPECONF_OUTPUT_COLORSPACE_RGB (0 << 11) /* ilk-ivb */
6203 #define PIPECONF_OUTPUT_COLORSPACE_YUV601 (1 << 11) /* ilk-ivb */
6204 #define PIPECONF_OUTPUT_COLORSPACE_YUV709 (2 << 11) /* ilk-ivb */
6205 #define PIPECONF_OUTPUT_COLORSPACE_YUV_HSW (1 << 11) /* hsw only */
6206 #define PIPECONF_BPC_MASK (0x7 << 5)
6207 #define PIPECONF_8BPC (0 << 5)
6208 #define PIPECONF_10BPC (1 << 5)
6209 #define PIPECONF_6BPC (2 << 5)
6210 #define PIPECONF_12BPC (3 << 5)
6211 #define PIPECONF_DITHER_EN (1 << 4)
6212 #define PIPECONF_DITHER_TYPE_MASK (0x0000000c)
6213 #define PIPECONF_DITHER_TYPE_SP (0 << 2)
6214 #define PIPECONF_DITHER_TYPE_ST1 (1 << 2)
6215 #define PIPECONF_DITHER_TYPE_ST2 (2 << 2)
6216 #define PIPECONF_DITHER_TYPE_TEMP (3 << 2)
6217 #define _PIPEASTAT 0x70024
6218 #define PIPE_FIFO_UNDERRUN_STATUS (1UL << 31)
6219 #define SPRITE1_FLIP_DONE_INT_EN_VLV (1UL << 30)
6220 #define PIPE_CRC_ERROR_ENABLE (1UL << 29)
6221 #define PIPE_CRC_DONE_ENABLE (1UL << 28)
6222 #define PERF_COUNTER2_INTERRUPT_EN (1UL << 27)
6223 #define PIPE_GMBUS_EVENT_ENABLE (1UL << 27)
6224 #define PLANE_FLIP_DONE_INT_EN_VLV (1UL << 26)
6225 #define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL << 26)
6226 #define PIPE_VSYNC_INTERRUPT_ENABLE (1UL << 25)
6227 #define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL << 24)
6228 #define PIPE_DPST_EVENT_ENABLE (1UL << 23)
6229 #define SPRITE0_FLIP_DONE_INT_EN_VLV (1UL << 22)
6230 #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL << 22)
6231 #define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL << 21)
6232 #define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL << 20)
6233 #define PIPE_B_PSR_INTERRUPT_ENABLE_VLV (1UL << 19)
6234 #define PERF_COUNTER_INTERRUPT_EN (1UL << 19)
6235 #define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL << 18) /* pre-965 */
6236 #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL << 18) /* 965 or later */
6237 #define PIPE_FRAMESTART_INTERRUPT_ENABLE (1UL << 17)
6238 #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL << 17)
6239 #define PIPEA_HBLANK_INT_EN_VLV (1UL << 16)
6240 #define PIPE_OVERLAY_UPDATED_ENABLE (1UL << 16)
6241 #define SPRITE1_FLIP_DONE_INT_STATUS_VLV (1UL << 15)
6242 #define SPRITE0_FLIP_DONE_INT_STATUS_VLV (1UL << 14)
6243 #define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL << 13)
6244 #define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL << 12)
6245 #define PERF_COUNTER2_INTERRUPT_STATUS (1UL << 11)
6246 #define PIPE_GMBUS_INTERRUPT_STATUS (1UL << 11)
6247 #define PLANE_FLIP_DONE_INT_STATUS_VLV (1UL << 10)
6248 #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL << 10)
6249 #define PIPE_VSYNC_INTERRUPT_STATUS (1UL << 9)
6250 #define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL << 8)
6251 #define PIPE_DPST_EVENT_STATUS (1UL << 7)
6252 #define PIPE_A_PSR_STATUS_VLV (1UL << 6)
6253 #define PIPE_LEGACY_BLC_EVENT_STATUS (1UL << 6)
6254 #define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL << 5)
6255 #define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL << 4)
6256 #define PIPE_B_PSR_STATUS_VLV (1UL << 3)
6257 #define PERF_COUNTER_INTERRUPT_STATUS (1UL << 3)
6258 #define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL << 2) /* pre-965 */
6259 #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL << 2) /* 965 or later */
6260 #define PIPE_FRAMESTART_INTERRUPT_STATUS (1UL << 1)
6261 #define PIPE_VBLANK_INTERRUPT_STATUS (1UL << 1)
6262 #define PIPE_HBLANK_INT_STATUS (1UL << 0)
6263 #define PIPE_OVERLAY_UPDATED_STATUS (1UL << 0)
6265 #define PIPESTAT_INT_ENABLE_MASK 0x7fff0000
6266 #define PIPESTAT_INT_STATUS_MASK 0x0000ffff
6268 #define PIPE_A_OFFSET 0x70000
6269 #define PIPE_B_OFFSET 0x71000
6270 #define PIPE_C_OFFSET 0x72000
6271 #define PIPE_D_OFFSET 0x73000
6272 #define CHV_PIPE_C_OFFSET 0x74000
6274 * There's actually no pipe EDP. Some pipe registers have
6275 * simply shifted from the pipe to the transcoder, while
6276 * keeping their original offset. Thus we need PIPE_EDP_OFFSET
6277 * to access such registers in transcoder EDP.
6279 #define PIPE_EDP_OFFSET 0x7f000
6281 /* ICL DSI 0 and 1 */
6282 #define PIPE_DSI0_OFFSET 0x7b000
6283 #define PIPE_DSI1_OFFSET 0x7b800
6285 #define PIPECONF(pipe) _MMIO_PIPE2(pipe, _PIPEACONF)
6286 #define PIPEDSL(pipe) _MMIO_PIPE2(pipe, _PIPEADSL)
6287 #define PIPEFRAME(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEHIGH)
6288 #define PIPEFRAMEPIXEL(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEPIXEL)
6289 #define PIPESTAT(pipe) _MMIO_PIPE2(pipe, _PIPEASTAT)
6291 #define _PIPEAGCMAX 0x70010
6292 #define _PIPEBGCMAX 0x71010
6293 #define PIPEGCMAX(pipe, i) _MMIO_PIPE2(pipe, _PIPEAGCMAX + (i) * 4)
6295 #define _PIPE_ARB_CTL_A 0x70028 /* icl+ */
6296 #define PIPE_ARB_CTL(pipe) _MMIO_PIPE2(pipe, _PIPE_ARB_CTL_A)
6297 #define PIPE_ARB_USE_PROG_SLOTS REG_BIT(13)
6299 #define _PIPE_MISC_A 0x70030
6300 #define _PIPE_MISC_B 0x71030
6301 #define PIPEMISC_YUV420_ENABLE (1 << 27) /* glk+ */
6302 #define PIPEMISC_YUV420_MODE_FULL_BLEND (1 << 26) /* glk+ */
6303 #define PIPEMISC_HDR_MODE_PRECISION (1 << 23) /* icl+ */
6304 #define PIPEMISC_OUTPUT_COLORSPACE_YUV (1 << 11)
6305 #define PIPEMISC_PIXEL_ROUNDING_TRUNC REG_BIT(8) /* tgl+ */
6307 * For Display < 13, Bits 5-7 of PIPE MISC represent DITHER BPC with
6308 * valid values of: 6, 8, 10 BPC.
6309 * ADLP+, the bits 5-7 represent PORT OUTPUT BPC with valid values of:
6312 #define PIPEMISC_BPC_MASK (7 << 5)
6313 #define PIPEMISC_8_BPC (0 << 5)
6314 #define PIPEMISC_10_BPC (1 << 5)
6315 #define PIPEMISC_6_BPC (2 << 5)
6316 #define PIPEMISC_12_BPC_ADLP (4 << 5) /* adlp+ */
6317 #define PIPEMISC_DITHER_ENABLE (1 << 4)
6318 #define PIPEMISC_DITHER_TYPE_MASK (3 << 2)
6319 #define PIPEMISC_DITHER_TYPE_SP (0 << 2)
6320 #define PIPEMISC(pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A)
6322 #define _PIPE_MISC2_A 0x7002C
6323 #define _PIPE_MISC2_B 0x7102C
6324 #define PIPE_MISC2_BUBBLE_COUNTER_SCALER_EN (0x50 << 24)
6325 #define PIPE_MISC2_BUBBLE_COUNTER_SCALER_DIS (0x14 << 24)
6326 #define PIPE_MISC2_UNDERRUN_BUBBLE_COUNTER_MASK (0xff << 24)
6327 #define PIPE_MISC2(pipe) _MMIO_PIPE2(pipe, _PIPE_MISC2_A)
6329 /* Skylake+ pipe bottom (background) color */
6330 #define _SKL_BOTTOM_COLOR_A 0x70034
6331 #define SKL_BOTTOM_COLOR_GAMMA_ENABLE (1 << 31)
6332 #define SKL_BOTTOM_COLOR_CSC_ENABLE (1 << 30)
6333 #define SKL_BOTTOM_COLOR(pipe) _MMIO_PIPE2(pipe, _SKL_BOTTOM_COLOR_A)
6335 #define _ICL_PIPE_A_STATUS 0x70058
6336 #define ICL_PIPESTATUS(pipe) _MMIO_PIPE2(pipe, _ICL_PIPE_A_STATUS)
6337 #define PIPE_STATUS_UNDERRUN REG_BIT(31)
6338 #define PIPE_STATUS_SOFT_UNDERRUN_XELPD REG_BIT(28)
6339 #define PIPE_STATUS_HARD_UNDERRUN_XELPD REG_BIT(27)
6340 #define PIPE_STATUS_PORT_UNDERRUN_XELPD REG_BIT(26)
6342 #define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)
6343 #define PIPEB_LINE_COMPARE_INT_EN (1 << 29)
6344 #define PIPEB_HLINE_INT_EN (1 << 28)
6345 #define PIPEB_VBLANK_INT_EN (1 << 27)
6346 #define SPRITED_FLIP_DONE_INT_EN (1 << 26)
6347 #define SPRITEC_FLIP_DONE_INT_EN (1 << 25)
6348 #define PLANEB_FLIP_DONE_INT_EN (1 << 24)
6349 #define PIPE_PSR_INT_EN (1 << 22)
6350 #define PIPEA_LINE_COMPARE_INT_EN (1 << 21)
6351 #define PIPEA_HLINE_INT_EN (1 << 20)
6352 #define PIPEA_VBLANK_INT_EN (1 << 19)
6353 #define SPRITEB_FLIP_DONE_INT_EN (1 << 18)
6354 #define SPRITEA_FLIP_DONE_INT_EN (1 << 17)
6355 #define PLANEA_FLIPDONE_INT_EN (1 << 16)
6356 #define PIPEC_LINE_COMPARE_INT_EN (1 << 13)
6357 #define PIPEC_HLINE_INT_EN (1 << 12)
6358 #define PIPEC_VBLANK_INT_EN (1 << 11)
6359 #define SPRITEF_FLIPDONE_INT_EN (1 << 10)
6360 #define SPRITEE_FLIPDONE_INT_EN (1 << 9)
6361 #define PLANEC_FLIPDONE_INT_EN (1 << 8)
6363 #define DPINVGTT _MMIO(VLV_DISPLAY_BASE + 0x7002c) /* VLV/CHV only */
6364 #define SPRITEF_INVALID_GTT_INT_EN (1 << 27)
6365 #define SPRITEE_INVALID_GTT_INT_EN (1 << 26)
6366 #define PLANEC_INVALID_GTT_INT_EN (1 << 25)
6367 #define CURSORC_INVALID_GTT_INT_EN (1 << 24)
6368 #define CURSORB_INVALID_GTT_INT_EN (1 << 23)
6369 #define CURSORA_INVALID_GTT_INT_EN (1 << 22)
6370 #define SPRITED_INVALID_GTT_INT_EN (1 << 21)
6371 #define SPRITEC_INVALID_GTT_INT_EN (1 << 20)
6372 #define PLANEB_INVALID_GTT_INT_EN (1 << 19)
6373 #define SPRITEB_INVALID_GTT_INT_EN (1 << 18)
6374 #define SPRITEA_INVALID_GTT_INT_EN (1 << 17)
6375 #define PLANEA_INVALID_GTT_INT_EN (1 << 16)
6376 #define DPINVGTT_EN_MASK 0xff0000
6377 #define DPINVGTT_EN_MASK_CHV 0xfff0000
6378 #define SPRITEF_INVALID_GTT_STATUS (1 << 11)
6379 #define SPRITEE_INVALID_GTT_STATUS (1 << 10)
6380 #define PLANEC_INVALID_GTT_STATUS (1 << 9)
6381 #define CURSORC_INVALID_GTT_STATUS (1 << 8)
6382 #define CURSORB_INVALID_GTT_STATUS (1 << 7)
6383 #define CURSORA_INVALID_GTT_STATUS (1 << 6)
6384 #define SPRITED_INVALID_GTT_STATUS (1 << 5)
6385 #define SPRITEC_INVALID_GTT_STATUS (1 << 4)
6386 #define PLANEB_INVALID_GTT_STATUS (1 << 3)
6387 #define SPRITEB_INVALID_GTT_STATUS (1 << 2)
6388 #define SPRITEA_INVALID_GTT_STATUS (1 << 1)
6389 #define PLANEA_INVALID_GTT_STATUS (1 << 0)
6390 #define DPINVGTT_STATUS_MASK 0xff
6391 #define DPINVGTT_STATUS_MASK_CHV 0xfff
6393 #define DSPARB _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70030)
6394 #define DSPARB_CSTART_MASK (0x7f << 7)
6395 #define DSPARB_CSTART_SHIFT 7
6396 #define DSPARB_BSTART_MASK (0x7f)
6397 #define DSPARB_BSTART_SHIFT 0
6398 #define DSPARB_BEND_SHIFT 9 /* on 855 */
6399 #define DSPARB_AEND_SHIFT 0
6400 #define DSPARB_SPRITEA_SHIFT_VLV 0
6401 #define DSPARB_SPRITEA_MASK_VLV (0xff << 0)
6402 #define DSPARB_SPRITEB_SHIFT_VLV 8
6403 #define DSPARB_SPRITEB_MASK_VLV (0xff << 8)
6404 #define DSPARB_SPRITEC_SHIFT_VLV 16
6405 #define DSPARB_SPRITEC_MASK_VLV (0xff << 16)
6406 #define DSPARB_SPRITED_SHIFT_VLV 24
6407 #define DSPARB_SPRITED_MASK_VLV (0xff << 24)
6408 #define DSPARB2 _MMIO(VLV_DISPLAY_BASE + 0x70060) /* vlv/chv */
6409 #define DSPARB_SPRITEA_HI_SHIFT_VLV 0
6410 #define DSPARB_SPRITEA_HI_MASK_VLV (0x1 << 0)
6411 #define DSPARB_SPRITEB_HI_SHIFT_VLV 4
6412 #define DSPARB_SPRITEB_HI_MASK_VLV (0x1 << 4)
6413 #define DSPARB_SPRITEC_HI_SHIFT_VLV 8
6414 #define DSPARB_SPRITEC_HI_MASK_VLV (0x1 << 8)
6415 #define DSPARB_SPRITED_HI_SHIFT_VLV 12
6416 #define DSPARB_SPRITED_HI_MASK_VLV (0x1 << 12)
6417 #define DSPARB_SPRITEE_HI_SHIFT_VLV 16
6418 #define DSPARB_SPRITEE_HI_MASK_VLV (0x1 << 16)
6419 #define DSPARB_SPRITEF_HI_SHIFT_VLV 20
6420 #define DSPARB_SPRITEF_HI_MASK_VLV (0x1 << 20)
6421 #define DSPARB3 _MMIO(VLV_DISPLAY_BASE + 0x7006c) /* chv */
6422 #define DSPARB_SPRITEE_SHIFT_VLV 0
6423 #define DSPARB_SPRITEE_MASK_VLV (0xff << 0)
6424 #define DSPARB_SPRITEF_SHIFT_VLV 8
6425 #define DSPARB_SPRITEF_MASK_VLV (0xff << 8)
6427 /* pnv/gen4/g4x/vlv/chv */
6428 #define DSPFW1 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70034)
6429 #define DSPFW_SR_SHIFT 23
6430 #define DSPFW_SR_MASK (0x1ff << 23)
6431 #define DSPFW_CURSORB_SHIFT 16
6432 #define DSPFW_CURSORB_MASK (0x3f << 16)
6433 #define DSPFW_PLANEB_SHIFT 8
6434 #define DSPFW_PLANEB_MASK (0x7f << 8)
6435 #define DSPFW_PLANEB_MASK_VLV (0xff << 8) /* vlv/chv */
6436 #define DSPFW_PLANEA_SHIFT 0
6437 #define DSPFW_PLANEA_MASK (0x7f << 0)
6438 #define DSPFW_PLANEA_MASK_VLV (0xff << 0) /* vlv/chv */
6439 #define DSPFW2 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70038)
6440 #define DSPFW_FBC_SR_EN (1 << 31) /* g4x */
6441 #define DSPFW_FBC_SR_SHIFT 28
6442 #define DSPFW_FBC_SR_MASK (0x7 << 28) /* g4x */
6443 #define DSPFW_FBC_HPLL_SR_SHIFT 24
6444 #define DSPFW_FBC_HPLL_SR_MASK (0xf << 24) /* g4x */
6445 #define DSPFW_SPRITEB_SHIFT (16)
6446 #define DSPFW_SPRITEB_MASK (0x7f << 16) /* g4x */
6447 #define DSPFW_SPRITEB_MASK_VLV (0xff << 16) /* vlv/chv */
6448 #define DSPFW_CURSORA_SHIFT 8
6449 #define DSPFW_CURSORA_MASK (0x3f << 8)
6450 #define DSPFW_PLANEC_OLD_SHIFT 0
6451 #define DSPFW_PLANEC_OLD_MASK (0x7f << 0) /* pre-gen4 sprite C */
6452 #define DSPFW_SPRITEA_SHIFT 0
6453 #define DSPFW_SPRITEA_MASK (0x7f << 0) /* g4x */
6454 #define DSPFW_SPRITEA_MASK_VLV (0xff << 0) /* vlv/chv */
6455 #define DSPFW3 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x7003c)
6456 #define DSPFW_HPLL_SR_EN (1 << 31)
6457 #define PINEVIEW_SELF_REFRESH_EN (1 << 30)
6458 #define DSPFW_CURSOR_SR_SHIFT 24
6459 #define DSPFW_CURSOR_SR_MASK (0x3f << 24)
6460 #define DSPFW_HPLL_CURSOR_SHIFT 16
6461 #define DSPFW_HPLL_CURSOR_MASK (0x3f << 16)
6462 #define DSPFW_HPLL_SR_SHIFT 0
6463 #define DSPFW_HPLL_SR_MASK (0x1ff << 0)
6466 #define DSPFW4 _MMIO(VLV_DISPLAY_BASE + 0x70070)
6467 #define DSPFW_SPRITEB_WM1_SHIFT 16
6468 #define DSPFW_SPRITEB_WM1_MASK (0xff << 16)
6469 #define DSPFW_CURSORA_WM1_SHIFT 8
6470 #define DSPFW_CURSORA_WM1_MASK (0x3f << 8)
6471 #define DSPFW_SPRITEA_WM1_SHIFT 0
6472 #define DSPFW_SPRITEA_WM1_MASK (0xff << 0)
6473 #define DSPFW5 _MMIO(VLV_DISPLAY_BASE + 0x70074)
6474 #define DSPFW_PLANEB_WM1_SHIFT 24
6475 #define DSPFW_PLANEB_WM1_MASK (0xff << 24)
6476 #define DSPFW_PLANEA_WM1_SHIFT 16
6477 #define DSPFW_PLANEA_WM1_MASK (0xff << 16)
6478 #define DSPFW_CURSORB_WM1_SHIFT 8
6479 #define DSPFW_CURSORB_WM1_MASK (0x3f << 8)
6480 #define DSPFW_CURSOR_SR_WM1_SHIFT 0
6481 #define DSPFW_CURSOR_SR_WM1_MASK (0x3f << 0)
6482 #define DSPFW6 _MMIO(VLV_DISPLAY_BASE + 0x70078)
6483 #define DSPFW_SR_WM1_SHIFT 0
6484 #define DSPFW_SR_WM1_MASK (0x1ff << 0)
6485 #define DSPFW7 _MMIO(VLV_DISPLAY_BASE + 0x7007c)
6486 #define DSPFW7_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b4) /* wtf #1? */
6487 #define DSPFW_SPRITED_WM1_SHIFT 24
6488 #define DSPFW_SPRITED_WM1_MASK (0xff << 24)
6489 #define DSPFW_SPRITED_SHIFT 16
6490 #define DSPFW_SPRITED_MASK_VLV (0xff << 16)
6491 #define DSPFW_SPRITEC_WM1_SHIFT 8
6492 #define DSPFW_SPRITEC_WM1_MASK (0xff << 8)
6493 #define DSPFW_SPRITEC_SHIFT 0
6494 #define DSPFW_SPRITEC_MASK_VLV (0xff << 0)
6495 #define DSPFW8_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b8)
6496 #define DSPFW_SPRITEF_WM1_SHIFT 24
6497 #define DSPFW_SPRITEF_WM1_MASK (0xff << 24)
6498 #define DSPFW_SPRITEF_SHIFT 16
6499 #define DSPFW_SPRITEF_MASK_VLV (0xff << 16)
6500 #define DSPFW_SPRITEE_WM1_SHIFT 8
6501 #define DSPFW_SPRITEE_WM1_MASK (0xff << 8)
6502 #define DSPFW_SPRITEE_SHIFT 0
6503 #define DSPFW_SPRITEE_MASK_VLV (0xff << 0)
6504 #define DSPFW9_CHV _MMIO(VLV_DISPLAY_BASE + 0x7007c) /* wtf #2? */
6505 #define DSPFW_PLANEC_WM1_SHIFT 24
6506 #define DSPFW_PLANEC_WM1_MASK (0xff << 24)
6507 #define DSPFW_PLANEC_SHIFT 16
6508 #define DSPFW_PLANEC_MASK_VLV (0xff << 16)
6509 #define DSPFW_CURSORC_WM1_SHIFT 8
6510 #define DSPFW_CURSORC_WM1_MASK (0x3f << 16)
6511 #define DSPFW_CURSORC_SHIFT 0
6512 #define DSPFW_CURSORC_MASK (0x3f << 0)
6514 /* vlv/chv high order bits */
6515 #define DSPHOWM _MMIO(VLV_DISPLAY_BASE + 0x70064)
6516 #define DSPFW_SR_HI_SHIFT 24
6517 #define DSPFW_SR_HI_MASK (3 << 24) /* 2 bits for chv, 1 for vlv */
6518 #define DSPFW_SPRITEF_HI_SHIFT 23
6519 #define DSPFW_SPRITEF_HI_MASK (1 << 23)
6520 #define DSPFW_SPRITEE_HI_SHIFT 22
6521 #define DSPFW_SPRITEE_HI_MASK (1 << 22)
6522 #define DSPFW_PLANEC_HI_SHIFT 21
6523 #define DSPFW_PLANEC_HI_MASK (1 << 21)
6524 #define DSPFW_SPRITED_HI_SHIFT 20
6525 #define DSPFW_SPRITED_HI_MASK (1 << 20)
6526 #define DSPFW_SPRITEC_HI_SHIFT 16
6527 #define DSPFW_SPRITEC_HI_MASK (1 << 16)
6528 #define DSPFW_PLANEB_HI_SHIFT 12
6529 #define DSPFW_PLANEB_HI_MASK (1 << 12)
6530 #define DSPFW_SPRITEB_HI_SHIFT 8
6531 #define DSPFW_SPRITEB_HI_MASK (1 << 8)
6532 #define DSPFW_SPRITEA_HI_SHIFT 4
6533 #define DSPFW_SPRITEA_HI_MASK (1 << 4)
6534 #define DSPFW_PLANEA_HI_SHIFT 0
6535 #define DSPFW_PLANEA_HI_MASK (1 << 0)
6536 #define DSPHOWM1 _MMIO(VLV_DISPLAY_BASE + 0x70068)
6537 #define DSPFW_SR_WM1_HI_SHIFT 24
6538 #define DSPFW_SR_WM1_HI_MASK (3 << 24) /* 2 bits for chv, 1 for vlv */
6539 #define DSPFW_SPRITEF_WM1_HI_SHIFT 23
6540 #define DSPFW_SPRITEF_WM1_HI_MASK (1 << 23)
6541 #define DSPFW_SPRITEE_WM1_HI_SHIFT 22
6542 #define DSPFW_SPRITEE_WM1_HI_MASK (1 << 22)
6543 #define DSPFW_PLANEC_WM1_HI_SHIFT 21
6544 #define DSPFW_PLANEC_WM1_HI_MASK (1 << 21)
6545 #define DSPFW_SPRITED_WM1_HI_SHIFT 20
6546 #define DSPFW_SPRITED_WM1_HI_MASK (1 << 20)
6547 #define DSPFW_SPRITEC_WM1_HI_SHIFT 16
6548 #define DSPFW_SPRITEC_WM1_HI_MASK (1 << 16)
6549 #define DSPFW_PLANEB_WM1_HI_SHIFT 12
6550 #define DSPFW_PLANEB_WM1_HI_MASK (1 << 12)
6551 #define DSPFW_SPRITEB_WM1_HI_SHIFT 8
6552 #define DSPFW_SPRITEB_WM1_HI_MASK (1 << 8)
6553 #define DSPFW_SPRITEA_WM1_HI_SHIFT 4
6554 #define DSPFW_SPRITEA_WM1_HI_MASK (1 << 4)
6555 #define DSPFW_PLANEA_WM1_HI_SHIFT 0
6556 #define DSPFW_PLANEA_WM1_HI_MASK (1 << 0)
6558 /* drain latency register values*/
6559 #define VLV_DDL(pipe) _MMIO(VLV_DISPLAY_BASE + 0x70050 + 4 * (pipe))
6560 #define DDL_CURSOR_SHIFT 24
6561 #define DDL_SPRITE_SHIFT(sprite) (8 + 8 * (sprite))
6562 #define DDL_PLANE_SHIFT 0
6563 #define DDL_PRECISION_HIGH (1 << 7)
6564 #define DDL_PRECISION_LOW (0 << 7)
6565 #define DRAIN_LATENCY_MASK 0x7f
6567 #define CBR1_VLV _MMIO(VLV_DISPLAY_BASE + 0x70400)
6568 #define CBR_PND_DEADLINE_DISABLE (1 << 31)
6569 #define CBR_PWM_CLOCK_MUX_SELECT (1 << 30)
6571 #define CBR4_VLV _MMIO(VLV_DISPLAY_BASE + 0x70450)
6572 #define CBR_DPLLBMD_PIPE(pipe) (1 << (7 + (pipe) * 11)) /* pipes B and C */
6574 /* FIFO watermark sizes etc */
6575 #define G4X_FIFO_LINE_SIZE 64
6576 #define I915_FIFO_LINE_SIZE 64
6577 #define I830_FIFO_LINE_SIZE 32
6579 #define VALLEYVIEW_FIFO_SIZE 255
6580 #define G4X_FIFO_SIZE 127
6581 #define I965_FIFO_SIZE 512
6582 #define I945_FIFO_SIZE 127
6583 #define I915_FIFO_SIZE 95
6584 #define I855GM_FIFO_SIZE 127 /* In cachelines */
6585 #define I830_FIFO_SIZE 95
6587 #define VALLEYVIEW_MAX_WM 0xff
6588 #define G4X_MAX_WM 0x3f
6589 #define I915_MAX_WM 0x3f
6591 #define PINEVIEW_DISPLAY_FIFO 512 /* in 64byte unit */
6592 #define PINEVIEW_FIFO_LINE_SIZE 64
6593 #define PINEVIEW_MAX_WM 0x1ff
6594 #define PINEVIEW_DFT_WM 0x3f
6595 #define PINEVIEW_DFT_HPLLOFF_WM 0
6596 #define PINEVIEW_GUARD_WM 10
6597 #define PINEVIEW_CURSOR_FIFO 64
6598 #define PINEVIEW_CURSOR_MAX_WM 0x3f
6599 #define PINEVIEW_CURSOR_DFT_WM 0
6600 #define PINEVIEW_CURSOR_GUARD_WM 5
6602 #define VALLEYVIEW_CURSOR_MAX_WM 64
6603 #define I965_CURSOR_FIFO 64
6604 #define I965_CURSOR_MAX_WM 32
6605 #define I965_CURSOR_DFT_WM 8
6607 /* Watermark register definitions for SKL */
6608 #define _CUR_WM_A_0 0x70140
6609 #define _CUR_WM_B_0 0x71140
6610 #define _CUR_WM_SAGV_A 0x70158
6611 #define _CUR_WM_SAGV_B 0x71158
6612 #define _CUR_WM_SAGV_TRANS_A 0x7015C
6613 #define _CUR_WM_SAGV_TRANS_B 0x7115C
6614 #define _CUR_WM_TRANS_A 0x70168
6615 #define _CUR_WM_TRANS_B 0x71168
6616 #define _PLANE_WM_1_A_0 0x70240
6617 #define _PLANE_WM_1_B_0 0x71240
6618 #define _PLANE_WM_2_A_0 0x70340
6619 #define _PLANE_WM_2_B_0 0x71340
6620 #define _PLANE_WM_SAGV_1_A 0x70258
6621 #define _PLANE_WM_SAGV_1_B 0x71258
6622 #define _PLANE_WM_SAGV_2_A 0x70358
6623 #define _PLANE_WM_SAGV_2_B 0x71358
6624 #define _PLANE_WM_SAGV_TRANS_1_A 0x7025C
6625 #define _PLANE_WM_SAGV_TRANS_1_B 0x7125C
6626 #define _PLANE_WM_SAGV_TRANS_2_A 0x7035C
6627 #define _PLANE_WM_SAGV_TRANS_2_B 0x7135C
6628 #define _PLANE_WM_TRANS_1_A 0x70268
6629 #define _PLANE_WM_TRANS_1_B 0x71268
6630 #define _PLANE_WM_TRANS_2_A 0x70368
6631 #define _PLANE_WM_TRANS_2_B 0x71368
6632 #define PLANE_WM_EN (1 << 31)
6633 #define PLANE_WM_IGNORE_LINES (1 << 30)
6634 #define PLANE_WM_LINES_MASK REG_GENMASK(26, 14)
6635 #define PLANE_WM_BLOCKS_MASK REG_GENMASK(11, 0)
6637 #define _CUR_WM_0(pipe) _PIPE(pipe, _CUR_WM_A_0, _CUR_WM_B_0)
6638 #define CUR_WM(pipe, level) _MMIO(_CUR_WM_0(pipe) + ((4) * (level)))
6639 #define CUR_WM_SAGV(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_A, _CUR_WM_SAGV_B)
6640 #define CUR_WM_SAGV_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_TRANS_A, _CUR_WM_SAGV_TRANS_B)
6641 #define CUR_WM_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_TRANS_A, _CUR_WM_TRANS_B)
6642 #define _PLANE_WM_1(pipe) _PIPE(pipe, _PLANE_WM_1_A_0, _PLANE_WM_1_B_0)
6643 #define _PLANE_WM_2(pipe) _PIPE(pipe, _PLANE_WM_2_A_0, _PLANE_WM_2_B_0)
6644 #define _PLANE_WM_BASE(pipe, plane) \
6645 _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe))
6646 #define PLANE_WM(pipe, plane, level) \
6647 _MMIO(_PLANE_WM_BASE(pipe, plane) + ((4) * (level)))
6648 #define _PLANE_WM_SAGV_1(pipe) \
6649 _PIPE(pipe, _PLANE_WM_SAGV_1_A, _PLANE_WM_SAGV_1_B)
6650 #define _PLANE_WM_SAGV_2(pipe) \
6651 _PIPE(pipe, _PLANE_WM_SAGV_2_A, _PLANE_WM_SAGV_2_B)
6652 #define PLANE_WM_SAGV(pipe, plane) \
6653 _MMIO(_PLANE(plane, _PLANE_WM_SAGV_1(pipe), _PLANE_WM_SAGV_2(pipe)))
6654 #define _PLANE_WM_SAGV_TRANS_1(pipe) \
6655 _PIPE(pipe, _PLANE_WM_SAGV_TRANS_1_A, _PLANE_WM_SAGV_TRANS_1_B)
6656 #define _PLANE_WM_SAGV_TRANS_2(pipe) \
6657 _PIPE(pipe, _PLANE_WM_SAGV_TRANS_2_A, _PLANE_WM_SAGV_TRANS_2_B)
6658 #define PLANE_WM_SAGV_TRANS(pipe, plane) \
6659 _MMIO(_PLANE(plane, _PLANE_WM_SAGV_TRANS_1(pipe), _PLANE_WM_SAGV_TRANS_2(pipe)))
6660 #define _PLANE_WM_TRANS_1(pipe) \
6661 _PIPE(pipe, _PLANE_WM_TRANS_1_A, _PLANE_WM_TRANS_1_B)
6662 #define _PLANE_WM_TRANS_2(pipe) \
6663 _PIPE(pipe, _PLANE_WM_TRANS_2_A, _PLANE_WM_TRANS_2_B)
6664 #define PLANE_WM_TRANS(pipe, plane) \
6665 _MMIO(_PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)))
6667 /* define the Watermark register on Ironlake */
6668 #define _WM0_PIPEA_ILK 0x45100
6669 #define _WM0_PIPEB_ILK 0x45104
6670 #define _WM0_PIPEC_IVB 0x45200
6671 #define WM0_PIPE_ILK(pipe) _MMIO_PIPE3((pipe), _WM0_PIPEA_ILK, \
6672 _WM0_PIPEB_ILK, _WM0_PIPEC_IVB)
6673 #define WM0_PIPE_PLANE_MASK (0xffff << 16)
6674 #define WM0_PIPE_PLANE_SHIFT 16
6675 #define WM0_PIPE_SPRITE_MASK (0xff << 8)
6676 #define WM0_PIPE_SPRITE_SHIFT 8
6677 #define WM0_PIPE_CURSOR_MASK (0xff)
6678 #define WM1_LP_ILK _MMIO(0x45108)
6679 #define WM1_LP_SR_EN (1 << 31)
6680 #define WM1_LP_LATENCY_SHIFT 24
6681 #define WM1_LP_LATENCY_MASK (0x7f << 24)
6682 #define WM1_LP_FBC_MASK (0xf << 20)
6683 #define WM1_LP_FBC_SHIFT 20
6684 #define WM1_LP_FBC_SHIFT_BDW 19
6685 #define WM1_LP_SR_MASK (0x7ff << 8)
6686 #define WM1_LP_SR_SHIFT 8
6687 #define WM1_LP_CURSOR_MASK (0xff)
6688 #define WM2_LP_ILK _MMIO(0x4510c)
6689 #define WM2_LP_EN (1 << 31)
6690 #define WM3_LP_ILK _MMIO(0x45110)
6691 #define WM3_LP_EN (1 << 31)
6692 #define WM1S_LP_ILK _MMIO(0x45120)
6693 #define WM2S_LP_IVB _MMIO(0x45124)
6694 #define WM3S_LP_IVB _MMIO(0x45128)
6695 #define WM1S_LP_EN (1 << 31)
6697 #define HSW_WM_LP_VAL(lat, fbc, pri, cur) \
6698 (WM3_LP_EN | ((lat) << WM1_LP_LATENCY_SHIFT) | \
6699 ((fbc) << WM1_LP_FBC_SHIFT) | ((pri) << WM1_LP_SR_SHIFT) | (cur))
6701 /* Memory latency timer register */
6702 #define MLTR_ILK _MMIO(0x11222)
6703 #define MLTR_WM1_SHIFT 0
6704 #define MLTR_WM2_SHIFT 8
6705 /* the unit of memory self-refresh latency time is 0.5us */
6706 #define ILK_SRLT_MASK 0x3f
6709 /* the address where we get all kinds of latency value */
6710 #define SSKPD _MMIO(0x5d10)
6711 #define SSKPD_WM_MASK 0x3f
6712 #define SSKPD_WM0_SHIFT 0
6713 #define SSKPD_WM1_SHIFT 8
6714 #define SSKPD_WM2_SHIFT 16
6715 #define SSKPD_WM3_SHIFT 24
6718 * The two pipe frame counter registers are not synchronized, so
6719 * reading a stable value is somewhat tricky. The following code
6723 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
6724 * PIPE_FRAME_HIGH_SHIFT;
6725 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
6726 * PIPE_FRAME_LOW_SHIFT);
6727 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
6728 * PIPE_FRAME_HIGH_SHIFT);
6729 * } while (high1 != high2);
6730 * frame = (high1 << 8) | low1;
6732 #define _PIPEAFRAMEHIGH 0x70040
6733 #define PIPE_FRAME_HIGH_MASK 0x0000ffff
6734 #define PIPE_FRAME_HIGH_SHIFT 0
6735 #define _PIPEAFRAMEPIXEL 0x70044
6736 #define PIPE_FRAME_LOW_MASK 0xff000000
6737 #define PIPE_FRAME_LOW_SHIFT 24
6738 #define PIPE_PIXEL_MASK 0x00ffffff
6739 #define PIPE_PIXEL_SHIFT 0
6740 /* GM45+ just has to be different */
6741 #define _PIPEA_FRMCOUNT_G4X 0x70040
6742 #define _PIPEA_FLIPCOUNT_G4X 0x70044
6743 #define PIPE_FRMCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FRMCOUNT_G4X)
6744 #define PIPE_FLIPCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FLIPCOUNT_G4X)
6746 /* Cursor A & B regs */
6747 #define _CURACNTR 0x70080
6748 /* Old style CUR*CNTR flags (desktop 8xx) */
6749 #define CURSOR_ENABLE 0x80000000
6750 #define CURSOR_GAMMA_ENABLE 0x40000000
6751 #define CURSOR_STRIDE_SHIFT 28
6752 #define CURSOR_STRIDE(x) ((ffs(x) - 9) << CURSOR_STRIDE_SHIFT) /* 256,512,1k,2k */
6753 #define CURSOR_FORMAT_SHIFT 24
6754 #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
6755 #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
6756 #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
6757 #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
6758 #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
6759 #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
6760 /* New style CUR*CNTR flags */
6761 #define MCURSOR_MODE 0x27
6762 #define MCURSOR_MODE_DISABLE 0x00
6763 #define MCURSOR_MODE_128_32B_AX 0x02
6764 #define MCURSOR_MODE_256_32B_AX 0x03
6765 #define MCURSOR_MODE_64_32B_AX 0x07
6766 #define MCURSOR_MODE_128_ARGB_AX ((1 << 5) | MCURSOR_MODE_128_32B_AX)
6767 #define MCURSOR_MODE_256_ARGB_AX ((1 << 5) | MCURSOR_MODE_256_32B_AX)
6768 #define MCURSOR_MODE_64_ARGB_AX ((1 << 5) | MCURSOR_MODE_64_32B_AX)
6769 #define MCURSOR_ARB_SLOTS_MASK REG_GENMASK(30, 28) /* icl+ */
6770 #define MCURSOR_ARB_SLOTS(x) REG_FIELD_PREP(MCURSOR_ARB_SLOTS_MASK, (x)) /* icl+ */
6771 #define MCURSOR_PIPE_SELECT_MASK (0x3 << 28)
6772 #define MCURSOR_PIPE_SELECT_SHIFT 28
6773 #define MCURSOR_PIPE_SELECT(pipe) ((pipe) << 28)
6774 #define MCURSOR_GAMMA_ENABLE (1 << 26)
6775 #define MCURSOR_PIPE_CSC_ENABLE (1 << 24) /* ilk+ */
6776 #define MCURSOR_ROTATE_180 (1 << 15)
6777 #define MCURSOR_TRICKLE_FEED_DISABLE (1 << 14)
6778 #define _CURABASE 0x70084
6779 #define _CURAPOS 0x70088
6780 #define CURSOR_POS_MASK 0x007FF
6781 #define CURSOR_POS_SIGN 0x8000
6782 #define CURSOR_X_SHIFT 0
6783 #define CURSOR_Y_SHIFT 16
6784 #define CURSIZE _MMIO(0x700a0) /* 845/865 */
6785 #define _CUR_FBC_CTL_A 0x700a0 /* ivb+ */
6786 #define CUR_FBC_CTL_EN (1 << 31)
6787 #define _CURASURFLIVE 0x700ac /* g4x+ */
6788 #define _CURBCNTR 0x700c0
6789 #define _CURBBASE 0x700c4
6790 #define _CURBPOS 0x700c8
6792 #define _CURBCNTR_IVB 0x71080
6793 #define _CURBBASE_IVB 0x71084
6794 #define _CURBPOS_IVB 0x71088
6796 #define CURCNTR(pipe) _CURSOR2(pipe, _CURACNTR)
6797 #define CURBASE(pipe) _CURSOR2(pipe, _CURABASE)
6798 #define CURPOS(pipe) _CURSOR2(pipe, _CURAPOS)
6799 #define CUR_FBC_CTL(pipe) _CURSOR2(pipe, _CUR_FBC_CTL_A)
6800 #define CURSURFLIVE(pipe) _CURSOR2(pipe, _CURASURFLIVE)
6802 #define CURSOR_A_OFFSET 0x70080
6803 #define CURSOR_B_OFFSET 0x700c0
6804 #define CHV_CURSOR_C_OFFSET 0x700e0
6805 #define IVB_CURSOR_B_OFFSET 0x71080
6806 #define IVB_CURSOR_C_OFFSET 0x72080
6807 #define TGL_CURSOR_D_OFFSET 0x73080
6809 /* Display A control */
6810 #define _DSPAADDR_VLV 0x7017C /* vlv/chv */
6811 #define _DSPACNTR 0x70180
6812 #define DISPLAY_PLANE_ENABLE (1 << 31)
6813 #define DISPLAY_PLANE_DISABLE 0
6814 #define DISPPLANE_GAMMA_ENABLE (1 << 30)
6815 #define DISPPLANE_GAMMA_DISABLE 0
6816 #define DISPPLANE_PIXFORMAT_MASK (0xf << 26)
6817 #define DISPPLANE_YUV422 (0x0 << 26)
6818 #define DISPPLANE_8BPP (0x2 << 26)
6819 #define DISPPLANE_BGRA555 (0x3 << 26)
6820 #define DISPPLANE_BGRX555 (0x4 << 26)
6821 #define DISPPLANE_BGRX565 (0x5 << 26)
6822 #define DISPPLANE_BGRX888 (0x6 << 26)
6823 #define DISPPLANE_BGRA888 (0x7 << 26)
6824 #define DISPPLANE_RGBX101010 (0x8 << 26)
6825 #define DISPPLANE_RGBA101010 (0x9 << 26)
6826 #define DISPPLANE_BGRX101010 (0xa << 26)
6827 #define DISPPLANE_BGRA101010 (0xb << 26)
6828 #define DISPPLANE_RGBX161616 (0xc << 26)
6829 #define DISPPLANE_RGBX888 (0xe << 26)
6830 #define DISPPLANE_RGBA888 (0xf << 26)
6831 #define DISPPLANE_STEREO_ENABLE (1 << 25)
6832 #define DISPPLANE_STEREO_DISABLE 0
6833 #define DISPPLANE_PIPE_CSC_ENABLE (1 << 24) /* ilk+ */
6834 #define DISPPLANE_SEL_PIPE_SHIFT 24
6835 #define DISPPLANE_SEL_PIPE_MASK (3 << DISPPLANE_SEL_PIPE_SHIFT)
6836 #define DISPPLANE_SEL_PIPE(pipe) ((pipe) << DISPPLANE_SEL_PIPE_SHIFT)
6837 #define DISPPLANE_SRC_KEY_ENABLE (1 << 22)
6838 #define DISPPLANE_SRC_KEY_DISABLE 0
6839 #define DISPPLANE_LINE_DOUBLE (1 << 20)
6840 #define DISPPLANE_NO_LINE_DOUBLE 0
6841 #define DISPPLANE_STEREO_POLARITY_FIRST 0
6842 #define DISPPLANE_STEREO_POLARITY_SECOND (1 << 18)
6843 #define DISPPLANE_ALPHA_PREMULTIPLY (1 << 16) /* CHV pipe B */
6844 #define DISPPLANE_ROTATE_180 (1 << 15)
6845 #define DISPPLANE_TRICKLE_FEED_DISABLE (1 << 14) /* Ironlake */
6846 #define DISPPLANE_TILED (1 << 10)
6847 #define DISPPLANE_ASYNC_FLIP (1 << 9) /* g4x+ */
6848 #define DISPPLANE_MIRROR (1 << 8) /* CHV pipe B */
6849 #define _DSPAADDR 0x70184
6850 #define _DSPASTRIDE 0x70188
6851 #define _DSPAPOS 0x7018C /* reserved */
6852 #define _DSPASIZE 0x70190
6853 #define _DSPASURF 0x7019C /* 965+ only */
6854 #define _DSPATILEOFF 0x701A4 /* 965+ only */
6855 #define _DSPAOFFSET 0x701A4 /* HSW */
6856 #define _DSPASURFLIVE 0x701AC
6857 #define _DSPAGAMC 0x701E0
6859 #define DSPADDR_VLV(plane) _MMIO_PIPE2(plane, _DSPAADDR_VLV)
6860 #define DSPCNTR(plane) _MMIO_PIPE2(plane, _DSPACNTR)
6861 #define DSPADDR(plane) _MMIO_PIPE2(plane, _DSPAADDR)
6862 #define DSPSTRIDE(plane) _MMIO_PIPE2(plane, _DSPASTRIDE)
6863 #define DSPPOS(plane) _MMIO_PIPE2(plane, _DSPAPOS)
6864 #define DSPSIZE(plane) _MMIO_PIPE2(plane, _DSPASIZE)
6865 #define DSPSURF(plane) _MMIO_PIPE2(plane, _DSPASURF)
6866 #define DSPTILEOFF(plane) _MMIO_PIPE2(plane, _DSPATILEOFF)
6867 #define DSPLINOFF(plane) DSPADDR(plane)
6868 #define DSPOFFSET(plane) _MMIO_PIPE2(plane, _DSPAOFFSET)
6869 #define DSPSURFLIVE(plane) _MMIO_PIPE2(plane, _DSPASURFLIVE)
6870 #define DSPGAMC(plane, i) _MMIO(_PIPE2(plane, _DSPAGAMC) + (5 - (i)) * 4) /* plane C only, 6 x u0.8 */
6872 /* CHV pipe B blender and primary plane */
6873 #define _CHV_BLEND_A 0x60a00
6874 #define CHV_BLEND_LEGACY (0 << 30)
6875 #define CHV_BLEND_ANDROID (1 << 30)
6876 #define CHV_BLEND_MPO (2 << 30)
6877 #define CHV_BLEND_MASK (3 << 30)
6878 #define _CHV_CANVAS_A 0x60a04
6879 #define _PRIMPOS_A 0x60a08
6880 #define _PRIMSIZE_A 0x60a0c
6881 #define _PRIMCNSTALPHA_A 0x60a10
6882 #define PRIM_CONST_ALPHA_ENABLE (1 << 31)
6884 #define CHV_BLEND(pipe) _MMIO_TRANS2(pipe, _CHV_BLEND_A)
6885 #define CHV_CANVAS(pipe) _MMIO_TRANS2(pipe, _CHV_CANVAS_A)
6886 #define PRIMPOS(plane) _MMIO_TRANS2(plane, _PRIMPOS_A)
6887 #define PRIMSIZE(plane) _MMIO_TRANS2(plane, _PRIMSIZE_A)
6888 #define PRIMCNSTALPHA(plane) _MMIO_TRANS2(plane, _PRIMCNSTALPHA_A)
6890 /* Display/Sprite base address macros */
6891 #define DISP_BASEADDR_MASK (0xfffff000)
6892 #define I915_LO_DISPBASE(val) ((val) & ~DISP_BASEADDR_MASK)
6893 #define I915_HI_DISPBASE(val) ((val) & DISP_BASEADDR_MASK)
6906 #define SWF0(i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70410 + (i) * 4)
6907 #define SWF1(i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x71410 + (i) * 4)
6908 #define SWF3(i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x72414 + (i) * 4)
6909 #define SWF_ILK(i) _MMIO(0x4F000 + (i) * 4)
6912 #define _PIPEBDSL (DISPLAY_MMIO_BASE(dev_priv) + 0x71000)
6913 #define _PIPEBCONF (DISPLAY_MMIO_BASE(dev_priv) + 0x71008)
6914 #define _PIPEBSTAT (DISPLAY_MMIO_BASE(dev_priv) + 0x71024)
6915 #define _PIPEBFRAMEHIGH 0x71040
6916 #define _PIPEBFRAMEPIXEL 0x71044
6917 #define _PIPEB_FRMCOUNT_G4X (DISPLAY_MMIO_BASE(dev_priv) + 0x71040)
6918 #define _PIPEB_FLIPCOUNT_G4X (DISPLAY_MMIO_BASE(dev_priv) + 0x71044)
6921 /* Display B control */
6922 #define _DSPBCNTR (DISPLAY_MMIO_BASE(dev_priv) + 0x71180)
6923 #define DISPPLANE_ALPHA_TRANS_ENABLE (1 << 15)
6924 #define DISPPLANE_ALPHA_TRANS_DISABLE 0
6925 #define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
6926 #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
6927 #define _DSPBADDR (DISPLAY_MMIO_BASE(dev_priv) + 0x71184)
6928 #define _DSPBSTRIDE (DISPLAY_MMIO_BASE(dev_priv) + 0x71188)
6929 #define _DSPBPOS (DISPLAY_MMIO_BASE(dev_priv) + 0x7118C)
6930 #define _DSPBSIZE (DISPLAY_MMIO_BASE(dev_priv) + 0x71190)
6931 #define _DSPBSURF (DISPLAY_MMIO_BASE(dev_priv) + 0x7119C)
6932 #define _DSPBTILEOFF (DISPLAY_MMIO_BASE(dev_priv) + 0x711A4)
6933 #define _DSPBOFFSET (DISPLAY_MMIO_BASE(dev_priv) + 0x711A4)
6934 #define _DSPBSURFLIVE (DISPLAY_MMIO_BASE(dev_priv) + 0x711AC)
6936 /* ICL DSI 0 and 1 */
6937 #define _PIPEDSI0CONF 0x7b008
6938 #define _PIPEDSI1CONF 0x7b808
6940 /* Sprite A control */
6941 #define _DVSACNTR 0x72180
6942 #define DVS_ENABLE (1 << 31)
6943 #define DVS_GAMMA_ENABLE (1 << 30)
6944 #define DVS_YUV_RANGE_CORRECTION_DISABLE (1 << 27)
6945 #define DVS_PIXFORMAT_MASK (3 << 25)
6946 #define DVS_FORMAT_YUV422 (0 << 25)
6947 #define DVS_FORMAT_RGBX101010 (1 << 25)
6948 #define DVS_FORMAT_RGBX888 (2 << 25)
6949 #define DVS_FORMAT_RGBX161616 (3 << 25)
6950 #define DVS_PIPE_CSC_ENABLE (1 << 24)
6951 #define DVS_SOURCE_KEY (1 << 22)
6952 #define DVS_RGB_ORDER_XBGR (1 << 20)
6953 #define DVS_YUV_FORMAT_BT709 (1 << 18)
6954 #define DVS_YUV_BYTE_ORDER_MASK (3 << 16)
6955 #define DVS_YUV_ORDER_YUYV (0 << 16)
6956 #define DVS_YUV_ORDER_UYVY (1 << 16)
6957 #define DVS_YUV_ORDER_YVYU (2 << 16)
6958 #define DVS_YUV_ORDER_VYUY (3 << 16)
6959 #define DVS_ROTATE_180 (1 << 15)
6960 #define DVS_DEST_KEY (1 << 2)
6961 #define DVS_TRICKLE_FEED_DISABLE (1 << 14)
6962 #define DVS_TILED (1 << 10)
6963 #define _DVSALINOFF 0x72184
6964 #define _DVSASTRIDE 0x72188
6965 #define _DVSAPOS 0x7218c
6966 #define _DVSASIZE 0x72190
6967 #define _DVSAKEYVAL 0x72194
6968 #define _DVSAKEYMSK 0x72198
6969 #define _DVSASURF 0x7219c
6970 #define _DVSAKEYMAXVAL 0x721a0
6971 #define _DVSATILEOFF 0x721a4
6972 #define _DVSASURFLIVE 0x721ac
6973 #define _DVSAGAMC_G4X 0x721e0 /* g4x */
6974 #define _DVSASCALE 0x72204
6975 #define DVS_SCALE_ENABLE (1 << 31)
6976 #define DVS_FILTER_MASK (3 << 29)
6977 #define DVS_FILTER_MEDIUM (0 << 29)
6978 #define DVS_FILTER_ENHANCING (1 << 29)
6979 #define DVS_FILTER_SOFTENING (2 << 29)
6980 #define DVS_VERTICAL_OFFSET_HALF (1 << 28) /* must be enabled below */
6981 #define DVS_VERTICAL_OFFSET_ENABLE (1 << 27)
6982 #define _DVSAGAMC_ILK 0x72300 /* ilk/snb */
6983 #define _DVSAGAMCMAX_ILK 0x72340 /* ilk/snb */
6985 #define _DVSBCNTR 0x73180
6986 #define _DVSBLINOFF 0x73184
6987 #define _DVSBSTRIDE 0x73188
6988 #define _DVSBPOS 0x7318c
6989 #define _DVSBSIZE 0x73190
6990 #define _DVSBKEYVAL 0x73194
6991 #define _DVSBKEYMSK 0x73198
6992 #define _DVSBSURF 0x7319c
6993 #define _DVSBKEYMAXVAL 0x731a0
6994 #define _DVSBTILEOFF 0x731a4
6995 #define _DVSBSURFLIVE 0x731ac
6996 #define _DVSBGAMC_G4X 0x731e0 /* g4x */
6997 #define _DVSBSCALE 0x73204
6998 #define _DVSBGAMC_ILK 0x73300 /* ilk/snb */
6999 #define _DVSBGAMCMAX_ILK 0x73340 /* ilk/snb */
7001 #define DVSCNTR(pipe) _MMIO_PIPE(pipe, _DVSACNTR, _DVSBCNTR)
7002 #define DVSLINOFF(pipe) _MMIO_PIPE(pipe, _DVSALINOFF, _DVSBLINOFF)
7003 #define DVSSTRIDE(pipe) _MMIO_PIPE(pipe, _DVSASTRIDE, _DVSBSTRIDE)
7004 #define DVSPOS(pipe) _MMIO_PIPE(pipe, _DVSAPOS, _DVSBPOS)
7005 #define DVSSURF(pipe) _MMIO_PIPE(pipe, _DVSASURF, _DVSBSURF)
7006 #define DVSKEYMAX(pipe) _MMIO_PIPE(pipe, _DVSAKEYMAXVAL, _DVSBKEYMAXVAL)
7007 #define DVSSIZE(pipe) _MMIO_PIPE(pipe, _DVSASIZE, _DVSBSIZE)
7008 #define DVSSCALE(pipe) _MMIO_PIPE(pipe, _DVSASCALE, _DVSBSCALE)
7009 #define DVSTILEOFF(pipe) _MMIO_PIPE(pipe, _DVSATILEOFF, _DVSBTILEOFF)
7010 #define DVSKEYVAL(pipe) _MMIO_PIPE(pipe, _DVSAKEYVAL, _DVSBKEYVAL)
7011 #define DVSKEYMSK(pipe) _MMIO_PIPE(pipe, _DVSAKEYMSK, _DVSBKEYMSK)
7012 #define DVSSURFLIVE(pipe) _MMIO_PIPE(pipe, _DVSASURFLIVE, _DVSBSURFLIVE)
7013 #define DVSGAMC_G4X(pipe, i) _MMIO(_PIPE(pipe, _DVSAGAMC_G4X, _DVSBGAMC_G4X) + (5 - (i)) * 4) /* 6 x u0.8 */
7014 #define DVSGAMC_ILK(pipe, i) _MMIO(_PIPE(pipe, _DVSAGAMC_ILK, _DVSBGAMC_ILK) + (i) * 4) /* 16 x u0.10 */
7015 #define DVSGAMCMAX_ILK(pipe, i) _MMIO(_PIPE(pipe, _DVSAGAMCMAX_ILK, _DVSBGAMCMAX_ILK) + (i) * 4) /* 3 x u1.10 */
7017 #define _SPRA_CTL 0x70280
7018 #define SPRITE_ENABLE (1 << 31)
7019 #define SPRITE_GAMMA_ENABLE (1 << 30)
7020 #define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
7021 #define SPRITE_PIXFORMAT_MASK (7 << 25)
7022 #define SPRITE_FORMAT_YUV422 (0 << 25)
7023 #define SPRITE_FORMAT_RGBX101010 (1 << 25)
7024 #define SPRITE_FORMAT_RGBX888 (2 << 25)
7025 #define SPRITE_FORMAT_RGBX161616 (3 << 25)
7026 #define SPRITE_FORMAT_YUV444 (4 << 25)
7027 #define SPRITE_FORMAT_XR_BGR101010 (5 << 25) /* Extended range */
7028 #define SPRITE_PIPE_CSC_ENABLE (1 << 24)
7029 #define SPRITE_SOURCE_KEY (1 << 22)
7030 #define SPRITE_RGB_ORDER_RGBX (1 << 20) /* only for 888 and 161616 */
7031 #define SPRITE_YUV_TO_RGB_CSC_DISABLE (1 << 19)
7032 #define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1 << 18) /* 0 is BT601 */
7033 #define SPRITE_YUV_BYTE_ORDER_MASK (3 << 16)
7034 #define SPRITE_YUV_ORDER_YUYV (0 << 16)
7035 #define SPRITE_YUV_ORDER_UYVY (1 << 16)
7036 #define SPRITE_YUV_ORDER_YVYU (2 << 16)
7037 #define SPRITE_YUV_ORDER_VYUY (3 << 16)
7038 #define SPRITE_ROTATE_180 (1 << 15)
7039 #define SPRITE_TRICKLE_FEED_DISABLE (1 << 14)
7040 #define SPRITE_INT_GAMMA_DISABLE (1 << 13)
7041 #define SPRITE_TILED (1 << 10)
7042 #define SPRITE_DEST_KEY (1 << 2)
7043 #define _SPRA_LINOFF 0x70284
7044 #define _SPRA_STRIDE 0x70288
7045 #define _SPRA_POS 0x7028c
7046 #define _SPRA_SIZE 0x70290
7047 #define _SPRA_KEYVAL 0x70294
7048 #define _SPRA_KEYMSK 0x70298
7049 #define _SPRA_SURF 0x7029c
7050 #define _SPRA_KEYMAX 0x702a0
7051 #define _SPRA_TILEOFF 0x702a4
7052 #define _SPRA_OFFSET 0x702a4
7053 #define _SPRA_SURFLIVE 0x702ac
7054 #define _SPRA_SCALE 0x70304
7055 #define SPRITE_SCALE_ENABLE (1 << 31)
7056 #define SPRITE_FILTER_MASK (3 << 29)
7057 #define SPRITE_FILTER_MEDIUM (0 << 29)
7058 #define SPRITE_FILTER_ENHANCING (1 << 29)
7059 #define SPRITE_FILTER_SOFTENING (2 << 29)
7060 #define SPRITE_VERTICAL_OFFSET_HALF (1 << 28) /* must be enabled below */
7061 #define SPRITE_VERTICAL_OFFSET_ENABLE (1 << 27)
7062 #define _SPRA_GAMC 0x70400
7063 #define _SPRA_GAMC16 0x70440
7064 #define _SPRA_GAMC17 0x7044c
7066 #define _SPRB_CTL 0x71280
7067 #define _SPRB_LINOFF 0x71284
7068 #define _SPRB_STRIDE 0x71288
7069 #define _SPRB_POS 0x7128c
7070 #define _SPRB_SIZE 0x71290
7071 #define _SPRB_KEYVAL 0x71294
7072 #define _SPRB_KEYMSK 0x71298
7073 #define _SPRB_SURF 0x7129c
7074 #define _SPRB_KEYMAX 0x712a0
7075 #define _SPRB_TILEOFF 0x712a4
7076 #define _SPRB_OFFSET 0x712a4
7077 #define _SPRB_SURFLIVE 0x712ac
7078 #define _SPRB_SCALE 0x71304
7079 #define _SPRB_GAMC 0x71400
7080 #define _SPRB_GAMC16 0x71440
7081 #define _SPRB_GAMC17 0x7144c
7083 #define SPRCTL(pipe) _MMIO_PIPE(pipe, _SPRA_CTL, _SPRB_CTL)
7084 #define SPRLINOFF(pipe) _MMIO_PIPE(pipe, _SPRA_LINOFF, _SPRB_LINOFF)
7085 #define SPRSTRIDE(pipe) _MMIO_PIPE(pipe, _SPRA_STRIDE, _SPRB_STRIDE)
7086 #define SPRPOS(pipe) _MMIO_PIPE(pipe, _SPRA_POS, _SPRB_POS)
7087 #define SPRSIZE(pipe) _MMIO_PIPE(pipe, _SPRA_SIZE, _SPRB_SIZE)
7088 #define SPRKEYVAL(pipe) _MMIO_PIPE(pipe, _SPRA_KEYVAL, _SPRB_KEYVAL)
7089 #define SPRKEYMSK(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMSK, _SPRB_KEYMSK)
7090 #define SPRSURF(pipe) _MMIO_PIPE(pipe, _SPRA_SURF, _SPRB_SURF)
7091 #define SPRKEYMAX(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMAX, _SPRB_KEYMAX)
7092 #define SPRTILEOFF(pipe) _MMIO_PIPE(pipe, _SPRA_TILEOFF, _SPRB_TILEOFF)
7093 #define SPROFFSET(pipe) _MMIO_PIPE(pipe, _SPRA_OFFSET, _SPRB_OFFSET)
7094 #define SPRSCALE(pipe) _MMIO_PIPE(pipe, _SPRA_SCALE, _SPRB_SCALE)
7095 #define SPRGAMC(pipe, i) _MMIO(_PIPE(pipe, _SPRA_GAMC, _SPRB_GAMC) + (i) * 4) /* 16 x u0.10 */
7096 #define SPRGAMC16(pipe, i) _MMIO(_PIPE(pipe, _SPRA_GAMC16, _SPRB_GAMC16) + (i) * 4) /* 3 x u1.10 */
7097 #define SPRGAMC17(pipe, i) _MMIO(_PIPE(pipe, _SPRA_GAMC17, _SPRB_GAMC17) + (i) * 4) /* 3 x u2.10 */
7098 #define SPRSURFLIVE(pipe) _MMIO_PIPE(pipe, _SPRA_SURFLIVE, _SPRB_SURFLIVE)
7100 #define _SPACNTR (VLV_DISPLAY_BASE + 0x72180)
7101 #define SP_ENABLE (1 << 31)
7102 #define SP_GAMMA_ENABLE (1 << 30)
7103 #define SP_PIXFORMAT_MASK (0xf << 26)
7104 #define SP_FORMAT_YUV422 (0x0 << 26)
7105 #define SP_FORMAT_8BPP (0x2 << 26)
7106 #define SP_FORMAT_BGR565 (0x5 << 26)
7107 #define SP_FORMAT_BGRX8888 (0x6 << 26)
7108 #define SP_FORMAT_BGRA8888 (0x7 << 26)
7109 #define SP_FORMAT_RGBX1010102 (0x8 << 26)
7110 #define SP_FORMAT_RGBA1010102 (0x9 << 26)
7111 #define SP_FORMAT_BGRX1010102 (0xa << 26) /* CHV pipe B */
7112 #define SP_FORMAT_BGRA1010102 (0xb << 26) /* CHV pipe B */
7113 #define SP_FORMAT_RGBX8888 (0xe << 26)
7114 #define SP_FORMAT_RGBA8888 (0xf << 26)
7115 #define SP_ALPHA_PREMULTIPLY (1 << 23) /* CHV pipe B */
7116 #define SP_SOURCE_KEY (1 << 22)
7117 #define SP_YUV_FORMAT_BT709 (1 << 18)
7118 #define SP_YUV_BYTE_ORDER_MASK (3 << 16)
7119 #define SP_YUV_ORDER_YUYV (0 << 16)
7120 #define SP_YUV_ORDER_UYVY (1 << 16)
7121 #define SP_YUV_ORDER_YVYU (2 << 16)
7122 #define SP_YUV_ORDER_VYUY (3 << 16)
7123 #define SP_ROTATE_180 (1 << 15)
7124 #define SP_TILED (1 << 10)
7125 #define SP_MIRROR (1 << 8) /* CHV pipe B */
7126 #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184)
7127 #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188)
7128 #define _SPAPOS (VLV_DISPLAY_BASE + 0x7218c)
7129 #define _SPASIZE (VLV_DISPLAY_BASE + 0x72190)
7130 #define _SPAKEYMINVAL (VLV_DISPLAY_BASE + 0x72194)
7131 #define _SPAKEYMSK (VLV_DISPLAY_BASE + 0x72198)
7132 #define _SPASURF (VLV_DISPLAY_BASE + 0x7219c)
7133 #define _SPAKEYMAXVAL (VLV_DISPLAY_BASE + 0x721a0)
7134 #define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4)
7135 #define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8)
7136 #define SP_CONST_ALPHA_ENABLE (1 << 31)
7137 #define _SPACLRC0 (VLV_DISPLAY_BASE + 0x721d0)
7138 #define SP_CONTRAST(x) ((x) << 18) /* u3.6 */
7139 #define SP_BRIGHTNESS(x) ((x) & 0xff) /* s8 */
7140 #define _SPACLRC1 (VLV_DISPLAY_BASE + 0x721d4)
7141 #define SP_SH_SIN(x) (((x) & 0x7ff) << 16) /* s4.7 */
7142 #define SP_SH_COS(x) (x) /* u3.7 */
7143 #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721e0)
7145 #define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280)
7146 #define _SPBLINOFF (VLV_DISPLAY_BASE + 0x72284)
7147 #define _SPBSTRIDE (VLV_DISPLAY_BASE + 0x72288)
7148 #define _SPBPOS (VLV_DISPLAY_BASE + 0x7228c)
7149 #define _SPBSIZE (VLV_DISPLAY_BASE + 0x72290)
7150 #define _SPBKEYMINVAL (VLV_DISPLAY_BASE + 0x72294)
7151 #define _SPBKEYMSK (VLV_DISPLAY_BASE + 0x72298)
7152 #define _SPBSURF (VLV_DISPLAY_BASE + 0x7229c)
7153 #define _SPBKEYMAXVAL (VLV_DISPLAY_BASE + 0x722a0)
7154 #define _SPBTILEOFF (VLV_DISPLAY_BASE + 0x722a4)
7155 #define _SPBCONSTALPHA (VLV_DISPLAY_BASE + 0x722a8)
7156 #define _SPBCLRC0 (VLV_DISPLAY_BASE + 0x722d0)
7157 #define _SPBCLRC1 (VLV_DISPLAY_BASE + 0x722d4)
7158 #define _SPBGAMC (VLV_DISPLAY_BASE + 0x722e0)
7160 #define _VLV_SPR(pipe, plane_id, reg_a, reg_b) \
7161 _PIPE((pipe) * 2 + (plane_id) - PLANE_SPRITE0, (reg_a), (reg_b))
7162 #define _MMIO_VLV_SPR(pipe, plane_id, reg_a, reg_b) \
7163 _MMIO(_VLV_SPR((pipe), (plane_id), (reg_a), (reg_b)))
7165 #define SPCNTR(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACNTR, _SPBCNTR)
7166 #define SPLINOFF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPALINOFF, _SPBLINOFF)
7167 #define SPSTRIDE(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASTRIDE, _SPBSTRIDE)
7168 #define SPPOS(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAPOS, _SPBPOS)
7169 #define SPSIZE(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASIZE, _SPBSIZE)
7170 #define SPKEYMINVAL(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMINVAL, _SPBKEYMINVAL)
7171 #define SPKEYMSK(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMSK, _SPBKEYMSK)
7172 #define SPSURF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASURF, _SPBSURF)
7173 #define SPKEYMAXVAL(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMAXVAL, _SPBKEYMAXVAL)
7174 #define SPTILEOFF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPATILEOFF, _SPBTILEOFF)
7175 #define SPCONSTALPHA(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACONSTALPHA, _SPBCONSTALPHA)
7176 #define SPCLRC0(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC0, _SPBCLRC0)
7177 #define SPCLRC1(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC1, _SPBCLRC1)
7178 #define SPGAMC(pipe, plane_id, i) _MMIO(_VLV_SPR((pipe), (plane_id), _SPAGAMC, _SPBGAMC) + (5 - (i)) * 4) /* 6 x u0.10 */
7181 * CHV pipe B sprite CSC
7183 * |cr| |c0 c1 c2| |cr + cr_ioff| |cr_ooff|
7184 * |yg| = |c3 c4 c5| x |yg + yg_ioff| + |yg_ooff|
7185 * |cb| |c6 c7 c8| |cb + cr_ioff| |cb_ooff|
7187 #define _MMIO_CHV_SPCSC(plane_id, reg) \
7188 _MMIO(VLV_DISPLAY_BASE + ((plane_id) - PLANE_SPRITE0) * 0x1000 + (reg))
7190 #define SPCSCYGOFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d900)
7191 #define SPCSCCBOFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d904)
7192 #define SPCSCCROFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d908)
7193 #define SPCSC_OOFF(x) (((x) & 0x7ff) << 16) /* s11 */
7194 #define SPCSC_IOFF(x) (((x) & 0x7ff) << 0) /* s11 */
7196 #define SPCSCC01(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d90c)
7197 #define SPCSCC23(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d910)
7198 #define SPCSCC45(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d914)
7199 #define SPCSCC67(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d918)
7200 #define SPCSCC8(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d91c)
7201 #define SPCSC_C1(x) (((x) & 0x7fff) << 16) /* s3.12 */
7202 #define SPCSC_C0(x) (((x) & 0x7fff) << 0) /* s3.12 */
7204 #define SPCSCYGICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d920)
7205 #define SPCSCCBICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d924)
7206 #define SPCSCCRICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d928)
7207 #define SPCSC_IMAX(x) (((x) & 0x7ff) << 16) /* s11 */
7208 #define SPCSC_IMIN(x) (((x) & 0x7ff) << 0) /* s11 */
7210 #define SPCSCYGOCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d92c)
7211 #define SPCSCCBOCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d930)
7212 #define SPCSCCROCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d934)
7213 #define SPCSC_OMAX(x) ((x) << 16) /* u10 */
7214 #define SPCSC_OMIN(x) ((x) << 0) /* u10 */
7216 /* Skylake plane registers */
7218 #define _PLANE_CTL_1_A 0x70180
7219 #define _PLANE_CTL_2_A 0x70280
7220 #define _PLANE_CTL_3_A 0x70380
7221 #define PLANE_CTL_ENABLE (1 << 31)
7222 #define PLANE_CTL_ARB_SLOTS_MASK REG_GENMASK(30, 28) /* icl+ */
7223 #define PLANE_CTL_ARB_SLOTS(x) REG_FIELD_PREP(PLANE_CTL_ARB_SLOTS_MASK, (x)) /* icl+ */
7224 #define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) /* Pre-GLK */
7225 #define PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
7227 * ICL+ uses the same PLANE_CTL_FORMAT bits, but the field definition
7228 * expanded to include bit 23 as well. However, the shift-24 based values
7229 * correctly map to the same formats in ICL, as long as bit 23 is set to 0
7231 #define PLANE_CTL_FORMAT_MASK (0xf << 24)
7232 #define PLANE_CTL_FORMAT_YUV422 (0 << 24)
7233 #define PLANE_CTL_FORMAT_NV12 (1 << 24)
7234 #define PLANE_CTL_FORMAT_XRGB_2101010 (2 << 24)
7235 #define PLANE_CTL_FORMAT_P010 (3 << 24)
7236 #define PLANE_CTL_FORMAT_XRGB_8888 (4 << 24)
7237 #define PLANE_CTL_FORMAT_P012 (5 << 24)
7238 #define PLANE_CTL_FORMAT_XRGB_16161616F (6 << 24)
7239 #define PLANE_CTL_FORMAT_P016 (7 << 24)
7240 #define PLANE_CTL_FORMAT_XYUV (8 << 24)
7241 #define PLANE_CTL_FORMAT_INDEXED (12 << 24)
7242 #define PLANE_CTL_FORMAT_RGB_565 (14 << 24)
7243 #define ICL_PLANE_CTL_FORMAT_MASK (0x1f << 23)
7244 #define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) /* Pre-GLK */
7245 #define PLANE_CTL_FORMAT_Y210 (1 << 23)
7246 #define PLANE_CTL_FORMAT_Y212 (3 << 23)
7247 #define PLANE_CTL_FORMAT_Y216 (5 << 23)
7248 #define PLANE_CTL_FORMAT_Y410 (7 << 23)
7249 #define PLANE_CTL_FORMAT_Y412 (9 << 23)
7250 #define PLANE_CTL_FORMAT_Y416 (0xb << 23)
7251 #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)
7252 #define PLANE_CTL_KEY_ENABLE_SOURCE (1 << 21)
7253 #define PLANE_CTL_KEY_ENABLE_DESTINATION (2 << 21)
7254 #define PLANE_CTL_ORDER_BGRX (0 << 20)
7255 #define PLANE_CTL_ORDER_RGBX (1 << 20)
7256 #define PLANE_CTL_YUV420_Y_PLANE (1 << 19)
7257 #define PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 (1 << 18)
7258 #define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16)
7259 #define PLANE_CTL_YUV422_YUYV (0 << 16)
7260 #define PLANE_CTL_YUV422_UYVY (1 << 16)
7261 #define PLANE_CTL_YUV422_YVYU (2 << 16)
7262 #define PLANE_CTL_YUV422_VYUY (3 << 16)
7263 #define PLANE_CTL_RENDER_DECOMPRESSION_ENABLE (1 << 15)
7264 #define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14)
7265 #define PLANE_CTL_CLEAR_COLOR_DISABLE (1 << 13) /* TGL+ */
7266 #define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) /* Pre-GLK */
7267 #define PLANE_CTL_TILED_MASK (0x7 << 10)
7268 #define PLANE_CTL_TILED_LINEAR (0 << 10)
7269 #define PLANE_CTL_TILED_X (1 << 10)
7270 #define PLANE_CTL_TILED_Y (4 << 10)
7271 #define PLANE_CTL_TILED_YF (5 << 10)
7272 #define PLANE_CTL_ASYNC_FLIP (1 << 9)
7273 #define PLANE_CTL_FLIP_HORIZONTAL (1 << 8)
7274 #define PLANE_CTL_MEDIA_DECOMPRESSION_ENABLE (1 << 4) /* TGL+ */
7275 #define PLANE_CTL_ALPHA_MASK (0x3 << 4) /* Pre-GLK */
7276 #define PLANE_CTL_ALPHA_DISABLE (0 << 4)
7277 #define PLANE_CTL_ALPHA_SW_PREMULTIPLY (2 << 4)
7278 #define PLANE_CTL_ALPHA_HW_PREMULTIPLY (3 << 4)
7279 #define PLANE_CTL_ROTATE_MASK 0x3
7280 #define PLANE_CTL_ROTATE_0 0x0
7281 #define PLANE_CTL_ROTATE_90 0x1
7282 #define PLANE_CTL_ROTATE_180 0x2
7283 #define PLANE_CTL_ROTATE_270 0x3
7284 #define _PLANE_STRIDE_1_A 0x70188
7285 #define _PLANE_STRIDE_2_A 0x70288
7286 #define _PLANE_STRIDE_3_A 0x70388
7287 #define _PLANE_POS_1_A 0x7018c
7288 #define _PLANE_POS_2_A 0x7028c
7289 #define _PLANE_POS_3_A 0x7038c
7290 #define _PLANE_SIZE_1_A 0x70190
7291 #define _PLANE_SIZE_2_A 0x70290
7292 #define _PLANE_SIZE_3_A 0x70390
7293 #define _PLANE_SURF_1_A 0x7019c
7294 #define _PLANE_SURF_2_A 0x7029c
7295 #define _PLANE_SURF_3_A 0x7039c
7296 #define _PLANE_OFFSET_1_A 0x701a4
7297 #define _PLANE_OFFSET_2_A 0x702a4
7298 #define _PLANE_OFFSET_3_A 0x703a4
7299 #define _PLANE_KEYVAL_1_A 0x70194
7300 #define _PLANE_KEYVAL_2_A 0x70294
7301 #define _PLANE_KEYMSK_1_A 0x70198
7302 #define _PLANE_KEYMSK_2_A 0x70298
7303 #define PLANE_KEYMSK_ALPHA_ENABLE (1 << 31)
7304 #define _PLANE_KEYMAX_1_A 0x701a0
7305 #define _PLANE_KEYMAX_2_A 0x702a0
7306 #define PLANE_KEYMAX_ALPHA(a) ((a) << 24)
7307 #define _PLANE_CC_VAL_1_A 0x701b4
7308 #define _PLANE_CC_VAL_2_A 0x702b4
7309 #define _PLANE_AUX_DIST_1_A 0x701c0
7310 #define _PLANE_AUX_DIST_2_A 0x702c0
7311 #define _PLANE_AUX_OFFSET_1_A 0x701c4
7312 #define _PLANE_AUX_OFFSET_2_A 0x702c4
7313 #define _PLANE_CUS_CTL_1_A 0x701c8
7314 #define _PLANE_CUS_CTL_2_A 0x702c8
7315 #define PLANE_CUS_ENABLE (1 << 31)
7316 #define PLANE_CUS_PLANE_4_RKL (0 << 30)
7317 #define PLANE_CUS_PLANE_5_RKL (1 << 30)
7318 #define PLANE_CUS_PLANE_6 (0 << 30)
7319 #define PLANE_CUS_PLANE_7 (1 << 30)
7320 #define PLANE_CUS_HPHASE_SIGN_NEGATIVE (1 << 19)
7321 #define PLANE_CUS_HPHASE_0 (0 << 16)
7322 #define PLANE_CUS_HPHASE_0_25 (1 << 16)
7323 #define PLANE_CUS_HPHASE_0_5 (2 << 16)
7324 #define PLANE_CUS_VPHASE_SIGN_NEGATIVE (1 << 15)
7325 #define PLANE_CUS_VPHASE_0 (0 << 12)
7326 #define PLANE_CUS_VPHASE_0_25 (1 << 12)
7327 #define PLANE_CUS_VPHASE_0_5 (2 << 12)
7328 #define _PLANE_COLOR_CTL_1_A 0x701CC /* GLK+ */
7329 #define _PLANE_COLOR_CTL_2_A 0x702CC /* GLK+ */
7330 #define _PLANE_COLOR_CTL_3_A 0x703CC /* GLK+ */
7331 #define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30) /* Pre-ICL */
7332 #define PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
7333 #define PLANE_COLOR_PLANE_CSC_ENABLE REG_BIT(21) /* ICL+ */
7334 #define PLANE_COLOR_INPUT_CSC_ENABLE (1 << 20) /* ICL+ */
7335 #define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23) /* Pre-ICL */
7336 #define PLANE_COLOR_CSC_MODE_BYPASS (0 << 17)
7337 #define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB601 (1 << 17)
7338 #define PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 (2 << 17)
7339 #define PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020 (3 << 17)
7340 #define PLANE_COLOR_CSC_MODE_RGB709_TO_RGB2020 (4 << 17)
7341 #define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13)
7342 #define PLANE_COLOR_ALPHA_MASK (0x3 << 4)
7343 #define PLANE_COLOR_ALPHA_DISABLE (0 << 4)
7344 #define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4)
7345 #define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)
7346 #define _PLANE_BUF_CFG_1_A 0x7027c
7347 #define _PLANE_BUF_CFG_2_A 0x7037c
7348 #define _PLANE_NV12_BUF_CFG_1_A 0x70278
7349 #define _PLANE_NV12_BUF_CFG_2_A 0x70378
7351 #define _PLANE_CC_VAL_1_B 0x711b4
7352 #define _PLANE_CC_VAL_2_B 0x712b4
7353 #define _PLANE_CC_VAL_1(pipe) _PIPE(pipe, _PLANE_CC_VAL_1_A, _PLANE_CC_VAL_1_B)
7354 #define _PLANE_CC_VAL_2(pipe) _PIPE(pipe, _PLANE_CC_VAL_2_A, _PLANE_CC_VAL_2_B)
7355 #define PLANE_CC_VAL(pipe, plane) \
7356 _MMIO_PLANE(plane, _PLANE_CC_VAL_1(pipe), _PLANE_CC_VAL_2(pipe))
7358 /* Input CSC Register Definitions */
7359 #define _PLANE_INPUT_CSC_RY_GY_1_A 0x701E0
7360 #define _PLANE_INPUT_CSC_RY_GY_2_A 0x702E0
7362 #define _PLANE_INPUT_CSC_RY_GY_1_B 0x711E0
7363 #define _PLANE_INPUT_CSC_RY_GY_2_B 0x712E0
7365 #define _PLANE_INPUT_CSC_RY_GY_1(pipe) \
7366 _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_1_A, \
7367 _PLANE_INPUT_CSC_RY_GY_1_B)
7368 #define _PLANE_INPUT_CSC_RY_GY_2(pipe) \
7369 _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_2_A, \
7370 _PLANE_INPUT_CSC_RY_GY_2_B)
7372 #define PLANE_INPUT_CSC_COEFF(pipe, plane, index) \
7373 _MMIO_PLANE(plane, _PLANE_INPUT_CSC_RY_GY_1(pipe) + (index) * 4, \
7374 _PLANE_INPUT_CSC_RY_GY_2(pipe) + (index) * 4)
7376 #define _PLANE_INPUT_CSC_PREOFF_HI_1_A 0x701F8
7377 #define _PLANE_INPUT_CSC_PREOFF_HI_2_A 0x702F8
7379 #define _PLANE_INPUT_CSC_PREOFF_HI_1_B 0x711F8
7380 #define _PLANE_INPUT_CSC_PREOFF_HI_2_B 0x712F8
7382 #define _PLANE_INPUT_CSC_PREOFF_HI_1(pipe) \
7383 _PIPE(pipe, _PLANE_INPUT_CSC_PREOFF_HI_1_A, \
7384 _PLANE_INPUT_CSC_PREOFF_HI_1_B)
7385 #define _PLANE_INPUT_CSC_PREOFF_HI_2(pipe) \
7386 _PIPE(pipe, _PLANE_INPUT_CSC_PREOFF_HI_2_A, \
7387 _PLANE_INPUT_CSC_PREOFF_HI_2_B)
7388 #define PLANE_INPUT_CSC_PREOFF(pipe, plane, index) \
7389 _MMIO_PLANE(plane, _PLANE_INPUT_CSC_PREOFF_HI_1(pipe) + (index) * 4, \
7390 _PLANE_INPUT_CSC_PREOFF_HI_2(pipe) + (index) * 4)
7392 #define _PLANE_INPUT_CSC_POSTOFF_HI_1_A 0x70204
7393 #define _PLANE_INPUT_CSC_POSTOFF_HI_2_A 0x70304
7395 #define _PLANE_INPUT_CSC_POSTOFF_HI_1_B 0x71204
7396 #define _PLANE_INPUT_CSC_POSTOFF_HI_2_B 0x71304
7398 #define _PLANE_INPUT_CSC_POSTOFF_HI_1(pipe) \
7399 _PIPE(pipe, _PLANE_INPUT_CSC_POSTOFF_HI_1_A, \
7400 _PLANE_INPUT_CSC_POSTOFF_HI_1_B)
7401 #define _PLANE_INPUT_CSC_POSTOFF_HI_2(pipe) \
7402 _PIPE(pipe, _PLANE_INPUT_CSC_POSTOFF_HI_2_A, \
7403 _PLANE_INPUT_CSC_POSTOFF_HI_2_B)
7404 #define PLANE_INPUT_CSC_POSTOFF(pipe, plane, index) \
7405 _MMIO_PLANE(plane, _PLANE_INPUT_CSC_POSTOFF_HI_1(pipe) + (index) * 4, \
7406 _PLANE_INPUT_CSC_POSTOFF_HI_2(pipe) + (index) * 4)
7408 #define _PLANE_CTL_1_B 0x71180
7409 #define _PLANE_CTL_2_B 0x71280
7410 #define _PLANE_CTL_3_B 0x71380
7411 #define _PLANE_CTL_1(pipe) _PIPE(pipe, _PLANE_CTL_1_A, _PLANE_CTL_1_B)
7412 #define _PLANE_CTL_2(pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B)
7413 #define _PLANE_CTL_3(pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B)
7414 #define PLANE_CTL(pipe, plane) \
7415 _MMIO_PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe))
7417 #define _PLANE_STRIDE_1_B 0x71188
7418 #define _PLANE_STRIDE_2_B 0x71288
7419 #define _PLANE_STRIDE_3_B 0x71388
7420 #define _PLANE_STRIDE_1(pipe) \
7421 _PIPE(pipe, _PLANE_STRIDE_1_A, _PLANE_STRIDE_1_B)
7422 #define _PLANE_STRIDE_2(pipe) \
7423 _PIPE(pipe, _PLANE_STRIDE_2_A, _PLANE_STRIDE_2_B)
7424 #define _PLANE_STRIDE_3(pipe) \
7425 _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B)
7426 #define PLANE_STRIDE(pipe, plane) \
7427 _MMIO_PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe))
7428 #define PLANE_STRIDE_MASK REG_GENMASK(10, 0)
7429 #define PLANE_STRIDE_MASK_XELPD REG_GENMASK(11, 0)
7431 #define _PLANE_POS_1_B 0x7118c
7432 #define _PLANE_POS_2_B 0x7128c
7433 #define _PLANE_POS_3_B 0x7138c
7434 #define _PLANE_POS_1(pipe) _PIPE(pipe, _PLANE_POS_1_A, _PLANE_POS_1_B)
7435 #define _PLANE_POS_2(pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B)
7436 #define _PLANE_POS_3(pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B)
7437 #define PLANE_POS(pipe, plane) \
7438 _MMIO_PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe))
7440 #define _PLANE_SIZE_1_B 0x71190
7441 #define _PLANE_SIZE_2_B 0x71290
7442 #define _PLANE_SIZE_3_B 0x71390
7443 #define _PLANE_SIZE_1(pipe) _PIPE(pipe, _PLANE_SIZE_1_A, _PLANE_SIZE_1_B)
7444 #define _PLANE_SIZE_2(pipe) _PIPE(pipe, _PLANE_SIZE_2_A, _PLANE_SIZE_2_B)
7445 #define _PLANE_SIZE_3(pipe) _PIPE(pipe, _PLANE_SIZE_3_A, _PLANE_SIZE_3_B)
7446 #define PLANE_SIZE(pipe, plane) \
7447 _MMIO_PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe))
7449 #define _PLANE_SURF_1_B 0x7119c
7450 #define _PLANE_SURF_2_B 0x7129c
7451 #define _PLANE_SURF_3_B 0x7139c
7452 #define _PLANE_SURF_1(pipe) _PIPE(pipe, _PLANE_SURF_1_A, _PLANE_SURF_1_B)
7453 #define _PLANE_SURF_2(pipe) _PIPE(pipe, _PLANE_SURF_2_A, _PLANE_SURF_2_B)
7454 #define _PLANE_SURF_3(pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B)
7455 #define PLANE_SURF(pipe, plane) \
7456 _MMIO_PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe))
7457 #define PLANE_SURF_DECRYPT REG_BIT(2)
7459 #define _PLANE_OFFSET_1_B 0x711a4
7460 #define _PLANE_OFFSET_2_B 0x712a4
7461 #define _PLANE_OFFSET_1(pipe) _PIPE(pipe, _PLANE_OFFSET_1_A, _PLANE_OFFSET_1_B)
7462 #define _PLANE_OFFSET_2(pipe) _PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B)
7463 #define PLANE_OFFSET(pipe, plane) \
7464 _MMIO_PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe))
7466 #define _PLANE_KEYVAL_1_B 0x71194
7467 #define _PLANE_KEYVAL_2_B 0x71294
7468 #define _PLANE_KEYVAL_1(pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B)
7469 #define _PLANE_KEYVAL_2(pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B)
7470 #define PLANE_KEYVAL(pipe, plane) \
7471 _MMIO_PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe))
7473 #define _PLANE_KEYMSK_1_B 0x71198
7474 #define _PLANE_KEYMSK_2_B 0x71298
7475 #define _PLANE_KEYMSK_1(pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B)
7476 #define _PLANE_KEYMSK_2(pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A, _PLANE_KEYMSK_2_B)
7477 #define PLANE_KEYMSK(pipe, plane) \
7478 _MMIO_PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe))
7480 #define _PLANE_KEYMAX_1_B 0x711a0
7481 #define _PLANE_KEYMAX_2_B 0x712a0
7482 #define _PLANE_KEYMAX_1(pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A, _PLANE_KEYMAX_1_B)
7483 #define _PLANE_KEYMAX_2(pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B)
7484 #define PLANE_KEYMAX(pipe, plane) \
7485 _MMIO_PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe))
7487 #define _PLANE_BUF_CFG_1_B 0x7127c
7488 #define _PLANE_BUF_CFG_2_B 0x7137c
7489 #define DDB_ENTRY_MASK 0xFFF /* skl+: 10 bits, icl+ 11 bits, adlp+ 12 bits */
7490 #define DDB_ENTRY_END_SHIFT 16
7491 #define _PLANE_BUF_CFG_1(pipe) \
7492 _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B)
7493 #define _PLANE_BUF_CFG_2(pipe) \
7494 _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B)
7495 #define PLANE_BUF_CFG(pipe, plane) \
7496 _MMIO_PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe))
7498 #define _PLANE_NV12_BUF_CFG_1_B 0x71278
7499 #define _PLANE_NV12_BUF_CFG_2_B 0x71378
7500 #define _PLANE_NV12_BUF_CFG_1(pipe) \
7501 _PIPE(pipe, _PLANE_NV12_BUF_CFG_1_A, _PLANE_NV12_BUF_CFG_1_B)
7502 #define _PLANE_NV12_BUF_CFG_2(pipe) \
7503 _PIPE(pipe, _PLANE_NV12_BUF_CFG_2_A, _PLANE_NV12_BUF_CFG_2_B)
7504 #define PLANE_NV12_BUF_CFG(pipe, plane) \
7505 _MMIO_PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), _PLANE_NV12_BUF_CFG_2(pipe))
7507 #define _PLANE_AUX_DIST_1_B 0x711c0
7508 #define _PLANE_AUX_DIST_2_B 0x712c0
7509 #define _PLANE_AUX_DIST_1(pipe) \
7510 _PIPE(pipe, _PLANE_AUX_DIST_1_A, _PLANE_AUX_DIST_1_B)
7511 #define _PLANE_AUX_DIST_2(pipe) \
7512 _PIPE(pipe, _PLANE_AUX_DIST_2_A, _PLANE_AUX_DIST_2_B)
7513 #define PLANE_AUX_DIST(pipe, plane) \
7514 _MMIO_PLANE(plane, _PLANE_AUX_DIST_1(pipe), _PLANE_AUX_DIST_2(pipe))
7516 #define _PLANE_AUX_OFFSET_1_B 0x711c4
7517 #define _PLANE_AUX_OFFSET_2_B 0x712c4
7518 #define _PLANE_AUX_OFFSET_1(pipe) \
7519 _PIPE(pipe, _PLANE_AUX_OFFSET_1_A, _PLANE_AUX_OFFSET_1_B)
7520 #define _PLANE_AUX_OFFSET_2(pipe) \
7521 _PIPE(pipe, _PLANE_AUX_OFFSET_2_A, _PLANE_AUX_OFFSET_2_B)
7522 #define PLANE_AUX_OFFSET(pipe, plane) \
7523 _MMIO_PLANE(plane, _PLANE_AUX_OFFSET_1(pipe), _PLANE_AUX_OFFSET_2(pipe))
7525 #define _PLANE_CUS_CTL_1_B 0x711c8
7526 #define _PLANE_CUS_CTL_2_B 0x712c8
7527 #define _PLANE_CUS_CTL_1(pipe) \
7528 _PIPE(pipe, _PLANE_CUS_CTL_1_A, _PLANE_CUS_CTL_1_B)
7529 #define _PLANE_CUS_CTL_2(pipe) \
7530 _PIPE(pipe, _PLANE_CUS_CTL_2_A, _PLANE_CUS_CTL_2_B)
7531 #define PLANE_CUS_CTL(pipe, plane) \
7532 _MMIO_PLANE(plane, _PLANE_CUS_CTL_1(pipe), _PLANE_CUS_CTL_2(pipe))
7534 #define _PLANE_COLOR_CTL_1_B 0x711CC
7535 #define _PLANE_COLOR_CTL_2_B 0x712CC
7536 #define _PLANE_COLOR_CTL_3_B 0x713CC
7537 #define _PLANE_COLOR_CTL_1(pipe) \
7538 _PIPE(pipe, _PLANE_COLOR_CTL_1_A, _PLANE_COLOR_CTL_1_B)
7539 #define _PLANE_COLOR_CTL_2(pipe) \
7540 _PIPE(pipe, _PLANE_COLOR_CTL_2_A, _PLANE_COLOR_CTL_2_B)
7541 #define PLANE_COLOR_CTL(pipe, plane) \
7542 _MMIO_PLANE(plane, _PLANE_COLOR_CTL_1(pipe), _PLANE_COLOR_CTL_2(pipe))
7544 #define _SEL_FETCH_PLANE_BASE_1_A 0x70890
7545 #define _SEL_FETCH_PLANE_BASE_2_A 0x708B0
7546 #define _SEL_FETCH_PLANE_BASE_3_A 0x708D0
7547 #define _SEL_FETCH_PLANE_BASE_4_A 0x708F0
7548 #define _SEL_FETCH_PLANE_BASE_5_A 0x70920
7549 #define _SEL_FETCH_PLANE_BASE_6_A 0x70940
7550 #define _SEL_FETCH_PLANE_BASE_7_A 0x70960
7551 #define _SEL_FETCH_PLANE_BASE_CUR_A 0x70880
7552 #define _SEL_FETCH_PLANE_BASE_1_B 0x70990
7554 #define _SEL_FETCH_PLANE_BASE_A(plane) _PICK(plane, \
7555 _SEL_FETCH_PLANE_BASE_1_A, \
7556 _SEL_FETCH_PLANE_BASE_2_A, \
7557 _SEL_FETCH_PLANE_BASE_3_A, \
7558 _SEL_FETCH_PLANE_BASE_4_A, \
7559 _SEL_FETCH_PLANE_BASE_5_A, \
7560 _SEL_FETCH_PLANE_BASE_6_A, \
7561 _SEL_FETCH_PLANE_BASE_7_A, \
7562 _SEL_FETCH_PLANE_BASE_CUR_A)
7563 #define _SEL_FETCH_PLANE_BASE_1(pipe) _PIPE(pipe, _SEL_FETCH_PLANE_BASE_1_A, _SEL_FETCH_PLANE_BASE_1_B)
7564 #define _SEL_FETCH_PLANE_BASE(pipe, plane) (_SEL_FETCH_PLANE_BASE_1(pipe) - \
7565 _SEL_FETCH_PLANE_BASE_1_A + \
7566 _SEL_FETCH_PLANE_BASE_A(plane))
7568 #define _SEL_FETCH_PLANE_CTL_1_A 0x70890
7569 #define PLANE_SEL_FETCH_CTL(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \
7570 _SEL_FETCH_PLANE_CTL_1_A - \
7571 _SEL_FETCH_PLANE_BASE_1_A)
7572 #define PLANE_SEL_FETCH_CTL_ENABLE REG_BIT(31)
7574 #define _SEL_FETCH_PLANE_POS_1_A 0x70894
7575 #define PLANE_SEL_FETCH_POS(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \
7576 _SEL_FETCH_PLANE_POS_1_A - \
7577 _SEL_FETCH_PLANE_BASE_1_A)
7579 #define _SEL_FETCH_PLANE_SIZE_1_A 0x70898
7580 #define PLANE_SEL_FETCH_SIZE(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \
7581 _SEL_FETCH_PLANE_SIZE_1_A - \
7582 _SEL_FETCH_PLANE_BASE_1_A)
7584 #define _SEL_FETCH_PLANE_OFFSET_1_A 0x7089C
7585 #define PLANE_SEL_FETCH_OFFSET(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \
7586 _SEL_FETCH_PLANE_OFFSET_1_A - \
7587 _SEL_FETCH_PLANE_BASE_1_A)
7589 /* SKL new cursor registers */
7590 #define _CUR_BUF_CFG_A 0x7017c
7591 #define _CUR_BUF_CFG_B 0x7117c
7592 #define CUR_BUF_CFG(pipe) _MMIO_PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B)
7595 #define VGACNTRL _MMIO(0x71400)
7596 # define VGA_DISP_DISABLE (1 << 31)
7597 # define VGA_2X_MODE (1 << 30)
7598 # define VGA_PIPE_B_SELECT (1 << 29)
7600 #define VLV_VGACNTRL _MMIO(VLV_DISPLAY_BASE + 0x71400)
7604 #define CPU_VGACNTRL _MMIO(0x41000)
7606 #define DIGITAL_PORT_HOTPLUG_CNTRL _MMIO(0x44030)
7607 #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
7608 #define DIGITAL_PORTA_PULSE_DURATION_2ms (0 << 2) /* pre-HSW */
7609 #define DIGITAL_PORTA_PULSE_DURATION_4_5ms (1 << 2) /* pre-HSW */
7610 #define DIGITAL_PORTA_PULSE_DURATION_6ms (2 << 2) /* pre-HSW */
7611 #define DIGITAL_PORTA_PULSE_DURATION_100ms (3 << 2) /* pre-HSW */
7612 #define DIGITAL_PORTA_PULSE_DURATION_MASK (3 << 2) /* pre-HSW */
7613 #define DIGITAL_PORTA_HOTPLUG_STATUS_MASK (3 << 0)
7614 #define DIGITAL_PORTA_HOTPLUG_NO_DETECT (0 << 0)
7615 #define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0)
7616 #define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0)
7618 /* refresh rate hardware control */
7619 #define RR_HW_CTL _MMIO(0x45300)
7620 #define RR_HW_LOW_POWER_FRAMES_MASK 0xff
7621 #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
7623 #define FDI_PLL_BIOS_0 _MMIO(0x46000)
7624 #define FDI_PLL_FB_CLOCK_MASK 0xff
7625 #define FDI_PLL_BIOS_1 _MMIO(0x46004)
7626 #define FDI_PLL_BIOS_2 _MMIO(0x46008)
7627 #define DISPLAY_PORT_PLL_BIOS_0 _MMIO(0x4600c)
7628 #define DISPLAY_PORT_PLL_BIOS_1 _MMIO(0x46010)
7629 #define DISPLAY_PORT_PLL_BIOS_2 _MMIO(0x46014)
7631 #define PCH_3DCGDIS0 _MMIO(0x46020)
7632 # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
7633 # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
7635 #define PCH_3DCGDIS1 _MMIO(0x46024)
7636 # define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11)
7638 #define FDI_PLL_FREQ_CTL _MMIO(0x46030)
7639 #define FDI_PLL_FREQ_CHANGE_REQUEST (1 << 24)
7640 #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
7641 #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
7644 #define _PIPEA_DATA_M1 0x60030
7645 #define PIPE_DATA_M1_OFFSET 0
7646 #define _PIPEA_DATA_N1 0x60034
7647 #define PIPE_DATA_N1_OFFSET 0
7649 #define _PIPEA_DATA_M2 0x60038
7650 #define PIPE_DATA_M2_OFFSET 0
7651 #define _PIPEA_DATA_N2 0x6003c
7652 #define PIPE_DATA_N2_OFFSET 0
7654 #define _PIPEA_LINK_M1 0x60040
7655 #define PIPE_LINK_M1_OFFSET 0
7656 #define _PIPEA_LINK_N1 0x60044
7657 #define PIPE_LINK_N1_OFFSET 0
7659 #define _PIPEA_LINK_M2 0x60048
7660 #define PIPE_LINK_M2_OFFSET 0
7661 #define _PIPEA_LINK_N2 0x6004c
7662 #define PIPE_LINK_N2_OFFSET 0
7664 /* PIPEB timing regs are same start from 0x61000 */
7666 #define _PIPEB_DATA_M1 0x61030
7667 #define _PIPEB_DATA_N1 0x61034
7668 #define _PIPEB_DATA_M2 0x61038
7669 #define _PIPEB_DATA_N2 0x6103c
7670 #define _PIPEB_LINK_M1 0x61040
7671 #define _PIPEB_LINK_N1 0x61044
7672 #define _PIPEB_LINK_M2 0x61048
7673 #define _PIPEB_LINK_N2 0x6104c
7675 #define PIPE_DATA_M1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M1)
7676 #define PIPE_DATA_N1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N1)
7677 #define PIPE_DATA_M2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M2)
7678 #define PIPE_DATA_N2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N2)
7679 #define PIPE_LINK_M1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M1)
7680 #define PIPE_LINK_N1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N1)
7681 #define PIPE_LINK_M2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M2)
7682 #define PIPE_LINK_N2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N2)
7684 /* CPU panel fitter */
7685 /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */
7686 #define _PFA_CTL_1 0x68080
7687 #define _PFB_CTL_1 0x68880
7688 #define PF_ENABLE (1 << 31)
7689 #define PF_PIPE_SEL_MASK_IVB (3 << 29)
7690 #define PF_PIPE_SEL_IVB(pipe) ((pipe) << 29)
7691 #define PF_FILTER_MASK (3 << 23)
7692 #define PF_FILTER_PROGRAMMED (0 << 23)
7693 #define PF_FILTER_MED_3x3 (1 << 23)
7694 #define PF_FILTER_EDGE_ENHANCE (2 << 23)
7695 #define PF_FILTER_EDGE_SOFTEN (3 << 23)
7696 #define _PFA_WIN_SZ 0x68074
7697 #define _PFB_WIN_SZ 0x68874
7698 #define _PFA_WIN_POS 0x68070
7699 #define _PFB_WIN_POS 0x68870
7700 #define _PFA_VSCALE 0x68084
7701 #define _PFB_VSCALE 0x68884
7702 #define _PFA_HSCALE 0x68090
7703 #define _PFB_HSCALE 0x68890
7705 #define PF_CTL(pipe) _MMIO_PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1)
7706 #define PF_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ)
7707 #define PF_WIN_POS(pipe) _MMIO_PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS)
7708 #define PF_VSCALE(pipe) _MMIO_PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE)
7709 #define PF_HSCALE(pipe) _MMIO_PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE)
7711 #define _PSA_CTL 0x68180
7712 #define _PSB_CTL 0x68980
7713 #define PS_ENABLE (1 << 31)
7714 #define _PSA_WIN_SZ 0x68174
7715 #define _PSB_WIN_SZ 0x68974
7716 #define _PSA_WIN_POS 0x68170
7717 #define _PSB_WIN_POS 0x68970
7719 #define PS_CTL(pipe) _MMIO_PIPE(pipe, _PSA_CTL, _PSB_CTL)
7720 #define PS_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PSA_WIN_SZ, _PSB_WIN_SZ)
7721 #define PS_WIN_POS(pipe) _MMIO_PIPE(pipe, _PSA_WIN_POS, _PSB_WIN_POS)
7726 #define _PS_1A_CTRL 0x68180
7727 #define _PS_2A_CTRL 0x68280
7728 #define _PS_1B_CTRL 0x68980
7729 #define _PS_2B_CTRL 0x68A80
7730 #define _PS_1C_CTRL 0x69180
7731 #define PS_SCALER_EN (1 << 31)
7732 #define SKL_PS_SCALER_MODE_MASK (3 << 28)
7733 #define SKL_PS_SCALER_MODE_DYN (0 << 28)
7734 #define SKL_PS_SCALER_MODE_HQ (1 << 28)
7735 #define SKL_PS_SCALER_MODE_NV12 (2 << 28)
7736 #define PS_SCALER_MODE_PLANAR (1 << 29)
7737 #define PS_SCALER_MODE_NORMAL (0 << 29)
7738 #define PS_PLANE_SEL_MASK (7 << 25)
7739 #define PS_PLANE_SEL(plane) (((plane) + 1) << 25)
7740 #define PS_FILTER_MASK (3 << 23)
7741 #define PS_FILTER_MEDIUM (0 << 23)
7742 #define PS_FILTER_PROGRAMMED (1 << 23)
7743 #define PS_FILTER_EDGE_ENHANCE (2 << 23)
7744 #define PS_FILTER_BILINEAR (3 << 23)
7745 #define PS_VERT3TAP (1 << 21)
7746 #define PS_VERT_INT_INVERT_FIELD1 (0 << 20)
7747 #define PS_VERT_INT_INVERT_FIELD0 (1 << 20)
7748 #define PS_PWRUP_PROGRESS (1 << 17)
7749 #define PS_V_FILTER_BYPASS (1 << 8)
7750 #define PS_VADAPT_EN (1 << 7)
7751 #define PS_VADAPT_MODE_MASK (3 << 5)
7752 #define PS_VADAPT_MODE_LEAST_ADAPT (0 << 5)
7753 #define PS_VADAPT_MODE_MOD_ADAPT (1 << 5)
7754 #define PS_VADAPT_MODE_MOST_ADAPT (3 << 5)
7755 #define PS_PLANE_Y_SEL_MASK (7 << 5)
7756 #define PS_PLANE_Y_SEL(plane) (((plane) + 1) << 5)
7757 #define PS_Y_VERT_FILTER_SELECT(set) ((set) << 4)
7758 #define PS_Y_HORZ_FILTER_SELECT(set) ((set) << 3)
7759 #define PS_UV_VERT_FILTER_SELECT(set) ((set) << 2)
7760 #define PS_UV_HORZ_FILTER_SELECT(set) ((set) << 1)
7762 #define _PS_PWR_GATE_1A 0x68160
7763 #define _PS_PWR_GATE_2A 0x68260
7764 #define _PS_PWR_GATE_1B 0x68960
7765 #define _PS_PWR_GATE_2B 0x68A60
7766 #define _PS_PWR_GATE_1C 0x69160
7767 #define PS_PWR_GATE_DIS_OVERRIDE (1 << 31)
7768 #define PS_PWR_GATE_SETTLING_TIME_32 (0 << 3)
7769 #define PS_PWR_GATE_SETTLING_TIME_64 (1 << 3)
7770 #define PS_PWR_GATE_SETTLING_TIME_96 (2 << 3)
7771 #define PS_PWR_GATE_SETTLING_TIME_128 (3 << 3)
7772 #define PS_PWR_GATE_SLPEN_8 0
7773 #define PS_PWR_GATE_SLPEN_16 1
7774 #define PS_PWR_GATE_SLPEN_24 2
7775 #define PS_PWR_GATE_SLPEN_32 3
7777 #define _PS_WIN_POS_1A 0x68170
7778 #define _PS_WIN_POS_2A 0x68270
7779 #define _PS_WIN_POS_1B 0x68970
7780 #define _PS_WIN_POS_2B 0x68A70
7781 #define _PS_WIN_POS_1C 0x69170
7783 #define _PS_WIN_SZ_1A 0x68174
7784 #define _PS_WIN_SZ_2A 0x68274
7785 #define _PS_WIN_SZ_1B 0x68974
7786 #define _PS_WIN_SZ_2B 0x68A74
7787 #define _PS_WIN_SZ_1C 0x69174
7789 #define _PS_VSCALE_1A 0x68184
7790 #define _PS_VSCALE_2A 0x68284
7791 #define _PS_VSCALE_1B 0x68984
7792 #define _PS_VSCALE_2B 0x68A84
7793 #define _PS_VSCALE_1C 0x69184
7795 #define _PS_HSCALE_1A 0x68190
7796 #define _PS_HSCALE_2A 0x68290
7797 #define _PS_HSCALE_1B 0x68990
7798 #define _PS_HSCALE_2B 0x68A90
7799 #define _PS_HSCALE_1C 0x69190
7801 #define _PS_VPHASE_1A 0x68188
7802 #define _PS_VPHASE_2A 0x68288
7803 #define _PS_VPHASE_1B 0x68988
7804 #define _PS_VPHASE_2B 0x68A88
7805 #define _PS_VPHASE_1C 0x69188
7806 #define PS_Y_PHASE(x) ((x) << 16)
7807 #define PS_UV_RGB_PHASE(x) ((x) << 0)
7808 #define PS_PHASE_MASK (0x7fff << 1) /* u2.13 */
7809 #define PS_PHASE_TRIP (1 << 0)
7811 #define _PS_HPHASE_1A 0x68194
7812 #define _PS_HPHASE_2A 0x68294
7813 #define _PS_HPHASE_1B 0x68994
7814 #define _PS_HPHASE_2B 0x68A94
7815 #define _PS_HPHASE_1C 0x69194
7817 #define _PS_ECC_STAT_1A 0x681D0
7818 #define _PS_ECC_STAT_2A 0x682D0
7819 #define _PS_ECC_STAT_1B 0x689D0
7820 #define _PS_ECC_STAT_2B 0x68AD0
7821 #define _PS_ECC_STAT_1C 0x691D0
7823 #define _PS_COEF_SET0_INDEX_1A 0x68198
7824 #define _PS_COEF_SET0_INDEX_2A 0x68298
7825 #define _PS_COEF_SET0_INDEX_1B 0x68998
7826 #define _PS_COEF_SET0_INDEX_2B 0x68A98
7827 #define PS_COEE_INDEX_AUTO_INC (1 << 10)
7829 #define _PS_COEF_SET0_DATA_1A 0x6819C
7830 #define _PS_COEF_SET0_DATA_2A 0x6829C
7831 #define _PS_COEF_SET0_DATA_1B 0x6899C
7832 #define _PS_COEF_SET0_DATA_2B 0x68A9C
7834 #define _ID(id, a, b) _PICK_EVEN(id, a, b)
7835 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe, \
7836 _ID(id, _PS_1A_CTRL, _PS_2A_CTRL), \
7837 _ID(id, _PS_1B_CTRL, _PS_2B_CTRL))
7838 #define SKL_PS_PWR_GATE(pipe, id) _MMIO_PIPE(pipe, \
7839 _ID(id, _PS_PWR_GATE_1A, _PS_PWR_GATE_2A), \
7840 _ID(id, _PS_PWR_GATE_1B, _PS_PWR_GATE_2B))
7841 #define SKL_PS_WIN_POS(pipe, id) _MMIO_PIPE(pipe, \
7842 _ID(id, _PS_WIN_POS_1A, _PS_WIN_POS_2A), \
7843 _ID(id, _PS_WIN_POS_1B, _PS_WIN_POS_2B))
7844 #define SKL_PS_WIN_SZ(pipe, id) _MMIO_PIPE(pipe, \
7845 _ID(id, _PS_WIN_SZ_1A, _PS_WIN_SZ_2A), \
7846 _ID(id, _PS_WIN_SZ_1B, _PS_WIN_SZ_2B))
7847 #define SKL_PS_VSCALE(pipe, id) _MMIO_PIPE(pipe, \
7848 _ID(id, _PS_VSCALE_1A, _PS_VSCALE_2A), \
7849 _ID(id, _PS_VSCALE_1B, _PS_VSCALE_2B))
7850 #define SKL_PS_HSCALE(pipe, id) _MMIO_PIPE(pipe, \
7851 _ID(id, _PS_HSCALE_1A, _PS_HSCALE_2A), \
7852 _ID(id, _PS_HSCALE_1B, _PS_HSCALE_2B))
7853 #define SKL_PS_VPHASE(pipe, id) _MMIO_PIPE(pipe, \
7854 _ID(id, _PS_VPHASE_1A, _PS_VPHASE_2A), \
7855 _ID(id, _PS_VPHASE_1B, _PS_VPHASE_2B))
7856 #define SKL_PS_HPHASE(pipe, id) _MMIO_PIPE(pipe, \
7857 _ID(id, _PS_HPHASE_1A, _PS_HPHASE_2A), \
7858 _ID(id, _PS_HPHASE_1B, _PS_HPHASE_2B))
7859 #define SKL_PS_ECC_STAT(pipe, id) _MMIO_PIPE(pipe, \
7860 _ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A), \
7861 _ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
7862 #define GLK_PS_COEF_INDEX_SET(pipe, id, set) _MMIO_PIPE(pipe, \
7863 _ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A) + (set) * 8, \
7864 _ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B) + (set) * 8)
7866 #define GLK_PS_COEF_DATA_SET(pipe, id, set) _MMIO_PIPE(pipe, \
7867 _ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A) + (set) * 8, \
7868 _ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B) + (set) * 8)
7869 /* legacy palette */
7870 #define _LGC_PALETTE_A 0x4a000
7871 #define _LGC_PALETTE_B 0x4a800
7872 #define LGC_PALETTE_RED_MASK REG_GENMASK(23, 16)
7873 #define LGC_PALETTE_GREEN_MASK REG_GENMASK(15, 8)
7874 #define LGC_PALETTE_BLUE_MASK REG_GENMASK(7, 0)
7875 #define LGC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4)
7877 /* ilk/snb precision palette */
7878 #define _PREC_PALETTE_A 0x4b000
7879 #define _PREC_PALETTE_B 0x4c000
7880 #define PREC_PALETTE_RED_MASK REG_GENMASK(29, 20)
7881 #define PREC_PALETTE_GREEN_MASK REG_GENMASK(19, 10)
7882 #define PREC_PALETTE_BLUE_MASK REG_GENMASK(9, 0)
7883 #define PREC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _PREC_PALETTE_A, _PREC_PALETTE_B) + (i) * 4)
7885 #define _PREC_PIPEAGCMAX 0x4d000
7886 #define _PREC_PIPEBGCMAX 0x4d010
7887 #define PREC_PIPEGCMAX(pipe, i) _MMIO(_PIPE(pipe, _PIPEAGCMAX, _PIPEBGCMAX) + (i) * 4)
7889 #define _GAMMA_MODE_A 0x4a480
7890 #define _GAMMA_MODE_B 0x4ac80
7891 #define GAMMA_MODE(pipe) _MMIO_PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B)
7892 #define PRE_CSC_GAMMA_ENABLE (1 << 31)
7893 #define POST_CSC_GAMMA_ENABLE (1 << 30)
7894 #define GAMMA_MODE_MODE_MASK (3 << 0)
7895 #define GAMMA_MODE_MODE_8BIT (0 << 0)
7896 #define GAMMA_MODE_MODE_10BIT (1 << 0)
7897 #define GAMMA_MODE_MODE_12BIT (2 << 0)
7898 #define GAMMA_MODE_MODE_SPLIT (3 << 0) /* ivb-bdw */
7899 #define GAMMA_MODE_MODE_12BIT_MULTI_SEGMENTED (3 << 0) /* icl + */
7902 #define DMC_PROGRAM(addr, i) _MMIO((addr) + (i) * 4)
7903 #define DMC_SSP_BASE_ADDR_GEN9 0x00002FC0
7904 #define DMC_HTP_ADDR_SKL 0x00500034
7905 #define DMC_SSP_BASE _MMIO(0x8F074)
7906 #define DMC_HTP_SKL _MMIO(0x8F004)
7907 #define DMC_LAST_WRITE _MMIO(0x8F034)
7908 #define DMC_LAST_WRITE_VALUE 0xc003b400
7909 /* MMIO address range for DMC program (0x80000 - 0x82FFF) */
7910 #define DMC_MMIO_START_RANGE 0x80000
7911 #define DMC_MMIO_END_RANGE 0x8FFFF
7912 #define SKL_DMC_DC3_DC5_COUNT _MMIO(0x80030)
7913 #define SKL_DMC_DC5_DC6_COUNT _MMIO(0x8002C)
7914 #define BXT_DMC_DC3_DC5_COUNT _MMIO(0x80038)
7915 #define TGL_DMC_DEBUG_DC5_COUNT _MMIO(0x101084)
7916 #define TGL_DMC_DEBUG_DC6_COUNT _MMIO(0x101088)
7917 #define DG1_DMC_DEBUG_DC5_COUNT _MMIO(0x134154)
7919 #define DMC_DEBUG3 _MMIO(0x101090)
7921 /* Display Internal Timeout Register */
7922 #define RM_TIMEOUT _MMIO(0x42060)
7923 #define MMIO_TIMEOUT_US(us) ((us) << 0)
7926 #define DE_MASTER_IRQ_CONTROL (1 << 31)
7927 #define DE_SPRITEB_FLIP_DONE (1 << 29)
7928 #define DE_SPRITEA_FLIP_DONE (1 << 28)
7929 #define DE_PLANEB_FLIP_DONE (1 << 27)
7930 #define DE_PLANEA_FLIP_DONE (1 << 26)
7931 #define DE_PLANE_FLIP_DONE(plane) (1 << (26 + (plane)))
7932 #define DE_PCU_EVENT (1 << 25)
7933 #define DE_GTT_FAULT (1 << 24)
7934 #define DE_POISON (1 << 23)
7935 #define DE_PERFORM_COUNTER (1 << 22)
7936 #define DE_PCH_EVENT (1 << 21)
7937 #define DE_AUX_CHANNEL_A (1 << 20)
7938 #define DE_DP_A_HOTPLUG (1 << 19)
7939 #define DE_GSE (1 << 18)
7940 #define DE_PIPEB_VBLANK (1 << 15)
7941 #define DE_PIPEB_EVEN_FIELD (1 << 14)
7942 #define DE_PIPEB_ODD_FIELD (1 << 13)
7943 #define DE_PIPEB_LINE_COMPARE (1 << 12)
7944 #define DE_PIPEB_VSYNC (1 << 11)
7945 #define DE_PIPEB_CRC_DONE (1 << 10)
7946 #define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
7947 #define DE_PIPEA_VBLANK (1 << 7)
7948 #define DE_PIPE_VBLANK(pipe) (1 << (7 + 8 * (pipe)))
7949 #define DE_PIPEA_EVEN_FIELD (1 << 6)
7950 #define DE_PIPEA_ODD_FIELD (1 << 5)
7951 #define DE_PIPEA_LINE_COMPARE (1 << 4)
7952 #define DE_PIPEA_VSYNC (1 << 3)
7953 #define DE_PIPEA_CRC_DONE (1 << 2)
7954 #define DE_PIPE_CRC_DONE(pipe) (1 << (2 + 8 * (pipe)))
7955 #define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
7956 #define DE_PIPE_FIFO_UNDERRUN(pipe) (1 << (8 * (pipe)))
7958 /* More Ivybridge lolz */
7959 #define DE_ERR_INT_IVB (1 << 30)
7960 #define DE_GSE_IVB (1 << 29)
7961 #define DE_PCH_EVENT_IVB (1 << 28)
7962 #define DE_DP_A_HOTPLUG_IVB (1 << 27)
7963 #define DE_AUX_CHANNEL_A_IVB (1 << 26)
7964 #define DE_EDP_PSR_INT_HSW (1 << 19)
7965 #define DE_SPRITEC_FLIP_DONE_IVB (1 << 14)
7966 #define DE_PLANEC_FLIP_DONE_IVB (1 << 13)
7967 #define DE_PIPEC_VBLANK_IVB (1 << 10)
7968 #define DE_SPRITEB_FLIP_DONE_IVB (1 << 9)
7969 #define DE_PLANEB_FLIP_DONE_IVB (1 << 8)
7970 #define DE_PIPEB_VBLANK_IVB (1 << 5)
7971 #define DE_SPRITEA_FLIP_DONE_IVB (1 << 4)
7972 #define DE_PLANEA_FLIP_DONE_IVB (1 << 3)
7973 #define DE_PLANE_FLIP_DONE_IVB(plane) (1 << (3 + 5 * (plane)))
7974 #define DE_PIPEA_VBLANK_IVB (1 << 0)
7975 #define DE_PIPE_VBLANK_IVB(pipe) (1 << ((pipe) * 5))
7977 #define VLV_MASTER_IER _MMIO(0x4400c) /* Gunit master IER */
7978 #define MASTER_INTERRUPT_ENABLE (1 << 31)
7980 #define DEISR _MMIO(0x44000)
7981 #define DEIMR _MMIO(0x44004)
7982 #define DEIIR _MMIO(0x44008)
7983 #define DEIER _MMIO(0x4400c)
7985 #define GTISR _MMIO(0x44010)
7986 #define GTIMR _MMIO(0x44014)
7987 #define GTIIR _MMIO(0x44018)
7988 #define GTIER _MMIO(0x4401c)
7990 #define GEN8_MASTER_IRQ _MMIO(0x44200)
7991 #define GEN8_MASTER_IRQ_CONTROL (1 << 31)
7992 #define GEN8_PCU_IRQ (1 << 30)
7993 #define GEN8_DE_PCH_IRQ (1 << 23)
7994 #define GEN8_DE_MISC_IRQ (1 << 22)
7995 #define GEN8_DE_PORT_IRQ (1 << 20)
7996 #define GEN8_DE_PIPE_C_IRQ (1 << 18)
7997 #define GEN8_DE_PIPE_B_IRQ (1 << 17)
7998 #define GEN8_DE_PIPE_A_IRQ (1 << 16)
7999 #define GEN8_DE_PIPE_IRQ(pipe) (1 << (16 + (pipe)))
8000 #define GEN8_GT_VECS_IRQ (1 << 6)
8001 #define GEN8_GT_GUC_IRQ (1 << 5)
8002 #define GEN8_GT_PM_IRQ (1 << 4)
8003 #define GEN8_GT_VCS1_IRQ (1 << 3) /* NB: VCS2 in bspec! */
8004 #define GEN8_GT_VCS0_IRQ (1 << 2) /* NB: VCS1 in bpsec! */
8005 #define GEN8_GT_BCS_IRQ (1 << 1)
8006 #define GEN8_GT_RCS_IRQ (1 << 0)
8008 #define XELPD_DISPLAY_ERR_FATAL_MASK _MMIO(0x4421c)
8010 #define GEN8_GT_ISR(which) _MMIO(0x44300 + (0x10 * (which)))
8011 #define GEN8_GT_IMR(which) _MMIO(0x44304 + (0x10 * (which)))
8012 #define GEN8_GT_IIR(which) _MMIO(0x44308 + (0x10 * (which)))
8013 #define GEN8_GT_IER(which) _MMIO(0x4430c + (0x10 * (which)))
8015 #define GEN8_RCS_IRQ_SHIFT 0
8016 #define GEN8_BCS_IRQ_SHIFT 16
8017 #define GEN8_VCS0_IRQ_SHIFT 0 /* NB: VCS1 in bspec! */
8018 #define GEN8_VCS1_IRQ_SHIFT 16 /* NB: VCS2 in bpsec! */
8019 #define GEN8_VECS_IRQ_SHIFT 0
8020 #define GEN8_WD_IRQ_SHIFT 16
8022 #define GEN8_DE_PIPE_ISR(pipe) _MMIO(0x44400 + (0x10 * (pipe)))
8023 #define GEN8_DE_PIPE_IMR(pipe) _MMIO(0x44404 + (0x10 * (pipe)))
8024 #define GEN8_DE_PIPE_IIR(pipe) _MMIO(0x44408 + (0x10 * (pipe)))
8025 #define GEN8_DE_PIPE_IER(pipe) _MMIO(0x4440c + (0x10 * (pipe)))
8026 #define GEN8_PIPE_FIFO_UNDERRUN (1 << 31)
8027 #define GEN8_PIPE_CDCLK_CRC_ERROR (1 << 29)
8028 #define GEN8_PIPE_CDCLK_CRC_DONE (1 << 28)
8029 #define XELPD_PIPE_SOFT_UNDERRUN (1 << 22)
8030 #define XELPD_PIPE_HARD_UNDERRUN (1 << 21)
8031 #define GEN8_PIPE_CURSOR_FAULT (1 << 10)
8032 #define GEN8_PIPE_SPRITE_FAULT (1 << 9)
8033 #define GEN8_PIPE_PRIMARY_FAULT (1 << 8)
8034 #define GEN8_PIPE_SPRITE_FLIP_DONE (1 << 5)
8035 #define GEN8_PIPE_PRIMARY_FLIP_DONE (1 << 4)
8036 #define GEN8_PIPE_SCAN_LINE_EVENT (1 << 2)
8037 #define GEN8_PIPE_VSYNC (1 << 1)
8038 #define GEN8_PIPE_VBLANK (1 << 0)
8039 #define GEN9_PIPE_CURSOR_FAULT (1 << 11)
8040 #define GEN11_PIPE_PLANE7_FAULT (1 << 22)
8041 #define GEN11_PIPE_PLANE6_FAULT (1 << 21)
8042 #define GEN11_PIPE_PLANE5_FAULT (1 << 20)
8043 #define GEN9_PIPE_PLANE4_FAULT (1 << 10)
8044 #define GEN9_PIPE_PLANE3_FAULT (1 << 9)
8045 #define GEN9_PIPE_PLANE2_FAULT (1 << 8)
8046 #define GEN9_PIPE_PLANE1_FAULT (1 << 7)
8047 #define GEN9_PIPE_PLANE4_FLIP_DONE (1 << 6)
8048 #define GEN9_PIPE_PLANE3_FLIP_DONE (1 << 5)
8049 #define GEN9_PIPE_PLANE2_FLIP_DONE (1 << 4)
8050 #define GEN9_PIPE_PLANE1_FLIP_DONE (1 << 3)
8051 #define GEN9_PIPE_PLANE_FLIP_DONE(p) (1 << (3 + (p)))
8052 #define GEN8_DE_PIPE_IRQ_FAULT_ERRORS \
8053 (GEN8_PIPE_CURSOR_FAULT | \
8054 GEN8_PIPE_SPRITE_FAULT | \
8055 GEN8_PIPE_PRIMARY_FAULT)
8056 #define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \
8057 (GEN9_PIPE_CURSOR_FAULT | \
8058 GEN9_PIPE_PLANE4_FAULT | \
8059 GEN9_PIPE_PLANE3_FAULT | \
8060 GEN9_PIPE_PLANE2_FAULT | \
8061 GEN9_PIPE_PLANE1_FAULT)
8062 #define GEN11_DE_PIPE_IRQ_FAULT_ERRORS \
8063 (GEN9_DE_PIPE_IRQ_FAULT_ERRORS | \
8064 GEN11_PIPE_PLANE7_FAULT | \
8065 GEN11_PIPE_PLANE6_FAULT | \
8066 GEN11_PIPE_PLANE5_FAULT)
8067 #define RKL_DE_PIPE_IRQ_FAULT_ERRORS \
8068 (GEN9_DE_PIPE_IRQ_FAULT_ERRORS | \
8069 GEN11_PIPE_PLANE5_FAULT)
8071 #define _HPD_PIN_DDI(hpd_pin) ((hpd_pin) - HPD_PORT_A)
8072 #define _HPD_PIN_TC(hpd_pin) ((hpd_pin) - HPD_PORT_TC1)
8074 #define GEN8_DE_PORT_ISR _MMIO(0x44440)
8075 #define GEN8_DE_PORT_IMR _MMIO(0x44444)
8076 #define GEN8_DE_PORT_IIR _MMIO(0x44448)
8077 #define GEN8_DE_PORT_IER _MMIO(0x4444c)
8078 #define DSI1_NON_TE (1 << 31)
8079 #define DSI0_NON_TE (1 << 30)
8080 #define ICL_AUX_CHANNEL_E (1 << 29)
8081 #define ICL_AUX_CHANNEL_F (1 << 28)
8082 #define GEN9_AUX_CHANNEL_D (1 << 27)
8083 #define GEN9_AUX_CHANNEL_C (1 << 26)
8084 #define GEN9_AUX_CHANNEL_B (1 << 25)
8085 #define DSI1_TE (1 << 24)
8086 #define DSI0_TE (1 << 23)
8087 #define GEN8_DE_PORT_HOTPLUG(hpd_pin) REG_BIT(3 + _HPD_PIN_DDI(hpd_pin))
8088 #define BXT_DE_PORT_HOTPLUG_MASK (GEN8_DE_PORT_HOTPLUG(HPD_PORT_A) | \
8089 GEN8_DE_PORT_HOTPLUG(HPD_PORT_B) | \
8090 GEN8_DE_PORT_HOTPLUG(HPD_PORT_C))
8091 #define BDW_DE_PORT_HOTPLUG_MASK GEN8_DE_PORT_HOTPLUG(HPD_PORT_A)
8092 #define BXT_DE_PORT_GMBUS (1 << 1)
8093 #define GEN8_AUX_CHANNEL_A (1 << 0)
8094 #define TGL_DE_PORT_AUX_USBC6 REG_BIT(13)
8095 #define XELPD_DE_PORT_AUX_DDIE REG_BIT(13)
8096 #define TGL_DE_PORT_AUX_USBC5 REG_BIT(12)
8097 #define XELPD_DE_PORT_AUX_DDID REG_BIT(12)
8098 #define TGL_DE_PORT_AUX_USBC4 REG_BIT(11)
8099 #define TGL_DE_PORT_AUX_USBC3 REG_BIT(10)
8100 #define TGL_DE_PORT_AUX_USBC2 REG_BIT(9)
8101 #define TGL_DE_PORT_AUX_USBC1 REG_BIT(8)
8102 #define TGL_DE_PORT_AUX_DDIC REG_BIT(2)
8103 #define TGL_DE_PORT_AUX_DDIB REG_BIT(1)
8104 #define TGL_DE_PORT_AUX_DDIA REG_BIT(0)
8106 #define GEN8_DE_MISC_ISR _MMIO(0x44460)
8107 #define GEN8_DE_MISC_IMR _MMIO(0x44464)
8108 #define GEN8_DE_MISC_IIR _MMIO(0x44468)
8109 #define GEN8_DE_MISC_IER _MMIO(0x4446c)
8110 #define GEN8_DE_MISC_GSE (1 << 27)
8111 #define GEN8_DE_EDP_PSR (1 << 19)
8113 #define GEN8_PCU_ISR _MMIO(0x444e0)
8114 #define GEN8_PCU_IMR _MMIO(0x444e4)
8115 #define GEN8_PCU_IIR _MMIO(0x444e8)
8116 #define GEN8_PCU_IER _MMIO(0x444ec)
8118 #define GEN11_GU_MISC_ISR _MMIO(0x444f0)
8119 #define GEN11_GU_MISC_IMR _MMIO(0x444f4)
8120 #define GEN11_GU_MISC_IIR _MMIO(0x444f8)
8121 #define GEN11_GU_MISC_IER _MMIO(0x444fc)
8122 #define GEN11_GU_MISC_GSE (1 << 27)
8124 #define GEN11_GFX_MSTR_IRQ _MMIO(0x190010)
8125 #define GEN11_MASTER_IRQ (1 << 31)
8126 #define GEN11_PCU_IRQ (1 << 30)
8127 #define GEN11_GU_MISC_IRQ (1 << 29)
8128 #define GEN11_DISPLAY_IRQ (1 << 16)
8129 #define GEN11_GT_DW_IRQ(x) (1 << (x))
8130 #define GEN11_GT_DW1_IRQ (1 << 1)
8131 #define GEN11_GT_DW0_IRQ (1 << 0)
8133 #define DG1_MSTR_TILE_INTR _MMIO(0x190008)
8134 #define DG1_MSTR_IRQ REG_BIT(31)
8135 #define DG1_MSTR_TILE(t) REG_BIT(t)
8137 #define GEN11_DISPLAY_INT_CTL _MMIO(0x44200)
8138 #define GEN11_DISPLAY_IRQ_ENABLE (1 << 31)
8139 #define GEN11_AUDIO_CODEC_IRQ (1 << 24)
8140 #define GEN11_DE_PCH_IRQ (1 << 23)
8141 #define GEN11_DE_MISC_IRQ (1 << 22)
8142 #define GEN11_DE_HPD_IRQ (1 << 21)
8143 #define GEN11_DE_PORT_IRQ (1 << 20)
8144 #define GEN11_DE_PIPE_C (1 << 18)
8145 #define GEN11_DE_PIPE_B (1 << 17)
8146 #define GEN11_DE_PIPE_A (1 << 16)
8148 #define GEN11_DE_HPD_ISR _MMIO(0x44470)
8149 #define GEN11_DE_HPD_IMR _MMIO(0x44474)
8150 #define GEN11_DE_HPD_IIR _MMIO(0x44478)
8151 #define GEN11_DE_HPD_IER _MMIO(0x4447c)
8152 #define GEN11_TC_HOTPLUG(hpd_pin) REG_BIT(16 + _HPD_PIN_TC(hpd_pin))
8153 #define GEN11_DE_TC_HOTPLUG_MASK (GEN11_TC_HOTPLUG(HPD_PORT_TC6) | \
8154 GEN11_TC_HOTPLUG(HPD_PORT_TC5) | \
8155 GEN11_TC_HOTPLUG(HPD_PORT_TC4) | \
8156 GEN11_TC_HOTPLUG(HPD_PORT_TC3) | \
8157 GEN11_TC_HOTPLUG(HPD_PORT_TC2) | \
8158 GEN11_TC_HOTPLUG(HPD_PORT_TC1))
8159 #define GEN11_TBT_HOTPLUG(hpd_pin) REG_BIT(_HPD_PIN_TC(hpd_pin))
8160 #define GEN11_DE_TBT_HOTPLUG_MASK (GEN11_TBT_HOTPLUG(HPD_PORT_TC6) | \
8161 GEN11_TBT_HOTPLUG(HPD_PORT_TC5) | \
8162 GEN11_TBT_HOTPLUG(HPD_PORT_TC4) | \
8163 GEN11_TBT_HOTPLUG(HPD_PORT_TC3) | \
8164 GEN11_TBT_HOTPLUG(HPD_PORT_TC2) | \
8165 GEN11_TBT_HOTPLUG(HPD_PORT_TC1))
8167 #define GEN11_TBT_HOTPLUG_CTL _MMIO(0x44030)
8168 #define GEN11_TC_HOTPLUG_CTL _MMIO(0x44038)
8169 #define GEN11_HOTPLUG_CTL_ENABLE(hpd_pin) (8 << (_HPD_PIN_TC(hpd_pin) * 4))
8170 #define GEN11_HOTPLUG_CTL_LONG_DETECT(hpd_pin) (2 << (_HPD_PIN_TC(hpd_pin) * 4))
8171 #define GEN11_HOTPLUG_CTL_SHORT_DETECT(hpd_pin) (1 << (_HPD_PIN_TC(hpd_pin) * 4))
8172 #define GEN11_HOTPLUG_CTL_NO_DETECT(hpd_pin) (0 << (_HPD_PIN_TC(hpd_pin) * 4))
8174 #define GEN11_GT_INTR_DW0 _MMIO(0x190018)
8175 #define GEN11_CSME (31)
8176 #define GEN11_GUNIT (28)
8177 #define GEN11_GUC (25)
8178 #define GEN11_WDPERF (20)
8179 #define GEN11_KCR (19)
8180 #define GEN11_GTPM (16)
8181 #define GEN11_BCS (15)
8182 #define GEN11_RCS0 (0)
8184 #define GEN11_GT_INTR_DW1 _MMIO(0x19001c)
8185 #define GEN11_VECS(x) (31 - (x))
8186 #define GEN11_VCS(x) (x)
8188 #define GEN11_GT_INTR_DW(x) _MMIO(0x190018 + ((x) * 4))
8190 #define GEN11_INTR_IDENTITY_REG0 _MMIO(0x190060)
8191 #define GEN11_INTR_IDENTITY_REG1 _MMIO(0x190064)
8192 #define GEN11_INTR_DATA_VALID (1 << 31)
8193 #define GEN11_INTR_ENGINE_CLASS(x) (((x) & GENMASK(18, 16)) >> 16)
8194 #define GEN11_INTR_ENGINE_INSTANCE(x) (((x) & GENMASK(25, 20)) >> 20)
8195 #define GEN11_INTR_ENGINE_INTR(x) ((x) & 0xffff)
8196 /* irq instances for OTHER_CLASS */
8197 #define OTHER_GUC_INSTANCE 0
8198 #define OTHER_GTPM_INSTANCE 1
8199 #define OTHER_KCR_INSTANCE 4
8201 #define GEN11_INTR_IDENTITY_REG(x) _MMIO(0x190060 + ((x) * 4))
8203 #define GEN11_IIR_REG0_SELECTOR _MMIO(0x190070)
8204 #define GEN11_IIR_REG1_SELECTOR _MMIO(0x190074)
8206 #define GEN11_IIR_REG_SELECTOR(x) _MMIO(0x190070 + ((x) * 4))
8208 #define GEN11_RENDER_COPY_INTR_ENABLE _MMIO(0x190030)
8209 #define GEN11_VCS_VECS_INTR_ENABLE _MMIO(0x190034)
8210 #define GEN11_GUC_SG_INTR_ENABLE _MMIO(0x190038)
8211 #define GEN11_GPM_WGBOXPERF_INTR_ENABLE _MMIO(0x19003c)
8212 #define GEN11_CRYPTO_RSVD_INTR_ENABLE _MMIO(0x190040)
8213 #define GEN11_GUNIT_CSME_INTR_ENABLE _MMIO(0x190044)
8215 #define GEN11_RCS0_RSVD_INTR_MASK _MMIO(0x190090)
8216 #define GEN11_BCS_RSVD_INTR_MASK _MMIO(0x1900a0)
8217 #define GEN11_VCS0_VCS1_INTR_MASK _MMIO(0x1900a8)
8218 #define GEN11_VCS2_VCS3_INTR_MASK _MMIO(0x1900ac)
8219 #define GEN12_VCS4_VCS5_INTR_MASK _MMIO(0x1900b0)
8220 #define GEN12_VCS6_VCS7_INTR_MASK _MMIO(0x1900b4)
8221 #define GEN11_VECS0_VECS1_INTR_MASK _MMIO(0x1900d0)
8222 #define GEN12_VECS2_VECS3_INTR_MASK _MMIO(0x1900d4)
8223 #define GEN11_GUC_SG_INTR_MASK _MMIO(0x1900e8)
8224 #define GEN11_GPM_WGBOXPERF_INTR_MASK _MMIO(0x1900ec)
8225 #define GEN11_CRYPTO_RSVD_INTR_MASK _MMIO(0x1900f0)
8226 #define GEN11_GUNIT_CSME_INTR_MASK _MMIO(0x1900f4)
8228 #define ENGINE1_MASK REG_GENMASK(31, 16)
8229 #define ENGINE0_MASK REG_GENMASK(15, 0)
8231 #define ILK_DISPLAY_CHICKEN2 _MMIO(0x42004)
8232 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
8233 #define ILK_ELPIN_409_SELECT (1 << 25)
8234 #define ILK_DPARB_GATE (1 << 22)
8235 #define ILK_VSDPFD_FULL (1 << 21)
8236 #define FUSE_STRAP _MMIO(0x42014)
8237 #define ILK_INTERNAL_GRAPHICS_DISABLE (1 << 31)
8238 #define ILK_INTERNAL_DISPLAY_DISABLE (1 << 30)
8239 #define ILK_DISPLAY_DEBUG_DISABLE (1 << 29)
8240 #define IVB_PIPE_C_DISABLE (1 << 28)
8241 #define ILK_HDCP_DISABLE (1 << 25)
8242 #define ILK_eDP_A_DISABLE (1 << 24)
8243 #define HSW_CDCLK_LIMIT (1 << 24)
8244 #define ILK_DESKTOP (1 << 23)
8245 #define HSW_CPU_SSC_ENABLE (1 << 21)
8247 #define FUSE_STRAP3 _MMIO(0x42020)
8248 #define HSW_REF_CLK_SELECT (1 << 1)
8250 #define ILK_DSPCLK_GATE_D _MMIO(0x42020)
8251 #define ILK_VRHUNIT_CLOCK_GATE_DISABLE (1 << 28)
8252 #define ILK_DPFCUNIT_CLOCK_GATE_DISABLE (1 << 9)
8253 #define ILK_DPFCRUNIT_CLOCK_GATE_DISABLE (1 << 8)
8254 #define ILK_DPFDUNIT_CLOCK_GATE_ENABLE (1 << 7)
8255 #define ILK_DPARBUNIT_CLOCK_GATE_ENABLE (1 << 5)
8257 #define IVB_CHICKEN3 _MMIO(0x4200c)
8258 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE (1 << 5)
8259 # define CHICKEN3_DGMG_DONE_FIX_DISABLE (1 << 2)
8261 #define CHICKEN_PAR1_1 _MMIO(0x42080)
8262 #define IGNORE_KVMR_PIPE_A REG_BIT(23)
8263 #define KBL_ARB_FILL_SPARE_22 REG_BIT(22)
8264 #define DIS_RAM_BYPASS_PSR2_MAN_TRACK (1 << 16)
8265 #define SKL_DE_COMPRESSED_HASH_MODE (1 << 15)
8266 #define DPA_MASK_VBLANK_SRD (1 << 15)
8267 #define FORCE_ARB_IDLE_PLANES (1 << 14)
8268 #define SKL_EDP_PSR_FIX_RDWRAP (1 << 3)
8269 #define IGNORE_PSR2_HW_TRACKING (1 << 1)
8271 #define CHICKEN_PAR2_1 _MMIO(0x42090)
8272 #define KVM_CONFIG_CHANGE_NOTIFICATION_SELECT (1 << 14)
8274 #define CHICKEN_MISC_2 _MMIO(0x42084)
8275 #define KBL_ARB_FILL_SPARE_14 REG_BIT(14)
8276 #define KBL_ARB_FILL_SPARE_13 REG_BIT(13)
8277 #define GLK_CL2_PWR_DOWN (1 << 12)
8278 #define GLK_CL1_PWR_DOWN (1 << 11)
8279 #define GLK_CL0_PWR_DOWN (1 << 10)
8281 #define CHICKEN_MISC_4 _MMIO(0x4208c)
8282 #define CHICKEN_FBC_STRIDE_OVERRIDE REG_BIT(13)
8283 #define CHICKEN_FBC_STRIDE_MASK REG_GENMASK(12, 0)
8284 #define CHICKEN_FBC_STRIDE(x) REG_FIELD_PREP(CHICKEN_FBC_STRIDE_MASK, (x))
8286 #define _CHICKEN_PIPESL_1_A 0x420b0
8287 #define _CHICKEN_PIPESL_1_B 0x420b4
8288 #define HSW_PRI_STRETCH_MAX_MASK REG_GENMASK(28, 27)
8289 #define HSW_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 0)
8290 #define HSW_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 1)
8291 #define HSW_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 2)
8292 #define HSW_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 3)
8293 #define HSW_SPR_STRETCH_MAX_MASK REG_GENMASK(26, 25)
8294 #define HSW_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 0)
8295 #define HSW_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 1)
8296 #define HSW_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 2)
8297 #define HSW_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 3)
8298 #define HSW_FBCQ_DIS (1 << 22)
8299 #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0)
8300 #define SKL_PLANE1_STRETCH_MAX_MASK REG_GENMASK(1, 0)
8301 #define SKL_PLANE1_STRETCH_MAX_X8 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 0)
8302 #define SKL_PLANE1_STRETCH_MAX_X4 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 1)
8303 #define SKL_PLANE1_STRETCH_MAX_X2 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 2)
8304 #define SKL_PLANE1_STRETCH_MAX_X1 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 3)
8305 #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B)
8307 #define _CHICKEN_TRANS_A 0x420c0
8308 #define _CHICKEN_TRANS_B 0x420c4
8309 #define _CHICKEN_TRANS_C 0x420c8
8310 #define _CHICKEN_TRANS_EDP 0x420cc
8311 #define _CHICKEN_TRANS_D 0x420d8
8312 #define CHICKEN_TRANS(trans) _MMIO(_PICK((trans), \
8313 [TRANSCODER_EDP] = _CHICKEN_TRANS_EDP, \
8314 [TRANSCODER_A] = _CHICKEN_TRANS_A, \
8315 [TRANSCODER_B] = _CHICKEN_TRANS_B, \
8316 [TRANSCODER_C] = _CHICKEN_TRANS_C, \
8317 [TRANSCODER_D] = _CHICKEN_TRANS_D))
8318 #define HSW_FRAME_START_DELAY_MASK REG_GENMASK(28, 27)
8319 #define HSW_FRAME_START_DELAY(x) REG_FIELD_PREP(HSW_FRAME_START_DELAY_MASK, x)
8320 #define VSC_DATA_SEL_SOFTWARE_CONTROL REG_BIT(25) /* GLK */
8321 #define FECSTALL_DIS_DPTSTREAM_DPTTG REG_BIT(23)
8322 #define DDI_TRAINING_OVERRIDE_ENABLE REG_BIT(19)
8323 #define ADLP_1_BASED_X_GRANULARITY REG_BIT(18)
8324 #define DDI_TRAINING_OVERRIDE_VALUE REG_BIT(18)
8325 #define DDIE_TRAINING_OVERRIDE_ENABLE REG_BIT(17) /* CHICKEN_TRANS_A only */
8326 #define DDIE_TRAINING_OVERRIDE_VALUE REG_BIT(16) /* CHICKEN_TRANS_A only */
8327 #define PSR2_ADD_VERTICAL_LINE_COUNT REG_BIT(15)
8328 #define PSR2_VSC_ENABLE_PROG_HEADER REG_BIT(12)
8330 #define DISP_ARB_CTL _MMIO(0x45000)
8331 #define DISP_FBC_MEMORY_WAKE (1 << 31)
8332 #define DISP_TILE_SURFACE_SWIZZLING (1 << 13)
8333 #define DISP_FBC_WM_DIS (1 << 15)
8334 #define DISP_ARB_CTL2 _MMIO(0x45004)
8335 #define DISP_DATA_PARTITION_5_6 (1 << 6)
8336 #define DISP_IPC_ENABLE (1 << 3)
8339 * The below are numbered starting from "S1" on gen11/gen12, but starting
8340 * with gen13 display, the bspec switches to a 0-based numbering scheme
8341 * (although the addresses stay the same so new S0 = old S1, new S1 = old S2).
8342 * We'll just use the 0-based numbering here for all platforms since it's the
8343 * way things will be named by the hardware team going forward, plus it's more
8344 * consistent with how most of the rest of our registers are named.
8346 #define _DBUF_CTL_S0 0x45008
8347 #define _DBUF_CTL_S1 0x44FE8
8348 #define _DBUF_CTL_S2 0x44300
8349 #define _DBUF_CTL_S3 0x44304
8350 #define DBUF_CTL_S(slice) _MMIO(_PICK(slice, \
8355 #define DBUF_POWER_REQUEST REG_BIT(31)
8356 #define DBUF_POWER_STATE REG_BIT(30)
8357 #define DBUF_TRACKER_STATE_SERVICE_MASK REG_GENMASK(23, 19)
8358 #define DBUF_TRACKER_STATE_SERVICE(x) REG_FIELD_PREP(DBUF_TRACKER_STATE_SERVICE_MASK, x)
8359 #define DBUF_MIN_TRACKER_STATE_SERVICE_MASK REG_GENMASK(18, 16) /* ADL-P+ */
8360 #define DBUF_MIN_TRACKER_STATE_SERVICE(x) REG_FIELD_PREP(DBUF_MIN_TRACKER_STATE_SERVICE_MASK, x) /* ADL-P+ */
8362 #define GEN7_MSG_CTL _MMIO(0x45010)
8363 #define WAIT_FOR_PCH_RESET_ACK (1 << 1)
8364 #define WAIT_FOR_PCH_FLR_ACK (1 << 0)
8366 #define _BW_BUDDY0_CTL 0x45130
8367 #define _BW_BUDDY1_CTL 0x45140
8368 #define BW_BUDDY_CTL(x) _MMIO(_PICK_EVEN(x, \
8371 #define BW_BUDDY_DISABLE REG_BIT(31)
8372 #define BW_BUDDY_TLB_REQ_TIMER_MASK REG_GENMASK(21, 16)
8373 #define BW_BUDDY_TLB_REQ_TIMER(x) REG_FIELD_PREP(BW_BUDDY_TLB_REQ_TIMER_MASK, x)
8375 #define _BW_BUDDY0_PAGE_MASK 0x45134
8376 #define _BW_BUDDY1_PAGE_MASK 0x45144
8377 #define BW_BUDDY_PAGE_MASK(x) _MMIO(_PICK_EVEN(x, \
8378 _BW_BUDDY0_PAGE_MASK, \
8379 _BW_BUDDY1_PAGE_MASK))
8381 #define HSW_NDE_RSTWRN_OPT _MMIO(0x46408)
8382 #define RESET_PCH_HANDSHAKE_ENABLE (1 << 4)
8384 #define GEN8_CHICKEN_DCPR_1 _MMIO(0x46430)
8385 #define SKL_SELECT_ALTERNATE_DC_EXIT (1 << 30)
8386 #define ICL_DELAY_PMRSP (1 << 22)
8387 #define MASK_WAKEMEM (1 << 13)
8389 #define GEN11_CHICKEN_DCPR_2 _MMIO(0x46434)
8390 #define DCPR_MASK_MAXLATENCY_MEMUP_CLR REG_BIT(27)
8391 #define DCPR_MASK_LPMODE REG_BIT(26)
8392 #define DCPR_SEND_RESP_IMM REG_BIT(25)
8393 #define DCPR_CLEAR_MEMSTAT_DIS REG_BIT(24)
8395 #define SKL_DFSM _MMIO(0x51000)
8396 #define SKL_DFSM_DISPLAY_PM_DISABLE (1 << 27)
8397 #define SKL_DFSM_DISPLAY_HDCP_DISABLE (1 << 25)
8398 #define SKL_DFSM_CDCLK_LIMIT_MASK (3 << 23)
8399 #define SKL_DFSM_CDCLK_LIMIT_675 (0 << 23)
8400 #define SKL_DFSM_CDCLK_LIMIT_540 (1 << 23)
8401 #define SKL_DFSM_CDCLK_LIMIT_450 (2 << 23)
8402 #define SKL_DFSM_CDCLK_LIMIT_337_5 (3 << 23)
8403 #define ICL_DFSM_DMC_DISABLE (1 << 23)
8404 #define SKL_DFSM_PIPE_A_DISABLE (1 << 30)
8405 #define SKL_DFSM_PIPE_B_DISABLE (1 << 21)
8406 #define SKL_DFSM_PIPE_C_DISABLE (1 << 28)
8407 #define TGL_DFSM_PIPE_D_DISABLE (1 << 22)
8408 #define GLK_DFSM_DISPLAY_DSC_DISABLE (1 << 7)
8410 #define SKL_DSSM _MMIO(0x51004)
8411 #define ICL_DSSM_CDCLK_PLL_REFCLK_MASK (7 << 29)
8412 #define ICL_DSSM_CDCLK_PLL_REFCLK_24MHz (0 << 29)
8413 #define ICL_DSSM_CDCLK_PLL_REFCLK_19_2MHz (1 << 29)
8414 #define ICL_DSSM_CDCLK_PLL_REFCLK_38_4MHz (2 << 29)
8416 #define GEN7_FF_SLICE_CS_CHICKEN1 _MMIO(0x20e0)
8417 #define GEN9_FFSC_PERCTX_PREEMPT_CTRL (1 << 14)
8419 #define FF_SLICE_CS_CHICKEN2 _MMIO(0x20e4)
8420 #define GEN9_TSG_BARRIER_ACK_DISABLE (1 << 8)
8421 #define GEN9_POOLED_EU_LOAD_BALANCING_FIX_DISABLE (1 << 10)
8423 #define GEN9_CS_DEBUG_MODE1 _MMIO(0x20ec)
8424 #define FF_DOP_CLOCK_GATE_DISABLE REG_BIT(1)
8425 #define GEN9_CTX_PREEMPT_REG _MMIO(0x2248)
8426 #define GEN12_DISABLE_POSH_BUSY_FF_DOP_CG REG_BIT(11)
8428 #define GEN12_CS_DEBUG_MODE1_CCCSUNIT_BE_COMMON _MMIO(0x20EC)
8429 #define GEN12_REPLAY_MODE_GRANULARITY REG_BIT(0)
8431 #define GEN8_CS_CHICKEN1 _MMIO(0x2580)
8432 #define GEN9_PREEMPT_3D_OBJECT_LEVEL (1 << 0)
8433 #define GEN9_PREEMPT_GPGPU_LEVEL(hi, lo) (((hi) << 2) | ((lo) << 1))
8434 #define GEN9_PREEMPT_GPGPU_MID_THREAD_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 0)
8435 #define GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 1)
8436 #define GEN9_PREEMPT_GPGPU_COMMAND_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(1, 0)
8437 #define GEN9_PREEMPT_GPGPU_LEVEL_MASK GEN9_PREEMPT_GPGPU_LEVEL(1, 1)
8440 #define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010)
8441 #define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC (1 << 10)
8442 #define GEN9_RHWO_OPTIMIZATION_DISABLE (1 << 14)
8444 #define COMMON_SLICE_CHICKEN2 _MMIO(0x7014)
8445 #define GEN9_PBE_COMPRESSED_HASH_SELECTION (1 << 13)
8446 #define GEN9_DISABLE_GATHER_AT_SET_SHADER_COMMON_SLICE (1 << 12)
8447 #define GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION (1 << 8)
8448 #define GEN8_CSC2_SBE_VUE_CACHE_CONSERVATIVE (1 << 0)
8450 #define GEN8_L3CNTLREG _MMIO(0x7034)
8451 #define GEN8_ERRDETBCTRL (1 << 9)
8453 #define GEN11_COMMON_SLICE_CHICKEN3 _MMIO(0x7304)
8454 #define DG1_FLOAT_POINT_BLEND_OPT_STRICT_MODE_EN REG_BIT(12)
8455 #define XEHP_DUAL_SIMD8_SEQ_MERGE_DISABLE REG_BIT(12)
8456 #define GEN11_BLEND_EMB_FIX_DISABLE_IN_RCC REG_BIT(11)
8457 #define GEN12_DISABLE_CPS_AWARE_COLOR_PIPE REG_BIT(9)
8459 #define HIZ_CHICKEN _MMIO(0x7018)
8460 # define CHV_HZ_8X8_MODE_IN_1X REG_BIT(15)
8461 # define DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE REG_BIT(14)
8462 # define BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE REG_BIT(3)
8464 #define GEN9_SLICE_COMMON_ECO_CHICKEN0 _MMIO(0x7308)
8465 #define DISABLE_PIXEL_MASK_CAMMING (1 << 14)
8467 #define GEN9_SLICE_COMMON_ECO_CHICKEN1 _MMIO(0x731c)
8468 #define GEN11_STATE_CACHE_REDIRECT_TO_CS (1 << 11)
8470 #define GEN7_SARCHKMD _MMIO(0xB000)
8471 #define GEN7_DISABLE_DEMAND_PREFETCH (1 << 31)
8472 #define GEN7_DISABLE_SAMPLER_PREFETCH (1 << 30)
8474 #define GEN7_L3SQCREG1 _MMIO(0xB010)
8475 #define VLV_B0_WA_L3SQCREG1_VALUE 0x00D30000
8477 #define GEN8_L3SQCREG1 _MMIO(0xB100)
8479 * Note that on CHV the following has an off-by-one error wrt. to BSpec.
8480 * Using the formula in BSpec leads to a hang, while the formula here works
8481 * fine and matches the formulas for all other platforms. A BSpec change
8482 * request has been filed to clarify this.
8484 #define L3_GENERAL_PRIO_CREDITS(x) (((x) >> 1) << 19)
8485 #define L3_HIGH_PRIO_CREDITS(x) (((x) >> 1) << 14)
8486 #define L3_PRIO_CREDITS_MASK ((0x1f << 19) | (0x1f << 14))
8488 #define GEN7_L3CNTLREG1 _MMIO(0xB01C)
8489 #define GEN7_WA_FOR_GEN7_L3_CONTROL 0x3C47FF8C
8490 #define GEN7_L3AGDIS (1 << 19)
8491 #define GEN7_L3CNTLREG2 _MMIO(0xB020)
8492 #define GEN7_L3CNTLREG3 _MMIO(0xB024)
8494 #define GEN7_L3_CHICKEN_MODE_REGISTER _MMIO(0xB030)
8495 #define GEN7_WA_L3_CHICKEN_MODE 0x20000000
8496 #define GEN10_L3_CHICKEN_MODE_REGISTER _MMIO(0xB114)
8497 #define GEN11_I2M_WRITE_DISABLE (1 << 28)
8499 #define GEN7_L3SQCREG4 _MMIO(0xb034)
8500 #define L3SQ_URB_READ_CAM_MATCH_DISABLE (1 << 27)
8502 #define GEN11_SCRATCH2 _MMIO(0xb140)
8503 #define GEN11_COHERENT_PARTIAL_WRITE_MERGE_ENABLE (1 << 19)
8505 #define GEN8_L3SQCREG4 _MMIO(0xb118)
8506 #define GEN11_LQSC_CLEAN_EVICT_DISABLE (1 << 6)
8507 #define GEN8_LQSC_RO_PERF_DIS (1 << 27)
8508 #define GEN8_LQSC_FLUSH_COHERENT_LINES (1 << 21)
8509 #define GEN8_LQSQ_NONIA_COHERENT_ATOMICS_ENABLE REG_BIT(22)
8511 #define GEN11_L3SQCREG5 _MMIO(0xb158)
8512 #define L3_PWM_TIMER_INIT_VAL_MASK REG_GENMASK(9, 0)
8514 #define XEHP_L3SCQREG7 _MMIO(0xb188)
8515 #define BLEND_FILL_CACHING_OPT_DIS REG_BIT(3)
8518 #define HDC_CHICKEN0 _MMIO(0x7300)
8519 #define ICL_HDC_MODE _MMIO(0xE5F4)
8520 #define HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE (1 << 15)
8521 #define HDC_FENCE_DEST_SLM_DISABLE (1 << 14)
8522 #define HDC_DONOT_FETCH_MEM_WHEN_MASKED (1 << 11)
8523 #define HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT (1 << 5)
8524 #define HDC_FORCE_NON_COHERENT (1 << 4)
8525 #define HDC_BARRIER_PERFORMANCE_DISABLE (1 << 10)
8527 #define GEN12_HDC_CHICKEN0 _MMIO(0xE5F0)
8528 #define LSC_L1_FLUSH_CTL_3D_DATAPORT_FLUSH_EVENTS_MASK REG_GENMASK(13, 11)
8530 #define SARB_CHICKEN1 _MMIO(0xe90c)
8531 #define COMP_CKN_IN REG_GENMASK(30, 29)
8533 #define GEN8_HDC_CHICKEN1 _MMIO(0x7304)
8536 #define SLICE_ECO_CHICKEN0 _MMIO(0x7308)
8537 #define PIXEL_MASK_CAMMING_DISABLE (1 << 14)
8539 #define GEN9_WM_CHICKEN3 _MMIO(0x5588)
8540 #define GEN9_FACTOR_IN_CLR_VAL_HIZ (1 << 9)
8542 /* WaCatErrorRejectionIssue */
8543 #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG _MMIO(0x9030)
8544 #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1 << 11)
8546 #define HSW_SCRATCH1 _MMIO(0xb038)
8547 #define HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE (1 << 27)
8549 #define BDW_SCRATCH1 _MMIO(0xb11c)
8550 #define GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE (1 << 2)
8553 #define _PIPEA_CHICKEN 0x70038
8554 #define _PIPEB_CHICKEN 0x71038
8555 #define _PIPEC_CHICKEN 0x72038
8556 #define PIPE_CHICKEN(pipe) _MMIO_PIPE(pipe, _PIPEA_CHICKEN,\
8558 #define UNDERRUN_RECOVERY_DISABLE_ADLP REG_BIT(30)
8559 #define UNDERRUN_RECOVERY_ENABLE_DG2 REG_BIT(30)
8560 #define PIXEL_ROUNDING_TRUNC_FB_PASSTHRU (1 << 15)
8561 #define PER_PIXEL_ALPHA_BYPASS_EN (1 << 7)
8563 #define VFLSKPD _MMIO(0x62a8)
8564 #define DIS_OVER_FETCH_CACHE REG_BIT(1)
8565 #define DIS_MULT_MISS_RD_SQUASH REG_BIT(0)
8567 #define FF_MODE2 _MMIO(0x6604)
8568 #define FF_MODE2_GS_TIMER_MASK REG_GENMASK(31, 24)
8569 #define FF_MODE2_GS_TIMER_224 REG_FIELD_PREP(FF_MODE2_GS_TIMER_MASK, 224)
8570 #define FF_MODE2_TDS_TIMER_MASK REG_GENMASK(23, 16)
8571 #define FF_MODE2_TDS_TIMER_128 REG_FIELD_PREP(FF_MODE2_TDS_TIMER_MASK, 4)
8575 #define PCH_DISPLAY_BASE 0xc0000u
8577 /* south display engine interrupt: IBX */
8578 #define SDE_AUDIO_POWER_D (1 << 27)
8579 #define SDE_AUDIO_POWER_C (1 << 26)
8580 #define SDE_AUDIO_POWER_B (1 << 25)
8581 #define SDE_AUDIO_POWER_SHIFT (25)
8582 #define SDE_AUDIO_POWER_MASK (7 << SDE_AUDIO_POWER_SHIFT)
8583 #define SDE_GMBUS (1 << 24)
8584 #define SDE_AUDIO_HDCP_TRANSB (1 << 23)
8585 #define SDE_AUDIO_HDCP_TRANSA (1 << 22)
8586 #define SDE_AUDIO_HDCP_MASK (3 << 22)
8587 #define SDE_AUDIO_TRANSB (1 << 21)
8588 #define SDE_AUDIO_TRANSA (1 << 20)
8589 #define SDE_AUDIO_TRANS_MASK (3 << 20)
8590 #define SDE_POISON (1 << 19)
8592 #define SDE_FDI_RXB (1 << 17)
8593 #define SDE_FDI_RXA (1 << 16)
8594 #define SDE_FDI_MASK (3 << 16)
8595 #define SDE_AUXD (1 << 15)
8596 #define SDE_AUXC (1 << 14)
8597 #define SDE_AUXB (1 << 13)
8598 #define SDE_AUX_MASK (7 << 13)
8600 #define SDE_CRT_HOTPLUG (1 << 11)
8601 #define SDE_PORTD_HOTPLUG (1 << 10)
8602 #define SDE_PORTC_HOTPLUG (1 << 9)
8603 #define SDE_PORTB_HOTPLUG (1 << 8)
8604 #define SDE_SDVOB_HOTPLUG (1 << 6)
8605 #define SDE_HOTPLUG_MASK (SDE_CRT_HOTPLUG | \
8606 SDE_SDVOB_HOTPLUG | \
8607 SDE_PORTB_HOTPLUG | \
8608 SDE_PORTC_HOTPLUG | \
8610 #define SDE_TRANSB_CRC_DONE (1 << 5)
8611 #define SDE_TRANSB_CRC_ERR (1 << 4)
8612 #define SDE_TRANSB_FIFO_UNDER (1 << 3)
8613 #define SDE_TRANSA_CRC_DONE (1 << 2)
8614 #define SDE_TRANSA_CRC_ERR (1 << 1)
8615 #define SDE_TRANSA_FIFO_UNDER (1 << 0)
8616 #define SDE_TRANS_MASK (0x3f)
8618 /* south display engine interrupt: CPT - CNP */
8619 #define SDE_AUDIO_POWER_D_CPT (1 << 31)
8620 #define SDE_AUDIO_POWER_C_CPT (1 << 30)
8621 #define SDE_AUDIO_POWER_B_CPT (1 << 29)
8622 #define SDE_AUDIO_POWER_SHIFT_CPT 29
8623 #define SDE_AUDIO_POWER_MASK_CPT (7 << 29)
8624 #define SDE_AUXD_CPT (1 << 27)
8625 #define SDE_AUXC_CPT (1 << 26)
8626 #define SDE_AUXB_CPT (1 << 25)
8627 #define SDE_AUX_MASK_CPT (7 << 25)
8628 #define SDE_PORTE_HOTPLUG_SPT (1 << 25)
8629 #define SDE_PORTA_HOTPLUG_SPT (1 << 24)
8630 #define SDE_PORTD_HOTPLUG_CPT (1 << 23)
8631 #define SDE_PORTC_HOTPLUG_CPT (1 << 22)
8632 #define SDE_PORTB_HOTPLUG_CPT (1 << 21)
8633 #define SDE_CRT_HOTPLUG_CPT (1 << 19)
8634 #define SDE_SDVOB_HOTPLUG_CPT (1 << 18)
8635 #define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \
8636 SDE_SDVOB_HOTPLUG_CPT | \
8637 SDE_PORTD_HOTPLUG_CPT | \
8638 SDE_PORTC_HOTPLUG_CPT | \
8639 SDE_PORTB_HOTPLUG_CPT)
8640 #define SDE_HOTPLUG_MASK_SPT (SDE_PORTE_HOTPLUG_SPT | \
8641 SDE_PORTD_HOTPLUG_CPT | \
8642 SDE_PORTC_HOTPLUG_CPT | \
8643 SDE_PORTB_HOTPLUG_CPT | \
8644 SDE_PORTA_HOTPLUG_SPT)
8645 #define SDE_GMBUS_CPT (1 << 17)
8646 #define SDE_ERROR_CPT (1 << 16)
8647 #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10)
8648 #define SDE_AUDIO_CP_CHG_C_CPT (1 << 9)
8649 #define SDE_FDI_RXC_CPT (1 << 8)
8650 #define SDE_AUDIO_CP_REQ_B_CPT (1 << 6)
8651 #define SDE_AUDIO_CP_CHG_B_CPT (1 << 5)
8652 #define SDE_FDI_RXB_CPT (1 << 4)
8653 #define SDE_AUDIO_CP_REQ_A_CPT (1 << 2)
8654 #define SDE_AUDIO_CP_CHG_A_CPT (1 << 1)
8655 #define SDE_FDI_RXA_CPT (1 << 0)
8656 #define SDE_AUDIO_CP_REQ_CPT (SDE_AUDIO_CP_REQ_C_CPT | \
8657 SDE_AUDIO_CP_REQ_B_CPT | \
8658 SDE_AUDIO_CP_REQ_A_CPT)
8659 #define SDE_AUDIO_CP_CHG_CPT (SDE_AUDIO_CP_CHG_C_CPT | \
8660 SDE_AUDIO_CP_CHG_B_CPT | \
8661 SDE_AUDIO_CP_CHG_A_CPT)
8662 #define SDE_FDI_MASK_CPT (SDE_FDI_RXC_CPT | \
8666 /* south display engine interrupt: ICP/TGP */
8667 #define SDE_GMBUS_ICP (1 << 23)
8668 #define SDE_TC_HOTPLUG_ICP(hpd_pin) REG_BIT(24 + _HPD_PIN_TC(hpd_pin))
8669 #define SDE_DDI_HOTPLUG_ICP(hpd_pin) REG_BIT(16 + _HPD_PIN_DDI(hpd_pin))
8670 #define SDE_DDI_HOTPLUG_MASK_ICP (SDE_DDI_HOTPLUG_ICP(HPD_PORT_D) | \
8671 SDE_DDI_HOTPLUG_ICP(HPD_PORT_C) | \
8672 SDE_DDI_HOTPLUG_ICP(HPD_PORT_B) | \
8673 SDE_DDI_HOTPLUG_ICP(HPD_PORT_A))
8674 #define SDE_TC_HOTPLUG_MASK_ICP (SDE_TC_HOTPLUG_ICP(HPD_PORT_TC6) | \
8675 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC5) | \
8676 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC4) | \
8677 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC3) | \
8678 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC2) | \
8679 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC1))
8681 #define SDEISR _MMIO(0xc4000)
8682 #define SDEIMR _MMIO(0xc4004)
8683 #define SDEIIR _MMIO(0xc4008)
8684 #define SDEIER _MMIO(0xc400c)
8686 #define SERR_INT _MMIO(0xc4040)
8687 #define SERR_INT_POISON (1 << 31)
8688 #define SERR_INT_TRANS_FIFO_UNDERRUN(pipe) (1 << ((pipe) * 3))
8690 /* digital port hotplug */
8691 #define PCH_PORT_HOTPLUG _MMIO(0xc4030) /* SHOTPLUG_CTL */
8692 #define PORTA_HOTPLUG_ENABLE (1 << 28) /* LPT:LP+ & BXT */
8693 #define BXT_DDIA_HPD_INVERT (1 << 27)
8694 #define PORTA_HOTPLUG_STATUS_MASK (3 << 24) /* SPT+ & BXT */
8695 #define PORTA_HOTPLUG_NO_DETECT (0 << 24) /* SPT+ & BXT */
8696 #define PORTA_HOTPLUG_SHORT_DETECT (1 << 24) /* SPT+ & BXT */
8697 #define PORTA_HOTPLUG_LONG_DETECT (2 << 24) /* SPT+ & BXT */
8698 #define PORTD_HOTPLUG_ENABLE (1 << 20)
8699 #define PORTD_PULSE_DURATION_2ms (0 << 18) /* pre-LPT */
8700 #define PORTD_PULSE_DURATION_4_5ms (1 << 18) /* pre-LPT */
8701 #define PORTD_PULSE_DURATION_6ms (2 << 18) /* pre-LPT */
8702 #define PORTD_PULSE_DURATION_100ms (3 << 18) /* pre-LPT */
8703 #define PORTD_PULSE_DURATION_MASK (3 << 18) /* pre-LPT */
8704 #define PORTD_HOTPLUG_STATUS_MASK (3 << 16)
8705 #define PORTD_HOTPLUG_NO_DETECT (0 << 16)
8706 #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
8707 #define PORTD_HOTPLUG_LONG_DETECT (2 << 16)
8708 #define PORTC_HOTPLUG_ENABLE (1 << 12)
8709 #define BXT_DDIC_HPD_INVERT (1 << 11)
8710 #define PORTC_PULSE_DURATION_2ms (0 << 10) /* pre-LPT */
8711 #define PORTC_PULSE_DURATION_4_5ms (1 << 10) /* pre-LPT */
8712 #define PORTC_PULSE_DURATION_6ms (2 << 10) /* pre-LPT */
8713 #define PORTC_PULSE_DURATION_100ms (3 << 10) /* pre-LPT */
8714 #define PORTC_PULSE_DURATION_MASK (3 << 10) /* pre-LPT */
8715 #define PORTC_HOTPLUG_STATUS_MASK (3 << 8)
8716 #define PORTC_HOTPLUG_NO_DETECT (0 << 8)
8717 #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
8718 #define PORTC_HOTPLUG_LONG_DETECT (2 << 8)
8719 #define PORTB_HOTPLUG_ENABLE (1 << 4)
8720 #define BXT_DDIB_HPD_INVERT (1 << 3)
8721 #define PORTB_PULSE_DURATION_2ms (0 << 2) /* pre-LPT */
8722 #define PORTB_PULSE_DURATION_4_5ms (1 << 2) /* pre-LPT */
8723 #define PORTB_PULSE_DURATION_6ms (2 << 2) /* pre-LPT */
8724 #define PORTB_PULSE_DURATION_100ms (3 << 2) /* pre-LPT */
8725 #define PORTB_PULSE_DURATION_MASK (3 << 2) /* pre-LPT */
8726 #define PORTB_HOTPLUG_STATUS_MASK (3 << 0)
8727 #define PORTB_HOTPLUG_NO_DETECT (0 << 0)
8728 #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
8729 #define PORTB_HOTPLUG_LONG_DETECT (2 << 0)
8730 #define BXT_DDI_HPD_INVERT_MASK (BXT_DDIA_HPD_INVERT | \
8731 BXT_DDIB_HPD_INVERT | \
8732 BXT_DDIC_HPD_INVERT)
8734 #define PCH_PORT_HOTPLUG2 _MMIO(0xc403C) /* SHOTPLUG_CTL2 SPT+ */
8735 #define PORTE_HOTPLUG_ENABLE (1 << 4)
8736 #define PORTE_HOTPLUG_STATUS_MASK (3 << 0)
8737 #define PORTE_HOTPLUG_NO_DETECT (0 << 0)
8738 #define PORTE_HOTPLUG_SHORT_DETECT (1 << 0)
8739 #define PORTE_HOTPLUG_LONG_DETECT (2 << 0)
8741 /* This register is a reuse of PCH_PORT_HOTPLUG register. The
8742 * functionality covered in PCH_PORT_HOTPLUG is split into
8743 * SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC.
8746 #define SHOTPLUG_CTL_DDI _MMIO(0xc4030)
8747 #define SHOTPLUG_CTL_DDI_HPD_ENABLE(hpd_pin) (0x8 << (_HPD_PIN_DDI(hpd_pin) * 4))
8748 #define SHOTPLUG_CTL_DDI_HPD_STATUS_MASK(hpd_pin) (0x3 << (_HPD_PIN_DDI(hpd_pin) * 4))
8749 #define SHOTPLUG_CTL_DDI_HPD_NO_DETECT(hpd_pin) (0x0 << (_HPD_PIN_DDI(hpd_pin) * 4))
8750 #define SHOTPLUG_CTL_DDI_HPD_SHORT_DETECT(hpd_pin) (0x1 << (_HPD_PIN_DDI(hpd_pin) * 4))
8751 #define SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(hpd_pin) (0x2 << (_HPD_PIN_DDI(hpd_pin) * 4))
8752 #define SHOTPLUG_CTL_DDI_HPD_SHORT_LONG_DETECT(hpd_pin) (0x3 << (_HPD_PIN_DDI(hpd_pin) * 4))
8754 #define SHOTPLUG_CTL_TC _MMIO(0xc4034)
8755 #define ICP_TC_HPD_ENABLE(hpd_pin) (8 << (_HPD_PIN_TC(hpd_pin) * 4))
8756 #define ICP_TC_HPD_LONG_DETECT(hpd_pin) (2 << (_HPD_PIN_TC(hpd_pin) * 4))
8757 #define ICP_TC_HPD_SHORT_DETECT(hpd_pin) (1 << (_HPD_PIN_TC(hpd_pin) * 4))
8759 #define SHPD_FILTER_CNT _MMIO(0xc4038)
8760 #define SHPD_FILTER_CNT_500_ADJ 0x001D9
8762 #define _PCH_DPLL_A 0xc6014
8763 #define _PCH_DPLL_B 0xc6018
8764 #define PCH_DPLL(pll) _MMIO((pll) == 0 ? _PCH_DPLL_A : _PCH_DPLL_B)
8766 #define _PCH_FPA0 0xc6040
8767 #define FP_CB_TUNE (0x3 << 22)
8768 #define _PCH_FPA1 0xc6044
8769 #define _PCH_FPB0 0xc6048
8770 #define _PCH_FPB1 0xc604c
8771 #define PCH_FP0(pll) _MMIO((pll) == 0 ? _PCH_FPA0 : _PCH_FPB0)
8772 #define PCH_FP1(pll) _MMIO((pll) == 0 ? _PCH_FPA1 : _PCH_FPB1)
8774 #define PCH_DPLL_TEST _MMIO(0xc606c)
8776 #define PCH_DREF_CONTROL _MMIO(0xC6200)
8777 #define DREF_CONTROL_MASK 0x7fc3
8778 #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0 << 13)
8779 #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2 << 13)
8780 #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3 << 13)
8781 #define DREF_CPU_SOURCE_OUTPUT_MASK (3 << 13)
8782 #define DREF_SSC_SOURCE_DISABLE (0 << 11)
8783 #define DREF_SSC_SOURCE_ENABLE (2 << 11)
8784 #define DREF_SSC_SOURCE_MASK (3 << 11)
8785 #define DREF_NONSPREAD_SOURCE_DISABLE (0 << 9)
8786 #define DREF_NONSPREAD_CK505_ENABLE (1 << 9)
8787 #define DREF_NONSPREAD_SOURCE_ENABLE (2 << 9)
8788 #define DREF_NONSPREAD_SOURCE_MASK (3 << 9)
8789 #define DREF_SUPERSPREAD_SOURCE_DISABLE (0 << 7)
8790 #define DREF_SUPERSPREAD_SOURCE_ENABLE (2 << 7)
8791 #define DREF_SUPERSPREAD_SOURCE_MASK (3 << 7)
8792 #define DREF_SSC4_DOWNSPREAD (0 << 6)
8793 #define DREF_SSC4_CENTERSPREAD (1 << 6)
8794 #define DREF_SSC1_DISABLE (0 << 1)
8795 #define DREF_SSC1_ENABLE (1 << 1)
8796 #define DREF_SSC4_DISABLE (0)
8797 #define DREF_SSC4_ENABLE (1)
8799 #define PCH_RAWCLK_FREQ _MMIO(0xc6204)
8800 #define FDL_TP1_TIMER_SHIFT 12
8801 #define FDL_TP1_TIMER_MASK (3 << 12)
8802 #define FDL_TP2_TIMER_SHIFT 10
8803 #define FDL_TP2_TIMER_MASK (3 << 10)
8804 #define RAWCLK_FREQ_MASK 0x3ff
8805 #define CNP_RAWCLK_DIV_MASK (0x3ff << 16)
8806 #define CNP_RAWCLK_DIV(div) ((div) << 16)
8807 #define CNP_RAWCLK_FRAC_MASK (0xf << 26)
8808 #define CNP_RAWCLK_DEN(den) ((den) << 26)
8809 #define ICP_RAWCLK_NUM(num) ((num) << 11)
8811 #define PCH_DPLL_TMR_CFG _MMIO(0xc6208)
8813 #define PCH_SSC4_PARMS _MMIO(0xc6210)
8814 #define PCH_SSC4_AUX_PARMS _MMIO(0xc6214)
8816 #define PCH_DPLL_SEL _MMIO(0xc7000)
8817 #define TRANS_DPLLB_SEL(pipe) (1 << ((pipe) * 4))
8818 #define TRANS_DPLLA_SEL(pipe) 0
8819 #define TRANS_DPLL_ENABLE(pipe) (1 << ((pipe) * 4 + 3))
8823 #define _PCH_TRANS_HTOTAL_A 0xe0000
8824 #define TRANS_HTOTAL_SHIFT 16
8825 #define TRANS_HACTIVE_SHIFT 0
8826 #define _PCH_TRANS_HBLANK_A 0xe0004
8827 #define TRANS_HBLANK_END_SHIFT 16
8828 #define TRANS_HBLANK_START_SHIFT 0
8829 #define _PCH_TRANS_HSYNC_A 0xe0008
8830 #define TRANS_HSYNC_END_SHIFT 16
8831 #define TRANS_HSYNC_START_SHIFT 0
8832 #define _PCH_TRANS_VTOTAL_A 0xe000c
8833 #define TRANS_VTOTAL_SHIFT 16
8834 #define TRANS_VACTIVE_SHIFT 0
8835 #define _PCH_TRANS_VBLANK_A 0xe0010
8836 #define TRANS_VBLANK_END_SHIFT 16
8837 #define TRANS_VBLANK_START_SHIFT 0
8838 #define _PCH_TRANS_VSYNC_A 0xe0014
8839 #define TRANS_VSYNC_END_SHIFT 16
8840 #define TRANS_VSYNC_START_SHIFT 0
8841 #define _PCH_TRANS_VSYNCSHIFT_A 0xe0028
8843 #define _PCH_TRANSA_DATA_M1 0xe0030
8844 #define _PCH_TRANSA_DATA_N1 0xe0034
8845 #define _PCH_TRANSA_DATA_M2 0xe0038
8846 #define _PCH_TRANSA_DATA_N2 0xe003c
8847 #define _PCH_TRANSA_LINK_M1 0xe0040
8848 #define _PCH_TRANSA_LINK_N1 0xe0044
8849 #define _PCH_TRANSA_LINK_M2 0xe0048
8850 #define _PCH_TRANSA_LINK_N2 0xe004c
8852 /* Per-transcoder DIP controls (PCH) */
8853 #define _VIDEO_DIP_CTL_A 0xe0200
8854 #define _VIDEO_DIP_DATA_A 0xe0208
8855 #define _VIDEO_DIP_GCP_A 0xe0210
8856 #define GCP_COLOR_INDICATION (1 << 2)
8857 #define GCP_DEFAULT_PHASE_ENABLE (1 << 1)
8858 #define GCP_AV_MUTE (1 << 0)
8860 #define _VIDEO_DIP_CTL_B 0xe1200
8861 #define _VIDEO_DIP_DATA_B 0xe1208
8862 #define _VIDEO_DIP_GCP_B 0xe1210
8864 #define TVIDEO_DIP_CTL(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B)
8865 #define TVIDEO_DIP_DATA(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B)
8866 #define TVIDEO_DIP_GCP(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
8868 /* Per-transcoder DIP controls (VLV) */
8869 #define _VLV_VIDEO_DIP_CTL_A (VLV_DISPLAY_BASE + 0x60200)
8870 #define _VLV_VIDEO_DIP_DATA_A (VLV_DISPLAY_BASE + 0x60208)
8871 #define _VLV_VIDEO_DIP_GDCP_PAYLOAD_A (VLV_DISPLAY_BASE + 0x60210)
8873 #define _VLV_VIDEO_DIP_CTL_B (VLV_DISPLAY_BASE + 0x61170)
8874 #define _VLV_VIDEO_DIP_DATA_B (VLV_DISPLAY_BASE + 0x61174)
8875 #define _VLV_VIDEO_DIP_GDCP_PAYLOAD_B (VLV_DISPLAY_BASE + 0x61178)
8877 #define _CHV_VIDEO_DIP_CTL_C (VLV_DISPLAY_BASE + 0x611f0)
8878 #define _CHV_VIDEO_DIP_DATA_C (VLV_DISPLAY_BASE + 0x611f4)
8879 #define _CHV_VIDEO_DIP_GDCP_PAYLOAD_C (VLV_DISPLAY_BASE + 0x611f8)
8881 #define VLV_TVIDEO_DIP_CTL(pipe) \
8882 _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_CTL_A, \
8883 _VLV_VIDEO_DIP_CTL_B, _CHV_VIDEO_DIP_CTL_C)
8884 #define VLV_TVIDEO_DIP_DATA(pipe) \
8885 _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_DATA_A, \
8886 _VLV_VIDEO_DIP_DATA_B, _CHV_VIDEO_DIP_DATA_C)
8887 #define VLV_TVIDEO_DIP_GCP(pipe) \
8888 _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
8889 _VLV_VIDEO_DIP_GDCP_PAYLOAD_B, _CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
8891 /* Haswell DIP controls */
8893 #define _HSW_VIDEO_DIP_CTL_A 0x60200
8894 #define _HSW_VIDEO_DIP_AVI_DATA_A 0x60220
8895 #define _HSW_VIDEO_DIP_VS_DATA_A 0x60260
8896 #define _HSW_VIDEO_DIP_SPD_DATA_A 0x602A0
8897 #define _HSW_VIDEO_DIP_GMP_DATA_A 0x602E0
8898 #define _HSW_VIDEO_DIP_VSC_DATA_A 0x60320
8899 #define _GLK_VIDEO_DIP_DRM_DATA_A 0x60440
8900 #define _HSW_VIDEO_DIP_AVI_ECC_A 0x60240
8901 #define _HSW_VIDEO_DIP_VS_ECC_A 0x60280
8902 #define _HSW_VIDEO_DIP_SPD_ECC_A 0x602C0
8903 #define _HSW_VIDEO_DIP_GMP_ECC_A 0x60300
8904 #define _HSW_VIDEO_DIP_VSC_ECC_A 0x60344
8905 #define _HSW_VIDEO_DIP_GCP_A 0x60210
8907 #define _HSW_VIDEO_DIP_CTL_B 0x61200
8908 #define _HSW_VIDEO_DIP_AVI_DATA_B 0x61220
8909 #define _HSW_VIDEO_DIP_VS_DATA_B 0x61260
8910 #define _HSW_VIDEO_DIP_SPD_DATA_B 0x612A0
8911 #define _HSW_VIDEO_DIP_GMP_DATA_B 0x612E0
8912 #define _HSW_VIDEO_DIP_VSC_DATA_B 0x61320
8913 #define _GLK_VIDEO_DIP_DRM_DATA_B 0x61440
8914 #define _HSW_VIDEO_DIP_BVI_ECC_B 0x61240
8915 #define _HSW_VIDEO_DIP_VS_ECC_B 0x61280
8916 #define _HSW_VIDEO_DIP_SPD_ECC_B 0x612C0
8917 #define _HSW_VIDEO_DIP_GMP_ECC_B 0x61300
8918 #define _HSW_VIDEO_DIP_VSC_ECC_B 0x61344
8919 #define _HSW_VIDEO_DIP_GCP_B 0x61210
8921 /* Icelake PPS_DATA and _ECC DIP Registers.
8922 * These are available for transcoders B,C and eDP.
8923 * Adding the _A so as to reuse the _MMIO_TRANS2
8924 * definition, with which it offsets to the right location.
8927 #define _ICL_VIDEO_DIP_PPS_DATA_A 0x60350
8928 #define _ICL_VIDEO_DIP_PPS_DATA_B 0x61350
8929 #define _ICL_VIDEO_DIP_PPS_ECC_A 0x603D4
8930 #define _ICL_VIDEO_DIP_PPS_ECC_B 0x613D4
8932 #define HSW_TVIDEO_DIP_CTL(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_CTL_A)
8933 #define HSW_TVIDEO_DIP_GCP(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GCP_A)
8934 #define HSW_TVIDEO_DIP_AVI_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_AVI_DATA_A + (i) * 4)
8935 #define HSW_TVIDEO_DIP_VS_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VS_DATA_A + (i) * 4)
8936 #define HSW_TVIDEO_DIP_SPD_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4)
8937 #define HSW_TVIDEO_DIP_GMP_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GMP_DATA_A + (i) * 4)
8938 #define HSW_TVIDEO_DIP_VSC_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4)
8939 #define GLK_TVIDEO_DIP_DRM_DATA(trans, i) _MMIO_TRANS2(trans, _GLK_VIDEO_DIP_DRM_DATA_A + (i) * 4)
8940 #define ICL_VIDEO_DIP_PPS_DATA(trans, i) _MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_DATA_A + (i) * 4)
8941 #define ICL_VIDEO_DIP_PPS_ECC(trans, i) _MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_ECC_A + (i) * 4)
8943 #define _HSW_STEREO_3D_CTL_A 0x70020
8944 #define S3D_ENABLE (1 << 31)
8945 #define _HSW_STEREO_3D_CTL_B 0x71020
8947 #define HSW_STEREO_3D_CTL(trans) _MMIO_PIPE2(trans, _HSW_STEREO_3D_CTL_A)
8949 #define _PCH_TRANS_HTOTAL_B 0xe1000
8950 #define _PCH_TRANS_HBLANK_B 0xe1004
8951 #define _PCH_TRANS_HSYNC_B 0xe1008
8952 #define _PCH_TRANS_VTOTAL_B 0xe100c
8953 #define _PCH_TRANS_VBLANK_B 0xe1010
8954 #define _PCH_TRANS_VSYNC_B 0xe1014
8955 #define _PCH_TRANS_VSYNCSHIFT_B 0xe1028
8957 #define PCH_TRANS_HTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HTOTAL_A, _PCH_TRANS_HTOTAL_B)
8958 #define PCH_TRANS_HBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HBLANK_A, _PCH_TRANS_HBLANK_B)
8959 #define PCH_TRANS_HSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HSYNC_A, _PCH_TRANS_HSYNC_B)
8960 #define PCH_TRANS_VTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VTOTAL_A, _PCH_TRANS_VTOTAL_B)
8961 #define PCH_TRANS_VBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VBLANK_A, _PCH_TRANS_VBLANK_B)
8962 #define PCH_TRANS_VSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNC_A, _PCH_TRANS_VSYNC_B)
8963 #define PCH_TRANS_VSYNCSHIFT(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNCSHIFT_A, _PCH_TRANS_VSYNCSHIFT_B)
8965 #define _PCH_TRANSB_DATA_M1 0xe1030
8966 #define _PCH_TRANSB_DATA_N1 0xe1034
8967 #define _PCH_TRANSB_DATA_M2 0xe1038
8968 #define _PCH_TRANSB_DATA_N2 0xe103c
8969 #define _PCH_TRANSB_LINK_M1 0xe1040
8970 #define _PCH_TRANSB_LINK_N1 0xe1044
8971 #define _PCH_TRANSB_LINK_M2 0xe1048
8972 #define _PCH_TRANSB_LINK_N2 0xe104c
8974 #define PCH_TRANS_DATA_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M1, _PCH_TRANSB_DATA_M1)
8975 #define PCH_TRANS_DATA_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N1, _PCH_TRANSB_DATA_N1)
8976 #define PCH_TRANS_DATA_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M2, _PCH_TRANSB_DATA_M2)
8977 #define PCH_TRANS_DATA_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N2, _PCH_TRANSB_DATA_N2)
8978 #define PCH_TRANS_LINK_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M1, _PCH_TRANSB_LINK_M1)
8979 #define PCH_TRANS_LINK_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N1, _PCH_TRANSB_LINK_N1)
8980 #define PCH_TRANS_LINK_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M2, _PCH_TRANSB_LINK_M2)
8981 #define PCH_TRANS_LINK_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N2, _PCH_TRANSB_LINK_N2)
8983 #define _PCH_TRANSACONF 0xf0008
8984 #define _PCH_TRANSBCONF 0xf1008
8985 #define PCH_TRANSCONF(pipe) _MMIO_PIPE(pipe, _PCH_TRANSACONF, _PCH_TRANSBCONF)
8986 #define LPT_TRANSCONF PCH_TRANSCONF(PIPE_A) /* lpt has only one transcoder */
8987 #define TRANS_DISABLE (0 << 31)
8988 #define TRANS_ENABLE (1 << 31)
8989 #define TRANS_STATE_MASK (1 << 30)
8990 #define TRANS_STATE_DISABLE (0 << 30)
8991 #define TRANS_STATE_ENABLE (1 << 30)
8992 #define TRANS_FRAME_START_DELAY_MASK (3 << 27) /* ibx */
8993 #define TRANS_FRAME_START_DELAY(x) ((x) << 27) /* ibx: 0-3 */
8994 #define TRANS_INTERLACE_MASK (7 << 21)
8995 #define TRANS_PROGRESSIVE (0 << 21)
8996 #define TRANS_INTERLACED (3 << 21)
8997 #define TRANS_LEGACY_INTERLACED_ILK (2 << 21)
8998 #define TRANS_8BPC (0 << 5)
8999 #define TRANS_10BPC (1 << 5)
9000 #define TRANS_6BPC (2 << 5)
9001 #define TRANS_12BPC (3 << 5)
9003 #define _TRANSA_CHICKEN1 0xf0060
9004 #define _TRANSB_CHICKEN1 0xf1060
9005 #define TRANS_CHICKEN1(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN1, _TRANSB_CHICKEN1)
9006 #define TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE (1 << 10)
9007 #define TRANS_CHICKEN1_DP0UNIT_GC_DISABLE (1 << 4)
9008 #define _TRANSA_CHICKEN2 0xf0064
9009 #define _TRANSB_CHICKEN2 0xf1064
9010 #define TRANS_CHICKEN2(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2)
9011 #define TRANS_CHICKEN2_TIMING_OVERRIDE (1 << 31)
9012 #define TRANS_CHICKEN2_FDI_POLARITY_REVERSED (1 << 29)
9013 #define TRANS_CHICKEN2_FRAME_START_DELAY_MASK (3 << 27)
9014 #define TRANS_CHICKEN2_FRAME_START_DELAY(x) ((x) << 27) /* 0-3 */
9015 #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_COUNTER (1 << 26)
9016 #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_MODESWITCH (1 << 25)
9018 #define SOUTH_CHICKEN1 _MMIO(0xc2000)
9019 #define FDIA_PHASE_SYNC_SHIFT_OVR 19
9020 #define FDIA_PHASE_SYNC_SHIFT_EN 18
9021 #define INVERT_DDID_HPD (1 << 18)
9022 #define INVERT_DDIC_HPD (1 << 17)
9023 #define INVERT_DDIB_HPD (1 << 16)
9024 #define INVERT_DDIA_HPD (1 << 15)
9025 #define FDI_PHASE_SYNC_OVR(pipe) (1 << (FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2)))
9026 #define FDI_PHASE_SYNC_EN(pipe) (1 << (FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2)))
9027 #define FDI_BC_BIFURCATION_SELECT (1 << 12)
9028 #define CHASSIS_CLK_REQ_DURATION_MASK (0xf << 8)
9029 #define CHASSIS_CLK_REQ_DURATION(x) ((x) << 8)
9030 #define SBCLK_RUN_REFCLK_DIS (1 << 7)
9031 #define SPT_PWM_GRANULARITY (1 << 0)
9032 #define SOUTH_CHICKEN2 _MMIO(0xc2004)
9033 #define FDI_MPHY_IOSFSB_RESET_STATUS (1 << 13)
9034 #define FDI_MPHY_IOSFSB_RESET_CTL (1 << 12)
9035 #define LPT_PWM_GRANULARITY (1 << 5)
9036 #define DPLS_EDP_PPS_FIX_DIS (1 << 0)
9038 #define _FDI_RXA_CHICKEN 0xc200c
9039 #define _FDI_RXB_CHICKEN 0xc2010
9040 #define FDI_RX_PHASE_SYNC_POINTER_OVR (1 << 1)
9041 #define FDI_RX_PHASE_SYNC_POINTER_EN (1 << 0)
9042 #define FDI_RX_CHICKEN(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CHICKEN, _FDI_RXB_CHICKEN)
9044 #define SOUTH_DSPCLK_GATE_D _MMIO(0xc2020)
9045 #define PCH_GMBUSUNIT_CLOCK_GATE_DISABLE (1 << 31)
9046 #define PCH_DPLUNIT_CLOCK_GATE_DISABLE (1 << 30)
9047 #define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1 << 29)
9048 #define PCH_DPMGUNIT_CLOCK_GATE_DISABLE (1 << 15)
9049 #define PCH_CPUNIT_CLOCK_GATE_DISABLE (1 << 14)
9050 #define CNP_PWM_CGE_GATING_DISABLE (1 << 13)
9051 #define PCH_LP_PARTITION_LEVEL_DISABLE (1 << 12)
9054 #define _FDI_TXA_CTL 0x60100
9055 #define _FDI_TXB_CTL 0x61100
9056 #define FDI_TX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_TXA_CTL, _FDI_TXB_CTL)
9057 #define FDI_TX_DISABLE (0 << 31)
9058 #define FDI_TX_ENABLE (1 << 31)
9059 #define FDI_LINK_TRAIN_PATTERN_1 (0 << 28)
9060 #define FDI_LINK_TRAIN_PATTERN_2 (1 << 28)
9061 #define FDI_LINK_TRAIN_PATTERN_IDLE (2 << 28)
9062 #define FDI_LINK_TRAIN_NONE (3 << 28)
9063 #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0 << 25)
9064 #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1 << 25)
9065 #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2 << 25)
9066 #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3 << 25)
9067 #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0 << 22)
9068 #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1 << 22)
9069 #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2 << 22)
9070 #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3 << 22)
9071 /* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.
9072 SNB has different settings. */
9073 /* SNB A-stepping */
9074 #define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38 << 22)
9075 #define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02 << 22)
9076 #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01 << 22)
9077 #define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0 << 22)
9078 /* SNB B-stepping */
9079 #define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0 << 22)
9080 #define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a << 22)
9081 #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39 << 22)
9082 #define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38 << 22)
9083 #define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f << 22)
9084 #define FDI_DP_PORT_WIDTH_SHIFT 19
9085 #define FDI_DP_PORT_WIDTH_MASK (7 << FDI_DP_PORT_WIDTH_SHIFT)
9086 #define FDI_DP_PORT_WIDTH(width) (((width) - 1) << FDI_DP_PORT_WIDTH_SHIFT)
9087 #define FDI_TX_ENHANCE_FRAME_ENABLE (1 << 18)
9088 /* Ironlake: hardwired to 1 */
9089 #define FDI_TX_PLL_ENABLE (1 << 14)
9091 /* Ivybridge has different bits for lolz */
9092 #define FDI_LINK_TRAIN_PATTERN_1_IVB (0 << 8)
9093 #define FDI_LINK_TRAIN_PATTERN_2_IVB (1 << 8)
9094 #define FDI_LINK_TRAIN_PATTERN_IDLE_IVB (2 << 8)
9095 #define FDI_LINK_TRAIN_NONE_IVB (3 << 8)
9097 /* both Tx and Rx */
9098 #define FDI_COMPOSITE_SYNC (1 << 11)
9099 #define FDI_LINK_TRAIN_AUTO (1 << 10)
9100 #define FDI_SCRAMBLING_ENABLE (0 << 7)
9101 #define FDI_SCRAMBLING_DISABLE (1 << 7)
9103 /* FDI_RX, FDI_X is hard-wired to Transcoder_X */
9104 #define _FDI_RXA_CTL 0xf000c
9105 #define _FDI_RXB_CTL 0xf100c
9106 #define FDI_RX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CTL, _FDI_RXB_CTL)
9107 #define FDI_RX_ENABLE (1 << 31)
9108 /* train, dp width same as FDI_TX */
9109 #define FDI_FS_ERRC_ENABLE (1 << 27)
9110 #define FDI_FE_ERRC_ENABLE (1 << 26)
9111 #define FDI_RX_POLARITY_REVERSED_LPT (1 << 16)
9112 #define FDI_8BPC (0 << 16)
9113 #define FDI_10BPC (1 << 16)
9114 #define FDI_6BPC (2 << 16)
9115 #define FDI_12BPC (3 << 16)
9116 #define FDI_RX_LINK_REVERSAL_OVERRIDE (1 << 15)
9117 #define FDI_DMI_LINK_REVERSE_MASK (1 << 14)
9118 #define FDI_RX_PLL_ENABLE (1 << 13)
9119 #define FDI_FS_ERR_CORRECT_ENABLE (1 << 11)
9120 #define FDI_FE_ERR_CORRECT_ENABLE (1 << 10)
9121 #define FDI_FS_ERR_REPORT_ENABLE (1 << 9)
9122 #define FDI_FE_ERR_REPORT_ENABLE (1 << 8)
9123 #define FDI_RX_ENHANCE_FRAME_ENABLE (1 << 6)
9124 #define FDI_PCDCLK (1 << 4)
9126 #define FDI_AUTO_TRAINING (1 << 10)
9127 #define FDI_LINK_TRAIN_PATTERN_1_CPT (0 << 8)
9128 #define FDI_LINK_TRAIN_PATTERN_2_CPT (1 << 8)
9129 #define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2 << 8)
9130 #define FDI_LINK_TRAIN_NORMAL_CPT (3 << 8)
9131 #define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3 << 8)
9133 #define _FDI_RXA_MISC 0xf0010
9134 #define _FDI_RXB_MISC 0xf1010
9135 #define FDI_RX_PWRDN_LANE1_MASK (3 << 26)
9136 #define FDI_RX_PWRDN_LANE1_VAL(x) ((x) << 26)
9137 #define FDI_RX_PWRDN_LANE0_MASK (3 << 24)
9138 #define FDI_RX_PWRDN_LANE0_VAL(x) ((x) << 24)
9139 #define FDI_RX_TP1_TO_TP2_48 (2 << 20)
9140 #define FDI_RX_TP1_TO_TP2_64 (3 << 20)
9141 #define FDI_RX_FDI_DELAY_90 (0x90 << 0)
9142 #define FDI_RX_MISC(pipe) _MMIO_PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC)
9144 #define _FDI_RXA_TUSIZE1 0xf0030
9145 #define _FDI_RXA_TUSIZE2 0xf0038
9146 #define _FDI_RXB_TUSIZE1 0xf1030
9147 #define _FDI_RXB_TUSIZE2 0xf1038
9148 #define FDI_RX_TUSIZE1(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1)
9149 #define FDI_RX_TUSIZE2(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2)
9151 /* FDI_RX interrupt register format */
9152 #define FDI_RX_INTER_LANE_ALIGN (1 << 10)
9153 #define FDI_RX_SYMBOL_LOCK (1 << 9) /* train 2 */
9154 #define FDI_RX_BIT_LOCK (1 << 8) /* train 1 */
9155 #define FDI_RX_TRAIN_PATTERN_2_FAIL (1 << 7)
9156 #define FDI_RX_FS_CODE_ERR (1 << 6)
9157 #define FDI_RX_FE_CODE_ERR (1 << 5)
9158 #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1 << 4)
9159 #define FDI_RX_HDCP_LINK_FAIL (1 << 3)
9160 #define FDI_RX_PIXEL_FIFO_OVERFLOW (1 << 2)
9161 #define FDI_RX_CROSS_CLOCK_OVERFLOW (1 << 1)
9162 #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1 << 0)
9164 #define _FDI_RXA_IIR 0xf0014
9165 #define _FDI_RXA_IMR 0xf0018
9166 #define _FDI_RXB_IIR 0xf1014
9167 #define _FDI_RXB_IMR 0xf1018
9168 #define FDI_RX_IIR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IIR, _FDI_RXB_IIR)
9169 #define FDI_RX_IMR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IMR, _FDI_RXB_IMR)
9171 #define FDI_PLL_CTL_1 _MMIO(0xfe000)
9172 #define FDI_PLL_CTL_2 _MMIO(0xfe004)
9174 #define PCH_LVDS _MMIO(0xe1180)
9175 #define LVDS_DETECTED (1 << 1)
9177 #define _PCH_DP_B 0xe4100
9178 #define PCH_DP_B _MMIO(_PCH_DP_B)
9179 #define _PCH_DPB_AUX_CH_CTL 0xe4110
9180 #define _PCH_DPB_AUX_CH_DATA1 0xe4114
9181 #define _PCH_DPB_AUX_CH_DATA2 0xe4118
9182 #define _PCH_DPB_AUX_CH_DATA3 0xe411c
9183 #define _PCH_DPB_AUX_CH_DATA4 0xe4120
9184 #define _PCH_DPB_AUX_CH_DATA5 0xe4124
9186 #define _PCH_DP_C 0xe4200
9187 #define PCH_DP_C _MMIO(_PCH_DP_C)
9188 #define _PCH_DPC_AUX_CH_CTL 0xe4210
9189 #define _PCH_DPC_AUX_CH_DATA1 0xe4214
9190 #define _PCH_DPC_AUX_CH_DATA2 0xe4218
9191 #define _PCH_DPC_AUX_CH_DATA3 0xe421c
9192 #define _PCH_DPC_AUX_CH_DATA4 0xe4220
9193 #define _PCH_DPC_AUX_CH_DATA5 0xe4224
9195 #define _PCH_DP_D 0xe4300
9196 #define PCH_DP_D _MMIO(_PCH_DP_D)
9197 #define _PCH_DPD_AUX_CH_CTL 0xe4310
9198 #define _PCH_DPD_AUX_CH_DATA1 0xe4314
9199 #define _PCH_DPD_AUX_CH_DATA2 0xe4318
9200 #define _PCH_DPD_AUX_CH_DATA3 0xe431c
9201 #define _PCH_DPD_AUX_CH_DATA4 0xe4320
9202 #define _PCH_DPD_AUX_CH_DATA5 0xe4324
9204 #define PCH_DP_AUX_CH_CTL(aux_ch) _MMIO_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
9205 #define PCH_DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
9208 #define _TRANS_DP_CTL_A 0xe0300
9209 #define _TRANS_DP_CTL_B 0xe1300
9210 #define _TRANS_DP_CTL_C 0xe2300
9211 #define TRANS_DP_CTL(pipe) _MMIO_PIPE(pipe, _TRANS_DP_CTL_A, _TRANS_DP_CTL_B)
9212 #define TRANS_DP_OUTPUT_ENABLE (1 << 31)
9213 #define TRANS_DP_PORT_SEL_MASK (3 << 29)
9214 #define TRANS_DP_PORT_SEL_NONE (3 << 29)
9215 #define TRANS_DP_PORT_SEL(port) (((port) - PORT_B) << 29)
9216 #define TRANS_DP_AUDIO_ONLY (1 << 26)
9217 #define TRANS_DP_ENH_FRAMING (1 << 18)
9218 #define TRANS_DP_8BPC (0 << 9)
9219 #define TRANS_DP_10BPC (1 << 9)
9220 #define TRANS_DP_6BPC (2 << 9)
9221 #define TRANS_DP_12BPC (3 << 9)
9222 #define TRANS_DP_BPC_MASK (3 << 9)
9223 #define TRANS_DP_VSYNC_ACTIVE_HIGH (1 << 4)
9224 #define TRANS_DP_VSYNC_ACTIVE_LOW 0
9225 #define TRANS_DP_HSYNC_ACTIVE_HIGH (1 << 3)
9226 #define TRANS_DP_HSYNC_ACTIVE_LOW 0
9227 #define TRANS_DP_SYNC_MASK (3 << 3)
9229 #define _TRANS_DP2_CTL_A 0x600a0
9230 #define _TRANS_DP2_CTL_B 0x610a0
9231 #define _TRANS_DP2_CTL_C 0x620a0
9232 #define _TRANS_DP2_CTL_D 0x630a0
9233 #define TRANS_DP2_CTL(trans) _MMIO_TRANS(trans, _TRANS_DP2_CTL_A, _TRANS_DP2_CTL_B)
9234 #define TRANS_DP2_128B132B_CHANNEL_CODING REG_BIT(31)
9235 #define TRANS_DP2_PANEL_REPLAY_ENABLE REG_BIT(30)
9236 #define TRANS_DP2_DEBUG_ENABLE REG_BIT(23)
9238 #define _TRANS_DP2_VFREQHIGH_A 0x600a4
9239 #define _TRANS_DP2_VFREQHIGH_B 0x610a4
9240 #define _TRANS_DP2_VFREQHIGH_C 0x620a4
9241 #define _TRANS_DP2_VFREQHIGH_D 0x630a4
9242 #define TRANS_DP2_VFREQHIGH(trans) _MMIO_TRANS(trans, _TRANS_DP2_VFREQHIGH_A, _TRANS_DP2_VFREQHIGH_B)
9243 #define TRANS_DP2_VFREQ_PIXEL_CLOCK_MASK REG_GENMASK(31, 8)
9244 #define TRANS_DP2_VFREQ_PIXEL_CLOCK(clk_hz) REG_FIELD_PREP(TRANS_DP2_VFREQ_PIXEL_CLOCK_MASK, (clk_hz))
9246 #define _TRANS_DP2_VFREQLOW_A 0x600a8
9247 #define _TRANS_DP2_VFREQLOW_B 0x610a8
9248 #define _TRANS_DP2_VFREQLOW_C 0x620a8
9249 #define _TRANS_DP2_VFREQLOW_D 0x630a8
9250 #define TRANS_DP2_VFREQLOW(trans) _MMIO_TRANS(trans, _TRANS_DP2_VFREQLOW_A, _TRANS_DP2_VFREQLOW_B)
9252 /* SNB eDP training params */
9253 /* SNB A-stepping */
9254 #define EDP_LINK_TRAIN_400MV_0DB_SNB_A (0x38 << 22)
9255 #define EDP_LINK_TRAIN_400MV_6DB_SNB_A (0x02 << 22)
9256 #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01 << 22)
9257 #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0 << 22)
9258 /* SNB B-stepping */
9259 #define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0 << 22)
9260 #define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1 << 22)
9261 #define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a << 22)
9262 #define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39 << 22)
9263 #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38 << 22)
9264 #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f << 22)
9267 #define EDP_LINK_TRAIN_400MV_0DB_IVB (0x24 << 22)
9268 #define EDP_LINK_TRAIN_400MV_3_5DB_IVB (0x2a << 22)
9269 #define EDP_LINK_TRAIN_400MV_6DB_IVB (0x2f << 22)
9270 #define EDP_LINK_TRAIN_600MV_0DB_IVB (0x30 << 22)
9271 #define EDP_LINK_TRAIN_600MV_3_5DB_IVB (0x36 << 22)
9272 #define EDP_LINK_TRAIN_800MV_0DB_IVB (0x38 << 22)
9273 #define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x3e << 22)
9276 #define EDP_LINK_TRAIN_500MV_0DB_IVB (0x00 << 22)
9277 #define EDP_LINK_TRAIN_1000MV_0DB_IVB (0x20 << 22)
9278 #define EDP_LINK_TRAIN_500MV_3_5DB_IVB (0x02 << 22)
9279 #define EDP_LINK_TRAIN_1000MV_3_5DB_IVB (0x22 << 22)
9280 #define EDP_LINK_TRAIN_1000MV_6DB_IVB (0x23 << 22)
9282 #define EDP_LINK_TRAIN_VOL_EMP_MASK_IVB (0x3f << 22)
9284 #define VLV_PMWGICZ _MMIO(0x1300a4)
9286 #define RC6_LOCATION _MMIO(0xD40)
9287 #define RC6_CTX_IN_DRAM (1 << 0)
9288 #define RC6_CTX_BASE _MMIO(0xD48)
9289 #define RC6_CTX_BASE_MASK 0xFFFFFFF0
9290 #define PWRCTX_MAXCNT_RCSUNIT _MMIO(0x2054)
9291 #define PWRCTX_MAXCNT_VCSUNIT0 _MMIO(0x12054)
9292 #define PWRCTX_MAXCNT_BCSUNIT _MMIO(0x22054)
9293 #define PWRCTX_MAXCNT_VECSUNIT _MMIO(0x1A054)
9294 #define PWRCTX_MAXCNT_VCSUNIT1 _MMIO(0x1C054)
9295 #define IDLE_TIME_MASK 0xFFFFF
9296 #define FORCEWAKE _MMIO(0xA18C)
9297 #define FORCEWAKE_VLV _MMIO(0x1300b0)
9298 #define FORCEWAKE_ACK_VLV _MMIO(0x1300b4)
9299 #define FORCEWAKE_MEDIA_VLV _MMIO(0x1300b8)
9300 #define FORCEWAKE_ACK_MEDIA_VLV _MMIO(0x1300bc)
9301 #define FORCEWAKE_ACK_HSW _MMIO(0x130044)
9302 #define FORCEWAKE_ACK _MMIO(0x130090)
9303 #define VLV_GTLC_WAKE_CTRL _MMIO(0x130090)
9304 #define VLV_GTLC_RENDER_CTX_EXISTS (1 << 25)
9305 #define VLV_GTLC_MEDIA_CTX_EXISTS (1 << 24)
9306 #define VLV_GTLC_ALLOWWAKEREQ (1 << 0)
9308 #define VLV_GTLC_PW_STATUS _MMIO(0x130094)
9309 #define VLV_GTLC_ALLOWWAKEACK (1 << 0)
9310 #define VLV_GTLC_ALLOWWAKEERR (1 << 1)
9311 #define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5)
9312 #define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7)
9313 #define FORCEWAKE_MT _MMIO(0xa188) /* multi-threaded */
9314 #define FORCEWAKE_MEDIA_GEN9 _MMIO(0xa270)
9315 #define FORCEWAKE_MEDIA_VDBOX_GEN11(n) _MMIO(0xa540 + (n) * 4)
9316 #define FORCEWAKE_MEDIA_VEBOX_GEN11(n) _MMIO(0xa560 + (n) * 4)
9317 #define FORCEWAKE_RENDER_GEN9 _MMIO(0xa278)
9318 #define FORCEWAKE_GT_GEN9 _MMIO(0xa188)
9319 #define FORCEWAKE_ACK_MEDIA_GEN9 _MMIO(0x0D88)
9320 #define FORCEWAKE_ACK_MEDIA_VDBOX_GEN11(n) _MMIO(0x0D50 + (n) * 4)
9321 #define FORCEWAKE_ACK_MEDIA_VEBOX_GEN11(n) _MMIO(0x0D70 + (n) * 4)
9322 #define FORCEWAKE_ACK_RENDER_GEN9 _MMIO(0x0D84)
9323 #define FORCEWAKE_ACK_GT_GEN9 _MMIO(0x130044)
9324 #define FORCEWAKE_KERNEL BIT(0)
9325 #define FORCEWAKE_USER BIT(1)
9326 #define FORCEWAKE_KERNEL_FALLBACK BIT(15)
9327 #define FORCEWAKE_MT_ACK _MMIO(0x130040)
9328 #define ECOBUS _MMIO(0xa180)
9329 #define FORCEWAKE_MT_ENABLE (1 << 5)
9330 #define VLV_SPAREG2H _MMIO(0xA194)
9331 #define GEN9_PWRGT_DOMAIN_STATUS _MMIO(0xA2A0)
9332 #define GEN9_PWRGT_MEDIA_STATUS_MASK (1 << 0)
9333 #define GEN9_PWRGT_RENDER_STATUS_MASK (1 << 1)
9335 #define GTFIFODBG _MMIO(0x120000)
9336 #define GT_FIFO_SBDEDICATE_FREE_ENTRY_CHV (0x1f << 20)
9337 #define GT_FIFO_FREE_ENTRIES_CHV (0x7f << 13)
9338 #define GT_FIFO_SBDROPERR (1 << 6)
9339 #define GT_FIFO_BLOBDROPERR (1 << 5)
9340 #define GT_FIFO_SB_READ_ABORTERR (1 << 4)
9341 #define GT_FIFO_DROPERR (1 << 3)
9342 #define GT_FIFO_OVFERR (1 << 2)
9343 #define GT_FIFO_IAWRERR (1 << 1)
9344 #define GT_FIFO_IARDERR (1 << 0)
9346 #define GTFIFOCTL _MMIO(0x120008)
9347 #define GT_FIFO_FREE_ENTRIES_MASK 0x7f
9348 #define GT_FIFO_NUM_RESERVED_ENTRIES 20
9349 #define GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL (1 << 12)
9350 #define GT_FIFO_CTL_RC6_POLICY_STALL (1 << 11)
9352 #define HSW_IDICR _MMIO(0x9008)
9353 #define IDIHASHMSK(x) (((x) & 0x3f) << 16)
9354 #define HSW_EDRAM_CAP _MMIO(0x120010)
9355 #define EDRAM_ENABLED 0x1
9356 #define EDRAM_NUM_BANKS(cap) (((cap) >> 1) & 0xf)
9357 #define EDRAM_WAYS_IDX(cap) (((cap) >> 5) & 0x7)
9358 #define EDRAM_SETS_IDX(cap) (((cap) >> 8) & 0x3)
9360 #define GEN6_UCGCTL1 _MMIO(0x9400)
9361 # define GEN6_GAMUNIT_CLOCK_GATE_DISABLE (1 << 22)
9362 # define GEN6_EU_TCUNIT_CLOCK_GATE_DISABLE (1 << 16)
9363 # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE (1 << 5)
9364 # define GEN6_CSUNIT_CLOCK_GATE_DISABLE (1 << 7)
9366 #define GEN6_UCGCTL2 _MMIO(0x9404)
9367 # define GEN6_VFUNIT_CLOCK_GATE_DISABLE (1 << 31)
9368 # define GEN7_VDSUNIT_CLOCK_GATE_DISABLE (1 << 30)
9369 # define GEN7_TDLUNIT_CLOCK_GATE_DISABLE (1 << 22)
9370 # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13)
9371 # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12)
9372 # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11)
9374 #define GEN6_UCGCTL3 _MMIO(0x9408)
9375 # define GEN6_OACSUNIT_CLOCK_GATE_DISABLE (1 << 20)
9377 #define GEN7_UCGCTL4 _MMIO(0x940c)
9378 #define GEN7_L3BANK2X_CLOCK_GATE_DISABLE (1 << 25)
9379 #define GEN8_EU_GAUNIT_CLOCK_GATE_DISABLE (1 << 14)
9381 #define GEN6_RCGCTL1 _MMIO(0x9410)
9382 #define GEN6_RCGCTL2 _MMIO(0x9414)
9383 #define GEN6_RSTCTL _MMIO(0x9420)
9385 #define GEN8_UCGCTL6 _MMIO(0x9430)
9386 #define GEN8_GAPSUNIT_CLOCK_GATE_DISABLE (1 << 24)
9387 #define GEN8_SDEUNIT_CLOCK_GATE_DISABLE (1 << 14)
9388 #define GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1 << 28)
9390 #define UNSLCGCTL9430 _MMIO(0x9430)
9391 #define MSQDUNIT_CLKGATE_DIS REG_BIT(3)
9393 #define GEN6_GFXPAUSE _MMIO(0xA000)
9394 #define GEN6_RPNSWREQ _MMIO(0xA008)
9395 #define GEN6_TURBO_DISABLE (1 << 31)
9396 #define GEN6_FREQUENCY(x) ((x) << 25)
9397 #define HSW_FREQUENCY(x) ((x) << 24)
9398 #define GEN9_FREQUENCY(x) ((x) << 23)
9399 #define GEN6_OFFSET(x) ((x) << 19)
9400 #define GEN6_AGGRESSIVE_TURBO (0 << 15)
9401 #define GEN9_SW_REQ_UNSLICE_RATIO_SHIFT 23
9403 #define GEN6_RC_VIDEO_FREQ _MMIO(0xA00C)
9404 #define GEN6_RC_CONTROL _MMIO(0xA090)
9405 #define GEN6_RC_CTL_RC6pp_ENABLE (1 << 16)
9406 #define GEN6_RC_CTL_RC6p_ENABLE (1 << 17)
9407 #define GEN6_RC_CTL_RC6_ENABLE (1 << 18)
9408 #define GEN6_RC_CTL_RC1e_ENABLE (1 << 20)
9409 #define GEN6_RC_CTL_RC7_ENABLE (1 << 22)
9410 #define VLV_RC_CTL_CTX_RST_PARALLEL (1 << 24)
9411 #define GEN7_RC_CTL_TO_MODE (1 << 28)
9412 #define GEN6_RC_CTL_EI_MODE(x) ((x) << 27)
9413 #define GEN6_RC_CTL_HW_ENABLE (1 << 31)
9414 #define GEN6_RP_DOWN_TIMEOUT _MMIO(0xA010)
9415 #define GEN6_RP_INTERRUPT_LIMITS _MMIO(0xA014)
9416 #define GEN6_RPSTAT1 _MMIO(0xA01C)
9417 #define GEN6_CAGF_SHIFT 8
9418 #define HSW_CAGF_SHIFT 7
9419 #define GEN9_CAGF_SHIFT 23
9420 #define GEN6_CAGF_MASK (0x7f << GEN6_CAGF_SHIFT)
9421 #define HSW_CAGF_MASK (0x7f << HSW_CAGF_SHIFT)
9422 #define GEN9_CAGF_MASK (0x1ff << GEN9_CAGF_SHIFT)
9423 #define GEN6_RP_CONTROL _MMIO(0xA024)
9424 #define GEN6_RP_MEDIA_TURBO (1 << 11)
9425 #define GEN6_RP_MEDIA_MODE_MASK (3 << 9)
9426 #define GEN6_RP_MEDIA_HW_TURBO_MODE (3 << 9)
9427 #define GEN6_RP_MEDIA_HW_NORMAL_MODE (2 << 9)
9428 #define GEN6_RP_MEDIA_HW_MODE (1 << 9)
9429 #define GEN6_RP_MEDIA_SW_MODE (0 << 9)
9430 #define GEN6_RP_MEDIA_IS_GFX (1 << 8)
9431 #define GEN6_RP_ENABLE (1 << 7)
9432 #define GEN6_RP_UP_IDLE_MIN (0x1 << 3)
9433 #define GEN6_RP_UP_BUSY_AVG (0x2 << 3)
9434 #define GEN6_RP_UP_BUSY_CONT (0x4 << 3)
9435 #define GEN6_RP_DOWN_IDLE_AVG (0x2 << 0)
9436 #define GEN6_RP_DOWN_IDLE_CONT (0x1 << 0)
9437 #define GEN6_RP_UP_THRESHOLD _MMIO(0xA02C)
9438 #define GEN6_RP_DOWN_THRESHOLD _MMIO(0xA030)
9439 #define GEN6_RP_CUR_UP_EI _MMIO(0xA050)
9440 #define GEN6_RP_EI_MASK 0xffffff
9441 #define GEN6_CURICONT_MASK GEN6_RP_EI_MASK
9442 #define GEN6_RP_CUR_UP _MMIO(0xA054)
9443 #define GEN6_CURBSYTAVG_MASK GEN6_RP_EI_MASK
9444 #define GEN6_RP_PREV_UP _MMIO(0xA058)
9445 #define GEN6_RP_CUR_DOWN_EI _MMIO(0xA05C)
9446 #define GEN6_CURIAVG_MASK GEN6_RP_EI_MASK
9447 #define GEN6_RP_CUR_DOWN _MMIO(0xA060)
9448 #define GEN6_RP_PREV_DOWN _MMIO(0xA064)
9449 #define GEN6_RP_UP_EI _MMIO(0xA068)
9450 #define GEN6_RP_DOWN_EI _MMIO(0xA06C)
9451 #define GEN6_RP_IDLE_HYSTERSIS _MMIO(0xA070)
9452 #define GEN6_RPDEUHWTC _MMIO(0xA080)
9453 #define GEN6_RPDEUC _MMIO(0xA084)
9454 #define GEN6_RPDEUCSW _MMIO(0xA088)
9455 #define GEN6_RC_STATE _MMIO(0xA094)
9456 #define RC_SW_TARGET_STATE_SHIFT 16
9457 #define RC_SW_TARGET_STATE_MASK (7 << RC_SW_TARGET_STATE_SHIFT)
9458 #define GEN6_RC1_WAKE_RATE_LIMIT _MMIO(0xA098)
9459 #define GEN6_RC6_WAKE_RATE_LIMIT _MMIO(0xA09C)
9460 #define GEN6_RC6pp_WAKE_RATE_LIMIT _MMIO(0xA0A0)
9461 #define GEN10_MEDIA_WAKE_RATE_LIMIT _MMIO(0xA0A0)
9462 #define GEN6_RC_EVALUATION_INTERVAL _MMIO(0xA0A8)
9463 #define GEN6_RC_IDLE_HYSTERSIS _MMIO(0xA0AC)
9464 #define GEN6_RC_SLEEP _MMIO(0xA0B0)
9465 #define GEN6_RCUBMABDTMR _MMIO(0xA0B0)
9466 #define GEN6_RC1e_THRESHOLD _MMIO(0xA0B4)
9467 #define GEN6_RC6_THRESHOLD _MMIO(0xA0B8)
9468 #define GEN6_RC6p_THRESHOLD _MMIO(0xA0BC)
9469 #define VLV_RCEDATA _MMIO(0xA0BC)
9470 #define GEN6_RC6pp_THRESHOLD _MMIO(0xA0C0)
9471 #define GEN6_PMINTRMSK _MMIO(0xA168)
9472 #define GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC (1 << 31)
9473 #define ARAT_EXPIRED_INTRMSK (1 << 9)
9474 #define GEN8_MISC_CTRL0 _MMIO(0xA180)
9475 #define VLV_PWRDWNUPCTL _MMIO(0xA294)
9476 #define GEN9_MEDIA_PG_IDLE_HYSTERESIS _MMIO(0xA0C4)
9477 #define GEN9_RENDER_PG_IDLE_HYSTERESIS _MMIO(0xA0C8)
9478 #define GEN9_PG_ENABLE _MMIO(0xA210)
9479 #define GEN9_RENDER_PG_ENABLE REG_BIT(0)
9480 #define GEN9_MEDIA_PG_ENABLE REG_BIT(1)
9481 #define GEN11_MEDIA_SAMPLER_PG_ENABLE REG_BIT(2)
9482 #define VDN_HCP_POWERGATE_ENABLE(n) REG_BIT(3 + 2 * (n))
9483 #define VDN_MFX_POWERGATE_ENABLE(n) REG_BIT(4 + 2 * (n))
9484 #define GEN8_PUSHBUS_CONTROL _MMIO(0xA248)
9485 #define GEN8_PUSHBUS_ENABLE _MMIO(0xA250)
9486 #define GEN8_PUSHBUS_SHIFT _MMIO(0xA25C)
9488 #define VLV_CHICKEN_3 _MMIO(VLV_DISPLAY_BASE + 0x7040C)
9489 #define PIXEL_OVERLAP_CNT_MASK (3 << 30)
9490 #define PIXEL_OVERLAP_CNT_SHIFT 30
9492 #define GEN6_PMISR _MMIO(0x44020)
9493 #define GEN6_PMIMR _MMIO(0x44024) /* rps_lock */
9494 #define GEN6_PMIIR _MMIO(0x44028)
9495 #define GEN6_PMIER _MMIO(0x4402C)
9496 #define GEN6_PM_MBOX_EVENT (1 << 25)
9497 #define GEN6_PM_THERMAL_EVENT (1 << 24)
9500 * For Gen11 these are in the upper word of the GPM_WGBOXPERF
9501 * registers. Shifting is handled on accessing the imr and ier.
9503 #define GEN6_PM_RP_DOWN_TIMEOUT (1 << 6)
9504 #define GEN6_PM_RP_UP_THRESHOLD (1 << 5)
9505 #define GEN6_PM_RP_DOWN_THRESHOLD (1 << 4)
9506 #define GEN6_PM_RP_UP_EI_EXPIRED (1 << 2)
9507 #define GEN6_PM_RP_DOWN_EI_EXPIRED (1 << 1)
9508 #define GEN6_PM_RPS_EVENTS (GEN6_PM_RP_UP_EI_EXPIRED | \
9509 GEN6_PM_RP_UP_THRESHOLD | \
9510 GEN6_PM_RP_DOWN_EI_EXPIRED | \
9511 GEN6_PM_RP_DOWN_THRESHOLD | \
9512 GEN6_PM_RP_DOWN_TIMEOUT)
9514 #define GEN7_GT_SCRATCH(i) _MMIO(0x4F100 + (i) * 4)
9515 #define GEN7_GT_SCRATCH_REG_NUM 8
9517 #define VLV_GTLC_SURVIVABILITY_REG _MMIO(0x130098)
9518 #define VLV_GFX_CLK_STATUS_BIT (1 << 3)
9519 #define VLV_GFX_CLK_FORCE_ON_BIT (1 << 2)
9521 #define GEN6_GT_GFX_RC6_LOCKED _MMIO(0x138104)
9522 #define VLV_COUNTER_CONTROL _MMIO(0x138104)
9523 #define VLV_COUNT_RANGE_HIGH (1 << 15)
9524 #define VLV_MEDIA_RC0_COUNT_EN (1 << 5)
9525 #define VLV_RENDER_RC0_COUNT_EN (1 << 4)
9526 #define VLV_MEDIA_RC6_COUNT_EN (1 << 1)
9527 #define VLV_RENDER_RC6_COUNT_EN (1 << 0)
9528 #define GEN6_GT_GFX_RC6 _MMIO(0x138108)
9529 #define VLV_GT_RENDER_RC6 _MMIO(0x138108)
9530 #define VLV_GT_MEDIA_RC6 _MMIO(0x13810C)
9532 #define GEN6_GT_GFX_RC6p _MMIO(0x13810C)
9533 #define GEN6_GT_GFX_RC6pp _MMIO(0x138110)
9534 #define VLV_RENDER_C0_COUNT _MMIO(0x138118)
9535 #define VLV_MEDIA_C0_COUNT _MMIO(0x13811C)
9537 #define GEN6_PCODE_MAILBOX _MMIO(0x138124)
9538 #define GEN6_PCODE_READY (1 << 31)
9539 #define GEN6_PCODE_ERROR_MASK 0xFF
9540 #define GEN6_PCODE_SUCCESS 0x0
9541 #define GEN6_PCODE_ILLEGAL_CMD 0x1
9542 #define GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x2
9543 #define GEN6_PCODE_TIMEOUT 0x3
9544 #define GEN6_PCODE_UNIMPLEMENTED_CMD 0xFF
9545 #define GEN7_PCODE_TIMEOUT 0x2
9546 #define GEN7_PCODE_ILLEGAL_DATA 0x3
9547 #define GEN11_PCODE_ILLEGAL_SUBCOMMAND 0x4
9548 #define GEN11_PCODE_LOCKED 0x6
9549 #define GEN11_PCODE_REJECTED 0x11
9550 #define GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x10
9551 #define GEN6_PCODE_WRITE_RC6VIDS 0x4
9552 #define GEN6_PCODE_READ_RC6VIDS 0x5
9553 #define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5)
9554 #define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) + 245)
9555 #define BDW_PCODE_DISPLAY_FREQ_CHANGE_REQ 0x18
9556 #define GEN9_PCODE_READ_MEM_LATENCY 0x6
9557 #define GEN9_MEM_LATENCY_LEVEL_MASK 0xFF
9558 #define GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT 8
9559 #define GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT 16
9560 #define GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT 24
9561 #define SKL_PCODE_LOAD_HDCP_KEYS 0x5
9562 #define SKL_PCODE_CDCLK_CONTROL 0x7
9563 #define SKL_CDCLK_PREPARE_FOR_CHANGE 0x3
9564 #define SKL_CDCLK_READY_FOR_CHANGE 0x1
9565 #define GEN6_PCODE_WRITE_MIN_FREQ_TABLE 0x8
9566 #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9
9567 #define GEN6_READ_OC_PARAMS 0xc
9568 #define ICL_PCODE_MEM_SUBSYSYSTEM_INFO 0xd
9569 #define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)
9570 #define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO(point) (((point) << 16) | (0x1 << 8))
9571 #define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8))
9572 #define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe
9573 #define ICL_PCODE_POINTS_RESTRICTED 0x0
9574 #define ICL_PCODE_POINTS_RESTRICTED_MASK 0xf
9575 #define ADLS_PSF_PT_SHIFT 8
9576 #define ADLS_QGV_PT_MASK REG_GENMASK(7, 0)
9577 #define ADLS_PSF_PT_MASK REG_GENMASK(10, 8)
9578 #define GEN6_PCODE_READ_D_COMP 0x10
9579 #define GEN6_PCODE_WRITE_D_COMP 0x11
9580 #define ICL_PCODE_EXIT_TCCOLD 0x12
9581 #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17
9582 #define DISPLAY_IPS_CONTROL 0x19
9583 #define TGL_PCODE_TCCOLD 0x26
9584 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_EXIT_FAILED REG_BIT(0)
9585 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_BLOCK_REQ 0
9586 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_UNBLOCK_REQ REG_BIT(0)
9587 /* See also IPS_CTL */
9588 #define IPS_PCODE_CONTROL (1 << 30)
9589 #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A
9590 #define GEN9_PCODE_SAGV_CONTROL 0x21
9591 #define GEN9_SAGV_DISABLE 0x0
9592 #define GEN9_SAGV_IS_DISABLED 0x1
9593 #define GEN9_SAGV_ENABLE 0x3
9594 #define DG1_PCODE_STATUS 0x7E
9595 #define DG1_UNCORE_GET_INIT_STATUS 0x0
9596 #define DG1_UNCORE_INIT_STATUS_COMPLETE 0x1
9597 #define GEN12_PCODE_READ_SAGV_BLOCK_TIME_US 0x23
9598 #define GEN6_PCODE_DATA _MMIO(0x138128)
9599 #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
9600 #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16
9601 #define GEN6_PCODE_DATA1 _MMIO(0x13812C)
9603 #define GEN6_GT_CORE_STATUS _MMIO(0x138060)
9604 #define GEN6_CORE_CPD_STATE_MASK (7 << 4)
9605 #define GEN6_RCn_MASK 7
9611 #define GEN8_GT_SLICE_INFO _MMIO(0x138064)
9612 #define GEN8_LSLICESTAT_MASK 0x7
9614 #define CHV_POWER_SS0_SIG1 _MMIO(0xa720)
9615 #define CHV_POWER_SS1_SIG1 _MMIO(0xa728)
9616 #define CHV_SS_PG_ENABLE (1 << 1)
9617 #define CHV_EU08_PG_ENABLE (1 << 9)
9618 #define CHV_EU19_PG_ENABLE (1 << 17)
9619 #define CHV_EU210_PG_ENABLE (1 << 25)
9621 #define CHV_POWER_SS0_SIG2 _MMIO(0xa724)
9622 #define CHV_POWER_SS1_SIG2 _MMIO(0xa72c)
9623 #define CHV_EU311_PG_ENABLE (1 << 1)
9625 #define GEN9_SLICE_PGCTL_ACK(slice) _MMIO(0x804c + (slice) * 0x4)
9626 #define GEN10_SLICE_PGCTL_ACK(slice) _MMIO(0x804c + ((slice) / 3) * 0x34 + \
9627 ((slice) % 3) * 0x4)
9628 #define GEN9_PGCTL_SLICE_ACK (1 << 0)
9629 #define GEN9_PGCTL_SS_ACK(subslice) (1 << (2 + (subslice) * 2))
9630 #define GEN10_PGCTL_VALID_SS_MASK(slice) ((slice) == 0 ? 0x7F : 0x1F)
9632 #define GEN9_SS01_EU_PGCTL_ACK(slice) _MMIO(0x805c + (slice) * 0x8)
9633 #define GEN10_SS01_EU_PGCTL_ACK(slice) _MMIO(0x805c + ((slice) / 3) * 0x30 + \
9634 ((slice) % 3) * 0x8)
9635 #define GEN9_SS23_EU_PGCTL_ACK(slice) _MMIO(0x8060 + (slice) * 0x8)
9636 #define GEN10_SS23_EU_PGCTL_ACK(slice) _MMIO(0x8060 + ((slice) / 3) * 0x30 + \
9637 ((slice) % 3) * 0x8)
9638 #define GEN9_PGCTL_SSA_EU08_ACK (1 << 0)
9639 #define GEN9_PGCTL_SSA_EU19_ACK (1 << 2)
9640 #define GEN9_PGCTL_SSA_EU210_ACK (1 << 4)
9641 #define GEN9_PGCTL_SSA_EU311_ACK (1 << 6)
9642 #define GEN9_PGCTL_SSB_EU08_ACK (1 << 8)
9643 #define GEN9_PGCTL_SSB_EU19_ACK (1 << 10)
9644 #define GEN9_PGCTL_SSB_EU210_ACK (1 << 12)
9645 #define GEN9_PGCTL_SSB_EU311_ACK (1 << 14)
9647 #define GEN7_MISCCPCTL _MMIO(0x9424)
9648 #define GEN7_DOP_CLOCK_GATE_ENABLE (1 << 0)
9649 #define GEN8_DOP_CLOCK_GATE_CFCLK_ENABLE (1 << 2)
9650 #define GEN8_DOP_CLOCK_GATE_GUC_ENABLE (1 << 4)
9651 #define GEN8_DOP_CLOCK_GATE_MEDIA_ENABLE (1 << 6)
9653 #define GEN8_GARBCNTL _MMIO(0xB004)
9654 #define GEN9_GAPS_TSV_CREDIT_DISABLE (1 << 7)
9655 #define GEN11_ARBITRATION_PRIO_ORDER_MASK (0x3f << 22)
9656 #define GEN11_HASH_CTRL_EXCL_MASK (0x7f << 0)
9657 #define GEN11_HASH_CTRL_EXCL_BIT0 (1 << 0)
9659 #define GEN11_GLBLINVL _MMIO(0xB404)
9660 #define GEN11_BANK_HASH_ADDR_EXCL_MASK (0x7f << 5)
9661 #define GEN11_BANK_HASH_ADDR_EXCL_BIT0 (1 << 5)
9663 #define GEN10_DFR_RATIO_EN_AND_CHICKEN _MMIO(0x9550)
9664 #define DFR_DISABLE (1 << 9)
9666 #define GEN11_GACB_PERF_CTRL _MMIO(0x4B80)
9667 #define GEN11_HASH_CTRL_MASK (0x3 << 12 | 0xf << 0)
9668 #define GEN11_HASH_CTRL_BIT0 (1 << 0)
9669 #define GEN11_HASH_CTRL_BIT4 (1 << 12)
9671 #define GEN11_LSN_UNSLCVC _MMIO(0xB43C)
9672 #define GEN11_LSN_UNSLCVC_GAFS_HALF_CL2_MAXALLOC (1 << 9)
9673 #define GEN11_LSN_UNSLCVC_GAFS_HALF_SF_MAXALLOC (1 << 7)
9675 #define GEN10_SAMPLER_MODE _MMIO(0xE18C)
9676 #define ENABLE_SMALLPL REG_BIT(15)
9677 #define GEN11_SAMPLER_ENABLE_HEADLESS_MSG REG_BIT(5)
9680 #define GEN7_L3CDERRST1(slice) _MMIO(0xB008 + (slice) * 0x200) /* L3CD Error Status 1 */
9681 #define GEN7_L3CDERRST1_ROW_MASK (0x7ff << 14)
9682 #define GEN7_PARITY_ERROR_VALID (1 << 13)
9683 #define GEN7_L3CDERRST1_BANK_MASK (3 << 11)
9684 #define GEN7_L3CDERRST1_SUBBANK_MASK (7 << 8)
9685 #define GEN7_PARITY_ERROR_ROW(reg) \
9686 (((reg) & GEN7_L3CDERRST1_ROW_MASK) >> 14)
9687 #define GEN7_PARITY_ERROR_BANK(reg) \
9688 (((reg) & GEN7_L3CDERRST1_BANK_MASK) >> 11)
9689 #define GEN7_PARITY_ERROR_SUBBANK(reg) \
9690 (((reg) & GEN7_L3CDERRST1_SUBBANK_MASK) >> 8)
9691 #define GEN7_L3CDERRST1_ENABLE (1 << 7)
9693 #define GEN7_L3LOG(slice, i) _MMIO(0xB070 + (slice) * 0x200 + (i) * 4)
9694 #define GEN7_L3LOG_SIZE 0x80
9696 #define GEN7_HALF_SLICE_CHICKEN1 _MMIO(0xe100) /* IVB GT1 + VLV */
9697 #define GEN7_HALF_SLICE_CHICKEN1_GT2 _MMIO(0xf100)
9698 #define GEN7_MAX_PS_THREAD_DEP (8 << 12)
9699 #define GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE (1 << 10)
9700 #define GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE (1 << 4)
9701 #define GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE (1 << 3)
9703 #define GEN9_HALF_SLICE_CHICKEN5 _MMIO(0xe188)
9704 #define GEN9_DG_MIRROR_FIX_ENABLE (1 << 5)
9705 #define GEN9_CCS_TLB_PREFETCH_ENABLE (1 << 3)
9707 #define GEN8_ROW_CHICKEN _MMIO(0xe4f0)
9708 #define FLOW_CONTROL_ENABLE REG_BIT(15)
9709 #define UGM_BACKUP_MODE REG_BIT(13)
9710 #define MDQ_ARBITRATION_MODE REG_BIT(12)
9711 #define PARTIAL_INSTRUCTION_SHOOTDOWN_DISABLE REG_BIT(8)
9712 #define STALL_DOP_GATING_DISABLE REG_BIT(5)
9713 #define THROTTLE_12_5 REG_GENMASK(4, 2)
9714 #define DISABLE_EARLY_EOT REG_BIT(1)
9716 #define GEN7_ROW_CHICKEN2 _MMIO(0xe4f4)
9717 #define GEN12_DISABLE_READ_SUPPRESSION REG_BIT(15)
9718 #define GEN12_DISABLE_EARLY_READ REG_BIT(14)
9719 #define GEN12_ENABLE_LARGE_GRF_MODE REG_BIT(12)
9720 #define GEN12_PUSH_CONST_DEREF_HOLD_DIS REG_BIT(8)
9722 #define LSC_CHICKEN_BIT_0 _MMIO(0xe7c8)
9723 #define FORCE_1_SUB_MESSAGE_PER_FRAGMENT REG_BIT(15)
9724 #define LSC_CHICKEN_BIT_0_UDW _MMIO(0xe7c8 + 4)
9725 #define DIS_CHAIN_2XSIMD8 REG_BIT(55 - 32)
9726 #define FORCE_SLM_FENCE_SCOPE_TO_TILE REG_BIT(42 - 32)
9727 #define FORCE_UGM_FENCE_SCOPE_TO_TILE REG_BIT(41 - 32)
9728 #define MAXREQS_PER_BANK REG_GENMASK(39 - 32, 37 - 32)
9729 #define DISABLE_128B_EVICTION_COMMAND_UDW REG_BIT(36 - 32)
9731 #define GEN7_ROW_CHICKEN2_GT2 _MMIO(0xf4f4)
9732 #define DOP_CLOCK_GATING_DISABLE (1 << 0)
9733 #define PUSH_CONSTANT_DEREF_DISABLE (1 << 8)
9734 #define GEN11_TDL_CLOCK_GATING_FIX_DISABLE (1 << 1)
9736 #define GEN9_ROW_CHICKEN4 _MMIO(0xe48c)
9737 #define GEN12_DISABLE_GRF_CLEAR REG_BIT(13)
9738 #define GEN12_DISABLE_TDL_PUSH REG_BIT(9)
9739 #define GEN11_DIS_PICK_2ND_EU REG_BIT(7)
9740 #define GEN12_DISABLE_HDR_PAST_PAYLOAD_HOLD_FIX REG_BIT(4)
9742 #define HSW_ROW_CHICKEN3 _MMIO(0xe49c)
9743 #define HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE (1 << 6)
9745 #define HALF_SLICE_CHICKEN2 _MMIO(0xe180)
9746 #define GEN8_ST_PO_DISABLE (1 << 13)
9748 #define HALF_SLICE_CHICKEN3 _MMIO(0xe184)
9749 #define HSW_SAMPLE_C_PERFORMANCE (1 << 9)
9750 #define GEN8_CENTROID_PIXEL_OPT_DIS (1 << 8)
9751 #define GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC (1 << 5)
9752 #define GEN8_SAMPLER_POWER_BYPASS_DIS (1 << 1)
9754 #define GEN9_HALF_SLICE_CHICKEN7 _MMIO(0xe194)
9755 #define DG2_DISABLE_ROUND_ENABLE_ALLOW_FOR_SSLA REG_BIT(15)
9756 #define GEN9_SAMPLER_HASH_COMPRESSED_READ_ADDR REG_BIT(8)
9757 #define GEN9_ENABLE_YV12_BUGFIX REG_BIT(4)
9758 #define GEN9_ENABLE_GPGPU_PREEMPTION REG_BIT(2)
9761 #define G4X_AUD_VID_DID _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x62020)
9762 #define INTEL_AUDIO_DEVCL 0x808629FB
9763 #define INTEL_AUDIO_DEVBLC 0x80862801
9764 #define INTEL_AUDIO_DEVCTG 0x80862802
9766 #define G4X_AUD_CNTL_ST _MMIO(0x620B4)
9767 #define G4X_ELDV_DEVCL_DEVBLC (1 << 13)
9768 #define G4X_ELDV_DEVCTG (1 << 14)
9769 #define G4X_ELD_ADDR_MASK (0xf << 5)
9770 #define G4X_ELD_ACK (1 << 4)
9771 #define G4X_HDMIW_HDMIEDID _MMIO(0x6210C)
9773 #define _IBX_HDMIW_HDMIEDID_A 0xE2050
9774 #define _IBX_HDMIW_HDMIEDID_B 0xE2150
9775 #define IBX_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _IBX_HDMIW_HDMIEDID_A, \
9776 _IBX_HDMIW_HDMIEDID_B)
9777 #define _IBX_AUD_CNTL_ST_A 0xE20B4
9778 #define _IBX_AUD_CNTL_ST_B 0xE21B4
9779 #define IBX_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CNTL_ST_A, \
9781 #define IBX_ELD_BUFFER_SIZE_MASK (0x1f << 10)
9782 #define IBX_ELD_ADDRESS_MASK (0x1f << 5)
9783 #define IBX_ELD_ACK (1 << 4)
9784 #define IBX_AUD_CNTL_ST2 _MMIO(0xE20C0)
9785 #define IBX_CP_READY(port) ((1 << 1) << (((port) - 1) * 4))
9786 #define IBX_ELD_VALID(port) ((1 << 0) << (((port) - 1) * 4))
9788 #define _CPT_HDMIW_HDMIEDID_A 0xE5050
9789 #define _CPT_HDMIW_HDMIEDID_B 0xE5150
9790 #define CPT_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _CPT_HDMIW_HDMIEDID_A, _CPT_HDMIW_HDMIEDID_B)
9791 #define _CPT_AUD_CNTL_ST_A 0xE50B4
9792 #define _CPT_AUD_CNTL_ST_B 0xE51B4
9793 #define CPT_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CNTL_ST_A, _CPT_AUD_CNTL_ST_B)
9794 #define CPT_AUD_CNTRL_ST2 _MMIO(0xE50C0)
9796 #define _VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050)
9797 #define _VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150)
9798 #define VLV_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _VLV_HDMIW_HDMIEDID_A, _VLV_HDMIW_HDMIEDID_B)
9799 #define _VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4)
9800 #define _VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4)
9801 #define VLV_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CNTL_ST_A, _VLV_AUD_CNTL_ST_B)
9802 #define VLV_AUD_CNTL_ST2 _MMIO(VLV_DISPLAY_BASE + 0x620C0)
9804 /* These are the 4 32-bit write offset registers for each stream
9805 * output buffer. It determines the offset from the
9806 * 3DSTATE_SO_BUFFERs that the next streamed vertex output goes to.
9808 #define GEN7_SO_WRITE_OFFSET(n) _MMIO(0x5280 + (n) * 4)
9810 #define _IBX_AUD_CONFIG_A 0xe2000
9811 #define _IBX_AUD_CONFIG_B 0xe2100
9812 #define IBX_AUD_CFG(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CONFIG_A, _IBX_AUD_CONFIG_B)
9813 #define _CPT_AUD_CONFIG_A 0xe5000
9814 #define _CPT_AUD_CONFIG_B 0xe5100
9815 #define CPT_AUD_CFG(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CONFIG_A, _CPT_AUD_CONFIG_B)
9816 #define _VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000)
9817 #define _VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100)
9818 #define VLV_AUD_CFG(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CONFIG_A, _VLV_AUD_CONFIG_B)
9820 #define AUD_CONFIG_N_VALUE_INDEX (1 << 29)
9821 #define AUD_CONFIG_N_PROG_ENABLE (1 << 28)
9822 #define AUD_CONFIG_UPPER_N_SHIFT 20
9823 #define AUD_CONFIG_UPPER_N_MASK (0xff << 20)
9824 #define AUD_CONFIG_LOWER_N_SHIFT 4
9825 #define AUD_CONFIG_LOWER_N_MASK (0xfff << 4)
9826 #define AUD_CONFIG_N_MASK (AUD_CONFIG_UPPER_N_MASK | AUD_CONFIG_LOWER_N_MASK)
9827 #define AUD_CONFIG_N(n) \
9828 (((((n) >> 12) & 0xff) << AUD_CONFIG_UPPER_N_SHIFT) | \
9829 (((n) & 0xfff) << AUD_CONFIG_LOWER_N_SHIFT))
9830 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT 16
9831 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK (0xf << 16)
9832 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 (0 << 16)
9833 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 (1 << 16)
9834 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 (2 << 16)
9835 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 (3 << 16)
9836 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 (4 << 16)
9837 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 (5 << 16)
9838 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 (6 << 16)
9839 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 (7 << 16)
9840 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 (8 << 16)
9841 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 (9 << 16)
9842 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_296703 (10 << 16)
9843 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_297000 (11 << 16)
9844 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_593407 (12 << 16)
9845 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_594000 (13 << 16)
9846 #define AUD_CONFIG_DISABLE_NCTS (1 << 3)
9849 #define _HSW_AUD_CONFIG_A 0x65000
9850 #define _HSW_AUD_CONFIG_B 0x65100
9851 #define HSW_AUD_CFG(trans) _MMIO_TRANS(trans, _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
9853 #define _HSW_AUD_MISC_CTRL_A 0x65010
9854 #define _HSW_AUD_MISC_CTRL_B 0x65110
9855 #define HSW_AUD_MISC_CTRL(trans) _MMIO_TRANS(trans, _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
9857 #define _HSW_AUD_M_CTS_ENABLE_A 0x65028
9858 #define _HSW_AUD_M_CTS_ENABLE_B 0x65128
9859 #define HSW_AUD_M_CTS_ENABLE(trans) _MMIO_TRANS(trans, _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
9860 #define AUD_M_CTS_M_VALUE_INDEX (1 << 21)
9861 #define AUD_M_CTS_M_PROG_ENABLE (1 << 20)
9862 #define AUD_CONFIG_M_MASK 0xfffff
9864 #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4
9865 #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4
9866 #define HSW_AUD_DIP_ELD_CTRL(trans) _MMIO_TRANS(trans, _HSW_AUD_DIP_ELD_CTRL_ST_A, _HSW_AUD_DIP_ELD_CTRL_ST_B)
9868 /* Audio Digital Converter */
9869 #define _HSW_AUD_DIG_CNVT_1 0x65080
9870 #define _HSW_AUD_DIG_CNVT_2 0x65180
9871 #define AUD_DIG_CNVT(trans) _MMIO_TRANS(trans, _HSW_AUD_DIG_CNVT_1, _HSW_AUD_DIG_CNVT_2)
9872 #define DIP_PORT_SEL_MASK 0x3
9874 #define _HSW_AUD_EDID_DATA_A 0x65050
9875 #define _HSW_AUD_EDID_DATA_B 0x65150
9876 #define HSW_AUD_EDID_DATA(trans) _MMIO_TRANS(trans, _HSW_AUD_EDID_DATA_A, _HSW_AUD_EDID_DATA_B)
9878 #define HSW_AUD_PIPE_CONV_CFG _MMIO(0x6507c)
9879 #define HSW_AUD_PIN_ELD_CP_VLD _MMIO(0x650c0)
9880 #define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4))
9881 #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4))
9882 #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4))
9883 #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4))
9885 #define _AUD_TCA_DP_2DOT0_CTRL 0x650bc
9886 #define _AUD_TCB_DP_2DOT0_CTRL 0x651bc
9887 #define AUD_DP_2DOT0_CTRL(trans) _MMIO_TRANS(trans, _AUD_TCA_DP_2DOT0_CTRL, _AUD_TCB_DP_2DOT0_CTRL)
9888 #define AUD_ENABLE_SDP_SPLIT REG_BIT(31)
9890 #define HSW_AUD_CHICKENBIT _MMIO(0x65f10)
9891 #define SKL_AUD_CODEC_WAKE_SIGNAL (1 << 15)
9893 #define AUD_FREQ_CNTRL _MMIO(0x65900)
9894 #define AUD_PIN_BUF_CTL _MMIO(0x48414)
9895 #define AUD_PIN_BUF_ENABLE REG_BIT(31)
9897 /* Display Audio Config Reg */
9898 #define AUD_CONFIG_BE _MMIO(0x65ef0)
9899 #define HBLANK_EARLY_ENABLE_ICL(pipe) (0x1 << (20 - (pipe)))
9900 #define HBLANK_EARLY_ENABLE_TGL(pipe) (0x1 << (24 + (pipe)))
9901 #define HBLANK_START_COUNT_MASK(pipe) (0x7 << (3 + ((pipe) * 6)))
9902 #define HBLANK_START_COUNT(pipe, val) (((val) & 0x7) << (3 + ((pipe)) * 6))
9903 #define NUMBER_SAMPLES_PER_LINE_MASK(pipe) (0x3 << ((pipe) * 6))
9904 #define NUMBER_SAMPLES_PER_LINE(pipe, val) (((val) & 0x3) << ((pipe) * 6))
9906 #define HBLANK_START_COUNT_8 0
9907 #define HBLANK_START_COUNT_16 1
9908 #define HBLANK_START_COUNT_32 2
9909 #define HBLANK_START_COUNT_64 3
9910 #define HBLANK_START_COUNT_96 4
9911 #define HBLANK_START_COUNT_128 5
9914 * HSW - ICL power wells
9916 * Platforms have up to 3 power well control register sets, each set
9917 * controlling up to 16 power wells via a request/status HW flag tuple:
9918 * - main (HSW_PWR_WELL_CTL[1-4])
9919 * - AUX (ICL_PWR_WELL_CTL_AUX[1-4])
9920 * - DDI (ICL_PWR_WELL_CTL_DDI[1-4])
9921 * Each control register set consists of up to 4 registers used by different
9922 * sources that can request a power well to be enabled:
9923 * - BIOS (HSW_PWR_WELL_CTL1/ICL_PWR_WELL_CTL_AUX1/ICL_PWR_WELL_CTL_DDI1)
9924 * - DRIVER (HSW_PWR_WELL_CTL2/ICL_PWR_WELL_CTL_AUX2/ICL_PWR_WELL_CTL_DDI2)
9925 * - KVMR (HSW_PWR_WELL_CTL3) (only in the main register set)
9926 * - DEBUG (HSW_PWR_WELL_CTL4/ICL_PWR_WELL_CTL_AUX4/ICL_PWR_WELL_CTL_DDI4)
9928 #define HSW_PWR_WELL_CTL1 _MMIO(0x45400)
9929 #define HSW_PWR_WELL_CTL2 _MMIO(0x45404)
9930 #define HSW_PWR_WELL_CTL3 _MMIO(0x45408)
9931 #define HSW_PWR_WELL_CTL4 _MMIO(0x4540C)
9932 #define HSW_PWR_WELL_CTL_REQ(pw_idx) (0x2 << ((pw_idx) * 2))
9933 #define HSW_PWR_WELL_CTL_STATE(pw_idx) (0x1 << ((pw_idx) * 2))
9935 /* HSW/BDW power well */
9936 #define HSW_PW_CTL_IDX_GLOBAL 15
9938 /* SKL/BXT/GLK power wells */
9939 #define SKL_PW_CTL_IDX_PW_2 15
9940 #define SKL_PW_CTL_IDX_PW_1 14
9941 #define GLK_PW_CTL_IDX_AUX_C 10
9942 #define GLK_PW_CTL_IDX_AUX_B 9
9943 #define GLK_PW_CTL_IDX_AUX_A 8
9944 #define SKL_PW_CTL_IDX_DDI_D 4
9945 #define SKL_PW_CTL_IDX_DDI_C 3
9946 #define SKL_PW_CTL_IDX_DDI_B 2
9947 #define SKL_PW_CTL_IDX_DDI_A_E 1
9948 #define GLK_PW_CTL_IDX_DDI_A 1
9949 #define SKL_PW_CTL_IDX_MISC_IO 0
9951 /* ICL/TGL - power wells */
9952 #define TGL_PW_CTL_IDX_PW_5 4
9953 #define ICL_PW_CTL_IDX_PW_4 3
9954 #define ICL_PW_CTL_IDX_PW_3 2
9955 #define ICL_PW_CTL_IDX_PW_2 1
9956 #define ICL_PW_CTL_IDX_PW_1 0
9958 /* XE_LPD - power wells */
9959 #define XELPD_PW_CTL_IDX_PW_D 8
9960 #define XELPD_PW_CTL_IDX_PW_C 7
9961 #define XELPD_PW_CTL_IDX_PW_B 6
9962 #define XELPD_PW_CTL_IDX_PW_A 5
9964 #define ICL_PWR_WELL_CTL_AUX1 _MMIO(0x45440)
9965 #define ICL_PWR_WELL_CTL_AUX2 _MMIO(0x45444)
9966 #define ICL_PWR_WELL_CTL_AUX4 _MMIO(0x4544C)
9967 #define TGL_PW_CTL_IDX_AUX_TBT6 14
9968 #define TGL_PW_CTL_IDX_AUX_TBT5 13
9969 #define TGL_PW_CTL_IDX_AUX_TBT4 12
9970 #define ICL_PW_CTL_IDX_AUX_TBT4 11
9971 #define TGL_PW_CTL_IDX_AUX_TBT3 11
9972 #define ICL_PW_CTL_IDX_AUX_TBT3 10
9973 #define TGL_PW_CTL_IDX_AUX_TBT2 10
9974 #define ICL_PW_CTL_IDX_AUX_TBT2 9
9975 #define TGL_PW_CTL_IDX_AUX_TBT1 9
9976 #define ICL_PW_CTL_IDX_AUX_TBT1 8
9977 #define TGL_PW_CTL_IDX_AUX_TC6 8
9978 #define XELPD_PW_CTL_IDX_AUX_E 8
9979 #define TGL_PW_CTL_IDX_AUX_TC5 7
9980 #define XELPD_PW_CTL_IDX_AUX_D 7
9981 #define TGL_PW_CTL_IDX_AUX_TC4 6
9982 #define ICL_PW_CTL_IDX_AUX_F 5
9983 #define TGL_PW_CTL_IDX_AUX_TC3 5
9984 #define ICL_PW_CTL_IDX_AUX_E 4
9985 #define TGL_PW_CTL_IDX_AUX_TC2 4
9986 #define ICL_PW_CTL_IDX_AUX_D 3
9987 #define TGL_PW_CTL_IDX_AUX_TC1 3
9988 #define ICL_PW_CTL_IDX_AUX_C 2
9989 #define ICL_PW_CTL_IDX_AUX_B 1
9990 #define ICL_PW_CTL_IDX_AUX_A 0
9992 #define ICL_PWR_WELL_CTL_DDI1 _MMIO(0x45450)
9993 #define ICL_PWR_WELL_CTL_DDI2 _MMIO(0x45454)
9994 #define ICL_PWR_WELL_CTL_DDI4 _MMIO(0x4545C)
9995 #define XELPD_PW_CTL_IDX_DDI_E 8
9996 #define TGL_PW_CTL_IDX_DDI_TC6 8
9997 #define XELPD_PW_CTL_IDX_DDI_D 7
9998 #define TGL_PW_CTL_IDX_DDI_TC5 7
9999 #define TGL_PW_CTL_IDX_DDI_TC4 6
10000 #define ICL_PW_CTL_IDX_DDI_F 5
10001 #define TGL_PW_CTL_IDX_DDI_TC3 5
10002 #define ICL_PW_CTL_IDX_DDI_E 4
10003 #define TGL_PW_CTL_IDX_DDI_TC2 4
10004 #define ICL_PW_CTL_IDX_DDI_D 3
10005 #define TGL_PW_CTL_IDX_DDI_TC1 3
10006 #define ICL_PW_CTL_IDX_DDI_C 2
10007 #define ICL_PW_CTL_IDX_DDI_B 1
10008 #define ICL_PW_CTL_IDX_DDI_A 0
10010 /* HSW - power well misc debug registers */
10011 #define HSW_PWR_WELL_CTL5 _MMIO(0x45410)
10012 #define HSW_PWR_WELL_ENABLE_SINGLE_STEP (1 << 31)
10013 #define HSW_PWR_WELL_PWR_GATE_OVERRIDE (1 << 20)
10014 #define HSW_PWR_WELL_FORCE_ON (1 << 19)
10015 #define HSW_PWR_WELL_CTL6 _MMIO(0x45414)
10017 /* SKL Fuse Status */
10018 enum skl_power_gate {
10026 #define SKL_FUSE_STATUS _MMIO(0x42000)
10027 #define SKL_FUSE_DOWNLOAD_STATUS (1 << 31)
10029 * PG0 is HW controlled, so doesn't have a corresponding power well control knob
10030 * SKL_DISP_PW1_IDX..SKL_DISP_PW2_IDX -> PG1..PG2
10032 #define SKL_PW_CTL_IDX_TO_PG(pw_idx) \
10033 ((pw_idx) - SKL_PW_CTL_IDX_PW_1 + SKL_PG1)
10035 * PG0 is HW controlled, so doesn't have a corresponding power well control knob
10036 * ICL_DISP_PW1_IDX..ICL_DISP_PW4_IDX -> PG1..PG4
10038 #define ICL_PW_CTL_IDX_TO_PG(pw_idx) \
10039 ((pw_idx) - ICL_PW_CTL_IDX_PW_1 + SKL_PG1)
10040 #define SKL_FUSE_PG_DIST_STATUS(pg) (1 << (27 - (pg)))
10042 #define _ICL_AUX_REG_IDX(pw_idx) ((pw_idx) - ICL_PW_CTL_IDX_AUX_A)
10043 #define _ICL_AUX_ANAOVRD1_A 0x162398
10044 #define _ICL_AUX_ANAOVRD1_B 0x6C398
10045 #define ICL_AUX_ANAOVRD1(pw_idx) _MMIO(_PICK(_ICL_AUX_REG_IDX(pw_idx), \
10046 _ICL_AUX_ANAOVRD1_A, \
10047 _ICL_AUX_ANAOVRD1_B))
10048 #define ICL_AUX_ANAOVRD1_LDO_BYPASS (1 << 7)
10049 #define ICL_AUX_ANAOVRD1_ENABLE (1 << 0)
10051 /* HDCP Key Registers */
10052 #define HDCP_KEY_CONF _MMIO(0x66c00)
10053 #define HDCP_AKSV_SEND_TRIGGER BIT(31)
10054 #define HDCP_CLEAR_KEYS_TRIGGER BIT(30)
10055 #define HDCP_KEY_LOAD_TRIGGER BIT(8)
10056 #define HDCP_KEY_STATUS _MMIO(0x66c04)
10057 #define HDCP_FUSE_IN_PROGRESS BIT(7)
10058 #define HDCP_FUSE_ERROR BIT(6)
10059 #define HDCP_FUSE_DONE BIT(5)
10060 #define HDCP_KEY_LOAD_STATUS BIT(1)
10061 #define HDCP_KEY_LOAD_DONE BIT(0)
10062 #define HDCP_AKSV_LO _MMIO(0x66c10)
10063 #define HDCP_AKSV_HI _MMIO(0x66c14)
10065 /* HDCP Repeater Registers */
10066 #define HDCP_REP_CTL _MMIO(0x66d00)
10067 #define HDCP_TRANSA_REP_PRESENT BIT(31)
10068 #define HDCP_TRANSB_REP_PRESENT BIT(30)
10069 #define HDCP_TRANSC_REP_PRESENT BIT(29)
10070 #define HDCP_TRANSD_REP_PRESENT BIT(28)
10071 #define HDCP_DDIB_REP_PRESENT BIT(30)
10072 #define HDCP_DDIA_REP_PRESENT BIT(29)
10073 #define HDCP_DDIC_REP_PRESENT BIT(28)
10074 #define HDCP_DDID_REP_PRESENT BIT(27)
10075 #define HDCP_DDIF_REP_PRESENT BIT(26)
10076 #define HDCP_DDIE_REP_PRESENT BIT(25)
10077 #define HDCP_TRANSA_SHA1_M0 (1 << 20)
10078 #define HDCP_TRANSB_SHA1_M0 (2 << 20)
10079 #define HDCP_TRANSC_SHA1_M0 (3 << 20)
10080 #define HDCP_TRANSD_SHA1_M0 (4 << 20)
10081 #define HDCP_DDIB_SHA1_M0 (1 << 20)
10082 #define HDCP_DDIA_SHA1_M0 (2 << 20)
10083 #define HDCP_DDIC_SHA1_M0 (3 << 20)
10084 #define HDCP_DDID_SHA1_M0 (4 << 20)
10085 #define HDCP_DDIF_SHA1_M0 (5 << 20)
10086 #define HDCP_DDIE_SHA1_M0 (6 << 20) /* Bspec says 5? */
10087 #define HDCP_SHA1_BUSY BIT(16)
10088 #define HDCP_SHA1_READY BIT(17)
10089 #define HDCP_SHA1_COMPLETE BIT(18)
10090 #define HDCP_SHA1_V_MATCH BIT(19)
10091 #define HDCP_SHA1_TEXT_32 (1 << 1)
10092 #define HDCP_SHA1_COMPLETE_HASH (2 << 1)
10093 #define HDCP_SHA1_TEXT_24 (4 << 1)
10094 #define HDCP_SHA1_TEXT_16 (5 << 1)
10095 #define HDCP_SHA1_TEXT_8 (6 << 1)
10096 #define HDCP_SHA1_TEXT_0 (7 << 1)
10097 #define HDCP_SHA_V_PRIME_H0 _MMIO(0x66d04)
10098 #define HDCP_SHA_V_PRIME_H1 _MMIO(0x66d08)
10099 #define HDCP_SHA_V_PRIME_H2 _MMIO(0x66d0C)
10100 #define HDCP_SHA_V_PRIME_H3 _MMIO(0x66d10)
10101 #define HDCP_SHA_V_PRIME_H4 _MMIO(0x66d14)
10102 #define HDCP_SHA_V_PRIME(h) _MMIO((0x66d04 + (h) * 4))
10103 #define HDCP_SHA_TEXT _MMIO(0x66d18)
10105 /* HDCP Auth Registers */
10106 #define _PORTA_HDCP_AUTHENC 0x66800
10107 #define _PORTB_HDCP_AUTHENC 0x66500
10108 #define _PORTC_HDCP_AUTHENC 0x66600
10109 #define _PORTD_HDCP_AUTHENC 0x66700
10110 #define _PORTE_HDCP_AUTHENC 0x66A00
10111 #define _PORTF_HDCP_AUTHENC 0x66900
10112 #define _PORT_HDCP_AUTHENC(port, x) _MMIO(_PICK(port, \
10113 _PORTA_HDCP_AUTHENC, \
10114 _PORTB_HDCP_AUTHENC, \
10115 _PORTC_HDCP_AUTHENC, \
10116 _PORTD_HDCP_AUTHENC, \
10117 _PORTE_HDCP_AUTHENC, \
10118 _PORTF_HDCP_AUTHENC) + (x))
10119 #define PORT_HDCP_CONF(port) _PORT_HDCP_AUTHENC(port, 0x0)
10120 #define _TRANSA_HDCP_CONF 0x66400
10121 #define _TRANSB_HDCP_CONF 0x66500
10122 #define TRANS_HDCP_CONF(trans) _MMIO_TRANS(trans, _TRANSA_HDCP_CONF, \
10124 #define HDCP_CONF(dev_priv, trans, port) \
10125 (GRAPHICS_VER(dev_priv) >= 12 ? \
10126 TRANS_HDCP_CONF(trans) : \
10127 PORT_HDCP_CONF(port))
10129 #define HDCP_CONF_CAPTURE_AN BIT(0)
10130 #define HDCP_CONF_AUTH_AND_ENC (BIT(1) | BIT(0))
10131 #define PORT_HDCP_ANINIT(port) _PORT_HDCP_AUTHENC(port, 0x4)
10132 #define _TRANSA_HDCP_ANINIT 0x66404
10133 #define _TRANSB_HDCP_ANINIT 0x66504
10134 #define TRANS_HDCP_ANINIT(trans) _MMIO_TRANS(trans, \
10135 _TRANSA_HDCP_ANINIT, \
10136 _TRANSB_HDCP_ANINIT)
10137 #define HDCP_ANINIT(dev_priv, trans, port) \
10138 (GRAPHICS_VER(dev_priv) >= 12 ? \
10139 TRANS_HDCP_ANINIT(trans) : \
10140 PORT_HDCP_ANINIT(port))
10142 #define PORT_HDCP_ANLO(port) _PORT_HDCP_AUTHENC(port, 0x8)
10143 #define _TRANSA_HDCP_ANLO 0x66408
10144 #define _TRANSB_HDCP_ANLO 0x66508
10145 #define TRANS_HDCP_ANLO(trans) _MMIO_TRANS(trans, _TRANSA_HDCP_ANLO, \
10147 #define HDCP_ANLO(dev_priv, trans, port) \
10148 (GRAPHICS_VER(dev_priv) >= 12 ? \
10149 TRANS_HDCP_ANLO(trans) : \
10150 PORT_HDCP_ANLO(port))
10152 #define PORT_HDCP_ANHI(port) _PORT_HDCP_AUTHENC(port, 0xC)
10153 #define _TRANSA_HDCP_ANHI 0x6640C
10154 #define _TRANSB_HDCP_ANHI 0x6650C
10155 #define TRANS_HDCP_ANHI(trans) _MMIO_TRANS(trans, _TRANSA_HDCP_ANHI, \
10157 #define HDCP_ANHI(dev_priv, trans, port) \
10158 (GRAPHICS_VER(dev_priv) >= 12 ? \
10159 TRANS_HDCP_ANHI(trans) : \
10160 PORT_HDCP_ANHI(port))
10162 #define PORT_HDCP_BKSVLO(port) _PORT_HDCP_AUTHENC(port, 0x10)
10163 #define _TRANSA_HDCP_BKSVLO 0x66410
10164 #define _TRANSB_HDCP_BKSVLO 0x66510
10165 #define TRANS_HDCP_BKSVLO(trans) _MMIO_TRANS(trans, \
10166 _TRANSA_HDCP_BKSVLO, \
10167 _TRANSB_HDCP_BKSVLO)
10168 #define HDCP_BKSVLO(dev_priv, trans, port) \
10169 (GRAPHICS_VER(dev_priv) >= 12 ? \
10170 TRANS_HDCP_BKSVLO(trans) : \
10171 PORT_HDCP_BKSVLO(port))
10173 #define PORT_HDCP_BKSVHI(port) _PORT_HDCP_AUTHENC(port, 0x14)
10174 #define _TRANSA_HDCP_BKSVHI 0x66414
10175 #define _TRANSB_HDCP_BKSVHI 0x66514
10176 #define TRANS_HDCP_BKSVHI(trans) _MMIO_TRANS(trans, \
10177 _TRANSA_HDCP_BKSVHI, \
10178 _TRANSB_HDCP_BKSVHI)
10179 #define HDCP_BKSVHI(dev_priv, trans, port) \
10180 (GRAPHICS_VER(dev_priv) >= 12 ? \
10181 TRANS_HDCP_BKSVHI(trans) : \
10182 PORT_HDCP_BKSVHI(port))
10184 #define PORT_HDCP_RPRIME(port) _PORT_HDCP_AUTHENC(port, 0x18)
10185 #define _TRANSA_HDCP_RPRIME 0x66418
10186 #define _TRANSB_HDCP_RPRIME 0x66518
10187 #define TRANS_HDCP_RPRIME(trans) _MMIO_TRANS(trans, \
10188 _TRANSA_HDCP_RPRIME, \
10189 _TRANSB_HDCP_RPRIME)
10190 #define HDCP_RPRIME(dev_priv, trans, port) \
10191 (GRAPHICS_VER(dev_priv) >= 12 ? \
10192 TRANS_HDCP_RPRIME(trans) : \
10193 PORT_HDCP_RPRIME(port))
10195 #define PORT_HDCP_STATUS(port) _PORT_HDCP_AUTHENC(port, 0x1C)
10196 #define _TRANSA_HDCP_STATUS 0x6641C
10197 #define _TRANSB_HDCP_STATUS 0x6651C
10198 #define TRANS_HDCP_STATUS(trans) _MMIO_TRANS(trans, \
10199 _TRANSA_HDCP_STATUS, \
10200 _TRANSB_HDCP_STATUS)
10201 #define HDCP_STATUS(dev_priv, trans, port) \
10202 (GRAPHICS_VER(dev_priv) >= 12 ? \
10203 TRANS_HDCP_STATUS(trans) : \
10204 PORT_HDCP_STATUS(port))
10206 #define HDCP_STATUS_STREAM_A_ENC BIT(31)
10207 #define HDCP_STATUS_STREAM_B_ENC BIT(30)
10208 #define HDCP_STATUS_STREAM_C_ENC BIT(29)
10209 #define HDCP_STATUS_STREAM_D_ENC BIT(28)
10210 #define HDCP_STATUS_AUTH BIT(21)
10211 #define HDCP_STATUS_ENC BIT(20)
10212 #define HDCP_STATUS_RI_MATCH BIT(19)
10213 #define HDCP_STATUS_R0_READY BIT(18)
10214 #define HDCP_STATUS_AN_READY BIT(17)
10215 #define HDCP_STATUS_CIPHER BIT(16)
10216 #define HDCP_STATUS_FRAME_CNT(x) (((x) >> 8) & 0xff)
10218 /* HDCP2.2 Registers */
10219 #define _PORTA_HDCP2_BASE 0x66800
10220 #define _PORTB_HDCP2_BASE 0x66500
10221 #define _PORTC_HDCP2_BASE 0x66600
10222 #define _PORTD_HDCP2_BASE 0x66700
10223 #define _PORTE_HDCP2_BASE 0x66A00
10224 #define _PORTF_HDCP2_BASE 0x66900
10225 #define _PORT_HDCP2_BASE(port, x) _MMIO(_PICK((port), \
10226 _PORTA_HDCP2_BASE, \
10227 _PORTB_HDCP2_BASE, \
10228 _PORTC_HDCP2_BASE, \
10229 _PORTD_HDCP2_BASE, \
10230 _PORTE_HDCP2_BASE, \
10231 _PORTF_HDCP2_BASE) + (x))
10233 #define PORT_HDCP2_AUTH(port) _PORT_HDCP2_BASE(port, 0x98)
10234 #define _TRANSA_HDCP2_AUTH 0x66498
10235 #define _TRANSB_HDCP2_AUTH 0x66598
10236 #define TRANS_HDCP2_AUTH(trans) _MMIO_TRANS(trans, _TRANSA_HDCP2_AUTH, \
10237 _TRANSB_HDCP2_AUTH)
10238 #define AUTH_LINK_AUTHENTICATED BIT(31)
10239 #define AUTH_LINK_TYPE BIT(30)
10240 #define AUTH_FORCE_CLR_INPUTCTR BIT(19)
10241 #define AUTH_CLR_KEYS BIT(18)
10242 #define HDCP2_AUTH(dev_priv, trans, port) \
10243 (GRAPHICS_VER(dev_priv) >= 12 ? \
10244 TRANS_HDCP2_AUTH(trans) : \
10245 PORT_HDCP2_AUTH(port))
10247 #define PORT_HDCP2_CTL(port) _PORT_HDCP2_BASE(port, 0xB0)
10248 #define _TRANSA_HDCP2_CTL 0x664B0
10249 #define _TRANSB_HDCP2_CTL 0x665B0
10250 #define TRANS_HDCP2_CTL(trans) _MMIO_TRANS(trans, _TRANSA_HDCP2_CTL, \
10252 #define CTL_LINK_ENCRYPTION_REQ BIT(31)
10253 #define HDCP2_CTL(dev_priv, trans, port) \
10254 (GRAPHICS_VER(dev_priv) >= 12 ? \
10255 TRANS_HDCP2_CTL(trans) : \
10256 PORT_HDCP2_CTL(port))
10258 #define PORT_HDCP2_STATUS(port) _PORT_HDCP2_BASE(port, 0xB4)
10259 #define _TRANSA_HDCP2_STATUS 0x664B4
10260 #define _TRANSB_HDCP2_STATUS 0x665B4
10261 #define TRANS_HDCP2_STATUS(trans) _MMIO_TRANS(trans, \
10262 _TRANSA_HDCP2_STATUS, \
10263 _TRANSB_HDCP2_STATUS)
10264 #define LINK_TYPE_STATUS BIT(22)
10265 #define LINK_AUTH_STATUS BIT(21)
10266 #define LINK_ENCRYPTION_STATUS BIT(20)
10267 #define HDCP2_STATUS(dev_priv, trans, port) \
10268 (GRAPHICS_VER(dev_priv) >= 12 ? \
10269 TRANS_HDCP2_STATUS(trans) : \
10270 PORT_HDCP2_STATUS(port))
10272 #define _PIPEA_HDCP2_STREAM_STATUS 0x668C0
10273 #define _PIPEB_HDCP2_STREAM_STATUS 0x665C0
10274 #define _PIPEC_HDCP2_STREAM_STATUS 0x666C0
10275 #define _PIPED_HDCP2_STREAM_STATUS 0x667C0
10276 #define PIPE_HDCP2_STREAM_STATUS(pipe) _MMIO(_PICK((pipe), \
10277 _PIPEA_HDCP2_STREAM_STATUS, \
10278 _PIPEB_HDCP2_STREAM_STATUS, \
10279 _PIPEC_HDCP2_STREAM_STATUS, \
10280 _PIPED_HDCP2_STREAM_STATUS))
10282 #define _TRANSA_HDCP2_STREAM_STATUS 0x664C0
10283 #define _TRANSB_HDCP2_STREAM_STATUS 0x665C0
10284 #define TRANS_HDCP2_STREAM_STATUS(trans) _MMIO_TRANS(trans, \
10285 _TRANSA_HDCP2_STREAM_STATUS, \
10286 _TRANSB_HDCP2_STREAM_STATUS)
10287 #define STREAM_ENCRYPTION_STATUS BIT(31)
10288 #define STREAM_TYPE_STATUS BIT(30)
10289 #define HDCP2_STREAM_STATUS(dev_priv, trans, port) \
10290 (GRAPHICS_VER(dev_priv) >= 12 ? \
10291 TRANS_HDCP2_STREAM_STATUS(trans) : \
10292 PIPE_HDCP2_STREAM_STATUS(pipe))
10294 #define _PORTA_HDCP2_AUTH_STREAM 0x66F00
10295 #define _PORTB_HDCP2_AUTH_STREAM 0x66F04
10296 #define PORT_HDCP2_AUTH_STREAM(port) _MMIO_PORT(port, \
10297 _PORTA_HDCP2_AUTH_STREAM, \
10298 _PORTB_HDCP2_AUTH_STREAM)
10299 #define _TRANSA_HDCP2_AUTH_STREAM 0x66F00
10300 #define _TRANSB_HDCP2_AUTH_STREAM 0x66F04
10301 #define TRANS_HDCP2_AUTH_STREAM(trans) _MMIO_TRANS(trans, \
10302 _TRANSA_HDCP2_AUTH_STREAM, \
10303 _TRANSB_HDCP2_AUTH_STREAM)
10304 #define AUTH_STREAM_TYPE BIT(31)
10305 #define HDCP2_AUTH_STREAM(dev_priv, trans, port) \
10306 (GRAPHICS_VER(dev_priv) >= 12 ? \
10307 TRANS_HDCP2_AUTH_STREAM(trans) : \
10308 PORT_HDCP2_AUTH_STREAM(port))
10310 /* Per-pipe DDI Function Control */
10311 #define _TRANS_DDI_FUNC_CTL_A 0x60400
10312 #define _TRANS_DDI_FUNC_CTL_B 0x61400
10313 #define _TRANS_DDI_FUNC_CTL_C 0x62400
10314 #define _TRANS_DDI_FUNC_CTL_D 0x63400
10315 #define _TRANS_DDI_FUNC_CTL_EDP 0x6F400
10316 #define _TRANS_DDI_FUNC_CTL_DSI0 0x6b400
10317 #define _TRANS_DDI_FUNC_CTL_DSI1 0x6bc00
10318 #define TRANS_DDI_FUNC_CTL(tran) _MMIO_TRANS2(tran, _TRANS_DDI_FUNC_CTL_A)
10320 #define TRANS_DDI_FUNC_ENABLE (1 << 31)
10321 /* Those bits are ignored by pipe EDP since it can only connect to DDI A */
10322 #define TRANS_DDI_PORT_SHIFT 28
10323 #define TGL_TRANS_DDI_PORT_SHIFT 27
10324 #define TRANS_DDI_PORT_MASK (7 << TRANS_DDI_PORT_SHIFT)
10325 #define TGL_TRANS_DDI_PORT_MASK (0xf << TGL_TRANS_DDI_PORT_SHIFT)
10326 #define TRANS_DDI_SELECT_PORT(x) ((x) << TRANS_DDI_PORT_SHIFT)
10327 #define TGL_TRANS_DDI_SELECT_PORT(x) (((x) + 1) << TGL_TRANS_DDI_PORT_SHIFT)
10328 #define TRANS_DDI_FUNC_CTL_VAL_TO_PORT(val) (((val) & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT)
10329 #define TGL_TRANS_DDI_FUNC_CTL_VAL_TO_PORT(val) ((((val) & TGL_TRANS_DDI_PORT_MASK) >> TGL_TRANS_DDI_PORT_SHIFT) - 1)
10330 #define TRANS_DDI_MODE_SELECT_MASK (7 << 24)
10331 #define TRANS_DDI_MODE_SELECT_HDMI (0 << 24)
10332 #define TRANS_DDI_MODE_SELECT_DVI (1 << 24)
10333 #define TRANS_DDI_MODE_SELECT_DP_SST (2 << 24)
10334 #define TRANS_DDI_MODE_SELECT_DP_MST (3 << 24)
10335 #define TRANS_DDI_MODE_SELECT_FDI_OR_128B132B (4 << 24)
10336 #define TRANS_DDI_BPC_MASK (7 << 20)
10337 #define TRANS_DDI_BPC_8 (0 << 20)
10338 #define TRANS_DDI_BPC_10 (1 << 20)
10339 #define TRANS_DDI_BPC_6 (2 << 20)
10340 #define TRANS_DDI_BPC_12 (3 << 20)
10341 #define TRANS_DDI_PORT_SYNC_MASTER_SELECT_MASK REG_GENMASK(19, 18)
10342 #define TRANS_DDI_PORT_SYNC_MASTER_SELECT(x) REG_FIELD_PREP(TRANS_DDI_PORT_SYNC_MASTER_SELECT_MASK, (x))
10343 #define TRANS_DDI_PVSYNC (1 << 17)
10344 #define TRANS_DDI_PHSYNC (1 << 16)
10345 #define TRANS_DDI_PORT_SYNC_ENABLE REG_BIT(15)
10346 #define TRANS_DDI_EDP_INPUT_MASK (7 << 12)
10347 #define TRANS_DDI_EDP_INPUT_A_ON (0 << 12)
10348 #define TRANS_DDI_EDP_INPUT_A_ONOFF (4 << 12)
10349 #define TRANS_DDI_EDP_INPUT_B_ONOFF (5 << 12)
10350 #define TRANS_DDI_EDP_INPUT_C_ONOFF (6 << 12)
10351 #define TRANS_DDI_EDP_INPUT_D_ONOFF (7 << 12)
10352 #define TRANS_DDI_MST_TRANSPORT_SELECT_MASK REG_GENMASK(11, 10)
10353 #define TRANS_DDI_MST_TRANSPORT_SELECT(trans) \
10354 REG_FIELD_PREP(TRANS_DDI_MST_TRANSPORT_SELECT_MASK, trans)
10355 #define TRANS_DDI_HDCP_SIGNALLING (1 << 9)
10356 #define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1 << 8)
10357 #define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1 << 7)
10358 #define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1 << 6)
10359 #define TRANS_DDI_HDCP_SELECT REG_BIT(5)
10360 #define TRANS_DDI_BFI_ENABLE (1 << 4)
10361 #define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1 << 4)
10362 #define TRANS_DDI_HDMI_SCRAMBLING (1 << 0)
10363 #define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
10364 | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
10365 | TRANS_DDI_HDMI_SCRAMBLING)
10367 #define _TRANS_DDI_FUNC_CTL2_A 0x60404
10368 #define _TRANS_DDI_FUNC_CTL2_B 0x61404
10369 #define _TRANS_DDI_FUNC_CTL2_C 0x62404
10370 #define _TRANS_DDI_FUNC_CTL2_EDP 0x6f404
10371 #define _TRANS_DDI_FUNC_CTL2_DSI0 0x6b404
10372 #define _TRANS_DDI_FUNC_CTL2_DSI1 0x6bc04
10373 #define TRANS_DDI_FUNC_CTL2(tran) _MMIO_TRANS2(tran, _TRANS_DDI_FUNC_CTL2_A)
10374 #define PORT_SYNC_MODE_ENABLE REG_BIT(4)
10375 #define PORT_SYNC_MODE_MASTER_SELECT_MASK REG_GENMASK(2, 0)
10376 #define PORT_SYNC_MODE_MASTER_SELECT(x) REG_FIELD_PREP(PORT_SYNC_MODE_MASTER_SELECT_MASK, (x))
10378 #define TRANS_CMTG_CHICKEN _MMIO(0x6fa90)
10379 #define DISABLE_DPT_CLK_GATING REG_BIT(1)
10381 /* DisplayPort Transport Control */
10382 #define _DP_TP_CTL_A 0x64040
10383 #define _DP_TP_CTL_B 0x64140
10384 #define _TGL_DP_TP_CTL_A 0x60540
10385 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
10386 #define TGL_DP_TP_CTL(tran) _MMIO_TRANS2((tran), _TGL_DP_TP_CTL_A)
10387 #define DP_TP_CTL_ENABLE (1 << 31)
10388 #define DP_TP_CTL_FEC_ENABLE (1 << 30)
10389 #define DP_TP_CTL_MODE_SST (0 << 27)
10390 #define DP_TP_CTL_MODE_MST (1 << 27)
10391 #define DP_TP_CTL_FORCE_ACT (1 << 25)
10392 #define DP_TP_CTL_ENHANCED_FRAME_ENABLE (1 << 18)
10393 #define DP_TP_CTL_FDI_AUTOTRAIN (1 << 15)
10394 #define DP_TP_CTL_LINK_TRAIN_MASK (7 << 8)
10395 #define DP_TP_CTL_LINK_TRAIN_PAT1 (0 << 8)
10396 #define DP_TP_CTL_LINK_TRAIN_PAT2 (1 << 8)
10397 #define DP_TP_CTL_LINK_TRAIN_PAT3 (4 << 8)
10398 #define DP_TP_CTL_LINK_TRAIN_PAT4 (5 << 8)
10399 #define DP_TP_CTL_LINK_TRAIN_IDLE (2 << 8)
10400 #define DP_TP_CTL_LINK_TRAIN_NORMAL (3 << 8)
10401 #define DP_TP_CTL_SCRAMBLE_DISABLE (1 << 7)
10403 /* DisplayPort Transport Status */
10404 #define _DP_TP_STATUS_A 0x64044
10405 #define _DP_TP_STATUS_B 0x64144
10406 #define _TGL_DP_TP_STATUS_A 0x60544
10407 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
10408 #define TGL_DP_TP_STATUS(tran) _MMIO_TRANS2((tran), _TGL_DP_TP_STATUS_A)
10409 #define DP_TP_STATUS_FEC_ENABLE_LIVE (1 << 28)
10410 #define DP_TP_STATUS_IDLE_DONE (1 << 25)
10411 #define DP_TP_STATUS_ACT_SENT (1 << 24)
10412 #define DP_TP_STATUS_MODE_STATUS_MST (1 << 23)
10413 #define DP_TP_STATUS_AUTOTRAIN_DONE (1 << 12)
10414 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC2 (3 << 8)
10415 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC1 (3 << 4)
10416 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC0 (3 << 0)
10418 /* DDI Buffer Control */
10419 #define _DDI_BUF_CTL_A 0x64000
10420 #define _DDI_BUF_CTL_B 0x64100
10421 #define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
10422 #define DDI_BUF_CTL_ENABLE (1 << 31)
10423 #define DDI_BUF_TRANS_SELECT(n) ((n) << 24)
10424 #define DDI_BUF_EMP_MASK (0xf << 24)
10425 #define DDI_BUF_PHY_LINK_RATE(r) ((r) << 20)
10426 #define DDI_BUF_PORT_REVERSAL (1 << 16)
10427 #define DDI_BUF_IS_IDLE (1 << 7)
10428 #define DDI_BUF_CTL_TC_PHY_OWNERSHIP REG_BIT(6)
10429 #define DDI_A_4_LANES (1 << 4)
10430 #define DDI_PORT_WIDTH(width) (((width) - 1) << 1)
10431 #define DDI_PORT_WIDTH_MASK (7 << 1)
10432 #define DDI_PORT_WIDTH_SHIFT 1
10433 #define DDI_INIT_DISPLAY_DETECTED (1 << 0)
10435 /* DDI Buffer Translations */
10436 #define _DDI_BUF_TRANS_A 0x64E00
10437 #define _DDI_BUF_TRANS_B 0x64E60
10438 #define DDI_BUF_TRANS_LO(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8)
10439 #define DDI_BUF_BALANCE_LEG_ENABLE (1 << 31)
10440 #define DDI_BUF_TRANS_HI(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8 + 4)
10442 /* DDI DP Compliance Control */
10443 #define _DDI_DP_COMP_CTL_A 0x605F0
10444 #define _DDI_DP_COMP_CTL_B 0x615F0
10445 #define DDI_DP_COMP_CTL(pipe) _MMIO_PIPE(pipe, _DDI_DP_COMP_CTL_A, _DDI_DP_COMP_CTL_B)
10446 #define DDI_DP_COMP_CTL_ENABLE (1 << 31)
10447 #define DDI_DP_COMP_CTL_D10_2 (0 << 28)
10448 #define DDI_DP_COMP_CTL_SCRAMBLED_0 (1 << 28)
10449 #define DDI_DP_COMP_CTL_PRBS7 (2 << 28)
10450 #define DDI_DP_COMP_CTL_CUSTOM80 (3 << 28)
10451 #define DDI_DP_COMP_CTL_HBR2 (4 << 28)
10452 #define DDI_DP_COMP_CTL_SCRAMBLED_1 (5 << 28)
10453 #define DDI_DP_COMP_CTL_HBR2_RESET (0xFC << 0)
10455 /* DDI DP Compliance Pattern */
10456 #define _DDI_DP_COMP_PAT_A 0x605F4
10457 #define _DDI_DP_COMP_PAT_B 0x615F4
10458 #define DDI_DP_COMP_PAT(pipe, i) _MMIO(_PIPE(pipe, _DDI_DP_COMP_PAT_A, _DDI_DP_COMP_PAT_B) + (i) * 4)
10460 /* Sideband Interface (SBI) is programmed indirectly, via
10461 * SBI_ADDR, which contains the register offset; and SBI_DATA,
10462 * which contains the payload */
10463 #define SBI_ADDR _MMIO(0xC6000)
10464 #define SBI_DATA _MMIO(0xC6004)
10465 #define SBI_CTL_STAT _MMIO(0xC6008)
10466 #define SBI_CTL_DEST_ICLK (0x0 << 16)
10467 #define SBI_CTL_DEST_MPHY (0x1 << 16)
10468 #define SBI_CTL_OP_IORD (0x2 << 8)
10469 #define SBI_CTL_OP_IOWR (0x3 << 8)
10470 #define SBI_CTL_OP_CRRD (0x6 << 8)
10471 #define SBI_CTL_OP_CRWR (0x7 << 8)
10472 #define SBI_RESPONSE_FAIL (0x1 << 1)
10473 #define SBI_RESPONSE_SUCCESS (0x0 << 1)
10474 #define SBI_BUSY (0x1 << 0)
10475 #define SBI_READY (0x0 << 0)
10478 #define SBI_SSCDIVINTPHASE 0x0200
10479 #define SBI_SSCDIVINTPHASE6 0x0600
10480 #define SBI_SSCDIVINTPHASE_DIVSEL_SHIFT 1
10481 #define SBI_SSCDIVINTPHASE_DIVSEL_MASK (0x7f << 1)
10482 #define SBI_SSCDIVINTPHASE_DIVSEL(x) ((x) << 1)
10483 #define SBI_SSCDIVINTPHASE_INCVAL_SHIFT 8
10484 #define SBI_SSCDIVINTPHASE_INCVAL_MASK (0x7f << 8)
10485 #define SBI_SSCDIVINTPHASE_INCVAL(x) ((x) << 8)
10486 #define SBI_SSCDIVINTPHASE_DIR(x) ((x) << 15)
10487 #define SBI_SSCDIVINTPHASE_PROPAGATE (1 << 0)
10488 #define SBI_SSCDITHPHASE 0x0204
10489 #define SBI_SSCCTL 0x020c
10490 #define SBI_SSCCTL6 0x060C
10491 #define SBI_SSCCTL_PATHALT (1 << 3)
10492 #define SBI_SSCCTL_DISABLE (1 << 0)
10493 #define SBI_SSCAUXDIV6 0x0610
10494 #define SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT 4
10495 #define SBI_SSCAUXDIV_FINALDIV2SEL_MASK (1 << 4)
10496 #define SBI_SSCAUXDIV_FINALDIV2SEL(x) ((x) << 4)
10497 #define SBI_DBUFF0 0x2a00
10498 #define SBI_GEN0 0x1f00
10499 #define SBI_GEN0_CFG_BUFFENABLE_DISABLE (1 << 0)
10501 /* LPT PIXCLK_GATE */
10502 #define PIXCLK_GATE _MMIO(0xC6020)
10503 #define PIXCLK_GATE_UNGATE (1 << 0)
10504 #define PIXCLK_GATE_GATE (0 << 0)
10507 #define SPLL_CTL _MMIO(0x46020)
10508 #define SPLL_PLL_ENABLE (1 << 31)
10509 #define SPLL_REF_BCLK (0 << 28)
10510 #define SPLL_REF_MUXED_SSC (1 << 28) /* CPU SSC if fused enabled, PCH SSC otherwise */
10511 #define SPLL_REF_NON_SSC_HSW (2 << 28)
10512 #define SPLL_REF_PCH_SSC_BDW (2 << 28)
10513 #define SPLL_REF_LCPLL (3 << 28)
10514 #define SPLL_REF_MASK (3 << 28)
10515 #define SPLL_FREQ_810MHz (0 << 26)
10516 #define SPLL_FREQ_1350MHz (1 << 26)
10517 #define SPLL_FREQ_2700MHz (2 << 26)
10518 #define SPLL_FREQ_MASK (3 << 26)
10521 #define _WRPLL_CTL1 0x46040
10522 #define _WRPLL_CTL2 0x46060
10523 #define WRPLL_CTL(pll) _MMIO_PIPE(pll, _WRPLL_CTL1, _WRPLL_CTL2)
10524 #define WRPLL_PLL_ENABLE (1 << 31)
10525 #define WRPLL_REF_BCLK (0 << 28)
10526 #define WRPLL_REF_PCH_SSC (1 << 28)
10527 #define WRPLL_REF_MUXED_SSC_BDW (2 << 28) /* CPU SSC if fused enabled, PCH SSC otherwise */
10528 #define WRPLL_REF_SPECIAL_HSW (2 << 28) /* muxed SSC (ULT), non-SSC (non-ULT) */
10529 #define WRPLL_REF_LCPLL (3 << 28)
10530 #define WRPLL_REF_MASK (3 << 28)
10531 /* WRPLL divider programming */
10532 #define WRPLL_DIVIDER_REFERENCE(x) ((x) << 0)
10533 #define WRPLL_DIVIDER_REF_MASK (0xff)
10534 #define WRPLL_DIVIDER_POST(x) ((x) << 8)
10535 #define WRPLL_DIVIDER_POST_MASK (0x3f << 8)
10536 #define WRPLL_DIVIDER_POST_SHIFT 8
10537 #define WRPLL_DIVIDER_FEEDBACK(x) ((x) << 16)
10538 #define WRPLL_DIVIDER_FB_SHIFT 16
10539 #define WRPLL_DIVIDER_FB_MASK (0xff << 16)
10541 /* Port clock selection */
10542 #define _PORT_CLK_SEL_A 0x46100
10543 #define _PORT_CLK_SEL_B 0x46104
10544 #define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
10545 #define PORT_CLK_SEL_LCPLL_2700 (0 << 29)
10546 #define PORT_CLK_SEL_LCPLL_1350 (1 << 29)
10547 #define PORT_CLK_SEL_LCPLL_810 (2 << 29)
10548 #define PORT_CLK_SEL_SPLL (3 << 29)
10549 #define PORT_CLK_SEL_WRPLL(pll) (((pll) + 4) << 29)
10550 #define PORT_CLK_SEL_WRPLL1 (4 << 29)
10551 #define PORT_CLK_SEL_WRPLL2 (5 << 29)
10552 #define PORT_CLK_SEL_NONE (7 << 29)
10553 #define PORT_CLK_SEL_MASK (7 << 29)
10555 /* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */
10556 #define DDI_CLK_SEL(port) PORT_CLK_SEL(port)
10557 #define DDI_CLK_SEL_NONE (0x0 << 28)
10558 #define DDI_CLK_SEL_MG (0x8 << 28)
10559 #define DDI_CLK_SEL_TBT_162 (0xC << 28)
10560 #define DDI_CLK_SEL_TBT_270 (0xD << 28)
10561 #define DDI_CLK_SEL_TBT_540 (0xE << 28)
10562 #define DDI_CLK_SEL_TBT_810 (0xF << 28)
10563 #define DDI_CLK_SEL_MASK (0xF << 28)
10565 /* Transcoder clock selection */
10566 #define _TRANS_CLK_SEL_A 0x46140
10567 #define _TRANS_CLK_SEL_B 0x46144
10568 #define TRANS_CLK_SEL(tran) _MMIO_TRANS(tran, _TRANS_CLK_SEL_A, _TRANS_CLK_SEL_B)
10569 /* For each transcoder, we need to select the corresponding port clock */
10570 #define TRANS_CLK_SEL_DISABLED (0x0 << 29)
10571 #define TRANS_CLK_SEL_PORT(x) (((x) + 1) << 29)
10572 #define TGL_TRANS_CLK_SEL_DISABLED (0x0 << 28)
10573 #define TGL_TRANS_CLK_SEL_PORT(x) (((x) + 1) << 28)
10576 #define CDCLK_FREQ _MMIO(0x46200)
10578 #define _TRANSA_MSA_MISC 0x60410
10579 #define _TRANSB_MSA_MISC 0x61410
10580 #define _TRANSC_MSA_MISC 0x62410
10581 #define _TRANS_EDP_MSA_MISC 0x6f410
10582 #define TRANS_MSA_MISC(tran) _MMIO_TRANS2(tran, _TRANSA_MSA_MISC)
10583 /* See DP_MSA_MISC_* for the bit definitions */
10585 #define _TRANS_A_SET_CONTEXT_LATENCY 0x6007C
10586 #define _TRANS_B_SET_CONTEXT_LATENCY 0x6107C
10587 #define _TRANS_C_SET_CONTEXT_LATENCY 0x6207C
10588 #define _TRANS_D_SET_CONTEXT_LATENCY 0x6307C
10589 #define TRANS_SET_CONTEXT_LATENCY(tran) _MMIO_TRANS2(tran, _TRANS_A_SET_CONTEXT_LATENCY)
10590 #define TRANS_SET_CONTEXT_LATENCY_MASK REG_GENMASK(15, 0)
10591 #define TRANS_SET_CONTEXT_LATENCY_VALUE(x) REG_FIELD_PREP(TRANS_SET_CONTEXT_LATENCY_MASK, (x))
10593 /* LCPLL Control */
10594 #define LCPLL_CTL _MMIO(0x130040)
10595 #define LCPLL_PLL_DISABLE (1 << 31)
10596 #define LCPLL_PLL_LOCK (1 << 30)
10597 #define LCPLL_REF_NON_SSC (0 << 28)
10598 #define LCPLL_REF_BCLK (2 << 28)
10599 #define LCPLL_REF_PCH_SSC (3 << 28)
10600 #define LCPLL_REF_MASK (3 << 28)
10601 #define LCPLL_CLK_FREQ_MASK (3 << 26)
10602 #define LCPLL_CLK_FREQ_450 (0 << 26)
10603 #define LCPLL_CLK_FREQ_54O_BDW (1 << 26)
10604 #define LCPLL_CLK_FREQ_337_5_BDW (2 << 26)
10605 #define LCPLL_CLK_FREQ_675_BDW (3 << 26)
10606 #define LCPLL_CD_CLOCK_DISABLE (1 << 25)
10607 #define LCPLL_ROOT_CD_CLOCK_DISABLE (1 << 24)
10608 #define LCPLL_CD2X_CLOCK_DISABLE (1 << 23)
10609 #define LCPLL_POWER_DOWN_ALLOW (1 << 22)
10610 #define LCPLL_CD_SOURCE_FCLK (1 << 21)
10611 #define LCPLL_CD_SOURCE_FCLK_DONE (1 << 19)
10618 #define CDCLK_CTL _MMIO(0x46000)
10619 #define CDCLK_FREQ_SEL_MASK (3 << 26)
10620 #define CDCLK_FREQ_450_432 (0 << 26)
10621 #define CDCLK_FREQ_540 (1 << 26)
10622 #define CDCLK_FREQ_337_308 (2 << 26)
10623 #define CDCLK_FREQ_675_617 (3 << 26)
10624 #define BXT_CDCLK_CD2X_DIV_SEL_MASK (3 << 22)
10625 #define BXT_CDCLK_CD2X_DIV_SEL_1 (0 << 22)
10626 #define BXT_CDCLK_CD2X_DIV_SEL_1_5 (1 << 22)
10627 #define BXT_CDCLK_CD2X_DIV_SEL_2 (2 << 22)
10628 #define BXT_CDCLK_CD2X_DIV_SEL_4 (3 << 22)
10629 #define BXT_CDCLK_CD2X_PIPE(pipe) ((pipe) << 20)
10630 #define CDCLK_DIVMUX_CD_OVERRIDE (1 << 19)
10631 #define BXT_CDCLK_CD2X_PIPE_NONE BXT_CDCLK_CD2X_PIPE(3)
10632 #define ICL_CDCLK_CD2X_PIPE(pipe) (_PICK(pipe, 0, 2, 6) << 19)
10633 #define ICL_CDCLK_CD2X_PIPE_NONE (7 << 19)
10634 #define TGL_CDCLK_CD2X_PIPE(pipe) BXT_CDCLK_CD2X_PIPE(pipe)
10635 #define TGL_CDCLK_CD2X_PIPE_NONE ICL_CDCLK_CD2X_PIPE_NONE
10636 #define BXT_CDCLK_SSA_PRECHARGE_ENABLE (1 << 16)
10637 #define CDCLK_FREQ_DECIMAL_MASK (0x7ff)
10640 #define LCPLL1_CTL _MMIO(0x46010)
10641 #define LCPLL2_CTL _MMIO(0x46014)
10642 #define LCPLL_PLL_ENABLE (1 << 31)
10644 /* DPLL control1 */
10645 #define DPLL_CTRL1 _MMIO(0x6C058)
10646 #define DPLL_CTRL1_HDMI_MODE(id) (1 << ((id) * 6 + 5))
10647 #define DPLL_CTRL1_SSC(id) (1 << ((id) * 6 + 4))
10648 #define DPLL_CTRL1_LINK_RATE_MASK(id) (7 << ((id) * 6 + 1))
10649 #define DPLL_CTRL1_LINK_RATE_SHIFT(id) ((id) * 6 + 1)
10650 #define DPLL_CTRL1_LINK_RATE(linkrate, id) ((linkrate) << ((id) * 6 + 1))
10651 #define DPLL_CTRL1_OVERRIDE(id) (1 << ((id) * 6))
10652 #define DPLL_CTRL1_LINK_RATE_2700 0
10653 #define DPLL_CTRL1_LINK_RATE_1350 1
10654 #define DPLL_CTRL1_LINK_RATE_810 2
10655 #define DPLL_CTRL1_LINK_RATE_1620 3
10656 #define DPLL_CTRL1_LINK_RATE_1080 4
10657 #define DPLL_CTRL1_LINK_RATE_2160 5
10659 /* DPLL control2 */
10660 #define DPLL_CTRL2 _MMIO(0x6C05C)
10661 #define DPLL_CTRL2_DDI_CLK_OFF(port) (1 << ((port) + 15))
10662 #define DPLL_CTRL2_DDI_CLK_SEL_MASK(port) (3 << ((port) * 3 + 1))
10663 #define DPLL_CTRL2_DDI_CLK_SEL_SHIFT(port) ((port) * 3 + 1)
10664 #define DPLL_CTRL2_DDI_CLK_SEL(clk, port) ((clk) << ((port) * 3 + 1))
10665 #define DPLL_CTRL2_DDI_SEL_OVERRIDE(port) (1 << ((port) * 3))
10668 #define DPLL_STATUS _MMIO(0x6C060)
10669 #define DPLL_LOCK(id) (1 << ((id) * 8))
10672 #define _DPLL1_CFGCR1 0x6C040
10673 #define _DPLL2_CFGCR1 0x6C048
10674 #define _DPLL3_CFGCR1 0x6C050
10675 #define DPLL_CFGCR1_FREQ_ENABLE (1 << 31)
10676 #define DPLL_CFGCR1_DCO_FRACTION_MASK (0x7fff << 9)
10677 #define DPLL_CFGCR1_DCO_FRACTION(x) ((x) << 9)
10678 #define DPLL_CFGCR1_DCO_INTEGER_MASK (0x1ff)
10680 #define _DPLL1_CFGCR2 0x6C044
10681 #define _DPLL2_CFGCR2 0x6C04C
10682 #define _DPLL3_CFGCR2 0x6C054
10683 #define DPLL_CFGCR2_QDIV_RATIO_MASK (0xff << 8)
10684 #define DPLL_CFGCR2_QDIV_RATIO(x) ((x) << 8)
10685 #define DPLL_CFGCR2_QDIV_MODE(x) ((x) << 7)
10686 #define DPLL_CFGCR2_KDIV_MASK (3 << 5)
10687 #define DPLL_CFGCR2_KDIV(x) ((x) << 5)
10688 #define DPLL_CFGCR2_KDIV_5 (0 << 5)
10689 #define DPLL_CFGCR2_KDIV_2 (1 << 5)
10690 #define DPLL_CFGCR2_KDIV_3 (2 << 5)
10691 #define DPLL_CFGCR2_KDIV_1 (3 << 5)
10692 #define DPLL_CFGCR2_PDIV_MASK (7 << 2)
10693 #define DPLL_CFGCR2_PDIV(x) ((x) << 2)
10694 #define DPLL_CFGCR2_PDIV_1 (0 << 2)
10695 #define DPLL_CFGCR2_PDIV_2 (1 << 2)
10696 #define DPLL_CFGCR2_PDIV_3 (2 << 2)
10697 #define DPLL_CFGCR2_PDIV_7 (4 << 2)
10698 #define DPLL_CFGCR2_PDIV_7_INVALID (5 << 2)
10699 #define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3)
10701 #define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR1)
10702 #define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2)
10705 #define ICL_DPCLKA_CFGCR0 _MMIO(0x164280)
10706 #define ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) (1 << _PICK(phy, 10, 11, 24, 4, 5))
10707 #define RKL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) REG_BIT((phy) + 10)
10708 #define ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port) (1 << ((tc_port) < TC_PORT_4 ? \
10710 (tc_port) - TC_PORT_4 + 21))
10711 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) ((phy) * 2)
10712 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (3 << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10713 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) ((pll) << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10714 #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) _PICK(phy, 0, 2, 4, 27)
10715 #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) \
10716 (3 << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10717 #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) \
10718 ((pll) << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10722 * First registers controls the first A and B, while the second register
10723 * controls the phy C and D. The bits on these registers are the
10724 * same, but refer to different phys
10726 #define _DG1_DPCLKA_CFGCR0 0x164280
10727 #define _DG1_DPCLKA1_CFGCR0 0x16C280
10728 #define _DG1_DPCLKA_PHY_IDX(phy) ((phy) % 2)
10729 #define _DG1_DPCLKA_PLL_IDX(pll) ((pll) % 2)
10730 #define DG1_DPCLKA_CFGCR0(phy) _MMIO_PHY((phy) / 2, \
10731 _DG1_DPCLKA_CFGCR0, \
10732 _DG1_DPCLKA1_CFGCR0)
10733 #define DG1_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) REG_BIT(_DG1_DPCLKA_PHY_IDX(phy) + 10)
10734 #define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) (_DG1_DPCLKA_PHY_IDX(phy) * 2)
10735 #define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) (_DG1_DPCLKA_PLL_IDX(pll) << DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10736 #define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (0x3 << DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10739 #define _ADLS_DPCLKA_CFGCR0 0x164280
10740 #define _ADLS_DPCLKA_CFGCR1 0x1642BC
10741 #define ADLS_DPCLKA_CFGCR(phy) _MMIO_PHY((phy) / 3, \
10742 _ADLS_DPCLKA_CFGCR0, \
10743 _ADLS_DPCLKA_CFGCR1)
10744 #define ADLS_DPCLKA_CFGCR_DDI_SHIFT(phy) (((phy) % 3) * 2)
10745 /* ADLS DPCLKA_CFGCR0 DDI mask */
10746 #define ADLS_DPCLKA_DDII_SEL_MASK REG_GENMASK(5, 4)
10747 #define ADLS_DPCLKA_DDIB_SEL_MASK REG_GENMASK(3, 2)
10748 #define ADLS_DPCLKA_DDIA_SEL_MASK REG_GENMASK(1, 0)
10749 /* ADLS DPCLKA_CFGCR1 DDI mask */
10750 #define ADLS_DPCLKA_DDIK_SEL_MASK REG_GENMASK(3, 2)
10751 #define ADLS_DPCLKA_DDIJ_SEL_MASK REG_GENMASK(1, 0)
10752 #define ADLS_DPCLKA_CFGCR_DDI_CLK_SEL_MASK(phy) _PICK((phy), \
10753 ADLS_DPCLKA_DDIA_SEL_MASK, \
10754 ADLS_DPCLKA_DDIB_SEL_MASK, \
10755 ADLS_DPCLKA_DDII_SEL_MASK, \
10756 ADLS_DPCLKA_DDIJ_SEL_MASK, \
10757 ADLS_DPCLKA_DDIK_SEL_MASK)
10760 #define DPLL0_ENABLE 0x46010
10761 #define DPLL1_ENABLE 0x46014
10762 #define _ADLS_DPLL2_ENABLE 0x46018
10763 #define _ADLS_DPLL3_ENABLE 0x46030
10764 #define PLL_ENABLE (1 << 31)
10765 #define PLL_LOCK (1 << 30)
10766 #define PLL_POWER_ENABLE (1 << 27)
10767 #define PLL_POWER_STATE (1 << 26)
10768 #define ICL_DPLL_ENABLE(pll) _MMIO_PLL3(pll, DPLL0_ENABLE, DPLL1_ENABLE, \
10769 _ADLS_DPLL2_ENABLE, _ADLS_DPLL3_ENABLE)
10771 #define _DG2_PLL3_ENABLE 0x4601C
10773 #define DG2_PLL_ENABLE(pll) _MMIO_PLL3(pll, DPLL0_ENABLE, DPLL1_ENABLE, \
10774 _ADLS_DPLL2_ENABLE, _DG2_PLL3_ENABLE)
10776 #define TBT_PLL_ENABLE _MMIO(0x46020)
10778 #define _MG_PLL1_ENABLE 0x46030
10779 #define _MG_PLL2_ENABLE 0x46034
10780 #define _MG_PLL3_ENABLE 0x46038
10781 #define _MG_PLL4_ENABLE 0x4603C
10782 /* Bits are the same as DPLL0_ENABLE */
10783 #define MG_PLL_ENABLE(tc_port) _MMIO_PORT((tc_port), _MG_PLL1_ENABLE, \
10787 #define DG1_DPLL_ENABLE(pll) _MMIO_PLL3(pll, DPLL0_ENABLE, DPLL1_ENABLE, \
10788 _MG_PLL1_ENABLE, _MG_PLL2_ENABLE)
10790 /* ADL-P Type C PLL */
10791 #define PORTTC1_PLL_ENABLE 0x46038
10792 #define PORTTC2_PLL_ENABLE 0x46040
10794 #define ADLP_PORTTC_PLL_ENABLE(tc_port) _MMIO_PORT((tc_port), \
10795 PORTTC1_PLL_ENABLE, \
10796 PORTTC2_PLL_ENABLE)
10798 #define _MG_REFCLKIN_CTL_PORT1 0x16892C
10799 #define _MG_REFCLKIN_CTL_PORT2 0x16992C
10800 #define _MG_REFCLKIN_CTL_PORT3 0x16A92C
10801 #define _MG_REFCLKIN_CTL_PORT4 0x16B92C
10802 #define MG_REFCLKIN_CTL_OD_2_MUX(x) ((x) << 8)
10803 #define MG_REFCLKIN_CTL_OD_2_MUX_MASK (0x7 << 8)
10804 #define MG_REFCLKIN_CTL(tc_port) _MMIO_PORT((tc_port), \
10805 _MG_REFCLKIN_CTL_PORT1, \
10806 _MG_REFCLKIN_CTL_PORT2)
10808 #define _MG_CLKTOP2_CORECLKCTL1_PORT1 0x1688D8
10809 #define _MG_CLKTOP2_CORECLKCTL1_PORT2 0x1698D8
10810 #define _MG_CLKTOP2_CORECLKCTL1_PORT3 0x16A8D8
10811 #define _MG_CLKTOP2_CORECLKCTL1_PORT4 0x16B8D8
10812 #define MG_CLKTOP2_CORECLKCTL1_B_DIVRATIO(x) ((x) << 16)
10813 #define MG_CLKTOP2_CORECLKCTL1_B_DIVRATIO_MASK (0xff << 16)
10814 #define MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO(x) ((x) << 8)
10815 #define MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO_MASK (0xff << 8)
10816 #define MG_CLKTOP2_CORECLKCTL1(tc_port) _MMIO_PORT((tc_port), \
10817 _MG_CLKTOP2_CORECLKCTL1_PORT1, \
10818 _MG_CLKTOP2_CORECLKCTL1_PORT2)
10820 #define _MG_CLKTOP2_HSCLKCTL_PORT1 0x1688D4
10821 #define _MG_CLKTOP2_HSCLKCTL_PORT2 0x1698D4
10822 #define _MG_CLKTOP2_HSCLKCTL_PORT3 0x16A8D4
10823 #define _MG_CLKTOP2_HSCLKCTL_PORT4 0x16B8D4
10824 #define MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL(x) ((x) << 16)
10825 #define MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL_MASK (0x1 << 16)
10826 #define MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL(x) ((x) << 14)
10827 #define MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL_MASK (0x3 << 14)
10828 #define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_MASK (0x3 << 12)
10829 #define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_2 (0 << 12)
10830 #define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_3 (1 << 12)
10831 #define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_5 (2 << 12)
10832 #define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_7 (3 << 12)
10833 #define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO(x) ((x) << 8)
10834 #define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO_SHIFT 8
10835 #define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO_MASK (0xf << 8)
10836 #define MG_CLKTOP2_HSCLKCTL(tc_port) _MMIO_PORT((tc_port), \
10837 _MG_CLKTOP2_HSCLKCTL_PORT1, \
10838 _MG_CLKTOP2_HSCLKCTL_PORT2)
10840 #define _MG_PLL_DIV0_PORT1 0x168A00
10841 #define _MG_PLL_DIV0_PORT2 0x169A00
10842 #define _MG_PLL_DIV0_PORT3 0x16AA00
10843 #define _MG_PLL_DIV0_PORT4 0x16BA00
10844 #define MG_PLL_DIV0_FRACNEN_H (1 << 30)
10845 #define MG_PLL_DIV0_FBDIV_FRAC_MASK (0x3fffff << 8)
10846 #define MG_PLL_DIV0_FBDIV_FRAC_SHIFT 8
10847 #define MG_PLL_DIV0_FBDIV_FRAC(x) ((x) << 8)
10848 #define MG_PLL_DIV0_FBDIV_INT_MASK (0xff << 0)
10849 #define MG_PLL_DIV0_FBDIV_INT(x) ((x) << 0)
10850 #define MG_PLL_DIV0(tc_port) _MMIO_PORT((tc_port), _MG_PLL_DIV0_PORT1, \
10851 _MG_PLL_DIV0_PORT2)
10853 #define _MG_PLL_DIV1_PORT1 0x168A04
10854 #define _MG_PLL_DIV1_PORT2 0x169A04
10855 #define _MG_PLL_DIV1_PORT3 0x16AA04
10856 #define _MG_PLL_DIV1_PORT4 0x16BA04
10857 #define MG_PLL_DIV1_IREF_NDIVRATIO(x) ((x) << 16)
10858 #define MG_PLL_DIV1_DITHER_DIV_1 (0 << 12)
10859 #define MG_PLL_DIV1_DITHER_DIV_2 (1 << 12)
10860 #define MG_PLL_DIV1_DITHER_DIV_4 (2 << 12)
10861 #define MG_PLL_DIV1_DITHER_DIV_8 (3 << 12)
10862 #define MG_PLL_DIV1_NDIVRATIO(x) ((x) << 4)
10863 #define MG_PLL_DIV1_FBPREDIV_MASK (0xf << 0)
10864 #define MG_PLL_DIV1_FBPREDIV(x) ((x) << 0)
10865 #define MG_PLL_DIV1(tc_port) _MMIO_PORT((tc_port), _MG_PLL_DIV1_PORT1, \
10866 _MG_PLL_DIV1_PORT2)
10868 #define _MG_PLL_LF_PORT1 0x168A08
10869 #define _MG_PLL_LF_PORT2 0x169A08
10870 #define _MG_PLL_LF_PORT3 0x16AA08
10871 #define _MG_PLL_LF_PORT4 0x16BA08
10872 #define MG_PLL_LF_TDCTARGETCNT(x) ((x) << 24)
10873 #define MG_PLL_LF_AFCCNTSEL_256 (0 << 20)
10874 #define MG_PLL_LF_AFCCNTSEL_512 (1 << 20)
10875 #define MG_PLL_LF_GAINCTRL(x) ((x) << 16)
10876 #define MG_PLL_LF_INT_COEFF(x) ((x) << 8)
10877 #define MG_PLL_LF_PROP_COEFF(x) ((x) << 0)
10878 #define MG_PLL_LF(tc_port) _MMIO_PORT((tc_port), _MG_PLL_LF_PORT1, \
10881 #define _MG_PLL_FRAC_LOCK_PORT1 0x168A0C
10882 #define _MG_PLL_FRAC_LOCK_PORT2 0x169A0C
10883 #define _MG_PLL_FRAC_LOCK_PORT3 0x16AA0C
10884 #define _MG_PLL_FRAC_LOCK_PORT4 0x16BA0C
10885 #define MG_PLL_FRAC_LOCK_TRUELOCK_CRIT_32 (1 << 18)
10886 #define MG_PLL_FRAC_LOCK_EARLYLOCK_CRIT_32 (1 << 16)
10887 #define MG_PLL_FRAC_LOCK_LOCKTHRESH(x) ((x) << 11)
10888 #define MG_PLL_FRAC_LOCK_DCODITHEREN (1 << 10)
10889 #define MG_PLL_FRAC_LOCK_FEEDFWRDCAL_EN (1 << 8)
10890 #define MG_PLL_FRAC_LOCK_FEEDFWRDGAIN(x) ((x) << 0)
10891 #define MG_PLL_FRAC_LOCK(tc_port) _MMIO_PORT((tc_port), \
10892 _MG_PLL_FRAC_LOCK_PORT1, \
10893 _MG_PLL_FRAC_LOCK_PORT2)
10895 #define _MG_PLL_SSC_PORT1 0x168A10
10896 #define _MG_PLL_SSC_PORT2 0x169A10
10897 #define _MG_PLL_SSC_PORT3 0x16AA10
10898 #define _MG_PLL_SSC_PORT4 0x16BA10
10899 #define MG_PLL_SSC_EN (1 << 28)
10900 #define MG_PLL_SSC_TYPE(x) ((x) << 26)
10901 #define MG_PLL_SSC_STEPLENGTH(x) ((x) << 16)
10902 #define MG_PLL_SSC_STEPNUM(x) ((x) << 10)
10903 #define MG_PLL_SSC_FLLEN (1 << 9)
10904 #define MG_PLL_SSC_STEPSIZE(x) ((x) << 0)
10905 #define MG_PLL_SSC(tc_port) _MMIO_PORT((tc_port), _MG_PLL_SSC_PORT1, \
10908 #define _MG_PLL_BIAS_PORT1 0x168A14
10909 #define _MG_PLL_BIAS_PORT2 0x169A14
10910 #define _MG_PLL_BIAS_PORT3 0x16AA14
10911 #define _MG_PLL_BIAS_PORT4 0x16BA14
10912 #define MG_PLL_BIAS_BIAS_GB_SEL(x) ((x) << 30)
10913 #define MG_PLL_BIAS_BIAS_GB_SEL_MASK (0x3 << 30)
10914 #define MG_PLL_BIAS_INIT_DCOAMP(x) ((x) << 24)
10915 #define MG_PLL_BIAS_INIT_DCOAMP_MASK (0x3f << 24)
10916 #define MG_PLL_BIAS_BIAS_BONUS(x) ((x) << 16)
10917 #define MG_PLL_BIAS_BIAS_BONUS_MASK (0xff << 16)
10918 #define MG_PLL_BIAS_BIASCAL_EN (1 << 15)
10919 #define MG_PLL_BIAS_CTRIM(x) ((x) << 8)
10920 #define MG_PLL_BIAS_CTRIM_MASK (0x1f << 8)
10921 #define MG_PLL_BIAS_VREF_RDAC(x) ((x) << 5)
10922 #define MG_PLL_BIAS_VREF_RDAC_MASK (0x7 << 5)
10923 #define MG_PLL_BIAS_IREFTRIM(x) ((x) << 0)
10924 #define MG_PLL_BIAS_IREFTRIM_MASK (0x1f << 0)
10925 #define MG_PLL_BIAS(tc_port) _MMIO_PORT((tc_port), _MG_PLL_BIAS_PORT1, \
10926 _MG_PLL_BIAS_PORT2)
10928 #define _MG_PLL_TDC_COLDST_BIAS_PORT1 0x168A18
10929 #define _MG_PLL_TDC_COLDST_BIAS_PORT2 0x169A18
10930 #define _MG_PLL_TDC_COLDST_BIAS_PORT3 0x16AA18
10931 #define _MG_PLL_TDC_COLDST_BIAS_PORT4 0x16BA18
10932 #define MG_PLL_TDC_COLDST_IREFINT_EN (1 << 27)
10933 #define MG_PLL_TDC_COLDST_REFBIAS_START_PULSE_W(x) ((x) << 17)
10934 #define MG_PLL_TDC_COLDST_COLDSTART (1 << 16)
10935 #define MG_PLL_TDC_TDCOVCCORR_EN (1 << 2)
10936 #define MG_PLL_TDC_TDCSEL(x) ((x) << 0)
10937 #define MG_PLL_TDC_COLDST_BIAS(tc_port) _MMIO_PORT((tc_port), \
10938 _MG_PLL_TDC_COLDST_BIAS_PORT1, \
10939 _MG_PLL_TDC_COLDST_BIAS_PORT2)
10941 #define _ICL_DPLL0_CFGCR0 0x164000
10942 #define _ICL_DPLL1_CFGCR0 0x164080
10943 #define ICL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _ICL_DPLL0_CFGCR0, \
10945 #define DPLL_CFGCR0_HDMI_MODE (1 << 30)
10946 #define DPLL_CFGCR0_SSC_ENABLE (1 << 29)
10947 #define DPLL_CFGCR0_SSC_ENABLE_ICL (1 << 25)
10948 #define DPLL_CFGCR0_LINK_RATE_MASK (0xf << 25)
10949 #define DPLL_CFGCR0_LINK_RATE_2700 (0 << 25)
10950 #define DPLL_CFGCR0_LINK_RATE_1350 (1 << 25)
10951 #define DPLL_CFGCR0_LINK_RATE_810 (2 << 25)
10952 #define DPLL_CFGCR0_LINK_RATE_1620 (3 << 25)
10953 #define DPLL_CFGCR0_LINK_RATE_1080 (4 << 25)
10954 #define DPLL_CFGCR0_LINK_RATE_2160 (5 << 25)
10955 #define DPLL_CFGCR0_LINK_RATE_3240 (6 << 25)
10956 #define DPLL_CFGCR0_LINK_RATE_4050 (7 << 25)
10957 #define DPLL_CFGCR0_DCO_FRACTION_MASK (0x7fff << 10)
10958 #define DPLL_CFGCR0_DCO_FRACTION_SHIFT (10)
10959 #define DPLL_CFGCR0_DCO_FRACTION(x) ((x) << 10)
10960 #define DPLL_CFGCR0_DCO_INTEGER_MASK (0x3ff)
10962 #define _ICL_DPLL0_CFGCR1 0x164004
10963 #define _ICL_DPLL1_CFGCR1 0x164084
10964 #define ICL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _ICL_DPLL0_CFGCR1, \
10966 #define DPLL_CFGCR1_QDIV_RATIO_MASK (0xff << 10)
10967 #define DPLL_CFGCR1_QDIV_RATIO_SHIFT (10)
10968 #define DPLL_CFGCR1_QDIV_RATIO(x) ((x) << 10)
10969 #define DPLL_CFGCR1_QDIV_MODE_SHIFT (9)
10970 #define DPLL_CFGCR1_QDIV_MODE(x) ((x) << 9)
10971 #define DPLL_CFGCR1_KDIV_MASK (7 << 6)
10972 #define DPLL_CFGCR1_KDIV_SHIFT (6)
10973 #define DPLL_CFGCR1_KDIV(x) ((x) << 6)
10974 #define DPLL_CFGCR1_KDIV_1 (1 << 6)
10975 #define DPLL_CFGCR1_KDIV_2 (2 << 6)
10976 #define DPLL_CFGCR1_KDIV_3 (4 << 6)
10977 #define DPLL_CFGCR1_PDIV_MASK (0xf << 2)
10978 #define DPLL_CFGCR1_PDIV_SHIFT (2)
10979 #define DPLL_CFGCR1_PDIV(x) ((x) << 2)
10980 #define DPLL_CFGCR1_PDIV_2 (1 << 2)
10981 #define DPLL_CFGCR1_PDIV_3 (2 << 2)
10982 #define DPLL_CFGCR1_PDIV_5 (4 << 2)
10983 #define DPLL_CFGCR1_PDIV_7 (8 << 2)
10984 #define DPLL_CFGCR1_CENTRAL_FREQ (3 << 0)
10985 #define DPLL_CFGCR1_CENTRAL_FREQ_8400 (3 << 0)
10986 #define TGL_DPLL_CFGCR1_CFSELOVRD_NORMAL_XTAL (0 << 0)
10988 #define _TGL_DPLL0_CFGCR0 0x164284
10989 #define _TGL_DPLL1_CFGCR0 0x16428C
10990 #define _TGL_TBTPLL_CFGCR0 0x16429C
10991 #define TGL_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \
10992 _TGL_DPLL1_CFGCR0, \
10993 _TGL_TBTPLL_CFGCR0)
10994 #define RKL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR0, \
10997 #define _TGL_DPLL0_CFGCR1 0x164288
10998 #define _TGL_DPLL1_CFGCR1 0x164290
10999 #define _TGL_TBTPLL_CFGCR1 0x1642A0
11000 #define TGL_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \
11001 _TGL_DPLL1_CFGCR1, \
11002 _TGL_TBTPLL_CFGCR1)
11003 #define RKL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR1, \
11006 #define _DG1_DPLL2_CFGCR0 0x16C284
11007 #define _DG1_DPLL3_CFGCR0 0x16C28C
11008 #define DG1_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \
11009 _TGL_DPLL1_CFGCR0, \
11010 _DG1_DPLL2_CFGCR0, \
11013 #define _DG1_DPLL2_CFGCR1 0x16C288
11014 #define _DG1_DPLL3_CFGCR1 0x16C290
11015 #define DG1_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \
11016 _TGL_DPLL1_CFGCR1, \
11017 _DG1_DPLL2_CFGCR1, \
11020 /* For ADL-S DPLL4_CFGCR0/1 are used to control DPLL2 */
11021 #define _ADLS_DPLL3_CFGCR0 0x1642C0
11022 #define _ADLS_DPLL4_CFGCR0 0x164294
11023 #define ADLS_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \
11024 _TGL_DPLL1_CFGCR0, \
11025 _ADLS_DPLL4_CFGCR0, \
11026 _ADLS_DPLL3_CFGCR0)
11028 #define _ADLS_DPLL3_CFGCR1 0x1642C4
11029 #define _ADLS_DPLL4_CFGCR1 0x164298
11030 #define ADLS_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \
11031 _TGL_DPLL1_CFGCR1, \
11032 _ADLS_DPLL4_CFGCR1, \
11033 _ADLS_DPLL3_CFGCR1)
11035 #define _DKL_PHY1_BASE 0x168000
11036 #define _DKL_PHY2_BASE 0x169000
11037 #define _DKL_PHY3_BASE 0x16A000
11038 #define _DKL_PHY4_BASE 0x16B000
11039 #define _DKL_PHY5_BASE 0x16C000
11040 #define _DKL_PHY6_BASE 0x16D000
11042 /* DEKEL PHY MMIO Address = Phy base + (internal address & ~index_mask) */
11043 #define _DKL_PLL_DIV0 0x200
11044 #define DKL_PLL_DIV0_INTEG_COEFF(x) ((x) << 16)
11045 #define DKL_PLL_DIV0_INTEG_COEFF_MASK (0x1F << 16)
11046 #define DKL_PLL_DIV0_PROP_COEFF(x) ((x) << 12)
11047 #define DKL_PLL_DIV0_PROP_COEFF_MASK (0xF << 12)
11048 #define DKL_PLL_DIV0_FBPREDIV_SHIFT (8)
11049 #define DKL_PLL_DIV0_FBPREDIV(x) ((x) << DKL_PLL_DIV0_FBPREDIV_SHIFT)
11050 #define DKL_PLL_DIV0_FBPREDIV_MASK (0xF << DKL_PLL_DIV0_FBPREDIV_SHIFT)
11051 #define DKL_PLL_DIV0_FBDIV_INT(x) ((x) << 0)
11052 #define DKL_PLL_DIV0_FBDIV_INT_MASK (0xFF << 0)
11053 #define DKL_PLL_DIV0(tc_port) _MMIO(_PORT(tc_port, _DKL_PHY1_BASE, \
11054 _DKL_PHY2_BASE) + \
11057 #define _DKL_PLL_DIV1 0x204
11058 #define DKL_PLL_DIV1_IREF_TRIM(x) ((x) << 16)
11059 #define DKL_PLL_DIV1_IREF_TRIM_MASK (0x1F << 16)
11060 #define DKL_PLL_DIV1_TDC_TARGET_CNT(x) ((x) << 0)
11061 #define DKL_PLL_DIV1_TDC_TARGET_CNT_MASK (0xFF << 0)
11062 #define DKL_PLL_DIV1(tc_port) _MMIO(_PORT(tc_port, _DKL_PHY1_BASE, \
11063 _DKL_PHY2_BASE) + \
11066 #define _DKL_PLL_SSC 0x210
11067 #define DKL_PLL_SSC_IREF_NDIV_RATIO(x) ((x) << 29)
11068 #define DKL_PLL_SSC_IREF_NDIV_RATIO_MASK (0x7 << 29)
11069 #define DKL_PLL_SSC_STEP_LEN(x) ((x) << 16)
11070 #define DKL_PLL_SSC_STEP_LEN_MASK (0xFF << 16)
11071 #define DKL_PLL_SSC_STEP_NUM(x) ((x) << 11)
11072 #define DKL_PLL_SSC_STEP_NUM_MASK (0x7 << 11)
11073 #define DKL_PLL_SSC_EN (1 << 9)
11074 #define DKL_PLL_SSC(tc_port) _MMIO(_PORT(tc_port, _DKL_PHY1_BASE, \
11075 _DKL_PHY2_BASE) + \
11078 #define _DKL_PLL_BIAS 0x214
11079 #define DKL_PLL_BIAS_FRAC_EN_H (1 << 30)
11080 #define DKL_PLL_BIAS_FBDIV_SHIFT (8)
11081 #define DKL_PLL_BIAS_FBDIV_FRAC(x) ((x) << DKL_PLL_BIAS_FBDIV_SHIFT)
11082 #define DKL_PLL_BIAS_FBDIV_FRAC_MASK (0x3FFFFF << DKL_PLL_BIAS_FBDIV_SHIFT)
11083 #define DKL_PLL_BIAS(tc_port) _MMIO(_PORT(tc_port, _DKL_PHY1_BASE, \
11084 _DKL_PHY2_BASE) + \
11087 #define _DKL_PLL_TDC_COLDST_BIAS 0x218
11088 #define DKL_PLL_TDC_SSC_STEP_SIZE(x) ((x) << 8)
11089 #define DKL_PLL_TDC_SSC_STEP_SIZE_MASK (0xFF << 8)
11090 #define DKL_PLL_TDC_FEED_FWD_GAIN(x) ((x) << 0)
11091 #define DKL_PLL_TDC_FEED_FWD_GAIN_MASK (0xFF << 0)
11092 #define DKL_PLL_TDC_COLDST_BIAS(tc_port) _MMIO(_PORT(tc_port, \
11094 _DKL_PHY2_BASE) + \
11095 _DKL_PLL_TDC_COLDST_BIAS)
11097 #define _DKL_REFCLKIN_CTL 0x12C
11098 /* Bits are the same as MG_REFCLKIN_CTL */
11099 #define DKL_REFCLKIN_CTL(tc_port) _MMIO(_PORT(tc_port, \
11101 _DKL_PHY2_BASE) + \
11104 #define _DKL_CLKTOP2_HSCLKCTL 0xD4
11105 /* Bits are the same as MG_CLKTOP2_HSCLKCTL */
11106 #define DKL_CLKTOP2_HSCLKCTL(tc_port) _MMIO(_PORT(tc_port, \
11108 _DKL_PHY2_BASE) + \
11109 _DKL_CLKTOP2_HSCLKCTL)
11111 #define _DKL_CLKTOP2_CORECLKCTL1 0xD8
11112 /* Bits are the same as MG_CLKTOP2_CORECLKCTL1 */
11113 #define DKL_CLKTOP2_CORECLKCTL1(tc_port) _MMIO(_PORT(tc_port, \
11115 _DKL_PHY2_BASE) + \
11116 _DKL_CLKTOP2_CORECLKCTL1)
11118 #define _DKL_TX_DPCNTL0 0x2C0
11119 #define DKL_TX_PRESHOOT_COEFF(x) ((x) << 13)
11120 #define DKL_TX_PRESHOOT_COEFF_MASK (0x1f << 13)
11121 #define DKL_TX_DE_EMPHASIS_COEFF(x) ((x) << 8)
11122 #define DKL_TX_DE_EMPAHSIS_COEFF_MASK (0x1f << 8)
11123 #define DKL_TX_VSWING_CONTROL(x) ((x) << 0)
11124 #define DKL_TX_VSWING_CONTROL_MASK (0x7 << 0)
11125 #define DKL_TX_DPCNTL0(tc_port) _MMIO(_PORT(tc_port, \
11127 _DKL_PHY2_BASE) + \
11130 #define _DKL_TX_DPCNTL1 0x2C4
11131 /* Bits are the same as DKL_TX_DPCNTRL0 */
11132 #define DKL_TX_DPCNTL1(tc_port) _MMIO(_PORT(tc_port, \
11134 _DKL_PHY2_BASE) + \
11137 #define _DKL_TX_DPCNTL2 0x2C8
11138 #define DKL_TX_DP20BITMODE (1 << 2)
11139 #define DKL_TX_DPCNTL2(tc_port) _MMIO(_PORT(tc_port, \
11141 _DKL_PHY2_BASE) + \
11144 #define _DKL_TX_FW_CALIB 0x2F8
11145 #define DKL_TX_CFG_DISABLE_WAIT_INIT (1 << 7)
11146 #define DKL_TX_FW_CALIB(tc_port) _MMIO(_PORT(tc_port, \
11148 _DKL_PHY2_BASE) + \
11151 #define _DKL_TX_PMD_LANE_SUS 0xD00
11152 #define DKL_TX_PMD_LANE_SUS(tc_port) _MMIO(_PORT(tc_port, \
11154 _DKL_PHY2_BASE) + \
11155 _DKL_TX_PMD_LANE_SUS)
11157 #define _DKL_TX_DW17 0xDC4
11158 #define DKL_TX_DW17(tc_port) _MMIO(_PORT(tc_port, \
11160 _DKL_PHY2_BASE) + \
11163 #define _DKL_TX_DW18 0xDC8
11164 #define DKL_TX_DW18(tc_port) _MMIO(_PORT(tc_port, \
11166 _DKL_PHY2_BASE) + \
11169 #define _DKL_DP_MODE 0xA0
11170 #define DKL_DP_MODE(tc_port) _MMIO(_PORT(tc_port, \
11172 _DKL_PHY2_BASE) + \
11175 #define _DKL_CMN_UC_DW27 0x36C
11176 #define DKL_CMN_UC_DW27_UC_HEALTH (0x1 << 15)
11177 #define DKL_CMN_UC_DW_27(tc_port) _MMIO(_PORT(tc_port, \
11179 _DKL_PHY2_BASE) + \
11183 * Each Dekel PHY is addressed through a 4KB aperture. Each PHY has more than
11184 * 4KB of register space, so a separate index is programmed in HIP_INDEX_REG0
11185 * or HIP_INDEX_REG1, based on the port number, to set the upper 2 address
11186 * bits that point the 4KB window into the full PHY register space.
11188 #define _HIP_INDEX_REG0 0x1010A0
11189 #define _HIP_INDEX_REG1 0x1010A4
11190 #define HIP_INDEX_REG(tc_port) _MMIO((tc_port) < 4 ? _HIP_INDEX_REG0 \
11192 #define _HIP_INDEX_SHIFT(tc_port) (8 * ((tc_port) % 4))
11193 #define HIP_INDEX_VAL(tc_port, val) ((val) << _HIP_INDEX_SHIFT(tc_port))
11195 /* BXT display engine PLL */
11196 #define BXT_DE_PLL_CTL _MMIO(0x6d000)
11197 #define BXT_DE_PLL_RATIO(x) (x) /* {60,65,100} * 19.2MHz */
11198 #define BXT_DE_PLL_RATIO_MASK 0xff
11200 #define BXT_DE_PLL_ENABLE _MMIO(0x46070)
11201 #define BXT_DE_PLL_PLL_ENABLE (1 << 31)
11202 #define BXT_DE_PLL_LOCK (1 << 30)
11203 #define BXT_DE_PLL_FREQ_REQ (1 << 23)
11204 #define BXT_DE_PLL_FREQ_REQ_ACK (1 << 22)
11205 #define ICL_CDCLK_PLL_RATIO(x) (x)
11206 #define ICL_CDCLK_PLL_RATIO_MASK 0xff
11209 #define DC_STATE_EN _MMIO(0x45504)
11210 #define DC_STATE_DISABLE 0
11211 #define DC_STATE_EN_DC3CO REG_BIT(30)
11212 #define DC_STATE_DC3CO_STATUS REG_BIT(29)
11213 #define DC_STATE_EN_UPTO_DC5 (1 << 0)
11214 #define DC_STATE_EN_DC9 (1 << 3)
11215 #define DC_STATE_EN_UPTO_DC6 (2 << 0)
11216 #define DC_STATE_EN_UPTO_DC5_DC6_MASK 0x3
11218 #define DC_STATE_DEBUG _MMIO(0x45520)
11219 #define DC_STATE_DEBUG_MASK_CORES (1 << 0)
11220 #define DC_STATE_DEBUG_MASK_MEMORY_UP (1 << 1)
11222 #define BXT_D_CR_DRP0_DUNIT8 0x1000
11223 #define BXT_D_CR_DRP0_DUNIT9 0x1200
11224 #define BXT_D_CR_DRP0_DUNIT_START 8
11225 #define BXT_D_CR_DRP0_DUNIT_END 11
11226 #define BXT_D_CR_DRP0_DUNIT(x) _MMIO(MCHBAR_MIRROR_BASE_SNB + \
11227 _PICK_EVEN((x) - 8, BXT_D_CR_DRP0_DUNIT8,\
11228 BXT_D_CR_DRP0_DUNIT9))
11229 #define BXT_DRAM_RANK_MASK 0x3
11230 #define BXT_DRAM_RANK_SINGLE 0x1
11231 #define BXT_DRAM_RANK_DUAL 0x3
11232 #define BXT_DRAM_WIDTH_MASK (0x3 << 4)
11233 #define BXT_DRAM_WIDTH_SHIFT 4
11234 #define BXT_DRAM_WIDTH_X8 (0x0 << 4)
11235 #define BXT_DRAM_WIDTH_X16 (0x1 << 4)
11236 #define BXT_DRAM_WIDTH_X32 (0x2 << 4)
11237 #define BXT_DRAM_WIDTH_X64 (0x3 << 4)
11238 #define BXT_DRAM_SIZE_MASK (0x7 << 6)
11239 #define BXT_DRAM_SIZE_SHIFT 6
11240 #define BXT_DRAM_SIZE_4GBIT (0x0 << 6)
11241 #define BXT_DRAM_SIZE_6GBIT (0x1 << 6)
11242 #define BXT_DRAM_SIZE_8GBIT (0x2 << 6)
11243 #define BXT_DRAM_SIZE_12GBIT (0x3 << 6)
11244 #define BXT_DRAM_SIZE_16GBIT (0x4 << 6)
11245 #define BXT_DRAM_TYPE_MASK (0x7 << 22)
11246 #define BXT_DRAM_TYPE_SHIFT 22
11247 #define BXT_DRAM_TYPE_DDR3 (0x0 << 22)
11248 #define BXT_DRAM_TYPE_LPDDR3 (0x1 << 22)
11249 #define BXT_DRAM_TYPE_LPDDR4 (0x2 << 22)
11250 #define BXT_DRAM_TYPE_DDR4 (0x4 << 22)
11252 #define SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5E04)
11253 #define DG1_GEAR_TYPE REG_BIT(16)
11255 #define SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5000)
11256 #define SKL_DRAM_DDR_TYPE_MASK (0x3 << 0)
11257 #define SKL_DRAM_DDR_TYPE_DDR4 (0 << 0)
11258 #define SKL_DRAM_DDR_TYPE_DDR3 (1 << 0)
11259 #define SKL_DRAM_DDR_TYPE_LPDDR3 (2 << 0)
11260 #define SKL_DRAM_DDR_TYPE_LPDDR4 (3 << 0)
11262 #define SKL_MAD_DIMM_CH0_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x500C)
11263 #define SKL_MAD_DIMM_CH1_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5010)
11264 #define SKL_DRAM_S_SHIFT 16
11265 #define SKL_DRAM_SIZE_MASK 0x3F
11266 #define SKL_DRAM_WIDTH_MASK (0x3 << 8)
11267 #define SKL_DRAM_WIDTH_SHIFT 8
11268 #define SKL_DRAM_WIDTH_X8 (0x0 << 8)
11269 #define SKL_DRAM_WIDTH_X16 (0x1 << 8)
11270 #define SKL_DRAM_WIDTH_X32 (0x2 << 8)
11271 #define SKL_DRAM_RANK_MASK (0x1 << 10)
11272 #define SKL_DRAM_RANK_SHIFT 10
11273 #define SKL_DRAM_RANK_1 (0x0 << 10)
11274 #define SKL_DRAM_RANK_2 (0x1 << 10)
11275 #define SKL_DRAM_RANK_MASK (0x1 << 10)
11276 #define ICL_DRAM_SIZE_MASK 0x7F
11277 #define ICL_DRAM_WIDTH_MASK (0x3 << 7)
11278 #define ICL_DRAM_WIDTH_SHIFT 7
11279 #define ICL_DRAM_WIDTH_X8 (0x0 << 7)
11280 #define ICL_DRAM_WIDTH_X16 (0x1 << 7)
11281 #define ICL_DRAM_WIDTH_X32 (0x2 << 7)
11282 #define ICL_DRAM_RANK_MASK (0x3 << 9)
11283 #define ICL_DRAM_RANK_SHIFT 9
11284 #define ICL_DRAM_RANK_1 (0x0 << 9)
11285 #define ICL_DRAM_RANK_2 (0x1 << 9)
11286 #define ICL_DRAM_RANK_3 (0x2 << 9)
11287 #define ICL_DRAM_RANK_4 (0x3 << 9)
11289 #define SA_PERF_STATUS_0_0_0_MCHBAR_PC _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5918)
11290 #define DG1_QCLK_RATIO_MASK REG_GENMASK(9, 2)
11291 #define DG1_QCLK_REFERENCE REG_BIT(10)
11293 #define MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x4000)
11294 #define DG1_DRAM_T_RDPRE_MASK REG_GENMASK(16, 11)
11295 #define DG1_DRAM_T_RP_MASK REG_GENMASK(6, 0)
11296 #define MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR_HIGH _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x4004)
11297 #define DG1_DRAM_T_RCD_MASK REG_GENMASK(15, 9)
11298 #define DG1_DRAM_T_RAS_MASK REG_GENMASK(8, 1)
11301 * Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
11302 * since on HSW we can't write to it using intel_uncore_write.
11304 #define D_COMP_HSW _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
11305 #define D_COMP_BDW _MMIO(0x138144)
11306 #define D_COMP_RCOMP_IN_PROGRESS (1 << 9)
11307 #define D_COMP_COMP_FORCE (1 << 8)
11308 #define D_COMP_COMP_DISABLE (1 << 0)
11310 /* Pipe WM_LINETIME - watermark line time */
11311 #define _WM_LINETIME_A 0x45270
11312 #define _WM_LINETIME_B 0x45274
11313 #define WM_LINETIME(pipe) _MMIO_PIPE(pipe, _WM_LINETIME_A, _WM_LINETIME_B)
11314 #define HSW_LINETIME_MASK REG_GENMASK(8, 0)
11315 #define HSW_LINETIME(x) REG_FIELD_PREP(HSW_LINETIME_MASK, (x))
11316 #define HSW_IPS_LINETIME_MASK REG_GENMASK(24, 16)
11317 #define HSW_IPS_LINETIME(x) REG_FIELD_PREP(HSW_IPS_LINETIME_MASK, (x))
11320 #define SFUSE_STRAP _MMIO(0xc2014)
11321 #define SFUSE_STRAP_FUSE_LOCK (1 << 13)
11322 #define SFUSE_STRAP_RAW_FREQUENCY (1 << 8)
11323 #define SFUSE_STRAP_DISPLAY_DISABLED (1 << 7)
11324 #define SFUSE_STRAP_CRT_DISABLED (1 << 6)
11325 #define SFUSE_STRAP_DDIF_DETECTED (1 << 3)
11326 #define SFUSE_STRAP_DDIB_DETECTED (1 << 2)
11327 #define SFUSE_STRAP_DDIC_DETECTED (1 << 1)
11328 #define SFUSE_STRAP_DDID_DETECTED (1 << 0)
11330 #define WM_MISC _MMIO(0x45260)
11331 #define WM_MISC_DATA_PARTITION_5_6 (1 << 0)
11333 #define WM_DBG _MMIO(0x45280)
11334 #define WM_DBG_DISALLOW_MULTIPLE_LP (1 << 0)
11335 #define WM_DBG_DISALLOW_MAXFIFO (1 << 1)
11336 #define WM_DBG_DISALLOW_SPRITE (1 << 2)
11339 #define _PIPE_A_CSC_COEFF_RY_GY 0x49010
11340 #define _PIPE_A_CSC_COEFF_BY 0x49014
11341 #define _PIPE_A_CSC_COEFF_RU_GU 0x49018
11342 #define _PIPE_A_CSC_COEFF_BU 0x4901c
11343 #define _PIPE_A_CSC_COEFF_RV_GV 0x49020
11344 #define _PIPE_A_CSC_COEFF_BV 0x49024
11346 #define _PIPE_A_CSC_MODE 0x49028
11347 #define ICL_CSC_ENABLE (1 << 31) /* icl+ */
11348 #define ICL_OUTPUT_CSC_ENABLE (1 << 30) /* icl+ */
11349 #define CSC_BLACK_SCREEN_OFFSET (1 << 2) /* ilk/snb */
11350 #define CSC_POSITION_BEFORE_GAMMA (1 << 1) /* pre-glk */
11351 #define CSC_MODE_YUV_TO_RGB (1 << 0) /* ilk/snb */
11353 #define _PIPE_A_CSC_PREOFF_HI 0x49030
11354 #define _PIPE_A_CSC_PREOFF_ME 0x49034
11355 #define _PIPE_A_CSC_PREOFF_LO 0x49038
11356 #define _PIPE_A_CSC_POSTOFF_HI 0x49040
11357 #define _PIPE_A_CSC_POSTOFF_ME 0x49044
11358 #define _PIPE_A_CSC_POSTOFF_LO 0x49048
11360 #define _PIPE_B_CSC_COEFF_RY_GY 0x49110
11361 #define _PIPE_B_CSC_COEFF_BY 0x49114
11362 #define _PIPE_B_CSC_COEFF_RU_GU 0x49118
11363 #define _PIPE_B_CSC_COEFF_BU 0x4911c
11364 #define _PIPE_B_CSC_COEFF_RV_GV 0x49120
11365 #define _PIPE_B_CSC_COEFF_BV 0x49124
11366 #define _PIPE_B_CSC_MODE 0x49128
11367 #define _PIPE_B_CSC_PREOFF_HI 0x49130
11368 #define _PIPE_B_CSC_PREOFF_ME 0x49134
11369 #define _PIPE_B_CSC_PREOFF_LO 0x49138
11370 #define _PIPE_B_CSC_POSTOFF_HI 0x49140
11371 #define _PIPE_B_CSC_POSTOFF_ME 0x49144
11372 #define _PIPE_B_CSC_POSTOFF_LO 0x49148
11374 #define PIPE_CSC_COEFF_RY_GY(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RY_GY, _PIPE_B_CSC_COEFF_RY_GY)
11375 #define PIPE_CSC_COEFF_BY(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BY, _PIPE_B_CSC_COEFF_BY)
11376 #define PIPE_CSC_COEFF_RU_GU(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RU_GU, _PIPE_B_CSC_COEFF_RU_GU)
11377 #define PIPE_CSC_COEFF_BU(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BU, _PIPE_B_CSC_COEFF_BU)
11378 #define PIPE_CSC_COEFF_RV_GV(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RV_GV, _PIPE_B_CSC_COEFF_RV_GV)
11379 #define PIPE_CSC_COEFF_BV(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BV, _PIPE_B_CSC_COEFF_BV)
11380 #define PIPE_CSC_MODE(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_MODE, _PIPE_B_CSC_MODE)
11381 #define PIPE_CSC_PREOFF_HI(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_HI, _PIPE_B_CSC_PREOFF_HI)
11382 #define PIPE_CSC_PREOFF_ME(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_ME, _PIPE_B_CSC_PREOFF_ME)
11383 #define PIPE_CSC_PREOFF_LO(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_LO, _PIPE_B_CSC_PREOFF_LO)
11384 #define PIPE_CSC_POSTOFF_HI(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_HI, _PIPE_B_CSC_POSTOFF_HI)
11385 #define PIPE_CSC_POSTOFF_ME(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_ME, _PIPE_B_CSC_POSTOFF_ME)
11386 #define PIPE_CSC_POSTOFF_LO(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_LO, _PIPE_B_CSC_POSTOFF_LO)
11388 /* Pipe Output CSC */
11389 #define _PIPE_A_OUTPUT_CSC_COEFF_RY_GY 0x49050
11390 #define _PIPE_A_OUTPUT_CSC_COEFF_BY 0x49054
11391 #define _PIPE_A_OUTPUT_CSC_COEFF_RU_GU 0x49058
11392 #define _PIPE_A_OUTPUT_CSC_COEFF_BU 0x4905c
11393 #define _PIPE_A_OUTPUT_CSC_COEFF_RV_GV 0x49060
11394 #define _PIPE_A_OUTPUT_CSC_COEFF_BV 0x49064
11395 #define _PIPE_A_OUTPUT_CSC_PREOFF_HI 0x49068
11396 #define _PIPE_A_OUTPUT_CSC_PREOFF_ME 0x4906c
11397 #define _PIPE_A_OUTPUT_CSC_PREOFF_LO 0x49070
11398 #define _PIPE_A_OUTPUT_CSC_POSTOFF_HI 0x49074
11399 #define _PIPE_A_OUTPUT_CSC_POSTOFF_ME 0x49078
11400 #define _PIPE_A_OUTPUT_CSC_POSTOFF_LO 0x4907c
11402 #define _PIPE_B_OUTPUT_CSC_COEFF_RY_GY 0x49150
11403 #define _PIPE_B_OUTPUT_CSC_COEFF_BY 0x49154
11404 #define _PIPE_B_OUTPUT_CSC_COEFF_RU_GU 0x49158
11405 #define _PIPE_B_OUTPUT_CSC_COEFF_BU 0x4915c
11406 #define _PIPE_B_OUTPUT_CSC_COEFF_RV_GV 0x49160
11407 #define _PIPE_B_OUTPUT_CSC_COEFF_BV 0x49164
11408 #define _PIPE_B_OUTPUT_CSC_PREOFF_HI 0x49168
11409 #define _PIPE_B_OUTPUT_CSC_PREOFF_ME 0x4916c
11410 #define _PIPE_B_OUTPUT_CSC_PREOFF_LO 0x49170
11411 #define _PIPE_B_OUTPUT_CSC_POSTOFF_HI 0x49174
11412 #define _PIPE_B_OUTPUT_CSC_POSTOFF_ME 0x49178
11413 #define _PIPE_B_OUTPUT_CSC_POSTOFF_LO 0x4917c
11415 #define PIPE_CSC_OUTPUT_COEFF_RY_GY(pipe) _MMIO_PIPE(pipe,\
11416 _PIPE_A_OUTPUT_CSC_COEFF_RY_GY,\
11417 _PIPE_B_OUTPUT_CSC_COEFF_RY_GY)
11418 #define PIPE_CSC_OUTPUT_COEFF_BY(pipe) _MMIO_PIPE(pipe, \
11419 _PIPE_A_OUTPUT_CSC_COEFF_BY, \
11420 _PIPE_B_OUTPUT_CSC_COEFF_BY)
11421 #define PIPE_CSC_OUTPUT_COEFF_RU_GU(pipe) _MMIO_PIPE(pipe, \
11422 _PIPE_A_OUTPUT_CSC_COEFF_RU_GU, \
11423 _PIPE_B_OUTPUT_CSC_COEFF_RU_GU)
11424 #define PIPE_CSC_OUTPUT_COEFF_BU(pipe) _MMIO_PIPE(pipe, \
11425 _PIPE_A_OUTPUT_CSC_COEFF_BU, \
11426 _PIPE_B_OUTPUT_CSC_COEFF_BU)
11427 #define PIPE_CSC_OUTPUT_COEFF_RV_GV(pipe) _MMIO_PIPE(pipe, \
11428 _PIPE_A_OUTPUT_CSC_COEFF_RV_GV, \
11429 _PIPE_B_OUTPUT_CSC_COEFF_RV_GV)
11430 #define PIPE_CSC_OUTPUT_COEFF_BV(pipe) _MMIO_PIPE(pipe, \
11431 _PIPE_A_OUTPUT_CSC_COEFF_BV, \
11432 _PIPE_B_OUTPUT_CSC_COEFF_BV)
11433 #define PIPE_CSC_OUTPUT_PREOFF_HI(pipe) _MMIO_PIPE(pipe, \
11434 _PIPE_A_OUTPUT_CSC_PREOFF_HI, \
11435 _PIPE_B_OUTPUT_CSC_PREOFF_HI)
11436 #define PIPE_CSC_OUTPUT_PREOFF_ME(pipe) _MMIO_PIPE(pipe, \
11437 _PIPE_A_OUTPUT_CSC_PREOFF_ME, \
11438 _PIPE_B_OUTPUT_CSC_PREOFF_ME)
11439 #define PIPE_CSC_OUTPUT_PREOFF_LO(pipe) _MMIO_PIPE(pipe, \
11440 _PIPE_A_OUTPUT_CSC_PREOFF_LO, \
11441 _PIPE_B_OUTPUT_CSC_PREOFF_LO)
11442 #define PIPE_CSC_OUTPUT_POSTOFF_HI(pipe) _MMIO_PIPE(pipe, \
11443 _PIPE_A_OUTPUT_CSC_POSTOFF_HI, \
11444 _PIPE_B_OUTPUT_CSC_POSTOFF_HI)
11445 #define PIPE_CSC_OUTPUT_POSTOFF_ME(pipe) _MMIO_PIPE(pipe, \
11446 _PIPE_A_OUTPUT_CSC_POSTOFF_ME, \
11447 _PIPE_B_OUTPUT_CSC_POSTOFF_ME)
11448 #define PIPE_CSC_OUTPUT_POSTOFF_LO(pipe) _MMIO_PIPE(pipe, \
11449 _PIPE_A_OUTPUT_CSC_POSTOFF_LO, \
11450 _PIPE_B_OUTPUT_CSC_POSTOFF_LO)
11452 /* pipe degamma/gamma LUTs on IVB+ */
11453 #define _PAL_PREC_INDEX_A 0x4A400
11454 #define _PAL_PREC_INDEX_B 0x4AC00
11455 #define _PAL_PREC_INDEX_C 0x4B400
11456 #define PAL_PREC_10_12_BIT (0 << 31)
11457 #define PAL_PREC_SPLIT_MODE (1 << 31)
11458 #define PAL_PREC_AUTO_INCREMENT (1 << 15)
11459 #define PAL_PREC_INDEX_VALUE_MASK (0x3ff << 0)
11460 #define PAL_PREC_INDEX_VALUE(x) ((x) << 0)
11461 #define _PAL_PREC_DATA_A 0x4A404
11462 #define _PAL_PREC_DATA_B 0x4AC04
11463 #define _PAL_PREC_DATA_C 0x4B404
11464 #define _PAL_PREC_GC_MAX_A 0x4A410
11465 #define _PAL_PREC_GC_MAX_B 0x4AC10
11466 #define _PAL_PREC_GC_MAX_C 0x4B410
11467 #define PREC_PAL_DATA_RED_MASK REG_GENMASK(29, 20)
11468 #define PREC_PAL_DATA_GREEN_MASK REG_GENMASK(19, 10)
11469 #define PREC_PAL_DATA_BLUE_MASK REG_GENMASK(9, 0)
11470 #define _PAL_PREC_EXT_GC_MAX_A 0x4A420
11471 #define _PAL_PREC_EXT_GC_MAX_B 0x4AC20
11472 #define _PAL_PREC_EXT_GC_MAX_C 0x4B420
11473 #define _PAL_PREC_EXT2_GC_MAX_A 0x4A430
11474 #define _PAL_PREC_EXT2_GC_MAX_B 0x4AC30
11475 #define _PAL_PREC_EXT2_GC_MAX_C 0x4B430
11477 #define PREC_PAL_INDEX(pipe) _MMIO_PIPE(pipe, _PAL_PREC_INDEX_A, _PAL_PREC_INDEX_B)
11478 #define PREC_PAL_DATA(pipe) _MMIO_PIPE(pipe, _PAL_PREC_DATA_A, _PAL_PREC_DATA_B)
11479 #define PREC_PAL_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_GC_MAX_A, _PAL_PREC_GC_MAX_B) + (i) * 4)
11480 #define PREC_PAL_EXT_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_EXT_GC_MAX_A, _PAL_PREC_EXT_GC_MAX_B) + (i) * 4)
11481 #define PREC_PAL_EXT2_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_EXT2_GC_MAX_A, _PAL_PREC_EXT2_GC_MAX_B) + (i) * 4)
11483 #define _PRE_CSC_GAMC_INDEX_A 0x4A484
11484 #define _PRE_CSC_GAMC_INDEX_B 0x4AC84
11485 #define _PRE_CSC_GAMC_INDEX_C 0x4B484
11486 #define PRE_CSC_GAMC_AUTO_INCREMENT (1 << 10)
11487 #define _PRE_CSC_GAMC_DATA_A 0x4A488
11488 #define _PRE_CSC_GAMC_DATA_B 0x4AC88
11489 #define _PRE_CSC_GAMC_DATA_C 0x4B488
11491 #define PRE_CSC_GAMC_INDEX(pipe) _MMIO_PIPE(pipe, _PRE_CSC_GAMC_INDEX_A, _PRE_CSC_GAMC_INDEX_B)
11492 #define PRE_CSC_GAMC_DATA(pipe) _MMIO_PIPE(pipe, _PRE_CSC_GAMC_DATA_A, _PRE_CSC_GAMC_DATA_B)
11494 /* ICL Multi segmented gamma */
11495 #define _PAL_PREC_MULTI_SEG_INDEX_A 0x4A408
11496 #define _PAL_PREC_MULTI_SEG_INDEX_B 0x4AC08
11497 #define PAL_PREC_MULTI_SEGMENT_AUTO_INCREMENT REG_BIT(15)
11498 #define PAL_PREC_MULTI_SEGMENT_INDEX_VALUE_MASK REG_GENMASK(4, 0)
11500 #define _PAL_PREC_MULTI_SEG_DATA_A 0x4A40C
11501 #define _PAL_PREC_MULTI_SEG_DATA_B 0x4AC0C
11502 #define PAL_PREC_MULTI_SEG_RED_LDW_MASK REG_GENMASK(29, 24)
11503 #define PAL_PREC_MULTI_SEG_RED_UDW_MASK REG_GENMASK(29, 20)
11504 #define PAL_PREC_MULTI_SEG_GREEN_LDW_MASK REG_GENMASK(19, 14)
11505 #define PAL_PREC_MULTI_SEG_GREEN_UDW_MASK REG_GENMASK(19, 10)
11506 #define PAL_PREC_MULTI_SEG_BLUE_LDW_MASK REG_GENMASK(9, 4)
11507 #define PAL_PREC_MULTI_SEG_BLUE_UDW_MASK REG_GENMASK(9, 0)
11509 #define PREC_PAL_MULTI_SEG_INDEX(pipe) _MMIO_PIPE(pipe, \
11510 _PAL_PREC_MULTI_SEG_INDEX_A, \
11511 _PAL_PREC_MULTI_SEG_INDEX_B)
11512 #define PREC_PAL_MULTI_SEG_DATA(pipe) _MMIO_PIPE(pipe, \
11513 _PAL_PREC_MULTI_SEG_DATA_A, \
11514 _PAL_PREC_MULTI_SEG_DATA_B)
11516 #define _MMIO_PLANE_GAMC(plane, i, a, b) _MMIO(_PIPE(plane, a, b) + (i) * 4)
11518 /* Plane CSC Registers */
11519 #define _PLANE_CSC_RY_GY_1_A 0x70210
11520 #define _PLANE_CSC_RY_GY_2_A 0x70310
11522 #define _PLANE_CSC_RY_GY_1_B 0x71210
11523 #define _PLANE_CSC_RY_GY_2_B 0x71310
11525 #define _PLANE_CSC_RY_GY_1(pipe) _PIPE(pipe, _PLANE_CSC_RY_GY_1_A, \
11526 _PLANE_CSC_RY_GY_1_B)
11527 #define _PLANE_CSC_RY_GY_2(pipe) _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_2_A, \
11528 _PLANE_INPUT_CSC_RY_GY_2_B)
11529 #define PLANE_CSC_COEFF(pipe, plane, index) _MMIO_PLANE(plane, \
11530 _PLANE_CSC_RY_GY_1(pipe) + (index) * 4, \
11531 _PLANE_CSC_RY_GY_2(pipe) + (index) * 4)
11533 #define _PLANE_CSC_PREOFF_HI_1_A 0x70228
11534 #define _PLANE_CSC_PREOFF_HI_2_A 0x70328
11536 #define _PLANE_CSC_PREOFF_HI_1_B 0x71228
11537 #define _PLANE_CSC_PREOFF_HI_2_B 0x71328
11539 #define _PLANE_CSC_PREOFF_HI_1(pipe) _PIPE(pipe, _PLANE_CSC_PREOFF_HI_1_A, \
11540 _PLANE_CSC_PREOFF_HI_1_B)
11541 #define _PLANE_CSC_PREOFF_HI_2(pipe) _PIPE(pipe, _PLANE_CSC_PREOFF_HI_2_A, \
11542 _PLANE_CSC_PREOFF_HI_2_B)
11543 #define PLANE_CSC_PREOFF(pipe, plane, index) _MMIO_PLANE(plane, _PLANE_CSC_PREOFF_HI_1(pipe) + \
11544 (index) * 4, _PLANE_CSC_PREOFF_HI_2(pipe) + \
11547 #define _PLANE_CSC_POSTOFF_HI_1_A 0x70234
11548 #define _PLANE_CSC_POSTOFF_HI_2_A 0x70334
11550 #define _PLANE_CSC_POSTOFF_HI_1_B 0x71234
11551 #define _PLANE_CSC_POSTOFF_HI_2_B 0x71334
11553 #define _PLANE_CSC_POSTOFF_HI_1(pipe) _PIPE(pipe, _PLANE_CSC_POSTOFF_HI_1_A, \
11554 _PLANE_CSC_POSTOFF_HI_1_B)
11555 #define _PLANE_CSC_POSTOFF_HI_2(pipe) _PIPE(pipe, _PLANE_CSC_POSTOFF_HI_2_A, \
11556 _PLANE_CSC_POSTOFF_HI_2_B)
11557 #define PLANE_CSC_POSTOFF(pipe, plane, index) _MMIO_PLANE(plane, _PLANE_CSC_POSTOFF_HI_1(pipe) + \
11558 (index) * 4, _PLANE_CSC_POSTOFF_HI_2(pipe) + \
11561 /* pipe CSC & degamma/gamma LUTs on CHV */
11562 #define _CGM_PIPE_A_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x67900)
11563 #define _CGM_PIPE_A_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x67904)
11564 #define _CGM_PIPE_A_CSC_COEFF45 (VLV_DISPLAY_BASE + 0x67908)
11565 #define _CGM_PIPE_A_CSC_COEFF67 (VLV_DISPLAY_BASE + 0x6790C)
11566 #define _CGM_PIPE_A_CSC_COEFF8 (VLV_DISPLAY_BASE + 0x67910)
11567 #define _CGM_PIPE_A_DEGAMMA (VLV_DISPLAY_BASE + 0x66000)
11568 #define CGM_PIPE_DEGAMMA_RED_MASK REG_GENMASK(13, 0)
11569 #define CGM_PIPE_DEGAMMA_GREEN_MASK REG_GENMASK(29, 16)
11570 #define CGM_PIPE_DEGAMMA_BLUE_MASK REG_GENMASK(13, 0)
11571 #define _CGM_PIPE_A_GAMMA (VLV_DISPLAY_BASE + 0x67000)
11572 #define CGM_PIPE_GAMMA_RED_MASK REG_GENMASK(9, 0)
11573 #define CGM_PIPE_GAMMA_GREEN_MASK REG_GENMASK(25, 16)
11574 #define CGM_PIPE_GAMMA_BLUE_MASK REG_GENMASK(9, 0)
11575 #define _CGM_PIPE_A_MODE (VLV_DISPLAY_BASE + 0x67A00)
11576 #define CGM_PIPE_MODE_GAMMA (1 << 2)
11577 #define CGM_PIPE_MODE_CSC (1 << 1)
11578 #define CGM_PIPE_MODE_DEGAMMA (1 << 0)
11580 #define _CGM_PIPE_B_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x69900)
11581 #define _CGM_PIPE_B_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x69904)
11582 #define _CGM_PIPE_B_CSC_COEFF45 (VLV_DISPLAY_BASE + 0x69908)
11583 #define _CGM_PIPE_B_CSC_COEFF67 (VLV_DISPLAY_BASE + 0x6990C)
11584 #define _CGM_PIPE_B_CSC_COEFF8 (VLV_DISPLAY_BASE + 0x69910)
11585 #define _CGM_PIPE_B_DEGAMMA (VLV_DISPLAY_BASE + 0x68000)
11586 #define _CGM_PIPE_B_GAMMA (VLV_DISPLAY_BASE + 0x69000)
11587 #define _CGM_PIPE_B_MODE (VLV_DISPLAY_BASE + 0x69A00)
11589 #define CGM_PIPE_CSC_COEFF01(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF01, _CGM_PIPE_B_CSC_COEFF01)
11590 #define CGM_PIPE_CSC_COEFF23(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF23, _CGM_PIPE_B_CSC_COEFF23)
11591 #define CGM_PIPE_CSC_COEFF45(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF45, _CGM_PIPE_B_CSC_COEFF45)
11592 #define CGM_PIPE_CSC_COEFF67(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF67, _CGM_PIPE_B_CSC_COEFF67)
11593 #define CGM_PIPE_CSC_COEFF8(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF8, _CGM_PIPE_B_CSC_COEFF8)
11594 #define CGM_PIPE_DEGAMMA(pipe, i, w) _MMIO(_PIPE(pipe, _CGM_PIPE_A_DEGAMMA, _CGM_PIPE_B_DEGAMMA) + (i) * 8 + (w) * 4)
11595 #define CGM_PIPE_GAMMA(pipe, i, w) _MMIO(_PIPE(pipe, _CGM_PIPE_A_GAMMA, _CGM_PIPE_B_GAMMA) + (i) * 8 + (w) * 4)
11596 #define CGM_PIPE_MODE(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_MODE, _CGM_PIPE_B_MODE)
11598 /* MIPI DSI registers */
11600 #define _MIPI_PORT(port, a, c) (((port) == PORT_A) ? a : c) /* ports A and C only */
11601 #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
11604 #define _MMIO_DSI(tc, dsi0, dsi1) _MMIO_TRANS((tc) - TRANSCODER_DSI_0, \
11607 #define MIPIO_TXESC_CLK_DIV1 _MMIO(0x160004)
11608 #define GLK_TX_ESC_CLK_DIV1_MASK 0x3FF
11609 #define MIPIO_TXESC_CLK_DIV2 _MMIO(0x160008)
11610 #define GLK_TX_ESC_CLK_DIV2_MASK 0x3FF
11612 #define _ICL_DSI_ESC_CLK_DIV0 0x6b090
11613 #define _ICL_DSI_ESC_CLK_DIV1 0x6b890
11614 #define ICL_DSI_ESC_CLK_DIV(port) _MMIO_PORT((port), \
11615 _ICL_DSI_ESC_CLK_DIV0, \
11616 _ICL_DSI_ESC_CLK_DIV1)
11617 #define _ICL_DPHY_ESC_CLK_DIV0 0x162190
11618 #define _ICL_DPHY_ESC_CLK_DIV1 0x6C190
11619 #define ICL_DPHY_ESC_CLK_DIV(port) _MMIO_PORT((port), \
11620 _ICL_DPHY_ESC_CLK_DIV0, \
11621 _ICL_DPHY_ESC_CLK_DIV1)
11622 #define ICL_BYTE_CLK_PER_ESC_CLK_MASK (0x1f << 16)
11623 #define ICL_BYTE_CLK_PER_ESC_CLK_SHIFT 16
11624 #define ICL_ESC_CLK_DIV_MASK 0x1ff
11625 #define ICL_ESC_CLK_DIV_SHIFT 0
11626 #define DSI_MAX_ESC_CLK 20000 /* in KHz */
11628 #define _ADL_MIPIO_REG 0x180
11629 #define ADL_MIPIO_DW(port, dw) _MMIO(_ICL_COMBOPHY(port) + _ADL_MIPIO_REG + 4 * (dw))
11630 #define TX_ESC_CLK_DIV_PHY_SEL REGBIT(16)
11631 #define TX_ESC_CLK_DIV_PHY_MASK REG_GENMASK(23, 16)
11632 #define TX_ESC_CLK_DIV_PHY REG_FIELD_PREP(TX_ESC_CLK_DIV_PHY_MASK, 0x7f)
11634 #define _DSI_CMD_FRMCTL_0 0x6b034
11635 #define _DSI_CMD_FRMCTL_1 0x6b834
11636 #define DSI_CMD_FRMCTL(port) _MMIO_PORT(port, \
11637 _DSI_CMD_FRMCTL_0,\
11639 #define DSI_FRAME_UPDATE_REQUEST (1 << 31)
11640 #define DSI_PERIODIC_FRAME_UPDATE_ENABLE (1 << 29)
11641 #define DSI_NULL_PACKET_ENABLE (1 << 28)
11642 #define DSI_FRAME_IN_PROGRESS (1 << 0)
11644 #define _DSI_INTR_MASK_REG_0 0x6b070
11645 #define _DSI_INTR_MASK_REG_1 0x6b870
11646 #define DSI_INTR_MASK_REG(port) _MMIO_PORT(port, \
11647 _DSI_INTR_MASK_REG_0,\
11648 _DSI_INTR_MASK_REG_1)
11650 #define _DSI_INTR_IDENT_REG_0 0x6b074
11651 #define _DSI_INTR_IDENT_REG_1 0x6b874
11652 #define DSI_INTR_IDENT_REG(port) _MMIO_PORT(port, \
11653 _DSI_INTR_IDENT_REG_0,\
11654 _DSI_INTR_IDENT_REG_1)
11655 #define DSI_TE_EVENT (1 << 31)
11656 #define DSI_RX_DATA_OR_BTA_TERMINATED (1 << 30)
11657 #define DSI_TX_DATA (1 << 29)
11658 #define DSI_ULPS_ENTRY_DONE (1 << 28)
11659 #define DSI_NON_TE_TRIGGER_RECEIVED (1 << 27)
11660 #define DSI_HOST_CHKSUM_ERROR (1 << 26)
11661 #define DSI_HOST_MULTI_ECC_ERROR (1 << 25)
11662 #define DSI_HOST_SINGL_ECC_ERROR (1 << 24)
11663 #define DSI_HOST_CONTENTION_DETECTED (1 << 23)
11664 #define DSI_HOST_FALSE_CONTROL_ERROR (1 << 22)
11665 #define DSI_HOST_TIMEOUT_ERROR (1 << 21)
11666 #define DSI_HOST_LOW_POWER_TX_SYNC_ERROR (1 << 20)
11667 #define DSI_HOST_ESCAPE_MODE_ENTRY_ERROR (1 << 19)
11668 #define DSI_FRAME_UPDATE_DONE (1 << 16)
11669 #define DSI_PROTOCOL_VIOLATION_REPORTED (1 << 15)
11670 #define DSI_INVALID_TX_LENGTH (1 << 13)
11671 #define DSI_INVALID_VC (1 << 12)
11672 #define DSI_INVALID_DATA_TYPE (1 << 11)
11673 #define DSI_PERIPHERAL_CHKSUM_ERROR (1 << 10)
11674 #define DSI_PERIPHERAL_MULTI_ECC_ERROR (1 << 9)
11675 #define DSI_PERIPHERAL_SINGLE_ECC_ERROR (1 << 8)
11676 #define DSI_PERIPHERAL_CONTENTION_DETECTED (1 << 7)
11677 #define DSI_PERIPHERAL_FALSE_CTRL_ERROR (1 << 6)
11678 #define DSI_PERIPHERAL_TIMEOUT_ERROR (1 << 5)
11679 #define DSI_PERIPHERAL_LP_TX_SYNC_ERROR (1 << 4)
11680 #define DSI_PERIPHERAL_ESC_MODE_ENTRY_CMD_ERR (1 << 3)
11681 #define DSI_EOT_SYNC_ERROR (1 << 2)
11682 #define DSI_SOT_SYNC_ERROR (1 << 1)
11683 #define DSI_SOT_ERROR (1 << 0)
11685 /* Gen4+ Timestamp and Pipe Frame time stamp registers */
11686 #define GEN4_TIMESTAMP _MMIO(0x2358)
11687 #define ILK_TIMESTAMP_HI _MMIO(0x70070)
11688 #define IVB_TIMESTAMP_CTR _MMIO(0x44070)
11690 #define GEN9_TIMESTAMP_OVERRIDE _MMIO(0x44074)
11691 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT 0
11692 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK 0x3ff
11693 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT 12
11694 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK (0xf << 12)
11696 #define _PIPE_FRMTMSTMP_A 0x70048
11697 #define PIPE_FRMTMSTMP(pipe) \
11698 _MMIO_PIPE2(pipe, _PIPE_FRMTMSTMP_A)
11700 /* BXT MIPI clock controls */
11701 #define BXT_MAX_VAR_OUTPUT_KHZ 39500
11703 #define BXT_MIPI_CLOCK_CTL _MMIO(0x46090)
11704 #define BXT_MIPI1_DIV_SHIFT 26
11705 #define BXT_MIPI2_DIV_SHIFT 10
11706 #define BXT_MIPI_DIV_SHIFT(port) \
11707 _MIPI_PORT(port, BXT_MIPI1_DIV_SHIFT, \
11708 BXT_MIPI2_DIV_SHIFT)
11710 /* TX control divider to select actual TX clock output from (8x/var) */
11711 #define BXT_MIPI1_TX_ESCLK_SHIFT 26
11712 #define BXT_MIPI2_TX_ESCLK_SHIFT 10
11713 #define BXT_MIPI_TX_ESCLK_SHIFT(port) \
11714 _MIPI_PORT(port, BXT_MIPI1_TX_ESCLK_SHIFT, \
11715 BXT_MIPI2_TX_ESCLK_SHIFT)
11716 #define BXT_MIPI1_TX_ESCLK_FIXDIV_MASK (0x3F << 26)
11717 #define BXT_MIPI2_TX_ESCLK_FIXDIV_MASK (0x3F << 10)
11718 #define BXT_MIPI_TX_ESCLK_FIXDIV_MASK(port) \
11719 _MIPI_PORT(port, BXT_MIPI1_TX_ESCLK_FIXDIV_MASK, \
11720 BXT_MIPI2_TX_ESCLK_FIXDIV_MASK)
11721 #define BXT_MIPI_TX_ESCLK_DIVIDER(port, val) \
11722 (((val) & 0x3F) << BXT_MIPI_TX_ESCLK_SHIFT(port))
11723 /* RX upper control divider to select actual RX clock output from 8x */
11724 #define BXT_MIPI1_RX_ESCLK_UPPER_SHIFT 21
11725 #define BXT_MIPI2_RX_ESCLK_UPPER_SHIFT 5
11726 #define BXT_MIPI_RX_ESCLK_UPPER_SHIFT(port) \
11727 _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_UPPER_SHIFT, \
11728 BXT_MIPI2_RX_ESCLK_UPPER_SHIFT)
11729 #define BXT_MIPI1_RX_ESCLK_UPPER_FIXDIV_MASK (3 << 21)
11730 #define BXT_MIPI2_RX_ESCLK_UPPER_FIXDIV_MASK (3 << 5)
11731 #define BXT_MIPI_RX_ESCLK_UPPER_FIXDIV_MASK(port) \
11732 _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_UPPER_FIXDIV_MASK, \
11733 BXT_MIPI2_RX_ESCLK_UPPER_FIXDIV_MASK)
11734 #define BXT_MIPI_RX_ESCLK_UPPER_DIVIDER(port, val) \
11735 (((val) & 3) << BXT_MIPI_RX_ESCLK_UPPER_SHIFT(port))
11736 /* 8/3X divider to select the actual 8/3X clock output from 8x */
11737 #define BXT_MIPI1_8X_BY3_SHIFT 19
11738 #define BXT_MIPI2_8X_BY3_SHIFT 3
11739 #define BXT_MIPI_8X_BY3_SHIFT(port) \
11740 _MIPI_PORT(port, BXT_MIPI1_8X_BY3_SHIFT, \
11741 BXT_MIPI2_8X_BY3_SHIFT)
11742 #define BXT_MIPI1_8X_BY3_DIVIDER_MASK (3 << 19)
11743 #define BXT_MIPI2_8X_BY3_DIVIDER_MASK (3 << 3)
11744 #define BXT_MIPI_8X_BY3_DIVIDER_MASK(port) \
11745 _MIPI_PORT(port, BXT_MIPI1_8X_BY3_DIVIDER_MASK, \
11746 BXT_MIPI2_8X_BY3_DIVIDER_MASK)
11747 #define BXT_MIPI_8X_BY3_DIVIDER(port, val) \
11748 (((val) & 3) << BXT_MIPI_8X_BY3_SHIFT(port))
11749 /* RX lower control divider to select actual RX clock output from 8x */
11750 #define BXT_MIPI1_RX_ESCLK_LOWER_SHIFT 16
11751 #define BXT_MIPI2_RX_ESCLK_LOWER_SHIFT 0
11752 #define BXT_MIPI_RX_ESCLK_LOWER_SHIFT(port) \
11753 _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_LOWER_SHIFT, \
11754 BXT_MIPI2_RX_ESCLK_LOWER_SHIFT)
11755 #define BXT_MIPI1_RX_ESCLK_LOWER_FIXDIV_MASK (3 << 16)
11756 #define BXT_MIPI2_RX_ESCLK_LOWER_FIXDIV_MASK (3 << 0)
11757 #define BXT_MIPI_RX_ESCLK_LOWER_FIXDIV_MASK(port) \
11758 _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_LOWER_FIXDIV_MASK, \
11759 BXT_MIPI2_RX_ESCLK_LOWER_FIXDIV_MASK)
11760 #define BXT_MIPI_RX_ESCLK_LOWER_DIVIDER(port, val) \
11761 (((val) & 3) << BXT_MIPI_RX_ESCLK_LOWER_SHIFT(port))
11763 #define RX_DIVIDER_BIT_1_2 0x3
11764 #define RX_DIVIDER_BIT_3_4 0xC
11766 /* BXT MIPI mode configure */
11767 #define _BXT_MIPIA_TRANS_HACTIVE 0x6B0F8
11768 #define _BXT_MIPIC_TRANS_HACTIVE 0x6B8F8
11769 #define BXT_MIPI_TRANS_HACTIVE(tc) _MMIO_MIPI(tc, \
11770 _BXT_MIPIA_TRANS_HACTIVE, _BXT_MIPIC_TRANS_HACTIVE)
11772 #define _BXT_MIPIA_TRANS_VACTIVE 0x6B0FC
11773 #define _BXT_MIPIC_TRANS_VACTIVE 0x6B8FC
11774 #define BXT_MIPI_TRANS_VACTIVE(tc) _MMIO_MIPI(tc, \
11775 _BXT_MIPIA_TRANS_VACTIVE, _BXT_MIPIC_TRANS_VACTIVE)
11777 #define _BXT_MIPIA_TRANS_VTOTAL 0x6B100
11778 #define _BXT_MIPIC_TRANS_VTOTAL 0x6B900
11779 #define BXT_MIPI_TRANS_VTOTAL(tc) _MMIO_MIPI(tc, \
11780 _BXT_MIPIA_TRANS_VTOTAL, _BXT_MIPIC_TRANS_VTOTAL)
11782 #define BXT_DSI_PLL_CTL _MMIO(0x161000)
11783 #define BXT_DSI_PLL_PVD_RATIO_SHIFT 16
11784 #define BXT_DSI_PLL_PVD_RATIO_MASK (3 << BXT_DSI_PLL_PVD_RATIO_SHIFT)
11785 #define BXT_DSI_PLL_PVD_RATIO_1 (1 << BXT_DSI_PLL_PVD_RATIO_SHIFT)
11786 #define BXT_DSIC_16X_BY1 (0 << 10)
11787 #define BXT_DSIC_16X_BY2 (1 << 10)
11788 #define BXT_DSIC_16X_BY3 (2 << 10)
11789 #define BXT_DSIC_16X_BY4 (3 << 10)
11790 #define BXT_DSIC_16X_MASK (3 << 10)
11791 #define BXT_DSIA_16X_BY1 (0 << 8)
11792 #define BXT_DSIA_16X_BY2 (1 << 8)
11793 #define BXT_DSIA_16X_BY3 (2 << 8)
11794 #define BXT_DSIA_16X_BY4 (3 << 8)
11795 #define BXT_DSIA_16X_MASK (3 << 8)
11796 #define BXT_DSI_FREQ_SEL_SHIFT 8
11797 #define BXT_DSI_FREQ_SEL_MASK (0xF << BXT_DSI_FREQ_SEL_SHIFT)
11799 #define BXT_DSI_PLL_RATIO_MAX 0x7D
11800 #define BXT_DSI_PLL_RATIO_MIN 0x22
11801 #define GLK_DSI_PLL_RATIO_MAX 0x6F
11802 #define GLK_DSI_PLL_RATIO_MIN 0x22
11803 #define BXT_DSI_PLL_RATIO_MASK 0xFF
11804 #define BXT_REF_CLOCK_KHZ 19200
11806 #define BXT_DSI_PLL_ENABLE _MMIO(0x46080)
11807 #define BXT_DSI_PLL_DO_ENABLE (1 << 31)
11808 #define BXT_DSI_PLL_LOCKED (1 << 30)
11810 #define _MIPIA_PORT_CTRL (VLV_DISPLAY_BASE + 0x61190)
11811 #define _MIPIC_PORT_CTRL (VLV_DISPLAY_BASE + 0x61700)
11812 #define MIPI_PORT_CTRL(port) _MMIO_MIPI(port, _MIPIA_PORT_CTRL, _MIPIC_PORT_CTRL)
11814 /* BXT port control */
11815 #define _BXT_MIPIA_PORT_CTRL 0x6B0C0
11816 #define _BXT_MIPIC_PORT_CTRL 0x6B8C0
11817 #define BXT_MIPI_PORT_CTRL(tc) _MMIO_MIPI(tc, _BXT_MIPIA_PORT_CTRL, _BXT_MIPIC_PORT_CTRL)
11819 /* ICL DSI MODE control */
11820 #define _ICL_DSI_IO_MODECTL_0 0x6B094
11821 #define _ICL_DSI_IO_MODECTL_1 0x6B894
11822 #define ICL_DSI_IO_MODECTL(port) _MMIO_PORT(port, \
11823 _ICL_DSI_IO_MODECTL_0, \
11824 _ICL_DSI_IO_MODECTL_1)
11825 #define COMBO_PHY_MODE_DSI (1 << 0)
11827 /* TGL DSI Chicken register */
11828 #define _TGL_DSI_CHKN_REG_0 0x6B0C0
11829 #define _TGL_DSI_CHKN_REG_1 0x6B8C0
11830 #define TGL_DSI_CHKN_REG(port) _MMIO_PORT(port, \
11831 _TGL_DSI_CHKN_REG_0, \
11832 _TGL_DSI_CHKN_REG_1)
11833 #define TGL_DSI_CHKN_LSHS_GB_MASK REG_GENMASK(15, 12)
11834 #define TGL_DSI_CHKN_LSHS_GB(byte_clocks) REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, \
11837 /* Display Stream Splitter Control */
11838 #define DSS_CTL1 _MMIO(0x67400)
11839 #define SPLITTER_ENABLE (1 << 31)
11840 #define JOINER_ENABLE (1 << 30)
11841 #define DUAL_LINK_MODE_INTERLEAVE (1 << 24)
11842 #define DUAL_LINK_MODE_FRONTBACK (0 << 24)
11843 #define OVERLAP_PIXELS_MASK (0xf << 16)
11844 #define OVERLAP_PIXELS(pixels) ((pixels) << 16)
11845 #define LEFT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0)
11846 #define LEFT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0)
11847 #define MAX_DL_BUFFER_TARGET_DEPTH 0x5a0
11849 #define DSS_CTL2 _MMIO(0x67404)
11850 #define LEFT_BRANCH_VDSC_ENABLE (1 << 31)
11851 #define RIGHT_BRANCH_VDSC_ENABLE (1 << 15)
11852 #define RIGHT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0)
11853 #define RIGHT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0)
11855 #define _ICL_PIPE_DSS_CTL1_PB 0x78200
11856 #define _ICL_PIPE_DSS_CTL1_PC 0x78400
11857 #define ICL_PIPE_DSS_CTL1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
11858 _ICL_PIPE_DSS_CTL1_PB, \
11859 _ICL_PIPE_DSS_CTL1_PC)
11860 #define BIG_JOINER_ENABLE (1 << 29)
11861 #define MASTER_BIG_JOINER_ENABLE (1 << 28)
11862 #define VGA_CENTERING_ENABLE (1 << 27)
11863 #define SPLITTER_CONFIGURATION_MASK REG_GENMASK(26, 25)
11864 #define SPLITTER_CONFIGURATION_2_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0)
11865 #define SPLITTER_CONFIGURATION_4_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1)
11866 #define UNCOMPRESSED_JOINER_MASTER (1 << 21)
11867 #define UNCOMPRESSED_JOINER_SLAVE (1 << 20)
11869 #define _ICL_PIPE_DSS_CTL2_PB 0x78204
11870 #define _ICL_PIPE_DSS_CTL2_PC 0x78404
11871 #define ICL_PIPE_DSS_CTL2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
11872 _ICL_PIPE_DSS_CTL2_PB, \
11873 _ICL_PIPE_DSS_CTL2_PC)
11875 #define BXT_P_DSI_REGULATOR_CFG _MMIO(0x160020)
11876 #define STAP_SELECT (1 << 0)
11878 #define BXT_P_DSI_REGULATOR_TX_CTRL _MMIO(0x160054)
11879 #define HS_IO_CTRL_SELECT (1 << 0)
11881 #define DPI_ENABLE (1 << 31) /* A + C */
11882 #define MIPIA_MIPI4DPHY_DELAY_COUNT_SHIFT 27
11883 #define MIPIA_MIPI4DPHY_DELAY_COUNT_MASK (0xf << 27)
11884 #define DUAL_LINK_MODE_SHIFT 26
11885 #define DUAL_LINK_MODE_MASK (1 << 26)
11886 #define DUAL_LINK_MODE_FRONT_BACK (0 << 26)
11887 #define DUAL_LINK_MODE_PIXEL_ALTERNATIVE (1 << 26)
11888 #define DITHERING_ENABLE (1 << 25) /* A + C */
11889 #define FLOPPED_HSTX (1 << 23)
11890 #define DE_INVERT (1 << 19) /* XXX */
11891 #define MIPIA_FLISDSI_DELAY_COUNT_SHIFT 18
11892 #define MIPIA_FLISDSI_DELAY_COUNT_MASK (0xf << 18)
11893 #define AFE_LATCHOUT (1 << 17)
11894 #define LP_OUTPUT_HOLD (1 << 16)
11895 #define MIPIC_FLISDSI_DELAY_COUNT_HIGH_SHIFT 15
11896 #define MIPIC_FLISDSI_DELAY_COUNT_HIGH_MASK (1 << 15)
11897 #define MIPIC_MIPI4DPHY_DELAY_COUNT_SHIFT 11
11898 #define MIPIC_MIPI4DPHY_DELAY_COUNT_MASK (0xf << 11)
11899 #define CSB_SHIFT 9
11900 #define CSB_MASK (3 << 9)
11901 #define CSB_20MHZ (0 << 9)
11902 #define CSB_10MHZ (1 << 9)
11903 #define CSB_40MHZ (2 << 9)
11904 #define BANDGAP_MASK (1 << 8)
11905 #define BANDGAP_PNW_CIRCUIT (0 << 8)
11906 #define BANDGAP_LNC_CIRCUIT (1 << 8)
11907 #define MIPIC_FLISDSI_DELAY_COUNT_LOW_SHIFT 5
11908 #define MIPIC_FLISDSI_DELAY_COUNT_LOW_MASK (7 << 5)
11909 #define TEARING_EFFECT_DELAY (1 << 4) /* A + C */
11910 #define TEARING_EFFECT_SHIFT 2 /* A + C */
11911 #define TEARING_EFFECT_MASK (3 << 2)
11912 #define TEARING_EFFECT_OFF (0 << 2)
11913 #define TEARING_EFFECT_DSI (1 << 2)
11914 #define TEARING_EFFECT_GPIO (2 << 2)
11915 #define LANE_CONFIGURATION_SHIFT 0
11916 #define LANE_CONFIGURATION_MASK (3 << 0)
11917 #define LANE_CONFIGURATION_4LANE (0 << 0)
11918 #define LANE_CONFIGURATION_DUAL_LINK_A (1 << 0)
11919 #define LANE_CONFIGURATION_DUAL_LINK_B (2 << 0)
11921 #define _MIPIA_TEARING_CTRL (VLV_DISPLAY_BASE + 0x61194)
11922 #define _MIPIC_TEARING_CTRL (VLV_DISPLAY_BASE + 0x61704)
11923 #define MIPI_TEARING_CTRL(port) _MMIO_MIPI(port, _MIPIA_TEARING_CTRL, _MIPIC_TEARING_CTRL)
11924 #define TEARING_EFFECT_DELAY_SHIFT 0
11925 #define TEARING_EFFECT_DELAY_MASK (0xffff << 0)
11927 /* XXX: all bits reserved */
11928 #define _MIPIA_AUTOPWG (VLV_DISPLAY_BASE + 0x611a0)
11930 /* MIPI DSI Controller and D-PHY registers */
11932 #define _MIPIA_DEVICE_READY (dev_priv->mipi_mmio_base + 0xb000)
11933 #define _MIPIC_DEVICE_READY (dev_priv->mipi_mmio_base + 0xb800)
11934 #define MIPI_DEVICE_READY(port) _MMIO_MIPI(port, _MIPIA_DEVICE_READY, _MIPIC_DEVICE_READY)
11935 #define BUS_POSSESSION (1 << 3) /* set to give bus to receiver */
11936 #define ULPS_STATE_MASK (3 << 1)
11937 #define ULPS_STATE_ENTER (2 << 1)
11938 #define ULPS_STATE_EXIT (1 << 1)
11939 #define ULPS_STATE_NORMAL_OPERATION (0 << 1)
11940 #define DEVICE_READY (1 << 0)
11942 #define _MIPIA_INTR_STAT (dev_priv->mipi_mmio_base + 0xb004)
11943 #define _MIPIC_INTR_STAT (dev_priv->mipi_mmio_base + 0xb804)
11944 #define MIPI_INTR_STAT(port) _MMIO_MIPI(port, _MIPIA_INTR_STAT, _MIPIC_INTR_STAT)
11945 #define _MIPIA_INTR_EN (dev_priv->mipi_mmio_base + 0xb008)
11946 #define _MIPIC_INTR_EN (dev_priv->mipi_mmio_base + 0xb808)
11947 #define MIPI_INTR_EN(port) _MMIO_MIPI(port, _MIPIA_INTR_EN, _MIPIC_INTR_EN)
11948 #define TEARING_EFFECT (1 << 31)
11949 #define SPL_PKT_SENT_INTERRUPT (1 << 30)
11950 #define GEN_READ_DATA_AVAIL (1 << 29)
11951 #define LP_GENERIC_WR_FIFO_FULL (1 << 28)
11952 #define HS_GENERIC_WR_FIFO_FULL (1 << 27)
11953 #define RX_PROT_VIOLATION (1 << 26)
11954 #define RX_INVALID_TX_LENGTH (1 << 25)
11955 #define ACK_WITH_NO_ERROR (1 << 24)
11956 #define TURN_AROUND_ACK_TIMEOUT (1 << 23)
11957 #define LP_RX_TIMEOUT (1 << 22)
11958 #define HS_TX_TIMEOUT (1 << 21)
11959 #define DPI_FIFO_UNDERRUN (1 << 20)
11960 #define LOW_CONTENTION (1 << 19)
11961 #define HIGH_CONTENTION (1 << 18)
11962 #define TXDSI_VC_ID_INVALID (1 << 17)
11963 #define TXDSI_DATA_TYPE_NOT_RECOGNISED (1 << 16)
11964 #define TXCHECKSUM_ERROR (1 << 15)
11965 #define TXECC_MULTIBIT_ERROR (1 << 14)
11966 #define TXECC_SINGLE_BIT_ERROR (1 << 13)
11967 #define TXFALSE_CONTROL_ERROR (1 << 12)
11968 #define RXDSI_VC_ID_INVALID (1 << 11)
11969 #define RXDSI_DATA_TYPE_NOT_REGOGNISED (1 << 10)
11970 #define RXCHECKSUM_ERROR (1 << 9)
11971 #define RXECC_MULTIBIT_ERROR (1 << 8)
11972 #define RXECC_SINGLE_BIT_ERROR (1 << 7)
11973 #define RXFALSE_CONTROL_ERROR (1 << 6)
11974 #define RXHS_RECEIVE_TIMEOUT_ERROR (1 << 5)
11975 #define RX_LP_TX_SYNC_ERROR (1 << 4)
11976 #define RXEXCAPE_MODE_ENTRY_ERROR (1 << 3)
11977 #define RXEOT_SYNC_ERROR (1 << 2)
11978 #define RXSOT_SYNC_ERROR (1 << 1)
11979 #define RXSOT_ERROR (1 << 0)
11981 #define _MIPIA_DSI_FUNC_PRG (dev_priv->mipi_mmio_base + 0xb00c)
11982 #define _MIPIC_DSI_FUNC_PRG (dev_priv->mipi_mmio_base + 0xb80c)
11983 #define MIPI_DSI_FUNC_PRG(port) _MMIO_MIPI(port, _MIPIA_DSI_FUNC_PRG, _MIPIC_DSI_FUNC_PRG)
11984 #define CMD_MODE_DATA_WIDTH_MASK (7 << 13)
11985 #define CMD_MODE_NOT_SUPPORTED (0 << 13)
11986 #define CMD_MODE_DATA_WIDTH_16_BIT (1 << 13)
11987 #define CMD_MODE_DATA_WIDTH_9_BIT (2 << 13)
11988 #define CMD_MODE_DATA_WIDTH_8_BIT (3 << 13)
11989 #define CMD_MODE_DATA_WIDTH_OPTION1 (4 << 13)
11990 #define CMD_MODE_DATA_WIDTH_OPTION2 (5 << 13)
11991 #define VID_MODE_FORMAT_MASK (0xf << 7)
11992 #define VID_MODE_NOT_SUPPORTED (0 << 7)
11993 #define VID_MODE_FORMAT_RGB565 (1 << 7)
11994 #define VID_MODE_FORMAT_RGB666_PACKED (2 << 7)
11995 #define VID_MODE_FORMAT_RGB666 (3 << 7)
11996 #define VID_MODE_FORMAT_RGB888 (4 << 7)
11997 #define CMD_MODE_CHANNEL_NUMBER_SHIFT 5
11998 #define CMD_MODE_CHANNEL_NUMBER_MASK (3 << 5)
11999 #define VID_MODE_CHANNEL_NUMBER_SHIFT 3
12000 #define VID_MODE_CHANNEL_NUMBER_MASK (3 << 3)
12001 #define DATA_LANES_PRG_REG_SHIFT 0
12002 #define DATA_LANES_PRG_REG_MASK (7 << 0)
12004 #define _MIPIA_HS_TX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb010)
12005 #define _MIPIC_HS_TX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb810)
12006 #define MIPI_HS_TX_TIMEOUT(port) _MMIO_MIPI(port, _MIPIA_HS_TX_TIMEOUT, _MIPIC_HS_TX_TIMEOUT)
12007 #define HIGH_SPEED_TX_TIMEOUT_COUNTER_MASK 0xffffff
12009 #define _MIPIA_LP_RX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb014)
12010 #define _MIPIC_LP_RX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb814)
12011 #define MIPI_LP_RX_TIMEOUT(port) _MMIO_MIPI(port, _MIPIA_LP_RX_TIMEOUT, _MIPIC_LP_RX_TIMEOUT)
12012 #define LOW_POWER_RX_TIMEOUT_COUNTER_MASK 0xffffff
12014 #define _MIPIA_TURN_AROUND_TIMEOUT (dev_priv->mipi_mmio_base + 0xb018)
12015 #define _MIPIC_TURN_AROUND_TIMEOUT (dev_priv->mipi_mmio_base + 0xb818)
12016 #define MIPI_TURN_AROUND_TIMEOUT(port) _MMIO_MIPI(port, _MIPIA_TURN_AROUND_TIMEOUT, _MIPIC_TURN_AROUND_TIMEOUT)
12017 #define TURN_AROUND_TIMEOUT_MASK 0x3f
12019 #define _MIPIA_DEVICE_RESET_TIMER (dev_priv->mipi_mmio_base + 0xb01c)
12020 #define _MIPIC_DEVICE_RESET_TIMER (dev_priv->mipi_mmio_base + 0xb81c)
12021 #define MIPI_DEVICE_RESET_TIMER(port) _MMIO_MIPI(port, _MIPIA_DEVICE_RESET_TIMER, _MIPIC_DEVICE_RESET_TIMER)
12022 #define DEVICE_RESET_TIMER_MASK 0xffff
12024 #define _MIPIA_DPI_RESOLUTION (dev_priv->mipi_mmio_base + 0xb020)
12025 #define _MIPIC_DPI_RESOLUTION (dev_priv->mipi_mmio_base + 0xb820)
12026 #define MIPI_DPI_RESOLUTION(port) _MMIO_MIPI(port, _MIPIA_DPI_RESOLUTION, _MIPIC_DPI_RESOLUTION)
12027 #define VERTICAL_ADDRESS_SHIFT 16
12028 #define VERTICAL_ADDRESS_MASK (0xffff << 16)
12029 #define HORIZONTAL_ADDRESS_SHIFT 0
12030 #define HORIZONTAL_ADDRESS_MASK 0xffff
12032 #define _MIPIA_DBI_FIFO_THROTTLE (dev_priv->mipi_mmio_base + 0xb024)
12033 #define _MIPIC_DBI_FIFO_THROTTLE (dev_priv->mipi_mmio_base + 0xb824)
12034 #define MIPI_DBI_FIFO_THROTTLE(port) _MMIO_MIPI(port, _MIPIA_DBI_FIFO_THROTTLE, _MIPIC_DBI_FIFO_THROTTLE)
12035 #define DBI_FIFO_EMPTY_HALF (0 << 0)
12036 #define DBI_FIFO_EMPTY_QUARTER (1 << 0)
12037 #define DBI_FIFO_EMPTY_7_LOCATIONS (2 << 0)
12039 /* regs below are bits 15:0 */
12040 #define _MIPIA_HSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb028)
12041 #define _MIPIC_HSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb828)
12042 #define MIPI_HSYNC_PADDING_COUNT(port) _MMIO_MIPI(port, _MIPIA_HSYNC_PADDING_COUNT, _MIPIC_HSYNC_PADDING_COUNT)
12044 #define _MIPIA_HBP_COUNT (dev_priv->mipi_mmio_base + 0xb02c)
12045 #define _MIPIC_HBP_COUNT (dev_priv->mipi_mmio_base + 0xb82c)
12046 #define MIPI_HBP_COUNT(port) _MMIO_MIPI(port, _MIPIA_HBP_COUNT, _MIPIC_HBP_COUNT)
12048 #define _MIPIA_HFP_COUNT (dev_priv->mipi_mmio_base + 0xb030)
12049 #define _MIPIC_HFP_COUNT (dev_priv->mipi_mmio_base + 0xb830)
12050 #define MIPI_HFP_COUNT(port) _MMIO_MIPI(port, _MIPIA_HFP_COUNT, _MIPIC_HFP_COUNT)
12052 #define _MIPIA_HACTIVE_AREA_COUNT (dev_priv->mipi_mmio_base + 0xb034)
12053 #define _MIPIC_HACTIVE_AREA_COUNT (dev_priv->mipi_mmio_base + 0xb834)
12054 #define MIPI_HACTIVE_AREA_COUNT(port) _MMIO_MIPI(port, _MIPIA_HACTIVE_AREA_COUNT, _MIPIC_HACTIVE_AREA_COUNT)
12056 #define _MIPIA_VSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb038)
12057 #define _MIPIC_VSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb838)
12058 #define MIPI_VSYNC_PADDING_COUNT(port) _MMIO_MIPI(port, _MIPIA_VSYNC_PADDING_COUNT, _MIPIC_VSYNC_PADDING_COUNT)
12060 #define _MIPIA_VBP_COUNT (dev_priv->mipi_mmio_base + 0xb03c)
12061 #define _MIPIC_VBP_COUNT (dev_priv->mipi_mmio_base + 0xb83c)
12062 #define MIPI_VBP_COUNT(port) _MMIO_MIPI(port, _MIPIA_VBP_COUNT, _MIPIC_VBP_COUNT)
12064 #define _MIPIA_VFP_COUNT (dev_priv->mipi_mmio_base + 0xb040)
12065 #define _MIPIC_VFP_COUNT (dev_priv->mipi_mmio_base + 0xb840)
12066 #define MIPI_VFP_COUNT(port) _MMIO_MIPI(port, _MIPIA_VFP_COUNT, _MIPIC_VFP_COUNT)
12068 #define _MIPIA_HIGH_LOW_SWITCH_COUNT (dev_priv->mipi_mmio_base + 0xb044)
12069 #define _MIPIC_HIGH_LOW_SWITCH_COUNT (dev_priv->mipi_mmio_base + 0xb844)
12070 #define MIPI_HIGH_LOW_SWITCH_COUNT(port) _MMIO_MIPI(port, _MIPIA_HIGH_LOW_SWITCH_COUNT, _MIPIC_HIGH_LOW_SWITCH_COUNT)
12072 /* regs above are bits 15:0 */
12074 #define _MIPIA_DPI_CONTROL (dev_priv->mipi_mmio_base + 0xb048)
12075 #define _MIPIC_DPI_CONTROL (dev_priv->mipi_mmio_base + 0xb848)
12076 #define MIPI_DPI_CONTROL(port) _MMIO_MIPI(port, _MIPIA_DPI_CONTROL, _MIPIC_DPI_CONTROL)
12077 #define DPI_LP_MODE (1 << 6)
12078 #define BACKLIGHT_OFF (1 << 5)
12079 #define BACKLIGHT_ON (1 << 4)
12080 #define COLOR_MODE_OFF (1 << 3)
12081 #define COLOR_MODE_ON (1 << 2)
12082 #define TURN_ON (1 << 1)
12083 #define SHUTDOWN (1 << 0)
12085 #define _MIPIA_DPI_DATA (dev_priv->mipi_mmio_base + 0xb04c)
12086 #define _MIPIC_DPI_DATA (dev_priv->mipi_mmio_base + 0xb84c)
12087 #define MIPI_DPI_DATA(port) _MMIO_MIPI(port, _MIPIA_DPI_DATA, _MIPIC_DPI_DATA)
12088 #define COMMAND_BYTE_SHIFT 0
12089 #define COMMAND_BYTE_MASK (0x3f << 0)
12091 #define _MIPIA_INIT_COUNT (dev_priv->mipi_mmio_base + 0xb050)
12092 #define _MIPIC_INIT_COUNT (dev_priv->mipi_mmio_base + 0xb850)
12093 #define MIPI_INIT_COUNT(port) _MMIO_MIPI(port, _MIPIA_INIT_COUNT, _MIPIC_INIT_COUNT)
12094 #define MASTER_INIT_TIMER_SHIFT 0
12095 #define MASTER_INIT_TIMER_MASK (0xffff << 0)
12097 #define _MIPIA_MAX_RETURN_PKT_SIZE (dev_priv->mipi_mmio_base + 0xb054)
12098 #define _MIPIC_MAX_RETURN_PKT_SIZE (dev_priv->mipi_mmio_base + 0xb854)
12099 #define MIPI_MAX_RETURN_PKT_SIZE(port) _MMIO_MIPI(port, \
12100 _MIPIA_MAX_RETURN_PKT_SIZE, _MIPIC_MAX_RETURN_PKT_SIZE)
12101 #define MAX_RETURN_PKT_SIZE_SHIFT 0
12102 #define MAX_RETURN_PKT_SIZE_MASK (0x3ff << 0)
12104 #define _MIPIA_VIDEO_MODE_FORMAT (dev_priv->mipi_mmio_base + 0xb058)
12105 #define _MIPIC_VIDEO_MODE_FORMAT (dev_priv->mipi_mmio_base + 0xb858)
12106 #define MIPI_VIDEO_MODE_FORMAT(port) _MMIO_MIPI(port, _MIPIA_VIDEO_MODE_FORMAT, _MIPIC_VIDEO_MODE_FORMAT)
12107 #define RANDOM_DPI_DISPLAY_RESOLUTION (1 << 4)
12108 #define DISABLE_VIDEO_BTA (1 << 3)
12109 #define IP_TG_CONFIG (1 << 2)
12110 #define VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE (1 << 0)
12111 #define VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS (2 << 0)
12112 #define VIDEO_MODE_BURST (3 << 0)
12114 #define _MIPIA_EOT_DISABLE (dev_priv->mipi_mmio_base + 0xb05c)
12115 #define _MIPIC_EOT_DISABLE (dev_priv->mipi_mmio_base + 0xb85c)
12116 #define MIPI_EOT_DISABLE(port) _MMIO_MIPI(port, _MIPIA_EOT_DISABLE, _MIPIC_EOT_DISABLE)
12117 #define BXT_DEFEATURE_DPI_FIFO_CTR (1 << 9)
12118 #define BXT_DPHY_DEFEATURE_EN (1 << 8)
12119 #define LP_RX_TIMEOUT_ERROR_RECOVERY_DISABLE (1 << 7)
12120 #define HS_RX_TIMEOUT_ERROR_RECOVERY_DISABLE (1 << 6)
12121 #define LOW_CONTENTION_RECOVERY_DISABLE (1 << 5)
12122 #define HIGH_CONTENTION_RECOVERY_DISABLE (1 << 4)
12123 #define TXDSI_TYPE_NOT_RECOGNISED_ERROR_RECOVERY_DISABLE (1 << 3)
12124 #define TXECC_MULTIBIT_ERROR_RECOVERY_DISABLE (1 << 2)
12125 #define CLOCKSTOP (1 << 1)
12126 #define EOT_DISABLE (1 << 0)
12128 #define _MIPIA_LP_BYTECLK (dev_priv->mipi_mmio_base + 0xb060)
12129 #define _MIPIC_LP_BYTECLK (dev_priv->mipi_mmio_base + 0xb860)
12130 #define MIPI_LP_BYTECLK(port) _MMIO_MIPI(port, _MIPIA_LP_BYTECLK, _MIPIC_LP_BYTECLK)
12131 #define LP_BYTECLK_SHIFT 0
12132 #define LP_BYTECLK_MASK (0xffff << 0)
12134 #define _MIPIA_TLPX_TIME_COUNT (dev_priv->mipi_mmio_base + 0xb0a4)
12135 #define _MIPIC_TLPX_TIME_COUNT (dev_priv->mipi_mmio_base + 0xb8a4)
12136 #define MIPI_TLPX_TIME_COUNT(port) _MMIO_MIPI(port, _MIPIA_TLPX_TIME_COUNT, _MIPIC_TLPX_TIME_COUNT)
12138 #define _MIPIA_CLK_LANE_TIMING (dev_priv->mipi_mmio_base + 0xb098)
12139 #define _MIPIC_CLK_LANE_TIMING (dev_priv->mipi_mmio_base + 0xb898)
12140 #define MIPI_CLK_LANE_TIMING(port) _MMIO_MIPI(port, _MIPIA_CLK_LANE_TIMING, _MIPIC_CLK_LANE_TIMING)
12143 #define _MIPIA_LP_GEN_DATA (dev_priv->mipi_mmio_base + 0xb064)
12144 #define _MIPIC_LP_GEN_DATA (dev_priv->mipi_mmio_base + 0xb864)
12145 #define MIPI_LP_GEN_DATA(port) _MMIO_MIPI(port, _MIPIA_LP_GEN_DATA, _MIPIC_LP_GEN_DATA)
12148 #define _MIPIA_HS_GEN_DATA (dev_priv->mipi_mmio_base + 0xb068)
12149 #define _MIPIC_HS_GEN_DATA (dev_priv->mipi_mmio_base + 0xb868)
12150 #define MIPI_HS_GEN_DATA(port) _MMIO_MIPI(port, _MIPIA_HS_GEN_DATA, _MIPIC_HS_GEN_DATA)
12152 #define _MIPIA_LP_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb06c)
12153 #define _MIPIC_LP_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb86c)
12154 #define MIPI_LP_GEN_CTRL(port) _MMIO_MIPI(port, _MIPIA_LP_GEN_CTRL, _MIPIC_LP_GEN_CTRL)
12155 #define _MIPIA_HS_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb070)
12156 #define _MIPIC_HS_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb870)
12157 #define MIPI_HS_GEN_CTRL(port) _MMIO_MIPI(port, _MIPIA_HS_GEN_CTRL, _MIPIC_HS_GEN_CTRL)
12158 #define LONG_PACKET_WORD_COUNT_SHIFT 8
12159 #define LONG_PACKET_WORD_COUNT_MASK (0xffff << 8)
12160 #define SHORT_PACKET_PARAM_SHIFT 8
12161 #define SHORT_PACKET_PARAM_MASK (0xffff << 8)
12162 #define VIRTUAL_CHANNEL_SHIFT 6
12163 #define VIRTUAL_CHANNEL_MASK (3 << 6)
12164 #define DATA_TYPE_SHIFT 0
12165 #define DATA_TYPE_MASK (0x3f << 0)
12166 /* data type values, see include/video/mipi_display.h */
12168 #define _MIPIA_GEN_FIFO_STAT (dev_priv->mipi_mmio_base + 0xb074)
12169 #define _MIPIC_GEN_FIFO_STAT (dev_priv->mipi_mmio_base + 0xb874)
12170 #define MIPI_GEN_FIFO_STAT(port) _MMIO_MIPI(port, _MIPIA_GEN_FIFO_STAT, _MIPIC_GEN_FIFO_STAT)
12171 #define DPI_FIFO_EMPTY (1 << 28)
12172 #define DBI_FIFO_EMPTY (1 << 27)
12173 #define LP_CTRL_FIFO_EMPTY (1 << 26)
12174 #define LP_CTRL_FIFO_HALF_EMPTY (1 << 25)
12175 #define LP_CTRL_FIFO_FULL (1 << 24)
12176 #define HS_CTRL_FIFO_EMPTY (1 << 18)
12177 #define HS_CTRL_FIFO_HALF_EMPTY (1 << 17)
12178 #define HS_CTRL_FIFO_FULL (1 << 16)
12179 #define LP_DATA_FIFO_EMPTY (1 << 10)
12180 #define LP_DATA_FIFO_HALF_EMPTY (1 << 9)
12181 #define LP_DATA_FIFO_FULL (1 << 8)
12182 #define HS_DATA_FIFO_EMPTY (1 << 2)
12183 #define HS_DATA_FIFO_HALF_EMPTY (1 << 1)
12184 #define HS_DATA_FIFO_FULL (1 << 0)
12186 #define _MIPIA_HS_LS_DBI_ENABLE (dev_priv->mipi_mmio_base + 0xb078)
12187 #define _MIPIC_HS_LS_DBI_ENABLE (dev_priv->mipi_mmio_base + 0xb878)
12188 #define MIPI_HS_LP_DBI_ENABLE(port) _MMIO_MIPI(port, _MIPIA_HS_LS_DBI_ENABLE, _MIPIC_HS_LS_DBI_ENABLE)
12189 #define DBI_HS_LP_MODE_MASK (1 << 0)
12190 #define DBI_LP_MODE (1 << 0)
12191 #define DBI_HS_MODE (0 << 0)
12193 #define _MIPIA_DPHY_PARAM (dev_priv->mipi_mmio_base + 0xb080)
12194 #define _MIPIC_DPHY_PARAM (dev_priv->mipi_mmio_base + 0xb880)
12195 #define MIPI_DPHY_PARAM(port) _MMIO_MIPI(port, _MIPIA_DPHY_PARAM, _MIPIC_DPHY_PARAM)
12196 #define EXIT_ZERO_COUNT_SHIFT 24
12197 #define EXIT_ZERO_COUNT_MASK (0x3f << 24)
12198 #define TRAIL_COUNT_SHIFT 16
12199 #define TRAIL_COUNT_MASK (0x1f << 16)
12200 #define CLK_ZERO_COUNT_SHIFT 8
12201 #define CLK_ZERO_COUNT_MASK (0xff << 8)
12202 #define PREPARE_COUNT_SHIFT 0
12203 #define PREPARE_COUNT_MASK (0x3f << 0)
12205 #define _ICL_DSI_T_INIT_MASTER_0 0x6b088
12206 #define _ICL_DSI_T_INIT_MASTER_1 0x6b888
12207 #define ICL_DSI_T_INIT_MASTER(port) _MMIO_PORT(port, \
12208 _ICL_DSI_T_INIT_MASTER_0,\
12209 _ICL_DSI_T_INIT_MASTER_1)
12211 #define _DPHY_CLK_TIMING_PARAM_0 0x162180
12212 #define _DPHY_CLK_TIMING_PARAM_1 0x6c180
12213 #define DPHY_CLK_TIMING_PARAM(port) _MMIO_PORT(port, \
12214 _DPHY_CLK_TIMING_PARAM_0,\
12215 _DPHY_CLK_TIMING_PARAM_1)
12216 #define _DSI_CLK_TIMING_PARAM_0 0x6b080
12217 #define _DSI_CLK_TIMING_PARAM_1 0x6b880
12218 #define DSI_CLK_TIMING_PARAM(port) _MMIO_PORT(port, \
12219 _DSI_CLK_TIMING_PARAM_0,\
12220 _DSI_CLK_TIMING_PARAM_1)
12221 #define CLK_PREPARE_OVERRIDE (1 << 31)
12222 #define CLK_PREPARE(x) ((x) << 28)
12223 #define CLK_PREPARE_MASK (0x7 << 28)
12224 #define CLK_PREPARE_SHIFT 28
12225 #define CLK_ZERO_OVERRIDE (1 << 27)
12226 #define CLK_ZERO(x) ((x) << 20)
12227 #define CLK_ZERO_MASK (0xf << 20)
12228 #define CLK_ZERO_SHIFT 20
12229 #define CLK_PRE_OVERRIDE (1 << 19)
12230 #define CLK_PRE(x) ((x) << 16)
12231 #define CLK_PRE_MASK (0x3 << 16)
12232 #define CLK_PRE_SHIFT 16
12233 #define CLK_POST_OVERRIDE (1 << 15)
12234 #define CLK_POST(x) ((x) << 8)
12235 #define CLK_POST_MASK (0x7 << 8)
12236 #define CLK_POST_SHIFT 8
12237 #define CLK_TRAIL_OVERRIDE (1 << 7)
12238 #define CLK_TRAIL(x) ((x) << 0)
12239 #define CLK_TRAIL_MASK (0xf << 0)
12240 #define CLK_TRAIL_SHIFT 0
12242 #define _DPHY_DATA_TIMING_PARAM_0 0x162184
12243 #define _DPHY_DATA_TIMING_PARAM_1 0x6c184
12244 #define DPHY_DATA_TIMING_PARAM(port) _MMIO_PORT(port, \
12245 _DPHY_DATA_TIMING_PARAM_0,\
12246 _DPHY_DATA_TIMING_PARAM_1)
12247 #define _DSI_DATA_TIMING_PARAM_0 0x6B084
12248 #define _DSI_DATA_TIMING_PARAM_1 0x6B884
12249 #define DSI_DATA_TIMING_PARAM(port) _MMIO_PORT(port, \
12250 _DSI_DATA_TIMING_PARAM_0,\
12251 _DSI_DATA_TIMING_PARAM_1)
12252 #define HS_PREPARE_OVERRIDE (1 << 31)
12253 #define HS_PREPARE(x) ((x) << 24)
12254 #define HS_PREPARE_MASK (0x7 << 24)
12255 #define HS_PREPARE_SHIFT 24
12256 #define HS_ZERO_OVERRIDE (1 << 23)
12257 #define HS_ZERO(x) ((x) << 16)
12258 #define HS_ZERO_MASK (0xf << 16)
12259 #define HS_ZERO_SHIFT 16
12260 #define HS_TRAIL_OVERRIDE (1 << 15)
12261 #define HS_TRAIL(x) ((x) << 8)
12262 #define HS_TRAIL_MASK (0x7 << 8)
12263 #define HS_TRAIL_SHIFT 8
12264 #define HS_EXIT_OVERRIDE (1 << 7)
12265 #define HS_EXIT(x) ((x) << 0)
12266 #define HS_EXIT_MASK (0x7 << 0)
12267 #define HS_EXIT_SHIFT 0
12269 #define _DPHY_TA_TIMING_PARAM_0 0x162188
12270 #define _DPHY_TA_TIMING_PARAM_1 0x6c188
12271 #define DPHY_TA_TIMING_PARAM(port) _MMIO_PORT(port, \
12272 _DPHY_TA_TIMING_PARAM_0,\
12273 _DPHY_TA_TIMING_PARAM_1)
12274 #define _DSI_TA_TIMING_PARAM_0 0x6b098
12275 #define _DSI_TA_TIMING_PARAM_1 0x6b898
12276 #define DSI_TA_TIMING_PARAM(port) _MMIO_PORT(port, \
12277 _DSI_TA_TIMING_PARAM_0,\
12278 _DSI_TA_TIMING_PARAM_1)
12279 #define TA_SURE_OVERRIDE (1 << 31)
12280 #define TA_SURE(x) ((x) << 16)
12281 #define TA_SURE_MASK (0x1f << 16)
12282 #define TA_SURE_SHIFT 16
12283 #define TA_GO_OVERRIDE (1 << 15)
12284 #define TA_GO(x) ((x) << 8)
12285 #define TA_GO_MASK (0xf << 8)
12286 #define TA_GO_SHIFT 8
12287 #define TA_GET_OVERRIDE (1 << 7)
12288 #define TA_GET(x) ((x) << 0)
12289 #define TA_GET_MASK (0xf << 0)
12290 #define TA_GET_SHIFT 0
12292 /* DSI transcoder configuration */
12293 #define _DSI_TRANS_FUNC_CONF_0 0x6b030
12294 #define _DSI_TRANS_FUNC_CONF_1 0x6b830
12295 #define DSI_TRANS_FUNC_CONF(tc) _MMIO_DSI(tc, \
12296 _DSI_TRANS_FUNC_CONF_0,\
12297 _DSI_TRANS_FUNC_CONF_1)
12298 #define OP_MODE_MASK (0x3 << 28)
12299 #define OP_MODE_SHIFT 28
12300 #define CMD_MODE_NO_GATE (0x0 << 28)
12301 #define CMD_MODE_TE_GATE (0x1 << 28)
12302 #define VIDEO_MODE_SYNC_EVENT (0x2 << 28)
12303 #define VIDEO_MODE_SYNC_PULSE (0x3 << 28)
12304 #define TE_SOURCE_GPIO (1 << 27)
12305 #define LINK_READY (1 << 20)
12306 #define PIX_FMT_MASK (0x3 << 16)
12307 #define PIX_FMT_SHIFT 16
12308 #define PIX_FMT_RGB565 (0x0 << 16)
12309 #define PIX_FMT_RGB666_PACKED (0x1 << 16)
12310 #define PIX_FMT_RGB666_LOOSE (0x2 << 16)
12311 #define PIX_FMT_RGB888 (0x3 << 16)
12312 #define PIX_FMT_RGB101010 (0x4 << 16)
12313 #define PIX_FMT_RGB121212 (0x5 << 16)
12314 #define PIX_FMT_COMPRESSED (0x6 << 16)
12315 #define BGR_TRANSMISSION (1 << 15)
12316 #define PIX_VIRT_CHAN(x) ((x) << 12)
12317 #define PIX_VIRT_CHAN_MASK (0x3 << 12)
12318 #define PIX_VIRT_CHAN_SHIFT 12
12319 #define PIX_BUF_THRESHOLD_MASK (0x3 << 10)
12320 #define PIX_BUF_THRESHOLD_SHIFT 10
12321 #define PIX_BUF_THRESHOLD_1_4 (0x0 << 10)
12322 #define PIX_BUF_THRESHOLD_1_2 (0x1 << 10)
12323 #define PIX_BUF_THRESHOLD_3_4 (0x2 << 10)
12324 #define PIX_BUF_THRESHOLD_FULL (0x3 << 10)
12325 #define CONTINUOUS_CLK_MASK (0x3 << 8)
12326 #define CONTINUOUS_CLK_SHIFT 8
12327 #define CLK_ENTER_LP_AFTER_DATA (0x0 << 8)
12328 #define CLK_HS_OR_LP (0x2 << 8)
12329 #define CLK_HS_CONTINUOUS (0x3 << 8)
12330 #define LINK_CALIBRATION_MASK (0x3 << 4)
12331 #define LINK_CALIBRATION_SHIFT 4
12332 #define CALIBRATION_DISABLED (0x0 << 4)
12333 #define CALIBRATION_ENABLED_INITIAL_ONLY (0x2 << 4)
12334 #define CALIBRATION_ENABLED_INITIAL_PERIODIC (0x3 << 4)
12335 #define BLANKING_PACKET_ENABLE (1 << 2)
12336 #define S3D_ORIENTATION_LANDSCAPE (1 << 1)
12337 #define EOTP_DISABLED (1 << 0)
12339 #define _DSI_CMD_RXCTL_0 0x6b0d4
12340 #define _DSI_CMD_RXCTL_1 0x6b8d4
12341 #define DSI_CMD_RXCTL(tc) _MMIO_DSI(tc, \
12344 #define READ_UNLOADS_DW (1 << 16)
12345 #define RECEIVED_UNASSIGNED_TRIGGER (1 << 15)
12346 #define RECEIVED_ACKNOWLEDGE_TRIGGER (1 << 14)
12347 #define RECEIVED_TEAR_EFFECT_TRIGGER (1 << 13)
12348 #define RECEIVED_RESET_TRIGGER (1 << 12)
12349 #define RECEIVED_PAYLOAD_WAS_LOST (1 << 11)
12350 #define RECEIVED_CRC_WAS_LOST (1 << 10)
12351 #define NUMBER_RX_PLOAD_DW_MASK (0xff << 0)
12352 #define NUMBER_RX_PLOAD_DW_SHIFT 0
12354 #define _DSI_CMD_TXCTL_0 0x6b0d0
12355 #define _DSI_CMD_TXCTL_1 0x6b8d0
12356 #define DSI_CMD_TXCTL(tc) _MMIO_DSI(tc, \
12359 #define KEEP_LINK_IN_HS (1 << 24)
12360 #define FREE_HEADER_CREDIT_MASK (0x1f << 8)
12361 #define FREE_HEADER_CREDIT_SHIFT 0x8
12362 #define FREE_PLOAD_CREDIT_MASK (0xff << 0)
12363 #define FREE_PLOAD_CREDIT_SHIFT 0
12364 #define MAX_HEADER_CREDIT 0x10
12365 #define MAX_PLOAD_CREDIT 0x40
12367 #define _DSI_CMD_TXHDR_0 0x6b100
12368 #define _DSI_CMD_TXHDR_1 0x6b900
12369 #define DSI_CMD_TXHDR(tc) _MMIO_DSI(tc, \
12372 #define PAYLOAD_PRESENT (1 << 31)
12373 #define LP_DATA_TRANSFER (1 << 30)
12374 #define VBLANK_FENCE (1 << 29)
12375 #define PARAM_WC_MASK (0xffff << 8)
12376 #define PARAM_WC_LOWER_SHIFT 8
12377 #define PARAM_WC_UPPER_SHIFT 16
12378 #define VC_MASK (0x3 << 6)
12380 #define DT_MASK (0x3f << 0)
12383 #define _DSI_CMD_TXPYLD_0 0x6b104
12384 #define _DSI_CMD_TXPYLD_1 0x6b904
12385 #define DSI_CMD_TXPYLD(tc) _MMIO_DSI(tc, \
12386 _DSI_CMD_TXPYLD_0,\
12389 #define _DSI_LP_MSG_0 0x6b0d8
12390 #define _DSI_LP_MSG_1 0x6b8d8
12391 #define DSI_LP_MSG(tc) _MMIO_DSI(tc, \
12394 #define LPTX_IN_PROGRESS (1 << 17)
12395 #define LINK_IN_ULPS (1 << 16)
12396 #define LINK_ULPS_TYPE_LP11 (1 << 8)
12397 #define LINK_ENTER_ULPS (1 << 0)
12399 /* DSI timeout registers */
12400 #define _DSI_HSTX_TO_0 0x6b044
12401 #define _DSI_HSTX_TO_1 0x6b844
12402 #define DSI_HSTX_TO(tc) _MMIO_DSI(tc, \
12405 #define HSTX_TIMEOUT_VALUE_MASK (0xffff << 16)
12406 #define HSTX_TIMEOUT_VALUE_SHIFT 16
12407 #define HSTX_TIMEOUT_VALUE(x) ((x) << 16)
12408 #define HSTX_TIMED_OUT (1 << 0)
12410 #define _DSI_LPRX_HOST_TO_0 0x6b048
12411 #define _DSI_LPRX_HOST_TO_1 0x6b848
12412 #define DSI_LPRX_HOST_TO(tc) _MMIO_DSI(tc, \
12413 _DSI_LPRX_HOST_TO_0,\
12414 _DSI_LPRX_HOST_TO_1)
12415 #define LPRX_TIMED_OUT (1 << 16)
12416 #define LPRX_TIMEOUT_VALUE_MASK (0xffff << 0)
12417 #define LPRX_TIMEOUT_VALUE_SHIFT 0
12418 #define LPRX_TIMEOUT_VALUE(x) ((x) << 0)
12420 #define _DSI_PWAIT_TO_0 0x6b040
12421 #define _DSI_PWAIT_TO_1 0x6b840
12422 #define DSI_PWAIT_TO(tc) _MMIO_DSI(tc, \
12425 #define PRESET_TIMEOUT_VALUE_MASK (0xffff << 16)
12426 #define PRESET_TIMEOUT_VALUE_SHIFT 16
12427 #define PRESET_TIMEOUT_VALUE(x) ((x) << 16)
12428 #define PRESPONSE_TIMEOUT_VALUE_MASK (0xffff << 0)
12429 #define PRESPONSE_TIMEOUT_VALUE_SHIFT 0
12430 #define PRESPONSE_TIMEOUT_VALUE(x) ((x) << 0)
12432 #define _DSI_TA_TO_0 0x6b04c
12433 #define _DSI_TA_TO_1 0x6b84c
12434 #define DSI_TA_TO(tc) _MMIO_DSI(tc, \
12437 #define TA_TIMED_OUT (1 << 16)
12438 #define TA_TIMEOUT_VALUE_MASK (0xffff << 0)
12439 #define TA_TIMEOUT_VALUE_SHIFT 0
12440 #define TA_TIMEOUT_VALUE(x) ((x) << 0)
12443 #define _MIPIA_DBI_BW_CTRL (dev_priv->mipi_mmio_base + 0xb084)
12444 #define _MIPIC_DBI_BW_CTRL (dev_priv->mipi_mmio_base + 0xb884)
12445 #define MIPI_DBI_BW_CTRL(port) _MMIO_MIPI(port, _MIPIA_DBI_BW_CTRL, _MIPIC_DBI_BW_CTRL)
12447 #define _MIPIA_CLK_LANE_SWITCH_TIME_CNT (dev_priv->mipi_mmio_base + 0xb088)
12448 #define _MIPIC_CLK_LANE_SWITCH_TIME_CNT (dev_priv->mipi_mmio_base + 0xb888)
12449 #define MIPI_CLK_LANE_SWITCH_TIME_CNT(port) _MMIO_MIPI(port, _MIPIA_CLK_LANE_SWITCH_TIME_CNT, _MIPIC_CLK_LANE_SWITCH_TIME_CNT)
12450 #define LP_HS_SSW_CNT_SHIFT 16
12451 #define LP_HS_SSW_CNT_MASK (0xffff << 16)
12452 #define HS_LP_PWR_SW_CNT_SHIFT 0
12453 #define HS_LP_PWR_SW_CNT_MASK (0xffff << 0)
12455 #define _MIPIA_STOP_STATE_STALL (dev_priv->mipi_mmio_base + 0xb08c)
12456 #define _MIPIC_STOP_STATE_STALL (dev_priv->mipi_mmio_base + 0xb88c)
12457 #define MIPI_STOP_STATE_STALL(port) _MMIO_MIPI(port, _MIPIA_STOP_STATE_STALL, _MIPIC_STOP_STATE_STALL)
12458 #define STOP_STATE_STALL_COUNTER_SHIFT 0
12459 #define STOP_STATE_STALL_COUNTER_MASK (0xff << 0)
12461 #define _MIPIA_INTR_STAT_REG_1 (dev_priv->mipi_mmio_base + 0xb090)
12462 #define _MIPIC_INTR_STAT_REG_1 (dev_priv->mipi_mmio_base + 0xb890)
12463 #define MIPI_INTR_STAT_REG_1(port) _MMIO_MIPI(port, _MIPIA_INTR_STAT_REG_1, _MIPIC_INTR_STAT_REG_1)
12464 #define _MIPIA_INTR_EN_REG_1 (dev_priv->mipi_mmio_base + 0xb094)
12465 #define _MIPIC_INTR_EN_REG_1 (dev_priv->mipi_mmio_base + 0xb894)
12466 #define MIPI_INTR_EN_REG_1(port) _MMIO_MIPI(port, _MIPIA_INTR_EN_REG_1, _MIPIC_INTR_EN_REG_1)
12467 #define RX_CONTENTION_DETECTED (1 << 0)
12469 /* XXX: only pipe A ?!? */
12470 #define MIPIA_DBI_TYPEC_CTRL (dev_priv->mipi_mmio_base + 0xb100)
12471 #define DBI_TYPEC_ENABLE (1 << 31)
12472 #define DBI_TYPEC_WIP (1 << 30)
12473 #define DBI_TYPEC_OPTION_SHIFT 28
12474 #define DBI_TYPEC_OPTION_MASK (3 << 28)
12475 #define DBI_TYPEC_FREQ_SHIFT 24
12476 #define DBI_TYPEC_FREQ_MASK (0xf << 24)
12477 #define DBI_TYPEC_OVERRIDE (1 << 8)
12478 #define DBI_TYPEC_OVERRIDE_COUNTER_SHIFT 0
12479 #define DBI_TYPEC_OVERRIDE_COUNTER_MASK (0xff << 0)
12482 /* MIPI adapter registers */
12484 #define _MIPIA_CTRL (dev_priv->mipi_mmio_base + 0xb104)
12485 #define _MIPIC_CTRL (dev_priv->mipi_mmio_base + 0xb904)
12486 #define MIPI_CTRL(port) _MMIO_MIPI(port, _MIPIA_CTRL, _MIPIC_CTRL)
12487 #define ESCAPE_CLOCK_DIVIDER_SHIFT 5 /* A only */
12488 #define ESCAPE_CLOCK_DIVIDER_MASK (3 << 5)
12489 #define ESCAPE_CLOCK_DIVIDER_1 (0 << 5)
12490 #define ESCAPE_CLOCK_DIVIDER_2 (1 << 5)
12491 #define ESCAPE_CLOCK_DIVIDER_4 (2 << 5)
12492 #define READ_REQUEST_PRIORITY_SHIFT 3
12493 #define READ_REQUEST_PRIORITY_MASK (3 << 3)
12494 #define READ_REQUEST_PRIORITY_LOW (0 << 3)
12495 #define READ_REQUEST_PRIORITY_HIGH (3 << 3)
12496 #define RGB_FLIP_TO_BGR (1 << 2)
12498 #define BXT_PIPE_SELECT_SHIFT 7
12499 #define BXT_PIPE_SELECT_MASK (7 << 7)
12500 #define BXT_PIPE_SELECT(pipe) ((pipe) << 7)
12501 #define GLK_PHY_STATUS_PORT_READY (1 << 31) /* RO */
12502 #define GLK_ULPS_NOT_ACTIVE (1 << 30) /* RO */
12503 #define GLK_MIPIIO_RESET_RELEASED (1 << 28)
12504 #define GLK_CLOCK_LANE_STOP_STATE (1 << 27) /* RO */
12505 #define GLK_DATA_LANE_STOP_STATE (1 << 26) /* RO */
12506 #define GLK_LP_WAKE (1 << 22)
12507 #define GLK_LP11_LOW_PWR_MODE (1 << 21)
12508 #define GLK_LP00_LOW_PWR_MODE (1 << 20)
12509 #define GLK_FIREWALL_ENABLE (1 << 16)
12510 #define BXT_PIXEL_OVERLAP_CNT_MASK (0xf << 10)
12511 #define BXT_PIXEL_OVERLAP_CNT_SHIFT 10
12512 #define BXT_DSC_ENABLE (1 << 3)
12513 #define BXT_RGB_FLIP (1 << 2)
12514 #define GLK_MIPIIO_PORT_POWERED (1 << 1) /* RO */
12515 #define GLK_MIPIIO_ENABLE (1 << 0)
12517 #define _MIPIA_DATA_ADDRESS (dev_priv->mipi_mmio_base + 0xb108)
12518 #define _MIPIC_DATA_ADDRESS (dev_priv->mipi_mmio_base + 0xb908)
12519 #define MIPI_DATA_ADDRESS(port) _MMIO_MIPI(port, _MIPIA_DATA_ADDRESS, _MIPIC_DATA_ADDRESS)
12520 #define DATA_MEM_ADDRESS_SHIFT 5
12521 #define DATA_MEM_ADDRESS_MASK (0x7ffffff << 5)
12522 #define DATA_VALID (1 << 0)
12524 #define _MIPIA_DATA_LENGTH (dev_priv->mipi_mmio_base + 0xb10c)
12525 #define _MIPIC_DATA_LENGTH (dev_priv->mipi_mmio_base + 0xb90c)
12526 #define MIPI_DATA_LENGTH(port) _MMIO_MIPI(port, _MIPIA_DATA_LENGTH, _MIPIC_DATA_LENGTH)
12527 #define DATA_LENGTH_SHIFT 0
12528 #define DATA_LENGTH_MASK (0xfffff << 0)
12530 #define _MIPIA_COMMAND_ADDRESS (dev_priv->mipi_mmio_base + 0xb110)
12531 #define _MIPIC_COMMAND_ADDRESS (dev_priv->mipi_mmio_base + 0xb910)
12532 #define MIPI_COMMAND_ADDRESS(port) _MMIO_MIPI(port, _MIPIA_COMMAND_ADDRESS, _MIPIC_COMMAND_ADDRESS)
12533 #define COMMAND_MEM_ADDRESS_SHIFT 5
12534 #define COMMAND_MEM_ADDRESS_MASK (0x7ffffff << 5)
12535 #define AUTO_PWG_ENABLE (1 << 2)
12536 #define MEMORY_WRITE_DATA_FROM_PIPE_RENDERING (1 << 1)
12537 #define COMMAND_VALID (1 << 0)
12539 #define _MIPIA_COMMAND_LENGTH (dev_priv->mipi_mmio_base + 0xb114)
12540 #define _MIPIC_COMMAND_LENGTH (dev_priv->mipi_mmio_base + 0xb914)
12541 #define MIPI_COMMAND_LENGTH(port) _MMIO_MIPI(port, _MIPIA_COMMAND_LENGTH, _MIPIC_COMMAND_LENGTH)
12542 #define COMMAND_LENGTH_SHIFT(n) (8 * (n)) /* n: 0...3 */
12543 #define COMMAND_LENGTH_MASK(n) (0xff << (8 * (n)))
12545 #define _MIPIA_READ_DATA_RETURN0 (dev_priv->mipi_mmio_base + 0xb118)
12546 #define _MIPIC_READ_DATA_RETURN0 (dev_priv->mipi_mmio_base + 0xb918)
12547 #define MIPI_READ_DATA_RETURN(port, n) _MMIO(_MIPI(port, _MIPIA_READ_DATA_RETURN0, _MIPIC_READ_DATA_RETURN0) + 4 * (n)) /* n: 0...7 */
12549 #define _MIPIA_READ_DATA_VALID (dev_priv->mipi_mmio_base + 0xb138)
12550 #define _MIPIC_READ_DATA_VALID (dev_priv->mipi_mmio_base + 0xb938)
12551 #define MIPI_READ_DATA_VALID(port) _MMIO_MIPI(port, _MIPIA_READ_DATA_VALID, _MIPIC_READ_DATA_VALID)
12552 #define READ_DATA_VALID(n) (1 << (n))
12554 /* MOCS (Memory Object Control State) registers */
12555 #define GEN9_LNCFCMOCS(i) _MMIO(0xb020 + (i) * 4) /* L3 Cache Control */
12556 #define GEN9_LNCFCMOCS_REG_COUNT 32
12558 #define __GEN9_RCS0_MOCS0 0xc800
12559 #define GEN9_GFX_MOCS(i) _MMIO(__GEN9_RCS0_MOCS0 + (i) * 4)
12560 #define __GEN9_VCS0_MOCS0 0xc900
12561 #define GEN9_MFX0_MOCS(i) _MMIO(__GEN9_VCS0_MOCS0 + (i) * 4)
12562 #define __GEN9_VCS1_MOCS0 0xca00
12563 #define GEN9_MFX1_MOCS(i) _MMIO(__GEN9_VCS1_MOCS0 + (i) * 4)
12564 #define __GEN9_VECS0_MOCS0 0xcb00
12565 #define GEN9_VEBOX_MOCS(i) _MMIO(__GEN9_VECS0_MOCS0 + (i) * 4)
12566 #define __GEN9_BCS0_MOCS0 0xcc00
12567 #define GEN9_BLT_MOCS(i) _MMIO(__GEN9_BCS0_MOCS0 + (i) * 4)
12568 #define __GEN11_VCS2_MOCS0 0x10000
12569 #define GEN11_MFX2_MOCS(i) _MMIO(__GEN11_VCS2_MOCS0 + (i) * 4)
12571 #define GEN9_SCRATCH_LNCF1 _MMIO(0xb008)
12572 #define GEN9_LNCF_NONIA_COHERENT_ATOMICS_ENABLE REG_BIT(0)
12574 #define GEN9_SCRATCH1 _MMIO(0xb11c)
12575 #define EVICTION_PERF_FIX_ENABLE REG_BIT(8)
12577 #define GEN10_SCRATCH_LNCF2 _MMIO(0xb0a0)
12578 #define PMFLUSHDONE_LNICRSDROP (1 << 20)
12579 #define PMFLUSH_GAPL3UNBLOCK (1 << 21)
12580 #define PMFLUSHDONE_LNEBLK (1 << 22)
12582 #define XEHP_L3NODEARBCFG _MMIO(0xb0b4)
12583 #define XEHP_LNESPARE REG_BIT(19)
12585 #define GEN12_GLOBAL_MOCS(i) _MMIO(0x4000 + (i) * 4) /* Global MOCS regs */
12587 #define GEN12_GSMBASE _MMIO(0x108100)
12588 #define GEN12_DSMBASE _MMIO(0x1080C0)
12590 #define XEHP_CLOCK_GATE_DIS _MMIO(0x101014)
12591 #define SGSI_SIDECLK_DIS REG_BIT(17)
12592 #define SGGI_DIS REG_BIT(15)
12593 #define SGR_DIS REG_BIT(13)
12596 #define GEN8_L3_LRA_1_GPGPU _MMIO(0x4dd4)
12597 #define GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW 0x67F1427F /* max/min for LRA1/2 */
12598 #define GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV 0x5FF101FF /* max/min for LRA1/2 */
12599 #define GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL 0x67F1427F /* " " */
12600 #define GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_BXT 0x5FF101FF /* " " */
12602 #define MMCD_MISC_CTRL _MMIO(0x4ddc) /* skl+ */
12603 #define MMCD_PCLA (1 << 31)
12604 #define MMCD_HOTSPOT_EN (1 << 27)
12606 #define _ICL_PHY_MISC_A 0x64C00
12607 #define _ICL_PHY_MISC_B 0x64C04
12608 #define ICL_PHY_MISC(port) _MMIO_PORT(port, _ICL_PHY_MISC_A, \
12610 #define ICL_PHY_MISC_MUX_DDID (1 << 28)
12611 #define ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN (1 << 23)
12612 #define DG2_PHY_DP_TX_ACK_MASK REG_GENMASK(23, 20)
12614 /* Icelake Display Stream Compression Registers */
12615 #define DSCA_PICTURE_PARAMETER_SET_0 _MMIO(0x6B200)
12616 #define DSCC_PICTURE_PARAMETER_SET_0 _MMIO(0x6BA00)
12617 #define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PB 0x78270
12618 #define _ICL_DSC1_PICTURE_PARAMETER_SET_0_PB 0x78370
12619 #define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PC 0x78470
12620 #define _ICL_DSC1_PICTURE_PARAMETER_SET_0_PC 0x78570
12621 #define ICL_DSC0_PICTURE_PARAMETER_SET_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12622 _ICL_DSC0_PICTURE_PARAMETER_SET_0_PB, \
12623 _ICL_DSC0_PICTURE_PARAMETER_SET_0_PC)
12624 #define ICL_DSC1_PICTURE_PARAMETER_SET_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12625 _ICL_DSC1_PICTURE_PARAMETER_SET_0_PB, \
12626 _ICL_DSC1_PICTURE_PARAMETER_SET_0_PC)
12627 #define DSC_VBR_ENABLE (1 << 19)
12628 #define DSC_422_ENABLE (1 << 18)
12629 #define DSC_COLOR_SPACE_CONVERSION (1 << 17)
12630 #define DSC_BLOCK_PREDICTION (1 << 16)
12631 #define DSC_LINE_BUF_DEPTH_SHIFT 12
12632 #define DSC_BPC_SHIFT 8
12633 #define DSC_VER_MIN_SHIFT 4
12634 #define DSC_VER_MAJ (0x1 << 0)
12636 #define DSCA_PICTURE_PARAMETER_SET_1 _MMIO(0x6B204)
12637 #define DSCC_PICTURE_PARAMETER_SET_1 _MMIO(0x6BA04)
12638 #define _ICL_DSC0_PICTURE_PARAMETER_SET_1_PB 0x78274
12639 #define _ICL_DSC1_PICTURE_PARAMETER_SET_1_PB 0x78374
12640 #define _ICL_DSC0_PICTURE_PARAMETER_SET_1_PC 0x78474
12641 #define _ICL_DSC1_PICTURE_PARAMETER_SET_1_PC 0x78574
12642 #define ICL_DSC0_PICTURE_PARAMETER_SET_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12643 _ICL_DSC0_PICTURE_PARAMETER_SET_1_PB, \
12644 _ICL_DSC0_PICTURE_PARAMETER_SET_1_PC)
12645 #define ICL_DSC1_PICTURE_PARAMETER_SET_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12646 _ICL_DSC1_PICTURE_PARAMETER_SET_1_PB, \
12647 _ICL_DSC1_PICTURE_PARAMETER_SET_1_PC)
12648 #define DSC_BPP(bpp) ((bpp) << 0)
12650 #define DSCA_PICTURE_PARAMETER_SET_2 _MMIO(0x6B208)
12651 #define DSCC_PICTURE_PARAMETER_SET_2 _MMIO(0x6BA08)
12652 #define _ICL_DSC0_PICTURE_PARAMETER_SET_2_PB 0x78278
12653 #define _ICL_DSC1_PICTURE_PARAMETER_SET_2_PB 0x78378
12654 #define _ICL_DSC0_PICTURE_PARAMETER_SET_2_PC 0x78478
12655 #define _ICL_DSC1_PICTURE_PARAMETER_SET_2_PC 0x78578
12656 #define ICL_DSC0_PICTURE_PARAMETER_SET_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12657 _ICL_DSC0_PICTURE_PARAMETER_SET_2_PB, \
12658 _ICL_DSC0_PICTURE_PARAMETER_SET_2_PC)
12659 #define ICL_DSC1_PICTURE_PARAMETER_SET_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12660 _ICL_DSC1_PICTURE_PARAMETER_SET_2_PB, \
12661 _ICL_DSC1_PICTURE_PARAMETER_SET_2_PC)
12662 #define DSC_PIC_WIDTH(pic_width) ((pic_width) << 16)
12663 #define DSC_PIC_HEIGHT(pic_height) ((pic_height) << 0)
12665 #define DSCA_PICTURE_PARAMETER_SET_3 _MMIO(0x6B20C)
12666 #define DSCC_PICTURE_PARAMETER_SET_3 _MMIO(0x6BA0C)
12667 #define _ICL_DSC0_PICTURE_PARAMETER_SET_3_PB 0x7827C
12668 #define _ICL_DSC1_PICTURE_PARAMETER_SET_3_PB 0x7837C
12669 #define _ICL_DSC0_PICTURE_PARAMETER_SET_3_PC 0x7847C
12670 #define _ICL_DSC1_PICTURE_PARAMETER_SET_3_PC 0x7857C
12671 #define ICL_DSC0_PICTURE_PARAMETER_SET_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12672 _ICL_DSC0_PICTURE_PARAMETER_SET_3_PB, \
12673 _ICL_DSC0_PICTURE_PARAMETER_SET_3_PC)
12674 #define ICL_DSC1_PICTURE_PARAMETER_SET_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12675 _ICL_DSC1_PICTURE_PARAMETER_SET_3_PB, \
12676 _ICL_DSC1_PICTURE_PARAMETER_SET_3_PC)
12677 #define DSC_SLICE_WIDTH(slice_width) ((slice_width) << 16)
12678 #define DSC_SLICE_HEIGHT(slice_height) ((slice_height) << 0)
12680 #define DSCA_PICTURE_PARAMETER_SET_4 _MMIO(0x6B210)
12681 #define DSCC_PICTURE_PARAMETER_SET_4 _MMIO(0x6BA10)
12682 #define _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB 0x78280
12683 #define _ICL_DSC1_PICTURE_PARAMETER_SET_4_PB 0x78380
12684 #define _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC 0x78480
12685 #define _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC 0x78580
12686 #define ICL_DSC0_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12687 _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \
12688 _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC)
12689 #define ICL_DSC1_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12690 _ICL_DSC1_PICTURE_PARAMETER_SET_4_PB, \
12691 _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC)
12692 #define DSC_INITIAL_DEC_DELAY(dec_delay) ((dec_delay) << 16)
12693 #define DSC_INITIAL_XMIT_DELAY(xmit_delay) ((xmit_delay) << 0)
12695 #define DSCA_PICTURE_PARAMETER_SET_5 _MMIO(0x6B214)
12696 #define DSCC_PICTURE_PARAMETER_SET_5 _MMIO(0x6BA14)
12697 #define _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB 0x78284
12698 #define _ICL_DSC1_PICTURE_PARAMETER_SET_5_PB 0x78384
12699 #define _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC 0x78484
12700 #define _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC 0x78584
12701 #define ICL_DSC0_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12702 _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB, \
12703 _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC)
12704 #define ICL_DSC1_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12705 _ICL_DSC1_PICTURE_PARAMETER_SET_5_PB, \
12706 _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC)
12707 #define DSC_SCALE_DEC_INT(scale_dec) ((scale_dec) << 16)
12708 #define DSC_SCALE_INC_INT(scale_inc) ((scale_inc) << 0)
12710 #define DSCA_PICTURE_PARAMETER_SET_6 _MMIO(0x6B218)
12711 #define DSCC_PICTURE_PARAMETER_SET_6 _MMIO(0x6BA18)
12712 #define _ICL_DSC0_PICTURE_PARAMETER_SET_6_PB 0x78288
12713 #define _ICL_DSC1_PICTURE_PARAMETER_SET_6_PB 0x78388
12714 #define _ICL_DSC0_PICTURE_PARAMETER_SET_6_PC 0x78488
12715 #define _ICL_DSC1_PICTURE_PARAMETER_SET_6_PC 0x78588
12716 #define ICL_DSC0_PICTURE_PARAMETER_SET_6(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12717 _ICL_DSC0_PICTURE_PARAMETER_SET_6_PB, \
12718 _ICL_DSC0_PICTURE_PARAMETER_SET_6_PC)
12719 #define ICL_DSC1_PICTURE_PARAMETER_SET_6(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12720 _ICL_DSC1_PICTURE_PARAMETER_SET_6_PB, \
12721 _ICL_DSC1_PICTURE_PARAMETER_SET_6_PC)
12722 #define DSC_FLATNESS_MAX_QP(max_qp) ((max_qp) << 24)
12723 #define DSC_FLATNESS_MIN_QP(min_qp) ((min_qp) << 16)
12724 #define DSC_FIRST_LINE_BPG_OFFSET(offset) ((offset) << 8)
12725 #define DSC_INITIAL_SCALE_VALUE(value) ((value) << 0)
12727 #define DSCA_PICTURE_PARAMETER_SET_7 _MMIO(0x6B21C)
12728 #define DSCC_PICTURE_PARAMETER_SET_7 _MMIO(0x6BA1C)
12729 #define _ICL_DSC0_PICTURE_PARAMETER_SET_7_PB 0x7828C
12730 #define _ICL_DSC1_PICTURE_PARAMETER_SET_7_PB 0x7838C
12731 #define _ICL_DSC0_PICTURE_PARAMETER_SET_7_PC 0x7848C
12732 #define _ICL_DSC1_PICTURE_PARAMETER_SET_7_PC 0x7858C
12733 #define ICL_DSC0_PICTURE_PARAMETER_SET_7(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12734 _ICL_DSC0_PICTURE_PARAMETER_SET_7_PB, \
12735 _ICL_DSC0_PICTURE_PARAMETER_SET_7_PC)
12736 #define ICL_DSC1_PICTURE_PARAMETER_SET_7(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12737 _ICL_DSC1_PICTURE_PARAMETER_SET_7_PB, \
12738 _ICL_DSC1_PICTURE_PARAMETER_SET_7_PC)
12739 #define DSC_NFL_BPG_OFFSET(bpg_offset) ((bpg_offset) << 16)
12740 #define DSC_SLICE_BPG_OFFSET(bpg_offset) ((bpg_offset) << 0)
12742 #define DSCA_PICTURE_PARAMETER_SET_8 _MMIO(0x6B220)
12743 #define DSCC_PICTURE_PARAMETER_SET_8 _MMIO(0x6BA20)
12744 #define _ICL_DSC0_PICTURE_PARAMETER_SET_8_PB 0x78290
12745 #define _ICL_DSC1_PICTURE_PARAMETER_SET_8_PB 0x78390
12746 #define _ICL_DSC0_PICTURE_PARAMETER_SET_8_PC 0x78490
12747 #define _ICL_DSC1_PICTURE_PARAMETER_SET_8_PC 0x78590
12748 #define ICL_DSC0_PICTURE_PARAMETER_SET_8(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12749 _ICL_DSC0_PICTURE_PARAMETER_SET_8_PB, \
12750 _ICL_DSC0_PICTURE_PARAMETER_SET_8_PC)
12751 #define ICL_DSC1_PICTURE_PARAMETER_SET_8(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12752 _ICL_DSC1_PICTURE_PARAMETER_SET_8_PB, \
12753 _ICL_DSC1_PICTURE_PARAMETER_SET_8_PC)
12754 #define DSC_INITIAL_OFFSET(initial_offset) ((initial_offset) << 16)
12755 #define DSC_FINAL_OFFSET(final_offset) ((final_offset) << 0)
12757 #define DSCA_PICTURE_PARAMETER_SET_9 _MMIO(0x6B224)
12758 #define DSCC_PICTURE_PARAMETER_SET_9 _MMIO(0x6BA24)
12759 #define _ICL_DSC0_PICTURE_PARAMETER_SET_9_PB 0x78294
12760 #define _ICL_DSC1_PICTURE_PARAMETER_SET_9_PB 0x78394
12761 #define _ICL_DSC0_PICTURE_PARAMETER_SET_9_PC 0x78494
12762 #define _ICL_DSC1_PICTURE_PARAMETER_SET_9_PC 0x78594
12763 #define ICL_DSC0_PICTURE_PARAMETER_SET_9(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12764 _ICL_DSC0_PICTURE_PARAMETER_SET_9_PB, \
12765 _ICL_DSC0_PICTURE_PARAMETER_SET_9_PC)
12766 #define ICL_DSC1_PICTURE_PARAMETER_SET_9(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12767 _ICL_DSC1_PICTURE_PARAMETER_SET_9_PB, \
12768 _ICL_DSC1_PICTURE_PARAMETER_SET_9_PC)
12769 #define DSC_RC_EDGE_FACTOR(rc_edge_fact) ((rc_edge_fact) << 16)
12770 #define DSC_RC_MODEL_SIZE(rc_model_size) ((rc_model_size) << 0)
12772 #define DSCA_PICTURE_PARAMETER_SET_10 _MMIO(0x6B228)
12773 #define DSCC_PICTURE_PARAMETER_SET_10 _MMIO(0x6BA28)
12774 #define _ICL_DSC0_PICTURE_PARAMETER_SET_10_PB 0x78298
12775 #define _ICL_DSC1_PICTURE_PARAMETER_SET_10_PB 0x78398
12776 #define _ICL_DSC0_PICTURE_PARAMETER_SET_10_PC 0x78498
12777 #define _ICL_DSC1_PICTURE_PARAMETER_SET_10_PC 0x78598
12778 #define ICL_DSC0_PICTURE_PARAMETER_SET_10(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12779 _ICL_DSC0_PICTURE_PARAMETER_SET_10_PB, \
12780 _ICL_DSC0_PICTURE_PARAMETER_SET_10_PC)
12781 #define ICL_DSC1_PICTURE_PARAMETER_SET_10(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12782 _ICL_DSC1_PICTURE_PARAMETER_SET_10_PB, \
12783 _ICL_DSC1_PICTURE_PARAMETER_SET_10_PC)
12784 #define DSC_RC_TARGET_OFF_LOW(rc_tgt_off_low) ((rc_tgt_off_low) << 20)
12785 #define DSC_RC_TARGET_OFF_HIGH(rc_tgt_off_high) ((rc_tgt_off_high) << 16)
12786 #define DSC_RC_QUANT_INC_LIMIT1(lim) ((lim) << 8)
12787 #define DSC_RC_QUANT_INC_LIMIT0(lim) ((lim) << 0)
12789 #define DSCA_PICTURE_PARAMETER_SET_11 _MMIO(0x6B22C)
12790 #define DSCC_PICTURE_PARAMETER_SET_11 _MMIO(0x6BA2C)
12791 #define _ICL_DSC0_PICTURE_PARAMETER_SET_11_PB 0x7829C
12792 #define _ICL_DSC1_PICTURE_PARAMETER_SET_11_PB 0x7839C
12793 #define _ICL_DSC0_PICTURE_PARAMETER_SET_11_PC 0x7849C
12794 #define _ICL_DSC1_PICTURE_PARAMETER_SET_11_PC 0x7859C
12795 #define ICL_DSC0_PICTURE_PARAMETER_SET_11(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12796 _ICL_DSC0_PICTURE_PARAMETER_SET_11_PB, \
12797 _ICL_DSC0_PICTURE_PARAMETER_SET_11_PC)
12798 #define ICL_DSC1_PICTURE_PARAMETER_SET_11(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12799 _ICL_DSC1_PICTURE_PARAMETER_SET_11_PB, \
12800 _ICL_DSC1_PICTURE_PARAMETER_SET_11_PC)
12802 #define DSCA_PICTURE_PARAMETER_SET_12 _MMIO(0x6B260)
12803 #define DSCC_PICTURE_PARAMETER_SET_12 _MMIO(0x6BA60)
12804 #define _ICL_DSC0_PICTURE_PARAMETER_SET_12_PB 0x782A0
12805 #define _ICL_DSC1_PICTURE_PARAMETER_SET_12_PB 0x783A0
12806 #define _ICL_DSC0_PICTURE_PARAMETER_SET_12_PC 0x784A0
12807 #define _ICL_DSC1_PICTURE_PARAMETER_SET_12_PC 0x785A0
12808 #define ICL_DSC0_PICTURE_PARAMETER_SET_12(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12809 _ICL_DSC0_PICTURE_PARAMETER_SET_12_PB, \
12810 _ICL_DSC0_PICTURE_PARAMETER_SET_12_PC)
12811 #define ICL_DSC1_PICTURE_PARAMETER_SET_12(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12812 _ICL_DSC1_PICTURE_PARAMETER_SET_12_PB, \
12813 _ICL_DSC1_PICTURE_PARAMETER_SET_12_PC)
12815 #define DSCA_PICTURE_PARAMETER_SET_13 _MMIO(0x6B264)
12816 #define DSCC_PICTURE_PARAMETER_SET_13 _MMIO(0x6BA64)
12817 #define _ICL_DSC0_PICTURE_PARAMETER_SET_13_PB 0x782A4
12818 #define _ICL_DSC1_PICTURE_PARAMETER_SET_13_PB 0x783A4
12819 #define _ICL_DSC0_PICTURE_PARAMETER_SET_13_PC 0x784A4
12820 #define _ICL_DSC1_PICTURE_PARAMETER_SET_13_PC 0x785A4
12821 #define ICL_DSC0_PICTURE_PARAMETER_SET_13(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12822 _ICL_DSC0_PICTURE_PARAMETER_SET_13_PB, \
12823 _ICL_DSC0_PICTURE_PARAMETER_SET_13_PC)
12824 #define ICL_DSC1_PICTURE_PARAMETER_SET_13(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12825 _ICL_DSC1_PICTURE_PARAMETER_SET_13_PB, \
12826 _ICL_DSC1_PICTURE_PARAMETER_SET_13_PC)
12828 #define DSCA_PICTURE_PARAMETER_SET_14 _MMIO(0x6B268)
12829 #define DSCC_PICTURE_PARAMETER_SET_14 _MMIO(0x6BA68)
12830 #define _ICL_DSC0_PICTURE_PARAMETER_SET_14_PB 0x782A8
12831 #define _ICL_DSC1_PICTURE_PARAMETER_SET_14_PB 0x783A8
12832 #define _ICL_DSC0_PICTURE_PARAMETER_SET_14_PC 0x784A8
12833 #define _ICL_DSC1_PICTURE_PARAMETER_SET_14_PC 0x785A8
12834 #define ICL_DSC0_PICTURE_PARAMETER_SET_14(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12835 _ICL_DSC0_PICTURE_PARAMETER_SET_14_PB, \
12836 _ICL_DSC0_PICTURE_PARAMETER_SET_14_PC)
12837 #define ICL_DSC1_PICTURE_PARAMETER_SET_14(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12838 _ICL_DSC1_PICTURE_PARAMETER_SET_14_PB, \
12839 _ICL_DSC1_PICTURE_PARAMETER_SET_14_PC)
12841 #define DSCA_PICTURE_PARAMETER_SET_15 _MMIO(0x6B26C)
12842 #define DSCC_PICTURE_PARAMETER_SET_15 _MMIO(0x6BA6C)
12843 #define _ICL_DSC0_PICTURE_PARAMETER_SET_15_PB 0x782AC
12844 #define _ICL_DSC1_PICTURE_PARAMETER_SET_15_PB 0x783AC
12845 #define _ICL_DSC0_PICTURE_PARAMETER_SET_15_PC 0x784AC
12846 #define _ICL_DSC1_PICTURE_PARAMETER_SET_15_PC 0x785AC
12847 #define ICL_DSC0_PICTURE_PARAMETER_SET_15(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12848 _ICL_DSC0_PICTURE_PARAMETER_SET_15_PB, \
12849 _ICL_DSC0_PICTURE_PARAMETER_SET_15_PC)
12850 #define ICL_DSC1_PICTURE_PARAMETER_SET_15(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12851 _ICL_DSC1_PICTURE_PARAMETER_SET_15_PB, \
12852 _ICL_DSC1_PICTURE_PARAMETER_SET_15_PC)
12854 #define DSCA_PICTURE_PARAMETER_SET_16 _MMIO(0x6B270)
12855 #define DSCC_PICTURE_PARAMETER_SET_16 _MMIO(0x6BA70)
12856 #define _ICL_DSC0_PICTURE_PARAMETER_SET_16_PB 0x782B0
12857 #define _ICL_DSC1_PICTURE_PARAMETER_SET_16_PB 0x783B0
12858 #define _ICL_DSC0_PICTURE_PARAMETER_SET_16_PC 0x784B0
12859 #define _ICL_DSC1_PICTURE_PARAMETER_SET_16_PC 0x785B0
12860 #define ICL_DSC0_PICTURE_PARAMETER_SET_16(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12861 _ICL_DSC0_PICTURE_PARAMETER_SET_16_PB, \
12862 _ICL_DSC0_PICTURE_PARAMETER_SET_16_PC)
12863 #define ICL_DSC1_PICTURE_PARAMETER_SET_16(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12864 _ICL_DSC1_PICTURE_PARAMETER_SET_16_PB, \
12865 _ICL_DSC1_PICTURE_PARAMETER_SET_16_PC)
12866 #define DSC_SLICE_ROW_PER_FRAME(slice_row_per_frame) ((slice_row_per_frame) << 20)
12867 #define DSC_SLICE_PER_LINE(slice_per_line) ((slice_per_line) << 16)
12868 #define DSC_SLICE_CHUNK_SIZE(slice_chunk_size) ((slice_chunk_size) << 0)
12870 /* Icelake Rate Control Buffer Threshold Registers */
12871 #define DSCA_RC_BUF_THRESH_0 _MMIO(0x6B230)
12872 #define DSCA_RC_BUF_THRESH_0_UDW _MMIO(0x6B230 + 4)
12873 #define DSCC_RC_BUF_THRESH_0 _MMIO(0x6BA30)
12874 #define DSCC_RC_BUF_THRESH_0_UDW _MMIO(0x6BA30 + 4)
12875 #define _ICL_DSC0_RC_BUF_THRESH_0_PB (0x78254)
12876 #define _ICL_DSC0_RC_BUF_THRESH_0_UDW_PB (0x78254 + 4)
12877 #define _ICL_DSC1_RC_BUF_THRESH_0_PB (0x78354)
12878 #define _ICL_DSC1_RC_BUF_THRESH_0_UDW_PB (0x78354 + 4)
12879 #define _ICL_DSC0_RC_BUF_THRESH_0_PC (0x78454)
12880 #define _ICL_DSC0_RC_BUF_THRESH_0_UDW_PC (0x78454 + 4)
12881 #define _ICL_DSC1_RC_BUF_THRESH_0_PC (0x78554)
12882 #define _ICL_DSC1_RC_BUF_THRESH_0_UDW_PC (0x78554 + 4)
12883 #define ICL_DSC0_RC_BUF_THRESH_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12884 _ICL_DSC0_RC_BUF_THRESH_0_PB, \
12885 _ICL_DSC0_RC_BUF_THRESH_0_PC)
12886 #define ICL_DSC0_RC_BUF_THRESH_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12887 _ICL_DSC0_RC_BUF_THRESH_0_UDW_PB, \
12888 _ICL_DSC0_RC_BUF_THRESH_0_UDW_PC)
12889 #define ICL_DSC1_RC_BUF_THRESH_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12890 _ICL_DSC1_RC_BUF_THRESH_0_PB, \
12891 _ICL_DSC1_RC_BUF_THRESH_0_PC)
12892 #define ICL_DSC1_RC_BUF_THRESH_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12893 _ICL_DSC1_RC_BUF_THRESH_0_UDW_PB, \
12894 _ICL_DSC1_RC_BUF_THRESH_0_UDW_PC)
12896 #define DSCA_RC_BUF_THRESH_1 _MMIO(0x6B238)
12897 #define DSCA_RC_BUF_THRESH_1_UDW _MMIO(0x6B238 + 4)
12898 #define DSCC_RC_BUF_THRESH_1 _MMIO(0x6BA38)
12899 #define DSCC_RC_BUF_THRESH_1_UDW _MMIO(0x6BA38 + 4)
12900 #define _ICL_DSC0_RC_BUF_THRESH_1_PB (0x7825C)
12901 #define _ICL_DSC0_RC_BUF_THRESH_1_UDW_PB (0x7825C + 4)
12902 #define _ICL_DSC1_RC_BUF_THRESH_1_PB (0x7835C)
12903 #define _ICL_DSC1_RC_BUF_THRESH_1_UDW_PB (0x7835C + 4)
12904 #define _ICL_DSC0_RC_BUF_THRESH_1_PC (0x7845C)
12905 #define _ICL_DSC0_RC_BUF_THRESH_1_UDW_PC (0x7845C + 4)
12906 #define _ICL_DSC1_RC_BUF_THRESH_1_PC (0x7855C)
12907 #define _ICL_DSC1_RC_BUF_THRESH_1_UDW_PC (0x7855C + 4)
12908 #define ICL_DSC0_RC_BUF_THRESH_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12909 _ICL_DSC0_RC_BUF_THRESH_1_PB, \
12910 _ICL_DSC0_RC_BUF_THRESH_1_PC)
12911 #define ICL_DSC0_RC_BUF_THRESH_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12912 _ICL_DSC0_RC_BUF_THRESH_1_UDW_PB, \
12913 _ICL_DSC0_RC_BUF_THRESH_1_UDW_PC)
12914 #define ICL_DSC1_RC_BUF_THRESH_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12915 _ICL_DSC1_RC_BUF_THRESH_1_PB, \
12916 _ICL_DSC1_RC_BUF_THRESH_1_PC)
12917 #define ICL_DSC1_RC_BUF_THRESH_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
12918 _ICL_DSC1_RC_BUF_THRESH_1_UDW_PB, \
12919 _ICL_DSC1_RC_BUF_THRESH_1_UDW_PC)
12921 #define PORT_TX_DFLEXDPSP(fia) _MMIO_FIA((fia), 0x008A0)
12922 #define MODULAR_FIA_MASK (1 << 4)
12923 #define TC_LIVE_STATE_TBT(idx) (1 << ((idx) * 8 + 6))
12924 #define TC_LIVE_STATE_TC(idx) (1 << ((idx) * 8 + 5))
12925 #define DP_LANE_ASSIGNMENT_SHIFT(idx) ((idx) * 8)
12926 #define DP_LANE_ASSIGNMENT_MASK(idx) (0xf << ((idx) * 8))
12927 #define DP_LANE_ASSIGNMENT(idx, x) ((x) << ((idx) * 8))
12929 #define PORT_TX_DFLEXDPPMS(fia) _MMIO_FIA((fia), 0x00890)
12930 #define DP_PHY_MODE_STATUS_COMPLETED(idx) (1 << (idx))
12932 #define PORT_TX_DFLEXDPCSSS(fia) _MMIO_FIA((fia), 0x00894)
12933 #define DP_PHY_MODE_STATUS_NOT_SAFE(idx) (1 << (idx))
12935 #define PORT_TX_DFLEXPA1(fia) _MMIO_FIA((fia), 0x00880)
12936 #define DP_PIN_ASSIGNMENT_SHIFT(idx) ((idx) * 4)
12937 #define DP_PIN_ASSIGNMENT_MASK(idx) (0xf << ((idx) * 4))
12938 #define DP_PIN_ASSIGNMENT(idx, x) ((x) << ((idx) * 4))
12940 #define _TCSS_DDI_STATUS_1 0x161500
12941 #define _TCSS_DDI_STATUS_2 0x161504
12942 #define TCSS_DDI_STATUS(tc) _MMIO(_PICK_EVEN(tc, \
12943 _TCSS_DDI_STATUS_1, \
12944 _TCSS_DDI_STATUS_2))
12945 #define TCSS_DDI_STATUS_READY REG_BIT(2)
12946 #define TCSS_DDI_STATUS_HPD_LIVE_STATUS_TBT REG_BIT(1)
12947 #define TCSS_DDI_STATUS_HPD_LIVE_STATUS_ALT REG_BIT(0)
12949 /* This register controls the Display State Buffer (DSB) engines. */
12950 #define _DSBSL_INSTANCE_BASE 0x70B00
12951 #define DSBSL_INSTANCE(pipe, id) (_DSBSL_INSTANCE_BASE + \
12952 (pipe) * 0x1000 + (id) * 0x100)
12953 #define DSB_HEAD(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x0)
12954 #define DSB_TAIL(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x4)
12955 #define DSB_CTRL(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x8)
12956 #define DSB_ENABLE (1 << 31)
12957 #define DSB_STATUS (1 << 0)
12959 #define TGL_ROOT_DEVICE_ID 0x9A00
12960 #define TGL_ROOT_DEVICE_MASK 0xFF00
12961 #define TGL_ROOT_DEVICE_SKU_MASK 0xF
12962 #define TGL_ROOT_DEVICE_SKU_ULX 0x2
12963 #define TGL_ROOT_DEVICE_SKU_ULT 0x4
12965 #define CLKREQ_POLICY _MMIO(0x101038)
12966 #define CLKREQ_POLICY_MEM_UP_OVRD REG_BIT(1)
12968 #define CLKGATE_DIS_MISC _MMIO(0x46534)
12969 #define CLKGATE_DIS_MISC_DMASC_GATING_DIS REG_BIT(21)
12971 #define SLICE_COMMON_ECO_CHICKEN1 _MMIO(0x731C)
12972 #define MSC_MSAA_REODER_BUF_BYPASS_DISABLE REG_BIT(14)
12974 #endif /* _I915_REG_H_ */