drm/amdgpu/atombios: use bios_scratch_reg_offset for atombios
Subsystems (2)
PATCH 1/5 drm/amdgpu/atombios: use bios_scratch_reg_offset for atombios
Align with the atomfirmware code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +12 -10
@@ -1686,7 +1686,7 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock) {uint32_t bios_6_scratch; - bios_6_scratch =RREG32 (mmBIOS_SCRATCH_6); + bios_6_scratch =RREG32 (adev->bios_scratch_reg_offset +6 );if (lock) { bios_6_scratch |=ATOM_S6_CRITICAL_STATE ;
@@ -1696,15 +1696,17 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock) bios_6_scratch |=ATOM_S6_ACC_MODE ; } -WREG32 (mmBIOS_SCRATCH_6, bios_6_scratch); +WREG32 (adev->bios_scratch_reg_offset +6 , bios_6_scratch); }void amdgpu_atombios_scratch_regs_init (struct amdgpu_device *adev) {uint32_t bios_2_scratch, bios_6_scratch; - bios_2_scratch =RREG32 (mmBIOS_SCRATCH_2); - bios_6_scratch =RREG32 (mmBIOS_SCRATCH_6); + adev->bios_scratch_reg_offset = mmBIOS_SCRATCH_0; + + bios_2_scratch =RREG32 (adev->bios_scratch_reg_offset +2 ); + bios_6_scratch =RREG32 (adev->bios_scratch_reg_offset +6 );/* let the bios control the backlight */ bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE ;
@@ -1715,8 +1717,8 @@ void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev)/* clear the vbios dpms state */ bios_2_scratch &= ~ATOM_S2_DEVICE_DPMS_STATE ; -WREG32 (mmBIOS_SCRATCH_2, bios_2_scratch); -WREG32 (mmBIOS_SCRATCH_6, bios_6_scratch); +WREG32 (adev->bios_scratch_reg_offset +2 , bios_2_scratch); +WREG32 (adev->bios_scratch_reg_offset +6 , bios_6_scratch); }void amdgpu_atombios_scratch_regs_save (struct amdgpu_device *adev)
@@ -1724,7 +1726,7 @@ void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev)int i;for (i =0 ; i <AMDGPU_BIOS_NUM_SCRATCH ; i++) - adev->bios_scratch[i] =RREG32 (mmBIOS_SCRATCH_0 + i); + adev->bios_scratch[i] =RREG32 (adev->bios_scratch_reg_offset + i); }void amdgpu_atombios_scratch_regs_restore (struct amdgpu_device *adev)
@@ -1738,20 +1740,20 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) adev->bios_scratch[7 ] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK ;for (i =0 ; i <AMDGPU_BIOS_NUM_SCRATCH ; i++) -WREG32 (mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); +WREG32 (adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]); }void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev,bool hung) { -u32 tmp =RREG32 (mmBIOS_SCRATCH_3); +u32 tmp =RREG32 (adev->bios_scratch_reg_offset +3 );if (hung) tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ;else tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -WREG32 (mmBIOS_SCRATCH_3, tmp); +WREG32 (adev->bios_scratch_reg_offset +3 , tmp); }/* Atom needs data in little endian format
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1498858359-11352-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/5 drm/amdgpu: unify some atombios/atomfirmware scratch reg functions
Now that we use a pointer to the scratch reg start offset, most of the functions were duplicated.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 35 ------------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | 4 --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 +++----------- drivers/gpu/drm/amd/amdgpu/soc15.c | 6 ++-- 4 files changed, 7 insertions(+), 58 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +0 -35
@@ -66,41 +66,6 @@ void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev) } } -void amdgpu_atomfirmware_scratch_regs_save (struct amdgpu_device *adev) -{ -int i; - -for (i =0 ; i <AMDGPU_BIOS_NUM_SCRATCH ; i++) - adev->bios_scratch[i] =RREG32 (adev->bios_scratch_reg_offset + i); -} - -void amdgpu_atomfirmware_scratch_regs_restore (struct amdgpu_device *adev) -{ -int i; - -/* -* VBIOS will check ASIC_INIT_COMPLETE bit to decide if -* execute ASIC_Init posting via driver -*/ - adev->bios_scratch[7 ] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK ; - -for (i =0 ; i <AMDGPU_BIOS_NUM_SCRATCH ; i++) -WREG32 (adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]); -} - -void amdgpu_atomfirmware_scratch_regs_engine_hung (struct amdgpu_device *adev, -bool hung) -{ -u32 tmp =RREG32 (adev->bios_scratch_reg_offset +3 ); - -if (hung) - tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -else - tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; - -WREG32 (adev->bios_scratch_reg_offset +3 , tmp); -} -int amdgpu_atomfirmware_allocate_fb_scratch (struct amdgpu_device *adev) {struct atom_context *ctx = adev->mode_info.atom_context;
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h +0 -4
@@ -26,10 +26,6 @@bool amdgpu_atomfirmware_gpu_supports_virtualization (struct amdgpu_device *adev);void amdgpu_atomfirmware_scratch_regs_init (struct amdgpu_device *adev); -void amdgpu_atomfirmware_scratch_regs_save (struct amdgpu_device *adev); -void amdgpu_atomfirmware_scratch_regs_restore (struct amdgpu_device *adev); -void amdgpu_atomfirmware_scratch_regs_engine_hung (struct amdgpu_device *adev, -bool hung);int amdgpu_atomfirmware_allocate_fb_scratch (struct amdgpu_device *adev);#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -16
@@ -2438,10 +2438,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)*/ amdgpu_bo_evict_vram (adev); -if (adev->is_atom_fw) -amdgpu_atomfirmware_scratch_regs_save (adev); -else -amdgpu_atombios_scratch_regs_save (adev); +amdgpu_atombios_scratch_regs_save (adev);pci_save_state (dev->pdev);if (suspend) {/* Shut down the device */
@@ -2490,10 +2487,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)if (r) goto unlock; } -if (adev->is_atom_fw) -amdgpu_atomfirmware_scratch_regs_restore (adev); -else -amdgpu_atombios_scratch_regs_restore (adev); +amdgpu_atombios_scratch_regs_restore (adev);/* post card */ if (amdgpu_need_post (adev)) {
@@ -2926,15 +2920,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) r =amdgpu_suspend (adev); retry: -if (adev->is_atom_fw) -amdgpu_atomfirmware_scratch_regs_save (adev); -else -amdgpu_atombios_scratch_regs_save (adev); +amdgpu_atombios_scratch_regs_save (adev); r =amdgpu_asic_reset (adev); -if (adev->is_atom_fw) -amdgpu_atomfirmware_scratch_regs_restore (adev); -else -amdgpu_atombios_scratch_regs_restore (adev); +amdgpu_atombios_scratch_regs_restore (adev);/* post card */ amdgpu_atom_asic_init (adev->mode_info.atom_context);
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -3
@@ -25,7 +25,7 @@#include <linux/module.h> #include "drmP.h" #include "amdgpu.h" -#include "amdgpu_atomfirmware.h" +#include "amdgpu_atombios.h" #include "amdgpu_ih.h" #include "amdgpu_uvd.h" #include "amdgpu_vce.h"
@@ -392,11 +392,11 @@ static void soc15_gpu_pci_config_reset(struct amdgpu_device *adev)static int soc15_asic_reset (struct amdgpu_device *adev) { -amdgpu_atomfirmware_scratch_regs_engine_hung (adev, true); +amdgpu_atombios_scratch_regs_engine_hung (adev, true);soc15_gpu_pci_config_reset (adev); -amdgpu_atomfirmware_scratch_regs_engine_hung (adev, false); +amdgpu_atombios_scratch_regs_engine_hung (adev, false);return 0 ; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 drm/amdgpu/atombios: add function for whether we need asic_init
In reply to a message not in the archiveCheck the atom scratch registers to see if asic_init is complete or not.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h | 1 + 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +10 -0
@@ -1756,6 +1756,16 @@ void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device *adev,WREG32 (adev->bios_scratch_reg_offset +3 , tmp); } +bool amdgpu_atombios_scratch_need_asic_init (struct amdgpu_device *adev) +{ +u32 tmp =RREG32 (adev->bios_scratch_reg_offset +7 ); + +if (tmp &ATOM_S7_ASIC_INIT_COMPLETE_MASK ) +return false; +else +return true; +} +/* Atom needs data in little endian format * so swap as appropriate when copying data to * or from atom. Note that atom operates on
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h +1 -0
@@ -200,6 +200,7 @@ void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev);void amdgpu_atombios_scratch_regs_restore (struct amdgpu_device *adev);void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev,bool hung); +bool amdgpu_atombios_scratch_need_asic_init (struct amdgpu_device *adev);void amdgpu_atombios_copy_swap (u8 *dst,u8 *src,u8 num_bytes,bool to_le); int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type,
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amdgpu: check scratch registers to see if we need post
In reply to a message not in the archiveRather than checking the CONGIG_MEMSIZE register as that may not be reliable on some APUs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -9
@@ -716,20 +716,12 @@ void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc)*/ bool amdgpu_need_post (struct amdgpu_device *adev) { -uint32_t reg; -if (adev->has_hw_reset) { adev->has_hw_reset = false;return true; } -/* then check MEM_SIZE, in case the crtcs are off */ - reg =amdgpu_asic_get_config_memsize (adev); - -if ((reg !=0 ) && (reg !=0xffffffff )) -return false; - -return true; +return amdgpu_atombios_scratch_need_asic_init (adev); }static bool amdgpu_vpost_needed (struct amdgpu_device *adev)
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1498858359-11352-4-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 4/5] drm/amdgpu: check scratch registers to see if we need post
Quoted 14 lines · Alex Deucher
Rather than checking the
CONGIG_MEMSIZEregister as that may not be reliable on some APUs.Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -716,20 +716,12 @@ void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc)*/
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc) · line 726
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-4bool amdgpu_need_post (struct amdgpu_device *adev) { -uint32_t reg; -if (adev->has_hw_reset) { adev->has_hw_reset = false;return true; } -/* then check MEM_SIZE, in case the crtcs are off */ - reg =amdgpu_asic_get_config_memsize (adev);
Do we still need it for SI?
Jerry
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc) · line 727
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-5- -if ((reg !=0 ) && (reg !=0xffffffff )) -return false; - -return true; +return amdgpu_atombios_scratch_need_asic_init (adev); }static bool amdgpu_vpost_needed (struct amdgpu_device *adev)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 4/5] drm/amdgpu: check scratch registers to see if we need post
Quoted 24 lines
-----Original Message-----
From: Zhang, Jerry
Sent: Thursday, July 06, 2017 2:08 AM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander
Subject: Re: [PATCH 4/5] drm/amdgpu: check scratch registers to see if we need postReview
Quoted 9 lines · Alex Deucher
Rather than checking the
CONGIG_MEMSIZEregister as that may not be reliable on some APUs.Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.cdrivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_gtt_location(struct amdgpu_device
Quoted 4 lines
index 63f4bed..9d08f53 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -716,20 +716,12 @@ void amdgpu_gtt_location(struct amdgpu_device*adev, struct
amdgpu_mc*mc)
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc) · line 726
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-4*/ bool amdgpu_need_post (struct amdgpu_device *adev) { -uint32_t reg; -if (adev->has_hw_reset) { adev->has_hw_reset = false;return true; } -/* then check MEM_SIZE, in case the crtcs are off */ - reg =amdgpu_asic_get_config_memsize (adev);Do we still need it for SI?
Yes, I sent out a v2 of the patch.
Alex
Quoted 9 lines
Jerry
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-5- -if ((reg !=0 ) && (reg !=0xffffffff )) -return false; - -return true;
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc) · line 727
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+return amdgpu_atombios_scratch_need_asic_init (adev); }static bool amdgpu_vpost_needed (struct amdgpu_device *adev)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amdgpu: remove get_memsize asic callback
In reply to a message not in the archiveWe don't need this anymore since we use bios scratch registers instead for checking if we need asic_init.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 --- drivers/gpu/drm/amd/amdgpu/cik.c | 6 ------ drivers/gpu/drm/amd/amdgpu/si.c | 6 ------ drivers/gpu/drm/amd/amdgpu/soc15.c | 9 --------- drivers/gpu/drm/amd/amdgpu/vi.c | 6 ------ 5 files changed, 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -3
@@ -1378,8 +1378,6 @@ struct amdgpu_asic_funcs {/* static power management */ int (*get_pcie_lanes)(struct amdgpu_device *adev);void (*set_pcie_lanes)(struct amdgpu_device *adev,int lanes); -/* get config memsize register */ -u32 (*get_config_memsize)(struct amdgpu_device *adev); };/*
@@ -1875,7 +1873,6 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_asic_read_disabled_bios (adev) (adev)->asic_funcs->read_disabled_bios((adev))#define amdgpu_asic_read_bios_from_rom (adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))#define amdgpu_asic_read_register (adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) -#define amdgpu_asic_get_config_memsize (adev) (adev)->asic_funcs->get_config_memsize((adev))#define amdgpu_gart_flush_gpu_tlb (adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid))#define amdgpu_gart_set_pte_pde (adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags))#define amdgpu_gart_get_vm_pde (adev, addr) (adev)->gart.gart_funcs->get_vm_pde((adev), (addr))
drivers/gpu/drm/amd/amdgpu/cik.c +0 -6
@@ -1212,11 +1212,6 @@ static int cik_asic_reset(struct amdgpu_device *adev)return r; } -static u32 cik_get_config_memsize (struct amdgpu_device *adev) -{ -return RREG32 (mmCONFIG_MEMSIZE); -} -static int cik_set_uvd_clock (struct amdgpu_device *adev,u32 clock,u32 cntl_reg,u32 status_reg) {
@@ -1646,7 +1641,6 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = .get_xclk = &cik_get_xclk, .set_uvd_clocks = &cik_set_uvd_clocks, .set_vce_clocks = &cik_set_vce_clocks, - .get_config_memsize = &cik_get_config_memsize, };static int cik_common_early_init (void *handle)
drivers/gpu/drm/amd/amdgpu/si.c +0 -6
@@ -1156,11 +1156,6 @@ static int si_asic_reset(struct amdgpu_device *adev)return 0 ; } -static u32 si_get_config_memsize (struct amdgpu_device *adev) -{ -return RREG32 (mmCONFIG_MEMSIZE); -} -static void si_vga_set_state (struct amdgpu_device *adev,bool state) {uint32_t temp;
@@ -1212,7 +1207,6 @@ static const struct amdgpu_asic_funcs si_asic_funcs = .get_xclk = &si_get_xclk, .set_uvd_clocks = &si_set_uvd_clocks, .set_vce_clocks = NULL, - .get_config_memsize = &si_get_config_memsize, };static uint32_t si_get_rev_id (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -9
@@ -198,14 +198,6 @@ static void soc15_didt_wreg(struct amdgpu_device *adev, u32 reg, u32 v)spin_unlock_irqrestore (&adev->didt_idx_lock, flags); } -static u32 soc15_get_config_memsize (struct amdgpu_device *adev) -{ -if (adev->flags &AMD_IS_APU ) -return nbio_v7_0_get_memsize (adev); -else -return nbio_v6_1_get_memsize (adev); -} -static const u32 vega10_golden_init[] = { };
@@ -553,7 +545,6 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = .get_xclk = &soc15_get_xclk, .set_uvd_clocks = &soc15_set_uvd_clocks, .set_vce_clocks = &soc15_set_vce_clocks, - .get_config_memsize = &soc15_get_config_memsize, };static int soc15_common_early_init (void *handle)
drivers/gpu/drm/amd/amdgpu/vi.c +0 -6
@@ -706,11 +706,6 @@ static int vi_asic_reset(struct amdgpu_device *adev)return r; } -static u32 vi_get_config_memsize (struct amdgpu_device *adev) -{ -return RREG32 (mmCONFIG_MEMSIZE); -} -static int vi_set_uvd_clock (struct amdgpu_device *adev,u32 clock,u32 cntl_reg,u32 status_reg) {
@@ -862,7 +857,6 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = .get_xclk = &vi_get_xclk, .set_uvd_clocks = &vi_set_uvd_clocks, .set_vce_clocks = &vi_set_vce_clocks, - .get_config_memsize = &vi_get_config_memsize, };#define CZ_REV_BRISTOL (rev) \
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 30.06.2017 um 23:32 schrieb Alex Deucher:
Quoted 3 lines
Align with the atomfirmware code.
Signed-off-by Alex Deucher <[email protected]>
Patch #1 and #2 in this series are Acked-by: Christian König <[email protected]>.
Patch #3-#5 are Reviewed-by: Christian König <[email protected]>.
Regards,
Christian.
Quoted 72 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +11
-9@@ -1686,7 +1686,7 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock) {uint32_t bios_6_scratch; - bios_6_scratch =RREG32 (mmBIOS_SCRATCH_6); + bios_6_scratch =RREG32 (adev->bios_scratch_reg_offset +6 );if (lock) { bios_6_scratch |=ATOM_S6_CRITICAL_STATE ;@@ -1696,15 +1696,17 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock) bios_6_scratch |=ATOM_S6_ACC_MODE ; } -WREG32 (mmBIOS_SCRATCH_6, bios_6_scratch); +WREG32 (adev->bios_scratch_reg_offset +6 , bios_6_scratch); }void amdgpu_atombios_scratch_regs_init (struct amdgpu_device *adev) {uint32_t bios_2_scratch, bios_6_scratch; - bios_2_scratch =RREG32 (mmBIOS_SCRATCH_2); - bios_6_scratch =RREG32 (mmBIOS_SCRATCH_6); + adev->bios_scratch_reg_offset = mmBIOS_SCRATCH_0; + + bios_2_scratch =RREG32 (adev->bios_scratch_reg_offset +2 ); + bios_6_scratch =RREG32 (adev->bios_scratch_reg_offset +6 );/* let the bios control the backlight */ bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE ;@@ -1715,8 +1717,8 @@ void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev)/* clear the vbios dpms state */ bios_2_scratch &= ~ATOM_S2_DEVICE_DPMS_STATE ; -WREG32 (mmBIOS_SCRATCH_2, bios_2_scratch); -WREG32 (mmBIOS_SCRATCH_6, bios_6_scratch); +WREG32 (adev->bios_scratch_reg_offset +2 , bios_2_scratch); +WREG32 (adev->bios_scratch_reg_offset +6 , bios_6_scratch); }void amdgpu_atombios_scratch_regs_save (struct amdgpu_device *adev)@@ -1724,7 +1726,7 @@ void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev)int i;for (i =0 ; i <AMDGPU_BIOS_NUM_SCRATCH ; i++) - adev->bios_scratch[i] =RREG32 (mmBIOS_SCRATCH_0 + i); + adev->bios_scratch[i] =RREG32 (adev->bios_scratch_reg_offset + i); }void amdgpu_atombios_scratch_regs_restore (struct amdgpu_device *adev)@@ -1738,20 +1740,20 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) adev->bios_scratch[7 ] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK ;for (i =0 ; i <AMDGPU_BIOS_NUM_SCRATCH ; i++) -WREG32 (mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); +WREG32 (adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]); }void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev,bool hung) { -u32 tmp =RREG32 (mmBIOS_SCRATCH_3); +u32 tmp =RREG32 (adev->bios_scratch_reg_offset +3 );
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) · line 1759
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +1
-1if (hung) tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ;else tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -WREG32 (mmBIOS_SCRATCH_3, tmp); +WREG32 (adev->bios_scratch_reg_offset +3 , tmp); }/* Atom needs data in little endian format
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx