Re: [PATCH 01/17] drm/amd/powerplay: move the API shared by SMU v11 to smu_v11_0.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 14, 2020 at 4:04 AM Evan Quan <evan.quan@xxxxxxx> wrote:
>
> To fit our original desgin and this can help to maintain
> clear code layer.
>
> Change-Id: Id89476c14709b5676bbf043371a27f27b94a58ed
> Signed-off-by: Evan Quan <evan.quan@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 16 ---------------
>  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  |  2 +-
>  .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  4 ----
>  drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  4 ++++
>  drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  4 ++--
>  .../drm/amd/powerplay/sienna_cichlid_ppt.c    |  2 +-
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 20 +++++++++++++++++--
>  7 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 16ff64644e2e..0daea412d0a0 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -675,22 +675,6 @@ static int smu_late_init(void *handle)
>         return 0;
>  }
>
> -int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
> -                           uint16_t *size, uint8_t *frev, uint8_t *crev,
> -                           uint8_t **addr)
> -{
> -       struct amdgpu_device *adev = smu->adev;
> -       uint16_t data_start;
> -
> -       if (!amdgpu_atom_parse_data_header(adev->mode_info.atom_context, table,
> -                                          size, frev, crev, &data_start))
> -               return -EINVAL;
> -
> -       *addr = (uint8_t *)adev->mode_info.atom_context->bios + data_start;
> -
> -       return 0;
> -}
> -
>  static int smu_init_fb_allocations(struct smu_context *smu)
>  {
>         struct amdgpu_device *adev = smu->adev;
> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> index 56dc20a617fd..03361d0194fe 100644
> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> @@ -488,7 +488,7 @@ static int arcturus_append_powerplay_table(struct smu_context *smu)
>         index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
>                                            smc_dpm_info);
>
> -       ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL,
> +       ret = smu_v11_0_get_atom_data_table(smu, index, NULL, NULL, NULL,
>                                       (uint8_t **)&smc_dpm_table);
>         if (ret)
>                 return ret;
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> index 52e5603dcc97..28894b8bab67 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> @@ -674,10 +674,6 @@ int smu_baco_exit(struct smu_context *smu);
>
>  int smu_mode2_reset(struct smu_context *smu);
>
> -extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
> -                                  uint16_t *size, uint8_t *frev, uint8_t *crev,
> -                                  uint8_t **addr);
> -
>  extern const struct amd_ip_funcs smu_ip_funcs;
>
>  extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> index 9b724e4aceaa..8a4053d8eb8c 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> @@ -175,6 +175,10 @@ int smu_v11_0_fini_power(struct smu_context *smu);
>
>  int smu_v11_0_check_fw_status(struct smu_context *smu);
>
> +int smu_v11_0_get_atom_data_table(struct smu_context *smu, uint32_t table,
> +                           uint16_t *size, uint8_t *frev, uint8_t *crev,
> +                           uint8_t **addr);
> +
>  int smu_v11_0_setup_pptable(struct smu_context *smu);
>
>  int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu);
> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> index 41bd6d157271..ff717b800086 100644
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> @@ -467,7 +467,7 @@ static int navi10_append_powerplay_table(struct smu_context *smu)
>         index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
>                                            smc_dpm_info);
>
> -       ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL,
> +       ret = smu_v11_0_get_atom_data_table(smu, index, NULL, NULL, NULL,
>                                       (uint8_t **)&smc_dpm_table);
>         if (ret)
>                 return ret;
> @@ -487,7 +487,7 @@ static int navi10_append_powerplay_table(struct smu_context *smu)
>                         sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header));
>                 break;
>         case 7: /* nv12 */
> -               ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL,
> +               ret = smu_v11_0_get_atom_data_table(smu, index, NULL, NULL, NULL,
>                                               (uint8_t **)&smc_dpm_table_v4_7);
>                 if (ret)
>                         return ret;
> diff --git a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
> index 48c5424f6f37..8a25921d28a9 100644
> --- a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
> @@ -398,7 +398,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu)
>         index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
>                                             smc_dpm_info);
>
> -       ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL,
> +       ret = smu_v11_0_get_atom_data_table(smu, index, NULL, NULL, NULL,
>                                       (uint8_t **)&smc_dpm_table);
>         if (ret)
>                 return ret;
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index fbd561a4d0eb..416aa536a57e 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -370,6 +370,22 @@ static int smu_v11_0_set_pptable_v2_1(struct smu_context *smu, void **table,
>         return 0;
>  }
>
> +int smu_v11_0_get_atom_data_table(struct smu_context *smu, uint32_t table,
> +                           uint16_t *size, uint8_t *frev, uint8_t *crev,
> +                           uint8_t **addr)
> +{
> +       struct amdgpu_device *adev = smu->adev;
> +       uint16_t data_start;
> +
> +       if (!amdgpu_atom_parse_data_header(adev->mode_info.atom_context, table,
> +                                          size, frev, crev, &data_start))
> +               return -EINVAL;
> +
> +       *addr = (uint8_t *)adev->mode_info.atom_context->bios + data_start;
> +
> +       return 0;
> +}

This is not really smu11 specific.  I think it would be better in the
smu_cmn file or even amdgpu_atombios.c.

Patches 2-17:
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> +
>  int smu_v11_0_setup_pptable(struct smu_context *smu)
>  {
>         struct amdgpu_device *adev = smu->adev;
> @@ -406,7 +422,7 @@ int smu_v11_0_setup_pptable(struct smu_context *smu)
>                 index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
>                                                     powerplayinfo);
>
> -               ret = smu_get_atom_data_table(smu, index, &atom_table_size, &frev, &crev,
> +               ret = smu_v11_0_get_atom_data_table(smu, index, &atom_table_size, &frev, &crev,
>                                               (uint8_t **)&table);
>                 if (ret)
>                         return ret;
> @@ -621,7 +637,7 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)
>         index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
>                                             firmwareinfo);
>
> -       ret = smu_get_atom_data_table(smu, index, &size, &frev, &crev,
> +       ret = smu_v11_0_get_atom_data_table(smu, index, &size, &frev, &crev,
>                                       (uint8_t **)&header);
>         if (ret)
>                 return ret;
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux