Module Name:    src
Committed By:   matt
Date:           Thu Dec  6 17:57:25 UTC 2012

Modified Files:
        src/sys/arch/arm/include [matt-nb6-plus]: isa_machdep.h
        src/sys/arch/shark/conf [matt-nb6-plus]: std.shark
        src/sys/arch/shark/include [matt-nb6-plus]: vmparam.h
        src/sys/arch/shark/isa [matt-nb6-plus]: isa_irq.S isadma_machdep.c
        src/sys/arch/shark/ofw [matt-nb6-plus]: ofw.c
        src/sys/arch/shark/shark [matt-nb6-plus]: autoconf.c shark_machdep.c

Log Message:
Merge changes from -current.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.10.1 src/sys/arch/arm/include/isa_machdep.h
cvs rdiff -u -r1.8 -r1.8.52.1 src/sys/arch/shark/conf/std.shark
cvs rdiff -u -r1.17 -r1.17.16.1 src/sys/arch/shark/include/vmparam.h
cvs rdiff -u -r1.13 -r1.13.16.1 src/sys/arch/shark/isa/isa_irq.S
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/arch/shark/isa/isadma_machdep.c
cvs rdiff -u -r1.57 -r1.57.6.1 src/sys/arch/shark/ofw/ofw.c
cvs rdiff -u -r1.17.18.1 -r1.17.18.1.2.1 src/sys/arch/shark/shark/autoconf.c
cvs rdiff -u -r1.39 -r1.39.10.1 src/sys/arch/shark/shark/shark_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/arm/include/isa_machdep.h
diff -u src/sys/arch/arm/include/isa_machdep.h:1.8 src/sys/arch/arm/include/isa_machdep.h:1.8.10.1
--- src/sys/arch/arm/include/isa_machdep.h:1.8	Fri Jul  1 21:16:40 2011
+++ src/sys/arch/arm/include/isa_machdep.h	Thu Dec  6 17:57:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.h,v 1.8 2011/07/01 21:16:40 dyoung Exp $	*/
+/*	$NetBSD: isa_machdep.h,v 1.8.10.1 2012/12/06 17:57:24 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -45,13 +45,12 @@ struct arm32_isa_chipset {
 
 typedef struct arm32_isa_chipset *isa_chipset_tag_t;
 
-struct device;			/* XXX */
 struct isabus_attach_args;	/* XXX */
 
 /*
  * Functions provided to machine-independent ISA code.
  */
-void	isa_attach_hook(struct device *, struct device *,
+void	isa_attach_hook(device_t, device_t,
 	    struct isabus_attach_args *);
 void	isa_detach_hook(isa_chipset_tag_t, device_t);
 const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq);
