drm/amdgpu/sdma3.0: clean up rb address calculation

Submitted by Alex Deucher on Nov. 23, 2016, 8:27 p.m.

Details

Message ID 1479932826-3362-5-git-send-email-alexander.deucher@amd.com
State New
Headers show
Series "drm/amdgpu/gfx8: move eop programming per queue" ( rev: 5 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Alex Deucher Nov. 23, 2016, 8:27 p.m.
Make it clearer what we are doing.

Reviewed-by: Christian K├Ânig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 1170a64..f0bbb75 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -605,6 +605,7 @@  static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)
 	u32 rb_bufsz;
 	u32 wb_offset;
 	u32 doorbell;
+	u64 gpu_addr;
 	int i, j, r;
 
 	for (i = 0; i < adev->sdma.num_instances; i++) {
@@ -651,8 +652,10 @@  static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)
 
 		rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_GFX_RB_CNTL, RPTR_WRITEBACK_ENABLE, 1);
 
-		WREG32(mmSDMA0_GFX_RB_BASE + sdma_offsets[i], ring->gpu_addr >> 8);
-		WREG32(mmSDMA0_GFX_RB_BASE_HI + sdma_offsets[i], ring->gpu_addr >> 40);
+		gpu_addr = ring->gpu_addr;
+		gpu_addr >>= 8;
+		WREG32(mmSDMA0_GFX_RB_BASE + sdma_offsets[i], lower_32_bits(gpu_addr));
+		WREG32(mmSDMA0_GFX_RB_BASE_HI + sdma_offsets[i], upper_32_bits(gpu_addr));
 
 		ring->wptr = 0;
 		WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], ring->wptr << 2);