Module Name:    src
Committed By:   cliff
Date:           Fri Apr 16 23:42:25 UTC 2010

Modified Files:
        src/sys/arch/mips/mips [matt-nb5-mips64]: bus_dma.c

Log Message:
- teach _bus_dmamem_map to handle PA > MIPS_PHYS_MASK for non-_LP64 kernel
- fix a debug print format for non-_LP32


To generate a diff of this commit:
cvs rdiff -u -r1.22.16.14 -r1.22.16.15 src/sys/arch/mips/mips/bus_dma.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/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.22.16.14 src/sys/arch/mips/mips/bus_dma.c:1.22.16.15
--- src/sys/arch/mips/mips/bus_dma.c:1.22.16.14	Wed Jan 20 06:58:36 2010
+++ src/sys/arch/mips/mips/bus_dma.c	Fri Apr 16 23:42:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.22.16.14 2010/01/20 06:58:36 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.22.16.15 2010/04/16 23:42:25 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22.16.14 2010/01/20 06:58:36 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22.16.15 2010/04/16 23:42:25 cliff Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -784,10 +784,10 @@
 		minlen = ulmin(len, seg->ds_len - offset);
 
 #ifdef BUS_DMA_DEBUG
-		printf("bus_dmamap_sync: flushing segment %d "
-		    "(0x%"PRIxVADDR"+%"PRIxBUSADDR
-		    ", 0x%"PRIxVADDR"+0x%"PRIxBUSADDR
-		    ") (olen = %"PRIxBUSADDR")...", i,
+		printf("bus_dmamap_sync: flushing segment %p "
+		    "(0x%"PRIxBUSADDR"+%"PRIxBUSADDR
+		    ", 0x%"PRIxBUSADDR"+0x%"PRIxBUSADDR
+		    ") (olen = %"PRIxBUSADDR")...", seg,
 		    vaddr - offset, offset,
 		    vaddr - offset, offset + minlen - 1, len);
 #endif
@@ -1018,8 +1018,8 @@
 	 * If we're only mapping 1 segment, use K0SEG, to avoid
 	 * TLB thrashing.
 	 */
-	if (nsegs == 1) {
 #ifdef _LP64
+	if (nsegs == 1) {
 		if (((mips_options.mips_cpu_flags & CPU_MIPS_D_CACHE_COHERENT) == 0)
 		&&  (flags & BUS_DMA_COHERENT))
 			*kvap = (void *)MIPS_PHYS_TO_XKPHYS_UNCACHED(
@@ -1027,15 +1027,18 @@
 		else
 			*kvap = (void *)MIPS_PHYS_TO_XKPHYS_CACHED(
 			    segs[0].ds_addr);
+		return 0;
+	}
 #else
+	if ((nsegs == 1) && (segs[0].ds_addr < MIPS_PHYS_MASK)) {
 		if (((mips_options.mips_cpu_flags & CPU_MIPS_D_CACHE_COHERENT) == 0)
 		&&  (flags & BUS_DMA_COHERENT))
 			*kvap = (void *)MIPS_PHYS_TO_KSEG1(segs[0].ds_addr);
 		else
 			*kvap = (void *)MIPS_PHYS_TO_KSEG0(segs[0].ds_addr);
-#endif
 		return (0);
 	}
+#endif	/* _LP64 */
 
 	size = round_page(size);
 

Reply via email to