]> git.dujemihanovic.xyz Git - linux.git/commitdiff
drm/amdgpu/bios: split vbios fetching between APU and dGPU
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Sep 2024 20:22:01 +0000 (16:22 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Sep 2024 20:15:09 +0000 (16:15 -0400)
We need some different logic for dGPUs and the APU path
can be simplified because there are some methods which
are never used on APUs.  This also fixes a regression
on some older APUs causing the driver to fetch the
unpatched ROM image rather than the patched image.

Fixes: 9c081c11c621 ("drm/amdgpu: Reorder to read EFI exported ROM first")
Reviewed-by: George Zhang <George.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c

index 42e64bce661e47ed85aa9341e5698592440724a3..e8f62d718167bf22101c9616881afc0e10a7f8c3 100644 (file)
@@ -414,7 +414,36 @@ static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev)
 }
 #endif
 
-bool amdgpu_get_bios(struct amdgpu_device *adev)
+static bool amdgpu_get_bios_apu(struct amdgpu_device *adev)
+{
+       if (amdgpu_acpi_vfct_bios(adev)) {
+               dev_info(adev->dev, "Fetched VBIOS from VFCT\n");
+               goto success;
+       }
+
+       if (igp_read_bios_from_vram(adev)) {
+               dev_info(adev->dev, "Fetched VBIOS from VRAM BAR\n");
+               goto success;
+       }
+
+       if (amdgpu_read_bios(adev)) {
+               dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
+               goto success;
+       }
+
+       if (amdgpu_read_platform_bios(adev)) {
+               dev_info(adev->dev, "Fetched VBIOS from platform\n");
+               goto success;
+       }
+
+       dev_err(adev->dev, "Unable to locate a BIOS ROM\n");
+       return false;
+
+success:
+       return true;
+}
+
+static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
 {
        if (amdgpu_atrm_get_bios(adev)) {
                dev_info(adev->dev, "Fetched VBIOS from ATRM\n");
@@ -455,10 +484,24 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
        return false;
 
 success:
-       adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10;
        return true;
 }
 
+bool amdgpu_get_bios(struct amdgpu_device *adev)
+{
+       bool found;
+
+       if (adev->flags & AMD_IS_APU)
+               found = amdgpu_get_bios_apu(adev);
+       else
+               found = amdgpu_get_bios_dgpu(adev);
+
+       if (found)
+               adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10;
+
+       return found;
+}
+
 /* helper function for soc15 and onwards to read bios from rom */
 bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
                                     u8 *bios, u32 length_bytes)