CVS commit: [matt-nb6-plus] src/sys/arch/arm/cortex

2013-03-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 12 21:20:04 UTC 2013

Modified Files:
src/sys/arch/arm/cortex [matt-nb6-plus]: a9_mpsubr.S

Log Message:
Busy wait in a WFI loop until told to exit.


To generate a diff of this commit:
cvs rdiff -u -r1.3.6.2 -r1.3.6.3 src/sys/arch/arm/cortex/a9_mpsubr.S

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/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.3.6.2 src/sys/arch/arm/cortex/a9_mpsubr.S:1.3.6.3
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.3.6.2	Wed Nov 28 22:40:25 2012
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Tue Mar 12 21:20:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.3.6.2 2012/11/28 22:40:25 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.3.6.3 2013/03/12 21:20:04 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -367,17 +367,18 @@ a9_mpstart:
 	/* Now we will wait for someone tell this cpu to start running */
 #ifdef MULTIPROCESSOR
 	ldr	r0, .Lcpu_mbox
-#else
-	cmp	r0, r0
 #endif
 2:
 #ifdef MULTIPROCESSOR
 	dmb
 	ldr	r2, [r0]
 	tst	r2, r5
-#endif
-	@wfeeq
+	wfieq
 	beq	2b
+#else
+	wfi
+	b	2b
+#endif
 
 #ifdef MULTIPROCESSOR
 3:	XPUTC(#98)



CVS commit: [matt-nb6-plus] src/sys/sys

2013-02-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 19 07:19:41 UTC 2013

Modified Files:
src/sys/sys [matt-nb6-plus]: kernhist.h

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/sys/sys/kernhist.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/sys/kernhist.h
diff -u src/sys/sys/kernhist.h:1.4 src/sys/sys/kernhist.h:1.4.6.1
--- src/sys/sys/kernhist.h:1.4	Mon Nov 21 04:36:05 2011
+++ src/sys/sys/kernhist.h	Tue Feb 19 07:19:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernhist.h,v 1.4 2011/11/21 04:36:05 christos Exp $	*/
+/*	$NetBSD: kernhist.h,v 1.4.6.1 2013/02/19 07:19:40 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -93,9 +93,11 @@ LIST_HEAD(kern_history_head, kern_histor
  */
 #ifndef KERNHIST
 #define KERNHIST_DECL(NAME)
+#define KERNHIST_DEFINE(NAME)
 #define KERNHIST_INIT(NAME,N)
 #define KERNHIST_INIT_STATIC(NAME,BUF)
 #define KERNHIST_LOG(NAME,FMT,A,B,C,D)
+#define KERNHIST_CALLARGS(NAME,FMT,A,B,C,D)
 #define KERNHIST_CALLED(NAME)
 #define KERNHIST_FUNC(FNAME)
 #define kernhist_dump(NAME)
@@ -106,7 +108,8 @@ LIST_HEAD(kern_history_head, kern_histor
 
 extern	struct kern_history_head kern_histories;
 
-#define KERNHIST_DECL(NAME) struct kern_history NAME
+#define KERNHIST_DECL(NAME) extern struct kern_history NAME
+#define KERNHIST_DEFINE(NAME) struct kern_history NAME
 
 #define KERNHIST_INIT(NAME,N) \
 do { \
@@ -130,13 +133,18 @@ do { \
 	LIST_INSERT_HEAD(&kern_histories, &(NAME), list); \
 } while (/*CONSTCOND*/ 0)
 
+#ifndef KERNHIST_DELAY
+#define KERNHIST_DELAY	10
+#endif
+
 #if defined(KERNHIST_PRINT)
 extern int kernhist_print_enabled;
 #define KERNHIST_PRINTNOW(E) \
 do { \
 		if (kernhist_print_enabled) { \
 			kernhist_entry_print(E); \
-			DELAY(10); \
+			if (KERNHISTDELAY != 0) \
+DELAY(KERNHIST_DELAY); \
 		} \
 } while (/*CONSTCOND*/ 0)
 #else
@@ -172,10 +180,20 @@ do { \
 	KERNHIST_LOG(NAME, "called!", 0, 0, 0, 0); \
 } while (/*CONSTCOND*/ 0)
 
+/*
+ * This extends kernhist to avoid wasting a separate "called!" entry on every
+ * function.
+ */
+#define KERNHIST_CALLARGS(NAME, FMT, A, B, C, D) \
+do { \
+	_kernhist_call = atomic_inc_uint_nv(&_kernhist_cnt); \
+	KERNHIST_LOG(NAME, "called: "FMT, (A), (B), (C), (D)); \
+} while (/*CONSTCOND*/ 0)
+
 #define KERNHIST_FUNC(FNAME) \
 	static unsigned int _kernhist_cnt = 0; \
 	static const char *const _kernhist_name = FNAME; \
-	int _kernhist_call = 0;
+	unsigned int _kernhist_call = 0;
 
 static inline void kernhist_entry_print(const struct kern_history_ent *);
 



CVS commit: [matt-nb6-plus] src/sys/arch/arm/broadcom

2013-02-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 19 02:31:55 UTC 2013

Modified Files:
src/sys/arch/arm/broadcom [matt-nb6-plus]: bcm53xx_board.c

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.5 -r1.8.4.6 src/sys/arch/arm/broadcom/bcm53xx_board.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/broadcom/bcm53xx_board.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.5 src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.6
--- src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.5	Tue Feb 19 02:22:02 2013
+++ src/sys/arch/arm/broadcom/bcm53xx_board.c	Tue Feb 19 02:31:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_board.c,v 1.8.4.5 2013/02/19 02:22:02 matt Exp $	*/
+/*	$NetBSD: bcm53xx_board.c,v 1.8.4.6 2013/02/19 02:31:55 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.5 2013/02/19 02:22:02 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.6 2013/02/19 02:31:55 matt Exp $");
 
 #include 
 #include 
@@ -106,18 +106,9 @@ struct arm32_bus_dma_tag bcm53xx_coheren
 };
 
 #ifdef _ARM32_NEED_BUS_DMA_BOUNCE
-struct arm32_dma_range bcm53xx_bounce_dma_ranges[] = {
-	[0] = {
-		.dr_sysbase = 0x8000,
-		.dr_busbase = 0x8000,
-		.dr_len = 0x1000,
-		.dr_flags = _BUS_DMAMAP_COHERENT,
-	},
-};
-
 struct arm32_bus_dma_tag bcm53xx_bounce_dma_tag = {
-	._ranges = bcm53xx_bounce_dma_ranges,
-	._nranges = __arraycount(bcm53xx_bounce_dma_ranges),
+	._ranges = bcm53xx_coherent_dma_ranges,
+	._nranges = 1,
 	_BUS_DMAMAP_FUNCS,
 	_BUS_DMAMEM_FUNCS,
 	_BUS_DMATAG_FUNCS,
@@ -544,11 +535,7 @@ bcm53xx_dma_bootstrap(psize_t memsize)
 		bcm53xx_dma_ranges[0].dr_len = memsize;
 		bcm53xx_coherent_dma_ranges[0].dr_len = memsize;
 		bcm53xx_dma_tag._nranges = 1;
-#ifndef _ARM32_NEED_BUS_DMA_BOUNCE
 		bcm53xx_coherent_dma_tag._nranges = 1;
-#else
-		bcm53xx_bounce_dma_ranges[0].dr_len = memsize;
-#endif
 	} else {
 		/*
 		 * By setting up two ranges, bus_dmamem_alloc will always
@@ -557,9 +544,6 @@ bcm53xx_dma_bootstrap(psize_t memsize)
 		 */
 		bcm53xx_dma_ranges[1].dr_len = memsize - 0x1000;
 		bcm53xx_coherent_dma_ranges[1].dr_len = memsize - 0x1000;
-#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
-		bcm53xx_bounce_dma_ranges[1].dr_len = memsize - 0x1000;
-#endif
 	}
 	KASSERT(bcm53xx_dma_tag._ranges[0].dr_flags == 0);
 	KASSERT(bcm53xx_coherent_dma_tag._ranges[0].dr_flags == _BUS_DMAMAP_COHERENT);



CVS commit: [matt-nb6-plus] src/sys/arch/arm/broadcom

2013-02-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 19 02:22:02 UTC 2013

Modified Files:
src/sys/arch/arm/broadcom [matt-nb6-plus]: bcm53xx_board.c
bcm53xx_eth.c bcm53xx_pax.c bcm53xx_var.h

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.4 -r1.8.4.5 src/sys/arch/arm/broadcom/bcm53xx_board.c
cvs rdiff -u -r1.17.2.4 -r1.17.2.5 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.7.4.2 -r1.7.4.3 src/sys/arch/arm/broadcom/bcm53xx_pax.c
cvs rdiff -u -r1.4.4.2 -r1.4.4.3 src/sys/arch/arm/broadcom/bcm53xx_var.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/arch/arm/broadcom/bcm53xx_board.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.4 src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.5
--- src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.4	Wed Feb 13 23:52:18 2013
+++ src/sys/arch/arm/broadcom/bcm53xx_board.c	Tue Feb 19 02:22:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_board.c,v 1.8.4.4 2013/02/13 23:52:18 matt Exp $	*/
+/*	$NetBSD: bcm53xx_board.c,v 1.8.4.5 2013/02/19 02:22:02 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.4 2013/02/13 23:52:18 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.5 2013/02/19 02:22:02 matt Exp $");
 
 #include 
 #include 
@@ -91,11 +91,9 @@ struct arm32_dma_range bcm53xx_coherent_
 		.dr_busbase = 0x8000,
 		.dr_len = 0x1000,
 		.dr_flags = _BUS_DMAMAP_COHERENT,
-#ifndef _ARM32_NEED_BUS_DMA_BOUNCE
 	}, [1] = {
 		.dr_sysbase = 0x9000,
 		.dr_busbase = 0x9000,
-#endif
 	},
 };
 
@@ -107,6 +105,25 @@ struct arm32_bus_dma_tag bcm53xx_coheren
 	_BUS_DMATAG_FUNCS,
 };
 
+#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
+struct arm32_dma_range bcm53xx_bounce_dma_ranges[] = {
+	[0] = {
+		.dr_sysbase = 0x8000,
+		.dr_busbase = 0x8000,
+		.dr_len = 0x1000,
+		.dr_flags = _BUS_DMAMAP_COHERENT,
+	},
+};
+
+struct arm32_bus_dma_tag bcm53xx_bounce_dma_tag = {
+	._ranges = bcm53xx_bounce_dma_ranges,
+	._nranges = __arraycount(bcm53xx_bounce_dma_ranges),
+	_BUS_DMAMAP_FUNCS,
+	_BUS_DMAMEM_FUNCS,
+	_BUS_DMATAG_FUNCS,
+};
+#endif
+
 #ifdef BCM53XX_CONSOLE_EARLY
 #include 
 #include 
@@ -529,6 +546,8 @@ bcm53xx_dma_bootstrap(psize_t memsize)
 		bcm53xx_dma_tag._nranges = 1;
 #ifndef _ARM32_NEED_BUS_DMA_BOUNCE
 		bcm53xx_coherent_dma_tag._nranges = 1;
+#else
+		bcm53xx_bounce_dma_ranges[0].dr_len = memsize;
 #endif
 	} else {
 		/*
@@ -537,12 +556,16 @@ bcm53xx_dma_bootstrap(psize_t memsize)
 		 * below 256MB which for PCI and GMAC are coherent.
 		 */
 		bcm53xx_dma_ranges[1].dr_len = memsize - 0x1000;
-#ifndef _ARM32_NEED_BUS_DMA_BOUNCE
 		bcm53xx_coherent_dma_ranges[1].dr_len = memsize - 0x1000;
+#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
+		bcm53xx_bounce_dma_ranges[1].dr_len = memsize - 0x1000;
 #endif
 	}
 	KASSERT(bcm53xx_dma_tag._ranges[0].dr_flags == 0);
 	KASSERT(bcm53xx_coherent_dma_tag._ranges[0].dr_flags == _BUS_DMAMAP_COHERENT);
+#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
+	KASSERT(bcm53xx_bounce_dma_tag._ranges[0].dr_flags == _BUS_DMAMAP_COHERENT);
+#endif
 }
 
 #ifdef MULTIPROCESSOR

Index: src/sys/arch/arm/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.17.2.4 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.17.2.5
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.17.2.4	Thu Feb  7 06:51:49 2013
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Tue Feb 19 02:22:02 2013
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.17.2.4 2013/02/07 06:51:49 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.17.2.5 2013/02/19 02:22:02 matt Exp $");
 
 #include 
 #include 
