Merge tag 'powerpc-6.0-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[platform/kernel/linux-rpi.git] / drivers / gpu / drm / amd / pm / swsmu / inc / pmfw_if / smu13_driver_if_v13_0_0.h
1 /*
2  * Copyright 2021 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23
24 #ifndef SMU13_DRIVER_IF_V13_0_0_H
25 #define SMU13_DRIVER_IF_V13_0_0_H
26
27 //Increment this version if SkuTable_t or BoardTable_t change
28 #define PPTABLE_VERSION 0x24
29
30 #define NUM_GFXCLK_DPM_LEVELS    16
31 #define NUM_SOCCLK_DPM_LEVELS    8
32 #define NUM_MP0CLK_DPM_LEVELS    2
33 #define NUM_DCLK_DPM_LEVELS      8
34 #define NUM_VCLK_DPM_LEVELS      8
35 #define NUM_DISPCLK_DPM_LEVELS   8
36 #define NUM_DPPCLK_DPM_LEVELS    8
37 #define NUM_DPREFCLK_DPM_LEVELS  8
38 #define NUM_DCFCLK_DPM_LEVELS    8
39 #define NUM_DTBCLK_DPM_LEVELS    8
40 #define NUM_UCLK_DPM_LEVELS      4
41 #define NUM_LINK_LEVELS          3
42 #define NUM_FCLK_DPM_LEVELS      8
43 #define NUM_OD_FAN_MAX_POINTS    6
44
45 // Feature Control Defines
46 #define FEATURE_FW_DATA_READ_BIT              0
47 #define FEATURE_DPM_GFXCLK_BIT                1
48 #define FEATURE_DPM_GFX_POWER_OPTIMIZER_BIT   2
49 #define FEATURE_DPM_UCLK_BIT                  3
50 #define FEATURE_DPM_FCLK_BIT                  4
51 #define FEATURE_DPM_SOCCLK_BIT                5
52 #define FEATURE_DPM_MP0CLK_BIT                6
53 #define FEATURE_DPM_LINK_BIT                  7
54 #define FEATURE_DPM_DCN_BIT                   8
55 #define FEATURE_VMEMP_SCALING_BIT             9
56 #define FEATURE_VDDIO_MEM_SCALING_BIT         10
57 #define FEATURE_DS_GFXCLK_BIT                 11
58 #define FEATURE_DS_SOCCLK_BIT                 12
59 #define FEATURE_DS_FCLK_BIT                   13
60 #define FEATURE_DS_LCLK_BIT                   14
61 #define FEATURE_DS_DCFCLK_BIT                 15
62 #define FEATURE_DS_UCLK_BIT                   16
63 #define FEATURE_GFX_ULV_BIT                   17
64 #define FEATURE_FW_DSTATE_BIT                 18
65 #define FEATURE_GFXOFF_BIT                    19
66 #define FEATURE_BACO_BIT                      20
67 #define FEATURE_MM_DPM_BIT                    21
68 #define FEATURE_SOC_MPCLK_DS_BIT              22
69 #define FEATURE_BACO_MPCLK_DS_BIT             23
70 #define FEATURE_THROTTLERS_BIT                24
71 #define FEATURE_SMARTSHIFT_BIT                25
72 #define FEATURE_GTHR_BIT                      26
73 #define FEATURE_ACDC_BIT                      27
74 #define FEATURE_VR0HOT_BIT                    28
75 #define FEATURE_FW_CTF_BIT                    29
76 #define FEATURE_FAN_CONTROL_BIT               30
77 #define FEATURE_GFX_DCS_BIT                   31
78 #define FEATURE_GFX_READ_MARGIN_BIT           32
79 #define FEATURE_LED_DISPLAY_BIT               33
80 #define FEATURE_GFXCLK_SPREAD_SPECTRUM_BIT    34
81 #define FEATURE_OUT_OF_BAND_MONITOR_BIT       35
82 #define FEATURE_OPTIMIZED_VMIN_BIT            36
83 #define FEATURE_GFX_IMU_BIT                   37
84 #define FEATURE_BOOT_TIME_CAL_BIT             38
85 #define FEATURE_GFX_PCC_DFLL_BIT              39
86 #define FEATURE_SOC_CG_BIT                    40
87 #define FEATURE_DF_CSTATE_BIT                 41
88 #define FEATURE_GFX_EDC_BIT                   42
89 #define FEATURE_BOOT_POWER_OPT_BIT            43
90 #define FEATURE_CLOCK_POWER_DOWN_BYPASS_BIT   44
91 #define FEATURE_DS_VCN_BIT                    45
92 #define FEATURE_BACO_CG_BIT                   46
93 #define FEATURE_MEM_TEMP_READ_BIT             47
94 #define FEATURE_ATHUB_MMHUB_PG_BIT            48
95 #define FEATURE_SOC_PCC_BIT                   49
96 #define FEATURE_EDC_PWRBRK_BIT                50
97 #define FEATURE_SPARE_51_BIT                  51
98 #define FEATURE_SPARE_52_BIT                  52
99 #define FEATURE_SPARE_53_BIT                  53
100 #define FEATURE_SPARE_54_BIT                  54
101 #define FEATURE_SPARE_55_BIT                  55
102 #define FEATURE_SPARE_56_BIT                  56
103 #define FEATURE_SPARE_57_BIT                  57
104 #define FEATURE_SPARE_58_BIT                  58
105 #define FEATURE_SPARE_59_BIT                  59
106 #define FEATURE_SPARE_60_BIT                  60
107 #define FEATURE_SPARE_61_BIT                  61
108 #define FEATURE_SPARE_62_BIT                  62
109 #define FEATURE_SPARE_63_BIT                  63
110 #define NUM_FEATURES                          64
111
112 //For use with feature control messages
113 typedef enum {
114   FEATURE_PWR_ALL,
115   FEATURE_PWR_S5,
116   FEATURE_PWR_BACO,
117   FEATURE_PWR_SOC,
118   FEATURE_PWR_GFX,
119   FEATURE_PWR_DOMAIN_COUNT,
120 } FEATURE_PWR_DOMAIN_e;
121
122
123 // Debug Overrides Bitmask
124 #define DEBUG_OVERRIDE_DISABLE_VOLT_LINK_VCN_FCLK      0x00000001
125 #define DEBUG_OVERRIDE_DISABLE_VOLT_LINK_DCN_FCLK      0x00000002
126 #define DEBUG_OVERRIDE_DISABLE_VOLT_LINK_MP0_FCLK      0x00000004
127 #define DEBUG_OVERRIDE_DISABLE_VOLT_LINK_VCN_DCFCLK    0x00000008
128 #define DEBUG_OVERRIDE_DISABLE_FAST_FCLK_TIMER         0x00000010
129 #define DEBUG_OVERRIDE_DISABLE_VCN_PG                  0x00000020
130 #define DEBUG_OVERRIDE_DISABLE_FMAX_VMAX               0x00000040
131 #define DEBUG_OVERRIDE_DISABLE_IMU_FW_CHECKS           0x00000080
132 #define DEBUG_OVERRIDE_DISABLE_D0i2_REENTRY_HSR_TIMER_CHECK 0x00000100
133 #define DEBUG_OVERRIDE_DISABLE_DFLL                    0x00000200
134 #define DEBUG_OVERRIDE_ENABLE_RLC_VF_BRINGUP_MODE      0x00000400
135 #define DEBUG_OVERRIDE_DFLL_MASTER_MODE                0x00000800
136
137 // VR Mapping Bit Defines
138 #define VR_MAPPING_VR_SELECT_MASK  0x01
139 #define VR_MAPPING_VR_SELECT_SHIFT 0x00
140
141 #define VR_MAPPING_PLANE_SELECT_MASK  0x02
142 #define VR_MAPPING_PLANE_SELECT_SHIFT 0x01
143
144 // PSI Bit Defines
145 #define PSI_SEL_VR0_PLANE0_PSI0  0x01
146 #define PSI_SEL_VR0_PLANE0_PSI1  0x02
147 #define PSI_SEL_VR0_PLANE1_PSI0  0x04
148 #define PSI_SEL_VR0_PLANE1_PSI1  0x08
149 #define PSI_SEL_VR1_PLANE0_PSI0  0x10
150 #define PSI_SEL_VR1_PLANE0_PSI1  0x20
151 #define PSI_SEL_VR1_PLANE1_PSI0  0x40
152 #define PSI_SEL_VR1_PLANE1_PSI1  0x80
153
154 typedef enum {
155   SVI_PSI_0, // Full phase count (default)
156   SVI_PSI_1, // Phase count 1st level
157   SVI_PSI_2, // Phase count 2nd level
158   SVI_PSI_3, // Single phase operation + active diode emulation
159   SVI_PSI_4, // Single phase operation + passive diode emulation *optional*
160   SVI_PSI_5, // Reserved
161   SVI_PSI_6, // Power down to 0V (voltage regulation disabled)
162   SVI_PSI_7, // Automated phase shedding and diode emulation
163 } SVI_PSI_e;
164
165 // Throttler Control/Status Bits
166 #define THROTTLER_TEMP_EDGE_BIT        0
167 #define THROTTLER_TEMP_HOTSPOT_BIT     1
168 #define THROTTLER_TEMP_HOTSPOT_G_BIT   2
169 #define THROTTLER_TEMP_HOTSPOT_M_BIT   3
170 #define THROTTLER_TEMP_MEM_BIT         4
171 #define THROTTLER_TEMP_VR_GFX_BIT      5
172 #define THROTTLER_TEMP_VR_MEM0_BIT     6
173 #define THROTTLER_TEMP_VR_MEM1_BIT     7
174 #define THROTTLER_TEMP_VR_SOC_BIT      8
175 #define THROTTLER_TEMP_VR_U_BIT        9
176 #define THROTTLER_TEMP_LIQUID0_BIT     10
177 #define THROTTLER_TEMP_LIQUID1_BIT     11
178 #define THROTTLER_TEMP_PLX_BIT         12
179 #define THROTTLER_TDC_GFX_BIT          13
180 #define THROTTLER_TDC_SOC_BIT          14
181 #define THROTTLER_TDC_U_BIT            15
182 #define THROTTLER_PPT0_BIT             16
183 #define THROTTLER_PPT1_BIT             17
184 #define THROTTLER_PPT2_BIT             18
185 #define THROTTLER_PPT3_BIT             19
186 #define THROTTLER_FIT_BIT              20
187 #define THROTTLER_GFX_APCC_PLUS_BIT    21
188 #define THROTTLER_COUNT                22
189
190 // FW DState Features Control Bits
191 #define FW_DSTATE_SOC_ULV_BIT               0
192 #define FW_DSTATE_G6_HSR_BIT                1
193 #define FW_DSTATE_G6_PHY_VMEMP_OFF_BIT      2
194 #define FW_DSTATE_SMN_DS_BIT                3
195 #define FW_DSTATE_MP1_WHISPER_MODE_BIT      4
196 #define FW_DSTATE_SOC_LIV_MIN_BIT           5
197 #define FW_DSTATE_SOC_PLL_PWRDN_BIT         6
198 #define FW_DSTATE_MEM_PLL_PWRDN_BIT         7
199 #define FW_DSTATE_MALL_ALLOC_BIT            8
200 #define FW_DSTATE_MEM_PSI_BIT               9
201 #define FW_DSTATE_HSR_NON_STROBE_BIT        10
202 #define FW_DSTATE_MP0_ENTER_WFI_BIT         11
203 #define FW_DSTATE_U_ULV_BIT                 12
204 #define FW_DSTATE_MALL_FLUSH_BIT            13
205 #define FW_DSTATE_SOC_PSI_BIT               14
206 #define FW_DSTATE_U_PSI_BIT                 15
207 #define FW_DSTATE_UCP_DS_BIT                16
208 #define FW_DSTATE_CSRCLK_DS_BIT             17
209 #define FW_DSTATE_MMHUB_INTERLOCK_BIT       18
210 #define FW_DSTATE_D0i3_2_QUIET_FW_BIT       19
211 #define FW_DSTATE_CLDO_PRG_BIT              20
212 #define FW_DSTATE_DF_PLL_PWRDN_BIT          21
213 #define FW_DSTATE_U_LOW_PWR_MODE_EN_BIT     22
214 #define FW_DSTATE_GFX_PSI6_BIT              23
215 #define FW_DSTATE_GFX_VR_PWR_STAGE_BIT      24
216
217 //LED Display Mask & Control Bits
218 #define LED_DISPLAY_GFX_DPM_BIT            0
219 #define LED_DISPLAY_PCIE_BIT               1
220 #define LED_DISPLAY_ERROR_BIT              2
221
222
223 #define MEM_TEMP_READ_OUT_OF_BAND_BIT          0
224 #define MEM_TEMP_READ_IN_BAND_REFRESH_BIT      1
225 #define MEM_TEMP_READ_IN_BAND_DUMMY_PSTATE_BIT 2
226
227 typedef enum {
228   SMARTSHIFT_VERSION_1,
229   SMARTSHIFT_VERSION_2,
230   SMARTSHIFT_VERSION_3,
231 } SMARTSHIFT_VERSION_e;
232
233 typedef enum {
234   FOPT_CALC_AC_CALC_DC,
235   FOPT_PPTABLE_AC_CALC_DC,
236   FOPT_CALC_AC_PPTABLE_DC,
237   FOPT_PPTABLE_AC_PPTABLE_DC,
238 } FOPT_CALC_e;
239
240 typedef enum {
241   DRAM_BIT_WIDTH_DISABLED = 0,
242   DRAM_BIT_WIDTH_X_8 = 8,
243   DRAM_BIT_WIDTH_X_16 = 16,
244   DRAM_BIT_WIDTH_X_32 = 32,
245   DRAM_BIT_WIDTH_X_64 = 64,
246   DRAM_BIT_WIDTH_X_128 = 128,
247   DRAM_BIT_WIDTH_COUNT,
248 } DRAM_BIT_WIDTH_TYPE_e;
249
250 //I2C Interface
251 #define NUM_I2C_CONTROLLERS                8
252
253 #define I2C_CONTROLLER_ENABLED             1
254 #define I2C_CONTROLLER_DISABLED            0
255
256 #define MAX_SW_I2C_COMMANDS                24
257
258 typedef enum {
259   I2C_CONTROLLER_PORT_0 = 0,  //CKSVII2C0
260   I2C_CONTROLLER_PORT_1 = 1,  //CKSVII2C1
261   I2C_CONTROLLER_PORT_COUNT,
262 } I2cControllerPort_e;
263
264 typedef enum {
265   I2C_CONTROLLER_NAME_VR_GFX = 0,
266   I2C_CONTROLLER_NAME_VR_SOC,
267   I2C_CONTROLLER_NAME_VR_VMEMP,
268   I2C_CONTROLLER_NAME_VR_VDDIO,
269   I2C_CONTROLLER_NAME_LIQUID0,
270   I2C_CONTROLLER_NAME_LIQUID1,
271   I2C_CONTROLLER_NAME_PLX,
272   I2C_CONTROLLER_NAME_OTHER,
273   I2C_CONTROLLER_NAME_COUNT,
274 } I2cControllerName_e;
275
276 typedef enum {
277   I2C_CONTROLLER_THROTTLER_TYPE_NONE = 0,
278   I2C_CONTROLLER_THROTTLER_VR_GFX,
279   I2C_CONTROLLER_THROTTLER_VR_SOC,
280   I2C_CONTROLLER_THROTTLER_VR_VMEMP,
281   I2C_CONTROLLER_THROTTLER_VR_VDDIO,
282   I2C_CONTROLLER_THROTTLER_LIQUID0,
283   I2C_CONTROLLER_THROTTLER_LIQUID1,
284   I2C_CONTROLLER_THROTTLER_PLX,
285   I2C_CONTROLLER_THROTTLER_INA3221,
286   I2C_CONTROLLER_THROTTLER_COUNT,
287 } I2cControllerThrottler_e;
288
289 typedef enum {
290   I2C_CONTROLLER_PROTOCOL_VR_XPDE132G5,
291   I2C_CONTROLLER_PROTOCOL_VR_IR35217,
292   I2C_CONTROLLER_PROTOCOL_TMP_TMP102A,
293   I2C_CONTROLLER_PROTOCOL_INA3221,
294   I2C_CONTROLLER_PROTOCOL_COUNT,
295 } I2cControllerProtocol_e;
296
297 typedef struct {
298   uint8_t   Enabled;
299   uint8_t   Speed;
300   uint8_t   SlaveAddress;
301   uint8_t   ControllerPort;
302   uint8_t   ControllerName;
303   uint8_t   ThermalThrotter;
304   uint8_t   I2cProtocol;
305   uint8_t   PaddingConfig;
306 } I2cControllerConfig_t;
307
308 typedef enum {
309   I2C_PORT_SVD_SCL = 0,
310   I2C_PORT_GPIO,
311 } I2cPort_e;
312
313 typedef enum {
314   I2C_SPEED_FAST_50K = 0,      //50  Kbits/s
315   I2C_SPEED_FAST_100K,         //100 Kbits/s
316   I2C_SPEED_FAST_400K,         //400 Kbits/s
317   I2C_SPEED_FAST_PLUS_1M,      //1   Mbits/s (in fast mode)
318   I2C_SPEED_HIGH_1M,           //1   Mbits/s (in high speed mode)
319   I2C_SPEED_HIGH_2M,           //2.3 Mbits/s
320   I2C_SPEED_COUNT,
321 } I2cSpeed_e;
322
323 typedef enum {
324   I2C_CMD_READ = 0,
325   I2C_CMD_WRITE,
326   I2C_CMD_COUNT,
327 } I2cCmdType_e;
328
329 #define CMDCONFIG_STOP_BIT             0
330 #define CMDCONFIG_RESTART_BIT          1
331 #define CMDCONFIG_READWRITE_BIT        2 //bit should be 0 for read, 1 for write
332
333 #define CMDCONFIG_STOP_MASK           (1 << CMDCONFIG_STOP_BIT)
334 #define CMDCONFIG_RESTART_MASK        (1 << CMDCONFIG_RESTART_BIT)
335 #define CMDCONFIG_READWRITE_MASK      (1 << CMDCONFIG_READWRITE_BIT)
336
337 typedef struct {
338   uint8_t ReadWriteData;  //Return data for read. Data to send for write
339   uint8_t CmdConfig; //Includes whether associated command should have a stop or restart command, and is a read or write
340 } SwI2cCmd_t; //SW I2C Command Table
341
342 typedef struct {
343   uint8_t     I2CcontrollerPort; //CKSVII2C0(0) or //CKSVII2C1(1)
344   uint8_t     I2CSpeed;          //Use I2cSpeed_e to indicate speed to select
345   uint8_t     SlaveAddress;      //Slave address of device
346   uint8_t     NumCmds;           //Number of commands
347
348   SwI2cCmd_t  SwI2cCmds[MAX_SW_I2C_COMMANDS];
349 } SwI2cRequest_t; // SW I2C Request Table
350
351 typedef struct {
352   SwI2cRequest_t SwI2cRequest;
353
354   uint32_t Spare[8];
355   uint32_t MmHubPadding[8]; // SMU internal use
356 } SwI2cRequestExternal_t;
357
358 typedef struct {
359   uint64_t mca_umc_status;
360   uint64_t mca_umc_addr;
361
362   uint16_t ce_count_lo_chip;
363   uint16_t ce_count_hi_chip;
364
365   uint32_t eccPadding;
366 } EccInfo_t;
367
368 typedef struct {
369   EccInfo_t  EccInfo[24];
370 } EccInfoTable_t;
371
372 //D3HOT sequences
373 typedef enum {
374   BACO_SEQUENCE,
375   MSR_SEQUENCE,
376   BAMACO_SEQUENCE,
377   ULPS_SEQUENCE,
378   D3HOT_SEQUENCE_COUNT,
379 } D3HOTSequence_e;
380
381 //This is aligned with RSMU PGFSM Register Mapping
382 typedef enum {
383   PG_DYNAMIC_MODE = 0,
384   PG_STATIC_MODE,
385 } PowerGatingMode_e;
386
387 //This is aligned with RSMU PGFSM Register Mapping
388 typedef enum {
389   PG_POWER_DOWN = 0,
390   PG_POWER_UP,
391 } PowerGatingSettings_e;
392
393 typedef struct {
394   uint32_t a;  // store in IEEE float format in this variable
395   uint32_t b;  // store in IEEE float format in this variable
396   uint32_t c;  // store in IEEE float format in this variable
397 } QuadraticInt_t;
398
399 typedef struct {
400   uint32_t m;  // store in IEEE float format in this variable
401   uint32_t b;  // store in IEEE float format in this variable
402 } LinearInt_t;
403
404 typedef struct {
405   uint32_t a;  // store in IEEE float format in this variable
406   uint32_t b;  // store in IEEE float format in this variable
407   uint32_t c;  // store in IEEE float format in this variable
408 } DroopInt_t;
409
410 typedef enum {
411   DCS_ARCH_DISABLED,
412   DCS_ARCH_FADCS,
413   DCS_ARCH_ASYNC,
414 } DCS_ARCH_e;
415
416 //Only Clks that have DPM descriptors are listed here
417 typedef enum {
418   PPCLK_GFXCLK = 0,
419   PPCLK_SOCCLK,
420   PPCLK_UCLK,
421   PPCLK_FCLK,
422   PPCLK_DCLK_0,
423   PPCLK_VCLK_0,
424   PPCLK_DCLK_1,
425   PPCLK_VCLK_1,
426   PPCLK_DISPCLK,
427   PPCLK_DPPCLK,
428   PPCLK_DPREFCLK,
429   PPCLK_DCFCLK,
430   PPCLK_DTBCLK,
431   PPCLK_COUNT,
432 } PPCLK_e;
433
434 typedef enum {
435   VOLTAGE_MODE_PPTABLE = 0,
436   VOLTAGE_MODE_FUSES,
437   VOLTAGE_MODE_COUNT,
438 } VOLTAGE_MODE_e;
439
440
441 typedef enum {
442   AVFS_VOLTAGE_GFX = 0,
443   AVFS_VOLTAGE_SOC,
444   AVFS_VOLTAGE_COUNT,
445 } AVFS_VOLTAGE_TYPE_e;
446
447 typedef enum {
448   AVFS_TEMP_COLD = 0,
449   AVFS_TEMP_HOT,
450   AVFS_TEMP_COUNT,
451 } AVFS_TEMP_e;
452
453 typedef enum {
454   AVFS_D_G,
455   AVFS_D_M_B,
456   AVFS_D_M_S,
457   AVFS_D_COUNT,
458 } AVFS_D_e;
459
460 typedef enum {
461   UCLK_DIV_BY_1 = 0,
462   UCLK_DIV_BY_2,
463   UCLK_DIV_BY_4,
464   UCLK_DIV_BY_8,
465 } UCLK_DIV_e;
466
467 typedef enum {
468   GPIO_INT_POLARITY_ACTIVE_LOW = 0,
469   GPIO_INT_POLARITY_ACTIVE_HIGH,
470 } GpioIntPolarity_e;
471
472 typedef enum {
473   PWR_CONFIG_TDP = 0,
474   PWR_CONFIG_TGP,
475   PWR_CONFIG_TCP_ESTIMATED,
476   PWR_CONFIG_TCP_MEASURED,
477 } PwrConfig_e;
478
479 typedef struct {
480   uint8_t        Padding;
481   uint8_t        SnapToDiscrete;      // 0 - Fine grained DPM, 1 - Discrete DPM
482   uint8_t        NumDiscreteLevels;   // Set to 2 (Fmin, Fmax) when using fine grained DPM, otherwise set to # discrete levels used
483   uint8_t        CalculateFopt;       // Indication whether FW should calculate Fopt or use values below. Reference FOPT_CALC_e
484   LinearInt_t    ConversionToAvfsClk; // Transfer function to AVFS Clock (GHz->GHz)
485   uint32_t       Padding3[3];
486   uint16_t       Padding4;
487   uint16_t       FoptimalDc;          //Foptimal frequency in DC power mode.
488   uint16_t       FoptimalAc;          //Foptimal frequency in AC power mode.
489   uint16_t       Padding2;
490 } DpmDescriptor_t;
491
492 typedef enum  {
493   PPT_THROTTLER_PPT0,
494   PPT_THROTTLER_PPT1,
495   PPT_THROTTLER_PPT2,
496   PPT_THROTTLER_PPT3,
497   PPT_THROTTLER_COUNT
498 } PPT_THROTTLER_e;
499
500 typedef enum  {
501   TEMP_EDGE,
502   TEMP_HOTSPOT,
503   TEMP_HOTSPOT_G,
504   TEMP_HOTSPOT_M,
505   TEMP_MEM,
506   TEMP_VR_GFX,
507   TEMP_VR_MEM0,
508   TEMP_VR_MEM1,
509   TEMP_VR_SOC,
510   TEMP_VR_U,
511   TEMP_LIQUID0,
512   TEMP_LIQUID1,
513   TEMP_PLX,
514   TEMP_COUNT,
515 } TEMP_e;
516
517 typedef enum {
518   TDC_THROTTLER_GFX,
519   TDC_THROTTLER_SOC,
520   TDC_THROTTLER_U,
521   TDC_THROTTLER_COUNT
522 } TDC_THROTTLER_e;
523
524 typedef enum {
525   SVI_PLANE_GFX,
526   SVI_PLANE_SOC,
527   SVI_PLANE_VMEMP,
528   SVI_PLANE_VDDIO_MEM,
529   SVI_PLANE_U,
530   SVI_PLANE_COUNT,
531 } SVI_PLANE_e;
532
533 typedef enum {
534   PMFW_VOLT_PLANE_GFX,
535   PMFW_VOLT_PLANE_SOC,
536   PMFW_VOLT_PLANE_COUNT
537 } PMFW_VOLT_PLANE_e;
538
539 typedef enum {
540   CUSTOMER_VARIANT_ROW,
541   CUSTOMER_VARIANT_FALCON,
542   CUSTOMER_VARIANT_COUNT,
543 } CUSTOMER_VARIANT_e;
544
545 typedef enum {
546   POWER_SOURCE_AC,
547   POWER_SOURCE_DC,
548   POWER_SOURCE_COUNT,
549 } POWER_SOURCE_e;
550
551 typedef enum {
552   MEM_VENDOR_SAMSUNG,
553   MEM_VENDOR_INFINEON,
554   MEM_VENDOR_ELPIDA,
555   MEM_VENDOR_ETRON,
556   MEM_VENDOR_NANYA,
557   MEM_VENDOR_HYNIX,
558   MEM_VENDOR_MOSEL,
559   MEM_VENDOR_WINBOND,
560   MEM_VENDOR_ESMT,
561   MEM_VENDOR_PLACEHOLDER0,
562   MEM_VENDOR_PLACEHOLDER1,
563   MEM_VENDOR_PLACEHOLDER2,
564   MEM_VENDOR_PLACEHOLDER3,
565   MEM_VENDOR_PLACEHOLDER4,
566   MEM_VENDOR_PLACEHOLDER5,
567   MEM_VENDOR_MICRON,
568   MEM_VENDOR_COUNT,
569 } MEM_VENDOR_e;
570
571 typedef enum {
572   PP_GRTAVFS_HW_CPO_CTL_ZONE0,
573   PP_GRTAVFS_HW_CPO_CTL_ZONE1,
574   PP_GRTAVFS_HW_CPO_CTL_ZONE2,
575   PP_GRTAVFS_HW_CPO_CTL_ZONE3,
576   PP_GRTAVFS_HW_CPO_CTL_ZONE4,
577   PP_GRTAVFS_HW_CPO_EN_0_31_ZONE0,
578   PP_GRTAVFS_HW_CPO_EN_32_63_ZONE0,
579   PP_GRTAVFS_HW_CPO_EN_0_31_ZONE1,
580   PP_GRTAVFS_HW_CPO_EN_32_63_ZONE1,
581   PP_GRTAVFS_HW_CPO_EN_0_31_ZONE2,
582   PP_GRTAVFS_HW_CPO_EN_32_63_ZONE2,
583   PP_GRTAVFS_HW_CPO_EN_0_31_ZONE3,
584   PP_GRTAVFS_HW_CPO_EN_32_63_ZONE3,
585   PP_GRTAVFS_HW_CPO_EN_0_31_ZONE4,
586   PP_GRTAVFS_HW_CPO_EN_32_63_ZONE4,
587   PP_GRTAVFS_HW_ZONE0_VF,
588   PP_GRTAVFS_HW_ZONE1_VF1,
589   PP_GRTAVFS_HW_ZONE2_VF2,
590   PP_GRTAVFS_HW_ZONE3_VF3,
591   PP_GRTAVFS_HW_VOLTAGE_GB,
592   PP_GRTAVFS_HW_CPOSCALINGCTRL_ZONE0,
593   PP_GRTAVFS_HW_CPOSCALINGCTRL_ZONE1,
594   PP_GRTAVFS_HW_CPOSCALINGCTRL_ZONE2,
595   PP_GRTAVFS_HW_CPOSCALINGCTRL_ZONE3,
596   PP_GRTAVFS_HW_CPOSCALINGCTRL_ZONE4,
597   PP_GRTAVFS_HW_RESERVED_0,
598   PP_GRTAVFS_HW_RESERVED_1,
599   PP_GRTAVFS_HW_RESERVED_2,
600   PP_GRTAVFS_HW_RESERVED_3,
601   PP_GRTAVFS_HW_RESERVED_4,
602   PP_GRTAVFS_HW_RESERVED_5,
603   PP_GRTAVFS_HW_RESERVED_6,
604   PP_GRTAVFS_HW_FUSE_COUNT,
605 } PP_GRTAVFS_HW_FUSE_e;
606
607 typedef enum {
608   PP_GRTAVFS_FW_COMMON_PPVMIN_Z1_HOT_T0,
609   PP_GRTAVFS_FW_COMMON_PPVMIN_Z1_COLD_T0,
610   PP_GRTAVFS_FW_COMMON_PPVMIN_Z2_HOT_T0,
611   PP_GRTAVFS_FW_COMMON_PPVMIN_Z2_COLD_T0,
612   PP_GRTAVFS_FW_COMMON_PPVMIN_Z3_HOT_T0,
613   PP_GRTAVFS_FW_COMMON_PPVMIN_Z3_COLD_T0,
614   PP_GRTAVFS_FW_COMMON_PPVMIN_Z4_HOT_T0,
615   PP_GRTAVFS_FW_COMMON_PPVMIN_Z4_COLD_T0,
616   PP_GRTAVFS_FW_COMMON_SRAM_RM_Z0,
617   PP_GRTAVFS_FW_COMMON_SRAM_RM_Z1,
618   PP_GRTAVFS_FW_COMMON_SRAM_RM_Z2,
619   PP_GRTAVFS_FW_COMMON_SRAM_RM_Z3,
620   PP_GRTAVFS_FW_COMMON_SRAM_RM_Z4,
621   PP_GRTAVFS_FW_COMMON_FUSE_COUNT,
622 } PP_GRTAVFS_FW_COMMON_FUSE_e;
623
624 typedef enum {
625   PP_GRTAVFS_FW_SEP_FUSE_GB1_PWL_VOLTAGE_NEG_1,
626   PP_GRTAVFS_FW_SEP_FUSE_GB1_PWL_VOLTAGE_0,
627   PP_GRTAVFS_FW_SEP_FUSE_GB1_PWL_VOLTAGE_1,
628   PP_GRTAVFS_FW_SEP_FUSE_GB1_PWL_VOLTAGE_2,
629   PP_GRTAVFS_FW_SEP_FUSE_GB1_PWL_VOLTAGE_3,
630   PP_GRTAVFS_FW_SEP_FUSE_GB1_PWL_VOLTAGE_4,
631   PP_GRTAVFS_FW_SEP_FUSE_GB2_PWL_VOLTAGE_NEG_1,
632   PP_GRTAVFS_FW_SEP_FUSE_GB2_PWL_VOLTAGE_0,
633   PP_GRTAVFS_FW_SEP_FUSE_GB2_PWL_VOLTAGE_1,
634   PP_GRTAVFS_FW_SEP_FUSE_GB2_PWL_VOLTAGE_2,
635   PP_GRTAVFS_FW_SEP_FUSE_GB2_PWL_VOLTAGE_3,
636   PP_GRTAVFS_FW_SEP_FUSE_GB2_PWL_VOLTAGE_4,
637   PP_GRTAVFS_FW_SEP_FUSE_VF_NEG_1_FREQUENCY,
638   PP_GRTAVFS_FW_SEP_FUSE_VF4_FREQUENCY,
639   PP_GRTAVFS_FW_SEP_FUSE_FREQUENCY_TO_COUNT_SCALER_0,
640   PP_GRTAVFS_FW_SEP_FUSE_FREQUENCY_TO_COUNT_SCALER_1,
641   PP_GRTAVFS_FW_SEP_FUSE_FREQUENCY_TO_COUNT_SCALER_2,
642   PP_GRTAVFS_FW_SEP_FUSE_FREQUENCY_TO_COUNT_SCALER_3,
643   PP_GRTAVFS_FW_SEP_FUSE_FREQUENCY_TO_COUNT_SCALER_4,
644   PP_GRTAVFS_FW_SEP_FUSE_COUNT,
645 } PP_GRTAVFS_FW_SEP_FUSE_e;
646
647 #define PP_NUM_RTAVFS_PWL_ZONES 5
648
649
650
651 // VBIOS or PPLIB configures telemetry slope and offset. Only slope expected to be set for SVI3
652 // Slope Q1.7, Offset Q1.2
653 typedef struct {
654   int8_t   Offset; // in Amps
655   uint8_t  Padding;
656   uint16_t MaxCurrent; // in Amps
657 } SviTelemetryScale_t;
658
659 #define PP_NUM_OD_VF_CURVE_POINTS PP_NUM_RTAVFS_PWL_ZONES + 1
660
661
662 typedef struct {
663   uint32_t FeatureCtrlMask;
664
665   //Voltage control
666   int16_t                VoltageOffsetPerZoneBoundary[PP_NUM_OD_VF_CURVE_POINTS];
667   uint16_t               reserved[2];
668
669   //Frequency changes
670   int16_t                GfxclkFmin;           // MHz
671   int16_t                GfxclkFmax;           // MHz
672   uint16_t               UclkFmin;             // MHz
673   uint16_t               UclkFmax;             // MHz
674
675   //PPT
676   int16_t                Ppt;         // %
677   int16_t                reserved1;
678
679   //Fan control
680   uint8_t                FanLinearPwmPoints[NUM_OD_FAN_MAX_POINTS];
681   uint8_t                FanLinearTempPoints[NUM_OD_FAN_MAX_POINTS];
682   uint16_t               FanMinimumPwm;
683   uint16_t               AcousticTargetRpmThreshold;
684   uint16_t               AcousticLimitRpmThreshold;
685   uint16_t               FanTargetTemperature; // Degree Celcius
686   uint8_t                FanZeroRpmEnable;
687   uint8_t                FanZeroRpmStopTemp;
688   uint8_t                FanMode;
689   uint8_t                MaxOpTemp;
690
691   uint32_t               Spare[13];
692   uint32_t               MmHubPadding[8]; // SMU internal use. Adding here instead of external as a workaround
693 } OverDriveTable_t;
694
695 typedef struct {
696   OverDriveTable_t OverDriveTable;
697
698 } OverDriveTableExternal_t;
699
700 typedef struct {
701   uint32_t FeatureCtrlMask;
702
703   int16_t VoltageOffsetPerZoneBoundary;
704   uint16_t               reserved[2];
705
706   uint16_t               GfxclkFmin;           // MHz
707   uint16_t               GfxclkFmax;           // MHz
708   uint16_t               UclkFmin;             // MHz
709   uint16_t               UclkFmax;             // MHz
710
711   //PPT
712   int16_t                Ppt;         // %
713   int16_t                reserved1;
714
715   uint8_t                FanLinearPwmPoints;
716   uint8_t                FanLinearTempPoints;
717   uint16_t               FanMinimumPwm;
718   uint16_t               AcousticTargetRpmThreshold;
719   uint16_t               AcousticLimitRpmThreshold;
720   uint16_t               FanTargetTemperature; // Degree Celcius
721   uint8_t                FanZeroRpmEnable;
722   uint8_t                FanZeroRpmStopTemp;
723   uint8_t                FanMode;
724   uint8_t                MaxOpTemp;
725
726   uint32_t               Spare[13];
727
728 } OverDriveLimits_t;
729
730
731 typedef enum {
732   BOARD_GPIO_SMUIO_0,
733   BOARD_GPIO_SMUIO_1,
734   BOARD_GPIO_SMUIO_2,
735   BOARD_GPIO_SMUIO_3,
736   BOARD_GPIO_SMUIO_4,
737   BOARD_GPIO_SMUIO_5,
738   BOARD_GPIO_SMUIO_6,
739   BOARD_GPIO_SMUIO_7,
740   BOARD_GPIO_SMUIO_8,
741   BOARD_GPIO_SMUIO_9,
742   BOARD_GPIO_SMUIO_10,
743   BOARD_GPIO_SMUIO_11,
744   BOARD_GPIO_SMUIO_12,
745   BOARD_GPIO_SMUIO_13,
746   BOARD_GPIO_SMUIO_14,
747   BOARD_GPIO_SMUIO_15,
748   BOARD_GPIO_SMUIO_16,
749   BOARD_GPIO_SMUIO_17,
750   BOARD_GPIO_SMUIO_18,
751   BOARD_GPIO_SMUIO_19,
752   BOARD_GPIO_SMUIO_20,
753   BOARD_GPIO_SMUIO_21,
754   BOARD_GPIO_SMUIO_22,
755   BOARD_GPIO_SMUIO_23,
756   BOARD_GPIO_SMUIO_24,
757   BOARD_GPIO_SMUIO_25,
758   BOARD_GPIO_SMUIO_26,
759   BOARD_GPIO_SMUIO_27,
760   BOARD_GPIO_SMUIO_28,
761   BOARD_GPIO_SMUIO_29,
762   BOARD_GPIO_SMUIO_30,
763   BOARD_GPIO_SMUIO_31,
764   MAX_BOARD_GPIO_SMUIO_NUM,
765   BOARD_GPIO_DC_GEN_A,
766   BOARD_GPIO_DC_GEN_B,
767   BOARD_GPIO_DC_GEN_C,
768   BOARD_GPIO_DC_GEN_D,
769   BOARD_GPIO_DC_GEN_E,
770   BOARD_GPIO_DC_GEN_F,
771   BOARD_GPIO_DC_GEN_G,
772   BOARD_GPIO_DC_GENLK_CLK,
773   BOARD_GPIO_DC_GENLK_VSYNC,
774   BOARD_GPIO_DC_SWAPLOCK_A,
775   BOARD_GPIO_DC_SWAPLOCK_B,
776 } BOARD_GPIO_TYPE_e;
777
778 #define INVALID_BOARD_GPIO 0xFF
779
780
781 typedef struct {
782   //PLL 0
783   uint16_t InitGfxclk_bypass;
784   uint16_t InitSocclk;
785   uint16_t InitMp0clk;
786   uint16_t InitMpioclk;
787   uint16_t InitSmnclk;
788   uint16_t InitUcpclk;
789   uint16_t InitCsrclk;
790   //PLL 1
791
792   uint16_t InitDprefclk;
793   uint16_t InitDcfclk;
794   uint16_t InitDtbclk;
795   //PLL 2
796   uint16_t InitDclk; //assume same DCLK/VCLK for both instances
797   uint16_t InitVclk;
798   // PLL 3
799   uint16_t InitUsbdfsclk;
800   uint16_t InitMp1clk;
801   uint16_t InitLclk;
802   uint16_t InitBaco400clk_bypass;
803   uint16_t InitBaco1200clk_bypass;
804   uint16_t InitBaco700clk_bypass;
805   // PLL 4
806   uint16_t InitFclk;
807   // PLL 5
808   uint16_t InitGfxclk_clkb;
809
810   //PLL 6
811   uint8_t InitUclkDPMState;    // =0,1,2,3, frequency from FreqTableUclk
812
813   uint8_t Padding[3];
814
815   uint32_t InitVcoFreqPll0;
816   uint32_t InitVcoFreqPll1;
817   uint32_t InitVcoFreqPll2;
818   uint32_t InitVcoFreqPll3;
819   uint32_t InitVcoFreqPll4;
820   uint32_t InitVcoFreqPll5;
821   uint32_t InitVcoFreqPll6;
822
823   //encoding will change depending on SVI2/SVI3
824   uint16_t InitGfx;     // In mV(Q2) ,  should be 0?
825   uint16_t InitSoc;     // In mV(Q2)
826   uint16_t InitU; // In Mv(Q2)
827
828   uint16_t Padding2;
829
830   uint32_t Spare[8];
831
832 } BootValues_t;
833
834
835 typedef struct {
836    uint16_t Power[PPT_THROTTLER_COUNT][POWER_SOURCE_COUNT]; // Watts
837   uint16_t Tdc[TDC_THROTTLER_COUNT];             // Amps
838
839   uint16_t Temperature[TEMP_COUNT]; // Celsius
840
841   uint8_t  PwmLimitMin;
842   uint8_t  PwmLimitMax;
843   uint8_t  FanTargetTemperature;
844   uint8_t  Spare1[1];
845
846   uint16_t AcousticTargetRpmThresholdMin;
847   uint16_t AcousticTargetRpmThresholdMax;
848
849   uint16_t AcousticLimitRpmThresholdMin;
850   uint16_t AcousticLimitRpmThresholdMax;
851
852   uint16_t  PccLimitMin;
853   uint16_t  PccLimitMax;
854
855   uint16_t  FanStopTempMin;
856   uint16_t  FanStopTempMax;
857   uint16_t  FanStartTempMin;
858   uint16_t  FanStartTempMax;
859
860   uint32_t Spare[12];
861
862 } MsgLimits_t;
863
864 typedef struct {
865   uint16_t BaseClockAc;
866   uint16_t GameClockAc;
867   uint16_t BoostClockAc;
868   uint16_t BaseClockDc;
869   uint16_t GameClockDc;
870   uint16_t BoostClockDc;
871
872   uint32_t Reserved[4];
873 } DriverReportedClocks_t;
874
875 typedef struct {
876   uint8_t           DcBtcEnabled;
877   uint8_t           Padding[3];
878
879   uint16_t          DcTol;            // mV Q2
880   uint16_t          DcBtcGb;       // mV Q2
881
882   uint16_t          DcBtcMin;       // mV Q2
883   uint16_t          DcBtcMax;       // mV Q2
884
885   LinearInt_t       DcBtcGbScalar;
886
887 } AvfsDcBtcParams_t;
888
889 typedef struct {
890   uint16_t       AvfsTemp[AVFS_TEMP_COUNT]; //in degrees C
891   uint16_t      VftFMin;  // in MHz
892   uint16_t      VInversion; // in mV Q2
893   QuadraticInt_t qVft[AVFS_TEMP_COUNT];
894   QuadraticInt_t qAvfsGb;
895   QuadraticInt_t qAvfsGb2;
896 } AvfsFuseOverride_t;
897
898 typedef struct {
899   // SECTION: Version
900
901   uint32_t Version; // should be unique to each SKU(i.e if any value changes in below structure then this value must be different)
902
903   // SECTION: Feature Control
904   uint32_t FeaturesToRun[NUM_FEATURES / 32]; // Features that PMFW will attempt to enable. Use FEATURE_*_BIT as mapping
905
906   // SECTION: Miscellaneous Configuration
907   uint8_t      TotalPowerConfig;    // Determines how PMFW calculates the power. Use defines from PwrConfig_e
908   uint8_t      CustomerVariant; //To specify if this PPTable is intended for a particular customer. Use defines from CUSTOMER_VARIANT_e
909   uint8_t      MemoryTemperatureTypeMask; // Bit mapping indicating which methods of memory temperature reading are enabled. Use defines from MEM_TEMP_*BIT
910   uint8_t      SmartShiftVersion; // Determine what SmartShift feature version is supported Use defines from SMARTSHIFT_VERSION_e
911
912   // SECTION: Infrastructure Limits
913   uint16_t SocketPowerLimitAc[PPT_THROTTLER_COUNT]; // In Watts. Power limit that PMFW attempts to control to in AC mode. Multiple limits supported
914   uint16_t SocketPowerLimitDc[PPT_THROTTLER_COUNT];  // In Watts. Power limit that PMFW attempts to control to in DC mode. Multiple limits supported
915
916   uint16_t SocketPowerLimitSmartShift2; // In Watts. Power limit used SmartShift
917
918   //if set to 1, SocketPowerLimitAc and SocketPowerLimitDc will be interpreted as legacy programs(i.e absolute power). If 0, all except index 0 will be scalars
919   //relative index 0
920   uint8_t  EnableLegacyPptLimit;
921   uint8_t  UseInputTelemetry; //applicable to SVI3 only and only to be set if VRs support
922   uint8_t  SmartShiftMinReportedPptinDcs; //minimum possible active power consumption for this SKU. Used for SmartShift power reporting
923
924   uint8_t  PaddingPpt[1];
925
926   uint16_t VrTdcLimit[TDC_THROTTLER_COUNT];             // In Amperes. Current limit associated with VR regulator maximum temperature
927
928   uint16_t PlatformTdcLimit[TDC_THROTTLER_COUNT];             // In Amperes. Current limit associated with platform maximum temperature per VR current rail
929
930   uint16_t TemperatureLimit[TEMP_COUNT]; // In degrees Celsius. Temperature limit associated with each input
931
932   uint16_t HwCtfTempLimit; // In degrees Celsius. Temperature above which HW will trigger CTF. Consumed by VBIOS only
933
934   uint16_t PaddingInfra;
935
936   // Per year normalized Vmax state failure rates (sum of the two domains divided by life time in years)
937   uint32_t FitControllerFailureRateLimit; //in IEEE float
938   //Expected GFX Duty Cycle at Vmax.
939   uint32_t FitControllerGfxDutyCycle; // in IEEE float
940   //Expected SOC Duty Cycle at Vmax.
941   uint32_t FitControllerSocDutyCycle; // in IEEE float
942
943   //This offset will be deducted from the controller output to before it goes through the SOC Vset limiter block.
944   uint32_t FitControllerSocOffset;  //in IEEE float
945
946   uint32_t     GfxApccPlusResidencyLimit; // Percentage value. Used by APCC+ controller to control PCC residency to some value
947
948   // SECTION: Throttler settings
949   uint32_t ThrottlerControlMask;   // See THROTTLER_*_BIT for mapping
950
951   // SECTION: FW DSTATE Settings
952   uint32_t FwDStateMask;           // See FW_DSTATE_*_BIT for mapping
953
954   // SECTION: Voltage Control Parameters
955   uint16_t  UlvVoltageOffset[PMFW_VOLT_PLANE_COUNT]; // In mV(Q2). ULV offset used in either GFX_ULV or SOC_ULV(part of FW_DSTATE)
956
957   uint16_t     UlvVoltageOffsetU; // In mV(Q2). ULV offset used in either U_ULV(part of FW_DSTATE)
958   uint16_t     DeepUlvVoltageOffsetSoc;        // In mV(Q2)  Long Idle Vmin (deep ULV), for VDD_SOC as part of FW_DSTATE
959
960   // Voltage Limits
961   uint16_t     DefaultMaxVoltage[PMFW_VOLT_PLANE_COUNT]; // In mV(Q2) Maximum voltage without FIT controller enabled
962   uint16_t     BoostMaxVoltage[PMFW_VOLT_PLANE_COUNT]; // In mV(Q2) Maximum voltage with FIT controller enabled
963
964   //Vmin Optimizations
965   int16_t         VminTempHystersis[PMFW_VOLT_PLANE_COUNT]; // Celsius Temperature hysteresis for switching between low/high temperature values for Vmin
966   int16_t         VminTempThreshold[PMFW_VOLT_PLANE_COUNT]; // Celsius Temperature threshold for switching between low/high temperature values for Vmin
967   uint16_t        Vmin_Hot_T0[PMFW_VOLT_PLANE_COUNT];            //In mV(Q2) Initial (pre-aging) Vset to be used at hot.
968   uint16_t        Vmin_Cold_T0[PMFW_VOLT_PLANE_COUNT];           //In mV(Q2) Initial (pre-aging) Vset to be used at cold.
969   uint16_t        Vmin_Hot_Eol[PMFW_VOLT_PLANE_COUNT];           //In mV(Q2) End-of-life Vset to be used at hot.
970   uint16_t        Vmin_Cold_Eol[PMFW_VOLT_PLANE_COUNT];          //In mV(Q2) End-of-life Vset to be used at cold.
971   uint16_t        Vmin_Aging_Offset[PMFW_VOLT_PLANE_COUNT];      //In mV(Q2) Worst-case aging margin
972   uint16_t        Spare_Vmin_Plat_Offset_Hot[PMFW_VOLT_PLANE_COUNT];   //In mV(Q2) Platform offset apply to T0 Hot
973   uint16_t        Spare_Vmin_Plat_Offset_Cold[PMFW_VOLT_PLANE_COUNT];  //In mV(Q2) Platform offset apply to T0 Cold
974
975   //This is a fixed/minimum VMIN aging degradation offset which is applied at T0. This reflects the minimum amount of aging already accounted for.
976   uint16_t        VcBtcFixedVminAgingOffset[PMFW_VOLT_PLANE_COUNT];
977   //Linear offset or GB term to account for mis-correlation between PSM and Vmin shift trends across parts.
978   uint16_t        VcBtcVmin2PsmDegrationGb[PMFW_VOLT_PLANE_COUNT];
979   //Scalar coefficient of the PSM aging degradation function
980   uint32_t        VcBtcPsmA[PMFW_VOLT_PLANE_COUNT];                   // A_PSM
981   //Exponential coefficient of the PSM aging degradation function
982   uint32_t        VcBtcPsmB[PMFW_VOLT_PLANE_COUNT];                   // B_PSM
983   //Scalar coefficient of the VMIN aging degradation function. Specified as worst case between hot and cold.
984   uint32_t        VcBtcVminA[PMFW_VOLT_PLANE_COUNT];                  // A_VMIN
985   //Exponential coefficient of the VMIN aging degradation function. Specified as worst case between hot and cold.
986   uint32_t        VcBtcVminB[PMFW_VOLT_PLANE_COUNT];                  // B_VMIN
987
988   uint8_t        PerPartVminEnabled[PMFW_VOLT_PLANE_COUNT];
989   uint8_t        VcBtcEnabled[PMFW_VOLT_PLANE_COUNT];
990
991   uint16_t SocketPowerLimitAcTau[PPT_THROTTLER_COUNT]; // Time constant of LPF in ms
992   uint16_t SocketPowerLimitDcTau[PPT_THROTTLER_COUNT]; // Time constant of LPF in ms
993
994   QuadraticInt_t Vmin_droop;
995   uint32_t       SpareVmin[9];
996
997
998   //SECTION: DPM Configuration 1
999   DpmDescriptor_t DpmDescriptor[PPCLK_COUNT];
1000
1001   uint16_t       FreqTableGfx      [NUM_GFXCLK_DPM_LEVELS  ];     // In MHz
1002   uint16_t       FreqTableVclk     [NUM_VCLK_DPM_LEVELS    ];     // In MHz
1003   uint16_t       FreqTableDclk     [NUM_DCLK_DPM_LEVELS    ];     // In MHz
1004   uint16_t       FreqTableSocclk   [NUM_SOCCLK_DPM_LEVELS  ];     // In MHz
1005   uint16_t       FreqTableUclk     [NUM_UCLK_DPM_LEVELS    ];     // In MHz
1006   uint16_t       FreqTableDispclk  [NUM_DISPCLK_DPM_LEVELS ];     // In MHz
1007   uint16_t       FreqTableDppClk   [NUM_DPPCLK_DPM_LEVELS  ];     // In MHz
1008   uint16_t       FreqTableDprefclk [NUM_DPREFCLK_DPM_LEVELS];     // In MHz
1009   uint16_t       FreqTableDcfclk   [NUM_DCFCLK_DPM_LEVELS  ];     // In MHz
1010   uint16_t       FreqTableDtbclk   [NUM_DTBCLK_DPM_LEVELS  ];     // In MHz
1011   uint16_t       FreqTableFclk     [NUM_FCLK_DPM_LEVELS    ];     // In MHz
1012
1013   uint32_t       DcModeMaxFreq     [PPCLK_COUNT            ];     // In MHz
1014
1015   // SECTION: DPM Configuration 2
1016   uint16_t       Mp0clkFreq        [NUM_MP0CLK_DPM_LEVELS];       // in MHz
1017   uint16_t       Mp0DpmVoltage     [NUM_MP0CLK_DPM_LEVELS];       // mV(Q2)
1018
1019   uint8_t         GfxclkSpare[2];
1020   uint16_t        GfxclkFreqCap;
1021
1022   //GFX Idle Power Settings
1023   uint16_t        GfxclkFgfxoffEntry;   // in Mhz
1024   uint16_t        GfxclkFgfxoffExitImu; // in Mhz
1025   uint16_t        GfxclkFgfxoffExitRlc; // in Mhz
1026   uint16_t        GfxclkThrottleClock;  //Used primarily in DCS
1027   uint8_t         EnableGfxPowerStagesGpio; //Genlk_vsync GPIO flag used to control gfx power stages
1028   uint8_t         GfxIdlePadding;
1029
1030   uint8_t          SmsRepairWRCKClkDivEn;
1031   uint8_t          SmsRepairWRCKClkDivVal;
1032   uint8_t          GfxOffEntryEarlyMGCGEn;
1033   uint8_t          GfxOffEntryForceCGCGEn;
1034   uint8_t          GfxOffEntryForceCGCGDelayEn;
1035   uint8_t          GfxOffEntryForceCGCGDelayVal; // in microseconds
1036
1037   uint16_t        GfxclkFreqGfxUlv; // in MHz
1038   uint8_t         GfxIdlePadding2[2];
1039
1040   uint32_t        GfxOffEntryHysteresis;
1041   uint32_t        GfxoffSpare[15];
1042
1043   // GFX GPO
1044   uint32_t        GfxGpoSpare[16];
1045
1046   // GFX DCS
1047
1048   uint16_t        DcsGfxOffVoltage;     //Voltage in mV(Q2) applied to VDDGFX when entering DCS GFXOFF phase
1049   uint16_t        PaddingDcs;
1050
1051   uint16_t        DcsMinGfxOffTime;     //Minimum amount of time PMFW shuts GFX OFF as part of GFX DCS phase
1052   uint16_t        DcsMaxGfxOffTime;      //Maximum amount of time PMFW can shut GFX OFF as part of GFX DCS phase at a stretch.
1053
1054   uint32_t        DcsMinCreditAccum;    //Min amount of positive credit accumulation before waking GFX up as part of DCS.
1055
1056   uint16_t        DcsExitHysteresis;    //The min amount of time power credit accumulator should have a value > 0 before SMU exits the DCS throttling phase.
1057   uint16_t        DcsTimeout;           //This is the amount of time SMU FW waits for RLC to put GFX into GFXOFF before reverting to the fallback mechanism of throttling GFXCLK to Fmin.
1058
1059
1060   uint32_t        DcsSpare[16];
1061
1062   // UCLK section
1063   uint8_t      UseStrobeModeOptimizations; //Set to indicate that FW should use strobe mode optimizations
1064   uint8_t      PaddingMem[3];
1065
1066   uint8_t      UclkDpmPstates     [NUM_UCLK_DPM_LEVELS];     // 4 DPM states, 0-P0, 1-P1, 2-P2, 3-P3.
1067   uint8_t      FreqTableUclkDiv  [NUM_UCLK_DPM_LEVELS    ];     // 0:Div-1, 1:Div-1/2, 2:Div-1/4, 3:Div-1/8
1068
1069   uint16_t     MemVmempVoltage   [NUM_UCLK_DPM_LEVELS];         // mV(Q2)
1070   uint16_t     MemVddioVoltage    [NUM_UCLK_DPM_LEVELS];         // mV(Q2)
1071
1072   //FCLK Section
1073
1074   uint8_t      FclkDpmUPstates[NUM_FCLK_DPM_LEVELS]; // U P-state ID associated with each FCLK DPM state.
1075   uint16_t     FclkDpmVddU[NUM_FCLK_DPM_LEVELS]; // mV(Q2) Vset U voltage associated with each FCLK DPM state.
1076   uint16_t     FclkDpmUSpeed[NUM_FCLK_DPM_LEVELS]; //U speed associated with each FCLK DPM state
1077   uint16_t     FclkDpmDisallowPstateFreq;  //Frequency which FW will target when indicated that display config cannot support P-state. Set to 0 use FW calculated value
1078   uint16_t     PaddingFclk;
1079
1080   // Link DPM Settings
1081   uint8_t      PcieGenSpeed[NUM_LINK_LEVELS];           ///< 0:PciE-gen1 1:PciE-gen2 2:PciE-gen3 3:PciE-gen4
1082   uint8_t      PcieLaneCount[NUM_LINK_LEVELS];          ///< 1=x1, 2=x2, 3=x4, 4=x8, 5=x12, 6=x16
1083   uint16_t     LclkFreq[NUM_LINK_LEVELS];
1084
1085   // SECTION: Fan Control
1086   uint16_t     FanStopTemp[TEMP_COUNT];          //Celsius
1087   uint16_t     FanStartTemp[TEMP_COUNT];         //Celsius
1088
1089   uint16_t     FanGain[TEMP_COUNT];
1090   uint16_t     FanGainPadding;
1091
1092   uint16_t     FanPwmMin;
1093   uint16_t     AcousticTargetRpmThreshold;
1094   uint16_t     AcousticLimitRpmThreshold;
1095   uint16_t     FanMaximumRpm;
1096   uint16_t     MGpuAcousticLimitRpmThreshold;
1097   uint16_t     FanTargetGfxclk;
1098   uint32_t     TempInputSelectMask;
1099   uint8_t      FanZeroRpmEnable;
1100   uint8_t      FanTachEdgePerRev;
1101   uint16_t     FanTargetTemperature[TEMP_COUNT];
1102
1103   // The following are AFC override parameters. Leave at 0 to use FW defaults.
1104   int16_t      FuzzyFan_ErrorSetDelta;
1105   int16_t      FuzzyFan_ErrorRateSetDelta;
1106   int16_t      FuzzyFan_PwmSetDelta;
1107   uint16_t     FuzzyFan_Reserved;
1108
1109   uint16_t     FwCtfLimit[TEMP_COUNT];
1110
1111   uint16_t IntakeTempEnableRPM;
1112   int16_t IntakeTempOffsetTemp;
1113   uint16_t IntakeTempReleaseTemp;
1114   uint16_t IntakeTempHighIntakeAcousticLimit;
1115   uint16_t IntakeTempAcouticLimitReleaseRate;
1116
1117   uint16_t FanStalledTempLimitOffset;
1118   uint16_t FanStalledTriggerRpm;
1119   uint16_t FanAbnormalTriggerRpm;
1120   uint16_t FanPadding;
1121
1122   uint32_t     FanSpare[14];
1123
1124   // SECTION: VDD_GFX AVFS
1125
1126   uint8_t      OverrideGfxAvfsFuses;
1127   uint8_t      GfxAvfsPadding[3];
1128
1129   uint32_t     L2HwRtAvfsFuses[PP_GRTAVFS_HW_FUSE_COUNT]; //see fusedoc for encoding
1130   uint32_t     SeHwRtAvfsFuses[PP_GRTAVFS_HW_FUSE_COUNT];
1131
1132   uint32_t     CommonRtAvfs[PP_GRTAVFS_FW_COMMON_FUSE_COUNT];
1133
1134   uint32_t     L2FwRtAvfsFuses[PP_GRTAVFS_FW_SEP_FUSE_COUNT];
1135   uint32_t     SeFwRtAvfsFuses[PP_GRTAVFS_FW_SEP_FUSE_COUNT];
1136
1137   uint32_t    Droop_PWL_F[PP_NUM_RTAVFS_PWL_ZONES];
1138   uint32_t    Droop_PWL_a[PP_NUM_RTAVFS_PWL_ZONES];
1139   uint32_t    Droop_PWL_b[PP_NUM_RTAVFS_PWL_ZONES];
1140   uint32_t    Droop_PWL_c[PP_NUM_RTAVFS_PWL_ZONES];
1141
1142   uint32_t   Static_PWL_Offset[PP_NUM_RTAVFS_PWL_ZONES];
1143
1144   uint32_t   dGbV_dT_vmin;
1145   uint32_t   dGbV_dT_vmax;
1146
1147   //Unused: PMFW-9370
1148   uint32_t   V2F_vmin_range_low;
1149   uint32_t   V2F_vmin_range_high;
1150   uint32_t   V2F_vmax_range_low;
1151   uint32_t   V2F_vmax_range_high;
1152
1153   AvfsDcBtcParams_t DcBtcGfxParams;
1154
1155   uint32_t   GfxAvfsSpare[32];
1156
1157   //SECTION: VDD_SOC AVFS
1158
1159   uint8_t      OverrideSocAvfsFuses;
1160   uint8_t      MinSocAvfsRevision;
1161   uint8_t      SocAvfsPadding[2];
1162
1163   AvfsFuseOverride_t SocAvfsFuseOverride[AVFS_D_COUNT];
1164
1165   DroopInt_t        dBtcGbSoc[AVFS_D_COUNT];            // GHz->V BtcGb
1166
1167   LinearInt_t       qAgingGb[AVFS_D_COUNT];          // GHz->V
1168
1169   QuadraticInt_t    qStaticVoltageOffset[AVFS_D_COUNT]; // GHz->V
1170
1171   AvfsDcBtcParams_t DcBtcSocParams[AVFS_D_COUNT];
1172
1173   uint32_t   SocAvfsSpare[32];
1174
1175   //SECTION: Boot clock and voltage values
1176   BootValues_t BootValues;
1177
1178   //SECTION: Driver Reported Clocks
1179   DriverReportedClocks_t DriverReportedClocks;
1180
1181   //SECTION: Message Limits
1182   MsgLimits_t MsgLimits;
1183
1184   //SECTION: OverDrive Limits
1185   OverDriveLimits_t OverDriveLimitsMin;
1186   OverDriveLimits_t OverDriveLimitsBasicMax;
1187   uint32_t reserved[22];
1188
1189   // SECTION: Advanced Options
1190   uint32_t          DebugOverrides;
1191
1192   // Section: Total Board Power idle vs active coefficients
1193   uint8_t     TotalBoardPowerSupport;
1194   uint8_t     TotalBoardPowerPadding[3];
1195
1196   int16_t     TotalIdleBoardPowerM;
1197   int16_t     TotalIdleBoardPowerB;
1198   int16_t     TotalBoardPowerM;
1199   int16_t     TotalBoardPowerB;
1200
1201   // SECTION: Sku Reserved
1202   uint32_t         Spare[61];
1203
1204   // Padding for MMHUB - do not modify this
1205   uint32_t     MmHubPadding[8];
1206
1207 } SkuTable_t;
1208
1209 typedef struct {
1210   // SECTION: Version
1211   uint32_t    Version; //should be unique to each board type
1212
1213
1214   // SECTION: I2C Control
1215   I2cControllerConfig_t  I2cControllers[NUM_I2C_CONTROLLERS];
1216
1217   // SECTION: SVI2 Board Parameters
1218   uint8_t      VddGfxVrMapping;   // Use VR_MAPPING* bitfields
1219   uint8_t      VddSocVrMapping;   // Use VR_MAPPING* bitfields
1220   uint8_t      VddMem0VrMapping;  // Use VR_MAPPING* bitfields
1221   uint8_t      VddMem1VrMapping;  // Use VR_MAPPING* bitfields
1222
1223   uint8_t      GfxUlvPhaseSheddingMask; // set this to 1 to set PSI0/1 to 1 in ULV mode
1224   uint8_t      SocUlvPhaseSheddingMask; // set this to 1 to set PSI0/1 to 1 in ULV mode
1225   uint8_t      VmempUlvPhaseSheddingMask; // set this to 1 to set PSI0/1 to 1 in ULV mode
1226   uint8_t      VddioUlvPhaseSheddingMask; // set this to 1 to set PSI0/1 to 1 in ULV mode
1227
1228   //SECTION SVI3 Board Parameters
1229   uint8_t      SlaveAddrMapping[SVI_PLANE_COUNT];
1230   uint8_t      VrPsiSupport[SVI_PLANE_COUNT];
1231
1232   uint8_t      PaddingPsi[SVI_PLANE_COUNT];
1233   uint8_t      EnablePsi6[SVI_PLANE_COUNT];       // only applicable in SVI3
1234
1235   // SECTION: Voltage Regulator Settings
1236   SviTelemetryScale_t SviTelemetryScale[SVI_PLANE_COUNT];
1237   uint32_t     VoltageTelemetryRatio[SVI_PLANE_COUNT]; // This is used for VDDIO  Svi2 Div Ratio workaround. It has 16 fractional bits (Q16.16)
1238
1239   uint8_t      DownSlewRateVr[SVI_PLANE_COUNT];
1240
1241   // SECTION: GPIO Settings
1242
1243   uint8_t      LedOffGpio;
1244   uint8_t      FanOffGpio;
1245   uint8_t      GfxVrPowerStageOffGpio;
1246
1247   uint8_t      AcDcGpio;        // GPIO pin configured for AC/DC switching
1248   uint8_t      AcDcPolarity;    // GPIO polarity for AC/DC switching
1249   uint8_t      VR0HotGpio;      // GPIO pin configured for VR0 HOT event
1250   uint8_t      VR0HotPolarity;  // GPIO polarity for VR0 HOT event
1251
1252   uint8_t      GthrGpio;        // GPIO pin configured for GTHR Event
1253   uint8_t      GthrPolarity;    // replace GPIO polarity for GTHR
1254
1255   // LED Display Settings
1256   uint8_t      LedPin0;         // GPIO number for LedPin[0]
1257   uint8_t      LedPin1;         // GPIO number for LedPin[1]
1258   uint8_t      LedPin2;         // GPIO number for LedPin[2]
1259   uint8_t      LedEnableMask;
1260
1261   uint8_t      LedPcie;        // GPIO number for PCIE results
1262   uint8_t      LedError;       // GPIO number for Error Cases
1263
1264   // SECTION: Clock Spread Spectrum
1265
1266   // UCLK Spread Spectrum
1267   uint8_t      UclkTrainingModeSpreadPercent;
1268   uint8_t      UclkSpreadPadding;
1269   uint16_t     UclkSpreadFreq;      // kHz
1270
1271   // UCLK Spread Spectrum
1272   uint8_t      UclkSpreadPercent[MEM_VENDOR_COUNT];
1273
1274   // FCLK Spread Spectrum
1275   uint8_t      FclkSpreadPadding;
1276   uint8_t      FclkSpreadPercent;   // Q4.4
1277   uint16_t     FclkSpreadFreq;      // kHz
1278
1279   // Section: Memory Config
1280   uint8_t      DramWidth; // Width of interface to the channel for each DRAM module. See DRAM_BIT_WIDTH_TYPE_e
1281   uint8_t      PaddingMem1[7];
1282
1283   // SECTION: UMC feature flags
1284   uint8_t      HsrEnabled;
1285   uint8_t      VddqOffEnabled;
1286   uint8_t      PaddingUmcFlags[2];
1287
1288   uint32_t    PostVoltageSetBacoDelay; // in microseconds. Amount of time FW will wait after power good is established or PSI0 command is issued
1289   uint32_t    BacoEntryDelay; // in milliseconds. Amount of time FW will wait to trigger BACO entry after receiving entry notification from OS
1290
1291   // SECTION: Board Reserved
1292   uint32_t     BoardSpare[64];
1293
1294   // SECTION: Structure Padding
1295
1296   // Padding for MMHUB - do not modify this
1297   uint32_t     MmHubPadding[8];
1298 } BoardTable_t;
1299
1300 typedef struct {
1301   SkuTable_t SkuTable;
1302   BoardTable_t BoardTable;
1303 } PPTable_t;
1304
1305 typedef struct {
1306   // Time constant parameters for clock averages in ms
1307   uint16_t     GfxclkAverageLpfTau;
1308   uint16_t     FclkAverageLpfTau;
1309   uint16_t     UclkAverageLpfTau;
1310   uint16_t     GfxActivityLpfTau;
1311   uint16_t     UclkActivityLpfTau;
1312   uint16_t     SocketPowerLpfTau;
1313   uint16_t     VcnClkAverageLpfTau;
1314   uint16_t     VcnUsageAverageLpfTau;
1315 } DriverSmuConfig_t;
1316
1317 typedef struct {
1318   DriverSmuConfig_t DriverSmuConfig;
1319
1320   uint32_t     Spare[8];
1321   // Padding - ignore
1322   uint32_t     MmHubPadding[8]; // SMU internal use
1323 } DriverSmuConfigExternal_t;
1324
1325
1326 typedef struct {
1327
1328   uint16_t       FreqTableGfx      [NUM_GFXCLK_DPM_LEVELS  ];     // In MHz
1329   uint16_t       FreqTableVclk     [NUM_VCLK_DPM_LEVELS    ];     // In MHz
1330   uint16_t       FreqTableDclk     [NUM_DCLK_DPM_LEVELS    ];     // In MHz
1331   uint16_t       FreqTableSocclk   [NUM_SOCCLK_DPM_LEVELS  ];     // In MHz
1332   uint16_t       FreqTableUclk     [NUM_UCLK_DPM_LEVELS    ];     // In MHz
1333   uint16_t       FreqTableDispclk  [NUM_DISPCLK_DPM_LEVELS ];     // In MHz
1334   uint16_t       FreqTableDppClk   [NUM_DPPCLK_DPM_LEVELS  ];     // In MHz
1335   uint16_t       FreqTableDprefclk [NUM_DPREFCLK_DPM_LEVELS];     // In MHz
1336   uint16_t       FreqTableDcfclk   [NUM_DCFCLK_DPM_LEVELS  ];     // In MHz
1337   uint16_t       FreqTableDtbclk   [NUM_DTBCLK_DPM_LEVELS  ];     // In MHz
1338   uint16_t       FreqTableFclk     [NUM_FCLK_DPM_LEVELS    ];     // In MHz
1339
1340   uint16_t       DcModeMaxFreq     [PPCLK_COUNT            ];     // In MHz
1341
1342   uint16_t       Padding;
1343
1344   uint32_t Spare[32];
1345
1346   // Padding - ignore
1347   uint32_t     MmHubPadding[8]; // SMU internal use
1348
1349 } DriverInfoTable_t;
1350
1351 typedef struct {
1352   uint32_t CurrClock[PPCLK_COUNT];
1353
1354   uint16_t AverageGfxclkFrequencyTarget;
1355   uint16_t AverageGfxclkFrequencyPreDs;
1356   uint16_t AverageGfxclkFrequencyPostDs;
1357   uint16_t AverageFclkFrequencyPreDs;
1358   uint16_t AverageFclkFrequencyPostDs;
1359   uint16_t AverageMemclkFrequencyPreDs  ; // this is scaled to actual memory clock
1360   uint16_t AverageMemclkFrequencyPostDs  ; // this is scaled to actual memory clock
1361   uint16_t AverageVclk0Frequency  ;
1362   uint16_t AverageDclk0Frequency  ;
1363   uint16_t AverageVclk1Frequency  ;
1364   uint16_t AverageDclk1Frequency  ;
1365   uint16_t PCIeBusy;
1366   uint16_t dGPU_W_MAX;
1367   uint16_t padding;
1368
1369   uint32_t MetricsCounter;
1370
1371   uint16_t AvgVoltage[SVI_PLANE_COUNT];
1372   uint16_t AvgCurrent[SVI_PLANE_COUNT];
1373
1374   uint16_t AverageGfxActivity    ;
1375   uint16_t AverageUclkActivity   ;
1376   uint16_t Vcn0ActivityPercentage  ;
1377   uint16_t Vcn1ActivityPercentage  ;
1378
1379   uint32_t EnergyAccumulator;
1380   uint16_t AverageSocketPower;
1381   uint16_t AverageTotalBoardPower;
1382
1383   uint16_t AvgTemperature[TEMP_COUNT];
1384   uint16_t TempPadding;
1385
1386   uint8_t  PcieRate               ;
1387   uint8_t  PcieWidth              ;
1388
1389   uint8_t  AvgFanPwm;
1390   uint8_t  Padding[1];
1391   uint16_t AvgFanRpm;
1392
1393
1394   uint8_t ThrottlingPercentage[THROTTLER_COUNT];
1395
1396   //metrics for D3hot entry/exit and driver ARM msgs
1397   uint32_t D3HotEntryCountPerMode[D3HOT_SEQUENCE_COUNT];
1398   uint32_t D3HotExitCountPerMode[D3HOT_SEQUENCE_COUNT];
1399   uint32_t ArmMsgReceivedCountPerMode[D3HOT_SEQUENCE_COUNT];
1400
1401   uint16_t ApuSTAPMSmartShiftLimit;
1402   uint16_t ApuSTAPMLimit;
1403   uint16_t AvgApuSocketPower;
1404
1405   uint16_t AverageUclkActivity_MAX;
1406
1407   uint32_t PublicSerialNumberLower;
1408   uint32_t PublicSerialNumberUpper;
1409
1410 } SmuMetrics_t;
1411
1412 typedef struct {
1413   SmuMetrics_t SmuMetrics;
1414   uint32_t Spare[30];
1415
1416   // Padding - ignore
1417   uint32_t     MmHubPadding[8]; // SMU internal use
1418 } SmuMetricsExternal_t;
1419
1420 typedef struct {
1421   uint8_t  WmSetting;
1422   uint8_t  Flags;
1423   uint8_t  Padding[2];
1424
1425 } WatermarkRowGeneric_t;
1426
1427 #define NUM_WM_RANGES 4
1428
1429 typedef enum {
1430   WATERMARKS_CLOCK_RANGE = 0,
1431   WATERMARKS_DUMMY_PSTATE,
1432   WATERMARKS_MALL,
1433   WATERMARKS_COUNT,
1434 } WATERMARKS_FLAGS_e;
1435
1436 typedef struct {
1437   // Watermarks
1438   WatermarkRowGeneric_t WatermarkRow[NUM_WM_RANGES];
1439 } Watermarks_t;
1440
1441 typedef struct {
1442   Watermarks_t Watermarks;
1443   uint32_t  Spare[16];
1444
1445   uint32_t     MmHubPadding[8]; // SMU internal use
1446 } WatermarksExternal_t;
1447
1448 typedef struct {
1449   uint16_t avgPsmCount[214];
1450   uint16_t minPsmCount[214];
1451   float    avgPsmVoltage[214];
1452   float    minPsmVoltage[214];
1453 } AvfsDebugTable_t;
1454
1455 typedef struct {
1456   AvfsDebugTable_t AvfsDebugTable;
1457
1458   uint32_t     MmHubPadding[8]; // SMU internal use
1459 } AvfsDebugTableExternal_t;
1460
1461
1462 typedef struct {
1463   uint8_t   Gfx_ActiveHystLimit;
1464   uint8_t   Gfx_IdleHystLimit;
1465   uint8_t   Gfx_FPS;
1466   uint8_t   Gfx_MinActiveFreqType;
1467   uint8_t   Gfx_BoosterFreqType;
1468   uint8_t   PaddingGfx;
1469   uint16_t  Gfx_MinActiveFreq;              // MHz
1470   uint16_t  Gfx_BoosterFreq;                // MHz
1471   uint16_t  Gfx_PD_Data_time_constant;      // Time constant of PD controller in ms
1472   uint32_t  Gfx_PD_Data_limit_a;            // Q16
1473   uint32_t  Gfx_PD_Data_limit_b;            // Q16
1474   uint32_t  Gfx_PD_Data_limit_c;            // Q16
1475   uint32_t  Gfx_PD_Data_error_coeff;        // Q16
1476   uint32_t  Gfx_PD_Data_error_rate_coeff;   // Q16
1477
1478   uint8_t   Fclk_ActiveHystLimit;
1479   uint8_t   Fclk_IdleHystLimit;
1480   uint8_t   Fclk_FPS;
1481   uint8_t   Fclk_MinActiveFreqType;
1482   uint8_t   Fclk_BoosterFreqType;
1483   uint8_t   PaddingFclk;
1484   uint16_t  Fclk_MinActiveFreq;              // MHz
1485   uint16_t  Fclk_BoosterFreq;                // MHz
1486   uint16_t  Fclk_PD_Data_time_constant;      // Time constant of PD controller in ms
1487   uint32_t  Fclk_PD_Data_limit_a;            // Q16
1488   uint32_t  Fclk_PD_Data_limit_b;            // Q16
1489   uint32_t  Fclk_PD_Data_limit_c;            // Q16
1490   uint32_t  Fclk_PD_Data_error_coeff;        // Q16
1491   uint32_t  Fclk_PD_Data_error_rate_coeff;   // Q16
1492
1493   uint32_t  Mem_UpThreshold_Limit[NUM_UCLK_DPM_LEVELS];          // Q16
1494   uint8_t   Mem_UpHystLimit[NUM_UCLK_DPM_LEVELS];
1495   uint8_t   Mem_DownHystLimit[NUM_UCLK_DPM_LEVELS];
1496   uint16_t  Mem_Fps;
1497   uint8_t   padding[2];
1498
1499 } DpmActivityMonitorCoeffInt_t;
1500
1501
1502 typedef struct {
1503   DpmActivityMonitorCoeffInt_t DpmActivityMonitorCoeffInt;
1504   uint32_t     MmHubPadding[8]; // SMU internal use
1505 } DpmActivityMonitorCoeffIntExternal_t;
1506
1507
1508
1509 // Workload bits
1510 #define WORKLOAD_PPLIB_DEFAULT_BIT        0
1511 #define WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT 1
1512 #define WORKLOAD_PPLIB_POWER_SAVING_BIT   2
1513 #define WORKLOAD_PPLIB_VIDEO_BIT          3
1514 #define WORKLOAD_PPLIB_VR_BIT             4
1515 #define WORKLOAD_PPLIB_COMPUTE_BIT        5
1516 #define WORKLOAD_PPLIB_CUSTOM_BIT         6
1517 #define WORKLOAD_PPLIB_WINDOW_3D_BIT      7
1518 #define WORKLOAD_PPLIB_COUNT              8
1519
1520
1521 // These defines are used with the following messages:
1522 // SMC_MSG_TransferTableDram2Smu
1523 // SMC_MSG_TransferTableSmu2Dram
1524
1525 // Table transfer status
1526 #define TABLE_TRANSFER_OK         0x0
1527 #define TABLE_TRANSFER_FAILED     0xFF
1528 #define TABLE_TRANSFER_PENDING    0xAB
1529
1530 // Table types
1531 #define TABLE_PPTABLE                 0
1532 #define TABLE_COMBO_PPTABLE           1
1533 #define TABLE_WATERMARKS              2
1534 #define TABLE_AVFS_PSM_DEBUG          3
1535 #define TABLE_PMSTATUSLOG             4
1536 #define TABLE_SMU_METRICS             5
1537 #define TABLE_DRIVER_SMU_CONFIG       6
1538 #define TABLE_ACTIVITY_MONITOR_COEFF  7
1539 #define TABLE_OVERDRIVE               8
1540 #define TABLE_I2C_COMMANDS            9
1541 #define TABLE_DRIVER_INFO             10
1542 #define TABLE_ECCINFO                 11
1543 #define TABLE_COUNT                   12
1544
1545 //IH Interupt ID
1546 #define IH_INTERRUPT_ID_TO_DRIVER                   0xFE
1547 #define IH_INTERRUPT_CONTEXT_ID_BACO                0x2
1548 #define IH_INTERRUPT_CONTEXT_ID_AC                  0x3
1549 #define IH_INTERRUPT_CONTEXT_ID_DC                  0x4
1550 #define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0            0x5
1551 #define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3            0x6
1552 #define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING  0x7
1553
1554 #endif