aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0006-drm-amdgpu-add-read_bios_from_rom-callback-for-VI-pa.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0006-drm-amdgpu-add-read_bios_from_rom-callback-for-VI-pa.patch')
-rw-r--r--common/recipes-kernel/linux/files/0006-drm-amdgpu-add-read_bios_from_rom-callback-for-VI-pa.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0006-drm-amdgpu-add-read_bios_from_rom-callback-for-VI-pa.patch b/common/recipes-kernel/linux/files/0006-drm-amdgpu-add-read_bios_from_rom-callback-for-VI-pa.patch
new file mode 100644
index 00000000..9d6a83de
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0006-drm-amdgpu-add-read_bios_from_rom-callback-for-VI-pa.patch
@@ -0,0 +1,73 @@
+From b526555fa7a53776ff1925bd0bf9cef664134750 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Tue, 24 Nov 2015 10:37:54 -0500
+Subject: [PATCH 0006/1110] drm/amdgpu: add read_bios_from_rom callback for VI
+ parts
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Read the vbios image directly from the rom.
+
+Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Reviewed-by: Monk Liu <monk.liu@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/vi.c | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
+index 3e9cbe3..0cb6f31 100644
+--- a/drivers/gpu/drm/amd/amdgpu/vi.c
++++ b/drivers/gpu/drm/amd/amdgpu/vi.c
+@@ -377,6 +377,38 @@ static bool vi_read_disabled_bios(struct amdgpu_device *adev)
+ WREG32_SMC(ixROM_CNTL, rom_cntl);
+ return r;
+ }
++
++static bool vi_read_bios_from_rom(struct amdgpu_device *adev,
++ u8 *bios, u32 length_bytes)
++{
++ u32 *dw_ptr;
++ unsigned long flags;
++ u32 i, length_dw;
++
++ if (bios == NULL)
++ return false;
++ if (length_bytes == 0)
++ return false;
++ /* APU vbios image is part of sbios image */
++ if (adev->flags & AMD_IS_APU)
++ return false;
++
++ dw_ptr = (u32 *)bios;
++ length_dw = ALIGN(length_bytes, 4) / 4;
++ /* take the smc lock since we are using the smc index */
++ spin_lock_irqsave(&adev->smc_idx_lock, flags);
++ /* set rom index to 0 */
++ WREG32(mmSMC_IND_INDEX_0, ixROM_INDEX);
++ WREG32(mmSMC_IND_DATA_0, 0);
++ /* set index to data for continous read */
++ WREG32(mmSMC_IND_INDEX_0, ixROM_DATA);
++ for (i = 0; i < length_dw; i++)
++ dw_ptr[i] = RREG32(mmSMC_IND_DATA_0);
++ spin_unlock_irqrestore(&adev->smc_idx_lock, flags);
++
++ return true;
++}
++
+ static struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = {
+ {mmGB_MACROTILE_MODE7, true},
+ };
+@@ -1369,6 +1401,7 @@ static uint32_t vi_get_rev_id(struct amdgpu_device *adev)
+ static const struct amdgpu_asic_funcs vi_asic_funcs =
+ {
+ .read_disabled_bios = &vi_read_disabled_bios,
++ .read_bios_from_rom = &vi_read_bios_from_rom,
+ .read_register = &vi_read_register,
+ .reset = &vi_asic_reset,
+ .set_vga_state = &vi_vga_set_state,
+--
+2.7.4
+