Commit 2ae6cd58 authored by Le Ma's avatar Le Ma Committed by Alex Deucher

drm/amdgpu: add psp funcs callback to check if aux fw is needed

Query pmfw version to determine if aux sos fw needs to be loaded
in psp v13.0.

v2: refine callback to check if aux_fw loading is needed instead of
    getting pmfw version barely
v3: return the comparison directly
Signed-off-by: default avatarLe Ma <le.ma@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 151b1813
...@@ -138,6 +138,7 @@ struct psp_funcs { ...@@ -138,6 +138,7 @@ struct psp_funcs {
int (*vbflash_stat)(struct psp_context *psp); int (*vbflash_stat)(struct psp_context *psp);
int (*fatal_error_recovery_quirk)(struct psp_context *psp); int (*fatal_error_recovery_quirk)(struct psp_context *psp);
bool (*get_ras_capability)(struct psp_context *psp); bool (*get_ras_capability)(struct psp_context *psp);
bool (*is_aux_sos_load_required)(struct psp_context *psp);
}; };
struct ta_funcs { struct ta_funcs {
...@@ -464,6 +465,9 @@ struct amdgpu_psp_funcs { ...@@ -464,6 +465,9 @@ struct amdgpu_psp_funcs {
((psp)->funcs->fatal_error_recovery_quirk ? \ ((psp)->funcs->fatal_error_recovery_quirk ? \
(psp)->funcs->fatal_error_recovery_quirk((psp)) : 0) (psp)->funcs->fatal_error_recovery_quirk((psp)) : 0)
#define psp_is_aux_sos_load_required(psp) \
((psp)->funcs->is_aux_sos_load_required ? (psp)->funcs->is_aux_sos_load_required((psp)) : 0)
extern const struct amd_ip_funcs psp_ip_funcs; extern const struct amd_ip_funcs psp_ip_funcs;
extern const struct amdgpu_ip_block_version psp_v3_1_ip_block; extern const struct amdgpu_ip_block_version psp_v3_1_ip_block;
......
...@@ -81,6 +81,8 @@ MODULE_FIRMWARE("amdgpu/psp_14_0_4_ta.bin"); ...@@ -81,6 +81,8 @@ MODULE_FIRMWARE("amdgpu/psp_14_0_4_ta.bin");
/* memory training timeout define */ /* memory training timeout define */
#define MEM_TRAIN_SEND_MSG_TIMEOUT_US 3000000 #define MEM_TRAIN_SEND_MSG_TIMEOUT_US 3000000
#define regMP1_PUB_SCRATCH0 0x3b10090
static int psp_v13_0_init_microcode(struct psp_context *psp) static int psp_v13_0_init_microcode(struct psp_context *psp)
{ {
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
...@@ -807,6 +809,20 @@ static bool psp_v13_0_get_ras_capability(struct psp_context *psp) ...@@ -807,6 +809,20 @@ static bool psp_v13_0_get_ras_capability(struct psp_context *psp)
} }
} }
static bool psp_v13_0_is_aux_sos_load_required(struct psp_context *psp)
{
struct amdgpu_device *adev = psp->adev;
u32 pmfw_ver;
if (amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(13, 0, 6))
return false;
/* load 4e version of sos if pmfw version less than 85.115.0 */
pmfw_ver = RREG32(regMP1_PUB_SCRATCH0 / 4);
return (pmfw_ver < 0x557300);
}
static const struct psp_funcs psp_v13_0_funcs = { static const struct psp_funcs psp_v13_0_funcs = {
.init_microcode = psp_v13_0_init_microcode, .init_microcode = psp_v13_0_init_microcode,
.wait_for_bootloader = psp_v13_0_wait_for_bootloader_steady_state, .wait_for_bootloader = psp_v13_0_wait_for_bootloader_steady_state,
...@@ -830,6 +846,7 @@ static const struct psp_funcs psp_v13_0_funcs = { ...@@ -830,6 +846,7 @@ static const struct psp_funcs psp_v13_0_funcs = {
.vbflash_stat = psp_v13_0_vbflash_status, .vbflash_stat = psp_v13_0_vbflash_status,
.fatal_error_recovery_quirk = psp_v13_0_fatal_error_recovery_quirk, .fatal_error_recovery_quirk = psp_v13_0_fatal_error_recovery_quirk,
.get_ras_capability = psp_v13_0_get_ras_capability, .get_ras_capability = psp_v13_0_get_ras_capability,
.is_aux_sos_load_required = psp_v13_0_is_aux_sos_load_required,
}; };
void psp_v13_0_set_psp_funcs(struct psp_context *psp) void psp_v13_0_set_psp_funcs(struct psp_context *psp)
......
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