162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2011 Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1262306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Authors: Alex Deucher
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ci#ifndef SI_H
2562306a36Sopenharmony_ci#define SI_H
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define TAHITI_RB_BITMAP_WIDTH_PER_SH  2
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define TAHITI_GB_ADDR_CONFIG_GOLDEN        0x12011003
3062306a36Sopenharmony_ci#define VERDE_GB_ADDR_CONFIG_GOLDEN         0x12010002
3162306a36Sopenharmony_ci#define HAINAN_GB_ADDR_CONFIG_GOLDEN        0x02010001
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define SI_MAX_SH_GPRS		 	256
3462306a36Sopenharmony_ci#define SI_MAX_TEMP_GPRS         	16
3562306a36Sopenharmony_ci#define SI_MAX_SH_THREADS        	256
3662306a36Sopenharmony_ci#define SI_MAX_SH_STACK_ENTRIES  	4096
3762306a36Sopenharmony_ci#define SI_MAX_FRC_EOV_CNT       	16384
3862306a36Sopenharmony_ci#define SI_MAX_BACKENDS          	8
3962306a36Sopenharmony_ci#define SI_MAX_BACKENDS_MASK     	0xFF
4062306a36Sopenharmony_ci#define SI_MAX_BACKENDS_PER_SE_MASK     0x0F
4162306a36Sopenharmony_ci#define SI_MAX_SIMDS             	12
4262306a36Sopenharmony_ci#define SI_MAX_SIMDS_MASK        	0x0FFF
4362306a36Sopenharmony_ci#define SI_MAX_SIMDS_PER_SE_MASK        0x00FF
4462306a36Sopenharmony_ci#define SI_MAX_PIPES            	8
4562306a36Sopenharmony_ci#define SI_MAX_PIPES_MASK        	0xFF
4662306a36Sopenharmony_ci#define SI_MAX_PIPES_PER_SIMD_MASK      0x3F
4762306a36Sopenharmony_ci#define SI_MAX_LDS_NUM           	0xFFFF
4862306a36Sopenharmony_ci#define SI_MAX_TCC               	16
4962306a36Sopenharmony_ci#define SI_MAX_TCC_MASK          	0xFFFF
5062306a36Sopenharmony_ci#define SI_MAX_CTLACKS_ASSERTION_WAIT   100
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/* SMC IND accessor regs */
5362306a36Sopenharmony_ci#define SMC_IND_INDEX_0                              0x80
5462306a36Sopenharmony_ci#define SMC_IND_DATA_0                               0x81
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define SMC_IND_ACCESS_CNTL                          0x8A
5762306a36Sopenharmony_ci#       define AUTO_INCREMENT_IND_0                  (1 << 0)
5862306a36Sopenharmony_ci#define SMC_MESSAGE_0                                0x8B
5962306a36Sopenharmony_ci#define SMC_RESP_0                                   0x8C
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/* CG IND registers are accessed via SMC indirect space + SMC_CG_IND_START */
6262306a36Sopenharmony_ci#define SMC_CG_IND_START                    0xc0030000
6362306a36Sopenharmony_ci#define SMC_CG_IND_END                      0xc0040000
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define	CG_CGTT_LOCAL_0				0x400
6662306a36Sopenharmony_ci#define	CG_CGTT_LOCAL_1				0x401
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/* SMC IND registers */
6962306a36Sopenharmony_ci#define	SMC_SYSCON_RESET_CNTL				0x80000000
7062306a36Sopenharmony_ci#       define RST_REG                                  (1 << 0)
7162306a36Sopenharmony_ci#define	SMC_SYSCON_CLOCK_CNTL_0				0x80000004
7262306a36Sopenharmony_ci#       define CK_DISABLE                               (1 << 0)
7362306a36Sopenharmony_ci#       define CKEN                                     (1 << 24)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define VGA_HDP_CONTROL  				0xCA
7662306a36Sopenharmony_ci#define		VGA_MEMORY_DISABLE				(1 << 4)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define DCCG_DISP_SLOW_SELECT_REG                       0x13F
7962306a36Sopenharmony_ci#define		DCCG_DISP1_SLOW_SELECT(x)		((x) << 0)
8062306a36Sopenharmony_ci#define		DCCG_DISP1_SLOW_SELECT_MASK		(7 << 0)
8162306a36Sopenharmony_ci#define		DCCG_DISP1_SLOW_SELECT_SHIFT		0
8262306a36Sopenharmony_ci#define		DCCG_DISP2_SLOW_SELECT(x)		((x) << 4)
8362306a36Sopenharmony_ci#define		DCCG_DISP2_SLOW_SELECT_MASK		(7 << 4)
8462306a36Sopenharmony_ci#define		DCCG_DISP2_SLOW_SELECT_SHIFT		4
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL				0x180
8762306a36Sopenharmony_ci#define		SPLL_RESET				(1 << 0)
8862306a36Sopenharmony_ci#define		SPLL_SLEEP				(1 << 1)
8962306a36Sopenharmony_ci#define		SPLL_BYPASS_EN				(1 << 3)
9062306a36Sopenharmony_ci#define		SPLL_REF_DIV(x)				((x) << 4)
9162306a36Sopenharmony_ci#define		SPLL_REF_DIV_MASK			(0x3f << 4)
9262306a36Sopenharmony_ci#define		SPLL_PDIV_A(x)				((x) << 20)
9362306a36Sopenharmony_ci#define		SPLL_PDIV_A_MASK			(0x7f << 20)
9462306a36Sopenharmony_ci#define		SPLL_PDIV_A_SHIFT			20
9562306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL_2				0x181
9662306a36Sopenharmony_ci#define		SCLK_MUX_SEL(x)				((x) << 0)
9762306a36Sopenharmony_ci#define		SCLK_MUX_SEL_MASK			(0x1ff << 0)
9862306a36Sopenharmony_ci#define		SPLL_CTLREQ_CHG				(1 << 23)
9962306a36Sopenharmony_ci#define		SCLK_MUX_UPDATE				(1 << 26)
10062306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL_3				0x182
10162306a36Sopenharmony_ci#define		SPLL_FB_DIV(x)				((x) << 0)
10262306a36Sopenharmony_ci#define		SPLL_FB_DIV_MASK			(0x3ffffff << 0)
10362306a36Sopenharmony_ci#define		SPLL_FB_DIV_SHIFT			0
10462306a36Sopenharmony_ci#define		SPLL_DITHEN				(1 << 28)
10562306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL_4				0x183
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci#define	SPLL_STATUS					0x185
10862306a36Sopenharmony_ci#define		SPLL_CHG_STATUS				(1 << 1)
10962306a36Sopenharmony_ci#define	SPLL_CNTL_MODE					0x186
11062306a36Sopenharmony_ci#define		SPLL_SW_DIR_CONTROL			(1 << 0)
11162306a36Sopenharmony_ci#	define SPLL_REFCLK_SEL(x)			((x) << 26)
11262306a36Sopenharmony_ci#	define SPLL_REFCLK_SEL_MASK			(3 << 26)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci#define	CG_SPLL_SPREAD_SPECTRUM				0x188
11562306a36Sopenharmony_ci#define		SSEN					(1 << 0)
11662306a36Sopenharmony_ci#define		CLK_S(x)				((x) << 4)
11762306a36Sopenharmony_ci#define		CLK_S_MASK				(0xfff << 4)
11862306a36Sopenharmony_ci#define		CLK_S_SHIFT				4
11962306a36Sopenharmony_ci#define	CG_SPLL_SPREAD_SPECTRUM_2			0x189
12062306a36Sopenharmony_ci#define		CLK_V(x)				((x) << 0)
12162306a36Sopenharmony_ci#define		CLK_V_MASK				(0x3ffffff << 0)
12262306a36Sopenharmony_ci#define		CLK_V_SHIFT				0
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define	CG_SPLL_AUTOSCALE_CNTL				0x18b
12562306a36Sopenharmony_ci#       define AUTOSCALE_ON_SS_CLEAR                    (1 << 9)
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/* discrete uvd clocks */
12862306a36Sopenharmony_ci#define	CG_UPLL_FUNC_CNTL				0x18d
12962306a36Sopenharmony_ci#	define UPLL_RESET_MASK				0x00000001
13062306a36Sopenharmony_ci#	define UPLL_SLEEP_MASK				0x00000002
13162306a36Sopenharmony_ci#	define UPLL_BYPASS_EN_MASK			0x00000004
13262306a36Sopenharmony_ci#	define UPLL_CTLREQ_MASK				0x00000008
13362306a36Sopenharmony_ci#	define UPLL_VCO_MODE_MASK			0x00000600
13462306a36Sopenharmony_ci#	define UPLL_REF_DIV_MASK			0x003F0000
13562306a36Sopenharmony_ci#	define UPLL_CTLACK_MASK				0x40000000
13662306a36Sopenharmony_ci#	define UPLL_CTLACK2_MASK			0x80000000
13762306a36Sopenharmony_ci#define	CG_UPLL_FUNC_CNTL_2				0x18e
13862306a36Sopenharmony_ci#	define UPLL_PDIV_A(x)				((x) << 0)
13962306a36Sopenharmony_ci#	define UPLL_PDIV_A_MASK				0x0000007F
14062306a36Sopenharmony_ci#	define UPLL_PDIV_B(x)				((x) << 8)
14162306a36Sopenharmony_ci#	define UPLL_PDIV_B_MASK				0x00007F00
14262306a36Sopenharmony_ci#	define VCLK_SRC_SEL(x)				((x) << 20)
14362306a36Sopenharmony_ci#	define VCLK_SRC_SEL_MASK			0x01F00000
14462306a36Sopenharmony_ci#	define DCLK_SRC_SEL(x)				((x) << 25)
14562306a36Sopenharmony_ci#	define DCLK_SRC_SEL_MASK			0x3E000000
14662306a36Sopenharmony_ci#define	CG_UPLL_FUNC_CNTL_3				0x18f
14762306a36Sopenharmony_ci#	define UPLL_FB_DIV(x)				((x) << 0)
14862306a36Sopenharmony_ci#	define UPLL_FB_DIV_MASK				0x01FFFFFF
14962306a36Sopenharmony_ci#define	CG_UPLL_FUNC_CNTL_4                             0x191
15062306a36Sopenharmony_ci#	define UPLL_SPARE_ISPARE9			0x00020000
15162306a36Sopenharmony_ci#define	CG_UPLL_FUNC_CNTL_5				0x192
15262306a36Sopenharmony_ci#	define RESET_ANTI_MUX_MASK			0x00000200
15362306a36Sopenharmony_ci#define	CG_UPLL_SPREAD_SPECTRUM				0x194
15462306a36Sopenharmony_ci#	define SSEN_MASK				0x00000001
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci#define	MPLL_BYPASSCLK_SEL				0x197
15762306a36Sopenharmony_ci#	define MPLL_CLKOUT_SEL(x)			((x) << 8)
15862306a36Sopenharmony_ci#	define MPLL_CLKOUT_SEL_MASK			0xFF00
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#define CG_CLKPIN_CNTL                                    0x198
16162306a36Sopenharmony_ci#       define XTALIN_DIVIDE                              (1 << 1)
16262306a36Sopenharmony_ci#       define BCLK_AS_XCLK                               (1 << 2)
16362306a36Sopenharmony_ci#define CG_CLKPIN_CNTL_2                                  0x199
16462306a36Sopenharmony_ci#       define FORCE_BIF_REFCLK_EN                        (1 << 3)
16562306a36Sopenharmony_ci#       define MUX_TCLK_TO_XCLK                           (1 << 8)
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define	THM_CLK_CNTL					0x19b
16862306a36Sopenharmony_ci#	define CMON_CLK_SEL(x)				((x) << 0)
16962306a36Sopenharmony_ci#	define CMON_CLK_SEL_MASK			0xFF
17062306a36Sopenharmony_ci#	define TMON_CLK_SEL(x)				((x) << 8)
17162306a36Sopenharmony_ci#	define TMON_CLK_SEL_MASK			0xFF00
17262306a36Sopenharmony_ci#define	MISC_CLK_CNTL					0x19c
17362306a36Sopenharmony_ci#	define DEEP_SLEEP_CLK_SEL(x)			((x) << 0)
17462306a36Sopenharmony_ci#	define DEEP_SLEEP_CLK_SEL_MASK			0xFF
17562306a36Sopenharmony_ci#	define ZCLK_SEL(x)				((x) << 8)
17662306a36Sopenharmony_ci#	define ZCLK_SEL_MASK				0xFF00
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci#define	CG_THERMAL_CTRL					0x1c0
17962306a36Sopenharmony_ci#define 	DPM_EVENT_SRC(x)			((x) << 0)
18062306a36Sopenharmony_ci#define 	DPM_EVENT_SRC_MASK			(7 << 0)
18162306a36Sopenharmony_ci#define		DIG_THERM_DPM(x)			((x) << 14)
18262306a36Sopenharmony_ci#define		DIG_THERM_DPM_MASK			0x003FC000
18362306a36Sopenharmony_ci#define		DIG_THERM_DPM_SHIFT			14
18462306a36Sopenharmony_ci#define	CG_THERMAL_STATUS				0x1c1
18562306a36Sopenharmony_ci#define		FDO_PWM_DUTY(x)				((x) << 9)
18662306a36Sopenharmony_ci#define		FDO_PWM_DUTY_MASK			(0xff << 9)
18762306a36Sopenharmony_ci#define		FDO_PWM_DUTY_SHIFT			9
18862306a36Sopenharmony_ci#define	CG_THERMAL_INT					0x1c2
18962306a36Sopenharmony_ci#define		DIG_THERM_INTH(x)			((x) << 8)
19062306a36Sopenharmony_ci#define		DIG_THERM_INTH_MASK			0x0000FF00
19162306a36Sopenharmony_ci#define		DIG_THERM_INTH_SHIFT			8
19262306a36Sopenharmony_ci#define		DIG_THERM_INTL(x)			((x) << 16)
19362306a36Sopenharmony_ci#define		DIG_THERM_INTL_MASK			0x00FF0000
19462306a36Sopenharmony_ci#define		DIG_THERM_INTL_SHIFT			16
19562306a36Sopenharmony_ci#define 	THERM_INT_MASK_HIGH			(1 << 24)
19662306a36Sopenharmony_ci#define 	THERM_INT_MASK_LOW			(1 << 25)
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci#define	CG_MULT_THERMAL_CTRL					0x1c4
19962306a36Sopenharmony_ci#define		TEMP_SEL(x)					((x) << 20)
20062306a36Sopenharmony_ci#define		TEMP_SEL_MASK					(0xff << 20)
20162306a36Sopenharmony_ci#define		TEMP_SEL_SHIFT					20
20262306a36Sopenharmony_ci#define	CG_MULT_THERMAL_STATUS					0x1c5
20362306a36Sopenharmony_ci#define		ASIC_MAX_TEMP(x)				((x) << 0)
20462306a36Sopenharmony_ci#define		ASIC_MAX_TEMP_MASK				0x000001ff
20562306a36Sopenharmony_ci#define		ASIC_MAX_TEMP_SHIFT				0
20662306a36Sopenharmony_ci#define		CTF_TEMP(x)					((x) << 9)
20762306a36Sopenharmony_ci#define		CTF_TEMP_MASK					0x0003fe00
20862306a36Sopenharmony_ci#define		CTF_TEMP_SHIFT					9
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci#define	CG_FDO_CTRL0					0x1d5
21162306a36Sopenharmony_ci#define		FDO_STATIC_DUTY(x)			((x) << 0)
21262306a36Sopenharmony_ci#define		FDO_STATIC_DUTY_MASK			0x000000FF
21362306a36Sopenharmony_ci#define		FDO_STATIC_DUTY_SHIFT			0
21462306a36Sopenharmony_ci#define	CG_FDO_CTRL1					0x1d6
21562306a36Sopenharmony_ci#define		FMAX_DUTY100(x)				((x) << 0)
21662306a36Sopenharmony_ci#define		FMAX_DUTY100_MASK			0x000000FF
21762306a36Sopenharmony_ci#define		FMAX_DUTY100_SHIFT			0
21862306a36Sopenharmony_ci#define	CG_FDO_CTRL2					0x1d7
21962306a36Sopenharmony_ci#define		TMIN(x)					((x) << 0)
22062306a36Sopenharmony_ci#define		TMIN_MASK				0x000000FF
22162306a36Sopenharmony_ci#define		TMIN_SHIFT				0
22262306a36Sopenharmony_ci#define		FDO_PWM_MODE(x)				((x) << 11)
22362306a36Sopenharmony_ci#define		FDO_PWM_MODE_MASK			(7 << 11)
22462306a36Sopenharmony_ci#define		FDO_PWM_MODE_SHIFT			11
22562306a36Sopenharmony_ci#define		TACH_PWM_RESP_RATE(x)			((x) << 25)
22662306a36Sopenharmony_ci#define		TACH_PWM_RESP_RATE_MASK			(0x7f << 25)
22762306a36Sopenharmony_ci#define		TACH_PWM_RESP_RATE_SHIFT		25
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci#define CG_TACH_CTRL                                    0x1dc
23062306a36Sopenharmony_ci#       define EDGE_PER_REV(x)                          ((x) << 0)
23162306a36Sopenharmony_ci#       define EDGE_PER_REV_MASK                        (0x7 << 0)
23262306a36Sopenharmony_ci#       define EDGE_PER_REV_SHIFT                       0
23362306a36Sopenharmony_ci#       define TARGET_PERIOD(x)                         ((x) << 3)
23462306a36Sopenharmony_ci#       define TARGET_PERIOD_MASK                       0xfffffff8
23562306a36Sopenharmony_ci#       define TARGET_PERIOD_SHIFT                      3
23662306a36Sopenharmony_ci#define CG_TACH_STATUS                                  0x1dd
23762306a36Sopenharmony_ci#       define TACH_PERIOD(x)                           ((x) << 0)
23862306a36Sopenharmony_ci#       define TACH_PERIOD_MASK                         0xffffffff
23962306a36Sopenharmony_ci#       define TACH_PERIOD_SHIFT                        0
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci#define GENERAL_PWRMGT                                  0x1e0
24262306a36Sopenharmony_ci#       define GLOBAL_PWRMGT_EN                         (1 << 0)
24362306a36Sopenharmony_ci#       define STATIC_PM_EN                             (1 << 1)
24462306a36Sopenharmony_ci#       define THERMAL_PROTECTION_DIS                   (1 << 2)
24562306a36Sopenharmony_ci#       define THERMAL_PROTECTION_TYPE                  (1 << 3)
24662306a36Sopenharmony_ci#       define SW_SMIO_INDEX(x)                         ((x) << 6)
24762306a36Sopenharmony_ci#       define SW_SMIO_INDEX_MASK                       (1 << 6)
24862306a36Sopenharmony_ci#       define SW_SMIO_INDEX_SHIFT                      6
24962306a36Sopenharmony_ci#       define VOLT_PWRMGT_EN                           (1 << 10)
25062306a36Sopenharmony_ci#       define DYN_SPREAD_SPECTRUM_EN                   (1 << 23)
25162306a36Sopenharmony_ci#define CG_TPC                                            0x1e1
25262306a36Sopenharmony_ci#define SCLK_PWRMGT_CNTL                                  0x1e2
25362306a36Sopenharmony_ci#       define SCLK_PWRMGT_OFF                            (1 << 0)
25462306a36Sopenharmony_ci#       define SCLK_LOW_D1                                (1 << 1)
25562306a36Sopenharmony_ci#       define FIR_RESET                                  (1 << 4)
25662306a36Sopenharmony_ci#       define FIR_FORCE_TREND_SEL                        (1 << 5)
25762306a36Sopenharmony_ci#       define FIR_TREND_MODE                             (1 << 6)
25862306a36Sopenharmony_ci#       define DYN_GFX_CLK_OFF_EN                         (1 << 7)
25962306a36Sopenharmony_ci#       define GFX_CLK_FORCE_ON                           (1 << 8)
26062306a36Sopenharmony_ci#       define GFX_CLK_REQUEST_OFF                        (1 << 9)
26162306a36Sopenharmony_ci#       define GFX_CLK_FORCE_OFF                          (1 << 10)
26262306a36Sopenharmony_ci#       define GFX_CLK_OFF_ACPI_D1                        (1 << 11)
26362306a36Sopenharmony_ci#       define GFX_CLK_OFF_ACPI_D2                        (1 << 12)
26462306a36Sopenharmony_ci#       define GFX_CLK_OFF_ACPI_D3                        (1 << 13)
26562306a36Sopenharmony_ci#       define DYN_LIGHT_SLEEP_EN                         (1 << 14)
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX                  0x1e6
26862306a36Sopenharmony_ci#       define CURRENT_STATE_INDEX_MASK                   (0xf << 4)
26962306a36Sopenharmony_ci#       define CURRENT_STATE_INDEX_SHIFT                  4
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci#define CG_FTV                                            0x1ef
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci#define CG_FFCT_0                                         0x1f0
27462306a36Sopenharmony_ci#       define UTC_0(x)                                   ((x) << 0)
27562306a36Sopenharmony_ci#       define UTC_0_MASK                                 (0x3ff << 0)
27662306a36Sopenharmony_ci#       define DTC_0(x)                                   ((x) << 10)
27762306a36Sopenharmony_ci#       define DTC_0_MASK                                 (0x3ff << 10)
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci#define CG_BSP                                          0x1ff
28062306a36Sopenharmony_ci#       define BSP(x)					((x) << 0)
28162306a36Sopenharmony_ci#       define BSP_MASK					(0xffff << 0)
28262306a36Sopenharmony_ci#       define BSU(x)					((x) << 16)
28362306a36Sopenharmony_ci#       define BSU_MASK					(0xf << 16)
28462306a36Sopenharmony_ci#define CG_AT                                           0x200
28562306a36Sopenharmony_ci#       define CG_R(x)					((x) << 0)
28662306a36Sopenharmony_ci#       define CG_R_MASK				(0xffff << 0)
28762306a36Sopenharmony_ci#       define CG_L(x)					((x) << 16)
28862306a36Sopenharmony_ci#       define CG_L_MASK				(0xffff << 16)
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci#define CG_GIT                                          0x201
29162306a36Sopenharmony_ci#       define CG_GICST(x)                              ((x) << 0)
29262306a36Sopenharmony_ci#       define CG_GICST_MASK                            (0xffff << 0)
29362306a36Sopenharmony_ci#       define CG_GIPOT(x)                              ((x) << 16)
29462306a36Sopenharmony_ci#       define CG_GIPOT_MASK                            (0xffff << 16)
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci#define CG_SSP                                            0x203
29762306a36Sopenharmony_ci#       define SST(x)                                     ((x) << 0)
29862306a36Sopenharmony_ci#       define SST_MASK                                   (0xffff << 0)
29962306a36Sopenharmony_ci#       define SSTU(x)                                    ((x) << 16)
30062306a36Sopenharmony_ci#       define SSTU_MASK                                  (0xf << 16)
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci#define CG_DISPLAY_GAP_CNTL                               0x20a
30362306a36Sopenharmony_ci#       define DISP1_GAP(x)                               ((x) << 0)
30462306a36Sopenharmony_ci#       define DISP1_GAP_MASK                             (3 << 0)
30562306a36Sopenharmony_ci#       define DISP2_GAP(x)                               ((x) << 2)
30662306a36Sopenharmony_ci#       define DISP2_GAP_MASK                             (3 << 2)
30762306a36Sopenharmony_ci#       define VBI_TIMER_COUNT(x)                         ((x) << 4)
30862306a36Sopenharmony_ci#       define VBI_TIMER_COUNT_MASK                       (0x3fff << 4)
30962306a36Sopenharmony_ci#       define VBI_TIMER_UNIT(x)                          ((x) << 20)
31062306a36Sopenharmony_ci#       define VBI_TIMER_UNIT_MASK                        (7 << 20)
31162306a36Sopenharmony_ci#       define DISP1_GAP_MCHG(x)                          ((x) << 24)
31262306a36Sopenharmony_ci#       define DISP1_GAP_MCHG_MASK                        (3 << 24)
31362306a36Sopenharmony_ci#       define DISP2_GAP_MCHG(x)                          ((x) << 26)
31462306a36Sopenharmony_ci#       define DISP2_GAP_MCHG_MASK                        (3 << 26)
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci#define	CG_ULV_CONTROL					0x21e
31762306a36Sopenharmony_ci#define	CG_ULV_PARAMETER				0x21f
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci#define	SMC_SCRATCH0					0x221
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci#define	CG_CAC_CTRL					0x22e
32262306a36Sopenharmony_ci#	define CAC_WINDOW(x)				((x) << 0)
32362306a36Sopenharmony_ci#	define CAC_WINDOW_MASK				0x00ffffff
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci#define DMIF_ADDR_CONFIG  				0x2F5
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci#define DMIF_ADDR_CALC  				0x300
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci#define	PIPE0_DMIF_BUFFER_CONTROL			  0x0328
33062306a36Sopenharmony_ci#       define DMIF_BUFFERS_ALLOCATED(x)                  ((x) << 0)
33162306a36Sopenharmony_ci#       define DMIF_BUFFERS_ALLOCATED_COMPLETED           (1 << 4)
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci#define	SRBM_STATUS				        0x394
33462306a36Sopenharmony_ci#define		GRBM_RQ_PENDING 			(1 << 5)
33562306a36Sopenharmony_ci#define		VMC_BUSY 				(1 << 8)
33662306a36Sopenharmony_ci#define		MCB_BUSY 				(1 << 9)
33762306a36Sopenharmony_ci#define		MCB_NON_DISPLAY_BUSY 			(1 << 10)
33862306a36Sopenharmony_ci#define		MCC_BUSY 				(1 << 11)
33962306a36Sopenharmony_ci#define		MCD_BUSY 				(1 << 12)
34062306a36Sopenharmony_ci#define		SEM_BUSY 				(1 << 14)
34162306a36Sopenharmony_ci#define		IH_BUSY 				(1 << 17)
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci#define	SRBM_SOFT_RESET				        0x398
34462306a36Sopenharmony_ci#define		SOFT_RESET_BIF				(1 << 1)
34562306a36Sopenharmony_ci#define		SOFT_RESET_DC				(1 << 5)
34662306a36Sopenharmony_ci#define		SOFT_RESET_DMA1				(1 << 6)
34762306a36Sopenharmony_ci#define		SOFT_RESET_GRBM				(1 << 8)
34862306a36Sopenharmony_ci#define		SOFT_RESET_HDP				(1 << 9)
34962306a36Sopenharmony_ci#define		SOFT_RESET_IH				(1 << 10)
35062306a36Sopenharmony_ci#define		SOFT_RESET_MC				(1 << 11)
35162306a36Sopenharmony_ci#define		SOFT_RESET_ROM				(1 << 14)
35262306a36Sopenharmony_ci#define		SOFT_RESET_SEM				(1 << 15)
35362306a36Sopenharmony_ci#define		SOFT_RESET_VMC				(1 << 17)
35462306a36Sopenharmony_ci#define		SOFT_RESET_DMA				(1 << 20)
35562306a36Sopenharmony_ci#define		SOFT_RESET_TST				(1 << 21)
35662306a36Sopenharmony_ci#define		SOFT_RESET_REGBB			(1 << 22)
35762306a36Sopenharmony_ci#define		SOFT_RESET_ORB				(1 << 23)
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci#define	CC_SYS_RB_BACKEND_DISABLE			0x3A0
36062306a36Sopenharmony_ci#define	GC_USER_SYS_RB_BACKEND_DISABLE			0x3A1
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci#define SRBM_READ_ERROR					0x3A6
36362306a36Sopenharmony_ci#define SRBM_INT_CNTL					0x3A8
36462306a36Sopenharmony_ci#define SRBM_INT_ACK					0x3AA
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ci#define	SRBM_STATUS2				        0x3B1
36762306a36Sopenharmony_ci#define		DMA_BUSY 				(1 << 5)
36862306a36Sopenharmony_ci#define		DMA1_BUSY 				(1 << 6)
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci#define VM_L2_CNTL					0x500
37162306a36Sopenharmony_ci#define		ENABLE_L2_CACHE					(1 << 0)
37262306a36Sopenharmony_ci#define		ENABLE_L2_FRAGMENT_PROCESSING			(1 << 1)
37362306a36Sopenharmony_ci#define		L2_CACHE_PTE_ENDIAN_SWAP_MODE(x)		((x) << 2)
37462306a36Sopenharmony_ci#define		L2_CACHE_PDE_ENDIAN_SWAP_MODE(x)		((x) << 4)
37562306a36Sopenharmony_ci#define		ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE		(1 << 9)
37662306a36Sopenharmony_ci#define		ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE	(1 << 10)
37762306a36Sopenharmony_ci#define		EFFECTIVE_L2_QUEUE_SIZE(x)			(((x) & 7) << 15)
37862306a36Sopenharmony_ci#define		CONTEXT1_IDENTITY_ACCESS_MODE(x)		(((x) & 3) << 19)
37962306a36Sopenharmony_ci#define VM_L2_CNTL2					0x501
38062306a36Sopenharmony_ci#define		INVALIDATE_ALL_L1_TLBS				(1 << 0)
38162306a36Sopenharmony_ci#define		INVALIDATE_L2_CACHE				(1 << 1)
38262306a36Sopenharmony_ci#define		INVALIDATE_CACHE_MODE(x)			((x) << 26)
38362306a36Sopenharmony_ci#define			INVALIDATE_PTE_AND_PDE_CACHES		0
38462306a36Sopenharmony_ci#define			INVALIDATE_ONLY_PTE_CACHES		1
38562306a36Sopenharmony_ci#define			INVALIDATE_ONLY_PDE_CACHES		2
38662306a36Sopenharmony_ci#define VM_L2_CNTL3					0x502
38762306a36Sopenharmony_ci#define		BANK_SELECT(x)					((x) << 0)
38862306a36Sopenharmony_ci#define		L2_CACHE_UPDATE_MODE(x)				((x) << 6)
38962306a36Sopenharmony_ci#define		L2_CACHE_BIGK_FRAGMENT_SIZE(x)			((x) << 15)
39062306a36Sopenharmony_ci#define		L2_CACHE_BIGK_ASSOCIATIVITY			(1 << 20)
39162306a36Sopenharmony_ci#define	VM_L2_STATUS					0x503
39262306a36Sopenharmony_ci#define		L2_BUSY						(1 << 0)
39362306a36Sopenharmony_ci#define VM_CONTEXT0_CNTL				0x504
39462306a36Sopenharmony_ci#define		ENABLE_CONTEXT					(1 << 0)
39562306a36Sopenharmony_ci#define		PAGE_TABLE_DEPTH(x)				(((x) & 3) << 1)
39662306a36Sopenharmony_ci#define		RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 3)
39762306a36Sopenharmony_ci#define		RANGE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 4)
39862306a36Sopenharmony_ci#define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT	(1 << 6)
39962306a36Sopenharmony_ci#define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT	(1 << 7)
40062306a36Sopenharmony_ci#define		PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 9)
40162306a36Sopenharmony_ci#define		PDE0_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 10)
40262306a36Sopenharmony_ci#define		VALID_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 12)
40362306a36Sopenharmony_ci#define		VALID_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 13)
40462306a36Sopenharmony_ci#define		READ_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 15)
40562306a36Sopenharmony_ci#define		READ_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 16)
40662306a36Sopenharmony_ci#define		WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 18)
40762306a36Sopenharmony_ci#define		WRITE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 19)
40862306a36Sopenharmony_ci#define		PAGE_TABLE_BLOCK_SIZE(x)			(((x) & 0xF) << 24)
40962306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL				0x505
41062306a36Sopenharmony_ci#define VM_CONTEXT0_CNTL2				0x50C
41162306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL2				0x50D
41262306a36Sopenharmony_ci#define	VM_CONTEXT8_PAGE_TABLE_BASE_ADDR		0x50E
41362306a36Sopenharmony_ci#define	VM_CONTEXT9_PAGE_TABLE_BASE_ADDR		0x50F
41462306a36Sopenharmony_ci#define	VM_CONTEXT10_PAGE_TABLE_BASE_ADDR		0x510
41562306a36Sopenharmony_ci#define	VM_CONTEXT11_PAGE_TABLE_BASE_ADDR		0x511
41662306a36Sopenharmony_ci#define	VM_CONTEXT12_PAGE_TABLE_BASE_ADDR		0x512
41762306a36Sopenharmony_ci#define	VM_CONTEXT13_PAGE_TABLE_BASE_ADDR		0x513
41862306a36Sopenharmony_ci#define	VM_CONTEXT14_PAGE_TABLE_BASE_ADDR		0x514
41962306a36Sopenharmony_ci#define	VM_CONTEXT15_PAGE_TABLE_BASE_ADDR		0x515
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci#define	VM_CONTEXT1_PROTECTION_FAULT_ADDR		0x53f
42262306a36Sopenharmony_ci#define	VM_CONTEXT1_PROTECTION_FAULT_STATUS		0x537
42362306a36Sopenharmony_ci#define		PROTECTIONS_MASK			(0xf << 0)
42462306a36Sopenharmony_ci#define		PROTECTIONS_SHIFT			0
42562306a36Sopenharmony_ci		/* bit 0: range
42662306a36Sopenharmony_ci		 * bit 1: pde0
42762306a36Sopenharmony_ci		 * bit 2: valid
42862306a36Sopenharmony_ci		 * bit 3: read
42962306a36Sopenharmony_ci		 * bit 4: write
43062306a36Sopenharmony_ci		 */
43162306a36Sopenharmony_ci#define		MEMORY_CLIENT_ID_MASK			(0xff << 12)
43262306a36Sopenharmony_ci#define		MEMORY_CLIENT_ID_SHIFT			12
43362306a36Sopenharmony_ci#define		MEMORY_CLIENT_RW_MASK			(1 << 24)
43462306a36Sopenharmony_ci#define		MEMORY_CLIENT_RW_SHIFT			24
43562306a36Sopenharmony_ci#define		FAULT_VMID_MASK				(0xf << 25)
43662306a36Sopenharmony_ci#define		FAULT_VMID_SHIFT			25
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci#define VM_INVALIDATE_REQUEST				0x51E
43962306a36Sopenharmony_ci#define VM_INVALIDATE_RESPONSE				0x51F
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci#define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR	0x546
44262306a36Sopenharmony_ci#define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR	0x547
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ci#define	VM_CONTEXT0_PAGE_TABLE_BASE_ADDR		0x54F
44562306a36Sopenharmony_ci#define	VM_CONTEXT1_PAGE_TABLE_BASE_ADDR		0x550
44662306a36Sopenharmony_ci#define	VM_CONTEXT2_PAGE_TABLE_BASE_ADDR		0x551
44762306a36Sopenharmony_ci#define	VM_CONTEXT3_PAGE_TABLE_BASE_ADDR		0x552
44862306a36Sopenharmony_ci#define	VM_CONTEXT4_PAGE_TABLE_BASE_ADDR		0x553
44962306a36Sopenharmony_ci#define	VM_CONTEXT5_PAGE_TABLE_BASE_ADDR		0x554
45062306a36Sopenharmony_ci#define	VM_CONTEXT6_PAGE_TABLE_BASE_ADDR		0x555
45162306a36Sopenharmony_ci#define	VM_CONTEXT7_PAGE_TABLE_BASE_ADDR		0x556
45262306a36Sopenharmony_ci#define	VM_CONTEXT0_PAGE_TABLE_START_ADDR		0x557
45362306a36Sopenharmony_ci#define	VM_CONTEXT1_PAGE_TABLE_START_ADDR		0x558
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_ci#define	VM_CONTEXT0_PAGE_TABLE_END_ADDR			0x55F
45662306a36Sopenharmony_ci#define	VM_CONTEXT1_PAGE_TABLE_END_ADDR			0x560
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ci#define VM_L2_CG           				0x570
45962306a36Sopenharmony_ci#define		MC_CG_ENABLE				(1 << 18)
46062306a36Sopenharmony_ci#define		MC_LS_ENABLE				(1 << 19)
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci#define MC_SHARED_CHMAP						0x801
46362306a36Sopenharmony_ci#define		NOOFCHAN_SHIFT					12
46462306a36Sopenharmony_ci#define		NOOFCHAN_MASK					0x0000f000
46562306a36Sopenharmony_ci#define MC_SHARED_CHREMAP					0x802
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci#define	MC_VM_FB_LOCATION				0x809
46862306a36Sopenharmony_ci#define	MC_VM_AGP_TOP					0x80A
46962306a36Sopenharmony_ci#define	MC_VM_AGP_BOT					0x80B
47062306a36Sopenharmony_ci#define	MC_VM_AGP_BASE					0x80C
47162306a36Sopenharmony_ci#define	MC_VM_SYSTEM_APERTURE_LOW_ADDR			0x80D
47262306a36Sopenharmony_ci#define	MC_VM_SYSTEM_APERTURE_HIGH_ADDR			0x80E
47362306a36Sopenharmony_ci#define	MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR		0x80F
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci#define	MC_VM_MX_L1_TLB_CNTL				0x819
47662306a36Sopenharmony_ci#define		ENABLE_L1_TLB					(1 << 0)
47762306a36Sopenharmony_ci#define		ENABLE_L1_FRAGMENT_PROCESSING			(1 << 1)
47862306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_PA_ONLY			(0 << 3)
47962306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_USE_SYS_MAP			(1 << 3)
48062306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_IN_SYS			(2 << 3)
48162306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_NOT_IN_SYS			(3 << 3)
48262306a36Sopenharmony_ci#define		SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU	(0 << 5)
48362306a36Sopenharmony_ci#define		ENABLE_ADVANCED_DRIVER_MODEL			(1 << 6)
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci#define MC_SHARED_BLACKOUT_CNTL           		0x82B
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci#define MC_HUB_MISC_HUB_CG           			0x82E
48862306a36Sopenharmony_ci#define MC_HUB_MISC_VM_CG           			0x82F
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci#define MC_HUB_MISC_SIP_CG           			0x830
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci#define MC_XPB_CLK_GAT           			0x91E
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci#define MC_CITF_MISC_RD_CG           			0x992
49562306a36Sopenharmony_ci#define MC_CITF_MISC_WR_CG           			0x993
49662306a36Sopenharmony_ci#define MC_CITF_MISC_VM_CG           			0x994
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci#define	MC_ARB_RAMCFG					0x9D8
49962306a36Sopenharmony_ci#define		NOOFBANK_SHIFT					0
50062306a36Sopenharmony_ci#define		NOOFBANK_MASK					0x00000003
50162306a36Sopenharmony_ci#define		NOOFRANK_SHIFT					2
50262306a36Sopenharmony_ci#define		NOOFRANK_MASK					0x00000004
50362306a36Sopenharmony_ci#define		NOOFROWS_SHIFT					3
50462306a36Sopenharmony_ci#define		NOOFROWS_MASK					0x00000038
50562306a36Sopenharmony_ci#define		NOOFCOLS_SHIFT					6
50662306a36Sopenharmony_ci#define		NOOFCOLS_MASK					0x000000C0
50762306a36Sopenharmony_ci#define		CHANSIZE_SHIFT					8
50862306a36Sopenharmony_ci#define		CHANSIZE_MASK					0x00000100
50962306a36Sopenharmony_ci#define		CHANSIZE_OVERRIDE				(1 << 11)
51062306a36Sopenharmony_ci#define		NOOFGROUPS_SHIFT				12
51162306a36Sopenharmony_ci#define		NOOFGROUPS_MASK					0x00001000
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_ci#define	MC_ARB_DRAM_TIMING				0x9DD
51462306a36Sopenharmony_ci#define	MC_ARB_DRAM_TIMING2				0x9DE
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci#define MC_ARB_BURST_TIME                               0xA02
51762306a36Sopenharmony_ci#define		STATE0(x)				((x) << 0)
51862306a36Sopenharmony_ci#define		STATE0_MASK				(0x1f << 0)
51962306a36Sopenharmony_ci#define		STATE0_SHIFT				0
52062306a36Sopenharmony_ci#define		STATE1(x)				((x) << 5)
52162306a36Sopenharmony_ci#define		STATE1_MASK				(0x1f << 5)
52262306a36Sopenharmony_ci#define		STATE1_SHIFT				5
52362306a36Sopenharmony_ci#define		STATE2(x)				((x) << 10)
52462306a36Sopenharmony_ci#define		STATE2_MASK				(0x1f << 10)
52562306a36Sopenharmony_ci#define		STATE2_SHIFT				10
52662306a36Sopenharmony_ci#define		STATE3(x)				((x) << 15)
52762306a36Sopenharmony_ci#define		STATE3_MASK				(0x1f << 15)
52862306a36Sopenharmony_ci#define		STATE3_SHIFT				15
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci#define	MC_SEQ_TRAIN_WAKEUP_CNTL			0xA3A
53162306a36Sopenharmony_ci#define		TRAIN_DONE_D0      			(1 << 30)
53262306a36Sopenharmony_ci#define		TRAIN_DONE_D1      			(1 << 31)
53362306a36Sopenharmony_ci
53462306a36Sopenharmony_ci#define MC_SEQ_SUP_CNTL           			0xA32
53562306a36Sopenharmony_ci#define		RUN_MASK      				(1 << 0)
53662306a36Sopenharmony_ci#define MC_SEQ_SUP_PGM           			0xA33
53762306a36Sopenharmony_ci#define MC_PMG_AUTO_CMD           			0xA34
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci#define MC_IO_PAD_CNTL_D0           			0xA74
54062306a36Sopenharmony_ci#define		MEM_FALL_OUT_CMD      			(1 << 8)
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_ci#define MC_SEQ_RAS_TIMING                               0xA28
54362306a36Sopenharmony_ci#define MC_SEQ_CAS_TIMING                               0xA29
54462306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING                              0xA2A
54562306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING2                             0xA2B
54662306a36Sopenharmony_ci#define MC_SEQ_PMG_TIMING                               0xA2C
54762306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D0                                0xA2D
54862306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D1                                0xA2E
54962306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D0                                0xA2F
55062306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D1                                0xA30
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_ci#define MC_SEQ_MISC0           				0xA80
55362306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_VEN_ID_SHIFT               8
55462306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_VEN_ID_MASK                0x00000f00
55562306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_VEN_ID_VALUE               3
55662306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_REV_ID_SHIFT               12
55762306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_REV_ID_MASK                0x0000f000
55862306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_REV_ID_VALUE               1
55962306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_GDDR5_SHIFT                28
56062306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_GDDR5_MASK                 0xf0000000
56162306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_GDDR5_VALUE                5
56262306a36Sopenharmony_ci#define MC_SEQ_MISC1                                    0xA81
56362306a36Sopenharmony_ci#define MC_SEQ_RESERVE_M                                0xA82
56462306a36Sopenharmony_ci#define MC_PMG_CMD_EMRS                                 0xA83
56562306a36Sopenharmony_ci
56662306a36Sopenharmony_ci#define MC_SEQ_IO_DEBUG_INDEX           		0xA91
56762306a36Sopenharmony_ci#define MC_SEQ_IO_DEBUG_DATA           			0xA92
56862306a36Sopenharmony_ci
56962306a36Sopenharmony_ci#define MC_SEQ_MISC5                                    0xA95
57062306a36Sopenharmony_ci#define MC_SEQ_MISC6                                    0xA96
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci#define MC_SEQ_MISC7                                    0xA99
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci#define MC_SEQ_RAS_TIMING_LP                            0xA9B
57562306a36Sopenharmony_ci#define MC_SEQ_CAS_TIMING_LP                            0xA9C
57662306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING_LP                           0xA9D
57762306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING2_LP                          0xA9E
57862306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D0_LP                             0xA9F
57962306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D1_LP                             0xAA0
58062306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_EMRS_LP                          0xAA1
58162306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS_LP                           0xAA2
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci#define MC_PMG_CMD_MRS                                  0xAAB
58462306a36Sopenharmony_ci
58562306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D0_LP                             0xAC7
58662306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D1_LP                             0xAC8
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci#define MC_PMG_CMD_MRS1                                 0xAD1
58962306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS1_LP                          0xAD2
59062306a36Sopenharmony_ci#define MC_SEQ_PMG_TIMING_LP                            0xAD3
59162306a36Sopenharmony_ci
59262306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_2                                 0xAD5
59362306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_2_LP                              0xAD6
59462306a36Sopenharmony_ci#define MC_PMG_CMD_MRS2                                 0xAD7
59562306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS2_LP                          0xAD8
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_ci#define	MCLK_PWRMGT_CNTL				0xAE8
59862306a36Sopenharmony_ci#       define DLL_SPEED(x)				((x) << 0)
59962306a36Sopenharmony_ci#       define DLL_SPEED_MASK				(0x1f << 0)
60062306a36Sopenharmony_ci#       define DLL_READY                                (1 << 6)
60162306a36Sopenharmony_ci#       define MC_INT_CNTL                              (1 << 7)
60262306a36Sopenharmony_ci#       define MRDCK0_PDNB                              (1 << 8)
60362306a36Sopenharmony_ci#       define MRDCK1_PDNB                              (1 << 9)
60462306a36Sopenharmony_ci#       define MRDCK0_RESET                             (1 << 16)
60562306a36Sopenharmony_ci#       define MRDCK1_RESET                             (1 << 17)
60662306a36Sopenharmony_ci#       define DLL_READY_READ                           (1 << 24)
60762306a36Sopenharmony_ci#define	DLL_CNTL					0xAE9
60862306a36Sopenharmony_ci#       define MRDCK0_BYPASS                            (1 << 24)
60962306a36Sopenharmony_ci#       define MRDCK1_BYPASS                            (1 << 25)
61062306a36Sopenharmony_ci
61162306a36Sopenharmony_ci#define	MPLL_CNTL_MODE					0xAEC
61262306a36Sopenharmony_ci#       define MPLL_MCLK_SEL                            (1 << 11)
61362306a36Sopenharmony_ci#define	MPLL_FUNC_CNTL					0xAED
61462306a36Sopenharmony_ci#define		BWCTRL(x)				((x) << 20)
61562306a36Sopenharmony_ci#define		BWCTRL_MASK				(0xff << 20)
61662306a36Sopenharmony_ci#define	MPLL_FUNC_CNTL_1				0xAEE
61762306a36Sopenharmony_ci#define		VCO_MODE(x)				((x) << 0)
61862306a36Sopenharmony_ci#define		VCO_MODE_MASK				(3 << 0)
61962306a36Sopenharmony_ci#define		CLKFRAC(x)				((x) << 4)
62062306a36Sopenharmony_ci#define		CLKFRAC_MASK				(0xfff << 4)
62162306a36Sopenharmony_ci#define		CLKF(x)					((x) << 16)
62262306a36Sopenharmony_ci#define		CLKF_MASK				(0xfff << 16)
62362306a36Sopenharmony_ci#define	MPLL_FUNC_CNTL_2				0xAEF
62462306a36Sopenharmony_ci#define	MPLL_AD_FUNC_CNTL				0xAF0
62562306a36Sopenharmony_ci#define		YCLK_POST_DIV(x)			((x) << 0)
62662306a36Sopenharmony_ci#define		YCLK_POST_DIV_MASK			(7 << 0)
62762306a36Sopenharmony_ci#define	MPLL_DQ_FUNC_CNTL				0xAF1
62862306a36Sopenharmony_ci#define		YCLK_SEL(x)				((x) << 4)
62962306a36Sopenharmony_ci#define		YCLK_SEL_MASK				(1 << 4)
63062306a36Sopenharmony_ci
63162306a36Sopenharmony_ci#define	MPLL_SS1					0xAF3
63262306a36Sopenharmony_ci#define		CLKV(x)					((x) << 0)
63362306a36Sopenharmony_ci#define		CLKV_MASK				(0x3ffffff << 0)
63462306a36Sopenharmony_ci#define	MPLL_SS2					0xAF4
63562306a36Sopenharmony_ci#define		CLKS(x)					((x) << 0)
63662306a36Sopenharmony_ci#define		CLKS_MASK				(0xfff << 0)
63762306a36Sopenharmony_ci
63862306a36Sopenharmony_ci#define	HDP_HOST_PATH_CNTL				0xB00
63962306a36Sopenharmony_ci#define 	CLOCK_GATING_DIS			(1 << 23)
64062306a36Sopenharmony_ci#define	HDP_NONSURFACE_BASE				0xB01
64162306a36Sopenharmony_ci#define	HDP_NONSURFACE_INFO				0xB02
64262306a36Sopenharmony_ci#define	HDP_NONSURFACE_SIZE				0xB03
64362306a36Sopenharmony_ci
64462306a36Sopenharmony_ci#define HDP_DEBUG0  					0xBCC
64562306a36Sopenharmony_ci
64662306a36Sopenharmony_ci#define HDP_ADDR_CONFIG  				0xBD2
64762306a36Sopenharmony_ci#define HDP_MISC_CNTL					0xBD3
64862306a36Sopenharmony_ci#define 	HDP_FLUSH_INVALIDATE_CACHE			(1 << 0)
64962306a36Sopenharmony_ci#define HDP_MEM_POWER_LS				0xBD4
65062306a36Sopenharmony_ci#define 	HDP_LS_ENABLE				(1 << 0)
65162306a36Sopenharmony_ci
65262306a36Sopenharmony_ci#define ATC_MISC_CG           				0xCD4
65362306a36Sopenharmony_ci
65462306a36Sopenharmony_ci#define IH_RB_CNTL                                        0xF80
65562306a36Sopenharmony_ci#       define IH_RB_ENABLE                               (1 << 0)
65662306a36Sopenharmony_ci#       define IH_IB_SIZE(x)                              ((x) << 1) /* log2 */
65762306a36Sopenharmony_ci#       define IH_RB_FULL_DRAIN_ENABLE                    (1 << 6)
65862306a36Sopenharmony_ci#       define IH_WPTR_WRITEBACK_ENABLE                   (1 << 8)
65962306a36Sopenharmony_ci#       define IH_WPTR_WRITEBACK_TIMER(x)                 ((x) << 9) /* log2 */
66062306a36Sopenharmony_ci#       define IH_WPTR_OVERFLOW_ENABLE                    (1 << 16)
66162306a36Sopenharmony_ci#       define IH_WPTR_OVERFLOW_CLEAR                     (1 << 31)
66262306a36Sopenharmony_ci#define IH_RB_BASE                                        0xF81
66362306a36Sopenharmony_ci#define IH_RB_RPTR                                        0xF82
66462306a36Sopenharmony_ci#define IH_RB_WPTR                                        0xF83
66562306a36Sopenharmony_ci#       define RB_OVERFLOW                                (1 << 0)
66662306a36Sopenharmony_ci#       define WPTR_OFFSET_MASK                           0x3fffc
66762306a36Sopenharmony_ci#define IH_RB_WPTR_ADDR_HI                                0xF84
66862306a36Sopenharmony_ci#define IH_RB_WPTR_ADDR_LO                                0xF85
66962306a36Sopenharmony_ci#define IH_CNTL                                           0xF86
67062306a36Sopenharmony_ci#       define ENABLE_INTR                                (1 << 0)
67162306a36Sopenharmony_ci#       define IH_MC_SWAP(x)                              ((x) << 1)
67262306a36Sopenharmony_ci#       define IH_MC_SWAP_NONE                            0
67362306a36Sopenharmony_ci#       define IH_MC_SWAP_16BIT                           1
67462306a36Sopenharmony_ci#       define IH_MC_SWAP_32BIT                           2
67562306a36Sopenharmony_ci#       define IH_MC_SWAP_64BIT                           3
67662306a36Sopenharmony_ci#       define RPTR_REARM                                 (1 << 4)
67762306a36Sopenharmony_ci#       define MC_WRREQ_CREDIT(x)                         ((x) << 15)
67862306a36Sopenharmony_ci#       define MC_WR_CLEAN_CNT(x)                         ((x) << 20)
67962306a36Sopenharmony_ci#       define MC_VMID(x)                                 ((x) << 25)
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ci#define	CONFIG_MEMSIZE					0x150A
68262306a36Sopenharmony_ci
68362306a36Sopenharmony_ci#define INTERRUPT_CNTL                                    0x151A
68462306a36Sopenharmony_ci#       define IH_DUMMY_RD_OVERRIDE                       (1 << 0)
68562306a36Sopenharmony_ci#       define IH_DUMMY_RD_EN                             (1 << 1)
68662306a36Sopenharmony_ci#       define IH_REQ_NONSNOOP_EN                         (1 << 3)
68762306a36Sopenharmony_ci#       define GEN_IH_INT_EN                              (1 << 8)
68862306a36Sopenharmony_ci#define INTERRUPT_CNTL2                                   0x151B
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci#define HDP_MEM_COHERENCY_FLUSH_CNTL			0x1520
69162306a36Sopenharmony_ci
69262306a36Sopenharmony_ci#define	BIF_FB_EN						0x1524
69362306a36Sopenharmony_ci#define		FB_READ_EN					(1 << 0)
69462306a36Sopenharmony_ci#define		FB_WRITE_EN					(1 << 1)
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci#define HDP_REG_COHERENCY_FLUSH_CNTL			0x1528
69762306a36Sopenharmony_ci
69862306a36Sopenharmony_ci/* DCE6 ELD audio interface */
69962306a36Sopenharmony_ci#define AZ_F0_CODEC_ENDPOINT_INDEX                       0x1780
70062306a36Sopenharmony_ci#       define AZ_ENDPOINT_REG_INDEX(x)                  (((x) & 0xff) << 0)
70162306a36Sopenharmony_ci#       define AZ_ENDPOINT_REG_WRITE_EN                  (1 << 8)
70262306a36Sopenharmony_ci#define AZ_F0_CODEC_ENDPOINT_DATA                        0x1781
70362306a36Sopenharmony_ci
70462306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER          0x25
70562306a36Sopenharmony_ci#define		SPEAKER_ALLOCATION(x)			(((x) & 0x7f) << 0)
70662306a36Sopenharmony_ci#define		SPEAKER_ALLOCATION_MASK			(0x7f << 0)
70762306a36Sopenharmony_ci#define		SPEAKER_ALLOCATION_SHIFT		0
70862306a36Sopenharmony_ci#define		HDMI_CONNECTION				(1 << 16)
70962306a36Sopenharmony_ci#define		DP_CONNECTION				(1 << 17)
71062306a36Sopenharmony_ci
71162306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0        0x28 /* LPCM */
71262306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR1        0x29 /* AC3 */
71362306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR2        0x2A /* MPEG1 */
71462306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR3        0x2B /* MP3 */
71562306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR4        0x2C /* MPEG2 */
71662306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR5        0x2D /* AAC */
71762306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR6        0x2E /* DTS */
71862306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR7        0x2F /* ATRAC */
71962306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR8        0x30 /* one bit audio - leave at 0 (default) */
72062306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR9        0x31 /* Dolby Digital */
72162306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR10       0x32 /* DTS-HD */
72262306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR11       0x33 /* MAT-MLP */
72362306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR12       0x34 /* DTS */
72462306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR13       0x35 /* WMA Pro */
72562306a36Sopenharmony_ci#       define MAX_CHANNELS(x)                            (((x) & 0x7) << 0)
72662306a36Sopenharmony_ci/* max channels minus one.  7 = 8 channels */
72762306a36Sopenharmony_ci#       define SUPPORTED_FREQUENCIES(x)                   (((x) & 0xff) << 8)
72862306a36Sopenharmony_ci#       define DESCRIPTOR_BYTE_2(x)                       (((x) & 0xff) << 16)
72962306a36Sopenharmony_ci#       define SUPPORTED_FREQUENCIES_STEREO(x)            (((x) & 0xff) << 24) /* LPCM only */
73062306a36Sopenharmony_ci/* SUPPORTED_FREQUENCIES, SUPPORTED_FREQUENCIES_STEREO
73162306a36Sopenharmony_ci * bit0 = 32 kHz
73262306a36Sopenharmony_ci * bit1 = 44.1 kHz
73362306a36Sopenharmony_ci * bit2 = 48 kHz
73462306a36Sopenharmony_ci * bit3 = 88.2 kHz
73562306a36Sopenharmony_ci * bit4 = 96 kHz
73662306a36Sopenharmony_ci * bit5 = 176.4 kHz
73762306a36Sopenharmony_ci * bit6 = 192 kHz
73862306a36Sopenharmony_ci */
73962306a36Sopenharmony_ci
74062306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC         0x37
74162306a36Sopenharmony_ci#       define VIDEO_LIPSYNC(x)                           (((x) & 0xff) << 0)
74262306a36Sopenharmony_ci#       define AUDIO_LIPSYNC(x)                           (((x) & 0xff) << 8)
74362306a36Sopenharmony_ci/* VIDEO_LIPSYNC, AUDIO_LIPSYNC
74462306a36Sopenharmony_ci * 0   = invalid
74562306a36Sopenharmony_ci * x   = legal delay value
74662306a36Sopenharmony_ci * 255 = sync not supported
74762306a36Sopenharmony_ci */
74862306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_RESPONSE_HBR             0x38
74962306a36Sopenharmony_ci#       define HBR_CAPABLE                                (1 << 0) /* enabled by default */
75062306a36Sopenharmony_ci
75162306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO0               0x3a
75262306a36Sopenharmony_ci#       define MANUFACTURER_ID(x)                        (((x) & 0xffff) << 0)
75362306a36Sopenharmony_ci#       define PRODUCT_ID(x)                             (((x) & 0xffff) << 16)
75462306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO1               0x3b
75562306a36Sopenharmony_ci#       define SINK_DESCRIPTION_LEN(x)                   (((x) & 0xff) << 0)
75662306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO2               0x3c
75762306a36Sopenharmony_ci#       define PORT_ID0(x)                               (((x) & 0xffffffff) << 0)
75862306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO3               0x3d
75962306a36Sopenharmony_ci#       define PORT_ID1(x)                               (((x) & 0xffffffff) << 0)
76062306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO4               0x3e
76162306a36Sopenharmony_ci#       define DESCRIPTION0(x)                           (((x) & 0xff) << 0)
76262306a36Sopenharmony_ci#       define DESCRIPTION1(x)                           (((x) & 0xff) << 8)
76362306a36Sopenharmony_ci#       define DESCRIPTION2(x)                           (((x) & 0xff) << 16)
76462306a36Sopenharmony_ci#       define DESCRIPTION3(x)                           (((x) & 0xff) << 24)
76562306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO5               0x3f
76662306a36Sopenharmony_ci#       define DESCRIPTION4(x)                           (((x) & 0xff) << 0)
76762306a36Sopenharmony_ci#       define DESCRIPTION5(x)                           (((x) & 0xff) << 8)
76862306a36Sopenharmony_ci#       define DESCRIPTION6(x)                           (((x) & 0xff) << 16)
76962306a36Sopenharmony_ci#       define DESCRIPTION7(x)                           (((x) & 0xff) << 24)
77062306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO6               0x40
77162306a36Sopenharmony_ci#       define DESCRIPTION8(x)                           (((x) & 0xff) << 0)
77262306a36Sopenharmony_ci#       define DESCRIPTION9(x)                           (((x) & 0xff) << 8)
77362306a36Sopenharmony_ci#       define DESCRIPTION10(x)                          (((x) & 0xff) << 16)
77462306a36Sopenharmony_ci#       define DESCRIPTION11(x)                          (((x) & 0xff) << 24)
77562306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO7               0x41
77662306a36Sopenharmony_ci#       define DESCRIPTION12(x)                          (((x) & 0xff) << 0)
77762306a36Sopenharmony_ci#       define DESCRIPTION13(x)                          (((x) & 0xff) << 8)
77862306a36Sopenharmony_ci#       define DESCRIPTION14(x)                          (((x) & 0xff) << 16)
77962306a36Sopenharmony_ci#       define DESCRIPTION15(x)                          (((x) & 0xff) << 24)
78062306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO8               0x42
78162306a36Sopenharmony_ci#       define DESCRIPTION16(x)                          (((x) & 0xff) << 0)
78262306a36Sopenharmony_ci#       define DESCRIPTION17(x)                          (((x) & 0xff) << 8)
78362306a36Sopenharmony_ci
78462306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL         0x54
78562306a36Sopenharmony_ci#       define AUDIO_ENABLED                             (1 << 31)
78662306a36Sopenharmony_ci
78762306a36Sopenharmony_ci#define AZ_F0_CODEC_PIN_CONTROL_RESPONSE_CONFIGURATION_DEFAULT  0x56
78862306a36Sopenharmony_ci#define		PORT_CONNECTIVITY_MASK				(3 << 30)
78962306a36Sopenharmony_ci#define		PORT_CONNECTIVITY_SHIFT				30
79062306a36Sopenharmony_ci
79162306a36Sopenharmony_ci#define	DC_LB_MEMORY_SPLIT					0x1AC3
79262306a36Sopenharmony_ci#define		DC_LB_MEMORY_CONFIG(x)				((x) << 20)
79362306a36Sopenharmony_ci
79462306a36Sopenharmony_ci#define	PRIORITY_A_CNT						0x1AC6
79562306a36Sopenharmony_ci#define		PRIORITY_MARK_MASK				0x7fff
79662306a36Sopenharmony_ci#define		PRIORITY_OFF					(1 << 16)
79762306a36Sopenharmony_ci#define		PRIORITY_ALWAYS_ON				(1 << 20)
79862306a36Sopenharmony_ci#define	PRIORITY_B_CNT						0x1AC7
79962306a36Sopenharmony_ci
80062306a36Sopenharmony_ci#define	DPG_PIPE_ARBITRATION_CONTROL3				0x1B32
80162306a36Sopenharmony_ci#       define LATENCY_WATERMARK_MASK(x)			((x) << 16)
80262306a36Sopenharmony_ci#define	DPG_PIPE_LATENCY_CONTROL				0x1B33
80362306a36Sopenharmony_ci#       define LATENCY_LOW_WATERMARK(x)				((x) << 0)
80462306a36Sopenharmony_ci#       define LATENCY_HIGH_WATERMARK(x)			((x) << 16)
80562306a36Sopenharmony_ci
80662306a36Sopenharmony_ci/* 0x6bb8, 0x77b8, 0x103b8, 0x10fb8, 0x11bb8, 0x127b8 */
80762306a36Sopenharmony_ci#define VLINE_STATUS                                    0x1AEE
80862306a36Sopenharmony_ci#       define VLINE_OCCURRED                           (1 << 0)
80962306a36Sopenharmony_ci#       define VLINE_ACK                                (1 << 4)
81062306a36Sopenharmony_ci#       define VLINE_STAT                               (1 << 12)
81162306a36Sopenharmony_ci#       define VLINE_INTERRUPT                          (1 << 16)
81262306a36Sopenharmony_ci#       define VLINE_INTERRUPT_TYPE                     (1 << 17)
81362306a36Sopenharmony_ci/* 0x6bbc, 0x77bc, 0x103bc, 0x10fbc, 0x11bbc, 0x127bc */
81462306a36Sopenharmony_ci#define VBLANK_STATUS                                   0x1AEF
81562306a36Sopenharmony_ci#       define VBLANK_OCCURRED                          (1 << 0)
81662306a36Sopenharmony_ci#       define VBLANK_ACK                               (1 << 4)
81762306a36Sopenharmony_ci#       define VBLANK_STAT                              (1 << 12)
81862306a36Sopenharmony_ci#       define VBLANK_INTERRUPT                         (1 << 16)
81962306a36Sopenharmony_ci#       define VBLANK_INTERRUPT_TYPE                    (1 << 17)
82062306a36Sopenharmony_ci
82162306a36Sopenharmony_ci/* 0x6b40, 0x7740, 0x10340, 0x10f40, 0x11b40, 0x12740 */
82262306a36Sopenharmony_ci#define INT_MASK                                        0x1AD0
82362306a36Sopenharmony_ci#       define VBLANK_INT_MASK                          (1 << 0)
82462306a36Sopenharmony_ci#       define VLINE_INT_MASK                           (1 << 4)
82562306a36Sopenharmony_ci
82662306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS                           0x183D
82762306a36Sopenharmony_ci#       define LB_D1_VLINE_INTERRUPT                    (1 << 2)
82862306a36Sopenharmony_ci#       define LB_D1_VBLANK_INTERRUPT                   (1 << 3)
82962306a36Sopenharmony_ci#       define DC_HPD1_INTERRUPT                        (1 << 17)
83062306a36Sopenharmony_ci#       define DC_HPD1_RX_INTERRUPT                     (1 << 18)
83162306a36Sopenharmony_ci#       define DACA_AUTODETECT_INTERRUPT                (1 << 22)
83262306a36Sopenharmony_ci#       define DACB_AUTODETECT_INTERRUPT                (1 << 23)
83362306a36Sopenharmony_ci#       define DC_I2C_SW_DONE_INTERRUPT                 (1 << 24)
83462306a36Sopenharmony_ci#       define DC_I2C_HW_DONE_INTERRUPT                 (1 << 25)
83562306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE                  0x183E
83662306a36Sopenharmony_ci#       define LB_D2_VLINE_INTERRUPT                    (1 << 2)
83762306a36Sopenharmony_ci#       define LB_D2_VBLANK_INTERRUPT                   (1 << 3)
83862306a36Sopenharmony_ci#       define DC_HPD2_INTERRUPT                        (1 << 17)
83962306a36Sopenharmony_ci#       define DC_HPD2_RX_INTERRUPT                     (1 << 18)
84062306a36Sopenharmony_ci#       define DISP_TIMER_INTERRUPT                     (1 << 24)
84162306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE2                 0x183F
84262306a36Sopenharmony_ci#       define LB_D3_VLINE_INTERRUPT                    (1 << 2)
84362306a36Sopenharmony_ci#       define LB_D3_VBLANK_INTERRUPT                   (1 << 3)
84462306a36Sopenharmony_ci#       define DC_HPD3_INTERRUPT                        (1 << 17)
84562306a36Sopenharmony_ci#       define DC_HPD3_RX_INTERRUPT                     (1 << 18)
84662306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE3                 0x1840
84762306a36Sopenharmony_ci#       define LB_D4_VLINE_INTERRUPT                    (1 << 2)
84862306a36Sopenharmony_ci#       define LB_D4_VBLANK_INTERRUPT                   (1 << 3)
84962306a36Sopenharmony_ci#       define DC_HPD4_INTERRUPT                        (1 << 17)
85062306a36Sopenharmony_ci#       define DC_HPD4_RX_INTERRUPT                     (1 << 18)
85162306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE4                 0x1853
85262306a36Sopenharmony_ci#       define LB_D5_VLINE_INTERRUPT                    (1 << 2)
85362306a36Sopenharmony_ci#       define LB_D5_VBLANK_INTERRUPT                   (1 << 3)
85462306a36Sopenharmony_ci#       define DC_HPD5_INTERRUPT                        (1 << 17)
85562306a36Sopenharmony_ci#       define DC_HPD5_RX_INTERRUPT                     (1 << 18)
85662306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE5                 0x1854
85762306a36Sopenharmony_ci#       define LB_D6_VLINE_INTERRUPT                    (1 << 2)
85862306a36Sopenharmony_ci#       define LB_D6_VBLANK_INTERRUPT                   (1 << 3)
85962306a36Sopenharmony_ci#       define DC_HPD6_INTERRUPT                        (1 << 17)
86062306a36Sopenharmony_ci#       define DC_HPD6_RX_INTERRUPT                     (1 << 18)
86162306a36Sopenharmony_ci
86262306a36Sopenharmony_ci/* 0x6858, 0x7458, 0x10058, 0x10c58, 0x11858, 0x12458 */
86362306a36Sopenharmony_ci#define GRPH_INT_STATUS                                 0x1A16
86462306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_OCCURRED                  (1 << 0)
86562306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_CLEAR                     (1 << 8)
86662306a36Sopenharmony_ci/* 0x685c, 0x745c, 0x1005c, 0x10c5c, 0x1185c, 0x1245c */
86762306a36Sopenharmony_ci#define	GRPH_INT_CONTROL			        0x1A17
86862306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_MASK                      (1 << 0)
86962306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_TYPE                      (1 << 8)
87062306a36Sopenharmony_ci
87162306a36Sopenharmony_ci#define	DAC_AUTODETECT_INT_CONTROL			0x19F2
87262306a36Sopenharmony_ci
87362306a36Sopenharmony_ci#define DC_HPD1_INT_STATUS                              0x1807
87462306a36Sopenharmony_ci#define DC_HPD2_INT_STATUS                              0x180A
87562306a36Sopenharmony_ci#define DC_HPD3_INT_STATUS                              0x180D
87662306a36Sopenharmony_ci#define DC_HPD4_INT_STATUS                              0x1810
87762306a36Sopenharmony_ci#define DC_HPD5_INT_STATUS                              0x1813
87862306a36Sopenharmony_ci#define DC_HPD6_INT_STATUS                              0x1816
87962306a36Sopenharmony_ci#       define DC_HPDx_INT_STATUS                       (1 << 0)
88062306a36Sopenharmony_ci#       define DC_HPDx_SENSE                            (1 << 1)
88162306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_STATUS                    (1 << 8)
88262306a36Sopenharmony_ci
88362306a36Sopenharmony_ci#define DC_HPD1_INT_CONTROL                             0x1808
88462306a36Sopenharmony_ci#define DC_HPD2_INT_CONTROL                             0x180B
88562306a36Sopenharmony_ci#define DC_HPD3_INT_CONTROL                             0x180E
88662306a36Sopenharmony_ci#define DC_HPD4_INT_CONTROL                             0x1811
88762306a36Sopenharmony_ci#define DC_HPD5_INT_CONTROL                             0x1814
88862306a36Sopenharmony_ci#define DC_HPD6_INT_CONTROL                             0x1817
88962306a36Sopenharmony_ci#       define DC_HPDx_INT_ACK                          (1 << 0)
89062306a36Sopenharmony_ci#       define DC_HPDx_INT_POLARITY                     (1 << 8)
89162306a36Sopenharmony_ci#       define DC_HPDx_INT_EN                           (1 << 16)
89262306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_ACK                       (1 << 20)
89362306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_EN                        (1 << 24)
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci#define DC_HPD1_CONTROL                                   0x1809
89662306a36Sopenharmony_ci#define DC_HPD2_CONTROL                                   0x180C
89762306a36Sopenharmony_ci#define DC_HPD3_CONTROL                                   0x180F
89862306a36Sopenharmony_ci#define DC_HPD4_CONTROL                                   0x1812
89962306a36Sopenharmony_ci#define DC_HPD5_CONTROL                                   0x1815
90062306a36Sopenharmony_ci#define DC_HPD6_CONTROL                                   0x1818
90162306a36Sopenharmony_ci#       define DC_HPDx_CONNECTION_TIMER(x)                ((x) << 0)
90262306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_TIMER(x)                    ((x) << 16)
90362306a36Sopenharmony_ci#       define DC_HPDx_EN                                 (1 << 28)
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci#define DPG_PIPE_STUTTER_CONTROL                          0x1B35
90662306a36Sopenharmony_ci#       define STUTTER_ENABLE                             (1 << 0)
90762306a36Sopenharmony_ci
90862306a36Sopenharmony_ci/* 0x6e98, 0x7a98, 0x10698, 0x11298, 0x11e98, 0x12a98 */
90962306a36Sopenharmony_ci#define CRTC_STATUS_FRAME_COUNT                         0x1BA6
91062306a36Sopenharmony_ci
91162306a36Sopenharmony_ci/* Audio clocks */
91262306a36Sopenharmony_ci#define DCCG_AUDIO_DTO_SOURCE                           0x05ac
91362306a36Sopenharmony_ci#       define DCCG_AUDIO_DTO0_SOURCE_SEL(x) ((x) << 0) /* crtc0 - crtc5 */
91462306a36Sopenharmony_ci#       define DCCG_AUDIO_DTO_SEL            (1 << 4)   /* 0=dto0 1=dto1 */
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci#define DCCG_AUDIO_DTO0_PHASE                           0x05b0
91762306a36Sopenharmony_ci#define DCCG_AUDIO_DTO0_MODULE                          0x05b4
91862306a36Sopenharmony_ci#define DCCG_AUDIO_DTO1_PHASE                           0x05c0
91962306a36Sopenharmony_ci#define DCCG_AUDIO_DTO1_MODULE                          0x05c4
92062306a36Sopenharmony_ci
92162306a36Sopenharmony_ci#define AFMT_AUDIO_SRC_CONTROL                          0x1c4f
92262306a36Sopenharmony_ci#define		AFMT_AUDIO_SRC_SELECT(x)		(((x) & 7) << 0)
92362306a36Sopenharmony_ci/* AFMT_AUDIO_SRC_SELECT
92462306a36Sopenharmony_ci * 0 = stream0
92562306a36Sopenharmony_ci * 1 = stream1
92662306a36Sopenharmony_ci * 2 = stream2
92762306a36Sopenharmony_ci * 3 = stream3
92862306a36Sopenharmony_ci * 4 = stream4
92962306a36Sopenharmony_ci * 5 = stream5
93062306a36Sopenharmony_ci */
93162306a36Sopenharmony_ci
93262306a36Sopenharmony_ci#define	GRBM_CNTL					0x2000
93362306a36Sopenharmony_ci#define		GRBM_READ_TIMEOUT(x)				((x) << 0)
93462306a36Sopenharmony_ci
93562306a36Sopenharmony_ci#define	GRBM_STATUS2					0x2002
93662306a36Sopenharmony_ci#define		RLC_RQ_PENDING 					(1 << 0)
93762306a36Sopenharmony_ci#define		RLC_BUSY 					(1 << 8)
93862306a36Sopenharmony_ci#define		TC_BUSY 					(1 << 9)
93962306a36Sopenharmony_ci
94062306a36Sopenharmony_ci#define	GRBM_STATUS					0x2004
94162306a36Sopenharmony_ci#define		CMDFIFO_AVAIL_MASK				0x0000000F
94262306a36Sopenharmony_ci#define		RING2_RQ_PENDING				(1 << 4)
94362306a36Sopenharmony_ci#define		SRBM_RQ_PENDING					(1 << 5)
94462306a36Sopenharmony_ci#define		RING1_RQ_PENDING				(1 << 6)
94562306a36Sopenharmony_ci#define		CF_RQ_PENDING					(1 << 7)
94662306a36Sopenharmony_ci#define		PF_RQ_PENDING					(1 << 8)
94762306a36Sopenharmony_ci#define		GDS_DMA_RQ_PENDING				(1 << 9)
94862306a36Sopenharmony_ci#define		GRBM_EE_BUSY					(1 << 10)
94962306a36Sopenharmony_ci#define		DB_CLEAN					(1 << 12)
95062306a36Sopenharmony_ci#define		CB_CLEAN					(1 << 13)
95162306a36Sopenharmony_ci#define		TA_BUSY 					(1 << 14)
95262306a36Sopenharmony_ci#define		GDS_BUSY 					(1 << 15)
95362306a36Sopenharmony_ci#define		VGT_BUSY					(1 << 17)
95462306a36Sopenharmony_ci#define		IA_BUSY_NO_DMA					(1 << 18)
95562306a36Sopenharmony_ci#define		IA_BUSY						(1 << 19)
95662306a36Sopenharmony_ci#define		SX_BUSY 					(1 << 20)
95762306a36Sopenharmony_ci#define		SPI_BUSY					(1 << 22)
95862306a36Sopenharmony_ci#define		BCI_BUSY					(1 << 23)
95962306a36Sopenharmony_ci#define		SC_BUSY 					(1 << 24)
96062306a36Sopenharmony_ci#define		PA_BUSY 					(1 << 25)
96162306a36Sopenharmony_ci#define		DB_BUSY 					(1 << 26)
96262306a36Sopenharmony_ci#define		CP_COHERENCY_BUSY      				(1 << 28)
96362306a36Sopenharmony_ci#define		CP_BUSY 					(1 << 29)
96462306a36Sopenharmony_ci#define		CB_BUSY 					(1 << 30)
96562306a36Sopenharmony_ci#define		GUI_ACTIVE					(1 << 31)
96662306a36Sopenharmony_ci#define	GRBM_STATUS_SE0					0x2005
96762306a36Sopenharmony_ci#define	GRBM_STATUS_SE1					0x2006
96862306a36Sopenharmony_ci#define		SE_DB_CLEAN					(1 << 1)
96962306a36Sopenharmony_ci#define		SE_CB_CLEAN					(1 << 2)
97062306a36Sopenharmony_ci#define		SE_BCI_BUSY					(1 << 22)
97162306a36Sopenharmony_ci#define		SE_VGT_BUSY					(1 << 23)
97262306a36Sopenharmony_ci#define		SE_PA_BUSY					(1 << 24)
97362306a36Sopenharmony_ci#define		SE_TA_BUSY					(1 << 25)
97462306a36Sopenharmony_ci#define		SE_SX_BUSY					(1 << 26)
97562306a36Sopenharmony_ci#define		SE_SPI_BUSY					(1 << 27)
97662306a36Sopenharmony_ci#define		SE_SC_BUSY					(1 << 29)
97762306a36Sopenharmony_ci#define		SE_DB_BUSY					(1 << 30)
97862306a36Sopenharmony_ci#define		SE_CB_BUSY					(1 << 31)
97962306a36Sopenharmony_ci
98062306a36Sopenharmony_ci#define	GRBM_SOFT_RESET					0x2008
98162306a36Sopenharmony_ci#define		SOFT_RESET_CP					(1 << 0)
98262306a36Sopenharmony_ci#define		SOFT_RESET_CB					(1 << 1)
98362306a36Sopenharmony_ci#define		SOFT_RESET_RLC					(1 << 2)
98462306a36Sopenharmony_ci#define		SOFT_RESET_DB					(1 << 3)
98562306a36Sopenharmony_ci#define		SOFT_RESET_GDS					(1 << 4)
98662306a36Sopenharmony_ci#define		SOFT_RESET_PA					(1 << 5)
98762306a36Sopenharmony_ci#define		SOFT_RESET_SC					(1 << 6)
98862306a36Sopenharmony_ci#define		SOFT_RESET_BCI					(1 << 7)
98962306a36Sopenharmony_ci#define		SOFT_RESET_SPI					(1 << 8)
99062306a36Sopenharmony_ci#define		SOFT_RESET_SX					(1 << 10)
99162306a36Sopenharmony_ci#define		SOFT_RESET_TC					(1 << 11)
99262306a36Sopenharmony_ci#define		SOFT_RESET_TA					(1 << 12)
99362306a36Sopenharmony_ci#define		SOFT_RESET_VGT					(1 << 14)
99462306a36Sopenharmony_ci#define		SOFT_RESET_IA					(1 << 15)
99562306a36Sopenharmony_ci
99662306a36Sopenharmony_ci#define GRBM_GFX_INDEX          			0x200B
99762306a36Sopenharmony_ci#define		INSTANCE_INDEX(x)			((x) << 0)
99862306a36Sopenharmony_ci#define		SH_INDEX(x)     			((x) << 8)
99962306a36Sopenharmony_ci#define		SE_INDEX(x)     			((x) << 16)
100062306a36Sopenharmony_ci#define		SH_BROADCAST_WRITES      		(1 << 29)
100162306a36Sopenharmony_ci#define		INSTANCE_BROADCAST_WRITES      		(1 << 30)
100262306a36Sopenharmony_ci#define		SE_BROADCAST_WRITES      		(1 << 31)
100362306a36Sopenharmony_ci
100462306a36Sopenharmony_ci#define GRBM_INT_CNTL                                   0x2018
100562306a36Sopenharmony_ci#       define RDERR_INT_ENABLE                         (1 << 0)
100662306a36Sopenharmony_ci#       define GUI_IDLE_INT_ENABLE                      (1 << 19)
100762306a36Sopenharmony_ci
100862306a36Sopenharmony_ci#define	CP_STRMOUT_CNTL					0x213F
100962306a36Sopenharmony_ci#define	SCRATCH_REG0					0x2140
101062306a36Sopenharmony_ci#define	SCRATCH_REG1					0x2141
101162306a36Sopenharmony_ci#define	SCRATCH_REG2					0x2142
101262306a36Sopenharmony_ci#define	SCRATCH_REG3					0x2143
101362306a36Sopenharmony_ci#define	SCRATCH_REG4					0x2144
101462306a36Sopenharmony_ci#define	SCRATCH_REG5					0x2145
101562306a36Sopenharmony_ci#define	SCRATCH_REG6					0x2146
101662306a36Sopenharmony_ci#define	SCRATCH_REG7					0x2147
101762306a36Sopenharmony_ci
101862306a36Sopenharmony_ci#define	SCRATCH_UMSK					0x2150
101962306a36Sopenharmony_ci#define	SCRATCH_ADDR					0x2151
102062306a36Sopenharmony_ci
102162306a36Sopenharmony_ci#define	CP_SEM_WAIT_TIMER				0x216F
102262306a36Sopenharmony_ci
102362306a36Sopenharmony_ci#define	CP_SEM_INCOMPLETE_TIMER_CNTL			0x2172
102462306a36Sopenharmony_ci
102562306a36Sopenharmony_ci#define CP_ME_CNTL					0x21B6
102662306a36Sopenharmony_ci#define		CP_CE_HALT					(1 << 24)
102762306a36Sopenharmony_ci#define		CP_PFP_HALT					(1 << 26)
102862306a36Sopenharmony_ci#define		CP_ME_HALT					(1 << 28)
102962306a36Sopenharmony_ci
103062306a36Sopenharmony_ci#define	CP_COHER_CNTL2					0x217A
103162306a36Sopenharmony_ci
103262306a36Sopenharmony_ci#define	CP_RB2_RPTR					0x21BE
103362306a36Sopenharmony_ci#define	CP_RB1_RPTR					0x21BF
103462306a36Sopenharmony_ci#define	CP_RB0_RPTR					0x21C0
103562306a36Sopenharmony_ci#define	CP_RB_WPTR_DELAY				0x21C1
103662306a36Sopenharmony_ci
103762306a36Sopenharmony_ci#define	CP_QUEUE_THRESHOLDS				0x21D8
103862306a36Sopenharmony_ci#define		ROQ_IB1_START(x)				((x) << 0)
103962306a36Sopenharmony_ci#define		ROQ_IB2_START(x)				((x) << 8)
104062306a36Sopenharmony_ci#define CP_MEQ_THRESHOLDS				0x21D9
104162306a36Sopenharmony_ci#define		MEQ1_START(x)				((x) << 0)
104262306a36Sopenharmony_ci#define		MEQ2_START(x)				((x) << 8)
104362306a36Sopenharmony_ci
104462306a36Sopenharmony_ci#define	CP_PERFMON_CNTL					0x21FF
104562306a36Sopenharmony_ci
104662306a36Sopenharmony_ci#define	VGT_VTX_VECT_EJECT_REG				0x222C
104762306a36Sopenharmony_ci
104862306a36Sopenharmony_ci#define	VGT_CACHE_INVALIDATION				0x2231
104962306a36Sopenharmony_ci#define		CACHE_INVALIDATION(x)				((x) << 0)
105062306a36Sopenharmony_ci#define			VC_ONLY						0
105162306a36Sopenharmony_ci#define			TC_ONLY						1
105262306a36Sopenharmony_ci#define			VC_AND_TC					2
105362306a36Sopenharmony_ci#define		AUTO_INVLD_EN(x)				((x) << 6)
105462306a36Sopenharmony_ci#define			NO_AUTO						0
105562306a36Sopenharmony_ci#define			ES_AUTO						1
105662306a36Sopenharmony_ci#define			GS_AUTO						2
105762306a36Sopenharmony_ci#define			ES_AND_GS_AUTO					3
105862306a36Sopenharmony_ci#define	VGT_ESGS_RING_SIZE				0x2232
105962306a36Sopenharmony_ci#define	VGT_GSVS_RING_SIZE				0x2233
106062306a36Sopenharmony_ci
106162306a36Sopenharmony_ci#define	VGT_GS_VERTEX_REUSE				0x2235
106262306a36Sopenharmony_ci
106362306a36Sopenharmony_ci#define	VGT_PRIMITIVE_TYPE				0x2256
106462306a36Sopenharmony_ci#define	VGT_INDEX_TYPE					0x2257
106562306a36Sopenharmony_ci
106662306a36Sopenharmony_ci#define	VGT_NUM_INDICES					0x225C
106762306a36Sopenharmony_ci#define	VGT_NUM_INSTANCES				0x225D
106862306a36Sopenharmony_ci
106962306a36Sopenharmony_ci#define	VGT_TF_RING_SIZE				0x2262
107062306a36Sopenharmony_ci
107162306a36Sopenharmony_ci#define	VGT_HS_OFFCHIP_PARAM				0x226C
107262306a36Sopenharmony_ci
107362306a36Sopenharmony_ci#define	VGT_TF_MEMORY_BASE				0x226E
107462306a36Sopenharmony_ci
107562306a36Sopenharmony_ci#define CC_GC_SHADER_ARRAY_CONFIG			0x226F
107662306a36Sopenharmony_ci#define		INACTIVE_CUS_MASK			0xFFFF0000
107762306a36Sopenharmony_ci#define		INACTIVE_CUS_SHIFT			16
107862306a36Sopenharmony_ci#define GC_USER_SHADER_ARRAY_CONFIG			0x2270
107962306a36Sopenharmony_ci
108062306a36Sopenharmony_ci#define	PA_CL_ENHANCE					0x2285
108162306a36Sopenharmony_ci#define		CLIP_VTX_REORDER_ENA				(1 << 0)
108262306a36Sopenharmony_ci#define		NUM_CLIP_SEQ(x)					((x) << 1)
108362306a36Sopenharmony_ci
108462306a36Sopenharmony_ci#define	PA_SU_LINE_STIPPLE_VALUE			0x2298
108562306a36Sopenharmony_ci
108662306a36Sopenharmony_ci#define	PA_SC_LINE_STIPPLE_STATE			0x22C4
108762306a36Sopenharmony_ci
108862306a36Sopenharmony_ci#define	PA_SC_FORCE_EOV_MAX_CNTS			0x22C9
108962306a36Sopenharmony_ci#define		FORCE_EOV_MAX_CLK_CNT(x)			((x) << 0)
109062306a36Sopenharmony_ci#define		FORCE_EOV_MAX_REZ_CNT(x)			((x) << 16)
109162306a36Sopenharmony_ci
109262306a36Sopenharmony_ci#define	PA_SC_FIFO_SIZE					0x22F3
109362306a36Sopenharmony_ci#define		SC_FRONTEND_PRIM_FIFO_SIZE(x)			((x) << 0)
109462306a36Sopenharmony_ci#define		SC_BACKEND_PRIM_FIFO_SIZE(x)			((x) << 6)
109562306a36Sopenharmony_ci#define		SC_HIZ_TILE_FIFO_SIZE(x)			((x) << 15)
109662306a36Sopenharmony_ci#define		SC_EARLYZ_TILE_FIFO_SIZE(x)			((x) << 23)
109762306a36Sopenharmony_ci
109862306a36Sopenharmony_ci#define	PA_SC_ENHANCE					0x22FC
109962306a36Sopenharmony_ci
110062306a36Sopenharmony_ci#define	SQ_CONFIG					0x2300
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_ci#define	SQC_CACHES					0x2302
110362306a36Sopenharmony_ci
110462306a36Sopenharmony_ci#define SQ_POWER_THROTTLE                               0x2396
110562306a36Sopenharmony_ci#define		MIN_POWER(x)				((x) << 0)
110662306a36Sopenharmony_ci#define		MIN_POWER_MASK				(0x3fff << 0)
110762306a36Sopenharmony_ci#define		MIN_POWER_SHIFT				0
110862306a36Sopenharmony_ci#define		MAX_POWER(x)				((x) << 16)
110962306a36Sopenharmony_ci#define		MAX_POWER_MASK				(0x3fff << 16)
111062306a36Sopenharmony_ci#define		MAX_POWER_SHIFT				0
111162306a36Sopenharmony_ci#define SQ_POWER_THROTTLE2                              0x2397
111262306a36Sopenharmony_ci#define		MAX_POWER_DELTA(x)			((x) << 0)
111362306a36Sopenharmony_ci#define		MAX_POWER_DELTA_MASK			(0x3fff << 0)
111462306a36Sopenharmony_ci#define		MAX_POWER_DELTA_SHIFT			0
111562306a36Sopenharmony_ci#define		STI_SIZE(x)				((x) << 16)
111662306a36Sopenharmony_ci#define		STI_SIZE_MASK				(0x3ff << 16)
111762306a36Sopenharmony_ci#define		STI_SIZE_SHIFT				16
111862306a36Sopenharmony_ci#define		LTI_RATIO(x)				((x) << 27)
111962306a36Sopenharmony_ci#define		LTI_RATIO_MASK				(0xf << 27)
112062306a36Sopenharmony_ci#define		LTI_RATIO_SHIFT				27
112162306a36Sopenharmony_ci
112262306a36Sopenharmony_ci#define	SX_DEBUG_1					0x2418
112362306a36Sopenharmony_ci
112462306a36Sopenharmony_ci#define	SPI_STATIC_THREAD_MGMT_1			0x2438
112562306a36Sopenharmony_ci#define	SPI_STATIC_THREAD_MGMT_2			0x2439
112662306a36Sopenharmony_ci#define	SPI_STATIC_THREAD_MGMT_3			0x243A
112762306a36Sopenharmony_ci#define	SPI_PS_MAX_WAVE_ID				0x243B
112862306a36Sopenharmony_ci
112962306a36Sopenharmony_ci#define	SPI_CONFIG_CNTL					0x2440
113062306a36Sopenharmony_ci
113162306a36Sopenharmony_ci#define	SPI_CONFIG_CNTL_1				0x244F
113262306a36Sopenharmony_ci#define		VTX_DONE_DELAY(x)				((x) << 0)
113362306a36Sopenharmony_ci#define		INTERP_ONE_PRIM_PER_ROW				(1 << 4)
113462306a36Sopenharmony_ci
113562306a36Sopenharmony_ci#define	CGTS_TCC_DISABLE				0x2452
113662306a36Sopenharmony_ci#define	CGTS_USER_TCC_DISABLE				0x2453
113762306a36Sopenharmony_ci#define		TCC_DISABLE_MASK				0xFFFF0000
113862306a36Sopenharmony_ci#define		TCC_DISABLE_SHIFT				16
113962306a36Sopenharmony_ci#define	CGTS_SM_CTRL_REG				0x2454
114062306a36Sopenharmony_ci#define		OVERRIDE				(1 << 21)
114162306a36Sopenharmony_ci#define		LS_OVERRIDE				(1 << 22)
114262306a36Sopenharmony_ci
114362306a36Sopenharmony_ci#define	SPI_LB_CU_MASK					0x24D5
114462306a36Sopenharmony_ci
114562306a36Sopenharmony_ci#define	TA_CNTL_AUX					0x2542
114662306a36Sopenharmony_ci
114762306a36Sopenharmony_ci#define CC_RB_BACKEND_DISABLE				0x263D
114862306a36Sopenharmony_ci#define		BACKEND_DISABLE(x)     			((x) << 16)
114962306a36Sopenharmony_ci#define GB_ADDR_CONFIG  				0x263E
115062306a36Sopenharmony_ci#define		NUM_PIPES(x)				((x) << 0)
115162306a36Sopenharmony_ci#define		NUM_PIPES_MASK				0x00000007
115262306a36Sopenharmony_ci#define		NUM_PIPES_SHIFT				0
115362306a36Sopenharmony_ci#define		PIPE_INTERLEAVE_SIZE(x)			((x) << 4)
115462306a36Sopenharmony_ci#define		PIPE_INTERLEAVE_SIZE_MASK		0x00000070
115562306a36Sopenharmony_ci#define		PIPE_INTERLEAVE_SIZE_SHIFT		4
115662306a36Sopenharmony_ci#define		NUM_SHADER_ENGINES(x)			((x) << 12)
115762306a36Sopenharmony_ci#define		NUM_SHADER_ENGINES_MASK			0x00003000
115862306a36Sopenharmony_ci#define		NUM_SHADER_ENGINES_SHIFT		12
115962306a36Sopenharmony_ci#define		SHADER_ENGINE_TILE_SIZE(x)     		((x) << 16)
116062306a36Sopenharmony_ci#define		SHADER_ENGINE_TILE_SIZE_MASK		0x00070000
116162306a36Sopenharmony_ci#define		SHADER_ENGINE_TILE_SIZE_SHIFT		16
116262306a36Sopenharmony_ci#define		NUM_GPUS(x)     			((x) << 20)
116362306a36Sopenharmony_ci#define		NUM_GPUS_MASK				0x00700000
116462306a36Sopenharmony_ci#define		NUM_GPUS_SHIFT				20
116562306a36Sopenharmony_ci#define		MULTI_GPU_TILE_SIZE(x)     		((x) << 24)
116662306a36Sopenharmony_ci#define		MULTI_GPU_TILE_SIZE_MASK		0x03000000
116762306a36Sopenharmony_ci#define		MULTI_GPU_TILE_SIZE_SHIFT		24
116862306a36Sopenharmony_ci#define		ROW_SIZE(x)             		((x) << 28)
116962306a36Sopenharmony_ci#define		ROW_SIZE_MASK				0x30000000
117062306a36Sopenharmony_ci#define		ROW_SIZE_SHIFT				28
117162306a36Sopenharmony_ci
117262306a36Sopenharmony_ci#define	GB_TILE_MODE0					0x2644
117362306a36Sopenharmony_ci#       define MICRO_TILE_MODE(x)				((x) << 0)
117462306a36Sopenharmony_ci#              define	ADDR_SURF_DISPLAY_MICRO_TILING		0
117562306a36Sopenharmony_ci#              define	ADDR_SURF_THIN_MICRO_TILING		1
117662306a36Sopenharmony_ci#              define	ADDR_SURF_DEPTH_MICRO_TILING		2
117762306a36Sopenharmony_ci#       define ARRAY_MODE(x)					((x) << 2)
117862306a36Sopenharmony_ci#              define	ARRAY_LINEAR_GENERAL			0
117962306a36Sopenharmony_ci#              define	ARRAY_LINEAR_ALIGNED			1
118062306a36Sopenharmony_ci#              define	ARRAY_1D_TILED_THIN1			2
118162306a36Sopenharmony_ci#              define	ARRAY_2D_TILED_THIN1			4
118262306a36Sopenharmony_ci#       define PIPE_CONFIG(x)					((x) << 6)
118362306a36Sopenharmony_ci#              define	ADDR_SURF_P2				0
118462306a36Sopenharmony_ci#              define	ADDR_SURF_P4_8x16			4
118562306a36Sopenharmony_ci#              define	ADDR_SURF_P4_16x16			5
118662306a36Sopenharmony_ci#              define	ADDR_SURF_P4_16x32			6
118762306a36Sopenharmony_ci#              define	ADDR_SURF_P4_32x32			7
118862306a36Sopenharmony_ci#              define	ADDR_SURF_P8_16x16_8x16			8
118962306a36Sopenharmony_ci#              define	ADDR_SURF_P8_16x32_8x16			9
119062306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x32_8x16			10
119162306a36Sopenharmony_ci#              define	ADDR_SURF_P8_16x32_16x16		11
119262306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x32_16x16		12
119362306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x32_16x32		13
119462306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x64_32x32		14
119562306a36Sopenharmony_ci#       define TILE_SPLIT(x)					((x) << 11)
119662306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_64B		0
119762306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_128B		1
119862306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_256B		2
119962306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_512B		3
120062306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_1KB		4
120162306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_2KB		5
120262306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_4KB		6
120362306a36Sopenharmony_ci#       define BANK_WIDTH(x)					((x) << 14)
120462306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_1			0
120562306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_2			1
120662306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_4			2
120762306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_8			3
120862306a36Sopenharmony_ci#       define BANK_HEIGHT(x)					((x) << 16)
120962306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_1			0
121062306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_2			1
121162306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_4			2
121262306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_8			3
121362306a36Sopenharmony_ci#       define MACRO_TILE_ASPECT(x)				((x) << 18)
121462306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_1		0
121562306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_2		1
121662306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_4		2
121762306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_8		3
121862306a36Sopenharmony_ci#       define NUM_BANKS(x)					((x) << 20)
121962306a36Sopenharmony_ci#              define	ADDR_SURF_2_BANK			0
122062306a36Sopenharmony_ci#              define	ADDR_SURF_4_BANK			1
122162306a36Sopenharmony_ci#              define	ADDR_SURF_8_BANK			2
122262306a36Sopenharmony_ci#              define	ADDR_SURF_16_BANK			3
122362306a36Sopenharmony_ci#define	GB_TILE_MODE1					0x2645
122462306a36Sopenharmony_ci#define	GB_TILE_MODE2					0x2646
122562306a36Sopenharmony_ci#define	GB_TILE_MODE3					0x2647
122662306a36Sopenharmony_ci#define	GB_TILE_MODE4					0x2648
122762306a36Sopenharmony_ci#define	GB_TILE_MODE5					0x2649
122862306a36Sopenharmony_ci#define	GB_TILE_MODE6					0x264a
122962306a36Sopenharmony_ci#define	GB_TILE_MODE7					0x264b
123062306a36Sopenharmony_ci#define	GB_TILE_MODE8					0x264c
123162306a36Sopenharmony_ci#define	GB_TILE_MODE9					0x264d
123262306a36Sopenharmony_ci#define	GB_TILE_MODE10					0x264e
123362306a36Sopenharmony_ci#define	GB_TILE_MODE11					0x264f
123462306a36Sopenharmony_ci#define	GB_TILE_MODE12					0x2650
123562306a36Sopenharmony_ci#define	GB_TILE_MODE13					0x2651
123662306a36Sopenharmony_ci#define	GB_TILE_MODE14					0x2652
123762306a36Sopenharmony_ci#define	GB_TILE_MODE15					0x2653
123862306a36Sopenharmony_ci#define	GB_TILE_MODE16					0x2654
123962306a36Sopenharmony_ci#define	GB_TILE_MODE17					0x2655
124062306a36Sopenharmony_ci#define	GB_TILE_MODE18					0x2656
124162306a36Sopenharmony_ci#define	GB_TILE_MODE19					0x2657
124262306a36Sopenharmony_ci#define	GB_TILE_MODE20					0x2658
124362306a36Sopenharmony_ci#define	GB_TILE_MODE21					0x2659
124462306a36Sopenharmony_ci#define	GB_TILE_MODE22					0x265a
124562306a36Sopenharmony_ci#define	GB_TILE_MODE23					0x265b
124662306a36Sopenharmony_ci#define	GB_TILE_MODE24					0x265c
124762306a36Sopenharmony_ci#define	GB_TILE_MODE25					0x265d
124862306a36Sopenharmony_ci#define	GB_TILE_MODE26					0x265e
124962306a36Sopenharmony_ci#define	GB_TILE_MODE27					0x265f
125062306a36Sopenharmony_ci#define	GB_TILE_MODE28					0x2660
125162306a36Sopenharmony_ci#define	GB_TILE_MODE29					0x2661
125262306a36Sopenharmony_ci#define	GB_TILE_MODE30					0x2662
125362306a36Sopenharmony_ci#define	GB_TILE_MODE31					0x2663
125462306a36Sopenharmony_ci
125562306a36Sopenharmony_ci#define	CB_PERFCOUNTER0_SELECT0				0x2688
125662306a36Sopenharmony_ci#define	CB_PERFCOUNTER0_SELECT1				0x2689
125762306a36Sopenharmony_ci#define	CB_PERFCOUNTER1_SELECT0				0x268A
125862306a36Sopenharmony_ci#define	CB_PERFCOUNTER1_SELECT1				0x268B
125962306a36Sopenharmony_ci#define	CB_PERFCOUNTER2_SELECT0				0x268C
126062306a36Sopenharmony_ci#define	CB_PERFCOUNTER2_SELECT1				0x268D
126162306a36Sopenharmony_ci#define	CB_PERFCOUNTER3_SELECT0				0x268E
126262306a36Sopenharmony_ci#define	CB_PERFCOUNTER3_SELECT1				0x268F
126362306a36Sopenharmony_ci
126462306a36Sopenharmony_ci#define	CB_CGTT_SCLK_CTRL				0x2698
126562306a36Sopenharmony_ci
126662306a36Sopenharmony_ci#define	GC_USER_RB_BACKEND_DISABLE			0x26DF
126762306a36Sopenharmony_ci#define		BACKEND_DISABLE_MASK			0x00FF0000
126862306a36Sopenharmony_ci#define		BACKEND_DISABLE_SHIFT			16
126962306a36Sopenharmony_ci
127062306a36Sopenharmony_ci#define	TCP_CHAN_STEER_LO				0x2B03
127162306a36Sopenharmony_ci#define	TCP_CHAN_STEER_HI				0x2B94
127262306a36Sopenharmony_ci
127362306a36Sopenharmony_ci#define	CP_RB0_BASE					0x3040
127462306a36Sopenharmony_ci#define	CP_RB0_CNTL					0x3041
127562306a36Sopenharmony_ci#define		RB_BUFSZ(x)					((x) << 0)
127662306a36Sopenharmony_ci#define		RB_BLKSZ(x)					((x) << 8)
127762306a36Sopenharmony_ci#define		BUF_SWAP_32BIT					(2 << 16)
127862306a36Sopenharmony_ci#define		RB_NO_UPDATE					(1 << 27)
127962306a36Sopenharmony_ci#define		RB_RPTR_WR_ENA					(1 << 31)
128062306a36Sopenharmony_ci
128162306a36Sopenharmony_ci#define	CP_RB0_RPTR_ADDR				0x3043
128262306a36Sopenharmony_ci#define	CP_RB0_RPTR_ADDR_HI				0x3044
128362306a36Sopenharmony_ci#define	CP_RB0_WPTR					0x3045
128462306a36Sopenharmony_ci
128562306a36Sopenharmony_ci#define	CP_PFP_UCODE_ADDR				0x3054
128662306a36Sopenharmony_ci#define	CP_PFP_UCODE_DATA				0x3055
128762306a36Sopenharmony_ci#define	CP_ME_RAM_RADDR					0x3056
128862306a36Sopenharmony_ci#define	CP_ME_RAM_WADDR					0x3057
128962306a36Sopenharmony_ci#define	CP_ME_RAM_DATA					0x3058
129062306a36Sopenharmony_ci
129162306a36Sopenharmony_ci#define	CP_CE_UCODE_ADDR				0x305A
129262306a36Sopenharmony_ci#define	CP_CE_UCODE_DATA				0x305B
129362306a36Sopenharmony_ci
129462306a36Sopenharmony_ci#define	CP_RB1_BASE					0x3060
129562306a36Sopenharmony_ci#define	CP_RB1_CNTL					0x3061
129662306a36Sopenharmony_ci#define	CP_RB1_RPTR_ADDR				0x3062
129762306a36Sopenharmony_ci#define	CP_RB1_RPTR_ADDR_HI				0x3063
129862306a36Sopenharmony_ci#define	CP_RB1_WPTR					0x3064
129962306a36Sopenharmony_ci#define	CP_RB2_BASE					0x3065
130062306a36Sopenharmony_ci#define	CP_RB2_CNTL					0x3066
130162306a36Sopenharmony_ci#define	CP_RB2_RPTR_ADDR				0x3067
130262306a36Sopenharmony_ci#define	CP_RB2_RPTR_ADDR_HI				0x3068
130362306a36Sopenharmony_ci#define	CP_RB2_WPTR					0x3069
130462306a36Sopenharmony_ci#define CP_INT_CNTL_RING0                               0x306A
130562306a36Sopenharmony_ci#define CP_INT_CNTL_RING1                               0x306B
130662306a36Sopenharmony_ci#define CP_INT_CNTL_RING2                               0x306C
130762306a36Sopenharmony_ci#       define CNTX_BUSY_INT_ENABLE                     (1 << 19)
130862306a36Sopenharmony_ci#       define CNTX_EMPTY_INT_ENABLE                    (1 << 20)
130962306a36Sopenharmony_ci#       define WAIT_MEM_SEM_INT_ENABLE                  (1 << 21)
131062306a36Sopenharmony_ci#       define TIME_STAMP_INT_ENABLE                    (1 << 26)
131162306a36Sopenharmony_ci#       define CP_RINGID2_INT_ENABLE                    (1 << 29)
131262306a36Sopenharmony_ci#       define CP_RINGID1_INT_ENABLE                    (1 << 30)
131362306a36Sopenharmony_ci#       define CP_RINGID0_INT_ENABLE                    (1 << 31)
131462306a36Sopenharmony_ci#define CP_INT_STATUS_RING0                             0x306D
131562306a36Sopenharmony_ci#define CP_INT_STATUS_RING1                             0x306E
131662306a36Sopenharmony_ci#define CP_INT_STATUS_RING2                             0x306F
131762306a36Sopenharmony_ci#       define WAIT_MEM_SEM_INT_STAT                    (1 << 21)
131862306a36Sopenharmony_ci#       define TIME_STAMP_INT_STAT                      (1 << 26)
131962306a36Sopenharmony_ci#       define CP_RINGID2_INT_STAT                      (1 << 29)
132062306a36Sopenharmony_ci#       define CP_RINGID1_INT_STAT                      (1 << 30)
132162306a36Sopenharmony_ci#       define CP_RINGID0_INT_STAT                      (1 << 31)
132262306a36Sopenharmony_ci
132362306a36Sopenharmony_ci#define	CP_MEM_SLP_CNTL					0x3079
132462306a36Sopenharmony_ci#       define CP_MEM_LS_EN                             (1 << 0)
132562306a36Sopenharmony_ci
132662306a36Sopenharmony_ci#define	CP_DEBUG					0x307F
132762306a36Sopenharmony_ci
132862306a36Sopenharmony_ci#define RLC_CNTL                                          0x30C0
132962306a36Sopenharmony_ci#       define RLC_ENABLE                                 (1 << 0)
133062306a36Sopenharmony_ci#define RLC_RL_BASE                                       0x30C1
133162306a36Sopenharmony_ci#define RLC_RL_SIZE                                       0x30C2
133262306a36Sopenharmony_ci#define RLC_LB_CNTL                                       0x30C3
133362306a36Sopenharmony_ci#       define LOAD_BALANCE_ENABLE                        (1 << 0)
133462306a36Sopenharmony_ci#define RLC_SAVE_AND_RESTORE_BASE                         0x30C4
133562306a36Sopenharmony_ci#define RLC_LB_CNTR_MAX                                   0x30C5
133662306a36Sopenharmony_ci#define RLC_LB_CNTR_INIT                                  0x30C6
133762306a36Sopenharmony_ci
133862306a36Sopenharmony_ci#define RLC_CLEAR_STATE_RESTORE_BASE                      0x30C8
133962306a36Sopenharmony_ci
134062306a36Sopenharmony_ci#define RLC_UCODE_ADDR                                    0x30CB
134162306a36Sopenharmony_ci#define RLC_UCODE_DATA                                    0x30CC
134262306a36Sopenharmony_ci
134362306a36Sopenharmony_ci#define RLC_GPU_CLOCK_COUNT_LSB                           0x30CE
134462306a36Sopenharmony_ci#define RLC_GPU_CLOCK_COUNT_MSB                           0x30CF
134562306a36Sopenharmony_ci#define RLC_CAPTURE_GPU_CLOCK_COUNT                       0x30D0
134662306a36Sopenharmony_ci#define RLC_MC_CNTL                                       0x30D1
134762306a36Sopenharmony_ci#define RLC_UCODE_CNTL                                    0x30D2
134862306a36Sopenharmony_ci#define RLC_STAT                                          0x30D3
134962306a36Sopenharmony_ci#       define RLC_BUSY_STATUS                            (1 << 0)
135062306a36Sopenharmony_ci#       define GFX_POWER_STATUS                           (1 << 1)
135162306a36Sopenharmony_ci#       define GFX_CLOCK_STATUS                           (1 << 2)
135262306a36Sopenharmony_ci#       define GFX_LS_STATUS                              (1 << 3)
135362306a36Sopenharmony_ci
135462306a36Sopenharmony_ci#define	RLC_PG_CNTL					0x30D7
135562306a36Sopenharmony_ci#	define GFX_PG_ENABLE				(1 << 0)
135662306a36Sopenharmony_ci#	define GFX_PG_SRC				(1 << 1)
135762306a36Sopenharmony_ci
135862306a36Sopenharmony_ci#define	RLC_CGTT_MGCG_OVERRIDE				0x3100
135962306a36Sopenharmony_ci#define	RLC_CGCG_CGLS_CTRL				0x3101
136062306a36Sopenharmony_ci#	define CGCG_EN					(1 << 0)
136162306a36Sopenharmony_ci#	define CGLS_EN					(1 << 1)
136262306a36Sopenharmony_ci
136362306a36Sopenharmony_ci#define	RLC_TTOP_D					0x3105
136462306a36Sopenharmony_ci#	define RLC_PUD(x)				((x) << 0)
136562306a36Sopenharmony_ci#	define RLC_PUD_MASK				(0xff << 0)
136662306a36Sopenharmony_ci#	define RLC_PDD(x)				((x) << 8)
136762306a36Sopenharmony_ci#	define RLC_PDD_MASK				(0xff << 8)
136862306a36Sopenharmony_ci#	define RLC_TTPD(x)				((x) << 16)
136962306a36Sopenharmony_ci#	define RLC_TTPD_MASK				(0xff << 16)
137062306a36Sopenharmony_ci#	define RLC_MSD(x)				((x) << 24)
137162306a36Sopenharmony_ci#	define RLC_MSD_MASK				(0xff << 24)
137262306a36Sopenharmony_ci
137362306a36Sopenharmony_ci#define RLC_LB_INIT_CU_MASK                               0x3107
137462306a36Sopenharmony_ci
137562306a36Sopenharmony_ci#define	RLC_PG_AO_CU_MASK				0x310B
137662306a36Sopenharmony_ci#define	RLC_MAX_PG_CU					0x310C
137762306a36Sopenharmony_ci#	define MAX_PU_CU(x)				((x) << 0)
137862306a36Sopenharmony_ci#	define MAX_PU_CU_MASK				(0xff << 0)
137962306a36Sopenharmony_ci#define	RLC_AUTO_PG_CTRL				0x310C
138062306a36Sopenharmony_ci#	define AUTO_PG_EN				(1 << 0)
138162306a36Sopenharmony_ci#	define GRBM_REG_SGIT(x)				((x) << 3)
138262306a36Sopenharmony_ci#	define GRBM_REG_SGIT_MASK			(0xffff << 3)
138362306a36Sopenharmony_ci#	define PG_AFTER_GRBM_REG_ST(x)			((x) << 19)
138462306a36Sopenharmony_ci#	define PG_AFTER_GRBM_REG_ST_MASK		(0x1fff << 19)
138562306a36Sopenharmony_ci
138662306a36Sopenharmony_ci#define RLC_SERDES_WR_MASTER_MASK_0                       0x3115
138762306a36Sopenharmony_ci#define RLC_SERDES_WR_MASTER_MASK_1                       0x3116
138862306a36Sopenharmony_ci#define RLC_SERDES_WR_CTRL                                0x3117
138962306a36Sopenharmony_ci
139062306a36Sopenharmony_ci#define RLC_SERDES_MASTER_BUSY_0                          0x3119
139162306a36Sopenharmony_ci#define RLC_SERDES_MASTER_BUSY_1                          0x311A
139262306a36Sopenharmony_ci
139362306a36Sopenharmony_ci#define RLC_GCPM_GENERAL_3                                0x311E
139462306a36Sopenharmony_ci
139562306a36Sopenharmony_ci#define	DB_RENDER_CONTROL				0xA000
139662306a36Sopenharmony_ci
139762306a36Sopenharmony_ci#define DB_DEPTH_INFO                                   0xA00F
139862306a36Sopenharmony_ci
139962306a36Sopenharmony_ci#define PA_SC_RASTER_CONFIG                             0xA0D4
140062306a36Sopenharmony_ci#	define RB_MAP_PKR0(x)				((x) << 0)
140162306a36Sopenharmony_ci#	define RB_MAP_PKR0_MASK				(0x3 << 0)
140262306a36Sopenharmony_ci#	define RB_MAP_PKR1(x)				((x) << 2)
140362306a36Sopenharmony_ci#	define RB_MAP_PKR1_MASK				(0x3 << 2)
140462306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_0                   0
140562306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_1                   1
140662306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_2                   2
140762306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_3                   3
140862306a36Sopenharmony_ci#	define RB_XSEL2(x)				((x) << 4)
140962306a36Sopenharmony_ci#	define RB_XSEL2_MASK				(0x3 << 4)
141062306a36Sopenharmony_ci#	define RB_XSEL					(1 << 6)
141162306a36Sopenharmony_ci#	define RB_YSEL					(1 << 7)
141262306a36Sopenharmony_ci#	define PKR_MAP(x)				((x) << 8)
141362306a36Sopenharmony_ci#	define PKR_MAP_MASK				(0x3 << 8)
141462306a36Sopenharmony_ci#       define RASTER_CONFIG_PKR_MAP_0			0
141562306a36Sopenharmony_ci#       define RASTER_CONFIG_PKR_MAP_1			1
141662306a36Sopenharmony_ci#       define RASTER_CONFIG_PKR_MAP_2			2
141762306a36Sopenharmony_ci#       define RASTER_CONFIG_PKR_MAP_3			3
141862306a36Sopenharmony_ci#	define PKR_XSEL(x)				((x) << 10)
141962306a36Sopenharmony_ci#	define PKR_XSEL_MASK				(0x3 << 10)
142062306a36Sopenharmony_ci#	define PKR_YSEL(x)				((x) << 12)
142162306a36Sopenharmony_ci#	define PKR_YSEL_MASK				(0x3 << 12)
142262306a36Sopenharmony_ci#	define SC_MAP(x)				((x) << 16)
142362306a36Sopenharmony_ci#	define SC_MAP_MASK				(0x3 << 16)
142462306a36Sopenharmony_ci#	define SC_XSEL(x)				((x) << 18)
142562306a36Sopenharmony_ci#	define SC_XSEL_MASK				(0x3 << 18)
142662306a36Sopenharmony_ci#	define SC_YSEL(x)				((x) << 20)
142762306a36Sopenharmony_ci#	define SC_YSEL_MASK				(0x3 << 20)
142862306a36Sopenharmony_ci#	define SE_MAP(x)				((x) << 24)
142962306a36Sopenharmony_ci#	define SE_MAP_MASK				(0x3 << 24)
143062306a36Sopenharmony_ci#       define RASTER_CONFIG_SE_MAP_0			0
143162306a36Sopenharmony_ci#       define RASTER_CONFIG_SE_MAP_1			1
143262306a36Sopenharmony_ci#       define RASTER_CONFIG_SE_MAP_2			2
143362306a36Sopenharmony_ci#       define RASTER_CONFIG_SE_MAP_3			3
143462306a36Sopenharmony_ci#	define SE_XSEL(x)				((x) << 26)
143562306a36Sopenharmony_ci#	define SE_XSEL_MASK				(0x3 << 26)
143662306a36Sopenharmony_ci#	define SE_YSEL(x)				((x) << 28)
143762306a36Sopenharmony_ci#	define SE_YSEL_MASK				(0x3 << 28)
143862306a36Sopenharmony_ci
143962306a36Sopenharmony_ci
144062306a36Sopenharmony_ci#define VGT_EVENT_INITIATOR                             0xA2A4
144162306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS1                   (1 << 0)
144262306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS2                   (2 << 0)
144362306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS3                   (3 << 0)
144462306a36Sopenharmony_ci#       define CACHE_FLUSH_TS                           (4 << 0)
144562306a36Sopenharmony_ci#       define CACHE_FLUSH                              (6 << 0)
144662306a36Sopenharmony_ci#       define CS_PARTIAL_FLUSH                         (7 << 0)
144762306a36Sopenharmony_ci#       define VGT_STREAMOUT_RESET                      (10 << 0)
144862306a36Sopenharmony_ci#       define END_OF_PIPE_INCR_DE                      (11 << 0)
144962306a36Sopenharmony_ci#       define END_OF_PIPE_IB_END                       (12 << 0)
145062306a36Sopenharmony_ci#       define RST_PIX_CNT                              (13 << 0)
145162306a36Sopenharmony_ci#       define VS_PARTIAL_FLUSH                         (15 << 0)
145262306a36Sopenharmony_ci#       define PS_PARTIAL_FLUSH                         (16 << 0)
145362306a36Sopenharmony_ci#       define CACHE_FLUSH_AND_INV_TS_EVENT             (20 << 0)
145462306a36Sopenharmony_ci#       define ZPASS_DONE                               (21 << 0)
145562306a36Sopenharmony_ci#       define CACHE_FLUSH_AND_INV_EVENT                (22 << 0)
145662306a36Sopenharmony_ci#       define PERFCOUNTER_START                        (23 << 0)
145762306a36Sopenharmony_ci#       define PERFCOUNTER_STOP                         (24 << 0)
145862306a36Sopenharmony_ci#       define PIPELINESTAT_START                       (25 << 0)
145962306a36Sopenharmony_ci#       define PIPELINESTAT_STOP                        (26 << 0)
146062306a36Sopenharmony_ci#       define PERFCOUNTER_SAMPLE                       (27 << 0)
146162306a36Sopenharmony_ci#       define SAMPLE_PIPELINESTAT                      (30 << 0)
146262306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS                    (32 << 0)
146362306a36Sopenharmony_ci#       define RESET_VTX_CNT                            (33 << 0)
146462306a36Sopenharmony_ci#       define VGT_FLUSH                                (36 << 0)
146562306a36Sopenharmony_ci#       define BOTTOM_OF_PIPE_TS                        (40 << 0)
146662306a36Sopenharmony_ci#       define DB_CACHE_FLUSH_AND_INV                   (42 << 0)
146762306a36Sopenharmony_ci#       define FLUSH_AND_INV_DB_DATA_TS                 (43 << 0)
146862306a36Sopenharmony_ci#       define FLUSH_AND_INV_DB_META                    (44 << 0)
146962306a36Sopenharmony_ci#       define FLUSH_AND_INV_CB_DATA_TS                 (45 << 0)
147062306a36Sopenharmony_ci#       define FLUSH_AND_INV_CB_META                    (46 << 0)
147162306a36Sopenharmony_ci#       define CS_DONE                                  (47 << 0)
147262306a36Sopenharmony_ci#       define PS_DONE                                  (48 << 0)
147362306a36Sopenharmony_ci#       define FLUSH_AND_INV_CB_PIXEL_DATA              (49 << 0)
147462306a36Sopenharmony_ci#       define THREAD_TRACE_START                       (51 << 0)
147562306a36Sopenharmony_ci#       define THREAD_TRACE_STOP                        (52 << 0)
147662306a36Sopenharmony_ci#       define THREAD_TRACE_FLUSH                       (54 << 0)
147762306a36Sopenharmony_ci#       define THREAD_TRACE_FINISH                      (55 << 0)
147862306a36Sopenharmony_ci
147962306a36Sopenharmony_ci/* PIF PHY0 registers idx/data 0x8/0xc */
148062306a36Sopenharmony_ci#define PB0_PIF_CNTL                                      0x10
148162306a36Sopenharmony_ci#       define LS2_EXIT_TIME(x)                           ((x) << 17)
148262306a36Sopenharmony_ci#       define LS2_EXIT_TIME_MASK                         (0x7 << 17)
148362306a36Sopenharmony_ci#       define LS2_EXIT_TIME_SHIFT                        17
148462306a36Sopenharmony_ci#define PB0_PIF_PAIRING                                   0x11
148562306a36Sopenharmony_ci#       define MULTI_PIF                                  (1 << 25)
148662306a36Sopenharmony_ci#define PB0_PIF_PWRDOWN_0                                 0x12
148762306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_0(x)               ((x) << 7)
148862306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_0_MASK             (0x7 << 7)
148962306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_0_SHIFT            7
149062306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_0(x)                ((x) << 10)
149162306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_0_MASK              (0x7 << 10)
149262306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_0_SHIFT             10
149362306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_0(x)                      ((x) << 24)
149462306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_0_MASK                    (0x7 << 24)
149562306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_0_SHIFT                   24
149662306a36Sopenharmony_ci#define PB0_PIF_PWRDOWN_1                                 0x13
149762306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_1(x)               ((x) << 7)
149862306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_1_MASK             (0x7 << 7)
149962306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_1_SHIFT            7
150062306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_1(x)                ((x) << 10)
150162306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_1_MASK              (0x7 << 10)
150262306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_1_SHIFT             10
150362306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_1(x)                      ((x) << 24)
150462306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_1_MASK                    (0x7 << 24)
150562306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_1_SHIFT                   24
150662306a36Sopenharmony_ci
150762306a36Sopenharmony_ci#define PB0_PIF_PWRDOWN_2                                 0x17
150862306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_2(x)               ((x) << 7)
150962306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_2_MASK             (0x7 << 7)
151062306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_2_SHIFT            7
151162306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_2(x)                ((x) << 10)
151262306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_2_MASK              (0x7 << 10)
151362306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_2_SHIFT             10
151462306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_2(x)                      ((x) << 24)
151562306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_2_MASK                    (0x7 << 24)
151662306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_2_SHIFT                   24
151762306a36Sopenharmony_ci#define PB0_PIF_PWRDOWN_3                                 0x18
151862306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_3(x)               ((x) << 7)
151962306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_3_MASK             (0x7 << 7)
152062306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_3_SHIFT            7
152162306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_3(x)                ((x) << 10)
152262306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_3_MASK              (0x7 << 10)
152362306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_3_SHIFT             10
152462306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_3(x)                      ((x) << 24)
152562306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_3_MASK                    (0x7 << 24)
152662306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_3_SHIFT                   24
152762306a36Sopenharmony_ci/* PIF PHY1 registers idx/data 0x10/0x14 */
152862306a36Sopenharmony_ci#define PB1_PIF_CNTL                                      0x10
152962306a36Sopenharmony_ci#define PB1_PIF_PAIRING                                   0x11
153062306a36Sopenharmony_ci#define PB1_PIF_PWRDOWN_0                                 0x12
153162306a36Sopenharmony_ci#define PB1_PIF_PWRDOWN_1                                 0x13
153262306a36Sopenharmony_ci
153362306a36Sopenharmony_ci#define PB1_PIF_PWRDOWN_2                                 0x17
153462306a36Sopenharmony_ci#define PB1_PIF_PWRDOWN_3                                 0x18
153562306a36Sopenharmony_ci/* PCIE registers idx/data 0x30/0x34 */
153662306a36Sopenharmony_ci#define PCIE_CNTL2                                        0x1c /* PCIE */
153762306a36Sopenharmony_ci#       define SLV_MEM_LS_EN                              (1 << 16)
153862306a36Sopenharmony_ci#       define SLV_MEM_AGGRESSIVE_LS_EN                   (1 << 17)
153962306a36Sopenharmony_ci#       define MST_MEM_LS_EN                              (1 << 18)
154062306a36Sopenharmony_ci#       define REPLAY_MEM_LS_EN                           (1 << 19)
154162306a36Sopenharmony_ci#define PCIE_LC_STATUS1                                   0x28 /* PCIE */
154262306a36Sopenharmony_ci#       define LC_REVERSE_RCVR                            (1 << 0)
154362306a36Sopenharmony_ci#       define LC_REVERSE_XMIT                            (1 << 1)
154462306a36Sopenharmony_ci#       define LC_OPERATING_LINK_WIDTH_MASK               (0x7 << 2)
154562306a36Sopenharmony_ci#       define LC_OPERATING_LINK_WIDTH_SHIFT              2
154662306a36Sopenharmony_ci#       define LC_DETECTED_LINK_WIDTH_MASK                (0x7 << 5)
154762306a36Sopenharmony_ci#       define LC_DETECTED_LINK_WIDTH_SHIFT               5
154862306a36Sopenharmony_ci
154962306a36Sopenharmony_ci#define PCIE_P_CNTL                                       0x40 /* PCIE */
155062306a36Sopenharmony_ci#       define P_IGNORE_EDB_ERR                           (1 << 6)
155162306a36Sopenharmony_ci
155262306a36Sopenharmony_ci/* PCIE PORT registers idx/data 0x38/0x3c */
155362306a36Sopenharmony_ci#define PCIE_LC_CNTL                                      0xa0
155462306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY(x)                       ((x) << 8)
155562306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY_MASK                     (0xf << 8)
155662306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY_SHIFT                    8
155762306a36Sopenharmony_ci#       define LC_L1_INACTIVITY(x)                        ((x) << 12)
155862306a36Sopenharmony_ci#       define LC_L1_INACTIVITY_MASK                      (0xf << 12)
155962306a36Sopenharmony_ci#       define LC_L1_INACTIVITY_SHIFT                     12
156062306a36Sopenharmony_ci#       define LC_PMI_TO_L1_DIS                           (1 << 16)
156162306a36Sopenharmony_ci#       define LC_ASPM_TO_L1_DIS                          (1 << 24)
156262306a36Sopenharmony_ci#define PCIE_LC_LINK_WIDTH_CNTL                           0xa2 /* PCIE_P */
156362306a36Sopenharmony_ci#       define LC_LINK_WIDTH_SHIFT                        0
156462306a36Sopenharmony_ci#       define LC_LINK_WIDTH_MASK                         0x7
156562306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X0                           0
156662306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X1                           1
156762306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X2                           2
156862306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X4                           3
156962306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X8                           4
157062306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X16                          6
157162306a36Sopenharmony_ci#       define LC_LINK_WIDTH_RD_SHIFT                     4
157262306a36Sopenharmony_ci#       define LC_LINK_WIDTH_RD_MASK                      0x70
157362306a36Sopenharmony_ci#       define LC_RECONFIG_ARC_MISSING_ESCAPE             (1 << 7)
157462306a36Sopenharmony_ci#       define LC_RECONFIG_NOW                            (1 << 8)
157562306a36Sopenharmony_ci#       define LC_RENEGOTIATION_SUPPORT                   (1 << 9)
157662306a36Sopenharmony_ci#       define LC_RENEGOTIATE_EN                          (1 << 10)
157762306a36Sopenharmony_ci#       define LC_SHORT_RECONFIG_EN                       (1 << 11)
157862306a36Sopenharmony_ci#       define LC_UPCONFIGURE_SUPPORT                     (1 << 12)
157962306a36Sopenharmony_ci#       define LC_UPCONFIGURE_DIS                         (1 << 13)
158062306a36Sopenharmony_ci#       define LC_DYN_LANES_PWR_STATE(x)                  ((x) << 21)
158162306a36Sopenharmony_ci#       define LC_DYN_LANES_PWR_STATE_MASK                (0x3 << 21)
158262306a36Sopenharmony_ci#       define LC_DYN_LANES_PWR_STATE_SHIFT               21
158362306a36Sopenharmony_ci#define PCIE_LC_N_FTS_CNTL                                0xa3 /* PCIE_P */
158462306a36Sopenharmony_ci#       define LC_XMIT_N_FTS(x)                           ((x) << 0)
158562306a36Sopenharmony_ci#       define LC_XMIT_N_FTS_MASK                         (0xff << 0)
158662306a36Sopenharmony_ci#       define LC_XMIT_N_FTS_SHIFT                        0
158762306a36Sopenharmony_ci#       define LC_XMIT_N_FTS_OVERRIDE_EN                  (1 << 8)
158862306a36Sopenharmony_ci#       define LC_N_FTS_MASK                              (0xff << 24)
158962306a36Sopenharmony_ci#define PCIE_LC_SPEED_CNTL                                0xa4 /* PCIE_P */
159062306a36Sopenharmony_ci#       define LC_GEN2_EN_STRAP                           (1 << 0)
159162306a36Sopenharmony_ci#       define LC_GEN3_EN_STRAP                           (1 << 1)
159262306a36Sopenharmony_ci#       define LC_TARGET_LINK_SPEED_OVERRIDE_EN           (1 << 2)
159362306a36Sopenharmony_ci#       define LC_TARGET_LINK_SPEED_OVERRIDE_MASK         (0x3 << 3)
159462306a36Sopenharmony_ci#       define LC_TARGET_LINK_SPEED_OVERRIDE_SHIFT        3
159562306a36Sopenharmony_ci#       define LC_FORCE_EN_SW_SPEED_CHANGE                (1 << 5)
159662306a36Sopenharmony_ci#       define LC_FORCE_DIS_SW_SPEED_CHANGE               (1 << 6)
159762306a36Sopenharmony_ci#       define LC_FORCE_EN_HW_SPEED_CHANGE                (1 << 7)
159862306a36Sopenharmony_ci#       define LC_FORCE_DIS_HW_SPEED_CHANGE               (1 << 8)
159962306a36Sopenharmony_ci#       define LC_INITIATE_LINK_SPEED_CHANGE              (1 << 9)
160062306a36Sopenharmony_ci#       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK      (0x3 << 10)
160162306a36Sopenharmony_ci#       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT     10
160262306a36Sopenharmony_ci#       define LC_CURRENT_DATA_RATE_MASK                  (0x3 << 13) /* 0/1/2 = gen1/2/3 */
160362306a36Sopenharmony_ci#       define LC_CURRENT_DATA_RATE_SHIFT                 13
160462306a36Sopenharmony_ci#       define LC_CLR_FAILED_SPD_CHANGE_CNT               (1 << 16)
160562306a36Sopenharmony_ci#       define LC_OTHER_SIDE_EVER_SENT_GEN2               (1 << 18)
160662306a36Sopenharmony_ci#       define LC_OTHER_SIDE_SUPPORTS_GEN2                (1 << 19)
160762306a36Sopenharmony_ci#       define LC_OTHER_SIDE_EVER_SENT_GEN3               (1 << 20)
160862306a36Sopenharmony_ci#       define LC_OTHER_SIDE_SUPPORTS_GEN3                (1 << 21)
160962306a36Sopenharmony_ci
161062306a36Sopenharmony_ci#define PCIE_LC_CNTL2                                     0xb1
161162306a36Sopenharmony_ci#       define LC_ALLOW_PDWN_IN_L1                        (1 << 17)
161262306a36Sopenharmony_ci#       define LC_ALLOW_PDWN_IN_L23                       (1 << 18)
161362306a36Sopenharmony_ci
161462306a36Sopenharmony_ci#define PCIE_LC_CNTL3                                     0xb5 /* PCIE_P */
161562306a36Sopenharmony_ci#       define LC_GO_TO_RECOVERY                          (1 << 30)
161662306a36Sopenharmony_ci#define PCIE_LC_CNTL4                                     0xb6 /* PCIE_P */
161762306a36Sopenharmony_ci#       define LC_REDO_EQ                                 (1 << 5)
161862306a36Sopenharmony_ci#       define LC_SET_QUIESCE                             (1 << 13)
161962306a36Sopenharmony_ci
162062306a36Sopenharmony_ci/*
162162306a36Sopenharmony_ci * UVD
162262306a36Sopenharmony_ci */
162362306a36Sopenharmony_ci#define UVD_UDEC_ADDR_CONFIG				0x3bd3
162462306a36Sopenharmony_ci#define UVD_UDEC_DB_ADDR_CONFIG				0x3bd4
162562306a36Sopenharmony_ci#define UVD_UDEC_DBW_ADDR_CONFIG			0x3bd5
162662306a36Sopenharmony_ci#define UVD_RBC_RB_RPTR					0x3da4
162762306a36Sopenharmony_ci#define UVD_RBC_RB_WPTR					0x3da5
162862306a36Sopenharmony_ci#define UVD_STATUS					0x3daf
162962306a36Sopenharmony_ci
163062306a36Sopenharmony_ci#define	UVD_CGC_CTRL					0x3dc2
163162306a36Sopenharmony_ci#	define DCM					(1 << 0)
163262306a36Sopenharmony_ci#	define CG_DT(x)					((x) << 2)
163362306a36Sopenharmony_ci#	define CG_DT_MASK				(0xf << 2)
163462306a36Sopenharmony_ci#	define CLK_OD(x)				((x) << 6)
163562306a36Sopenharmony_ci#	define CLK_OD_MASK				(0x1f << 6)
163662306a36Sopenharmony_ci
163762306a36Sopenharmony_ci /* UVD CTX indirect */
163862306a36Sopenharmony_ci#define	UVD_CGC_MEM_CTRL				0xC0
163962306a36Sopenharmony_ci#define	UVD_CGC_CTRL2					0xC1
164062306a36Sopenharmony_ci#	define DYN_OR_EN				(1 << 0)
164162306a36Sopenharmony_ci#	define DYN_RR_EN				(1 << 1)
164262306a36Sopenharmony_ci#	define G_DIV_ID(x)				((x) << 2)
164362306a36Sopenharmony_ci#	define G_DIV_ID_MASK				(0x7 << 2)
164462306a36Sopenharmony_ci
164562306a36Sopenharmony_ci/*
164662306a36Sopenharmony_ci * PM4
164762306a36Sopenharmony_ci */
164862306a36Sopenharmony_ci#define PACKET_TYPE0    0
164962306a36Sopenharmony_ci#define PACKET0(reg, n) ((PACKET_TYPE0 << 30) |				\
165062306a36Sopenharmony_ci                         ((reg) & 0xFFFF) |				\
165162306a36Sopenharmony_ci                         ((n) & 0x3FFF) << 16)
165262306a36Sopenharmony_ci#define CP_PACKET2			0x80000000
165362306a36Sopenharmony_ci#define		PACKET2_PAD_SHIFT		0
165462306a36Sopenharmony_ci#define		PACKET2_PAD_MASK		(0x3fffffff << 0)
165562306a36Sopenharmony_ci
165662306a36Sopenharmony_ci#define PACKET2(v)	(CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
165762306a36Sopenharmony_ci#define RADEON_PACKET_TYPE3 3
165862306a36Sopenharmony_ci#define PACKET3(op, n)	((RADEON_PACKET_TYPE3 << 30) |			\
165962306a36Sopenharmony_ci			 (((op) & 0xFF) << 8) |				\
166062306a36Sopenharmony_ci			 ((n) & 0x3FFF) << 16)
166162306a36Sopenharmony_ci
166262306a36Sopenharmony_ci#define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1)
166362306a36Sopenharmony_ci
166462306a36Sopenharmony_ci/* Packet 3 types */
166562306a36Sopenharmony_ci#define	PACKET3_NOP					0x10
166662306a36Sopenharmony_ci#define	PACKET3_SET_BASE				0x11
166762306a36Sopenharmony_ci#define		PACKET3_BASE_INDEX(x)                  ((x) << 0)
166862306a36Sopenharmony_ci#define			GDS_PARTITION_BASE		2
166962306a36Sopenharmony_ci#define			CE_PARTITION_BASE		3
167062306a36Sopenharmony_ci#define	PACKET3_CLEAR_STATE				0x12
167162306a36Sopenharmony_ci#define	PACKET3_INDEX_BUFFER_SIZE			0x13
167262306a36Sopenharmony_ci#define	PACKET3_DISPATCH_DIRECT				0x15
167362306a36Sopenharmony_ci#define	PACKET3_DISPATCH_INDIRECT			0x16
167462306a36Sopenharmony_ci#define	PACKET3_ALLOC_GDS				0x1B
167562306a36Sopenharmony_ci#define	PACKET3_WRITE_GDS_RAM				0x1C
167662306a36Sopenharmony_ci#define	PACKET3_ATOMIC_GDS				0x1D
167762306a36Sopenharmony_ci#define	PACKET3_ATOMIC					0x1E
167862306a36Sopenharmony_ci#define	PACKET3_OCCLUSION_QUERY				0x1F
167962306a36Sopenharmony_ci#define	PACKET3_SET_PREDICATION				0x20
168062306a36Sopenharmony_ci#define	PACKET3_REG_RMW					0x21
168162306a36Sopenharmony_ci#define	PACKET3_COND_EXEC				0x22
168262306a36Sopenharmony_ci#define	PACKET3_PRED_EXEC				0x23
168362306a36Sopenharmony_ci#define	PACKET3_DRAW_INDIRECT				0x24
168462306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_INDIRECT			0x25
168562306a36Sopenharmony_ci#define	PACKET3_INDEX_BASE				0x26
168662306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_2				0x27
168762306a36Sopenharmony_ci#define	PACKET3_CONTEXT_CONTROL				0x28
168862306a36Sopenharmony_ci#define	PACKET3_INDEX_TYPE				0x2A
168962306a36Sopenharmony_ci#define	PACKET3_DRAW_INDIRECT_MULTI			0x2C
169062306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_AUTO				0x2D
169162306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_IMMD				0x2E
169262306a36Sopenharmony_ci#define	PACKET3_NUM_INSTANCES				0x2F
169362306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_MULTI_AUTO			0x30
169462306a36Sopenharmony_ci#define	PACKET3_INDIRECT_BUFFER_CONST			0x31
169562306a36Sopenharmony_ci#define	PACKET3_INDIRECT_BUFFER				0x3F
169662306a36Sopenharmony_ci#define	PACKET3_STRMOUT_BUFFER_UPDATE			0x34
169762306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_OFFSET_2			0x35
169862306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_MULTI_ELEMENT		0x36
169962306a36Sopenharmony_ci#define	PACKET3_WRITE_DATA				0x37
170062306a36Sopenharmony_ci#define		WRITE_DATA_DST_SEL(x)                   ((x) << 8)
170162306a36Sopenharmony_ci                /* 0 - register
170262306a36Sopenharmony_ci		 * 1 - memory (sync - via GRBM)
170362306a36Sopenharmony_ci		 * 2 - tc/l2
170462306a36Sopenharmony_ci		 * 3 - gds
170562306a36Sopenharmony_ci		 * 4 - reserved
170662306a36Sopenharmony_ci		 * 5 - memory (async - direct)
170762306a36Sopenharmony_ci		 */
170862306a36Sopenharmony_ci#define		WR_ONE_ADDR                             (1 << 16)
170962306a36Sopenharmony_ci#define		WR_CONFIRM                              (1 << 20)
171062306a36Sopenharmony_ci#define		WRITE_DATA_ENGINE_SEL(x)                ((x) << 30)
171162306a36Sopenharmony_ci                /* 0 - me
171262306a36Sopenharmony_ci		 * 1 - pfp
171362306a36Sopenharmony_ci		 * 2 - ce
171462306a36Sopenharmony_ci		 */
171562306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_INDIRECT_MULTI		0x38
171662306a36Sopenharmony_ci#define	PACKET3_MEM_SEMAPHORE				0x39
171762306a36Sopenharmony_ci#define	PACKET3_MPEG_INDEX				0x3A
171862306a36Sopenharmony_ci#define	PACKET3_COPY_DW					0x3B
171962306a36Sopenharmony_ci#define	PACKET3_WAIT_REG_MEM				0x3C
172062306a36Sopenharmony_ci#define		WAIT_REG_MEM_FUNCTION(x)                ((x) << 0)
172162306a36Sopenharmony_ci                /* 0 - always
172262306a36Sopenharmony_ci		 * 1 - <
172362306a36Sopenharmony_ci		 * 2 - <=
172462306a36Sopenharmony_ci		 * 3 - ==
172562306a36Sopenharmony_ci		 * 4 - !=
172662306a36Sopenharmony_ci		 * 5 - >=
172762306a36Sopenharmony_ci		 * 6 - >
172862306a36Sopenharmony_ci		 */
172962306a36Sopenharmony_ci#define		WAIT_REG_MEM_MEM_SPACE(x)               ((x) << 4)
173062306a36Sopenharmony_ci                /* 0 - reg
173162306a36Sopenharmony_ci		 * 1 - mem
173262306a36Sopenharmony_ci		 */
173362306a36Sopenharmony_ci#define		WAIT_REG_MEM_ENGINE(x)                  ((x) << 8)
173462306a36Sopenharmony_ci                /* 0 - me
173562306a36Sopenharmony_ci		 * 1 - pfp
173662306a36Sopenharmony_ci		 */
173762306a36Sopenharmony_ci#define	PACKET3_MEM_WRITE				0x3D
173862306a36Sopenharmony_ci#define	PACKET3_COPY_DATA				0x40
173962306a36Sopenharmony_ci#define	PACKET3_CP_DMA					0x41
174062306a36Sopenharmony_ci/* 1. header
174162306a36Sopenharmony_ci * 2. SRC_ADDR_LO or DATA [31:0]
174262306a36Sopenharmony_ci * 3. CP_SYNC [31] | SRC_SEL [30:29] | ENGINE [27] | DST_SEL [21:20] |
174362306a36Sopenharmony_ci *    SRC_ADDR_HI [7:0]
174462306a36Sopenharmony_ci * 4. DST_ADDR_LO [31:0]
174562306a36Sopenharmony_ci * 5. DST_ADDR_HI [7:0]
174662306a36Sopenharmony_ci * 6. COMMAND [30:21] | BYTE_COUNT [20:0]
174762306a36Sopenharmony_ci */
174862306a36Sopenharmony_ci#              define PACKET3_CP_DMA_DST_SEL(x)    ((x) << 20)
174962306a36Sopenharmony_ci                /* 0 - DST_ADDR
175062306a36Sopenharmony_ci		 * 1 - GDS
175162306a36Sopenharmony_ci		 */
175262306a36Sopenharmony_ci#              define PACKET3_CP_DMA_ENGINE(x)     ((x) << 27)
175362306a36Sopenharmony_ci                /* 0 - ME
175462306a36Sopenharmony_ci		 * 1 - PFP
175562306a36Sopenharmony_ci		 */
175662306a36Sopenharmony_ci#              define PACKET3_CP_DMA_SRC_SEL(x)    ((x) << 29)
175762306a36Sopenharmony_ci                /* 0 - SRC_ADDR
175862306a36Sopenharmony_ci		 * 1 - GDS
175962306a36Sopenharmony_ci		 * 2 - DATA
176062306a36Sopenharmony_ci		 */
176162306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CP_SYNC       (1 << 31)
176262306a36Sopenharmony_ci/* COMMAND */
176362306a36Sopenharmony_ci#              define PACKET3_CP_DMA_DIS_WC        (1 << 21)
176462306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22)
176562306a36Sopenharmony_ci                /* 0 - none
176662306a36Sopenharmony_ci		 * 1 - 8 in 16
176762306a36Sopenharmony_ci		 * 2 - 8 in 32
176862306a36Sopenharmony_ci		 * 3 - 8 in 64
176962306a36Sopenharmony_ci		 */
177062306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_DST_SWAP(x) ((x) << 24)
177162306a36Sopenharmony_ci                /* 0 - none
177262306a36Sopenharmony_ci		 * 1 - 8 in 16
177362306a36Sopenharmony_ci		 * 2 - 8 in 32
177462306a36Sopenharmony_ci		 * 3 - 8 in 64
177562306a36Sopenharmony_ci		 */
177662306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_SAS       (1 << 26)
177762306a36Sopenharmony_ci                /* 0 - memory
177862306a36Sopenharmony_ci		 * 1 - register
177962306a36Sopenharmony_ci		 */
178062306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_DAS       (1 << 27)
178162306a36Sopenharmony_ci                /* 0 - memory
178262306a36Sopenharmony_ci		 * 1 - register
178362306a36Sopenharmony_ci		 */
178462306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_SAIC      (1 << 28)
178562306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_DAIC      (1 << 29)
178662306a36Sopenharmony_ci#              define PACKET3_CP_DMA_CMD_RAW_WAIT  (1 << 30)
178762306a36Sopenharmony_ci#define	PACKET3_PFP_SYNC_ME				0x42
178862306a36Sopenharmony_ci#define	PACKET3_SURFACE_SYNC				0x43
178962306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_0_ENA      (1 << 0)
179062306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_1_ENA      (1 << 1)
179162306a36Sopenharmony_ci#              define PACKET3_CB0_DEST_BASE_ENA    (1 << 6)
179262306a36Sopenharmony_ci#              define PACKET3_CB1_DEST_BASE_ENA    (1 << 7)
179362306a36Sopenharmony_ci#              define PACKET3_CB2_DEST_BASE_ENA    (1 << 8)
179462306a36Sopenharmony_ci#              define PACKET3_CB3_DEST_BASE_ENA    (1 << 9)
179562306a36Sopenharmony_ci#              define PACKET3_CB4_DEST_BASE_ENA    (1 << 10)
179662306a36Sopenharmony_ci#              define PACKET3_CB5_DEST_BASE_ENA    (1 << 11)
179762306a36Sopenharmony_ci#              define PACKET3_CB6_DEST_BASE_ENA    (1 << 12)
179862306a36Sopenharmony_ci#              define PACKET3_CB7_DEST_BASE_ENA    (1 << 13)
179962306a36Sopenharmony_ci#              define PACKET3_DB_DEST_BASE_ENA     (1 << 14)
180062306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_2_ENA      (1 << 19)
180162306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_3_ENA      (1 << 21)
180262306a36Sopenharmony_ci#              define PACKET3_TCL1_ACTION_ENA      (1 << 22)
180362306a36Sopenharmony_ci#              define PACKET3_TC_ACTION_ENA        (1 << 23)
180462306a36Sopenharmony_ci#              define PACKET3_CB_ACTION_ENA        (1 << 25)
180562306a36Sopenharmony_ci#              define PACKET3_DB_ACTION_ENA        (1 << 26)
180662306a36Sopenharmony_ci#              define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27)
180762306a36Sopenharmony_ci#              define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29)
180862306a36Sopenharmony_ci#define	PACKET3_ME_INITIALIZE				0x44
180962306a36Sopenharmony_ci#define		PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
181062306a36Sopenharmony_ci#define	PACKET3_COND_WRITE				0x45
181162306a36Sopenharmony_ci#define	PACKET3_EVENT_WRITE				0x46
181262306a36Sopenharmony_ci#define		EVENT_TYPE(x)                           ((x) << 0)
181362306a36Sopenharmony_ci#define		EVENT_INDEX(x)                          ((x) << 8)
181462306a36Sopenharmony_ci                /* 0 - any non-TS event
181562306a36Sopenharmony_ci		 * 1 - ZPASS_DONE
181662306a36Sopenharmony_ci		 * 2 - SAMPLE_PIPELINESTAT
181762306a36Sopenharmony_ci		 * 3 - SAMPLE_STREAMOUTSTAT*
181862306a36Sopenharmony_ci		 * 4 - *S_PARTIAL_FLUSH
181962306a36Sopenharmony_ci		 * 5 - EOP events
182062306a36Sopenharmony_ci		 * 6 - EOS events
182162306a36Sopenharmony_ci		 * 7 - CACHE_FLUSH, CACHE_FLUSH_AND_INV_EVENT
182262306a36Sopenharmony_ci		 */
182362306a36Sopenharmony_ci#define		INV_L2                                  (1 << 20)
182462306a36Sopenharmony_ci                /* INV TC L2 cache when EVENT_INDEX = 7 */
182562306a36Sopenharmony_ci#define	PACKET3_EVENT_WRITE_EOP				0x47
182662306a36Sopenharmony_ci#define		DATA_SEL(x)                             ((x) << 29)
182762306a36Sopenharmony_ci                /* 0 - discard
182862306a36Sopenharmony_ci		 * 1 - send low 32bit data
182962306a36Sopenharmony_ci		 * 2 - send 64bit data
183062306a36Sopenharmony_ci		 * 3 - send 64bit counter value
183162306a36Sopenharmony_ci		 */
183262306a36Sopenharmony_ci#define		INT_SEL(x)                              ((x) << 24)
183362306a36Sopenharmony_ci                /* 0 - none
183462306a36Sopenharmony_ci		 * 1 - interrupt only (DATA_SEL = 0)
183562306a36Sopenharmony_ci		 * 2 - interrupt when data write is confirmed
183662306a36Sopenharmony_ci		 */
183762306a36Sopenharmony_ci#define	PACKET3_EVENT_WRITE_EOS				0x48
183862306a36Sopenharmony_ci#define	PACKET3_PREAMBLE_CNTL				0x4A
183962306a36Sopenharmony_ci#              define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE     (2 << 28)
184062306a36Sopenharmony_ci#              define PACKET3_PREAMBLE_END_CLEAR_STATE       (3 << 28)
184162306a36Sopenharmony_ci#define	PACKET3_ONE_REG_WRITE				0x57
184262306a36Sopenharmony_ci#define	PACKET3_LOAD_CONFIG_REG				0x5F
184362306a36Sopenharmony_ci#define	PACKET3_LOAD_CONTEXT_REG			0x60
184462306a36Sopenharmony_ci#define	PACKET3_LOAD_SH_REG				0x61
184562306a36Sopenharmony_ci#define	PACKET3_SET_CONFIG_REG				0x68
184662306a36Sopenharmony_ci#define		PACKET3_SET_CONFIG_REG_START			0x00002000
184762306a36Sopenharmony_ci#define		PACKET3_SET_CONFIG_REG_END			0x00002c00
184862306a36Sopenharmony_ci#define	PACKET3_SET_CONTEXT_REG				0x69
184962306a36Sopenharmony_ci#define		PACKET3_SET_CONTEXT_REG_START			0x000a000
185062306a36Sopenharmony_ci#define		PACKET3_SET_CONTEXT_REG_END			0x000a400
185162306a36Sopenharmony_ci#define	PACKET3_SET_CONTEXT_REG_INDIRECT		0x73
185262306a36Sopenharmony_ci#define	PACKET3_SET_RESOURCE_INDIRECT			0x74
185362306a36Sopenharmony_ci#define	PACKET3_SET_SH_REG				0x76
185462306a36Sopenharmony_ci#define		PACKET3_SET_SH_REG_START			0x00002c00
185562306a36Sopenharmony_ci#define		PACKET3_SET_SH_REG_END				0x00003000
185662306a36Sopenharmony_ci#define	PACKET3_SET_SH_REG_OFFSET			0x77
185762306a36Sopenharmony_ci#define	PACKET3_ME_WRITE				0x7A
185862306a36Sopenharmony_ci#define	PACKET3_SCRATCH_RAM_WRITE			0x7D
185962306a36Sopenharmony_ci#define	PACKET3_SCRATCH_RAM_READ			0x7E
186062306a36Sopenharmony_ci#define	PACKET3_CE_WRITE				0x7F
186162306a36Sopenharmony_ci#define	PACKET3_LOAD_CONST_RAM				0x80
186262306a36Sopenharmony_ci#define	PACKET3_WRITE_CONST_RAM				0x81
186362306a36Sopenharmony_ci#define	PACKET3_WRITE_CONST_RAM_OFFSET			0x82
186462306a36Sopenharmony_ci#define	PACKET3_DUMP_CONST_RAM				0x83
186562306a36Sopenharmony_ci#define	PACKET3_INCREMENT_CE_COUNTER			0x84
186662306a36Sopenharmony_ci#define	PACKET3_INCREMENT_DE_COUNTER			0x85
186762306a36Sopenharmony_ci#define	PACKET3_WAIT_ON_CE_COUNTER			0x86
186862306a36Sopenharmony_ci#define	PACKET3_WAIT_ON_DE_COUNTER			0x87
186962306a36Sopenharmony_ci#define	PACKET3_WAIT_ON_DE_COUNTER_DIFF			0x88
187062306a36Sopenharmony_ci#define	PACKET3_SET_CE_DE_COUNTERS			0x89
187162306a36Sopenharmony_ci#define	PACKET3_WAIT_ON_AVAIL_BUFFER			0x8A
187262306a36Sopenharmony_ci#define	PACKET3_SWITCH_BUFFER				0x8B
187362306a36Sopenharmony_ci
187462306a36Sopenharmony_ci/* ASYNC DMA - first instance at 0xd000, second at 0xd800 */
187562306a36Sopenharmony_ci#define DMA0_REGISTER_OFFSET                              0x0 /* not a register */
187662306a36Sopenharmony_ci#define DMA1_REGISTER_OFFSET                              0x200 /* not a register */
187762306a36Sopenharmony_ci
187862306a36Sopenharmony_ci#define DMA_RB_CNTL                                       0x3400
187962306a36Sopenharmony_ci#       define DMA_RB_ENABLE                              (1 << 0)
188062306a36Sopenharmony_ci#       define DMA_RB_SIZE(x)                             ((x) << 1) /* log2 */
188162306a36Sopenharmony_ci#       define DMA_RB_SWAP_ENABLE                         (1 << 9) /* 8IN32 */
188262306a36Sopenharmony_ci#       define DMA_RPTR_WRITEBACK_ENABLE                  (1 << 12)
188362306a36Sopenharmony_ci#       define DMA_RPTR_WRITEBACK_SWAP_ENABLE             (1 << 13)  /* 8IN32 */
188462306a36Sopenharmony_ci#       define DMA_RPTR_WRITEBACK_TIMER(x)                ((x) << 16) /* log2 */
188562306a36Sopenharmony_ci#define DMA_RB_BASE                                       0x3401
188662306a36Sopenharmony_ci#define DMA_RB_RPTR                                       0x3402
188762306a36Sopenharmony_ci#define DMA_RB_WPTR                                       0x3403
188862306a36Sopenharmony_ci
188962306a36Sopenharmony_ci#define DMA_RB_RPTR_ADDR_HI                               0x3407
189062306a36Sopenharmony_ci#define DMA_RB_RPTR_ADDR_LO                               0x3408
189162306a36Sopenharmony_ci
189262306a36Sopenharmony_ci#define DMA_IB_CNTL                                       0x3409
189362306a36Sopenharmony_ci#       define DMA_IB_ENABLE                              (1 << 0)
189462306a36Sopenharmony_ci#       define DMA_IB_SWAP_ENABLE                         (1 << 4)
189562306a36Sopenharmony_ci#       define CMD_VMID_FORCE                             (1 << 31)
189662306a36Sopenharmony_ci#define DMA_IB_RPTR                                       0x340a
189762306a36Sopenharmony_ci#define DMA_CNTL                                          0x340b
189862306a36Sopenharmony_ci#       define TRAP_ENABLE                                (1 << 0)
189962306a36Sopenharmony_ci#       define SEM_INCOMPLETE_INT_ENABLE                  (1 << 1)
190062306a36Sopenharmony_ci#       define SEM_WAIT_INT_ENABLE                        (1 << 2)
190162306a36Sopenharmony_ci#       define DATA_SWAP_ENABLE                           (1 << 3)
190262306a36Sopenharmony_ci#       define FENCE_SWAP_ENABLE                          (1 << 4)
190362306a36Sopenharmony_ci#       define CTXEMPTY_INT_ENABLE                        (1 << 28)
190462306a36Sopenharmony_ci#define DMA_STATUS_REG                                    0x340d
190562306a36Sopenharmony_ci#       define DMA_IDLE                                   (1 << 0)
190662306a36Sopenharmony_ci#define DMA_TILING_CONFIG  				  0x342e
190762306a36Sopenharmony_ci
190862306a36Sopenharmony_ci#define	DMA_POWER_CNTL					0x342f
190962306a36Sopenharmony_ci#       define MEM_POWER_OVERRIDE                       (1 << 8)
191062306a36Sopenharmony_ci#define	DMA_CLK_CTRL					0x3430
191162306a36Sopenharmony_ci
191262306a36Sopenharmony_ci#define	DMA_PG						0x3435
191362306a36Sopenharmony_ci#	define PG_CNTL_ENABLE				(1 << 0)
191462306a36Sopenharmony_ci#define	DMA_PGFSM_CONFIG				0x3436
191562306a36Sopenharmony_ci#define	DMA_PGFSM_WRITE					0x3437
191662306a36Sopenharmony_ci
191762306a36Sopenharmony_ci#define DMA_PACKET(cmd, b, t, s, n)	((((cmd) & 0xF) << 28) |	\
191862306a36Sopenharmony_ci					 (((b) & 0x1) << 26) |		\
191962306a36Sopenharmony_ci					 (((t) & 0x1) << 23) |		\
192062306a36Sopenharmony_ci					 (((s) & 0x1) << 22) |		\
192162306a36Sopenharmony_ci					 (((n) & 0xFFFFF) << 0))
192262306a36Sopenharmony_ci
192362306a36Sopenharmony_ci#define DMA_IB_PACKET(cmd, vmid, n)	((((cmd) & 0xF) << 28) |	\
192462306a36Sopenharmony_ci					 (((vmid) & 0xF) << 20) |	\
192562306a36Sopenharmony_ci					 (((n) & 0xFFFFF) << 0))
192662306a36Sopenharmony_ci
192762306a36Sopenharmony_ci#define DMA_PTE_PDE_PACKET(n)		((2 << 28) |			\
192862306a36Sopenharmony_ci					 (1 << 26) |			\
192962306a36Sopenharmony_ci					 (1 << 21) |			\
193062306a36Sopenharmony_ci					 (((n) & 0xFFFFF) << 0))
193162306a36Sopenharmony_ci
193262306a36Sopenharmony_ci/* async DMA Packet types */
193362306a36Sopenharmony_ci#define	DMA_PACKET_WRITE				  0x2
193462306a36Sopenharmony_ci#define	DMA_PACKET_COPY					  0x3
193562306a36Sopenharmony_ci#define	DMA_PACKET_INDIRECT_BUFFER			  0x4
193662306a36Sopenharmony_ci#define	DMA_PACKET_SEMAPHORE				  0x5
193762306a36Sopenharmony_ci#define	DMA_PACKET_FENCE				  0x6
193862306a36Sopenharmony_ci#define	DMA_PACKET_TRAP					  0x7
193962306a36Sopenharmony_ci#define	DMA_PACKET_SRBM_WRITE				  0x9
194062306a36Sopenharmony_ci#define	DMA_PACKET_CONSTANT_FILL			  0xd
194162306a36Sopenharmony_ci#define	DMA_PACKET_POLL_REG_MEM				  0xe
194262306a36Sopenharmony_ci#define	DMA_PACKET_NOP					  0xf
194362306a36Sopenharmony_ci
194462306a36Sopenharmony_ci#define VCE_STATUS					0x20004
194562306a36Sopenharmony_ci#define VCE_VCPU_CNTL					0x20014
194662306a36Sopenharmony_ci#define		VCE_CLK_EN				(1 << 0)
194762306a36Sopenharmony_ci#define VCE_VCPU_CACHE_OFFSET0				0x20024
194862306a36Sopenharmony_ci#define VCE_VCPU_CACHE_SIZE0				0x20028
194962306a36Sopenharmony_ci#define VCE_VCPU_CACHE_OFFSET1				0x2002c
195062306a36Sopenharmony_ci#define VCE_VCPU_CACHE_SIZE1				0x20030
195162306a36Sopenharmony_ci#define VCE_VCPU_CACHE_OFFSET2				0x20034
195262306a36Sopenharmony_ci#define VCE_VCPU_CACHE_SIZE2				0x20038
195362306a36Sopenharmony_ci#define VCE_SOFT_RESET					0x20120
195462306a36Sopenharmony_ci#define 	VCE_ECPU_SOFT_RESET			(1 << 0)
195562306a36Sopenharmony_ci#define 	VCE_FME_SOFT_RESET			(1 << 2)
195662306a36Sopenharmony_ci#define VCE_RB_BASE_LO2					0x2016c
195762306a36Sopenharmony_ci#define VCE_RB_BASE_HI2					0x20170
195862306a36Sopenharmony_ci#define VCE_RB_SIZE2					0x20174
195962306a36Sopenharmony_ci#define VCE_RB_RPTR2					0x20178
196062306a36Sopenharmony_ci#define VCE_RB_WPTR2					0x2017c
196162306a36Sopenharmony_ci#define VCE_RB_BASE_LO					0x20180
196262306a36Sopenharmony_ci#define VCE_RB_BASE_HI					0x20184
196362306a36Sopenharmony_ci#define VCE_RB_SIZE					0x20188
196462306a36Sopenharmony_ci#define VCE_RB_RPTR					0x2018c
196562306a36Sopenharmony_ci#define VCE_RB_WPTR					0x20190
196662306a36Sopenharmony_ci#define VCE_CLOCK_GATING_A				0x202f8
196762306a36Sopenharmony_ci#define VCE_CLOCK_GATING_B				0x202fc
196862306a36Sopenharmony_ci#define VCE_UENC_CLOCK_GATING				0x205bc
196962306a36Sopenharmony_ci#define VCE_UENC_REG_CLOCK_GATING			0x205c0
197062306a36Sopenharmony_ci#define VCE_FW_REG_STATUS				0x20e10
197162306a36Sopenharmony_ci#	define VCE_FW_REG_STATUS_BUSY			(1 << 0)
197262306a36Sopenharmony_ci#	define VCE_FW_REG_STATUS_PASS			(1 << 3)
197362306a36Sopenharmony_ci#	define VCE_FW_REG_STATUS_DONE			(1 << 11)
197462306a36Sopenharmony_ci#define VCE_LMI_FW_START_KEYSEL				0x20e18
197562306a36Sopenharmony_ci#define VCE_LMI_FW_PERIODIC_CTRL			0x20e20
197662306a36Sopenharmony_ci#define VCE_LMI_CTRL2					0x20e74
197762306a36Sopenharmony_ci#define VCE_LMI_CTRL					0x20e98
197862306a36Sopenharmony_ci#define VCE_LMI_VM_CTRL					0x20ea0
197962306a36Sopenharmony_ci#define VCE_LMI_SWAP_CNTL				0x20eb4
198062306a36Sopenharmony_ci#define VCE_LMI_SWAP_CNTL1				0x20eb8
198162306a36Sopenharmony_ci#define VCE_LMI_CACHE_CTRL				0x20ef4
198262306a36Sopenharmony_ci
198362306a36Sopenharmony_ci#define VCE_CMD_NO_OP					0x00000000
198462306a36Sopenharmony_ci#define VCE_CMD_END					0x00000001
198562306a36Sopenharmony_ci#define VCE_CMD_IB					0x00000002
198662306a36Sopenharmony_ci#define VCE_CMD_FENCE					0x00000003
198762306a36Sopenharmony_ci#define VCE_CMD_TRAP					0x00000004
198862306a36Sopenharmony_ci#define VCE_CMD_IB_AUTO					0x00000005
198962306a36Sopenharmony_ci#define VCE_CMD_SEMAPHORE				0x00000006
199062306a36Sopenharmony_ci
199162306a36Sopenharmony_ci
199262306a36Sopenharmony_ci//#dce stupp
199362306a36Sopenharmony_ci/* display controller offsets used for crtc/cur/lut/grph/viewport/etc. */
199462306a36Sopenharmony_ci#define SI_CRTC0_REGISTER_OFFSET                0 //(0x6df0 - 0x6df0)/4
199562306a36Sopenharmony_ci#define SI_CRTC1_REGISTER_OFFSET                0x300 //(0x79f0 - 0x6df0)/4
199662306a36Sopenharmony_ci#define SI_CRTC2_REGISTER_OFFSET                0x2600 //(0x105f0 - 0x6df0)/4
199762306a36Sopenharmony_ci#define SI_CRTC3_REGISTER_OFFSET                0x2900 //(0x111f0 - 0x6df0)/4
199862306a36Sopenharmony_ci#define SI_CRTC4_REGISTER_OFFSET                0x2c00 //(0x11df0 - 0x6df0)/4
199962306a36Sopenharmony_ci#define SI_CRTC5_REGISTER_OFFSET                0x2f00 //(0x129f0 - 0x6df0)/4
200062306a36Sopenharmony_ci
200162306a36Sopenharmony_ci#define CURSOR_WIDTH 64
200262306a36Sopenharmony_ci#define CURSOR_HEIGHT 64
200362306a36Sopenharmony_ci#define AMDGPU_MM_INDEX		        0x0000
200462306a36Sopenharmony_ci#define AMDGPU_MM_DATA		        0x0001
200562306a36Sopenharmony_ci
200662306a36Sopenharmony_ci#define VERDE_NUM_CRTC 6
200762306a36Sopenharmony_ci#define	BLACKOUT_MODE_MASK			0x00000007
200862306a36Sopenharmony_ci#define	VGA_RENDER_CONTROL			0xC0
200962306a36Sopenharmony_ci#define R_000300_VGA_RENDER_CONTROL             0xC0
201062306a36Sopenharmony_ci#define C_000300_VGA_VSTATUS_CNTL               0xFFFCFFFF
201162306a36Sopenharmony_ci#define EVERGREEN_CRTC_STATUS                   0x1BA3
201262306a36Sopenharmony_ci#define EVERGREEN_CRTC_V_BLANK                  (1 << 0)
201362306a36Sopenharmony_ci#define EVERGREEN_CRTC_STATUS_POSITION          0x1BA4
201462306a36Sopenharmony_ci/* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
201562306a36Sopenharmony_ci#define EVERGREEN_CRTC_V_BLANK_START_END                0x1b8d
201662306a36Sopenharmony_ci#define EVERGREEN_CRTC_CONTROL                          0x1b9c
201762306a36Sopenharmony_ci#define EVERGREEN_CRTC_MASTER_EN                 (1 << 0)
201862306a36Sopenharmony_ci#define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
201962306a36Sopenharmony_ci#define EVERGREEN_CRTC_BLANK_CONTROL                    0x1b9d
202062306a36Sopenharmony_ci#define EVERGREEN_CRTC_BLANK_DATA_EN             (1 << 8)
202162306a36Sopenharmony_ci#define EVERGREEN_CRTC_V_BLANK                   (1 << 0)
202262306a36Sopenharmony_ci#define EVERGREEN_CRTC_STATUS_HV_COUNT                  0x1ba8
202362306a36Sopenharmony_ci#define EVERGREEN_CRTC_UPDATE_LOCK                      0x1bb5
202462306a36Sopenharmony_ci#define EVERGREEN_MASTER_UPDATE_LOCK                    0x1bbd
202562306a36Sopenharmony_ci#define EVERGREEN_MASTER_UPDATE_MODE                    0x1bbe
202662306a36Sopenharmony_ci#define EVERGREEN_GRPH_UPDATE_LOCK               (1 << 16)
202762306a36Sopenharmony_ci#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH     0x1a07
202862306a36Sopenharmony_ci#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH   0x1a08
202962306a36Sopenharmony_ci#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS          0x1a04
203062306a36Sopenharmony_ci#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS        0x1a05
203162306a36Sopenharmony_ci#define EVERGREEN_GRPH_UPDATE                           0x1a11
203262306a36Sopenharmony_ci#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS               0xc4
203362306a36Sopenharmony_ci#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH          0xc9
203462306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING    (1 << 2)
203562306a36Sopenharmony_ci
203662306a36Sopenharmony_ci#define EVERGREEN_DATA_FORMAT                           0x1ac0
203762306a36Sopenharmony_ci#       define EVERGREEN_INTERLEAVE_EN                  (1 << 0)
203862306a36Sopenharmony_ci
203962306a36Sopenharmony_ci#define MC_SHARED_CHMAP__NOOFCHAN_MASK 0xf000
204062306a36Sopenharmony_ci#define MC_SHARED_CHMAP__NOOFCHAN__SHIFT 0xc
204162306a36Sopenharmony_ci
204262306a36Sopenharmony_ci#define R600_D1GRPH_ARRAY_MODE_LINEAR_GENERAL            (0 << 20)
204362306a36Sopenharmony_ci#define R600_D1GRPH_ARRAY_MODE_LINEAR_ALIGNED            (1 << 20)
204462306a36Sopenharmony_ci#define R600_D1GRPH_ARRAY_MODE_1D_TILED_THIN1            (2 << 20)
204562306a36Sopenharmony_ci#define R600_D1GRPH_ARRAY_MODE_2D_TILED_THIN1            (4 << 20)
204662306a36Sopenharmony_ci
204762306a36Sopenharmony_ci#define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH                0x1a45
204862306a36Sopenharmony_ci#define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH                0x1845
204962306a36Sopenharmony_ci
205062306a36Sopenharmony_ci#define R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH              0x1847
205162306a36Sopenharmony_ci#define R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH              0x1a47
205262306a36Sopenharmony_ci
205362306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS__LB_D1_VBLANK_INTERRUPT_MASK 0x8
205462306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE__LB_D2_VBLANK_INTERRUPT_MASK 0x8
205562306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE2__LB_D3_VBLANK_INTERRUPT_MASK 0x8
205662306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE3__LB_D4_VBLANK_INTERRUPT_MASK 0x8
205762306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE4__LB_D5_VBLANK_INTERRUPT_MASK 0x8
205862306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE5__LB_D6_VBLANK_INTERRUPT_MASK 0x8
205962306a36Sopenharmony_ci
206062306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS__LB_D1_VLINE_INTERRUPT_MASK 0x4
206162306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE__LB_D2_VLINE_INTERRUPT_MASK 0x4
206262306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE2__LB_D3_VLINE_INTERRUPT_MASK 0x4
206362306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE3__LB_D4_VLINE_INTERRUPT_MASK 0x4
206462306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE4__LB_D5_VLINE_INTERRUPT_MASK 0x4
206562306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE5__LB_D6_VLINE_INTERRUPT_MASK 0x4
206662306a36Sopenharmony_ci
206762306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS__DC_HPD1_INTERRUPT_MASK 0x20000
206862306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE__DC_HPD2_INTERRUPT_MASK 0x20000
206962306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE2__DC_HPD3_INTERRUPT_MASK 0x20000
207062306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE3__DC_HPD4_INTERRUPT_MASK 0x20000
207162306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE4__DC_HPD5_INTERRUPT_MASK 0x20000
207262306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE5__DC_HPD6_INTERRUPT_MASK 0x20000
207362306a36Sopenharmony_ci
207462306a36Sopenharmony_ci#define GRPH_INTERRUPT_STATUS__GRPH_PFLIP_INT_OCCURRED_MASK 0x1
207562306a36Sopenharmony_ci#define GRPH_INTERRUPT_STATUS__GRPH_PFLIP_INT_CLEAR_MASK 0x100
207662306a36Sopenharmony_ci
207762306a36Sopenharmony_ci#define DC_HPD1_INT_CONTROL__DC_HPD1_INT_ACK_MASK 0x1
207862306a36Sopenharmony_ci
207962306a36Sopenharmony_ci#define R600_D1GRPH_SWAP_CONTROL                               0x1843
208062306a36Sopenharmony_ci#define R600_D1GRPH_SWAP_ENDIAN_NONE                    (0 << 0)
208162306a36Sopenharmony_ci#define R600_D1GRPH_SWAP_ENDIAN_16BIT                   (1 << 0)
208262306a36Sopenharmony_ci#define R600_D1GRPH_SWAP_ENDIAN_32BIT                   (2 << 0)
208362306a36Sopenharmony_ci#define R600_D1GRPH_SWAP_ENDIAN_64BIT                   (3 << 0)
208462306a36Sopenharmony_ci
208562306a36Sopenharmony_ci#define AVIVO_D1VGA_CONTROL					0x00cc
208662306a36Sopenharmony_ci#       define AVIVO_DVGA_CONTROL_MODE_ENABLE            (1 << 0)
208762306a36Sopenharmony_ci#       define AVIVO_DVGA_CONTROL_TIMING_SELECT          (1 << 8)
208862306a36Sopenharmony_ci#       define AVIVO_DVGA_CONTROL_SYNC_POLARITY_SELECT   (1 << 9)
208962306a36Sopenharmony_ci#       define AVIVO_DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1 << 10)
209062306a36Sopenharmony_ci#       define AVIVO_DVGA_CONTROL_OVERSCAN_COLOR_EN      (1 << 16)
209162306a36Sopenharmony_ci#       define AVIVO_DVGA_CONTROL_ROTATE                 (1 << 24)
209262306a36Sopenharmony_ci#define AVIVO_D2VGA_CONTROL					0x00ce
209362306a36Sopenharmony_ci
209462306a36Sopenharmony_ci#define R600_BUS_CNTL                                           0x1508
209562306a36Sopenharmony_ci#       define R600_BIOS_ROM_DIS                                (1 << 1)
209662306a36Sopenharmony_ci
209762306a36Sopenharmony_ci#define R600_ROM_CNTL                              0x580
209862306a36Sopenharmony_ci#       define R600_SCK_OVERWRITE                  (1 << 1)
209962306a36Sopenharmony_ci#       define R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT 28
210062306a36Sopenharmony_ci#       define R600_SCK_PRESCALE_CRYSTAL_CLK_MASK  (0xf << 28)
210162306a36Sopenharmony_ci
210262306a36Sopenharmony_ci#define GRPH_INTERRUPT_CONTROL__GRPH_PFLIP_INT_MASK_MASK 0x1
210362306a36Sopenharmony_ci
210462306a36Sopenharmony_ci#define FMT_BIT_DEPTH_CONTROL                0x1bf2
210562306a36Sopenharmony_ci#define FMT_TRUNCATE_EN               (1 << 0)
210662306a36Sopenharmony_ci#define FMT_TRUNCATE_DEPTH            (1 << 4)
210762306a36Sopenharmony_ci#define FMT_SPATIAL_DITHER_EN         (1 << 8)
210862306a36Sopenharmony_ci#define FMT_SPATIAL_DITHER_MODE(x)    ((x) << 9)
210962306a36Sopenharmony_ci#define FMT_SPATIAL_DITHER_DEPTH      (1 << 12)
211062306a36Sopenharmony_ci#define FMT_FRAME_RANDOM_ENABLE       (1 << 13)
211162306a36Sopenharmony_ci#define FMT_RGB_RANDOM_ENABLE         (1 << 14)
211262306a36Sopenharmony_ci#define FMT_HIGHPASS_RANDOM_ENABLE    (1 << 15)
211362306a36Sopenharmony_ci#define FMT_TEMPORAL_DITHER_EN        (1 << 16)
211462306a36Sopenharmony_ci#define FMT_TEMPORAL_DITHER_DEPTH     (1 << 20)
211562306a36Sopenharmony_ci#define FMT_TEMPORAL_DITHER_OFFSET(x) ((x) << 21)
211662306a36Sopenharmony_ci#define FMT_TEMPORAL_LEVEL            (1 << 24)
211762306a36Sopenharmony_ci#define FMT_TEMPORAL_DITHER_RESET     (1 << 25)
211862306a36Sopenharmony_ci#define FMT_25FRC_SEL(x)              ((x) << 26)
211962306a36Sopenharmony_ci#define FMT_50FRC_SEL(x)              ((x) << 28)
212062306a36Sopenharmony_ci#define FMT_75FRC_SEL(x)              ((x) << 30)
212162306a36Sopenharmony_ci
212262306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_CONTROL                        0x1a80
212362306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE              0x1a81
212462306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN             0x1a82
212562306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_BLACK_OFFSET_RED               0x1a83
212662306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE              0x1a84
212762306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN             0x1a85
212862306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_WHITE_OFFSET_RED               0x1a86
212962306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_30_COLOR                       0x1a7c
213062306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_RW_INDEX                       0x1a79
213162306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_WRITE_EN_MASK                  0x1a7e
213262306a36Sopenharmony_ci#define EVERGREEN_DC_LUT_RW_MODE                        0x1a78
213362306a36Sopenharmony_ci
213462306a36Sopenharmony_ci#define EVERGREEN_GRPH_ENABLE                           0x1a00
213562306a36Sopenharmony_ci#define EVERGREEN_GRPH_CONTROL                          0x1a01
213662306a36Sopenharmony_ci#define EVERGREEN_GRPH_DEPTH(x)                  (((x) & 0x3) << 0)
213762306a36Sopenharmony_ci#define EVERGREEN_GRPH_DEPTH_8BPP                0
213862306a36Sopenharmony_ci#define EVERGREEN_GRPH_DEPTH_16BPP               1
213962306a36Sopenharmony_ci#define EVERGREEN_GRPH_DEPTH_32BPP               2
214062306a36Sopenharmony_ci#define EVERGREEN_GRPH_NUM_BANKS(x)              (((x) & 0x3) << 2)
214162306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_2_BANK               0
214262306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_4_BANK               1
214362306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_8_BANK               2
214462306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_16_BANK              3
214562306a36Sopenharmony_ci#define EVERGREEN_GRPH_Z(x)                      (((x) & 0x3) << 4)
214662306a36Sopenharmony_ci#define EVERGREEN_GRPH_BANK_WIDTH(x)             (((x) & 0x3) << 6)
214762306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_WIDTH_1         0
214862306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_WIDTH_2         1
214962306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_WIDTH_4         2
215062306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_WIDTH_8         3
215162306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT(x)                 (((x) & 0x7) << 8)
215262306a36Sopenharmony_ci
215362306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_INDEXED            0
215462306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_ARGB1555           0
215562306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_ARGB565            1
215662306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_ARGB4444           2
215762306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_AI88               3
215862306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_MONO16             4
215962306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_BGRA5551           5
216062306a36Sopenharmony_ci
216162306a36Sopenharmony_ci/* 32 BPP */
216262306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_ARGB8888           0
216362306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_ARGB2101010        1
216462306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_32BPP_DIG          2
216562306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_8B_ARGB2101010     3
216662306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_BGRA1010102        4
216762306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102     5
216862306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_RGB111110          6
216962306a36Sopenharmony_ci#define EVERGREEN_GRPH_FORMAT_BGR101111          7
217062306a36Sopenharmony_ci#define EVERGREEN_GRPH_BANK_HEIGHT(x)            (((x) & 0x3) << 11)
217162306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1        0
217262306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2        1
217362306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4        2
217462306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8        3
217562306a36Sopenharmony_ci#define EVERGREEN_GRPH_TILE_SPLIT(x)             (((x) & 0x7) << 13)
217662306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B       0
217762306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B      1
217862306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B      2
217962306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B      3
218062306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB       4
218162306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB       5
218262306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB       6
218362306a36Sopenharmony_ci#define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x)      (((x) & 0x3) << 18)
218462306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1  0
218562306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2  1
218662306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4  2
218762306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8  3
218862306a36Sopenharmony_ci#define EVERGREEN_GRPH_ARRAY_MODE(x)             (((x) & 0x7) << 20)
218962306a36Sopenharmony_ci#define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL      0
219062306a36Sopenharmony_ci#define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED      1
219162306a36Sopenharmony_ci#define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1      2
219262306a36Sopenharmony_ci#define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1      4
219362306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1  0
219462306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2  1
219562306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4  2
219662306a36Sopenharmony_ci#define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8  3
219762306a36Sopenharmony_ci
219862306a36Sopenharmony_ci#define EVERGREEN_GRPH_SWAP_CONTROL                     0x1a03
219962306a36Sopenharmony_ci#define EVERGREEN_GRPH_ENDIAN_SWAP(x)            (((x) & 0x3) << 0)
220062306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ENDIAN_NONE               0
220162306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ENDIAN_8IN16              1
220262306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ENDIAN_8IN32              2
220362306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ENDIAN_8IN64              3
220462306a36Sopenharmony_ci#define EVERGREEN_GRPH_RED_CROSSBAR(x)           (((x) & 0x3) << 4)
220562306a36Sopenharmony_ci#       define EVERGREEN_GRPH_RED_SEL_R                 0
220662306a36Sopenharmony_ci#       define EVERGREEN_GRPH_RED_SEL_G                 1
220762306a36Sopenharmony_ci#       define EVERGREEN_GRPH_RED_SEL_B                 2
220862306a36Sopenharmony_ci#       define EVERGREEN_GRPH_RED_SEL_A                 3
220962306a36Sopenharmony_ci#define EVERGREEN_GRPH_GREEN_CROSSBAR(x)         (((x) & 0x3) << 6)
221062306a36Sopenharmony_ci#       define EVERGREEN_GRPH_GREEN_SEL_G               0
221162306a36Sopenharmony_ci#       define EVERGREEN_GRPH_GREEN_SEL_B               1
221262306a36Sopenharmony_ci#       define EVERGREEN_GRPH_GREEN_SEL_A               2
221362306a36Sopenharmony_ci#       define EVERGREEN_GRPH_GREEN_SEL_R               3
221462306a36Sopenharmony_ci#define EVERGREEN_GRPH_BLUE_CROSSBAR(x)          (((x) & 0x3) << 8)
221562306a36Sopenharmony_ci#       define EVERGREEN_GRPH_BLUE_SEL_B                0
221662306a36Sopenharmony_ci#       define EVERGREEN_GRPH_BLUE_SEL_A                1
221762306a36Sopenharmony_ci#       define EVERGREEN_GRPH_BLUE_SEL_R                2
221862306a36Sopenharmony_ci#       define EVERGREEN_GRPH_BLUE_SEL_G                3
221962306a36Sopenharmony_ci#define EVERGREEN_GRPH_ALPHA_CROSSBAR(x)         (((x) & 0x3) << 10)
222062306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ALPHA_SEL_A               0
222162306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ALPHA_SEL_R               1
222262306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ALPHA_SEL_G               2
222362306a36Sopenharmony_ci#       define EVERGREEN_GRPH_ALPHA_SEL_B               3
222462306a36Sopenharmony_ci
222562306a36Sopenharmony_ci#define EVERGREEN_D3VGA_CONTROL                         0xf8
222662306a36Sopenharmony_ci#define EVERGREEN_D4VGA_CONTROL                         0xf9
222762306a36Sopenharmony_ci#define EVERGREEN_D5VGA_CONTROL                         0xfa
222862306a36Sopenharmony_ci#define EVERGREEN_D6VGA_CONTROL                         0xfb
222962306a36Sopenharmony_ci
223062306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_ADDRESS_MASK      0xffffff00
223162306a36Sopenharmony_ci
223262306a36Sopenharmony_ci#define EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL         0x1a02
223362306a36Sopenharmony_ci#define EVERGREEN_LUT_10BIT_BYPASS_EN            (1 << 8)
223462306a36Sopenharmony_ci
223562306a36Sopenharmony_ci#define EVERGREEN_GRPH_PITCH                            0x1a06
223662306a36Sopenharmony_ci#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH     0x1a07
223762306a36Sopenharmony_ci#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH   0x1a08
223862306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_OFFSET_X                 0x1a09
223962306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_OFFSET_Y                 0x1a0a
224062306a36Sopenharmony_ci#define EVERGREEN_GRPH_X_START                          0x1a0b
224162306a36Sopenharmony_ci#define EVERGREEN_GRPH_Y_START                          0x1a0c
224262306a36Sopenharmony_ci#define EVERGREEN_GRPH_X_END                            0x1a0d
224362306a36Sopenharmony_ci#define EVERGREEN_GRPH_Y_END                            0x1a0e
224462306a36Sopenharmony_ci#define EVERGREEN_GRPH_UPDATE                           0x1a11
224562306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING    (1 << 2)
224662306a36Sopenharmony_ci#define EVERGREEN_GRPH_UPDATE_LOCK               (1 << 16)
224762306a36Sopenharmony_ci#define EVERGREEN_GRPH_FLIP_CONTROL                     0x1a12
224862306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0)
224962306a36Sopenharmony_ci
225062306a36Sopenharmony_ci#define EVERGREEN_VIEWPORT_START                        0x1b5c
225162306a36Sopenharmony_ci#define EVERGREEN_VIEWPORT_SIZE                         0x1b5d
225262306a36Sopenharmony_ci#define EVERGREEN_DESKTOP_HEIGHT                        0x1ac1
225362306a36Sopenharmony_ci
225462306a36Sopenharmony_ci/* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */
225562306a36Sopenharmony_ci#define EVERGREEN_CUR_CONTROL                           0x1a66
225662306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_EN                      (1 << 0)
225762306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_MODE(x)                 (((x) & 0x3) << 8)
225862306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_MONO                    0
225962306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_24_1                    1
226062306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_24_8_PRE_MULT           2
226162306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_24_8_UNPRE_MULT         3
226262306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_2X_MAGNIFY              (1 << 16)
226362306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_FORCE_MC_ON             (1 << 20)
226462306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_URGENT_CONTROL(x)       (((x) & 0x7) << 24)
226562306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_URGENT_ALWAYS           0
226662306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_URGENT_1_8              1
226762306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_URGENT_1_4              2
226862306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_URGENT_3_8              3
226962306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_URGENT_1_2              4
227062306a36Sopenharmony_ci#define EVERGREEN_CUR_SURFACE_ADDRESS                   0x1a67
227162306a36Sopenharmony_ci#       define EVERGREEN_CUR_SURFACE_ADDRESS_MASK       0xfffff000
227262306a36Sopenharmony_ci#define EVERGREEN_CUR_SIZE                              0x1a68
227362306a36Sopenharmony_ci#define EVERGREEN_CUR_SURFACE_ADDRESS_HIGH              0x1a69
227462306a36Sopenharmony_ci#define EVERGREEN_CUR_POSITION                          0x1a6a
227562306a36Sopenharmony_ci#define EVERGREEN_CUR_HOT_SPOT                          0x1a6b
227662306a36Sopenharmony_ci#define EVERGREEN_CUR_COLOR1                            0x1a6c
227762306a36Sopenharmony_ci#define EVERGREEN_CUR_COLOR2                            0x1a6d
227862306a36Sopenharmony_ci#define EVERGREEN_CUR_UPDATE                            0x1a6e
227962306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_UPDATE_PENDING          (1 << 0)
228062306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_UPDATE_TAKEN            (1 << 1)
228162306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_UPDATE_LOCK             (1 << 16)
228262306a36Sopenharmony_ci#       define EVERGREEN_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
228362306a36Sopenharmony_ci
228462306a36Sopenharmony_ci
228562306a36Sopenharmony_ci#define NI_INPUT_CSC_CONTROL                           0x1a35
228662306a36Sopenharmony_ci#       define NI_INPUT_CSC_GRPH_MODE(x)               (((x) & 0x3) << 0)
228762306a36Sopenharmony_ci#       define NI_INPUT_CSC_BYPASS                     0
228862306a36Sopenharmony_ci#       define NI_INPUT_CSC_PROG_COEFF                 1
228962306a36Sopenharmony_ci#       define NI_INPUT_CSC_PROG_SHARED_MATRIXA        2
229062306a36Sopenharmony_ci#       define NI_INPUT_CSC_OVL_MODE(x)                (((x) & 0x3) << 4)
229162306a36Sopenharmony_ci
229262306a36Sopenharmony_ci#define NI_OUTPUT_CSC_CONTROL                          0x1a3c
229362306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_GRPH_MODE(x)              (((x) & 0x7) << 0)
229462306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_BYPASS                    0
229562306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_TV_RGB                    1
229662306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_YCBCR_601                 2
229762306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_YCBCR_709                 3
229862306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_PROG_COEFF                4
229962306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_PROG_SHARED_MATRIXB       5
230062306a36Sopenharmony_ci#       define NI_OUTPUT_CSC_OVL_MODE(x)               (((x) & 0x7) << 4)
230162306a36Sopenharmony_ci
230262306a36Sopenharmony_ci#define NI_DEGAMMA_CONTROL                             0x1a58
230362306a36Sopenharmony_ci#       define NI_GRPH_DEGAMMA_MODE(x)                 (((x) & 0x3) << 0)
230462306a36Sopenharmony_ci#       define NI_DEGAMMA_BYPASS                       0
230562306a36Sopenharmony_ci#       define NI_DEGAMMA_SRGB_24                      1
230662306a36Sopenharmony_ci#       define NI_DEGAMMA_XVYCC_222                    2
230762306a36Sopenharmony_ci#       define NI_OVL_DEGAMMA_MODE(x)                  (((x) & 0x3) << 4)
230862306a36Sopenharmony_ci#       define NI_ICON_DEGAMMA_MODE(x)                 (((x) & 0x3) << 8)
230962306a36Sopenharmony_ci#       define NI_CURSOR_DEGAMMA_MODE(x)               (((x) & 0x3) << 12)
231062306a36Sopenharmony_ci
231162306a36Sopenharmony_ci#define NI_GAMUT_REMAP_CONTROL                         0x1a59
231262306a36Sopenharmony_ci#       define NI_GRPH_GAMUT_REMAP_MODE(x)             (((x) & 0x3) << 0)
231362306a36Sopenharmony_ci#       define NI_GAMUT_REMAP_BYPASS                   0
231462306a36Sopenharmony_ci#       define NI_GAMUT_REMAP_PROG_COEFF               1
231562306a36Sopenharmony_ci#       define NI_GAMUT_REMAP_PROG_SHARED_MATRIXA      2
231662306a36Sopenharmony_ci#       define NI_GAMUT_REMAP_PROG_SHARED_MATRIXB      3
231762306a36Sopenharmony_ci#       define NI_OVL_GAMUT_REMAP_MODE(x)              (((x) & 0x3) << 4)
231862306a36Sopenharmony_ci
231962306a36Sopenharmony_ci#define NI_REGAMMA_CONTROL                             0x1aa0
232062306a36Sopenharmony_ci#       define NI_GRPH_REGAMMA_MODE(x)                 (((x) & 0x7) << 0)
232162306a36Sopenharmony_ci#       define NI_REGAMMA_BYPASS                       0
232262306a36Sopenharmony_ci#       define NI_REGAMMA_SRGB_24                      1
232362306a36Sopenharmony_ci#       define NI_REGAMMA_XVYCC_222                    2
232462306a36Sopenharmony_ci#       define NI_REGAMMA_PROG_A                       3
232562306a36Sopenharmony_ci#       define NI_REGAMMA_PROG_B                       4
232662306a36Sopenharmony_ci#       define NI_OVL_REGAMMA_MODE(x)                  (((x) & 0x7) << 4)
232762306a36Sopenharmony_ci
232862306a36Sopenharmony_ci
232962306a36Sopenharmony_ci#define NI_PRESCALE_GRPH_CONTROL                       0x1a2d
233062306a36Sopenharmony_ci#       define NI_GRPH_PRESCALE_BYPASS                 (1 << 4)
233162306a36Sopenharmony_ci
233262306a36Sopenharmony_ci#define NI_PRESCALE_OVL_CONTROL                        0x1a31
233362306a36Sopenharmony_ci#       define NI_OVL_PRESCALE_BYPASS                  (1 << 4)
233462306a36Sopenharmony_ci
233562306a36Sopenharmony_ci#define NI_INPUT_GAMMA_CONTROL                         0x1a10
233662306a36Sopenharmony_ci#       define NI_GRPH_INPUT_GAMMA_MODE(x)             (((x) & 0x3) << 0)
233762306a36Sopenharmony_ci#       define NI_INPUT_GAMMA_USE_LUT                  0
233862306a36Sopenharmony_ci#       define NI_INPUT_GAMMA_BYPASS                   1
233962306a36Sopenharmony_ci#       define NI_INPUT_GAMMA_SRGB_24                  2
234062306a36Sopenharmony_ci#       define NI_INPUT_GAMMA_XVYCC_222                3
234162306a36Sopenharmony_ci#       define NI_OVL_INPUT_GAMMA_MODE(x)              (((x) & 0x3) << 4)
234262306a36Sopenharmony_ci
234362306a36Sopenharmony_ci#define	BLACKOUT_MODE_MASK			0x00000007
234462306a36Sopenharmony_ci#define	VGA_RENDER_CONTROL			0xC0
234562306a36Sopenharmony_ci#define R_000300_VGA_RENDER_CONTROL             0xC0
234662306a36Sopenharmony_ci#define C_000300_VGA_VSTATUS_CNTL               0xFFFCFFFF
234762306a36Sopenharmony_ci#define EVERGREEN_CRTC_STATUS                   0x1BA3
234862306a36Sopenharmony_ci#define EVERGREEN_CRTC_V_BLANK                  (1 << 0)
234962306a36Sopenharmony_ci#define EVERGREEN_CRTC_STATUS_POSITION          0x1BA4
235062306a36Sopenharmony_ci/* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
235162306a36Sopenharmony_ci#define EVERGREEN_CRTC_V_BLANK_START_END                0x1b8d
235262306a36Sopenharmony_ci#define EVERGREEN_CRTC_CONTROL                          0x1b9c
235362306a36Sopenharmony_ci#       define EVERGREEN_CRTC_MASTER_EN                 (1 << 0)
235462306a36Sopenharmony_ci#       define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
235562306a36Sopenharmony_ci#define EVERGREEN_CRTC_BLANK_CONTROL                    0x1b9d
235662306a36Sopenharmony_ci#       define EVERGREEN_CRTC_BLANK_DATA_EN             (1 << 8)
235762306a36Sopenharmony_ci#       define EVERGREEN_CRTC_V_BLANK                   (1 << 0)
235862306a36Sopenharmony_ci#define EVERGREEN_CRTC_STATUS_HV_COUNT                  0x1ba8
235962306a36Sopenharmony_ci#define EVERGREEN_CRTC_UPDATE_LOCK                      0x1bb5
236062306a36Sopenharmony_ci#define EVERGREEN_MASTER_UPDATE_LOCK                    0x1bbd
236162306a36Sopenharmony_ci#define EVERGREEN_MASTER_UPDATE_MODE                    0x1bbe
236262306a36Sopenharmony_ci#define EVERGREEN_GRPH_UPDATE_LOCK               (1 << 16)
236362306a36Sopenharmony_ci#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH     0x1a07
236462306a36Sopenharmony_ci#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH   0x1a08
236562306a36Sopenharmony_ci#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS          0x1a04
236662306a36Sopenharmony_ci#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS        0x1a05
236762306a36Sopenharmony_ci#define EVERGREEN_GRPH_UPDATE                           0x1a11
236862306a36Sopenharmony_ci#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS               0xc4
236962306a36Sopenharmony_ci#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH          0xc9
237062306a36Sopenharmony_ci#define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING    (1 << 2)
237162306a36Sopenharmony_ci
237262306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxRANGE_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x10
237362306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxRANGE_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x4
237462306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxDUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x80
237562306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxDUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x7
237662306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxPDE0_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x400
237762306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxPDE0_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0xa
237862306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxVALID_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x2000
237962306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxVALID_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0xd
238062306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxREAD_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x10000
238162306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxREAD_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x10
238262306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxWRITE_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x80000
238362306a36Sopenharmony_ci#define mmVM_CONTEXT1_CNTL__xxWRITE_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x13
238462306a36Sopenharmony_ci
238562306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxVMID_MASK 0x1e000000
238662306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxVMID__SHIFT 0x19
238762306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxPROTECTIONS_MASK 0xff
238862306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxPROTECTIONS__SHIFT 0x0
238962306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_ID_MASK 0xff000
239062306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_ID__SHIFT 0xc
239162306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_RW_MASK 0x1000000
239262306a36Sopenharmony_ci#define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_RW__SHIFT 0x18
239362306a36Sopenharmony_ci
239462306a36Sopenharmony_ci#define mmMC_SHARED_BLACKOUT_CNTL__xxBLACKOUT_MODE_MASK 0x7
239562306a36Sopenharmony_ci#define mmMC_SHARED_BLACKOUT_CNTL__xxBLACKOUT_MODE__SHIFT 0x0
239662306a36Sopenharmony_ci
239762306a36Sopenharmony_ci#define mmBIF_FB_EN__xxFB_READ_EN_MASK 0x1
239862306a36Sopenharmony_ci#define mmBIF_FB_EN__xxFB_READ_EN__SHIFT 0x0
239962306a36Sopenharmony_ci#define mmBIF_FB_EN__xxFB_WRITE_EN_MASK 0x2
240062306a36Sopenharmony_ci#define mmBIF_FB_EN__xxFB_WRITE_EN__SHIFT 0x1
240162306a36Sopenharmony_ci
240262306a36Sopenharmony_ci#define mmSRBM_SOFT_RESET__xxSOFT_RESET_VMC_MASK 0x20000
240362306a36Sopenharmony_ci#define mmSRBM_SOFT_RESET__xxSOFT_RESET_VMC__SHIFT 0x11
240462306a36Sopenharmony_ci#define mmSRBM_SOFT_RESET__xxSOFT_RESET_MC_MASK 0x800
240562306a36Sopenharmony_ci#define mmSRBM_SOFT_RESET__xxSOFT_RESET_MC__SHIFT 0xb
240662306a36Sopenharmony_ci
240762306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x8
240862306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x3
240962306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x40
241062306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x6
241162306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x200
241262306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x9
241362306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__VALID_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x1000
241462306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__VALID_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0xc
241562306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__READ_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x8000
241662306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__READ_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0xf
241762306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x40000
241862306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL__WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x12
241962306a36Sopenharmony_ci
242062306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__MASK	0xf0000000
242162306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR1  0x10000000
242262306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__DDR2   0x20000000
242362306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR3  0x30000000
242462306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR4  0x40000000
242562306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR5  0x50000000
242662306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__HBM    0x60000000
242762306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__DDR3   0xB0000000
242862306a36Sopenharmony_ci
242962306a36Sopenharmony_ci#define GRBM_STATUS__GUI_ACTIVE_MASK 0x80000000
243062306a36Sopenharmony_ci#define CP_INT_CNTL_RING__TIME_STAMP_INT_ENABLE_MASK 0x4000000
243162306a36Sopenharmony_ci#define CP_INT_CNTL_RING0__PRIV_REG_INT_ENABLE_MASK 0x800000
243262306a36Sopenharmony_ci#define CP_INT_CNTL_RING0__PRIV_INSTR_INT_ENABLE_MASK 0x400000
243362306a36Sopenharmony_ci#define PACKET3_SEM_WAIT_ON_SIGNAL    (0x1 << 12)
243462306a36Sopenharmony_ci#define PACKET3_SEM_SEL_SIGNAL	    (0x6 << 29)
243562306a36Sopenharmony_ci#define PACKET3_SEM_SEL_WAIT	    (0x7 << 29)
243662306a36Sopenharmony_ci
243762306a36Sopenharmony_ci#define CONFIG_CNTL	0x1509
243862306a36Sopenharmony_ci#define CC_DRM_ID_STRAPS	0X1559
243962306a36Sopenharmony_ci#define AMDGPU_PCIE_INDEX	0xc
244062306a36Sopenharmony_ci#define AMDGPU_PCIE_DATA	0xd
244162306a36Sopenharmony_ci
244262306a36Sopenharmony_ci#define DMA_SEM_INCOMPLETE_TIMER_CNTL                     0x3411
244362306a36Sopenharmony_ci#define DMA_SEM_WAIT_FAIL_TIMER_CNTL                      0x3412
244462306a36Sopenharmony_ci#define DMA_MODE                                          0x342f
244562306a36Sopenharmony_ci#define DMA_RB_RPTR_ADDR_HI                               0x3407
244662306a36Sopenharmony_ci#define DMA_RB_RPTR_ADDR_LO                               0x3408
244762306a36Sopenharmony_ci#define DMA_BUSY_MASK 0x20
244862306a36Sopenharmony_ci#define DMA1_BUSY_MASK 0X40
244962306a36Sopenharmony_ci#define SDMA_MAX_INSTANCE 2
245062306a36Sopenharmony_ci
245162306a36Sopenharmony_ci#define PCIE_BUS_CLK    10000
245262306a36Sopenharmony_ci#define TCLK            (PCIE_BUS_CLK / 10)
245362306a36Sopenharmony_ci#define	PCIE_PORT_INDEX					0xe
245462306a36Sopenharmony_ci#define	PCIE_PORT_DATA					0xf
245562306a36Sopenharmony_ci#define EVERGREEN_PIF_PHY0_INDEX                        0x8
245662306a36Sopenharmony_ci#define EVERGREEN_PIF_PHY0_DATA                         0xc
245762306a36Sopenharmony_ci#define EVERGREEN_PIF_PHY1_INDEX                        0x10
245862306a36Sopenharmony_ci#define EVERGREEN_PIF_PHY1_DATA				0x14
245962306a36Sopenharmony_ci
246062306a36Sopenharmony_ci#define	MC_VM_FB_OFFSET					0x81a
246162306a36Sopenharmony_ci
246262306a36Sopenharmony_ci/* Discrete VCE clocks */
246362306a36Sopenharmony_ci#define CG_VCEPLL_FUNC_CNTL                             0xc0030600
246462306a36Sopenharmony_ci#define    VCEPLL_RESET_MASK                            0x00000001
246562306a36Sopenharmony_ci#define    VCEPLL_SLEEP_MASK                            0x00000002
246662306a36Sopenharmony_ci#define    VCEPLL_BYPASS_EN_MASK                        0x00000004
246762306a36Sopenharmony_ci#define    VCEPLL_CTLREQ_MASK                           0x00000008
246862306a36Sopenharmony_ci#define    VCEPLL_VCO_MODE_MASK                         0x00000600
246962306a36Sopenharmony_ci#define    VCEPLL_REF_DIV_MASK                          0x003F0000
247062306a36Sopenharmony_ci#define    VCEPLL_CTLACK_MASK                           0x40000000
247162306a36Sopenharmony_ci#define    VCEPLL_CTLACK2_MASK                          0x80000000
247262306a36Sopenharmony_ci
247362306a36Sopenharmony_ci#define CG_VCEPLL_FUNC_CNTL_2                           0xc0030601
247462306a36Sopenharmony_ci#define    VCEPLL_PDIV_A(x)                             ((x) << 0)
247562306a36Sopenharmony_ci#define    VCEPLL_PDIV_A_MASK                           0x0000007F
247662306a36Sopenharmony_ci#define    VCEPLL_PDIV_B(x)                             ((x) << 8)
247762306a36Sopenharmony_ci#define    VCEPLL_PDIV_B_MASK                           0x00007F00
247862306a36Sopenharmony_ci#define    EVCLK_SRC_SEL(x)                             ((x) << 20)
247962306a36Sopenharmony_ci#define    EVCLK_SRC_SEL_MASK                           0x01F00000
248062306a36Sopenharmony_ci#define    ECCLK_SRC_SEL(x)                             ((x) << 25)
248162306a36Sopenharmony_ci#define    ECCLK_SRC_SEL_MASK                           0x3E000000
248262306a36Sopenharmony_ci
248362306a36Sopenharmony_ci#define CG_VCEPLL_FUNC_CNTL_3                           0xc0030602
248462306a36Sopenharmony_ci#define    VCEPLL_FB_DIV(x)                             ((x) << 0)
248562306a36Sopenharmony_ci#define    VCEPLL_FB_DIV_MASK                           0x01FFFFFF
248662306a36Sopenharmony_ci
248762306a36Sopenharmony_ci#define CG_VCEPLL_FUNC_CNTL_4                           0xc0030603
248862306a36Sopenharmony_ci
248962306a36Sopenharmony_ci#define CG_VCEPLL_FUNC_CNTL_5                           0xc0030604
249062306a36Sopenharmony_ci#define CG_VCEPLL_SPREAD_SPECTRUM                       0xc0030606
249162306a36Sopenharmony_ci#define    VCEPLL_SSEN_MASK                             0x00000001
249262306a36Sopenharmony_ci
249362306a36Sopenharmony_ci
249462306a36Sopenharmony_ci#endif
2495