From: Huang Rui <[email protected]>

This will be used for newer asics.

Signed-off-by: Huang Rui <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 0f0b381..be16377 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -232,9 +232,12 @@ static int amdgpu_ucode_init_single_fw(struct 
amdgpu_firmware_info *ucode,
                return 0;
 
        header = (const struct common_firmware_header *)ucode->fw->data;
+
+       ucode->ucode_size = le32_to_cpu(header->ucode_size_bytes);
+
        memcpy(ucode->kaddr, (void *)((uint8_t *)ucode->fw->data +
-               le32_to_cpu(header->ucode_array_offset_bytes)),
-               le32_to_cpu(header->ucode_size_bytes));
+              le32_to_cpu(header->ucode_array_offset_bytes)),
+              ucode->ucode_size);
 
        return 0;
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
index a8a4230..19a584c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
@@ -161,6 +161,8 @@ struct amdgpu_firmware_info {
        uint64_t mc_addr;
        /* kernel linear address */
        void *kaddr;
+       /* ucode_size_bytes */
+       uint32_t ucode_size;
 };
 
 void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to