summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-08-11 20:56:56 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-08-11 20:56:56 +0000
commitfa52c6dbee44e5933c7655930f53a5602448116c (patch)
treea9c0e89be60a403bdbca5f0ce3b149ad8fe0561b /sys/arch/sparc64
parent0e48c387a157680176359531c8c9f3bc434d1fbe (diff)
Allow mapping mmio regions that are not page aligned.
ok miod@
Diffstat (limited to 'sys/arch/sparc64')
-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;