2 * Copyright 2019 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #define SWSMU_CODE_LAYER_L2
26 #include <linux/firmware.h>
27 #include <linux/pci.h>
28 #include <linux/i2c.h>
30 #include "amdgpu_dpm.h"
31 #include "amdgpu_smu.h"
32 #include "atomfirmware.h"
33 #include "amdgpu_atomfirmware.h"
34 #include "amdgpu_atombios.h"
35 #include "smu_v11_0.h"
36 #include "smu11_driver_if_sienna_cichlid.h"
37 #include "soc15_common.h"
39 #include "sienna_cichlid_ppt.h"
40 #include "smu_v11_0_7_pptable.h"
41 #include "smu_v11_0_7_ppsmc.h"
42 #include "nbio/nbio_2_3_offset.h"
43 #include "nbio/nbio_2_3_sh_mask.h"
44 #include "thm/thm_11_0_2_offset.h"
45 #include "thm/thm_11_0_2_sh_mask.h"
46 #include "mp/mp_11_0_offset.h"
47 #include "mp/mp_11_0_sh_mask.h"
49 #include "asic_reg/mp/mp_11_0_sh_mask.h"
50 #include "amdgpu_ras.h"
54 * DO NOT use these for err/warn/info/debug messages.
55 * Use dev_err, dev_warn, dev_info and dev_dbg instead.
56 * They are more MGPU friendly.
63 #define FEATURE_MASK(feature) (1ULL << feature)
64 #define SMC_DPM_FEATURE ( \
65 FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) | \
66 FEATURE_MASK(FEATURE_DPM_GFXCLK_BIT) | \
67 FEATURE_MASK(FEATURE_DPM_UCLK_BIT) | \
68 FEATURE_MASK(FEATURE_DPM_LINK_BIT) | \
69 FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) | \
70 FEATURE_MASK(FEATURE_DPM_FCLK_BIT) | \
71 FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT) | \
72 FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT))
74 #define SMU_11_0_7_GFX_BUSY_THRESHOLD 15
76 #define GET_PPTABLE_MEMBER(field, member) do {\
77 if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))\
78 (*member) = (smu->smu_table.driver_pptable + offsetof(PPTable_beige_goby_t, field));\
80 (*member) = (smu->smu_table.driver_pptable + offsetof(PPTable_t, field));\
83 /* STB FIFO depth is in 64bit units */
84 #define SIENNA_CICHLID_STB_DEPTH_UNIT_BYTES 8
87 * SMU support ECCTABLE since version 58.70.0,
88 * use this to check whether ECCTABLE feature is supported.
90 #define SUPPORT_ECCTABLE_SMU_VERSION 0x003a4600
92 static int get_table_size(struct smu_context *smu)
94 if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))
95 return sizeof(PPTable_beige_goby_t);
97 return sizeof(PPTable_t);
100 static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT] = {
101 MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 1),
102 MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion, 1),
103 MSG_MAP(GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion, 1),
104 MSG_MAP(SetAllowedFeaturesMaskLow, PPSMC_MSG_SetAllowedFeaturesMaskLow, 0),
105 MSG_MAP(SetAllowedFeaturesMaskHigh, PPSMC_MSG_SetAllowedFeaturesMaskHigh, 0),
106 MSG_MAP(EnableAllSmuFeatures, PPSMC_MSG_EnableAllSmuFeatures, 0),
107 MSG_MAP(DisableAllSmuFeatures, PPSMC_MSG_DisableAllSmuFeatures, 0),
108 MSG_MAP(EnableSmuFeaturesLow, PPSMC_MSG_EnableSmuFeaturesLow, 1),
109 MSG_MAP(EnableSmuFeaturesHigh, PPSMC_MSG_EnableSmuFeaturesHigh, 1),
110 MSG_MAP(DisableSmuFeaturesLow, PPSMC_MSG_DisableSmuFeaturesLow, 1),
111 MSG_MAP(DisableSmuFeaturesHigh, PPSMC_MSG_DisableSmuFeaturesHigh, 1),
112 MSG_MAP(GetEnabledSmuFeaturesLow, PPSMC_MSG_GetRunningSmuFeaturesLow, 1),
113 MSG_MAP(GetEnabledSmuFeaturesHigh, PPSMC_MSG_GetRunningSmuFeaturesHigh, 1),
114 MSG_MAP(SetWorkloadMask, PPSMC_MSG_SetWorkloadMask, 1),
115 MSG_MAP(SetPptLimit, PPSMC_MSG_SetPptLimit, 0),
116 MSG_MAP(SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh, 1),
117 MSG_MAP(SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow, 1),
118 MSG_MAP(SetToolsDramAddrHigh, PPSMC_MSG_SetToolsDramAddrHigh, 0),
119 MSG_MAP(SetToolsDramAddrLow, PPSMC_MSG_SetToolsDramAddrLow, 0),
120 MSG_MAP(TransferTableSmu2Dram, PPSMC_MSG_TransferTableSmu2Dram, 1),
121 MSG_MAP(TransferTableDram2Smu, PPSMC_MSG_TransferTableDram2Smu, 0),
122 MSG_MAP(UseDefaultPPTable, PPSMC_MSG_UseDefaultPPTable, 0),
123 MSG_MAP(RunDcBtc, PPSMC_MSG_RunDcBtc, 0),
124 MSG_MAP(EnterBaco, PPSMC_MSG_EnterBaco, 0),
125 MSG_MAP(SetSoftMinByFreq, PPSMC_MSG_SetSoftMinByFreq, 1),
126 MSG_MAP(SetSoftMaxByFreq, PPSMC_MSG_SetSoftMaxByFreq, 1),
127 MSG_MAP(SetHardMinByFreq, PPSMC_MSG_SetHardMinByFreq, 1),
128 MSG_MAP(SetHardMaxByFreq, PPSMC_MSG_SetHardMaxByFreq, 0),
129 MSG_MAP(GetMinDpmFreq, PPSMC_MSG_GetMinDpmFreq, 1),
130 MSG_MAP(GetMaxDpmFreq, PPSMC_MSG_GetMaxDpmFreq, 1),
131 MSG_MAP(GetDpmFreqByIndex, PPSMC_MSG_GetDpmFreqByIndex, 1),
132 MSG_MAP(SetGeminiMode, PPSMC_MSG_SetGeminiMode, 0),
133 MSG_MAP(SetGeminiApertureHigh, PPSMC_MSG_SetGeminiApertureHigh, 0),
134 MSG_MAP(SetGeminiApertureLow, PPSMC_MSG_SetGeminiApertureLow, 0),
135 MSG_MAP(OverridePcieParameters, PPSMC_MSG_OverridePcieParameters, 0),
136 MSG_MAP(ReenableAcDcInterrupt, PPSMC_MSG_ReenableAcDcInterrupt, 0),
137 MSG_MAP(NotifyPowerSource, PPSMC_MSG_NotifyPowerSource, 0),
138 MSG_MAP(SetUclkFastSwitch, PPSMC_MSG_SetUclkFastSwitch, 0),
139 MSG_MAP(SetVideoFps, PPSMC_MSG_SetVideoFps, 0),
140 MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload, 1),
141 MSG_MAP(AllowGfxOff, PPSMC_MSG_AllowGfxOff, 0),
142 MSG_MAP(DisallowGfxOff, PPSMC_MSG_DisallowGfxOff, 0),
143 MSG_MAP(GetPptLimit, PPSMC_MSG_GetPptLimit, 0),
144 MSG_MAP(GetDcModeMaxDpmFreq, PPSMC_MSG_GetDcModeMaxDpmFreq, 1),
145 MSG_MAP(ExitBaco, PPSMC_MSG_ExitBaco, 0),
146 MSG_MAP(PowerUpVcn, PPSMC_MSG_PowerUpVcn, 0),
147 MSG_MAP(PowerDownVcn, PPSMC_MSG_PowerDownVcn, 0),
148 MSG_MAP(PowerUpJpeg, PPSMC_MSG_PowerUpJpeg, 0),
149 MSG_MAP(PowerDownJpeg, PPSMC_MSG_PowerDownJpeg, 0),
150 MSG_MAP(BacoAudioD3PME, PPSMC_MSG_BacoAudioD3PME, 0),
151 MSG_MAP(ArmD3, PPSMC_MSG_ArmD3, 0),
152 MSG_MAP(Mode1Reset, PPSMC_MSG_Mode1Reset, 0),
153 MSG_MAP(SetMGpuFanBoostLimitRpm, PPSMC_MSG_SetMGpuFanBoostLimitRpm, 0),
154 MSG_MAP(SetGpoFeaturePMask, PPSMC_MSG_SetGpoFeaturePMask, 0),
155 MSG_MAP(DisallowGpo, PPSMC_MSG_DisallowGpo, 0),
156 MSG_MAP(Enable2ndUSB20Port, PPSMC_MSG_Enable2ndUSB20Port, 0),
157 MSG_MAP(DriverMode2Reset, PPSMC_MSG_DriverMode2Reset, 0),
160 static struct cmn2asic_mapping sienna_cichlid_clk_map[SMU_CLK_COUNT] = {
161 CLK_MAP(GFXCLK, PPCLK_GFXCLK),
162 CLK_MAP(SCLK, PPCLK_GFXCLK),
163 CLK_MAP(SOCCLK, PPCLK_SOCCLK),
164 CLK_MAP(FCLK, PPCLK_FCLK),
165 CLK_MAP(UCLK, PPCLK_UCLK),
166 CLK_MAP(MCLK, PPCLK_UCLK),
167 CLK_MAP(DCLK, PPCLK_DCLK_0),
168 CLK_MAP(DCLK1, PPCLK_DCLK_1),
169 CLK_MAP(VCLK, PPCLK_VCLK_0),
170 CLK_MAP(VCLK1, PPCLK_VCLK_1),
171 CLK_MAP(DCEFCLK, PPCLK_DCEFCLK),
172 CLK_MAP(DISPCLK, PPCLK_DISPCLK),
173 CLK_MAP(PIXCLK, PPCLK_PIXCLK),
174 CLK_MAP(PHYCLK, PPCLK_PHYCLK),
177 static struct cmn2asic_mapping sienna_cichlid_feature_mask_map[SMU_FEATURE_COUNT] = {
178 FEA_MAP(DPM_PREFETCHER),
180 FEA_MAP(DPM_GFX_GPO),
186 FEA_MAP(DPM_DCEFCLK),
188 FEA_MAP(MEM_VDDCI_SCALING),
189 FEA_MAP(MEM_MVDD_SCALING),
201 FEA_MAP(RSMU_SMN_CG),
210 FEA_MAP(FAN_CONTROL),
214 FEA_MAP(LED_DISPLAY),
216 FEA_MAP(OUT_OF_BAND_MONITOR),
217 FEA_MAP(TEMP_DEPENDENT_VMIN),
223 static struct cmn2asic_mapping sienna_cichlid_table_map[SMU_TABLE_COUNT] = {
226 TAB_MAP(AVFS_PSM_DEBUG),
227 TAB_MAP(AVFS_FUSE_OVERRIDE),
228 TAB_MAP(PMSTATUSLOG),
229 TAB_MAP(SMU_METRICS),
230 TAB_MAP(DRIVER_SMU_CONFIG),
231 TAB_MAP(ACTIVITY_MONITOR_COEFF),
233 TAB_MAP(I2C_COMMANDS),
238 static struct cmn2asic_mapping sienna_cichlid_pwr_src_map[SMU_POWER_SOURCE_COUNT] = {
243 static struct cmn2asic_mapping sienna_cichlid_workload_map[PP_SMC_POWER_PROFILE_COUNT] = {
244 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT, WORKLOAD_PPLIB_DEFAULT_BIT),
245 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_FULLSCREEN3D, WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT),
246 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),
247 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),
248 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR, WORKLOAD_PPLIB_VR_BIT),
249 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE, WORKLOAD_PPLIB_COMPUTE_BIT),
250 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),
253 static const uint8_t sienna_cichlid_throttler_map[] = {
254 [THROTTLER_TEMP_EDGE_BIT] = (SMU_THROTTLER_TEMP_EDGE_BIT),
255 [THROTTLER_TEMP_HOTSPOT_BIT] = (SMU_THROTTLER_TEMP_HOTSPOT_BIT),
256 [THROTTLER_TEMP_MEM_BIT] = (SMU_THROTTLER_TEMP_MEM_BIT),
257 [THROTTLER_TEMP_VR_GFX_BIT] = (SMU_THROTTLER_TEMP_VR_GFX_BIT),
258 [THROTTLER_TEMP_VR_MEM0_BIT] = (SMU_THROTTLER_TEMP_VR_MEM0_BIT),
259 [THROTTLER_TEMP_VR_MEM1_BIT] = (SMU_THROTTLER_TEMP_VR_MEM1_BIT),
260 [THROTTLER_TEMP_VR_SOC_BIT] = (SMU_THROTTLER_TEMP_VR_SOC_BIT),
261 [THROTTLER_TEMP_LIQUID0_BIT] = (SMU_THROTTLER_TEMP_LIQUID0_BIT),
262 [THROTTLER_TEMP_LIQUID1_BIT] = (SMU_THROTTLER_TEMP_LIQUID1_BIT),
263 [THROTTLER_TDC_GFX_BIT] = (SMU_THROTTLER_TDC_GFX_BIT),
264 [THROTTLER_TDC_SOC_BIT] = (SMU_THROTTLER_TDC_SOC_BIT),
265 [THROTTLER_PPT0_BIT] = (SMU_THROTTLER_PPT0_BIT),
266 [THROTTLER_PPT1_BIT] = (SMU_THROTTLER_PPT1_BIT),
267 [THROTTLER_PPT2_BIT] = (SMU_THROTTLER_PPT2_BIT),
268 [THROTTLER_PPT3_BIT] = (SMU_THROTTLER_PPT3_BIT),
269 [THROTTLER_FIT_BIT] = (SMU_THROTTLER_FIT_BIT),
270 [THROTTLER_PPM_BIT] = (SMU_THROTTLER_PPM_BIT),
271 [THROTTLER_APCC_BIT] = (SMU_THROTTLER_APCC_BIT),
275 sienna_cichlid_get_allowed_feature_mask(struct smu_context *smu,
276 uint32_t *feature_mask, uint32_t num)
278 struct amdgpu_device *adev = smu->adev;
283 memset(feature_mask, 0, sizeof(uint32_t) * num);
285 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT)
286 | FEATURE_MASK(FEATURE_DPM_FCLK_BIT)
287 | FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT)
288 | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT)
289 | FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT)
290 | FEATURE_MASK(FEATURE_DS_FCLK_BIT)
291 | FEATURE_MASK(FEATURE_DS_UCLK_BIT)
292 | FEATURE_MASK(FEATURE_FW_DSTATE_BIT)
293 | FEATURE_MASK(FEATURE_DF_CSTATE_BIT)
294 | FEATURE_MASK(FEATURE_RSMU_SMN_CG_BIT)
295 | FEATURE_MASK(FEATURE_GFX_SS_BIT)
296 | FEATURE_MASK(FEATURE_VR0HOT_BIT)
297 | FEATURE_MASK(FEATURE_PPT_BIT)
298 | FEATURE_MASK(FEATURE_TDC_BIT)
299 | FEATURE_MASK(FEATURE_BACO_BIT)
300 | FEATURE_MASK(FEATURE_APCC_DFLL_BIT)
301 | FEATURE_MASK(FEATURE_FW_CTF_BIT)
302 | FEATURE_MASK(FEATURE_FAN_CONTROL_BIT)
303 | FEATURE_MASK(FEATURE_THERMAL_BIT)
304 | FEATURE_MASK(FEATURE_OUT_OF_BAND_MONITOR_BIT);
306 if (adev->pm.pp_feature & PP_SCLK_DPM_MASK) {
307 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_GFXCLK_BIT);
308 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_GFX_GPO_BIT);
311 if ((adev->pm.pp_feature & PP_GFX_DCS_MASK) &&
312 (adev->ip_versions[MP1_HWIP][0] > IP_VERSION(11, 0, 7)) &&
313 !(adev->flags & AMD_IS_APU))
314 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_GFX_DCS_BIT);
316 if (adev->pm.pp_feature & PP_MCLK_DPM_MASK)
317 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_UCLK_BIT)
318 | FEATURE_MASK(FEATURE_MEM_VDDCI_SCALING_BIT)
319 | FEATURE_MASK(FEATURE_MEM_MVDD_SCALING_BIT);
321 if (adev->pm.pp_feature & PP_PCIE_DPM_MASK)
322 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_LINK_BIT);
324 if (adev->pm.pp_feature & PP_DCEFCLK_DPM_MASK)
325 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT);
327 if (adev->pm.pp_feature & PP_SOCCLK_DPM_MASK)
328 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT);
330 if (adev->pm.pp_feature & PP_ULV_MASK)
331 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_GFX_ULV_BIT);
333 if (adev->pm.pp_feature & PP_SCLK_DEEP_SLEEP_MASK)
334 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DS_GFXCLK_BIT);
336 if (adev->pm.pp_feature & PP_GFXOFF_MASK)
337 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_GFXOFF_BIT);
339 if (smu->adev->pg_flags & AMD_PG_SUPPORT_ATHUB)
340 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_ATHUB_PG_BIT);
342 if (smu->adev->pg_flags & AMD_PG_SUPPORT_MMHUB)
343 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_MMHUB_PG_BIT);
345 if (smu->adev->pg_flags & AMD_PG_SUPPORT_VCN ||
346 smu->adev->pg_flags & AMD_PG_SUPPORT_JPEG)
347 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_MM_DPM_PG_BIT);
349 if (smu->dc_controlled_by_gpio)
350 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_ACDC_BIT);
352 if (amdgpu_device_should_use_aspm(adev))
353 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DS_LCLK_BIT);
358 static void sienna_cichlid_check_bxco_support(struct smu_context *smu)
360 struct smu_table_context *table_context = &smu->smu_table;
361 struct smu_11_0_7_powerplay_table *powerplay_table =
362 table_context->power_play_table;
363 struct smu_baco_context *smu_baco = &smu->smu_baco;
364 struct amdgpu_device *adev = smu->adev;
367 if (powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_BACO) {
368 val = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP0);
369 smu_baco->platform_support =
370 (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true :
374 * Disable BACO entry/exit completely on below SKUs to
375 * avoid hardware intermittent failures.
377 if (((adev->pdev->device == 0x73A1) &&
378 (adev->pdev->revision == 0x00)) ||
379 ((adev->pdev->device == 0x73BF) &&
380 (adev->pdev->revision == 0xCF)) ||
381 ((adev->pdev->device == 0x7422) &&
382 (adev->pdev->revision == 0x00)) ||
383 ((adev->pdev->device == 0x73A3) &&
384 (adev->pdev->revision == 0x00)) ||
385 ((adev->pdev->device == 0x73E3) &&
386 (adev->pdev->revision == 0x00)))
387 smu_baco->platform_support = false;
392 static void sienna_cichlid_check_fan_support(struct smu_context *smu)
394 struct smu_table_context *table_context = &smu->smu_table;
395 PPTable_t *pptable = table_context->driver_pptable;
396 uint64_t features = *(uint64_t *) pptable->FeaturesToRun;
398 /* Fan control is not possible if PPTable has it disabled */
399 smu->adev->pm.no_fan =
400 !(features & (1ULL << FEATURE_FAN_CONTROL_BIT));
401 if (smu->adev->pm.no_fan)
402 dev_info_once(smu->adev->dev,
403 "PMFW based fan control disabled");
406 static int sienna_cichlid_check_powerplay_table(struct smu_context *smu)
408 struct smu_table_context *table_context = &smu->smu_table;
409 struct smu_11_0_7_powerplay_table *powerplay_table =
410 table_context->power_play_table;
412 if (powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_HARDWAREDC)
413 smu->dc_controlled_by_gpio = true;
415 sienna_cichlid_check_bxco_support(smu);
416 sienna_cichlid_check_fan_support(smu);
418 table_context->thermal_controller_type =
419 powerplay_table->thermal_controller_type;
422 * Instead of having its own buffer space and get overdrive_table copied,
423 * smu->od_settings just points to the actual overdrive_table
425 smu->od_settings = &powerplay_table->overdrive_table;
430 static int sienna_cichlid_append_powerplay_table(struct smu_context *smu)
432 struct atom_smc_dpm_info_v4_9 *smc_dpm_table;
434 PPTable_beige_goby_t *ppt_beige_goby;
437 if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))
438 ppt_beige_goby = smu->smu_table.driver_pptable;
440 ppt = smu->smu_table.driver_pptable;
442 index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
445 ret = amdgpu_atombios_get_data_table(smu->adev, index, NULL, NULL, NULL,
446 (uint8_t **)&smc_dpm_table);
450 if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))
451 smu_memcpy_trailing(ppt_beige_goby, I2cControllers, BoardReserved,
452 smc_dpm_table, I2cControllers);
454 smu_memcpy_trailing(ppt, I2cControllers, BoardReserved,
455 smc_dpm_table, I2cControllers);
460 static int sienna_cichlid_store_powerplay_table(struct smu_context *smu)
462 struct smu_table_context *table_context = &smu->smu_table;
463 struct smu_11_0_7_powerplay_table *powerplay_table =
464 table_context->power_play_table;
467 table_size = get_table_size(smu);
468 memcpy(table_context->driver_pptable, &powerplay_table->smc_pptable,
474 static int sienna_cichlid_patch_pptable_quirk(struct smu_context *smu)
476 struct amdgpu_device *adev = smu->adev;
477 uint32_t *board_reserved;
478 uint16_t *freq_table_gfx;
481 /* Fix some OEM SKU specific stability issues */
482 GET_PPTABLE_MEMBER(BoardReserved, &board_reserved);
483 if ((adev->pdev->device == 0x73DF) &&
484 (adev->pdev->revision == 0XC3) &&
485 (adev->pdev->subsystem_device == 0x16C2) &&
486 (adev->pdev->subsystem_vendor == 0x1043))
487 board_reserved[0] = 1387;
489 GET_PPTABLE_MEMBER(FreqTableGfx, &freq_table_gfx);
490 if ((adev->pdev->device == 0x73DF) &&
491 (adev->pdev->revision == 0XC3) &&
492 ((adev->pdev->subsystem_device == 0x16C2) ||
493 (adev->pdev->subsystem_device == 0x133C)) &&
494 (adev->pdev->subsystem_vendor == 0x1043)) {
495 for (i = 0; i < NUM_GFXCLK_DPM_LEVELS; i++) {
496 if (freq_table_gfx[i] > 2500)
497 freq_table_gfx[i] = 2500;
504 static int sienna_cichlid_setup_pptable(struct smu_context *smu)
508 ret = smu_v11_0_setup_pptable(smu);
512 ret = sienna_cichlid_store_powerplay_table(smu);
516 ret = sienna_cichlid_append_powerplay_table(smu);
520 ret = sienna_cichlid_check_powerplay_table(smu);
524 return sienna_cichlid_patch_pptable_quirk(smu);
527 static int sienna_cichlid_tables_init(struct smu_context *smu)
529 struct smu_table_context *smu_table = &smu->smu_table;
530 struct smu_table *tables = smu_table->tables;
533 table_size = get_table_size(smu);
534 SMU_TABLE_INIT(tables, SMU_TABLE_PPTABLE, table_size,
535 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
536 SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t),
537 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
538 SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, sizeof(SmuMetricsExternal_t),
539 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
540 SMU_TABLE_INIT(tables, SMU_TABLE_I2C_COMMANDS, sizeof(SwI2cRequest_t),
541 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
542 SMU_TABLE_INIT(tables, SMU_TABLE_OVERDRIVE, sizeof(OverDriveTable_t),
543 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
544 SMU_TABLE_INIT(tables, SMU_TABLE_PMSTATUSLOG, SMU11_TOOL_SIZE,
545 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
546 SMU_TABLE_INIT(tables, SMU_TABLE_ACTIVITY_MONITOR_COEFF,
547 sizeof(DpmActivityMonitorCoeffIntExternal_t), PAGE_SIZE,
548 AMDGPU_GEM_DOMAIN_VRAM);
549 SMU_TABLE_INIT(tables, SMU_TABLE_ECCINFO, sizeof(EccInfoTable_t),
550 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
551 SMU_TABLE_INIT(tables, SMU_TABLE_DRIVER_SMU_CONFIG, sizeof(DriverSmuConfigExternal_t),
552 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
554 smu_table->metrics_table = kzalloc(sizeof(SmuMetricsExternal_t), GFP_KERNEL);
555 if (!smu_table->metrics_table)
557 smu_table->metrics_time = 0;
559 smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_3);
560 smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
561 if (!smu_table->gpu_metrics_table)
564 smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL);
565 if (!smu_table->watermarks_table)
568 smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size, GFP_KERNEL);
569 if (!smu_table->ecc_table)
572 smu_table->driver_smu_config_table =
573 kzalloc(tables[SMU_TABLE_DRIVER_SMU_CONFIG].size, GFP_KERNEL);
574 if (!smu_table->driver_smu_config_table)
580 kfree(smu_table->ecc_table);
582 kfree(smu_table->watermarks_table);
584 kfree(smu_table->gpu_metrics_table);
586 kfree(smu_table->metrics_table);
591 static uint32_t sienna_cichlid_get_throttler_status_locked(struct smu_context *smu,
595 struct smu_table_context *smu_table= &smu->smu_table;
596 SmuMetricsExternal_t *metrics_ext =
597 (SmuMetricsExternal_t *)(smu_table->metrics_table);
598 uint32_t throttler_status = 0;
601 if (use_metrics_v3) {
602 for (i = 0; i < THROTTLER_COUNT; i++)
604 (metrics_ext->SmuMetrics_V3.ThrottlingPercentage[i] ? 1U << i : 0);
605 } else if (use_metrics_v2) {
606 for (i = 0; i < THROTTLER_COUNT; i++)
608 (metrics_ext->SmuMetrics_V2.ThrottlingPercentage[i] ? 1U << i : 0);
610 throttler_status = metrics_ext->SmuMetrics.ThrottlerStatus;
613 return throttler_status;
616 static int sienna_cichlid_get_power_limit(struct smu_context *smu,
617 uint32_t *current_power_limit,
618 uint32_t *default_power_limit,
619 uint32_t *max_power_limit)
621 struct smu_11_0_7_powerplay_table *powerplay_table =
622 (struct smu_11_0_7_powerplay_table *)smu->smu_table.power_play_table;
623 uint32_t power_limit, od_percent;
624 uint16_t *table_member;
626 GET_PPTABLE_MEMBER(SocketPowerLimitAc, &table_member);
628 if (smu_v11_0_get_current_power_limit(smu, &power_limit)) {
630 table_member[PPT_THROTTLER_PPT0];
633 if (current_power_limit)
634 *current_power_limit = power_limit;
635 if (default_power_limit)
636 *default_power_limit = power_limit;
638 if (max_power_limit) {
639 if (smu->od_enabled) {
641 le32_to_cpu(powerplay_table->overdrive_table.max[
642 SMU_11_0_7_ODSETTING_POWERPERCENTAGE]);
644 dev_dbg(smu->adev->dev, "ODSETTING_POWERPERCENTAGE: %d (default: %d)\n",
645 od_percent, power_limit);
647 power_limit *= (100 + od_percent);
650 *max_power_limit = power_limit;
656 static void sienna_cichlid_get_smartshift_power_percentage(struct smu_context *smu,
657 uint32_t *apu_percent,
658 uint32_t *dgpu_percent)
660 struct smu_table_context *smu_table = &smu->smu_table;
661 SmuMetrics_V4_t *metrics_v4 =
662 &(((SmuMetricsExternal_t *)(smu_table->metrics_table))->SmuMetrics_V4);
663 uint16_t powerRatio = 0;
664 uint16_t apu_power_limit = 0;
665 uint16_t dgpu_power_limit = 0;
666 uint32_t apu_boost = 0;
667 uint32_t dgpu_boost = 0;
668 uint32_t cur_power_limit;
670 if (metrics_v4->ApuSTAPMSmartShiftLimit != 0) {
671 sienna_cichlid_get_power_limit(smu, &cur_power_limit, NULL, NULL);
672 apu_power_limit = metrics_v4->ApuSTAPMLimit;
673 dgpu_power_limit = cur_power_limit;
674 powerRatio = (((apu_power_limit +
675 dgpu_power_limit) * 100) /
676 metrics_v4->ApuSTAPMSmartShiftLimit);
677 if (powerRatio > 100) {
678 apu_power_limit = (apu_power_limit * 100) /
680 dgpu_power_limit = (dgpu_power_limit * 100) /
683 if (metrics_v4->AverageApuSocketPower > apu_power_limit &&
684 apu_power_limit != 0) {
685 apu_boost = ((metrics_v4->AverageApuSocketPower -
686 apu_power_limit) * 100) /
692 if (metrics_v4->AverageSocketPower > dgpu_power_limit &&
693 dgpu_power_limit != 0) {
694 dgpu_boost = ((metrics_v4->AverageSocketPower -
695 dgpu_power_limit) * 100) /
697 if (dgpu_boost > 100)
701 if (dgpu_boost >= apu_boost)
706 *apu_percent = apu_boost;
707 *dgpu_percent = dgpu_boost;
710 static int sienna_cichlid_get_smu_metrics_data(struct smu_context *smu,
711 MetricsMember_t member,
714 struct smu_table_context *smu_table= &smu->smu_table;
715 SmuMetrics_t *metrics =
716 &(((SmuMetricsExternal_t *)(smu_table->metrics_table))->SmuMetrics);
717 SmuMetrics_V2_t *metrics_v2 =
718 &(((SmuMetricsExternal_t *)(smu_table->metrics_table))->SmuMetrics_V2);
719 SmuMetrics_V3_t *metrics_v3 =
720 &(((SmuMetricsExternal_t *)(smu_table->metrics_table))->SmuMetrics_V3);
721 bool use_metrics_v2 = false;
722 bool use_metrics_v3 = false;
723 uint16_t average_gfx_activity;
725 uint32_t apu_percent = 0;
726 uint32_t dgpu_percent = 0;
728 switch (smu->adev->ip_versions[MP1_HWIP][0]) {
729 case IP_VERSION(11, 0, 7):
730 if (smu->smc_fw_version >= 0x3A4900)
731 use_metrics_v3 = true;
732 else if (smu->smc_fw_version >= 0x3A4300)
733 use_metrics_v2 = true;
735 case IP_VERSION(11, 0, 11):
736 if (smu->smc_fw_version >= 0x412D00)
737 use_metrics_v2 = true;
739 case IP_VERSION(11, 0, 12):
740 if (smu->smc_fw_version >= 0x3B2300)
741 use_metrics_v2 = true;
743 case IP_VERSION(11, 0, 13):
744 if (smu->smc_fw_version >= 0x491100)
745 use_metrics_v2 = true;
751 ret = smu_cmn_get_metrics_table(smu,
758 case METRICS_CURR_GFXCLK:
759 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_GFXCLK] :
760 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_GFXCLK] :
761 metrics->CurrClock[PPCLK_GFXCLK];
763 case METRICS_CURR_SOCCLK:
764 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_SOCCLK] :
765 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_SOCCLK] :
766 metrics->CurrClock[PPCLK_SOCCLK];
768 case METRICS_CURR_UCLK:
769 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_UCLK] :
770 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_UCLK] :
771 metrics->CurrClock[PPCLK_UCLK];
773 case METRICS_CURR_VCLK:
774 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_VCLK_0] :
775 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_VCLK_0] :
776 metrics->CurrClock[PPCLK_VCLK_0];
778 case METRICS_CURR_VCLK1:
779 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_VCLK_1] :
780 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_VCLK_1] :
781 metrics->CurrClock[PPCLK_VCLK_1];
783 case METRICS_CURR_DCLK:
784 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_DCLK_0] :
785 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_DCLK_0] :
786 metrics->CurrClock[PPCLK_DCLK_0];
788 case METRICS_CURR_DCLK1:
789 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_DCLK_1] :
790 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_DCLK_1] :
791 metrics->CurrClock[PPCLK_DCLK_1];
793 case METRICS_CURR_DCEFCLK:
794 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_DCEFCLK] :
795 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_DCEFCLK] :
796 metrics->CurrClock[PPCLK_DCEFCLK];
798 case METRICS_CURR_FCLK:
799 *value = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_FCLK] :
800 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_FCLK] :
801 metrics->CurrClock[PPCLK_FCLK];
803 case METRICS_AVERAGE_GFXCLK:
804 average_gfx_activity = use_metrics_v3 ? metrics_v3->AverageGfxActivity :
805 use_metrics_v2 ? metrics_v2->AverageGfxActivity :
806 metrics->AverageGfxActivity;
807 if (average_gfx_activity <= SMU_11_0_7_GFX_BUSY_THRESHOLD)
808 *value = use_metrics_v3 ? metrics_v3->AverageGfxclkFrequencyPostDs :
809 use_metrics_v2 ? metrics_v2->AverageGfxclkFrequencyPostDs :
810 metrics->AverageGfxclkFrequencyPostDs;
812 *value = use_metrics_v3 ? metrics_v3->AverageGfxclkFrequencyPreDs :
813 use_metrics_v2 ? metrics_v2->AverageGfxclkFrequencyPreDs :
814 metrics->AverageGfxclkFrequencyPreDs;
816 case METRICS_AVERAGE_FCLK:
817 *value = use_metrics_v3 ? metrics_v3->AverageFclkFrequencyPostDs :
818 use_metrics_v2 ? metrics_v2->AverageFclkFrequencyPostDs :
819 metrics->AverageFclkFrequencyPostDs;
821 case METRICS_AVERAGE_UCLK:
822 *value = use_metrics_v3 ? metrics_v3->AverageUclkFrequencyPostDs :
823 use_metrics_v2 ? metrics_v2->AverageUclkFrequencyPostDs :
824 metrics->AverageUclkFrequencyPostDs;
826 case METRICS_AVERAGE_GFXACTIVITY:
827 *value = use_metrics_v3 ? metrics_v3->AverageGfxActivity :
828 use_metrics_v2 ? metrics_v2->AverageGfxActivity :
829 metrics->AverageGfxActivity;
831 case METRICS_AVERAGE_MEMACTIVITY:
832 *value = use_metrics_v3 ? metrics_v3->AverageUclkActivity :
833 use_metrics_v2 ? metrics_v2->AverageUclkActivity :
834 metrics->AverageUclkActivity;
836 case METRICS_AVERAGE_SOCKETPOWER:
837 *value = use_metrics_v3 ? metrics_v3->AverageSocketPower << 8 :
838 use_metrics_v2 ? metrics_v2->AverageSocketPower << 8 :
839 metrics->AverageSocketPower << 8;
841 case METRICS_TEMPERATURE_EDGE:
842 *value = (use_metrics_v3 ? metrics_v3->TemperatureEdge :
843 use_metrics_v2 ? metrics_v2->TemperatureEdge :
844 metrics->TemperatureEdge) * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
846 case METRICS_TEMPERATURE_HOTSPOT:
847 *value = (use_metrics_v3 ? metrics_v3->TemperatureHotspot :
848 use_metrics_v2 ? metrics_v2->TemperatureHotspot :
849 metrics->TemperatureHotspot) * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
851 case METRICS_TEMPERATURE_MEM:
852 *value = (use_metrics_v3 ? metrics_v3->TemperatureMem :
853 use_metrics_v2 ? metrics_v2->TemperatureMem :
854 metrics->TemperatureMem) * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
856 case METRICS_TEMPERATURE_VRGFX:
857 *value = (use_metrics_v3 ? metrics_v3->TemperatureVrGfx :
858 use_metrics_v2 ? metrics_v2->TemperatureVrGfx :
859 metrics->TemperatureVrGfx) * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
861 case METRICS_TEMPERATURE_VRSOC:
862 *value = (use_metrics_v3 ? metrics_v3->TemperatureVrSoc :
863 use_metrics_v2 ? metrics_v2->TemperatureVrSoc :
864 metrics->TemperatureVrSoc) * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
866 case METRICS_THROTTLER_STATUS:
867 *value = sienna_cichlid_get_throttler_status_locked(smu, use_metrics_v3, use_metrics_v2);
869 case METRICS_CURR_FANSPEED:
870 *value = use_metrics_v3 ? metrics_v3->CurrFanSpeed :
871 use_metrics_v2 ? metrics_v2->CurrFanSpeed : metrics->CurrFanSpeed;
873 case METRICS_UNIQUE_ID_UPPER32:
874 /* Only supported in 0x3A5300+, metrics_v3 requires 0x3A4900+ */
875 *value = use_metrics_v3 ? metrics_v3->PublicSerialNumUpper32 : 0;
877 case METRICS_UNIQUE_ID_LOWER32:
878 /* Only supported in 0x3A5300+, metrics_v3 requires 0x3A4900+ */
879 *value = use_metrics_v3 ? metrics_v3->PublicSerialNumLower32 : 0;
881 case METRICS_SS_APU_SHARE:
882 sienna_cichlid_get_smartshift_power_percentage(smu, &apu_percent, &dgpu_percent);
883 *value = apu_percent;
885 case METRICS_SS_DGPU_SHARE:
886 sienna_cichlid_get_smartshift_power_percentage(smu, &apu_percent, &dgpu_percent);
887 *value = dgpu_percent;
899 static int sienna_cichlid_allocate_dpm_context(struct smu_context *smu)
901 struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
903 smu_dpm->dpm_context = kzalloc(sizeof(struct smu_11_0_dpm_context),
905 if (!smu_dpm->dpm_context)
908 smu_dpm->dpm_context_size = sizeof(struct smu_11_0_dpm_context);
913 static void sienna_cichlid_stb_init(struct smu_context *smu);
915 static int sienna_cichlid_init_smc_tables(struct smu_context *smu)
917 struct amdgpu_device *adev = smu->adev;
920 ret = sienna_cichlid_tables_init(smu);
924 ret = sienna_cichlid_allocate_dpm_context(smu);
928 if (!amdgpu_sriov_vf(adev))
929 sienna_cichlid_stb_init(smu);
931 return smu_v11_0_init_smc_tables(smu);
934 static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu)
936 struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
937 struct smu_11_0_dpm_table *dpm_table;
938 struct amdgpu_device *adev = smu->adev;
940 DpmDescriptor_t *table_member;
942 /* socclk dpm table setup */
943 dpm_table = &dpm_context->dpm_tables.soc_table;
944 GET_PPTABLE_MEMBER(DpmDescriptor, &table_member);
945 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
946 ret = smu_v11_0_set_single_dpm_table(smu,
951 dpm_table->is_fine_grained =
952 !table_member[PPCLK_SOCCLK].SnapToDiscrete;
954 dpm_table->count = 1;
955 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.socclk / 100;
956 dpm_table->dpm_levels[0].enabled = true;
957 dpm_table->min = dpm_table->dpm_levels[0].value;
958 dpm_table->max = dpm_table->dpm_levels[0].value;
961 /* gfxclk dpm table setup */
962 dpm_table = &dpm_context->dpm_tables.gfx_table;
963 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT)) {
964 ret = smu_v11_0_set_single_dpm_table(smu,
969 dpm_table->is_fine_grained =
970 !table_member[PPCLK_GFXCLK].SnapToDiscrete;
972 dpm_table->count = 1;
973 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.gfxclk / 100;
974 dpm_table->dpm_levels[0].enabled = true;
975 dpm_table->min = dpm_table->dpm_levels[0].value;
976 dpm_table->max = dpm_table->dpm_levels[0].value;
979 /* uclk dpm table setup */
980 dpm_table = &dpm_context->dpm_tables.uclk_table;
981 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT)) {
982 ret = smu_v11_0_set_single_dpm_table(smu,
987 dpm_table->is_fine_grained =
988 !table_member[PPCLK_UCLK].SnapToDiscrete;
990 dpm_table->count = 1;
991 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.uclk / 100;
992 dpm_table->dpm_levels[0].enabled = true;
993 dpm_table->min = dpm_table->dpm_levels[0].value;
994 dpm_table->max = dpm_table->dpm_levels[0].value;
997 /* fclk dpm table setup */
998 dpm_table = &dpm_context->dpm_tables.fclk_table;
999 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_FCLK_BIT)) {
1000 ret = smu_v11_0_set_single_dpm_table(smu,
1005 dpm_table->is_fine_grained =
1006 !table_member[PPCLK_FCLK].SnapToDiscrete;
1008 dpm_table->count = 1;
1009 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.fclk / 100;
1010 dpm_table->dpm_levels[0].enabled = true;
1011 dpm_table->min = dpm_table->dpm_levels[0].value;
1012 dpm_table->max = dpm_table->dpm_levels[0].value;
1015 /* vclk0/1 dpm table setup */
1016 for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
1017 if (adev->vcn.harvest_config & (1 << i))
1020 dpm_table = &dpm_context->dpm_tables.vclk_table;
1021 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
1022 ret = smu_v11_0_set_single_dpm_table(smu,
1023 i ? SMU_VCLK1 : SMU_VCLK,
1027 dpm_table->is_fine_grained =
1028 !table_member[i ? PPCLK_VCLK_1 : PPCLK_VCLK_0].SnapToDiscrete;
1030 dpm_table->count = 1;
1031 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.vclk / 100;
1032 dpm_table->dpm_levels[0].enabled = true;
1033 dpm_table->min = dpm_table->dpm_levels[0].value;
1034 dpm_table->max = dpm_table->dpm_levels[0].value;
1038 /* dclk0/1 dpm table setup */
1039 for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
1040 if (adev->vcn.harvest_config & (1 << i))
1042 dpm_table = &dpm_context->dpm_tables.dclk_table;
1043 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
1044 ret = smu_v11_0_set_single_dpm_table(smu,
1045 i ? SMU_DCLK1 : SMU_DCLK,
1049 dpm_table->is_fine_grained =
1050 !table_member[i ? PPCLK_DCLK_1 : PPCLK_DCLK_0].SnapToDiscrete;
1052 dpm_table->count = 1;
1053 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.dclk / 100;
1054 dpm_table->dpm_levels[0].enabled = true;
1055 dpm_table->min = dpm_table->dpm_levels[0].value;
1056 dpm_table->max = dpm_table->dpm_levels[0].value;
1060 /* dcefclk dpm table setup */
1061 dpm_table = &dpm_context->dpm_tables.dcef_table;
1062 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
1063 ret = smu_v11_0_set_single_dpm_table(smu,
1068 dpm_table->is_fine_grained =
1069 !table_member[PPCLK_DCEFCLK].SnapToDiscrete;
1071 dpm_table->count = 1;
1072 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.dcefclk / 100;
1073 dpm_table->dpm_levels[0].enabled = true;
1074 dpm_table->min = dpm_table->dpm_levels[0].value;
1075 dpm_table->max = dpm_table->dpm_levels[0].value;
1078 /* pixelclk dpm table setup */
1079 dpm_table = &dpm_context->dpm_tables.pixel_table;
1080 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
1081 ret = smu_v11_0_set_single_dpm_table(smu,
1086 dpm_table->is_fine_grained =
1087 !table_member[PPCLK_PIXCLK].SnapToDiscrete;
1089 dpm_table->count = 1;
1090 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.dcefclk / 100;
1091 dpm_table->dpm_levels[0].enabled = true;
1092 dpm_table->min = dpm_table->dpm_levels[0].value;
1093 dpm_table->max = dpm_table->dpm_levels[0].value;
1096 /* displayclk dpm table setup */
1097 dpm_table = &dpm_context->dpm_tables.display_table;
1098 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
1099 ret = smu_v11_0_set_single_dpm_table(smu,
1104 dpm_table->is_fine_grained =
1105 !table_member[PPCLK_DISPCLK].SnapToDiscrete;
1107 dpm_table->count = 1;
1108 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.dcefclk / 100;
1109 dpm_table->dpm_levels[0].enabled = true;
1110 dpm_table->min = dpm_table->dpm_levels[0].value;
1111 dpm_table->max = dpm_table->dpm_levels[0].value;
1114 /* phyclk dpm table setup */
1115 dpm_table = &dpm_context->dpm_tables.phy_table;
1116 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
1117 ret = smu_v11_0_set_single_dpm_table(smu,
1122 dpm_table->is_fine_grained =
1123 !table_member[PPCLK_PHYCLK].SnapToDiscrete;
1125 dpm_table->count = 1;
1126 dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.dcefclk / 100;
1127 dpm_table->dpm_levels[0].enabled = true;
1128 dpm_table->min = dpm_table->dpm_levels[0].value;
1129 dpm_table->max = dpm_table->dpm_levels[0].value;
1135 static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu, bool enable)
1137 struct amdgpu_device *adev = smu->adev;
1140 for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
1141 if (adev->vcn.harvest_config & (1 << i))
1143 /* vcn dpm on is a prerequisite for vcn power gate messages */
1144 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
1145 ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
1146 SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
1156 static int sienna_cichlid_dpm_set_jpeg_enable(struct smu_context *smu, bool enable)
1161 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
1162 ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpJpeg, 0, NULL);
1167 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
1168 ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownJpeg, 0, NULL);
1177 static int sienna_cichlid_get_current_clk_freq_by_table(struct smu_context *smu,
1178 enum smu_clk_type clk_type,
1181 MetricsMember_t member_type;
1184 clk_id = smu_cmn_to_asic_specific_index(smu,
1185 CMN2ASIC_MAPPING_CLK,
1192 member_type = METRICS_CURR_GFXCLK;
1195 member_type = METRICS_CURR_UCLK;
1198 member_type = METRICS_CURR_SOCCLK;
1201 member_type = METRICS_CURR_FCLK;
1204 member_type = METRICS_CURR_VCLK;
1207 member_type = METRICS_CURR_VCLK1;
1210 member_type = METRICS_CURR_DCLK;
1213 member_type = METRICS_CURR_DCLK1;
1216 member_type = METRICS_CURR_DCEFCLK;
1222 return sienna_cichlid_get_smu_metrics_data(smu,
1228 static bool sienna_cichlid_is_support_fine_grained_dpm(struct smu_context *smu, enum smu_clk_type clk_type)
1230 DpmDescriptor_t *dpm_desc = NULL;
1231 DpmDescriptor_t *table_member;
1232 uint32_t clk_index = 0;
1234 GET_PPTABLE_MEMBER(DpmDescriptor, &table_member);
1235 clk_index = smu_cmn_to_asic_specific_index(smu,
1236 CMN2ASIC_MAPPING_CLK,
1238 dpm_desc = &table_member[clk_index];
1240 /* 0 - Fine grained DPM, 1 - Discrete DPM */
1241 return dpm_desc->SnapToDiscrete == 0;
1244 static bool sienna_cichlid_is_od_feature_supported(struct smu_11_0_7_overdrive_table *od_table,
1245 enum SMU_11_0_7_ODFEATURE_CAP cap)
1247 return od_table->cap[cap];
1250 static void sienna_cichlid_get_od_setting_range(struct smu_11_0_7_overdrive_table *od_table,
1251 enum SMU_11_0_7_ODSETTING_ID setting,
1252 uint32_t *min, uint32_t *max)
1255 *min = od_table->min[setting];
1257 *max = od_table->max[setting];
1260 static int sienna_cichlid_print_clk_levels(struct smu_context *smu,
1261 enum smu_clk_type clk_type, char *buf)
1263 struct amdgpu_device *adev = smu->adev;
1264 struct smu_table_context *table_context = &smu->smu_table;
1265 struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
1266 struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context;
1267 uint16_t *table_member;
1269 struct smu_11_0_7_overdrive_table *od_settings = smu->od_settings;
1270 OverDriveTable_t *od_table =
1271 (OverDriveTable_t *)table_context->overdrive_table;
1272 int i, size = 0, ret = 0;
1273 uint32_t cur_value = 0, value = 0, count = 0;
1274 uint32_t freq_values[3] = {0};
1275 uint32_t mark_index = 0;
1276 uint32_t gen_speed, lane_width;
1277 uint32_t min_value, max_value;
1278 uint32_t smu_version;
1280 smu_cmn_get_sysfs_buf(&buf, &size);
1294 ret = sienna_cichlid_get_current_clk_freq_by_table(smu, clk_type, &cur_value);
1298 ret = smu_v11_0_get_dpm_level_count(smu, clk_type, &count);
1302 if (!sienna_cichlid_is_support_fine_grained_dpm(smu, clk_type)) {
1303 for (i = 0; i < count; i++) {
1304 ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, i, &value);
1308 size += sysfs_emit_at(buf, size, "%d: %uMhz %s\n", i, value,
1309 cur_value == value ? "*" : "");
1312 ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, 0, &freq_values[0]);
1315 ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, count - 1, &freq_values[2]);
1319 freq_values[1] = cur_value;
1320 mark_index = cur_value == freq_values[0] ? 0 :
1321 cur_value == freq_values[2] ? 2 : 1;
1324 if (mark_index != 1) {
1326 freq_values[1] = freq_values[2];
1329 for (i = 0; i < count; i++) {
1330 size += sysfs_emit_at(buf, size, "%d: %uMhz %s\n", i, freq_values[i],
1331 cur_value == freq_values[i] ? "*" : "");
1337 gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
1338 lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
1339 GET_PPTABLE_MEMBER(LclkFreq, &table_member);
1340 for (i = 0; i < NUM_LINK_LEVELS; i++)
1341 size += sysfs_emit_at(buf, size, "%d: %s %s %dMhz %s\n", i,
1342 (dpm_context->dpm_tables.pcie_table.pcie_gen[i] == 0) ? "2.5GT/s," :
1343 (dpm_context->dpm_tables.pcie_table.pcie_gen[i] == 1) ? "5.0GT/s," :
1344 (dpm_context->dpm_tables.pcie_table.pcie_gen[i] == 2) ? "8.0GT/s," :
1345 (dpm_context->dpm_tables.pcie_table.pcie_gen[i] == 3) ? "16.0GT/s," : "",
1346 (dpm_context->dpm_tables.pcie_table.pcie_lane[i] == 1) ? "x1" :
1347 (dpm_context->dpm_tables.pcie_table.pcie_lane[i] == 2) ? "x2" :
1348 (dpm_context->dpm_tables.pcie_table.pcie_lane[i] == 3) ? "x4" :
1349 (dpm_context->dpm_tables.pcie_table.pcie_lane[i] == 4) ? "x8" :
1350 (dpm_context->dpm_tables.pcie_table.pcie_lane[i] == 5) ? "x12" :
1351 (dpm_context->dpm_tables.pcie_table.pcie_lane[i] == 6) ? "x16" : "",
1353 (gen_speed == dpm_context->dpm_tables.pcie_table.pcie_gen[i]) &&
1354 (lane_width == dpm_context->dpm_tables.pcie_table.pcie_lane[i]) ?
1358 if (!smu->od_enabled || !od_table || !od_settings)
1361 if (!sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_GFXCLK_LIMITS))
1364 size += sysfs_emit_at(buf, size, "OD_SCLK:\n");
1365 size += sysfs_emit_at(buf, size, "0: %uMhz\n1: %uMhz\n", od_table->GfxclkFmin, od_table->GfxclkFmax);
1369 if (!smu->od_enabled || !od_table || !od_settings)
1372 if (!sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_UCLK_LIMITS))
1375 size += sysfs_emit_at(buf, size, "OD_MCLK:\n");
1376 size += sysfs_emit_at(buf, size, "0: %uMhz\n1: %uMHz\n", od_table->UclkFmin, od_table->UclkFmax);
1379 case SMU_OD_VDDGFX_OFFSET:
1380 if (!smu->od_enabled || !od_table || !od_settings)
1384 * OD GFX Voltage Offset functionality is supported only by 58.41.0
1385 * and onwards SMU firmwares.
1387 smu_cmn_get_smc_version(smu, NULL, &smu_version);
1388 if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
1389 (smu_version < 0x003a2900))
1392 size += sysfs_emit_at(buf, size, "OD_VDDGFX_OFFSET:\n");
1393 size += sysfs_emit_at(buf, size, "%dmV\n", od_table->VddGfxOffset);
1397 if (!smu->od_enabled || !od_table || !od_settings)
1400 size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
1402 if (sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_GFXCLK_LIMITS)) {
1403 sienna_cichlid_get_od_setting_range(od_settings, SMU_11_0_7_ODSETTING_GFXCLKFMIN,
1405 sienna_cichlid_get_od_setting_range(od_settings, SMU_11_0_7_ODSETTING_GFXCLKFMAX,
1407 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
1408 min_value, max_value);
1411 if (sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_UCLK_LIMITS)) {
1412 sienna_cichlid_get_od_setting_range(od_settings, SMU_11_0_7_ODSETTING_UCLKFMIN,
1414 sienna_cichlid_get_od_setting_range(od_settings, SMU_11_0_7_ODSETTING_UCLKFMAX,
1416 size += sysfs_emit_at(buf, size, "MCLK: %7uMhz %10uMhz\n",
1417 min_value, max_value);
1429 static int sienna_cichlid_force_clk_levels(struct smu_context *smu,
1430 enum smu_clk_type clk_type, uint32_t mask)
1433 uint32_t soft_min_level = 0, soft_max_level = 0, min_freq = 0, max_freq = 0;
1435 soft_min_level = mask ? (ffs(mask) - 1) : 0;
1436 soft_max_level = mask ? (fls(mask) - 1) : 0;
1445 /* There is only 2 levels for fine grained DPM */
1446 if (sienna_cichlid_is_support_fine_grained_dpm(smu, clk_type)) {
1447 soft_max_level = (soft_max_level >= 1 ? 1 : 0);
1448 soft_min_level = (soft_min_level >= 1 ? 1 : 0);
1451 ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, soft_min_level, &min_freq);
1453 goto forec_level_out;
1455 ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, soft_max_level, &max_freq);
1457 goto forec_level_out;
1459 ret = smu_v11_0_set_soft_freq_limited_range(smu, clk_type, min_freq, max_freq);
1461 goto forec_level_out;
1464 dev_info(smu->adev->dev,"Setting DCEFCLK min/max dpm level is not supported!\n");
1474 static int sienna_cichlid_populate_umd_state_clk(struct smu_context *smu)
1476 struct smu_11_0_dpm_context *dpm_context =
1477 smu->smu_dpm.dpm_context;
1478 struct smu_11_0_dpm_table *gfx_table =
1479 &dpm_context->dpm_tables.gfx_table;
1480 struct smu_11_0_dpm_table *mem_table =
1481 &dpm_context->dpm_tables.uclk_table;
1482 struct smu_11_0_dpm_table *soc_table =
1483 &dpm_context->dpm_tables.soc_table;
1484 struct smu_umd_pstate_table *pstate_table =
1486 struct amdgpu_device *adev = smu->adev;
1488 pstate_table->gfxclk_pstate.min = gfx_table->min;
1489 pstate_table->gfxclk_pstate.peak = gfx_table->max;
1491 pstate_table->uclk_pstate.min = mem_table->min;
1492 pstate_table->uclk_pstate.peak = mem_table->max;
1494 pstate_table->socclk_pstate.min = soc_table->min;
1495 pstate_table->socclk_pstate.peak = soc_table->max;
1497 switch (adev->ip_versions[MP1_HWIP][0]) {
1498 case IP_VERSION(11, 0, 7):
1499 case IP_VERSION(11, 0, 11):
1500 pstate_table->gfxclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK;
1501 pstate_table->uclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK;
1502 pstate_table->socclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK;
1504 case IP_VERSION(11, 0, 12):
1505 pstate_table->gfxclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_GFXCLK;
1506 pstate_table->uclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_MEMCLK;
1507 pstate_table->socclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_SOCCLK;
1509 case IP_VERSION(11, 0, 13):
1510 pstate_table->gfxclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_GFXCLK;
1511 pstate_table->uclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_MEMCLK;
1512 pstate_table->socclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_SOCCLK;
1521 static int sienna_cichlid_pre_display_config_changed(struct smu_context *smu)
1524 uint32_t max_freq = 0;
1526 /* Sienna_Cichlid do not support to change display num currently */
1529 ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays, 0, NULL);
1534 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT)) {
1535 ret = smu_v11_0_get_dpm_ultimate_freq(smu, SMU_UCLK, NULL, &max_freq);
1538 ret = smu_v11_0_set_hard_freq_limited_range(smu, SMU_UCLK, 0, max_freq);
1546 static int sienna_cichlid_display_config_changed(struct smu_context *smu)
1550 if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
1551 smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
1552 smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
1554 ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays,
1555 smu->display_config->num_display,
1565 static bool sienna_cichlid_is_dpm_running(struct smu_context *smu)
1568 uint64_t feature_enabled;
1570 ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
1574 return !!(feature_enabled & SMC_DPM_FEATURE);
1577 static int sienna_cichlid_get_fan_speed_rpm(struct smu_context *smu,
1584 * For Sienna_Cichlid and later, the fan speed(rpm) reported
1585 * by pmfw is always trustable(even when the fan control feature
1586 * disabled or 0 RPM kicked in).
1588 return sienna_cichlid_get_smu_metrics_data(smu,
1589 METRICS_CURR_FANSPEED,
1593 static int sienna_cichlid_get_fan_parameters(struct smu_context *smu)
1595 uint16_t *table_member;
1597 GET_PPTABLE_MEMBER(FanMaximumRpm, &table_member);
1598 smu->fan_max_rpm = *table_member;
1603 static int sienna_cichlid_get_power_profile_mode(struct smu_context *smu, char *buf)
1605 DpmActivityMonitorCoeffIntExternal_t activity_monitor_external;
1606 DpmActivityMonitorCoeffInt_t *activity_monitor =
1607 &(activity_monitor_external.DpmActivityMonitorCoeffInt);
1608 uint32_t i, size = 0;
1609 int16_t workload_type = 0;
1610 static const char *title[] = {
1611 "PROFILE_INDEX(NAME)",
1615 "MinActiveFreqType",
1620 "PD_Data_error_coeff",
1621 "PD_Data_error_rate_coeff"};
1627 size += sysfs_emit_at(buf, size, "%16s %s %s %s %s %s %s %s %s %s %s\n",
1628 title[0], title[1], title[2], title[3], title[4], title[5],
1629 title[6], title[7], title[8], title[9], title[10]);
1631 for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) {
1632 /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
1633 workload_type = smu_cmn_to_asic_specific_index(smu,
1634 CMN2ASIC_MAPPING_WORKLOAD,
1636 if (workload_type < 0)
1639 result = smu_cmn_update_table(smu,
1640 SMU_TABLE_ACTIVITY_MONITOR_COEFF, workload_type,
1641 (void *)(&activity_monitor_external), false);
1643 dev_err(smu->adev->dev, "[%s] Failed to get activity monitor!", __func__);
1647 size += sysfs_emit_at(buf, size, "%2d %14s%s:\n",
1648 i, amdgpu_pp_profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
1650 size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n",
1654 activity_monitor->Gfx_FPS,
1655 activity_monitor->Gfx_MinFreqStep,
1656 activity_monitor->Gfx_MinActiveFreqType,
1657 activity_monitor->Gfx_MinActiveFreq,
1658 activity_monitor->Gfx_BoosterFreqType,
1659 activity_monitor->Gfx_BoosterFreq,
1660 activity_monitor->Gfx_PD_Data_limit_c,
1661 activity_monitor->Gfx_PD_Data_error_coeff,
1662 activity_monitor->Gfx_PD_Data_error_rate_coeff);
1664 size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n",
1668 activity_monitor->Fclk_FPS,
1669 activity_monitor->Fclk_MinFreqStep,
1670 activity_monitor->Fclk_MinActiveFreqType,
1671 activity_monitor->Fclk_MinActiveFreq,
1672 activity_monitor->Fclk_BoosterFreqType,
1673 activity_monitor->Fclk_BoosterFreq,
1674 activity_monitor->Fclk_PD_Data_limit_c,
1675 activity_monitor->Fclk_PD_Data_error_coeff,
1676 activity_monitor->Fclk_PD_Data_error_rate_coeff);
1678 size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n",
1682 activity_monitor->Mem_FPS,
1683 activity_monitor->Mem_MinFreqStep,
1684 activity_monitor->Mem_MinActiveFreqType,
1685 activity_monitor->Mem_MinActiveFreq,
1686 activity_monitor->Mem_BoosterFreqType,
1687 activity_monitor->Mem_BoosterFreq,
1688 activity_monitor->Mem_PD_Data_limit_c,
1689 activity_monitor->Mem_PD_Data_error_coeff,
1690 activity_monitor->Mem_PD_Data_error_rate_coeff);
1696 static int sienna_cichlid_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size)
1699 DpmActivityMonitorCoeffIntExternal_t activity_monitor_external;
1700 DpmActivityMonitorCoeffInt_t *activity_monitor =
1701 &(activity_monitor_external.DpmActivityMonitorCoeffInt);
1702 int workload_type, ret = 0;
1704 smu->power_profile_mode = input[size];
1706 if (smu->power_profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
1707 dev_err(smu->adev->dev, "Invalid power profile mode %d\n", smu->power_profile_mode);
1711 if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
1713 ret = smu_cmn_update_table(smu,
1714 SMU_TABLE_ACTIVITY_MONITOR_COEFF, WORKLOAD_PPLIB_CUSTOM_BIT,
1715 (void *)(&activity_monitor_external), false);
1717 dev_err(smu->adev->dev, "[%s] Failed to get activity monitor!", __func__);
1722 case 0: /* Gfxclk */
1723 activity_monitor->Gfx_FPS = input[1];
1724 activity_monitor->Gfx_MinFreqStep = input[2];
1725 activity_monitor->Gfx_MinActiveFreqType = input[3];
1726 activity_monitor->Gfx_MinActiveFreq = input[4];
1727 activity_monitor->Gfx_BoosterFreqType = input[5];
1728 activity_monitor->Gfx_BoosterFreq = input[6];
1729 activity_monitor->Gfx_PD_Data_limit_c = input[7];
1730 activity_monitor->Gfx_PD_Data_error_coeff = input[8];
1731 activity_monitor->Gfx_PD_Data_error_rate_coeff = input[9];
1733 case 1: /* Socclk */
1734 activity_monitor->Fclk_FPS = input[1];
1735 activity_monitor->Fclk_MinFreqStep = input[2];
1736 activity_monitor->Fclk_MinActiveFreqType = input[3];
1737 activity_monitor->Fclk_MinActiveFreq = input[4];
1738 activity_monitor->Fclk_BoosterFreqType = input[5];
1739 activity_monitor->Fclk_BoosterFreq = input[6];
1740 activity_monitor->Fclk_PD_Data_limit_c = input[7];
1741 activity_monitor->Fclk_PD_Data_error_coeff = input[8];
1742 activity_monitor->Fclk_PD_Data_error_rate_coeff = input[9];
1745 activity_monitor->Mem_FPS = input[1];
1746 activity_monitor->Mem_MinFreqStep = input[2];
1747 activity_monitor->Mem_MinActiveFreqType = input[3];
1748 activity_monitor->Mem_MinActiveFreq = input[4];
1749 activity_monitor->Mem_BoosterFreqType = input[5];
1750 activity_monitor->Mem_BoosterFreq = input[6];
1751 activity_monitor->Mem_PD_Data_limit_c = input[7];
1752 activity_monitor->Mem_PD_Data_error_coeff = input[8];
1753 activity_monitor->Mem_PD_Data_error_rate_coeff = input[9];
1757 ret = smu_cmn_update_table(smu,
1758 SMU_TABLE_ACTIVITY_MONITOR_COEFF, WORKLOAD_PPLIB_CUSTOM_BIT,
1759 (void *)(&activity_monitor_external), true);
1761 dev_err(smu->adev->dev, "[%s] Failed to set activity monitor!", __func__);
1766 /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
1767 workload_type = smu_cmn_to_asic_specific_index(smu,
1768 CMN2ASIC_MAPPING_WORKLOAD,
1769 smu->power_profile_mode);
1770 if (workload_type < 0)
1772 smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
1773 1 << workload_type, NULL);
1778 static int sienna_cichlid_notify_smc_display_config(struct smu_context *smu)
1780 struct smu_clocks min_clocks = {0};
1781 struct pp_display_clock_request clock_req;
1784 min_clocks.dcef_clock = smu->display_config->min_dcef_set_clk;
1785 min_clocks.dcef_clock_in_sr = smu->display_config->min_dcef_deep_sleep_set_clk;
1786 min_clocks.memory_clock = smu->display_config->min_mem_set_clock;
1788 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
1789 clock_req.clock_type = amd_pp_dcef_clock;
1790 clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
1792 ret = smu_v11_0_display_clock_voltage_request(smu, &clock_req);
1794 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
1795 ret = smu_cmn_send_smc_msg_with_param(smu,
1796 SMU_MSG_SetMinDeepSleepDcefclk,
1797 min_clocks.dcef_clock_in_sr/100,
1800 dev_err(smu->adev->dev, "Attempt to set divider for DCEFCLK Failed!");
1805 dev_info(smu->adev->dev, "Attempt to set Hard Min for DCEFCLK Failed!");
1809 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT)) {
1810 ret = smu_v11_0_set_hard_freq_limited_range(smu, SMU_UCLK, min_clocks.memory_clock/100, 0);
1812 dev_err(smu->adev->dev, "[%s] Set hard min uclk failed!", __func__);
1820 static int sienna_cichlid_set_watermarks_table(struct smu_context *smu,
1821 struct pp_smu_wm_range_sets *clock_ranges)
1823 Watermarks_t *table = smu->smu_table.watermarks_table;
1828 if (clock_ranges->num_reader_wm_sets > NUM_WM_RANGES ||
1829 clock_ranges->num_writer_wm_sets > NUM_WM_RANGES)
1832 for (i = 0; i < clock_ranges->num_reader_wm_sets; i++) {
1833 table->WatermarkRow[WM_DCEFCLK][i].MinClock =
1834 clock_ranges->reader_wm_sets[i].min_drain_clk_mhz;
1835 table->WatermarkRow[WM_DCEFCLK][i].MaxClock =
1836 clock_ranges->reader_wm_sets[i].max_drain_clk_mhz;
1837 table->WatermarkRow[WM_DCEFCLK][i].MinUclk =
1838 clock_ranges->reader_wm_sets[i].min_fill_clk_mhz;
1839 table->WatermarkRow[WM_DCEFCLK][i].MaxUclk =
1840 clock_ranges->reader_wm_sets[i].max_fill_clk_mhz;
1842 table->WatermarkRow[WM_DCEFCLK][i].WmSetting =
1843 clock_ranges->reader_wm_sets[i].wm_inst;
1846 for (i = 0; i < clock_ranges->num_writer_wm_sets; i++) {
1847 table->WatermarkRow[WM_SOCCLK][i].MinClock =
1848 clock_ranges->writer_wm_sets[i].min_fill_clk_mhz;
1849 table->WatermarkRow[WM_SOCCLK][i].MaxClock =
1850 clock_ranges->writer_wm_sets[i].max_fill_clk_mhz;
1851 table->WatermarkRow[WM_SOCCLK][i].MinUclk =
1852 clock_ranges->writer_wm_sets[i].min_drain_clk_mhz;
1853 table->WatermarkRow[WM_SOCCLK][i].MaxUclk =
1854 clock_ranges->writer_wm_sets[i].max_drain_clk_mhz;
1856 table->WatermarkRow[WM_SOCCLK][i].WmSetting =
1857 clock_ranges->writer_wm_sets[i].wm_inst;
1860 smu->watermarks_bitmap |= WATERMARKS_EXIST;
1863 if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
1864 !(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
1865 ret = smu_cmn_write_watermarks_table(smu);
1867 dev_err(smu->adev->dev, "Failed to update WMTABLE!");
1870 smu->watermarks_bitmap |= WATERMARKS_LOADED;
1876 static int sienna_cichlid_read_sensor(struct smu_context *smu,
1877 enum amd_pp_sensors sensor,
1878 void *data, uint32_t *size)
1882 struct amdgpu_device *adev = smu->adev;
1888 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
1889 GET_PPTABLE_MEMBER(FanMaximumRpm, &temp);
1890 *(uint16_t *)data = *temp;
1893 case AMDGPU_PP_SENSOR_MEM_LOAD:
1894 ret = sienna_cichlid_get_smu_metrics_data(smu,
1895 METRICS_AVERAGE_MEMACTIVITY,
1899 case AMDGPU_PP_SENSOR_GPU_LOAD:
1900 ret = sienna_cichlid_get_smu_metrics_data(smu,
1901 METRICS_AVERAGE_GFXACTIVITY,
1905 case AMDGPU_PP_SENSOR_GPU_AVG_POWER:
1906 ret = sienna_cichlid_get_smu_metrics_data(smu,
1907 METRICS_AVERAGE_SOCKETPOWER,
1911 case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:
1912 ret = sienna_cichlid_get_smu_metrics_data(smu,
1913 METRICS_TEMPERATURE_HOTSPOT,
1917 case AMDGPU_PP_SENSOR_EDGE_TEMP:
1918 ret = sienna_cichlid_get_smu_metrics_data(smu,
1919 METRICS_TEMPERATURE_EDGE,
1923 case AMDGPU_PP_SENSOR_MEM_TEMP:
1924 ret = sienna_cichlid_get_smu_metrics_data(smu,
1925 METRICS_TEMPERATURE_MEM,
1929 case AMDGPU_PP_SENSOR_GFX_MCLK:
1930 ret = sienna_cichlid_get_smu_metrics_data(smu,
1933 *(uint32_t *)data *= 100;
1936 case AMDGPU_PP_SENSOR_GFX_SCLK:
1937 ret = sienna_cichlid_get_smu_metrics_data(smu,
1938 METRICS_AVERAGE_GFXCLK,
1940 *(uint32_t *)data *= 100;
1943 case AMDGPU_PP_SENSOR_VDDGFX:
1944 ret = smu_v11_0_get_gfx_vdd(smu, (uint32_t *)data);
1947 case AMDGPU_PP_SENSOR_SS_APU_SHARE:
1948 if (adev->ip_versions[MP1_HWIP][0] != IP_VERSION(11, 0, 7)) {
1949 ret = sienna_cichlid_get_smu_metrics_data(smu,
1950 METRICS_SS_APU_SHARE, (uint32_t *)data);
1956 case AMDGPU_PP_SENSOR_SS_DGPU_SHARE:
1957 if (adev->ip_versions[MP1_HWIP][0] != IP_VERSION(11, 0, 7)) {
1958 ret = sienna_cichlid_get_smu_metrics_data(smu,
1959 METRICS_SS_DGPU_SHARE, (uint32_t *)data);
1965 case AMDGPU_PP_SENSOR_GPU_INPUT_POWER:
1974 static void sienna_cichlid_get_unique_id(struct smu_context *smu)
1976 struct amdgpu_device *adev = smu->adev;
1977 uint32_t upper32 = 0, lower32 = 0;
1979 /* Only supported as of version 0.58.83.0 and only on Sienna Cichlid */
1980 if (smu->smc_fw_version < 0x3A5300 ||
1981 smu->adev->ip_versions[MP1_HWIP][0] != IP_VERSION(11, 0, 7))
1984 if (sienna_cichlid_get_smu_metrics_data(smu, METRICS_UNIQUE_ID_UPPER32, &upper32))
1986 if (sienna_cichlid_get_smu_metrics_data(smu, METRICS_UNIQUE_ID_LOWER32, &lower32))
1991 adev->unique_id = ((uint64_t)upper32 << 32) | lower32;
1992 if (adev->serial[0] == '\0')
1993 sprintf(adev->serial, "%016llx", adev->unique_id);
1996 static int sienna_cichlid_get_uclk_dpm_states(struct smu_context *smu, uint32_t *clocks_in_khz, uint32_t *num_states)
1998 uint32_t num_discrete_levels = 0;
1999 uint16_t *dpm_levels = NULL;
2001 struct smu_table_context *table_context = &smu->smu_table;
2002 DpmDescriptor_t *table_member1;
2003 uint16_t *table_member2;
2005 if (!clocks_in_khz || !num_states || !table_context->driver_pptable)
2008 GET_PPTABLE_MEMBER(DpmDescriptor, &table_member1);
2009 num_discrete_levels = table_member1[PPCLK_UCLK].NumDiscreteLevels;
2010 GET_PPTABLE_MEMBER(FreqTableUclk, &table_member2);
2011 dpm_levels = table_member2;
2013 if (num_discrete_levels == 0 || dpm_levels == NULL)
2016 *num_states = num_discrete_levels;
2017 for (i = 0; i < num_discrete_levels; i++) {
2018 /* convert to khz */
2019 *clocks_in_khz = (*dpm_levels) * 1000;
2027 static int sienna_cichlid_get_thermal_temperature_range(struct smu_context *smu,
2028 struct smu_temperature_range *range)
2030 struct smu_table_context *table_context = &smu->smu_table;
2031 struct smu_11_0_7_powerplay_table *powerplay_table =
2032 table_context->power_play_table;
2033 uint16_t *table_member;
2034 uint16_t temp_edge, temp_hotspot, temp_mem;
2039 memcpy(range, &smu11_thermal_policy[0], sizeof(struct smu_temperature_range));
2041 GET_PPTABLE_MEMBER(TemperatureLimit, &table_member);
2042 temp_edge = table_member[TEMP_EDGE];
2043 temp_hotspot = table_member[TEMP_HOTSPOT];
2044 temp_mem = table_member[TEMP_MEM];
2046 range->max = temp_edge * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
2047 range->edge_emergency_max = (temp_edge + CTF_OFFSET_EDGE) *
2048 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
2049 range->hotspot_crit_max = temp_hotspot * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
2050 range->hotspot_emergency_max = (temp_hotspot + CTF_OFFSET_HOTSPOT) *
2051 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
2052 range->mem_crit_max = temp_mem * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
2053 range->mem_emergency_max = (temp_mem + CTF_OFFSET_MEM)*
2054 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
2056 range->software_shutdown_temp = powerplay_table->software_shutdown_temp;
2061 static int sienna_cichlid_display_disable_memory_clock_switch(struct smu_context *smu,
2062 bool disable_memory_clock_switch)
2065 struct smu_11_0_max_sustainable_clocks *max_sustainable_clocks =
2066 (struct smu_11_0_max_sustainable_clocks *)
2067 smu->smu_table.max_sustainable_clocks;
2068 uint32_t min_memory_clock = smu->hard_min_uclk_req_from_dal;
2069 uint32_t max_memory_clock = max_sustainable_clocks->uclock;
2071 if(smu->disable_uclk_switch == disable_memory_clock_switch)
2074 if(disable_memory_clock_switch)
2075 ret = smu_v11_0_set_hard_freq_limited_range(smu, SMU_UCLK, max_memory_clock, 0);
2077 ret = smu_v11_0_set_hard_freq_limited_range(smu, SMU_UCLK, min_memory_clock, 0);
2080 smu->disable_uclk_switch = disable_memory_clock_switch;
2085 #define MAX(a, b) ((a) > (b) ? (a) : (b))
2087 static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu,
2088 uint32_t pcie_gen_cap,
2089 uint32_t pcie_width_cap)
2091 struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
2092 struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table;
2093 uint8_t *table_member1, *table_member2;
2094 uint32_t min_gen_speed, max_gen_speed;
2095 uint32_t min_lane_width, max_lane_width;
2096 uint32_t smu_pcie_arg;
2099 GET_PPTABLE_MEMBER(PcieGenSpeed, &table_member1);
2100 GET_PPTABLE_MEMBER(PcieLaneCount, &table_member2);
2102 min_gen_speed = MAX(0, table_member1[0]);
2103 max_gen_speed = MIN(pcie_gen_cap, table_member1[1]);
2104 min_gen_speed = min_gen_speed > max_gen_speed ?
2105 max_gen_speed : min_gen_speed;
2106 min_lane_width = MAX(1, table_member2[0]);
2107 max_lane_width = MIN(pcie_width_cap, table_member2[1]);
2108 min_lane_width = min_lane_width > max_lane_width ?
2109 max_lane_width : min_lane_width;
2111 if (!amdgpu_device_pcie_dynamic_switching_supported()) {
2112 pcie_table->pcie_gen[0] = max_gen_speed;
2113 pcie_table->pcie_lane[0] = max_lane_width;
2115 pcie_table->pcie_gen[0] = min_gen_speed;
2116 pcie_table->pcie_lane[0] = min_lane_width;
2118 pcie_table->pcie_gen[1] = max_gen_speed;
2119 pcie_table->pcie_lane[1] = max_lane_width;
2121 for (i = 0; i < NUM_LINK_LEVELS; i++) {
2122 smu_pcie_arg = (i << 16 |
2123 pcie_table->pcie_gen[i] << 8 |
2124 pcie_table->pcie_lane[i]);
2126 ret = smu_cmn_send_smc_msg_with_param(smu,
2127 SMU_MSG_OverridePcieParameters,
2137 static int sienna_cichlid_get_dpm_ultimate_freq(struct smu_context *smu,
2138 enum smu_clk_type clk_type,
2139 uint32_t *min, uint32_t *max)
2141 return smu_v11_0_get_dpm_ultimate_freq(smu, clk_type, min, max);
2144 static void sienna_cichlid_dump_od_table(struct smu_context *smu,
2145 OverDriveTable_t *od_table)
2147 struct amdgpu_device *adev = smu->adev;
2148 uint32_t smu_version;
2150 dev_dbg(smu->adev->dev, "OD: Gfxclk: (%d, %d)\n", od_table->GfxclkFmin,
2151 od_table->GfxclkFmax);
2152 dev_dbg(smu->adev->dev, "OD: Uclk: (%d, %d)\n", od_table->UclkFmin,
2153 od_table->UclkFmax);
2155 smu_cmn_get_smc_version(smu, NULL, &smu_version);
2156 if (!((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
2157 (smu_version < 0x003a2900)))
2158 dev_dbg(smu->adev->dev, "OD: VddGfxOffset: %d\n", od_table->VddGfxOffset);
2161 static int sienna_cichlid_set_default_od_settings(struct smu_context *smu)
2163 OverDriveTable_t *od_table =
2164 (OverDriveTable_t *)smu->smu_table.overdrive_table;
2165 OverDriveTable_t *boot_od_table =
2166 (OverDriveTable_t *)smu->smu_table.boot_overdrive_table;
2167 OverDriveTable_t *user_od_table =
2168 (OverDriveTable_t *)smu->smu_table.user_overdrive_table;
2169 OverDriveTable_t user_od_table_bak;
2172 ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE,
2173 0, (void *)boot_od_table, false);
2175 dev_err(smu->adev->dev, "Failed to get overdrive table!\n");
2179 sienna_cichlid_dump_od_table(smu, boot_od_table);
2181 memcpy(od_table, boot_od_table, sizeof(OverDriveTable_t));
2184 * For S3/S4/Runpm resume, we need to setup those overdrive tables again,
2185 * but we have to preserve user defined values in "user_od_table".
2187 if (!smu->adev->in_suspend) {
2188 memcpy(user_od_table, boot_od_table, sizeof(OverDriveTable_t));
2189 smu->user_dpm_profile.user_od = false;
2190 } else if (smu->user_dpm_profile.user_od) {
2191 memcpy(&user_od_table_bak, user_od_table, sizeof(OverDriveTable_t));
2192 memcpy(user_od_table, boot_od_table, sizeof(OverDriveTable_t));
2193 user_od_table->GfxclkFmin = user_od_table_bak.GfxclkFmin;
2194 user_od_table->GfxclkFmax = user_od_table_bak.GfxclkFmax;
2195 user_od_table->UclkFmin = user_od_table_bak.UclkFmin;
2196 user_od_table->UclkFmax = user_od_table_bak.UclkFmax;
2197 user_od_table->VddGfxOffset = user_od_table_bak.VddGfxOffset;
2203 static int sienna_cichlid_od_setting_check_range(struct smu_context *smu,
2204 struct smu_11_0_7_overdrive_table *od_table,
2205 enum SMU_11_0_7_ODSETTING_ID setting,
2208 if (value < od_table->min[setting]) {
2209 dev_warn(smu->adev->dev, "OD setting (%d, %d) is less than the minimum allowed (%d)\n",
2210 setting, value, od_table->min[setting]);
2213 if (value > od_table->max[setting]) {
2214 dev_warn(smu->adev->dev, "OD setting (%d, %d) is greater than the maximum allowed (%d)\n",
2215 setting, value, od_table->max[setting]);
2222 static int sienna_cichlid_od_edit_dpm_table(struct smu_context *smu,
2223 enum PP_OD_DPM_TABLE_COMMAND type,
2224 long input[], uint32_t size)
2226 struct smu_table_context *table_context = &smu->smu_table;
2227 OverDriveTable_t *od_table =
2228 (OverDriveTable_t *)table_context->overdrive_table;
2229 struct smu_11_0_7_overdrive_table *od_settings =
2230 (struct smu_11_0_7_overdrive_table *)smu->od_settings;
2231 struct amdgpu_device *adev = smu->adev;
2232 enum SMU_11_0_7_ODSETTING_ID freq_setting;
2235 uint32_t smu_version;
2237 if (!smu->od_enabled) {
2238 dev_warn(smu->adev->dev, "OverDrive is not enabled!\n");
2242 if (!smu->od_settings) {
2243 dev_err(smu->adev->dev, "OD board limits are not set!\n");
2247 if (!(table_context->overdrive_table && table_context->boot_overdrive_table)) {
2248 dev_err(smu->adev->dev, "Overdrive table was not initialized!\n");
2253 case PP_OD_EDIT_SCLK_VDDC_TABLE:
2254 if (!sienna_cichlid_is_od_feature_supported(od_settings,
2255 SMU_11_0_7_ODCAP_GFXCLK_LIMITS)) {
2256 dev_warn(smu->adev->dev, "GFXCLK_LIMITS not supported!\n");
2260 for (i = 0; i < size; i += 2) {
2262 dev_info(smu->adev->dev, "invalid number of input parameters %d\n", size);
2268 if (input[i + 1] > od_table->GfxclkFmax) {
2269 dev_info(smu->adev->dev, "GfxclkFmin (%ld) must be <= GfxclkFmax (%u)!\n",
2270 input[i + 1], od_table->GfxclkFmax);
2274 freq_setting = SMU_11_0_7_ODSETTING_GFXCLKFMIN;
2275 freq_ptr = &od_table->GfxclkFmin;
2279 if (input[i + 1] < od_table->GfxclkFmin) {
2280 dev_info(smu->adev->dev, "GfxclkFmax (%ld) must be >= GfxclkFmin (%u)!\n",
2281 input[i + 1], od_table->GfxclkFmin);
2285 freq_setting = SMU_11_0_7_ODSETTING_GFXCLKFMAX;
2286 freq_ptr = &od_table->GfxclkFmax;
2290 dev_info(smu->adev->dev, "Invalid SCLK_VDDC_TABLE index: %ld\n", input[i]);
2291 dev_info(smu->adev->dev, "Supported indices: [0:min,1:max]\n");
2295 ret = sienna_cichlid_od_setting_check_range(smu, od_settings,
2296 freq_setting, input[i + 1]);
2300 *freq_ptr = (uint16_t)input[i + 1];
2304 case PP_OD_EDIT_MCLK_VDDC_TABLE:
2305 if (!sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_UCLK_LIMITS)) {
2306 dev_warn(smu->adev->dev, "UCLK_LIMITS not supported!\n");
2310 for (i = 0; i < size; i += 2) {
2312 dev_info(smu->adev->dev, "invalid number of input parameters %d\n", size);
2318 if (input[i + 1] > od_table->UclkFmax) {
2319 dev_info(smu->adev->dev, "UclkFmin (%ld) must be <= UclkFmax (%u)!\n",
2320 input[i + 1], od_table->UclkFmax);
2324 freq_setting = SMU_11_0_7_ODSETTING_UCLKFMIN;
2325 freq_ptr = &od_table->UclkFmin;
2329 if (input[i + 1] < od_table->UclkFmin) {
2330 dev_info(smu->adev->dev, "UclkFmax (%ld) must be >= UclkFmin (%u)!\n",
2331 input[i + 1], od_table->UclkFmin);
2335 freq_setting = SMU_11_0_7_ODSETTING_UCLKFMAX;
2336 freq_ptr = &od_table->UclkFmax;
2340 dev_info(smu->adev->dev, "Invalid MCLK_VDDC_TABLE index: %ld\n", input[i]);
2341 dev_info(smu->adev->dev, "Supported indices: [0:min,1:max]\n");
2345 ret = sienna_cichlid_od_setting_check_range(smu, od_settings,
2346 freq_setting, input[i + 1]);
2350 *freq_ptr = (uint16_t)input[i + 1];
2354 case PP_OD_RESTORE_DEFAULT_TABLE:
2355 memcpy(table_context->overdrive_table,
2356 table_context->boot_overdrive_table,
2357 sizeof(OverDriveTable_t));
2360 case PP_OD_COMMIT_DPM_TABLE:
2361 if (memcmp(od_table, table_context->user_overdrive_table, sizeof(OverDriveTable_t))) {
2362 sienna_cichlid_dump_od_table(smu, od_table);
2363 ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE, 0, (void *)od_table, true);
2365 dev_err(smu->adev->dev, "Failed to import overdrive table!\n");
2368 memcpy(table_context->user_overdrive_table, od_table, sizeof(OverDriveTable_t));
2369 smu->user_dpm_profile.user_od = true;
2371 if (!memcmp(table_context->user_overdrive_table,
2372 table_context->boot_overdrive_table,
2373 sizeof(OverDriveTable_t)))
2374 smu->user_dpm_profile.user_od = false;
2378 case PP_OD_EDIT_VDDGFX_OFFSET:
2380 dev_info(smu->adev->dev, "invalid number of parameters: %d\n", size);
2385 * OD GFX Voltage Offset functionality is supported only by 58.41.0
2386 * and onwards SMU firmwares.
2388 smu_cmn_get_smc_version(smu, NULL, &smu_version);
2389 if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
2390 (smu_version < 0x003a2900)) {
2391 dev_err(smu->adev->dev, "OD GFX Voltage offset functionality is supported "
2392 "only by 58.41.0 and onwards SMU firmwares!\n");
2396 od_table->VddGfxOffset = (int16_t)input[0];
2398 sienna_cichlid_dump_od_table(smu, od_table);
2408 static int sienna_cichlid_restore_user_od_settings(struct smu_context *smu)
2410 struct smu_table_context *table_context = &smu->smu_table;
2411 OverDriveTable_t *od_table = table_context->overdrive_table;
2412 OverDriveTable_t *user_od_table = table_context->user_overdrive_table;
2415 res = smu_v11_0_restore_user_od_settings(smu);
2417 memcpy(od_table, user_od_table, sizeof(OverDriveTable_t));
2422 static int sienna_cichlid_run_btc(struct smu_context *smu)
2426 res = smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL);
2428 dev_err(smu->adev->dev, "RunDcBtc failed!\n");
2433 static int sienna_cichlid_baco_enter(struct smu_context *smu)
2435 struct amdgpu_device *adev = smu->adev;
2437 if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
2438 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO);
2440 return smu_v11_0_baco_enter(smu);
2443 static int sienna_cichlid_baco_exit(struct smu_context *smu)
2445 struct amdgpu_device *adev = smu->adev;
2447 if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
2448 /* Wait for PMFW handling for the Dstate change */
2450 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
2452 return smu_v11_0_baco_exit(smu);
2456 static bool sienna_cichlid_is_mode1_reset_supported(struct smu_context *smu)
2458 struct amdgpu_device *adev = smu->adev;
2463 * SRIOV env will not support SMU mode1 reset
2464 * PM FW support mode1 reset from 58.26
2466 smu_cmn_get_smc_version(smu, NULL, &smu_version);
2467 if (amdgpu_sriov_vf(adev) || (smu_version < 0x003a1a00))
2471 * mode1 reset relies on PSP, so we should check if
2474 val = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
2478 static void beige_goby_dump_pptable(struct smu_context *smu)
2480 struct smu_table_context *table_context = &smu->smu_table;
2481 PPTable_beige_goby_t *pptable = table_context->driver_pptable;
2484 dev_info(smu->adev->dev, "Dumped PPTable:\n");
2486 dev_info(smu->adev->dev, "Version = 0x%08x\n", pptable->Version);
2487 dev_info(smu->adev->dev, "FeaturesToRun[0] = 0x%08x\n", pptable->FeaturesToRun[0]);
2488 dev_info(smu->adev->dev, "FeaturesToRun[1] = 0x%08x\n", pptable->FeaturesToRun[1]);
2490 for (i = 0; i < PPT_THROTTLER_COUNT; i++) {
2491 dev_info(smu->adev->dev, "SocketPowerLimitAc[%d] = 0x%x\n", i, pptable->SocketPowerLimitAc[i]);
2492 dev_info(smu->adev->dev, "SocketPowerLimitAcTau[%d] = 0x%x\n", i, pptable->SocketPowerLimitAcTau[i]);
2493 dev_info(smu->adev->dev, "SocketPowerLimitDc[%d] = 0x%x\n", i, pptable->SocketPowerLimitDc[i]);
2494 dev_info(smu->adev->dev, "SocketPowerLimitDcTau[%d] = 0x%x\n", i, pptable->SocketPowerLimitDcTau[i]);
2497 for (i = 0; i < TDC_THROTTLER_COUNT; i++) {
2498 dev_info(smu->adev->dev, "TdcLimit[%d] = 0x%x\n", i, pptable->TdcLimit[i]);
2499 dev_info(smu->adev->dev, "TdcLimitTau[%d] = 0x%x\n", i, pptable->TdcLimitTau[i]);
2502 for (i = 0; i < TEMP_COUNT; i++) {
2503 dev_info(smu->adev->dev, "TemperatureLimit[%d] = 0x%x\n", i, pptable->TemperatureLimit[i]);
2506 dev_info(smu->adev->dev, "FitLimit = 0x%x\n", pptable->FitLimit);
2507 dev_info(smu->adev->dev, "TotalPowerConfig = 0x%x\n", pptable->TotalPowerConfig);
2508 dev_info(smu->adev->dev, "TotalPowerPadding[0] = 0x%x\n", pptable->TotalPowerPadding[0]);
2509 dev_info(smu->adev->dev, "TotalPowerPadding[1] = 0x%x\n", pptable->TotalPowerPadding[1]);
2510 dev_info(smu->adev->dev, "TotalPowerPadding[2] = 0x%x\n", pptable->TotalPowerPadding[2]);
2512 dev_info(smu->adev->dev, "ApccPlusResidencyLimit = 0x%x\n", pptable->ApccPlusResidencyLimit);
2513 for (i = 0; i < NUM_SMNCLK_DPM_LEVELS; i++) {
2514 dev_info(smu->adev->dev, "SmnclkDpmFreq[%d] = 0x%x\n", i, pptable->SmnclkDpmFreq[i]);
2515 dev_info(smu->adev->dev, "SmnclkDpmVoltage[%d] = 0x%x\n", i, pptable->SmnclkDpmVoltage[i]);
2517 dev_info(smu->adev->dev, "ThrottlerControlMask = 0x%x\n", pptable->ThrottlerControlMask);
2519 dev_info(smu->adev->dev, "FwDStateMask = 0x%x\n", pptable->FwDStateMask);
2521 dev_info(smu->adev->dev, "UlvVoltageOffsetSoc = 0x%x\n", pptable->UlvVoltageOffsetSoc);
2522 dev_info(smu->adev->dev, "UlvVoltageOffsetGfx = 0x%x\n", pptable->UlvVoltageOffsetGfx);
2523 dev_info(smu->adev->dev, "MinVoltageUlvGfx = 0x%x\n", pptable->MinVoltageUlvGfx);
2524 dev_info(smu->adev->dev, "MinVoltageUlvSoc = 0x%x\n", pptable->MinVoltageUlvSoc);
2526 dev_info(smu->adev->dev, "SocLIVmin = 0x%x\n", pptable->SocLIVmin);
2528 dev_info(smu->adev->dev, "GceaLinkMgrIdleThreshold = 0x%x\n", pptable->GceaLinkMgrIdleThreshold);
2530 dev_info(smu->adev->dev, "MinVoltageGfx = 0x%x\n", pptable->MinVoltageGfx);
2531 dev_info(smu->adev->dev, "MinVoltageSoc = 0x%x\n", pptable->MinVoltageSoc);
2532 dev_info(smu->adev->dev, "MaxVoltageGfx = 0x%x\n", pptable->MaxVoltageGfx);
2533 dev_info(smu->adev->dev, "MaxVoltageSoc = 0x%x\n", pptable->MaxVoltageSoc);
2535 dev_info(smu->adev->dev, "LoadLineResistanceGfx = 0x%x\n", pptable->LoadLineResistanceGfx);
2536 dev_info(smu->adev->dev, "LoadLineResistanceSoc = 0x%x\n", pptable->LoadLineResistanceSoc);
2538 dev_info(smu->adev->dev, "VDDGFX_TVmin = 0x%x\n", pptable->VDDGFX_TVmin);
2539 dev_info(smu->adev->dev, "VDDSOC_TVmin = 0x%x\n", pptable->VDDSOC_TVmin);
2540 dev_info(smu->adev->dev, "VDDGFX_Vmin_HiTemp = 0x%x\n", pptable->VDDGFX_Vmin_HiTemp);
2541 dev_info(smu->adev->dev, "VDDGFX_Vmin_LoTemp = 0x%x\n", pptable->VDDGFX_Vmin_LoTemp);
2542 dev_info(smu->adev->dev, "VDDSOC_Vmin_HiTemp = 0x%x\n", pptable->VDDSOC_Vmin_HiTemp);
2543 dev_info(smu->adev->dev, "VDDSOC_Vmin_LoTemp = 0x%x\n", pptable->VDDSOC_Vmin_LoTemp);
2544 dev_info(smu->adev->dev, "VDDGFX_TVminHystersis = 0x%x\n", pptable->VDDGFX_TVminHystersis);
2545 dev_info(smu->adev->dev, "VDDSOC_TVminHystersis = 0x%x\n", pptable->VDDSOC_TVminHystersis);
2547 dev_info(smu->adev->dev, "[PPCLK_GFXCLK]\n"
2548 " .VoltageMode = 0x%02x\n"
2549 " .SnapToDiscrete = 0x%02x\n"
2550 " .NumDiscreteLevels = 0x%02x\n"
2551 " .padding = 0x%02x\n"
2552 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2553 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2554 " .SsFmin = 0x%04x\n"
2555 " .Padding_16 = 0x%04x\n",
2556 pptable->DpmDescriptor[PPCLK_GFXCLK].VoltageMode,
2557 pptable->DpmDescriptor[PPCLK_GFXCLK].SnapToDiscrete,
2558 pptable->DpmDescriptor[PPCLK_GFXCLK].NumDiscreteLevels,
2559 pptable->DpmDescriptor[PPCLK_GFXCLK].Padding,
2560 pptable->DpmDescriptor[PPCLK_GFXCLK].ConversionToAvfsClk.m,
2561 pptable->DpmDescriptor[PPCLK_GFXCLK].ConversionToAvfsClk.b,
2562 pptable->DpmDescriptor[PPCLK_GFXCLK].SsCurve.a,
2563 pptable->DpmDescriptor[PPCLK_GFXCLK].SsCurve.b,
2564 pptable->DpmDescriptor[PPCLK_GFXCLK].SsCurve.c,
2565 pptable->DpmDescriptor[PPCLK_GFXCLK].SsFmin,
2566 pptable->DpmDescriptor[PPCLK_GFXCLK].Padding16);
2568 dev_info(smu->adev->dev, "[PPCLK_SOCCLK]\n"
2569 " .VoltageMode = 0x%02x\n"
2570 " .SnapToDiscrete = 0x%02x\n"
2571 " .NumDiscreteLevels = 0x%02x\n"
2572 " .padding = 0x%02x\n"
2573 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2574 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2575 " .SsFmin = 0x%04x\n"
2576 " .Padding_16 = 0x%04x\n",
2577 pptable->DpmDescriptor[PPCLK_SOCCLK].VoltageMode,
2578 pptable->DpmDescriptor[PPCLK_SOCCLK].SnapToDiscrete,
2579 pptable->DpmDescriptor[PPCLK_SOCCLK].NumDiscreteLevels,
2580 pptable->DpmDescriptor[PPCLK_SOCCLK].Padding,
2581 pptable->DpmDescriptor[PPCLK_SOCCLK].ConversionToAvfsClk.m,
2582 pptable->DpmDescriptor[PPCLK_SOCCLK].ConversionToAvfsClk.b,
2583 pptable->DpmDescriptor[PPCLK_SOCCLK].SsCurve.a,
2584 pptable->DpmDescriptor[PPCLK_SOCCLK].SsCurve.b,
2585 pptable->DpmDescriptor[PPCLK_SOCCLK].SsCurve.c,
2586 pptable->DpmDescriptor[PPCLK_SOCCLK].SsFmin,
2587 pptable->DpmDescriptor[PPCLK_SOCCLK].Padding16);
2589 dev_info(smu->adev->dev, "[PPCLK_UCLK]\n"
2590 " .VoltageMode = 0x%02x\n"
2591 " .SnapToDiscrete = 0x%02x\n"
2592 " .NumDiscreteLevels = 0x%02x\n"
2593 " .padding = 0x%02x\n"
2594 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2595 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2596 " .SsFmin = 0x%04x\n"
2597 " .Padding_16 = 0x%04x\n",
2598 pptable->DpmDescriptor[PPCLK_UCLK].VoltageMode,
2599 pptable->DpmDescriptor[PPCLK_UCLK].SnapToDiscrete,
2600 pptable->DpmDescriptor[PPCLK_UCLK].NumDiscreteLevels,
2601 pptable->DpmDescriptor[PPCLK_UCLK].Padding,
2602 pptable->DpmDescriptor[PPCLK_UCLK].ConversionToAvfsClk.m,
2603 pptable->DpmDescriptor[PPCLK_UCLK].ConversionToAvfsClk.b,
2604 pptable->DpmDescriptor[PPCLK_UCLK].SsCurve.a,
2605 pptable->DpmDescriptor[PPCLK_UCLK].SsCurve.b,
2606 pptable->DpmDescriptor[PPCLK_UCLK].SsCurve.c,
2607 pptable->DpmDescriptor[PPCLK_UCLK].SsFmin,
2608 pptable->DpmDescriptor[PPCLK_UCLK].Padding16);
2610 dev_info(smu->adev->dev, "[PPCLK_FCLK]\n"
2611 " .VoltageMode = 0x%02x\n"
2612 " .SnapToDiscrete = 0x%02x\n"
2613 " .NumDiscreteLevels = 0x%02x\n"
2614 " .padding = 0x%02x\n"
2615 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2616 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2617 " .SsFmin = 0x%04x\n"
2618 " .Padding_16 = 0x%04x\n",
2619 pptable->DpmDescriptor[PPCLK_FCLK].VoltageMode,
2620 pptable->DpmDescriptor[PPCLK_FCLK].SnapToDiscrete,
2621 pptable->DpmDescriptor[PPCLK_FCLK].NumDiscreteLevels,
2622 pptable->DpmDescriptor[PPCLK_FCLK].Padding,
2623 pptable->DpmDescriptor[PPCLK_FCLK].ConversionToAvfsClk.m,
2624 pptable->DpmDescriptor[PPCLK_FCLK].ConversionToAvfsClk.b,
2625 pptable->DpmDescriptor[PPCLK_FCLK].SsCurve.a,
2626 pptable->DpmDescriptor[PPCLK_FCLK].SsCurve.b,
2627 pptable->DpmDescriptor[PPCLK_FCLK].SsCurve.c,
2628 pptable->DpmDescriptor[PPCLK_FCLK].SsFmin,
2629 pptable->DpmDescriptor[PPCLK_FCLK].Padding16);
2631 dev_info(smu->adev->dev, "[PPCLK_DCLK_0]\n"
2632 " .VoltageMode = 0x%02x\n"
2633 " .SnapToDiscrete = 0x%02x\n"
2634 " .NumDiscreteLevels = 0x%02x\n"
2635 " .padding = 0x%02x\n"
2636 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2637 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2638 " .SsFmin = 0x%04x\n"
2639 " .Padding_16 = 0x%04x\n",
2640 pptable->DpmDescriptor[PPCLK_DCLK_0].VoltageMode,
2641 pptable->DpmDescriptor[PPCLK_DCLK_0].SnapToDiscrete,
2642 pptable->DpmDescriptor[PPCLK_DCLK_0].NumDiscreteLevels,
2643 pptable->DpmDescriptor[PPCLK_DCLK_0].Padding,
2644 pptable->DpmDescriptor[PPCLK_DCLK_0].ConversionToAvfsClk.m,
2645 pptable->DpmDescriptor[PPCLK_DCLK_0].ConversionToAvfsClk.b,
2646 pptable->DpmDescriptor[PPCLK_DCLK_0].SsCurve.a,
2647 pptable->DpmDescriptor[PPCLK_DCLK_0].SsCurve.b,
2648 pptable->DpmDescriptor[PPCLK_DCLK_0].SsCurve.c,
2649 pptable->DpmDescriptor[PPCLK_DCLK_0].SsFmin,
2650 pptable->DpmDescriptor[PPCLK_DCLK_0].Padding16);
2652 dev_info(smu->adev->dev, "[PPCLK_VCLK_0]\n"
2653 " .VoltageMode = 0x%02x\n"
2654 " .SnapToDiscrete = 0x%02x\n"
2655 " .NumDiscreteLevels = 0x%02x\n"
2656 " .padding = 0x%02x\n"
2657 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2658 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2659 " .SsFmin = 0x%04x\n"
2660 " .Padding_16 = 0x%04x\n",
2661 pptable->DpmDescriptor[PPCLK_VCLK_0].VoltageMode,
2662 pptable->DpmDescriptor[PPCLK_VCLK_0].SnapToDiscrete,
2663 pptable->DpmDescriptor[PPCLK_VCLK_0].NumDiscreteLevels,
2664 pptable->DpmDescriptor[PPCLK_VCLK_0].Padding,
2665 pptable->DpmDescriptor[PPCLK_VCLK_0].ConversionToAvfsClk.m,
2666 pptable->DpmDescriptor[PPCLK_VCLK_0].ConversionToAvfsClk.b,
2667 pptable->DpmDescriptor[PPCLK_VCLK_0].SsCurve.a,
2668 pptable->DpmDescriptor[PPCLK_VCLK_0].SsCurve.b,
2669 pptable->DpmDescriptor[PPCLK_VCLK_0].SsCurve.c,
2670 pptable->DpmDescriptor[PPCLK_VCLK_0].SsFmin,
2671 pptable->DpmDescriptor[PPCLK_VCLK_0].Padding16);
2673 dev_info(smu->adev->dev, "[PPCLK_DCLK_1]\n"
2674 " .VoltageMode = 0x%02x\n"
2675 " .SnapToDiscrete = 0x%02x\n"
2676 " .NumDiscreteLevels = 0x%02x\n"
2677 " .padding = 0x%02x\n"
2678 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2679 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2680 " .SsFmin = 0x%04x\n"
2681 " .Padding_16 = 0x%04x\n",
2682 pptable->DpmDescriptor[PPCLK_DCLK_1].VoltageMode,
2683 pptable->DpmDescriptor[PPCLK_DCLK_1].SnapToDiscrete,
2684 pptable->DpmDescriptor[PPCLK_DCLK_1].NumDiscreteLevels,
2685 pptable->DpmDescriptor[PPCLK_DCLK_1].Padding,
2686 pptable->DpmDescriptor[PPCLK_DCLK_1].ConversionToAvfsClk.m,
2687 pptable->DpmDescriptor[PPCLK_DCLK_1].ConversionToAvfsClk.b,
2688 pptable->DpmDescriptor[PPCLK_DCLK_1].SsCurve.a,
2689 pptable->DpmDescriptor[PPCLK_DCLK_1].SsCurve.b,
2690 pptable->DpmDescriptor[PPCLK_DCLK_1].SsCurve.c,
2691 pptable->DpmDescriptor[PPCLK_DCLK_1].SsFmin,
2692 pptable->DpmDescriptor[PPCLK_DCLK_1].Padding16);
2694 dev_info(smu->adev->dev, "[PPCLK_VCLK_1]\n"
2695 " .VoltageMode = 0x%02x\n"
2696 " .SnapToDiscrete = 0x%02x\n"
2697 " .NumDiscreteLevels = 0x%02x\n"
2698 " .padding = 0x%02x\n"
2699 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
2700 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
2701 " .SsFmin = 0x%04x\n"
2702 " .Padding_16 = 0x%04x\n",
2703 pptable->DpmDescriptor[PPCLK_VCLK_1].VoltageMode,
2704 pptable->DpmDescriptor[PPCLK_VCLK_1].SnapToDiscrete,
2705 pptable->DpmDescriptor[PPCLK_VCLK_1].NumDiscreteLevels,
2706 pptable->DpmDescriptor[PPCLK_VCLK_1].Padding,
2707 pptable->DpmDescriptor[PPCLK_VCLK_1].ConversionToAvfsClk.m,
2708 pptable->DpmDescriptor[PPCLK_VCLK_1].ConversionToAvfsClk.b,
2709 pptable->DpmDescriptor[PPCLK_VCLK_1].SsCurve.a,
2710 pptable->DpmDescriptor[PPCLK_VCLK_1].SsCurve.b,
2711 pptable->DpmDescriptor[PPCLK_VCLK_1].SsCurve.c,
2712 pptable->DpmDescriptor[PPCLK_VCLK_1].SsFmin,
2713 pptable->DpmDescriptor[PPCLK_VCLK_1].Padding16);
2715 dev_info(smu->adev->dev, "FreqTableGfx\n");
2716 for (i = 0; i < NUM_GFXCLK_DPM_LEVELS; i++)
2717 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableGfx[i]);
2719 dev_info(smu->adev->dev, "FreqTableVclk\n");
2720 for (i = 0; i < NUM_VCLK_DPM_LEVELS; i++)
2721 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableVclk[i]);
2723 dev_info(smu->adev->dev, "FreqTableDclk\n");
2724 for (i = 0; i < NUM_DCLK_DPM_LEVELS; i++)
2725 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableDclk[i]);
2727 dev_info(smu->adev->dev, "FreqTableSocclk\n");
2728 for (i = 0; i < NUM_SOCCLK_DPM_LEVELS; i++)
2729 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableSocclk[i]);
2731 dev_info(smu->adev->dev, "FreqTableUclk\n");
2732 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
2733 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableUclk[i]);
2735 dev_info(smu->adev->dev, "FreqTableFclk\n");
2736 for (i = 0; i < NUM_FCLK_DPM_LEVELS; i++)
2737 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableFclk[i]);
2739 dev_info(smu->adev->dev, "DcModeMaxFreq\n");
2740 dev_info(smu->adev->dev, " .PPCLK_GFXCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_GFXCLK]);
2741 dev_info(smu->adev->dev, " .PPCLK_SOCCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_SOCCLK]);
2742 dev_info(smu->adev->dev, " .PPCLK_UCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_UCLK]);
2743 dev_info(smu->adev->dev, " .PPCLK_FCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_FCLK]);
2744 dev_info(smu->adev->dev, " .PPCLK_DCLK_0 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_DCLK_0]);
2745 dev_info(smu->adev->dev, " .PPCLK_VCLK_0 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_VCLK_0]);
2746 dev_info(smu->adev->dev, " .PPCLK_DCLK_1 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_DCLK_1]);
2747 dev_info(smu->adev->dev, " .PPCLK_VCLK_1 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_VCLK_1]);
2749 dev_info(smu->adev->dev, "FreqTableUclkDiv\n");
2750 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
2751 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->FreqTableUclkDiv[i]);
2753 dev_info(smu->adev->dev, "FclkBoostFreq = 0x%x\n", pptable->FclkBoostFreq);
2754 dev_info(smu->adev->dev, "FclkParamPadding = 0x%x\n", pptable->FclkParamPadding);
2756 dev_info(smu->adev->dev, "Mp0clkFreq\n");
2757 for (i = 0; i < NUM_MP0CLK_DPM_LEVELS; i++)
2758 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->Mp0clkFreq[i]);
2760 dev_info(smu->adev->dev, "Mp0DpmVoltage\n");
2761 for (i = 0; i < NUM_MP0CLK_DPM_LEVELS; i++)
2762 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->Mp0DpmVoltage[i]);
2764 dev_info(smu->adev->dev, "MemVddciVoltage\n");
2765 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
2766 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->MemVddciVoltage[i]);
2768 dev_info(smu->adev->dev, "MemMvddVoltage\n");
2769 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
2770 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->MemMvddVoltage[i]);
2772 dev_info(smu->adev->dev, "GfxclkFgfxoffEntry = 0x%x\n", pptable->GfxclkFgfxoffEntry);
2773 dev_info(smu->adev->dev, "GfxclkFinit = 0x%x\n", pptable->GfxclkFinit);
2774 dev_info(smu->adev->dev, "GfxclkFidle = 0x%x\n", pptable->GfxclkFidle);
2775 dev_info(smu->adev->dev, "GfxclkSource = 0x%x\n", pptable->GfxclkSource);
2776 dev_info(smu->adev->dev, "GfxclkPadding = 0x%x\n", pptable->GfxclkPadding);
2778 dev_info(smu->adev->dev, "GfxGpoSubFeatureMask = 0x%x\n", pptable->GfxGpoSubFeatureMask);
2780 dev_info(smu->adev->dev, "GfxGpoEnabledWorkPolicyMask = 0x%x\n", pptable->GfxGpoEnabledWorkPolicyMask);
2781 dev_info(smu->adev->dev, "GfxGpoDisabledWorkPolicyMask = 0x%x\n", pptable->GfxGpoDisabledWorkPolicyMask);
2782 dev_info(smu->adev->dev, "GfxGpoPadding[0] = 0x%x\n", pptable->GfxGpoPadding[0]);
2783 dev_info(smu->adev->dev, "GfxGpoVotingAllow = 0x%x\n", pptable->GfxGpoVotingAllow);
2784 dev_info(smu->adev->dev, "GfxGpoPadding32[0] = 0x%x\n", pptable->GfxGpoPadding32[0]);
2785 dev_info(smu->adev->dev, "GfxGpoPadding32[1] = 0x%x\n", pptable->GfxGpoPadding32[1]);
2786 dev_info(smu->adev->dev, "GfxGpoPadding32[2] = 0x%x\n", pptable->GfxGpoPadding32[2]);
2787 dev_info(smu->adev->dev, "GfxGpoPadding32[3] = 0x%x\n", pptable->GfxGpoPadding32[3]);
2788 dev_info(smu->adev->dev, "GfxDcsFopt = 0x%x\n", pptable->GfxDcsFopt);
2789 dev_info(smu->adev->dev, "GfxDcsFclkFopt = 0x%x\n", pptable->GfxDcsFclkFopt);
2790 dev_info(smu->adev->dev, "GfxDcsUclkFopt = 0x%x\n", pptable->GfxDcsUclkFopt);
2792 dev_info(smu->adev->dev, "DcsGfxOffVoltage = 0x%x\n", pptable->DcsGfxOffVoltage);
2793 dev_info(smu->adev->dev, "DcsMinGfxOffTime = 0x%x\n", pptable->DcsMinGfxOffTime);
2794 dev_info(smu->adev->dev, "DcsMaxGfxOffTime = 0x%x\n", pptable->DcsMaxGfxOffTime);
2795 dev_info(smu->adev->dev, "DcsMinCreditAccum = 0x%x\n", pptable->DcsMinCreditAccum);
2796 dev_info(smu->adev->dev, "DcsExitHysteresis = 0x%x\n", pptable->DcsExitHysteresis);
2797 dev_info(smu->adev->dev, "DcsTimeout = 0x%x\n", pptable->DcsTimeout);
2799 dev_info(smu->adev->dev, "DcsParamPadding[0] = 0x%x\n", pptable->DcsParamPadding[0]);
2800 dev_info(smu->adev->dev, "DcsParamPadding[1] = 0x%x\n", pptable->DcsParamPadding[1]);
2801 dev_info(smu->adev->dev, "DcsParamPadding[2] = 0x%x\n", pptable->DcsParamPadding[2]);
2802 dev_info(smu->adev->dev, "DcsParamPadding[3] = 0x%x\n", pptable->DcsParamPadding[3]);
2803 dev_info(smu->adev->dev, "DcsParamPadding[4] = 0x%x\n", pptable->DcsParamPadding[4]);
2805 dev_info(smu->adev->dev, "FlopsPerByteTable\n");
2806 for (i = 0; i < RLC_PACE_TABLE_NUM_LEVELS; i++)
2807 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->FlopsPerByteTable[i]);
2809 dev_info(smu->adev->dev, "LowestUclkReservedForUlv = 0x%x\n", pptable->LowestUclkReservedForUlv);
2810 dev_info(smu->adev->dev, "vddingMem[0] = 0x%x\n", pptable->PaddingMem[0]);
2811 dev_info(smu->adev->dev, "vddingMem[1] = 0x%x\n", pptable->PaddingMem[1]);
2812 dev_info(smu->adev->dev, "vddingMem[2] = 0x%x\n", pptable->PaddingMem[2]);
2814 dev_info(smu->adev->dev, "UclkDpmPstates\n");
2815 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
2816 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->UclkDpmPstates[i]);
2818 dev_info(smu->adev->dev, "UclkDpmSrcFreqRange\n");
2819 dev_info(smu->adev->dev, " .Fmin = 0x%x\n",
2820 pptable->UclkDpmSrcFreqRange.Fmin);
2821 dev_info(smu->adev->dev, " .Fmax = 0x%x\n",
2822 pptable->UclkDpmSrcFreqRange.Fmax);
2823 dev_info(smu->adev->dev, "UclkDpmTargFreqRange\n");
2824 dev_info(smu->adev->dev, " .Fmin = 0x%x\n",
2825 pptable->UclkDpmTargFreqRange.Fmin);
2826 dev_info(smu->adev->dev, " .Fmax = 0x%x\n",
2827 pptable->UclkDpmTargFreqRange.Fmax);
2828 dev_info(smu->adev->dev, "UclkDpmMidstepFreq = 0x%x\n", pptable->UclkDpmMidstepFreq);
2829 dev_info(smu->adev->dev, "UclkMidstepPadding = 0x%x\n", pptable->UclkMidstepPadding);
2831 dev_info(smu->adev->dev, "PcieGenSpeed\n");
2832 for (i = 0; i < NUM_LINK_LEVELS; i++)
2833 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->PcieGenSpeed[i]);
2835 dev_info(smu->adev->dev, "PcieLaneCount\n");
2836 for (i = 0; i < NUM_LINK_LEVELS; i++)
2837 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->PcieLaneCount[i]);
2839 dev_info(smu->adev->dev, "LclkFreq\n");
2840 for (i = 0; i < NUM_LINK_LEVELS; i++)
2841 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->LclkFreq[i]);
2843 dev_info(smu->adev->dev, "FanStopTemp = 0x%x\n", pptable->FanStopTemp);
2844 dev_info(smu->adev->dev, "FanStartTemp = 0x%x\n", pptable->FanStartTemp);
2846 dev_info(smu->adev->dev, "FanGain\n");
2847 for (i = 0; i < TEMP_COUNT; i++)
2848 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->FanGain[i]);
2850 dev_info(smu->adev->dev, "FanPwmMin = 0x%x\n", pptable->FanPwmMin);
2851 dev_info(smu->adev->dev, "FanAcousticLimitRpm = 0x%x\n", pptable->FanAcousticLimitRpm);
2852 dev_info(smu->adev->dev, "FanThrottlingRpm = 0x%x\n", pptable->FanThrottlingRpm);
2853 dev_info(smu->adev->dev, "FanMaximumRpm = 0x%x\n", pptable->FanMaximumRpm);
2854 dev_info(smu->adev->dev, "MGpuFanBoostLimitRpm = 0x%x\n", pptable->MGpuFanBoostLimitRpm);
2855 dev_info(smu->adev->dev, "FanTargetTemperature = 0x%x\n", pptable->FanTargetTemperature);
2856 dev_info(smu->adev->dev, "FanTargetGfxclk = 0x%x\n", pptable->FanTargetGfxclk);
2857 dev_info(smu->adev->dev, "FanPadding16 = 0x%x\n", pptable->FanPadding16);
2858 dev_info(smu->adev->dev, "FanTempInputSelect = 0x%x\n", pptable->FanTempInputSelect);
2859 dev_info(smu->adev->dev, "FanPadding = 0x%x\n", pptable->FanPadding);
2860 dev_info(smu->adev->dev, "FanZeroRpmEnable = 0x%x\n", pptable->FanZeroRpmEnable);
2861 dev_info(smu->adev->dev, "FanTachEdgePerRev = 0x%x\n", pptable->FanTachEdgePerRev);
2863 dev_info(smu->adev->dev, "FuzzyFan_ErrorSetDelta = 0x%x\n", pptable->FuzzyFan_ErrorSetDelta);
2864 dev_info(smu->adev->dev, "FuzzyFan_ErrorRateSetDelta = 0x%x\n", pptable->FuzzyFan_ErrorRateSetDelta);
2865 dev_info(smu->adev->dev, "FuzzyFan_PwmSetDelta = 0x%x\n", pptable->FuzzyFan_PwmSetDelta);
2866 dev_info(smu->adev->dev, "FuzzyFan_Reserved = 0x%x\n", pptable->FuzzyFan_Reserved);
2868 dev_info(smu->adev->dev, "OverrideAvfsGb[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->OverrideAvfsGb[AVFS_VOLTAGE_GFX]);
2869 dev_info(smu->adev->dev, "OverrideAvfsGb[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->OverrideAvfsGb[AVFS_VOLTAGE_SOC]);
2870 dev_info(smu->adev->dev, "dBtcGbGfxDfllModelSelect = 0x%x\n", pptable->dBtcGbGfxDfllModelSelect);
2871 dev_info(smu->adev->dev, "Padding8_Avfs = 0x%x\n", pptable->Padding8_Avfs);
2873 dev_info(smu->adev->dev, "qAvfsGb[AVFS_VOLTAGE_GFX]{a = 0x%x b = 0x%x c = 0x%x}\n",
2874 pptable->qAvfsGb[AVFS_VOLTAGE_GFX].a,
2875 pptable->qAvfsGb[AVFS_VOLTAGE_GFX].b,
2876 pptable->qAvfsGb[AVFS_VOLTAGE_GFX].c);
2877 dev_info(smu->adev->dev, "qAvfsGb[AVFS_VOLTAGE_SOC]{a = 0x%x b = 0x%x c = 0x%x}\n",
2878 pptable->qAvfsGb[AVFS_VOLTAGE_SOC].a,
2879 pptable->qAvfsGb[AVFS_VOLTAGE_SOC].b,
2880 pptable->qAvfsGb[AVFS_VOLTAGE_SOC].c);
2881 dev_info(smu->adev->dev, "dBtcGbGfxPll{a = 0x%x b = 0x%x c = 0x%x}\n",
2882 pptable->dBtcGbGfxPll.a,
2883 pptable->dBtcGbGfxPll.b,
2884 pptable->dBtcGbGfxPll.c);
2885 dev_info(smu->adev->dev, "dBtcGbGfxAfll{a = 0x%x b = 0x%x c = 0x%x}\n",
2886 pptable->dBtcGbGfxDfll.a,
2887 pptable->dBtcGbGfxDfll.b,
2888 pptable->dBtcGbGfxDfll.c);
2889 dev_info(smu->adev->dev, "dBtcGbSoc{a = 0x%x b = 0x%x c = 0x%x}\n",
2890 pptable->dBtcGbSoc.a,
2891 pptable->dBtcGbSoc.b,
2892 pptable->dBtcGbSoc.c);
2893 dev_info(smu->adev->dev, "qAgingGb[AVFS_VOLTAGE_GFX]{m = 0x%x b = 0x%x}\n",
2894 pptable->qAgingGb[AVFS_VOLTAGE_GFX].m,
2895 pptable->qAgingGb[AVFS_VOLTAGE_GFX].b);
2896 dev_info(smu->adev->dev, "qAgingGb[AVFS_VOLTAGE_SOC]{m = 0x%x b = 0x%x}\n",
2897 pptable->qAgingGb[AVFS_VOLTAGE_SOC].m,
2898 pptable->qAgingGb[AVFS_VOLTAGE_SOC].b);
2900 dev_info(smu->adev->dev, "PiecewiseLinearDroopIntGfxDfll\n");
2901 for (i = 0; i < NUM_PIECE_WISE_LINEAR_DROOP_MODEL_VF_POINTS; i++) {
2902 dev_info(smu->adev->dev, " Fset[%d] = 0x%x\n",
2903 i, pptable->PiecewiseLinearDroopIntGfxDfll.Fset[i]);
2904 dev_info(smu->adev->dev, " Vdroop[%d] = 0x%x\n",
2905 i, pptable->PiecewiseLinearDroopIntGfxDfll.Vdroop[i]);
2908 dev_info(smu->adev->dev, "qStaticVoltageOffset[AVFS_VOLTAGE_GFX]{a = 0x%x b = 0x%x c = 0x%x}\n",
2909 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_GFX].a,
2910 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_GFX].b,
2911 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_GFX].c);
2912 dev_info(smu->adev->dev, "qStaticVoltageOffset[AVFS_VOLTAGE_SOC]{a = 0x%x b = 0x%x c = 0x%x}\n",
2913 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_SOC].a,
2914 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_SOC].b,
2915 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_SOC].c);
2917 dev_info(smu->adev->dev, "DcTol[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcTol[AVFS_VOLTAGE_GFX]);
2918 dev_info(smu->adev->dev, "DcTol[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcTol[AVFS_VOLTAGE_SOC]);
2920 dev_info(smu->adev->dev, "DcBtcEnabled[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcEnabled[AVFS_VOLTAGE_GFX]);
2921 dev_info(smu->adev->dev, "DcBtcEnabled[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcEnabled[AVFS_VOLTAGE_SOC]);
2922 dev_info(smu->adev->dev, "Padding8_GfxBtc[0] = 0x%x\n", pptable->Padding8_GfxBtc[0]);
2923 dev_info(smu->adev->dev, "Padding8_GfxBtc[1] = 0x%x\n", pptable->Padding8_GfxBtc[1]);
2925 dev_info(smu->adev->dev, "DcBtcMin[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcMin[AVFS_VOLTAGE_GFX]);
2926 dev_info(smu->adev->dev, "DcBtcMin[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcMin[AVFS_VOLTAGE_SOC]);
2927 dev_info(smu->adev->dev, "DcBtcMax[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcMax[AVFS_VOLTAGE_GFX]);
2928 dev_info(smu->adev->dev, "DcBtcMax[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcMax[AVFS_VOLTAGE_SOC]);
2930 dev_info(smu->adev->dev, "DcBtcGb[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcGb[AVFS_VOLTAGE_GFX]);
2931 dev_info(smu->adev->dev, "DcBtcGb[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcGb[AVFS_VOLTAGE_SOC]);
2933 dev_info(smu->adev->dev, "XgmiDpmPstates\n");
2934 for (i = 0; i < NUM_XGMI_LEVELS; i++)
2935 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiDpmPstates[i]);
2936 dev_info(smu->adev->dev, "XgmiDpmSpare[0] = 0x%02x\n", pptable->XgmiDpmSpare[0]);
2937 dev_info(smu->adev->dev, "XgmiDpmSpare[1] = 0x%02x\n", pptable->XgmiDpmSpare[1]);
2939 dev_info(smu->adev->dev, "DebugOverrides = 0x%x\n", pptable->DebugOverrides);
2940 dev_info(smu->adev->dev, "ReservedEquation0{a = 0x%x b = 0x%x c = 0x%x}\n",
2941 pptable->ReservedEquation0.a,
2942 pptable->ReservedEquation0.b,
2943 pptable->ReservedEquation0.c);
2944 dev_info(smu->adev->dev, "ReservedEquation1{a = 0x%x b = 0x%x c = 0x%x}\n",
2945 pptable->ReservedEquation1.a,
2946 pptable->ReservedEquation1.b,
2947 pptable->ReservedEquation1.c);
2948 dev_info(smu->adev->dev, "ReservedEquation2{a = 0x%x b = 0x%x c = 0x%x}\n",
2949 pptable->ReservedEquation2.a,
2950 pptable->ReservedEquation2.b,
2951 pptable->ReservedEquation2.c);
2952 dev_info(smu->adev->dev, "ReservedEquation3{a = 0x%x b = 0x%x c = 0x%x}\n",
2953 pptable->ReservedEquation3.a,
2954 pptable->ReservedEquation3.b,
2955 pptable->ReservedEquation3.c);
2957 dev_info(smu->adev->dev, "SkuReserved[0] = 0x%x\n", pptable->SkuReserved[0]);
2958 dev_info(smu->adev->dev, "SkuReserved[1] = 0x%x\n", pptable->SkuReserved[1]);
2959 dev_info(smu->adev->dev, "SkuReserved[2] = 0x%x\n", pptable->SkuReserved[2]);
2960 dev_info(smu->adev->dev, "SkuReserved[3] = 0x%x\n", pptable->SkuReserved[3]);
2961 dev_info(smu->adev->dev, "SkuReserved[4] = 0x%x\n", pptable->SkuReserved[4]);
2962 dev_info(smu->adev->dev, "SkuReserved[5] = 0x%x\n", pptable->SkuReserved[5]);
2963 dev_info(smu->adev->dev, "SkuReserved[6] = 0x%x\n", pptable->SkuReserved[6]);
2964 dev_info(smu->adev->dev, "SkuReserved[7] = 0x%x\n", pptable->SkuReserved[7]);
2966 dev_info(smu->adev->dev, "GamingClk[0] = 0x%x\n", pptable->GamingClk[0]);
2967 dev_info(smu->adev->dev, "GamingClk[1] = 0x%x\n", pptable->GamingClk[1]);
2968 dev_info(smu->adev->dev, "GamingClk[2] = 0x%x\n", pptable->GamingClk[2]);
2969 dev_info(smu->adev->dev, "GamingClk[3] = 0x%x\n", pptable->GamingClk[3]);
2970 dev_info(smu->adev->dev, "GamingClk[4] = 0x%x\n", pptable->GamingClk[4]);
2971 dev_info(smu->adev->dev, "GamingClk[5] = 0x%x\n", pptable->GamingClk[5]);
2973 for (i = 0; i < NUM_I2C_CONTROLLERS; i++) {
2974 dev_info(smu->adev->dev, "I2cControllers[%d]:\n", i);
2975 dev_info(smu->adev->dev, " .Enabled = 0x%x\n",
2976 pptable->I2cControllers[i].Enabled);
2977 dev_info(smu->adev->dev, " .Speed = 0x%x\n",
2978 pptable->I2cControllers[i].Speed);
2979 dev_info(smu->adev->dev, " .SlaveAddress = 0x%x\n",
2980 pptable->I2cControllers[i].SlaveAddress);
2981 dev_info(smu->adev->dev, " .ControllerPort = 0x%x\n",
2982 pptable->I2cControllers[i].ControllerPort);
2983 dev_info(smu->adev->dev, " .ControllerName = 0x%x\n",
2984 pptable->I2cControllers[i].ControllerName);
2985 dev_info(smu->adev->dev, " .ThermalThrottler = 0x%x\n",
2986 pptable->I2cControllers[i].ThermalThrotter);
2987 dev_info(smu->adev->dev, " .I2cProtocol = 0x%x\n",
2988 pptable->I2cControllers[i].I2cProtocol);
2989 dev_info(smu->adev->dev, " .PaddingConfig = 0x%x\n",
2990 pptable->I2cControllers[i].PaddingConfig);
2993 dev_info(smu->adev->dev, "GpioScl = 0x%x\n", pptable->GpioScl);
2994 dev_info(smu->adev->dev, "GpioSda = 0x%x\n", pptable->GpioSda);
2995 dev_info(smu->adev->dev, "FchUsbPdSlaveAddr = 0x%x\n", pptable->FchUsbPdSlaveAddr);
2996 dev_info(smu->adev->dev, "I2cSpare[0] = 0x%x\n", pptable->I2cSpare[0]);
2998 dev_info(smu->adev->dev, "Board Parameters:\n");
2999 dev_info(smu->adev->dev, "VddGfxVrMapping = 0x%x\n", pptable->VddGfxVrMapping);
3000 dev_info(smu->adev->dev, "VddSocVrMapping = 0x%x\n", pptable->VddSocVrMapping);
3001 dev_info(smu->adev->dev, "VddMem0VrMapping = 0x%x\n", pptable->VddMem0VrMapping);
3002 dev_info(smu->adev->dev, "VddMem1VrMapping = 0x%x\n", pptable->VddMem1VrMapping);
3003 dev_info(smu->adev->dev, "GfxUlvPhaseSheddingMask = 0x%x\n", pptable->GfxUlvPhaseSheddingMask);
3004 dev_info(smu->adev->dev, "SocUlvPhaseSheddingMask = 0x%x\n", pptable->SocUlvPhaseSheddingMask);
3005 dev_info(smu->adev->dev, "VddciUlvPhaseSheddingMask = 0x%x\n", pptable->VddciUlvPhaseSheddingMask);
3006 dev_info(smu->adev->dev, "MvddUlvPhaseSheddingMask = 0x%x\n", pptable->MvddUlvPhaseSheddingMask);
3008 dev_info(smu->adev->dev, "GfxMaxCurrent = 0x%x\n", pptable->GfxMaxCurrent);
3009 dev_info(smu->adev->dev, "GfxOffset = 0x%x\n", pptable->GfxOffset);
3010 dev_info(smu->adev->dev, "Padding_TelemetryGfx = 0x%x\n", pptable->Padding_TelemetryGfx);
3012 dev_info(smu->adev->dev, "SocMaxCurrent = 0x%x\n", pptable->SocMaxCurrent);
3013 dev_info(smu->adev->dev, "SocOffset = 0x%x\n", pptable->SocOffset);
3014 dev_info(smu->adev->dev, "Padding_TelemetrySoc = 0x%x\n", pptable->Padding_TelemetrySoc);
3016 dev_info(smu->adev->dev, "Mem0MaxCurrent = 0x%x\n", pptable->Mem0MaxCurrent);
3017 dev_info(smu->adev->dev, "Mem0Offset = 0x%x\n", pptable->Mem0Offset);
3018 dev_info(smu->adev->dev, "Padding_TelemetryMem0 = 0x%x\n", pptable->Padding_TelemetryMem0);
3020 dev_info(smu->adev->dev, "Mem1MaxCurrent = 0x%x\n", pptable->Mem1MaxCurrent);
3021 dev_info(smu->adev->dev, "Mem1Offset = 0x%x\n", pptable->Mem1Offset);
3022 dev_info(smu->adev->dev, "Padding_TelemetryMem1 = 0x%x\n", pptable->Padding_TelemetryMem1);
3024 dev_info(smu->adev->dev, "MvddRatio = 0x%x\n", pptable->MvddRatio);
3026 dev_info(smu->adev->dev, "AcDcGpio = 0x%x\n", pptable->AcDcGpio);
3027 dev_info(smu->adev->dev, "AcDcPolarity = 0x%x\n", pptable->AcDcPolarity);
3028 dev_info(smu->adev->dev, "VR0HotGpio = 0x%x\n", pptable->VR0HotGpio);
3029 dev_info(smu->adev->dev, "VR0HotPolarity = 0x%x\n", pptable->VR0HotPolarity);
3030 dev_info(smu->adev->dev, "VR1HotGpio = 0x%x\n", pptable->VR1HotGpio);
3031 dev_info(smu->adev->dev, "VR1HotPolarity = 0x%x\n", pptable->VR1HotPolarity);
3032 dev_info(smu->adev->dev, "GthrGpio = 0x%x\n", pptable->GthrGpio);
3033 dev_info(smu->adev->dev, "GthrPolarity = 0x%x\n", pptable->GthrPolarity);
3034 dev_info(smu->adev->dev, "LedPin0 = 0x%x\n", pptable->LedPin0);
3035 dev_info(smu->adev->dev, "LedPin1 = 0x%x\n", pptable->LedPin1);
3036 dev_info(smu->adev->dev, "LedPin2 = 0x%x\n", pptable->LedPin2);
3037 dev_info(smu->adev->dev, "LedEnableMask = 0x%x\n", pptable->LedEnableMask);
3038 dev_info(smu->adev->dev, "LedPcie = 0x%x\n", pptable->LedPcie);
3039 dev_info(smu->adev->dev, "LedError = 0x%x\n", pptable->LedError);
3040 dev_info(smu->adev->dev, "LedSpare1[0] = 0x%x\n", pptable->LedSpare1[0]);
3041 dev_info(smu->adev->dev, "LedSpare1[1] = 0x%x\n", pptable->LedSpare1[1]);
3043 dev_info(smu->adev->dev, "PllGfxclkSpreadEnabled = 0x%x\n", pptable->PllGfxclkSpreadEnabled);
3044 dev_info(smu->adev->dev, "PllGfxclkSpreadPercent = 0x%x\n", pptable->PllGfxclkSpreadPercent);
3045 dev_info(smu->adev->dev, "PllGfxclkSpreadFreq = 0x%x\n", pptable->PllGfxclkSpreadFreq);
3047 dev_info(smu->adev->dev, "DfllGfxclkSpreadEnabled = 0x%x\n", pptable->DfllGfxclkSpreadEnabled);
3048 dev_info(smu->adev->dev, "DfllGfxclkSpreadPercent = 0x%x\n", pptable->DfllGfxclkSpreadPercent);
3049 dev_info(smu->adev->dev, "DfllGfxclkSpreadFreq = 0x%x\n", pptable->DfllGfxclkSpreadFreq);
3051 dev_info(smu->adev->dev, "UclkSpreadPadding = 0x%x\n", pptable->UclkSpreadPadding);
3052 dev_info(smu->adev->dev, "UclkSpreadFreq = 0x%x\n", pptable->UclkSpreadFreq);
3054 dev_info(smu->adev->dev, "FclkSpreadEnabled = 0x%x\n", pptable->FclkSpreadEnabled);
3055 dev_info(smu->adev->dev, "FclkSpreadPercent = 0x%x\n", pptable->FclkSpreadPercent);
3056 dev_info(smu->adev->dev, "FclkSpreadFreq = 0x%x\n", pptable->FclkSpreadFreq);
3058 dev_info(smu->adev->dev, "MemoryChannelEnabled = 0x%x\n", pptable->MemoryChannelEnabled);
3059 dev_info(smu->adev->dev, "DramBitWidth = 0x%x\n", pptable->DramBitWidth);
3060 dev_info(smu->adev->dev, "PaddingMem1[0] = 0x%x\n", pptable->PaddingMem1[0]);
3061 dev_info(smu->adev->dev, "PaddingMem1[1] = 0x%x\n", pptable->PaddingMem1[1]);
3062 dev_info(smu->adev->dev, "PaddingMem1[2] = 0x%x\n", pptable->PaddingMem1[2]);
3064 dev_info(smu->adev->dev, "TotalBoardPower = 0x%x\n", pptable->TotalBoardPower);
3065 dev_info(smu->adev->dev, "BoardPowerPadding = 0x%x\n", pptable->BoardPowerPadding);
3067 dev_info(smu->adev->dev, "XgmiLinkSpeed\n");
3068 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3069 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiLinkSpeed[i]);
3070 dev_info(smu->adev->dev, "XgmiLinkWidth\n");
3071 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3072 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiLinkWidth[i]);
3073 dev_info(smu->adev->dev, "XgmiFclkFreq\n");
3074 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3075 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiFclkFreq[i]);
3076 dev_info(smu->adev->dev, "XgmiSocVoltage\n");
3077 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3078 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiSocVoltage[i]);
3080 dev_info(smu->adev->dev, "HsrEnabled = 0x%x\n", pptable->HsrEnabled);
3081 dev_info(smu->adev->dev, "VddqOffEnabled = 0x%x\n", pptable->VddqOffEnabled);
3082 dev_info(smu->adev->dev, "PaddingUmcFlags[0] = 0x%x\n", pptable->PaddingUmcFlags[0]);
3083 dev_info(smu->adev->dev, "PaddingUmcFlags[1] = 0x%x\n", pptable->PaddingUmcFlags[1]);
3085 dev_info(smu->adev->dev, "BoardReserved[0] = 0x%x\n", pptable->BoardReserved[0]);
3086 dev_info(smu->adev->dev, "BoardReserved[1] = 0x%x\n", pptable->BoardReserved[1]);
3087 dev_info(smu->adev->dev, "BoardReserved[2] = 0x%x\n", pptable->BoardReserved[2]);
3088 dev_info(smu->adev->dev, "BoardReserved[3] = 0x%x\n", pptable->BoardReserved[3]);
3089 dev_info(smu->adev->dev, "BoardReserved[4] = 0x%x\n", pptable->BoardReserved[4]);
3090 dev_info(smu->adev->dev, "BoardReserved[5] = 0x%x\n", pptable->BoardReserved[5]);
3091 dev_info(smu->adev->dev, "BoardReserved[6] = 0x%x\n", pptable->BoardReserved[6]);
3092 dev_info(smu->adev->dev, "BoardReserved[7] = 0x%x\n", pptable->BoardReserved[7]);
3093 dev_info(smu->adev->dev, "BoardReserved[8] = 0x%x\n", pptable->BoardReserved[8]);
3094 dev_info(smu->adev->dev, "BoardReserved[9] = 0x%x\n", pptable->BoardReserved[9]);
3095 dev_info(smu->adev->dev, "BoardReserved[10] = 0x%x\n", pptable->BoardReserved[10]);
3097 dev_info(smu->adev->dev, "MmHubPadding[0] = 0x%x\n", pptable->MmHubPadding[0]);
3098 dev_info(smu->adev->dev, "MmHubPadding[1] = 0x%x\n", pptable->MmHubPadding[1]);
3099 dev_info(smu->adev->dev, "MmHubPadding[2] = 0x%x\n", pptable->MmHubPadding[2]);
3100 dev_info(smu->adev->dev, "MmHubPadding[3] = 0x%x\n", pptable->MmHubPadding[3]);
3101 dev_info(smu->adev->dev, "MmHubPadding[4] = 0x%x\n", pptable->MmHubPadding[4]);
3102 dev_info(smu->adev->dev, "MmHubPadding[5] = 0x%x\n", pptable->MmHubPadding[5]);
3103 dev_info(smu->adev->dev, "MmHubPadding[6] = 0x%x\n", pptable->MmHubPadding[6]);
3104 dev_info(smu->adev->dev, "MmHubPadding[7] = 0x%x\n", pptable->MmHubPadding[7]);
3107 static void sienna_cichlid_dump_pptable(struct smu_context *smu)
3109 struct smu_table_context *table_context = &smu->smu_table;
3110 PPTable_t *pptable = table_context->driver_pptable;
3113 if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13)) {
3114 beige_goby_dump_pptable(smu);
3118 dev_info(smu->adev->dev, "Dumped PPTable:\n");
3120 dev_info(smu->adev->dev, "Version = 0x%08x\n", pptable->Version);
3121 dev_info(smu->adev->dev, "FeaturesToRun[0] = 0x%08x\n", pptable->FeaturesToRun[0]);
3122 dev_info(smu->adev->dev, "FeaturesToRun[1] = 0x%08x\n", pptable->FeaturesToRun[1]);
3124 for (i = 0; i < PPT_THROTTLER_COUNT; i++) {
3125 dev_info(smu->adev->dev, "SocketPowerLimitAc[%d] = 0x%x\n", i, pptable->SocketPowerLimitAc[i]);
3126 dev_info(smu->adev->dev, "SocketPowerLimitAcTau[%d] = 0x%x\n", i, pptable->SocketPowerLimitAcTau[i]);
3127 dev_info(smu->adev->dev, "SocketPowerLimitDc[%d] = 0x%x\n", i, pptable->SocketPowerLimitDc[i]);
3128 dev_info(smu->adev->dev, "SocketPowerLimitDcTau[%d] = 0x%x\n", i, pptable->SocketPowerLimitDcTau[i]);
3131 for (i = 0; i < TDC_THROTTLER_COUNT; i++) {
3132 dev_info(smu->adev->dev, "TdcLimit[%d] = 0x%x\n", i, pptable->TdcLimit[i]);
3133 dev_info(smu->adev->dev, "TdcLimitTau[%d] = 0x%x\n", i, pptable->TdcLimitTau[i]);
3136 for (i = 0; i < TEMP_COUNT; i++) {
3137 dev_info(smu->adev->dev, "TemperatureLimit[%d] = 0x%x\n", i, pptable->TemperatureLimit[i]);
3140 dev_info(smu->adev->dev, "FitLimit = 0x%x\n", pptable->FitLimit);
3141 dev_info(smu->adev->dev, "TotalPowerConfig = 0x%x\n", pptable->TotalPowerConfig);
3142 dev_info(smu->adev->dev, "TotalPowerPadding[0] = 0x%x\n", pptable->TotalPowerPadding[0]);
3143 dev_info(smu->adev->dev, "TotalPowerPadding[1] = 0x%x\n", pptable->TotalPowerPadding[1]);
3144 dev_info(smu->adev->dev, "TotalPowerPadding[2] = 0x%x\n", pptable->TotalPowerPadding[2]);
3146 dev_info(smu->adev->dev, "ApccPlusResidencyLimit = 0x%x\n", pptable->ApccPlusResidencyLimit);
3147 for (i = 0; i < NUM_SMNCLK_DPM_LEVELS; i++) {
3148 dev_info(smu->adev->dev, "SmnclkDpmFreq[%d] = 0x%x\n", i, pptable->SmnclkDpmFreq[i]);
3149 dev_info(smu->adev->dev, "SmnclkDpmVoltage[%d] = 0x%x\n", i, pptable->SmnclkDpmVoltage[i]);
3151 dev_info(smu->adev->dev, "ThrottlerControlMask = 0x%x\n", pptable->ThrottlerControlMask);
3153 dev_info(smu->adev->dev, "FwDStateMask = 0x%x\n", pptable->FwDStateMask);
3155 dev_info(smu->adev->dev, "UlvVoltageOffsetSoc = 0x%x\n", pptable->UlvVoltageOffsetSoc);
3156 dev_info(smu->adev->dev, "UlvVoltageOffsetGfx = 0x%x\n", pptable->UlvVoltageOffsetGfx);
3157 dev_info(smu->adev->dev, "MinVoltageUlvGfx = 0x%x\n", pptable->MinVoltageUlvGfx);
3158 dev_info(smu->adev->dev, "MinVoltageUlvSoc = 0x%x\n", pptable->MinVoltageUlvSoc);
3160 dev_info(smu->adev->dev, "SocLIVmin = 0x%x\n", pptable->SocLIVmin);
3161 dev_info(smu->adev->dev, "PaddingLIVmin = 0x%x\n", pptable->PaddingLIVmin);
3163 dev_info(smu->adev->dev, "GceaLinkMgrIdleThreshold = 0x%x\n", pptable->GceaLinkMgrIdleThreshold);
3164 dev_info(smu->adev->dev, "paddingRlcUlvParams[0] = 0x%x\n", pptable->paddingRlcUlvParams[0]);
3165 dev_info(smu->adev->dev, "paddingRlcUlvParams[1] = 0x%x\n", pptable->paddingRlcUlvParams[1]);
3166 dev_info(smu->adev->dev, "paddingRlcUlvParams[2] = 0x%x\n", pptable->paddingRlcUlvParams[2]);
3168 dev_info(smu->adev->dev, "MinVoltageGfx = 0x%x\n", pptable->MinVoltageGfx);
3169 dev_info(smu->adev->dev, "MinVoltageSoc = 0x%x\n", pptable->MinVoltageSoc);
3170 dev_info(smu->adev->dev, "MaxVoltageGfx = 0x%x\n", pptable->MaxVoltageGfx);
3171 dev_info(smu->adev->dev, "MaxVoltageSoc = 0x%x\n", pptable->MaxVoltageSoc);
3173 dev_info(smu->adev->dev, "LoadLineResistanceGfx = 0x%x\n", pptable->LoadLineResistanceGfx);
3174 dev_info(smu->adev->dev, "LoadLineResistanceSoc = 0x%x\n", pptable->LoadLineResistanceSoc);
3176 dev_info(smu->adev->dev, "VDDGFX_TVmin = 0x%x\n", pptable->VDDGFX_TVmin);
3177 dev_info(smu->adev->dev, "VDDSOC_TVmin = 0x%x\n", pptable->VDDSOC_TVmin);
3178 dev_info(smu->adev->dev, "VDDGFX_Vmin_HiTemp = 0x%x\n", pptable->VDDGFX_Vmin_HiTemp);
3179 dev_info(smu->adev->dev, "VDDGFX_Vmin_LoTemp = 0x%x\n", pptable->VDDGFX_Vmin_LoTemp);
3180 dev_info(smu->adev->dev, "VDDSOC_Vmin_HiTemp = 0x%x\n", pptable->VDDSOC_Vmin_HiTemp);
3181 dev_info(smu->adev->dev, "VDDSOC_Vmin_LoTemp = 0x%x\n", pptable->VDDSOC_Vmin_LoTemp);
3182 dev_info(smu->adev->dev, "VDDGFX_TVminHystersis = 0x%x\n", pptable->VDDGFX_TVminHystersis);
3183 dev_info(smu->adev->dev, "VDDSOC_TVminHystersis = 0x%x\n", pptable->VDDSOC_TVminHystersis);
3185 dev_info(smu->adev->dev, "[PPCLK_GFXCLK]\n"
3186 " .VoltageMode = 0x%02x\n"
3187 " .SnapToDiscrete = 0x%02x\n"
3188 " .NumDiscreteLevels = 0x%02x\n"
3189 " .padding = 0x%02x\n"
3190 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3191 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3192 " .SsFmin = 0x%04x\n"
3193 " .Padding_16 = 0x%04x\n",
3194 pptable->DpmDescriptor[PPCLK_GFXCLK].VoltageMode,
3195 pptable->DpmDescriptor[PPCLK_GFXCLK].SnapToDiscrete,
3196 pptable->DpmDescriptor[PPCLK_GFXCLK].NumDiscreteLevels,
3197 pptable->DpmDescriptor[PPCLK_GFXCLK].Padding,
3198 pptable->DpmDescriptor[PPCLK_GFXCLK].ConversionToAvfsClk.m,
3199 pptable->DpmDescriptor[PPCLK_GFXCLK].ConversionToAvfsClk.b,
3200 pptable->DpmDescriptor[PPCLK_GFXCLK].SsCurve.a,
3201 pptable->DpmDescriptor[PPCLK_GFXCLK].SsCurve.b,
3202 pptable->DpmDescriptor[PPCLK_GFXCLK].SsCurve.c,
3203 pptable->DpmDescriptor[PPCLK_GFXCLK].SsFmin,
3204 pptable->DpmDescriptor[PPCLK_GFXCLK].Padding16);
3206 dev_info(smu->adev->dev, "[PPCLK_SOCCLK]\n"
3207 " .VoltageMode = 0x%02x\n"
3208 " .SnapToDiscrete = 0x%02x\n"
3209 " .NumDiscreteLevels = 0x%02x\n"
3210 " .padding = 0x%02x\n"
3211 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3212 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3213 " .SsFmin = 0x%04x\n"
3214 " .Padding_16 = 0x%04x\n",
3215 pptable->DpmDescriptor[PPCLK_SOCCLK].VoltageMode,
3216 pptable->DpmDescriptor[PPCLK_SOCCLK].SnapToDiscrete,
3217 pptable->DpmDescriptor[PPCLK_SOCCLK].NumDiscreteLevels,
3218 pptable->DpmDescriptor[PPCLK_SOCCLK].Padding,
3219 pptable->DpmDescriptor[PPCLK_SOCCLK].ConversionToAvfsClk.m,
3220 pptable->DpmDescriptor[PPCLK_SOCCLK].ConversionToAvfsClk.b,
3221 pptable->DpmDescriptor[PPCLK_SOCCLK].SsCurve.a,
3222 pptable->DpmDescriptor[PPCLK_SOCCLK].SsCurve.b,
3223 pptable->DpmDescriptor[PPCLK_SOCCLK].SsCurve.c,
3224 pptable->DpmDescriptor[PPCLK_SOCCLK].SsFmin,
3225 pptable->DpmDescriptor[PPCLK_SOCCLK].Padding16);
3227 dev_info(smu->adev->dev, "[PPCLK_UCLK]\n"
3228 " .VoltageMode = 0x%02x\n"
3229 " .SnapToDiscrete = 0x%02x\n"
3230 " .NumDiscreteLevels = 0x%02x\n"
3231 " .padding = 0x%02x\n"
3232 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3233 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3234 " .SsFmin = 0x%04x\n"
3235 " .Padding_16 = 0x%04x\n",
3236 pptable->DpmDescriptor[PPCLK_UCLK].VoltageMode,
3237 pptable->DpmDescriptor[PPCLK_UCLK].SnapToDiscrete,
3238 pptable->DpmDescriptor[PPCLK_UCLK].NumDiscreteLevels,
3239 pptable->DpmDescriptor[PPCLK_UCLK].Padding,
3240 pptable->DpmDescriptor[PPCLK_UCLK].ConversionToAvfsClk.m,
3241 pptable->DpmDescriptor[PPCLK_UCLK].ConversionToAvfsClk.b,
3242 pptable->DpmDescriptor[PPCLK_UCLK].SsCurve.a,
3243 pptable->DpmDescriptor[PPCLK_UCLK].SsCurve.b,
3244 pptable->DpmDescriptor[PPCLK_UCLK].SsCurve.c,
3245 pptable->DpmDescriptor[PPCLK_UCLK].SsFmin,
3246 pptable->DpmDescriptor[PPCLK_UCLK].Padding16);
3248 dev_info(smu->adev->dev, "[PPCLK_FCLK]\n"
3249 " .VoltageMode = 0x%02x\n"
3250 " .SnapToDiscrete = 0x%02x\n"
3251 " .NumDiscreteLevels = 0x%02x\n"
3252 " .padding = 0x%02x\n"
3253 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3254 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3255 " .SsFmin = 0x%04x\n"
3256 " .Padding_16 = 0x%04x\n",
3257 pptable->DpmDescriptor[PPCLK_FCLK].VoltageMode,
3258 pptable->DpmDescriptor[PPCLK_FCLK].SnapToDiscrete,
3259 pptable->DpmDescriptor[PPCLK_FCLK].NumDiscreteLevels,
3260 pptable->DpmDescriptor[PPCLK_FCLK].Padding,
3261 pptable->DpmDescriptor[PPCLK_FCLK].ConversionToAvfsClk.m,
3262 pptable->DpmDescriptor[PPCLK_FCLK].ConversionToAvfsClk.b,
3263 pptable->DpmDescriptor[PPCLK_FCLK].SsCurve.a,
3264 pptable->DpmDescriptor[PPCLK_FCLK].SsCurve.b,
3265 pptable->DpmDescriptor[PPCLK_FCLK].SsCurve.c,
3266 pptable->DpmDescriptor[PPCLK_FCLK].SsFmin,
3267 pptable->DpmDescriptor[PPCLK_FCLK].Padding16);
3269 dev_info(smu->adev->dev, "[PPCLK_DCLK_0]\n"
3270 " .VoltageMode = 0x%02x\n"
3271 " .SnapToDiscrete = 0x%02x\n"
3272 " .NumDiscreteLevels = 0x%02x\n"
3273 " .padding = 0x%02x\n"
3274 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3275 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3276 " .SsFmin = 0x%04x\n"
3277 " .Padding_16 = 0x%04x\n",
3278 pptable->DpmDescriptor[PPCLK_DCLK_0].VoltageMode,
3279 pptable->DpmDescriptor[PPCLK_DCLK_0].SnapToDiscrete,
3280 pptable->DpmDescriptor[PPCLK_DCLK_0].NumDiscreteLevels,
3281 pptable->DpmDescriptor[PPCLK_DCLK_0].Padding,
3282 pptable->DpmDescriptor[PPCLK_DCLK_0].ConversionToAvfsClk.m,
3283 pptable->DpmDescriptor[PPCLK_DCLK_0].ConversionToAvfsClk.b,
3284 pptable->DpmDescriptor[PPCLK_DCLK_0].SsCurve.a,
3285 pptable->DpmDescriptor[PPCLK_DCLK_0].SsCurve.b,
3286 pptable->DpmDescriptor[PPCLK_DCLK_0].SsCurve.c,
3287 pptable->DpmDescriptor[PPCLK_DCLK_0].SsFmin,
3288 pptable->DpmDescriptor[PPCLK_DCLK_0].Padding16);
3290 dev_info(smu->adev->dev, "[PPCLK_VCLK_0]\n"
3291 " .VoltageMode = 0x%02x\n"
3292 " .SnapToDiscrete = 0x%02x\n"
3293 " .NumDiscreteLevels = 0x%02x\n"
3294 " .padding = 0x%02x\n"
3295 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3296 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3297 " .SsFmin = 0x%04x\n"
3298 " .Padding_16 = 0x%04x\n",
3299 pptable->DpmDescriptor[PPCLK_VCLK_0].VoltageMode,
3300 pptable->DpmDescriptor[PPCLK_VCLK_0].SnapToDiscrete,
3301 pptable->DpmDescriptor[PPCLK_VCLK_0].NumDiscreteLevels,
3302 pptable->DpmDescriptor[PPCLK_VCLK_0].Padding,
3303 pptable->DpmDescriptor[PPCLK_VCLK_0].ConversionToAvfsClk.m,
3304 pptable->DpmDescriptor[PPCLK_VCLK_0].ConversionToAvfsClk.b,
3305 pptable->DpmDescriptor[PPCLK_VCLK_0].SsCurve.a,
3306 pptable->DpmDescriptor[PPCLK_VCLK_0].SsCurve.b,
3307 pptable->DpmDescriptor[PPCLK_VCLK_0].SsCurve.c,
3308 pptable->DpmDescriptor[PPCLK_VCLK_0].SsFmin,
3309 pptable->DpmDescriptor[PPCLK_VCLK_0].Padding16);
3311 dev_info(smu->adev->dev, "[PPCLK_DCLK_1]\n"
3312 " .VoltageMode = 0x%02x\n"
3313 " .SnapToDiscrete = 0x%02x\n"
3314 " .NumDiscreteLevels = 0x%02x\n"
3315 " .padding = 0x%02x\n"
3316 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3317 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3318 " .SsFmin = 0x%04x\n"
3319 " .Padding_16 = 0x%04x\n",
3320 pptable->DpmDescriptor[PPCLK_DCLK_1].VoltageMode,
3321 pptable->DpmDescriptor[PPCLK_DCLK_1].SnapToDiscrete,
3322 pptable->DpmDescriptor[PPCLK_DCLK_1].NumDiscreteLevels,
3323 pptable->DpmDescriptor[PPCLK_DCLK_1].Padding,
3324 pptable->DpmDescriptor[PPCLK_DCLK_1].ConversionToAvfsClk.m,
3325 pptable->DpmDescriptor[PPCLK_DCLK_1].ConversionToAvfsClk.b,
3326 pptable->DpmDescriptor[PPCLK_DCLK_1].SsCurve.a,
3327 pptable->DpmDescriptor[PPCLK_DCLK_1].SsCurve.b,
3328 pptable->DpmDescriptor[PPCLK_DCLK_1].SsCurve.c,
3329 pptable->DpmDescriptor[PPCLK_DCLK_1].SsFmin,
3330 pptable->DpmDescriptor[PPCLK_DCLK_1].Padding16);
3332 dev_info(smu->adev->dev, "[PPCLK_VCLK_1]\n"
3333 " .VoltageMode = 0x%02x\n"
3334 " .SnapToDiscrete = 0x%02x\n"
3335 " .NumDiscreteLevels = 0x%02x\n"
3336 " .padding = 0x%02x\n"
3337 " .ConversionToAvfsClk{m = 0x%08x b = 0x%08x}\n"
3338 " .SsCurve {a = 0x%08x b = 0x%08x c = 0x%08x}\n"
3339 " .SsFmin = 0x%04x\n"
3340 " .Padding_16 = 0x%04x\n",
3341 pptable->DpmDescriptor[PPCLK_VCLK_1].VoltageMode,
3342 pptable->DpmDescriptor[PPCLK_VCLK_1].SnapToDiscrete,
3343 pptable->DpmDescriptor[PPCLK_VCLK_1].NumDiscreteLevels,
3344 pptable->DpmDescriptor[PPCLK_VCLK_1].Padding,
3345 pptable->DpmDescriptor[PPCLK_VCLK_1].ConversionToAvfsClk.m,
3346 pptable->DpmDescriptor[PPCLK_VCLK_1].ConversionToAvfsClk.b,
3347 pptable->DpmDescriptor[PPCLK_VCLK_1].SsCurve.a,
3348 pptable->DpmDescriptor[PPCLK_VCLK_1].SsCurve.b,
3349 pptable->DpmDescriptor[PPCLK_VCLK_1].SsCurve.c,
3350 pptable->DpmDescriptor[PPCLK_VCLK_1].SsFmin,
3351 pptable->DpmDescriptor[PPCLK_VCLK_1].Padding16);
3353 dev_info(smu->adev->dev, "FreqTableGfx\n");
3354 for (i = 0; i < NUM_GFXCLK_DPM_LEVELS; i++)
3355 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableGfx[i]);
3357 dev_info(smu->adev->dev, "FreqTableVclk\n");
3358 for (i = 0; i < NUM_VCLK_DPM_LEVELS; i++)
3359 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableVclk[i]);
3361 dev_info(smu->adev->dev, "FreqTableDclk\n");
3362 for (i = 0; i < NUM_DCLK_DPM_LEVELS; i++)
3363 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableDclk[i]);
3365 dev_info(smu->adev->dev, "FreqTableSocclk\n");
3366 for (i = 0; i < NUM_SOCCLK_DPM_LEVELS; i++)
3367 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableSocclk[i]);
3369 dev_info(smu->adev->dev, "FreqTableUclk\n");
3370 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
3371 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableUclk[i]);
3373 dev_info(smu->adev->dev, "FreqTableFclk\n");
3374 for (i = 0; i < NUM_FCLK_DPM_LEVELS; i++)
3375 dev_info(smu->adev->dev, " .[%02d] = 0x%x\n", i, pptable->FreqTableFclk[i]);
3377 dev_info(smu->adev->dev, "DcModeMaxFreq\n");
3378 dev_info(smu->adev->dev, " .PPCLK_GFXCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_GFXCLK]);
3379 dev_info(smu->adev->dev, " .PPCLK_SOCCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_SOCCLK]);
3380 dev_info(smu->adev->dev, " .PPCLK_UCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_UCLK]);
3381 dev_info(smu->adev->dev, " .PPCLK_FCLK = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_FCLK]);
3382 dev_info(smu->adev->dev, " .PPCLK_DCLK_0 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_DCLK_0]);
3383 dev_info(smu->adev->dev, " .PPCLK_VCLK_0 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_VCLK_0]);
3384 dev_info(smu->adev->dev, " .PPCLK_DCLK_1 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_DCLK_1]);
3385 dev_info(smu->adev->dev, " .PPCLK_VCLK_1 = 0x%x\n", pptable->DcModeMaxFreq[PPCLK_VCLK_1]);
3387 dev_info(smu->adev->dev, "FreqTableUclkDiv\n");
3388 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
3389 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->FreqTableUclkDiv[i]);
3391 dev_info(smu->adev->dev, "FclkBoostFreq = 0x%x\n", pptable->FclkBoostFreq);
3392 dev_info(smu->adev->dev, "FclkParamPadding = 0x%x\n", pptable->FclkParamPadding);
3394 dev_info(smu->adev->dev, "Mp0clkFreq\n");
3395 for (i = 0; i < NUM_MP0CLK_DPM_LEVELS; i++)
3396 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->Mp0clkFreq[i]);
3398 dev_info(smu->adev->dev, "Mp0DpmVoltage\n");
3399 for (i = 0; i < NUM_MP0CLK_DPM_LEVELS; i++)
3400 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->Mp0DpmVoltage[i]);
3402 dev_info(smu->adev->dev, "MemVddciVoltage\n");
3403 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
3404 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->MemVddciVoltage[i]);
3406 dev_info(smu->adev->dev, "MemMvddVoltage\n");
3407 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
3408 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->MemMvddVoltage[i]);
3410 dev_info(smu->adev->dev, "GfxclkFgfxoffEntry = 0x%x\n", pptable->GfxclkFgfxoffEntry);
3411 dev_info(smu->adev->dev, "GfxclkFinit = 0x%x\n", pptable->GfxclkFinit);
3412 dev_info(smu->adev->dev, "GfxclkFidle = 0x%x\n", pptable->GfxclkFidle);
3413 dev_info(smu->adev->dev, "GfxclkSource = 0x%x\n", pptable->GfxclkSource);
3414 dev_info(smu->adev->dev, "GfxclkPadding = 0x%x\n", pptable->GfxclkPadding);
3416 dev_info(smu->adev->dev, "GfxGpoSubFeatureMask = 0x%x\n", pptable->GfxGpoSubFeatureMask);
3418 dev_info(smu->adev->dev, "GfxGpoEnabledWorkPolicyMask = 0x%x\n", pptable->GfxGpoEnabledWorkPolicyMask);
3419 dev_info(smu->adev->dev, "GfxGpoDisabledWorkPolicyMask = 0x%x\n", pptable->GfxGpoDisabledWorkPolicyMask);
3420 dev_info(smu->adev->dev, "GfxGpoPadding[0] = 0x%x\n", pptable->GfxGpoPadding[0]);
3421 dev_info(smu->adev->dev, "GfxGpoVotingAllow = 0x%x\n", pptable->GfxGpoVotingAllow);
3422 dev_info(smu->adev->dev, "GfxGpoPadding32[0] = 0x%x\n", pptable->GfxGpoPadding32[0]);
3423 dev_info(smu->adev->dev, "GfxGpoPadding32[1] = 0x%x\n", pptable->GfxGpoPadding32[1]);
3424 dev_info(smu->adev->dev, "GfxGpoPadding32[2] = 0x%x\n", pptable->GfxGpoPadding32[2]);
3425 dev_info(smu->adev->dev, "GfxGpoPadding32[3] = 0x%x\n", pptable->GfxGpoPadding32[3]);
3426 dev_info(smu->adev->dev, "GfxDcsFopt = 0x%x\n", pptable->GfxDcsFopt);
3427 dev_info(smu->adev->dev, "GfxDcsFclkFopt = 0x%x\n", pptable->GfxDcsFclkFopt);
3428 dev_info(smu->adev->dev, "GfxDcsUclkFopt = 0x%x\n", pptable->GfxDcsUclkFopt);
3430 dev_info(smu->adev->dev, "DcsGfxOffVoltage = 0x%x\n", pptable->DcsGfxOffVoltage);
3431 dev_info(smu->adev->dev, "DcsMinGfxOffTime = 0x%x\n", pptable->DcsMinGfxOffTime);
3432 dev_info(smu->adev->dev, "DcsMaxGfxOffTime = 0x%x\n", pptable->DcsMaxGfxOffTime);
3433 dev_info(smu->adev->dev, "DcsMinCreditAccum = 0x%x\n", pptable->DcsMinCreditAccum);
3434 dev_info(smu->adev->dev, "DcsExitHysteresis = 0x%x\n", pptable->DcsExitHysteresis);
3435 dev_info(smu->adev->dev, "DcsTimeout = 0x%x\n", pptable->DcsTimeout);
3437 dev_info(smu->adev->dev, "DcsParamPadding[0] = 0x%x\n", pptable->DcsParamPadding[0]);
3438 dev_info(smu->adev->dev, "DcsParamPadding[1] = 0x%x\n", pptable->DcsParamPadding[1]);
3439 dev_info(smu->adev->dev, "DcsParamPadding[2] = 0x%x\n", pptable->DcsParamPadding[2]);
3440 dev_info(smu->adev->dev, "DcsParamPadding[3] = 0x%x\n", pptable->DcsParamPadding[3]);
3441 dev_info(smu->adev->dev, "DcsParamPadding[4] = 0x%x\n", pptable->DcsParamPadding[4]);
3443 dev_info(smu->adev->dev, "FlopsPerByteTable\n");
3444 for (i = 0; i < RLC_PACE_TABLE_NUM_LEVELS; i++)
3445 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->FlopsPerByteTable[i]);
3447 dev_info(smu->adev->dev, "LowestUclkReservedForUlv = 0x%x\n", pptable->LowestUclkReservedForUlv);
3448 dev_info(smu->adev->dev, "vddingMem[0] = 0x%x\n", pptable->PaddingMem[0]);
3449 dev_info(smu->adev->dev, "vddingMem[1] = 0x%x\n", pptable->PaddingMem[1]);
3450 dev_info(smu->adev->dev, "vddingMem[2] = 0x%x\n", pptable->PaddingMem[2]);
3452 dev_info(smu->adev->dev, "UclkDpmPstates\n");
3453 for (i = 0; i < NUM_UCLK_DPM_LEVELS; i++)
3454 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->UclkDpmPstates[i]);
3456 dev_info(smu->adev->dev, "UclkDpmSrcFreqRange\n");
3457 dev_info(smu->adev->dev, " .Fmin = 0x%x\n",
3458 pptable->UclkDpmSrcFreqRange.Fmin);
3459 dev_info(smu->adev->dev, " .Fmax = 0x%x\n",
3460 pptable->UclkDpmSrcFreqRange.Fmax);
3461 dev_info(smu->adev->dev, "UclkDpmTargFreqRange\n");
3462 dev_info(smu->adev->dev, " .Fmin = 0x%x\n",
3463 pptable->UclkDpmTargFreqRange.Fmin);
3464 dev_info(smu->adev->dev, " .Fmax = 0x%x\n",
3465 pptable->UclkDpmTargFreqRange.Fmax);
3466 dev_info(smu->adev->dev, "UclkDpmMidstepFreq = 0x%x\n", pptable->UclkDpmMidstepFreq);
3467 dev_info(smu->adev->dev, "UclkMidstepPadding = 0x%x\n", pptable->UclkMidstepPadding);
3469 dev_info(smu->adev->dev, "PcieGenSpeed\n");
3470 for (i = 0; i < NUM_LINK_LEVELS; i++)
3471 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->PcieGenSpeed[i]);
3473 dev_info(smu->adev->dev, "PcieLaneCount\n");
3474 for (i = 0; i < NUM_LINK_LEVELS; i++)
3475 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->PcieLaneCount[i]);
3477 dev_info(smu->adev->dev, "LclkFreq\n");
3478 for (i = 0; i < NUM_LINK_LEVELS; i++)
3479 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->LclkFreq[i]);
3481 dev_info(smu->adev->dev, "FanStopTemp = 0x%x\n", pptable->FanStopTemp);
3482 dev_info(smu->adev->dev, "FanStartTemp = 0x%x\n", pptable->FanStartTemp);
3484 dev_info(smu->adev->dev, "FanGain\n");
3485 for (i = 0; i < TEMP_COUNT; i++)
3486 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->FanGain[i]);
3488 dev_info(smu->adev->dev, "FanPwmMin = 0x%x\n", pptable->FanPwmMin);
3489 dev_info(smu->adev->dev, "FanAcousticLimitRpm = 0x%x\n", pptable->FanAcousticLimitRpm);
3490 dev_info(smu->adev->dev, "FanThrottlingRpm = 0x%x\n", pptable->FanThrottlingRpm);
3491 dev_info(smu->adev->dev, "FanMaximumRpm = 0x%x\n", pptable->FanMaximumRpm);
3492 dev_info(smu->adev->dev, "MGpuFanBoostLimitRpm = 0x%x\n", pptable->MGpuFanBoostLimitRpm);
3493 dev_info(smu->adev->dev, "FanTargetTemperature = 0x%x\n", pptable->FanTargetTemperature);
3494 dev_info(smu->adev->dev, "FanTargetGfxclk = 0x%x\n", pptable->FanTargetGfxclk);
3495 dev_info(smu->adev->dev, "FanPadding16 = 0x%x\n", pptable->FanPadding16);
3496 dev_info(smu->adev->dev, "FanTempInputSelect = 0x%x\n", pptable->FanTempInputSelect);
3497 dev_info(smu->adev->dev, "FanPadding = 0x%x\n", pptable->FanPadding);
3498 dev_info(smu->adev->dev, "FanZeroRpmEnable = 0x%x\n", pptable->FanZeroRpmEnable);
3499 dev_info(smu->adev->dev, "FanTachEdgePerRev = 0x%x\n", pptable->FanTachEdgePerRev);
3501 dev_info(smu->adev->dev, "FuzzyFan_ErrorSetDelta = 0x%x\n", pptable->FuzzyFan_ErrorSetDelta);
3502 dev_info(smu->adev->dev, "FuzzyFan_ErrorRateSetDelta = 0x%x\n", pptable->FuzzyFan_ErrorRateSetDelta);
3503 dev_info(smu->adev->dev, "FuzzyFan_PwmSetDelta = 0x%x\n", pptable->FuzzyFan_PwmSetDelta);
3504 dev_info(smu->adev->dev, "FuzzyFan_Reserved = 0x%x\n", pptable->FuzzyFan_Reserved);
3506 dev_info(smu->adev->dev, "OverrideAvfsGb[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->OverrideAvfsGb[AVFS_VOLTAGE_GFX]);
3507 dev_info(smu->adev->dev, "OverrideAvfsGb[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->OverrideAvfsGb[AVFS_VOLTAGE_SOC]);
3508 dev_info(smu->adev->dev, "dBtcGbGfxDfllModelSelect = 0x%x\n", pptable->dBtcGbGfxDfllModelSelect);
3509 dev_info(smu->adev->dev, "Padding8_Avfs = 0x%x\n", pptable->Padding8_Avfs);
3511 dev_info(smu->adev->dev, "qAvfsGb[AVFS_VOLTAGE_GFX]{a = 0x%x b = 0x%x c = 0x%x}\n",
3512 pptable->qAvfsGb[AVFS_VOLTAGE_GFX].a,
3513 pptable->qAvfsGb[AVFS_VOLTAGE_GFX].b,
3514 pptable->qAvfsGb[AVFS_VOLTAGE_GFX].c);
3515 dev_info(smu->adev->dev, "qAvfsGb[AVFS_VOLTAGE_SOC]{a = 0x%x b = 0x%x c = 0x%x}\n",
3516 pptable->qAvfsGb[AVFS_VOLTAGE_SOC].a,
3517 pptable->qAvfsGb[AVFS_VOLTAGE_SOC].b,
3518 pptable->qAvfsGb[AVFS_VOLTAGE_SOC].c);
3519 dev_info(smu->adev->dev, "dBtcGbGfxPll{a = 0x%x b = 0x%x c = 0x%x}\n",
3520 pptable->dBtcGbGfxPll.a,
3521 pptable->dBtcGbGfxPll.b,
3522 pptable->dBtcGbGfxPll.c);
3523 dev_info(smu->adev->dev, "dBtcGbGfxAfll{a = 0x%x b = 0x%x c = 0x%x}\n",
3524 pptable->dBtcGbGfxDfll.a,
3525 pptable->dBtcGbGfxDfll.b,
3526 pptable->dBtcGbGfxDfll.c);
3527 dev_info(smu->adev->dev, "dBtcGbSoc{a = 0x%x b = 0x%x c = 0x%x}\n",
3528 pptable->dBtcGbSoc.a,
3529 pptable->dBtcGbSoc.b,
3530 pptable->dBtcGbSoc.c);
3531 dev_info(smu->adev->dev, "qAgingGb[AVFS_VOLTAGE_GFX]{m = 0x%x b = 0x%x}\n",
3532 pptable->qAgingGb[AVFS_VOLTAGE_GFX].m,
3533 pptable->qAgingGb[AVFS_VOLTAGE_GFX].b);
3534 dev_info(smu->adev->dev, "qAgingGb[AVFS_VOLTAGE_SOC]{m = 0x%x b = 0x%x}\n",
3535 pptable->qAgingGb[AVFS_VOLTAGE_SOC].m,
3536 pptable->qAgingGb[AVFS_VOLTAGE_SOC].b);
3538 dev_info(smu->adev->dev, "PiecewiseLinearDroopIntGfxDfll\n");
3539 for (i = 0; i < NUM_PIECE_WISE_LINEAR_DROOP_MODEL_VF_POINTS; i++) {
3540 dev_info(smu->adev->dev, " Fset[%d] = 0x%x\n",
3541 i, pptable->PiecewiseLinearDroopIntGfxDfll.Fset[i]);
3542 dev_info(smu->adev->dev, " Vdroop[%d] = 0x%x\n",
3543 i, pptable->PiecewiseLinearDroopIntGfxDfll.Vdroop[i]);
3546 dev_info(smu->adev->dev, "qStaticVoltageOffset[AVFS_VOLTAGE_GFX]{a = 0x%x b = 0x%x c = 0x%x}\n",
3547 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_GFX].a,
3548 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_GFX].b,
3549 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_GFX].c);
3550 dev_info(smu->adev->dev, "qStaticVoltageOffset[AVFS_VOLTAGE_SOC]{a = 0x%x b = 0x%x c = 0x%x}\n",
3551 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_SOC].a,
3552 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_SOC].b,
3553 pptable->qStaticVoltageOffset[AVFS_VOLTAGE_SOC].c);
3555 dev_info(smu->adev->dev, "DcTol[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcTol[AVFS_VOLTAGE_GFX]);
3556 dev_info(smu->adev->dev, "DcTol[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcTol[AVFS_VOLTAGE_SOC]);
3558 dev_info(smu->adev->dev, "DcBtcEnabled[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcEnabled[AVFS_VOLTAGE_GFX]);
3559 dev_info(smu->adev->dev, "DcBtcEnabled[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcEnabled[AVFS_VOLTAGE_SOC]);
3560 dev_info(smu->adev->dev, "Padding8_GfxBtc[0] = 0x%x\n", pptable->Padding8_GfxBtc[0]);
3561 dev_info(smu->adev->dev, "Padding8_GfxBtc[1] = 0x%x\n", pptable->Padding8_GfxBtc[1]);
3563 dev_info(smu->adev->dev, "DcBtcMin[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcMin[AVFS_VOLTAGE_GFX]);
3564 dev_info(smu->adev->dev, "DcBtcMin[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcMin[AVFS_VOLTAGE_SOC]);
3565 dev_info(smu->adev->dev, "DcBtcMax[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcMax[AVFS_VOLTAGE_GFX]);
3566 dev_info(smu->adev->dev, "DcBtcMax[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcMax[AVFS_VOLTAGE_SOC]);
3568 dev_info(smu->adev->dev, "DcBtcGb[AVFS_VOLTAGE_GFX] = 0x%x\n", pptable->DcBtcGb[AVFS_VOLTAGE_GFX]);
3569 dev_info(smu->adev->dev, "DcBtcGb[AVFS_VOLTAGE_SOC] = 0x%x\n", pptable->DcBtcGb[AVFS_VOLTAGE_SOC]);
3571 dev_info(smu->adev->dev, "XgmiDpmPstates\n");
3572 for (i = 0; i < NUM_XGMI_LEVELS; i++)
3573 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiDpmPstates[i]);
3574 dev_info(smu->adev->dev, "XgmiDpmSpare[0] = 0x%02x\n", pptable->XgmiDpmSpare[0]);
3575 dev_info(smu->adev->dev, "XgmiDpmSpare[1] = 0x%02x\n", pptable->XgmiDpmSpare[1]);
3577 dev_info(smu->adev->dev, "DebugOverrides = 0x%x\n", pptable->DebugOverrides);
3578 dev_info(smu->adev->dev, "ReservedEquation0{a = 0x%x b = 0x%x c = 0x%x}\n",
3579 pptable->ReservedEquation0.a,
3580 pptable->ReservedEquation0.b,
3581 pptable->ReservedEquation0.c);
3582 dev_info(smu->adev->dev, "ReservedEquation1{a = 0x%x b = 0x%x c = 0x%x}\n",
3583 pptable->ReservedEquation1.a,
3584 pptable->ReservedEquation1.b,
3585 pptable->ReservedEquation1.c);
3586 dev_info(smu->adev->dev, "ReservedEquation2{a = 0x%x b = 0x%x c = 0x%x}\n",
3587 pptable->ReservedEquation2.a,
3588 pptable->ReservedEquation2.b,
3589 pptable->ReservedEquation2.c);
3590 dev_info(smu->adev->dev, "ReservedEquation3{a = 0x%x b = 0x%x c = 0x%x}\n",
3591 pptable->ReservedEquation3.a,
3592 pptable->ReservedEquation3.b,
3593 pptable->ReservedEquation3.c);
3595 dev_info(smu->adev->dev, "SkuReserved[0] = 0x%x\n", pptable->SkuReserved[0]);
3596 dev_info(smu->adev->dev, "SkuReserved[1] = 0x%x\n", pptable->SkuReserved[1]);
3597 dev_info(smu->adev->dev, "SkuReserved[2] = 0x%x\n", pptable->SkuReserved[2]);
3598 dev_info(smu->adev->dev, "SkuReserved[3] = 0x%x\n", pptable->SkuReserved[3]);
3599 dev_info(smu->adev->dev, "SkuReserved[4] = 0x%x\n", pptable->SkuReserved[4]);
3600 dev_info(smu->adev->dev, "SkuReserved[5] = 0x%x\n", pptable->SkuReserved[5]);
3601 dev_info(smu->adev->dev, "SkuReserved[6] = 0x%x\n", pptable->SkuReserved[6]);
3602 dev_info(smu->adev->dev, "SkuReserved[7] = 0x%x\n", pptable->SkuReserved[7]);
3604 dev_info(smu->adev->dev, "GamingClk[0] = 0x%x\n", pptable->GamingClk[0]);
3605 dev_info(smu->adev->dev, "GamingClk[1] = 0x%x\n", pptable->GamingClk[1]);
3606 dev_info(smu->adev->dev, "GamingClk[2] = 0x%x\n", pptable->GamingClk[2]);
3607 dev_info(smu->adev->dev, "GamingClk[3] = 0x%x\n", pptable->GamingClk[3]);
3608 dev_info(smu->adev->dev, "GamingClk[4] = 0x%x\n", pptable->GamingClk[4]);
3609 dev_info(smu->adev->dev, "GamingClk[5] = 0x%x\n", pptable->GamingClk[5]);
3611 for (i = 0; i < NUM_I2C_CONTROLLERS; i++) {
3612 dev_info(smu->adev->dev, "I2cControllers[%d]:\n", i);
3613 dev_info(smu->adev->dev, " .Enabled = 0x%x\n",
3614 pptable->I2cControllers[i].Enabled);
3615 dev_info(smu->adev->dev, " .Speed = 0x%x\n",
3616 pptable->I2cControllers[i].Speed);
3617 dev_info(smu->adev->dev, " .SlaveAddress = 0x%x\n",
3618 pptable->I2cControllers[i].SlaveAddress);
3619 dev_info(smu->adev->dev, " .ControllerPort = 0x%x\n",
3620 pptable->I2cControllers[i].ControllerPort);
3621 dev_info(smu->adev->dev, " .ControllerName = 0x%x\n",
3622 pptable->I2cControllers[i].ControllerName);
3623 dev_info(smu->adev->dev, " .ThermalThrottler = 0x%x\n",
3624 pptable->I2cControllers[i].ThermalThrotter);
3625 dev_info(smu->adev->dev, " .I2cProtocol = 0x%x\n",
3626 pptable->I2cControllers[i].I2cProtocol);
3627 dev_info(smu->adev->dev, " .PaddingConfig = 0x%x\n",
3628 pptable->I2cControllers[i].PaddingConfig);
3631 dev_info(smu->adev->dev, "GpioScl = 0x%x\n", pptable->GpioScl);
3632 dev_info(smu->adev->dev, "GpioSda = 0x%x\n", pptable->GpioSda);
3633 dev_info(smu->adev->dev, "FchUsbPdSlaveAddr = 0x%x\n", pptable->FchUsbPdSlaveAddr);
3634 dev_info(smu->adev->dev, "I2cSpare[0] = 0x%x\n", pptable->I2cSpare[0]);
3636 dev_info(smu->adev->dev, "Board Parameters:\n");
3637 dev_info(smu->adev->dev, "VddGfxVrMapping = 0x%x\n", pptable->VddGfxVrMapping);
3638 dev_info(smu->adev->dev, "VddSocVrMapping = 0x%x\n", pptable->VddSocVrMapping);
3639 dev_info(smu->adev->dev, "VddMem0VrMapping = 0x%x\n", pptable->VddMem0VrMapping);
3640 dev_info(smu->adev->dev, "VddMem1VrMapping = 0x%x\n", pptable->VddMem1VrMapping);
3641 dev_info(smu->adev->dev, "GfxUlvPhaseSheddingMask = 0x%x\n", pptable->GfxUlvPhaseSheddingMask);
3642 dev_info(smu->adev->dev, "SocUlvPhaseSheddingMask = 0x%x\n", pptable->SocUlvPhaseSheddingMask);
3643 dev_info(smu->adev->dev, "VddciUlvPhaseSheddingMask = 0x%x\n", pptable->VddciUlvPhaseSheddingMask);
3644 dev_info(smu->adev->dev, "MvddUlvPhaseSheddingMask = 0x%x\n", pptable->MvddUlvPhaseSheddingMask);
3646 dev_info(smu->adev->dev, "GfxMaxCurrent = 0x%x\n", pptable->GfxMaxCurrent);
3647 dev_info(smu->adev->dev, "GfxOffset = 0x%x\n", pptable->GfxOffset);
3648 dev_info(smu->adev->dev, "Padding_TelemetryGfx = 0x%x\n", pptable->Padding_TelemetryGfx);
3650 dev_info(smu->adev->dev, "SocMaxCurrent = 0x%x\n", pptable->SocMaxCurrent);
3651 dev_info(smu->adev->dev, "SocOffset = 0x%x\n", pptable->SocOffset);
3652 dev_info(smu->adev->dev, "Padding_TelemetrySoc = 0x%x\n", pptable->Padding_TelemetrySoc);
3654 dev_info(smu->adev->dev, "Mem0MaxCurrent = 0x%x\n", pptable->Mem0MaxCurrent);
3655 dev_info(smu->adev->dev, "Mem0Offset = 0x%x\n", pptable->Mem0Offset);
3656 dev_info(smu->adev->dev, "Padding_TelemetryMem0 = 0x%x\n", pptable->Padding_TelemetryMem0);
3658 dev_info(smu->adev->dev, "Mem1MaxCurrent = 0x%x\n", pptable->Mem1MaxCurrent);
3659 dev_info(smu->adev->dev, "Mem1Offset = 0x%x\n", pptable->Mem1Offset);
3660 dev_info(smu->adev->dev, "Padding_TelemetryMem1 = 0x%x\n", pptable->Padding_TelemetryMem1);
3662 dev_info(smu->adev->dev, "MvddRatio = 0x%x\n", pptable->MvddRatio);
3664 dev_info(smu->adev->dev, "AcDcGpio = 0x%x\n", pptable->AcDcGpio);
3665 dev_info(smu->adev->dev, "AcDcPolarity = 0x%x\n", pptable->AcDcPolarity);
3666 dev_info(smu->adev->dev, "VR0HotGpio = 0x%x\n", pptable->VR0HotGpio);
3667 dev_info(smu->adev->dev, "VR0HotPolarity = 0x%x\n", pptable->VR0HotPolarity);
3668 dev_info(smu->adev->dev, "VR1HotGpio = 0x%x\n", pptable->VR1HotGpio);
3669 dev_info(smu->adev->dev, "VR1HotPolarity = 0x%x\n", pptable->VR1HotPolarity);
3670 dev_info(smu->adev->dev, "GthrGpio = 0x%x\n", pptable->GthrGpio);
3671 dev_info(smu->adev->dev, "GthrPolarity = 0x%x\n", pptable->GthrPolarity);
3672 dev_info(smu->adev->dev, "LedPin0 = 0x%x\n", pptable->LedPin0);
3673 dev_info(smu->adev->dev, "LedPin1 = 0x%x\n", pptable->LedPin1);
3674 dev_info(smu->adev->dev, "LedPin2 = 0x%x\n", pptable->LedPin2);
3675 dev_info(smu->adev->dev, "LedEnableMask = 0x%x\n", pptable->LedEnableMask);
3676 dev_info(smu->adev->dev, "LedPcie = 0x%x\n", pptable->LedPcie);
3677 dev_info(smu->adev->dev, "LedError = 0x%x\n", pptable->LedError);
3678 dev_info(smu->adev->dev, "LedSpare1[0] = 0x%x\n", pptable->LedSpare1[0]);
3679 dev_info(smu->adev->dev, "LedSpare1[1] = 0x%x\n", pptable->LedSpare1[1]);
3681 dev_info(smu->adev->dev, "PllGfxclkSpreadEnabled = 0x%x\n", pptable->PllGfxclkSpreadEnabled);
3682 dev_info(smu->adev->dev, "PllGfxclkSpreadPercent = 0x%x\n", pptable->PllGfxclkSpreadPercent);
3683 dev_info(smu->adev->dev, "PllGfxclkSpreadFreq = 0x%x\n", pptable->PllGfxclkSpreadFreq);
3685 dev_info(smu->adev->dev, "DfllGfxclkSpreadEnabled = 0x%x\n", pptable->DfllGfxclkSpreadEnabled);
3686 dev_info(smu->adev->dev, "DfllGfxclkSpreadPercent = 0x%x\n", pptable->DfllGfxclkSpreadPercent);
3687 dev_info(smu->adev->dev, "DfllGfxclkSpreadFreq = 0x%x\n", pptable->DfllGfxclkSpreadFreq);
3689 dev_info(smu->adev->dev, "UclkSpreadPadding = 0x%x\n", pptable->UclkSpreadPadding);
3690 dev_info(smu->adev->dev, "UclkSpreadFreq = 0x%x\n", pptable->UclkSpreadFreq);
3692 dev_info(smu->adev->dev, "FclkSpreadEnabled = 0x%x\n", pptable->FclkSpreadEnabled);
3693 dev_info(smu->adev->dev, "FclkSpreadPercent = 0x%x\n", pptable->FclkSpreadPercent);
3694 dev_info(smu->adev->dev, "FclkSpreadFreq = 0x%x\n", pptable->FclkSpreadFreq);
3696 dev_info(smu->adev->dev, "MemoryChannelEnabled = 0x%x\n", pptable->MemoryChannelEnabled);
3697 dev_info(smu->adev->dev, "DramBitWidth = 0x%x\n", pptable->DramBitWidth);
3698 dev_info(smu->adev->dev, "PaddingMem1[0] = 0x%x\n", pptable->PaddingMem1[0]);
3699 dev_info(smu->adev->dev, "PaddingMem1[1] = 0x%x\n", pptable->PaddingMem1[1]);
3700 dev_info(smu->adev->dev, "PaddingMem1[2] = 0x%x\n", pptable->PaddingMem1[2]);
3702 dev_info(smu->adev->dev, "TotalBoardPower = 0x%x\n", pptable->TotalBoardPower);
3703 dev_info(smu->adev->dev, "BoardPowerPadding = 0x%x\n", pptable->BoardPowerPadding);
3705 dev_info(smu->adev->dev, "XgmiLinkSpeed\n");
3706 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3707 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiLinkSpeed[i]);
3708 dev_info(smu->adev->dev, "XgmiLinkWidth\n");
3709 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3710 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiLinkWidth[i]);
3711 dev_info(smu->adev->dev, "XgmiFclkFreq\n");
3712 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3713 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiFclkFreq[i]);
3714 dev_info(smu->adev->dev, "XgmiSocVoltage\n");
3715 for (i = 0; i < NUM_XGMI_PSTATE_LEVELS; i++)
3716 dev_info(smu->adev->dev, " .[%d] = 0x%x\n", i, pptable->XgmiSocVoltage[i]);
3718 dev_info(smu->adev->dev, "HsrEnabled = 0x%x\n", pptable->HsrEnabled);
3719 dev_info(smu->adev->dev, "VddqOffEnabled = 0x%x\n", pptable->VddqOffEnabled);
3720 dev_info(smu->adev->dev, "PaddingUmcFlags[0] = 0x%x\n", pptable->PaddingUmcFlags[0]);
3721 dev_info(smu->adev->dev, "PaddingUmcFlags[1] = 0x%x\n", pptable->PaddingUmcFlags[1]);
3723 dev_info(smu->adev->dev, "BoardReserved[0] = 0x%x\n", pptable->BoardReserved[0]);
3724 dev_info(smu->adev->dev, "BoardReserved[1] = 0x%x\n", pptable->BoardReserved[1]);
3725 dev_info(smu->adev->dev, "BoardReserved[2] = 0x%x\n", pptable->BoardReserved[2]);
3726 dev_info(smu->adev->dev, "BoardReserved[3] = 0x%x\n", pptable->BoardReserved[3]);
3727 dev_info(smu->adev->dev, "BoardReserved[4] = 0x%x\n", pptable->BoardReserved[4]);
3728 dev_info(smu->adev->dev, "BoardReserved[5] = 0x%x\n", pptable->BoardReserved[5]);
3729 dev_info(smu->adev->dev, "BoardReserved[6] = 0x%x\n", pptable->BoardReserved[6]);
3730 dev_info(smu->adev->dev, "BoardReserved[7] = 0x%x\n", pptable->BoardReserved[7]);
3731 dev_info(smu->adev->dev, "BoardReserved[8] = 0x%x\n", pptable->BoardReserved[8]);
3732 dev_info(smu->adev->dev, "BoardReserved[9] = 0x%x\n", pptable->BoardReserved[9]);
3733 dev_info(smu->adev->dev, "BoardReserved[10] = 0x%x\n", pptable->BoardReserved[10]);
3735 dev_info(smu->adev->dev, "MmHubPadding[0] = 0x%x\n", pptable->MmHubPadding[0]);
3736 dev_info(smu->adev->dev, "MmHubPadding[1] = 0x%x\n", pptable->MmHubPadding[1]);
3737 dev_info(smu->adev->dev, "MmHubPadding[2] = 0x%x\n", pptable->MmHubPadding[2]);
3738 dev_info(smu->adev->dev, "MmHubPadding[3] = 0x%x\n", pptable->MmHubPadding[3]);
3739 dev_info(smu->adev->dev, "MmHubPadding[4] = 0x%x\n", pptable->MmHubPadding[4]);
3740 dev_info(smu->adev->dev, "MmHubPadding[5] = 0x%x\n", pptable->MmHubPadding[5]);
3741 dev_info(smu->adev->dev, "MmHubPadding[6] = 0x%x\n", pptable->MmHubPadding[6]);
3742 dev_info(smu->adev->dev, "MmHubPadding[7] = 0x%x\n", pptable->MmHubPadding[7]);
3745 static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap,
3746 struct i2c_msg *msg, int num_msgs)
3748 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(i2c_adap);
3749 struct amdgpu_device *adev = smu_i2c->adev;
3750 struct smu_context *smu = adev->powerplay.pp_handle;
3751 struct smu_table_context *smu_table = &smu->smu_table;
3752 struct smu_table *table = &smu_table->driver_table;
3753 SwI2cRequest_t *req, *res = (SwI2cRequest_t *)table->cpu_addr;
3757 if (!adev->pm.dpm_enabled)
3760 req = kzalloc(sizeof(*req), GFP_KERNEL);
3764 req->I2CcontrollerPort = smu_i2c->port;
3765 req->I2CSpeed = I2C_SPEED_FAST_400K;
3766 req->SlaveAddress = msg[0].addr << 1; /* wants an 8-bit address */
3767 dir = msg[0].flags & I2C_M_RD;
3769 for (c = i = 0; i < num_msgs; i++) {
3770 for (j = 0; j < msg[i].len; j++, c++) {
3771 SwI2cCmd_t *cmd = &req->SwI2cCmds[c];
3773 if (!(msg[i].flags & I2C_M_RD)) {
3775 cmd->CmdConfig |= CMDCONFIG_READWRITE_MASK;
3776 cmd->ReadWriteData = msg[i].buf[j];
3779 if ((dir ^ msg[i].flags) & I2C_M_RD) {
3780 /* The direction changes.
3782 dir = msg[i].flags & I2C_M_RD;
3783 cmd->CmdConfig |= CMDCONFIG_RESTART_MASK;
3789 * Insert STOP if we are at the last byte of either last
3790 * message for the transaction or the client explicitly
3791 * requires a STOP at this particular message.
3793 if ((j == msg[i].len - 1) &&
3794 ((i == num_msgs - 1) || (msg[i].flags & I2C_M_STOP))) {
3795 cmd->CmdConfig &= ~CMDCONFIG_RESTART_MASK;
3796 cmd->CmdConfig |= CMDCONFIG_STOP_MASK;
3800 mutex_lock(&adev->pm.mutex);
3801 r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true);
3805 for (c = i = 0; i < num_msgs; i++) {
3806 if (!(msg[i].flags & I2C_M_RD)) {
3810 for (j = 0; j < msg[i].len; j++, c++) {
3811 SwI2cCmd_t *cmd = &res->SwI2cCmds[c];
3813 msg[i].buf[j] = cmd->ReadWriteData;
3818 mutex_unlock(&adev->pm.mutex);
3823 static u32 sienna_cichlid_i2c_func(struct i2c_adapter *adap)
3825 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
3829 static const struct i2c_algorithm sienna_cichlid_i2c_algo = {
3830 .master_xfer = sienna_cichlid_i2c_xfer,
3831 .functionality = sienna_cichlid_i2c_func,
3834 static const struct i2c_adapter_quirks sienna_cichlid_i2c_control_quirks = {
3835 .flags = I2C_AQ_COMB | I2C_AQ_COMB_SAME_ADDR | I2C_AQ_NO_ZERO_LEN,
3836 .max_read_len = MAX_SW_I2C_COMMANDS,
3837 .max_write_len = MAX_SW_I2C_COMMANDS,
3838 .max_comb_1st_msg_len = 2,
3839 .max_comb_2nd_msg_len = MAX_SW_I2C_COMMANDS - 2,
3842 static int sienna_cichlid_i2c_control_init(struct smu_context *smu)
3844 struct amdgpu_device *adev = smu->adev;
3847 for (i = 0; i < MAX_SMU_I2C_BUSES; i++) {
3848 struct amdgpu_smu_i2c_bus *smu_i2c = &adev->pm.smu_i2c[i];
3849 struct i2c_adapter *control = &smu_i2c->adapter;
3851 smu_i2c->adev = adev;
3853 mutex_init(&smu_i2c->mutex);
3854 control->owner = THIS_MODULE;
3855 control->class = I2C_CLASS_HWMON;
3856 control->dev.parent = &adev->pdev->dev;
3857 control->algo = &sienna_cichlid_i2c_algo;
3858 snprintf(control->name, sizeof(control->name), "AMDGPU SMU %d", i);
3859 control->quirks = &sienna_cichlid_i2c_control_quirks;
3860 i2c_set_adapdata(control, smu_i2c);
3862 res = i2c_add_adapter(control);
3864 DRM_ERROR("Failed to register hw i2c, err: %d\n", res);
3868 /* assign the buses used for the FRU EEPROM and RAS EEPROM */
3869 /* XXX ideally this would be something in a vbios data table */
3870 adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[1].adapter;
3871 adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
3875 for ( ; i >= 0; i--) {
3876 struct amdgpu_smu_i2c_bus *smu_i2c = &adev->pm.smu_i2c[i];
3877 struct i2c_adapter *control = &smu_i2c->adapter;
3879 i2c_del_adapter(control);
3884 static void sienna_cichlid_i2c_control_fini(struct smu_context *smu)
3886 struct amdgpu_device *adev = smu->adev;
3889 for (i = 0; i < MAX_SMU_I2C_BUSES; i++) {
3890 struct amdgpu_smu_i2c_bus *smu_i2c = &adev->pm.smu_i2c[i];
3891 struct i2c_adapter *control = &smu_i2c->adapter;
3893 i2c_del_adapter(control);
3895 adev->pm.ras_eeprom_i2c_bus = NULL;
3896 adev->pm.fru_eeprom_i2c_bus = NULL;
3899 static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu,
3902 struct smu_table_context *smu_table = &smu->smu_table;
3903 struct gpu_metrics_v1_3 *gpu_metrics =
3904 (struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
3905 SmuMetricsExternal_t metrics_external;
3906 SmuMetrics_t *metrics =
3907 &(metrics_external.SmuMetrics);
3908 SmuMetrics_V2_t *metrics_v2 =
3909 &(metrics_external.SmuMetrics_V2);
3910 SmuMetrics_V3_t *metrics_v3 =
3911 &(metrics_external.SmuMetrics_V3);
3912 struct amdgpu_device *adev = smu->adev;
3913 bool use_metrics_v2 = false;
3914 bool use_metrics_v3 = false;
3915 uint16_t average_gfx_activity;
3918 switch (smu->adev->ip_versions[MP1_HWIP][0]) {
3919 case IP_VERSION(11, 0, 7):
3920 if (smu->smc_fw_version >= 0x3A4900)
3921 use_metrics_v3 = true;
3922 else if (smu->smc_fw_version >= 0x3A4300)
3923 use_metrics_v2 = true;
3925 case IP_VERSION(11, 0, 11):
3926 if (smu->smc_fw_version >= 0x412D00)
3927 use_metrics_v2 = true;
3929 case IP_VERSION(11, 0, 12):
3930 if (smu->smc_fw_version >= 0x3B2300)
3931 use_metrics_v2 = true;
3933 case IP_VERSION(11, 0, 13):
3934 if (smu->smc_fw_version >= 0x491100)
3935 use_metrics_v2 = true;
3941 ret = smu_cmn_get_metrics_table(smu,
3947 smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3);
3949 gpu_metrics->temperature_edge = use_metrics_v3 ? metrics_v3->TemperatureEdge :
3950 use_metrics_v2 ? metrics_v2->TemperatureEdge : metrics->TemperatureEdge;
3951 gpu_metrics->temperature_hotspot = use_metrics_v3 ? metrics_v3->TemperatureHotspot :
3952 use_metrics_v2 ? metrics_v2->TemperatureHotspot : metrics->TemperatureHotspot;
3953 gpu_metrics->temperature_mem = use_metrics_v3 ? metrics_v3->TemperatureMem :
3954 use_metrics_v2 ? metrics_v2->TemperatureMem : metrics->TemperatureMem;
3955 gpu_metrics->temperature_vrgfx = use_metrics_v3 ? metrics_v3->TemperatureVrGfx :
3956 use_metrics_v2 ? metrics_v2->TemperatureVrGfx : metrics->TemperatureVrGfx;
3957 gpu_metrics->temperature_vrsoc = use_metrics_v3 ? metrics_v3->TemperatureVrSoc :
3958 use_metrics_v2 ? metrics_v2->TemperatureVrSoc : metrics->TemperatureVrSoc;
3959 gpu_metrics->temperature_vrmem = use_metrics_v3 ? metrics_v3->TemperatureVrMem0 :
3960 use_metrics_v2 ? metrics_v2->TemperatureVrMem0 : metrics->TemperatureVrMem0;
3962 gpu_metrics->average_gfx_activity = use_metrics_v3 ? metrics_v3->AverageGfxActivity :
3963 use_metrics_v2 ? metrics_v2->AverageGfxActivity : metrics->AverageGfxActivity;
3964 gpu_metrics->average_umc_activity = use_metrics_v3 ? metrics_v3->AverageUclkActivity :
3965 use_metrics_v2 ? metrics_v2->AverageUclkActivity : metrics->AverageUclkActivity;
3966 gpu_metrics->average_mm_activity = use_metrics_v3 ?
3967 (metrics_v3->VcnUsagePercentage0 + metrics_v3->VcnUsagePercentage1) / 2 :
3968 use_metrics_v2 ? metrics_v2->VcnActivityPercentage : metrics->VcnActivityPercentage;
3970 gpu_metrics->average_socket_power = use_metrics_v3 ? metrics_v3->AverageSocketPower :
3971 use_metrics_v2 ? metrics_v2->AverageSocketPower : metrics->AverageSocketPower;
3972 gpu_metrics->energy_accumulator = use_metrics_v3 ? metrics_v3->EnergyAccumulator :
3973 use_metrics_v2 ? metrics_v2->EnergyAccumulator : metrics->EnergyAccumulator;
3975 if (metrics->CurrGfxVoltageOffset)
3976 gpu_metrics->voltage_gfx =
3977 (155000 - 625 * metrics->CurrGfxVoltageOffset) / 100;
3978 if (metrics->CurrMemVidOffset)
3979 gpu_metrics->voltage_mem =
3980 (155000 - 625 * metrics->CurrMemVidOffset) / 100;
3981 if (metrics->CurrSocVoltageOffset)
3982 gpu_metrics->voltage_soc =
3983 (155000 - 625 * metrics->CurrSocVoltageOffset) / 100;
3985 average_gfx_activity = use_metrics_v3 ? metrics_v3->AverageGfxActivity :
3986 use_metrics_v2 ? metrics_v2->AverageGfxActivity : metrics->AverageGfxActivity;
3987 if (average_gfx_activity <= SMU_11_0_7_GFX_BUSY_THRESHOLD)
3988 gpu_metrics->average_gfxclk_frequency =
3989 use_metrics_v3 ? metrics_v3->AverageGfxclkFrequencyPostDs :
3990 use_metrics_v2 ? metrics_v2->AverageGfxclkFrequencyPostDs :
3991 metrics->AverageGfxclkFrequencyPostDs;
3993 gpu_metrics->average_gfxclk_frequency =
3994 use_metrics_v3 ? metrics_v3->AverageGfxclkFrequencyPreDs :
3995 use_metrics_v2 ? metrics_v2->AverageGfxclkFrequencyPreDs :
3996 metrics->AverageGfxclkFrequencyPreDs;
3998 gpu_metrics->average_uclk_frequency =
3999 use_metrics_v3 ? metrics_v3->AverageUclkFrequencyPostDs :
4000 use_metrics_v2 ? metrics_v2->AverageUclkFrequencyPostDs :
4001 metrics->AverageUclkFrequencyPostDs;
4002 gpu_metrics->average_vclk0_frequency = use_metrics_v3 ? metrics_v3->AverageVclk0Frequency :
4003 use_metrics_v2 ? metrics_v2->AverageVclk0Frequency : metrics->AverageVclk0Frequency;
4004 gpu_metrics->average_dclk0_frequency = use_metrics_v3 ? metrics_v3->AverageDclk0Frequency :
4005 use_metrics_v2 ? metrics_v2->AverageDclk0Frequency : metrics->AverageDclk0Frequency;
4006 gpu_metrics->average_vclk1_frequency = use_metrics_v3 ? metrics_v3->AverageVclk1Frequency :
4007 use_metrics_v2 ? metrics_v2->AverageVclk1Frequency : metrics->AverageVclk1Frequency;
4008 gpu_metrics->average_dclk1_frequency = use_metrics_v3 ? metrics_v3->AverageDclk1Frequency :
4009 use_metrics_v2 ? metrics_v2->AverageDclk1Frequency : metrics->AverageDclk1Frequency;
4011 gpu_metrics->current_gfxclk = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_GFXCLK] :
4012 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_GFXCLK] : metrics->CurrClock[PPCLK_GFXCLK];
4013 gpu_metrics->current_socclk = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_SOCCLK] :
4014 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_SOCCLK] : metrics->CurrClock[PPCLK_SOCCLK];
4015 gpu_metrics->current_uclk = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_UCLK] :
4016 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_UCLK] : metrics->CurrClock[PPCLK_UCLK];
4017 gpu_metrics->current_vclk0 = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_VCLK_0] :
4018 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_VCLK_0] : metrics->CurrClock[PPCLK_VCLK_0];
4019 gpu_metrics->current_dclk0 = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_DCLK_0] :
4020 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_DCLK_0] : metrics->CurrClock[PPCLK_DCLK_0];
4021 gpu_metrics->current_vclk1 = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_VCLK_1] :
4022 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_VCLK_1] : metrics->CurrClock[PPCLK_VCLK_1];
4023 gpu_metrics->current_dclk1 = use_metrics_v3 ? metrics_v3->CurrClock[PPCLK_DCLK_1] :
4024 use_metrics_v2 ? metrics_v2->CurrClock[PPCLK_DCLK_1] : metrics->CurrClock[PPCLK_DCLK_1];
4026 gpu_metrics->throttle_status = sienna_cichlid_get_throttler_status_locked(smu, use_metrics_v3, use_metrics_v2);
4027 gpu_metrics->indep_throttle_status =
4028 smu_cmn_get_indep_throttler_status(gpu_metrics->throttle_status,
4029 sienna_cichlid_throttler_map);
4031 gpu_metrics->current_fan_speed = use_metrics_v3 ? metrics_v3->CurrFanSpeed :
4032 use_metrics_v2 ? metrics_v2->CurrFanSpeed : metrics->CurrFanSpeed;
4034 if (((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) && smu->smc_fw_version > 0x003A1E00) ||
4035 ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 11)) && smu->smc_fw_version > 0x00410400)) {
4036 gpu_metrics->pcie_link_width = use_metrics_v3 ? metrics_v3->PcieWidth :
4037 use_metrics_v2 ? metrics_v2->PcieWidth : metrics->PcieWidth;
4038 gpu_metrics->pcie_link_speed = link_speed[use_metrics_v3 ? metrics_v3->PcieRate :
4039 use_metrics_v2 ? metrics_v2->PcieRate : metrics->PcieRate];
4041 gpu_metrics->pcie_link_width =
4042 smu_v11_0_get_current_pcie_link_width(smu);
4043 gpu_metrics->pcie_link_speed =
4044 smu_v11_0_get_current_pcie_link_speed(smu);
4047 gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
4049 *table = (void *)gpu_metrics;
4051 return sizeof(struct gpu_metrics_v1_3);
4054 static int sienna_cichlid_check_ecc_table_support(struct smu_context *smu)
4056 uint32_t if_version = 0xff, smu_version = 0xff;
4059 ret = smu_cmn_get_smc_version(smu, &if_version, &smu_version);
4063 if (smu_version < SUPPORT_ECCTABLE_SMU_VERSION)
4069 static ssize_t sienna_cichlid_get_ecc_info(struct smu_context *smu,
4072 struct smu_table_context *smu_table = &smu->smu_table;
4073 EccInfoTable_t *ecc_table = NULL;
4074 struct ecc_info_per_ch *ecc_info_per_channel = NULL;
4076 struct umc_ecc_info *eccinfo = (struct umc_ecc_info *)table;
4078 ret = sienna_cichlid_check_ecc_table_support(smu);
4082 ret = smu_cmn_update_table(smu,
4085 smu_table->ecc_table,
4088 dev_info(smu->adev->dev, "Failed to export SMU ecc table!\n");
4092 ecc_table = (EccInfoTable_t *)smu_table->ecc_table;
4094 for (i = 0; i < SIENNA_CICHLID_UMC_CHANNEL_NUM; i++) {
4095 ecc_info_per_channel = &(eccinfo->ecc[i]);
4096 ecc_info_per_channel->ce_count_lo_chip =
4097 ecc_table->EccInfo[i].ce_count_lo_chip;
4098 ecc_info_per_channel->ce_count_hi_chip =
4099 ecc_table->EccInfo[i].ce_count_hi_chip;
4100 ecc_info_per_channel->mca_umc_status =
4101 ecc_table->EccInfo[i].mca_umc_status;
4102 ecc_info_per_channel->mca_umc_addr =
4103 ecc_table->EccInfo[i].mca_umc_addr;
4108 static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
4110 uint16_t *mgpu_fan_boost_limit_rpm;
4112 GET_PPTABLE_MEMBER(MGpuFanBoostLimitRpm, &mgpu_fan_boost_limit_rpm);
4114 * Skip the MGpuFanBoost setting for those ASICs
4115 * which do not support it
4117 if (*mgpu_fan_boost_limit_rpm == 0)
4120 return smu_cmn_send_smc_msg_with_param(smu,
4121 SMU_MSG_SetMGpuFanBoostLimitRpm,
4126 static int sienna_cichlid_gpo_control(struct smu_context *smu,
4129 uint32_t smu_version;
4133 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFX_GPO_BIT)) {
4134 ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
4139 if (smu_version < 0x003a2500) {
4140 ret = smu_cmn_send_smc_msg_with_param(smu,
4141 SMU_MSG_SetGpoFeaturePMask,
4142 GFX_GPO_PACE_MASK | GFX_GPO_DEM_MASK,
4145 ret = smu_cmn_send_smc_msg_with_param(smu,
4146 SMU_MSG_DisallowGpo,
4151 if (smu_version < 0x003a2500) {
4152 ret = smu_cmn_send_smc_msg_with_param(smu,
4153 SMU_MSG_SetGpoFeaturePMask,
4157 ret = smu_cmn_send_smc_msg_with_param(smu,
4158 SMU_MSG_DisallowGpo,
4168 static int sienna_cichlid_notify_2nd_usb20_port(struct smu_context *smu)
4170 uint32_t smu_version;
4173 ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
4178 * Message SMU_MSG_Enable2ndUSB20Port is supported by 58.45
4181 if (smu_version < 0x003A2D00)
4184 return smu_cmn_send_smc_msg_with_param(smu,
4185 SMU_MSG_Enable2ndUSB20Port,
4186 smu->smu_table.boot_values.firmware_caps & ATOM_FIRMWARE_CAP_ENABLE_2ND_USB20PORT ?
4191 static int sienna_cichlid_system_features_control(struct smu_context *smu,
4197 ret = sienna_cichlid_notify_2nd_usb20_port(smu);
4202 return smu_v11_0_system_features_control(smu, en);
4205 static int sienna_cichlid_set_mp1_state(struct smu_context *smu,
4206 enum pp_mp1_state mp1_state)
4210 switch (mp1_state) {
4211 case PP_MP1_STATE_UNLOAD:
4212 ret = smu_cmn_set_mp1_state(smu, mp1_state);
4222 static void sienna_cichlid_stb_init(struct smu_context *smu)
4224 struct amdgpu_device *adev = smu->adev;
4227 reg = RREG32_PCIE(MP1_Public | smnMP1_PMI_3_START);
4228 smu->stb_context.enabled = REG_GET_FIELD(reg, MP1_PMI_3_START, ENABLE);
4230 /* STB is disabled */
4231 if (!smu->stb_context.enabled)
4234 spin_lock_init(&smu->stb_context.lock);
4236 /* STB buffer size in bytes as function of FIFO depth */
4237 reg = RREG32_PCIE(MP1_Public | smnMP1_PMI_3_FIFO);
4238 smu->stb_context.stb_buf_size = 1 << REG_GET_FIELD(reg, MP1_PMI_3_FIFO, DEPTH);
4239 smu->stb_context.stb_buf_size *= SIENNA_CICHLID_STB_DEPTH_UNIT_BYTES;
4241 dev_info(smu->adev->dev, "STB initialized to %d entries",
4242 smu->stb_context.stb_buf_size / SIENNA_CICHLID_STB_DEPTH_UNIT_BYTES);
4246 static int sienna_cichlid_get_default_config_table_settings(struct smu_context *smu,
4247 struct config_table_setting *table)
4249 struct amdgpu_device *adev = smu->adev;
4254 table->gfxclk_average_tau = 10;
4255 table->socclk_average_tau = 10;
4256 table->fclk_average_tau = 10;
4257 table->uclk_average_tau = 10;
4258 table->gfx_activity_average_tau = 10;
4259 table->mem_activity_average_tau = 10;
4260 table->socket_power_average_tau = 100;
4261 if (adev->ip_versions[MP1_HWIP][0] != IP_VERSION(11, 0, 7))
4262 table->apu_socket_power_average_tau = 100;
4267 static int sienna_cichlid_set_config_table(struct smu_context *smu,
4268 struct config_table_setting *table)
4270 DriverSmuConfigExternal_t driver_smu_config_table;
4275 memset(&driver_smu_config_table,
4277 sizeof(driver_smu_config_table));
4278 driver_smu_config_table.DriverSmuConfig.GfxclkAverageLpfTau =
4279 table->gfxclk_average_tau;
4280 driver_smu_config_table.DriverSmuConfig.FclkAverageLpfTau =
4281 table->fclk_average_tau;
4282 driver_smu_config_table.DriverSmuConfig.UclkAverageLpfTau =
4283 table->uclk_average_tau;
4284 driver_smu_config_table.DriverSmuConfig.GfxActivityLpfTau =
4285 table->gfx_activity_average_tau;
4286 driver_smu_config_table.DriverSmuConfig.UclkActivityLpfTau =
4287 table->mem_activity_average_tau;
4288 driver_smu_config_table.DriverSmuConfig.SocketPowerLpfTau =
4289 table->socket_power_average_tau;
4291 return smu_cmn_update_table(smu,
4292 SMU_TABLE_DRIVER_SMU_CONFIG,
4294 (void *)&driver_smu_config_table,
4298 static int sienna_cichlid_stb_get_data_direct(struct smu_context *smu,
4303 struct amdgpu_device *adev = smu->adev;
4305 /* No need to disable interrupts for now as we don't lock it yet from ISR */
4306 spin_lock(&smu->stb_context.lock);
4309 * Read the STB FIFO in units of 32bit since this is the accessor window
4310 * (register width) we have.
4312 buf = ((char *) buf) + size;
4313 while ((void *)p < buf)
4314 *p++ = cpu_to_le32(RREG32_PCIE(MP1_Public | smnMP1_PMI_3));
4316 spin_unlock(&smu->stb_context.lock);
4321 static bool sienna_cichlid_is_mode2_reset_supported(struct smu_context *smu)
4326 static int sienna_cichlid_mode2_reset(struct smu_context *smu)
4330 struct amdgpu_device *adev = smu->adev;
4333 smu_cmn_get_smc_version(smu, NULL, &smu_version);
4335 index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
4336 SMU_MSG_DriverMode2Reset);
4338 mutex_lock(&smu->message_lock);
4340 ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index,
4343 ret = smu_cmn_wait_for_response(smu);
4344 while (ret != 0 && timeout) {
4345 ret = smu_cmn_wait_for_response(smu);
4346 /* Wait a bit more time for getting ACK */
4349 usleep_range(500, 1000);
4358 "failed to send mode2 message \tparam: 0x%08x response %#x\n",
4359 SMU_RESET_MODE_2, ret);
4363 dev_info(smu->adev->dev, "restore config space...\n");
4364 /* Restore the config space saved during init */
4365 amdgpu_device_load_pci_state(adev->pdev);
4367 mutex_unlock(&smu->message_lock);
4372 static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
4373 .get_allowed_feature_mask = sienna_cichlid_get_allowed_feature_mask,
4374 .set_default_dpm_table = sienna_cichlid_set_default_dpm_table,
4375 .dpm_set_vcn_enable = sienna_cichlid_dpm_set_vcn_enable,
4376 .dpm_set_jpeg_enable = sienna_cichlid_dpm_set_jpeg_enable,
4377 .i2c_init = sienna_cichlid_i2c_control_init,
4378 .i2c_fini = sienna_cichlid_i2c_control_fini,
4379 .print_clk_levels = sienna_cichlid_print_clk_levels,
4380 .force_clk_levels = sienna_cichlid_force_clk_levels,
4381 .populate_umd_state_clk = sienna_cichlid_populate_umd_state_clk,
4382 .pre_display_config_changed = sienna_cichlid_pre_display_config_changed,
4383 .display_config_changed = sienna_cichlid_display_config_changed,
4384 .notify_smc_display_config = sienna_cichlid_notify_smc_display_config,
4385 .is_dpm_running = sienna_cichlid_is_dpm_running,
4386 .get_fan_speed_pwm = smu_v11_0_get_fan_speed_pwm,
4387 .get_fan_speed_rpm = sienna_cichlid_get_fan_speed_rpm,
4388 .get_power_profile_mode = sienna_cichlid_get_power_profile_mode,
4389 .set_power_profile_mode = sienna_cichlid_set_power_profile_mode,
4390 .set_watermarks_table = sienna_cichlid_set_watermarks_table,
4391 .read_sensor = sienna_cichlid_read_sensor,
4392 .get_uclk_dpm_states = sienna_cichlid_get_uclk_dpm_states,
4393 .set_performance_level = smu_v11_0_set_performance_level,
4394 .get_thermal_temperature_range = sienna_cichlid_get_thermal_temperature_range,
4395 .display_disable_memory_clock_switch = sienna_cichlid_display_disable_memory_clock_switch,
4396 .get_power_limit = sienna_cichlid_get_power_limit,
4397 .update_pcie_parameters = sienna_cichlid_update_pcie_parameters,
4398 .dump_pptable = sienna_cichlid_dump_pptable,
4399 .init_microcode = smu_v11_0_init_microcode,
4400 .load_microcode = smu_v11_0_load_microcode,
4401 .fini_microcode = smu_v11_0_fini_microcode,
4402 .init_smc_tables = sienna_cichlid_init_smc_tables,
4403 .fini_smc_tables = smu_v11_0_fini_smc_tables,
4404 .init_power = smu_v11_0_init_power,
4405 .fini_power = smu_v11_0_fini_power,
4406 .check_fw_status = smu_v11_0_check_fw_status,
4407 .setup_pptable = sienna_cichlid_setup_pptable,
4408 .get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
4409 .check_fw_version = smu_v11_0_check_fw_version,
4410 .write_pptable = smu_cmn_write_pptable,
4411 .set_driver_table_location = smu_v11_0_set_driver_table_location,
4412 .set_tool_table_location = smu_v11_0_set_tool_table_location,
4413 .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
4414 .system_features_control = sienna_cichlid_system_features_control,
4415 .send_smc_msg_with_param = smu_cmn_send_smc_msg_with_param,
4416 .send_smc_msg = smu_cmn_send_smc_msg,
4417 .init_display_count = NULL,
4418 .set_allowed_mask = smu_v11_0_set_allowed_mask,
4419 .get_enabled_mask = smu_cmn_get_enabled_mask,
4420 .feature_is_enabled = smu_cmn_feature_is_enabled,
4421 .disable_all_features_with_exception = smu_cmn_disable_all_features_with_exception,
4422 .notify_display_change = NULL,
4423 .set_power_limit = smu_v11_0_set_power_limit,
4424 .init_max_sustainable_clocks = smu_v11_0_init_max_sustainable_clocks,
4425 .enable_thermal_alert = smu_v11_0_enable_thermal_alert,
4426 .disable_thermal_alert = smu_v11_0_disable_thermal_alert,
4427 .set_min_dcef_deep_sleep = NULL,
4428 .display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
4429 .get_fan_control_mode = smu_v11_0_get_fan_control_mode,
4430 .set_fan_control_mode = smu_v11_0_set_fan_control_mode,
4431 .set_fan_speed_pwm = smu_v11_0_set_fan_speed_pwm,
4432 .set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
4433 .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
4434 .gfx_off_control = smu_v11_0_gfx_off_control,
4435 .register_irq_handler = smu_v11_0_register_irq_handler,
4436 .set_azalia_d3_pme = smu_v11_0_set_azalia_d3_pme,
4437 .get_max_sustainable_clocks_by_dc = smu_v11_0_get_max_sustainable_clocks_by_dc,
4438 .baco_is_support = smu_v11_0_baco_is_support,
4439 .baco_get_state = smu_v11_0_baco_get_state,
4440 .baco_set_state = smu_v11_0_baco_set_state,
4441 .baco_enter = sienna_cichlid_baco_enter,
4442 .baco_exit = sienna_cichlid_baco_exit,
4443 .mode1_reset_is_support = sienna_cichlid_is_mode1_reset_supported,
4444 .mode1_reset = smu_v11_0_mode1_reset,
4445 .get_dpm_ultimate_freq = sienna_cichlid_get_dpm_ultimate_freq,
4446 .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range,
4447 .set_default_od_settings = sienna_cichlid_set_default_od_settings,
4448 .od_edit_dpm_table = sienna_cichlid_od_edit_dpm_table,
4449 .restore_user_od_settings = sienna_cichlid_restore_user_od_settings,
4450 .run_btc = sienna_cichlid_run_btc,
4451 .set_power_source = smu_v11_0_set_power_source,
4452 .get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
4453 .set_pp_feature_mask = smu_cmn_set_pp_feature_mask,
4454 .get_gpu_metrics = sienna_cichlid_get_gpu_metrics,
4455 .enable_mgpu_fan_boost = sienna_cichlid_enable_mgpu_fan_boost,
4456 .gfx_ulv_control = smu_v11_0_gfx_ulv_control,
4457 .deep_sleep_control = smu_v11_0_deep_sleep_control,
4458 .get_fan_parameters = sienna_cichlid_get_fan_parameters,
4459 .interrupt_work = smu_v11_0_interrupt_work,
4460 .gpo_control = sienna_cichlid_gpo_control,
4461 .set_mp1_state = sienna_cichlid_set_mp1_state,
4462 .stb_collect_info = sienna_cichlid_stb_get_data_direct,
4463 .get_ecc_info = sienna_cichlid_get_ecc_info,
4464 .get_default_config_table_settings = sienna_cichlid_get_default_config_table_settings,
4465 .set_config_table = sienna_cichlid_set_config_table,
4466 .get_unique_id = sienna_cichlid_get_unique_id,
4467 .mode2_reset_is_support = sienna_cichlid_is_mode2_reset_supported,
4468 .mode2_reset = sienna_cichlid_mode2_reset,
4471 void sienna_cichlid_set_ppt_funcs(struct smu_context *smu)
4473 smu->ppt_funcs = &sienna_cichlid_ppt_funcs;
4474 smu->message_map = sienna_cichlid_message_map;
4475 smu->clock_map = sienna_cichlid_clk_map;
4476 smu->feature_map = sienna_cichlid_feature_mask_map;
4477 smu->table_map = sienna_cichlid_table_map;
4478 smu->pwr_src_map = sienna_cichlid_pwr_src_map;
4479 smu->workload_map = sienna_cichlid_workload_map;
4480 smu_v11_0_set_smu_mailbox_registers(smu);