drm/amdgpu: move ring helpers to amdgpu_ring.h
authorChristian König <christian.koenig@amd.com>
Wed, 28 Jun 2017 11:43:48 +0000 (13:43 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:05:56 +0000 (11:05 -0400)
Keep them where they belong.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h

index df63823..714235f 100644 (file)
@@ -1792,50 +1792,6 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v);
 #define RBIOS16(i) (RBIOS8(i) | (RBIOS8((i)+1) << 8))
 #define RBIOS32(i) ((RBIOS16(i)) | (RBIOS16((i)+2) << 16))
 
-/*
- * RING helpers.
- */
-static inline void amdgpu_ring_write(struct amdgpu_ring *ring, uint32_t v)
-{
-       if (ring->count_dw <= 0)
-               DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n");
-       ring->ring[ring->wptr++ & ring->buf_mask] = v;
-       ring->wptr &= ring->ptr_mask;
-       ring->count_dw--;
-}
-
-static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring, void *src, int count_dw)
-{
-       unsigned occupied, chunk1, chunk2;
-       void *dst;
-
-       if (unlikely(ring->count_dw < count_dw)) {
-               DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n");
-               return;
-       }
-
-       occupied = ring->wptr & ring->buf_mask;
-       dst = (void *)&ring->ring[occupied];
-       chunk1 = ring->buf_mask + 1 - occupied;
-       chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1;
-       chunk2 = count_dw - chunk1;
-       chunk1 <<= 2;
-       chunk2 <<= 2;
-
-       if (chunk1)
-               memcpy(dst, src, chunk1);
-
-       if (chunk2) {
-               src += chunk1;
-               dst = (void *)ring->ring;
-               memcpy(dst, src, chunk2);
-       }
-
-       ring->wptr += count_dw;
-       ring->wptr &= ring->ptr_mask;
-       ring->count_dw -= count_dw;
-}
-
 static inline struct amdgpu_sdma_instance *
 amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 {
index bc8dec9..04cbc3a 100644 (file)
@@ -212,4 +212,46 @@ static inline void amdgpu_ring_clear_ring(struct amdgpu_ring *ring)
 
 }
 
+static inline void amdgpu_ring_write(struct amdgpu_ring *ring, uint32_t v)
+{
+       if (ring->count_dw <= 0)
+               DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n");
+       ring->ring[ring->wptr++ & ring->buf_mask] = v;
+       ring->wptr &= ring->ptr_mask;
+       ring->count_dw--;
+}
+
+static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
+                                             void *src, int count_dw)
+{
+       unsigned occupied, chunk1, chunk2;
+       void *dst;
+
+       if (unlikely(ring->count_dw < count_dw)) {
+               DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n");
+               return;
+       }
+
+       occupied = ring->wptr & ring->buf_mask;
+       dst = (void *)&ring->ring[occupied];
+       chunk1 = ring->buf_mask + 1 - occupied;
+       chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1;
+       chunk2 = count_dw - chunk1;
+       chunk1 <<= 2;
+       chunk2 <<= 2;
+
+       if (chunk1)
+               memcpy(dst, src, chunk1);
+
+       if (chunk2) {
+               src += chunk1;
+               dst = (void *)ring->ring;
+               memcpy(dst, src, chunk2);
+       }
+
+       ring->wptr += count_dw;
+       ring->wptr &= ring->ptr_mask;
+       ring->count_dw -= count_dw;
+}
+
 #endif