162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2012 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 CIK_H
2562306a36Sopenharmony_ci#define CIK_H
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define BONAIRE_GB_ADDR_CONFIG_GOLDEN        0x12010001
2862306a36Sopenharmony_ci#define HAWAII_GB_ADDR_CONFIG_GOLDEN         0x12011003
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define CIK_RB_BITMAP_WIDTH_PER_SH     2
3162306a36Sopenharmony_ci#define HAWAII_RB_BITMAP_WIDTH_PER_SH  4
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* DIDT IND registers */
3462306a36Sopenharmony_ci#define DIDT_SQ_CTRL0                                     0x0
3562306a36Sopenharmony_ci#       define DIDT_CTRL_EN                               (1 << 0)
3662306a36Sopenharmony_ci#define DIDT_DB_CTRL0                                     0x20
3762306a36Sopenharmony_ci#define DIDT_TD_CTRL0                                     0x40
3862306a36Sopenharmony_ci#define DIDT_TCP_CTRL0                                    0x60
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/* SMC IND registers */
4162306a36Sopenharmony_ci#define DPM_TABLE_475                                     0x3F768
4262306a36Sopenharmony_ci#       define SamuBootLevel(x)                           ((x) << 0)
4362306a36Sopenharmony_ci#       define SamuBootLevel_MASK                         0x000000ff
4462306a36Sopenharmony_ci#       define SamuBootLevel_SHIFT                        0
4562306a36Sopenharmony_ci#       define AcpBootLevel(x)                            ((x) << 8)
4662306a36Sopenharmony_ci#       define AcpBootLevel_MASK                          0x0000ff00
4762306a36Sopenharmony_ci#       define AcpBootLevel_SHIFT                         8
4862306a36Sopenharmony_ci#       define VceBootLevel(x)                            ((x) << 16)
4962306a36Sopenharmony_ci#       define VceBootLevel_MASK                          0x00ff0000
5062306a36Sopenharmony_ci#       define VceBootLevel_SHIFT                         16
5162306a36Sopenharmony_ci#       define UvdBootLevel(x)                            ((x) << 24)
5262306a36Sopenharmony_ci#       define UvdBootLevel_MASK                          0xff000000
5362306a36Sopenharmony_ci#       define UvdBootLevel_SHIFT                         24
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define FIRMWARE_FLAGS                                    0x3F800
5662306a36Sopenharmony_ci#       define INTERRUPTS_ENABLED                         (1 << 0)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define NB_DPM_CONFIG_1                                   0x3F9E8
5962306a36Sopenharmony_ci#       define Dpm0PgNbPsLo(x)                            ((x) << 0)
6062306a36Sopenharmony_ci#       define Dpm0PgNbPsLo_MASK                          0x000000ff
6162306a36Sopenharmony_ci#       define Dpm0PgNbPsLo_SHIFT                         0
6262306a36Sopenharmony_ci#       define Dpm0PgNbPsHi(x)                            ((x) << 8)
6362306a36Sopenharmony_ci#       define Dpm0PgNbPsHi_MASK                          0x0000ff00
6462306a36Sopenharmony_ci#       define Dpm0PgNbPsHi_SHIFT                         8
6562306a36Sopenharmony_ci#       define DpmXNbPsLo(x)                              ((x) << 16)
6662306a36Sopenharmony_ci#       define DpmXNbPsLo_MASK                            0x00ff0000
6762306a36Sopenharmony_ci#       define DpmXNbPsLo_SHIFT                           16
6862306a36Sopenharmony_ci#       define DpmXNbPsHi(x)                              ((x) << 24)
6962306a36Sopenharmony_ci#       define DpmXNbPsHi_MASK                            0xff000000
7062306a36Sopenharmony_ci#       define DpmXNbPsHi_SHIFT                           24
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define	SMC_SYSCON_RESET_CNTL				0x80000000
7362306a36Sopenharmony_ci#       define RST_REG                                  (1 << 0)
7462306a36Sopenharmony_ci#define	SMC_SYSCON_CLOCK_CNTL_0				0x80000004
7562306a36Sopenharmony_ci#       define CK_DISABLE                               (1 << 0)
7662306a36Sopenharmony_ci#       define CKEN                                     (1 << 24)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define	SMC_SYSCON_MISC_CNTL				0x80000010
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define SMC_SYSCON_MSG_ARG_0                              0x80000068
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define SMC_PC_C                                          0x80000370
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define SMC_SCRATCH9                                      0x80000424
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#define RCU_UC_EVENTS                                     0xC0000004
8762306a36Sopenharmony_ci#       define BOOT_SEQ_DONE                              (1 << 7)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define GENERAL_PWRMGT                                    0xC0200000
9062306a36Sopenharmony_ci#       define GLOBAL_PWRMGT_EN                           (1 << 0)
9162306a36Sopenharmony_ci#       define STATIC_PM_EN                               (1 << 1)
9262306a36Sopenharmony_ci#       define THERMAL_PROTECTION_DIS                     (1 << 2)
9362306a36Sopenharmony_ci#       define THERMAL_PROTECTION_TYPE                    (1 << 3)
9462306a36Sopenharmony_ci#       define SW_SMIO_INDEX(x)                           ((x) << 6)
9562306a36Sopenharmony_ci#       define SW_SMIO_INDEX_MASK                         (1 << 6)
9662306a36Sopenharmony_ci#       define SW_SMIO_INDEX_SHIFT                        6
9762306a36Sopenharmony_ci#       define VOLT_PWRMGT_EN                             (1 << 10)
9862306a36Sopenharmony_ci#       define GPU_COUNTER_CLK                            (1 << 15)
9962306a36Sopenharmony_ci#       define DYN_SPREAD_SPECTRUM_EN                     (1 << 23)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#define CNB_PWRMGT_CNTL                                   0xC0200004
10262306a36Sopenharmony_ci#       define GNB_SLOW_MODE(x)                           ((x) << 0)
10362306a36Sopenharmony_ci#       define GNB_SLOW_MODE_MASK                         (3 << 0)
10462306a36Sopenharmony_ci#       define GNB_SLOW_MODE_SHIFT                        0
10562306a36Sopenharmony_ci#       define GNB_SLOW                                   (1 << 2)
10662306a36Sopenharmony_ci#       define FORCE_NB_PS1                               (1 << 3)
10762306a36Sopenharmony_ci#       define DPM_ENABLED                                (1 << 4)
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define SCLK_PWRMGT_CNTL                                  0xC0200008
11062306a36Sopenharmony_ci#       define SCLK_PWRMGT_OFF                            (1 << 0)
11162306a36Sopenharmony_ci#       define RESET_BUSY_CNT                             (1 << 4)
11262306a36Sopenharmony_ci#       define RESET_SCLK_CNT                             (1 << 5)
11362306a36Sopenharmony_ci#       define DYNAMIC_PM_EN                              (1 << 21)
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX                  0xC0200014
11662306a36Sopenharmony_ci#       define CURRENT_STATE_MASK                         (0xf << 4)
11762306a36Sopenharmony_ci#       define CURRENT_STATE_SHIFT                        4
11862306a36Sopenharmony_ci#       define CURR_MCLK_INDEX_MASK                       (0xf << 8)
11962306a36Sopenharmony_ci#       define CURR_MCLK_INDEX_SHIFT                      8
12062306a36Sopenharmony_ci#       define CURR_SCLK_INDEX_MASK                       (0x1f << 16)
12162306a36Sopenharmony_ci#       define CURR_SCLK_INDEX_SHIFT                      16
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define CG_SSP                                            0xC0200044
12462306a36Sopenharmony_ci#       define SST(x)                                     ((x) << 0)
12562306a36Sopenharmony_ci#       define SST_MASK                                   (0xffff << 0)
12662306a36Sopenharmony_ci#       define SSTU(x)                                    ((x) << 16)
12762306a36Sopenharmony_ci#       define SSTU_MASK                                  (0xf << 16)
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define CG_DISPLAY_GAP_CNTL                               0xC0200060
13062306a36Sopenharmony_ci#       define DISP_GAP(x)                                ((x) << 0)
13162306a36Sopenharmony_ci#       define DISP_GAP_MASK                              (3 << 0)
13262306a36Sopenharmony_ci#       define VBI_TIMER_COUNT(x)                         ((x) << 4)
13362306a36Sopenharmony_ci#       define VBI_TIMER_COUNT_MASK                       (0x3fff << 4)
13462306a36Sopenharmony_ci#       define VBI_TIMER_UNIT(x)                          ((x) << 20)
13562306a36Sopenharmony_ci#       define VBI_TIMER_UNIT_MASK                        (7 << 20)
13662306a36Sopenharmony_ci#       define DISP_GAP_MCHG(x)                           ((x) << 24)
13762306a36Sopenharmony_ci#       define DISP_GAP_MCHG_MASK                         (3 << 24)
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci#define SMU_VOLTAGE_STATUS                                0xC0200094
14062306a36Sopenharmony_ci#       define SMU_VOLTAGE_CURRENT_LEVEL_MASK             (0xff << 1)
14162306a36Sopenharmony_ci#       define SMU_VOLTAGE_CURRENT_LEVEL_SHIFT            1
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX_1                0xC02000F0
14462306a36Sopenharmony_ci#       define CURR_PCIE_INDEX_MASK                       (0xf << 24)
14562306a36Sopenharmony_ci#       define CURR_PCIE_INDEX_SHIFT                      24
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define CG_ULV_PARAMETER                                  0xC0200158
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci#define CG_FTV_0                                          0xC02001A8
15062306a36Sopenharmony_ci#define CG_FTV_1                                          0xC02001AC
15162306a36Sopenharmony_ci#define CG_FTV_2                                          0xC02001B0
15262306a36Sopenharmony_ci#define CG_FTV_3                                          0xC02001B4
15362306a36Sopenharmony_ci#define CG_FTV_4                                          0xC02001B8
15462306a36Sopenharmony_ci#define CG_FTV_5                                          0xC02001BC
15562306a36Sopenharmony_ci#define CG_FTV_6                                          0xC02001C0
15662306a36Sopenharmony_ci#define CG_FTV_7                                          0xC02001C4
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define CG_DISPLAY_GAP_CNTL2                              0xC0200230
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#define LCAC_SX0_OVR_SEL                                  0xC0400D04
16162306a36Sopenharmony_ci#define LCAC_SX0_OVR_VAL                                  0xC0400D08
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci#define LCAC_MC0_CNTL                                     0xC0400D30
16462306a36Sopenharmony_ci#define LCAC_MC0_OVR_SEL                                  0xC0400D34
16562306a36Sopenharmony_ci#define LCAC_MC0_OVR_VAL                                  0xC0400D38
16662306a36Sopenharmony_ci#define LCAC_MC1_CNTL                                     0xC0400D3C
16762306a36Sopenharmony_ci#define LCAC_MC1_OVR_SEL                                  0xC0400D40
16862306a36Sopenharmony_ci#define LCAC_MC1_OVR_VAL                                  0xC0400D44
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci#define LCAC_MC2_OVR_SEL                                  0xC0400D4C
17162306a36Sopenharmony_ci#define LCAC_MC2_OVR_VAL                                  0xC0400D50
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci#define LCAC_MC3_OVR_SEL                                  0xC0400D58
17462306a36Sopenharmony_ci#define LCAC_MC3_OVR_VAL                                  0xC0400D5C
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci#define LCAC_CPL_CNTL                                     0xC0400D80
17762306a36Sopenharmony_ci#define LCAC_CPL_OVR_SEL                                  0xC0400D84
17862306a36Sopenharmony_ci#define LCAC_CPL_OVR_VAL                                  0xC0400D88
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* dGPU */
18162306a36Sopenharmony_ci#define	CG_THERMAL_CTRL					0xC0300004
18262306a36Sopenharmony_ci#define 	DPM_EVENT_SRC(x)			((x) << 0)
18362306a36Sopenharmony_ci#define 	DPM_EVENT_SRC_MASK			(7 << 0)
18462306a36Sopenharmony_ci#define		DIG_THERM_DPM(x)			((x) << 14)
18562306a36Sopenharmony_ci#define		DIG_THERM_DPM_MASK			0x003FC000
18662306a36Sopenharmony_ci#define		DIG_THERM_DPM_SHIFT			14
18762306a36Sopenharmony_ci#define	CG_THERMAL_STATUS				0xC0300008
18862306a36Sopenharmony_ci#define		FDO_PWM_DUTY(x)				((x) << 9)
18962306a36Sopenharmony_ci#define		FDO_PWM_DUTY_MASK			(0xff << 9)
19062306a36Sopenharmony_ci#define		FDO_PWM_DUTY_SHIFT			9
19162306a36Sopenharmony_ci#define	CG_THERMAL_INT					0xC030000C
19262306a36Sopenharmony_ci#define		CI_DIG_THERM_INTH(x)			((x) << 8)
19362306a36Sopenharmony_ci#define		CI_DIG_THERM_INTH_MASK			0x0000FF00
19462306a36Sopenharmony_ci#define		CI_DIG_THERM_INTH_SHIFT			8
19562306a36Sopenharmony_ci#define		CI_DIG_THERM_INTL(x)			((x) << 16)
19662306a36Sopenharmony_ci#define		CI_DIG_THERM_INTL_MASK			0x00FF0000
19762306a36Sopenharmony_ci#define		CI_DIG_THERM_INTL_SHIFT			16
19862306a36Sopenharmony_ci#define 	THERM_INT_MASK_HIGH			(1 << 24)
19962306a36Sopenharmony_ci#define 	THERM_INT_MASK_LOW			(1 << 25)
20062306a36Sopenharmony_ci#define	CG_MULT_THERMAL_CTRL				0xC0300010
20162306a36Sopenharmony_ci#define		TEMP_SEL(x)				((x) << 20)
20262306a36Sopenharmony_ci#define		TEMP_SEL_MASK				(0xff << 20)
20362306a36Sopenharmony_ci#define		TEMP_SEL_SHIFT				20
20462306a36Sopenharmony_ci#define	CG_MULT_THERMAL_STATUS				0xC0300014
20562306a36Sopenharmony_ci#define		ASIC_MAX_TEMP(x)			((x) << 0)
20662306a36Sopenharmony_ci#define		ASIC_MAX_TEMP_MASK			0x000001ff
20762306a36Sopenharmony_ci#define		ASIC_MAX_TEMP_SHIFT			0
20862306a36Sopenharmony_ci#define		CTF_TEMP(x)				((x) << 9)
20962306a36Sopenharmony_ci#define		CTF_TEMP_MASK				0x0003fe00
21062306a36Sopenharmony_ci#define		CTF_TEMP_SHIFT				9
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci#define	CG_FDO_CTRL0					0xC0300064
21362306a36Sopenharmony_ci#define		FDO_STATIC_DUTY(x)			((x) << 0)
21462306a36Sopenharmony_ci#define		FDO_STATIC_DUTY_MASK			0x000000FF
21562306a36Sopenharmony_ci#define		FDO_STATIC_DUTY_SHIFT			0
21662306a36Sopenharmony_ci#define	CG_FDO_CTRL1					0xC0300068
21762306a36Sopenharmony_ci#define		FMAX_DUTY100(x)				((x) << 0)
21862306a36Sopenharmony_ci#define		FMAX_DUTY100_MASK			0x000000FF
21962306a36Sopenharmony_ci#define		FMAX_DUTY100_SHIFT			0
22062306a36Sopenharmony_ci#define	CG_FDO_CTRL2					0xC030006C
22162306a36Sopenharmony_ci#define		TMIN(x)					((x) << 0)
22262306a36Sopenharmony_ci#define		TMIN_MASK				0x000000FF
22362306a36Sopenharmony_ci#define		TMIN_SHIFT				0
22462306a36Sopenharmony_ci#define		FDO_PWM_MODE(x)				((x) << 11)
22562306a36Sopenharmony_ci#define		FDO_PWM_MODE_MASK			(7 << 11)
22662306a36Sopenharmony_ci#define		FDO_PWM_MODE_SHIFT			11
22762306a36Sopenharmony_ci#define		TACH_PWM_RESP_RATE(x)			((x) << 25)
22862306a36Sopenharmony_ci#define		TACH_PWM_RESP_RATE_MASK			(0x7f << 25)
22962306a36Sopenharmony_ci#define		TACH_PWM_RESP_RATE_SHIFT		25
23062306a36Sopenharmony_ci#define CG_TACH_CTRL                                    0xC0300070
23162306a36Sopenharmony_ci#       define EDGE_PER_REV(x)                          ((x) << 0)
23262306a36Sopenharmony_ci#       define EDGE_PER_REV_MASK                        (0x7 << 0)
23362306a36Sopenharmony_ci#       define EDGE_PER_REV_SHIFT                       0
23462306a36Sopenharmony_ci#       define TARGET_PERIOD(x)                         ((x) << 3)
23562306a36Sopenharmony_ci#       define TARGET_PERIOD_MASK                       0xfffffff8
23662306a36Sopenharmony_ci#       define TARGET_PERIOD_SHIFT                      3
23762306a36Sopenharmony_ci#define CG_TACH_STATUS                                  0xC0300074
23862306a36Sopenharmony_ci#       define TACH_PERIOD(x)                           ((x) << 0)
23962306a36Sopenharmony_ci#       define TACH_PERIOD_MASK                         0xffffffff
24062306a36Sopenharmony_ci#       define TACH_PERIOD_SHIFT                        0
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci#define CG_ECLK_CNTL                                    0xC05000AC
24362306a36Sopenharmony_ci#       define ECLK_DIVIDER_MASK                        0x7f
24462306a36Sopenharmony_ci#       define ECLK_DIR_CNTL_EN                         (1 << 8)
24562306a36Sopenharmony_ci#define CG_ECLK_STATUS                                  0xC05000B0
24662306a36Sopenharmony_ci#       define ECLK_STATUS                              (1 << 0)
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL				0xC0500140
24962306a36Sopenharmony_ci#define		SPLL_RESET				(1 << 0)
25062306a36Sopenharmony_ci#define		SPLL_PWRON				(1 << 1)
25162306a36Sopenharmony_ci#define		SPLL_BYPASS_EN				(1 << 3)
25262306a36Sopenharmony_ci#define		SPLL_REF_DIV(x)				((x) << 5)
25362306a36Sopenharmony_ci#define		SPLL_REF_DIV_MASK			(0x3f << 5)
25462306a36Sopenharmony_ci#define		SPLL_PDIV_A(x)				((x) << 20)
25562306a36Sopenharmony_ci#define		SPLL_PDIV_A_MASK			(0x7f << 20)
25662306a36Sopenharmony_ci#define		SPLL_PDIV_A_SHIFT			20
25762306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL_2				0xC0500144
25862306a36Sopenharmony_ci#define		SCLK_MUX_SEL(x)				((x) << 0)
25962306a36Sopenharmony_ci#define		SCLK_MUX_SEL_MASK			(0x1ff << 0)
26062306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL_3				0xC0500148
26162306a36Sopenharmony_ci#define		SPLL_FB_DIV(x)				((x) << 0)
26262306a36Sopenharmony_ci#define		SPLL_FB_DIV_MASK			(0x3ffffff << 0)
26362306a36Sopenharmony_ci#define		SPLL_FB_DIV_SHIFT			0
26462306a36Sopenharmony_ci#define		SPLL_DITHEN				(1 << 28)
26562306a36Sopenharmony_ci#define	CG_SPLL_FUNC_CNTL_4				0xC050014C
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci#define	CG_SPLL_SPREAD_SPECTRUM				0xC0500164
26862306a36Sopenharmony_ci#define		SSEN					(1 << 0)
26962306a36Sopenharmony_ci#define		CLK_S(x)				((x) << 4)
27062306a36Sopenharmony_ci#define		CLK_S_MASK				(0xfff << 4)
27162306a36Sopenharmony_ci#define		CLK_S_SHIFT				4
27262306a36Sopenharmony_ci#define	CG_SPLL_SPREAD_SPECTRUM_2			0xC0500168
27362306a36Sopenharmony_ci#define		CLK_V(x)				((x) << 0)
27462306a36Sopenharmony_ci#define		CLK_V_MASK				(0x3ffffff << 0)
27562306a36Sopenharmony_ci#define		CLK_V_SHIFT				0
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci#define	MPLL_BYPASSCLK_SEL				0xC050019C
27862306a36Sopenharmony_ci#	define MPLL_CLKOUT_SEL(x)			((x) << 8)
27962306a36Sopenharmony_ci#	define MPLL_CLKOUT_SEL_MASK			0xFF00
28062306a36Sopenharmony_ci#define CG_CLKPIN_CNTL                                    0xC05001A0
28162306a36Sopenharmony_ci#       define XTALIN_DIVIDE                              (1 << 1)
28262306a36Sopenharmony_ci#       define BCLK_AS_XCLK                               (1 << 2)
28362306a36Sopenharmony_ci#define CG_CLKPIN_CNTL_2                                  0xC05001A4
28462306a36Sopenharmony_ci#       define FORCE_BIF_REFCLK_EN                        (1 << 3)
28562306a36Sopenharmony_ci#       define MUX_TCLK_TO_XCLK                           (1 << 8)
28662306a36Sopenharmony_ci#define	THM_CLK_CNTL					0xC05001A8
28762306a36Sopenharmony_ci#	define CMON_CLK_SEL(x)				((x) << 0)
28862306a36Sopenharmony_ci#	define CMON_CLK_SEL_MASK			0xFF
28962306a36Sopenharmony_ci#	define TMON_CLK_SEL(x)				((x) << 8)
29062306a36Sopenharmony_ci#	define TMON_CLK_SEL_MASK			0xFF00
29162306a36Sopenharmony_ci#define	MISC_CLK_CTRL					0xC05001AC
29262306a36Sopenharmony_ci#	define DEEP_SLEEP_CLK_SEL(x)			((x) << 0)
29362306a36Sopenharmony_ci#	define DEEP_SLEEP_CLK_SEL_MASK			0xFF
29462306a36Sopenharmony_ci#	define ZCLK_SEL(x)				((x) << 8)
29562306a36Sopenharmony_ci#	define ZCLK_SEL_MASK				0xFF00
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci/* KV/KB */
29862306a36Sopenharmony_ci#define	CG_THERMAL_INT_CTRL				0xC2100028
29962306a36Sopenharmony_ci#define		DIG_THERM_INTH(x)			((x) << 0)
30062306a36Sopenharmony_ci#define		DIG_THERM_INTH_MASK			0x000000FF
30162306a36Sopenharmony_ci#define		DIG_THERM_INTH_SHIFT			0
30262306a36Sopenharmony_ci#define		DIG_THERM_INTL(x)			((x) << 8)
30362306a36Sopenharmony_ci#define		DIG_THERM_INTL_MASK			0x0000FF00
30462306a36Sopenharmony_ci#define		DIG_THERM_INTL_SHIFT			8
30562306a36Sopenharmony_ci#define 	THERM_INTH_MASK				(1 << 24)
30662306a36Sopenharmony_ci#define 	THERM_INTL_MASK				(1 << 25)
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci/* PCIE registers idx/data 0x38/0x3c */
30962306a36Sopenharmony_ci#define PB0_PIF_PWRDOWN_0                                 0x1100012 /* PCIE */
31062306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_0(x)               ((x) << 7)
31162306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_0_MASK             (0x7 << 7)
31262306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_0_SHIFT            7
31362306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_0(x)                ((x) << 10)
31462306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_0_MASK              (0x7 << 10)
31562306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_0_SHIFT             10
31662306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_0(x)                      ((x) << 24)
31762306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_0_MASK                    (0x7 << 24)
31862306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_0_SHIFT                   24
31962306a36Sopenharmony_ci#define PB0_PIF_PWRDOWN_1                                 0x1100013 /* PCIE */
32062306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_1(x)               ((x) << 7)
32162306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_1_MASK             (0x7 << 7)
32262306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_TXS2_1_SHIFT            7
32362306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_1(x)                ((x) << 10)
32462306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_1_MASK              (0x7 << 10)
32562306a36Sopenharmony_ci#       define PLL_POWER_STATE_IN_OFF_1_SHIFT             10
32662306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_1(x)                      ((x) << 24)
32762306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_1_MASK                    (0x7 << 24)
32862306a36Sopenharmony_ci#       define PLL_RAMP_UP_TIME_1_SHIFT                   24
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci#define PCIE_CNTL2                                        0x1001001c /* PCIE */
33162306a36Sopenharmony_ci#       define SLV_MEM_LS_EN                              (1 << 16)
33262306a36Sopenharmony_ci#       define SLV_MEM_AGGRESSIVE_LS_EN                   (1 << 17)
33362306a36Sopenharmony_ci#       define MST_MEM_LS_EN                              (1 << 18)
33462306a36Sopenharmony_ci#       define REPLAY_MEM_LS_EN                           (1 << 19)
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci#define PCIE_LC_STATUS1                                   0x1400028 /* PCIE */
33762306a36Sopenharmony_ci#       define LC_REVERSE_RCVR                            (1 << 0)
33862306a36Sopenharmony_ci#       define LC_REVERSE_XMIT                            (1 << 1)
33962306a36Sopenharmony_ci#       define LC_OPERATING_LINK_WIDTH_MASK               (0x7 << 2)
34062306a36Sopenharmony_ci#       define LC_OPERATING_LINK_WIDTH_SHIFT              2
34162306a36Sopenharmony_ci#       define LC_DETECTED_LINK_WIDTH_MASK                (0x7 << 5)
34262306a36Sopenharmony_ci#       define LC_DETECTED_LINK_WIDTH_SHIFT               5
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci#define PCIE_P_CNTL                                       0x1400040 /* PCIE */
34562306a36Sopenharmony_ci#       define P_IGNORE_EDB_ERR                           (1 << 6)
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci#define PB1_PIF_PWRDOWN_0                                 0x2100012 /* PCIE */
34862306a36Sopenharmony_ci#define PB1_PIF_PWRDOWN_1                                 0x2100013 /* PCIE */
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci#define PCIE_LC_CNTL                                      0x100100A0 /* PCIE */
35162306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY(x)                       ((x) << 8)
35262306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY_MASK                     (0xf << 8)
35362306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY_SHIFT                    8
35462306a36Sopenharmony_ci#       define LC_L1_INACTIVITY(x)                        ((x) << 12)
35562306a36Sopenharmony_ci#       define LC_L1_INACTIVITY_MASK                      (0xf << 12)
35662306a36Sopenharmony_ci#       define LC_L1_INACTIVITY_SHIFT                     12
35762306a36Sopenharmony_ci#       define LC_PMI_TO_L1_DIS                           (1 << 16)
35862306a36Sopenharmony_ci#       define LC_ASPM_TO_L1_DIS                          (1 << 24)
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci#define PCIE_LC_LINK_WIDTH_CNTL                           0x100100A2 /* PCIE */
36162306a36Sopenharmony_ci#       define LC_LINK_WIDTH_SHIFT                        0
36262306a36Sopenharmony_ci#       define LC_LINK_WIDTH_MASK                         0x7
36362306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X0                           0
36462306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X1                           1
36562306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X2                           2
36662306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X4                           3
36762306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X8                           4
36862306a36Sopenharmony_ci#       define LC_LINK_WIDTH_X16                          6
36962306a36Sopenharmony_ci#       define LC_LINK_WIDTH_RD_SHIFT                     4
37062306a36Sopenharmony_ci#       define LC_LINK_WIDTH_RD_MASK                      0x70
37162306a36Sopenharmony_ci#       define LC_RECONFIG_ARC_MISSING_ESCAPE             (1 << 7)
37262306a36Sopenharmony_ci#       define LC_RECONFIG_NOW                            (1 << 8)
37362306a36Sopenharmony_ci#       define LC_RENEGOTIATION_SUPPORT                   (1 << 9)
37462306a36Sopenharmony_ci#       define LC_RENEGOTIATE_EN                          (1 << 10)
37562306a36Sopenharmony_ci#       define LC_SHORT_RECONFIG_EN                       (1 << 11)
37662306a36Sopenharmony_ci#       define LC_UPCONFIGURE_SUPPORT                     (1 << 12)
37762306a36Sopenharmony_ci#       define LC_UPCONFIGURE_DIS                         (1 << 13)
37862306a36Sopenharmony_ci#       define LC_DYN_LANES_PWR_STATE(x)                  ((x) << 21)
37962306a36Sopenharmony_ci#       define LC_DYN_LANES_PWR_STATE_MASK                (0x3 << 21)
38062306a36Sopenharmony_ci#       define LC_DYN_LANES_PWR_STATE_SHIFT               21
38162306a36Sopenharmony_ci#define PCIE_LC_N_FTS_CNTL                                0x100100a3 /* PCIE */
38262306a36Sopenharmony_ci#       define LC_XMIT_N_FTS(x)                           ((x) << 0)
38362306a36Sopenharmony_ci#       define LC_XMIT_N_FTS_MASK                         (0xff << 0)
38462306a36Sopenharmony_ci#       define LC_XMIT_N_FTS_SHIFT                        0
38562306a36Sopenharmony_ci#       define LC_XMIT_N_FTS_OVERRIDE_EN                  (1 << 8)
38662306a36Sopenharmony_ci#       define LC_N_FTS_MASK                              (0xff << 24)
38762306a36Sopenharmony_ci#define PCIE_LC_SPEED_CNTL                                0x100100A4 /* PCIE */
38862306a36Sopenharmony_ci#       define LC_GEN2_EN_STRAP                           (1 << 0)
38962306a36Sopenharmony_ci#       define LC_GEN3_EN_STRAP                           (1 << 1)
39062306a36Sopenharmony_ci#       define LC_TARGET_LINK_SPEED_OVERRIDE_EN           (1 << 2)
39162306a36Sopenharmony_ci#       define LC_TARGET_LINK_SPEED_OVERRIDE_MASK         (0x3 << 3)
39262306a36Sopenharmony_ci#       define LC_TARGET_LINK_SPEED_OVERRIDE_SHIFT        3
39362306a36Sopenharmony_ci#       define LC_FORCE_EN_SW_SPEED_CHANGE                (1 << 5)
39462306a36Sopenharmony_ci#       define LC_FORCE_DIS_SW_SPEED_CHANGE               (1 << 6)
39562306a36Sopenharmony_ci#       define LC_FORCE_EN_HW_SPEED_CHANGE                (1 << 7)
39662306a36Sopenharmony_ci#       define LC_FORCE_DIS_HW_SPEED_CHANGE               (1 << 8)
39762306a36Sopenharmony_ci#       define LC_INITIATE_LINK_SPEED_CHANGE              (1 << 9)
39862306a36Sopenharmony_ci#       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK      (0x3 << 10)
39962306a36Sopenharmony_ci#       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT     10
40062306a36Sopenharmony_ci#       define LC_CURRENT_DATA_RATE_MASK                  (0x3 << 13) /* 0/1/2 = gen1/2/3 */
40162306a36Sopenharmony_ci#       define LC_CURRENT_DATA_RATE_SHIFT                 13
40262306a36Sopenharmony_ci#       define LC_CLR_FAILED_SPD_CHANGE_CNT               (1 << 16)
40362306a36Sopenharmony_ci#       define LC_OTHER_SIDE_EVER_SENT_GEN2               (1 << 18)
40462306a36Sopenharmony_ci#       define LC_OTHER_SIDE_SUPPORTS_GEN2                (1 << 19)
40562306a36Sopenharmony_ci#       define LC_OTHER_SIDE_EVER_SENT_GEN3               (1 << 20)
40662306a36Sopenharmony_ci#       define LC_OTHER_SIDE_SUPPORTS_GEN3                (1 << 21)
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_ci#define PCIE_LC_CNTL2                                     0x100100B1 /* PCIE */
40962306a36Sopenharmony_ci#       define LC_ALLOW_PDWN_IN_L1                        (1 << 17)
41062306a36Sopenharmony_ci#       define LC_ALLOW_PDWN_IN_L23                       (1 << 18)
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci#define PCIE_LC_CNTL3                                     0x100100B5 /* PCIE */
41362306a36Sopenharmony_ci#       define LC_GO_TO_RECOVERY                          (1 << 30)
41462306a36Sopenharmony_ci#define PCIE_LC_CNTL4                                     0x100100B6 /* PCIE */
41562306a36Sopenharmony_ci#       define LC_REDO_EQ                                 (1 << 5)
41662306a36Sopenharmony_ci#       define LC_SET_QUIESCE                             (1 << 13)
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ci/* direct registers */
41962306a36Sopenharmony_ci#define PCIE_INDEX  					0x38
42062306a36Sopenharmony_ci#define PCIE_DATA  					0x3C
42162306a36Sopenharmony_ci
42262306a36Sopenharmony_ci#define SMC_IND_INDEX_0  				0x200
42362306a36Sopenharmony_ci#define SMC_IND_DATA_0  				0x204
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci#define SMC_IND_ACCESS_CNTL  				0x240
42662306a36Sopenharmony_ci#define		AUTO_INCREMENT_IND_0			(1 << 0)
42762306a36Sopenharmony_ci
42862306a36Sopenharmony_ci#define SMC_MESSAGE_0  					0x250
42962306a36Sopenharmony_ci#define		SMC_MSG_MASK				0xffff
43062306a36Sopenharmony_ci#define SMC_RESP_0  					0x254
43162306a36Sopenharmony_ci#define		SMC_RESP_MASK				0xffff
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_ci#define SMC_MSG_ARG_0  					0x290
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci#define VGA_HDP_CONTROL  				0x328
43662306a36Sopenharmony_ci#define		VGA_MEMORY_DISABLE				(1 << 4)
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci#define DMIF_ADDR_CALC  				0xC00
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci#define	PIPE0_DMIF_BUFFER_CONTROL			  0x0ca0
44162306a36Sopenharmony_ci#       define DMIF_BUFFERS_ALLOCATED(x)                  ((x) << 0)
44262306a36Sopenharmony_ci#       define DMIF_BUFFERS_ALLOCATED_COMPLETED           (1 << 4)
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ci#define	SRBM_GFX_CNTL				        0xE44
44562306a36Sopenharmony_ci#define		PIPEID(x)					((x) << 0)
44662306a36Sopenharmony_ci#define		MEID(x)						((x) << 2)
44762306a36Sopenharmony_ci#define		VMID(x)						((x) << 4)
44862306a36Sopenharmony_ci#define		QUEUEID(x)					((x) << 8)
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci#define	SRBM_STATUS2				        0xE4C
45162306a36Sopenharmony_ci#define		SDMA_BUSY 				(1 << 5)
45262306a36Sopenharmony_ci#define		SDMA1_BUSY 				(1 << 6)
45362306a36Sopenharmony_ci#define	SRBM_STATUS				        0xE50
45462306a36Sopenharmony_ci#define		UVD_RQ_PENDING 				(1 << 1)
45562306a36Sopenharmony_ci#define		GRBM_RQ_PENDING 			(1 << 5)
45662306a36Sopenharmony_ci#define		VMC_BUSY 				(1 << 8)
45762306a36Sopenharmony_ci#define		MCB_BUSY 				(1 << 9)
45862306a36Sopenharmony_ci#define		MCB_NON_DISPLAY_BUSY 			(1 << 10)
45962306a36Sopenharmony_ci#define		MCC_BUSY 				(1 << 11)
46062306a36Sopenharmony_ci#define		MCD_BUSY 				(1 << 12)
46162306a36Sopenharmony_ci#define		SEM_BUSY 				(1 << 14)
46262306a36Sopenharmony_ci#define		IH_BUSY 				(1 << 17)
46362306a36Sopenharmony_ci#define		UVD_BUSY 				(1 << 19)
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci#define	SRBM_SOFT_RESET				        0xE60
46662306a36Sopenharmony_ci#define		SOFT_RESET_BIF				(1 << 1)
46762306a36Sopenharmony_ci#define		SOFT_RESET_R0PLL			(1 << 4)
46862306a36Sopenharmony_ci#define		SOFT_RESET_DC				(1 << 5)
46962306a36Sopenharmony_ci#define		SOFT_RESET_SDMA1			(1 << 6)
47062306a36Sopenharmony_ci#define		SOFT_RESET_GRBM				(1 << 8)
47162306a36Sopenharmony_ci#define		SOFT_RESET_HDP				(1 << 9)
47262306a36Sopenharmony_ci#define		SOFT_RESET_IH				(1 << 10)
47362306a36Sopenharmony_ci#define		SOFT_RESET_MC				(1 << 11)
47462306a36Sopenharmony_ci#define		SOFT_RESET_ROM				(1 << 14)
47562306a36Sopenharmony_ci#define		SOFT_RESET_SEM				(1 << 15)
47662306a36Sopenharmony_ci#define		SOFT_RESET_VMC				(1 << 17)
47762306a36Sopenharmony_ci#define		SOFT_RESET_SDMA				(1 << 20)
47862306a36Sopenharmony_ci#define		SOFT_RESET_TST				(1 << 21)
47962306a36Sopenharmony_ci#define		SOFT_RESET_REGBB		       	(1 << 22)
48062306a36Sopenharmony_ci#define		SOFT_RESET_ORB				(1 << 23)
48162306a36Sopenharmony_ci#define		SOFT_RESET_VCE				(1 << 24)
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci#define SRBM_READ_ERROR					0xE98
48462306a36Sopenharmony_ci#define SRBM_INT_CNTL					0xEA0
48562306a36Sopenharmony_ci#define SRBM_INT_ACK					0xEA8
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci#define VM_L2_CNTL					0x1400
48862306a36Sopenharmony_ci#define		ENABLE_L2_CACHE					(1 << 0)
48962306a36Sopenharmony_ci#define		ENABLE_L2_FRAGMENT_PROCESSING			(1 << 1)
49062306a36Sopenharmony_ci#define		L2_CACHE_PTE_ENDIAN_SWAP_MODE(x)		((x) << 2)
49162306a36Sopenharmony_ci#define		L2_CACHE_PDE_ENDIAN_SWAP_MODE(x)		((x) << 4)
49262306a36Sopenharmony_ci#define		ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE		(1 << 9)
49362306a36Sopenharmony_ci#define		ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE	(1 << 10)
49462306a36Sopenharmony_ci#define		EFFECTIVE_L2_QUEUE_SIZE(x)			(((x) & 7) << 15)
49562306a36Sopenharmony_ci#define		CONTEXT1_IDENTITY_ACCESS_MODE(x)		(((x) & 3) << 19)
49662306a36Sopenharmony_ci#define VM_L2_CNTL2					0x1404
49762306a36Sopenharmony_ci#define		INVALIDATE_ALL_L1_TLBS				(1 << 0)
49862306a36Sopenharmony_ci#define		INVALIDATE_L2_CACHE				(1 << 1)
49962306a36Sopenharmony_ci#define		INVALIDATE_CACHE_MODE(x)			((x) << 26)
50062306a36Sopenharmony_ci#define			INVALIDATE_PTE_AND_PDE_CACHES		0
50162306a36Sopenharmony_ci#define			INVALIDATE_ONLY_PTE_CACHES		1
50262306a36Sopenharmony_ci#define			INVALIDATE_ONLY_PDE_CACHES		2
50362306a36Sopenharmony_ci#define VM_L2_CNTL3					0x1408
50462306a36Sopenharmony_ci#define		BANK_SELECT(x)					((x) << 0)
50562306a36Sopenharmony_ci#define		L2_CACHE_UPDATE_MODE(x)				((x) << 6)
50662306a36Sopenharmony_ci#define		L2_CACHE_BIGK_FRAGMENT_SIZE(x)			((x) << 15)
50762306a36Sopenharmony_ci#define		L2_CACHE_BIGK_ASSOCIATIVITY			(1 << 20)
50862306a36Sopenharmony_ci#define	VM_L2_STATUS					0x140C
50962306a36Sopenharmony_ci#define		L2_BUSY						(1 << 0)
51062306a36Sopenharmony_ci#define VM_CONTEXT0_CNTL				0x1410
51162306a36Sopenharmony_ci#define		ENABLE_CONTEXT					(1 << 0)
51262306a36Sopenharmony_ci#define		PAGE_TABLE_DEPTH(x)				(((x) & 3) << 1)
51362306a36Sopenharmony_ci#define		RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 3)
51462306a36Sopenharmony_ci#define		RANGE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 4)
51562306a36Sopenharmony_ci#define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT	(1 << 6)
51662306a36Sopenharmony_ci#define		DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT	(1 << 7)
51762306a36Sopenharmony_ci#define		PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 9)
51862306a36Sopenharmony_ci#define		PDE0_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 10)
51962306a36Sopenharmony_ci#define		VALID_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 12)
52062306a36Sopenharmony_ci#define		VALID_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 13)
52162306a36Sopenharmony_ci#define		READ_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 15)
52262306a36Sopenharmony_ci#define		READ_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 16)
52362306a36Sopenharmony_ci#define		WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT		(1 << 18)
52462306a36Sopenharmony_ci#define		WRITE_PROTECTION_FAULT_ENABLE_DEFAULT		(1 << 19)
52562306a36Sopenharmony_ci#define		PAGE_TABLE_BLOCK_SIZE(x)			(((x) & 0xF) << 24)
52662306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL				0x1414
52762306a36Sopenharmony_ci#define VM_CONTEXT0_CNTL2				0x1430
52862306a36Sopenharmony_ci#define VM_CONTEXT1_CNTL2				0x1434
52962306a36Sopenharmony_ci#define	VM_CONTEXT8_PAGE_TABLE_BASE_ADDR		0x1438
53062306a36Sopenharmony_ci#define	VM_CONTEXT9_PAGE_TABLE_BASE_ADDR		0x143c
53162306a36Sopenharmony_ci#define	VM_CONTEXT10_PAGE_TABLE_BASE_ADDR		0x1440
53262306a36Sopenharmony_ci#define	VM_CONTEXT11_PAGE_TABLE_BASE_ADDR		0x1444
53362306a36Sopenharmony_ci#define	VM_CONTEXT12_PAGE_TABLE_BASE_ADDR		0x1448
53462306a36Sopenharmony_ci#define	VM_CONTEXT13_PAGE_TABLE_BASE_ADDR		0x144c
53562306a36Sopenharmony_ci#define	VM_CONTEXT14_PAGE_TABLE_BASE_ADDR		0x1450
53662306a36Sopenharmony_ci#define	VM_CONTEXT15_PAGE_TABLE_BASE_ADDR		0x1454
53762306a36Sopenharmony_ci
53862306a36Sopenharmony_ci#define VM_INVALIDATE_REQUEST				0x1478
53962306a36Sopenharmony_ci#define VM_INVALIDATE_RESPONSE				0x147c
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci#define	VM_CONTEXT1_PROTECTION_FAULT_STATUS		0x14DC
54262306a36Sopenharmony_ci#define		PROTECTIONS_MASK			(0xf << 0)
54362306a36Sopenharmony_ci#define		PROTECTIONS_SHIFT			0
54462306a36Sopenharmony_ci		/* bit 0: range
54562306a36Sopenharmony_ci		 * bit 1: pde0
54662306a36Sopenharmony_ci		 * bit 2: valid
54762306a36Sopenharmony_ci		 * bit 3: read
54862306a36Sopenharmony_ci		 * bit 4: write
54962306a36Sopenharmony_ci		 */
55062306a36Sopenharmony_ci#define		MEMORY_CLIENT_ID_MASK			(0xff << 12)
55162306a36Sopenharmony_ci#define		HAWAII_MEMORY_CLIENT_ID_MASK		(0x1ff << 12)
55262306a36Sopenharmony_ci#define		MEMORY_CLIENT_ID_SHIFT			12
55362306a36Sopenharmony_ci#define		MEMORY_CLIENT_RW_MASK			(1 << 24)
55462306a36Sopenharmony_ci#define		MEMORY_CLIENT_RW_SHIFT			24
55562306a36Sopenharmony_ci#define		FAULT_VMID_MASK				(0xf << 25)
55662306a36Sopenharmony_ci#define		FAULT_VMID_SHIFT			25
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci#define	VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT		0x14E4
55962306a36Sopenharmony_ci
56062306a36Sopenharmony_ci#define	VM_CONTEXT1_PROTECTION_FAULT_ADDR		0x14FC
56162306a36Sopenharmony_ci
56262306a36Sopenharmony_ci#define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR	0x1518
56362306a36Sopenharmony_ci#define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR	0x151c
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci#define	VM_CONTEXT0_PAGE_TABLE_BASE_ADDR		0x153c
56662306a36Sopenharmony_ci#define	VM_CONTEXT1_PAGE_TABLE_BASE_ADDR		0x1540
56762306a36Sopenharmony_ci#define	VM_CONTEXT2_PAGE_TABLE_BASE_ADDR		0x1544
56862306a36Sopenharmony_ci#define	VM_CONTEXT3_PAGE_TABLE_BASE_ADDR		0x1548
56962306a36Sopenharmony_ci#define	VM_CONTEXT4_PAGE_TABLE_BASE_ADDR		0x154c
57062306a36Sopenharmony_ci#define	VM_CONTEXT5_PAGE_TABLE_BASE_ADDR		0x1550
57162306a36Sopenharmony_ci#define	VM_CONTEXT6_PAGE_TABLE_BASE_ADDR		0x1554
57262306a36Sopenharmony_ci#define	VM_CONTEXT7_PAGE_TABLE_BASE_ADDR		0x1558
57362306a36Sopenharmony_ci#define	VM_CONTEXT0_PAGE_TABLE_START_ADDR		0x155c
57462306a36Sopenharmony_ci#define	VM_CONTEXT1_PAGE_TABLE_START_ADDR		0x1560
57562306a36Sopenharmony_ci
57662306a36Sopenharmony_ci#define	VM_CONTEXT0_PAGE_TABLE_END_ADDR			0x157C
57762306a36Sopenharmony_ci#define	VM_CONTEXT1_PAGE_TABLE_END_ADDR			0x1580
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci#define VM_L2_CG           				0x15c0
58062306a36Sopenharmony_ci#define		MC_CG_ENABLE				(1 << 18)
58162306a36Sopenharmony_ci#define		MC_LS_ENABLE				(1 << 19)
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci#define MC_SHARED_CHMAP						0x2004
58462306a36Sopenharmony_ci#define		NOOFCHAN_SHIFT					12
58562306a36Sopenharmony_ci#define		NOOFCHAN_MASK					0x0000f000
58662306a36Sopenharmony_ci#define MC_SHARED_CHREMAP					0x2008
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci#define CHUB_CONTROL					0x1864
58962306a36Sopenharmony_ci#define		BYPASS_VM					(1 << 0)
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci#define	MC_VM_FB_LOCATION				0x2024
59262306a36Sopenharmony_ci#define	MC_VM_AGP_TOP					0x2028
59362306a36Sopenharmony_ci#define	MC_VM_AGP_BOT					0x202C
59462306a36Sopenharmony_ci#define	MC_VM_AGP_BASE					0x2030
59562306a36Sopenharmony_ci#define	MC_VM_SYSTEM_APERTURE_LOW_ADDR			0x2034
59662306a36Sopenharmony_ci#define	MC_VM_SYSTEM_APERTURE_HIGH_ADDR			0x2038
59762306a36Sopenharmony_ci#define	MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR		0x203C
59862306a36Sopenharmony_ci
59962306a36Sopenharmony_ci#define	MC_VM_MX_L1_TLB_CNTL				0x2064
60062306a36Sopenharmony_ci#define		ENABLE_L1_TLB					(1 << 0)
60162306a36Sopenharmony_ci#define		ENABLE_L1_FRAGMENT_PROCESSING			(1 << 1)
60262306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_PA_ONLY			(0 << 3)
60362306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_USE_SYS_MAP			(1 << 3)
60462306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_IN_SYS			(2 << 3)
60562306a36Sopenharmony_ci#define		SYSTEM_ACCESS_MODE_NOT_IN_SYS			(3 << 3)
60662306a36Sopenharmony_ci#define		SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU	(0 << 5)
60762306a36Sopenharmony_ci#define		ENABLE_ADVANCED_DRIVER_MODEL			(1 << 6)
60862306a36Sopenharmony_ci#define	MC_VM_FB_OFFSET					0x2068
60962306a36Sopenharmony_ci
61062306a36Sopenharmony_ci#define MC_SHARED_BLACKOUT_CNTL           		0x20ac
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ci#define MC_HUB_MISC_HUB_CG           			0x20b8
61362306a36Sopenharmony_ci#define MC_HUB_MISC_VM_CG           			0x20bc
61462306a36Sopenharmony_ci
61562306a36Sopenharmony_ci#define MC_HUB_MISC_SIP_CG           			0x20c0
61662306a36Sopenharmony_ci
61762306a36Sopenharmony_ci#define MC_XPB_CLK_GAT           			0x2478
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci#define MC_CITF_MISC_RD_CG           			0x2648
62062306a36Sopenharmony_ci#define MC_CITF_MISC_WR_CG           			0x264c
62162306a36Sopenharmony_ci#define MC_CITF_MISC_VM_CG           			0x2650
62262306a36Sopenharmony_ci
62362306a36Sopenharmony_ci#define	MC_ARB_RAMCFG					0x2760
62462306a36Sopenharmony_ci#define		NOOFBANK_SHIFT					0
62562306a36Sopenharmony_ci#define		NOOFBANK_MASK					0x00000003
62662306a36Sopenharmony_ci#define		NOOFRANK_SHIFT					2
62762306a36Sopenharmony_ci#define		NOOFRANK_MASK					0x00000004
62862306a36Sopenharmony_ci#define		NOOFROWS_SHIFT					3
62962306a36Sopenharmony_ci#define		NOOFROWS_MASK					0x00000038
63062306a36Sopenharmony_ci#define		NOOFCOLS_SHIFT					6
63162306a36Sopenharmony_ci#define		NOOFCOLS_MASK					0x000000C0
63262306a36Sopenharmony_ci#define		CHANSIZE_SHIFT					8
63362306a36Sopenharmony_ci#define		CHANSIZE_MASK					0x00000100
63462306a36Sopenharmony_ci#define		NOOFGROUPS_SHIFT				12
63562306a36Sopenharmony_ci#define		NOOFGROUPS_MASK					0x00001000
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ci#define	MC_ARB_DRAM_TIMING				0x2774
63862306a36Sopenharmony_ci#define	MC_ARB_DRAM_TIMING2				0x2778
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci#define MC_ARB_BURST_TIME                               0x2808
64162306a36Sopenharmony_ci#define		STATE0(x)				((x) << 0)
64262306a36Sopenharmony_ci#define		STATE0_MASK				(0x1f << 0)
64362306a36Sopenharmony_ci#define		STATE0_SHIFT				0
64462306a36Sopenharmony_ci#define		STATE1(x)				((x) << 5)
64562306a36Sopenharmony_ci#define		STATE1_MASK				(0x1f << 5)
64662306a36Sopenharmony_ci#define		STATE1_SHIFT				5
64762306a36Sopenharmony_ci#define		STATE2(x)				((x) << 10)
64862306a36Sopenharmony_ci#define		STATE2_MASK				(0x1f << 10)
64962306a36Sopenharmony_ci#define		STATE2_SHIFT				10
65062306a36Sopenharmony_ci#define		STATE3(x)				((x) << 15)
65162306a36Sopenharmony_ci#define		STATE3_MASK				(0x1f << 15)
65262306a36Sopenharmony_ci#define		STATE3_SHIFT				15
65362306a36Sopenharmony_ci
65462306a36Sopenharmony_ci#define MC_SEQ_RAS_TIMING                               0x28a0
65562306a36Sopenharmony_ci#define MC_SEQ_CAS_TIMING                               0x28a4
65662306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING                              0x28a8
65762306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING2                             0x28ac
65862306a36Sopenharmony_ci#define MC_SEQ_PMG_TIMING                               0x28b0
65962306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D0                                0x28b4
66062306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D1                                0x28b8
66162306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D0                                0x28bc
66262306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D1                                0x28c0
66362306a36Sopenharmony_ci
66462306a36Sopenharmony_ci#define MC_SEQ_SUP_CNTL           			0x28c8
66562306a36Sopenharmony_ci#define		RUN_MASK      				(1 << 0)
66662306a36Sopenharmony_ci#define MC_SEQ_SUP_PGM           			0x28cc
66762306a36Sopenharmony_ci#define MC_PMG_AUTO_CMD           			0x28d0
66862306a36Sopenharmony_ci
66962306a36Sopenharmony_ci#define	MC_SEQ_TRAIN_WAKEUP_CNTL			0x28e8
67062306a36Sopenharmony_ci#define		TRAIN_DONE_D0      			(1 << 30)
67162306a36Sopenharmony_ci#define		TRAIN_DONE_D1      			(1 << 31)
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci#define MC_IO_PAD_CNTL_D0           			0x29d0
67462306a36Sopenharmony_ci#define		MEM_FALL_OUT_CMD      			(1 << 8)
67562306a36Sopenharmony_ci
67662306a36Sopenharmony_ci#define MC_SEQ_MISC0           				0x2a00
67762306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_VEN_ID_SHIFT               8
67862306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_VEN_ID_MASK                0x00000f00
67962306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_VEN_ID_VALUE               3
68062306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_REV_ID_SHIFT               12
68162306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_REV_ID_MASK                0x0000f000
68262306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_REV_ID_VALUE               1
68362306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_GDDR5_SHIFT                28
68462306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_GDDR5_MASK                 0xf0000000
68562306a36Sopenharmony_ci#define 	MC_SEQ_MISC0_GDDR5_VALUE                5
68662306a36Sopenharmony_ci#define MC_SEQ_MISC1                                    0x2a04
68762306a36Sopenharmony_ci#define MC_SEQ_RESERVE_M                                0x2a08
68862306a36Sopenharmony_ci#define MC_PMG_CMD_EMRS                                 0x2a0c
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci#define MC_SEQ_IO_DEBUG_INDEX           		0x2a44
69162306a36Sopenharmony_ci#define MC_SEQ_IO_DEBUG_DATA           			0x2a48
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_ci#define MC_SEQ_MISC5                                    0x2a54
69462306a36Sopenharmony_ci#define MC_SEQ_MISC6                                    0x2a58
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci#define MC_SEQ_MISC7                                    0x2a64
69762306a36Sopenharmony_ci
69862306a36Sopenharmony_ci#define MC_SEQ_RAS_TIMING_LP                            0x2a6c
69962306a36Sopenharmony_ci#define MC_SEQ_CAS_TIMING_LP                            0x2a70
70062306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING_LP                           0x2a74
70162306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING2_LP                          0x2a78
70262306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D0_LP                             0x2a7c
70362306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D1_LP                             0x2a80
70462306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_EMRS_LP                          0x2a84
70562306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS_LP                           0x2a88
70662306a36Sopenharmony_ci
70762306a36Sopenharmony_ci#define MC_PMG_CMD_MRS                                  0x2aac
70862306a36Sopenharmony_ci
70962306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D0_LP                             0x2b1c
71062306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D1_LP                             0x2b20
71162306a36Sopenharmony_ci
71262306a36Sopenharmony_ci#define MC_PMG_CMD_MRS1                                 0x2b44
71362306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS1_LP                          0x2b48
71462306a36Sopenharmony_ci#define MC_SEQ_PMG_TIMING_LP                            0x2b4c
71562306a36Sopenharmony_ci
71662306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_2                                 0x2b54
71762306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_2_LP                              0x2b58
71862306a36Sopenharmony_ci#define MC_PMG_CMD_MRS2                                 0x2b5c
71962306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS2_LP                          0x2b60
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_ci#define	MCLK_PWRMGT_CNTL				0x2ba0
72262306a36Sopenharmony_ci#       define DLL_SPEED(x)				((x) << 0)
72362306a36Sopenharmony_ci#       define DLL_SPEED_MASK				(0x1f << 0)
72462306a36Sopenharmony_ci#       define DLL_READY                                (1 << 6)
72562306a36Sopenharmony_ci#       define MC_INT_CNTL                              (1 << 7)
72662306a36Sopenharmony_ci#       define MRDCK0_PDNB                              (1 << 8)
72762306a36Sopenharmony_ci#       define MRDCK1_PDNB                              (1 << 9)
72862306a36Sopenharmony_ci#       define MRDCK0_RESET                             (1 << 16)
72962306a36Sopenharmony_ci#       define MRDCK1_RESET                             (1 << 17)
73062306a36Sopenharmony_ci#       define DLL_READY_READ                           (1 << 24)
73162306a36Sopenharmony_ci#define	DLL_CNTL					0x2ba4
73262306a36Sopenharmony_ci#       define MRDCK0_BYPASS                            (1 << 24)
73362306a36Sopenharmony_ci#       define MRDCK1_BYPASS                            (1 << 25)
73462306a36Sopenharmony_ci
73562306a36Sopenharmony_ci#define	MPLL_FUNC_CNTL					0x2bb4
73662306a36Sopenharmony_ci#define		BWCTRL(x)				((x) << 20)
73762306a36Sopenharmony_ci#define		BWCTRL_MASK				(0xff << 20)
73862306a36Sopenharmony_ci#define	MPLL_FUNC_CNTL_1				0x2bb8
73962306a36Sopenharmony_ci#define		VCO_MODE(x)				((x) << 0)
74062306a36Sopenharmony_ci#define		VCO_MODE_MASK				(3 << 0)
74162306a36Sopenharmony_ci#define		CLKFRAC(x)				((x) << 4)
74262306a36Sopenharmony_ci#define		CLKFRAC_MASK				(0xfff << 4)
74362306a36Sopenharmony_ci#define		CLKF(x)					((x) << 16)
74462306a36Sopenharmony_ci#define		CLKF_MASK				(0xfff << 16)
74562306a36Sopenharmony_ci#define	MPLL_FUNC_CNTL_2				0x2bbc
74662306a36Sopenharmony_ci#define	MPLL_AD_FUNC_CNTL				0x2bc0
74762306a36Sopenharmony_ci#define		YCLK_POST_DIV(x)			((x) << 0)
74862306a36Sopenharmony_ci#define		YCLK_POST_DIV_MASK			(7 << 0)
74962306a36Sopenharmony_ci#define	MPLL_DQ_FUNC_CNTL				0x2bc4
75062306a36Sopenharmony_ci#define		YCLK_SEL(x)				((x) << 4)
75162306a36Sopenharmony_ci#define		YCLK_SEL_MASK				(1 << 4)
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_ci#define	MPLL_SS1					0x2bcc
75462306a36Sopenharmony_ci#define		CLKV(x)					((x) << 0)
75562306a36Sopenharmony_ci#define		CLKV_MASK				(0x3ffffff << 0)
75662306a36Sopenharmony_ci#define	MPLL_SS2					0x2bd0
75762306a36Sopenharmony_ci#define		CLKS(x)					((x) << 0)
75862306a36Sopenharmony_ci#define		CLKS_MASK				(0xfff << 0)
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci#define	HDP_HOST_PATH_CNTL				0x2C00
76162306a36Sopenharmony_ci#define 	CLOCK_GATING_DIS			(1 << 23)
76262306a36Sopenharmony_ci#define	HDP_NONSURFACE_BASE				0x2C04
76362306a36Sopenharmony_ci#define	HDP_NONSURFACE_INFO				0x2C08
76462306a36Sopenharmony_ci#define	HDP_NONSURFACE_SIZE				0x2C0C
76562306a36Sopenharmony_ci
76662306a36Sopenharmony_ci#define HDP_ADDR_CONFIG  				0x2F48
76762306a36Sopenharmony_ci#define HDP_MISC_CNTL					0x2F4C
76862306a36Sopenharmony_ci#define 	HDP_FLUSH_INVALIDATE_CACHE			(1 << 0)
76962306a36Sopenharmony_ci#define HDP_MEM_POWER_LS				0x2F50
77062306a36Sopenharmony_ci#define 	HDP_LS_ENABLE				(1 << 0)
77162306a36Sopenharmony_ci
77262306a36Sopenharmony_ci#define ATC_MISC_CG           				0x3350
77362306a36Sopenharmony_ci
77462306a36Sopenharmony_ci#define GMCON_RENG_EXECUTE				0x3508
77562306a36Sopenharmony_ci#define 	RENG_EXECUTE_ON_PWR_UP			(1 << 0)
77662306a36Sopenharmony_ci#define GMCON_MISC					0x350c
77762306a36Sopenharmony_ci#define 	RENG_EXECUTE_ON_REG_UPDATE		(1 << 11)
77862306a36Sopenharmony_ci#define 	STCTRL_STUTTER_EN			(1 << 16)
77962306a36Sopenharmony_ci
78062306a36Sopenharmony_ci#define GMCON_PGFSM_CONFIG				0x3538
78162306a36Sopenharmony_ci#define GMCON_PGFSM_WRITE				0x353c
78262306a36Sopenharmony_ci#define GMCON_PGFSM_READ				0x3540
78362306a36Sopenharmony_ci#define GMCON_MISC3					0x3544
78462306a36Sopenharmony_ci
78562306a36Sopenharmony_ci#define MC_SEQ_CNTL_3                                     0x3600
78662306a36Sopenharmony_ci#       define CAC_EN                                     (1 << 31)
78762306a36Sopenharmony_ci#define MC_SEQ_G5PDX_CTRL                                 0x3604
78862306a36Sopenharmony_ci#define MC_SEQ_G5PDX_CTRL_LP                              0x3608
78962306a36Sopenharmony_ci#define MC_SEQ_G5PDX_CMD0                                 0x360c
79062306a36Sopenharmony_ci#define MC_SEQ_G5PDX_CMD0_LP                              0x3610
79162306a36Sopenharmony_ci#define MC_SEQ_G5PDX_CMD1                                 0x3614
79262306a36Sopenharmony_ci#define MC_SEQ_G5PDX_CMD1_LP                              0x3618
79362306a36Sopenharmony_ci
79462306a36Sopenharmony_ci#define MC_SEQ_PMG_DVS_CTL                                0x3628
79562306a36Sopenharmony_ci#define MC_SEQ_PMG_DVS_CTL_LP                             0x362c
79662306a36Sopenharmony_ci#define MC_SEQ_PMG_DVS_CMD                                0x3630
79762306a36Sopenharmony_ci#define MC_SEQ_PMG_DVS_CMD_LP                             0x3634
79862306a36Sopenharmony_ci#define MC_SEQ_DLL_STBY                                   0x3638
79962306a36Sopenharmony_ci#define MC_SEQ_DLL_STBY_LP                                0x363c
80062306a36Sopenharmony_ci
80162306a36Sopenharmony_ci#define IH_RB_CNTL                                        0x3e00
80262306a36Sopenharmony_ci#       define IH_RB_ENABLE                               (1 << 0)
80362306a36Sopenharmony_ci#       define IH_RB_SIZE(x)                              ((x) << 1) /* log2 */
80462306a36Sopenharmony_ci#       define IH_RB_FULL_DRAIN_ENABLE                    (1 << 6)
80562306a36Sopenharmony_ci#       define IH_WPTR_WRITEBACK_ENABLE                   (1 << 8)
80662306a36Sopenharmony_ci#       define IH_WPTR_WRITEBACK_TIMER(x)                 ((x) << 9) /* log2 */
80762306a36Sopenharmony_ci#       define IH_WPTR_OVERFLOW_ENABLE                    (1 << 16)
80862306a36Sopenharmony_ci#       define IH_WPTR_OVERFLOW_CLEAR                     (1 << 31)
80962306a36Sopenharmony_ci#define IH_RB_BASE                                        0x3e04
81062306a36Sopenharmony_ci#define IH_RB_RPTR                                        0x3e08
81162306a36Sopenharmony_ci#define IH_RB_WPTR                                        0x3e0c
81262306a36Sopenharmony_ci#       define RB_OVERFLOW                                (1 << 0)
81362306a36Sopenharmony_ci#       define WPTR_OFFSET_MASK                           0x3fffc
81462306a36Sopenharmony_ci#define IH_RB_WPTR_ADDR_HI                                0x3e10
81562306a36Sopenharmony_ci#define IH_RB_WPTR_ADDR_LO                                0x3e14
81662306a36Sopenharmony_ci#define IH_CNTL                                           0x3e18
81762306a36Sopenharmony_ci#       define ENABLE_INTR                                (1 << 0)
81862306a36Sopenharmony_ci#       define IH_MC_SWAP(x)                              ((x) << 1)
81962306a36Sopenharmony_ci#       define IH_MC_SWAP_NONE                            0
82062306a36Sopenharmony_ci#       define IH_MC_SWAP_16BIT                           1
82162306a36Sopenharmony_ci#       define IH_MC_SWAP_32BIT                           2
82262306a36Sopenharmony_ci#       define IH_MC_SWAP_64BIT                           3
82362306a36Sopenharmony_ci#       define RPTR_REARM                                 (1 << 4)
82462306a36Sopenharmony_ci#       define MC_WRREQ_CREDIT(x)                         ((x) << 15)
82562306a36Sopenharmony_ci#       define MC_WR_CLEAN_CNT(x)                         ((x) << 20)
82662306a36Sopenharmony_ci#       define MC_VMID(x)                                 ((x) << 25)
82762306a36Sopenharmony_ci
82862306a36Sopenharmony_ci#define	BIF_LNCNT_RESET					0x5220
82962306a36Sopenharmony_ci#       define RESET_LNCNT_EN                           (1 << 0)
83062306a36Sopenharmony_ci
83162306a36Sopenharmony_ci#define	CONFIG_MEMSIZE					0x5428
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci#define INTERRUPT_CNTL                                    0x5468
83462306a36Sopenharmony_ci#       define IH_DUMMY_RD_OVERRIDE                       (1 << 0)
83562306a36Sopenharmony_ci#       define IH_DUMMY_RD_EN                             (1 << 1)
83662306a36Sopenharmony_ci#       define IH_REQ_NONSNOOP_EN                         (1 << 3)
83762306a36Sopenharmony_ci#       define GEN_IH_INT_EN                              (1 << 8)
83862306a36Sopenharmony_ci#define INTERRUPT_CNTL2                                   0x546c
83962306a36Sopenharmony_ci
84062306a36Sopenharmony_ci#define HDP_MEM_COHERENCY_FLUSH_CNTL			0x5480
84162306a36Sopenharmony_ci
84262306a36Sopenharmony_ci#define	BIF_FB_EN						0x5490
84362306a36Sopenharmony_ci#define		FB_READ_EN					(1 << 0)
84462306a36Sopenharmony_ci#define		FB_WRITE_EN					(1 << 1)
84562306a36Sopenharmony_ci
84662306a36Sopenharmony_ci#define HDP_REG_COHERENCY_FLUSH_CNTL			0x54A0
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_ci#define GPU_HDP_FLUSH_REQ				0x54DC
84962306a36Sopenharmony_ci#define GPU_HDP_FLUSH_DONE				0x54E0
85062306a36Sopenharmony_ci#define		CP0					(1 << 0)
85162306a36Sopenharmony_ci#define		CP1					(1 << 1)
85262306a36Sopenharmony_ci#define		CP2					(1 << 2)
85362306a36Sopenharmony_ci#define		CP3					(1 << 3)
85462306a36Sopenharmony_ci#define		CP4					(1 << 4)
85562306a36Sopenharmony_ci#define		CP5					(1 << 5)
85662306a36Sopenharmony_ci#define		CP6					(1 << 6)
85762306a36Sopenharmony_ci#define		CP7					(1 << 7)
85862306a36Sopenharmony_ci#define		CP8					(1 << 8)
85962306a36Sopenharmony_ci#define		CP9					(1 << 9)
86062306a36Sopenharmony_ci#define		SDMA0					(1 << 10)
86162306a36Sopenharmony_ci#define		SDMA1					(1 << 11)
86262306a36Sopenharmony_ci
86362306a36Sopenharmony_ci/* 0x6b04, 0x7704, 0x10304, 0x10f04, 0x11b04, 0x12704 */
86462306a36Sopenharmony_ci#define	LB_MEMORY_CTRL					0x6b04
86562306a36Sopenharmony_ci#define		LB_MEMORY_SIZE(x)			((x) << 0)
86662306a36Sopenharmony_ci#define		LB_MEMORY_CONFIG(x)			((x) << 20)
86762306a36Sopenharmony_ci
86862306a36Sopenharmony_ci#define	DPG_WATERMARK_MASK_CONTROL			0x6cc8
86962306a36Sopenharmony_ci#       define LATENCY_WATERMARK_MASK(x)		((x) << 8)
87062306a36Sopenharmony_ci#define	DPG_PIPE_LATENCY_CONTROL			0x6ccc
87162306a36Sopenharmony_ci#       define LATENCY_LOW_WATERMARK(x)			((x) << 0)
87262306a36Sopenharmony_ci#       define LATENCY_HIGH_WATERMARK(x)		((x) << 16)
87362306a36Sopenharmony_ci
87462306a36Sopenharmony_ci/* 0x6b24, 0x7724, 0x10324, 0x10f24, 0x11b24, 0x12724 */
87562306a36Sopenharmony_ci#define LB_VLINE_STATUS                                 0x6b24
87662306a36Sopenharmony_ci#       define VLINE_OCCURRED                           (1 << 0)
87762306a36Sopenharmony_ci#       define VLINE_ACK                                (1 << 4)
87862306a36Sopenharmony_ci#       define VLINE_STAT                               (1 << 12)
87962306a36Sopenharmony_ci#       define VLINE_INTERRUPT                          (1 << 16)
88062306a36Sopenharmony_ci#       define VLINE_INTERRUPT_TYPE                     (1 << 17)
88162306a36Sopenharmony_ci/* 0x6b2c, 0x772c, 0x1032c, 0x10f2c, 0x11b2c, 0x1272c */
88262306a36Sopenharmony_ci#define LB_VBLANK_STATUS                                0x6b2c
88362306a36Sopenharmony_ci#       define VBLANK_OCCURRED                          (1 << 0)
88462306a36Sopenharmony_ci#       define VBLANK_ACK                               (1 << 4)
88562306a36Sopenharmony_ci#       define VBLANK_STAT                              (1 << 12)
88662306a36Sopenharmony_ci#       define VBLANK_INTERRUPT                         (1 << 16)
88762306a36Sopenharmony_ci#       define VBLANK_INTERRUPT_TYPE                    (1 << 17)
88862306a36Sopenharmony_ci
88962306a36Sopenharmony_ci/* 0x6b20, 0x7720, 0x10320, 0x10f20, 0x11b20, 0x12720 */
89062306a36Sopenharmony_ci#define LB_INTERRUPT_MASK                               0x6b20
89162306a36Sopenharmony_ci#       define VBLANK_INTERRUPT_MASK                    (1 << 0)
89262306a36Sopenharmony_ci#       define VLINE_INTERRUPT_MASK                     (1 << 4)
89362306a36Sopenharmony_ci#       define VLINE2_INTERRUPT_MASK                    (1 << 8)
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS                           0x60f4
89662306a36Sopenharmony_ci#       define LB_D1_VLINE_INTERRUPT                    (1 << 2)
89762306a36Sopenharmony_ci#       define LB_D1_VBLANK_INTERRUPT                   (1 << 3)
89862306a36Sopenharmony_ci#       define DC_HPD1_INTERRUPT                        (1 << 17)
89962306a36Sopenharmony_ci#       define DC_HPD1_RX_INTERRUPT                     (1 << 18)
90062306a36Sopenharmony_ci#       define DACA_AUTODETECT_INTERRUPT                (1 << 22)
90162306a36Sopenharmony_ci#       define DACB_AUTODETECT_INTERRUPT                (1 << 23)
90262306a36Sopenharmony_ci#       define DC_I2C_SW_DONE_INTERRUPT                 (1 << 24)
90362306a36Sopenharmony_ci#       define DC_I2C_HW_DONE_INTERRUPT                 (1 << 25)
90462306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE                  0x60f8
90562306a36Sopenharmony_ci#       define LB_D2_VLINE_INTERRUPT                    (1 << 2)
90662306a36Sopenharmony_ci#       define LB_D2_VBLANK_INTERRUPT                   (1 << 3)
90762306a36Sopenharmony_ci#       define DC_HPD2_INTERRUPT                        (1 << 17)
90862306a36Sopenharmony_ci#       define DC_HPD2_RX_INTERRUPT                     (1 << 18)
90962306a36Sopenharmony_ci#       define DISP_TIMER_INTERRUPT                     (1 << 24)
91062306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE2                 0x60fc
91162306a36Sopenharmony_ci#       define LB_D3_VLINE_INTERRUPT                    (1 << 2)
91262306a36Sopenharmony_ci#       define LB_D3_VBLANK_INTERRUPT                   (1 << 3)
91362306a36Sopenharmony_ci#       define DC_HPD3_INTERRUPT                        (1 << 17)
91462306a36Sopenharmony_ci#       define DC_HPD3_RX_INTERRUPT                     (1 << 18)
91562306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE3                 0x6100
91662306a36Sopenharmony_ci#       define LB_D4_VLINE_INTERRUPT                    (1 << 2)
91762306a36Sopenharmony_ci#       define LB_D4_VBLANK_INTERRUPT                   (1 << 3)
91862306a36Sopenharmony_ci#       define DC_HPD4_INTERRUPT                        (1 << 17)
91962306a36Sopenharmony_ci#       define DC_HPD4_RX_INTERRUPT                     (1 << 18)
92062306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE4                 0x614c
92162306a36Sopenharmony_ci#       define LB_D5_VLINE_INTERRUPT                    (1 << 2)
92262306a36Sopenharmony_ci#       define LB_D5_VBLANK_INTERRUPT                   (1 << 3)
92362306a36Sopenharmony_ci#       define DC_HPD5_INTERRUPT                        (1 << 17)
92462306a36Sopenharmony_ci#       define DC_HPD5_RX_INTERRUPT                     (1 << 18)
92562306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE5                 0x6150
92662306a36Sopenharmony_ci#       define LB_D6_VLINE_INTERRUPT                    (1 << 2)
92762306a36Sopenharmony_ci#       define LB_D6_VBLANK_INTERRUPT                   (1 << 3)
92862306a36Sopenharmony_ci#       define DC_HPD6_INTERRUPT                        (1 << 17)
92962306a36Sopenharmony_ci#       define DC_HPD6_RX_INTERRUPT                     (1 << 18)
93062306a36Sopenharmony_ci#define DISP_INTERRUPT_STATUS_CONTINUE6                 0x6780
93162306a36Sopenharmony_ci
93262306a36Sopenharmony_ci/* 0x6858, 0x7458, 0x10058, 0x10c58, 0x11858, 0x12458 */
93362306a36Sopenharmony_ci#define GRPH_INT_STATUS                                 0x6858
93462306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_OCCURRED                  (1 << 0)
93562306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_CLEAR                     (1 << 8)
93662306a36Sopenharmony_ci/* 0x685c, 0x745c, 0x1005c, 0x10c5c, 0x1185c, 0x1245c */
93762306a36Sopenharmony_ci#define GRPH_INT_CONTROL                                0x685c
93862306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_MASK                      (1 << 0)
93962306a36Sopenharmony_ci#       define GRPH_PFLIP_INT_TYPE                      (1 << 8)
94062306a36Sopenharmony_ci
94162306a36Sopenharmony_ci#define	DAC_AUTODETECT_INT_CONTROL			0x67c8
94262306a36Sopenharmony_ci
94362306a36Sopenharmony_ci#define DC_HPD1_INT_STATUS                              0x601c
94462306a36Sopenharmony_ci#define DC_HPD2_INT_STATUS                              0x6028
94562306a36Sopenharmony_ci#define DC_HPD3_INT_STATUS                              0x6034
94662306a36Sopenharmony_ci#define DC_HPD4_INT_STATUS                              0x6040
94762306a36Sopenharmony_ci#define DC_HPD5_INT_STATUS                              0x604c
94862306a36Sopenharmony_ci#define DC_HPD6_INT_STATUS                              0x6058
94962306a36Sopenharmony_ci#       define DC_HPDx_INT_STATUS                       (1 << 0)
95062306a36Sopenharmony_ci#       define DC_HPDx_SENSE                            (1 << 1)
95162306a36Sopenharmony_ci#       define DC_HPDx_SENSE_DELAYED                    (1 << 4)
95262306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_STATUS                    (1 << 8)
95362306a36Sopenharmony_ci
95462306a36Sopenharmony_ci#define DC_HPD1_INT_CONTROL                             0x6020
95562306a36Sopenharmony_ci#define DC_HPD2_INT_CONTROL                             0x602c
95662306a36Sopenharmony_ci#define DC_HPD3_INT_CONTROL                             0x6038
95762306a36Sopenharmony_ci#define DC_HPD4_INT_CONTROL                             0x6044
95862306a36Sopenharmony_ci#define DC_HPD5_INT_CONTROL                             0x6050
95962306a36Sopenharmony_ci#define DC_HPD6_INT_CONTROL                             0x605c
96062306a36Sopenharmony_ci#       define DC_HPDx_INT_ACK                          (1 << 0)
96162306a36Sopenharmony_ci#       define DC_HPDx_INT_POLARITY                     (1 << 8)
96262306a36Sopenharmony_ci#       define DC_HPDx_INT_EN                           (1 << 16)
96362306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_ACK                       (1 << 20)
96462306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_EN                        (1 << 24)
96562306a36Sopenharmony_ci
96662306a36Sopenharmony_ci#define DC_HPD1_CONTROL                                   0x6024
96762306a36Sopenharmony_ci#define DC_HPD2_CONTROL                                   0x6030
96862306a36Sopenharmony_ci#define DC_HPD3_CONTROL                                   0x603c
96962306a36Sopenharmony_ci#define DC_HPD4_CONTROL                                   0x6048
97062306a36Sopenharmony_ci#define DC_HPD5_CONTROL                                   0x6054
97162306a36Sopenharmony_ci#define DC_HPD6_CONTROL                                   0x6060
97262306a36Sopenharmony_ci#       define DC_HPDx_CONNECTION_TIMER(x)                ((x) << 0)
97362306a36Sopenharmony_ci#       define DC_HPDx_RX_INT_TIMER(x)                    ((x) << 16)
97462306a36Sopenharmony_ci#       define DC_HPDx_EN                                 (1 << 28)
97562306a36Sopenharmony_ci
97662306a36Sopenharmony_ci#define DPG_PIPE_STUTTER_CONTROL                          0x6cd4
97762306a36Sopenharmony_ci#       define STUTTER_ENABLE                             (1 << 0)
97862306a36Sopenharmony_ci
97962306a36Sopenharmony_ci/* DCE8 FMT blocks */
98062306a36Sopenharmony_ci#define FMT_DYNAMIC_EXP_CNTL                 0x6fb4
98162306a36Sopenharmony_ci#       define FMT_DYNAMIC_EXP_EN            (1 << 0)
98262306a36Sopenharmony_ci#       define FMT_DYNAMIC_EXP_MODE          (1 << 4)
98362306a36Sopenharmony_ci        /* 0 = 10bit -> 12bit, 1 = 8bit -> 12bit */
98462306a36Sopenharmony_ci#define FMT_CONTROL                          0x6fb8
98562306a36Sopenharmony_ci#       define FMT_PIXEL_ENCODING            (1 << 16)
98662306a36Sopenharmony_ci        /* 0 = RGB 4:4:4 or YCbCr 4:4:4, 1 = YCbCr 4:2:2 */
98762306a36Sopenharmony_ci#define FMT_BIT_DEPTH_CONTROL                0x6fc8
98862306a36Sopenharmony_ci#       define FMT_TRUNCATE_EN               (1 << 0)
98962306a36Sopenharmony_ci#       define FMT_TRUNCATE_MODE             (1 << 1)
99062306a36Sopenharmony_ci#       define FMT_TRUNCATE_DEPTH(x)         ((x) << 4) /* 0 - 18bpp, 1 - 24bpp, 2 - 30bpp */
99162306a36Sopenharmony_ci#       define FMT_SPATIAL_DITHER_EN         (1 << 8)
99262306a36Sopenharmony_ci#       define FMT_SPATIAL_DITHER_MODE(x)    ((x) << 9)
99362306a36Sopenharmony_ci#       define FMT_SPATIAL_DITHER_DEPTH(x)   ((x) << 11) /* 0 - 18bpp, 1 - 24bpp, 2 - 30bpp */
99462306a36Sopenharmony_ci#       define FMT_FRAME_RANDOM_ENABLE       (1 << 13)
99562306a36Sopenharmony_ci#       define FMT_RGB_RANDOM_ENABLE         (1 << 14)
99662306a36Sopenharmony_ci#       define FMT_HIGHPASS_RANDOM_ENABLE    (1 << 15)
99762306a36Sopenharmony_ci#       define FMT_TEMPORAL_DITHER_EN        (1 << 16)
99862306a36Sopenharmony_ci#       define FMT_TEMPORAL_DITHER_DEPTH(x)  ((x) << 17) /* 0 - 18bpp, 1 - 24bpp, 2 - 30bpp */
99962306a36Sopenharmony_ci#       define FMT_TEMPORAL_DITHER_OFFSET(x) ((x) << 21)
100062306a36Sopenharmony_ci#       define FMT_TEMPORAL_LEVEL            (1 << 24)
100162306a36Sopenharmony_ci#       define FMT_TEMPORAL_DITHER_RESET     (1 << 25)
100262306a36Sopenharmony_ci#       define FMT_25FRC_SEL(x)              ((x) << 26)
100362306a36Sopenharmony_ci#       define FMT_50FRC_SEL(x)              ((x) << 28)
100462306a36Sopenharmony_ci#       define FMT_75FRC_SEL(x)              ((x) << 30)
100562306a36Sopenharmony_ci#define FMT_CLAMP_CONTROL                    0x6fe4
100662306a36Sopenharmony_ci#       define FMT_CLAMP_DATA_EN             (1 << 0)
100762306a36Sopenharmony_ci#       define FMT_CLAMP_COLOR_FORMAT(x)     ((x) << 16)
100862306a36Sopenharmony_ci#       define FMT_CLAMP_6BPC                0
100962306a36Sopenharmony_ci#       define FMT_CLAMP_8BPC                1
101062306a36Sopenharmony_ci#       define FMT_CLAMP_10BPC               2
101162306a36Sopenharmony_ci
101262306a36Sopenharmony_ci#define	GRBM_CNTL					0x8000
101362306a36Sopenharmony_ci#define		GRBM_READ_TIMEOUT(x)				((x) << 0)
101462306a36Sopenharmony_ci
101562306a36Sopenharmony_ci#define	GRBM_STATUS2					0x8008
101662306a36Sopenharmony_ci#define		ME0PIPE1_CMDFIFO_AVAIL_MASK			0x0000000F
101762306a36Sopenharmony_ci#define		ME0PIPE1_CF_RQ_PENDING				(1 << 4)
101862306a36Sopenharmony_ci#define		ME0PIPE1_PF_RQ_PENDING				(1 << 5)
101962306a36Sopenharmony_ci#define		ME1PIPE0_RQ_PENDING				(1 << 6)
102062306a36Sopenharmony_ci#define		ME1PIPE1_RQ_PENDING				(1 << 7)
102162306a36Sopenharmony_ci#define		ME1PIPE2_RQ_PENDING				(1 << 8)
102262306a36Sopenharmony_ci#define		ME1PIPE3_RQ_PENDING				(1 << 9)
102362306a36Sopenharmony_ci#define		ME2PIPE0_RQ_PENDING				(1 << 10)
102462306a36Sopenharmony_ci#define		ME2PIPE1_RQ_PENDING				(1 << 11)
102562306a36Sopenharmony_ci#define		ME2PIPE2_RQ_PENDING				(1 << 12)
102662306a36Sopenharmony_ci#define		ME2PIPE3_RQ_PENDING				(1 << 13)
102762306a36Sopenharmony_ci#define		RLC_RQ_PENDING 					(1 << 14)
102862306a36Sopenharmony_ci#define		RLC_BUSY 					(1 << 24)
102962306a36Sopenharmony_ci#define		TC_BUSY 					(1 << 25)
103062306a36Sopenharmony_ci#define		CPF_BUSY 					(1 << 28)
103162306a36Sopenharmony_ci#define		CPC_BUSY 					(1 << 29)
103262306a36Sopenharmony_ci#define		CPG_BUSY 					(1 << 30)
103362306a36Sopenharmony_ci
103462306a36Sopenharmony_ci#define	GRBM_STATUS					0x8010
103562306a36Sopenharmony_ci#define		ME0PIPE0_CMDFIFO_AVAIL_MASK			0x0000000F
103662306a36Sopenharmony_ci#define		SRBM_RQ_PENDING					(1 << 5)
103762306a36Sopenharmony_ci#define		ME0PIPE0_CF_RQ_PENDING				(1 << 7)
103862306a36Sopenharmony_ci#define		ME0PIPE0_PF_RQ_PENDING				(1 << 8)
103962306a36Sopenharmony_ci#define		GDS_DMA_RQ_PENDING				(1 << 9)
104062306a36Sopenharmony_ci#define		DB_CLEAN					(1 << 12)
104162306a36Sopenharmony_ci#define		CB_CLEAN					(1 << 13)
104262306a36Sopenharmony_ci#define		TA_BUSY 					(1 << 14)
104362306a36Sopenharmony_ci#define		GDS_BUSY 					(1 << 15)
104462306a36Sopenharmony_ci#define		WD_BUSY_NO_DMA 					(1 << 16)
104562306a36Sopenharmony_ci#define		VGT_BUSY					(1 << 17)
104662306a36Sopenharmony_ci#define		IA_BUSY_NO_DMA					(1 << 18)
104762306a36Sopenharmony_ci#define		IA_BUSY						(1 << 19)
104862306a36Sopenharmony_ci#define		SX_BUSY 					(1 << 20)
104962306a36Sopenharmony_ci#define		WD_BUSY 					(1 << 21)
105062306a36Sopenharmony_ci#define		SPI_BUSY					(1 << 22)
105162306a36Sopenharmony_ci#define		BCI_BUSY					(1 << 23)
105262306a36Sopenharmony_ci#define		SC_BUSY 					(1 << 24)
105362306a36Sopenharmony_ci#define		PA_BUSY 					(1 << 25)
105462306a36Sopenharmony_ci#define		DB_BUSY 					(1 << 26)
105562306a36Sopenharmony_ci#define		CP_COHERENCY_BUSY      				(1 << 28)
105662306a36Sopenharmony_ci#define		CP_BUSY 					(1 << 29)
105762306a36Sopenharmony_ci#define		CB_BUSY 					(1 << 30)
105862306a36Sopenharmony_ci#define		GUI_ACTIVE					(1 << 31)
105962306a36Sopenharmony_ci#define	GRBM_STATUS_SE0					0x8014
106062306a36Sopenharmony_ci#define	GRBM_STATUS_SE1					0x8018
106162306a36Sopenharmony_ci#define	GRBM_STATUS_SE2					0x8038
106262306a36Sopenharmony_ci#define	GRBM_STATUS_SE3					0x803C
106362306a36Sopenharmony_ci#define		SE_DB_CLEAN					(1 << 1)
106462306a36Sopenharmony_ci#define		SE_CB_CLEAN					(1 << 2)
106562306a36Sopenharmony_ci#define		SE_BCI_BUSY					(1 << 22)
106662306a36Sopenharmony_ci#define		SE_VGT_BUSY					(1 << 23)
106762306a36Sopenharmony_ci#define		SE_PA_BUSY					(1 << 24)
106862306a36Sopenharmony_ci#define		SE_TA_BUSY					(1 << 25)
106962306a36Sopenharmony_ci#define		SE_SX_BUSY					(1 << 26)
107062306a36Sopenharmony_ci#define		SE_SPI_BUSY					(1 << 27)
107162306a36Sopenharmony_ci#define		SE_SC_BUSY					(1 << 29)
107262306a36Sopenharmony_ci#define		SE_DB_BUSY					(1 << 30)
107362306a36Sopenharmony_ci#define		SE_CB_BUSY					(1 << 31)
107462306a36Sopenharmony_ci
107562306a36Sopenharmony_ci#define	GRBM_SOFT_RESET					0x8020
107662306a36Sopenharmony_ci#define		SOFT_RESET_CP					(1 << 0)  /* All CP blocks */
107762306a36Sopenharmony_ci#define		SOFT_RESET_RLC					(1 << 2)  /* RLC */
107862306a36Sopenharmony_ci#define		SOFT_RESET_GFX					(1 << 16) /* GFX */
107962306a36Sopenharmony_ci#define		SOFT_RESET_CPF					(1 << 17) /* CP fetcher shared by gfx and compute */
108062306a36Sopenharmony_ci#define		SOFT_RESET_CPC					(1 << 18) /* CP Compute (MEC1/2) */
108162306a36Sopenharmony_ci#define		SOFT_RESET_CPG					(1 << 19) /* CP GFX (PFP, ME, CE) */
108262306a36Sopenharmony_ci
108362306a36Sopenharmony_ci#define GRBM_INT_CNTL                                   0x8060
108462306a36Sopenharmony_ci#       define RDERR_INT_ENABLE                         (1 << 0)
108562306a36Sopenharmony_ci#       define GUI_IDLE_INT_ENABLE                      (1 << 19)
108662306a36Sopenharmony_ci
108762306a36Sopenharmony_ci#define CP_CPC_STATUS					0x8210
108862306a36Sopenharmony_ci#define CP_CPC_BUSY_STAT				0x8214
108962306a36Sopenharmony_ci#define CP_CPC_STALLED_STAT1				0x8218
109062306a36Sopenharmony_ci#define CP_CPF_STATUS					0x821c
109162306a36Sopenharmony_ci#define CP_CPF_BUSY_STAT				0x8220
109262306a36Sopenharmony_ci#define CP_CPF_STALLED_STAT1				0x8224
109362306a36Sopenharmony_ci
109462306a36Sopenharmony_ci#define CP_MEC_CNTL					0x8234
109562306a36Sopenharmony_ci#define		MEC_ME2_HALT					(1 << 28)
109662306a36Sopenharmony_ci#define		MEC_ME1_HALT					(1 << 30)
109762306a36Sopenharmony_ci
109862306a36Sopenharmony_ci#define CP_MEC_CNTL					0x8234
109962306a36Sopenharmony_ci#define		MEC_ME2_HALT					(1 << 28)
110062306a36Sopenharmony_ci#define		MEC_ME1_HALT					(1 << 30)
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_ci#define CP_STALLED_STAT3				0x8670
110362306a36Sopenharmony_ci#define CP_STALLED_STAT1				0x8674
110462306a36Sopenharmony_ci#define CP_STALLED_STAT2				0x8678
110562306a36Sopenharmony_ci
110662306a36Sopenharmony_ci#define CP_STAT						0x8680
110762306a36Sopenharmony_ci
110862306a36Sopenharmony_ci#define CP_ME_CNTL					0x86D8
110962306a36Sopenharmony_ci#define		CP_CE_HALT					(1 << 24)
111062306a36Sopenharmony_ci#define		CP_PFP_HALT					(1 << 26)
111162306a36Sopenharmony_ci#define		CP_ME_HALT					(1 << 28)
111262306a36Sopenharmony_ci
111362306a36Sopenharmony_ci#define	CP_RB0_RPTR					0x8700
111462306a36Sopenharmony_ci#define	CP_RB_WPTR_DELAY				0x8704
111562306a36Sopenharmony_ci#define	CP_RB_WPTR_POLL_CNTL				0x8708
111662306a36Sopenharmony_ci#define		IDLE_POLL_COUNT(x)			((x) << 16)
111762306a36Sopenharmony_ci#define		IDLE_POLL_COUNT_MASK			(0xffff << 16)
111862306a36Sopenharmony_ci
111962306a36Sopenharmony_ci#define CP_MEQ_THRESHOLDS				0x8764
112062306a36Sopenharmony_ci#define		MEQ1_START(x)				((x) << 0)
112162306a36Sopenharmony_ci#define		MEQ2_START(x)				((x) << 8)
112262306a36Sopenharmony_ci
112362306a36Sopenharmony_ci#define	VGT_VTX_VECT_EJECT_REG				0x88B0
112462306a36Sopenharmony_ci
112562306a36Sopenharmony_ci#define	VGT_CACHE_INVALIDATION				0x88C4
112662306a36Sopenharmony_ci#define		CACHE_INVALIDATION(x)				((x) << 0)
112762306a36Sopenharmony_ci#define			VC_ONLY						0
112862306a36Sopenharmony_ci#define			TC_ONLY						1
112962306a36Sopenharmony_ci#define			VC_AND_TC					2
113062306a36Sopenharmony_ci#define		AUTO_INVLD_EN(x)				((x) << 6)
113162306a36Sopenharmony_ci#define			NO_AUTO						0
113262306a36Sopenharmony_ci#define			ES_AUTO						1
113362306a36Sopenharmony_ci#define			GS_AUTO						2
113462306a36Sopenharmony_ci#define			ES_AND_GS_AUTO					3
113562306a36Sopenharmony_ci
113662306a36Sopenharmony_ci#define	VGT_GS_VERTEX_REUSE				0x88D4
113762306a36Sopenharmony_ci
113862306a36Sopenharmony_ci#define CC_GC_SHADER_ARRAY_CONFIG			0x89bc
113962306a36Sopenharmony_ci#define		INACTIVE_CUS_MASK			0xFFFF0000
114062306a36Sopenharmony_ci#define		INACTIVE_CUS_SHIFT			16
114162306a36Sopenharmony_ci#define GC_USER_SHADER_ARRAY_CONFIG			0x89c0
114262306a36Sopenharmony_ci
114362306a36Sopenharmony_ci#define	PA_CL_ENHANCE					0x8A14
114462306a36Sopenharmony_ci#define		CLIP_VTX_REORDER_ENA				(1 << 0)
114562306a36Sopenharmony_ci#define		NUM_CLIP_SEQ(x)					((x) << 1)
114662306a36Sopenharmony_ci
114762306a36Sopenharmony_ci#define	PA_SC_FORCE_EOV_MAX_CNTS			0x8B24
114862306a36Sopenharmony_ci#define		FORCE_EOV_MAX_CLK_CNT(x)			((x) << 0)
114962306a36Sopenharmony_ci#define		FORCE_EOV_MAX_REZ_CNT(x)			((x) << 16)
115062306a36Sopenharmony_ci
115162306a36Sopenharmony_ci#define	PA_SC_FIFO_SIZE					0x8BCC
115262306a36Sopenharmony_ci#define		SC_FRONTEND_PRIM_FIFO_SIZE(x)			((x) << 0)
115362306a36Sopenharmony_ci#define		SC_BACKEND_PRIM_FIFO_SIZE(x)			((x) << 6)
115462306a36Sopenharmony_ci#define		SC_HIZ_TILE_FIFO_SIZE(x)			((x) << 15)
115562306a36Sopenharmony_ci#define		SC_EARLYZ_TILE_FIFO_SIZE(x)			((x) << 23)
115662306a36Sopenharmony_ci
115762306a36Sopenharmony_ci#define	PA_SC_ENHANCE					0x8BF0
115862306a36Sopenharmony_ci#define		ENABLE_PA_SC_OUT_OF_ORDER			(1 << 0)
115962306a36Sopenharmony_ci#define		DISABLE_PA_SC_GUIDANCE				(1 << 13)
116062306a36Sopenharmony_ci
116162306a36Sopenharmony_ci#define	SQ_CONFIG					0x8C00
116262306a36Sopenharmony_ci
116362306a36Sopenharmony_ci#define	SH_MEM_BASES					0x8C28
116462306a36Sopenharmony_ci/* if PTR32, these are the bases for scratch and lds */
116562306a36Sopenharmony_ci#define		PRIVATE_BASE(x)					((x) << 0) /* scratch */
116662306a36Sopenharmony_ci#define		SHARED_BASE(x)					((x) << 16) /* LDS */
116762306a36Sopenharmony_ci#define	SH_MEM_APE1_BASE				0x8C2C
116862306a36Sopenharmony_ci/* if PTR32, this is the base location of GPUVM */
116962306a36Sopenharmony_ci#define	SH_MEM_APE1_LIMIT				0x8C30
117062306a36Sopenharmony_ci/* if PTR32, this is the upper limit of GPUVM */
117162306a36Sopenharmony_ci#define	SH_MEM_CONFIG					0x8C34
117262306a36Sopenharmony_ci#define		PTR32						(1 << 0)
117362306a36Sopenharmony_ci#define		ALIGNMENT_MODE(x)				((x) << 2)
117462306a36Sopenharmony_ci#define			SH_MEM_ALIGNMENT_MODE_DWORD			0
117562306a36Sopenharmony_ci#define			SH_MEM_ALIGNMENT_MODE_DWORD_STRICT		1
117662306a36Sopenharmony_ci#define			SH_MEM_ALIGNMENT_MODE_STRICT			2
117762306a36Sopenharmony_ci#define			SH_MEM_ALIGNMENT_MODE_UNALIGNED			3
117862306a36Sopenharmony_ci#define		DEFAULT_MTYPE(x)				((x) << 4)
117962306a36Sopenharmony_ci#define		APE1_MTYPE(x)					((x) << 7)
118062306a36Sopenharmony_ci/* valid for both DEFAULT_MTYPE and APE1_MTYPE */
118162306a36Sopenharmony_ci#define	MTYPE_CACHED					0
118262306a36Sopenharmony_ci#define	MTYPE_NONCACHED					3
118362306a36Sopenharmony_ci
118462306a36Sopenharmony_ci#define	SX_DEBUG_1					0x9060
118562306a36Sopenharmony_ci
118662306a36Sopenharmony_ci#define	SPI_CONFIG_CNTL					0x9100
118762306a36Sopenharmony_ci
118862306a36Sopenharmony_ci#define	SPI_CONFIG_CNTL_1				0x913C
118962306a36Sopenharmony_ci#define		VTX_DONE_DELAY(x)				((x) << 0)
119062306a36Sopenharmony_ci#define		INTERP_ONE_PRIM_PER_ROW				(1 << 4)
119162306a36Sopenharmony_ci
119262306a36Sopenharmony_ci#define	TA_CNTL_AUX					0x9508
119362306a36Sopenharmony_ci
119462306a36Sopenharmony_ci#define DB_DEBUG					0x9830
119562306a36Sopenharmony_ci#define DB_DEBUG2					0x9834
119662306a36Sopenharmony_ci#define DB_DEBUG3					0x9838
119762306a36Sopenharmony_ci
119862306a36Sopenharmony_ci#define CC_RB_BACKEND_DISABLE				0x98F4
119962306a36Sopenharmony_ci#define		BACKEND_DISABLE(x)     			((x) << 16)
120062306a36Sopenharmony_ci#define GB_ADDR_CONFIG  				0x98F8
120162306a36Sopenharmony_ci#define		NUM_PIPES(x)				((x) << 0)
120262306a36Sopenharmony_ci#define		NUM_PIPES_MASK				0x00000007
120362306a36Sopenharmony_ci#define		NUM_PIPES_SHIFT				0
120462306a36Sopenharmony_ci#define		PIPE_INTERLEAVE_SIZE(x)			((x) << 4)
120562306a36Sopenharmony_ci#define		PIPE_INTERLEAVE_SIZE_MASK		0x00000070
120662306a36Sopenharmony_ci#define		PIPE_INTERLEAVE_SIZE_SHIFT		4
120762306a36Sopenharmony_ci#define		NUM_SHADER_ENGINES(x)			((x) << 12)
120862306a36Sopenharmony_ci#define		NUM_SHADER_ENGINES_MASK			0x00003000
120962306a36Sopenharmony_ci#define		NUM_SHADER_ENGINES_SHIFT		12
121062306a36Sopenharmony_ci#define		SHADER_ENGINE_TILE_SIZE(x)     		((x) << 16)
121162306a36Sopenharmony_ci#define		SHADER_ENGINE_TILE_SIZE_MASK		0x00070000
121262306a36Sopenharmony_ci#define		SHADER_ENGINE_TILE_SIZE_SHIFT		16
121362306a36Sopenharmony_ci#define		ROW_SIZE(x)             		((x) << 28)
121462306a36Sopenharmony_ci#define		ROW_SIZE_MASK				0x30000000
121562306a36Sopenharmony_ci#define		ROW_SIZE_SHIFT				28
121662306a36Sopenharmony_ci
121762306a36Sopenharmony_ci#define	GB_TILE_MODE0					0x9910
121862306a36Sopenharmony_ci#       define ARRAY_MODE(x)					((x) << 2)
121962306a36Sopenharmony_ci#              define	ARRAY_LINEAR_GENERAL			0
122062306a36Sopenharmony_ci#              define	ARRAY_LINEAR_ALIGNED			1
122162306a36Sopenharmony_ci#              define	ARRAY_1D_TILED_THIN1			2
122262306a36Sopenharmony_ci#              define	ARRAY_2D_TILED_THIN1			4
122362306a36Sopenharmony_ci#              define	ARRAY_PRT_TILED_THIN1			5
122462306a36Sopenharmony_ci#              define	ARRAY_PRT_2D_TILED_THIN1		6
122562306a36Sopenharmony_ci#       define PIPE_CONFIG(x)					((x) << 6)
122662306a36Sopenharmony_ci#              define	ADDR_SURF_P2				0
122762306a36Sopenharmony_ci#              define	ADDR_SURF_P4_8x16			4
122862306a36Sopenharmony_ci#              define	ADDR_SURF_P4_16x16			5
122962306a36Sopenharmony_ci#              define	ADDR_SURF_P4_16x32			6
123062306a36Sopenharmony_ci#              define	ADDR_SURF_P4_32x32			7
123162306a36Sopenharmony_ci#              define	ADDR_SURF_P8_16x16_8x16			8
123262306a36Sopenharmony_ci#              define	ADDR_SURF_P8_16x32_8x16			9
123362306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x32_8x16			10
123462306a36Sopenharmony_ci#              define	ADDR_SURF_P8_16x32_16x16		11
123562306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x32_16x16		12
123662306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x32_16x32		13
123762306a36Sopenharmony_ci#              define	ADDR_SURF_P8_32x64_32x32		14
123862306a36Sopenharmony_ci#              define	ADDR_SURF_P16_32x32_8x16		16
123962306a36Sopenharmony_ci#              define	ADDR_SURF_P16_32x32_16x16		17
124062306a36Sopenharmony_ci#       define TILE_SPLIT(x)					((x) << 11)
124162306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_64B		0
124262306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_128B		1
124362306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_256B		2
124462306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_512B		3
124562306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_1KB		4
124662306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_2KB		5
124762306a36Sopenharmony_ci#              define	ADDR_SURF_TILE_SPLIT_4KB		6
124862306a36Sopenharmony_ci#       define MICRO_TILE_MODE_NEW(x)				((x) << 22)
124962306a36Sopenharmony_ci#              define	ADDR_SURF_DISPLAY_MICRO_TILING		0
125062306a36Sopenharmony_ci#              define	ADDR_SURF_THIN_MICRO_TILING		1
125162306a36Sopenharmony_ci#              define	ADDR_SURF_DEPTH_MICRO_TILING		2
125262306a36Sopenharmony_ci#              define	ADDR_SURF_ROTATED_MICRO_TILING		3
125362306a36Sopenharmony_ci#       define SAMPLE_SPLIT(x)					((x) << 25)
125462306a36Sopenharmony_ci#              define	ADDR_SURF_SAMPLE_SPLIT_1		0
125562306a36Sopenharmony_ci#              define	ADDR_SURF_SAMPLE_SPLIT_2		1
125662306a36Sopenharmony_ci#              define	ADDR_SURF_SAMPLE_SPLIT_4		2
125762306a36Sopenharmony_ci#              define	ADDR_SURF_SAMPLE_SPLIT_8		3
125862306a36Sopenharmony_ci
125962306a36Sopenharmony_ci#define	GB_MACROTILE_MODE0					0x9990
126062306a36Sopenharmony_ci#       define BANK_WIDTH(x)					((x) << 0)
126162306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_1			0
126262306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_2			1
126362306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_4			2
126462306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_WIDTH_8			3
126562306a36Sopenharmony_ci#       define BANK_HEIGHT(x)					((x) << 2)
126662306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_1			0
126762306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_2			1
126862306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_4			2
126962306a36Sopenharmony_ci#              define	ADDR_SURF_BANK_HEIGHT_8			3
127062306a36Sopenharmony_ci#       define MACRO_TILE_ASPECT(x)				((x) << 4)
127162306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_1		0
127262306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_2		1
127362306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_4		2
127462306a36Sopenharmony_ci#              define	ADDR_SURF_MACRO_ASPECT_8		3
127562306a36Sopenharmony_ci#       define NUM_BANKS(x)					((x) << 6)
127662306a36Sopenharmony_ci#              define	ADDR_SURF_2_BANK			0
127762306a36Sopenharmony_ci#              define	ADDR_SURF_4_BANK			1
127862306a36Sopenharmony_ci#              define	ADDR_SURF_8_BANK			2
127962306a36Sopenharmony_ci#              define	ADDR_SURF_16_BANK			3
128062306a36Sopenharmony_ci
128162306a36Sopenharmony_ci#define	CB_HW_CONTROL					0x9A10
128262306a36Sopenharmony_ci
128362306a36Sopenharmony_ci#define	GC_USER_RB_BACKEND_DISABLE			0x9B7C
128462306a36Sopenharmony_ci#define		BACKEND_DISABLE_MASK			0x00FF0000
128562306a36Sopenharmony_ci#define		BACKEND_DISABLE_SHIFT			16
128662306a36Sopenharmony_ci
128762306a36Sopenharmony_ci#define	TCP_CHAN_STEER_LO				0xac0c
128862306a36Sopenharmony_ci#define	TCP_CHAN_STEER_HI				0xac10
128962306a36Sopenharmony_ci
129062306a36Sopenharmony_ci#define	TC_CFG_L1_LOAD_POLICY0				0xAC68
129162306a36Sopenharmony_ci#define	TC_CFG_L1_LOAD_POLICY1				0xAC6C
129262306a36Sopenharmony_ci#define	TC_CFG_L1_STORE_POLICY				0xAC70
129362306a36Sopenharmony_ci#define	TC_CFG_L2_LOAD_POLICY0				0xAC74
129462306a36Sopenharmony_ci#define	TC_CFG_L2_LOAD_POLICY1				0xAC78
129562306a36Sopenharmony_ci#define	TC_CFG_L2_STORE_POLICY0				0xAC7C
129662306a36Sopenharmony_ci#define	TC_CFG_L2_STORE_POLICY1				0xAC80
129762306a36Sopenharmony_ci#define	TC_CFG_L2_ATOMIC_POLICY				0xAC84
129862306a36Sopenharmony_ci#define	TC_CFG_L1_VOLATILE				0xAC88
129962306a36Sopenharmony_ci#define	TC_CFG_L2_VOLATILE				0xAC8C
130062306a36Sopenharmony_ci
130162306a36Sopenharmony_ci#define	CP_RB0_BASE					0xC100
130262306a36Sopenharmony_ci#define	CP_RB0_CNTL					0xC104
130362306a36Sopenharmony_ci#define		RB_BUFSZ(x)					((x) << 0)
130462306a36Sopenharmony_ci#define		RB_BLKSZ(x)					((x) << 8)
130562306a36Sopenharmony_ci#define		BUF_SWAP_32BIT					(2 << 16)
130662306a36Sopenharmony_ci#define		RB_NO_UPDATE					(1 << 27)
130762306a36Sopenharmony_ci#define		RB_RPTR_WR_ENA					(1 << 31)
130862306a36Sopenharmony_ci
130962306a36Sopenharmony_ci#define	CP_RB0_RPTR_ADDR				0xC10C
131062306a36Sopenharmony_ci#define		RB_RPTR_SWAP_32BIT				(2 << 0)
131162306a36Sopenharmony_ci#define	CP_RB0_RPTR_ADDR_HI				0xC110
131262306a36Sopenharmony_ci#define	CP_RB0_WPTR					0xC114
131362306a36Sopenharmony_ci
131462306a36Sopenharmony_ci#define	CP_DEVICE_ID					0xC12C
131562306a36Sopenharmony_ci#define	CP_ENDIAN_SWAP					0xC140
131662306a36Sopenharmony_ci#define	CP_RB_VMID					0xC144
131762306a36Sopenharmony_ci
131862306a36Sopenharmony_ci#define	CP_PFP_UCODE_ADDR				0xC150
131962306a36Sopenharmony_ci#define	CP_PFP_UCODE_DATA				0xC154
132062306a36Sopenharmony_ci#define	CP_ME_RAM_RADDR					0xC158
132162306a36Sopenharmony_ci#define	CP_ME_RAM_WADDR					0xC15C
132262306a36Sopenharmony_ci#define	CP_ME_RAM_DATA					0xC160
132362306a36Sopenharmony_ci
132462306a36Sopenharmony_ci#define	CP_CE_UCODE_ADDR				0xC168
132562306a36Sopenharmony_ci#define	CP_CE_UCODE_DATA				0xC16C
132662306a36Sopenharmony_ci#define	CP_MEC_ME1_UCODE_ADDR				0xC170
132762306a36Sopenharmony_ci#define	CP_MEC_ME1_UCODE_DATA				0xC174
132862306a36Sopenharmony_ci#define	CP_MEC_ME2_UCODE_ADDR				0xC178
132962306a36Sopenharmony_ci#define	CP_MEC_ME2_UCODE_DATA				0xC17C
133062306a36Sopenharmony_ci
133162306a36Sopenharmony_ci#define CP_INT_CNTL_RING0                               0xC1A8
133262306a36Sopenharmony_ci#       define CNTX_BUSY_INT_ENABLE                     (1 << 19)
133362306a36Sopenharmony_ci#       define CNTX_EMPTY_INT_ENABLE                    (1 << 20)
133462306a36Sopenharmony_ci#       define PRIV_INSTR_INT_ENABLE                    (1 << 22)
133562306a36Sopenharmony_ci#       define PRIV_REG_INT_ENABLE                      (1 << 23)
133662306a36Sopenharmony_ci#       define OPCODE_ERROR_INT_ENABLE                  (1 << 24)
133762306a36Sopenharmony_ci#       define TIME_STAMP_INT_ENABLE                    (1 << 26)
133862306a36Sopenharmony_ci#       define CP_RINGID2_INT_ENABLE                    (1 << 29)
133962306a36Sopenharmony_ci#       define CP_RINGID1_INT_ENABLE                    (1 << 30)
134062306a36Sopenharmony_ci#       define CP_RINGID0_INT_ENABLE                    (1 << 31)
134162306a36Sopenharmony_ci
134262306a36Sopenharmony_ci#define CP_INT_STATUS_RING0                             0xC1B4
134362306a36Sopenharmony_ci#       define PRIV_INSTR_INT_STAT                      (1 << 22)
134462306a36Sopenharmony_ci#       define PRIV_REG_INT_STAT                        (1 << 23)
134562306a36Sopenharmony_ci#       define TIME_STAMP_INT_STAT                      (1 << 26)
134662306a36Sopenharmony_ci#       define CP_RINGID2_INT_STAT                      (1 << 29)
134762306a36Sopenharmony_ci#       define CP_RINGID1_INT_STAT                      (1 << 30)
134862306a36Sopenharmony_ci#       define CP_RINGID0_INT_STAT                      (1 << 31)
134962306a36Sopenharmony_ci
135062306a36Sopenharmony_ci#define CP_MEM_SLP_CNTL                                 0xC1E4
135162306a36Sopenharmony_ci#       define CP_MEM_LS_EN                             (1 << 0)
135262306a36Sopenharmony_ci
135362306a36Sopenharmony_ci#define CP_CPF_DEBUG                                    0xC200
135462306a36Sopenharmony_ci
135562306a36Sopenharmony_ci#define CP_PQ_WPTR_POLL_CNTL                            0xC20C
135662306a36Sopenharmony_ci#define		WPTR_POLL_EN      			(1 << 31)
135762306a36Sopenharmony_ci
135862306a36Sopenharmony_ci#define CP_ME1_PIPE0_INT_CNTL                           0xC214
135962306a36Sopenharmony_ci#define CP_ME1_PIPE1_INT_CNTL                           0xC218
136062306a36Sopenharmony_ci#define CP_ME1_PIPE2_INT_CNTL                           0xC21C
136162306a36Sopenharmony_ci#define CP_ME1_PIPE3_INT_CNTL                           0xC220
136262306a36Sopenharmony_ci#define CP_ME2_PIPE0_INT_CNTL                           0xC224
136362306a36Sopenharmony_ci#define CP_ME2_PIPE1_INT_CNTL                           0xC228
136462306a36Sopenharmony_ci#define CP_ME2_PIPE2_INT_CNTL                           0xC22C
136562306a36Sopenharmony_ci#define CP_ME2_PIPE3_INT_CNTL                           0xC230
136662306a36Sopenharmony_ci#       define DEQUEUE_REQUEST_INT_ENABLE               (1 << 13)
136762306a36Sopenharmony_ci#       define WRM_POLL_TIMEOUT_INT_ENABLE              (1 << 17)
136862306a36Sopenharmony_ci#       define PRIV_REG_INT_ENABLE                      (1 << 23)
136962306a36Sopenharmony_ci#       define TIME_STAMP_INT_ENABLE                    (1 << 26)
137062306a36Sopenharmony_ci#       define GENERIC2_INT_ENABLE                      (1 << 29)
137162306a36Sopenharmony_ci#       define GENERIC1_INT_ENABLE                      (1 << 30)
137262306a36Sopenharmony_ci#       define GENERIC0_INT_ENABLE                      (1 << 31)
137362306a36Sopenharmony_ci#define CP_ME1_PIPE0_INT_STATUS                         0xC214
137462306a36Sopenharmony_ci#define CP_ME1_PIPE1_INT_STATUS                         0xC218
137562306a36Sopenharmony_ci#define CP_ME1_PIPE2_INT_STATUS                         0xC21C
137662306a36Sopenharmony_ci#define CP_ME1_PIPE3_INT_STATUS                         0xC220
137762306a36Sopenharmony_ci#define CP_ME2_PIPE0_INT_STATUS                         0xC224
137862306a36Sopenharmony_ci#define CP_ME2_PIPE1_INT_STATUS                         0xC228
137962306a36Sopenharmony_ci#define CP_ME2_PIPE2_INT_STATUS                         0xC22C
138062306a36Sopenharmony_ci#define CP_ME2_PIPE3_INT_STATUS                         0xC230
138162306a36Sopenharmony_ci#       define DEQUEUE_REQUEST_INT_STATUS               (1 << 13)
138262306a36Sopenharmony_ci#       define WRM_POLL_TIMEOUT_INT_STATUS              (1 << 17)
138362306a36Sopenharmony_ci#       define PRIV_REG_INT_STATUS                      (1 << 23)
138462306a36Sopenharmony_ci#       define TIME_STAMP_INT_STATUS                    (1 << 26)
138562306a36Sopenharmony_ci#       define GENERIC2_INT_STATUS                      (1 << 29)
138662306a36Sopenharmony_ci#       define GENERIC1_INT_STATUS                      (1 << 30)
138762306a36Sopenharmony_ci#       define GENERIC0_INT_STATUS                      (1 << 31)
138862306a36Sopenharmony_ci
138962306a36Sopenharmony_ci#define	CP_MAX_CONTEXT					0xC2B8
139062306a36Sopenharmony_ci
139162306a36Sopenharmony_ci#define	CP_RB0_BASE_HI					0xC2C4
139262306a36Sopenharmony_ci
139362306a36Sopenharmony_ci#define RLC_CNTL                                          0xC300
139462306a36Sopenharmony_ci#       define RLC_ENABLE                                 (1 << 0)
139562306a36Sopenharmony_ci
139662306a36Sopenharmony_ci#define RLC_MC_CNTL                                       0xC30C
139762306a36Sopenharmony_ci
139862306a36Sopenharmony_ci#define RLC_MEM_SLP_CNTL                                  0xC318
139962306a36Sopenharmony_ci#       define RLC_MEM_LS_EN                              (1 << 0)
140062306a36Sopenharmony_ci
140162306a36Sopenharmony_ci#define RLC_LB_CNTR_MAX                                   0xC348
140262306a36Sopenharmony_ci
140362306a36Sopenharmony_ci#define RLC_LB_CNTL                                       0xC364
140462306a36Sopenharmony_ci#       define LOAD_BALANCE_ENABLE                        (1 << 0)
140562306a36Sopenharmony_ci
140662306a36Sopenharmony_ci#define RLC_LB_CNTR_INIT                                  0xC36C
140762306a36Sopenharmony_ci
140862306a36Sopenharmony_ci#define RLC_SAVE_AND_RESTORE_BASE                         0xC374
140962306a36Sopenharmony_ci#define RLC_DRIVER_DMA_STATUS                             0xC378 /* dGPU */
141062306a36Sopenharmony_ci#define RLC_CP_TABLE_RESTORE                              0xC378 /* APU */
141162306a36Sopenharmony_ci#define RLC_PG_DELAY_2                                    0xC37C
141262306a36Sopenharmony_ci
141362306a36Sopenharmony_ci#define RLC_GPM_UCODE_ADDR                                0xC388
141462306a36Sopenharmony_ci#define RLC_GPM_UCODE_DATA                                0xC38C
141562306a36Sopenharmony_ci#define RLC_GPU_CLOCK_COUNT_LSB                           0xC390
141662306a36Sopenharmony_ci#define RLC_GPU_CLOCK_COUNT_MSB                           0xC394
141762306a36Sopenharmony_ci#define RLC_CAPTURE_GPU_CLOCK_COUNT                       0xC398
141862306a36Sopenharmony_ci#define RLC_UCODE_CNTL                                    0xC39C
141962306a36Sopenharmony_ci
142062306a36Sopenharmony_ci#define RLC_GPM_STAT                                      0xC400
142162306a36Sopenharmony_ci#       define RLC_GPM_BUSY                               (1 << 0)
142262306a36Sopenharmony_ci#       define GFX_POWER_STATUS                           (1 << 1)
142362306a36Sopenharmony_ci#       define GFX_CLOCK_STATUS                           (1 << 2)
142462306a36Sopenharmony_ci
142562306a36Sopenharmony_ci#define RLC_PG_CNTL                                       0xC40C
142662306a36Sopenharmony_ci#       define GFX_PG_ENABLE                              (1 << 0)
142762306a36Sopenharmony_ci#       define GFX_PG_SRC                                 (1 << 1)
142862306a36Sopenharmony_ci#       define DYN_PER_CU_PG_ENABLE                       (1 << 2)
142962306a36Sopenharmony_ci#       define STATIC_PER_CU_PG_ENABLE                    (1 << 3)
143062306a36Sopenharmony_ci#       define DISABLE_GDS_PG                             (1 << 13)
143162306a36Sopenharmony_ci#       define DISABLE_CP_PG                              (1 << 15)
143262306a36Sopenharmony_ci#       define SMU_CLK_SLOWDOWN_ON_PU_ENABLE              (1 << 17)
143362306a36Sopenharmony_ci#       define SMU_CLK_SLOWDOWN_ON_PD_ENABLE              (1 << 18)
143462306a36Sopenharmony_ci
143562306a36Sopenharmony_ci#define RLC_CGTT_MGCG_OVERRIDE                            0xC420
143662306a36Sopenharmony_ci#define RLC_CGCG_CGLS_CTRL                                0xC424
143762306a36Sopenharmony_ci#       define CGCG_EN                                    (1 << 0)
143862306a36Sopenharmony_ci#       define CGLS_EN                                    (1 << 1)
143962306a36Sopenharmony_ci
144062306a36Sopenharmony_ci#define RLC_PG_DELAY                                      0xC434
144162306a36Sopenharmony_ci
144262306a36Sopenharmony_ci#define RLC_LB_INIT_CU_MASK                               0xC43C
144362306a36Sopenharmony_ci
144462306a36Sopenharmony_ci#define RLC_LB_PARAMS                                     0xC444
144562306a36Sopenharmony_ci
144662306a36Sopenharmony_ci#define RLC_PG_AO_CU_MASK                                 0xC44C
144762306a36Sopenharmony_ci
144862306a36Sopenharmony_ci#define	RLC_MAX_PG_CU					0xC450
144962306a36Sopenharmony_ci#	define MAX_PU_CU(x)				((x) << 0)
145062306a36Sopenharmony_ci#	define MAX_PU_CU_MASK				(0xff << 0)
145162306a36Sopenharmony_ci#define RLC_AUTO_PG_CTRL                                  0xC454
145262306a36Sopenharmony_ci#       define AUTO_PG_EN                                 (1 << 0)
145362306a36Sopenharmony_ci#	define GRBM_REG_SGIT(x)				((x) << 3)
145462306a36Sopenharmony_ci#	define GRBM_REG_SGIT_MASK			(0xffff << 3)
145562306a36Sopenharmony_ci
145662306a36Sopenharmony_ci#define RLC_SERDES_WR_CU_MASTER_MASK                      0xC474
145762306a36Sopenharmony_ci#define RLC_SERDES_WR_NONCU_MASTER_MASK                   0xC478
145862306a36Sopenharmony_ci#define RLC_SERDES_WR_CTRL                                0xC47C
145962306a36Sopenharmony_ci#define		BPM_ADDR(x)				((x) << 0)
146062306a36Sopenharmony_ci#define		BPM_ADDR_MASK      			(0xff << 0)
146162306a36Sopenharmony_ci#define		CGLS_ENABLE				(1 << 16)
146262306a36Sopenharmony_ci#define		CGCG_OVERRIDE_0				(1 << 20)
146362306a36Sopenharmony_ci#define		MGCG_OVERRIDE_0				(1 << 22)
146462306a36Sopenharmony_ci#define		MGCG_OVERRIDE_1				(1 << 23)
146562306a36Sopenharmony_ci
146662306a36Sopenharmony_ci#define RLC_SERDES_CU_MASTER_BUSY                         0xC484
146762306a36Sopenharmony_ci#define RLC_SERDES_NONCU_MASTER_BUSY                      0xC488
146862306a36Sopenharmony_ci#       define SE_MASTER_BUSY_MASK                        0x0000ffff
146962306a36Sopenharmony_ci#       define GC_MASTER_BUSY                             (1 << 16)
147062306a36Sopenharmony_ci#       define TC0_MASTER_BUSY                            (1 << 17)
147162306a36Sopenharmony_ci#       define TC1_MASTER_BUSY                            (1 << 18)
147262306a36Sopenharmony_ci
147362306a36Sopenharmony_ci#define RLC_GPM_SCRATCH_ADDR                              0xC4B0
147462306a36Sopenharmony_ci#define RLC_GPM_SCRATCH_DATA                              0xC4B4
147562306a36Sopenharmony_ci
147662306a36Sopenharmony_ci#define RLC_GPR_REG2                                      0xC4E8
147762306a36Sopenharmony_ci#define		REQ      				0x00000001
147862306a36Sopenharmony_ci#define		MESSAGE(x)      			((x) << 1)
147962306a36Sopenharmony_ci#define		MESSAGE_MASK      			0x0000001e
148062306a36Sopenharmony_ci#define		MSG_ENTER_RLC_SAFE_MODE      			1
148162306a36Sopenharmony_ci#define		MSG_EXIT_RLC_SAFE_MODE      			0
148262306a36Sopenharmony_ci
148362306a36Sopenharmony_ci#define CP_HPD_EOP_BASE_ADDR                              0xC904
148462306a36Sopenharmony_ci#define CP_HPD_EOP_BASE_ADDR_HI                           0xC908
148562306a36Sopenharmony_ci#define CP_HPD_EOP_VMID                                   0xC90C
148662306a36Sopenharmony_ci#define CP_HPD_EOP_CONTROL                                0xC910
148762306a36Sopenharmony_ci#define		EOP_SIZE(x)				((x) << 0)
148862306a36Sopenharmony_ci#define		EOP_SIZE_MASK      			(0x3f << 0)
148962306a36Sopenharmony_ci#define CP_MQD_BASE_ADDR                                  0xC914
149062306a36Sopenharmony_ci#define CP_MQD_BASE_ADDR_HI                               0xC918
149162306a36Sopenharmony_ci#define CP_HQD_ACTIVE                                     0xC91C
149262306a36Sopenharmony_ci#define CP_HQD_VMID                                       0xC920
149362306a36Sopenharmony_ci
149462306a36Sopenharmony_ci#define CP_HQD_PERSISTENT_STATE				0xC924u
149562306a36Sopenharmony_ci#define	DEFAULT_CP_HQD_PERSISTENT_STATE			(0x33U << 8)
149662306a36Sopenharmony_ci
149762306a36Sopenharmony_ci#define CP_HQD_PIPE_PRIORITY				0xC928u
149862306a36Sopenharmony_ci#define CP_HQD_QUEUE_PRIORITY				0xC92Cu
149962306a36Sopenharmony_ci#define CP_HQD_QUANTUM					0xC930u
150062306a36Sopenharmony_ci#define	QUANTUM_EN					1U
150162306a36Sopenharmony_ci#define	QUANTUM_SCALE_1MS				(1U << 4)
150262306a36Sopenharmony_ci#define	QUANTUM_DURATION(x)				((x) << 8)
150362306a36Sopenharmony_ci
150462306a36Sopenharmony_ci#define CP_HQD_PQ_BASE                                    0xC934
150562306a36Sopenharmony_ci#define CP_HQD_PQ_BASE_HI                                 0xC938
150662306a36Sopenharmony_ci#define CP_HQD_PQ_RPTR                                    0xC93C
150762306a36Sopenharmony_ci#define CP_HQD_PQ_RPTR_REPORT_ADDR                        0xC940
150862306a36Sopenharmony_ci#define CP_HQD_PQ_RPTR_REPORT_ADDR_HI                     0xC944
150962306a36Sopenharmony_ci#define CP_HQD_PQ_WPTR_POLL_ADDR                          0xC948
151062306a36Sopenharmony_ci#define CP_HQD_PQ_WPTR_POLL_ADDR_HI                       0xC94C
151162306a36Sopenharmony_ci#define CP_HQD_PQ_DOORBELL_CONTROL                        0xC950
151262306a36Sopenharmony_ci#define		DOORBELL_OFFSET(x)			((x) << 2)
151362306a36Sopenharmony_ci#define		DOORBELL_OFFSET_MASK			(0x1fffff << 2)
151462306a36Sopenharmony_ci#define		DOORBELL_SOURCE      			(1 << 28)
151562306a36Sopenharmony_ci#define		DOORBELL_SCHD_HIT      			(1 << 29)
151662306a36Sopenharmony_ci#define		DOORBELL_EN      			(1 << 30)
151762306a36Sopenharmony_ci#define		DOORBELL_HIT      			(1 << 31)
151862306a36Sopenharmony_ci#define CP_HQD_PQ_WPTR                                    0xC954
151962306a36Sopenharmony_ci#define CP_HQD_PQ_CONTROL                                 0xC958
152062306a36Sopenharmony_ci#define		QUEUE_SIZE(x)				((x) << 0)
152162306a36Sopenharmony_ci#define		QUEUE_SIZE_MASK      			(0x3f << 0)
152262306a36Sopenharmony_ci#define		RPTR_BLOCK_SIZE(x)			((x) << 8)
152362306a36Sopenharmony_ci#define		RPTR_BLOCK_SIZE_MASK			(0x3f << 8)
152462306a36Sopenharmony_ci#define		PQ_VOLATILE      			(1 << 26)
152562306a36Sopenharmony_ci#define		NO_UPDATE_RPTR      			(1 << 27)
152662306a36Sopenharmony_ci#define		UNORD_DISPATCH      			(1 << 28)
152762306a36Sopenharmony_ci#define		ROQ_PQ_IB_FLIP      			(1 << 29)
152862306a36Sopenharmony_ci#define		PRIV_STATE      			(1 << 30)
152962306a36Sopenharmony_ci#define		KMD_QUEUE      				(1 << 31)
153062306a36Sopenharmony_ci
153162306a36Sopenharmony_ci#define CP_HQD_IB_BASE_ADDR				0xC95Cu
153262306a36Sopenharmony_ci#define CP_HQD_IB_BASE_ADDR_HI			0xC960u
153362306a36Sopenharmony_ci#define CP_HQD_IB_RPTR					0xC964u
153462306a36Sopenharmony_ci#define CP_HQD_IB_CONTROL				0xC968u
153562306a36Sopenharmony_ci#define	IB_ATC_EN					(1U << 23)
153662306a36Sopenharmony_ci#define	DEFAULT_MIN_IB_AVAIL_SIZE			(3U << 20)
153762306a36Sopenharmony_ci
153862306a36Sopenharmony_ci#define CP_HQD_DEQUEUE_REQUEST			0xC974
153962306a36Sopenharmony_ci#define	DEQUEUE_REQUEST_DRAIN				1
154062306a36Sopenharmony_ci#define DEQUEUE_REQUEST_RESET				2
154162306a36Sopenharmony_ci
154262306a36Sopenharmony_ci#define CP_MQD_CONTROL                                  0xC99C
154362306a36Sopenharmony_ci#define		MQD_VMID(x)				((x) << 0)
154462306a36Sopenharmony_ci#define		MQD_VMID_MASK      			(0xf << 0)
154562306a36Sopenharmony_ci
154662306a36Sopenharmony_ci#define CP_HQD_SEMA_CMD					0xC97Cu
154762306a36Sopenharmony_ci#define CP_HQD_MSG_TYPE					0xC980u
154862306a36Sopenharmony_ci#define CP_HQD_ATOMIC0_PREOP_LO			0xC984u
154962306a36Sopenharmony_ci#define CP_HQD_ATOMIC0_PREOP_HI			0xC988u
155062306a36Sopenharmony_ci#define CP_HQD_ATOMIC1_PREOP_LO			0xC98Cu
155162306a36Sopenharmony_ci#define CP_HQD_ATOMIC1_PREOP_HI			0xC990u
155262306a36Sopenharmony_ci#define CP_HQD_HQ_SCHEDULER0			0xC994u
155362306a36Sopenharmony_ci#define CP_HQD_HQ_SCHEDULER1			0xC998u
155462306a36Sopenharmony_ci
155562306a36Sopenharmony_ci#define SH_STATIC_MEM_CONFIG			0x9604u
155662306a36Sopenharmony_ci
155762306a36Sopenharmony_ci#define DB_RENDER_CONTROL                               0x28000
155862306a36Sopenharmony_ci
155962306a36Sopenharmony_ci#define PA_SC_RASTER_CONFIG                             0x28350
156062306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_0                   0
156162306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_1                   1
156262306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_2                   2
156362306a36Sopenharmony_ci#       define RASTER_CONFIG_RB_MAP_3                   3
156462306a36Sopenharmony_ci#define		PKR_MAP(x)				((x) << 8)
156562306a36Sopenharmony_ci
156662306a36Sopenharmony_ci#define VGT_EVENT_INITIATOR                             0x28a90
156762306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS1                   (1 << 0)
156862306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS2                   (2 << 0)
156962306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS3                   (3 << 0)
157062306a36Sopenharmony_ci#       define CACHE_FLUSH_TS                           (4 << 0)
157162306a36Sopenharmony_ci#       define CACHE_FLUSH                              (6 << 0)
157262306a36Sopenharmony_ci#       define CS_PARTIAL_FLUSH                         (7 << 0)
157362306a36Sopenharmony_ci#       define VGT_STREAMOUT_RESET                      (10 << 0)
157462306a36Sopenharmony_ci#       define END_OF_PIPE_INCR_DE                      (11 << 0)
157562306a36Sopenharmony_ci#       define END_OF_PIPE_IB_END                       (12 << 0)
157662306a36Sopenharmony_ci#       define RST_PIX_CNT                              (13 << 0)
157762306a36Sopenharmony_ci#       define VS_PARTIAL_FLUSH                         (15 << 0)
157862306a36Sopenharmony_ci#       define PS_PARTIAL_FLUSH                         (16 << 0)
157962306a36Sopenharmony_ci#       define CACHE_FLUSH_AND_INV_TS_EVENT             (20 << 0)
158062306a36Sopenharmony_ci#       define ZPASS_DONE                               (21 << 0)
158162306a36Sopenharmony_ci#       define CACHE_FLUSH_AND_INV_EVENT                (22 << 0)
158262306a36Sopenharmony_ci#       define PERFCOUNTER_START                        (23 << 0)
158362306a36Sopenharmony_ci#       define PERFCOUNTER_STOP                         (24 << 0)
158462306a36Sopenharmony_ci#       define PIPELINESTAT_START                       (25 << 0)
158562306a36Sopenharmony_ci#       define PIPELINESTAT_STOP                        (26 << 0)
158662306a36Sopenharmony_ci#       define PERFCOUNTER_SAMPLE                       (27 << 0)
158762306a36Sopenharmony_ci#       define SAMPLE_PIPELINESTAT                      (30 << 0)
158862306a36Sopenharmony_ci#       define SO_VGT_STREAMOUT_FLUSH                   (31 << 0)
158962306a36Sopenharmony_ci#       define SAMPLE_STREAMOUTSTATS                    (32 << 0)
159062306a36Sopenharmony_ci#       define RESET_VTX_CNT                            (33 << 0)
159162306a36Sopenharmony_ci#       define VGT_FLUSH                                (36 << 0)
159262306a36Sopenharmony_ci#       define BOTTOM_OF_PIPE_TS                        (40 << 0)
159362306a36Sopenharmony_ci#       define DB_CACHE_FLUSH_AND_INV                   (42 << 0)
159462306a36Sopenharmony_ci#       define FLUSH_AND_INV_DB_DATA_TS                 (43 << 0)
159562306a36Sopenharmony_ci#       define FLUSH_AND_INV_DB_META                    (44 << 0)
159662306a36Sopenharmony_ci#       define FLUSH_AND_INV_CB_DATA_TS                 (45 << 0)
159762306a36Sopenharmony_ci#       define FLUSH_AND_INV_CB_META                    (46 << 0)
159862306a36Sopenharmony_ci#       define CS_DONE                                  (47 << 0)
159962306a36Sopenharmony_ci#       define PS_DONE                                  (48 << 0)
160062306a36Sopenharmony_ci#       define FLUSH_AND_INV_CB_PIXEL_DATA              (49 << 0)
160162306a36Sopenharmony_ci#       define THREAD_TRACE_START                       (51 << 0)
160262306a36Sopenharmony_ci#       define THREAD_TRACE_STOP                        (52 << 0)
160362306a36Sopenharmony_ci#       define THREAD_TRACE_FLUSH                       (54 << 0)
160462306a36Sopenharmony_ci#       define THREAD_TRACE_FINISH                      (55 << 0)
160562306a36Sopenharmony_ci#       define PIXEL_PIPE_STAT_CONTROL                  (56 << 0)
160662306a36Sopenharmony_ci#       define PIXEL_PIPE_STAT_DUMP                     (57 << 0)
160762306a36Sopenharmony_ci#       define PIXEL_PIPE_STAT_RESET                    (58 << 0)
160862306a36Sopenharmony_ci
160962306a36Sopenharmony_ci#define	SCRATCH_REG0					0x30100
161062306a36Sopenharmony_ci#define	SCRATCH_REG1					0x30104
161162306a36Sopenharmony_ci#define	SCRATCH_REG2					0x30108
161262306a36Sopenharmony_ci#define	SCRATCH_REG3					0x3010C
161362306a36Sopenharmony_ci#define	SCRATCH_REG4					0x30110
161462306a36Sopenharmony_ci#define	SCRATCH_REG5					0x30114
161562306a36Sopenharmony_ci#define	SCRATCH_REG6					0x30118
161662306a36Sopenharmony_ci#define	SCRATCH_REG7					0x3011C
161762306a36Sopenharmony_ci
161862306a36Sopenharmony_ci#define	SCRATCH_UMSK					0x30140
161962306a36Sopenharmony_ci#define	SCRATCH_ADDR					0x30144
162062306a36Sopenharmony_ci
162162306a36Sopenharmony_ci#define	CP_SEM_WAIT_TIMER				0x301BC
162262306a36Sopenharmony_ci
162362306a36Sopenharmony_ci#define	CP_SEM_INCOMPLETE_TIMER_CNTL			0x301C8
162462306a36Sopenharmony_ci
162562306a36Sopenharmony_ci#define	CP_WAIT_REG_MEM_TIMEOUT				0x301D0
162662306a36Sopenharmony_ci
162762306a36Sopenharmony_ci#define GRBM_GFX_INDEX          			0x30800
162862306a36Sopenharmony_ci#define		INSTANCE_INDEX(x)			((x) << 0)
162962306a36Sopenharmony_ci#define		SH_INDEX(x)     			((x) << 8)
163062306a36Sopenharmony_ci#define		SE_INDEX(x)     			((x) << 16)
163162306a36Sopenharmony_ci#define		SH_BROADCAST_WRITES      		(1 << 29)
163262306a36Sopenharmony_ci#define		INSTANCE_BROADCAST_WRITES      		(1 << 30)
163362306a36Sopenharmony_ci#define		SE_BROADCAST_WRITES      		(1 << 31)
163462306a36Sopenharmony_ci
163562306a36Sopenharmony_ci#define	VGT_ESGS_RING_SIZE				0x30900
163662306a36Sopenharmony_ci#define	VGT_GSVS_RING_SIZE				0x30904
163762306a36Sopenharmony_ci#define	VGT_PRIMITIVE_TYPE				0x30908
163862306a36Sopenharmony_ci#define	VGT_INDEX_TYPE					0x3090C
163962306a36Sopenharmony_ci
164062306a36Sopenharmony_ci#define	VGT_NUM_INDICES					0x30930
164162306a36Sopenharmony_ci#define	VGT_NUM_INSTANCES				0x30934
164262306a36Sopenharmony_ci#define	VGT_TF_RING_SIZE				0x30938
164362306a36Sopenharmony_ci#define	VGT_HS_OFFCHIP_PARAM				0x3093C
164462306a36Sopenharmony_ci#define	VGT_TF_MEMORY_BASE				0x30940
164562306a36Sopenharmony_ci
164662306a36Sopenharmony_ci#define	PA_SU_LINE_STIPPLE_VALUE			0x30a00
164762306a36Sopenharmony_ci#define	PA_SC_LINE_STIPPLE_STATE			0x30a04
164862306a36Sopenharmony_ci
164962306a36Sopenharmony_ci#define	SQC_CACHES					0x30d20
165062306a36Sopenharmony_ci
165162306a36Sopenharmony_ci#define	CP_PERFMON_CNTL					0x36020
165262306a36Sopenharmony_ci
165362306a36Sopenharmony_ci#define	CGTS_SM_CTRL_REG				0x3c000
165462306a36Sopenharmony_ci#define		SM_MODE(x)				((x) << 17)
165562306a36Sopenharmony_ci#define		SM_MODE_MASK				(0x7 << 17)
165662306a36Sopenharmony_ci#define		SM_MODE_ENABLE				(1 << 20)
165762306a36Sopenharmony_ci#define		CGTS_OVERRIDE				(1 << 21)
165862306a36Sopenharmony_ci#define		CGTS_LS_OVERRIDE			(1 << 22)
165962306a36Sopenharmony_ci#define		ON_MONITOR_ADD_EN			(1 << 23)
166062306a36Sopenharmony_ci#define		ON_MONITOR_ADD(x)			((x) << 24)
166162306a36Sopenharmony_ci#define		ON_MONITOR_ADD_MASK			(0xff << 24)
166262306a36Sopenharmony_ci
166362306a36Sopenharmony_ci#define	CGTS_TCC_DISABLE				0x3c00c
166462306a36Sopenharmony_ci#define	CGTS_USER_TCC_DISABLE				0x3c010
166562306a36Sopenharmony_ci#define		TCC_DISABLE_MASK				0xFFFF0000
166662306a36Sopenharmony_ci#define		TCC_DISABLE_SHIFT				16
166762306a36Sopenharmony_ci
166862306a36Sopenharmony_ci#define	CB_CGTT_SCLK_CTRL				0x3c2a0
166962306a36Sopenharmony_ci
167062306a36Sopenharmony_ci/*
167162306a36Sopenharmony_ci * PM4
167262306a36Sopenharmony_ci */
167362306a36Sopenharmony_ci#define	PACKET_TYPE0	0
167462306a36Sopenharmony_ci#define	PACKET_TYPE1	1
167562306a36Sopenharmony_ci#define	PACKET_TYPE2	2
167662306a36Sopenharmony_ci#define	PACKET_TYPE3	3
167762306a36Sopenharmony_ci
167862306a36Sopenharmony_ci#define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
167962306a36Sopenharmony_ci#define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
168062306a36Sopenharmony_ci#define CP_PACKET0_GET_REG(h) (((h) & 0xFFFF) << 2)
168162306a36Sopenharmony_ci#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
168262306a36Sopenharmony_ci#define PACKET0(reg, n)	((PACKET_TYPE0 << 30) |				\
168362306a36Sopenharmony_ci			 (((reg) >> 2) & 0xFFFF) |			\
168462306a36Sopenharmony_ci			 ((n) & 0x3FFF) << 16)
168562306a36Sopenharmony_ci#define CP_PACKET2			0x80000000
168662306a36Sopenharmony_ci#define		PACKET2_PAD_SHIFT		0
168762306a36Sopenharmony_ci#define		PACKET2_PAD_MASK		(0x3fffffff << 0)
168862306a36Sopenharmony_ci
168962306a36Sopenharmony_ci#define PACKET2(v)	(CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
169062306a36Sopenharmony_ci
169162306a36Sopenharmony_ci#define PACKET3(op, n)	((PACKET_TYPE3 << 30) |				\
169262306a36Sopenharmony_ci			 (((op) & 0xFF) << 8) |				\
169362306a36Sopenharmony_ci			 ((n) & 0x3FFF) << 16)
169462306a36Sopenharmony_ci
169562306a36Sopenharmony_ci#define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1)
169662306a36Sopenharmony_ci
169762306a36Sopenharmony_ci/* Packet 3 types */
169862306a36Sopenharmony_ci#define	PACKET3_NOP					0x10
169962306a36Sopenharmony_ci#define	PACKET3_SET_BASE				0x11
170062306a36Sopenharmony_ci#define		PACKET3_BASE_INDEX(x)                  ((x) << 0)
170162306a36Sopenharmony_ci#define			CE_PARTITION_BASE		3
170262306a36Sopenharmony_ci#define	PACKET3_CLEAR_STATE				0x12
170362306a36Sopenharmony_ci#define	PACKET3_INDEX_BUFFER_SIZE			0x13
170462306a36Sopenharmony_ci#define	PACKET3_DISPATCH_DIRECT				0x15
170562306a36Sopenharmony_ci#define	PACKET3_DISPATCH_INDIRECT			0x16
170662306a36Sopenharmony_ci#define	PACKET3_ATOMIC_GDS				0x1D
170762306a36Sopenharmony_ci#define	PACKET3_ATOMIC_MEM				0x1E
170862306a36Sopenharmony_ci#define	PACKET3_OCCLUSION_QUERY				0x1F
170962306a36Sopenharmony_ci#define	PACKET3_SET_PREDICATION				0x20
171062306a36Sopenharmony_ci#define	PACKET3_REG_RMW					0x21
171162306a36Sopenharmony_ci#define	PACKET3_COND_EXEC				0x22
171262306a36Sopenharmony_ci#define	PACKET3_PRED_EXEC				0x23
171362306a36Sopenharmony_ci#define	PACKET3_DRAW_INDIRECT				0x24
171462306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_INDIRECT			0x25
171562306a36Sopenharmony_ci#define	PACKET3_INDEX_BASE				0x26
171662306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_2				0x27
171762306a36Sopenharmony_ci#define	PACKET3_CONTEXT_CONTROL				0x28
171862306a36Sopenharmony_ci#define	PACKET3_INDEX_TYPE				0x2A
171962306a36Sopenharmony_ci#define	PACKET3_DRAW_INDIRECT_MULTI			0x2C
172062306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_AUTO				0x2D
172162306a36Sopenharmony_ci#define	PACKET3_NUM_INSTANCES				0x2F
172262306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_MULTI_AUTO			0x30
172362306a36Sopenharmony_ci#define	PACKET3_INDIRECT_BUFFER_CONST			0x33
172462306a36Sopenharmony_ci#define	PACKET3_STRMOUT_BUFFER_UPDATE			0x34
172562306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_OFFSET_2			0x35
172662306a36Sopenharmony_ci#define	PACKET3_DRAW_PREAMBLE				0x36
172762306a36Sopenharmony_ci#define	PACKET3_WRITE_DATA				0x37
172862306a36Sopenharmony_ci#define		WRITE_DATA_DST_SEL(x)                   ((x) << 8)
172962306a36Sopenharmony_ci                /* 0 - register
173062306a36Sopenharmony_ci		 * 1 - memory (sync - via GRBM)
173162306a36Sopenharmony_ci		 * 2 - gl2
173262306a36Sopenharmony_ci		 * 3 - gds
173362306a36Sopenharmony_ci		 * 4 - reserved
173462306a36Sopenharmony_ci		 * 5 - memory (async - direct)
173562306a36Sopenharmony_ci		 */
173662306a36Sopenharmony_ci#define		WR_ONE_ADDR                             (1 << 16)
173762306a36Sopenharmony_ci#define		WR_CONFIRM                              (1 << 20)
173862306a36Sopenharmony_ci#define		WRITE_DATA_CACHE_POLICY(x)              ((x) << 25)
173962306a36Sopenharmony_ci                /* 0 - LRU
174062306a36Sopenharmony_ci		 * 1 - Stream
174162306a36Sopenharmony_ci		 */
174262306a36Sopenharmony_ci#define		WRITE_DATA_ENGINE_SEL(x)                ((x) << 30)
174362306a36Sopenharmony_ci                /* 0 - me
174462306a36Sopenharmony_ci		 * 1 - pfp
174562306a36Sopenharmony_ci		 * 2 - ce
174662306a36Sopenharmony_ci		 */
174762306a36Sopenharmony_ci#define	PACKET3_DRAW_INDEX_INDIRECT_MULTI		0x38
174862306a36Sopenharmony_ci#define	PACKET3_MEM_SEMAPHORE				0x39
174962306a36Sopenharmony_ci#              define PACKET3_SEM_USE_MAILBOX       (0x1 << 16)
175062306a36Sopenharmony_ci#              define PACKET3_SEM_SEL_SIGNAL_TYPE   (0x1 << 20) /* 0 = increment, 1 = write 1 */
175162306a36Sopenharmony_ci#              define PACKET3_SEM_CLIENT_CODE	    ((x) << 24) /* 0 = CP, 1 = CB, 2 = DB */
175262306a36Sopenharmony_ci#              define PACKET3_SEM_SEL_SIGNAL	    (0x6 << 29)
175362306a36Sopenharmony_ci#              define PACKET3_SEM_SEL_WAIT	    (0x7 << 29)
175462306a36Sopenharmony_ci#define	PACKET3_COPY_DW					0x3B
175562306a36Sopenharmony_ci#define	PACKET3_WAIT_REG_MEM				0x3C
175662306a36Sopenharmony_ci#define		WAIT_REG_MEM_FUNCTION(x)                ((x) << 0)
175762306a36Sopenharmony_ci                /* 0 - always
175862306a36Sopenharmony_ci		 * 1 - <
175962306a36Sopenharmony_ci		 * 2 - <=
176062306a36Sopenharmony_ci		 * 3 - ==
176162306a36Sopenharmony_ci		 * 4 - !=
176262306a36Sopenharmony_ci		 * 5 - >=
176362306a36Sopenharmony_ci		 * 6 - >
176462306a36Sopenharmony_ci		 */
176562306a36Sopenharmony_ci#define		WAIT_REG_MEM_MEM_SPACE(x)               ((x) << 4)
176662306a36Sopenharmony_ci                /* 0 - reg
176762306a36Sopenharmony_ci		 * 1 - mem
176862306a36Sopenharmony_ci		 */
176962306a36Sopenharmony_ci#define		WAIT_REG_MEM_OPERATION(x)               ((x) << 6)
177062306a36Sopenharmony_ci                /* 0 - wait_reg_mem
177162306a36Sopenharmony_ci		 * 1 - wr_wait_wr_reg
177262306a36Sopenharmony_ci		 */
177362306a36Sopenharmony_ci#define		WAIT_REG_MEM_ENGINE(x)                  ((x) << 8)
177462306a36Sopenharmony_ci                /* 0 - me
177562306a36Sopenharmony_ci		 * 1 - pfp
177662306a36Sopenharmony_ci		 */
177762306a36Sopenharmony_ci#define	PACKET3_INDIRECT_BUFFER				0x3F
177862306a36Sopenharmony_ci#define		INDIRECT_BUFFER_TCL2_VOLATILE           (1 << 22)
177962306a36Sopenharmony_ci#define		INDIRECT_BUFFER_VALID                   (1 << 23)
178062306a36Sopenharmony_ci#define		INDIRECT_BUFFER_CACHE_POLICY(x)         ((x) << 28)
178162306a36Sopenharmony_ci                /* 0 - LRU
178262306a36Sopenharmony_ci		 * 1 - Stream
178362306a36Sopenharmony_ci		 * 2 - Bypass
178462306a36Sopenharmony_ci		 */
178562306a36Sopenharmony_ci#define	PACKET3_COPY_DATA				0x40
178662306a36Sopenharmony_ci#define	PACKET3_PFP_SYNC_ME				0x42
178762306a36Sopenharmony_ci#define	PACKET3_SURFACE_SYNC				0x43
178862306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_0_ENA      (1 << 0)
178962306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_1_ENA      (1 << 1)
179062306a36Sopenharmony_ci#              define PACKET3_CB0_DEST_BASE_ENA    (1 << 6)
179162306a36Sopenharmony_ci#              define PACKET3_CB1_DEST_BASE_ENA    (1 << 7)
179262306a36Sopenharmony_ci#              define PACKET3_CB2_DEST_BASE_ENA    (1 << 8)
179362306a36Sopenharmony_ci#              define PACKET3_CB3_DEST_BASE_ENA    (1 << 9)
179462306a36Sopenharmony_ci#              define PACKET3_CB4_DEST_BASE_ENA    (1 << 10)
179562306a36Sopenharmony_ci#              define PACKET3_CB5_DEST_BASE_ENA    (1 << 11)
179662306a36Sopenharmony_ci#              define PACKET3_CB6_DEST_BASE_ENA    (1 << 12)
179762306a36Sopenharmony_ci#              define PACKET3_CB7_DEST_BASE_ENA    (1 << 13)
179862306a36Sopenharmony_ci#              define PACKET3_DB_DEST_BASE_ENA     (1 << 14)
179962306a36Sopenharmony_ci#              define PACKET3_TCL1_VOL_ACTION_ENA  (1 << 15)
180062306a36Sopenharmony_ci#              define PACKET3_TC_VOL_ACTION_ENA    (1 << 16) /* L2 */
180162306a36Sopenharmony_ci#              define PACKET3_TC_WB_ACTION_ENA     (1 << 18) /* L2 */
180262306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_2_ENA      (1 << 19)
180362306a36Sopenharmony_ci#              define PACKET3_DEST_BASE_3_ENA      (1 << 21)
180462306a36Sopenharmony_ci#              define PACKET3_TCL1_ACTION_ENA      (1 << 22)
180562306a36Sopenharmony_ci#              define PACKET3_TC_ACTION_ENA        (1 << 23) /* L2 */
180662306a36Sopenharmony_ci#              define PACKET3_CB_ACTION_ENA        (1 << 25)
180762306a36Sopenharmony_ci#              define PACKET3_DB_ACTION_ENA        (1 << 26)
180862306a36Sopenharmony_ci#              define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27)
180962306a36Sopenharmony_ci#              define PACKET3_SH_KCACHE_VOL_ACTION_ENA (1 << 28)
181062306a36Sopenharmony_ci#              define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29)
181162306a36Sopenharmony_ci#define	PACKET3_COND_WRITE				0x45
181262306a36Sopenharmony_ci#define	PACKET3_EVENT_WRITE				0x46
181362306a36Sopenharmony_ci#define		EVENT_TYPE(x)                           ((x) << 0)
181462306a36Sopenharmony_ci#define		EVENT_INDEX(x)                          ((x) << 8)
181562306a36Sopenharmony_ci                /* 0 - any non-TS event
181662306a36Sopenharmony_ci		 * 1 - ZPASS_DONE, PIXEL_PIPE_STAT_*
181762306a36Sopenharmony_ci		 * 2 - SAMPLE_PIPELINESTAT
181862306a36Sopenharmony_ci		 * 3 - SAMPLE_STREAMOUTSTAT*
181962306a36Sopenharmony_ci		 * 4 - *S_PARTIAL_FLUSH
182062306a36Sopenharmony_ci		 * 5 - EOP events
182162306a36Sopenharmony_ci		 * 6 - EOS events
182262306a36Sopenharmony_ci		 */
182362306a36Sopenharmony_ci#define	PACKET3_EVENT_WRITE_EOP				0x47
182462306a36Sopenharmony_ci#define		EOP_TCL1_VOL_ACTION_EN                  (1 << 12)
182562306a36Sopenharmony_ci#define		EOP_TC_VOL_ACTION_EN                    (1 << 13) /* L2 */
182662306a36Sopenharmony_ci#define		EOP_TC_WB_ACTION_EN                     (1 << 15) /* L2 */
182762306a36Sopenharmony_ci#define		EOP_TCL1_ACTION_EN                      (1 << 16)
182862306a36Sopenharmony_ci#define		EOP_TC_ACTION_EN                        (1 << 17) /* L2 */
182962306a36Sopenharmony_ci#define		EOP_TCL2_VOLATILE                       (1 << 24)
183062306a36Sopenharmony_ci#define		EOP_CACHE_POLICY(x)                     ((x) << 25)
183162306a36Sopenharmony_ci                /* 0 - LRU
183262306a36Sopenharmony_ci		 * 1 - Stream
183362306a36Sopenharmony_ci		 * 2 - Bypass
183462306a36Sopenharmony_ci		 */
183562306a36Sopenharmony_ci#define		DATA_SEL(x)                             ((x) << 29)
183662306a36Sopenharmony_ci                /* 0 - discard
183762306a36Sopenharmony_ci		 * 1 - send low 32bit data
183862306a36Sopenharmony_ci		 * 2 - send 64bit data
183962306a36Sopenharmony_ci		 * 3 - send 64bit GPU counter value
184062306a36Sopenharmony_ci		 * 4 - send 64bit sys counter value
184162306a36Sopenharmony_ci		 */
184262306a36Sopenharmony_ci#define		INT_SEL(x)                              ((x) << 24)
184362306a36Sopenharmony_ci                /* 0 - none
184462306a36Sopenharmony_ci		 * 1 - interrupt only (DATA_SEL = 0)
184562306a36Sopenharmony_ci		 * 2 - interrupt when data write is confirmed
184662306a36Sopenharmony_ci		 */
184762306a36Sopenharmony_ci#define		DST_SEL(x)                              ((x) << 16)
184862306a36Sopenharmony_ci                /* 0 - MC
184962306a36Sopenharmony_ci		 * 1 - TC/L2
185062306a36Sopenharmony_ci		 */
185162306a36Sopenharmony_ci#define	PACKET3_EVENT_WRITE_EOS				0x48
185262306a36Sopenharmony_ci#define	PACKET3_RELEASE_MEM				0x49
185362306a36Sopenharmony_ci#define	PACKET3_PREAMBLE_CNTL				0x4A
185462306a36Sopenharmony_ci#              define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE     (2 << 28)
185562306a36Sopenharmony_ci#              define PACKET3_PREAMBLE_END_CLEAR_STATE       (3 << 28)
185662306a36Sopenharmony_ci#define	PACKET3_DMA_DATA				0x50
185762306a36Sopenharmony_ci/* 1. header
185862306a36Sopenharmony_ci * 2. CONTROL
185962306a36Sopenharmony_ci * 3. SRC_ADDR_LO or DATA [31:0]
186062306a36Sopenharmony_ci * 4. SRC_ADDR_HI [31:0]
186162306a36Sopenharmony_ci * 5. DST_ADDR_LO [31:0]
186262306a36Sopenharmony_ci * 6. DST_ADDR_HI [7:0]
186362306a36Sopenharmony_ci * 7. COMMAND [30:21] | BYTE_COUNT [20:0]
186462306a36Sopenharmony_ci */
186562306a36Sopenharmony_ci/* CONTROL */
186662306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_ENGINE(x)     ((x) << 0)
186762306a36Sopenharmony_ci                /* 0 - ME
186862306a36Sopenharmony_ci		 * 1 - PFP
186962306a36Sopenharmony_ci		 */
187062306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_SRC_CACHE_POLICY(x) ((x) << 13)
187162306a36Sopenharmony_ci                /* 0 - LRU
187262306a36Sopenharmony_ci		 * 1 - Stream
187362306a36Sopenharmony_ci		 * 2 - Bypass
187462306a36Sopenharmony_ci		 */
187562306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_SRC_VOLATILE (1 << 15)
187662306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_DST_SEL(x)  ((x) << 20)
187762306a36Sopenharmony_ci                /* 0 - DST_ADDR using DAS
187862306a36Sopenharmony_ci		 * 1 - GDS
187962306a36Sopenharmony_ci		 * 3 - DST_ADDR using L2
188062306a36Sopenharmony_ci		 */
188162306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_DST_CACHE_POLICY(x) ((x) << 25)
188262306a36Sopenharmony_ci                /* 0 - LRU
188362306a36Sopenharmony_ci		 * 1 - Stream
188462306a36Sopenharmony_ci		 * 2 - Bypass
188562306a36Sopenharmony_ci		 */
188662306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_DST_VOLATILE (1 << 27)
188762306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_SRC_SEL(x)  ((x) << 29)
188862306a36Sopenharmony_ci                /* 0 - SRC_ADDR using SAS
188962306a36Sopenharmony_ci		 * 1 - GDS
189062306a36Sopenharmony_ci		 * 2 - DATA
189162306a36Sopenharmony_ci		 * 3 - SRC_ADDR using L2
189262306a36Sopenharmony_ci		 */
189362306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CP_SYNC     (1 << 31)
189462306a36Sopenharmony_ci/* COMMAND */
189562306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_DIS_WC      (1 << 21)
189662306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_SRC_SWAP(x) ((x) << 22)
189762306a36Sopenharmony_ci                /* 0 - none
189862306a36Sopenharmony_ci		 * 1 - 8 in 16
189962306a36Sopenharmony_ci		 * 2 - 8 in 32
190062306a36Sopenharmony_ci		 * 3 - 8 in 64
190162306a36Sopenharmony_ci		 */
190262306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_DST_SWAP(x) ((x) << 24)
190362306a36Sopenharmony_ci                /* 0 - none
190462306a36Sopenharmony_ci		 * 1 - 8 in 16
190562306a36Sopenharmony_ci		 * 2 - 8 in 32
190662306a36Sopenharmony_ci		 * 3 - 8 in 64
190762306a36Sopenharmony_ci		 */
190862306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_SAS     (1 << 26)
190962306a36Sopenharmony_ci                /* 0 - memory
191062306a36Sopenharmony_ci		 * 1 - register
191162306a36Sopenharmony_ci		 */
191262306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_DAS     (1 << 27)
191362306a36Sopenharmony_ci                /* 0 - memory
191462306a36Sopenharmony_ci		 * 1 - register
191562306a36Sopenharmony_ci		 */
191662306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_SAIC    (1 << 28)
191762306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_DAIC    (1 << 29)
191862306a36Sopenharmony_ci#              define PACKET3_DMA_DATA_CMD_RAW_WAIT  (1 << 30)
191962306a36Sopenharmony_ci#define	PACKET3_AQUIRE_MEM				0x58
192062306a36Sopenharmony_ci#define	PACKET3_REWIND					0x59
192162306a36Sopenharmony_ci#define	PACKET3_LOAD_UCONFIG_REG			0x5E
192262306a36Sopenharmony_ci#define	PACKET3_LOAD_SH_REG				0x5F
192362306a36Sopenharmony_ci#define	PACKET3_LOAD_CONFIG_REG				0x60
192462306a36Sopenharmony_ci#define	PACKET3_LOAD_CONTEXT_REG			0x61
192562306a36Sopenharmony_ci#define	PACKET3_SET_CONFIG_REG				0x68
192662306a36Sopenharmony_ci#define		PACKET3_SET_CONFIG_REG_START			0x00008000
192762306a36Sopenharmony_ci#define		PACKET3_SET_CONFIG_REG_END			0x0000b000
192862306a36Sopenharmony_ci#define	PACKET3_SET_CONTEXT_REG				0x69
192962306a36Sopenharmony_ci#define		PACKET3_SET_CONTEXT_REG_START			0x00028000
193062306a36Sopenharmony_ci#define		PACKET3_SET_CONTEXT_REG_END			0x00029000
193162306a36Sopenharmony_ci#define	PACKET3_SET_CONTEXT_REG_INDIRECT		0x73
193262306a36Sopenharmony_ci#define	PACKET3_SET_SH_REG				0x76
193362306a36Sopenharmony_ci#define		PACKET3_SET_SH_REG_START			0x0000b000
193462306a36Sopenharmony_ci#define		PACKET3_SET_SH_REG_END				0x0000c000
193562306a36Sopenharmony_ci#define	PACKET3_SET_SH_REG_OFFSET			0x77
193662306a36Sopenharmony_ci#define	PACKET3_SET_QUEUE_REG				0x78
193762306a36Sopenharmony_ci#define	PACKET3_SET_UCONFIG_REG				0x79
193862306a36Sopenharmony_ci#define		PACKET3_SET_UCONFIG_REG_START			0x00030000
193962306a36Sopenharmony_ci#define		PACKET3_SET_UCONFIG_REG_END			0x00031000
194062306a36Sopenharmony_ci#define	PACKET3_SCRATCH_RAM_WRITE			0x7D
194162306a36Sopenharmony_ci#define	PACKET3_SCRATCH_RAM_READ			0x7E
194262306a36Sopenharmony_ci#define	PACKET3_LOAD_CONST_RAM				0x80
194362306a36Sopenharmony_ci#define	PACKET3_WRITE_CONST_RAM				0x81
194462306a36Sopenharmony_ci#define	PACKET3_DUMP_CONST_RAM				0x83
194562306a36Sopenharmony_ci#define	PACKET3_INCREMENT_CE_COUNTER			0x84
194662306a36Sopenharmony_ci#define	PACKET3_INCREMENT_DE_COUNTER			0x85
194762306a36Sopenharmony_ci#define	PACKET3_WAIT_ON_CE_COUNTER			0x86
194862306a36Sopenharmony_ci#define	PACKET3_WAIT_ON_DE_COUNTER_DIFF			0x88
194962306a36Sopenharmony_ci#define	PACKET3_SWITCH_BUFFER				0x8B
195062306a36Sopenharmony_ci
195162306a36Sopenharmony_ci/* SDMA - first instance at 0xd000, second at 0xd800 */
195262306a36Sopenharmony_ci#define SDMA0_REGISTER_OFFSET                             0x0 /* not a register */
195362306a36Sopenharmony_ci#define SDMA1_REGISTER_OFFSET                             0x800 /* not a register */
195462306a36Sopenharmony_ci
195562306a36Sopenharmony_ci#define	SDMA0_UCODE_ADDR                                  0xD000
195662306a36Sopenharmony_ci#define	SDMA0_UCODE_DATA                                  0xD004
195762306a36Sopenharmony_ci#define	SDMA0_POWER_CNTL                                  0xD008
195862306a36Sopenharmony_ci#define	SDMA0_CLK_CTRL                                    0xD00C
195962306a36Sopenharmony_ci
196062306a36Sopenharmony_ci#define SDMA0_CNTL                                        0xD010
196162306a36Sopenharmony_ci#       define TRAP_ENABLE                                (1 << 0)
196262306a36Sopenharmony_ci#       define SEM_INCOMPLETE_INT_ENABLE                  (1 << 1)
196362306a36Sopenharmony_ci#       define SEM_WAIT_INT_ENABLE                        (1 << 2)
196462306a36Sopenharmony_ci#       define DATA_SWAP_ENABLE                           (1 << 3)
196562306a36Sopenharmony_ci#       define FENCE_SWAP_ENABLE                          (1 << 4)
196662306a36Sopenharmony_ci#       define AUTO_CTXSW_ENABLE                          (1 << 18)
196762306a36Sopenharmony_ci#       define CTXEMPTY_INT_ENABLE                        (1 << 28)
196862306a36Sopenharmony_ci
196962306a36Sopenharmony_ci#define SDMA0_TILING_CONFIG  				  0xD018
197062306a36Sopenharmony_ci
197162306a36Sopenharmony_ci#define SDMA0_SEM_INCOMPLETE_TIMER_CNTL                   0xD020
197262306a36Sopenharmony_ci#define SDMA0_SEM_WAIT_FAIL_TIMER_CNTL                    0xD024
197362306a36Sopenharmony_ci
197462306a36Sopenharmony_ci#define SDMA0_STATUS_REG                                  0xd034
197562306a36Sopenharmony_ci#       define SDMA_IDLE                                  (1 << 0)
197662306a36Sopenharmony_ci
197762306a36Sopenharmony_ci#define SDMA0_ME_CNTL                                     0xD048
197862306a36Sopenharmony_ci#       define SDMA_HALT                                  (1 << 0)
197962306a36Sopenharmony_ci
198062306a36Sopenharmony_ci#define SDMA0_GFX_RB_CNTL                                 0xD200
198162306a36Sopenharmony_ci#       define SDMA_RB_ENABLE                             (1 << 0)
198262306a36Sopenharmony_ci#       define SDMA_RB_SIZE(x)                            ((x) << 1) /* log2 */
198362306a36Sopenharmony_ci#       define SDMA_RB_SWAP_ENABLE                        (1 << 9) /* 8IN32 */
198462306a36Sopenharmony_ci#       define SDMA_RPTR_WRITEBACK_ENABLE                 (1 << 12)
198562306a36Sopenharmony_ci#       define SDMA_RPTR_WRITEBACK_SWAP_ENABLE            (1 << 13)  /* 8IN32 */
198662306a36Sopenharmony_ci#       define SDMA_RPTR_WRITEBACK_TIMER(x)               ((x) << 16) /* log2 */
198762306a36Sopenharmony_ci#define SDMA0_GFX_RB_BASE                                 0xD204
198862306a36Sopenharmony_ci#define SDMA0_GFX_RB_BASE_HI                              0xD208
198962306a36Sopenharmony_ci#define SDMA0_GFX_RB_RPTR                                 0xD20C
199062306a36Sopenharmony_ci#define SDMA0_GFX_RB_WPTR                                 0xD210
199162306a36Sopenharmony_ci
199262306a36Sopenharmony_ci#define SDMA0_GFX_RB_RPTR_ADDR_HI                         0xD220
199362306a36Sopenharmony_ci#define SDMA0_GFX_RB_RPTR_ADDR_LO                         0xD224
199462306a36Sopenharmony_ci#define SDMA0_GFX_IB_CNTL                                 0xD228
199562306a36Sopenharmony_ci#       define SDMA_IB_ENABLE                             (1 << 0)
199662306a36Sopenharmony_ci#       define SDMA_IB_SWAP_ENABLE                        (1 << 4)
199762306a36Sopenharmony_ci#       define SDMA_SWITCH_INSIDE_IB                      (1 << 8)
199862306a36Sopenharmony_ci#       define SDMA_CMD_VMID(x)                           ((x) << 16)
199962306a36Sopenharmony_ci
200062306a36Sopenharmony_ci#define SDMA0_GFX_VIRTUAL_ADDR                            0xD29C
200162306a36Sopenharmony_ci#define SDMA0_GFX_APE1_CNTL                               0xD2A0
200262306a36Sopenharmony_ci
200362306a36Sopenharmony_ci#define SDMA_PACKET(op, sub_op, e)	((((e) & 0xFFFF) << 16) |	\
200462306a36Sopenharmony_ci					 (((sub_op) & 0xFF) << 8) |	\
200562306a36Sopenharmony_ci					 (((op) & 0xFF) << 0))
200662306a36Sopenharmony_ci/* sDMA opcodes */
200762306a36Sopenharmony_ci#define	SDMA_OPCODE_NOP					  0
200862306a36Sopenharmony_ci#define	SDMA_OPCODE_COPY				  1
200962306a36Sopenharmony_ci#       define SDMA_COPY_SUB_OPCODE_LINEAR                0
201062306a36Sopenharmony_ci#       define SDMA_COPY_SUB_OPCODE_TILED                 1
201162306a36Sopenharmony_ci#       define SDMA_COPY_SUB_OPCODE_SOA                   3
201262306a36Sopenharmony_ci#       define SDMA_COPY_SUB_OPCODE_LINEAR_SUB_WINDOW     4
201362306a36Sopenharmony_ci#       define SDMA_COPY_SUB_OPCODE_TILED_SUB_WINDOW      5
201462306a36Sopenharmony_ci#       define SDMA_COPY_SUB_OPCODE_T2T_SUB_WINDOW        6
201562306a36Sopenharmony_ci#define	SDMA_OPCODE_WRITE				  2
201662306a36Sopenharmony_ci#       define SDMA_WRITE_SUB_OPCODE_LINEAR               0
201762306a36Sopenharmony_ci#       define SDMA_WRITE_SUB_OPCODE_TILED                1
201862306a36Sopenharmony_ci#define	SDMA_OPCODE_INDIRECT_BUFFER			  4
201962306a36Sopenharmony_ci#define	SDMA_OPCODE_FENCE				  5
202062306a36Sopenharmony_ci#define	SDMA_OPCODE_TRAP				  6
202162306a36Sopenharmony_ci#define	SDMA_OPCODE_SEMAPHORE				  7
202262306a36Sopenharmony_ci#       define SDMA_SEMAPHORE_EXTRA_O                     (1 << 13)
202362306a36Sopenharmony_ci                /* 0 - increment
202462306a36Sopenharmony_ci		 * 1 - write 1
202562306a36Sopenharmony_ci		 */
202662306a36Sopenharmony_ci#       define SDMA_SEMAPHORE_EXTRA_S                     (1 << 14)
202762306a36Sopenharmony_ci                /* 0 - wait
202862306a36Sopenharmony_ci		 * 1 - signal
202962306a36Sopenharmony_ci		 */
203062306a36Sopenharmony_ci#       define SDMA_SEMAPHORE_EXTRA_M                     (1 << 15)
203162306a36Sopenharmony_ci                /* mailbox */
203262306a36Sopenharmony_ci#define	SDMA_OPCODE_POLL_REG_MEM			  8
203362306a36Sopenharmony_ci#       define SDMA_POLL_REG_MEM_EXTRA_OP(x)              ((x) << 10)
203462306a36Sopenharmony_ci                /* 0 - wait_reg_mem
203562306a36Sopenharmony_ci		 * 1 - wr_wait_wr_reg
203662306a36Sopenharmony_ci		 */
203762306a36Sopenharmony_ci#       define SDMA_POLL_REG_MEM_EXTRA_FUNC(x)            ((x) << 12)
203862306a36Sopenharmony_ci                /* 0 - always
203962306a36Sopenharmony_ci		 * 1 - <
204062306a36Sopenharmony_ci		 * 2 - <=
204162306a36Sopenharmony_ci		 * 3 - ==
204262306a36Sopenharmony_ci		 * 4 - !=
204362306a36Sopenharmony_ci		 * 5 - >=
204462306a36Sopenharmony_ci		 * 6 - >
204562306a36Sopenharmony_ci		 */
204662306a36Sopenharmony_ci#       define SDMA_POLL_REG_MEM_EXTRA_M                  (1 << 15)
204762306a36Sopenharmony_ci                /* 0 = register
204862306a36Sopenharmony_ci		 * 1 = memory
204962306a36Sopenharmony_ci		 */
205062306a36Sopenharmony_ci#define	SDMA_OPCODE_COND_EXEC				  9
205162306a36Sopenharmony_ci#define	SDMA_OPCODE_CONSTANT_FILL			  11
205262306a36Sopenharmony_ci#       define SDMA_CONSTANT_FILL_EXTRA_SIZE(x)           ((x) << 14)
205362306a36Sopenharmony_ci                /* 0 = byte fill
205462306a36Sopenharmony_ci		 * 2 = DW fill
205562306a36Sopenharmony_ci		 */
205662306a36Sopenharmony_ci#define	SDMA_OPCODE_GENERATE_PTE_PDE			  12
205762306a36Sopenharmony_ci#define	SDMA_OPCODE_TIMESTAMP				  13
205862306a36Sopenharmony_ci#       define SDMA_TIMESTAMP_SUB_OPCODE_SET_LOCAL        0
205962306a36Sopenharmony_ci#       define SDMA_TIMESTAMP_SUB_OPCODE_GET_LOCAL        1
206062306a36Sopenharmony_ci#       define SDMA_TIMESTAMP_SUB_OPCODE_GET_GLOBAL       2
206162306a36Sopenharmony_ci#define	SDMA_OPCODE_SRBM_WRITE				  14
206262306a36Sopenharmony_ci#       define SDMA_SRBM_WRITE_EXTRA_BYTE_ENABLE(x)       ((x) << 12)
206362306a36Sopenharmony_ci                /* byte mask */
206462306a36Sopenharmony_ci
206562306a36Sopenharmony_ci/* UVD */
206662306a36Sopenharmony_ci
206762306a36Sopenharmony_ci#define UVD_UDEC_ADDR_CONFIG		0xef4c
206862306a36Sopenharmony_ci#define UVD_UDEC_DB_ADDR_CONFIG		0xef50
206962306a36Sopenharmony_ci#define UVD_UDEC_DBW_ADDR_CONFIG	0xef54
207062306a36Sopenharmony_ci#define UVD_NO_OP			0xeffc
207162306a36Sopenharmony_ci
207262306a36Sopenharmony_ci#define UVD_LMI_EXT40_ADDR		0xf498
207362306a36Sopenharmony_ci#define UVD_GP_SCRATCH4			0xf4e0
207462306a36Sopenharmony_ci#define UVD_LMI_ADDR_EXT		0xf594
207562306a36Sopenharmony_ci#define UVD_VCPU_CACHE_OFFSET0		0xf608
207662306a36Sopenharmony_ci#define UVD_VCPU_CACHE_SIZE0		0xf60c
207762306a36Sopenharmony_ci#define UVD_VCPU_CACHE_OFFSET1		0xf610
207862306a36Sopenharmony_ci#define UVD_VCPU_CACHE_SIZE1		0xf614
207962306a36Sopenharmony_ci#define UVD_VCPU_CACHE_OFFSET2		0xf618
208062306a36Sopenharmony_ci#define UVD_VCPU_CACHE_SIZE2		0xf61c
208162306a36Sopenharmony_ci
208262306a36Sopenharmony_ci#define UVD_RBC_RB_RPTR			0xf690
208362306a36Sopenharmony_ci#define UVD_RBC_RB_WPTR			0xf694
208462306a36Sopenharmony_ci
208562306a36Sopenharmony_ci#define	UVD_CGC_CTRL					0xF4B0
208662306a36Sopenharmony_ci#	define DCM					(1 << 0)
208762306a36Sopenharmony_ci#	define CG_DT(x)					((x) << 2)
208862306a36Sopenharmony_ci#	define CG_DT_MASK				(0xf << 2)
208962306a36Sopenharmony_ci#	define CLK_OD(x)				((x) << 6)
209062306a36Sopenharmony_ci#	define CLK_OD_MASK				(0x1f << 6)
209162306a36Sopenharmony_ci
209262306a36Sopenharmony_ci#define UVD_STATUS					0xf6bc
209362306a36Sopenharmony_ci
209462306a36Sopenharmony_ci/* UVD clocks */
209562306a36Sopenharmony_ci
209662306a36Sopenharmony_ci#define CG_DCLK_CNTL			0xC050009C
209762306a36Sopenharmony_ci#	define DCLK_DIVIDER_MASK	0x7f
209862306a36Sopenharmony_ci#	define DCLK_DIR_CNTL_EN		(1 << 8)
209962306a36Sopenharmony_ci#define CG_DCLK_STATUS			0xC05000A0
210062306a36Sopenharmony_ci#	define DCLK_STATUS		(1 << 0)
210162306a36Sopenharmony_ci#define CG_VCLK_CNTL			0xC05000A4
210262306a36Sopenharmony_ci#define CG_VCLK_STATUS			0xC05000A8
210362306a36Sopenharmony_ci
210462306a36Sopenharmony_ci/* UVD CTX indirect */
210562306a36Sopenharmony_ci#define	UVD_CGC_MEM_CTRL				0xC0
210662306a36Sopenharmony_ci
210762306a36Sopenharmony_ci/* VCE */
210862306a36Sopenharmony_ci
210962306a36Sopenharmony_ci#define VCE_VCPU_CACHE_OFFSET0		0x20024
211062306a36Sopenharmony_ci#define VCE_VCPU_CACHE_SIZE0		0x20028
211162306a36Sopenharmony_ci#define VCE_VCPU_CACHE_OFFSET1		0x2002c
211262306a36Sopenharmony_ci#define VCE_VCPU_CACHE_SIZE1		0x20030
211362306a36Sopenharmony_ci#define VCE_VCPU_CACHE_OFFSET2		0x20034
211462306a36Sopenharmony_ci#define VCE_VCPU_CACHE_SIZE2		0x20038
211562306a36Sopenharmony_ci#define VCE_RB_RPTR2			0x20178
211662306a36Sopenharmony_ci#define VCE_RB_WPTR2			0x2017c
211762306a36Sopenharmony_ci#define VCE_RB_RPTR			0x2018c
211862306a36Sopenharmony_ci#define VCE_RB_WPTR			0x20190
211962306a36Sopenharmony_ci#define VCE_CLOCK_GATING_A		0x202f8
212062306a36Sopenharmony_ci#	define CGC_CLK_GATE_DLY_TIMER_MASK	(0xf << 0)
212162306a36Sopenharmony_ci#	define CGC_CLK_GATE_DLY_TIMER(x)	((x) << 0)
212262306a36Sopenharmony_ci#	define CGC_CLK_GATER_OFF_DLY_TIMER_MASK	(0xff << 4)
212362306a36Sopenharmony_ci#	define CGC_CLK_GATER_OFF_DLY_TIMER(x)	((x) << 4)
212462306a36Sopenharmony_ci#	define CGC_UENC_WAIT_AWAKE	(1 << 18)
212562306a36Sopenharmony_ci#define VCE_CLOCK_GATING_B		0x202fc
212662306a36Sopenharmony_ci#define VCE_CGTT_CLK_OVERRIDE		0x207a0
212762306a36Sopenharmony_ci#define VCE_UENC_CLOCK_GATING		0x207bc
212862306a36Sopenharmony_ci#	define CLOCK_ON_DELAY_MASK	(0xf << 0)
212962306a36Sopenharmony_ci#	define CLOCK_ON_DELAY(x)	((x) << 0)
213062306a36Sopenharmony_ci#	define CLOCK_OFF_DELAY_MASK	(0xff << 4)
213162306a36Sopenharmony_ci#	define CLOCK_OFF_DELAY(x)	((x) << 4)
213262306a36Sopenharmony_ci#define VCE_UENC_REG_CLOCK_GATING	0x207c0
213362306a36Sopenharmony_ci#define VCE_SYS_INT_EN			0x21300
213462306a36Sopenharmony_ci#	define VCE_SYS_INT_TRAP_INTERRUPT_EN	(1 << 3)
213562306a36Sopenharmony_ci#define VCE_LMI_VCPU_CACHE_40BIT_BAR	0x2145c
213662306a36Sopenharmony_ci#define VCE_LMI_CTRL2			0x21474
213762306a36Sopenharmony_ci#define VCE_LMI_CTRL			0x21498
213862306a36Sopenharmony_ci#define VCE_LMI_VM_CTRL			0x214a0
213962306a36Sopenharmony_ci#define VCE_LMI_SWAP_CNTL		0x214b4
214062306a36Sopenharmony_ci#define VCE_LMI_SWAP_CNTL1		0x214b8
214162306a36Sopenharmony_ci#define VCE_LMI_CACHE_CTRL		0x214f4
214262306a36Sopenharmony_ci
214362306a36Sopenharmony_ci#define VCE_CMD_NO_OP		0x00000000
214462306a36Sopenharmony_ci#define VCE_CMD_END		0x00000001
214562306a36Sopenharmony_ci#define VCE_CMD_IB		0x00000002
214662306a36Sopenharmony_ci#define VCE_CMD_FENCE		0x00000003
214762306a36Sopenharmony_ci#define VCE_CMD_TRAP		0x00000004
214862306a36Sopenharmony_ci#define VCE_CMD_IB_AUTO		0x00000005
214962306a36Sopenharmony_ci#define VCE_CMD_SEMAPHORE	0x00000006
215062306a36Sopenharmony_ci
215162306a36Sopenharmony_ci#define ATC_VMID_PASID_MAPPING_UPDATE_STATUS		0x3398u
215262306a36Sopenharmony_ci#define ATC_VMID0_PASID_MAPPING				0x339Cu
215362306a36Sopenharmony_ci#define ATC_VMID_PASID_MAPPING_PASID_MASK		(0xFFFF)
215462306a36Sopenharmony_ci#define ATC_VMID_PASID_MAPPING_PASID_SHIFT		0
215562306a36Sopenharmony_ci#define ATC_VMID_PASID_MAPPING_VALID_MASK		(0x1 << 31)
215662306a36Sopenharmony_ci#define ATC_VMID_PASID_MAPPING_VALID_SHIFT		31
215762306a36Sopenharmony_ci
215862306a36Sopenharmony_ci#define ATC_VM_APERTURE0_CNTL					0x3310u
215962306a36Sopenharmony_ci#define	ATS_ACCESS_MODE_NEVER						0
216062306a36Sopenharmony_ci#define	ATS_ACCESS_MODE_ALWAYS						1
216162306a36Sopenharmony_ci
216262306a36Sopenharmony_ci#define ATC_VM_APERTURE0_CNTL2					0x3318u
216362306a36Sopenharmony_ci#define ATC_VM_APERTURE0_HIGH_ADDR				0x3308u
216462306a36Sopenharmony_ci#define ATC_VM_APERTURE0_LOW_ADDR				0x3300u
216562306a36Sopenharmony_ci#define ATC_VM_APERTURE1_CNTL					0x3314u
216662306a36Sopenharmony_ci#define ATC_VM_APERTURE1_CNTL2					0x331Cu
216762306a36Sopenharmony_ci#define ATC_VM_APERTURE1_HIGH_ADDR				0x330Cu
216862306a36Sopenharmony_ci#define ATC_VM_APERTURE1_LOW_ADDR				0x3304u
216962306a36Sopenharmony_ci
217062306a36Sopenharmony_ci#define IH_VMID_0_LUT						0x3D40u
217162306a36Sopenharmony_ci
217262306a36Sopenharmony_ci#endif
2173