62e0f075b1de7fa88637a6e055b0b3495bb29ed8
[platform/kernel/linux-starfive.git] / drivers / gpu / drm / i915 / gt / intel_gt_regs.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5
6 #ifndef __INTEL_GT_REGS__
7 #define __INTEL_GT_REGS__
8
9 #include "i915_reg_defs.h"
10
11 /* RPM unit config (Gen8+) */
12 #define RPM_CONFIG0                             _MMIO(0xd00)
13 #define   GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT     3
14 #define   GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK      (1 << GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
15 #define   GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ  0
16 #define   GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ    1
17 #define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT    3
18 #define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK     (0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
19 #define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ   0
20 #define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 1
21 #define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ 2
22 #define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ   3
23 #define   GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT   1
24 #define   GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK    (0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT)
25
26 #define RPM_CONFIG1                             _MMIO(0xd04)
27 #define   GEN10_GT_NOA_ENABLE                   (1 << 9)
28
29 /* RCP unit config (Gen8+) */
30 #define RCP_CONFIG                              _MMIO(0xd08)
31
32 #define RC6_LOCATION                            _MMIO(0xd40)
33 #define   RC6_CTX_IN_DRAM                       (1 << 0)
34 #define RC6_CTX_BASE                            _MMIO(0xd48)
35 #define   RC6_CTX_BASE_MASK                     0xFFFFFFF0
36
37 #define FORCEWAKE_ACK_MEDIA_VDBOX_GEN11(n)      _MMIO(0xd50 + (n) * 4)
38 #define FORCEWAKE_ACK_MEDIA_VEBOX_GEN11(n)      _MMIO(0xd70 + (n) * 4)
39 #define FORCEWAKE_ACK_RENDER_GEN9               _MMIO(0xd84)
40 #define FORCEWAKE_ACK_MEDIA_GEN9                _MMIO(0xd88)
41
42 #define MCFG_MCR_SELECTOR                       _MMIO(0xfd0)
43 #define SF_MCR_SELECTOR                         _MMIO(0xfd8)
44 #define GEN8_MCR_SELECTOR                       _MMIO(0xfdc)
45 #define   GEN8_MCR_SLICE(slice)                 (((slice) & 3) << 26)
46 #define   GEN8_MCR_SLICE_MASK                   GEN8_MCR_SLICE(3)
47 #define   GEN8_MCR_SUBSLICE(subslice)           (((subslice) & 3) << 24)
48 #define   GEN8_MCR_SUBSLICE_MASK                GEN8_MCR_SUBSLICE(3)
49 #define   GEN11_MCR_MULTICAST                   REG_BIT(31)
50 #define   GEN11_MCR_SLICE(slice)                (((slice) & 0xf) << 27)
51 #define   GEN11_MCR_SLICE_MASK                  GEN11_MCR_SLICE(0xf)
52 #define   GEN11_MCR_SUBSLICE(subslice)          (((subslice) & 0x7) << 24)
53 #define   GEN11_MCR_SUBSLICE_MASK               GEN11_MCR_SUBSLICE(0x7)
54
55 #define IPEIR_I965                              _MMIO(0x2064)
56 #define IPEHR_I965                              _MMIO(0x2068)
57
58 /*
59  * On GEN4, only the render ring INSTDONE exists and has a different
60  * layout than the GEN7+ version.
61  * The GEN2 counterpart of this register is GEN2_INSTDONE.
62  */
63 #define INSTPS                                  _MMIO(0x2070) /* 965+ only */
64 #define GEN4_INSTDONE1                          _MMIO(0x207c) /* 965+ only, aka INSTDONE_2 on SNB */
65 #define ACTHD_I965                              _MMIO(0x2074)
66 #define HWS_PGA                                 _MMIO(0x2080)
67 #define   HWS_ADDRESS_MASK                      0xfffff000
68 #define   HWS_START_ADDRESS_SHIFT               4
69
70 #define _3D_CHICKEN                             _MMIO(0x2084)
71 #define   _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB     (1 << 10)
72
73 #define PWRCTXA                                 _MMIO(0x2088) /* 965GM+ only */
74 #define   PWRCTX_EN                             (1 << 0)
75
76 #define FF_SLICE_CHICKEN                        _MMIO(0x2088)
77 #define   FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX      (1 << 1)
78
79 /* GM45+ chicken bits -- debug workaround bits that may be required
80  * for various sorts of correct behavior.  The top 16 bits of each are
81  * the enables for writing to the corresponding low bit.
82  */
83 #define _3D_CHICKEN2                            _MMIO(0x208c)
84 /* Disables pipelining of read flushes past the SF-WIZ interface.
85  * Required on all Ironlake steppings according to the B-Spec, but the
86  * particular danger of not doing so is not specified.
87  */
88 #define   _3D_CHICKEN2_WM_READ_PIPELINED        (1 << 14)
89
90 #define _3D_CHICKEN3                            _MMIO(0x2090)
91 #define   _3D_CHICKEN_SF_PROVOKING_VERTEX_FIX   (1 << 12)
92 #define   _3D_CHICKEN_SF_DISABLE_OBJEND_CULL    (1 << 10)
93 #define   _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE       (1 << 5)
94 #define   _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5)
95 #define   _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x)      ((x) << 1) /* gen8+ */
96 #define   _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH  (1 << 1) /* gen6 */
97
98 #define GEN2_INSTDONE                           _MMIO(0x2090)
99 #define NOPID                                   _MMIO(0x2094)
100 #define HWSTAM                                  _MMIO(0x2098)
101
102 #define WAIT_FOR_RC6_EXIT                       _MMIO(0x20cc)
103 /* HSW only */
104 #define   HSW_SELECTIVE_READ_ADDRESSING_SHIFT   2
105 #define   HSW_SELECTIVE_READ_ADDRESSING_MASK    (0x3 << HSW_SLECTIVE_READ_ADDRESSING_SHIFT)
106 #define   HSW_SELECTIVE_WRITE_ADDRESS_SHIFT     4
107 #define   HSW_SELECTIVE_WRITE_ADDRESS_MASK      (0x7 << HSW_SELECTIVE_WRITE_ADDRESS_SHIFT)
108 /* HSW+ */
109 #define   HSW_WAIT_FOR_RC6_EXIT_ENABLE          (1 << 0)
110 #define   HSW_RCS_CONTEXT_ENABLE                (1 << 7)
111 #define   HSW_RCS_INHIBIT                       (1 << 8)
112 /* Gen8 */
113 #define   GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT    4
114 #define   GEN8_SELECTIVE_WRITE_ADDRESS_MASK     (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
115 #define   GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT    4
116 #define   GEN8_SELECTIVE_WRITE_ADDRESS_MASK     (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
117 #define   GEN8_SELECTIVE_WRITE_ADDRESSING_ENABLE        (1 << 6)
118 #define   GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT     9
119 #define   GEN8_SELECTIVE_READ_SUBSLICE_SELECT_MASK      (0x3 << GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT)
120 #define   GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT        11
121 #define   GEN8_SELECTIVE_READ_SLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT)
122 #define   GEN8_SELECTIVE_READ_ADDRESSING_ENABLE (1 << 13)
123
124 #define GEN6_GT_MODE                            _MMIO(0x20d0)
125 #define   GEN6_WIZ_HASHING(hi, lo)              (((hi) << 9) | ((lo) << 7))
126 #define   GEN6_WIZ_HASHING_8x8                  GEN6_WIZ_HASHING(0, 0)
127 #define   GEN6_WIZ_HASHING_8x4                  GEN6_WIZ_HASHING(0, 1)
128 #define   GEN6_WIZ_HASHING_16x4                 GEN6_WIZ_HASHING(1, 0)
129 #define   GEN6_WIZ_HASHING_MASK                 GEN6_WIZ_HASHING(1, 1)
130 #define   GEN6_TD_FOUR_ROW_DISPATCH_DISABLE     (1 << 5)
131
132 /* chicken reg for WaConextSwitchWithConcurrentTLBInvalidate */
133 #define GEN9_CSFE_CHICKEN1_RCS                  _MMIO(0x20d4)
134 #define   GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE        (1 << 2)
135 #define   GEN11_ENABLE_32_PLANE_MODE            (1 << 7)
136
137 #define GEN7_FF_SLICE_CS_CHICKEN1               _MMIO(0x20e0)
138 #define   GEN9_FFSC_PERCTX_PREEMPT_CTRL         (1 << 14)
139
140 #define FF_SLICE_CS_CHICKEN2                    _MMIO(0x20e4)
141 #define   GEN9_TSG_BARRIER_ACK_DISABLE          (1 << 8)
142 #define   GEN9_POOLED_EU_LOAD_BALANCING_FIX_DISABLE     (1 << 10)
143
144 #define GEN9_CS_DEBUG_MODE1                     _MMIO(0x20ec)
145 #define   FF_DOP_CLOCK_GATE_DISABLE             REG_BIT(1)
146 #define GEN12_CS_DEBUG_MODE1_CCCSUNIT_BE_COMMON _MMIO(0x20ec)
147 #define   GEN12_REPLAY_MODE_GRANULARITY         REG_BIT(0)
148
149 /* WaClearTdlStateAckDirtyBits */
150 #define GEN8_STATE_ACK                          _MMIO(0x20f0)
151 #define GEN9_STATE_ACK_SLICE1                   _MMIO(0x20f8)
152 #define GEN9_STATE_ACK_SLICE2                   _MMIO(0x2100)
153 #define   GEN9_STATE_ACK_TDL0                   (1 << 12)
154 #define   GEN9_STATE_ACK_TDL1                   (1 << 13)
155 #define   GEN9_STATE_ACK_TDL2                   (1 << 14)
156 #define   GEN9_STATE_ACK_TDL3                   (1 << 15)
157 #define   GEN9_SUBSLICE_TDL_ACK_BITS    \
158         (GEN9_STATE_ACK_TDL3 | GEN9_STATE_ACK_TDL2 | \
159          GEN9_STATE_ACK_TDL1 | GEN9_STATE_ACK_TDL0)
160
161 #define CACHE_MODE_0                            _MMIO(0x2120) /* 915+ only */
162 #define   CM0_PIPELINED_RENDER_FLUSH_DISABLE    (1 << 8)
163 #define   CM0_IZ_OPT_DISABLE                    (1 << 6)
164 #define   CM0_ZR_OPT_DISABLE                    (1 << 5)
165 #define   CM0_STC_EVICT_DISABLE_LRA_SNB         (1 << 5)
166 #define   CM0_DEPTH_EVICT_DISABLE               (1 << 4)
167 #define   CM0_COLOR_EVICT_DISABLE               (1 << 3)
168 #define   CM0_DEPTH_WRITE_DISABLE               (1 << 1)
169 #define   CM0_RC_OP_FLUSH_DISABLE               (1 << 0)
170
171 #define GFX_FLSH_CNTL                           _MMIO(0x2170) /* 915+ only */
172
173 /*
174  * Logical Context regs
175  */
176 /*
177  * Notes on SNB/IVB/VLV context size:
178  * - Power context is saved elsewhere (LLC or stolen)
179  * - Ring/execlist context is saved on SNB, not on IVB
180  * - Extended context size already includes render context size
181  * - We always need to follow the extended context size.
182  *   SNB BSpec has comments indicating that we should use the
183  *   render context size instead if execlists are disabled, but
184  *   based on empirical testing that's just nonsense.
185  * - Pipelined/VF state is saved on SNB/IVB respectively
186  * - GT1 size just indicates how much of render context
187  *   doesn't need saving on GT1
188  */
189 #define CXT_SIZE                                _MMIO(0x21a0)
190 #define   GEN6_CXT_POWER_SIZE(cxt_reg)          (((cxt_reg) >> 24) & 0x3f)
191 #define   GEN6_CXT_RING_SIZE(cxt_reg)           (((cxt_reg) >> 18) & 0x3f)
192 #define   GEN6_CXT_RENDER_SIZE(cxt_reg)         (((cxt_reg) >> 12) & 0x3f)
193 #define   GEN6_CXT_EXTENDED_SIZE(cxt_reg)       (((cxt_reg) >> 6) & 0x3f)
194 #define   GEN6_CXT_PIPELINE_SIZE(cxt_reg)       (((cxt_reg) >> 0) & 0x3f)
195 #define   GEN6_CXT_TOTAL_SIZE(cxt_reg)          (GEN6_CXT_RING_SIZE(cxt_reg) + \
196                                                 GEN6_CXT_EXTENDED_SIZE(cxt_reg) + \
197                                                 GEN6_CXT_PIPELINE_SIZE(cxt_reg))
198 #define GEN7_CXT_SIZE                           _MMIO(0x21a8)
199 #define   GEN7_CXT_POWER_SIZE(ctx_reg)          (((ctx_reg) >> 25) & 0x7f)
200 #define   GEN7_CXT_RING_SIZE(ctx_reg)           (((ctx_reg) >> 22) & 0x7)
201 #define   GEN7_CXT_RENDER_SIZE(ctx_reg)         (((ctx_reg) >> 16) & 0x3f)
202 #define   GEN7_CXT_EXTENDED_SIZE(ctx_reg)       (((ctx_reg) >> 9) & 0x7f)
203 #define   GEN7_CXT_GT1_SIZE(ctx_reg)            (((ctx_reg) >> 6) & 0x7)
204 #define   GEN7_CXT_VFSTATE_SIZE(ctx_reg)        (((ctx_reg) >> 0) & 0x3f)
205 #define   GEN7_CXT_TOTAL_SIZE(ctx_reg)          (GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \
206                                                  GEN7_CXT_VFSTATE_SIZE(ctx_reg))
207
208 #define HSW_MI_PREDICATE_RESULT_2               _MMIO(0x2214)
209
210 #define GEN9_CTX_PREEMPT_REG                    _MMIO(0x2248)
211 #define   GEN12_DISABLE_POSH_BUSY_FF_DOP_CG     REG_BIT(11)
212
213 #define GPGPU_THREADS_DISPATCHED                _MMIO(0x2290)
214 #define GPGPU_THREADS_DISPATCHED_UDW            _MMIO(0x2290 + 4)
215
216 #define GEN9_RCS_FE_FSM2                        _MMIO(0x22a4)
217 #define GEN6_RCS_PWR_FSM                        _MMIO(0x22ac)
218
219 #define HS_INVOCATION_COUNT                     _MMIO(0x2300)
220 #define HS_INVOCATION_COUNT_UDW                 _MMIO(0x2300 + 4)
221 #define DS_INVOCATION_COUNT                     _MMIO(0x2308)
222 #define DS_INVOCATION_COUNT_UDW                 _MMIO(0x2308 + 4)
223 #define IA_VERTICES_COUNT                       _MMIO(0x2310)
224 #define IA_VERTICES_COUNT_UDW                   _MMIO(0x2310 + 4)
225 #define IA_PRIMITIVES_COUNT                     _MMIO(0x2318)
226 #define IA_PRIMITIVES_COUNT_UDW                 _MMIO(0x2318 + 4)
227 #define VS_INVOCATION_COUNT                     _MMIO(0x2320)
228 #define VS_INVOCATION_COUNT_UDW                 _MMIO(0x2320 + 4)
229 #define GS_INVOCATION_COUNT                     _MMIO(0x2328)
230 #define GS_INVOCATION_COUNT_UDW                 _MMIO(0x2328 + 4)
231 #define GS_PRIMITIVES_COUNT                     _MMIO(0x2330)
232 #define GS_PRIMITIVES_COUNT_UDW                 _MMIO(0x2330 + 4)
233 #define CL_INVOCATION_COUNT                     _MMIO(0x2338)
234 #define CL_INVOCATION_COUNT_UDW                 _MMIO(0x2338 + 4)
235 #define CL_PRIMITIVES_COUNT                     _MMIO(0x2340)
236 #define CL_PRIMITIVES_COUNT_UDW                 _MMIO(0x2340 + 4)
237 #define PS_INVOCATION_COUNT                     _MMIO(0x2348)
238 #define PS_INVOCATION_COUNT_UDW                 _MMIO(0x2348 + 4)
239 #define PS_DEPTH_COUNT                          _MMIO(0x2350)
240 #define PS_DEPTH_COUNT_UDW                      _MMIO(0x2350 + 4)
241 #define GEN7_3DPRIM_END_OFFSET                  _MMIO(0x2420)
242 #define GEN7_3DPRIM_START_VERTEX                _MMIO(0x2430)
243 #define GEN7_3DPRIM_VERTEX_COUNT                _MMIO(0x2434)
244 #define GEN7_3DPRIM_INSTANCE_COUNT              _MMIO(0x2438)
245 #define GEN7_3DPRIM_START_INSTANCE              _MMIO(0x243c)
246 #define GEN7_3DPRIM_BASE_VERTEX                 _MMIO(0x2440)
247 #define GEN7_GPGPU_DISPATCHDIMX                 _MMIO(0x2500)
248 #define GEN7_GPGPU_DISPATCHDIMY                 _MMIO(0x2504)
249 #define GEN7_GPGPU_DISPATCHDIMZ                 _MMIO(0x2508)
250
251 #define GFX_MODE                                _MMIO(0x2520)
252
253 #define GEN8_CS_CHICKEN1                        _MMIO(0x2580)
254 #define   GEN9_PREEMPT_3D_OBJECT_LEVEL          (1 << 0)
255 #define   GEN9_PREEMPT_GPGPU_LEVEL(hi, lo)      (((hi) << 2) | ((lo) << 1))
256 #define   GEN9_PREEMPT_GPGPU_MID_THREAD_LEVEL   GEN9_PREEMPT_GPGPU_LEVEL(0, 0)
257 #define   GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 1)
258 #define   GEN9_PREEMPT_GPGPU_COMMAND_LEVEL      GEN9_PREEMPT_GPGPU_LEVEL(1, 0)
259 #define   GEN9_PREEMPT_GPGPU_LEVEL_MASK         GEN9_PREEMPT_GPGPU_LEVEL(1, 1)
260
261 #define GEN12_GLOBAL_MOCS(i)                    _MMIO(0x4000 + (i) * 4) /* Global MOCS regs */
262
263 #define RENDER_HWS_PGA_GEN7                     _MMIO(0x4080)
264
265 #define GEN8_GAMW_ECO_DEV_RW_IA                 _MMIO(0x4080)
266 #define   GAMW_ECO_ENABLE_64K_IPS_FIELD         0xF
267 #define   GAMW_ECO_DEV_CTX_RELOAD_DISABLE       (1 << 7)
268
269 #define GAM_ECOCHK                              _MMIO(0x4090)
270 #define   BDW_DISABLE_HDC_INVALIDATION          (1 << 25)
271 #define   ECOCHK_SNB_BIT                        (1 << 10)
272 #define   ECOCHK_DIS_TLB                        (1 << 8)
273 #define   HSW_ECOCHK_ARB_PRIO_SOL               (1 << 6)
274 #define   ECOCHK_PPGTT_CACHE64B                 (0x3 << 3)
275 #define   ECOCHK_PPGTT_CACHE4B                  (0x0 << 3)
276 #define   ECOCHK_PPGTT_GFDT_IVB                 (0x1 << 4)
277 #define   ECOCHK_PPGTT_LLC_IVB                  (0x1 << 3)
278 #define   ECOCHK_PPGTT_UC_HSW                   (0x1 << 3)
279 #define   ECOCHK_PPGTT_WT_HSW                   (0x2 << 3)
280 #define   ECOCHK_PPGTT_WB_HSW                   (0x3 << 3)
281
282 #define GEN8_RING_FAULT_REG                     _MMIO(0x4094)
283 #define _RING_FAULT_REG_RCS                     0x4094
284 #define _RING_FAULT_REG_VCS                     0x4194
285 #define _RING_FAULT_REG_BCS                     0x4294
286 #define _RING_FAULT_REG_VECS                    0x4394
287 #define RING_FAULT_REG(engine)                  _MMIO(_PICK((engine)->class, \
288                                                             _RING_FAULT_REG_RCS, \
289                                                             _RING_FAULT_REG_VCS, \
290                                                             _RING_FAULT_REG_VECS, \
291                                                             _RING_FAULT_REG_BCS))
292
293 #define ERROR_GEN6                              _MMIO(0x40a0)
294
295 #define DONE_REG                                _MMIO(0x40b0)
296 #define GEN8_PRIVATE_PAT_LO                     _MMIO(0x40e0)
297 #define GEN8_PRIVATE_PAT_HI                     _MMIO(0x40e0 + 4)
298 #define GEN10_PAT_INDEX(index)                  _MMIO(0x40e0 + (index) * 4)
299 #define BSD_HWS_PGA_GEN7                        _MMIO(0x4180)
300 #define GEN12_GFX_CCS_AUX_NV                    _MMIO(0x4208)
301 #define GEN12_VD0_AUX_NV                        _MMIO(0x4218)
302 #define GEN12_VD1_AUX_NV                        _MMIO(0x4228)
303
304 #define GEN8_RTCR                               _MMIO(0x4260)
305 #define GEN8_M1TCR                              _MMIO(0x4264)
306 #define GEN8_M2TCR                              _MMIO(0x4268)
307 #define GEN8_BTCR                               _MMIO(0x426c)
308 #define GEN8_VTCR                               _MMIO(0x4270)
309
310 #define GEN12_VD2_AUX_NV                        _MMIO(0x4298)
311 #define GEN12_VD3_AUX_NV                        _MMIO(0x42a8)
312 #define GEN12_VE0_AUX_NV                        _MMIO(0x4238)
313
314 #define BLT_HWS_PGA_GEN7                        _MMIO(0x4280)
315
316 #define GEN12_VE1_AUX_NV                        _MMIO(0x42b8)
317 #define   AUX_INV                               REG_BIT(0)
318 #define VEBOX_HWS_PGA_GEN7                      _MMIO(0x4380)
319
320 #define GEN12_AUX_ERR_DBG                       _MMIO(0x43f4)
321
322 #define GEN7_TLB_RD_ADDR                        _MMIO(0x4700)
323
324 #define GEN12_PAT_INDEX(index)                  _MMIO(0x4800 + (index) * 4)
325
326 #define XEHPSDV_FLAT_CCS_BASE_ADDR              _MMIO(0x4910)
327 #define   XEHPSDV_CCS_BASE_SHIFT                8
328
329 #define GAMTARBMODE                             _MMIO(0x4a08)
330 #define   ARB_MODE_BWGTLB_DISABLE               (1 << 9)
331 #define   ARB_MODE_SWIZZLE_BDW                  (1 << 1)
332
333 #define GEN9_GAMT_ECO_REG_RW_IA                 _MMIO(0x4ab0)
334 #define   GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS   (1 << 18)
335
336 #define GAMT_CHKN_BIT_REG                       _MMIO(0x4ab8)
337 #define   GAMT_CHKN_DISABLE_L3_COH_PIPE         (1 << 31)
338 #define   GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING      (1 << 28)
339 #define   GAMT_CHKN_DISABLE_I2M_CYCLE_ON_WR_PORT        (1 << 24)
340
341 #define GEN8_FAULT_TLB_DATA0                    _MMIO(0x4b10)
342 #define GEN8_FAULT_TLB_DATA1                    _MMIO(0x4b14)
343
344 #define GEN11_GACB_PERF_CTRL                    _MMIO(0x4b80)
345 #define   GEN11_HASH_CTRL_MASK                  (0x3 << 12 | 0xf << 0)
346 #define   GEN11_HASH_CTRL_BIT0                  (1 << 0)
347 #define   GEN11_HASH_CTRL_BIT4                  (1 << 12)
348
349 /* gamt regs */
350 #define GEN8_L3_LRA_1_GPGPU                     _MMIO(0x4dd4)
351 #define   GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW 0x67F1427F /* max/min for LRA1/2 */
352 #define   GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV 0x5FF101FF /* max/min for LRA1/2 */
353 #define   GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL 0x67F1427F /*    "        " */
354 #define   GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_BXT 0x5FF101FF /*    "        " */
355
356 #define MMCD_MISC_CTRL                          _MMIO(0x4ddc) /* skl+ */
357 #define   MMCD_PCLA                             (1 << 31)
358 #define   MMCD_HOTSPOT_EN                       (1 << 27)
359
360 /* There are the 4 64-bit counter registers, one for each stream output */
361 #define GEN7_SO_NUM_PRIMS_WRITTEN(n)            _MMIO(0x5200 + (n) * 8)
362 #define GEN7_SO_NUM_PRIMS_WRITTEN_UDW(n)        _MMIO(0x5200 + (n) * 8 + 4)
363
364 #define GEN7_SO_PRIM_STORAGE_NEEDED(n)          _MMIO(0x5240 + (n) * 8)
365 #define GEN7_SO_PRIM_STORAGE_NEEDED_UDW(n)      _MMIO(0x5240 + (n) * 8 + 4)
366
367 #define GEN9_WM_CHICKEN3                        _MMIO(0x5588)
368 #define   GEN9_FACTOR_IN_CLR_VAL_HIZ            (1 << 9)
369
370 #define VFLSKPD                                 _MMIO(0x62a8)
371 #define   DIS_OVER_FETCH_CACHE                  REG_BIT(1)
372 #define   DIS_MULT_MISS_RD_SQUASH               REG_BIT(0)
373
374 #define FF_MODE2                                _MMIO(0x6604)
375 #define   FF_MODE2_GS_TIMER_MASK                REG_GENMASK(31, 24)
376 #define   FF_MODE2_GS_TIMER_224                 REG_FIELD_PREP(FF_MODE2_GS_TIMER_MASK, 224)
377 #define   FF_MODE2_TDS_TIMER_MASK               REG_GENMASK(23, 16)
378 #define   FF_MODE2_TDS_TIMER_128                REG_FIELD_PREP(FF_MODE2_TDS_TIMER_MASK, 4)
379
380 #define XEHPG_INSTDONE_GEOM_SVG                 _MMIO(0x666c)
381
382 #define CACHE_MODE_0_GEN7                       _MMIO(0x7000) /* IVB+ */
383 #define   RC_OP_FLUSH_ENABLE                    (1 << 0)
384 #define   HIZ_RAW_STALL_OPT_DISABLE             (1 << 2)
385 #define CACHE_MODE_1                            _MMIO(0x7004) /* IVB+ */
386 #define   PIXEL_SUBSPAN_COLLECT_OPT_DISABLE     (1 << 6)
387 #define   GEN8_4x4_STC_OPTIMIZATION_DISABLE     (1 << 6)
388 #define   GEN9_PARTIAL_RESOLVE_IN_VC_DISABLE    (1 << 1)
389
390 #define GEN7_GT_MODE                            _MMIO(0x7008)
391 #define   GEN9_IZ_HASHING_MASK(slice)           (0x3 << ((slice) * 2))
392 #define   GEN9_IZ_HASHING(slice, val)           ((val) << ((slice) * 2))
393
394 /* GEN7 chicken */
395 #define GEN7_COMMON_SLICE_CHICKEN1              _MMIO(0x7010)
396 #define   GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC     (1 << 10)
397 #define   GEN9_RHWO_OPTIMIZATION_DISABLE        (1 << 14)
398
399 #define COMMON_SLICE_CHICKEN2                   _MMIO(0x7014)
400 #define   GEN9_PBE_COMPRESSED_HASH_SELECTION    (1 << 13)
401 #define   GEN9_DISABLE_GATHER_AT_SET_SHADER_COMMON_SLICE        (1 << 12)
402 #define   GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION      (1 << 8)
403 #define   GEN8_CSC2_SBE_VUE_CACHE_CONSERVATIVE  (1 << 0)
404
405 #define HIZ_CHICKEN                             _MMIO(0x7018)
406 #define   CHV_HZ_8X8_MODE_IN_1X                 REG_BIT(15)
407 #define   DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE  REG_BIT(14)
408 #define   BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE   REG_BIT(3)
409
410 #define GEN8_L3CNTLREG                          _MMIO(0x7034)
411 #define   GEN8_ERRDETBCTRL                      (1 << 9)
412
413 #define GEN7_SC_INSTDONE                        _MMIO(0x7100)
414 #define GEN12_SC_INSTDONE_EXTRA                 _MMIO(0x7104)
415 #define GEN12_SC_INSTDONE_EXTRA2                _MMIO(0x7108)
416
417 /* GEN8 chicken */
418 #define HDC_CHICKEN0                            _MMIO(0x7300)
419 #define   HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE        (1 << 15)
420 #define   HDC_FENCE_DEST_SLM_DISABLE            (1 << 14)
421 #define   HDC_DONOT_FETCH_MEM_WHEN_MASKED       (1 << 11)
422 #define   HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT   (1 << 5)
423 #define   HDC_FORCE_NON_COHERENT                (1 << 4)
424 #define   HDC_BARRIER_PERFORMANCE_DISABLE       (1 << 10)
425
426 #define GEN8_HDC_CHICKEN1                       _MMIO(0x7304)
427
428 #define GEN11_COMMON_SLICE_CHICKEN3             _MMIO(0x7304)
429 #define   DG1_FLOAT_POINT_BLEND_OPT_STRICT_MODE_EN      REG_BIT(12)
430 #define   XEHP_DUAL_SIMD8_SEQ_MERGE_DISABLE     REG_BIT(12)
431 #define   GEN11_BLEND_EMB_FIX_DISABLE_IN_RCC    REG_BIT(11)
432 #define   GEN12_DISABLE_CPS_AWARE_COLOR_PIPE    REG_BIT(9)
433
434 /* GEN9 chicken */
435 #define SLICE_ECO_CHICKEN0                      _MMIO(0x7308)
436 #define   PIXEL_MASK_CAMMING_DISABLE            (1 << 14)
437
438 #define GEN9_SLICE_COMMON_ECO_CHICKEN0          _MMIO(0x7308)
439 #define   DISABLE_PIXEL_MASK_CAMMING            (1 << 14)
440
441 #define GEN9_SLICE_COMMON_ECO_CHICKEN1          _MMIO(0x731c)
442 #define   GEN11_STATE_CACHE_REDIRECT_TO_CS      (1 << 11)
443
444 #define SLICE_COMMON_ECO_CHICKEN1               _MMIO(0x731c)
445 #define   MSC_MSAA_REODER_BUF_BYPASS_DISABLE    REG_BIT(14)
446
447 #define GEN9_SLICE_PGCTL_ACK(slice)             _MMIO(0x804c + (slice) * 0x4)
448 #define GEN10_SLICE_PGCTL_ACK(slice)            _MMIO(0x804c + ((slice) / 3) * 0x34 + \
449                                                       ((slice) % 3) * 0x4)
450 #define   GEN9_PGCTL_SLICE_ACK                  (1 << 0)
451 #define   GEN9_PGCTL_SS_ACK(subslice)           (1 << (2 + (subslice) * 2))
452 #define   GEN10_PGCTL_VALID_SS_MASK(slice)      ((slice) == 0 ? 0x7F : 0x1F)
453
454 #define GEN9_SS01_EU_PGCTL_ACK(slice)           _MMIO(0x805c + (slice) * 0x8)
455 #define GEN10_SS01_EU_PGCTL_ACK(slice)          _MMIO(0x805c + ((slice) / 3) * 0x30 + \
456                                                       ((slice) % 3) * 0x8)
457 #define GEN9_SS23_EU_PGCTL_ACK(slice)           _MMIO(0x8060 + (slice) * 0x8)
458 #define GEN10_SS23_EU_PGCTL_ACK(slice)          _MMIO(0x8060 + ((slice) / 3) * 0x30 + \
459                                                       ((slice) % 3) * 0x8)
460 #define   GEN9_PGCTL_SSA_EU08_ACK               (1 << 0)
461 #define   GEN9_PGCTL_SSA_EU19_ACK               (1 << 2)
462 #define   GEN9_PGCTL_SSA_EU210_ACK              (1 << 4)
463 #define   GEN9_PGCTL_SSA_EU311_ACK              (1 << 6)
464 #define   GEN9_PGCTL_SSB_EU08_ACK               (1 << 8)
465 #define   GEN9_PGCTL_SSB_EU19_ACK               (1 << 10)
466 #define   GEN9_PGCTL_SSB_EU210_ACK              (1 << 12)
467 #define   GEN9_PGCTL_SSB_EU311_ACK              (1 << 14)
468
469 #define VF_PREEMPTION                           _MMIO(0x83a4)
470 #define   PREEMPTION_VERTEX_COUNT               REG_GENMASK(15, 0)
471
472 #define GEN8_RC6_CTX_INFO                       _MMIO(0x8504)
473
474 #define GEN12_SQCM                              _MMIO(0x8724)
475 #define   EN_32B_ACCESS                         REG_BIT(30)
476
477 #define HSW_IDICR                               _MMIO(0x9008)
478 #define   IDIHASHMSK(x)                         (((x) & 0x3f) << 16)
479
480 #define GEN6_MBCUNIT_SNPCR                      _MMIO(0x900c) /* for LLC config */
481 #define   GEN6_MBC_SNPCR_SHIFT                  21
482 #define   GEN6_MBC_SNPCR_MASK                   (3 << 21)
483 #define   GEN6_MBC_SNPCR_MAX                    (0 << 21)
484 #define   GEN6_MBC_SNPCR_MED                    (1 << 21)
485 #define   GEN6_MBC_SNPCR_LOW                    (2 << 21)
486 #define   GEN6_MBC_SNPCR_MIN                    (3 << 21) /* only 1/16th of the cache is shared */
487
488 #define VLV_G3DCTL                              _MMIO(0x9024)
489 #define VLV_GSCKGCTL                            _MMIO(0x9028)
490
491 /* WaCatErrorRejectionIssue */
492 #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG          _MMIO(0x9030)
493 #define   GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB      (1 << 11)
494
495 #define FBC_LLC_READ_CTRL                       _MMIO(0x9044)
496 #define   FBC_LLC_FULLY_OPEN                    REG_BIT(30)
497
498 #define GEN6_MBCTL                              _MMIO(0x907c)
499 #define   GEN6_MBCTL_ENABLE_BOOT_FETCH          (1 << 4)
500 #define   GEN6_MBCTL_CTX_FETCH_NEEDED           (1 << 3)
501 #define   GEN6_MBCTL_BME_UPDATE_ENABLE          (1 << 2)
502 #define   GEN6_MBCTL_MAE_UPDATE_ENABLE          (1 << 1)
503 #define   GEN6_MBCTL_BOOT_FETCH_MECH            (1 << 0)
504
505 /* Fuse readout registers for GT */
506 #define GEN10_MIRROR_FUSE3                      _MMIO(0x9118)
507 #define   GEN10_L3BANK_PAIR_COUNT               4
508 #define   GEN10_L3BANK_MASK                     0x0F
509 /* on Xe_HP the same fuses indicates mslices instead of L3 banks */
510 #define   GEN12_MAX_MSLICES                     4
511 #define   GEN12_MEML3_EN_MASK                   0x0F
512
513 #define HSW_PAVP_FUSE1                          _MMIO(0x911c)
514 #define   XEHP_SFC_ENABLE_MASK                  REG_GENMASK(27, 24)
515 #define   HSW_F1_EU_DIS_MASK                    REG_GENMASK(17, 16)
516 #define   HSW_F1_EU_DIS_10EUS                   0
517 #define   HSW_F1_EU_DIS_8EUS                    1
518 #define   HSW_F1_EU_DIS_6EUS                    2
519
520 #define GEN8_FUSE2                              _MMIO(0x9120)
521 #define   GEN8_F2_SS_DIS_SHIFT                  21
522 #define   GEN8_F2_SS_DIS_MASK                   (0x7 << GEN8_F2_SS_DIS_SHIFT)
523 #define   GEN8_F2_S_ENA_SHIFT                   25
524 #define   GEN8_F2_S_ENA_MASK                    (0x7 << GEN8_F2_S_ENA_SHIFT)
525 #define   GEN9_F2_SS_DIS_SHIFT                  20
526 #define   GEN9_F2_SS_DIS_MASK                   (0xf << GEN9_F2_SS_DIS_SHIFT)
527 #define   GEN10_F2_S_ENA_SHIFT                  22
528 #define   GEN10_F2_S_ENA_MASK                   (0x3f << GEN10_F2_S_ENA_SHIFT)
529 #define   GEN10_F2_SS_DIS_SHIFT                 18
530 #define   GEN10_F2_SS_DIS_MASK                  (0xf << GEN10_F2_SS_DIS_SHIFT)
531
532 #define GEN8_EU_DISABLE0                        _MMIO(0x9134)
533 #define GEN9_EU_DISABLE(slice)                  _MMIO(0x9134 + (slice) * 0x4)
534 #define GEN11_EU_DISABLE                        _MMIO(0x9134)
535 #define   GEN8_EU_DIS0_S0_MASK                  0xffffff
536 #define   GEN8_EU_DIS0_S1_SHIFT                 24
537 #define   GEN8_EU_DIS0_S1_MASK                  (0xff << GEN8_EU_DIS0_S1_SHIFT)
538 #define   GEN11_EU_DIS_MASK                     0xFF
539 #define XEHP_EU_ENABLE                          _MMIO(0x9134)
540 #define   XEHP_EU_ENA_MASK                      0xFF
541
542 #define GEN8_EU_DISABLE1                        _MMIO(0x9138)
543 #define   GEN8_EU_DIS1_S1_MASK                  0xffff
544 #define   GEN8_EU_DIS1_S2_SHIFT                 16
545 #define   GEN8_EU_DIS1_S2_MASK                  (0xffff << GEN8_EU_DIS1_S2_SHIFT)
546
547 #define GEN11_GT_SLICE_ENABLE                   _MMIO(0x9138)
548 #define   GEN11_GT_S_ENA_MASK                   0xFF
549
550 #define GEN8_EU_DISABLE2                        _MMIO(0x913c)
551 #define   GEN8_EU_DIS2_S2_MASK                  0xff
552
553 #define GEN11_GT_SUBSLICE_DISABLE               _MMIO(0x913c)
554 #define GEN12_GT_GEOMETRY_DSS_ENABLE            _MMIO(0x913c)
555
556 #define GEN10_EU_DISABLE3                       _MMIO(0x9140)
557 #define   GEN10_EU_DIS_SS_MASK                  0xff
558 #define GEN11_GT_VEBOX_VDBOX_DISABLE            _MMIO(0x9140)
559 #define   GEN11_GT_VDBOX_DISABLE_MASK           0xff
560 #define   GEN11_GT_VEBOX_DISABLE_SHIFT          16
561 #define   GEN11_GT_VEBOX_DISABLE_MASK           (0x0f << GEN11_GT_VEBOX_DISABLE_SHIFT)
562
563 #define GEN12_GT_COMPUTE_DSS_ENABLE             _MMIO(0x9144)
564
565 #define GEN6_UCGCTL1                            _MMIO(0x9400)
566 #define   GEN6_GAMUNIT_CLOCK_GATE_DISABLE       (1 << 22)
567 #define   GEN6_EU_TCUNIT_CLOCK_GATE_DISABLE     (1 << 16)
568 #define   GEN6_BLBUNIT_CLOCK_GATE_DISABLE       (1 << 5)
569 #define   GEN6_CSUNIT_CLOCK_GATE_DISABLE                (1 << 7)
570
571 #define GEN6_UCGCTL2                            _MMIO(0x9404)
572 #define   GEN6_VFUNIT_CLOCK_GATE_DISABLE        (1 << 31)
573 #define   GEN7_VDSUNIT_CLOCK_GATE_DISABLE       (1 << 30)
574 #define   GEN7_TDLUNIT_CLOCK_GATE_DISABLE       (1 << 22)
575 #define   GEN6_RCZUNIT_CLOCK_GATE_DISABLE       (1 << 13)
576 #define   GEN6_RCPBUNIT_CLOCK_GATE_DISABLE      (1 << 12)
577 #define   GEN6_RCCUNIT_CLOCK_GATE_DISABLE       (1 << 11)
578
579 #define GEN6_UCGCTL3                            _MMIO(0x9408)
580 #define   GEN6_OACSUNIT_CLOCK_GATE_DISABLE      (1 << 20)
581
582 #define GEN7_UCGCTL4                            _MMIO(0x940c)
583 #define   GEN7_L3BANK2X_CLOCK_GATE_DISABLE      (1 << 25)
584 #define   GEN8_EU_GAUNIT_CLOCK_GATE_DISABLE     (1 << 14)
585
586 #define GEN6_RCGCTL1                            _MMIO(0x9410)
587 #define GEN6_RCGCTL2                            _MMIO(0x9414)
588
589 #define GEN6_GDRST                              _MMIO(0x941c)
590 #define   GEN6_GRDOM_FULL                       (1 << 0)
591 #define   GEN6_GRDOM_RENDER                     (1 << 1)
592 #define   GEN6_GRDOM_MEDIA                      (1 << 2)
593 #define   GEN6_GRDOM_BLT                        (1 << 3)
594 #define   GEN6_GRDOM_VECS                       (1 << 4)
595 #define   GEN9_GRDOM_GUC                        (1 << 5)
596 #define   GEN8_GRDOM_MEDIA2                     (1 << 7)
597 /* GEN11 changed all bit defs except for FULL & RENDER */
598 #define   GEN11_GRDOM_FULL                      GEN6_GRDOM_FULL
599 #define   GEN11_GRDOM_RENDER                    GEN6_GRDOM_RENDER
600 #define   GEN11_GRDOM_BLT                       (1 << 2)
601 #define   GEN11_GRDOM_GUC                       (1 << 3)
602 #define   GEN11_GRDOM_MEDIA                     (1 << 5)
603 #define   GEN11_GRDOM_MEDIA2                    (1 << 6)
604 #define   GEN11_GRDOM_MEDIA3                    (1 << 7)
605 #define   GEN11_GRDOM_MEDIA4                    (1 << 8)
606 #define   GEN11_GRDOM_MEDIA5                    (1 << 9)
607 #define   GEN11_GRDOM_MEDIA6                    (1 << 10)
608 #define   GEN11_GRDOM_MEDIA7                    (1 << 11)
609 #define   GEN11_GRDOM_MEDIA8                    (1 << 12)
610 #define   GEN11_GRDOM_VECS                      (1 << 13)
611 #define   GEN11_GRDOM_VECS2                     (1 << 14)
612 #define   GEN11_GRDOM_VECS3                     (1 << 15)
613 #define   GEN11_GRDOM_VECS4                     (1 << 16)
614 #define   GEN11_GRDOM_SFC0                      (1 << 17)
615 #define   GEN11_GRDOM_SFC1                      (1 << 18)
616 #define   GEN11_GRDOM_SFC2                      (1 << 19)
617 #define   GEN11_GRDOM_SFC3                      (1 << 20)
618 #define   GEN11_VCS_SFC_RESET_BIT(instance)     (GEN11_GRDOM_SFC0 << ((instance) >> 1))
619 #define   GEN11_VECS_SFC_RESET_BIT(instance)    (GEN11_GRDOM_SFC0 << (instance))
620
621 #define GEN6_RSTCTL                             _MMIO(0x9420)
622
623 #define GEN7_MISCCPCTL                          _MMIO(0x9424)
624 #define   GEN7_DOP_CLOCK_GATE_ENABLE            (1 << 0)
625 #define   GEN8_DOP_CLOCK_GATE_CFCLK_ENABLE      (1 << 2)
626 #define   GEN8_DOP_CLOCK_GATE_GUC_ENABLE        (1 << 4)
627 #define   GEN8_DOP_CLOCK_GATE_MEDIA_ENABLE      (1 << 6)
628
629 #define GEN8_UCGCTL6                            _MMIO(0x9430)
630 #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE      (1 << 24)
631 #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE       (1 << 14)
632 #define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ        (1 << 28)
633
634 #define UNSLCGCTL9430                           _MMIO(0x9430)
635 #define   MSQDUNIT_CLKGATE_DIS                  REG_BIT(3)
636
637 #define UNSLICE_UNIT_LEVEL_CLKGATE              _MMIO(0x9434)
638 #define   VFUNIT_CLKGATE_DIS                    REG_BIT(20)
639 #define   TSGUNIT_CLKGATE_DIS                   REG_BIT(17) /* XEHPSDV */
640 #define   CG3DDISCFEG_CLKGATE_DIS               REG_BIT(17) /* DG2 */
641 #define   GAMEDIA_CLKGATE_DIS                   REG_BIT(11)
642 #define   HSUNIT_CLKGATE_DIS                    REG_BIT(8)
643 #define   VSUNIT_CLKGATE_DIS                    REG_BIT(3)
644
645 #define UNSLCGCTL9440                           _MMIO(0x9440)
646 #define   GAMTLBOACS_CLKGATE_DIS                REG_BIT(28)
647 #define   GAMTLBVDBOX5_CLKGATE_DIS              REG_BIT(27)
648 #define   GAMTLBVDBOX6_CLKGATE_DIS              REG_BIT(26)
649 #define   GAMTLBVDBOX3_CLKGATE_DIS              REG_BIT(24)
650 #define   GAMTLBVDBOX4_CLKGATE_DIS              REG_BIT(23)
651 #define   GAMTLBVDBOX7_CLKGATE_DIS              REG_BIT(22)
652 #define   GAMTLBVDBOX2_CLKGATE_DIS              REG_BIT(21)
653 #define   GAMTLBVDBOX0_CLKGATE_DIS              REG_BIT(17)
654 #define   GAMTLBKCR_CLKGATE_DIS                 REG_BIT(16)
655 #define   GAMTLBGUC_CLKGATE_DIS                 REG_BIT(15)
656 #define   GAMTLBBLT_CLKGATE_DIS                 REG_BIT(14)
657 #define   GAMTLBVDBOX1_CLKGATE_DIS              REG_BIT(6)
658
659 #define UNSLCGCTL9444                           _MMIO(0x9444)
660 #define   GAMTLBGFXA0_CLKGATE_DIS               REG_BIT(30)
661 #define   GAMTLBGFXA1_CLKGATE_DIS               REG_BIT(29)
662 #define   GAMTLBCOMPA0_CLKGATE_DIS              REG_BIT(28)
663 #define   GAMTLBCOMPA1_CLKGATE_DIS              REG_BIT(27)
664 #define   GAMTLBCOMPB0_CLKGATE_DIS              REG_BIT(26)
665 #define   GAMTLBCOMPB1_CLKGATE_DIS              REG_BIT(25)
666 #define   GAMTLBCOMPC0_CLKGATE_DIS              REG_BIT(24)
667 #define   GAMTLBCOMPC1_CLKGATE_DIS              REG_BIT(23)
668 #define   GAMTLBCOMPD0_CLKGATE_DIS              REG_BIT(22)
669 #define   GAMTLBCOMPD1_CLKGATE_DIS              REG_BIT(21)
670 #define   GAMTLBMERT_CLKGATE_DIS                REG_BIT(20)
671 #define   GAMTLBVEBOX3_CLKGATE_DIS              REG_BIT(19)
672 #define   GAMTLBVEBOX2_CLKGATE_DIS              REG_BIT(18)
673 #define   GAMTLBVEBOX1_CLKGATE_DIS              REG_BIT(17)
674 #define   GAMTLBVEBOX0_CLKGATE_DIS              REG_BIT(16)
675 #define   LTCDD_CLKGATE_DIS                     REG_BIT(10)
676
677 #define SLICE_UNIT_LEVEL_CLKGATE                _MMIO(0x94d4)
678 #define   SARBUNIT_CLKGATE_DIS                  (1 << 5)
679 #define   RCCUNIT_CLKGATE_DIS                   (1 << 7)
680 #define   MSCUNIT_CLKGATE_DIS                   (1 << 10)
681 #define   NODEDSS_CLKGATE_DIS                   REG_BIT(12)
682 #define   L3_CLKGATE_DIS                        REG_BIT(16)
683 #define   L3_CR2X_CLKGATE_DIS                   REG_BIT(17)
684
685 #define SCCGCTL94DC                             _MMIO(0x94dc)
686 #define   CG3DDISURB                            REG_BIT(14)
687
688 #define UNSLICE_UNIT_LEVEL_CLKGATE2             _MMIO(0x94e4)
689 #define   VSUNIT_CLKGATE_DIS_TGL                REG_BIT(19)
690 #define   PSDUNIT_CLKGATE_DIS                   REG_BIT(5)
691
692 #define SUBSLICE_UNIT_LEVEL_CLKGATE             _MMIO(0x9524)
693 #define   DSS_ROUTER_CLKGATE_DIS                REG_BIT(28)
694 #define   GWUNIT_CLKGATE_DIS                    REG_BIT(16)
695
696 #define SUBSLICE_UNIT_LEVEL_CLKGATE2            _MMIO(0x9528)
697 #define   CPSSUNIT_CLKGATE_DIS                  REG_BIT(9)
698
699 #define SSMCGCTL9530                            _MMIO(0x9530)
700 #define   RTFUNIT_CLKGATE_DIS                   REG_BIT(18)
701
702 #define GEN10_DFR_RATIO_EN_AND_CHICKEN          _MMIO(0x9550)
703 #define   DFR_DISABLE                           (1 << 9)
704
705 #define INF_UNIT_LEVEL_CLKGATE                  _MMIO(0x9560)
706 #define   CGPSF_CLKGATE_DIS                     (1 << 3)
707
708 #define MICRO_BP0_0                             _MMIO(0x9800)
709 #define MICRO_BP0_2                             _MMIO(0x9804)
710 #define MICRO_BP0_1                             _MMIO(0x9808)
711 #define MICRO_BP1_0                             _MMIO(0x980c)
712 #define MICRO_BP1_2                             _MMIO(0x9810)
713 #define MICRO_BP1_1                             _MMIO(0x9814)
714 #define MICRO_BP2_0                             _MMIO(0x9818)
715 #define MICRO_BP2_2                             _MMIO(0x981c)
716 #define MICRO_BP2_1                             _MMIO(0x9820)
717 #define MICRO_BP3_0                             _MMIO(0x9824)
718 #define MICRO_BP3_2                             _MMIO(0x9828)
719 #define MICRO_BP3_1                             _MMIO(0x982c)
720 #define MICRO_BP_TRIGGER                        _MMIO(0x9830)
721 #define MICRO_BP3_COUNT_STATUS01                _MMIO(0x9834)
722 #define MICRO_BP3_COUNT_STATUS23                _MMIO(0x9838)
723 #define MICRO_BP_FIRED_ARMED                    _MMIO(0x983c)
724
725 #define GEN6_GFXPAUSE                           _MMIO(0xa000)
726 #define GEN6_RPNSWREQ                           _MMIO(0xa008)
727 #define   GEN6_TURBO_DISABLE                    (1 << 31)
728 #define   GEN6_FREQUENCY(x)                     ((x) << 25)
729 #define   HSW_FREQUENCY(x)                      ((x) << 24)
730 #define   GEN9_FREQUENCY(x)                     ((x) << 23)
731 #define   GEN6_OFFSET(x)                        ((x) << 19)
732 #define   GEN6_AGGRESSIVE_TURBO                 (0 << 15)
733 #define   GEN9_SW_REQ_UNSLICE_RATIO_SHIFT       23
734 #define   GEN9_IGNORE_SLICE_RATIO               (0 << 0)
735
736 #define GEN6_RC_VIDEO_FREQ                      _MMIO(0xa00c)
737 #define   GEN6_RC_CTL_RC6pp_ENABLE              (1 << 16)
738 #define   GEN6_RC_CTL_RC6p_ENABLE               (1 << 17)
739 #define   GEN6_RC_CTL_RC6_ENABLE                (1 << 18)
740 #define   GEN6_RC_CTL_RC1e_ENABLE               (1 << 20)
741 #define   GEN6_RC_CTL_RC7_ENABLE                (1 << 22)
742 #define   VLV_RC_CTL_CTX_RST_PARALLEL           (1 << 24)
743 #define   GEN7_RC_CTL_TO_MODE                   (1 << 28)
744 #define   GEN6_RC_CTL_EI_MODE(x)                ((x) << 27)
745 #define   GEN6_RC_CTL_HW_ENABLE                 (1 << 31)
746 #define GEN6_RP_DOWN_TIMEOUT                    _MMIO(0xa010)
747 #define GEN6_RP_INTERRUPT_LIMITS                _MMIO(0xa014)
748 #define GEN6_RPSTAT1                            _MMIO(0xa01c)
749 #define   GEN6_CAGF_SHIFT                       8
750 #define   HSW_CAGF_SHIFT                        7
751 #define   GEN9_CAGF_SHIFT                       23
752 #define   GEN6_CAGF_MASK                        (0x7f << GEN6_CAGF_SHIFT)
753 #define   HSW_CAGF_MASK                         (0x7f << HSW_CAGF_SHIFT)
754 #define   GEN9_CAGF_MASK                        (0x1ff << GEN9_CAGF_SHIFT)
755 #define GEN6_RP_CONTROL                         _MMIO(0xa024)
756 #define   GEN6_RP_MEDIA_TURBO                   (1 << 11)
757 #define   GEN6_RP_MEDIA_MODE_MASK               (3 << 9)
758 #define   GEN6_RP_MEDIA_HW_TURBO_MODE           (3 << 9)
759 #define   GEN6_RP_MEDIA_HW_NORMAL_MODE          (2 << 9)
760 #define   GEN6_RP_MEDIA_HW_MODE                 (1 << 9)
761 #define   GEN6_RP_MEDIA_SW_MODE                 (0 << 9)
762 #define   GEN6_RP_MEDIA_IS_GFX                  (1 << 8)
763 #define   GEN6_RP_ENABLE                        (1 << 7)
764 #define   GEN6_RP_UP_IDLE_MIN                   (0x1 << 3)
765 #define   GEN6_RP_UP_BUSY_AVG                   (0x2 << 3)
766 #define   GEN6_RP_UP_BUSY_CONT                  (0x4 << 3)
767 #define   GEN6_RP_DOWN_IDLE_AVG                 (0x2 << 0)
768 #define   GEN6_RP_DOWN_IDLE_CONT                (0x1 << 0)
769 #define   GEN6_RPSWCTL_SHIFT                    9
770 #define   GEN9_RPSWCTL_ENABLE                   (0x2 << GEN6_RPSWCTL_SHIFT)
771 #define   GEN9_RPSWCTL_DISABLE                  (0x0 << GEN6_RPSWCTL_SHIFT)
772 #define GEN6_RP_UP_THRESHOLD                    _MMIO(0xa02c)
773 #define GEN6_RP_DOWN_THRESHOLD                  _MMIO(0xa030)
774 #define GEN6_RP_CUR_UP_EI                       _MMIO(0xa050)
775 #define   GEN6_RP_EI_MASK                       0xffffff
776 #define   GEN6_CURICONT_MASK                    GEN6_RP_EI_MASK
777 #define GEN6_RP_CUR_UP                          _MMIO(0xa054)
778 #define   GEN6_CURBSYTAVG_MASK                  GEN6_RP_EI_MASK
779 #define GEN6_RP_PREV_UP                         _MMIO(0xa058)
780 #define GEN6_RP_CUR_DOWN_EI                     _MMIO(0xa05c)
781 #define   GEN6_CURIAVG_MASK                     GEN6_RP_EI_MASK
782 #define GEN6_RP_CUR_DOWN                        _MMIO(0xa060)
783 #define GEN6_RP_PREV_DOWN                       _MMIO(0xa064)
784 #define GEN6_RP_UP_EI                           _MMIO(0xa068)
785 #define GEN6_RP_DOWN_EI                         _MMIO(0xa06c)
786 #define GEN6_RP_IDLE_HYSTERSIS                  _MMIO(0xa070)
787 #define GEN6_RPDEUHWTC                          _MMIO(0xa080)
788 #define GEN6_RPDEUC                             _MMIO(0xa084)
789 #define GEN6_RPDEUCSW                           _MMIO(0xa088)
790 #define GEN6_RC_CONTROL                         _MMIO(0xa090)
791 #define GEN6_RC_STATE                           _MMIO(0xa094)
792 #define   RC_SW_TARGET_STATE_SHIFT              16
793 #define   RC_SW_TARGET_STATE_MASK               (7 << RC_SW_TARGET_STATE_SHIFT)
794 #define GEN6_RC1_WAKE_RATE_LIMIT                _MMIO(0xa098)
795 #define GEN6_RC6_WAKE_RATE_LIMIT                _MMIO(0xa09c)
796 #define GEN6_RC6pp_WAKE_RATE_LIMIT              _MMIO(0xa0a0)
797 #define GEN10_MEDIA_WAKE_RATE_LIMIT             _MMIO(0xa0a0)
798 #define GEN6_RC_EVALUATION_INTERVAL             _MMIO(0xa0a8)
799 #define GEN6_RC_IDLE_HYSTERSIS                  _MMIO(0xa0ac)
800 #define GEN6_RC_SLEEP                           _MMIO(0xa0b0)
801 #define GEN6_RCUBMABDTMR                        _MMIO(0xa0b0)
802 #define GEN6_RC1e_THRESHOLD                     _MMIO(0xa0b4)
803 #define GEN6_RC6_THRESHOLD                      _MMIO(0xa0b8)
804 #define GEN6_RC6p_THRESHOLD                     _MMIO(0xa0bc)
805 #define VLV_RCEDATA                             _MMIO(0xa0bc)
806 #define GEN6_RC6pp_THRESHOLD                    _MMIO(0xa0c0)
807 #define GEN9_MEDIA_PG_IDLE_HYSTERESIS           _MMIO(0xa0c4)
808 #define GEN9_RENDER_PG_IDLE_HYSTERESIS          _MMIO(0xa0c8)
809
810 #define GEN6_PMINTRMSK                          _MMIO(0xa168)
811 #define   GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC   (1 << 31)
812 #define   ARAT_EXPIRED_INTRMSK                  (1 << 9)
813
814 #define GEN8_MISC_CTRL0                         _MMIO(0xa180)
815
816 #define ECOBUS                                  _MMIO(0xa180)
817 #define    FORCEWAKE_MT_ENABLE                  (1 << 5)
818
819 #define FORCEWAKE_MT                            _MMIO(0xa188) /* multi-threaded */
820 #define FORCEWAKE_GT_GEN9                       _MMIO(0xa188)
821 #define FORCEWAKE                               _MMIO(0xa18c)
822
823 #define VLV_SPAREG2H                            _MMIO(0xa194)
824
825 #define GEN9_PG_ENABLE                          _MMIO(0xa210)
826 #define   GEN9_RENDER_PG_ENABLE                 REG_BIT(0)
827 #define   GEN9_MEDIA_PG_ENABLE                  REG_BIT(1)
828 #define   GEN11_MEDIA_SAMPLER_PG_ENABLE         REG_BIT(2)
829 #define   VDN_HCP_POWERGATE_ENABLE(n)           REG_BIT(3 + 2 * (n))
830 #define   VDN_MFX_POWERGATE_ENABLE(n)           REG_BIT(4 + 2 * (n))
831
832 #define GEN8_PUSHBUS_CONTROL                    _MMIO(0xa248)
833 #define GEN8_PUSHBUS_ENABLE                     _MMIO(0xa250)
834 #define GEN8_PUSHBUS_SHIFT                      _MMIO(0xa25c)
835
836 /* GPM unit config (Gen9+) */
837 #define CTC_MODE                                _MMIO(0xa26c)
838 #define   CTC_SOURCE_PARAMETER_MASK             1
839 #define   CTC_SOURCE_CRYSTAL_CLOCK              0
840 #define   CTC_SOURCE_DIVIDE_LOGIC               1
841 #define   CTC_SHIFT_PARAMETER_SHIFT             1
842 #define   CTC_SHIFT_PARAMETER_MASK              (0x3 << CTC_SHIFT_PARAMETER_SHIFT)
843
844 #define FORCEWAKE_MEDIA_GEN9                    _MMIO(0xa270)
845 #define FORCEWAKE_RENDER_GEN9                   _MMIO(0xa278)
846
847 #define VLV_PWRDWNUPCTL                         _MMIO(0xa294)
848
849 #define GEN9_PWRGT_DOMAIN_STATUS                _MMIO(0xa2a0)
850 #define   GEN9_PWRGT_MEDIA_STATUS_MASK          (1 << 0)
851 #define   GEN9_PWRGT_RENDER_STATUS_MASK         (1 << 1)
852
853 #define MISC_STATUS0                            _MMIO(0xa500)
854 #define MISC_STATUS1                            _MMIO(0xa504)
855
856 #define FORCEWAKE_MEDIA_VDBOX_GEN11(n)          _MMIO(0xa540 + (n) * 4)
857 #define FORCEWAKE_MEDIA_VEBOX_GEN11(n)          _MMIO(0xa560 + (n) * 4)
858
859 #define CHV_POWER_SS0_SIG1                      _MMIO(0xa720)
860 #define CHV_POWER_SS0_SIG2                      _MMIO(0xa724)
861 #define CHV_POWER_SS1_SIG1                      _MMIO(0xa728)
862 #define   CHV_SS_PG_ENABLE                      (1 << 1)
863 #define   CHV_EU08_PG_ENABLE                    (1 << 9)
864 #define   CHV_EU19_PG_ENABLE                    (1 << 17)
865 #define   CHV_EU210_PG_ENABLE                   (1 << 25)
866 #define CHV_POWER_SS1_SIG2                      _MMIO(0xa72c)
867 #define   CHV_EU311_PG_ENABLE                   (1 << 1)
868
869 #define GEN7_SARCHKMD                           _MMIO(0xb000)
870 #define   GEN7_DISABLE_DEMAND_PREFETCH          (1 << 31)
871 #define   GEN7_DISABLE_SAMPLER_PREFETCH         (1 << 30)
872
873 #define GEN8_GARBCNTL                           _MMIO(0xb004)
874 #define   GEN9_GAPS_TSV_CREDIT_DISABLE          (1 << 7)
875 #define   GEN11_ARBITRATION_PRIO_ORDER_MASK     (0x3f << 22)
876 #define   GEN11_HASH_CTRL_EXCL_MASK             (0x7f << 0)
877 #define   GEN11_HASH_CTRL_EXCL_BIT0             (1 << 0)
878
879 #define GEN9_SCRATCH_LNCF1                      _MMIO(0xb008)
880 #define   GEN9_LNCF_NONIA_COHERENT_ATOMICS_ENABLE       REG_BIT(0)
881
882 #define GEN7_L3SQCREG1                          _MMIO(0xb010)
883 #define   VLV_B0_WA_L3SQCREG1_VALUE             0x00D30000
884
885 #define GEN7_L3CNTLREG1                         _MMIO(0xb01c)
886 #define   GEN7_WA_FOR_GEN7_L3_CONTROL           0x3C47FF8C
887 #define   GEN7_L3AGDIS                          (1 << 19)
888 #define GEN7_L3CNTLREG2                         _MMIO(0xb020)
889
890 /* MOCS (Memory Object Control State) registers */
891 #define GEN9_LNCFCMOCS(i)                       _MMIO(0xb020 + (i) * 4) /* L3 Cache Control */
892 #define GEN9_LNCFCMOCS_REG_COUNT                32
893
894 #define GEN7_L3CNTLREG3                         _MMIO(0xb024)
895
896 #define GEN7_L3_CHICKEN_MODE_REGISTER           _MMIO(0xb030)
897 #define   GEN7_WA_L3_CHICKEN_MODE               0x20000000
898
899 #define GEN7_L3SQCREG4                          _MMIO(0xb034)
900 #define   L3SQ_URB_READ_CAM_MATCH_DISABLE       (1 << 27)
901
902 #define HSW_SCRATCH1                            _MMIO(0xb038)
903 #define   HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE  (1 << 27)
904
905 #define GEN7_L3LOG(slice, i)                    _MMIO(0xb070 + (slice) * 0x200 + (i) * 4)
906 #define   GEN7_L3LOG_SIZE                       0x80
907
908 #define GEN10_SCRATCH_LNCF2                     _MMIO(0xb0a0)
909 #define   PMFLUSHDONE_LNICRSDROP                (1 << 20)
910 #define   PMFLUSH_GAPL3UNBLOCK                  (1 << 21)
911 #define   PMFLUSHDONE_LNEBLK                    (1 << 22)
912
913 #define XEHP_L3NODEARBCFG                       _MMIO(0xb0b4)
914 #define   XEHP_LNESPARE                         REG_BIT(19)
915
916 #define GEN8_L3SQCREG1                          _MMIO(0xb100)
917 /*
918  * Note that on CHV the following has an off-by-one error wrt. to BSpec.
919  * Using the formula in BSpec leads to a hang, while the formula here works
920  * fine and matches the formulas for all other platforms. A BSpec change
921  * request has been filed to clarify this.
922  */
923 #define   L3_GENERAL_PRIO_CREDITS(x)            (((x) >> 1) << 19)
924 #define   L3_HIGH_PRIO_CREDITS(x)               (((x) >> 1) << 14)
925 #define   L3_PRIO_CREDITS_MASK                  ((0x1f << 19) | (0x1f << 14))
926
927 #define GEN10_L3_CHICKEN_MODE_REGISTER          _MMIO(0xb114)
928 #define   GEN11_I2M_WRITE_DISABLE               (1 << 28)
929
930 #define GEN8_L3SQCREG4                          _MMIO(0xb118)
931 #define   GEN11_LQSC_CLEAN_EVICT_DISABLE        (1 << 6)
932 #define   GEN8_LQSC_RO_PERF_DIS                 (1 << 27)
933 #define   GEN8_LQSC_FLUSH_COHERENT_LINES        (1 << 21)
934 #define   GEN8_LQSQ_NONIA_COHERENT_ATOMICS_ENABLE       REG_BIT(22)
935
936 #define GEN9_SCRATCH1                           _MMIO(0xb11c)
937 #define   EVICTION_PERF_FIX_ENABLE              REG_BIT(8)
938
939 #define BDW_SCRATCH1                            _MMIO(0xb11c)
940 #define   GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE     (1 << 2)
941
942 #define GEN11_SCRATCH2                          _MMIO(0xb140)
943 #define   GEN11_COHERENT_PARTIAL_WRITE_MERGE_ENABLE     (1 << 19)
944
945 #define GEN11_L3SQCREG5                         _MMIO(0xb158)
946 #define   L3_PWM_TIMER_INIT_VAL_MASK            REG_GENMASK(9, 0)
947
948 #define MLTICTXCTL                              _MMIO(0xb170)
949 #define   TDONRENDER                            REG_BIT(2)
950
951 #define XEHP_L3SCQREG7                          _MMIO(0xb188)
952 #define   BLEND_FILL_CACHING_OPT_DIS            REG_BIT(3)
953
954 #define L3SQCREG1_CCS0                          _MMIO(0xb200)
955 #define   FLUSHALLNONCOH                        REG_BIT(5)
956
957 #define GEN11_GLBLINVL                          _MMIO(0xb404)
958 #define   GEN11_BANK_HASH_ADDR_EXCL_MASK        (0x7f << 5)
959 #define   GEN11_BANK_HASH_ADDR_EXCL_BIT0        (1 << 5)
960
961 #define GEN11_LSN_UNSLCVC                       _MMIO(0xb43c)
962 #define   GEN11_LSN_UNSLCVC_GAFS_HALF_CL2_MAXALLOC      (1 << 9)
963 #define   GEN11_LSN_UNSLCVC_GAFS_HALF_SF_MAXALLOC       (1 << 7)
964
965 #define __GEN9_RCS0_MOCS0                       0xc800
966 #define GEN9_GFX_MOCS(i)                        _MMIO(__GEN9_RCS0_MOCS0 + (i) * 4)
967 #define __GEN9_VCS0_MOCS0                       0xc900
968 #define GEN9_MFX0_MOCS(i)                       _MMIO(__GEN9_VCS0_MOCS0 + (i) * 4)
969 #define __GEN9_VCS1_MOCS0                       0xca00
970 #define GEN9_MFX1_MOCS(i)                       _MMIO(__GEN9_VCS1_MOCS0 + (i) * 4)
971 #define __GEN9_VECS0_MOCS0                      0xcb00
972 #define GEN9_VEBOX_MOCS(i)                      _MMIO(__GEN9_VECS0_MOCS0 + (i) * 4)
973 #define __GEN9_BCS0_MOCS0                       0xcc00
974 #define GEN9_BLT_MOCS(i)                        _MMIO(__GEN9_BCS0_MOCS0 + (i) * 4)
975
976 #define GEN12_FAULT_TLB_DATA0                   _MMIO(0xceb8)
977 #define GEN12_FAULT_TLB_DATA1                   _MMIO(0xcebc)
978 #define   FAULT_VA_HIGH_BITS                    (0xf << 0)
979 #define   FAULT_GTT_SEL                         (1 << 4)
980
981 #define GEN12_RING_FAULT_REG                    _MMIO(0xcec4)
982 #define   GEN8_RING_FAULT_ENGINE_ID(x)          (((x) >> 12) & 0x7)
983 #define   RING_FAULT_GTTSEL_MASK                (1 << 11)
984 #define   RING_FAULT_SRCID(x)                   (((x) >> 3) & 0xff)
985 #define   RING_FAULT_FAULT_TYPE(x)              (((x) >> 1) & 0x3)
986 #define   RING_FAULT_VALID                      (1 << 0)
987
988 #define GEN12_GFX_TLB_INV_CR                    _MMIO(0xced8)
989 #define GEN12_VD_TLB_INV_CR                     _MMIO(0xcedc)
990 #define GEN12_VE_TLB_INV_CR                     _MMIO(0xcee0)
991 #define GEN12_BLT_TLB_INV_CR                    _MMIO(0xcee4)
992
993 #define GEN12_MERT_MOD_CTRL                     _MMIO(0xcf28)
994 #define RENDER_MOD_CTRL                         _MMIO(0xcf2c)
995 #define COMP_MOD_CTRL                           _MMIO(0xcf30)
996 #define VDBX_MOD_CTRL                           _MMIO(0xcf34)
997 #define VEBX_MOD_CTRL                           _MMIO(0xcf38)
998 #define   FORCE_MISS_FTLB                       REG_BIT(3)
999
1000 #define GEN12_GAMSTLB_CTRL                      _MMIO(0xcf4c)
1001 #define   CONTROL_BLOCK_CLKGATE_DIS             REG_BIT(12)
1002 #define   EGRESS_BLOCK_CLKGATE_DIS              REG_BIT(11)
1003 #define   TAG_BLOCK_CLKGATE_DIS                 REG_BIT(7)
1004
1005 #define GEN12_GAMCNTRL_CTRL                     _MMIO(0xcf54)
1006 #define   INVALIDATION_BROADCAST_MODE_DIS       REG_BIT(12)
1007 #define   GLOBAL_INVALIDATION_MODE              REG_BIT(2)
1008
1009 #define GEN12_GAM_DONE                          _MMIO(0xcf68)
1010
1011 #define GEN7_HALF_SLICE_CHICKEN1                _MMIO(0xe100) /* IVB GT1 + VLV */
1012 #define   GEN7_MAX_PS_THREAD_DEP                (8 << 12)
1013 #define   GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE   (1 << 10)
1014 #define   GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE       (1 << 4)
1015 #define   GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE  (1 << 3)
1016
1017 #define GEN7_SAMPLER_INSTDONE                   _MMIO(0xe160)
1018 #define GEN7_ROW_INSTDONE                       _MMIO(0xe164)
1019
1020 #define HALF_SLICE_CHICKEN2                     _MMIO(0xe180)
1021 #define   GEN8_ST_PO_DISABLE                    (1 << 13)
1022
1023 #define HALF_SLICE_CHICKEN3                     _MMIO(0xe184)
1024 #define   HSW_SAMPLE_C_PERFORMANCE              (1 << 9)
1025 #define   GEN8_CENTROID_PIXEL_OPT_DIS           (1 << 8)
1026 #define   GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC   (1 << 5)
1027 #define   GEN8_SAMPLER_POWER_BYPASS_DIS         (1 << 1)
1028
1029 #define GEN9_HALF_SLICE_CHICKEN5                _MMIO(0xe188)
1030 #define   GEN9_DG_MIRROR_FIX_ENABLE             (1 << 5)
1031 #define   GEN9_CCS_TLB_PREFETCH_ENABLE          (1 << 3)
1032
1033 #define GEN10_SAMPLER_MODE                      _MMIO(0xe18c)
1034 #define   ENABLE_SMALLPL                        REG_BIT(15)
1035 #define   GEN11_SAMPLER_ENABLE_HEADLESS_MSG     REG_BIT(5)
1036
1037 #define GEN9_HALF_SLICE_CHICKEN7                _MMIO(0xe194)
1038 #define   DG2_DISABLE_ROUND_ENABLE_ALLOW_FOR_SSLA       REG_BIT(15)
1039 #define   GEN9_SAMPLER_HASH_COMPRESSED_READ_ADDR        REG_BIT(8)
1040 #define   GEN9_ENABLE_YV12_BUGFIX               REG_BIT(4)
1041 #define   GEN9_ENABLE_GPGPU_PREEMPTION          REG_BIT(2)
1042
1043 #define GEN10_CACHE_MODE_SS                     _MMIO(0xe420)
1044 #define   ENABLE_PREFETCH_INTO_IC               REG_BIT(3)
1045 #define   FLOAT_BLEND_OPTIMIZATION_ENABLE       REG_BIT(4)
1046
1047 #define EU_PERF_CNTL0                           _MMIO(0xe458)
1048 #define EU_PERF_CNTL4                           _MMIO(0xe45c)
1049
1050 #define GEN9_ROW_CHICKEN4                       _MMIO(0xe48c)
1051 #define   GEN12_DISABLE_GRF_CLEAR               REG_BIT(13)
1052 #define   XEHP_DIS_BBL_SYSPIPE                  REG_BIT(11)
1053 #define   GEN12_DISABLE_TDL_PUSH                REG_BIT(9)
1054 #define   GEN11_DIS_PICK_2ND_EU                 REG_BIT(7)
1055 #define   GEN12_DISABLE_HDR_PAST_PAYLOAD_HOLD_FIX       REG_BIT(4)
1056
1057 #define HSW_ROW_CHICKEN3                        _MMIO(0xe49c)
1058 #define   HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE    (1 << 6)
1059
1060 #define GEN8_ROW_CHICKEN                        _MMIO(0xe4f0)
1061 #define   FLOW_CONTROL_ENABLE                   REG_BIT(15)
1062 #define   UGM_BACKUP_MODE                       REG_BIT(13)
1063 #define   MDQ_ARBITRATION_MODE                  REG_BIT(12)
1064 #define   SYSTOLIC_DOP_CLOCK_GATING_DIS         REG_BIT(10)
1065 #define   PARTIAL_INSTRUCTION_SHOOTDOWN_DISABLE REG_BIT(8)
1066 #define   STALL_DOP_GATING_DISABLE              REG_BIT(5)
1067 #define   THROTTLE_12_5                         REG_GENMASK(4, 2)
1068 #define   DISABLE_EARLY_EOT                     REG_BIT(1)
1069
1070 #define GEN7_ROW_CHICKEN2                       _MMIO(0xe4f4)
1071 #define   GEN12_DISABLE_READ_SUPPRESSION        REG_BIT(15)
1072 #define   GEN12_DISABLE_EARLY_READ              REG_BIT(14)
1073 #define   GEN12_ENABLE_LARGE_GRF_MODE           REG_BIT(12)
1074 #define   GEN12_PUSH_CONST_DEREF_HOLD_DIS       REG_BIT(8)
1075
1076 #define RT_CTRL                                 _MMIO(0xe530)
1077 #define   DIS_NULL_QUERY                        REG_BIT(10)
1078
1079 #define EU_PERF_CNTL1                           _MMIO(0xe558)
1080 #define EU_PERF_CNTL5                           _MMIO(0xe55c)
1081
1082 #define GEN12_HDC_CHICKEN0                      _MMIO(0xe5f0)
1083 #define   LSC_L1_FLUSH_CTL_3D_DATAPORT_FLUSH_EVENTS_MASK        REG_GENMASK(13, 11)
1084 #define ICL_HDC_MODE                            _MMIO(0xe5f4)
1085
1086 #define EU_PERF_CNTL2                           _MMIO(0xe658)
1087 #define EU_PERF_CNTL6                           _MMIO(0xe65c)
1088 #define EU_PERF_CNTL3                           _MMIO(0xe758)
1089
1090 #define LSC_CHICKEN_BIT_0                       _MMIO(0xe7c8)
1091 #define   FORCE_1_SUB_MESSAGE_PER_FRAGMENT      REG_BIT(15)
1092 #define LSC_CHICKEN_BIT_0_UDW                   _MMIO(0xe7c8 + 4)
1093 #define   DIS_CHAIN_2XSIMD8                     REG_BIT(55 - 32)
1094 #define   FORCE_SLM_FENCE_SCOPE_TO_TILE         REG_BIT(42 - 32)
1095 #define   FORCE_UGM_FENCE_SCOPE_TO_TILE         REG_BIT(41 - 32)
1096 #define   MAXREQS_PER_BANK                      REG_GENMASK(39 - 32, 37 - 32)
1097 #define   DISABLE_128B_EVICTION_COMMAND_UDW     REG_BIT(36 - 32)
1098
1099 #define SARB_CHICKEN1                           _MMIO(0xe90c)
1100 #define   COMP_CKN_IN                           REG_GENMASK(30, 29)
1101
1102 #define GEN7_HALF_SLICE_CHICKEN1_GT2            _MMIO(0xf100)
1103
1104 #define GEN7_ROW_CHICKEN2_GT2                   _MMIO(0xf4f4)
1105 #define   DOP_CLOCK_GATING_DISABLE              (1 << 0)
1106 #define   PUSH_CONSTANT_DEREF_DISABLE           (1 << 8)
1107 #define   GEN11_TDL_CLOCK_GATING_FIX_DISABLE    (1 << 1)
1108
1109 #define __GEN11_VCS2_MOCS0                      0x10000
1110 #define GEN11_MFX2_MOCS(i)                      _MMIO(__GEN11_VCS2_MOCS0 + (i) * 4)
1111
1112 #define CRSTANDVID                              _MMIO(0x11100)
1113 #define PXVFREQ(fstart)                         _MMIO(0x11110 + (fstart) * 4)  /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
1114 #define   PXVFREQ_PX_MASK                       0x7f000000
1115 #define   PXVFREQ_PX_SHIFT                      24
1116 #define VIDFREQ_BASE                            _MMIO(0x11110)
1117 #define VIDFREQ1                                _MMIO(0x11110) /* VIDFREQ1-4 (0x1111c) (Cantiga) */
1118 #define VIDFREQ2                                _MMIO(0x11114)
1119 #define VIDFREQ3                                _MMIO(0x11118)
1120 #define VIDFREQ4                                _MMIO(0x1111c)
1121 #define   VIDFREQ_P0_MASK                       0x1f000000
1122 #define   VIDFREQ_P0_SHIFT                      24
1123 #define   VIDFREQ_P0_CSCLK_MASK                 0x00f00000
1124 #define   VIDFREQ_P0_CSCLK_SHIFT                20
1125 #define   VIDFREQ_P0_CRCLK_MASK                 0x000f0000
1126 #define   VIDFREQ_P0_CRCLK_SHIFT                16
1127 #define   VIDFREQ_P1_MASK                       0x00001f00
1128 #define   VIDFREQ_P1_SHIFT                      8
1129 #define   VIDFREQ_P1_CSCLK_MASK                 0x000000f0
1130 #define   VIDFREQ_P1_CSCLK_SHIFT                4
1131 #define   VIDFREQ_P1_CRCLK_MASK                 0x0000000f
1132 #define INTTOEXT_BASE                           _MMIO(0x11120) /* INTTOEXT1-8 (0x1113c) */
1133 #define   INTTOEXT_MAP3_SHIFT                   24
1134 #define   INTTOEXT_MAP3_MASK                    (0x1f << INTTOEXT_MAP3_SHIFT)
1135 #define   INTTOEXT_MAP2_SHIFT                   16
1136 #define   INTTOEXT_MAP2_MASK                    (0x1f << INTTOEXT_MAP2_SHIFT)
1137 #define   INTTOEXT_MAP1_SHIFT                   8
1138 #define   INTTOEXT_MAP1_MASK                    (0x1f << INTTOEXT_MAP1_SHIFT)
1139 #define   INTTOEXT_MAP0_SHIFT                   0
1140 #define   INTTOEXT_MAP0_MASK                    (0x1f << INTTOEXT_MAP0_SHIFT)
1141 #define MEMSWCTL                                _MMIO(0x11170) /* Ironlake only */
1142 #define   MEMCTL_CMD_MASK                       0xe000
1143 #define   MEMCTL_CMD_SHIFT                      13
1144 #define   MEMCTL_CMD_RCLK_OFF                   0
1145 #define   MEMCTL_CMD_RCLK_ON                    1
1146 #define   MEMCTL_CMD_CHFREQ                     2
1147 #define   MEMCTL_CMD_CHVID                      3
1148 #define   MEMCTL_CMD_VMMOFF                     4
1149 #define   MEMCTL_CMD_VMMON                      5
1150 #define   MEMCTL_CMD_STS                        (1 << 12) /* write 1 triggers command, clears
1151                                                              when command complete */
1152 #define   MEMCTL_FREQ_MASK                      0x0f00 /* jitter, from 0-15 */
1153 #define   MEMCTL_FREQ_SHIFT                     8
1154 #define   MEMCTL_SFCAVM                         (1 << 7)
1155 #define   MEMCTL_TGT_VID_MASK                   0x007f
1156 #define MEMIHYST                                _MMIO(0x1117c)
1157 #define MEMINTREN                               _MMIO(0x11180) /* 16 bits */
1158 #define   MEMINT_RSEXIT_EN                      (1 << 8)
1159 #define   MEMINT_CX_SUPR_EN                     (1 << 7)
1160 #define   MEMINT_CONT_BUSY_EN                   (1 << 6)
1161 #define   MEMINT_AVG_BUSY_EN                    (1 << 5)
1162 #define   MEMINT_EVAL_CHG_EN                    (1 << 4)
1163 #define   MEMINT_MON_IDLE_EN                    (1 << 3)
1164 #define   MEMINT_UP_EVAL_EN                     (1 << 2)
1165 #define   MEMINT_DOWN_EVAL_EN                   (1 << 1)
1166 #define   MEMINT_SW_CMD_EN                      (1 << 0)
1167 #define MEMINTRSTR                              _MMIO(0x11182) /* 16 bits */
1168 #define   MEM_RSEXIT_MASK                       0xc000
1169 #define   MEM_RSEXIT_SHIFT                      14
1170 #define   MEM_CONT_BUSY_MASK                    0x3000
1171 #define   MEM_CONT_BUSY_SHIFT                   12
1172 #define   MEM_AVG_BUSY_MASK                     0x0c00
1173 #define   MEM_AVG_BUSY_SHIFT                    10
1174 #define   MEM_EVAL_CHG_MASK                     0x0300
1175 #define   MEM_EVAL_BUSY_SHIFT                   8
1176 #define   MEM_MON_IDLE_MASK                     0x00c0
1177 #define   MEM_MON_IDLE_SHIFT                    6
1178 #define   MEM_UP_EVAL_MASK                      0x0030
1179 #define   MEM_UP_EVAL_SHIFT                     4
1180 #define   MEM_DOWN_EVAL_MASK                    0x000c
1181 #define   MEM_DOWN_EVAL_SHIFT                   2
1182 #define   MEM_SW_CMD_MASK                       0x0003
1183 #define   MEM_INT_STEER_GFX                     0
1184 #define   MEM_INT_STEER_CMR                     1
1185 #define   MEM_INT_STEER_SMI                     2
1186 #define   MEM_INT_STEER_SCI                     3
1187 #define MEMINTRSTS                              _MMIO(0x11184)
1188 #define   MEMINT_RSEXIT                         (1 << 7)
1189 #define   MEMINT_CONT_BUSY                      (1 << 6)
1190 #define   MEMINT_AVG_BUSY                       (1 << 5)
1191 #define   MEMINT_EVAL_CHG                       (1 << 4)
1192 #define   MEMINT_MON_IDLE                       (1 << 3)
1193 #define   MEMINT_UP_EVAL                        (1 << 2)
1194 #define   MEMINT_DOWN_EVAL                      (1 << 1)
1195 #define   MEMINT_SW_CMD                         (1 << 0)
1196 #define MEMMODECTL                              _MMIO(0x11190)
1197 #define   MEMMODE_BOOST_EN                      (1 << 31)
1198 #define   MEMMODE_BOOST_FREQ_MASK               0x0f000000 /* jitter for boost, 0-15 */
1199 #define   MEMMODE_BOOST_FREQ_SHIFT              24
1200 #define   MEMMODE_IDLE_MODE_MASK                0x00030000
1201 #define   MEMMODE_IDLE_MODE_SHIFT               16
1202 #define   MEMMODE_IDLE_MODE_EVAL                0
1203 #define   MEMMODE_IDLE_MODE_CONT                1
1204 #define   MEMMODE_HWIDLE_EN                     (1 << 15)
1205 #define   MEMMODE_SWMODE_EN                     (1 << 14)
1206 #define   MEMMODE_RCLK_GATE                     (1 << 13)
1207 #define   MEMMODE_HW_UPDATE                     (1 << 12)
1208 #define   MEMMODE_FSTART_MASK                   0x00000f00 /* starting jitter, 0-15 */
1209 #define   MEMMODE_FSTART_SHIFT                  8
1210 #define   MEMMODE_FMAX_MASK                     0x000000f0 /* max jitter, 0-15 */
1211 #define   MEMMODE_FMAX_SHIFT                    4
1212 #define   MEMMODE_FMIN_MASK                     0x0000000f /* min jitter, 0-15 */
1213 #define RCBMAXAVG                               _MMIO(0x1119c)
1214 #define MEMSWCTL2                               _MMIO(0x1119e) /* Cantiga only */
1215 #define   SWMEMCMD_RENDER_OFF                   (0 << 13)
1216 #define   SWMEMCMD_RENDER_ON                    (1 << 13)
1217 #define   SWMEMCMD_SWFREQ                       (2 << 13)
1218 #define   SWMEMCMD_TARVID                       (3 << 13)
1219 #define   SWMEMCMD_VRM_OFF                      (4 << 13)
1220 #define   SWMEMCMD_VRM_ON                       (5 << 13)
1221 #define   CMDSTS                                (1 << 12)
1222 #define   SFCAVM                                (1 << 11)
1223 #define   SWFREQ_MASK                           0x0380 /* P0-7 */
1224 #define   SWFREQ_SHIFT                          7
1225 #define   TARVID_MASK                           0x001f
1226 #define MEMSTAT_CTG                             _MMIO(0x111a0)
1227 #define RCBMINAVG                               _MMIO(0x111a0)
1228 #define RCUPEI                                  _MMIO(0x111b0)
1229 #define RCDNEI                                  _MMIO(0x111b4)
1230 #define RSTDBYCTL                               _MMIO(0x111b8)
1231 #define   RS1EN                                 (1 << 31)
1232 #define   RS2EN                                 (1 << 30)
1233 #define   RS3EN                                 (1 << 29)
1234 #define   D3RS3EN                               (1 << 28) /* Display D3 imlies RS3 */
1235 #define   SWPROMORSX                            (1 << 27) /* RSx promotion timers ignored */
1236 #define   RCWAKERW                              (1 << 26) /* Resetwarn from PCH causes wakeup */
1237 #define   DPRSLPVREN                            (1 << 25) /* Fast voltage ramp enable */
1238 #define   GFXTGHYST                             (1 << 24) /* Hysteresis to allow trunk gating */
1239 #define   RCX_SW_EXIT                           (1 << 23) /* Leave RSx and prevent re-entry */
1240 #define   RSX_STATUS_MASK                       (7 << 20)
1241 #define   RSX_STATUS_ON                         (0 << 20)
1242 #define   RSX_STATUS_RC1                        (1 << 20)
1243 #define   RSX_STATUS_RC1E                       (2 << 20)
1244 #define   RSX_STATUS_RS1                        (3 << 20)
1245 #define   RSX_STATUS_RS2                        (4 << 20) /* aka rc6 */
1246 #define   RSX_STATUS_RSVD                       (5 << 20) /* deep rc6 unsupported on ilk */
1247 #define   RSX_STATUS_RS3                        (6 << 20) /* rs3 unsupported on ilk */
1248 #define   RSX_STATUS_RSVD2                      (7 << 20)
1249 #define   UWRCRSXE                              (1 << 19) /* wake counter limit prevents rsx */
1250 #define   RSCRP                                 (1 << 18) /* rs requests control on rs1/2 reqs */
1251 #define   JRSC                                  (1 << 17) /* rsx coupled to cpu c-state */
1252 #define   RS2INC0                               (1 << 16) /* allow rs2 in cpu c0 */
1253 #define   RS1CONTSAV_MASK                       (3 << 14)
1254 #define   RS1CONTSAV_NO_RS1                     (0 << 14) /* rs1 doesn't save/restore context */
1255 #define   RS1CONTSAV_RSVD                       (1 << 14)
1256 #define   RS1CONTSAV_SAVE_RS1                   (2 << 14) /* rs1 saves context */
1257 #define   RS1CONTSAV_FULL_RS1                   (3 << 14) /* rs1 saves and restores context */
1258 #define   NORMSLEXLAT_MASK                      (3 << 12)
1259 #define   SLOW_RS123                            (0 << 12)
1260 #define   SLOW_RS23                             (1 << 12)
1261 #define   SLOW_RS3                              (2 << 12)
1262 #define   NORMAL_RS123                          (3 << 12)
1263 #define   RCMODE_TIMEOUT                        (1 << 11) /* 0 is eval interval method */
1264 #define   IMPROMOEN                             (1 << 10) /* promo is immediate or delayed until next idle interval (only for timeout method above) */
1265 #define   RCENTSYNC                             (1 << 9) /* rs coupled to cpu c-state (3/6/7) */
1266 #define   STATELOCK                             (1 << 7) /* locked to rs_cstate if 0 */
1267 #define   RS_CSTATE_MASK                        (3 << 4)
1268 #define   RS_CSTATE_C367_RS1                    (0 << 4)
1269 #define   RS_CSTATE_C36_RS1_C7_RS2              (1 << 4)
1270 #define   RS_CSTATE_RSVD                        (2 << 4)
1271 #define   RS_CSTATE_C367_RS2                    (3 << 4)
1272 #define   REDSAVES                              (1 << 3) /* no context save if was idle during rs0 */
1273 #define   REDRESTORES                           (1 << 2) /* no restore if was idle during rs0 */
1274 #define VIDCTL                                  _MMIO(0x111c0)
1275 #define VIDSTS                                  _MMIO(0x111c8)
1276 #define VIDSTART                                _MMIO(0x111cc) /* 8 bits */
1277 #define MEMSTAT_ILK                             _MMIO(0x111f8)
1278 #define   MEMSTAT_VID_MASK                      0x7f00
1279 #define   MEMSTAT_VID_SHIFT                     8
1280 #define   MEMSTAT_PSTATE_MASK                   0x00f8
1281 #define   MEMSTAT_PSTATE_SHIFT                  3
1282 #define   MEMSTAT_MON_ACTV                      (1 << 2)
1283 #define   MEMSTAT_SRC_CTL_MASK                  0x0003
1284 #define   MEMSTAT_SRC_CTL_CORE                  0
1285 #define   MEMSTAT_SRC_CTL_TRB                   1
1286 #define   MEMSTAT_SRC_CTL_THM                   2
1287 #define   MEMSTAT_SRC_CTL_STDBY                 3
1288 #define PMMISC                                  _MMIO(0x11214)
1289 #define   MCPPCE_EN                             (1 << 0) /* enable PM_MSG from PCH->MPC */
1290 #define SDEW                                    _MMIO(0x1124c)
1291 #define CSIEW0                                  _MMIO(0x11250)
1292 #define CSIEW1                                  _MMIO(0x11254)
1293 #define CSIEW2                                  _MMIO(0x11258)
1294 #define PEW(i)                                  _MMIO(0x1125c + (i) * 4) /* 5 registers */
1295 #define DEW(i)                                  _MMIO(0x11270 + (i) * 4) /* 3 registers */
1296 #define MCHAFE                                  _MMIO(0x112c0)
1297 #define CSIEC                                   _MMIO(0x112e0)
1298 #define DMIEC                                   _MMIO(0x112e4)
1299 #define DDREC                                   _MMIO(0x112e8)
1300 #define PEG0EC                                  _MMIO(0x112ec)
1301 #define PEG1EC                                  _MMIO(0x112f0)
1302 #define GFXEC                                   _MMIO(0x112f4)
1303 #define INTTOEXT_BASE_ILK                       _MMIO(0x11300)
1304 #define RPPREVBSYTUPAVG                         _MMIO(0x113b8)
1305 #define RCPREVBSYTUPAVG                         _MMIO(0x113b8)
1306 #define RCPREVBSYTDNAVG                         _MMIO(0x113bc)
1307 #define RPPREVBSYTDNAVG                         _MMIO(0x113bc)
1308 #define ECR                                     _MMIO(0x11600)
1309 #define   ECR_GPFE                              (1 << 31)
1310 #define   ECR_IMONE                             (1 << 30)
1311 #define   ECR_CAP_MASK                          0x0000001f /* Event range, 0-31 */
1312 #define OGW0                                    _MMIO(0x11608)
1313 #define OGW1                                    _MMIO(0x1160c)
1314 #define EG0                                     _MMIO(0x11610)
1315 #define EG1                                     _MMIO(0x11614)
1316 #define EG2                                     _MMIO(0x11618)
1317 #define EG3                                     _MMIO(0x1161c)
1318 #define EG4                                     _MMIO(0x11620)
1319 #define EG5                                     _MMIO(0x11624)
1320 #define EG6                                     _MMIO(0x11628)
1321 #define EG7                                     _MMIO(0x1162c)
1322 #define PXW(i)                                  _MMIO(0x11664 + (i) * 4) /* 4 registers */
1323 #define PXWL(i)                                 _MMIO(0x11680 + (i) * 8) /* 8 registers */
1324 #define LCFUSE02                                _MMIO(0x116c0)
1325 #define   LCFUSE_HIV_MASK                       0x000000ff
1326
1327 #define GAC_ECO_BITS                            _MMIO(0x14090)
1328 #define   ECOBITS_SNB_BIT                       (1 << 13)
1329 #define   ECOBITS_PPGTT_CACHE64B                (3 << 8)
1330 #define   ECOBITS_PPGTT_CACHE4B                 (0 << 8)
1331
1332 #define GEN12_RCU_MODE                          _MMIO(0x14800)
1333 #define   GEN12_RCU_MODE_CCS_ENABLE             REG_BIT(0)
1334
1335 #define CHV_FUSE_GT                             _MMIO(VLV_DISPLAY_BASE + 0x2168)
1336 #define   CHV_FGT_DISABLE_SS0                   (1 << 10)
1337 #define   CHV_FGT_DISABLE_SS1                   (1 << 11)
1338 #define   CHV_FGT_EU_DIS_SS0_R0_SHIFT           16
1339 #define   CHV_FGT_EU_DIS_SS0_R0_MASK            (0xf << CHV_FGT_EU_DIS_SS0_R0_SHIFT)
1340 #define   CHV_FGT_EU_DIS_SS0_R1_SHIFT           20
1341 #define   CHV_FGT_EU_DIS_SS0_R1_MASK            (0xf << CHV_FGT_EU_DIS_SS0_R1_SHIFT)
1342 #define   CHV_FGT_EU_DIS_SS1_R0_SHIFT           24
1343 #define   CHV_FGT_EU_DIS_SS1_R0_MASK            (0xf << CHV_FGT_EU_DIS_SS1_R0_SHIFT)
1344 #define   CHV_FGT_EU_DIS_SS1_R1_SHIFT           28
1345 #define   CHV_FGT_EU_DIS_SS1_R1_MASK            (0xf << CHV_FGT_EU_DIS_SS1_R1_SHIFT)
1346
1347 #define BCS_SWCTRL                              _MMIO(0x22200)
1348 #define   BCS_SRC_Y                             REG_BIT(0)
1349 #define   BCS_DST_Y                             REG_BIT(1)
1350
1351 #define GAB_CTL                                 _MMIO(0x24000)
1352 #define   GAB_CTL_CONT_AFTER_PAGEFAULT          (1 << 8)
1353
1354 #define GEN6_PMISR                              _MMIO(0x44020)
1355 #define GEN6_PMIMR                              _MMIO(0x44024) /* rps_lock */
1356 #define GEN6_PMIIR                              _MMIO(0x44028)
1357 #define GEN6_PMIER                              _MMIO(0x4402c)
1358 #define   GEN6_PM_MBOX_EVENT                    (1 << 25)
1359 #define   GEN6_PM_THERMAL_EVENT                 (1 << 24)
1360 /*
1361  * For Gen11 these are in the upper word of the GPM_WGBOXPERF
1362  * registers. Shifting is handled on accessing the imr and ier.
1363  */
1364 #define   GEN6_PM_RP_DOWN_TIMEOUT               (1 << 6)
1365 #define   GEN6_PM_RP_UP_THRESHOLD               (1 << 5)
1366 #define   GEN6_PM_RP_DOWN_THRESHOLD             (1 << 4)
1367 #define   GEN6_PM_RP_UP_EI_EXPIRED              (1 << 2)
1368 #define   GEN6_PM_RP_DOWN_EI_EXPIRED            (1 << 1)
1369 #define   GEN6_PM_RPS_EVENTS                    (GEN6_PM_RP_UP_EI_EXPIRED   | \
1370                                                  GEN6_PM_RP_UP_THRESHOLD    | \
1371                                                  GEN6_PM_RP_DOWN_EI_EXPIRED | \
1372                                                  GEN6_PM_RP_DOWN_THRESHOLD  | \
1373                                                  GEN6_PM_RP_DOWN_TIMEOUT)
1374
1375 #define GEN7_GT_SCRATCH(i)                      _MMIO(0x4f100 + (i) * 4)
1376 #define   GEN7_GT_SCRATCH_REG_NUM               8
1377
1378 #define GFX_FLSH_CNTL_GEN6                      _MMIO(0x101008)
1379 #define   GFX_FLSH_CNTL_EN                      (1 << 0)
1380
1381 #define GTFIFODBG                               _MMIO(0x120000)
1382 #define   GT_FIFO_SBDEDICATE_FREE_ENTRY_CHV     (0x1f << 20)
1383 #define   GT_FIFO_FREE_ENTRIES_CHV              (0x7f << 13)
1384 #define   GT_FIFO_SBDROPERR                     (1 << 6)
1385 #define   GT_FIFO_BLOBDROPERR                   (1 << 5)
1386 #define   GT_FIFO_SB_READ_ABORTERR              (1 << 4)
1387 #define   GT_FIFO_DROPERR                       (1 << 3)
1388 #define   GT_FIFO_OVFERR                        (1 << 2)
1389 #define   GT_FIFO_IAWRERR                       (1 << 1)
1390 #define   GT_FIFO_IARDERR                       (1 << 0)
1391
1392 #define GTFIFOCTL                               _MMIO(0x120008)
1393 #define   GT_FIFO_FREE_ENTRIES_MASK             0x7f
1394 #define   GT_FIFO_NUM_RESERVED_ENTRIES          20
1395 #define   GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL    (1 << 12)
1396 #define   GT_FIFO_CTL_RC6_POLICY_STALL          (1 << 11)
1397
1398 #define FORCEWAKE_MT_ACK                        _MMIO(0x130040)
1399 #define FORCEWAKE_ACK_HSW                       _MMIO(0x130044)
1400 #define FORCEWAKE_ACK_GT_GEN9                   _MMIO(0x130044)
1401 #define   FORCEWAKE_KERNEL                      BIT(0)
1402 #define   FORCEWAKE_USER                        BIT(1)
1403 #define   FORCEWAKE_KERNEL_FALLBACK             BIT(15)
1404 #define FORCEWAKE_ACK                           _MMIO(0x130090)
1405 #define VLV_GTLC_WAKE_CTRL                      _MMIO(0x130090)
1406 #define   VLV_GTLC_RENDER_CTX_EXISTS            (1 << 25)
1407 #define   VLV_GTLC_MEDIA_CTX_EXISTS             (1 << 24)
1408 #define   VLV_GTLC_ALLOWWAKEREQ                 (1 << 0)
1409 #define VLV_GTLC_PW_STATUS                      _MMIO(0x130094)
1410 #define   VLV_GTLC_ALLOWWAKEACK                 (1 << 0)
1411 #define   VLV_GTLC_ALLOWWAKEERR                 (1 << 1)
1412 #define   VLV_GTLC_PW_MEDIA_STATUS_MASK         (1 << 5)
1413 #define   VLV_GTLC_PW_RENDER_STATUS_MASK        (1 << 7)
1414 #define VLV_GTLC_SURVIVABILITY_REG              _MMIO(0x130098)
1415 #define   VLV_GFX_CLK_STATUS_BIT                (1 << 3)
1416 #define   VLV_GFX_CLK_FORCE_ON_BIT              (1 << 2)
1417 #define FORCEWAKE_VLV                           _MMIO(0x1300b0)
1418 #define FORCEWAKE_ACK_VLV                       _MMIO(0x1300b4)
1419 #define FORCEWAKE_MEDIA_VLV                     _MMIO(0x1300b8)
1420 #define FORCEWAKE_ACK_MEDIA_VLV                 _MMIO(0x1300bc)
1421
1422 #define GEN6_GT_THREAD_STATUS_REG               _MMIO(0x13805c)
1423 #define   GEN6_GT_THREAD_STATUS_CORE_MASK       0x7
1424
1425 #define GEN6_GT_CORE_STATUS                     _MMIO(0x138060)
1426 #define   GEN6_CORE_CPD_STATE_MASK              (7 << 4)
1427 #define   GEN6_RCn_MASK                         7
1428 #define   GEN6_RC0                              0
1429 #define   GEN6_RC3                              2
1430 #define   GEN6_RC6                              3
1431 #define   GEN6_RC7                              4
1432
1433 #define GEN8_GT_SLICE_INFO                      _MMIO(0x138064)
1434 #define   GEN8_LSLICESTAT_MASK                  0x7
1435
1436 #define GEN6_GT_GFX_RC6_LOCKED                  _MMIO(0x138104)
1437 #define VLV_COUNTER_CONTROL                     _MMIO(0x138104)
1438 #define   VLV_COUNT_RANGE_HIGH                  (1 << 15)
1439 #define   VLV_MEDIA_RC0_COUNT_EN                (1 << 5)
1440 #define   VLV_RENDER_RC0_COUNT_EN               (1 << 4)
1441 #define   VLV_MEDIA_RC6_COUNT_EN                (1 << 1)
1442 #define   VLV_RENDER_RC6_COUNT_EN               (1 << 0)
1443 #define GEN6_GT_GFX_RC6                         _MMIO(0x138108)
1444 #define VLV_GT_RENDER_RC6                       _MMIO(0x138108)
1445 #define VLV_GT_MEDIA_RC6                        _MMIO(0x13810c)
1446
1447 #define GEN6_GT_GFX_RC6p                        _MMIO(0x13810c)
1448 #define GEN6_GT_GFX_RC6pp                       _MMIO(0x138110)
1449 #define VLV_RENDER_C0_COUNT                     _MMIO(0x138118)
1450 #define VLV_MEDIA_C0_COUNT                      _MMIO(0x13811c)
1451
1452 #define GEN11_GT_INTR_DW(x)                     _MMIO(0x190018 + ((x) * 4))
1453 #define   GEN11_CSME                            (31)
1454 #define   GEN11_GUNIT                           (28)
1455 #define   GEN11_GUC                             (25)
1456 #define   GEN11_WDPERF                          (20)
1457 #define   GEN11_KCR                             (19)
1458 #define   GEN11_GTPM                            (16)
1459 #define   GEN11_BCS                             (15)
1460 #define   GEN12_CCS3                            (7)
1461 #define   GEN12_CCS2                            (6)
1462 #define   GEN12_CCS1                            (5)
1463 #define   GEN12_CCS0                            (4)
1464 #define   GEN11_RCS0                            (0)
1465 #define   GEN11_VECS(x)                         (31 - (x))
1466 #define   GEN11_VCS(x)                          (x)
1467
1468 #define GEN11_RENDER_COPY_INTR_ENABLE           _MMIO(0x190030)
1469 #define GEN11_VCS_VECS_INTR_ENABLE              _MMIO(0x190034)
1470 #define GEN11_GUC_SG_INTR_ENABLE                _MMIO(0x190038)
1471 #define   ENGINE1_MASK                          REG_GENMASK(31, 16)
1472 #define   ENGINE0_MASK                          REG_GENMASK(15, 0)
1473 #define GEN11_GPM_WGBOXPERF_INTR_ENABLE         _MMIO(0x19003c)
1474 #define GEN11_CRYPTO_RSVD_INTR_ENABLE           _MMIO(0x190040)
1475 #define GEN11_GUNIT_CSME_INTR_ENABLE            _MMIO(0x190044)
1476 #define GEN12_CCS_RSVD_INTR_ENABLE              _MMIO(0x190048)
1477
1478 #define GEN11_INTR_IDENTITY_REG(x)              _MMIO(0x190060 + ((x) * 4))
1479 #define   GEN11_INTR_DATA_VALID                 (1 << 31)
1480 #define   GEN11_INTR_ENGINE_CLASS(x)            (((x) & GENMASK(18, 16)) >> 16)
1481 #define   GEN11_INTR_ENGINE_INSTANCE(x)         (((x) & GENMASK(25, 20)) >> 20)
1482 #define   GEN11_INTR_ENGINE_INTR(x)             ((x) & 0xffff)
1483 /* irq instances for OTHER_CLASS */
1484 #define   OTHER_GUC_INSTANCE                    0
1485 #define   OTHER_GTPM_INSTANCE                   1
1486 #define   OTHER_KCR_INSTANCE                    4
1487
1488 #define GEN11_IIR_REG_SELECTOR(x)               _MMIO(0x190070 + ((x) * 4))
1489
1490 #define GEN11_RCS0_RSVD_INTR_MASK               _MMIO(0x190090)
1491 #define GEN11_BCS_RSVD_INTR_MASK                _MMIO(0x1900a0)
1492 #define GEN11_VCS0_VCS1_INTR_MASK               _MMIO(0x1900a8)
1493 #define GEN11_VCS2_VCS3_INTR_MASK               _MMIO(0x1900ac)
1494 #define GEN12_VCS4_VCS5_INTR_MASK               _MMIO(0x1900b0)
1495 #define GEN12_VCS6_VCS7_INTR_MASK               _MMIO(0x1900b4)
1496 #define GEN11_VECS0_VECS1_INTR_MASK             _MMIO(0x1900d0)
1497 #define GEN12_VECS2_VECS3_INTR_MASK             _MMIO(0x1900d4)
1498 #define GEN11_GUC_SG_INTR_MASK                  _MMIO(0x1900e8)
1499 #define GEN11_GPM_WGBOXPERF_INTR_MASK           _MMIO(0x1900ec)
1500 #define GEN11_CRYPTO_RSVD_INTR_MASK             _MMIO(0x1900f0)
1501 #define GEN11_GUNIT_CSME_INTR_MASK              _MMIO(0x1900f4)
1502 #define GEN12_CCS0_CCS1_INTR_MASK               _MMIO(0x190100)
1503 #define GEN12_CCS2_CCS3_INTR_MASK               _MMIO(0x190104)
1504
1505 #define GEN12_SFC_DONE(n)                       _MMIO(0x1cc000 + (n) * 0x1000)
1506
1507 #endif /* __INTEL_GT_REGS__ */