[PATCH 03/10] drm/amdgpu: add helper to init rlc fw in header v2_2

Zhang, Hawking Hawking.Zhang at amd.com
Mon Sep 19 02:31:44 UTC 2022


[AMD Official Use Only - General]

[Kevin]:
according to code logic in above, the following code is not needed to convert again.
ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_dram_ucode_size_bytes), PAGE_SIZE);

Good catch. will make the change when push the code.

Regards,
Hawking

From: Wang, Yang(Kevin) <KevinYang.Wang at amd.com>
Date: Monday, September 19, 2022 at 01:15
To: Zhang, Hawking <Hawking.Zhang at amd.com>, amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>, Gao, Likun <Likun.Gao at amd.com>, Deucher, Alexander <Alexander.Deucher at amd.com>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>
Subject: RE: [PATCH 03/10] drm/amdgpu: add helper to init rlc fw in header v2_2
[AMD Official Use Only - General]

-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Hawking Zhang
Sent: Friday, September 16, 2022 1:01 AM
To: amd-gfx at lists.freedesktop.org; Gao, Likun <Likun.Gao at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>
Subject: [PATCH 03/10] 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 <Hawking.Zhang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c | 30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c
index 04bdb885918d..a055818d87f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c
@@ -376,3 +376,33 @@ static void amdgpu_gfx_rlc_init_microcode_v2_1(struct amdgpu_device *adev)
                }
        }
 }
+
+static void amdgpu_gfx_rlc_init_microcode_v2_2(struct amdgpu_device
+*adev) {
+       const struct rlc_firmware_header_v2_2 *rlc_hdr;
+       struct amdgpu_firmware_info *info;
+
+       rlc_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;
+       adev->gfx.rlc.rlc_iram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_iram_ucode_size_bytes);
+       adev->gfx.rlc.rlc_iram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_iram_ucode_offset_bytes);
+       adev->gfx.rlc.rlc_dram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_dram_ucode_size_bytes);
+       adev->gfx.rlc.rlc_dram_ucode = (u8 *)rlc_hdr +
+le32_to_cpu(rlc_hdr->rlc_dram_ucode_offset_bytes);
+
+       if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
+               if (adev->gfx.rlc.rlc_iram_ucode_size_bytes) {
+                       info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM];
+                       info->ucode_id = AMDGPU_UCODE_ID_RLC_IRAM;
+                       info->fw = adev->gfx.rlc_fw;
+                       adev->firmware.fw_size +=
+                               ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_iram_ucode_size_bytes), PAGE_SIZE);
+               }
+
+               if (adev->gfx.rlc.rlc_dram_ucode_size_bytes) {
+                       info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM];
+                       info->ucode_id = AMDGPU_UCODE_ID_RLC_DRAM;
+                       info->fw = adev->gfx.rlc_fw;
+                       adev->firmware.fw_size +=
+                               ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_dram_ucode_size_bytes), PAGE_SIZE);
+               }
+       }

[Kevin]:
according to code logic in above, the following code is not needed to convert again.
ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_dram_ucode_size_bytes), PAGE_SIZE);

Best Regards,
Kevin
+}
--
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220919/05a5a01d/attachment.htm>


More information about the amd-gfx mailing list