blob: f5e54a7e2bf2faa2321a02c3e743bd9bb42b6a1d [file] [log] [blame]
Alex Deucher0af62b02011-01-06 21:19:31 -05001/*
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#ifndef NI_H
25#define NI_H
26
Alex Deucherfecf1d02011-03-02 20:07:29 -050027#define CAYMAN_MAX_SH_GPRS 256
28#define CAYMAN_MAX_TEMP_GPRS 16
29#define CAYMAN_MAX_SH_THREADS 256
30#define CAYMAN_MAX_SH_STACK_ENTRIES 4096
31#define CAYMAN_MAX_FRC_EOV_CNT 16384
32#define CAYMAN_MAX_BACKENDS 8
33#define CAYMAN_MAX_BACKENDS_MASK 0xFF
34#define CAYMAN_MAX_BACKENDS_PER_SE_MASK 0xF
35#define CAYMAN_MAX_SIMDS 16
36#define CAYMAN_MAX_SIMDS_MASK 0xFFFF
37#define CAYMAN_MAX_SIMDS_PER_SE_MASK 0xFFF
38#define CAYMAN_MAX_PIPES 8
39#define CAYMAN_MAX_PIPES_MASK 0xFF
40#define CAYMAN_MAX_LDS_NUM 0xFFFF
41#define CAYMAN_MAX_TCC 16
42#define CAYMAN_MAX_TCC_MASK 0xFF
43
Alex Deucher416a2bd2012-05-31 19:00:25 -040044#define CAYMAN_GB_ADDR_CONFIG_GOLDEN 0x02011003
45#define ARUBA_GB_ADDR_CONFIG_GOLDEN 0x12010001
46
Alex Deucherfecf1d02011-03-02 20:07:29 -050047#define DMIF_ADDR_CONFIG 0xBD4
Alex Deucher1b370782011-11-17 20:13:28 -050048#define SRBM_GFX_CNTL 0x0E44
49#define RINGID(x) (((x) & 0x3) << 0)
50#define VMID(x) (((x) & 0x7) << 0)
Alex Deucherb9952a82011-03-02 20:07:33 -050051#define SRBM_STATUS 0x0E50
Alex Deucherfecf1d02011-03-02 20:07:29 -050052
Alex Deucherfa8198e2011-03-02 20:07:30 -050053#define VM_CONTEXT0_REQUEST_RESPONSE 0x1470
54#define REQUEST_TYPE(x) (((x) & 0xf) << 0)
55#define RESPONSE_TYPE_MASK 0x000000F0
56#define RESPONSE_TYPE_SHIFT 4
57#define VM_L2_CNTL 0x1400
58#define ENABLE_L2_CACHE (1 << 0)
59#define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1)
60#define ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE (1 << 9)
61#define ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE (1 << 10)
62#define EFFECTIVE_L2_QUEUE_SIZE(x) (((x) & 7) << 14)
63#define CONTEXT1_IDENTITY_ACCESS_MODE(x) (((x) & 3) << 18)
64/* CONTEXT1_IDENTITY_ACCESS_MODE
65 * 0 physical = logical
66 * 1 logical via context1 page table
67 * 2 inside identity aperture use translation, outside physical = logical
68 * 3 inside identity aperture physical = logical, outside use translation
69 */
70#define VM_L2_CNTL2 0x1404
71#define INVALIDATE_ALL_L1_TLBS (1 << 0)
72#define INVALIDATE_L2_CACHE (1 << 1)
73#define VM_L2_CNTL3 0x1408
74#define BANK_SELECT(x) ((x) << 0)
75#define CACHE_UPDATE_MODE(x) ((x) << 6)
76#define L2_CACHE_BIGK_ASSOCIATIVITY (1 << 20)
77#define L2_CACHE_BIGK_FRAGMENT_SIZE(x) ((x) << 15)
78#define VM_L2_STATUS 0x140C
79#define L2_BUSY (1 << 0)
80#define VM_CONTEXT0_CNTL 0x1410
81#define ENABLE_CONTEXT (1 << 0)
82#define PAGE_TABLE_DEPTH(x) (((x) & 3) << 1)
Christian Königae133a12012-09-18 15:30:44 -040083#define RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 3)
Alex Deucherfa8198e2011-03-02 20:07:30 -050084#define RANGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 4)
Christian Königae133a12012-09-18 15:30:44 -040085#define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 6)
86#define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 7)
87#define PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 9)
88#define PDE0_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 10)
89#define VALID_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 12)
90#define VALID_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 13)
91#define READ_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 15)
92#define READ_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 16)
93#define WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 18)
94#define WRITE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 19)
Alex Deucherfa8198e2011-03-02 20:07:30 -050095#define VM_CONTEXT1_CNTL 0x1414
96#define VM_CONTEXT0_CNTL2 0x1430
97#define VM_CONTEXT1_CNTL2 0x1434
98#define VM_INVALIDATE_REQUEST 0x1478
99#define VM_INVALIDATE_RESPONSE 0x147c
100#define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518
101#define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x151c
102#define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C
103#define VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x155C
104#define VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x157C
105
Alex Deucherfecf1d02011-03-02 20:07:29 -0500106#define MC_SHARED_CHMAP 0x2004
107#define NOOFCHAN_SHIFT 12
108#define NOOFCHAN_MASK 0x00003000
109#define MC_SHARED_CHREMAP 0x2008
Alex Deucherfa8198e2011-03-02 20:07:30 -0500110
111#define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034
112#define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
113#define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C
114#define MC_VM_MX_L1_TLB_CNTL 0x2064
115#define ENABLE_L1_TLB (1 << 0)
116#define ENABLE_L1_FRAGMENT_PROCESSING (1 << 1)
117#define SYSTEM_ACCESS_MODE_PA_ONLY (0 << 3)
118#define SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 3)
119#define SYSTEM_ACCESS_MODE_IN_SYS (2 << 3)
120#define SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 3)
121#define SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5)
122#define ENABLE_ADVANCED_DRIVER_MODEL (1 << 6)
Alex Deucher05b3ef62012-03-20 17:18:37 -0400123#define FUS_MC_VM_FB_OFFSET 0x2068
Alex Deucherfa8198e2011-03-02 20:07:30 -0500124
Alex Deucher0af62b02011-01-06 21:19:31 -0500125#define MC_SHARED_BLACKOUT_CNTL 0x20ac
Alex Deucherfecf1d02011-03-02 20:07:29 -0500126#define MC_ARB_RAMCFG 0x2760
127#define NOOFBANK_SHIFT 0
128#define NOOFBANK_MASK 0x00000003
129#define NOOFRANK_SHIFT 2
130#define NOOFRANK_MASK 0x00000004
131#define NOOFROWS_SHIFT 3
132#define NOOFROWS_MASK 0x00000038
133#define NOOFCOLS_SHIFT 6
134#define NOOFCOLS_MASK 0x000000C0
135#define CHANSIZE_SHIFT 8
136#define CHANSIZE_MASK 0x00000100
137#define BURSTLENGTH_SHIFT 9
138#define BURSTLENGTH_MASK 0x00000200
139#define CHANSIZE_OVERRIDE (1 << 11)
Alex Deucher0af62b02011-01-06 21:19:31 -0500140#define MC_SEQ_SUP_CNTL 0x28c8
141#define RUN_MASK (1 << 0)
142#define MC_SEQ_SUP_PGM 0x28cc
143#define MC_IO_PAD_CNTL_D0 0x29d0
144#define MEM_FALL_OUT_CMD (1 << 8)
145#define MC_SEQ_MISC0 0x2a00
146#define MC_SEQ_MISC0_GDDR5_SHIFT 28
147#define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000
148#define MC_SEQ_MISC0_GDDR5_VALUE 5
149#define MC_SEQ_IO_DEBUG_INDEX 0x2a44
150#define MC_SEQ_IO_DEBUG_DATA 0x2a48
151
Alex Deucherfecf1d02011-03-02 20:07:29 -0500152#define HDP_HOST_PATH_CNTL 0x2C00
153#define HDP_NONSURFACE_BASE 0x2C04
154#define HDP_NONSURFACE_INFO 0x2C08
155#define HDP_NONSURFACE_SIZE 0x2C0C
156#define HDP_ADDR_CONFIG 0x2F48
Dave Airlie0b65f832011-05-19 14:14:42 +1000157#define HDP_MISC_CNTL 0x2F4C
158#define HDP_FLUSH_INVALIDATE_CACHE (1 << 0)
Alex Deucherfecf1d02011-03-02 20:07:29 -0500159
160#define CC_SYS_RB_BACKEND_DISABLE 0x3F88
161#define GC_USER_SYS_RB_BACKEND_DISABLE 0x3F8C
162#define CGTS_SYS_TCC_DISABLE 0x3F90
163#define CGTS_USER_SYS_TCC_DISABLE 0x3F94
164
Alex Deucher416a2bd2012-05-31 19:00:25 -0400165#define RLC_GFX_INDEX 0x3FC4
166
Alex Deucherfecf1d02011-03-02 20:07:29 -0500167#define CONFIG_MEMSIZE 0x5428
168
Alex Deucherfa8198e2011-03-02 20:07:30 -0500169#define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480
Alex Deucherfecf1d02011-03-02 20:07:29 -0500170#define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0
171
172#define GRBM_CNTL 0x8000
173#define GRBM_READ_TIMEOUT(x) ((x) << 0)
174#define GRBM_STATUS 0x8010
175#define CMDFIFO_AVAIL_MASK 0x0000000F
176#define RING2_RQ_PENDING (1 << 4)
177#define SRBM_RQ_PENDING (1 << 5)
178#define RING1_RQ_PENDING (1 << 6)
179#define CF_RQ_PENDING (1 << 7)
180#define PF_RQ_PENDING (1 << 8)
181#define GDS_DMA_RQ_PENDING (1 << 9)
182#define GRBM_EE_BUSY (1 << 10)
183#define SX_CLEAN (1 << 11)
184#define DB_CLEAN (1 << 12)
185#define CB_CLEAN (1 << 13)
186#define TA_BUSY (1 << 14)
187#define GDS_BUSY (1 << 15)
188#define VGT_BUSY_NO_DMA (1 << 16)
189#define VGT_BUSY (1 << 17)
190#define IA_BUSY_NO_DMA (1 << 18)
191#define IA_BUSY (1 << 19)
192#define SX_BUSY (1 << 20)
193#define SH_BUSY (1 << 21)
194#define SPI_BUSY (1 << 22)
195#define SC_BUSY (1 << 24)
196#define PA_BUSY (1 << 25)
197#define DB_BUSY (1 << 26)
198#define CP_COHERENCY_BUSY (1 << 28)
199#define CP_BUSY (1 << 29)
200#define CB_BUSY (1 << 30)
201#define GUI_ACTIVE (1 << 31)
202#define GRBM_STATUS_SE0 0x8014
203#define GRBM_STATUS_SE1 0x8018
204#define SE_SX_CLEAN (1 << 0)
205#define SE_DB_CLEAN (1 << 1)
206#define SE_CB_CLEAN (1 << 2)
207#define SE_VGT_BUSY (1 << 23)
208#define SE_PA_BUSY (1 << 24)
209#define SE_TA_BUSY (1 << 25)
210#define SE_SX_BUSY (1 << 26)
211#define SE_SPI_BUSY (1 << 27)
212#define SE_SH_BUSY (1 << 28)
213#define SE_SC_BUSY (1 << 29)
214#define SE_DB_BUSY (1 << 30)
215#define SE_CB_BUSY (1 << 31)
216#define GRBM_SOFT_RESET 0x8020
217#define SOFT_RESET_CP (1 << 0)
218#define SOFT_RESET_CB (1 << 1)
219#define SOFT_RESET_DB (1 << 3)
220#define SOFT_RESET_GDS (1 << 4)
221#define SOFT_RESET_PA (1 << 5)
222#define SOFT_RESET_SC (1 << 6)
223#define SOFT_RESET_SPI (1 << 8)
224#define SOFT_RESET_SH (1 << 9)
225#define SOFT_RESET_SX (1 << 10)
226#define SOFT_RESET_TC (1 << 11)
227#define SOFT_RESET_TA (1 << 12)
228#define SOFT_RESET_VGT (1 << 14)
229#define SOFT_RESET_IA (1 << 15)
230
Alex Deucher416a2bd2012-05-31 19:00:25 -0400231#define GRBM_GFX_INDEX 0x802C
232#define INSTANCE_INDEX(x) ((x) << 0)
233#define SE_INDEX(x) ((x) << 16)
234#define INSTANCE_BROADCAST_WRITES (1 << 30)
235#define SE_BROADCAST_WRITES (1 << 31)
236
Alex Deucher0c88a022011-03-02 20:07:31 -0500237#define SCRATCH_REG0 0x8500
238#define SCRATCH_REG1 0x8504
239#define SCRATCH_REG2 0x8508
240#define SCRATCH_REG3 0x850C
241#define SCRATCH_REG4 0x8510
242#define SCRATCH_REG5 0x8514
243#define SCRATCH_REG6 0x8518
244#define SCRATCH_REG7 0x851C
245#define SCRATCH_UMSK 0x8540
246#define SCRATCH_ADDR 0x8544
247#define CP_SEM_WAIT_TIMER 0x85BC
Alex Deucher11ef3f12012-01-20 14:47:43 -0500248#define CP_SEM_INCOMPLETE_TIMER_CNTL 0x85C8
Jerome Glisse721604a2012-01-05 22:11:05 -0500249#define CP_COHER_CNTL2 0x85E8
Jerome Glisse440a7cd2012-06-27 12:25:01 -0400250#define CP_STALLED_STAT1 0x8674
251#define CP_STALLED_STAT2 0x8678
252#define CP_BUSY_STAT 0x867C
253#define CP_STAT 0x8680
Alex Deucher0c88a022011-03-02 20:07:31 -0500254#define CP_ME_CNTL 0x86D8
255#define CP_ME_HALT (1 << 28)
256#define CP_PFP_HALT (1 << 26)
257#define CP_RB2_RPTR 0x86f8
258#define CP_RB1_RPTR 0x86fc
259#define CP_RB0_RPTR 0x8700
260#define CP_RB_WPTR_DELAY 0x8704
Alex Deucherfecf1d02011-03-02 20:07:29 -0500261#define CP_MEQ_THRESHOLDS 0x8764
262#define MEQ1_START(x) ((x) << 0)
263#define MEQ2_START(x) ((x) << 8)
264#define CP_PERFMON_CNTL 0x87FC
265
266#define VGT_CACHE_INVALIDATION 0x88C4
267#define CACHE_INVALIDATION(x) ((x) << 0)
268#define VC_ONLY 0
269#define TC_ONLY 1
270#define VC_AND_TC 2
271#define AUTO_INVLD_EN(x) ((x) << 6)
272#define NO_AUTO 0
273#define ES_AUTO 1
274#define GS_AUTO 2
275#define ES_AND_GS_AUTO 3
276#define VGT_GS_VERTEX_REUSE 0x88D4
277
278#define CC_GC_SHADER_PIPE_CONFIG 0x8950
279#define GC_USER_SHADER_PIPE_CONFIG 0x8954
280#define INACTIVE_QD_PIPES(x) ((x) << 8)
281#define INACTIVE_QD_PIPES_MASK 0x0000FF00
282#define INACTIVE_QD_PIPES_SHIFT 8
283#define INACTIVE_SIMDS(x) ((x) << 16)
284#define INACTIVE_SIMDS_MASK 0xFFFF0000
285#define INACTIVE_SIMDS_SHIFT 16
286
287#define VGT_PRIMITIVE_TYPE 0x8958
288#define VGT_NUM_INSTANCES 0x8974
289#define VGT_TF_RING_SIZE 0x8988
290#define VGT_OFFCHIP_LDS_BASE 0x89b4
291
292#define PA_SC_LINE_STIPPLE_STATE 0x8B10
293#define PA_CL_ENHANCE 0x8A14
294#define CLIP_VTX_REORDER_ENA (1 << 0)
295#define NUM_CLIP_SEQ(x) ((x) << 1)
296#define PA_SC_FIFO_SIZE 0x8BCC
297#define SC_PRIM_FIFO_SIZE(x) ((x) << 0)
298#define SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 12)
299#define SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 20)
300#define PA_SC_FORCE_EOV_MAX_CNTS 0x8B24
301#define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0)
302#define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16)
303
304#define SQ_CONFIG 0x8C00
305#define VC_ENABLE (1 << 0)
306#define EXPORT_SRC_C (1 << 1)
307#define GFX_PRIO(x) ((x) << 2)
308#define CS1_PRIO(x) ((x) << 4)
309#define CS2_PRIO(x) ((x) << 6)
310#define SQ_GPR_RESOURCE_MGMT_1 0x8C04
311#define NUM_PS_GPRS(x) ((x) << 0)
312#define NUM_VS_GPRS(x) ((x) << 16)
313#define NUM_CLAUSE_TEMP_GPRS(x) ((x) << 28)
314#define SQ_ESGS_RING_SIZE 0x8c44
315#define SQ_GSVS_RING_SIZE 0x8c4c
316#define SQ_ESTMP_RING_BASE 0x8c50
317#define SQ_ESTMP_RING_SIZE 0x8c54
318#define SQ_GSTMP_RING_BASE 0x8c58
319#define SQ_GSTMP_RING_SIZE 0x8c5c
320#define SQ_VSTMP_RING_BASE 0x8c60
321#define SQ_VSTMP_RING_SIZE 0x8c64
322#define SQ_PSTMP_RING_BASE 0x8c68
323#define SQ_PSTMP_RING_SIZE 0x8c6c
324#define SQ_MS_FIFO_SIZES 0x8CF0
325#define CACHE_FIFO_SIZE(x) ((x) << 0)
326#define FETCH_FIFO_HIWATER(x) ((x) << 8)
327#define DONE_FIFO_HIWATER(x) ((x) << 16)
328#define ALU_UPDATE_FIFO_HIWATER(x) ((x) << 24)
329#define SQ_LSTMP_RING_BASE 0x8e10
330#define SQ_LSTMP_RING_SIZE 0x8e14
331#define SQ_HSTMP_RING_BASE 0x8e18
332#define SQ_HSTMP_RING_SIZE 0x8e1c
333#define SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x8D8C
334#define DYN_GPR_ENABLE (1 << 8)
335#define SQ_CONST_MEM_BASE 0x8df8
336
337#define SX_EXPORT_BUFFER_SIZES 0x900C
338#define COLOR_BUFFER_SIZE(x) ((x) << 0)
339#define POSITION_BUFFER_SIZE(x) ((x) << 8)
340#define SMX_BUFFER_SIZE(x) ((x) << 16)
341#define SX_DEBUG_1 0x9058
342#define ENABLE_NEW_SMX_ADDRESS (1 << 16)
343
344#define SPI_CONFIG_CNTL 0x9100
345#define GPR_WRITE_PRIORITY(x) ((x) << 0)
346#define SPI_CONFIG_CNTL_1 0x913C
347#define VTX_DONE_DELAY(x) ((x) << 0)
348#define INTERP_ONE_PRIM_PER_ROW (1 << 4)
349#define CRC_SIMD_ID_WADDR_DISABLE (1 << 8)
350
351#define CGTS_TCC_DISABLE 0x9148
352#define CGTS_USER_TCC_DISABLE 0x914C
353#define TCC_DISABLE_MASK 0xFFFF0000
354#define TCC_DISABLE_SHIFT 16
Alex Deucher2498c412011-07-01 12:58:54 -0400355#define CGTS_SM_CTRL_REG 0x9150
Alex Deucherfecf1d02011-03-02 20:07:29 -0500356#define OVERRIDE (1 << 21)
357
358#define TA_CNTL_AUX 0x9508
359#define DISABLE_CUBE_WRAP (1 << 0)
360#define DISABLE_CUBE_ANISO (1 << 1)
361
362#define TCP_CHAN_STEER_LO 0x960c
363#define TCP_CHAN_STEER_HI 0x9610
364
365#define CC_RB_BACKEND_DISABLE 0x98F4
366#define BACKEND_DISABLE(x) ((x) << 16)
367#define GB_ADDR_CONFIG 0x98F8
368#define NUM_PIPES(x) ((x) << 0)
369#define NUM_PIPES_MASK 0x00000007
370#define NUM_PIPES_SHIFT 0
371#define PIPE_INTERLEAVE_SIZE(x) ((x) << 4)
372#define PIPE_INTERLEAVE_SIZE_MASK 0x00000070
373#define PIPE_INTERLEAVE_SIZE_SHIFT 4
374#define BANK_INTERLEAVE_SIZE(x) ((x) << 8)
375#define NUM_SHADER_ENGINES(x) ((x) << 12)
376#define NUM_SHADER_ENGINES_MASK 0x00003000
377#define NUM_SHADER_ENGINES_SHIFT 12
378#define SHADER_ENGINE_TILE_SIZE(x) ((x) << 16)
379#define SHADER_ENGINE_TILE_SIZE_MASK 0x00070000
380#define SHADER_ENGINE_TILE_SIZE_SHIFT 16
381#define NUM_GPUS(x) ((x) << 20)
382#define NUM_GPUS_MASK 0x00700000
383#define NUM_GPUS_SHIFT 20
384#define MULTI_GPU_TILE_SIZE(x) ((x) << 24)
385#define MULTI_GPU_TILE_SIZE_MASK 0x03000000
386#define MULTI_GPU_TILE_SIZE_SHIFT 24
387#define ROW_SIZE(x) ((x) << 28)
Alex Deucherbb920912011-05-23 14:22:26 -0400388#define ROW_SIZE_MASK 0x30000000
Alex Deucherfecf1d02011-03-02 20:07:29 -0500389#define ROW_SIZE_SHIFT 28
390#define NUM_LOWER_PIPES(x) ((x) << 30)
391#define NUM_LOWER_PIPES_MASK 0x40000000
392#define NUM_LOWER_PIPES_SHIFT 30
393#define GB_BACKEND_MAP 0x98FC
394
395#define CB_PERF_CTR0_SEL_0 0x9A20
396#define CB_PERF_CTR0_SEL_1 0x9A24
397#define CB_PERF_CTR1_SEL_0 0x9A28
398#define CB_PERF_CTR1_SEL_1 0x9A2C
399#define CB_PERF_CTR2_SEL_0 0x9A30
400#define CB_PERF_CTR2_SEL_1 0x9A34
401#define CB_PERF_CTR3_SEL_0 0x9A38
402#define CB_PERF_CTR3_SEL_1 0x9A3C
403
404#define GC_USER_RB_BACKEND_DISABLE 0x9B7C
405#define BACKEND_DISABLE_MASK 0x00FF0000
406#define BACKEND_DISABLE_SHIFT 16
407
408#define SMX_DC_CTL0 0xA020
409#define USE_HASH_FUNCTION (1 << 0)
410#define NUMBER_OF_SETS(x) ((x) << 1)
411#define FLUSH_ALL_ON_EVENT (1 << 10)
412#define STALL_ON_EVENT (1 << 11)
413#define SMX_EVENT_CTL 0xA02C
414#define ES_FLUSH_CTL(x) ((x) << 0)
415#define GS_FLUSH_CTL(x) ((x) << 3)
416#define ACK_FLUSH_CTL(x) ((x) << 6)
417#define SYNC_FLUSH_CTL (1 << 8)
418
Alex Deucher0c88a022011-03-02 20:07:31 -0500419#define CP_RB0_BASE 0xC100
420#define CP_RB0_CNTL 0xC104
421#define RB_BUFSZ(x) ((x) << 0)
422#define RB_BLKSZ(x) ((x) << 8)
423#define RB_NO_UPDATE (1 << 27)
424#define RB_RPTR_WR_ENA (1 << 31)
425#define BUF_SWAP_32BIT (2 << 16)
426#define CP_RB0_RPTR_ADDR 0xC10C
427#define CP_RB0_RPTR_ADDR_HI 0xC110
428#define CP_RB0_WPTR 0xC114
Alex Deucher1b370782011-11-17 20:13:28 -0500429
430#define CP_INT_CNTL 0xC124
431# define CNTX_BUSY_INT_ENABLE (1 << 19)
432# define CNTX_EMPTY_INT_ENABLE (1 << 20)
433# define TIME_STAMP_INT_ENABLE (1 << 26)
434
Alex Deucher0c88a022011-03-02 20:07:31 -0500435#define CP_RB1_BASE 0xC180
436#define CP_RB1_CNTL 0xC184
437#define CP_RB1_RPTR_ADDR 0xC188
438#define CP_RB1_RPTR_ADDR_HI 0xC18C
439#define CP_RB1_WPTR 0xC190
440#define CP_RB2_BASE 0xC194
441#define CP_RB2_CNTL 0xC198
442#define CP_RB2_RPTR_ADDR 0xC19C
443#define CP_RB2_RPTR_ADDR_HI 0xC1A0
444#define CP_RB2_WPTR 0xC1A4
445#define CP_PFP_UCODE_ADDR 0xC150
446#define CP_PFP_UCODE_DATA 0xC154
447#define CP_ME_RAM_RADDR 0xC158
448#define CP_ME_RAM_WADDR 0xC15C
449#define CP_ME_RAM_DATA 0xC160
450#define CP_DEBUG 0xC1FC
451
Alex Deucherb40e7e12011-11-17 14:57:50 -0500452#define VGT_EVENT_INITIATOR 0x28a90
453# define CACHE_FLUSH_AND_INV_EVENT_TS (0x14 << 0)
454# define CACHE_FLUSH_AND_INV_EVENT (0x16 << 0)
455
Alex Deucher0c88a022011-03-02 20:07:31 -0500456/*
457 * PM4
458 */
459#define PACKET_TYPE0 0
460#define PACKET_TYPE1 1
461#define PACKET_TYPE2 2
462#define PACKET_TYPE3 3
463
464#define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
465#define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
466#define CP_PACKET0_GET_REG(h) (((h) & 0xFFFF) << 2)
467#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
468#define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \
469 (((reg) >> 2) & 0xFFFF) | \
470 ((n) & 0x3FFF) << 16)
471#define CP_PACKET2 0x80000000
472#define PACKET2_PAD_SHIFT 0
473#define PACKET2_PAD_MASK (0x3fffffff << 0)
474
475#define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
476
477#define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \
478 (((op) & 0xFF) << 8) | \
479 ((n) & 0x3FFF) << 16)
480
481/* Packet 3 types */
482#define PACKET3_NOP 0x10
483#define PACKET3_SET_BASE 0x11
484#define PACKET3_CLEAR_STATE 0x12
485#define PACKET3_INDEX_BUFFER_SIZE 0x13
486#define PACKET3_DEALLOC_STATE 0x14
487#define PACKET3_DISPATCH_DIRECT 0x15
488#define PACKET3_DISPATCH_INDIRECT 0x16
489#define PACKET3_INDIRECT_BUFFER_END 0x17
Jerome Glisse721604a2012-01-05 22:11:05 -0500490#define PACKET3_MODE_CONTROL 0x18
Alex Deucher0c88a022011-03-02 20:07:31 -0500491#define PACKET3_SET_PREDICATION 0x20
492#define PACKET3_REG_RMW 0x21
493#define PACKET3_COND_EXEC 0x22
494#define PACKET3_PRED_EXEC 0x23
495#define PACKET3_DRAW_INDIRECT 0x24
496#define PACKET3_DRAW_INDEX_INDIRECT 0x25
497#define PACKET3_INDEX_BASE 0x26
498#define PACKET3_DRAW_INDEX_2 0x27
499#define PACKET3_CONTEXT_CONTROL 0x28
500#define PACKET3_DRAW_INDEX_OFFSET 0x29
501#define PACKET3_INDEX_TYPE 0x2A
502#define PACKET3_DRAW_INDEX 0x2B
503#define PACKET3_DRAW_INDEX_AUTO 0x2D
504#define PACKET3_DRAW_INDEX_IMMD 0x2E
505#define PACKET3_NUM_INSTANCES 0x2F
506#define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30
507#define PACKET3_INDIRECT_BUFFER 0x32
508#define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
509#define PACKET3_DRAW_INDEX_OFFSET_2 0x35
510#define PACKET3_DRAW_INDEX_MULTI_ELEMENT 0x36
511#define PACKET3_WRITE_DATA 0x37
512#define PACKET3_MEM_SEMAPHORE 0x39
513#define PACKET3_MPEG_INDEX 0x3A
514#define PACKET3_WAIT_REG_MEM 0x3C
515#define PACKET3_MEM_WRITE 0x3D
Christian König58f8cf52012-10-22 17:42:35 +0200516#define PACKET3_PFP_SYNC_ME 0x42
Alex Deucher0c88a022011-03-02 20:07:31 -0500517#define PACKET3_SURFACE_SYNC 0x43
518# define PACKET3_CB0_DEST_BASE_ENA (1 << 6)
519# define PACKET3_CB1_DEST_BASE_ENA (1 << 7)
520# define PACKET3_CB2_DEST_BASE_ENA (1 << 8)
521# define PACKET3_CB3_DEST_BASE_ENA (1 << 9)
522# define PACKET3_CB4_DEST_BASE_ENA (1 << 10)
523# define PACKET3_CB5_DEST_BASE_ENA (1 << 11)
524# define PACKET3_CB6_DEST_BASE_ENA (1 << 12)
525# define PACKET3_CB7_DEST_BASE_ENA (1 << 13)
526# define PACKET3_DB_DEST_BASE_ENA (1 << 14)
527# define PACKET3_CB8_DEST_BASE_ENA (1 << 15)
528# define PACKET3_CB9_DEST_BASE_ENA (1 << 16)
529# define PACKET3_CB10_DEST_BASE_ENA (1 << 17)
530# define PACKET3_CB11_DEST_BASE_ENA (1 << 18)
531# define PACKET3_FULL_CACHE_ENA (1 << 20)
532# define PACKET3_TC_ACTION_ENA (1 << 23)
533# define PACKET3_CB_ACTION_ENA (1 << 25)
534# define PACKET3_DB_ACTION_ENA (1 << 26)
535# define PACKET3_SH_ACTION_ENA (1 << 27)
536# define PACKET3_SX_ACTION_ENA (1 << 28)
537#define PACKET3_ME_INITIALIZE 0x44
538#define PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
539#define PACKET3_COND_WRITE 0x45
540#define PACKET3_EVENT_WRITE 0x46
Alex Deucherb40e7e12011-11-17 14:57:50 -0500541#define EVENT_TYPE(x) ((x) << 0)
542#define EVENT_INDEX(x) ((x) << 8)
543 /* 0 - any non-TS event
544 * 1 - ZPASS_DONE
545 * 2 - SAMPLE_PIPELINESTAT
546 * 3 - SAMPLE_STREAMOUTSTAT*
547 * 4 - *S_PARTIAL_FLUSH
548 * 5 - TS events
549 */
Alex Deucher0c88a022011-03-02 20:07:31 -0500550#define PACKET3_EVENT_WRITE_EOP 0x47
Alex Deucherb40e7e12011-11-17 14:57:50 -0500551#define DATA_SEL(x) ((x) << 29)
552 /* 0 - discard
553 * 1 - send low 32bit data
554 * 2 - send 64bit data
555 * 3 - send 64bit counter value
556 */
557#define INT_SEL(x) ((x) << 24)
558 /* 0 - none
559 * 1 - interrupt only (DATA_SEL = 0)
560 * 2 - interrupt when data write is confirmed
561 */
Alex Deucher0c88a022011-03-02 20:07:31 -0500562#define PACKET3_EVENT_WRITE_EOS 0x48
563#define PACKET3_PREAMBLE_CNTL 0x4A
564# define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28)
565# define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28)
566#define PACKET3_ALU_PS_CONST_BUFFER_COPY 0x4C
567#define PACKET3_ALU_VS_CONST_BUFFER_COPY 0x4D
568#define PACKET3_ALU_PS_CONST_UPDATE 0x4E
569#define PACKET3_ALU_VS_CONST_UPDATE 0x4F
570#define PACKET3_ONE_REG_WRITE 0x57
571#define PACKET3_SET_CONFIG_REG 0x68
572#define PACKET3_SET_CONFIG_REG_START 0x00008000
573#define PACKET3_SET_CONFIG_REG_END 0x0000ac00
574#define PACKET3_SET_CONTEXT_REG 0x69
575#define PACKET3_SET_CONTEXT_REG_START 0x00028000
576#define PACKET3_SET_CONTEXT_REG_END 0x00029000
577#define PACKET3_SET_ALU_CONST 0x6A
578/* alu const buffers only; no reg file */
579#define PACKET3_SET_BOOL_CONST 0x6B
580#define PACKET3_SET_BOOL_CONST_START 0x0003a500
581#define PACKET3_SET_BOOL_CONST_END 0x0003a518
582#define PACKET3_SET_LOOP_CONST 0x6C
583#define PACKET3_SET_LOOP_CONST_START 0x0003a200
584#define PACKET3_SET_LOOP_CONST_END 0x0003a500
585#define PACKET3_SET_RESOURCE 0x6D
586#define PACKET3_SET_RESOURCE_START 0x00030000
587#define PACKET3_SET_RESOURCE_END 0x00038000
588#define PACKET3_SET_SAMPLER 0x6E
589#define PACKET3_SET_SAMPLER_START 0x0003c000
590#define PACKET3_SET_SAMPLER_END 0x0003c600
591#define PACKET3_SET_CTL_CONST 0x6F
592#define PACKET3_SET_CTL_CONST_START 0x0003cff0
593#define PACKET3_SET_CTL_CONST_END 0x0003ff0c
594#define PACKET3_SET_RESOURCE_OFFSET 0x70
595#define PACKET3_SET_ALU_CONST_VS 0x71
596#define PACKET3_SET_ALU_CONST_DI 0x72
597#define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73
598#define PACKET3_SET_RESOURCE_INDIRECT 0x74
599#define PACKET3_SET_APPEND_CNT 0x75
Christian König2a6f1ab2012-08-11 15:00:30 +0200600#define PACKET3_ME_WRITE 0x7A
Alex Deucher0c88a022011-03-02 20:07:31 -0500601
Alex Deucher0af62b02011-01-06 21:19:31 -0500602#endif
603