Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: add atomfirmware helper function to query sram ecc caps

sram ecc capability could be get from firmware_capability field in firmwareinfo table

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Hawking Zhang and committed by
Alex Deucher
8b6da23f 511c4348

+31
+30
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
··· 271 271 struct atom_firmware_info_v3_1 v31; 272 272 }; 273 273 274 + /* 275 + * Return true if vbios supports sram ecc or false if not 276 + */ 277 + bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev) 278 + { 279 + struct amdgpu_mode_info *mode_info = &adev->mode_info; 280 + int index; 281 + u16 data_offset, size; 282 + union firmware_info *firmware_info; 283 + u8 frev, crev; 284 + bool sram_ecc_supported = false; 285 + 286 + index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, 287 + firmwareinfo); 288 + 289 + if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context, 290 + index, &size, &frev, &crev, &data_offset)) { 291 + /* support firmware_info 3.1 + */ 292 + if ((frev == 3 && crev >=1) || (frev > 3)) { 293 + firmware_info = (union firmware_info *) 294 + (mode_info->atom_context->bios + data_offset); 295 + sram_ecc_supported = 296 + (le32_to_cpu(firmware_info->v31.firmware_capability) & 297 + ATOM_FIRMWARE_CAP_SRAM_ECC) ? true : false; 298 + } 299 + } 300 + 301 + return sram_ecc_supported; 302 + } 303 + 274 304 union smu_info { 275 305 struct atom_smu_info_v3_1 v31; 276 306 };
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h
··· 34 34 int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev); 35 35 int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev); 36 36 bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev); 37 + bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev); 37 38 38 39 #endif