Path: blob/master/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomfwctrl.c
26552 views
/*1* Copyright 2016 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*21*/2223#include "ppatomfwctrl.h"24#include "atomfirmware.h"25#include "atom.h"26#include "pp_debug.h"2728static const union atom_voltage_object_v4 *pp_atomfwctrl_lookup_voltage_type_v4(29const struct atom_voltage_objects_info_v4_1 *voltage_object_info_table,30uint8_t voltage_type, uint8_t voltage_mode)31{32unsigned int size = le16_to_cpu(33voltage_object_info_table->table_header.structuresize);34unsigned int offset =35offsetof(struct atom_voltage_objects_info_v4_1, voltage_object[0]);36unsigned long start = (unsigned long)voltage_object_info_table;3738while (offset < size) {39const union atom_voltage_object_v4 *voltage_object =40(const union atom_voltage_object_v4 *)(start + offset);4142if (voltage_type == voltage_object->gpio_voltage_obj.header.voltage_type &&43voltage_mode == voltage_object->gpio_voltage_obj.header.voltage_mode)44return voltage_object;4546offset += le16_to_cpu(voltage_object->gpio_voltage_obj.header.object_size);4748}4950return NULL;51}5253static struct atom_voltage_objects_info_v4_1 *pp_atomfwctrl_get_voltage_info_table(54struct pp_hwmgr *hwmgr)55{56const void *table_address;57uint16_t idx;5859idx = GetIndexIntoMasterDataTable(voltageobject_info);60table_address = smu_atom_get_data_table(hwmgr->adev,61idx, NULL, NULL, NULL);6263PP_ASSERT_WITH_CODE(table_address,64"Error retrieving BIOS Table Address!",65return NULL);6667return (struct atom_voltage_objects_info_v4_1 *)table_address;68}6970/*71* Returns TRUE if the given voltage type is controlled by GPIO pins.72* voltage_type is one of SET_VOLTAGE_TYPE_ASIC_VDDC, SET_VOLTAGE_TYPE_ASIC_MVDDC, SET_VOLTAGE_TYPE_ASIC_MVDDQ.73* voltage_mode is one of ATOM_SET_VOLTAGE, ATOM_SET_VOLTAGE_PHASE74*/75bool pp_atomfwctrl_is_voltage_controlled_by_gpio_v4(struct pp_hwmgr *hwmgr,76uint8_t voltage_type, uint8_t voltage_mode)77{78struct atom_voltage_objects_info_v4_1 *voltage_info =79(struct atom_voltage_objects_info_v4_1 *)80pp_atomfwctrl_get_voltage_info_table(hwmgr);81bool ret;8283/* If we cannot find the table do NOT try to control this voltage. */84PP_ASSERT_WITH_CODE(voltage_info,85"Could not find Voltage Table in BIOS.",86return false);8788ret = (pp_atomfwctrl_lookup_voltage_type_v4(voltage_info,89voltage_type, voltage_mode)) ? true : false;9091return ret;92}9394int pp_atomfwctrl_get_voltage_table_v4(struct pp_hwmgr *hwmgr,95uint8_t voltage_type, uint8_t voltage_mode,96struct pp_atomfwctrl_voltage_table *voltage_table)97{98struct atom_voltage_objects_info_v4_1 *voltage_info =99(struct atom_voltage_objects_info_v4_1 *)100pp_atomfwctrl_get_voltage_info_table(hwmgr);101const union atom_voltage_object_v4 *voltage_object;102unsigned int i;103int result = 0;104105PP_ASSERT_WITH_CODE(voltage_info,106"Could not find Voltage Table in BIOS.",107return -1);108109voltage_object = pp_atomfwctrl_lookup_voltage_type_v4(voltage_info,110voltage_type, voltage_mode);111112if (!voltage_object)113return -1;114115voltage_table->count = 0;116if (voltage_mode == VOLTAGE_OBJ_GPIO_LUT) {117PP_ASSERT_WITH_CODE(118(voltage_object->gpio_voltage_obj.gpio_entry_num <=119PP_ATOMFWCTRL_MAX_VOLTAGE_ENTRIES),120"Too many voltage entries!",121result = -1);122123if (!result) {124for (i = 0; i < voltage_object->gpio_voltage_obj.125gpio_entry_num; i++) {126voltage_table->entries[i].value =127le16_to_cpu(voltage_object->gpio_voltage_obj.128voltage_gpio_lut[i].voltage_level_mv);129voltage_table->entries[i].smio_low =130le32_to_cpu(voltage_object->gpio_voltage_obj.131voltage_gpio_lut[i].voltage_gpio_reg_val);132}133voltage_table->count =134voltage_object->gpio_voltage_obj.gpio_entry_num;135voltage_table->mask_low =136le32_to_cpu(137voltage_object->gpio_voltage_obj.gpio_mask_val);138voltage_table->phase_delay =139voltage_object->gpio_voltage_obj.phase_delay_us;140}141} else if (voltage_mode == VOLTAGE_OBJ_SVID2) {142voltage_table->psi1_enable =143(voltage_object->svid2_voltage_obj.loadline_psi1 & 0x20) >> 5;144voltage_table->psi0_enable =145voltage_object->svid2_voltage_obj.psi0_enable & 0x1;146voltage_table->max_vid_step =147voltage_object->svid2_voltage_obj.maxvstep;148voltage_table->telemetry_offset =149voltage_object->svid2_voltage_obj.telemetry_offset;150voltage_table->telemetry_slope =151voltage_object->svid2_voltage_obj.telemetry_gain;152} else153PP_ASSERT_WITH_CODE(false,154"Unsupported Voltage Object Mode!",155result = -1);156157return result;158}159160/** pp_atomfwctrl_get_gpu_pll_dividers_vega10().161*162* @param hwmgr input parameter: pointer to HwMgr163* @param clock_type input parameter: Clock type: 1 - GFXCLK, 2 - UCLK, 0 - All other clocks164* @param clock_value input parameter: Clock165* @param dividers output parameter:Clock dividers166*/167int pp_atomfwctrl_get_gpu_pll_dividers_vega10(struct pp_hwmgr *hwmgr,168uint32_t clock_type, uint32_t clock_value,169struct pp_atomfwctrl_clock_dividers_soc15 *dividers)170{171struct amdgpu_device *adev = hwmgr->adev;172struct compute_gpu_clock_input_parameter_v1_8 pll_parameters;173struct compute_gpu_clock_output_parameter_v1_8 *pll_output;174uint32_t idx;175176pll_parameters.gpuclock_10khz = (uint32_t)clock_value;177pll_parameters.gpu_clock_type = clock_type;178179idx = GetIndexIntoMasterCmdTable(computegpuclockparam);180181if (amdgpu_atom_execute_table(182adev->mode_info.atom_context, idx, (uint32_t *)&pll_parameters, sizeof(pll_parameters)))183return -EINVAL;184185pll_output = (struct compute_gpu_clock_output_parameter_v1_8 *)186&pll_parameters;187dividers->ulClock = le32_to_cpu(pll_output->gpuclock_10khz);188dividers->ulDid = le32_to_cpu(pll_output->dfs_did);189dividers->ulPll_fb_mult = le32_to_cpu(pll_output->pll_fb_mult);190dividers->ulPll_ss_fbsmult = le32_to_cpu(pll_output->pll_ss_fbsmult);191dividers->usPll_ss_slew_frac = le16_to_cpu(pll_output->pll_ss_slew_frac);192dividers->ucPll_ss_enable = pll_output->pll_ss_enable;193194return 0;195}196197int pp_atomfwctrl_get_avfs_information(struct pp_hwmgr *hwmgr,198struct pp_atomfwctrl_avfs_parameters *param)199{200uint16_t idx;201uint8_t format_revision, content_revision;202203struct atom_asic_profiling_info_v4_1 *profile;204struct atom_asic_profiling_info_v4_2 *profile_v4_2;205206idx = GetIndexIntoMasterDataTable(asic_profiling_info);207profile = (struct atom_asic_profiling_info_v4_1 *)208smu_atom_get_data_table(hwmgr->adev,209idx, NULL, NULL, NULL);210211if (!profile)212return -1;213214format_revision = ((struct atom_common_table_header *)profile)->format_revision;215content_revision = ((struct atom_common_table_header *)profile)->content_revision;216217if (format_revision == 4 && content_revision == 1) {218param->ulMaxVddc = le32_to_cpu(profile->maxvddc);219param->ulMinVddc = le32_to_cpu(profile->minvddc);220param->ulMeanNsigmaAcontant0 =221le32_to_cpu(profile->avfs_meannsigma_acontant0);222param->ulMeanNsigmaAcontant1 =223le32_to_cpu(profile->avfs_meannsigma_acontant1);224param->ulMeanNsigmaAcontant2 =225le32_to_cpu(profile->avfs_meannsigma_acontant2);226param->usMeanNsigmaDcTolSigma =227le16_to_cpu(profile->avfs_meannsigma_dc_tol_sigma);228param->usMeanNsigmaPlatformMean =229le16_to_cpu(profile->avfs_meannsigma_platform_mean);230param->usMeanNsigmaPlatformSigma =231le16_to_cpu(profile->avfs_meannsigma_platform_sigma);232param->ulGbVdroopTableCksoffA0 =233le32_to_cpu(profile->gb_vdroop_table_cksoff_a0);234param->ulGbVdroopTableCksoffA1 =235le32_to_cpu(profile->gb_vdroop_table_cksoff_a1);236param->ulGbVdroopTableCksoffA2 =237le32_to_cpu(profile->gb_vdroop_table_cksoff_a2);238param->ulGbVdroopTableCksonA0 =239le32_to_cpu(profile->gb_vdroop_table_ckson_a0);240param->ulGbVdroopTableCksonA1 =241le32_to_cpu(profile->gb_vdroop_table_ckson_a1);242param->ulGbVdroopTableCksonA2 =243le32_to_cpu(profile->gb_vdroop_table_ckson_a2);244param->ulGbFuseTableCksoffM1 =245le32_to_cpu(profile->avfsgb_fuse_table_cksoff_m1);246param->ulGbFuseTableCksoffM2 =247le32_to_cpu(profile->avfsgb_fuse_table_cksoff_m2);248param->ulGbFuseTableCksoffB =249le32_to_cpu(profile->avfsgb_fuse_table_cksoff_b);250param->ulGbFuseTableCksonM1 =251le32_to_cpu(profile->avfsgb_fuse_table_ckson_m1);252param->ulGbFuseTableCksonM2 =253le32_to_cpu(profile->avfsgb_fuse_table_ckson_m2);254param->ulGbFuseTableCksonB =255le32_to_cpu(profile->avfsgb_fuse_table_ckson_b);256257param->ucEnableGbVdroopTableCkson =258profile->enable_gb_vdroop_table_ckson;259param->ucEnableGbFuseTableCkson =260profile->enable_gb_fuse_table_ckson;261param->usPsmAgeComfactor =262le16_to_cpu(profile->psm_age_comfactor);263264param->ulDispclk2GfxclkM1 =265le32_to_cpu(profile->dispclk2gfxclk_a);266param->ulDispclk2GfxclkM2 =267le32_to_cpu(profile->dispclk2gfxclk_b);268param->ulDispclk2GfxclkB =269le32_to_cpu(profile->dispclk2gfxclk_c);270param->ulDcefclk2GfxclkM1 =271le32_to_cpu(profile->dcefclk2gfxclk_a);272param->ulDcefclk2GfxclkM2 =273le32_to_cpu(profile->dcefclk2gfxclk_b);274param->ulDcefclk2GfxclkB =275le32_to_cpu(profile->dcefclk2gfxclk_c);276param->ulPixelclk2GfxclkM1 =277le32_to_cpu(profile->pixclk2gfxclk_a);278param->ulPixelclk2GfxclkM2 =279le32_to_cpu(profile->pixclk2gfxclk_b);280param->ulPixelclk2GfxclkB =281le32_to_cpu(profile->pixclk2gfxclk_c);282param->ulPhyclk2GfxclkM1 =283le32_to_cpu(profile->phyclk2gfxclk_a);284param->ulPhyclk2GfxclkM2 =285le32_to_cpu(profile->phyclk2gfxclk_b);286param->ulPhyclk2GfxclkB =287le32_to_cpu(profile->phyclk2gfxclk_c);288param->ulAcgGbVdroopTableA0 = 0;289param->ulAcgGbVdroopTableA1 = 0;290param->ulAcgGbVdroopTableA2 = 0;291param->ulAcgGbFuseTableM1 = 0;292param->ulAcgGbFuseTableM2 = 0;293param->ulAcgGbFuseTableB = 0;294param->ucAcgEnableGbVdroopTable = 0;295param->ucAcgEnableGbFuseTable = 0;296} else if (format_revision == 4 && content_revision == 2) {297profile_v4_2 = (struct atom_asic_profiling_info_v4_2 *)profile;298param->ulMaxVddc = le32_to_cpu(profile_v4_2->maxvddc);299param->ulMinVddc = le32_to_cpu(profile_v4_2->minvddc);300param->ulMeanNsigmaAcontant0 =301le32_to_cpu(profile_v4_2->avfs_meannsigma_acontant0);302param->ulMeanNsigmaAcontant1 =303le32_to_cpu(profile_v4_2->avfs_meannsigma_acontant1);304param->ulMeanNsigmaAcontant2 =305le32_to_cpu(profile_v4_2->avfs_meannsigma_acontant2);306param->usMeanNsigmaDcTolSigma =307le16_to_cpu(profile_v4_2->avfs_meannsigma_dc_tol_sigma);308param->usMeanNsigmaPlatformMean =309le16_to_cpu(profile_v4_2->avfs_meannsigma_platform_mean);310param->usMeanNsigmaPlatformSigma =311le16_to_cpu(profile_v4_2->avfs_meannsigma_platform_sigma);312param->ulGbVdroopTableCksoffA0 =313le32_to_cpu(profile_v4_2->gb_vdroop_table_cksoff_a0);314param->ulGbVdroopTableCksoffA1 =315le32_to_cpu(profile_v4_2->gb_vdroop_table_cksoff_a1);316param->ulGbVdroopTableCksoffA2 =317le32_to_cpu(profile_v4_2->gb_vdroop_table_cksoff_a2);318param->ulGbVdroopTableCksonA0 =319le32_to_cpu(profile_v4_2->gb_vdroop_table_ckson_a0);320param->ulGbVdroopTableCksonA1 =321le32_to_cpu(profile_v4_2->gb_vdroop_table_ckson_a1);322param->ulGbVdroopTableCksonA2 =323le32_to_cpu(profile_v4_2->gb_vdroop_table_ckson_a2);324param->ulGbFuseTableCksoffM1 =325le32_to_cpu(profile_v4_2->avfsgb_fuse_table_cksoff_m1);326param->ulGbFuseTableCksoffM2 =327le32_to_cpu(profile_v4_2->avfsgb_fuse_table_cksoff_m2);328param->ulGbFuseTableCksoffB =329le32_to_cpu(profile_v4_2->avfsgb_fuse_table_cksoff_b);330param->ulGbFuseTableCksonM1 =331le32_to_cpu(profile_v4_2->avfsgb_fuse_table_ckson_m1);332param->ulGbFuseTableCksonM2 =333le32_to_cpu(profile_v4_2->avfsgb_fuse_table_ckson_m2);334param->ulGbFuseTableCksonB =335le32_to_cpu(profile_v4_2->avfsgb_fuse_table_ckson_b);336337param->ucEnableGbVdroopTableCkson =338profile_v4_2->enable_gb_vdroop_table_ckson;339param->ucEnableGbFuseTableCkson =340profile_v4_2->enable_gb_fuse_table_ckson;341param->usPsmAgeComfactor =342le16_to_cpu(profile_v4_2->psm_age_comfactor);343344param->ulDispclk2GfxclkM1 =345le32_to_cpu(profile_v4_2->dispclk2gfxclk_a);346param->ulDispclk2GfxclkM2 =347le32_to_cpu(profile_v4_2->dispclk2gfxclk_b);348param->ulDispclk2GfxclkB =349le32_to_cpu(profile_v4_2->dispclk2gfxclk_c);350param->ulDcefclk2GfxclkM1 =351le32_to_cpu(profile_v4_2->dcefclk2gfxclk_a);352param->ulDcefclk2GfxclkM2 =353le32_to_cpu(profile_v4_2->dcefclk2gfxclk_b);354param->ulDcefclk2GfxclkB =355le32_to_cpu(profile_v4_2->dcefclk2gfxclk_c);356param->ulPixelclk2GfxclkM1 =357le32_to_cpu(profile_v4_2->pixclk2gfxclk_a);358param->ulPixelclk2GfxclkM2 =359le32_to_cpu(profile_v4_2->pixclk2gfxclk_b);360param->ulPixelclk2GfxclkB =361le32_to_cpu(profile_v4_2->pixclk2gfxclk_c);362param->ulPhyclk2GfxclkM1 =363le32_to_cpu(profile->phyclk2gfxclk_a);364param->ulPhyclk2GfxclkM2 =365le32_to_cpu(profile_v4_2->phyclk2gfxclk_b);366param->ulPhyclk2GfxclkB =367le32_to_cpu(profile_v4_2->phyclk2gfxclk_c);368param->ulAcgGbVdroopTableA0 = le32_to_cpu(profile_v4_2->acg_gb_vdroop_table_a0);369param->ulAcgGbVdroopTableA1 = le32_to_cpu(profile_v4_2->acg_gb_vdroop_table_a1);370param->ulAcgGbVdroopTableA2 = le32_to_cpu(profile_v4_2->acg_gb_vdroop_table_a2);371param->ulAcgGbFuseTableM1 = le32_to_cpu(profile_v4_2->acg_avfsgb_fuse_table_m1);372param->ulAcgGbFuseTableM2 = le32_to_cpu(profile_v4_2->acg_avfsgb_fuse_table_m2);373param->ulAcgGbFuseTableB = le32_to_cpu(profile_v4_2->acg_avfsgb_fuse_table_b);374param->ucAcgEnableGbVdroopTable = le32_to_cpu(profile_v4_2->enable_acg_gb_vdroop_table);375param->ucAcgEnableGbFuseTable = le32_to_cpu(profile_v4_2->enable_acg_gb_fuse_table);376} else {377pr_info("Invalid VBIOS AVFS ProfilingInfo Revision!\n");378return -EINVAL;379}380381return 0;382}383384int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr *hwmgr,385struct pp_atomfwctrl_gpio_parameters *param)386{387struct atom_smu_info_v3_1 *info;388uint16_t idx;389390idx = GetIndexIntoMasterDataTable(smu_info);391info = (struct atom_smu_info_v3_1 *)392smu_atom_get_data_table(hwmgr->adev,393idx, NULL, NULL, NULL);394395if (!info) {396pr_info("Error retrieving BIOS smu_info Table Address!");397return -1;398}399400param->ucAcDcGpio = info->ac_dc_gpio_bit;401param->ucAcDcPolarity = info->ac_dc_polarity;402param->ucVR0HotGpio = info->vr0hot_gpio_bit;403param->ucVR0HotPolarity = info->vr0hot_polarity;404param->ucVR1HotGpio = info->vr1hot_gpio_bit;405param->ucVR1HotPolarity = info->vr1hot_polarity;406param->ucFwCtfGpio = info->fw_ctf_gpio_bit;407param->ucFwCtfPolarity = info->fw_ctf_polarity;408409return 0;410}411412int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr,413uint8_t clk_id, uint8_t syspll_id,414uint32_t *frequency)415{416struct amdgpu_device *adev = hwmgr->adev;417struct atom_get_smu_clock_info_parameters_v3_1 parameters;418struct atom_get_smu_clock_info_output_parameters_v3_1 *output;419uint32_t ix;420421parameters.clk_id = clk_id;422parameters.syspll_id = syspll_id;423parameters.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;424parameters.dfsdid = 0;425426ix = GetIndexIntoMasterCmdTable(getsmuclockinfo);427428if (amdgpu_atom_execute_table(429adev->mode_info.atom_context, ix, (uint32_t *)¶meters, sizeof(parameters)))430return -EINVAL;431432output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)¶meters;433*frequency = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;434435return 0;436}437438static void pp_atomfwctrl_copy_vbios_bootup_values_3_2(struct pp_hwmgr *hwmgr,439struct pp_atomfwctrl_bios_boot_up_values *boot_values,440struct atom_firmware_info_v3_2 *fw_info)441{442uint32_t frequency = 0;443444boot_values->ulRevision = fw_info->firmware_revision;445boot_values->ulGfxClk = fw_info->bootup_sclk_in10khz;446boot_values->ulUClk = fw_info->bootup_mclk_in10khz;447boot_values->usVddc = fw_info->bootup_vddc_mv;448boot_values->usVddci = fw_info->bootup_vddci_mv;449boot_values->usMvddc = fw_info->bootup_mvddc_mv;450boot_values->usVddGfx = fw_info->bootup_vddgfx_mv;451boot_values->ucCoolingID = fw_info->coolingsolution_id;452boot_values->ulSocClk = 0;453boot_values->ulDCEFClk = 0;454455if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_SOCCLK_ID, SMU11_SYSPLL0_ID, &frequency))456boot_values->ulSocClk = frequency;457458if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_DCEFCLK_ID, SMU11_SYSPLL0_ID, &frequency))459boot_values->ulDCEFClk = frequency;460461if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_ECLK_ID, SMU11_SYSPLL0_ID, &frequency))462boot_values->ulEClk = frequency;463464if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_VCLK_ID, SMU11_SYSPLL0_ID, &frequency))465boot_values->ulVClk = frequency;466467if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_DCLK_ID, SMU11_SYSPLL0_ID, &frequency))468boot_values->ulDClk = frequency;469470if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL1_0_FCLK_ID, SMU11_SYSPLL1_2_ID, &frequency))471boot_values->ulFClk = frequency;472}473474static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr,475struct pp_atomfwctrl_bios_boot_up_values *boot_values,476struct atom_firmware_info_v3_1 *fw_info)477{478uint32_t frequency = 0;479480boot_values->ulRevision = fw_info->firmware_revision;481boot_values->ulGfxClk = fw_info->bootup_sclk_in10khz;482boot_values->ulUClk = fw_info->bootup_mclk_in10khz;483boot_values->usVddc = fw_info->bootup_vddc_mv;484boot_values->usVddci = fw_info->bootup_vddci_mv;485boot_values->usMvddc = fw_info->bootup_mvddc_mv;486boot_values->usVddGfx = fw_info->bootup_vddgfx_mv;487boot_values->ucCoolingID = fw_info->coolingsolution_id;488boot_values->ulSocClk = 0;489boot_values->ulDCEFClk = 0;490491if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_SOCCLK_ID, 0, &frequency))492boot_values->ulSocClk = frequency;493494if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_DCEFCLK_ID, 0, &frequency))495boot_values->ulDCEFClk = frequency;496497if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_ECLK_ID, 0, &frequency))498boot_values->ulEClk = frequency;499500if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_VCLK_ID, 0, &frequency))501boot_values->ulVClk = frequency;502503if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_DCLK_ID, 0, &frequency))504boot_values->ulDClk = frequency;505}506507int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr *hwmgr,508struct pp_atomfwctrl_bios_boot_up_values *boot_values)509{510struct atom_firmware_info_v3_2 *fwinfo_3_2;511struct atom_firmware_info_v3_1 *fwinfo_3_1;512struct atom_common_table_header *info = NULL;513uint16_t ix;514515ix = GetIndexIntoMasterDataTable(firmwareinfo);516info = (struct atom_common_table_header *)517smu_atom_get_data_table(hwmgr->adev,518ix, NULL, NULL, NULL);519520if (!info) {521pr_info("Error retrieving BIOS firmwareinfo!");522return -EINVAL;523}524525if ((info->format_revision == 3) && (info->content_revision == 2)) {526fwinfo_3_2 = (struct atom_firmware_info_v3_2 *)info;527pp_atomfwctrl_copy_vbios_bootup_values_3_2(hwmgr,528boot_values, fwinfo_3_2);529} else if ((info->format_revision == 3) && (info->content_revision == 1)) {530fwinfo_3_1 = (struct atom_firmware_info_v3_1 *)info;531pp_atomfwctrl_copy_vbios_bootup_values_3_1(hwmgr,532boot_values, fwinfo_3_1);533} else {534pr_info("Fw info table revision does not match!");535return -EINVAL;536}537538return 0;539}540541int pp_atomfwctrl_get_smc_dpm_information(struct pp_hwmgr *hwmgr,542struct pp_atomfwctrl_smc_dpm_parameters *param)543{544struct atom_smc_dpm_info_v4_1 *info;545uint16_t ix;546547ix = GetIndexIntoMasterDataTable(smc_dpm_info);548info = (struct atom_smc_dpm_info_v4_1 *)549smu_atom_get_data_table(hwmgr->adev,550ix, NULL, NULL, NULL);551if (!info) {552pr_info("Error retrieving BIOS Table Address!");553return -EINVAL;554}555556param->liquid1_i2c_address = info->liquid1_i2c_address;557param->liquid2_i2c_address = info->liquid2_i2c_address;558param->vr_i2c_address = info->vr_i2c_address;559param->plx_i2c_address = info->plx_i2c_address;560561param->liquid_i2c_linescl = info->liquid_i2c_linescl;562param->liquid_i2c_linesda = info->liquid_i2c_linesda;563param->vr_i2c_linescl = info->vr_i2c_linescl;564param->vr_i2c_linesda = info->vr_i2c_linesda;565566param->plx_i2c_linescl = info->plx_i2c_linescl;567param->plx_i2c_linesda = info->plx_i2c_linesda;568param->vrsensorpresent = info->vrsensorpresent;569param->liquidsensorpresent = info->liquidsensorpresent;570571param->maxvoltagestepgfx = info->maxvoltagestepgfx;572param->maxvoltagestepsoc = info->maxvoltagestepsoc;573574param->vddgfxvrmapping = info->vddgfxvrmapping;575param->vddsocvrmapping = info->vddsocvrmapping;576param->vddmem0vrmapping = info->vddmem0vrmapping;577param->vddmem1vrmapping = info->vddmem1vrmapping;578579param->gfxulvphasesheddingmask = info->gfxulvphasesheddingmask;580param->soculvphasesheddingmask = info->soculvphasesheddingmask;581582param->gfxmaxcurrent = info->gfxmaxcurrent;583param->gfxoffset = info->gfxoffset;584param->padding_telemetrygfx = info->padding_telemetrygfx;585586param->socmaxcurrent = info->socmaxcurrent;587param->socoffset = info->socoffset;588param->padding_telemetrysoc = info->padding_telemetrysoc;589590param->mem0maxcurrent = info->mem0maxcurrent;591param->mem0offset = info->mem0offset;592param->padding_telemetrymem0 = info->padding_telemetrymem0;593594param->mem1maxcurrent = info->mem1maxcurrent;595param->mem1offset = info->mem1offset;596param->padding_telemetrymem1 = info->padding_telemetrymem1;597598param->acdcgpio = info->acdcgpio;599param->acdcpolarity = info->acdcpolarity;600param->vr0hotgpio = info->vr0hotgpio;601param->vr0hotpolarity = info->vr0hotpolarity;602603param->vr1hotgpio = info->vr1hotgpio;604param->vr1hotpolarity = info->vr1hotpolarity;605param->padding1 = info->padding1;606param->padding2 = info->padding2;607608param->ledpin0 = info->ledpin0;609param->ledpin1 = info->ledpin1;610param->ledpin2 = info->ledpin2;611612param->pllgfxclkspreadenabled = info->pllgfxclkspreadenabled;613param->pllgfxclkspreadpercent = info->pllgfxclkspreadpercent;614param->pllgfxclkspreadfreq = info->pllgfxclkspreadfreq;615616param->uclkspreadenabled = info->uclkspreadenabled;617param->uclkspreadpercent = info->uclkspreadpercent;618param->uclkspreadfreq = info->uclkspreadfreq;619620param->socclkspreadenabled = info->socclkspreadenabled;621param->socclkspreadpercent = info->socclkspreadpercent;622param->socclkspreadfreq = info->socclkspreadfreq;623624param->acggfxclkspreadenabled = info->acggfxclkspreadenabled;625param->acggfxclkspreadpercent = info->acggfxclkspreadpercent;626param->acggfxclkspreadfreq = info->acggfxclkspreadfreq;627628param->Vr2_I2C_address = info->Vr2_I2C_address;629630return 0;631}632633634