CVS commit: src/share/mk

2015-04-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Apr  8 06:03:09 UTC 2015

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
remove support to look for GCC 4.5 in gcc.old.


To generate a diff of this commit:
cvs rdiff -u -r1.844 -r1.845 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.844 src/share/mk/bsd.own.mk:1.845
--- src/share/mk/bsd.own.mk:1.844	Sun Mar  1 07:46:04 2015
+++ src/share/mk/bsd.own.mk	Wed Apr  8 06:03:09 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.844 2015/03/01 07:46:04 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.845 2015/04/08 06:03:09 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -78,9 +78,7 @@ MKGCCCMDS?=	no
 # We import the old gcc as "gcc.old" when upgrading.  EXTERNAL_GCC_SUBDIR is
 # set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC.
 #
-.if ${HAVE_GCC} == 45
-EXTERNAL_GCC_SUBDIR=	gcc.old
-.elif ${HAVE_GCC} == 48
+.if ${HAVE_GCC} == 48
 EXTERNAL_GCC_SUBDIR=	gcc
 .else
 EXTERNAL_GCC_SUBDIR=	/does/not/exist



CVS commit: src/sys/arch/x86/x86

2015-04-07 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Apr  8 05:52:41 UTC 2015

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
add prototype declarations


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/x86/x86/intr.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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.77 src/sys/arch/x86/x86/intr.c:1.78
--- src/sys/arch/x86/x86/intr.c:1.77	Tue May 20 03:24:19 2014
+++ src/sys/arch/x86/x86/intr.c	Wed Apr  8 05:52:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.77 2014/05/20 03:24:19 ozaki-r Exp $	*/
+/*	$NetBSD: intr.c,v 1.78 2015/04/08 05:52:41 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.77 2014/05/20 03:24:19 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.78 2015/04/08 05:52:41 knakahara Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -188,6 +188,8 @@ struct pic softintr_pic = {
 	.pic_lock = __SIMPLELOCK_UNLOCKED,
 };
 
+static void intr_calculatemasks(struct cpu_info *);
+
 #if NIOAPIC > 0 || NACPICA > 0
 static int intr_scan_bus(int, int, int *);
 #if NPCI > 0
@@ -195,6 +197,23 @@ static int intr_find_pcibridge(int, pcit
 #endif
 #endif
 
+static int intr_allocate_slot_cpu(struct cpu_info *, struct pic *, int, int *);
+static int __noinline intr_allocate_slot(struct pic *, int, int,
+	 struct cpu_info **, int *, int *);
+
+static void intr_source_free(struct cpu_info *, int, struct pic *, int);
+
+static void intr_establish_xcall(void *, void *);
+static void intr_disestablish_xcall(void *, void *);
+
+static inline bool redzone_const_or_false(bool);
+static inline int redzone_const_or_zero(int);
+
+static void intr_redistribute_xc_t(void *, void *);
+static void intr_redistribute_xc_s1(void *, void *);
+static void intr_redistribute_xc_s2(void *, void *);
+static bool intr_redistribute(struct cpu_info *);
+
 /*
  * Fill in default interrupt table (in case of spurious interrupt
  * during configuration of kernel), setup interrupt control unit



CVS commit: src

2015-04-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  8 05:48:24 UTC 2015

Modified Files:
src: BUILDING

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/BUILDING

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

Modified files:

Index: src/BUILDING
diff -u src/BUILDING:1.118 src/BUILDING:1.119
--- src/BUILDING:1.118	Sun Nov 30 15:54:34 2014
+++ src/BUILDING	Wed Apr  8 05:48:24 2015
@@ -452,8 +452,8 @@ CONFIGURATION
  X11FLAVOUR  The style of X11 cross-built, set to either ``Xorg'' or
  ``XFree86''.
 
- Default: ``Xorg'' on amd64, i386, macppc, shark and sparc64
- platforms, ``XFree86'' on everything else.
+ Default: ``XFree86'' on acorn32, alpha, amiga, mac68k, pmax,
+ and sun3 platforms, ``Xorg'' on everything else.
 
"make" variables for full builds
  These variables only affect the top level ``Makefile'' and do not affect
@@ -1108,4 +1108,4 @@ CAVEATS
  files in object directories.  Instead, one may have to manually remove
  the files.  Consult the UPDATING file for notices concerning this.
 
-NetBSD  August 7, 2014  NetBSD
+NetBSD   April 7, 2015  NetBSD



CVS commit: src/doc

2015-04-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  8 05:47:43 UTC 2015

Modified Files:
src/doc: BUILDING.mdoc

Log Message:
Update Xorg defaults description. From Joachim Henke on netbsd-docs.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/doc/BUILDING.mdoc

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

Modified files:

Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.111 src/doc/BUILDING.mdoc:1.112
--- src/doc/BUILDING.mdoc:1.111	Thu Jan  8 23:59:26 2015
+++ src/doc/BUILDING.mdoc	Wed Apr  8 05:47:43 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: BUILDING.mdoc,v 1.111 2015/01/08 23:59:26 riastradh Exp $
+.\"	$NetBSD: BUILDING.mdoc,v 1.112 2015/04/08 05:47:43 wiz Exp $
 .\"
 .\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" Toolchain prefix for commands
 .ds toolprefix nb
 .
-.Dd August 7, 2014
+.Dd April 7, 2015
 .Dt BUILDING 8
 .Os NetBSD
 .
@@ -783,9 +783,9 @@ The style of X11 cross-built, set to eit
 or
 .Dq XFree86 .
 .DFLT
-.Dq Xorg
-on amd64, i386, macppc, shark and sparc64 platforms,
 .Dq XFree86
+on acorn32, alpha, amiga, mac68k, pmax, and sun3 platforms,
+.Dq Xorg
 on everything else.
 .
 .El



CVS commit: src/share/man/man5

2015-04-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  8 05:47:00 UTC 2015

Modified Files:
src/share/man/man5: mk.conf.5

Log Message:
Update some defaults, from Joachim Henke on netbsd-docs.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/share/man/man5/mk.conf.5

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

Modified files:

Index: src/share/man/man5/mk.conf.5
diff -u src/share/man/man5/mk.conf.5:1.69 src/share/man/man5/mk.conf.5:1.70
--- src/share/man/man5/mk.conf.5:1.69	Tue Mar 25 10:23:26 2014
+++ src/share/man/man5/mk.conf.5	Wed Apr  8 05:47:00 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mk.conf.5,v 1.69 2014/03/25 10:23:26 wiz Exp $
+.\"	$NetBSD: mk.conf.5,v 1.70 2015/04/08 05:47:00 wiz Exp $
 .\"
 .\"  Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
 .\"  All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 25, 2014
+.Dd April 7, 2015
 .Dt MK.CONF 5
 .Os
 .\" turn off hyphenation
@@ -262,7 +262,7 @@ based frontends are used.
 .YorN
 Indicates whether preformatted plaintext manual pages will be created
 and installed.
-.DFLTy
+.DFLTn
 .
 .It Sy MKCLEANSRC
 .YorN
@@ -1053,11 +1053,10 @@ or
 .Dq XFree86 .
 Only relevant if
 .Sy MKX11!=no .
-.Pp
-.Em Default :
-.Dq Xorg
-on alpha, i386, macppc, shark and sparc64 platforms.
+.DFLT
 .Dq XFree86
+on acorn32, alpha, amiga, mac68k, pmax, and sun3 platforms,
+.Dq Xorg
 on everything else.
 .
 .El



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 03:14:29 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Oops -- we already hold rndpool_mtx here.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.36 src/sys/kern/kern_rndq.c:1.37
--- src/sys/kern/kern_rndq.c:1.36	Wed Apr  8 03:00:31 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 03:14:29 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.36 2015/04/08 03:00:31 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.37 2015/04/08 03:14:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.36 2015/04/08 03:00:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.37 2015/04/08 03:14:29 riastradh Exp $");
 
 #include 
 #include 
@@ -1097,9 +1097,7 @@ rnd_process_events(void)
 		 */
 		if (source->type == RND_TYPE_RNG) {
 			if (__predict_false(rnd_hwrng_test(sample))) {
-mutex_spin_enter(&rndpool_mtx);
 source->flags |= RND_FLAG_NO_COLLECT;
-mutex_spin_exit(&rndpool_mtx);
 rnd_printf("rnd: disabling source \"%s\".",
 badsource->name);
 goto skip;



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 03:00:31 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Simplify logic to disable HWRNGs that fail rngtest.

- Mark them RND_FLAG_NO_COLLECT.
- Skip samples from sources marked RND_FLAG_NO_COLLECT.
- Don't ever call rnd_detach_source in softint context.
- Remove bogus use of cpu_softintr_p.

The call to rnd_detach_source in softint can't possibly have ever
worked: if the owner of the source ever tried to detach it by calling
rnd_detach_source again, it would LIST_REMOVE a removed element,
which is broken.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.35 src/sys/kern/kern_rndq.c:1.36
--- src/sys/kern/kern_rndq.c:1.35	Wed Apr  8 02:52:25 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 03:00:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.35 2015/04/08 02:52:25 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.36 2015/04/08 03:00:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.35 2015/04/08 02:52:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.36 2015/04/08 03:00:31 riastradh Exp $");
 
 #include 
 #include 
@@ -55,7 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,
 #include 
 #include 
 #include 
-#include 	/* XXX temporary, see rnd_detach_source */
 
 #include 
 
@@ -752,15 +751,13 @@ rnd_detach_source(krndsource_t *source)
 	}
 	mutex_spin_exit(&rnd_samples.lock);
 
-	if (!cpu_softintr_p()) {	/* XXX XXX very temporary "fix" */
-		if (source->state) {
-			rnd_sample_free(source->state);
-			source->state = NULL;
-		}
+	if (source->state) {
+		rnd_sample_free(source->state);
+		source->state = NULL;
+	}
 
-		if (source->test) {
-			kmem_free(source->test, sizeof(rngtest_t));
-		}
+	if (source->test) {
+		kmem_free(source->test, sizeof(rngtest_t));
 	}
 
 	rnd_printf_verbose("rnd: %s detached as an entropy source\n",
@@ -1087,19 +1084,25 @@ rnd_process_events(void)
 		last_source = source;
 
 		/*
+		 * If the source has been disabled, ignore samples from
+		 * it.
+		 */
+		if (source->flags & RND_FLAG_NO_COLLECT)
+			goto skip;
+
+		/*
 		 * Hardware generators are great but sometimes they
 		 * have...hardware issues.  Don't use any data from
 		 * them unless it passes some tests.
 		 */
 		if (source->type == RND_TYPE_RNG) {
 			if (__predict_false(rnd_hwrng_test(sample))) {
-/*
- * Detach the bad source.  See below.
- */
-badsource = source;
-rnd_printf("rnd: detaching source \"%s\".",
-   badsource->name);
-break;
+mutex_spin_enter(&rndpool_mtx);
+source->flags |= RND_FLAG_NO_COLLECT;
+mutex_spin_exit(&rndpool_mtx);
+rnd_printf("rnd: disabling source \"%s\".",
+badsource->name);
+goto skip;
 			}
 		}
 
@@ -1118,7 +1121,7 @@ rnd_process_events(void)
 
 		pool_entropy += entropy;
 		source->total += sample->entropy;
-		SIMPLEQ_INSERT_TAIL(&df_samples, sample, next);
+skip:		SIMPLEQ_INSERT_TAIL(&df_samples, sample, next);
 	}
 	rndpool_set_entropy_count(&rnd_pool, pool_entropy);
 	if (pool_entropy > RND_ENTROPY_THRESHOLD * 8) {
@@ -1132,19 +1135,6 @@ rnd_process_events(void)
 	mutex_spin_exit(&rndpool_mtx);
 
 	/* Now we hold no locks: clean up. */
-	if (__predict_false(badsource)) {
-		/*
-		 * The detach routine frees any samples we have not
-		 * dequeued ourselves.  For sanity's sake, we simply
-		 * free (without using) all dequeued samples from the
-		 * point at which we detected a problem onwards.
-		 */
-		rnd_detach_source(badsource);
-		while ((sample = SIMPLEQ_FIRST(&dq_samples))) {
-			SIMPLEQ_REMOVE_HEAD(&dq_samples, next);
-			rnd_sample_free(sample);
-		}
-	}
 	while ((sample = SIMPLEQ_FIRST(&df_samples))) {
 		SIMPLEQ_REMOVE_HEAD(&df_samples, next);
 		rnd_sample_free(sample);



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 02:52:25 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Name the simpleq of rnd_sample_t structure.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.34 src/sys/kern/kern_rndq.c:1.35
--- src/sys/kern/kern_rndq.c:1.34	Wed Apr  8 02:49:03 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 02:52:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.34 2015/04/08 02:49:03 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.35 2015/04/08 02:52:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.34 2015/04/08 02:49:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.35 2015/04/08 02:52:25 riastradh Exp $");
 
 #include 
 #include 
@@ -108,13 +108,15 @@ typedef struct _rnd_sample_t {
 	u_int32_t	values[RND_SAMPLE_COUNT];
 } rnd_sample_t;
 
+SIMPLEQ_HEAD(rnd_sampleq, _rnd_sample_t);
+
 /*
  * The sample queue.  Samples are put into the queue and processed in a
  * softint in order to limit the latency of adding a sample.
  */
 static struct {
-	kmutex_t			lock;
-	SIMPLEQ_HEAD(, _rnd_sample_t)	q;
+	kmutex_t		lock;
+	struct rnd_sampleq	q;
 } rnd_samples __cacheline_aligned;
 
 /*
@@ -865,8 +867,7 @@ rnd_add_data_ts(krndsource_t *rs, const 
 	uint32_t dint;
 	int todo, done, filled = 0;
 	int sample_count;
-	SIMPLEQ_HEAD(, _rnd_sample_t) tmp_samples =
-			SIMPLEQ_HEAD_INITIALIZER(tmp_samples);
+	struct rnd_sampleq tmp_samples = SIMPLEQ_HEAD_INITIALIZER(tmp_samples);
 
 	if (rs && (rs->flags & RND_FLAG_NO_COLLECT ||
 	__predict_false(!(rs->flags & 
@@ -1036,10 +1037,8 @@ rnd_process_events(void)
 	u_int32_t entropy;
 	size_t pool_entropy;
 	int found = 0, wake = 0;
-	SIMPLEQ_HEAD(, _rnd_sample_t) dq_samples =
-			SIMPLEQ_HEAD_INITIALIZER(dq_samples);
-	SIMPLEQ_HEAD(, _rnd_sample_t) df_samples =
-			SIMPLEQ_HEAD_INITIALIZER(df_samples);
+	struct rnd_sampleq dq_samples = SIMPLEQ_HEAD_INITIALIZER(dq_samples);
+	struct rnd_sampleq df_samples = SIMPLEQ_HEAD_INITIALIZER(df_samples);
 
 	/*
 	 * Drain to the on-stack queue and drop the lock.



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 02:49:03 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Gather sample queue and lock into a static cacheline-aligned struct.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.33 src/sys/kern/kern_rndq.c:1.34
--- src/sys/kern/kern_rndq.c:1.33	Wed Apr  8 02:44:07 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 02:49:03 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.33 2015/04/08 02:44:07 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.34 2015/04/08 02:49:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.33 2015/04/08 02:44:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.34 2015/04/08 02:49:03 riastradh Exp $");
 
 #include 
 #include 
@@ -109,11 +109,13 @@ typedef struct _rnd_sample_t {
 } rnd_sample_t;
 
 /*
- * The event queue.  Fields are altered at an interrupt level.
- * All accesses must be protected with the mutex.
+ * The sample queue.  Samples are put into the queue and processed in a
+ * softint in order to limit the latency of adding a sample.
  */
-SIMPLEQ_HEAD(, _rnd_sample_t)	rnd_samples;
-kmutex_t			rnd_mtx;
+static struct {
+	kmutex_t			lock;
+	SIMPLEQ_HEAD(, _rnd_sample_t)	q;
+} rnd_samples __cacheline_aligned;
 
 /*
  * Memory pool for sample buffers
@@ -522,7 +524,7 @@ rnd_init(void)
 	if (rnd_ready)
 		return;
 
-	mutex_init(&rnd_mtx, MUTEX_DEFAULT, IPL_VM);
+	mutex_init(&rnd_samples.lock, MUTEX_DEFAULT, IPL_VM);
 	rndsinks_init();
 
 	/*
@@ -532,7 +534,7 @@ rnd_init(void)
 	c = rnd_counter();
 
 	LIST_INIT(&rnd_sources);
-	SIMPLEQ_INIT(&rnd_samples);
+	SIMPLEQ_INIT(&rnd_samples.q);
 
 	rndpool_init(&rnd_pool);
 	mutex_init(&rndpool_mtx, MUTEX_DEFAULT, IPL_VM);
@@ -738,15 +740,15 @@ rnd_detach_source(krndsource_t *source)
 	 * If there are samples queued up "remove" them from the sample queue
 	 * by setting the source to the no-collect pseudosource.
 	 */
-	mutex_spin_enter(&rnd_mtx);
-	sample = SIMPLEQ_FIRST(&rnd_samples);
+	mutex_spin_enter(&rnd_samples.lock);
+	sample = SIMPLEQ_FIRST(&rnd_samples.q);
 	while (sample != NULL) {
 		if (sample->source == source)
 			sample->source = &rnd_source_no_collect;
 
 		sample = SIMPLEQ_NEXT(sample, next);
 	}
-	mutex_spin_exit(&rnd_mtx);
+	mutex_spin_exit(&rnd_samples.lock);
 
 	if (!cpu_softintr_p()) {	/* XXX XXX very temporary "fix" */
 		if (source->state) {
@@ -955,12 +957,12 @@ rnd_add_data_ts(krndsource_t *rs, const 
 		return;
 	}
 
-	mutex_spin_enter(&rnd_mtx);
+	mutex_spin_enter(&rnd_samples.lock);
 	while ((state = SIMPLEQ_FIRST(&tmp_samples))) {
 		SIMPLEQ_REMOVE_HEAD(&tmp_samples, next);
-		SIMPLEQ_INSERT_HEAD(&rnd_samples, state, next);
+		SIMPLEQ_INSERT_HEAD(&rnd_samples.q, state, next);
 	}
-	mutex_spin_exit(&rnd_mtx);
+	mutex_spin_exit(&rnd_samples.lock);
 
 	/* Cause processing of queued samples */
 	rnd_schedule_process();
@@ -1040,14 +1042,12 @@ rnd_process_events(void)
 			SIMPLEQ_HEAD_INITIALIZER(df_samples);
 
 	/*
-	 * Sample queue is protected by rnd_mtx, drain to onstack queue
-	 * and drop lock.
+	 * Drain to the on-stack queue and drop the lock.
 	 */
-
-	mutex_spin_enter(&rnd_mtx);
-	while ((sample = SIMPLEQ_FIRST(&rnd_samples))) {
+	mutex_spin_enter(&rnd_samples.lock);
+	while ((sample = SIMPLEQ_FIRST(&rnd_samples.q))) {
 		found++;
-		SIMPLEQ_REMOVE_HEAD(&rnd_samples, next);
+		SIMPLEQ_REMOVE_HEAD(&rnd_samples.q, next);
 		/*
 		 * We repeat this check here, since it is possible
 		 * the source was disabled before we were called, but
@@ -1061,7 +1061,7 @@ rnd_process_events(void)
 			SIMPLEQ_INSERT_TAIL(&dq_samples, sample, next);
 		}
 	}
-	mutex_spin_exit(&rnd_mtx);
+	mutex_spin_exit(&rnd_samples.lock);
 
 	/* Don't thrash the rndpool mtx either.  Hold, add all samples. */
 	mutex_spin_enter(&rndpool_mtx);



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 02:44:07 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Let's use the same lock for insertion and deletion, shall we?


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.32 src/sys/kern/kern_rndq.c:1.33
--- src/sys/kern/kern_rndq.c:1.32	Wed Apr  8 02:35:33 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 02:44:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.32 2015/04/08 02:35:33 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.33 2015/04/08 02:44:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.32 2015/04/08 02:35:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.33 2015/04/08 02:44:07 riastradh Exp $");
 
 #include 
 #include 
@@ -730,14 +730,15 @@ rnd_detach_source(krndsource_t *source)
 {
 	rnd_sample_t *sample;
 
-	mutex_spin_enter(&rnd_mtx);
-
+	mutex_spin_enter(&rndpool_mtx);
 	LIST_REMOVE(source, list);
+	mutex_spin_exit(&rndpool_mtx);
 
 	/*
 	 * If there are samples queued up "remove" them from the sample queue
 	 * by setting the source to the no-collect pseudosource.
 	 */
+	mutex_spin_enter(&rnd_mtx);
 	sample = SIMPLEQ_FIRST(&rnd_samples);
 	while (sample != NULL) {
 		if (sample->source == source)
@@ -745,7 +746,6 @@ rnd_detach_source(krndsource_t *source)
 
 		sample = SIMPLEQ_NEXT(sample, next);
 	}
-
 	mutex_spin_exit(&rnd_mtx);
 
 	if (!cpu_softintr_p()) {	/* XXX XXX very temporary "fix" */



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 02:35:33 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Reduce some indentation.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.31 src/sys/kern/kern_rndq.c:1.32
--- src/sys/kern/kern_rndq.c:1.31	Wed Apr  8 02:32:26 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 02:35:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.31 2015/04/08 02:32:26 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.32 2015/04/08 02:35:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.31 2015/04/08 02:32:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.32 2015/04/08 02:35:33 riastradh Exp $");
 
 #include 
 #include 
@@ -284,16 +284,15 @@ rnd_getmore(size_t byteswanted)
 	KASSERT(mutex_owned(&rndpool_mtx));
 
 	LIST_FOREACH(rs, &rnd_sources, list) {
-		if (rs->flags & RND_FLAG_HASCB) {
-			KASSERT(rs->get != NULL);
-			KASSERT(rs->getarg != NULL);
-			rs->get(byteswanted, rs->getarg);
-			rnd_printf_verbose("rnd: entropy estimate %zu bits\n",
-			rndpool_get_entropy_count(&rnd_pool));
-			rnd_printf_verbose("rnd: asking source %s"
-			" for %zu bytes\n",
-			rs->name, byteswanted);
-		}
+		if (!ISSET(rs->flags, RND_FLAG_HASCB))
+			continue;
+		KASSERT(rs->get != NULL);
+		KASSERT(rs->getarg != NULL);
+		rs->get(byteswanted, rs->getarg);
+		rnd_printf_verbose("rnd: entropy estimate %zu bits\n",
+		rndpool_get_entropy_count(&rnd_pool));
+		rnd_printf_verbose("rnd: asking source %s for %zu bytes\n",
+		rs->name, byteswanted);
 	}
 }
 



CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 02:32:26 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Reduce #ifdef RND_VERBOSE clutter.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.30 src/sys/kern/kern_rndq.c:1.31
--- src/sys/kern/kern_rndq.c:1.30	Wed Apr  8 02:25:06 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 02:32:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.30 2015/04/08 02:25:06 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.31 2015/04/08 02:32:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.30 2015/04/08 02:25:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.31 2015/04/08 02:32:26 riastradh Exp $");
 
 #include 
 #include 
@@ -83,6 +83,12 @@ int	rnd_debug = 0;
 #endif
 
 #ifdef RND_VERBOSE
+#define	rnd_printf_verbose(fmt, ...)	rnd_printf(fmt, ##__VA_ARGS__)
+#else
+#define	rnd_printf_verbose(fmt, ...)	((void)0)
+#endif
+
+#ifdef RND_VERBOSE
 static unsigned int deltacnt;
 #endif
 
@@ -167,7 +173,6 @@ static inline uint32_t	rnd_counter(void)
 staticvoid	rnd_intr(void *);
 static	  void	rnd_wake(void *);
 static	  void	rnd_process_events(void);
-static	  u_int32_t	rnd_extract_data_locked(void *, u_int32_t, u_int32_t);
 static	  void	rnd_add_data_ts(krndsource_t *, const void *const,
 	uint32_t, uint32_t, uint32_t);
 static inline void	rnd_schedule_process(void);
@@ -274,7 +279,7 @@ rnd_schedule_wakeup(void)
 void
 rnd_getmore(size_t byteswanted)
 {
-	krndsource_t *rs; 
+	krndsource_t *rs;
 
 	KASSERT(mutex_owned(&rndpool_mtx));
 
@@ -283,14 +288,13 @@ rnd_getmore(size_t byteswanted)
 			KASSERT(rs->get != NULL);
 			KASSERT(rs->getarg != NULL);
 			rs->get(byteswanted, rs->getarg);
-#ifdef RND_VERBOSE
-			rnd_printf("rnd: entropy estimate %zu bits\n",
-   rndpool_get_entropy_count(&rnd_pool));
-			rnd_printf("rnd: asking source %s for %zu bytes\n",
-			   rs->name, byteswanted);
-#endif
-		}
-	}
+			rnd_printf_verbose("rnd: entropy estimate %zu bits\n",
+			rndpool_get_entropy_count(&rnd_pool));
+			rnd_printf_verbose("rnd: asking source %s"
+			" for %zu bytes\n",
+			rs->name, byteswanted);
+		}
+	}
 }
 
 /*
@@ -314,7 +318,7 @@ rnd_wakeup_readers(void)
 	} else {
 #ifdef RND_VERBOSE
 		if (__predict_false(!rnd_initial_entropy))
-			rnd_printf("rnd: have initial entropy (%zu)\n",
+			rnd_printf_verbose("rnd: have initial entropy (%zu)\n",
 			entropy_count);
 #endif
 		rnd_empty = 0;
@@ -389,7 +393,7 @@ rnd_dt_estimate(krndsource_t *rs, uint32
 	KASSERT(d->dx == delta);
 #ifdef RND_VERBOSE
 	if (deltacnt++ % 1151 == 0) {
-		rnd_printf("rnd_dt_estimate: %s x = %lld, dx = %lld, "
+		rnd_printf_verbose("rnd_dt_estimate: %s x = %lld, dx = %lld, "
 		   "d2x = %lld\n", rs->name,
 		   (int)d->x, (int)d->dx, (int)d->d2x);
 	}
@@ -418,7 +422,7 @@ rnd_dv_estimate(krndsource_t *rs, uint32
 	KASSERT(d->dx == delta);
 #ifdef RND_VERBOSE
 	if (deltacnt++ % 1151 == 0) {
-		rnd_printf("rnd_dv_estimate: %s x = %lld, dx = %lld, "
+		rnd_printf_verbose("rnd_dv_estimate: %s x = %lld, dx = %lld, "
 		   " d2x = %lld\n", rs->name,
 		   (long long int)d->x,
 		   (long long int)d->dx,
@@ -575,10 +579,8 @@ rnd_init(void)
 	rnd_skew(NULL);
 #endif
 
-#ifdef RND_VERBOSE
-	rnd_printf("rnd: initialised (%u)%s", RND_POOLBITS,
-	   c ? " with counter\n" : "\n");
-#endif
+	rnd_printf_verbose("rnd: initialised (%u)%s", RND_POOLBITS,
+	c ? " with counter\n" : "\n");
 	if (boot_rsp != NULL) {
 		mutex_spin_enter(&rndpool_mtx);
 			rndpool_add_data(&rnd_pool, boot_rsp->data,
@@ -590,10 +592,8 @@ rnd_init(void)
 	rnd_initial_entropy = 1;
 		}
 mutex_spin_exit(&rndpool_mtx);
-#ifdef RND_VERBOSE
 		rnd_printf("rnd: seeded with %d bits\n",
-		   MIN(boot_rsp->entropy, RND_POOLBITS / 2));
-#endif
+		MIN(boot_rsp->entropy, RND_POOLBITS / 2));
 		memset(boot_rsp, 0, sizeof(*boot_rsp));
 	}
 	rnd_attach_source(&rnd_source_anonymous, "Anonymous",
@@ -701,15 +701,16 @@ rnd_attach_source(krndsource_t *rs, cons
 	LIST_INSERT_HEAD(&rnd_sources, rs, list);
 
 #ifdef RND_VERBOSE
-	rnd_printf("rnd: %s attached as an entropy source (", rs->name);
+	rnd_printf_verbose("rnd: %s attached as an entropy source (",
+	rs->name);
 	if (!(flags & RND_FLAG_NO_COLLECT)) {
-		rnd_printf("collecting");
+		rnd_printf_verbose("collecting");
 		if (flags & RND_FLAG_NO_ESTIMATE)
-			rnd_printf(" without estimation");
+			rnd_printf_verbose(" without estimation");
 	}
 	else
-		rnd_printf("off");
-	rnd_printf(")\n");
+		rnd_printf_verbose("off");
+	rnd_printf_verbose(")\n");
 #endif
 
 	/*
@@ -759,9 +760,

CVS commit: src/sys/kern

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 02:25:06 UTC 2015

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Make rnd_extract_data_locked static.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.29 src/sys/kern/kern_rndq.c:1.30
--- src/sys/kern/kern_rndq.c:1.29	Thu Jan  8 16:13:07 2015
+++ src/sys/kern/kern_rndq.c	Wed Apr  8 02:25:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.29 2015/01/08 16:13:07 christos Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.30 2015/04/08 02:25:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.29 2015/01/08 16:13:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.30 2015/04/08 02:25:06 riastradh Exp $");
 
 #include 
 #include 
@@ -167,7 +167,7 @@ static inline uint32_t	rnd_counter(void)
 staticvoid	rnd_intr(void *);
 static	  void	rnd_wake(void *);
 static	  void	rnd_process_events(void);
-u_int32_t rnd_extract_data_locked(void *, u_int32_t, u_int32_t); /* XXX */
+static	  u_int32_t	rnd_extract_data_locked(void *, u_int32_t, u_int32_t);
 static	  void	rnd_add_data_ts(krndsource_t *, const void *const,
 	uint32_t, uint32_t, uint32_t);
 static inline void	rnd_schedule_process(void);
@@ -1175,7 +1175,7 @@ rnd_wake(void *arg)
 	rnd_wakeup_readers();
 }
 
-u_int32_t
+static u_int32_t
 rnd_extract_data_locked(void *p, u_int32_t len, u_int32_t flags)
 {
 	static int timed_in;



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 01:47:20 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: atombios_crtc.c

Log Message:
Don't reserve if atomic -- caller must have pre-pinned the buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/atombios_crtc.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/external/bsd/drm2/dist/drm/radeon/atombios_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/atombios_crtc.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/atombios_crtc.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/atombios_crtc.c:1.2	Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/atombios_crtc.c	Wed Apr  8 01:47:20 2015
@@ -1124,23 +1124,24 @@ static int dce4_crtc_do_set_base(struct 
 	 */
 	obj = radeon_fb->obj;
 	rbo = gem_to_radeon_bo(obj);
-	r = radeon_bo_reserve(rbo, false);
-	if (unlikely(r != 0))
-		return r;
 
-	if (atomic)
+	if (atomic) {
+		BUG_ON(rbo->pin_count == 0);
 		fb_location = radeon_bo_gpu_offset(rbo);
-	else {
+		tiling_flags = 0;
+	} else {
+		r = radeon_bo_reserve(rbo, false);
+		if (unlikely(r != 0))
+			return r;
 		r = radeon_bo_pin(rbo, RADEON_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
 			radeon_bo_unreserve(rbo);
 			return -EINVAL;
 		}
+		radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL);
+		radeon_bo_unreserve(rbo);
 	}
 
-	radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL);
-	radeon_bo_unreserve(rbo);
-
 	switch (target_fb->bits_per_pixel) {
 	case 8:
 		fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) |



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2015-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  8 01:42:40 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_legacy_crtc.c

Log Message:
Don't reserve if atomic -- caller must have pre-pinned the buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_crtc.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/external/bsd/drm2/dist/drm/radeon/radeon_legacy_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_crtc.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_crtc.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_crtc.c:1.1.1.1	Wed Jul 16 19:35:28 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_crtc.c	Wed Apr  8 01:42:40 2015
@@ -422,6 +422,16 @@ int radeon_crtc_do_set_base(struct drm_c
 	/* Pin framebuffer & get tilling informations */
 	obj = radeon_fb->obj;
 	rbo = gem_to_radeon_bo(obj);
+	if (atomic) {
+		/*
+		 * If you want to do this in atomic, better have it
+		 * pinned ahead of time.
+		 */
+		BUG_ON(rbo->pin_count == 0);
+		base = radeon_bo_gpu_offset(rbo);
+		tiling_flags = 0;
+		goto pinned;
+	}
 retry:
 	r = radeon_bo_reserve(rbo, false);
 	if (unlikely(r != 0))
@@ -444,7 +454,7 @@ retry:
 		 * We don't shutdown the display controller because new buffer
 		 * will end up in same spot.
 		 */
-		if (!atomic && fb && fb != crtc->primary->fb) {
+		if (fb && fb != crtc->primary->fb) {
 			struct radeon_bo *old_rbo;
 			unsigned long nsize, osize;
 
@@ -462,6 +472,7 @@ retry:
 	}
 	radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL);
 	radeon_bo_unreserve(rbo);
+pinned:
 	if (tiling_flags & RADEON_TILING_MICRO)
 		DRM_ERROR("trying to scanout microtiled buffer\n");
 



CVS commit: src/sys

2015-04-07 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Apr  7 23:30:36 UTC 2015

Modified Files:
src/sys/net: if.c if.h
src/sys/netinet6: in6.c in6_var.h

Log Message:
Move in6if_do_dad() to if_do_dad() as the routine is not INET6 specific
and could equally be used by INET.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/net/if.c
cvs rdiff -u -r1.186 -r1.187 src/sys/net/if.h
cvs rdiff -u -r1.185 -r1.186 src/sys/netinet6/in6.c
cvs rdiff -u -r1.72 -r1.73 src/sys/netinet6/in6_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/net/if.c
diff -u src/sys/net/if.c:1.308 src/sys/net/if.c:1.309
--- src/sys/net/if.c:1.308	Fri Jan 16 10:36:14 2015
+++ src/sys/net/if.c	Tue Apr  7 23:30:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.308 2015/01/16 10:36:14 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.309 2015/04/07 23:30:36 roy Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.308 2015/01/16 10:36:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.309 2015/04/07 23:30:36 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2317,6 +2317,39 @@ if_addr_init(ifnet_t *ifp, struct ifaddr
 }
 
 int
+if_do_dad(struct ifnet *ifp)
+{
+	if ((ifp->if_flags & IFF_LOOPBACK) != 0)
+		return 0;
+
+	switch (ifp->if_type) {
+	case IFT_FAITH:
+		/*
+		 * These interfaces do not have the IFF_LOOPBACK flag,
+		 * but loop packets back.  We do not have to do DAD on such
+		 * interfaces.  We should even omit it, because loop-backed
+		 * responses would confuse the DAD procedure.
+		 */
+		return 0;
+	default:
+		/*
+		 * Our DAD routine requires the interface up and running.
+		 * However, some interfaces can be up before the RUNNING
+		 * status.  Additionaly, users may try to assign addresses
+		 * before the interface becomes up (or running).
+		 * We simply skip DAD in such a case as a work around.
+		 * XXX: we should rather mark "tentative" on such addresses,
+		 * and do DAD after the interface becomes ready.
+		 */
+		if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) !=
+		(IFF_UP|IFF_RUNNING))
+			return 0;
+
+		return 1;
+	}
+}
+
+int
 if_flags_set(ifnet_t *ifp, const short flags)
 {
 	int rc;

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.186 src/sys/net/if.h:1.187
--- src/sys/net/if.h:1.186	Fri Apr  3 08:20:55 2015
+++ src/sys/net/if.h	Tue Apr  7 23:30:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.186 2015/04/03 08:20:55 msaitoh Exp $	*/
+/*	$NetBSD: if.h,v 1.187 2015/04/07 23:30:36 roy Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -879,6 +879,7 @@ int	ifioctl_common(struct ifnet *, u_lon
 int	ifpromisc(struct ifnet *, int);
 struct	ifnet *ifunit(const char *);
 int	if_addr_init(ifnet_t *, struct ifaddr *, bool);
+int	if_do_dad(struct ifnet *);
 int	if_mcast_op(ifnet_t *, const unsigned long, const struct sockaddr *);
 int	if_flags_set(struct ifnet *, const short);
 

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.185 src/sys/netinet6/in6.c:1.186
--- src/sys/netinet6/in6.c:1.185	Thu Feb 26 12:58:36 2015
+++ src/sys/netinet6/in6.c	Tue Apr  7 23:30:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.185 2015/02/26 12:58:36 roy Exp $	*/
+/*	$NetBSD: in6.c,v 1.186 2015/04/07 23:30:36 roy Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.185 2015/02/26 12:58:36 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.186 2015/04/07 23:30:36 roy Exp $");
 
 #include "opt_inet.h"
 #include "opt_compat_netbsd.h"
@@ -979,7 +979,7 @@ in6_update_ifa1(struct ifnet *ifp, struc
 	if (ifp->if_link_state == LINK_STATE_DOWN) {
 		ia->ia6_flags |= IN6_IFF_DETACHED;
 		ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
-	} else if ((hostIsNew || was_tentative) && in6if_do_dad(ifp))
+	} else if ((hostIsNew || was_tentative) && if_do_dad(ifp))
 		ia->ia6_flags |= IN6_IFF_TENTATIVE;
 
 	/*
@@ -1205,7 +1205,7 @@ in6_update_ifa1(struct ifnet *ifp, struc
 	 * XXX It may be of use, if we can administratively
 	 * disable DAD.
 	 */
-	if (hostIsNew && in6if_do_dad(ifp) &&
+	if (hostIsNew && if_do_dad(ifp) &&
 	((ifra->ifra_flags & IN6_IFF_NODAD) == 0) &&
 	(ia->ia6_flags & IN6_IFF_TENTATIVE))
 	{
@@ -2005,7 +2005,7 @@ in6_if_link_up(struct ifnet *ifp)
 		/* If detached then mark as tentative */
 		if (ia->ia6_flags & IN6_IFF_DETACHED) {
 			ia->ia6_flags &= ~IN6_IFF_DETACHED;
-			if (in6if_do_dad(ifp)) {
+			if (if_do_dad(ifp)) {
 ia->ia6_flags |= IN6_IFF_TENTATIVE;
 nd6log((LOG_ERR, "in6_if_up: "
 "%s marked tentative\n",
@@ -2097,39 +2097,6 @@ in6_if_down(struct ifnet *ifp)
 	in6_if_link_down(ifp);
 }
 
-int
-in6if_do_dad(struct ifnet *ifp)
-{
-	if ((ifp->if_flags & IFF_LOOPBACK) != 0)
-		return 0;
-
-	switch (ifp->if_type) {
-	case IF

CVS commit: src/sys/arch/arm/arm32

2015-04-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr  7 20:38:20 UTC 2015

Modified Files:
src/sys/arch/arm/arm32: genassym.cf

Log Message:
__HAVE_UNNESTED_INTRS is never used.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/arm/arm32/genassym.cf

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/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.70 src/sys/arch/arm/arm32/genassym.cf:1.71
--- src/sys/arch/arm/arm32/genassym.cf:1.70	Mon Mar 23 17:28:14 2015
+++ src/sys/arch/arm/arm32/genassym.cf	Tue Apr  7 20:38:20 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.70 2015/03/23 17:28:14 matt Exp $
+#	$NetBSD: genassym.cf,v 1.71 2015/04/07 20:38:20 matt Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -78,10 +78,6 @@ ifdef __HAVE_PIC_FAST_SOFTINTS
 define	__HAVE_PIC_FAST_SOFTINTS	1
 endif
 
-ifdef __HAVE_UNNESTED_INTRS
-define	__HAVE_UNNESTED_INTRS	1
-endif
-
 ifdef ARM_MMU_EXTENDED
 define  ARM_MMU_EXTENDED	1
 endif



CVS commit: src/sys/arch/arm/arm32

2015-04-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr  7 20:36:22 UTC 2015

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Fix two bugs.  pmap_is_cached fix for MULTIPROCESSOR (not just ASID on
local cpu -> any valid ASID on any cpu).
pmap_deactivate: update curcpu()->ci_pmap_cur_asid to KERNEL_PID too.


To generate a diff of this commit:
cvs rdiff -u -r1.317 -r1.318 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.317 src/sys/arch/arm/arm32/pmap.c:1.318
--- src/sys/arch/arm/arm32/pmap.c:1.317	Wed Feb 25 13:52:42 2015
+++ src/sys/arch/arm/arm32/pmap.c	Tue Apr  7 20:36:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.317 2015/02/25 13:52:42 joerg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.318 2015/04/07 20:36:21 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -215,7 +215,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.317 2015/02/25 13:52:42 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.318 2015/04/07 20:36:21 matt Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -924,9 +924,18 @@ static inline bool
 pmap_is_cached(pmap_t pm)
 {
 #ifdef ARM_MMU_EXTENDED
+	if (pm == pmap_kernel())
+		return true;
+#ifdef MULTIPROCESSOR
+	// Is this pmap active on any CPU?
+	if (!kcpuset_iszero(pm->pm_active))
+		return true;
+#else
 	struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
-	if (pm == pmap_kernel() || PMAP_PAI_ASIDVALID_P(PMAP_PAI(pm, ti), ti))
+	// Is this pmap active?
+	if (PMAP_PAI_ASIDVALID_P(PMAP_PAI(pm, ti), ti))
 		return true;
+#endif
 #else
 	struct cpu_info * const ci = curcpu();
 	if (pm == pmap_kernel() || ci->ci_pmap_lastuser == NULL
@@ -4937,6 +4946,7 @@ pmap_deactivate(struct lwp *l)
 	pmap_tlb_asid_deactivate(pm);
 	cpu_setttb(pmap_kernel()->pm_l1_pa, KERNEL_PID);
 	ci->ci_pmap_cur = pmap_kernel();
+	ci->ci_pmap_asid_cur = KERNEL_PID;
 	kpreempt_enable();
 #else
 	/*



CVS commit: src/external/zlib/pigz/bin/pigz

2015-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 17:48:13 UTC 2015

Modified Files:
src/external/zlib/pigz/bin/pigz: Makefile

Log Message:
From: Joachim Henke

In -current, build.sh fails due to missing zless/zless.1. The attached
patch brings external/zlib/pigz/bin/pigz/Makefile in sync with
usr.bin/gzip/Makefile, which fixes the build.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/zlib/pigz/bin/pigz/Makefile

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

Modified files:

Index: src/external/zlib/pigz/bin/pigz/Makefile
diff -u src/external/zlib/pigz/bin/pigz/Makefile:1.8 src/external/zlib/pigz/bin/pigz/Makefile:1.9
--- src/external/zlib/pigz/bin/pigz/Makefile:1.8	Sun Jun 15 13:54:55 2014
+++ src/external/zlib/pigz/bin/pigz/Makefile	Tue Apr  7 13:48:13 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2014/06/15 17:54:55 tls Exp $
+#	$NetBSD: Makefile,v 1.9 2015/04/07 17:48:13 christos Exp $
 
 .include 
 
@@ -33,7 +33,8 @@ MLINKS+=	pigz.1 gzip.1 \
 		pigz.1 zcat.1 \
 		zdiff.1 zcmp.1 \
 		zgrep.1 zegrep.1 \
-		zgrep.1 zfgrep.1
+		zgrep.1 zfgrep.1 \
+		zmore.1 zless.1
 
 LINKS+=		${BINDIR}/pigz ${BINDIR}/gzip \
 		${BINDIR}/pigz ${BINDIR}/gunzip \
@@ -41,7 +42,8 @@ LINKS+=		${BINDIR}/pigz ${BINDIR}/gzip \
 		${BINDIR}/pigz ${BINDIR}/zcat \
 		${BINDIR}/zdiff ${BINDIR}/zcmp \
 		${BINDIR}/zgrep ${BINDIR}/zegrep \
-		${BINDIR}/zgrep ${BINDIR}/zfgrep
+		${BINDIR}/zgrep ${BINDIR}/zfgrep \
+		${BINDIR}/zmore ${BINDIR}/zless
 .endif
 
 .include 



CVS commit: src/usr.bin/awk

2015-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 17:49:40 UTC 2015

Removed Files:
src/usr.bin/awk: Makefile TODO awk.1

Log Message:
remove ancient dup.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r0 src/usr.bin/awk/Makefile
cvs rdiff -u -r1.3 -r0 src/usr.bin/awk/TODO
cvs rdiff -u -r1.19 -r0 src/usr.bin/awk/awk.1

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



CVS commit: src/usr.sbin/makemandb

2015-04-07 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Apr  7 17:47:10 UTC 2015

Modified Files:
src/usr.sbin/makemandb: makemandb.c

Log Message:
largely apply patch from PR bin/47392 by Abhinav Upadhyay

change some comments to reflect reality, a variable name to enhance
readability, and adds an assert for safety.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makemandb/makemandb.c

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

Modified files:

Index: src/usr.sbin/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.28 src/usr.sbin/makemandb/makemandb.c:1.29
--- src/usr.sbin/makemandb/makemandb.c:1.28	Thu Mar 12 14:57:18 2015
+++ src/usr.sbin/makemandb/makemandb.c	Tue Apr  7 17:47:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.28 2015/03/12 14:57:18 joerg Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.29 2015/04/07 17:47:10 plunky Exp $	*/
 /*
  * Copyright (c) 2011 Abhinav Upadhyay 
  * Copyright (c) 2011 Kristaps Dzonsons 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: makemandb.c,v 1.28 2015/03/12 14:57:18 joerg Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.29 2015/04/07 17:47:10 plunky Exp $");
 
 #include 
 #include 
@@ -75,7 +75,7 @@ typedef struct mandb_rec {
 	secbuff errors; // ERRORS
 	char section[2];
 
-	int xr_found;
+	int xr_found; // To track whether a .Xr was seen when parsing a section
 
 	/* Fields for mandb_meta table */
 	char *md5_hash;
@@ -973,12 +973,8 @@ pmdoc_Nm(const struct mdoc_node *n, mand
 static void
 pmdoc_Nd(const struct mdoc_node *n, mandb_rec *rec)
 {
-	/*
-	 * A static variable for keeping track of whether a Xr macro was seen
-	 * previously.
-	 */
 	char *buf = NULL;
-	char *temp;
+	char *name;
 	char *nd_text;
 
 	if (n == NULL || (n->type != MDOC_TEXT && n->tok == MDOC_MAX))
@@ -988,11 +984,12 @@ pmdoc_Nd(const struct mdoc_node *n, mand
 		if (rec->xr_found && n->next) {
 			/*
 			 * An Xr macro was seen previously, so parse this
-			 * and the next node.
+			 * and the next node, as "Name(Section)".
 			 */
-			temp = n->string;
+			name = n->string;
 			n = n->next;
-			easprintf(&buf, "%s(%s)", temp, n->string);
+			assert(n->type == MDOC_TEXT);
+			easprintf(&buf, "%s(%s)", name, n->string);
 			concat(&rec->name_desc, buf);
 			free(buf);
 		} else {



CVS commit: src/etc/rc.d

2015-04-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Apr  7 18:02:11 UTC 2015

Modified Files:
src/etc/rc.d: resize_root

Log Message:
fix typo in previous; pass -y unconditionally to resize_ffs, not -p


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/resize_root

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

Modified files:

Index: src/etc/rc.d/resize_root
diff -u src/etc/rc.d/resize_root:1.2 src/etc/rc.d/resize_root:1.3
--- src/etc/rc.d/resize_root:1.2	Mon Apr  6 22:40:09 2015
+++ src/etc/rc.d/resize_root	Tue Apr  7 18:02:11 2015
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: resize_root,v 1.2 2015/04/06 22:40:09 jmcneill Exp $
+# $NetBSD: resize_root,v 1.3 2015/04/07 18:02:11 jmcneill Exp $
 #
 
 # PROVIDE: resize_root
@@ -82,7 +82,7 @@ resize_root_start()
 
 	if resize_ffs -c $rootdev; then
 		echo "Resizing $rootmp"
-		if ! resize_ffs -p $resize_root_flags $rootdev; then
+		if ! resize_ffs -y $resize_root_flags $rootdev; then
 		echo "Error resizing root."
 		stop_boot
 		fi



CVS commit: src/doc

2015-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 17:41:42 UTC 2015

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new ntp


To generate a diff of this commit:
cvs rdiff -u -r1.1217 -r1.1218 src/doc/3RDPARTY
cvs rdiff -u -r1.2065 -r1.2066 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1217 src/doc/3RDPARTY:1.1218
--- src/doc/3RDPARTY:1.1217	Fri Apr  3 20:03:12 2015
+++ src/doc/3RDPARTY	Tue Apr  7 13:41:42 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1217 2015/04/04 00:03:12 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1218 2015/04/07 17:41:42 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -922,8 +922,8 @@ and ndbootd-raw.c.  Restore saved config
 HAVE_STRICT_ALIGNMENT.  Fix RCS IDs, import.
 
 Package:	ntp
-Version:	4.2.8
-Current Vers:	4.2.8
+Version:	4.2.8p2
+Current Vers:	4.2.8p2
 Maintainer:	David L. Mills 
 Archive Site:	http://www.ntp.org/
 Home Page:	http://www.ntp.org/, http://support.ntp.org/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2065 src/doc/CHANGES:1.2066
--- src/doc/CHANGES:1.2065	Mon Apr  6 13:59:10 2015
+++ src/doc/CHANGES	Tue Apr  7 13:41:42 2015
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2065 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2066 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -150,3 +150,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	wpa: Import wpa_supplicant and hostapd 2.4. [christos 20150401]
 	OpenSSH: Imported 6.8. [christos 20150403]
 	btmagic(4): add Magic Trackpad support [bouyer 20150406]
+	ntp: Import ntp 4.2.8p2. [christos 20150407]



CVS commit: src/usr.bin/man

2015-04-07 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Apr  7 10:17:21 UTC 2015

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
change _whatdb => _mandb as that is the correct keyword here,
and move it to the correct position in the list.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/man/man.conf.5

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

Modified files:

Index: src/usr.bin/man/man.conf.5
diff -u src/usr.bin/man/man.conf.5:1.25 src/usr.bin/man/man.conf.5:1.26
--- src/usr.bin/man/man.conf.5:1.25	Tue Mar  3 17:59:32 2015
+++ src/usr.bin/man/man.conf.5	Tue Apr  7 10:17:21 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: man.conf.5,v 1.25 2015/03/03 17:59:32 christos Exp $
+.\"	$NetBSD: man.conf.5,v 1.26 2015/04/07 10:17:21 plunky Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -116,6 +116,20 @@ in the shell command line, and it will
 be replaced by the name of the output file.
 .It _default
 Contains the system-wide default man path used to search for man pages.
+.It _mandb
+Defines the full pathname (not just a directory path) for a database to
+be used
+by the
+.Xr apropos 1
+and
+.Xr whatis 1
+commands.
+The pathname may contain the normal shell globbing characters,
+including curly braces
+.Pq Dq {} ;
+to escape a shell globbing character,
+precede it with a backslash
+.Pq Dq \e .
 .It _subdir
 Contains the list (in search order) of section subdirectories which will
 be searched in any man path directory named with a trailing slash
@@ -142,20 +156,6 @@ including curly braces
 .Pq Dq {} ) .
 .It _version
 Contains the version of the configuration file.
-.It _whatdb
-Defines the full pathname (not just a directory path) for a database to
-be used
-by the
-.Xr apropos 1
-and
-.Xr whatis 1
-commands.
-The pathname may contain the normal shell globbing characters,
-including curly braces
-.Pq Dq {} ;
-to escape a shell globbing character,
-precede it with a backslash
-.Pq Dq \e .
 .It _ Ns Aq machine
 Defines additional paths to be searched for the particular
 .Dv machine



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  7 07:58:56 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: usb_subr.c

Log Message:
Oops.  Fix previous.


To generate a diff of this commit:
cvs rdiff -u -r1.198.2.11 -r1.198.2.12 src/sys/dev/usb/usb_subr.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/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.198.2.11 src/sys/dev/usb/usb_subr.c:1.198.2.12
--- src/sys/dev/usb/usb_subr.c:1.198.2.11	Tue Apr  7 07:16:47 2015
+++ src/sys/dev/usb/usb_subr.c	Tue Apr  7 07:58:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.198.2.11 2015/04/07 07:16:47 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.198.2.12 2015/04/07 07:58:56 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.11 2015/04/07 07:16:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.12 2015/04/07 07:58:56 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1432,7 +1432,7 @@ usbd_fill_deviceinfo(struct usbd_device 
  * if SS, otherwise it means UPS_LOW_SPEED.
  */
 else if (dev->ud_speed == USB_SPEED_SUPER && 
-(s & UPS_PORT_POWER_SS) &&
+(s & UPS_PORT_POWER_SS))
 	err = USB_PORT_POWERED;
 else if (s & UPS_PORT_POWER)
 	err = USB_PORT_POWERED;



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  7 07:16:47 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: usb_subr.c

Log Message:
Deal with super speed port powered reporting.  From Takahiro HAYASHI.


To generate a diff of this commit:
cvs rdiff -u -r1.198.2.10 -r1.198.2.11 src/sys/dev/usb/usb_subr.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/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.198.2.10 src/sys/dev/usb/usb_subr.c:1.198.2.11
--- src/sys/dev/usb/usb_subr.c:1.198.2.10	Mon Apr  6 15:18:13 2015
+++ src/sys/dev/usb/usb_subr.c	Tue Apr  7 07:16:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.198.2.10 2015/04/06 15:18:13 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.198.2.11 2015/04/07 07:16:47 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.10 2015/04/06 15:18:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.11 2015/04/07 07:16:47 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1427,6 +1427,13 @@ usbd_fill_deviceinfo(struct usbd_device 
 	err = USB_PORT_ENABLED;
 else if (s & UPS_SUSPEND)
 	err = USB_PORT_SUSPENDED;
+/*
+ * UPS_PORT_POWER_SS is available only
+ * if SS, otherwise it means UPS_LOW_SPEED.
+ */
+else if (dev->ud_speed == USB_SPEED_SUPER && 
+(s & UPS_PORT_POWER_SS) &&
+	err = USB_PORT_POWERED;
 else if (s & UPS_PORT_POWER)
 	err = USB_PORT_POWERED;
 else



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  7 07:11:58 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhcivar.h

Log Message:
Some quirk flags.  From Takahiro HAYASHI.


To generate a diff of this commit:
cvs rdiff -u -r1.4.12.3 -r1.4.12.4 src/sys/dev/usb/xhcivar.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/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.4.12.3 src/sys/dev/usb/xhcivar.h:1.4.12.4
--- src/sys/dev/usb/xhcivar.h:1.4.12.3	Thu Mar 19 17:26:43 2015
+++ src/sys/dev/usb/xhcivar.h	Tue Apr  7 07:11:58 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.4.12.3 2015/03/19 17:26:43 skrll Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.4.12.4 2015/04/07 07:11:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -109,6 +109,10 @@ struct xhci_softc {
 
 	bool sc_ac64;
 	bool sc_dying;
+
+	int sc_quirks;
+#define XHCI_QUIRK_FORCE_INTR	__BIT(0) /* force interrupt reading */
+#define XHCI_QUIRK_INTEL	__BIT(1) /* Intel xhci chip */
 };
 
 int	xhci_init(struct xhci_softc *);