CVS commit: src/sys/netipsec

2017-07-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 26 03:59:59 UTC 2017

Modified Files:
src/sys/netipsec: ipsec.c key.c key.h key_debug.c

Log Message:
Provide and apply key_sp_refcnt (NFC)

It simplifies further changes.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.192 -r1.193 src/sys/netipsec/key.c
cvs rdiff -u -r1.24 -r1.25 src/sys/netipsec/key.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netipsec/key_debug.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.110 src/sys/netipsec/ipsec.c:1.111
--- src/sys/netipsec/ipsec.c:1.110	Fri Jul 21 04:50:11 2017
+++ src/sys/netipsec/ipsec.c	Wed Jul 26 03:59:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.110 2017/07/21 04:50:11 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.111 2017/07/26 03:59:59 ozaki-r Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.110 2017/07/21 04:50:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.111 2017/07/26 03:59:59 ozaki-r Exp $");
 
 /*
  * IPsec controller part.
@@ -256,7 +256,7 @@ ipsec_checkpcbcache(struct mbuf *m, stru
 	KEY_SP_REF(pcbsp->sp_cache[dir].cachesp);
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
 	"DP cause refcnt++:%d SP:%p\n",
-	pcbsp->sp_cache[dir].cachesp->refcnt,
+	key_sp_refcnt(pcbsp->sp_cache[dir].cachesp),
 	pcbsp->sp_cache[dir].cachesp);
 	return pcbsp->sp_cache[dir].cachesp;
 }
@@ -282,7 +282,7 @@ ipsec_fillpcbcache(struct inpcbpolicy *p
 		KEY_SP_REF(pcbsp->sp_cache[dir].cachesp);
 		KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
 		"DP cause refcnt++:%d SP:%p\n",
-		pcbsp->sp_cache[dir].cachesp->refcnt,
+		key_sp_refcnt(pcbsp->sp_cache[dir].cachesp),
 		pcbsp->sp_cache[dir].cachesp);
 
 		/*
@@ -392,7 +392,7 @@ key_get_default_sp(int af, const char *w
 	KEY_SP_REF(sp);
 
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP, "DP returns SP:%p (%u)\n",
-	sp, sp->refcnt);
+	sp, key_sp_refcnt(sp));
 	return sp;
 }
 #define	KEY_GET_DEFAULT_SP(af) \
@@ -531,7 +531,7 @@ ipsec_getpolicybysock(struct mbuf *m, u_
 	currsp->policy);
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
 	"DP (priv %u policy %u) allocates SP:%p (refcnt %u)\n",
-	pcbsp->priv, currsp->policy, sp, sp->refcnt);
+	pcbsp->priv, currsp->policy, sp, key_sp_refcnt(sp));
 	ipsec_fillpcbcache(pcbsp, m, sp, dir);
 	return sp;
 }

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.192 src/sys/netipsec/key.c:1.193
--- src/sys/netipsec/key.c:1.192	Wed Jul 26 01:33:35 2017
+++ src/sys/netipsec/key.c	Wed Jul 26 03:59:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.192 2017/07/26 01:33:35 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.193 2017/07/26 03:59:59 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.192 2017/07/26 01:33:35 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.193 2017/07/26 03:59:59 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -602,6 +602,15 @@ static struct work	key_timehandler_wk;
 	REFLOG("SP_DELREF", (p), (where), (tag));			\
 } while (0)
 
+u_int
+key_sp_refcnt(const struct secpolicy *sp)
+{
+
+	if (sp == NULL)
+		return 0;
+
+	return sp->refcnt;
+}
 
 static inline void
 key_sp_dead(struct secpolicy *sp)
@@ -686,7 +695,7 @@ found:
 
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
 	"DP return SP:%p (ID=%u) refcnt %u\n",
-	sp, sp ? sp->id : 0, sp ? sp->refcnt : 0);
+	sp, sp ? sp->id : 0, key_sp_refcnt(sp));
 	return sp;
 }
 
@@ -762,7 +771,7 @@ found:
 done:
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
 	"DP return SP:%p (ID=%u) refcnt %u\n",
-	sp, sp ? sp->id : 0, sp ? sp->refcnt : 0);
+	sp, sp ? sp->id : 0, key_sp_refcnt(sp));
 	return sp;
 }
 
@@ -1112,7 +1121,7 @@ key_sp_ref(struct secpolicy *sp, const c
 
 	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
 	"DP SP:%p (ID=%u) from %s:%u; refcnt now %u\n",
-	sp, sp->id, where, tag, sp->refcnt);
+	sp, sp->id, where, tag, key_sp_refcnt(sp));
 }
 
 void
@@ -2492,7 +2501,8 @@ key_setdumpsp(struct secpolicy *sp, u_in
 {
 	struct mbuf *result = NULL, *m;
 
-	m = key_setsadbmsg(type, 0, SADB_SATYPE_UNSPEC, seq, pid, sp->refcnt);
+	m = key_setsadbmsg(type, 0, SADB_SATYPE_UNSPEC, seq, pid,
+	key_sp_refcnt(sp));
 	if (!m)
 		goto fail;
 	result = m;

Index: src/sys/netipsec/key.h
diff -u src/sys/netipsec/key.h:1.24 src/sys/netipsec/key.h:1.25
--- src/sys/netipsec/key.h:1.24	Fri Jul 21 04:39:08 2017
+++ src/sys/netipsec/key.h	Wed Jul 26 03:59:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.h,v 1.24 2017/07/21 

CVS commit: src/bin/sh

2017-07-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Jul 26 03:46:55 UTC 2017

Modified Files:
src/bin/sh: mktokens

Log Message:
Add a comment explaining the ordering reltionship of the tokens
(operators all come first, then TWORD, then keywords), and switch
from using TIF to define KWDOFFSET to using TWORD (the barrier,
rather than the token that happens to be first after it.)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/sh/mktokens

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

Modified files:

Index: src/bin/sh/mktokens
diff -u src/bin/sh/mktokens:1.13 src/bin/sh/mktokens:1.14
--- src/bin/sh/mktokens:1.13	Thu May  4 04:37:51 2017
+++ src/bin/sh/mktokens	Wed Jul 26 03:46:54 2017
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: mktokens,v 1.13 2017/05/04 04:37:51 kre Exp $
+#	$NetBSD: mktokens,v 1.14 2017/07/26 03:46:54 kre Exp $
 #
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -40,6 +40,9 @@
 # token marks the end of a list.  The third column is the name to print in
 # error messages.
 
+# Note that all the keyword tokens come after TWORD, and all the others
+# come before it.   We rely upon that relationship - keep it!
+
 cat > /tmp/ka$$ <<\!
 TEOF	1	end of file
 TNL	0	newline
@@ -87,7 +90,7 @@ ${SED} -e 's/"/\\"/g' \
 echo '};
 '
 ${SED} 's/"//g' /tmp/ka$$ | ${AWK} '
-/TIF/{print "#define KWDOFFSET " NR-1; print ""; 
+/TWORD/{print "#define KWDOFFSET " NR; print ""; 
   print "const char *const parsekwd[] = {"}
 /TIF/,/neverfound/{print "	\"" $3 "\","}'
 echo '	0



CVS commit: src/bin/sh

2017-07-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Jul 26 03:44:43 UTC 2017

Modified Files:
src/bin/sh: shell.h

Log Message:
NFC: DEBUG mode change - add a couple more TRACE macros to allow for
conditional (apart from the normal debug conditions) tracing.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/sh/shell.h

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

Modified files:

Index: src/bin/sh/shell.h
diff -u src/bin/sh/shell.h:1.24 src/bin/sh/shell.h:1.25
--- src/bin/sh/shell.h:1.24	Sat Jun 17 12:41:20 2017
+++ src/bin/sh/shell.h	Wed Jul 26 03:44:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: shell.h,v 1.24 2017/06/17 12:41:20 kre Exp $	*/
+/*	$NetBSD: shell.h,v 1.25 2017/07/26 03:44:43 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -123,6 +123,11 @@ extern	int		ShNest;
 	trace param;			\
 } while (/*CONSTCOND*/ 0)
 
+#define CCTRACE(when,cond,param) do {	\
+if ((cond) && (DFlags & (when)) != 0) \
+	trace param;			\
+} while (/*CONSTCOND*/ 0)
+
 #define CTRACEV(when, param)	do {	\
 if ((DFlags & (when)) != 0)		\
 	tracev param;			\
@@ -141,6 +146,12 @@ extern	int		ShNest;
 	trace param;		\
 } while (/*CONSTCOND*/ 0)
 
+#define CVTRACE(when,cond,param) do {	\
+if ((cond) && (DFlags &		\
+	(when)<

CVS commit: src/sys/external/bsd/drm2/linux

2017-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 26 03:40:40 UTC 2017

Modified Files:
src/sys/external/bsd/drm2/linux: linux_idr.c

Log Message:
Tweak slightly sketchy logic in linux_idr.

1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.

Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/linux/linux_idr.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/linux/linux_idr.c
diff -u src/sys/external/bsd/drm2/linux/linux_idr.c:1.5 src/sys/external/bsd/drm2/linux/linux_idr.c:1.6
--- src/sys/external/bsd/drm2/linux/linux_idr.c:1.5	Thu Jan  1 01:15:43 2015
+++ src/sys/external/bsd/drm2/linux/linux_idr.c	Wed Jul 26 03:40:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_idr.c,v 1.5 2015/01/01 01:15:43 mrg Exp $	*/
+/*	$NetBSD: linux_idr.c,v 1.6 2017/07/26 03:40:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.5 2015/01/01 01:15:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.6 2017/07/26 03:40:39 riastradh Exp $");
 
 #include 
 #include 
@@ -191,6 +191,7 @@ idr_preload(gfp_t gfp)
 		ASSERT_SLEEPABLE();
 
 	node = kmalloc(sizeof(*node), gfp);
+	KASSERT(node != NULL || !ISSET(gfp, __GFP_WAIT));
 	if (node == NULL)
 		return;
 
@@ -216,8 +217,10 @@ idr_alloc(struct idr *idr, void *data, i
 
 	/* Grab a node allocated by idr_preload.  */
 	mutex_spin_enter(_cache.lock);
-	KASSERTMSG(!SIMPLEQ_EMPTY(_cache.preloaded_nodes),
-	"missing call to idr_preload");
+	if (SIMPLEQ_EMPTY(_cache.preloaded_nodes)) {
+		mutex_spin_exit(_cache.lock);
+		return -ENOMEM;
+	}
 	node = SIMPLEQ_FIRST(_cache.preloaded_nodes);
 	SIMPLEQ_REMOVE_HEAD(_cache.preloaded_nodes, in_list);
 	mutex_spin_exit(_cache.lock);



CVS commit: src/sys/netipsec

2017-07-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 26 01:33:35 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Fix key_getcomb_setlifetime

The fix adjusts a soft limit to be 80% of a corresponding hard limit.

I'm not sure the fix is really correct though, at least the original
code is wrong. A passed comb is zero-cleared before calling
key_getcomb_setlifetime, so
  comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100;
is meaningless.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.191 src/sys/netipsec/key.c:1.192
--- src/sys/netipsec/key.c:1.191	Fri Jul 21 04:50:11 2017
+++ src/sys/netipsec/key.c	Wed Jul 26 01:33:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.191 2017/07/21 04:50:11 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.192 2017/07/26 01:33:35 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.191 2017/07/21 04:50:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.192 2017/07/26 01:33:35 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -5763,9 +5763,9 @@ key_getcomb_setlifetime(struct sadb_comb
 	comb->sadb_comb_soft_bytes = 0;
 	comb->sadb_comb_hard_bytes = 0;
 	comb->sadb_comb_hard_addtime = 86400;	/* 1 day */
-	comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100;
-	comb->sadb_comb_soft_usetime = 28800;	/* 8 hours */
-	comb->sadb_comb_hard_usetime = comb->sadb_comb_hard_usetime * 80 / 100;
+	comb->sadb_comb_soft_addtime = comb->sadb_comb_hard_addtime * 80 / 100;
+	comb->sadb_comb_hard_usetime = 28800;	/* 8 hours */
+	comb->sadb_comb_soft_usetime = comb->sadb_comb_hard_usetime * 80 / 100;
 }
 
 /*



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

2017-07-25 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 25 23:31:27 UTC 2017

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: intel_sdvo.c

Log Message:
Pull in upstream commit:

Author: Ville Syrjälä 
Date:   Mon Jun 9 16:20:46 2014 +0300

drm/i915: Avoid div-by-zero when pixel_multiplier is zero

On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disabled
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=76520


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.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/i915/intel_sdvo.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7	Tue Oct 27 13:16:33 2015
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c	Tue Jul 25 23:31:27 2017
@@ -1391,7 +1391,10 @@ static void intel_sdvo_get_config(struct
 			 >> SDVO_PORT_MULTIPLY_SHIFT) + 1;
 	}
 
-	dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
+	dotclock = pipe_config->port_clock;
+
+	if (pipe_config->pixel_multiplier)
+		dotclock /= pipe_config->pixel_multiplier;
 
 	if (HAS_PCH_SPLIT(dev))
 		ironlake_check_encoder_dotclock(pipe_config, dotclock);



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

2017-07-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jul 25 23:20:57 UTC 2017

Modified Files:
src/sys/arch/dreamcast/conf: G1IDE GENERIC

Log Message:
Use the correct attachment for dreamcast audio.

Found and tested by Bjorn Johannesson on port-dreamcast.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/dreamcast/conf/G1IDE
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/dreamcast/conf/GENERIC

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/dreamcast/conf/G1IDE
diff -u src/sys/arch/dreamcast/conf/G1IDE:1.1 src/sys/arch/dreamcast/conf/G1IDE:1.2
--- src/sys/arch/dreamcast/conf/G1IDE:1.1	Thu Dec 29 11:49:05 2016
+++ src/sys/arch/dreamcast/conf/G1IDE	Tue Jul 25 23:20:57 2017
@@ -1,4 +1,4 @@
-# $NetBSD: G1IDE,v 1.1 2016/12/29 11:49:05 tsutsui Exp $
+# $NetBSD: G1IDE,v 1.2 2017/07/25 23:20:57 nat Exp $
 
 include 	"arch/dreamcast/conf/std.dreamcast"
 
@@ -190,7 +190,7 @@ rlphy*		at mii? phy ?
 mbe*		at g2bus?			# SEGA LAN Adapter
 
 #aica*		at g2bus?			# AICA Sound Processing Unit
-#audio*		at aica?
+#audio*		at audiobus?
 
 #spkr*		at audio?		# PC speaker (synthesized)
 

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.125 src/sys/arch/dreamcast/conf/GENERIC:1.126
--- src/sys/arch/dreamcast/conf/GENERIC:1.125	Tue Dec 13 20:42:17 2016
+++ src/sys/arch/dreamcast/conf/GENERIC	Tue Jul 25 23:20:57 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.125 2016/12/13 20:42:17 christos Exp $
+# $NetBSD: GENERIC,v 1.126 2017/07/25 23:20:57 nat Exp $
 #
 # GENERIC machine description file
 # 
@@ -191,7 +191,7 @@ rlphy*		at mii? phy ?
 mbe*		at g2bus?			# SEGA LAN Adapter
 
 aica*		at g2bus?			# AICA Sound Processing Unit
-audio*		at aica?
+audio*		at audiobus?
 
 spkr*		at audio?		# PC speaker (synthesized)
 



CVS commit: src/sys/arch/dreamcast/dev/g2

2017-07-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jul 25 23:18:04 UTC 2017

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Dreamcast audio only supports playback so set it in the props.
This makes dreamcast audio work again.

Tested by Bjorn Johannesson.
cvs: --


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.22 src/sys/arch/dreamcast/dev/g2/aica.c:1.23
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.22	Wed Nov 23 23:07:29 2011
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Tue Jul 25 23:18:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.22 2011/11/23 23:07:29 jmcneill Exp $	*/
+/*	$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.22 2011/11/23 23:07:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $");
 
 #include 
 #include 
@@ -774,7 +774,7 @@ int
 aica_get_props(void *addr)
 {
 
-	return 0;
+	return AUDIO_PROP_PLAYBACK;
 }
 
 void



CVS commit: src/sys/dev

2017-07-25 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 25 23:17:20 UTC 2017

Modified Files:
src/sys/dev/ic: rt2860.c rt2860var.h
src/sys/dev/pci: if_ral_pci.c

Log Message:
enable rt2860 power management code

adjust to fit netbsd:
make suspend,resume functions match desired pmf* prototypes
remove wakeup/activate wrapper functions

avoid jumping to NULL on resume by initializing if_stop

the problem machine has other issues on resume, so there might be further
issues, but it's an improvement over a jump to NULL.

tested by Riccardo Mottola


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/rt2860.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/rt2860var.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_ral_pci.c

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

Modified files:

Index: src/sys/dev/ic/rt2860.c
diff -u src/sys/dev/ic/rt2860.c:1.27 src/sys/dev/ic/rt2860.c:1.28
--- src/sys/dev/ic/rt2860.c:1.27	Thu Jul 20 18:17:25 2017
+++ src/sys/dev/ic/rt2860.c	Tue Jul 25 23:17:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2860.c,v 1.27 2017/07/20 18:17:25 maya Exp $	*/
+/*	$NetBSD: rt2860.c,v 1.28 2017/07/25 23:17:20 maya Exp $	*/
 /*	$OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $	*/
 /*	$FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
 
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.27 2017/07/20 18:17:25 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.28 2017/07/25 23:17:20 maya Exp $");
 
 #include 
 #include 
@@ -74,6 +74,8 @@ int rt2860_debug = 0;
 #define MAXQS	6 /* Tx (4 EDCAs + HCCA + Mgt) and Rx rings */
 
 static void	rt2860_attachhook(device_t);
+static bool	rt2860_suspend(device_t self, const pmf_qual_t *qual);
+static bool	rt2860_wakeup(device_t self, const pmf_qual_t *qual);
 static int	rt2860_alloc_tx_ring(struct rt2860_softc *,
 		struct rt2860_tx_ring *);
 static void	rt2860_reset_tx_ring(struct rt2860_softc *,
@@ -394,6 +396,7 @@ rt2860_attachhook(device_t self)
 	ifp->if_init = rt2860_init;
 	ifp->if_ioctl = rt2860_ioctl;
 	ifp->if_start = rt2860_start;
+	ifp->if_stop = rt2860_stop;
 	ifp->if_watchdog = rt2860_watchdog;
 	IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
@@ -434,7 +437,7 @@ rt2860_attachhook(device_t self)
 
 	ieee80211_announce(ic);
 
-	if (pmf_device_register(sc->sc_dev, NULL, NULL))
+	if (pmf_device_register(sc->sc_dev, rt2860_wakeup, rt2860_suspend))
 		pmf_class_network_register(sc->sc_dev, ifp);
 	else
 		aprint_error_dev(sc->sc_dev,
@@ -471,24 +474,31 @@ rt2860_detach(void *xsc)
 	return 0;
 }
 
-void
-rt2860_suspend(void *xsc)
+static bool
+rt2860_suspend(device_t self, const pmf_qual_t *qual)
 {
-	struct rt2860_softc *sc = xsc;
+	struct rt2860_softc *sc = device_private(self);
 	struct ifnet *ifp = >sc_if;
 
 	if (ifp->if_flags & IFF_RUNNING)
 		rt2860_stop(ifp, 1);
+
+	return true;
 }
 
-void
-rt2860_wakeup(void *xsc)
+static bool
+rt2860_wakeup(device_t self, const pmf_qual_t *qual)
 {
-	struct rt2860_softc *sc = xsc;
+	struct rt2860_softc *sc = device_private(self);
 	struct ifnet *ifp = >sc_if;
+	int s;
 
+	s = splnet();
 	if (ifp->if_flags & IFF_UP)
 		rt2860_init(ifp);
+	splx(s);
+
+	return true;
 }
 
 static int

Index: src/sys/dev/ic/rt2860var.h
diff -u src/sys/dev/ic/rt2860var.h:1.4 src/sys/dev/ic/rt2860var.h:1.5
--- src/sys/dev/ic/rt2860var.h:1.4	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/ic/rt2860var.h	Tue Jul 25 23:17:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2860var.h,v 1.4 2017/02/02 10:05:35 nonaka Exp $	*/
+/*	$NetBSD: rt2860var.h,v 1.5 2017/07/25 23:17:20 maya Exp $	*/
 /*	$OpenBSD: rt2860var.h,v 1.23 2016/03/21 21:16:30 stsp Exp $	*/
 
 /*-
@@ -212,6 +212,4 @@ struct rt2860_softc {
 
 int	rt2860_attach(void *, int);
 int	rt2860_detach(void *);
-void	rt2860_suspend(void *);
-void	rt2860_wakeup(void *);
 int	rt2860_intr(void *);

Index: src/sys/dev/pci/if_ral_pci.c
diff -u src/sys/dev/pci/if_ral_pci.c:1.23 src/sys/dev/pci/if_ral_pci.c:1.24
--- src/sys/dev/pci/if_ral_pci.c:1.23	Wed Jul  6 14:28:51 2016
+++ src/sys/dev/pci/if_ral_pci.c	Tue Jul 25 23:17:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ral_pci.c,v 1.23 2016/07/06 14:28:51 christos Exp $	*/
+/*	$NetBSD: if_ral_pci.c,v 1.24 2017/07/25 23:17:20 maya Exp $	*/
 /*	$OpenBSD: if_ral_pci.c,v 1.24 2015/11/24 17:11:39 mpi Exp $  */
 
 /*-
@@ -21,7 +21,7 @@
  * PCI front-end for the Ralink RT2560/RT2561/RT2860/RT3090 driver.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ral_pci.c,v 1.23 2016/07/06 14:28:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ral_pci.c,v 1.24 2017/07/25 23:17:20 maya Exp $");
 
 
 #include 
@@ -56,42 +56,24 @@ __KERNEL_RCSID(0, "$NetBSD: if_ral_pci.c
 #include 
 #include 
 
-#define RAL_POWER_MANAGEMENT 0	/* Disabled for now */
-
 static struct ral_opns {
 	int	(*attach)(void *, int);
 	int	(*detach)(void *);
-#if RAL_POWER_MANAGEMENT
-	void	(*suspend)(void *);
-	void	

CVS commit: src/tests/usr.bin/mixerctl

2017-07-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul 25 22:28:22 UTC 2017

Modified Files:
src/tests/usr.bin/mixerctl: t_mixerctl.sh

Log Message:
Do the previous test a better way - for a file, test is generally
adequate, but for a device, we really need to actually try opening
it to determine that it is possible - so do the test that way, then
if the open succeeds once, assume it will the second time (which then
holds it open.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/mixerctl/t_mixerctl.sh

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

Modified files:

Index: src/tests/usr.bin/mixerctl/t_mixerctl.sh
diff -u src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.9 src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.10
--- src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.9	Tue Jul 25 21:25:03 2017
+++ src/tests/usr.bin/mixerctl/t_mixerctl.sh	Tue Jul 25 22:28:22 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_mixerctl.sh,v 1.9 2017/07/25 21:25:03 kre Exp $
+# $NetBSD: t_mixerctl.sh,v 1.10 2017/07/25 22:28:22 kre Exp $
 
 audio_setup() {
 	# Open /dev/pad0 so we have a configured audio device.
@@ -21,7 +21,7 @@ audio_setup() {
 	# variables, we would need to put $padpid in a file.)
 
 	unset padpid
-	test -r /dev/pad0 && 
+	( true /dev/null 2>&1 &&
 	{ { cat >/dev/null & } < /dev/pad0 ; } 2>/dev/null && padpid=$!
 
 	(/dev/null 2>&1 ||



CVS commit: src/tests/lib/libm

2017-07-25 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 25 21:26:56 UTC 2017

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
Revert previous as it breaks at least sparc and hpcsh builds.
nearbyint() is not included in libm on all platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/t_fe_round.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/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.4 src/tests/lib/libm/t_fe_round.c:1.5
--- src/tests/lib/libm/t_fe_round.c:1.4	Mon Jul 24 18:14:46 2017
+++ src/tests/lib/libm/t_fe_round.c	Tue Jul 25 21:26:56 2017
@@ -93,40 +93,10 @@ ATF_TC_BODY(fe_round, tc)
 	}
 }
 
-ATF_TC(fe_nearbyint);
-ATF_TC_HEAD(fe_nearbyint, tc)
-{
-	atf_tc_set_md_var(tc, "descr","Checking IEEE 754 rounding modes using nearbyint");
-}
-
-ATF_TC_BODY(fe_nearbyint, tc)
-{
-	double received;
-
-	for (unsigned int i = 0; i < __arraycount(values); i++) {
-		fesetround(values[i].round_mode);
-
-		received = nearbyint(values[i].input);
-		ATF_CHECK_MSG(
-		(fabs(received - values[i].expected) < EPSILON),
-		"nearbyint rounding wrong, difference too large\n"
-		"input: %f (index %d): got %f, expected %ld\n",
-		values[i].input, i, received, values[i].expected);
-
-		/* Do we get the same rounding mode out? */
-		ATF_CHECK_MSG(
-		(fegetround() == values[i].round_mode),
-		"Didn't get the same rounding mode out!\n"
-		"(index %d) fed in %d rounding mode, got %d out\n",
-		i, values[i].round_mode, fegetround());
-	}
-}
-
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, fe_round);
-	ATF_TP_ADD_TC(tp, fe_nearbyint);
 
 	return atf_no_error();
 }
@@ -139,27 +109,15 @@ ATF_TC_HEAD(t_nofe_round, tc)
 	"dummy test case - no fenv.h support");
 }
 
-ATF_TC_BODY(t_nofe_round, tc)
-{
-	atf_tc_skip("no fenv.h support on this architecture");
-}
 
-ATF_TC_HEAD(t_nofe_nearbyint, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	"dummy test case - no fenv.h support");
-}
-
-ATF_TC_BODY(t_nofe_nearbyint, tc)
+ATF_TC_BODY(t_nofe_round, tc)
 {
 	atf_tc_skip("no fenv.h support on this architecture");
 }
 
-
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, t_nofe_round);
-	ATF_TP_ADD_TC(tp, t_nofe_nearbyint);
 	return atf_no_error();
 }
 



CVS commit: src/tests/usr.bin/mixerctl

2017-07-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul 25 21:25:03 UTC 2017

Modified Files:
src/tests/usr.bin/mixerctl: t_mixerctl.sh

Log Message:
Correct oversight in previous ... redirecting into a compound statement
causes the shell to exit if the redirect fails (posix says "may exit"
and /bin/sh does - maybe should give that more thought) - which will
happen if /dev/pad0 does not exist, causing a very messy test abort
(the shell running the test is not supposed to just go away).  So
check tha the device exista and is readable before attempting to open it.

Problem brought to my attention by nat@ - thanks...


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/mixerctl/t_mixerctl.sh

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

Modified files:

Index: src/tests/usr.bin/mixerctl/t_mixerctl.sh
diff -u src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.8 src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.9
--- src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.8	Tue Jul 18 13:17:37 2017
+++ src/tests/usr.bin/mixerctl/t_mixerctl.sh	Tue Jul 25 21:25:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_mixerctl.sh,v 1.8 2017/07/18 13:17:37 kre Exp $
+# $NetBSD: t_mixerctl.sh,v 1.9 2017/07/25 21:25:03 kre Exp $
 
 audio_setup() {
 	# Open /dev/pad0 so we have a configured audio device.
@@ -21,7 +21,8 @@ audio_setup() {
 	# variables, we would need to put $padpid in a file.)
 
 	unset padpid
-	{ { cat >/dev/null & } < /dev/pad0 ; } 2>/dev/null && padpid=$!
+	test -r /dev/pad0 && 
+	{ { cat >/dev/null & } < /dev/pad0 ; } 2>/dev/null && padpid=$!
 
 	(/dev/null 2>&1 ||
 	atf_skip "no audio mixer available in kernel"



CVS commit: [netbsd-7] src/doc

2017-07-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jul 25 19:51:29 UTC 2017

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
1413


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 src/doc/CHANGES-7.2

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-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.31 src/doc/CHANGES-7.2:1.1.2.32
--- src/doc/CHANGES-7.2:1.1.2.31	Sun Jul 23 06:29:48 2017
+++ src/doc/CHANGES-7.2	Tue Jul 25 19:51:29 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.31 2017/07/23 06:29:48 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.32 2017/07/25 19:51:29 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -2573,3 +2573,45 @@ sys/arch/arm/arm32/genassym.cf			1.75
 	Avoids a problem with large ranges as seen in port-evbarm/52169.
 	[skrll, ticket #1452]
 
+distrib/sets/lists/base/mi			patch
+etc/mtree/NetBSD.dist.base			patch
+external/intel-fw-public/Makefile		patch
+external/intel-fw-public/iwl3160/Makefile	patch
+external/intel-fw-public/iwl3160/dist/LICENSE.iwlwifi-3160-ucode patch
+external/intel-fw-public/iwl3160/dist/README.iwlwifi-3160-ucode patch
+external/intel-fw-public/iwl3160/dist/iwlwifi-3160-17.ucode patch
+external/intel-fw-public/iwl3168/Makefile	patch
+external/intel-fw-public/iwl3168/dist/LICENSE.iwlwifi-3168-ucode patch
+external/intel-fw-public/iwl3168/dist/README.iwlwifi-3168-ucode patch
+external/intel-fw-public/iwl3168/dist/iwlwifi-3168-22.ucode patch
+external/intel-fw-public/iwl7260/Makefile	patch
+external/intel-fw-public/iwl7260/dist/LICENSE.iwlwifi-7260-ucode patch
+external/intel-fw-public/iwl7260/dist/README.iwlwifi-7260-ucode patch
+external/intel-fw-public/iwl7260/dist/iwlwifi-7260-17.ucode patch
+external/intel-fw-public/iwl7265/Makefile	patch
+external/intel-fw-public/iwl7265/dist/LICENSE.iwlwifi-7265-ucode patch
+external/intel-fw-public/iwl7265/dist/README.iwlwifi-7265-ucode patch
+external/intel-fw-public/iwl7265/dist/iwlwifi-7265-17.ucode patch
+external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-22.ucode patch
+external/intel-fw-public/iwl8000/Makefile	patch
+external/intel-fw-public/iwl8000/dist/LICENSE.iwlwifi-8000-ucode patch
+external/intel-fw-public/iwl8000/dist/README.iwlwifi-8000-ucode patch
+external/intel-fw-public/iwl8000/dist/iwlwifi-8000C-22.ucode patch
+external/intel-fw-public/iwl8265/Makefile	patch
+external/intel-fw-public/iwl8265/dist/LICENSE.iwlwifi-8265-ucode patch
+external/intel-fw-public/iwl8265/dist/README.iwlwifi-8265-ucode patch
+external/intel-fw-public/iwl8265/dist/iwlwifi-8265-22.ucode patch
+sys/arch/amd64/conf/GENERIC			patch
+sys/arch/i386/conf/GENERIC			patch
+sys/dev/pci/files.pcipatch
+sys/dev/pci/pcidevspatch
+sys/dev/pci/pcidevs.hregen
+sys/dev/pci/pcidevs_data.h			regen
+sys/dev/pci/if_iwm.cpatch
+sys/dev/pci/if_iwmreg.hpatch
+sys/dev/pci/if_iwmvar.hpatch
+
+	iwm(4): Add a driver for Intel Wireless 726x, 316x, 826x
+	and 416x series.  Ported from OpenBSD.
+	[nonaka, ticket #1413]
+



CVS commit: src/external/gpl3/binutils/dist/bfd

2017-07-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jul 25 19:44:25 UTC 2017

Modified Files:
src/external/gpl3/binutils/dist/bfd: elfxx-sparc.c

Log Message:
TLS relocations for PIE and non-PIE main executable work the same, so
apply the same relaxation rules and the same static binding rules.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/bfd/elfxx-sparc.c

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

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/elfxx-sparc.c
diff -u src/external/gpl3/binutils/dist/bfd/elfxx-sparc.c:1.11 src/external/gpl3/binutils/dist/bfd/elfxx-sparc.c:1.12
--- src/external/gpl3/binutils/dist/bfd/elfxx-sparc.c:1.11	Wed Oct 26 18:42:52 2016
+++ src/external/gpl3/binutils/dist/bfd/elfxx-sparc.c	Tue Jul 25 19:44:25 2017
@@ -1330,7 +1330,7 @@ sparc_elf_tls_transition (struct bfd_lin
   && ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd)
 r_type = R_SPARC_REV32;
 
-  if (bfd_link_pic (info))
+  if (bfd_link_dll (info))
 return r_type;
 
   switch (r_type)
@@ -1501,13 +1501,13 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, 
 
 	case R_SPARC_TLS_LE_HIX22:
 	case R_SPARC_TLS_LE_LOX10:
-	  if (bfd_link_pic (info))
+	  if (bfd_link_dll (info))
 	goto r_sparc_plt32;
 	  break;
 
 	case R_SPARC_TLS_IE_HI22:
 	case R_SPARC_TLS_IE_LO10:
-	  if (bfd_link_pic (info))
+	  if (bfd_link_dll (info))
 	info->flags |= DF_STATIC_TLS;
 	  /* Fall through */
 
@@ -2334,7 +2334,7 @@ allocate_dynrelocs (struct elf_link_hash
   /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
  make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry.  */
   if (h->got.refcount > 0
-  && !bfd_link_pic (info)
+  && !bfd_link_dll (info)
   && h->dynindx == -1
   && _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
 h->got.offset = (bfd_vma) -1;
@@ -3582,7 +3582,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 	  else if (h != NULL)
 	{
 	  tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
-	  if (!bfd_link_pic (info)
+	  if (!bfd_link_dll (info)
 		  && h->dynindx == -1
 		  && tls_type == GOT_TLS_IE)
 		switch (SPARC_ELF_R_TYPE (rel->r_info))
@@ -3706,7 +3706,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 
 	case R_SPARC_TLS_LDM_HI22:
 	case R_SPARC_TLS_LDM_LO10:
-	  if (! bfd_link_pic (info))
+	  if (! bfd_link_dll (info))
 	{
 	  bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
 	  continue;
@@ -3717,7 +3717,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 
 	case R_SPARC_TLS_LDO_HIX22:
 	case R_SPARC_TLS_LDO_LOX10:
-	  if (bfd_link_pic (info))
+	  if (bfd_link_dll (info))
 	{
 	  relocation -= dtpoff_base (info);
 	  break;
@@ -3729,7 +3729,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 
 	case R_SPARC_TLS_LE_HIX22:
 	case R_SPARC_TLS_LE_LOX10:
-	  if (bfd_link_pic (info))
+	  if (bfd_link_dll (info))
 	{
 	  Elf_Internal_Rela outrel;
 	  bfd_boolean skip;
@@ -3761,7 +3761,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 	  break;
 
 	case R_SPARC_TLS_LDM_CALL:
-	  if (! bfd_link_pic (info))
+	  if (! bfd_link_dll (info))
 	{
 	  /* mov %g0, %o0 */
 	  bfd_put_32 (output_bfd, 0x9010, contents + rel->r_offset);
@@ -3775,13 +3775,13 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 	tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
 	  else if (h != NULL)
 	tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
-	  if (! bfd_link_pic (info)
+	  if (! bfd_link_dll (info)
 	  || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
 	{
 	  Elf_Internal_Rela *rel2;
 	  bfd_vma insn;
 
-	  if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+	  if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
 		{
 		  /* GD -> LE */
 		  bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
@@ -3868,12 +3868,12 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 	  continue;
 
 	case R_SPARC_TLS_LDM_ADD:
-	  if (! bfd_link_pic (info))
+	  if (! bfd_link_dll (info))
 	bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
 	  continue;
 
 	case R_SPARC_TLS_LDO_ADD:
-	  if (! bfd_link_pic (info))
+	  if (! bfd_link_dll (info))
 	{
 	  /* Change rs1 into %g7.  */
 	  bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
@@ -3884,7 +3884,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 
 	case R_SPARC_TLS_IE_LD:
 	case R_SPARC_TLS_IE_LDX:
-	  if (! bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+	  if (! bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
 	{
 	  bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
 	  int rs2 = insn & 0x1f;



CVS commit: src/sys/arch/amd64/amd64

2017-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 25 18:03:56 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c

Log Message:
This branch must be static, otherwise there is a condition under which
the KASSERT in startlwp32 would be triggered.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/amd64/amd64/netbsd32_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.106 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.107
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.106	Sat Jul 22 13:00:42 2017
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Tue Jul 25 18:03:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.106 2017/07/22 13:00:42 maxv Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.107 2017/07/25 18:03:56 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.106 2017/07/22 13:00:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.107 2017/07/25 18:03:56 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1086,37 +1086,36 @@ check_sigcontext32(struct lwp *l, const 
 int
 cpu_mcontext32_validate(struct lwp *l, const mcontext32_t *mcp)
 {
-	struct pmap *pmap = l->l_proc->p_vmspace->vm_map.pmap;
 	const __greg32_t *gr;
 	struct trapframe *tf;
-	struct pcb *pcb;
 
 	gr = mcp->__gregs;
 	tf = l->l_md.md_regs;
-	pcb = lwp_getpcb(l);
 
 	if (((gr[_REG32_EFL] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0)
 		return EINVAL;
 
-	if (__predict_false(pmap->pm_ldt != NULL)) {
-		/* Only when the LDT is user-set (with USER_LDT) */
-		if (!USERMODE(gr[_REG32_CS], gr[_REG32_EFL]))
-			return EINVAL;
-	} else {
-		if (!VALID_USER_CSEL32(gr[_REG32_CS]))
-			return EINVAL;
-		if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]) &&
-		!(VALID_USER_FSEL32(gr[_REG32_FS]) && pcb->pcb_fs != 0))
-			return EINVAL;
-		if (gr[_REG32_GS] != 0 && !VALID_USER_DSEL32(gr[_REG32_GS]) &&
-		!(VALID_USER_GSEL32(gr[_REG32_GS]) && pcb->pcb_gs != 0))
-			return EINVAL;
-		if (gr[_REG32_ES] != 0 && !VALID_USER_DSEL32(gr[_REG32_ES]))
-			return EINVAL;
-		if (!VALID_USER_DSEL32(gr[_REG32_DS]) ||
-		!VALID_USER_DSEL32(gr[_REG32_SS]))
-			return EINVAL;
-	}
+#ifdef USER_LDT
+	/* Userland is allowed to have unfamiliar segment register values */
+	if (!USERMODE(gr[_REG32_CS], gr[_REG32_EFL]))
+		return EINVAL;
+#else
+	struct pcb *pcb = lwp_getpcb(l);
+
+	if (!VALID_USER_CSEL32(gr[_REG32_CS]))
+		return EINVAL;
+	if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]) &&
+	!(VALID_USER_FSEL32(gr[_REG32_FS]) && pcb->pcb_fs != 0))
+		return EINVAL;
+	if (gr[_REG32_GS] != 0 && !VALID_USER_DSEL32(gr[_REG32_GS]) &&
+	!(VALID_USER_GSEL32(gr[_REG32_GS]) && pcb->pcb_gs != 0))
+		return EINVAL;
+	if (gr[_REG32_ES] != 0 && !VALID_USER_DSEL32(gr[_REG32_ES]))
+		return EINVAL;
+	if (!VALID_USER_DSEL32(gr[_REG32_DS]) ||
+	!VALID_USER_DSEL32(gr[_REG32_SS]))
+		return EINVAL;
+#endif
 
 	if (gr[_REG32_EIP] >= VM_MAXUSER_ADDRESS32)
 		return EINVAL;



CVS commit: src/sys/arch/amd64/amd64

2017-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 25 17:43:44 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: machdep.c

Log Message:
Must not be from n32.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/arch/amd64/amd64/machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.259 src/sys/arch/amd64/amd64/machdep.c:1.260
--- src/sys/arch/amd64/amd64/machdep.c:1.259	Sat Jul 22 09:20:01 2017
+++ src/sys/arch/amd64/amd64/machdep.c	Tue Jul 25 17:43:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.259 2017/07/22 09:20:01 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.260 2017/07/25 17:43:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.259 2017/07/22 09:20:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.260 2017/07/25 17:43:44 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1898,66 +1898,46 @@ cpu_setmcontext(struct lwp *l, const mco
 int
 cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
 {
-	struct pmap *pmap = l->l_proc->p_vmspace->vm_map.pmap;
-	struct proc *p = l->l_proc;
+	struct proc *p __diagused = l->l_proc;
 	struct trapframe *tf = l->l_md.md_regs;
 	const __greg_t *gr;
 	uint16_t sel;
 
+	KASSERT((p->p_flag & PK_32) == 0);
 	gr = mcp->__gregs;
 
 	if (((gr[_REG_RFLAGS] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0)
 		return EINVAL;
 
-	if (__predict_false(pmap->pm_ldt != NULL)) {
-		/* Only when the LDT is user-set (with USER_LDT) */
-		if ((gr[_REG_DS] & 0x) == 0)
-			return EINVAL;
-#ifndef XEN
-		if ((gr[_REG_SS] & 0x) == 0)
-			return EINVAL;
-		if (!USERMODE(gr[_REG_CS], gr[_REG_RFLAGS]))
-			return EINVAL;
-#endif
-	} else {
-#define VUD(sel) \
-((p->p_flag & PK_32) ? VALID_USER_DSEL32(sel) : VALID_USER_DSEL(sel))
-#define VUF(sel) /* XXX: Shouldn't this be FSEL32? */ \
-((p->p_flag & PK_32) ? VALID_USER_DSEL32(sel) : VALID_USER_DSEL(sel))
-#define VUG(sel) \
-((p->p_flag & PK_32) ? VALID_USER_GSEL32(sel) : VALID_USER_DSEL(sel))
-#define VUC(sel) \
-((p->p_flag & PK_32) ? VALID_USER_CSEL32(sel) : VALID_USER_CSEL(sel))
-
-		sel = gr[_REG_ES] & 0x;
-		if (sel != 0 && !VUD(sel))
-			return EINVAL;
-
-		sel = gr[_REG_FS] & 0x;
-		if (sel != 0 && !VUF(sel))
-			return EINVAL;
-
-		sel = gr[_REG_GS] & 0x;
-		if (sel != 0 && !VUG(sel))
-			return EINVAL;
-
-		sel = gr[_REG_DS] & 0x;
-		if (!VUD(sel))
-			return EINVAL;
+	sel = gr[_REG_ES] & 0x;
+	if (sel != 0 && !VALID_USER_DSEL(sel))
+		return EINVAL;
+
+	sel = gr[_REG_FS] & 0x;
+	if (sel != 0 && !VALID_USER_DSEL(sel))
+		return EINVAL;
+
+	sel = gr[_REG_GS] & 0x;
+	if (sel != 0 && !VALID_USER_DSEL(sel))
+		return EINVAL;
+
+	sel = gr[_REG_DS] & 0x;
+	if (!VALID_USER_DSEL(sel))
+		return EINVAL;
 
 #ifndef XEN
-		sel = gr[_REG_SS] & 0x;
-		if (!VUD(sel))
-			return EINVAL;
-
-		sel = gr[_REG_CS] & 0x;
-		if (!VUC(sel))
-			return EINVAL;
+	sel = gr[_REG_SS] & 0x;
+	if (!VALID_USER_DSEL(sel))
+		return EINVAL;
+
+	sel = gr[_REG_CS] & 0x;
+	if (!VALID_USER_CSEL(sel))
+		return EINVAL;
 #endif
-	}
 
 	if (gr[_REG_RIP] >= VM_MAXUSER_ADDRESS)
 		return EINVAL;
+
 	return 0;
 }
 



CVS commit: src/sys/arch

2017-07-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul 25 17:04:52 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_wdt.c

Log Message:
Add watchdog timer support.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_wdt.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/conf/SUNXI

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/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.13 src/sys/arch/arm/sunxi/files.sunxi:1.14
--- src/sys/arch/arm/sunxi/files.sunxi:1.13	Sun Jul 23 10:16:08 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Tue Jul 25 17:04:52 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.13 2017/07/23 10:16:08 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.14 2017/07/25 17:04:52 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -103,6 +103,11 @@ device	sunxiemac: arp, ether, ifnet, mii
 attach	sunxiemac at fdt with sunxi_emac
 file	arch/arm/sunxi/sunxi_emac.c		sunxi_emac
 
+# Watchdog
+device	sunxiwdt: sysmon_wdog
+attach	sunxiwdt at fdt with sunxi_wdt
+file	arch/arm/sunxi/sunxi_wdt.c		sunxi_wdt
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN8I: SOC_SUNXI

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.17 src/sys/arch/evbarm/conf/SUNXI:1.18
--- src/sys/arch/evbarm/conf/SUNXI:1.17	Thu Jul 13 09:06:28 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Tue Jul 25 17:04:52 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.17 2017/07/13 09:06:28 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.18 2017/07/25 17:04:52 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -79,6 +79,9 @@ gpioleds*	at fdt?
 gtmr*		at fdt? pass 1		# ARM Generic Timer
 armgtmr0	at gtmr?
 
+# Watchdog
+sunxiwdt*	at fdt?			# Allwinner watchdog
+
 # Interrupt controller
 gic*		at fdt? pass 1		# GIC
 armgic0		at gic?

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_wdt.c
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_wdt.c:1.1
--- /dev/null	Tue Jul 25 17:04:52 2017
+++ src/sys/arch/arm/sunxi/sunxi_wdt.c	Tue Jul 25 17:04:52 2017
@@ -0,0 +1,199 @@
+/* $NetBSD: sunxi_wdt.c,v 1.1 2017/07/25 17:04:52 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: sunxi_wdt.c,v 1.1 2017/07/25 17:04:52 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	SUNXI_WDT_PERIOD_DEFAULT	16
+
+#define	WDT_IRQ_EN_REG		0x00
+#define	 WDT_IRQ_EN_EN		__BIT(0)
+#define	WDT_IRQ_STA_REG		0x04
+#define	 WDT_IRQ_STA_PEND	__BIT(0)
+#define	WDT_CTRL_REG		0x10
+#define	 WDT_CTRL_KEY_FIELD	__BITS(12,1)
+#define	  WDT_CTRL_KEY_FIELD_V	0xa57
+#define	 WDT_CTRL_RSTART	__BIT(0)
+#define	WDT_CFG_REG		0x14
+#define	 WDT_CFG_CONFIG		__BITS(1,0)
+#define	  WDT_CFG_CONFIG_SYS	1
+#define	  WDT_CFG_CONFIG_IRQ	2
+#define	WDT_MODE_REG		0x18
+#define	 WDT_MODE_INTV		__BITS(7,4)
+#define	 WDT_MODE_EN		__BIT(0)
+
+static const int sun6i_periods[] = {
+	500, 1000, 2000, 3000,
+	4000, 5000, 6000, 8000,
+	1, 12000, 14000, 16000,
+	-1
+};
+
+static const struct of_compat_data compat_data[] = {
+	{ "allwinner,sun6i-a31-wdt",	(uintptr_t)_periods },
+	{ NULL }
+};
+
+struct sunxi_wdt_softc {
+	device_t sc_dev;
+	bus_space_tag_t sc_bst;
+	bus_space_handle_t sc_bsh;
+
+	const int *sc_periods;
+
+	struct sysmon_wdog sc_smw;
+};
+
+#define WDT_READ(sc, reg) \
+

CVS commit: src/sys/dev

2017-07-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jul 25 13:29:16 UTC 2017

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

Log Message:
Fix a panic caused by opening pad(4)'s mixer before the corresponding
audio device has attached.

Addresses PR kern/52424.


To generate a diff of this commit:
cvs rdiff -u -r1.368 -r1.369 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.368 src/sys/dev/audio.c:1.369
--- src/sys/dev/audio.c:1.368	Sun Jul  9 12:08:39 2017
+++ src/sys/dev/audio.c	Tue Jul 25 13:29:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.369 2017/07/25 13:29:16 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.369 2017/07/25 13:29:16 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5807,6 +5807,9 @@ audio_query_devinfo(struct audio_softc *
 
 	KASSERT(mutex_owned(sc->sc_lock));
 
+	if (sc->sc_static_nmixer_states == 0 || sc->sc_nmixer_states == 0)
+		goto hardware;
+
 	if (di->index >= sc->sc_static_nmixer_states - 1 &&
 	di->index < sc->sc_nmixer_states) {
 		if (di->index == sc->sc_static_nmixer_states - 1) {
@@ -5838,7 +5841,7 @@ audio_query_devinfo(struct audio_softc *
 		return 0;
 	}
 
-
+hardware:
 	return sc->hw_if->query_devinfo(sc->hw_hdl, di);
 }
 



CVS commit: src/doc

2017-07-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Jul 25 10:43:41 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
Current sljit version is r350.


To generate a diff of this commit:
cvs rdiff -u -r1.1456 -r1.1457 src/doc/3RDPARTY

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.1456 src/doc/3RDPARTY:1.1457
--- src/doc/3RDPARTY:1.1456	Wed Jul  5 11:22:18 2017
+++ src/doc/3RDPARTY	Tue Jul 25 10:43:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1456 2017/07/05 11:22:18 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1457 2017/07/25 10:43:40 alnsn Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1557,7 +1557,7 @@ Notes:
 
 Package:	sljit
 Version:	svn revision 313
-Current Vers:	svn revision 313
+Current Vers:	svn revision 350
 Maintainer:	Zoltán Herczeg 

CVS commit: src/bin/sh

2017-07-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jul 25 08:37:48 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.162 src/bin/sh/sh.1:1.163
--- src/bin/sh/sh.1:1.162	Mon Jul 24 14:17:11 2017
+++ src/bin/sh/sh.1	Tue Jul 25 08:37:48 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.162 2017/07/24 14:17:11 kre Exp $
+.\"	$NetBSD: sh.1,v 1.163 2017/07/25 08:37:48 wiz Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -831,7 +831,7 @@ operators or reserved words, together cr
 Overall, a shell program is a:
 .Bl -tag -width XpipelineX
 .It list
-Which is a sequence of one or more AND-OR lists. 
+Which is a sequence of one or more AND-OR lists.
 .It "AND-OR list"
 is a sequence of one or more pipelines.
 .It pipeline
@@ -904,7 +904,7 @@ the pipeline status is the exit
 status of the last command in the pipeline,
 and the exit status of any other commands in the pipeline is ignored.
 .Pp
-If the reserved word ! precedes the pipeline, the exit status 
+If the reserved word ! precedes the pipeline, the exit status
 becomes the logical NOT of the pipeline status as determined above.
 That is, if the pipeline status is zero, the exit status is 1;
 if the pipeline status is other than zero, the exit status is zero.



CVS commit: src/share/man/man4/man4.pmax

2017-07-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jul 25 08:30:45 UTC 2017

Modified Files:
src/share/man/man4/man4.pmax: ibus.4 intro.4

Log Message:
Fix some mandoc warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/man4.pmax/ibus.4
cvs rdiff -u -r1.19 -r1.20 src/share/man/man4/man4.pmax/intro.4

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/man4/man4.pmax/ibus.4
diff -u src/share/man/man4/man4.pmax/ibus.4:1.6 src/share/man/man4/man4.pmax/ibus.4:1.7
--- src/share/man/man4/man4.pmax/ibus.4:1.6	Tue Jul 25 03:51:41 2017
+++ src/share/man/man4/man4.pmax/ibus.4	Tue Jul 25 08:30:45 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ibus.4,v 1.6 2017/07/25 03:51:41 ryoon Exp $
+.\"	$NetBSD: ibus.4,v 1.7 2017/07/25 08:30:45 wiz Exp $
 .\"
 .\" Copyright (c) 1998 MINOURA Makoto
 .\" Copyright (c) 1998 NetBSD Foundation, Inc.
@@ -49,7 +49,6 @@ of the kernel startup procedure.
 .Pp
 .Nm
 driver manages the internal I/O space of pmax.
-.Pp
 .Bl -bullet -offset indent
 .It
 Address range management to avoid confliction of address space of

Index: src/share/man/man4/man4.pmax/intro.4
diff -u src/share/man/man4/man4.pmax/intro.4:1.19 src/share/man/man4/man4.pmax/intro.4:1.20
--- src/share/man/man4/man4.pmax/intro.4:1.19	Tue Jul 25 03:51:41 2017
+++ src/share/man/man4/man4.pmax/intro.4	Tue Jul 25 08:30:45 2017
@@ -27,7 +27,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\"	$NetBSD: intro.4,v 1.19 2017/07/25 03:51:41 ryoon Exp $
+.\"	$NetBSD: intro.4,v 1.20 2017/07/25 08:30:45 wiz Exp $
 .\"
 .Dd February 17, 2017
 .Dt INTRO 4 pmax
@@ -177,7 +177,8 @@ The following devices are not supported,
 either documentation or sample hardware:
 .Pp
 .Bl -tag -width speaker -offset indent -compact
-.It LoFi	DEC Western Research Labs audio card
+.It LoFi
+DEC Western Research Labs audio card
 .El
 .Pp
 The floppy-disk drive on the MAXINE baseboard is currently not



CVS commit: src/share/man/man4/man4.pmax

2017-07-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jul 25 08:30:27 UTC 2017

Modified Files:
src/share/man/man4/man4.pmax: autoconf.4 pm.4 xcfb.4

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.pmax/autoconf.4 \
src/share/man/man4/man4.pmax/pm.4
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/man4.pmax/xcfb.4

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/man4/man4.pmax/autoconf.4
diff -u src/share/man/man4/man4.pmax/autoconf.4:1.5 src/share/man/man4/man4.pmax/autoconf.4:1.6
--- src/share/man/man4/man4.pmax/autoconf.4:1.5	Tue Jul 25 03:51:41 2017
+++ src/share/man/man4/man4.pmax/autoconf.4	Tue Jul 25 08:30:27 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: autoconf.4,v 1.5 2017/07/25 03:51:41 ryoon Exp $
+.\" $NetBSD: autoconf.4,v 1.6 2017/07/25 08:30:27 wiz Exp $
 .\"
 .\" Copyright (c) 1994 Christopher G. Demetriou
 .\" All rights reserved.
@@ -43,8 +43,9 @@ When
 .Nx
 bootstraps it probes the innards of the machine on which it is running
 and locates controllers, drives, and other devices, printing out what
-it finds on the console.  This procedure is driven by a system
-configuration table which is processed by
+it finds on the console.
+This procedure is driven by a system configuration table which is
+processed by
 .Xr config 1
 and compiled into each kernel.
 Devices which exist in the machine but are not configured into the
Index: src/share/man/man4/man4.pmax/pm.4
diff -u src/share/man/man4/man4.pmax/pm.4:1.5 src/share/man/man4/man4.pmax/pm.4:1.6
--- src/share/man/man4/man4.pmax/pm.4:1.5	Sat Feb 18 22:39:01 2017
+++ src/share/man/man4/man4.pmax/pm.4	Tue Jul 25 08:30:27 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: pm.4,v 1.5 2017/02/18 22:39:01 wiz Exp $
+.\" $NetBSD: pm.4,v 1.6 2017/07/25 08:30:27 wiz Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -39,10 +39,11 @@
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for the 2100/3100 baseboard framebuffer.  It
-can operate as either a monochrome framebuffer (with memory part
-number VFB01) or an 8 bpp colour framebuffer (with memory part number
-VFB02).  Both provide 16x16 hardware sprite cursor.
+driver provides support for the 2100/3100 baseboard framebuffer.
+It can operate as either a monochrome framebuffer (with memory part
+number VFB01) or an 8 bpp colour framebuffer (with memory part
+number VFB02).
+Both provide 16x16 hardware sprite cursor.
 .Sh SEE ALSO
 .Xr cfb 4 ,
 .Xr mfb 4 ,

Index: src/share/man/man4/man4.pmax/xcfb.4
diff -u src/share/man/man4/man4.pmax/xcfb.4:1.6 src/share/man/man4/man4.pmax/xcfb.4:1.7
--- src/share/man/man4/man4.pmax/xcfb.4:1.6	Fri Feb 17 22:24:47 2017
+++ src/share/man/man4/man4.pmax/xcfb.4	Tue Jul 25 08:30:27 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: xcfb.4,v 1.6 2017/02/17 22:24:47 christos Exp $
+.\" $NetBSD: xcfb.4,v 1.7 2017/07/25 08:30:27 wiz Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -41,8 +41,9 @@ DECstation 5000/xx PMAG-DV colour frameb
 The
 .Nm
 driver provides support for the PMAG-DV framebuffer found on the
-DECstation 5000/xx baseboard.  It is an 8 bpp colour framebuffer
-capable of running at a resolution of 1024-by-768 at 66 Hz.
+DECstation 5000/xx baseboard.
+It is an 8 bpp colour framebuffer capable of running at a resolution
+of 1024-by-768 at 66 Hz.
 .Sh SEE ALSO
 .Xr cfb 4 ,
 .Xr mfb 4 ,



CVS commit: src/sys/netipsec

2017-07-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jul 25 08:15:57 UTC 2017

Modified Files:
src/sys/netipsec: ipsec6.h

Log Message:
Remove unused macro


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/netipsec/ipsec6.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/netipsec/ipsec6.h
diff -u src/sys/netipsec/ipsec6.h:1.18 src/sys/netipsec/ipsec6.h:1.19
--- src/sys/netipsec/ipsec6.h:1.18	Wed Jul  5 03:44:59 2017
+++ src/sys/netipsec/ipsec6.h	Tue Jul 25 08:15:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec6.h,v 1.18 2017/07/05 03:44:59 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec6.h,v 1.19 2017/07/25 08:15:57 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/ipsec6.h,v 1.1.4.1 2003/01/24 05:11:35 sam Exp $	*/
 /*	$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $	*/
 
@@ -57,7 +57,6 @@ struct in6pcb;
 /* KAME compatibility shims */
 #define	ipsec6_getpolicybyaddr	ipsec_getpolicybyaddr
 #define	ipsec6_getpolicybysock	ipsec_getpolicybysock
-#define	key_freesp(_x)		KEY_FREESP(&_x)
 
 int ipsec6_delete_pcbpolicy (struct in6pcb *);
 int ipsec6_set_policy (struct in6pcb *, int, const void *, size_t, kauth_cred_t);



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

2017-07-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Jul 25 06:44:22 UTC 2017

Modified Files:
src/sys/arch/evbmips/conf: CI20

Log Message:
don't set NEED_MDSETIMAGE when we don't enable the md_root.  move the
option in with the commented md_root options.

part 2 of the CI20 kernel build fix.  now evbmips builds completes
sanely for me.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbmips/conf/CI20

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/evbmips/conf/CI20
diff -u src/sys/arch/evbmips/conf/CI20:1.22 src/sys/arch/evbmips/conf/CI20:1.23
--- src/sys/arch/evbmips/conf/CI20:1.22	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbmips/conf/CI20	Tue Jul 25 06:44:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: CI20,v 1.22 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: CI20,v 1.23 2017/07/25 06:44:22 mrg Exp $
 #
 # MIPS Creator CI20
 #
@@ -7,7 +7,7 @@ include 	"arch/evbmips/conf/std.ingenic"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"CI20-$Revision: 1.22 $"
+#ident 		"CI20-$Revision: 1.23 $"
 
 maxusers	32
 
@@ -15,13 +15,13 @@ maxusers	32
 
 options 	MIPS32R2
 makeoptions	CPUFLAGS+="-mips32r2"
-makeoptions	NEED_MDSETIMAGE="yes"
 makeoptions	NEED_BINARY="yes"
 makeoptions	NEED_UBOOTIMAGE="gz"
 options 	COM_TOLERANCE=50	# +/- 5%
 options 	CONSPEED=115200	# u-boot default
 
 # Options for necessary to use MD
+#makeoptions	NEED_MDSETIMAGE="yes"
 #options 	MEMORY_DISK_HOOKS
 #options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
 #options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support



CVS commit: src/external/gpl3/binutils/usr.sbin/mdsetimage

2017-07-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Jul 25 06:43:03 UTC 2017

Modified Files:
src/external/gpl3/binutils/usr.sbin/mdsetimage: bin_bfd.c

Log Message:
initialise some stack variables to zero so that later checking ensures
they are considered "unfound" instead of some random value.

part 1 in fixing the CI20 kernel build.  this one actually will cause
the build to fail, but it's outputting broken objects right now anyway.
part 2 coming up in the CI20 configuration itself.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/binutils/usr.sbin/mdsetimage/bin_bfd.c

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

Modified files:

Index: src/external/gpl3/binutils/usr.sbin/mdsetimage/bin_bfd.c
diff -u src/external/gpl3/binutils/usr.sbin/mdsetimage/bin_bfd.c:1.1 src/external/gpl3/binutils/usr.sbin/mdsetimage/bin_bfd.c:1.2
--- src/external/gpl3/binutils/usr.sbin/mdsetimage/bin_bfd.c:1.1	Wed Sep 21 21:52:26 2016
+++ src/external/gpl3/binutils/usr.sbin/mdsetimage/bin_bfd.c	Tue Jul 25 06:43:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bin_bfd.c,v 1.1 2016/09/21 21:52:26 christos Exp $	*/
+/*	$NetBSD: bin_bfd.c,v 1.2 2017/07/25 06:43:03 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996, 2002 Christopher G. Demetriou
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: bin_bfd.c,v 1.1 2016/09/21 21:52:26 christos Exp $");
+__RCSID("$NetBSD: bin_bfd.c,v 1.2 2017/07/25 06:43:03 mrg Exp $");
 
 #include 
 #include 
@@ -75,6 +75,8 @@ bin_find_md_root(void *bin, const char *
 		size_t offset;
 	} *s, symbols[3];
 
+	symbols[0].offset = 0;
+	symbols[1].offset = 0;
 	symbols[0].name = root_name;
 	symbols[1].name = size_name;
 	symbols[2].name = NULL;



CVS commit: src/sys/dev/pci

2017-07-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul 25 06:00:17 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c if_wmvar.h

Log Message:
 Use new nvm.{acquire,release}() for semaphore. Almost the same except the
following:
 - 8257[12]: Don't directly access SPI but use EERD register.
 - 82575-I354: If the size of SPI ROM >= 32K words, use direct SPI access
   instead of EERD register access.
 - Add wm_nvm_eec_clock_raise() and wm_nvm_eec_clock_lower() and use them for
   Microwire/SPI bus control. Same as Linux and FreeBSD.
 - Redude timeout value for 80003 in wm_get_swfw_semaphore(). Same as
   Linux and FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.529 -r1.530 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_wmvar.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.529 src/sys/dev/pci/if_wm.c:1.530
--- src/sys/dev/pci/if_wm.c:1.529	Thu Jul 20 10:00:25 2017
+++ src/sys/dev/pci/if_wm.c	Tue Jul 25 06:00:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.529 2017/07/20 10:00:25 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.530 2017/07/25 06:00:17 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.529 2017/07/20 10:00:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.530 2017/07/25 06:00:17 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -442,6 +442,12 @@ struct wm_phyop {
 	int reset_delay_us;
 };
 
+struct wm_nvmop {
+	int (*acquire)(struct wm_softc *);
+	void (*release)(struct wm_softc *);
+	int (*read)(struct wm_softc *, int, int, uint16_t *);
+};
+
 /*
  * Software state per device.
  */
@@ -564,6 +570,7 @@ struct wm_softc {
 	kmutex_t *sc_ich_nvmmtx;	/* ICH/PCH specific NVM mutex */
 
 	struct wm_phyop phy;
+	struct wm_nvmop nvm;
 };
 
 #define WM_CORE_LOCK(_sc)	if ((_sc)->sc_core_lock) mutex_enter((_sc)->sc_core_lock)
@@ -857,8 +864,6 @@ static int	wm_nvm_read_spt(struct wm_sof
 static int	wm_nvm_read_word_invm(struct wm_softc *, uint16_t, uint16_t *);
 static int	wm_nvm_read_invm(struct wm_softc *, int, int, uint16_t *);
 /* Lock, detecting NVM type, validate checksum and read */
-static int	wm_nvm_acquire(struct wm_softc *);
-static void	wm_nvm_release(struct wm_softc *);
 static int	wm_nvm_is_onboard_eeprom(struct wm_softc *);
 static int	wm_nvm_get_flash_presence_i210(struct wm_softc *);
 static int	wm_nvm_validate_checksum(struct wm_softc *);
@@ -872,17 +877,23 @@ static int	wm_nvm_read(struct wm_softc *
  */
 static int	wm_get_null(struct wm_softc *);
 static void	wm_put_null(struct wm_softc *);
+static int	wm_get_eecd(struct wm_softc *);
+static void	wm_put_eecd(struct wm_softc *);
 static int	wm_get_swsm_semaphore(struct wm_softc *); /* 8257[123] */
 static void	wm_put_swsm_semaphore(struct wm_softc *);
 static int	wm_get_swfw_semaphore(struct wm_softc *, uint16_t);
 static void	wm_put_swfw_semaphore(struct wm_softc *, uint16_t);
+static int	wm_get_nvm_80003(struct wm_softc *);
+static void	wm_put_nvm_80003(struct wm_softc *);
+static int	wm_get_nvm_82571(struct wm_softc *);
+static void	wm_put_nvm_82571(struct wm_softc *);
 static int	wm_get_phy_82575(struct wm_softc *);
 static void	wm_put_phy_82575(struct wm_softc *);
 static int	wm_get_swfwhw_semaphore(struct wm_softc *); /* For 574/583 */
 static void	wm_put_swfwhw_semaphore(struct wm_softc *);
 static int	wm_get_swflag_ich8lan(struct wm_softc *);	/* For PHY */
 static void	wm_put_swflag_ich8lan(struct wm_softc *);
-static int	wm_get_nvm_ich8lan(struct wm_softc *);		/* For NVM */
+static int	wm_get_nvm_ich8lan(struct wm_softc *);
 static void	wm_put_nvm_ich8lan(struct wm_softc *);
 static int	wm_get_hw_semaphore_82573(struct wm_softc *);
 static void	wm_put_hw_semaphore_82573(struct wm_softc *);
@@ -1713,8 +1724,8 @@ wm_attach(device_t parent, device_t self
 	sc->sc_type = wmp->wmp_type;
 
 	/* Set default function pointers */
-	sc->phy.acquire = wm_get_null;
-	sc->phy.release = wm_put_null;
+	sc->phy.acquire = sc->nvm.acquire = wm_get_null;
+	sc->phy.release = sc->nvm.release = wm_put_null;
 	sc->phy.reset_delay_us = (sc->sc_type >= WM_T_82571) ? 100 : 1;
 
 	if (sc->sc_type < WM_T_82543) {
@@ -2039,6 +2050,7 @@ alloc_retry:
 	case WM_T_82543:
 	case WM_T_82544:
 		/* Microwire */
+		sc->nvm.read = wm_nvm_read_uwire;
 		sc->sc_nvm_wordsize = 64;
 		sc->sc_nvm_addrbits = 6;
 		break;
@@ -2048,6 +2060,7 @@ alloc_retry:
 	case WM_T_82546:
 	case WM_T_82546_3:
 		/* Microwire */
+		sc->nvm.read = wm_nvm_read_uwire;
 		reg = CSR_READ(sc, WMREG_EECD);
 		if (reg & EECD_EE_SIZE) {
 			sc->sc_nvm_wordsize = 256;
@@ -2057,19 +2070,22 @@ alloc_retry:
 			sc->sc_nvm_addrbits = 6;
 		}
 		sc->sc_flags |= WM_F_LOCK_EECD;
+		sc->nvm.acquire = wm_get_eecd;
+		sc->nvm.release = wm_put_eecd;
 		break;
 	case