aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-07-13 02:28:17 -0400
committerDave Airlie <airlied@redhat.com>2011-07-25 07:14:56 -0400
commitdf07d6999e4e502ff474eeafe11ea0055f4cd68d (patch)
tree141b7203059cee94568e36505b3bc57376fc1689 /drivers
parenta0533fbf8778991f9a978656cff0d301322d37e2 (diff)
drm/radeon: Writeback endian fixes
The writeback ring pointer and IH ring pointer are read using le32_to_cpu so we do not want the chip to byteswap them on big-endian. We still want to byteswap the ring itself and the IBs, so we don't touch that but we remove setting of the byteswap bits in CP_RB_RPTR_ADDR and IH_CNTL. In general, for things like that where we control all the accessors easily, we are better off doing the swap in SW rather than HW. Paradoxally, it does keep the code closer to x86 and avoid using poorly tested HW features. I also changed the use of RADEON_ to R600_ in a couple of cases to be more consistent with the surrounding code. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Michel Dänzer <michel@daenzer.net> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c3
-rw-r--r--drivers/gpu/drm/radeon/r600.c7
-rw-r--r--drivers/gpu/drm/radeon/r600_cp.c23
3 files changed, 9 insertions, 24 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 55d04ee88c24..37dd6449f46f 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1382,9 +1382,6 @@ int evergreen_cp_resume(struct radeon_device *rdev)
1382 1382
1383 /* set the wb address wether it's enabled or not */ 1383 /* set the wb address wether it's enabled or not */
1384 WREG32(CP_RB_RPTR_ADDR, 1384 WREG32(CP_RB_RPTR_ADDR,
1385#ifdef __BIG_ENDIAN
1386 RB_RPTR_SWAP(2) |
1387#endif
1388 ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC)); 1385 ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC));
1389 WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); 1386 WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF);
1390 WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); 1387 WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 9fefce704f96..1741af86943c 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2213,9 +2213,6 @@ int r600_cp_resume(struct radeon_device *rdev)
2213 2213
2214 /* set the wb address whether it's enabled or not */ 2214 /* set the wb address whether it's enabled or not */
2215 WREG32(CP_RB_RPTR_ADDR, 2215 WREG32(CP_RB_RPTR_ADDR,
2216#ifdef __BIG_ENDIAN
2217 RB_RPTR_SWAP(2) |
2218#endif
2219 ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC)); 2216 ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC));
2220 WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); 2217 WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF);
2221 WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); 2218 WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF);
@@ -2995,10 +2992,6 @@ int r600_irq_init(struct radeon_device *rdev)
2995 /* RPTR_REARM only works if msi's are enabled */ 2992 /* RPTR_REARM only works if msi's are enabled */
2996 if (rdev->msi_enabled) 2993 if (rdev->msi_enabled)
2997 ih_cntl |= RPTR_REARM; 2994 ih_cntl |= RPTR_REARM;
2998
2999#ifdef __BIG_ENDIAN
3000 ih_cntl |= IH_MC_SWAP(IH_MC_SWAP_32BIT);
3001#endif
3002 WREG32(IH_CNTL, ih_cntl); 2995 WREG32(IH_CNTL, ih_cntl);
3003 2996
3004 /* force the active interrupt state to all disabled */ 2997 /* force the active interrupt state to all disabled */
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c
index c3ab959bdc7c..45fd592f9606 100644
--- a/drivers/gpu/drm/radeon/r600_cp.c
+++ b/drivers/gpu/drm/radeon/r600_cp.c
@@ -1802,8 +1802,8 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev,
1802 /* Set ring buffer size */ 1802 /* Set ring buffer size */
1803#ifdef __BIG_ENDIAN 1803#ifdef __BIG_ENDIAN
1804 RADEON_WRITE(R600_CP_RB_CNTL, 1804 RADEON_WRITE(R600_CP_RB_CNTL,
1805 RADEON_BUF_SWAP_32BIT | 1805 R600_BUF_SWAP_32BIT |
1806 RADEON_RB_NO_UPDATE | 1806 R600_RB_NO_UPDATE |
1807 (dev_priv->ring.rptr_update_l2qw << 8) | 1807 (dev_priv->ring.rptr_update_l2qw << 8) |
1808 dev_priv->ring.size_l2qw); 1808 dev_priv->ring.size_l2qw);
1809#else 1809#else
@@ -1820,15 +1820,15 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev,
1820 1820
1821#ifdef __BIG_ENDIAN 1821#ifdef __BIG_ENDIAN
1822 RADEON_WRITE(R600_CP_RB_CNTL, 1822 RADEON_WRITE(R600_CP_RB_CNTL,
1823 RADEON_BUF_SWAP_32BIT | 1823 R600_BUF_SWAP_32BIT |
1824 RADEON_RB_NO_UPDATE | 1824 R600_RB_NO_UPDATE |
1825 RADEON_RB_RPTR_WR_ENA | 1825 R600_RB_RPTR_WR_ENA |
1826 (dev_priv->ring.rptr_update_l2qw << 8) | 1826 (dev_priv->ring.rptr_update_l2qw << 8) |
1827 dev_priv->ring.size_l2qw); 1827 dev_priv->ring.size_l2qw);
1828#else 1828#else
1829 RADEON_WRITE(R600_CP_RB_CNTL, 1829 RADEON_WRITE(R600_CP_RB_CNTL,
1830 RADEON_RB_NO_UPDATE | 1830 R600_RB_NO_UPDATE |
1831 RADEON_RB_RPTR_WR_ENA | 1831 R600_RB_RPTR_WR_ENA |
1832 (dev_priv->ring.rptr_update_l2qw << 8) | 1832 (dev_priv->ring.rptr_update_l2qw << 8) |
1833 dev_priv->ring.size_l2qw); 1833 dev_priv->ring.size_l2qw);
1834#endif 1834#endif
@@ -1851,13 +1851,8 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev,
1851 - ((unsigned long) dev->sg->virtual) 1851 - ((unsigned long) dev->sg->virtual)
1852 + dev_priv->gart_vm_start; 1852 + dev_priv->gart_vm_start;
1853 } 1853 }
1854 RADEON_WRITE(R600_CP_RB_RPTR_ADDR, 1854 RADEON_WRITE(R600_CP_RB_RPTR_ADDR, (rptr_addr & 0xfffffffc));
1855#ifdef __BIG_ENDIAN 1855 RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, upper_32_bits(rptr_addr));
1856 (2 << 0) |
1857#endif
1858 (rptr_addr & 0xfffffffc));
1859 RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI,
1860 upper_32_bits(rptr_addr));
1861 1856
1862#ifdef __BIG_ENDIAN 1857#ifdef __BIG_ENDIAN
1863 RADEON_WRITE(R600_CP_RB_CNTL, 1858 RADEON_WRITE(R600_CP_RB_CNTL,