Skip to content

Commit bcecb65

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

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,33 @@ static void amdgpu_gfx_rlc_init_microcode_v2_1(struct amdgpu_device *adev)
376376
}
377377
}
378378
}
379+
380+
static void amdgpu_gfx_rlc_init_microcode_v2_2(struct amdgpu_device *adev)
381+
{
382+
const struct rlc_firmware_header_v2_2 *rlc_hdr;
383+
struct amdgpu_firmware_info *info;
384+
385+
rlc_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;
386+
adev->gfx.rlc.rlc_iram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_iram_ucode_size_bytes);
387+
adev->gfx.rlc.rlc_iram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_iram_ucode_offset_bytes);
388+
adev->gfx.rlc.rlc_dram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_dram_ucode_size_bytes);
389+
adev->gfx.rlc.rlc_dram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_dram_ucode_offset_bytes);
390+
391+
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
392+
if (adev->gfx.rlc.rlc_iram_ucode_size_bytes) {
393+
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM];
394+
info->ucode_id = AMDGPU_UCODE_ID_RLC_IRAM;
395+
info->fw = adev->gfx.rlc_fw;
396+
adev->firmware.fw_size +=
397+
ALIGN(adev->gfx.rlc.rlc_iram_ucode_size_bytes, PAGE_SIZE);
398+
}
399+
400+
if (adev->gfx.rlc.rlc_dram_ucode_size_bytes) {
401+
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM];
402+
info->ucode_id = AMDGPU_UCODE_ID_RLC_DRAM;
403+
info->fw = adev->gfx.rlc_fw;
404+
adev->firmware.fw_size +=
405+
ALIGN(adev->gfx.rlc.rlc_dram_ucode_size_bytes, PAGE_SIZE);
406+
}
407+
}
408+
}

0 commit comments

Comments
 (0)