Commit 3e333c6c authored by Likun Gao's avatar Likun Gao Committed by Alex Deucher

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

Add smu_v11_0_parse_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 74e07f9d
...@@ -70,6 +70,7 @@ struct smu_table_context ...@@ -70,6 +70,7 @@ struct smu_table_context
uint32_t power_play_table_size; uint32_t power_play_table_size;
struct smu_bios_boot_up_values boot_values; struct smu_bios_boot_up_values boot_values;
void *driver_pptable;
struct smu_table *tables; struct smu_table *tables;
uint32_t table_count; uint32_t table_count;
struct smu_table memory_pool; struct smu_table memory_pool;
...@@ -177,6 +178,8 @@ struct smu_funcs ...@@ -177,6 +178,8 @@ struct smu_funcs
((smu)->funcs->send_smc_msg? (smu)->funcs->send_smc_msg((smu), (msg)) : 0) ((smu)->funcs->send_smc_msg? (smu)->funcs->send_smc_msg((smu), (msg)) : 0)
#define smu_send_smc_msg_with_param(smu, msg, param) \ #define smu_send_smc_msg_with_param(smu, msg, param) \
((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) \
((smu)->ppt_funcs->store_powerplay_table ? (smu)->ppt_funcs->store_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,25 @@ static int smu_v11_0_notify_memory_pool_location(struct smu_context *smu) ...@@ -486,6 +486,25 @@ static int smu_v11_0_notify_memory_pool_location(struct smu_context *smu)
return ret; return ret;
} }
static int smu_v11_0_parse_pptable(struct smu_context *smu)
{
int ret;
struct smu_table_context *table_context = &smu->smu_table;
if (table_context->driver_pptable)
return -EINVAL;
table_context->driver_pptable = kzalloc(sizeof(PPTable_t), GFP_KERNEL);
if (!table_context->driver_pptable)
return -ENOMEM;
ret = smu_store_powerplay_table(smu);
return ret;
}
static const struct smu_funcs smu_v11_0_funcs = { static const struct smu_funcs smu_v11_0_funcs = {
.init_microcode = smu_v11_0_init_microcode, .init_microcode = smu_v11_0_init_microcode,
.load_microcode = smu_v11_0_load_microcode, .load_microcode = smu_v11_0_load_microcode,
...@@ -501,6 +520,7 @@ static const struct smu_funcs smu_v11_0_funcs = { ...@@ -501,6 +520,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,
.parse_pptable = smu_v11_0_parse_pptable,
}; };
void smu_v11_0_set_smu_funcs(struct smu_context *smu) void smu_v11_0_set_smu_funcs(struct smu_context *smu)
......
...@@ -38,6 +38,17 @@ ...@@ -38,6 +38,17 @@
static int vega20_store_powerplay_table(struct smu_context *smu) static int vega20_store_powerplay_table(struct smu_context *smu)
{ {
ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL;
struct smu_table_context *table_context = &smu->smu_table;
if (!table_context->power_play_table)
return -EINVAL;
powerplay_table = table_context->power_play_table;
memcpy(table_context->driver_pptable, &powerplay_table->smcPPTable,
sizeof(PPTable_t));
return 0; return 0;
} }
......
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