diff options
author | Hawking Zhang <Hawking.Zhang@amd.com> | 2019-03-06 21:14:13 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-03-19 16:36:51 -0400 |
commit | 511c4348cf7bb4d224e944e6d84a5bf8edacbfef (patch) | |
tree | afa3f4c6592388d3204dceea3cf9f876ec686274 | |
parent | ed606ca3d30d2e73d566e087214274399ca016d3 (diff) |
drm/amdgpu: add atomfirmware helper function to query ecc status
ecc default status (enabled or disabled) could be get from umc_config field in umc_info 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>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c index ea917d640688..742af0ed94d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | |||
@@ -236,6 +236,37 @@ int amdgpu_atomfirmware_get_vram_type(struct amdgpu_device *adev) | |||
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
239 | /* | ||
240 | * Return true if vbios enabled ecc by default, if umc info table is available | ||
241 | * or false if ecc is not enabled or umc info table is not available | ||
242 | */ | ||
243 | bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev) | ||
244 | { | ||
245 | struct amdgpu_mode_info *mode_info = &adev->mode_info; | ||
246 | int index; | ||
247 | u16 data_offset, size; | ||
248 | union umc_info *umc_info; | ||
249 | u8 frev, crev; | ||
250 | bool ecc_default_enabled = false; | ||
251 | |||
252 | index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, | ||
253 | umc_info); | ||
254 | |||
255 | if (amdgpu_atom_parse_data_header(mode_info->atom_context, | ||
256 | index, &size, &frev, &crev, &data_offset)) { | ||
257 | /* support umc_info 3.1+ */ | ||
258 | if ((frev == 3 && crev >= 1) || (frev > 3)) { | ||
259 | umc_info = (union umc_info *) | ||
260 | (mode_info->atom_context->bios + data_offset); | ||
261 | ecc_default_enabled = | ||
262 | (le32_to_cpu(umc_info->v31.umc_config) & | ||
263 | UMC_CONFIG__DEFAULT_MEM_ECC_ENABLE) ? true : false; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | return ecc_default_enabled; | ||
268 | } | ||
269 | |||
239 | union firmware_info { | 270 | union firmware_info { |
240 | struct atom_firmware_info_v3_1 v31; | 271 | struct atom_firmware_info_v3_1 v31; |
241 | }; | 272 | }; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h index f8ea77d4e863..6da079e60619 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | |||
@@ -33,5 +33,6 @@ int amdgpu_atomfirmware_get_vram_width(struct amdgpu_device *adev); | |||
33 | int amdgpu_atomfirmware_get_vram_type(struct amdgpu_device *adev); | 33 | int amdgpu_atomfirmware_get_vram_type(struct amdgpu_device *adev); |
34 | int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev); | 34 | int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev); |
35 | int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev); | 35 | int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev); |
36 | bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev); | ||
36 | 37 | ||
37 | #endif | 38 | #endif |