[PATCH 06/53] drm/amdgpu/discovery: init reg base offset via ip discovery for navi14

Alex Deucher alexdeucher at gmail.com
Tue Jul 2 20:27:57 UTC 2019


From: Xiaojie Yuan <xiaojie.yuan at amd.com>

Add IP discovery for navi14.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan at amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c b/drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c
index 28f3d6490649..864668a7f1d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c
+++ b/drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c
@@ -29,8 +29,20 @@
 
 int navi14_reg_base_init(struct amdgpu_device *adev)
 {
-	/* HW has more IP blocks,  only initialized the blocke needed by driver */
-	uint32_t i;
+	int r, i;
+
+	if (amdgpu_discovery) {
+		r = amdgpu_discovery_reg_base_init(adev);
+		if (r) {
+			DRM_WARN("failed to init reg base from ip discovery table, "
+					"fallback to legacy init method\n");
+			goto legacy_init;
+		}
+
+		return 0;
+	}
+
+legacy_init:
 	for (i = 0 ; i < MAX_INSTANCE ; ++i) {
 		adev->reg_offset[GC_HWIP][i] = (uint32_t *)(&(GC_BASE.instance[i]));
 		adev->reg_offset[HDP_HWIP][i] = (uint32_t *)(&(HDP_BASE.instance[i]));
@@ -49,5 +61,6 @@ int navi14_reg_base_init(struct amdgpu_device *adev)
 		adev->reg_offset[THM_HWIP][i] = (uint32_t *)(&(THM_BASE.instance[i]));
 		adev->reg_offset[CLK_HWIP][i] = (uint32_t *)(&(CLK_BASE.instance[i]));
 	}
+
 	return 0;
 }
-- 
2.20.1



More information about the amd-gfx mailing list