Commit b5c73856 authored by Xiaojie Yuan's avatar Xiaojie Yuan Committed by Alex Deucher

drm/amdgpu/discovery: move common discovery code out of navi1*_reg_base_init()

move amdgpu_discovery_reg_base_init() from navi1*_reg_base_init() to a
common function nv_reg_base_init().
Signed-off-by: default avatarXiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 35ef88fa
...@@ -29,20 +29,8 @@ ...@@ -29,20 +29,8 @@
int navi10_reg_base_init(struct amdgpu_device *adev) int navi10_reg_base_init(struct amdgpu_device *adev)
{ {
int r, i; int 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) { for (i = 0 ; i < MAX_INSTANCE ; ++i) {
adev->reg_offset[GC_HWIP][i] = (uint32_t *)(&(GC_BASE.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])); adev->reg_offset[HDP_HWIP][i] = (uint32_t *)(&(HDP_BASE.instance[i]));
......
...@@ -29,20 +29,8 @@ ...@@ -29,20 +29,8 @@
int navi14_reg_base_init(struct amdgpu_device *adev) int navi14_reg_base_init(struct amdgpu_device *adev)
{ {
int r, i; int 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) { for (i = 0 ; i < MAX_INSTANCE ; ++i) {
adev->reg_offset[GC_HWIP][i] = (uint32_t *)(&(GC_BASE.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])); adev->reg_offset[HDP_HWIP][i] = (uint32_t *)(&(HDP_BASE.instance[i]));
......
...@@ -376,9 +376,22 @@ static const struct amdgpu_ip_block_version nv_common_ip_block = ...@@ -376,9 +376,22 @@ static const struct amdgpu_ip_block_version nv_common_ip_block =
.funcs = &nv_common_ip_funcs, .funcs = &nv_common_ip_funcs,
}; };
int nv_set_ip_blocks(struct amdgpu_device *adev) static int nv_reg_base_init(struct amdgpu_device *adev)
{ {
/* Set IP register base before any HW register access */ int r;
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:
switch (adev->asic_type) { switch (adev->asic_type) {
case CHIP_NAVI10: case CHIP_NAVI10:
navi10_reg_base_init(adev); navi10_reg_base_init(adev);
...@@ -393,6 +406,18 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) ...@@ -393,6 +406,18 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
return 0;
}
int nv_set_ip_blocks(struct amdgpu_device *adev)
{
int r;
/* Set IP register base before any HW register access */
r = nv_reg_base_init(adev);
if (r)
return r;
adev->nbio_funcs = &nbio_v2_3_funcs; adev->nbio_funcs = &nbio_v2_3_funcs;
adev->nbio_funcs->detect_hw_virt(adev); adev->nbio_funcs->detect_hw_virt(adev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment