Re: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Public Use]





From: Zhang, Hawking <Hawking.Zhang@xxxxxxx>
Sent: Monday, March 1, 2021 5:31 PM
To: Wang, Kevin(Yang) <Kevin1.Wang@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs
 
[AMD Public Use]

+       for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {

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.

[kevin]:
thanks, yes,  the ASD is different with other TAs, I will correct it before submitting.

+       TA_FW_TYPE_PSP_COUNT,
+       static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT]

The enum is a little bit confusing, might rename to TA_FW_TYPE_MAX_INDEX,

Regards,
Hawking

-----Original Message-----
From: Wang, Kevin(Yang) <Kevin1.Wang@xxxxxxx>
Sent: Monday, March 1, 2021 17:10
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Zhang, Hawking <Hawking.Zhang@xxxxxxx>; Wang, Kevin(Yang) <Kevin1.Wang@xxxxxxx>
Subject: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs

refine PSP TA firmware info print in amdgpu_firmware_info().

Signed-off-by: Kevin Wang <kevin1.wang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   | 50 +++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  1 +
 2 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 6c8ea9d26320..1a27673271b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -289,23 +289,23 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
                 break;
         case AMDGPU_INFO_FW_TA:
                 switch (query_fw->index) {
-               case 0:
+               case TA_FW_TYPE_PSP_XGMI:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_xgmi_ucode_version;
                         break;
-               case 1:
+               case TA_FW_TYPE_PSP_RAS:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_ras_ucode_version;
                         break;
-               case 2:
+               case TA_FW_TYPE_PSP_HDCP:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_hdcp_ucode_version;
                         break;
-               case 3:
+               case TA_FW_TYPE_PSP_DTM:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_dtm_ucode_version;
                         break;
-               case 4:
+               case TA_FW_TYPE_PSP_RAP:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_rap_ucode_version;
                         break;
@@ -1355,6 +1355,17 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
         struct atom_context *ctx = adev->mode_info.atom_context;
         int ret, i;
 
+       static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT] = { #define
+TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type
+               TA_FW_NAME(ASD),
+               TA_FW_NAME(XGMI),
+               TA_FW_NAME(RAS),
+               TA_FW_NAME(HDCP),
+               TA_FW_NAME(DTM),
+               TA_FW_NAME(RAP),
+#undef TA_FW_NAME
+       };
+
         /* VCE */
         query_fw.fw_type = AMDGPU_INFO_FW_VCE;
         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)
                    fw_info.feature, fw_info.ver);
 
         query_fw.fw_type = AMDGPU_INFO_FW_TA;
-       for (i = 0; i < 5; i++) {
+       for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {
                 query_fw.index = i;
                 ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
                 if (ret)
                         continue;
-               switch (query_fw.index) {
-               case 0:
-                       seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-                                       "RAS", fw_info.feature, fw_info.ver);
-                       break;
-               case 1:
-                       seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-                                       "XGMI", fw_info.feature, fw_info.ver);
-                       break;
-               case 2:
-                       seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-                                       "HDCP", fw_info.feature, fw_info.ver);
-                       break;
-               case 3:
-                       seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-                                       "DTM", fw_info.feature, fw_info.ver);
-                       break;
-               case 4:
-                       seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-                                       "RAP", fw_info.feature, fw_info.ver);
-                       break;
-               default:
-                       return -EINVAL;
-               }
+
+               seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
+                          ta_fw_name[i], fw_info.feature, fw_info.ver);
         }
 
         /* SMC */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
index 46449e70348b..c03f32ec3ebc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
@@ -136,6 +136,7 @@ enum ta_fw_type {
         TA_FW_TYPE_PSP_DTM,
         TA_FW_TYPE_PSP_RAP,
         TA_FW_TYPE_PSP_SECUREDISPLAY,
+       TA_FW_TYPE_PSP_COUNT,
 };
 
 struct ta_fw_bin_desc {
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux