summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-12-27 14:33:56 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-12-27 14:33:56 +0000
commitdb3609ce558d7563615796b50372a2144006869e (patch)
tree9b6e3672dfb351769f2cdc8fbdd1a8376782fb17 /sys
parentacb3a29533c9bd7a1ce494125da9dec658149d40 (diff)
Make sure we pick the right PCI BARs on Expert3D cards (which have an extra
BAR that we need to skip). ok miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/dev/ifb.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/arch/sparc64/dev/ifb.c b/sys/arch/sparc64/dev/ifb.c
index 1cb0b29b5a9..9cc81b0ff53 100644
--- a/sys/arch/sparc64/dev/ifb.c
+++ b/sys/arch/sparc64/dev/ifb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifb.c,v 1.2 2008/03/23 20:20:11 miod Exp $ */
+/* $OpenBSD: ifb.c,v 1.3 2008/12/27 14:33:55 kettenis Exp $ */
/*
* Copyright (c) 2007, 2008 Miodrag Vallat.
@@ -86,6 +86,14 @@
* to parasite overlays appearing sometimes in the screen...
*/
+/*
+ * The Expert3D has an extra BAR that is not present on the -Lite
+ * version. This register contains bits that tell us how many BARs to
+ * skip before we get to the BARs that interest us.
+ */
+#define IFB_PCI_CFG 0x5c
+#define IFB_PCI_CFG_BAR_OFFSET(x) ((x & 0x000000e0) >> 3)
+
#define IFB_REG_OFFSET 0x8000
/*
@@ -549,13 +557,16 @@ int
ifb_mapregs(struct ifb_softc *sc, struct pci_attach_args *pa)
{
u_int32_t cf;
- int rc;
+ int bar, rc;
+
+ cf = pci_conf_read(pa->pa_pc, pa->pa_tag, IFB_PCI_CFG);
+ bar = PCI_MAPREG_START + IFB_PCI_CFG_BAR_OFFSET(cf);
- cf = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START);
+ cf = pci_conf_read(pa->pa_pc, pa->pa_tag, bar);
if (PCI_MAPREG_TYPE(cf) == PCI_MAPREG_TYPE_IO)
rc = EINVAL;
else {
- rc = pci_mapreg_map(pa, PCI_MAPREG_START, cf,
+ rc = pci_mapreg_map(pa, bar, cf,
BUS_SPACE_MAP_LINEAR, NULL, &sc->sc_mem_h,
&sc->sc_membase, &sc->sc_memlen, 0);
}
@@ -565,11 +576,11 @@ ifb_mapregs(struct ifb_softc *sc, struct pci_attach_args *pa)
return rc;
}
- cf = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START + 4);
+ cf = pci_conf_read(pa->pa_pc, pa->pa_tag, bar + 4);
if (PCI_MAPREG_TYPE(cf) == PCI_MAPREG_TYPE_IO)
rc = EINVAL;
else {
- rc = pci_mapreg_map(pa, PCI_MAPREG_START + 4, cf,
+ rc = pci_mapreg_map(pa, bar + 4, cf,
0, NULL, &sc->sc_reg_h, NULL, NULL, 0x9000);
}
if (rc != 0) {