Module Name: src Committed By: macallan Date: Tue Nov 10 22:23:23 UTC 2009
Modified Files: src/sys/dev/ic: igsfb.c igsfbvar.h Log Message: add support for an optional machine-dependent mmap() method, so the bus backend can do whatever voodoo necessary to the aperture, IO space etc. Mainly for shark, to get around the weird ARM bus_space. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/igsfb.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/igsfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/igsfb.c diff -u src/sys/dev/ic/igsfb.c:1.44 src/sys/dev/ic/igsfb.c:1.45 --- src/sys/dev/ic/igsfb.c:1.44 Tue Apr 8 12:07:26 2008 +++ src/sys/dev/ic/igsfb.c Tue Nov 10 22:23:22 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: igsfb.c,v 1.44 2008/04/08 12:07:26 cegger Exp $ */ +/* $NetBSD: igsfb.c,v 1.45 2009/11/10 22:23:22 macallan Exp $ */ /* * Copyright (c) 2002, 2003 Valeriy E. Ushakov @@ -31,7 +31,7 @@ * Integraphics Systems IGA 168x and CyberPro series. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.44 2008/04/08 12:07:26 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.45 2009/11/10 22:23:22 macallan Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -53,7 +53,7 @@ #include <dev/ic/igsfbvar.h> -struct igsfb_devconfig igsfb_console_dc; +struct igsfb_devconfig igsfb_console_dc = {.dc_mmap = NULL,}; /* * wsscreen @@ -577,11 +577,12 @@ struct vcons_data *vd = v; struct igsfb_devconfig *dc = vd->cookie; - if (offset >= dc->dc_memsz || offset < 0) - return -1; - - return bus_space_mmap(dc->dc_memt, dc->dc_memaddr, offset, prot, - dc->dc_memflags | BUS_SPACE_MAP_LINEAR); + if (offset < dc->dc_memsz && offset >= 0) + return bus_space_mmap(dc->dc_memt, dc->dc_memaddr, offset, + prot, dc->dc_memflags | BUS_SPACE_MAP_LINEAR); + if (dc->dc_mmap) + return dc->dc_mmap(v, vs, offset, prot); + return -1; } Index: src/sys/dev/ic/igsfbvar.h diff -u src/sys/dev/ic/igsfbvar.h:1.16 src/sys/dev/ic/igsfbvar.h:1.17 --- src/sys/dev/ic/igsfbvar.h:1.16 Wed Apr 5 01:13:50 2006 +++ src/sys/dev/ic/igsfbvar.h Tue Nov 10 22:23:22 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: igsfbvar.h,v 1.16 2006/04/05 01:13:50 uwe Exp $ */ +/* $NetBSD: igsfbvar.h,v 1.17 2009/11/10 22:23:22 macallan Exp $ */ /* * Copyright (c) 2002, 2003 Valeriy E. Ushakov @@ -105,6 +105,9 @@ /* saved dc_ri.ri_ops.putchar */ void (*dc_ri_putchar)(void *, int, int, u_int, long); + /* optional MD mmap() method */ + paddr_t (*dc_mmap)(void *, void *, off_t, int); + struct igs_hwcmap dc_cmap; /* software copy of colormap */ struct igs_hwcursor dc_cursor; /* software copy of cursor sprite */