summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHawking Zhang <Hawking.Zhang@amd.com>2021-05-13 17:02:29 +0300
committerAlex Deucher <alexander.deucher@amd.com>2021-05-20 05:30:09 +0300
commit698b1010864e4e396762567748724ebadc8184cd (patch)
tree306feb03298ca3c3faa6ce5de72cf8d5d3ff6ade
parent58ff791ad3ef468fe8f00eb8849b435fe52811d3 (diff)
downloadlinux-698b1010864e4e396762567748724ebadc8184cd.tar.xz
drm/amdgpu: switch to cached fw flags for sram ecc cap
Check cached firmware_flags to determine whether sram ecc is supported or not. Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: John Clements <john.clements@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
index 2cb854608289..9f25db0e9874 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
@@ -437,33 +437,19 @@ bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev)
}
/*
+ * Helper function to query sram ecc capablity
+ *
+ * @adev: amdgpu_device pointer
+ *
* Return true if vbios supports sram ecc or false if not
*/
bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev)
{
- struct amdgpu_mode_info *mode_info = &adev->mode_info;
- int index;
- u16 data_offset, size;
- union firmware_info *firmware_info;
- u8 frev, crev;
- bool sram_ecc_supported = false;
-
- index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
- firmwareinfo);
+ u32 fw_cap;
- if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context,
- index, &size, &frev, &crev, &data_offset)) {
- /* support firmware_info 3.1 + */
- if ((frev == 3 && crev >=1) || (frev > 3)) {
- firmware_info = (union firmware_info *)
- (mode_info->atom_context->bios + data_offset);
- sram_ecc_supported =
- (le32_to_cpu(firmware_info->v31.firmware_capability) &
- ATOM_FIRMWARE_CAP_SRAM_ECC) ? true : false;
- }
- }
+ fw_cap = adev->mode_info.firmware_flags;
- return sram_ecc_supported;
+ return (fw_cap & ATOM_FIRMWARE_CAP_SRAM_ECC) ? true : false;
}
union smu_info {