summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-11-26 02:20:51 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-11-26 02:20:51 +0000
commit2af6bf258bc66d293733484b8e990300e385ba76 (patch)
tree9f2784ce3e7af67176e8583a6d205043bd663e38 /sys
parentd2a1b06e625b929bca1ac4f980fd329091262a5e (diff)
When deciding if a pci device is 'primary' test if the efi fb memory
range is contained in a pci bar instead of only testing if the start address of the efi fb is non zero. Corrects a problem reported by Brennan Vincent on a Dell XPS 9575 with amdgpu and inteldrm booted via efi. amdgpu would wrongly decide it was primary on probe and as a result when encountering an unrelated error efifb would reattach when amdgpu detached. When inteldrm would latter attach an assert would trigger as efifb had already claimed the console. ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/efifb.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/efifb.c b/sys/arch/amd64/amd64/efifb.c
index e3570d7a90a..44c2478463e 100644
--- a/sys/arch/amd64/amd64/efifb.c
+++ b/sys/arch/amd64/amd64/efifb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efifb.c,v 1.25 2019/10/13 10:56:31 kettenis Exp $ */
+/* $OpenBSD: efifb.c,v 1.26 2019/11/26 02:20:50 jsg Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -520,15 +520,20 @@ efifb_is_primary(struct pci_attach_args *pa)
if (pci_mapreg_info(pc, tag, reg, type, &base, &size, NULL))
continue;
- if (bios_efiinfo != NULL && bios_efiinfo->fb_addr != 0)
- return (1);
+ if (bios_efiinfo != NULL &&
+ bios_efiinfo->fb_addr >= base &&
+ bios_efiinfo->fb_addr < base + size)
+ return 1;
+
+ if (efifb_console.paddr >= base &&
+ efifb_console.paddr < base + size)
+ return 1;
if (type & PCI_MAPREG_MEM_TYPE_64BIT)
reg += 4;
}
- /* XXX coreboot framebuffer isn't matched above. */
- return efifb_is_console(pa);;
+ return 0;
}
void