xref: /dflybsd-src/sys/dev/drm/amd/powerplay/inc/smu74_discrete.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2014 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 SMU74_DISCRETE_H
25*b843c749SSergey Zigachev #define SMU74_DISCRETE_H
26*b843c749SSergey Zigachev 
27*b843c749SSergey Zigachev #include "smu74.h"
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #pragma pack(push, 1)
30*b843c749SSergey Zigachev 
31*b843c749SSergey Zigachev 
32*b843c749SSergey Zigachev #define NUM_SCLK_RANGE 8
33*b843c749SSergey Zigachev 
34*b843c749SSergey Zigachev #define VCO_3_6 1
35*b843c749SSergey Zigachev #define VCO_2_4 3
36*b843c749SSergey Zigachev 
37*b843c749SSergey Zigachev #define POSTDIV_DIV_BY_1  0
38*b843c749SSergey Zigachev #define POSTDIV_DIV_BY_2  1
39*b843c749SSergey Zigachev #define POSTDIV_DIV_BY_4  2
40*b843c749SSergey Zigachev #define POSTDIV_DIV_BY_8  3
41*b843c749SSergey Zigachev #define POSTDIV_DIV_BY_16 4
42*b843c749SSergey Zigachev 
43*b843c749SSergey Zigachev struct sclkFcwRange_t {
44*b843c749SSergey Zigachev 	uint8_t  vco_setting;
45*b843c749SSergey Zigachev 	uint8_t  postdiv;
46*b843c749SSergey Zigachev 	uint16_t fcw_pcc;
47*b843c749SSergey Zigachev 
48*b843c749SSergey Zigachev 	uint16_t fcw_trans_upper;
49*b843c749SSergey Zigachev 	uint16_t fcw_trans_lower;
50*b843c749SSergey Zigachev };
51*b843c749SSergey Zigachev typedef struct sclkFcwRange_t sclkFcwRange_t;
52*b843c749SSergey Zigachev 
53*b843c749SSergey Zigachev struct SMIO_Pattern {
54*b843c749SSergey Zigachev 	uint16_t Voltage;
55*b843c749SSergey Zigachev 	uint8_t  Smio;
56*b843c749SSergey Zigachev 	uint8_t  padding;
57*b843c749SSergey Zigachev };
58*b843c749SSergey Zigachev 
59*b843c749SSergey Zigachev typedef struct SMIO_Pattern SMIO_Pattern;
60*b843c749SSergey Zigachev 
61*b843c749SSergey Zigachev struct SMIO_Table {
62*b843c749SSergey Zigachev 	SMIO_Pattern Pattern[SMU_MAX_SMIO_LEVELS];
63*b843c749SSergey Zigachev };
64*b843c749SSergey Zigachev 
65*b843c749SSergey Zigachev typedef struct SMIO_Table SMIO_Table;
66*b843c749SSergey Zigachev 
67*b843c749SSergey Zigachev struct SMU_SclkSetting {
68*b843c749SSergey Zigachev 	uint32_t    SclkFrequency;
69*b843c749SSergey Zigachev 	uint16_t    Fcw_int;
70*b843c749SSergey Zigachev 	uint16_t    Fcw_frac;
71*b843c749SSergey Zigachev 	uint16_t    Pcc_fcw_int;
72*b843c749SSergey Zigachev 	uint8_t     PllRange;
73*b843c749SSergey Zigachev 	uint8_t     SSc_En;
74*b843c749SSergey Zigachev 	uint16_t    Sclk_slew_rate;
75*b843c749SSergey Zigachev 	uint16_t    Pcc_up_slew_rate;
76*b843c749SSergey Zigachev 	uint16_t    Pcc_down_slew_rate;
77*b843c749SSergey Zigachev 	uint16_t    Fcw1_int;
78*b843c749SSergey Zigachev 	uint16_t    Fcw1_frac;
79*b843c749SSergey Zigachev 	uint16_t    Sclk_ss_slew_rate;
80*b843c749SSergey Zigachev };
81*b843c749SSergey Zigachev typedef struct SMU_SclkSetting SMU_SclkSetting;
82*b843c749SSergey Zigachev 
83*b843c749SSergey Zigachev struct SMU74_Discrete_GraphicsLevel {
84*b843c749SSergey Zigachev 	SMU_VoltageLevel MinVoltage;
85*b843c749SSergey Zigachev 	uint8_t     pcieDpmLevel;
86*b843c749SSergey Zigachev 	uint8_t     DeepSleepDivId;
87*b843c749SSergey Zigachev 	uint16_t    ActivityLevel;
88*b843c749SSergey Zigachev 	uint32_t    CgSpllFuncCntl3;
89*b843c749SSergey Zigachev 	uint32_t    CgSpllFuncCntl4;
90*b843c749SSergey Zigachev 	uint32_t    CcPwrDynRm;
91*b843c749SSergey Zigachev 	uint32_t    CcPwrDynRm1;
92*b843c749SSergey Zigachev 	uint8_t     SclkDid;
93*b843c749SSergey Zigachev 	uint8_t     padding;
94*b843c749SSergey Zigachev 	uint8_t     EnabledForActivity;
95*b843c749SSergey Zigachev 	uint8_t     EnabledForThrottle;
96*b843c749SSergey Zigachev 	uint8_t     UpHyst;
97*b843c749SSergey Zigachev 	uint8_t     DownHyst;
98*b843c749SSergey Zigachev 	uint8_t     VoltageDownHyst;
99*b843c749SSergey Zigachev 	uint8_t     PowerThrottle;
100*b843c749SSergey Zigachev 	SMU_SclkSetting SclkSetting;
101*b843c749SSergey Zigachev };
102*b843c749SSergey Zigachev 
103*b843c749SSergey Zigachev typedef struct SMU74_Discrete_GraphicsLevel SMU74_Discrete_GraphicsLevel;
104*b843c749SSergey Zigachev 
105*b843c749SSergey Zigachev struct SMU74_Discrete_ACPILevel {
106*b843c749SSergey Zigachev 	uint32_t    Flags;
107*b843c749SSergey Zigachev 	SMU_VoltageLevel MinVoltage;
108*b843c749SSergey Zigachev 	uint32_t    SclkFrequency;
109*b843c749SSergey Zigachev 	uint8_t     SclkDid;
110*b843c749SSergey Zigachev 	uint8_t     DisplayWatermark;
111*b843c749SSergey Zigachev 	uint8_t     DeepSleepDivId;
112*b843c749SSergey Zigachev 	uint8_t     padding;
113*b843c749SSergey Zigachev 	uint32_t    CcPwrDynRm;
114*b843c749SSergey Zigachev 	uint32_t    CcPwrDynRm1;
115*b843c749SSergey Zigachev 
116*b843c749SSergey Zigachev 	SMU_SclkSetting SclkSetting;
117*b843c749SSergey Zigachev };
118*b843c749SSergey Zigachev 
119*b843c749SSergey Zigachev typedef struct SMU74_Discrete_ACPILevel SMU74_Discrete_ACPILevel;
120*b843c749SSergey Zigachev 
121*b843c749SSergey Zigachev struct SMU74_Discrete_Ulv {
122*b843c749SSergey Zigachev 	uint32_t    CcPwrDynRm;
123*b843c749SSergey Zigachev 	uint32_t    CcPwrDynRm1;
124*b843c749SSergey Zigachev 	uint16_t    VddcOffset;
125*b843c749SSergey Zigachev 	uint8_t     VddcOffsetVid;
126*b843c749SSergey Zigachev 	uint8_t     VddcPhase;
127*b843c749SSergey Zigachev 	uint16_t    BifSclkDfs;
128*b843c749SSergey Zigachev 	uint16_t    Reserved;
129*b843c749SSergey Zigachev };
130*b843c749SSergey Zigachev 
131*b843c749SSergey Zigachev typedef struct SMU74_Discrete_Ulv SMU74_Discrete_Ulv;
132*b843c749SSergey Zigachev 
133*b843c749SSergey Zigachev struct SMU74_Discrete_MemoryLevel {
134*b843c749SSergey Zigachev 	SMU_VoltageLevel MinVoltage;
135*b843c749SSergey Zigachev 	uint32_t    MinMvdd;
136*b843c749SSergey Zigachev 
137*b843c749SSergey Zigachev 	uint32_t    MclkFrequency;
138*b843c749SSergey Zigachev 
139*b843c749SSergey Zigachev 	uint8_t     StutterEnable;
140*b843c749SSergey Zigachev 	uint8_t     EnabledForThrottle;
141*b843c749SSergey Zigachev 	uint8_t     EnabledForActivity;
142*b843c749SSergey Zigachev 	uint8_t     padding_0;
143*b843c749SSergey Zigachev 
144*b843c749SSergey Zigachev 	uint8_t     UpHyst;
145*b843c749SSergey Zigachev 	uint8_t     DownHyst;
146*b843c749SSergey Zigachev 	uint8_t     VoltageDownHyst;
147*b843c749SSergey Zigachev 	uint8_t     padding_1;
148*b843c749SSergey Zigachev 
149*b843c749SSergey Zigachev 	uint16_t    ActivityLevel;
150*b843c749SSergey Zigachev 	uint8_t     DisplayWatermark;
151*b843c749SSergey Zigachev 	uint8_t     Reserved;
152*b843c749SSergey Zigachev };
153*b843c749SSergey Zigachev 
154*b843c749SSergey Zigachev typedef struct SMU74_Discrete_MemoryLevel SMU74_Discrete_MemoryLevel;
155*b843c749SSergey Zigachev 
156*b843c749SSergey Zigachev struct SMU74_Discrete_LinkLevel {
157*b843c749SSergey Zigachev 	uint8_t     PcieGenSpeed;
158*b843c749SSergey Zigachev 	uint8_t     PcieLaneCount;
159*b843c749SSergey Zigachev 	uint8_t     EnabledForActivity;
160*b843c749SSergey Zigachev 	uint8_t     SPC;
161*b843c749SSergey Zigachev 	uint32_t    DownThreshold;
162*b843c749SSergey Zigachev 	uint32_t    UpThreshold;
163*b843c749SSergey Zigachev 	uint16_t    BifSclkDfs;
164*b843c749SSergey Zigachev 	uint16_t    Reserved;
165*b843c749SSergey Zigachev };
166*b843c749SSergey Zigachev 
167*b843c749SSergey Zigachev typedef struct SMU74_Discrete_LinkLevel SMU74_Discrete_LinkLevel;
168*b843c749SSergey Zigachev 
169*b843c749SSergey Zigachev struct SMU74_Discrete_MCArbDramTimingTableEntry {
170*b843c749SSergey Zigachev 	uint32_t McArbDramTiming;
171*b843c749SSergey Zigachev 	uint32_t McArbDramTiming2;
172*b843c749SSergey Zigachev 	uint8_t  McArbBurstTime;
173*b843c749SSergey Zigachev 	uint8_t  padding[3];
174*b843c749SSergey Zigachev };
175*b843c749SSergey Zigachev 
176*b843c749SSergey Zigachev typedef struct SMU74_Discrete_MCArbDramTimingTableEntry SMU74_Discrete_MCArbDramTimingTableEntry;
177*b843c749SSergey Zigachev 
178*b843c749SSergey Zigachev struct SMU74_Discrete_MCArbDramTimingTable {
179*b843c749SSergey Zigachev 	SMU74_Discrete_MCArbDramTimingTableEntry entries[SMU__NUM_SCLK_DPM_STATE][SMU__NUM_MCLK_DPM_LEVELS];
180*b843c749SSergey Zigachev };
181*b843c749SSergey Zigachev 
182*b843c749SSergey Zigachev typedef struct SMU74_Discrete_MCArbDramTimingTable SMU74_Discrete_MCArbDramTimingTable;
183*b843c749SSergey Zigachev 
184*b843c749SSergey Zigachev struct SMU74_Discrete_UvdLevel {
185*b843c749SSergey Zigachev 	uint32_t VclkFrequency;
186*b843c749SSergey Zigachev 	uint32_t DclkFrequency;
187*b843c749SSergey Zigachev 	SMU_VoltageLevel MinVoltage;
188*b843c749SSergey Zigachev 	uint8_t  VclkDivider;
189*b843c749SSergey Zigachev 	uint8_t  DclkDivider;
190*b843c749SSergey Zigachev 	uint8_t  padding[2];
191*b843c749SSergey Zigachev };
192*b843c749SSergey Zigachev 
193*b843c749SSergey Zigachev typedef struct SMU74_Discrete_UvdLevel SMU74_Discrete_UvdLevel;
194*b843c749SSergey Zigachev 
195*b843c749SSergey Zigachev struct SMU74_Discrete_ExtClkLevel {
196*b843c749SSergey Zigachev 	uint32_t Frequency;
197*b843c749SSergey Zigachev 	SMU_VoltageLevel MinVoltage;
198*b843c749SSergey Zigachev 	uint8_t  Divider;
199*b843c749SSergey Zigachev 	uint8_t  padding[3];
200*b843c749SSergey Zigachev };
201*b843c749SSergey Zigachev 
202*b843c749SSergey Zigachev typedef struct SMU74_Discrete_ExtClkLevel SMU74_Discrete_ExtClkLevel;
203*b843c749SSergey Zigachev 
204*b843c749SSergey Zigachev struct SMU74_Discrete_StateInfo {
205*b843c749SSergey Zigachev 	uint32_t SclkFrequency;
206*b843c749SSergey Zigachev 	uint32_t MclkFrequency;
207*b843c749SSergey Zigachev 	uint32_t VclkFrequency;
208*b843c749SSergey Zigachev 	uint32_t DclkFrequency;
209*b843c749SSergey Zigachev 	uint32_t SamclkFrequency;
210*b843c749SSergey Zigachev 	uint32_t AclkFrequency;
211*b843c749SSergey Zigachev 	uint32_t EclkFrequency;
212*b843c749SSergey Zigachev 	uint16_t MvddVoltage;
213*b843c749SSergey Zigachev 	uint16_t padding16;
214*b843c749SSergey Zigachev 	uint8_t  DisplayWatermark;
215*b843c749SSergey Zigachev 	uint8_t  McArbIndex;
216*b843c749SSergey Zigachev 	uint8_t  McRegIndex;
217*b843c749SSergey Zigachev 	uint8_t  SeqIndex;
218*b843c749SSergey Zigachev 	uint8_t  SclkDid;
219*b843c749SSergey Zigachev 	int8_t   SclkIndex;
220*b843c749SSergey Zigachev 	int8_t   MclkIndex;
221*b843c749SSergey Zigachev 	uint8_t  PCIeGen;
222*b843c749SSergey Zigachev };
223*b843c749SSergey Zigachev 
224*b843c749SSergey Zigachev typedef struct SMU74_Discrete_StateInfo SMU74_Discrete_StateInfo;
225*b843c749SSergey Zigachev 
226*b843c749SSergey Zigachev struct SMU_QuadraticCoeffs {
227*b843c749SSergey Zigachev 	int32_t m1;
228*b843c749SSergey Zigachev 	uint32_t b;
229*b843c749SSergey Zigachev 
230*b843c749SSergey Zigachev 	int16_t m2;
231*b843c749SSergey Zigachev 	uint8_t m1_shift;
232*b843c749SSergey Zigachev 	uint8_t m2_shift;
233*b843c749SSergey Zigachev };
234*b843c749SSergey Zigachev typedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs;
235*b843c749SSergey Zigachev 
236*b843c749SSergey Zigachev struct SMU74_Discrete_DpmTable {
237*b843c749SSergey Zigachev 
238*b843c749SSergey Zigachev 	SMU74_PIDController                  GraphicsPIDController;
239*b843c749SSergey Zigachev 	SMU74_PIDController                  MemoryPIDController;
240*b843c749SSergey Zigachev 	SMU74_PIDController                  LinkPIDController;
241*b843c749SSergey Zigachev 
242*b843c749SSergey Zigachev 	uint32_t                            SystemFlags;
243*b843c749SSergey Zigachev 
244*b843c749SSergey Zigachev 	uint32_t                            VRConfig;
245*b843c749SSergey Zigachev 	uint32_t                            SmioMask1;
246*b843c749SSergey Zigachev 	uint32_t                            SmioMask2;
247*b843c749SSergey Zigachev 	SMIO_Table                          SmioTable1;
248*b843c749SSergey Zigachev 	SMIO_Table                          SmioTable2;
249*b843c749SSergey Zigachev 
250*b843c749SSergey Zigachev 	uint32_t                            MvddLevelCount;
251*b843c749SSergey Zigachev 
252*b843c749SSergey Zigachev 
253*b843c749SSergey Zigachev 	uint8_t                             BapmVddcVidHiSidd[SMU74_MAX_LEVELS_VDDC];
254*b843c749SSergey Zigachev 	uint8_t                             BapmVddcVidLoSidd[SMU74_MAX_LEVELS_VDDC];
255*b843c749SSergey Zigachev 	uint8_t                             BapmVddcVidHiSidd2[SMU74_MAX_LEVELS_VDDC];
256*b843c749SSergey Zigachev 
257*b843c749SSergey Zigachev 	uint8_t                             GraphicsDpmLevelCount;
258*b843c749SSergey Zigachev 	uint8_t                             MemoryDpmLevelCount;
259*b843c749SSergey Zigachev 	uint8_t                             LinkLevelCount;
260*b843c749SSergey Zigachev 	uint8_t                             MasterDeepSleepControl;
261*b843c749SSergey Zigachev 
262*b843c749SSergey Zigachev 	uint8_t                             UvdLevelCount;
263*b843c749SSergey Zigachev 	uint8_t                             VceLevelCount;
264*b843c749SSergey Zigachev 	uint8_t                             AcpLevelCount;
265*b843c749SSergey Zigachev 	uint8_t                             SamuLevelCount;
266*b843c749SSergey Zigachev 
267*b843c749SSergey Zigachev 	uint8_t                             ThermOutGpio;
268*b843c749SSergey Zigachev 	uint8_t                             ThermOutPolarity;
269*b843c749SSergey Zigachev 	uint8_t                             ThermOutMode;
270*b843c749SSergey Zigachev 	uint8_t                             BootPhases;
271*b843c749SSergey Zigachev 
272*b843c749SSergey Zigachev 	uint8_t                             VRHotLevel;
273*b843c749SSergey Zigachev 	uint8_t                             LdoRefSel;
274*b843c749SSergey Zigachev 	uint8_t                             Reserved1[2];
275*b843c749SSergey Zigachev 	uint16_t                            FanStartTemperature;
276*b843c749SSergey Zigachev 	uint16_t                            FanStopTemperature;
277*b843c749SSergey Zigachev 	uint16_t                            MaxVoltage;
278*b843c749SSergey Zigachev 	uint16_t                            Reserved2;
279*b843c749SSergey Zigachev 	uint32_t                            Reserved[1];
280*b843c749SSergey Zigachev 
281*b843c749SSergey Zigachev 	SMU74_Discrete_GraphicsLevel        GraphicsLevel[SMU74_MAX_LEVELS_GRAPHICS];
282*b843c749SSergey Zigachev 	SMU74_Discrete_MemoryLevel          MemoryACPILevel;
283*b843c749SSergey Zigachev 	SMU74_Discrete_MemoryLevel          MemoryLevel[SMU74_MAX_LEVELS_MEMORY];
284*b843c749SSergey Zigachev 	SMU74_Discrete_LinkLevel            LinkLevel[SMU74_MAX_LEVELS_LINK];
285*b843c749SSergey Zigachev 	SMU74_Discrete_ACPILevel            ACPILevel;
286*b843c749SSergey Zigachev 	SMU74_Discrete_UvdLevel             UvdLevel[SMU74_MAX_LEVELS_UVD];
287*b843c749SSergey Zigachev 	SMU74_Discrete_ExtClkLevel          VceLevel[SMU74_MAX_LEVELS_VCE];
288*b843c749SSergey Zigachev 	SMU74_Discrete_ExtClkLevel          AcpLevel[SMU74_MAX_LEVELS_ACP];
289*b843c749SSergey Zigachev 	SMU74_Discrete_ExtClkLevel          SamuLevel[SMU74_MAX_LEVELS_SAMU];
290*b843c749SSergey Zigachev 	SMU74_Discrete_Ulv                  Ulv;
291*b843c749SSergey Zigachev 
292*b843c749SSergey Zigachev 	uint8_t                             DisplayWatermark[SMU74_MAX_LEVELS_MEMORY][SMU74_MAX_LEVELS_GRAPHICS];
293*b843c749SSergey Zigachev 
294*b843c749SSergey Zigachev 	uint32_t                            SclkStepSize;
295*b843c749SSergey Zigachev 	uint32_t                            Smio[SMU74_MAX_ENTRIES_SMIO];
296*b843c749SSergey Zigachev 
297*b843c749SSergey Zigachev 	uint8_t                             UvdBootLevel;
298*b843c749SSergey Zigachev 	uint8_t                             VceBootLevel;
299*b843c749SSergey Zigachev 	uint8_t                             AcpBootLevel;
300*b843c749SSergey Zigachev 	uint8_t                             SamuBootLevel;
301*b843c749SSergey Zigachev 
302*b843c749SSergey Zigachev 	uint8_t                             GraphicsBootLevel;
303*b843c749SSergey Zigachev 	uint8_t                             GraphicsVoltageChangeEnable;
304*b843c749SSergey Zigachev 	uint8_t                             GraphicsThermThrottleEnable;
305*b843c749SSergey Zigachev 	uint8_t                             GraphicsInterval;
306*b843c749SSergey Zigachev 
307*b843c749SSergey Zigachev 	uint8_t                             VoltageInterval;
308*b843c749SSergey Zigachev 	uint8_t                             ThermalInterval;
309*b843c749SSergey Zigachev 	uint16_t                            TemperatureLimitHigh;
310*b843c749SSergey Zigachev 
311*b843c749SSergey Zigachev 	uint16_t                            TemperatureLimitLow;
312*b843c749SSergey Zigachev 	uint8_t                             MemoryBootLevel;
313*b843c749SSergey Zigachev 	uint8_t                             MemoryVoltageChangeEnable;
314*b843c749SSergey Zigachev 
315*b843c749SSergey Zigachev 	uint16_t                            BootMVdd;
316*b843c749SSergey Zigachev 	uint8_t                             MemoryInterval;
317*b843c749SSergey Zigachev 	uint8_t                             MemoryThermThrottleEnable;
318*b843c749SSergey Zigachev 
319*b843c749SSergey Zigachev 	uint16_t                            VoltageResponseTime;
320*b843c749SSergey Zigachev 	uint16_t                            PhaseResponseTime;
321*b843c749SSergey Zigachev 
322*b843c749SSergey Zigachev 	uint8_t                             PCIeBootLinkLevel;
323*b843c749SSergey Zigachev 	uint8_t                             PCIeGenInterval;
324*b843c749SSergey Zigachev 	uint8_t                             DTEInterval;
325*b843c749SSergey Zigachev 	uint8_t                             DTEMode;
326*b843c749SSergey Zigachev 
327*b843c749SSergey Zigachev 	uint8_t                             SVI2Enable;
328*b843c749SSergey Zigachev 	uint8_t                             VRHotGpio;
329*b843c749SSergey Zigachev 	uint8_t                             AcDcGpio;
330*b843c749SSergey Zigachev 	uint8_t                             ThermGpio;
331*b843c749SSergey Zigachev 
332*b843c749SSergey Zigachev 	uint16_t                            PPM_PkgPwrLimit;
333*b843c749SSergey Zigachev 	uint16_t                            PPM_TemperatureLimit;
334*b843c749SSergey Zigachev 
335*b843c749SSergey Zigachev 	uint16_t                            DefaultTdp;
336*b843c749SSergey Zigachev 	uint16_t                            TargetTdp;
337*b843c749SSergey Zigachev 
338*b843c749SSergey Zigachev 	uint16_t                            FpsHighThreshold;
339*b843c749SSergey Zigachev 	uint16_t                            FpsLowThreshold;
340*b843c749SSergey Zigachev 
341*b843c749SSergey Zigachev 	uint16_t                            BAPMTI_R[SMU74_DTE_ITERATIONS][SMU74_DTE_SOURCES][SMU74_DTE_SINKS];
342*b843c749SSergey Zigachev 	uint16_t                            BAPMTI_RC[SMU74_DTE_ITERATIONS][SMU74_DTE_SOURCES][SMU74_DTE_SINKS];
343*b843c749SSergey Zigachev 
344*b843c749SSergey Zigachev 	uint16_t                            TemperatureLimitEdge;
345*b843c749SSergey Zigachev 	uint16_t                            TemperatureLimitHotspot;
346*b843c749SSergey Zigachev 
347*b843c749SSergey Zigachev 	uint16_t                            BootVddc;
348*b843c749SSergey Zigachev 	uint16_t                            BootVddci;
349*b843c749SSergey Zigachev 
350*b843c749SSergey Zigachev 	uint16_t                            FanGainEdge;
351*b843c749SSergey Zigachev 	uint16_t                            FanGainHotspot;
352*b843c749SSergey Zigachev 
353*b843c749SSergey Zigachev 	uint32_t                            LowSclkInterruptThreshold;
354*b843c749SSergey Zigachev 	uint32_t                            VddGfxReChkWait;
355*b843c749SSergey Zigachev 
356*b843c749SSergey Zigachev 	uint8_t                             ClockStretcherAmount;
357*b843c749SSergey Zigachev 	uint8_t                             Sclk_CKS_masterEn0_7;
358*b843c749SSergey Zigachev 	uint8_t                             Sclk_CKS_masterEn8_15;
359*b843c749SSergey Zigachev 	uint8_t                             DPMFreezeAndForced;
360*b843c749SSergey Zigachev 
361*b843c749SSergey Zigachev 	uint8_t                             Sclk_voltageOffset[8];
362*b843c749SSergey Zigachev 
363*b843c749SSergey Zigachev 	SMU_ClockStretcherDataTable         ClockStretcherDataTable;
364*b843c749SSergey Zigachev 	SMU_CKS_LOOKUPTable                 CKS_LOOKUPTable;
365*b843c749SSergey Zigachev 
366*b843c749SSergey Zigachev 	uint32_t                            CurrSclkPllRange;
367*b843c749SSergey Zigachev 	sclkFcwRange_t                      SclkFcwRangeTable[NUM_SCLK_RANGE];
368*b843c749SSergey Zigachev 	GB_VDROOP_TABLE_t                   BTCGB_VDROOP_TABLE[BTCGB_VDROOP_TABLE_MAX_ENTRIES];
369*b843c749SSergey Zigachev 	SMU_QuadraticCoeffs                 AVFSGB_VDROOP_TABLE[AVFSGB_VDROOP_TABLE_MAX_ENTRIES];
370*b843c749SSergey Zigachev };
371*b843c749SSergey Zigachev 
372*b843c749SSergey Zigachev typedef struct SMU74_Discrete_DpmTable SMU74_Discrete_DpmTable;
373*b843c749SSergey Zigachev 
374*b843c749SSergey Zigachev 
375*b843c749SSergey Zigachev struct SMU74_Discrete_FanTable {
376*b843c749SSergey Zigachev 	uint16_t FdoMode;
377*b843c749SSergey Zigachev 	int16_t  TempMin;
378*b843c749SSergey Zigachev 	int16_t  TempMed;
379*b843c749SSergey Zigachev 	int16_t  TempMax;
380*b843c749SSergey Zigachev 	int16_t  Slope1;
381*b843c749SSergey Zigachev 	int16_t  Slope2;
382*b843c749SSergey Zigachev 	int16_t  FdoMin;
383*b843c749SSergey Zigachev 	int16_t  HystUp;
384*b843c749SSergey Zigachev 	int16_t  HystDown;
385*b843c749SSergey Zigachev 	int16_t  HystSlope;
386*b843c749SSergey Zigachev 	int16_t  TempRespLim;
387*b843c749SSergey Zigachev 	int16_t  TempCurr;
388*b843c749SSergey Zigachev 	int16_t  SlopeCurr;
389*b843c749SSergey Zigachev 	int16_t  PwmCurr;
390*b843c749SSergey Zigachev 	uint32_t RefreshPeriod;
391*b843c749SSergey Zigachev 	int16_t  FdoMax;
392*b843c749SSergey Zigachev 	uint8_t  TempSrc;
393*b843c749SSergey Zigachev 	int8_t   Padding;
394*b843c749SSergey Zigachev };
395*b843c749SSergey Zigachev 
396*b843c749SSergey Zigachev typedef struct SMU74_Discrete_FanTable SMU74_Discrete_FanTable;
397*b843c749SSergey Zigachev 
398*b843c749SSergey Zigachev #define SMU7_DISCRETE_GPIO_SCLK_DEBUG             4
399*b843c749SSergey Zigachev #define SMU7_DISCRETE_GPIO_SCLK_DEBUG_BIT         (0x1 << SMU7_DISCRETE_GPIO_SCLK_DEBUG)
400*b843c749SSergey Zigachev 
401*b843c749SSergey Zigachev 
402*b843c749SSergey Zigachev struct SMU7_MclkDpmScoreboard {
403*b843c749SSergey Zigachev 	uint32_t PercentageBusy;
404*b843c749SSergey Zigachev 
405*b843c749SSergey Zigachev 	int32_t  PIDError;
406*b843c749SSergey Zigachev 	int32_t  PIDIntegral;
407*b843c749SSergey Zigachev 	int32_t  PIDOutput;
408*b843c749SSergey Zigachev 
409*b843c749SSergey Zigachev 	uint32_t SigmaDeltaAccum;
410*b843c749SSergey Zigachev 	uint32_t SigmaDeltaOutput;
411*b843c749SSergey Zigachev 	uint32_t SigmaDeltaLevel;
412*b843c749SSergey Zigachev 
413*b843c749SSergey Zigachev 	uint32_t UtilizationSetpoint;
414*b843c749SSergey Zigachev 
415*b843c749SSergey Zigachev 	uint8_t  TdpClampMode;
416*b843c749SSergey Zigachev 	uint8_t  TdcClampMode;
417*b843c749SSergey Zigachev 	uint8_t  ThermClampMode;
418*b843c749SSergey Zigachev 	uint8_t  VoltageBusy;
419*b843c749SSergey Zigachev 
420*b843c749SSergey Zigachev 	int8_t   CurrLevel;
421*b843c749SSergey Zigachev 	int8_t   TargLevel;
422*b843c749SSergey Zigachev 	uint8_t  LevelChangeInProgress;
423*b843c749SSergey Zigachev 	uint8_t  UpHyst;
424*b843c749SSergey Zigachev 
425*b843c749SSergey Zigachev 	uint8_t  DownHyst;
426*b843c749SSergey Zigachev 	uint8_t  VoltageDownHyst;
427*b843c749SSergey Zigachev 	uint8_t  DpmEnable;
428*b843c749SSergey Zigachev 	uint8_t  DpmRunning;
429*b843c749SSergey Zigachev 
430*b843c749SSergey Zigachev 	uint8_t  DpmForce;
431*b843c749SSergey Zigachev 	uint8_t  DpmForceLevel;
432*b843c749SSergey Zigachev 	uint8_t  padding2;
433*b843c749SSergey Zigachev 	uint8_t  McArbIndex;
434*b843c749SSergey Zigachev 
435*b843c749SSergey Zigachev 	uint32_t MinimumPerfMclk;
436*b843c749SSergey Zigachev 
437*b843c749SSergey Zigachev 	uint8_t  AcpiReq;
438*b843c749SSergey Zigachev 	uint8_t  AcpiAck;
439*b843c749SSergey Zigachev 	uint8_t  MclkSwitchInProgress;
440*b843c749SSergey Zigachev 	uint8_t  MclkSwitchCritical;
441*b843c749SSergey Zigachev 
442*b843c749SSergey Zigachev 	uint8_t  IgnoreVBlank;
443*b843c749SSergey Zigachev 	uint8_t  TargetMclkIndex;
444*b843c749SSergey Zigachev 	uint16_t VbiFailureCount;
445*b843c749SSergey Zigachev 	uint8_t  VbiWaitCounter;
446*b843c749SSergey Zigachev 	uint8_t  EnabledLevelsChange;
447*b843c749SSergey Zigachev 
448*b843c749SSergey Zigachev 	uint16_t LevelResidencyCounters[SMU74_MAX_LEVELS_MEMORY];
449*b843c749SSergey Zigachev 	uint16_t LevelSwitchCounters[SMU74_MAX_LEVELS_MEMORY];
450*b843c749SSergey Zigachev 
451*b843c749SSergey Zigachev 	void     (*TargetStateCalculator)(uint8_t);
452*b843c749SSergey Zigachev 	void     (*SavedTargetStateCalculator)(uint8_t);
453*b843c749SSergey Zigachev 
454*b843c749SSergey Zigachev 	uint16_t AutoDpmInterval;
455*b843c749SSergey Zigachev 	uint16_t AutoDpmRange;
456*b843c749SSergey Zigachev 
457*b843c749SSergey Zigachev 	uint16_t VbiTimeoutCount;
458*b843c749SSergey Zigachev 	uint16_t MclkSwitchingTime;
459*b843c749SSergey Zigachev 
460*b843c749SSergey Zigachev 	uint8_t  fastSwitch;
461*b843c749SSergey Zigachev 	uint8_t  Save_PIC_VDDGFX_EXIT;
462*b843c749SSergey Zigachev 	uint8_t  Save_PIC_VDDGFX_ENTER;
463*b843c749SSergey Zigachev 	uint8_t  padding;
464*b843c749SSergey Zigachev };
465*b843c749SSergey Zigachev 
466*b843c749SSergey Zigachev typedef struct SMU7_MclkDpmScoreboard SMU7_MclkDpmScoreboard;
467*b843c749SSergey Zigachev 
468*b843c749SSergey Zigachev struct SMU7_UlvScoreboard {
469*b843c749SSergey Zigachev 	uint8_t     EnterUlv;
470*b843c749SSergey Zigachev 	uint8_t     ExitUlv;
471*b843c749SSergey Zigachev 	uint8_t     UlvActive;
472*b843c749SSergey Zigachev 	uint8_t     WaitingForUlv;
473*b843c749SSergey Zigachev 	uint8_t     UlvEnable;
474*b843c749SSergey Zigachev 	uint8_t     UlvRunning;
475*b843c749SSergey Zigachev 	uint8_t     UlvMasterEnable;
476*b843c749SSergey Zigachev 	uint8_t     padding;
477*b843c749SSergey Zigachev 	uint32_t    UlvAbortedCount;
478*b843c749SSergey Zigachev 	uint32_t    UlvTimeStamp;
479*b843c749SSergey Zigachev };
480*b843c749SSergey Zigachev 
481*b843c749SSergey Zigachev typedef struct SMU7_UlvScoreboard SMU7_UlvScoreboard;
482*b843c749SSergey Zigachev 
483*b843c749SSergey Zigachev struct VddgfxSavedRegisters {
484*b843c749SSergey Zigachev 	uint32_t GPU_DBG[3];
485*b843c749SSergey Zigachev 	uint32_t MEC_BaseAddress_Hi;
486*b843c749SSergey Zigachev 	uint32_t MEC_BaseAddress_Lo;
487*b843c749SSergey Zigachev 	uint32_t THM_TMON0_CTRL2__RDIR_PRESENT;
488*b843c749SSergey Zigachev 	uint32_t THM_TMON1_CTRL2__RDIR_PRESENT;
489*b843c749SSergey Zigachev 	uint32_t CP_INT_CNTL;
490*b843c749SSergey Zigachev };
491*b843c749SSergey Zigachev 
492*b843c749SSergey Zigachev typedef struct VddgfxSavedRegisters VddgfxSavedRegisters;
493*b843c749SSergey Zigachev 
494*b843c749SSergey Zigachev struct SMU7_VddGfxScoreboard {
495*b843c749SSergey Zigachev 	uint8_t     VddGfxEnable;
496*b843c749SSergey Zigachev 	uint8_t     VddGfxActive;
497*b843c749SSergey Zigachev 	uint8_t     VPUResetOccured;
498*b843c749SSergey Zigachev 	uint8_t     padding;
499*b843c749SSergey Zigachev 
500*b843c749SSergey Zigachev 	uint32_t    VddGfxEnteredCount;
501*b843c749SSergey Zigachev 	uint32_t    VddGfxAbortedCount;
502*b843c749SSergey Zigachev 
503*b843c749SSergey Zigachev 	uint32_t    VddGfxVid;
504*b843c749SSergey Zigachev 
505*b843c749SSergey Zigachev 	VddgfxSavedRegisters SavedRegisters;
506*b843c749SSergey Zigachev };
507*b843c749SSergey Zigachev 
508*b843c749SSergey Zigachev typedef struct SMU7_VddGfxScoreboard SMU7_VddGfxScoreboard;
509*b843c749SSergey Zigachev 
510*b843c749SSergey Zigachev struct SMU7_TdcLimitScoreboard {
511*b843c749SSergey Zigachev 	uint8_t  Enable;
512*b843c749SSergey Zigachev 	uint8_t  Running;
513*b843c749SSergey Zigachev 	uint16_t Alpha;
514*b843c749SSergey Zigachev 	uint32_t FilteredIddc;
515*b843c749SSergey Zigachev 	uint32_t IddcLimit;
516*b843c749SSergey Zigachev 	uint32_t IddcHyst;
517*b843c749SSergey Zigachev 	SMU7_HystController_Data HystControllerData;
518*b843c749SSergey Zigachev };
519*b843c749SSergey Zigachev 
520*b843c749SSergey Zigachev typedef struct SMU7_TdcLimitScoreboard SMU7_TdcLimitScoreboard;
521*b843c749SSergey Zigachev 
522*b843c749SSergey Zigachev struct SMU7_PkgPwrLimitScoreboard {
523*b843c749SSergey Zigachev 	uint8_t  Enable;
524*b843c749SSergey Zigachev 	uint8_t  Running;
525*b843c749SSergey Zigachev 	uint16_t Alpha;
526*b843c749SSergey Zigachev 	uint32_t FilteredPkgPwr;
527*b843c749SSergey Zigachev 	uint32_t Limit;
528*b843c749SSergey Zigachev 	uint32_t Hyst;
529*b843c749SSergey Zigachev 	uint32_t LimitFromDriver;
530*b843c749SSergey Zigachev 	SMU7_HystController_Data HystControllerData;
531*b843c749SSergey Zigachev };
532*b843c749SSergey Zigachev 
533*b843c749SSergey Zigachev typedef struct SMU7_PkgPwrLimitScoreboard SMU7_PkgPwrLimitScoreboard;
534*b843c749SSergey Zigachev 
535*b843c749SSergey Zigachev struct SMU7_BapmScoreboard {
536*b843c749SSergey Zigachev 	uint32_t source_powers[SMU74_DTE_SOURCES];
537*b843c749SSergey Zigachev 	uint32_t source_powers_last[SMU74_DTE_SOURCES];
538*b843c749SSergey Zigachev 	int32_t entity_temperatures[SMU74_NUM_GPU_TES];
539*b843c749SSergey Zigachev 	int32_t initial_entity_temperatures[SMU74_NUM_GPU_TES];
540*b843c749SSergey Zigachev 	int32_t Limit;
541*b843c749SSergey Zigachev 	int32_t Hyst;
542*b843c749SSergey Zigachev 	int32_t therm_influence_coeff_table[SMU74_DTE_ITERATIONS * SMU74_DTE_SOURCES * SMU74_DTE_SINKS * 2];
543*b843c749SSergey Zigachev 	int32_t therm_node_table[SMU74_DTE_ITERATIONS * SMU74_DTE_SOURCES * SMU74_DTE_SINKS];
544*b843c749SSergey Zigachev 	uint16_t ConfigTDPPowerScalar;
545*b843c749SSergey Zigachev 	uint16_t FanSpeedPowerScalar;
546*b843c749SSergey Zigachev 	uint16_t OverDrivePowerScalar;
547*b843c749SSergey Zigachev 	uint16_t OverDriveLimitScalar;
548*b843c749SSergey Zigachev 	uint16_t FinalPowerScalar;
549*b843c749SSergey Zigachev 	uint8_t VariantID;
550*b843c749SSergey Zigachev 	uint8_t spare997;
551*b843c749SSergey Zigachev 
552*b843c749SSergey Zigachev 	SMU7_HystController_Data HystControllerData;
553*b843c749SSergey Zigachev 
554*b843c749SSergey Zigachev 	int32_t temperature_gradient_slope;
555*b843c749SSergey Zigachev 	int32_t temperature_gradient;
556*b843c749SSergey Zigachev 	uint32_t measured_temperature;
557*b843c749SSergey Zigachev };
558*b843c749SSergey Zigachev 
559*b843c749SSergey Zigachev 
560*b843c749SSergey Zigachev typedef struct SMU7_BapmScoreboard SMU7_BapmScoreboard;
561*b843c749SSergey Zigachev 
562*b843c749SSergey Zigachev struct SMU7_AcpiScoreboard {
563*b843c749SSergey Zigachev 	uint32_t SavedInterruptMask[2];
564*b843c749SSergey Zigachev 	uint8_t LastACPIRequest;
565*b843c749SSergey Zigachev 	uint8_t CgBifResp;
566*b843c749SSergey Zigachev 	uint8_t RequestType;
567*b843c749SSergey Zigachev 	uint8_t Padding;
568*b843c749SSergey Zigachev 	SMU74_Discrete_ACPILevel D0Level;
569*b843c749SSergey Zigachev };
570*b843c749SSergey Zigachev 
571*b843c749SSergey Zigachev typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard;
572*b843c749SSergey Zigachev 
573*b843c749SSergey Zigachev struct SMU74_Discrete_PmFuses {
574*b843c749SSergey Zigachev 	uint8_t BapmVddCVidHiSidd[8];
575*b843c749SSergey Zigachev 	uint8_t BapmVddCVidLoSidd[8];
576*b843c749SSergey Zigachev 	uint8_t VddCVid[8];
577*b843c749SSergey Zigachev 	uint8_t SviLoadLineEn;
578*b843c749SSergey Zigachev 	uint8_t SviLoadLineVddC;
579*b843c749SSergey Zigachev 	uint8_t SviLoadLineTrimVddC;
580*b843c749SSergey Zigachev 	uint8_t SviLoadLineOffsetVddC;
581*b843c749SSergey Zigachev 	uint16_t TDC_VDDC_PkgLimit;
582*b843c749SSergey Zigachev 	uint8_t TDC_VDDC_ThrottleReleaseLimitPerc;
583*b843c749SSergey Zigachev 	uint8_t TDC_MAWt;
584*b843c749SSergey Zigachev 	uint8_t TdcWaterfallCtl;
585*b843c749SSergey Zigachev 	uint8_t LPMLTemperatureMin;
586*b843c749SSergey Zigachev 	uint8_t LPMLTemperatureMax;
587*b843c749SSergey Zigachev 	uint8_t Reserved;
588*b843c749SSergey Zigachev 
589*b843c749SSergey Zigachev 	uint8_t LPMLTemperatureScaler[16];
590*b843c749SSergey Zigachev 
591*b843c749SSergey Zigachev 	int16_t FuzzyFan_ErrorSetDelta;
592*b843c749SSergey Zigachev 	int16_t FuzzyFan_ErrorRateSetDelta;
593*b843c749SSergey Zigachev 	int16_t FuzzyFan_PwmSetDelta;
594*b843c749SSergey Zigachev 	uint16_t Reserved6;
595*b843c749SSergey Zigachev 
596*b843c749SSergey Zigachev 	uint8_t GnbLPML[16];
597*b843c749SSergey Zigachev 
598*b843c749SSergey Zigachev 	uint8_t GnbLPMLMaxVid;
599*b843c749SSergey Zigachev 	uint8_t GnbLPMLMinVid;
600*b843c749SSergey Zigachev 	uint8_t Reserved1[2];
601*b843c749SSergey Zigachev 
602*b843c749SSergey Zigachev 	uint16_t BapmVddCBaseLeakageHiSidd;
603*b843c749SSergey Zigachev 	uint16_t BapmVddCBaseLeakageLoSidd;
604*b843c749SSergey Zigachev 
605*b843c749SSergey Zigachev 	uint16_t  VFT_Temp[3];
606*b843c749SSergey Zigachev 	uint16_t  padding;
607*b843c749SSergey Zigachev 
608*b843c749SSergey Zigachev 	SMU_QuadraticCoeffs VFT_ATE[3];
609*b843c749SSergey Zigachev 
610*b843c749SSergey Zigachev 	SMU_QuadraticCoeffs AVFS_GB;
611*b843c749SSergey Zigachev 	SMU_QuadraticCoeffs ATE_ACBTC_GB;
612*b843c749SSergey Zigachev 
613*b843c749SSergey Zigachev 	SMU_QuadraticCoeffs P2V;
614*b843c749SSergey Zigachev 
615*b843c749SSergey Zigachev 	uint32_t PsmCharzFreq;
616*b843c749SSergey Zigachev 
617*b843c749SSergey Zigachev 	uint16_t InversionVoltage;
618*b843c749SSergey Zigachev 	uint16_t PsmCharzTemp;
619*b843c749SSergey Zigachev 
620*b843c749SSergey Zigachev 	uint32_t EnabledAvfsModules;
621*b843c749SSergey Zigachev };
622*b843c749SSergey Zigachev 
623*b843c749SSergey Zigachev typedef struct SMU74_Discrete_PmFuses SMU74_Discrete_PmFuses;
624*b843c749SSergey Zigachev 
625*b843c749SSergey Zigachev struct SMU7_Discrete_Log_Header_Table {
626*b843c749SSergey Zigachev 	uint32_t    version;
627*b843c749SSergey Zigachev 	uint32_t    asic_id;
628*b843c749SSergey Zigachev 	uint16_t    flags;
629*b843c749SSergey Zigachev 	uint16_t    entry_size;
630*b843c749SSergey Zigachev 	uint32_t    total_size;
631*b843c749SSergey Zigachev 	uint32_t    num_of_entries;
632*b843c749SSergey Zigachev 	uint8_t     type;
633*b843c749SSergey Zigachev 	uint8_t     mode;
634*b843c749SSergey Zigachev 	uint8_t     filler_0[2];
635*b843c749SSergey Zigachev 	uint32_t    filler_1[2];
636*b843c749SSergey Zigachev };
637*b843c749SSergey Zigachev 
638*b843c749SSergey Zigachev typedef struct SMU7_Discrete_Log_Header_Table SMU7_Discrete_Log_Header_Table;
639*b843c749SSergey Zigachev 
640*b843c749SSergey Zigachev struct SMU7_Discrete_Log_Cntl {
641*b843c749SSergey Zigachev 	uint8_t             Enabled;
642*b843c749SSergey Zigachev 	uint8_t             Type;
643*b843c749SSergey Zigachev 	uint8_t             padding[2];
644*b843c749SSergey Zigachev 	uint32_t            BufferSize;
645*b843c749SSergey Zigachev 	uint32_t            SamplesLogged;
646*b843c749SSergey Zigachev 	uint32_t            SampleSize;
647*b843c749SSergey Zigachev 	uint32_t            AddrL;
648*b843c749SSergey Zigachev 	uint32_t            AddrH;
649*b843c749SSergey Zigachev };
650*b843c749SSergey Zigachev 
651*b843c749SSergey Zigachev typedef struct SMU7_Discrete_Log_Cntl SMU7_Discrete_Log_Cntl;
652*b843c749SSergey Zigachev 
653*b843c749SSergey Zigachev #if defined SMU__DGPU_ONLY
654*b843c749SSergey Zigachev #define CAC_ACC_NW_NUM_OF_SIGNALS 87
655*b843c749SSergey Zigachev #endif
656*b843c749SSergey Zigachev 
657*b843c749SSergey Zigachev 
658*b843c749SSergey Zigachev struct SMU7_Discrete_Cac_Collection_Table {
659*b843c749SSergey Zigachev 	uint32_t temperature;
660*b843c749SSergey Zigachev 	uint32_t cac_acc_nw[CAC_ACC_NW_NUM_OF_SIGNALS];
661*b843c749SSergey Zigachev };
662*b843c749SSergey Zigachev 
663*b843c749SSergey Zigachev typedef struct SMU7_Discrete_Cac_Collection_Table SMU7_Discrete_Cac_Collection_Table;
664*b843c749SSergey Zigachev 
665*b843c749SSergey Zigachev struct SMU7_Discrete_Cac_Verification_Table {
666*b843c749SSergey Zigachev 	uint32_t VddcTotalPower;
667*b843c749SSergey Zigachev 	uint32_t VddcLeakagePower;
668*b843c749SSergey Zigachev 	uint32_t VddcConstantPower;
669*b843c749SSergey Zigachev 	uint32_t VddcGfxDynamicPower;
670*b843c749SSergey Zigachev 	uint32_t VddcUvdDynamicPower;
671*b843c749SSergey Zigachev 	uint32_t VddcVceDynamicPower;
672*b843c749SSergey Zigachev 	uint32_t VddcAcpDynamicPower;
673*b843c749SSergey Zigachev 	uint32_t VddcPcieDynamicPower;
674*b843c749SSergey Zigachev 	uint32_t VddcDceDynamicPower;
675*b843c749SSergey Zigachev 	uint32_t VddcCurrent;
676*b843c749SSergey Zigachev 	uint32_t VddcVoltage;
677*b843c749SSergey Zigachev 	uint32_t VddciTotalPower;
678*b843c749SSergey Zigachev 	uint32_t VddciLeakagePower;
679*b843c749SSergey Zigachev 	uint32_t VddciConstantPower;
680*b843c749SSergey Zigachev 	uint32_t VddciDynamicPower;
681*b843c749SSergey Zigachev 	uint32_t Vddr1TotalPower;
682*b843c749SSergey Zigachev 	uint32_t Vddr1LeakagePower;
683*b843c749SSergey Zigachev 	uint32_t Vddr1ConstantPower;
684*b843c749SSergey Zigachev 	uint32_t Vddr1DynamicPower;
685*b843c749SSergey Zigachev 	uint32_t spare[4];
686*b843c749SSergey Zigachev 	uint32_t temperature;
687*b843c749SSergey Zigachev };
688*b843c749SSergey Zigachev 
689*b843c749SSergey Zigachev typedef struct SMU7_Discrete_Cac_Verification_Table SMU7_Discrete_Cac_Verification_Table;
690*b843c749SSergey Zigachev 
691*b843c749SSergey Zigachev struct SMU7_Discrete_Pm_Status_Table {
692*b843c749SSergey Zigachev 	int32_t T_meas_max;
693*b843c749SSergey Zigachev 	int32_t T_meas_acc;
694*b843c749SSergey Zigachev 	int32_t T_calc_max;
695*b843c749SSergey Zigachev 	int32_t T_calc_acc;
696*b843c749SSergey Zigachev 	uint32_t P_scalar_acc;
697*b843c749SSergey Zigachev 	uint32_t P_calc_max;
698*b843c749SSergey Zigachev 	uint32_t P_calc_acc;
699*b843c749SSergey Zigachev 
700*b843c749SSergey Zigachev 	uint32_t I_calc_max;
701*b843c749SSergey Zigachev 	uint32_t I_calc_acc;
702*b843c749SSergey Zigachev 	uint32_t I_calc_acc_vddci;
703*b843c749SSergey Zigachev 	uint32_t V_calc_noload_acc;
704*b843c749SSergey Zigachev 	uint32_t V_calc_load_acc;
705*b843c749SSergey Zigachev 	uint32_t V_calc_noload_acc_vddci;
706*b843c749SSergey Zigachev 	uint32_t P_meas_acc;
707*b843c749SSergey Zigachev 	uint32_t V_meas_noload_acc;
708*b843c749SSergey Zigachev 	uint32_t V_meas_load_acc;
709*b843c749SSergey Zigachev 	uint32_t I_meas_acc;
710*b843c749SSergey Zigachev 	uint32_t P_meas_acc_vddci;
711*b843c749SSergey Zigachev 	uint32_t V_meas_noload_acc_vddci;
712*b843c749SSergey Zigachev 	uint32_t V_meas_load_acc_vddci;
713*b843c749SSergey Zigachev 	uint32_t I_meas_acc_vddci;
714*b843c749SSergey Zigachev 
715*b843c749SSergey Zigachev 	uint16_t Sclk_dpm_residency[8];
716*b843c749SSergey Zigachev 	uint16_t Uvd_dpm_residency[8];
717*b843c749SSergey Zigachev 	uint16_t Vce_dpm_residency[8];
718*b843c749SSergey Zigachev 	uint16_t Mclk_dpm_residency[4];
719*b843c749SSergey Zigachev 
720*b843c749SSergey Zigachev 	uint32_t P_vddci_acc;
721*b843c749SSergey Zigachev 	uint32_t P_vddr1_acc;
722*b843c749SSergey Zigachev 	uint32_t P_nte1_acc;
723*b843c749SSergey Zigachev 	uint32_t PkgPwr_max;
724*b843c749SSergey Zigachev 	uint32_t PkgPwr_acc;
725*b843c749SSergey Zigachev 	uint32_t MclkSwitchingTime_max;
726*b843c749SSergey Zigachev 	uint32_t MclkSwitchingTime_acc;
727*b843c749SSergey Zigachev 	uint32_t FanPwm_acc;
728*b843c749SSergey Zigachev 	uint32_t FanRpm_acc;
729*b843c749SSergey Zigachev 
730*b843c749SSergey Zigachev 	uint32_t AccCnt;
731*b843c749SSergey Zigachev };
732*b843c749SSergey Zigachev 
733*b843c749SSergey Zigachev typedef struct SMU7_Discrete_Pm_Status_Table SMU7_Discrete_Pm_Status_Table;
734*b843c749SSergey Zigachev 
735*b843c749SSergey Zigachev #define SMU7_MAX_GFX_CU_COUNT 16
736*b843c749SSergey Zigachev 
737*b843c749SSergey Zigachev struct SMU7_GfxCuPgScoreboard {
738*b843c749SSergey Zigachev 	uint8_t Enabled;
739*b843c749SSergey Zigachev 	uint8_t WaterfallUp;
740*b843c749SSergey Zigachev 	uint8_t WaterfallDown;
741*b843c749SSergey Zigachev 	uint8_t WaterfallLimit;
742*b843c749SSergey Zigachev 	uint8_t CurrMaxCu;
743*b843c749SSergey Zigachev 	uint8_t TargMaxCu;
744*b843c749SSergey Zigachev 	uint8_t ClampMode;
745*b843c749SSergey Zigachev 	uint8_t Active;
746*b843c749SSergey Zigachev 	uint8_t MaxSupportedCu;
747*b843c749SSergey Zigachev 	uint8_t MinSupportedCu;
748*b843c749SSergey Zigachev 	uint8_t PendingGfxCuHostInterrupt;
749*b843c749SSergey Zigachev 	uint8_t LastFilteredMaxCuInteger;
750*b843c749SSergey Zigachev 	uint16_t FilteredMaxCu;
751*b843c749SSergey Zigachev 	uint16_t FilteredMaxCuAlpha;
752*b843c749SSergey Zigachev 	uint16_t FilterResetCount;
753*b843c749SSergey Zigachev 	uint16_t FilterResetCountLimit;
754*b843c749SSergey Zigachev 	uint8_t ForceCu;
755*b843c749SSergey Zigachev 	uint8_t ForceCuCount;
756*b843c749SSergey Zigachev 	uint8_t spare[2];
757*b843c749SSergey Zigachev };
758*b843c749SSergey Zigachev 
759*b843c749SSergey Zigachev typedef struct SMU7_GfxCuPgScoreboard SMU7_GfxCuPgScoreboard;
760*b843c749SSergey Zigachev 
761*b843c749SSergey Zigachev #define SMU7_SCLK_CAC 0x561
762*b843c749SSergey Zigachev #define SMU7_MCLK_CAC 0xF9
763*b843c749SSergey Zigachev #define SMU7_VCLK_CAC 0x2DE
764*b843c749SSergey Zigachev #define SMU7_DCLK_CAC 0x2DE
765*b843c749SSergey Zigachev #define SMU7_ECLK_CAC 0x25E
766*b843c749SSergey Zigachev #define SMU7_ACLK_CAC 0x25E
767*b843c749SSergey Zigachev #define SMU7_SAMCLK_CAC 0x25E
768*b843c749SSergey Zigachev #define SMU7_DISPCLK_CAC 0x100
769*b843c749SSergey Zigachev #define SMU7_CAC_CONSTANT 0x2EE3430
770*b843c749SSergey Zigachev #define SMU7_CAC_CONSTANT_SHIFT 18
771*b843c749SSergey Zigachev 
772*b843c749SSergey Zigachev #define SMU7_VDDCI_MCLK_CONST        1765
773*b843c749SSergey Zigachev #define SMU7_VDDCI_MCLK_CONST_SHIFT  16
774*b843c749SSergey Zigachev #define SMU7_VDDCI_VDDCI_CONST       50958
775*b843c749SSergey Zigachev #define SMU7_VDDCI_VDDCI_CONST_SHIFT 14
776*b843c749SSergey Zigachev #define SMU7_VDDCI_CONST             11781
777*b843c749SSergey Zigachev #define SMU7_VDDCI_STROBE_PWR        1331
778*b843c749SSergey Zigachev 
779*b843c749SSergey Zigachev #define SMU7_VDDR1_CONST            693
780*b843c749SSergey Zigachev #define SMU7_VDDR1_CAC_WEIGHT       20
781*b843c749SSergey Zigachev #define SMU7_VDDR1_CAC_WEIGHT_SHIFT 19
782*b843c749SSergey Zigachev #define SMU7_VDDR1_STROBE_PWR       512
783*b843c749SSergey Zigachev 
784*b843c749SSergey Zigachev #define SMU7_AREA_COEFF_UVD 0xA78
785*b843c749SSergey Zigachev #define SMU7_AREA_COEFF_VCE 0x190A
786*b843c749SSergey Zigachev #define SMU7_AREA_COEFF_ACP 0x22D1
787*b843c749SSergey Zigachev #define SMU7_AREA_COEFF_SAMU 0x534
788*b843c749SSergey Zigachev 
789*b843c749SSergey Zigachev #define SMU7_THERM_OUT_MODE_DISABLE       0x0
790*b843c749SSergey Zigachev #define SMU7_THERM_OUT_MODE_THERM_ONLY    0x1
791*b843c749SSergey Zigachev #define SMU7_THERM_OUT_MODE_THERM_VRHOT   0x2
792*b843c749SSergey Zigachev 
793*b843c749SSergey Zigachev // DIDT Defines
794*b843c749SSergey Zigachev #define SQ_Enable_MASK 0x1
795*b843c749SSergey Zigachev #define SQ_IR_MASK 0x2
796*b843c749SSergey Zigachev #define SQ_PCC_MASK 0x4
797*b843c749SSergey Zigachev #define SQ_EDC_MASK 0x8
798*b843c749SSergey Zigachev 
799*b843c749SSergey Zigachev #define TCP_Enable_MASK 0x100
800*b843c749SSergey Zigachev #define TCP_IR_MASK 0x200
801*b843c749SSergey Zigachev #define TCP_PCC_MASK 0x400
802*b843c749SSergey Zigachev #define TCP_EDC_MASK 0x800
803*b843c749SSergey Zigachev 
804*b843c749SSergey Zigachev #define TD_Enable_MASK 0x10000
805*b843c749SSergey Zigachev #define TD_IR_MASK 0x20000
806*b843c749SSergey Zigachev #define TD_PCC_MASK 0x40000
807*b843c749SSergey Zigachev #define TD_EDC_MASK 0x80000
808*b843c749SSergey Zigachev 
809*b843c749SSergey Zigachev #define DB_Enable_MASK 0x1000000
810*b843c749SSergey Zigachev #define DB_IR_MASK 0x2000000
811*b843c749SSergey Zigachev #define DB_PCC_MASK 0x4000000
812*b843c749SSergey Zigachev #define DB_EDC_MASK 0x8000000
813*b843c749SSergey Zigachev 
814*b843c749SSergey Zigachev #define SQ_Enable_SHIFT 0
815*b843c749SSergey Zigachev #define SQ_IR_SHIFT 1
816*b843c749SSergey Zigachev #define SQ_PCC_SHIFT 2
817*b843c749SSergey Zigachev #define SQ_EDC_SHIFT 3
818*b843c749SSergey Zigachev 
819*b843c749SSergey Zigachev #define TCP_Enable_SHIFT 8
820*b843c749SSergey Zigachev #define TCP_IR_SHIFT 9
821*b843c749SSergey Zigachev #define TCP_PCC_SHIFT 10
822*b843c749SSergey Zigachev #define TCP_EDC_SHIFT 11
823*b843c749SSergey Zigachev 
824*b843c749SSergey Zigachev #define TD_Enable_SHIFT 16
825*b843c749SSergey Zigachev #define TD_IR_SHIFT 17
826*b843c749SSergey Zigachev #define TD_PCC_SHIFT 18
827*b843c749SSergey Zigachev #define TD_EDC_SHIFT 19
828*b843c749SSergey Zigachev 
829*b843c749SSergey Zigachev #define DB_Enable_SHIFT 24
830*b843c749SSergey Zigachev #define DB_IR_SHIFT 25
831*b843c749SSergey Zigachev #define DB_PCC_SHIFT 26
832*b843c749SSergey Zigachev #define DB_EDC_SHIFT 27
833*b843c749SSergey Zigachev 
834*b843c749SSergey Zigachev #define BTCGB0_Vdroop_Enable_MASK  0x1
835*b843c749SSergey Zigachev #define BTCGB1_Vdroop_Enable_MASK  0x2
836*b843c749SSergey Zigachev #define AVFSGB0_Vdroop_Enable_MASK 0x4
837*b843c749SSergey Zigachev #define AVFSGB1_Vdroop_Enable_MASK 0x8
838*b843c749SSergey Zigachev 
839*b843c749SSergey Zigachev #define BTCGB0_Vdroop_Enable_SHIFT  0
840*b843c749SSergey Zigachev #define BTCGB1_Vdroop_Enable_SHIFT  1
841*b843c749SSergey Zigachev #define AVFSGB0_Vdroop_Enable_SHIFT 2
842*b843c749SSergey Zigachev #define AVFSGB1_Vdroop_Enable_SHIFT 3
843*b843c749SSergey Zigachev 
844*b843c749SSergey Zigachev 
845*b843c749SSergey Zigachev #pragma pack(pop)
846*b843c749SSergey Zigachev 
847*b843c749SSergey Zigachev 
848*b843c749SSergey Zigachev #endif
849*b843c749SSergey Zigachev 
850