Commit 2a9a151f authored by John Clements's avatar John Clements Committed by Alex Deucher

drm/amdgpu: Added support for loading auxiliary PSP FW

In the case with xgmi connected to cpu load alternate psp fw
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarJohn Clements <john.clements@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 79a0f441
...@@ -2797,6 +2797,48 @@ int psp_init_toc_microcode(struct psp_context *psp, ...@@ -2797,6 +2797,48 @@ int psp_init_toc_microcode(struct psp_context *psp,
return err; return err;
} }
static int psp_init_sos_base_fw(struct amdgpu_device *adev)
{
const struct psp_firmware_header_v1_0 *sos_hdr;
const struct psp_firmware_header_v1_3 *sos_hdr_v1_3;
sos_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.sos_fw->data;
if (adev->gmc.xgmi.connected_to_cpu || (adev->asic_type != CHIP_ALDEBARAN)) {
adev->psp.sos_fw_version = le32_to_cpu(sos_hdr->header.ucode_version);
adev->psp.sos_feature_version = le32_to_cpu(sos_hdr->sos.fw_version);
adev->psp.sys_bin_size = le32_to_cpu(sos_hdr->sos.offset_bytes);
adev->psp.sys_start_addr = (uint8_t *)sos_hdr +
le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);
adev->psp.sos_bin_size = le32_to_cpu(sos_hdr->sos.size_bytes);
adev->psp.sos_start_addr = (uint8_t *)adev->psp.sys_start_addr +
le32_to_cpu(sos_hdr->sos.offset_bytes);
} else {
/* Load alternate PSP SOS FW */
sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;
adev->psp.sos_fw_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);
adev->psp.sos_feature_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);
adev->psp.sys_bin_size = le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.size_bytes);
adev->psp.sys_start_addr = (uint8_t *)adev->psp.sys_start_addr +
le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.offset_bytes);
adev->psp.sos_bin_size = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);
adev->psp.sos_start_addr = (uint8_t *)adev->psp.sys_start_addr +
le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
}
if ((adev->psp.sys_bin_size == 0) || (adev->psp.sos_bin_size == 0)) {
dev_warn(adev->dev, "PSP SOS FW not available");
return -EINVAL;
}
return 0;
}
int psp_init_sos_microcode(struct psp_context *psp, int psp_init_sos_microcode(struct psp_context *psp,
const char *chip_name) const char *chip_name)
{ {
...@@ -2827,14 +2869,10 @@ int psp_init_sos_microcode(struct psp_context *psp, ...@@ -2827,14 +2869,10 @@ int psp_init_sos_microcode(struct psp_context *psp,
switch (sos_hdr->header.header_version_major) { switch (sos_hdr->header.header_version_major) {
case 1: case 1:
adev->psp.sos_fw_version = le32_to_cpu(sos_hdr->header.ucode_version); err = psp_init_sos_base_fw(adev);
adev->psp.sos_feature_version = le32_to_cpu(sos_hdr->sos.fw_version); if (err)
adev->psp.sos_bin_size = le32_to_cpu(sos_hdr->sos.size_bytes); goto out;
adev->psp.sys_bin_size = le32_to_cpu(sos_hdr->sos.offset_bytes);
adev->psp.sys_start_addr = (uint8_t *)sos_hdr +
le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);
adev->psp.sos_start_addr = (uint8_t *)adev->psp.sys_start_addr +
le32_to_cpu(sos_hdr->sos.offset_bytes);
if (sos_hdr->header.header_version_minor == 1) { if (sos_hdr->header.header_version_minor == 1) {
sos_hdr_v1_1 = (const struct psp_firmware_header_v1_1 *)adev->psp.sos_fw->data; sos_hdr_v1_1 = (const struct psp_firmware_header_v1_1 *)adev->psp.sos_fw->data;
adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_1->toc.size_bytes); adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_1->toc.size_bytes);
......
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