xref: /dflybsd-src/sys/dev/drm/amd/powerplay/inc/smu9_driver_if.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2016 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 SMU9_DRIVER_IF_H
25*b843c749SSergey Zigachev #define SMU9_DRIVER_IF_H
26*b843c749SSergey Zigachev 
27*b843c749SSergey Zigachev #include "smu9.h"
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev /**** IMPORTANT ***
30*b843c749SSergey Zigachev  * SMU TEAM: Always increment the interface version if
31*b843c749SSergey Zigachev  * any structure is changed in this file
32*b843c749SSergey Zigachev  */
33*b843c749SSergey Zigachev #define SMU9_DRIVER_IF_VERSION 0xE
34*b843c749SSergey Zigachev 
35*b843c749SSergey Zigachev #define PPTABLE_V10_SMU_VERSION 1
36*b843c749SSergey Zigachev 
37*b843c749SSergey Zigachev #define NUM_GFXCLK_DPM_LEVELS  8
38*b843c749SSergey Zigachev #define NUM_UVD_DPM_LEVELS     8
39*b843c749SSergey Zigachev #define NUM_VCE_DPM_LEVELS     8
40*b843c749SSergey Zigachev #define NUM_MP0CLK_DPM_LEVELS  8
41*b843c749SSergey Zigachev #define NUM_UCLK_DPM_LEVELS    4
42*b843c749SSergey Zigachev #define NUM_SOCCLK_DPM_LEVELS  8
43*b843c749SSergey Zigachev #define NUM_DCEFCLK_DPM_LEVELS 8
44*b843c749SSergey Zigachev #define NUM_LINK_LEVELS        2
45*b843c749SSergey Zigachev 
46*b843c749SSergey Zigachev #define MAX_GFXCLK_DPM_LEVEL  (NUM_GFXCLK_DPM_LEVELS  - 1)
47*b843c749SSergey Zigachev #define MAX_UVD_DPM_LEVEL     (NUM_UVD_DPM_LEVELS     - 1)
48*b843c749SSergey Zigachev #define MAX_VCE_DPM_LEVEL     (NUM_VCE_DPM_LEVELS     - 1)
49*b843c749SSergey Zigachev #define MAX_MP0CLK_DPM_LEVEL  (NUM_MP0CLK_DPM_LEVELS  - 1)
50*b843c749SSergey Zigachev #define MAX_UCLK_DPM_LEVEL    (NUM_UCLK_DPM_LEVELS    - 1)
51*b843c749SSergey Zigachev #define MAX_SOCCLK_DPM_LEVEL  (NUM_SOCCLK_DPM_LEVELS  - 1)
52*b843c749SSergey Zigachev #define MAX_DCEFCLK_DPM_LEVEL (NUM_DCEFCLK_DPM_LEVELS - 1)
53*b843c749SSergey Zigachev #define MAX_LINK_DPM_LEVEL    (NUM_LINK_LEVELS        - 1)
54*b843c749SSergey Zigachev 
55*b843c749SSergey Zigachev #define MIN_GFXCLK_DPM_LEVEL  0
56*b843c749SSergey Zigachev #define MIN_UVD_DPM_LEVEL     0
57*b843c749SSergey Zigachev #define MIN_VCE_DPM_LEVEL     0
58*b843c749SSergey Zigachev #define MIN_MP0CLK_DPM_LEVEL  0
59*b843c749SSergey Zigachev #define MIN_UCLK_DPM_LEVEL    0
60*b843c749SSergey Zigachev #define MIN_SOCCLK_DPM_LEVEL  0
61*b843c749SSergey Zigachev #define MIN_DCEFCLK_DPM_LEVEL 0
62*b843c749SSergey Zigachev #define MIN_LINK_DPM_LEVEL    0
63*b843c749SSergey Zigachev 
64*b843c749SSergey Zigachev #define NUM_EVV_VOLTAGE_LEVELS 8
65*b843c749SSergey Zigachev #define MAX_EVV_VOLTAGE_LEVEL (NUM_EVV_VOLTAGE_LEVELS - 1)
66*b843c749SSergey Zigachev #define MIN_EVV_VOLTAGE_LEVEL 0
67*b843c749SSergey Zigachev 
68*b843c749SSergey Zigachev #define NUM_PSP_LEVEL_MAP 4
69*b843c749SSergey Zigachev 
70*b843c749SSergey Zigachev /* Gemini Modes */
71*b843c749SSergey Zigachev #define PPSMC_GeminiModeNone   0  /* Single GPU board */
72*b843c749SSergey Zigachev #define PPSMC_GeminiModeMaster 1  /* Master GPU on a Gemini board */
73*b843c749SSergey Zigachev #define PPSMC_GeminiModeSlave  2  /* Slave GPU on a Gemini board */
74*b843c749SSergey Zigachev 
75*b843c749SSergey Zigachev /* Voltage Modes for DPMs */
76*b843c749SSergey Zigachev #define VOLTAGE_MODE_AVFS_INTERPOLATE 0
77*b843c749SSergey Zigachev #define VOLTAGE_MODE_AVFS_WORST_CASE  1
78*b843c749SSergey Zigachev #define VOLTAGE_MODE_STATIC           2
79*b843c749SSergey Zigachev 
80*b843c749SSergey Zigachev typedef struct {
81*b843c749SSergey Zigachev   uint32_t FbMult; /* Feedback Multiplier, bit 8:0 int, bit 15:12 post_div, bit 31:16 frac */
82*b843c749SSergey Zigachev   uint32_t SsFbMult; /* Spread FB Mult: bit 8:0 int, bit 31:16 frac */
83*b843c749SSergey Zigachev   uint16_t SsSlewFrac;
84*b843c749SSergey Zigachev   uint8_t  SsOn;
85*b843c749SSergey Zigachev   uint8_t  Did;      /* DID */
86*b843c749SSergey Zigachev } PllSetting_t;
87*b843c749SSergey Zigachev 
88*b843c749SSergey Zigachev typedef struct {
89*b843c749SSergey Zigachev   int32_t a0;
90*b843c749SSergey Zigachev   int32_t a1;
91*b843c749SSergey Zigachev   int32_t a2;
92*b843c749SSergey Zigachev 
93*b843c749SSergey Zigachev   uint8_t a0_shift;
94*b843c749SSergey Zigachev   uint8_t a1_shift;
95*b843c749SSergey Zigachev   uint8_t a2_shift;
96*b843c749SSergey Zigachev   uint8_t padding;
97*b843c749SSergey Zigachev } GbVdroopTable_t;
98*b843c749SSergey Zigachev 
99*b843c749SSergey Zigachev typedef struct {
100*b843c749SSergey Zigachev   int32_t m1;
101*b843c749SSergey Zigachev   int32_t m2;
102*b843c749SSergey Zigachev   int32_t b;
103*b843c749SSergey Zigachev 
104*b843c749SSergey Zigachev   uint8_t m1_shift;
105*b843c749SSergey Zigachev   uint8_t m2_shift;
106*b843c749SSergey Zigachev   uint8_t b_shift;
107*b843c749SSergey Zigachev   uint8_t padding;
108*b843c749SSergey Zigachev } QuadraticInt_t;
109*b843c749SSergey Zigachev 
110*b843c749SSergey Zigachev #define NUM_DSPCLK_LEVELS 8
111*b843c749SSergey Zigachev 
112*b843c749SSergey Zigachev typedef enum {
113*b843c749SSergey Zigachev   DSPCLK_DCEFCLK = 0,
114*b843c749SSergey Zigachev   DSPCLK_DISPCLK,
115*b843c749SSergey Zigachev   DSPCLK_PIXCLK,
116*b843c749SSergey Zigachev   DSPCLK_PHYCLK,
117*b843c749SSergey Zigachev   DSPCLK_COUNT,
118*b843c749SSergey Zigachev } DSPCLK_e;
119*b843c749SSergey Zigachev 
120*b843c749SSergey Zigachev typedef struct {
121*b843c749SSergey Zigachev   uint16_t Freq; /* in MHz */
122*b843c749SSergey Zigachev   uint16_t Vid;  /* min voltage in SVI2 VID */
123*b843c749SSergey Zigachev } DisplayClockTable_t;
124*b843c749SSergey Zigachev 
125*b843c749SSergey Zigachev typedef struct {
126*b843c749SSergey Zigachev   /* PowerTune */
127*b843c749SSergey Zigachev   uint16_t SocketPowerLimit; /* Watts */
128*b843c749SSergey Zigachev   uint16_t TdcLimit;         /* Amps */
129*b843c749SSergey Zigachev   uint16_t EdcLimit;         /* Amps */
130*b843c749SSergey Zigachev   uint16_t TedgeLimit;       /* Celcius */
131*b843c749SSergey Zigachev   uint16_t ThotspotLimit;    /* Celcius */
132*b843c749SSergey Zigachev   uint16_t ThbmLimit;        /* Celcius */
133*b843c749SSergey Zigachev   uint16_t Tvr_socLimit;     /* Celcius */
134*b843c749SSergey Zigachev   uint16_t Tvr_memLimit;     /* Celcius */
135*b843c749SSergey Zigachev   uint16_t Tliquid1Limit;    /* Celcius */
136*b843c749SSergey Zigachev   uint16_t Tliquid2Limit;    /* Celcius */
137*b843c749SSergey Zigachev   uint16_t TplxLimit;        /* Celcius */
138*b843c749SSergey Zigachev   uint16_t LoadLineResistance; /* in mOhms */
139*b843c749SSergey Zigachev   uint32_t FitLimit;         /* Failures in time (failures per million parts over the defined lifetime) */
140*b843c749SSergey Zigachev 
141*b843c749SSergey Zigachev   /* External Component Communication Settings */
142*b843c749SSergey Zigachev   uint8_t  Liquid1_I2C_address;
143*b843c749SSergey Zigachev   uint8_t  Liquid2_I2C_address;
144*b843c749SSergey Zigachev   uint8_t  Vr_I2C_address;
145*b843c749SSergey Zigachev   uint8_t  Plx_I2C_address;
146*b843c749SSergey Zigachev 
147*b843c749SSergey Zigachev   uint8_t  GeminiMode;
148*b843c749SSergey Zigachev   uint8_t  spare17[3];
149*b843c749SSergey Zigachev   uint32_t GeminiApertureHigh;
150*b843c749SSergey Zigachev   uint32_t GeminiApertureLow;
151*b843c749SSergey Zigachev 
152*b843c749SSergey Zigachev   uint8_t  Liquid_I2C_LineSCL;
153*b843c749SSergey Zigachev   uint8_t  Liquid_I2C_LineSDA;
154*b843c749SSergey Zigachev   uint8_t  Vr_I2C_LineSCL;
155*b843c749SSergey Zigachev   uint8_t  Vr_I2C_LineSDA;
156*b843c749SSergey Zigachev   uint8_t  Plx_I2C_LineSCL;
157*b843c749SSergey Zigachev   uint8_t  Plx_I2C_LineSDA;
158*b843c749SSergey Zigachev   uint8_t  paddingx[2];
159*b843c749SSergey Zigachev 
160*b843c749SSergey Zigachev   /* ULV Settings */
161*b843c749SSergey Zigachev   uint8_t  UlvOffsetVid;     /* SVI2 VID */
162*b843c749SSergey Zigachev   uint8_t  UlvSmnclkDid;     /* DID for ULV mode. 0 means CLK will not be modified in ULV. */
163*b843c749SSergey Zigachev   uint8_t  UlvMp1clkDid;     /* DID for ULV mode. 0 means CLK will not be modified in ULV. */
164*b843c749SSergey Zigachev   uint8_t  UlvGfxclkBypass;  /* 1 to turn off/bypass Gfxclk during ULV, 0 to leave Gfxclk on during ULV */
165*b843c749SSergey Zigachev 
166*b843c749SSergey Zigachev   /* VDDCR_SOC Voltages */
167*b843c749SSergey Zigachev   uint8_t      SocVid[NUM_EVV_VOLTAGE_LEVELS];
168*b843c749SSergey Zigachev 
169*b843c749SSergey Zigachev   /* This is the minimum voltage needed to run the SOC. */
170*b843c749SSergey Zigachev   uint8_t      MinVoltageVid; /* Minimum Voltage ("Vmin") of ASIC */
171*b843c749SSergey Zigachev   uint8_t      MaxVoltageVid; /* Maximum Voltage allowable */
172*b843c749SSergey Zigachev   uint8_t      MaxVidStep; /* Max VID step that SMU will request. Multiple steps are taken if voltage change exceeds this value. */
173*b843c749SSergey Zigachev   uint8_t      padding8;
174*b843c749SSergey Zigachev 
175*b843c749SSergey Zigachev   uint8_t      UlvPhaseSheddingPsi0; /* set this to 1 to set PSI0/1 to 1 in ULV mode */
176*b843c749SSergey Zigachev   uint8_t      UlvPhaseSheddingPsi1; /* set this to 1 to set PSI0/1 to 1 in ULV mode */
177*b843c749SSergey Zigachev   uint8_t      padding8_2[2];
178*b843c749SSergey Zigachev 
179*b843c749SSergey Zigachev   /* SOC Frequencies */
180*b843c749SSergey Zigachev   PllSetting_t GfxclkLevel        [NUM_GFXCLK_DPM_LEVELS];
181*b843c749SSergey Zigachev 
182*b843c749SSergey Zigachev   uint8_t      SocclkDid          [NUM_SOCCLK_DPM_LEVELS];          /* DID */
183*b843c749SSergey Zigachev   uint8_t      SocDpmVoltageIndex [NUM_SOCCLK_DPM_LEVELS];
184*b843c749SSergey Zigachev 
185*b843c749SSergey Zigachev   uint8_t      VclkDid            [NUM_UVD_DPM_LEVELS];            /* DID */
186*b843c749SSergey Zigachev   uint8_t      DclkDid            [NUM_UVD_DPM_LEVELS];            /* DID */
187*b843c749SSergey Zigachev   uint8_t      UvdDpmVoltageIndex [NUM_UVD_DPM_LEVELS];
188*b843c749SSergey Zigachev 
189*b843c749SSergey Zigachev   uint8_t      EclkDid            [NUM_VCE_DPM_LEVELS];            /* DID */
190*b843c749SSergey Zigachev   uint8_t      VceDpmVoltageIndex [NUM_VCE_DPM_LEVELS];
191*b843c749SSergey Zigachev 
192*b843c749SSergey Zigachev   uint8_t      Mp0clkDid          [NUM_MP0CLK_DPM_LEVELS];          /* DID */
193*b843c749SSergey Zigachev   uint8_t      Mp0DpmVoltageIndex [NUM_MP0CLK_DPM_LEVELS];
194*b843c749SSergey Zigachev 
195*b843c749SSergey Zigachev   DisplayClockTable_t DisplayClockTable[DSPCLK_COUNT][NUM_DSPCLK_LEVELS];
196*b843c749SSergey Zigachev   QuadraticInt_t      DisplayClock2Gfxclk[DSPCLK_COUNT];
197*b843c749SSergey Zigachev 
198*b843c749SSergey Zigachev   uint8_t      GfxDpmVoltageMode;
199*b843c749SSergey Zigachev   uint8_t      SocDpmVoltageMode;
200*b843c749SSergey Zigachev   uint8_t      UclkDpmVoltageMode;
201*b843c749SSergey Zigachev   uint8_t      UvdDpmVoltageMode;
202*b843c749SSergey Zigachev 
203*b843c749SSergey Zigachev   uint8_t      VceDpmVoltageMode;
204*b843c749SSergey Zigachev   uint8_t      Mp0DpmVoltageMode;
205*b843c749SSergey Zigachev   uint8_t      DisplayDpmVoltageMode;
206*b843c749SSergey Zigachev   uint8_t      padding8_3;
207*b843c749SSergey Zigachev 
208*b843c749SSergey Zigachev   uint16_t     GfxclkSlewRate;
209*b843c749SSergey Zigachev   uint16_t     padding;
210*b843c749SSergey Zigachev 
211*b843c749SSergey Zigachev   uint32_t     LowGfxclkInterruptThreshold;  /* in units of 10KHz */
212*b843c749SSergey Zigachev 
213*b843c749SSergey Zigachev   /* Alpha parameters for clock averages. ("255"=1) */
214*b843c749SSergey Zigachev   uint8_t      GfxclkAverageAlpha;
215*b843c749SSergey Zigachev   uint8_t      SocclkAverageAlpha;
216*b843c749SSergey Zigachev   uint8_t      UclkAverageAlpha;
217*b843c749SSergey Zigachev   uint8_t      GfxActivityAverageAlpha;
218*b843c749SSergey Zigachev 
219*b843c749SSergey Zigachev   /* UCLK States */
220*b843c749SSergey Zigachev   uint8_t      MemVid[NUM_UCLK_DPM_LEVELS];    /* VID */
221*b843c749SSergey Zigachev   PllSetting_t UclkLevel[NUM_UCLK_DPM_LEVELS];   /* Full PLL settings */
222*b843c749SSergey Zigachev   uint8_t      MemSocVoltageIndex[NUM_UCLK_DPM_LEVELS];
223*b843c749SSergey Zigachev   uint8_t      LowestUclkReservedForUlv; /* Set this to 1 if UCLK DPM0 is reserved for ULV-mode only */
224*b843c749SSergey Zigachev   uint8_t      paddingUclk[3];
225*b843c749SSergey Zigachev   uint16_t     NumMemoryChannels;  /* Used for memory bandwidth calculations */
226*b843c749SSergey Zigachev   uint16_t     MemoryChannelWidth; /* Used for memory bandwidth calculations */
227*b843c749SSergey Zigachev 
228*b843c749SSergey Zigachev   /* CKS Settings */
229*b843c749SSergey Zigachev   uint8_t      CksEnable[NUM_GFXCLK_DPM_LEVELS];
230*b843c749SSergey Zigachev   uint8_t      CksVidOffset[NUM_GFXCLK_DPM_LEVELS];
231*b843c749SSergey Zigachev 
232*b843c749SSergey Zigachev   /* MP0 Mapping Table */
233*b843c749SSergey Zigachev   uint8_t      PspLevelMap[NUM_PSP_LEVEL_MAP];
234*b843c749SSergey Zigachev 
235*b843c749SSergey Zigachev   /* Link DPM Settings */
236*b843c749SSergey Zigachev   uint8_t     PcieGenSpeed[NUM_LINK_LEVELS];           /* 0:PciE-gen1 1:PciE-gen2 2:PciE-gen3 */
237*b843c749SSergey Zigachev   uint8_t     PcieLaneCount[NUM_LINK_LEVELS];          /* 1=x1, 2=x2, 3=x4, 4=x8, 5=x12, 6=x16 */
238*b843c749SSergey Zigachev   uint8_t     LclkDid[NUM_LINK_LEVELS];                /* Leave at 0 to use hardcoded values in FW */
239*b843c749SSergey Zigachev   uint8_t     paddingLinkDpm[2];
240*b843c749SSergey Zigachev 
241*b843c749SSergey Zigachev   /* Fan Control */
242*b843c749SSergey Zigachev   uint16_t     FanStopTemp;          /* Celcius */
243*b843c749SSergey Zigachev   uint16_t     FanStartTemp;         /* Celcius */
244*b843c749SSergey Zigachev 
245*b843c749SSergey Zigachev   uint16_t     FanGainEdge;
246*b843c749SSergey Zigachev   uint16_t     FanGainHotspot;
247*b843c749SSergey Zigachev   uint16_t     FanGainLiquid;
248*b843c749SSergey Zigachev   uint16_t     FanGainVrVddc;
249*b843c749SSergey Zigachev   uint16_t     FanGainVrMvdd;
250*b843c749SSergey Zigachev   uint16_t     FanGainPlx;
251*b843c749SSergey Zigachev   uint16_t     FanGainHbm;
252*b843c749SSergey Zigachev   uint16_t     FanPwmMin;
253*b843c749SSergey Zigachev   uint16_t     FanAcousticLimitRpm;
254*b843c749SSergey Zigachev   uint16_t     FanThrottlingRpm;
255*b843c749SSergey Zigachev   uint16_t     FanMaximumRpm;
256*b843c749SSergey Zigachev   uint16_t     FanTargetTemperature;
257*b843c749SSergey Zigachev   uint16_t     FanTargetGfxclk;
258*b843c749SSergey Zigachev   uint8_t      FanZeroRpmEnable;
259*b843c749SSergey Zigachev   uint8_t      FanSpare;
260*b843c749SSergey Zigachev 
261*b843c749SSergey Zigachev   /* The following are AFC override parameters. Leave at 0 to use FW defaults. */
262*b843c749SSergey Zigachev   int16_t      FuzzyFan_ErrorSetDelta;
263*b843c749SSergey Zigachev   int16_t      FuzzyFan_ErrorRateSetDelta;
264*b843c749SSergey Zigachev   int16_t      FuzzyFan_PwmSetDelta;
265*b843c749SSergey Zigachev   uint16_t     FuzzyFan_Reserved;
266*b843c749SSergey Zigachev 
267*b843c749SSergey Zigachev   /* GPIO Settings */
268*b843c749SSergey Zigachev   uint8_t      AcDcGpio;        /* GPIO pin configured for AC/DC switching */
269*b843c749SSergey Zigachev   uint8_t      AcDcPolarity;    /* GPIO polarity for AC/DC switching */
270*b843c749SSergey Zigachev   uint8_t      VR0HotGpio;      /* GPIO pin configured for VR0 HOT event */
271*b843c749SSergey Zigachev   uint8_t      VR0HotPolarity;  /* GPIO polarity for VR0 HOT event */
272*b843c749SSergey Zigachev   uint8_t      VR1HotGpio;      /* GPIO pin configured for VR1 HOT event */
273*b843c749SSergey Zigachev   uint8_t      VR1HotPolarity;  /* GPIO polarity for VR1 HOT event */
274*b843c749SSergey Zigachev   uint8_t      Padding1;       /* replace GPIO pin configured for CTF */
275*b843c749SSergey Zigachev   uint8_t      Padding2;       /* replace GPIO polarity for CTF */
276*b843c749SSergey Zigachev 
277*b843c749SSergey Zigachev   /* LED Display Settings */
278*b843c749SSergey Zigachev   uint8_t      LedPin0;         /* GPIO number for LedPin[0] */
279*b843c749SSergey Zigachev   uint8_t      LedPin1;         /* GPIO number for LedPin[1] */
280*b843c749SSergey Zigachev   uint8_t      LedPin2;         /* GPIO number for LedPin[2] */
281*b843c749SSergey Zigachev   uint8_t      padding8_4;
282*b843c749SSergey Zigachev 
283*b843c749SSergey Zigachev   /* AVFS */
284*b843c749SSergey Zigachev   uint8_t      OverrideBtcGbCksOn;
285*b843c749SSergey Zigachev   uint8_t      OverrideAvfsGbCksOn;
286*b843c749SSergey Zigachev   uint8_t      PaddingAvfs8[2];
287*b843c749SSergey Zigachev 
288*b843c749SSergey Zigachev   GbVdroopTable_t BtcGbVdroopTableCksOn;
289*b843c749SSergey Zigachev   GbVdroopTable_t BtcGbVdroopTableCksOff;
290*b843c749SSergey Zigachev 
291*b843c749SSergey Zigachev   QuadraticInt_t  AvfsGbCksOn;  /* Replacement equation */
292*b843c749SSergey Zigachev   QuadraticInt_t  AvfsGbCksOff; /* Replacement equation */
293*b843c749SSergey Zigachev 
294*b843c749SSergey Zigachev   uint8_t      StaticVoltageOffsetVid[NUM_GFXCLK_DPM_LEVELS]; /* This values are added on to the final voltage calculation */
295*b843c749SSergey Zigachev 
296*b843c749SSergey Zigachev   /* Ageing Guardband Parameters */
297*b843c749SSergey Zigachev   uint32_t     AConstant[3];
298*b843c749SSergey Zigachev   uint16_t     DC_tol_sigma;
299*b843c749SSergey Zigachev   uint16_t     Platform_mean;
300*b843c749SSergey Zigachev   uint16_t     Platform_sigma;
301*b843c749SSergey Zigachev   uint16_t     PSM_Age_CompFactor;
302*b843c749SSergey Zigachev 
303*b843c749SSergey Zigachev   uint32_t     DpmLevelPowerDelta;
304*b843c749SSergey Zigachev 
305*b843c749SSergey Zigachev   uint8_t      EnableBoostState;
306*b843c749SSergey Zigachev   uint8_t      AConstant_Shift;
307*b843c749SSergey Zigachev   uint8_t      DC_tol_sigma_Shift;
308*b843c749SSergey Zigachev   uint8_t      PSM_Age_CompFactor_Shift;
309*b843c749SSergey Zigachev 
310*b843c749SSergey Zigachev   uint16_t     BoostStartTemperature;
311*b843c749SSergey Zigachev   uint16_t     BoostStopTemperature;
312*b843c749SSergey Zigachev 
313*b843c749SSergey Zigachev   PllSetting_t GfxBoostState;
314*b843c749SSergey Zigachev 
315*b843c749SSergey Zigachev   uint8_t      AcgEnable[NUM_GFXCLK_DPM_LEVELS];
316*b843c749SSergey Zigachev   GbVdroopTable_t AcgBtcGbVdroopTable;
317*b843c749SSergey Zigachev   QuadraticInt_t  AcgAvfsGb;
318*b843c749SSergey Zigachev 
319*b843c749SSergey Zigachev   /* ACG Frequency Table, in Mhz */
320*b843c749SSergey Zigachev   uint32_t     AcgFreqTable[NUM_GFXCLK_DPM_LEVELS];
321*b843c749SSergey Zigachev 
322*b843c749SSergey Zigachev   /* Padding - ignore */
323*b843c749SSergey Zigachev   uint32_t     MmHubPadding[3]; /* SMU internal use */
324*b843c749SSergey Zigachev 
325*b843c749SSergey Zigachev } PPTable_t;
326*b843c749SSergey Zigachev 
327*b843c749SSergey Zigachev typedef struct {
328*b843c749SSergey Zigachev   uint16_t MinClock; // This is either DCEFCLK or SOCCLK (in MHz)
329*b843c749SSergey Zigachev   uint16_t MaxClock; // This is either DCEFCLK or SOCCLK (in MHz)
330*b843c749SSergey Zigachev   uint16_t MinUclk;
331*b843c749SSergey Zigachev   uint16_t MaxUclk;
332*b843c749SSergey Zigachev 
333*b843c749SSergey Zigachev   uint8_t  WmSetting;
334*b843c749SSergey Zigachev   uint8_t  Padding[3];
335*b843c749SSergey Zigachev } WatermarkRowGeneric_t;
336*b843c749SSergey Zigachev 
337*b843c749SSergey Zigachev #define NUM_WM_RANGES 4
338*b843c749SSergey Zigachev 
339*b843c749SSergey Zigachev typedef enum {
340*b843c749SSergey Zigachev   WM_SOCCLK = 0,
341*b843c749SSergey Zigachev   WM_DCEFCLK,
342*b843c749SSergey Zigachev   WM_COUNT,
343*b843c749SSergey Zigachev } WM_CLOCK_e;
344*b843c749SSergey Zigachev 
345*b843c749SSergey Zigachev typedef struct {
346*b843c749SSergey Zigachev   /* Watermarks */
347*b843c749SSergey Zigachev   WatermarkRowGeneric_t WatermarkRow[WM_COUNT][NUM_WM_RANGES];
348*b843c749SSergey Zigachev 
349*b843c749SSergey Zigachev   uint32_t     MmHubPadding[7]; /* SMU internal use */
350*b843c749SSergey Zigachev } Watermarks_t;
351*b843c749SSergey Zigachev 
352*b843c749SSergey Zigachev #ifdef PPTABLE_V10_SMU_VERSION
353*b843c749SSergey Zigachev typedef struct {
354*b843c749SSergey Zigachev   float        AvfsGbCksOn[NUM_GFXCLK_DPM_LEVELS];
355*b843c749SSergey Zigachev   float        AcBtcGbCksOn[NUM_GFXCLK_DPM_LEVELS];
356*b843c749SSergey Zigachev   float        AvfsGbCksOff[NUM_GFXCLK_DPM_LEVELS];
357*b843c749SSergey Zigachev   float        AcBtcGbCksOff[NUM_GFXCLK_DPM_LEVELS];
358*b843c749SSergey Zigachev   float        DcBtcGb;
359*b843c749SSergey Zigachev 
360*b843c749SSergey Zigachev   uint32_t     MmHubPadding[7]; /* SMU internal use */
361*b843c749SSergey Zigachev } AvfsTable_t;
362*b843c749SSergey Zigachev #else
363*b843c749SSergey Zigachev typedef struct {
364*b843c749SSergey Zigachev   uint32_t     AvfsGbCksOn[NUM_GFXCLK_DPM_LEVELS];
365*b843c749SSergey Zigachev   uint32_t     AcBtcGbCksOn[NUM_GFXCLK_DPM_LEVELS];
366*b843c749SSergey Zigachev   uint32_t     AvfsGbCksOff[NUM_GFXCLK_DPM_LEVELS];
367*b843c749SSergey Zigachev   uint32_t     AcBtcGbCksOff[NUM_GFXCLK_DPM_LEVELS];
368*b843c749SSergey Zigachev   uint32_t     DcBtcGb;
369*b843c749SSergey Zigachev 
370*b843c749SSergey Zigachev   uint32_t     MmHubPadding[7]; /* SMU internal use */
371*b843c749SSergey Zigachev } AvfsTable_t;
372*b843c749SSergey Zigachev #endif
373*b843c749SSergey Zigachev 
374*b843c749SSergey Zigachev typedef struct {
375*b843c749SSergey Zigachev   uint16_t avgPsmCount[30];
376*b843c749SSergey Zigachev   uint16_t minPsmCount[30];
377*b843c749SSergey Zigachev   float    avgPsmVoltage[30];
378*b843c749SSergey Zigachev   float    minPsmVoltage[30];
379*b843c749SSergey Zigachev 
380*b843c749SSergey Zigachev   uint32_t MmHubPadding[7]; /* SMU internal use */
381*b843c749SSergey Zigachev } AvfsDebugTable_t;
382*b843c749SSergey Zigachev 
383*b843c749SSergey Zigachev typedef struct {
384*b843c749SSergey Zigachev   uint8_t  AvfsEn;
385*b843c749SSergey Zigachev   uint8_t  AvfsVersion;
386*b843c749SSergey Zigachev   uint8_t  Padding[2];
387*b843c749SSergey Zigachev 
388*b843c749SSergey Zigachev   int32_t VFT0_m1; /* Q8.24 */
389*b843c749SSergey Zigachev   int32_t VFT0_m2; /* Q12.12 */
390*b843c749SSergey Zigachev   int32_t VFT0_b;  /* Q32 */
391*b843c749SSergey Zigachev 
392*b843c749SSergey Zigachev   int32_t VFT1_m1; /* Q8.16 */
393*b843c749SSergey Zigachev   int32_t VFT1_m2; /* Q12.12 */
394*b843c749SSergey Zigachev   int32_t VFT1_b;  /* Q32 */
395*b843c749SSergey Zigachev 
396*b843c749SSergey Zigachev   int32_t VFT2_m1; /* Q8.16 */
397*b843c749SSergey Zigachev   int32_t VFT2_m2; /* Q12.12 */
398*b843c749SSergey Zigachev   int32_t VFT2_b;  /* Q32 */
399*b843c749SSergey Zigachev 
400*b843c749SSergey Zigachev   int32_t AvfsGb0_m1; /* Q8.16 */
401*b843c749SSergey Zigachev   int32_t AvfsGb0_m2; /* Q12.12 */
402*b843c749SSergey Zigachev   int32_t AvfsGb0_b;  /* Q32 */
403*b843c749SSergey Zigachev 
404*b843c749SSergey Zigachev   int32_t AcBtcGb_m1; /* Q8.24 */
405*b843c749SSergey Zigachev   int32_t AcBtcGb_m2; /* Q12.12 */
406*b843c749SSergey Zigachev   int32_t AcBtcGb_b;  /* Q32 */
407*b843c749SSergey Zigachev 
408*b843c749SSergey Zigachev   uint32_t AvfsTempCold;
409*b843c749SSergey Zigachev   uint32_t AvfsTempMid;
410*b843c749SSergey Zigachev   uint32_t AvfsTempHot;
411*b843c749SSergey Zigachev 
412*b843c749SSergey Zigachev   uint32_t InversionVoltage; /*  in mV with 2 fractional bits */
413*b843c749SSergey Zigachev 
414*b843c749SSergey Zigachev   int32_t P2V_m1; /* Q8.24 */
415*b843c749SSergey Zigachev   int32_t P2V_m2; /* Q12.12 */
416*b843c749SSergey Zigachev   int32_t P2V_b;  /* Q32 */
417*b843c749SSergey Zigachev 
418*b843c749SSergey Zigachev   uint32_t P2VCharzFreq; /* in 10KHz units */
419*b843c749SSergey Zigachev 
420*b843c749SSergey Zigachev   uint32_t EnabledAvfsModules;
421*b843c749SSergey Zigachev 
422*b843c749SSergey Zigachev   uint32_t MmHubPadding[7]; /* SMU internal use */
423*b843c749SSergey Zigachev } AvfsFuseOverride_t;
424*b843c749SSergey Zigachev 
425*b843c749SSergey Zigachev /* These defines are used with the following messages:
426*b843c749SSergey Zigachev  * SMC_MSG_TransferTableDram2Smu
427*b843c749SSergey Zigachev  * SMC_MSG_TransferTableSmu2Dram
428*b843c749SSergey Zigachev  */
429*b843c749SSergey Zigachev #define TABLE_PPTABLE            0
430*b843c749SSergey Zigachev #define TABLE_WATERMARKS         1
431*b843c749SSergey Zigachev #define TABLE_AVFS               2
432*b843c749SSergey Zigachev #define TABLE_AVFS_PSM_DEBUG     3
433*b843c749SSergey Zigachev #define TABLE_AVFS_FUSE_OVERRIDE 4
434*b843c749SSergey Zigachev #define TABLE_PMSTATUSLOG        5
435*b843c749SSergey Zigachev #define TABLE_COUNT              6
436*b843c749SSergey Zigachev 
437*b843c749SSergey Zigachev /* These defines are used with the SMC_MSG_SetUclkFastSwitch message. */
438*b843c749SSergey Zigachev #define UCLK_SWITCH_SLOW 0
439*b843c749SSergey Zigachev #define UCLK_SWITCH_FAST 1
440*b843c749SSergey Zigachev 
441*b843c749SSergey Zigachev /* GFX DIDT Configuration */
442*b843c749SSergey Zigachev #define SQ_Enable_MASK 0x1
443*b843c749SSergey Zigachev #define SQ_IR_MASK 0x2
444*b843c749SSergey Zigachev #define SQ_PCC_MASK 0x4
445*b843c749SSergey Zigachev #define SQ_EDC_MASK 0x8
446*b843c749SSergey Zigachev 
447*b843c749SSergey Zigachev #define TCP_Enable_MASK 0x100
448*b843c749SSergey Zigachev #define TCP_IR_MASK 0x200
449*b843c749SSergey Zigachev #define TCP_PCC_MASK 0x400
450*b843c749SSergey Zigachev #define TCP_EDC_MASK 0x800
451*b843c749SSergey Zigachev 
452*b843c749SSergey Zigachev #define TD_Enable_MASK 0x10000
453*b843c749SSergey Zigachev #define TD_IR_MASK 0x20000
454*b843c749SSergey Zigachev #define TD_PCC_MASK 0x40000
455*b843c749SSergey Zigachev #define TD_EDC_MASK 0x80000
456*b843c749SSergey Zigachev 
457*b843c749SSergey Zigachev #define DB_Enable_MASK 0x1000000
458*b843c749SSergey Zigachev #define DB_IR_MASK 0x2000000
459*b843c749SSergey Zigachev #define DB_PCC_MASK 0x4000000
460*b843c749SSergey Zigachev #define DB_EDC_MASK 0x8000000
461*b843c749SSergey Zigachev 
462*b843c749SSergey Zigachev #define SQ_Enable_SHIFT 0
463*b843c749SSergey Zigachev #define SQ_IR_SHIFT 1
464*b843c749SSergey Zigachev #define SQ_PCC_SHIFT 2
465*b843c749SSergey Zigachev #define SQ_EDC_SHIFT 3
466*b843c749SSergey Zigachev 
467*b843c749SSergey Zigachev #define TCP_Enable_SHIFT 8
468*b843c749SSergey Zigachev #define TCP_IR_SHIFT 9
469*b843c749SSergey Zigachev #define TCP_PCC_SHIFT 10
470*b843c749SSergey Zigachev #define TCP_EDC_SHIFT 11
471*b843c749SSergey Zigachev 
472*b843c749SSergey Zigachev #define TD_Enable_SHIFT 16
473*b843c749SSergey Zigachev #define TD_IR_SHIFT 17
474*b843c749SSergey Zigachev #define TD_PCC_SHIFT 18
475*b843c749SSergey Zigachev #define TD_EDC_SHIFT 19
476*b843c749SSergey Zigachev 
477*b843c749SSergey Zigachev #define DB_Enable_SHIFT 24
478*b843c749SSergey Zigachev #define DB_IR_SHIFT 25
479*b843c749SSergey Zigachev #define DB_PCC_SHIFT 26
480*b843c749SSergey Zigachev #define DB_EDC_SHIFT 27
481*b843c749SSergey Zigachev 
482*b843c749SSergey Zigachev #define REMOVE_FMAX_MARGIN_BIT     0x0
483*b843c749SSergey Zigachev #define REMOVE_DCTOL_MARGIN_BIT    0x1
484*b843c749SSergey Zigachev #define REMOVE_PLATFORM_MARGIN_BIT 0x2
485*b843c749SSergey Zigachev 
486*b843c749SSergey Zigachev #endif
487