xref: /linux/drivers/gpu/drm/radeon/cikd.h (revision d93f79376f210e0b19da57a3dc841ba332daa9d0)
18cc1a532SAlex Deucher /*
28cc1a532SAlex Deucher  * Copyright 2012 Advanced Micro Devices, Inc.
38cc1a532SAlex Deucher  *
48cc1a532SAlex Deucher  * Permission is hereby granted, free of charge, to any person obtaining a
58cc1a532SAlex Deucher  * copy of this software and associated documentation files (the "Software"),
68cc1a532SAlex Deucher  * to deal in the Software without restriction, including without limitation
78cc1a532SAlex Deucher  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88cc1a532SAlex Deucher  * and/or sell copies of the Software, and to permit persons to whom the
98cc1a532SAlex Deucher  * Software is furnished to do so, subject to the following conditions:
108cc1a532SAlex Deucher  *
118cc1a532SAlex Deucher  * The above copyright notice and this permission notice shall be included in
128cc1a532SAlex Deucher  * all copies or substantial portions of the Software.
138cc1a532SAlex Deucher  *
148cc1a532SAlex Deucher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158cc1a532SAlex Deucher  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168cc1a532SAlex Deucher  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
178cc1a532SAlex Deucher  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
188cc1a532SAlex Deucher  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
198cc1a532SAlex Deucher  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208cc1a532SAlex Deucher  * OTHER DEALINGS IN THE SOFTWARE.
218cc1a532SAlex Deucher  *
228cc1a532SAlex Deucher  * Authors: Alex Deucher
238cc1a532SAlex Deucher  */
248cc1a532SAlex Deucher #ifndef CIK_H
258cc1a532SAlex Deucher #define CIK_H
268cc1a532SAlex Deucher 
278cc1a532SAlex Deucher #define BONAIRE_GB_ADDR_CONFIG_GOLDEN        0x12010001
28b496038bSAlex Deucher #define HAWAII_GB_ADDR_CONFIG_GOLDEN         0x12011003
298cc1a532SAlex Deucher 
308cc1a532SAlex Deucher #define CIK_RB_BITMAP_WIDTH_PER_SH     2
31fc821b70SAlex Deucher #define HAWAII_RB_BITMAP_WIDTH_PER_SH  4
328cc1a532SAlex Deucher 
3341a524abSAlex Deucher /* DIDT IND registers */
3441a524abSAlex Deucher #define DIDT_SQ_CTRL0                                     0x0
3541a524abSAlex Deucher #       define DIDT_CTRL_EN                               (1 << 0)
3641a524abSAlex Deucher #define DIDT_DB_CTRL0                                     0x20
3741a524abSAlex Deucher #define DIDT_TD_CTRL0                                     0x40
3841a524abSAlex Deucher #define DIDT_TCP_CTRL0                                    0x60
3941a524abSAlex Deucher 
402c67912cSAlex Deucher /* SMC IND registers */
41cc8dbbb4SAlex Deucher #define DPM_TABLE_475                                     0x3F768
42cc8dbbb4SAlex Deucher #       define SamuBootLevel(x)                           ((x) << 0)
43cc8dbbb4SAlex Deucher #       define SamuBootLevel_MASK                         0x000000ff
44cc8dbbb4SAlex Deucher #       define SamuBootLevel_SHIFT                        0
45cc8dbbb4SAlex Deucher #       define AcpBootLevel(x)                            ((x) << 8)
46cc8dbbb4SAlex Deucher #       define AcpBootLevel_MASK                          0x0000ff00
47cc8dbbb4SAlex Deucher #       define AcpBootLevel_SHIFT                         8
48cc8dbbb4SAlex Deucher #       define VceBootLevel(x)                            ((x) << 16)
49cc8dbbb4SAlex Deucher #       define VceBootLevel_MASK                          0x00ff0000
50cc8dbbb4SAlex Deucher #       define VceBootLevel_SHIFT                         16
51cc8dbbb4SAlex Deucher #       define UvdBootLevel(x)                            ((x) << 24)
52cc8dbbb4SAlex Deucher #       define UvdBootLevel_MASK                          0xff000000
53cc8dbbb4SAlex Deucher #       define UvdBootLevel_SHIFT                         24
54cc8dbbb4SAlex Deucher 
55cc8dbbb4SAlex Deucher #define FIRMWARE_FLAGS                                    0x3F800
56cc8dbbb4SAlex Deucher #       define INTERRUPTS_ENABLED                         (1 << 0)
57cc8dbbb4SAlex Deucher 
5841a524abSAlex Deucher #define NB_DPM_CONFIG_1                                   0x3F9E8
5941a524abSAlex Deucher #       define Dpm0PgNbPsLo(x)                            ((x) << 0)
6041a524abSAlex Deucher #       define Dpm0PgNbPsLo_MASK                          0x000000ff
6141a524abSAlex Deucher #       define Dpm0PgNbPsLo_SHIFT                         0
6241a524abSAlex Deucher #       define Dpm0PgNbPsHi(x)                            ((x) << 8)
6341a524abSAlex Deucher #       define Dpm0PgNbPsHi_MASK                          0x0000ff00
6441a524abSAlex Deucher #       define Dpm0PgNbPsHi_SHIFT                         8
6541a524abSAlex Deucher #       define DpmXNbPsLo(x)                              ((x) << 16)
6641a524abSAlex Deucher #       define DpmXNbPsLo_MASK                            0x00ff0000
6741a524abSAlex Deucher #       define DpmXNbPsLo_SHIFT                           16
6841a524abSAlex Deucher #       define DpmXNbPsHi(x)                              ((x) << 24)
6941a524abSAlex Deucher #       define DpmXNbPsHi_MASK                            0xff000000
7041a524abSAlex Deucher #       define DpmXNbPsHi_SHIFT                           24
7141a524abSAlex Deucher 
72cc8dbbb4SAlex Deucher #define	SMC_SYSCON_RESET_CNTL				0x80000000
73cc8dbbb4SAlex Deucher #       define RST_REG                                  (1 << 0)
74cc8dbbb4SAlex Deucher #define	SMC_SYSCON_CLOCK_CNTL_0				0x80000004
75cc8dbbb4SAlex Deucher #       define CK_DISABLE                               (1 << 0)
76cc8dbbb4SAlex Deucher #       define CKEN                                     (1 << 24)
77cc8dbbb4SAlex Deucher 
78cc8dbbb4SAlex Deucher #define	SMC_SYSCON_MISC_CNTL				0x80000010
79cc8dbbb4SAlex Deucher 
8041a524abSAlex Deucher #define SMC_SYSCON_MSG_ARG_0                              0x80000068
8141a524abSAlex Deucher 
82cc8dbbb4SAlex Deucher #define SMC_PC_C                                          0x80000370
83cc8dbbb4SAlex Deucher 
84cc8dbbb4SAlex Deucher #define SMC_SCRATCH9                                      0x80000424
85cc8dbbb4SAlex Deucher 
86cc8dbbb4SAlex Deucher #define RCU_UC_EVENTS                                     0xC0000004
87cc8dbbb4SAlex Deucher #       define BOOT_SEQ_DONE                              (1 << 7)
88cc8dbbb4SAlex Deucher 
892c67912cSAlex Deucher #define GENERAL_PWRMGT                                    0xC0200000
9041a524abSAlex Deucher #       define GLOBAL_PWRMGT_EN                           (1 << 0)
91cc8dbbb4SAlex Deucher #       define STATIC_PM_EN                               (1 << 1)
92cc8dbbb4SAlex Deucher #       define THERMAL_PROTECTION_DIS                     (1 << 2)
93cc8dbbb4SAlex Deucher #       define THERMAL_PROTECTION_TYPE                    (1 << 3)
94cc8dbbb4SAlex Deucher #       define SW_SMIO_INDEX(x)                           ((x) << 6)
95cc8dbbb4SAlex Deucher #       define SW_SMIO_INDEX_MASK                         (1 << 6)
96cc8dbbb4SAlex Deucher #       define SW_SMIO_INDEX_SHIFT                        6
97cc8dbbb4SAlex Deucher #       define VOLT_PWRMGT_EN                             (1 << 10)
982c67912cSAlex Deucher #       define GPU_COUNTER_CLK                            (1 << 15)
99cc8dbbb4SAlex Deucher #       define DYN_SPREAD_SPECTRUM_EN                     (1 << 23)
100cc8dbbb4SAlex Deucher 
101cc8dbbb4SAlex Deucher #define CNB_PWRMGT_CNTL                                   0xC0200004
102cc8dbbb4SAlex Deucher #       define GNB_SLOW_MODE(x)                           ((x) << 0)
103cc8dbbb4SAlex Deucher #       define GNB_SLOW_MODE_MASK                         (3 << 0)
104cc8dbbb4SAlex Deucher #       define GNB_SLOW_MODE_SHIFT                        0
105cc8dbbb4SAlex Deucher #       define GNB_SLOW                                   (1 << 2)
106cc8dbbb4SAlex Deucher #       define FORCE_NB_PS1                               (1 << 3)
107cc8dbbb4SAlex Deucher #       define DPM_ENABLED                                (1 << 4)
1082c67912cSAlex Deucher 
10941a524abSAlex Deucher #define SCLK_PWRMGT_CNTL                                  0xC0200008
110cc8dbbb4SAlex Deucher #       define SCLK_PWRMGT_OFF                            (1 << 0)
11141a524abSAlex Deucher #       define RESET_BUSY_CNT                             (1 << 4)
11241a524abSAlex Deucher #       define RESET_SCLK_CNT                             (1 << 5)
11341a524abSAlex Deucher #       define DYNAMIC_PM_EN                              (1 << 21)
11441a524abSAlex Deucher 
11594b4adc5SAlex Deucher #define TARGET_AND_CURRENT_PROFILE_INDEX                  0xC0200014
11694b4adc5SAlex Deucher #       define CURRENT_STATE_MASK                         (0xf << 4)
11794b4adc5SAlex Deucher #       define CURRENT_STATE_SHIFT                        4
11894b4adc5SAlex Deucher #       define CURR_MCLK_INDEX_MASK                       (0xf << 8)
11994b4adc5SAlex Deucher #       define CURR_MCLK_INDEX_SHIFT                      8
12094b4adc5SAlex Deucher #       define CURR_SCLK_INDEX_MASK                       (0x1f << 16)
12194b4adc5SAlex Deucher #       define CURR_SCLK_INDEX_SHIFT                      16
12294b4adc5SAlex Deucher 
123cc8dbbb4SAlex Deucher #define CG_SSP                                            0xC0200044
124cc8dbbb4SAlex Deucher #       define SST(x)                                     ((x) << 0)
125cc8dbbb4SAlex Deucher #       define SST_MASK                                   (0xffff << 0)
126cc8dbbb4SAlex Deucher #       define SSTU(x)                                    ((x) << 16)
127cc8dbbb4SAlex Deucher #       define SSTU_MASK                                  (0xf << 16)
128cc8dbbb4SAlex Deucher 
129cc8dbbb4SAlex Deucher #define CG_DISPLAY_GAP_CNTL                               0xC0200060
130cc8dbbb4SAlex Deucher #       define DISP_GAP(x)                                ((x) << 0)
131cc8dbbb4SAlex Deucher #       define DISP_GAP_MASK                              (3 << 0)
132cc8dbbb4SAlex Deucher #       define VBI_TIMER_COUNT(x)                         ((x) << 4)
133cc8dbbb4SAlex Deucher #       define VBI_TIMER_COUNT_MASK                       (0x3fff << 4)
134cc8dbbb4SAlex Deucher #       define VBI_TIMER_UNIT(x)                          ((x) << 20)
135cc8dbbb4SAlex Deucher #       define VBI_TIMER_UNIT_MASK                        (7 << 20)
136cc8dbbb4SAlex Deucher #       define DISP_GAP_MCHG(x)                           ((x) << 24)
137cc8dbbb4SAlex Deucher #       define DISP_GAP_MCHG_MASK                         (3 << 24)
138cc8dbbb4SAlex Deucher 
139ae3e40e8SAlex Deucher #define SMU_VOLTAGE_STATUS                                0xC0200094
140ae3e40e8SAlex Deucher #       define SMU_VOLTAGE_CURRENT_LEVEL_MASK             (0xff << 1)
141ae3e40e8SAlex Deucher #       define SMU_VOLTAGE_CURRENT_LEVEL_SHIFT            1
142ae3e40e8SAlex Deucher 
14394b4adc5SAlex Deucher #define TARGET_AND_CURRENT_PROFILE_INDEX_1                0xC02000F0
14494b4adc5SAlex Deucher #       define CURR_PCIE_INDEX_MASK                       (0xf << 24)
14594b4adc5SAlex Deucher #       define CURR_PCIE_INDEX_SHIFT                      24
14694b4adc5SAlex Deucher 
147cc8dbbb4SAlex Deucher #define CG_ULV_PARAMETER                                  0xC0200158
148cc8dbbb4SAlex Deucher 
14941a524abSAlex Deucher #define CG_FTV_0                                          0xC02001A8
150cc8dbbb4SAlex Deucher #define CG_FTV_1                                          0xC02001AC
151cc8dbbb4SAlex Deucher #define CG_FTV_2                                          0xC02001B0
152cc8dbbb4SAlex Deucher #define CG_FTV_3                                          0xC02001B4
153cc8dbbb4SAlex Deucher #define CG_FTV_4                                          0xC02001B8
154cc8dbbb4SAlex Deucher #define CG_FTV_5                                          0xC02001BC
155cc8dbbb4SAlex Deucher #define CG_FTV_6                                          0xC02001C0
156cc8dbbb4SAlex Deucher #define CG_FTV_7                                          0xC02001C4
157cc8dbbb4SAlex Deucher 
158cc8dbbb4SAlex Deucher #define CG_DISPLAY_GAP_CNTL2                              0xC0200230
15941a524abSAlex Deucher 
16041a524abSAlex Deucher #define LCAC_SX0_OVR_SEL                                  0xC0400D04
16141a524abSAlex Deucher #define LCAC_SX0_OVR_VAL                                  0xC0400D08
16241a524abSAlex Deucher 
163cc8dbbb4SAlex Deucher #define LCAC_MC0_CNTL                                     0xC0400D30
16441a524abSAlex Deucher #define LCAC_MC0_OVR_SEL                                  0xC0400D34
16541a524abSAlex Deucher #define LCAC_MC0_OVR_VAL                                  0xC0400D38
166cc8dbbb4SAlex Deucher #define LCAC_MC1_CNTL                                     0xC0400D3C
16741a524abSAlex Deucher #define LCAC_MC1_OVR_SEL                                  0xC0400D40
16841a524abSAlex Deucher #define LCAC_MC1_OVR_VAL                                  0xC0400D44
16941a524abSAlex Deucher 
17041a524abSAlex Deucher #define LCAC_MC2_OVR_SEL                                  0xC0400D4C
17141a524abSAlex Deucher #define LCAC_MC2_OVR_VAL                                  0xC0400D50
17241a524abSAlex Deucher 
17341a524abSAlex Deucher #define LCAC_MC3_OVR_SEL                                  0xC0400D58
17441a524abSAlex Deucher #define LCAC_MC3_OVR_VAL                                  0xC0400D5C
17541a524abSAlex Deucher 
176cc8dbbb4SAlex Deucher #define LCAC_CPL_CNTL                                     0xC0400D80
17741a524abSAlex Deucher #define LCAC_CPL_OVR_SEL                                  0xC0400D84
17841a524abSAlex Deucher #define LCAC_CPL_OVR_VAL                                  0xC0400D88
17941a524abSAlex Deucher 
180cc8dbbb4SAlex Deucher /* dGPU */
181cc8dbbb4SAlex Deucher #define	CG_THERMAL_CTRL					0xC0300004
182cc8dbbb4SAlex Deucher #define 	DPM_EVENT_SRC(x)			((x) << 0)
183cc8dbbb4SAlex Deucher #define 	DPM_EVENT_SRC_MASK			(7 << 0)
184cc8dbbb4SAlex Deucher #define		DIG_THERM_DPM(x)			((x) << 14)
185cc8dbbb4SAlex Deucher #define		DIG_THERM_DPM_MASK			0x003FC000
186cc8dbbb4SAlex Deucher #define		DIG_THERM_DPM_SHIFT			14
187cc8dbbb4SAlex Deucher 
188cc8dbbb4SAlex Deucher #define	CG_THERMAL_INT					0xC030000C
189cc8dbbb4SAlex Deucher #define		CI_DIG_THERM_INTH(x)			((x) << 8)
190cc8dbbb4SAlex Deucher #define		CI_DIG_THERM_INTH_MASK			0x0000FF00
191cc8dbbb4SAlex Deucher #define		CI_DIG_THERM_INTH_SHIFT			8
192cc8dbbb4SAlex Deucher #define		CI_DIG_THERM_INTL(x)			((x) << 16)
193cc8dbbb4SAlex Deucher #define		CI_DIG_THERM_INTL_MASK			0x00FF0000
194cc8dbbb4SAlex Deucher #define		CI_DIG_THERM_INTL_SHIFT			16
195cc8dbbb4SAlex Deucher #define 	THERM_INT_MASK_HIGH			(1 << 24)
196cc8dbbb4SAlex Deucher #define 	THERM_INT_MASK_LOW			(1 << 25)
197cc8dbbb4SAlex Deucher 
198286d9cc6SAlex Deucher #define	CG_MULT_THERMAL_STATUS				0xC0300014
199286d9cc6SAlex Deucher #define		ASIC_MAX_TEMP(x)			((x) << 0)
200286d9cc6SAlex Deucher #define		ASIC_MAX_TEMP_MASK			0x000001ff
201286d9cc6SAlex Deucher #define		ASIC_MAX_TEMP_SHIFT			0
202286d9cc6SAlex Deucher #define		CTF_TEMP(x)				((x) << 9)
203286d9cc6SAlex Deucher #define		CTF_TEMP_MASK				0x0003fe00
204286d9cc6SAlex Deucher #define		CTF_TEMP_SHIFT				9
205286d9cc6SAlex Deucher 
206cc8dbbb4SAlex Deucher #define	CG_SPLL_FUNC_CNTL				0xC0500140
207cc8dbbb4SAlex Deucher #define		SPLL_RESET				(1 << 0)
208cc8dbbb4SAlex Deucher #define		SPLL_PWRON				(1 << 1)
209cc8dbbb4SAlex Deucher #define		SPLL_BYPASS_EN				(1 << 3)
210cc8dbbb4SAlex Deucher #define		SPLL_REF_DIV(x)				((x) << 5)
211cc8dbbb4SAlex Deucher #define		SPLL_REF_DIV_MASK			(0x3f << 5)
212cc8dbbb4SAlex Deucher #define		SPLL_PDIV_A(x)				((x) << 20)
213cc8dbbb4SAlex Deucher #define		SPLL_PDIV_A_MASK			(0x7f << 20)
214cc8dbbb4SAlex Deucher #define		SPLL_PDIV_A_SHIFT			20
215cc8dbbb4SAlex Deucher #define	CG_SPLL_FUNC_CNTL_2				0xC0500144
216cc8dbbb4SAlex Deucher #define		SCLK_MUX_SEL(x)				((x) << 0)
217cc8dbbb4SAlex Deucher #define		SCLK_MUX_SEL_MASK			(0x1ff << 0)
218cc8dbbb4SAlex Deucher #define	CG_SPLL_FUNC_CNTL_3				0xC0500148
219cc8dbbb4SAlex Deucher #define		SPLL_FB_DIV(x)				((x) << 0)
220cc8dbbb4SAlex Deucher #define		SPLL_FB_DIV_MASK			(0x3ffffff << 0)
221cc8dbbb4SAlex Deucher #define		SPLL_FB_DIV_SHIFT			0
222cc8dbbb4SAlex Deucher #define		SPLL_DITHEN				(1 << 28)
223cc8dbbb4SAlex Deucher #define	CG_SPLL_FUNC_CNTL_4				0xC050014C
224cc8dbbb4SAlex Deucher 
225cc8dbbb4SAlex Deucher #define	CG_SPLL_SPREAD_SPECTRUM				0xC0500164
226cc8dbbb4SAlex Deucher #define		SSEN					(1 << 0)
227cc8dbbb4SAlex Deucher #define		CLK_S(x)				((x) << 4)
228cc8dbbb4SAlex Deucher #define		CLK_S_MASK				(0xfff << 4)
229cc8dbbb4SAlex Deucher #define		CLK_S_SHIFT				4
230cc8dbbb4SAlex Deucher #define	CG_SPLL_SPREAD_SPECTRUM_2			0xC0500168
231cc8dbbb4SAlex Deucher #define		CLK_V(x)				((x) << 0)
232cc8dbbb4SAlex Deucher #define		CLK_V_MASK				(0x3ffffff << 0)
233cc8dbbb4SAlex Deucher #define		CLK_V_SHIFT				0
234cc8dbbb4SAlex Deucher 
2357235711aSAlex Deucher #define	MPLL_BYPASSCLK_SEL				0xC050019C
2367235711aSAlex Deucher #	define MPLL_CLKOUT_SEL(x)			((x) << 8)
2377235711aSAlex Deucher #	define MPLL_CLKOUT_SEL_MASK			0xFF00
2382c67912cSAlex Deucher #define CG_CLKPIN_CNTL                                    0xC05001A0
2392c67912cSAlex Deucher #       define XTALIN_DIVIDE                              (1 << 1)
2407235711aSAlex Deucher #       define BCLK_AS_XCLK                               (1 << 2)
2417235711aSAlex Deucher #define CG_CLKPIN_CNTL_2                                  0xC05001A4
2427235711aSAlex Deucher #       define FORCE_BIF_REFCLK_EN                        (1 << 3)
2437235711aSAlex Deucher #       define MUX_TCLK_TO_XCLK                           (1 << 8)
2447235711aSAlex Deucher #define	THM_CLK_CNTL					0xC05001A8
2457235711aSAlex Deucher #	define CMON_CLK_SEL(x)				((x) << 0)
2467235711aSAlex Deucher #	define CMON_CLK_SEL_MASK			0xFF
2477235711aSAlex Deucher #	define TMON_CLK_SEL(x)				((x) << 8)
2487235711aSAlex Deucher #	define TMON_CLK_SEL_MASK			0xFF00
2497235711aSAlex Deucher #define	MISC_CLK_CTRL					0xC05001AC
2507235711aSAlex Deucher #	define DEEP_SLEEP_CLK_SEL(x)			((x) << 0)
2517235711aSAlex Deucher #	define DEEP_SLEEP_CLK_SEL_MASK			0xFF
2527235711aSAlex Deucher #	define ZCLK_SEL(x)				((x) << 8)
2537235711aSAlex Deucher #	define ZCLK_SEL_MASK				0xFF00
2542c67912cSAlex Deucher 
255cc8dbbb4SAlex Deucher /* KV/KB */
25641a524abSAlex Deucher #define	CG_THERMAL_INT_CTRL				0xC2100028
25741a524abSAlex Deucher #define		DIG_THERM_INTH(x)			((x) << 0)
25841a524abSAlex Deucher #define		DIG_THERM_INTH_MASK			0x000000FF
25941a524abSAlex Deucher #define		DIG_THERM_INTH_SHIFT			0
26041a524abSAlex Deucher #define		DIG_THERM_INTL(x)			((x) << 8)
26141a524abSAlex Deucher #define		DIG_THERM_INTL_MASK			0x0000FF00
26241a524abSAlex Deucher #define		DIG_THERM_INTL_SHIFT			8
26341a524abSAlex Deucher #define 	THERM_INTH_MASK				(1 << 24)
26441a524abSAlex Deucher #define 	THERM_INTL_MASK				(1 << 25)
26541a524abSAlex Deucher 
2668a7cd276SAlex Deucher /* PCIE registers idx/data 0x38/0x3c */
2677235711aSAlex Deucher #define PB0_PIF_PWRDOWN_0                                 0x1100012 /* PCIE */
2687235711aSAlex Deucher #       define PLL_POWER_STATE_IN_TXS2_0(x)               ((x) << 7)
2697235711aSAlex Deucher #       define PLL_POWER_STATE_IN_TXS2_0_MASK             (0x7 << 7)
2707235711aSAlex Deucher #       define PLL_POWER_STATE_IN_TXS2_0_SHIFT            7
2717235711aSAlex Deucher #       define PLL_POWER_STATE_IN_OFF_0(x)                ((x) << 10)
2727235711aSAlex Deucher #       define PLL_POWER_STATE_IN_OFF_0_MASK              (0x7 << 10)
2737235711aSAlex Deucher #       define PLL_POWER_STATE_IN_OFF_0_SHIFT             10
2747235711aSAlex Deucher #       define PLL_RAMP_UP_TIME_0(x)                      ((x) << 24)
2757235711aSAlex Deucher #       define PLL_RAMP_UP_TIME_0_MASK                    (0x7 << 24)
2767235711aSAlex Deucher #       define PLL_RAMP_UP_TIME_0_SHIFT                   24
2777235711aSAlex Deucher #define PB0_PIF_PWRDOWN_1                                 0x1100013 /* PCIE */
2787235711aSAlex Deucher #       define PLL_POWER_STATE_IN_TXS2_1(x)               ((x) << 7)
2797235711aSAlex Deucher #       define PLL_POWER_STATE_IN_TXS2_1_MASK             (0x7 << 7)
2807235711aSAlex Deucher #       define PLL_POWER_STATE_IN_TXS2_1_SHIFT            7
2817235711aSAlex Deucher #       define PLL_POWER_STATE_IN_OFF_1(x)                ((x) << 10)
2827235711aSAlex Deucher #       define PLL_POWER_STATE_IN_OFF_1_MASK              (0x7 << 10)
2837235711aSAlex Deucher #       define PLL_POWER_STATE_IN_OFF_1_SHIFT             10
2847235711aSAlex Deucher #       define PLL_RAMP_UP_TIME_1(x)                      ((x) << 24)
2857235711aSAlex Deucher #       define PLL_RAMP_UP_TIME_1_MASK                    (0x7 << 24)
2867235711aSAlex Deucher #       define PLL_RAMP_UP_TIME_1_SHIFT                   24
2877235711aSAlex Deucher 
2887235711aSAlex Deucher #define PCIE_CNTL2                                        0x1001001c /* PCIE */
2897235711aSAlex Deucher #       define SLV_MEM_LS_EN                              (1 << 16)
290473359bcSAlex Deucher #       define SLV_MEM_AGGRESSIVE_LS_EN                   (1 << 17)
2917235711aSAlex Deucher #       define MST_MEM_LS_EN                              (1 << 18)
2927235711aSAlex Deucher #       define REPLAY_MEM_LS_EN                           (1 << 19)
2937235711aSAlex Deucher 
2948a7cd276SAlex Deucher #define PCIE_LC_STATUS1                                   0x1400028 /* PCIE */
2958a7cd276SAlex Deucher #       define LC_REVERSE_RCVR                            (1 << 0)
2968a7cd276SAlex Deucher #       define LC_REVERSE_XMIT                            (1 << 1)
2978a7cd276SAlex Deucher #       define LC_OPERATING_LINK_WIDTH_MASK               (0x7 << 2)
2988a7cd276SAlex Deucher #       define LC_OPERATING_LINK_WIDTH_SHIFT              2
2998a7cd276SAlex Deucher #       define LC_DETECTED_LINK_WIDTH_MASK                (0x7 << 5)
3008a7cd276SAlex Deucher #       define LC_DETECTED_LINK_WIDTH_SHIFT               5
3018a7cd276SAlex Deucher 
3027235711aSAlex Deucher #define PCIE_P_CNTL                                       0x1400040 /* PCIE */
3037235711aSAlex Deucher #       define P_IGNORE_EDB_ERR                           (1 << 6)
3047235711aSAlex Deucher 
3057235711aSAlex Deucher #define PB1_PIF_PWRDOWN_0                                 0x2100012 /* PCIE */
3067235711aSAlex Deucher #define PB1_PIF_PWRDOWN_1                                 0x2100013 /* PCIE */
3077235711aSAlex Deucher 
3087235711aSAlex Deucher #define PCIE_LC_CNTL                                      0x100100A0 /* PCIE */
3097235711aSAlex Deucher #       define LC_L0S_INACTIVITY(x)                       ((x) << 8)
3107235711aSAlex Deucher #       define LC_L0S_INACTIVITY_MASK                     (0xf << 8)
3117235711aSAlex Deucher #       define LC_L0S_INACTIVITY_SHIFT                    8
3127235711aSAlex Deucher #       define LC_L1_INACTIVITY(x)                        ((x) << 12)
3137235711aSAlex Deucher #       define LC_L1_INACTIVITY_MASK                      (0xf << 12)
3147235711aSAlex Deucher #       define LC_L1_INACTIVITY_SHIFT                     12
3157235711aSAlex Deucher #       define LC_PMI_TO_L1_DIS                           (1 << 16)
3167235711aSAlex Deucher #       define LC_ASPM_TO_L1_DIS                          (1 << 24)
3177235711aSAlex Deucher 
3188a7cd276SAlex Deucher #define PCIE_LC_LINK_WIDTH_CNTL                           0x100100A2 /* PCIE */
3198a7cd276SAlex Deucher #       define LC_LINK_WIDTH_SHIFT                        0
3208a7cd276SAlex Deucher #       define LC_LINK_WIDTH_MASK                         0x7
3218a7cd276SAlex Deucher #       define LC_LINK_WIDTH_X0                           0
3228a7cd276SAlex Deucher #       define LC_LINK_WIDTH_X1                           1
3238a7cd276SAlex Deucher #       define LC_LINK_WIDTH_X2                           2
3248a7cd276SAlex Deucher #       define LC_LINK_WIDTH_X4                           3
3258a7cd276SAlex Deucher #       define LC_LINK_WIDTH_X8                           4
3268a7cd276SAlex Deucher #       define LC_LINK_WIDTH_X16                          6
3278a7cd276SAlex Deucher #       define LC_LINK_WIDTH_RD_SHIFT                     4
3288a7cd276SAlex Deucher #       define LC_LINK_WIDTH_RD_MASK                      0x70
3298a7cd276SAlex Deucher #       define LC_RECONFIG_ARC_MISSING_ESCAPE             (1 << 7)
3308a7cd276SAlex Deucher #       define LC_RECONFIG_NOW                            (1 << 8)
3318a7cd276SAlex Deucher #       define LC_RENEGOTIATION_SUPPORT                   (1 << 9)
3328a7cd276SAlex Deucher #       define LC_RENEGOTIATE_EN                          (1 << 10)
3338a7cd276SAlex Deucher #       define LC_SHORT_RECONFIG_EN                       (1 << 11)
3348a7cd276SAlex Deucher #       define LC_UPCONFIGURE_SUPPORT                     (1 << 12)
3358a7cd276SAlex Deucher #       define LC_UPCONFIGURE_DIS                         (1 << 13)
3368a7cd276SAlex Deucher #       define LC_DYN_LANES_PWR_STATE(x)                  ((x) << 21)
3378a7cd276SAlex Deucher #       define LC_DYN_LANES_PWR_STATE_MASK                (0x3 << 21)
3388a7cd276SAlex Deucher #       define LC_DYN_LANES_PWR_STATE_SHIFT               21
3397235711aSAlex Deucher #define PCIE_LC_N_FTS_CNTL                                0x100100a3 /* PCIE */
3407235711aSAlex Deucher #       define LC_XMIT_N_FTS(x)                           ((x) << 0)
3417235711aSAlex Deucher #       define LC_XMIT_N_FTS_MASK                         (0xff << 0)
3427235711aSAlex Deucher #       define LC_XMIT_N_FTS_SHIFT                        0
3437235711aSAlex Deucher #       define LC_XMIT_N_FTS_OVERRIDE_EN                  (1 << 8)
3447235711aSAlex Deucher #       define LC_N_FTS_MASK                              (0xff << 24)
3458a7cd276SAlex Deucher #define PCIE_LC_SPEED_CNTL                                0x100100A4 /* PCIE */
3468a7cd276SAlex Deucher #       define LC_GEN2_EN_STRAP                           (1 << 0)
3478a7cd276SAlex Deucher #       define LC_GEN3_EN_STRAP                           (1 << 1)
3488a7cd276SAlex Deucher #       define LC_TARGET_LINK_SPEED_OVERRIDE_EN           (1 << 2)
3498a7cd276SAlex Deucher #       define LC_TARGET_LINK_SPEED_OVERRIDE_MASK         (0x3 << 3)
3508a7cd276SAlex Deucher #       define LC_TARGET_LINK_SPEED_OVERRIDE_SHIFT        3
3518a7cd276SAlex Deucher #       define LC_FORCE_EN_SW_SPEED_CHANGE                (1 << 5)
3528a7cd276SAlex Deucher #       define LC_FORCE_DIS_SW_SPEED_CHANGE               (1 << 6)
3538a7cd276SAlex Deucher #       define LC_FORCE_EN_HW_SPEED_CHANGE                (1 << 7)
3548a7cd276SAlex Deucher #       define LC_FORCE_DIS_HW_SPEED_CHANGE               (1 << 8)
3558a7cd276SAlex Deucher #       define LC_INITIATE_LINK_SPEED_CHANGE              (1 << 9)
3568a7cd276SAlex Deucher #       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK      (0x3 << 10)
3578a7cd276SAlex Deucher #       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT     10
3588a7cd276SAlex Deucher #       define LC_CURRENT_DATA_RATE_MASK                  (0x3 << 13) /* 0/1/2 = gen1/2/3 */
3598a7cd276SAlex Deucher #       define LC_CURRENT_DATA_RATE_SHIFT                 13
3608a7cd276SAlex Deucher #       define LC_CLR_FAILED_SPD_CHANGE_CNT               (1 << 16)
3618a7cd276SAlex Deucher #       define LC_OTHER_SIDE_EVER_SENT_GEN2               (1 << 18)
3628a7cd276SAlex Deucher #       define LC_OTHER_SIDE_SUPPORTS_GEN2                (1 << 19)
3638a7cd276SAlex Deucher #       define LC_OTHER_SIDE_EVER_SENT_GEN3               (1 << 20)
3648a7cd276SAlex Deucher #       define LC_OTHER_SIDE_SUPPORTS_GEN3                (1 << 21)
3658a7cd276SAlex Deucher 
3667235711aSAlex Deucher #define PCIE_LC_CNTL2                                     0x100100B1 /* PCIE */
3677235711aSAlex Deucher #       define LC_ALLOW_PDWN_IN_L1                        (1 << 17)
3687235711aSAlex Deucher #       define LC_ALLOW_PDWN_IN_L23                       (1 << 18)
3697235711aSAlex Deucher 
3707235711aSAlex Deucher #define PCIE_LC_CNTL3                                     0x100100B5 /* PCIE */
3717235711aSAlex Deucher #       define LC_GO_TO_RECOVERY                          (1 << 30)
3728a7cd276SAlex Deucher #define PCIE_LC_CNTL4                                     0x100100B6 /* PCIE */
3738a7cd276SAlex Deucher #       define LC_REDO_EQ                                 (1 << 5)
3748a7cd276SAlex Deucher #       define LC_SET_QUIESCE                             (1 << 13)
3758a7cd276SAlex Deucher 
3768a7cd276SAlex Deucher /* direct registers */
3776e2c3c0aSAlex Deucher #define PCIE_INDEX  					0x38
3786e2c3c0aSAlex Deucher #define PCIE_DATA  					0x3C
3796e2c3c0aSAlex Deucher 
38041a524abSAlex Deucher #define SMC_IND_INDEX_0  				0x200
38141a524abSAlex Deucher #define SMC_IND_DATA_0  				0x204
38241a524abSAlex Deucher 
38341a524abSAlex Deucher #define SMC_IND_ACCESS_CNTL  				0x240
38441a524abSAlex Deucher #define		AUTO_INCREMENT_IND_0			(1 << 0)
38541a524abSAlex Deucher 
38641a524abSAlex Deucher #define SMC_MESSAGE_0  					0x250
38741a524abSAlex Deucher #define		SMC_MSG_MASK				0xffff
38841a524abSAlex Deucher #define SMC_RESP_0  					0x254
38941a524abSAlex Deucher #define		SMC_RESP_MASK				0xffff
39041a524abSAlex Deucher 
39141a524abSAlex Deucher #define SMC_MSG_ARG_0  					0x290
39241a524abSAlex Deucher 
3931c49165dSAlex Deucher #define VGA_HDP_CONTROL  				0x328
3941c49165dSAlex Deucher #define		VGA_MEMORY_DISABLE				(1 << 4)
3951c49165dSAlex Deucher 
3968cc1a532SAlex Deucher #define DMIF_ADDR_CALC  				0xC00
3978cc1a532SAlex Deucher 
398bc01a8c7SAlex Deucher #define	PIPE0_DMIF_BUFFER_CONTROL			  0x0ca0
399bc01a8c7SAlex Deucher #       define DMIF_BUFFERS_ALLOCATED(x)                  ((x) << 0)
400bc01a8c7SAlex Deucher #       define DMIF_BUFFERS_ALLOCATED_COMPLETED           (1 << 4)
401bc01a8c7SAlex Deucher 
4021c49165dSAlex Deucher #define	SRBM_GFX_CNTL				        0xE44
4031c49165dSAlex Deucher #define		PIPEID(x)					((x) << 0)
4041c49165dSAlex Deucher #define		MEID(x)						((x) << 2)
4051c49165dSAlex Deucher #define		VMID(x)						((x) << 4)
4061c49165dSAlex Deucher #define		QUEUEID(x)					((x) << 8)
4071c49165dSAlex Deucher 
4086f2043ceSAlex Deucher #define	SRBM_STATUS2				        0xE4C
409cc066715SAlex Deucher #define		SDMA_BUSY 				(1 << 5)
410cc066715SAlex Deucher #define		SDMA1_BUSY 				(1 << 6)
4116f2043ceSAlex Deucher #define	SRBM_STATUS				        0xE50
412cc066715SAlex Deucher #define		UVD_RQ_PENDING 				(1 << 1)
413cc066715SAlex Deucher #define		GRBM_RQ_PENDING 			(1 << 5)
414cc066715SAlex Deucher #define		VMC_BUSY 				(1 << 8)
415cc066715SAlex Deucher #define		MCB_BUSY 				(1 << 9)
416cc066715SAlex Deucher #define		MCB_NON_DISPLAY_BUSY 			(1 << 10)
417cc066715SAlex Deucher #define		MCC_BUSY 				(1 << 11)
418cc066715SAlex Deucher #define		MCD_BUSY 				(1 << 12)
419cc066715SAlex Deucher #define		SEM_BUSY 				(1 << 14)
420cc066715SAlex Deucher #define		IH_BUSY 				(1 << 17)
421cc066715SAlex Deucher #define		UVD_BUSY 				(1 << 19)
4226f2043ceSAlex Deucher 
42321a93e13SAlex Deucher #define	SRBM_SOFT_RESET				        0xE60
42421a93e13SAlex Deucher #define		SOFT_RESET_BIF				(1 << 1)
42521a93e13SAlex Deucher #define		SOFT_RESET_R0PLL			(1 << 4)
42621a93e13SAlex Deucher #define		SOFT_RESET_DC				(1 << 5)
42721a93e13SAlex Deucher #define		SOFT_RESET_SDMA1			(1 << 6)
42821a93e13SAlex Deucher #define		SOFT_RESET_GRBM				(1 << 8)
42921a93e13SAlex Deucher #define		SOFT_RESET_HDP				(1 << 9)
43021a93e13SAlex Deucher #define		SOFT_RESET_IH				(1 << 10)
43121a93e13SAlex Deucher #define		SOFT_RESET_MC				(1 << 11)
43221a93e13SAlex Deucher #define		SOFT_RESET_ROM				(1 << 14)
43321a93e13SAlex Deucher #define		SOFT_RESET_SEM				(1 << 15)
43421a93e13SAlex Deucher #define		SOFT_RESET_VMC				(1 << 17)
43521a93e13SAlex Deucher #define		SOFT_RESET_SDMA				(1 << 20)
43621a93e13SAlex Deucher #define		SOFT_RESET_TST				(1 << 21)
43721a93e13SAlex Deucher #define		SOFT_RESET_REGBB		       	(1 << 22)
43821a93e13SAlex Deucher #define		SOFT_RESET_ORB				(1 << 23)
43921a93e13SAlex Deucher #define		SOFT_RESET_VCE				(1 << 24)
44021a93e13SAlex Deucher 
4411c49165dSAlex Deucher #define VM_L2_CNTL					0x1400
4421c49165dSAlex Deucher #define		ENABLE_L2_CACHE					(1 << 0)
4431c49165dSAlex Deucher #define		ENABLE_L2_FRAGMENT_PROCESSING			(1 << 1)
4441c49165dSAlex Deucher #define		L2_CACHE_PTE_ENDIAN_SWAP_MODE(x)		((x) << 2)
4451c49165dSAlex Deucher #define		L2_CACHE_PDE_ENDIAN_SWAP_MODE(x)		((x) << 4)
4461c49165dSAlex Deucher #define		ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE		(1 << 9)
4471c49165dSAlex Deucher #define		ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE	(1 << 10)
4481c49165dSAlex Deucher #define		EFFECTIVE_L2_QUEUE_SIZE(x)			(((x) & 7) << 15)
4491c49165dSAlex Deucher #define		CONTEXT1_IDENTITY_ACCESS_MODE(x)		(((x) & 3) << 19)
4501c49165dSAlex Deucher #define VM_L2_CNTL2					0x1404
4511c49165dSAlex Deucher #define		INVALIDATE_ALL_L1_TLBS				(1 << 0)
4521c49165dSAlex Deucher #define		INVALIDATE_L2_CACHE				(1 << 1)
4531c49165dSAlex Deucher #define		INVALIDATE_CACHE_MODE(x)			((x) << 26)
4541c49165dSAlex Deucher #define			INVALIDATE_PTE_AND_PDE_CACHES		0
4551c49165dSAlex Deucher #define			INVALIDATE_ONLY_PTE_CACHES		1
4561c49165dSAlex Deucher #define			INVALIDATE_ONLY_PDE_CACHES		2
4571c49165dSAlex Deucher #define VM_L2_CNTL3					0x1408
4581c49165dSAlex Deucher #define		BANK_SELECT(x)					((x) << 0)
4591c49165dSAlex Deucher #define		L2_CACHE_UPDATE_MODE(x)				((x) << 6)
4601c49165dSAlex Deucher #define		L2_CACHE_BIGK_FRAGMENT_SIZE(x)			((x) << 15)
4611c49165dSAlex Deucher #define		L2_CACHE_BIGK_ASSOCIATIVITY			(1 << 20)
4621c49165dSAlex Deucher #define	VM_L2_STATUS					0x140C
4631c49165dSAlex Deucher #define		L2_BUSY						(1 << 0)
4641c49165dSAlex Deucher #define VM_CONTEXT0_CNTL				0x1410
4651c49165dSAlex Deucher #define		ENABLE_CONTEXT					(1 << 0)
4661c49165dSAlex Deucher #define		PAGE_TABLE_DEPTH(x)				(((x) & 3) << 1)
467a00024b0SAlex Deucher #define		RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 3)
4681c49165dSAlex Deucher #define		RANGE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 4)
469a00024b0SAlex Deucher #define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT	(1 << 6)
470a00024b0SAlex Deucher #define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT	(1 << 7)
471a00024b0SAlex Deucher #define		PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 9)
472a00024b0SAlex Deucher #define		PDE0_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 10)
473a00024b0SAlex Deucher #define		VALID_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 12)
474a00024b0SAlex Deucher #define		VALID_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 13)
475a00024b0SAlex Deucher #define		READ_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 15)
476a00024b0SAlex Deucher #define		READ_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 16)
477a00024b0SAlex Deucher #define		WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 18)
478a00024b0SAlex Deucher #define		WRITE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 19)
4791c49165dSAlex Deucher #define VM_CONTEXT1_CNTL				0x1414
4801c49165dSAlex Deucher #define VM_CONTEXT0_CNTL2				0x1430
4811c49165dSAlex Deucher #define VM_CONTEXT1_CNTL2				0x1434
4821c49165dSAlex Deucher #define	VM_CONTEXT8_PAGE_TABLE_BASE_ADDR		0x1438
4831c49165dSAlex Deucher #define	VM_CONTEXT9_PAGE_TABLE_BASE_ADDR		0x143c
4841c49165dSAlex Deucher #define	VM_CONTEXT10_PAGE_TABLE_BASE_ADDR		0x1440
4851c49165dSAlex Deucher #define	VM_CONTEXT11_PAGE_TABLE_BASE_ADDR		0x1444
4861c49165dSAlex Deucher #define	VM_CONTEXT12_PAGE_TABLE_BASE_ADDR		0x1448
4871c49165dSAlex Deucher #define	VM_CONTEXT13_PAGE_TABLE_BASE_ADDR		0x144c
4881c49165dSAlex Deucher #define	VM_CONTEXT14_PAGE_TABLE_BASE_ADDR		0x1450
4891c49165dSAlex Deucher #define	VM_CONTEXT15_PAGE_TABLE_BASE_ADDR		0x1454
4901c49165dSAlex Deucher 
4911c49165dSAlex Deucher #define VM_INVALIDATE_REQUEST				0x1478
4921c49165dSAlex Deucher #define VM_INVALIDATE_RESPONSE				0x147c
4931c49165dSAlex Deucher 
4949d97c99bSAlex Deucher #define	VM_CONTEXT1_PROTECTION_FAULT_STATUS		0x14DC
4953ec7d11bSAlex Deucher #define		PROTECTIONS_MASK			(0xf << 0)
4963ec7d11bSAlex Deucher #define		PROTECTIONS_SHIFT			0
4973ec7d11bSAlex Deucher 		/* bit 0: range
4983ec7d11bSAlex Deucher 		 * bit 1: pde0
4993ec7d11bSAlex Deucher 		 * bit 2: valid
5003ec7d11bSAlex Deucher 		 * bit 3: read
5013ec7d11bSAlex Deucher 		 * bit 4: write
5023ec7d11bSAlex Deucher 		 */
5033ec7d11bSAlex Deucher #define		MEMORY_CLIENT_ID_MASK			(0xff << 12)
504939c0d3cSAlex Deucher #define		HAWAII_MEMORY_CLIENT_ID_MASK		(0x1ff << 12)
5053ec7d11bSAlex Deucher #define		MEMORY_CLIENT_ID_SHIFT			12
5063ec7d11bSAlex Deucher #define		MEMORY_CLIENT_RW_MASK			(1 << 24)
5073ec7d11bSAlex Deucher #define		MEMORY_CLIENT_RW_SHIFT			24
5083ec7d11bSAlex Deucher #define		FAULT_VMID_MASK				(0xf << 25)
5093ec7d11bSAlex Deucher #define		FAULT_VMID_SHIFT			25
5103ec7d11bSAlex Deucher 
5113ec7d11bSAlex Deucher #define	VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT		0x14E4
5129d97c99bSAlex Deucher 
5139d97c99bSAlex Deucher #define	VM_CONTEXT1_PROTECTION_FAULT_ADDR		0x14FC
5149d97c99bSAlex Deucher 
5151c49165dSAlex Deucher #define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR	0x1518
5161c49165dSAlex Deucher #define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR	0x151c
5171c49165dSAlex Deucher 
5181c49165dSAlex Deucher #define	VM_CONTEXT0_PAGE_TABLE_BASE_ADDR		0x153c
5191c49165dSAlex Deucher #define	VM_CONTEXT1_PAGE_TABLE_BASE_ADDR		0x1540
5201c49165dSAlex Deucher #define	VM_CONTEXT2_PAGE_TABLE_BASE_ADDR		0x1544
5211c49165dSAlex Deucher #define	VM_CONTEXT3_PAGE_TABLE_BASE_ADDR		0x1548
5221c49165dSAlex Deucher #define	VM_CONTEXT4_PAGE_TABLE_BASE_ADDR		0x154c
5231c49165dSAlex Deucher #define	VM_CONTEXT5_PAGE_TABLE_BASE_ADDR		0x1550
5241c49165dSAlex Deucher #define	VM_CONTEXT6_PAGE_TABLE_BASE_ADDR		0x1554
5251c49165dSAlex Deucher #define	VM_CONTEXT7_PAGE_TABLE_BASE_ADDR		0x1558
5261c49165dSAlex Deucher #define	VM_CONTEXT0_PAGE_TABLE_START_ADDR		0x155c
5271c49165dSAlex Deucher #define	VM_CONTEXT1_PAGE_TABLE_START_ADDR		0x1560
5281c49165dSAlex Deucher 
5291c49165dSAlex Deucher #define	VM_CONTEXT0_PAGE_TABLE_END_ADDR			0x157C
5301c49165dSAlex Deucher #define	VM_CONTEXT1_PAGE_TABLE_END_ADDR			0x1580
5311c49165dSAlex Deucher 
53222c775ceSAlex Deucher #define VM_L2_CG           				0x15c0
53322c775ceSAlex Deucher #define		MC_CG_ENABLE				(1 << 18)
53422c775ceSAlex Deucher #define		MC_LS_ENABLE				(1 << 19)
53522c775ceSAlex Deucher 
5368cc1a532SAlex Deucher #define MC_SHARED_CHMAP						0x2004
5378cc1a532SAlex Deucher #define		NOOFCHAN_SHIFT					12
5388cc1a532SAlex Deucher #define		NOOFCHAN_MASK					0x0000f000
5398cc1a532SAlex Deucher #define MC_SHARED_CHREMAP					0x2008
5408cc1a532SAlex Deucher 
5411c49165dSAlex Deucher #define CHUB_CONTROL					0x1864
5421c49165dSAlex Deucher #define		BYPASS_VM					(1 << 0)
5431c49165dSAlex Deucher 
5441c49165dSAlex Deucher #define	MC_VM_FB_LOCATION				0x2024
5451c49165dSAlex Deucher #define	MC_VM_AGP_TOP					0x2028
5461c49165dSAlex Deucher #define	MC_VM_AGP_BOT					0x202C
5471c49165dSAlex Deucher #define	MC_VM_AGP_BASE					0x2030
5481c49165dSAlex Deucher #define	MC_VM_SYSTEM_APERTURE_LOW_ADDR			0x2034
5491c49165dSAlex Deucher #define	MC_VM_SYSTEM_APERTURE_HIGH_ADDR			0x2038
5501c49165dSAlex Deucher #define	MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR		0x203C
5511c49165dSAlex Deucher 
5521c49165dSAlex Deucher #define	MC_VM_MX_L1_TLB_CNTL				0x2064
5531c49165dSAlex Deucher #define		ENABLE_L1_TLB					(1 << 0)
5541c49165dSAlex Deucher #define		ENABLE_L1_FRAGMENT_PROCESSING			(1 << 1)
5551c49165dSAlex Deucher #define		SYSTEM_ACCESS_MODE_PA_ONLY			(0 << 3)
5561c49165dSAlex Deucher #define		SYSTEM_ACCESS_MODE_USE_SYS_MAP			(1 << 3)
5571c49165dSAlex Deucher #define		SYSTEM_ACCESS_MODE_IN_SYS			(2 << 3)
5581c49165dSAlex Deucher #define		SYSTEM_ACCESS_MODE_NOT_IN_SYS			(3 << 3)
5591c49165dSAlex Deucher #define		SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU	(0 << 5)
5601c49165dSAlex Deucher #define		ENABLE_ADVANCED_DRIVER_MODEL			(1 << 6)
5611c49165dSAlex Deucher #define	MC_VM_FB_OFFSET					0x2068
5621c49165dSAlex Deucher 
563bc8273feSAlex Deucher #define MC_SHARED_BLACKOUT_CNTL           		0x20ac
564bc8273feSAlex Deucher 
56522c775ceSAlex Deucher #define MC_HUB_MISC_HUB_CG           			0x20b8
56622c775ceSAlex Deucher #define MC_HUB_MISC_VM_CG           			0x20bc
56722c775ceSAlex Deucher 
56822c775ceSAlex Deucher #define MC_HUB_MISC_SIP_CG           			0x20c0
56922c775ceSAlex Deucher 
57022c775ceSAlex Deucher #define MC_XPB_CLK_GAT           			0x2478
57122c775ceSAlex Deucher 
57222c775ceSAlex Deucher #define MC_CITF_MISC_RD_CG           			0x2648
57322c775ceSAlex Deucher #define MC_CITF_MISC_WR_CG           			0x264c
57422c775ceSAlex Deucher #define MC_CITF_MISC_VM_CG           			0x2650
57522c775ceSAlex Deucher 
5768cc1a532SAlex Deucher #define	MC_ARB_RAMCFG					0x2760
5778cc1a532SAlex Deucher #define		NOOFBANK_SHIFT					0
5788cc1a532SAlex Deucher #define		NOOFBANK_MASK					0x00000003
5798cc1a532SAlex Deucher #define		NOOFRANK_SHIFT					2
5808cc1a532SAlex Deucher #define		NOOFRANK_MASK					0x00000004
5818cc1a532SAlex Deucher #define		NOOFROWS_SHIFT					3
5828cc1a532SAlex Deucher #define		NOOFROWS_MASK					0x00000038
5838cc1a532SAlex Deucher #define		NOOFCOLS_SHIFT					6
5848cc1a532SAlex Deucher #define		NOOFCOLS_MASK					0x000000C0
5858cc1a532SAlex Deucher #define		CHANSIZE_SHIFT					8
5868cc1a532SAlex Deucher #define		CHANSIZE_MASK					0x00000100
5878cc1a532SAlex Deucher #define		NOOFGROUPS_SHIFT				12
5888cc1a532SAlex Deucher #define		NOOFGROUPS_MASK					0x00001000
5898cc1a532SAlex Deucher 
590cc8dbbb4SAlex Deucher #define	MC_ARB_DRAM_TIMING				0x2774
591cc8dbbb4SAlex Deucher #define	MC_ARB_DRAM_TIMING2				0x2778
592cc8dbbb4SAlex Deucher 
593cc8dbbb4SAlex Deucher #define MC_ARB_BURST_TIME                               0x2808
594cc8dbbb4SAlex Deucher #define		STATE0(x)				((x) << 0)
595cc8dbbb4SAlex Deucher #define		STATE0_MASK				(0x1f << 0)
596cc8dbbb4SAlex Deucher #define		STATE0_SHIFT				0
597cc8dbbb4SAlex Deucher #define		STATE1(x)				((x) << 5)
598cc8dbbb4SAlex Deucher #define		STATE1_MASK				(0x1f << 5)
599cc8dbbb4SAlex Deucher #define		STATE1_SHIFT				5
600cc8dbbb4SAlex Deucher #define		STATE2(x)				((x) << 10)
601cc8dbbb4SAlex Deucher #define		STATE2_MASK				(0x1f << 10)
602cc8dbbb4SAlex Deucher #define		STATE2_SHIFT				10
603cc8dbbb4SAlex Deucher #define		STATE3(x)				((x) << 15)
604cc8dbbb4SAlex Deucher #define		STATE3_MASK				(0x1f << 15)
605cc8dbbb4SAlex Deucher #define		STATE3_SHIFT				15
606cc8dbbb4SAlex Deucher 
607cc8dbbb4SAlex Deucher #define MC_SEQ_RAS_TIMING                               0x28a0
608cc8dbbb4SAlex Deucher #define MC_SEQ_CAS_TIMING                               0x28a4
609cc8dbbb4SAlex Deucher #define MC_SEQ_MISC_TIMING                              0x28a8
610cc8dbbb4SAlex Deucher #define MC_SEQ_MISC_TIMING2                             0x28ac
611cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_TIMING                               0x28b0
612cc8dbbb4SAlex Deucher #define MC_SEQ_RD_CTL_D0                                0x28b4
613cc8dbbb4SAlex Deucher #define MC_SEQ_RD_CTL_D1                                0x28b8
614cc8dbbb4SAlex Deucher #define MC_SEQ_WR_CTL_D0                                0x28bc
615cc8dbbb4SAlex Deucher #define MC_SEQ_WR_CTL_D1                                0x28c0
616cc8dbbb4SAlex Deucher 
617bc8273feSAlex Deucher #define MC_SEQ_SUP_CNTL           			0x28c8
618bc8273feSAlex Deucher #define		RUN_MASK      				(1 << 0)
619bc8273feSAlex Deucher #define MC_SEQ_SUP_PGM           			0x28cc
620cc8dbbb4SAlex Deucher #define MC_PMG_AUTO_CMD           			0x28d0
621bc8273feSAlex Deucher 
622bc8273feSAlex Deucher #define	MC_SEQ_TRAIN_WAKEUP_CNTL			0x28e8
623bc8273feSAlex Deucher #define		TRAIN_DONE_D0      			(1 << 30)
624bc8273feSAlex Deucher #define		TRAIN_DONE_D1      			(1 << 31)
625bc8273feSAlex Deucher 
626bc8273feSAlex Deucher #define MC_IO_PAD_CNTL_D0           			0x29d0
627bc8273feSAlex Deucher #define		MEM_FALL_OUT_CMD      			(1 << 8)
628bc8273feSAlex Deucher 
629cc8dbbb4SAlex Deucher #define MC_SEQ_MISC0           				0x2a00
630cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_VEN_ID_SHIFT               8
631cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_VEN_ID_MASK                0x00000f00
632cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_VEN_ID_VALUE               3
633cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_REV_ID_SHIFT               12
634cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_REV_ID_MASK                0x0000f000
635cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_REV_ID_VALUE               1
636cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_GDDR5_SHIFT                28
637cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_GDDR5_MASK                 0xf0000000
638cc8dbbb4SAlex Deucher #define 	MC_SEQ_MISC0_GDDR5_VALUE                5
639cc8dbbb4SAlex Deucher #define MC_SEQ_MISC1                                    0x2a04
640cc8dbbb4SAlex Deucher #define MC_SEQ_RESERVE_M                                0x2a08
641cc8dbbb4SAlex Deucher #define MC_PMG_CMD_EMRS                                 0x2a0c
642cc8dbbb4SAlex Deucher 
643bc8273feSAlex Deucher #define MC_SEQ_IO_DEBUG_INDEX           		0x2a44
644bc8273feSAlex Deucher #define MC_SEQ_IO_DEBUG_DATA           			0x2a48
645bc8273feSAlex Deucher 
646cc8dbbb4SAlex Deucher #define MC_SEQ_MISC5                                    0x2a54
647cc8dbbb4SAlex Deucher #define MC_SEQ_MISC6                                    0x2a58
648cc8dbbb4SAlex Deucher 
649cc8dbbb4SAlex Deucher #define MC_SEQ_MISC7                                    0x2a64
650cc8dbbb4SAlex Deucher 
651cc8dbbb4SAlex Deucher #define MC_SEQ_RAS_TIMING_LP                            0x2a6c
652cc8dbbb4SAlex Deucher #define MC_SEQ_CAS_TIMING_LP                            0x2a70
653cc8dbbb4SAlex Deucher #define MC_SEQ_MISC_TIMING_LP                           0x2a74
654cc8dbbb4SAlex Deucher #define MC_SEQ_MISC_TIMING2_LP                          0x2a78
655cc8dbbb4SAlex Deucher #define MC_SEQ_WR_CTL_D0_LP                             0x2a7c
656cc8dbbb4SAlex Deucher #define MC_SEQ_WR_CTL_D1_LP                             0x2a80
657cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_CMD_EMRS_LP                          0x2a84
658cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_CMD_MRS_LP                           0x2a88
659cc8dbbb4SAlex Deucher 
660cc8dbbb4SAlex Deucher #define MC_PMG_CMD_MRS                                  0x2aac
661cc8dbbb4SAlex Deucher 
662cc8dbbb4SAlex Deucher #define MC_SEQ_RD_CTL_D0_LP                             0x2b1c
663cc8dbbb4SAlex Deucher #define MC_SEQ_RD_CTL_D1_LP                             0x2b20
664cc8dbbb4SAlex Deucher 
665cc8dbbb4SAlex Deucher #define MC_PMG_CMD_MRS1                                 0x2b44
666cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_CMD_MRS1_LP                          0x2b48
667cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_TIMING_LP                            0x2b4c
668cc8dbbb4SAlex Deucher 
669cc8dbbb4SAlex Deucher #define MC_SEQ_WR_CTL_2                                 0x2b54
670cc8dbbb4SAlex Deucher #define MC_SEQ_WR_CTL_2_LP                              0x2b58
671cc8dbbb4SAlex Deucher #define MC_PMG_CMD_MRS2                                 0x2b5c
672cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_CMD_MRS2_LP                          0x2b60
673cc8dbbb4SAlex Deucher 
674cc8dbbb4SAlex Deucher #define	MCLK_PWRMGT_CNTL				0x2ba0
675cc8dbbb4SAlex Deucher #       define DLL_SPEED(x)				((x) << 0)
676cc8dbbb4SAlex Deucher #       define DLL_SPEED_MASK				(0x1f << 0)
677cc8dbbb4SAlex Deucher #       define DLL_READY                                (1 << 6)
678cc8dbbb4SAlex Deucher #       define MC_INT_CNTL                              (1 << 7)
679cc8dbbb4SAlex Deucher #       define MRDCK0_PDNB                              (1 << 8)
680cc8dbbb4SAlex Deucher #       define MRDCK1_PDNB                              (1 << 9)
681cc8dbbb4SAlex Deucher #       define MRDCK0_RESET                             (1 << 16)
682cc8dbbb4SAlex Deucher #       define MRDCK1_RESET                             (1 << 17)
683cc8dbbb4SAlex Deucher #       define DLL_READY_READ                           (1 << 24)
684cc8dbbb4SAlex Deucher #define	DLL_CNTL					0x2ba4
685cc8dbbb4SAlex Deucher #       define MRDCK0_BYPASS                            (1 << 24)
686cc8dbbb4SAlex Deucher #       define MRDCK1_BYPASS                            (1 << 25)
687cc8dbbb4SAlex Deucher 
688cc8dbbb4SAlex Deucher #define	MPLL_FUNC_CNTL					0x2bb4
689cc8dbbb4SAlex Deucher #define		BWCTRL(x)				((x) << 20)
690cc8dbbb4SAlex Deucher #define		BWCTRL_MASK				(0xff << 20)
691cc8dbbb4SAlex Deucher #define	MPLL_FUNC_CNTL_1				0x2bb8
692cc8dbbb4SAlex Deucher #define		VCO_MODE(x)				((x) << 0)
693cc8dbbb4SAlex Deucher #define		VCO_MODE_MASK				(3 << 0)
694cc8dbbb4SAlex Deucher #define		CLKFRAC(x)				((x) << 4)
695cc8dbbb4SAlex Deucher #define		CLKFRAC_MASK				(0xfff << 4)
696cc8dbbb4SAlex Deucher #define		CLKF(x)					((x) << 16)
697cc8dbbb4SAlex Deucher #define		CLKF_MASK				(0xfff << 16)
698cc8dbbb4SAlex Deucher #define	MPLL_FUNC_CNTL_2				0x2bbc
699cc8dbbb4SAlex Deucher #define	MPLL_AD_FUNC_CNTL				0x2bc0
700cc8dbbb4SAlex Deucher #define		YCLK_POST_DIV(x)			((x) << 0)
701cc8dbbb4SAlex Deucher #define		YCLK_POST_DIV_MASK			(7 << 0)
702cc8dbbb4SAlex Deucher #define	MPLL_DQ_FUNC_CNTL				0x2bc4
703cc8dbbb4SAlex Deucher #define		YCLK_SEL(x)				((x) << 4)
704cc8dbbb4SAlex Deucher #define		YCLK_SEL_MASK				(1 << 4)
705cc8dbbb4SAlex Deucher 
706cc8dbbb4SAlex Deucher #define	MPLL_SS1					0x2bcc
707cc8dbbb4SAlex Deucher #define		CLKV(x)					((x) << 0)
708cc8dbbb4SAlex Deucher #define		CLKV_MASK				(0x3ffffff << 0)
709cc8dbbb4SAlex Deucher #define	MPLL_SS2					0x2bd0
710cc8dbbb4SAlex Deucher #define		CLKS(x)					((x) << 0)
711cc8dbbb4SAlex Deucher #define		CLKS_MASK				(0xfff << 0)
712cc8dbbb4SAlex Deucher 
7138cc1a532SAlex Deucher #define	HDP_HOST_PATH_CNTL				0x2C00
71422c775ceSAlex Deucher #define 	CLOCK_GATING_DIS			(1 << 23)
7158cc1a532SAlex Deucher #define	HDP_NONSURFACE_BASE				0x2C04
7168cc1a532SAlex Deucher #define	HDP_NONSURFACE_INFO				0x2C08
7178cc1a532SAlex Deucher #define	HDP_NONSURFACE_SIZE				0x2C0C
7188cc1a532SAlex Deucher 
7198cc1a532SAlex Deucher #define HDP_ADDR_CONFIG  				0x2F48
7208cc1a532SAlex Deucher #define HDP_MISC_CNTL					0x2F4C
7218cc1a532SAlex Deucher #define 	HDP_FLUSH_INVALIDATE_CACHE			(1 << 0)
72222c775ceSAlex Deucher #define HDP_MEM_POWER_LS				0x2F50
72322c775ceSAlex Deucher #define 	HDP_LS_ENABLE				(1 << 0)
72422c775ceSAlex Deucher 
72522c775ceSAlex Deucher #define ATC_MISC_CG           				0x3350
7268cc1a532SAlex Deucher 
7270279ed19SAlex Deucher #define GMCON_RENG_EXECUTE				0x3508
7280279ed19SAlex Deucher #define 	RENG_EXECUTE_ON_PWR_UP			(1 << 0)
7290279ed19SAlex Deucher #define GMCON_MISC					0x350c
7300279ed19SAlex Deucher #define 	RENG_EXECUTE_ON_REG_UPDATE		(1 << 11)
7310279ed19SAlex Deucher #define 	STCTRL_STUTTER_EN			(1 << 16)
7320279ed19SAlex Deucher 
7330279ed19SAlex Deucher #define GMCON_PGFSM_CONFIG				0x3538
7340279ed19SAlex Deucher #define GMCON_PGFSM_WRITE				0x353c
7350279ed19SAlex Deucher #define GMCON_PGFSM_READ				0x3540
7360279ed19SAlex Deucher #define GMCON_MISC3					0x3544
7370279ed19SAlex Deucher 
738cc8dbbb4SAlex Deucher #define MC_SEQ_CNTL_3                                     0x3600
739cc8dbbb4SAlex Deucher #       define CAC_EN                                     (1 << 31)
740cc8dbbb4SAlex Deucher #define MC_SEQ_G5PDX_CTRL                                 0x3604
741cc8dbbb4SAlex Deucher #define MC_SEQ_G5PDX_CTRL_LP                              0x3608
742cc8dbbb4SAlex Deucher #define MC_SEQ_G5PDX_CMD0                                 0x360c
743cc8dbbb4SAlex Deucher #define MC_SEQ_G5PDX_CMD0_LP                              0x3610
744cc8dbbb4SAlex Deucher #define MC_SEQ_G5PDX_CMD1                                 0x3614
745cc8dbbb4SAlex Deucher #define MC_SEQ_G5PDX_CMD1_LP                              0x3618
746cc8dbbb4SAlex Deucher 
747cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_DVS_CTL                                0x3628
748cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_DVS_CTL_LP                             0x362c
749cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_DVS_CMD                                0x3630
750cc8dbbb4SAlex Deucher #define MC_SEQ_PMG_DVS_CMD_LP                             0x3634
751cc8dbbb4SAlex Deucher #define MC_SEQ_DLL_STBY                                   0x3638
752cc8dbbb4SAlex Deucher #define MC_SEQ_DLL_STBY_LP                                0x363c
753cc8dbbb4SAlex Deucher 
754a59781bbSAlex Deucher #define IH_RB_CNTL                                        0x3e00
755a59781bbSAlex Deucher #       define IH_RB_ENABLE                               (1 << 0)
756a59781bbSAlex Deucher #       define IH_RB_SIZE(x)                              ((x) << 1) /* log2 */
757a59781bbSAlex Deucher #       define IH_RB_FULL_DRAIN_ENABLE                    (1 << 6)
758a59781bbSAlex Deucher #       define IH_WPTR_WRITEBACK_ENABLE                   (1 << 8)
759a59781bbSAlex Deucher #       define IH_WPTR_WRITEBACK_TIMER(x)                 ((x) << 9) /* log2 */
760a59781bbSAlex Deucher #       define IH_WPTR_OVERFLOW_ENABLE                    (1 << 16)
761a59781bbSAlex Deucher #       define IH_WPTR_OVERFLOW_CLEAR                     (1 << 31)
762a59781bbSAlex Deucher #define IH_RB_BASE                                        0x3e04
763a59781bbSAlex Deucher #define IH_RB_RPTR                                        0x3e08
764a59781bbSAlex Deucher #define IH_RB_WPTR                                        0x3e0c
765a59781bbSAlex Deucher #       define RB_OVERFLOW                                (1 << 0)
766a59781bbSAlex Deucher #       define WPTR_OFFSET_MASK                           0x3fffc
767a59781bbSAlex Deucher #define IH_RB_WPTR_ADDR_HI                                0x3e10
768a59781bbSAlex Deucher #define IH_RB_WPTR_ADDR_LO                                0x3e14
769a59781bbSAlex Deucher #define IH_CNTL                                           0x3e18
770a59781bbSAlex Deucher #       define ENABLE_INTR                                (1 << 0)
771a59781bbSAlex Deucher #       define IH_MC_SWAP(x)                              ((x) << 1)
772a59781bbSAlex Deucher #       define IH_MC_SWAP_NONE                            0
773a59781bbSAlex Deucher #       define IH_MC_SWAP_16BIT                           1
774a59781bbSAlex Deucher #       define IH_MC_SWAP_32BIT                           2
775a59781bbSAlex Deucher #       define IH_MC_SWAP_64BIT                           3
776a59781bbSAlex Deucher #       define RPTR_REARM                                 (1 << 4)
777a59781bbSAlex Deucher #       define MC_WRREQ_CREDIT(x)                         ((x) << 15)
778a59781bbSAlex Deucher #       define MC_WR_CLEAN_CNT(x)                         ((x) << 20)
779a59781bbSAlex Deucher #       define MC_VMID(x)                                 ((x) << 25)
780a59781bbSAlex Deucher 
781cc8dbbb4SAlex Deucher #define	BIF_LNCNT_RESET					0x5220
782cc8dbbb4SAlex Deucher #       define RESET_LNCNT_EN                           (1 << 0)
783cc8dbbb4SAlex Deucher 
7841c49165dSAlex Deucher #define	CONFIG_MEMSIZE					0x5428
7851c49165dSAlex Deucher 
786a59781bbSAlex Deucher #define INTERRUPT_CNTL                                    0x5468
787a59781bbSAlex Deucher #       define IH_DUMMY_RD_OVERRIDE                       (1 << 0)
788a59781bbSAlex Deucher #       define IH_DUMMY_RD_EN                             (1 << 1)
789a59781bbSAlex Deucher #       define IH_REQ_NONSNOOP_EN                         (1 << 3)
790a59781bbSAlex Deucher #       define GEN_IH_INT_EN                              (1 << 8)
791a59781bbSAlex Deucher #define INTERRUPT_CNTL2                                   0x546c
792a59781bbSAlex Deucher 
7931c49165dSAlex Deucher #define HDP_MEM_COHERENCY_FLUSH_CNTL			0x5480
7941c49165dSAlex Deucher 
7958cc1a532SAlex Deucher #define	BIF_FB_EN						0x5490
7968cc1a532SAlex Deucher #define		FB_READ_EN					(1 << 0)
7978cc1a532SAlex Deucher #define		FB_WRITE_EN					(1 << 1)
7988cc1a532SAlex Deucher 
7991c49165dSAlex Deucher #define HDP_REG_COHERENCY_FLUSH_CNTL			0x54A0
8001c49165dSAlex Deucher 
8012cae3bc3SAlex Deucher #define GPU_HDP_FLUSH_REQ				0x54DC
8022cae3bc3SAlex Deucher #define GPU_HDP_FLUSH_DONE				0x54E0
8032cae3bc3SAlex Deucher #define		CP0					(1 << 0)
8042cae3bc3SAlex Deucher #define		CP1					(1 << 1)
8052cae3bc3SAlex Deucher #define		CP2					(1 << 2)
8062cae3bc3SAlex Deucher #define		CP3					(1 << 3)
8072cae3bc3SAlex Deucher #define		CP4					(1 << 4)
8082cae3bc3SAlex Deucher #define		CP5					(1 << 5)
8092cae3bc3SAlex Deucher #define		CP6					(1 << 6)
8102cae3bc3SAlex Deucher #define		CP7					(1 << 7)
8112cae3bc3SAlex Deucher #define		CP8					(1 << 8)
8122cae3bc3SAlex Deucher #define		CP9					(1 << 9)
8132cae3bc3SAlex Deucher #define		SDMA0					(1 << 10)
8142cae3bc3SAlex Deucher #define		SDMA1					(1 << 11)
8152cae3bc3SAlex Deucher 
816cd84a27dSAlex Deucher /* 0x6b04, 0x7704, 0x10304, 0x10f04, 0x11b04, 0x12704 */
817cd84a27dSAlex Deucher #define	LB_MEMORY_CTRL					0x6b04
818cd84a27dSAlex Deucher #define		LB_MEMORY_SIZE(x)			((x) << 0)
819cd84a27dSAlex Deucher #define		LB_MEMORY_CONFIG(x)			((x) << 20)
820cd84a27dSAlex Deucher 
821cd84a27dSAlex Deucher #define	DPG_WATERMARK_MASK_CONTROL			0x6cc8
822cd84a27dSAlex Deucher #       define LATENCY_WATERMARK_MASK(x)		((x) << 8)
823cd84a27dSAlex Deucher #define	DPG_PIPE_LATENCY_CONTROL			0x6ccc
824cd84a27dSAlex Deucher #       define LATENCY_LOW_WATERMARK(x)			((x) << 0)
825cd84a27dSAlex Deucher #       define LATENCY_HIGH_WATERMARK(x)		((x) << 16)
826cd84a27dSAlex Deucher 
827a59781bbSAlex Deucher /* 0x6b24, 0x7724, 0x10324, 0x10f24, 0x11b24, 0x12724 */
828a59781bbSAlex Deucher #define LB_VLINE_STATUS                                 0x6b24
829a59781bbSAlex Deucher #       define VLINE_OCCURRED                           (1 << 0)
830a59781bbSAlex Deucher #       define VLINE_ACK                                (1 << 4)
831a59781bbSAlex Deucher #       define VLINE_STAT                               (1 << 12)
832a59781bbSAlex Deucher #       define VLINE_INTERRUPT                          (1 << 16)
833a59781bbSAlex Deucher #       define VLINE_INTERRUPT_TYPE                     (1 << 17)
834a59781bbSAlex Deucher /* 0x6b2c, 0x772c, 0x1032c, 0x10f2c, 0x11b2c, 0x1272c */
835a59781bbSAlex Deucher #define LB_VBLANK_STATUS                                0x6b2c
836a59781bbSAlex Deucher #       define VBLANK_OCCURRED                          (1 << 0)
837a59781bbSAlex Deucher #       define VBLANK_ACK                               (1 << 4)
838a59781bbSAlex Deucher #       define VBLANK_STAT                              (1 << 12)
839a59781bbSAlex Deucher #       define VBLANK_INTERRUPT                         (1 << 16)
840a59781bbSAlex Deucher #       define VBLANK_INTERRUPT_TYPE                    (1 << 17)
841a59781bbSAlex Deucher 
842a59781bbSAlex Deucher /* 0x6b20, 0x7720, 0x10320, 0x10f20, 0x11b20, 0x12720 */
843a59781bbSAlex Deucher #define LB_INTERRUPT_MASK                               0x6b20
844a59781bbSAlex Deucher #       define VBLANK_INTERRUPT_MASK                    (1 << 0)
845a59781bbSAlex Deucher #       define VLINE_INTERRUPT_MASK                     (1 << 4)
846a59781bbSAlex Deucher #       define VLINE2_INTERRUPT_MASK                    (1 << 8)
847a59781bbSAlex Deucher 
848a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS                           0x60f4
849a59781bbSAlex Deucher #       define LB_D1_VLINE_INTERRUPT                    (1 << 2)
850a59781bbSAlex Deucher #       define LB_D1_VBLANK_INTERRUPT                   (1 << 3)
851a59781bbSAlex Deucher #       define DC_HPD1_INTERRUPT                        (1 << 17)
852a59781bbSAlex Deucher #       define DC_HPD1_RX_INTERRUPT                     (1 << 18)
853a59781bbSAlex Deucher #       define DACA_AUTODETECT_INTERRUPT                (1 << 22)
854a59781bbSAlex Deucher #       define DACB_AUTODETECT_INTERRUPT                (1 << 23)
855a59781bbSAlex Deucher #       define DC_I2C_SW_DONE_INTERRUPT                 (1 << 24)
856a59781bbSAlex Deucher #       define DC_I2C_HW_DONE_INTERRUPT                 (1 << 25)
857a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS_CONTINUE                  0x60f8
858a59781bbSAlex Deucher #       define LB_D2_VLINE_INTERRUPT                    (1 << 2)
859a59781bbSAlex Deucher #       define LB_D2_VBLANK_INTERRUPT                   (1 << 3)
860a59781bbSAlex Deucher #       define DC_HPD2_INTERRUPT                        (1 << 17)
861a59781bbSAlex Deucher #       define DC_HPD2_RX_INTERRUPT                     (1 << 18)
862a59781bbSAlex Deucher #       define DISP_TIMER_INTERRUPT                     (1 << 24)
863a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS_CONTINUE2                 0x60fc
864a59781bbSAlex Deucher #       define LB_D3_VLINE_INTERRUPT                    (1 << 2)
865a59781bbSAlex Deucher #       define LB_D3_VBLANK_INTERRUPT                   (1 << 3)
866a59781bbSAlex Deucher #       define DC_HPD3_INTERRUPT                        (1 << 17)
867a59781bbSAlex Deucher #       define DC_HPD3_RX_INTERRUPT                     (1 << 18)
868a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS_CONTINUE3                 0x6100
869a59781bbSAlex Deucher #       define LB_D4_VLINE_INTERRUPT                    (1 << 2)
870a59781bbSAlex Deucher #       define LB_D4_VBLANK_INTERRUPT                   (1 << 3)
871a59781bbSAlex Deucher #       define DC_HPD4_INTERRUPT                        (1 << 17)
872a59781bbSAlex Deucher #       define DC_HPD4_RX_INTERRUPT                     (1 << 18)
873a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS_CONTINUE4                 0x614c
874a59781bbSAlex Deucher #       define LB_D5_VLINE_INTERRUPT                    (1 << 2)
875a59781bbSAlex Deucher #       define LB_D5_VBLANK_INTERRUPT                   (1 << 3)
876a59781bbSAlex Deucher #       define DC_HPD5_INTERRUPT                        (1 << 17)
877a59781bbSAlex Deucher #       define DC_HPD5_RX_INTERRUPT                     (1 << 18)
878a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS_CONTINUE5                 0x6150
879a59781bbSAlex Deucher #       define LB_D6_VLINE_INTERRUPT                    (1 << 2)
880a59781bbSAlex Deucher #       define LB_D6_VBLANK_INTERRUPT                   (1 << 3)
881a59781bbSAlex Deucher #       define DC_HPD6_INTERRUPT                        (1 << 17)
882a59781bbSAlex Deucher #       define DC_HPD6_RX_INTERRUPT                     (1 << 18)
883a59781bbSAlex Deucher #define DISP_INTERRUPT_STATUS_CONTINUE6                 0x6780
884a59781bbSAlex Deucher 
885a59781bbSAlex Deucher #define	DAC_AUTODETECT_INT_CONTROL			0x67c8
886a59781bbSAlex Deucher 
887a59781bbSAlex Deucher #define DC_HPD1_INT_STATUS                              0x601c
888a59781bbSAlex Deucher #define DC_HPD2_INT_STATUS                              0x6028
889a59781bbSAlex Deucher #define DC_HPD3_INT_STATUS                              0x6034
890a59781bbSAlex Deucher #define DC_HPD4_INT_STATUS                              0x6040
891a59781bbSAlex Deucher #define DC_HPD5_INT_STATUS                              0x604c
892a59781bbSAlex Deucher #define DC_HPD6_INT_STATUS                              0x6058
893a59781bbSAlex Deucher #       define DC_HPDx_INT_STATUS                       (1 << 0)
894a59781bbSAlex Deucher #       define DC_HPDx_SENSE                            (1 << 1)
895a59781bbSAlex Deucher #       define DC_HPDx_SENSE_DELAYED                    (1 << 4)
896a59781bbSAlex Deucher #       define DC_HPDx_RX_INT_STATUS                    (1 << 8)
897a59781bbSAlex Deucher 
898a59781bbSAlex Deucher #define DC_HPD1_INT_CONTROL                             0x6020
899a59781bbSAlex Deucher #define DC_HPD2_INT_CONTROL                             0x602c
900a59781bbSAlex Deucher #define DC_HPD3_INT_CONTROL                             0x6038
901a59781bbSAlex Deucher #define DC_HPD4_INT_CONTROL                             0x6044
902a59781bbSAlex Deucher #define DC_HPD5_INT_CONTROL                             0x6050
903a59781bbSAlex Deucher #define DC_HPD6_INT_CONTROL                             0x605c
904a59781bbSAlex Deucher #       define DC_HPDx_INT_ACK                          (1 << 0)
905a59781bbSAlex Deucher #       define DC_HPDx_INT_POLARITY                     (1 << 8)
906a59781bbSAlex Deucher #       define DC_HPDx_INT_EN                           (1 << 16)
907a59781bbSAlex Deucher #       define DC_HPDx_RX_INT_ACK                       (1 << 20)
908a59781bbSAlex Deucher #       define DC_HPDx_RX_INT_EN                        (1 << 24)
909a59781bbSAlex Deucher 
910a59781bbSAlex Deucher #define DC_HPD1_CONTROL                                   0x6024
911a59781bbSAlex Deucher #define DC_HPD2_CONTROL                                   0x6030
912a59781bbSAlex Deucher #define DC_HPD3_CONTROL                                   0x603c
913a59781bbSAlex Deucher #define DC_HPD4_CONTROL                                   0x6048
914a59781bbSAlex Deucher #define DC_HPD5_CONTROL                                   0x6054
915a59781bbSAlex Deucher #define DC_HPD6_CONTROL                                   0x6060
916a59781bbSAlex Deucher #       define DC_HPDx_CONNECTION_TIMER(x)                ((x) << 0)
917a59781bbSAlex Deucher #       define DC_HPDx_RX_INT_TIMER(x)                    ((x) << 16)
918a59781bbSAlex Deucher #       define DC_HPDx_EN                                 (1 << 28)
919a59781bbSAlex Deucher 
920cc8dbbb4SAlex Deucher #define DPG_PIPE_STUTTER_CONTROL                          0x6cd4
921cc8dbbb4SAlex Deucher #       define STUTTER_ENABLE                             (1 << 0)
922cc8dbbb4SAlex Deucher 
923134b480fSAlex Deucher /* DCE8 FMT blocks */
924134b480fSAlex Deucher #define FMT_DYNAMIC_EXP_CNTL                 0x6fb4
925134b480fSAlex Deucher #       define FMT_DYNAMIC_EXP_EN            (1 << 0)
926134b480fSAlex Deucher #       define FMT_DYNAMIC_EXP_MODE          (1 << 4)
927134b480fSAlex Deucher         /* 0 = 10bit -> 12bit, 1 = 8bit -> 12bit */
928134b480fSAlex Deucher #define FMT_CONTROL                          0x6fb8
929134b480fSAlex Deucher #       define FMT_PIXEL_ENCODING            (1 << 16)
930134b480fSAlex Deucher         /* 0 = RGB 4:4:4 or YCbCr 4:4:4, 1 = YCbCr 4:2:2 */
931134b480fSAlex Deucher #define FMT_BIT_DEPTH_CONTROL                0x6fc8
932134b480fSAlex Deucher #       define FMT_TRUNCATE_EN               (1 << 0)
933134b480fSAlex Deucher #       define FMT_TRUNCATE_MODE             (1 << 1)
934134b480fSAlex Deucher #       define FMT_TRUNCATE_DEPTH(x)         ((x) << 4) /* 0 - 18bpp, 1 - 24bpp, 2 - 30bpp */
935134b480fSAlex Deucher #       define FMT_SPATIAL_DITHER_EN         (1 << 8)
936134b480fSAlex Deucher #       define FMT_SPATIAL_DITHER_MODE(x)    ((x) << 9)
937134b480fSAlex Deucher #       define FMT_SPATIAL_DITHER_DEPTH(x)   ((x) << 11) /* 0 - 18bpp, 1 - 24bpp, 2 - 30bpp */
938134b480fSAlex Deucher #       define FMT_FRAME_RANDOM_ENABLE       (1 << 13)
939134b480fSAlex Deucher #       define FMT_RGB_RANDOM_ENABLE         (1 << 14)
940134b480fSAlex Deucher #       define FMT_HIGHPASS_RANDOM_ENABLE    (1 << 15)
941134b480fSAlex Deucher #       define FMT_TEMPORAL_DITHER_EN        (1 << 16)
942134b480fSAlex Deucher #       define FMT_TEMPORAL_DITHER_DEPTH(x)  ((x) << 17) /* 0 - 18bpp, 1 - 24bpp, 2 - 30bpp */
943134b480fSAlex Deucher #       define FMT_TEMPORAL_DITHER_OFFSET(x) ((x) << 21)
944134b480fSAlex Deucher #       define FMT_TEMPORAL_LEVEL            (1 << 24)
945134b480fSAlex Deucher #       define FMT_TEMPORAL_DITHER_RESET     (1 << 25)
946134b480fSAlex Deucher #       define FMT_25FRC_SEL(x)              ((x) << 26)
947134b480fSAlex Deucher #       define FMT_50FRC_SEL(x)              ((x) << 28)
948134b480fSAlex Deucher #       define FMT_75FRC_SEL(x)              ((x) << 30)
949134b480fSAlex Deucher #define FMT_CLAMP_CONTROL                    0x6fe4
950134b480fSAlex Deucher #       define FMT_CLAMP_DATA_EN             (1 << 0)
951134b480fSAlex Deucher #       define FMT_CLAMP_COLOR_FORMAT(x)     ((x) << 16)
952134b480fSAlex Deucher #       define FMT_CLAMP_6BPC                0
953134b480fSAlex Deucher #       define FMT_CLAMP_8BPC                1
954134b480fSAlex Deucher #       define FMT_CLAMP_10BPC               2
955134b480fSAlex Deucher 
9568cc1a532SAlex Deucher #define	GRBM_CNTL					0x8000
9578cc1a532SAlex Deucher #define		GRBM_READ_TIMEOUT(x)				((x) << 0)
9588cc1a532SAlex Deucher 
9596f2043ceSAlex Deucher #define	GRBM_STATUS2					0x8008
9606f2043ceSAlex Deucher #define		ME0PIPE1_CMDFIFO_AVAIL_MASK			0x0000000F
9616f2043ceSAlex Deucher #define		ME0PIPE1_CF_RQ_PENDING				(1 << 4)
9626f2043ceSAlex Deucher #define		ME0PIPE1_PF_RQ_PENDING				(1 << 5)
9636f2043ceSAlex Deucher #define		ME1PIPE0_RQ_PENDING				(1 << 6)
9646f2043ceSAlex Deucher #define		ME1PIPE1_RQ_PENDING				(1 << 7)
9656f2043ceSAlex Deucher #define		ME1PIPE2_RQ_PENDING				(1 << 8)
9666f2043ceSAlex Deucher #define		ME1PIPE3_RQ_PENDING				(1 << 9)
9676f2043ceSAlex Deucher #define		ME2PIPE0_RQ_PENDING				(1 << 10)
9686f2043ceSAlex Deucher #define		ME2PIPE1_RQ_PENDING				(1 << 11)
9696f2043ceSAlex Deucher #define		ME2PIPE2_RQ_PENDING				(1 << 12)
9706f2043ceSAlex Deucher #define		ME2PIPE3_RQ_PENDING				(1 << 13)
9716f2043ceSAlex Deucher #define		RLC_RQ_PENDING 					(1 << 14)
9726f2043ceSAlex Deucher #define		RLC_BUSY 					(1 << 24)
9736f2043ceSAlex Deucher #define		TC_BUSY 					(1 << 25)
9746f2043ceSAlex Deucher #define		CPF_BUSY 					(1 << 28)
9756f2043ceSAlex Deucher #define		CPC_BUSY 					(1 << 29)
9766f2043ceSAlex Deucher #define		CPG_BUSY 					(1 << 30)
9776f2043ceSAlex Deucher 
9786f2043ceSAlex Deucher #define	GRBM_STATUS					0x8010
9796f2043ceSAlex Deucher #define		ME0PIPE0_CMDFIFO_AVAIL_MASK			0x0000000F
9806f2043ceSAlex Deucher #define		SRBM_RQ_PENDING					(1 << 5)
9816f2043ceSAlex Deucher #define		ME0PIPE0_CF_RQ_PENDING				(1 << 7)
9826f2043ceSAlex Deucher #define		ME0PIPE0_PF_RQ_PENDING				(1 << 8)
9836f2043ceSAlex Deucher #define		GDS_DMA_RQ_PENDING				(1 << 9)
9846f2043ceSAlex Deucher #define		DB_CLEAN					(1 << 12)
9856f2043ceSAlex Deucher #define		CB_CLEAN					(1 << 13)
9866f2043ceSAlex Deucher #define		TA_BUSY 					(1 << 14)
9876f2043ceSAlex Deucher #define		GDS_BUSY 					(1 << 15)
9886f2043ceSAlex Deucher #define		WD_BUSY_NO_DMA 					(1 << 16)
9896f2043ceSAlex Deucher #define		VGT_BUSY					(1 << 17)
9906f2043ceSAlex Deucher #define		IA_BUSY_NO_DMA					(1 << 18)
9916f2043ceSAlex Deucher #define		IA_BUSY						(1 << 19)
9926f2043ceSAlex Deucher #define		SX_BUSY 					(1 << 20)
9936f2043ceSAlex Deucher #define		WD_BUSY 					(1 << 21)
9946f2043ceSAlex Deucher #define		SPI_BUSY					(1 << 22)
9956f2043ceSAlex Deucher #define		BCI_BUSY					(1 << 23)
9966f2043ceSAlex Deucher #define		SC_BUSY 					(1 << 24)
9976f2043ceSAlex Deucher #define		PA_BUSY 					(1 << 25)
9986f2043ceSAlex Deucher #define		DB_BUSY 					(1 << 26)
9996f2043ceSAlex Deucher #define		CP_COHERENCY_BUSY      				(1 << 28)
10006f2043ceSAlex Deucher #define		CP_BUSY 					(1 << 29)
10016f2043ceSAlex Deucher #define		CB_BUSY 					(1 << 30)
10026f2043ceSAlex Deucher #define		GUI_ACTIVE					(1 << 31)
10036f2043ceSAlex Deucher #define	GRBM_STATUS_SE0					0x8014
10046f2043ceSAlex Deucher #define	GRBM_STATUS_SE1					0x8018
10056f2043ceSAlex Deucher #define	GRBM_STATUS_SE2					0x8038
10066f2043ceSAlex Deucher #define	GRBM_STATUS_SE3					0x803C
10076f2043ceSAlex Deucher #define		SE_DB_CLEAN					(1 << 1)
10086f2043ceSAlex Deucher #define		SE_CB_CLEAN					(1 << 2)
10096f2043ceSAlex Deucher #define		SE_BCI_BUSY					(1 << 22)
10106f2043ceSAlex Deucher #define		SE_VGT_BUSY					(1 << 23)
10116f2043ceSAlex Deucher #define		SE_PA_BUSY					(1 << 24)
10126f2043ceSAlex Deucher #define		SE_TA_BUSY					(1 << 25)
10136f2043ceSAlex Deucher #define		SE_SX_BUSY					(1 << 26)
10146f2043ceSAlex Deucher #define		SE_SPI_BUSY					(1 << 27)
10156f2043ceSAlex Deucher #define		SE_SC_BUSY					(1 << 29)
10166f2043ceSAlex Deucher #define		SE_DB_BUSY					(1 << 30)
10176f2043ceSAlex Deucher #define		SE_CB_BUSY					(1 << 31)
10186f2043ceSAlex Deucher 
10196f2043ceSAlex Deucher #define	GRBM_SOFT_RESET					0x8020
10206f2043ceSAlex Deucher #define		SOFT_RESET_CP					(1 << 0)  /* All CP blocks */
10216f2043ceSAlex Deucher #define		SOFT_RESET_RLC					(1 << 2)  /* RLC */
10226f2043ceSAlex Deucher #define		SOFT_RESET_GFX					(1 << 16) /* GFX */
10236f2043ceSAlex Deucher #define		SOFT_RESET_CPF					(1 << 17) /* CP fetcher shared by gfx and compute */
10246f2043ceSAlex Deucher #define		SOFT_RESET_CPC					(1 << 18) /* CP Compute (MEC1/2) */
10256f2043ceSAlex Deucher #define		SOFT_RESET_CPG					(1 << 19) /* CP GFX (PFP, ME, CE) */
10266f2043ceSAlex Deucher 
1027a59781bbSAlex Deucher #define GRBM_INT_CNTL                                   0x8060
1028a59781bbSAlex Deucher #       define RDERR_INT_ENABLE                         (1 << 0)
1029a59781bbSAlex Deucher #       define GUI_IDLE_INT_ENABLE                      (1 << 19)
1030a59781bbSAlex Deucher 
1031963e81f9SAlex Deucher #define CP_CPC_STATUS					0x8210
1032963e81f9SAlex Deucher #define CP_CPC_BUSY_STAT				0x8214
1033963e81f9SAlex Deucher #define CP_CPC_STALLED_STAT1				0x8218
1034963e81f9SAlex Deucher #define CP_CPF_STATUS					0x821c
1035963e81f9SAlex Deucher #define CP_CPF_BUSY_STAT				0x8220
1036963e81f9SAlex Deucher #define CP_CPF_STALLED_STAT1				0x8224
1037963e81f9SAlex Deucher 
10386f2043ceSAlex Deucher #define CP_MEC_CNTL					0x8234
10396f2043ceSAlex Deucher #define		MEC_ME2_HALT					(1 << 28)
10406f2043ceSAlex Deucher #define		MEC_ME1_HALT					(1 << 30)
10416f2043ceSAlex Deucher 
1042841cf442SAlex Deucher #define CP_MEC_CNTL					0x8234
1043841cf442SAlex Deucher #define		MEC_ME2_HALT					(1 << 28)
1044841cf442SAlex Deucher #define		MEC_ME1_HALT					(1 << 30)
1045841cf442SAlex Deucher 
1046963e81f9SAlex Deucher #define CP_STALLED_STAT3				0x8670
1047963e81f9SAlex Deucher #define CP_STALLED_STAT1				0x8674
1048963e81f9SAlex Deucher #define CP_STALLED_STAT2				0x8678
1049963e81f9SAlex Deucher 
1050963e81f9SAlex Deucher #define CP_STAT						0x8680
1051963e81f9SAlex Deucher 
10526f2043ceSAlex Deucher #define CP_ME_CNTL					0x86D8
10536f2043ceSAlex Deucher #define		CP_CE_HALT					(1 << 24)
10546f2043ceSAlex Deucher #define		CP_PFP_HALT					(1 << 26)
10556f2043ceSAlex Deucher #define		CP_ME_HALT					(1 << 28)
10566f2043ceSAlex Deucher 
1057841cf442SAlex Deucher #define	CP_RB0_RPTR					0x8700
1058841cf442SAlex Deucher #define	CP_RB_WPTR_DELAY				0x8704
105922c775ceSAlex Deucher #define	CP_RB_WPTR_POLL_CNTL				0x8708
106022c775ceSAlex Deucher #define		IDLE_POLL_COUNT(x)			((x) << 16)
106122c775ceSAlex Deucher #define		IDLE_POLL_COUNT_MASK			(0xffff << 16)
1062841cf442SAlex Deucher 
10638cc1a532SAlex Deucher #define CP_MEQ_THRESHOLDS				0x8764
10648cc1a532SAlex Deucher #define		MEQ1_START(x)				((x) << 0)
10658cc1a532SAlex Deucher #define		MEQ2_START(x)				((x) << 8)
10668cc1a532SAlex Deucher 
10678cc1a532SAlex Deucher #define	VGT_VTX_VECT_EJECT_REG				0x88B0
10688cc1a532SAlex Deucher 
10698cc1a532SAlex Deucher #define	VGT_CACHE_INVALIDATION				0x88C4
10708cc1a532SAlex Deucher #define		CACHE_INVALIDATION(x)				((x) << 0)
10718cc1a532SAlex Deucher #define			VC_ONLY						0
10728cc1a532SAlex Deucher #define			TC_ONLY						1
10738cc1a532SAlex Deucher #define			VC_AND_TC					2
10748cc1a532SAlex Deucher #define		AUTO_INVLD_EN(x)				((x) << 6)
10758cc1a532SAlex Deucher #define			NO_AUTO						0
10768cc1a532SAlex Deucher #define			ES_AUTO						1
10778cc1a532SAlex Deucher #define			GS_AUTO						2
10788cc1a532SAlex Deucher #define			ES_AND_GS_AUTO					3
10798cc1a532SAlex Deucher 
10808cc1a532SAlex Deucher #define	VGT_GS_VERTEX_REUSE				0x88D4
10818cc1a532SAlex Deucher 
10828cc1a532SAlex Deucher #define CC_GC_SHADER_ARRAY_CONFIG			0x89bc
10838cc1a532SAlex Deucher #define		INACTIVE_CUS_MASK			0xFFFF0000
10848cc1a532SAlex Deucher #define		INACTIVE_CUS_SHIFT			16
10858cc1a532SAlex Deucher #define GC_USER_SHADER_ARRAY_CONFIG			0x89c0
10868cc1a532SAlex Deucher 
10878cc1a532SAlex Deucher #define	PA_CL_ENHANCE					0x8A14
10888cc1a532SAlex Deucher #define		CLIP_VTX_REORDER_ENA				(1 << 0)
10898cc1a532SAlex Deucher #define		NUM_CLIP_SEQ(x)					((x) << 1)
10908cc1a532SAlex Deucher 
10918cc1a532SAlex Deucher #define	PA_SC_FORCE_EOV_MAX_CNTS			0x8B24
10928cc1a532SAlex Deucher #define		FORCE_EOV_MAX_CLK_CNT(x)			((x) << 0)
10938cc1a532SAlex Deucher #define		FORCE_EOV_MAX_REZ_CNT(x)			((x) << 16)
10948cc1a532SAlex Deucher 
10958cc1a532SAlex Deucher #define	PA_SC_FIFO_SIZE					0x8BCC
10968cc1a532SAlex Deucher #define		SC_FRONTEND_PRIM_FIFO_SIZE(x)			((x) << 0)
10978cc1a532SAlex Deucher #define		SC_BACKEND_PRIM_FIFO_SIZE(x)			((x) << 6)
10988cc1a532SAlex Deucher #define		SC_HIZ_TILE_FIFO_SIZE(x)			((x) << 15)
10998cc1a532SAlex Deucher #define		SC_EARLYZ_TILE_FIFO_SIZE(x)			((x) << 23)
11008cc1a532SAlex Deucher 
11018cc1a532SAlex Deucher #define	PA_SC_ENHANCE					0x8BF0
11028cc1a532SAlex Deucher #define		ENABLE_PA_SC_OUT_OF_ORDER			(1 << 0)
11038cc1a532SAlex Deucher #define		DISABLE_PA_SC_GUIDANCE				(1 << 13)
11048cc1a532SAlex Deucher 
11058cc1a532SAlex Deucher #define	SQ_CONFIG					0x8C00
11068cc1a532SAlex Deucher 
11071c49165dSAlex Deucher #define	SH_MEM_BASES					0x8C28
11081c49165dSAlex Deucher /* if PTR32, these are the bases for scratch and lds */
11091c49165dSAlex Deucher #define		PRIVATE_BASE(x)					((x) << 0) /* scratch */
11101c49165dSAlex Deucher #define		SHARED_BASE(x)					((x) << 16) /* LDS */
11111c49165dSAlex Deucher #define	SH_MEM_APE1_BASE				0x8C2C
11121c49165dSAlex Deucher /* if PTR32, this is the base location of GPUVM */
11131c49165dSAlex Deucher #define	SH_MEM_APE1_LIMIT				0x8C30
11141c49165dSAlex Deucher /* if PTR32, this is the upper limit of GPUVM */
11151c49165dSAlex Deucher #define	SH_MEM_CONFIG					0x8C34
11161c49165dSAlex Deucher #define		PTR32						(1 << 0)
11171c49165dSAlex Deucher #define		ALIGNMENT_MODE(x)				((x) << 2)
11181c49165dSAlex Deucher #define			SH_MEM_ALIGNMENT_MODE_DWORD			0
11191c49165dSAlex Deucher #define			SH_MEM_ALIGNMENT_MODE_DWORD_STRICT		1
11201c49165dSAlex Deucher #define			SH_MEM_ALIGNMENT_MODE_STRICT			2
11211c49165dSAlex Deucher #define			SH_MEM_ALIGNMENT_MODE_UNALIGNED			3
11221c49165dSAlex Deucher #define		DEFAULT_MTYPE(x)				((x) << 4)
11231c49165dSAlex Deucher #define		APE1_MTYPE(x)					((x) << 7)
11241c49165dSAlex Deucher 
11258cc1a532SAlex Deucher #define	SX_DEBUG_1					0x9060
11268cc1a532SAlex Deucher 
11278cc1a532SAlex Deucher #define	SPI_CONFIG_CNTL					0x9100
11288cc1a532SAlex Deucher 
11298cc1a532SAlex Deucher #define	SPI_CONFIG_CNTL_1				0x913C
11308cc1a532SAlex Deucher #define		VTX_DONE_DELAY(x)				((x) << 0)
11318cc1a532SAlex Deucher #define		INTERP_ONE_PRIM_PER_ROW				(1 << 4)
11328cc1a532SAlex Deucher 
11338cc1a532SAlex Deucher #define	TA_CNTL_AUX					0x9508
11348cc1a532SAlex Deucher 
11358cc1a532SAlex Deucher #define DB_DEBUG					0x9830
11368cc1a532SAlex Deucher #define DB_DEBUG2					0x9834
11378cc1a532SAlex Deucher #define DB_DEBUG3					0x9838
11388cc1a532SAlex Deucher 
11398cc1a532SAlex Deucher #define CC_RB_BACKEND_DISABLE				0x98F4
11408cc1a532SAlex Deucher #define		BACKEND_DISABLE(x)     			((x) << 16)
11418cc1a532SAlex Deucher #define GB_ADDR_CONFIG  				0x98F8
11428cc1a532SAlex Deucher #define		NUM_PIPES(x)				((x) << 0)
11438cc1a532SAlex Deucher #define		NUM_PIPES_MASK				0x00000007
11448cc1a532SAlex Deucher #define		NUM_PIPES_SHIFT				0
11458cc1a532SAlex Deucher #define		PIPE_INTERLEAVE_SIZE(x)			((x) << 4)
11468cc1a532SAlex Deucher #define		PIPE_INTERLEAVE_SIZE_MASK		0x00000070
11478cc1a532SAlex Deucher #define		PIPE_INTERLEAVE_SIZE_SHIFT		4
11488cc1a532SAlex Deucher #define		NUM_SHADER_ENGINES(x)			((x) << 12)
11498cc1a532SAlex Deucher #define		NUM_SHADER_ENGINES_MASK			0x00003000
11508cc1a532SAlex Deucher #define		NUM_SHADER_ENGINES_SHIFT		12
11518cc1a532SAlex Deucher #define		SHADER_ENGINE_TILE_SIZE(x)     		((x) << 16)
11528cc1a532SAlex Deucher #define		SHADER_ENGINE_TILE_SIZE_MASK		0x00070000
11538cc1a532SAlex Deucher #define		SHADER_ENGINE_TILE_SIZE_SHIFT		16
11548cc1a532SAlex Deucher #define		ROW_SIZE(x)             		((x) << 28)
11558cc1a532SAlex Deucher #define		ROW_SIZE_MASK				0x30000000
11568cc1a532SAlex Deucher #define		ROW_SIZE_SHIFT				28
11578cc1a532SAlex Deucher 
11588cc1a532SAlex Deucher #define	GB_TILE_MODE0					0x9910
11598cc1a532SAlex Deucher #       define ARRAY_MODE(x)					((x) << 2)
11608cc1a532SAlex Deucher #              define	ARRAY_LINEAR_GENERAL			0
11618cc1a532SAlex Deucher #              define	ARRAY_LINEAR_ALIGNED			1
11628cc1a532SAlex Deucher #              define	ARRAY_1D_TILED_THIN1			2
11638cc1a532SAlex Deucher #              define	ARRAY_2D_TILED_THIN1			4
11648cc1a532SAlex Deucher #              define	ARRAY_PRT_TILED_THIN1			5
11658cc1a532SAlex Deucher #              define	ARRAY_PRT_2D_TILED_THIN1		6
11668cc1a532SAlex Deucher #       define PIPE_CONFIG(x)					((x) << 6)
11678cc1a532SAlex Deucher #              define	ADDR_SURF_P2				0
11688cc1a532SAlex Deucher #              define	ADDR_SURF_P4_8x16			4
11698cc1a532SAlex Deucher #              define	ADDR_SURF_P4_16x16			5
11708cc1a532SAlex Deucher #              define	ADDR_SURF_P4_16x32			6
11718cc1a532SAlex Deucher #              define	ADDR_SURF_P4_32x32			7
11728cc1a532SAlex Deucher #              define	ADDR_SURF_P8_16x16_8x16			8
11738cc1a532SAlex Deucher #              define	ADDR_SURF_P8_16x32_8x16			9
11748cc1a532SAlex Deucher #              define	ADDR_SURF_P8_32x32_8x16			10
11758cc1a532SAlex Deucher #              define	ADDR_SURF_P8_16x32_16x16		11
11768cc1a532SAlex Deucher #              define	ADDR_SURF_P8_32x32_16x16		12
11778cc1a532SAlex Deucher #              define	ADDR_SURF_P8_32x32_16x32		13
11788cc1a532SAlex Deucher #              define	ADDR_SURF_P8_32x64_32x32		14
117921e438afSAlex Deucher #              define	ADDR_SURF_P16_32x32_8x16		16
118021e438afSAlex Deucher #              define	ADDR_SURF_P16_32x32_16x16		17
11818cc1a532SAlex Deucher #       define TILE_SPLIT(x)					((x) << 11)
11828cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_64B		0
11838cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_128B		1
11848cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_256B		2
11858cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_512B		3
11868cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_1KB		4
11878cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_2KB		5
11888cc1a532SAlex Deucher #              define	ADDR_SURF_TILE_SPLIT_4KB		6
11898cc1a532SAlex Deucher #       define MICRO_TILE_MODE_NEW(x)				((x) << 22)
11908cc1a532SAlex Deucher #              define	ADDR_SURF_DISPLAY_MICRO_TILING		0
11918cc1a532SAlex Deucher #              define	ADDR_SURF_THIN_MICRO_TILING		1
11928cc1a532SAlex Deucher #              define	ADDR_SURF_DEPTH_MICRO_TILING		2
11938cc1a532SAlex Deucher #              define	ADDR_SURF_ROTATED_MICRO_TILING		3
11948cc1a532SAlex Deucher #       define SAMPLE_SPLIT(x)					((x) << 25)
11958cc1a532SAlex Deucher #              define	ADDR_SURF_SAMPLE_SPLIT_1		0
11968cc1a532SAlex Deucher #              define	ADDR_SURF_SAMPLE_SPLIT_2		1
11978cc1a532SAlex Deucher #              define	ADDR_SURF_SAMPLE_SPLIT_4		2
11988cc1a532SAlex Deucher #              define	ADDR_SURF_SAMPLE_SPLIT_8		3
11998cc1a532SAlex Deucher 
12008cc1a532SAlex Deucher #define	GB_MACROTILE_MODE0					0x9990
12018cc1a532SAlex Deucher #       define BANK_WIDTH(x)					((x) << 0)
12028cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_WIDTH_1			0
12038cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_WIDTH_2			1
12048cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_WIDTH_4			2
12058cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_WIDTH_8			3
12068cc1a532SAlex Deucher #       define BANK_HEIGHT(x)					((x) << 2)
12078cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_HEIGHT_1			0
12088cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_HEIGHT_2			1
12098cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_HEIGHT_4			2
12108cc1a532SAlex Deucher #              define	ADDR_SURF_BANK_HEIGHT_8			3
12118cc1a532SAlex Deucher #       define MACRO_TILE_ASPECT(x)				((x) << 4)
12128cc1a532SAlex Deucher #              define	ADDR_SURF_MACRO_ASPECT_1		0
12138cc1a532SAlex Deucher #              define	ADDR_SURF_MACRO_ASPECT_2		1
12148cc1a532SAlex Deucher #              define	ADDR_SURF_MACRO_ASPECT_4		2
12158cc1a532SAlex Deucher #              define	ADDR_SURF_MACRO_ASPECT_8		3
12168cc1a532SAlex Deucher #       define NUM_BANKS(x)					((x) << 6)
12178cc1a532SAlex Deucher #              define	ADDR_SURF_2_BANK			0
12188cc1a532SAlex Deucher #              define	ADDR_SURF_4_BANK			1
12198cc1a532SAlex Deucher #              define	ADDR_SURF_8_BANK			2
12208cc1a532SAlex Deucher #              define	ADDR_SURF_16_BANK			3
12218cc1a532SAlex Deucher 
12228cc1a532SAlex Deucher #define	CB_HW_CONTROL					0x9A10
12238cc1a532SAlex Deucher 
12248cc1a532SAlex Deucher #define	GC_USER_RB_BACKEND_DISABLE			0x9B7C
12258cc1a532SAlex Deucher #define		BACKEND_DISABLE_MASK			0x00FF0000
12268cc1a532SAlex Deucher #define		BACKEND_DISABLE_SHIFT			16
12278cc1a532SAlex Deucher 
12288cc1a532SAlex Deucher #define	TCP_CHAN_STEER_LO				0xac0c
12298cc1a532SAlex Deucher #define	TCP_CHAN_STEER_HI				0xac10
12308cc1a532SAlex Deucher 
12311c49165dSAlex Deucher #define	TC_CFG_L1_LOAD_POLICY0				0xAC68
12321c49165dSAlex Deucher #define	TC_CFG_L1_LOAD_POLICY1				0xAC6C
12331c49165dSAlex Deucher #define	TC_CFG_L1_STORE_POLICY				0xAC70
12341c49165dSAlex Deucher #define	TC_CFG_L2_LOAD_POLICY0				0xAC74
12351c49165dSAlex Deucher #define	TC_CFG_L2_LOAD_POLICY1				0xAC78
12361c49165dSAlex Deucher #define	TC_CFG_L2_STORE_POLICY0				0xAC7C
12371c49165dSAlex Deucher #define	TC_CFG_L2_STORE_POLICY1				0xAC80
12381c49165dSAlex Deucher #define	TC_CFG_L2_ATOMIC_POLICY				0xAC84
12391c49165dSAlex Deucher #define	TC_CFG_L1_VOLATILE				0xAC88
12401c49165dSAlex Deucher #define	TC_CFG_L2_VOLATILE				0xAC8C
12411c49165dSAlex Deucher 
1242841cf442SAlex Deucher #define	CP_RB0_BASE					0xC100
1243841cf442SAlex Deucher #define	CP_RB0_CNTL					0xC104
1244841cf442SAlex Deucher #define		RB_BUFSZ(x)					((x) << 0)
1245841cf442SAlex Deucher #define		RB_BLKSZ(x)					((x) << 8)
1246841cf442SAlex Deucher #define		BUF_SWAP_32BIT					(2 << 16)
1247841cf442SAlex Deucher #define		RB_NO_UPDATE					(1 << 27)
1248841cf442SAlex Deucher #define		RB_RPTR_WR_ENA					(1 << 31)
1249841cf442SAlex Deucher 
1250841cf442SAlex Deucher #define	CP_RB0_RPTR_ADDR				0xC10C
1251841cf442SAlex Deucher #define		RB_RPTR_SWAP_32BIT				(2 << 0)
1252841cf442SAlex Deucher #define	CP_RB0_RPTR_ADDR_HI				0xC110
1253841cf442SAlex Deucher #define	CP_RB0_WPTR					0xC114
1254841cf442SAlex Deucher 
1255841cf442SAlex Deucher #define	CP_DEVICE_ID					0xC12C
1256841cf442SAlex Deucher #define	CP_ENDIAN_SWAP					0xC140
1257841cf442SAlex Deucher #define	CP_RB_VMID					0xC144
1258841cf442SAlex Deucher 
1259841cf442SAlex Deucher #define	CP_PFP_UCODE_ADDR				0xC150
1260841cf442SAlex Deucher #define	CP_PFP_UCODE_DATA				0xC154
1261841cf442SAlex Deucher #define	CP_ME_RAM_RADDR					0xC158
1262841cf442SAlex Deucher #define	CP_ME_RAM_WADDR					0xC15C
1263841cf442SAlex Deucher #define	CP_ME_RAM_DATA					0xC160
1264841cf442SAlex Deucher 
1265841cf442SAlex Deucher #define	CP_CE_UCODE_ADDR				0xC168
1266841cf442SAlex Deucher #define	CP_CE_UCODE_DATA				0xC16C
1267841cf442SAlex Deucher #define	CP_MEC_ME1_UCODE_ADDR				0xC170
1268841cf442SAlex Deucher #define	CP_MEC_ME1_UCODE_DATA				0xC174
1269841cf442SAlex Deucher #define	CP_MEC_ME2_UCODE_ADDR				0xC178
1270841cf442SAlex Deucher #define	CP_MEC_ME2_UCODE_DATA				0xC17C
1271841cf442SAlex Deucher 
1272f6796caeSAlex Deucher #define CP_INT_CNTL_RING0                               0xC1A8
1273f6796caeSAlex Deucher #       define CNTX_BUSY_INT_ENABLE                     (1 << 19)
1274f6796caeSAlex Deucher #       define CNTX_EMPTY_INT_ENABLE                    (1 << 20)
1275f6796caeSAlex Deucher #       define PRIV_INSTR_INT_ENABLE                    (1 << 22)
1276f6796caeSAlex Deucher #       define PRIV_REG_INT_ENABLE                      (1 << 23)
1277f6796caeSAlex Deucher #       define TIME_STAMP_INT_ENABLE                    (1 << 26)
1278f6796caeSAlex Deucher #       define CP_RINGID2_INT_ENABLE                    (1 << 29)
1279f6796caeSAlex Deucher #       define CP_RINGID1_INT_ENABLE                    (1 << 30)
1280f6796caeSAlex Deucher #       define CP_RINGID0_INT_ENABLE                    (1 << 31)
1281f6796caeSAlex Deucher 
1282a59781bbSAlex Deucher #define CP_INT_STATUS_RING0                             0xC1B4
1283a59781bbSAlex Deucher #       define PRIV_INSTR_INT_STAT                      (1 << 22)
1284a59781bbSAlex Deucher #       define PRIV_REG_INT_STAT                        (1 << 23)
1285a59781bbSAlex Deucher #       define TIME_STAMP_INT_STAT                      (1 << 26)
1286a59781bbSAlex Deucher #       define CP_RINGID2_INT_STAT                      (1 << 29)
1287a59781bbSAlex Deucher #       define CP_RINGID1_INT_STAT                      (1 << 30)
1288a59781bbSAlex Deucher #       define CP_RINGID0_INT_STAT                      (1 << 31)
1289a59781bbSAlex Deucher 
129022c775ceSAlex Deucher #define CP_MEM_SLP_CNTL                                 0xC1E4
129122c775ceSAlex Deucher #       define CP_MEM_LS_EN                             (1 << 0)
129222c775ceSAlex Deucher 
1293963e81f9SAlex Deucher #define CP_CPF_DEBUG                                    0xC200
1294963e81f9SAlex Deucher 
1295963e81f9SAlex Deucher #define CP_PQ_WPTR_POLL_CNTL                            0xC20C
1296963e81f9SAlex Deucher #define		WPTR_POLL_EN      			(1 << 31)
1297963e81f9SAlex Deucher 
1298a59781bbSAlex Deucher #define CP_ME1_PIPE0_INT_CNTL                           0xC214
1299a59781bbSAlex Deucher #define CP_ME1_PIPE1_INT_CNTL                           0xC218
1300a59781bbSAlex Deucher #define CP_ME1_PIPE2_INT_CNTL                           0xC21C
1301a59781bbSAlex Deucher #define CP_ME1_PIPE3_INT_CNTL                           0xC220
1302a59781bbSAlex Deucher #define CP_ME2_PIPE0_INT_CNTL                           0xC224
1303a59781bbSAlex Deucher #define CP_ME2_PIPE1_INT_CNTL                           0xC228
1304a59781bbSAlex Deucher #define CP_ME2_PIPE2_INT_CNTL                           0xC22C
1305a59781bbSAlex Deucher #define CP_ME2_PIPE3_INT_CNTL                           0xC230
1306a59781bbSAlex Deucher #       define DEQUEUE_REQUEST_INT_ENABLE               (1 << 13)
1307a59781bbSAlex Deucher #       define WRM_POLL_TIMEOUT_INT_ENABLE              (1 << 17)
1308a59781bbSAlex Deucher #       define PRIV_REG_INT_ENABLE                      (1 << 23)
1309a59781bbSAlex Deucher #       define TIME_STAMP_INT_ENABLE                    (1 << 26)
1310a59781bbSAlex Deucher #       define GENERIC2_INT_ENABLE                      (1 << 29)
1311a59781bbSAlex Deucher #       define GENERIC1_INT_ENABLE                      (1 << 30)
1312a59781bbSAlex Deucher #       define GENERIC0_INT_ENABLE                      (1 << 31)
1313a59781bbSAlex Deucher #define CP_ME1_PIPE0_INT_STATUS                         0xC214
1314a59781bbSAlex Deucher #define CP_ME1_PIPE1_INT_STATUS                         0xC218
1315a59781bbSAlex Deucher #define CP_ME1_PIPE2_INT_STATUS                         0xC21C
1316a59781bbSAlex Deucher #define CP_ME1_PIPE3_INT_STATUS                         0xC220
1317a59781bbSAlex Deucher #define CP_ME2_PIPE0_INT_STATUS                         0xC224
1318a59781bbSAlex Deucher #define CP_ME2_PIPE1_INT_STATUS                         0xC228
1319a59781bbSAlex Deucher #define CP_ME2_PIPE2_INT_STATUS                         0xC22C
1320a59781bbSAlex Deucher #define CP_ME2_PIPE3_INT_STATUS                         0xC230
1321a59781bbSAlex Deucher #       define DEQUEUE_REQUEST_INT_STATUS               (1 << 13)
1322a59781bbSAlex Deucher #       define WRM_POLL_TIMEOUT_INT_STATUS              (1 << 17)
1323a59781bbSAlex Deucher #       define PRIV_REG_INT_STATUS                      (1 << 23)
1324a59781bbSAlex Deucher #       define TIME_STAMP_INT_STATUS                    (1 << 26)
1325a59781bbSAlex Deucher #       define GENERIC2_INT_STATUS                      (1 << 29)
1326a59781bbSAlex Deucher #       define GENERIC1_INT_STATUS                      (1 << 30)
1327a59781bbSAlex Deucher #       define GENERIC0_INT_STATUS                      (1 << 31)
1328a59781bbSAlex Deucher 
1329841cf442SAlex Deucher #define	CP_MAX_CONTEXT					0xC2B8
1330841cf442SAlex Deucher 
1331841cf442SAlex Deucher #define	CP_RB0_BASE_HI					0xC2C4
1332841cf442SAlex Deucher 
1333f6796caeSAlex Deucher #define RLC_CNTL                                          0xC300
1334f6796caeSAlex Deucher #       define RLC_ENABLE                                 (1 << 0)
1335f6796caeSAlex Deucher 
1336f6796caeSAlex Deucher #define RLC_MC_CNTL                                       0xC30C
1337f6796caeSAlex Deucher 
133822c775ceSAlex Deucher #define RLC_MEM_SLP_CNTL                                  0xC318
133922c775ceSAlex Deucher #       define RLC_MEM_LS_EN                              (1 << 0)
134022c775ceSAlex Deucher 
1341f6796caeSAlex Deucher #define RLC_LB_CNTR_MAX                                   0xC348
1342f6796caeSAlex Deucher 
1343f6796caeSAlex Deucher #define RLC_LB_CNTL                                       0xC364
1344866d83deSAlex Deucher #       define LOAD_BALANCE_ENABLE                        (1 << 0)
1345f6796caeSAlex Deucher 
1346f6796caeSAlex Deucher #define RLC_LB_CNTR_INIT                                  0xC36C
1347f6796caeSAlex Deucher 
1348f6796caeSAlex Deucher #define RLC_SAVE_AND_RESTORE_BASE                         0xC374
134922c775ceSAlex Deucher #define RLC_DRIVER_DMA_STATUS                             0xC378 /* dGPU */
135022c775ceSAlex Deucher #define RLC_CP_TABLE_RESTORE                              0xC378 /* APU */
135122c775ceSAlex Deucher #define RLC_PG_DELAY_2                                    0xC37C
1352f6796caeSAlex Deucher 
1353f6796caeSAlex Deucher #define RLC_GPM_UCODE_ADDR                                0xC388
1354f6796caeSAlex Deucher #define RLC_GPM_UCODE_DATA                                0xC38C
135544fa346fSAlex Deucher #define RLC_GPU_CLOCK_COUNT_LSB                           0xC390
135644fa346fSAlex Deucher #define RLC_GPU_CLOCK_COUNT_MSB                           0xC394
135744fa346fSAlex Deucher #define RLC_CAPTURE_GPU_CLOCK_COUNT                       0xC398
1358f6796caeSAlex Deucher #define RLC_UCODE_CNTL                                    0xC39C
1359f6796caeSAlex Deucher 
136022c775ceSAlex Deucher #define RLC_GPM_STAT                                      0xC400
136122c775ceSAlex Deucher #       define RLC_GPM_BUSY                               (1 << 0)
1362a412fce0SAlex Deucher #       define GFX_POWER_STATUS                           (1 << 1)
1363a412fce0SAlex Deucher #       define GFX_CLOCK_STATUS                           (1 << 2)
136422c775ceSAlex Deucher 
136522c775ceSAlex Deucher #define RLC_PG_CNTL                                       0xC40C
136622c775ceSAlex Deucher #       define GFX_PG_ENABLE                              (1 << 0)
136722c775ceSAlex Deucher #       define GFX_PG_SRC                                 (1 << 1)
136822c775ceSAlex Deucher #       define DYN_PER_CU_PG_ENABLE                       (1 << 2)
136922c775ceSAlex Deucher #       define STATIC_PER_CU_PG_ENABLE                    (1 << 3)
137022c775ceSAlex Deucher #       define DISABLE_GDS_PG                             (1 << 13)
137122c775ceSAlex Deucher #       define DISABLE_CP_PG                              (1 << 15)
137222c775ceSAlex Deucher #       define SMU_CLK_SLOWDOWN_ON_PU_ENABLE              (1 << 17)
137322c775ceSAlex Deucher #       define SMU_CLK_SLOWDOWN_ON_PD_ENABLE              (1 << 18)
137422c775ceSAlex Deucher 
137522c775ceSAlex Deucher #define RLC_CGTT_MGCG_OVERRIDE                            0xC420
1376f6796caeSAlex Deucher #define RLC_CGCG_CGLS_CTRL                                0xC424
137722c775ceSAlex Deucher #       define CGCG_EN                                    (1 << 0)
137822c775ceSAlex Deucher #       define CGLS_EN                                    (1 << 1)
137922c775ceSAlex Deucher 
138022c775ceSAlex Deucher #define RLC_PG_DELAY                                      0xC434
1381f6796caeSAlex Deucher 
1382f6796caeSAlex Deucher #define RLC_LB_INIT_CU_MASK                               0xC43C
1383f6796caeSAlex Deucher 
1384f6796caeSAlex Deucher #define RLC_LB_PARAMS                                     0xC444
1385f6796caeSAlex Deucher 
138622c775ceSAlex Deucher #define RLC_PG_AO_CU_MASK                                 0xC44C
138722c775ceSAlex Deucher 
138822c775ceSAlex Deucher #define	RLC_MAX_PG_CU					0xC450
138922c775ceSAlex Deucher #	define MAX_PU_CU(x)				((x) << 0)
139022c775ceSAlex Deucher #	define MAX_PU_CU_MASK				(0xff << 0)
139122c775ceSAlex Deucher #define RLC_AUTO_PG_CTRL                                  0xC454
139222c775ceSAlex Deucher #       define AUTO_PG_EN                                 (1 << 0)
139322c775ceSAlex Deucher #	define GRBM_REG_SGIT(x)				((x) << 3)
139422c775ceSAlex Deucher #	define GRBM_REG_SGIT_MASK			(0xffff << 3)
139522c775ceSAlex Deucher 
139622c775ceSAlex Deucher #define RLC_SERDES_WR_CU_MASTER_MASK                      0xC474
139722c775ceSAlex Deucher #define RLC_SERDES_WR_NONCU_MASTER_MASK                   0xC478
139822c775ceSAlex Deucher #define RLC_SERDES_WR_CTRL                                0xC47C
139922c775ceSAlex Deucher #define		BPM_ADDR(x)				((x) << 0)
140022c775ceSAlex Deucher #define		BPM_ADDR_MASK      			(0xff << 0)
140122c775ceSAlex Deucher #define		CGLS_ENABLE				(1 << 16)
140222c775ceSAlex Deucher #define		CGCG_OVERRIDE_0				(1 << 20)
140322c775ceSAlex Deucher #define		MGCG_OVERRIDE_0				(1 << 22)
140422c775ceSAlex Deucher #define		MGCG_OVERRIDE_1				(1 << 23)
140522c775ceSAlex Deucher 
1406f6796caeSAlex Deucher #define RLC_SERDES_CU_MASTER_BUSY                         0xC484
1407f6796caeSAlex Deucher #define RLC_SERDES_NONCU_MASTER_BUSY                      0xC488
1408f6796caeSAlex Deucher #       define SE_MASTER_BUSY_MASK                        0x0000ffff
1409f6796caeSAlex Deucher #       define GC_MASTER_BUSY                             (1 << 16)
1410f6796caeSAlex Deucher #       define TC0_MASTER_BUSY                            (1 << 17)
1411f6796caeSAlex Deucher #       define TC1_MASTER_BUSY                            (1 << 18)
1412f6796caeSAlex Deucher 
1413f6796caeSAlex Deucher #define RLC_GPM_SCRATCH_ADDR                              0xC4B0
1414f6796caeSAlex Deucher #define RLC_GPM_SCRATCH_DATA                              0xC4B4
1415f6796caeSAlex Deucher 
1416a412fce0SAlex Deucher #define RLC_GPR_REG2                                      0xC4E8
1417a412fce0SAlex Deucher #define		REQ      				0x00000001
1418a412fce0SAlex Deucher #define		MESSAGE(x)      			((x) << 1)
1419a412fce0SAlex Deucher #define		MESSAGE_MASK      			0x0000001e
1420a412fce0SAlex Deucher #define		MSG_ENTER_RLC_SAFE_MODE      			1
1421a412fce0SAlex Deucher #define		MSG_EXIT_RLC_SAFE_MODE      			0
1422a412fce0SAlex Deucher 
1423963e81f9SAlex Deucher #define CP_HPD_EOP_BASE_ADDR                              0xC904
1424963e81f9SAlex Deucher #define CP_HPD_EOP_BASE_ADDR_HI                           0xC908
1425963e81f9SAlex Deucher #define CP_HPD_EOP_VMID                                   0xC90C
1426963e81f9SAlex Deucher #define CP_HPD_EOP_CONTROL                                0xC910
1427963e81f9SAlex Deucher #define		EOP_SIZE(x)				((x) << 0)
1428963e81f9SAlex Deucher #define		EOP_SIZE_MASK      			(0x3f << 0)
1429963e81f9SAlex Deucher #define CP_MQD_BASE_ADDR                                  0xC914
1430963e81f9SAlex Deucher #define CP_MQD_BASE_ADDR_HI                               0xC918
1431963e81f9SAlex Deucher #define CP_HQD_ACTIVE                                     0xC91C
1432963e81f9SAlex Deucher #define CP_HQD_VMID                                       0xC920
1433963e81f9SAlex Deucher 
1434963e81f9SAlex Deucher #define CP_HQD_PQ_BASE                                    0xC934
1435963e81f9SAlex Deucher #define CP_HQD_PQ_BASE_HI                                 0xC938
1436963e81f9SAlex Deucher #define CP_HQD_PQ_RPTR                                    0xC93C
1437963e81f9SAlex Deucher #define CP_HQD_PQ_RPTR_REPORT_ADDR                        0xC940
1438963e81f9SAlex Deucher #define CP_HQD_PQ_RPTR_REPORT_ADDR_HI                     0xC944
1439963e81f9SAlex Deucher #define CP_HQD_PQ_WPTR_POLL_ADDR                          0xC948
1440963e81f9SAlex Deucher #define CP_HQD_PQ_WPTR_POLL_ADDR_HI                       0xC94C
1441963e81f9SAlex Deucher #define CP_HQD_PQ_DOORBELL_CONTROL                        0xC950
1442963e81f9SAlex Deucher #define		DOORBELL_OFFSET(x)			((x) << 2)
1443963e81f9SAlex Deucher #define		DOORBELL_OFFSET_MASK			(0x1fffff << 2)
1444963e81f9SAlex Deucher #define		DOORBELL_SOURCE      			(1 << 28)
1445963e81f9SAlex Deucher #define		DOORBELL_SCHD_HIT      			(1 << 29)
1446963e81f9SAlex Deucher #define		DOORBELL_EN      			(1 << 30)
1447963e81f9SAlex Deucher #define		DOORBELL_HIT      			(1 << 31)
1448963e81f9SAlex Deucher #define CP_HQD_PQ_WPTR                                    0xC954
1449963e81f9SAlex Deucher #define CP_HQD_PQ_CONTROL                                 0xC958
1450963e81f9SAlex Deucher #define		QUEUE_SIZE(x)				((x) << 0)
1451963e81f9SAlex Deucher #define		QUEUE_SIZE_MASK      			(0x3f << 0)
1452963e81f9SAlex Deucher #define		RPTR_BLOCK_SIZE(x)			((x) << 8)
1453963e81f9SAlex Deucher #define		RPTR_BLOCK_SIZE_MASK			(0x3f << 8)
1454963e81f9SAlex Deucher #define		PQ_VOLATILE      			(1 << 26)
1455963e81f9SAlex Deucher #define		NO_UPDATE_RPTR      			(1 << 27)
1456963e81f9SAlex Deucher #define		UNORD_DISPATCH      			(1 << 28)
1457963e81f9SAlex Deucher #define		ROQ_PQ_IB_FLIP      			(1 << 29)
1458963e81f9SAlex Deucher #define		PRIV_STATE      			(1 << 30)
1459963e81f9SAlex Deucher #define		KMD_QUEUE      				(1 << 31)
1460963e81f9SAlex Deucher 
1461963e81f9SAlex Deucher #define CP_HQD_DEQUEUE_REQUEST                          0xC974
1462963e81f9SAlex Deucher 
1463963e81f9SAlex Deucher #define CP_MQD_CONTROL                                  0xC99C
1464963e81f9SAlex Deucher #define		MQD_VMID(x)				((x) << 0)
1465963e81f9SAlex Deucher #define		MQD_VMID_MASK      			(0xf << 0)
1466963e81f9SAlex Deucher 
146722c775ceSAlex Deucher #define DB_RENDER_CONTROL                               0x28000
146822c775ceSAlex Deucher 
14698cc1a532SAlex Deucher #define PA_SC_RASTER_CONFIG                             0x28350
14708cc1a532SAlex Deucher #       define RASTER_CONFIG_RB_MAP_0                   0
14718cc1a532SAlex Deucher #       define RASTER_CONFIG_RB_MAP_1                   1
14728cc1a532SAlex Deucher #       define RASTER_CONFIG_RB_MAP_2                   2
14738cc1a532SAlex Deucher #       define RASTER_CONFIG_RB_MAP_3                   3
1474fc821b70SAlex Deucher #define		PKR_MAP(x)				((x) << 8)
14758cc1a532SAlex Deucher 
14762cae3bc3SAlex Deucher #define VGT_EVENT_INITIATOR                             0x28a90
14772cae3bc3SAlex Deucher #       define SAMPLE_STREAMOUTSTATS1                   (1 << 0)
14782cae3bc3SAlex Deucher #       define SAMPLE_STREAMOUTSTATS2                   (2 << 0)
14792cae3bc3SAlex Deucher #       define SAMPLE_STREAMOUTSTATS3                   (3 << 0)
14802cae3bc3SAlex Deucher #       define CACHE_FLUSH_TS                           (4 << 0)
14812cae3bc3SAlex Deucher #       define CACHE_FLUSH                              (6 << 0)
14822cae3bc3SAlex Deucher #       define CS_PARTIAL_FLUSH                         (7 << 0)
14832cae3bc3SAlex Deucher #       define VGT_STREAMOUT_RESET                      (10 << 0)
14842cae3bc3SAlex Deucher #       define END_OF_PIPE_INCR_DE                      (11 << 0)
14852cae3bc3SAlex Deucher #       define END_OF_PIPE_IB_END                       (12 << 0)
14862cae3bc3SAlex Deucher #       define RST_PIX_CNT                              (13 << 0)
14872cae3bc3SAlex Deucher #       define VS_PARTIAL_FLUSH                         (15 << 0)
14882cae3bc3SAlex Deucher #       define PS_PARTIAL_FLUSH                         (16 << 0)
14892cae3bc3SAlex Deucher #       define CACHE_FLUSH_AND_INV_TS_EVENT             (20 << 0)
14902cae3bc3SAlex Deucher #       define ZPASS_DONE                               (21 << 0)
14912cae3bc3SAlex Deucher #       define CACHE_FLUSH_AND_INV_EVENT                (22 << 0)
14922cae3bc3SAlex Deucher #       define PERFCOUNTER_START                        (23 << 0)
14932cae3bc3SAlex Deucher #       define PERFCOUNTER_STOP                         (24 << 0)
14942cae3bc3SAlex Deucher #       define PIPELINESTAT_START                       (25 << 0)
14952cae3bc3SAlex Deucher #       define PIPELINESTAT_STOP                        (26 << 0)
14962cae3bc3SAlex Deucher #       define PERFCOUNTER_SAMPLE                       (27 << 0)
14972cae3bc3SAlex Deucher #       define SAMPLE_PIPELINESTAT                      (30 << 0)
14982cae3bc3SAlex Deucher #       define SO_VGT_STREAMOUT_FLUSH                   (31 << 0)
14992cae3bc3SAlex Deucher #       define SAMPLE_STREAMOUTSTATS                    (32 << 0)
15002cae3bc3SAlex Deucher #       define RESET_VTX_CNT                            (33 << 0)
15012cae3bc3SAlex Deucher #       define VGT_FLUSH                                (36 << 0)
15022cae3bc3SAlex Deucher #       define BOTTOM_OF_PIPE_TS                        (40 << 0)
15032cae3bc3SAlex Deucher #       define DB_CACHE_FLUSH_AND_INV                   (42 << 0)
15042cae3bc3SAlex Deucher #       define FLUSH_AND_INV_DB_DATA_TS                 (43 << 0)
15052cae3bc3SAlex Deucher #       define FLUSH_AND_INV_DB_META                    (44 << 0)
15062cae3bc3SAlex Deucher #       define FLUSH_AND_INV_CB_DATA_TS                 (45 << 0)
15072cae3bc3SAlex Deucher #       define FLUSH_AND_INV_CB_META                    (46 << 0)
15082cae3bc3SAlex Deucher #       define CS_DONE                                  (47 << 0)
15092cae3bc3SAlex Deucher #       define PS_DONE                                  (48 << 0)
15102cae3bc3SAlex Deucher #       define FLUSH_AND_INV_CB_PIXEL_DATA              (49 << 0)
15112cae3bc3SAlex Deucher #       define THREAD_TRACE_START                       (51 << 0)
15122cae3bc3SAlex Deucher #       define THREAD_TRACE_STOP                        (52 << 0)
15132cae3bc3SAlex Deucher #       define THREAD_TRACE_FLUSH                       (54 << 0)
15142cae3bc3SAlex Deucher #       define THREAD_TRACE_FINISH                      (55 << 0)
15152cae3bc3SAlex Deucher #       define PIXEL_PIPE_STAT_CONTROL                  (56 << 0)
15162cae3bc3SAlex Deucher #       define PIXEL_PIPE_STAT_DUMP                     (57 << 0)
15172cae3bc3SAlex Deucher #       define PIXEL_PIPE_STAT_RESET                    (58 << 0)
15182cae3bc3SAlex Deucher 
1519841cf442SAlex Deucher #define	SCRATCH_REG0					0x30100
1520841cf442SAlex Deucher #define	SCRATCH_REG1					0x30104
1521841cf442SAlex Deucher #define	SCRATCH_REG2					0x30108
1522841cf442SAlex Deucher #define	SCRATCH_REG3					0x3010C
1523841cf442SAlex Deucher #define	SCRATCH_REG4					0x30110
1524841cf442SAlex Deucher #define	SCRATCH_REG5					0x30114
1525841cf442SAlex Deucher #define	SCRATCH_REG6					0x30118
1526841cf442SAlex Deucher #define	SCRATCH_REG7					0x3011C
1527841cf442SAlex Deucher 
1528841cf442SAlex Deucher #define	SCRATCH_UMSK					0x30140
1529841cf442SAlex Deucher #define	SCRATCH_ADDR					0x30144
1530841cf442SAlex Deucher 
1531841cf442SAlex Deucher #define	CP_SEM_WAIT_TIMER				0x301BC
1532841cf442SAlex Deucher 
1533841cf442SAlex Deucher #define	CP_SEM_INCOMPLETE_TIMER_CNTL			0x301C8
1534841cf442SAlex Deucher 
15352cae3bc3SAlex Deucher #define	CP_WAIT_REG_MEM_TIMEOUT				0x301D0
15362cae3bc3SAlex Deucher 
15378cc1a532SAlex Deucher #define GRBM_GFX_INDEX          			0x30800
15388cc1a532SAlex Deucher #define		INSTANCE_INDEX(x)			((x) << 0)
15398cc1a532SAlex Deucher #define		SH_INDEX(x)     			((x) << 8)
15408cc1a532SAlex Deucher #define		SE_INDEX(x)     			((x) << 16)
15418cc1a532SAlex Deucher #define		SH_BROADCAST_WRITES      		(1 << 29)
15428cc1a532SAlex Deucher #define		INSTANCE_BROADCAST_WRITES      		(1 << 30)
15438cc1a532SAlex Deucher #define		SE_BROADCAST_WRITES      		(1 << 31)
15448cc1a532SAlex Deucher 
15458cc1a532SAlex Deucher #define	VGT_ESGS_RING_SIZE				0x30900
15468cc1a532SAlex Deucher #define	VGT_GSVS_RING_SIZE				0x30904
15478cc1a532SAlex Deucher #define	VGT_PRIMITIVE_TYPE				0x30908
15488cc1a532SAlex Deucher #define	VGT_INDEX_TYPE					0x3090C
15498cc1a532SAlex Deucher 
15508cc1a532SAlex Deucher #define	VGT_NUM_INDICES					0x30930
15518cc1a532SAlex Deucher #define	VGT_NUM_INSTANCES				0x30934
15528cc1a532SAlex Deucher #define	VGT_TF_RING_SIZE				0x30938
15538cc1a532SAlex Deucher #define	VGT_HS_OFFCHIP_PARAM				0x3093C
15548cc1a532SAlex Deucher #define	VGT_TF_MEMORY_BASE				0x30940
15558cc1a532SAlex Deucher 
15568cc1a532SAlex Deucher #define	PA_SU_LINE_STIPPLE_VALUE			0x30a00
15578cc1a532SAlex Deucher #define	PA_SC_LINE_STIPPLE_STATE			0x30a04
15588cc1a532SAlex Deucher 
15598cc1a532SAlex Deucher #define	SQC_CACHES					0x30d20
15608cc1a532SAlex Deucher 
15618cc1a532SAlex Deucher #define	CP_PERFMON_CNTL					0x36020
15628cc1a532SAlex Deucher 
156322c775ceSAlex Deucher #define	CGTS_SM_CTRL_REG				0x3c000
156422c775ceSAlex Deucher #define		SM_MODE(x)				((x) << 17)
156522c775ceSAlex Deucher #define		SM_MODE_MASK				(0x7 << 17)
156622c775ceSAlex Deucher #define		SM_MODE_ENABLE				(1 << 20)
156722c775ceSAlex Deucher #define		CGTS_OVERRIDE				(1 << 21)
156822c775ceSAlex Deucher #define		CGTS_LS_OVERRIDE			(1 << 22)
156922c775ceSAlex Deucher #define		ON_MONITOR_ADD_EN			(1 << 23)
157022c775ceSAlex Deucher #define		ON_MONITOR_ADD(x)			((x) << 24)
157122c775ceSAlex Deucher #define		ON_MONITOR_ADD_MASK			(0xff << 24)
157222c775ceSAlex Deucher 
15738cc1a532SAlex Deucher #define	CGTS_TCC_DISABLE				0x3c00c
15748cc1a532SAlex Deucher #define	CGTS_USER_TCC_DISABLE				0x3c010
15758cc1a532SAlex Deucher #define		TCC_DISABLE_MASK				0xFFFF0000
15768cc1a532SAlex Deucher #define		TCC_DISABLE_SHIFT				16
15778cc1a532SAlex Deucher 
1578f6796caeSAlex Deucher #define	CB_CGTT_SCLK_CTRL				0x3c2a0
1579f6796caeSAlex Deucher 
1580841cf442SAlex Deucher /*
1581841cf442SAlex Deucher  * PM4
1582841cf442SAlex Deucher  */
1583841cf442SAlex Deucher #define	PACKET_TYPE0	0
1584841cf442SAlex Deucher #define	PACKET_TYPE1	1
1585841cf442SAlex Deucher #define	PACKET_TYPE2	2
1586841cf442SAlex Deucher #define	PACKET_TYPE3	3
1587841cf442SAlex Deucher 
1588841cf442SAlex Deucher #define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
1589841cf442SAlex Deucher #define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
1590841cf442SAlex Deucher #define CP_PACKET0_GET_REG(h) (((h) & 0xFFFF) << 2)
1591841cf442SAlex Deucher #define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
1592841cf442SAlex Deucher #define PACKET0(reg, n)	((PACKET_TYPE0 << 30) |				\
1593841cf442SAlex Deucher 			 (((reg) >> 2) & 0xFFFF) |			\
1594841cf442SAlex Deucher 			 ((n) & 0x3FFF) << 16)
1595841cf442SAlex Deucher #define CP_PACKET2			0x80000000
1596841cf442SAlex Deucher #define		PACKET2_PAD_SHIFT		0
1597841cf442SAlex Deucher #define		PACKET2_PAD_MASK		(0x3fffffff << 0)
1598841cf442SAlex Deucher 
1599841cf442SAlex Deucher #define PACKET2(v)	(CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
1600841cf442SAlex Deucher 
1601841cf442SAlex Deucher #define PACKET3(op, n)	((PACKET_TYPE3 << 30) |				\
1602841cf442SAlex Deucher 			 (((op) & 0xFF) << 8) |				\
1603841cf442SAlex Deucher 			 ((n) & 0x3FFF) << 16)
1604841cf442SAlex Deucher 
1605841cf442SAlex Deucher #define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1)
1606841cf442SAlex Deucher 
1607841cf442SAlex Deucher /* Packet 3 types */
1608841cf442SAlex Deucher #define	PACKET3_NOP					0x10
1609841cf442SAlex Deucher #define	PACKET3_SET_BASE				0x11
1610841cf442SAlex Deucher #define		PACKET3_BASE_INDEX(x)                  ((x) << 0)
1611841cf442SAlex Deucher #define			CE_PARTITION_BASE		3
1612841cf442SAlex Deucher #define	PACKET3_CLEAR_STATE				0x12
1613841cf442SAlex Deucher #define	PACKET3_INDEX_BUFFER_SIZE			0x13
1614841cf442SAlex Deucher #define	PACKET3_DISPATCH_DIRECT				0x15
1615841cf442SAlex Deucher #define	PACKET3_DISPATCH_INDIRECT			0x16
1616841cf442SAlex Deucher #define	PACKET3_ATOMIC_GDS				0x1D
1617841cf442SAlex Deucher #define	PACKET3_ATOMIC_MEM				0x1E
1618841cf442SAlex Deucher #define	PACKET3_OCCLUSION_QUERY				0x1F
1619841cf442SAlex Deucher #define	PACKET3_SET_PREDICATION				0x20
1620841cf442SAlex Deucher #define	PACKET3_REG_RMW					0x21
1621841cf442SAlex Deucher #define	PACKET3_COND_EXEC				0x22
1622841cf442SAlex Deucher #define	PACKET3_PRED_EXEC				0x23
1623841cf442SAlex Deucher #define	PACKET3_DRAW_INDIRECT				0x24
1624841cf442SAlex Deucher #define	PACKET3_DRAW_INDEX_INDIRECT			0x25
1625841cf442SAlex Deucher #define	PACKET3_INDEX_BASE				0x26
1626841cf442SAlex Deucher #define	PACKET3_DRAW_INDEX_2				0x27
1627841cf442SAlex Deucher #define	PACKET3_CONTEXT_CONTROL				0x28
1628841cf442SAlex Deucher #define	PACKET3_INDEX_TYPE				0x2A
1629841cf442SAlex Deucher #define	PACKET3_DRAW_INDIRECT_MULTI			0x2C
1630841cf442SAlex Deucher #define	PACKET3_DRAW_INDEX_AUTO				0x2D
1631841cf442SAlex Deucher #define	PACKET3_NUM_INSTANCES				0x2F
1632841cf442SAlex Deucher #define	PACKET3_DRAW_INDEX_MULTI_AUTO			0x30
1633841cf442SAlex Deucher #define	PACKET3_INDIRECT_BUFFER_CONST			0x33
1634841cf442SAlex Deucher #define	PACKET3_STRMOUT_BUFFER_UPDATE			0x34
1635841cf442SAlex Deucher #define	PACKET3_DRAW_INDEX_OFFSET_2			0x35
1636841cf442SAlex Deucher #define	PACKET3_DRAW_PREAMBLE				0x36
1637841cf442SAlex Deucher #define	PACKET3_WRITE_DATA				0x37
16382cae3bc3SAlex Deucher #define		WRITE_DATA_DST_SEL(x)                   ((x) << 8)
16392cae3bc3SAlex Deucher                 /* 0 - register
16402cae3bc3SAlex Deucher 		 * 1 - memory (sync - via GRBM)
16412cae3bc3SAlex Deucher 		 * 2 - gl2
16422cae3bc3SAlex Deucher 		 * 3 - gds
16432cae3bc3SAlex Deucher 		 * 4 - reserved
16442cae3bc3SAlex Deucher 		 * 5 - memory (async - direct)
16452cae3bc3SAlex Deucher 		 */
16462cae3bc3SAlex Deucher #define		WR_ONE_ADDR                             (1 << 16)
16472cae3bc3SAlex Deucher #define		WR_CONFIRM                              (1 << 20)
16482cae3bc3SAlex Deucher #define		WRITE_DATA_CACHE_POLICY(x)              ((x) << 25)
16492cae3bc3SAlex Deucher                 /* 0 - LRU
16502cae3bc3SAlex Deucher 		 * 1 - Stream
16512cae3bc3SAlex Deucher 		 */
16522cae3bc3SAlex Deucher #define		WRITE_DATA_ENGINE_SEL(x)                ((x) << 30)
16532cae3bc3SAlex Deucher                 /* 0 - me
16542cae3bc3SAlex Deucher 		 * 1 - pfp
16552cae3bc3SAlex Deucher 		 * 2 - ce
16562cae3bc3SAlex Deucher 		 */
1657841cf442SAlex Deucher #define	PACKET3_DRAW_INDEX_INDIRECT_MULTI		0x38
1658841cf442SAlex Deucher #define	PACKET3_MEM_SEMAPHORE				0x39
16592cae3bc3SAlex Deucher #              define PACKET3_SEM_USE_MAILBOX       (0x1 << 16)
16602cae3bc3SAlex Deucher #              define PACKET3_SEM_SEL_SIGNAL_TYPE   (0x1 << 20) /* 0 = increment, 1 = write 1 */
16612cae3bc3SAlex Deucher #              define PACKET3_SEM_CLIENT_CODE	    ((x) << 24) /* 0 = CP, 1 = CB, 2 = DB */
16622cae3bc3SAlex Deucher #              define PACKET3_SEM_SEL_SIGNAL	    (0x6 << 29)
16632cae3bc3SAlex Deucher #              define PACKET3_SEM_SEL_WAIT	    (0x7 << 29)
1664841cf442SAlex Deucher #define	PACKET3_COPY_DW					0x3B
1665841cf442SAlex Deucher #define	PACKET3_WAIT_REG_MEM				0x3C
16662cae3bc3SAlex Deucher #define		WAIT_REG_MEM_FUNCTION(x)                ((x) << 0)
16672cae3bc3SAlex Deucher                 /* 0 - always
16682cae3bc3SAlex Deucher 		 * 1 - <
16692cae3bc3SAlex Deucher 		 * 2 - <=
16702cae3bc3SAlex Deucher 		 * 3 - ==
16712cae3bc3SAlex Deucher 		 * 4 - !=
16722cae3bc3SAlex Deucher 		 * 5 - >=
16732cae3bc3SAlex Deucher 		 * 6 - >
16742cae3bc3SAlex Deucher 		 */
16752cae3bc3SAlex Deucher #define		WAIT_REG_MEM_MEM_SPACE(x)               ((x) << 4)
16762cae3bc3SAlex Deucher                 /* 0 - reg
16772cae3bc3SAlex Deucher 		 * 1 - mem
16782cae3bc3SAlex Deucher 		 */
16792cae3bc3SAlex Deucher #define		WAIT_REG_MEM_OPERATION(x)               ((x) << 6)
16802cae3bc3SAlex Deucher                 /* 0 - wait_reg_mem
16812cae3bc3SAlex Deucher 		 * 1 - wr_wait_wr_reg
16822cae3bc3SAlex Deucher 		 */
16832cae3bc3SAlex Deucher #define		WAIT_REG_MEM_ENGINE(x)                  ((x) << 8)
16842cae3bc3SAlex Deucher                 /* 0 - me
16852cae3bc3SAlex Deucher 		 * 1 - pfp
16862cae3bc3SAlex Deucher 		 */
1687841cf442SAlex Deucher #define	PACKET3_INDIRECT_BUFFER				0x3F
16882cae3bc3SAlex Deucher #define		INDIRECT_BUFFER_TCL2_VOLATILE           (1 << 22)
16892cae3bc3SAlex Deucher #define		INDIRECT_BUFFER_VALID                   (1 << 23)
16902cae3bc3SAlex Deucher #define		INDIRECT_BUFFER_CACHE_POLICY(x)         ((x) << 28)
16912cae3bc3SAlex Deucher                 /* 0 - LRU
16922cae3bc3SAlex Deucher 		 * 1 - Stream
16932cae3bc3SAlex Deucher 		 * 2 - Bypass
16942cae3bc3SAlex Deucher 		 */
1695841cf442SAlex Deucher #define	PACKET3_COPY_DATA				0x40
1696841cf442SAlex Deucher #define	PACKET3_PFP_SYNC_ME				0x42
1697841cf442SAlex Deucher #define	PACKET3_SURFACE_SYNC				0x43
1698841cf442SAlex Deucher #              define PACKET3_DEST_BASE_0_ENA      (1 << 0)
1699841cf442SAlex Deucher #              define PACKET3_DEST_BASE_1_ENA      (1 << 1)
1700841cf442SAlex Deucher #              define PACKET3_CB0_DEST_BASE_ENA    (1 << 6)
1701841cf442SAlex Deucher #              define PACKET3_CB1_DEST_BASE_ENA    (1 << 7)
1702841cf442SAlex Deucher #              define PACKET3_CB2_DEST_BASE_ENA    (1 << 8)
1703841cf442SAlex Deucher #              define PACKET3_CB3_DEST_BASE_ENA    (1 << 9)
1704841cf442SAlex Deucher #              define PACKET3_CB4_DEST_BASE_ENA    (1 << 10)
1705841cf442SAlex Deucher #              define PACKET3_CB5_DEST_BASE_ENA    (1 << 11)
1706841cf442SAlex Deucher #              define PACKET3_CB6_DEST_BASE_ENA    (1 << 12)
1707841cf442SAlex Deucher #              define PACKET3_CB7_DEST_BASE_ENA    (1 << 13)
1708841cf442SAlex Deucher #              define PACKET3_DB_DEST_BASE_ENA     (1 << 14)
1709841cf442SAlex Deucher #              define PACKET3_TCL1_VOL_ACTION_ENA  (1 << 15)
1710841cf442SAlex Deucher #              define PACKET3_TC_VOL_ACTION_ENA    (1 << 16) /* L2 */
1711841cf442SAlex Deucher #              define PACKET3_TC_WB_ACTION_ENA     (1 << 18) /* L2 */
1712841cf442SAlex Deucher #              define PACKET3_DEST_BASE_2_ENA      (1 << 19)
1713841cf442SAlex Deucher #              define PACKET3_DEST_BASE_3_ENA      (1 << 21)
1714841cf442SAlex Deucher #              define PACKET3_TCL1_ACTION_ENA      (1 << 22)
1715841cf442SAlex Deucher #              define PACKET3_TC_ACTION_ENA        (1 << 23) /* L2 */
1716841cf442SAlex Deucher #              define PACKET3_CB_ACTION_ENA        (1 << 25)
1717841cf442SAlex Deucher #              define PACKET3_DB_ACTION_ENA        (1 << 26)
1718841cf442SAlex Deucher #              define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27)
1719841cf442SAlex Deucher #              define PACKET3_SH_KCACHE_VOL_ACTION_ENA (1 << 28)
1720841cf442SAlex Deucher #              define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29)
1721841cf442SAlex Deucher #define	PACKET3_COND_WRITE				0x45
1722841cf442SAlex Deucher #define	PACKET3_EVENT_WRITE				0x46
1723841cf442SAlex Deucher #define		EVENT_TYPE(x)                           ((x) << 0)
1724841cf442SAlex Deucher #define		EVENT_INDEX(x)                          ((x) << 8)
1725841cf442SAlex Deucher                 /* 0 - any non-TS event
1726841cf442SAlex Deucher 		 * 1 - ZPASS_DONE, PIXEL_PIPE_STAT_*
1727841cf442SAlex Deucher 		 * 2 - SAMPLE_PIPELINESTAT
1728841cf442SAlex Deucher 		 * 3 - SAMPLE_STREAMOUTSTAT*
1729841cf442SAlex Deucher 		 * 4 - *S_PARTIAL_FLUSH
1730841cf442SAlex Deucher 		 * 5 - EOP events
1731841cf442SAlex Deucher 		 * 6 - EOS events
1732841cf442SAlex Deucher 		 */
1733841cf442SAlex Deucher #define	PACKET3_EVENT_WRITE_EOP				0x47
1734841cf442SAlex Deucher #define		EOP_TCL1_VOL_ACTION_EN                  (1 << 12)
1735841cf442SAlex Deucher #define		EOP_TC_VOL_ACTION_EN                    (1 << 13) /* L2 */
1736841cf442SAlex Deucher #define		EOP_TC_WB_ACTION_EN                     (1 << 15) /* L2 */
1737841cf442SAlex Deucher #define		EOP_TCL1_ACTION_EN                      (1 << 16)
1738841cf442SAlex Deucher #define		EOP_TC_ACTION_EN                        (1 << 17) /* L2 */
17392cae3bc3SAlex Deucher #define		EOP_CACHE_POLICY(x)                     ((x) << 25)
1740841cf442SAlex Deucher                 /* 0 - LRU
1741841cf442SAlex Deucher 		 * 1 - Stream
1742841cf442SAlex Deucher 		 * 2 - Bypass
1743841cf442SAlex Deucher 		 */
17442cae3bc3SAlex Deucher #define		EOP_TCL2_VOLATILE                       (1 << 27)
1745841cf442SAlex Deucher #define		DATA_SEL(x)                             ((x) << 29)
1746841cf442SAlex Deucher                 /* 0 - discard
1747841cf442SAlex Deucher 		 * 1 - send low 32bit data
1748841cf442SAlex Deucher 		 * 2 - send 64bit data
1749841cf442SAlex Deucher 		 * 3 - send 64bit GPU counter value
1750841cf442SAlex Deucher 		 * 4 - send 64bit sys counter value
1751841cf442SAlex Deucher 		 */
1752841cf442SAlex Deucher #define		INT_SEL(x)                              ((x) << 24)
1753841cf442SAlex Deucher                 /* 0 - none
1754841cf442SAlex Deucher 		 * 1 - interrupt only (DATA_SEL = 0)
1755841cf442SAlex Deucher 		 * 2 - interrupt when data write is confirmed
1756841cf442SAlex Deucher 		 */
1757841cf442SAlex Deucher #define		DST_SEL(x)                              ((x) << 16)
1758841cf442SAlex Deucher                 /* 0 - MC
1759841cf442SAlex Deucher 		 * 1 - TC/L2
1760841cf442SAlex Deucher 		 */
1761841cf442SAlex Deucher #define	PACKET3_EVENT_WRITE_EOS				0x48
1762841cf442SAlex Deucher #define	PACKET3_RELEASE_MEM				0x49
1763841cf442SAlex Deucher #define	PACKET3_PREAMBLE_CNTL				0x4A
1764841cf442SAlex Deucher #              define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE     (2 << 28)
1765841cf442SAlex Deucher #              define PACKET3_PREAMBLE_END_CLEAR_STATE       (3 << 28)
1766841cf442SAlex Deucher #define	PACKET3_DMA_DATA				0x50
1767c9dbd705SAlex Deucher /* 1. header
1768c9dbd705SAlex Deucher  * 2. CONTROL
1769c9dbd705SAlex Deucher  * 3. SRC_ADDR_LO or DATA [31:0]
1770c9dbd705SAlex Deucher  * 4. SRC_ADDR_HI [31:0]
1771c9dbd705SAlex Deucher  * 5. DST_ADDR_LO [31:0]
1772c9dbd705SAlex Deucher  * 6. DST_ADDR_HI [7:0]
1773c9dbd705SAlex Deucher  * 7. COMMAND [30:21] | BYTE_COUNT [20:0]
1774c9dbd705SAlex Deucher  */
1775c9dbd705SAlex Deucher /* CONTROL */
1776c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_ENGINE(x)     ((x) << 0)
1777c9dbd705SAlex Deucher                 /* 0 - ME
1778c9dbd705SAlex Deucher 		 * 1 - PFP
1779c9dbd705SAlex Deucher 		 */
1780c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_SRC_CACHE_POLICY(x) ((x) << 13)
1781c9dbd705SAlex Deucher                 /* 0 - LRU
1782c9dbd705SAlex Deucher 		 * 1 - Stream
1783c9dbd705SAlex Deucher 		 * 2 - Bypass
1784c9dbd705SAlex Deucher 		 */
1785c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_SRC_VOLATILE (1 << 15)
1786c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_DST_SEL(x)  ((x) << 20)
1787c9dbd705SAlex Deucher                 /* 0 - DST_ADDR using DAS
1788c9dbd705SAlex Deucher 		 * 1 - GDS
1789c9dbd705SAlex Deucher 		 * 3 - DST_ADDR using L2
1790c9dbd705SAlex Deucher 		 */
1791c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_DST_CACHE_POLICY(x) ((x) << 25)
1792c9dbd705SAlex Deucher                 /* 0 - LRU
1793c9dbd705SAlex Deucher 		 * 1 - Stream
1794c9dbd705SAlex Deucher 		 * 2 - Bypass
1795c9dbd705SAlex Deucher 		 */
1796c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_DST_VOLATILE (1 << 27)
1797c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_SRC_SEL(x)  ((x) << 29)
1798c9dbd705SAlex Deucher                 /* 0 - SRC_ADDR using SAS
1799c9dbd705SAlex Deucher 		 * 1 - GDS
1800c9dbd705SAlex Deucher 		 * 2 - DATA
1801c9dbd705SAlex Deucher 		 * 3 - SRC_ADDR using L2
1802c9dbd705SAlex Deucher 		 */
1803c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CP_SYNC     (1 << 31)
1804c9dbd705SAlex Deucher /* COMMAND */
1805c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_DIS_WC      (1 << 21)
1806c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_SRC_SWAP(x) ((x) << 22)
1807c9dbd705SAlex Deucher                 /* 0 - none
1808c9dbd705SAlex Deucher 		 * 1 - 8 in 16
1809c9dbd705SAlex Deucher 		 * 2 - 8 in 32
1810c9dbd705SAlex Deucher 		 * 3 - 8 in 64
1811c9dbd705SAlex Deucher 		 */
1812c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_DST_SWAP(x) ((x) << 24)
1813c9dbd705SAlex Deucher                 /* 0 - none
1814c9dbd705SAlex Deucher 		 * 1 - 8 in 16
1815c9dbd705SAlex Deucher 		 * 2 - 8 in 32
1816c9dbd705SAlex Deucher 		 * 3 - 8 in 64
1817c9dbd705SAlex Deucher 		 */
1818c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_SAS     (1 << 26)
1819c9dbd705SAlex Deucher                 /* 0 - memory
1820c9dbd705SAlex Deucher 		 * 1 - register
1821c9dbd705SAlex Deucher 		 */
1822c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_DAS     (1 << 27)
1823c9dbd705SAlex Deucher                 /* 0 - memory
1824c9dbd705SAlex Deucher 		 * 1 - register
1825c9dbd705SAlex Deucher 		 */
1826c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_SAIC    (1 << 28)
1827c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_DAIC    (1 << 29)
1828c9dbd705SAlex Deucher #              define PACKET3_DMA_DATA_CMD_RAW_WAIT  (1 << 30)
1829841cf442SAlex Deucher #define	PACKET3_AQUIRE_MEM				0x58
1830841cf442SAlex Deucher #define	PACKET3_REWIND					0x59
1831841cf442SAlex Deucher #define	PACKET3_LOAD_UCONFIG_REG			0x5E
1832841cf442SAlex Deucher #define	PACKET3_LOAD_SH_REG				0x5F
1833841cf442SAlex Deucher #define	PACKET3_LOAD_CONFIG_REG				0x60
1834841cf442SAlex Deucher #define	PACKET3_LOAD_CONTEXT_REG			0x61
1835841cf442SAlex Deucher #define	PACKET3_SET_CONFIG_REG				0x68
1836841cf442SAlex Deucher #define		PACKET3_SET_CONFIG_REG_START			0x00008000
1837841cf442SAlex Deucher #define		PACKET3_SET_CONFIG_REG_END			0x0000b000
1838841cf442SAlex Deucher #define	PACKET3_SET_CONTEXT_REG				0x69
1839841cf442SAlex Deucher #define		PACKET3_SET_CONTEXT_REG_START			0x00028000
1840841cf442SAlex Deucher #define		PACKET3_SET_CONTEXT_REG_END			0x00029000
1841841cf442SAlex Deucher #define	PACKET3_SET_CONTEXT_REG_INDIRECT		0x73
1842841cf442SAlex Deucher #define	PACKET3_SET_SH_REG				0x76
1843841cf442SAlex Deucher #define		PACKET3_SET_SH_REG_START			0x0000b000
1844841cf442SAlex Deucher #define		PACKET3_SET_SH_REG_END				0x0000c000
1845841cf442SAlex Deucher #define	PACKET3_SET_SH_REG_OFFSET			0x77
1846841cf442SAlex Deucher #define	PACKET3_SET_QUEUE_REG				0x78
1847841cf442SAlex Deucher #define	PACKET3_SET_UCONFIG_REG				0x79
18482cae3bc3SAlex Deucher #define		PACKET3_SET_UCONFIG_REG_START			0x00030000
18492cae3bc3SAlex Deucher #define		PACKET3_SET_UCONFIG_REG_END			0x00031000
1850841cf442SAlex Deucher #define	PACKET3_SCRATCH_RAM_WRITE			0x7D
1851841cf442SAlex Deucher #define	PACKET3_SCRATCH_RAM_READ			0x7E
1852841cf442SAlex Deucher #define	PACKET3_LOAD_CONST_RAM				0x80
1853841cf442SAlex Deucher #define	PACKET3_WRITE_CONST_RAM				0x81
1854841cf442SAlex Deucher #define	PACKET3_DUMP_CONST_RAM				0x83
1855841cf442SAlex Deucher #define	PACKET3_INCREMENT_CE_COUNTER			0x84
1856841cf442SAlex Deucher #define	PACKET3_INCREMENT_DE_COUNTER			0x85
1857841cf442SAlex Deucher #define	PACKET3_WAIT_ON_CE_COUNTER			0x86
1858841cf442SAlex Deucher #define	PACKET3_WAIT_ON_DE_COUNTER_DIFF			0x88
18592cae3bc3SAlex Deucher #define	PACKET3_SWITCH_BUFFER				0x8B
1860841cf442SAlex Deucher 
186121a93e13SAlex Deucher /* SDMA - first instance at 0xd000, second at 0xd800 */
186221a93e13SAlex Deucher #define SDMA0_REGISTER_OFFSET                             0x0 /* not a register */
186321a93e13SAlex Deucher #define SDMA1_REGISTER_OFFSET                             0x800 /* not a register */
186421a93e13SAlex Deucher 
186521a93e13SAlex Deucher #define	SDMA0_UCODE_ADDR                                  0xD000
186621a93e13SAlex Deucher #define	SDMA0_UCODE_DATA                                  0xD004
186722c775ceSAlex Deucher #define	SDMA0_POWER_CNTL                                  0xD008
186822c775ceSAlex Deucher #define	SDMA0_CLK_CTRL                                    0xD00C
186921a93e13SAlex Deucher 
187021a93e13SAlex Deucher #define SDMA0_CNTL                                        0xD010
187121a93e13SAlex Deucher #       define TRAP_ENABLE                                (1 << 0)
187221a93e13SAlex Deucher #       define SEM_INCOMPLETE_INT_ENABLE                  (1 << 1)
187321a93e13SAlex Deucher #       define SEM_WAIT_INT_ENABLE                        (1 << 2)
187421a93e13SAlex Deucher #       define DATA_SWAP_ENABLE                           (1 << 3)
187521a93e13SAlex Deucher #       define FENCE_SWAP_ENABLE                          (1 << 4)
187621a93e13SAlex Deucher #       define AUTO_CTXSW_ENABLE                          (1 << 18)
187721a93e13SAlex Deucher #       define CTXEMPTY_INT_ENABLE                        (1 << 28)
187821a93e13SAlex Deucher 
187921a93e13SAlex Deucher #define SDMA0_TILING_CONFIG  				  0xD018
188021a93e13SAlex Deucher 
188121a93e13SAlex Deucher #define SDMA0_SEM_INCOMPLETE_TIMER_CNTL                   0xD020
188221a93e13SAlex Deucher #define SDMA0_SEM_WAIT_FAIL_TIMER_CNTL                    0xD024
188321a93e13SAlex Deucher 
188421a93e13SAlex Deucher #define SDMA0_STATUS_REG                                  0xd034
188521a93e13SAlex Deucher #       define SDMA_IDLE                                  (1 << 0)
188621a93e13SAlex Deucher 
188721a93e13SAlex Deucher #define SDMA0_ME_CNTL                                     0xD048
188821a93e13SAlex Deucher #       define SDMA_HALT                                  (1 << 0)
188921a93e13SAlex Deucher 
189021a93e13SAlex Deucher #define SDMA0_GFX_RB_CNTL                                 0xD200
189121a93e13SAlex Deucher #       define SDMA_RB_ENABLE                             (1 << 0)
189221a93e13SAlex Deucher #       define SDMA_RB_SIZE(x)                            ((x) << 1) /* log2 */
189321a93e13SAlex Deucher #       define SDMA_RB_SWAP_ENABLE                        (1 << 9) /* 8IN32 */
189421a93e13SAlex Deucher #       define SDMA_RPTR_WRITEBACK_ENABLE                 (1 << 12)
189521a93e13SAlex Deucher #       define SDMA_RPTR_WRITEBACK_SWAP_ENABLE            (1 << 13)  /* 8IN32 */
189621a93e13SAlex Deucher #       define SDMA_RPTR_WRITEBACK_TIMER(x)               ((x) << 16) /* log2 */
189721a93e13SAlex Deucher #define SDMA0_GFX_RB_BASE                                 0xD204
189821a93e13SAlex Deucher #define SDMA0_GFX_RB_BASE_HI                              0xD208
189921a93e13SAlex Deucher #define SDMA0_GFX_RB_RPTR                                 0xD20C
190021a93e13SAlex Deucher #define SDMA0_GFX_RB_WPTR                                 0xD210
190121a93e13SAlex Deucher 
190221a93e13SAlex Deucher #define SDMA0_GFX_RB_RPTR_ADDR_HI                         0xD220
190321a93e13SAlex Deucher #define SDMA0_GFX_RB_RPTR_ADDR_LO                         0xD224
190421a93e13SAlex Deucher #define SDMA0_GFX_IB_CNTL                                 0xD228
190521a93e13SAlex Deucher #       define SDMA_IB_ENABLE                             (1 << 0)
190621a93e13SAlex Deucher #       define SDMA_IB_SWAP_ENABLE                        (1 << 4)
190721a93e13SAlex Deucher #       define SDMA_SWITCH_INSIDE_IB                      (1 << 8)
190821a93e13SAlex Deucher #       define SDMA_CMD_VMID(x)                           ((x) << 16)
190921a93e13SAlex Deucher 
191021a93e13SAlex Deucher #define SDMA0_GFX_VIRTUAL_ADDR                            0xD29C
191121a93e13SAlex Deucher #define SDMA0_GFX_APE1_CNTL                               0xD2A0
191221a93e13SAlex Deucher 
191321a93e13SAlex Deucher #define SDMA_PACKET(op, sub_op, e)	((((e) & 0xFFFF) << 16) |	\
191421a93e13SAlex Deucher 					 (((sub_op) & 0xFF) << 8) |	\
191521a93e13SAlex Deucher 					 (((op) & 0xFF) << 0))
191621a93e13SAlex Deucher /* sDMA opcodes */
191721a93e13SAlex Deucher #define	SDMA_OPCODE_NOP					  0
191821a93e13SAlex Deucher #define	SDMA_OPCODE_COPY				  1
191921a93e13SAlex Deucher #       define SDMA_COPY_SUB_OPCODE_LINEAR                0
192021a93e13SAlex Deucher #       define SDMA_COPY_SUB_OPCODE_TILED                 1
192121a93e13SAlex Deucher #       define SDMA_COPY_SUB_OPCODE_SOA                   3
192221a93e13SAlex Deucher #       define SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW     4
192321a93e13SAlex Deucher #       define SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW      5
192421a93e13SAlex Deucher #       define SDMA_COPY_SUB_OPCODE_T2T_SUB_WINDOW        6
192521a93e13SAlex Deucher #define	SDMA_OPCODE_WRITE				  2
192621a93e13SAlex Deucher #       define SDMA_WRITE_SUB_OPCODE_LINEAR               0
192721a93e13SAlex Deucher #       define SDMA_WRTIE_SUB_OPCODE_TILED                1
192821a93e13SAlex Deucher #define	SDMA_OPCODE_INDIRECT_BUFFER			  4
192921a93e13SAlex Deucher #define	SDMA_OPCODE_FENCE				  5
193021a93e13SAlex Deucher #define	SDMA_OPCODE_TRAP				  6
193121a93e13SAlex Deucher #define	SDMA_OPCODE_SEMAPHORE				  7
193221a93e13SAlex Deucher #       define SDMA_SEMAPHORE_EXTRA_O                     (1 << 13)
193321a93e13SAlex Deucher                 /* 0 - increment
193421a93e13SAlex Deucher 		 * 1 - write 1
193521a93e13SAlex Deucher 		 */
193621a93e13SAlex Deucher #       define SDMA_SEMAPHORE_EXTRA_S                     (1 << 14)
193721a93e13SAlex Deucher                 /* 0 - wait
193821a93e13SAlex Deucher 		 * 1 - signal
193921a93e13SAlex Deucher 		 */
194021a93e13SAlex Deucher #       define SDMA_SEMAPHORE_EXTRA_M                     (1 << 15)
194121a93e13SAlex Deucher                 /* mailbox */
194221a93e13SAlex Deucher #define	SDMA_OPCODE_POLL_REG_MEM			  8
194321a93e13SAlex Deucher #       define SDMA_POLL_REG_MEM_EXTRA_OP(x)              ((x) << 10)
194421a93e13SAlex Deucher                 /* 0 - wait_reg_mem
194521a93e13SAlex Deucher 		 * 1 - wr_wait_wr_reg
194621a93e13SAlex Deucher 		 */
194721a93e13SAlex Deucher #       define SDMA_POLL_REG_MEM_EXTRA_FUNC(x)            ((x) << 12)
194821a93e13SAlex Deucher                 /* 0 - always
194921a93e13SAlex Deucher 		 * 1 - <
195021a93e13SAlex Deucher 		 * 2 - <=
195121a93e13SAlex Deucher 		 * 3 - ==
195221a93e13SAlex Deucher 		 * 4 - !=
195321a93e13SAlex Deucher 		 * 5 - >=
195421a93e13SAlex Deucher 		 * 6 - >
195521a93e13SAlex Deucher 		 */
195621a93e13SAlex Deucher #       define SDMA_POLL_REG_MEM_EXTRA_M                  (1 << 15)
195721a93e13SAlex Deucher                 /* 0 = register
195821a93e13SAlex Deucher 		 * 1 = memory
195921a93e13SAlex Deucher 		 */
196021a93e13SAlex Deucher #define	SDMA_OPCODE_COND_EXEC				  9
196121a93e13SAlex Deucher #define	SDMA_OPCODE_CONSTANT_FILL			  11
196221a93e13SAlex Deucher #       define SDMA_CONSTANT_FILL_EXTRA_SIZE(x)           ((x) << 14)
196321a93e13SAlex Deucher                 /* 0 = byte fill
196421a93e13SAlex Deucher 		 * 2 = DW fill
196521a93e13SAlex Deucher 		 */
196621a93e13SAlex Deucher #define	SDMA_OPCODE_GENERATE_PTE_PDE			  12
196721a93e13SAlex Deucher #define	SDMA_OPCODE_TIMESTAMP				  13
196821a93e13SAlex Deucher #       define SDMA_TIMESTAMP_SUB_OPCODE_SET_LOCAL        0
196921a93e13SAlex Deucher #       define SDMA_TIMESTAMP_SUB_OPCODE_GET_LOCAL        1
197021a93e13SAlex Deucher #       define SDMA_TIMESTAMP_SUB_OPCODE_GET_GLOBAL       2
197121a93e13SAlex Deucher #define	SDMA_OPCODE_SRBM_WRITE				  14
197221a93e13SAlex Deucher #       define SDMA_SRBM_WRITE_EXTRA_BYTE_ENABLE(x)       ((x) << 12)
197321a93e13SAlex Deucher                 /* byte mask */
197421a93e13SAlex Deucher 
197587167bb1SChristian König /* UVD */
197687167bb1SChristian König 
197787167bb1SChristian König #define UVD_UDEC_ADDR_CONFIG		0xef4c
197887167bb1SChristian König #define UVD_UDEC_DB_ADDR_CONFIG		0xef50
197987167bb1SChristian König #define UVD_UDEC_DBW_ADDR_CONFIG	0xef54
198087167bb1SChristian König 
198187167bb1SChristian König #define UVD_LMI_EXT40_ADDR		0xf498
198287167bb1SChristian König #define UVD_LMI_ADDR_EXT		0xf594
198387167bb1SChristian König #define UVD_VCPU_CACHE_OFFSET0		0xf608
198487167bb1SChristian König #define UVD_VCPU_CACHE_SIZE0		0xf60c
198587167bb1SChristian König #define UVD_VCPU_CACHE_OFFSET1		0xf610
198687167bb1SChristian König #define UVD_VCPU_CACHE_SIZE1		0xf614
198787167bb1SChristian König #define UVD_VCPU_CACHE_OFFSET2		0xf618
198887167bb1SChristian König #define UVD_VCPU_CACHE_SIZE2		0xf61c
198987167bb1SChristian König 
199087167bb1SChristian König #define UVD_RBC_RB_RPTR			0xf690
199187167bb1SChristian König #define UVD_RBC_RB_WPTR			0xf694
199287167bb1SChristian König 
199322c775ceSAlex Deucher #define	UVD_CGC_CTRL					0xF4B0
199422c775ceSAlex Deucher #	define DCM					(1 << 0)
199522c775ceSAlex Deucher #	define CG_DT(x)					((x) << 2)
199622c775ceSAlex Deucher #	define CG_DT_MASK				(0xf << 2)
199722c775ceSAlex Deucher #	define CLK_OD(x)				((x) << 6)
199822c775ceSAlex Deucher #	define CLK_OD_MASK				(0x1f << 6)
199922c775ceSAlex Deucher 
200087167bb1SChristian König /* UVD clocks */
200187167bb1SChristian König 
200287167bb1SChristian König #define CG_DCLK_CNTL			0xC050009C
200387167bb1SChristian König #	define DCLK_DIVIDER_MASK	0x7f
200487167bb1SChristian König #	define DCLK_DIR_CNTL_EN		(1 << 8)
200587167bb1SChristian König #define CG_DCLK_STATUS			0xC05000A0
200687167bb1SChristian König #	define DCLK_STATUS		(1 << 0)
200787167bb1SChristian König #define CG_VCLK_CNTL			0xC05000A4
200887167bb1SChristian König #define CG_VCLK_STATUS			0xC05000A8
200987167bb1SChristian König 
201022c775ceSAlex Deucher /* UVD CTX indirect */
201122c775ceSAlex Deucher #define	UVD_CGC_MEM_CTRL				0xC0
201222c775ceSAlex Deucher 
2013*d93f7937SChristian König /* VCE */
2014*d93f7937SChristian König 
2015*d93f7937SChristian König #define VCE_VCPU_CACHE_OFFSET0		0x20024
2016*d93f7937SChristian König #define VCE_VCPU_CACHE_SIZE0		0x20028
2017*d93f7937SChristian König #define VCE_VCPU_CACHE_OFFSET1		0x2002c
2018*d93f7937SChristian König #define VCE_VCPU_CACHE_SIZE1		0x20030
2019*d93f7937SChristian König #define VCE_VCPU_CACHE_OFFSET2		0x20034
2020*d93f7937SChristian König #define VCE_VCPU_CACHE_SIZE2		0x20038
2021*d93f7937SChristian König #define VCE_RB_RPTR2			0x20178
2022*d93f7937SChristian König #define VCE_RB_WPTR2			0x2017c
2023*d93f7937SChristian König #define VCE_RB_RPTR			0x2018c
2024*d93f7937SChristian König #define VCE_RB_WPTR			0x20190
2025*d93f7937SChristian König #define VCE_CLOCK_GATING_A		0x202f8
2026*d93f7937SChristian König #define VCE_CLOCK_GATING_B		0x202fc
2027*d93f7937SChristian König #define VCE_UENC_CLOCK_GATING		0x207bc
2028*d93f7937SChristian König #define VCE_UENC_REG_CLOCK_GATING	0x207c0
2029*d93f7937SChristian König #define VCE_SYS_INT_EN			0x21300
2030*d93f7937SChristian König #	define VCE_SYS_INT_TRAP_INTERRUPT_EN	(1 << 3)
2031*d93f7937SChristian König #define VCE_LMI_CTRL2			0x21474
2032*d93f7937SChristian König #define VCE_LMI_CTRL			0x21498
2033*d93f7937SChristian König #define VCE_LMI_VM_CTRL			0x214a0
2034*d93f7937SChristian König #define VCE_LMI_SWAP_CNTL		0x214b4
2035*d93f7937SChristian König #define VCE_LMI_SWAP_CNTL1		0x214b8
2036*d93f7937SChristian König #define VCE_LMI_CACHE_CTRL		0x214f4
2037*d93f7937SChristian König 
2038*d93f7937SChristian König #define VCE_CMD_NO_OP		0x00000000
2039*d93f7937SChristian König #define VCE_CMD_END		0x00000001
2040*d93f7937SChristian König #define VCE_CMD_IB		0x00000002
2041*d93f7937SChristian König #define VCE_CMD_FENCE		0x00000003
2042*d93f7937SChristian König #define VCE_CMD_TRAP		0x00000004
2043*d93f7937SChristian König #define VCE_CMD_IB_AUTO		0x00000005
2044*d93f7937SChristian König #define VCE_CMD_SEMAPHORE	0x00000006
2045*d93f7937SChristian König 
20468cc1a532SAlex Deucher #endif
2047