Module Name: src Committed By: bouyer Date: Sun Oct 18 13:43:46 UTC 2009
Modified Files: src/sys/arch/sparc/include [netbsd-5]: bus.h src/sys/arch/sparc/sparc [netbsd-5]: machdep.c Log Message: Pull up following revision(s) (requested by macallan in ticket #969): sys/arch/sparc/include/bus.h: revision 1.56 sys/arch/sparc/sparc/machdep.c: revision 1.294 do as phone suggested - remove sparc_bus_map_large() again and use a =20= flag instead ( BUS_SPACE_MAP_LARGE ) To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.54.10.1 src/sys/arch/sparc/include/bus.h cvs rdiff -u -r1.282.4.1 -r1.282.4.2 src/sys/arch/sparc/sparc/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc/include/bus.h diff -u src/sys/arch/sparc/include/bus.h:1.54 src/sys/arch/sparc/include/bus.h:1.54.10.1 --- src/sys/arch/sparc/include/bus.h:1.54 Mon Apr 28 20:23:36 2008 +++ src/sys/arch/sparc/include/bus.h Sun Oct 18 13:43:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.h,v 1.54 2008/04/28 20:23:36 martin Exp $ */ +/* $NetBSD: bus.h,v 1.54.10.1 2009/10/18 13:43:45 bouyer Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -245,6 +245,7 @@ void (*)(void)); /*optional fast vector*/ + static __inline int bus_space_map(t, a, s, f, hp) bus_space_tag_t t; @@ -352,7 +353,7 @@ #define BUS_SPACE_MAP_BUS1 0x0100 /* placeholders for bus functions... */ #define BUS_SPACE_MAP_BUS2 0x0200 #define BUS_SPACE_MAP_BUS3 0x0400 -#define BUS_SPACE_MAP_BUS4 0x0800 +#define BUS_SPACE_MAP_LARGE 0x0800 /* map outside IODEV range */ /* flags for bus_space_barrier() */ Index: src/sys/arch/sparc/sparc/machdep.c diff -u src/sys/arch/sparc/sparc/machdep.c:1.282.4.1 src/sys/arch/sparc/sparc/machdep.c:1.282.4.2 --- src/sys/arch/sparc/sparc/machdep.c:1.282.4.1 Mon Feb 2 03:30:33 2009 +++ src/sys/arch/sparc/sparc/machdep.c Sun Oct 18 13:43:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.282.4.1 2009/02/02 03:30:33 snj Exp $ */ +/* $NetBSD: machdep.c,v 1.282.4.2 2009/10/18 13:43:45 bouyer Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.282.4.1 2009/02/02 03:30:33 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.282.4.2 2009/10/18 13:43:45 bouyer Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_sunos.h" @@ -2127,8 +2127,8 @@ return (EINVAL); } -int -sparc_bus_map(bus_space_tag_t t, bus_addr_t ba, bus_size_t size, int flags, +static int +sparc_bus_map_iodev(bus_space_tag_t t, bus_addr_t ba, bus_size_t size, int flags, vaddr_t va, bus_space_handle_t *hp) { vaddr_t v; @@ -2194,11 +2194,44 @@ return (0); } +static int +sparc_bus_map_large(bus_space_tag_t t, bus_addr_t ba, + bus_size_t size, int flags, bus_space_handle_t *hp) +{ + vaddr_t v = 0; + + if (uvm_map(kernel_map, &v, size, NULL, 0, PAGE_SIZE, + UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW, UVM_INH_SHARE, UVM_ADV_NORMAL, + 0)) == 0) { + return sparc_bus_map_iodev(t, ba, size, flags, v, hp); + } + return -1; +} + +int +sparc_bus_map(bus_space_tag_t t, bus_addr_t ba, + bus_size_t size, int flags, vaddr_t va, + bus_space_handle_t *hp) +{ + + if (flags & BUS_SPACE_MAP_LARGE) { + return sparc_bus_map_large(t, ba, size, flags, hp); + } else + return sparc_bus_map_iodev(t, ba, size, flags, va, hp); + +} + int sparc_bus_unmap(bus_space_tag_t t, bus_space_handle_t bh, bus_size_t size) { vaddr_t va = trunc_page((vaddr_t)bh); + /* + * XXX + * mappings with BUS_SPACE_MAP_LARGE need additional care here + * we can just check if the VA is in the IODEV range + */ + pmap_kremove(va, round_page(size)); pmap_update(pmap_kernel()); return (0);