Skip to contentSkip to conversation

drm/amdgpu/pp: endian fixes for process_pptables_v1_0.c

PATCH In review Alex Deucher 3 participants 5 messages Aug 7, 2018 – Aug 8, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu/pp: endian fixes for process_pptables_v1_0.c

Properly swap when reading from the vbios.

---
 .../amd/powerplay/hwmgr/process_pptables_v1_0.c    | 194 ++++++++++-----------
 1 file changed, 97 insertions(+), 97 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +97 -97
index 4e1fd5393845..ae64ff7153d6 100644
@@ -214,23 +214,23 @@ static int get_platform_power_management_table(
 	ptr->ppm_design
 		= atom_ppm_table->ucPpmDesign;
 	ptr->cpu_core_number
-		= atom_ppm_table->usCpuCoreNumber;
+		= le16_to_cpu(atom_ppm_table->usCpuCoreNumber);
 	ptr->platform_tdp
-		= atom_ppm_table->ulPlatformTDP;
+		= le32_to_cpu(atom_ppm_table->ulPlatformTDP);
 	ptr->small_ac_platform_tdp
-		= atom_ppm_table->ulSmallACPlatformTDP;
+		= le32_to_cpu(atom_ppm_table->ulSmallACPlatformTDP);
 	ptr->platform_tdc
-		= atom_ppm_table->ulPlatformTDC;
+		= le32_to_cpu(atom_ppm_table->ulPlatformTDC);
 	ptr->small_ac_platform_tdc
-		= atom_ppm_table->ulSmallACPlatformTDC;
+		= le32_to_cpu(atom_ppm_table->ulSmallACPlatformTDC);
 	ptr->apu_tdp
-		= atom_ppm_table->ulApuTDP;
+		= le32_to_cpu(atom_ppm_table->ulApuTDP);
 	ptr->dgpu_tdp
-		= atom_ppm_table->ulDGpuTDP;
+		= le32_to_cpu(atom_ppm_table->ulDGpuTDP);
 	ptr->dgpu_ulv_power
-		= atom_ppm_table->ulDGpuUlvPower;
+		= le32_to_cpu(atom_ppm_table->ulDGpuUlvPower);
 	ptr->tj_max
-		= atom_ppm_table->ulTjmax;
+		= le32_to_cpu(atom_ppm_table->ulTjmax);
 
 	pp_table_information->ppm_parameter_table = ptr;
 
@@ -355,11 +355,11 @@ static int get_hard_limits(
 	PP_ASSERT_WITH_CODE((0 != limitable->ucNumEntries), "Invalid PowerPlay Table!", return -1);
 
 	/* currently we always take entries[0] parameters */
-	limits->sclk = (uint32_t)limitable->entries[0].ulSCLKLimit;
-	limits->mclk = (uint32_t)limitable->entries[0].ulMCLKLimit;
-	limits->vddc = (uint16_t)limitable->entries[0].usVddcLimit;
-	limits->vddci = (uint16_t)limitable->entries[0].usVddciLimit;
-	limits->vddgfx = (uint16_t)limitable->entries[0].usVddgfxLimit;
+	limits->sclk = le32_to_cpu(limitable->entries[0].ulSCLKLimit);
+	limits->mclk = le32_to_cpu(limitable->entries[0].ulMCLKLimit);
+	limits->vddc = le16_to_cpu(limitable->entries[0].usVddcLimit);
+	limits->vddci = le16_to_cpu(limitable->entries[0].usVddciLimit);
+	limits->vddgfx = le16_to_cpu(limitable->entries[0].usVddgfxLimit);
 
 	return 0;
 }
@@ -396,10 +396,10 @@ static int get_mclk_voltage_dependency_table(
 					ATOM_Tonga_MCLK_Dependency_Record,
 						entries, mclk_dep_table, i);
 		mclk_table_record->vddInd = mclk_dep_record->ucVddcInd;
-		mclk_table_record->vdd_offset = mclk_dep_record->usVddgfxOffset;
-		mclk_table_record->vddci = mclk_dep_record->usVddci;
-		mclk_table_record->mvdd = mclk_dep_record->usMvdd;
-		mclk_table_record->clk = mclk_dep_record->ulMclk;
+		mclk_table_record->vdd_offset = le16_to_cpu(mclk_dep_record->usVddgfxOffset);
+		mclk_table_record->vddci = le16_to_cpu(mclk_dep_record->usVddci);
+		mclk_table_record->mvdd = le16_to_cpu(mclk_dep_record->usMvdd);
+		mclk_table_record->clk = le32_to_cpu(mclk_dep_record->ulMclk);
 	}
 
 	*pp_tonga_mclk_dep_table = mclk_table;
@@ -443,8 +443,8 @@ static int get_sclk_voltage_dependency_table(
 						phm_ppt_v1_clock_voltage_dependency_record,
 						entries, sclk_table, i);
 			sclk_table_record->vddInd = sclk_dep_record->ucVddInd;
