Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/fdt For drivers whose framebuffer is located not pag...
details: https://anonhg.NetBSD.org/src/rev/e709d6b56b2a
branches: trunk
changeset: 962492:e709d6b56b2a
user: rin <rin%NetBSD.org@localhost>
date: Tue Jul 23 14:34:11 2019 +0000
description:
For drivers whose framebuffer is located not page-aligned, permit
offset of mmap up to (length of framebuffer) + (page offset of base
address of framebuffer). This is necessary in order to map the
highest page of framebuffer correctly, see,
http://cvsweb.netbsd.org/bsdweb.cgi/xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c#rev1.35
diffstat:
sys/arch/arm/omap/tifb.c | 7 ++++---
sys/arch/luna68k/dev/lunafb.c | 7 ++++---
sys/dev/fdt/simplefb.c | 9 +++++----
3 files changed, 13 insertions(+), 10 deletions(-)
diffs (88 lines):
diff -r 37879af73de2 -r e709d6b56b2a sys/arch/arm/omap/tifb.c
--- a/sys/arch/arm/omap/tifb.c Tue Jul 23 14:28:24 2019 +0000
+++ b/sys/arch/arm/omap/tifb.c Tue Jul 23 14:34:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tifb.c,v 1.7 2017/03/01 16:27:25 skrll Exp $ */
+/* $NetBSD: tifb.c,v 1.8 2019/07/23 14:34:11 rin Exp $ */
/*
* Copyright (c) 2010 Michael Lorenz
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.7 2017/03/01 16:27:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.8 2019/07/23 14:34:11 rin Exp $");
#include "opt_omap.h"
@@ -816,7 +816,8 @@
struct tifb_softc *sc = vd->cookie;
/* 'regular' framebuffer mmap()ing */
- if (offset < sc->sc_stride * sc->sc_pi->panel_height) {
+ if (offset >= 0 && offset < sc->sc_palettesize +
+ sc->sc_stride * sc->sc_pi->panel_height) {
pa = bus_dmamem_mmap(sc->sc_dmat, sc->sc_dmamem, 1,
offset, prot, BUS_DMA_PREFETCHABLE);
return pa;
diff -r 37879af73de2 -r e709d6b56b2a sys/arch/luna68k/dev/lunafb.c
--- a/sys/arch/luna68k/dev/lunafb.c Tue Jul 23 14:28:24 2019 +0000
+++ b/sys/arch/luna68k/dev/lunafb.c Tue Jul 23 14:34:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.39 2019/06/30 05:04:48 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.40 2019/07/23 14:34:11 rin Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.39 2019/06/30 05:04:48 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.40 2019/07/23 14:34:11 rin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -308,7 +308,8 @@
#endif
case WSDISPLAYIO_MODE_DUMBFB:
if (offset >= 0 &&
- offset < dc->dc_rowbytes * dc->dc_ht * dc->dc_depth)
+ offset < (m68k_page_offset(OMFB_FB_RADDR) +
+ dc->dc_rowbytes * dc->dc_ht) * dc->dc_depth)
cookie = m68k_btop(m68k_trunc_page(OMFB_FB_RADDR) +
offset);
break;
diff -r 37879af73de2 -r e709d6b56b2a sys/dev/fdt/simplefb.c
--- a/sys/dev/fdt/simplefb.c Tue Jul 23 14:28:24 2019 +0000
+++ b/sys/dev/fdt/simplefb.c Tue Jul 23 14:34:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: simplefb.c,v 1.7 2019/01/30 00:55:04 jmcneill Exp $ */
+/* $NetBSD: simplefb.c,v 1.8 2019/07/23 14:34:12 rin Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "opt_wsdisplay_compat.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.7 2019/01/30 00:55:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.8 2019/07/23 14:34:12 rin Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -114,10 +114,11 @@
{
struct simplefb_softc * const sc = v;
- if (off < 0 || off >= sc->sc_gen.sc_fbsize)
+ if (off < 0 || off >= (sc->sc_paddr & PAGE_MASK) +
+ sc->sc_gen.sc_fbsize)
return -1;
- return bus_space_mmap(sc->sc_bst, sc->sc_paddr, off, prot,
+ return bus_space_mmap(sc->sc_bst, trunc_page(sc->sc_paddr), off, prot,
BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE);
}
Home |
Main Index |
Thread Index |
Old Index