summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-04-15 17:43:31 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-04-15 17:43:31 +0000
commitb9eda7c38c67b115c9a3b2706938972fe6adac5d (patch)
tree143dc59e48e8033cf921242bae876f2657a6f317 /sys/arch
parent3bc768a22e2cc66ea8b311cb4466a66fb5e4997c (diff)
Since XFree doesn't try to remap things behind our backs anymore, simplify
the driver a bit (mainly don't reprobe the pci address for every call to vgafb_mmap()).
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/dev/vgafb.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c
index 59e7f3947e8..7a149be7188 100644
--- a/sys/arch/sparc64/dev/vgafb.c
+++ b/sys/arch/sparc64/dev/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.16 2002/04/08 17:49:42 jason Exp $ */
+/* $OpenBSD: vgafb.c,v 1.17 2002/04/15 17:43:30 jason Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -70,8 +70,6 @@ struct vgafb_softc {
bus_addr_t sc_io_addr, sc_mem_addr, sc_mmio_addr, sc_rom_addr;
bus_size_t sc_io_size, sc_mem_size, sc_mmio_size, sc_rom_size;
pci_chipset_tag_t sc_pci_chip;
- pcitag_t sc_pci_tag;
- int sc_io_cf, sc_mmio_cf, sc_mem_cf;
u_int8_t *sc_rom_ptr;
int sc_has_rom;
struct rcons sc_rcons;
@@ -180,8 +178,8 @@ vgafbattach(parent, self, aux)
struct wsemuldisplaydev_attach_args waa;
long defattr;
- sc->sc_pci_chip = pa->pa_pc;
- sc->sc_pci_tag = pa->pa_tag;
+ sc->sc_mem_t = pa->pa_memt;
+ sc->sc_io_t = pa->pa_iot;
sc->sc_node = PCITAG_NODE(pa->pa_tag);
sc->sc_depth = getpropint(sc->sc_node, "depth", -1);
@@ -424,8 +422,6 @@ vgafb_mmap(v, off, prot)
int prot;
{
struct vgafb_softc *sc = v;
- bus_addr_t ba;
- bus_size_t bs;
paddr_t pa;
vaddr_t va;
@@ -434,16 +430,16 @@ vgafb_mmap(v, off, prot)
switch (sc->sc_mode) {
case WSDISPLAYIO_MODE_MAPPED:
- if ((pci_mem_find(sc->sc_pci_chip, sc->sc_pci_tag,
- sc->sc_mem_cf, &ba, &bs, NULL) == 0) &&
- (off >= ba) && (off < (ba + bs)))
- return (bus_space_mmap(sc->sc_mem_t, ba, off - ba,
+ if (off >= sc->sc_mem_addr &&
+ off < (sc->sc_mem_addr + sc->sc_mem_size))
+ return (bus_space_mmap(sc->sc_mem_t,
+ sc->sc_mem_addr, off - sc->sc_mem_addr,
prot, BUS_SPACE_MAP_LINEAR));
- if ((pci_mem_find(sc->sc_pci_chip, sc->sc_pci_tag,
- sc->sc_mmio_cf, &ba, &bs, NULL) == 0) &&
- (off >= ba) && (off < (ba + bs)))
- return (bus_space_mmap(sc->sc_mem_t, ba, off - ba,
+ if (off >= sc->sc_mmio_addr &&
+ off < (sc->sc_mmio_addr + sc->sc_mmio_size))
+ return (bus_space_mmap(sc->sc_mem_t,
+ sc->sc_mmio_addr, off - sc->sc_mmio_addr,
prot, BUS_SPACE_MAP_LINEAR));
if (sc->sc_rom_ptr != NULL &&
@@ -599,10 +595,9 @@ vgafb_mapregs(sc, pa)
printf(": can't map io space\n");
continue;
}
- sc->sc_io_cf = i;
hasio = 1;
} else {
- /* Memory mapping... framebuffer or mmio? */
+ /* Memory mapping... frame memory or mmio? */
if (pci_mem_find(pa->pa_pc, pa->pa_tag, i,
&ba, &bs, NULL)) {
printf(": failed to find mem at 0x%x\n", i);
@@ -619,7 +614,6 @@ vgafb_mapregs(sc, pa)
}
sc->sc_mmio_addr = ba;
sc->sc_mmio_size = bs;
- sc->sc_mmio_cf = i;
hasmmio = 1;
} else {
if (hasmem)
@@ -632,7 +626,6 @@ vgafb_mapregs(sc, pa)
}
sc->sc_mem_addr = ba;
sc->sc_mem_size = bs;
- sc->sc_mem_cf = i;
hasmem = 1;
}
}
@@ -643,9 +636,6 @@ vgafb_mapregs(sc, pa)
goto fail;
}
- sc->sc_mem_t = pa->pa_memt;
- sc->sc_io_t = pa->pa_iot;
-
return (0);
fail: