summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGeorge Koehler <gkoehler@cvs.openbsd.org>2022-12-31 05:06:19 +0000
committerGeorge Koehler <gkoehler@cvs.openbsd.org>2022-12-31 05:06:19 +0000
commit39f246938f33f2fe52e6a210c07e8fc8d62cb3be (patch)
tree267e71ed72693b76147bdac7b771b135ab4bccc5 /sys
parent82dde4ed3b019c8ac330c53185c78ac0d41af184 (diff)
Look for the first 2 mem regions, ignore the rest
Some macppc nvidia graphics cards have a 3rd mem region, but nv(4) wants to mmap the 1st and 2nd regions. ok miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/pci/vgafb.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c
index 2994310f604..f7be0086be0 100644
--- a/sys/arch/macppc/pci/vgafb.c
+++ b/sys/arch/macppc/pci/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.63 2022/07/15 17:57:26 kettenis Exp $ */
+/* $OpenBSD: vgafb.c,v 1.64 2022/12/31 05:06:18 gkoehler Exp $ */
/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */
/*
@@ -511,6 +511,12 @@ vgafb_mapregs(struct vgafb_softc *sc, struct pci_attach_args *pa)
uint32_t i, cf;
int rv;
+ /*
+ * Look for the first 2 mem regions. For r128, this skips the
+ * io region 0x14 and finds frame memory 0x10 and mmio 0x18.
+ * For nvidia, this finds mmio 0x10 and frame memory 0x14.
+ * Some nvidias have a 3rd mem region 0x18, which we ignore.
+ */
for (i = PCI_MAPREG_START; i <= PCI_MAPREG_PPB_END; i += 4) {
cf = pci_conf_read(pa->pa_pc, pa->pa_tag, i);
if (PCI_MAPREG_TYPE(cf) == PCI_MAPREG_TYPE_MEM) {
@@ -549,6 +555,8 @@ vgafb_mapregs(struct vgafb_softc *sc, struct pci_attach_args *pa)
sc->sc_mem_addr = ba;
sc->sc_mem_size = bs;
}
+ /* Ignore any other mem region. */
+ break;
}
}
}