Commit c6eef2d0 authored by Likun Gao's avatar Likun Gao Committed by Alex Deucher

drm/amd/powerplay: add function to check pptable for smu11

Add smu_v11_0_check_pptable function for smu11.
Signed-off-by: default avatarLikun Gao <Likun.Gao@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarKevin Wang <Kevin1.Wang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3e333c6c
...@@ -102,6 +102,7 @@ struct smu_context ...@@ -102,6 +102,7 @@ struct smu_context
struct pptable_funcs { struct pptable_funcs {
int (*store_powerplay_table)(struct smu_context *smu); int (*store_powerplay_table)(struct smu_context *smu);
int (*check_powerplay_table)(struct smu_context *smu);
}; };
struct smu_funcs struct smu_funcs
...@@ -180,6 +181,8 @@ struct smu_funcs ...@@ -180,6 +181,8 @@ struct smu_funcs
((smu)->funcs->send_smc_msg_with_param? (smu)->funcs->send_smc_msg_with_param((smu), (msg), (param)) : 0) ((smu)->funcs->send_smc_msg_with_param? (smu)->funcs->send_smc_msg_with_param((smu), (msg), (param)) : 0)
#define smu_store_powerplay_table(smu) \ #define smu_store_powerplay_table(smu) \
((smu)->ppt_funcs->store_powerplay_table ? (smu)->ppt_funcs->store_powerplay_table((smu)) : 0) ((smu)->ppt_funcs->store_powerplay_table ? (smu)->ppt_funcs->store_powerplay_table((smu)) : 0)
#define smu_check_powerplay_table(smu) \
((smu)->ppt_funcs->check_powerplay_table ? (smu)->ppt_funcs->check_powerplay_table((smu)) : 0)
extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
uint16_t *size, uint8_t *frev, uint8_t *crev, uint16_t *size, uint8_t *frev, uint8_t *crev,
......
...@@ -486,6 +486,14 @@ static int smu_v11_0_notify_memory_pool_location(struct smu_context *smu) ...@@ -486,6 +486,14 @@ static int smu_v11_0_notify_memory_pool_location(struct smu_context *smu)
return ret; return ret;
} }
static int smu_v11_0_check_pptable(struct smu_context *smu)
{
int ret;
ret = smu_check_powerplay_table(smu);
return ret;
}
static int smu_v11_0_parse_pptable(struct smu_context *smu) static int smu_v11_0_parse_pptable(struct smu_context *smu)
{ {
int ret; int ret;
...@@ -520,6 +528,7 @@ static const struct smu_funcs smu_v11_0_funcs = { ...@@ -520,6 +528,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values, .get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
.get_clk_info_from_vbios = smu_v11_0_get_clk_info_from_vbios, .get_clk_info_from_vbios = smu_v11_0_get_clk_info_from_vbios,
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location, .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
.check_pptable = smu_v11_0_check_pptable,
.parse_pptable = smu_v11_0_parse_pptable, .parse_pptable = smu_v11_0_parse_pptable,
}; };
......
...@@ -52,8 +52,29 @@ static int vega20_store_powerplay_table(struct smu_context *smu) ...@@ -52,8 +52,29 @@ static int vega20_store_powerplay_table(struct smu_context *smu)
return 0; return 0;
} }
static int vega20_check_powerplay_table(struct smu_context *smu)
{
ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL;
struct smu_table_context *table_context = &smu->smu_table;
powerplay_table = table_context->power_play_table;
if (powerplay_table->sHeader.format_revision < ATOM_VEGA20_TABLE_REVISION_VEGA20) {
pr_err("Unsupported PPTable format!");
return -EINVAL;
}
if (!powerplay_table->sHeader.structuresize) {
pr_err("Invalid PowerPlay Table!");
return -EINVAL;
}
return 0;
}
static const struct pptable_funcs vega20_ppt_funcs = { static const struct pptable_funcs vega20_ppt_funcs = {
.store_powerplay_table = vega20_store_powerplay_table, .store_powerplay_table = vega20_store_powerplay_table,
.check_powerplay_table = vega20_check_powerplay_table,
}; };
void vega20_set_ppt_funcs(struct smu_context *smu) void vega20_set_ppt_funcs(struct smu_context *smu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment