Skip to content

Commit c1c3f41

Browse files
Hawking Zhangalexdeucher
authored andcommitted
drm/amdgpu: add helper to init rlc fw in header v2_3
To initialize rlc firmware in header v2_3 Signed-off-by: Hawking Zhang <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent bcecb65 commit c1c3f41

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,38 @@ static void amdgpu_gfx_rlc_init_microcode_v2_2(struct amdgpu_device *adev)
406406
}
407407
}
408408
}
409+
410+
static void amdgpu_gfx_rlc_init_microcode_v2_3(struct amdgpu_device *adev)
411+
{
412+
const struct rlc_firmware_header_v2_3 *rlc_hdr;
413+
struct amdgpu_firmware_info *info;
414+
415+
rlc_hdr = (const struct rlc_firmware_header_v2_3 *)adev->gfx.rlc_fw->data;
416+
adev->gfx.rlcp_ucode_version = le32_to_cpu(rlc_hdr->rlcp_ucode_version);
417+
adev->gfx.rlcp_ucode_feature_version = le32_to_cpu(rlc_hdr->rlcp_ucode_feature_version);
418+
adev->gfx.rlc.rlcp_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlcp_ucode_size_bytes);
419+
adev->gfx.rlc.rlcp_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlcp_ucode_offset_bytes);
420+
421+
adev->gfx.rlcv_ucode_version = le32_to_cpu(rlc_hdr->rlcv_ucode_version);
422+
adev->gfx.rlcv_ucode_feature_version = le32_to_cpu(rlc_hdr->rlcv_ucode_feature_version);
423+
adev->gfx.rlc.rlcv_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlcv_ucode_size_bytes);
424+
adev->gfx.rlc.rlcv_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlcv_ucode_offset_bytes);
425+
426+
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
427+
if (adev->gfx.rlc.rlcp_ucode_size_bytes) {
428+
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_P];
429+
info->ucode_id = AMDGPU_UCODE_ID_RLC_P;
430+
info->fw = adev->gfx.rlc_fw;
431+
adev->firmware.fw_size +=
432+
ALIGN(adev->gfx.rlc.rlcp_ucode_size_bytes, PAGE_SIZE);
433+
}
434+
435+
if (adev->gfx.rlc.rlcv_ucode_size_bytes) {
436+
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_V];
437+
info->ucode_id = AMDGPU_UCODE_ID_RLC_V;
438+
info->fw = adev->gfx.rlc_fw;
439+
adev->firmware.fw_size +=
440+
ALIGN(adev->gfx.rlc.rlcv_ucode_size_bytes, PAGE_SIZE);
441+
}
442+
}
443+
}

0 commit comments

Comments
 (0)