@@ -281,6 +281,11 @@ bcmeth_ccb_attach(device_t parent, devic
 	 * We need to use the coherent dma tag for the GMAC.
 	 */
 	sc->sc_dmat = &bcm53xx_coherent_dma_tag;
+#if _ARM32_NEED_BUS_DMA_BOUNCE
+	if (device_cfdata(self)->cf_flags & 2) {
+		sc->sc_dmat = &bcm53xx_bounce_dma_tag;
+	}
+#endif
 
 	prop_data_t eaprop = prop_dictionary_get(dict, "mac-address");
 if (eaprop == NULL) {

Index: src/sys/arch/arm/broadcom/bcm53xx_pax.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.7.4.2 src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.7.4.3
--- src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.7.4.2	Wed Nov 28 22:40:23 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_pax.c	Tue Feb 19 02:22:02 2013
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.7.4.2 2012/11/28 22:40:23 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.7.4.3 2013/02/19 02:22:02 matt Exp $");
 
 #include 
 #include 
@@ -199,10 +199,15 @@ bcmpax_ccb_attach(device_t parent, devic
 	struct bcmccb_attach_args * const ccbaa = aux;
 	const struct bcm_locators * const loc = &ccbaa->ccbaa_loc;
 	const char * const xname = device_xname(self);
+	cfdata_t cf = de

CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32

2013-02-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 15 01:02:59 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: bus_dma.c

Log Message:
Actually use the calculated uboundary


To generate a diff of this commit:
cvs rdiff -u -r1.54.10.5 -r1.54.10.6 src/sys/arch/arm/arm32/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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.54.10.5 src/sys/arch/arm/arm32/bus_dma.c:1.54.10.6
--- src/sys/arch/arm/arm32/bus_dma.c:1.54.10.5	Thu Feb 14 08:24:58 2013
+++ src/sys/arch/arm/arm32/bus_dma.c	Fri Feb 15 01:02:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.54.10.5 2013/02/14 08:24:58 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.54.10.6 2013/02/15 01:02:59 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.5 2013/02/14 08:24:58 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.6 2013/02/15 01:02:59 matt Exp $");
 
 #include 
 #include 
@@ -1562,7 +1562,7 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t,
 	/*
 	 * Allocate pages from the VM system.
 	 */
-	error = uvm_pglistalloc(size, low, high, alignment, boundary,
+	error = uvm_pglistalloc(size, low, high, alignment, uboundary,
 	&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
 	if (error)
 		return (error);



CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32

2013-02-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 14 08:24:59 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: bus_dma.c

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.54.10.4 -r1.54.10.5 src/sys/arch/arm/arm32/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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.54.10.4 src/sys/arch/arm/arm32/bus_dma.c:1.54.10.5
--- src/sys/arch/arm/arm32/bus_dma.c:1.54.10.4	Thu Feb 14 08:08:18 2013
+++ src/sys/arch/arm/arm32/bus_dma.c	Thu Feb 14 08:24:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.54.10.4 2013/02/14 08:08:18 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.54.10.5 2013/02/14 08:24:58 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.4 2013/02/14 08:08:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.5 2013/02/14 08:24:58 matt Exp $");
 
 #include 
 #include 
@@ -763,11 +763,11 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 		const size_t line_size = arm_dcache_align;
 		const size_t line_mask = arm_dcache_align_mask;
 		vsize_t misalignment = va & line_mask;
-		STAT_INCR(sync_preread);
 		if (misalignment) {
 			va -= misalignment;
 			pa -= misalignment;
 			len += misalignment;
+			STAT_INCR(sync_preread_begin);
 			cpu_dcache_wbinv_range(va, line_size);
 			cpu_sdcache_wbinv_range(va, pa, line_size);
 			if (len <= line_size)
@@ -779,12 +779,14 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 		misalignment = len & line_mask;
 		len -= misalignment;
 		if (len > 0) {
+			STAT_INCR(sync_preread);
 			cpu_dcache_inv_range(va, len);
 			cpu_sdcache_inv_range(va, pa, len);
 		}
 		if (misalignment) {
 			va += len;
 			pa += len;
+			STAT_INCR(sync_preread_tail);
 			cpu_dcache_wbinv_range(va, line_size);
 			cpu_sdcache_wbinv_range(va, pa, line_size);
 		}



CVS commit: [matt-nb6-plus] src/sys/arch/arm/conf

2013-02-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 14 08:09:00 UTC 2013

Modified Files:
src/sys/arch/arm/conf [matt-nb6-plus]: files.arm

Log Message:
Add BUSDMA_COUNTERS option


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.1.2.1 -r1.103.2.1.2.2 src/sys/arch/arm/conf/files.arm

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/conf/files.arm
diff -u src/sys/arch/arm/conf/files.arm:1.103.2.1.2.1 src/sys/arch/arm/conf/files.arm:1.103.2.1.2.2
--- src/sys/arch/arm/conf/files.arm:1.103.2.1.2.1	Wed Nov 28 22:40:25 2012
+++ src/sys/arch/arm/conf/files.arm	Thu Feb 14 08:09:00 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arm,v 1.103.2.1.2.1 2012/11/28 22:40:25 matt Exp $
+#	$NetBSD: files.arm,v 1.103.2.1.2.2 2013/02/14 08:09:00 matt Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflagARM32
@@ -45,7 +45,9 @@ defparam opt_arm_intr_impl.h	ARM_INTR_IM
 defflag	opt_arm_debug.h		ARM_LOCK_CAS_DEBUG
 
 # Board-specific bus_space(9)/bus_dma(9) definitions
-defflag  opt_arm_bus_space.h	__BUS_SPACE_HAS_STREAM_METHODS _ARM32_NEED_BUS_DMA_BOUNCE
+defflag  opt_arm_bus_space.h	__BUS_SPACE_HAS_STREAM_METHODS
+_ARM32_NEED_BUS_DMA_BOUNCE
+BUSDMA_COUNTERS
 
 # Floating point emulator
 defflagARMFPE



CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32

2013-02-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 14 08:08:18 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: bus_dma.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.54.10.3 -r1.54.10.4 src/sys/arch/arm/arm32/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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.54.10.3 src/sys/arch/arm/arm32/bus_dma.c:1.54.10.4
--- src/sys/arch/arm/arm32/bus_dma.c:1.54.10.3	Thu Feb 14 01:12:53 2013
+++ src/sys/arch/arm/arm32/bus_dma.c	Thu Feb 14 08:08:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.54.10.3 2013/02/14 01:12:53 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.54.10.4 2013/02/14 08:08:18 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.3 2013/02/14 01:12:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.4 2013/02/14 08:08:18 matt Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 
 #include 
 
+#ifdef BUSDMA_COUNTERS
 static struct evcnt bus_dma_creates =
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "creates");
 static struct evcnt bus_dma_bounced_creates =
@@ -75,6 +76,22 @@ static struct evcnt bus_dma_bounced_dest
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "bounced destroys");
 static struct evcnt bus_dma_destroys =
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "destroys");
+static struct evcnt bus_dma_sync_prereadwrite = 
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync prereadwrite");
+static struct evcnt bus_dma_sync_preread_begin =
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync preread begin");
+static struct evcnt bus_dma_sync_preread =
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync preread");
+static struct evcnt bus_dma_sync_preread_tail =
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync preread tail");
+static struct evcnt bus_dma_sync_prewrite = 
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync prewrite");
+static struct evcnt bus_dma_sync_postread = 
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync postread");
+static struct evcnt bus_dma_sync_postreadwrite = 
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync postreadwrite");
+static struct evcnt bus_dma_sync_postwrite = 
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync postwrite");
 
 EVCNT_ATTACH_STATIC(bus_dma_creates);
 EVCNT_ATTACH_STATIC(bus_dma_bounced_creates);
@@ -86,8 +103,19 @@ EVCNT_ATTACH_STATIC(bus_dma_unloads);
 EVCNT_ATTACH_STATIC(bus_dma_bounced_unloads);
 EVCNT_ATTACH_STATIC(bus_dma_destroys);
 EVCNT_ATTACH_STATIC(bus_dma_bounced_destroys);
+EVCNT_ATTACH_STATIC(bus_dma_sync_prereadwrite);
+EVCNT_ATTACH_STATIC(bus_dma_sync_preread_begin);
+EVCNT_ATTACH_STATIC(bus_dma_sync_preread);
+EVCNT_ATTACH_STATIC(bus_dma_sync_preread_tail);
+EVCNT_ATTACH_STATIC(bus_dma_sync_prewrite);
+EVCNT_ATTACH_STATIC(bus_dma_sync_postread);
+EVCNT_ATTACH_STATIC(bus_dma_sync_postreadwrite);
+EVCNT_ATTACH_STATIC(bus_dma_sync_postwrite);
 
 #define	STAT_INCR(x)	(bus_dma_ ## x.ev_count++)
+#else
+#define	STAT_INCR(x)	/*(bus_dma_ ## x.ev_count++)*/
+#endif
 
 int	_bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
 	bus_size_t, struct vmspace *, int);
@@ -724,6 +752,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 	switch (ops) {
 	case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE:
 		if (!readonly_p) {
+			STAT_INCR(sync_prereadwrite);
 			cpu_dcache_wbinv_range(va, len);
 			cpu_sdcache_wbinv_range(va, pa, len);
 			break;
@@ -734,6 +763,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 		const size_t line_size = arm_dcache_align;
 		const size_t line_mask = arm_dcache_align_mask;
 		vsize_t misalignment = va & line_mask;
+		STAT_INCR(sync_preread);
 		if (misalignment) {
 			va -= misalignment;
 			pa -= misalignment;
@@ -762,6 +792,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 	}
 
 	case BUS_DMASYNC_PREWRITE:
+		STAT_INCR(sync_prewrite);
 		cpu_dcache_wb_range(va, len);
 		cpu_sdcache_wb_range(va, pa, len);
 		break;
@@ -774,7 +805,12 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 	 * have to worry about having to write back their contents.
 	 */
 	case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE:
+		STAT_INCR(sync_postreadwrite);
+		cpu_dcache_inv_range(va, len);
+		cpu_sdcache_inv_range(va, pa, len);
+		break;
 	case BUS_DMASYNC_POSTREAD:
+		STAT_INCR(sync_postread);
 		cpu_dcache_inv_range(va, len);
 		cpu_sdcache_inv_range(va, pa, len);
 		break;
@@ -975,6 +1011,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	const int post_ops = 0;
 #endif
 	if (!bouncing && pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) {
+		STAT_INCR(sync_postwrite);
 		return;
 	}
 	KASSERTMSG(bouncing || pre_ops != 0 || (post_

CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32

2013-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 14 01:12:53 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: bus_dma.c

Log Message:
sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.54.10.2 -r1.54.10.3 src/sys/arch/arm/arm32/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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.54.10.2 src/sys/arch/arm/arm32/bus_dma.c:1.54.10.3
--- src/sys/arch/arm/arm32/bus_dma.c:1.54.10.2	Wed Jan 16 22:44:18 2013
+++ src/sys/arch/arm/arm32/bus_dma.c	Thu Feb 14 01:12:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.54.10.2 2013/01/16 22:44:18 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.54.10.3 2013/02/14 01:12:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.2 2013/01/16 22:44:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.3 2013/02/14 01:12:53 matt Exp $");
 
 #include 
 #include 
@@ -169,16 +169,17 @@ _bus_dmamap_load_paddr(bus_dma_tag_t t, 
 		 * If this region is coherent, mark the segment as coherent.
 		 */
 		_ds_flags |= dr->dr_flags & _BUS_DMAMAP_COHERENT;
-#if 0
-		printf("%p: %#lx: range %#lx/%#lx/%#lx/%#x: %#x\n",
-		t, paddr, dr->dr_sysbase, dr->dr_busbase,
-		dr->dr_len, dr->dr_flags, _ds_flags);
-#endif
+
 		/*
 		 * In a valid DMA range.  Translate the physical
 		 * memory address to an address in the DMA window.
 		 */
 		curaddr = (paddr - dr->dr_sysbase) + dr->dr_busbase;
+#if 0
+		printf("%p: %#lx: range %#lx/%#lx/%#lx/%#x: %#x <-- %#lx\n",
+		t, paddr, dr->dr_sysbase, dr->dr_busbase,
+		dr->dr_len, dr->dr_flags, _ds_flags, curaddr);
+#endif
 	} else
 		curaddr = paddr;
 
@@ -450,7 +451,9 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
 	map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	if (buflen > map->_dm_size)
 		return (EINVAL);
@@ -517,7 +520,9 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
 	map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 #ifdef DIAGNOSTIC
 	if ((m0->m_flags & M_PKTHDR) == 0)
@@ -639,7 +644,9 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	resid = uio->uio_resid;
 	iov = uio->uio_iov;
@@ -956,7 +963,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	 *	POSTWRITE -- Nothing.
 	 */
 #ifdef _ARM32_NEED_BUS_DMA_BOUNCE
-	const bool bouncing = (map->_dm_flags & _BUS_DMA_IS_BOUNCING);
+	const bool bouncing = (map->_dm_flags & _BUS_DMAMAP_IS_BOUNCING);
 #else
 	const bool bouncing = false;
 #endif
@@ -970,7 +977,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	if (!bouncing && pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) {
 		return;
 	}
-
+	KASSERTMSG(bouncing || pre_ops != 0 || (post_ops & BUS_DMASYNC_POSTREAD),
+	"pre_ops %#x post_ops %#x", pre_ops, post_ops);
 #ifdef _ARM32_NEED_BUS_DMA_BOUNCE
 	if (bouncing && (ops & BUS_DMASYNC_PREWRITE)) {
 		struct arm32_bus_dma_cookie * const cookie = map->_dm_cookie;
@@ -1010,7 +1018,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	/* Skip cache frobbing if mapping was COHERENT. */
 	if (!bouncing && (map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
 		/* Drain the write buffer. */
-		cpu_drain_writebuf();
+		if (pre_ops & BUS_DMASYNC_PREWRITE)
+			cpu_drain_writebuf();
 		return;
 	}
 
@@ -1132,7 +1141,8 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_s
 	if ((dr = t->_ranges) != NULL) {
 		error = ENOMEM;
 		for (i = 0; i < t->_nranges; i++, dr++) {
-			if (dr->dr_len == 0)
+			if (dr->dr_len == 0
+			|| (dr->dr_flags & _BUS_DMAMAP_NOALLOC))
 continue;
 			error = _bus_dmamem_alloc_range(t, size, alignment,
 			boundary, segs, nsegs, rsegs, flags,
@@ -1213,34 +1223,32 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 	 * avoid having a separate mapping for it.
 	 */
 	if (nsegs == 1) {
-		paddr_t paddr = segs[0].ds_addr;
 		/*
 		 * If this is a non-COHERENT mapping, then the existing kernel
 		 * mapping is already compatible with it.
 		 */
-		if ((flags & BUS_DMA_COHERENT) == 0) {
-#ifdef DEBUG_DMA
-			printf("dmamem_map: =%p\n", *kvap);
-#endif	/* DEBUG_DMA */
-			*kvap = (void *)PMAP_MAP_POOLPAGE(paddr);
-			retur

CVS commit: [matt-nb6-plus] src/sys/arch/evbarm/conf

2013-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 13 23:54:05 UTC 2013

Modified Files:
src/sys/arch/evbarm/conf [matt-nb6-plus]: std.bcm53xx

Log Message:
enable bounce buffers


To generate a diff of this commit:
cvs rdiff -u -r1.7.4.2 -r1.7.4.3 src/sys/arch/evbarm/conf/std.bcm53xx

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/evbarm/conf/std.bcm53xx
diff -u src/sys/arch/evbarm/conf/std.bcm53xx:1.7.4.2 src/sys/arch/evbarm/conf/std.bcm53xx:1.7.4.3
--- src/sys/arch/evbarm/conf/std.bcm53xx:1.7.4.2	Wed Nov 28 22:50:09 2012
+++ src/sys/arch/evbarm/conf/std.bcm53xx	Wed Feb 13 23:54:04 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: std.bcm53xx,v 1.7.4.2 2012/11/28 22:50:09 matt Exp $
+#	$NetBSD: std.bcm53xx,v 1.7.4.3 2013/02/13 23:54:04 matt Exp $
 #
 # standard NetBSD/evbarm for BEAGLEBAORD options
 
@@ -16,7 +16,7 @@ options 	COM_TOLERANCE=40
 options 	ARM32
 options 	FPU_VFP
 options 	CORTEX_PMC
-#options 	_ARM32_NEED_BUS_DMA_BOUNCE
+options 	_ARM32_NEED_BUS_DMA_BOUNCE
 options 	PMAP_NEED_ALLOC_POOLPAGE
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP



CVS commit: [matt-nb6-plus] src/sys

2013-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 13 23:52:45 UTC 2013

Modified Files:
src/sys/arch/arm/include [matt-nb6-plus]: bus_defs.h
src/sys/sys [matt-nb6-plus]: bus_proto.h

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.1.10.1 -r1.1.10.2 src/sys/arch/arm/include/bus_defs.h
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/sys/bus_proto.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/arch/arm/include/bus_defs.h
diff -u src/sys/arch/arm/include/bus_defs.h:1.1.10.1 src/sys/arch/arm/include/bus_defs.h:1.1.10.2
--- src/sys/arch/arm/include/bus_defs.h:1.1.10.1	Wed Nov 28 22:40:28 2012
+++ src/sys/arch/arm/include/bus_defs.h	Wed Feb 13 23:52:45 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.1.10.1 2012/11/28 22:40:28 matt Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.1.10.2 2013/02/13 23:52:45 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -300,7 +300,8 @@ struct bus_space {
  * Private flags stored in the DMA map.
  */
 #define	_BUS_DMAMAP_COHERENT	0x1	/* no cache flush necessary on sync */
-#define	_BUS_DMAMAP_IS_BOUNCING	0x2	/* is bouncing current xfer */
+#define	_BUS_DMAMAP_IS_BOUNCING	0x2 /* is bouncing current xfer */
+#define	_BUS_DMAMAP_NOALLOC	0x4	/* don't alloc memory from this range */
 
 /* Forwards needed by prototypes below. */
 struct mbuf;

Index: src/sys/sys/bus_proto.h
diff -u src/sys/sys/bus_proto.h:1.6 src/sys/sys/bus_proto.h:1.6.10.1
--- src/sys/sys/bus_proto.h:1.6	Wed Aug 17 10:46:38 2011
+++ src/sys/sys/bus_proto.h	Wed Feb 13 23:52:45 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_proto.h,v 1.6 2011/08/17 10:46:38 martin Exp $	*/
+/*	$NetBSD: bus_proto.h,v 1.6.10.1 2013/02/13 23:52:45 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001, 2007 The NetBSD Foundation, Inc.
@@ -319,6 +319,8 @@ bool	bus_space_handle_is_equal(bus_space
 #define	BUS_DMA_READ		0x100	/* mapping is device -> memory only */
 #define	BUS_DMA_WRITE		0x200	/* mapping is memory -> device only */
 #define	BUS_DMA_NOCACHE		0x400	/* hint: map non-cached memory */
+#define	BUS_DMA_PREFETCHABLE	0x800	/* hint: map non-cached but allow 
+	 * things like write combining */
 
 /* Operations performed by bus_dmamap_sync(). */
 #define	BUS_DMASYNC_PREREAD	0x01	/* pre-read synchronization */



CVS commit: [matt-nb6-plus] src/sys/arch/arm/broadcom

2013-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 13 23:52:18 UTC 2013

Modified Files:
src/sys/arch/arm/broadcom [matt-nb6-plus]: bcm53xx_board.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.3 -r1.8.4.4 src/sys/arch/arm/broadcom/bcm53xx_board.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/broadcom/bcm53xx_board.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.3 src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.4
--- src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.3	Thu Feb  7 06:51:48 2013
+++ src/sys/arch/arm/broadcom/bcm53xx_board.c	Wed Feb 13 23:52:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_board.c,v 1.8.4.3 2013/02/07 06:51:48 matt Exp $	*/
+/*	$NetBSD: bcm53xx_board.c,v 1.8.4.4 2013/02/13 23:52:18 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.3 2013/02/07 06:51:48 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.4 2013/02/13 23:52:18 matt Exp $");
 
 #include 
 #include 
@@ -66,7 +66,7 @@ bus_space_handle_t bcm53xx_armcore_bsh;
 
 static struct cpu_softc cpu_softc;
 
-struct arm32_dma_range bcm53xx_dma_ranges[2] = {
+struct arm32_dma_range bcm53xx_dma_ranges[] = {
 	[0] = {
 		.dr_sysbase = 0x8000,
 		.dr_busbase = 0x8000,
@@ -85,15 +85,17 @@ struct arm32_bus_dma_tag bcm53xx_dma_tag
 	_BUS_DMATAG_FUNCS,
 };
 
-struct arm32_dma_range bcm53xx_coherent_dma_ranges[2] = {
+struct arm32_dma_range bcm53xx_coherent_dma_ranges[] = {
 	[0] = {
 		.dr_sysbase = 0x8000,
 		.dr_busbase = 0x8000,
 		.dr_len = 0x1000,
 		.dr_flags = _BUS_DMAMAP_COHERENT,
+#ifndef _ARM32_NEED_BUS_DMA_BOUNCE
 	}, [1] = {
 		.dr_sysbase = 0x9000,
 		.dr_busbase = 0x9000,
+#endif
 	},
 };
 
@@ -521,19 +523,23 @@ bcm53xx_bootstrap(vaddr_t iobase)
 void
 bcm53xx_dma_bootstrap(psize_t memsize)
 {
-	if (memsize > 256*1024*1024) {
+	if (memsize <= 256*1024*1024) {
+		bcm53xx_dma_ranges[0].dr_len = memsize;
+		bcm53xx_coherent_dma_ranges[0].dr_len = memsize;
+		bcm53xx_dma_tag._nranges = 1;
+#ifndef _ARM32_NEED_BUS_DMA_BOUNCE
+		bcm53xx_coherent_dma_tag._nranges = 1;
+#endif
+	} else {
 		/*
 		 * By setting up two ranges, bus_dmamem_alloc will always
 		 * try to allocate from range 0 first resulting in allocations
 		 * below 256MB which for PCI and GMAC are coherent.
 		 */
 		bcm53xx_dma_ranges[1].dr_len = memsize - 0x1000;
+#ifndef _ARM32_NEED_BUS_DMA_BOUNCE
 		bcm53xx_coherent_dma_ranges[1].dr_len = memsize - 0x1000;
-	} else {
-		bcm53xx_dma_ranges[0].dr_len = memsize;
-		bcm53xx_coherent_dma_ranges[0].dr_len = memsize;
-		bcm53xx_dma_tag._nranges = 1;
-		bcm53xx_coherent_dma_tag._nranges = 1;
+#endif
 	}
 	KASSERT(bcm53xx_dma_tag._ranges[0].dr_flags == 0);
 	KASSERT(bcm53xx_coherent_dma_tag._ranges[0].dr_flags == _BUS_DMAMAP_COHERENT);



CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32

2013-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 13 23:52:03 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: pmap.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.228.2.1.2.2 -r1.228.2.1.2.3 src/sys/arch/arm/arm32/pmap.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/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.228.2.1.2.2 src/sys/arch/arm/arm32/pmap.c:1.228.2.1.2.3
--- src/sys/arch/arm/arm32/pmap.c:1.228.2.1.2.2	Thu Feb  7 06:52:53 2013
+++ src/sys/arch/arm/arm32/pmap.c	Wed Feb 13 23:52:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.228.2.1.2.2 2013/02/07 06:52:53 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.228.2.1.2.3 2013/02/13 23:52:02 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.228.2.1.2.2 2013/02/07 06:52:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.228.2.1.2.3 2013/02/13 23:52:02 matt Exp $");
 
 #ifdef PMAP_DEBUG
 
@@ -605,14 +605,32 @@ struct pv_entry {
  * Macro to determine if a mapping might be resident in the
  * instruction cache and/or TLB
  */
+#if ARM_MMU_V7 > 0
+/*
+ * Speculative loads by Cortex cores can cause TLB entries to be filled even if
+ * there are no explicit accesses, so there may be always be TLB entries to
+ * flush.  If we used ASIDs then this would not be a problem.
+ */
+#define	PV_BEEN_EXECD(f)  (((f) & PVF_EXEC) == PVF_EXEC)
+#else
 #define	PV_BEEN_EXECD(f)  (((f) & (PVF_REF | PVF_EXEC)) == (PVF_REF | PVF_EXEC))
+#endif
 #define	PV_IS_EXEC_P(f)   (((f) & PVF_EXEC) != 0)
 
 /*
  * Macro to determine if a mapping might be resident in the
  * data cache and/or TLB
  */
+#if ARM_MMU_V7 > 0
+/*
+ * Speculative loads by Cortex cores can cause TLB entries to be filled even if
+ * there are no explicit accesses, so there may be always be TLB entries to
+ * flush.  If we used ASIDs then this would not be a problem.
+ */
+#define	PV_BEEN_REFD(f)   (1)
+#else
 #define	PV_BEEN_REFD(f)   (((f) & PVF_REF) != 0)
+#endif
 
 /*
  * Local prototypes
@@ -726,7 +744,16 @@ pmap_tlb_flushID(pmap_t pm)
 
 	if (pm->pm_cstate.cs_tlb_id) {
 		cpu_tlb_flushID();
+#if ARM_MMU_V7 == 0
+		/*
+		 * Speculative loads by Cortex cores can cause TLB entries to
+		 * be filled even if there are no explicit accesses, so there
+		 * may be always be TLB entries to flush.  If we used ASIDs
+		 * then it would not be a problem.
+		 * This is not true for other CPUs.
+		 */
 		pm->pm_cstate.cs_tlb = 0;
+#endif
 	}
 }
 
@@ -736,7 +763,16 @@ pmap_tlb_flushD(pmap_t pm)
 
 	if (pm->pm_cstate.cs_tlb_d) {
 		cpu_tlb_flushD();
+#if ARM_MMU_V7 == 0
+		/*
+		 * Speculative loads by Cortex cores can cause TLB entries to
+		 * be filled even if there are no explicit accesses, so there
+		 * may be always be TLB entries to flush.  If we used ASIDs
+		 * then it would not be a problem.
+		 * This is not true for other CPUs.
+		 */
 		pm->pm_cstate.cs_tlb_d = 0;
+#endif
 	}
 }
 



CVS commit: [matt-nb6-plus] src/sys/arch/evbarm/conf

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 07:04:44 UTC 2013

Modified Files:
src/sys/arch/evbarm/conf [matt-nb6-plus]: BCM5301X

Log Message:
Disable UVMHIST


To generate a diff of this commit:
cvs rdiff -u -r1.9.4.2 -r1.9.4.3 src/sys/arch/evbarm/conf/BCM5301X

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/evbarm/conf/BCM5301X
diff -u src/sys/arch/evbarm/conf/BCM5301X:1.9.4.2 src/sys/arch/evbarm/conf/BCM5301X:1.9.4.3
--- src/sys/arch/evbarm/conf/BCM5301X:1.9.4.2	Wed Nov 28 22:50:05 2012
+++ src/sys/arch/evbarm/conf/BCM5301X	Thu Feb  7 07:04:44 2013
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BCM5301X,v 1.9.4.2 2012/11/28 22:50:05 matt Exp $
+#	$NetBSD: BCM5301X,v 1.9.4.3 2013/02/07 07:04:44 matt Exp $
 #
 #	BCM5301X -- Broadcom BCM5301X Eval Board Kernel
 #
@@ -18,7 +18,7 @@ options 	RTC_OFFSET=0	# hardware clock i
 # CPU options
 
 #makeoptions	DEFCOPTS="-O0"
-options 	UVMHIST
+#options 	UVMHIST
 #options 	UVMHIST_PRINT,A9WDT_PERIOD_DEFAULT=30
 options 	BCM53XX_CONSOLE_EARLY
 #options 	MULTIPROCESSOR



CVS commit: [matt-nb6-plus] src/sys/lib/libkern

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 07:03:28 UTC 2013

Modified Files:
src/sys/lib/libkern [matt-nb6-plus]: Makefile.libkern

Log Message:
Pullup rev 1.19:
date: 2013/01/23 22:34:37;  author: matt;  state: Exp;  lines: +2 -2
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.4.1 src/sys/lib/libkern/Makefile.libkern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.17 src/sys/lib/libkern/Makefile.libkern:1.17.4.1
--- src/sys/lib/libkern/Makefile.libkern:1.17	Sun Feb  5 14:19:03 2012
+++ src/sys/lib/libkern/Makefile.libkern	Thu Feb  7 07:03:28 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.17 2012/02/05 14:19:03 dholland Exp $
+#	$NetBSD: Makefile.libkern,v 1.17.4.1 2013/02/07 07:03:28 matt Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -84,7 +84,7 @@ SRCS+=	random.c
 SRCS+=	rngtest.c
 
 SRCS+=	memchr.c
-SRCS+=	strcat.c strcmp.c strcpy.c strlen.c
+SRCS+=	strcat.c strcmp.c strcpy.c strlen.c strnlen.c
 SRCS+=	strncmp.c strncpy.c
 SRCS+=	strcasecmp.c strncasecmp.c
 



CVS commit: [matt-nb6-plus] src/sys/sys

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 06:58:40 UTC 2013

Modified Files:
src/sys/sys [matt-nb6-plus]: cdefs.h

Log Message:
Pull rev 1.104 from HEAD:
Don't define __BIT/__BITS if __ASSEMBLER__ is defined.
(since they use C syntax they won't work anyways).


To generate a diff of this commit:
cvs rdiff -u -r1.89.6.2 -r1.89.6.2.2.1 src/sys/sys/cdefs.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/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.89.6.2 src/sys/sys/cdefs.h:1.89.6.2.2.1
--- src/sys/sys/cdefs.h:1.89.6.2	Sun Jun 24 15:44:07 2012
+++ src/sys/sys/cdefs.h	Thu Feb  7 06:58:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.89.6.2 2012/06/24 15:44:07 jdc Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.89.6.2.2.1 2013/02/07 06:58:40 matt Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -499,6 +499,7 @@
  */
 #define	__arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
 
+#ifndef __ASSEMBLER__
 /* __BIT(n): nth bit, where __BIT(0) == 0x1. */
 #define	__BIT(__n)	\
 (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)(__n)))
@@ -506,6 +507,7 @@
 /* __BITS(m, n): bits m through n, m < n. */
 #define	__BITS(__m, __n)	\
 	((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
+#endif /* !__ASSEMBLER__ */
 
 /* find least significant bit that is set */
 #define	__LOWEST_SET_BIT(__mask) __mask) - 1) & (__mask)) ^ (__mask))



CVS commit: [matt-nb6-plus] src/sys/arch/arm/cortex

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 06:55:01 UTC 2013

Modified Files:
src/sys/arch/arm/cortex [matt-nb6-plus]: pl310.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.8.2.2 -r1.8.2.3 src/sys/arch/arm/cortex/pl310.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/cortex/pl310.c
diff -u src/sys/arch/arm/cortex/pl310.c:1.8.2.2 src/sys/arch/arm/cortex/pl310.c:1.8.2.3
--- src/sys/arch/arm/cortex/pl310.c:1.8.2.2	Wed Nov 28 22:40:27 2012
+++ src/sys/arch/arm/cortex/pl310.c	Thu Feb  7 06:55:01 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pl310.c,v 1.8.2.2 2012/11/28 22:40:27 matt Exp $	*/
+/*	$NetBSD: pl310.c,v 1.8.2.3 2013/02/07 06:55:01 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.8.2.2 2012/11/28 22:40:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.8.2.3 2013/02/07 06:55:01 matt Exp $");
 
 #include 
 #include 
@@ -195,11 +195,14 @@ arml2cc_attach(device_t parent, device_t
 }
 
 static inline void
-arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val)
+arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val,
+bool wait)
 {
 	arml2cc_write_4(sc, off, val);
-	while (arml2cc_read_4(sc, off) & 1) {
-		/* spin */
+	if (wait) {
+		while (arml2cc_read_4(sc, off) & 1) {
+			/* spin */
+		}
 	}
 }
 
@@ -215,7 +218,7 @@ arml2cc_cache_way_op(struct arml2cc_soft
 static inline void
 arml2cc_cache_sync(struct arml2cc_softc *sc)
 {
-	arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0);
+	arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0, true);
 }
 
 static inline void
@@ -284,20 +287,16 @@ arml2cc_cache_range_op(paddr_t pa, psize
 		pa -= off;
 	}
 	len = roundup2(len, line_size);
-	off = pa & PAGE_MASK;
-	for (const paddr_t endpa = pa + len; pa < endpa; off = 0) {
-		psize_t seglen = min(len, PAGE_SIZE - off);
-
-		mutex_spin_enter(&sc->sc_lock);
-		if (!sc->sc_enabled) {
-			mutex_spin_exit(&sc->sc_lock);
-			return;
-		}
-		for (paddr_t segend = pa + seglen; pa < segend; pa += line_size) {
-			arml2cc_cache_op(sc, cache_op, pa);
-		}
+	mutex_spin_enter(&sc->sc_lock);
+	if (__predict_false(!sc->sc_enabled)) {
 		mutex_spin_exit(&sc->sc_lock);
+		return;
+	}
+	for (const paddr_t endpa = pa + len; pa < endpa; pa += line_size) {
+		arml2cc_cache_op(sc, cache_op, pa, false);
 	}
+	arml2cc_cache_sync(sc);
+	mutex_spin_exit(&sc->sc_lock);
 }
 
 static void



CVS commit: [matt-nb6-plus] src/sys/arch/arm

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 06:52:54 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: pmap.c
src/sys/arch/arm/include/arm32 [matt-nb6-plus]: pmap.h

Log Message:
pullup pmap changes from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.228.2.1.2.1 -r1.228.2.1.2.2 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.101.4.1 -r1.101.4.2 src/sys/arch/arm/include/arm32/pmap.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/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.228.2.1.2.1 src/sys/arch/arm/arm32/pmap.c:1.228.2.1.2.2
--- src/sys/arch/arm/arm32/pmap.c:1.228.2.1.2.1	Wed Nov 28 22:40:19 2012
+++ src/sys/arch/arm/arm32/pmap.c	Thu Feb  7 06:52:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.228.2.1.2.1 2012/11/28 22:40:19 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.228.2.1.2.2 2013/02/07 06:52:53 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.228.2.1.2.1 2012/11/28 22:40:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.228.2.1.2.2 2013/02/07 06:52:53 matt Exp $");
 
 #ifdef PMAP_DEBUG
 
@@ -668,12 +668,6 @@ static vaddr_t		kernel_pt_lookup(paddr_t
 
 
 /*
- * External function prototypes
- */
-extern void bzero_page(vaddr_t);
-extern void bcopy_page(vaddr_t, vaddr_t);
-
-/*
  * Misc variables
  */
 vaddr_t virtual_avail;
@@ -699,6 +693,12 @@ pmap_debug(int level)
 }
 #endif	/* PMAP_DEBUG */
 
+#ifdef PMAP_CACHE_VIPT
+#define PMAP_VALIDATE_MD_PAGE(md)	\
+	KASSERTMSG(arm_cache_prefer_mask == 0 || (((md)->pvh_attrs & PVF_WRITE) == 0) == ((md)->urw_mappings + (md)->krw_mappings == 0), \
+	"(md) %p: attrs=%#x urw=%u krw=%u", (md), \
+	(md)->pvh_attrs, (md)->urw_mappings, (md)->krw_mappings);
+#endif /* PMAP_CACHE_VIPT */
 /*
  * A bunch of routines to conditionally flush the caches/TLB depending
  * on whether the specified pmap actually needs to be flushed at any
@@ -829,10 +829,10 @@ do {	\
 /*
  * main pv_entry manipulation functions:
  *   pmap_enter_pv: enter a mapping onto a vm_page list
- *   pmap_remove_pv: remove a mappiing from a vm_page list
+ *   pmap_remove_pv: remove a mapping from a vm_page list
  *
  * NOTE: pmap_enter_pv expects to lock the pvh itself
- *   pmap_remove_pv expects te caller to lock the pvh before calling
+ *   pmap_remove_pv expects the caller to lock the pvh before calling
  */
 
 /*
@@ -896,6 +896,13 @@ pmap_enter_pv(struct vm_page_md *md, pad
 
 #ifdef PMAP_CACHE_VIPT
 	/*
+	 * Even though pmap_vac_me_harder will set PVF_WRITE for us,
+	 * do it here as well to keep the mappings & KVF_WRITE consistent.
+	 */
+	if (arm_cache_prefer_mask != 0 && (flags & PVF_WRITE) != 0) {
+		md->pvh_attrs |= PVF_WRITE;
+	}
+	/*
 	 * If this is an exec mapping and its the first exec mapping
 	 * for this page, make sure to sync the I-cache.
 	 */
@@ -1014,8 +1021,11 @@ pmap_remove_pv(struct vm_page_md *md, pa
 	 * mappings (ignoring KMPAGE), clear the WRITE flag and writeback
 	 * the contents to memory.
 	 */
-	if (md->krw_mappings + md->urw_mappings == 0)
-		md->pvh_attrs &= ~PVF_WRITE;
+	if (arm_cache_prefer_mask != 0) {
+		if (md->krw_mappings + md->urw_mappings == 0)
+			md->pvh_attrs &= ~PVF_WRITE;
+		PMAP_VALIDATE_MD_PAGE(md);
+	}
 	KASSERT((md->pvh_attrs & PVF_DMOD) == 0 || (md->pvh_attrs & (PVF_DIRTY|PVF_NC)));
 #endif /* PMAP_CACHE_VIPT */
 
@@ -1093,8 +1103,13 @@ pmap_modify_pv(struct vm_page_md *md, pa
 		}
 	}
 #ifdef PMAP_CACHE_VIPT
-	if (md->urw_mappings + md->krw_mappings == 0)
-		md->pvh_attrs &= ~PVF_WRITE;
+	if (arm_cache_prefer_mask != 0) {
+		if (md->urw_mappings + md->krw_mappings == 0) {
+			md->pvh_attrs &= ~PVF_WRITE;
+		} else {
+			md->pvh_attrs |= PVF_WRITE;
+		}
+	}
 	/*
 	 * We have two cases here: the first is from enter_pv (new exec
 	 * page), the second is a combined pmap_remove_pv/pmap_enter_pv.
@@ -1850,7 +1865,7 @@ pmap_vac_me_harder(struct vm_page_md *md
 		 * Only check for a bad alias if we have writable mappings.
 		 */
 		tst_mask &= arm_cache_prefer_mask;
-		if (rw_mappings > 0 && arm_cache_prefer_mask) {
+		if (rw_mappings > 0) {
 			for (; pv && !bad_alias; pv = SLIST_NEXT(pv, pv_link)) {
 /* if there's a bad alias, stop checking. */
 if (tst_mask != (pv->pv_va & arm_cache_prefer_mask))
@@ -1906,7 +1921,7 @@ pmap_vac_me_harder(struct vm_page_md *md
 		KASSERT((md->pvh_attrs & PVF_DMOD) == 0 || (md->pvh_attrs & (PVF_DIRTY|PVF_NC)));
 		KASSERT((rw_mappings == 0) == !(md->pvh_attrs & PVF_WRITE));
 	} else if (!va) {
-		KASSERT(arm_cache_prefer_mask == 0 || pmap_is_page_colored_p(md));
+		KASSERT(pmap_is_page_colored_p(md));
 		KASSERT(!(md->pvh_attrs & PVF_WRITE)
 		|| (md->pvh_attrs & PVF_DIRTY));
 		if (rw_mappings == 0) {
@@ -2230,8 +2245,13 @@ pmap_clearbit(struct vm_page_md *md, pad
 	md->uro_mappings++;
 }
 #ifdef PMAP_CACHE_V

CVS commit: [matt-nb6-plus] src/sys/arch/arm/broadcom

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 06:51:50 UTC 2013

Modified Files:
src/sys/arch/arm/broadcom [matt-nb6-plus]: bcm53xx_board.c
bcm53xx_eth.c bcm53xx_idm.c bcm53xx_reg.h bcm53xx_rng.c

Log Message:
Sync bcm53xx support to HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.2 -r1.8.4.3 src/sys/arch/arm/broadcom/bcm53xx_board.c
cvs rdiff -u -r1.17.2.3 -r1.17.2.4 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/arch/arm/broadcom/bcm53xx_idm.c
cvs rdiff -u -r1.10.2.3 -r1.10.2.4 src/sys/arch/arm/broadcom/bcm53xx_reg.h
cvs rdiff -u -r1.3.4.2 -r1.3.4.3 src/sys/arch/arm/broadcom/bcm53xx_rng.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/broadcom/bcm53xx_board.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.2 src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.3
--- src/sys/arch/arm/broadcom/bcm53xx_board.c:1.8.4.2	Wed Nov 28 22:40:21 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_board.c	Thu Feb  7 06:51:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_board.c,v 1.8.4.2 2012/11/28 22:40:21 matt Exp $	*/
+/*	$NetBSD: bcm53xx_board.c,v 1.8.4.3 2013/02/07 06:51:48 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.2 2012/11/28 22:40:21 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.8.4.3 2013/02/07 06:51:48 matt Exp $");
 
 #include 
 #include 
@@ -65,7 +65,6 @@ bus_space_tag_t bcm53xx_armcore_bst = &b
 bus_space_handle_t bcm53xx_armcore_bsh;
 
 static struct cpu_softc cpu_softc;
-static struct bcm53xx_clock_info clk_info;
 
 struct arm32_dma_range bcm53xx_dma_ranges[2] = {
 	[0] = {
@@ -450,23 +449,24 @@ void
 bcm53xx_print_clocks(void)
 {
 #if defined(VERBOSE_ARM_INIT)
-	printf("ref clk =	%u (%#x)\n", clk_info.clk_ref, clk_info.clk_ref);
-	printf("sys clk =	%u (%#x)\n", clk_info.clk_sys, clk_info.clk_sys);
-	printf("lcpll clk =	%u (%#x)\n", clk_info.clk_lcpll, clk_info.clk_lcpll);
-	printf("pcie ref clk =	%u (%#x) [CH0]\n", clk_info.clk_pcie_ref, clk_info.clk_pcie_ref);
-	printf("sdio clk =	%u (%#x) [CH1]\n", clk_info.clk_sdio, clk_info.clk_sdio);
-	printf("ddr ref clk =	%u (%#x) [CH2]\n", clk_info.clk_ddr_ref, clk_info.clk_ddr_ref);
-	printf("axi clk =	%u (%#x) [CH3]\n", clk_info.clk_axi, clk_info.clk_axi);
-	printf("genpll clk =	%u (%#x)\n", clk_info.clk_genpll, clk_info.clk_genpll);
-	printf("mac clk =	%u (%#x) [CH0]\n", clk_info.clk_mac, clk_info.clk_mac);
-	printf("robo clk =	%u (%#x) [CH1]\n", clk_info.clk_robo, clk_info.clk_robo);
-	printf("usb2 clk =	%u (%#x) [CH2]\n", clk_info.clk_usb2, clk_info.clk_usb2);
-	printf("iproc clk =	%u (%#x) [CH3]\n", clk_info.clk_iproc, clk_info.clk_iproc);
-	printf("ddr clk =	%u (%#x)\n", clk_info.clk_ddr, clk_info.clk_ddr);
-	printf("ddr mhz =	%u (%#x)\n", clk_info.clk_ddr_mhz, clk_info.clk_ddr_mhz);
-	printf("cpu clk =	%u (%#x)\n", clk_info.clk_cpu, clk_info.clk_cpu);
-	printf("apb clk =	%u (%#x)\n", clk_info.clk_apb, clk_info.clk_apb);
-	printf("usb ref clk =	%u (%#x)\n", clk_info.clk_usb_ref, clk_info.clk_usb_ref);
+	const struct bcm53xx_clock_info * const clk = &cpu_softc.cpu_clk;
+	printf("ref clk =	%u (%#x)\n", clk->clk_ref, clk->clk_ref);
+	printf("sys clk =	%u (%#x)\n", clk->clk_sys, clk->clk_sys);
+	printf("lcpll clk =	%u (%#x)\n", clk->clk_lcpll, clk->clk_lcpll);
+	printf("pcie ref clk =	%u (%#x) [CH0]\n", clk->clk_pcie_ref, clk->clk_pcie_ref);
+	printf("sdio clk =	%u (%#x) [CH1]\n", clk->clk_sdio, clk->clk_sdio);
+	printf("ddr ref clk =	%u (%#x) [CH2]\n", clk->clk_ddr_ref, clk->clk_ddr_ref);
+	printf("axi clk =	%u (%#x) [CH3]\n", clk->clk_axi, clk->clk_axi);
+	printf("genpll clk =	%u (%#x)\n", clk->clk_genpll, clk->clk_genpll);
+	printf("mac clk =	%u (%#x) [CH0]\n", clk->clk_mac, clk->clk_mac);
+	printf("robo clk =	%u (%#x) [CH1]\n", clk->clk_robo, clk->clk_robo);
+	printf("usb2 clk =	%u (%#x) [CH2]\n", clk->clk_usb2, clk->clk_usb2);
+	printf("iproc clk =	%u (%#x) [CH3]\n", clk->clk_iproc, clk->clk_iproc);
+	printf("ddr clk =	%u (%#x)\n", clk->clk_ddr, clk->clk_ddr);
+	printf("ddr mhz =	%u (%#x)\n", clk->clk_ddr_mhz, clk->clk_ddr_mhz);
+	printf("cpu clk =	%u (%#x)\n", clk->clk_cpu, clk->clk_cpu);
+	printf("apb clk =	%u (%#x)\n", clk->clk_apb, clk->clk_apb);
+	printf("usb ref clk =	%u (%#x)\n", clk->clk_usb_ref, clk->clk_usb_ref);
 #endif
 }
 
@@ -500,7 +500,7 @@ bcm53xx_bootstrap(vaddr_t iobase)
 	bcm53xx_get_chip_ioreg_state(&bcs, bcm53xx_ioreg_bst, bcm53xx_ioreg_bsh);
 	bcm53xx_get_chip_armcore_state(&bcs, bcm53xx_armcore_bst, bcm53xx_armcore_bsh);
 
-	struct bcm53xx_clock_info * const clk = &clk_info;
+	struct bcm53xx_clock_info * const clk = &cpu_softc.cpu_clk;
 
 	bcm53xx_clock_init(clk);
 	bcm53xx_lcpll_clock_init(clk, bcs.bcs_lcpll_control1,
@@ -575,7 +575,7 @@ bcm53xx_device_register(device_t self, v
 		 * to ti

CVS commit: [matt-nb6-plus] src/sys/arch/arm/include

2013-01-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 17 01:33:34 UTC 2013

Modified Files:
src/sys/arch/arm/include [matt-nb6-plus]: bus_funcs.h

Log Message:
Pullup from HEAD:
Cortex needs ._dmamap_sync_post for BUS_DMASYNC_POSTREAD


To generate a diff of this commit:
cvs rdiff -u -r1.1.10.1 -r1.1.10.2 src/sys/arch/arm/include/bus_funcs.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/arch/arm/include/bus_funcs.h
diff -u src/sys/arch/arm/include/bus_funcs.h:1.1.10.1 src/sys/arch/arm/include/bus_funcs.h:1.1.10.2
--- src/sys/arch/arm/include/bus_funcs.h:1.1.10.1	Wed Nov 28 22:40:28 2012
+++ src/sys/arch/arm/include/bus_funcs.h	Thu Jan 17 01:33:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_funcs.h,v 1.1.10.1 2012/11/28 22:40:28 matt Exp $	*/
+/*	$NetBSD: bus_funcs.h,v 1.1.10.2 2013/01/17 01:33:34 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -64,6 +64,10 @@
 #ifndef _ARM32_BUS_FUNCS_H_
 #define _ARM32_BUS_FUNCS_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_cputypes.h"
+#endif
+
 /*
  * Utility macros; INTERNAL USE ONLY.
  */
@@ -635,7 +639,7 @@ void	_bus_dmamap_unload(bus_dma_tag_t, b
 void	_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
 	bus_size_t, int);
 
-#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
+#if defined(_ARM32_NEED_BUS_DMA_BOUNCE) || defined(CPU_CORTEX)
 #define	_BUS_DMAMAP_SYNC_FUNCS \
 	._dmamap_sync_pre = _bus_dmamap_sync,	\
 	._dmamap_sync_post = _bus_dmamap_sync



CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32

2013-01-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 16 22:44:18 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [matt-nb6-plus]: bus_dma.c

Log Message:
Pullup from HEAD:
On Cortex, speculative loads can cache lines to be populated after then they've
been invalidated for a DMA read.  So after the DMA read we have to reinvalidate
them again.  We have to both invalidates since the former prevents dirty lines
overwriting just DMAed data.


To generate a diff of this commit:
cvs rdiff -u -r1.54.10.1 -r1.54.10.2 src/sys/arch/arm/arm32/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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.54.10.1 src/sys/arch/arm/arm32/bus_dma.c:1.54.10.2
--- src/sys/arch/arm/arm32/bus_dma.c:1.54.10.1	Wed Nov 28 22:40:17 2012
+++ src/sys/arch/arm/arm32/bus_dma.c	Wed Jan 16 22:44:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.54.10.1 2012/11/28 22:40:17 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.54.10.2 2013/01/16 22:44:18 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.1 2012/11/28 22:40:17 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.2 2013/01/16 22:44:18 matt Exp $");
 
 #include 
 #include 
@@ -758,6 +758,20 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 		cpu_dcache_wb_range(va, len);
 		cpu_sdcache_wb_range(va, pa, len);
 		break;
+
+#ifdef CPU_CORTEX
+	/*
+	 * Cortex CPUs can do speculative loads so we need to clean the cache
+	 * after a DMA read to deal with any speculatively loaded cache lines.
+	 * Since these can't be dirty, we can just invalidate them and don't
+	 * have to worry about having to write back their contents.
+	 */
+	case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE:
+	case BUS_DMASYNC_POSTREAD:
+		cpu_dcache_inv_range(va, len);
+		cpu_sdcache_inv_range(va, pa, len);
+		break;
+#endif
 	}
 }
 
@@ -786,7 +800,7 @@ _bus_dmamap_sync_linear(bus_dma_tag_t t,
 
 		if ((ds->_ds_flags & _BUS_DMAMAP_COHERENT) == 0)
 			_bus_dmamap_sync_segment(va + offset, pa, seglen, ops,
-			 false);
+			false);
 
 		offset += seglen;
 		len -= seglen;
@@ -935,7 +949,9 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	 *	we are doing a PREREAD|PREWRITE, we can collapse
 	 *	the whole thing into a single Wb-Inv.
 	 *
-	 *	POSTREAD -- Nothing.
+	 *	POSTREAD -- Re-invalidate the D-cache in case speculative
+	 *	memory accesses caused cachelines to become valid with now
+	 *	invalid data.
 	 *
 	 *	POSTWRITE -- Nothing.
 	 */
@@ -946,7 +962,12 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 #endif
 
 	const int pre_ops = ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
-	if (!bouncing && pre_ops == 0) {
+#ifdef CPU_CORTEX
+	const int post_ops = ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+#else
+	const int post_ops = 0;
+#endif
+	if (!bouncing && pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) {
 		return;
 	}
 



CVS commit: [matt-nb6-plus] src/sys/arch/arm/broadcom

2012-12-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec  7 22:47:13 UTC 2012

Modified Files:
src/sys/arch/arm/broadcom [matt-nb6-plus]: bcm53xx_eth.c files.bcm53xx

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.17.2.2 -r1.17.2.3 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/arch/arm/broadcom/files.bcm53xx

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/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.17.2.2 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.17.2.3
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.17.2.2	Wed Nov 28 22:40:22 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Fri Dec  7 22:47:13 2012
@@ -31,10 +31,11 @@
 #define GMAC_PRIVATE
 
 #include "locators.h"
+#include "opt_broadcom.h"
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.17.2.2 2012/11/28 22:40:22 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.17.2.3 2012/12/07 22:47:13 matt Exp $");
 
 #include 
 #include 
@@ -63,6 +64,13 @@ __KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.
 
 //#define BCMETH_MPSAFE
 
+#ifdef BCMETH_COUNTERS
+#define	BCMETH_EVCNT_ADD(a,b)	((void)((a).ev_count += (b)))
+#else
+#define	BCMETH_EVCNT_ADD(a,b)	do { } while (/*CONSTCOND*/0)
+#endif
+#define	BCMETH_EVCNT_INCR(a)	BCMETH_EVCNT_ADD((a), 1)
+
 #define	BCMETH_RCVOFFSET	10
 #define	BCMETH_MAXTXMBUFS	128
 #define	BCMETH_NTXSEGS		30
@@ -148,12 +156,14 @@ struct bcmeth_softc {
 #define	SOFT_RXINTR		0x01
 #define	SOFT_TXINTR		0x02
 
+#ifdef BCMETH_COUNTERS
 	struct evcnt sc_ev_intr;
 	struct evcnt sc_ev_soft_intr;
 	struct evcnt sc_ev_work;
 	struct evcnt sc_ev_tx_stall;
 	struct evcnt sc_ev_rx_badmagic_lo;
 	struct evcnt sc_ev_rx_badmagic_hi;
+#endif
 
 	struct ifqueue sc_rx_bufcache;
 	struct bcmeth_mapcache *sc_rx_mapcache; 
@@ -386,6 +396,7 @@ bcmeth_ccb_attach(device_t parent, devic
 	if_attach(ifp);
 	ether_ifattach(ifp, sc->sc_enaddr);
 
+#ifdef BCMETH_COUNTERS
 	evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR,
 	NULL, xname, "intr");
 	evcnt_attach_dynamic(&sc->sc_ev_soft_intr, EVCNT_TYPE_INTR,
@@ -398,6 +409,7 @@ bcmeth_ccb_attach(device_t parent, devic
 	NULL, xname, "rx badmagic lo");
 	evcnt_attach_dynamic(&sc->sc_ev_rx_badmagic_hi, EVCNT_TYPE_MISC,
 	NULL, xname, "rx badmagic hi");
+#endif
 }
 
 static int
@@ -1056,9 +1068,9 @@ bcmeth_rxq_consume(
 		if (rxsts == BCMETH_RCVMAGIC) {	
 			ifp->if_ierrors++;
 			if ((m->m_ext.ext_paddr >> 28) == 8) {
-sc->sc_ev_rx_badmagic_lo.ev_count++;
+BCMETH_EVCNT_INCR(sc->sc_ev_rx_badmagic_lo);
 			} else {
-sc->sc_ev_rx_badmagic_hi.ev_count++;
+BCMETH_EVCNT_INCR( sc->sc_ev_rx_badmagic_hi);
 			}
 			IF_ENQUEUE(&sc->sc_rx_bufcache, m);
 		} else
@@ -1709,7 +1721,7 @@ bcmeth_intr(void *arg)
 	mutex_enter(sc->sc_hwlock);
 
 	uint32_t intmask = sc->sc_intmask;
-	sc->sc_ev_intr.ev_count++;
+	BCMETH_EVCNT_INCR(sc->sc_ev_intr);
 
 	for (;;) {
 		uint32_t intstatus = bcmeth_read_4(sc, GMAC_INTSTATUS);
@@ -1821,7 +1833,7 @@ bcmeth_soft_txintr(struct bcmeth_softc *
 	 */
 	if (!bcmeth_txq_consume(sc, &sc->sc_txq)
 	|| !bcmeth_txq_enqueue(sc, &sc->sc_txq)) {
-		sc->sc_ev_tx_stall.ev_count++;
+		BCMETH_EVCNT_INCR(sc->sc_ev_tx_stall);
 		sc->sc_if.if_flags |= IFF_OACTIVE;
 	} else {
 		sc->sc_if.if_flags &= ~IFF_OACTIVE;
@@ -1847,7 +1859,7 @@ bcmeth_soft_intr(void *arg)
 
 	u_int soft_flags = atomic_swap_uint(&sc->sc_soft_flags, 0);
 
-	sc->sc_ev_soft_intr.ev_count++;
+	BCMETH_EVCNT_INCR(sc->sc_ev_soft_intr);
 
 	if ((soft_flags & SOFT_TXINTR)
 	|| bcmeth_txq_active_p(sc, &sc->sc_txq)) {
@@ -1857,7 +1869,7 @@ bcmeth_soft_intr(void *arg)
 		 */
 		if (!bcmeth_txq_consume(sc, &sc->sc_txq)
 		|| !bcmeth_txq_enqueue(sc, &sc->sc_txq)) {
-			sc->sc_ev_tx_stall.ev_count++;
+			BCMETH_EVCNT_INCR(sc->sc_ev_tx_stall);
 			ifp->if_flags |= IFF_OACTIVE;
 		} else {
 			ifp->if_flags &= ~IFF_OACTIVE;
@@ -1893,7 +1905,7 @@ bcmeth_worker(struct work *wk, void *arg
 
 	mutex_enter(sc->sc_lock);
 
-	sc->sc_ev_work.ev_count++;
+	BCMETH_EVCNT_INCR(sc->sc_ev_work);
 
 	uint32_t work_flags = atomic_swap_32(&sc->sc_work_flags, 0);
 	if (work_flags & WORK_REINIT) {

Index: src/sys/arch/arm/broadcom/files.bcm53xx
diff -u src/sys/arch/arm/broadcom/files.bcm53xx:1.2.4.2 src/sys/arch/arm/broadcom/files.bcm53xx:1.2.4.3
--- src/sys/arch/arm/broadcom/files.bcm53xx:1.2.4.2	Wed Nov 28 22:40:24 2012
+++ src/sys/arch/arm/broadcom/files.bcm53xx	Fri Dec  7 22:47:13 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.bcm53xx,v 1.2.4.2 2012/11/28 22:40:24 matt Exp $
+#	$NetBSD: files.bcm53xx,v 1.2.4.3 2012/12/07 22:47:13 matt Exp $
 #
 # Configuration info for Broadcom BCM5301X ARM Peripherals
 #
@@ -20,6 +20,7 @@ defparam opt_broadcom.hCONSPEED
 defparam opt_broadcom.hCONMODE
 defparam opt_broadcom.hMEMSIZE
 defflag opt_broadcom.hBCM53XX_CONSOLE_EARLY
+defflag opt_broadcom.hBCMET

CVS commit: [matt-nb6-plus] src/sys/arch/evbarm/bcm53xx

2012-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec  7 00:00:20 UTC 2012

Modified Files:
src/sys/arch/evbarm/bcm53xx [matt-nb6-plus]: bcm53xx_start.S

Log Message:
After calling a9_mpstart make sure cps is set to SVC32


To generate a diff of this commit:
cvs rdiff -u -r1.4.4.2 -r1.4.4.3 src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S

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/evbarm/bcm53xx/bcm53xx_start.S
diff -u src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S:1.4.4.2 src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S:1.4.4.3
--- src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S:1.4.4.2	Wed Nov 28 22:50:03 2012
+++ src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S	Fri Dec  7 00:00:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_start.S,v 1.4.4.2 2012/11/28 22:50:03 matt Exp $	*/
+/*	$NetBSD: bcm53xx_start.S,v 1.4.4.3 2012/12/07 00:00:20 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -45,7 +45,7 @@
 #define	CONADDR		0x18000300
 #endif
 
-RCSID("$NetBSD: bcm53xx_start.S,v 1.4.4.2 2012/11/28 22:50:03 matt Exp $")
+RCSID("$NetBSD: bcm53xx_start.S,v 1.4.4.3 2012/12/07 00:00:20 matt Exp $")
 
 #undef VERBOSE_INIT_ARM
 #define VERBOSE_INIT_ARM
@@ -83,6 +83,7 @@ _C_LABEL(bcm53xx_start):
 	 * Cal the initial start code for the a9
 	 */
 	bl	a9_start
+	cps	#PSR_SVC32_MODE
 
 	/*
 	 * Set up a preliminary mapping in the MMU to allow us to run



CVS commit: [matt-nb6-plus] src/sys/conf

2012-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  6 18:01:22 UTC 2012

Modified Files:
src/sys/conf [matt-nb6-plus]: files

Log Message:
Don't enable KERN_SA for COMPAT_40


To generate a diff of this commit:
cvs rdiff -u -r1.1043.2.1 -r1.1043.2.1.2.1 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1043.2.1 src/sys/conf/files:1.1043.2.1.2.1
--- src/sys/conf/files:1.1043.2.1	Mon Jul  2 18:01:16 2012
+++ src/sys/conf/files	Thu Dec  6 18:01:21 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1043.2.1 2012/07/02 18:01:16 jdc Exp $
+#	$NetBSD: files,v 1.1043.2.1.2.1 2012/12/06 18:01:21 matt Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -126,7 +126,7 @@ defparam opt_wapbl.h		WAPBL_DEBUG_PRINT
 defflag	opt_sa.h		KERN_SA
 defflag opt_compat_netbsd.h	COMPAT_NETBSD
 defflag	opt_compat_netbsd.h	COMPAT_50: COMPAT_NETBSD
-defflag	opt_compat_netbsd.h	COMPAT_40: COMPAT_50, KERN_SA, COMPAT_NETBSD
+defflag	opt_compat_netbsd.h	COMPAT_40: COMPAT_50, COMPAT_NETBSD
 defflag	opt_compat_netbsd.h	COMPAT_30: COMPAT_40, COMPAT_NETBSD
 defflag	opt_compat_netbsd.h	COMPAT_20: COMPAT_30, COMPAT_NETBSD
 defflag	opt_compat_netbsd.h	COMPAT_16: COMPAT_20, COMPAT_NETBSD



CVS commit: [matt-nb6-plus] src/sys/arch

2012-12-06 Thread Matt Thomas
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 
 
@@ -90,4 

CVS commit: [matt-nb6-plus] src/sys/rump/librump/rumpkern

2012-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  6 17:20:26 UTC 2012

Modified Files:
src/sys/rump/librump/rumpkern [matt-nb6-plus]: Makefile.rumpkern

Log Message:
Only add atomic_cas_generic.c to SRCS if there isn't already some
atomic_cas_* already in SRCS.


To generate a diff of this commit:
cvs rdiff -u -r1.115.2.1 -r1.115.2.1.2.1 \
src/sys/rump/librump/rumpkern/Makefile.rumpkern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.115.2.1 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.115.2.1.2.1
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.115.2.1	Tue Jun 26 14:49:09 2012
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Thu Dec  6 17:20:26 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.115.2.1 2012/06/26 14:49:09 riz Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.115.2.1.2.1 2012/12/06 17:20:26 matt Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -194,10 +194,12 @@ KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
 .if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \
 || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
 || ${MACHINE_CPU} == "vax" || ${MACHINE_ARCH} == "m68000"
+.if ${SRCS:Matomic_cas_*} == ""
 CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
 SRCS+=		atomic_cas_generic.c
 #SRCS+=		rump_atomic_cas_up.c
 .endif
+.endif
 
 .include 
 .include 



CVS commit: [matt-nb6-plus] src/sys/arch/evbarm/stand

2012-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  6 17:14:24 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440 [matt-nb6-plus]: Makefile
src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014 
[matt-nb6-plus]:
Makefile
src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160 [matt-nb6-plus]:
Makefile
src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008 
[matt-nb6-plus]:
Makefile
src/sys/arch/evbarm/stand/gzboot/IQ80321_flash_0xf008 
[matt-nb6-plus]:
Makefile
src/sys/arch/evbarm/stand/gzboot/TS7200_flash_0x6066 
[matt-nb6-plus]:
Makefile

Log Message:
Hardcode CPUFLAGS appropriately so that these are always built for the correct
cpu/architecture.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/arch/evbarm/stand/boot2440/Makefile
cvs rdiff -u -r1.2 -r1.2.150.1 \
src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014/Makefile
cvs rdiff -u -r1.2 -r1.2.30.1 \
src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160/Makefile
cvs rdiff -u -r1.3 -r1.3.150.1 \
src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008/Makefile
cvs rdiff -u -r1.3 -r1.3.150.1 \
src/sys/arch/evbarm/stand/gzboot/IQ80321_flash_0xf008/Makefile
cvs rdiff -u -r1.2 -r1.2.120.1 \
src/sys/arch/evbarm/stand/gzboot/TS7200_flash_0x6066/Makefile

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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.2 src/sys/arch/evbarm/stand/boot2440/Makefile:1.2.4.1
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.2	Tue Jan 31 11:04:17 2012
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Thu Dec  6 17:14:23 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2012/01/31 11:04:17 nisimura Exp $
+#	$NetBSD: Makefile,v 1.2.4.1 2012/12/06 17:14:23 matt Exp $
 
 S=		${.CURDIR}/../../../..
 PROG=		bootmini2440
@@ -8,7 +8,8 @@ SRCS+=		s3csdi.c vers.c
 .include 
 
 CLEANFILES+=	vers.c ${PROG}.elf
-CFLAGS+=	-Wall -Wno-main -ffreestanding -march=armv4
+CFLAGS+=	-Wall -Wno-main -ffreestanding
+CPUFLAGS=	-march=armv4
 CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP 
 CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0x18,0x12,0x27" 
 CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"

Index: src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014/Makefile
diff -u src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014/Makefile:1.2 src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014/Makefile:1.2.150.1
--- src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014/Makefile:1.2	Tue Apr 29 05:36:20 2003
+++ src/sys/arch/evbarm/stand/gzboot/ADI_BRH_flash_0x0014/Makefile	Thu Dec  6 17:14:23 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2003/04/29 05:36:20 thorpej Exp $
+#	$NetBSD: Makefile,v 1.2.150.1 2012/12/06 17:14:23 matt Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -11,6 +11,7 @@ CPPFLAGS+= -DBECC_SUPPORT_V7
 CPPFLAGS+= -DCONSPEED=57600
 CPPFLAGS+= -DCONADDR=0x0300UL
 CPPFLAGS+= -DNS16550_FREQ=3330
+CPUFLAGS= -mcpu=xscale
 
 LDSCRIPT= ${.CURDIR}/ldscript
 

Index: src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160/Makefile
diff -u src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160/Makefile:1.2 src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160/Makefile:1.2.30.1
--- src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160/Makefile:1.2	Mon Nov 10 20:30:12 2008
+++ src/sys/arch/evbarm/stand/gzboot/GEMINI_dram_0x0160/Makefile	Thu Dec  6 17:14:23 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2008/11/10 20:30:12 cliff Exp $
+#	$NetBSD: Makefile,v 1.2.30.1 2012/12/06 17:14:23 matt Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -11,6 +11,7 @@ CPPFLAGS+= -DCONSPEED=19200
 CPPFLAGS+= -DCONADDR=0x4200UL
 CPPFLAGS+= -DNS16550_AX4
 CPPFLAGS+= -DNS16550_FREQ=4800
+CPUFLAGS= -march=armv4
 
 LDSCRIPT= ${.CURDIR}/ldscript
 

Index: src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008/Makefile
diff -u src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008/Makefile:1.3 src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008/Makefile:1.3.150.1
--- src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008/Makefile:1.3	Tue Apr 29 05:38:52 2003
+++ src/sys/arch/evbarm/stand/gzboot/IQ80310_flash_0x0008/Makefile	Thu Dec  6 17:14:23 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2003/04/29 05:38:52 thorpej Exp $
+#	$NetBSD: Makefile,v 1.3.150.1 2012/12/06 17:14:23 matt Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -9,6 +9,7 @@ LOADADDR= 0xa020
 
 CPPFLAGS+= -DCONSPEED=115200
 CPPFLAGS+= -DCONADDR=0xfe81UL
+CPUFLAGS= -mcpu=xscale
 
 LDSCRIPT= ${.CURDIR}/ldscript
 

Index: src/sys/arch/evbarm/stand/gzboot/IQ80321_flash_0xf008/Makefile
diff -u src/sys/arch/evbarm/stand/gzboot/IQ80321_flash_0xf008/Makefile:1.3 src/sys/arch/evbarm/stand/gzboot/IQ80321_flash_0xf008/Makefile:1

CVS commit: [matt-nb6-plus] src/sys/lib/libkern

2012-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  6 17:13:31 UTC 2012

Modified Files:
src/sys/lib/libkern [matt-nb6-plus]: Makefile.inc

Log Message:
Don't pass CPUFLAGS down since its value is in CFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.118.1 src/sys/lib/libkern/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/Makefile.inc
diff -u src/sys/lib/libkern/Makefile.inc:1.40 src/sys/lib/libkern/Makefile.inc:1.40.118.1
--- src/sys/lib/libkern/Makefile.inc:1.40	Tue Dec 20 19:35:26 2005
+++ src/sys/lib/libkern/Makefile.inc	Thu Dec  6 17:13:31 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.40 2005/12/20 19:35:26 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.40.118.1 2012/12/06 17:13:31 matt Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -42,6 +42,7 @@ KERNMAKE= \
 	TSORT=${TSORT:Q} \
 	LD=${LD:Q} STRIP=${STRIP:Q} \
 	AR=${AR:Q} NM=${NM:Q} \
+	CPUFLAGS= \
 	RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
 	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
 	KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:Q} \



CVS commit: [matt-nb6-plus] src/sys/kern

2012-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  6 16:07:21 UTC 2012

Modified Files:
src/sys/kern [matt-nb6-plus]: sys_generic.c

Log Message:
Make sure ioctl stkbuf has a minimal alignment of (__ALIGNBYTES+1)


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.128.4.1 src/sys/kern/sys_generic.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/kern/sys_generic.c
diff -u src/sys/kern/sys_generic.c:1.128 src/sys/kern/sys_generic.c:1.128.4.1
--- src/sys/kern/sys_generic.c:1.128	Wed Jan 25 00:28:36 2012
+++ src/sys/kern/sys_generic.c	Thu Dec  6 16:07:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_generic.c,v 1.128 2012/01/25 00:28:36 christos Exp $	*/
+/*	$NetBSD: sys_generic.c,v 1.128.4.1 2012/12/06 16:07:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.128 2012/01/25 00:28:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.128.4.1 2012/12/06 16:07:21 matt Exp $");
 
 #include 
 #include 
@@ -525,7 +525,7 @@ sys_ioctl(struct lwp *l, const struct sy
 	size_t		size, alloc_size;
 	void 		*data, *memp;
 #define	STK_PARAMS	128
-	u_long		stkbuf[STK_PARAMS/sizeof(u_long)];
+	u_long		stkbuf[STK_PARAMS/sizeof(u_long)] __aligned(__ALIGNBYTES+1);
 
 	memp = NULL;
 	alloc_size = 0;



CVS commit: [matt-nb6-plus] src/sys/conf

2012-12-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec  4 07:00:31 UTC 2012

Modified Files:
src/sys/conf [matt-nb6-plus]: Makefile.kern.inc

Log Message:
Add SYSTEM_LD_TAIL_DBSYM for arm.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.152.4.1 src/sys/conf/Makefile.kern.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.152 src/sys/conf/Makefile.kern.inc:1.152.4.1
--- src/sys/conf/Makefile.kern.inc:1.152	Sun Feb 12 16:34:11 2012
+++ src/sys/conf/Makefile.kern.inc	Tue Dec  4 07:00:30 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.152 2012/02/12 16:34:11 matt Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.152.4.1 2012/12/04 07:00:30 matt Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -236,6 +236,7 @@ SYSTEM_LD?=	@${_MKSHMSG} "   link  ${.CU
 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
 		${SIZE} $@; chmod 755 $@; \
 		${SYSTEM_CTFMERGE}
+SYSTEM_LD_TAIL_DBSYM?=  true
 
 TEXTADDR?=	${LOADADDRESS}			# backwards compatibility
 LINKTEXT?=	${TEXTADDR:C/.+/-Ttext &/}



CVS commit: [matt-nb6-plus] src/sys/dev/ic

2012-12-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Dec  3 22:00:53 UTC 2012

Modified Files:
src/sys/dev/ic [matt-nb6-plus]: ahcisata_core.c

Log Message:
Pullup changes in rev 1.44.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/dev/ic/ahcisata_core.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/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.33 src/sys/dev/ic/ahcisata_core.c:1.33.4.1
--- src/sys/dev/ic/ahcisata_core.c:1.33	Tue Jan 10 01:43:05 2012
+++ src/sys/dev/ic/ahcisata_core.c	Mon Dec  3 22:00:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.33 2012/01/10 01:43:05 jakllsch Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.33.4.1 2012/12/03 22:00:53 matt Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.33 2012/01/10 01:43:05 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.33.4.1 2012/12/03 22:00:53 matt Exp $");
 
 #include 
 #include 
@@ -686,11 +686,12 @@ ahci_probe_drive(struct ata_channel *chp
 		splx(s);
 		/* clear port interrupt register */
 		AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0x);
+		
 		/* and enable interrupts */
 		AHCI_WRITE(sc, AHCI_P_IE(chp->ch_channel),
 		AHCI_P_IX_TFES | AHCI_P_IX_HBFS | AHCI_P_IX_IFS |
 		AHCI_P_IX_OFS | AHCI_P_IX_DPS | AHCI_P_IX_UFS |
-		AHCI_P_IX_DHRS);
+		AHCI_P_IX_PSS | AHCI_P_IX_DHRS);
 		/* wait 500ms before actually starting operations */
 		tsleep(&sc, PRIBIO, "ahciprb", mstohz(500));
 		break;
@@ -769,8 +770,9 @@ ahci_cmd_start(struct ata_channel *chp, 
 	int i;
 	int channel = chp->ch_channel;
 
-	AHCIDEBUG_PRINT(("ahci_cmd_start CI 0x%x\n",
-	AHCI_READ(sc, AHCI_P_CI(chp->ch_channel))), DEBUG_XFERS);
+	AHCIDEBUG_PRINT(("ahci_cmd_start CI 0x%x timo %d\n",
+	AHCI_READ(sc, AHCI_P_CI(chp->ch_channel)), ata_c->timeout),
+	DEBUG_XFERS);
 
 	cmd_tbl = achp->ahcic_cmd_tbl[slot];
 	AHCIDEBUG_PRINT(("%s port %d tbl %p\n", AHCINAME(sc), chp->ch_channel,
@@ -912,18 +914,18 @@ ahci_cmd_done(struct ata_channel *chp, s
 	uint16_t *idwordbuf;
 	int i;
 
-	AHCIDEBUG_PRINT(("ahci_cmd_done channel %d\n", chp->ch_channel),
-	DEBUG_FUNCS);
+	AHCIDEBUG_PRINT(("ahci_cmd_done channel %d (status %#x) flags %#x/%#x\n",
+	chp->ch_channel, chp->ch_status, xfer->c_flags, ata_c->flags), DEBUG_FUNCS);
 
 	/* this comamnd is not active any more */
 	achp->ahcic_cmds_active &= ~(1 << slot);
 
 	if (ata_c->flags & (AT_READ|AT_WRITE) && ata_c->bcount > 0) {
-		bus_dmamap_sync(sc->sc_dmat, achp->ahcic_datad[slot], 0,
-		achp->ahcic_datad[slot]->dm_mapsize,
+		bus_dmamap_t map = achp->ahcic_datad[slot];
+		bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize,
 		(ata_c->flags & AT_READ) ? BUS_DMASYNC_POSTREAD :
 		BUS_DMASYNC_POSTWRITE);
-		bus_dmamap_unload(sc->sc_dmat, achp->ahcic_datad[slot]);
+		bus_dmamap_unload(sc->sc_dmat, map);
 	}
 
 	AHCI_CMDH_SYNC(sc, achp, slot,
@@ -1192,8 +1194,12 @@ ahci_timeout(void *v)
 {
 	struct ata_channel *chp = (struct ata_channel *)v;
 	struct ata_xfer *xfer = chp->ch_queue->active_xfer;
+#ifdef AHCI_DEBUG
+	struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac;
+#endif
 	int s = splbio();
-	AHCIDEBUG_PRINT(("ahci_timeout xfer %p\n", xfer), DEBUG_INTR);
+	AHCIDEBUG_PRINT(("ahci_timeout xfer %p intr %#x\n", xfer, AHCI_READ(sc, AHCI_P_IS(chp->ch_channel))), DEBUG_INTR);
+	
 	if ((chp->ch_flags & ATACH_IRQ_WAIT) != 0) {
 		xfer->c_flags |= C_TIMEOU;
 		xfer->c_intr(chp, xfer, 0);



CVS commit: [matt-nb6-plus] src/sys/arch/arm/broadcom

2012-11-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 29 18:42:06 UTC 2012

Modified Files:
src/sys/arch/arm/broadcom [matt-nb6-plus]: bcm53xx_reg.h bcm53xx_usb.c

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.10.2.2 -r1.10.2.3 src/sys/arch/arm/broadcom/bcm53xx_reg.h
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/arch/arm/broadcom/bcm53xx_usb.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/broadcom/bcm53xx_reg.h
diff -u src/sys/arch/arm/broadcom/bcm53xx_reg.h:1.10.2.2 src/sys/arch/arm/broadcom/bcm53xx_reg.h:1.10.2.3
--- src/sys/arch/arm/broadcom/bcm53xx_reg.h:1.10.2.2	Wed Nov 28 22:40:23 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_reg.h	Thu Nov 29 18:42:05 2012
@@ -658,6 +658,13 @@
 
 #endif /* IDM_PRIVATE */
 
+#ifdef USBH_PRIVATE
+#define	USBH_PHY_CTRL_P0		0x200
+#define	USBH_PHY_CTRL_P1		0x204
+
+#define	USBH_PHY_CTRL_INIT		0x3ff
+#endif
+
 #ifdef GMAC_PRIVATE
 
 struct gmac_txdb {

Index: src/sys/arch/arm/broadcom/bcm53xx_usb.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.2.4.2 src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.2.4.3
--- src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.2.4.2	Wed Nov 28 22:40:24 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_usb.c	Thu Nov 29 18:42:05 2012
@@ -26,12 +26,13 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#define USBH_PRIVATE
 
 #include "locators.h"
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_usb.c,v 1.2.4.2 2012/11/28 22:40:24 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_usb.c,v 1.2.4.3 2012/11/29 18:42:05 matt Exp $");
 
 #include 
 #include 
@@ -242,6 +243,14 @@ bcmusb_ccb_attach(device_t parent, devic
 	0x1000, &usbsc->usbsc_ohci_bsh);
 
 	/*
+	 * Bring the PHYs out of reset.
+	 */
+	bus_space_write_4(usbsc->usbsc_bst, usbsc->usbsc_ehci_bsh,
+	USBH_PHY_CTRL_P0, USBH_PHY_CTRL_INIT);
+	bus_space_write_4(usbsc->usbsc_bst, usbsc->usbsc_ehci_bsh,
+	USBH_PHY_CTRL_P1, USBH_PHY_CTRL_INIT);
+
+	/*
 	 * Disable interrupts
 	 */
 	bus_space_write_4(usbsc->usbsc_bst, usbsc->usbsc_ohci_bsh,



CVS commit: [matt-nb6-plus] src/sys/arch/arm/cortex

2012-11-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 29 18:33:41 UTC 2012

Modified Files:
src/sys/arch/arm/cortex [matt-nb6-plus]: a9tmr.c

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.3.4.2 -r1.3.4.3 src/sys/arch/arm/cortex/a9tmr.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/cortex/a9tmr.c
diff -u src/sys/arch/arm/cortex/a9tmr.c:1.3.4.2 src/sys/arch/arm/cortex/a9tmr.c:1.3.4.3
--- src/sys/arch/arm/cortex/a9tmr.c:1.3.4.2	Wed Nov 28 22:40:25 2012
+++ src/sys/arch/arm/cortex/a9tmr.c	Thu Nov 29 18:33:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9tmr.c,v 1.3.4.2 2012/11/28 22:40:25 matt Exp $	*/
+/*	$NetBSD: a9tmr.c,v 1.3.4.3 2012/11/29 18:33:41 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.3.4.2 2012/11/28 22:40:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.3.4.3 2012/11/29 18:33:41 matt Exp $");
 
 #include 
 #include 
@@ -196,7 +196,7 @@ a9tmr_init_cpu_clock(struct cpu_info *ci
 	 * Re-enable the comparator and now enable interrupts.
 	 */
 	a9tmr_global_write(sc, TMR_GBL_INT, 1);	/* clear interrupt pending */
-	ctl |= TMR_GBL_CTL_CMP_ENABLE | TMR_GBL_CTL_INT_ENABLE | TMR_GBL_CTL_AUTO_INC;
+	ctl |= TMR_GBL_CTL_CMP_ENABLE | TMR_GBL_CTL_INT_ENABLE | TMR_GBL_CTL_AUTO_INC | TMR_CTL_ENABLE;
 	a9tmr_global_write(sc, TMR_GBL_CTL, ctl);
 #if 0
 	printf("%s: %s: ctl %#x autoinc %u cmp %#x%08x now %#"PRIx64"\n",



CVS commit: [matt-nb6-plus] src/sys/compat/linux/arch/arm

2012-11-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 29 16:31:01 UTC 2012

Modified Files:
src/sys/compat/linux/arch/arm [matt-nb6-plus]: linux_machdep.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.16.1 src/sys/compat/linux/arch/arm/linux_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/compat/linux/arch/arm/linux_machdep.c
diff -u src/sys/compat/linux/arch/arm/linux_machdep.c:1.29 src/sys/compat/linux/arch/arm/linux_machdep.c:1.29.16.1
--- src/sys/compat/linux/arch/arm/linux_machdep.c:1.29	Wed Jul  7 01:30:33 2010
+++ src/sys/compat/linux/arch/arm/linux_machdep.c	Thu Nov 29 16:31:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.29 2010/07/07 01:30:33 chs Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.29.16.1 2012/11/29 16:31:01 matt Exp $	*/
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.29 2010/07/07 01:30:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.29.16.1 2012/11/29 16:31:01 matt Exp $");
 
 #include 
 #include 
@@ -76,15 +76,14 @@ linux_setregs(struct lwp *l, struct exec
 void
 linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
 {
-	struct lwp *l = curlwp;
-	struct proc *p = l->l_proc;
-	struct trapframe *tf;
+	struct lwp * const l = curlwp;
+	struct proc * const p = l->l_proc;
+	struct trapframe * const tf = lwp_trapframe(l);
 	struct linux_sigframe *fp, frame;
 	int onstack, error;
 	const int sig = ksi->ksi_signo;
 	sig_t catcher = SIGACTION(p, sig).sa_handler;
 
-	tf = process_frame(l);
 
 	/*
 	 * The Linux version of this code is in
@@ -195,13 +194,11 @@ int
 linux_sys_sigreturn(struct lwp *l, const struct linux_sys_sigreturn_args *v,
 	register_t *retval)
 {
+	struct trapframe * const tf = lwp_trapframe(l);
+	struct proc * const p = l->l_proc;
 	struct linux_sigframe *sfp, frame;
-	struct proc *p = l->l_proc;
-	struct trapframe *tf;
 	sigset_t mask;
 
-	tf = process_frame(l);
-
 	/*
 	 * The trampoline code hands us the context.
 	 * It is unsafe to keep track of it ourselves, in the event that a
@@ -219,7 +216,6 @@ linux_sys_sigreturn(struct lwp *l, const
 		return EINVAL;
 
 	/* Restore register context. */
-	tf = process_frame(l);
 	tf->tf_r0= frame.sf_sc.sc_r0;
 	tf->tf_r1= frame.sf_sc.sc_r1;
 	tf->tf_r2= frame.sf_sc.sc_r2;



CVS commit: [matt-nb6-plus] src/sys

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:59:09 UTC 2012

Modified Files:
src/sys/kern [matt-nb6-plus]: kern_kthread.c
src/sys/uvm [matt-nb6-plus]: uvm_extern.h uvm_glue.c

Log Message:
Pull from HEAD:
Add a __HAVE_CPU_UAREA_IDLELWP hook so that the MD code can allocate
special UAREAs for idle lwp's.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.10.1 src/sys/kern/kern_kthread.c
cvs rdiff -u -r1.181.2.1 -r1.181.2.1.2.1 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.156.2.3 -r1.156.2.3.2.1 src/sys/uvm/uvm_glue.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/kern/kern_kthread.c
diff -u src/sys/kern/kern_kthread.c:1.38 src/sys/kern/kern_kthread.c:1.38.10.1
--- src/sys/kern/kern_kthread.c:1.38	Tue Nov  1 15:39:37 2011
+++ src/sys/kern/kern_kthread.c	Wed Nov 28 22:59:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_kthread.c,v 1.38 2011/11/01 15:39:37 jym Exp $	*/
+/*	$NetBSD: kern_kthread.c,v 1.38.10.1 2012/11/28 22:59:09 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.38 2011/11/01 15:39:37 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.38.10.1 2012/11/28 22:59:09 matt Exp $");
 
 #include 
 #include 
@@ -70,7 +70,8 @@ kthread_create(pri_t pri, int flag, stru
 
 	KASSERT((flag & KTHREAD_INTR) == 0 || (flag & KTHREAD_MPSAFE) != 0);
 
-	uaddr = uvm_uarea_system_alloc();
+	uaddr = uvm_uarea_system_alloc(
+	   (flag & (KTHREAD_INTR|KTHREAD_IDLE)) == KTHREAD_IDLE ? ci : NULL);
 	if (uaddr == 0) {
 		return ENOMEM;
 	}

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.181.2.1 src/sys/uvm/uvm_extern.h:1.181.2.1.2.1
--- src/sys/uvm/uvm_extern.h:1.181.2.1	Thu Apr 12 17:05:37 2012
+++ src/sys/uvm/uvm_extern.h	Wed Nov 28 22:59:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.181.2.1 2012/04/12 17:05:37 riz Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.181.2.1.2.1 2012/11/28 22:59:09 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -611,7 +611,7 @@ bool			uvm_kernacc(void *, size_t, vm_pr
 __dead void		uvm_scheduler(void);
 vaddr_t			uvm_uarea_alloc(void);
 void			uvm_uarea_free(vaddr_t);
-vaddr_t			uvm_uarea_system_alloc(void);
+vaddr_t			uvm_uarea_system_alloc(struct cpu_info *);
 void			uvm_uarea_system_free(vaddr_t);
 vaddr_t			uvm_lwp_getuarea(lwp_t *);
 void			uvm_lwp_setuarea(lwp_t *, vaddr_t);

Index: src/sys/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.156.2.3 src/sys/uvm/uvm_glue.c:1.156.2.3.2.1
--- src/sys/uvm/uvm_glue.c:1.156.2.3	Thu Apr 12 17:05:37 2012
+++ src/sys/uvm/uvm_glue.c	Wed Nov 28 22:59:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.156.2.3 2012/04/12 17:05:37 riz Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.156.2.3.2.1 2012/11/28 22:59:09 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.156.2.3 2012/04/12 17:05:37 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.156.2.3.2.1 2012/11/28 22:59:09 matt Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -366,8 +366,12 @@ uvm_uarea_alloc(void)
 }
 
 vaddr_t
-uvm_uarea_system_alloc(void)
+uvm_uarea_system_alloc(struct cpu_info *ci)
 {
+#ifdef __HAVE_CPU_UAREA_ALLOC_IDLELWP
+	if (__predict_false(ci != NULL))
+		return cpu_uarea_alloc_idlelwp(ci);
+#endif
 
 	return (vaddr_t)pool_cache_get(uvm_uarea_system_cache, PR_WAITOK);
 }



CVS commit: [matt-nb6-plus] src/sys/sys

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:52:53 UTC 2012

Modified Files:
src/sys/sys [matt-nb6-plus]: lwp.h

Log Message:
Pulled from HEAD:
Don't give a boost to system threads.


To generate a diff of this commit:
cvs rdiff -u -r1.159.2.1.2.1 -r1.159.2.1.2.2 src/sys/sys/lwp.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/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.159.2.1.2.1 src/sys/sys/lwp.h:1.159.2.1.2.2
--- src/sys/sys/lwp.h:1.159.2.1.2.1	Thu Nov  1 16:45:04 2012
+++ src/sys/sys/lwp.h	Wed Nov 28 22:52:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.159.2.1.2.1 2012/11/01 16:45:04 matt Exp $	*/
+/*	$NetBSD: lwp.h,v 1.159.2.1.2.2 2012/11/28 22:52:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -416,7 +416,7 @@ lwp_eprio(lwp_t *l)
 	pri_t pri;
 
 	pri = l->l_priority;
-	if (l->l_kpriority && pri < PRI_KERNEL)
+	if ((l->l_flag & LW_SYSTEM) == 0 && l->l_kpriority && pri < PRI_KERNEL)
 		pri = (pri >> 1) + l->l_kpribase;
 	return MAX(l->l_inheritedprio, pri);
 }



CVS commit: [matt-nb6-plus] src/sys/arch/arm/include

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:45:22 UTC 2012

Modified Files:
src/sys/arch/arm/include [matt-nb6-plus]: lock.h types.h

Log Message:
Make __swp for the kernel return unsigned char and restore __cpu_simple_lock_t
(match what -HEAD has).


To generate a diff of this commit:
cvs rdiff -u -r1.17.42.1 -r1.17.42.2 src/sys/arch/arm/include/lock.h
cvs rdiff -u -r1.21.8.1 -r1.21.8.2 src/sys/arch/arm/include/types.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/arch/arm/include/lock.h
diff -u src/sys/arch/arm/include/lock.h:1.17.42.1 src/sys/arch/arm/include/lock.h:1.17.42.2
--- src/sys/arch/arm/include/lock.h:1.17.42.1	Wed Nov 28 22:40:29 2012
+++ src/sys/arch/arm/include/lock.h	Wed Nov 28 22:45:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.17.42.1 2012/11/28 22:40:29 matt Exp $	*/
+/*	$NetBSD: lock.h,v 1.17.42.2 2012/11/28 22:45:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@ __cpu_simple_lock_set(__cpu_simple_lock_
 #endif
 
 #if defined(_KERNEL)
-static __inline __cpu_simple_lock_t
+static __inline unsigned char
 __swp(__cpu_simple_lock_t __val, volatile __cpu_simple_lock_t *__ptr)
 {
 #ifdef _ARM_ARCH_6

Index: src/sys/arch/arm/include/types.h
diff -u src/sys/arch/arm/include/types.h:1.21.8.1 src/sys/arch/arm/include/types.h:1.21.8.2
--- src/sys/arch/arm/include/types.h:1.21.8.1	Wed Nov 28 22:40:30 2012
+++ src/sys/arch/arm/include/types.h	Wed Nov 28 22:45:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.21.8.1 2012/11/28 22:40:30 matt Exp $	*/
+/*	$NetBSD: types.h,v 1.21.8.2 2012/11/28 22:45:22 matt Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -73,17 +73,9 @@ typedef unsigned long	pmc_ctr_t;
  * to user-space, we don't want ABI breakage there.
  */
 #if defined(_KERNEL)
-typedef 
-#if __GNUC_PREREQ__(4,5)
-	volatile
-#endif
-	unsigned char	__cpu_simple_lock_t;
+typedef volatile unsigned char	__cpu_simple_lock_t;
 #else
-typedef
-#if __GNUC_PREREQ__(4,5)
-	volatile
-#endif
-	int		__cpu_simple_lock_t;
+typedef volatile int		__cpu_simple_lock_t;
 #endif /* _KERNEL */
 
 #define	__SIMPLELOCK_LOCKED	1



CVS commit: [matt-nb6-plus] src/sys/dev/pci

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:31:49 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb6-plus]: pcireg.h

Log Message:
Add LCSR definitions and NVM storage subclass.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.10.1 src/sys/dev/pci/pcireg.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/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.73 src/sys/dev/pci/pcireg.h:1.73.10.1
--- src/sys/dev/pci/pcireg.h:1.73	Wed Aug 17 00:59:47 2011
+++ src/sys/dev/pci/pcireg.h	Wed Nov 28 22:31:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.73 2011/08/17 00:59:47 dyoung Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.73.10.1 2012/11/28 22:31:47 matt Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -179,6 +179,7 @@ typedef u_int8_t pci_revision_t;
 #define	PCI_SUBCLASS_MASS_STORAGE_ATA		0x05
 #define	PCI_SUBCLASS_MASS_STORAGE_SATA		0x06
 #define	PCI_SUBCLASS_MASS_STORAGE_SAS		0x07
+#define	PCI_SUBCLASS_MASS_STORAGE_NVM		0x08
 #define	PCI_SUBCLASS_MASS_STORAGE_MISC		0x80
 
 /* 0x02 network subclasses */
@@ -656,6 +657,17 @@ struct pci_msix_table_entry {
 #define PCI_PCIE_LCSR		0x10	/* Link Control & Status Register */
 #define PCI_PCIE_LCSR_ASPM_L0S	__BIT(0)
 #define PCI_PCIE_LCSR_ASPM_L1	__BIT(1)
+#define PCI_PCIE_LCSR_RCB	__BIT(3)
+#define PCI_PCIE_LCSR_LINK_DIS	__BIT(4)
+#define PCI_PCIE_LCSR_RETRAIN	__BIT(5)
+#define PCI_PCIE_LCSR_COMCLKCFG	__BIT(6)
+#define PCI_PCIE_LCSR_EXTNDSYNC	__BIT(7)
+#define PCI_PCIE_LCSR_ENCLKPM	__BIT(8)
+#define	PCI_PCIE_LCSR_LINKSPEED	__BITS(19,16)
+#define	PCI_PCIE_LCSR_NLW	__BITS(25,20)
+#define	PCI_PCIE_LCSR_LINKTRAIN	__BIT(27)
+#define	PCI_PCIE_LCSR_SLOTCLKCFG __BIT(28)
+#define	PCI_PCIE_LCSR_DLACTIVE	__BIT(29)
 #define PCI_PCIE_SLCAP		0x14	/* Slot Capabilities Register */
 #define PCI_PCIE_SLCAP_ABP	__BIT(0)	/* Attention Button Present */
 #define PCI_PCIE_SLCAP_PCP	__BIT(1)	/* Power Controller Present */



CVS commit: [matt-nb6-plus] src/sys/lib/libkern/arch/arm

2012-11-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 02:25:44 UTC 2012

Modified Files:
src/sys/lib/libkern/arch/arm [matt-nb6-plus]: Makefile.inc

Log Message:
Deal with div/mod changes.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.20.1 src/sys/lib/libkern/arch/arm/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.9 src/sys/lib/libkern/arch/arm/Makefile.inc:1.9.20.1
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.9	Fri Aug 14 19:23:53 2009
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Wed Nov 28 02:25:43 2012
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.9 2009/08/14 19:23:53 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.9.20.1 2012/11/28 02:25:43 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
-SRCS+=	divsi3.S clzsi2.S
+SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S
 SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S



CVS commit: [matt-nb6-plus] src/sys/arch/arm/include

2012-11-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 21 00:00:10 UTC 2012

Modified Files:
src/sys/arch/arm/include [matt-nb6-plus]: Makefile vfpreg.h
Added Files:
src/sys/arch/arm/include [matt-nb6-plus]: aeabi.h

Log Message:
Add aeabi.h, cpuconf.h, and vfpreg.h


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.10.1 src/sys/arch/arm/include/Makefile
cvs rdiff -u -r0 -r1.2.6.2 src/sys/arch/arm/include/aeabi.h
cvs rdiff -u -r1.1 -r1.1.56.1 src/sys/arch/arm/include/vfpreg.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/arch/arm/include/Makefile
diff -u src/sys/arch/arm/include/Makefile:1.40 src/sys/arch/arm/include/Makefile:1.40.10.1
--- src/sys/arch/arm/include/Makefile:1.40	Sun Jul 17 23:52:12 2011
+++ src/sys/arch/arm/include/Makefile	Wed Nov 21 00:00:10 2012
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.40 2011/07/17 23:52:12 dyoung Exp $
+#	$NetBSD: Makefile,v 1.40.10.1 2012/11/21 00:00:10 matt Exp $
 
 INCSDIR= /usr/include/arm
 
-INCS=	ansi.h aout_machdep.h armreg.h asm.h atomic.h \
+INCS=	aeabi.h ansi.h aout_machdep.h armreg.h asm.h atomic.h \
 	bswap.h byte_swap.h \
-	cdefs.h cpu.h \
+	cdefs.h cpu.h cpuconf.h \
 	disklabel.h \
 	elf_machdep.h endian.h endian_machdep.h \
 	float.h fp.h frame.h \
@@ -18,6 +18,7 @@ INCS=	ansi.h aout_machdep.h armreg.h asm
 	reg.h rwlock.h \
 	setjmp.h signal.h swi.h sysarch.h \
 	trap.h types.h \
+	vfpreg.h \
 	wchar_limits.h
 
 .include 

Index: src/sys/arch/arm/include/vfpreg.h
diff -u src/sys/arch/arm/include/vfpreg.h:1.1 src/sys/arch/arm/include/vfpreg.h:1.1.56.1
--- src/sys/arch/arm/include/vfpreg.h:1.1	Sat Mar 15 10:16:43 2008
+++ src/sys/arch/arm/include/vfpreg.h	Wed Nov 21 00:00:10 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfpreg.h,v 1.1 2008/03/15 10:16:43 rearnsha Exp $ */
+/*  $NetBSD: vfpreg.h,v 1.1.56.1 2012/11/21 00:00:10 matt Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -45,20 +45,60 @@
 #define VFP_FPSID_ARCH_MSK	0x000f	/* Architecture */
 #define VFP_FPSID_ARCH_V1	0x	/* Arch VFPv1 */
 #define VFP_FPSID_ARCH_V2	0x0001	/* Arch VFPv2 */
+#define VFP_FPSID_ARCH_V3_2	0x0002	/* Arch VFPv3 (subarch v2) */
+#define VFP_FPSID_ARCH_V3	0x0003	/* Arch VFPv3 (no subarch) */
+#define VFP_FPSID_ARCH_V3_3	0x0004	/* Arch VFPv3 (subarch v3) */
 #define VFP_FPSID_PART_MSK	0xff00	/* Part number */
 #define VFP_FPSID_PART_VFP10	0x1000	/* VFP10 */
+#define VFP_FPSID_PART_VFP11	0x2000	/* VFP11 */
+#define VFP_FPSID_PART_VFP30	0x3000	/* VFP30 */
 #define VFP_FPSID_VAR_MSK	0x00f0	/* Variant */
 #define VFP_FPSID_VAR_ARM10	0x00a0	/* Variant ARM10 */
+#define VFP_FPSID_VAR_ARM11	0x00b0	/* Variant ARM11 */
 #define VFP_FPSID_REV_MSK	0x000f	/* Revision */
 
-#define VFP_FPEXC_EX		0x8000	/* Exception status bit */
-#define VFP_FPEXC_EN		0x4000	/* Enable bit */
-
-#define VFP_FPSCR_DN		0x0200	/* Default NaN mode */
-#define VFP_FPSCR_FZ		0x0100	/* Flush-to-zero mode */
-
-
 #define FPU_VFP10_ARM10E	0x410001a0	/* Really a VFPv2 part */
 #define FPU_VFP11_ARM11		0x410120b0
+#define FPU_VFP_CORTEXA5	0x41023050
+#define FPU_VFP_CORTEXA7	0x41023070
+#define FPU_VFP_CORTEXA8	0x410330c0
+#define FPU_VFP_CORTEXA9	0x41033090
+
+#define VFP_FPEXC_EX		0x8000	/* Exception status bit */
+#define VFP_FPEXC_EN		0x4000	/* VFP Enable bit */
+#define VFP_FPEXC_FP2V		0x1000	/* FPINST2 instruction valid */
+#define VFP_FPEXC_VECITR	0x0700	/* Vector iteration count */
+#define VFP_FPEXC_INV		0x0080	/* Input exception flag */
+#define VFP_FPEXC_UFC		0x0080	/* Potential underflow flag */
+#define VFP_FPEXC_OFC		0x0080	/* Potential overflow flag */
+#define VFP_FPEXC_IOC		0x0080	/* Potential inv. op. flag */
+
+#define VFP_FPSCR_N	0x8000	/* set if compare <= result */
+#define VFP_FPSCR_Z	0x4000	/* set if compare = result */
+#define VFP_FPSCR_C	0x2000	/* set if compare (=,>=,UNORD) result */
+#define VFP_FPSCR_V	0x1000	/* set if compare UNORD result */
+#define VFP_FPSCR_DN	0x0200	/* Default NaN mode */
+#define VFP_FPSCR_FZ	0x0100	/* Flush-to-zero mode */
+#define VFP_FPSCR_RMODE	0x00c0	/* Rounding Mode */
+#define VFP_FPSCR_RZ	0x00c0	/* round towards zero (RZ) */
+#define VFP_FPSCR_RM	0x0080	/* round towards +INF (RP) */
+#define VFP_FPSCR_RP	0x0040	/* round towards -INF (RM) */
+#define VFP_FPSCR_RN	0x	/* round to nearest (RN) */
+#define VFP_FPSCR_STRIDE 0x0030	/* Vector Stride */
+#define VFP_FPSCR_LEN	0x0007	/* Vector Length */
+#define VFP_FPSCR_IDE	0x8000	/* Inout Subnormal Exception Enable */
+#define VFP_FPSCR_ESUM	0x1f00	/* IXE|UFE|OFE|DZE|IOE */
+#define VFP_FPSCR_IXE	0x1000	/* Inexact Exception Enable */
+#define VFP_FPSCR_UFE	0x0800	/* Underflow Exception Enable */
+#define VFP_FPSCR_OFE	0x0400	/* Overflow Exception Enable */
+#define VFP_FPSCR_DZE	0x0200	/* Inexact

CVS commit: [matt-nb6-plus] src/sys/rump

2012-11-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 20 23:58:02 UTC 2012

Modified Files:
src/sys/rump [matt-nb6-plus]: Makefile.rump

Log Message:
Don't use ldscript unless HAVE_BINUTILS == 219


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.61.12.1 src/sys/rump/Makefile.rump

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/Makefile.rump
diff -u src/sys/rump/Makefile.rump:1.61 src/sys/rump/Makefile.rump:1.61.12.1
--- src/sys/rump/Makefile.rump:1.61	Tue May 10 00:33:58 2011
+++ src/sys/rump/Makefile.rump	Tue Nov 20 23:58:02 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rump,v 1.61 2011/05/10 00:33:58 matt Exp $
+#	$NetBSD: Makefile.rump,v 1.61.12.1 2012/11/20 23:58:02 matt Exp $
 #
 
 WARNS?=		3	# XXX: src/sys won't compile with -Wsign-compare yet
@@ -32,7 +32,9 @@ CPPFLAGS+=	-I${RUMPTOP}/../../common/inc
 CPPFLAGS+=	-I${RUMPTOP}/include
 CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern/opt
 CPPFLAGS+=	-nostdinc -isystem ${RUMPTOP}/..
+.if ${HAVE_BINUTILS} == "219"
 LDFLAGS+=	-T ${RUMPTOP}/ldscript.rump
+.endif
 #CPPFLAGS+=	-DDEBUG
 
 .ifdef RUMP_LOCKDEBUG