aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2018-10-09 16:33:16 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-10-10 15:49:43 -0400
commitd97a7ab394800d41eb3b043a5692bfee0634f5c9 (patch)
tree70fc89649c8f662b7dee2a49299e9193b94c09c8 /drivers/gpu
parentde501763304b7cdcc1d8d04ec32ad58f0cb598b1 (diff)
drm/amdgpu/powerplay: endian fixes for vega12_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')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c
index cb3a5b1737c8..3203cd2d2029 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c
@@ -114,7 +114,7 @@ static int copy_clock_limits_array(
114 return -ENOMEM; 114 return -ENOMEM;
115 115
116 for (i = 0; i < ATOM_VEGA12_PPCLOCK_COUNT; i++) 116 for (i = 0; i < ATOM_VEGA12_PPCLOCK_COUNT; i++)
117 table[i] = pptable_array[i]; 117 table[i] = le32_to_cpu(pptable_array[i]);
118 118
119 *pptable_info_array = table; 119 *pptable_info_array = table;
120 120
@@ -136,7 +136,7 @@ static int copy_overdrive_settings_limits_array(
136 return -ENOMEM; 136 return -ENOMEM;
137 137
138 for (i = 0; i < ATOM_VEGA12_ODSETTING_COUNT; i++) 138 for (i = 0; i < ATOM_VEGA12_ODSETTING_COUNT; i++)
139 table[i] = pptable_array[i]; 139 table[i] = le32_to_cpu(pptable_array[i]);
140 140
141 *pptable_info_array = table; 141 *pptable_info_array = table;
142 142
@@ -250,11 +250,13 @@ static int init_powerplay_table_information(
250 250
251 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl); 251 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
252 252
253 if (powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_GFXCLKFMAX] > VEGA12_ENGINECLOCK_HARDMAX) 253 if (le32_to_cpu(powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_GFXCLKFMAX]) > VEGA12_ENGINECLOCK_HARDMAX)
254 hwmgr->platform_descriptor.overdriveLimit.engineClock = VEGA12_ENGINECLOCK_HARDMAX; 254 hwmgr->platform_descriptor.overdriveLimit.engineClock = VEGA12_ENGINECLOCK_HARDMAX;
255 else 255 else
256 hwmgr->platform_descriptor.overdriveLimit.engineClock = powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_GFXCLKFMAX]; 256 hwmgr->platform_descriptor.overdriveLimit.engineClock =
257 hwmgr->platform_descriptor.overdriveLimit.memoryClock = powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_UCLKFMAX]; 257 le32_to_cpu(powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_GFXCLKFMAX]);
258 hwmgr->platform_descriptor.overdriveLimit.memoryClock =
259 le32_to_cpu(powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_UCLKFMAX]);
258 260
259 copy_overdrive_settings_limits_array(hwmgr, &pptable_information->od_settings_max, powerplay_table->ODSettingsMax); 261 copy_overdrive_settings_limits_array(hwmgr, &pptable_information->od_settings_max, powerplay_table->ODSettingsMax);
260 copy_overdrive_settings_limits_array(hwmgr, &pptable_information->od_settings_min, powerplay_table->ODSettingsMin); 262 copy_overdrive_settings_limits_array(hwmgr, &pptable_information->od_settings_min, powerplay_table->ODSettingsMin);
@@ -267,15 +269,15 @@ static int init_powerplay_table_information(
267 && hwmgr->platform_descriptor.overdriveLimit.memoryClock > 0) 269 && hwmgr->platform_descriptor.overdriveLimit.memoryClock > 0)
268 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_ACOverdriveSupport); 270 phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_ACOverdriveSupport);
269 271
270 pptable_information->us_small_power_limit1 = powerplay_table->usSmallPowerLimit1; 272 pptable_information->us_small_power_limit1 = le16_to_cpu(powerplay_table->usSmallPowerLimit1);
271 pptable_information->us_small_power_limit2 = powerplay_table->usSmallPowerLimit2; 273 pptable_information->us_small_power_limit2 = le16_to_cpu(powerplay_table->usSmallPowerLimit2);
272 pptable_information->us_boost_power_limit = powerplay_table->usBoostPowerLimit; 274 pptable_information->us_boost_power_limit = le16_to_cpu(powerplay_table->usBoostPowerLimit);
273 pptable_information->us_od_turbo_power_limit = powerplay_table->usODTurboPowerLimit; 275 pptable_information->us_od_turbo_power_limit = le16_to_cpu(powerplay_table->usODTurboPowerLimit);
274 pptable_information->us_od_powersave_power_limit = powerplay_table->usODPowerSavePowerLimit; 276 pptable_information->us_od_powersave_power_limit = le16_to_cpu(powerplay_table->usODPowerSavePowerLimit);
275 277
276 pptable_information->us_software_shutdown_temp = powerplay_table->usSoftwareShutdownTemp; 278 pptable_information->us_software_shutdown_temp = le16_to_cpu(powerplay_table->usSoftwareShutdownTemp);
277 279
278 hwmgr->platform_descriptor.TDPODLimit = (uint16_t)powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_POWERPERCENTAGE]; 280 hwmgr->platform_descriptor.TDPODLimit = le32_to_cpu(powerplay_table->ODSettingsMax[ATOM_VEGA12_ODSETTING_POWERPERCENTAGE]);
279 281
280 disable_power_control = 0; 282 disable_power_control = 0;
281 if (!disable_power_control) { 283 if (!disable_power_control) {