]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amdgpu: merge bios post checking functions
authorpding <Pixel.Ding@amd.com>
Thu, 19 Oct 2017 01:38:39 +0000 (09:38 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 20 Oct 2017 17:28:19 +0000 (13:28 -0400)
Merge the post checking functions to avoid confusion and take
virtualization into account in all cases.

Signed-off-by: pding <Pixel.Ding@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 0b9332e65a4c35552edf351fd1efc5503dd0599f..8cf58911b17b28dd2e8a9402a4928facaea9df1f 100644 (file)
@@ -744,27 +744,6 @@ bool amdgpu_need_post(struct amdgpu_device *adev)
 {
        uint32_t reg;
 
-       if (adev->has_hw_reset) {
-               adev->has_hw_reset = false;
-               return true;
-       }
-
-       /* bios scratch used on CIK+ */
-       if (adev->asic_type >= CHIP_BONAIRE)
-               return amdgpu_atombios_scratch_need_asic_init(adev);
-
-       /* check MEM_SIZE for older asics */
-       reg = amdgpu_asic_get_config_memsize(adev);
-
-       if ((reg != 0) && (reg != 0xffffffff))
-               return false;
-
-       return true;
-
-}
-
-static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
-{
        if (amdgpu_sriov_vf(adev))
                return false;
 
@@ -787,7 +766,23 @@ static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
                                return true;
                }
        }
-       return amdgpu_need_post(adev);
+
+       if (adev->has_hw_reset) {
+               adev->has_hw_reset = false;
+               return true;
+       }
+
+       /* bios scratch used on CIK+ */
+       if (adev->asic_type >= CHIP_BONAIRE)
+               return amdgpu_atombios_scratch_need_asic_init(adev);
+
+       /* check MEM_SIZE for older asics */
+       reg = amdgpu_asic_get_config_memsize(adev);
+
+       if ((reg != 0) && (reg != 0xffffffff))
+               return false;
+
+       return true;
 }
 
 /**
@@ -2208,7 +2203,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        amdgpu_device_detect_sriov_bios(adev);
 
        /* Post card if necessary */
-       if (amdgpu_vpost_needed(adev)) {
+       if (amdgpu_need_post(adev)) {
                if (!adev->bios) {
                        dev_err(adev->dev, "no vBIOS found\n");
                        amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_NO_VBIOS, 0, 0);