<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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);">
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Sent:</b> Monday, March 1, 2021 5:31 PM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> RE: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">[AMD Public Use]<br>
<br>
+ for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {<br>
<br>
I think we still rely on AMDGPU_INFO_FW_ASD to query ASD firmware version. Therefore, we need to start from TA_FW_TYPE_PSP_XGMI.</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">thanks, yes, the ASD is different with other TAs, I will correct it before submitting.</div>
<div class="PlainText"><br>
+ TA_FW_TYPE_PSP_COUNT,<br>
+ static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT]</div>
<div class="PlainText"><br>
The enum is a little bit confusing, might rename to TA_FW_TYPE_MAX_INDEX, <br>
<br>
Regards,<br>
Hawking<br>
<br>
-----Original Message-----<br>
From: Wang, Kevin(Yang) <Kevin1.Wang@amd.com> <br>
Sent: Monday, March 1, 2021 17:10<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhang, Hawking <Hawking.Zhang@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
Subject: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs<br>
<br>
refine PSP TA firmware info print in amdgpu_firmware_info().<br>
<br>
Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 50 +++++++++--------------<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 +<br>
2 files changed, 21 insertions(+), 30 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
index 6c8ea9d26320..1a27673271b0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
@@ -289,23 +289,23 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,<br>
break;<br>
case AMDGPU_INFO_FW_TA:<br>
switch (query_fw->index) {<br>
- case 0:<br>
+ case TA_FW_TYPE_PSP_XGMI:<br>
fw_info->ver = adev->psp.ta_fw_version;<br>
fw_info->feature = adev->psp.ta_xgmi_ucode_version;<br>
break;<br>
- case 1:<br>
+ case TA_FW_TYPE_PSP_RAS:<br>
fw_info->ver = adev->psp.ta_fw_version;<br>
fw_info->feature = adev->psp.ta_ras_ucode_version;<br>
break;<br>
- case 2:<br>
+ case TA_FW_TYPE_PSP_HDCP:<br>
fw_info->ver = adev->psp.ta_fw_version;<br>
fw_info->feature = adev->psp.ta_hdcp_ucode_version;<br>
break;<br>
- case 3:<br>
+ case TA_FW_TYPE_PSP_DTM:<br>
fw_info->ver = adev->psp.ta_fw_version;<br>
fw_info->feature = adev->psp.ta_dtm_ucode_version;<br>
break;<br>
- case 4:<br>
+ case TA_FW_TYPE_PSP_RAP:<br>
fw_info->ver = adev->psp.ta_fw_version;<br>
fw_info->feature = adev->psp.ta_rap_ucode_version;<br>
break;<br>
@@ -1355,6 +1355,17 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)<br>
struct atom_context *ctx = adev->mode_info.atom_context;<br>
int ret, i;<br>
<br>
+ static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT] = { #define <br>
+TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type<br>
+ TA_FW_NAME(ASD),<br>
+ TA_FW_NAME(XGMI),<br>
+ TA_FW_NAME(RAS),<br>
+ TA_FW_NAME(HDCP),<br>
+ TA_FW_NAME(DTM),<br>
+ TA_FW_NAME(RAP),<br>
+#undef TA_FW_NAME<br>
+ };<br>
+<br>
/* VCE */<br>
query_fw.fw_type = AMDGPU_INFO_FW_VCE;<br>
ret = amdgpu_firmware_info(&fw_info, &query_fw, adev); @@ -1472,35 +1483,14 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)<br>
fw_info.feature, fw_info.ver);<br>
<br>
query_fw.fw_type = AMDGPU_INFO_FW_TA;<br>
- for (i = 0; i < 5; i++) {<br>
+ for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {<br>
query_fw.index = i;<br>
ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);<br>
if (ret)<br>
continue;<br>
- switch (query_fw.index) {<br>
- case 0:<br>
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",<br>
- "RAS", fw_info.feature, fw_info.ver);<br>
- break;<br>
- case 1:<br>
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",<br>
- "XGMI", fw_info.feature, fw_info.ver);<br>
- break;<br>
- case 2:<br>
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",<br>
- "HDCP", fw_info.feature, fw_info.ver);<br>
- break;<br>
- case 3:<br>
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",<br>
- "DTM", fw_info.feature, fw_info.ver);<br>
- break;<br>
- case 4:<br>
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",<br>
- "RAP", fw_info.feature, fw_info.ver);<br>
- break;<br>
- default:<br>
- return -EINVAL;<br>
- }<br>
+<br>
+ seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",<br>
+ ta_fw_name[i], fw_info.feature, fw_info.ver);<br>
}<br>
<br>
/* SMC */<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h<br>
index 46449e70348b..c03f32ec3ebc 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h<br>
@@ -136,6 +136,7 @@ enum ta_fw_type {<br>
TA_FW_TYPE_PSP_DTM,<br>
TA_FW_TYPE_PSP_RAP,<br>
TA_FW_TYPE_PSP_SECUREDISPLAY,<br>
+ TA_FW_TYPE_PSP_COUNT,<br>
};<br>
<br>
struct ta_fw_bin_desc {<br>
--<br>
2.17.1<br>
</div>
</span></font></div>
</div>
</body>
</html>