CVS commit: src/tests/net/ndp

2017-11-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Nov 25 07:58:47 UTC 2017

Modified Files:
src/tests/net/ndp: t_ra.sh

Log Message:
Make this test somewhat deterministic - far fewer races, and most
of what are left are "race for the bus" type - if we lose, we just
wait for the next one ... slower but still reliable.

There are two exceptions ... when starting more than one rtadvd
(on different routers) we expect to receive an RA from each, but
all that we can check is that we received the (at least) right number
of RAs.  It is possible (though unlikely) that one router sent two
before another sent any, in which case we will not have the data we
expect, and a sub-test will fail.

Second, there is no way to know for sure that we have waited long
enough when we're waiting for data to expire - in systems with
correctly working clocks that actually measure time, this should not
be an issue, if data is due to expire in < 5 seconds, and we wait
5 seconds, and the data is still there, then that indicates a
failure, which should be detected.   Unfortunately with QEMU testing
time just isn't that reliable.  But fortunately, it is generally the
sleep which takes longer, while other timers run correctly, which is
the way that makes us happy...

While here lots of cleanups - everything from white space and
line wrapping, to removing superfluous quotes and adding some
(but probably not enough) that are not (though given the data is
all known here, lack of quotes will rarely hurt.)

Also take note of the fact that current rtadvd *cannot* delete its
pidfile, so waiting for that file to be removed is doomed to failure.
Do things in a way that works, rather than simply resorting to assassination.

Because we do a lot less "sleep and hope it is long enough" and more
"wait until it is observed to happen" the tests generally run in less
elapsed time than before (20% less has been observed.)  But because we
"wait until it is observed to happen" rather than just "sleep and hope
it is long enough" sometimes things take longer (and when that happens,
we no longer fail).  Up to 7% slower (overall) has been observed.
(Observations on an amd64 DomU, no idea yet as to what QEMU might observe.)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/net/ndp/t_ra.sh

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



CVS commit: src/sys/arch/evbarm/conf

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 25 04:53:24 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: ARMADILLO-IOT-G3 DNS323 HUMMINGBOARD
PARALLELLA POGO ROCKCHIP VTC100 ZEDBOARD

Log Message:
comment out duplicate options and unknown devices


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/ARMADILLO-IOT-G3
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/DNS323
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/HUMMINGBOARD \
src/sys/arch/evbarm/conf/PARALLELLA src/sys/arch/evbarm/conf/ZEDBOARD
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/POGO
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/ROCKCHIP
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/VTC100

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/ARMADILLO-IOT-G3
diff -u src/sys/arch/evbarm/conf/ARMADILLO-IOT-G3:1.9 src/sys/arch/evbarm/conf/ARMADILLO-IOT-G3:1.10
--- src/sys/arch/evbarm/conf/ARMADILLO-IOT-G3:1.9	Thu Sep 14 03:58:40 2017
+++ src/sys/arch/evbarm/conf/ARMADILLO-IOT-G3	Fri Nov 24 23:53:24 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ARMADILLO-IOT-G3,v 1.9 2017/09/14 07:58:40 mrg Exp $
+# $NetBSD: ARMADILLO-IOT-G3,v 1.10 2017/11/25 04:53:24 christos Exp $
 #
 # ARMADILLO-IOT-G3 -- Atmark Techno, Armadillo-IoT G3
 #
@@ -79,7 +79,7 @@ include 	"conf/compat_netbsd60.config"
 options 	COMPAT_NETBSD32	# allow running arm (e.g. non-earm) binaries
 
 #options 	COMPAT_NDIS	# NDIS network driver
-options 	COMPAT_NETBSD32	# allow running arm (e.g. non-earm) binaries
+#options 	COMPAT_NETBSD32	# allow running arm (e.g. non-earm) binaries
 options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
 
 # Wedge support

Index: src/sys/arch/evbarm/conf/DNS323
diff -u src/sys/arch/evbarm/conf/DNS323:1.8 src/sys/arch/evbarm/conf/DNS323:1.9
--- src/sys/arch/evbarm/conf/DNS323:1.8	Thu Aug 20 21:52:07 2015
+++ src/sys/arch/evbarm/conf/DNS323	Fri Nov 24 23:53:24 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: DNS323,v 1.8 2015/08/21 01:52:07 uebayasi Exp $
+#	$NetBSD: DNS323,v 1.9 2017/11/25 04:53:24 christos Exp $
 #
 #  DNS323 -- D-Link. DNS-323 platform kernel
 #
@@ -19,8 +19,8 @@ options 	DIAGNOSTIC	# internal consisten
 options 	DEBUG
 #options 	PMAP_DEBUG	# Enable pmap_debug_level code
 #options 	VERBOSE_INIT_ARM # verbose bootstraping messages
-options 	DDB		# in-kernel debugger
-pseudo-device	ksyms
+#options 	DDB		# in-kernel debugger
+#pseudo-device	ksyms
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	KGDB
 #options 	DEBUG_KGDB

Index: src/sys/arch/evbarm/conf/HUMMINGBOARD
diff -u src/sys/arch/evbarm/conf/HUMMINGBOARD:1.2 src/sys/arch/evbarm/conf/HUMMINGBOARD:1.3
--- src/sys/arch/evbarm/conf/HUMMINGBOARD:1.2	Thu Nov  9 00:57:23 2017
+++ src/sys/arch/evbarm/conf/HUMMINGBOARD	Fri Nov 24 23:53:24 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: HUMMINGBOARD,v 1.2 2017/11/09 05:57:23 hkenken Exp $
+#	$NetBSD: HUMMINGBOARD,v 1.3 2017/11/25 04:53:24 christos Exp $
 #
 #	Hummingboard -- Freescale i.MX6 Eval Board Kernel
 #
@@ -22,7 +22,7 @@ options 	MULTIPROCESSOR
 options 	CONSDEVNAME="\"imxuart\"",CONADDR=0x0202
 options 	CONSPEED=115200	# Console speed
 
-options		DIAGNOSTIC  # internal consistency checks
+#options		DIAGNOSTIC  # internal consistency checks
 options		DEBUG
 #options 	KGDB
 makeoptions	DEBUG="-g"	# compile full symbol table
