I'm not aware of any Aldebaran SKUs that don't have the FRU, but I can look 
into it before submitting this patch.

 Kent

> -----Original Message-----
> From: Chen, Guchun <guchun.c...@amd.com>
> Sent: Monday, December 13, 2021 10:39 PM
> To: Chen, Guchun <guchun.c...@amd.com>; Russell, Kent <kent.russ...@amd.com>;
> amd-gfx@lists.freedesktop.org
> Cc: Russell, Kent <kent.russ...@amd.com>
> Subject: RE: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran
> 
> [Public]
> 
> BTW, does FRU exists on all the Aldebaran SKUs?
> 
> This patch acks FRU's presence when it's Aldebaran. So if some Aldebaran SKUs 
> do not have
> a FRU, some i2c access failures will be observed during boot up. This is not 
> friendly to user.
> 
> Please check Vega20 case we talked before, and there are some more strict 
> checks for FRU
> on several Vega20 SKUs.
> 
> case CHIP_VEGA20:
>               /* D161 and D163 are the VG20 server SKUs */
>               if (strnstr(atom_ctx->vbios_version, "D161",
>                           sizeof(atom_ctx->vbios_version)) ||
>                   strnstr(atom_ctx->vbios_version, "D163",
>                           sizeof(atom_ctx->vbios_version)))
>                       return true;
>               else
>                       return false;
> 
> Regards,
> Guchun
> 
> -----Original Message-----
> From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> On Behalf Of Chen, 
> Guchun
> Sent: Tuesday, December 14, 2021 11:17 AM
> To: Russell, Kent <kent.russ...@amd.com>; amd-gfx@lists.freedesktop.org
> Cc: Russell, Kent <kent.russ...@amd.com>
> Subject: RE: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran
> 
> [Public]
> 
> +     if (adev->asic_type == CHIP_ALDEBARAN)
> +             offset = 0;
> 
>       if (!is_fru_eeprom_supported(adev))
>               return 0;
> 
> I assume the logic should be adjusted. It's better to put the asic_type check 
> after
> is_fru_eeprom_supported.
> 
> Regards,
> Guchun
> 
> -----Original Message-----
> From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> On Behalf Of Kent 
> Russell
> Sent: Tuesday, December 14, 2021 3:34 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Russell, Kent <kent.russ...@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.
> 
> Signed-off-by: Kent Russell <kent.russ...@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 12 +++++++++---
>  1 file changed, 9 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 b3b951fe0861..124376b666fd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
> @@ -56,6 +56,8 @@ static bool is_fru_eeprom_supported(struct amdgpu_device 
> *adev)
>                       return true;
>               else
>                       return false;
> +     case CHIP_ALDEBARAN:
> +             return true;
>       default:
>               return false;
>       }
> @@ -91,6 +93,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
>       unsigned char buff[66];
>       u32 addrptr;
>       int size, len;
> +     int offset = 2;
> +
> +     if (adev->asic_type == CHIP_ALDEBARAN)
> +             offset = 0;
> 
>       if (!is_fru_eeprom_supported(adev))
>               return 0;
> @@ -139,7 +145,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device 
> *adev)
>               len = sizeof(adev->product_name) - 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;
> @@ -157,7 +163,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;
> @@ -184,7 +190,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

Reply via email to