diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/psp_v3_1.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c index 0c768e388ace..727071fee6f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | |||
@@ -47,6 +47,8 @@ MODULE_FIRMWARE("amdgpu/vega20_asd.bin"); | |||
47 | 47 | ||
48 | #define smnMP1_FIRMWARE_FLAGS 0x3010028 | 48 | #define smnMP1_FIRMWARE_FLAGS 0x3010028 |
49 | 49 | ||
50 | static uint32_t sos_old_versions[] = {1517616, 1510592, 1448594, 1446554}; | ||
51 | |||
50 | static int | 52 | static int |
51 | psp_v3_1_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *type) | 53 | psp_v3_1_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *type) |
52 | { | 54 | { |
@@ -210,12 +212,31 @@ static int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp) | |||
210 | return ret; | 212 | return ret; |
211 | } | 213 | } |
212 | 214 | ||
215 | static bool psp_v3_1_match_version(struct amdgpu_device *adev, uint32_t ver) | ||
216 | { | ||
217 | int i; | ||
218 | |||
219 | if (ver == adev->psp.sos_fw_version) | ||
220 | return true; | ||
221 | |||
222 | /* | ||
223 | * Double check if the latest four legacy versions. | ||
224 | * If yes, it is still the right version. | ||
225 | */ | ||
226 | for (i = 0; i < sizeof(sos_old_versions) / sizeof(uint32_t); i++) { | ||
227 | if (sos_old_versions[i] == adev->psp.sos_fw_version) | ||
228 | return true; | ||
229 | } | ||
230 | |||
231 | return false; | ||
232 | } | ||
233 | |||
213 | static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) | 234 | static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) |
214 | { | 235 | { |
215 | int ret; | 236 | int ret; |
216 | unsigned int psp_gfxdrv_command_reg = 0; | 237 | unsigned int psp_gfxdrv_command_reg = 0; |
217 | struct amdgpu_device *adev = psp->adev; | 238 | struct amdgpu_device *adev = psp->adev; |
218 | uint32_t sol_reg; | 239 | uint32_t sol_reg, ver; |
219 | 240 | ||
220 | /* Check sOS sign of life register to confirm sys driver and sOS | 241 | /* Check sOS sign of life register to confirm sys driver and sOS |
221 | * are already been loaded. | 242 | * are already been loaded. |
@@ -248,6 +269,10 @@ static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) | |||
248 | RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81), | 269 | RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81), |
249 | 0, true); | 270 | 0, true); |
250 | 271 | ||
272 | ver = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58); | ||
273 | if (!psp_v3_1_match_version(adev, ver)) | ||
274 | DRM_WARN("SOS version doesn't match\n"); | ||
275 | |||
251 | return ret; | 276 | return ret; |
252 | } | 277 | } |
253 | 278 | ||