xref: /dflybsd-src/sys/dev/drm/amd/powerplay/inc/smu10.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2017 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  */
23*b843c749SSergey Zigachev 
24*b843c749SSergey Zigachev #ifndef SMU10_H
25*b843c749SSergey Zigachev #define SMU10_H
26*b843c749SSergey Zigachev 
27*b843c749SSergey Zigachev #pragma pack(push, 1)
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #define ENABLE_DEBUG_FEATURES
30*b843c749SSergey Zigachev 
31*b843c749SSergey Zigachev /* Feature Control Defines */
32*b843c749SSergey Zigachev #define FEATURE_CCLK_CONTROLLER_BIT   0
33*b843c749SSergey Zigachev #define FEATURE_FAN_CONTROLLER_BIT    1
34*b843c749SSergey Zigachev #define FEATURE_DATA_CALCULATION_BIT  2
35*b843c749SSergey Zigachev #define FEATURE_PPT_BIT               3
36*b843c749SSergey Zigachev #define FEATURE_TDC_BIT               4
37*b843c749SSergey Zigachev #define FEATURE_THERMAL_BIT           5
38*b843c749SSergey Zigachev #define FEATURE_FIT_BIT               6
39*b843c749SSergey Zigachev #define FEATURE_EDC_BIT               7
40*b843c749SSergey Zigachev #define FEATURE_PLL_POWER_DOWN_BIT    8
41*b843c749SSergey Zigachev #define FEATURE_ULV_BIT               9
42*b843c749SSergey Zigachev #define FEATURE_VDDOFF_BIT            10
43*b843c749SSergey Zigachev #define FEATURE_VCN_DPM_BIT           11
44*b843c749SSergey Zigachev #define FEATURE_ACP_DPM_BIT           12
45*b843c749SSergey Zigachev #define FEATURE_ISP_DPM_BIT           13
46*b843c749SSergey Zigachev #define FEATURE_FCLK_DPM_BIT          14
47*b843c749SSergey Zigachev #define FEATURE_SOCCLK_DPM_BIT        15
48*b843c749SSergey Zigachev #define FEATURE_MP0CLK_DPM_BIT        16
49*b843c749SSergey Zigachev #define FEATURE_LCLK_DPM_BIT          17
50*b843c749SSergey Zigachev #define FEATURE_SHUBCLK_DPM_BIT       18
51*b843c749SSergey Zigachev #define FEATURE_DCEFCLK_DPM_BIT       19
52*b843c749SSergey Zigachev #define FEATURE_GFX_DPM_BIT           20
53*b843c749SSergey Zigachev #define FEATURE_DS_GFXCLK_BIT         21
54*b843c749SSergey Zigachev #define FEATURE_DS_SOCCLK_BIT         22
55*b843c749SSergey Zigachev #define FEATURE_DS_LCLK_BIT           23
56*b843c749SSergey Zigachev #define FEATURE_DS_DCEFCLK_BIT        24
57*b843c749SSergey Zigachev #define FEATURE_DS_SHUBCLK_BIT        25
58*b843c749SSergey Zigachev #define FEATURE_RM_BIT                26
59*b843c749SSergey Zigachev #define FEATURE_S0i2_BIT              27
60*b843c749SSergey Zigachev #define FEATURE_WHISPER_MODE_BIT      28
61*b843c749SSergey Zigachev #define FEATURE_DS_FCLK_BIT           29
62*b843c749SSergey Zigachev #define FEATURE_DS_SMNCLK_BIT         30
63*b843c749SSergey Zigachev #define FEATURE_DS_MP1CLK_BIT         31
64*b843c749SSergey Zigachev #define FEATURE_DS_MP0CLK_BIT         32
65*b843c749SSergey Zigachev #define FEATURE_MGCG_BIT              33
66*b843c749SSergey Zigachev #define FEATURE_DS_FUSE_SRAM_BIT      34
67*b843c749SSergey Zigachev #define FEATURE_GFX_CKS               35
68*b843c749SSergey Zigachev #define FEATURE_PSI0_BIT              36
69*b843c749SSergey Zigachev #define FEATURE_PROCHOT_BIT           37
70*b843c749SSergey Zigachev #define FEATURE_CPUOFF_BIT            38
71*b843c749SSergey Zigachev #define FEATURE_STAPM_BIT             39
72*b843c749SSergey Zigachev #define FEATURE_CORE_CSTATES_BIT      40
73*b843c749SSergey Zigachev #define FEATURE_SPARE_41_BIT          41
74*b843c749SSergey Zigachev #define FEATURE_SPARE_42_BIT          42
75*b843c749SSergey Zigachev #define FEATURE_SPARE_43_BIT          43
76*b843c749SSergey Zigachev #define FEATURE_SPARE_44_BIT          44
77*b843c749SSergey Zigachev #define FEATURE_SPARE_45_BIT          45
78*b843c749SSergey Zigachev #define FEATURE_SPARE_46_BIT          46
79*b843c749SSergey Zigachev #define FEATURE_SPARE_47_BIT          47
80*b843c749SSergey Zigachev #define FEATURE_SPARE_48_BIT          48
81*b843c749SSergey Zigachev #define FEATURE_SPARE_49_BIT          49
82*b843c749SSergey Zigachev #define FEATURE_SPARE_50_BIT          50
83*b843c749SSergey Zigachev #define FEATURE_SPARE_51_BIT          51
84*b843c749SSergey Zigachev #define FEATURE_SPARE_52_BIT          52
85*b843c749SSergey Zigachev #define FEATURE_SPARE_53_BIT          53
86*b843c749SSergey Zigachev #define FEATURE_SPARE_54_BIT          54
87*b843c749SSergey Zigachev #define FEATURE_SPARE_55_BIT          55
88*b843c749SSergey Zigachev #define FEATURE_SPARE_56_BIT          56
89*b843c749SSergey Zigachev #define FEATURE_SPARE_57_BIT          57
90*b843c749SSergey Zigachev #define FEATURE_SPARE_58_BIT          58
91*b843c749SSergey Zigachev #define FEATURE_SPARE_59_BIT          59
92*b843c749SSergey Zigachev #define FEATURE_SPARE_60_BIT          60
93*b843c749SSergey Zigachev #define FEATURE_SPARE_61_BIT          61
94*b843c749SSergey Zigachev #define FEATURE_SPARE_62_BIT          62
95*b843c749SSergey Zigachev #define FEATURE_SPARE_63_BIT          63
96*b843c749SSergey Zigachev 
97*b843c749SSergey Zigachev #define NUM_FEATURES                  64
98*b843c749SSergey Zigachev 
99*b843c749SSergey Zigachev #define FEATURE_CCLK_CONTROLLER_MASK  (1 << FEATURE_CCLK_CONTROLLER_BIT)
100*b843c749SSergey Zigachev #define FEATURE_FAN_CONTROLLER_MASK   (1 << FEATURE_FAN_CONTROLLER_BIT)
101*b843c749SSergey Zigachev #define FEATURE_DATA_CALCULATION_MASK (1 << FEATURE_DATA_CALCULATION_BIT)
102*b843c749SSergey Zigachev #define FEATURE_PPT_MASK              (1 << FEATURE_PPT_BIT)
103*b843c749SSergey Zigachev #define FEATURE_TDC_MASK              (1 << FEATURE_TDC_BIT)
104*b843c749SSergey Zigachev #define FEATURE_THERMAL_MASK          (1 << FEATURE_THERMAL_BIT)
105*b843c749SSergey Zigachev #define FEATURE_FIT_MASK              (1 << FEATURE_FIT_BIT)
106*b843c749SSergey Zigachev #define FEATURE_EDC_MASK              (1 << FEATURE_EDC_BIT)
107*b843c749SSergey Zigachev #define FEATURE_PLL_POWER_DOWN_MASK   (1 << FEATURE_PLL_POWER_DOWN_BIT)
108*b843c749SSergey Zigachev #define FEATURE_ULV_MASK              (1 << FEATURE_ULV_BIT)
109*b843c749SSergey Zigachev #define FEATURE_VDDOFF_MASK           (1 << FEATURE_VDDOFF_BIT)
110*b843c749SSergey Zigachev #define FEATURE_VCN_DPM_MASK          (1 << FEATURE_VCN_DPM_BIT)
111*b843c749SSergey Zigachev #define FEATURE_ACP_DPM_MASK          (1 << FEATURE_ACP_DPM_BIT)
112*b843c749SSergey Zigachev #define FEATURE_ISP_DPM_MASK          (1 << FEATURE_ISP_DPM_BIT)
113*b843c749SSergey Zigachev #define FEATURE_FCLK_DPM_MASK         (1 << FEATURE_FCLK_DPM_BIT)
114*b843c749SSergey Zigachev #define FEATURE_SOCCLK_DPM_MASK       (1 << FEATURE_SOCCLK_DPM_BIT)
115*b843c749SSergey Zigachev #define FEATURE_MP0CLK_DPM_MASK       (1 << FEATURE_MP0CLK_DPM_BIT)
116*b843c749SSergey Zigachev #define FEATURE_LCLK_DPM_MASK         (1 << FEATURE_LCLK_DPM_BIT)
117*b843c749SSergey Zigachev #define FEATURE_SHUBCLK_DPM_MASK      (1 << FEATURE_SHUBCLK_DPM_BIT)
118*b843c749SSergey Zigachev #define FEATURE_DCEFCLK_DPM_MASK      (1 << FEATURE_DCEFCLK_DPM_BIT)
119*b843c749SSergey Zigachev #define FEATURE_GFX_DPM_MASK          (1 << FEATURE_GFX_DPM_BIT)
120*b843c749SSergey Zigachev #define FEATURE_DS_GFXCLK_MASK        (1 << FEATURE_DS_GFXCLK_BIT)
121*b843c749SSergey Zigachev #define FEATURE_DS_SOCCLK_MASK        (1 << FEATURE_DS_SOCCLK_BIT)
122*b843c749SSergey Zigachev #define FEATURE_DS_LCLK_MASK          (1 << FEATURE_DS_LCLK_BIT)
123*b843c749SSergey Zigachev #define FEATURE_DS_DCEFCLK_MASK       (1 << FEATURE_DS_DCEFCLK_BIT)
124*b843c749SSergey Zigachev #define FEATURE_DS_SHUBCLK_MASK       (1 << FEATURE_DS_SHUBCLK_BIT)
125*b843c749SSergey Zigachev #define FEATURE_RM_MASK               (1 << FEATURE_RM_BIT)
126*b843c749SSergey Zigachev #define FEATURE_DS_FCLK_MASK          (1 << FEATURE_DS_FCLK_BIT)
127*b843c749SSergey Zigachev #define FEATURE_DS_SMNCLK_MASK        (1 << FEATURE_DS_SMNCLK_BIT)
128*b843c749SSergey Zigachev #define FEATURE_DS_MP1CLK_MASK        (1 << FEATURE_DS_MP1CLK_BIT)
129*b843c749SSergey Zigachev #define FEATURE_DS_MP0CLK_MASK        (1 << FEATURE_DS_MP0CLK_BIT)
130*b843c749SSergey Zigachev #define FEATURE_MGCG_MASK             (1 << FEATURE_MGCG_BIT)
131*b843c749SSergey Zigachev #define FEATURE_DS_FUSE_SRAM_MASK     (1 << FEATURE_DS_FUSE_SRAM_BIT)
132*b843c749SSergey Zigachev #define FEATURE_PSI0_MASK             (1 << FEATURE_PSI0_BIT)
133*b843c749SSergey Zigachev #define FEATURE_STAPM_MASK            (1 << FEATURE_STAPM_BIT)
134*b843c749SSergey Zigachev #define FEATURE_PROCHOT_MASK          (1 << FEATURE_PROCHOT_BIT)
135*b843c749SSergey Zigachev #define FEATURE_CPUOFF_MASK           (1 << FEATURE_CPUOFF_BIT)
136*b843c749SSergey Zigachev #define FEATURE_CORE_CSTATES_MASK     (1 << FEATURE_CORE_CSTATES_BIT)
137*b843c749SSergey Zigachev 
138*b843c749SSergey Zigachev /* Workload bits */
139*b843c749SSergey Zigachev #define WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT 0
140*b843c749SSergey Zigachev #define WORKLOAD_PPLIB_VIDEO_BIT          2
141*b843c749SSergey Zigachev #define WORKLOAD_PPLIB_VR_BIT             3
142*b843c749SSergey Zigachev #define WORKLOAD_PPLIB_COMPUTE_BIT        4
143*b843c749SSergey Zigachev #define WORKLOAD_PPLIB_CUSTOM_BIT         5
144*b843c749SSergey Zigachev #define WORKLOAD_PPLIB_COUNT              6
145*b843c749SSergey Zigachev 
146*b843c749SSergey Zigachev typedef struct {
147*b843c749SSergey Zigachev 	/* MP1_EXT_SCRATCH0 */
148*b843c749SSergey Zigachev 	uint32_t CurrLevel_ACP     : 4;
149*b843c749SSergey Zigachev 	uint32_t CurrLevel_ISP     : 4;
150*b843c749SSergey Zigachev 	uint32_t CurrLevel_VCN     : 4;
151*b843c749SSergey Zigachev 	uint32_t CurrLevel_LCLK    : 4;
152*b843c749SSergey Zigachev 	uint32_t CurrLevel_MP0CLK  : 4;
153*b843c749SSergey Zigachev 	uint32_t CurrLevel_FCLK    : 4;
154*b843c749SSergey Zigachev 	uint32_t CurrLevel_SOCCLK  : 4;
155*b843c749SSergey Zigachev 	uint32_t CurrLevel_DCEFCLK : 4;
156*b843c749SSergey Zigachev 	/* MP1_EXT_SCRATCH1 */
157*b843c749SSergey Zigachev 	uint32_t TargLevel_ACP     : 4;
158*b843c749SSergey Zigachev 	uint32_t TargLevel_ISP     : 4;
159*b843c749SSergey Zigachev 	uint32_t TargLevel_VCN     : 4;
160*b843c749SSergey Zigachev 	uint32_t TargLevel_LCLK    : 4;
161*b843c749SSergey Zigachev 	uint32_t TargLevel_MP0CLK  : 4;
162*b843c749SSergey Zigachev 	uint32_t TargLevel_FCLK    : 4;
163*b843c749SSergey Zigachev 	uint32_t TargLevel_SOCCLK  : 4;
164*b843c749SSergey Zigachev 	uint32_t TargLevel_DCEFCLK : 4;
165*b843c749SSergey Zigachev 	/* MP1_EXT_SCRATCH2 */
166*b843c749SSergey Zigachev 	uint32_t CurrLevel_SHUBCLK  : 4;
167*b843c749SSergey Zigachev 	uint32_t TargLevel_SHUBCLK  : 4;
168*b843c749SSergey Zigachev 	uint32_t InUlv              : 1;
169*b843c749SSergey Zigachev 	uint32_t InS0i2             : 1;
170*b843c749SSergey Zigachev 	uint32_t InWhisperMode      : 1;
171*b843c749SSergey Zigachev 	uint32_t Reserved           : 21;
172*b843c749SSergey Zigachev 	/* MP1_EXT_SCRATCH3-4 */
173*b843c749SSergey Zigachev 	uint32_t Reserved2[2];
174*b843c749SSergey Zigachev 	/* MP1_EXT_SCRATCH5 */
175*b843c749SSergey Zigachev 	uint32_t FeatureStatus[NUM_FEATURES / 32];
176*b843c749SSergey Zigachev } FwStatus_t;
177*b843c749SSergey Zigachev 
178*b843c749SSergey Zigachev #define TABLE_BIOS_IF            0 /* Called by BIOS */
179*b843c749SSergey Zigachev #define TABLE_WATERMARKS         1 /* Called by Driver */
180*b843c749SSergey Zigachev #define TABLE_CUSTOM_DPM         2 /* Called by Driver */
181*b843c749SSergey Zigachev #define TABLE_PMSTATUSLOG        3 /* Called by Tools for Agm logging */
182*b843c749SSergey Zigachev #define TABLE_DPMCLOCKS          4 /* Called by Driver */
183*b843c749SSergey Zigachev #define TABLE_MOMENTARY_PM       5 /* Called by Tools */
184*b843c749SSergey Zigachev #define TABLE_COUNT              6
185*b843c749SSergey Zigachev 
186*b843c749SSergey Zigachev #pragma pack(pop)
187*b843c749SSergey Zigachev 
188*b843c749SSergey Zigachev #endif
189