@@ -115,42 +114,6 @@ void	isa_intr_disestablish(isa_chipset_t
 
 extern struct arm32_bus_dma_tag isa_bus_dma_tag;
 
-/*
- * Cookie used by ISA DMA.  A pointer to one of these is stashed in
- * the DMA map.
- */
-struct arm32_isa_dma_cookie {
-	int	id_flags;		/* flags; see below */
-
-	/*
-	 * Information about the original buffer used during
-	 * DMA map syncs.  Note that origbuflen is only used
-	 * for ID_BUFTYPE_LINEAR.
-	 */
-	void	*id_origbuf;		/* pointer to orig buffer if
-					   bouncing */
-	bus_size_t id_origbuflen;	/* ...and size */
-	int	id_buftype;		/* type of buffer */
-
-	void	*id_bouncebuf;		/* pointer to the bounce buffer */
-	bus_size_t id_bouncebuflen;	/* ...and size */
-	int	id_nbouncesegs;		/* number of valid bounce segs */
-	bus_dma_segment_t id_bouncesegs[0]; /* array of bounce buffer
-					       physical memory segments */
-};
-
-/* id_flags */
-#define	ID_MIGHT_NEED_BOUNCE	0x01	/* map could need bounce buffers */
-#define	ID_HAS_BOUNCE		0x02	/* map currently has bounce buffers */
-#define	ID_IS_BOUNCING		0x04	/* map is bouncing current xfer */
-
-/* id_buftype */
-#define	ID_BUFTYPE_INVALID	0
-#define	ID_BUFTYPE_LINEAR	1
-#define	ID_BUFTYPE_MBUF		2
-#define	ID_BUFTYPE_UIO		3
-#define	ID_BUFTYPE_RAW		4
-
 /* bus space tags */
 extern struct bus_space isa_io_bs_tag;
 extern struct bus_space isa_mem_bs_tag;

Index: src/sys/arch/shark/conf/std.shark
diff -u src/sys/arch/shark/conf/std.shark:1.8 src/sys/arch/shark/conf/std.shark:1.8.52.1
--- src/sys/arch/shark/conf/std.shark:1.8	Sun Jan 27 12:37:12 2008
+++ src/sys/arch/shark/conf/std.shark	Thu Dec  6 17:57:24 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: std.shark,v 1.8 2008/01/27 12:37:12 chris Exp $
+#	$NetBSD: std.shark,v 1.8.52.1 2012/12/06 17:57:24 matt Exp $
 #
 # standard NetBSD/shark options
 
@@ -12,6 +12,7 @@ options 	EXEC_SCRIPT
 
 # To support easy transit to ../arch/arm/arm32
 options 	ARM32
+options 	_ARM32_NEED_BUS_DMA_BOUNCE
 
 #options 	ARM32_NEW_VM_LAYOUT	# Not yet ready for prime-time
 

Index: src/sys/arch/shark/include/vmparam.h
diff -u src/sys/arch/shark/include/vmparam.h:1.17 src/sys/arch/shark/include/vmparam.h:1.17.16.1
--- src/sys/arch/shark/include/vmparam.h:1.17	Sat Nov  6 15:42:49 2010
+++ src/sys/arch/shark/include/vmparam.h	Thu Dec  6 17:57:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.17 2010/11/06 15:42:49 uebayasi Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.17.16.1 2012/12/06 17:57:24 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -29,10 +29,10 @@
  * SUCH DAMAGE.
  */
 
-#ifndef	_ARM32_VMPARAM_H_
-#define	_ARM32_VMPARAM_H_
+#ifndef	_SHARK_VMPARAM_H_
+#define	_SHARK_VMPARAM_H_
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_KMEMUSER)
 
 #include <arm/arm32/vmparam.h>
 
@@ -90,4 +90,4 @@
 
 #endif /* _KERNEL */
 
-#endif	/* _ARM32_VMPARAM_H_ */
+#endif	/* _SHARK_VMPARAM_H_ */

Index: src/sys/arch/shark/isa/isa_irq.S
diff -u src/sys/arch/shark/isa/isa_irq.S:1.13 src/sys/arch/shark/isa/isa_irq.S:1.13.16.1
--- src/sys/arch/shark/isa/isa_irq.S:1.13	Mon Dec 20 00:25:43 2010
+++ src/sys/arch/shark/isa/isa_irq.S	Thu Dec  6 17:57:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_irq.S,v 1.13 2010/12/20 00:25:43 matt Exp $	*/
+/*	$NetBSD: isa_irq.S,v 1.13.16.1 2012/12/06 17:57:24 matt Exp $	*/
 
 /*
  * Copyright 1997
@@ -113,8 +113,8 @@
 /*
  * Register usage
  *
+ *  r5  - Pointer to handler pointer list
  *  r6  - Address of current handler
- *  r7  - Pointer to handler pointer list
  *  r8  - Current IRQ requests.
  *  r9  - Used to count through possible IRQ bits.
  *  r10 - Base address of IOMD
@@ -183,17 +183,17 @@ ASENTRY_NP(irq_entry)
 	 */
 
 	mov	r9, #(NIPL - 1)
-	ldr	r7, .Lspl_masks
+	ldr	r5, .Lspl_masks
 
 .Lfind_highest_ipl:
-	ldr	r2, [r7, r9, lsl #2]
+	ldr	r2, [r5, r9, lsl #2]
 	tst	r8, r2
 	subeq	r9, r9, #1
 	beq	.Lfind_highest_ipl
 
 	/* r9 = SPL level of highest priority interrupt */
 	add	r9, r9, #1
-	ldr	r2, [r7, r9, lsl #2]
+	ldr	r2, [r5, r9, lsl #2]
 	mvn	r2, r2
 	orr	r0, r0, r2
 
@@ -210,7 +210,7 @@ ASENTRY_NP(irq_entry)
 	bic	r0, r0, #I32_bit
 	msr	cpsr_all, r0
 
-	ldr	r7, .Lirqhandlers
+	ldr	r5, .Lirqhandlers
 	mov	r9, #0x00000001
 
 irqloop:
@@ -218,7 +218,7 @@ irqloop:
 	tst	r8, r9			/* Is a bit set ? */
 	beq	nextirq			/* No ? try next bit */
 
-	ldr	r6, [r7]		/* Get address of first handler structure */
+	ldr	r6, [r5]		/* Get address of first handler structure */
 
 	teq	r6, #0x00000000		/* Do we have a handler */
 	moveq	r0, r8			/* IRQ requests as arg 0 */
@@ -255,7 +255,7 @@ irqdone:
 	stmia   r3, {r1-r2}		/* store ev_count */
 
 nextirq:
-	add	r7, r7, #0x00000004	/* update pointer to handlers */
+	add	r5, r5, #0x00000004	/* update pointer to handlers */
 	mov	r9, r9, lsl #1		/* move on to next bit */
 	teq	r9, #(1 << 16)		/* done the last bit ? */
 	bne	irqloop			/* no - loop back. */

Index: src/sys/arch/shark/isa/isadma_machdep.c
diff -u src/sys/arch/shark/isa/isadma_machdep.c:1.16 src/sys/arch/shark/isa/isadma_machdep.c:1.16.4.1
--- src/sys/arch/shark/isa/isadma_machdep.c:1.16	Tue Jan 31 04:28:50 2012
+++ src/sys/arch/shark/isa/isadma_machdep.c	Thu Dec  6 17:57:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isadma_machdep.c,v 1.16 2012/01/31 04:28:50 matt Exp $	*/
+/*	$NetBSD: isadma_machdep.c,v 1.16.4.1 2012/12/06 17:57:24 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isadma_machdep.c,v 1.16 2012/01/31 04:28:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isadma_machdep.c,v 1.16.4.1 2012/12/06 17:57:24 matt Exp $");
 
 #define ISA_DMA_STATS
 
@@ -63,51 +63,15 @@ __KERNEL_RCSID(0, "$NetBSD: isadma_machd
 extern struct arm32_dma_range *shark_isa_dma_ranges;
 extern int shark_isa_dma_nranges;
 
-int	_isa_bus_dmamap_create(bus_dma_tag_t, bus_size_t, int,
-	    bus_size_t, bus_size_t, int, bus_dmamap_t *);
-void	_isa_bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
-int	_isa_bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
-	    bus_size_t, struct proc *, int);
-int	_isa_bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
-	    struct mbuf *, int);
-int	_isa_bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
-	    struct uio *, int);
-int	_isa_bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
-	    bus_dma_segment_t *, int, bus_size_t, int);
-void	_isa_bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
-void	_isa_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t,
-	    bus_addr_t, bus_size_t, int);
-
-int	_isa_bus_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t,
-	    bus_size_t, bus_dma_segment_t *, int, int *, int);
-
-int	_isa_dma_alloc_bouncebuf(bus_dma_tag_t, bus_dmamap_t,
-	    bus_size_t, int);
-void	_isa_dma_free_bouncebuf(bus_dma_tag_t, bus_dmamap_t);
-
 /*
  * Entry points for ISA DMA.  These are mostly wrappers around
  * the generic functions that understand how to deal with bounce
  * buffers, if necessary.
  */
 struct arm32_bus_dma_tag isa_bus_dma_tag = {
-	0,				/* _ranges */
-	0,				/* _nranges */
-	NULL,				/* _cookie */
-	_isa_bus_dmamap_create,
-	_isa_bus_dmamap_destroy,
-	_isa_bus_dmamap_load,
-	_isa_bus_dmamap_load_mbuf,
-	_isa_bus_dmamap_load_uio,
-	_isa_bus_dmamap_load_raw,
-	_isa_bus_dmamap_unload,
-	_isa_bus_dmamap_sync,		/* pre */
-	_isa_bus_dmamap_sync,		/* post */
-	_isa_bus_dmamem_alloc,
-	_bus_dmamem_free,
-	_bus_dmamem_map,
-	_bus_dmamem_unmap,
-	_bus_dmamem_mmap, 
+	_BUS_DMAMAP_FUNCS,
+	_BUS_DMAMEM_FUNCS,
+	_BUS_DMATAG_FUNCS,
 };
 
 /*
@@ -120,504 +84,3 @@ isa_dma_init(void)
 	isa_bus_dma_tag._ranges = shark_isa_dma_ranges;
 	isa_bus_dma_tag._nranges = shark_isa_dma_nranges;
 }
-
-/**********************************************************************
- * bus.h dma interface entry points
- **********************************************************************/
-
-#ifdef ISA_DMA_STATS
-#define	STAT_INCR(v)	(v)++
-#define	STAT_DECR(v)	do { \
-		if ((v) == 0) \
-			printf("%s:%d -- Already 0!\n", __FILE__, __LINE__); \
-		else \
-			(v)--; \
-		} while (0)
-u_long	isa_dma_stats_loads;
-u_long	isa_dma_stats_bounces;
-u_long	isa_dma_stats_nbouncebufs;
-#else
-#define	STAT_INCR(v)
-#define	STAT_DECR(v)
-#endif
-
-/*
- * Create an ISA DMA map.
- */
-int
-_isa_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
-{
-	struct arm32_isa_dma_cookie *cookie;
-	bus_dmamap_t map;
-	int error, cookieflags;
-	void *cookiestore;
-	size_t cookiesize;
-
-	/* Call common function to create the basic map. */
-	error = _bus_dmamap_create(t, size, nsegments, maxsegsz, boundary,
-	    flags, dmamp);
-	if (error)
-		return (error);
-
-	map = *dmamp;
-	map->_dm_cookie = NULL;
-
-	cookiesize = sizeof(struct arm32_isa_dma_cookie);
-
-	/*
-	 * ISA only has 24-bits of address space.  This means
-	 * we can't DMA to pages over 16M.  In order to DMA to
-	 * arbitrary buffers, we use "bounce buffers" - pages
-	 * in memory below the 16M boundary.  On DMA reads,
-	 * DMA happens to the bounce buffers, and is copied into
-	 * the caller's buffer.  On writes, data is copied into
-	 * but bounce buffer, and the DMA happens from those
-	 * pages.  To software using the DMA mapping interface,
-	 * this looks simply like a data cache.
-	 *
-	 * If we have more than 16M of RAM in the system, we may
-	 * need bounce buffers.  We check and remember that here.
-	 *
-	 * There are exceptions, however.  VLB devices can do
-	 * 32-bit DMA, and indicate that here.
-	 *
-	 * ...or, there is an opposite case.  The most segments
-	 * a transfer will require is (maxxfer / PAGE_SIZE) + 1.  If
-	 * the caller can't handle that many segments (e.g. the
-	 * ISA DMA controller), we may have to bounce it as well.
-	 *
-	 * Well, not really... see note above regarding DMA ranges.
-	 * Because of the range issue on this platform, we just
-	 * always "might bounce".
-	 */
-	cookieflags = ID_MIGHT_NEED_BOUNCE;
-	cookiesize += (sizeof(bus_dma_segment_t) * map->_dm_segcnt);
-
-	/*
-	 * Allocate our cookie.
-	 */
-	if ((cookiestore = malloc(cookiesize, M_DMAMAP,
-	    (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) {
-		error = ENOMEM;
-		goto out;
-	}
-	memset(cookiestore, 0, cookiesize);
-	cookie = (struct arm32_isa_dma_cookie *)cookiestore;
-	cookie->id_flags = cookieflags;
-	map->_dm_cookie = cookie;
-
-	if (cookieflags & ID_MIGHT_NEED_BOUNCE) {
-		/*
-		 * Allocate the bounce pages now if the caller
-		 * wishes us to do so.
-		 */
-		if ((flags & BUS_DMA_ALLOCNOW) == 0)
-			goto out;
-
-		error = _isa_dma_alloc_bouncebuf(t, map, size, flags);
-	}
-
- out:
-	if (error) {
-		if (map->_dm_cookie != NULL)
-			free(map->_dm_cookie, M_DMAMAP);
-		_bus_dmamap_destroy(t, map);
-	}
-	return (error);
-}
-
-/*
- * Destroy an ISA DMA map.
- */
-void
-_isa_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-
-	/*
-	 * Free any bounce pages this map might hold.
-	 */
-	if (cookie->id_flags & ID_HAS_BOUNCE)
-		_isa_dma_free_bouncebuf(t, map);
-
-	free(cookie, M_DMAMAP);
-	_bus_dmamap_destroy(t, map);
-}
-
-/*
- * Load an ISA DMA map with a linear buffer.
- */
-int
-_isa_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
-	bus_size_t buflen, struct proc *p, int flags)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-	int error;
-
-	STAT_INCR(isa_dma_stats_loads);
-
-	/*
-	 * Make sure that on error condition we return "no valid mappings."
-	 */
-	map->dm_mapsize = 0;
-	map->dm_nsegs = 0;
-
-	/*
-	 * Try to load the map the normal way.  If this errors out,
-	 * and we can bounce, we will.
-	 */
-	error = _bus_dmamap_load(t, map, buf, buflen, p, flags);
-	if (error == 0 ||
-	    (error != 0 && (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0))
-		return (error);
-
-	/*
-	 * First attempt failed; bounce it.
-	 */
-
-	STAT_INCR(isa_dma_stats_bounces);
-
-	/*
-	 * Allocate bounce pages, if necessary.
-	 */
-	if ((cookie->id_flags & ID_HAS_BOUNCE) == 0) {
-		error = _isa_dma_alloc_bouncebuf(t, map, buflen, flags);
-		if (error)
-			return (error);
-	}
-
-	/*
-	 * Cache a pointer to the caller's buffer and load the DMA map
-	 * with the bounce buffer.
-	 */
-	cookie->id_origbuf = buf;
-	cookie->id_origbuflen = buflen;
-	cookie->id_buftype = ID_BUFTYPE_LINEAR;
-	error = _bus_dmamap_load(t, map, cookie->id_bouncebuf, buflen,
-	    NULL, flags);
-	if (error) {
-		/*
-		 * Free the bounce pages, unless our resources
-		 * are reserved for our exclusive use.
-		 */
-		if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0)
-			_isa_dma_free_bouncebuf(t, map);
-		return (error);
-	}
-
-	/* ...so _isa_bus_dmamap_sync() knows we're bouncing */
-	cookie->id_flags |= ID_IS_BOUNCING;
-	return (0);
-}
-
-/*
- * Like _isa_bus_dmamap_load(), but for mbufs.
- */
-int
-_isa_bus_dmamap_load_mbuf( bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
-	int flags)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-	int error;
-
-	/*
-	 * Make sure that on error condition we return "no valid mappings."
-	 */
-	map->dm_mapsize = 0;
-	map->dm_nsegs = 0;
-
-#ifdef DIAGNOSTIC
-	if ((m0->m_flags & M_PKTHDR) == 0)
-		panic("_isa_bus_dmamap_load_mbuf: no packet header");
-#endif
-
-	if (m0->m_pkthdr.len > map->_dm_size)
-		return (EINVAL);
-
-	/*
-	 * Try to load the map the normal way.  If this errors out,
-	 * and we can bounce, we will.
-	 */
-	error = _bus_dmamap_load_mbuf(t, map, m0, flags);
-	if (error == 0 ||
-	    (error != 0 && (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0))
-		return (error);
-
-	/*
-	 * First attempt failed; bounce it.
-	 */
-
-	STAT_INCR(isa_dma_stats_bounces);
-
-	/*
-	 * Allocate bounce pages, if necessary.
-	 */
-	if ((cookie->id_flags & ID_HAS_BOUNCE) == 0) {
-		error = _isa_dma_alloc_bouncebuf(t, map, m0->m_pkthdr.len,
-		    flags);
-		if (error)
-			return (error);
-	}
-
-	/*
-	 * Cache a pointer to the caller's buffer and load the DMA map
-	 * with the bounce buffer.
-	 */
-	cookie->id_origbuf = m0;
-	cookie->id_origbuflen = m0->m_pkthdr.len;	/* not really used */
-	cookie->id_buftype = ID_BUFTYPE_MBUF;
-	error = _bus_dmamap_load(t, map, cookie->id_bouncebuf,
-	    m0->m_pkthdr.len, NULL, flags);
-	if (error) {
-		/*
-		 * Free the bounce pages, unless our resources
-		 * are reserved for our exclusive use.
-		 */
-		if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0)
-			_isa_dma_free_bouncebuf(t, map);
-		return (error);
-	}
-
-	/* ...so _isa_bus_dmamap_sync() knows we're bouncing */
-	cookie->id_flags |= ID_IS_BOUNCING;
-	return (0);
-}
-
-/*
- * Like _isa_bus_dmamap_load(), but for uios.
- */
-int
-_isa_bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio, int flags)
-{
-
-	panic("_isa_bus_dmamap_load_uio: not implemented");
-}
-
-/*
- * Like _isa_bus_dmamap_load(), but for raw memory allocated with
- * bus_dmamem_alloc().
- */
-int
-_isa_bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
-{
-
-	panic("_isa_bus_dmamap_load_raw: not implemented");
-}
-
-/*
- * Unload an ISA DMA map.
- */
-void
-_isa_bus_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-
-	/*
-	 * If we have bounce pages, free them, unless they're
-	 * reserved for our exclusive use.
-	 */
-	if ((cookie->id_flags & ID_HAS_BOUNCE) &&
-	    (map->_dm_flags & BUS_DMA_ALLOCNOW) == 0)
-		_isa_dma_free_bouncebuf(t, map);
-
-	cookie->id_flags &= ~ID_IS_BOUNCING;
-	cookie->id_buftype = ID_BUFTYPE_INVALID;
-
-	/*
-	 * Do the generic bits of the unload.
-	 */
-	_bus_dmamap_unload(t, map);
-}
-
-/*
- * Synchronize an ISA DMA map.
- */
-void
-_isa_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, bus_size_t len, int ops)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-
-	/*
-	 * Mixing PRE and POST operations is not allowed.
-	 */
-	if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 &&
-	    (ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0)
-		panic("_isa_bus_dmamap_sync: mix PRE and POST");
-
-#ifdef DIAGNOSTIC
-	if ((ops & (BUS_DMASYNC_PREWRITE|BUS_DMASYNC_POSTREAD)) != 0) {
-		if (offset >= map->dm_mapsize)
-			panic("_isa_bus_dmamap_sync: bad offset");
-		if (len == 0 || (offset + len) > map->dm_mapsize)
-			panic("_isa_bus_dmamap_sync: bad length");
-	}
-#endif
-
-	/*
-	 * If we're not bouncing, just return; nothing to do.
-	 */
-	if ((cookie->id_flags & ID_IS_BOUNCING) == 0)
-		return;
-
-	switch (cookie->id_buftype) {
-	case ID_BUFTYPE_LINEAR:
-		/*
-		 * Nothing to do for pre-read.
-		 */
-
-		if (ops & BUS_DMASYNC_PREWRITE) {
-			/*
-			 * Copy the caller's buffer to the bounce buffer.
-			 */
-			memcpy((char *)cookie->id_bouncebuf + offset,
-			    (char *)cookie->id_origbuf + offset, len);
-		}
-
-		if (ops & BUS_DMASYNC_POSTREAD) {
-			/*
-			 * Copy the bounce buffer to the caller's buffer.
-			 */
-			memcpy((char *)cookie->id_origbuf + offset,
-			    (char *)cookie->id_bouncebuf + offset, len);
-		}
-
-		/*
-		 * Nothing to do for post-write.
-		 */
-		break;
-
-	case ID_BUFTYPE_MBUF:
-	    {
-		struct mbuf *m, *m0 = cookie->id_origbuf;
-		bus_size_t minlen, moff;
-
-		/*
-		 * Nothing to do for pre-read.
-		 */
-
-		if (ops & BUS_DMASYNC_PREWRITE) {
-			/*
-			 * Copy the caller's buffer to the bounce buffer.
-			 */
-			m_copydata(m0, offset, len,
-			    (char *)cookie->id_bouncebuf + offset);
-		}
-
-		if (ops & BUS_DMASYNC_POSTREAD) {
-			/*
-			 * Copy the bounce buffer to the caller's buffer.
-			 */
-			for (moff = offset, m = m0; m != NULL && len != 0;
-			    m = m->m_next) {
-				/* Find the beginning mbuf. */
-				if (moff >= m->m_len) {
-					moff -= m->m_len;
-					continue;
-				}
-
-				/*
-				 * Now at the first mbuf to sync; nail
-				 * each one until we have exhausted the
-				 * length.
-				 */
-				minlen = len < m->m_len - moff ?
-				    len : m->m_len - moff;
-
-				memcpy(mtod(m, char *) + moff,
-				    (char *)cookie->id_bouncebuf + offset,
-				    minlen);
-
-				moff = 0;
-				len -= minlen;
-				offset += minlen;
-			}
-		}
-
-		/*
-		 * Nothing to do for post-write.
-		 */
-		break;
-	    }
-	
-	case ID_BUFTYPE_UIO:
-		panic("_isa_bus_dmamap_sync: ID_BUFTYPE_UIO");
-		break;
-
-	case ID_BUFTYPE_RAW:
-		panic("_isa_bus_dmamap_sync: ID_BUFTYPE_RAW");
-		break;
-
-	case ID_BUFTYPE_INVALID:
-		panic("_isa_bus_dmamap_sync: ID_BUFTYPE_INVALID");
-		break;
-
-	default:
-		printf("unknown buffer type %d\n", cookie->id_buftype);
-		panic("_isa_bus_dmamap_sync");
-	}
-}
-
-/*
- * Allocate memory safe for ISA DMA.
- */
-int
-_isa_bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags)
-{
-
-	if (t->_ranges == NULL)
-		return (ENOMEM);
-
-	/* _bus_dmamem_alloc() does the range checks for us. */
-	return (_bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs,
-	    rsegs, flags));
-}
-
-/**********************************************************************
- * ISA DMA utility functions
- **********************************************************************/
-
-int
-_isa_dma_alloc_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map, bus_size_t size, int flags)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-	int error = 0;
-
-	cookie->id_bouncebuflen = round_page(size);
-	error = _isa_bus_dmamem_alloc(t, cookie->id_bouncebuflen,
-	    PAGE_SIZE, map->_dm_boundary, cookie->id_bouncesegs,
-	    map->_dm_segcnt, &cookie->id_nbouncesegs, flags);
-	if (error)
-		goto out;
-	error = _bus_dmamem_map(t, cookie->id_bouncesegs,
-	    cookie->id_nbouncesegs, cookie->id_bouncebuflen,
-	    (void **)&cookie->id_bouncebuf, flags);
-
- out:
-	if (error) {
-		_bus_dmamem_free(t, cookie->id_bouncesegs,
-		    cookie->id_nbouncesegs);
-		cookie->id_bouncebuflen = 0;
-		cookie->id_nbouncesegs = 0;
-	} else {
-		cookie->id_flags |= ID_HAS_BOUNCE;
-		STAT_INCR(isa_dma_stats_nbouncebufs);
-	}
-
-	return (error);
-}
-
-void
-_isa_dma_free_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map)
-{
-	struct arm32_isa_dma_cookie *cookie = map->_dm_cookie;
-
-	STAT_DECR(isa_dma_stats_nbouncebufs);
-
-	_bus_dmamem_unmap(t, cookie->id_bouncebuf,
-	    cookie->id_bouncebuflen);
-	_bus_dmamem_free(t, cookie->id_bouncesegs,
-	    cookie->id_nbouncesegs);
-	cookie->id_bouncebuflen = 0;
-	cookie->id_nbouncesegs = 0;
-	cookie->id_flags &= ~ID_HAS_BOUNCE;
-}

Index: src/sys/arch/shark/ofw/ofw.c
diff -u src/sys/arch/shark/ofw/ofw.c:1.57 src/sys/arch/shark/ofw/ofw.c:1.57.6.1
--- src/sys/arch/shark/ofw/ofw.c:1.57	Wed Nov 23 23:07:30 2011
+++ src/sys/arch/shark/ofw/ofw.c	Thu Dec  6 17:57:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw.c,v 1.57 2011/11/23 23:07:30 jmcneill Exp $	*/
+/*	$NetBSD: ofw.c,v 1.57.6.1 2012/12/06 17:57:25 matt Exp $	*/
 
 /*
  * Copyright 1997
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw.c,v 1.57 2011/11/23 23:07:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw.c,v 1.57.6.1 2012/12/06 17:57:25 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -132,12 +132,6 @@ paddr_t physical_freestart;
 paddr_t physical_freeend;
 paddr_t physical_end;
 u_int free_pages;
-#ifndef	OFWGENCFG
-pv_addr_t irqstack;
-#endif
-pv_addr_t undstack;
-pv_addr_t abtstack;
-pv_addr_t kernelstack;
 
 paddr_t msgbufphys;
 
@@ -781,7 +775,7 @@ ofw_configmem(void)
 
 	/* Switch to the proc0 pagetables. */
 	cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
-	cpu_setttb(kernel_l1pt.pv_pa);
+	cpu_setttb(kernel_l1pt.pv_pa, true);
 	cpu_tlb_flushID();
 	cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
 

Index: src/sys/arch/shark/shark/autoconf.c
diff -u src/sys/arch/shark/shark/autoconf.c:1.17.18.1 src/sys/arch/shark/shark/autoconf.c:1.17.18.1.2.1
--- src/sys/arch/shark/shark/autoconf.c:1.17.18.1	Wed Aug  8 15:51:14 2012
+++ src/sys/arch/shark/shark/autoconf.c	Thu Dec  6 17:57:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.17.18.1 2012/08/08 15:51:14 martin Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.17.18.1.2.1 2012/12/06 17:57:25 matt Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.17.18.1 2012/08/08 15:51:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.17.18.1.2.1 2012/12/06 17:57:25 matt Exp $");
 
 #include "opt_md.h"
 
@@ -53,11 +53,15 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/disklabel.h>
 #include <sys/device.h>
 #include <sys/conf.h>
+#include <sys/intr.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
+
+#include <uvm/uvm_extern.h>
+
 #include <arm/arm32/machdep.h>
+
 #include <machine/bootconfig.h>
-#include <machine/intr.h>
 #include <machine/irqhandler.h>
 
 #include "isa.h"
