Skip to content

Commit 27145f7

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Prefer shadow rom when available
Fetch VBIOS from shadow ROM when available before trying other methods like EFI method. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Fixes: 9c081c1 ("drm/amdgpu: Reorder to read EFI exported ROM first") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4066 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 942de4e commit 27145f7

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,13 @@ static bool amdgpu_get_bios_apu(struct amdgpu_device *adev)
447447
return true;
448448
}
449449

450+
static bool amdgpu_prefer_rom_resource(struct amdgpu_device *adev)
451+
{
452+
struct resource *res = &adev->pdev->resource[PCI_ROM_RESOURCE];
453+
454+
return (res->flags & IORESOURCE_ROM_SHADOW);
455+
}
456+
450457
static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
451458
{
452459
if (amdgpu_atrm_get_bios(adev)) {
@@ -465,14 +472,27 @@ static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
465472
goto success;
466473
}
467474

468-
if (amdgpu_read_platform_bios(adev)) {
469-
dev_info(adev->dev, "Fetched VBIOS from platform\n");
470-
goto success;
471-
}
475+
if (amdgpu_prefer_rom_resource(adev)) {
476+
if (amdgpu_read_bios(adev)) {
477+
dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
478+
goto success;
479+
}
472480

473-
if (amdgpu_read_bios(adev)) {
474-
dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
475-
goto success;
481+
if (amdgpu_read_platform_bios(adev)) {
482+
dev_info(adev->dev, "Fetched VBIOS from platform\n");
483+
goto success;
484+
}
485+
486+
} else {
487+
if (amdgpu_read_platform_bios(adev)) {
488+
dev_info(adev->dev, "Fetched VBIOS from platform\n");
489+
goto success;
490+
}
491+
492+
if (amdgpu_read_bios(adev)) {
493+
dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
494+
goto success;
495+
}
476496
}
477497

478498
if (amdgpu_read_bios_from_rom(adev)) {

0 commit comments

Comments
 (0)