drm/amdgpu: use defines for mmBIF_IOV_FUNC_IDENTIFIER fields
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Dec 2017 14:57:53 +0000 (09:57 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 20 Dec 2017 04:44:13 +0000 (23:44 -0500)
Rather than magic numbers.

Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/vi.c

index c59b37365e4d2f35f80fca08a9dc84baaa5d898d..da2b99c2d95f06953d285b0e6bbd4093e768f423 100644 (file)
@@ -455,11 +455,10 @@ static void vi_detect_hw_virtualization(struct amdgpu_device *adev)
            adev->asic_type == CHIP_FIJI) {
               reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);
               /* bit0: 0 means pf and 1 means vf */
-              /* bit31: 0 means disable IOV and 1 means enable */
-              if (reg & 1)
+              if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, FUNC_IDENTIFIER))
                       adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
-
-              if (reg & 0x80000000)
+              /* bit31: 0 means disable IOV and 1 means enable */
+              if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, IOV_ENABLE))
                       adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
        }