drm/amdgpu: Check if FB BAR is enabled for ROM read
authorLijo Lazar <lijo.lazar@amd.com>
Tue, 2 Mar 2021 08:28:43 +0000 (16:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 24 Mar 2021 03:02:05 +0000 (23:02 -0400)
Some configurations don't have FB BAR enabled. Avoid reading ROM image
from FB BAR region in such cases.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c

index efdf639f6593546d852e81e9bccd454dc6571027..f454a6bd0ed6e7daf3a49adb7863fb497beebd29 100644 (file)
@@ -97,6 +97,10 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
                if (amdgpu_device_need_post(adev))
                        return false;
 
+       /* FB BAR not enabled */
+       if (pci_resource_len(adev->pdev, 0) == 0)
+               return false;
+
        adev->bios = NULL;
        vram_base = pci_resource_start(adev->pdev, 0);
        bios = ioremap_wc(vram_base, size);