[AMD Official Use Only - Internal Distribution Only] Updated in the new patch. BR, Evan -----Original Message----- From: Alex Deucher <alexdeucher@xxxxxxxxx> Sent: Thursday, July 16, 2020 1:58 AM To: Quan, Evan <Evan.Quan@xxxxxxx> Cc: amd-gfx list <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>; Deucher, Alexander <Alexander.Deucher@xxxxxxx> Subject: Re: [PATCH 01/17] drm/amd/powerplay: move the API shared by SMU v11 to smu_v11_0.c 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist > s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cev > an.quan%40amd.com%7Cc33d26750f124a1ccbd608d828e8b36f%7C3dd8961fe4884e6 > 08e11a82d994e183d%7C0%7C0%7C637304327224279817&sdata=dc%2BP6PvWBvR > K%2BJuGkMTBYfCqZOYWdZD0FUPs4TH3F1g%3D&reserved=0 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx