Tue May 26 03:30:25 2009 UTC ()
do as phone suggested - remove sparc_bus_map_large() again and use a flag
instead ( BUS_SPACE_MAP_LARGE )


(macallan)
diff -r1.55 -r1.56 src/sys/arch/sparc/include/bus.h
diff -r1.293 -r1.294 src/sys/arch/sparc/sparc/machdep.c

cvs diff -r1.55 -r1.56 src/sys/arch/sparc/include/Attic/bus.h (expand / switch to context diff)
--- src/sys/arch/sparc/include/Attic/bus.h 2009/04/16 16:55:00 1.55
+++ src/sys/arch/sparc/include/Attic/bus.h 2009/05/26 03:30:25 1.56
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.55 2009/04/16 16:55:00 macallan Exp $	*/
+/*	$NetBSD: bus.h,v 1.56 2009/05/26 03:30:25 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -245,10 +245,7 @@
 				void (*)(void));	/*optional fast vector*/
 
 
-int sparc_bus_map_large(bus_space_tag_t, int, bus_size_t, bus_size_t, int, 
-		        bus_space_handle_t *);
 
-
 static __inline int
 bus_space_map(t, a, s, f, hp)
 	bus_space_tag_t	t;
@@ -356,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() */

cvs diff -r1.293 -r1.294 src/sys/arch/sparc/sparc/machdep.c (expand / switch to context diff)
--- src/sys/arch/sparc/sparc/machdep.c 2009/05/16 17:01:15 1.293
+++ src/sys/arch/sparc/sparc/machdep.c 2009/05/26 03:30:24 1.294
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.293 2009/05/16 17:01:15 cegger Exp $ */
+/*	$NetBSD: machdep.c,v 1.294 2009/05/26 03:30:24 macallan 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.293 2009/05/16 17:01:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.294 2009/05/26 03:30:24 macallan Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_sunos.h"
@@ -1914,8 +1914,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;
@@ -1981,30 +1981,42 @@
 	return (0);
 }
 
-int
-sparc_bus_map_large(bus_space_tag_t t, int slot, bus_size_t offset,
+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)
 {
-	bus_addr_t pa = BUS_ADDR(slot,offset);
 	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(t, pa, size, flags, v, hp);
+		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 from sparc_bus_map_large() probably need additional care
-	 * here
+	 * 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));