xref: /dragonfly/sys/dev/drm/radeon/nid.h (revision b29f78b5)
1 /*
2  * Copyright 2010 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: Alex Deucher
23  *
24  * $FreeBSD: head/sys/dev/drm2/radeon/nid.h 254885 2013-08-25 19:37:15Z dumbbell $
25  */
26 #ifndef NI_H
27 #define NI_H
28 
29 #define CAYMAN_MAX_SH_GPRS           256
30 #define CAYMAN_MAX_TEMP_GPRS         16
31 #define CAYMAN_MAX_SH_THREADS        256
32 #define CAYMAN_MAX_SH_STACK_ENTRIES  4096
33 #define CAYMAN_MAX_FRC_EOV_CNT       16384
34 #define CAYMAN_MAX_BACKENDS          8
35 #define CAYMAN_MAX_BACKENDS_MASK     0xFF
36 #define CAYMAN_MAX_BACKENDS_PER_SE_MASK 0xF
37 #define CAYMAN_MAX_SIMDS             16
38 #define CAYMAN_MAX_SIMDS_MASK        0xFFFF
39 #define CAYMAN_MAX_SIMDS_PER_SE_MASK 0xFFF
40 #define CAYMAN_MAX_PIPES             8
41 #define CAYMAN_MAX_PIPES_MASK        0xFF
42 #define CAYMAN_MAX_LDS_NUM           0xFFFF
43 #define CAYMAN_MAX_TCC               16
44 #define CAYMAN_MAX_TCC_MASK          0xFF
45 
46 #define CAYMAN_GB_ADDR_CONFIG_GOLDEN       0x02011003
47 #define ARUBA_GB_ADDR_CONFIG_GOLDEN        0x12010001
48 
49 #define DMIF_ADDR_CONFIG  				0xBD4
50 #define	SRBM_GFX_CNTL				        0x0E44
51 #define		RINGID(x)					(((x) & 0x3) << 0)
52 #define		VMID(x)						(((x) & 0x7) << 0)
53 #define	SRBM_STATUS				        0x0E50
54 #define		RLC_RQ_PENDING 				(1 << 3)
55 #define		GRBM_RQ_PENDING 			(1 << 5)
56 #define		VMC_BUSY 				(1 << 8)
57 #define		MCB_BUSY 				(1 << 9)
58 #define		MCB_NON_DISPLAY_BUSY 			(1 << 10)
59 #define		MCC_BUSY 				(1 << 11)
60 #define		MCD_BUSY 				(1 << 12)
61 #define		SEM_BUSY 				(1 << 14)
62 #define		RLC_BUSY 				(1 << 15)
63 #define		IH_BUSY 				(1 << 17)
64 
65 #define	SRBM_SOFT_RESET				        0x0E60
66 #define		SOFT_RESET_BIF				(1 << 1)
67 #define		SOFT_RESET_CG				(1 << 2)
68 #define		SOFT_RESET_DC				(1 << 5)
69 #define		SOFT_RESET_DMA1				(1 << 6)
70 #define		SOFT_RESET_GRBM				(1 << 8)
71 #define		SOFT_RESET_HDP				(1 << 9)
72 #define		SOFT_RESET_IH				(1 << 10)
73 #define		SOFT_RESET_MC				(1 << 11)
74 #define		SOFT_RESET_RLC				(1 << 13)
75 #define		SOFT_RESET_ROM				(1 << 14)
76 #define		SOFT_RESET_SEM				(1 << 15)
77 #define		SOFT_RESET_VMC				(1 << 17)
78 #define		SOFT_RESET_DMA				(1 << 20)
79 #define		SOFT_RESET_TST				(1 << 21)
80 #define		SOFT_RESET_REGBB			(1 << 22)
81 #define		SOFT_RESET_ORB				(1 << 23)
82 
83 #define	SRBM_STATUS2				        0x0EC4
84 #define		DMA_BUSY 				(1 << 5)
85 #define		DMA1_BUSY 				(1 << 6)
86 
87 #define VM_CONTEXT0_REQUEST_RESPONSE			0x1470
88 #define		REQUEST_TYPE(x)					(((x) & 0xf) << 0)
89 #define		RESPONSE_TYPE_MASK				0x000000F0
90 #define		RESPONSE_TYPE_SHIFT				4
91 #define VM_L2_CNTL					0x1400
92 #define		ENABLE_L2_CACHE					(1 << 0)
93 #define		ENABLE_L2_FRAGMENT_PROCESSING			(1 << 1)
94 #define		ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE		(1 << 9)
95 #define		ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE	(1 << 10)
96 #define		EFFECTIVE_L2_QUEUE_SIZE(x)			(((x) & 7) << 14)
97 #define		CONTEXT1_IDENTITY_ACCESS_MODE(x)		(((x) & 3) << 18)
98 /* CONTEXT1_IDENTITY_ACCESS_MODE
99  * 0 physical = logical
100  * 1 logical via context1 page table
101  * 2 inside identity aperture use translation, outside physical = logical
102  * 3 inside identity aperture physical = logical, outside use translation
103  */
104 #define VM_L2_CNTL2					0x1404
105 #define		INVALIDATE_ALL_L1_TLBS				(1 << 0)
106 #define		INVALIDATE_L2_CACHE				(1 << 1)
107 #define VM_L2_CNTL3					0x1408
108 #define		BANK_SELECT(x)					((x) << 0)
109 #define		CACHE_UPDATE_MODE(x)				((x) << 6)
110 #define		L2_CACHE_BIGK_ASSOCIATIVITY			(1 << 20)
111 #define		L2_CACHE_BIGK_FRAGMENT_SIZE(x)			((x) << 15)
112 #define	VM_L2_STATUS					0x140C
113 #define		L2_BUSY						(1 << 0)
114 #define VM_CONTEXT0_CNTL				0x1410
115 #define		ENABLE_CONTEXT					(1 << 0)
116 #define		PAGE_TABLE_DEPTH(x)				(((x) & 3) << 1)
117 #define		RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 3)
118 #define		RANGE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 4)
119 #define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT	(1 << 6)
120 #define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT	(1 << 7)
121 #define		PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 9)
122 #define		PDE0_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 10)
123 #define		VALID_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 12)
124 #define		VALID_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 13)
125 #define		READ_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 15)
126 #define		READ_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 16)
127 #define		WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 18)
128 #define		WRITE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 19)
129 #define VM_CONTEXT1_CNTL				0x1414
130 #define VM_CONTEXT0_CNTL2				0x1430
131 #define VM_CONTEXT1_CNTL2				0x1434
132 #define VM_INVALIDATE_REQUEST				0x1478
133 #define VM_INVALIDATE_RESPONSE				0x147c
134 #define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR	0x1518
135 #define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR	0x151c
136 #define	VM_CONTEXT0_PAGE_TABLE_BASE_ADDR		0x153C
137 #define	VM_CONTEXT0_PAGE_TABLE_START_ADDR		0x155C
138 #define	VM_CONTEXT0_PAGE_TABLE_END_ADDR			0x157C
139 
140 #define MC_SHARED_CHMAP						0x2004
141 #define		NOOFCHAN_SHIFT					12
142 #define		NOOFCHAN_MASK					0x00003000
143 #define MC_SHARED_CHREMAP					0x2008
144 
145 #define	MC_VM_SYSTEM_APERTURE_LOW_ADDR			0x2034
146 #define	MC_VM_SYSTEM_APERTURE_HIGH_ADDR			0x2038
147 #define	MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR		0x203C
148 #define	MC_VM_MX_L1_TLB_CNTL				0x2064
149 #define		ENABLE_L1_TLB					(1 << 0)
150 #define		ENABLE_L1_FRAGMENT_PROCESSING			(1 << 1)
151 #define		SYSTEM_ACCESS_MODE_PA_ONLY			(0 << 3)
152 #define		SYSTEM_ACCESS_MODE_USE_SYS_MAP			(1 << 3)
153 #define		SYSTEM_ACCESS_MODE_IN_SYS			(2 << 3)
154 #define		SYSTEM_ACCESS_MODE_NOT_IN_SYS			(3 << 3)
155 #define		SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU	(0 << 5)
156 #define		ENABLE_ADVANCED_DRIVER_MODEL			(1 << 6)
157 #define	FUS_MC_VM_FB_OFFSET				0x2068
158 
159 #define MC_SHARED_BLACKOUT_CNTL           		0x20ac
160 #define	MC_ARB_RAMCFG					0x2760
161 #define		NOOFBANK_SHIFT					0
162 #define		NOOFBANK_MASK					0x00000003
163 #define		NOOFRANK_SHIFT					2
164 #define		NOOFRANK_MASK					0x00000004
165 #define		NOOFROWS_SHIFT					3
166 #define		NOOFROWS_MASK					0x00000038
167 #define		NOOFCOLS_SHIFT					6
168 #define		NOOFCOLS_MASK					0x000000C0
169 #define		CHANSIZE_SHIFT					8
170 #define		CHANSIZE_MASK					0x00000100
171 #define		BURSTLENGTH_SHIFT				9
172 #define		BURSTLENGTH_MASK				0x00000200
173 #define		CHANSIZE_OVERRIDE				(1 << 11)
174 #define MC_SEQ_SUP_CNTL           			0x28c8
175 #define		RUN_MASK      				(1 << 0)
176 #define MC_SEQ_SUP_PGM           			0x28cc
177 #define MC_IO_PAD_CNTL_D0           			0x29d0
178 #define		MEM_FALL_OUT_CMD      			(1 << 8)
179 #define MC_SEQ_MISC0           				0x2a00
180 #define		MC_SEQ_MISC0_GDDR5_SHIFT      		28
181 #define		MC_SEQ_MISC0_GDDR5_MASK      		0xf0000000
182 #define		MC_SEQ_MISC0_GDDR5_VALUE      		5
183 #define MC_SEQ_IO_DEBUG_INDEX           		0x2a44
184 #define MC_SEQ_IO_DEBUG_DATA           			0x2a48
185 
186 #define	HDP_HOST_PATH_CNTL				0x2C00
187 #define	HDP_NONSURFACE_BASE				0x2C04
188 #define	HDP_NONSURFACE_INFO				0x2C08
189 #define	HDP_NONSURFACE_SIZE				0x2C0C
190 #define HDP_ADDR_CONFIG  				0x2F48
191 #define HDP_MISC_CNTL					0x2F4C
192 #define 	HDP_FLUSH_INVALIDATE_CACHE			(1 << 0)
193 
194 #define	CC_SYS_RB_BACKEND_DISABLE			0x3F88
195 #define	GC_USER_SYS_RB_BACKEND_DISABLE			0x3F8C
196 #define	CGTS_SYS_TCC_DISABLE				0x3F90
197 #define	CGTS_USER_SYS_TCC_DISABLE			0x3F94
198 
199 #define RLC_GFX_INDEX           			0x3FC4
200 
201 #define	CONFIG_MEMSIZE					0x5428
202 
203 #define HDP_MEM_COHERENCY_FLUSH_CNTL			0x5480
204 #define HDP_REG_COHERENCY_FLUSH_CNTL			0x54A0
205 
206 #define	GRBM_CNTL					0x8000
207 #define		GRBM_READ_TIMEOUT(x)				((x) << 0)
208 #define	GRBM_STATUS					0x8010
209 #define		CMDFIFO_AVAIL_MASK				0x0000000F
210 #define		RING2_RQ_PENDING				(1 << 4)
211 #define		SRBM_RQ_PENDING					(1 << 5)
212 #define		RING1_RQ_PENDING				(1 << 6)
213 #define		CF_RQ_PENDING					(1 << 7)
214 #define		PF_RQ_PENDING					(1 << 8)
215 #define		GDS_DMA_RQ_PENDING				(1 << 9)
216 #define		GRBM_EE_BUSY					(1 << 10)
217 #define		SX_CLEAN					(1 << 11)
218 #define		DB_CLEAN					(1 << 12)
219 #define		CB_CLEAN					(1 << 13)
220 #define		TA_BUSY 					(1 << 14)
221 #define		GDS_BUSY 					(1 << 15)
222 #define		VGT_BUSY_NO_DMA					(1 << 16)
223 #define		VGT_BUSY					(1 << 17)
224 #define		IA_BUSY_NO_DMA					(1 << 18)
225 #define		IA_BUSY						(1 << 19)
226 #define		SX_BUSY 					(1 << 20)
227 #define		SH_BUSY 					(1 << 21)
228 #define		SPI_BUSY					(1 << 22)
229 #define		SC_BUSY 					(1 << 24)
230 #define		PA_BUSY 					(1 << 25)
231 #define		DB_BUSY 					(1 << 26)
232 #define		CP_COHERENCY_BUSY      				(1 << 28)
233 #define		CP_BUSY 					(1 << 29)
234 #define		CB_BUSY 					(1 << 30)
235 #define		GUI_ACTIVE					(1 << 31)
236 #define	GRBM_STATUS_SE0					0x8014
237 #define	GRBM_STATUS_SE1					0x8018
238 #define		SE_SX_CLEAN					(1 << 0)
239 #define		SE_DB_CLEAN					(1 << 1)
240 #define		SE_CB_CLEAN					(1 << 2)
241 #define		SE_VGT_BUSY					(1 << 23)
242 #define		SE_PA_BUSY					(1 << 24)
243 #define		SE_TA_BUSY					(1 << 25)
244 #define		SE_SX_BUSY					(1 << 26)
245 #define		SE_SPI_BUSY					(1 << 27)
246 #define		SE_SH_BUSY					(1 << 28)
247 #define		SE_SC_BUSY					(1 << 29)
248 #define		SE_DB_BUSY					(1 << 30)
249 #define		SE_CB_BUSY					(1 << 31)
250 #define	GRBM_SOFT_RESET					0x8020
251 #define		SOFT_RESET_CP					(1 << 0)
252 #define		SOFT_RESET_CB					(1 << 1)
253 #define		SOFT_RESET_DB					(1 << 3)
254 #define		SOFT_RESET_GDS					(1 << 4)
255 #define		SOFT_RESET_PA					(1 << 5)
256 #define		SOFT_RESET_SC					(1 << 6)
257 #define		SOFT_RESET_SPI					(1 << 8)
258 #define		SOFT_RESET_SH					(1 << 9)
259 #define		SOFT_RESET_SX					(1 << 10)
260 #define		SOFT_RESET_TC					(1 << 11)
261 #define		SOFT_RESET_TA					(1 << 12)
262 #define		SOFT_RESET_VGT					(1 << 14)
263 #define		SOFT_RESET_IA					(1 << 15)
264 
265 #define GRBM_GFX_INDEX          			0x802C
266 #define		INSTANCE_INDEX(x)			((x) << 0)
267 #define		SE_INDEX(x)     			((x) << 16)
268 #define		INSTANCE_BROADCAST_WRITES      		(1 << 30)
269 #define		SE_BROADCAST_WRITES      		(1 << 31)
270 
271 #define	SCRATCH_REG0					0x8500
272 #define	SCRATCH_REG1					0x8504
273 #define	SCRATCH_REG2					0x8508
274 #define	SCRATCH_REG3					0x850C
275 #define	SCRATCH_REG4					0x8510
276 #define	SCRATCH_REG5					0x8514
277 #define	SCRATCH_REG6					0x8518
278 #define	SCRATCH_REG7					0x851C
279 #define	SCRATCH_UMSK					0x8540
280 #define	SCRATCH_ADDR					0x8544
281 #define	CP_SEM_WAIT_TIMER				0x85BC
282 #define	CP_SEM_INCOMPLETE_TIMER_CNTL			0x85C8
283 #define	CP_COHER_CNTL2					0x85E8
284 #define	CP_STALLED_STAT1			0x8674
285 #define	CP_STALLED_STAT2			0x8678
286 #define	CP_BUSY_STAT				0x867C
287 #define	CP_STAT						0x8680
288 #define CP_ME_CNTL					0x86D8
289 #define		CP_ME_HALT					(1 << 28)
290 #define		CP_PFP_HALT					(1 << 26)
291 #define	CP_RB2_RPTR					0x86f8
292 #define	CP_RB1_RPTR					0x86fc
293 #define	CP_RB0_RPTR					0x8700
294 #define	CP_RB_WPTR_DELAY				0x8704
295 #define CP_MEQ_THRESHOLDS				0x8764
296 #define		MEQ1_START(x)				((x) << 0)
297 #define		MEQ2_START(x)				((x) << 8)
298 #define	CP_PERFMON_CNTL					0x87FC
299 
300 #define	VGT_CACHE_INVALIDATION				0x88C4
301 #define		CACHE_INVALIDATION(x)				((x) << 0)
302 #define			VC_ONLY						0
303 #define			TC_ONLY						1
304 #define			VC_AND_TC					2
305 #define		AUTO_INVLD_EN(x)				((x) << 6)
306 #define			NO_AUTO						0
307 #define			ES_AUTO						1
308 #define			GS_AUTO						2
309 #define			ES_AND_GS_AUTO					3
310 #define	VGT_GS_VERTEX_REUSE				0x88D4
311 
312 #define CC_GC_SHADER_PIPE_CONFIG			0x8950
313 #define	GC_USER_SHADER_PIPE_CONFIG			0x8954
314 #define		INACTIVE_QD_PIPES(x)				((x) << 8)
315 #define		INACTIVE_QD_PIPES_MASK				0x0000FF00
316 #define		INACTIVE_QD_PIPES_SHIFT				8
317 #define		INACTIVE_SIMDS(x)				((x) << 16)
318 #define		INACTIVE_SIMDS_MASK				0xFFFF0000
319 #define		INACTIVE_SIMDS_SHIFT				16
320 
321 #define VGT_PRIMITIVE_TYPE                              0x8958
322 #define	VGT_NUM_INSTANCES				0x8974
323 #define VGT_TF_RING_SIZE				0x8988
324 #define VGT_OFFCHIP_LDS_BASE				0x89b4
325 
326 #define	PA_SC_LINE_STIPPLE_STATE			0x8B10
327 #define	PA_CL_ENHANCE					0x8A14
328 #define		CLIP_VTX_REORDER_ENA				(1 << 0)
329 #define		NUM_CLIP_SEQ(x)					((x) << 1)
330 #define	PA_SC_FIFO_SIZE					0x8BCC
331 #define		SC_PRIM_FIFO_SIZE(x)				((x) << 0)
332 #define		SC_HIZ_TILE_FIFO_SIZE(x)			((x) << 12)
333 #define		SC_EARLYZ_TILE_FIFO_SIZE(x)			((x) << 20)
334 #define	PA_SC_FORCE_EOV_MAX_CNTS			0x8B24
335 #define		FORCE_EOV_MAX_CLK_CNT(x)			((x) << 0)
336 #define		FORCE_EOV_MAX_REZ_CNT(x)			((x) << 16)
337 
338 #define	SQ_CONFIG					0x8C00
339 #define		VC_ENABLE					(1 << 0)
340 #define		EXPORT_SRC_C					(1 << 1)
341 #define		GFX_PRIO(x)					((x) << 2)
342 #define		CS1_PRIO(x)					((x) << 4)
343 #define		CS2_PRIO(x)					((x) << 6)
344 #define	SQ_GPR_RESOURCE_MGMT_1				0x8C04
345 #define		NUM_PS_GPRS(x)					((x) << 0)
346 #define		NUM_VS_GPRS(x)					((x) << 16)
347 #define		NUM_CLAUSE_TEMP_GPRS(x)				((x) << 28)
348 #define SQ_ESGS_RING_SIZE				0x8c44
349 #define SQ_GSVS_RING_SIZE				0x8c4c
350 #define SQ_ESTMP_RING_BASE				0x8c50
351 #define SQ_ESTMP_RING_SIZE				0x8c54
352 #define SQ_GSTMP_RING_BASE				0x8c58
353 #define SQ_GSTMP_RING_SIZE				0x8c5c
354 #define SQ_VSTMP_RING_BASE				0x8c60
355 #define SQ_VSTMP_RING_SIZE				0x8c64
356 #define SQ_PSTMP_RING_BASE				0x8c68
357 #define SQ_PSTMP_RING_SIZE				0x8c6c
358 #define	SQ_MS_FIFO_SIZES				0x8CF0
359 #define		CACHE_FIFO_SIZE(x)				((x) << 0)
360 #define		FETCH_FIFO_HIWATER(x)				((x) << 8)
361 #define		DONE_FIFO_HIWATER(x)				((x) << 16)
362 #define		ALU_UPDATE_FIFO_HIWATER(x)			((x) << 24)
363 #define SQ_LSTMP_RING_BASE				0x8e10
364 #define SQ_LSTMP_RING_SIZE				0x8e14
365 #define SQ_HSTMP_RING_BASE				0x8e18
366 #define SQ_HSTMP_RING_SIZE				0x8e1c
367 #define	SQ_DYN_GPR_CNTL_PS_FLUSH_REQ    		0x8D8C
368 #define		DYN_GPR_ENABLE					(1 << 8)
369 #define SQ_CONST_MEM_BASE				0x8df8
370 
371 #define	SX_EXPORT_BUFFER_SIZES				0x900C
372 #define		COLOR_BUFFER_SIZE(x)				((x) << 0)
373 #define		POSITION_BUFFER_SIZE(x)				((x) << 8)
374 #define		SMX_BUFFER_SIZE(x)				((x) << 16)
375 #define	SX_DEBUG_1					0x9058
376 #define		ENABLE_NEW_SMX_ADDRESS				(1 << 16)
377 
378 #define	SPI_CONFIG_CNTL					0x9100
379 #define		GPR_WRITE_PRIORITY(x)				((x) << 0)
380 #define	SPI_CONFIG_CNTL_1				0x913C
381 #define		VTX_DONE_DELAY(x)				((x) << 0)
382 #define		INTERP_ONE_PRIM_PER_ROW				(1 << 4)
383 #define		CRC_SIMD_ID_WADDR_DISABLE			(1 << 8)
384 
385 #define	CGTS_TCC_DISABLE				0x9148
386 #define	CGTS_USER_TCC_DISABLE				0x914C
387 #define		TCC_DISABLE_MASK				0xFFFF0000
388 #define		TCC_DISABLE_SHIFT				16
389 #define	CGTS_SM_CTRL_REG				0x9150
390 #define		OVERRIDE				(1 << 21)
391 
392 #define	TA_CNTL_AUX					0x9508
393 #define		DISABLE_CUBE_WRAP				(1 << 0)
394 #define		DISABLE_CUBE_ANISO				(1 << 1)
395 
396 #define	TCP_CHAN_STEER_LO				0x960c
397 #define	TCP_CHAN_STEER_HI				0x9610
398 
399 #define CC_RB_BACKEND_DISABLE				0x98F4
400 #define		BACKEND_DISABLE(x)     			((x) << 16)
401 #define GB_ADDR_CONFIG  				0x98F8
402 #define		NUM_PIPES(x)				((x) << 0)
403 #define		NUM_PIPES_MASK				0x00000007
404 #define		NUM_PIPES_SHIFT				0
405 #define		PIPE_INTERLEAVE_SIZE(x)			((x) << 4)
406 #define		PIPE_INTERLEAVE_SIZE_MASK		0x00000070
407 #define		PIPE_INTERLEAVE_SIZE_SHIFT		4
408 #define		BANK_INTERLEAVE_SIZE(x)			((x) << 8)
409 #define		NUM_SHADER_ENGINES(x)			((x) << 12)
410 #define		NUM_SHADER_ENGINES_MASK			0x00003000
411 #define		NUM_SHADER_ENGINES_SHIFT		12
412 #define		SHADER_ENGINE_TILE_SIZE(x)     		((x) << 16)
413 #define		SHADER_ENGINE_TILE_SIZE_MASK		0x00070000
414 #define		SHADER_ENGINE_TILE_SIZE_SHIFT		16
415 #define		NUM_GPUS(x)     			((x) << 20)
416 #define		NUM_GPUS_MASK				0x00700000
417 #define		NUM_GPUS_SHIFT				20
418 #define		MULTI_GPU_TILE_SIZE(x)     		((x) << 24)
419 #define		MULTI_GPU_TILE_SIZE_MASK		0x03000000
420 #define		MULTI_GPU_TILE_SIZE_SHIFT		24
421 #define		ROW_SIZE(x)             		((x) << 28)
422 #define		ROW_SIZE_MASK				0x30000000
423 #define		ROW_SIZE_SHIFT				28
424 #define		NUM_LOWER_PIPES(x)			((x) << 30)
425 #define		NUM_LOWER_PIPES_MASK			0x40000000
426 #define		NUM_LOWER_PIPES_SHIFT			30
427 #define GB_BACKEND_MAP  				0x98FC
428 
429 #define CB_PERF_CTR0_SEL_0				0x9A20
430 #define CB_PERF_CTR0_SEL_1				0x9A24
431 #define CB_PERF_CTR1_SEL_0				0x9A28
432 #define CB_PERF_CTR1_SEL_1				0x9A2C
433 #define CB_PERF_CTR2_SEL_0				0x9A30
434 #define CB_PERF_CTR2_SEL_1				0x9A34
435 #define CB_PERF_CTR3_SEL_0				0x9A38
436 #define CB_PERF_CTR3_SEL_1				0x9A3C
437 
438 #define	GC_USER_RB_BACKEND_DISABLE			0x9B7C
439 #define		BACKEND_DISABLE_MASK			0x00FF0000
440 #define		BACKEND_DISABLE_SHIFT			16
441 
442 #define	SMX_DC_CTL0					0xA020
443 #define		USE_HASH_FUNCTION				(1 << 0)
444 #define		NUMBER_OF_SETS(x)				((x) << 1)
445 #define		FLUSH_ALL_ON_EVENT				(1 << 10)
446 #define		STALL_ON_EVENT					(1 << 11)
447 #define	SMX_EVENT_CTL					0xA02C
448 #define		ES_FLUSH_CTL(x)					((x) << 0)
449 #define		GS_FLUSH_CTL(x)					((x) << 3)
450 #define		ACK_FLUSH_CTL(x)				((x) << 6)
451 #define		SYNC_FLUSH_CTL					(1 << 8)
452 
453 #define	CP_RB0_BASE					0xC100
454 #define	CP_RB0_CNTL					0xC104
455 #define		RB_BUFSZ(x)					((x) << 0)
456 #define		RB_BLKSZ(x)					((x) << 8)
457 #define		RB_NO_UPDATE					(1 << 27)
458 #define		RB_RPTR_WR_ENA					(1 << 31)
459 #define		BUF_SWAP_32BIT					(2 << 16)
460 #define	CP_RB0_RPTR_ADDR				0xC10C
461 #define	CP_RB0_RPTR_ADDR_HI				0xC110
462 #define	CP_RB0_WPTR					0xC114
463 
464 #define CP_INT_CNTL                                     0xC124
465 #       define CNTX_BUSY_INT_ENABLE                     (1 << 19)
466 #       define CNTX_EMPTY_INT_ENABLE                    (1 << 20)
467 #       define TIME_STAMP_INT_ENABLE                    (1 << 26)
468 
469 #define	CP_RB1_BASE					0xC180
470 #define	CP_RB1_CNTL					0xC184
471 #define	CP_RB1_RPTR_ADDR				0xC188
472 #define	CP_RB1_RPTR_ADDR_HI				0xC18C
473 #define	CP_RB1_WPTR					0xC190
474 #define	CP_RB2_BASE					0xC194
475 #define	CP_RB2_CNTL					0xC198
476 #define	CP_RB2_RPTR_ADDR				0xC19C
477 #define	CP_RB2_RPTR_ADDR_HI				0xC1A0
478 #define	CP_RB2_WPTR					0xC1A4
479 #define	CP_PFP_UCODE_ADDR				0xC150
480 #define	CP_PFP_UCODE_DATA				0xC154
481 #define	CP_ME_RAM_RADDR					0xC158
482 #define	CP_ME_RAM_WADDR					0xC15C
483 #define	CP_ME_RAM_DATA					0xC160
484 #define	CP_DEBUG					0xC1FC
485 
486 #define VGT_EVENT_INITIATOR                             0x28a90
487 #       define CACHE_FLUSH_AND_INV_EVENT_TS                     (0x14 << 0)
488 #       define CACHE_FLUSH_AND_INV_EVENT                        (0x16 << 0)
489 
490 /*
491  * PM4
492  */
493 #define PACKET0(reg, n)	((RADEON_PACKET_TYPE0 << 30) |			\
494 			 (((reg) >> 2) & 0xFFFF) |			\
495 			 ((n) & 0x3FFF) << 16)
496 #define CP_PACKET2			0x80000000
497 #define		PACKET2_PAD_SHIFT		0
498 #define		PACKET2_PAD_MASK		(0x3fffffff << 0)
499 
500 #define PACKET2(v)	(CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
501 
502 #define PACKET3(op, n)	((RADEON_PACKET_TYPE3 << 30) |			\
503 			 (((op) & 0xFF) << 8) |				\
504 			 ((n) & 0x3FFF) << 16)
505 
506 /* Packet 3 types */
507 #define	PACKET3_NOP					0x10
508 #define	PACKET3_SET_BASE				0x11
509 #define	PACKET3_CLEAR_STATE				0x12
510 #define	PACKET3_INDEX_BUFFER_SIZE			0x13
511 #define	PACKET3_DEALLOC_STATE				0x14
512 #define	PACKET3_DISPATCH_DIRECT				0x15
513 #define	PACKET3_DISPATCH_INDIRECT			0x16
514 #define	PACKET3_INDIRECT_BUFFER_END			0x17
515 #define	PACKET3_MODE_CONTROL				0x18
516 #define	PACKET3_SET_PREDICATION				0x20
517 #define	PACKET3_REG_RMW					0x21
518 #define	PACKET3_COND_EXEC				0x22
519 #define	PACKET3_PRED_EXEC				0x23
520 #define	PACKET3_DRAW_INDIRECT				0x24
521 #define	PACKET3_DRAW_INDEX_INDIRECT			0x25
522 #define	PACKET3_INDEX_BASE				0x26
523 #define	PACKET3_DRAW_INDEX_2				0x27
524 #define	PACKET3_CONTEXT_CONTROL				0x28
525 #define	PACKET3_DRAW_INDEX_OFFSET			0x29
526 #define	PACKET3_INDEX_TYPE				0x2A
527 #define	PACKET3_DRAW_INDEX				0x2B
528 #define	PACKET3_DRAW_INDEX_AUTO				0x2D
529 #define	PACKET3_DRAW_INDEX_IMMD				0x2E
530 #define	PACKET3_NUM_INSTANCES				0x2F
531 #define	PACKET3_DRAW_INDEX_MULTI_AUTO			0x30
532 #define	PACKET3_INDIRECT_BUFFER				0x32
533 #define	PACKET3_STRMOUT_BUFFER_UPDATE			0x34
534 #define	PACKET3_DRAW_INDEX_OFFSET_2			0x35
535 #define	PACKET3_DRAW_INDEX_MULTI_ELEMENT		0x36
536 #define	PACKET3_WRITE_DATA				0x37
537 #define	PACKET3_MEM_SEMAPHORE				0x39
538 #define	PACKET3_MPEG_INDEX				0x3A
539 #define	PACKET3_WAIT_REG_MEM				0x3C
540 #define	PACKET3_MEM_WRITE				0x3D
541 #define	PACKET3_PFP_SYNC_ME				0x42
542 #define	PACKET3_SURFACE_SYNC				0x43
543 #              define PACKET3_CB0_DEST_BASE_ENA    (1 << 6)
544 #              define PACKET3_CB1_DEST_BASE_ENA    (1 << 7)
545 #              define PACKET3_CB2_DEST_BASE_ENA    (1 << 8)
546 #              define PACKET3_CB3_DEST_BASE_ENA    (1 << 9)
547 #              define PACKET3_CB4_DEST_BASE_ENA    (1 << 10)
548 #              define PACKET3_CB5_DEST_BASE_ENA    (1 << 11)
549 #              define PACKET3_CB6_DEST_BASE_ENA    (1 << 12)
550 #              define PACKET3_CB7_DEST_BASE_ENA    (1 << 13)
551 #              define PACKET3_DB_DEST_BASE_ENA     (1 << 14)
552 #              define PACKET3_CB8_DEST_BASE_ENA    (1 << 15)
553 #              define PACKET3_CB9_DEST_BASE_ENA    (1 << 16)
554 #              define PACKET3_CB10_DEST_BASE_ENA   (1 << 17)
555 #              define PACKET3_CB11_DEST_BASE_ENA   (1 << 18)
556 #              define PACKET3_FULL_CACHE_ENA       (1 << 20)
557 #              define PACKET3_TC_ACTION_ENA        (1 << 23)
558 #              define PACKET3_CB_ACTION_ENA        (1 << 25)
559 #              define PACKET3_DB_ACTION_ENA        (1 << 26)
560 #              define PACKET3_SH_ACTION_ENA        (1 << 27)
561 #              define PACKET3_SX_ACTION_ENA        (1 << 28)
562 #define	PACKET3_ME_INITIALIZE				0x44
563 #define		PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
564 #define	PACKET3_COND_WRITE				0x45
565 #define	PACKET3_EVENT_WRITE				0x46
566 #define		EVENT_TYPE(x)                           ((x) << 0)
567 #define		EVENT_INDEX(x)                          ((x) << 8)
568                 /* 0 - any non-TS event
569 		 * 1 - ZPASS_DONE
570 		 * 2 - SAMPLE_PIPELINESTAT
571 		 * 3 - SAMPLE_STREAMOUTSTAT*
572 		 * 4 - *S_PARTIAL_FLUSH
573 		 * 5 - TS events
574 		 */
575 #define	PACKET3_EVENT_WRITE_EOP				0x47
576 #define		DATA_SEL(x)                             ((x) << 29)
577                 /* 0 - discard
578 		 * 1 - send low 32bit data
579 		 * 2 - send 64bit data
580 		 * 3 - send 64bit counter value
581 		 */
582 #define		INT_SEL(x)                              ((x) << 24)
583                 /* 0 - none
584 		 * 1 - interrupt only (DATA_SEL = 0)
585 		 * 2 - interrupt when data write is confirmed
586 		 */
587 #define	PACKET3_EVENT_WRITE_EOS				0x48
588 #define	PACKET3_PREAMBLE_CNTL				0x4A
589 #              define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE     (2 << 28)
590 #              define PACKET3_PREAMBLE_END_CLEAR_STATE       (3 << 28)
591 #define	PACKET3_ALU_PS_CONST_BUFFER_COPY		0x4C
592 #define	PACKET3_ALU_VS_CONST_BUFFER_COPY		0x4D
593 #define	PACKET3_ALU_PS_CONST_UPDATE		        0x4E
594 #define	PACKET3_ALU_VS_CONST_UPDATE		        0x4F
595 #define	PACKET3_ONE_REG_WRITE				0x57
596 #define	PACKET3_SET_CONFIG_REG				0x68
597 #define		PACKET3_SET_CONFIG_REG_START			0x00008000
598 #define		PACKET3_SET_CONFIG_REG_END			0x0000ac00
599 #define	PACKET3_SET_CONTEXT_REG				0x69
600 #define		PACKET3_SET_CONTEXT_REG_START			0x00028000
601 #define		PACKET3_SET_CONTEXT_REG_END			0x00029000
602 #define	PACKET3_SET_ALU_CONST				0x6A
603 /* alu const buffers only; no reg file */
604 #define	PACKET3_SET_BOOL_CONST				0x6B
605 #define		PACKET3_SET_BOOL_CONST_START			0x0003a500
606 #define		PACKET3_SET_BOOL_CONST_END			0x0003a518
607 #define	PACKET3_SET_LOOP_CONST				0x6C
608 #define		PACKET3_SET_LOOP_CONST_START			0x0003a200
609 #define		PACKET3_SET_LOOP_CONST_END			0x0003a500
610 #define	PACKET3_SET_RESOURCE				0x6D
611 #define		PACKET3_SET_RESOURCE_START			0x00030000
612 #define		PACKET3_SET_RESOURCE_END			0x00038000
613 #define	PACKET3_SET_SAMPLER				0x6E
614 #define		PACKET3_SET_SAMPLER_START			0x0003c000
615 #define		PACKET3_SET_SAMPLER_END				0x0003c600
616 #define	PACKET3_SET_CTL_CONST				0x6F
617 #define		PACKET3_SET_CTL_CONST_START			0x0003cff0
618 #define		PACKET3_SET_CTL_CONST_END			0x0003ff0c
619 #define	PACKET3_SET_RESOURCE_OFFSET			0x70
620 #define	PACKET3_SET_ALU_CONST_VS			0x71
621 #define	PACKET3_SET_ALU_CONST_DI			0x72
622 #define	PACKET3_SET_CONTEXT_REG_INDIRECT		0x73
623 #define	PACKET3_SET_RESOURCE_INDIRECT			0x74
624 #define	PACKET3_SET_APPEND_CNT			        0x75
625 #define	PACKET3_ME_WRITE				0x7A
626 
627 /* ASYNC DMA - first instance at 0xd000, second at 0xd800 */
628 #define DMA0_REGISTER_OFFSET                              0x0 /* not a register */
629 #define DMA1_REGISTER_OFFSET                              0x800 /* not a register */
630 
631 #define DMA_RB_CNTL                                       0xd000
632 #       define DMA_RB_ENABLE                              (1 << 0)
633 #       define DMA_RB_SIZE(x)                             ((x) << 1) /* log2 */
634 #       define DMA_RB_SWAP_ENABLE                         (1 << 9) /* 8IN32 */
635 #       define DMA_RPTR_WRITEBACK_ENABLE                  (1 << 12)
636 #       define DMA_RPTR_WRITEBACK_SWAP_ENABLE             (1 << 13)  /* 8IN32 */
637 #       define DMA_RPTR_WRITEBACK_TIMER(x)                ((x) << 16) /* log2 */
638 #define DMA_RB_BASE                                       0xd004
639 #define DMA_RB_RPTR                                       0xd008
640 #define DMA_RB_WPTR                                       0xd00c
641 
642 #define DMA_RB_RPTR_ADDR_HI                               0xd01c
643 #define DMA_RB_RPTR_ADDR_LO                               0xd020
644 
645 #define DMA_IB_CNTL                                       0xd024
646 #       define DMA_IB_ENABLE                              (1 << 0)
647 #       define DMA_IB_SWAP_ENABLE                         (1 << 4)
648 #       define CMD_VMID_FORCE                             (1 << 31)
649 #define DMA_IB_RPTR                                       0xd028
650 #define DMA_CNTL                                          0xd02c
651 #       define TRAP_ENABLE                                (1 << 0)
652 #       define SEM_INCOMPLETE_INT_ENABLE                  (1 << 1)
653 #       define SEM_WAIT_INT_ENABLE                        (1 << 2)
654 #       define DATA_SWAP_ENABLE                           (1 << 3)
655 #       define FENCE_SWAP_ENABLE                          (1 << 4)
656 #       define CTXEMPTY_INT_ENABLE                        (1 << 28)
657 #define DMA_STATUS_REG                                    0xd034
658 #       define DMA_IDLE                                   (1 << 0)
659 #define DMA_SEM_INCOMPLETE_TIMER_CNTL                     0xd044
660 #define DMA_SEM_WAIT_FAIL_TIMER_CNTL                      0xd048
661 #define DMA_TILING_CONFIG  				  0xd0b8
662 #define DMA_MODE                                          0xd0bc
663 
664 #define DMA_PACKET(cmd, t, s, n)	((((cmd) & 0xF) << 28) |	\
665 					 (((t) & 0x1) << 23) |		\
666 					 (((s) & 0x1) << 22) |		\
667 					 (((n) & 0xFFFFF) << 0))
668 
669 #define DMA_IB_PACKET(cmd, vmid, n)	((((cmd) & 0xF) << 28) |	\
670 					 (((vmid) & 0xF) << 20) |	\
671 					 (((n) & 0xFFFFF) << 0))
672 
673 /* async DMA Packet types */
674 #define	DMA_PACKET_WRITE				  0x2
675 #define	DMA_PACKET_COPY					  0x3
676 #define	DMA_PACKET_INDIRECT_BUFFER			  0x4
677 #define	DMA_PACKET_SEMAPHORE				  0x5
678 #define	DMA_PACKET_FENCE				  0x6
679 #define	DMA_PACKET_TRAP					  0x7
680 #define	DMA_PACKET_SRBM_WRITE				  0x9
681 #define	DMA_PACKET_CONSTANT_FILL			  0xd
682 #define	DMA_PACKET_NOP					  0xf
683 
684 #endif
685