[PATCH] drm/amdgpu: drop some unused atombios functions

Christian König ckoenig.leichtzumerken at gmail.com
Wed Mar 31 14:17:40 UTC 2021


Am 31.03.21 um 16:06 schrieb Alex Deucher:
> These were leftover from the old CI dpm code which was
> retired a while ago.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

Acked-by: Christian König <christian.koenig at amd.com>

BTW: Wasn't there a way to get the linker to complain about unused symbols?

E.g. unused function, global variables etc which are only declared but 
never referenced.

Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 151 -------------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h |  12 --
>   2 files changed, 163 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> index ca7bdbdbf302..494b2e1717d5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> @@ -1232,157 +1232,6 @@ int amdgpu_atombios_get_leakage_vddc_based_on_leakage_idx(struct amdgpu_device *
>   	return amdgpu_atombios_get_max_vddc(adev, VOLTAGE_TYPE_VDDC, leakage_idx, voltage);
>   }
>   
> -int amdgpu_atombios_get_leakage_id_from_vbios(struct amdgpu_device *adev,
> -					      u16 *leakage_id)
> -{
> -	union set_voltage args;
> -	int index = GetIndexIntoMasterTable(COMMAND, SetVoltage);
> -	u8 frev, crev;
> -
> -	if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev))
> -		return -EINVAL;
> -
> -	switch (crev) {
> -	case 3:
> -	case 4:
> -		args.v3.ucVoltageType = 0;
> -		args.v3.ucVoltageMode = ATOM_GET_LEAKAGE_ID;
> -		args.v3.usVoltageLevel = 0;
> -
> -		amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args);
> -
> -		*leakage_id = le16_to_cpu(args.v3.usVoltageLevel);
> -		break;
> -	default:
> -		DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
> -		return -EINVAL;
> -	}
> -
> -	return 0;
> -}
> -
> -int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_device *adev,
> -							     u16 *vddc, u16 *vddci,
> -							     u16 virtual_voltage_id,
> -							     u16 vbios_voltage_id)
> -{
> -	int index = GetIndexIntoMasterTable(DATA, ASIC_ProfilingInfo);
> -	u8 frev, crev;
> -	u16 data_offset, size;
> -	int i, j;
> -	ATOM_ASIC_PROFILING_INFO_V2_1 *profile;
> -	u16 *leakage_bin, *vddc_id_buf, *vddc_buf, *vddci_id_buf, *vddci_buf;
> -
> -	*vddc = 0;
> -	*vddci = 0;
> -
> -	if (!amdgpu_atom_parse_data_header(adev->mode_info.atom_context, index, &size,
> -				    &frev, &crev, &data_offset))
> -		return -EINVAL;
> -
> -	profile = (ATOM_ASIC_PROFILING_INFO_V2_1 *)
> -		(adev->mode_info.atom_context->bios + data_offset);
> -
> -	switch (frev) {
> -	case 1:
> -		return -EINVAL;
> -	case 2:
> -		switch (crev) {
> -		case 1:
> -			if (size < sizeof(ATOM_ASIC_PROFILING_INFO_V2_1))
> -				return -EINVAL;
> -			leakage_bin = (u16 *)
> -				(adev->mode_info.atom_context->bios + data_offset +
> -				 le16_to_cpu(profile->usLeakageBinArrayOffset));
> -			vddc_id_buf = (u16 *)
> -				(adev->mode_info.atom_context->bios + data_offset +
> -				 le16_to_cpu(profile->usElbVDDC_IdArrayOffset));
> -			vddc_buf = (u16 *)
> -				(adev->mode_info.atom_context->bios + data_offset +
> -				 le16_to_cpu(profile->usElbVDDC_LevelArrayOffset));
> -			vddci_id_buf = (u16 *)
> -				(adev->mode_info.atom_context->bios + data_offset +
> -				 le16_to_cpu(profile->usElbVDDCI_IdArrayOffset));
> -			vddci_buf = (u16 *)
> -				(adev->mode_info.atom_context->bios + data_offset +
> -				 le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset));
> -
> -			if (profile->ucElbVDDC_Num > 0) {
> -				for (i = 0; i < profile->ucElbVDDC_Num; i++) {
> -					if (vddc_id_buf[i] == virtual_voltage_id) {
> -						for (j = 0; j < profile->ucLeakageBinNum; j++) {
> -							if (vbios_voltage_id <= leakage_bin[j]) {
> -								*vddc = vddc_buf[j * profile->ucElbVDDC_Num + i];
> -								break;
> -							}
> -						}
> -						break;
> -					}
> -				}
> -			}
> -			if (profile->ucElbVDDCI_Num > 0) {
> -				for (i = 0; i < profile->ucElbVDDCI_Num; i++) {
> -					if (vddci_id_buf[i] == virtual_voltage_id) {
> -						for (j = 0; j < profile->ucLeakageBinNum; j++) {
> -							if (vbios_voltage_id <= leakage_bin[j]) {
> -								*vddci = vddci_buf[j * profile->ucElbVDDCI_Num + i];
> -								break;
> -							}
> -						}
> -						break;
> -					}
> -				}
> -			}
> -			break;
> -		default:
> -			DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
> -			return -EINVAL;
> -		}
> -		break;
> -	default:
> -		DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
> -		return -EINVAL;
> -	}
> -
> -	return 0;
> -}
> -
> -union get_voltage_info {
> -	struct _GET_VOLTAGE_INFO_INPUT_PARAMETER_V1_2 in;
> -	struct _GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 evv_out;
> -};
> -
> -int amdgpu_atombios_get_voltage_evv(struct amdgpu_device *adev,
> -				    u16 virtual_voltage_id,
> -				    u16 *voltage)
> -{
> -	int index = GetIndexIntoMasterTable(COMMAND, GetVoltageInfo);
> -	u32 entry_id;
> -	u32 count = adev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count;
> -	union get_voltage_info args;
> -
> -	for (entry_id = 0; entry_id < count; entry_id++) {
> -		if (adev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].v ==
> -		    virtual_voltage_id)
> -			break;
> -	}
> -
> -	if (entry_id >= count)
> -		return -EINVAL;
> -
> -	args.in.ucVoltageType = VOLTAGE_TYPE_VDDC;
> -	args.in.ucVoltageMode = ATOM_GET_VOLTAGE_EVV_VOLTAGE;
> -	args.in.usVoltageLevel = cpu_to_le16(virtual_voltage_id);
> -	args.in.ulSCLKFreq =
> -		cpu_to_le32(adev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk);
> -
> -	amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args);
> -
> -	*voltage = le16_to_cpu(args.evv_out.usVoltageLevel);
> -
> -	return 0;
> -}
> -
>   union voltage_object_info {
>   	struct _ATOM_VOLTAGE_OBJECT_INFO v1;
>   	struct _ATOM_VOLTAGE_OBJECT_INFO_V2 v2;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h
> index 1321ec09c734..8cc0222dba19 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h
> @@ -168,18 +168,6 @@ int amdgpu_atombios_get_memory_pll_dividers(struct amdgpu_device *adev,
>   void amdgpu_atombios_set_engine_dram_timings(struct amdgpu_device *adev,
>   					     u32 eng_clock, u32 mem_clock);
>   
> -int amdgpu_atombios_get_leakage_id_from_vbios(struct amdgpu_device *adev,
> -					      u16 *leakage_id);
> -
> -int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_device *adev,
> -							     u16 *vddc, u16 *vddci,
> -							     u16 virtual_voltage_id,
> -							     u16 vbios_voltage_id);
> -
> -int amdgpu_atombios_get_voltage_evv(struct amdgpu_device *adev,
> -				    u16 virtual_voltage_id,
> -				    u16 *voltage);
> -
>   bool
>   amdgpu_atombios_is_voltage_gpio(struct amdgpu_device *adev,
>   				u8 voltage_type, u8 voltage_mode);



More information about the amd-gfx mailing list