1 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 2 * All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the 6 * "Software"), to deal in the Software without restriction, including 7 * without limitation the rights to use, copy, modify, merge, publish, 8 * distribute, sub license, and/or sell copies of the Software, and to 9 * permit persons to whom the Software is furnished to do so, subject to 10 * the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the 13 * next paragraph) shall be included in all copies or substantial portions 14 * of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 19 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 #ifndef _I915_REG_H_ 26 #define _I915_REG_H_ 27 28 #include "i915_reg_defs.h" 29 30 /** 31 * DOC: The i915 register macro definition style guide 32 * 33 * Follow the style described here for new macros, and while changing existing 34 * macros. Do **not** mass change existing definitions just to update the style. 35 * 36 * File Layout 37 * ~~~~~~~~~~~ 38 * 39 * Keep helper macros near the top. For example, _PIPE() and friends. 40 * 41 * Prefix macros that generally should not be used outside of this file with 42 * underscore '_'. For example, _PIPE() and friends, single instances of 43 * registers that are defined solely for the use by function-like macros. 44 * 45 * Avoid using the underscore prefixed macros outside of this file. There are 46 * exceptions, but keep them to a minimum. 47 * 48 * There are two basic types of register definitions: Single registers and 49 * register groups. Register groups are registers which have two or more 50 * instances, for example one per pipe, port, transcoder, etc. Register groups 51 * should be defined using function-like macros. 52 * 53 * For single registers, define the register offset first, followed by register 54 * contents. 55 * 56 * For register groups, define the register instance offsets first, prefixed 57 * with underscore, followed by a function-like macro choosing the right 58 * instance based on the parameter, followed by register contents. 59 * 60 * Define the register contents (i.e. bit and bit field macros) from most 61 * significant to least significant bit. Indent the register content macros 62 * using two extra spaces between ``#define`` and the macro name. 63 * 64 * Define bit fields using ``REG_GENMASK(h, l)``. Define bit field contents 65 * using ``REG_FIELD_PREP(mask, value)``. This will define the values already 66 * shifted in place, so they can be directly OR'd together. For convenience, 67 * function-like macros may be used to define bit fields, but do note that the 68 * macros may be needed to read as well as write the register contents. 69 * 70 * Define bits using ``REG_BIT(N)``. Do **not** add ``_BIT`` suffix to the name. 71 * 72 * Group the register and its contents together without blank lines, separate 73 * from other registers and their contents with one blank line. 74 * 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. 79 * 80 * Naming 81 * ~~~~~~ 82 * 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. 85 * 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. 89 * 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. 93 * 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``. 97 * 98 * Examples 99 * ~~~~~~~~ 100 * 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 103 * definitions.):: 104 * 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 REG_BIT(31) 109 * #define FOO_MODE_MASK REG_GENMASK(19, 16) 110 * #define FOO_MODE_BAR REG_FIELD_PREP(FOO_MODE_MASK, 0) 111 * #define FOO_MODE_BAZ REG_FIELD_PREP(FOO_MODE_MASK, 1) 112 * #define FOO_MODE_QUX_SNB REG_FIELD_PREP(FOO_MODE_MASK, 2) 113 * 114 * #define BAR _MMIO(0xb000) 115 * #define GEN8_BAR _MMIO(0xb888) 116 */ 117 118 #define DISPLAY_MMIO_BASE(dev_priv) (INTEL_INFO(dev_priv)->display.mmio_offset) 119 120 /* 121 * Given the first two numbers __a and __b of arbitrarily many evenly spaced 122 * numbers, pick the 0-based __index'th value. 123 * 124 * Always prefer this over _PICK() if the numbers are evenly spaced. 125 */ 126 #define _PICK_EVEN(__index, __a, __b) ((__a) + (__index) * ((__b) - (__a))) 127 128 /* 129 * Given the arbitrary numbers in varargs, pick the 0-based __index'th number. 130 * 131 * Always prefer _PICK_EVEN() over this if the numbers are evenly spaced. 132 */ 133 #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index]) 134 135 /* 136 * Named helper wrappers around _PICK_EVEN() and _PICK(). 137 */ 138 #define _PIPE(pipe, a, b) _PICK_EVEN(pipe, a, b) 139 #define _PLANE(plane, a, b) _PICK_EVEN(plane, a, b) 140 #define _TRANS(tran, a, b) _PICK_EVEN(tran, a, b) 141 #define _PORT(port, a, b) _PICK_EVEN(port, a, b) 142 #define _PLL(pll, a, b) _PICK_EVEN(pll, a, b) 143 #define _PHY(phy, a, b) _PICK_EVEN(phy, a, b) 144 145 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b)) 146 #define _MMIO_PLANE(plane, a, b) _MMIO(_PLANE(plane, a, b)) 147 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b)) 148 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b)) 149 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b)) 150 #define _MMIO_PHY(phy, a, b) _MMIO(_PHY(phy, a, b)) 151 152 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__) 153 154 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c)) 155 #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c)) 156 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c)) 157 #define _MMIO_PLL3(pll, ...) _MMIO(_PICK(pll, __VA_ARGS__)) 158 159 160 /* 161 * Device info offset array based helpers for groups of registers with unevenly 162 * spaced base offsets. 163 */ 164 #define _MMIO_PIPE2(pipe, reg) _MMIO(INTEL_INFO(dev_priv)->display.pipe_offsets[(pipe)] - \ 165 INTEL_INFO(dev_priv)->display.pipe_offsets[PIPE_A] + \ 166 DISPLAY_MMIO_BASE(dev_priv) + (reg)) 167 #define _MMIO_TRANS2(tran, reg) _MMIO(INTEL_INFO(dev_priv)->display.trans_offsets[(tran)] - \ 168 INTEL_INFO(dev_priv)->display.trans_offsets[TRANSCODER_A] + \ 169 DISPLAY_MMIO_BASE(dev_priv) + (reg)) 170 #define _MMIO_CURSOR2(pipe, reg) _MMIO(INTEL_INFO(dev_priv)->display.cursor_offsets[(pipe)] - \ 171 INTEL_INFO(dev_priv)->display.cursor_offsets[PIPE_A] + \ 172 DISPLAY_MMIO_BASE(dev_priv) + (reg)) 173 174 #define __MASKED_FIELD(mask, value) ((mask) << 16 | (value)) 175 #define _MASKED_FIELD(mask, value) ({ \ 176 if (__builtin_constant_p(mask)) \ 177 BUILD_BUG_ON_MSG(((mask) & 0xffff0000), "Incorrect mask"); \ 178 if (__builtin_constant_p(value)) \ 179 BUILD_BUG_ON_MSG((value) & 0xffff0000, "Incorrect value"); \ 180 if (__builtin_constant_p(mask) && __builtin_constant_p(value)) \ 181 BUILD_BUG_ON_MSG((value) & ~(mask), \ 182 "Incorrect value for mask"); \ 183 __MASKED_FIELD(mask, value); }) 184 #define _MASKED_BIT_ENABLE(a) ({ typeof(a) _a = (a); _MASKED_FIELD(_a, _a); }) 185 #define _MASKED_BIT_DISABLE(a) (_MASKED_FIELD((a), 0)) 186 187 #define GU_CNTL _MMIO(0x101010) 188 #define LMEM_INIT REG_BIT(7) 189 190 #define GEN6_STOLEN_RESERVED _MMIO(0x1082C0) 191 #define GEN6_STOLEN_RESERVED_ADDR_MASK (0xFFF << 20) 192 #define GEN7_STOLEN_RESERVED_ADDR_MASK (0x3FFF << 18) 193 #define GEN6_STOLEN_RESERVED_SIZE_MASK (3 << 4) 194 #define GEN6_STOLEN_RESERVED_1M (0 << 4) 195 #define GEN6_STOLEN_RESERVED_512K (1 << 4) 196 #define GEN6_STOLEN_RESERVED_256K (2 << 4) 197 #define GEN6_STOLEN_RESERVED_128K (3 << 4) 198 #define GEN7_STOLEN_RESERVED_SIZE_MASK (1 << 5) 199 #define GEN7_STOLEN_RESERVED_1M (0 << 5) 200 #define GEN7_STOLEN_RESERVED_256K (1 << 5) 201 #define GEN8_STOLEN_RESERVED_SIZE_MASK (3 << 7) 202 #define GEN8_STOLEN_RESERVED_1M (0 << 7) 203 #define GEN8_STOLEN_RESERVED_2M (1 << 7) 204 #define GEN8_STOLEN_RESERVED_4M (2 << 7) 205 #define GEN8_STOLEN_RESERVED_8M (3 << 7) 206 #define GEN6_STOLEN_RESERVED_ENABLE (1 << 0) 207 #define GEN11_STOLEN_RESERVED_ADDR_MASK (0xFFFFFFFFFFFULL << 20) 208 209 #define _VGA_MSR_WRITE _MMIO(0x3c2) 210 211 #define _GEN7_PIPEA_DE_LOAD_SL 0x70068 212 #define _GEN7_PIPEB_DE_LOAD_SL 0x71068 213 #define GEN7_PIPE_DE_LOAD_SL(pipe) _MMIO_PIPE(pipe, _GEN7_PIPEA_DE_LOAD_SL, _GEN7_PIPEB_DE_LOAD_SL) 214 215 /* 216 * Reset registers 217 */ 218 #define DEBUG_RESET_I830 _MMIO(0x6070) 219 #define DEBUG_RESET_FULL (1 << 7) 220 #define DEBUG_RESET_RENDER (1 << 8) 221 #define DEBUG_RESET_DISPLAY (1 << 9) 222 223 /* 224 * IOSF sideband 225 */ 226 #define VLV_IOSF_DOORBELL_REQ _MMIO(VLV_DISPLAY_BASE + 0x2100) 227 #define IOSF_DEVFN_SHIFT 24 228 #define IOSF_OPCODE_SHIFT 16 229 #define IOSF_PORT_SHIFT 8 230 #define IOSF_BYTE_ENABLES_SHIFT 4 231 #define IOSF_BAR_SHIFT 1 232 #define IOSF_SB_BUSY (1 << 0) 233 #define IOSF_PORT_BUNIT 0x03 234 #define IOSF_PORT_PUNIT 0x04 235 #define IOSF_PORT_NC 0x11 236 #define IOSF_PORT_DPIO 0x12 237 #define IOSF_PORT_GPIO_NC 0x13 238 #define IOSF_PORT_CCK 0x14 239 #define IOSF_PORT_DPIO_2 0x1a 240 #define IOSF_PORT_FLISDSI 0x1b 241 #define IOSF_PORT_GPIO_SC 0x48 242 #define IOSF_PORT_GPIO_SUS 0xa8 243 #define IOSF_PORT_CCU 0xa9 244 #define CHV_IOSF_PORT_GPIO_N 0x13 245 #define CHV_IOSF_PORT_GPIO_SE 0x48 246 #define CHV_IOSF_PORT_GPIO_E 0xa8 247 #define CHV_IOSF_PORT_GPIO_SW 0xb2 248 #define VLV_IOSF_DATA _MMIO(VLV_DISPLAY_BASE + 0x2104) 249 #define VLV_IOSF_ADDR _MMIO(VLV_DISPLAY_BASE + 0x2108) 250 251 /* DPIO registers */ 252 #define DPIO_DEVFN 0 253 254 #define DPIO_CTL _MMIO(VLV_DISPLAY_BASE + 0x2110) 255 #define DPIO_MODSEL1 (1 << 3) /* if ref clk b == 27 */ 256 #define DPIO_MODSEL0 (1 << 2) /* if ref clk a == 27 */ 257 #define DPIO_SFR_BYPASS (1 << 1) 258 #define DPIO_CMNRST (1 << 0) 259 260 #define DPIO_PHY(pipe) ((pipe) >> 1) 261 262 /* 263 * Per pipe/PLL DPIO regs 264 */ 265 #define _VLV_PLL_DW3_CH0 0x800c 266 #define DPIO_POST_DIV_SHIFT (28) /* 3 bits */ 267 #define DPIO_POST_DIV_DAC 0 268 #define DPIO_POST_DIV_HDMIDP 1 /* DAC 225-400M rate */ 269 #define DPIO_POST_DIV_LVDS1 2 270 #define DPIO_POST_DIV_LVDS2 3 271 #define DPIO_K_SHIFT (24) /* 4 bits */ 272 #define DPIO_P1_SHIFT (21) /* 3 bits */ 273 #define DPIO_P2_SHIFT (16) /* 5 bits */ 274 #define DPIO_N_SHIFT (12) /* 4 bits */ 275 #define DPIO_ENABLE_CALIBRATION (1 << 11) 276 #define DPIO_M1DIV_SHIFT (8) /* 3 bits */ 277 #define DPIO_M2DIV_MASK 0xff 278 #define _VLV_PLL_DW3_CH1 0x802c 279 #define VLV_PLL_DW3(ch) _PIPE(ch, _VLV_PLL_DW3_CH0, _VLV_PLL_DW3_CH1) 280 281 #define _VLV_PLL_DW5_CH0 0x8014 282 #define DPIO_REFSEL_OVERRIDE 27 283 #define DPIO_PLL_MODESEL_SHIFT 24 /* 3 bits */ 284 #define DPIO_BIAS_CURRENT_CTL_SHIFT 21 /* 3 bits, always 0x7 */ 285 #define DPIO_PLL_REFCLK_SEL_SHIFT 16 /* 2 bits */ 286 #define DPIO_PLL_REFCLK_SEL_MASK 3 287 #define DPIO_DRIVER_CTL_SHIFT 12 /* always set to 0x8 */ 288 #define DPIO_CLK_BIAS_CTL_SHIFT 8 /* always set to 0x5 */ 289 #define _VLV_PLL_DW5_CH1 0x8034 290 #define VLV_PLL_DW5(ch) _PIPE(ch, _VLV_PLL_DW5_CH0, _VLV_PLL_DW5_CH1) 291 292 #define _VLV_PLL_DW7_CH0 0x801c 293 #define _VLV_PLL_DW7_CH1 0x803c 294 #define VLV_PLL_DW7(ch) _PIPE(ch, _VLV_PLL_DW7_CH0, _VLV_PLL_DW7_CH1) 295 296 #define _VLV_PLL_DW8_CH0 0x8040 297 #define _VLV_PLL_DW8_CH1 0x8060 298 #define VLV_PLL_DW8(ch) _PIPE(ch, _VLV_PLL_DW8_CH0, _VLV_PLL_DW8_CH1) 299 300 #define VLV_PLL_DW9_BCAST 0xc044 301 #define _VLV_PLL_DW9_CH0 0x8044 302 #define _VLV_PLL_DW9_CH1 0x8064 303 #define VLV_PLL_DW9(ch) _PIPE(ch, _VLV_PLL_DW9_CH0, _VLV_PLL_DW9_CH1) 304 305 #define _VLV_PLL_DW10_CH0 0x8048 306 #define _VLV_PLL_DW10_CH1 0x8068 307 #define VLV_PLL_DW10(ch) _PIPE(ch, _VLV_PLL_DW10_CH0, _VLV_PLL_DW10_CH1) 308 309 #define _VLV_PLL_DW11_CH0 0x804c 310 #define _VLV_PLL_DW11_CH1 0x806c 311 #define VLV_PLL_DW11(ch) _PIPE(ch, _VLV_PLL_DW11_CH0, _VLV_PLL_DW11_CH1) 312 313 /* Spec for ref block start counts at DW10 */ 314 #define VLV_REF_DW13 0x80ac 315 316 #define VLV_CMN_DW0 0x8100 317 318 /* 319 * Per DDI channel DPIO regs 320 */ 321 322 #define _VLV_PCS_DW0_CH0 0x8200 323 #define _VLV_PCS_DW0_CH1 0x8400 324 #define DPIO_PCS_TX_LANE2_RESET (1 << 16) 325 #define DPIO_PCS_TX_LANE1_RESET (1 << 7) 326 #define DPIO_LEFT_TXFIFO_RST_MASTER2 (1 << 4) 327 #define DPIO_RIGHT_TXFIFO_RST_MASTER2 (1 << 3) 328 #define VLV_PCS_DW0(ch) _PORT(ch, _VLV_PCS_DW0_CH0, _VLV_PCS_DW0_CH1) 329 330 #define _VLV_PCS01_DW0_CH0 0x200 331 #define _VLV_PCS23_DW0_CH0 0x400 332 #define _VLV_PCS01_DW0_CH1 0x2600 333 #define _VLV_PCS23_DW0_CH1 0x2800 334 #define VLV_PCS01_DW0(ch) _PORT(ch, _VLV_PCS01_DW0_CH0, _VLV_PCS01_DW0_CH1) 335 #define VLV_PCS23_DW0(ch) _PORT(ch, _VLV_PCS23_DW0_CH0, _VLV_PCS23_DW0_CH1) 336 337 #define _VLV_PCS_DW1_CH0 0x8204 338 #define _VLV_PCS_DW1_CH1 0x8404 339 #define CHV_PCS_REQ_SOFTRESET_EN (1 << 23) 340 #define DPIO_PCS_CLK_CRI_RXEB_EIOS_EN (1 << 22) 341 #define DPIO_PCS_CLK_CRI_RXDIGFILTSG_EN (1 << 21) 342 #define DPIO_PCS_CLK_DATAWIDTH_SHIFT (6) 343 #define DPIO_PCS_CLK_SOFT_RESET (1 << 5) 344 #define VLV_PCS_DW1(ch) _PORT(ch, _VLV_PCS_DW1_CH0, _VLV_PCS_DW1_CH1) 345 346 #define _VLV_PCS01_DW1_CH0 0x204 347 #define _VLV_PCS23_DW1_CH0 0x404 348 #define _VLV_PCS01_DW1_CH1 0x2604 349 #define _VLV_PCS23_DW1_CH1 0x2804 350 #define VLV_PCS01_DW1(ch) _PORT(ch, _VLV_PCS01_DW1_CH0, _VLV_PCS01_DW1_CH1) 351 #define VLV_PCS23_DW1(ch) _PORT(ch, _VLV_PCS23_DW1_CH0, _VLV_PCS23_DW1_CH1) 352 353 #define _VLV_PCS_DW8_CH0 0x8220 354 #define _VLV_PCS_DW8_CH1 0x8420 355 #define CHV_PCS_USEDCLKCHANNEL_OVRRIDE (1 << 20) 356 #define CHV_PCS_USEDCLKCHANNEL (1 << 21) 357 #define VLV_PCS_DW8(ch) _PORT(ch, _VLV_PCS_DW8_CH0, _VLV_PCS_DW8_CH1) 358 359 #define _VLV_PCS01_DW8_CH0 0x0220 360 #define _VLV_PCS23_DW8_CH0 0x0420 361 #define _VLV_PCS01_DW8_CH1 0x2620 362 #define _VLV_PCS23_DW8_CH1 0x2820 363 #define VLV_PCS01_DW8(port) _PORT(port, _VLV_PCS01_DW8_CH0, _VLV_PCS01_DW8_CH1) 364 #define VLV_PCS23_DW8(port) _PORT(port, _VLV_PCS23_DW8_CH0, _VLV_PCS23_DW8_CH1) 365 366 #define _VLV_PCS_DW9_CH0 0x8224 367 #define _VLV_PCS_DW9_CH1 0x8424 368 #define DPIO_PCS_TX2MARGIN_MASK (0x7 << 13) 369 #define DPIO_PCS_TX2MARGIN_000 (0 << 13) 370 #define DPIO_PCS_TX2MARGIN_101 (1 << 13) 371 #define DPIO_PCS_TX1MARGIN_MASK (0x7 << 10) 372 #define DPIO_PCS_TX1MARGIN_000 (0 << 10) 373 #define DPIO_PCS_TX1MARGIN_101 (1 << 10) 374 #define VLV_PCS_DW9(ch) _PORT(ch, _VLV_PCS_DW9_CH0, _VLV_PCS_DW9_CH1) 375 376 #define _VLV_PCS01_DW9_CH0 0x224 377 #define _VLV_PCS23_DW9_CH0 0x424 378 #define _VLV_PCS01_DW9_CH1 0x2624 379 #define _VLV_PCS23_DW9_CH1 0x2824 380 #define VLV_PCS01_DW9(ch) _PORT(ch, _VLV_PCS01_DW9_CH0, _VLV_PCS01_DW9_CH1) 381 #define VLV_PCS23_DW9(ch) _PORT(ch, _VLV_PCS23_DW9_CH0, _VLV_PCS23_DW9_CH1) 382 383 #define _CHV_PCS_DW10_CH0 0x8228 384 #define _CHV_PCS_DW10_CH1 0x8428 385 #define DPIO_PCS_SWING_CALC_TX0_TX2 (1 << 30) 386 #define DPIO_PCS_SWING_CALC_TX1_TX3 (1 << 31) 387 #define DPIO_PCS_TX2DEEMP_MASK (0xf << 24) 388 #define DPIO_PCS_TX2DEEMP_9P5 (0 << 24) 389 #define DPIO_PCS_TX2DEEMP_6P0 (2 << 24) 390 #define DPIO_PCS_TX1DEEMP_MASK (0xf << 16) 391 #define DPIO_PCS_TX1DEEMP_9P5 (0 << 16) 392 #define DPIO_PCS_TX1DEEMP_6P0 (2 << 16) 393 #define CHV_PCS_DW10(ch) _PORT(ch, _CHV_PCS_DW10_CH0, _CHV_PCS_DW10_CH1) 394 395 #define _VLV_PCS01_DW10_CH0 0x0228 396 #define _VLV_PCS23_DW10_CH0 0x0428 397 #define _VLV_PCS01_DW10_CH1 0x2628 398 #define _VLV_PCS23_DW10_CH1 0x2828 399 #define VLV_PCS01_DW10(port) _PORT(port, _VLV_PCS01_DW10_CH0, _VLV_PCS01_DW10_CH1) 400 #define VLV_PCS23_DW10(port) _PORT(port, _VLV_PCS23_DW10_CH0, _VLV_PCS23_DW10_CH1) 401 402 #define _VLV_PCS_DW11_CH0 0x822c 403 #define _VLV_PCS_DW11_CH1 0x842c 404 #define DPIO_TX2_STAGGER_MASK(x) ((x) << 24) 405 #define DPIO_LANEDESKEW_STRAP_OVRD (1 << 3) 406 #define DPIO_LEFT_TXFIFO_RST_MASTER (1 << 1) 407 #define DPIO_RIGHT_TXFIFO_RST_MASTER (1 << 0) 408 #define VLV_PCS_DW11(ch) _PORT(ch, _VLV_PCS_DW11_CH0, _VLV_PCS_DW11_CH1) 409 410 #define _VLV_PCS01_DW11_CH0 0x022c 411 #define _VLV_PCS23_DW11_CH0 0x042c 412 #define _VLV_PCS01_DW11_CH1 0x262c 413 #define _VLV_PCS23_DW11_CH1 0x282c 414 #define VLV_PCS01_DW11(ch) _PORT(ch, _VLV_PCS01_DW11_CH0, _VLV_PCS01_DW11_CH1) 415 #define VLV_PCS23_DW11(ch) _PORT(ch, _VLV_PCS23_DW11_CH0, _VLV_PCS23_DW11_CH1) 416 417 #define _VLV_PCS01_DW12_CH0 0x0230 418 #define _VLV_PCS23_DW12_CH0 0x0430 419 #define _VLV_PCS01_DW12_CH1 0x2630 420 #define _VLV_PCS23_DW12_CH1 0x2830 421 #define VLV_PCS01_DW12(ch) _PORT(ch, _VLV_PCS01_DW12_CH0, _VLV_PCS01_DW12_CH1) 422 #define VLV_PCS23_DW12(ch) _PORT(ch, _VLV_PCS23_DW12_CH0, _VLV_PCS23_DW12_CH1) 423 424 #define _VLV_PCS_DW12_CH0 0x8230 425 #define _VLV_PCS_DW12_CH1 0x8430 426 #define DPIO_TX2_STAGGER_MULT(x) ((x) << 20) 427 #define DPIO_TX1_STAGGER_MULT(x) ((x) << 16) 428 #define DPIO_TX1_STAGGER_MASK(x) ((x) << 8) 429 #define DPIO_LANESTAGGER_STRAP_OVRD (1 << 6) 430 #define DPIO_LANESTAGGER_STRAP(x) ((x) << 0) 431 #define VLV_PCS_DW12(ch) _PORT(ch, _VLV_PCS_DW12_CH0, _VLV_PCS_DW12_CH1) 432 433 #define _VLV_PCS_DW14_CH0 0x8238 434 #define _VLV_PCS_DW14_CH1 0x8438 435 #define VLV_PCS_DW14(ch) _PORT(ch, _VLV_PCS_DW14_CH0, _VLV_PCS_DW14_CH1) 436 437 #define _VLV_PCS_DW23_CH0 0x825c 438 #define _VLV_PCS_DW23_CH1 0x845c 439 #define VLV_PCS_DW23(ch) _PORT(ch, _VLV_PCS_DW23_CH0, _VLV_PCS_DW23_CH1) 440 441 #define _VLV_TX_DW2_CH0 0x8288 442 #define _VLV_TX_DW2_CH1 0x8488 443 #define DPIO_SWING_MARGIN000_SHIFT 16 444 #define DPIO_SWING_MARGIN000_MASK (0xff << DPIO_SWING_MARGIN000_SHIFT) 445 #define DPIO_UNIQ_TRANS_SCALE_SHIFT 8 446 #define VLV_TX_DW2(ch) _PORT(ch, _VLV_TX_DW2_CH0, _VLV_TX_DW2_CH1) 447 448 #define _VLV_TX_DW3_CH0 0x828c 449 #define _VLV_TX_DW3_CH1 0x848c 450 /* The following bit for CHV phy */ 451 #define DPIO_TX_UNIQ_TRANS_SCALE_EN (1 << 27) 452 #define DPIO_SWING_MARGIN101_SHIFT 16 453 #define DPIO_SWING_MARGIN101_MASK (0xff << DPIO_SWING_MARGIN101_SHIFT) 454 #define VLV_TX_DW3(ch) _PORT(ch, _VLV_TX_DW3_CH0, _VLV_TX_DW3_CH1) 455 456 #define _VLV_TX_DW4_CH0 0x8290 457 #define _VLV_TX_DW4_CH1 0x8490 458 #define DPIO_SWING_DEEMPH9P5_SHIFT 24 459 #define DPIO_SWING_DEEMPH9P5_MASK (0xff << DPIO_SWING_DEEMPH9P5_SHIFT) 460 #define DPIO_SWING_DEEMPH6P0_SHIFT 16 461 #define DPIO_SWING_DEEMPH6P0_MASK (0xff << DPIO_SWING_DEEMPH6P0_SHIFT) 462 #define VLV_TX_DW4(ch) _PORT(ch, _VLV_TX_DW4_CH0, _VLV_TX_DW4_CH1) 463 464 #define _VLV_TX3_DW4_CH0 0x690 465 #define _VLV_TX3_DW4_CH1 0x2a90 466 #define VLV_TX3_DW4(ch) _PORT(ch, _VLV_TX3_DW4_CH0, _VLV_TX3_DW4_CH1) 467 468 #define _VLV_TX_DW5_CH0 0x8294 469 #define _VLV_TX_DW5_CH1 0x8494 470 #define DPIO_TX_OCALINIT_EN (1 << 31) 471 #define VLV_TX_DW5(ch) _PORT(ch, _VLV_TX_DW5_CH0, _VLV_TX_DW5_CH1) 472 473 #define _VLV_TX_DW11_CH0 0x82ac 474 #define _VLV_TX_DW11_CH1 0x84ac 475 #define VLV_TX_DW11(ch) _PORT(ch, _VLV_TX_DW11_CH0, _VLV_TX_DW11_CH1) 476 477 #define _VLV_TX_DW14_CH0 0x82b8 478 #define _VLV_TX_DW14_CH1 0x84b8 479 #define VLV_TX_DW14(ch) _PORT(ch, _VLV_TX_DW14_CH0, _VLV_TX_DW14_CH1) 480 481 /* CHV dpPhy registers */ 482 #define _CHV_PLL_DW0_CH0 0x8000 483 #define _CHV_PLL_DW0_CH1 0x8180 484 #define CHV_PLL_DW0(ch) _PIPE(ch, _CHV_PLL_DW0_CH0, _CHV_PLL_DW0_CH1) 485 486 #define _CHV_PLL_DW1_CH0 0x8004 487 #define _CHV_PLL_DW1_CH1 0x8184 488 #define DPIO_CHV_N_DIV_SHIFT 8 489 #define DPIO_CHV_M1_DIV_BY_2 (0 << 0) 490 #define CHV_PLL_DW1(ch) _PIPE(ch, _CHV_PLL_DW1_CH0, _CHV_PLL_DW1_CH1) 491 492 #define _CHV_PLL_DW2_CH0 0x8008 493 #define _CHV_PLL_DW2_CH1 0x8188 494 #define CHV_PLL_DW2(ch) _PIPE(ch, _CHV_PLL_DW2_CH0, _CHV_PLL_DW2_CH1) 495 496 #define _CHV_PLL_DW3_CH0 0x800c 497 #define _CHV_PLL_DW3_CH1 0x818c 498 #define DPIO_CHV_FRAC_DIV_EN (1 << 16) 499 #define DPIO_CHV_FIRST_MOD (0 << 8) 500 #define DPIO_CHV_SECOND_MOD (1 << 8) 501 #define DPIO_CHV_FEEDFWD_GAIN_SHIFT 0 502 #define DPIO_CHV_FEEDFWD_GAIN_MASK (0xF << 0) 503 #define CHV_PLL_DW3(ch) _PIPE(ch, _CHV_PLL_DW3_CH0, _CHV_PLL_DW3_CH1) 504 505 #define _CHV_PLL_DW6_CH0 0x8018 506 #define _CHV_PLL_DW6_CH1 0x8198 507 #define DPIO_CHV_GAIN_CTRL_SHIFT 16 508 #define DPIO_CHV_INT_COEFF_SHIFT 8 509 #define DPIO_CHV_PROP_COEFF_SHIFT 0 510 #define CHV_PLL_DW6(ch) _PIPE(ch, _CHV_PLL_DW6_CH0, _CHV_PLL_DW6_CH1) 511 512 #define _CHV_PLL_DW8_CH0 0x8020 513 #define _CHV_PLL_DW8_CH1 0x81A0 514 #define DPIO_CHV_TDC_TARGET_CNT_SHIFT 0 515 #define DPIO_CHV_TDC_TARGET_CNT_MASK (0x3FF << 0) 516 #define CHV_PLL_DW8(ch) _PIPE(ch, _CHV_PLL_DW8_CH0, _CHV_PLL_DW8_CH1) 517 518 #define _CHV_PLL_DW9_CH0 0x8024 519 #define _CHV_PLL_DW9_CH1 0x81A4 520 #define DPIO_CHV_INT_LOCK_THRESHOLD_SHIFT 1 /* 3 bits */ 521 #define DPIO_CHV_INT_LOCK_THRESHOLD_MASK (7 << 1) 522 #define DPIO_CHV_INT_LOCK_THRESHOLD_SEL_COARSE 1 /* 1: coarse & 0 : fine */ 523 #define CHV_PLL_DW9(ch) _PIPE(ch, _CHV_PLL_DW9_CH0, _CHV_PLL_DW9_CH1) 524 525 #define _CHV_CMN_DW0_CH0 0x8100 526 #define DPIO_ALLDL_POWERDOWN_SHIFT_CH0 19 527 #define DPIO_ANYDL_POWERDOWN_SHIFT_CH0 18 528 #define DPIO_ALLDL_POWERDOWN (1 << 1) 529 #define DPIO_ANYDL_POWERDOWN (1 << 0) 530 531 #define _CHV_CMN_DW5_CH0 0x8114 532 #define CHV_BUFRIGHTENA1_DISABLE (0 << 20) 533 #define CHV_BUFRIGHTENA1_NORMAL (1 << 20) 534 #define CHV_BUFRIGHTENA1_FORCE (3 << 20) 535 #define CHV_BUFRIGHTENA1_MASK (3 << 20) 536 #define CHV_BUFLEFTENA1_DISABLE (0 << 22) 537 #define CHV_BUFLEFTENA1_NORMAL (1 << 22) 538 #define CHV_BUFLEFTENA1_FORCE (3 << 22) 539 #define CHV_BUFLEFTENA1_MASK (3 << 22) 540 541 #define _CHV_CMN_DW13_CH0 0x8134 542 #define _CHV_CMN_DW0_CH1 0x8080 543 #define DPIO_CHV_S1_DIV_SHIFT 21 544 #define DPIO_CHV_P1_DIV_SHIFT 13 /* 3 bits */ 545 #define DPIO_CHV_P2_DIV_SHIFT 8 /* 5 bits */ 546 #define DPIO_CHV_K_DIV_SHIFT 4 547 #define DPIO_PLL_FREQLOCK (1 << 1) 548 #define DPIO_PLL_LOCK (1 << 0) 549 #define CHV_CMN_DW13(ch) _PIPE(ch, _CHV_CMN_DW13_CH0, _CHV_CMN_DW0_CH1) 550 551 #define _CHV_CMN_DW14_CH0 0x8138 552 #define _CHV_CMN_DW1_CH1 0x8084 553 #define DPIO_AFC_RECAL (1 << 14) 554 #define DPIO_DCLKP_EN (1 << 13) 555 #define CHV_BUFLEFTENA2_DISABLE (0 << 17) /* CL2 DW1 only */ 556 #define CHV_BUFLEFTENA2_NORMAL (1 << 17) /* CL2 DW1 only */ 557 #define CHV_BUFLEFTENA2_FORCE (3 << 17) /* CL2 DW1 only */ 558 #define CHV_BUFLEFTENA2_MASK (3 << 17) /* CL2 DW1 only */ 559 #define CHV_BUFRIGHTENA2_DISABLE (0 << 19) /* CL2 DW1 only */ 560 #define CHV_BUFRIGHTENA2_NORMAL (1 << 19) /* CL2 DW1 only */ 561 #define CHV_BUFRIGHTENA2_FORCE (3 << 19) /* CL2 DW1 only */ 562 #define CHV_BUFRIGHTENA2_MASK (3 << 19) /* CL2 DW1 only */ 563 #define CHV_CMN_DW14(ch) _PIPE(ch, _CHV_CMN_DW14_CH0, _CHV_CMN_DW1_CH1) 564 565 #define _CHV_CMN_DW19_CH0 0x814c 566 #define _CHV_CMN_DW6_CH1 0x8098 567 #define DPIO_ALLDL_POWERDOWN_SHIFT_CH1 30 /* CL2 DW6 only */ 568 #define DPIO_ANYDL_POWERDOWN_SHIFT_CH1 29 /* CL2 DW6 only */ 569 #define DPIO_DYNPWRDOWNEN_CH1 (1 << 28) /* CL2 DW6 only */ 570 #define CHV_CMN_USEDCLKCHANNEL (1 << 13) 571 572 #define CHV_CMN_DW19(ch) _PIPE(ch, _CHV_CMN_DW19_CH0, _CHV_CMN_DW6_CH1) 573 574 #define CHV_CMN_DW28 0x8170 575 #define DPIO_CL1POWERDOWNEN (1 << 23) 576 #define DPIO_DYNPWRDOWNEN_CH0 (1 << 22) 577 #define DPIO_SUS_CLK_CONFIG_ON (0 << 0) 578 #define DPIO_SUS_CLK_CONFIG_CLKREQ (1 << 0) 579 #define DPIO_SUS_CLK_CONFIG_GATE (2 << 0) 580 #define DPIO_SUS_CLK_CONFIG_GATE_CLKREQ (3 << 0) 581 582 #define CHV_CMN_DW30 0x8178 583 #define DPIO_CL2_LDOFUSE_PWRENB (1 << 6) 584 #define DPIO_LRC_BYPASS (1 << 3) 585 586 #define _TXLANE(ch, lane, offset) ((ch ? 0x2400 : 0) + \ 587 (lane) * 0x200 + (offset)) 588 589 #define CHV_TX_DW0(ch, lane) _TXLANE(ch, lane, 0x80) 590 #define CHV_TX_DW1(ch, lane) _TXLANE(ch, lane, 0x84) 591 #define CHV_TX_DW2(ch, lane) _TXLANE(ch, lane, 0x88) 592 #define CHV_TX_DW3(ch, lane) _TXLANE(ch, lane, 0x8c) 593 #define CHV_TX_DW4(ch, lane) _TXLANE(ch, lane, 0x90) 594 #define CHV_TX_DW5(ch, lane) _TXLANE(ch, lane, 0x94) 595 #define CHV_TX_DW6(ch, lane) _TXLANE(ch, lane, 0x98) 596 #define CHV_TX_DW7(ch, lane) _TXLANE(ch, lane, 0x9c) 597 #define CHV_TX_DW8(ch, lane) _TXLANE(ch, lane, 0xa0) 598 #define CHV_TX_DW9(ch, lane) _TXLANE(ch, lane, 0xa4) 599 #define CHV_TX_DW10(ch, lane) _TXLANE(ch, lane, 0xa8) 600 #define CHV_TX_DW11(ch, lane) _TXLANE(ch, lane, 0xac) 601 #define DPIO_FRC_LATENCY_SHFIT 8 602 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8) 603 #define DPIO_UPAR_SHIFT 30 604 605 /* BXT PHY registers */ 606 #define _BXT_PHY0_BASE 0x6C000 607 #define _BXT_PHY1_BASE 0x162000 608 #define _BXT_PHY2_BASE 0x163000 609 #define BXT_PHY_BASE(phy) _PHY3((phy), _BXT_PHY0_BASE, \ 610 _BXT_PHY1_BASE, \ 611 _BXT_PHY2_BASE) 612 613 #define _BXT_PHY(phy, reg) \ 614 _MMIO(BXT_PHY_BASE(phy) - _BXT_PHY0_BASE + (reg)) 615 616 #define _BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \ 617 (BXT_PHY_BASE(phy) + _PIPE((ch), (reg_ch0) - _BXT_PHY0_BASE, \ 618 (reg_ch1) - _BXT_PHY0_BASE)) 619 #define _MMIO_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \ 620 _MMIO(_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1)) 621 622 #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090) 623 #define MIPIO_RST_CTRL (1 << 2) 624 625 #define _BXT_PHY_CTL_DDI_A 0x64C00 626 #define _BXT_PHY_CTL_DDI_B 0x64C10 627 #define _BXT_PHY_CTL_DDI_C 0x64C20 628 #define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) 629 #define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) 630 #define BXT_PHY_LANE_ENABLED (1 << 8) 631 #define BXT_PHY_CTL(port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ 632 _BXT_PHY_CTL_DDI_B) 633 634 #define _PHY_CTL_FAMILY_EDP 0x64C80 635 #define _PHY_CTL_FAMILY_DDI 0x64C90 636 #define _PHY_CTL_FAMILY_DDI_C 0x64CA0 637 #define COMMON_RESET_DIS (1 << 31) 638 #define BXT_PHY_CTL_FAMILY(phy) _MMIO_PHY3((phy), _PHY_CTL_FAMILY_DDI, \ 639 _PHY_CTL_FAMILY_EDP, \ 640 _PHY_CTL_FAMILY_DDI_C) 641 642 /* BXT PHY PLL registers */ 643 #define _PORT_PLL_A 0x46074 644 #define _PORT_PLL_B 0x46078 645 #define _PORT_PLL_C 0x4607c 646 #define PORT_PLL_ENABLE REG_BIT(31) 647 #define PORT_PLL_LOCK REG_BIT(30) 648 #define PORT_PLL_REF_SEL REG_BIT(27) 649 #define PORT_PLL_POWER_ENABLE REG_BIT(26) 650 #define PORT_PLL_POWER_STATE REG_BIT(25) 651 #define BXT_PORT_PLL_ENABLE(port) _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B) 652 653 #define _PORT_PLL_EBB_0_A 0x162034 654 #define _PORT_PLL_EBB_0_B 0x6C034 655 #define _PORT_PLL_EBB_0_C 0x6C340 656 #define PORT_PLL_P1_MASK REG_GENMASK(15, 13) 657 #define PORT_PLL_P1(p1) REG_FIELD_PREP(PORT_PLL_P1_MASK, (p1)) 658 #define PORT_PLL_P2_MASK REG_GENMASK(12, 8) 659 #define PORT_PLL_P2(p2) REG_FIELD_PREP(PORT_PLL_P2_MASK, (p2)) 660 #define BXT_PORT_PLL_EBB_0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 661 _PORT_PLL_EBB_0_B, \ 662 _PORT_PLL_EBB_0_C) 663 664 #define _PORT_PLL_EBB_4_A 0x162038 665 #define _PORT_PLL_EBB_4_B 0x6C038 666 #define _PORT_PLL_EBB_4_C 0x6C344 667 #define PORT_PLL_RECALIBRATE REG_BIT(14) 668 #define PORT_PLL_10BIT_CLK_ENABLE REG_BIT(13) 669 #define BXT_PORT_PLL_EBB_4(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 670 _PORT_PLL_EBB_4_B, \ 671 _PORT_PLL_EBB_4_C) 672 673 #define _PORT_PLL_0_A 0x162100 674 #define _PORT_PLL_0_B 0x6C100 675 #define _PORT_PLL_0_C 0x6C380 676 /* PORT_PLL_0_A */ 677 #define PORT_PLL_M2_INT_MASK REG_GENMASK(7, 0) 678 #define PORT_PLL_M2_INT(m2_int) REG_FIELD_PREP(PORT_PLL_M2_INT_MASK, (m2_int)) 679 /* PORT_PLL_1_A */ 680 #define PORT_PLL_N_MASK REG_GENMASK(11, 8) 681 #define PORT_PLL_N(n) REG_FIELD_PREP(PORT_PLL_N_MASK, (n)) 682 /* PORT_PLL_2_A */ 683 #define PORT_PLL_M2_FRAC_MASK REG_GENMASK(21, 0) 684 #define PORT_PLL_M2_FRAC(m2_frac) REG_FIELD_PREP(PORT_PLL_M2_FRAC_MASK, (m2_frac)) 685 /* PORT_PLL_3_A */ 686 #define PORT_PLL_M2_FRAC_ENABLE REG_BIT(16) 687 /* PORT_PLL_6_A */ 688 #define PORT_PLL_GAIN_CTL_MASK REG_GENMASK(18, 16) 689 #define PORT_PLL_GAIN_CTL(x) REG_FIELD_PREP(PORT_PLL_GAIN_CTL_MASK, (x)) 690 #define PORT_PLL_INT_COEFF_MASK REG_GENMASK(12, 8) 691 #define PORT_PLL_INT_COEFF(x) REG_FIELD_PREP(PORT_PLL_INT_COEFF_MASK, (x)) 692 #define PORT_PLL_PROP_COEFF_MASK REG_GENMASK(3, 0) 693 #define PORT_PLL_PROP_COEFF(x) REG_FIELD_PREP(PORT_PLL_PROP_COEFF_MASK, (x)) 694 /* PORT_PLL_8_A */ 695 #define PORT_PLL_TARGET_CNT_MASK REG_GENMASK(9, 0) 696 #define PORT_PLL_TARGET_CNT(x) REG_FIELD_PREP(PORT_PLL_TARGET_CNT_MASK, (x)) 697 /* PORT_PLL_9_A */ 698 #define PORT_PLL_LOCK_THRESHOLD_MASK REG_GENMASK(3, 1) 699 #define PORT_PLL_LOCK_THRESHOLD(x) REG_FIELD_PREP(PORT_PLL_LOCK_THRESHOLD_MASK, (x)) 700 /* PORT_PLL_10_A */ 701 #define PORT_PLL_DCO_AMP_OVR_EN_H REG_BIT(27) 702 #define PORT_PLL_DCO_AMP_MASK REG_GENMASK(13, 10) 703 #define PORT_PLL_DCO_AMP(x) REG_FIELD_PREP(PORT_PLL_DCO_AMP_MASK, (x)) 704 #define _PORT_PLL_BASE(phy, ch) _BXT_PHY_CH(phy, ch, \ 705 _PORT_PLL_0_B, \ 706 _PORT_PLL_0_C) 707 #define BXT_PORT_PLL(phy, ch, idx) _MMIO(_PORT_PLL_BASE(phy, ch) + \ 708 (idx) * 4) 709 710 /* BXT PHY common lane registers */ 711 #define _PORT_CL1CM_DW0_A 0x162000 712 #define _PORT_CL1CM_DW0_BC 0x6C000 713 #define PHY_POWER_GOOD (1 << 16) 714 #define PHY_RESERVED (1 << 7) 715 #define BXT_PORT_CL1CM_DW0(phy) _BXT_PHY((phy), _PORT_CL1CM_DW0_BC) 716 717 #define _PORT_CL1CM_DW9_A 0x162024 718 #define _PORT_CL1CM_DW9_BC 0x6C024 719 #define IREF0RC_OFFSET_SHIFT 8 720 #define IREF0RC_OFFSET_MASK (0xFF << IREF0RC_OFFSET_SHIFT) 721 #define BXT_PORT_CL1CM_DW9(phy) _BXT_PHY((phy), _PORT_CL1CM_DW9_BC) 722 723 #define _PORT_CL1CM_DW10_A 0x162028 724 #define _PORT_CL1CM_DW10_BC 0x6C028 725 #define IREF1RC_OFFSET_SHIFT 8 726 #define IREF1RC_OFFSET_MASK (0xFF << IREF1RC_OFFSET_SHIFT) 727 #define BXT_PORT_CL1CM_DW10(phy) _BXT_PHY((phy), _PORT_CL1CM_DW10_BC) 728 729 #define _PORT_CL1CM_DW28_A 0x162070 730 #define _PORT_CL1CM_DW28_BC 0x6C070 731 #define OCL1_POWER_DOWN_EN (1 << 23) 732 #define DW28_OLDO_DYN_PWR_DOWN_EN (1 << 22) 733 #define SUS_CLK_CONFIG 0x3 734 #define BXT_PORT_CL1CM_DW28(phy) _BXT_PHY((phy), _PORT_CL1CM_DW28_BC) 735 736 #define _PORT_CL1CM_DW30_A 0x162078 737 #define _PORT_CL1CM_DW30_BC 0x6C078 738 #define OCL2_LDOFUSE_PWR_DIS (1 << 6) 739 #define BXT_PORT_CL1CM_DW30(phy) _BXT_PHY((phy), _PORT_CL1CM_DW30_BC) 740 741 /* The spec defines this only for BXT PHY0, but lets assume that this 742 * would exist for PHY1 too if it had a second channel. 743 */ 744 #define _PORT_CL2CM_DW6_A 0x162358 745 #define _PORT_CL2CM_DW6_BC 0x6C358 746 #define BXT_PORT_CL2CM_DW6(phy) _BXT_PHY((phy), _PORT_CL2CM_DW6_BC) 747 #define DW6_OLDO_DYN_PWR_DOWN_EN (1 << 28) 748 749 /* BXT PHY Ref registers */ 750 #define _PORT_REF_DW3_A 0x16218C 751 #define _PORT_REF_DW3_BC 0x6C18C 752 #define GRC_DONE (1 << 22) 753 #define BXT_PORT_REF_DW3(phy) _BXT_PHY((phy), _PORT_REF_DW3_BC) 754 755 #define _PORT_REF_DW6_A 0x162198 756 #define _PORT_REF_DW6_BC 0x6C198 757 #define GRC_CODE_SHIFT 24 758 #define GRC_CODE_MASK (0xFF << GRC_CODE_SHIFT) 759 #define GRC_CODE_FAST_SHIFT 16 760 #define GRC_CODE_FAST_MASK (0xFF << GRC_CODE_FAST_SHIFT) 761 #define GRC_CODE_SLOW_SHIFT 8 762 #define GRC_CODE_SLOW_MASK (0xFF << GRC_CODE_SLOW_SHIFT) 763 #define GRC_CODE_NOM_MASK 0xFF 764 #define BXT_PORT_REF_DW6(phy) _BXT_PHY((phy), _PORT_REF_DW6_BC) 765 766 #define _PORT_REF_DW8_A 0x1621A0 767 #define _PORT_REF_DW8_BC 0x6C1A0 768 #define GRC_DIS (1 << 15) 769 #define GRC_RDY_OVRD (1 << 1) 770 #define BXT_PORT_REF_DW8(phy) _BXT_PHY((phy), _PORT_REF_DW8_BC) 771 772 /* BXT PHY PCS registers */ 773 #define _PORT_PCS_DW10_LN01_A 0x162428 774 #define _PORT_PCS_DW10_LN01_B 0x6C428 775 #define _PORT_PCS_DW10_LN01_C 0x6C828 776 #define _PORT_PCS_DW10_GRP_A 0x162C28 777 #define _PORT_PCS_DW10_GRP_B 0x6CC28 778 #define _PORT_PCS_DW10_GRP_C 0x6CE28 779 #define BXT_PORT_PCS_DW10_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 780 _PORT_PCS_DW10_LN01_B, \ 781 _PORT_PCS_DW10_LN01_C) 782 #define BXT_PORT_PCS_DW10_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 783 _PORT_PCS_DW10_GRP_B, \ 784 _PORT_PCS_DW10_GRP_C) 785 786 #define TX2_SWING_CALC_INIT (1 << 31) 787 #define TX1_SWING_CALC_INIT (1 << 30) 788 789 #define _PORT_PCS_DW12_LN01_A 0x162430 790 #define _PORT_PCS_DW12_LN01_B 0x6C430 791 #define _PORT_PCS_DW12_LN01_C 0x6C830 792 #define _PORT_PCS_DW12_LN23_A 0x162630 793 #define _PORT_PCS_DW12_LN23_B 0x6C630 794 #define _PORT_PCS_DW12_LN23_C 0x6CA30 795 #define _PORT_PCS_DW12_GRP_A 0x162c30 796 #define _PORT_PCS_DW12_GRP_B 0x6CC30 797 #define _PORT_PCS_DW12_GRP_C 0x6CE30 798 #define LANESTAGGER_STRAP_OVRD (1 << 6) 799 #define LANE_STAGGER_MASK 0x1F 800 #define BXT_PORT_PCS_DW12_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 801 _PORT_PCS_DW12_LN01_B, \ 802 _PORT_PCS_DW12_LN01_C) 803 #define BXT_PORT_PCS_DW12_LN23(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 804 _PORT_PCS_DW12_LN23_B, \ 805 _PORT_PCS_DW12_LN23_C) 806 #define BXT_PORT_PCS_DW12_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 807 _PORT_PCS_DW12_GRP_B, \ 808 _PORT_PCS_DW12_GRP_C) 809 810 /* BXT PHY TX registers */ 811 #define _BXT_LANE_OFFSET(lane) (((lane) >> 1) * 0x200 + \ 812 ((lane) & 1) * 0x80) 813 814 #define _PORT_TX_DW2_LN0_A 0x162508 815 #define _PORT_TX_DW2_LN0_B 0x6C508 816 #define _PORT_TX_DW2_LN0_C 0x6C908 817 #define _PORT_TX_DW2_GRP_A 0x162D08 818 #define _PORT_TX_DW2_GRP_B 0x6CD08 819 #define _PORT_TX_DW2_GRP_C 0x6CF08 820 #define BXT_PORT_TX_DW2_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 821 _PORT_TX_DW2_LN0_B, \ 822 _PORT_TX_DW2_LN0_C) 823 #define BXT_PORT_TX_DW2_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 824 _PORT_TX_DW2_GRP_B, \ 825 _PORT_TX_DW2_GRP_C) 826 #define MARGIN_000_SHIFT 16 827 #define MARGIN_000 (0xFF << MARGIN_000_SHIFT) 828 #define UNIQ_TRANS_SCALE_SHIFT 8 829 #define UNIQ_TRANS_SCALE (0xFF << UNIQ_TRANS_SCALE_SHIFT) 830 831 #define _PORT_TX_DW3_LN0_A 0x16250C 832 #define _PORT_TX_DW3_LN0_B 0x6C50C 833 #define _PORT_TX_DW3_LN0_C 0x6C90C 834 #define _PORT_TX_DW3_GRP_A 0x162D0C 835 #define _PORT_TX_DW3_GRP_B 0x6CD0C 836 #define _PORT_TX_DW3_GRP_C 0x6CF0C 837 #define BXT_PORT_TX_DW3_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 838 _PORT_TX_DW3_LN0_B, \ 839 _PORT_TX_DW3_LN0_C) 840 #define BXT_PORT_TX_DW3_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 841 _PORT_TX_DW3_GRP_B, \ 842 _PORT_TX_DW3_GRP_C) 843 #define SCALE_DCOMP_METHOD (1 << 26) 844 #define UNIQUE_TRANGE_EN_METHOD (1 << 27) 845 846 #define _PORT_TX_DW4_LN0_A 0x162510 847 #define _PORT_TX_DW4_LN0_B 0x6C510 848 #define _PORT_TX_DW4_LN0_C 0x6C910 849 #define _PORT_TX_DW4_GRP_A 0x162D10 850 #define _PORT_TX_DW4_GRP_B 0x6CD10 851 #define _PORT_TX_DW4_GRP_C 0x6CF10 852 #define BXT_PORT_TX_DW4_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 853 _PORT_TX_DW4_LN0_B, \ 854 _PORT_TX_DW4_LN0_C) 855 #define BXT_PORT_TX_DW4_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 856 _PORT_TX_DW4_GRP_B, \ 857 _PORT_TX_DW4_GRP_C) 858 #define DEEMPH_SHIFT 24 859 #define DE_EMPHASIS (0xFF << DEEMPH_SHIFT) 860 861 #define _PORT_TX_DW5_LN0_A 0x162514 862 #define _PORT_TX_DW5_LN0_B 0x6C514 863 #define _PORT_TX_DW5_LN0_C 0x6C914 864 #define _PORT_TX_DW5_GRP_A 0x162D14 865 #define _PORT_TX_DW5_GRP_B 0x6CD14 866 #define _PORT_TX_DW5_GRP_C 0x6CF14 867 #define BXT_PORT_TX_DW5_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 868 _PORT_TX_DW5_LN0_B, \ 869 _PORT_TX_DW5_LN0_C) 870 #define BXT_PORT_TX_DW5_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \ 871 _PORT_TX_DW5_GRP_B, \ 872 _PORT_TX_DW5_GRP_C) 873 #define DCC_DELAY_RANGE_1 (1 << 9) 874 #define DCC_DELAY_RANGE_2 (1 << 8) 875 876 #define _PORT_TX_DW14_LN0_A 0x162538 877 #define _PORT_TX_DW14_LN0_B 0x6C538 878 #define _PORT_TX_DW14_LN0_C 0x6C938 879 #define LATENCY_OPTIM_SHIFT 30 880 #define LATENCY_OPTIM (1 << LATENCY_OPTIM_SHIFT) 881 #define BXT_PORT_TX_DW14_LN(phy, ch, lane) \ 882 _MMIO(_BXT_PHY_CH(phy, ch, _PORT_TX_DW14_LN0_B, \ 883 _PORT_TX_DW14_LN0_C) + \ 884 _BXT_LANE_OFFSET(lane)) 885 886 /* UAIMI scratch pad register 1 */ 887 #define UAIMI_SPR1 _MMIO(0x4F074) 888 /* SKL VccIO mask */ 889 #define SKL_VCCIO_MASK 0x1 890 /* SKL balance leg register */ 891 #define DISPIO_CR_TX_BMU_CR0 _MMIO(0x6C00C) 892 /* I_boost values */ 893 #define BALANCE_LEG_SHIFT(port) (8 + 3 * (port)) 894 #define BALANCE_LEG_MASK(port) (7 << (8 + 3 * (port))) 895 /* Balance leg disable bits */ 896 #define BALANCE_LEG_DISABLE_SHIFT 23 897 #define BALANCE_LEG_DISABLE(port) (1 << (23 + (port))) 898 899 /* 900 * Fence registers 901 * [0-7] @ 0x2000 gen2,gen3 902 * [8-15] @ 0x3000 945,g33,pnv 903 * 904 * [0-15] @ 0x3000 gen4,gen5 905 * 906 * [0-15] @ 0x100000 gen6,vlv,chv 907 * [0-31] @ 0x100000 gen7+ 908 */ 909 #define FENCE_REG(i) _MMIO(0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4) 910 #define I830_FENCE_START_MASK 0x07f80000 911 #define I830_FENCE_TILING_Y_SHIFT 12 912 #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8) 913 #define I830_FENCE_PITCH_SHIFT 4 914 #define I830_FENCE_REG_VALID (1 << 0) 915 #define I915_FENCE_MAX_PITCH_VAL 4 916 #define I830_FENCE_MAX_PITCH_VAL 6 917 #define I830_FENCE_MAX_SIZE_VAL (1 << 8) 918 919 #define I915_FENCE_START_MASK 0x0ff00000 920 #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8) 921 922 #define FENCE_REG_965_LO(i) _MMIO(0x03000 + (i) * 8) 923 #define FENCE_REG_965_HI(i) _MMIO(0x03000 + (i) * 8 + 4) 924 #define I965_FENCE_PITCH_SHIFT 2 925 #define I965_FENCE_TILING_Y_SHIFT 1 926 #define I965_FENCE_REG_VALID (1 << 0) 927 #define I965_FENCE_MAX_PITCH_VAL 0x0400 928 929 #define FENCE_REG_GEN6_LO(i) _MMIO(0x100000 + (i) * 8) 930 #define FENCE_REG_GEN6_HI(i) _MMIO(0x100000 + (i) * 8 + 4) 931 #define GEN6_FENCE_PITCH_SHIFT 32 932 #define GEN7_FENCE_MAX_PITCH_VAL 0x0800 933 934 935 /* control register for cpu gtt access */ 936 #define TILECTL _MMIO(0x101000) 937 #define TILECTL_SWZCTL (1 << 0) 938 #define TILECTL_TLBPF (1 << 1) 939 #define TILECTL_TLB_PREFETCH_DIS (1 << 2) 940 #define TILECTL_BACKSNOOP_DIS (1 << 3) 941 942 /* 943 * Instruction and interrupt control regs 944 */ 945 #define PGTBL_CTL _MMIO(0x02020) 946 #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */ 947 #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */ 948 #define PGTBL_ER _MMIO(0x02024) 949 #define PRB0_BASE (0x2030 - 0x30) 950 #define PRB1_BASE (0x2040 - 0x30) /* 830,gen3 */ 951 #define PRB2_BASE (0x2050 - 0x30) /* gen3 */ 952 #define SRB0_BASE (0x2100 - 0x30) /* gen2 */ 953 #define SRB1_BASE (0x2110 - 0x30) /* gen2 */ 954 #define SRB2_BASE (0x2120 - 0x30) /* 830 */ 955 #define SRB3_BASE (0x2130 - 0x30) /* 830 */ 956 #define RENDER_RING_BASE 0x02000 957 #define BSD_RING_BASE 0x04000 958 #define GEN6_BSD_RING_BASE 0x12000 959 #define GEN8_BSD2_RING_BASE 0x1c000 960 #define GEN11_BSD_RING_BASE 0x1c0000 961 #define GEN11_BSD2_RING_BASE 0x1c4000 962 #define GEN11_BSD3_RING_BASE 0x1d0000 963 #define GEN11_BSD4_RING_BASE 0x1d4000 964 #define XEHP_BSD5_RING_BASE 0x1e0000 965 #define XEHP_BSD6_RING_BASE 0x1e4000 966 #define XEHP_BSD7_RING_BASE 0x1f0000 967 #define XEHP_BSD8_RING_BASE 0x1f4000 968 #define VEBOX_RING_BASE 0x1a000 969 #define GEN11_VEBOX_RING_BASE 0x1c8000 970 #define GEN11_VEBOX2_RING_BASE 0x1d8000 971 #define XEHP_VEBOX3_RING_BASE 0x1e8000 972 #define XEHP_VEBOX4_RING_BASE 0x1f8000 973 #define MTL_GSC_RING_BASE 0x11a000 974 #define GEN12_COMPUTE0_RING_BASE 0x1a000 975 #define GEN12_COMPUTE1_RING_BASE 0x1c000 976 #define GEN12_COMPUTE2_RING_BASE 0x1e000 977 #define GEN12_COMPUTE3_RING_BASE 0x26000 978 #define BLT_RING_BASE 0x22000 979 #define XEHPC_BCS1_RING_BASE 0x3e0000 980 #define XEHPC_BCS2_RING_BASE 0x3e2000 981 #define XEHPC_BCS3_RING_BASE 0x3e4000 982 #define XEHPC_BCS4_RING_BASE 0x3e6000 983 #define XEHPC_BCS5_RING_BASE 0x3e8000 984 #define XEHPC_BCS6_RING_BASE 0x3ea000 985 #define XEHPC_BCS7_RING_BASE 0x3ec000 986 #define XEHPC_BCS8_RING_BASE 0x3ee000 987 #define DG1_GSC_HECI1_BASE 0x00258000 988 #define DG1_GSC_HECI2_BASE 0x00259000 989 #define DG2_GSC_HECI1_BASE 0x00373000 990 #define DG2_GSC_HECI2_BASE 0x00374000 991 992 993 994 #define HSW_GTT_CACHE_EN _MMIO(0x4024) 995 #define GTT_CACHE_EN_ALL 0xF0007FFF 996 #define GEN7_WR_WATERMARK _MMIO(0x4028) 997 #define GEN7_GFX_PRIO_CTRL _MMIO(0x402C) 998 #define ARB_MODE _MMIO(0x4030) 999 #define ARB_MODE_SWIZZLE_SNB (1 << 4) 1000 #define ARB_MODE_SWIZZLE_IVB (1 << 5) 1001 #define GEN7_GFX_PEND_TLB0 _MMIO(0x4034) 1002 #define GEN7_GFX_PEND_TLB1 _MMIO(0x4038) 1003 /* L3, CVS, ZTLB, RCC, CASC LRA min, max values */ 1004 #define GEN7_LRA_LIMITS(i) _MMIO(0x403C + (i) * 4) 1005 #define GEN7_LRA_LIMITS_REG_NUM 13 1006 #define GEN7_MEDIA_MAX_REQ_COUNT _MMIO(0x4070) 1007 #define GEN7_GFX_MAX_REQ_COUNT _MMIO(0x4074) 1008 1009 #define GEN7_ERR_INT _MMIO(0x44040) 1010 #define ERR_INT_POISON (1 << 31) 1011 #define ERR_INT_MMIO_UNCLAIMED (1 << 13) 1012 #define ERR_INT_PIPE_CRC_DONE_C (1 << 8) 1013 #define ERR_INT_FIFO_UNDERRUN_C (1 << 6) 1014 #define ERR_INT_PIPE_CRC_DONE_B (1 << 5) 1015 #define ERR_INT_FIFO_UNDERRUN_B (1 << 3) 1016 #define ERR_INT_PIPE_CRC_DONE_A (1 << 2) 1017 #define ERR_INT_PIPE_CRC_DONE(pipe) (1 << (2 + (pipe) * 3)) 1018 #define ERR_INT_FIFO_UNDERRUN_A (1 << 0) 1019 #define ERR_INT_FIFO_UNDERRUN(pipe) (1 << ((pipe) * 3)) 1020 1021 #define FPGA_DBG _MMIO(0x42300) 1022 #define FPGA_DBG_RM_NOCLAIM REG_BIT(31) 1023 1024 #define CLAIM_ER _MMIO(VLV_DISPLAY_BASE + 0x2028) 1025 #define CLAIM_ER_CLR REG_BIT(31) 1026 #define CLAIM_ER_OVERFLOW REG_BIT(16) 1027 #define CLAIM_ER_CTR_MASK REG_GENMASK(15, 0) 1028 1029 #define DERRMR _MMIO(0x44050) 1030 /* Note that HBLANK events are reserved on bdw+ */ 1031 #define DERRMR_PIPEA_SCANLINE (1 << 0) 1032 #define DERRMR_PIPEA_PRI_FLIP_DONE (1 << 1) 1033 #define DERRMR_PIPEA_SPR_FLIP_DONE (1 << 2) 1034 #define DERRMR_PIPEA_VBLANK (1 << 3) 1035 #define DERRMR_PIPEA_HBLANK (1 << 5) 1036 #define DERRMR_PIPEB_SCANLINE (1 << 8) 1037 #define DERRMR_PIPEB_PRI_FLIP_DONE (1 << 9) 1038 #define DERRMR_PIPEB_SPR_FLIP_DONE (1 << 10) 1039 #define DERRMR_PIPEB_VBLANK (1 << 11) 1040 #define DERRMR_PIPEB_HBLANK (1 << 13) 1041 /* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ 1042 #define DERRMR_PIPEC_SCANLINE (1 << 14) 1043 #define DERRMR_PIPEC_PRI_FLIP_DONE (1 << 15) 1044 #define DERRMR_PIPEC_SPR_FLIP_DONE (1 << 20) 1045 #define DERRMR_PIPEC_VBLANK (1 << 21) 1046 #define DERRMR_PIPEC_HBLANK (1 << 22) 1047 1048 #define VLV_GU_CTL0 _MMIO(VLV_DISPLAY_BASE + 0x2030) 1049 #define VLV_GU_CTL1 _MMIO(VLV_DISPLAY_BASE + 0x2034) 1050 #define SCPD0 _MMIO(0x209c) /* 915+ only */ 1051 #define SCPD_FBC_IGNORE_3D (1 << 6) 1052 #define CSTATE_RENDER_CLOCK_GATE_DISABLE (1 << 5) 1053 #define GEN2_IER _MMIO(0x20a0) 1054 #define GEN2_IIR _MMIO(0x20a4) 1055 #define GEN2_IMR _MMIO(0x20a8) 1056 #define GEN2_ISR _MMIO(0x20ac) 1057 #define VLV_GUNIT_CLOCK_GATE _MMIO(VLV_DISPLAY_BASE + 0x2060) 1058 #define GINT_DIS (1 << 22) 1059 #define GCFG_DIS (1 << 8) 1060 #define VLV_GUNIT_CLOCK_GATE2 _MMIO(VLV_DISPLAY_BASE + 0x2064) 1061 #define VLV_IIR_RW _MMIO(VLV_DISPLAY_BASE + 0x2084) 1062 #define VLV_IER _MMIO(VLV_DISPLAY_BASE + 0x20a0) 1063 #define VLV_IIR _MMIO(VLV_DISPLAY_BASE + 0x20a4) 1064 #define VLV_IMR _MMIO(VLV_DISPLAY_BASE + 0x20a8) 1065 #define VLV_ISR _MMIO(VLV_DISPLAY_BASE + 0x20ac) 1066 #define VLV_PCBR _MMIO(VLV_DISPLAY_BASE + 0x2120) 1067 #define VLV_PCBR_ADDR_SHIFT 12 1068 1069 #define DISPLAY_PLANE_FLIP_PENDING(plane) (1 << (11 - (plane))) /* A and B only */ 1070 #define EIR _MMIO(0x20b0) 1071 #define EMR _MMIO(0x20b4) 1072 #define ESR _MMIO(0x20b8) 1073 #define GM45_ERROR_PAGE_TABLE (1 << 5) 1074 #define GM45_ERROR_MEM_PRIV (1 << 4) 1075 #define I915_ERROR_PAGE_TABLE (1 << 4) 1076 #define GM45_ERROR_CP_PRIV (1 << 3) 1077 #define I915_ERROR_MEMORY_REFRESH (1 << 1) 1078 #define I915_ERROR_INSTRUCTION (1 << 0) 1079 #define INSTPM _MMIO(0x20c0) 1080 #define INSTPM_SELF_EN (1 << 12) /* 915GM only */ 1081 #define INSTPM_AGPBUSY_INT_EN (1 << 11) /* gen3: when disabled, pending interrupts 1082 will not assert AGPBUSY# and will only 1083 be delivered when out of C3. */ 1084 #define INSTPM_FORCE_ORDERING (1 << 7) /* GEN6+ */ 1085 #define INSTPM_TLB_INVALIDATE (1 << 9) 1086 #define INSTPM_SYNC_FLUSH (1 << 5) 1087 #define MEM_MODE _MMIO(0x20cc) 1088 #define MEM_DISPLAY_B_TRICKLE_FEED_DISABLE (1 << 3) /* 830 only */ 1089 #define MEM_DISPLAY_A_TRICKLE_FEED_DISABLE (1 << 2) /* 830/845 only */ 1090 #define MEM_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2) /* 85x only */ 1091 #define FW_BLC _MMIO(0x20d8) 1092 #define FW_BLC2 _MMIO(0x20dc) 1093 #define FW_BLC_SELF _MMIO(0x20e0) /* 915+ only */ 1094 #define FW_BLC_SELF_EN_MASK (1 << 31) 1095 #define FW_BLC_SELF_FIFO_MASK (1 << 16) /* 945 only */ 1096 #define FW_BLC_SELF_EN (1 << 15) /* 945 only */ 1097 #define MM_BURST_LENGTH 0x00700000 1098 #define MM_FIFO_WATERMARK 0x0001F000 1099 #define LM_BURST_LENGTH 0x00000700 1100 #define LM_FIFO_WATERMARK 0x0000001F 1101 #define MI_ARB_STATE _MMIO(0x20e4) /* 915+ only */ 1102 1103 #define _MBUS_ABOX0_CTL 0x45038 1104 #define _MBUS_ABOX1_CTL 0x45048 1105 #define _MBUS_ABOX2_CTL 0x4504C 1106 #define MBUS_ABOX_CTL(x) _MMIO(_PICK(x, _MBUS_ABOX0_CTL, \ 1107 _MBUS_ABOX1_CTL, \ 1108 _MBUS_ABOX2_CTL)) 1109 #define MBUS_ABOX_BW_CREDIT_MASK (3 << 20) 1110 #define MBUS_ABOX_BW_CREDIT(x) ((x) << 20) 1111 #define MBUS_ABOX_B_CREDIT_MASK (0xF << 16) 1112 #define MBUS_ABOX_B_CREDIT(x) ((x) << 16) 1113 #define MBUS_ABOX_BT_CREDIT_POOL2_MASK (0x1F << 8) 1114 #define MBUS_ABOX_BT_CREDIT_POOL2(x) ((x) << 8) 1115 #define MBUS_ABOX_BT_CREDIT_POOL1_MASK (0x1F << 0) 1116 #define MBUS_ABOX_BT_CREDIT_POOL1(x) ((x) << 0) 1117 1118 #define _PIPEA_MBUS_DBOX_CTL 0x7003C 1119 #define _PIPEB_MBUS_DBOX_CTL 0x7103C 1120 #define PIPE_MBUS_DBOX_CTL(pipe) _MMIO_PIPE(pipe, _PIPEA_MBUS_DBOX_CTL, \ 1121 _PIPEB_MBUS_DBOX_CTL) 1122 #define MBUS_DBOX_B2B_TRANSACTIONS_MAX_MASK REG_GENMASK(24, 20) /* tgl+ */ 1123 #define MBUS_DBOX_B2B_TRANSACTIONS_MAX(x) REG_FIELD_PREP(MBUS_DBOX_B2B_TRANSACTIONS_MAX_MASK, x) 1124 #define MBUS_DBOX_B2B_TRANSACTIONS_DELAY_MASK REG_GENMASK(19, 17) /* tgl+ */ 1125 #define MBUS_DBOX_B2B_TRANSACTIONS_DELAY(x) REG_FIELD_PREP(MBUS_DBOX_B2B_TRANSACTIONS_DELAY_MASK, x) 1126 #define MBUS_DBOX_REGULATE_B2B_TRANSACTIONS_EN REG_BIT(16) /* tgl+ */ 1127 #define MBUS_DBOX_BW_CREDIT_MASK REG_GENMASK(15, 14) 1128 #define MBUS_DBOX_BW_CREDIT(x) REG_FIELD_PREP(MBUS_DBOX_BW_CREDIT_MASK, x) 1129 #define MBUS_DBOX_BW_4CREDITS_MTL REG_FIELD_PREP(MBUS_DBOX_BW_CREDIT_MASK, 0x2) 1130 #define MBUS_DBOX_BW_8CREDITS_MTL REG_FIELD_PREP(MBUS_DBOX_BW_CREDIT_MASK, 0x3) 1131 #define MBUS_DBOX_B_CREDIT_MASK REG_GENMASK(12, 8) 1132 #define MBUS_DBOX_B_CREDIT(x) REG_FIELD_PREP(MBUS_DBOX_B_CREDIT_MASK, x) 1133 #define MBUS_DBOX_I_CREDIT_MASK REG_GENMASK(7, 5) 1134 #define MBUS_DBOX_I_CREDIT(x) REG_FIELD_PREP(MBUS_DBOX_I_CREDIT_MASK, x) 1135 #define MBUS_DBOX_A_CREDIT_MASK REG_GENMASK(3, 0) 1136 #define MBUS_DBOX_A_CREDIT(x) REG_FIELD_PREP(MBUS_DBOX_A_CREDIT_MASK, x) 1137 1138 #define MBUS_UBOX_CTL _MMIO(0x4503C) 1139 #define MBUS_BBOX_CTL_S1 _MMIO(0x45040) 1140 #define MBUS_BBOX_CTL_S2 _MMIO(0x45044) 1141 1142 #define MBUS_CTL _MMIO(0x4438C) 1143 #define MBUS_JOIN REG_BIT(31) 1144 #define MBUS_HASHING_MODE_MASK REG_BIT(30) 1145 #define MBUS_HASHING_MODE_2x2 REG_FIELD_PREP(MBUS_HASHING_MODE_MASK, 0) 1146 #define MBUS_HASHING_MODE_1x4 REG_FIELD_PREP(MBUS_HASHING_MODE_MASK, 1) 1147 #define MBUS_JOIN_PIPE_SELECT_MASK REG_GENMASK(28, 26) 1148 #define MBUS_JOIN_PIPE_SELECT(pipe) REG_FIELD_PREP(MBUS_JOIN_PIPE_SELECT_MASK, pipe) 1149 #define MBUS_JOIN_PIPE_SELECT_NONE MBUS_JOIN_PIPE_SELECT(7) 1150 1151 #define HDPORT_STATE _MMIO(0x45050) 1152 #define HDPORT_DPLL_USED_MASK REG_GENMASK(15, 12) 1153 #define HDPORT_DDI_USED(phy) REG_BIT(2 * (phy) + 1) 1154 #define HDPORT_ENABLED REG_BIT(0) 1155 1156 /* Make render/texture TLB fetches lower priorty than associated data 1157 * fetches. This is not turned on by default 1158 */ 1159 #define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15) 1160 1161 /* Isoch request wait on GTT enable (Display A/B/C streams). 1162 * Make isoch requests stall on the TLB update. May cause 1163 * display underruns (test mode only) 1164 */ 1165 #define MI_ARB_ISOCH_WAIT_GTT (1 << 14) 1166 1167 /* Block grant count for isoch requests when block count is 1168 * set to a finite value. 1169 */ 1170 #define MI_ARB_BLOCK_GRANT_MASK (3 << 12) 1171 #define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */ 1172 #define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */ 1173 #define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */ 1174 #define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */ 1175 1176 /* Enable render writes to complete in C2/C3/C4 power states. 1177 * If this isn't enabled, render writes are prevented in low 1178 * power states. That seems bad to me. 1179 */ 1180 #define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11) 1181 1182 /* This acknowledges an async flip immediately instead 1183 * of waiting for 2TLB fetches. 1184 */ 1185 #define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10) 1186 1187 /* Enables non-sequential data reads through arbiter 1188 */ 1189 #define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9) 1190 1191 /* Disable FSB snooping of cacheable write cycles from binner/render 1192 * command stream 1193 */ 1194 #define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8) 1195 1196 /* Arbiter time slice for non-isoch streams */ 1197 #define MI_ARB_TIME_SLICE_MASK (7 << 5) 1198 #define MI_ARB_TIME_SLICE_1 (0 << 5) 1199 #define MI_ARB_TIME_SLICE_2 (1 << 5) 1200 #define MI_ARB_TIME_SLICE_4 (2 << 5) 1201 #define MI_ARB_TIME_SLICE_6 (3 << 5) 1202 #define MI_ARB_TIME_SLICE_8 (4 << 5) 1203 #define MI_ARB_TIME_SLICE_10 (5 << 5) 1204 #define MI_ARB_TIME_SLICE_14 (6 << 5) 1205 #define MI_ARB_TIME_SLICE_16 (7 << 5) 1206 1207 /* Low priority grace period page size */ 1208 #define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */ 1209 #define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4) 1210 1211 /* Disable display A/B trickle feed */ 1212 #define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2) 1213 1214 /* Set display plane priority */ 1215 #define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */ 1216 #define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */ 1217 1218 #define MI_STATE _MMIO(0x20e4) /* gen2 only */ 1219 #define MI_AGPBUSY_INT_EN (1 << 1) /* 85x only */ 1220 #define MI_AGPBUSY_830_MODE (1 << 0) /* 85x only */ 1221 1222 /* On modern GEN architectures interrupt control consists of two sets 1223 * of registers. The first set pertains to the ring generating the 1224 * interrupt. The second control is for the functional block generating the 1225 * interrupt. These are PM, GT, DE, etc. 1226 * 1227 * Luckily *knocks on wood* all the ring interrupt bits match up with the 1228 * GT interrupt bits, so we don't need to duplicate the defines. 1229 * 1230 * These defines should cover us well from SNB->HSW with minor exceptions 1231 * it can also work on ILK. 1232 */ 1233 #define GT_BLT_FLUSHDW_NOTIFY_INTERRUPT (1 << 26) 1234 #define GT_BLT_CS_ERROR_INTERRUPT (1 << 25) 1235 #define GT_BLT_USER_INTERRUPT (1 << 22) 1236 #define GT_BSD_CS_ERROR_INTERRUPT (1 << 15) 1237 #define GT_BSD_USER_INTERRUPT (1 << 12) 1238 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 (1 << 11) /* hsw+; rsvd on snb, ivb, vlv */ 1239 #define GT_WAIT_SEMAPHORE_INTERRUPT REG_BIT(11) /* bdw+ */ 1240 #define GT_CONTEXT_SWITCH_INTERRUPT (1 << 8) 1241 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT (1 << 5) /* !snb */ 1242 #define GT_RENDER_PIPECTL_NOTIFY_INTERRUPT (1 << 4) 1243 #define GT_CS_MASTER_ERROR_INTERRUPT REG_BIT(3) 1244 #define GT_RENDER_SYNC_STATUS_INTERRUPT (1 << 2) 1245 #define GT_RENDER_DEBUG_INTERRUPT (1 << 1) 1246 #define GT_RENDER_USER_INTERRUPT (1 << 0) 1247 1248 #define PM_VEBOX_CS_ERROR_INTERRUPT (1 << 12) /* hsw+ */ 1249 #define PM_VEBOX_USER_INTERRUPT (1 << 10) /* hsw+ */ 1250 1251 #define GT_PARITY_ERROR(dev_priv) \ 1252 (GT_RENDER_L3_PARITY_ERROR_INTERRUPT | \ 1253 (IS_HASWELL(dev_priv) ? GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 : 0)) 1254 1255 /* These are all the "old" interrupts */ 1256 #define ILK_BSD_USER_INTERRUPT (1 << 5) 1257 1258 #define I915_PM_INTERRUPT (1 << 31) 1259 #define I915_ISP_INTERRUPT (1 << 22) 1260 #define I915_LPE_PIPE_B_INTERRUPT (1 << 21) 1261 #define I915_LPE_PIPE_A_INTERRUPT (1 << 20) 1262 #define I915_MIPIC_INTERRUPT (1 << 19) 1263 #define I915_MIPIA_INTERRUPT (1 << 18) 1264 #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1 << 18) 1265 #define I915_DISPLAY_PORT_INTERRUPT (1 << 17) 1266 #define I915_DISPLAY_PIPE_C_HBLANK_INTERRUPT (1 << 16) 1267 #define I915_MASTER_ERROR_INTERRUPT (1 << 15) 1268 #define I915_DISPLAY_PIPE_B_HBLANK_INTERRUPT (1 << 14) 1269 #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1 << 14) /* p-state */ 1270 #define I915_DISPLAY_PIPE_A_HBLANK_INTERRUPT (1 << 13) 1271 #define I915_HWB_OOM_INTERRUPT (1 << 13) 1272 #define I915_LPE_PIPE_C_INTERRUPT (1 << 12) 1273 #define I915_SYNC_STATUS_INTERRUPT (1 << 12) 1274 #define I915_MISC_INTERRUPT (1 << 11) 1275 #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1 << 11) 1276 #define I915_DISPLAY_PIPE_C_VBLANK_INTERRUPT (1 << 10) 1277 #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1 << 10) 1278 #define I915_DISPLAY_PIPE_C_EVENT_INTERRUPT (1 << 9) 1279 #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1 << 9) 1280 #define I915_DISPLAY_PIPE_C_DPBM_INTERRUPT (1 << 8) 1281 #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1 << 8) 1282 #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1 << 7) 1283 #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1 << 6) 1284 #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1 << 5) 1285 #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1 << 4) 1286 #define I915_DISPLAY_PIPE_A_DPBM_INTERRUPT (1 << 3) 1287 #define I915_DISPLAY_PIPE_B_DPBM_INTERRUPT (1 << 2) 1288 #define I915_DEBUG_INTERRUPT (1 << 2) 1289 #define I915_WINVALID_INTERRUPT (1 << 1) 1290 #define I915_USER_INTERRUPT (1 << 1) 1291 #define I915_ASLE_INTERRUPT (1 << 0) 1292 #define I915_BSD_USER_INTERRUPT (1 << 25) 1293 1294 #define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000) 1295 #define I915_HDMI_LPE_AUDIO_SIZE 0x1000 1296 1297 /* DisplayPort Audio w/ LPE */ 1298 #define VLV_AUD_CHICKEN_BIT_REG _MMIO(VLV_DISPLAY_BASE + 0x62F38) 1299 #define VLV_CHICKEN_BIT_DBG_ENABLE (1 << 0) 1300 1301 #define _VLV_AUD_PORT_EN_B_DBG (VLV_DISPLAY_BASE + 0x62F20) 1302 #define _VLV_AUD_PORT_EN_C_DBG (VLV_DISPLAY_BASE + 0x62F30) 1303 #define _VLV_AUD_PORT_EN_D_DBG (VLV_DISPLAY_BASE + 0x62F34) 1304 #define VLV_AUD_PORT_EN_DBG(port) _MMIO_PORT3((port) - PORT_B, \ 1305 _VLV_AUD_PORT_EN_B_DBG, \ 1306 _VLV_AUD_PORT_EN_C_DBG, \ 1307 _VLV_AUD_PORT_EN_D_DBG) 1308 #define VLV_AMP_MUTE (1 << 1) 1309 1310 #define GEN6_BSD_RNCID _MMIO(0x12198) 1311 1312 #define GEN7_FF_THREAD_MODE _MMIO(0x20a0) 1313 #define GEN7_FF_SCHED_MASK 0x0077070 1314 #define GEN8_FF_DS_REF_CNT_FFME (1 << 19) 1315 #define GEN12_FF_TESSELATION_DOP_GATE_DISABLE BIT(19) 1316 #define GEN7_FF_TS_SCHED_HS1 (0x5 << 16) 1317 #define GEN7_FF_TS_SCHED_HS0 (0x3 << 16) 1318 #define GEN7_FF_TS_SCHED_LOAD_BALANCE (0x1 << 16) 1319 #define GEN7_FF_TS_SCHED_HW (0x0 << 16) /* Default */ 1320 #define GEN7_FF_VS_REF_CNT_FFME (1 << 15) 1321 #define GEN7_FF_VS_SCHED_HS1 (0x5 << 12) 1322 #define GEN7_FF_VS_SCHED_HS0 (0x3 << 12) 1323 #define GEN7_FF_VS_SCHED_LOAD_BALANCE (0x1 << 12) /* Default */ 1324 #define GEN7_FF_VS_SCHED_HW (0x0 << 12) 1325 #define GEN7_FF_DS_SCHED_HS1 (0x5 << 4) 1326 #define GEN7_FF_DS_SCHED_HS0 (0x3 << 4) 1327 #define GEN7_FF_DS_SCHED_LOAD_BALANCE (0x1 << 4) /* Default */ 1328 #define GEN7_FF_DS_SCHED_HW (0x0 << 4) 1329 1330 /* 1331 * Framebuffer compression (915+ only) 1332 */ 1333 1334 #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */ 1335 #define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */ 1336 #define FBC_CONTROL _MMIO(0x3208) 1337 #define FBC_CTL_EN REG_BIT(31) 1338 #define FBC_CTL_PERIODIC REG_BIT(30) 1339 #define FBC_CTL_INTERVAL_MASK REG_GENMASK(29, 16) 1340 #define FBC_CTL_INTERVAL(x) REG_FIELD_PREP(FBC_CTL_INTERVAL_MASK, (x)) 1341 #define FBC_CTL_STOP_ON_MOD REG_BIT(15) 1342 #define FBC_CTL_UNCOMPRESSIBLE REG_BIT(14) /* i915+ */ 1343 #define FBC_CTL_C3_IDLE REG_BIT(13) /* i945gm only */ 1344 #define FBC_CTL_STRIDE_MASK REG_GENMASK(12, 5) 1345 #define FBC_CTL_STRIDE(x) REG_FIELD_PREP(FBC_CTL_STRIDE_MASK, (x)) 1346 #define FBC_CTL_FENCENO_MASK REG_GENMASK(3, 0) 1347 #define FBC_CTL_FENCENO(x) REG_FIELD_PREP(FBC_CTL_FENCENO_MASK, (x)) 1348 #define FBC_COMMAND _MMIO(0x320c) 1349 #define FBC_CMD_COMPRESS REG_BIT(0) 1350 #define FBC_STATUS _MMIO(0x3210) 1351 #define FBC_STAT_COMPRESSING REG_BIT(31) 1352 #define FBC_STAT_COMPRESSED REG_BIT(30) 1353 #define FBC_STAT_MODIFIED REG_BIT(29) 1354 #define FBC_STAT_CURRENT_LINE_MASK REG_GENMASK(10, 0) 1355 #define FBC_CONTROL2 _MMIO(0x3214) /* i965gm only */ 1356 #define FBC_CTL_FENCE_DBL REG_BIT(4) 1357 #define FBC_CTL_IDLE_MASK REG_GENMASK(3, 2) 1358 #define FBC_CTL_IDLE_IMM REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 0) 1359 #define FBC_CTL_IDLE_FULL REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 1) 1360 #define FBC_CTL_IDLE_LINE REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 2) 1361 #define FBC_CTL_IDLE_DEBUG REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 3) 1362 #define FBC_CTL_CPU_FENCE_EN REG_BIT(1) 1363 #define FBC_CTL_PLANE_MASK REG_GENMASK(1, 0) 1364 #define FBC_CTL_PLANE(i9xx_plane) REG_FIELD_PREP(FBC_CTL_PLANE_MASK, (i9xx_plane)) 1365 #define FBC_FENCE_OFF _MMIO(0x3218) /* i965gm only, BSpec typo has 321Bh */ 1366 #define FBC_MOD_NUM _MMIO(0x3220) /* i965gm only */ 1367 #define FBC_MOD_NUM_MASK REG_GENMASK(31, 1) 1368 #define FBC_MOD_NUM_VALID REG_BIT(0) 1369 #define FBC_TAG(i) _MMIO(0x3300 + (i) * 4) /* 49 reisters */ 1370 #define FBC_TAG_MASK REG_GENMASK(1, 0) /* 16 tags per register */ 1371 #define FBC_TAG_MODIFIED REG_FIELD_PREP(FBC_TAG_MASK, 0) 1372 #define FBC_TAG_UNCOMPRESSED REG_FIELD_PREP(FBC_TAG_MASK, 1) 1373 #define FBC_TAG_UNCOMPRESSIBLE REG_FIELD_PREP(FBC_TAG_MASK, 2) 1374 #define FBC_TAG_COMPRESSED REG_FIELD_PREP(FBC_TAG_MASK, 3) 1375 1376 #define FBC_LL_SIZE (1536) 1377 1378 /* Framebuffer compression for GM45+ */ 1379 #define DPFC_CB_BASE _MMIO(0x3200) 1380 #define ILK_DPFC_CB_BASE(fbc_id) _MMIO_PIPE((fbc_id), 0x43200, 0x43240) 1381 #define DPFC_CONTROL _MMIO(0x3208) 1382 #define ILK_DPFC_CONTROL(fbc_id) _MMIO_PIPE((fbc_id), 0x43208, 0x43248) 1383 #define DPFC_CTL_EN REG_BIT(31) 1384 #define DPFC_CTL_PLANE_MASK_G4X REG_BIT(30) /* g4x-snb */ 1385 #define DPFC_CTL_PLANE_G4X(i9xx_plane) REG_FIELD_PREP(DPFC_CTL_PLANE_MASK_G4X, (i9xx_plane)) 1386 #define DPFC_CTL_FENCE_EN_G4X REG_BIT(29) /* g4x-snb */ 1387 #define DPFC_CTL_PLANE_MASK_IVB REG_GENMASK(30, 29) /* ivb only */ 1388 #define DPFC_CTL_PLANE_IVB(i9xx_plane) REG_FIELD_PREP(DPFC_CTL_PLANE_MASK_IVB, (i9xx_plane)) 1389 #define DPFC_CTL_FENCE_EN_IVB REG_BIT(28) /* ivb+ */ 1390 #define DPFC_CTL_PERSISTENT_MODE REG_BIT(25) /* g4x-snb */ 1391 #define DPFC_CTL_FALSE_COLOR REG_BIT(10) /* ivb+ */ 1392 #define DPFC_CTL_SR_EN REG_BIT(10) /* g4x only */ 1393 #define DPFC_CTL_SR_EXIT_DIS REG_BIT(9) /* g4x only */ 1394 #define DPFC_CTL_LIMIT_MASK REG_GENMASK(7, 6) 1395 #define DPFC_CTL_LIMIT_1X REG_FIELD_PREP(DPFC_CTL_LIMIT_MASK, 0) 1396 #define DPFC_CTL_LIMIT_2X REG_FIELD_PREP(DPFC_CTL_LIMIT_MASK, 1) 1397 #define DPFC_CTL_LIMIT_4X REG_FIELD_PREP(DPFC_CTL_LIMIT_MASK, 2) 1398 #define DPFC_CTL_FENCENO_MASK REG_GENMASK(3, 0) 1399 #define DPFC_CTL_FENCENO(fence) REG_FIELD_PREP(DPFC_CTL_FENCENO_MASK, (fence)) 1400 #define DPFC_RECOMP_CTL _MMIO(0x320c) 1401 #define ILK_DPFC_RECOMP_CTL(fbc_id) _MMIO_PIPE((fbc_id), 0x4320c, 0x4324c) 1402 #define DPFC_RECOMP_STALL_EN REG_BIT(27) 1403 #define DPFC_RECOMP_STALL_WM_MASK REG_GENMASK(26, 16) 1404 #define DPFC_RECOMP_TIMER_COUNT_MASK REG_GENMASK(5, 0) 1405 #define DPFC_STATUS _MMIO(0x3210) 1406 #define ILK_DPFC_STATUS(fbc_id) _MMIO_PIPE((fbc_id), 0x43210, 0x43250) 1407 #define DPFC_INVAL_SEG_MASK REG_GENMASK(26, 16) 1408 #define DPFC_COMP_SEG_MASK REG_GENMASK(10, 0) 1409 #define DPFC_STATUS2 _MMIO(0x3214) 1410 #define ILK_DPFC_STATUS2(fbc_id) _MMIO_PIPE((fbc_id), 0x43214, 0x43254) 1411 #define DPFC_COMP_SEG_MASK_IVB REG_GENMASK(11, 0) 1412 #define DPFC_FENCE_YOFF _MMIO(0x3218) 1413 #define ILK_DPFC_FENCE_YOFF(fbc_id) _MMIO_PIPE((fbc_id), 0x43218, 0x43258) 1414 #define DPFC_CHICKEN _MMIO(0x3224) 1415 #define ILK_DPFC_CHICKEN(fbc_id) _MMIO_PIPE((fbc_id), 0x43224, 0x43264) 1416 #define DPFC_HT_MODIFY REG_BIT(31) /* pre-ivb */ 1417 #define DPFC_NUKE_ON_ANY_MODIFICATION REG_BIT(23) /* bdw+ */ 1418 #define DPFC_CHICKEN_COMP_DUMMY_PIXEL REG_BIT(14) /* glk+ */ 1419 #define DPFC_CHICKEN_FORCE_SLB_INVALIDATION REG_BIT(13) /* icl+ */ 1420 #define DPFC_DISABLE_DUMMY0 REG_BIT(8) /* ivb+ */ 1421 1422 #define GLK_FBC_STRIDE(fbc_id) _MMIO_PIPE((fbc_id), 0x43228, 0x43268) 1423 #define FBC_STRIDE_OVERRIDE REG_BIT(15) 1424 #define FBC_STRIDE_MASK REG_GENMASK(14, 0) 1425 #define FBC_STRIDE(x) REG_FIELD_PREP(FBC_STRIDE_MASK, (x)) 1426 1427 #define ILK_FBC_RT_BASE _MMIO(0x2128) 1428 #define ILK_FBC_RT_VALID REG_BIT(0) 1429 #define SNB_FBC_FRONT_BUFFER REG_BIT(1) 1430 1431 #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000) 1432 #define ILK_FBCQ_DIS (1 << 22) 1433 #define ILK_PABSTRETCH_DIS REG_BIT(21) 1434 #define ILK_SABSTRETCH_DIS REG_BIT(20) 1435 #define IVB_PRI_STRETCH_MAX_MASK REG_GENMASK(21, 20) 1436 #define IVB_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 0) 1437 #define IVB_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 1) 1438 #define IVB_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 2) 1439 #define IVB_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 3) 1440 #define IVB_SPR_STRETCH_MAX_MASK REG_GENMASK(19, 18) 1441 #define IVB_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 0) 1442 #define IVB_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 1) 1443 #define IVB_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 2) 1444 #define IVB_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 3) 1445 1446 1447 /* 1448 * Framebuffer compression for Sandybridge 1449 * 1450 * The following two registers are of type GTTMMADR 1451 */ 1452 #define SNB_DPFC_CTL_SA _MMIO(0x100100) 1453 #define SNB_DPFC_FENCE_EN REG_BIT(29) 1454 #define SNB_DPFC_FENCENO_MASK REG_GENMASK(4, 0) 1455 #define SNB_DPFC_FENCENO(fence) REG_FIELD_PREP(SNB_DPFC_FENCENO_MASK, (fence)) 1456 #define SNB_DPFC_CPU_FENCE_OFFSET _MMIO(0x100104) 1457 1458 /* Framebuffer compression for Ivybridge */ 1459 #define IVB_FBC_RT_BASE _MMIO(0x7020) 1460 #define IVB_FBC_RT_BASE_UPPER _MMIO(0x7024) 1461 1462 #define IPS_CTL _MMIO(0x43408) 1463 #define IPS_ENABLE (1 << 31) 1464 1465 #define MSG_FBC_REND_STATE(fbc_id) _MMIO_PIPE((fbc_id), 0x50380, 0x50384) 1466 #define FBC_REND_NUKE REG_BIT(2) 1467 #define FBC_REND_CACHE_CLEAN REG_BIT(1) 1468 1469 /* 1470 * Clock control & power management 1471 */ 1472 #define _DPLL_A (DISPLAY_MMIO_BASE(dev_priv) + 0x6014) 1473 #define _DPLL_B (DISPLAY_MMIO_BASE(dev_priv) + 0x6018) 1474 #define _CHV_DPLL_C (DISPLAY_MMIO_BASE(dev_priv) + 0x6030) 1475 #define DPLL(pipe) _MMIO_PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C) 1476 1477 #define VGA0 _MMIO(0x6000) 1478 #define VGA1 _MMIO(0x6004) 1479 #define VGA_PD _MMIO(0x6010) 1480 #define VGA0_PD_P2_DIV_4 (1 << 7) 1481 #define VGA0_PD_P1_DIV_2 (1 << 5) 1482 #define VGA0_PD_P1_SHIFT 0 1483 #define VGA0_PD_P1_MASK (0x1f << 0) 1484 #define VGA1_PD_P2_DIV_4 (1 << 15) 1485 #define VGA1_PD_P1_DIV_2 (1 << 13) 1486 #define VGA1_PD_P1_SHIFT 8 1487 #define VGA1_PD_P1_MASK (0x1f << 8) 1488 #define DPLL_VCO_ENABLE (1 << 31) 1489 #define DPLL_SDVO_HIGH_SPEED (1 << 30) 1490 #define DPLL_DVO_2X_MODE (1 << 30) 1491 #define DPLL_EXT_BUFFER_ENABLE_VLV (1 << 30) 1492 #define DPLL_SYNCLOCK_ENABLE (1 << 29) 1493 #define DPLL_REF_CLK_ENABLE_VLV (1 << 29) 1494 #define DPLL_VGA_MODE_DIS (1 << 28) 1495 #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */ 1496 #define DPLLB_MODE_LVDS (2 << 26) /* i915 */ 1497 #define DPLL_MODE_MASK (3 << 26) 1498 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */ 1499 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */ 1500 #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */ 1501 #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */ 1502 #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */ 1503 #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */ 1504 #define DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW 0x00ff8000 /* Pineview */ 1505 #define DPLL_LOCK_VLV (1 << 15) 1506 #define DPLL_INTEGRATED_CRI_CLK_VLV (1 << 14) 1507 #define DPLL_INTEGRATED_REF_CLK_VLV (1 << 13) 1508 #define DPLL_SSC_REF_CLK_CHV (1 << 13) 1509 #define DPLL_PORTC_READY_MASK (0xf << 4) 1510 #define DPLL_PORTB_READY_MASK (0xf) 1511 1512 #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000 1513 1514 /* Additional CHV pll/phy registers */ 1515 #define DPIO_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x6240) 1516 #define DPLL_PORTD_READY_MASK (0xf) 1517 #define DISPLAY_PHY_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x60100) 1518 #define PHY_CH_POWER_DOWN_OVRD_EN(phy, ch) (1 << (2 * (phy) + (ch) + 27)) 1519 #define PHY_LDO_DELAY_0NS 0x0 1520 #define PHY_LDO_DELAY_200NS 0x1 1521 #define PHY_LDO_DELAY_600NS 0x2 1522 #define PHY_LDO_SEQ_DELAY(delay, phy) ((delay) << (2 * (phy) + 23)) 1523 #define PHY_CH_POWER_DOWN_OVRD(mask, phy, ch) ((mask) << (8 * (phy) + 4 * (ch) + 11)) 1524 #define PHY_CH_SU_PSR 0x1 1525 #define PHY_CH_DEEP_PSR 0x7 1526 #define PHY_CH_POWER_MODE(mode, phy, ch) ((mode) << (6 * (phy) + 3 * (ch) + 2)) 1527 #define PHY_COM_LANE_RESET_DEASSERT(phy) (1 << (phy)) 1528 #define DISPLAY_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x60104) 1529 #define PHY_POWERGOOD(phy) (((phy) == DPIO_PHY0) ? (1 << 31) : (1 << 30)) 1530 #define PHY_STATUS_CMN_LDO(phy, ch) (1 << (6 - (6 * (phy) + 3 * (ch)))) 1531 #define PHY_STATUS_SPLINE_LDO(phy, ch, spline) (1 << (8 - (6 * (phy) + 3 * (ch) + (spline)))) 1532 1533 /* 1534 * The i830 generation, in LVDS mode, defines P1 as the bit number set within 1535 * this field (only one bit may be set). 1536 */ 1537 #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000 1538 #define DPLL_FPA01_P1_POST_DIV_SHIFT 16 1539 #define DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW 15 1540 /* i830, required in DVO non-gang */ 1541 #define PLL_P2_DIVIDE_BY_4 (1 << 23) 1542 #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */ 1543 #define PLL_REF_INPUT_DREFCLK (0 << 13) 1544 #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */ 1545 #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */ 1546 #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13) 1547 #define PLL_REF_INPUT_MASK (3 << 13) 1548 #define PLL_LOAD_PULSE_PHASE_SHIFT 9 1549 /* Ironlake */ 1550 # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9 1551 # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9) 1552 # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x) - 1) << 9) 1553 # define DPLL_FPA1_P1_POST_DIV_SHIFT 0 1554 # define DPLL_FPA1_P1_POST_DIV_MASK 0xff 1555 1556 /* 1557 * Parallel to Serial Load Pulse phase selection. 1558 * Selects the phase for the 10X DPLL clock for the PCIe 1559 * digital display port. The range is 4 to 13; 10 or more 1560 * is just a flip delay. The default is 6 1561 */ 1562 #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT) 1563 #define DISPLAY_RATE_SELECT_FPA1 (1 << 8) 1564 /* 1565 * SDVO multiplier for 945G/GM. Not used on 965. 1566 */ 1567 #define SDVO_MULTIPLIER_MASK 0x000000ff 1568 #define SDVO_MULTIPLIER_SHIFT_HIRES 4 1569 #define SDVO_MULTIPLIER_SHIFT_VGA 0 1570 1571 #define _DPLL_A_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x601c) 1572 #define _DPLL_B_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x6020) 1573 #define _CHV_DPLL_C_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x603c) 1574 #define DPLL_MD(pipe) _MMIO_PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD) 1575 1576 /* 1577 * UDI pixel divider, controlling how many pixels are stuffed into a packet. 1578 * 1579 * Value is pixels minus 1. Must be set to 1 pixel for SDVO. 1580 */ 1581 #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000 1582 #define DPLL_MD_UDI_DIVIDER_SHIFT 24 1583 /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */ 1584 #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000 1585 #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16 1586 /* 1587 * SDVO/UDI pixel multiplier. 1588 * 1589 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus 1590 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate 1591 * modes, the bus rate would be below the limits, so SDVO allows for stuffing 1592 * dummy bytes in the datastream at an increased clock rate, with both sides of 1593 * the link knowing how many bytes are fill. 1594 * 1595 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock 1596 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be 1597 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and 1598 * through an SDVO command. 1599 * 1600 * This register field has values of multiplication factor minus 1, with 1601 * a maximum multiplier of 5 for SDVO. 1602 */ 1603 #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00 1604 #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8 1605 /* 1606 * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK. 1607 * This best be set to the default value (3) or the CRT won't work. No, 1608 * I don't entirely understand what this does... 1609 */ 1610 #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f 1611 #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0 1612 1613 #define RAWCLK_FREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6024) 1614 1615 #define _FPA0 0x6040 1616 #define _FPA1 0x6044 1617 #define _FPB0 0x6048 1618 #define _FPB1 0x604c 1619 #define FP0(pipe) _MMIO_PIPE(pipe, _FPA0, _FPB0) 1620 #define FP1(pipe) _MMIO_PIPE(pipe, _FPA1, _FPB1) 1621 #define FP_N_DIV_MASK 0x003f0000 1622 #define FP_N_PINEVIEW_DIV_MASK 0x00ff0000 1623 #define FP_N_DIV_SHIFT 16 1624 #define FP_M1_DIV_MASK 0x00003f00 1625 #define FP_M1_DIV_SHIFT 8 1626 #define FP_M2_DIV_MASK 0x0000003f 1627 #define FP_M2_PINEVIEW_DIV_MASK 0x000000ff 1628 #define FP_M2_DIV_SHIFT 0 1629 #define DPLL_TEST _MMIO(0x606c) 1630 #define DPLLB_TEST_SDVO_DIV_1 (0 << 22) 1631 #define DPLLB_TEST_SDVO_DIV_2 (1 << 22) 1632 #define DPLLB_TEST_SDVO_DIV_4 (2 << 22) 1633 #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22) 1634 #define DPLLB_TEST_N_BYPASS (1 << 19) 1635 #define DPLLB_TEST_M_BYPASS (1 << 18) 1636 #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16) 1637 #define DPLLA_TEST_N_BYPASS (1 << 3) 1638 #define DPLLA_TEST_M_BYPASS (1 << 2) 1639 #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0) 1640 #define D_STATE _MMIO(0x6104) 1641 #define DSTATE_GFX_RESET_I830 (1 << 6) 1642 #define DSTATE_PLL_D3_OFF (1 << 3) 1643 #define DSTATE_GFX_CLOCK_GATING (1 << 1) 1644 #define DSTATE_DOT_CLOCK_GATING (1 << 0) 1645 #define DSPCLK_GATE_D(__i915) _MMIO(DISPLAY_MMIO_BASE(__i915) + 0x6200) 1646 # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */ 1647 # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */ 1648 # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */ 1649 # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */ 1650 # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */ 1651 # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */ 1652 # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */ 1653 # define PNV_GMBUSUNIT_CLOCK_GATE_DISABLE (1 << 24) /* pnv */ 1654 # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */ 1655 # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */ 1656 # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */ 1657 # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */ 1658 # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */ 1659 # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */ 1660 # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */ 1661 # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */ 1662 # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */ 1663 # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */ 1664 # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */ 1665 # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */ 1666 # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11) 1667 # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10) 1668 # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9) 1669 # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8) 1670 # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */ 1671 # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */ 1672 # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */ 1673 # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5) 1674 # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4) 1675 /* 1676 * This bit must be set on the 830 to prevent hangs when turning off the 1677 * overlay scaler. 1678 */ 1679 # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3) 1680 # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2) 1681 # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1) 1682 # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */ 1683 # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */ 1684 1685 #define RENCLK_GATE_D1 _MMIO(0x6204) 1686 # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */ 1687 # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */ 1688 # define PC_FE_CLOCK_GATE_DISABLE (1 << 11) 1689 # define PC_BE_CLOCK_GATE_DISABLE (1 << 10) 1690 # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9) 1691 # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8) 1692 # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7) 1693 # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6) 1694 # define MAG_CLOCK_GATE_DISABLE (1 << 5) 1695 /* This bit must be unset on 855,865 */ 1696 # define MECI_CLOCK_GATE_DISABLE (1 << 4) 1697 # define DCMP_CLOCK_GATE_DISABLE (1 << 3) 1698 # define MEC_CLOCK_GATE_DISABLE (1 << 2) 1699 # define MECO_CLOCK_GATE_DISABLE (1 << 1) 1700 /* This bit must be set on 855,865. */ 1701 # define SV_CLOCK_GATE_DISABLE (1 << 0) 1702 # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16) 1703 # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15) 1704 # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14) 1705 # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13) 1706 # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12) 1707 # define I915_WM_CLOCK_GATE_DISABLE (1 << 11) 1708 # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10) 1709 # define I915_PI_CLOCK_GATE_DISABLE (1 << 9) 1710 # define I915_DI_CLOCK_GATE_DISABLE (1 << 8) 1711 # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7) 1712 # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6) 1713 # define I915_SC_CLOCK_GATE_DISABLE (1 << 5) 1714 # define I915_FL_CLOCK_GATE_DISABLE (1 << 4) 1715 # define I915_DM_CLOCK_GATE_DISABLE (1 << 3) 1716 # define I915_PS_CLOCK_GATE_DISABLE (1 << 2) 1717 # define I915_CC_CLOCK_GATE_DISABLE (1 << 1) 1718 # define I915_BY_CLOCK_GATE_DISABLE (1 << 0) 1719 1720 # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30) 1721 /* This bit must always be set on 965G/965GM */ 1722 # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29) 1723 # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28) 1724 # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27) 1725 # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26) 1726 # define I965_GW_CLOCK_GATE_DISABLE (1 << 25) 1727 # define I965_TD_CLOCK_GATE_DISABLE (1 << 24) 1728 /* This bit must always be set on 965G */ 1729 # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23) 1730 # define I965_IC_CLOCK_GATE_DISABLE (1 << 22) 1731 # define I965_EU_CLOCK_GATE_DISABLE (1 << 21) 1732 # define I965_IF_CLOCK_GATE_DISABLE (1 << 20) 1733 # define I965_TC_CLOCK_GATE_DISABLE (1 << 19) 1734 # define I965_SO_CLOCK_GATE_DISABLE (1 << 17) 1735 # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16) 1736 # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15) 1737 # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14) 1738 # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13) 1739 # define I965_EM_CLOCK_GATE_DISABLE (1 << 12) 1740 # define I965_UC_CLOCK_GATE_DISABLE (1 << 11) 1741 # define I965_SI_CLOCK_GATE_DISABLE (1 << 6) 1742 # define I965_MT_CLOCK_GATE_DISABLE (1 << 5) 1743 # define I965_PL_CLOCK_GATE_DISABLE (1 << 4) 1744 # define I965_DG_CLOCK_GATE_DISABLE (1 << 3) 1745 # define I965_QC_CLOCK_GATE_DISABLE (1 << 2) 1746 # define I965_FT_CLOCK_GATE_DISABLE (1 << 1) 1747 # define I965_DM_CLOCK_GATE_DISABLE (1 << 0) 1748 1749 #define RENCLK_GATE_D2 _MMIO(0x6208) 1750 #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9) 1751 #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7) 1752 #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6) 1753 1754 #define VDECCLK_GATE_D _MMIO(0x620C) /* g4x only */ 1755 #define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4) 1756 1757 #define RAMCLK_GATE_D _MMIO(0x6210) /* CRL only */ 1758 #define DEUC _MMIO(0x6214) /* CRL only */ 1759 1760 #define FW_BLC_SELF_VLV _MMIO(VLV_DISPLAY_BASE + 0x6500) 1761 #define FW_CSPWRDWNEN (1 << 15) 1762 1763 #define MI_ARB_VLV _MMIO(VLV_DISPLAY_BASE + 0x6504) 1764 1765 #define CZCLK_CDCLK_FREQ_RATIO _MMIO(VLV_DISPLAY_BASE + 0x6508) 1766 #define CDCLK_FREQ_SHIFT 4 1767 #define CDCLK_FREQ_MASK (0x1f << CDCLK_FREQ_SHIFT) 1768 #define CZCLK_FREQ_MASK 0xf 1769 1770 #define GCI_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x650C) 1771 #define PFI_CREDIT_63 (9 << 28) /* chv only */ 1772 #define PFI_CREDIT_31 (8 << 28) /* chv only */ 1773 #define PFI_CREDIT(x) (((x) - 8) << 28) /* 8-15 */ 1774 #define PFI_CREDIT_RESEND (1 << 27) 1775 #define VGA_FAST_MODE_DISABLE (1 << 14) 1776 1777 #define GMBUSFREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6510) 1778 1779 /* 1780 * Palette regs 1781 */ 1782 #define _PALETTE_A 0xa000 1783 #define _PALETTE_B 0xa800 1784 #define _CHV_PALETTE_C 0xc000 1785 #define PALETTE_RED_MASK REG_GENMASK(23, 16) 1786 #define PALETTE_GREEN_MASK REG_GENMASK(15, 8) 1787 #define PALETTE_BLUE_MASK REG_GENMASK(7, 0) 1788 #define PALETTE(pipe, i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + \ 1789 _PICK((pipe), _PALETTE_A, \ 1790 _PALETTE_B, _CHV_PALETTE_C) + \ 1791 (i) * 4) 1792 1793 #define PEG_BAND_GAP_DATA _MMIO(0x14d68) 1794 1795 #define BXT_RP_STATE_CAP _MMIO(0x138170) 1796 #define GEN9_RP_STATE_LIMITS _MMIO(0x138148) 1797 #define XEHPSDV_RP_STATE_CAP _MMIO(0x250014) 1798 #define PVC_RP_STATE_CAP _MMIO(0x281014) 1799 1800 #define MTL_RP_STATE_CAP _MMIO(0x138000) 1801 #define MTL_MEDIAP_STATE_CAP _MMIO(0x138020) 1802 #define MTL_RP0_CAP_MASK REG_GENMASK(8, 0) 1803 #define MTL_RPN_CAP_MASK REG_GENMASK(24, 16) 1804 1805 #define MTL_GT_RPE_FREQUENCY _MMIO(0x13800c) 1806 #define MTL_MPE_FREQUENCY _MMIO(0x13802c) 1807 #define MTL_RPE_MASK REG_GENMASK(8, 0) 1808 1809 #define GT0_PERF_LIMIT_REASONS _MMIO(0x1381a8) 1810 #define GT0_PERF_LIMIT_REASONS_MASK 0xde3 1811 #define PROCHOT_MASK REG_BIT(0) 1812 #define THERMAL_LIMIT_MASK REG_BIT(1) 1813 #define RATL_MASK REG_BIT(5) 1814 #define VR_THERMALERT_MASK REG_BIT(6) 1815 #define VR_TDC_MASK REG_BIT(7) 1816 #define POWER_LIMIT_4_MASK REG_BIT(8) 1817 #define POWER_LIMIT_1_MASK REG_BIT(10) 1818 #define POWER_LIMIT_2_MASK REG_BIT(11) 1819 #define GT0_PERF_LIMIT_REASONS_LOG_MASK REG_GENMASK(31, 16) 1820 #define MTL_MEDIA_PERF_LIMIT_REASONS _MMIO(0x138030) 1821 1822 #define CHV_CLK_CTL1 _MMIO(0x101100) 1823 #define VLV_CLK_CTL2 _MMIO(0x101104) 1824 #define CLK_CTL2_CZCOUNT_30NS_SHIFT 28 1825 1826 /* 1827 * Overlay regs 1828 */ 1829 1830 #define OVADD _MMIO(0x30000) 1831 #define DOVSTA _MMIO(0x30008) 1832 #define OC_BUF (0x3 << 20) 1833 #define OGAMC5 _MMIO(0x30010) 1834 #define OGAMC4 _MMIO(0x30014) 1835 #define OGAMC3 _MMIO(0x30018) 1836 #define OGAMC2 _MMIO(0x3001c) 1837 #define OGAMC1 _MMIO(0x30020) 1838 #define OGAMC0 _MMIO(0x30024) 1839 1840 /* 1841 * GEN9 clock gating regs 1842 */ 1843 #define GEN9_CLKGATE_DIS_0 _MMIO(0x46530) 1844 #define DARBF_GATING_DIS (1 << 27) 1845 #define PWM2_GATING_DIS (1 << 14) 1846 #define PWM1_GATING_DIS (1 << 13) 1847 1848 #define GEN9_CLKGATE_DIS_3 _MMIO(0x46538) 1849 #define TGL_VRH_GATING_DIS REG_BIT(31) 1850 #define DPT_GATING_DIS REG_BIT(22) 1851 1852 #define GEN9_CLKGATE_DIS_4 _MMIO(0x4653C) 1853 #define BXT_GMBUS_GATING_DIS (1 << 14) 1854 1855 #define GEN9_CLKGATE_DIS_5 _MMIO(0x46540) 1856 #define DPCE_GATING_DIS REG_BIT(17) 1857 1858 #define _CLKGATE_DIS_PSL_A 0x46520 1859 #define _CLKGATE_DIS_PSL_B 0x46524 1860 #define _CLKGATE_DIS_PSL_C 0x46528 1861 #define DUPS1_GATING_DIS (1 << 15) 1862 #define DUPS2_GATING_DIS (1 << 19) 1863 #define DUPS3_GATING_DIS (1 << 23) 1864 #define CURSOR_GATING_DIS REG_BIT(28) 1865 #define DPF_GATING_DIS (1 << 10) 1866 #define DPF_RAM_GATING_DIS (1 << 9) 1867 #define DPFR_GATING_DIS (1 << 8) 1868 1869 #define CLKGATE_DIS_PSL(pipe) \ 1870 _MMIO_PIPE(pipe, _CLKGATE_DIS_PSL_A, _CLKGATE_DIS_PSL_B) 1871 1872 #define _CLKGATE_DIS_PSL_EXT_A 0x4654C 1873 #define _CLKGATE_DIS_PSL_EXT_B 0x46550 1874 #define PIPEDMC_GATING_DIS REG_BIT(12) 1875 1876 #define CLKGATE_DIS_PSL_EXT(pipe) \ 1877 _MMIO_PIPE(pipe, _CLKGATE_DIS_PSL_EXT_A, _CLKGATE_DIS_PSL_EXT_B) 1878 1879 /* 1880 * Display engine regs 1881 */ 1882 1883 /* Pipe A CRC regs */ 1884 #define _PIPE_CRC_CTL_A 0x60050 1885 #define PIPE_CRC_ENABLE REG_BIT(31) 1886 /* skl+ source selection */ 1887 #define PIPE_CRC_SOURCE_MASK_SKL REG_GENMASK(30, 28) 1888 #define PIPE_CRC_SOURCE_PLANE_1_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 0) 1889 #define PIPE_CRC_SOURCE_PLANE_2_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 2) 1890 #define PIPE_CRC_SOURCE_DMUX_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 4) 1891 #define PIPE_CRC_SOURCE_PLANE_3_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 6) 1892 #define PIPE_CRC_SOURCE_PLANE_4_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 7) 1893 #define PIPE_CRC_SOURCE_PLANE_5_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 5) 1894 #define PIPE_CRC_SOURCE_PLANE_6_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 3) 1895 #define PIPE_CRC_SOURCE_PLANE_7_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 1) 1896 /* ivb+ source selection */ 1897 #define PIPE_CRC_SOURCE_MASK_IVB REG_GENMASK(30, 29) 1898 #define PIPE_CRC_SOURCE_PRIMARY_IVB REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_IVB, 0) 1899 #define PIPE_CRC_SOURCE_SPRITE_IVB REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_IVB, 1) 1900 #define PIPE_CRC_SOURCE_PF_IVB REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_IVB, 2) 1901 /* ilk+ source selection */ 1902 #define PIPE_CRC_SOURCE_MASK_ILK REG_GENMASK(30, 28) 1903 #define PIPE_CRC_SOURCE_PRIMARY_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 0) 1904 #define PIPE_CRC_SOURCE_SPRITE_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 1) 1905 #define PIPE_CRC_SOURCE_PIPE_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 2) 1906 /* embedded DP port on the north display block */ 1907 #define PIPE_CRC_SOURCE_PORT_A_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 4) 1908 #define PIPE_CRC_SOURCE_FDI_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 5) 1909 /* vlv source selection */ 1910 #define PIPE_CRC_SOURCE_MASK_VLV REG_GENMASK(30, 27) 1911 #define PIPE_CRC_SOURCE_PIPE_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 0) 1912 #define PIPE_CRC_SOURCE_HDMIB_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 1) 1913 #define PIPE_CRC_SOURCE_HDMIC_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 2) 1914 /* with DP port the pipe source is invalid */ 1915 #define PIPE_CRC_SOURCE_DP_D_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 3) 1916 #define PIPE_CRC_SOURCE_DP_B_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 6) 1917 #define PIPE_CRC_SOURCE_DP_C_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 7) 1918 /* gen3+ source selection */ 1919 #define PIPE_CRC_SOURCE_MASK_I9XX REG_GENMASK(30, 28) 1920 #define PIPE_CRC_SOURCE_PIPE_I9XX REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 0) 1921 #define PIPE_CRC_SOURCE_SDVOB_I9XX REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 1) 1922 #define PIPE_CRC_SOURCE_SDVOC_I9XX REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 2) 1923 /* with DP/TV port the pipe source is invalid */ 1924 #define PIPE_CRC_SOURCE_DP_D_G4X REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 3) 1925 #define PIPE_CRC_SOURCE_TV_PRE REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 4) 1926 #define PIPE_CRC_SOURCE_TV_POST REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 5) 1927 #define PIPE_CRC_SOURCE_DP_B_G4X REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 6) 1928 #define PIPE_CRC_SOURCE_DP_C_G4X REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 7) 1929 /* gen2 doesn't have source selection bits */ 1930 #define PIPE_CRC_INCLUDE_BORDER_I8XX REG_BIT(30) 1931 1932 #define _PIPE_CRC_RES_1_A_IVB 0x60064 1933 #define _PIPE_CRC_RES_2_A_IVB 0x60068 1934 #define _PIPE_CRC_RES_3_A_IVB 0x6006c 1935 #define _PIPE_CRC_RES_4_A_IVB 0x60070 1936 #define _PIPE_CRC_RES_5_A_IVB 0x60074 1937 1938 #define _PIPE_CRC_RES_RED_A 0x60060 1939 #define _PIPE_CRC_RES_GREEN_A 0x60064 1940 #define _PIPE_CRC_RES_BLUE_A 0x60068 1941 #define _PIPE_CRC_RES_RES1_A_I915 0x6006c 1942 #define _PIPE_CRC_RES_RES2_A_G4X 0x60080 1943 1944 /* Pipe B CRC regs */ 1945 #define _PIPE_CRC_RES_1_B_IVB 0x61064 1946 #define _PIPE_CRC_RES_2_B_IVB 0x61068 1947 #define _PIPE_CRC_RES_3_B_IVB 0x6106c 1948 #define _PIPE_CRC_RES_4_B_IVB 0x61070 1949 #define _PIPE_CRC_RES_5_B_IVB 0x61074 1950 1951 #define PIPE_CRC_CTL(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_CTL_A) 1952 #define PIPE_CRC_RES_1_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_1_A_IVB) 1953 #define PIPE_CRC_RES_2_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_2_A_IVB) 1954 #define PIPE_CRC_RES_3_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_3_A_IVB) 1955 #define PIPE_CRC_RES_4_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_4_A_IVB) 1956 #define PIPE_CRC_RES_5_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_5_A_IVB) 1957 1958 #define PIPE_CRC_RES_RED(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RED_A) 1959 #define PIPE_CRC_RES_GREEN(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_GREEN_A) 1960 #define PIPE_CRC_RES_BLUE(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_BLUE_A) 1961 #define PIPE_CRC_RES_RES1_I915(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES1_A_I915) 1962 #define PIPE_CRC_RES_RES2_G4X(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES2_A_G4X) 1963 1964 /* Pipe A timing regs */ 1965 #define _HTOTAL_A 0x60000 1966 #define _HBLANK_A 0x60004 1967 #define _HSYNC_A 0x60008 1968 #define _VTOTAL_A 0x6000c 1969 #define _VBLANK_A 0x60010 1970 #define _VSYNC_A 0x60014 1971 #define _EXITLINE_A 0x60018 1972 #define _PIPEASRC 0x6001c 1973 #define PIPESRC_WIDTH_MASK REG_GENMASK(31, 16) 1974 #define PIPESRC_WIDTH(w) REG_FIELD_PREP(PIPESRC_WIDTH_MASK, (w)) 1975 #define PIPESRC_HEIGHT_MASK REG_GENMASK(15, 0) 1976 #define PIPESRC_HEIGHT(h) REG_FIELD_PREP(PIPESRC_HEIGHT_MASK, (h)) 1977 #define _BCLRPAT_A 0x60020 1978 #define _VSYNCSHIFT_A 0x60028 1979 #define _PIPE_MULT_A 0x6002c 1980 1981 /* Pipe B timing regs */ 1982 #define _HTOTAL_B 0x61000 1983 #define _HBLANK_B 0x61004 1984 #define _HSYNC_B 0x61008 1985 #define _VTOTAL_B 0x6100c 1986 #define _VBLANK_B 0x61010 1987 #define _VSYNC_B 0x61014 1988 #define _PIPEBSRC 0x6101c 1989 #define _BCLRPAT_B 0x61020 1990 #define _VSYNCSHIFT_B 0x61028 1991 #define _PIPE_MULT_B 0x6102c 1992 1993 /* DSI 0 timing regs */ 1994 #define _HTOTAL_DSI0 0x6b000 1995 #define _HSYNC_DSI0 0x6b008 1996 #define _VTOTAL_DSI0 0x6b00c 1997 #define _VSYNC_DSI0 0x6b014 1998 #define _VSYNCSHIFT_DSI0 0x6b028 1999 2000 /* DSI 1 timing regs */ 2001 #define _HTOTAL_DSI1 0x6b800 2002 #define _HSYNC_DSI1 0x6b808 2003 #define _VTOTAL_DSI1 0x6b80c 2004 #define _VSYNC_DSI1 0x6b814 2005 #define _VSYNCSHIFT_DSI1 0x6b828 2006 2007 #define TRANSCODER_A_OFFSET 0x60000 2008 #define TRANSCODER_B_OFFSET 0x61000 2009 #define TRANSCODER_C_OFFSET 0x62000 2010 #define CHV_TRANSCODER_C_OFFSET 0x63000 2011 #define TRANSCODER_D_OFFSET 0x63000 2012 #define TRANSCODER_EDP_OFFSET 0x6f000 2013 #define TRANSCODER_DSI0_OFFSET 0x6b000 2014 #define TRANSCODER_DSI1_OFFSET 0x6b800 2015 2016 #define HTOTAL(trans) _MMIO_TRANS2(trans, _HTOTAL_A) 2017 #define HBLANK(trans) _MMIO_TRANS2(trans, _HBLANK_A) 2018 #define HSYNC(trans) _MMIO_TRANS2(trans, _HSYNC_A) 2019 #define VTOTAL(trans) _MMIO_TRANS2(trans, _VTOTAL_A) 2020 #define VBLANK(trans) _MMIO_TRANS2(trans, _VBLANK_A) 2021 #define VSYNC(trans) _MMIO_TRANS2(trans, _VSYNC_A) 2022 #define BCLRPAT(trans) _MMIO_TRANS2(trans, _BCLRPAT_A) 2023 #define VSYNCSHIFT(trans) _MMIO_TRANS2(trans, _VSYNCSHIFT_A) 2024 #define PIPESRC(trans) _MMIO_TRANS2(trans, _PIPEASRC) 2025 #define PIPE_MULT(trans) _MMIO_TRANS2(trans, _PIPE_MULT_A) 2026 2027 #define EXITLINE(trans) _MMIO_TRANS2(trans, _EXITLINE_A) 2028 #define EXITLINE_ENABLE REG_BIT(31) 2029 #define EXITLINE_MASK REG_GENMASK(12, 0) 2030 #define EXITLINE_SHIFT 0 2031 2032 /* VRR registers */ 2033 #define _TRANS_VRR_CTL_A 0x60420 2034 #define _TRANS_VRR_CTL_B 0x61420 2035 #define _TRANS_VRR_CTL_C 0x62420 2036 #define _TRANS_VRR_CTL_D 0x63420 2037 #define TRANS_VRR_CTL(trans) _MMIO_TRANS2(trans, _TRANS_VRR_CTL_A) 2038 #define VRR_CTL_VRR_ENABLE REG_BIT(31) 2039 #define VRR_CTL_IGN_MAX_SHIFT REG_BIT(30) 2040 #define VRR_CTL_FLIP_LINE_EN REG_BIT(29) 2041 #define VRR_CTL_PIPELINE_FULL_MASK REG_GENMASK(10, 3) 2042 #define VRR_CTL_PIPELINE_FULL(x) REG_FIELD_PREP(VRR_CTL_PIPELINE_FULL_MASK, (x)) 2043 #define VRR_CTL_PIPELINE_FULL_OVERRIDE REG_BIT(0) 2044 #define XELPD_VRR_CTL_VRR_GUARDBAND_MASK REG_GENMASK(15, 0) 2045 #define XELPD_VRR_CTL_VRR_GUARDBAND(x) REG_FIELD_PREP(XELPD_VRR_CTL_VRR_GUARDBAND_MASK, (x)) 2046 2047 #define _TRANS_VRR_VMAX_A 0x60424 2048 #define _TRANS_VRR_VMAX_B 0x61424 2049 #define _TRANS_VRR_VMAX_C 0x62424 2050 #define _TRANS_VRR_VMAX_D 0x63424 2051 #define TRANS_VRR_VMAX(trans) _MMIO_TRANS2(trans, _TRANS_VRR_VMAX_A) 2052 #define VRR_VMAX_MASK REG_GENMASK(19, 0) 2053 2054 #define _TRANS_VRR_VMIN_A 0x60434 2055 #define _TRANS_VRR_VMIN_B 0x61434 2056 #define _TRANS_VRR_VMIN_C 0x62434 2057 #define _TRANS_VRR_VMIN_D 0x63434 2058 #define TRANS_VRR_VMIN(trans) _MMIO_TRANS2(trans, _TRANS_VRR_VMIN_A) 2059 #define VRR_VMIN_MASK REG_GENMASK(15, 0) 2060 2061 #define _TRANS_VRR_VMAXSHIFT_A 0x60428 2062 #define _TRANS_VRR_VMAXSHIFT_B 0x61428 2063 #define _TRANS_VRR_VMAXSHIFT_C 0x62428 2064 #define _TRANS_VRR_VMAXSHIFT_D 0x63428 2065 #define TRANS_VRR_VMAXSHIFT(trans) _MMIO_TRANS2(trans, \ 2066 _TRANS_VRR_VMAXSHIFT_A) 2067 #define VRR_VMAXSHIFT_DEC_MASK REG_GENMASK(29, 16) 2068 #define VRR_VMAXSHIFT_DEC REG_BIT(16) 2069 #define VRR_VMAXSHIFT_INC_MASK REG_GENMASK(12, 0) 2070 2071 #define _TRANS_VRR_STATUS_A 0x6042C 2072 #define _TRANS_VRR_STATUS_B 0x6142C 2073 #define _TRANS_VRR_STATUS_C 0x6242C 2074 #define _TRANS_VRR_STATUS_D 0x6342C 2075 #define TRANS_VRR_STATUS(trans) _MMIO_TRANS2(trans, _TRANS_VRR_STATUS_A) 2076 #define VRR_STATUS_VMAX_REACHED REG_BIT(31) 2077 #define VRR_STATUS_NOFLIP_TILL_BNDR REG_BIT(30) 2078 #define VRR_STATUS_FLIP_BEF_BNDR REG_BIT(29) 2079 #define VRR_STATUS_NO_FLIP_FRAME REG_BIT(28) 2080 #define VRR_STATUS_VRR_EN_LIVE REG_BIT(27) 2081 #define VRR_STATUS_FLIPS_SERVICED REG_BIT(26) 2082 #define VRR_STATUS_VBLANK_MASK REG_GENMASK(22, 20) 2083 #define STATUS_FSM_IDLE REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 0) 2084 #define STATUS_FSM_WAIT_TILL_FDB REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 1) 2085 #define STATUS_FSM_WAIT_TILL_FS REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 2) 2086 #define STATUS_FSM_WAIT_TILL_FLIP REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 3) 2087 #define STATUS_FSM_PIPELINE_FILL REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 4) 2088 #define STATUS_FSM_ACTIVE REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 5) 2089 #define STATUS_FSM_LEGACY_VBLANK REG_FIELD_PREP(VRR_STATUS_VBLANK_MASK, 6) 2090 2091 #define _TRANS_VRR_VTOTAL_PREV_A 0x60480 2092 #define _TRANS_VRR_VTOTAL_PREV_B 0x61480 2093 #define _TRANS_VRR_VTOTAL_PREV_C 0x62480 2094 #define _TRANS_VRR_VTOTAL_PREV_D 0x63480 2095 #define TRANS_VRR_VTOTAL_PREV(trans) _MMIO_TRANS2(trans, \ 2096 _TRANS_VRR_VTOTAL_PREV_A) 2097 #define VRR_VTOTAL_FLIP_BEFR_BNDR REG_BIT(31) 2098 #define VRR_VTOTAL_FLIP_AFTER_BNDR REG_BIT(30) 2099 #define VRR_VTOTAL_FLIP_AFTER_DBLBUF REG_BIT(29) 2100 #define VRR_VTOTAL_PREV_FRAME_MASK REG_GENMASK(19, 0) 2101 2102 #define _TRANS_VRR_FLIPLINE_A 0x60438 2103 #define _TRANS_VRR_FLIPLINE_B 0x61438 2104 #define _TRANS_VRR_FLIPLINE_C 0x62438 2105 #define _TRANS_VRR_FLIPLINE_D 0x63438 2106 #define TRANS_VRR_FLIPLINE(trans) _MMIO_TRANS2(trans, \ 2107 _TRANS_VRR_FLIPLINE_A) 2108 #define VRR_FLIPLINE_MASK REG_GENMASK(19, 0) 2109 2110 #define _TRANS_VRR_STATUS2_A 0x6043C 2111 #define _TRANS_VRR_STATUS2_B 0x6143C 2112 #define _TRANS_VRR_STATUS2_C 0x6243C 2113 #define _TRANS_VRR_STATUS2_D 0x6343C 2114 #define TRANS_VRR_STATUS2(trans) _MMIO_TRANS2(trans, _TRANS_VRR_STATUS2_A) 2115 #define VRR_STATUS2_VERT_LN_CNT_MASK REG_GENMASK(19, 0) 2116 2117 #define _TRANS_PUSH_A 0x60A70 2118 #define _TRANS_PUSH_B 0x61A70 2119 #define _TRANS_PUSH_C 0x62A70 2120 #define _TRANS_PUSH_D 0x63A70 2121 #define TRANS_PUSH(trans) _MMIO_TRANS2(trans, _TRANS_PUSH_A) 2122 #define TRANS_PUSH_EN REG_BIT(31) 2123 #define TRANS_PUSH_SEND REG_BIT(30) 2124 2125 /* 2126 * HSW+ eDP PSR registers 2127 * 2128 * HSW PSR registers are relative to DDIA(_DDI_BUF_CTL_A + 0x800) with just one 2129 * instance of it 2130 */ 2131 #define _SRD_CTL_A 0x60800 2132 #define _SRD_CTL_EDP 0x6f800 2133 #define EDP_PSR_CTL(tran) _MMIO_TRANS2(tran, _SRD_CTL_A) 2134 #define EDP_PSR_ENABLE (1 << 31) 2135 #define BDW_PSR_SINGLE_FRAME (1 << 30) 2136 #define EDP_PSR_RESTORE_PSR_ACTIVE_CTX_MASK (1 << 29) /* SW can't modify */ 2137 #define EDP_PSR_LINK_STANDBY (1 << 27) 2138 #define EDP_PSR_MIN_LINK_ENTRY_TIME_MASK (3 << 25) 2139 #define EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES (0 << 25) 2140 #define EDP_PSR_MIN_LINK_ENTRY_TIME_4_LINES (1 << 25) 2141 #define EDP_PSR_MIN_LINK_ENTRY_TIME_2_LINES (2 << 25) 2142 #define EDP_PSR_MIN_LINK_ENTRY_TIME_0_LINES (3 << 25) 2143 #define EDP_PSR_MAX_SLEEP_TIME_SHIFT 20 2144 #define EDP_PSR_SKIP_AUX_EXIT (1 << 12) 2145 #define EDP_PSR_TP1_TP2_SEL (0 << 11) 2146 #define EDP_PSR_TP1_TP3_SEL (1 << 11) 2147 #define EDP_PSR_CRC_ENABLE (1 << 10) /* BDW+ */ 2148 #define EDP_PSR_TP2_TP3_TIME_500us (0 << 8) 2149 #define EDP_PSR_TP2_TP3_TIME_100us (1 << 8) 2150 #define EDP_PSR_TP2_TP3_TIME_2500us (2 << 8) 2151 #define EDP_PSR_TP2_TP3_TIME_0us (3 << 8) 2152 #define EDP_PSR_TP4_TIME_0US (3 << 6) /* ICL+ */ 2153 #define EDP_PSR_TP1_TIME_500us (0 << 4) 2154 #define EDP_PSR_TP1_TIME_100us (1 << 4) 2155 #define EDP_PSR_TP1_TIME_2500us (2 << 4) 2156 #define EDP_PSR_TP1_TIME_0us (3 << 4) 2157 #define EDP_PSR_IDLE_FRAME_SHIFT 0 2158 2159 /* 2160 * Until TGL, IMR/IIR are fixed at 0x648xx. On TGL+ those registers are relative 2161 * to transcoder and bits defined for each one as if using no shift (i.e. as if 2162 * it was for TRANSCODER_EDP) 2163 */ 2164 #define EDP_PSR_IMR _MMIO(0x64834) 2165 #define EDP_PSR_IIR _MMIO(0x64838) 2166 #define _PSR_IMR_A 0x60814 2167 #define _PSR_IIR_A 0x60818 2168 #define TRANS_PSR_IMR(tran) _MMIO_TRANS2(tran, _PSR_IMR_A) 2169 #define TRANS_PSR_IIR(tran) _MMIO_TRANS2(tran, _PSR_IIR_A) 2170 #define _EDP_PSR_TRANS_SHIFT(trans) ((trans) == TRANSCODER_EDP ? \ 2171 0 : ((trans) - TRANSCODER_A + 1) * 8) 2172 #define TGL_PSR_MASK REG_GENMASK(2, 0) 2173 #define TGL_PSR_ERROR REG_BIT(2) 2174 #define TGL_PSR_POST_EXIT REG_BIT(1) 2175 #define TGL_PSR_PRE_ENTRY REG_BIT(0) 2176 #define EDP_PSR_MASK(trans) (TGL_PSR_MASK << \ 2177 _EDP_PSR_TRANS_SHIFT(trans)) 2178 #define EDP_PSR_ERROR(trans) (TGL_PSR_ERROR << \ 2179 _EDP_PSR_TRANS_SHIFT(trans)) 2180 #define EDP_PSR_POST_EXIT(trans) (TGL_PSR_POST_EXIT << \ 2181 _EDP_PSR_TRANS_SHIFT(trans)) 2182 #define EDP_PSR_PRE_ENTRY(trans) (TGL_PSR_PRE_ENTRY << \ 2183 _EDP_PSR_TRANS_SHIFT(trans)) 2184 2185 #define _SRD_AUX_DATA_A 0x60814 2186 #define _SRD_AUX_DATA_EDP 0x6f814 2187 #define EDP_PSR_AUX_DATA(tran, i) _MMIO_TRANS2(tran, _SRD_AUX_DATA_A + (i) + 4) /* 5 registers */ 2188 2189 #define _SRD_STATUS_A 0x60840 2190 #define _SRD_STATUS_EDP 0x6f840 2191 #define EDP_PSR_STATUS(tran) _MMIO_TRANS2(tran, _SRD_STATUS_A) 2192 #define EDP_PSR_STATUS_STATE_MASK (7 << 29) 2193 #define EDP_PSR_STATUS_STATE_SHIFT 29 2194 #define EDP_PSR_STATUS_STATE_IDLE (0 << 29) 2195 #define EDP_PSR_STATUS_STATE_SRDONACK (1 << 29) 2196 #define EDP_PSR_STATUS_STATE_SRDENT (2 << 29) 2197 #define EDP_PSR_STATUS_STATE_BUFOFF (3 << 29) 2198 #define EDP_PSR_STATUS_STATE_BUFON (4 << 29) 2199 #define EDP_PSR_STATUS_STATE_AUXACK (5 << 29) 2200 #define EDP_PSR_STATUS_STATE_SRDOFFACK (6 << 29) 2201 #define EDP_PSR_STATUS_LINK_MASK (3 << 26) 2202 #define EDP_PSR_STATUS_LINK_FULL_OFF (0 << 26) 2203 #define EDP_PSR_STATUS_LINK_FULL_ON (1 << 26) 2204 #define EDP_PSR_STATUS_LINK_STANDBY (2 << 26) 2205 #define EDP_PSR_STATUS_MAX_SLEEP_TIMER_SHIFT 20 2206 #define EDP_PSR_STATUS_MAX_SLEEP_TIMER_MASK 0x1f 2207 #define EDP_PSR_STATUS_COUNT_SHIFT 16 2208 #define EDP_PSR_STATUS_COUNT_MASK 0xf 2209 #define EDP_PSR_STATUS_AUX_ERROR (1 << 15) 2210 #define EDP_PSR_STATUS_AUX_SENDING (1 << 12) 2211 #define EDP_PSR_STATUS_SENDING_IDLE (1 << 9) 2212 #define EDP_PSR_STATUS_SENDING_TP2_TP3 (1 << 8) 2213 #define EDP_PSR_STATUS_SENDING_TP1 (1 << 4) 2214 #define EDP_PSR_STATUS_IDLE_MASK 0xf 2215 2216 #define _SRD_PERF_CNT_A 0x60844 2217 #define _SRD_PERF_CNT_EDP 0x6f844 2218 #define EDP_PSR_PERF_CNT(tran) _MMIO_TRANS2(tran, _SRD_PERF_CNT_A) 2219 #define EDP_PSR_PERF_CNT_MASK 0xffffff 2220 2221 /* PSR_MASK on SKL+ */ 2222 #define _SRD_DEBUG_A 0x60860 2223 #define _SRD_DEBUG_EDP 0x6f860 2224 #define EDP_PSR_DEBUG(tran) _MMIO_TRANS2(tran, _SRD_DEBUG_A) 2225 #define EDP_PSR_DEBUG_MASK_MAX_SLEEP (1 << 28) 2226 #define EDP_PSR_DEBUG_MASK_LPSP (1 << 27) 2227 #define EDP_PSR_DEBUG_MASK_MEMUP (1 << 26) 2228 #define EDP_PSR_DEBUG_MASK_HPD (1 << 25) 2229 #define EDP_PSR_DEBUG_MASK_DISP_REG_WRITE (1 << 16) /* Reserved in ICL+ */ 2230 #define EDP_PSR_DEBUG_EXIT_ON_PIXEL_UNDERRUN (1 << 15) /* SKL+ */ 2231 2232 #define _PSR2_CTL_A 0x60900 2233 #define _PSR2_CTL_EDP 0x6f900 2234 #define EDP_PSR2_CTL(tran) _MMIO_TRANS2(tran, _PSR2_CTL_A) 2235 #define EDP_PSR2_ENABLE (1 << 31) 2236 #define EDP_SU_TRACK_ENABLE (1 << 30) /* up to adl-p */ 2237 #define TGL_EDP_PSR2_BLOCK_COUNT_NUM_2 (0 << 28) 2238 #define TGL_EDP_PSR2_BLOCK_COUNT_NUM_3 (1 << 28) 2239 #define EDP_Y_COORDINATE_ENABLE REG_BIT(25) /* display 10, 11 and 12 */ 2240 #define EDP_PSR2_SU_SDP_SCANLINE REG_BIT(25) /* display 13+ */ 2241 #define EDP_MAX_SU_DISABLE_TIME(t) ((t) << 20) 2242 #define EDP_MAX_SU_DISABLE_TIME_MASK (0x1f << 20) 2243 #define EDP_PSR2_IO_BUFFER_WAKE_MAX_LINES 8 2244 #define EDP_PSR2_IO_BUFFER_WAKE(lines) ((EDP_PSR2_IO_BUFFER_WAKE_MAX_LINES - (lines)) << 13) 2245 #define EDP_PSR2_IO_BUFFER_WAKE_MASK (3 << 13) 2246 #define TGL_EDP_PSR2_IO_BUFFER_WAKE_MIN_LINES 5 2247 #define TGL_EDP_PSR2_IO_BUFFER_WAKE_SHIFT 13 2248 #define TGL_EDP_PSR2_IO_BUFFER_WAKE(lines) (((lines) - TGL_EDP_PSR2_IO_BUFFER_WAKE_MIN_LINES) << TGL_EDP_PSR2_IO_BUFFER_WAKE_SHIFT) 2249 #define TGL_EDP_PSR2_IO_BUFFER_WAKE_MASK (7 << 13) 2250 #define EDP_PSR2_FAST_WAKE_MAX_LINES 8 2251 #define EDP_PSR2_FAST_WAKE(lines) ((EDP_PSR2_FAST_WAKE_MAX_LINES - (lines)) << 11) 2252 #define EDP_PSR2_FAST_WAKE_MASK (3 << 11) 2253 #define TGL_EDP_PSR2_FAST_WAKE_MIN_LINES 5 2254 #define TGL_EDP_PSR2_FAST_WAKE_MIN_SHIFT 10 2255 #define TGL_EDP_PSR2_FAST_WAKE(lines) (((lines) - TGL_EDP_PSR2_FAST_WAKE_MIN_LINES) << TGL_EDP_PSR2_FAST_WAKE_MIN_SHIFT) 2256 #define TGL_EDP_PSR2_FAST_WAKE_MASK (7 << 10) 2257 #define EDP_PSR2_TP2_TIME_500us (0 << 8) 2258 #define EDP_PSR2_TP2_TIME_100us (1 << 8) 2259 #define EDP_PSR2_TP2_TIME_2500us (2 << 8) 2260 #define EDP_PSR2_TP2_TIME_50us (3 << 8) 2261 #define EDP_PSR2_TP2_TIME_MASK (3 << 8) 2262 #define EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4 2263 #define EDP_PSR2_FRAME_BEFORE_SU_MASK (0xf << 4) 2264 #define EDP_PSR2_FRAME_BEFORE_SU(a) ((a) << 4) 2265 #define EDP_PSR2_IDLE_FRAME_MASK 0xf 2266 #define EDP_PSR2_IDLE_FRAME_SHIFT 0 2267 2268 #define _PSR_EVENT_TRANS_A 0x60848 2269 #define _PSR_EVENT_TRANS_B 0x61848 2270 #define _PSR_EVENT_TRANS_C 0x62848 2271 #define _PSR_EVENT_TRANS_D 0x63848 2272 #define _PSR_EVENT_TRANS_EDP 0x6f848 2273 #define PSR_EVENT(tran) _MMIO_TRANS2(tran, _PSR_EVENT_TRANS_A) 2274 #define PSR_EVENT_PSR2_WD_TIMER_EXPIRE (1 << 17) 2275 #define PSR_EVENT_PSR2_DISABLED (1 << 16) 2276 #define PSR_EVENT_SU_DIRTY_FIFO_UNDERRUN (1 << 15) 2277 #define PSR_EVENT_SU_CRC_FIFO_UNDERRUN (1 << 14) 2278 #define PSR_EVENT_GRAPHICS_RESET (1 << 12) 2279 #define PSR_EVENT_PCH_INTERRUPT (1 << 11) 2280 #define PSR_EVENT_MEMORY_UP (1 << 10) 2281 #define PSR_EVENT_FRONT_BUFFER_MODIFY (1 << 9) 2282 #define PSR_EVENT_WD_TIMER_EXPIRE (1 << 8) 2283 #define PSR_EVENT_PIPE_REGISTERS_UPDATE (1 << 6) 2284 #define PSR_EVENT_REGISTER_UPDATE (1 << 5) /* Reserved in ICL+ */ 2285 #define PSR_EVENT_HDCP_ENABLE (1 << 4) 2286 #define PSR_EVENT_KVMR_SESSION_ENABLE (1 << 3) 2287 #define PSR_EVENT_VBI_ENABLE (1 << 2) 2288 #define PSR_EVENT_LPSP_MODE_EXIT (1 << 1) 2289 #define PSR_EVENT_PSR_DISABLE (1 << 0) 2290 2291 #define _PSR2_STATUS_A 0x60940 2292 #define _PSR2_STATUS_EDP 0x6f940 2293 #define EDP_PSR2_STATUS(tran) _MMIO_TRANS2(tran, _PSR2_STATUS_A) 2294 #define EDP_PSR2_STATUS_STATE_MASK REG_GENMASK(31, 28) 2295 #define EDP_PSR2_STATUS_STATE_DEEP_SLEEP REG_FIELD_PREP(EDP_PSR2_STATUS_STATE_MASK, 0x8) 2296 2297 #define _PSR2_SU_STATUS_A 0x60914 2298 #define _PSR2_SU_STATUS_EDP 0x6f914 2299 #define _PSR2_SU_STATUS(tran, index) _MMIO_TRANS2(tran, _PSR2_SU_STATUS_A + (index) * 4) 2300 #define PSR2_SU_STATUS(tran, frame) (_PSR2_SU_STATUS(tran, (frame) / 3)) 2301 #define PSR2_SU_STATUS_SHIFT(frame) (((frame) % 3) * 10) 2302 #define PSR2_SU_STATUS_MASK(frame) (0x3ff << PSR2_SU_STATUS_SHIFT(frame)) 2303 #define PSR2_SU_STATUS_FRAMES 8 2304 2305 #define _PSR2_MAN_TRK_CTL_A 0x60910 2306 #define _PSR2_MAN_TRK_CTL_EDP 0x6f910 2307 #define PSR2_MAN_TRK_CTL(tran) _MMIO_TRANS2(tran, _PSR2_MAN_TRK_CTL_A) 2308 #define PSR2_MAN_TRK_CTL_ENABLE REG_BIT(31) 2309 #define PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK REG_GENMASK(30, 21) 2310 #define PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(val) REG_FIELD_PREP(PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK, val) 2311 #define PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK REG_GENMASK(20, 11) 2312 #define PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(val) REG_FIELD_PREP(PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK, val) 2313 #define PSR2_MAN_TRK_CTL_SF_SINGLE_FULL_FRAME REG_BIT(3) 2314 #define PSR2_MAN_TRK_CTL_SF_CONTINUOS_FULL_FRAME REG_BIT(2) 2315 #define PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE REG_BIT(1) 2316 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK REG_GENMASK(28, 16) 2317 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(val) REG_FIELD_PREP(ADLP_PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR_MASK, val) 2318 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK REG_GENMASK(12, 0) 2319 #define ADLP_PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(val) REG_FIELD_PREP(ADLP_PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR_MASK, val) 2320 #define ADLP_PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE REG_BIT(31) 2321 #define ADLP_PSR2_MAN_TRK_CTL_SF_SINGLE_FULL_FRAME REG_BIT(14) 2322 #define ADLP_PSR2_MAN_TRK_CTL_SF_CONTINUOS_FULL_FRAME REG_BIT(13) 2323 2324 /* Icelake DSC Rate Control Range Parameter Registers */ 2325 #define DSCA_RC_RANGE_PARAMETERS_0 _MMIO(0x6B240) 2326 #define DSCA_RC_RANGE_PARAMETERS_0_UDW _MMIO(0x6B240 + 4) 2327 #define DSCC_RC_RANGE_PARAMETERS_0 _MMIO(0x6BA40) 2328 #define DSCC_RC_RANGE_PARAMETERS_0_UDW _MMIO(0x6BA40 + 4) 2329 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_PB (0x78208) 2330 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PB (0x78208 + 4) 2331 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_PB (0x78308) 2332 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PB (0x78308 + 4) 2333 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_PC (0x78408) 2334 #define _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PC (0x78408 + 4) 2335 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_PC (0x78508) 2336 #define _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PC (0x78508 + 4) 2337 #define ICL_DSC0_RC_RANGE_PARAMETERS_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2338 _ICL_DSC0_RC_RANGE_PARAMETERS_0_PB, \ 2339 _ICL_DSC0_RC_RANGE_PARAMETERS_0_PC) 2340 #define ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2341 _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PB, \ 2342 _ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW_PC) 2343 #define ICL_DSC1_RC_RANGE_PARAMETERS_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2344 _ICL_DSC1_RC_RANGE_PARAMETERS_0_PB, \ 2345 _ICL_DSC1_RC_RANGE_PARAMETERS_0_PC) 2346 #define ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2347 _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PB, \ 2348 _ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW_PC) 2349 #define RC_BPG_OFFSET_SHIFT 10 2350 #define RC_MAX_QP_SHIFT 5 2351 #define RC_MIN_QP_SHIFT 0 2352 2353 #define DSCA_RC_RANGE_PARAMETERS_1 _MMIO(0x6B248) 2354 #define DSCA_RC_RANGE_PARAMETERS_1_UDW _MMIO(0x6B248 + 4) 2355 #define DSCC_RC_RANGE_PARAMETERS_1 _MMIO(0x6BA48) 2356 #define DSCC_RC_RANGE_PARAMETERS_1_UDW _MMIO(0x6BA48 + 4) 2357 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_PB (0x78210) 2358 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PB (0x78210 + 4) 2359 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_PB (0x78310) 2360 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PB (0x78310 + 4) 2361 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_PC (0x78410) 2362 #define _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PC (0x78410 + 4) 2363 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_PC (0x78510) 2364 #define _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PC (0x78510 + 4) 2365 #define ICL_DSC0_RC_RANGE_PARAMETERS_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2366 _ICL_DSC0_RC_RANGE_PARAMETERS_1_PB, \ 2367 _ICL_DSC0_RC_RANGE_PARAMETERS_1_PC) 2368 #define ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2369 _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PB, \ 2370 _ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW_PC) 2371 #define ICL_DSC1_RC_RANGE_PARAMETERS_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2372 _ICL_DSC1_RC_RANGE_PARAMETERS_1_PB, \ 2373 _ICL_DSC1_RC_RANGE_PARAMETERS_1_PC) 2374 #define ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2375 _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PB, \ 2376 _ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW_PC) 2377 2378 #define DSCA_RC_RANGE_PARAMETERS_2 _MMIO(0x6B250) 2379 #define DSCA_RC_RANGE_PARAMETERS_2_UDW _MMIO(0x6B250 + 4) 2380 #define DSCC_RC_RANGE_PARAMETERS_2 _MMIO(0x6BA50) 2381 #define DSCC_RC_RANGE_PARAMETERS_2_UDW _MMIO(0x6BA50 + 4) 2382 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_PB (0x78218) 2383 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PB (0x78218 + 4) 2384 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_PB (0x78318) 2385 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PB (0x78318 + 4) 2386 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_PC (0x78418) 2387 #define _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PC (0x78418 + 4) 2388 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_PC (0x78518) 2389 #define _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PC (0x78518 + 4) 2390 #define ICL_DSC0_RC_RANGE_PARAMETERS_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2391 _ICL_DSC0_RC_RANGE_PARAMETERS_2_PB, \ 2392 _ICL_DSC0_RC_RANGE_PARAMETERS_2_PC) 2393 #define ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2394 _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PB, \ 2395 _ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW_PC) 2396 #define ICL_DSC1_RC_RANGE_PARAMETERS_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2397 _ICL_DSC1_RC_RANGE_PARAMETERS_2_PB, \ 2398 _ICL_DSC1_RC_RANGE_PARAMETERS_2_PC) 2399 #define ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2400 _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PB, \ 2401 _ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW_PC) 2402 2403 #define DSCA_RC_RANGE_PARAMETERS_3 _MMIO(0x6B258) 2404 #define DSCA_RC_RANGE_PARAMETERS_3_UDW _MMIO(0x6B258 + 4) 2405 #define DSCC_RC_RANGE_PARAMETERS_3 _MMIO(0x6BA58) 2406 #define DSCC_RC_RANGE_PARAMETERS_3_UDW _MMIO(0x6BA58 + 4) 2407 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_PB (0x78220) 2408 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PB (0x78220 + 4) 2409 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_PB (0x78320) 2410 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PB (0x78320 + 4) 2411 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_PC (0x78420) 2412 #define _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PC (0x78420 + 4) 2413 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_PC (0x78520) 2414 #define _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PC (0x78520 + 4) 2415 #define ICL_DSC0_RC_RANGE_PARAMETERS_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2416 _ICL_DSC0_RC_RANGE_PARAMETERS_3_PB, \ 2417 _ICL_DSC0_RC_RANGE_PARAMETERS_3_PC) 2418 #define ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2419 _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PB, \ 2420 _ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW_PC) 2421 #define ICL_DSC1_RC_RANGE_PARAMETERS_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2422 _ICL_DSC1_RC_RANGE_PARAMETERS_3_PB, \ 2423 _ICL_DSC1_RC_RANGE_PARAMETERS_3_PC) 2424 #define ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 2425 _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PB, \ 2426 _ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW_PC) 2427 2428 /* VGA port control */ 2429 #define ADPA _MMIO(0x61100) 2430 #define PCH_ADPA _MMIO(0xe1100) 2431 #define VLV_ADPA _MMIO(VLV_DISPLAY_BASE + 0x61100) 2432 2433 #define ADPA_DAC_ENABLE (1 << 31) 2434 #define ADPA_DAC_DISABLE 0 2435 #define ADPA_PIPE_SEL_SHIFT 30 2436 #define ADPA_PIPE_SEL_MASK (1 << 30) 2437 #define ADPA_PIPE_SEL(pipe) ((pipe) << 30) 2438 #define ADPA_PIPE_SEL_SHIFT_CPT 29 2439 #define ADPA_PIPE_SEL_MASK_CPT (3 << 29) 2440 #define ADPA_PIPE_SEL_CPT(pipe) ((pipe) << 29) 2441 #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */ 2442 #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0 << 24) 2443 #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3 << 24) 2444 #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3 << 24) 2445 #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2 << 24) 2446 #define ADPA_CRT_HOTPLUG_ENABLE (1 << 23) 2447 #define ADPA_CRT_HOTPLUG_PERIOD_64 (0 << 22) 2448 #define ADPA_CRT_HOTPLUG_PERIOD_128 (1 << 22) 2449 #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0 << 21) 2450 #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1 << 21) 2451 #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0 << 20) 2452 #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1 << 20) 2453 #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0 << 18) 2454 #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1 << 18) 2455 #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2 << 18) 2456 #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3 << 18) 2457 #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0 << 17) 2458 #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1 << 17) 2459 #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1 << 16) 2460 #define ADPA_USE_VGA_HVPOLARITY (1 << 15) 2461 #define ADPA_SETS_HVPOLARITY 0 2462 #define ADPA_VSYNC_CNTL_DISABLE (1 << 10) 2463 #define ADPA_VSYNC_CNTL_ENABLE 0 2464 #define ADPA_HSYNC_CNTL_DISABLE (1 << 11) 2465 #define ADPA_HSYNC_CNTL_ENABLE 0 2466 #define ADPA_VSYNC_ACTIVE_HIGH (1 << 4) 2467 #define ADPA_VSYNC_ACTIVE_LOW 0 2468 #define ADPA_HSYNC_ACTIVE_HIGH (1 << 3) 2469 #define ADPA_HSYNC_ACTIVE_LOW 0 2470 #define ADPA_DPMS_MASK (~(3 << 10)) 2471 #define ADPA_DPMS_ON (0 << 10) 2472 #define ADPA_DPMS_SUSPEND (1 << 10) 2473 #define ADPA_DPMS_STANDBY (2 << 10) 2474 #define ADPA_DPMS_OFF (3 << 10) 2475 2476 2477 /* Hotplug control (945+ only) */ 2478 #define PORT_HOTPLUG_EN _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61110) 2479 #define PORTB_HOTPLUG_INT_EN (1 << 29) 2480 #define PORTC_HOTPLUG_INT_EN (1 << 28) 2481 #define PORTD_HOTPLUG_INT_EN (1 << 27) 2482 #define SDVOB_HOTPLUG_INT_EN (1 << 26) 2483 #define SDVOC_HOTPLUG_INT_EN (1 << 25) 2484 #define TV_HOTPLUG_INT_EN (1 << 18) 2485 #define CRT_HOTPLUG_INT_EN (1 << 9) 2486 #define HOTPLUG_INT_EN_MASK (PORTB_HOTPLUG_INT_EN | \ 2487 PORTC_HOTPLUG_INT_EN | \ 2488 PORTD_HOTPLUG_INT_EN | \ 2489 SDVOC_HOTPLUG_INT_EN | \ 2490 SDVOB_HOTPLUG_INT_EN | \ 2491 CRT_HOTPLUG_INT_EN) 2492 #define CRT_HOTPLUG_FORCE_DETECT (1 << 3) 2493 #define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8) 2494 /* must use period 64 on GM45 according to docs */ 2495 #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8) 2496 #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7) 2497 #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7) 2498 #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5) 2499 #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5) 2500 #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5) 2501 #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5) 2502 #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5) 2503 #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4) 2504 #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4) 2505 #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2) 2506 #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) 2507 2508 #define PORT_HOTPLUG_STAT _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61114) 2509 /* 2510 * HDMI/DP bits are g4x+ 2511 * 2512 * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused. 2513 * Please check the detailed lore in the commit message for for experimental 2514 * evidence. 2515 */ 2516 /* Bspec says GM45 should match G4X/VLV/CHV, but reality disagrees */ 2517 #define PORTD_HOTPLUG_LIVE_STATUS_GM45 (1 << 29) 2518 #define PORTC_HOTPLUG_LIVE_STATUS_GM45 (1 << 28) 2519 #define PORTB_HOTPLUG_LIVE_STATUS_GM45 (1 << 27) 2520 /* G4X/VLV/CHV DP/HDMI bits again match Bspec */ 2521 #define PORTD_HOTPLUG_LIVE_STATUS_G4X (1 << 27) 2522 #define PORTC_HOTPLUG_LIVE_STATUS_G4X (1 << 28) 2523 #define PORTB_HOTPLUG_LIVE_STATUS_G4X (1 << 29) 2524 #define PORTD_HOTPLUG_INT_STATUS (3 << 21) 2525 #define PORTD_HOTPLUG_INT_LONG_PULSE (2 << 21) 2526 #define PORTD_HOTPLUG_INT_SHORT_PULSE (1 << 21) 2527 #define PORTC_HOTPLUG_INT_STATUS (3 << 19) 2528 #define PORTC_HOTPLUG_INT_LONG_PULSE (2 << 19) 2529 #define PORTC_HOTPLUG_INT_SHORT_PULSE (1 << 19) 2530 #define PORTB_HOTPLUG_INT_STATUS (3 << 17) 2531 #define PORTB_HOTPLUG_INT_LONG_PULSE (2 << 17) 2532 #define PORTB_HOTPLUG_INT_SHORT_PLUSE (1 << 17) 2533 /* CRT/TV common between gen3+ */ 2534 #define CRT_HOTPLUG_INT_STATUS (1 << 11) 2535 #define TV_HOTPLUG_INT_STATUS (1 << 10) 2536 #define CRT_HOTPLUG_MONITOR_MASK (3 << 8) 2537 #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8) 2538 #define CRT_HOTPLUG_MONITOR_MONO (2 << 8) 2539 #define CRT_HOTPLUG_MONITOR_NONE (0 << 8) 2540 #define DP_AUX_CHANNEL_D_INT_STATUS_G4X (1 << 6) 2541 #define DP_AUX_CHANNEL_C_INT_STATUS_G4X (1 << 5) 2542 #define DP_AUX_CHANNEL_B_INT_STATUS_G4X (1 << 4) 2543 #define DP_AUX_CHANNEL_MASK_INT_STATUS_G4X (7 << 4) 2544 2545 /* SDVO is different across gen3/4 */ 2546 #define SDVOC_HOTPLUG_INT_STATUS_G4X (1 << 3) 2547 #define SDVOB_HOTPLUG_INT_STATUS_G4X (1 << 2) 2548 /* 2549 * Bspec seems to be seriously misleaded about the SDVO hpd bits on i965g/gm, 2550 * since reality corrobates that they're the same as on gen3. But keep these 2551 * bits here (and the comment!) to help any other lost wanderers back onto the 2552 * right tracks. 2553 */ 2554 #define SDVOC_HOTPLUG_INT_STATUS_I965 (3 << 4) 2555 #define SDVOB_HOTPLUG_INT_STATUS_I965 (3 << 2) 2556 #define SDVOC_HOTPLUG_INT_STATUS_I915 (1 << 7) 2557 #define SDVOB_HOTPLUG_INT_STATUS_I915 (1 << 6) 2558 #define HOTPLUG_INT_STATUS_G4X (CRT_HOTPLUG_INT_STATUS | \ 2559 SDVOB_HOTPLUG_INT_STATUS_G4X | \ 2560 SDVOC_HOTPLUG_INT_STATUS_G4X | \ 2561 PORTB_HOTPLUG_INT_STATUS | \ 2562 PORTC_HOTPLUG_INT_STATUS | \ 2563 PORTD_HOTPLUG_INT_STATUS) 2564 2565 #define HOTPLUG_INT_STATUS_I915 (CRT_HOTPLUG_INT_STATUS | \ 2566 SDVOB_HOTPLUG_INT_STATUS_I915 | \ 2567 SDVOC_HOTPLUG_INT_STATUS_I915 | \ 2568 PORTB_HOTPLUG_INT_STATUS | \ 2569 PORTC_HOTPLUG_INT_STATUS | \ 2570 PORTD_HOTPLUG_INT_STATUS) 2571 2572 /* SDVO and HDMI port control. 2573 * The same register may be used for SDVO or HDMI */ 2574 #define _GEN3_SDVOB 0x61140 2575 #define _GEN3_SDVOC 0x61160 2576 #define GEN3_SDVOB _MMIO(_GEN3_SDVOB) 2577 #define GEN3_SDVOC _MMIO(_GEN3_SDVOC) 2578 #define GEN4_HDMIB GEN3_SDVOB 2579 #define GEN4_HDMIC GEN3_SDVOC 2580 #define VLV_HDMIB _MMIO(VLV_DISPLAY_BASE + 0x61140) 2581 #define VLV_HDMIC _MMIO(VLV_DISPLAY_BASE + 0x61160) 2582 #define CHV_HDMID _MMIO(VLV_DISPLAY_BASE + 0x6116C) 2583 #define PCH_SDVOB _MMIO(0xe1140) 2584 #define PCH_HDMIB PCH_SDVOB 2585 #define PCH_HDMIC _MMIO(0xe1150) 2586 #define PCH_HDMID _MMIO(0xe1160) 2587 2588 #define PORT_DFT_I9XX _MMIO(0x61150) 2589 #define DC_BALANCE_RESET (1 << 25) 2590 #define PORT_DFT2_G4X _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61154) 2591 #define DC_BALANCE_RESET_VLV (1 << 31) 2592 #define PIPE_SCRAMBLE_RESET_MASK ((1 << 14) | (0x3 << 0)) 2593 #define PIPE_C_SCRAMBLE_RESET REG_BIT(14) /* chv */ 2594 #define PIPE_B_SCRAMBLE_RESET REG_BIT(1) 2595 #define PIPE_A_SCRAMBLE_RESET REG_BIT(0) 2596 2597 /* Gen 3 SDVO bits: */ 2598 #define SDVO_ENABLE (1 << 31) 2599 #define SDVO_PIPE_SEL_SHIFT 30 2600 #define SDVO_PIPE_SEL_MASK (1 << 30) 2601 #define SDVO_PIPE_SEL(pipe) ((pipe) << 30) 2602 #define SDVO_STALL_SELECT (1 << 29) 2603 #define SDVO_INTERRUPT_ENABLE (1 << 26) 2604 /* 2605 * 915G/GM SDVO pixel multiplier. 2606 * Programmed value is multiplier - 1, up to 5x. 2607 * \sa DPLL_MD_UDI_MULTIPLIER_MASK 2608 */ 2609 #define SDVO_PORT_MULTIPLY_MASK (7 << 23) 2610 #define SDVO_PORT_MULTIPLY_SHIFT 23 2611 #define SDVO_PHASE_SELECT_MASK (15 << 19) 2612 #define SDVO_PHASE_SELECT_DEFAULT (6 << 19) 2613 #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18) 2614 #define SDVOC_GANG_MODE (1 << 16) /* Port C only */ 2615 #define SDVO_BORDER_ENABLE (1 << 7) /* SDVO only */ 2616 #define SDVOB_PCIE_CONCURRENCY (1 << 3) /* Port B only */ 2617 #define SDVO_DETECTED (1 << 2) 2618 /* Bits to be preserved when writing */ 2619 #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | \ 2620 SDVO_INTERRUPT_ENABLE) 2621 #define SDVOC_PRESERVE_MASK ((1 << 17) | SDVO_INTERRUPT_ENABLE) 2622 2623 /* Gen 4 SDVO/HDMI bits: */ 2624 #define SDVO_COLOR_FORMAT_8bpc (0 << 26) 2625 #define SDVO_COLOR_FORMAT_MASK (7 << 26) 2626 #define SDVO_ENCODING_SDVO (0 << 10) 2627 #define SDVO_ENCODING_HDMI (2 << 10) 2628 #define HDMI_MODE_SELECT_HDMI (1 << 9) /* HDMI only */ 2629 #define HDMI_MODE_SELECT_DVI (0 << 9) /* HDMI only */ 2630 #define HDMI_COLOR_RANGE_16_235 (1 << 8) /* HDMI only */ 2631 #define HDMI_AUDIO_ENABLE (1 << 6) /* HDMI only */ 2632 /* VSYNC/HSYNC bits new with 965, default is to be set */ 2633 #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4) 2634 #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3) 2635 2636 /* Gen 5 (IBX) SDVO/HDMI bits: */ 2637 #define HDMI_COLOR_FORMAT_12bpc (3 << 26) /* HDMI only */ 2638 #define SDVOB_HOTPLUG_ENABLE (1 << 23) /* SDVO only */ 2639 2640 /* Gen 6 (CPT) SDVO/HDMI bits: */ 2641 #define SDVO_PIPE_SEL_SHIFT_CPT 29 2642 #define SDVO_PIPE_SEL_MASK_CPT (3 << 29) 2643 #define SDVO_PIPE_SEL_CPT(pipe) ((pipe) << 29) 2644 2645 /* CHV SDVO/HDMI bits: */ 2646 #define SDVO_PIPE_SEL_SHIFT_CHV 24 2647 #define SDVO_PIPE_SEL_MASK_CHV (3 << 24) 2648 #define SDVO_PIPE_SEL_CHV(pipe) ((pipe) << 24) 2649 2650 2651 /* DVO port control */ 2652 #define _DVOA 0x61120 2653 #define DVOA _MMIO(_DVOA) 2654 #define _DVOB 0x61140 2655 #define DVOB _MMIO(_DVOB) 2656 #define _DVOC 0x61160 2657 #define DVOC _MMIO(_DVOC) 2658 #define DVO_ENABLE (1 << 31) 2659 #define DVO_PIPE_SEL_SHIFT 30 2660 #define DVO_PIPE_SEL_MASK (1 << 30) 2661 #define DVO_PIPE_SEL(pipe) ((pipe) << 30) 2662 #define DVO_PIPE_STALL_UNUSED (0 << 28) 2663 #define DVO_PIPE_STALL (1 << 28) 2664 #define DVO_PIPE_STALL_TV (2 << 28) 2665 #define DVO_PIPE_STALL_MASK (3 << 28) 2666 #define DVO_USE_VGA_SYNC (1 << 15) 2667 #define DVO_DATA_ORDER_I740 (0 << 14) 2668 #define DVO_DATA_ORDER_FP (1 << 14) 2669 #define DVO_VSYNC_DISABLE (1 << 11) 2670 #define DVO_HSYNC_DISABLE (1 << 10) 2671 #define DVO_VSYNC_TRISTATE (1 << 9) 2672 #define DVO_HSYNC_TRISTATE (1 << 8) 2673 #define DVO_BORDER_ENABLE (1 << 7) 2674 #define DVO_DATA_ORDER_GBRG (1 << 6) 2675 #define DVO_DATA_ORDER_RGGB (0 << 6) 2676 #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6) 2677 #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6) 2678 #define DVO_VSYNC_ACTIVE_HIGH (1 << 4) 2679 #define DVO_HSYNC_ACTIVE_HIGH (1 << 3) 2680 #define DVO_BLANK_ACTIVE_HIGH (1 << 2) 2681 #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */ 2682 #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */ 2683 #define DVO_PRESERVE_MASK (0x7 << 24) 2684 #define DVOA_SRCDIM _MMIO(0x61124) 2685 #define DVOB_SRCDIM _MMIO(0x61144) 2686 #define DVOC_SRCDIM _MMIO(0x61164) 2687 #define DVO_SRCDIM_HORIZONTAL_SHIFT 12 2688 #define DVO_SRCDIM_VERTICAL_SHIFT 0 2689 2690 /* LVDS port control */ 2691 #define LVDS _MMIO(0x61180) 2692 /* 2693 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as 2694 * the DPLL semantics change when the LVDS is assigned to that pipe. 2695 */ 2696 #define LVDS_PORT_EN (1 << 31) 2697 /* Selects pipe B for LVDS data. Must be set on pre-965. */ 2698 #define LVDS_PIPE_SEL_SHIFT 30 2699 #define LVDS_PIPE_SEL_MASK (1 << 30) 2700 #define LVDS_PIPE_SEL(pipe) ((pipe) << 30) 2701 #define LVDS_PIPE_SEL_SHIFT_CPT 29 2702 #define LVDS_PIPE_SEL_MASK_CPT (3 << 29) 2703 #define LVDS_PIPE_SEL_CPT(pipe) ((pipe) << 29) 2704 /* LVDS dithering flag on 965/g4x platform */ 2705 #define LVDS_ENABLE_DITHER (1 << 25) 2706 /* LVDS sync polarity flags. Set to invert (i.e. negative) */ 2707 #define LVDS_VSYNC_POLARITY (1 << 21) 2708 #define LVDS_HSYNC_POLARITY (1 << 20) 2709 2710 /* Enable border for unscaled (or aspect-scaled) display */ 2711 #define LVDS_BORDER_ENABLE (1 << 15) 2712 /* 2713 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per 2714 * pixel. 2715 */ 2716 #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8) 2717 #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8) 2718 #define LVDS_A0A2_CLKA_POWER_UP (3 << 8) 2719 /* 2720 * Controls the A3 data pair, which contains the additional LSBs for 24 bit 2721 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be 2722 * on. 2723 */ 2724 #define LVDS_A3_POWER_MASK (3 << 6) 2725 #define LVDS_A3_POWER_DOWN (0 << 6) 2726 #define LVDS_A3_POWER_UP (3 << 6) 2727 /* 2728 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP 2729 * is set. 2730 */ 2731 #define LVDS_CLKB_POWER_MASK (3 << 4) 2732 #define LVDS_CLKB_POWER_DOWN (0 << 4) 2733 #define LVDS_CLKB_POWER_UP (3 << 4) 2734 /* 2735 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2 2736 * setting for whether we are in dual-channel mode. The B3 pair will 2737 * additionally only be powered up when LVDS_A3_POWER_UP is set. 2738 */ 2739 #define LVDS_B0B3_POWER_MASK (3 << 2) 2740 #define LVDS_B0B3_POWER_DOWN (0 << 2) 2741 #define LVDS_B0B3_POWER_UP (3 << 2) 2742 2743 /* Video Data Island Packet control */ 2744 #define VIDEO_DIP_DATA _MMIO(0x61178) 2745 /* Read the description of VIDEO_DIP_DATA (before Haswell) or VIDEO_DIP_ECC 2746 * (Haswell and newer) to see which VIDEO_DIP_DATA byte corresponds to each byte 2747 * of the infoframe structure specified by CEA-861. */ 2748 #define VIDEO_DIP_DATA_SIZE 32 2749 #define VIDEO_DIP_GMP_DATA_SIZE 36 2750 #define VIDEO_DIP_VSC_DATA_SIZE 36 2751 #define VIDEO_DIP_PPS_DATA_SIZE 132 2752 #define VIDEO_DIP_CTL _MMIO(0x61170) 2753 /* Pre HSW: */ 2754 #define VIDEO_DIP_ENABLE (1 << 31) 2755 #define VIDEO_DIP_PORT(port) ((port) << 29) 2756 #define VIDEO_DIP_PORT_MASK (3 << 29) 2757 #define VIDEO_DIP_ENABLE_GCP (1 << 25) /* ilk+ */ 2758 #define VIDEO_DIP_ENABLE_AVI (1 << 21) 2759 #define VIDEO_DIP_ENABLE_VENDOR (2 << 21) 2760 #define VIDEO_DIP_ENABLE_GAMUT (4 << 21) /* ilk+ */ 2761 #define VIDEO_DIP_ENABLE_SPD (8 << 21) 2762 #define VIDEO_DIP_SELECT_AVI (0 << 19) 2763 #define VIDEO_DIP_SELECT_VENDOR (1 << 19) 2764 #define VIDEO_DIP_SELECT_GAMUT (2 << 19) 2765 #define VIDEO_DIP_SELECT_SPD (3 << 19) 2766 #define VIDEO_DIP_SELECT_MASK (3 << 19) 2767 #define VIDEO_DIP_FREQ_ONCE (0 << 16) 2768 #define VIDEO_DIP_FREQ_VSYNC (1 << 16) 2769 #define VIDEO_DIP_FREQ_2VSYNC (2 << 16) 2770 #define VIDEO_DIP_FREQ_MASK (3 << 16) 2771 /* HSW and later: */ 2772 #define VIDEO_DIP_ENABLE_DRM_GLK (1 << 28) 2773 #define PSR_VSC_BIT_7_SET (1 << 27) 2774 #define VSC_SELECT_MASK (0x3 << 25) 2775 #define VSC_SELECT_SHIFT 25 2776 #define VSC_DIP_HW_HEA_DATA (0 << 25) 2777 #define VSC_DIP_HW_HEA_SW_DATA (1 << 25) 2778 #define VSC_DIP_HW_DATA_SW_HEA (2 << 25) 2779 #define VSC_DIP_SW_HEA_DATA (3 << 25) 2780 #define VDIP_ENABLE_PPS (1 << 24) 2781 #define VIDEO_DIP_ENABLE_VSC_HSW (1 << 20) 2782 #define VIDEO_DIP_ENABLE_GCP_HSW (1 << 16) 2783 #define VIDEO_DIP_ENABLE_AVI_HSW (1 << 12) 2784 #define VIDEO_DIP_ENABLE_VS_HSW (1 << 8) 2785 #define VIDEO_DIP_ENABLE_GMP_HSW (1 << 4) 2786 #define VIDEO_DIP_ENABLE_SPD_HSW (1 << 0) 2787 2788 /* Panel power sequencing */ 2789 #define PPS_BASE 0x61200 2790 #define VLV_PPS_BASE (VLV_DISPLAY_BASE + PPS_BASE) 2791 #define PCH_PPS_BASE 0xC7200 2792 2793 #define _MMIO_PPS(pps_idx, reg) _MMIO(dev_priv->display.pps.mmio_base - \ 2794 PPS_BASE + (reg) + \ 2795 (pps_idx) * 0x100) 2796 2797 #define _PP_STATUS 0x61200 2798 #define PP_STATUS(pps_idx) _MMIO_PPS(pps_idx, _PP_STATUS) 2799 #define PP_ON REG_BIT(31) 2800 /* 2801 * Indicates that all dependencies of the panel are on: 2802 * 2803 * - PLL enabled 2804 * - pipe enabled 2805 * - LVDS/DVOB/DVOC on 2806 */ 2807 #define PP_READY REG_BIT(30) 2808 #define PP_SEQUENCE_MASK REG_GENMASK(29, 28) 2809 #define PP_SEQUENCE_NONE REG_FIELD_PREP(PP_SEQUENCE_MASK, 0) 2810 #define PP_SEQUENCE_POWER_UP REG_FIELD_PREP(PP_SEQUENCE_MASK, 1) 2811 #define PP_SEQUENCE_POWER_DOWN REG_FIELD_PREP(PP_SEQUENCE_MASK, 2) 2812 #define PP_CYCLE_DELAY_ACTIVE REG_BIT(27) 2813 #define PP_SEQUENCE_STATE_MASK REG_GENMASK(3, 0) 2814 #define PP_SEQUENCE_STATE_OFF_IDLE REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x0) 2815 #define PP_SEQUENCE_STATE_OFF_S0_1 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x1) 2816 #define PP_SEQUENCE_STATE_OFF_S0_2 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x2) 2817 #define PP_SEQUENCE_STATE_OFF_S0_3 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x3) 2818 #define PP_SEQUENCE_STATE_ON_IDLE REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x8) 2819 #define PP_SEQUENCE_STATE_ON_S1_1 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0x9) 2820 #define PP_SEQUENCE_STATE_ON_S1_2 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0xa) 2821 #define PP_SEQUENCE_STATE_ON_S1_3 REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0xb) 2822 #define PP_SEQUENCE_STATE_RESET REG_FIELD_PREP(PP_SEQUENCE_STATE_MASK, 0xf) 2823 2824 #define _PP_CONTROL 0x61204 2825 #define PP_CONTROL(pps_idx) _MMIO_PPS(pps_idx, _PP_CONTROL) 2826 #define PANEL_UNLOCK_MASK REG_GENMASK(31, 16) 2827 #define PANEL_UNLOCK_REGS REG_FIELD_PREP(PANEL_UNLOCK_MASK, 0xabcd) 2828 #define BXT_POWER_CYCLE_DELAY_MASK REG_GENMASK(8, 4) 2829 #define EDP_FORCE_VDD REG_BIT(3) 2830 #define EDP_BLC_ENABLE REG_BIT(2) 2831 #define PANEL_POWER_RESET REG_BIT(1) 2832 #define PANEL_POWER_ON REG_BIT(0) 2833 2834 #define _PP_ON_DELAYS 0x61208 2835 #define PP_ON_DELAYS(pps_idx) _MMIO_PPS(pps_idx, _PP_ON_DELAYS) 2836 #define PANEL_PORT_SELECT_MASK REG_GENMASK(31, 30) 2837 #define PANEL_PORT_SELECT_LVDS REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 0) 2838 #define PANEL_PORT_SELECT_DPA REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 1) 2839 #define PANEL_PORT_SELECT_DPC REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 2) 2840 #define PANEL_PORT_SELECT_DPD REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, 3) 2841 #define PANEL_PORT_SELECT_VLV(port) REG_FIELD_PREP(PANEL_PORT_SELECT_MASK, port) 2842 #define PANEL_POWER_UP_DELAY_MASK REG_GENMASK(28, 16) 2843 #define PANEL_LIGHT_ON_DELAY_MASK REG_GENMASK(12, 0) 2844 2845 #define _PP_OFF_DELAYS 0x6120C 2846 #define PP_OFF_DELAYS(pps_idx) _MMIO_PPS(pps_idx, _PP_OFF_DELAYS) 2847 #define PANEL_POWER_DOWN_DELAY_MASK REG_GENMASK(28, 16) 2848 #define PANEL_LIGHT_OFF_DELAY_MASK REG_GENMASK(12, 0) 2849 2850 #define _PP_DIVISOR 0x61210 2851 #define PP_DIVISOR(pps_idx) _MMIO_PPS(pps_idx, _PP_DIVISOR) 2852 #define PP_REFERENCE_DIVIDER_MASK REG_GENMASK(31, 8) 2853 #define PANEL_POWER_CYCLE_DELAY_MASK REG_GENMASK(4, 0) 2854 2855 /* Panel fitting */ 2856 #define PFIT_CONTROL _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61230) 2857 #define PFIT_ENABLE (1 << 31) 2858 #define PFIT_PIPE_MASK (3 << 29) 2859 #define PFIT_PIPE_SHIFT 29 2860 #define PFIT_PIPE(pipe) ((pipe) << 29) 2861 #define VERT_INTERP_DISABLE (0 << 10) 2862 #define VERT_INTERP_BILINEAR (1 << 10) 2863 #define VERT_INTERP_MASK (3 << 10) 2864 #define VERT_AUTO_SCALE (1 << 9) 2865 #define HORIZ_INTERP_DISABLE (0 << 6) 2866 #define HORIZ_INTERP_BILINEAR (1 << 6) 2867 #define HORIZ_INTERP_MASK (3 << 6) 2868 #define HORIZ_AUTO_SCALE (1 << 5) 2869 #define PANEL_8TO6_DITHER_ENABLE (1 << 3) 2870 #define PFIT_FILTER_FUZZY (0 << 24) 2871 #define PFIT_SCALING_AUTO (0 << 26) 2872 #define PFIT_SCALING_PROGRAMMED (1 << 26) 2873 #define PFIT_SCALING_PILLAR (2 << 26) 2874 #define PFIT_SCALING_LETTER (3 << 26) 2875 #define PFIT_PGM_RATIOS _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61234) 2876 /* Pre-965 */ 2877 #define PFIT_VERT_SCALE_SHIFT 20 2878 #define PFIT_VERT_SCALE_MASK 0xfff00000 2879 #define PFIT_HORIZ_SCALE_SHIFT 4 2880 #define PFIT_HORIZ_SCALE_MASK 0x0000fff0 2881 /* 965+ */ 2882 #define PFIT_VERT_SCALE_SHIFT_965 16 2883 #define PFIT_VERT_SCALE_MASK_965 0x1fff0000 2884 #define PFIT_HORIZ_SCALE_SHIFT_965 0 2885 #define PFIT_HORIZ_SCALE_MASK_965 0x00001fff 2886 2887 #define PFIT_AUTO_RATIOS _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61238) 2888 2889 #define PCH_GTC_CTL _MMIO(0xe7000) 2890 #define PCH_GTC_ENABLE (1 << 31) 2891 2892 /* TV port control */ 2893 #define TV_CTL _MMIO(0x68000) 2894 /* Enables the TV encoder */ 2895 # define TV_ENC_ENABLE (1 << 31) 2896 /* Sources the TV encoder input from pipe B instead of A. */ 2897 # define TV_ENC_PIPE_SEL_SHIFT 30 2898 # define TV_ENC_PIPE_SEL_MASK (1 << 30) 2899 # define TV_ENC_PIPE_SEL(pipe) ((pipe) << 30) 2900 /* Outputs composite video (DAC A only) */ 2901 # define TV_ENC_OUTPUT_COMPOSITE (0 << 28) 2902 /* Outputs SVideo video (DAC B/C) */ 2903 # define TV_ENC_OUTPUT_SVIDEO (1 << 28) 2904 /* Outputs Component video (DAC A/B/C) */ 2905 # define TV_ENC_OUTPUT_COMPONENT (2 << 28) 2906 /* Outputs Composite and SVideo (DAC A/B/C) */ 2907 # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28) 2908 # define TV_TRILEVEL_SYNC (1 << 21) 2909 /* Enables slow sync generation (945GM only) */ 2910 # define TV_SLOW_SYNC (1 << 20) 2911 /* Selects 4x oversampling for 480i and 576p */ 2912 # define TV_OVERSAMPLE_4X (0 << 18) 2913 /* Selects 2x oversampling for 720p and 1080i */ 2914 # define TV_OVERSAMPLE_2X (1 << 18) 2915 /* Selects no oversampling for 1080p */ 2916 # define TV_OVERSAMPLE_NONE (2 << 18) 2917 /* Selects 8x oversampling */ 2918 # define TV_OVERSAMPLE_8X (3 << 18) 2919 # define TV_OVERSAMPLE_MASK (3 << 18) 2920 /* Selects progressive mode rather than interlaced */ 2921 # define TV_PROGRESSIVE (1 << 17) 2922 /* Sets the colorburst to PAL mode. Required for non-M PAL modes. */ 2923 # define TV_PAL_BURST (1 << 16) 2924 /* Field for setting delay of Y compared to C */ 2925 # define TV_YC_SKEW_MASK (7 << 12) 2926 /* Enables a fix for 480p/576p standard definition modes on the 915GM only */ 2927 # define TV_ENC_SDP_FIX (1 << 11) 2928 /* 2929 * Enables a fix for the 915GM only. 2930 * 2931 * Not sure what it does. 2932 */ 2933 # define TV_ENC_C0_FIX (1 << 10) 2934 /* Bits that must be preserved by software */ 2935 # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf) 2936 # define TV_FUSE_STATE_MASK (3 << 4) 2937 /* Read-only state that reports all features enabled */ 2938 # define TV_FUSE_STATE_ENABLED (0 << 4) 2939 /* Read-only state that reports that Macrovision is disabled in hardware*/ 2940 # define TV_FUSE_STATE_NO_MACROVISION (1 << 4) 2941 /* Read-only state that reports that TV-out is disabled in hardware. */ 2942 # define TV_FUSE_STATE_DISABLED (2 << 4) 2943 /* Normal operation */ 2944 # define TV_TEST_MODE_NORMAL (0 << 0) 2945 /* Encoder test pattern 1 - combo pattern */ 2946 # define TV_TEST_MODE_PATTERN_1 (1 << 0) 2947 /* Encoder test pattern 2 - full screen vertical 75% color bars */ 2948 # define TV_TEST_MODE_PATTERN_2 (2 << 0) 2949 /* Encoder test pattern 3 - full screen horizontal 75% color bars */ 2950 # define TV_TEST_MODE_PATTERN_3 (3 << 0) 2951 /* Encoder test pattern 4 - random noise */ 2952 # define TV_TEST_MODE_PATTERN_4 (4 << 0) 2953 /* Encoder test pattern 5 - linear color ramps */ 2954 # define TV_TEST_MODE_PATTERN_5 (5 << 0) 2955 /* 2956 * This test mode forces the DACs to 50% of full output. 2957 * 2958 * This is used for load detection in combination with TVDAC_SENSE_MASK 2959 */ 2960 # define TV_TEST_MODE_MONITOR_DETECT (7 << 0) 2961 # define TV_TEST_MODE_MASK (7 << 0) 2962 2963 #define TV_DAC _MMIO(0x68004) 2964 # define TV_DAC_SAVE 0x00ffff00 2965 /* 2966 * Reports that DAC state change logic has reported change (RO). 2967 * 2968 * This gets cleared when TV_DAC_STATE_EN is cleared 2969 */ 2970 # define TVDAC_STATE_CHG (1 << 31) 2971 # define TVDAC_SENSE_MASK (7 << 28) 2972 /* Reports that DAC A voltage is above the detect threshold */ 2973 # define TVDAC_A_SENSE (1 << 30) 2974 /* Reports that DAC B voltage is above the detect threshold */ 2975 # define TVDAC_B_SENSE (1 << 29) 2976 /* Reports that DAC C voltage is above the detect threshold */ 2977 # define TVDAC_C_SENSE (1 << 28) 2978 /* 2979 * Enables DAC state detection logic, for load-based TV detection. 2980 * 2981 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set 2982 * to off, for load detection to work. 2983 */ 2984 # define TVDAC_STATE_CHG_EN (1 << 27) 2985 /* Sets the DAC A sense value to high */ 2986 # define TVDAC_A_SENSE_CTL (1 << 26) 2987 /* Sets the DAC B sense value to high */ 2988 # define TVDAC_B_SENSE_CTL (1 << 25) 2989 /* Sets the DAC C sense value to high */ 2990 # define TVDAC_C_SENSE_CTL (1 << 24) 2991 /* Overrides the ENC_ENABLE and DAC voltage levels */ 2992 # define DAC_CTL_OVERRIDE (1 << 7) 2993 /* Sets the slew rate. Must be preserved in software */ 2994 # define ENC_TVDAC_SLEW_FAST (1 << 6) 2995 # define DAC_A_1_3_V (0 << 4) 2996 # define DAC_A_1_1_V (1 << 4) 2997 # define DAC_A_0_7_V (2 << 4) 2998 # define DAC_A_MASK (3 << 4) 2999 # define DAC_B_1_3_V (0 << 2) 3000 # define DAC_B_1_1_V (1 << 2) 3001 # define DAC_B_0_7_V (2 << 2) 3002 # define DAC_B_MASK (3 << 2) 3003 # define DAC_C_1_3_V (0 << 0) 3004 # define DAC_C_1_1_V (1 << 0) 3005 # define DAC_C_0_7_V (2 << 0) 3006 # define DAC_C_MASK (3 << 0) 3007 3008 /* 3009 * CSC coefficients are stored in a floating point format with 9 bits of 3010 * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n, 3011 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with 3012 * -1 (0x3) being the only legal negative value. 3013 */ 3014 #define TV_CSC_Y _MMIO(0x68010) 3015 # define TV_RY_MASK 0x07ff0000 3016 # define TV_RY_SHIFT 16 3017 # define TV_GY_MASK 0x00000fff 3018 # define TV_GY_SHIFT 0 3019 3020 #define TV_CSC_Y2 _MMIO(0x68014) 3021 # define TV_BY_MASK 0x07ff0000 3022 # define TV_BY_SHIFT 16 3023 /* 3024 * Y attenuation for component video. 3025 * 3026 * Stored in 1.9 fixed point. 3027 */ 3028 # define TV_AY_MASK 0x000003ff 3029 # define TV_AY_SHIFT 0 3030 3031 #define TV_CSC_U _MMIO(0x68018) 3032 # define TV_RU_MASK 0x07ff0000 3033 # define TV_RU_SHIFT 16 3034 # define TV_GU_MASK 0x000007ff 3035 # define TV_GU_SHIFT 0 3036 3037 #define TV_CSC_U2 _MMIO(0x6801c) 3038 # define TV_BU_MASK 0x07ff0000 3039 # define TV_BU_SHIFT 16 3040 /* 3041 * U attenuation for component video. 3042 * 3043 * Stored in 1.9 fixed point. 3044 */ 3045 # define TV_AU_MASK 0x000003ff 3046 # define TV_AU_SHIFT 0 3047 3048 #define TV_CSC_V _MMIO(0x68020) 3049 # define TV_RV_MASK 0x0fff0000 3050 # define TV_RV_SHIFT 16 3051 # define TV_GV_MASK 0x000007ff 3052 # define TV_GV_SHIFT 0 3053 3054 #define TV_CSC_V2 _MMIO(0x68024) 3055 # define TV_BV_MASK 0x07ff0000 3056 # define TV_BV_SHIFT 16 3057 /* 3058 * V attenuation for component video. 3059 * 3060 * Stored in 1.9 fixed point. 3061 */ 3062 # define TV_AV_MASK 0x000007ff 3063 # define TV_AV_SHIFT 0 3064 3065 #define TV_CLR_KNOBS _MMIO(0x68028) 3066 /* 2s-complement brightness adjustment */ 3067 # define TV_BRIGHTNESS_MASK 0xff000000 3068 # define TV_BRIGHTNESS_SHIFT 24 3069 /* Contrast adjustment, as a 2.6 unsigned floating point number */ 3070 # define TV_CONTRAST_MASK 0x00ff0000 3071 # define TV_CONTRAST_SHIFT 16 3072 /* Saturation adjustment, as a 2.6 unsigned floating point number */ 3073 # define TV_SATURATION_MASK 0x0000ff00 3074 # define TV_SATURATION_SHIFT 8 3075 /* Hue adjustment, as an integer phase angle in degrees */ 3076 # define TV_HUE_MASK 0x000000ff 3077 # define TV_HUE_SHIFT 0 3078 3079 #define TV_CLR_LEVEL _MMIO(0x6802c) 3080 /* Controls the DAC level for black */ 3081 # define TV_BLACK_LEVEL_MASK 0x01ff0000 3082 # define TV_BLACK_LEVEL_SHIFT 16 3083 /* Controls the DAC level for blanking */ 3084 # define TV_BLANK_LEVEL_MASK 0x000001ff 3085 # define TV_BLANK_LEVEL_SHIFT 0 3086 3087 #define TV_H_CTL_1 _MMIO(0x68030) 3088 /* Number of pixels in the hsync. */ 3089 # define TV_HSYNC_END_MASK 0x1fff0000 3090 # define TV_HSYNC_END_SHIFT 16 3091 /* Total number of pixels minus one in the line (display and blanking). */ 3092 # define TV_HTOTAL_MASK 0x00001fff 3093 # define TV_HTOTAL_SHIFT 0 3094 3095 #define TV_H_CTL_2 _MMIO(0x68034) 3096 /* Enables the colorburst (needed for non-component color) */ 3097 # define TV_BURST_ENA (1 << 31) 3098 /* Offset of the colorburst from the start of hsync, in pixels minus one. */ 3099 # define TV_HBURST_START_SHIFT 16 3100 # define TV_HBURST_START_MASK 0x1fff0000 3101 /* Length of the colorburst */ 3102 # define TV_HBURST_LEN_SHIFT 0 3103 # define TV_HBURST_LEN_MASK 0x0001fff 3104 3105 #define TV_H_CTL_3 _MMIO(0x68038) 3106 /* End of hblank, measured in pixels minus one from start of hsync */ 3107 # define TV_HBLANK_END_SHIFT 16 3108 # define TV_HBLANK_END_MASK 0x1fff0000 3109 /* Start of hblank, measured in pixels minus one from start of hsync */ 3110 # define TV_HBLANK_START_SHIFT 0 3111 # define TV_HBLANK_START_MASK 0x0001fff 3112 3113 #define TV_V_CTL_1 _MMIO(0x6803c) 3114 /* XXX */ 3115 # define TV_NBR_END_SHIFT 16 3116 # define TV_NBR_END_MASK 0x07ff0000 3117 /* XXX */ 3118 # define TV_VI_END_F1_SHIFT 8 3119 # define TV_VI_END_F1_MASK 0x00003f00 3120 /* XXX */ 3121 # define TV_VI_END_F2_SHIFT 0 3122 # define TV_VI_END_F2_MASK 0x0000003f 3123 3124 #define TV_V_CTL_2 _MMIO(0x68040) 3125 /* Length of vsync, in half lines */ 3126 # define TV_VSYNC_LEN_MASK 0x07ff0000 3127 # define TV_VSYNC_LEN_SHIFT 16 3128 /* Offset of the start of vsync in field 1, measured in one less than the 3129 * number of half lines. 3130 */ 3131 # define TV_VSYNC_START_F1_MASK 0x00007f00 3132 # define TV_VSYNC_START_F1_SHIFT 8 3133 /* 3134 * Offset of the start of vsync in field 2, measured in one less than the 3135 * number of half lines. 3136 */ 3137 # define TV_VSYNC_START_F2_MASK 0x0000007f 3138 # define TV_VSYNC_START_F2_SHIFT 0 3139 3140 #define TV_V_CTL_3 _MMIO(0x68044) 3141 /* Enables generation of the equalization signal */ 3142 # define TV_EQUAL_ENA (1 << 31) 3143 /* Length of vsync, in half lines */ 3144 # define TV_VEQ_LEN_MASK 0x007f0000 3145 # define TV_VEQ_LEN_SHIFT 16 3146 /* Offset of the start of equalization in field 1, measured in one less than 3147 * the number of half lines. 3148 */ 3149 # define TV_VEQ_START_F1_MASK 0x0007f00 3150 # define TV_VEQ_START_F1_SHIFT 8 3151 /* 3152 * Offset of the start of equalization in field 2, measured in one less than 3153 * the number of half lines. 3154 */ 3155 # define TV_VEQ_START_F2_MASK 0x000007f 3156 # define TV_VEQ_START_F2_SHIFT 0 3157 3158 #define TV_V_CTL_4 _MMIO(0x68048) 3159 /* 3160 * Offset to start of vertical colorburst, measured in one less than the 3161 * number of lines from vertical start. 3162 */ 3163 # define TV_VBURST_START_F1_MASK 0x003f0000 3164 # define TV_VBURST_START_F1_SHIFT 16 3165 /* 3166 * Offset to the end of vertical colorburst, measured in one less than the 3167 * number of lines from the start of NBR. 3168 */ 3169 # define TV_VBURST_END_F1_MASK 0x000000ff 3170 # define TV_VBURST_END_F1_SHIFT 0 3171 3172 #define TV_V_CTL_5 _MMIO(0x6804c) 3173 /* 3174 * Offset to start of vertical colorburst, measured in one less than the 3175 * number of lines from vertical start. 3176 */ 3177 # define TV_VBURST_START_F2_MASK 0x003f0000 3178 # define TV_VBURST_START_F2_SHIFT 16 3179 /* 3180 * Offset to the end of vertical colorburst, measured in one less than the 3181 * number of lines from the start of NBR. 3182 */ 3183 # define TV_VBURST_END_F2_MASK 0x000000ff 3184 # define TV_VBURST_END_F2_SHIFT 0 3185 3186 #define TV_V_CTL_6 _MMIO(0x68050) 3187 /* 3188 * Offset to start of vertical colorburst, measured in one less than the 3189 * number of lines from vertical start. 3190 */ 3191 # define TV_VBURST_START_F3_MASK 0x003f0000 3192 # define TV_VBURST_START_F3_SHIFT 16 3193 /* 3194 * Offset to the end of vertical colorburst, measured in one less than the 3195 * number of lines from the start of NBR. 3196 */ 3197 # define TV_VBURST_END_F3_MASK 0x000000ff 3198 # define TV_VBURST_END_F3_SHIFT 0 3199 3200 #define TV_V_CTL_7 _MMIO(0x68054) 3201 /* 3202 * Offset to start of vertical colorburst, measured in one less than the 3203 * number of lines from vertical start. 3204 */ 3205 # define TV_VBURST_START_F4_MASK 0x003f0000 3206 # define TV_VBURST_START_F4_SHIFT 16 3207 /* 3208 * Offset to the end of vertical colorburst, measured in one less than the 3209 * number of lines from the start of NBR. 3210 */ 3211 # define TV_VBURST_END_F4_MASK 0x000000ff 3212 # define TV_VBURST_END_F4_SHIFT 0 3213 3214 #define TV_SC_CTL_1 _MMIO(0x68060) 3215 /* Turns on the first subcarrier phase generation DDA */ 3216 # define TV_SC_DDA1_EN (1 << 31) 3217 /* Turns on the first subcarrier phase generation DDA */ 3218 # define TV_SC_DDA2_EN (1 << 30) 3219 /* Turns on the first subcarrier phase generation DDA */ 3220 # define TV_SC_DDA3_EN (1 << 29) 3221 /* Sets the subcarrier DDA to reset frequency every other field */ 3222 # define TV_SC_RESET_EVERY_2 (0 << 24) 3223 /* Sets the subcarrier DDA to reset frequency every fourth field */ 3224 # define TV_SC_RESET_EVERY_4 (1 << 24) 3225 /* Sets the subcarrier DDA to reset frequency every eighth field */ 3226 # define TV_SC_RESET_EVERY_8 (2 << 24) 3227 /* Sets the subcarrier DDA to never reset the frequency */ 3228 # define TV_SC_RESET_NEVER (3 << 24) 3229 /* Sets the peak amplitude of the colorburst.*/ 3230 # define TV_BURST_LEVEL_MASK 0x00ff0000 3231 # define TV_BURST_LEVEL_SHIFT 16 3232 /* Sets the increment of the first subcarrier phase generation DDA */ 3233 # define TV_SCDDA1_INC_MASK 0x00000fff 3234 # define TV_SCDDA1_INC_SHIFT 0 3235 3236 #define TV_SC_CTL_2 _MMIO(0x68064) 3237 /* Sets the rollover for the second subcarrier phase generation DDA */ 3238 # define TV_SCDDA2_SIZE_MASK 0x7fff0000 3239 # define TV_SCDDA2_SIZE_SHIFT 16 3240 /* Sets the increent of the second subcarrier phase generation DDA */ 3241 # define TV_SCDDA2_INC_MASK 0x00007fff 3242 # define TV_SCDDA2_INC_SHIFT 0 3243 3244 #define TV_SC_CTL_3 _MMIO(0x68068) 3245 /* Sets the rollover for the third subcarrier phase generation DDA */ 3246 # define TV_SCDDA3_SIZE_MASK 0x7fff0000 3247 # define TV_SCDDA3_SIZE_SHIFT 16 3248 /* Sets the increent of the third subcarrier phase generation DDA */ 3249 # define TV_SCDDA3_INC_MASK 0x00007fff 3250 # define TV_SCDDA3_INC_SHIFT 0 3251 3252 #define TV_WIN_POS _MMIO(0x68070) 3253 /* X coordinate of the display from the start of horizontal active */ 3254 # define TV_XPOS_MASK 0x1fff0000 3255 # define TV_XPOS_SHIFT 16 3256 /* Y coordinate of the display from the start of vertical active (NBR) */ 3257 # define TV_YPOS_MASK 0x00000fff 3258 # define TV_YPOS_SHIFT 0 3259 3260 #define TV_WIN_SIZE _MMIO(0x68074) 3261 /* Horizontal size of the display window, measured in pixels*/ 3262 # define TV_XSIZE_MASK 0x1fff0000 3263 # define TV_XSIZE_SHIFT 16 3264 /* 3265 * Vertical size of the display window, measured in pixels. 3266 * 3267 * Must be even for interlaced modes. 3268 */ 3269 # define TV_YSIZE_MASK 0x00000fff 3270 # define TV_YSIZE_SHIFT 0 3271 3272 #define TV_FILTER_CTL_1 _MMIO(0x68080) 3273 /* 3274 * Enables automatic scaling calculation. 3275 * 3276 * If set, the rest of the registers are ignored, and the calculated values can 3277 * be read back from the register. 3278 */ 3279 # define TV_AUTO_SCALE (1 << 31) 3280 /* 3281 * Disables the vertical filter. 3282 * 3283 * This is required on modes more than 1024 pixels wide */ 3284 # define TV_V_FILTER_BYPASS (1 << 29) 3285 /* Enables adaptive vertical filtering */ 3286 # define TV_VADAPT (1 << 28) 3287 # define TV_VADAPT_MODE_MASK (3 << 26) 3288 /* Selects the least adaptive vertical filtering mode */ 3289 # define TV_VADAPT_MODE_LEAST (0 << 26) 3290 /* Selects the moderately adaptive vertical filtering mode */ 3291 # define TV_VADAPT_MODE_MODERATE (1 << 26) 3292 /* Selects the most adaptive vertical filtering mode */ 3293 # define TV_VADAPT_MODE_MOST (3 << 26) 3294 /* 3295 * Sets the horizontal scaling factor. 3296 * 3297 * This should be the fractional part of the horizontal scaling factor divided 3298 * by the oversampling rate. TV_HSCALE should be less than 1, and set to: 3299 * 3300 * (src width - 1) / ((oversample * dest width) - 1) 3301 */ 3302 # define TV_HSCALE_FRAC_MASK 0x00003fff 3303 # define TV_HSCALE_FRAC_SHIFT 0 3304 3305 #define TV_FILTER_CTL_2 _MMIO(0x68084) 3306 /* 3307 * Sets the integer part of the 3.15 fixed-point vertical scaling factor. 3308 * 3309 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1) 3310 */ 3311 # define TV_VSCALE_INT_MASK 0x00038000 3312 # define TV_VSCALE_INT_SHIFT 15 3313 /* 3314 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor. 3315 * 3316 * \sa TV_VSCALE_INT_MASK 3317 */ 3318 # define TV_VSCALE_FRAC_MASK 0x00007fff 3319 # define TV_VSCALE_FRAC_SHIFT 0 3320 3321 #define TV_FILTER_CTL_3 _MMIO(0x68088) 3322 /* 3323 * Sets the integer part of the 3.15 fixed-point vertical scaling factor. 3324 * 3325 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1)) 3326 * 3327 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes. 3328 */ 3329 # define TV_VSCALE_IP_INT_MASK 0x00038000 3330 # define TV_VSCALE_IP_INT_SHIFT 15 3331 /* 3332 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor. 3333 * 3334 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes. 3335 * 3336 * \sa TV_VSCALE_IP_INT_MASK 3337 */ 3338 # define TV_VSCALE_IP_FRAC_MASK 0x00007fff 3339 # define TV_VSCALE_IP_FRAC_SHIFT 0 3340 3341 #define TV_CC_CONTROL _MMIO(0x68090) 3342 # define TV_CC_ENABLE (1 << 31) 3343 /* 3344 * Specifies which field to send the CC data in. 3345 * 3346 * CC data is usually sent in field 0. 3347 */ 3348 # define TV_CC_FID_MASK (1 << 27) 3349 # define TV_CC_FID_SHIFT 27 3350 /* Sets the horizontal position of the CC data. Usually 135. */ 3351 # define TV_CC_HOFF_MASK 0x03ff0000 3352 # define TV_CC_HOFF_SHIFT 16 3353 /* Sets the vertical position of the CC data. Usually 21 */ 3354 # define TV_CC_LINE_MASK 0x0000003f 3355 # define TV_CC_LINE_SHIFT 0 3356 3357 #define TV_CC_DATA _MMIO(0x68094) 3358 # define TV_CC_RDY (1 << 31) 3359 /* Second word of CC data to be transmitted. */ 3360 # define TV_CC_DATA_2_MASK 0x007f0000 3361 # define TV_CC_DATA_2_SHIFT 16 3362 /* First word of CC data to be transmitted. */ 3363 # define TV_CC_DATA_1_MASK 0x0000007f 3364 # define TV_CC_DATA_1_SHIFT 0 3365 3366 #define TV_H_LUMA(i) _MMIO(0x68100 + (i) * 4) /* 60 registers */ 3367 #define TV_H_CHROMA(i) _MMIO(0x68200 + (i) * 4) /* 60 registers */ 3368 #define TV_V_LUMA(i) _MMIO(0x68300 + (i) * 4) /* 43 registers */ 3369 #define TV_V_CHROMA(i) _MMIO(0x68400 + (i) * 4) /* 43 registers */ 3370 3371 /* Display Port */ 3372 #define DP_A _MMIO(0x64000) /* eDP */ 3373 #define DP_B _MMIO(0x64100) 3374 #define DP_C _MMIO(0x64200) 3375 #define DP_D _MMIO(0x64300) 3376 3377 #define VLV_DP_B _MMIO(VLV_DISPLAY_BASE + 0x64100) 3378 #define VLV_DP_C _MMIO(VLV_DISPLAY_BASE + 0x64200) 3379 #define CHV_DP_D _MMIO(VLV_DISPLAY_BASE + 0x64300) 3380 3381 #define DP_PORT_EN (1 << 31) 3382 #define DP_PIPE_SEL_SHIFT 30 3383 #define DP_PIPE_SEL_MASK (1 << 30) 3384 #define DP_PIPE_SEL(pipe) ((pipe) << 30) 3385 #define DP_PIPE_SEL_SHIFT_IVB 29 3386 #define DP_PIPE_SEL_MASK_IVB (3 << 29) 3387 #define DP_PIPE_SEL_IVB(pipe) ((pipe) << 29) 3388 #define DP_PIPE_SEL_SHIFT_CHV 16 3389 #define DP_PIPE_SEL_MASK_CHV (3 << 16) 3390 #define DP_PIPE_SEL_CHV(pipe) ((pipe) << 16) 3391 3392 /* Link training mode - select a suitable mode for each stage */ 3393 #define DP_LINK_TRAIN_PAT_1 (0 << 28) 3394 #define DP_LINK_TRAIN_PAT_2 (1 << 28) 3395 #define DP_LINK_TRAIN_PAT_IDLE (2 << 28) 3396 #define DP_LINK_TRAIN_OFF (3 << 28) 3397 #define DP_LINK_TRAIN_MASK (3 << 28) 3398 #define DP_LINK_TRAIN_SHIFT 28 3399 3400 /* CPT Link training mode */ 3401 #define DP_LINK_TRAIN_PAT_1_CPT (0 << 8) 3402 #define DP_LINK_TRAIN_PAT_2_CPT (1 << 8) 3403 #define DP_LINK_TRAIN_PAT_IDLE_CPT (2 << 8) 3404 #define DP_LINK_TRAIN_OFF_CPT (3 << 8) 3405 #define DP_LINK_TRAIN_MASK_CPT (7 << 8) 3406 #define DP_LINK_TRAIN_SHIFT_CPT 8 3407 3408 /* Signal voltages. These are mostly controlled by the other end */ 3409 #define DP_VOLTAGE_0_4 (0 << 25) 3410 #define DP_VOLTAGE_0_6 (1 << 25) 3411 #define DP_VOLTAGE_0_8 (2 << 25) 3412 #define DP_VOLTAGE_1_2 (3 << 25) 3413 #define DP_VOLTAGE_MASK (7 << 25) 3414 #define DP_VOLTAGE_SHIFT 25 3415 3416 /* Signal pre-emphasis levels, like voltages, the other end tells us what 3417 * they want 3418 */ 3419 #define DP_PRE_EMPHASIS_0 (0 << 22) 3420 #define DP_PRE_EMPHASIS_3_5 (1 << 22) 3421 #define DP_PRE_EMPHASIS_6 (2 << 22) 3422 #define DP_PRE_EMPHASIS_9_5 (3 << 22) 3423 #define DP_PRE_EMPHASIS_MASK (7 << 22) 3424 #define DP_PRE_EMPHASIS_SHIFT 22 3425 3426 /* How many wires to use. I guess 3 was too hard */ 3427 #define DP_PORT_WIDTH(width) (((width) - 1) << 19) 3428 #define DP_PORT_WIDTH_MASK (7 << 19) 3429 #define DP_PORT_WIDTH_SHIFT 19 3430 3431 /* Mystic DPCD version 1.1 special mode */ 3432 #define DP_ENHANCED_FRAMING (1 << 18) 3433 3434 /* eDP */ 3435 #define DP_PLL_FREQ_270MHZ (0 << 16) 3436 #define DP_PLL_FREQ_162MHZ (1 << 16) 3437 #define DP_PLL_FREQ_MASK (3 << 16) 3438 3439 /* locked once port is enabled */ 3440 #define DP_PORT_REVERSAL (1 << 15) 3441 3442 /* eDP */ 3443 #define DP_PLL_ENABLE (1 << 14) 3444 3445 /* sends the clock on lane 15 of the PEG for debug */ 3446 #define DP_CLOCK_OUTPUT_ENABLE (1 << 13) 3447 3448 #define DP_SCRAMBLING_DISABLE (1 << 12) 3449 #define DP_SCRAMBLING_DISABLE_IRONLAKE (1 << 7) 3450 3451 /* limit RGB values to avoid confusing TVs */ 3452 #define DP_COLOR_RANGE_16_235 (1 << 8) 3453 3454 /* Turn on the audio link */ 3455 #define DP_AUDIO_OUTPUT_ENABLE (1 << 6) 3456 3457 /* vs and hs sync polarity */ 3458 #define DP_SYNC_VS_HIGH (1 << 4) 3459 #define DP_SYNC_HS_HIGH (1 << 3) 3460 3461 /* A fantasy */ 3462 #define DP_DETECTED (1 << 2) 3463 3464 /* The aux channel provides a way to talk to the 3465 * signal sink for DDC etc. Max packet size supported 3466 * is 20 bytes in each direction, hence the 5 fixed 3467 * data registers 3468 */ 3469 #define _DPA_AUX_CH_CTL (DISPLAY_MMIO_BASE(dev_priv) + 0x64010) 3470 #define _DPA_AUX_CH_DATA1 (DISPLAY_MMIO_BASE(dev_priv) + 0x64014) 3471 3472 #define _DPB_AUX_CH_CTL (DISPLAY_MMIO_BASE(dev_priv) + 0x64110) 3473 #define _DPB_AUX_CH_DATA1 (DISPLAY_MMIO_BASE(dev_priv) + 0x64114) 3474 3475 #define DP_AUX_CH_CTL(aux_ch) _MMIO_PORT(aux_ch, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL) 3476 #define DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT(aux_ch, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */ 3477 3478 #define _XELPDP_USBC1_AUX_CH_CTL 0x16F210 3479 #define _XELPDP_USBC2_AUX_CH_CTL 0x16F410 3480 #define _XELPDP_USBC3_AUX_CH_CTL 0x16F610 3481 #define _XELPDP_USBC4_AUX_CH_CTL 0x16F810 3482 3483 #define XELPDP_DP_AUX_CH_CTL(aux_ch) _MMIO(_PICK(aux_ch, \ 3484 _DPA_AUX_CH_CTL, \ 3485 _DPB_AUX_CH_CTL, \ 3486 0, /* port/aux_ch C is non-existent */ \ 3487 _XELPDP_USBC1_AUX_CH_CTL, \ 3488 _XELPDP_USBC2_AUX_CH_CTL, \ 3489 _XELPDP_USBC3_AUX_CH_CTL, \ 3490 _XELPDP_USBC4_AUX_CH_CTL)) 3491 3492 #define _XELPDP_USBC1_AUX_CH_DATA1 0x16F214 3493 #define _XELPDP_USBC2_AUX_CH_DATA1 0x16F414 3494 #define _XELPDP_USBC3_AUX_CH_DATA1 0x16F614 3495 #define _XELPDP_USBC4_AUX_CH_DATA1 0x16F814 3496 3497 #define XELPDP_DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PICK(aux_ch, \ 3498 _DPA_AUX_CH_DATA1, \ 3499 _DPB_AUX_CH_DATA1, \ 3500 0, /* port/aux_ch C is non-existent */ \ 3501 _XELPDP_USBC1_AUX_CH_DATA1, \ 3502 _XELPDP_USBC2_AUX_CH_DATA1, \ 3503 _XELPDP_USBC3_AUX_CH_DATA1, \ 3504 _XELPDP_USBC4_AUX_CH_DATA1) + (i) * 4) 3505 3506 #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31) 3507 #define DP_AUX_CH_CTL_DONE (1 << 30) 3508 #define DP_AUX_CH_CTL_INTERRUPT (1 << 29) 3509 #define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28) 3510 #define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26) 3511 #define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26) 3512 #define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26) 3513 #define DP_AUX_CH_CTL_TIME_OUT_MAX (3 << 26) /* Varies per platform */ 3514 #define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26) 3515 #define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25) 3516 #define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20) 3517 #define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20 3518 #define XELPDP_DP_AUX_CH_CTL_POWER_REQUEST REG_BIT(19) 3519 #define XELPDP_DP_AUX_CH_CTL_POWER_STATUS REG_BIT(18) 3520 #define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16) 3521 #define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16 3522 #define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15) 3523 #define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14) 3524 #define DP_AUX_CH_CTL_SYNC_TEST (1 << 13) 3525 #define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12) 3526 #define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11) 3527 #define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff) 3528 #define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0 3529 #define DP_AUX_CH_CTL_PSR_DATA_AUX_REG_SKL (1 << 14) 3530 #define DP_AUX_CH_CTL_FS_DATA_AUX_REG_SKL (1 << 13) 3531 #define DP_AUX_CH_CTL_GTC_DATA_AUX_REG_SKL (1 << 12) 3532 #define DP_AUX_CH_CTL_TBT_IO (1 << 11) 3533 #define DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL_MASK (0x1f << 5) 3534 #define DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(c) (((c) - 1) << 5) 3535 #define DP_AUX_CH_CTL_SYNC_PULSE_SKL(c) ((c) - 1) 3536 3537 /* 3538 * Computing GMCH M and N values for the Display Port link 3539 * 3540 * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes 3541 * 3542 * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz) 3543 * 3544 * The GMCH value is used internally 3545 * 3546 * bytes_per_pixel is the number of bytes coming out of the plane, 3547 * which is after the LUTs, so we want the bytes for our color format. 3548 * For our current usage, this is always 3, one byte for R, G and B. 3549 */ 3550 #define _PIPEA_DATA_M_G4X 0x70050 3551 #define _PIPEB_DATA_M_G4X 0x71050 3552 3553 /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */ 3554 #define TU_SIZE_MASK REG_GENMASK(30, 25) 3555 #define TU_SIZE(x) REG_FIELD_PREP(TU_SIZE_MASK, (x) - 1) /* default size 64 */ 3556 3557 #define DATA_LINK_M_N_MASK REG_GENMASK(23, 0) 3558 #define DATA_LINK_N_MAX (0x800000) 3559 3560 #define _PIPEA_DATA_N_G4X 0x70054 3561 #define _PIPEB_DATA_N_G4X 0x71054 3562 3563 /* 3564 * Computing Link M and N values for the Display Port link 3565 * 3566 * Link M / N = pixel_clock / ls_clk 3567 * 3568 * (the DP spec calls pixel_clock the 'strm_clk') 3569 * 3570 * The Link value is transmitted in the Main Stream 3571 * Attributes and VB-ID. 3572 */ 3573 3574 #define _PIPEA_LINK_M_G4X 0x70060 3575 #define _PIPEB_LINK_M_G4X 0x71060 3576 #define _PIPEA_LINK_N_G4X 0x70064 3577 #define _PIPEB_LINK_N_G4X 0x71064 3578 3579 #define PIPE_DATA_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_M_G4X, _PIPEB_DATA_M_G4X) 3580 #define PIPE_DATA_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_N_G4X, _PIPEB_DATA_N_G4X) 3581 #define PIPE_LINK_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_M_G4X, _PIPEB_LINK_M_G4X) 3582 #define PIPE_LINK_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_N_G4X, _PIPEB_LINK_N_G4X) 3583 3584 /* Display & cursor control */ 3585 3586 /* Pipe A */ 3587 #define _PIPEADSL 0x70000 3588 #define PIPEDSL_CURR_FIELD REG_BIT(31) /* ctg+ */ 3589 #define PIPEDSL_LINE_MASK REG_GENMASK(19, 0) 3590 #define _PIPEACONF 0x70008 3591 #define PIPECONF_ENABLE REG_BIT(31) 3592 #define PIPECONF_DOUBLE_WIDE REG_BIT(30) /* pre-i965 */ 3593 #define PIPECONF_STATE_ENABLE REG_BIT(30) /* i965+ */ 3594 #define PIPECONF_DSI_PLL_LOCKED REG_BIT(29) /* vlv & pipe A only */ 3595 #define PIPECONF_FRAME_START_DELAY_MASK REG_GENMASK(28, 27) /* pre-hsw */ 3596 #define PIPECONF_FRAME_START_DELAY(x) REG_FIELD_PREP(PIPECONF_FRAME_START_DELAY_MASK, (x)) /* pre-hsw: 0-3 */ 3597 #define PIPECONF_PIPE_LOCKED REG_BIT(25) 3598 #define PIPECONF_FORCE_BORDER REG_BIT(25) 3599 #define PIPECONF_GAMMA_MODE_MASK_I9XX REG_BIT(24) /* gmch */ 3600 #define PIPECONF_GAMMA_MODE_MASK_ILK REG_GENMASK(25, 24) /* ilk-ivb */ 3601 #define PIPECONF_GAMMA_MODE_8BIT REG_FIELD_PREP(PIPECONF_GAMMA_MODE_MASK, 0) 3602 #define PIPECONF_GAMMA_MODE_10BIT REG_FIELD_PREP(PIPECONF_GAMMA_MODE_MASK, 1) 3603 #define PIPECONF_GAMMA_MODE_12BIT REG_FIELD_PREP(PIPECONF_GAMMA_MODE_MASK_ILK, 2) /* ilk-ivb */ 3604 #define PIPECONF_GAMMA_MODE_SPLIT REG_FIELD_PREP(PIPECONF_GAMMA_MODE_MASK_ILK, 3) /* ivb */ 3605 #define PIPECONF_GAMMA_MODE(x) REG_FIELD_PREP(PIPECONF_GAMMA_MODE_MASK_ILK, (x)) /* pass in GAMMA_MODE_MODE_* */ 3606 #define PIPECONF_INTERLACE_MASK REG_GENMASK(23, 21) /* gen3+ */ 3607 #define PIPECONF_INTERLACE_PROGRESSIVE REG_FIELD_PREP(PIPECONF_INTERLACE_MASK, 0) 3608 #define PIPECONF_INTERLACE_W_SYNC_SHIFT_PANEL REG_FIELD_PREP(PIPECONF_INTERLACE_MASK, 4) /* gen4 only */ 3609 #define PIPECONF_INTERLACE_W_SYNC_SHIFT REG_FIELD_PREP(PIPECONF_INTERLACE_MASK, 5) /* gen4 only */ 3610 #define PIPECONF_INTERLACE_W_FIELD_INDICATION REG_FIELD_PREP(PIPECONF_INTERLACE_MASK, 6) 3611 #define PIPECONF_INTERLACE_FIELD_0_ONLY REG_FIELD_PREP(PIPECONF_INTERLACE_MASK, 7) /* gen3 only */ 3612 /* 3613 * ilk+: PF/D=progressive fetch/display, IF/D=interlaced fetch/display, 3614 * DBL=power saving pixel doubling, PF-ID* requires panel fitter 3615 */ 3616 #define PIPECONF_INTERLACE_MASK_ILK REG_GENMASK(23, 21) /* ilk+ */ 3617 #define PIPECONF_INTERLACE_MASK_HSW REG_GENMASK(22, 21) /* hsw+ */ 3618 #define PIPECONF_INTERLACE_PF_PD_ILK REG_FIELD_PREP(PIPECONF_INTERLACE_MASK_ILK, 0) 3619 #define PIPECONF_INTERLACE_PF_ID_ILK REG_FIELD_PREP(PIPECONF_INTERLACE_MASK_ILK, 1) 3620 #define PIPECONF_INTERLACE_IF_ID_ILK REG_FIELD_PREP(PIPECONF_INTERLACE_MASK_ILK, 3) 3621 #define PIPECONF_INTERLACE_IF_ID_DBL_ILK REG_FIELD_PREP(PIPECONF_INTERLACE_MASK_ILK, 4) /* ilk/snb only */ 3622 #define PIPECONF_INTERLACE_PF_ID_DBL_ILK REG_FIELD_PREP(PIPECONF_INTERLACE_MASK_ILK, 5) /* ilk/snb only */ 3623 #define PIPECONF_REFRESH_RATE_ALT_ILK REG_BIT(20) 3624 #define PIPECONF_MSA_TIMING_DELAY_MASK REG_GENMASK(19, 18) /* ilk/snb/ivb */ 3625 #define PIPECONF_MSA_TIMING_DELAY(x) REG_FIELD_PREP(PIPECONF_MSA_TIMING_DELAY_MASK, (x)) 3626 #define PIPECONF_CXSR_DOWNCLOCK REG_BIT(16) 3627 #define PIPECONF_REFRESH_RATE_ALT_VLV REG_BIT(14) 3628 #define PIPECONF_COLOR_RANGE_SELECT REG_BIT(13) 3629 #define PIPECONF_OUTPUT_COLORSPACE_MASK REG_GENMASK(12, 11) /* ilk-ivb */ 3630 #define PIPECONF_OUTPUT_COLORSPACE_RGB REG_FIELD_PREP(PIPECONF_OUTPUT_COLORSPACE_MASK, 0) /* ilk-ivb */ 3631 #define PIPECONF_OUTPUT_COLORSPACE_YUV601 REG_FIELD_PREP(PIPECONF_OUTPUT_COLORSPACE_MASK, 1) /* ilk-ivb */ 3632 #define PIPECONF_OUTPUT_COLORSPACE_YUV709 REG_FIELD_PREP(PIPECONF_OUTPUT_COLORSPACE_MASK, 2) /* ilk-ivb */ 3633 #define PIPECONF_OUTPUT_COLORSPACE_YUV_HSW REG_BIT(11) /* hsw only */ 3634 #define PIPECONF_BPC_MASK REG_GENMASK(7, 5) /* ctg-ivb */ 3635 #define PIPECONF_BPC_8 REG_FIELD_PREP(PIPECONF_BPC_MASK, 0) 3636 #define PIPECONF_BPC_10 REG_FIELD_PREP(PIPECONF_BPC_MASK, 1) 3637 #define PIPECONF_BPC_6 REG_FIELD_PREP(PIPECONF_BPC_MASK, 2) 3638 #define PIPECONF_BPC_12 REG_FIELD_PREP(PIPECONF_BPC_MASK, 3) 3639 #define PIPECONF_DITHER_EN REG_BIT(4) 3640 #define PIPECONF_DITHER_TYPE_MASK REG_GENMASK(3, 2) 3641 #define PIPECONF_DITHER_TYPE_SP REG_FIELD_PREP(PIPECONF_DITHER_TYPE_MASK, 0) 3642 #define PIPECONF_DITHER_TYPE_ST1 REG_FIELD_PREP(PIPECONF_DITHER_TYPE_MASK, 1) 3643 #define PIPECONF_DITHER_TYPE_ST2 REG_FIELD_PREP(PIPECONF_DITHER_TYPE_MASK, 2) 3644 #define PIPECONF_DITHER_TYPE_TEMP REG_FIELD_PREP(PIPECONF_DITHER_TYPE_MASK, 3) 3645 #define _PIPEASTAT 0x70024 3646 #define PIPE_FIFO_UNDERRUN_STATUS (1UL << 31) 3647 #define SPRITE1_FLIP_DONE_INT_EN_VLV (1UL << 30) 3648 #define PIPE_CRC_ERROR_ENABLE (1UL << 29) 3649 #define PIPE_CRC_DONE_ENABLE (1UL << 28) 3650 #define PERF_COUNTER2_INTERRUPT_EN (1UL << 27) 3651 #define PIPE_GMBUS_EVENT_ENABLE (1UL << 27) 3652 #define PLANE_FLIP_DONE_INT_EN_VLV (1UL << 26) 3653 #define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL << 26) 3654 #define PIPE_VSYNC_INTERRUPT_ENABLE (1UL << 25) 3655 #define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL << 24) 3656 #define PIPE_DPST_EVENT_ENABLE (1UL << 23) 3657 #define SPRITE0_FLIP_DONE_INT_EN_VLV (1UL << 22) 3658 #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL << 22) 3659 #define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL << 21) 3660 #define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL << 20) 3661 #define PIPE_B_PSR_INTERRUPT_ENABLE_VLV (1UL << 19) 3662 #define PERF_COUNTER_INTERRUPT_EN (1UL << 19) 3663 #define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL << 18) /* pre-965 */ 3664 #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL << 18) /* 965 or later */ 3665 #define PIPE_FRAMESTART_INTERRUPT_ENABLE (1UL << 17) 3666 #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL << 17) 3667 #define PIPEA_HBLANK_INT_EN_VLV (1UL << 16) 3668 #define PIPE_OVERLAY_UPDATED_ENABLE (1UL << 16) 3669 #define SPRITE1_FLIP_DONE_INT_STATUS_VLV (1UL << 15) 3670 #define SPRITE0_FLIP_DONE_INT_STATUS_VLV (1UL << 14) 3671 #define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL << 13) 3672 #define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL << 12) 3673 #define PERF_COUNTER2_INTERRUPT_STATUS (1UL << 11) 3674 #define PIPE_GMBUS_INTERRUPT_STATUS (1UL << 11) 3675 #define PLANE_FLIP_DONE_INT_STATUS_VLV (1UL << 10) 3676 #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL << 10) 3677 #define PIPE_VSYNC_INTERRUPT_STATUS (1UL << 9) 3678 #define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL << 8) 3679 #define PIPE_DPST_EVENT_STATUS (1UL << 7) 3680 #define PIPE_A_PSR_STATUS_VLV (1UL << 6) 3681 #define PIPE_LEGACY_BLC_EVENT_STATUS (1UL << 6) 3682 #define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL << 5) 3683 #define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL << 4) 3684 #define PIPE_B_PSR_STATUS_VLV (1UL << 3) 3685 #define PERF_COUNTER_INTERRUPT_STATUS (1UL << 3) 3686 #define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL << 2) /* pre-965 */ 3687 #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL << 2) /* 965 or later */ 3688 #define PIPE_FRAMESTART_INTERRUPT_STATUS (1UL << 1) 3689 #define PIPE_VBLANK_INTERRUPT_STATUS (1UL << 1) 3690 #define PIPE_HBLANK_INT_STATUS (1UL << 0) 3691 #define PIPE_OVERLAY_UPDATED_STATUS (1UL << 0) 3692 3693 #define PIPESTAT_INT_ENABLE_MASK 0x7fff0000 3694 #define PIPESTAT_INT_STATUS_MASK 0x0000ffff 3695 3696 #define PIPE_A_OFFSET 0x70000 3697 #define PIPE_B_OFFSET 0x71000 3698 #define PIPE_C_OFFSET 0x72000 3699 #define PIPE_D_OFFSET 0x73000 3700 #define CHV_PIPE_C_OFFSET 0x74000 3701 /* 3702 * There's actually no pipe EDP. Some pipe registers have 3703 * simply shifted from the pipe to the transcoder, while 3704 * keeping their original offset. Thus we need PIPE_EDP_OFFSET 3705 * to access such registers in transcoder EDP. 3706 */ 3707 #define PIPE_EDP_OFFSET 0x7f000 3708 3709 /* ICL DSI 0 and 1 */ 3710 #define PIPE_DSI0_OFFSET 0x7b000 3711 #define PIPE_DSI1_OFFSET 0x7b800 3712 3713 #define PIPECONF(pipe) _MMIO_PIPE2(pipe, _PIPEACONF) 3714 #define PIPEDSL(pipe) _MMIO_PIPE2(pipe, _PIPEADSL) 3715 #define PIPEFRAME(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEHIGH) 3716 #define PIPEFRAMEPIXEL(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEPIXEL) 3717 #define PIPESTAT(pipe) _MMIO_PIPE2(pipe, _PIPEASTAT) 3718 3719 #define _PIPEAGCMAX 0x70010 3720 #define _PIPEBGCMAX 0x71010 3721 #define PIPEGCMAX(pipe, i) _MMIO_PIPE2(pipe, _PIPEAGCMAX + (i) * 4) 3722 3723 #define _PIPE_ARB_CTL_A 0x70028 /* icl+ */ 3724 #define PIPE_ARB_CTL(pipe) _MMIO_PIPE2(pipe, _PIPE_ARB_CTL_A) 3725 #define PIPE_ARB_USE_PROG_SLOTS REG_BIT(13) 3726 3727 #define _PIPE_MISC_A 0x70030 3728 #define _PIPE_MISC_B 0x71030 3729 #define PIPEMISC_YUV420_ENABLE REG_BIT(27) /* glk+ */ 3730 #define PIPEMISC_YUV420_MODE_FULL_BLEND REG_BIT(26) /* glk+ */ 3731 #define PIPEMISC_HDR_MODE_PRECISION REG_BIT(23) /* icl+ */ 3732 #define PIPEMISC_OUTPUT_COLORSPACE_YUV REG_BIT(11) 3733 #define PIPEMISC_PIXEL_ROUNDING_TRUNC REG_BIT(8) /* tgl+ */ 3734 /* 3735 * For Display < 13, Bits 5-7 of PIPE MISC represent DITHER BPC with 3736 * valid values of: 6, 8, 10 BPC. 3737 * ADLP+, the bits 5-7 represent PORT OUTPUT BPC with valid values of: 3738 * 6, 8, 10, 12 BPC. 3739 */ 3740 #define PIPEMISC_BPC_MASK REG_GENMASK(7, 5) 3741 #define PIPEMISC_BPC_8 REG_FIELD_PREP(PIPEMISC_BPC_MASK, 0) 3742 #define PIPEMISC_BPC_10 REG_FIELD_PREP(PIPEMISC_BPC_MASK, 1) 3743 #define PIPEMISC_BPC_6 REG_FIELD_PREP(PIPEMISC_BPC_MASK, 2) 3744 #define PIPEMISC_BPC_12_ADLP REG_FIELD_PREP(PIPEMISC_BPC_MASK, 4) /* adlp+ */ 3745 #define PIPEMISC_DITHER_ENABLE REG_BIT(4) 3746 #define PIPEMISC_DITHER_TYPE_MASK REG_GENMASK(3, 2) 3747 #define PIPEMISC_DITHER_TYPE_SP REG_FIELD_PREP(PIPEMISC_DITHER_TYPE_MASK, 0) 3748 #define PIPEMISC_DITHER_TYPE_ST1 REG_FIELD_PREP(PIPEMISC_DITHER_TYPE_MASK, 1) 3749 #define PIPEMISC_DITHER_TYPE_ST2 REG_FIELD_PREP(PIPEMISC_DITHER_TYPE_MASK, 2) 3750 #define PIPEMISC_DITHER_TYPE_TEMP REG_FIELD_PREP(PIPEMISC_DITHER_TYPE_MASK, 3) 3751 #define PIPEMISC(pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A) 3752 3753 #define _PIPE_MISC2_A 0x7002C 3754 #define _PIPE_MISC2_B 0x7102C 3755 #define PIPE_MISC2_BUBBLE_COUNTER_MASK REG_GENMASK(31, 24) 3756 #define PIPE_MISC2_BUBBLE_COUNTER_SCALER_EN REG_FIELD_PREP(PIPE_MISC2_BUBBLE_COUNTER_MASK, 80) 3757 #define PIPE_MISC2_BUBBLE_COUNTER_SCALER_DIS REG_FIELD_PREP(PIPE_MISC2_BUBBLE_COUNTER_MASK, 20) 3758 #define PIPE_MISC2(pipe) _MMIO_PIPE2(pipe, _PIPE_MISC2_A) 3759 3760 /* Skylake+ pipe bottom (background) color */ 3761 #define _SKL_BOTTOM_COLOR_A 0x70034 3762 #define SKL_BOTTOM_COLOR_GAMMA_ENABLE REG_BIT(31) 3763 #define SKL_BOTTOM_COLOR_CSC_ENABLE REG_BIT(30) 3764 #define SKL_BOTTOM_COLOR(pipe) _MMIO_PIPE2(pipe, _SKL_BOTTOM_COLOR_A) 3765 3766 #define _ICL_PIPE_A_STATUS 0x70058 3767 #define ICL_PIPESTATUS(pipe) _MMIO_PIPE2(pipe, _ICL_PIPE_A_STATUS) 3768 #define PIPE_STATUS_UNDERRUN REG_BIT(31) 3769 #define PIPE_STATUS_SOFT_UNDERRUN_XELPD REG_BIT(28) 3770 #define PIPE_STATUS_HARD_UNDERRUN_XELPD REG_BIT(27) 3771 #define PIPE_STATUS_PORT_UNDERRUN_XELPD REG_BIT(26) 3772 3773 #define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028) 3774 #define PIPEB_LINE_COMPARE_INT_EN REG_BIT(29) 3775 #define PIPEB_HLINE_INT_EN REG_BIT(28) 3776 #define PIPEB_VBLANK_INT_EN REG_BIT(27) 3777 #define SPRITED_FLIP_DONE_INT_EN REG_BIT(26) 3778 #define SPRITEC_FLIP_DONE_INT_EN REG_BIT(25) 3779 #define PLANEB_FLIP_DONE_INT_EN REG_BIT(24) 3780 #define PIPE_PSR_INT_EN REG_BIT(22) 3781 #define PIPEA_LINE_COMPARE_INT_EN REG_BIT(21) 3782 #define PIPEA_HLINE_INT_EN REG_BIT(20) 3783 #define PIPEA_VBLANK_INT_EN REG_BIT(19) 3784 #define SPRITEB_FLIP_DONE_INT_EN REG_BIT(18) 3785 #define SPRITEA_FLIP_DONE_INT_EN REG_BIT(17) 3786 #define PLANEA_FLIPDONE_INT_EN REG_BIT(16) 3787 #define PIPEC_LINE_COMPARE_INT_EN REG_BIT(13) 3788 #define PIPEC_HLINE_INT_EN REG_BIT(12) 3789 #define PIPEC_VBLANK_INT_EN REG_BIT(11) 3790 #define SPRITEF_FLIPDONE_INT_EN REG_BIT(10) 3791 #define SPRITEE_FLIPDONE_INT_EN REG_BIT(9) 3792 #define PLANEC_FLIPDONE_INT_EN REG_BIT(8) 3793 3794 #define DPINVGTT _MMIO(VLV_DISPLAY_BASE + 0x7002c) /* VLV/CHV only */ 3795 #define DPINVGTT_EN_MASK_CHV REG_GENMASK(27, 16) 3796 #define DPINVGTT_EN_MASK_VLV REG_GENMASK(23, 16) 3797 #define SPRITEF_INVALID_GTT_INT_EN REG_BIT(27) 3798 #define SPRITEE_INVALID_GTT_INT_EN REG_BIT(26) 3799 #define PLANEC_INVALID_GTT_INT_EN REG_BIT(25) 3800 #define CURSORC_INVALID_GTT_INT_EN REG_BIT(24) 3801 #define CURSORB_INVALID_GTT_INT_EN REG_BIT(23) 3802 #define CURSORA_INVALID_GTT_INT_EN REG_BIT(22) 3803 #define SPRITED_INVALID_GTT_INT_EN REG_BIT(21) 3804 #define SPRITEC_INVALID_GTT_INT_EN REG_BIT(20) 3805 #define PLANEB_INVALID_GTT_INT_EN REG_BIT(19) 3806 #define SPRITEB_INVALID_GTT_INT_EN REG_BIT(18) 3807 #define SPRITEA_INVALID_GTT_INT_EN REG_BIT(17) 3808 #define PLANEA_INVALID_GTT_INT_EN REG_BIT(16) 3809 #define DPINVGTT_STATUS_MASK_CHV REG_GENMASK(11, 0) 3810 #define DPINVGTT_STATUS_MASK_VLV REG_GENMASK(7, 0) 3811 #define SPRITEF_INVALID_GTT_STATUS REG_BIT(11) 3812 #define SPRITEE_INVALID_GTT_STATUS REG_BIT(10) 3813 #define PLANEC_INVALID_GTT_STATUS REG_BIT(9) 3814 #define CURSORC_INVALID_GTT_STATUS REG_BIT(8) 3815 #define CURSORB_INVALID_GTT_STATUS REG_BIT(7) 3816 #define CURSORA_INVALID_GTT_STATUS REG_BIT(6) 3817 #define SPRITED_INVALID_GTT_STATUS REG_BIT(5) 3818 #define SPRITEC_INVALID_GTT_STATUS REG_BIT(4) 3819 #define PLANEB_INVALID_GTT_STATUS REG_BIT(3) 3820 #define SPRITEB_INVALID_GTT_STATUS REG_BIT(2) 3821 #define SPRITEA_INVALID_GTT_STATUS REG_BIT(1) 3822 #define PLANEA_INVALID_GTT_STATUS REG_BIT(0) 3823 3824 #define DSPARB _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70030) 3825 #define DSPARB_CSTART_MASK (0x7f << 7) 3826 #define DSPARB_CSTART_SHIFT 7 3827 #define DSPARB_BSTART_MASK (0x7f) 3828 #define DSPARB_BSTART_SHIFT 0 3829 #define DSPARB_BEND_SHIFT 9 /* on 855 */ 3830 #define DSPARB_AEND_SHIFT 0 3831 #define DSPARB_SPRITEA_SHIFT_VLV 0 3832 #define DSPARB_SPRITEA_MASK_VLV (0xff << 0) 3833 #define DSPARB_SPRITEB_SHIFT_VLV 8 3834 #define DSPARB_SPRITEB_MASK_VLV (0xff << 8) 3835 #define DSPARB_SPRITEC_SHIFT_VLV 16 3836 #define DSPARB_SPRITEC_MASK_VLV (0xff << 16) 3837 #define DSPARB_SPRITED_SHIFT_VLV 24 3838 #define DSPARB_SPRITED_MASK_VLV (0xff << 24) 3839 #define DSPARB2 _MMIO(VLV_DISPLAY_BASE + 0x70060) /* vlv/chv */ 3840 #define DSPARB_SPRITEA_HI_SHIFT_VLV 0 3841 #define DSPARB_SPRITEA_HI_MASK_VLV (0x1 << 0) 3842 #define DSPARB_SPRITEB_HI_SHIFT_VLV 4 3843 #define DSPARB_SPRITEB_HI_MASK_VLV (0x1 << 4) 3844 #define DSPARB_SPRITEC_HI_SHIFT_VLV 8 3845 #define DSPARB_SPRITEC_HI_MASK_VLV (0x1 << 8) 3846 #define DSPARB_SPRITED_HI_SHIFT_VLV 12 3847 #define DSPARB_SPRITED_HI_MASK_VLV (0x1 << 12) 3848 #define DSPARB_SPRITEE_HI_SHIFT_VLV 16 3849 #define DSPARB_SPRITEE_HI_MASK_VLV (0x1 << 16) 3850 #define DSPARB_SPRITEF_HI_SHIFT_VLV 20 3851 #define DSPARB_SPRITEF_HI_MASK_VLV (0x1 << 20) 3852 #define DSPARB3 _MMIO(VLV_DISPLAY_BASE + 0x7006c) /* chv */ 3853 #define DSPARB_SPRITEE_SHIFT_VLV 0 3854 #define DSPARB_SPRITEE_MASK_VLV (0xff << 0) 3855 #define DSPARB_SPRITEF_SHIFT_VLV 8 3856 #define DSPARB_SPRITEF_MASK_VLV (0xff << 8) 3857 3858 /* pnv/gen4/g4x/vlv/chv */ 3859 #define DSPFW1 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70034) 3860 #define DSPFW_SR_SHIFT 23 3861 #define DSPFW_SR_MASK (0x1ff << 23) 3862 #define DSPFW_CURSORB_SHIFT 16 3863 #define DSPFW_CURSORB_MASK (0x3f << 16) 3864 #define DSPFW_PLANEB_SHIFT 8 3865 #define DSPFW_PLANEB_MASK (0x7f << 8) 3866 #define DSPFW_PLANEB_MASK_VLV (0xff << 8) /* vlv/chv */ 3867 #define DSPFW_PLANEA_SHIFT 0 3868 #define DSPFW_PLANEA_MASK (0x7f << 0) 3869 #define DSPFW_PLANEA_MASK_VLV (0xff << 0) /* vlv/chv */ 3870 #define DSPFW2 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70038) 3871 #define DSPFW_FBC_SR_EN (1 << 31) /* g4x */ 3872 #define DSPFW_FBC_SR_SHIFT 28 3873 #define DSPFW_FBC_SR_MASK (0x7 << 28) /* g4x */ 3874 #define DSPFW_FBC_HPLL_SR_SHIFT 24 3875 #define DSPFW_FBC_HPLL_SR_MASK (0xf << 24) /* g4x */ 3876 #define DSPFW_SPRITEB_SHIFT (16) 3877 #define DSPFW_SPRITEB_MASK (0x7f << 16) /* g4x */ 3878 #define DSPFW_SPRITEB_MASK_VLV (0xff << 16) /* vlv/chv */ 3879 #define DSPFW_CURSORA_SHIFT 8 3880 #define DSPFW_CURSORA_MASK (0x3f << 8) 3881 #define DSPFW_PLANEC_OLD_SHIFT 0 3882 #define DSPFW_PLANEC_OLD_MASK (0x7f << 0) /* pre-gen4 sprite C */ 3883 #define DSPFW_SPRITEA_SHIFT 0 3884 #define DSPFW_SPRITEA_MASK (0x7f << 0) /* g4x */ 3885 #define DSPFW_SPRITEA_MASK_VLV (0xff << 0) /* vlv/chv */ 3886 #define DSPFW3 _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x7003c) 3887 #define DSPFW_HPLL_SR_EN (1 << 31) 3888 #define PINEVIEW_SELF_REFRESH_EN (1 << 30) 3889 #define DSPFW_CURSOR_SR_SHIFT 24 3890 #define DSPFW_CURSOR_SR_MASK (0x3f << 24) 3891 #define DSPFW_HPLL_CURSOR_SHIFT 16 3892 #define DSPFW_HPLL_CURSOR_MASK (0x3f << 16) 3893 #define DSPFW_HPLL_SR_SHIFT 0 3894 #define DSPFW_HPLL_SR_MASK (0x1ff << 0) 3895 3896 /* vlv/chv */ 3897 #define DSPFW4 _MMIO(VLV_DISPLAY_BASE + 0x70070) 3898 #define DSPFW_SPRITEB_WM1_SHIFT 16 3899 #define DSPFW_SPRITEB_WM1_MASK (0xff << 16) 3900 #define DSPFW_CURSORA_WM1_SHIFT 8 3901 #define DSPFW_CURSORA_WM1_MASK (0x3f << 8) 3902 #define DSPFW_SPRITEA_WM1_SHIFT 0 3903 #define DSPFW_SPRITEA_WM1_MASK (0xff << 0) 3904 #define DSPFW5 _MMIO(VLV_DISPLAY_BASE + 0x70074) 3905 #define DSPFW_PLANEB_WM1_SHIFT 24 3906 #define DSPFW_PLANEB_WM1_MASK (0xff << 24) 3907 #define DSPFW_PLANEA_WM1_SHIFT 16 3908 #define DSPFW_PLANEA_WM1_MASK (0xff << 16) 3909 #define DSPFW_CURSORB_WM1_SHIFT 8 3910 #define DSPFW_CURSORB_WM1_MASK (0x3f << 8) 3911 #define DSPFW_CURSOR_SR_WM1_SHIFT 0 3912 #define DSPFW_CURSOR_SR_WM1_MASK (0x3f << 0) 3913 #define DSPFW6 _MMIO(VLV_DISPLAY_BASE + 0x70078) 3914 #define DSPFW_SR_WM1_SHIFT 0 3915 #define DSPFW_SR_WM1_MASK (0x1ff << 0) 3916 #define DSPFW7 _MMIO(VLV_DISPLAY_BASE + 0x7007c) 3917 #define DSPFW7_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b4) /* wtf #1? */ 3918 #define DSPFW_SPRITED_WM1_SHIFT 24 3919 #define DSPFW_SPRITED_WM1_MASK (0xff << 24) 3920 #define DSPFW_SPRITED_SHIFT 16 3921 #define DSPFW_SPRITED_MASK_VLV (0xff << 16) 3922 #define DSPFW_SPRITEC_WM1_SHIFT 8 3923 #define DSPFW_SPRITEC_WM1_MASK (0xff << 8) 3924 #define DSPFW_SPRITEC_SHIFT 0 3925 #define DSPFW_SPRITEC_MASK_VLV (0xff << 0) 3926 #define DSPFW8_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b8) 3927 #define DSPFW_SPRITEF_WM1_SHIFT 24 3928 #define DSPFW_SPRITEF_WM1_MASK (0xff << 24) 3929 #define DSPFW_SPRITEF_SHIFT 16 3930 #define DSPFW_SPRITEF_MASK_VLV (0xff << 16) 3931 #define DSPFW_SPRITEE_WM1_SHIFT 8 3932 #define DSPFW_SPRITEE_WM1_MASK (0xff << 8) 3933 #define DSPFW_SPRITEE_SHIFT 0 3934 #define DSPFW_SPRITEE_MASK_VLV (0xff << 0) 3935 #define DSPFW9_CHV _MMIO(VLV_DISPLAY_BASE + 0x7007c) /* wtf #2? */ 3936 #define DSPFW_PLANEC_WM1_SHIFT 24 3937 #define DSPFW_PLANEC_WM1_MASK (0xff << 24) 3938 #define DSPFW_PLANEC_SHIFT 16 3939 #define DSPFW_PLANEC_MASK_VLV (0xff << 16) 3940 #define DSPFW_CURSORC_WM1_SHIFT 8 3941 #define DSPFW_CURSORC_WM1_MASK (0x3f << 16) 3942 #define DSPFW_CURSORC_SHIFT 0 3943 #define DSPFW_CURSORC_MASK (0x3f << 0) 3944 3945 /* vlv/chv high order bits */ 3946 #define DSPHOWM _MMIO(VLV_DISPLAY_BASE + 0x70064) 3947 #define DSPFW_SR_HI_SHIFT 24 3948 #define DSPFW_SR_HI_MASK (3 << 24) /* 2 bits for chv, 1 for vlv */ 3949 #define DSPFW_SPRITEF_HI_SHIFT 23 3950 #define DSPFW_SPRITEF_HI_MASK (1 << 23) 3951 #define DSPFW_SPRITEE_HI_SHIFT 22 3952 #define DSPFW_SPRITEE_HI_MASK (1 << 22) 3953 #define DSPFW_PLANEC_HI_SHIFT 21 3954 #define DSPFW_PLANEC_HI_MASK (1 << 21) 3955 #define DSPFW_SPRITED_HI_SHIFT 20 3956 #define DSPFW_SPRITED_HI_MASK (1 << 20) 3957 #define DSPFW_SPRITEC_HI_SHIFT 16 3958 #define DSPFW_SPRITEC_HI_MASK (1 << 16) 3959 #define DSPFW_PLANEB_HI_SHIFT 12 3960 #define DSPFW_PLANEB_HI_MASK (1 << 12) 3961 #define DSPFW_SPRITEB_HI_SHIFT 8 3962 #define DSPFW_SPRITEB_HI_MASK (1 << 8) 3963 #define DSPFW_SPRITEA_HI_SHIFT 4 3964 #define DSPFW_SPRITEA_HI_MASK (1 << 4) 3965 #define DSPFW_PLANEA_HI_SHIFT 0 3966 #define DSPFW_PLANEA_HI_MASK (1 << 0) 3967 #define DSPHOWM1 _MMIO(VLV_DISPLAY_BASE + 0x70068) 3968 #define DSPFW_SR_WM1_HI_SHIFT 24 3969 #define DSPFW_SR_WM1_HI_MASK (3 << 24) /* 2 bits for chv, 1 for vlv */ 3970 #define DSPFW_SPRITEF_WM1_HI_SHIFT 23 3971 #define DSPFW_SPRITEF_WM1_HI_MASK (1 << 23) 3972 #define DSPFW_SPRITEE_WM1_HI_SHIFT 22 3973 #define DSPFW_SPRITEE_WM1_HI_MASK (1 << 22) 3974 #define DSPFW_PLANEC_WM1_HI_SHIFT 21 3975 #define DSPFW_PLANEC_WM1_HI_MASK (1 << 21) 3976 #define DSPFW_SPRITED_WM1_HI_SHIFT 20 3977 #define DSPFW_SPRITED_WM1_HI_MASK (1 << 20) 3978 #define DSPFW_SPRITEC_WM1_HI_SHIFT 16 3979 #define DSPFW_SPRITEC_WM1_HI_MASK (1 << 16) 3980 #define DSPFW_PLANEB_WM1_HI_SHIFT 12 3981 #define DSPFW_PLANEB_WM1_HI_MASK (1 << 12) 3982 #define DSPFW_SPRITEB_WM1_HI_SHIFT 8 3983 #define DSPFW_SPRITEB_WM1_HI_MASK (1 << 8) 3984 #define DSPFW_SPRITEA_WM1_HI_SHIFT 4 3985 #define DSPFW_SPRITEA_WM1_HI_MASK (1 << 4) 3986 #define DSPFW_PLANEA_WM1_HI_SHIFT 0 3987 #define DSPFW_PLANEA_WM1_HI_MASK (1 << 0) 3988 3989 /* drain latency register values*/ 3990 #define VLV_DDL(pipe) _MMIO(VLV_DISPLAY_BASE + 0x70050 + 4 * (pipe)) 3991 #define DDL_CURSOR_SHIFT 24 3992 #define DDL_SPRITE_SHIFT(sprite) (8 + 8 * (sprite)) 3993 #define DDL_PLANE_SHIFT 0 3994 #define DDL_PRECISION_HIGH (1 << 7) 3995 #define DDL_PRECISION_LOW (0 << 7) 3996 #define DRAIN_LATENCY_MASK 0x7f 3997 3998 #define CBR1_VLV _MMIO(VLV_DISPLAY_BASE + 0x70400) 3999 #define CBR_PND_DEADLINE_DISABLE (1 << 31) 4000 #define CBR_PWM_CLOCK_MUX_SELECT (1 << 30) 4001 4002 #define CBR4_VLV _MMIO(VLV_DISPLAY_BASE + 0x70450) 4003 #define CBR_DPLLBMD_PIPE(pipe) (1 << (7 + (pipe) * 11)) /* pipes B and C */ 4004 4005 /* FIFO watermark sizes etc */ 4006 #define G4X_FIFO_LINE_SIZE 64 4007 #define I915_FIFO_LINE_SIZE 64 4008 #define I830_FIFO_LINE_SIZE 32 4009 4010 #define VALLEYVIEW_FIFO_SIZE 255 4011 #define G4X_FIFO_SIZE 127 4012 #define I965_FIFO_SIZE 512 4013 #define I945_FIFO_SIZE 127 4014 #define I915_FIFO_SIZE 95 4015 #define I855GM_FIFO_SIZE 127 /* In cachelines */ 4016 #define I830_FIFO_SIZE 95 4017 4018 #define VALLEYVIEW_MAX_WM 0xff 4019 #define G4X_MAX_WM 0x3f 4020 #define I915_MAX_WM 0x3f 4021 4022 #define PINEVIEW_DISPLAY_FIFO 512 /* in 64byte unit */ 4023 #define PINEVIEW_FIFO_LINE_SIZE 64 4024 #define PINEVIEW_MAX_WM 0x1ff 4025 #define PINEVIEW_DFT_WM 0x3f 4026 #define PINEVIEW_DFT_HPLLOFF_WM 0 4027 #define PINEVIEW_GUARD_WM 10 4028 #define PINEVIEW_CURSOR_FIFO 64 4029 #define PINEVIEW_CURSOR_MAX_WM 0x3f 4030 #define PINEVIEW_CURSOR_DFT_WM 0 4031 #define PINEVIEW_CURSOR_GUARD_WM 5 4032 4033 #define VALLEYVIEW_CURSOR_MAX_WM 64 4034 #define I965_CURSOR_FIFO 64 4035 #define I965_CURSOR_MAX_WM 32 4036 #define I965_CURSOR_DFT_WM 8 4037 4038 /* Watermark register definitions for SKL */ 4039 #define _CUR_WM_A_0 0x70140 4040 #define _CUR_WM_B_0 0x71140 4041 #define _CUR_WM_SAGV_A 0x70158 4042 #define _CUR_WM_SAGV_B 0x71158 4043 #define _CUR_WM_SAGV_TRANS_A 0x7015C 4044 #define _CUR_WM_SAGV_TRANS_B 0x7115C 4045 #define _CUR_WM_TRANS_A 0x70168 4046 #define _CUR_WM_TRANS_B 0x71168 4047 #define _PLANE_WM_1_A_0 0x70240 4048 #define _PLANE_WM_1_B_0 0x71240 4049 #define _PLANE_WM_2_A_0 0x70340 4050 #define _PLANE_WM_2_B_0 0x71340 4051 #define _PLANE_WM_SAGV_1_A 0x70258 4052 #define _PLANE_WM_SAGV_1_B 0x71258 4053 #define _PLANE_WM_SAGV_2_A 0x70358 4054 #define _PLANE_WM_SAGV_2_B 0x71358 4055 #define _PLANE_WM_SAGV_TRANS_1_A 0x7025C 4056 #define _PLANE_WM_SAGV_TRANS_1_B 0x7125C 4057 #define _PLANE_WM_SAGV_TRANS_2_A 0x7035C 4058 #define _PLANE_WM_SAGV_TRANS_2_B 0x7135C 4059 #define _PLANE_WM_TRANS_1_A 0x70268 4060 #define _PLANE_WM_TRANS_1_B 0x71268 4061 #define _PLANE_WM_TRANS_2_A 0x70368 4062 #define _PLANE_WM_TRANS_2_B 0x71368 4063 #define PLANE_WM_EN (1 << 31) 4064 #define PLANE_WM_IGNORE_LINES (1 << 30) 4065 #define PLANE_WM_LINES_MASK REG_GENMASK(26, 14) 4066 #define PLANE_WM_BLOCKS_MASK REG_GENMASK(11, 0) 4067 4068 #define _CUR_WM_0(pipe) _PIPE(pipe, _CUR_WM_A_0, _CUR_WM_B_0) 4069 #define CUR_WM(pipe, level) _MMIO(_CUR_WM_0(pipe) + ((4) * (level))) 4070 #define CUR_WM_SAGV(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_A, _CUR_WM_SAGV_B) 4071 #define CUR_WM_SAGV_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_TRANS_A, _CUR_WM_SAGV_TRANS_B) 4072 #define CUR_WM_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_TRANS_A, _CUR_WM_TRANS_B) 4073 #define _PLANE_WM_1(pipe) _PIPE(pipe, _PLANE_WM_1_A_0, _PLANE_WM_1_B_0) 4074 #define _PLANE_WM_2(pipe) _PIPE(pipe, _PLANE_WM_2_A_0, _PLANE_WM_2_B_0) 4075 #define _PLANE_WM_BASE(pipe, plane) \ 4076 _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe)) 4077 #define PLANE_WM(pipe, plane, level) \ 4078 _MMIO(_PLANE_WM_BASE(pipe, plane) + ((4) * (level))) 4079 #define _PLANE_WM_SAGV_1(pipe) \ 4080 _PIPE(pipe, _PLANE_WM_SAGV_1_A, _PLANE_WM_SAGV_1_B) 4081 #define _PLANE_WM_SAGV_2(pipe) \ 4082 _PIPE(pipe, _PLANE_WM_SAGV_2_A, _PLANE_WM_SAGV_2_B) 4083 #define PLANE_WM_SAGV(pipe, plane) \ 4084 _MMIO(_PLANE(plane, _PLANE_WM_SAGV_1(pipe), _PLANE_WM_SAGV_2(pipe))) 4085 #define _PLANE_WM_SAGV_TRANS_1(pipe) \ 4086 _PIPE(pipe, _PLANE_WM_SAGV_TRANS_1_A, _PLANE_WM_SAGV_TRANS_1_B) 4087 #define _PLANE_WM_SAGV_TRANS_2(pipe) \ 4088 _PIPE(pipe, _PLANE_WM_SAGV_TRANS_2_A, _PLANE_WM_SAGV_TRANS_2_B) 4089 #define PLANE_WM_SAGV_TRANS(pipe, plane) \ 4090 _MMIO(_PLANE(plane, _PLANE_WM_SAGV_TRANS_1(pipe), _PLANE_WM_SAGV_TRANS_2(pipe))) 4091 #define _PLANE_WM_TRANS_1(pipe) \ 4092 _PIPE(pipe, _PLANE_WM_TRANS_1_A, _PLANE_WM_TRANS_1_B) 4093 #define _PLANE_WM_TRANS_2(pipe) \ 4094 _PIPE(pipe, _PLANE_WM_TRANS_2_A, _PLANE_WM_TRANS_2_B) 4095 #define PLANE_WM_TRANS(pipe, plane) \ 4096 _MMIO(_PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe))) 4097 4098 /* define the Watermark register on Ironlake */ 4099 #define _WM0_PIPEA_ILK 0x45100 4100 #define _WM0_PIPEB_ILK 0x45104 4101 #define _WM0_PIPEC_IVB 0x45200 4102 #define WM0_PIPE_ILK(pipe) _MMIO_PIPE3((pipe), _WM0_PIPEA_ILK, \ 4103 _WM0_PIPEB_ILK, _WM0_PIPEC_IVB) 4104 #define WM0_PIPE_PRIMARY_MASK REG_GENMASK(31, 16) 4105 #define WM0_PIPE_SPRITE_MASK REG_GENMASK(15, 8) 4106 #define WM0_PIPE_CURSOR_MASK REG_GENMASK(7, 0) 4107 #define WM0_PIPE_PRIMARY(x) REG_FIELD_PREP(WM0_PIPE_PRIMARY_MASK, (x)) 4108 #define WM0_PIPE_SPRITE(x) REG_FIELD_PREP(WM0_PIPE_SPRITE_MASK, (x)) 4109 #define WM0_PIPE_CURSOR(x) REG_FIELD_PREP(WM0_PIPE_CURSOR_MASK, (x)) 4110 #define WM1_LP_ILK _MMIO(0x45108) 4111 #define WM2_LP_ILK _MMIO(0x4510c) 4112 #define WM3_LP_ILK _MMIO(0x45110) 4113 #define WM_LP_ENABLE REG_BIT(31) 4114 #define WM_LP_LATENCY_MASK REG_GENMASK(30, 24) 4115 #define WM_LP_FBC_MASK_BDW REG_GENMASK(23, 19) 4116 #define WM_LP_FBC_MASK_ILK REG_GENMASK(23, 20) 4117 #define WM_LP_PRIMARY_MASK REG_GENMASK(18, 8) 4118 #define WM_LP_CURSOR_MASK REG_GENMASK(7, 0) 4119 #define WM_LP_LATENCY(x) REG_FIELD_PREP(WM_LP_LATENCY_MASK, (x)) 4120 #define WM_LP_FBC_BDW(x) REG_FIELD_PREP(WM_LP_FBC_MASK_BDW, (x)) 4121 #define WM_LP_FBC_ILK(x) REG_FIELD_PREP(WM_LP_FBC_MASK_ILK, (x)) 4122 #define WM_LP_PRIMARY(x) REG_FIELD_PREP(WM_LP_PRIMARY_MASK, (x)) 4123 #define WM_LP_CURSOR(x) REG_FIELD_PREP(WM_LP_CURSOR_MASK, (x)) 4124 #define WM1S_LP_ILK _MMIO(0x45120) 4125 #define WM2S_LP_IVB _MMIO(0x45124) 4126 #define WM3S_LP_IVB _MMIO(0x45128) 4127 #define WM_LP_SPRITE_ENABLE REG_BIT(31) /* ilk/snb WM1S only */ 4128 #define WM_LP_SPRITE_MASK REG_GENMASK(10, 0) 4129 #define WM_LP_SPRITE(x) REG_FIELD_PREP(WM_LP_SPRITE_MASK, (x)) 4130 4131 /* 4132 * The two pipe frame counter registers are not synchronized, so 4133 * reading a stable value is somewhat tricky. The following code 4134 * should work: 4135 * 4136 * do { 4137 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> 4138 * PIPE_FRAME_HIGH_SHIFT; 4139 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> 4140 * PIPE_FRAME_LOW_SHIFT); 4141 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> 4142 * PIPE_FRAME_HIGH_SHIFT); 4143 * } while (high1 != high2); 4144 * frame = (high1 << 8) | low1; 4145 */ 4146 #define _PIPEAFRAMEHIGH 0x70040 4147 #define PIPE_FRAME_HIGH_MASK 0x0000ffff 4148 #define PIPE_FRAME_HIGH_SHIFT 0 4149 #define _PIPEAFRAMEPIXEL 0x70044 4150 #define PIPE_FRAME_LOW_MASK 0xff000000 4151 #define PIPE_FRAME_LOW_SHIFT 24 4152 #define PIPE_PIXEL_MASK 0x00ffffff 4153 #define PIPE_PIXEL_SHIFT 0 4154 /* GM45+ just has to be different */ 4155 #define _PIPEA_FRMCOUNT_G4X 0x70040 4156 #define _PIPEA_FLIPCOUNT_G4X 0x70044 4157 #define PIPE_FRMCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FRMCOUNT_G4X) 4158 #define PIPE_FLIPCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FLIPCOUNT_G4X) 4159 4160 /* Cursor A & B regs */ 4161 #define _CURACNTR 0x70080 4162 /* Old style CUR*CNTR flags (desktop 8xx) */ 4163 #define CURSOR_ENABLE REG_BIT(31) 4164 #define CURSOR_PIPE_GAMMA_ENABLE REG_BIT(30) 4165 #define CURSOR_STRIDE_MASK REG_GENMASK(29, 28) 4166 #define CURSOR_STRIDE(stride) REG_FIELD_PREP(CURSOR_STRIDE_MASK, ffs(stride) - 9) /* 256,512,1k,2k */ 4167 #define CURSOR_FORMAT_MASK REG_GENMASK(26, 24) 4168 #define CURSOR_FORMAT_2C REG_FIELD_PREP(CURSOR_FORMAT_MASK, 0) 4169 #define CURSOR_FORMAT_3C REG_FIELD_PREP(CURSOR_FORMAT_MASK, 1) 4170 #define CURSOR_FORMAT_4C REG_FIELD_PREP(CURSOR_FORMAT_MASK, 2) 4171 #define CURSOR_FORMAT_ARGB REG_FIELD_PREP(CURSOR_FORMAT_MASK, 4) 4172 #define CURSOR_FORMAT_XRGB REG_FIELD_PREP(CURSOR_FORMAT_MASK, 5) 4173 /* New style CUR*CNTR flags */ 4174 #define MCURSOR_ARB_SLOTS_MASK REG_GENMASK(30, 28) /* icl+ */ 4175 #define MCURSOR_ARB_SLOTS(x) REG_FIELD_PREP(MCURSOR_ARB_SLOTS_MASK, (x)) /* icl+ */ 4176 #define MCURSOR_PIPE_SEL_MASK REG_GENMASK(29, 28) 4177 #define MCURSOR_PIPE_SEL(pipe) REG_FIELD_PREP(MCURSOR_PIPE_SEL_MASK, (pipe)) 4178 #define MCURSOR_PIPE_GAMMA_ENABLE REG_BIT(26) 4179 #define MCURSOR_PIPE_CSC_ENABLE REG_BIT(24) /* ilk+ */ 4180 #define MCURSOR_ROTATE_180 REG_BIT(15) 4181 #define MCURSOR_TRICKLE_FEED_DISABLE REG_BIT(14) 4182 #define MCURSOR_MODE_MASK 0x27 4183 #define MCURSOR_MODE_DISABLE 0x00 4184 #define MCURSOR_MODE_128_32B_AX 0x02 4185 #define MCURSOR_MODE_256_32B_AX 0x03 4186 #define MCURSOR_MODE_64_32B_AX 0x07 4187 #define MCURSOR_MODE_128_ARGB_AX (0x20 | MCURSOR_MODE_128_32B_AX) 4188 #define MCURSOR_MODE_256_ARGB_AX (0x20 | MCURSOR_MODE_256_32B_AX) 4189 #define MCURSOR_MODE_64_ARGB_AX (0x20 | MCURSOR_MODE_64_32B_AX) 4190 #define _CURABASE 0x70084 4191 #define _CURAPOS 0x70088 4192 #define CURSOR_POS_Y_SIGN REG_BIT(31) 4193 #define CURSOR_POS_Y_MASK REG_GENMASK(30, 16) 4194 #define CURSOR_POS_Y(y) REG_FIELD_PREP(CURSOR_POS_Y_MASK, (y)) 4195 #define CURSOR_POS_X_SIGN REG_BIT(15) 4196 #define CURSOR_POS_X_MASK REG_GENMASK(14, 0) 4197 #define CURSOR_POS_X(x) REG_FIELD_PREP(CURSOR_POS_X_MASK, (x)) 4198 #define _CURASIZE 0x700a0 /* 845/865 */ 4199 #define CURSOR_HEIGHT_MASK REG_GENMASK(21, 12) 4200 #define CURSOR_HEIGHT(h) REG_FIELD_PREP(CURSOR_HEIGHT_MASK, (h)) 4201 #define CURSOR_WIDTH_MASK REG_GENMASK(9, 0) 4202 #define CURSOR_WIDTH(w) REG_FIELD_PREP(CURSOR_WIDTH_MASK, (w)) 4203 #define _CUR_FBC_CTL_A 0x700a0 /* ivb+ */ 4204 #define CUR_FBC_EN REG_BIT(31) 4205 #define CUR_FBC_HEIGHT_MASK REG_GENMASK(7, 0) 4206 #define CUR_FBC_HEIGHT(h) REG_FIELD_PREP(CUR_FBC_HEIGHT_MASK, (h)) 4207 #define _CURASURFLIVE 0x700ac /* g4x+ */ 4208 #define _CURBCNTR 0x700c0 4209 #define _CURBBASE 0x700c4 4210 #define _CURBPOS 0x700c8 4211 4212 #define _CURBCNTR_IVB 0x71080 4213 #define _CURBBASE_IVB 0x71084 4214 #define _CURBPOS_IVB 0x71088 4215 4216 #define CURCNTR(pipe) _MMIO_CURSOR2(pipe, _CURACNTR) 4217 #define CURBASE(pipe) _MMIO_CURSOR2(pipe, _CURABASE) 4218 #define CURPOS(pipe) _MMIO_CURSOR2(pipe, _CURAPOS) 4219 #define CURSIZE(pipe) _MMIO_CURSOR2(pipe, _CURASIZE) 4220 #define CUR_FBC_CTL(pipe) _MMIO_CURSOR2(pipe, _CUR_FBC_CTL_A) 4221 #define CURSURFLIVE(pipe) _MMIO_CURSOR2(pipe, _CURASURFLIVE) 4222 4223 #define CURSOR_A_OFFSET 0x70080 4224 #define CURSOR_B_OFFSET 0x700c0 4225 #define CHV_CURSOR_C_OFFSET 0x700e0 4226 #define IVB_CURSOR_B_OFFSET 0x71080 4227 #define IVB_CURSOR_C_OFFSET 0x72080 4228 #define TGL_CURSOR_D_OFFSET 0x73080 4229 4230 /* Display A control */ 4231 #define _DSPAADDR_VLV 0x7017C /* vlv/chv */ 4232 #define _DSPACNTR 0x70180 4233 #define DISP_ENABLE REG_BIT(31) 4234 #define DISP_PIPE_GAMMA_ENABLE REG_BIT(30) 4235 #define DISP_FORMAT_MASK REG_GENMASK(29, 26) 4236 #define DISP_FORMAT_8BPP REG_FIELD_PREP(DISP_FORMAT_MASK, 2) 4237 #define DISP_FORMAT_BGRA555 REG_FIELD_PREP(DISP_FORMAT_MASK, 3) 4238 #define DISP_FORMAT_BGRX555 REG_FIELD_PREP(DISP_FORMAT_MASK, 4) 4239 #define DISP_FORMAT_BGRX565 REG_FIELD_PREP(DISP_FORMAT_MASK, 5) 4240 #define DISP_FORMAT_BGRX888 REG_FIELD_PREP(DISP_FORMAT_MASK, 6) 4241 #define DISP_FORMAT_BGRA888 REG_FIELD_PREP(DISP_FORMAT_MASK, 7) 4242 #define DISP_FORMAT_RGBX101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 8) 4243 #define DISP_FORMAT_RGBA101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 9) 4244 #define DISP_FORMAT_BGRX101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 10) 4245 #define DISP_FORMAT_BGRA101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 11) 4246 #define DISP_FORMAT_RGBX161616 REG_FIELD_PREP(DISP_FORMAT_MASK, 12) 4247 #define DISP_FORMAT_RGBX888 REG_FIELD_PREP(DISP_FORMAT_MASK, 14) 4248 #define DISP_FORMAT_RGBA888 REG_FIELD_PREP(DISP_FORMAT_MASK, 15) 4249 #define DISP_STEREO_ENABLE REG_BIT(25) 4250 #define DISP_PIPE_CSC_ENABLE REG_BIT(24) /* ilk+ */ 4251 #define DISP_PIPE_SEL_MASK REG_GENMASK(25, 24) 4252 #define DISP_PIPE_SEL(pipe) REG_FIELD_PREP(DISP_PIPE_SEL_MASK, (pipe)) 4253 #define DISP_SRC_KEY_ENABLE REG_BIT(22) 4254 #define DISP_LINE_DOUBLE REG_BIT(20) 4255 #define DISP_STEREO_POLARITY_SECOND REG_BIT(18) 4256 #define DISP_ALPHA_PREMULTIPLY REG_BIT(16) /* CHV pipe B */ 4257 #define DISP_ROTATE_180 REG_BIT(15) 4258 #define DISP_TRICKLE_FEED_DISABLE REG_BIT(14) /* g4x+ */ 4259 #define DISP_TILED REG_BIT(10) 4260 #define DISP_ASYNC_FLIP REG_BIT(9) /* g4x+ */ 4261 #define DISP_MIRROR REG_BIT(8) /* CHV pipe B */ 4262 #define _DSPAADDR 0x70184 4263 #define _DSPASTRIDE 0x70188 4264 #define _DSPAPOS 0x7018C /* reserved */ 4265 #define DISP_POS_Y_MASK REG_GENMASK(31, 16) 4266 #define DISP_POS_Y(y) REG_FIELD_PREP(DISP_POS_Y_MASK, (y)) 4267 #define DISP_POS_X_MASK REG_GENMASK(15, 0) 4268 #define DISP_POS_X(x) REG_FIELD_PREP(DISP_POS_X_MASK, (x)) 4269 #define _DSPASIZE 0x70190 4270 #define DISP_HEIGHT_MASK REG_GENMASK(31, 16) 4271 #define DISP_HEIGHT(h) REG_FIELD_PREP(DISP_HEIGHT_MASK, (h)) 4272 #define DISP_WIDTH_MASK REG_GENMASK(15, 0) 4273 #define DISP_WIDTH(w) REG_FIELD_PREP(DISP_WIDTH_MASK, (w)) 4274 #define _DSPASURF 0x7019C /* 965+ only */ 4275 #define DISP_ADDR_MASK REG_GENMASK(31, 12) 4276 #define _DSPATILEOFF 0x701A4 /* 965+ only */ 4277 #define DISP_OFFSET_Y_MASK REG_GENMASK(31, 16) 4278 #define DISP_OFFSET_Y(y) REG_FIELD_PREP(DISP_OFFSET_Y_MASK, (y)) 4279 #define DISP_OFFSET_X_MASK REG_GENMASK(15, 0) 4280 #define DISP_OFFSET_X(x) REG_FIELD_PREP(DISP_OFFSET_X_MASK, (x)) 4281 #define _DSPAOFFSET 0x701A4 /* HSW */ 4282 #define _DSPASURFLIVE 0x701AC 4283 #define _DSPAGAMC 0x701E0 4284 4285 #define DSPADDR_VLV(plane) _MMIO_PIPE2(plane, _DSPAADDR_VLV) 4286 #define DSPCNTR(plane) _MMIO_PIPE2(plane, _DSPACNTR) 4287 #define DSPADDR(plane) _MMIO_PIPE2(plane, _DSPAADDR) 4288 #define DSPSTRIDE(plane) _MMIO_PIPE2(plane, _DSPASTRIDE) 4289 #define DSPPOS(plane) _MMIO_PIPE2(plane, _DSPAPOS) 4290 #define DSPSIZE(plane) _MMIO_PIPE2(plane, _DSPASIZE) 4291 #define DSPSURF(plane) _MMIO_PIPE2(plane, _DSPASURF) 4292 #define DSPTILEOFF(plane) _MMIO_PIPE2(plane, _DSPATILEOFF) 4293 #define DSPLINOFF(plane) DSPADDR(plane) 4294 #define DSPOFFSET(plane) _MMIO_PIPE2(plane, _DSPAOFFSET) 4295 #define DSPSURFLIVE(plane) _MMIO_PIPE2(plane, _DSPASURFLIVE) 4296 #define DSPGAMC(plane, i) _MMIO_PIPE2(plane, _DSPAGAMC + (5 - (i)) * 4) /* plane C only, 6 x u0.8 */ 4297 4298 /* CHV pipe B blender and primary plane */ 4299 #define _CHV_BLEND_A 0x60a00 4300 #define CHV_BLEND_MASK REG_GENMASK(31, 30) 4301 #define CHV_BLEND_LEGACY REG_FIELD_PREP(CHV_BLEND_MASK, 0) 4302 #define CHV_BLEND_ANDROID REG_FIELD_PREP(CHV_BLEND_MASK, 1) 4303 #define CHV_BLEND_MPO REG_FIELD_PREP(CHV_BLEND_MASK, 2) 4304 #define _CHV_CANVAS_A 0x60a04 4305 #define CHV_CANVAS_RED_MASK REG_GENMASK(29, 20) 4306 #define CHV_CANVAS_GREEN_MASK REG_GENMASK(19, 10) 4307 #define CHV_CANVAS_BLUE_MASK REG_GENMASK(9, 0) 4308 #define _PRIMPOS_A 0x60a08 4309 #define PRIM_POS_Y_MASK REG_GENMASK(31, 16) 4310 #define PRIM_POS_Y(y) REG_FIELD_PREP(PRIM_POS_Y_MASK, (y)) 4311 #define PRIM_POS_X_MASK REG_GENMASK(15, 0) 4312 #define PRIM_POS_X(x) REG_FIELD_PREP(PRIM_POS_X_MASK, (x)) 4313 #define _PRIMSIZE_A 0x60a0c 4314 #define PRIM_HEIGHT_MASK REG_GENMASK(31, 16) 4315 #define PRIM_HEIGHT(h) REG_FIELD_PREP(PRIM_HEIGHT_MASK, (h)) 4316 #define PRIM_WIDTH_MASK REG_GENMASK(15, 0) 4317 #define PRIM_WIDTH(w) REG_FIELD_PREP(PRIM_WIDTH_MASK, (w)) 4318 #define _PRIMCNSTALPHA_A 0x60a10 4319 #define PRIM_CONST_ALPHA_ENABLE REG_BIT(31) 4320 #define PRIM_CONST_ALPHA_MASK REG_GENMASK(7, 0) 4321 #define PRIM_CONST_ALPHA(alpha) REG_FIELD_PREP(PRIM_CONST_ALPHA_MASK, (alpha)) 4322 4323 #define CHV_BLEND(pipe) _MMIO_TRANS2(pipe, _CHV_BLEND_A) 4324 #define CHV_CANVAS(pipe) _MMIO_TRANS2(pipe, _CHV_CANVAS_A) 4325 #define PRIMPOS(plane) _MMIO_TRANS2(plane, _PRIMPOS_A) 4326 #define PRIMSIZE(plane) _MMIO_TRANS2(plane, _PRIMSIZE_A) 4327 #define PRIMCNSTALPHA(plane) _MMIO_TRANS2(plane, _PRIMCNSTALPHA_A) 4328 4329 /* Display/Sprite base address macros */ 4330 #define DISP_BASEADDR_MASK (0xfffff000) 4331 #define I915_LO_DISPBASE(val) ((val) & ~DISP_BASEADDR_MASK) 4332 #define I915_HI_DISPBASE(val) ((val) & DISP_BASEADDR_MASK) 4333 4334 /* 4335 * VBIOS flags 4336 * gen2: 4337 * [00:06] alm,mgm 4338 * [10:16] all 4339 * [30:32] alm,mgm 4340 * gen3+: 4341 * [00:0f] all 4342 * [10:1f] all 4343 * [30:32] all 4344 */ 4345 #define SWF0(i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70410 + (i) * 4) 4346 #define SWF1(i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x71410 + (i) * 4) 4347 #define SWF3(i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x72414 + (i) * 4) 4348 #define SWF_ILK(i) _MMIO(0x4F000 + (i) * 4) 4349 4350 /* Pipe B */ 4351 #define _PIPEBDSL (DISPLAY_MMIO_BASE(dev_priv) + 0x71000) 4352 #define _PIPEBCONF (DISPLAY_MMIO_BASE(dev_priv) + 0x71008) 4353 #define _PIPEBSTAT (DISPLAY_MMIO_BASE(dev_priv) + 0x71024) 4354 #define _PIPEBFRAMEHIGH 0x71040 4355 #define _PIPEBFRAMEPIXEL 0x71044 4356 #define _PIPEB_FRMCOUNT_G4X (DISPLAY_MMIO_BASE(dev_priv) + 0x71040) 4357 #define _PIPEB_FLIPCOUNT_G4X (DISPLAY_MMIO_BASE(dev_priv) + 0x71044) 4358 4359 4360 /* Display B control */ 4361 #define _DSPBCNTR (DISPLAY_MMIO_BASE(dev_priv) + 0x71180) 4362 #define DISP_ALPHA_TRANS_ENABLE REG_BIT(15) 4363 #define DISP_SPRITE_ABOVE_OVERLAY REG_BIT(0) 4364 #define _DSPBADDR (DISPLAY_MMIO_BASE(dev_priv) + 0x71184) 4365 #define _DSPBSTRIDE (DISPLAY_MMIO_BASE(dev_priv) + 0x71188) 4366 #define _DSPBPOS (DISPLAY_MMIO_BASE(dev_priv) + 0x7118C) 4367 #define _DSPBSIZE (DISPLAY_MMIO_BASE(dev_priv) + 0x71190) 4368 #define _DSPBSURF (DISPLAY_MMIO_BASE(dev_priv) + 0x7119C) 4369 #define _DSPBTILEOFF (DISPLAY_MMIO_BASE(dev_priv) + 0x711A4) 4370 #define _DSPBOFFSET (DISPLAY_MMIO_BASE(dev_priv) + 0x711A4) 4371 #define _DSPBSURFLIVE (DISPLAY_MMIO_BASE(dev_priv) + 0x711AC) 4372 4373 /* ICL DSI 0 and 1 */ 4374 #define _PIPEDSI0CONF 0x7b008 4375 #define _PIPEDSI1CONF 0x7b808 4376 4377 /* Sprite A control */ 4378 #define _DVSACNTR 0x72180 4379 #define DVS_ENABLE REG_BIT(31) 4380 #define DVS_PIPE_GAMMA_ENABLE REG_BIT(30) 4381 #define DVS_YUV_RANGE_CORRECTION_DISABLE REG_BIT(27) 4382 #define DVS_FORMAT_MASK REG_GENMASK(26, 25) 4383 #define DVS_FORMAT_YUV422 REG_FIELD_PREP(DVS_FORMAT_MASK, 0) 4384 #define DVS_FORMAT_RGBX101010 REG_FIELD_PREP(DVS_FORMAT_MASK, 1) 4385 #define DVS_FORMAT_RGBX888 REG_FIELD_PREP(DVS_FORMAT_MASK, 2) 4386 #define DVS_FORMAT_RGBX161616 REG_FIELD_PREP(DVS_FORMAT_MASK, 3) 4387 #define DVS_PIPE_CSC_ENABLE REG_BIT(24) 4388 #define DVS_SOURCE_KEY REG_BIT(22) 4389 #define DVS_RGB_ORDER_XBGR REG_BIT(20) 4390 #define DVS_YUV_FORMAT_BT709 REG_BIT(18) 4391 #define DVS_YUV_ORDER_MASK REG_GENMASK(17, 16) 4392 #define DVS_YUV_ORDER_YUYV REG_FIELD_PREP(DVS_YUV_ORDER_MASK, 0) 4393 #define DVS_YUV_ORDER_UYVY REG_FIELD_PREP(DVS_YUV_ORDER_MASK, 1) 4394 #define DVS_YUV_ORDER_YVYU REG_FIELD_PREP(DVS_YUV_ORDER_MASK, 2) 4395 #define DVS_YUV_ORDER_VYUY REG_FIELD_PREP(DVS_YUV_ORDER_MASK, 3) 4396 #define DVS_ROTATE_180 REG_BIT(15) 4397 #define DVS_TRICKLE_FEED_DISABLE REG_BIT(14) 4398 #define DVS_TILED REG_BIT(10) 4399 #define DVS_DEST_KEY REG_BIT(2) 4400 #define _DVSALINOFF 0x72184 4401 #define _DVSASTRIDE 0x72188 4402 #define _DVSAPOS 0x7218c 4403 #define DVS_POS_Y_MASK REG_GENMASK(31, 16) 4404 #define DVS_POS_Y(y) REG_FIELD_PREP(DVS_POS_Y_MASK, (y)) 4405 #define DVS_POS_X_MASK REG_GENMASK(15, 0) 4406 #define DVS_POS_X(x) REG_FIELD_PREP(DVS_POS_X_MASK, (x)) 4407 #define _DVSASIZE 0x72190 4408 #define DVS_HEIGHT_MASK REG_GENMASK(31, 16) 4409 #define DVS_HEIGHT(h) REG_FIELD_PREP(DVS_HEIGHT_MASK, (h)) 4410 #define DVS_WIDTH_MASK REG_GENMASK(15, 0) 4411 #define DVS_WIDTH(w) REG_FIELD_PREP(DVS_WIDTH_MASK, (w)) 4412 #define _DVSAKEYVAL 0x72194 4413 #define _DVSAKEYMSK 0x72198 4414 #define _DVSASURF 0x7219c 4415 #define DVS_ADDR_MASK REG_GENMASK(31, 12) 4416 #define _DVSAKEYMAXVAL 0x721a0 4417 #define _DVSATILEOFF 0x721a4 4418 #define DVS_OFFSET_Y_MASK REG_GENMASK(31, 16) 4419 #define DVS_OFFSET_Y(y) REG_FIELD_PREP(DVS_OFFSET_Y_MASK, (y)) 4420 #define DVS_OFFSET_X_MASK REG_GENMASK(15, 0) 4421 #define DVS_OFFSET_X(x) REG_FIELD_PREP(DVS_OFFSET_X_MASK, (x)) 4422 #define _DVSASURFLIVE 0x721ac 4423 #define _DVSAGAMC_G4X 0x721e0 /* g4x */ 4424 #define _DVSASCALE 0x72204 4425 #define DVS_SCALE_ENABLE REG_BIT(31) 4426 #define DVS_FILTER_MASK REG_GENMASK(30, 29) 4427 #define DVS_FILTER_MEDIUM REG_FIELD_PREP(DVS_FILTER_MASK, 0) 4428 #define DVS_FILTER_ENHANCING REG_FIELD_PREP(DVS_FILTER_MASK, 1) 4429 #define DVS_FILTER_SOFTENING REG_FIELD_PREP(DVS_FILTER_MASK, 2) 4430 #define DVS_VERTICAL_OFFSET_HALF REG_BIT(28) /* must be enabled below */ 4431 #define DVS_VERTICAL_OFFSET_ENABLE REG_BIT(27) 4432 #define DVS_SRC_WIDTH_MASK REG_GENMASK(26, 16) 4433 #define DVS_SRC_WIDTH(w) REG_FIELD_PREP(DVS_SRC_WIDTH_MASK, (w)) 4434 #define DVS_SRC_HEIGHT_MASK REG_GENMASK(10, 0) 4435 #define DVS_SRC_HEIGHT(h) REG_FIELD_PREP(DVS_SRC_HEIGHT_MASK, (h)) 4436 #define _DVSAGAMC_ILK 0x72300 /* ilk/snb */ 4437 #define _DVSAGAMCMAX_ILK 0x72340 /* ilk/snb */ 4438 4439 #define _DVSBCNTR 0x73180 4440 #define _DVSBLINOFF 0x73184 4441 #define _DVSBSTRIDE 0x73188 4442 #define _DVSBPOS 0x7318c 4443 #define _DVSBSIZE 0x73190 4444 #define _DVSBKEYVAL 0x73194 4445 #define _DVSBKEYMSK 0x73198 4446 #define _DVSBSURF 0x7319c 4447 #define _DVSBKEYMAXVAL 0x731a0 4448 #define _DVSBTILEOFF 0x731a4 4449 #define _DVSBSURFLIVE 0x731ac 4450 #define _DVSBGAMC_G4X 0x731e0 /* g4x */ 4451 #define _DVSBSCALE 0x73204 4452 #define _DVSBGAMC_ILK 0x73300 /* ilk/snb */ 4453 #define _DVSBGAMCMAX_ILK 0x73340 /* ilk/snb */ 4454 4455 #define DVSCNTR(pipe) _MMIO_PIPE(pipe, _DVSACNTR, _DVSBCNTR) 4456 #define DVSLINOFF(pipe) _MMIO_PIPE(pipe, _DVSALINOFF, _DVSBLINOFF) 4457 #define DVSSTRIDE(pipe) _MMIO_PIPE(pipe, _DVSASTRIDE, _DVSBSTRIDE) 4458 #define DVSPOS(pipe) _MMIO_PIPE(pipe, _DVSAPOS, _DVSBPOS) 4459 #define DVSSURF(pipe) _MMIO_PIPE(pipe, _DVSASURF, _DVSBSURF) 4460 #define DVSKEYMAX(pipe) _MMIO_PIPE(pipe, _DVSAKEYMAXVAL, _DVSBKEYMAXVAL) 4461 #define DVSSIZE(pipe) _MMIO_PIPE(pipe, _DVSASIZE, _DVSBSIZE) 4462 #define DVSSCALE(pipe) _MMIO_PIPE(pipe, _DVSASCALE, _DVSBSCALE) 4463 #define DVSTILEOFF(pipe) _MMIO_PIPE(pipe, _DVSATILEOFF, _DVSBTILEOFF) 4464 #define DVSKEYVAL(pipe) _MMIO_PIPE(pipe, _DVSAKEYVAL, _DVSBKEYVAL) 4465 #define DVSKEYMSK(pipe) _MMIO_PIPE(pipe, _DVSAKEYMSK, _DVSBKEYMSK) 4466 #define DVSSURFLIVE(pipe) _MMIO_PIPE(pipe, _DVSASURFLIVE, _DVSBSURFLIVE) 4467 #define DVSGAMC_G4X(pipe, i) _MMIO(_PIPE(pipe, _DVSAGAMC_G4X, _DVSBGAMC_G4X) + (5 - (i)) * 4) /* 6 x u0.8 */ 4468 #define DVSGAMC_ILK(pipe, i) _MMIO(_PIPE(pipe, _DVSAGAMC_ILK, _DVSBGAMC_ILK) + (i) * 4) /* 16 x u0.10 */ 4469 #define DVSGAMCMAX_ILK(pipe, i) _MMIO(_PIPE(pipe, _DVSAGAMCMAX_ILK, _DVSBGAMCMAX_ILK) + (i) * 4) /* 3 x u1.10 */ 4470 4471 #define _SPRA_CTL 0x70280 4472 #define SPRITE_ENABLE REG_BIT(31) 4473 #define SPRITE_PIPE_GAMMA_ENABLE REG_BIT(30) 4474 #define SPRITE_YUV_RANGE_CORRECTION_DISABLE REG_BIT(28) 4475 #define SPRITE_FORMAT_MASK REG_GENMASK(27, 25) 4476 #define SPRITE_FORMAT_YUV422 REG_FIELD_PREP(SPRITE_FORMAT_MASK, 0) 4477 #define SPRITE_FORMAT_RGBX101010 REG_FIELD_PREP(SPRITE_FORMAT_MASK, 1) 4478 #define SPRITE_FORMAT_RGBX888 REG_FIELD_PREP(SPRITE_FORMAT_MASK, 2) 4479 #define SPRITE_FORMAT_RGBX161616 REG_FIELD_PREP(SPRITE_FORMAT_MASK, 3) 4480 #define SPRITE_FORMAT_YUV444 REG_FIELD_PREP(SPRITE_FORMAT_MASK, 4) 4481 #define SPRITE_FORMAT_XR_BGR101010 REG_FIELD_PREP(SPRITE_FORMAT_MASK, 5) /* Extended range */ 4482 #define SPRITE_PIPE_CSC_ENABLE REG_BIT(24) 4483 #define SPRITE_SOURCE_KEY REG_BIT(22) 4484 #define SPRITE_RGB_ORDER_RGBX REG_BIT(20) /* only for 888 and 161616 */ 4485 #define SPRITE_YUV_TO_RGB_CSC_DISABLE REG_BIT(19) 4486 #define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 REG_BIT(18) /* 0 is BT601 */ 4487 #define SPRITE_YUV_ORDER_MASK REG_GENMASK(17, 16) 4488 #define SPRITE_YUV_ORDER_YUYV REG_FIELD_PREP(SPRITE_YUV_ORDER_MASK, 0) 4489 #define SPRITE_YUV_ORDER_UYVY REG_FIELD_PREP(SPRITE_YUV_ORDER_MASK, 1) 4490 #define SPRITE_YUV_ORDER_YVYU REG_FIELD_PREP(SPRITE_YUV_ORDER_MASK, 2) 4491 #define SPRITE_YUV_ORDER_VYUY REG_FIELD_PREP(SPRITE_YUV_ORDER_MASK, 3) 4492 #define SPRITE_ROTATE_180 REG_BIT(15) 4493 #define SPRITE_TRICKLE_FEED_DISABLE REG_BIT(14) 4494 #define SPRITE_PLANE_GAMMA_DISABLE REG_BIT(13) 4495 #define SPRITE_TILED REG_BIT(10) 4496 #define SPRITE_DEST_KEY REG_BIT(2) 4497 #define _SPRA_LINOFF 0x70284 4498 #define _SPRA_STRIDE 0x70288 4499 #define _SPRA_POS 0x7028c 4500 #define SPRITE_POS_Y_MASK REG_GENMASK(31, 16) 4501 #define SPRITE_POS_Y(y) REG_FIELD_PREP(SPRITE_POS_Y_MASK, (y)) 4502 #define SPRITE_POS_X_MASK REG_GENMASK(15, 0) 4503 #define SPRITE_POS_X(x) REG_FIELD_PREP(SPRITE_POS_X_MASK, (x)) 4504 #define _SPRA_SIZE 0x70290 4505 #define SPRITE_HEIGHT_MASK REG_GENMASK(31, 16) 4506 #define SPRITE_HEIGHT(h) REG_FIELD_PREP(SPRITE_HEIGHT_MASK, (h)) 4507 #define SPRITE_WIDTH_MASK REG_GENMASK(15, 0) 4508 #define SPRITE_WIDTH(w) REG_FIELD_PREP(SPRITE_WIDTH_MASK, (w)) 4509 #define _SPRA_KEYVAL 0x70294 4510 #define _SPRA_KEYMSK 0x70298 4511 #define _SPRA_SURF 0x7029c 4512 #define SPRITE_ADDR_MASK REG_GENMASK(31, 12) 4513 #define _SPRA_KEYMAX 0x702a0 4514 #define _SPRA_TILEOFF 0x702a4 4515 #define SPRITE_OFFSET_Y_MASK REG_GENMASK(31, 16) 4516 #define SPRITE_OFFSET_Y(y) REG_FIELD_PREP(SPRITE_OFFSET_Y_MASK, (y)) 4517 #define SPRITE_OFFSET_X_MASK REG_GENMASK(15, 0) 4518 #define SPRITE_OFFSET_X(x) REG_FIELD_PREP(SPRITE_OFFSET_X_MASK, (x)) 4519 #define _SPRA_OFFSET 0x702a4 4520 #define _SPRA_SURFLIVE 0x702ac 4521 #define _SPRA_SCALE 0x70304 4522 #define SPRITE_SCALE_ENABLE REG_BIT(31) 4523 #define SPRITE_FILTER_MASK REG_GENMASK(30, 29) 4524 #define SPRITE_FILTER_MEDIUM REG_FIELD_PREP(SPRITE_FILTER_MASK, 0) 4525 #define SPRITE_FILTER_ENHANCING REG_FIELD_PREP(SPRITE_FILTER_MASK, 1) 4526 #define SPRITE_FILTER_SOFTENING REG_FIELD_PREP(SPRITE_FILTER_MASK, 2) 4527 #define SPRITE_VERTICAL_OFFSET_HALF REG_BIT(28) /* must be enabled below */ 4528 #define SPRITE_VERTICAL_OFFSET_ENABLE REG_BIT(27) 4529 #define SPRITE_SRC_WIDTH_MASK REG_GENMASK(26, 16) 4530 #define SPRITE_SRC_WIDTH(w) REG_FIELD_PREP(SPRITE_SRC_WIDTH_MASK, (w)) 4531 #define SPRITE_SRC_HEIGHT_MASK REG_GENMASK(10, 0) 4532 #define SPRITE_SRC_HEIGHT(h) REG_FIELD_PREP(SPRITE_SRC_HEIGHT_MASK, (h)) 4533 #define _SPRA_GAMC 0x70400 4534 #define _SPRA_GAMC16 0x70440 4535 #define _SPRA_GAMC17 0x7044c 4536 4537 #define _SPRB_CTL 0x71280 4538 #define _SPRB_LINOFF 0x71284 4539 #define _SPRB_STRIDE 0x71288 4540 #define _SPRB_POS 0x7128c 4541 #define _SPRB_SIZE 0x71290 4542 #define _SPRB_KEYVAL 0x71294 4543 #define _SPRB_KEYMSK 0x71298 4544 #define _SPRB_SURF 0x7129c 4545 #define _SPRB_KEYMAX 0x712a0 4546 #define _SPRB_TILEOFF 0x712a4 4547 #define _SPRB_OFFSET 0x712a4 4548 #define _SPRB_SURFLIVE 0x712ac 4549 #define _SPRB_SCALE 0x71304 4550 #define _SPRB_GAMC 0x71400 4551 #define _SPRB_GAMC16 0x71440 4552 #define _SPRB_GAMC17 0x7144c 4553 4554 #define SPRCTL(pipe) _MMIO_PIPE(pipe, _SPRA_CTL, _SPRB_CTL) 4555 #define SPRLINOFF(pipe) _MMIO_PIPE(pipe, _SPRA_LINOFF, _SPRB_LINOFF) 4556 #define SPRSTRIDE(pipe) _MMIO_PIPE(pipe, _SPRA_STRIDE, _SPRB_STRIDE) 4557 #define SPRPOS(pipe) _MMIO_PIPE(pipe, _SPRA_POS, _SPRB_POS) 4558 #define SPRSIZE(pipe) _MMIO_PIPE(pipe, _SPRA_SIZE, _SPRB_SIZE) 4559 #define SPRKEYVAL(pipe) _MMIO_PIPE(pipe, _SPRA_KEYVAL, _SPRB_KEYVAL) 4560 #define SPRKEYMSK(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMSK, _SPRB_KEYMSK) 4561 #define SPRSURF(pipe) _MMIO_PIPE(pipe, _SPRA_SURF, _SPRB_SURF) 4562 #define SPRKEYMAX(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMAX, _SPRB_KEYMAX) 4563 #define SPRTILEOFF(pipe) _MMIO_PIPE(pipe, _SPRA_TILEOFF, _SPRB_TILEOFF) 4564 #define SPROFFSET(pipe) _MMIO_PIPE(pipe, _SPRA_OFFSET, _SPRB_OFFSET) 4565 #define SPRSCALE(pipe) _MMIO_PIPE(pipe, _SPRA_SCALE, _SPRB_SCALE) 4566 #define SPRGAMC(pipe, i) _MMIO(_PIPE(pipe, _SPRA_GAMC, _SPRB_GAMC) + (i) * 4) /* 16 x u0.10 */ 4567 #define SPRGAMC16(pipe, i) _MMIO(_PIPE(pipe, _SPRA_GAMC16, _SPRB_GAMC16) + (i) * 4) /* 3 x u1.10 */ 4568 #define SPRGAMC17(pipe, i) _MMIO(_PIPE(pipe, _SPRA_GAMC17, _SPRB_GAMC17) + (i) * 4) /* 3 x u2.10 */ 4569 #define SPRSURFLIVE(pipe) _MMIO_PIPE(pipe, _SPRA_SURFLIVE, _SPRB_SURFLIVE) 4570 4571 #define _SPACNTR (VLV_DISPLAY_BASE + 0x72180) 4572 #define SP_ENABLE REG_BIT(31) 4573 #define SP_PIPE_GAMMA_ENABLE REG_BIT(30) 4574 #define SP_FORMAT_MASK REG_GENMASK(29, 26) 4575 #define SP_FORMAT_YUV422 REG_FIELD_PREP(SP_FORMAT_MASK, 0) 4576 #define SP_FORMAT_8BPP REG_FIELD_PREP(SP_FORMAT_MASK, 2) 4577 #define SP_FORMAT_BGR565 REG_FIELD_PREP(SP_FORMAT_MASK, 5) 4578 #define SP_FORMAT_BGRX8888 REG_FIELD_PREP(SP_FORMAT_MASK, 6) 4579 #define SP_FORMAT_BGRA8888 REG_FIELD_PREP(SP_FORMAT_MASK, 7) 4580 #define SP_FORMAT_RGBX1010102 REG_FIELD_PREP(SP_FORMAT_MASK, 8) 4581 #define SP_FORMAT_RGBA1010102 REG_FIELD_PREP(SP_FORMAT_MASK, 9) 4582 #define SP_FORMAT_BGRX1010102 REG_FIELD_PREP(SP_FORMAT_MASK, 10) /* CHV pipe B */ 4583 #define SP_FORMAT_BGRA1010102 REG_FIELD_PREP(SP_FORMAT_MASK, 11) /* CHV pipe B */ 4584 #define SP_FORMAT_RGBX8888 REG_FIELD_PREP(SP_FORMAT_MASK, 14) 4585 #define SP_FORMAT_RGBA8888 REG_FIELD_PREP(SP_FORMAT_MASK, 15) 4586 #define SP_ALPHA_PREMULTIPLY REG_BIT(23) /* CHV pipe B */ 4587 #define SP_SOURCE_KEY REG_BIT(22) 4588 #define SP_YUV_FORMAT_BT709 REG_BIT(18) 4589 #define SP_YUV_ORDER_MASK REG_GENMASK(17, 16) 4590 #define SP_YUV_ORDER_YUYV REG_FIELD_PREP(SP_YUV_ORDER_MASK, 0) 4591 #define SP_YUV_ORDER_UYVY REG_FIELD_PREP(SP_YUV_ORDER_MASK, 1) 4592 #define SP_YUV_ORDER_YVYU REG_FIELD_PREP(SP_YUV_ORDER_MASK, 2) 4593 #define SP_YUV_ORDER_VYUY REG_FIELD_PREP(SP_YUV_ORDER_MASK, 3) 4594 #define SP_ROTATE_180 REG_BIT(15) 4595 #define SP_TILED REG_BIT(10) 4596 #define SP_MIRROR REG_BIT(8) /* CHV pipe B */ 4597 #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184) 4598 #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188) 4599 #define _SPAPOS (VLV_DISPLAY_BASE + 0x7218c) 4600 #define SP_POS_Y_MASK REG_GENMASK(31, 16) 4601 #define SP_POS_Y(y) REG_FIELD_PREP(SP_POS_Y_MASK, (y)) 4602 #define SP_POS_X_MASK REG_GENMASK(15, 0) 4603 #define SP_POS_X(x) REG_FIELD_PREP(SP_POS_X_MASK, (x)) 4604 #define _SPASIZE (VLV_DISPLAY_BASE + 0x72190) 4605 #define SP_HEIGHT_MASK REG_GENMASK(31, 16) 4606 #define SP_HEIGHT(h) REG_FIELD_PREP(SP_HEIGHT_MASK, (h)) 4607 #define SP_WIDTH_MASK REG_GENMASK(15, 0) 4608 #define SP_WIDTH(w) REG_FIELD_PREP(SP_WIDTH_MASK, (w)) 4609 #define _SPAKEYMINVAL (VLV_DISPLAY_BASE + 0x72194) 4610 #define _SPAKEYMSK (VLV_DISPLAY_BASE + 0x72198) 4611 #define _SPASURF (VLV_DISPLAY_BASE + 0x7219c) 4612 #define SP_ADDR_MASK REG_GENMASK(31, 12) 4613 #define _SPAKEYMAXVAL (VLV_DISPLAY_BASE + 0x721a0) 4614 #define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4) 4615 #define SP_OFFSET_Y_MASK REG_GENMASK(31, 16) 4616 #define SP_OFFSET_Y(y) REG_FIELD_PREP(SP_OFFSET_Y_MASK, (y)) 4617 #define SP_OFFSET_X_MASK REG_GENMASK(15, 0) 4618 #define SP_OFFSET_X(x) REG_FIELD_PREP(SP_OFFSET_X_MASK, (x)) 4619 #define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8) 4620 #define SP_CONST_ALPHA_ENABLE REG_BIT(31) 4621 #define SP_CONST_ALPHA_MASK REG_GENMASK(7, 0) 4622 #define SP_CONST_ALPHA(alpha) REG_FIELD_PREP(SP_CONST_ALPHA_MASK, (alpha)) 4623 #define _SPACLRC0 (VLV_DISPLAY_BASE + 0x721d0) 4624 #define SP_CONTRAST_MASK REG_GENMASK(26, 18) 4625 #define SP_CONTRAST(x) REG_FIELD_PREP(SP_CONTRAST_MASK, (x)) /* u3.6 */ 4626 #define SP_BRIGHTNESS_MASK REG_GENMASK(7, 0) 4627 #define SP_BRIGHTNESS(x) REG_FIELD_PREP(SP_BRIGHTNESS_MASK, (x)) /* s8 */ 4628 #define _SPACLRC1 (VLV_DISPLAY_BASE + 0x721d4) 4629 #define SP_SH_SIN_MASK REG_GENMASK(26, 16) 4630 #define SP_SH_SIN(x) REG_FIELD_PREP(SP_SH_SIN_MASK, (x)) /* s4.7 */ 4631 #define SP_SH_COS_MASK REG_GENMASK(9, 0) 4632 #define SP_SH_COS(x) REG_FIELD_PREP(SP_SH_COS_MASK, (x)) /* u3.7 */ 4633 #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721e0) 4634 4635 #define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280) 4636 #define _SPBLINOFF (VLV_DISPLAY_BASE + 0x72284) 4637 #define _SPBSTRIDE (VLV_DISPLAY_BASE + 0x72288) 4638 #define _SPBPOS (VLV_DISPLAY_BASE + 0x7228c) 4639 #define _SPBSIZE (VLV_DISPLAY_BASE + 0x72290) 4640 #define _SPBKEYMINVAL (VLV_DISPLAY_BASE + 0x72294) 4641 #define _SPBKEYMSK (VLV_DISPLAY_BASE + 0x72298) 4642 #define _SPBSURF (VLV_DISPLAY_BASE + 0x7229c) 4643 #define _SPBKEYMAXVAL (VLV_DISPLAY_BASE + 0x722a0) 4644 #define _SPBTILEOFF (VLV_DISPLAY_BASE + 0x722a4) 4645 #define _SPBCONSTALPHA (VLV_DISPLAY_BASE + 0x722a8) 4646 #define _SPBCLRC0 (VLV_DISPLAY_BASE + 0x722d0) 4647 #define _SPBCLRC1 (VLV_DISPLAY_BASE + 0x722d4) 4648 #define _SPBGAMC (VLV_DISPLAY_BASE + 0x722e0) 4649 4650 #define _VLV_SPR(pipe, plane_id, reg_a, reg_b) \ 4651 _PIPE((pipe) * 2 + (plane_id) - PLANE_SPRITE0, (reg_a), (reg_b)) 4652 #define _MMIO_VLV_SPR(pipe, plane_id, reg_a, reg_b) \ 4653 _MMIO(_VLV_SPR((pipe), (plane_id), (reg_a), (reg_b))) 4654 4655 #define SPCNTR(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACNTR, _SPBCNTR) 4656 #define SPLINOFF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPALINOFF, _SPBLINOFF) 4657 #define SPSTRIDE(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASTRIDE, _SPBSTRIDE) 4658 #define SPPOS(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAPOS, _SPBPOS) 4659 #define SPSIZE(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASIZE, _SPBSIZE) 4660 #define SPKEYMINVAL(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMINVAL, _SPBKEYMINVAL) 4661 #define SPKEYMSK(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMSK, _SPBKEYMSK) 4662 #define SPSURF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASURF, _SPBSURF) 4663 #define SPKEYMAXVAL(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMAXVAL, _SPBKEYMAXVAL) 4664 #define SPTILEOFF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPATILEOFF, _SPBTILEOFF) 4665 #define SPCONSTALPHA(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACONSTALPHA, _SPBCONSTALPHA) 4666 #define SPCLRC0(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC0, _SPBCLRC0) 4667 #define SPCLRC1(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC1, _SPBCLRC1) 4668 #define SPGAMC(pipe, plane_id, i) _MMIO(_VLV_SPR((pipe), (plane_id), _SPAGAMC, _SPBGAMC) + (5 - (i)) * 4) /* 6 x u0.10 */ 4669 4670 /* 4671 * CHV pipe B sprite CSC 4672 * 4673 * |cr| |c0 c1 c2| |cr + cr_ioff| |cr_ooff| 4674 * |yg| = |c3 c4 c5| x |yg + yg_ioff| + |yg_ooff| 4675 * |cb| |c6 c7 c8| |cb + cr_ioff| |cb_ooff| 4676 */ 4677 #define _MMIO_CHV_SPCSC(plane_id, reg) \ 4678 _MMIO(VLV_DISPLAY_BASE + ((plane_id) - PLANE_SPRITE0) * 0x1000 + (reg)) 4679 4680 #define SPCSCYGOFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d900) 4681 #define SPCSCCBOFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d904) 4682 #define SPCSCCROFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d908) 4683 #define SPCSC_OOFF_MASK REG_GENMASK(26, 16) 4684 #define SPCSC_OOFF(x) REG_FIELD_PREP(SPCSC_OOFF_MASK, (x) & 0x7ff) /* s11 */ 4685 #define SPCSC_IOFF_MASK REG_GENMASK(10, 0) 4686 #define SPCSC_IOFF(x) REG_FIELD_PREP(SPCSC_IOFF_MASK, (x) & 0x7ff) /* s11 */ 4687 4688 #define SPCSCC01(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d90c) 4689 #define SPCSCC23(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d910) 4690 #define SPCSCC45(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d914) 4691 #define SPCSCC67(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d918) 4692 #define SPCSCC8(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d91c) 4693 #define SPCSC_C1_MASK REG_GENMASK(30, 16) 4694 #define SPCSC_C1(x) REG_FIELD_PREP(SPCSC_C1_MASK, (x) & 0x7fff) /* s3.12 */ 4695 #define SPCSC_C0_MASK REG_GENMASK(14, 0) 4696 #define SPCSC_C0(x) REG_FIELD_PREP(SPCSC_C0_MASK, (x) & 0x7fff) /* s3.12 */ 4697 4698 #define SPCSCYGICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d920) 4699 #define SPCSCCBICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d924) 4700 #define SPCSCCRICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d928) 4701 #define SPCSC_IMAX_MASK REG_GENMASK(26, 16) 4702 #define SPCSC_IMAX(x) REG_FIELD_PREP(SPCSC_IMAX_MASK, (x) & 0x7ff) /* s11 */ 4703 #define SPCSC_IMIN_MASK REG_GENMASK(10, 0) 4704 #define SPCSC_IMIN(x) REG_FIELD_PREP(SPCSC_IMIN_MASK, (x) & 0x7ff) /* s11 */ 4705 4706 #define SPCSCYGOCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d92c) 4707 #define SPCSCCBOCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d930) 4708 #define SPCSCCROCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d934) 4709 #define SPCSC_OMAX_MASK REG_GENMASK(25, 16) 4710 #define SPCSC_OMAX(x) REG_FIELD_PREP(SPCSC_OMAX_MASK, (x)) /* u10 */ 4711 #define SPCSC_OMIN_MASK REG_GENMASK(9, 0) 4712 #define SPCSC_OMIN(x) REG_FIELD_PREP(SPCSC_OMIN_MASK, (x)) /* u10 */ 4713 4714 /* Skylake plane registers */ 4715 4716 #define _PLANE_CTL_1_A 0x70180 4717 #define _PLANE_CTL_2_A 0x70280 4718 #define _PLANE_CTL_3_A 0x70380 4719 #define PLANE_CTL_ENABLE REG_BIT(31) 4720 #define PLANE_CTL_ARB_SLOTS_MASK REG_GENMASK(30, 28) /* icl+ */ 4721 #define PLANE_CTL_ARB_SLOTS(x) REG_FIELD_PREP(PLANE_CTL_ARB_SLOTS_MASK, (x)) /* icl+ */ 4722 #define PLANE_CTL_PIPE_GAMMA_ENABLE REG_BIT(30) /* Pre-GLK */ 4723 #define PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE REG_BIT(28) 4724 /* 4725 * ICL+ uses the same PLANE_CTL_FORMAT bits, but the field definition 4726 * expanded to include bit 23 as well. However, the shift-24 based values 4727 * correctly map to the same formats in ICL, as long as bit 23 is set to 0 4728 */ 4729 #define PLANE_CTL_FORMAT_MASK_SKL REG_GENMASK(27, 24) /* pre-icl */ 4730 #define PLANE_CTL_FORMAT_MASK_ICL REG_GENMASK(27, 23) /* icl+ */ 4731 #define PLANE_CTL_FORMAT_YUV422 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 0) 4732 #define PLANE_CTL_FORMAT_NV12 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 1) 4733 #define PLANE_CTL_FORMAT_XRGB_2101010 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 2) 4734 #define PLANE_CTL_FORMAT_P010 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 3) 4735 #define PLANE_CTL_FORMAT_XRGB_8888 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 4) 4736 #define PLANE_CTL_FORMAT_P012 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 5) 4737 #define PLANE_CTL_FORMAT_XRGB_16161616F REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 6) 4738 #define PLANE_CTL_FORMAT_P016 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 7) 4739 #define PLANE_CTL_FORMAT_XYUV REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 8) 4740 #define PLANE_CTL_FORMAT_INDEXED REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 12) 4741 #define PLANE_CTL_FORMAT_RGB_565 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_SKL, 14) 4742 #define PLANE_CTL_FORMAT_Y210 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_ICL, 1) 4743 #define PLANE_CTL_FORMAT_Y212 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_ICL, 3) 4744 #define PLANE_CTL_FORMAT_Y216 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_ICL, 5) 4745 #define PLANE_CTL_FORMAT_Y410 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_ICL, 7) 4746 #define PLANE_CTL_FORMAT_Y412 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_ICL, 9) 4747 #define PLANE_CTL_FORMAT_Y416 REG_FIELD_PREP(PLANE_CTL_FORMAT_MASK_ICL, 11) 4748 #define PLANE_CTL_PIPE_CSC_ENABLE REG_BIT(23) /* Pre-GLK */ 4749 #define PLANE_CTL_KEY_ENABLE_MASK REG_GENMASK(22, 21) 4750 #define PLANE_CTL_KEY_ENABLE_SOURCE REG_FIELD_PREP(PLANE_CTL_KEY_ENABLE_MASK, 1) 4751 #define PLANE_CTL_KEY_ENABLE_DESTINATION REG_FIELD_PREP(PLANE_CTL_KEY_ENABLE_MASK, 2) 4752 #define PLANE_CTL_ORDER_RGBX REG_BIT(20) 4753 #define PLANE_CTL_YUV420_Y_PLANE REG_BIT(19) 4754 #define PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 REG_BIT(18) 4755 #define PLANE_CTL_YUV422_ORDER_MASK REG_GENMASK(17, 16) 4756 #define PLANE_CTL_YUV422_ORDER_YUYV REG_FIELD_PREP(PLANE_CTL_YUV422_ORDER_MASK, 0) 4757 #define PLANE_CTL_YUV422_ORDER_UYVY REG_FIELD_PREP(PLANE_CTL_YUV422_ORDER_MASK, 1) 4758 #define PLANE_CTL_YUV422_ORDER_YVYU REG_FIELD_PREP(PLANE_CTL_YUV422_ORDER_MASK, 2) 4759 #define PLANE_CTL_YUV422_ORDER_VYUY REG_FIELD_PREP(PLANE_CTL_YUV422_ORDER_MASK, 3) 4760 #define PLANE_CTL_RENDER_DECOMPRESSION_ENABLE REG_BIT(15) 4761 #define PLANE_CTL_TRICKLE_FEED_DISABLE REG_BIT(14) 4762 #define PLANE_CTL_CLEAR_COLOR_DISABLE REG_BIT(13) /* TGL+ */ 4763 #define PLANE_CTL_PLANE_GAMMA_DISABLE REG_BIT(13) /* Pre-GLK */ 4764 #define PLANE_CTL_TILED_MASK REG_GENMASK(12, 10) 4765 #define PLANE_CTL_TILED_LINEAR REG_FIELD_PREP(PLANE_CTL_TILED_MASK, 0) 4766 #define PLANE_CTL_TILED_X REG_FIELD_PREP(PLANE_CTL_TILED_MASK, 1) 4767 #define PLANE_CTL_TILED_Y REG_FIELD_PREP(PLANE_CTL_TILED_MASK, 4) 4768 #define PLANE_CTL_TILED_YF REG_FIELD_PREP(PLANE_CTL_TILED_MASK, 5) 4769 #define PLANE_CTL_TILED_4 REG_FIELD_PREP(PLANE_CTL_TILED_MASK, 5) 4770 #define PLANE_CTL_ASYNC_FLIP REG_BIT(9) 4771 #define PLANE_CTL_FLIP_HORIZONTAL REG_BIT(8) 4772 #define PLANE_CTL_MEDIA_DECOMPRESSION_ENABLE REG_BIT(4) /* TGL+ */ 4773 #define PLANE_CTL_ALPHA_MASK REG_GENMASK(5, 4) /* Pre-GLK */ 4774 #define PLANE_CTL_ALPHA_DISABLE REG_FIELD_PREP(PLANE_CTL_ALPHA_MASK, 0) 4775 #define PLANE_CTL_ALPHA_SW_PREMULTIPLY REG_FIELD_PREP(PLANE_CTL_ALPHA_MASK, 2) 4776 #define PLANE_CTL_ALPHA_HW_PREMULTIPLY REG_FIELD_PREP(PLANE_CTL_ALPHA_MASK, 3) 4777 #define PLANE_CTL_ROTATE_MASK REG_GENMASK(1, 0) 4778 #define PLANE_CTL_ROTATE_0 REG_FIELD_PREP(PLANE_CTL_ROTATE_MASK, 0) 4779 #define PLANE_CTL_ROTATE_90 REG_FIELD_PREP(PLANE_CTL_ROTATE_MASK, 1) 4780 #define PLANE_CTL_ROTATE_180 REG_FIELD_PREP(PLANE_CTL_ROTATE_MASK, 2) 4781 #define PLANE_CTL_ROTATE_270 REG_FIELD_PREP(PLANE_CTL_ROTATE_MASK, 3) 4782 #define _PLANE_STRIDE_1_A 0x70188 4783 #define _PLANE_STRIDE_2_A 0x70288 4784 #define _PLANE_STRIDE_3_A 0x70388 4785 #define PLANE_STRIDE__MASK REG_GENMASK(11, 0) 4786 #define PLANE_STRIDE_(stride) REG_FIELD_PREP(PLANE_STRIDE__MASK, (stride)) 4787 #define _PLANE_POS_1_A 0x7018c 4788 #define _PLANE_POS_2_A 0x7028c 4789 #define _PLANE_POS_3_A 0x7038c 4790 #define PLANE_POS_Y_MASK REG_GENMASK(31, 16) 4791 #define PLANE_POS_Y(y) REG_FIELD_PREP(PLANE_POS_Y_MASK, (y)) 4792 #define PLANE_POS_X_MASK REG_GENMASK(15, 0) 4793 #define PLANE_POS_X(x) REG_FIELD_PREP(PLANE_POS_X_MASK, (x)) 4794 #define _PLANE_SIZE_1_A 0x70190 4795 #define _PLANE_SIZE_2_A 0x70290 4796 #define _PLANE_SIZE_3_A 0x70390 4797 #define PLANE_HEIGHT_MASK REG_GENMASK(31, 16) 4798 #define PLANE_HEIGHT(h) REG_FIELD_PREP(PLANE_HEIGHT_MASK, (h)) 4799 #define PLANE_WIDTH_MASK REG_GENMASK(15, 0) 4800 #define PLANE_WIDTH(w) REG_FIELD_PREP(PLANE_WIDTH_MASK, (w)) 4801 #define _PLANE_SURF_1_A 0x7019c 4802 #define _PLANE_SURF_2_A 0x7029c 4803 #define _PLANE_SURF_3_A 0x7039c 4804 #define PLANE_SURF_ADDR_MASK REG_GENMASK(31, 12) 4805 #define PLANE_SURF_DECRYPT REG_BIT(2) 4806 #define _PLANE_OFFSET_1_A 0x701a4 4807 #define _PLANE_OFFSET_2_A 0x702a4 4808 #define _PLANE_OFFSET_3_A 0x703a4 4809 #define PLANE_OFFSET_Y_MASK REG_GENMASK(31, 16) 4810 #define PLANE_OFFSET_Y(y) REG_FIELD_PREP(PLANE_OFFSET_Y_MASK, (y)) 4811 #define PLANE_OFFSET_X_MASK REG_GENMASK(15, 0) 4812 #define PLANE_OFFSET_X(x) REG_FIELD_PREP(PLANE_OFFSET_X_MASK, (x)) 4813 #define _PLANE_KEYVAL_1_A 0x70194 4814 #define _PLANE_KEYVAL_2_A 0x70294 4815 #define _PLANE_KEYMSK_1_A 0x70198 4816 #define _PLANE_KEYMSK_2_A 0x70298 4817 #define PLANE_KEYMSK_ALPHA_ENABLE (1 << 31) 4818 #define _PLANE_KEYMAX_1_A 0x701a0 4819 #define _PLANE_KEYMAX_2_A 0x702a0 4820 #define PLANE_KEYMAX_ALPHA(a) ((a) << 24) 4821 #define _PLANE_CC_VAL_1_A 0x701b4 4822 #define _PLANE_CC_VAL_2_A 0x702b4 4823 #define _PLANE_AUX_DIST_1_A 0x701c0 4824 #define PLANE_AUX_DISTANCE_MASK REG_GENMASK(31, 12) 4825 #define PLANE_AUX_STRIDE_MASK REG_GENMASK(11, 0) 4826 #define PLANE_AUX_STRIDE(stride) REG_FIELD_PREP(PLANE_AUX_STRIDE_MASK, (stride)) 4827 #define _PLANE_AUX_DIST_2_A 0x702c0 4828 #define _PLANE_AUX_OFFSET_1_A 0x701c4 4829 #define _PLANE_AUX_OFFSET_2_A 0x702c4 4830 #define _PLANE_CUS_CTL_1_A 0x701c8 4831 #define _PLANE_CUS_CTL_2_A 0x702c8 4832 #define PLANE_CUS_ENABLE REG_BIT(31) 4833 #define PLANE_CUS_Y_PLANE_MASK REG_BIT(30) 4834 #define PLANE_CUS_Y_PLANE_4_RKL REG_FIELD_PREP(PLANE_CUS_Y_PLANE_MASK, 0) 4835 #define PLANE_CUS_Y_PLANE_5_RKL REG_FIELD_PREP(PLANE_CUS_Y_PLANE_MASK, 1) 4836 #define PLANE_CUS_Y_PLANE_6_ICL REG_FIELD_PREP(PLANE_CUS_Y_PLANE_MASK, 0) 4837 #define PLANE_CUS_Y_PLANE_7_ICL REG_FIELD_PREP(PLANE_CUS_Y_PLANE_MASK, 1) 4838 #define PLANE_CUS_HPHASE_SIGN_NEGATIVE REG_BIT(19) 4839 #define PLANE_CUS_HPHASE_MASK REG_GENMASK(17, 16) 4840 #define PLANE_CUS_HPHASE_0 REG_FIELD_PREP(PLANE_CUS_HPHASE_MASK, 0) 4841 #define PLANE_CUS_HPHASE_0_25 REG_FIELD_PREP(PLANE_CUS_HPHASE_MASK, 1) 4842 #define PLANE_CUS_HPHASE_0_5 REG_FIELD_PREP(PLANE_CUS_HPHASE_MASK, 2) 4843 #define PLANE_CUS_VPHASE_SIGN_NEGATIVE REG_BIT(15) 4844 #define PLANE_CUS_VPHASE_MASK REG_GENMASK(13, 12) 4845 #define PLANE_CUS_VPHASE_0 REG_FIELD_PREP(PLANE_CUS_VPHASE_MASK, 0) 4846 #define PLANE_CUS_VPHASE_0_25 REG_FIELD_PREP(PLANE_CUS_VPHASE_MASK, 1) 4847 #define PLANE_CUS_VPHASE_0_5 REG_FIELD_PREP(PLANE_CUS_VPHASE_MASK, 2) 4848 #define _PLANE_COLOR_CTL_1_A 0x701CC /* GLK+ */ 4849 #define _PLANE_COLOR_CTL_2_A 0x702CC /* GLK+ */ 4850 #define _PLANE_COLOR_CTL_3_A 0x703CC /* GLK+ */ 4851 #define PLANE_COLOR_PIPE_GAMMA_ENABLE REG_BIT(30) /* Pre-ICL */ 4852 #define PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE REG_BIT(28) 4853 #define PLANE_COLOR_PIPE_CSC_ENABLE REG_BIT(23) /* Pre-ICL */ 4854 #define PLANE_COLOR_PLANE_CSC_ENABLE REG_BIT(21) /* ICL+ */ 4855 #define PLANE_COLOR_INPUT_CSC_ENABLE REG_BIT(20) /* ICL+ */ 4856 #define PLANE_COLOR_CSC_MODE_MASK REG_GENMASK(19, 17) 4857 #define PLANE_COLOR_CSC_MODE_BYPASS REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 0) 4858 #define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB601 REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 1) 4859 #define PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 2) 4860 #define PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020 REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 3) 4861 #define PLANE_COLOR_CSC_MODE_RGB709_TO_RGB2020 REG_FIELD_PREP(PLANE_COLOR_CSC_MODE_MASK, 4) 4862 #define PLANE_COLOR_PLANE_GAMMA_DISABLE REG_BIT(13) 4863 #define PLANE_COLOR_ALPHA_MASK REG_GENMASK(5, 4) 4864 #define PLANE_COLOR_ALPHA_DISABLE REG_FIELD_PREP(PLANE_COLOR_ALPHA_MASK, 0) 4865 #define PLANE_COLOR_ALPHA_SW_PREMULTIPLY REG_FIELD_PREP(PLANE_COLOR_ALPHA_MASK, 2) 4866 #define PLANE_COLOR_ALPHA_HW_PREMULTIPLY REG_FIELD_PREP(PLANE_COLOR_ALPHA_MASK, 3) 4867 #define _PLANE_BUF_CFG_1_A 0x7027c 4868 #define _PLANE_BUF_CFG_2_A 0x7037c 4869 #define _PLANE_NV12_BUF_CFG_1_A 0x70278 4870 #define _PLANE_NV12_BUF_CFG_2_A 0x70378 4871 4872 #define _PLANE_CC_VAL_1_B 0x711b4 4873 #define _PLANE_CC_VAL_2_B 0x712b4 4874 #define _PLANE_CC_VAL_1(pipe, dw) (_PIPE(pipe, _PLANE_CC_VAL_1_A, _PLANE_CC_VAL_1_B) + (dw) * 4) 4875 #define _PLANE_CC_VAL_2(pipe, dw) (_PIPE(pipe, _PLANE_CC_VAL_2_A, _PLANE_CC_VAL_2_B) + (dw) * 4) 4876 #define PLANE_CC_VAL(pipe, plane, dw) \ 4877 _MMIO_PLANE((plane), _PLANE_CC_VAL_1((pipe), (dw)), _PLANE_CC_VAL_2((pipe), (dw))) 4878 4879 /* Input CSC Register Definitions */ 4880 #define _PLANE_INPUT_CSC_RY_GY_1_A 0x701E0 4881 #define _PLANE_INPUT_CSC_RY_GY_2_A 0x702E0 4882 4883 #define _PLANE_INPUT_CSC_RY_GY_1_B 0x711E0 4884 #define _PLANE_INPUT_CSC_RY_GY_2_B 0x712E0 4885 4886 #define _PLANE_INPUT_CSC_RY_GY_1(pipe) \ 4887 _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_1_A, \ 4888 _PLANE_INPUT_CSC_RY_GY_1_B) 4889 #define _PLANE_INPUT_CSC_RY_GY_2(pipe) \ 4890 _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_2_A, \ 4891 _PLANE_INPUT_CSC_RY_GY_2_B) 4892 4893 #define PLANE_INPUT_CSC_COEFF(pipe, plane, index) \ 4894 _MMIO_PLANE(plane, _PLANE_INPUT_CSC_RY_GY_1(pipe) + (index) * 4, \ 4895 _PLANE_INPUT_CSC_RY_GY_2(pipe) + (index) * 4) 4896 4897 #define _PLANE_INPUT_CSC_PREOFF_HI_1_A 0x701F8 4898 #define _PLANE_INPUT_CSC_PREOFF_HI_2_A 0x702F8 4899 4900 #define _PLANE_INPUT_CSC_PREOFF_HI_1_B 0x711F8 4901 #define _PLANE_INPUT_CSC_PREOFF_HI_2_B 0x712F8 4902 4903 #define _PLANE_INPUT_CSC_PREOFF_HI_1(pipe) \ 4904 _PIPE(pipe, _PLANE_INPUT_CSC_PREOFF_HI_1_A, \ 4905 _PLANE_INPUT_CSC_PREOFF_HI_1_B) 4906 #define _PLANE_INPUT_CSC_PREOFF_HI_2(pipe) \ 4907 _PIPE(pipe, _PLANE_INPUT_CSC_PREOFF_HI_2_A, \ 4908 _PLANE_INPUT_CSC_PREOFF_HI_2_B) 4909 #define PLANE_INPUT_CSC_PREOFF(pipe, plane, index) \ 4910 _MMIO_PLANE(plane, _PLANE_INPUT_CSC_PREOFF_HI_1(pipe) + (index) * 4, \ 4911 _PLANE_INPUT_CSC_PREOFF_HI_2(pipe) + (index) * 4) 4912 4913 #define _PLANE_INPUT_CSC_POSTOFF_HI_1_A 0x70204 4914 #define _PLANE_INPUT_CSC_POSTOFF_HI_2_A 0x70304 4915 4916 #define _PLANE_INPUT_CSC_POSTOFF_HI_1_B 0x71204 4917 #define _PLANE_INPUT_CSC_POSTOFF_HI_2_B 0x71304 4918 4919 #define _PLANE_INPUT_CSC_POSTOFF_HI_1(pipe) \ 4920 _PIPE(pipe, _PLANE_INPUT_CSC_POSTOFF_HI_1_A, \ 4921 _PLANE_INPUT_CSC_POSTOFF_HI_1_B) 4922 #define _PLANE_INPUT_CSC_POSTOFF_HI_2(pipe) \ 4923 _PIPE(pipe, _PLANE_INPUT_CSC_POSTOFF_HI_2_A, \ 4924 _PLANE_INPUT_CSC_POSTOFF_HI_2_B) 4925 #define PLANE_INPUT_CSC_POSTOFF(pipe, plane, index) \ 4926 _MMIO_PLANE(plane, _PLANE_INPUT_CSC_POSTOFF_HI_1(pipe) + (index) * 4, \ 4927 _PLANE_INPUT_CSC_POSTOFF_HI_2(pipe) + (index) * 4) 4928 4929 #define _PLANE_CTL_1_B 0x71180 4930 #define _PLANE_CTL_2_B 0x71280 4931 #define _PLANE_CTL_3_B 0x71380 4932 #define _PLANE_CTL_1(pipe) _PIPE(pipe, _PLANE_CTL_1_A, _PLANE_CTL_1_B) 4933 #define _PLANE_CTL_2(pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B) 4934 #define _PLANE_CTL_3(pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B) 4935 #define PLANE_CTL(pipe, plane) \ 4936 _MMIO_PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe)) 4937 4938 #define _PLANE_STRIDE_1_B 0x71188 4939 #define _PLANE_STRIDE_2_B 0x71288 4940 #define _PLANE_STRIDE_3_B 0x71388 4941 #define _PLANE_STRIDE_1(pipe) \ 4942 _PIPE(pipe, _PLANE_STRIDE_1_A, _PLANE_STRIDE_1_B) 4943 #define _PLANE_STRIDE_2(pipe) \ 4944 _PIPE(pipe, _PLANE_STRIDE_2_A, _PLANE_STRIDE_2_B) 4945 #define _PLANE_STRIDE_3(pipe) \ 4946 _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B) 4947 #define PLANE_STRIDE(pipe, plane) \ 4948 _MMIO_PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe)) 4949 4950 #define _PLANE_POS_1_B 0x7118c 4951 #define _PLANE_POS_2_B 0x7128c 4952 #define _PLANE_POS_3_B 0x7138c 4953 #define _PLANE_POS_1(pipe) _PIPE(pipe, _PLANE_POS_1_A, _PLANE_POS_1_B) 4954 #define _PLANE_POS_2(pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B) 4955 #define _PLANE_POS_3(pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B) 4956 #define PLANE_POS(pipe, plane) \ 4957 _MMIO_PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe)) 4958 4959 #define _PLANE_SIZE_1_B 0x71190 4960 #define _PLANE_SIZE_2_B 0x71290 4961 #define _PLANE_SIZE_3_B 0x71390 4962 #define _PLANE_SIZE_1(pipe) _PIPE(pipe, _PLANE_SIZE_1_A, _PLANE_SIZE_1_B) 4963 #define _PLANE_SIZE_2(pipe) _PIPE(pipe, _PLANE_SIZE_2_A, _PLANE_SIZE_2_B) 4964 #define _PLANE_SIZE_3(pipe) _PIPE(pipe, _PLANE_SIZE_3_A, _PLANE_SIZE_3_B) 4965 #define PLANE_SIZE(pipe, plane) \ 4966 _MMIO_PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe)) 4967 4968 #define _PLANE_SURF_1_B 0x7119c 4969 #define _PLANE_SURF_2_B 0x7129c 4970 #define _PLANE_SURF_3_B 0x7139c 4971 #define _PLANE_SURF_1(pipe) _PIPE(pipe, _PLANE_SURF_1_A, _PLANE_SURF_1_B) 4972 #define _PLANE_SURF_2(pipe) _PIPE(pipe, _PLANE_SURF_2_A, _PLANE_SURF_2_B) 4973 #define _PLANE_SURF_3(pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B) 4974 #define PLANE_SURF(pipe, plane) \ 4975 _MMIO_PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe)) 4976 4977 #define _PLANE_OFFSET_1_B 0x711a4 4978 #define _PLANE_OFFSET_2_B 0x712a4 4979 #define _PLANE_OFFSET_1(pipe) _PIPE(pipe, _PLANE_OFFSET_1_A, _PLANE_OFFSET_1_B) 4980 #define _PLANE_OFFSET_2(pipe) _PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B) 4981 #define PLANE_OFFSET(pipe, plane) \ 4982 _MMIO_PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) 4983 4984 #define _PLANE_KEYVAL_1_B 0x71194 4985 #define _PLANE_KEYVAL_2_B 0x71294 4986 #define _PLANE_KEYVAL_1(pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B) 4987 #define _PLANE_KEYVAL_2(pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B) 4988 #define PLANE_KEYVAL(pipe, plane) \ 4989 _MMIO_PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe)) 4990 4991 #define _PLANE_KEYMSK_1_B 0x71198 4992 #define _PLANE_KEYMSK_2_B 0x71298 4993 #define _PLANE_KEYMSK_1(pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B) 4994 #define _PLANE_KEYMSK_2(pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A, _PLANE_KEYMSK_2_B) 4995 #define PLANE_KEYMSK(pipe, plane) \ 4996 _MMIO_PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe)) 4997 4998 #define _PLANE_KEYMAX_1_B 0x711a0 4999 #define _PLANE_KEYMAX_2_B 0x712a0 5000 #define _PLANE_KEYMAX_1(pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A, _PLANE_KEYMAX_1_B) 5001 #define _PLANE_KEYMAX_2(pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B) 5002 #define PLANE_KEYMAX(pipe, plane) \ 5003 _MMIO_PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) 5004 5005 #define _PLANE_BUF_CFG_1_B 0x7127c 5006 #define _PLANE_BUF_CFG_2_B 0x7137c 5007 /* skl+: 10 bits, icl+ 11 bits, adlp+ 12 bits */ 5008 #define PLANE_BUF_END_MASK REG_GENMASK(27, 16) 5009 #define PLANE_BUF_END(end) REG_FIELD_PREP(PLANE_BUF_END_MASK, (end)) 5010 #define PLANE_BUF_START_MASK REG_GENMASK(11, 0) 5011 #define PLANE_BUF_START(start) REG_FIELD_PREP(PLANE_BUF_START_MASK, (start)) 5012 #define _PLANE_BUF_CFG_1(pipe) \ 5013 _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B) 5014 #define _PLANE_BUF_CFG_2(pipe) \ 5015 _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B) 5016 #define PLANE_BUF_CFG(pipe, plane) \ 5017 _MMIO_PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe)) 5018 5019 #define _PLANE_NV12_BUF_CFG_1_B 0x71278 5020 #define _PLANE_NV12_BUF_CFG_2_B 0x71378 5021 #define _PLANE_NV12_BUF_CFG_1(pipe) \ 5022 _PIPE(pipe, _PLANE_NV12_BUF_CFG_1_A, _PLANE_NV12_BUF_CFG_1_B) 5023 #define _PLANE_NV12_BUF_CFG_2(pipe) \ 5024 _PIPE(pipe, _PLANE_NV12_BUF_CFG_2_A, _PLANE_NV12_BUF_CFG_2_B) 5025 #define PLANE_NV12_BUF_CFG(pipe, plane) \ 5026 _MMIO_PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), _PLANE_NV12_BUF_CFG_2(pipe)) 5027 5028 #define _PLANE_AUX_DIST_1_B 0x711c0 5029 #define _PLANE_AUX_DIST_2_B 0x712c0 5030 #define _PLANE_AUX_DIST_1(pipe) \ 5031 _PIPE(pipe, _PLANE_AUX_DIST_1_A, _PLANE_AUX_DIST_1_B) 5032 #define _PLANE_AUX_DIST_2(pipe) \ 5033 _PIPE(pipe, _PLANE_AUX_DIST_2_A, _PLANE_AUX_DIST_2_B) 5034 #define PLANE_AUX_DIST(pipe, plane) \ 5035 _MMIO_PLANE(plane, _PLANE_AUX_DIST_1(pipe), _PLANE_AUX_DIST_2(pipe)) 5036 5037 #define _PLANE_AUX_OFFSET_1_B 0x711c4 5038 #define _PLANE_AUX_OFFSET_2_B 0x712c4 5039 #define _PLANE_AUX_OFFSET_1(pipe) \ 5040 _PIPE(pipe, _PLANE_AUX_OFFSET_1_A, _PLANE_AUX_OFFSET_1_B) 5041 #define _PLANE_AUX_OFFSET_2(pipe) \ 5042 _PIPE(pipe, _PLANE_AUX_OFFSET_2_A, _PLANE_AUX_OFFSET_2_B) 5043 #define PLANE_AUX_OFFSET(pipe, plane) \ 5044 _MMIO_PLANE(plane, _PLANE_AUX_OFFSET_1(pipe), _PLANE_AUX_OFFSET_2(pipe)) 5045 5046 #define _PLANE_CUS_CTL_1_B 0x711c8 5047 #define _PLANE_CUS_CTL_2_B 0x712c8 5048 #define _PLANE_CUS_CTL_1(pipe) \ 5049 _PIPE(pipe, _PLANE_CUS_CTL_1_A, _PLANE_CUS_CTL_1_B) 5050 #define _PLANE_CUS_CTL_2(pipe) \ 5051 _PIPE(pipe, _PLANE_CUS_CTL_2_A, _PLANE_CUS_CTL_2_B) 5052 #define PLANE_CUS_CTL(pipe, plane) \ 5053 _MMIO_PLANE(plane, _PLANE_CUS_CTL_1(pipe), _PLANE_CUS_CTL_2(pipe)) 5054 5055 #define _PLANE_COLOR_CTL_1_B 0x711CC 5056 #define _PLANE_COLOR_CTL_2_B 0x712CC 5057 #define _PLANE_COLOR_CTL_3_B 0x713CC 5058 #define _PLANE_COLOR_CTL_1(pipe) \ 5059 _PIPE(pipe, _PLANE_COLOR_CTL_1_A, _PLANE_COLOR_CTL_1_B) 5060 #define _PLANE_COLOR_CTL_2(pipe) \ 5061 _PIPE(pipe, _PLANE_COLOR_CTL_2_A, _PLANE_COLOR_CTL_2_B) 5062 #define PLANE_COLOR_CTL(pipe, plane) \ 5063 _MMIO_PLANE(plane, _PLANE_COLOR_CTL_1(pipe), _PLANE_COLOR_CTL_2(pipe)) 5064 5065 #define _SEL_FETCH_PLANE_BASE_1_A 0x70890 5066 #define _SEL_FETCH_PLANE_BASE_2_A 0x708B0 5067 #define _SEL_FETCH_PLANE_BASE_3_A 0x708D0 5068 #define _SEL_FETCH_PLANE_BASE_4_A 0x708F0 5069 #define _SEL_FETCH_PLANE_BASE_5_A 0x70920 5070 #define _SEL_FETCH_PLANE_BASE_6_A 0x70940 5071 #define _SEL_FETCH_PLANE_BASE_7_A 0x70960 5072 #define _SEL_FETCH_PLANE_BASE_CUR_A 0x70880 5073 #define _SEL_FETCH_PLANE_BASE_1_B 0x71890 5074 5075 #define _SEL_FETCH_PLANE_BASE_A(plane) _PICK(plane, \ 5076 _SEL_FETCH_PLANE_BASE_1_A, \ 5077 _SEL_FETCH_PLANE_BASE_2_A, \ 5078 _SEL_FETCH_PLANE_BASE_3_A, \ 5079 _SEL_FETCH_PLANE_BASE_4_A, \ 5080 _SEL_FETCH_PLANE_BASE_5_A, \ 5081 _SEL_FETCH_PLANE_BASE_6_A, \ 5082 _SEL_FETCH_PLANE_BASE_7_A, \ 5083 _SEL_FETCH_PLANE_BASE_CUR_A) 5084 #define _SEL_FETCH_PLANE_BASE_1(pipe) _PIPE(pipe, _SEL_FETCH_PLANE_BASE_1_A, _SEL_FETCH_PLANE_BASE_1_B) 5085 #define _SEL_FETCH_PLANE_BASE(pipe, plane) (_SEL_FETCH_PLANE_BASE_1(pipe) - \ 5086 _SEL_FETCH_PLANE_BASE_1_A + \ 5087 _SEL_FETCH_PLANE_BASE_A(plane)) 5088 5089 #define _SEL_FETCH_PLANE_CTL_1_A 0x70890 5090 #define PLANE_SEL_FETCH_CTL(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \ 5091 _SEL_FETCH_PLANE_CTL_1_A - \ 5092 _SEL_FETCH_PLANE_BASE_1_A) 5093 #define PLANE_SEL_FETCH_CTL_ENABLE REG_BIT(31) 5094 5095 #define _SEL_FETCH_PLANE_POS_1_A 0x70894 5096 #define PLANE_SEL_FETCH_POS(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \ 5097 _SEL_FETCH_PLANE_POS_1_A - \ 5098 _SEL_FETCH_PLANE_BASE_1_A) 5099 5100 #define _SEL_FETCH_PLANE_SIZE_1_A 0x70898 5101 #define PLANE_SEL_FETCH_SIZE(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \ 5102 _SEL_FETCH_PLANE_SIZE_1_A - \ 5103 _SEL_FETCH_PLANE_BASE_1_A) 5104 5105 #define _SEL_FETCH_PLANE_OFFSET_1_A 0x7089C 5106 #define PLANE_SEL_FETCH_OFFSET(pipe, plane) _MMIO(_SEL_FETCH_PLANE_BASE(pipe, plane) + \ 5107 _SEL_FETCH_PLANE_OFFSET_1_A - \ 5108 _SEL_FETCH_PLANE_BASE_1_A) 5109 5110 /* SKL new cursor registers */ 5111 #define _CUR_BUF_CFG_A 0x7017c 5112 #define _CUR_BUF_CFG_B 0x7117c 5113 #define CUR_BUF_CFG(pipe) _MMIO_PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B) 5114 5115 /* VBIOS regs */ 5116 #define VGACNTRL _MMIO(0x71400) 5117 # define VGA_DISP_DISABLE (1 << 31) 5118 # define VGA_2X_MODE (1 << 30) 5119 # define VGA_PIPE_B_SELECT (1 << 29) 5120 5121 #define VLV_VGACNTRL _MMIO(VLV_DISPLAY_BASE + 0x71400) 5122 5123 /* Ironlake */ 5124 5125 #define CPU_VGACNTRL _MMIO(0x41000) 5126 5127 #define DIGITAL_PORT_HOTPLUG_CNTRL _MMIO(0x44030) 5128 #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4) 5129 #define DIGITAL_PORTA_PULSE_DURATION_2ms (0 << 2) /* pre-HSW */ 5130 #define DIGITAL_PORTA_PULSE_DURATION_4_5ms (1 << 2) /* pre-HSW */ 5131 #define DIGITAL_PORTA_PULSE_DURATION_6ms (2 << 2) /* pre-HSW */ 5132 #define DIGITAL_PORTA_PULSE_DURATION_100ms (3 << 2) /* pre-HSW */ 5133 #define DIGITAL_PORTA_PULSE_DURATION_MASK (3 << 2) /* pre-HSW */ 5134 #define DIGITAL_PORTA_HOTPLUG_STATUS_MASK (3 << 0) 5135 #define DIGITAL_PORTA_HOTPLUG_NO_DETECT (0 << 0) 5136 #define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0) 5137 #define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0) 5138 5139 /* refresh rate hardware control */ 5140 #define RR_HW_CTL _MMIO(0x45300) 5141 #define RR_HW_LOW_POWER_FRAMES_MASK 0xff 5142 #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00 5143 5144 #define FDI_PLL_BIOS_0 _MMIO(0x46000) 5145 #define FDI_PLL_FB_CLOCK_MASK 0xff 5146 #define FDI_PLL_BIOS_1 _MMIO(0x46004) 5147 #define FDI_PLL_BIOS_2 _MMIO(0x46008) 5148 #define DISPLAY_PORT_PLL_BIOS_0 _MMIO(0x4600c) 5149 #define DISPLAY_PORT_PLL_BIOS_1 _MMIO(0x46010) 5150 #define DISPLAY_PORT_PLL_BIOS_2 _MMIO(0x46014) 5151 5152 #define PCH_3DCGDIS0 _MMIO(0x46020) 5153 # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18) 5154 # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1) 5155 5156 #define PCH_3DCGDIS1 _MMIO(0x46024) 5157 # define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11) 5158 5159 #define FDI_PLL_FREQ_CTL _MMIO(0x46030) 5160 #define FDI_PLL_FREQ_CHANGE_REQUEST (1 << 24) 5161 #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 5162 #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff 5163 5164 5165 #define _PIPEA_DATA_M1 0x60030 5166 #define _PIPEA_DATA_N1 0x60034 5167 #define _PIPEA_DATA_M2 0x60038 5168 #define _PIPEA_DATA_N2 0x6003c 5169 #define _PIPEA_LINK_M1 0x60040 5170 #define _PIPEA_LINK_N1 0x60044 5171 #define _PIPEA_LINK_M2 0x60048 5172 #define _PIPEA_LINK_N2 0x6004c 5173 5174 /* PIPEB timing regs are same start from 0x61000 */ 5175 5176 #define _PIPEB_DATA_M1 0x61030 5177 #define _PIPEB_DATA_N1 0x61034 5178 #define _PIPEB_DATA_M2 0x61038 5179 #define _PIPEB_DATA_N2 0x6103c 5180 #define _PIPEB_LINK_M1 0x61040 5181 #define _PIPEB_LINK_N1 0x61044 5182 #define _PIPEB_LINK_M2 0x61048 5183 #define _PIPEB_LINK_N2 0x6104c 5184 5185 #define PIPE_DATA_M1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M1) 5186 #define PIPE_DATA_N1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N1) 5187 #define PIPE_DATA_M2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M2) 5188 #define PIPE_DATA_N2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N2) 5189 #define PIPE_LINK_M1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M1) 5190 #define PIPE_LINK_N1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N1) 5191 #define PIPE_LINK_M2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M2) 5192 #define PIPE_LINK_N2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N2) 5193 5194 /* CPU panel fitter */ 5195 /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */ 5196 #define _PFA_CTL_1 0x68080 5197 #define _PFB_CTL_1 0x68880 5198 #define PF_ENABLE (1 << 31) 5199 #define PF_PIPE_SEL_MASK_IVB (3 << 29) 5200 #define PF_PIPE_SEL_IVB(pipe) ((pipe) << 29) 5201 #define PF_FILTER_MASK (3 << 23) 5202 #define PF_FILTER_PROGRAMMED (0 << 23) 5203 #define PF_FILTER_MED_3x3 (1 << 23) 5204 #define PF_FILTER_EDGE_ENHANCE (2 << 23) 5205 #define PF_FILTER_EDGE_SOFTEN (3 << 23) 5206 #define _PFA_WIN_SZ 0x68074 5207 #define _PFB_WIN_SZ 0x68874 5208 #define _PFA_WIN_POS 0x68070 5209 #define _PFB_WIN_POS 0x68870 5210 #define _PFA_VSCALE 0x68084 5211 #define _PFB_VSCALE 0x68884 5212 #define _PFA_HSCALE 0x68090 5213 #define _PFB_HSCALE 0x68890 5214 5215 #define PF_CTL(pipe) _MMIO_PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1) 5216 #define PF_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ) 5217 #define PF_WIN_POS(pipe) _MMIO_PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS) 5218 #define PF_VSCALE(pipe) _MMIO_PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE) 5219 #define PF_HSCALE(pipe) _MMIO_PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE) 5220 5221 #define _PSA_CTL 0x68180 5222 #define _PSB_CTL 0x68980 5223 #define PS_ENABLE (1 << 31) 5224 #define _PSA_WIN_SZ 0x68174 5225 #define _PSB_WIN_SZ 0x68974 5226 #define _PSA_WIN_POS 0x68170 5227 #define _PSB_WIN_POS 0x68970 5228 5229 #define PS_CTL(pipe) _MMIO_PIPE(pipe, _PSA_CTL, _PSB_CTL) 5230 #define PS_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PSA_WIN_SZ, _PSB_WIN_SZ) 5231 #define PS_WIN_POS(pipe) _MMIO_PIPE(pipe, _PSA_WIN_POS, _PSB_WIN_POS) 5232 5233 /* 5234 * Skylake scalers 5235 */ 5236 #define _PS_1A_CTRL 0x68180 5237 #define _PS_2A_CTRL 0x68280 5238 #define _PS_1B_CTRL 0x68980 5239 #define _PS_2B_CTRL 0x68A80 5240 #define _PS_1C_CTRL 0x69180 5241 #define PS_SCALER_EN (1 << 31) 5242 #define SKL_PS_SCALER_MODE_MASK (3 << 28) 5243 #define SKL_PS_SCALER_MODE_DYN (0 << 28) 5244 #define SKL_PS_SCALER_MODE_HQ (1 << 28) 5245 #define SKL_PS_SCALER_MODE_NV12 (2 << 28) 5246 #define PS_SCALER_MODE_PLANAR (1 << 29) 5247 #define PS_SCALER_MODE_NORMAL (0 << 29) 5248 #define PS_PLANE_SEL_MASK (7 << 25) 5249 #define PS_PLANE_SEL(plane) (((plane) + 1) << 25) 5250 #define PS_FILTER_MASK (3 << 23) 5251 #define PS_FILTER_MEDIUM (0 << 23) 5252 #define PS_FILTER_PROGRAMMED (1 << 23) 5253 #define PS_FILTER_EDGE_ENHANCE (2 << 23) 5254 #define PS_FILTER_BILINEAR (3 << 23) 5255 #define PS_VERT3TAP (1 << 21) 5256 #define PS_VERT_INT_INVERT_FIELD1 (0 << 20) 5257 #define PS_VERT_INT_INVERT_FIELD0 (1 << 20) 5258 #define PS_PWRUP_PROGRESS (1 << 17) 5259 #define PS_V_FILTER_BYPASS (1 << 8) 5260 #define PS_VADAPT_EN (1 << 7) 5261 #define PS_VADAPT_MODE_MASK (3 << 5) 5262 #define PS_VADAPT_MODE_LEAST_ADAPT (0 << 5) 5263 #define PS_VADAPT_MODE_MOD_ADAPT (1 << 5) 5264 #define PS_VADAPT_MODE_MOST_ADAPT (3 << 5) 5265 #define PS_PLANE_Y_SEL_MASK (7 << 5) 5266 #define PS_PLANE_Y_SEL(plane) (((plane) + 1) << 5) 5267 #define PS_Y_VERT_FILTER_SELECT(set) ((set) << 4) 5268 #define PS_Y_HORZ_FILTER_SELECT(set) ((set) << 3) 5269 #define PS_UV_VERT_FILTER_SELECT(set) ((set) << 2) 5270 #define PS_UV_HORZ_FILTER_SELECT(set) ((set) << 1) 5271 5272 #define _PS_PWR_GATE_1A 0x68160 5273 #define _PS_PWR_GATE_2A 0x68260 5274 #define _PS_PWR_GATE_1B 0x68960 5275 #define _PS_PWR_GATE_2B 0x68A60 5276 #define _PS_PWR_GATE_1C 0x69160 5277 #define PS_PWR_GATE_DIS_OVERRIDE (1 << 31) 5278 #define PS_PWR_GATE_SETTLING_TIME_32 (0 << 3) 5279 #define PS_PWR_GATE_SETTLING_TIME_64 (1 << 3) 5280 #define PS_PWR_GATE_SETTLING_TIME_96 (2 << 3) 5281 #define PS_PWR_GATE_SETTLING_TIME_128 (3 << 3) 5282 #define PS_PWR_GATE_SLPEN_8 0 5283 #define PS_PWR_GATE_SLPEN_16 1 5284 #define PS_PWR_GATE_SLPEN_24 2 5285 #define PS_PWR_GATE_SLPEN_32 3 5286 5287 #define _PS_WIN_POS_1A 0x68170 5288 #define _PS_WIN_POS_2A 0x68270 5289 #define _PS_WIN_POS_1B 0x68970 5290 #define _PS_WIN_POS_2B 0x68A70 5291 #define _PS_WIN_POS_1C 0x69170 5292 5293 #define _PS_WIN_SZ_1A 0x68174 5294 #define _PS_WIN_SZ_2A 0x68274 5295 #define _PS_WIN_SZ_1B 0x68974 5296 #define _PS_WIN_SZ_2B 0x68A74 5297 #define _PS_WIN_SZ_1C 0x69174 5298 5299 #define _PS_VSCALE_1A 0x68184 5300 #define _PS_VSCALE_2A 0x68284 5301 #define _PS_VSCALE_1B 0x68984 5302 #define _PS_VSCALE_2B 0x68A84 5303 #define _PS_VSCALE_1C 0x69184 5304 5305 #define _PS_HSCALE_1A 0x68190 5306 #define _PS_HSCALE_2A 0x68290 5307 #define _PS_HSCALE_1B 0x68990 5308 #define _PS_HSCALE_2B 0x68A90 5309 #define _PS_HSCALE_1C 0x69190 5310 5311 #define _PS_VPHASE_1A 0x68188 5312 #define _PS_VPHASE_2A 0x68288 5313 #define _PS_VPHASE_1B 0x68988 5314 #define _PS_VPHASE_2B 0x68A88 5315 #define _PS_VPHASE_1C 0x69188 5316 #define PS_Y_PHASE(x) ((x) << 16) 5317 #define PS_UV_RGB_PHASE(x) ((x) << 0) 5318 #define PS_PHASE_MASK (0x7fff << 1) /* u2.13 */ 5319 #define PS_PHASE_TRIP (1 << 0) 5320 5321 #define _PS_HPHASE_1A 0x68194 5322 #define _PS_HPHASE_2A 0x68294 5323 #define _PS_HPHASE_1B 0x68994 5324 #define _PS_HPHASE_2B 0x68A94 5325 #define _PS_HPHASE_1C 0x69194 5326 5327 #define _PS_ECC_STAT_1A 0x681D0 5328 #define _PS_ECC_STAT_2A 0x682D0 5329 #define _PS_ECC_STAT_1B 0x689D0 5330 #define _PS_ECC_STAT_2B 0x68AD0 5331 #define _PS_ECC_STAT_1C 0x691D0 5332 5333 #define _PS_COEF_SET0_INDEX_1A 0x68198 5334 #define _PS_COEF_SET0_INDEX_2A 0x68298 5335 #define _PS_COEF_SET0_INDEX_1B 0x68998 5336 #define _PS_COEF_SET0_INDEX_2B 0x68A98 5337 #define PS_COEE_INDEX_AUTO_INC (1 << 10) 5338 5339 #define _PS_COEF_SET0_DATA_1A 0x6819C 5340 #define _PS_COEF_SET0_DATA_2A 0x6829C 5341 #define _PS_COEF_SET0_DATA_1B 0x6899C 5342 #define _PS_COEF_SET0_DATA_2B 0x68A9C 5343 5344 #define _ID(id, a, b) _PICK_EVEN(id, a, b) 5345 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe, \ 5346 _ID(id, _PS_1A_CTRL, _PS_2A_CTRL), \ 5347 _ID(id, _PS_1B_CTRL, _PS_2B_CTRL)) 5348 #define SKL_PS_PWR_GATE(pipe, id) _MMIO_PIPE(pipe, \ 5349 _ID(id, _PS_PWR_GATE_1A, _PS_PWR_GATE_2A), \ 5350 _ID(id, _PS_PWR_GATE_1B, _PS_PWR_GATE_2B)) 5351 #define SKL_PS_WIN_POS(pipe, id) _MMIO_PIPE(pipe, \ 5352 _ID(id, _PS_WIN_POS_1A, _PS_WIN_POS_2A), \ 5353 _ID(id, _PS_WIN_POS_1B, _PS_WIN_POS_2B)) 5354 #define SKL_PS_WIN_SZ(pipe, id) _MMIO_PIPE(pipe, \ 5355 _ID(id, _PS_WIN_SZ_1A, _PS_WIN_SZ_2A), \ 5356 _ID(id, _PS_WIN_SZ_1B, _PS_WIN_SZ_2B)) 5357 #define SKL_PS_VSCALE(pipe, id) _MMIO_PIPE(pipe, \ 5358 _ID(id, _PS_VSCALE_1A, _PS_VSCALE_2A), \ 5359 _ID(id, _PS_VSCALE_1B, _PS_VSCALE_2B)) 5360 #define SKL_PS_HSCALE(pipe, id) _MMIO_PIPE(pipe, \ 5361 _ID(id, _PS_HSCALE_1A, _PS_HSCALE_2A), \ 5362 _ID(id, _PS_HSCALE_1B, _PS_HSCALE_2B)) 5363 #define SKL_PS_VPHASE(pipe, id) _MMIO_PIPE(pipe, \ 5364 _ID(id, _PS_VPHASE_1A, _PS_VPHASE_2A), \ 5365 _ID(id, _PS_VPHASE_1B, _PS_VPHASE_2B)) 5366 #define SKL_PS_HPHASE(pipe, id) _MMIO_PIPE(pipe, \ 5367 _ID(id, _PS_HPHASE_1A, _PS_HPHASE_2A), \ 5368 _ID(id, _PS_HPHASE_1B, _PS_HPHASE_2B)) 5369 #define SKL_PS_ECC_STAT(pipe, id) _MMIO_PIPE(pipe, \ 5370 _ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A), \ 5371 _ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B)) 5372 #define GLK_PS_COEF_INDEX_SET(pipe, id, set) _MMIO_PIPE(pipe, \ 5373 _ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A) + (set) * 8, \ 5374 _ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B) + (set) * 8) 5375 5376 #define GLK_PS_COEF_DATA_SET(pipe, id, set) _MMIO_PIPE(pipe, \ 5377 _ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A) + (set) * 8, \ 5378 _ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B) + (set) * 8) 5379 /* legacy palette */ 5380 #define _LGC_PALETTE_A 0x4a000 5381 #define _LGC_PALETTE_B 0x4a800 5382 #define LGC_PALETTE_RED_MASK REG_GENMASK(23, 16) 5383 #define LGC_PALETTE_GREEN_MASK REG_GENMASK(15, 8) 5384 #define LGC_PALETTE_BLUE_MASK REG_GENMASK(7, 0) 5385 #define LGC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4) 5386 5387 /* ilk/snb precision palette */ 5388 #define _PREC_PALETTE_A 0x4b000 5389 #define _PREC_PALETTE_B 0x4c000 5390 #define PREC_PALETTE_RED_MASK REG_GENMASK(29, 20) 5391 #define PREC_PALETTE_GREEN_MASK REG_GENMASK(19, 10) 5392 #define PREC_PALETTE_BLUE_MASK REG_GENMASK(9, 0) 5393 #define PREC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _PREC_PALETTE_A, _PREC_PALETTE_B) + (i) * 4) 5394 5395 #define _PREC_PIPEAGCMAX 0x4d000 5396 #define _PREC_PIPEBGCMAX 0x4d010 5397 #define PREC_PIPEGCMAX(pipe, i) _MMIO(_PIPE(pipe, _PIPEAGCMAX, _PIPEBGCMAX) + (i) * 4) 5398 5399 #define _GAMMA_MODE_A 0x4a480 5400 #define _GAMMA_MODE_B 0x4ac80 5401 #define GAMMA_MODE(pipe) _MMIO_PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B) 5402 #define PRE_CSC_GAMMA_ENABLE (1 << 31) 5403 #define POST_CSC_GAMMA_ENABLE (1 << 30) 5404 #define GAMMA_MODE_MODE_MASK (3 << 0) 5405 #define GAMMA_MODE_MODE_8BIT (0 << 0) 5406 #define GAMMA_MODE_MODE_10BIT (1 << 0) 5407 #define GAMMA_MODE_MODE_12BIT (2 << 0) 5408 #define GAMMA_MODE_MODE_SPLIT (3 << 0) /* ivb-bdw */ 5409 #define GAMMA_MODE_MODE_12BIT_MULTI_SEGMENTED (3 << 0) /* icl + */ 5410 5411 /* Display Internal Timeout Register */ 5412 #define RM_TIMEOUT _MMIO(0x42060) 5413 #define MMIO_TIMEOUT_US(us) ((us) << 0) 5414 5415 /* interrupts */ 5416 #define DE_MASTER_IRQ_CONTROL (1 << 31) 5417 #define DE_SPRITEB_FLIP_DONE (1 << 29) 5418 #define DE_SPRITEA_FLIP_DONE (1 << 28) 5419 #define DE_PLANEB_FLIP_DONE (1 << 27) 5420 #define DE_PLANEA_FLIP_DONE (1 << 26) 5421 #define DE_PLANE_FLIP_DONE(plane) (1 << (26 + (plane))) 5422 #define DE_PCU_EVENT (1 << 25) 5423 #define DE_GTT_FAULT (1 << 24) 5424 #define DE_POISON (1 << 23) 5425 #define DE_PERFORM_COUNTER (1 << 22) 5426 #define DE_PCH_EVENT (1 << 21) 5427 #define DE_AUX_CHANNEL_A (1 << 20) 5428 #define DE_DP_A_HOTPLUG (1 << 19) 5429 #define DE_GSE (1 << 18) 5430 #define DE_PIPEB_VBLANK (1 << 15) 5431 #define DE_PIPEB_EVEN_FIELD (1 << 14) 5432 #define DE_PIPEB_ODD_FIELD (1 << 13) 5433 #define DE_PIPEB_LINE_COMPARE (1 << 12) 5434 #define DE_PIPEB_VSYNC (1 << 11) 5435 #define DE_PIPEB_CRC_DONE (1 << 10) 5436 #define DE_PIPEB_FIFO_UNDERRUN (1 << 8) 5437 #define DE_PIPEA_VBLANK (1 << 7) 5438 #define DE_PIPE_VBLANK(pipe) (1 << (7 + 8 * (pipe))) 5439 #define DE_PIPEA_EVEN_FIELD (1 << 6) 5440 #define DE_PIPEA_ODD_FIELD (1 << 5) 5441 #define DE_PIPEA_LINE_COMPARE (1 << 4) 5442 #define DE_PIPEA_VSYNC (1 << 3) 5443 #define DE_PIPEA_CRC_DONE (1 << 2) 5444 #define DE_PIPE_CRC_DONE(pipe) (1 << (2 + 8 * (pipe))) 5445 #define DE_PIPEA_FIFO_UNDERRUN (1 << 0) 5446 #define DE_PIPE_FIFO_UNDERRUN(pipe) (1 << (8 * (pipe))) 5447 5448 /* More Ivybridge lolz */ 5449 #define DE_ERR_INT_IVB (1 << 30) 5450 #define DE_GSE_IVB (1 << 29) 5451 #define DE_PCH_EVENT_IVB (1 << 28) 5452 #define DE_DP_A_HOTPLUG_IVB (1 << 27) 5453 #define DE_AUX_CHANNEL_A_IVB (1 << 26) 5454 #define DE_EDP_PSR_INT_HSW (1 << 19) 5455 #define DE_SPRITEC_FLIP_DONE_IVB (1 << 14) 5456 #define DE_PLANEC_FLIP_DONE_IVB (1 << 13) 5457 #define DE_PIPEC_VBLANK_IVB (1 << 10) 5458 #define DE_SPRITEB_FLIP_DONE_IVB (1 << 9) 5459 #define DE_PLANEB_FLIP_DONE_IVB (1 << 8) 5460 #define DE_PIPEB_VBLANK_IVB (1 << 5) 5461 #define DE_SPRITEA_FLIP_DONE_IVB (1 << 4) 5462 #define DE_PLANEA_FLIP_DONE_IVB (1 << 3) 5463 #define DE_PLANE_FLIP_DONE_IVB(plane) (1 << (3 + 5 * (plane))) 5464 #define DE_PIPEA_VBLANK_IVB (1 << 0) 5465 #define DE_PIPE_VBLANK_IVB(pipe) (1 << ((pipe) * 5)) 5466 5467 #define VLV_MASTER_IER _MMIO(0x4400c) /* Gunit master IER */ 5468 #define MASTER_INTERRUPT_ENABLE (1 << 31) 5469 5470 #define DEISR _MMIO(0x44000) 5471 #define DEIMR _MMIO(0x44004) 5472 #define DEIIR _MMIO(0x44008) 5473 #define DEIER _MMIO(0x4400c) 5474 5475 #define GTISR _MMIO(0x44010) 5476 #define GTIMR _MMIO(0x44014) 5477 #define GTIIR _MMIO(0x44018) 5478 #define GTIER _MMIO(0x4401c) 5479 5480 #define GEN8_MASTER_IRQ _MMIO(0x44200) 5481 #define GEN8_MASTER_IRQ_CONTROL (1 << 31) 5482 #define GEN8_PCU_IRQ (1 << 30) 5483 #define GEN8_DE_PCH_IRQ (1 << 23) 5484 #define GEN8_DE_MISC_IRQ (1 << 22) 5485 #define GEN8_DE_PORT_IRQ (1 << 20) 5486 #define GEN8_DE_PIPE_C_IRQ (1 << 18) 5487 #define GEN8_DE_PIPE_B_IRQ (1 << 17) 5488 #define GEN8_DE_PIPE_A_IRQ (1 << 16) 5489 #define GEN8_DE_PIPE_IRQ(pipe) (1 << (16 + (pipe))) 5490 #define GEN8_GT_VECS_IRQ (1 << 6) 5491 #define GEN8_GT_GUC_IRQ (1 << 5) 5492 #define GEN8_GT_PM_IRQ (1 << 4) 5493 #define GEN8_GT_VCS1_IRQ (1 << 3) /* NB: VCS2 in bspec! */ 5494 #define GEN8_GT_VCS0_IRQ (1 << 2) /* NB: VCS1 in bpsec! */ 5495 #define GEN8_GT_BCS_IRQ (1 << 1) 5496 #define GEN8_GT_RCS_IRQ (1 << 0) 5497 5498 #define XELPD_DISPLAY_ERR_FATAL_MASK _MMIO(0x4421c) 5499 5500 #define GEN8_GT_ISR(which) _MMIO(0x44300 + (0x10 * (which))) 5501 #define GEN8_GT_IMR(which) _MMIO(0x44304 + (0x10 * (which))) 5502 #define GEN8_GT_IIR(which) _MMIO(0x44308 + (0x10 * (which))) 5503 #define GEN8_GT_IER(which) _MMIO(0x4430c + (0x10 * (which))) 5504 5505 #define GEN8_RCS_IRQ_SHIFT 0 5506 #define GEN8_BCS_IRQ_SHIFT 16 5507 #define GEN8_VCS0_IRQ_SHIFT 0 /* NB: VCS1 in bspec! */ 5508 #define GEN8_VCS1_IRQ_SHIFT 16 /* NB: VCS2 in bpsec! */ 5509 #define GEN8_VECS_IRQ_SHIFT 0 5510 #define GEN8_WD_IRQ_SHIFT 16 5511 5512 #define GEN8_DE_PIPE_ISR(pipe) _MMIO(0x44400 + (0x10 * (pipe))) 5513 #define GEN8_DE_PIPE_IMR(pipe) _MMIO(0x44404 + (0x10 * (pipe))) 5514 #define GEN8_DE_PIPE_IIR(pipe) _MMIO(0x44408 + (0x10 * (pipe))) 5515 #define GEN8_DE_PIPE_IER(pipe) _MMIO(0x4440c + (0x10 * (pipe))) 5516 #define GEN8_PIPE_FIFO_UNDERRUN (1 << 31) 5517 #define GEN8_PIPE_CDCLK_CRC_ERROR (1 << 29) 5518 #define GEN8_PIPE_CDCLK_CRC_DONE (1 << 28) 5519 #define XELPD_PIPE_SOFT_UNDERRUN (1 << 22) 5520 #define XELPD_PIPE_HARD_UNDERRUN (1 << 21) 5521 #define GEN8_PIPE_CURSOR_FAULT (1 << 10) 5522 #define GEN8_PIPE_SPRITE_FAULT (1 << 9) 5523 #define GEN8_PIPE_PRIMARY_FAULT (1 << 8) 5524 #define GEN8_PIPE_SPRITE_FLIP_DONE (1 << 5) 5525 #define GEN8_PIPE_PRIMARY_FLIP_DONE (1 << 4) 5526 #define GEN8_PIPE_SCAN_LINE_EVENT (1 << 2) 5527 #define GEN8_PIPE_VSYNC (1 << 1) 5528 #define GEN8_PIPE_VBLANK (1 << 0) 5529 #define GEN9_PIPE_CURSOR_FAULT (1 << 11) 5530 #define GEN11_PIPE_PLANE7_FAULT (1 << 22) 5531 #define GEN11_PIPE_PLANE6_FAULT (1 << 21) 5532 #define GEN11_PIPE_PLANE5_FAULT (1 << 20) 5533 #define GEN9_PIPE_PLANE4_FAULT (1 << 10) 5534 #define GEN9_PIPE_PLANE3_FAULT (1 << 9) 5535 #define GEN9_PIPE_PLANE2_FAULT (1 << 8) 5536 #define GEN9_PIPE_PLANE1_FAULT (1 << 7) 5537 #define GEN9_PIPE_PLANE4_FLIP_DONE (1 << 6) 5538 #define GEN9_PIPE_PLANE3_FLIP_DONE (1 << 5) 5539 #define GEN9_PIPE_PLANE2_FLIP_DONE (1 << 4) 5540 #define GEN9_PIPE_PLANE1_FLIP_DONE (1 << 3) 5541 #define GEN9_PIPE_PLANE_FLIP_DONE(p) (1 << (3 + (p))) 5542 #define GEN8_DE_PIPE_IRQ_FAULT_ERRORS \ 5543 (GEN8_PIPE_CURSOR_FAULT | \ 5544 GEN8_PIPE_SPRITE_FAULT | \ 5545 GEN8_PIPE_PRIMARY_FAULT) 5546 #define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \ 5547 (GEN9_PIPE_CURSOR_FAULT | \ 5548 GEN9_PIPE_PLANE4_FAULT | \ 5549 GEN9_PIPE_PLANE3_FAULT | \ 5550 GEN9_PIPE_PLANE2_FAULT | \ 5551 GEN9_PIPE_PLANE1_FAULT) 5552 #define GEN11_DE_PIPE_IRQ_FAULT_ERRORS \ 5553 (GEN9_DE_PIPE_IRQ_FAULT_ERRORS | \ 5554 GEN11_PIPE_PLANE7_FAULT | \ 5555 GEN11_PIPE_PLANE6_FAULT | \ 5556 GEN11_PIPE_PLANE5_FAULT) 5557 #define RKL_DE_PIPE_IRQ_FAULT_ERRORS \ 5558 (GEN9_DE_PIPE_IRQ_FAULT_ERRORS | \ 5559 GEN11_PIPE_PLANE5_FAULT) 5560 5561 #define _HPD_PIN_DDI(hpd_pin) ((hpd_pin) - HPD_PORT_A) 5562 #define _HPD_PIN_TC(hpd_pin) ((hpd_pin) - HPD_PORT_TC1) 5563 5564 #define GEN8_DE_PORT_ISR _MMIO(0x44440) 5565 #define GEN8_DE_PORT_IMR _MMIO(0x44444) 5566 #define GEN8_DE_PORT_IIR _MMIO(0x44448) 5567 #define GEN8_DE_PORT_IER _MMIO(0x4444c) 5568 #define DSI1_NON_TE (1 << 31) 5569 #define DSI0_NON_TE (1 << 30) 5570 #define ICL_AUX_CHANNEL_E (1 << 29) 5571 #define ICL_AUX_CHANNEL_F (1 << 28) 5572 #define GEN9_AUX_CHANNEL_D (1 << 27) 5573 #define GEN9_AUX_CHANNEL_C (1 << 26) 5574 #define GEN9_AUX_CHANNEL_B (1 << 25) 5575 #define DSI1_TE (1 << 24) 5576 #define DSI0_TE (1 << 23) 5577 #define GEN8_DE_PORT_HOTPLUG(hpd_pin) REG_BIT(3 + _HPD_PIN_DDI(hpd_pin)) 5578 #define BXT_DE_PORT_HOTPLUG_MASK (GEN8_DE_PORT_HOTPLUG(HPD_PORT_A) | \ 5579 GEN8_DE_PORT_HOTPLUG(HPD_PORT_B) | \ 5580 GEN8_DE_PORT_HOTPLUG(HPD_PORT_C)) 5581 #define BDW_DE_PORT_HOTPLUG_MASK GEN8_DE_PORT_HOTPLUG(HPD_PORT_A) 5582 #define BXT_DE_PORT_GMBUS (1 << 1) 5583 #define GEN8_AUX_CHANNEL_A (1 << 0) 5584 #define TGL_DE_PORT_AUX_USBC6 REG_BIT(13) 5585 #define XELPD_DE_PORT_AUX_DDIE REG_BIT(13) 5586 #define TGL_DE_PORT_AUX_USBC5 REG_BIT(12) 5587 #define XELPD_DE_PORT_AUX_DDID REG_BIT(12) 5588 #define TGL_DE_PORT_AUX_USBC4 REG_BIT(11) 5589 #define TGL_DE_PORT_AUX_USBC3 REG_BIT(10) 5590 #define TGL_DE_PORT_AUX_USBC2 REG_BIT(9) 5591 #define TGL_DE_PORT_AUX_USBC1 REG_BIT(8) 5592 #define TGL_DE_PORT_AUX_DDIC REG_BIT(2) 5593 #define TGL_DE_PORT_AUX_DDIB REG_BIT(1) 5594 #define TGL_DE_PORT_AUX_DDIA REG_BIT(0) 5595 5596 #define GEN8_DE_MISC_ISR _MMIO(0x44460) 5597 #define GEN8_DE_MISC_IMR _MMIO(0x44464) 5598 #define GEN8_DE_MISC_IIR _MMIO(0x44468) 5599 #define GEN8_DE_MISC_IER _MMIO(0x4446c) 5600 #define GEN8_DE_MISC_GSE (1 << 27) 5601 #define GEN8_DE_EDP_PSR (1 << 19) 5602 5603 #define GEN8_PCU_ISR _MMIO(0x444e0) 5604 #define GEN8_PCU_IMR _MMIO(0x444e4) 5605 #define GEN8_PCU_IIR _MMIO(0x444e8) 5606 #define GEN8_PCU_IER _MMIO(0x444ec) 5607 5608 #define GEN11_GU_MISC_ISR _MMIO(0x444f0) 5609 #define GEN11_GU_MISC_IMR _MMIO(0x444f4) 5610 #define GEN11_GU_MISC_IIR _MMIO(0x444f8) 5611 #define GEN11_GU_MISC_IER _MMIO(0x444fc) 5612 #define GEN11_GU_MISC_GSE (1 << 27) 5613 5614 #define GEN11_GFX_MSTR_IRQ _MMIO(0x190010) 5615 #define GEN11_MASTER_IRQ (1 << 31) 5616 #define GEN11_PCU_IRQ (1 << 30) 5617 #define GEN11_GU_MISC_IRQ (1 << 29) 5618 #define GEN11_DISPLAY_IRQ (1 << 16) 5619 #define GEN11_GT_DW_IRQ(x) (1 << (x)) 5620 #define GEN11_GT_DW1_IRQ (1 << 1) 5621 #define GEN11_GT_DW0_IRQ (1 << 0) 5622 5623 #define DG1_MSTR_TILE_INTR _MMIO(0x190008) 5624 #define DG1_MSTR_IRQ REG_BIT(31) 5625 #define DG1_MSTR_TILE(t) REG_BIT(t) 5626 5627 #define GEN11_DISPLAY_INT_CTL _MMIO(0x44200) 5628 #define GEN11_DISPLAY_IRQ_ENABLE (1 << 31) 5629 #define GEN11_AUDIO_CODEC_IRQ (1 << 24) 5630 #define GEN11_DE_PCH_IRQ (1 << 23) 5631 #define GEN11_DE_MISC_IRQ (1 << 22) 5632 #define GEN11_DE_HPD_IRQ (1 << 21) 5633 #define GEN11_DE_PORT_IRQ (1 << 20) 5634 #define GEN11_DE_PIPE_C (1 << 18) 5635 #define GEN11_DE_PIPE_B (1 << 17) 5636 #define GEN11_DE_PIPE_A (1 << 16) 5637 5638 #define GEN11_DE_HPD_ISR _MMIO(0x44470) 5639 #define GEN11_DE_HPD_IMR _MMIO(0x44474) 5640 #define GEN11_DE_HPD_IIR _MMIO(0x44478) 5641 #define GEN11_DE_HPD_IER _MMIO(0x4447c) 5642 #define GEN11_TC_HOTPLUG(hpd_pin) REG_BIT(16 + _HPD_PIN_TC(hpd_pin)) 5643 #define GEN11_DE_TC_HOTPLUG_MASK (GEN11_TC_HOTPLUG(HPD_PORT_TC6) | \ 5644 GEN11_TC_HOTPLUG(HPD_PORT_TC5) | \ 5645 GEN11_TC_HOTPLUG(HPD_PORT_TC4) | \ 5646 GEN11_TC_HOTPLUG(HPD_PORT_TC3) | \ 5647 GEN11_TC_HOTPLUG(HPD_PORT_TC2) | \ 5648 GEN11_TC_HOTPLUG(HPD_PORT_TC1)) 5649 #define GEN11_TBT_HOTPLUG(hpd_pin) REG_BIT(_HPD_PIN_TC(hpd_pin)) 5650 #define GEN11_DE_TBT_HOTPLUG_MASK (GEN11_TBT_HOTPLUG(HPD_PORT_TC6) | \ 5651 GEN11_TBT_HOTPLUG(HPD_PORT_TC5) | \ 5652 GEN11_TBT_HOTPLUG(HPD_PORT_TC4) | \ 5653 GEN11_TBT_HOTPLUG(HPD_PORT_TC3) | \ 5654 GEN11_TBT_HOTPLUG(HPD_PORT_TC2) | \ 5655 GEN11_TBT_HOTPLUG(HPD_PORT_TC1)) 5656 5657 #define GEN11_TBT_HOTPLUG_CTL _MMIO(0x44030) 5658 #define GEN11_TC_HOTPLUG_CTL _MMIO(0x44038) 5659 #define GEN11_HOTPLUG_CTL_ENABLE(hpd_pin) (8 << (_HPD_PIN_TC(hpd_pin) * 4)) 5660 #define GEN11_HOTPLUG_CTL_LONG_DETECT(hpd_pin) (2 << (_HPD_PIN_TC(hpd_pin) * 4)) 5661 #define GEN11_HOTPLUG_CTL_SHORT_DETECT(hpd_pin) (1 << (_HPD_PIN_TC(hpd_pin) * 4)) 5662 #define GEN11_HOTPLUG_CTL_NO_DETECT(hpd_pin) (0 << (_HPD_PIN_TC(hpd_pin) * 4)) 5663 5664 #define ILK_DISPLAY_CHICKEN2 _MMIO(0x42004) 5665 /* Required on all Ironlake and Sandybridge according to the B-Spec. */ 5666 #define ILK_ELPIN_409_SELECT (1 << 25) 5667 #define ILK_DPARB_GATE (1 << 22) 5668 #define ILK_VSDPFD_FULL (1 << 21) 5669 #define FUSE_STRAP _MMIO(0x42014) 5670 #define ILK_INTERNAL_GRAPHICS_DISABLE (1 << 31) 5671 #define ILK_INTERNAL_DISPLAY_DISABLE (1 << 30) 5672 #define ILK_DISPLAY_DEBUG_DISABLE (1 << 29) 5673 #define IVB_PIPE_C_DISABLE (1 << 28) 5674 #define ILK_HDCP_DISABLE (1 << 25) 5675 #define ILK_eDP_A_DISABLE (1 << 24) 5676 #define HSW_CDCLK_LIMIT (1 << 24) 5677 #define ILK_DESKTOP (1 << 23) 5678 #define HSW_CPU_SSC_ENABLE (1 << 21) 5679 5680 #define FUSE_STRAP3 _MMIO(0x42020) 5681 #define HSW_REF_CLK_SELECT (1 << 1) 5682 5683 #define ILK_DSPCLK_GATE_D _MMIO(0x42020) 5684 #define ILK_VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) 5685 #define ILK_DPFCUNIT_CLOCK_GATE_DISABLE (1 << 9) 5686 #define ILK_DPFCRUNIT_CLOCK_GATE_DISABLE (1 << 8) 5687 #define ILK_DPFDUNIT_CLOCK_GATE_ENABLE (1 << 7) 5688 #define ILK_DPARBUNIT_CLOCK_GATE_ENABLE (1 << 5) 5689 5690 #define IVB_CHICKEN3 _MMIO(0x4200c) 5691 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE (1 << 5) 5692 # define CHICKEN3_DGMG_DONE_FIX_DISABLE (1 << 2) 5693 5694 #define CHICKEN_PAR1_1 _MMIO(0x42080) 5695 #define IGNORE_KVMR_PIPE_A REG_BIT(23) 5696 #define KBL_ARB_FILL_SPARE_22 REG_BIT(22) 5697 #define DIS_RAM_BYPASS_PSR2_MAN_TRACK (1 << 16) 5698 #define SKL_DE_COMPRESSED_HASH_MODE (1 << 15) 5699 #define DPA_MASK_VBLANK_SRD (1 << 15) 5700 #define FORCE_ARB_IDLE_PLANES (1 << 14) 5701 #define SKL_EDP_PSR_FIX_RDWRAP (1 << 3) 5702 #define IGNORE_PSR2_HW_TRACKING (1 << 1) 5703 5704 #define CHICKEN_PAR2_1 _MMIO(0x42090) 5705 #define KVM_CONFIG_CHANGE_NOTIFICATION_SELECT (1 << 14) 5706 5707 #define CHICKEN_MISC_2 _MMIO(0x42084) 5708 #define KBL_ARB_FILL_SPARE_14 REG_BIT(14) 5709 #define KBL_ARB_FILL_SPARE_13 REG_BIT(13) 5710 #define GLK_CL2_PWR_DOWN (1 << 12) 5711 #define GLK_CL1_PWR_DOWN (1 << 11) 5712 #define GLK_CL0_PWR_DOWN (1 << 10) 5713 5714 #define CHICKEN_MISC_4 _MMIO(0x4208c) 5715 #define CHICKEN_FBC_STRIDE_OVERRIDE REG_BIT(13) 5716 #define CHICKEN_FBC_STRIDE_MASK REG_GENMASK(12, 0) 5717 #define CHICKEN_FBC_STRIDE(x) REG_FIELD_PREP(CHICKEN_FBC_STRIDE_MASK, (x)) 5718 5719 #define _CHICKEN_PIPESL_1_A 0x420b0 5720 #define _CHICKEN_PIPESL_1_B 0x420b4 5721 #define HSW_PRI_STRETCH_MAX_MASK REG_GENMASK(28, 27) 5722 #define HSW_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 0) 5723 #define HSW_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 1) 5724 #define HSW_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 2) 5725 #define HSW_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 3) 5726 #define HSW_SPR_STRETCH_MAX_MASK REG_GENMASK(26, 25) 5727 #define HSW_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 0) 5728 #define HSW_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 1) 5729 #define HSW_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 2) 5730 #define HSW_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 3) 5731 #define HSW_FBCQ_DIS (1 << 22) 5732 #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0) 5733 #define SKL_PLANE1_STRETCH_MAX_MASK REG_GENMASK(1, 0) 5734 #define SKL_PLANE1_STRETCH_MAX_X8 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 0) 5735 #define SKL_PLANE1_STRETCH_MAX_X4 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 1) 5736 #define SKL_PLANE1_STRETCH_MAX_X2 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 2) 5737 #define SKL_PLANE1_STRETCH_MAX_X1 REG_FIELD_PREP(SKL_PLANE1_STRETCH_MAX_MASK, 3) 5738 #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B) 5739 5740 #define _CHICKEN_TRANS_A 0x420c0 5741 #define _CHICKEN_TRANS_B 0x420c4 5742 #define _CHICKEN_TRANS_C 0x420c8 5743 #define _CHICKEN_TRANS_EDP 0x420cc 5744 #define _CHICKEN_TRANS_D 0x420d8 5745 #define CHICKEN_TRANS(trans) _MMIO(_PICK((trans), \ 5746 [TRANSCODER_EDP] = _CHICKEN_TRANS_EDP, \ 5747 [TRANSCODER_A] = _CHICKEN_TRANS_A, \ 5748 [TRANSCODER_B] = _CHICKEN_TRANS_B, \ 5749 [TRANSCODER_C] = _CHICKEN_TRANS_C, \ 5750 [TRANSCODER_D] = _CHICKEN_TRANS_D)) 5751 5752 #define _MTL_CHICKEN_TRANS_A 0x604e0 5753 #define _MTL_CHICKEN_TRANS_B 0x614e0 5754 #define MTL_CHICKEN_TRANS(trans) _MMIO_TRANS((trans), \ 5755 _MTL_CHICKEN_TRANS_A, \ 5756 _MTL_CHICKEN_TRANS_B) 5757 5758 #define HSW_FRAME_START_DELAY_MASK REG_GENMASK(28, 27) 5759 #define HSW_FRAME_START_DELAY(x) REG_FIELD_PREP(HSW_FRAME_START_DELAY_MASK, x) 5760 #define VSC_DATA_SEL_SOFTWARE_CONTROL REG_BIT(25) /* GLK */ 5761 #define FECSTALL_DIS_DPTSTREAM_DPTTG REG_BIT(23) 5762 #define DDI_TRAINING_OVERRIDE_ENABLE REG_BIT(19) 5763 #define ADLP_1_BASED_X_GRANULARITY REG_BIT(18) 5764 #define DDI_TRAINING_OVERRIDE_VALUE REG_BIT(18) 5765 #define DDIE_TRAINING_OVERRIDE_ENABLE REG_BIT(17) /* CHICKEN_TRANS_A only */ 5766 #define DDIE_TRAINING_OVERRIDE_VALUE REG_BIT(16) /* CHICKEN_TRANS_A only */ 5767 #define PSR2_ADD_VERTICAL_LINE_COUNT REG_BIT(15) 5768 #define PSR2_VSC_ENABLE_PROG_HEADER REG_BIT(12) 5769 5770 #define DISP_ARB_CTL _MMIO(0x45000) 5771 #define DISP_FBC_MEMORY_WAKE (1 << 31) 5772 #define DISP_TILE_SURFACE_SWIZZLING (1 << 13) 5773 #define DISP_FBC_WM_DIS (1 << 15) 5774 #define DISP_ARB_CTL2 _MMIO(0x45004) 5775 #define DISP_DATA_PARTITION_5_6 (1 << 6) 5776 #define DISP_IPC_ENABLE (1 << 3) 5777 5778 /* 5779 * The below are numbered starting from "S1" on gen11/gen12, but starting 5780 * with display 13, the bspec switches to a 0-based numbering scheme 5781 * (although the addresses stay the same so new S0 = old S1, new S1 = old S2). 5782 * We'll just use the 0-based numbering here for all platforms since it's the 5783 * way things will be named by the hardware team going forward, plus it's more 5784 * consistent with how most of the rest of our registers are named. 5785 */ 5786 #define _DBUF_CTL_S0 0x45008 5787 #define _DBUF_CTL_S1 0x44FE8 5788 #define _DBUF_CTL_S2 0x44300 5789 #define _DBUF_CTL_S3 0x44304 5790 #define DBUF_CTL_S(slice) _MMIO(_PICK(slice, \ 5791 _DBUF_CTL_S0, \ 5792 _DBUF_CTL_S1, \ 5793 _DBUF_CTL_S2, \ 5794 _DBUF_CTL_S3)) 5795 #define DBUF_POWER_REQUEST REG_BIT(31) 5796 #define DBUF_POWER_STATE REG_BIT(30) 5797 #define DBUF_TRACKER_STATE_SERVICE_MASK REG_GENMASK(23, 19) 5798 #define DBUF_TRACKER_STATE_SERVICE(x) REG_FIELD_PREP(DBUF_TRACKER_STATE_SERVICE_MASK, x) 5799 #define DBUF_MIN_TRACKER_STATE_SERVICE_MASK REG_GENMASK(18, 16) /* ADL-P+ */ 5800 #define DBUF_MIN_TRACKER_STATE_SERVICE(x) REG_FIELD_PREP(DBUF_MIN_TRACKER_STATE_SERVICE_MASK, x) /* ADL-P+ */ 5801 5802 #define GEN7_MSG_CTL _MMIO(0x45010) 5803 #define WAIT_FOR_PCH_RESET_ACK (1 << 1) 5804 #define WAIT_FOR_PCH_FLR_ACK (1 << 0) 5805 5806 #define _BW_BUDDY0_CTL 0x45130 5807 #define _BW_BUDDY1_CTL 0x45140 5808 #define BW_BUDDY_CTL(x) _MMIO(_PICK_EVEN(x, \ 5809 _BW_BUDDY0_CTL, \ 5810 _BW_BUDDY1_CTL)) 5811 #define BW_BUDDY_DISABLE REG_BIT(31) 5812 #define BW_BUDDY_TLB_REQ_TIMER_MASK REG_GENMASK(21, 16) 5813 #define BW_BUDDY_TLB_REQ_TIMER(x) REG_FIELD_PREP(BW_BUDDY_TLB_REQ_TIMER_MASK, x) 5814 5815 #define _BW_BUDDY0_PAGE_MASK 0x45134 5816 #define _BW_BUDDY1_PAGE_MASK 0x45144 5817 #define BW_BUDDY_PAGE_MASK(x) _MMIO(_PICK_EVEN(x, \ 5818 _BW_BUDDY0_PAGE_MASK, \ 5819 _BW_BUDDY1_PAGE_MASK)) 5820 5821 #define HSW_NDE_RSTWRN_OPT _MMIO(0x46408) 5822 #define MTL_RESET_PICA_HANDSHAKE_EN REG_BIT(6) 5823 #define RESET_PCH_HANDSHAKE_ENABLE REG_BIT(4) 5824 5825 #define GEN8_CHICKEN_DCPR_1 _MMIO(0x46430) 5826 #define SKL_SELECT_ALTERNATE_DC_EXIT REG_BIT(30) 5827 #define LATENCY_REPORTING_REMOVED_PIPE_C REG_BIT(25) 5828 #define LATENCY_REPORTING_REMOVED_PIPE_B REG_BIT(24) 5829 #define LATENCY_REPORTING_REMOVED_PIPE_A REG_BIT(23) 5830 #define ICL_DELAY_PMRSP REG_BIT(22) 5831 #define DISABLE_FLR_SRC REG_BIT(15) 5832 #define MASK_WAKEMEM REG_BIT(13) 5833 #define DDI_CLOCK_REG_ACCESS REG_BIT(7) 5834 5835 #define GEN11_CHICKEN_DCPR_2 _MMIO(0x46434) 5836 #define DCPR_MASK_MAXLATENCY_MEMUP_CLR REG_BIT(27) 5837 #define DCPR_MASK_LPMODE REG_BIT(26) 5838 #define DCPR_SEND_RESP_IMM REG_BIT(25) 5839 #define DCPR_CLEAR_MEMSTAT_DIS REG_BIT(24) 5840 5841 #define SKL_DFSM _MMIO(0x51000) 5842 #define SKL_DFSM_DISPLAY_PM_DISABLE (1 << 27) 5843 #define SKL_DFSM_DISPLAY_HDCP_DISABLE (1 << 25) 5844 #define SKL_DFSM_CDCLK_LIMIT_MASK (3 << 23) 5845 #define SKL_DFSM_CDCLK_LIMIT_675 (0 << 23) 5846 #define SKL_DFSM_CDCLK_LIMIT_540 (1 << 23) 5847 #define SKL_DFSM_CDCLK_LIMIT_450 (2 << 23) 5848 #define SKL_DFSM_CDCLK_LIMIT_337_5 (3 << 23) 5849 #define ICL_DFSM_DMC_DISABLE (1 << 23) 5850 #define SKL_DFSM_PIPE_A_DISABLE (1 << 30) 5851 #define SKL_DFSM_PIPE_B_DISABLE (1 << 21) 5852 #define SKL_DFSM_PIPE_C_DISABLE (1 << 28) 5853 #define TGL_DFSM_PIPE_D_DISABLE (1 << 22) 5854 #define GLK_DFSM_DISPLAY_DSC_DISABLE (1 << 7) 5855 5856 #define SKL_DSSM _MMIO(0x51004) 5857 #define ICL_DSSM_CDCLK_PLL_REFCLK_MASK (7 << 29) 5858 #define ICL_DSSM_CDCLK_PLL_REFCLK_24MHz (0 << 29) 5859 #define ICL_DSSM_CDCLK_PLL_REFCLK_19_2MHz (1 << 29) 5860 #define ICL_DSSM_CDCLK_PLL_REFCLK_38_4MHz (2 << 29) 5861 5862 #define GMD_ID_DISPLAY _MMIO(0x510a0) 5863 #define GMD_ID_ARCH_MASK REG_GENMASK(31, 22) 5864 #define GMD_ID_RELEASE_MASK REG_GENMASK(21, 14) 5865 #define GMD_ID_STEP REG_GENMASK(5, 0) 5866 5867 /*GEN11 chicken */ 5868 #define _PIPEA_CHICKEN 0x70038 5869 #define _PIPEB_CHICKEN 0x71038 5870 #define _PIPEC_CHICKEN 0x72038 5871 #define PIPE_CHICKEN(pipe) _MMIO_PIPE(pipe, _PIPEA_CHICKEN,\ 5872 _PIPEB_CHICKEN) 5873 #define UNDERRUN_RECOVERY_DISABLE_ADLP REG_BIT(30) 5874 #define UNDERRUN_RECOVERY_ENABLE_DG2 REG_BIT(30) 5875 #define PIXEL_ROUNDING_TRUNC_FB_PASSTHRU REG_BIT(15) 5876 #define DG2_RENDER_CCSTAG_4_3_EN REG_BIT(12) 5877 #define PER_PIXEL_ALPHA_BYPASS_EN REG_BIT(7) 5878 5879 /* PCH */ 5880 5881 #define PCH_DISPLAY_BASE 0xc0000u 5882 5883 /* south display engine interrupt: IBX */ 5884 #define SDE_AUDIO_POWER_D (1 << 27) 5885 #define SDE_AUDIO_POWER_C (1 << 26) 5886 #define SDE_AUDIO_POWER_B (1 << 25) 5887 #define SDE_AUDIO_POWER_SHIFT (25) 5888 #define SDE_AUDIO_POWER_MASK (7 << SDE_AUDIO_POWER_SHIFT) 5889 #define SDE_GMBUS (1 << 24) 5890 #define SDE_AUDIO_HDCP_TRANSB (1 << 23) 5891 #define SDE_AUDIO_HDCP_TRANSA (1 << 22) 5892 #define SDE_AUDIO_HDCP_MASK (3 << 22) 5893 #define SDE_AUDIO_TRANSB (1 << 21) 5894 #define SDE_AUDIO_TRANSA (1 << 20) 5895 #define SDE_AUDIO_TRANS_MASK (3 << 20) 5896 #define SDE_POISON (1 << 19) 5897 /* 18 reserved */ 5898 #define SDE_FDI_RXB (1 << 17) 5899 #define SDE_FDI_RXA (1 << 16) 5900 #define SDE_FDI_MASK (3 << 16) 5901 #define SDE_AUXD (1 << 15) 5902 #define SDE_AUXC (1 << 14) 5903 #define SDE_AUXB (1 << 13) 5904 #define SDE_AUX_MASK (7 << 13) 5905 /* 12 reserved */ 5906 #define SDE_CRT_HOTPLUG (1 << 11) 5907 #define SDE_PORTD_HOTPLUG (1 << 10) 5908 #define SDE_PORTC_HOTPLUG (1 << 9) 5909 #define SDE_PORTB_HOTPLUG (1 << 8) 5910 #define SDE_SDVOB_HOTPLUG (1 << 6) 5911 #define SDE_HOTPLUG_MASK (SDE_CRT_HOTPLUG | \ 5912 SDE_SDVOB_HOTPLUG | \ 5913 SDE_PORTB_HOTPLUG | \ 5914 SDE_PORTC_HOTPLUG | \ 5915 SDE_PORTD_HOTPLUG) 5916 #define SDE_TRANSB_CRC_DONE (1 << 5) 5917 #define SDE_TRANSB_CRC_ERR (1 << 4) 5918 #define SDE_TRANSB_FIFO_UNDER (1 << 3) 5919 #define SDE_TRANSA_CRC_DONE (1 << 2) 5920 #define SDE_TRANSA_CRC_ERR (1 << 1) 5921 #define SDE_TRANSA_FIFO_UNDER (1 << 0) 5922 #define SDE_TRANS_MASK (0x3f) 5923 5924 /* south display engine interrupt: CPT - CNP */ 5925 #define SDE_AUDIO_POWER_D_CPT (1 << 31) 5926 #define SDE_AUDIO_POWER_C_CPT (1 << 30) 5927 #define SDE_AUDIO_POWER_B_CPT (1 << 29) 5928 #define SDE_AUDIO_POWER_SHIFT_CPT 29 5929 #define SDE_AUDIO_POWER_MASK_CPT (7 << 29) 5930 #define SDE_AUXD_CPT (1 << 27) 5931 #define SDE_AUXC_CPT (1 << 26) 5932 #define SDE_AUXB_CPT (1 << 25) 5933 #define SDE_AUX_MASK_CPT (7 << 25) 5934 #define SDE_PORTE_HOTPLUG_SPT (1 << 25) 5935 #define SDE_PORTA_HOTPLUG_SPT (1 << 24) 5936 #define SDE_PORTD_HOTPLUG_CPT (1 << 23) 5937 #define SDE_PORTC_HOTPLUG_CPT (1 << 22) 5938 #define SDE_PORTB_HOTPLUG_CPT (1 << 21) 5939 #define SDE_CRT_HOTPLUG_CPT (1 << 19) 5940 #define SDE_SDVOB_HOTPLUG_CPT (1 << 18) 5941 #define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \ 5942 SDE_SDVOB_HOTPLUG_CPT | \ 5943 SDE_PORTD_HOTPLUG_CPT | \ 5944 SDE_PORTC_HOTPLUG_CPT | \ 5945 SDE_PORTB_HOTPLUG_CPT) 5946 #define SDE_HOTPLUG_MASK_SPT (SDE_PORTE_HOTPLUG_SPT | \ 5947 SDE_PORTD_HOTPLUG_CPT | \ 5948 SDE_PORTC_HOTPLUG_CPT | \ 5949 SDE_PORTB_HOTPLUG_CPT | \ 5950 SDE_PORTA_HOTPLUG_SPT) 5951 #define SDE_GMBUS_CPT (1 << 17) 5952 #define SDE_ERROR_CPT (1 << 16) 5953 #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10) 5954 #define SDE_AUDIO_CP_CHG_C_CPT (1 << 9) 5955 #define SDE_FDI_RXC_CPT (1 << 8) 5956 #define SDE_AUDIO_CP_REQ_B_CPT (1 << 6) 5957 #define SDE_AUDIO_CP_CHG_B_CPT (1 << 5) 5958 #define SDE_FDI_RXB_CPT (1 << 4) 5959 #define SDE_AUDIO_CP_REQ_A_CPT (1 << 2) 5960 #define SDE_AUDIO_CP_CHG_A_CPT (1 << 1) 5961 #define SDE_FDI_RXA_CPT (1 << 0) 5962 #define SDE_AUDIO_CP_REQ_CPT (SDE_AUDIO_CP_REQ_C_CPT | \ 5963 SDE_AUDIO_CP_REQ_B_CPT | \ 5964 SDE_AUDIO_CP_REQ_A_CPT) 5965 #define SDE_AUDIO_CP_CHG_CPT (SDE_AUDIO_CP_CHG_C_CPT | \ 5966 SDE_AUDIO_CP_CHG_B_CPT | \ 5967 SDE_AUDIO_CP_CHG_A_CPT) 5968 #define SDE_FDI_MASK_CPT (SDE_FDI_RXC_CPT | \ 5969 SDE_FDI_RXB_CPT | \ 5970 SDE_FDI_RXA_CPT) 5971 5972 /* south display engine interrupt: ICP/TGP */ 5973 #define SDE_GMBUS_ICP (1 << 23) 5974 #define SDE_TC_HOTPLUG_ICP(hpd_pin) REG_BIT(24 + _HPD_PIN_TC(hpd_pin)) 5975 #define SDE_TC_HOTPLUG_DG2(hpd_pin) REG_BIT(25 + _HPD_PIN_TC(hpd_pin)) /* sigh */ 5976 #define SDE_DDI_HOTPLUG_ICP(hpd_pin) REG_BIT(16 + _HPD_PIN_DDI(hpd_pin)) 5977 #define SDE_DDI_HOTPLUG_MASK_ICP (SDE_DDI_HOTPLUG_ICP(HPD_PORT_D) | \ 5978 SDE_DDI_HOTPLUG_ICP(HPD_PORT_C) | \ 5979 SDE_DDI_HOTPLUG_ICP(HPD_PORT_B) | \ 5980 SDE_DDI_HOTPLUG_ICP(HPD_PORT_A)) 5981 #define SDE_TC_HOTPLUG_MASK_ICP (SDE_TC_HOTPLUG_ICP(HPD_PORT_TC6) | \ 5982 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC5) | \ 5983 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC4) | \ 5984 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC3) | \ 5985 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC2) | \ 5986 SDE_TC_HOTPLUG_ICP(HPD_PORT_TC1)) 5987 5988 #define SDEISR _MMIO(0xc4000) 5989 #define SDEIMR _MMIO(0xc4004) 5990 #define SDEIIR _MMIO(0xc4008) 5991 #define SDEIER _MMIO(0xc400c) 5992 5993 #define SERR_INT _MMIO(0xc4040) 5994 #define SERR_INT_POISON (1 << 31) 5995 #define SERR_INT_TRANS_FIFO_UNDERRUN(pipe) (1 << ((pipe) * 3)) 5996 5997 /* digital port hotplug */ 5998 #define PCH_PORT_HOTPLUG _MMIO(0xc4030) /* SHOTPLUG_CTL */ 5999 #define PORTA_HOTPLUG_ENABLE (1 << 28) /* LPT:LP+ & BXT */ 6000 #define BXT_DDIA_HPD_INVERT (1 << 27) 6001 #define PORTA_HOTPLUG_STATUS_MASK (3 << 24) /* SPT+ & BXT */ 6002 #define PORTA_HOTPLUG_NO_DETECT (0 << 24) /* SPT+ & BXT */ 6003 #define PORTA_HOTPLUG_SHORT_DETECT (1 << 24) /* SPT+ & BXT */ 6004 #define PORTA_HOTPLUG_LONG_DETECT (2 << 24) /* SPT+ & BXT */ 6005 #define PORTD_HOTPLUG_ENABLE (1 << 20) 6006 #define PORTD_PULSE_DURATION_2ms (0 << 18) /* pre-LPT */ 6007 #define PORTD_PULSE_DURATION_4_5ms (1 << 18) /* pre-LPT */ 6008 #define PORTD_PULSE_DURATION_6ms (2 << 18) /* pre-LPT */ 6009 #define PORTD_PULSE_DURATION_100ms (3 << 18) /* pre-LPT */ 6010 #define PORTD_PULSE_DURATION_MASK (3 << 18) /* pre-LPT */ 6011 #define PORTD_HOTPLUG_STATUS_MASK (3 << 16) 6012 #define PORTD_HOTPLUG_NO_DETECT (0 << 16) 6013 #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16) 6014 #define PORTD_HOTPLUG_LONG_DETECT (2 << 16) 6015 #define PORTC_HOTPLUG_ENABLE (1 << 12) 6016 #define BXT_DDIC_HPD_INVERT (1 << 11) 6017 #define PORTC_PULSE_DURATION_2ms (0 << 10) /* pre-LPT */ 6018 #define PORTC_PULSE_DURATION_4_5ms (1 << 10) /* pre-LPT */ 6019 #define PORTC_PULSE_DURATION_6ms (2 << 10) /* pre-LPT */ 6020 #define PORTC_PULSE_DURATION_100ms (3 << 10) /* pre-LPT */ 6021 #define PORTC_PULSE_DURATION_MASK (3 << 10) /* pre-LPT */ 6022 #define PORTC_HOTPLUG_STATUS_MASK (3 << 8) 6023 #define PORTC_HOTPLUG_NO_DETECT (0 << 8) 6024 #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8) 6025 #define PORTC_HOTPLUG_LONG_DETECT (2 << 8) 6026 #define PORTB_HOTPLUG_ENABLE (1 << 4) 6027 #define BXT_DDIB_HPD_INVERT (1 << 3) 6028 #define PORTB_PULSE_DURATION_2ms (0 << 2) /* pre-LPT */ 6029 #define PORTB_PULSE_DURATION_4_5ms (1 << 2) /* pre-LPT */ 6030 #define PORTB_PULSE_DURATION_6ms (2 << 2) /* pre-LPT */ 6031 #define PORTB_PULSE_DURATION_100ms (3 << 2) /* pre-LPT */ 6032 #define PORTB_PULSE_DURATION_MASK (3 << 2) /* pre-LPT */ 6033 #define PORTB_HOTPLUG_STATUS_MASK (3 << 0) 6034 #define PORTB_HOTPLUG_NO_DETECT (0 << 0) 6035 #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0) 6036 #define PORTB_HOTPLUG_LONG_DETECT (2 << 0) 6037 #define BXT_DDI_HPD_INVERT_MASK (BXT_DDIA_HPD_INVERT | \ 6038 BXT_DDIB_HPD_INVERT | \ 6039 BXT_DDIC_HPD_INVERT) 6040 6041 #define PCH_PORT_HOTPLUG2 _MMIO(0xc403C) /* SHOTPLUG_CTL2 SPT+ */ 6042 #define PORTE_HOTPLUG_ENABLE (1 << 4) 6043 #define PORTE_HOTPLUG_STATUS_MASK (3 << 0) 6044 #define PORTE_HOTPLUG_NO_DETECT (0 << 0) 6045 #define PORTE_HOTPLUG_SHORT_DETECT (1 << 0) 6046 #define PORTE_HOTPLUG_LONG_DETECT (2 << 0) 6047 6048 /* This register is a reuse of PCH_PORT_HOTPLUG register. The 6049 * functionality covered in PCH_PORT_HOTPLUG is split into 6050 * SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. 6051 */ 6052 6053 #define SHOTPLUG_CTL_DDI _MMIO(0xc4030) 6054 #define SHOTPLUG_CTL_DDI_HPD_ENABLE(hpd_pin) (0x8 << (_HPD_PIN_DDI(hpd_pin) * 4)) 6055 #define SHOTPLUG_CTL_DDI_HPD_STATUS_MASK(hpd_pin) (0x3 << (_HPD_PIN_DDI(hpd_pin) * 4)) 6056 #define SHOTPLUG_CTL_DDI_HPD_NO_DETECT(hpd_pin) (0x0 << (_HPD_PIN_DDI(hpd_pin) * 4)) 6057 #define SHOTPLUG_CTL_DDI_HPD_SHORT_DETECT(hpd_pin) (0x1 << (_HPD_PIN_DDI(hpd_pin) * 4)) 6058 #define SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(hpd_pin) (0x2 << (_HPD_PIN_DDI(hpd_pin) * 4)) 6059 #define SHOTPLUG_CTL_DDI_HPD_SHORT_LONG_DETECT(hpd_pin) (0x3 << (_HPD_PIN_DDI(hpd_pin) * 4)) 6060 6061 #define SHOTPLUG_CTL_TC _MMIO(0xc4034) 6062 #define ICP_TC_HPD_ENABLE(hpd_pin) (8 << (_HPD_PIN_TC(hpd_pin) * 4)) 6063 #define ICP_TC_HPD_LONG_DETECT(hpd_pin) (2 << (_HPD_PIN_TC(hpd_pin) * 4)) 6064 #define ICP_TC_HPD_SHORT_DETECT(hpd_pin) (1 << (_HPD_PIN_TC(hpd_pin) * 4)) 6065 6066 #define SHPD_FILTER_CNT _MMIO(0xc4038) 6067 #define SHPD_FILTER_CNT_500_ADJ 0x001D9 6068 6069 #define _PCH_DPLL_A 0xc6014 6070 #define _PCH_DPLL_B 0xc6018 6071 #define PCH_DPLL(pll) _MMIO((pll) == 0 ? _PCH_DPLL_A : _PCH_DPLL_B) 6072 6073 #define _PCH_FPA0 0xc6040 6074 #define FP_CB_TUNE (0x3 << 22) 6075 #define _PCH_FPA1 0xc6044 6076 #define _PCH_FPB0 0xc6048 6077 #define _PCH_FPB1 0xc604c 6078 #define PCH_FP0(pll) _MMIO((pll) == 0 ? _PCH_FPA0 : _PCH_FPB0) 6079 #define PCH_FP1(pll) _MMIO((pll) == 0 ? _PCH_FPA1 : _PCH_FPB1) 6080 6081 #define PCH_DPLL_TEST _MMIO(0xc606c) 6082 6083 #define PCH_DREF_CONTROL _MMIO(0xC6200) 6084 #define DREF_CONTROL_MASK 0x7fc3 6085 #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0 << 13) 6086 #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2 << 13) 6087 #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3 << 13) 6088 #define DREF_CPU_SOURCE_OUTPUT_MASK (3 << 13) 6089 #define DREF_SSC_SOURCE_DISABLE (0 << 11) 6090 #define DREF_SSC_SOURCE_ENABLE (2 << 11) 6091 #define DREF_SSC_SOURCE_MASK (3 << 11) 6092 #define DREF_NONSPREAD_SOURCE_DISABLE (0 << 9) 6093 #define DREF_NONSPREAD_CK505_ENABLE (1 << 9) 6094 #define DREF_NONSPREAD_SOURCE_ENABLE (2 << 9) 6095 #define DREF_NONSPREAD_SOURCE_MASK (3 << 9) 6096 #define DREF_SUPERSPREAD_SOURCE_DISABLE (0 << 7) 6097 #define DREF_SUPERSPREAD_SOURCE_ENABLE (2 << 7) 6098 #define DREF_SUPERSPREAD_SOURCE_MASK (3 << 7) 6099 #define DREF_SSC4_DOWNSPREAD (0 << 6) 6100 #define DREF_SSC4_CENTERSPREAD (1 << 6) 6101 #define DREF_SSC1_DISABLE (0 << 1) 6102 #define DREF_SSC1_ENABLE (1 << 1) 6103 #define DREF_SSC4_DISABLE (0) 6104 #define DREF_SSC4_ENABLE (1) 6105 6106 #define PCH_RAWCLK_FREQ _MMIO(0xc6204) 6107 #define FDL_TP1_TIMER_SHIFT 12 6108 #define FDL_TP1_TIMER_MASK (3 << 12) 6109 #define FDL_TP2_TIMER_SHIFT 10 6110 #define FDL_TP2_TIMER_MASK (3 << 10) 6111 #define RAWCLK_FREQ_MASK 0x3ff 6112 #define CNP_RAWCLK_DIV_MASK (0x3ff << 16) 6113 #define CNP_RAWCLK_DIV(div) ((div) << 16) 6114 #define CNP_RAWCLK_FRAC_MASK (0xf << 26) 6115 #define CNP_RAWCLK_DEN(den) ((den) << 26) 6116 #define ICP_RAWCLK_NUM(num) ((num) << 11) 6117 6118 #define PCH_DPLL_TMR_CFG _MMIO(0xc6208) 6119 6120 #define PCH_SSC4_PARMS _MMIO(0xc6210) 6121 #define PCH_SSC4_AUX_PARMS _MMIO(0xc6214) 6122 6123 #define PCH_DPLL_SEL _MMIO(0xc7000) 6124 #define TRANS_DPLLB_SEL(pipe) (1 << ((pipe) * 4)) 6125 #define TRANS_DPLLA_SEL(pipe) 0 6126 #define TRANS_DPLL_ENABLE(pipe) (1 << ((pipe) * 4 + 3)) 6127 6128 /* transcoder */ 6129 6130 #define _PCH_TRANS_HTOTAL_A 0xe0000 6131 #define TRANS_HTOTAL_SHIFT 16 6132 #define TRANS_HACTIVE_SHIFT 0 6133 #define _PCH_TRANS_HBLANK_A 0xe0004 6134 #define TRANS_HBLANK_END_SHIFT 16 6135 #define TRANS_HBLANK_START_SHIFT 0 6136 #define _PCH_TRANS_HSYNC_A 0xe0008 6137 #define TRANS_HSYNC_END_SHIFT 16 6138 #define TRANS_HSYNC_START_SHIFT 0 6139 #define _PCH_TRANS_VTOTAL_A 0xe000c 6140 #define TRANS_VTOTAL_SHIFT 16 6141 #define TRANS_VACTIVE_SHIFT 0 6142 #define _PCH_TRANS_VBLANK_A 0xe0010 6143 #define TRANS_VBLANK_END_SHIFT 16 6144 #define TRANS_VBLANK_START_SHIFT 0 6145 #define _PCH_TRANS_VSYNC_A 0xe0014 6146 #define TRANS_VSYNC_END_SHIFT 16 6147 #define TRANS_VSYNC_START_SHIFT 0 6148 #define _PCH_TRANS_VSYNCSHIFT_A 0xe0028 6149 6150 #define _PCH_TRANSA_DATA_M1 0xe0030 6151 #define _PCH_TRANSA_DATA_N1 0xe0034 6152 #define _PCH_TRANSA_DATA_M2 0xe0038 6153 #define _PCH_TRANSA_DATA_N2 0xe003c 6154 #define _PCH_TRANSA_LINK_M1 0xe0040 6155 #define _PCH_TRANSA_LINK_N1 0xe0044 6156 #define _PCH_TRANSA_LINK_M2 0xe0048 6157 #define _PCH_TRANSA_LINK_N2 0xe004c 6158 6159 /* Per-transcoder DIP controls (PCH) */ 6160 #define _VIDEO_DIP_CTL_A 0xe0200 6161 #define _VIDEO_DIP_DATA_A 0xe0208 6162 #define _VIDEO_DIP_GCP_A 0xe0210 6163 #define GCP_COLOR_INDICATION (1 << 2) 6164 #define GCP_DEFAULT_PHASE_ENABLE (1 << 1) 6165 #define GCP_AV_MUTE (1 << 0) 6166 6167 #define _VIDEO_DIP_CTL_B 0xe1200 6168 #define _VIDEO_DIP_DATA_B 0xe1208 6169 #define _VIDEO_DIP_GCP_B 0xe1210 6170 6171 #define TVIDEO_DIP_CTL(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B) 6172 #define TVIDEO_DIP_DATA(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B) 6173 #define TVIDEO_DIP_GCP(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B) 6174 6175 /* Per-transcoder DIP controls (VLV) */ 6176 #define _VLV_VIDEO_DIP_CTL_A (VLV_DISPLAY_BASE + 0x60200) 6177 #define _VLV_VIDEO_DIP_DATA_A (VLV_DISPLAY_BASE + 0x60208) 6178 #define _VLV_VIDEO_DIP_GDCP_PAYLOAD_A (VLV_DISPLAY_BASE + 0x60210) 6179 6180 #define _VLV_VIDEO_DIP_CTL_B (VLV_DISPLAY_BASE + 0x61170) 6181 #define _VLV_VIDEO_DIP_DATA_B (VLV_DISPLAY_BASE + 0x61174) 6182 #define _VLV_VIDEO_DIP_GDCP_PAYLOAD_B (VLV_DISPLAY_BASE + 0x61178) 6183 6184 #define _CHV_VIDEO_DIP_CTL_C (VLV_DISPLAY_BASE + 0x611f0) 6185 #define _CHV_VIDEO_DIP_DATA_C (VLV_DISPLAY_BASE + 0x611f4) 6186 #define _CHV_VIDEO_DIP_GDCP_PAYLOAD_C (VLV_DISPLAY_BASE + 0x611f8) 6187 6188 #define VLV_TVIDEO_DIP_CTL(pipe) \ 6189 _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_CTL_A, \ 6190 _VLV_VIDEO_DIP_CTL_B, _CHV_VIDEO_DIP_CTL_C) 6191 #define VLV_TVIDEO_DIP_DATA(pipe) \ 6192 _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_DATA_A, \ 6193 _VLV_VIDEO_DIP_DATA_B, _CHV_VIDEO_DIP_DATA_C) 6194 #define VLV_TVIDEO_DIP_GCP(pipe) \ 6195 _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \ 6196 _VLV_VIDEO_DIP_GDCP_PAYLOAD_B, _CHV_VIDEO_DIP_GDCP_PAYLOAD_C) 6197 6198 /* Haswell DIP controls */ 6199 6200 #define _HSW_VIDEO_DIP_CTL_A 0x60200 6201 #define _HSW_VIDEO_DIP_AVI_DATA_A 0x60220 6202 #define _HSW_VIDEO_DIP_VS_DATA_A 0x60260 6203 #define _HSW_VIDEO_DIP_SPD_DATA_A 0x602A0 6204 #define _HSW_VIDEO_DIP_GMP_DATA_A 0x602E0 6205 #define _HSW_VIDEO_DIP_VSC_DATA_A 0x60320 6206 #define _GLK_VIDEO_DIP_DRM_DATA_A 0x60440 6207 #define _HSW_VIDEO_DIP_AVI_ECC_A 0x60240 6208 #define _HSW_VIDEO_DIP_VS_ECC_A 0x60280 6209 #define _HSW_VIDEO_DIP_SPD_ECC_A 0x602C0 6210 #define _HSW_VIDEO_DIP_GMP_ECC_A 0x60300 6211 #define _HSW_VIDEO_DIP_VSC_ECC_A 0x60344 6212 #define _HSW_VIDEO_DIP_GCP_A 0x60210 6213 6214 #define _HSW_VIDEO_DIP_CTL_B 0x61200 6215 #define _HSW_VIDEO_DIP_AVI_DATA_B 0x61220 6216 #define _HSW_VIDEO_DIP_VS_DATA_B 0x61260 6217 #define _HSW_VIDEO_DIP_SPD_DATA_B 0x612A0 6218 #define _HSW_VIDEO_DIP_GMP_DATA_B 0x612E0 6219 #define _HSW_VIDEO_DIP_VSC_DATA_B 0x61320 6220 #define _GLK_VIDEO_DIP_DRM_DATA_B 0x61440 6221 #define _HSW_VIDEO_DIP_BVI_ECC_B 0x61240 6222 #define _HSW_VIDEO_DIP_VS_ECC_B 0x61280 6223 #define _HSW_VIDEO_DIP_SPD_ECC_B 0x612C0 6224 #define _HSW_VIDEO_DIP_GMP_ECC_B 0x61300 6225 #define _HSW_VIDEO_DIP_VSC_ECC_B 0x61344 6226 #define _HSW_VIDEO_DIP_GCP_B 0x61210 6227 6228 /* Icelake PPS_DATA and _ECC DIP Registers. 6229 * These are available for transcoders B,C and eDP. 6230 * Adding the _A so as to reuse the _MMIO_TRANS2 6231 * definition, with which it offsets to the right location. 6232 */ 6233 6234 #define _ICL_VIDEO_DIP_PPS_DATA_A 0x60350 6235 #define _ICL_VIDEO_DIP_PPS_DATA_B 0x61350 6236 #define _ICL_VIDEO_DIP_PPS_ECC_A 0x603D4 6237 #define _ICL_VIDEO_DIP_PPS_ECC_B 0x613D4 6238 6239 #define HSW_TVIDEO_DIP_CTL(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_CTL_A) 6240 #define HSW_TVIDEO_DIP_GCP(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GCP_A) 6241 #define HSW_TVIDEO_DIP_AVI_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_AVI_DATA_A + (i) * 4) 6242 #define HSW_TVIDEO_DIP_VS_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VS_DATA_A + (i) * 4) 6243 #define HSW_TVIDEO_DIP_SPD_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4) 6244 #define HSW_TVIDEO_DIP_GMP_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GMP_DATA_A + (i) * 4) 6245 #define HSW_TVIDEO_DIP_VSC_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4) 6246 #define GLK_TVIDEO_DIP_DRM_DATA(trans, i) _MMIO_TRANS2(trans, _GLK_VIDEO_DIP_DRM_DATA_A + (i) * 4) 6247 #define ICL_VIDEO_DIP_PPS_DATA(trans, i) _MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_DATA_A + (i) * 4) 6248 #define ICL_VIDEO_DIP_PPS_ECC(trans, i) _MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_ECC_A + (i) * 4) 6249 6250 #define _HSW_STEREO_3D_CTL_A 0x70020 6251 #define S3D_ENABLE (1 << 31) 6252 #define _HSW_STEREO_3D_CTL_B 0x71020 6253 6254 #define HSW_STEREO_3D_CTL(trans) _MMIO_PIPE2(trans, _HSW_STEREO_3D_CTL_A) 6255 6256 #define _PCH_TRANS_HTOTAL_B 0xe1000 6257 #define _PCH_TRANS_HBLANK_B 0xe1004 6258 #define _PCH_TRANS_HSYNC_B 0xe1008 6259 #define _PCH_TRANS_VTOTAL_B 0xe100c 6260 #define _PCH_TRANS_VBLANK_B 0xe1010 6261 #define _PCH_TRANS_VSYNC_B 0xe1014 6262 #define _PCH_TRANS_VSYNCSHIFT_B 0xe1028 6263 6264 #define PCH_TRANS_HTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HTOTAL_A, _PCH_TRANS_HTOTAL_B) 6265 #define PCH_TRANS_HBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HBLANK_A, _PCH_TRANS_HBLANK_B) 6266 #define PCH_TRANS_HSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HSYNC_A, _PCH_TRANS_HSYNC_B) 6267 #define PCH_TRANS_VTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VTOTAL_A, _PCH_TRANS_VTOTAL_B) 6268 #define PCH_TRANS_VBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VBLANK_A, _PCH_TRANS_VBLANK_B) 6269 #define PCH_TRANS_VSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNC_A, _PCH_TRANS_VSYNC_B) 6270 #define PCH_TRANS_VSYNCSHIFT(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNCSHIFT_A, _PCH_TRANS_VSYNCSHIFT_B) 6271 6272 #define _PCH_TRANSB_DATA_M1 0xe1030 6273 #define _PCH_TRANSB_DATA_N1 0xe1034 6274 #define _PCH_TRANSB_DATA_M2 0xe1038 6275 #define _PCH_TRANSB_DATA_N2 0xe103c 6276 #define _PCH_TRANSB_LINK_M1 0xe1040 6277 #define _PCH_TRANSB_LINK_N1 0xe1044 6278 #define _PCH_TRANSB_LINK_M2 0xe1048 6279 #define _PCH_TRANSB_LINK_N2 0xe104c 6280 6281 #define PCH_TRANS_DATA_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M1, _PCH_TRANSB_DATA_M1) 6282 #define PCH_TRANS_DATA_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N1, _PCH_TRANSB_DATA_N1) 6283 #define PCH_TRANS_DATA_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M2, _PCH_TRANSB_DATA_M2) 6284 #define PCH_TRANS_DATA_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N2, _PCH_TRANSB_DATA_N2) 6285 #define PCH_TRANS_LINK_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M1, _PCH_TRANSB_LINK_M1) 6286 #define PCH_TRANS_LINK_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N1, _PCH_TRANSB_LINK_N1) 6287 #define PCH_TRANS_LINK_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M2, _PCH_TRANSB_LINK_M2) 6288 #define PCH_TRANS_LINK_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N2, _PCH_TRANSB_LINK_N2) 6289 6290 #define _PCH_TRANSACONF 0xf0008 6291 #define _PCH_TRANSBCONF 0xf1008 6292 #define PCH_TRANSCONF(pipe) _MMIO_PIPE(pipe, _PCH_TRANSACONF, _PCH_TRANSBCONF) 6293 #define LPT_TRANSCONF PCH_TRANSCONF(PIPE_A) /* lpt has only one transcoder */ 6294 #define TRANS_ENABLE REG_BIT(31) 6295 #define TRANS_STATE_ENABLE REG_BIT(30) 6296 #define TRANS_FRAME_START_DELAY_MASK REG_GENMASK(28, 27) /* ibx */ 6297 #define TRANS_FRAME_START_DELAY(x) REG_FIELD_PREP(TRANS_FRAME_START_DELAY_MASK, (x)) /* ibx: 0-3 */ 6298 #define TRANS_INTERLACE_MASK REG_GENMASK(23, 21) 6299 #define TRANS_INTERLACE_PROGRESSIVE REG_FIELD_PREP(TRANS_INTERLACE_MASK, 0) 6300 #define TRANS_INTERLACE_LEGACY_VSYNC_IBX REG_FIELD_PREP(TRANS_INTERLACE_MASK, 2) /* ibx */ 6301 #define TRANS_INTERLACE_INTERLACED REG_FIELD_PREP(TRANS_INTERLACE_MASK, 3) 6302 #define TRANS_BPC_MASK REG_GENMASK(7, 5) /* ibx */ 6303 #define TRANS_BPC_8 REG_FIELD_PREP(TRANS_BPC_MASK, 0) 6304 #define TRANS_BPC_10 REG_FIELD_PREP(TRANS_BPC_MASK, 1) 6305 #define TRANS_BPC_6 REG_FIELD_PREP(TRANS_BPC_MASK, 2) 6306 #define TRANS_BPC_12 REG_FIELD_PREP(TRANS_BPC_MASK, 3) 6307 #define _TRANSA_CHICKEN1 0xf0060 6308 #define _TRANSB_CHICKEN1 0xf1060 6309 #define TRANS_CHICKEN1(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN1, _TRANSB_CHICKEN1) 6310 #define TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE (1 << 10) 6311 #define TRANS_CHICKEN1_DP0UNIT_GC_DISABLE (1 << 4) 6312 #define _TRANSA_CHICKEN2 0xf0064 6313 #define _TRANSB_CHICKEN2 0xf1064 6314 #define TRANS_CHICKEN2(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2) 6315 #define TRANS_CHICKEN2_TIMING_OVERRIDE (1 << 31) 6316 #define TRANS_CHICKEN2_FDI_POLARITY_REVERSED (1 << 29) 6317 #define TRANS_CHICKEN2_FRAME_START_DELAY_MASK (3 << 27) 6318 #define TRANS_CHICKEN2_FRAME_START_DELAY(x) ((x) << 27) /* 0-3 */ 6319 #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_COUNTER (1 << 26) 6320 #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_MODESWITCH (1 << 25) 6321 6322 #define SOUTH_CHICKEN1 _MMIO(0xc2000) 6323 #define FDIA_PHASE_SYNC_SHIFT_OVR 19 6324 #define FDIA_PHASE_SYNC_SHIFT_EN 18 6325 #define INVERT_DDID_HPD (1 << 18) 6326 #define INVERT_DDIC_HPD (1 << 17) 6327 #define INVERT_DDIB_HPD (1 << 16) 6328 #define INVERT_DDIA_HPD (1 << 15) 6329 #define FDI_PHASE_SYNC_OVR(pipe) (1 << (FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2))) 6330 #define FDI_PHASE_SYNC_EN(pipe) (1 << (FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2))) 6331 #define FDI_BC_BIFURCATION_SELECT (1 << 12) 6332 #define CHASSIS_CLK_REQ_DURATION_MASK (0xf << 8) 6333 #define CHASSIS_CLK_REQ_DURATION(x) ((x) << 8) 6334 #define SBCLK_RUN_REFCLK_DIS (1 << 7) 6335 #define SPT_PWM_GRANULARITY (1 << 0) 6336 #define SOUTH_CHICKEN2 _MMIO(0xc2004) 6337 #define FDI_MPHY_IOSFSB_RESET_STATUS (1 << 13) 6338 #define FDI_MPHY_IOSFSB_RESET_CTL (1 << 12) 6339 #define LPT_PWM_GRANULARITY (1 << 5) 6340 #define DPLS_EDP_PPS_FIX_DIS (1 << 0) 6341 6342 #define _FDI_RXA_CHICKEN 0xc200c 6343 #define _FDI_RXB_CHICKEN 0xc2010 6344 #define FDI_RX_PHASE_SYNC_POINTER_OVR (1 << 1) 6345 #define FDI_RX_PHASE_SYNC_POINTER_EN (1 << 0) 6346 #define FDI_RX_CHICKEN(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CHICKEN, _FDI_RXB_CHICKEN) 6347 6348 #define SOUTH_DSPCLK_GATE_D _MMIO(0xc2020) 6349 #define PCH_GMBUSUNIT_CLOCK_GATE_DISABLE (1 << 31) 6350 #define PCH_DPLUNIT_CLOCK_GATE_DISABLE (1 << 30) 6351 #define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1 << 29) 6352 #define PCH_DPMGUNIT_CLOCK_GATE_DISABLE (1 << 15) 6353 #define PCH_CPUNIT_CLOCK_GATE_DISABLE (1 << 14) 6354 #define CNP_PWM_CGE_GATING_DISABLE (1 << 13) 6355 #define PCH_LP_PARTITION_LEVEL_DISABLE (1 << 12) 6356 6357 /* CPU: FDI_TX */ 6358 #define _FDI_TXA_CTL 0x60100 6359 #define _FDI_TXB_CTL 0x61100 6360 #define FDI_TX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_TXA_CTL, _FDI_TXB_CTL) 6361 #define FDI_TX_DISABLE (0 << 31) 6362 #define FDI_TX_ENABLE (1 << 31) 6363 #define FDI_LINK_TRAIN_PATTERN_1 (0 << 28) 6364 #define FDI_LINK_TRAIN_PATTERN_2 (1 << 28) 6365 #define FDI_LINK_TRAIN_PATTERN_IDLE (2 << 28) 6366 #define FDI_LINK_TRAIN_NONE (3 << 28) 6367 #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0 << 25) 6368 #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1 << 25) 6369 #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2 << 25) 6370 #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3 << 25) 6371 #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0 << 22) 6372 #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1 << 22) 6373 #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2 << 22) 6374 #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3 << 22) 6375 /* ILK always use 400mV 0dB for voltage swing and pre-emphasis level. 6376 SNB has different settings. */ 6377 /* SNB A-stepping */ 6378 #define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38 << 22) 6379 #define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02 << 22) 6380 #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01 << 22) 6381 #define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0 << 22) 6382 /* SNB B-stepping */ 6383 #define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0 << 22) 6384 #define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a << 22) 6385 #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39 << 22) 6386 #define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38 << 22) 6387 #define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f << 22) 6388 #define FDI_DP_PORT_WIDTH_SHIFT 19 6389 #define FDI_DP_PORT_WIDTH_MASK (7 << FDI_DP_PORT_WIDTH_SHIFT) 6390 #define FDI_DP_PORT_WIDTH(width) (((width) - 1) << FDI_DP_PORT_WIDTH_SHIFT) 6391 #define FDI_TX_ENHANCE_FRAME_ENABLE (1 << 18) 6392 /* Ironlake: hardwired to 1 */ 6393 #define FDI_TX_PLL_ENABLE (1 << 14) 6394 6395 /* Ivybridge has different bits for lolz */ 6396 #define FDI_LINK_TRAIN_PATTERN_1_IVB (0 << 8) 6397 #define FDI_LINK_TRAIN_PATTERN_2_IVB (1 << 8) 6398 #define FDI_LINK_TRAIN_PATTERN_IDLE_IVB (2 << 8) 6399 #define FDI_LINK_TRAIN_NONE_IVB (3 << 8) 6400 6401 /* both Tx and Rx */ 6402 #define FDI_COMPOSITE_SYNC (1 << 11) 6403 #define FDI_LINK_TRAIN_AUTO (1 << 10) 6404 #define FDI_SCRAMBLING_ENABLE (0 << 7) 6405 #define FDI_SCRAMBLING_DISABLE (1 << 7) 6406 6407 /* FDI_RX, FDI_X is hard-wired to Transcoder_X */ 6408 #define _FDI_RXA_CTL 0xf000c 6409 #define _FDI_RXB_CTL 0xf100c 6410 #define FDI_RX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CTL, _FDI_RXB_CTL) 6411 #define FDI_RX_ENABLE (1 << 31) 6412 /* train, dp width same as FDI_TX */ 6413 #define FDI_FS_ERRC_ENABLE (1 << 27) 6414 #define FDI_FE_ERRC_ENABLE (1 << 26) 6415 #define FDI_RX_POLARITY_REVERSED_LPT (1 << 16) 6416 #define FDI_8BPC (0 << 16) 6417 #define FDI_10BPC (1 << 16) 6418 #define FDI_6BPC (2 << 16) 6419 #define FDI_12BPC (3 << 16) 6420 #define FDI_RX_LINK_REVERSAL_OVERRIDE (1 << 15) 6421 #define FDI_DMI_LINK_REVERSE_MASK (1 << 14) 6422 #define FDI_RX_PLL_ENABLE (1 << 13) 6423 #define FDI_FS_ERR_CORRECT_ENABLE (1 << 11) 6424 #define FDI_FE_ERR_CORRECT_ENABLE (1 << 10) 6425 #define FDI_FS_ERR_REPORT_ENABLE (1 << 9) 6426 #define FDI_FE_ERR_REPORT_ENABLE (1 << 8) 6427 #define FDI_RX_ENHANCE_FRAME_ENABLE (1 << 6) 6428 #define FDI_PCDCLK (1 << 4) 6429 /* CPT */ 6430 #define FDI_AUTO_TRAINING (1 << 10) 6431 #define FDI_LINK_TRAIN_PATTERN_1_CPT (0 << 8) 6432 #define FDI_LINK_TRAIN_PATTERN_2_CPT (1 << 8) 6433 #define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2 << 8) 6434 #define FDI_LINK_TRAIN_NORMAL_CPT (3 << 8) 6435 #define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3 << 8) 6436 6437 #define _FDI_RXA_MISC 0xf0010 6438 #define _FDI_RXB_MISC 0xf1010 6439 #define FDI_RX_PWRDN_LANE1_MASK (3 << 26) 6440 #define FDI_RX_PWRDN_LANE1_VAL(x) ((x) << 26) 6441 #define FDI_RX_PWRDN_LANE0_MASK (3 << 24) 6442 #define FDI_RX_PWRDN_LANE0_VAL(x) ((x) << 24) 6443 #define FDI_RX_TP1_TO_TP2_48 (2 << 20) 6444 #define FDI_RX_TP1_TO_TP2_64 (3 << 20) 6445 #define FDI_RX_FDI_DELAY_90 (0x90 << 0) 6446 #define FDI_RX_MISC(pipe) _MMIO_PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC) 6447 6448 #define _FDI_RXA_TUSIZE1 0xf0030 6449 #define _FDI_RXA_TUSIZE2 0xf0038 6450 #define _FDI_RXB_TUSIZE1 0xf1030 6451 #define _FDI_RXB_TUSIZE2 0xf1038 6452 #define FDI_RX_TUSIZE1(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1) 6453 #define FDI_RX_TUSIZE2(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2) 6454 6455 /* FDI_RX interrupt register format */ 6456 #define FDI_RX_INTER_LANE_ALIGN (1 << 10) 6457 #define FDI_RX_SYMBOL_LOCK (1 << 9) /* train 2 */ 6458 #define FDI_RX_BIT_LOCK (1 << 8) /* train 1 */ 6459 #define FDI_RX_TRAIN_PATTERN_2_FAIL (1 << 7) 6460 #define FDI_RX_FS_CODE_ERR (1 << 6) 6461 #define FDI_RX_FE_CODE_ERR (1 << 5) 6462 #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1 << 4) 6463 #define FDI_RX_HDCP_LINK_FAIL (1 << 3) 6464 #define FDI_RX_PIXEL_FIFO_OVERFLOW (1 << 2) 6465 #define FDI_RX_CROSS_CLOCK_OVERFLOW (1 << 1) 6466 #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1 << 0) 6467 6468 #define _FDI_RXA_IIR 0xf0014 6469 #define _FDI_RXA_IMR 0xf0018 6470 #define _FDI_RXB_IIR 0xf1014 6471 #define _FDI_RXB_IMR 0xf1018 6472 #define FDI_RX_IIR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IIR, _FDI_RXB_IIR) 6473 #define FDI_RX_IMR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IMR, _FDI_RXB_IMR) 6474 6475 #define FDI_PLL_CTL_1 _MMIO(0xfe000) 6476 #define FDI_PLL_CTL_2 _MMIO(0xfe004) 6477 6478 #define PCH_LVDS _MMIO(0xe1180) 6479 #define LVDS_DETECTED (1 << 1) 6480 6481 #define _PCH_DP_B 0xe4100 6482 #define PCH_DP_B _MMIO(_PCH_DP_B) 6483 #define _PCH_DPB_AUX_CH_CTL 0xe4110 6484 #define _PCH_DPB_AUX_CH_DATA1 0xe4114 6485 #define _PCH_DPB_AUX_CH_DATA2 0xe4118 6486 #define _PCH_DPB_AUX_CH_DATA3 0xe411c 6487 #define _PCH_DPB_AUX_CH_DATA4 0xe4120 6488 #define _PCH_DPB_AUX_CH_DATA5 0xe4124 6489 6490 #define _PCH_DP_C 0xe4200 6491 #define PCH_DP_C _MMIO(_PCH_DP_C) 6492 #define _PCH_DPC_AUX_CH_CTL 0xe4210 6493 #define _PCH_DPC_AUX_CH_DATA1 0xe4214 6494 #define _PCH_DPC_AUX_CH_DATA2 0xe4218 6495 #define _PCH_DPC_AUX_CH_DATA3 0xe421c 6496 #define _PCH_DPC_AUX_CH_DATA4 0xe4220 6497 #define _PCH_DPC_AUX_CH_DATA5 0xe4224 6498 6499 #define _PCH_DP_D 0xe4300 6500 #define PCH_DP_D _MMIO(_PCH_DP_D) 6501 #define _PCH_DPD_AUX_CH_CTL 0xe4310 6502 #define _PCH_DPD_AUX_CH_DATA1 0xe4314 6503 #define _PCH_DPD_AUX_CH_DATA2 0xe4318 6504 #define _PCH_DPD_AUX_CH_DATA3 0xe431c 6505 #define _PCH_DPD_AUX_CH_DATA4 0xe4320 6506 #define _PCH_DPD_AUX_CH_DATA5 0xe4324 6507 6508 #define PCH_DP_AUX_CH_CTL(aux_ch) _MMIO_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL) 6509 #define PCH_DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */ 6510 6511 /* CPT */ 6512 #define _TRANS_DP_CTL_A 0xe0300 6513 #define _TRANS_DP_CTL_B 0xe1300 6514 #define _TRANS_DP_CTL_C 0xe2300 6515 #define TRANS_DP_CTL(pipe) _MMIO_PIPE(pipe, _TRANS_DP_CTL_A, _TRANS_DP_CTL_B) 6516 #define TRANS_DP_OUTPUT_ENABLE REG_BIT(31) 6517 #define TRANS_DP_PORT_SEL_MASK REG_GENMASK(30, 29) 6518 #define TRANS_DP_PORT_SEL_NONE REG_FIELD_PREP(TRANS_DP_PORT_SEL_MASK, 3) 6519 #define TRANS_DP_PORT_SEL(port) REG_FIELD_PREP(TRANS_DP_PORT_SEL_MASK, (port) - PORT_B) 6520 #define TRANS_DP_AUDIO_ONLY REG_BIT(26) 6521 #define TRANS_DP_ENH_FRAMING REG_BIT(18) 6522 #define TRANS_DP_BPC_MASK REG_GENMASK(10, 9) 6523 #define TRANS_DP_BPC_8 REG_FIELD_PREP(TRANS_DP_BPC_MASK, 0) 6524 #define TRANS_DP_BPC_10 REG_FIELD_PREP(TRANS_DP_BPC_MASK, 1) 6525 #define TRANS_DP_BPC_6 REG_FIELD_PREP(TRANS_DP_BPC_MASK, 2) 6526 #define TRANS_DP_BPC_12 REG_FIELD_PREP(TRANS_DP_BPC_MASK, 3) 6527 #define TRANS_DP_VSYNC_ACTIVE_HIGH REG_BIT(4) 6528 #define TRANS_DP_HSYNC_ACTIVE_HIGH REG_BIT(3) 6529 6530 #define _TRANS_DP2_CTL_A 0x600a0 6531 #define _TRANS_DP2_CTL_B 0x610a0 6532 #define _TRANS_DP2_CTL_C 0x620a0 6533 #define _TRANS_DP2_CTL_D 0x630a0 6534 #define TRANS_DP2_CTL(trans) _MMIO_TRANS(trans, _TRANS_DP2_CTL_A, _TRANS_DP2_CTL_B) 6535 #define TRANS_DP2_128B132B_CHANNEL_CODING REG_BIT(31) 6536 #define TRANS_DP2_PANEL_REPLAY_ENABLE REG_BIT(30) 6537 #define TRANS_DP2_DEBUG_ENABLE REG_BIT(23) 6538 6539 #define _TRANS_DP2_VFREQHIGH_A 0x600a4 6540 #define _TRANS_DP2_VFREQHIGH_B 0x610a4 6541 #define _TRANS_DP2_VFREQHIGH_C 0x620a4 6542 #define _TRANS_DP2_VFREQHIGH_D 0x630a4 6543 #define TRANS_DP2_VFREQHIGH(trans) _MMIO_TRANS(trans, _TRANS_DP2_VFREQHIGH_A, _TRANS_DP2_VFREQHIGH_B) 6544 #define TRANS_DP2_VFREQ_PIXEL_CLOCK_MASK REG_GENMASK(31, 8) 6545 #define TRANS_DP2_VFREQ_PIXEL_CLOCK(clk_hz) REG_FIELD_PREP(TRANS_DP2_VFREQ_PIXEL_CLOCK_MASK, (clk_hz)) 6546 6547 #define _TRANS_DP2_VFREQLOW_A 0x600a8 6548 #define _TRANS_DP2_VFREQLOW_B 0x610a8 6549 #define _TRANS_DP2_VFREQLOW_C 0x620a8 6550 #define _TRANS_DP2_VFREQLOW_D 0x630a8 6551 #define TRANS_DP2_VFREQLOW(trans) _MMIO_TRANS(trans, _TRANS_DP2_VFREQLOW_A, _TRANS_DP2_VFREQLOW_B) 6552 6553 /* SNB eDP training params */ 6554 /* SNB A-stepping */ 6555 #define EDP_LINK_TRAIN_400MV_0DB_SNB_A (0x38 << 22) 6556 #define EDP_LINK_TRAIN_400MV_6DB_SNB_A (0x02 << 22) 6557 #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01 << 22) 6558 #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0 << 22) 6559 /* SNB B-stepping */ 6560 #define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0 << 22) 6561 #define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1 << 22) 6562 #define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a << 22) 6563 #define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39 << 22) 6564 #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38 << 22) 6565 #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f << 22) 6566 6567 /* IVB */ 6568 #define EDP_LINK_TRAIN_400MV_0DB_IVB (0x24 << 22) 6569 #define EDP_LINK_TRAIN_400MV_3_5DB_IVB (0x2a << 22) 6570 #define EDP_LINK_TRAIN_400MV_6DB_IVB (0x2f << 22) 6571 #define EDP_LINK_TRAIN_600MV_0DB_IVB (0x30 << 22) 6572 #define EDP_LINK_TRAIN_600MV_3_5DB_IVB (0x36 << 22) 6573 #define EDP_LINK_TRAIN_800MV_0DB_IVB (0x38 << 22) 6574 #define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x3e << 22) 6575 6576 /* legacy values */ 6577 #define EDP_LINK_TRAIN_500MV_0DB_IVB (0x00 << 22) 6578 #define EDP_LINK_TRAIN_1000MV_0DB_IVB (0x20 << 22) 6579 #define EDP_LINK_TRAIN_500MV_3_5DB_IVB (0x02 << 22) 6580 #define EDP_LINK_TRAIN_1000MV_3_5DB_IVB (0x22 << 22) 6581 #define EDP_LINK_TRAIN_1000MV_6DB_IVB (0x23 << 22) 6582 6583 #define EDP_LINK_TRAIN_VOL_EMP_MASK_IVB (0x3f << 22) 6584 6585 #define VLV_PMWGICZ _MMIO(0x1300a4) 6586 6587 #define HSW_EDRAM_CAP _MMIO(0x120010) 6588 #define EDRAM_ENABLED 0x1 6589 #define EDRAM_NUM_BANKS(cap) (((cap) >> 1) & 0xf) 6590 #define EDRAM_WAYS_IDX(cap) (((cap) >> 5) & 0x7) 6591 #define EDRAM_SETS_IDX(cap) (((cap) >> 8) & 0x3) 6592 6593 #define VLV_CHICKEN_3 _MMIO(VLV_DISPLAY_BASE + 0x7040C) 6594 #define PIXEL_OVERLAP_CNT_MASK (3 << 30) 6595 #define PIXEL_OVERLAP_CNT_SHIFT 30 6596 6597 #define GEN6_PCODE_MAILBOX _MMIO(0x138124) 6598 #define GEN6_PCODE_READY (1 << 31) 6599 #define GEN6_PCODE_MB_PARAM2 REG_GENMASK(23, 16) 6600 #define GEN6_PCODE_MB_PARAM1 REG_GENMASK(15, 8) 6601 #define GEN6_PCODE_MB_COMMAND REG_GENMASK(7, 0) 6602 #define GEN6_PCODE_ERROR_MASK 0xFF 6603 #define GEN6_PCODE_SUCCESS 0x0 6604 #define GEN6_PCODE_ILLEGAL_CMD 0x1 6605 #define GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x2 6606 #define GEN6_PCODE_TIMEOUT 0x3 6607 #define GEN6_PCODE_UNIMPLEMENTED_CMD 0xFF 6608 #define GEN7_PCODE_TIMEOUT 0x2 6609 #define GEN7_PCODE_ILLEGAL_DATA 0x3 6610 #define GEN11_PCODE_ILLEGAL_SUBCOMMAND 0x4 6611 #define GEN11_PCODE_LOCKED 0x6 6612 #define GEN11_PCODE_REJECTED 0x11 6613 #define GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x10 6614 #define GEN6_PCODE_WRITE_RC6VIDS 0x4 6615 #define GEN6_PCODE_READ_RC6VIDS 0x5 6616 #define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5) 6617 #define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) + 245) 6618 #define BDW_PCODE_DISPLAY_FREQ_CHANGE_REQ 0x18 6619 #define GEN9_PCODE_READ_MEM_LATENCY 0x6 6620 #define GEN9_MEM_LATENCY_LEVEL_3_7_MASK REG_GENMASK(31, 24) 6621 #define GEN9_MEM_LATENCY_LEVEL_2_6_MASK REG_GENMASK(23, 16) 6622 #define GEN9_MEM_LATENCY_LEVEL_1_5_MASK REG_GENMASK(15, 8) 6623 #define GEN9_MEM_LATENCY_LEVEL_0_4_MASK REG_GENMASK(7, 0) 6624 #define SKL_PCODE_LOAD_HDCP_KEYS 0x5 6625 #define SKL_PCODE_CDCLK_CONTROL 0x7 6626 #define SKL_CDCLK_PREPARE_FOR_CHANGE 0x3 6627 #define SKL_CDCLK_READY_FOR_CHANGE 0x1 6628 #define GEN6_PCODE_WRITE_MIN_FREQ_TABLE 0x8 6629 #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9 6630 #define GEN6_READ_OC_PARAMS 0xc 6631 #define ICL_PCODE_MEM_SUBSYSYSTEM_INFO 0xd 6632 #define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8) 6633 #define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO(point) (((point) << 16) | (0x1 << 8)) 6634 #define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8)) 6635 #define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe 6636 #define ICL_PCODE_REP_QGV_MASK REG_GENMASK(1, 0) 6637 #define ICL_PCODE_REP_QGV_SAFE REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 0) 6638 #define ICL_PCODE_REP_QGV_POLL REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 1) 6639 #define ICL_PCODE_REP_QGV_REJECTED REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 2) 6640 #define ADLS_PCODE_REP_PSF_MASK REG_GENMASK(3, 2) 6641 #define ADLS_PCODE_REP_PSF_SAFE REG_FIELD_PREP(ADLS_PCODE_REP_PSF_MASK, 0) 6642 #define ADLS_PCODE_REP_PSF_POLL REG_FIELD_PREP(ADLS_PCODE_REP_PSF_MASK, 1) 6643 #define ADLS_PCODE_REP_PSF_REJECTED REG_FIELD_PREP(ADLS_PCODE_REP_PSF_MASK, 2) 6644 #define ICL_PCODE_REQ_QGV_PT_MASK REG_GENMASK(7, 0) 6645 #define ICL_PCODE_REQ_QGV_PT(x) REG_FIELD_PREP(ICL_PCODE_REQ_QGV_PT_MASK, (x)) 6646 #define ADLS_PCODE_REQ_PSF_PT_MASK REG_GENMASK(10, 8) 6647 #define ADLS_PCODE_REQ_PSF_PT(x) REG_FIELD_PREP(ADLS_PCODE_REQ_PSF_PT_MASK, (x)) 6648 #define GEN6_PCODE_READ_D_COMP 0x10 6649 #define GEN6_PCODE_WRITE_D_COMP 0x11 6650 #define ICL_PCODE_EXIT_TCCOLD 0x12 6651 #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17 6652 #define DISPLAY_IPS_CONTROL 0x19 6653 #define TGL_PCODE_TCCOLD 0x26 6654 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_EXIT_FAILED REG_BIT(0) 6655 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_BLOCK_REQ 0 6656 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_UNBLOCK_REQ REG_BIT(0) 6657 /* See also IPS_CTL */ 6658 #define IPS_PCODE_CONTROL (1 << 30) 6659 #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A 6660 #define GEN9_PCODE_SAGV_CONTROL 0x21 6661 #define GEN9_SAGV_DISABLE 0x0 6662 #define GEN9_SAGV_IS_DISABLED 0x1 6663 #define GEN9_SAGV_ENABLE 0x3 6664 #define DG1_PCODE_STATUS 0x7E 6665 #define DG1_UNCORE_GET_INIT_STATUS 0x0 6666 #define DG1_UNCORE_INIT_STATUS_COMPLETE 0x1 6667 #define PCODE_POWER_SETUP 0x7C 6668 #define POWER_SETUP_SUBCOMMAND_READ_I1 0x4 6669 #define POWER_SETUP_SUBCOMMAND_WRITE_I1 0x5 6670 #define POWER_SETUP_I1_WATTS REG_BIT(31) 6671 #define POWER_SETUP_I1_SHIFT 6 /* 10.6 fixed point format */ 6672 #define POWER_SETUP_I1_DATA_MASK REG_GENMASK(15, 0) 6673 #define GEN12_PCODE_READ_SAGV_BLOCK_TIME_US 0x23 6674 #define XEHP_PCODE_FREQUENCY_CONFIG 0x6e /* xehpsdv, pvc */ 6675 /* XEHP_PCODE_FREQUENCY_CONFIG sub-commands (param1) */ 6676 #define PCODE_MBOX_FC_SC_READ_FUSED_P0 0x0 6677 #define PCODE_MBOX_FC_SC_READ_FUSED_PN 0x1 6678 /* PCODE_MBOX_DOMAIN_* - mailbox domain IDs */ 6679 /* XEHP_PCODE_FREQUENCY_CONFIG param2 */ 6680 #define PCODE_MBOX_DOMAIN_NONE 0x0 6681 #define PCODE_MBOX_DOMAIN_MEDIAFF 0x3 6682 6683 /* Wa_14017210380: mtl */ 6684 #define PCODE_MBOX_GT_STATE 0x50 6685 /* sub-commands (param1) */ 6686 #define PCODE_MBOX_GT_STATE_MEDIA_BUSY 0x1 6687 #define PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY 0x2 6688 /* param2 */ 6689 #define PCODE_MBOX_GT_STATE_DOMAIN_MEDIA 0x1 6690 6691 #define GEN6_PCODE_DATA _MMIO(0x138128) 6692 #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 6693 #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 6694 #define GEN6_PCODE_DATA1 _MMIO(0x13812C) 6695 6696 /* IVYBRIDGE DPF */ 6697 #define GEN7_L3CDERRST1(slice) _MMIO(0xB008 + (slice) * 0x200) /* L3CD Error Status 1 */ 6698 #define GEN7_L3CDERRST1_ROW_MASK (0x7ff << 14) 6699 #define GEN7_PARITY_ERROR_VALID (1 << 13) 6700 #define GEN7_L3CDERRST1_BANK_MASK (3 << 11) 6701 #define GEN7_L3CDERRST1_SUBBANK_MASK (7 << 8) 6702 #define GEN7_PARITY_ERROR_ROW(reg) \ 6703 (((reg) & GEN7_L3CDERRST1_ROW_MASK) >> 14) 6704 #define GEN7_PARITY_ERROR_BANK(reg) \ 6705 (((reg) & GEN7_L3CDERRST1_BANK_MASK) >> 11) 6706 #define GEN7_PARITY_ERROR_SUBBANK(reg) \ 6707 (((reg) & GEN7_L3CDERRST1_SUBBANK_MASK) >> 8) 6708 #define GEN7_L3CDERRST1_ENABLE (1 << 7) 6709 6710 /* These are the 4 32-bit write offset registers for each stream 6711 * output buffer. It determines the offset from the 6712 * 3DSTATE_SO_BUFFERs that the next streamed vertex output goes to. 6713 */ 6714 #define GEN7_SO_WRITE_OFFSET(n) _MMIO(0x5280 + (n) * 4) 6715 6716 /* 6717 * HSW - ICL power wells 6718 * 6719 * Platforms have up to 3 power well control register sets, each set 6720 * controlling up to 16 power wells via a request/status HW flag tuple: 6721 * - main (HSW_PWR_WELL_CTL[1-4]) 6722 * - AUX (ICL_PWR_WELL_CTL_AUX[1-4]) 6723 * - DDI (ICL_PWR_WELL_CTL_DDI[1-4]) 6724 * Each control register set consists of up to 4 registers used by different 6725 * sources that can request a power well to be enabled: 6726 * - BIOS (HSW_PWR_WELL_CTL1/ICL_PWR_WELL_CTL_AUX1/ICL_PWR_WELL_CTL_DDI1) 6727 * - DRIVER (HSW_PWR_WELL_CTL2/ICL_PWR_WELL_CTL_AUX2/ICL_PWR_WELL_CTL_DDI2) 6728 * - KVMR (HSW_PWR_WELL_CTL3) (only in the main register set) 6729 * - DEBUG (HSW_PWR_WELL_CTL4/ICL_PWR_WELL_CTL_AUX4/ICL_PWR_WELL_CTL_DDI4) 6730 */ 6731 #define HSW_PWR_WELL_CTL1 _MMIO(0x45400) 6732 #define HSW_PWR_WELL_CTL2 _MMIO(0x45404) 6733 #define HSW_PWR_WELL_CTL3 _MMIO(0x45408) 6734 #define HSW_PWR_WELL_CTL4 _MMIO(0x4540C) 6735 #define HSW_PWR_WELL_CTL_REQ(pw_idx) (0x2 << ((pw_idx) * 2)) 6736 #define HSW_PWR_WELL_CTL_STATE(pw_idx) (0x1 << ((pw_idx) * 2)) 6737 6738 /* HSW/BDW power well */ 6739 #define HSW_PW_CTL_IDX_GLOBAL 15 6740 6741 /* SKL/BXT/GLK power wells */ 6742 #define SKL_PW_CTL_IDX_PW_2 15 6743 #define SKL_PW_CTL_IDX_PW_1 14 6744 #define GLK_PW_CTL_IDX_AUX_C 10 6745 #define GLK_PW_CTL_IDX_AUX_B 9 6746 #define GLK_PW_CTL_IDX_AUX_A 8 6747 #define SKL_PW_CTL_IDX_DDI_D 4 6748 #define SKL_PW_CTL_IDX_DDI_C 3 6749 #define SKL_PW_CTL_IDX_DDI_B 2 6750 #define SKL_PW_CTL_IDX_DDI_A_E 1 6751 #define GLK_PW_CTL_IDX_DDI_A 1 6752 #define SKL_PW_CTL_IDX_MISC_IO 0 6753 6754 /* ICL/TGL - power wells */ 6755 #define TGL_PW_CTL_IDX_PW_5 4 6756 #define ICL_PW_CTL_IDX_PW_4 3 6757 #define ICL_PW_CTL_IDX_PW_3 2 6758 #define ICL_PW_CTL_IDX_PW_2 1 6759 #define ICL_PW_CTL_IDX_PW_1 0 6760 6761 /* XE_LPD - power wells */ 6762 #define XELPD_PW_CTL_IDX_PW_D 8 6763 #define XELPD_PW_CTL_IDX_PW_C 7 6764 #define XELPD_PW_CTL_IDX_PW_B 6 6765 #define XELPD_PW_CTL_IDX_PW_A 5 6766 6767 #define ICL_PWR_WELL_CTL_AUX1 _MMIO(0x45440) 6768 #define ICL_PWR_WELL_CTL_AUX2 _MMIO(0x45444) 6769 #define ICL_PWR_WELL_CTL_AUX4 _MMIO(0x4544C) 6770 #define TGL_PW_CTL_IDX_AUX_TBT6 14 6771 #define TGL_PW_CTL_IDX_AUX_TBT5 13 6772 #define TGL_PW_CTL_IDX_AUX_TBT4 12 6773 #define ICL_PW_CTL_IDX_AUX_TBT4 11 6774 #define TGL_PW_CTL_IDX_AUX_TBT3 11 6775 #define ICL_PW_CTL_IDX_AUX_TBT3 10 6776 #define TGL_PW_CTL_IDX_AUX_TBT2 10 6777 #define ICL_PW_CTL_IDX_AUX_TBT2 9 6778 #define TGL_PW_CTL_IDX_AUX_TBT1 9 6779 #define ICL_PW_CTL_IDX_AUX_TBT1 8 6780 #define TGL_PW_CTL_IDX_AUX_TC6 8 6781 #define XELPD_PW_CTL_IDX_AUX_E 8 6782 #define TGL_PW_CTL_IDX_AUX_TC5 7 6783 #define XELPD_PW_CTL_IDX_AUX_D 7 6784 #define TGL_PW_CTL_IDX_AUX_TC4 6 6785 #define ICL_PW_CTL_IDX_AUX_F 5 6786 #define TGL_PW_CTL_IDX_AUX_TC3 5 6787 #define ICL_PW_CTL_IDX_AUX_E 4 6788 #define TGL_PW_CTL_IDX_AUX_TC2 4 6789 #define ICL_PW_CTL_IDX_AUX_D 3 6790 #define TGL_PW_CTL_IDX_AUX_TC1 3 6791 #define ICL_PW_CTL_IDX_AUX_C 2 6792 #define ICL_PW_CTL_IDX_AUX_B 1 6793 #define ICL_PW_CTL_IDX_AUX_A 0 6794 6795 #define ICL_PWR_WELL_CTL_DDI1 _MMIO(0x45450) 6796 #define ICL_PWR_WELL_CTL_DDI2 _MMIO(0x45454) 6797 #define ICL_PWR_WELL_CTL_DDI4 _MMIO(0x4545C) 6798 #define XELPD_PW_CTL_IDX_DDI_E 8 6799 #define TGL_PW_CTL_IDX_DDI_TC6 8 6800 #define XELPD_PW_CTL_IDX_DDI_D 7 6801 #define TGL_PW_CTL_IDX_DDI_TC5 7 6802 #define TGL_PW_CTL_IDX_DDI_TC4 6 6803 #define ICL_PW_CTL_IDX_DDI_F 5 6804 #define TGL_PW_CTL_IDX_DDI_TC3 5 6805 #define ICL_PW_CTL_IDX_DDI_E 4 6806 #define TGL_PW_CTL_IDX_DDI_TC2 4 6807 #define ICL_PW_CTL_IDX_DDI_D 3 6808 #define TGL_PW_CTL_IDX_DDI_TC1 3 6809 #define ICL_PW_CTL_IDX_DDI_C 2 6810 #define ICL_PW_CTL_IDX_DDI_B 1 6811 #define ICL_PW_CTL_IDX_DDI_A 0 6812 6813 /* HSW - power well misc debug registers */ 6814 #define HSW_PWR_WELL_CTL5 _MMIO(0x45410) 6815 #define HSW_PWR_WELL_ENABLE_SINGLE_STEP (1 << 31) 6816 #define HSW_PWR_WELL_PWR_GATE_OVERRIDE (1 << 20) 6817 #define HSW_PWR_WELL_FORCE_ON (1 << 19) 6818 #define HSW_PWR_WELL_CTL6 _MMIO(0x45414) 6819 6820 /* SKL Fuse Status */ 6821 enum skl_power_gate { 6822 SKL_PG0, 6823 SKL_PG1, 6824 SKL_PG2, 6825 ICL_PG3, 6826 ICL_PG4, 6827 }; 6828 6829 #define SKL_FUSE_STATUS _MMIO(0x42000) 6830 #define SKL_FUSE_DOWNLOAD_STATUS (1 << 31) 6831 /* 6832 * PG0 is HW controlled, so doesn't have a corresponding power well control knob 6833 * SKL_DISP_PW1_IDX..SKL_DISP_PW2_IDX -> PG1..PG2 6834 */ 6835 #define SKL_PW_CTL_IDX_TO_PG(pw_idx) \ 6836 ((pw_idx) - SKL_PW_CTL_IDX_PW_1 + SKL_PG1) 6837 /* 6838 * PG0 is HW controlled, so doesn't have a corresponding power well control knob 6839 * ICL_DISP_PW1_IDX..ICL_DISP_PW4_IDX -> PG1..PG4 6840 */ 6841 #define ICL_PW_CTL_IDX_TO_PG(pw_idx) \ 6842 ((pw_idx) - ICL_PW_CTL_IDX_PW_1 + SKL_PG1) 6843 #define SKL_FUSE_PG_DIST_STATUS(pg) (1 << (27 - (pg))) 6844 6845 #define _ICL_AUX_REG_IDX(pw_idx) ((pw_idx) - ICL_PW_CTL_IDX_AUX_A) 6846 #define _ICL_AUX_ANAOVRD1_A 0x162398 6847 #define _ICL_AUX_ANAOVRD1_B 0x6C398 6848 #define ICL_AUX_ANAOVRD1(pw_idx) _MMIO(_PICK(_ICL_AUX_REG_IDX(pw_idx), \ 6849 _ICL_AUX_ANAOVRD1_A, \ 6850 _ICL_AUX_ANAOVRD1_B)) 6851 #define ICL_AUX_ANAOVRD1_LDO_BYPASS (1 << 7) 6852 #define ICL_AUX_ANAOVRD1_ENABLE (1 << 0) 6853 6854 /* Per-pipe DDI Function Control */ 6855 #define _TRANS_DDI_FUNC_CTL_A 0x60400 6856 #define _TRANS_DDI_FUNC_CTL_B 0x61400 6857 #define _TRANS_DDI_FUNC_CTL_C 0x62400 6858 #define _TRANS_DDI_FUNC_CTL_D 0x63400 6859 #define _TRANS_DDI_FUNC_CTL_EDP 0x6F400 6860 #define _TRANS_DDI_FUNC_CTL_DSI0 0x6b400 6861 #define _TRANS_DDI_FUNC_CTL_DSI1 0x6bc00 6862 #define TRANS_DDI_FUNC_CTL(tran) _MMIO_TRANS2(tran, _TRANS_DDI_FUNC_CTL_A) 6863 6864 #define TRANS_DDI_FUNC_ENABLE (1 << 31) 6865 /* Those bits are ignored by pipe EDP since it can only connect to DDI A */ 6866 #define TRANS_DDI_PORT_SHIFT 28 6867 #define TGL_TRANS_DDI_PORT_SHIFT 27 6868 #define TRANS_DDI_PORT_MASK (7 << TRANS_DDI_PORT_SHIFT) 6869 #define TGL_TRANS_DDI_PORT_MASK (0xf << TGL_TRANS_DDI_PORT_SHIFT) 6870 #define TRANS_DDI_SELECT_PORT(x) ((x) << TRANS_DDI_PORT_SHIFT) 6871 #define TGL_TRANS_DDI_SELECT_PORT(x) (((x) + 1) << TGL_TRANS_DDI_PORT_SHIFT) 6872 #define TRANS_DDI_MODE_SELECT_MASK (7 << 24) 6873 #define TRANS_DDI_MODE_SELECT_HDMI (0 << 24) 6874 #define TRANS_DDI_MODE_SELECT_DVI (1 << 24) 6875 #define TRANS_DDI_MODE_SELECT_DP_SST (2 << 24) 6876 #define TRANS_DDI_MODE_SELECT_DP_MST (3 << 24) 6877 #define TRANS_DDI_MODE_SELECT_FDI_OR_128B132B (4 << 24) 6878 #define TRANS_DDI_BPC_MASK (7 << 20) 6879 #define TRANS_DDI_BPC_8 (0 << 20) 6880 #define TRANS_DDI_BPC_10 (1 << 20) 6881 #define TRANS_DDI_BPC_6 (2 << 20) 6882 #define TRANS_DDI_BPC_12 (3 << 20) 6883 #define TRANS_DDI_PORT_SYNC_MASTER_SELECT_MASK REG_GENMASK(19, 18) 6884 #define TRANS_DDI_PORT_SYNC_MASTER_SELECT(x) REG_FIELD_PREP(TRANS_DDI_PORT_SYNC_MASTER_SELECT_MASK, (x)) 6885 #define TRANS_DDI_PVSYNC (1 << 17) 6886 #define TRANS_DDI_PHSYNC (1 << 16) 6887 #define TRANS_DDI_PORT_SYNC_ENABLE REG_BIT(15) 6888 #define TRANS_DDI_EDP_INPUT_MASK (7 << 12) 6889 #define TRANS_DDI_EDP_INPUT_A_ON (0 << 12) 6890 #define TRANS_DDI_EDP_INPUT_A_ONOFF (4 << 12) 6891 #define TRANS_DDI_EDP_INPUT_B_ONOFF (5 << 12) 6892 #define TRANS_DDI_EDP_INPUT_C_ONOFF (6 << 12) 6893 #define TRANS_DDI_EDP_INPUT_D_ONOFF (7 << 12) 6894 #define TRANS_DDI_MST_TRANSPORT_SELECT_MASK REG_GENMASK(11, 10) 6895 #define TRANS_DDI_MST_TRANSPORT_SELECT(trans) \ 6896 REG_FIELD_PREP(TRANS_DDI_MST_TRANSPORT_SELECT_MASK, trans) 6897 #define TRANS_DDI_HDCP_SIGNALLING (1 << 9) 6898 #define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1 << 8) 6899 #define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1 << 7) 6900 #define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1 << 6) 6901 #define TRANS_DDI_HDCP_SELECT REG_BIT(5) 6902 #define TRANS_DDI_BFI_ENABLE (1 << 4) 6903 #define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1 << 4) 6904 #define TRANS_DDI_HDMI_SCRAMBLING (1 << 0) 6905 #define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \ 6906 | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \ 6907 | TRANS_DDI_HDMI_SCRAMBLING) 6908 6909 #define _TRANS_DDI_FUNC_CTL2_A 0x60404 6910 #define _TRANS_DDI_FUNC_CTL2_B 0x61404 6911 #define _TRANS_DDI_FUNC_CTL2_C 0x62404 6912 #define _TRANS_DDI_FUNC_CTL2_EDP 0x6f404 6913 #define _TRANS_DDI_FUNC_CTL2_DSI0 0x6b404 6914 #define _TRANS_DDI_FUNC_CTL2_DSI1 0x6bc04 6915 #define TRANS_DDI_FUNC_CTL2(tran) _MMIO_TRANS2(tran, _TRANS_DDI_FUNC_CTL2_A) 6916 #define PORT_SYNC_MODE_ENABLE REG_BIT(4) 6917 #define PORT_SYNC_MODE_MASTER_SELECT_MASK REG_GENMASK(2, 0) 6918 #define PORT_SYNC_MODE_MASTER_SELECT(x) REG_FIELD_PREP(PORT_SYNC_MODE_MASTER_SELECT_MASK, (x)) 6919 6920 #define TRANS_CMTG_CHICKEN _MMIO(0x6fa90) 6921 #define DISABLE_DPT_CLK_GATING REG_BIT(1) 6922 6923 /* DisplayPort Transport Control */ 6924 #define _DP_TP_CTL_A 0x64040 6925 #define _DP_TP_CTL_B 0x64140 6926 #define _TGL_DP_TP_CTL_A 0x60540 6927 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B) 6928 #define TGL_DP_TP_CTL(tran) _MMIO_TRANS2((tran), _TGL_DP_TP_CTL_A) 6929 #define DP_TP_CTL_ENABLE (1 << 31) 6930 #define DP_TP_CTL_FEC_ENABLE (1 << 30) 6931 #define DP_TP_CTL_MODE_SST (0 << 27) 6932 #define DP_TP_CTL_MODE_MST (1 << 27) 6933 #define DP_TP_CTL_FORCE_ACT (1 << 25) 6934 #define DP_TP_CTL_ENHANCED_FRAME_ENABLE (1 << 18) 6935 #define DP_TP_CTL_FDI_AUTOTRAIN (1 << 15) 6936 #define DP_TP_CTL_LINK_TRAIN_MASK (7 << 8) 6937 #define DP_TP_CTL_LINK_TRAIN_PAT1 (0 << 8) 6938 #define DP_TP_CTL_LINK_TRAIN_PAT2 (1 << 8) 6939 #define DP_TP_CTL_LINK_TRAIN_PAT3 (4 << 8) 6940 #define DP_TP_CTL_LINK_TRAIN_PAT4 (5 << 8) 6941 #define DP_TP_CTL_LINK_TRAIN_IDLE (2 << 8) 6942 #define DP_TP_CTL_LINK_TRAIN_NORMAL (3 << 8) 6943 #define DP_TP_CTL_SCRAMBLE_DISABLE (1 << 7) 6944 6945 /* DisplayPort Transport Status */ 6946 #define _DP_TP_STATUS_A 0x64044 6947 #define _DP_TP_STATUS_B 0x64144 6948 #define _TGL_DP_TP_STATUS_A 0x60544 6949 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B) 6950 #define TGL_DP_TP_STATUS(tran) _MMIO_TRANS2((tran), _TGL_DP_TP_STATUS_A) 6951 #define DP_TP_STATUS_FEC_ENABLE_LIVE (1 << 28) 6952 #define DP_TP_STATUS_IDLE_DONE (1 << 25) 6953 #define DP_TP_STATUS_ACT_SENT (1 << 24) 6954 #define DP_TP_STATUS_MODE_STATUS_MST (1 << 23) 6955 #define DP_TP_STATUS_AUTOTRAIN_DONE (1 << 12) 6956 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC2 (3 << 8) 6957 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC1 (3 << 4) 6958 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC0 (3 << 0) 6959 6960 /* DDI Buffer Control */ 6961 #define _DDI_BUF_CTL_A 0x64000 6962 #define _DDI_BUF_CTL_B 0x64100 6963 #define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B) 6964 #define DDI_BUF_CTL_ENABLE (1 << 31) 6965 #define DDI_BUF_TRANS_SELECT(n) ((n) << 24) 6966 #define DDI_BUF_EMP_MASK (0xf << 24) 6967 #define DDI_BUF_PHY_LINK_RATE(r) ((r) << 20) 6968 #define DDI_BUF_PORT_REVERSAL (1 << 16) 6969 #define DDI_BUF_IS_IDLE (1 << 7) 6970 #define DDI_BUF_CTL_TC_PHY_OWNERSHIP REG_BIT(6) 6971 #define DDI_A_4_LANES (1 << 4) 6972 #define DDI_PORT_WIDTH(width) (((width) - 1) << 1) 6973 #define DDI_PORT_WIDTH_MASK (7 << 1) 6974 #define DDI_PORT_WIDTH_SHIFT 1 6975 #define DDI_INIT_DISPLAY_DETECTED (1 << 0) 6976 6977 /* DDI Buffer Translations */ 6978 #define _DDI_BUF_TRANS_A 0x64E00 6979 #define _DDI_BUF_TRANS_B 0x64E60 6980 #define DDI_BUF_TRANS_LO(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8) 6981 #define DDI_BUF_BALANCE_LEG_ENABLE (1 << 31) 6982 #define DDI_BUF_TRANS_HI(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8 + 4) 6983 6984 /* DDI DP Compliance Control */ 6985 #define _DDI_DP_COMP_CTL_A 0x605F0 6986 #define _DDI_DP_COMP_CTL_B 0x615F0 6987 #define DDI_DP_COMP_CTL(pipe) _MMIO_PIPE(pipe, _DDI_DP_COMP_CTL_A, _DDI_DP_COMP_CTL_B) 6988 #define DDI_DP_COMP_CTL_ENABLE (1 << 31) 6989 #define DDI_DP_COMP_CTL_D10_2 (0 << 28) 6990 #define DDI_DP_COMP_CTL_SCRAMBLED_0 (1 << 28) 6991 #define DDI_DP_COMP_CTL_PRBS7 (2 << 28) 6992 #define DDI_DP_COMP_CTL_CUSTOM80 (3 << 28) 6993 #define DDI_DP_COMP_CTL_HBR2 (4 << 28) 6994 #define DDI_DP_COMP_CTL_SCRAMBLED_1 (5 << 28) 6995 #define DDI_DP_COMP_CTL_HBR2_RESET (0xFC << 0) 6996 6997 /* DDI DP Compliance Pattern */ 6998 #define _DDI_DP_COMP_PAT_A 0x605F4 6999 #define _DDI_DP_COMP_PAT_B 0x615F4 7000 #define DDI_DP_COMP_PAT(pipe, i) _MMIO(_PIPE(pipe, _DDI_DP_COMP_PAT_A, _DDI_DP_COMP_PAT_B) + (i) * 4) 7001 7002 /* Sideband Interface (SBI) is programmed indirectly, via 7003 * SBI_ADDR, which contains the register offset; and SBI_DATA, 7004 * which contains the payload */ 7005 #define SBI_ADDR _MMIO(0xC6000) 7006 #define SBI_DATA _MMIO(0xC6004) 7007 #define SBI_CTL_STAT _MMIO(0xC6008) 7008 #define SBI_CTL_DEST_ICLK (0x0 << 16) 7009 #define SBI_CTL_DEST_MPHY (0x1 << 16) 7010 #define SBI_CTL_OP_IORD (0x2 << 8) 7011 #define SBI_CTL_OP_IOWR (0x3 << 8) 7012 #define SBI_CTL_OP_CRRD (0x6 << 8) 7013 #define SBI_CTL_OP_CRWR (0x7 << 8) 7014 #define SBI_RESPONSE_FAIL (0x1 << 1) 7015 #define SBI_RESPONSE_SUCCESS (0x0 << 1) 7016 #define SBI_BUSY (0x1 << 0) 7017 #define SBI_READY (0x0 << 0) 7018 7019 /* SBI offsets */ 7020 #define SBI_SSCDIVINTPHASE 0x0200 7021 #define SBI_SSCDIVINTPHASE6 0x0600 7022 #define SBI_SSCDIVINTPHASE_DIVSEL_SHIFT 1 7023 #define SBI_SSCDIVINTPHASE_DIVSEL_MASK (0x7f << 1) 7024 #define SBI_SSCDIVINTPHASE_DIVSEL(x) ((x) << 1) 7025 #define SBI_SSCDIVINTPHASE_INCVAL_SHIFT 8 7026 #define SBI_SSCDIVINTPHASE_INCVAL_MASK (0x7f << 8) 7027 #define SBI_SSCDIVINTPHASE_INCVAL(x) ((x) << 8) 7028 #define SBI_SSCDIVINTPHASE_DIR(x) ((x) << 15) 7029 #define SBI_SSCDIVINTPHASE_PROPAGATE (1 << 0) 7030 #define SBI_SSCDITHPHASE 0x0204 7031 #define SBI_SSCCTL 0x020c 7032 #define SBI_SSCCTL6 0x060C 7033 #define SBI_SSCCTL_PATHALT (1 << 3) 7034 #define SBI_SSCCTL_DISABLE (1 << 0) 7035 #define SBI_SSCAUXDIV6 0x0610 7036 #define SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT 4 7037 #define SBI_SSCAUXDIV_FINALDIV2SEL_MASK (1 << 4) 7038 #define SBI_SSCAUXDIV_FINALDIV2SEL(x) ((x) << 4) 7039 #define SBI_DBUFF0 0x2a00 7040 #define SBI_GEN0 0x1f00 7041 #define SBI_GEN0_CFG_BUFFENABLE_DISABLE (1 << 0) 7042 7043 /* LPT PIXCLK_GATE */ 7044 #define PIXCLK_GATE _MMIO(0xC6020) 7045 #define PIXCLK_GATE_UNGATE (1 << 0) 7046 #define PIXCLK_GATE_GATE (0 << 0) 7047 7048 /* SPLL */ 7049 #define SPLL_CTL _MMIO(0x46020) 7050 #define SPLL_PLL_ENABLE (1 << 31) 7051 #define SPLL_REF_BCLK (0 << 28) 7052 #define SPLL_REF_MUXED_SSC (1 << 28) /* CPU SSC if fused enabled, PCH SSC otherwise */ 7053 #define SPLL_REF_NON_SSC_HSW (2 << 28) 7054 #define SPLL_REF_PCH_SSC_BDW (2 << 28) 7055 #define SPLL_REF_LCPLL (3 << 28) 7056 #define SPLL_REF_MASK (3 << 28) 7057 #define SPLL_FREQ_810MHz (0 << 26) 7058 #define SPLL_FREQ_1350MHz (1 << 26) 7059 #define SPLL_FREQ_2700MHz (2 << 26) 7060 #define SPLL_FREQ_MASK (3 << 26) 7061 7062 /* WRPLL */ 7063 #define _WRPLL_CTL1 0x46040 7064 #define _WRPLL_CTL2 0x46060 7065 #define WRPLL_CTL(pll) _MMIO_PIPE(pll, _WRPLL_CTL1, _WRPLL_CTL2) 7066 #define WRPLL_PLL_ENABLE (1 << 31) 7067 #define WRPLL_REF_BCLK (0 << 28) 7068 #define WRPLL_REF_PCH_SSC (1 << 28) 7069 #define WRPLL_REF_MUXED_SSC_BDW (2 << 28) /* CPU SSC if fused enabled, PCH SSC otherwise */ 7070 #define WRPLL_REF_SPECIAL_HSW (2 << 28) /* muxed SSC (ULT), non-SSC (non-ULT) */ 7071 #define WRPLL_REF_LCPLL (3 << 28) 7072 #define WRPLL_REF_MASK (3 << 28) 7073 /* WRPLL divider programming */ 7074 #define WRPLL_DIVIDER_REFERENCE(x) ((x) << 0) 7075 #define WRPLL_DIVIDER_REF_MASK (0xff) 7076 #define WRPLL_DIVIDER_POST(x) ((x) << 8) 7077 #define WRPLL_DIVIDER_POST_MASK (0x3f << 8) 7078 #define WRPLL_DIVIDER_POST_SHIFT 8 7079 #define WRPLL_DIVIDER_FEEDBACK(x) ((x) << 16) 7080 #define WRPLL_DIVIDER_FB_SHIFT 16 7081 #define WRPLL_DIVIDER_FB_MASK (0xff << 16) 7082 7083 /* Port clock selection */ 7084 #define _PORT_CLK_SEL_A 0x46100 7085 #define _PORT_CLK_SEL_B 0x46104 7086 #define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B) 7087 #define PORT_CLK_SEL_MASK REG_GENMASK(31, 29) 7088 #define PORT_CLK_SEL_LCPLL_2700 REG_FIELD_PREP(PORT_CLK_SEL_MASK, 0) 7089 #define PORT_CLK_SEL_LCPLL_1350 REG_FIELD_PREP(PORT_CLK_SEL_MASK, 1) 7090 #define PORT_CLK_SEL_LCPLL_810 REG_FIELD_PREP(PORT_CLK_SEL_MASK, 2) 7091 #define PORT_CLK_SEL_SPLL REG_FIELD_PREP(PORT_CLK_SEL_MASK, 3) 7092 #define PORT_CLK_SEL_WRPLL(pll) REG_FIELD_PREP(PORT_CLK_SEL_MASK, 4 + (pll)) 7093 #define PORT_CLK_SEL_WRPLL1 REG_FIELD_PREP(PORT_CLK_SEL_MASK, 4) 7094 #define PORT_CLK_SEL_WRPLL2 REG_FIELD_PREP(PORT_CLK_SEL_MASK, 5) 7095 #define PORT_CLK_SEL_NONE REG_FIELD_PREP(PORT_CLK_SEL_MASK, 7) 7096 7097 /* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */ 7098 #define DDI_CLK_SEL(port) PORT_CLK_SEL(port) 7099 #define DDI_CLK_SEL_MASK REG_GENMASK(31, 28) 7100 #define DDI_CLK_SEL_NONE REG_FIELD_PREP(DDI_CLK_SEL_MASK, 0x0) 7101 #define DDI_CLK_SEL_MG REG_FIELD_PREP(DDI_CLK_SEL_MASK, 0x8) 7102 #define DDI_CLK_SEL_TBT_162 REG_FIELD_PREP(DDI_CLK_SEL_MASK, 0xC) 7103 #define DDI_CLK_SEL_TBT_270 REG_FIELD_PREP(DDI_CLK_SEL_MASK, 0xD) 7104 #define DDI_CLK_SEL_TBT_540 REG_FIELD_PREP(DDI_CLK_SEL_MASK, 0xE) 7105 #define DDI_CLK_SEL_TBT_810 REG_FIELD_PREP(DDI_CLK_SEL_MASK, 0xF) 7106 7107 /* Transcoder clock selection */ 7108 #define _TRANS_CLK_SEL_A 0x46140 7109 #define _TRANS_CLK_SEL_B 0x46144 7110 #define TRANS_CLK_SEL(tran) _MMIO_TRANS(tran, _TRANS_CLK_SEL_A, _TRANS_CLK_SEL_B) 7111 /* For each transcoder, we need to select the corresponding port clock */ 7112 #define TRANS_CLK_SEL_DISABLED (0x0 << 29) 7113 #define TRANS_CLK_SEL_PORT(x) (((x) + 1) << 29) 7114 #define TGL_TRANS_CLK_SEL_DISABLED (0x0 << 28) 7115 #define TGL_TRANS_CLK_SEL_PORT(x) (((x) + 1) << 28) 7116 7117 7118 #define CDCLK_FREQ _MMIO(0x46200) 7119 7120 #define _TRANSA_MSA_MISC 0x60410 7121 #define _TRANSB_MSA_MISC 0x61410 7122 #define _TRANSC_MSA_MISC 0x62410 7123 #define _TRANS_EDP_MSA_MISC 0x6f410 7124 #define TRANS_MSA_MISC(tran) _MMIO_TRANS2(tran, _TRANSA_MSA_MISC) 7125 /* See DP_MSA_MISC_* for the bit definitions */ 7126 7127 #define _TRANS_A_SET_CONTEXT_LATENCY 0x6007C 7128 #define _TRANS_B_SET_CONTEXT_LATENCY 0x6107C 7129 #define _TRANS_C_SET_CONTEXT_LATENCY 0x6207C 7130 #define _TRANS_D_SET_CONTEXT_LATENCY 0x6307C 7131 #define TRANS_SET_CONTEXT_LATENCY(tran) _MMIO_TRANS2(tran, _TRANS_A_SET_CONTEXT_LATENCY) 7132 #define TRANS_SET_CONTEXT_LATENCY_MASK REG_GENMASK(15, 0) 7133 #define TRANS_SET_CONTEXT_LATENCY_VALUE(x) REG_FIELD_PREP(TRANS_SET_CONTEXT_LATENCY_MASK, (x)) 7134 7135 /* LCPLL Control */ 7136 #define LCPLL_CTL _MMIO(0x130040) 7137 #define LCPLL_PLL_DISABLE (1 << 31) 7138 #define LCPLL_PLL_LOCK (1 << 30) 7139 #define LCPLL_REF_NON_SSC (0 << 28) 7140 #define LCPLL_REF_BCLK (2 << 28) 7141 #define LCPLL_REF_PCH_SSC (3 << 28) 7142 #define LCPLL_REF_MASK (3 << 28) 7143 #define LCPLL_CLK_FREQ_MASK (3 << 26) 7144 #define LCPLL_CLK_FREQ_450 (0 << 26) 7145 #define LCPLL_CLK_FREQ_54O_BDW (1 << 26) 7146 #define LCPLL_CLK_FREQ_337_5_BDW (2 << 26) 7147 #define LCPLL_CLK_FREQ_675_BDW (3 << 26) 7148 #define LCPLL_CD_CLOCK_DISABLE (1 << 25) 7149 #define LCPLL_ROOT_CD_CLOCK_DISABLE (1 << 24) 7150 #define LCPLL_CD2X_CLOCK_DISABLE (1 << 23) 7151 #define LCPLL_POWER_DOWN_ALLOW (1 << 22) 7152 #define LCPLL_CD_SOURCE_FCLK (1 << 21) 7153 #define LCPLL_CD_SOURCE_FCLK_DONE (1 << 19) 7154 7155 /* 7156 * SKL Clocks 7157 */ 7158 7159 /* CDCLK_CTL */ 7160 #define CDCLK_CTL _MMIO(0x46000) 7161 #define CDCLK_FREQ_SEL_MASK REG_GENMASK(27, 26) 7162 #define CDCLK_FREQ_450_432 REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 0) 7163 #define CDCLK_FREQ_540 REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 1) 7164 #define CDCLK_FREQ_337_308 REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 2) 7165 #define CDCLK_FREQ_675_617 REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 3) 7166 #define BXT_CDCLK_CD2X_DIV_SEL_MASK REG_GENMASK(23, 22) 7167 #define BXT_CDCLK_CD2X_DIV_SEL_1 REG_FIELD_PREP(BXT_CDCLK_CD2X_DIV_SEL_MASK, 0) 7168 #define BXT_CDCLK_CD2X_DIV_SEL_1_5 REG_FIELD_PREP(BXT_CDCLK_CD2X_DIV_SEL_MASK, 1) 7169 #define BXT_CDCLK_CD2X_DIV_SEL_2 REG_FIELD_PREP(BXT_CDCLK_CD2X_DIV_SEL_MASK, 2) 7170 #define BXT_CDCLK_CD2X_DIV_SEL_4 REG_FIELD_PREP(BXT_CDCLK_CD2X_DIV_SEL_MASK, 3) 7171 #define BXT_CDCLK_CD2X_PIPE(pipe) ((pipe) << 20) 7172 #define CDCLK_DIVMUX_CD_OVERRIDE (1 << 19) 7173 #define BXT_CDCLK_CD2X_PIPE_NONE BXT_CDCLK_CD2X_PIPE(3) 7174 #define ICL_CDCLK_CD2X_PIPE(pipe) (_PICK(pipe, 0, 2, 6) << 19) 7175 #define ICL_CDCLK_CD2X_PIPE_NONE (7 << 19) 7176 #define TGL_CDCLK_CD2X_PIPE(pipe) BXT_CDCLK_CD2X_PIPE(pipe) 7177 #define TGL_CDCLK_CD2X_PIPE_NONE ICL_CDCLK_CD2X_PIPE_NONE 7178 #define BXT_CDCLK_SSA_PRECHARGE_ENABLE (1 << 16) 7179 #define CDCLK_FREQ_DECIMAL_MASK (0x7ff) 7180 7181 /* CDCLK_SQUASH_CTL */ 7182 #define CDCLK_SQUASH_CTL _MMIO(0x46008) 7183 #define CDCLK_SQUASH_ENABLE REG_BIT(31) 7184 #define CDCLK_SQUASH_WINDOW_SIZE_MASK REG_GENMASK(27, 24) 7185 #define CDCLK_SQUASH_WINDOW_SIZE(x) REG_FIELD_PREP(CDCLK_SQUASH_WINDOW_SIZE_MASK, (x)) 7186 #define CDCLK_SQUASH_WAVEFORM_MASK REG_GENMASK(15, 0) 7187 #define CDCLK_SQUASH_WAVEFORM(x) REG_FIELD_PREP(CDCLK_SQUASH_WAVEFORM_MASK, (x)) 7188 7189 /* LCPLL_CTL */ 7190 #define LCPLL1_CTL _MMIO(0x46010) 7191 #define LCPLL2_CTL _MMIO(0x46014) 7192 #define LCPLL_PLL_ENABLE (1 << 31) 7193 7194 /* DPLL control1 */ 7195 #define DPLL_CTRL1 _MMIO(0x6C058) 7196 #define DPLL_CTRL1_HDMI_MODE(id) (1 << ((id) * 6 + 5)) 7197 #define DPLL_CTRL1_SSC(id) (1 << ((id) * 6 + 4)) 7198 #define DPLL_CTRL1_LINK_RATE_MASK(id) (7 << ((id) * 6 + 1)) 7199 #define DPLL_CTRL1_LINK_RATE_SHIFT(id) ((id) * 6 + 1) 7200 #define DPLL_CTRL1_LINK_RATE(linkrate, id) ((linkrate) << ((id) * 6 + 1)) 7201 #define DPLL_CTRL1_OVERRIDE(id) (1 << ((id) * 6)) 7202 #define DPLL_CTRL1_LINK_RATE_2700 0 7203 #define DPLL_CTRL1_LINK_RATE_1350 1 7204 #define DPLL_CTRL1_LINK_RATE_810 2 7205 #define DPLL_CTRL1_LINK_RATE_1620 3 7206 #define DPLL_CTRL1_LINK_RATE_1080 4 7207 #define DPLL_CTRL1_LINK_RATE_2160 5 7208 7209 /* DPLL control2 */ 7210 #define DPLL_CTRL2 _MMIO(0x6C05C) 7211 #define DPLL_CTRL2_DDI_CLK_OFF(port) (1 << ((port) + 15)) 7212 #define DPLL_CTRL2_DDI_CLK_SEL_MASK(port) (3 << ((port) * 3 + 1)) 7213 #define DPLL_CTRL2_DDI_CLK_SEL_SHIFT(port) ((port) * 3 + 1) 7214 #define DPLL_CTRL2_DDI_CLK_SEL(clk, port) ((clk) << ((port) * 3 + 1)) 7215 #define DPLL_CTRL2_DDI_SEL_OVERRIDE(port) (1 << ((port) * 3)) 7216 7217 /* DPLL Status */ 7218 #define DPLL_STATUS _MMIO(0x6C060) 7219 #define DPLL_LOCK(id) (1 << ((id) * 8)) 7220 7221 /* DPLL cfg */ 7222 #define _DPLL1_CFGCR1 0x6C040 7223 #define _DPLL2_CFGCR1 0x6C048 7224 #define _DPLL3_CFGCR1 0x6C050 7225 #define DPLL_CFGCR1_FREQ_ENABLE (1 << 31) 7226 #define DPLL_CFGCR1_DCO_FRACTION_MASK (0x7fff << 9) 7227 #define DPLL_CFGCR1_DCO_FRACTION(x) ((x) << 9) 7228 #define DPLL_CFGCR1_DCO_INTEGER_MASK (0x1ff) 7229 7230 #define _DPLL1_CFGCR2 0x6C044 7231 #define _DPLL2_CFGCR2 0x6C04C 7232 #define _DPLL3_CFGCR2 0x6C054 7233 #define DPLL_CFGCR2_QDIV_RATIO_MASK (0xff << 8) 7234 #define DPLL_CFGCR2_QDIV_RATIO(x) ((x) << 8) 7235 #define DPLL_CFGCR2_QDIV_MODE(x) ((x) << 7) 7236 #define DPLL_CFGCR2_KDIV_MASK (3 << 5) 7237 #define DPLL_CFGCR2_KDIV(x) ((x) << 5) 7238 #define DPLL_CFGCR2_KDIV_5 (0 << 5) 7239 #define DPLL_CFGCR2_KDIV_2 (1 << 5) 7240 #define DPLL_CFGCR2_KDIV_3 (2 << 5) 7241 #define DPLL_CFGCR2_KDIV_1 (3 << 5) 7242 #define DPLL_CFGCR2_PDIV_MASK (7 << 2) 7243 #define DPLL_CFGCR2_PDIV(x) ((x) << 2) 7244 #define DPLL_CFGCR2_PDIV_1 (0 << 2) 7245 #define DPLL_CFGCR2_PDIV_2 (1 << 2) 7246 #define DPLL_CFGCR2_PDIV_3 (2 << 2) 7247 #define DPLL_CFGCR2_PDIV_7 (4 << 2) 7248 #define DPLL_CFGCR2_PDIV_7_INVALID (5 << 2) 7249 #define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3) 7250 7251 #define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR1) 7252 #define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2) 7253 7254 /* ICL Clocks */ 7255 #define ICL_DPCLKA_CFGCR0 _MMIO(0x164280) 7256 #define ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) (1 << _PICK(phy, 10, 11, 24, 4, 5)) 7257 #define RKL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) REG_BIT((phy) + 10) 7258 #define ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port) (1 << ((tc_port) < TC_PORT_4 ? \ 7259 (tc_port) + 12 : \ 7260 (tc_port) - TC_PORT_4 + 21)) 7261 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) ((phy) * 2) 7262 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (3 << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 7263 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) ((pll) << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 7264 #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) _PICK(phy, 0, 2, 4, 27) 7265 #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) \ 7266 (3 << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 7267 #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) \ 7268 ((pll) << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 7269 7270 /* 7271 * DG1 Clocks 7272 * First registers controls the first A and B, while the second register 7273 * controls the phy C and D. The bits on these registers are the 7274 * same, but refer to different phys 7275 */ 7276 #define _DG1_DPCLKA_CFGCR0 0x164280 7277 #define _DG1_DPCLKA1_CFGCR0 0x16C280 7278 #define _DG1_DPCLKA_PHY_IDX(phy) ((phy) % 2) 7279 #define _DG1_DPCLKA_PLL_IDX(pll) ((pll) % 2) 7280 #define DG1_DPCLKA_CFGCR0(phy) _MMIO_PHY((phy) / 2, \ 7281 _DG1_DPCLKA_CFGCR0, \ 7282 _DG1_DPCLKA1_CFGCR0) 7283 #define DG1_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) REG_BIT(_DG1_DPCLKA_PHY_IDX(phy) + 10) 7284 #define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) (_DG1_DPCLKA_PHY_IDX(phy) * 2) 7285 #define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) (_DG1_DPCLKA_PLL_IDX(pll) << DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 7286 #define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (0x3 << DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 7287 7288 /* ADLS Clocks */ 7289 #define _ADLS_DPCLKA_CFGCR0 0x164280 7290 #define _ADLS_DPCLKA_CFGCR1 0x1642BC 7291 #define ADLS_DPCLKA_CFGCR(phy) _MMIO_PHY((phy) / 3, \ 7292 _ADLS_DPCLKA_CFGCR0, \ 7293 _ADLS_DPCLKA_CFGCR1) 7294 #define ADLS_DPCLKA_CFGCR_DDI_SHIFT(phy) (((phy) % 3) * 2) 7295 /* ADLS DPCLKA_CFGCR0 DDI mask */ 7296 #define ADLS_DPCLKA_DDII_SEL_MASK REG_GENMASK(5, 4) 7297 #define ADLS_DPCLKA_DDIB_SEL_MASK REG_GENMASK(3, 2) 7298 #define ADLS_DPCLKA_DDIA_SEL_MASK REG_GENMASK(1, 0) 7299 /* ADLS DPCLKA_CFGCR1 DDI mask */ 7300 #define ADLS_DPCLKA_DDIK_SEL_MASK REG_GENMASK(3, 2) 7301 #define ADLS_DPCLKA_DDIJ_SEL_MASK REG_GENMASK(1, 0) 7302 #define ADLS_DPCLKA_CFGCR_DDI_CLK_SEL_MASK(phy) _PICK((phy), \ 7303 ADLS_DPCLKA_DDIA_SEL_MASK, \ 7304 ADLS_DPCLKA_DDIB_SEL_MASK, \ 7305 ADLS_DPCLKA_DDII_SEL_MASK, \ 7306 ADLS_DPCLKA_DDIJ_SEL_MASK, \ 7307 ADLS_DPCLKA_DDIK_SEL_MASK) 7308 7309 /* ICL PLL */ 7310 #define DPLL0_ENABLE 0x46010 7311 #define DPLL1_ENABLE 0x46014 7312 #define _ADLS_DPLL2_ENABLE 0x46018 7313 #define _ADLS_DPLL3_ENABLE 0x46030 7314 #define PLL_ENABLE (1 << 31) 7315 #define PLL_LOCK (1 << 30) 7316 #define PLL_POWER_ENABLE (1 << 27) 7317 #define PLL_POWER_STATE (1 << 26) 7318 #define ICL_DPLL_ENABLE(pll) _MMIO_PLL3(pll, DPLL0_ENABLE, DPLL1_ENABLE, \ 7319 _ADLS_DPLL2_ENABLE, _ADLS_DPLL3_ENABLE) 7320 7321 #define _DG2_PLL3_ENABLE 0x4601C 7322 7323 #define DG2_PLL_ENABLE(pll) _MMIO_PLL3(pll, DPLL0_ENABLE, DPLL1_ENABLE, \ 7324 _ADLS_DPLL2_ENABLE, _DG2_PLL3_ENABLE) 7325 7326 #define TBT_PLL_ENABLE _MMIO(0x46020) 7327 7328 #define _MG_PLL1_ENABLE 0x46030 7329 #define _MG_PLL2_ENABLE 0x46034 7330 #define _MG_PLL3_ENABLE 0x46038 7331 #define _MG_PLL4_ENABLE 0x4603C 7332 /* Bits are the same as DPLL0_ENABLE */ 7333 #define MG_PLL_ENABLE(tc_port) _MMIO_PORT((tc_port), _MG_PLL1_ENABLE, \ 7334 _MG_PLL2_ENABLE) 7335 7336 /* DG1 PLL */ 7337 #define DG1_DPLL_ENABLE(pll) _MMIO_PLL3(pll, DPLL0_ENABLE, DPLL1_ENABLE, \ 7338 _MG_PLL1_ENABLE, _MG_PLL2_ENABLE) 7339 7340 /* ADL-P Type C PLL */ 7341 #define PORTTC1_PLL_ENABLE 0x46038 7342 #define PORTTC2_PLL_ENABLE 0x46040 7343 7344 #define ADLP_PORTTC_PLL_ENABLE(tc_port) _MMIO_PORT((tc_port), \ 7345 PORTTC1_PLL_ENABLE, \ 7346 PORTTC2_PLL_ENABLE) 7347 7348 #define _ICL_DPLL0_CFGCR0 0x164000 7349 #define _ICL_DPLL1_CFGCR0 0x164080 7350 #define ICL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _ICL_DPLL0_CFGCR0, \ 7351 _ICL_DPLL1_CFGCR0) 7352 #define DPLL_CFGCR0_HDMI_MODE (1 << 30) 7353 #define DPLL_CFGCR0_SSC_ENABLE (1 << 29) 7354 #define DPLL_CFGCR0_SSC_ENABLE_ICL (1 << 25) 7355 #define DPLL_CFGCR0_LINK_RATE_MASK (0xf << 25) 7356 #define DPLL_CFGCR0_LINK_RATE_2700 (0 << 25) 7357 #define DPLL_CFGCR0_LINK_RATE_1350 (1 << 25) 7358 #define DPLL_CFGCR0_LINK_RATE_810 (2 << 25) 7359 #define DPLL_CFGCR0_LINK_RATE_1620 (3 << 25) 7360 #define DPLL_CFGCR0_LINK_RATE_1080 (4 << 25) 7361 #define DPLL_CFGCR0_LINK_RATE_2160 (5 << 25) 7362 #define DPLL_CFGCR0_LINK_RATE_3240 (6 << 25) 7363 #define DPLL_CFGCR0_LINK_RATE_4050 (7 << 25) 7364 #define DPLL_CFGCR0_DCO_FRACTION_MASK (0x7fff << 10) 7365 #define DPLL_CFGCR0_DCO_FRACTION_SHIFT (10) 7366 #define DPLL_CFGCR0_DCO_FRACTION(x) ((x) << 10) 7367 #define DPLL_CFGCR0_DCO_INTEGER_MASK (0x3ff) 7368 7369 #define _ICL_DPLL0_CFGCR1 0x164004 7370 #define _ICL_DPLL1_CFGCR1 0x164084 7371 #define ICL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _ICL_DPLL0_CFGCR1, \ 7372 _ICL_DPLL1_CFGCR1) 7373 #define DPLL_CFGCR1_QDIV_RATIO_MASK (0xff << 10) 7374 #define DPLL_CFGCR1_QDIV_RATIO_SHIFT (10) 7375 #define DPLL_CFGCR1_QDIV_RATIO(x) ((x) << 10) 7376 #define DPLL_CFGCR1_QDIV_MODE_SHIFT (9) 7377 #define DPLL_CFGCR1_QDIV_MODE(x) ((x) << 9) 7378 #define DPLL_CFGCR1_KDIV_MASK (7 << 6) 7379 #define DPLL_CFGCR1_KDIV_SHIFT (6) 7380 #define DPLL_CFGCR1_KDIV(x) ((x) << 6) 7381 #define DPLL_CFGCR1_KDIV_1 (1 << 6) 7382 #define DPLL_CFGCR1_KDIV_2 (2 << 6) 7383 #define DPLL_CFGCR1_KDIV_3 (4 << 6) 7384 #define DPLL_CFGCR1_PDIV_MASK (0xf << 2) 7385 #define DPLL_CFGCR1_PDIV_SHIFT (2) 7386 #define DPLL_CFGCR1_PDIV(x) ((x) << 2) 7387 #define DPLL_CFGCR1_PDIV_2 (1 << 2) 7388 #define DPLL_CFGCR1_PDIV_3 (2 << 2) 7389 #define DPLL_CFGCR1_PDIV_5 (4 << 2) 7390 #define DPLL_CFGCR1_PDIV_7 (8 << 2) 7391 #define DPLL_CFGCR1_CENTRAL_FREQ (3 << 0) 7392 #define DPLL_CFGCR1_CENTRAL_FREQ_8400 (3 << 0) 7393 #define TGL_DPLL_CFGCR1_CFSELOVRD_NORMAL_XTAL (0 << 0) 7394 7395 #define _TGL_DPLL0_CFGCR0 0x164284 7396 #define _TGL_DPLL1_CFGCR0 0x16428C 7397 #define _TGL_TBTPLL_CFGCR0 0x16429C 7398 #define TGL_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \ 7399 _TGL_DPLL1_CFGCR0, \ 7400 _TGL_TBTPLL_CFGCR0) 7401 #define RKL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR0, \ 7402 _TGL_DPLL1_CFGCR0) 7403 7404 #define _TGL_DPLL0_DIV0 0x164B00 7405 #define _TGL_DPLL1_DIV0 0x164C00 7406 #define TGL_DPLL0_DIV0(pll) _MMIO_PLL(pll, _TGL_DPLL0_DIV0, _TGL_DPLL1_DIV0) 7407 #define TGL_DPLL0_DIV0_AFC_STARTUP_MASK REG_GENMASK(27, 25) 7408 #define TGL_DPLL0_DIV0_AFC_STARTUP(val) REG_FIELD_PREP(TGL_DPLL0_DIV0_AFC_STARTUP_MASK, (val)) 7409 7410 #define _TGL_DPLL0_CFGCR1 0x164288 7411 #define _TGL_DPLL1_CFGCR1 0x164290 7412 #define _TGL_TBTPLL_CFGCR1 0x1642A0 7413 #define TGL_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \ 7414 _TGL_DPLL1_CFGCR1, \ 7415 _TGL_TBTPLL_CFGCR1) 7416 #define RKL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR1, \ 7417 _TGL_DPLL1_CFGCR1) 7418 7419 #define _DG1_DPLL2_CFGCR0 0x16C284 7420 #define _DG1_DPLL3_CFGCR0 0x16C28C 7421 #define DG1_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \ 7422 _TGL_DPLL1_CFGCR0, \ 7423 _DG1_DPLL2_CFGCR0, \ 7424 _DG1_DPLL3_CFGCR0) 7425 7426 #define _DG1_DPLL2_CFGCR1 0x16C288 7427 #define _DG1_DPLL3_CFGCR1 0x16C290 7428 #define DG1_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \ 7429 _TGL_DPLL1_CFGCR1, \ 7430 _DG1_DPLL2_CFGCR1, \ 7431 _DG1_DPLL3_CFGCR1) 7432 7433 /* For ADL-S DPLL4_CFGCR0/1 are used to control DPLL2 */ 7434 #define _ADLS_DPLL3_CFGCR0 0x1642C0 7435 #define _ADLS_DPLL4_CFGCR0 0x164294 7436 #define ADLS_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \ 7437 _TGL_DPLL1_CFGCR0, \ 7438 _ADLS_DPLL4_CFGCR0, \ 7439 _ADLS_DPLL3_CFGCR0) 7440 7441 #define _ADLS_DPLL3_CFGCR1 0x1642C4 7442 #define _ADLS_DPLL4_CFGCR1 0x164298 7443 #define ADLS_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \ 7444 _TGL_DPLL1_CFGCR1, \ 7445 _ADLS_DPLL4_CFGCR1, \ 7446 _ADLS_DPLL3_CFGCR1) 7447 7448 /* BXT display engine PLL */ 7449 #define BXT_DE_PLL_CTL _MMIO(0x6d000) 7450 #define BXT_DE_PLL_RATIO(x) (x) /* {60,65,100} * 19.2MHz */ 7451 #define BXT_DE_PLL_RATIO_MASK 0xff 7452 7453 #define BXT_DE_PLL_ENABLE _MMIO(0x46070) 7454 #define BXT_DE_PLL_PLL_ENABLE (1 << 31) 7455 #define BXT_DE_PLL_LOCK (1 << 30) 7456 #define BXT_DE_PLL_FREQ_REQ (1 << 23) 7457 #define BXT_DE_PLL_FREQ_REQ_ACK (1 << 22) 7458 #define ICL_CDCLK_PLL_RATIO(x) (x) 7459 #define ICL_CDCLK_PLL_RATIO_MASK 0xff 7460 7461 /* GEN9 DC */ 7462 #define DC_STATE_EN _MMIO(0x45504) 7463 #define DC_STATE_DISABLE 0 7464 #define DC_STATE_EN_DC3CO REG_BIT(30) 7465 #define DC_STATE_DC3CO_STATUS REG_BIT(29) 7466 #define DC_STATE_EN_UPTO_DC5 (1 << 0) 7467 #define DC_STATE_EN_DC9 (1 << 3) 7468 #define DC_STATE_EN_UPTO_DC6 (2 << 0) 7469 #define DC_STATE_EN_UPTO_DC5_DC6_MASK 0x3 7470 7471 #define DC_STATE_DEBUG _MMIO(0x45520) 7472 #define DC_STATE_DEBUG_MASK_CORES (1 << 0) 7473 #define DC_STATE_DEBUG_MASK_MEMORY_UP (1 << 1) 7474 7475 #define D_COMP_BDW _MMIO(0x138144) 7476 7477 /* Pipe WM_LINETIME - watermark line time */ 7478 #define _WM_LINETIME_A 0x45270 7479 #define _WM_LINETIME_B 0x45274 7480 #define WM_LINETIME(pipe) _MMIO_PIPE(pipe, _WM_LINETIME_A, _WM_LINETIME_B) 7481 #define HSW_LINETIME_MASK REG_GENMASK(8, 0) 7482 #define HSW_LINETIME(x) REG_FIELD_PREP(HSW_LINETIME_MASK, (x)) 7483 #define HSW_IPS_LINETIME_MASK REG_GENMASK(24, 16) 7484 #define HSW_IPS_LINETIME(x) REG_FIELD_PREP(HSW_IPS_LINETIME_MASK, (x)) 7485 7486 /* SFUSE_STRAP */ 7487 #define SFUSE_STRAP _MMIO(0xc2014) 7488 #define SFUSE_STRAP_FUSE_LOCK (1 << 13) 7489 #define SFUSE_STRAP_RAW_FREQUENCY (1 << 8) 7490 #define SFUSE_STRAP_DISPLAY_DISABLED (1 << 7) 7491 #define SFUSE_STRAP_CRT_DISABLED (1 << 6) 7492 #define SFUSE_STRAP_DDIF_DETECTED (1 << 3) 7493 #define SFUSE_STRAP_DDIB_DETECTED (1 << 2) 7494 #define SFUSE_STRAP_DDIC_DETECTED (1 << 1) 7495 #define SFUSE_STRAP_DDID_DETECTED (1 << 0) 7496 7497 #define WM_MISC _MMIO(0x45260) 7498 #define WM_MISC_DATA_PARTITION_5_6 (1 << 0) 7499 7500 #define WM_DBG _MMIO(0x45280) 7501 #define WM_DBG_DISALLOW_MULTIPLE_LP (1 << 0) 7502 #define WM_DBG_DISALLOW_MAXFIFO (1 << 1) 7503 #define WM_DBG_DISALLOW_SPRITE (1 << 2) 7504 7505 /* pipe CSC */ 7506 #define _PIPE_A_CSC_COEFF_RY_GY 0x49010 7507 #define _PIPE_A_CSC_COEFF_BY 0x49014 7508 #define _PIPE_A_CSC_COEFF_RU_GU 0x49018 7509 #define _PIPE_A_CSC_COEFF_BU 0x4901c 7510 #define _PIPE_A_CSC_COEFF_RV_GV 0x49020 7511 #define _PIPE_A_CSC_COEFF_BV 0x49024 7512 7513 #define _PIPE_A_CSC_MODE 0x49028 7514 #define ICL_CSC_ENABLE (1 << 31) /* icl+ */ 7515 #define ICL_OUTPUT_CSC_ENABLE (1 << 30) /* icl+ */ 7516 #define CSC_BLACK_SCREEN_OFFSET (1 << 2) /* ilk/snb */ 7517 #define CSC_POSITION_BEFORE_GAMMA (1 << 1) /* pre-glk */ 7518 #define CSC_MODE_YUV_TO_RGB (1 << 0) /* ilk/snb */ 7519 7520 #define _PIPE_A_CSC_PREOFF_HI 0x49030 7521 #define _PIPE_A_CSC_PREOFF_ME 0x49034 7522 #define _PIPE_A_CSC_PREOFF_LO 0x49038 7523 #define _PIPE_A_CSC_POSTOFF_HI 0x49040 7524 #define _PIPE_A_CSC_POSTOFF_ME 0x49044 7525 #define _PIPE_A_CSC_POSTOFF_LO 0x49048 7526 7527 #define _PIPE_B_CSC_COEFF_RY_GY 0x49110 7528 #define _PIPE_B_CSC_COEFF_BY 0x49114 7529 #define _PIPE_B_CSC_COEFF_RU_GU 0x49118 7530 #define _PIPE_B_CSC_COEFF_BU 0x4911c 7531 #define _PIPE_B_CSC_COEFF_RV_GV 0x49120 7532 #define _PIPE_B_CSC_COEFF_BV 0x49124 7533 #define _PIPE_B_CSC_MODE 0x49128 7534 #define _PIPE_B_CSC_PREOFF_HI 0x49130 7535 #define _PIPE_B_CSC_PREOFF_ME 0x49134 7536 #define _PIPE_B_CSC_PREOFF_LO 0x49138 7537 #define _PIPE_B_CSC_POSTOFF_HI 0x49140 7538 #define _PIPE_B_CSC_POSTOFF_ME 0x49144 7539 #define _PIPE_B_CSC_POSTOFF_LO 0x49148 7540 7541 #define PIPE_CSC_COEFF_RY_GY(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RY_GY, _PIPE_B_CSC_COEFF_RY_GY) 7542 #define PIPE_CSC_COEFF_BY(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BY, _PIPE_B_CSC_COEFF_BY) 7543 #define PIPE_CSC_COEFF_RU_GU(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RU_GU, _PIPE_B_CSC_COEFF_RU_GU) 7544 #define PIPE_CSC_COEFF_BU(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BU, _PIPE_B_CSC_COEFF_BU) 7545 #define PIPE_CSC_COEFF_RV_GV(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RV_GV, _PIPE_B_CSC_COEFF_RV_GV) 7546 #define PIPE_CSC_COEFF_BV(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BV, _PIPE_B_CSC_COEFF_BV) 7547 #define PIPE_CSC_MODE(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_MODE, _PIPE_B_CSC_MODE) 7548 #define PIPE_CSC_PREOFF_HI(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_HI, _PIPE_B_CSC_PREOFF_HI) 7549 #define PIPE_CSC_PREOFF_ME(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_ME, _PIPE_B_CSC_PREOFF_ME) 7550 #define PIPE_CSC_PREOFF_LO(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_LO, _PIPE_B_CSC_PREOFF_LO) 7551 #define PIPE_CSC_POSTOFF_HI(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_HI, _PIPE_B_CSC_POSTOFF_HI) 7552 #define PIPE_CSC_POSTOFF_ME(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_ME, _PIPE_B_CSC_POSTOFF_ME) 7553 #define PIPE_CSC_POSTOFF_LO(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_LO, _PIPE_B_CSC_POSTOFF_LO) 7554 7555 /* Pipe Output CSC */ 7556 #define _PIPE_A_OUTPUT_CSC_COEFF_RY_GY 0x49050 7557 #define _PIPE_A_OUTPUT_CSC_COEFF_BY 0x49054 7558 #define _PIPE_A_OUTPUT_CSC_COEFF_RU_GU 0x49058 7559 #define _PIPE_A_OUTPUT_CSC_COEFF_BU 0x4905c 7560 #define _PIPE_A_OUTPUT_CSC_COEFF_RV_GV 0x49060 7561 #define _PIPE_A_OUTPUT_CSC_COEFF_BV 0x49064 7562 #define _PIPE_A_OUTPUT_CSC_PREOFF_HI 0x49068 7563 #define _PIPE_A_OUTPUT_CSC_PREOFF_ME 0x4906c 7564 #define _PIPE_A_OUTPUT_CSC_PREOFF_LO 0x49070 7565 #define _PIPE_A_OUTPUT_CSC_POSTOFF_HI 0x49074 7566 #define _PIPE_A_OUTPUT_CSC_POSTOFF_ME 0x49078 7567 #define _PIPE_A_OUTPUT_CSC_POSTOFF_LO 0x4907c 7568 7569 #define _PIPE_B_OUTPUT_CSC_COEFF_RY_GY 0x49150 7570 #define _PIPE_B_OUTPUT_CSC_COEFF_BY 0x49154 7571 #define _PIPE_B_OUTPUT_CSC_COEFF_RU_GU 0x49158 7572 #define _PIPE_B_OUTPUT_CSC_COEFF_BU 0x4915c 7573 #define _PIPE_B_OUTPUT_CSC_COEFF_RV_GV 0x49160 7574 #define _PIPE_B_OUTPUT_CSC_COEFF_BV 0x49164 7575 #define _PIPE_B_OUTPUT_CSC_PREOFF_HI 0x49168 7576 #define _PIPE_B_OUTPUT_CSC_PREOFF_ME 0x4916c 7577 #define _PIPE_B_OUTPUT_CSC_PREOFF_LO 0x49170 7578 #define _PIPE_B_OUTPUT_CSC_POSTOFF_HI 0x49174 7579 #define _PIPE_B_OUTPUT_CSC_POSTOFF_ME 0x49178 7580 #define _PIPE_B_OUTPUT_CSC_POSTOFF_LO 0x4917c 7581 7582 #define PIPE_CSC_OUTPUT_COEFF_RY_GY(pipe) _MMIO_PIPE(pipe,\ 7583 _PIPE_A_OUTPUT_CSC_COEFF_RY_GY,\ 7584 _PIPE_B_OUTPUT_CSC_COEFF_RY_GY) 7585 #define PIPE_CSC_OUTPUT_COEFF_BY(pipe) _MMIO_PIPE(pipe, \ 7586 _PIPE_A_OUTPUT_CSC_COEFF_BY, \ 7587 _PIPE_B_OUTPUT_CSC_COEFF_BY) 7588 #define PIPE_CSC_OUTPUT_COEFF_RU_GU(pipe) _MMIO_PIPE(pipe, \ 7589 _PIPE_A_OUTPUT_CSC_COEFF_RU_GU, \ 7590 _PIPE_B_OUTPUT_CSC_COEFF_RU_GU) 7591 #define PIPE_CSC_OUTPUT_COEFF_BU(pipe) _MMIO_PIPE(pipe, \ 7592 _PIPE_A_OUTPUT_CSC_COEFF_BU, \ 7593 _PIPE_B_OUTPUT_CSC_COEFF_BU) 7594 #define PIPE_CSC_OUTPUT_COEFF_RV_GV(pipe) _MMIO_PIPE(pipe, \ 7595 _PIPE_A_OUTPUT_CSC_COEFF_RV_GV, \ 7596 _PIPE_B_OUTPUT_CSC_COEFF_RV_GV) 7597 #define PIPE_CSC_OUTPUT_COEFF_BV(pipe) _MMIO_PIPE(pipe, \ 7598 _PIPE_A_OUTPUT_CSC_COEFF_BV, \ 7599 _PIPE_B_OUTPUT_CSC_COEFF_BV) 7600 #define PIPE_CSC_OUTPUT_PREOFF_HI(pipe) _MMIO_PIPE(pipe, \ 7601 _PIPE_A_OUTPUT_CSC_PREOFF_HI, \ 7602 _PIPE_B_OUTPUT_CSC_PREOFF_HI) 7603 #define PIPE_CSC_OUTPUT_PREOFF_ME(pipe) _MMIO_PIPE(pipe, \ 7604 _PIPE_A_OUTPUT_CSC_PREOFF_ME, \ 7605 _PIPE_B_OUTPUT_CSC_PREOFF_ME) 7606 #define PIPE_CSC_OUTPUT_PREOFF_LO(pipe) _MMIO_PIPE(pipe, \ 7607 _PIPE_A_OUTPUT_CSC_PREOFF_LO, \ 7608 _PIPE_B_OUTPUT_CSC_PREOFF_LO) 7609 #define PIPE_CSC_OUTPUT_POSTOFF_HI(pipe) _MMIO_PIPE(pipe, \ 7610 _PIPE_A_OUTPUT_CSC_POSTOFF_HI, \ 7611 _PIPE_B_OUTPUT_CSC_POSTOFF_HI) 7612 #define PIPE_CSC_OUTPUT_POSTOFF_ME(pipe) _MMIO_PIPE(pipe, \ 7613 _PIPE_A_OUTPUT_CSC_POSTOFF_ME, \ 7614 _PIPE_B_OUTPUT_CSC_POSTOFF_ME) 7615 #define PIPE_CSC_OUTPUT_POSTOFF_LO(pipe) _MMIO_PIPE(pipe, \ 7616 _PIPE_A_OUTPUT_CSC_POSTOFF_LO, \ 7617 _PIPE_B_OUTPUT_CSC_POSTOFF_LO) 7618 7619 /* pipe degamma/gamma LUTs on IVB+ */ 7620 #define _PAL_PREC_INDEX_A 0x4A400 7621 #define _PAL_PREC_INDEX_B 0x4AC00 7622 #define _PAL_PREC_INDEX_C 0x4B400 7623 #define PAL_PREC_10_12_BIT (0 << 31) 7624 #define PAL_PREC_SPLIT_MODE (1 << 31) 7625 #define PAL_PREC_AUTO_INCREMENT (1 << 15) 7626 #define PAL_PREC_INDEX_VALUE_MASK (0x3ff << 0) 7627 #define PAL_PREC_INDEX_VALUE(x) ((x) << 0) 7628 #define _PAL_PREC_DATA_A 0x4A404 7629 #define _PAL_PREC_DATA_B 0x4AC04 7630 #define _PAL_PREC_DATA_C 0x4B404 7631 #define _PAL_PREC_GC_MAX_A 0x4A410 7632 #define _PAL_PREC_GC_MAX_B 0x4AC10 7633 #define _PAL_PREC_GC_MAX_C 0x4B410 7634 #define PREC_PAL_DATA_RED_MASK REG_GENMASK(29, 20) 7635 #define PREC_PAL_DATA_GREEN_MASK REG_GENMASK(19, 10) 7636 #define PREC_PAL_DATA_BLUE_MASK REG_GENMASK(9, 0) 7637 #define _PAL_PREC_EXT_GC_MAX_A 0x4A420 7638 #define _PAL_PREC_EXT_GC_MAX_B 0x4AC20 7639 #define _PAL_PREC_EXT_GC_MAX_C 0x4B420 7640 #define _PAL_PREC_EXT2_GC_MAX_A 0x4A430 7641 #define _PAL_PREC_EXT2_GC_MAX_B 0x4AC30 7642 #define _PAL_PREC_EXT2_GC_MAX_C 0x4B430 7643 7644 #define PREC_PAL_INDEX(pipe) _MMIO_PIPE(pipe, _PAL_PREC_INDEX_A, _PAL_PREC_INDEX_B) 7645 #define PREC_PAL_DATA(pipe) _MMIO_PIPE(pipe, _PAL_PREC_DATA_A, _PAL_PREC_DATA_B) 7646 #define PREC_PAL_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_GC_MAX_A, _PAL_PREC_GC_MAX_B) + (i) * 4) 7647 #define PREC_PAL_EXT_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_EXT_GC_MAX_A, _PAL_PREC_EXT_GC_MAX_B) + (i) * 4) 7648 #define PREC_PAL_EXT2_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_EXT2_GC_MAX_A, _PAL_PREC_EXT2_GC_MAX_B) + (i) * 4) 7649 7650 #define _PRE_CSC_GAMC_INDEX_A 0x4A484 7651 #define _PRE_CSC_GAMC_INDEX_B 0x4AC84 7652 #define _PRE_CSC_GAMC_INDEX_C 0x4B484 7653 #define PRE_CSC_GAMC_AUTO_INCREMENT (1 << 10) 7654 #define _PRE_CSC_GAMC_DATA_A 0x4A488 7655 #define _PRE_CSC_GAMC_DATA_B 0x4AC88 7656 #define _PRE_CSC_GAMC_DATA_C 0x4B488 7657 7658 #define PRE_CSC_GAMC_INDEX(pipe) _MMIO_PIPE(pipe, _PRE_CSC_GAMC_INDEX_A, _PRE_CSC_GAMC_INDEX_B) 7659 #define PRE_CSC_GAMC_DATA(pipe) _MMIO_PIPE(pipe, _PRE_CSC_GAMC_DATA_A, _PRE_CSC_GAMC_DATA_B) 7660 7661 /* ICL Multi segmented gamma */ 7662 #define _PAL_PREC_MULTI_SEG_INDEX_A 0x4A408 7663 #define _PAL_PREC_MULTI_SEG_INDEX_B 0x4AC08 7664 #define PAL_PREC_MULTI_SEGMENT_AUTO_INCREMENT REG_BIT(15) 7665 #define PAL_PREC_MULTI_SEGMENT_INDEX_VALUE_MASK REG_GENMASK(4, 0) 7666 7667 #define _PAL_PREC_MULTI_SEG_DATA_A 0x4A40C 7668 #define _PAL_PREC_MULTI_SEG_DATA_B 0x4AC0C 7669 #define PAL_PREC_MULTI_SEG_RED_LDW_MASK REG_GENMASK(29, 24) 7670 #define PAL_PREC_MULTI_SEG_RED_UDW_MASK REG_GENMASK(29, 20) 7671 #define PAL_PREC_MULTI_SEG_GREEN_LDW_MASK REG_GENMASK(19, 14) 7672 #define PAL_PREC_MULTI_SEG_GREEN_UDW_MASK REG_GENMASK(19, 10) 7673 #define PAL_PREC_MULTI_SEG_BLUE_LDW_MASK REG_GENMASK(9, 4) 7674 #define PAL_PREC_MULTI_SEG_BLUE_UDW_MASK REG_GENMASK(9, 0) 7675 7676 #define PREC_PAL_MULTI_SEG_INDEX(pipe) _MMIO_PIPE(pipe, \ 7677 _PAL_PREC_MULTI_SEG_INDEX_A, \ 7678 _PAL_PREC_MULTI_SEG_INDEX_B) 7679 #define PREC_PAL_MULTI_SEG_DATA(pipe) _MMIO_PIPE(pipe, \ 7680 _PAL_PREC_MULTI_SEG_DATA_A, \ 7681 _PAL_PREC_MULTI_SEG_DATA_B) 7682 7683 #define _MMIO_PLANE_GAMC(plane, i, a, b) _MMIO(_PIPE(plane, a, b) + (i) * 4) 7684 7685 /* Plane CSC Registers */ 7686 #define _PLANE_CSC_RY_GY_1_A 0x70210 7687 #define _PLANE_CSC_RY_GY_2_A 0x70310 7688 7689 #define _PLANE_CSC_RY_GY_1_B 0x71210 7690 #define _PLANE_CSC_RY_GY_2_B 0x71310 7691 7692 #define _PLANE_CSC_RY_GY_1(pipe) _PIPE(pipe, _PLANE_CSC_RY_GY_1_A, \ 7693 _PLANE_CSC_RY_GY_1_B) 7694 #define _PLANE_CSC_RY_GY_2(pipe) _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_2_A, \ 7695 _PLANE_INPUT_CSC_RY_GY_2_B) 7696 #define PLANE_CSC_COEFF(pipe, plane, index) _MMIO_PLANE(plane, \ 7697 _PLANE_CSC_RY_GY_1(pipe) + (index) * 4, \ 7698 _PLANE_CSC_RY_GY_2(pipe) + (index) * 4) 7699 7700 #define _PLANE_CSC_PREOFF_HI_1_A 0x70228 7701 #define _PLANE_CSC_PREOFF_HI_2_A 0x70328 7702 7703 #define _PLANE_CSC_PREOFF_HI_1_B 0x71228 7704 #define _PLANE_CSC_PREOFF_HI_2_B 0x71328 7705 7706 #define _PLANE_CSC_PREOFF_HI_1(pipe) _PIPE(pipe, _PLANE_CSC_PREOFF_HI_1_A, \ 7707 _PLANE_CSC_PREOFF_HI_1_B) 7708 #define _PLANE_CSC_PREOFF_HI_2(pipe) _PIPE(pipe, _PLANE_CSC_PREOFF_HI_2_A, \ 7709 _PLANE_CSC_PREOFF_HI_2_B) 7710 #define PLANE_CSC_PREOFF(pipe, plane, index) _MMIO_PLANE(plane, _PLANE_CSC_PREOFF_HI_1(pipe) + \ 7711 (index) * 4, _PLANE_CSC_PREOFF_HI_2(pipe) + \ 7712 (index) * 4) 7713 7714 #define _PLANE_CSC_POSTOFF_HI_1_A 0x70234 7715 #define _PLANE_CSC_POSTOFF_HI_2_A 0x70334 7716 7717 #define _PLANE_CSC_POSTOFF_HI_1_B 0x71234 7718 #define _PLANE_CSC_POSTOFF_HI_2_B 0x71334 7719 7720 #define _PLANE_CSC_POSTOFF_HI_1(pipe) _PIPE(pipe, _PLANE_CSC_POSTOFF_HI_1_A, \ 7721 _PLANE_CSC_POSTOFF_HI_1_B) 7722 #define _PLANE_CSC_POSTOFF_HI_2(pipe) _PIPE(pipe, _PLANE_CSC_POSTOFF_HI_2_A, \ 7723 _PLANE_CSC_POSTOFF_HI_2_B) 7724 #define PLANE_CSC_POSTOFF(pipe, plane, index) _MMIO_PLANE(plane, _PLANE_CSC_POSTOFF_HI_1(pipe) + \ 7725 (index) * 4, _PLANE_CSC_POSTOFF_HI_2(pipe) + \ 7726 (index) * 4) 7727 7728 /* pipe CSC & degamma/gamma LUTs on CHV */ 7729 #define _CGM_PIPE_A_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x67900) 7730 #define _CGM_PIPE_A_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x67904) 7731 #define _CGM_PIPE_A_CSC_COEFF45 (VLV_DISPLAY_BASE + 0x67908) 7732 #define _CGM_PIPE_A_CSC_COEFF67 (VLV_DISPLAY_BASE + 0x6790C) 7733 #define _CGM_PIPE_A_CSC_COEFF8 (VLV_DISPLAY_BASE + 0x67910) 7734 #define _CGM_PIPE_A_DEGAMMA (VLV_DISPLAY_BASE + 0x66000) 7735 #define CGM_PIPE_DEGAMMA_RED_MASK REG_GENMASK(13, 0) 7736 #define CGM_PIPE_DEGAMMA_GREEN_MASK REG_GENMASK(29, 16) 7737 #define CGM_PIPE_DEGAMMA_BLUE_MASK REG_GENMASK(13, 0) 7738 #define _CGM_PIPE_A_GAMMA (VLV_DISPLAY_BASE + 0x67000) 7739 #define CGM_PIPE_GAMMA_RED_MASK REG_GENMASK(9, 0) 7740 #define CGM_PIPE_GAMMA_GREEN_MASK REG_GENMASK(25, 16) 7741 #define CGM_PIPE_GAMMA_BLUE_MASK REG_GENMASK(9, 0) 7742 #define _CGM_PIPE_A_MODE (VLV_DISPLAY_BASE + 0x67A00) 7743 #define CGM_PIPE_MODE_GAMMA (1 << 2) 7744 #define CGM_PIPE_MODE_CSC (1 << 1) 7745 #define CGM_PIPE_MODE_DEGAMMA (1 << 0) 7746 7747 #define _CGM_PIPE_B_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x69900) 7748 #define _CGM_PIPE_B_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x69904) 7749 #define _CGM_PIPE_B_CSC_COEFF45 (VLV_DISPLAY_BASE + 0x69908) 7750 #define _CGM_PIPE_B_CSC_COEFF67 (VLV_DISPLAY_BASE + 0x6990C) 7751 #define _CGM_PIPE_B_CSC_COEFF8 (VLV_DISPLAY_BASE + 0x69910) 7752 #define _CGM_PIPE_B_DEGAMMA (VLV_DISPLAY_BASE + 0x68000) 7753 #define _CGM_PIPE_B_GAMMA (VLV_DISPLAY_BASE + 0x69000) 7754 #define _CGM_PIPE_B_MODE (VLV_DISPLAY_BASE + 0x69A00) 7755 7756 #define CGM_PIPE_CSC_COEFF01(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF01, _CGM_PIPE_B_CSC_COEFF01) 7757 #define CGM_PIPE_CSC_COEFF23(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF23, _CGM_PIPE_B_CSC_COEFF23) 7758 #define CGM_PIPE_CSC_COEFF45(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF45, _CGM_PIPE_B_CSC_COEFF45) 7759 #define CGM_PIPE_CSC_COEFF67(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF67, _CGM_PIPE_B_CSC_COEFF67) 7760 #define CGM_PIPE_CSC_COEFF8(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF8, _CGM_PIPE_B_CSC_COEFF8) 7761 #define CGM_PIPE_DEGAMMA(pipe, i, w) _MMIO(_PIPE(pipe, _CGM_PIPE_A_DEGAMMA, _CGM_PIPE_B_DEGAMMA) + (i) * 8 + (w) * 4) 7762 #define CGM_PIPE_GAMMA(pipe, i, w) _MMIO(_PIPE(pipe, _CGM_PIPE_A_GAMMA, _CGM_PIPE_B_GAMMA) + (i) * 8 + (w) * 4) 7763 #define CGM_PIPE_MODE(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_MODE, _CGM_PIPE_B_MODE) 7764 7765 /* Gen4+ Timestamp and Pipe Frame time stamp registers */ 7766 #define GEN4_TIMESTAMP _MMIO(0x2358) 7767 #define ILK_TIMESTAMP_HI _MMIO(0x70070) 7768 #define IVB_TIMESTAMP_CTR _MMIO(0x44070) 7769 7770 #define GEN9_TIMESTAMP_OVERRIDE _MMIO(0x44074) 7771 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT 0 7772 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK 0x3ff 7773 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT 12 7774 #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK (0xf << 12) 7775 7776 #define _PIPE_FRMTMSTMP_A 0x70048 7777 #define PIPE_FRMTMSTMP(pipe) \ 7778 _MMIO_PIPE2(pipe, _PIPE_FRMTMSTMP_A) 7779 7780 /* Display Stream Splitter Control */ 7781 #define DSS_CTL1 _MMIO(0x67400) 7782 #define SPLITTER_ENABLE (1 << 31) 7783 #define JOINER_ENABLE (1 << 30) 7784 #define DUAL_LINK_MODE_INTERLEAVE (1 << 24) 7785 #define DUAL_LINK_MODE_FRONTBACK (0 << 24) 7786 #define OVERLAP_PIXELS_MASK (0xf << 16) 7787 #define OVERLAP_PIXELS(pixels) ((pixels) << 16) 7788 #define LEFT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) 7789 #define LEFT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) 7790 #define MAX_DL_BUFFER_TARGET_DEPTH 0x5a0 7791 7792 #define DSS_CTL2 _MMIO(0x67404) 7793 #define LEFT_BRANCH_VDSC_ENABLE (1 << 31) 7794 #define RIGHT_BRANCH_VDSC_ENABLE (1 << 15) 7795 #define RIGHT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) 7796 #define RIGHT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) 7797 7798 #define _ICL_PIPE_DSS_CTL1_PB 0x78200 7799 #define _ICL_PIPE_DSS_CTL1_PC 0x78400 7800 #define ICL_PIPE_DSS_CTL1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7801 _ICL_PIPE_DSS_CTL1_PB, \ 7802 _ICL_PIPE_DSS_CTL1_PC) 7803 #define BIG_JOINER_ENABLE (1 << 29) 7804 #define MASTER_BIG_JOINER_ENABLE (1 << 28) 7805 #define VGA_CENTERING_ENABLE (1 << 27) 7806 #define SPLITTER_CONFIGURATION_MASK REG_GENMASK(26, 25) 7807 #define SPLITTER_CONFIGURATION_2_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0) 7808 #define SPLITTER_CONFIGURATION_4_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1) 7809 #define UNCOMPRESSED_JOINER_MASTER (1 << 21) 7810 #define UNCOMPRESSED_JOINER_SLAVE (1 << 20) 7811 7812 #define _ICL_PIPE_DSS_CTL2_PB 0x78204 7813 #define _ICL_PIPE_DSS_CTL2_PC 0x78404 7814 #define ICL_PIPE_DSS_CTL2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7815 _ICL_PIPE_DSS_CTL2_PB, \ 7816 _ICL_PIPE_DSS_CTL2_PC) 7817 7818 #define GGC _MMIO(0x108040) 7819 #define GMS_MASK REG_GENMASK(15, 8) 7820 #define GGMS_MASK REG_GENMASK(7, 6) 7821 7822 #define GEN12_GSMBASE _MMIO(0x108100) 7823 #define GEN12_DSMBASE _MMIO(0x1080C0) 7824 #define GEN12_BDSM_MASK REG_GENMASK64(63, 20) 7825 7826 #define XEHP_CLOCK_GATE_DIS _MMIO(0x101014) 7827 #define SGSI_SIDECLK_DIS REG_BIT(17) 7828 #define SGGI_DIS REG_BIT(15) 7829 #define SGR_DIS REG_BIT(13) 7830 7831 #define _ICL_PHY_MISC_A 0x64C00 7832 #define _ICL_PHY_MISC_B 0x64C04 7833 #define _DG2_PHY_MISC_TC1 0x64C14 /* TC1="PHY E" but offset as if "PHY F" */ 7834 #define ICL_PHY_MISC(port) _MMIO_PORT(port, _ICL_PHY_MISC_A, _ICL_PHY_MISC_B) 7835 #define DG2_PHY_MISC(port) ((port) == PHY_E ? _MMIO(_DG2_PHY_MISC_TC1) : \ 7836 ICL_PHY_MISC(port)) 7837 #define ICL_PHY_MISC_MUX_DDID (1 << 28) 7838 #define ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN (1 << 23) 7839 #define DG2_PHY_DP_TX_ACK_MASK REG_GENMASK(23, 20) 7840 7841 /* Icelake Display Stream Compression Registers */ 7842 #define DSCA_PICTURE_PARAMETER_SET_0 _MMIO(0x6B200) 7843 #define DSCC_PICTURE_PARAMETER_SET_0 _MMIO(0x6BA00) 7844 #define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PB 0x78270 7845 #define _ICL_DSC1_PICTURE_PARAMETER_SET_0_PB 0x78370 7846 #define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PC 0x78470 7847 #define _ICL_DSC1_PICTURE_PARAMETER_SET_0_PC 0x78570 7848 #define ICL_DSC0_PICTURE_PARAMETER_SET_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7849 _ICL_DSC0_PICTURE_PARAMETER_SET_0_PB, \ 7850 _ICL_DSC0_PICTURE_PARAMETER_SET_0_PC) 7851 #define ICL_DSC1_PICTURE_PARAMETER_SET_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7852 _ICL_DSC1_PICTURE_PARAMETER_SET_0_PB, \ 7853 _ICL_DSC1_PICTURE_PARAMETER_SET_0_PC) 7854 #define DSC_ALT_ICH_SEL (1 << 20) 7855 #define DSC_VBR_ENABLE (1 << 19) 7856 #define DSC_422_ENABLE (1 << 18) 7857 #define DSC_COLOR_SPACE_CONVERSION (1 << 17) 7858 #define DSC_BLOCK_PREDICTION (1 << 16) 7859 #define DSC_LINE_BUF_DEPTH_SHIFT 12 7860 #define DSC_BPC_SHIFT 8 7861 #define DSC_VER_MIN_SHIFT 4 7862 #define DSC_VER_MAJ (0x1 << 0) 7863 7864 #define DSCA_PICTURE_PARAMETER_SET_1 _MMIO(0x6B204) 7865 #define DSCC_PICTURE_PARAMETER_SET_1 _MMIO(0x6BA04) 7866 #define _ICL_DSC0_PICTURE_PARAMETER_SET_1_PB 0x78274 7867 #define _ICL_DSC1_PICTURE_PARAMETER_SET_1_PB 0x78374 7868 #define _ICL_DSC0_PICTURE_PARAMETER_SET_1_PC 0x78474 7869 #define _ICL_DSC1_PICTURE_PARAMETER_SET_1_PC 0x78574 7870 #define ICL_DSC0_PICTURE_PARAMETER_SET_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7871 _ICL_DSC0_PICTURE_PARAMETER_SET_1_PB, \ 7872 _ICL_DSC0_PICTURE_PARAMETER_SET_1_PC) 7873 #define ICL_DSC1_PICTURE_PARAMETER_SET_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7874 _ICL_DSC1_PICTURE_PARAMETER_SET_1_PB, \ 7875 _ICL_DSC1_PICTURE_PARAMETER_SET_1_PC) 7876 #define DSC_BPP(bpp) ((bpp) << 0) 7877 7878 #define DSCA_PICTURE_PARAMETER_SET_2 _MMIO(0x6B208) 7879 #define DSCC_PICTURE_PARAMETER_SET_2 _MMIO(0x6BA08) 7880 #define _ICL_DSC0_PICTURE_PARAMETER_SET_2_PB 0x78278 7881 #define _ICL_DSC1_PICTURE_PARAMETER_SET_2_PB 0x78378 7882 #define _ICL_DSC0_PICTURE_PARAMETER_SET_2_PC 0x78478 7883 #define _ICL_DSC1_PICTURE_PARAMETER_SET_2_PC 0x78578 7884 #define ICL_DSC0_PICTURE_PARAMETER_SET_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7885 _ICL_DSC0_PICTURE_PARAMETER_SET_2_PB, \ 7886 _ICL_DSC0_PICTURE_PARAMETER_SET_2_PC) 7887 #define ICL_DSC1_PICTURE_PARAMETER_SET_2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7888 _ICL_DSC1_PICTURE_PARAMETER_SET_2_PB, \ 7889 _ICL_DSC1_PICTURE_PARAMETER_SET_2_PC) 7890 #define DSC_PIC_WIDTH(pic_width) ((pic_width) << 16) 7891 #define DSC_PIC_HEIGHT(pic_height) ((pic_height) << 0) 7892 7893 #define DSCA_PICTURE_PARAMETER_SET_3 _MMIO(0x6B20C) 7894 #define DSCC_PICTURE_PARAMETER_SET_3 _MMIO(0x6BA0C) 7895 #define _ICL_DSC0_PICTURE_PARAMETER_SET_3_PB 0x7827C 7896 #define _ICL_DSC1_PICTURE_PARAMETER_SET_3_PB 0x7837C 7897 #define _ICL_DSC0_PICTURE_PARAMETER_SET_3_PC 0x7847C 7898 #define _ICL_DSC1_PICTURE_PARAMETER_SET_3_PC 0x7857C 7899 #define ICL_DSC0_PICTURE_PARAMETER_SET_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7900 _ICL_DSC0_PICTURE_PARAMETER_SET_3_PB, \ 7901 _ICL_DSC0_PICTURE_PARAMETER_SET_3_PC) 7902 #define ICL_DSC1_PICTURE_PARAMETER_SET_3(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7903 _ICL_DSC1_PICTURE_PARAMETER_SET_3_PB, \ 7904 _ICL_DSC1_PICTURE_PARAMETER_SET_3_PC) 7905 #define DSC_SLICE_WIDTH(slice_width) ((slice_width) << 16) 7906 #define DSC_SLICE_HEIGHT(slice_height) ((slice_height) << 0) 7907 7908 #define DSCA_PICTURE_PARAMETER_SET_4 _MMIO(0x6B210) 7909 #define DSCC_PICTURE_PARAMETER_SET_4 _MMIO(0x6BA10) 7910 #define _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB 0x78280 7911 #define _ICL_DSC1_PICTURE_PARAMETER_SET_4_PB 0x78380 7912 #define _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC 0x78480 7913 #define _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC 0x78580 7914 #define ICL_DSC0_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7915 _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \ 7916 _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC) 7917 #define ICL_DSC1_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7918 _ICL_DSC1_PICTURE_PARAMETER_SET_4_PB, \ 7919 _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC) 7920 #define DSC_INITIAL_DEC_DELAY(dec_delay) ((dec_delay) << 16) 7921 #define DSC_INITIAL_XMIT_DELAY(xmit_delay) ((xmit_delay) << 0) 7922 7923 #define DSCA_PICTURE_PARAMETER_SET_5 _MMIO(0x6B214) 7924 #define DSCC_PICTURE_PARAMETER_SET_5 _MMIO(0x6BA14) 7925 #define _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB 0x78284 7926 #define _ICL_DSC1_PICTURE_PARAMETER_SET_5_PB 0x78384 7927 #define _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC 0x78484 7928 #define _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC 0x78584 7929 #define ICL_DSC0_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7930 _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB, \ 7931 _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC) 7932 #define ICL_DSC1_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7933 _ICL_DSC1_PICTURE_PARAMETER_SET_5_PB, \ 7934 _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC) 7935 #define DSC_SCALE_DEC_INT(scale_dec) ((scale_dec) << 16) 7936 #define DSC_SCALE_INC_INT(scale_inc) ((scale_inc) << 0) 7937 7938 #define DSCA_PICTURE_PARAMETER_SET_6 _MMIO(0x6B218) 7939 #define DSCC_PICTURE_PARAMETER_SET_6 _MMIO(0x6BA18) 7940 #define _ICL_DSC0_PICTURE_PARAMETER_SET_6_PB 0x78288 7941 #define _ICL_DSC1_PICTURE_PARAMETER_SET_6_PB 0x78388 7942 #define _ICL_DSC0_PICTURE_PARAMETER_SET_6_PC 0x78488 7943 #define _ICL_DSC1_PICTURE_PARAMETER_SET_6_PC 0x78588 7944 #define ICL_DSC0_PICTURE_PARAMETER_SET_6(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7945 _ICL_DSC0_PICTURE_PARAMETER_SET_6_PB, \ 7946 _ICL_DSC0_PICTURE_PARAMETER_SET_6_PC) 7947 #define ICL_DSC1_PICTURE_PARAMETER_SET_6(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7948 _ICL_DSC1_PICTURE_PARAMETER_SET_6_PB, \ 7949 _ICL_DSC1_PICTURE_PARAMETER_SET_6_PC) 7950 #define DSC_FLATNESS_MAX_QP(max_qp) ((max_qp) << 24) 7951 #define DSC_FLATNESS_MIN_QP(min_qp) ((min_qp) << 16) 7952 #define DSC_FIRST_LINE_BPG_OFFSET(offset) ((offset) << 8) 7953 #define DSC_INITIAL_SCALE_VALUE(value) ((value) << 0) 7954 7955 #define DSCA_PICTURE_PARAMETER_SET_7 _MMIO(0x6B21C) 7956 #define DSCC_PICTURE_PARAMETER_SET_7 _MMIO(0x6BA1C) 7957 #define _ICL_DSC0_PICTURE_PARAMETER_SET_7_PB 0x7828C 7958 #define _ICL_DSC1_PICTURE_PARAMETER_SET_7_PB 0x7838C 7959 #define _ICL_DSC0_PICTURE_PARAMETER_SET_7_PC 0x7848C 7960 #define _ICL_DSC1_PICTURE_PARAMETER_SET_7_PC 0x7858C 7961 #define ICL_DSC0_PICTURE_PARAMETER_SET_7(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7962 _ICL_DSC0_PICTURE_PARAMETER_SET_7_PB, \ 7963 _ICL_DSC0_PICTURE_PARAMETER_SET_7_PC) 7964 #define ICL_DSC1_PICTURE_PARAMETER_SET_7(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7965 _ICL_DSC1_PICTURE_PARAMETER_SET_7_PB, \ 7966 _ICL_DSC1_PICTURE_PARAMETER_SET_7_PC) 7967 #define DSC_NFL_BPG_OFFSET(bpg_offset) ((bpg_offset) << 16) 7968 #define DSC_SLICE_BPG_OFFSET(bpg_offset) ((bpg_offset) << 0) 7969 7970 #define DSCA_PICTURE_PARAMETER_SET_8 _MMIO(0x6B220) 7971 #define DSCC_PICTURE_PARAMETER_SET_8 _MMIO(0x6BA20) 7972 #define _ICL_DSC0_PICTURE_PARAMETER_SET_8_PB 0x78290 7973 #define _ICL_DSC1_PICTURE_PARAMETER_SET_8_PB 0x78390 7974 #define _ICL_DSC0_PICTURE_PARAMETER_SET_8_PC 0x78490 7975 #define _ICL_DSC1_PICTURE_PARAMETER_SET_8_PC 0x78590 7976 #define ICL_DSC0_PICTURE_PARAMETER_SET_8(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7977 _ICL_DSC0_PICTURE_PARAMETER_SET_8_PB, \ 7978 _ICL_DSC0_PICTURE_PARAMETER_SET_8_PC) 7979 #define ICL_DSC1_PICTURE_PARAMETER_SET_8(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7980 _ICL_DSC1_PICTURE_PARAMETER_SET_8_PB, \ 7981 _ICL_DSC1_PICTURE_PARAMETER_SET_8_PC) 7982 #define DSC_INITIAL_OFFSET(initial_offset) ((initial_offset) << 16) 7983 #define DSC_FINAL_OFFSET(final_offset) ((final_offset) << 0) 7984 7985 #define DSCA_PICTURE_PARAMETER_SET_9 _MMIO(0x6B224) 7986 #define DSCC_PICTURE_PARAMETER_SET_9 _MMIO(0x6BA24) 7987 #define _ICL_DSC0_PICTURE_PARAMETER_SET_9_PB 0x78294 7988 #define _ICL_DSC1_PICTURE_PARAMETER_SET_9_PB 0x78394 7989 #define _ICL_DSC0_PICTURE_PARAMETER_SET_9_PC 0x78494 7990 #define _ICL_DSC1_PICTURE_PARAMETER_SET_9_PC 0x78594 7991 #define ICL_DSC0_PICTURE_PARAMETER_SET_9(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7992 _ICL_DSC0_PICTURE_PARAMETER_SET_9_PB, \ 7993 _ICL_DSC0_PICTURE_PARAMETER_SET_9_PC) 7994 #define ICL_DSC1_PICTURE_PARAMETER_SET_9(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 7995 _ICL_DSC1_PICTURE_PARAMETER_SET_9_PB, \ 7996 _ICL_DSC1_PICTURE_PARAMETER_SET_9_PC) 7997 #define DSC_RC_EDGE_FACTOR(rc_edge_fact) ((rc_edge_fact) << 16) 7998 #define DSC_RC_MODEL_SIZE(rc_model_size) ((rc_model_size) << 0) 7999 8000 #define DSCA_PICTURE_PARAMETER_SET_10 _MMIO(0x6B228) 8001 #define DSCC_PICTURE_PARAMETER_SET_10 _MMIO(0x6BA28) 8002 #define _ICL_DSC0_PICTURE_PARAMETER_SET_10_PB 0x78298 8003 #define _ICL_DSC1_PICTURE_PARAMETER_SET_10_PB 0x78398 8004 #define _ICL_DSC0_PICTURE_PARAMETER_SET_10_PC 0x78498 8005 #define _ICL_DSC1_PICTURE_PARAMETER_SET_10_PC 0x78598 8006 #define ICL_DSC0_PICTURE_PARAMETER_SET_10(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8007 _ICL_DSC0_PICTURE_PARAMETER_SET_10_PB, \ 8008 _ICL_DSC0_PICTURE_PARAMETER_SET_10_PC) 8009 #define ICL_DSC1_PICTURE_PARAMETER_SET_10(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8010 _ICL_DSC1_PICTURE_PARAMETER_SET_10_PB, \ 8011 _ICL_DSC1_PICTURE_PARAMETER_SET_10_PC) 8012 #define DSC_RC_TARGET_OFF_LOW(rc_tgt_off_low) ((rc_tgt_off_low) << 20) 8013 #define DSC_RC_TARGET_OFF_HIGH(rc_tgt_off_high) ((rc_tgt_off_high) << 16) 8014 #define DSC_RC_QUANT_INC_LIMIT1(lim) ((lim) << 8) 8015 #define DSC_RC_QUANT_INC_LIMIT0(lim) ((lim) << 0) 8016 8017 #define DSCA_PICTURE_PARAMETER_SET_11 _MMIO(0x6B22C) 8018 #define DSCC_PICTURE_PARAMETER_SET_11 _MMIO(0x6BA2C) 8019 #define _ICL_DSC0_PICTURE_PARAMETER_SET_11_PB 0x7829C 8020 #define _ICL_DSC1_PICTURE_PARAMETER_SET_11_PB 0x7839C 8021 #define _ICL_DSC0_PICTURE_PARAMETER_SET_11_PC 0x7849C 8022 #define _ICL_DSC1_PICTURE_PARAMETER_SET_11_PC 0x7859C 8023 #define ICL_DSC0_PICTURE_PARAMETER_SET_11(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8024 _ICL_DSC0_PICTURE_PARAMETER_SET_11_PB, \ 8025 _ICL_DSC0_PICTURE_PARAMETER_SET_11_PC) 8026 #define ICL_DSC1_PICTURE_PARAMETER_SET_11(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8027 _ICL_DSC1_PICTURE_PARAMETER_SET_11_PB, \ 8028 _ICL_DSC1_PICTURE_PARAMETER_SET_11_PC) 8029 8030 #define DSCA_PICTURE_PARAMETER_SET_12 _MMIO(0x6B260) 8031 #define DSCC_PICTURE_PARAMETER_SET_12 _MMIO(0x6BA60) 8032 #define _ICL_DSC0_PICTURE_PARAMETER_SET_12_PB 0x782A0 8033 #define _ICL_DSC1_PICTURE_PARAMETER_SET_12_PB 0x783A0 8034 #define _ICL_DSC0_PICTURE_PARAMETER_SET_12_PC 0x784A0 8035 #define _ICL_DSC1_PICTURE_PARAMETER_SET_12_PC 0x785A0 8036 #define ICL_DSC0_PICTURE_PARAMETER_SET_12(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8037 _ICL_DSC0_PICTURE_PARAMETER_SET_12_PB, \ 8038 _ICL_DSC0_PICTURE_PARAMETER_SET_12_PC) 8039 #define ICL_DSC1_PICTURE_PARAMETER_SET_12(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8040 _ICL_DSC1_PICTURE_PARAMETER_SET_12_PB, \ 8041 _ICL_DSC1_PICTURE_PARAMETER_SET_12_PC) 8042 8043 #define DSCA_PICTURE_PARAMETER_SET_13 _MMIO(0x6B264) 8044 #define DSCC_PICTURE_PARAMETER_SET_13 _MMIO(0x6BA64) 8045 #define _ICL_DSC0_PICTURE_PARAMETER_SET_13_PB 0x782A4 8046 #define _ICL_DSC1_PICTURE_PARAMETER_SET_13_PB 0x783A4 8047 #define _ICL_DSC0_PICTURE_PARAMETER_SET_13_PC 0x784A4 8048 #define _ICL_DSC1_PICTURE_PARAMETER_SET_13_PC 0x785A4 8049 #define ICL_DSC0_PICTURE_PARAMETER_SET_13(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8050 _ICL_DSC0_PICTURE_PARAMETER_SET_13_PB, \ 8051 _ICL_DSC0_PICTURE_PARAMETER_SET_13_PC) 8052 #define ICL_DSC1_PICTURE_PARAMETER_SET_13(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8053 _ICL_DSC1_PICTURE_PARAMETER_SET_13_PB, \ 8054 _ICL_DSC1_PICTURE_PARAMETER_SET_13_PC) 8055 8056 #define DSCA_PICTURE_PARAMETER_SET_14 _MMIO(0x6B268) 8057 #define DSCC_PICTURE_PARAMETER_SET_14 _MMIO(0x6BA68) 8058 #define _ICL_DSC0_PICTURE_PARAMETER_SET_14_PB 0x782A8 8059 #define _ICL_DSC1_PICTURE_PARAMETER_SET_14_PB 0x783A8 8060 #define _ICL_DSC0_PICTURE_PARAMETER_SET_14_PC 0x784A8 8061 #define _ICL_DSC1_PICTURE_PARAMETER_SET_14_PC 0x785A8 8062 #define ICL_DSC0_PICTURE_PARAMETER_SET_14(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8063 _ICL_DSC0_PICTURE_PARAMETER_SET_14_PB, \ 8064 _ICL_DSC0_PICTURE_PARAMETER_SET_14_PC) 8065 #define ICL_DSC1_PICTURE_PARAMETER_SET_14(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8066 _ICL_DSC1_PICTURE_PARAMETER_SET_14_PB, \ 8067 _ICL_DSC1_PICTURE_PARAMETER_SET_14_PC) 8068 8069 #define DSCA_PICTURE_PARAMETER_SET_15 _MMIO(0x6B26C) 8070 #define DSCC_PICTURE_PARAMETER_SET_15 _MMIO(0x6BA6C) 8071 #define _ICL_DSC0_PICTURE_PARAMETER_SET_15_PB 0x782AC 8072 #define _ICL_DSC1_PICTURE_PARAMETER_SET_15_PB 0x783AC 8073 #define _ICL_DSC0_PICTURE_PARAMETER_SET_15_PC 0x784AC 8074 #define _ICL_DSC1_PICTURE_PARAMETER_SET_15_PC 0x785AC 8075 #define ICL_DSC0_PICTURE_PARAMETER_SET_15(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8076 _ICL_DSC0_PICTURE_PARAMETER_SET_15_PB, \ 8077 _ICL_DSC0_PICTURE_PARAMETER_SET_15_PC) 8078 #define ICL_DSC1_PICTURE_PARAMETER_SET_15(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8079 _ICL_DSC1_PICTURE_PARAMETER_SET_15_PB, \ 8080 _ICL_DSC1_PICTURE_PARAMETER_SET_15_PC) 8081 8082 #define DSCA_PICTURE_PARAMETER_SET_16 _MMIO(0x6B270) 8083 #define DSCC_PICTURE_PARAMETER_SET_16 _MMIO(0x6BA70) 8084 #define _ICL_DSC0_PICTURE_PARAMETER_SET_16_PB 0x782B0 8085 #define _ICL_DSC1_PICTURE_PARAMETER_SET_16_PB 0x783B0 8086 #define _ICL_DSC0_PICTURE_PARAMETER_SET_16_PC 0x784B0 8087 #define _ICL_DSC1_PICTURE_PARAMETER_SET_16_PC 0x785B0 8088 #define ICL_DSC0_PICTURE_PARAMETER_SET_16(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8089 _ICL_DSC0_PICTURE_PARAMETER_SET_16_PB, \ 8090 _ICL_DSC0_PICTURE_PARAMETER_SET_16_PC) 8091 #define ICL_DSC1_PICTURE_PARAMETER_SET_16(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8092 _ICL_DSC1_PICTURE_PARAMETER_SET_16_PB, \ 8093 _ICL_DSC1_PICTURE_PARAMETER_SET_16_PC) 8094 #define DSC_SLICE_ROW_PER_FRAME(slice_row_per_frame) ((slice_row_per_frame) << 20) 8095 #define DSC_SLICE_PER_LINE(slice_per_line) ((slice_per_line) << 16) 8096 #define DSC_SLICE_CHUNK_SIZE(slice_chunk_size) ((slice_chunk_size) << 0) 8097 8098 /* Icelake Rate Control Buffer Threshold Registers */ 8099 #define DSCA_RC_BUF_THRESH_0 _MMIO(0x6B230) 8100 #define DSCA_RC_BUF_THRESH_0_UDW _MMIO(0x6B230 + 4) 8101 #define DSCC_RC_BUF_THRESH_0 _MMIO(0x6BA30) 8102 #define DSCC_RC_BUF_THRESH_0_UDW _MMIO(0x6BA30 + 4) 8103 #define _ICL_DSC0_RC_BUF_THRESH_0_PB (0x78254) 8104 #define _ICL_DSC0_RC_BUF_THRESH_0_UDW_PB (0x78254 + 4) 8105 #define _ICL_DSC1_RC_BUF_THRESH_0_PB (0x78354) 8106 #define _ICL_DSC1_RC_BUF_THRESH_0_UDW_PB (0x78354 + 4) 8107 #define _ICL_DSC0_RC_BUF_THRESH_0_PC (0x78454) 8108 #define _ICL_DSC0_RC_BUF_THRESH_0_UDW_PC (0x78454 + 4) 8109 #define _ICL_DSC1_RC_BUF_THRESH_0_PC (0x78554) 8110 #define _ICL_DSC1_RC_BUF_THRESH_0_UDW_PC (0x78554 + 4) 8111 #define ICL_DSC0_RC_BUF_THRESH_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8112 _ICL_DSC0_RC_BUF_THRESH_0_PB, \ 8113 _ICL_DSC0_RC_BUF_THRESH_0_PC) 8114 #define ICL_DSC0_RC_BUF_THRESH_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8115 _ICL_DSC0_RC_BUF_THRESH_0_UDW_PB, \ 8116 _ICL_DSC0_RC_BUF_THRESH_0_UDW_PC) 8117 #define ICL_DSC1_RC_BUF_THRESH_0(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8118 _ICL_DSC1_RC_BUF_THRESH_0_PB, \ 8119 _ICL_DSC1_RC_BUF_THRESH_0_PC) 8120 #define ICL_DSC1_RC_BUF_THRESH_0_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8121 _ICL_DSC1_RC_BUF_THRESH_0_UDW_PB, \ 8122 _ICL_DSC1_RC_BUF_THRESH_0_UDW_PC) 8123 8124 #define DSCA_RC_BUF_THRESH_1 _MMIO(0x6B238) 8125 #define DSCA_RC_BUF_THRESH_1_UDW _MMIO(0x6B238 + 4) 8126 #define DSCC_RC_BUF_THRESH_1 _MMIO(0x6BA38) 8127 #define DSCC_RC_BUF_THRESH_1_UDW _MMIO(0x6BA38 + 4) 8128 #define _ICL_DSC0_RC_BUF_THRESH_1_PB (0x7825C) 8129 #define _ICL_DSC0_RC_BUF_THRESH_1_UDW_PB (0x7825C + 4) 8130 #define _ICL_DSC1_RC_BUF_THRESH_1_PB (0x7835C) 8131 #define _ICL_DSC1_RC_BUF_THRESH_1_UDW_PB (0x7835C + 4) 8132 #define _ICL_DSC0_RC_BUF_THRESH_1_PC (0x7845C) 8133 #define _ICL_DSC0_RC_BUF_THRESH_1_UDW_PC (0x7845C + 4) 8134 #define _ICL_DSC1_RC_BUF_THRESH_1_PC (0x7855C) 8135 #define _ICL_DSC1_RC_BUF_THRESH_1_UDW_PC (0x7855C + 4) 8136 #define ICL_DSC0_RC_BUF_THRESH_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8137 _ICL_DSC0_RC_BUF_THRESH_1_PB, \ 8138 _ICL_DSC0_RC_BUF_THRESH_1_PC) 8139 #define ICL_DSC0_RC_BUF_THRESH_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8140 _ICL_DSC0_RC_BUF_THRESH_1_UDW_PB, \ 8141 _ICL_DSC0_RC_BUF_THRESH_1_UDW_PC) 8142 #define ICL_DSC1_RC_BUF_THRESH_1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8143 _ICL_DSC1_RC_BUF_THRESH_1_PB, \ 8144 _ICL_DSC1_RC_BUF_THRESH_1_PC) 8145 #define ICL_DSC1_RC_BUF_THRESH_1_UDW(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ 8146 _ICL_DSC1_RC_BUF_THRESH_1_UDW_PB, \ 8147 _ICL_DSC1_RC_BUF_THRESH_1_UDW_PC) 8148 8149 #define PORT_TX_DFLEXDPSP(fia) _MMIO_FIA((fia), 0x008A0) 8150 #define MODULAR_FIA_MASK (1 << 4) 8151 #define TC_LIVE_STATE_TBT(idx) (1 << ((idx) * 8 + 6)) 8152 #define TC_LIVE_STATE_TC(idx) (1 << ((idx) * 8 + 5)) 8153 #define DP_LANE_ASSIGNMENT_SHIFT(idx) ((idx) * 8) 8154 #define DP_LANE_ASSIGNMENT_MASK(idx) (0xf << ((idx) * 8)) 8155 #define DP_LANE_ASSIGNMENT(idx, x) ((x) << ((idx) * 8)) 8156 8157 #define PORT_TX_DFLEXDPPMS(fia) _MMIO_FIA((fia), 0x00890) 8158 #define DP_PHY_MODE_STATUS_COMPLETED(idx) (1 << (idx)) 8159 8160 #define PORT_TX_DFLEXDPCSSS(fia) _MMIO_FIA((fia), 0x00894) 8161 #define DP_PHY_MODE_STATUS_NOT_SAFE(idx) (1 << (idx)) 8162 8163 #define PORT_TX_DFLEXPA1(fia) _MMIO_FIA((fia), 0x00880) 8164 #define DP_PIN_ASSIGNMENT_SHIFT(idx) ((idx) * 4) 8165 #define DP_PIN_ASSIGNMENT_MASK(idx) (0xf << ((idx) * 4)) 8166 #define DP_PIN_ASSIGNMENT(idx, x) ((x) << ((idx) * 4)) 8167 8168 #define _TCSS_DDI_STATUS_1 0x161500 8169 #define _TCSS_DDI_STATUS_2 0x161504 8170 #define TCSS_DDI_STATUS(tc) _MMIO(_PICK_EVEN(tc, \ 8171 _TCSS_DDI_STATUS_1, \ 8172 _TCSS_DDI_STATUS_2)) 8173 #define TCSS_DDI_STATUS_READY REG_BIT(2) 8174 #define TCSS_DDI_STATUS_HPD_LIVE_STATUS_TBT REG_BIT(1) 8175 #define TCSS_DDI_STATUS_HPD_LIVE_STATUS_ALT REG_BIT(0) 8176 8177 #define PRIMARY_SPI_TRIGGER _MMIO(0x102040) 8178 #define PRIMARY_SPI_ADDRESS _MMIO(0x102080) 8179 #define PRIMARY_SPI_REGIONID _MMIO(0x102084) 8180 #define SPI_STATIC_REGIONS _MMIO(0x102090) 8181 #define OPTIONROM_SPI_REGIONID_MASK REG_GENMASK(7, 0) 8182 #define OROM_OFFSET _MMIO(0x1020c0) 8183 #define OROM_OFFSET_MASK REG_GENMASK(20, 16) 8184 8185 /* This register controls the Display State Buffer (DSB) engines. */ 8186 #define _DSBSL_INSTANCE_BASE 0x70B00 8187 #define DSBSL_INSTANCE(pipe, id) (_DSBSL_INSTANCE_BASE + \ 8188 (pipe) * 0x1000 + (id) * 0x100) 8189 #define DSB_HEAD(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x0) 8190 #define DSB_TAIL(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x4) 8191 #define DSB_CTRL(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x8) 8192 #define DSB_ENABLE (1 << 31) 8193 #define DSB_STATUS (1 << 0) 8194 8195 #define CLKREQ_POLICY _MMIO(0x101038) 8196 #define CLKREQ_POLICY_MEM_UP_OVRD REG_BIT(1) 8197 8198 #define CLKGATE_DIS_MISC _MMIO(0x46534) 8199 #define CLKGATE_DIS_MISC_DMASC_GATING_DIS REG_BIT(21) 8200 8201 #define GEN12_CULLBIT1 _MMIO(0x6100) 8202 #define GEN12_CULLBIT2 _MMIO(0x7030) 8203 #define GEN12_STATE_ACK_DEBUG _MMIO(0x20BC) 8204 8205 #define _MTL_CLKGATE_DIS_TRANS_A 0x604E8 8206 #define _MTL_CLKGATE_DIS_TRANS_B 0x614E8 8207 #define MTL_CLKGATE_DIS_TRANS(trans) _MMIO_TRANS2(trans, _MTL_CLKGATE_DIS_TRANS_A) 8208 #define MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS REG_BIT(7) 8209 8210 #define MTL_LATENCY_LP0_LP1 _MMIO(0x45780) 8211 #define MTL_LATENCY_LP2_LP3 _MMIO(0x45784) 8212 #define MTL_LATENCY_LP4_LP5 _MMIO(0x45788) 8213 #define MTL_LATENCY_LEVEL_EVEN_MASK REG_GENMASK(12, 0) 8214 #define MTL_LATENCY_LEVEL_ODD_MASK REG_GENMASK(28, 16) 8215 8216 #define MTL_LATENCY_SAGV _MMIO(0x4578b) 8217 #define MTL_LATENCY_QCLK_SAGV REG_GENMASK(12, 0) 8218 8219 #define MTL_MEM_SS_INFO_GLOBAL _MMIO(0x45700) 8220 #define MTL_N_OF_ENABLED_QGV_POINTS_MASK REG_GENMASK(11, 8) 8221 #define MTL_N_OF_POPULATED_CH_MASK REG_GENMASK(7, 4) 8222 #define MTL_DDR_TYPE_MASK REG_GENMASK(3, 0) 8223 8224 #define MTL_MEM_SS_INFO_QGV_POINT_LOW(point) _MMIO(0x45710 + (point) * 2) 8225 #define MTL_TRCD_MASK REG_GENMASK(31, 24) 8226 #define MTL_TRP_MASK REG_GENMASK(23, 16) 8227 #define MTL_DCLK_MASK REG_GENMASK(15, 0) 8228 8229 #define MTL_MEM_SS_INFO_QGV_POINT_HIGH(point) _MMIO(0x45714 + (point) * 2) 8230 #define MTL_TRAS_MASK REG_GENMASK(16, 8) 8231 #define MTL_TRDPRE_MASK REG_GENMASK(7, 0) 8232 8233 #define MTL_MEDIA_GSI_BASE 0x380000 8234 8235 #endif /* _I915_REG_H_ */ 8236