Index: src/sys/arch/evbarm/conf/PARALLELLA
diff -u src/sys/arch/evbarm/conf/PARALLELLA:1.2 src/sys/arch/evbarm/conf/PARALLELLA:1.3
--- src/sys/arch/evbarm/conf/PARALLELLA:1.2	Fri Apr 10 06:58:07 2015
+++ src/sys/arch/evbarm/conf/PARALLELLA	Fri Nov 24 23:53:24 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: PARALLELLA,v 1.2 2015/04/10 10:58:07 hkenken Exp $
+#	$NetBSD: PARALLELLA,v 1.3 2017/11/25 04:53:24 christos Exp $
 #
 #	Parallella -- Xilinx Zynq Eval Board Kernel
 #
@@ -26,7 +26,7 @@ options		MEMSIZE=1024
 options 	CONSDEVNAME="\"zynquart\"",CONADDR=0xe0001000
 options 	CONSPEED=115200	# Console speed
 
-options DIAGNOSTIC  # internal consistency checks
+#options DIAGNOSTIC  # internal consistency checks
 #optionsDEBUG
 #options 	KGDB
 makeoptions	DEBUG="-g"	# compile full symbol table
Index: src/sys/arch/evbarm/conf/ZEDBOARD
diff -u src/sys/arch/evbarm/conf/ZEDBOARD:1.2 src/sys/arch/evbarm/conf/ZEDBOARD:1.3
--- src/sys/arch/evbarm/conf/ZEDBOARD:1.2	Fri Apr 10 06:58:07 2015
+++ src/sys/arch/evbarm/conf/ZEDBOARD	Fri Nov 24 23:53:24 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: ZEDBOARD,v 1.2 2015/04/10 10:58:07 hkenken Exp $
+#	$NetBSD: ZEDBOARD,v 1.3 2017/11/25 04:53:24 christos Exp $
 #
 #	ZedBoard -- Xilinx Zynq Eval Board Kernel
 #
@@ -25,7 +25,7 @@ options		MEMSIZE=512
 options 	CONSDEVNAME="\"zynquart\"",CONADDR=0xe0001000
 options 	CONSPEED=115200	# Console speed
 
-options DIAGNOSTIC  # internal consistency checks
+#options DIAGNOSTIC  # internal 

CVS commit: src/sys/arch/evbarm/conf

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 25 04:53:24 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: ARMADILLO-IOT-G3 DNS323 HUMMINGBOARD
PARALLELLA POGO ROCKCHIP VTC100 ZEDBOARD

Log Message:
comment out duplicate options and unknown devices


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/ARMADILLO-IOT-G3
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/DNS323
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/HUMMINGBOARD \
src/sys/arch/evbarm/conf/PARALLELLA src/sys/arch/evbarm/conf/ZEDBOARD
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/POGO
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/ROCKCHIP
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/VTC100

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



CVS commit: src/sys/arch/evbarm/conf

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 25 04:22:43 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: OPENRD

Log Message:
we don't need manual removals now that config has been fixed


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/OPENRD

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/OPENRD
diff -u src/sys/arch/evbarm/conf/OPENRD:1.7 src/sys/arch/evbarm/conf/OPENRD:1.8
--- src/sys/arch/evbarm/conf/OPENRD:1.7	Mon Nov 20 19:47:38 2017
+++ src/sys/arch/evbarm/conf/OPENRD	Fri Nov 24 23:22:42 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: OPENRD,v 1.7 2017/11/21 00:47:38 christos Exp $
+#	$NetBSD: OPENRD,v 1.8 2017/11/25 04:22:42 christos Exp $
 #
 # This is a working config file for OpenRD(.org) Client.  Note that the
 # default boot address will not work and the kernel has to load at 8MB
@@ -28,7 +28,3 @@ wsdisplay*	at vga? console ?
 # mvsdio doesn't currently function on OPENRD
 # Tested on OpenRD-Client
 no mvsdio
-no sdmmc* at mvsdio?
-no ld* at sdmmc?
-no sbt* at sdmmc?
-



CVS commit: src/sys/arch/evbarm/conf

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 25 04:22:43 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: OPENRD

Log Message:
we don't need manual removals now that config has been fixed


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/OPENRD

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



CVS commit: src/sys/arch/sparc/sparc

2017-11-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Nov 25 04:11:37 UTC 2017

Modified Files:
src/sys/arch/sparc/sparc: locore.s

Log Message:
Avoid an instruction requiring a higher alignment than we are guaranteed

Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/arch/sparc/sparc/locore.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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.268 src/sys/arch/sparc/sparc/locore.s:1.269
--- src/sys/arch/sparc/sparc/locore.s:1.268	Sun Nov  4 00:32:47 2012
+++ src/sys/arch/sparc/sparc/locore.s	Sat Nov 25 04:11:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.268 2012/11/04 00:32:47 chs Exp $	*/
+/*	$NetBSD: locore.s,v 1.269 2017/11/25 04:11:37 maya Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -6288,8 +6288,9 @@ ENTRY(longjmp)
 	cmp	%fp, %g7	! compare against desired frame
 	bl,a	1b		! if below,
 	 restore		!pop frame and loop
-	be,a	2f		! if there,
-	 ldd	[%g1+0], %o2	!fetch return %sp and pc, and get out
+	ld	[%g1+0], %o2	! fetch return %sp
+	be,a	2f		! we're there, get out
+	 ld	[%g1+4], %o3	! fetch return pc
 
 Llongjmpbotch:
 ! otherwise, went too far; bomb out



CVS commit: src/sys/arch/sparc/sparc

2017-11-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Nov 25 04:11:37 UTC 2017

Modified Files:
src/sys/arch/sparc/sparc: locore.s

Log Message:
Avoid an instruction requiring a higher alignment than we are guaranteed

Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/arch/sparc/sparc/locore.s

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



CVS commit: src/usr.sbin/rtadvd

2017-11-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Nov 25 02:37:04 UTC 2017

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

Log Message:
When sending log messages to stderr, append the \n that syslog does not need.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/rtadvd/rtadvd.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/rtadvd/rtadvd.c
diff -u src/usr.sbin/rtadvd/rtadvd.c:1.58 src/usr.sbin/rtadvd/rtadvd.c:1.59
--- src/usr.sbin/rtadvd/rtadvd.c:1.58	Mon Nov  6 19:12:23 2017
+++ src/usr.sbin/rtadvd/rtadvd.c	Sat Nov 25 02:37:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.c,v 1.58 2017/11/06 19:12:23 joerg Exp $	*/
+/*	$NetBSD: rtadvd.c,v 1.59 2017/11/25 02:37:04 kre Exp $	*/
 /*	$KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -1864,6 +1864,7 @@ expandm(char *buf, size_t len, const cha
 		buf[cur] = '\0';
 	}
 	strlcat(buf, fmt, len);
+	strlcat(buf, "\n", len); /* syslog does not need \n, printf does */
 	return buf;
 }
 



CVS commit: src/usr.sbin/rtadvd

2017-11-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Nov 25 02:37:04 UTC 2017

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

Log Message:
When sending log messages to stderr, append the \n that syslog does not need.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/rtadvd/rtadvd.c

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



CVS commit: src/usr.bin/config

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 23:42:36 UTC 2017

Modified Files:
src/usr.bin/config: main.c

Log Message:
- Instead of checking the recursion level before we recurse, check in on
  function entry.
- Always decrement the level and reset levelparent on exit.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/config/main.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.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.94 src/usr.bin/config/main.c:1.95
--- src/usr.bin/config/main.c:1.94	Sat Nov 18 13:39:16 2017
+++ src/usr.bin/config/main.c	Fri Nov 24 18:42:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.94 2017/11/18 18:39:16 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.95 2017/11/24 23:42:36 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.94 2017/11/18 18:39:16 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.95 2017/11/24 23:42:36 christos Exp $");
 
 #ifndef MAKE_BOOTSTRAP
 #include 
@@ -1868,27 +1868,30 @@ check_dead_devi(const char *key, void *v
 	return 0;
 }
 
-static int
-is_orphan_loop(const struct devbase *d, const struct devbase *p)
-{
-
-	for (; p && d != p; p = p->d_levelparent)
-		continue;
-	return d == p;
-}
+static struct devbase root;
 
-static void
+static int
 addlevelparent(struct devbase *d, struct devbase *parent)
 {
 	struct devbase *p;
 
-	if (d->d_levelparent)
-		return;
+	if (d == parent) {
+		if (d->d_level++ > 1)
+			return 0;
+		return 1;
+	}
+
+	if (d->d_levelparent) {
+		if (d->d_level++ > 1)
+			return 0;
+		return 1;
+	}
 
 	for (p = parent; p != NULL; p = p->d_levelparent)
-		if (d == p)
-			return;
-	d->d_levelparent = p;
+		if (d == p && d->d_level++ > 1)
+			return 0;
+	d->d_levelparent = p ? p :  
+	return 1;
 }
 
 static void
@@ -1902,7 +1905,8 @@ do_kill_orphans(struct devbase *d, struc
 	struct pspec *p;
 	int active = 0;
 
-	addlevelparent(d, parent);
+	if (!addlevelparent(d, parent))
+		return;
 
 	/*
 	 * A pseudo-device will always attach at root, and if it has an
@@ -1970,7 +1974,7 @@ do_kill_orphans(struct devbase *d, struc
 		 * If we've been there but have made no change, stop.
 		 */
 		if (seen && active != DEVI_ACTIVE)
-			return;
+			goto out;
 		if (active != DEVI_ACTIVE) {
 			struct cdd_params cdd = { d, at, parent };
 			/* Look for a matching dead devi */
@@ -1990,22 +1994,19 @@ do_kill_orphans(struct devbase *d, struc
 CFGDBG(5, "`%s' at '%s' ignored", d->d_name,
 parent ? parent->d_name : "(root)");
 
-			} else
-return;
+			}
 		}
 	}
 
 	for (al = d->d_attrs; al != NULL; al = al->al_next) {
 		a = al->al_this;
 		for (nv1 = a->a_devs; nv1 != NULL; nv1 = nv1->nv_next) {
-			if (is_orphan_loop(nv1->nv_ptr, d)) {
-if (d->d_level++ > 1)
-	continue;
-			}
 			do_kill_orphans(nv1->nv_ptr, a, d, active);
 		}
 	}
+out:
 	d->d_levelparent = NULL;
+	d->d_level--;
 }
 
 static int



CVS commit: src/usr.bin/config

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 23:42:36 UTC 2017

Modified Files:
src/usr.bin/config: main.c

Log Message:
- Instead of checking the recursion level before we recurse, check in on
  function entry.
- Always decrement the level and reset levelparent on exit.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/config/main.c

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



CVS commit: src/tests/lib/libc/locale

2017-11-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Nov 24 21:30:43 UTC 2017

Modified Files:
src/tests/lib/libc/locale: t_sprintf.c

Log Message:
When comparing doubles (any floating point values) which have been
computed using different methods, don't expect to achieve identical
results (here, one constant is perhaps converted to binary from a string by
a cross compiler, the other is converted at run time).   Allow them to
have a small difference (for now, small is < 1e-7 - the constant is ~ 1e5,
so this is 12 orders of magnitude less) before failing (and include the
actual difference in the error message if it does fail.)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/locale/t_sprintf.c

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

Modified files:

