aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2018-10-09 16:50:38 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-10-10 15:49:44 -0400
commit99e219521da5c1bfa9f36ca4fae3fe1a3718cf24 (patch)
treebb2ec0d74a0ddc60b4deb4d16aa053965b91a53f /drivers/gpu/drm/amd
parentd97a7ab394800d41eb3b043a5692bfee0634f5c9 (diff)
drm/amdgpu/powerplay: endian fixes for vega20_processpptables.c
Properly swap data from vbios. Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
index c9b93e6487e4..956aa6aff28d 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
@@ -676,7 +676,7 @@ static int copy_clock_limits_array(
676 return -ENOMEM; 676 return -ENOMEM;
677 677
678 for (i = 0; i < power_saving_clock_count; i++) 678 for (i = 0; i < power_saving_clock_count; i++)
679 table[i] = pptable_array[i]; 679 table[i] = le32_to_cpu(pptable_array[i]);
680 680
681 *pptable_info_array = table; 681 *pptable_info_array = table;
682 682
@@ -698,7 +698,7 @@ static int copy_overdrive_settings_limits_array(
698 return -ENOMEM; 698 return -ENOMEM;
699 699
700 for (i = 0; i < od_setting_count; i++) 700 for (i = 0; i < od_setting_count; i++)
701 table[i] = pptable_array[i]; 701 table[i] = le32_to_cpu(pptable_array[i]);
702 702
703 *pptable_info_array = table; 703 *pptable_info_array = table;
704 704
@@ -721,7 +721,7 @@ static int copy_overdrive_feature_capabilities_array(
721 return -ENOMEM; 721 return -ENOMEM;
722 722
723 for (i = 0; i < od_feature_count; i++) { 723 for (i = 0; i < od_feature_count; i++) {
724 table[i] = pptable_array[i]; 724 table[i] = le32_to_cpu(pptable_array[i]);
725 if (table[i]) 725 if (table[i])
726 od_supported = true; 726 od_supported = true;
727 } 727 }
@@ -844,10 +844,16 @@ static int init_powerplay_table_information(
844 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl); 844 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
845 845
846 if (powerplay_table->OverDrive8Table.ucODTableRevision == 1) { 846 if (powerplay_table->OverDrive8Table.ucODTableRevision == 1) {
847 od_feature_count = (powerplay_table->OverDrive8Table.ODFeatureCount > ATOM_VEGA20_ODFEATURE_COUNT) ? 847 od_feature_count =
848 ATOM_VEGA20_ODFEATURE_COUNT : powerplay_table->OverDrive8Table.ODFeatureCount; 848 (le32_to_cpu(powerplay_table->OverDrive8Table.ODFeatureCount) >
849 od_setting_count = (powerplay_table->OverDrive8Table.ODSettingCount > ATOM_VEGA20_ODSETTING_COUNT) ? 849 ATOM_VEGA20_ODFEATURE_COUNT) ?
850 ATOM_VEGA20_ODSETTING_COUNT : powerplay_table->OverDrive8Table.ODSettingCount; 850 ATOM_VEGA20_ODFEATURE_COUNT :
851 le32_to_cpu(powerplay_table->OverDrive8Table.ODFeatureCount);
852 od_setting_count =
853 (le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingCount) >
854 ATOM_VEGA20_ODSETTING_COUNT) ?
855 ATOM_VEGA20_ODSETTING_COUNT :
856 le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingCount);
851 857
852 copy_overdrive_feature_capabilities_array(hwmgr, 858 copy_overdrive_feature_capabilities_array(hwmgr,
853 &pptable_information->od_feature_capabilities, 859 &pptable_information->od_feature_capabilities,
@@ -863,15 +869,15 @@ static int init_powerplay_table_information(
863 od_setting_count); 869 od_setting_count);
864 } 870 }
865 871
866 pptable_information->us_small_power_limit1 = powerplay_table->usSmallPowerLimit1; 872 pptable_information->us_small_power_limit1 = le16_to_cpu(powerplay_table->usSmallPowerLimit1);
867 pptable_information->us_small_power_limit2 = powerplay_table->usSmallPowerLimit2; 873 pptable_information->us_small_power_limit2 = le16_to_cpu(powerplay_table->usSmallPowerLimit2);
868 pptable_information->us_boost_power_limit = powerplay_table->usBoostPowerLimit; 874 pptable_information->us_boost_power_limit = le16_to_cpu(powerplay_table->usBoostPowerLimit);
869 pptable_information->us_od_turbo_power_limit = powerplay_table->usODTurboPowerLimit; 875 pptable_information->us_od_turbo_power_limit = le16_to_cpu(powerplay_table->usODTurboPowerLimit);
870 pptable_information->us_od_powersave_power_limit = powerplay_table->usODPowerSavePowerLimit; 876 pptable_information->us_od_powersave_power_limit = le16_to_cpu(powerplay_table->usODPowerSavePowerLimit);
871 877
872 pptable_information->us_software_shutdown_temp = powerplay_table->usSoftwareShutdownTemp; 878 pptable_information->us_software_shutdown_temp = le16_to_cpu(powerplay_table->usSoftwareShutdownTemp);
873 879
874 hwmgr->platform_descriptor.TDPODLimit = (uint16_t)powerplay_table->OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE]; 880 hwmgr->platform_descriptor.TDPODLimit = le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE]);
875 881
876 disable_power_control = 0; 882 disable_power_control = 0;
877 if (!disable_power_control && hwmgr->platform_descriptor.TDPODLimit) 883 if (!disable_power_control && hwmgr->platform_descriptor.TDPODLimit)
@@ -879,8 +885,11 @@ static int init_powerplay_table_information(
879 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PowerControl); 885 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PowerControl);
880 886
881 if (powerplay_table->PowerSavingClockTable.ucTableRevision == 1) { 887 if (powerplay_table->PowerSavingClockTable.ucTableRevision == 1) {
882 power_saving_clock_count = (powerplay_table->PowerSavingClockTable.PowerSavingClockCount >= ATOM_VEGA20_PPCLOCK_COUNT) ? 888 power_saving_clock_count =
883 ATOM_VEGA20_PPCLOCK_COUNT : powerplay_table->PowerSavingClockTable.PowerSavingClockCount; 889 (le32_to_cpu(powerplay_table->PowerSavingClockTable.PowerSavingClockCount) >=
890 ATOM_VEGA20_PPCLOCK_COUNT) ?
891 ATOM_VEGA20_PPCLOCK_COUNT :
892 le32_to_cpu(powerplay_table->PowerSavingClockTable.PowerSavingClockCount);
884 copy_clock_limits_array(hwmgr, 893 copy_clock_limits_array(hwmgr,
885 &pptable_information->power_saving_clock_max, 894 &pptable_information->power_saving_clock_max,
886 powerplay_table->PowerSavingClockTable.PowerSavingClockMax, 895 powerplay_table->PowerSavingClockTable.PowerSavingClockMax,