提交 e695e77c 编写于 作者: A Alex Deucher

drm/amdgpu: move atom scratch register save/restore to common code

We need this for more than just DCE.  Move it out of the DCE modules
and into the device code.  This way we can be sure the scratch registers
are initialized properly before we run asic_init which happens before
DCE IPs are restored.

Fixes atombios hangs in asic_init.
Reviewed-by: NJimQu <Jim.Qu@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 08e23a02
...@@ -1959,6 +1959,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) ...@@ -1959,6 +1959,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
/* evict remaining vram memory */ /* evict remaining vram memory */
amdgpu_bo_evict_vram(adev); amdgpu_bo_evict_vram(adev);
amdgpu_atombios_scratch_regs_save(adev);
pci_save_state(dev->pdev); pci_save_state(dev->pdev);
if (suspend) { if (suspend) {
/* Shut down the device */ /* Shut down the device */
...@@ -2010,6 +2011,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) ...@@ -2010,6 +2011,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
return r; return r;
} }
} }
amdgpu_atombios_scratch_regs_restore(adev);
/* post card */ /* post card */
if (!amdgpu_card_posted(adev) || !resume) { if (!amdgpu_card_posted(adev) || !resume) {
...@@ -2277,8 +2279,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) ...@@ -2277,8 +2279,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
amdgpu_display_stop_mc_access(adev, &save); amdgpu_display_stop_mc_access(adev, &save);
amdgpu_wait_for_idle(adev, AMD_IP_BLOCK_TYPE_GMC); amdgpu_wait_for_idle(adev, AMD_IP_BLOCK_TYPE_GMC);
} }
amdgpu_atombios_scratch_regs_save(adev);
r = amdgpu_asic_reset(adev); r = amdgpu_asic_reset(adev);
amdgpu_atombios_scratch_regs_restore(adev);
/* post card */ /* post card */
amdgpu_atom_asic_init(adev->mode_info.atom_context); amdgpu_atom_asic_init(adev->mode_info.atom_context);
......
...@@ -3151,10 +3151,6 @@ static int dce_v10_0_hw_fini(void *handle) ...@@ -3151,10 +3151,6 @@ static int dce_v10_0_hw_fini(void *handle)
static int dce_v10_0_suspend(void *handle) static int dce_v10_0_suspend(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
amdgpu_atombios_scratch_regs_save(adev);
return dce_v10_0_hw_fini(handle); return dce_v10_0_hw_fini(handle);
} }
...@@ -3165,8 +3161,6 @@ static int dce_v10_0_resume(void *handle) ...@@ -3165,8 +3161,6 @@ static int dce_v10_0_resume(void *handle)
ret = dce_v10_0_hw_init(handle); ret = dce_v10_0_hw_init(handle);
amdgpu_atombios_scratch_regs_restore(adev);
/* turn on the BL */ /* turn on the BL */
if (adev->mode_info.bl_encoder) { if (adev->mode_info.bl_encoder) {
u8 bl_level = amdgpu_display_backlight_get_level(adev, u8 bl_level = amdgpu_display_backlight_get_level(adev,
......
...@@ -3215,10 +3215,6 @@ static int dce_v11_0_hw_fini(void *handle) ...@@ -3215,10 +3215,6 @@ static int dce_v11_0_hw_fini(void *handle)
static int dce_v11_0_suspend(void *handle) static int dce_v11_0_suspend(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
amdgpu_atombios_scratch_regs_save(adev);
return dce_v11_0_hw_fini(handle); return dce_v11_0_hw_fini(handle);
} }
...@@ -3229,8 +3225,6 @@ static int dce_v11_0_resume(void *handle) ...@@ -3229,8 +3225,6 @@ static int dce_v11_0_resume(void *handle)
ret = dce_v11_0_hw_init(handle); ret = dce_v11_0_hw_init(handle);
amdgpu_atombios_scratch_regs_restore(adev);
/* turn on the BL */ /* turn on the BL */
if (adev->mode_info.bl_encoder) { if (adev->mode_info.bl_encoder) {
u8 bl_level = amdgpu_display_backlight_get_level(adev, u8 bl_level = amdgpu_display_backlight_get_level(adev,
......
...@@ -2482,10 +2482,6 @@ static int dce_v6_0_hw_fini(void *handle) ...@@ -2482,10 +2482,6 @@ static int dce_v6_0_hw_fini(void *handle)
static int dce_v6_0_suspend(void *handle) static int dce_v6_0_suspend(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
amdgpu_atombios_scratch_regs_save(adev);
return dce_v6_0_hw_fini(handle); return dce_v6_0_hw_fini(handle);
} }
...@@ -2496,8 +2492,6 @@ static int dce_v6_0_resume(void *handle) ...@@ -2496,8 +2492,6 @@ static int dce_v6_0_resume(void *handle)
ret = dce_v6_0_hw_init(handle); ret = dce_v6_0_hw_init(handle);
amdgpu_atombios_scratch_regs_restore(adev);
/* turn on the BL */ /* turn on the BL */
if (adev->mode_info.bl_encoder) { if (adev->mode_info.bl_encoder) {
u8 bl_level = amdgpu_display_backlight_get_level(adev, u8 bl_level = amdgpu_display_backlight_get_level(adev,
......
...@@ -3033,10 +3033,6 @@ static int dce_v8_0_hw_fini(void *handle) ...@@ -3033,10 +3033,6 @@ static int dce_v8_0_hw_fini(void *handle)
static int dce_v8_0_suspend(void *handle) static int dce_v8_0_suspend(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
amdgpu_atombios_scratch_regs_save(adev);
return dce_v8_0_hw_fini(handle); return dce_v8_0_hw_fini(handle);
} }
...@@ -3047,8 +3043,6 @@ static int dce_v8_0_resume(void *handle) ...@@ -3047,8 +3043,6 @@ static int dce_v8_0_resume(void *handle)
ret = dce_v8_0_hw_init(handle); ret = dce_v8_0_hw_init(handle);
amdgpu_atombios_scratch_regs_restore(adev);
/* turn on the BL */ /* turn on the BL */
if (adev->mode_info.bl_encoder) { if (adev->mode_info.bl_encoder) {
u8 bl_level = amdgpu_display_backlight_get_level(adev, u8 bl_level = amdgpu_display_backlight_get_level(adev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册