mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-27 11:58:32 -04:00
drm/amdgpu: add generic func to check if ta fw is applicable
Separated xgmi ta is required for specific APU, and driver needs parse the ta binary properly with aux xgmi ta packed. v2: make the check function more generic (Lijo) Signed-off-by: Le Ma <le.ma@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -3563,6 +3563,36 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static bool is_ta_fw_applicable(struct psp_context *psp,
|
||||
const struct psp_fw_bin_desc *desc)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
uint32_t fw_version;
|
||||
|
||||
switch (desc->fw_type) {
|
||||
case TA_FW_TYPE_PSP_XGMI:
|
||||
case TA_FW_TYPE_PSP_XGMI_AUX:
|
||||
/* for now, AUX TA only exists on 13.0.6 ta bin,
|
||||
* from v20.00.0x.14
|
||||
*/
|
||||
if (amdgpu_ip_version(adev, MP0_HWIP, 0) ==
|
||||
IP_VERSION(13, 0, 6)) {
|
||||
fw_version = le32_to_cpu(desc->fw_version);
|
||||
|
||||
if (adev->flags & AMD_IS_APU &&
|
||||
(fw_version & 0xff) >= 0x14)
|
||||
return desc->fw_type == TA_FW_TYPE_PSP_XGMI_AUX;
|
||||
else
|
||||
return desc->fw_type == TA_FW_TYPE_PSP_XGMI;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int parse_ta_bin_descriptor(struct psp_context *psp,
|
||||
const struct psp_fw_bin_desc *desc,
|
||||
const struct ta_firmware_header_v2_0 *ta_hdr)
|
||||
@@ -3572,6 +3602,9 @@ static int parse_ta_bin_descriptor(struct psp_context *psp,
|
||||
if (!psp || !desc || !ta_hdr)
|
||||
return -EINVAL;
|
||||
|
||||
if (!is_ta_fw_applicable(psp, desc))
|
||||
return 0;
|
||||
|
||||
ucode_start_addr = (uint8_t *)ta_hdr +
|
||||
le32_to_cpu(desc->offset_bytes) +
|
||||
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
|
||||
@@ -3584,6 +3617,7 @@ static int parse_ta_bin_descriptor(struct psp_context *psp,
|
||||
psp->asd_context.bin_desc.start_addr = ucode_start_addr;
|
||||
break;
|
||||
case TA_FW_TYPE_PSP_XGMI:
|
||||
case TA_FW_TYPE_PSP_XGMI_AUX:
|
||||
psp->xgmi_context.context.bin_desc.fw_version = le32_to_cpu(desc->fw_version);
|
||||
psp->xgmi_context.context.bin_desc.size_bytes = le32_to_cpu(desc->size_bytes);
|
||||
psp->xgmi_context.context.bin_desc.start_addr = ucode_start_addr;
|
||||
|
||||
Reference in New Issue
Block a user