<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We also need to release the firmware when the driver unloads or is that already handled in some common path?<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Changfeng.Zhu <changfeng.zhu@amd.com><br>
<b>Sent:</b> Tuesday, September 1, 2020 10:25 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Huang, Ray <Ray.Huang@amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com><br>
<b>Cc:</b> Zhu, Changfeng <Changfeng.Zhu@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: add ta firmware load in psp_v12_0 for renoir</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: changzhu <Changfeng.Zhu@amd.com><br>
<br>
From: Changfeng <Changfeng.Zhu@amd.com><br>
<br>
It needs to load renoir_ta firmware because hdcp is enabled by default<br>
for renoir now. This can avoid error:DTM TA is not initialized<br>
<br>
Change-Id: Ib2f03a531013e4b432c2e9d4ec3dc021b4f8da7d<br>
Signed-off-by: Changfeng <Changfeng.Zhu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 54 ++++++++++++++++++++++++++<br>
 1 file changed, 54 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c<br>
index 6c9614f77d33..75489313dbad 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c<br>
@@ -38,6 +38,8 @@<br>
 #include "oss/osssys_4_0_sh_mask.h"<br>
 <br>
 MODULE_FIRMWARE("amdgpu/renoir_asd.bin");<br>
+MODULE_FIRMWARE("amdgpu/renoir_ta.bin");<br>
+<br>
 /* address block */<br>
 #define smnMP1_FIRMWARE_FLAGS           0x3010024<br>
 <br>
@@ -45,7 +47,10 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)<br>
 {<br>
         struct amdgpu_device *adev = psp->adev;<br>
         const char *chip_name;<br>
+       char fw_name[30];<br>
         int err = 0;<br>
+       const struct ta_firmware_header_v1_0 *ta_hdr;<br>
+       DRM_DEBUG("\n");<br>
 <br>
         switch (adev->asic_type) {<br>
         case CHIP_RENOIR:<br>
@@ -56,6 +61,55 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)<br>
         }<br>
 <br>
         err = psp_init_asd_microcode(psp, chip_name);<br>
+       if (err)<br>
+               goto out;<br>
+<br>
+       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);<br>
+       err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);<br>
+       if (err) {<br>
+               release_firmware(adev->psp.ta_fw);<br>
+               adev->psp.ta_fw = NULL;<br>
+               dev_info(adev->dev,<br>
+                        "psp v12.0: Failed to load firmware \"%s\"\n",<br>
+                        fw_name);<br>
+       } else {<br>
+               err = amdgpu_ucode_validate(adev->psp.ta_fw);<br>
+               if (err)<br>
+                       goto out2;<br>
+<br>
+               ta_hdr = (const struct ta_firmware_header_v1_0 *)<br>
+                                adev->psp.ta_fw->data;<br>
+               adev->psp.ta_hdcp_ucode_version =<br>
+                       le32_to_cpu(ta_hdr->ta_hdcp_ucode_version);<br>
+               adev->psp.ta_hdcp_ucode_size =<br>
+                       le32_to_cpu(ta_hdr->ta_hdcp_size_bytes);<br>
+               adev->psp.ta_hdcp_start_addr =<br>
+                       (uint8_t *)ta_hdr +<br>
+                       le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);<br>
+<br>
+               adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);<br>
+<br>
+               adev->psp.ta_dtm_ucode_version =<br>
+                       le32_to_cpu(ta_hdr->ta_dtm_ucode_version);<br>
+               adev->psp.ta_dtm_ucode_size =<br>
+                       le32_to_cpu(ta_hdr->ta_dtm_size_bytes);<br>
+               adev->psp.ta_dtm_start_addr =<br>
+                       (uint8_t *)adev->psp.ta_hdcp_start_addr +<br>
+                       le32_to_cpu(ta_hdr->ta_dtm_offset_bytes);<br>
+       }<br>
+<br>
+       return 0;<br>
+<br>
+out2:<br>
+       release_firmware(adev->psp.ta_fw);<br>
+       adev->psp.ta_fw = NULL;<br>
+out:<br>
+       if (err) {<br>
+               dev_err(adev->dev,<br>
+                       "psp v12.0: Failed to load firmware \"%s\"\n",<br>
+                       fw_name);<br>
+       }<br>
+<br>
         return err;<br>
 }<br>
 <br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7C324a6285d81146a0639b08d84ee78d14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637346103730596780&amp;sdata=ItQDVbjEzkmKeeEU%2BV01rQb4iGuWvHaqRAFlC4e6oqI%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7C324a6285d81146a0639b08d84ee78d14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637346103730596780&amp;sdata=ItQDVbjEzkmKeeEU%2BV01rQb4iGuWvHaqRAFlC4e6oqI%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>