<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Times New Roman",serif">[Kevin]:<br>
according to code logic in above, the following code is not needed to convert again.<br>
ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_dram_ucode_size_bytes), PAGE_SIZE);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Good catch. will make the change when push the code.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Regards,<br>
Hawking</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Wang, Yang(Kevin) <KevinYang.Wang@amd.com><br>
<b>Date: </b>Monday, September 19, 2022 at 01:15<br>
<b>To: </b>Zhang, Hawking <Hawking.Zhang@amd.com>, amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>, Gao, Likun <Likun.Gao@amd.com>, Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc: </b>Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject: </b>RE: [PATCH 03/10] drm/amdgpu: add helper to init rlc fw in header v2_2<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><a name="BM_BEGIN"></a><span style="font-size:11.0pt;font-family:"Times New Roman",serif">[AMD Official Use Only - General]<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Hawking Zhang<br>
Sent: Friday, September 16, 2022 1:01 AM<br>
To: amd-gfx@lists.freedesktop.org; Gao, Likun <Likun.Gao@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
Cc: Zhang, Hawking <Hawking.Zhang@amd.com><br>
Subject: [PATCH 03/10] drm/amdgpu: add helper to init rlc fw in header v2_2<br>
<br>
To initialize rlc firmware in header v2_2<br>
<br>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c | 30 +++++++++++++++++++++++++<br>
 1 file changed, 30 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c<br>
index 04bdb885918d..a055818d87f7 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c<br>
@@ -376,3 +376,33 @@ static void amdgpu_gfx_rlc_init_microcode_v2_1(struct amdgpu_device *adev)<br>
                }<br>
        }<br>
 }<br>
+<br>
+static void amdgpu_gfx_rlc_init_microcode_v2_2(struct amdgpu_device<br>
+*adev) {<br>
+       const struct rlc_firmware_header_v2_2 *rlc_hdr;<br>
+       struct amdgpu_firmware_info *info;<br>
+<br>
+       rlc_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;<br>
+       adev->gfx.rlc.rlc_iram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_iram_ucode_size_bytes);<br>
+       adev->gfx.rlc.rlc_iram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_iram_ucode_offset_bytes);<br>
+       adev->gfx.rlc.rlc_dram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_dram_ucode_size_bytes);<br>
+       adev->gfx.rlc.rlc_dram_ucode = (u8 *)rlc_hdr +<br>
+le32_to_cpu(rlc_hdr->rlc_dram_ucode_offset_bytes);<br>
+<br>
+       if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {<br>
+               if (adev->gfx.rlc.rlc_iram_ucode_size_bytes) {<br>
+                       info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM];<br>
+                       info->ucode_id = AMDGPU_UCODE_ID_RLC_IRAM;<br>
+                       info->fw = adev->gfx.rlc_fw;<br>
+                       adev->firmware.fw_size +=<br>
+                               ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_iram_ucode_size_bytes), PAGE_SIZE);<br>
+               }<br>
+<br>
+               if (adev->gfx.rlc.rlc_dram_ucode_size_bytes) {<br>
+                       info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM];<br>
+                       info->ucode_id = AMDGPU_UCODE_ID_RLC_DRAM;<br>
+                       info->fw = adev->gfx.rlc_fw;<br>
+                       adev->firmware.fw_size +=<br>
+                               ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_dram_ucode_size_bytes), PAGE_SIZE);<br>
+               }<br>
+       }<br>
<br>
[Kevin]:<br>
according to code logic in above, the following code is not needed to convert again.<br>
ALIGN(le32_to_cpu(adev->gfx.rlc.rlc_dram_ucode_size_bytes), PAGE_SIZE);<br>
<br>
Best Regards,<br>
Kevin<br>
+}<br>
--<br>
2.17.1</span><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>