Commit 184d8384 authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher

drm/amdgpu: Add vbios attribute only if supported

Not all devices carry VBIOS version information. Add the device
attribute only if supported.
Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarLe Ma <le.ma@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c09b3bf7
...@@ -1791,6 +1791,15 @@ const struct attribute_group amdgpu_vbios_version_attr_group = { ...@@ -1791,6 +1791,15 @@ const struct attribute_group amdgpu_vbios_version_attr_group = {
.attrs = amdgpu_vbios_version_attrs .attrs = amdgpu_vbios_version_attrs
}; };
int amdgpu_atombios_sysfs_init(struct amdgpu_device *adev)
{
if (adev->mode_info.atom_context)
return devm_device_add_group(adev->dev,
&amdgpu_vbios_version_attr_group);
return 0;
}
/** /**
* amdgpu_atombios_fini - free the driver info and callbacks for atombios * amdgpu_atombios_fini - free the driver info and callbacks for atombios
* *
......
...@@ -217,5 +217,6 @@ int amdgpu_atombios_get_data_table(struct amdgpu_device *adev, ...@@ -217,5 +217,6 @@ int amdgpu_atombios_get_data_table(struct amdgpu_device *adev,
void amdgpu_atombios_fini(struct amdgpu_device *adev); void amdgpu_atombios_fini(struct amdgpu_device *adev);
int amdgpu_atombios_init(struct amdgpu_device *adev); int amdgpu_atombios_init(struct amdgpu_device *adev);
int amdgpu_atombios_sysfs_init(struct amdgpu_device *adev);
#endif #endif
...@@ -4018,6 +4018,11 @@ int amdgpu_device_init(struct amdgpu_device *adev, ...@@ -4018,6 +4018,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
/* Get a log2 for easy divisions. */ /* Get a log2 for easy divisions. */
adev->mm_stats.log2_max_MBps = ilog2(max(1u, max_MBps)); adev->mm_stats.log2_max_MBps = ilog2(max(1u, max_MBps));
r = amdgpu_atombios_sysfs_init(adev);
if (r)
drm_err(&adev->ddev,
"registering atombios sysfs failed (%d).\n", r);
r = amdgpu_pm_sysfs_init(adev); r = amdgpu_pm_sysfs_init(adev);
if (r) if (r)
DRM_ERROR("registering pm sysfs failed (%d).\n", r); DRM_ERROR("registering pm sysfs failed (%d).\n", r);
......
...@@ -2899,12 +2899,10 @@ static struct pci_error_handlers amdgpu_pci_err_handler = { ...@@ -2899,12 +2899,10 @@ static struct pci_error_handlers amdgpu_pci_err_handler = {
extern const struct attribute_group amdgpu_vram_mgr_attr_group; extern const struct attribute_group amdgpu_vram_mgr_attr_group;
extern const struct attribute_group amdgpu_gtt_mgr_attr_group; extern const struct attribute_group amdgpu_gtt_mgr_attr_group;
extern const struct attribute_group amdgpu_vbios_version_attr_group;
static const struct attribute_group *amdgpu_sysfs_groups[] = { static const struct attribute_group *amdgpu_sysfs_groups[] = {
&amdgpu_vram_mgr_attr_group, &amdgpu_vram_mgr_attr_group,
&amdgpu_gtt_mgr_attr_group, &amdgpu_gtt_mgr_attr_group,
&amdgpu_vbios_version_attr_group,
NULL, NULL,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment