diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2017-06-30 17:08:45 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-07-14 11:06:04 -0400 |
commit | d05da0e24bb584baf634489810561fc3d2a83bf3 (patch) | |
tree | 36d59a326acc891ebe230e6b0311df1283071144 /drivers/gpu/drm | |
parent | 3164cba317c235f950c861928b290dd93b30d821 (diff) |
drm/amdgpu: unify some atombios/atomfirmware scratch reg functions
Now that we use a pointer to the scratch reg start offset,
most of the functions were duplicated.
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 35 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc15.c | 6 |
4 files changed, 7 insertions, 58 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c index 4bdda56fccee..9ddfe34d12af 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | |||
@@ -66,41 +66,6 @@ void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | void amdgpu_atomfirmware_scratch_regs_save(struct amdgpu_device *adev) | ||
70 | { | ||
71 | int i; | ||
72 | |||
73 | for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) | ||
74 | adev->bios_scratch[i] = RREG32(adev->bios_scratch_reg_offset + i); | ||
75 | } | ||
76 | |||
77 | void amdgpu_atomfirmware_scratch_regs_restore(struct amdgpu_device *adev) | ||
78 | { | ||
79 | int i; | ||
80 | |||
81 | /* | ||
82 | * VBIOS will check ASIC_INIT_COMPLETE bit to decide if | ||
83 | * execute ASIC_Init posting via driver | ||
84 | */ | ||
85 | adev->bios_scratch[7] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK; | ||
86 | |||
87 | for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) | ||
88 | WREG32(adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]); | ||
89 | } | ||
90 | |||
91 | void amdgpu_atomfirmware_scratch_regs_engine_hung(struct amdgpu_device *adev, | ||
92 | bool hung) | ||
93 | { | ||
94 | u32 tmp = RREG32(adev->bios_scratch_reg_offset + 3); | ||
95 | |||
96 | if (hung) | ||
97 | tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
98 | else | ||
99 | tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
100 | |||
101 | WREG32(adev->bios_scratch_reg_offset + 3, tmp); | ||
102 | } | ||
103 | |||
104 | int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev) | 69 | int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev) |
105 | { | 70 | { |
106 | struct atom_context *ctx = adev->mode_info.atom_context; | 71 | struct atom_context *ctx = adev->mode_info.atom_context; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h index a2c3ebe22c71..907e48f6b301 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | |||
@@ -26,10 +26,6 @@ | |||
26 | 26 | ||
27 | bool amdgpu_atomfirmware_gpu_supports_virtualization(struct amdgpu_device *adev); | 27 | bool amdgpu_atomfirmware_gpu_supports_virtualization(struct amdgpu_device *adev); |
28 | void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev); | 28 | void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev); |
29 | void amdgpu_atomfirmware_scratch_regs_save(struct amdgpu_device *adev); | ||
30 | void amdgpu_atomfirmware_scratch_regs_restore(struct amdgpu_device *adev); | ||
31 | void amdgpu_atomfirmware_scratch_regs_engine_hung(struct amdgpu_device *adev, | ||
32 | bool hung); | ||
33 | int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev); | 29 | int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev); |
34 | 30 | ||
35 | #endif | 31 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 88e45c6d36ea..7963c54e5d03 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -2393,10 +2393,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) | |||
2393 | */ | 2393 | */ |
2394 | amdgpu_bo_evict_vram(adev); | 2394 | amdgpu_bo_evict_vram(adev); |
2395 | 2395 | ||
2396 | if (adev->is_atom_fw) | 2396 | amdgpu_atombios_scratch_regs_save(adev); |
2397 | amdgpu_atomfirmware_scratch_regs_save(adev); | ||
2398 | else | ||
2399 | amdgpu_atombios_scratch_regs_save(adev); | ||
2400 | pci_save_state(dev->pdev); | 2397 | pci_save_state(dev->pdev); |
2401 | if (suspend) { | 2398 | if (suspend) { |
2402 | /* Shut down the device */ | 2399 | /* Shut down the device */ |
@@ -2445,10 +2442,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) | |||
2445 | if (r) | 2442 | if (r) |
2446 | goto unlock; | 2443 | goto unlock; |
2447 | } | 2444 | } |
2448 | if (adev->is_atom_fw) | 2445 | amdgpu_atombios_scratch_regs_restore(adev); |
2449 | amdgpu_atomfirmware_scratch_regs_restore(adev); | ||
2450 | else | ||
2451 | amdgpu_atombios_scratch_regs_restore(adev); | ||
2452 | 2446 | ||
2453 | /* post card */ | 2447 | /* post card */ |
2454 | if (amdgpu_need_post(adev)) { | 2448 | if (amdgpu_need_post(adev)) { |
@@ -2861,15 +2855,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) | |||
2861 | r = amdgpu_suspend(adev); | 2855 | r = amdgpu_suspend(adev); |
2862 | 2856 | ||
2863 | retry: | 2857 | retry: |
2864 | if (adev->is_atom_fw) | 2858 | amdgpu_atombios_scratch_regs_save(adev); |
2865 | amdgpu_atomfirmware_scratch_regs_save(adev); | ||
2866 | else | ||
2867 | amdgpu_atombios_scratch_regs_save(adev); | ||
2868 | r = amdgpu_asic_reset(adev); | 2859 | r = amdgpu_asic_reset(adev); |
2869 | if (adev->is_atom_fw) | 2860 | amdgpu_atombios_scratch_regs_restore(adev); |
2870 | amdgpu_atomfirmware_scratch_regs_restore(adev); | ||
2871 | else | ||
2872 | amdgpu_atombios_scratch_regs_restore(adev); | ||
2873 | /* post card */ | 2861 | /* post card */ |
2874 | amdgpu_atom_asic_init(adev->mode_info.atom_context); | 2862 | amdgpu_atom_asic_init(adev->mode_info.atom_context); |
2875 | 2863 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index a7341d88a320..79f5e3e73e0b 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <drm/drmP.h> | 26 | #include <drm/drmP.h> |
27 | #include "amdgpu.h" | 27 | #include "amdgpu.h" |
28 | #include "amdgpu_atomfirmware.h" | 28 | #include "amdgpu_atombios.h" |
29 | #include "amdgpu_ih.h" | 29 | #include "amdgpu_ih.h" |
30 | #include "amdgpu_uvd.h" | 30 | #include "amdgpu_uvd.h" |
31 | #include "amdgpu_vce.h" | 31 | #include "amdgpu_vce.h" |
@@ -392,11 +392,11 @@ static void soc15_gpu_pci_config_reset(struct amdgpu_device *adev) | |||
392 | 392 | ||
393 | static int soc15_asic_reset(struct amdgpu_device *adev) | 393 | static int soc15_asic_reset(struct amdgpu_device *adev) |
394 | { | 394 | { |
395 | amdgpu_atomfirmware_scratch_regs_engine_hung(adev, true); | 395 | amdgpu_atombios_scratch_regs_engine_hung(adev, true); |
396 | 396 | ||
397 | soc15_gpu_pci_config_reset(adev); | 397 | soc15_gpu_pci_config_reset(adev); |
398 | 398 | ||
399 | amdgpu_atomfirmware_scratch_regs_engine_hung(adev, false); | 399 | amdgpu_atombios_scratch_regs_engine_hung(adev, false); |
400 | 400 | ||
401 | return 0; | 401 | return 0; |
402 | } | 402 | } |