drm/amdgpu: add a ucode size member into firmware info
authorHuang Rui <ray.huang@amd.com>
Mon, 10 Oct 2016 07:19:06 +0000 (15:19 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:53:39 +0000 (23:53 -0400)
This will be used for newer asics.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h

index 0f0b38191fac899f90592c107fca8eee826b5448..be16377128c32b55d5138d45fe452c98a35ef77a 100644 (file)
@@ -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;
 }
index a8a4230729f952074219dd5db3f025d609577ca2..19a584cd452702dc2ba685ee7562d5534869ede1 100644 (file)
@@ -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);