summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc64/dev/vgafb.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c
index 26e01b9a9ea..98d79f385ac 100644
--- a/sys/arch/sparc64/dev/vgafb.c
+++ b/sys/arch/sparc64/dev/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.52 2008/03/23 12:10:53 miod Exp $ */
+/* $OpenBSD: vgafb.c,v 1.53 2008/08/11 20:56:55 kettenis Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -418,10 +418,19 @@ vgafb_mmap(v, off, prot)
sc->sc_mem_addr, off - sc->sc_mem_addr,
prot, BUS_SPACE_MAP_LINEAR));
- if (off >= sc->sc_mmio_addr &&
+ /*
+ * ATI Mach64 boards have an mmio region that's
+ * typically smaller than a page and therefore may end
+ * up being not aligned to a page boundary. Alow the
+ * whole page to be mapped and hope the firmware
+ * didn't put any resources on the same page that
+ * belong to a different device.
+ */
+ if (off >= trunc_page(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,
+ trunc_page(sc->sc_mmio_addr),
+ off - trunc_page(sc->sc_mmio_addr),
prot, BUS_SPACE_MAP_LINEAR));
break;