aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/1577-drm-amdgpu-add-atomfirmware-helper-function-to-query.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/1577-drm-amdgpu-add-atomfirmware-helper-function-to-query.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/1577-drm-amdgpu-add-atomfirmware-helper-function-to-query.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/1577-drm-amdgpu-add-atomfirmware-helper-function-to-query.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/1577-drm-amdgpu-add-atomfirmware-helper-function-to-query.patch
new file mode 100644
index 00000000..22227a4a
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/1577-drm-amdgpu-add-atomfirmware-helper-function-to-query.patch
@@ -0,0 +1,71 @@
+From ee37e58d1bc415f156fa4e27a02b5d24188fd8d7 Mon Sep 17 00:00:00 2001
+From: Hawking Zhang <Hawking.Zhang@amd.com>
+Date: Thu, 7 Mar 2019 10:14:13 +0800
+Subject: [PATCH 1577/2940] 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>
+---
+ .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 31 +++++++++++++++++++
+ .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | 1 +
+ 2 files changed, 32 insertions(+)
+
+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)
+ return 0;
+ }
+
++/*
++ * Return true if vbios enabled ecc by default, if umc info table is available
++ * or false if ecc is not enabled or umc info table is not available
++ */
++bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev)
++{
++ struct amdgpu_mode_info *mode_info = &adev->mode_info;
++ int index;
++ u16 data_offset, size;
++ union umc_info *umc_info;
++ u8 frev, crev;
++ bool ecc_default_enabled = false;
++
++ index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
++ umc_info);
++
++ if (amdgpu_atom_parse_data_header(mode_info->atom_context,
++ index, &size, &frev, &crev, &data_offset)) {
++ /* support umc_info 3.1+ */
++ if ((frev == 3 && crev >= 1) || (frev > 3)) {
++ umc_info = (union umc_info *)
++ (mode_info->atom_context->bios + data_offset);
++ ecc_default_enabled =
++ (le32_to_cpu(umc_info->v31.umc_config) &
++ UMC_CONFIG__DEFAULT_MEM_ECC_ENABLE) ? true : false;
++ }
++ }
++
++ return ecc_default_enabled;
++}
++
+ union firmware_info {
+ struct atom_firmware_info_v3_1 v31;
+ };
+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);
+ int amdgpu_atomfirmware_get_vram_type(struct amdgpu_device *adev);
+ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev);
+ int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev);
++bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev);
+
+ #endif
+--
+2.17.1
+