drm/amdgpu: unify some atombios/atomfirmware scratch reg functions
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Jun 2017 21:08:45 +0000 (17:08 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:06:04 +0000 (11:06 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/soc15.c

index 4bdda56fcceea36b8229d74ac3b76fe706919a77..9ddfe34d12afd1022460c087a389e69e721c234c 100644 (file)
@@ -66,41 +66,6 @@ void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev)
        }
 }
 
-void amdgpu_atomfirmware_scratch_regs_save(struct amdgpu_device *adev)
-{
-       int i;
-
-       for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
-               adev->bios_scratch[i] = RREG32(adev->bios_scratch_reg_offset + i);
-}
-
-void amdgpu_atomfirmware_scratch_regs_restore(struct amdgpu_device *adev)
-{
-       int i;
-
-       /*
-        * VBIOS will check ASIC_INIT_COMPLETE bit to decide if
-        * execute ASIC_Init posting via driver
-        */
-       adev->bios_scratch[7] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK;
-
-       for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
-               WREG32(adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]);
-}
-
-void amdgpu_atomfirmware_scratch_regs_engine_hung(struct amdgpu_device *adev,
-                                                 bool hung)
-{
-       u32 tmp = RREG32(adev->bios_scratch_reg_offset + 3);
-
-       if (hung)
-               tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG;
-       else
-               tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG;
-
-       WREG32(adev->bios_scratch_reg_offset + 3, tmp);
-}
-
 int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev)
 {
        struct atom_context *ctx = adev->mode_info.atom_context;
index a2c3ebe22c713aeacff5036d431ffc1e157f5f7e..907e48f6b301ee800892c56a10d81d1f1eebb633 100644 (file)
 
 bool amdgpu_atomfirmware_gpu_supports_virtualization(struct amdgpu_device *adev);
 void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev);
-void amdgpu_atomfirmware_scratch_regs_save(struct amdgpu_device *adev);
-void amdgpu_atomfirmware_scratch_regs_restore(struct amdgpu_device *adev);
-void amdgpu_atomfirmware_scratch_regs_engine_hung(struct amdgpu_device *adev,
-                                                 bool hung);
 int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev);
 
 #endif
index 88e45c6d36ea0b2b9463b946b5e827e6a2bf504d..7963c54e5d032806c952c7e4311ab8f0cb034d20 100644 (file)
@@ -2393,10 +2393,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
         */
        amdgpu_bo_evict_vram(adev);
 
-       if (adev->is_atom_fw)
-               amdgpu_atomfirmware_scratch_regs_save(adev);
-       else
-               amdgpu_atombios_scratch_regs_save(adev);
+       amdgpu_atombios_scratch_regs_save(adev);
        pci_save_state(dev->pdev);
        if (suspend) {
                /* Shut down the device */
@@ -2445,10 +2442,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
                if (r)
                        goto unlock;
        }
-       if (adev->is_atom_fw)
-               amdgpu_atomfirmware_scratch_regs_restore(adev);
-       else
-               amdgpu_atombios_scratch_regs_restore(adev);
+       amdgpu_atombios_scratch_regs_restore(adev);
 
        /* post card */
        if (amdgpu_need_post(adev)) {
@@ -2861,15 +2855,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
                r = amdgpu_suspend(adev);
 
 retry:
-               if (adev->is_atom_fw)
-                       amdgpu_atomfirmware_scratch_regs_save(adev);
-               else
-                       amdgpu_atombios_scratch_regs_save(adev);
+               amdgpu_atombios_scratch_regs_save(adev);
                r = amdgpu_asic_reset(adev);
-               if (adev->is_atom_fw)
-                       amdgpu_atomfirmware_scratch_regs_restore(adev);
-               else
-                       amdgpu_atombios_scratch_regs_restore(adev);
+               amdgpu_atombios_scratch_regs_restore(adev);
                /* post card */
                amdgpu_atom_asic_init(adev->mode_info.atom_context);
 
index a7341d88a32024728866e728c689cd946c1c099d..79f5e3e73e0b64c5fe18770871b77aadd40d2155 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/module.h>
 #include <drm/drmP.h>
 #include "amdgpu.h"
-#include "amdgpu_atomfirmware.h"
+#include "amdgpu_atombios.h"
 #include "amdgpu_ih.h"
 #include "amdgpu_uvd.h"
 #include "amdgpu_vce.h"
@@ -392,11 +392,11 @@ static void soc15_gpu_pci_config_reset(struct amdgpu_device *adev)
 
 static int soc15_asic_reset(struct amdgpu_device *adev)
 {
-       amdgpu_atomfirmware_scratch_regs_engine_hung(adev, true);
+       amdgpu_atombios_scratch_regs_engine_hung(adev, true);
 
        soc15_gpu_pci_config_reset(adev);
 
-       amdgpu_atomfirmware_scratch_regs_engine_hung(adev, false);
+       amdgpu_atombios_scratch_regs_engine_hung(adev, false);
 
        return 0;
 }