Lines Matching refs:hwmgr

95 static int polaris10_perform_btc(struct pp_hwmgr *hwmgr)  in polaris10_perform_btc()  argument
98 struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend); in polaris10_perform_btc()
101 …if (0 != smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_PerformBtc, smu_data->avfs_btc_param… in polaris10_perform_btc()
109 cgs_write_register(hwmgr->device, mmCP_MEC_CNTL, 0x50000000); in polaris10_perform_btc()
111 cgs_write_register(hwmgr->device, mmGRBM_SOFT_RESET, 0xffffffff); in polaris10_perform_btc()
112 cgs_write_register(hwmgr->device, mmGRBM_SOFT_RESET, 0); in polaris10_perform_btc()
118 static int polaris10_setup_graphics_level_structure(struct pp_hwmgr *hwmgr) in polaris10_setup_graphics_level_structure() argument
129 PP_ASSERT_WITH_CODE(0 == smu7_read_smc_sram_dword(hwmgr, in polaris10_setup_graphics_level_structure()
140 PP_ASSERT_WITH_CODE(0 == smu7_copy_bytes_to_smc(hwmgr, vr_config_address, in polaris10_setup_graphics_level_structure()
147 PP_ASSERT_WITH_CODE(0 == smu7_copy_bytes_to_smc(hwmgr, graphics_level_address, in polaris10_setup_graphics_level_structure()
155 PP_ASSERT_WITH_CODE(0 == smu7_copy_bytes_to_smc(hwmgr, graphics_level_address, in polaris10_setup_graphics_level_structure()
164 PP_ASSERT_WITH_CODE(0 == smu7_copy_bytes_to_smc(hwmgr, graphics_level_address, in polaris10_setup_graphics_level_structure()
173 static int polaris10_avfs_event_mgr(struct pp_hwmgr *hwmgr) in polaris10_avfs_event_mgr() argument
175 struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend); in polaris10_avfs_event_mgr()
177 if (!hwmgr->avfs_supported) in polaris10_avfs_event_mgr()
180 PP_ASSERT_WITH_CODE(0 == polaris10_setup_graphics_level_structure(hwmgr), in polaris10_avfs_event_mgr()
186 PP_ASSERT_WITH_CODE(0 == smu7_setup_pwr_virus(hwmgr), in polaris10_avfs_event_mgr()
191 PP_ASSERT_WITH_CODE(0 == polaris10_perform_btc(hwmgr), in polaris10_avfs_event_mgr()
198 static int polaris10_start_smu_in_protection_mode(struct pp_hwmgr *hwmgr) in polaris10_start_smu_in_protection_mode() argument
206 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_protection_mode()
209 result = smu7_upload_smu_firmware_image(hwmgr); in polaris10_start_smu_in_protection_mode()
214 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMU_STATUS, 0); in polaris10_start_smu_in_protection_mode()
216 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_protection_mode()
220 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_protection_mode()
224 PHM_WAIT_VFPF_INDIRECT_FIELD(hwmgr, SMC_IND, RCU_UC_EVENTS, INTERRUPTS_ENABLED, 1); in polaris10_start_smu_in_protection_mode()
228 smu7_send_msg_to_smc_offset(hwmgr); in polaris10_start_smu_in_protection_mode()
233 PHM_WAIT_VFPF_INDIRECT_FIELD_UNEQUAL(hwmgr, SMC_IND, SMU_STATUS, SMU_DONE, 0); in polaris10_start_smu_in_protection_mode()
235 if (1 != PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_protection_mode()
239 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixFIRMWARE_FLAGS, 0); in polaris10_start_smu_in_protection_mode()
241 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_protection_mode()
244 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_protection_mode()
248 PHM_WAIT_VFPF_INDIRECT_FIELD(hwmgr, SMC_IND, FIRMWARE_FLAGS, INTERRUPTS_ENABLED, 1); in polaris10_start_smu_in_protection_mode()
253 static int polaris10_start_smu_in_non_protection_mode(struct pp_hwmgr *hwmgr) in polaris10_start_smu_in_non_protection_mode() argument
258 PHM_WAIT_VFPF_INDIRECT_FIELD_UNEQUAL(hwmgr, SMC_IND, RCU_UC_EVENTS, boot_seq_done, 0); in polaris10_start_smu_in_non_protection_mode()
262 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_non_protection_mode()
265 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_non_protection_mode()
269 result = smu7_upload_smu_firmware_image(hwmgr); in polaris10_start_smu_in_non_protection_mode()
274 smu7_program_jump_on_start(hwmgr); in polaris10_start_smu_in_non_protection_mode()
276 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_non_protection_mode()
279 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_start_smu_in_non_protection_mode()
284 PHM_WAIT_VFPF_INDIRECT_FIELD(hwmgr, SMC_IND, in polaris10_start_smu_in_non_protection_mode()
290 static int polaris10_start_smu(struct pp_hwmgr *hwmgr) in polaris10_start_smu() argument
293 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_start_smu()
296 if (!smu7_is_smc_ram_running(hwmgr) && hwmgr->not_vf) { in polaris10_start_smu()
297 …smu_data->protected_mode = (uint8_t) (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC… in polaris10_start_smu()
298 …smu_data->smu7_data.security_hard_key = (uint8_t) (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS… in polaris10_start_smu()
302 result = polaris10_start_smu_in_non_protection_mode(hwmgr); in polaris10_start_smu()
304 result = polaris10_start_smu_in_protection_mode(hwmgr); in polaris10_start_smu()
309 polaris10_avfs_event_mgr(hwmgr); in polaris10_start_smu()
313 …smu7_read_smc_sram_dword(hwmgr, SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, So… in polaris10_start_smu()
316 result = smu7_request_smu_load_fw(hwmgr); in polaris10_start_smu()
321 static bool polaris10_is_hw_avfs_present(struct pp_hwmgr *hwmgr) in polaris10_is_hw_avfs_present() argument
325 efuse = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMU_EFUSE_0 + (49*4)); in polaris10_is_hw_avfs_present()
333 static int polaris10_smu_init(struct pp_hwmgr *hwmgr) in polaris10_smu_init() argument
341 hwmgr->smu_backend = smu_data; in polaris10_smu_init()
343 if (smu7_init(hwmgr)) { in polaris10_smu_init()
351 static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, in polaris10_get_dependency_volt_by_clk() argument
357 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_get_dependency_volt_by_clk()
423 static int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr) in polaris10_populate_bapm_parameters_in_dpm_table() argument
425 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_bapm_parameters_in_dpm_table()
430 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_bapm_parameters_in_dpm_table()
433 &hwmgr->thermal_controller.advanceFanControlParameters; in polaris10_populate_bapm_parameters_in_dpm_table()
471 static int polaris10_populate_svi_load_line(struct pp_hwmgr *hwmgr) in polaris10_populate_svi_load_line() argument
473 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_svi_load_line()
484 static int polaris10_populate_tdc_limit(struct pp_hwmgr *hwmgr) in polaris10_populate_tdc_limit() argument
487 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_tdc_limit()
489 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_tdc_limit()
502 static int polaris10_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset) in polaris10_populate_dw8() argument
504 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_dw8()
508 if (smu7_read_smc_sram_dword(hwmgr, in polaris10_populate_dw8()
526 static int polaris10_populate_temperature_scaler(struct pp_hwmgr *hwmgr) in polaris10_populate_temperature_scaler() argument
529 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_temperature_scaler()
538 static int polaris10_populate_fuzzy_fan(struct pp_hwmgr *hwmgr) in polaris10_populate_fuzzy_fan() argument
540 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_fuzzy_fan()
543 if ((hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity & (1 << 15)) in polaris10_populate_fuzzy_fan()
544 || 0 == hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity) in polaris10_populate_fuzzy_fan()
545 hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity = in polaris10_populate_fuzzy_fan()
546 hwmgr->thermal_controller.advanceFanControlParameters.usDefaultFanOutputSensitivity; in polaris10_populate_fuzzy_fan()
549 hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity); in polaris10_populate_fuzzy_fan()
553 static int polaris10_populate_gnb_lpml(struct pp_hwmgr *hwmgr) in polaris10_populate_gnb_lpml() argument
556 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_gnb_lpml()
565 static int polaris10_populate_bapm_vddc_base_leakage_sidd(struct pp_hwmgr *hwmgr) in polaris10_populate_bapm_vddc_base_leakage_sidd() argument
567 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_bapm_vddc_base_leakage_sidd()
569 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_bapm_vddc_base_leakage_sidd()
585 static int polaris10_populate_pm_fuses(struct pp_hwmgr *hwmgr) in polaris10_populate_pm_fuses() argument
587 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_pm_fuses()
590 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_populate_pm_fuses()
592 if (smu7_read_smc_sram_dword(hwmgr, in polaris10_populate_pm_fuses()
600 if (polaris10_populate_svi_load_line(hwmgr)) in polaris10_populate_pm_fuses()
605 if (polaris10_populate_tdc_limit(hwmgr)) in polaris10_populate_pm_fuses()
609 if (polaris10_populate_dw8(hwmgr, pm_fuse_table_offset)) in polaris10_populate_pm_fuses()
615 if (0 != polaris10_populate_temperature_scaler(hwmgr)) in polaris10_populate_pm_fuses()
620 if (polaris10_populate_fuzzy_fan(hwmgr)) in polaris10_populate_pm_fuses()
625 if (polaris10_populate_gnb_lpml(hwmgr)) in polaris10_populate_pm_fuses()
630 if (polaris10_populate_bapm_vddc_base_leakage_sidd(hwmgr)) in polaris10_populate_pm_fuses()
635 if (smu7_copy_bytes_to_smc(hwmgr, pm_fuse_table_offset, in polaris10_populate_pm_fuses()
645 static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_mvdd_table() argument
648 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_mvdd_table()
672 static int polaris10_populate_smc_vddci_table(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_vddci_table() argument
676 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_vddci_table()
697 static int polaris10_populate_cac_table(struct pp_hwmgr *hwmgr, in polaris10_populate_cac_table() argument
702 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_cac_table()
704 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_cac_table()
723 static int polaris10_populate_smc_voltage_tables(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_voltage_tables() argument
726 polaris10_populate_smc_vddci_table(hwmgr, table); in polaris10_populate_smc_voltage_tables()
727 polaris10_populate_smc_mvdd_table(hwmgr, table); in polaris10_populate_smc_voltage_tables()
728 polaris10_populate_cac_table(hwmgr, table); in polaris10_populate_smc_voltage_tables()
733 static int polaris10_populate_ulv_level(struct pp_hwmgr *hwmgr, in polaris10_populate_ulv_level() argument
736 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_ulv_level()
738 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_ulv_level()
747 if (hwmgr->chip_id == CHIP_POLARIS12 || hwmgr->is_kicker) in polaris10_populate_ulv_level()
759 static int polaris10_populate_ulv_state(struct pp_hwmgr *hwmgr, in polaris10_populate_ulv_state() argument
762 return polaris10_populate_ulv_level(hwmgr, &table->Ulv); in polaris10_populate_ulv_state()
765 static int polaris10_populate_smc_link_level(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_link_level() argument
768 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_link_level()
769 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_smc_link_level()
797 static void polaris10_get_sclk_range_table(struct pp_hwmgr *hwmgr, in polaris10_get_sclk_range_table() argument
800 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_get_sclk_range_table()
805 ref_clk = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in polaris10_get_sclk_range_table()
807 if (0 == atomctrl_get_smc_sclk_range_table(hwmgr, &range_table_from_vbios)) { in polaris10_get_sclk_range_table()
840 static int polaris10_calculate_sclk_params(struct pp_hwmgr *hwmgr, in polaris10_calculate_sclk_params() argument
843 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_calculate_sclk_params()
854 result = atomctrl_get_engine_pll_dividers_ai(hwmgr, clock, &dividers); in polaris10_calculate_sclk_params()
870 ref_clock = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in polaris10_calculate_sclk_params()
905 static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr, in polaris10_populate_single_graphic_level() argument
911 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_single_graphic_level()
913 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_single_graphic_level()
917 result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting); in polaris10_populate_single_graphic_level()
919 if (hwmgr->od_enabled) in polaris10_populate_single_graphic_level()
925 result = polaris10_get_dependency_volt_by_clk(hwmgr, in polaris10_populate_single_graphic_level()
943 data->display_timing.min_clock_in_sr = hwmgr->display_config->min_core_set_clock_in_sr; in polaris10_populate_single_graphic_level()
945 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) in polaris10_populate_single_graphic_level()
947 hwmgr->display_config->min_core_set_clock_in_sr); in polaris10_populate_single_graphic_level()
976 static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) in polaris10_populate_all_graphic_levels() argument
978 struct smu7_hwmgr *hw_data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_all_graphic_levels()
979 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_all_graphic_levels()
982 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_all_graphic_levels()
998 polaris10_get_sclk_range_table(hwmgr, &(smu_data->smc_state_table)); in polaris10_populate_all_graphic_levels()
1002 result = polaris10_populate_single_graphic_level(hwmgr, in polaris10_populate_all_graphic_levels()
1012 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_populate_all_graphic_levels()
1063 result = smu7_copy_bytes_to_smc(hwmgr, array, (uint8_t *)levels, in polaris10_populate_all_graphic_levels()
1070 static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr, in polaris10_populate_single_memory_level() argument
1073 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_single_memory_level()
1075 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_single_memory_level()
1081 if (hwmgr->od_enabled) in polaris10_populate_single_memory_level()
1087 result = polaris10_get_dependency_volt_by_clk(hwmgr, in polaris10_populate_single_memory_level()
1105 data->display_timing.num_existing_displays = hwmgr->display_config->num_display; in polaris10_populate_single_memory_level()
1109 (PHM_READ_FIELD(hwmgr->device, DPG_PIPE_STUTTER_CONTROL, in polaris10_populate_single_memory_level()
1122 static int polaris10_populate_all_memory_levels(struct pp_hwmgr *hwmgr) in polaris10_populate_all_memory_levels() argument
1124 struct smu7_hwmgr *hw_data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_all_memory_levels()
1125 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_all_memory_levels()
1141 result = polaris10_populate_single_memory_level(hwmgr, in polaris10_populate_all_memory_levels()
1166 result = smu7_copy_bytes_to_smc(hwmgr, array, (uint8_t *)levels, in polaris10_populate_all_memory_levels()
1172 static int polaris10_populate_mvdd_value(struct pp_hwmgr *hwmgr, in polaris10_populate_mvdd_value() argument
1175 const struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_mvdd_value()
1177 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_mvdd_value()
1197 static int polaris10_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_acpi_level() argument
1202 const struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_acpi_level()
1204 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_smc_acpi_level()
1213 result = polaris10_get_dependency_volt_by_clk(hwmgr, in polaris10_populate_smc_acpi_level()
1222 result = polaris10_calculate_sclk_params(hwmgr, sclk_frequency, &(table->ACPILevel.SclkSetting)); in polaris10_populate_smc_acpi_level()
1248 result = polaris10_get_dependency_volt_by_clk(hwmgr, in polaris10_populate_smc_acpi_level()
1259 polaris10_populate_mvdd_value(hwmgr, in polaris10_populate_smc_acpi_level()
1263 if (0 == polaris10_populate_mvdd_value(hwmgr, 0, &vol_level)) in polaris10_populate_smc_acpi_level()
1284 static int polaris10_populate_smc_vce_level(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_vce_level() argument
1291 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_smc_vce_level()
1294 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_vce_level()
1320 result = atomctrl_get_dfs_pll_dividers_vi(hwmgr, in polaris10_populate_smc_vce_level()
1334 static int polaris10_populate_memory_timing_parameters(struct pp_hwmgr *hwmgr, in polaris10_populate_memory_timing_parameters() argument
1343 result = atomctrl_set_engine_dram_timings_rv770(hwmgr, in polaris10_populate_memory_timing_parameters()
1348 dram_timing = cgs_read_register(hwmgr->device, mmMC_ARB_DRAM_TIMING); in polaris10_populate_memory_timing_parameters()
1349 dram_timing2 = cgs_read_register(hwmgr->device, mmMC_ARB_DRAM_TIMING2); in polaris10_populate_memory_timing_parameters()
1350 burst_time = PHM_READ_FIELD(hwmgr->device, MC_ARB_BURST_TIME, STATE0); in polaris10_populate_memory_timing_parameters()
1360 static int polaris10_program_memory_timing_parameters(struct pp_hwmgr *hwmgr) in polaris10_program_memory_timing_parameters() argument
1362 struct smu7_hwmgr *hw_data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_program_memory_timing_parameters()
1363 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_program_memory_timing_parameters()
1370 result = polaris10_populate_memory_timing_parameters(hwmgr, in polaris10_program_memory_timing_parameters()
1375 result = atomctrl_set_ac_timing_ai(hwmgr, hw_data->dpm_table.mclk_table.dpm_levels[j].value, j); in polaris10_program_memory_timing_parameters()
1382 hwmgr, in polaris10_program_memory_timing_parameters()
1390 static int polaris10_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_uvd_level() argument
1397 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_smc_uvd_level()
1400 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_uvd_level()
1425 result = atomctrl_get_dfs_pll_dividers_vi(hwmgr, in polaris10_populate_smc_uvd_level()
1432 result = atomctrl_get_dfs_pll_dividers_vi(hwmgr, in polaris10_populate_smc_uvd_level()
1447 static int polaris10_populate_smc_boot_level(struct pp_hwmgr *hwmgr, in polaris10_populate_smc_boot_level() argument
1451 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_boot_level()
1479 static int polaris10_populate_smc_initailial_state(struct pp_hwmgr *hwmgr) in polaris10_populate_smc_initailial_state() argument
1481 struct smu7_hwmgr *hw_data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_smc_initailial_state()
1482 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_smc_initailial_state()
1484 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_smc_initailial_state()
1509 static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) in polaris10_populate_clock_stretcher_data_table() argument
1512 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_clock_stretcher_data_table()
1516 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_populate_clock_stretcher_data_table()
1525 efuse = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, in polaris10_populate_clock_stretcher_data_table()
1530 if (hwmgr->chip_id == CHIP_POLARIS10) { in polaris10_populate_clock_stretcher_data_table()
1544 if (hwmgr->chip_id == CHIP_POLARIS10) { in polaris10_populate_clock_stretcher_data_table()
1566 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_populate_clock_stretcher_data_table()
1573 value = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL); in polaris10_populate_clock_stretcher_data_table()
1575 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL, value); in polaris10_populate_clock_stretcher_data_table()
1580 static int polaris10_populate_vr_config(struct pp_hwmgr *hwmgr, in polaris10_populate_vr_config() argument
1583 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_vr_config()
1584 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_vr_config()
1614 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, smu_data->smu7_data.soft_regs_start + in polaris10_populate_vr_config()
1625 static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr) in polaris10_populate_avfs_parameters() argument
1627 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_populate_avfs_parameters()
1628 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_populate_avfs_parameters()
1638 (struct phm_ppt_v1_information *)hwmgr->pptable; in polaris10_populate_avfs_parameters()
1643 if (!hwmgr->avfs_supported) in polaris10_populate_avfs_parameters()
1646 result = atomctrl_get_avfs_information(hwmgr, &avfs_params); in polaris10_populate_avfs_parameters()
1679 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_populate_avfs_parameters()
1683 smu7_copy_bytes_to_smc(hwmgr, in polaris10_populate_avfs_parameters()
1689 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_populate_avfs_parameters()
1692 smu7_copy_bytes_to_smc(hwmgr, in polaris10_populate_avfs_parameters()
1707 static int polaris10_init_arb_table_index(struct pp_hwmgr *hwmgr) in polaris10_init_arb_table_index() argument
1709 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_init_arb_table_index()
1721 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_init_arb_table_index()
1730 return smu7_write_smc_sram_dword(hwmgr, in polaris10_init_arb_table_index()
1734 static void polaris10_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) in polaris10_initialize_power_tune_defaults() argument
1736 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_initialize_power_tune_defaults()
1738 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_initialize_power_tune_defaults()
1751 static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) in polaris10_init_smc_table() argument
1754 struct smu7_hwmgr *hw_data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_init_smc_table()
1755 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_init_smc_table()
1758 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_init_smc_table()
1764 polaris10_initialize_power_tune_defaults(hwmgr); in polaris10_init_smc_table()
1767 polaris10_populate_smc_voltage_tables(hwmgr, table); in polaris10_init_smc_table()
1770 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1774 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1782 result = polaris10_populate_ulv_state(hwmgr, table); in polaris10_init_smc_table()
1785 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, in polaris10_init_smc_table()
1789 result = polaris10_populate_smc_link_level(hwmgr, table); in polaris10_init_smc_table()
1793 result = polaris10_populate_all_graphic_levels(hwmgr); in polaris10_init_smc_table()
1797 result = polaris10_populate_all_memory_levels(hwmgr); in polaris10_init_smc_table()
1801 result = polaris10_populate_smc_acpi_level(hwmgr, table); in polaris10_init_smc_table()
1805 result = polaris10_populate_smc_vce_level(hwmgr, table); in polaris10_init_smc_table()
1813 result = polaris10_program_memory_timing_parameters(hwmgr); in polaris10_init_smc_table()
1817 result = polaris10_populate_smc_uvd_level(hwmgr, table); in polaris10_init_smc_table()
1821 result = polaris10_populate_smc_boot_level(hwmgr, table); in polaris10_init_smc_table()
1825 result = polaris10_populate_smc_initailial_state(hwmgr); in polaris10_init_smc_table()
1829 result = polaris10_populate_bapm_parameters_in_dpm_table(hwmgr); in polaris10_init_smc_table()
1833 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1835 result = polaris10_populate_clock_stretcher_data_table(hwmgr); in polaris10_init_smc_table()
1841 result = polaris10_populate_avfs_parameters(hwmgr); in polaris10_init_smc_table()
1865 result = polaris10_populate_vr_config(hwmgr, table); in polaris10_init_smc_table()
1872 if (atomctrl_get_pp_assign_pin(hwmgr, VDDC_VRHOT_GPIO_PINID, &gpio_pin)) { in polaris10_init_smc_table()
1876 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1880 if (atomctrl_get_pp_assign_pin(hwmgr, PP_AC_DC_SWITCH_GPIO_PINID, in polaris10_init_smc_table()
1883 phm_cap_set(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1887 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1892 if (atomctrl_get_pp_assign_pin(hwmgr, THERMAL_INT_OUTPUT_GPIO_PINID, in polaris10_init_smc_table()
1894 phm_cap_set(hwmgr->platform_descriptor.platformCaps, in polaris10_init_smc_table()
1904 table->ThermOutPolarity = (0 == (cgs_read_register(hwmgr->device, mmGPIOPAD_A) in polaris10_init_smc_table()
1909 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_RegulatorHot) in polaris10_init_smc_table()
1910 …&& phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_CombinePCCWithThermal… in polaris10_init_smc_table()
1920 result = atomctrl_get_dfs_pll_dividers_vi(hwmgr, smu_data->bif_sclk_table[i], &dividers); in polaris10_init_smc_table()
1944 result = smu7_copy_bytes_to_smc(hwmgr, in polaris10_init_smc_table()
1953 result = polaris10_init_arb_table_index(hwmgr); in polaris10_init_smc_table()
1957 result = polaris10_populate_pm_fuses(hwmgr); in polaris10_init_smc_table()
1964 static int polaris10_program_mem_timing_parameters(struct pp_hwmgr *hwmgr) in polaris10_program_mem_timing_parameters() argument
1966 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_program_mem_timing_parameters()
1970 return polaris10_program_memory_timing_parameters(hwmgr); in polaris10_program_mem_timing_parameters()
1975 int polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr) in polaris10_thermal_avfs_enable() argument
1977 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_thermal_avfs_enable()
1979 if (!hwmgr->avfs_supported) in polaris10_thermal_avfs_enable()
1982 smum_send_msg_to_smc_with_parameter(hwmgr, in polaris10_thermal_avfs_enable()
1985 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_EnableAvfs); in polaris10_thermal_avfs_enable()
1990 static int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr) in polaris10_thermal_setup_fan_table() argument
1992 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_thermal_setup_fan_table()
2001 if (hwmgr->thermal_controller.fanInfo.bNoFan) { in polaris10_thermal_setup_fan_table()
2002 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_thermal_setup_fan_table()
2008 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_thermal_setup_fan_table()
2013 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in polaris10_thermal_setup_fan_table()
2017 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_thermal_setup_fan_table()
2022 tmp64 = hwmgr->thermal_controller.advanceFanControlParameters. in polaris10_thermal_setup_fan_table()
2027 t_diff1 = hwmgr->thermal_controller.advanceFanControlParameters.usTMed - in polaris10_thermal_setup_fan_table()
2028 hwmgr->thermal_controller.advanceFanControlParameters.usTMin; in polaris10_thermal_setup_fan_table()
2029 t_diff2 = hwmgr->thermal_controller.advanceFanControlParameters.usTHigh - in polaris10_thermal_setup_fan_table()
2030 hwmgr->thermal_controller.advanceFanControlParameters.usTMed; in polaris10_thermal_setup_fan_table()
2032 pwm_diff1 = hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed - in polaris10_thermal_setup_fan_table()
2033 hwmgr->thermal_controller.advanceFanControlParameters.usPWMMin; in polaris10_thermal_setup_fan_table()
2034 pwm_diff2 = hwmgr->thermal_controller.advanceFanControlParameters.usPWMHigh - in polaris10_thermal_setup_fan_table()
2035 hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed; in polaris10_thermal_setup_fan_table()
2040 fan_table.TempMin = cpu_to_be16((50 + hwmgr-> in polaris10_thermal_setup_fan_table()
2042 fan_table.TempMed = cpu_to_be16((50 + hwmgr-> in polaris10_thermal_setup_fan_table()
2044 fan_table.TempMax = cpu_to_be16((50 + hwmgr-> in polaris10_thermal_setup_fan_table()
2052 fan_table.HystDown = cpu_to_be16(hwmgr-> in polaris10_thermal_setup_fan_table()
2061 reference_clock = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in polaris10_thermal_setup_fan_table()
2063 fan_table.RefreshPeriod = cpu_to_be32((hwmgr-> in polaris10_thermal_setup_fan_table()
2070 hwmgr->device, CGS_IND_REG__SMC, in polaris10_thermal_setup_fan_table()
2073 res = smu7_copy_bytes_to_smc(hwmgr, smu_data->smu7_data.fan_table_start, in polaris10_thermal_setup_fan_table()
2077 if (!res && hwmgr->thermal_controller. in polaris10_thermal_setup_fan_table()
2079 res = smum_send_msg_to_smc_with_parameter(hwmgr, in polaris10_thermal_setup_fan_table()
2081 hwmgr->thermal_controller. in polaris10_thermal_setup_fan_table()
2084 if (!res && hwmgr->thermal_controller. in polaris10_thermal_setup_fan_table()
2086 res = smum_send_msg_to_smc_with_parameter(hwmgr, in polaris10_thermal_setup_fan_table()
2088 hwmgr->thermal_controller. in polaris10_thermal_setup_fan_table()
2092 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, in polaris10_thermal_setup_fan_table()
2098 static int polaris10_update_uvd_smc_table(struct pp_hwmgr *hwmgr) in polaris10_update_uvd_smc_table() argument
2100 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_update_uvd_smc_table()
2103 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_update_uvd_smc_table()
2113 mm_boot_level_value = cgs_read_ind_register(hwmgr->device, in polaris10_update_uvd_smc_table()
2117 cgs_write_ind_register(hwmgr->device, in polaris10_update_uvd_smc_table()
2120 if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_update_uvd_smc_table()
2122 phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_update_uvd_smc_table()
2124 smum_send_msg_to_smc_with_parameter(hwmgr, in polaris10_update_uvd_smc_table()
2130 static int polaris10_update_vce_smc_table(struct pp_hwmgr *hwmgr) in polaris10_update_vce_smc_table() argument
2132 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_update_vce_smc_table()
2135 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_update_vce_smc_table()
2137 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_update_vce_smc_table()
2148 mm_boot_level_value = cgs_read_ind_register(hwmgr->device, in polaris10_update_vce_smc_table()
2152 cgs_write_ind_register(hwmgr->device, in polaris10_update_vce_smc_table()
2155 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) in polaris10_update_vce_smc_table()
2156 smum_send_msg_to_smc_with_parameter(hwmgr, in polaris10_update_vce_smc_table()
2162 static int polaris10_update_bif_smc_table(struct pp_hwmgr *hwmgr) in polaris10_update_bif_smc_table() argument
2164 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_update_bif_smc_table()
2166 (struct phm_ppt_v1_information *)(hwmgr->pptable); in polaris10_update_bif_smc_table()
2179 static int polaris10_update_smc_table(struct pp_hwmgr *hwmgr, uint32_t type) in polaris10_update_smc_table() argument
2183 polaris10_update_uvd_smc_table(hwmgr); in polaris10_update_smc_table()
2186 polaris10_update_vce_smc_table(hwmgr); in polaris10_update_smc_table()
2189 polaris10_update_bif_smc_table(hwmgr); in polaris10_update_smc_table()
2196 static int polaris10_update_sclk_threshold(struct pp_hwmgr *hwmgr) in polaris10_update_sclk_threshold() argument
2198 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_update_sclk_threshold()
2199 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_update_sclk_threshold()
2204 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in polaris10_update_sclk_threshold()
2213 hwmgr, in polaris10_update_sclk_threshold()
2224 result = polaris10_program_mem_timing_parameters(hwmgr); in polaris10_update_sclk_threshold()
2301 static int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr) in polaris10_process_firmware_header() argument
2303 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); in polaris10_process_firmware_header()
2304 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_process_firmware_header()
2309 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_process_firmware_header()
2319 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_process_firmware_header()
2331 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_process_firmware_header()
2339 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_process_firmware_header()
2349 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_process_firmware_header()
2359 result = smu7_read_smc_sram_dword(hwmgr, in polaris10_process_firmware_header()
2365 hwmgr->microcode_version_info.SMC = tmp; in polaris10_process_firmware_header()
2372 static bool polaris10_is_dpm_running(struct pp_hwmgr *hwmgr) in polaris10_is_dpm_running() argument
2374 return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device, in polaris10_is_dpm_running()
2379 static int polaris10_update_dpm_settings(struct pp_hwmgr *hwmgr, in polaris10_update_dpm_settings() argument
2382 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); in polaris10_update_dpm_settings()
2384 (hwmgr->smu_backend); in polaris10_update_dpm_settings()
2405 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_SCLKDPM_FreezeLevel); in polaris10_update_dpm_settings()
2414 tmp = PP_HOST_TO_SMC_UL(cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset)); in polaris10_update_dpm_settings()
2416 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset, PP_HOST_TO_SMC_UL(tmp)); in polaris10_update_dpm_settings()
2428 tmp = PP_HOST_TO_SMC_UL(cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset)); in polaris10_update_dpm_settings()
2431 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset, PP_HOST_TO_SMC_UL(tmp)); in polaris10_update_dpm_settings()
2435 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_SCLKDPM_UnfreezeLevel); in polaris10_update_dpm_settings()
2440 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_MCLKDPM_FreezeLevel); in polaris10_update_dpm_settings()
2449 tmp = PP_HOST_TO_SMC_UL(cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset)); in polaris10_update_dpm_settings()
2451 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset, PP_HOST_TO_SMC_UL(tmp)); in polaris10_update_dpm_settings()
2463 tmp = PP_HOST_TO_SMC_UL(cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset)); in polaris10_update_dpm_settings()
2466 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset, PP_HOST_TO_SMC_UL(tmp)); in polaris10_update_dpm_settings()
2470 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_MCLKDPM_UnfreezeLevel); in polaris10_update_dpm_settings()