Index: src/tests/lib/libc/locale/t_sprintf.c
diff -u src/tests/lib/libc/locale/t_sprintf.c:1.4 src/tests/lib/libc/locale/t_sprintf.c:1.5
--- src/tests/lib/libc/locale/t_sprintf.c:1.4	Thu Nov 23 23:47:09 2017
+++ src/tests/lib/libc/locale/t_sprintf.c	Fri Nov 24 21:30:43 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sprintf.c,v 1.4 2017/11/23 23:47:09 kre Exp $ */
+/* $NetBSD: t_sprintf.c,v 1.5 2017/11/24 21:30:43 kre Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,9 +32,10 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2017\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sprintf.c,v 1.4 2017/11/23 23:47:09 kre Exp $");
+__RCSID("$NetBSD: t_sprintf.c,v 1.5 2017/11/24 21:30:43 kre Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -125,7 +126,7 @@ h_sprintf(const struct test *t)
 static void
 h_strto(const struct test *t)
 {
-	double d;
+	double d, diff;
 
 	ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
 	printf("Trying locale %s...\n", t->locale);
@@ -133,9 +134,11 @@ h_strto(const struct test *t)
 
 	ATF_REQUIRE_EQ((int)strtol(t->int_input, NULL, 10), t->int_value);
 	d = strtod(t->double_input, NULL);
-	ATF_REQUIRE_EQ_MSG(d, t->double_value, "In %s: "
-	"strtod(t->double_input[%s], NULL)[%g] != t->double_value[%g]",
-	t->locale, t->double_input, d, t->double_value);
+	if ((diff = fabs(d - t->double_value)) > 1e-7)
+		ATF_REQUIRE_EQ_MSG(d, t->double_value, "In %s: d=strtod("
+		"t->double_input[%s], NULL)[%.9g] != t->double_value[%.9g]"
+		": diff=%g", t->locale, t->double_input, d,
+		t->double_value, diff);
 }
 
 static void



CVS commit: src/tests/lib/libc/locale

2017-11-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Nov 24 21:30:43 UTC 2017

Modified Files:
src/tests/lib/libc/locale: t_sprintf.c

Log Message:
When comparing doubles (any floating point values) which have been
computed using different methods, don't expect to achieve identical
results (here, one constant is perhaps converted to binary from a string by
a cross compiler, the other is converted at run time).   Allow them to
have a small difference (for now, small is < 1e-7 - the constant is ~ 1e5,
so this is 12 orders of magnitude less) before failing (and include the
actual difference in the error message if it does fail.)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/locale/t_sprintf.c

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



CVS commit: src/usr.bin/config

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 18:45:59 UTC 2017

Modified Files:
src/usr.bin/config: sem.c

Log Message:
Tidy up error messages, line wraps, initialization. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/config/sem.c

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



CVS commit: src/usr.bin/config

2017-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 18:45:59 UTC 2017

Modified Files:
src/usr.bin/config: sem.c

Log Message:
Tidy up error messages, line wraps, initialization. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/config/sem.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.bin/config/sem.c
diff -u src/usr.bin/config/sem.c:1.80 src/usr.bin/config/sem.c:1.81
--- src/usr.bin/config/sem.c:1.80	Sat Nov 18 19:41:10 2017
+++ src/usr.bin/config/sem.c	Fri Nov 24 13:45:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sem.c,v 1.80 2017/11/19 00:41:10 kre Exp $	*/
+/*	$NetBSD: sem.c,v 1.81 2017/11/24 18:45:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: sem.c,v 1.80 2017/11/19 00:41:10 kre Exp $");
+__RCSID("$NetBSD: sem.c,v 1.81 2017/11/24 18:45:59 christos Exp $");
 
 #include 
 #include 
@@ -214,7 +214,8 @@ fixdev(struct devbase *dev)
 	CFGDBG(4, "fixing devbase `%s'", dev->d_name);
 	for (al = dev->d_attrs; al != NULL; al = al->al_next) {
 		a = al->al_this;
-		CFGDBG(4, "fixing devbase `%s' attr `%s'", dev->d_name, a->a_name);
+		CFGDBG(4, "fixing devbase `%s' attr `%s'", dev->d_name,
+		a->a_name);
 		if (a->a_iattr) {
 			a->a_refs = addtoattr(a->a_refs, dev);
 			CFGDBG(3, "device `%s' has iattr `%s'", dev->d_name,
@@ -228,8 +229,8 @@ fixdev(struct devbase *dev)
 			}
 			if (dev->d_classattr == NULL) {
 dev->d_classattr = a;
-CFGDBG(3, "device `%s' is devclass `%s'", dev->d_name,
-a->a_name);
+CFGDBG(3, "device `%s' is devclass `%s'",
+dev->d_name, a->a_name);
 			}
 		} else {
 			if (strcmp(dev->d_name, a->a_name) != 0) {
@@ -396,7 +397,7 @@ defiattr(const char *name, struct loclis
 	struct loclist *ll;
 
 	if (devclass)
-		panic("defattr(%s): locators and devclass", name);
+		panic("%s: %s has both locators and devclass", __func__, name);
 
 	if (defattr(name, locs, deps, devclass) != 0)
 		return (1);
@@ -426,7 +427,8 @@ defdevclass(const char *name, struct loc
 	int errored = 0;
 
 	if (deps)
-		panic("defattr(%s): dependencies and devclass", name);
+		panic("%s: %s has both dependencies and devclass", __func__,
+		name);
 
 	if (defattr(name, locs, deps, devclass) != 0)
 		return (1);
@@ -434,9 +436,9 @@ defdevclass(const char *name, struct loc
 	a = getattr(name);
 	(void)snprintf(classenum, sizeof(classenum), "DV_%s", name);
 	for (cp = classenum + 3; *cp; cp++) {
-		if (!errored &&
-		(!isalnum((unsigned char)*cp) ||
-		  (isalpha((unsigned char)*cp) && !islower((unsigned char)*cp {
+		if (!errored && (!isalnum((unsigned char)*cp) ||
+		  (isalpha((unsigned char)*cp)
+		  && !islower((unsigned char)*cp {
 			cfgerror("device class names must be "
 			"lower-case alphanumeric characters");
 			errored = 1;
@@ -625,7 +627,7 @@ getdevbase(const char *name)
 		dev->d_umax = 0;
 		TAILQ_INSERT_TAIL(, dev, d_next);
 		if (ht_insert(devbasetab, name, dev))
-			panic("getdevbase(%s)", name);
+			panic("%s: Can't insert %s", __func__, name);
 		CFGDBG(3, "devbase defined `%s'", dev->d_name);
 	}
 	return (dev);
@@ -765,7 +767,7 @@ getdevattach(const char *name)
 		deva->d_ipp = >d_ihead;
 		TAILQ_INSERT_TAIL(, deva, d_next);
 		if (ht_insert(devatab, name, deva))
-			panic("getdeva(%s)", name);
+			panic("%s: Can't insert %s", __func__, name);
 	}
 	return (deva);
 }
@@ -938,7 +940,7 @@ resolve(struct nvlist **nvp, const char 
 	char buf[NAMESIZE];
 
 	if ((part -= 'a') >= maxpartitions || part < 0)
-		panic("resolve");
+		panic("%s: Bad partition %c", __func__, part);
 	if ((nv = *nvp) == NULL) {
 		dev_t	d = NODEV;
 		/*
@@ -,7 +1113,7 @@ delconf(const char *name, int nowarn)
 		if (!strcmp(cf->cf_name, name))
 			break;
 	if (cf == NULL)
-		panic("lost configuration `%s'", name);
+		panic("%s: lost configuration for %s", __func__, name);
 
 	TAILQ_REMOVE(, cf, cf_next);
 }
@@ -1251,14 +1253,12 @@ adddev(const char *name, const char *at,
 	struct devbase *ab;	/* not NULL => at another dev */
 	struct deva *iba;	/* devbase attachment used */
 	struct deva *lastiba;
