Commit a7d4c920 authored by Tianci.Yin's avatar Tianci.Yin Committed by Alex Deucher

drm/amdgpu: introduce psp_v11_0_is_sos_alive interface(v2)

introduce psp_v11_0_is_sos_alive func for common use.
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
Signed-off-by: default avatarTianci.Yin <tianci.yin@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e35e2b11
...@@ -206,18 +206,26 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) ...@@ -206,18 +206,26 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
return err; return err;
} }
static bool psp_v11_0_is_sos_alive(struct psp_context *psp)
{
struct amdgpu_device *adev = psp->adev;
uint32_t sol_reg;
sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
return sol_reg != 0x0;
}
static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp)
{ {
int ret; int ret;
uint32_t psp_gfxdrv_command_reg = 0; uint32_t psp_gfxdrv_command_reg = 0;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
uint32_t sol_reg;
/* Check tOS sign of life register to confirm sys driver and sOS /* Check tOS sign of life register to confirm sys driver and sOS
* are already been loaded. * are already been loaded.
*/ */
sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); if (psp_v11_0_is_sos_alive(psp)) {
if (sol_reg) {
psp->sos_fw_version = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58); psp->sos_fw_version = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58);
dev_info(adev->dev, "sos fw version = 0x%x.\n", psp->sos_fw_version); dev_info(adev->dev, "sos fw version = 0x%x.\n", psp->sos_fw_version);
return 0; return 0;
...@@ -253,13 +261,11 @@ static int psp_v11_0_bootloader_load_sysdrv(struct psp_context *psp) ...@@ -253,13 +261,11 @@ static int psp_v11_0_bootloader_load_sysdrv(struct psp_context *psp)
int ret; int ret;
uint32_t psp_gfxdrv_command_reg = 0; uint32_t psp_gfxdrv_command_reg = 0;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
uint32_t sol_reg;
/* Check sOS sign of life register to confirm sys driver and sOS /* Check sOS sign of life register to confirm sys driver and sOS
* are already been loaded. * are already been loaded.
*/ */
sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); if (psp_v11_0_is_sos_alive(psp)) {
if (sol_reg) {
psp->sos_fw_version = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58); psp->sos_fw_version = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58);
dev_info(adev->dev, "sos fw version = 0x%x.\n", psp->sos_fw_version); dev_info(adev->dev, "sos fw version = 0x%x.\n", psp->sos_fw_version);
return 0; return 0;
...@@ -297,13 +303,11 @@ static int psp_v11_0_bootloader_load_sos(struct psp_context *psp) ...@@ -297,13 +303,11 @@ static int psp_v11_0_bootloader_load_sos(struct psp_context *psp)
int ret; int ret;
unsigned int psp_gfxdrv_command_reg = 0; unsigned int psp_gfxdrv_command_reg = 0;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
uint32_t sol_reg;
/* Check sOS sign of life register to confirm sys driver and sOS /* Check sOS sign of life register to confirm sys driver and sOS
* are already been loaded. * are already been loaded.
*/ */
sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); if (psp_v11_0_is_sos_alive(psp))
if (sol_reg)
return 0; return 0;
/* Wait for bootloader to signify that is ready having bit 31 of C2PMSG_35 set to 1 */ /* Wait for bootloader to signify that is ready having bit 31 of C2PMSG_35 set to 1 */
......
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