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