Commit 9f6a7857 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/amdgpu: move apu flags initialization to the start of device init

In some asics, we need to adjust the behavior according to the apu flags
at very early stage.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarAaron Liu <aaron.liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 25f178bb
...@@ -1369,6 +1369,38 @@ static void amdgpu_device_check_smu_prv_buffer_size(struct amdgpu_device *adev) ...@@ -1369,6 +1369,38 @@ static void amdgpu_device_check_smu_prv_buffer_size(struct amdgpu_device *adev)
adev->pm.smu_prv_buffer_size = 0; adev->pm.smu_prv_buffer_size = 0;
} }
static int amdgpu_device_init_apu_flags(struct amdgpu_device *adev)
{
if (!(adev->flags & AMD_IS_APU) ||
adev->asic_type < CHIP_RAVEN)
return 0;
switch (adev->asic_type) {
case CHIP_RAVEN:
if (adev->pdev->device == 0x15dd)
adev->apu_flags |= AMD_APU_IS_RAVEN;
if (adev->pdev->device == 0x15d8)
adev->apu_flags |= AMD_APU_IS_PICASSO;
break;
case CHIP_RENOIR:
if ((adev->pdev->device == 0x1636) ||
(adev->pdev->device == 0x164c))
adev->apu_flags |= AMD_APU_IS_RENOIR;
else
adev->apu_flags |= AMD_APU_IS_GREEN_SARDINE;
break;
case CHIP_VANGOGH:
adev->apu_flags |= AMD_APU_IS_VANGOGH;
break;
case CHIP_YELLOW_CARP:
break;
default:
return -EINVAL;
}
return 0;
}
/** /**
* amdgpu_device_check_arguments - validate module params * amdgpu_device_check_arguments - validate module params
* *
...@@ -3386,6 +3418,10 @@ int amdgpu_device_init(struct amdgpu_device *adev, ...@@ -3386,6 +3418,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,
mutex_init(&adev->psp.mutex); mutex_init(&adev->psp.mutex);
mutex_init(&adev->notifier_lock); mutex_init(&adev->notifier_lock);
r = amdgpu_device_init_apu_flags(adev);
if (r)
return r;
r = amdgpu_device_check_arguments(adev); r = amdgpu_device_check_arguments(adev);
if (r) if (r)
return r; return r;
......
...@@ -1305,7 +1305,6 @@ static int nv_common_early_init(void *handle) ...@@ -1305,7 +1305,6 @@ static int nv_common_early_init(void *handle)
break; break;
case CHIP_VANGOGH: case CHIP_VANGOGH:
adev->apu_flags |= AMD_APU_IS_VANGOGH;
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_MGLS |
AMD_CG_SUPPORT_GFX_CP_LS | AMD_CG_SUPPORT_GFX_CP_LS |
......
...@@ -1360,10 +1360,7 @@ static int soc15_common_early_init(void *handle) ...@@ -1360,10 +1360,7 @@ static int soc15_common_early_init(void *handle)
break; break;
case CHIP_RAVEN: case CHIP_RAVEN:
adev->asic_funcs = &soc15_asic_funcs; adev->asic_funcs = &soc15_asic_funcs;
if (adev->pdev->device == 0x15dd)
adev->apu_flags |= AMD_APU_IS_RAVEN;
if (adev->pdev->device == 0x15d8)
adev->apu_flags |= AMD_APU_IS_PICASSO;
if (adev->rev_id >= 0x8) if (adev->rev_id >= 0x8)
adev->apu_flags |= AMD_APU_IS_RAVEN2; adev->apu_flags |= AMD_APU_IS_RAVEN2;
...@@ -1455,11 +1452,6 @@ static int soc15_common_early_init(void *handle) ...@@ -1455,11 +1452,6 @@ static int soc15_common_early_init(void *handle)
break; break;
case CHIP_RENOIR: case CHIP_RENOIR:
adev->asic_funcs = &soc15_asic_funcs; adev->asic_funcs = &soc15_asic_funcs;
if ((adev->pdev->device == 0x1636) ||
(adev->pdev->device == 0x164c))
adev->apu_flags |= AMD_APU_IS_RENOIR;
else
adev->apu_flags |= AMD_APU_IS_GREEN_SARDINE;
if (adev->apu_flags & AMD_APU_IS_RENOIR) if (adev->apu_flags & AMD_APU_IS_RENOIR)
adev->external_rev_id = adev->rev_id + 0x91; adev->external_rev_id = adev->rev_id + 0x91;
......
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