Commit b5604512 authored by Aaron Liu's avatar Aaron Liu Committed by Alex Deucher

drm/amd/powerplay: using valid mapping check for rn

Check whether the message mapping is valid
Signed-off-by: default avatarAaron Liu <aaron.liu@amd.com>
Reviewed-by: default avatarKenneth Feng <kenneth.feng@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarKevin Wang <kevin1.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a31b059b
...@@ -32,6 +32,11 @@ ...@@ -32,6 +32,11 @@
#define MP1_SRAM 0x03c00004 #define MP1_SRAM 0x03c00004
struct smu_12_0_cmn2aisc_mapping {
int valid_mapping;
int map_to;
};
void smu_v12_0_set_smu_funcs(struct smu_context *smu); void smu_v12_0_set_smu_funcs(struct smu_context *smu);
#endif #endif
...@@ -26,13 +26,14 @@ ...@@ -26,13 +26,14 @@
#include "soc15_common.h" #include "soc15_common.h"
#include "smu_v12_0_ppsmc.h" #include "smu_v12_0_ppsmc.h"
#include "smu12_driver_if.h" #include "smu12_driver_if.h"
#include "smu_v12_0.h"
#include "renoir_ppt.h" #include "renoir_ppt.h"
#define MSG_MAP(msg, index) \ #define MSG_MAP(msg, index) \
[SMU_MSG_##msg] = index [SMU_MSG_##msg] = {1, (index)}
static int renoir_message_map[SMU_MSG_MAX_COUNT] = { static struct smu_12_0_cmn2aisc_mapping renoir_message_map[SMU_MSG_MAX_COUNT] = {
MSG_MAP(TestMessage, PPSMC_MSG_TestMessage), MSG_MAP(TestMessage, PPSMC_MSG_TestMessage),
MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion), MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion),
MSG_MAP(GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion), MSG_MAP(GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion),
...@@ -98,16 +99,16 @@ static int renoir_message_map[SMU_MSG_MAX_COUNT] = { ...@@ -98,16 +99,16 @@ static int renoir_message_map[SMU_MSG_MAX_COUNT] = {
static int renoir_get_smu_msg_index(struct smu_context *smc, uint32_t index) static int renoir_get_smu_msg_index(struct smu_context *smc, uint32_t index)
{ {
int val; struct smu_12_0_cmn2aisc_mapping mapping;
if (index >= SMU_MSG_MAX_COUNT) if (index >= SMU_MSG_MAX_COUNT)
return -EINVAL; return -EINVAL;
val = renoir_message_map[index]; mapping = renoir_message_map[index];
if (val > PPSMC_Message_Count) if (!(mapping.valid_mapping))
return -EINVAL; return -EINVAL;
return val; return mapping.map_to;
} }
......
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