aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu.h
diff options
context:
space:
mode:
authorJammy Zhou <Jammy.Zhou@amd.com>2015-09-01 00:56:17 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-09-02 12:23:58 -0400
commit4b2f7e2ca94d58ea16e411a1f717392b91f7730a (patch)
treeac57d4fb4dde5cbcaa860c14dd876b371c8d56c5 /drivers/gpu/drm/amd/amdgpu/amdgpu.h
parent36f523a7c095192662286057a7eb70d583203fe5 (diff)
drm/amdgpu: add amdgpu_get_sdma_instance helper function
This function is added to map the ring to sdma instance Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 0be51f998ff9..057e7ef5c0d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2199,6 +2199,21 @@ static inline void amdgpu_ring_write(struct amdgpu_ring *ring, uint32_t v)
2199 ring->ring_free_dw--; 2199 ring->ring_free_dw--;
2200} 2200}
2201 2201
2202static inline struct amdgpu_sdma * amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
2203{
2204 struct amdgpu_device *adev = ring->adev;
2205 int i;
2206
2207 for (i = 0; i < AMDGPU_MAX_SDMA_INSTANCES; i++)
2208 if (&adev->sdma[i].ring == ring)
2209 break;
2210
2211 if (i < AMDGPU_MAX_SDMA_INSTANCES)
2212 return &adev->sdma[i];
2213 else
2214 return NULL;
2215}
2216
2202/* 2217/*
2203 * ASICs macro. 2218 * ASICs macro.
2204 */ 2219 */