diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2017-06-30 17:00:01 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-07-14 11:06:04 -0400 |
commit | 3164cba317c235f950c861928b290dd93b30d821 (patch) | |
tree | b82417b1f8dffd19a0bb0292839b1a2185673888 /drivers/gpu/drm | |
parent | 1aaa56029f47e16f9d03e25a313677f16212ad72 (diff) |
drm/amdgpu/atombios: use bios_scratch_reg_offset for atombios
Align with the atomfirmware code.
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c index 1e8e1123ddf4..8e7a7b9baa1d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | |||
@@ -1686,7 +1686,7 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock) | |||
1686 | { | 1686 | { |
1687 | uint32_t bios_6_scratch; | 1687 | uint32_t bios_6_scratch; |
1688 | 1688 | ||
1689 | bios_6_scratch = RREG32(mmBIOS_SCRATCH_6); | 1689 | bios_6_scratch = RREG32(adev->bios_scratch_reg_offset + 6); |
1690 | 1690 | ||
1691 | if (lock) { | 1691 | if (lock) { |
1692 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; | 1692 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; |
@@ -1696,15 +1696,17 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock) | |||
1696 | bios_6_scratch |= ATOM_S6_ACC_MODE; | 1696 | bios_6_scratch |= ATOM_S6_ACC_MODE; |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | WREG32(mmBIOS_SCRATCH_6, bios_6_scratch); | 1699 | WREG32(adev->bios_scratch_reg_offset + 6, bios_6_scratch); |
1700 | } | 1700 | } |
1701 | 1701 | ||
1702 | void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev) | 1702 | void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev) |
1703 | { | 1703 | { |
1704 | uint32_t bios_2_scratch, bios_6_scratch; | 1704 | uint32_t bios_2_scratch, bios_6_scratch; |
1705 | 1705 | ||
1706 | bios_2_scratch = RREG32(mmBIOS_SCRATCH_2); | 1706 | adev->bios_scratch_reg_offset = mmBIOS_SCRATCH_0; |
1707 | bios_6_scratch = RREG32(mmBIOS_SCRATCH_6); | 1707 | |
1708 | bios_2_scratch = RREG32(adev->bios_scratch_reg_offset + 2); | ||
1709 | bios_6_scratch = RREG32(adev->bios_scratch_reg_offset + 6); | ||
1708 | 1710 | ||
1709 | /* let the bios control the backlight */ | 1711 | /* let the bios control the backlight */ |
1710 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; | 1712 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; |
@@ -1715,8 +1717,8 @@ void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev) | |||
1715 | /* clear the vbios dpms state */ | 1717 | /* clear the vbios dpms state */ |
1716 | bios_2_scratch &= ~ATOM_S2_DEVICE_DPMS_STATE; | 1718 | bios_2_scratch &= ~ATOM_S2_DEVICE_DPMS_STATE; |
1717 | 1719 | ||
1718 | WREG32(mmBIOS_SCRATCH_2, bios_2_scratch); | 1720 | WREG32(adev->bios_scratch_reg_offset + 2, bios_2_scratch); |
1719 | WREG32(mmBIOS_SCRATCH_6, bios_6_scratch); | 1721 | WREG32(adev->bios_scratch_reg_offset + 6, bios_6_scratch); |
1720 | } | 1722 | } |
1721 | 1723 | ||
1722 | void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev) | 1724 | void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev) |
@@ -1724,7 +1726,7 @@ void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev) | |||
1724 | int i; | 1726 | int i; |
1725 | 1727 | ||
1726 | for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) | 1728 | for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) |
1727 | adev->bios_scratch[i] = RREG32(mmBIOS_SCRATCH_0 + i); | 1729 | adev->bios_scratch[i] = RREG32(adev->bios_scratch_reg_offset + i); |
1728 | } | 1730 | } |
1729 | 1731 | ||
1730 | void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) | 1732 | void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) |
@@ -1738,20 +1740,20 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) | |||
1738 | adev->bios_scratch[7] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK; | 1740 | adev->bios_scratch[7] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK; |
1739 | 1741 | ||
1740 | for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) | 1742 | for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) |
1741 | WREG32(mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); | 1743 | WREG32(adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]); |
1742 | } | 1744 | } |
1743 | 1745 | ||
1744 | void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device *adev, | 1746 | void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device *adev, |
1745 | bool hung) | 1747 | bool hung) |
1746 | { | 1748 | { |
1747 | u32 tmp = RREG32(mmBIOS_SCRATCH_3); | 1749 | u32 tmp = RREG32(adev->bios_scratch_reg_offset + 3); |
1748 | 1750 | ||
1749 | if (hung) | 1751 | if (hung) |
1750 | tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG; | 1752 | tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG; |
1751 | else | 1753 | else |
1752 | tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG; | 1754 | tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG; |
1753 | 1755 | ||
1754 | WREG32(mmBIOS_SCRATCH_3, tmp); | 1756 | WREG32(adev->bios_scratch_reg_offset + 3, tmp); |
1755 | } | 1757 | } |
1756 | 1758 | ||
1757 | /* Atom needs data in little endian format | 1759 | /* Atom needs data in little endian format |