-	int atunit;
+	int atunit, first;
 
 	lastiba = NULL;
 	if ((i = getdevi(name)) == NULL)
 		goto bad;
 	ib = i->i_base;
-	iba = NULL;
-	p = NULL;
 	attr = finddevattr(name, at, ib, , );
 	if (attr == NULL) {
 		i->i_active = DEVI_BROKEN;
@@ -1271,11 +1271,13 @@ adddev(const char *name, const char *at,
 			attr ==  ? NULL : attr))
 break;
 
+		first = lastiba == ib->d_ahead;
 		if (iba == NULL) {
-			if (lastiba != ib->d_ahead)
+			if (!first)
 goto bad;
 			if (attr != ) {
-panic("adddev: can't figure out attachment");
+panic("%s: can't figure out attachment",
+__func__);
 			} else {
 cfgerror("`%s' cannot attach to the root",
 ib->d_name);
@@ -1283,7 +1285,7 @@ adddev(const char *name, const char *at,
 			}
 		}
 		

CVS commit: src/sys/dev/hdaudio

2017-11-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov 24 17:51:10 UTC 2017

Modified Files:
src/sys/dev/hdaudio: hdaudio.c

Log Message:
Always go through RIRB startup process, initialize RIRB interrupt count
register, and ack RIRBs as we process them in polling mode.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hdaudio/hdaudio.c

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



CVS commit: src/sys/dev/hdaudio

2017-11-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov 24 17:51:10 UTC 2017

Modified Files:
src/sys/dev/hdaudio: hdaudio.c

Log Message:
Always go through RIRB startup process, initialize RIRB interrupt count
register, and ack RIRBs as we process them in polling mode.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hdaudio/hdaudio.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/hdaudio/hdaudio.c
diff -u src/sys/dev/hdaudio/hdaudio.c:1.7 src/sys/dev/hdaudio/hdaudio.c:1.8
--- src/sys/dev/hdaudio/hdaudio.c:1.7	Fri Nov 24 14:00:04 2017
+++ src/sys/dev/hdaudio/hdaudio.c	Fri Nov 24 17:51:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.7 2017/11/24 14:00:04 jmcneill Exp $ */
+/* $NetBSD: hdaudio.c,v 1.8 2017/11/24 17:51:10 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.7 2017/11/24 14:00:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.8 2017/11/24 17:51:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -347,6 +347,9 @@ hdaudio_command_unlocked(struct hdaudio_
 	hdaudio_corb_enqueue(sc, co->co_addr, nid, control, param);
 	result = hdaudio_rirb_dequeue(sc, false);
 
+	/* Clear response interrupt status */
+	hda_write1(sc, HDAUDIO_MMIO_RIRBSTS, hda_read1(sc, HDAUDIO_MMIO_RIRBSTS));
+
 	return result;
 }
 
@@ -497,20 +500,21 @@ hdaudio_rirb_start(struct hdaudio_softc 
 	uint8_t rirbctl;
 	int retry = HDAUDIO_RIRB_TIMEOUT;
 
-	/* Start the RIRB if necessary */
+	/* Set the RIRB interrupt count */
+	hda_write2(sc, HDAUDIO_MMIO_RINTCNT, 1);
+
+	/* Start the RIRB */
 	rirbctl = hda_read1(sc, HDAUDIO_MMIO_RIRBCTL);
-	if ((rirbctl & (HDAUDIO_RIRBCTL_RUN|HDAUDIO_RIRBCTL_INT_EN)) == 0) {
-		rirbctl |= HDAUDIO_RIRBCTL_RUN;
-		rirbctl |= HDAUDIO_RIRBCTL_INT_EN;
-		hda_write1(sc, HDAUDIO_MMIO_RIRBCTL, rirbctl);
-		do {
-			hda_delay(10);
-			rirbctl = hda_read1(sc, HDAUDIO_MMIO_RIRBCTL);
-		} while (--retry > 0 && (rirbctl & HDAUDIO_RIRBCTL_RUN) == 0);
-		if (retry == 0) {
-			hda_error(sc, "timeout starting RIRB\n");
-			return ETIME;
-		}
+	rirbctl |= HDAUDIO_RIRBCTL_RUN;
+	rirbctl |= HDAUDIO_RIRBCTL_INT_EN;
+	hda_write1(sc, HDAUDIO_MMIO_RIRBCTL, rirbctl);
+	do {
+		hda_delay(10);
+		rirbctl = hda_read1(sc, HDAUDIO_MMIO_RIRBCTL);
+	} while (--retry > 0 && (rirbctl & HDAUDIO_RIRBCTL_RUN) == 0);
+	if (retry == 0) {
+		hda_error(sc, "timeout starting RIRB\n");
+		return ETIME;
 	}
 
 	return 0;
@@ -558,8 +562,6 @@ static int
 hdaudio_rirb_config(struct hdaudio_softc *sc)
 {
 	uint32_t rirbubase, rirblbase;
-	uint32_t rirbwp;
-	int retry = HDAUDIO_RIRB_TIMEOUT;
 
 	/* Program command buffer base address and size */
 	rirblbase = (uint32_t)DMA_DMAADDR(>sc_rirb);
@@ -570,15 +572,6 @@ hdaudio_rirb_config(struct hdaudio_softc
 
 	/* Clear the write pointer */
 	hda_write2(sc, HDAUDIO_MMIO_RIRBWP, HDAUDIO_RIRBWP_WP_RESET);
-	hda_write2(sc, HDAUDIO_MMIO_RIRBWP, 0);
-	do {
-		hda_delay(10);
-		rirbwp = hda_read2(sc, HDAUDIO_MMIO_RIRBWP);
-	} while (--retry > 0 && (rirbwp & HDAUDIO_RIRBWP_WP_RESET) != 0);
-	if (retry == 0) {
-		hda_error(sc, "timeout resetting RIRB\n");
-		return ETIME;
-	}
 	sc->sc_rirbrp = 0;
 
 	return 0;



CVS commit: src/sys

2017-11-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Nov 24 14:03:25 UTC 2017

Modified Files:
src/sys/netinet: ip_input.c
src/sys/netinet6: in6_src.c ip6_input.c ip6_output.c

Log Message:
Allow local communication over DETACHED addresses.
Allow binding to DETACHED or TENTATIVE addresses as we deny
sending upstream from them anyway.
Prefer non DETACHED or TENTATIVE addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.82 -r1.83 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.193 -r1.194 src/sys/netinet6/ip6_output.c

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



CVS commit: src/sys

2017-11-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Nov 24 14:03:25 UTC 2017

Modified Files:
src/sys/netinet: ip_input.c
src/sys/netinet6: in6_src.c ip6_input.c ip6_output.c

Log Message:
Allow local communication over DETACHED addresses.
Allow binding to DETACHED or TENTATIVE addresses as we deny
sending upstream from them anyway.
Prefer non DETACHED or TENTATIVE addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.82 -r1.83 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.193 -r1.194 src/sys/netinet6/ip6_output.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/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.362 src/sys/netinet/ip_input.c:1.363
--- src/sys/netinet/ip_input.c:1.362	Fri Nov 17 07:37:12 2017
+++ src/sys/netinet/ip_input.c	Fri Nov 24 14:03:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.362 2017/11/17 07:37:12 ozaki-r Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.363 2017/11/24 14:03:25 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.362 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.363 2017/11/24 14:03:25 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -371,11 +371,14 @@ ip_match_our_address(struct ifnet *ifp, 
 continue;
 			if (checkif && ia->ia_ifp != ifp)
 continue;
-			if ((ia->ia_ifp->if_flags & IFF_UP) != 0 &&
-			(ia->ia4_flags & IN_IFF_DETACHED) == 0)
-break;
-			else
+			if ((ia->ia_ifp->if_flags & IFF_UP) == 0) {
 (*downmatch)++;
+continue;
+			}
+			if (ia->ia4_flags & IN_IFF_DETACHED &&
+			(ifp->if_flags & IFF_LOOPBACK) == 0)
+continue;
+			break;
 		}
 	}
 
@@ -392,7 +395,10 @@ ip_match_our_address_broadcast(struct if
 		if (ifa->ifa_addr->sa_family != AF_INET)
 			continue;
 		ia = ifatoia(ifa);
-		if (ia->ia4_flags & (IN_IFF_NOTREADY | IN_IFF_DETACHED))
+		if (ia->ia4_flags & IN_IFF_NOTREADY)
+			continue;
+		if (ia->ia4_flags & IN_IFF_DETACHED &&
+		(ifp->if_flags & IFF_LOOPBACK) == 0)
 			continue;
 		if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) ||
 		in_hosteq(ip->ip_dst, ia->ia_netbroadcast) ||

Index: src/sys/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.82 src/sys/netinet6/in6_src.c:1.83
--- src/sys/netinet6/in6_src.c:1.82	Mon Nov 20 09:01:20 2017
+++ src/sys/netinet6/in6_src.c	Fri Nov 24 14:03:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.82 2017/11/20 09:01:20 ozaki-r Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.83 2017/11/24 14:03:25 roy Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.82 2017/11/20 09:01:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.83 2017/11/24 14:03:25 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -217,10 +217,14 @@ in6_select_best_ia(struct sockaddr_in6 *
 		}
 
 		/* avoid unusable addresses */
-		if ((ia->ia6_flags &
-		 (IN6_IFF_NOTREADY | IN6_IFF_ANYCAST | IN6_IFF_DETACHED))) {
-continue;
-		}
+		if ((ia->ia6_flags & (IN6_IFF_DUPLICATED | IN6_IFF_ANYCAST)))
+			continue;
+		/* Prefer validated addresses */
+		if (!(ia->ia6_flags & (IN6_IFF_TENTATIVE | IN6_IFF_DETACHED)) &&
+		ia_best != NULL &&
+		ia_best->ia6_flags & (IN6_IFF_TENTATIVE | IN6_IFF_DETACHED))
+			REPLACE(0);
+
 		if (!ip6_use_deprecated && IFA6_IS_DEPRECATED(ia))
 			continue;
 
@@ -238,7 +242,7 @@ in6_select_best_ia(struct sockaddr_in6 *
 		}
 
 		if (ia_best == NULL)
-			REPLACE(0);
+			REPLACE(1);
 
 		/* Rule 2: Prefer appropriate scope */
 		if (dst_scope < 0)

Index: src/sys/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.183 src/sys/netinet6/ip6_input.c:1.184
--- src/sys/netinet6/ip6_input.c:1.183	Fri Nov 17 07:37:12 2017
+++ src/sys/netinet6/ip6_input.c	Fri Nov 24 14:03:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_input.c,v 1.183 2017/11/17 07:37:12 ozaki-r Exp $	*/
+/*	$NetBSD: ip6_input.c,v 1.184 2017/11/24 14:03:25 roy Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.183 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.184 2017/11/24 14:03:25 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -501,13 +501,33 @@ ip6_input(struct mbuf *m, struct ifnet *
 #endif
 	rt->rt_ifp->if_type == IFT_LOOP) {
 		struct in6_ifaddr *ia6 = (struct in6_ifaddr *)rt->rt_ifa;
+		int addrok;
+
 		if (ia6->ia6_flags & IN6_IFF_ANYCAST)
 			m->m_flags |= M_ANYCAST6;
 		/*
 		 * packets to a tentative, duplicated, or somehow invalid
 		 * address must not be accepted.
 		 */
-		if (!(ia6->ia6_flags & 

CVS commit: src/sys/dev/hdaudio

2017-11-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov 24 14:00:04 UTC 2017

Modified Files:
src/sys/dev/hdaudio: hdaudio.c

Log Message:
Always access CORBCTL using hda_read1/hda_write1 (it is an 8-bit wide reg).
Reported by Michal Necasek.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hdaudio/hdaudio.c

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



CVS commit: [netbsd-8] src/doc

2017-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 24 08:40:26 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #388 and #389


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.83 -r1.1.2.84 src/doc/CHANGES-8.0

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



CVS commit: [netbsd-8] src/doc

2017-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 24 08:40:26 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #388 and #389


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.83 -r1.1.2.84 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.83 src/doc/CHANGES-8.0:1.1.2.84
--- src/doc/CHANGES-8.0:1.1.2.83	Thu Nov 23 13:42:09 2017
+++ src/doc/CHANGES-8.0	Fri Nov 24 08:40:26 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.83 2017/11/23 13:42:09 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.84 2017/11/24 08:40:26 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -7878,3 +7878,24 @@ sys/kern/kern_softint.c1.44
 	implemented, increase softint_bytes from 8192 to 32768.
 	[msaitoh, ticket #387]
 
+sys/dev/hdaudio/hdaudio.c			1.6
+
+	Enter link reset even if GCTL says we are already in reset state.
+	Fixes hdaudio codec detection under VirtualBox on a "cold" boot.
+	[jmcneill, ticket #388]
+
+
+sys/dev/pci/if_bge.c1.313
+sys/dev/pci/if_wm.c1.544
+sys/dev/pci/if_wmreg.h1.105
+sys/net/if_ether.h1.69-1.70
+sys/net/if_vlan.c1.108,1.110
+sys/net/if_vlanvar.h1.11-1.12
+
+
+	Fix a bug that a vlan packet which has priority or CFI
+	bit in the tag causes panic.
+	Revert part of if_bge.c 1.312, if_wm.c 1.542 and if_wmreg.h 1.104,
+	it's not required to mask other than VLAN ID bits in VLAN tag.
+	[msaitoh, ticket #389]
+



CVS commit: [netbsd-8] src/sys

2017-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 24 08:39:09 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_bge.c if_wm.c if_wmreg.h
src/sys/net [netbsd-8]: if_ether.h if_vlan.c if_vlanvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #389):
sys/net/if_ether.h: revision 1.69
sys/net/if_vlan.c: revision 1.108
sys/dev/pci/if_bge.c: revision 1.313
sys/net/if_vlanvar.h: revision 1.11
sys/net/if_vlanvar.h: revision 1.12
sys/net/if_ether.h: revision 1.70
sys/net/if_vlan.c: revision 1.110
sys/dev/pci/if_wm.c: revision 1.544
sys/dev/pci/if_wmreg.h: revision 1.105
  Fix a bug that a vlan packet which has priority or CFI bit in the tag causes
panic.
  Revert part of if_bge.c 1.312. It's not required to mask other than VLAN ID
bits in VLAN tag.
  Revert if_wmreg.h 1.104 and if_wm.c 1.542. It's not required to mask other
than VLAN ID bits in VLAN tag.
No functional change:
  - u_int16_t -> uint16_t
  - u_short -> uint16_t
  - tag_hash_func -> vlan_tag_hash
  - 0 -> NULL because vlr_parent is a pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.310.2.1 -r1.310.2.2 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.508.4.6 -r1.508.4.7 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.2 -r1.98.6.3 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.66.8.1 -r1.66.8.2 src/sys/net/if_ether.h
cvs rdiff -u -r1.97.2.7 -r1.97.2.8 src/sys/net/if_vlan.c
cvs rdiff -u -r1.9.80.1 -r1.9.80.2 src/sys/net/if_vlanvar.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/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.310.2.1 src/sys/dev/pci/if_bge.c:1.310.2.2
--- src/sys/dev/pci/if_bge.c:1.310.2.1	Tue Oct 24 08:38:59 2017
+++ src/sys/dev/pci/if_bge.c	Fri Nov 24 08:39:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.310.2.1 2017/10/24 08:38:59 snj Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.310.2.2 2017/11/24 08:39:09 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.1 2017/10/24 08:38:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.2 2017/11/24 08:39:09 martin Exp $");
 
 #include 
 #include 
@@ -4607,7 +4607,7 @@ bge_rxeof(struct bge_softc *sc)
 		 * to vlan_input() instead of ether_input().
 		 */
 		if (cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) {
-			vlan_set_tag(m, cur_rx->bge_vlan_tag & ETHER_VLAN_MASK);
+			vlan_set_tag(m, cur_rx->bge_vlan_tag);
 		}
 
 		if_percpuq_enqueue(ifp->if_percpuq, m);

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.6 src/sys/dev/pci/if_wm.c:1.508.4.7
--- src/sys/dev/pci/if_wm.c:1.508.4.6	Wed Nov 22 16:40:42 2017
+++ src/sys/dev/pci/if_wm.c	Fri Nov 24 08:39:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.6 2017/11/22 16:40:42 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.7 2017/11/24 08:39:09 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.6 2017/11/22 16:40:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.7 2017/11/24 08:39:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8103,11 +8103,11 @@ wm_rxdesc_get_vlantag(struct wm_rxqueue 
 	struct wm_softc *sc = rxq->rxq_sc;
 
 	if (sc->sc_type == WM_T_82574)
-		return EXTRXC_VLAN_ID(rxq->rxq_ext_descs[idx].erx_ctx.erxc_vlan);
+		return rxq->rxq_ext_descs[idx].erx_ctx.erxc_vlan;
 	else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0)
-		return NQRXC_VLAN_ID(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_vlan);
+		return rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_vlan;
 	else
-		return WRX_VLAN_ID(rxq->rxq_descs[idx].wrx_special);
+		return rxq->rxq_descs[idx].wrx_special;
 }
 
 static inline int

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.98.6.2 src/sys/dev/pci/if_wmreg.h:1.98.6.3
--- src/sys/dev/pci/if_wmreg.h:1.98.6.2	Mon Nov  6 09:54:01 2017
+++ src/sys/dev/pci/if_wmreg.h	Fri Nov 24 08:39:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.98.6.2 2017/11/06 09:54:01 snj Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.98.6.3 2017/11/24 08:39:09 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -208,12 +208,6 @@ typedef union ext_rxdesc {
 #define EXTRXC_STATUS_PKTTYPE_MASK	__BITS(19,16)
 #define EXTRXC_STATUS_PKTTYPE(status)	__SHIFTOUT(status,EXTRXC_STATUS_PKTTYPE_MASK)
 
-#define	EXTRXC_VLAN_ID_MASK	__BITS(11,0)	/* VLAN identifier mask */
-#define	EXTRXC_VLAN_ID(x)	((x) & EXTRXC_VLAN_ID_MASK) /* VLAN identifier */
-#define	EXTRXC_VLAN_CFI		__BIT(12)	/* Canonical Form Indicator */
-#define	EXTRXC_VLAN_PRI_MASK	__BITS(15,13)	/* VLAN priority mask */
-#define	EXTRXC_VLAN_PRI(x)	__SHIFTOUT((x),EXTRXC_VLAN_PRI_MASK) /* VLAN priority */
-
 /* advanced RX descriptor for 82575 and newer */
 typedef union nq_rxdesc {
 	struct {

CVS commit: [netbsd-8] src/sys

2017-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 24 08:39:09 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_bge.c if_wm.c if_wmreg.h
src/sys/net [netbsd-8]: if_ether.h if_vlan.c if_vlanvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #389):
sys/net/if_ether.h: revision 1.69
sys/net/if_vlan.c: revision 1.108
sys/dev/pci/if_bge.c: revision 1.313
sys/net/if_vlanvar.h: revision 1.11
sys/net/if_vlanvar.h: revision 1.12
sys/net/if_ether.h: revision 1.70
sys/net/if_vlan.c: revision 1.110
sys/dev/pci/if_wm.c: revision 1.544
sys/dev/pci/if_wmreg.h: revision 1.105
  Fix a bug that a vlan packet which has priority or CFI bit in the tag causes
panic.
  Revert part of if_bge.c 1.312. It's not required to mask other than VLAN ID
bits in VLAN tag.
  Revert if_wmreg.h 1.104 and if_wm.c 1.542. It's not required to mask other
than VLAN ID bits in VLAN tag.
No functional change:
  - u_int16_t -> uint16_t
  - u_short -> uint16_t
  - tag_hash_func -> vlan_tag_hash
  - 0 -> NULL because vlr_parent is a pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.310.2.1 -r1.310.2.2 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.508.4.6 -r1.508.4.7 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.2 -r1.98.6.3 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.66.8.1 -r1.66.8.2 src/sys/net/if_ether.h
cvs rdiff -u -r1.97.2.7 -r1.97.2.8 src/sys/net/if_vlan.c
cvs rdiff -u -r1.9.80.1 -r1.9.80.2 src/sys/net/if_vlanvar.h

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



CVS commit: src/sys/dev/pci/ixgbe

2017-11-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 24 08:36:22 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
 On X540, print PHY FW Revision with %u.%x. 0x04000300 will be printed
as "Revision 4.3 ID 0x0"


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/ixgbe/ixgbe.c

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



CVS commit: src/sys/dev/pci/ixgbe

2017-11-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 24 08:36:22 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
 On X540, print PHY FW Revision with %u.%x. 0x04000300 will be printed
as "Revision 4.3 ID 0x0"


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/ixgbe/ixgbe.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/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.113 src/sys/dev/pci/ixgbe/ixgbe.c:1.114
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.113	Wed Nov 22 15:15:09 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Nov 24 08:36:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.113 2017/11/22 15:15:09 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.114 2017/11/24 08:36:22 msaitoh Exp $ */
 
 /**
 
@@ -1003,8 +1003,13 @@ ixgbe_attach(device_t parent, device_t d
 		high = (nvmreg >> 12) & 0x0f;
 		low = (nvmreg >> 4) & 0xff;
 		id = nvmreg & 0x000f;
-		aprint_normal(" PHY FW Revision %u.%02x ID 0x%x,", high, low,
-		id);
+		aprint_normal(" PHY FW Revision %u.", high);
+		if (hw->mac.type == ixgbe_mac_X540)
+			str = "%x";
+		else
+			str = "%02x";
+		aprint_normal(str, low);
+		aprint_normal(" ID 0x%x,", id);
 		break;
 	default:
 		break;



CVS commit: [netbsd-8] src/sys/dev/hdaudio

2017-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 24 08:35:34 UTC 2017

Modified Files:
src/sys/dev/hdaudio [netbsd-8]: hdaudio.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #388):
sys/dev/hdaudio/hdaudio.c: revision 1.6
Enter link reset even if GCTL says we are already in reset state. Fixes
hdaudio codec detection under VirtualBox on a "cold" boot.
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/dev/hdaudio/hdaudio.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/hdaudio/hdaudio.c
diff -u src/sys/dev/hdaudio/hdaudio.c:1.4.10.1 src/sys/dev/hdaudio/hdaudio.c:1.4.10.2
--- src/sys/dev/hdaudio/hdaudio.c:1.4.10.1	Mon Jun  5 08:13:05 2017
+++ src/sys/dev/hdaudio/hdaudio.c	Fri Nov 24 08:35:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.4.10.1 2017/06/05 08:13:05 snj Exp $ */
+/* $NetBSD: hdaudio.c,v 1.4.10.2 2017/11/24 08:35:34 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4.10.1 2017/06/05 08:13:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4.10.2 2017/11/24 08:35:34 martin Exp $");
 
 #include 
 #include 
@@ -612,21 +612,21 @@ hdaudio_reset(struct hdaudio_softc *sc)
 	hda_write1(sc, HDAUDIO_MMIO_RIRBSTS,
 	hda_read1(sc, HDAUDIO_MMIO_RIRBSTS));
 
-	/* If the controller isn't in reset state, initiate the transition */
+	/* Put the controller into reset state */
 	gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL);
-	if (gctl & HDAUDIO_GCTL_CRST) {
-		gctl &= ~HDAUDIO_GCTL_CRST;
-		hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl);
-		do {
-			hda_delay(10);
-			gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL);
-		} while (--retry > 0 && (gctl & HDAUDIO_GCTL_CRST) != 0);
-		if (retry == 0) {
-			hda_error(sc, "timeout entering reset state\n");
-			return ETIME;
-		}
+	gctl &= ~HDAUDIO_GCTL_CRST;
+	hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl);
+	do {
+		hda_delay(10);
+		gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL);
+	} while (--retry > 0 && (gctl & HDAUDIO_GCTL_CRST) != 0);
+	if (retry == 0) {
+		hda_error(sc, "timeout entering reset state\n");
+		return ETIME;
 	}
 
+	hda_delay(1000);
+
 	/* Now the controller is in reset state, so bring it out */
 	retry = HDAUDIO_RESET_TIMEOUT;
 	hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl | HDAUDIO_GCTL_CRST);
@@ -639,6 +639,8 @@ hdaudio_reset(struct hdaudio_softc *sc)
 		return ETIME;
 	}
 
+	hda_delay(2000);
+
 	/* Accept unsolicited responses */
 	hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl | HDAUDIO_GCTL_UNSOL_EN);
 



CVS commit: [netbsd-8] src/sys/dev/hdaudio

2017-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 24 08:35:34 UTC 2017

Modified Files:
src/sys/dev/hdaudio [netbsd-8]: hdaudio.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #388):
sys/dev/hdaudio/hdaudio.c: revision 1.6
Enter link reset even if GCTL says we are already in reset state. Fixes
hdaudio codec detection under VirtualBox on a "cold" boot.
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/dev/hdaudio/hdaudio.c

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