@@ -65,13 +69,13 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #ifdef SHARK
 #include <shark/shark/sequoia.h>
 extern void	ofrootfound(void);
-extern void	ofw_device_register(struct device *, void *aux);
+extern void	ofw_device_register(device_t, void *);
 extern void	startrtclock(void);
 #endif
 
 #if defined(OFWGENCFG) || defined(SHARK)
 /* Temporary for SHARK! */
-extern void ofw_device_register(struct device *dev, void *aux);
+extern void ofw_device_register(device_t, void *);
 #include <machine/ofw.h>
 #endif
 
@@ -146,7 +150,7 @@ cpu_rootconf(void)
 	set_root_device();
 
 	printf("boot device: %s\n",
-	    booted_device != NULL ? booted_device->dv_xname : "<unknown>");
+	    booted_device != NULL ? device_xname(booted_device) : "<unknown>");
 #endif
 	rootconf();
 }
@@ -199,7 +203,7 @@ cpu_configure(void)
 }
 
 void
-device_register(struct device *dev, void *aux)
+device_register(device_t dev, void *aux)
 {
 #if defined(OFWGENCFG) || defined(SHARK)
 	/* Temporary for SHARK! */

Index: src/sys/arch/shark/shark/shark_machdep.c
diff -u src/sys/arch/shark/shark/shark_machdep.c:1.39 src/sys/arch/shark/shark/shark_machdep.c:1.39.10.1
--- src/sys/arch/shark/shark/shark_machdep.c:1.39	Mon Jun  6 16:29:16 2011
+++ src/sys/arch/shark/shark/shark_machdep.c	Thu Dec  6 17:57:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: shark_machdep.c,v 1.39 2011/06/06 16:29:16 matt Exp $	*/
+/*	$NetBSD: shark_machdep.c,v 1.39.10.1 2012/12/06 17:57:25 matt Exp $	*/
 
 /*
  * Copyright 1997
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: shark_machdep.c,v 1.39 2011/06/06 16:29:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shark_machdep.c,v 1.39.10.1 2012/12/06 17:57:25 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -102,10 +102,6 @@ __KERNEL_RCSID(0, "$NetBSD: shark_machde
 extern pv_addr_t irqstack;
 extern pv_addr_t undstack;
 extern pv_addr_t abtstack;
-extern pv_addr_t kernelstack;
-extern u_int data_abort_handler_address;
-extern u_int prefetch_abort_handler_address;
-extern u_int undefined_handler_address;
 
 /*
  *  Imported routines

Reply via email to