[PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

Deucher, Alexander Alexander.Deucher at amd.com
Fri Dec 17 17:43:53 UTC 2021


[AMD Official Use Only]

Series is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Kent Russell <kent.russell at amd.com>
Sent: Friday, December 17, 2021 10:31 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Russell, Kent <Kent.Russell at amd.com>
Subject: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

This is supported, although the offset is different from VG20, so fix
that with a variable and enable getting the product name and serial
number from the FRU. Do this for all SKUs since all SKUs have the FRU

Signed-off-by: Kent Russell <kent.russell at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
index 5ed24701f9cf..80f43e69e659 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
@@ -56,6 +56,9 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
                         return true;
                 else
                         return false;
+       case CHIP_ALDEBARAN:
+               /* All Aldebaran SKUs have the FRU */
+               return true;
         default:
                 return false;
         }
@@ -91,6 +94,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
         unsigned char buff[PRODUCT_NAME_LEN+2];
         u32 addrptr;
         int size, len;
+       int offset = 2;
+
+       if (adev->asic_type == CHIP_ALDEBARAN)
+               offset = 0;

         if (!is_fru_eeprom_supported(adev))
                 return 0;
@@ -137,7 +144,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
                 len = PRODUCT_NAME_LEN - 1;
         }
         /* Start at 2 due to buff using fields 0 and 1 for the address */
-       memcpy(adev->product_name, &buff[2], len);
+       memcpy(adev->product_name, &buff[offset], len);
         adev->product_name[len] = '\0';

         addrptr += size + 1;
@@ -155,7 +162,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
                 DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
                 len = sizeof(adev->product_number) - 1;
         }
-       memcpy(adev->product_number, &buff[2], len);
+       memcpy(adev->product_number, &buff[offset], len);
         adev->product_number[len] = '\0';

         addrptr += size + 1;
@@ -182,7 +189,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
                 DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
                 len = sizeof(adev->serial) - 1;
         }
-       memcpy(adev->serial, &buff[2], len);
+       memcpy(adev->serial, &buff[offset], len);
         adev->serial[len] = '\0';

         return 0;
--
2.25.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20211217/6af3c319/attachment-0001.htm>


More information about the amd-gfx mailing list