-			sclk_table_record->vdd_offset = sclk_dep_record->usVddcOffset;
-			sclk_table_record->clk = sclk_dep_record->ulSclk;
+			sclk_table_record->vdd_offset = le16_to_cpu(sclk_dep_record->usVddcOffset);
+			sclk_table_record->clk = le32_to_cpu(sclk_dep_record->ulSclk);
 			sclk_table_record->cks_enable =
 				(((sclk_dep_record->ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
 			sclk_table_record->cks_voffset = (sclk_dep_record->ucCKSVOffsetandDisable & 0x7F);
@@ -475,12 +475,12 @@ static int get_sclk_voltage_dependency_table(
 						phm_ppt_v1_clock_voltage_dependency_record,
 						entries, sclk_table, i);
 			sclk_table_record->vddInd = sclk_dep_record->ucVddInd;
-			sclk_table_record->vdd_offset = sclk_dep_record->usVddcOffset;
-			sclk_table_record->clk = sclk_dep_record->ulSclk;
+			sclk_table_record->vdd_offset = le16_to_cpu(sclk_dep_record->usVddcOffset);
+			sclk_table_record->clk = le32_to_cpu(sclk_dep_record->ulSclk);
 			sclk_table_record->cks_enable =
 				(((sclk_dep_record->ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
 			sclk_table_record->cks_voffset = (sclk_dep_record->ucCKSVOffsetandDisable & 0x7F);
-			sclk_table_record->sclk_offset = sclk_dep_record->ulSclkOffset;
+			sclk_table_record->sclk_offset = le32_to_cpu(sclk_dep_record->ulSclkOffset);
 		}
 	}
 	*pp_tonga_sclk_dep_table = sclk_table;
@@ -534,7 +534,7 @@ static int get_pcie_table(
 						ATOM_Tonga_PCIE_Record,
 						entries, atom_pcie_table, i);
 			pcie_record->gen_speed = atom_pcie_record->ucPCIEGenSpeed;
-			pcie_record->lane_width = atom_pcie_record->usPCIELaneWidth;
+			pcie_record->lane_width = le16_to_cpu(atom_pcie_record->usPCIELaneWidth);
 		}
 
 		*pp_tonga_pcie_table = pcie_table;
@@ -574,8 +574,8 @@ static int get_pcie_table(
 						ATOM_Polaris10_PCIE_Record,
 						entries, atom_pcie_table, i);
 			pcie_record->gen_speed = atom_pcie_record->ucPCIEGenSpeed;
-			pcie_record->lane_width = atom_pcie_record->usPCIELaneWidth;
-			pcie_record->pcie_sclk = atom_pcie_record->ulPCIE_Sclk;
+			pcie_record->lane_width = le16_to_cpu(atom_pcie_record->usPCIELaneWidth);
+			pcie_record->pcie_sclk = le32_to_cpu(atom_pcie_record->ulPCIE_Sclk);
 		}
 
 		*pp_tonga_pcie_table = pcie_table;
@@ -609,64 +609,64 @@ static int get_cac_tdp_table(
 	if (table->ucRevId < 3) {
 		const ATOM_Tonga_PowerTune_Table *tonga_table =
 			(ATOM_Tonga_PowerTune_Table *)table;
-		tdp_table->usTDP = tonga_table->usTDP;
+		tdp_table->usTDP = le16_to_cpu(tonga_table->usTDP);
 		tdp_table->usConfigurableTDP =
-			tonga_table->usConfigurableTDP;
-		tdp_table->usTDC = tonga_table->usTDC;
+			le16_to_cpu(tonga_table->usConfigurableTDP);
+		tdp_table->usTDC = le16_to_cpu(tonga_table->usTDC);
 		tdp_table->usBatteryPowerLimit =
-			tonga_table->usBatteryPowerLimit;
+			le16_to_cpu(tonga_table->usBatteryPowerLimit);
 		tdp_table->usSmallPowerLimit =
-			tonga_table->usSmallPowerLimit;
+			le16_to_cpu(tonga_table->usSmallPowerLimit);
 		tdp_table->usLowCACLeakage =
-			tonga_table->usLowCACLeakage;
+			le16_to_cpu(tonga_table->usLowCACLeakage);
 		tdp_table->usHighCACLeakage =
-			tonga_table->usHighCACLeakage;
+			le16_to_cpu(tonga_table->usHighCACLeakage);
 		tdp_table->usMaximumPowerDeliveryLimit =
-			tonga_table->usMaximumPowerDeliveryLimit;
+			le16_to_cpu(tonga_table->usMaximumPowerDeliveryLimit);
 		tdp_table->usDefaultTargetOperatingTemp =
-			tonga_table->usTjMax;
+			le16_to_cpu(tonga_table->usTjMax);
 		tdp_table->usTargetOperatingTemp =
-			tonga_table->usTjMax; /*Set the initial temp to the same as default */
+			le16_to_cpu(tonga_table->usTjMax); /*Set the initial temp to the same as default */
 		tdp_table->usPowerTuneDataSetID =
-			tonga_table->usPowerTuneDataSetID;
+			le16_to_cpu(tonga_table->usPowerTuneDataSetID);
 		tdp_table->usSoftwareShutdownTemp =
-			tonga_table->usSoftwareShutdownTemp;
+			le16_to_cpu(tonga_table->usSoftwareShutdownTemp);
 		tdp_table->usClockStretchAmount =
-			tonga_table->usClockStretchAmount;
+			le16_to_cpu(tonga_table->usClockStretchAmount);
 	} else {   /* Fiji and newer */
 		const ATOM_Fiji_PowerTune_Table *fijitable =
 			(ATOM_Fiji_PowerTune_Table *)table;
-		tdp_table->usTDP = fijitable->usTDP;
-		tdp_table->usConfigurableTDP = fijitable->usConfigurableTDP;
-		tdp_table->usTDC = fijitable->usTDC;
-		tdp_table->usBatteryPowerLimit = fijitable->usBatteryPowerLimit;
-		tdp_table->usSmallPowerLimit = fijitable->usSmallPowerLimit;
-		tdp_table->usLowCACLeakage = fijitable->usLowCACLeakage;
-		tdp_table->usHighCACLeakage = fijitable->usHighCACLeakage;
+		tdp_table->usTDP = le16_to_cpu(fijitable->usTDP);
+		tdp_table->usConfigurableTDP = le16_to_cpu(fijitable->usConfigurableTDP);
+		tdp_table->usTDC = le16_to_cpu(fijitable->usTDC);
+		tdp_table->usBatteryPowerLimit = le16_to_cpu(fijitable->usBatteryPowerLimit);
+		tdp_table->usSmallPowerLimit = le16_to_cpu(fijitable->usSmallPowerLimit);
+		tdp_table->usLowCACLeakage = le16_to_cpu(fijitable->usLowCACLeakage);
+		tdp_table->usHighCACLeakage = le16_to_cpu(fijitable->usHighCACLeakage);
 		tdp_table->usMaximumPowerDeliveryLimit =
-			fijitable->usMaximumPowerDeliveryLimit;
+			le16_to_cpu(fijitable->usMaximumPowerDeliveryLimit);
 		tdp_table->usDefaultTargetOperatingTemp =
-			fijitable->usTjMax;
+			le16_to_cpu(fijitable->usTjMax);
 		tdp_table->usTargetOperatingTemp =
-			fijitable->usTjMax; /*Set the initial temp to the same as default */
+			le16_to_cpu(fijitable->usTjMax); /*Set the initial temp to the same as default */
 		tdp_table->usPowerTuneDataSetID =
-			fijitable->usPowerTuneDataSetID;
+			le16_to_cpu(fijitable->usPowerTuneDataSetID);
 		tdp_table->usSoftwareShutdownTemp =
-			fijitable->usSoftwareShutdownTemp;
+			le16_to_cpu(fijitable->usSoftwareShutdownTemp);
 		tdp_table->usClockStretchAmount =
-			fijitable->usClockStretchAmount;
+			le16_to_cpu(fijitable->usClockStretchAmount);
 		tdp_table->usTemperatureLimitHotspot =
-			fijitable->usTemperatureLimitHotspot;
+			le16_to_cpu(fijitable->usTemperatureLimitHotspot);
 		tdp_table->usTemperatureLimitLiquid1 =
-			fijitable->usTemperatureLimitLiquid1;
+			le16_to_cpu(fijitable->usTemperatureLimitLiquid1);
 		tdp_table->usTemperatureLimitLiquid2 =
-			fijitable->usTemperatureLimitLiquid2;
+			le16_to_cpu(fijitable->usTemperatureLimitLiquid2);
 		tdp_table->usTemperatureLimitVrVddc =
-			fijitable->usTemperatureLimitVrVddc;
+			le16_to_cpu(fijitable->usTemperatureLimitVrVddc);
 		tdp_table->usTemperatureLimitVrMvdd =
-			fijitable->usTemperatureLimitVrMvdd;
+			le16_to_cpu(fijitable->usTemperatureLimitVrMvdd);
 		tdp_table->usTemperatureLimitPlx =
-			fijitable->usTemperatureLimitPlx;
+			le16_to_cpu(fijitable->usTemperatureLimitPlx);
 		tdp_table->ucLiquid1_I2C_address =
 			fijitable->ucLiquid1_I2C_address;
 		tdp_table->ucLiquid2_I2C_address =
@@ -715,12 +715,12 @@ static int get_mm_clock_voltage_table(
 					phm_ppt_v1_mm_clock_voltage_dependency_record,
 					entries, mm_table, i);
 		mm_table_record->vddcInd = mm_dependency_record->ucVddcInd;
-		mm_table_record->vddgfx_offset = mm_dependency_record->usVddgfxOffset;
-		mm_table_record->aclk = mm_dependency_record->ulAClk;
-		mm_table_record->samclock = mm_dependency_record->ulSAMUClk;
-		mm_table_record->eclk = mm_dependency_record->ulEClk;
-		mm_table_record->vclk = mm_dependency_record->ulVClk;
-		mm_table_record->dclk = mm_dependency_record->ulDClk;
+		mm_table_record->vddgfx_offset = le16_to_cpu(mm_dependency_record->usVddgfxOffset);
+		mm_table_record->aclk = le32_to_cpu(mm_dependency_record->ulAClk);
+		mm_table_record->samclock = le32_to_cpu(mm_dependency_record->ulSAMUClk);
+		mm_table_record->eclk = le32_to_cpu(mm_dependency_record->ulEClk);
+		mm_table_record->vclk = le32_to_cpu(mm_dependency_record->ulVClk);
+		mm_table_record->dclk = le32_to_cpu(mm_dependency_record->ulDClk);
 	}
 
 	*tonga_mm_table = mm_table;
@@ -939,33 +939,33 @@ static int init_thermal_controller(
 		hwmgr->thermal_controller.advanceFanControlParameters.ucTHyst
 			= tonga_fan_table->ucTHyst;
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMin
-			= tonga_fan_table->usTMin;
+			= le16_to_cpu(tonga_fan_table->usTMin);
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMed
-			= tonga_fan_table->usTMed;
+			= le16_to_cpu(tonga_fan_table->usTMed);
 		hwmgr->thermal_controller.advanceFanControlParameters.usTHigh
-			= tonga_fan_table->usTHigh;
+			= le16_to_cpu(tonga_fan_table->usTHigh);
 		hwmgr->thermal_controller.advanceFanControlParameters.usPWMMin
-			= tonga_fan_table->usPWMMin;
+			= le16_to_cpu(tonga_fan_table->usPWMMin);
 		hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed
-			= tonga_fan_table->usPWMMed;
+			= le16_to_cpu(tonga_fan_table->usPWMMed);
 		hwmgr->thermal_controller.advanceFanControlParameters.usPWMHigh
-			= tonga_fan_table->usPWMHigh;
+			= le16_to_cpu(tonga_fan_table->usPWMHigh);
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMax
 			= 10900;                  /* hard coded */
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMax
-			= tonga_fan_table->usTMax;
+			= le16_to_cpu(tonga_fan_table->usTMax);
 		hwmgr->thermal_controller.advanceFanControlParameters.ucFanControlMode
 			= tonga_fan_table->ucFanControlMode;
 		hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanPWM
-			= tonga_fan_table->usFanPWMMax;
+			= le16_to_cpu(tonga_fan_table->usFanPWMMax);
 		hwmgr->thermal_controller.advanceFanControlParameters.usDefaultFanOutputSensitivity
 			= 4836;
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity
-			= tonga_fan_table->usFanOutputSensitivity;
+			= le16_to_cpu(tonga_fan_table->usFanOutputSensitivity);
 		hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanRPM
-			= tonga_fan_table->usFanRPMMax;
+			= le16_to_cpu(tonga_fan_table->usFanRPMMax);
 		hwmgr->thermal_controller.advanceFanControlParameters.ulMinFanSCLKAcousticLimit
-			= (tonga_fan_table->ulMinFanSCLKAcousticLimit / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
+			= (le32_to_cpu(tonga_fan_table->ulMinFanSCLKAcousticLimit) / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
 		hwmgr->thermal_controller.advanceFanControlParameters.ucTargetTemperature
 			= tonga_fan_table->ucTargetTemperature;
 		hwmgr->thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit
@@ -976,50 +976,50 @@ static int init_thermal_controller(
 		hwmgr->thermal_controller.advanceFanControlParameters.ucTHyst
 			= fiji_fan_table->ucTHyst;
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMin
-			= fiji_fan_table->usTMin;
+			= le16_to_cpu(fiji_fan_table->usTMin);
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMed
-			= fiji_fan_table->usTMed;
+			= le16_to_cpu(fiji_fan_table->usTMed);
 		hwmgr->thermal_controller.advanceFanControlParameters.usTHigh
-			= fiji_fan_table->usTHigh;
+			= le16_to_cpu(fiji_fan_table->usTHigh);
 		hwmgr->thermal_controller.advanceFanControlParameters.usPWMMin
-			= fiji_fan_table->usPWMMin;
+			= le16_to_cpu(fiji_fan_table->usPWMMin);
 		hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed
-			= fiji_fan_table->usPWMMed;
+			= le16_to_cpu(fiji_fan_table->usPWMMed);
 		hwmgr->thermal_controller.advanceFanControlParameters.usPWMHigh
-			= fiji_fan_table->usPWMHigh;
+			= le16_to_cpu(fiji_fan_table->usPWMHigh);
 		hwmgr->thermal_controller.advanceFanControlParameters.usTMax
-			= fiji_fan_table->usTMax;
+			= le16_to_cpu(fiji_fan_table->usTMax);
 		hwmgr->thermal_controller.advanceFanControlParameters.ucFanControlMode
 			= fiji_fan_table->ucFanControlMode;
 		hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanPWM
-			= fiji_fan_table->usFanPWMMax;
+			= le16_to_cpu(fiji_fan_table->usFanPWMMax);
 		hwmgr->thermal_controller.advanceFanControlParameters.usDefaultFanOutputSensitivity
 			= 4836;
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity
-			= fiji_fan_table->usFanOutputSensitivity;
+			= le16_to_cpu(fiji_fan_table->usFanOutputSensitivity);
 		hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanRPM
-			= fiji_fan_table->usFanRPMMax;
+			= le16_to_cpu(fiji_fan_table->usFanRPMMax);
 		hwmgr->thermal_controller.advanceFanControlParameters.ulMinFanSCLKAcousticLimit
-			= (fiji_fan_table->ulMinFanSCLKAcousticLimit / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
+			= (le32_to_cpu(fiji_fan_table->ulMinFanSCLKAcousticLimit) / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
 		hwmgr->thermal_controller.advanceFanControlParameters.ucTargetTemperature
 			= fiji_fan_table->ucTargetTemperature;
 		hwmgr->thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit
 			= fiji_fan_table->ucMinimumPWMLimit;
 
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainEdge
-			= fiji_fan_table->usFanGainEdge;
+			= le16_to_cpu(fiji_fan_table->usFanGainEdge);
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainHotspot
-			= fiji_fan_table->usFanGainHotspot;
+			= le16_to_cpu(fiji_fan_table->usFanGainHotspot);
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainLiquid
-			= fiji_fan_table->usFanGainLiquid;
+			= le16_to_cpu(fiji_fan_table->usFanGainLiquid);
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainVrVddc
-			= fiji_fan_table->usFanGainVrVddc;
+			= le16_to_cpu(fiji_fan_table->usFanGainVrVddc);
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainVrMvdd
-			= fiji_fan_table->usFanGainVrMvdd;
+			= le16_to_cpu(fiji_fan_table->usFanGainVrMvdd);
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainPlx
-			= fiji_fan_table->usFanGainPlx;
+			= le16_to_cpu(fiji_fan_table->usFanGainPlx);
 		hwmgr->thermal_controller.advanceFanControlParameters.usFanGainHbm
-			= fiji_fan_table->usFanGainHbm;
+			= le16_to_cpu(fiji_fan_table->usFanGainHbm);
 	}
 
 	return 0;
@@ -1256,9 +1256,9 @@ static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i
 					vce_state_record->ucVCEClockIndex);
 	*flag = vce_state_record->ucFlag;
 
-	vce_state->evclk = mm_dep_record->ulEClk;
-	vce_state->ecclk = mm_dep_record->ulEClk;
-	vce_state->sclk = sclk_dep_record->ulSclk;
+	vce_state->evclk = le32_to_cpu(mm_dep_record->ulEClk);
+	vce_state->ecclk = le32_to_cpu(mm_dep_record->ulEClk);
+	vce_state->sclk = le32_to_cpu(sclk_dep_record->ulSclk);
 
 	if (vce_state_record->ucMCLKIndex >= mclk_dep_table->ucNumEntries)
 		mclk_dep_record = GET_FLEXIBLE_ARRAY_MEMBER_ADDR(
@@ -1271,7 +1271,7 @@ static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i
 					entries, mclk_dep_table,
 					vce_state_record->ucMCLKIndex);
 
-	vce_state->mclk = mclk_dep_record->ulMclk;
+	vce_state->mclk = le32_to_cpu(mclk_dep_record->ulMclk);
 	return 0;
 }
 
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180807213137.24704-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu/pp: endian fixes for processpptables.c

Properly swap when reading from the vbios.

---
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +16 -14
index 925e17104f90..77c14671866c 100644
@@ -757,8 +757,8 @@ static int init_non_clock_fields(struct pp_hwmgr *hwmgr,
 	ps->validation.supportedPowerLevels = pnon_clock_info->ucRequiredPower;
 
 	if (ATOM_PPLIB_NONCLOCKINFO_VER1 < version) {
-		ps->uvd_clocks.VCLK = pnon_clock_info->ulVCLK;
-		ps->uvd_clocks.DCLK = pnon_clock_info->ulDCLK;
+		ps->uvd_clocks.VCLK = le32_to_cpu(pnon_clock_info->ulVCLK);
+		ps->uvd_clocks.DCLK = le32_to_cpu(pnon_clock_info->ulDCLK);
 	} else {
 		ps->uvd_clocks.VCLK = 0;
 		ps->uvd_clocks.DCLK = 0;
@@ -937,8 +937,9 @@ int pp_tables_get_entry(struct pp_hwmgr *hwmgr,
 		if (entry_index > powerplay_table->ucNumStates)
 			return -1;
 
-		pstate_entry = (ATOM_PPLIB_STATE *)((unsigned long)powerplay_table + powerplay_table->usStateArrayOffset +
-				entry_index * powerplay_table->ucStateEntrySize);
+		pstate_entry = (ATOM_PPLIB_STATE *)((unsigned long)powerplay_table +
+						    le16_to_cpu(powerplay_table->usStateArrayOffset) +
+						    entry_index * powerplay_table->ucStateEntrySize);
 
 		pnon_clock_info = (ATOM_PPLIB_NONCLOCK_INFO *)((unsigned long)powerplay_table +
 						le16_to_cpu(powerplay_table->usNonClockInfoArrayOffset) +
@@ -1063,13 +1064,13 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,
 			 &size, &frev, &crev);
 
 	if ((fw_info->ucTableFormatRevision == 1)
-		&& (fw_info->usStructureSize >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))
+	    && (le16_to_cpu(fw_info->usStructureSize) >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))
 		result = init_overdrive_limits_V1_4(hwmgr,
 				powerplay_table,
 				(const ATOM_FIRMWARE_INFO_V1_4 *)fw_info);
 
 	else if ((fw_info->ucTableFormatRevision == 2)
-		&& (fw_info->usStructureSize >= sizeof(ATOM_FIRMWARE_INFO_V2_1)))
+		 && (le16_to_cpu(fw_info->usStructureSize) >= sizeof(ATOM_FIRMWARE_INFO_V2_1)))
 		result = init_overdrive_limits_V2_1(hwmgr,
 				powerplay_table,
 				(const ATOM_FIRMWARE_INFO_V2_1 *)fw_info);
@@ -1303,7 +1304,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
 		if (0 != powerplay_table4->usVddcDependencyOnSCLKOffset) {
 			table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4->usVddcDependencyOnSCLKOffset);
+				 le16_to_cpu(powerplay_table4->usVddcDependencyOnSCLKOffset));
 			result = get_clock_voltage_dependency_table(hwmgr,
 				&hwmgr->dyn_state.vddc_dependency_on_sclk, table);
 		}
@@ -1311,7 +1312,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4->usVddciDependencyOnMCLKOffset)) {
 			table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4->usVddciDependencyOnMCLKOffset);
+				 le16_to_cpu(powerplay_table4->usVddciDependencyOnMCLKOffset));
 			result = get_clock_voltage_dependency_table(hwmgr,
 				&hwmgr->dyn_state.vddci_dependency_on_mclk, table);
 		}
@@ -1319,7 +1320,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4->usVddcDependencyOnMCLKOffset)) {
 			table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4->usVddcDependencyOnMCLKOffset);
+				 le16_to_cpu(powerplay_table4->usVddcDependencyOnMCLKOffset));
 			result = get_clock_voltage_dependency_table(hwmgr,
 				&hwmgr->dyn_state.vddc_dependency_on_mclk, table);
 		}
@@ -1327,7 +1328,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4->usMaxClockVoltageOnDCOffset)) {
 			limit_table = (ATOM_PPLIB_Clock_Voltage_Limit_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4->usMaxClockVoltageOnDCOffset);
+				 le16_to_cpu(powerplay_table4->usMaxClockVoltageOnDCOffset));
 			result = get_clock_voltage_limit(hwmgr,
 				&hwmgr->dyn_state.max_clock_voltage_on_dc, limit_table);
 		}
@@ -1346,7 +1347,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4->usMvddDependencyOnMCLKOffset)) {
 			table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4->usMvddDependencyOnMCLKOffset);
+				 le16_to_cpu(powerplay_table4->usMvddDependencyOnMCLKOffset));
 			result = get_clock_voltage_dependency_table(hwmgr,
 				&hwmgr->dyn_state.mvdd_dependency_on_mclk, table);
 		}
@@ -1569,7 +1570,8 @@ static int get_vce_state_table_entry(struct pp_hwmgr *hwmgr,
 
 	const VCEClockInfoArray *vce_clock_info_array = (const VCEClockInfoArray *)(((unsigned long) powerplay_table) + vce_clock_info_array_offset);
 
-	const ClockInfoArray *clock_arrays = (ClockInfoArray *)(((unsigned long)powerplay_table) + powerplay_table->usClockInfoArrayOffset);
+	const ClockInfoArray *clock_arrays = (ClockInfoArray *)(((unsigned long)powerplay_table) +
+								le16_to_cpu(powerplay_table->usClockInfoArrayOffset));
 
 	const ATOM_PPLIB_VCE_State_Record *record = &vce_state_table->entries[i];
 
@@ -1579,8 +1581,8 @@ static int get_vce_state_table_entry(struct pp_hwmgr *hwmgr,
 
 	*flag = (record->ucClockInfoIndex >> NUM_BITS_CLOCK_INFO_ARRAY_INDEX);
 
-	vce_state->evclk = ((uint32_t)vce_clock_info->ucEVClkHigh << 16) | vce_clock_info->usEVClkLow;
-	vce_state->ecclk = ((uint32_t)vce_clock_info->ucECClkHigh << 16) | vce_clock_info->usECClkLow;
+	vce_state->evclk = ((uint32_t)vce_clock_info->ucEVClkHigh << 16) | le16_to_cpu(vce_clock_info->usEVClkLow);
+	vce_state->ecclk = ((uint32_t)vce_clock_info->ucECClkHigh << 16) | le16_to_cpu(vce_clock_info->usECClkLow);
 
 	*clock_info = (void *)((unsigned long)(clock_arrays->clockInfo) + (clockInfoIndex * clock_arrays->ucEntrySize));
 
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180807213137.24704-2-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#4 lore raw

RE: [PATCH 2/2] drm/amdgpu/pp: endian fixes for processpptables.c

Quoted 191 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, August 08, 2018 5:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu/pp: endian fixes for processpptables.c

Properly swap when reading from the vbios.

---
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  | 30
++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +2 -2
index 925e17104f90..77c14671866c 100644
@@ -757,8 +757,8 @@ static int init_non_clock_fields(struct pp_hwmgr
 *hwmgr,
 	ps->validation.supportedPowerLevels = pnon_clock_info-
 >ucRequiredPower;
 
 	if (ATOM_PPLIB_NONCLOCKINFO_VER1 < version) {
-		ps->uvd_clocks.VCLK = pnon_clock_info->ulVCLK;
-		ps->uvd_clocks.DCLK = pnon_clock_info->ulDCLK;
+		ps->uvd_clocks.VCLK = le32_to_cpu(pnon_clock_info-
 >ulVCLK);
+		ps->uvd_clocks.DCLK = le32_to_cpu(pnon_clock_info-
Quoted 1 line

ulDCLK);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 	} else {
 		ps->uvd_clocks.VCLK = 0;
 		ps->uvd_clocks.DCLK = 0;
@@ -937,8 +937,9 @@ int pp_tables_get_entry(struct pp_hwmgr *hwmgr,
 		if (entry_index > powerplay_table->ucNumStates)
 			return -1;
 
-		pstate_entry = (ATOM_PPLIB_STATE *)((unsigned

long)powerplay_table + powerplay_table->usStateArrayOffset +

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
-				entry_index * powerplay_table-
Quoted 1 line

ucStateEntrySize);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+		pstate_entry = (ATOM_PPLIB_STATE *)((unsigned

long)powerplay_table +
+ le16_to_cpu(powerplay_table->usStateArrayOffset) +

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+						    entry_index *

powerplay_table->ucStateEntrySize);

pnon_clock_info = (ATOM_PPLIB_NONCLOCK_INFO
*)((unsigned long)powerplay_table +

	le16_to_cpu(powerplay_table->usNonClockInfoArrayOffset) + @@ -

1063,13 +1064,13 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 			 &size, &frev, &crev);
 
 	if ((fw_info->ucTableFormatRevision == 1)
-		&& (fw_info->usStructureSize >=

sizeof(ATOM_FIRMWARE_INFO_V1_4)))

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +2 -0
+	    && (le16_to_cpu(fw_info->usStructureSize) >=
+sizeof(ATOM_FIRMWARE_INFO_V1_4)))
 		result = init_overdrive_limits_V1_4(hwmgr,
 				powerplay_table,
 				(const ATOM_FIRMWARE_INFO_V1_4

*)fw_info);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 	else if ((fw_info->ucTableFormatRevision == 2)
-		&& (fw_info->usStructureSize >=

sizeof(ATOM_FIRMWARE_INFO_V2_1)))

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +2 -0
+		 && (le16_to_cpu(fw_info->usStructureSize) >=
+sizeof(ATOM_FIRMWARE_INFO_V2_1)))
 		result = init_overdrive_limits_V2_1(hwmgr,
 				powerplay_table,
 				(const ATOM_FIRMWARE_INFO_V2_1

*)fw_info); @@ -1303,7 +1304,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
if (0 != powerplay_table4-

Quoted 1 line

usVddcDependencyOnSCLKOffset) {

table =
(ATOM_PPLIB_Clock_Voltage_Dependency_Table *)

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4-
Quoted 1 line

usVddcDependencyOnSCLKOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+				 le16_to_cpu(powerplay_table4-
Quoted 1 line

usVddcDependencyOnSCLKOffset));

result =
get_clock_voltage_dependency_table(hwmgr,
&hwmgr-

Quoted 1 line

dyn_state.vddc_dependency_on_sclk, table);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 		}
@@ -1311,7 +1312,7 @@ static int init_clock_voltage_dependency(struct
 pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4-
 >usVddciDependencyOnMCLKOffset)) {
 			table =
 (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4-
Quoted 1 line

usVddciDependencyOnMCLKOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+				 le16_to_cpu(powerplay_table4-
Quoted 1 line

usVddciDependencyOnMCLKOffset));

result =
get_clock_voltage_dependency_table(hwmgr,
&hwmgr-

Quoted 1 line

dyn_state.vddci_dependency_on_mclk, table);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 		}
@@ -1319,7 +1320,7 @@ static int init_clock_voltage_dependency(struct
 pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4-
 >usVddcDependencyOnMCLKOffset)) {
 			table =
 (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4-
Quoted 1 line

usVddcDependencyOnMCLKOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+				 le16_to_cpu(powerplay_table4-
Quoted 1 line

usVddcDependencyOnMCLKOffset));

result =
get_clock_voltage_dependency_table(hwmgr,
&hwmgr-

Quoted 1 line

dyn_state.vddc_dependency_on_mclk, table);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 		}
@@ -1327,7 +1328,7 @@ static int init_clock_voltage_dependency(struct
 pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4-
 >usMaxClockVoltageOnDCOffset)) {
 			limit_table =
 (ATOM_PPLIB_Clock_Voltage_Limit_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4-
Quoted 1 line

usMaxClockVoltageOnDCOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+				 le16_to_cpu(powerplay_table4-
Quoted 1 line

usMaxClockVoltageOnDCOffset));

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -0
 			result = get_clock_voltage_limit(hwmgr,
 				&hwmgr-
Quoted 1 line

dyn_state.max_clock_voltage_on_dc, limit_table);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
 		}
