[PATCH] drm/amdgpu: Expose an IP function to get register offset

Oak Zeng zengshanjun at gmail.com
Tue Oct 30 20:40:32 UTC 2018


Expose get_reg_offset function of sdma_v4_0 for kfd to use

Change-Id: Ib687b390d6d3f8c8a35651e064e35aacf6722f98
Signed-off-by: Oak Zeng <Oak.Zeng at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 7 +++++++
 drivers/gpu/drm/amd/include/amd_shared.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index f35f578..1b6c591 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -206,6 +206,12 @@ static u32 sdma_v4_0_get_reg_offset(struct amdgpu_device *adev,
 	return 0;
 }
 
+static u32 sdma_v4_0_get_reg_offset_external(void *handle, u32 instance, u32 offset)
+{
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	return sdma_v4_0_get_reg_offset(adev, instance, offset);
+}
+
 static unsigned sdma_v4_0_seq_to_irq_id(int seq_num)
 {
 	switch (seq_num) {
@@ -1746,6 +1752,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = {
 	.set_clockgating_state = sdma_v4_0_set_clockgating_state,
 	.set_powergating_state = sdma_v4_0_set_powergating_state,
 	.get_clockgating_state = sdma_v4_0_get_clockgating_state,
+	.get_reg_offset = sdma_v4_0_get_reg_offset_external,
 };
 
 static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index fc7fcb1..ab44fa8 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -173,6 +173,9 @@ struct amd_ip_funcs {
 				     enum amd_powergating_state state);
 	/* get current clockgating status */
 	void (*get_clockgating_state)(void *handle, u32 *flags);
+
+	/* get instance's register offset */
+	u32 (*get_reg_offset)(void *handle, u32 instance, u32 offset);
 };
 
 
-- 
2.7.4



More information about the amd-gfx mailing list