diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-10-31 07:49:27 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-11-05 15:49:38 -0500 |
commit | f6cffc0d4d3c20bd5c9b3c825448016d7388b43a (patch) | |
tree | 1258a5d196a22d3e27f37792af78290fcea7a83d /drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | |
parent | ccf191f8aabf8cb7bb01e4efae7bdb73614c745b (diff) |
drm/amdgpu: Add helper function to get sdma index
Get the sdma index from ring
v2: refine function name
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index c91223021ab4..115bb0c99b0f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | |||
@@ -40,3 +40,19 @@ struct amdgpu_sdma_instance *amdgpu_sdma_get_instance_from_ring(struct amdgpu_ri | |||
40 | 40 | ||
41 | return NULL; | 41 | return NULL; |
42 | } | 42 | } |
43 | |||
44 | int amdgpu_sdma_get_index_from_ring(struct amdgpu_ring *ring, uint32_t *index) | ||
45 | { | ||
46 | struct amdgpu_device *adev = ring->adev; | ||
47 | int i; | ||
48 | |||
49 | for (i = 0; i < adev->sdma.num_instances; i++) { | ||
50 | if (ring == &adev->sdma.instance[i].ring || | ||
51 | ring == &adev->sdma.instance[i].page) { | ||
52 | *index = i; | ||
53 | return 0; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | return -EINVAL; | ||
58 | } | ||