@@ -1346,7 +1347,7 @@ static int init_clock_voltage_dependency(struct
 pp_hwmgr *hwmgr,
 		if (result == 0 && (0 != powerplay_table4-
 >usMvddDependencyOnMCLKOffset)) {
 			table =
 (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
 				(((unsigned long) powerplay_table4) +
-				powerplay_table4-
Quoted 1 line

usMvddDependencyOnMCLKOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+				 le16_to_cpu(powerplay_table4-
Quoted 1 line

usMvddDependencyOnMCLKOffset));

result =
get_clock_voltage_dependency_table(hwmgr,
&hwmgr-

Quoted 1 line

dyn_state.mvdd_dependency_on_mclk, table);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -0
 		}
@@ -1569,7 +1570,8 @@ static int get_vce_state_table_entry(struct
 pp_hwmgr *hwmgr,
 
 	const VCEClockInfoArray *vce_clock_info_array = (const

VCEClockInfoArray *)(((unsigned long) powerplay_table) + vce_clock_info_array_offset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -1
-	const ClockInfoArray *clock_arrays = (ClockInfoArray *)(((unsigned

long)powerplay_table) + powerplay_table->usClockInfoArrayOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+	const ClockInfoArray *clock_arrays = (ClockInfoArray *)(((unsigned

long)powerplay_table) +
+

	le16_to_cpu(powerplay_table->usClockInfoArrayOffset));

const ATOM_PPLIB_VCE_State_Record *record = &vce_state_table-

Quoted 1 line

entries[i];

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -2
@@ -1579,8 +1581,8 @@ static int get_vce_state_table_entry(struct
 pp_hwmgr *hwmgr,
 
 	*flag = (record->ucClockInfoIndex >>
 NUM_BITS_CLOCK_INFO_ARRAY_INDEX);
 
-	vce_state->evclk = ((uint32_t)vce_clock_info->ucEVClkHigh << 16) |
 vce_clock_info->usEVClkLow;
-	vce_state->ecclk = ((uint32_t)vce_clock_info->ucECClkHigh << 16) |

vce_clock_info->usECClkLow;

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
+	vce_state->evclk = ((uint32_t)vce_clock_info->ucEVClkHigh << 16) |

le16_to_cpu(vce_clock_info->usEVClkLow);

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +2 -0
+	vce_state->ecclk = ((uint32_t)vce_clock_info->ucECClkHigh << 16) |
+le16_to_cpu(vce_clock_info->usECClkLow);
 
 	*clock_info = (void *)((unsigned long)(clock_arrays->clockInfo) +

(clockInfoIndex * clock_arrays->ucEntrySize));

Quoted 7 lines

--
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Rex Zhu
#5 lore raw

RE: [PATCH 2/2] drm/amdgpu/pp: endian fixes for processpptables.c

In reply to a message not in the archive

Series is:

Regards
Rex
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, August 8, 2018 5:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu/pp: endian fixes for processpptables.c

Properly swap when reading from the vbios.

---
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +5 -4
index 925e17104f90..77c14671866c 100644
@@ -757,8 +757,8 @@ static int init_non_clock_fields(struct pp_hwmgr *hwmgr,
 	ps->validation.supportedPowerLevels = pnon_clock_info->ucRequiredPower;
 
 	if (ATOM_PPLIB_NONCLOCKINFO_VER1 < version) {
-		ps->uvd_clocks.VCLK = pnon_clock_info->ulVCLK;
-		ps->uvd_clocks.DCLK = pnon_clock_info->ulDCLK;
+		ps->uvd_clocks.VCLK = le32_to_cpu(pnon_clock_info->ulVCLK);
+		ps->uvd_clocks.DCLK = le32_to_cpu(pnon_clock_info->ulDCLK);
 	} else {
 		ps->uvd_clocks.VCLK = 0;
 		ps->uvd_clocks.DCLK = 0;
@@ -937,8 +937,9 @@ int pp_tables_get_entry(struct pp_hwmgr *hwmgr,
 		if (entry_index > powerplay_table->ucNumStates)
 			return -1;
 
-		pstate_entry = (ATOM_PPLIB_STATE *)((unsigned long)powerplay_table + powerplay_table->usStateArrayOffset +
-				entry_index * powerplay_table->ucStateEntrySize);
+		pstate_entry = (ATOM_PPLIB_STATE *)((unsigned long)powerplay_table +
+						    le16_to_cpu(powerplay_table->usStateArrayOffset) +
+						    entry_index * powerplay_table->ucStateEntrySize);
 
 		pnon_clock_info = (ATOM_PPLIB_NONCLOCK_INFO *)((unsigned long)powerplay_table +
 						le16_to_cpu(powerplay_table->usNonClockInfoArrayOffset) + @@ -1063,13 +1064,13 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,

&size, &frev, &crev);

if ((fw_info->ucTableFormatRevision == 1)
- && (fw_info->usStructureSize >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))
+ && (le16_to_cpu(fw_info->usStructureSize) >=
+sizeof(ATOM_FIRMWARE_INFO_V1_4)))
result = init_overdrive_limits_V1_4(hwmgr,
powerplay_table,
(const ATOM_FIRMWARE_INFO_V1_4 *)fw_info);

else if ((fw_info->ucTableFormatRevision == 2)
- && (fw_info->usStructureSize >= sizeof(ATOM_FIRMWARE_INFO_V2_1)))
+ && (le16_to_cpu(fw_info->usStructureSize) >=
+sizeof(ATOM_FIRMWARE_INFO_V2_1)))
result = init_overdrive_limits_V2_1(hwmgr,
powerplay_table,
(const ATOM_FIRMWARE_INFO_V2_1 *)fw_info); @@ -1303,7 +1304,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
if (0 != powerplay_table4->usVddcDependencyOnSCLKOffset) {
table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
(((unsigned long) powerplay_table4) +
- powerplay_table4->usVddcDependencyOnSCLKOffset);
+ le16_to_cpu(powerplay_table4->usVddcDependencyOnSCLKOffset));
result = get_clock_voltage_dependency_table(hwmgr,
&hwmgr->dyn_state.vddc_dependency_on_sclk, table);
}
@@ -1311,7 +1312,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
if (result == 0 && (0 != powerplay_table4->usVddciDependencyOnMCLKOffset)) {
table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
(((unsigned long) powerplay_table4) +
- powerplay_table4->usVddciDependencyOnMCLKOffset);
+ le16_to_cpu(powerplay_table4->usVddciDependencyOnMCLKOffset));
result = get_clock_voltage_dependency_table(hwmgr,
&hwmgr->dyn_state.vddci_dependency_on_mclk, table);
}
@@ -1319,7 +1320,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
if (result == 0 && (0 != powerplay_table4->usVddcDependencyOnMCLKOffset)) {
table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
(((unsigned long) powerplay_table4) +
- powerplay_table4->usVddcDependencyOnMCLKOffset);
+ le16_to_cpu(powerplay_table4->usVddcDependencyOnMCLKOffset));
result = get_clock_voltage_dependency_table(hwmgr,
&hwmgr->dyn_state.vddc_dependency_on_mclk, table);
}
@@ -1327,7 +1328,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
if (result == 0 && (0 != powerplay_table4->usMaxClockVoltageOnDCOffset)) {
limit_table = (ATOM_PPLIB_Clock_Voltage_Limit_Table *)
(((unsigned long) powerplay_table4) +
- powerplay_table4->usMaxClockVoltageOnDCOffset);
+ le16_to_cpu(powerplay_table4->usMaxClockVoltageOnDCOffset));
result = get_clock_voltage_limit(hwmgr,
&hwmgr->dyn_state.max_clock_voltage_on_dc, limit_table);
}
@@ -1346,7 +1347,7 @@ static int init_clock_voltage_dependency(struct pp_hwmgr *hwmgr,
if (result == 0 && (0 != powerplay_table4->usMvddDependencyOnMCLKOffset)) {
table = (ATOM_PPLIB_Clock_Voltage_Dependency_Table *)
(((unsigned long) powerplay_table4) +
- powerplay_table4->usMvddDependencyOnMCLKOffset);
+ le16_to_cpu(powerplay_table4->usMvddDependencyOnMCLKOffset));
result = get_clock_voltage_dependency_table(hwmgr,
&hwmgr->dyn_state.mvdd_dependency_on_mclk, table);
}
@@ -1569,7 +1570,8 @@ static int get_vce_state_table_entry(struct pp_hwmgr *hwmgr,

const VCEClockInfoArray *vce_clock_info_array = (const VCEClockInfoArray *)(((unsigned long) powerplay_table) + vce_clock_info_array_offset);

- const ClockInfoArray *clock_arrays = (ClockInfoArray *)(((unsigned long)powerplay_table) + powerplay_table->usClockInfoArrayOffset);
+ const ClockInfoArray *clock_arrays = (ClockInfoArray *)(((unsigned long)powerplay_table) +
+ le16_to_cpu(powerplay_table->usClockInfoArrayOffset));

const ATOM_PPLIB_VCE_State_Record *record = &vce_state_table->entries[i];

@@ -1579,8 +1581,8 @@ static int get_vce_state_table_entry(struct pp_hwmgr *hwmgr,

*flag = (record->ucClockInfoIndex >> NUM_BITS_CLOCK_INFO_ARRAY_INDEX);

-	vce_state->evclk = ((uint32_t)vce_clock_info->ucEVClkHigh << 16) | vce_clock_info->usEVClkLow;
-	vce_state->ecclk = ((uint32_t)vce_clock_info->ucECClkHigh << 16) | vce_clock_info->usECClkLow;
+	vce_state->evclk = ((uint32_t)vce_clock_info->ucEVClkHigh << 16) | le16_to_cpu(vce_clock_info->usEVClkLow);
+	vce_state->ecclk = ((uint32_t)vce_clock_info->ucECClkHigh << 16) | 

+le16_to_cpu(vce_clock_info->usECClkLow);

*clock_info = (void *)((unsigned long)(clock_arrays->clockInfo) + (clockInfoIndex * clock_arrays->ucEntrySize));

--
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Evan Quan
#6 lore raw
In reply to a message not in the archive
Quoted 510 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, August 08, 2018 5:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/pp: endian fixes for process_pptables_v1_0.c

Properly swap when reading from the vbios.

---
 .../amd/powerplay/hwmgr/process_pptables_v1_0.c    | 194 ++++++++++---
--------
 1 file changed, 97 insertions(+), 97 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c index 4e1fd5393845..ae64ff7153d6 100644

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
@@ -214,23 +214,23 @@ static int

get_platform_power_management_table(

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +14 -14
 	ptr->ppm_design
 		= atom_ppm_table->ucPpmDesign;
 	ptr->cpu_core_number
-		= atom_ppm_table->usCpuCoreNumber;
+		= le16_to_cpu(atom_ppm_table->usCpuCoreNumber);
 	ptr->platform_tdp
-		= atom_ppm_table->ulPlatformTDP;
+		= le32_to_cpu(atom_ppm_table->ulPlatformTDP);
 	ptr->small_ac_platform_tdp
-		= atom_ppm_table->ulSmallACPlatformTDP;
+		= le32_to_cpu(atom_ppm_table->ulSmallACPlatformTDP);
 	ptr->platform_tdc
-		= atom_ppm_table->ulPlatformTDC;
+		= le32_to_cpu(atom_ppm_table->ulPlatformTDC);
 	ptr->small_ac_platform_tdc
-		= atom_ppm_table->ulSmallACPlatformTDC;
+		= le32_to_cpu(atom_ppm_table->ulSmallACPlatformTDC);
 	ptr->apu_tdp
-		= atom_ppm_table->ulApuTDP;
+		= le32_to_cpu(atom_ppm_table->ulApuTDP);
 	ptr->dgpu_tdp
-		= atom_ppm_table->ulDGpuTDP;
+		= le32_to_cpu(atom_ppm_table->ulDGpuTDP);
 	ptr->dgpu_ulv_power
-		= atom_ppm_table->ulDGpuUlvPower;
+		= le32_to_cpu(atom_ppm_table->ulDGpuUlvPower);
 	ptr->tj_max
-		= atom_ppm_table->ulTjmax;
+		= le32_to_cpu(atom_ppm_table->ulTjmax);
 
 	pp_table_information->ppm_parameter_table = ptr;
@@ -355,11 +355,11 @@ static int get_hard_limits(
 	PP_ASSERT_WITH_CODE((0 != limitable->ucNumEntries), "Invalid
 PowerPlay Table!", return -1);
 
 	/* currently we always take entries[0] parameters */
-	limits->sclk = (uint32_t)limitable->entries[0].ulSCLKLimit;
-	limits->mclk = (uint32_t)limitable->entries[0].ulMCLKLimit;
-	limits->vddc = (uint16_t)limitable->entries[0].usVddcLimit;
-	limits->vddci = (uint16_t)limitable->entries[0].usVddciLimit;
-	limits->vddgfx = (uint16_t)limitable->entries[0].usVddgfxLimit;
+	limits->sclk = le32_to_cpu(limitable->entries[0].ulSCLKLimit);
+	limits->mclk = le32_to_cpu(limitable->entries[0].ulMCLKLimit);
+	limits->vddc = le16_to_cpu(limitable->entries[0].usVddcLimit);
+	limits->vddci = le16_to_cpu(limitable->entries[0].usVddciLimit);
+	limits->vddgfx = le16_to_cpu(limitable->entries[0].usVddgfxLimit);
 
 	return 0;

}

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -4
@@ -396,10 +396,10 @@ static int get_mclk_voltage_dependency_table(
 
 	ATOM_Tonga_MCLK_Dependency_Record,
 						entries, mclk_dep_table, i);
 		mclk_table_record->vddInd = mclk_dep_record->ucVddcInd;
-		mclk_table_record->vdd_offset = mclk_dep_record-
 >usVddgfxOffset;
-		mclk_table_record->vddci = mclk_dep_record->usVddci;
-		mclk_table_record->mvdd = mclk_dep_record->usMvdd;
-		mclk_table_record->clk = mclk_dep_record->ulMclk;
+		mclk_table_record->vdd_offset =
 le16_to_cpu(mclk_dep_record->usVddgfxOffset);
+		mclk_table_record->vddci = le16_to_cpu(mclk_dep_record-
Quoted 1 line

usVddci);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mclk_table_record->mvdd = le16_to_cpu(mclk_dep_record-
Quoted 1 line

usMvdd);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mclk_table_record->clk = le32_to_cpu(mclk_dep_record-
Quoted 1 line

ulMclk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 	}
 
 	*pp_tonga_mclk_dep_table = mclk_table; @@ -443,8 +443,8 @@

static int get_sclk_voltage_dependency_table(

phm_ppt_v1_clock_voltage_dependency_record,

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 						entries, sclk_table, i);
 			sclk_table_record->vddInd = sclk_dep_record-
Quoted 1 line

ucVddInd;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-			sclk_table_record->vdd_offset = sclk_dep_record-
Quoted 1 line

usVddcOffset;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			sclk_table_record->clk = sclk_dep_record->ulSclk;
+			sclk_table_record->vdd_offset =

le16_to_cpu(sclk_dep_record->usVddcOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			sclk_table_record->clk =

le32_to_cpu(sclk_dep_record->ulSclk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			sclk_table_record->cks_enable =
 				(((sclk_dep_record-
Quoted 1 line

ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;

sclk_table_record->cks_voffset = (sclk_dep_record-

Quoted 1 line

ucCKSVOffsetandDisable & 0x7F); @@ -475,12 +475,12 @@ static int

get_sclk_voltage_dependency_table(

phm_ppt_v1_clock_voltage_dependency_record,

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 						entries, sclk_table, i);
 			sclk_table_record->vddInd = sclk_dep_record-
Quoted 1 line

ucVddInd;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-			sclk_table_record->vdd_offset = sclk_dep_record-
Quoted 1 line

usVddcOffset;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			sclk_table_record->clk = sclk_dep_record->ulSclk;
+			sclk_table_record->vdd_offset =

le16_to_cpu(sclk_dep_record->usVddcOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			sclk_table_record->clk =

le32_to_cpu(sclk_dep_record->ulSclk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			sclk_table_record->cks_enable =
 				(((sclk_dep_record-
Quoted 1 line

ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;

sclk_table_record->cks_voffset = (sclk_dep_record-

Quoted 1 line

ucCKSVOffsetandDisable & 0x7F);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-			sclk_table_record->sclk_offset = sclk_dep_record-
Quoted 1 line

ulSclkOffset;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -0
+			sclk_table_record->sclk_offset =
+le32_to_cpu(sclk_dep_record->ulSclkOffset);
 		}
 	}
 	*pp_tonga_sclk_dep_table = sclk_table; @@ -534,7 +534,7 @@

static int get_pcie_table(

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 						ATOM_Tonga_PCIE_Record,
 						entries, atom_pcie_table, i);
 			pcie_record->gen_speed = atom_pcie_record-
Quoted 1 line

ucPCIEGenSpeed;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-			pcie_record->lane_width = atom_pcie_record-
Quoted 1 line

usPCIELaneWidth;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -2
+			pcie_record->lane_width =
+le16_to_cpu(atom_pcie_record->usPCIELaneWidth);
 		}
 
 		*pp_tonga_pcie_table = pcie_table;
@@ -574,8 +574,8 @@ static int get_pcie_table(
 
 	ATOM_Polaris10_PCIE_Record,
 						entries, atom_pcie_table, i);
 			pcie_record->gen_speed = atom_pcie_record-
 >ucPCIEGenSpeed;
-			pcie_record->lane_width = atom_pcie_record-
 >usPCIELaneWidth;
-			pcie_record->pcie_sclk = atom_pcie_record-
Quoted 1 line

ulPCIE_Sclk;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			pcie_record->lane_width =

le16_to_cpu(atom_pcie_record->usPCIELaneWidth);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			pcie_record->pcie_sclk =

le32_to_cpu(atom_pcie_record->ulPCIE_Sclk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +9 -10
 		}
 
 		*pp_tonga_pcie_table = pcie_table;
@@ -609,64 +609,64 @@ static int get_cac_tdp_table(
 	if (table->ucRevId < 3) {
 		const ATOM_Tonga_PowerTune_Table *tonga_table =
 			(ATOM_Tonga_PowerTune_Table *)table;
-		tdp_table->usTDP = tonga_table->usTDP;
+		tdp_table->usTDP = le16_to_cpu(tonga_table->usTDP);
 		tdp_table->usConfigurableTDP =
-			tonga_table->usConfigurableTDP;
-		tdp_table->usTDC = tonga_table->usTDC;
+			le16_to_cpu(tonga_table->usConfigurableTDP);
+		tdp_table->usTDC = le16_to_cpu(tonga_table->usTDC);
 		tdp_table->usBatteryPowerLimit =
-			tonga_table->usBatteryPowerLimit;
+			le16_to_cpu(tonga_table->usBatteryPowerLimit);
 		tdp_table->usSmallPowerLimit =
-			tonga_table->usSmallPowerLimit;
+			le16_to_cpu(tonga_table->usSmallPowerLimit);
 		tdp_table->usLowCACLeakage =
-			tonga_table->usLowCACLeakage;
+			le16_to_cpu(tonga_table->usLowCACLeakage);
 		tdp_table->usHighCACLeakage =
-			tonga_table->usHighCACLeakage;
+			le16_to_cpu(tonga_table->usHighCACLeakage);
 		tdp_table->usMaximumPowerDeliveryLimit =
-			tonga_table->usMaximumPowerDeliveryLimit;
+			le16_to_cpu(tonga_table-
 >usMaximumPowerDeliveryLimit);
 		tdp_table->usDefaultTargetOperatingTemp =
-			tonga_table->usTjMax;
+			le16_to_cpu(tonga_table->usTjMax);
 		tdp_table->usTargetOperatingTemp =
-			tonga_table->usTjMax; /*Set the initial temp to the

same as default */

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			le16_to_cpu(tonga_table->usTjMax); /*Set the initial

temp to the

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +3 -2
+same as default */
 		tdp_table->usPowerTuneDataSetID =
-			tonga_table->usPowerTuneDataSetID;
+			le16_to_cpu(tonga_table->usPowerTuneDataSetID);
 		tdp_table->usSoftwareShutdownTemp =
-			tonga_table->usSoftwareShutdownTemp;
+			le16_to_cpu(tonga_table-
Quoted 1 line

usSoftwareShutdownTemp);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -3
 		tdp_table->usClockStretchAmount =
-			tonga_table->usClockStretchAmount;
+			le16_to_cpu(tonga_table->usClockStretchAmount);
 	} else {   /* Fiji and newer */
 		const ATOM_Fiji_PowerTune_Table *fijitable =
 			(ATOM_Fiji_PowerTune_Table *)table;
-		tdp_table->usTDP = fijitable->usTDP;
-		tdp_table->usConfigurableTDP = fijitable-
Quoted 1 line

usConfigurableTDP;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -2
-		tdp_table->usTDC = fijitable->usTDC;
-		tdp_table->usBatteryPowerLimit = fijitable-
Quoted 1 line

usBatteryPowerLimit;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-		tdp_table->usSmallPowerLimit = fijitable-
Quoted 1 line

usSmallPowerLimit;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -2
-		tdp_table->usLowCACLeakage = fijitable->usLowCACLeakage;
-		tdp_table->usHighCACLeakage = fijitable-
Quoted 1 line

usHighCACLeakage;

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -0
+		tdp_table->usTDP = le16_to_cpu(fijitable->usTDP);
+		tdp_table->usConfigurableTDP = le16_to_cpu(fijitable-
Quoted 1 line

usConfigurableTDP);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -0
+		tdp_table->usTDC = le16_to_cpu(fijitable->usTDC);
+		tdp_table->usBatteryPowerLimit = le16_to_cpu(fijitable-
Quoted 1 line

usBatteryPowerLimit);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		tdp_table->usSmallPowerLimit = le16_to_cpu(fijitable-
Quoted 1 line

usSmallPowerLimit);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		tdp_table->usLowCACLeakage = le16_to_cpu(fijitable-
Quoted 1 line

usLowCACLeakage);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +3 -1
+		tdp_table->usHighCACLeakage =
+le16_to_cpu(fijitable->usHighCACLeakage);
 		tdp_table->usMaximumPowerDeliveryLimit =
-			fijitable->usMaximumPowerDeliveryLimit;
+			le16_to_cpu(fijitable-
Quoted 1 line

usMaximumPowerDeliveryLimit);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -2
 		tdp_table->usDefaultTargetOperatingTemp =
-			fijitable->usTjMax;
+			le16_to_cpu(fijitable->usTjMax);
 		tdp_table->usTargetOperatingTemp =
-			fijitable->usTjMax; /*Set the initial temp to the same

as default */

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			le16_to_cpu(fijitable->usTjMax); /*Set the initial

temp to the same

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +11 -15
+as default */
 		tdp_table->usPowerTuneDataSetID =
-			fijitable->usPowerTuneDataSetID;
+			le16_to_cpu(fijitable->usPowerTuneDataSetID);
 		tdp_table->usSoftwareShutdownTemp =
-			fijitable->usSoftwareShutdownTemp;
+			le16_to_cpu(fijitable->usSoftwareShutdownTemp);
 		tdp_table->usClockStretchAmount =
-			fijitable->usClockStretchAmount;
+			le16_to_cpu(fijitable->usClockStretchAmount);
 		tdp_table->usTemperatureLimitHotspot =
-			fijitable->usTemperatureLimitHotspot;
+			le16_to_cpu(fijitable->usTemperatureLimitHotspot);
 		tdp_table->usTemperatureLimitLiquid1 =
-			fijitable->usTemperatureLimitLiquid1;
+			le16_to_cpu(fijitable->usTemperatureLimitLiquid1);
 		tdp_table->usTemperatureLimitLiquid2 =
-			fijitable->usTemperatureLimitLiquid2;
+			le16_to_cpu(fijitable->usTemperatureLimitLiquid2);
 		tdp_table->usTemperatureLimitVrVddc =
-			fijitable->usTemperatureLimitVrVddc;
+			le16_to_cpu(fijitable->usTemperatureLimitVrVddc);
 		tdp_table->usTemperatureLimitVrMvdd =
-			fijitable->usTemperatureLimitVrMvdd;
+			le16_to_cpu(fijitable->usTemperatureLimitVrMvdd);
 		tdp_table->usTemperatureLimitPlx =
-			fijitable->usTemperatureLimitPlx;
+			le16_to_cpu(fijitable->usTemperatureLimitPlx);
 		tdp_table->ucLiquid1_I2C_address =
 			fijitable->ucLiquid1_I2C_address;
 		tdp_table->ucLiquid2_I2C_address =
@@ -715,12 +715,12 @@ static int get_mm_clock_voltage_table(
 
 	phm_ppt_v1_mm_clock_voltage_dependency_record,
 					entries, mm_table, i);
 		mm_table_record->vddcInd = mm_dependency_record-
 >ucVddcInd;
-		mm_table_record->vddgfx_offset =
 mm_dependency_record->usVddgfxOffset;
-		mm_table_record->aclk = mm_dependency_record->ulAClk;
-		mm_table_record->samclock = mm_dependency_record-
 >ulSAMUClk;
-		mm_table_record->eclk = mm_dependency_record->ulEClk;
-		mm_table_record->vclk = mm_dependency_record->ulVClk;
-		mm_table_record->dclk = mm_dependency_record->ulDClk;
+		mm_table_record->vddgfx_offset =

le16_to_cpu(mm_dependency_record->usVddgfxOffset);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mm_table_record->aclk =

le32_to_cpu(mm_dependency_record->ulAClk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mm_table_record->samclock =

le32_to_cpu(mm_dependency_record->ulSAMUClk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mm_table_record->eclk =

le32_to_cpu(mm_dependency_record->ulEClk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mm_table_record->vclk =

le32_to_cpu(mm_dependency_record->ulVClk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+		mm_table_record->dclk =

le32_to_cpu(mm_dependency_record->ulDClk);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 	}
 
 	*tonga_mm_table = mm_table;
@@ -939,33 +939,33 @@ static int init_thermal_controller(
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucTHyst

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= tonga_fan_table->ucTHyst;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMin

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usTMin;
+			= le16_to_cpu(tonga_fan_table->usTMin);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMed

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usTMed;
+			= le16_to_cpu(tonga_fan_table->usTMed);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTHigh

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usTHigh;
+			= le16_to_cpu(tonga_fan_table->usTHigh);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usPWMMin

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usPWMMin;
+			= le16_to_cpu(tonga_fan_table->usPWMMin);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usPWMMed

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usPWMMed;
+			= le16_to_cpu(tonga_fan_table->usPWMMed);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usPWMHigh

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usPWMHigh;
+			= le16_to_cpu(tonga_fan_table->usPWMHigh);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMax

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= 10900;                  /* hard coded */
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMax

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usTMax;
+			= le16_to_cpu(tonga_fan_table->usTMax);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucFanControlMode

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= tonga_fan_table->ucFanControlMode;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usDefaultMaxFanPWM

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usFanPWMMax;
+			= le16_to_cpu(tonga_fan_table->usFanPWMMax);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usDefaultFanOutputSen

sitivity

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= 4836;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanOutputSensitivity

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usFanOutputSensitivity;
+			= le16_to_cpu(tonga_fan_table-
Quoted 1 line

usFanOutputSensitivity);

hwmgr-

Quoted 1 line

thermal_controller.advanceFanControlParameters.usDefaultMaxFanRPM

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= tonga_fan_table->usFanRPMMax;
+			= le16_to_cpu(tonga_fan_table->usFanRPMMax);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ulMinFanSCLKAcousticLi

mit

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-			= (tonga_fan_table->ulMinFanSCLKAcousticLimit /

100); /* PPTable stores it in 10Khz unit for 2 decimal places. SMC wants MHz. */

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			= (le32_to_cpu(tonga_fan_table-
Quoted 1 line

ulMinFanSCLKAcousticLimit) / 100);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -0
+/* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants
+MHz. */
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucTargetTemperature

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= tonga_fan_table->ucTargetTemperature;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
@@ -976,50 +976,50 @@ static int init_thermal_controller(
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucTHyst

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= fiji_fan_table->ucTHyst;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMin

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usTMin;
+			= le16_to_cpu(fiji_fan_table->usTMin);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMed

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usTMed;
+			= le16_to_cpu(fiji_fan_table->usTMed);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTHigh

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usTHigh;
+			= le16_to_cpu(fiji_fan_table->usTHigh);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usPWMMin

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usPWMMin;
+			= le16_to_cpu(fiji_fan_table->usPWMMin);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usPWMMed

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usPWMMed;
+			= le16_to_cpu(fiji_fan_table->usPWMMed);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usPWMHigh

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usPWMHigh;
+			= le16_to_cpu(fiji_fan_table->usPWMHigh);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usTMax

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usTMax;
+			= le16_to_cpu(fiji_fan_table->usTMax);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucFanControlMode

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= fiji_fan_table->ucFanControlMode;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usDefaultMaxFanPWM

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanPWMMax;
+			= le16_to_cpu(fiji_fan_table->usFanPWMMax);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usDefaultFanOutputSen

sitivity

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= 4836;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanOutputSensitivity

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanOutputSensitivity;
+			= le16_to_cpu(fiji_fan_table-
Quoted 1 line

usFanOutputSensitivity);

hwmgr-

Quoted 1 line

thermal_controller.advanceFanControlParameters.usDefaultMaxFanRPM

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanRPMMax;
+			= le16_to_cpu(fiji_fan_table->usFanRPMMax);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ulMinFanSCLKAcousticLi

mit

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -1
-			= (fiji_fan_table->ulMinFanSCLKAcousticLimit / 100);

/* PPTable stores it in 10Khz unit for 2 decimal places. SMC wants MHz. */

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -0
+			= (le32_to_cpu(fiji_fan_table-
Quoted 1 line

ulMinFanSCLKAcousticLimit) / 100); /*

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +2 -0
+PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz.
+*/
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucTargetTemperature

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= fiji_fan_table->ucTargetTemperature;
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +0 -0
 			= fiji_fan_table->ucMinimumPWMLimit;
 
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainEdge

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainEdge;
+			= le16_to_cpu(fiji_fan_table->usFanGainEdge);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainHotspot

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainHotspot;
+			= le16_to_cpu(fiji_fan_table->usFanGainHotspot);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainLiquid

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainLiquid;
+			= le16_to_cpu(fiji_fan_table->usFanGainLiquid);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainVrVddc

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainVrVddc;
+			= le16_to_cpu(fiji_fan_table->usFanGainVrVddc);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainVrMvdd

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainVrMvdd;
+			= le16_to_cpu(fiji_fan_table->usFanGainVrMvdd);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainPlx

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainPlx;
+			= le16_to_cpu(fiji_fan_table->usFanGainPlx);
 		hwmgr-
Quoted 1 line

thermal_controller.advanceFanControlParameters.usFanGainHbm

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
-			= fiji_fan_table->usFanGainHbm;
+			= le16_to_cpu(fiji_fan_table->usFanGainHbm);
 	}
 
 	return 0;
@@ -1256,9 +1256,9 @@ static int

ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i
vce_state_record-

Quoted 1 line

ucVCEClockIndex);

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +3 -3
 	*flag = vce_state_record->ucFlag;
 
-	vce_state->evclk = mm_dep_record->ulEClk;
-	vce_state->ecclk = mm_dep_record->ulEClk;
-	vce_state->sclk = sclk_dep_record->ulSclk;
+	vce_state->evclk = le32_to_cpu(mm_dep_record->ulEClk);
+	vce_state->ecclk = le32_to_cpu(mm_dep_record->ulEClk);
+	vce_state->sclk = le32_to_cpu(sclk_dep_record->ulSclk);
 
 	if (vce_state_record->ucMCLKIndex >= mclk_dep_table-
Quoted 1 line

ucNumEntries)

mclk_dep_record =
GET_FLEXIBLE_ARRAY_MEMBER_ADDR( @@ -1271,7 +1271,7 @@ static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +1 -2
 					entries, mclk_dep_table,
 					vce_state_record->ucMCLKIndex);
 
-	vce_state->mclk = mclk_dep_record->ulMclk;
+	vce_state->mclk = le32_to_cpu(mclk_dep_record->ulMclk);
 	return 0;
 }
 
--

2.13.6

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx