CVS commit: src/sys/net

2017-11-14 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Nov 15 07:52:58 UTC 2017

Modified Files:
src/sys/net: if_pppoe.c if_spppsubr.c

Log Message:
Mark callouts of pppoe(4) CALLOUT_MPSAFE. Suggested by ozaki-r@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.171 -r1.172 src/sys/net/if_spppsubr.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/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.129 src/sys/net/if_pppoe.c:1.130
--- src/sys/net/if_pppoe.c:1.129	Mon Oct 23 09:32:33 2017
+++ src/sys/net/if_pppoe.c	Wed Nov 15 07:52:58 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.129 2017/10/23 09:32:33 msaitoh Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.130 2017/11/15 07:52:58 knakahara Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.129 2017/10/23 09:32:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.130 2017/11/15 07:52:58 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -317,7 +317,7 @@ pppoe_clone_create(struct if_clone *ifc,
 	/* changed to real address later */
 	memcpy(>sc_dest, etherbroadcastaddr, sizeof(sc->sc_dest));
 
-	callout_init(>sc_timeout, 0);
+	callout_init(>sc_timeout, CALLOUT_MPSAFE);
 
 	sc->sc_sppp.pp_if.if_start = pppoe_start;
 #ifdef PPPOE_MPSAFE

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.171 src/sys/net/if_spppsubr.c:1.172
--- src/sys/net/if_spppsubr.c:1.171	Fri Oct 13 03:11:50 2017
+++ src/sys/net/if_spppsubr.c	Wed Nov 15 07:52:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.171 2017/10/13 03:11:50 knakahara Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.172 2017/11/15 07:52:58 knakahara Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.171 2017/10/13 03:11:50 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.172 2017/11/15 07:52:58 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -999,7 +999,7 @@ sppp_attach(struct ifnet *ifp)
 
 	/* Initialize keepalive handler. */
 	if (! spppq) {
-		callout_init(_ch, 0);
+		callout_init(_ch, CALLOUT_MPSAFE);
 		callout_reset(_ch, hz * LCP_KEEPALIVE_INTERVAL, sppp_keepalive, NULL);
 	}
 
@@ -2204,7 +2204,7 @@ sppp_lcp_init(struct sppp *sp)
 	sp->lcp.max_terminate = 2;
 	sp->lcp.max_configure = 10;
 	sp->lcp.max_failure = 10;
-	callout_init(>ch[IDX_LCP], 0);
+	callout_init(>ch[IDX_LCP], CALLOUT_MPSAFE);
 }
 
 static void
@@ -2966,7 +2966,7 @@ sppp_ipcp_init(struct sppp *sp)
 	sp->fail_counter[IDX_IPCP] = 0;
 	sp->pp_seq[IDX_IPCP] = 0;
 	sp->pp_rseq[IDX_IPCP] = 0;
-	callout_init(>ch[IDX_IPCP], 0);
+	callout_init(>ch[IDX_IPCP], CALLOUT_MPSAFE);
 
 	error = workqueue_create(>ipcp.update_addrs_wq, "ipcp_update_addrs",
 	sppp_update_ip_addrs_work, sp, PRI_SOFTNET, IPL_NET, 0);
@@ -3525,7 +3525,7 @@ sppp_ipv6cp_init(struct sppp *sp)
 	sp->fail_counter[IDX_IPV6CP] = 0;
 	sp->pp_seq[IDX_IPV6CP] = 0;
 	sp->pp_rseq[IDX_IPV6CP] = 0;
-	callout_init(>ch[IDX_IPV6CP], 0);
+	callout_init(>ch[IDX_IPV6CP], CALLOUT_MPSAFE);
 }
 
 static void
@@ -4463,7 +4463,7 @@ sppp_chap_init(struct sppp *sp)
 	sp->fail_counter[IDX_CHAP] = 0;
 	sp->pp_seq[IDX_CHAP] = 0;
 	sp->pp_rseq[IDX_CHAP] = 0;
-	callout_init(>ch[IDX_CHAP], 0);
+	callout_init(>ch[IDX_CHAP], CALLOUT_MPSAFE);
 }
 
 static void
@@ -4831,8 +4831,8 @@ sppp_pap_init(struct sppp *sp)
 	sp->fail_counter[IDX_PAP] = 0;
 	sp->pp_seq[IDX_PAP] = 0;
 	sp->pp_rseq[IDX_PAP] = 0;
-	callout_init(>ch[IDX_PAP], 0);
-	callout_init(>pap_my_to_ch, 0);
+	callout_init(>ch[IDX_PAP], CALLOUT_MPSAFE);
+	callout_init(>pap_my_to_ch, CALLOUT_MPSAFE);
 }
 
 static void



CVS commit: src/external/gpl3/gcc.old/usr.bin

2017-11-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Nov 15 07:47:10 UTC 2017

Modified Files:
src/external/gpl3/gcc.old/usr.bin/common: Makefile
src/external/gpl3/gcc.old/usr.bin/frontend: Makefile

Log Message:
ensure version.c gets rebuilt properly.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/usr.bin/common/Makefile
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc.old/usr.bin/frontend/Makefile

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

Modified files:

Index: src/external/gpl3/gcc.old/usr.bin/common/Makefile
diff -u src/external/gpl3/gcc.old/usr.bin/common/Makefile:1.3 src/external/gpl3/gcc.old/usr.bin/common/Makefile:1.4
--- src/external/gpl3/gcc.old/usr.bin/common/Makefile:1.3	Sun Jul 23 01:12:17 2017
+++ src/external/gpl3/gcc.old/usr.bin/common/Makefile	Wed Nov 15 07:47:10 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2017/07/23 01:12:17 mrg Exp $
+#	$NetBSD: Makefile,v 1.4 2017/11/15 07:47:10 mrg Exp $
 
 LIBISPRIVATE=	yes
 
@@ -31,6 +31,8 @@ HOSTPROG_CXX=	1
 COPTS.diagnostic.c=	-Wno-stack-protector
 COPTS.intl.c=		-Wno-stack-protector
 
+version.c: ${GCCARCH}/defs.mk ${TOP}/tools/gcc/gcc-version.mk
+
 ${SRCS}: ${GCCARCH}/defs.mk
 
 .include 

Index: src/external/gpl3/gcc.old/usr.bin/frontend/Makefile
diff -u src/external/gpl3/gcc.old/usr.bin/frontend/Makefile:1.5 src/external/gpl3/gcc.old/usr.bin/frontend/Makefile:1.6
--- src/external/gpl3/gcc.old/usr.bin/frontend/Makefile:1.5	Sun Jul 23 01:12:17 2017
+++ src/external/gpl3/gcc.old/usr.bin/frontend/Makefile	Wed Nov 15 07:47:10 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2017/07/23 01:12:17 mrg Exp $
+#	$NetBSD: Makefile,v 1.6 2017/11/15 07:47:10 mrg Exp $
 
 LIBISPRIVATE=	yes
 
@@ -23,6 +23,8 @@ SRCS+=		driver-rs6000.c
 
 .include "../Makefile.target-defines"
 
+version.c: ${GCCARCH}/defs.mk ${TOP}/tools/gcc/gcc-version.mk
+
 CPPFLAGS+=	-I${GCCARCH} -I. \
 		${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*} \
 		-DPREFIX=\"/usr\"



CVS commit: src/external/gpl3/gcc/usr.bin

2017-11-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Nov 15 07:47:40 UTC 2017

Modified Files:
src/external/gpl3/gcc/usr.bin/common: Makefile
src/external/gpl3/gcc/usr.bin/frontend: Makefile

Log Message:
pull across from gcc.old:
>https://bugzilla.eng.vmware.com/show_bug.cgi?id=1703878#c118


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/usr.bin/common/Makefile
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/usr.bin/frontend/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/common/Makefile
diff -u src/external/gpl3/gcc/usr.bin/common/Makefile:1.4 src/external/gpl3/gcc/usr.bin/common/Makefile:1.5
--- src/external/gpl3/gcc/usr.bin/common/Makefile:1.4	Tue Mar 15 19:13:22 2016
+++ src/external/gpl3/gcc/usr.bin/common/Makefile	Wed Nov 15 07:47:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2016/03/15 19:13:22 mrg Exp $
+#	$NetBSD: Makefile,v 1.5 2017/11/15 07:47:40 mrg Exp $
 
 LIBISPRIVATE=	yes
 
@@ -31,6 +31,8 @@ HOSTPROG_CXX=	1
 COPTS.diagnostic.c=	-Wno-stack-protector
 COPTS.intl.c=		-Wno-stack-protector
 
+version.c: ${GCCARCH}/defs.mk ${TOP}/tools/gcc/gcc-version.mk
+
 ${SRCS}: ${GCCARCH}/defs.mk
 
 .include 

Index: src/external/gpl3/gcc/usr.bin/frontend/Makefile
diff -u src/external/gpl3/gcc/usr.bin/frontend/Makefile:1.10 src/external/gpl3/gcc/usr.bin/frontend/Makefile:1.11
--- src/external/gpl3/gcc/usr.bin/frontend/Makefile:1.10	Tue Mar 15 19:12:06 2016
+++ src/external/gpl3/gcc/usr.bin/frontend/Makefile	Wed Nov 15 07:47:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2016/03/15 19:12:06 mrg Exp $
+#	$NetBSD: Makefile,v 1.11 2017/11/15 07:47:40 mrg Exp $
 
 LIBISPRIVATE=	yes
 
@@ -23,6 +23,8 @@ SRCS+=		driver-rs6000.c
 
 .include "../Makefile.target-defines"
 
+version.c: ${GCCARCH}/defs.mk ${TOP}/tools/gcc/gcc-version.mk
+
 CPPFLAGS+=	-I${GCCARCH} -I. \
 		${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*} \
 		-DPREFIX=\"/usr\"



CVS commit: src/sys/net

2017-11-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 15 06:17:41 UTC 2017

Modified Files:
src/sys/net: if_bridge.c

Log Message:
Mark callouts of bridge CALLOUT_MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/net/if_bridge.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/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.138 src/sys/net/if_bridge.c:1.139
--- src/sys/net/if_bridge.c:1.138	Wed Oct 25 04:33:15 2017
+++ src/sys/net/if_bridge.c	Wed Nov 15 06:17:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.138 2017/10/25 04:33:15 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.139 2017/11/15 06:17:40 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.138 2017/10/25 04:33:15 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.139 2017/11/15 06:17:40 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -415,8 +415,8 @@ bridge_clone_create(struct if_clone *ifc
 	if (error)
 		panic("%s: workqueue_create %d\n", __func__, error);
 
-	callout_init(>sc_brcallout, 0);
-	callout_init(>sc_bstpcallout, 0);
+	callout_init(>sc_brcallout, CALLOUT_MPSAFE);
+	callout_init(>sc_bstpcallout, CALLOUT_MPSAFE);
 
 	mutex_init(>sc_iflist_psref.bip_lock, MUTEX_DEFAULT, IPL_NONE);
 	PSLIST_INIT(>sc_iflist_psref.bip_iflist);



CVS commit: src/etc

2017-11-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Nov 15 04:31:48 UTC 2017

Modified Files:
src/etc/etc.macppc: MAKEDEV.conf
src/etc/etc.sparc64: MAKEDEV.conf

Log Message:
create more /dev/pci* nodes, for PCIe systems


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/etc/etc.macppc/MAKEDEV.conf
cvs rdiff -u -r1.17 -r1.18 src/etc/etc.sparc64/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.macppc/MAKEDEV.conf
diff -u src/etc/etc.macppc/MAKEDEV.conf:1.10 src/etc/etc.macppc/MAKEDEV.conf:1.11
--- src/etc/etc.macppc/MAKEDEV.conf:1.10	Thu Dec  8 11:31:14 2016
+++ src/etc/etc.macppc/MAKEDEV.conf	Wed Nov 15 04:31:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.10 2016/12/08 11:31:14 nat Exp $
+# $NetBSD: MAKEDEV.conf,v 1.11 2017/11/15 04:31:48 macallan Exp $
 
 all_md)
 	makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1 wd2 wd3
@@ -11,7 +11,8 @@ all_md)
 	makedev scsibus0 scsibus1 scsibus2 scsibus3
 	makedev ses0 ses1 ses2 ses3
 	makedev isdns
-	makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7
+	makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 pci8 pci9 pci10 pci11
+	makedev pci12 pci13 pci14 pci15 pci16 pci17 pci18 pci19
 	makedev altq
 	makedev sysmon
 	makedev bktr

Index: src/etc/etc.sparc64/MAKEDEV.conf
diff -u src/etc/etc.sparc64/MAKEDEV.conf:1.17 src/etc/etc.sparc64/MAKEDEV.conf:1.18
--- src/etc/etc.sparc64/MAKEDEV.conf:1.17	Sun Mar 26 18:31:52 2017
+++ src/etc/etc.sparc64/MAKEDEV.conf	Wed Nov 15 04:31:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.17 2017/03/26 18:31:52 martin Exp $
+# $NetBSD: MAKEDEV.conf,v 1.18 2017/11/15 04:31:48 macallan Exp $
 
 all_md)
 	makedev std_sparc64 ttya ttyb ttyc ttyd ttyC00 ttyC01
@@ -17,7 +17,8 @@ all_md)
 	makedev usbs
 	makedev radio
 	makedev isdns
-	makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7
+	makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 pci8 pci9 pci10 pci11
+	makedev pci12 pci13 pci14 pci15 pci16 pci17 pci18 pci19
 	makedev altq
 	makedev wscons
 	makedev kttcp



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 04:28:45 UTC 2017

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

Log Message:
For the virtual stream it is required to insert silence.  As these streams
are not harware streams audio_pint_silence is ineffective.

As audio_mix() was the only consumer of audio_pint_silence it has been
removed along with sc_sil_count - which was only used by this function.


To generate a diff of this commit:
cvs rdiff -u -r1.437 -r1.438 src/sys/dev/audio.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/audiovar.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/audio.c
diff -u src/sys/dev/audio.c:1.437 src/sys/dev/audio.c:1.438
--- src/sys/dev/audio.c:1.437	Wed Nov 15 02:13:33 2017
+++ src/sys/dev/audio.c	Wed Nov 15 04:28:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.437 2017/11/15 02:13:33 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.438 2017/11/15 04:28:45 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.437 2017/11/15 02:13:33 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.438 2017/11/15 04:28:45 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -294,9 +294,6 @@ int	audio_drain(struct audio_softc *, st
 void	audio_clear(struct audio_softc *, struct virtual_channel *);
 void	audio_clear_intr_unlocked(struct audio_softc *sc,
   struct virtual_channel *);
-static inline void
-	audio_pint_silence(struct audio_softc *, struct audio_ringbuffer *,
-			   uint8_t *, int, struct virtual_channel *);
 int	audio_alloc_ring(struct audio_softc *, struct audio_ringbuffer *, int,
 			 size_t);
 void	audio_free_ring(struct audio_softc *, struct audio_ringbuffer *);
@@ -2086,7 +2083,6 @@ audio_initbufs(struct audio_softc *sc, s
 		((vc->sc_open & AUOPEN_WRITE) || vc == sc->sc_hwvc)) {
 		audio_init_ringbuffer(sc, >sc_mpr,
 		AUMODE_PLAY);
-		vc->sc_sil_count = 0;
 		if (sc->sc_opens == 0 && (vc->sc_open & AUOPEN_WRITE)) {
 			if (hw->init_output) {
 error = hw->init_output(sc->hw_hdl,
@@ -2181,7 +2177,6 @@ audio_open(dev_t dev, struct audio_softc
 	if (sc->sc_usemixer) {
 		vc->sc_open = 0;
 		vc->sc_mode = 0;
-		vc->sc_sil_count = 0;
 		vc->sc_nrfilters = 0;
 		memset(vc->sc_rfilters, 0,
 		sizeof(vc->sc_rfilters));
@@ -3020,12 +3015,6 @@ audio_write(struct audio_softc *sc, stru
 		einp = cb->s.inp;
 
 		/*
-		 * This is a very suboptimal way of keeping track of
-		 * silence in the buffer, but it is simple.
-		 */
-		vc->sc_sil_count = 0;
-
-		/*
 		 * If the interrupt routine wants the last block filled AND
 		 * the copy did not fill the last block completely it needs to
 		 * be padded.
@@ -3623,60 +3612,6 @@ done:
 	return error;
 }
 
-/*
- * When the play interrupt routine finds that the write isn't keeping
- * the buffer filled it will insert silence in the buffer to make up
- * for this.  The part of the buffer that is filled with silence
- * is kept track of in a very approximate way: it starts at sc_sil_start
- * and extends sc_sil_count bytes.  If there is already silence in
- * the requested area nothing is done; so when the whole buffer is
- * silent nothing happens.  When the writer starts again sc_sil_count
- * is set to 0.
- *
- * XXX
- * Putting silence into the output buffer should not really be done
- * from the device interrupt handler.  Consider deferring to the soft
- * interrupt.
- */
-static inline void
-audio_pint_silence(struct audio_softc *sc, struct audio_ringbuffer *cb,
-		   uint8_t *inp, int cc, struct virtual_channel *vc)
-{
-	uint8_t *s, *e, *p, *q;
-
-	KASSERT(mutex_owned(sc->sc_lock));
-
-	if (vc->sc_sil_count > 0) {
-		s = vc->sc_sil_start; /* start of silence */
-		e = s + vc->sc_sil_count; /* end of sil., may be beyond end */
-		p = inp;	/* adjusted pointer to area to fill */
-		if (p < s)
-			p += cb->s.end - cb->s.start;
-		q = p + cc;
-		/* Check if there is already silence. */
-		if (!(s <= p && p <  e &&
-		  s <= q && q <= e)) {
-			if (s <= p)
-vc->sc_sil_count = max(vc->sc_sil_count, q-s);
-			DPRINTFN(5,("audio_pint_silence: fill cc=%d inp=%p, "
-"count=%d size=%d\n",
-cc, inp, vc->sc_sil_count,
-(int)(cb->s.end - cb->s.start)));
-			audio_fill_silence(>s.param, inp, cc);
-		} else {
-			DPRINTFN(5,("audio_pint_silence: already silent "
-"cc=%d inp=%p\n", cc, inp));
-
-		}
-	} else {
-		vc->sc_sil_start = inp;
-		vc->sc_sil_count = cc;
-		DPRINTFN(5, ("audio_pint_silence: start fill %p %d\n",
-			 inp, cc));
-		audio_fill_silence(>s.param, inp, cc);
-	}
-}
-
 static void
 audio_softintr_rd(void *cookie)
 {
@@ -3899,15 +3834,15 @@ audio_mix(void *v)
 	vc->sc_playdrop += cc;
 }
 
-audio_pint_silence(sc, cb, inp, cc, vc);
+audio_fill_silence(>s.param, inp, cc);
 cb->s.inp = audio_stream_add_inp(>s, inp,
 cc);
 
 		

CVS commit: src/sys/net

2017-11-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 15 04:08:02 UTC 2017

Modified Files:
src/sys/net: if_loop.c

Log Message:
Don't take KERNEL_LOCK in looutput if NET_MPSAFE

We can perhaps get rid of KERNEL_LOCK from looutput, but for now
keep it for safe.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/net/if_loop.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/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.96 src/sys/net/if_loop.c:1.97
--- src/sys/net/if_loop.c:1.96	Mon Oct 23 09:32:00 2017
+++ src/sys/net/if_loop.c	Wed Nov 15 04:08:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.96 2017/10/23 09:32:00 msaitoh Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.97 2017/11/15 04:08:02 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.96 2017/10/23 09:32:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.97 2017/11/15 04:08:02 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -247,7 +247,9 @@ looutput(struct ifnet *ifp, struct mbuf 
 
 	MCLAIM(m, ifp->if_mowner);
 
+#ifndef NET_MPSAFE
 	KERNEL_LOCK(1, NULL);
+#endif
 
 	if ((m->m_flags & M_PKTHDR) == 0)
 		panic("looutput: no header mbuf");
@@ -373,7 +375,9 @@ looutput(struct ifnet *ifp, struct mbuf 
 	schednetisr(isr);
 	splx(s);
 out:
+#ifndef NET_MPSAFE
 	KERNEL_UNLOCK_ONE(NULL);
+#endif
 	return error;
 }
 



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 02:13:33 UTC 2017

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

Log Message:
The harware vc is rounded to a power of two then round_blocksize is called.

This improves playback and makes it possibile to use mmapped audio on usb.


To generate a diff of this commit:
cvs rdiff -u -r1.436 -r1.437 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.436 src/sys/dev/audio.c:1.437
--- src/sys/dev/audio.c:1.436	Wed Nov 15 02:02:55 2017
+++ src/sys/dev/audio.c	Wed Nov 15 02:13:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.436 2017/11/15 02:02:55 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.437 2017/11/15 02:13:33 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.436 2017/11/15 02:02:55 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.437 2017/11/15 02:13:33 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2021,27 +2021,19 @@ audio_init_ringbuffer(struct audio_softc
 	DPRINTF(("audio_init_ringbuffer: MI blksize=%d\n", blksize));
 
 	struct virtual_channel *hwvc = sc->sc_hwvc;
+
+	int tmpblksize = 1; 	 
+	/* round blocksize to a power of 2 */ 	 
+	while (tmpblksize < blksize)
+		tmpblksize <<= 1; 	 
+
+	blksize = tmpblksize;
+
 	if (sc->hw_if->round_blocksize &&
-	(rp == >sc_mpr || rp == >sc_mrr)) {
+	(rp == >sc_mpr || rp == >sc_mrr || rp ==
+	>sc_mixring.sc_mpr || rp == >sc_mixring.sc_mrr)) {
 		blksize = sc->hw_if->round_blocksize(sc->hw_hdl, blksize,
 		mode, >s.param);
-	} else {
-		int hwblksize = rp->s.bufsize;
-		if (sc->hw_if->round_blocksize) {
-			if (audio_can_capture(sc))
-hwblksize = sc->sc_hwvc->sc_mpr.blksize;
-			else
-hwblksize = sc->sc_hwvc->sc_mrr.blksize;
-		}
-
-		int tmpblksize = 1; 	 
-		/* round blocksize to a power of 2 */ 	 
-		while (tmpblksize < blksize) 	 
-			tmpblksize <<= 1; 	 
-
-		blksize = tmpblksize;
-		if (blksize > hwblksize)
-			blksize = hwblksize;
 	}
 
 	if (blksize <= 0)



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 02:02:55 UTC 2017

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

Log Message:
audio_pint improvements for when audio mixing is disabled.

When audio mixing is disabled there is only the hardware vc the mix ring
is not used.


To generate a diff of this commit:
cvs rdiff -u -r1.435 -r1.436 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.435 src/sys/dev/audio.c:1.436
--- src/sys/dev/audio.c:1.435	Wed Nov 15 01:58:48 2017
+++ src/sys/dev/audio.c	Wed Nov 15 02:02:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.435 2017/11/15 01:58:48 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.436 2017/11/15 02:02:55 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.435 2017/11/15 01:58:48 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.436 2017/11/15 02:02:55 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -3735,6 +3735,7 @@ void
 audio_pint(void *v)
 {
 	struct audio_softc *sc;
+	struct audio_ringbuffer *cb;
 	struct virtual_channel *vc;
 	int blksize, cc, used;
 
@@ -3745,31 +3746,34 @@ audio_pint(void *v)
 	if (sc->sc_dying == true || sc->sc_trigger_started == false)
 		return;
 
-	if (vc->sc_draining && (!sc->sc_usemixer ||
-	(sc->sc_mixring.sc_mpr.drops != sc->sc_last_drops))) {
+	if (sc->sc_usemixer)
+		cb = >sc_mixring.sc_mpr;
+	else
+		cb = >sc_mpr;
+
+	if (vc->sc_draining && cb->drops != sc->sc_last_drops) {
 		vc->sc_mpr.drops += blksize;
 		cv_broadcast(>sc_wchan);
 	}
-	sc->sc_last_drops = sc->sc_mixring.sc_mpr.drops;
+
+	sc->sc_last_drops = cb->drops;
 
 	vc->sc_mpr.s.outp = audio_stream_add_outp(>sc_mpr.s,
 	vc->sc_mpr.s.outp, blksize);
 
-	if (audio_stream_get_used(>sc_mixring.sc_mpr.s) < blksize) {
+	if (audio_stream_get_used(>s) < blksize) {
 		DPRINTFN(3, ("HW RING - INSERT SILENCE\n"));
 		used = blksize;
 		while (used > 0) {
-			cc = sc->sc_mixring.sc_mpr.s.end -
-			sc->sc_mixring.sc_mpr.s.inp;
+			cc = cb->s.end - cb->s.inp;
 			if (cc > used)
 cc = used;
-			audio_fill_silence(>sc_pustream->param,
-			sc->sc_mixring.sc_mpr.s.inp, cc);
-			sc->sc_mixring.sc_mpr.s.inp =
-			audio_stream_add_inp(>sc_mixring.sc_mpr.s,
-			sc->sc_mixring.sc_mpr.s.inp, cc);
+			audio_fill_silence(>s.param, cb->s.inp, cc);
+			cb->s.inp =
+			audio_stream_add_inp(>s, cb->s.inp, cc);
 			used -= cc;
 		}
+		vc->sc_mpr.drops += blksize;
 	}
 
 	mix_write(sc);



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 01:58:48 UTC 2017

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

Log Message:
Improved audiostartp for when audio mixing is disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.434 -r1.435 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.434 src/sys/dev/audio.c:1.435
--- src/sys/dev/audio.c:1.434	Wed Nov 15 01:55:45 2017
+++ src/sys/dev/audio.c	Wed Nov 15 01:58:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.434 2017/11/15 01:55:45 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.435 2017/11/15 01:58:48 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.434 2017/11/15 01:55:45 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.435 2017/11/15 01:58:48 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -3593,7 +3593,13 @@ audiostartp(struct audio_softc *sc, stru
 	if (vc == sc->sc_hwvc && sc->sc_usemixer)
 		return 0;
 
-	if (!vc->sc_mpr.mmapped && used < sc->sc_mixring.sc_mpr.blksize) {
+	int blksize;
+	if (sc->sc_usemixer)
+		blksize = sc->sc_mixring.sc_mpr.blksize;
+	else
+		blksize = vc->sc_mpr.blksize;
+
+	if (!vc->sc_mpr.mmapped && used < blksize) {
 		cv_broadcast(>sc_wchan);
 		DPRINTF(("%s: wakeup and return\n", __func__));
 		return 0;
@@ -3610,13 +3616,14 @@ audiostartp(struct audio_softc *sc, stru
 		error = mix_write(sc);
 		if (error)
 			goto done;
-		vc = sc->sc_hwvc;
-		vc->sc_mpr.s.outp =
-		audio_stream_add_outp(>sc_mpr.s,
-		  vc->sc_mpr.s.outp, vc->sc_mpr.blksize);
-		error = mix_write(sc);
-		if (sc->sc_usemixer)
+		if (sc->sc_usemixer) {
+			vc = sc->sc_hwvc;
+			vc->sc_mpr.s.outp =
+			audio_stream_add_outp(>sc_mpr.s,
+			  vc->sc_mpr.s.outp, vc->sc_mpr.blksize);
+			error = mix_write(sc);
 			cv_broadcast(>sc_condvar);
+		}
 done:
 		mutex_exit(sc->sc_intr_lock);
 	}



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 01:55:46 UTC 2017

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

Log Message:
Improved draining function for when the mixer is and is not enabled.

One block of silence is also played in audio drivers using start_output
when draining the hardware, this helps playback of short (less than
blocksize) samples.


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 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.433 src/sys/dev/audio.c:1.434
--- src/sys/dev/audio.c:1.433	Wed Nov 15 01:49:59 2017
+++ src/sys/dev/audio.c	Wed Nov 15 01:55:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.433 2017/11/15 01:49:59 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.434 2017/11/15 01:55:45 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.433 2017/11/15 01:49:59 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.434 2017/11/15 01:55:45 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2402,13 +2402,13 @@ audio_drain(struct audio_softc *sc, stru
 		return 0;
 
 	used = audio_stream_get_used(>s);
-	if (vc == sc->sc_hwvc) {
+	if (vc == sc->sc_hwvc && sc->sc_usemixer) {
 		hw = true;
 		used += audio_stream_get_used(>sc_mixring.sc_mpr.s);
 	}
 	for (i = 0; i < vc->sc_npfilters; i++)
 		used += audio_stream_get_used(>sc_pstreams[i]);
-	if (used <= 0 || (hw == true && sc->hw_if->trigger_output == NULL))
+	if (used <= 0)
 		return 0;
 
 	if (hw == false && !vc->sc_pbus) {
@@ -2457,9 +2457,14 @@ audio_drain(struct audio_softc *sc, stru
 #endif
 	vc->sc_draining = true;
 
-	drops = cb->drops + (cb->blksize * PREFILL_BLOCKS);
+	drops = cb->drops;
+	if (vc == sc->sc_hwvc)
+		drops += cb->blksize;
+	else if (sc->sc_usemixer)
+		drops += sc->sc_mixring.sc_mpr.blksize * PREFILL_BLOCKS;
+
 	error = 0;
-	while (cb->drops < drops && !error) {
+	while (cb->drops <= drops && !error) {
 		DPRINTF(("audio_drain: vc=%p used=%d, drops=%ld\n",
 			vc,
 			audio_stream_get_used(>sc_mpr.s),



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 01:49:59 UTC 2017

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

Log Message:
Plug memory leak as the mixer state does not grow or shrink when audio
mixing is disabled.  This avoids triggering a panic also.


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 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.432 src/sys/dev/audio.c:1.433
--- src/sys/dev/audio.c:1.432	Wed Nov 15 01:45:57 2017
+++ src/sys/dev/audio.c	Wed Nov 15 01:49:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.432 2017/11/15 01:45:57 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.433 2017/11/15 01:49:59 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.432 2017/11/15 01:45:57 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.433 2017/11/15 01:49:59 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2310,7 +2310,8 @@ audio_open(dev_t dev, struct audio_softc
 
 	DPRINTF(("audio_open: done sc_mode = 0x%x\n", vc->sc_mode));
 
-	grow_mixer_states(sc, 2);
+	if (sc->sc_usemixer)
+		grow_mixer_states(sc, 2);
 	if (flags & FREAD)
 		sc->sc_recopens++;
 	if (flags & FWRITE)



CVS commit: src/sys/dev

2017-11-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Nov 15 01:45:57 UTC 2017

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

Log Message:
Don't return EIO falsely when dealing with the hardware vc.
Draining of the hardware vc on close is now possible.


To generate a diff of this commit:
cvs rdiff -u -r1.431 -r1.432 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.431 src/sys/dev/audio.c:1.432
--- src/sys/dev/audio.c:1.431	Tue Nov  7 09:26:55 2017
+++ src/sys/dev/audio.c	Wed Nov 15 01:45:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.431 2017/11/07 09:26:55 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.432 2017/11/15 01:45:57 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.431 2017/11/07 09:26:55 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.432 2017/11/15 01:45:57 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1605,7 +1605,7 @@ audio_waitio(struct audio_softc *sc, kco
 	/* Wait for pending I/O to complete. */
 	error = cv_wait_sig(chan, sc->sc_lock);
 
-	if (!sc->sc_usemixer)
+	if (!sc->sc_usemixer || vc == sc->sc_hwvc)
 		return error;
 
 	found = false;



CVS commit: src/sys/modules/nand

2017-11-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Nov 15 00:48:42 UTC 2017

Modified Files:
src/sys/modules/nand: Makefile

Log Message:
Build nand_toshiba.c


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/modules/nand/Makefile

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

Modified files:

Index: src/sys/modules/nand/Makefile
diff -u src/sys/modules/nand/Makefile:1.4 src/sys/modules/nand/Makefile:1.5
--- src/sys/modules/nand/Makefile:1.4	Sat Nov  3 11:48:54 2012
+++ src/sys/modules/nand/Makefile	Wed Nov 15 00:48:42 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2012/11/03 11:48:54 ahoka Exp $
+# $NetBSD: Makefile,v 1.5 2017/11/15 00:48:42 jmcneill Exp $
 
 .include "../Makefile.inc"
 
@@ -12,5 +12,6 @@ SRCS+=	nand_crc.c
 SRCS+=	hamming.c
 SRCS+=	nand_micron.c
 SRCS+=	nand_samsung.c
+SRCS+=	nand_toshiba.c
 
 .include 



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

2017-11-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Nov 15 00:30:02 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_nand.c

Log Message:
Wait for irq instead of polling for cmd completion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_nand.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_nand.c
diff -u src/sys/arch/arm/sunxi/sunxi_nand.c:1.4 src/sys/arch/arm/sunxi/sunxi_nand.c:1.5
--- src/sys/arch/arm/sunxi/sunxi_nand.c:1.4	Mon Nov 13 17:37:02 2017
+++ src/sys/arch/arm/sunxi/sunxi_nand.c	Wed Nov 15 00:30:02 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_nand.c,v 1.4 2017/11/13 17:37:02 jmcneill Exp $ */
+/* $NetBSD: sunxi_nand.c,v 1.5 2017/11/15 00:30:02 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_nand.c,v 1.4 2017/11/13 17:37:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_nand.c,v 1.5 2017/11/15 00:30:02 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,8 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_nand.c
 #define	NDFC_ST			0x04
 #define	 NDFC_ST_RB_STATE(n)		__BIT(8 + (n))
 #define	 NDFC_ST_CMD_FIFO_STATUS	__BIT(3)
+#define	 NDFC_ST_DMA_INT_FLAG		__BIT(2)
 #define	 NDFC_ST_CMD_INT_FLAG		__BIT(1)
+#define	 NDFC_ST_INT_MASK		__BITS(2,0)
 #define	NDFC_INT		0x08
+#define	 NDFC_INT_CMD_INT_ENABLE	__BIT(1)
 #define	NDFC_TIMING_CTL		0x0c
 #define	NDFC_TIMING_CFG		0x10
 #define	NDFC_ADDR_LOW		0x14
@@ -130,6 +133,12 @@ struct sunxi_nand_softc {
 	intsc_phandle;
 	bus_space_tag_t			sc_bst;
 	bus_space_handle_t		sc_bsh;
+	void*sc_ih;
+
+	kmutex_t			sc_lock;
+	kcondvar_t			sc_cv;
+
+	uint32_t			sc_intr;
 
 	struct clk			*sc_clk_mod;
 	struct clk			*sc_clk_ahb;
@@ -157,7 +166,7 @@ static int
 sunxi_nand_wait_status(struct sunxi_nand_softc *sc, uint32_t mask, uint32_t val)
 {
 	uint32_t status;
-	int retry;
+	int retry, error = 0;
 
 	for (retry = 100; retry > 0; retry--) {
 		status = NAND_READ(sc, NDFC_ST);
@@ -171,13 +180,42 @@ sunxi_nand_wait_status(struct sunxi_nand
 		"device timeout; status=%x mask=%x val=%x\n",
 		status, mask, val);
 #endif
-		return ETIMEDOUT;
+		error = ETIMEDOUT;
 	}
 
 	if (mask == NDFC_ST_CMD_INT_FLAG)
 		NAND_WRITE(sc, NDFC_ST, NDFC_ST_CMD_INT_FLAG);
 
-	return 0;
+	return error;
+}
+
+static int
+sunxi_nand_wait_intr(struct sunxi_nand_softc *sc, uint32_t mask)
+{
+	struct bintime timeo, epsilon;
+	int error = 0;
+
+	KASSERT(mutex_owned(>sc_lock));
+
+	sc->sc_intr = 0;
+
+	/* Enable interrupts */
+	NAND_WRITE(sc, NDFC_INT, mask);
+
+	/* Wait for the command to complete */
+	timeo = ms2bintime(1000);
+	epsilon = ms2bintime(1000);
+	do {
+		if (sc->sc_intr & mask)
+			break;
+		error = cv_timedwaitbt(>sc_cv, >sc_lock, ,
+		);
+	} while (error == 0);
+
+	/* Disable interrupts */
+	NAND_WRITE(sc, NDFC_INT, 0);
+
+	return error;
 }
 
 static void
@@ -232,8 +270,15 @@ sunxi_nand_read_buf_n(device_t dev, void
 		NDFC_CMD_DATA_TRANS | NDFC_CMD_DATA_METHOD);
 
 		/* Wait for the command to finish */
-		error = sunxi_nand_wait_status(sc, NDFC_ST_CMD_INT_FLAG,
-		NDFC_ST_CMD_INT_FLAG);
+		if (cold) {
+			error = sunxi_nand_wait_status(sc, NDFC_ST_CMD_INT_FLAG,
+			NDFC_ST_CMD_INT_FLAG);
+		} else {
+			mutex_enter(>sc_lock);
+			error = sunxi_nand_wait_intr(sc, NDFC_ST_CMD_INT_FLAG);
+			mutex_exit(>sc_lock);
+		}
+
 		if (error != 0)
 			return error;
 
@@ -293,8 +338,14 @@ sunxi_nand_write_buf_n(device_t dev, con
 		NDFC_CMD_ACCESS_DIR);
 
 		/* Wait for the command to finish */
-		error = sunxi_nand_wait_status(sc, NDFC_ST_CMD_INT_FLAG,
-		NDFC_ST_CMD_INT_FLAG);
+		if (cold) {
+			error = sunxi_nand_wait_status(sc, NDFC_ST_CMD_INT_FLAG,
+			NDFC_ST_CMD_INT_FLAG);
+		} else {
+			mutex_enter(>sc_lock);
+			error = sunxi_nand_wait_intr(sc, NDFC_ST_CMD_INT_FLAG);
+			mutex_exit(>sc_lock);
+		}
 		if (error != 0)
 			return error;
 
@@ -429,6 +480,26 @@ sunxi_nand_write_buf_2(device_t dev, con
 	sunxi_nand_write_buf_n(dev, data, len, 2);
 }
 
+static int
+sunxi_nand_intr(void *priv)
+{
+	struct sunxi_nand_softc * const sc = priv;
+	uint32_t status;
+	int rv = 0;
+
+	mutex_enter(>sc_lock);
+	status = NAND_READ(sc, NDFC_ST) & NDFC_ST_INT_MASK;
+	if (status) {
+		sc->sc_intr |= status;
+		NAND_WRITE(sc, NDFC_ST, status);
+		cv_signal(>sc_cv);
+		rv = 1;
+	}
+	mutex_exit(>sc_lock);
+
+	return rv;
+}
+
 static void
 sunxi_nand_attach_chip(struct sunxi_nand_softc *sc,
 struct sunxi_nand_chip *chip, int phandle)
@@ -569,6 +640,7 @@ sunxi_nand_attach(device_t parent, devic
 	struct sunxi_nand_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
+	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
 	int child;
@@ -577,6 +649,10 @@ sunxi_nand_attach(device_t parent, devic
 		

CVS commit: src/sys/ufs/chfs

2017-11-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Nov 14 22:06:40 UTC 2017

Modified Files:
src/sys/ufs/chfs: chfs_vfsops.c

Log Message:
Fix up chfs_mountfs error branches.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/chfs/chfs_vfsops.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/ufs/chfs/chfs_vfsops.c
diff -u src/sys/ufs/chfs/chfs_vfsops.c:1.16 src/sys/ufs/chfs/chfs_vfsops.c:1.17
--- src/sys/ufs/chfs/chfs_vfsops.c:1.16	Fri Feb 17 08:31:26 2017
+++ src/sys/ufs/chfs/chfs_vfsops.c	Tue Nov 14 22:06:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_vfsops.c,v 1.16 2017/02/17 08:31:26 hannken Exp $	*/
+/*	$NetBSD: chfs_vfsops.c,v 1.17 2017/11/14 22:06:40 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -227,7 +227,7 @@ chfs_mountfs(struct vnode *devvp, struct
 	err = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0);
 	VOP_UNLOCK(devvp);
 	if (err)
-		return (err);
+		goto fail0;
 
 	/* Setup device. */
 	flash_major = cdevsw_lookup_major(_cdevsw);
@@ -241,10 +241,8 @@ chfs_mountfs(struct vnode *devvp, struct
 		major(dev), flash_major);
 		err = ENODEV;
 	}
-	if (err) {
-		vrele(devvp);
-		return (err);
-	}
+	if (err)
+		goto fail0;
 
 	/* Connect CHFS to UFS. */
 	ump = kmem_zalloc(sizeof(struct ufsmount), KM_SLEEP);
@@ -262,7 +260,7 @@ chfs_mountfs(struct vnode *devvp, struct
 	err = ebh_open(chmp->chm_ebh, devvp->v_rdev);
 	if (err) {
 		dbg("error while opening flash\n");
-		goto fail;
+		goto fail1;
 	}
 
 	//TODO check flash sizes
@@ -320,10 +318,8 @@ chfs_mountfs(struct vnode *devvp, struct
 
 	if (err) {
 		/* Armageddon and return. */
-		chfs_vnocache_hash_destroy(chmp->chm_vnocache_hash);
-		ebh_close(chmp->chm_ebh);
 		err = EIO;
-		goto fail;
+		goto fail2;
 	}
 
 	/* Initialize UFS. */
@@ -359,10 +355,31 @@ chfs_mountfs(struct vnode *devvp, struct
 	spec_node_setmountedfs(devvp, mp);
 	return 0;
 
-fail:
+fail2:
+	KASSERT(TAILQ_EMPTY(>chm_erase_pending_queue));
+	KASSERT(TAILQ_EMPTY(>chm_erasable_pending_wbuf_queue));
+	KASSERT(TAILQ_EMPTY(>chm_very_dirty_queue));
+	KASSERT(TAILQ_EMPTY(>chm_dirty_queue));
+	KASSERT(TAILQ_EMPTY(>chm_clean_queue));
+	KASSERT(TAILQ_EMPTY(>chm_free_queue));
+	rw_destroy(>chm_lock_wbuf);
+	kmem_free(chmp->chm_wbuf, chmp->chm_wbuf_pagesize);
+	mutex_destroy(>chm_lock_vnocache);
+	mutex_destroy(>chm_lock_sizes);
+	mutex_destroy(>chm_lock_mountfields);
+	kmem_free(chmp->chm_blocks, chmp->chm_ebh->peb_nr *
+	sizeof(struct chfs_eraseblock));
+	chfs_vnocache_hash_destroy(chmp->chm_vnocache_hash);
+	ebh_close(chmp->chm_ebh);
+
+fail1:
 	kmem_free(chmp->chm_ebh, sizeof(struct chfs_ebh));
+	mutex_destroy(>um_lock);
 	kmem_free(chmp, sizeof(struct chfs_mount));
 	kmem_free(ump, sizeof(struct ufsmount));
+
+fail0:
+	KASSERT(err);
 	return err;
 }
 



CVS commit: src/sys/arch/sparc64/include

2017-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 14 16:56:03 UTC 2017

Modified Files:
src/sys/arch/sparc64/include: vmparam.h

Log Message:
Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sparc64/include/vmparam.h

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

Modified files:

Index: src/sys/arch/sparc64/include/vmparam.h
diff -u src/sys/arch/sparc64/include/vmparam.h:1.37 src/sys/arch/sparc64/include/vmparam.h:1.38
--- src/sys/arch/sparc64/include/vmparam.h:1.37	Sat Mar 26 11:49:10 2016
+++ src/sys/arch/sparc64/include/vmparam.h	Tue Nov 14 16:56:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.37 2016/03/26 11:49:10 martin Exp $ */
+/*	$NetBSD: vmparam.h,v 1.38 2017/11/14 16:56:03 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -58,6 +58,12 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 
 /*
+ * Default pager_map of 16MB is awfully small.  There is plenty
+ * of VA so use it.
+ */
+#definePAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)
+
+/*
  * The kernel itself is mapped by the boot loader with 4Mb locked VM pages,
  * so let's keep 4Mb definitions here as well.
  */



CVS commit: src/sys/kern

2017-11-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 14 15:02:06 UTC 2017

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

Log Message:
- fix an assert; we can reach there if we are nowait or limitfail.
- when priming the pool and failing with ERESTART, don't decrement the number
  of pages; this avoids the issue of returning an ERESTART when we get to 0,
  and is more correct.
- simplify the pool_grow code, and don't wakeup things if we ENOMEM.


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/kern/subr_pool.c

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

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.215 src/sys/kern/subr_pool.c:1.216
--- src/sys/kern/subr_pool.c:1.215	Thu Nov  9 17:52:26 2017
+++ src/sys/kern/subr_pool.c	Tue Nov 14 10:02:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.215 2017/11/09 22:52:26 christos Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.216 2017/11/14 15:02:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.215 2017/11/09 22:52:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.216 2017/11/14 15:02:06 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -809,7 +809,7 @@ pool_get(struct pool *pp, int flags)
 		pp->pr_nfail++;
 
 		mutex_exit(>pr_lock);
-		KASSERT((flags & (PR_WAITOK|PR_NOWAIT)) == PR_NOWAIT);
+		KASSERT((flags & (PR_NOWAIT|PR_LIMITFAIL)) != 0);
 		return (NULL);
 	}
 
@@ -1062,10 +1062,6 @@ pool_put(struct pool *pp, void *v)
 static int
 pool_grow(struct pool *pp, int flags)
 {
-	struct pool_item_header *ph = NULL;
-	char *cp;
-	int error;
-
 	/*
 	 * If there's a pool_grow in progress, wait for it to complete
 	 * and try again from the top.
@@ -1083,34 +1079,32 @@ pool_grow(struct pool *pp, int flags)
 	pp->pr_flags |= PR_GROWING;
 
 	mutex_exit(>pr_lock);
-	cp = pool_allocator_alloc(pp, flags);
-	if (__predict_true(cp != NULL)) {
-		ph = pool_alloc_item_header(pp, cp, flags);
-	}
-	if (__predict_false(cp == NULL || ph == NULL)) {
-		if (cp != NULL) {
-			pool_allocator_free(pp, cp);
-		}
-		mutex_enter(>pr_lock);
-		error = ENOMEM;
+	char *cp = pool_allocator_alloc(pp, flags);
+	if (__predict_false(cp == NULL))
+		goto out;
+
+	struct pool_item_header *ph = pool_alloc_item_header(pp, cp, flags);
+	if (__predict_false(ph == NULL)) {
+		pool_allocator_free(pp, cp);
 		goto out;
 	}
 
 	mutex_enter(>pr_lock);
 	pool_prime_page(pp, cp, ph);
 	pp->pr_npagealloc++;
-	error = 0;
-
-out:
+	KASSERT(pp->pr_flags & PR_GROWING);
+	pp->pr_flags &= ~PR_GROWING;
 	/*
 	 * If anyone was waiting for pool_grow, notify them that we
 	 * may have just done it.
 	 */
+	cv_broadcast(>pr_cv);
+	return 0;
+out:
 	KASSERT(pp->pr_flags & PR_GROWING);
 	pp->pr_flags &= ~PR_GROWING;
-	cv_broadcast(>pr_cv);
-
-	return error;
+	mutex_enter(>pr_lock);
+	return ENOMEM;
 }
 
 /*
@@ -1126,7 +1120,7 @@ pool_prime(struct pool *pp, int n)
 
 	newpages = roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage;
 
-	while (newpages-- > 0) {
+	while (newpages > 0) {
 		error = pool_grow(pp, PR_NOWAIT);
 		if (error) {
 			if (error == ERESTART)
@@ -1134,6 +1128,7 @@ pool_prime(struct pool *pp, int n)
 			break;
 		}
 		pp->pr_minpages++;
+		newpages--;
 	}
 
 	if (pp->pr_minpages >= pp->pr_maxpages)



CVS commit: src/sys/opencrypto

2017-11-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 14 14:29:33 UTC 2017

Modified Files:
src/sys/opencrypto: cryptodev.c

Log Message:
check results of pool_prime.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/opencrypto/cryptodev.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/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.95 src/sys/opencrypto/cryptodev.c:1.96
--- src/sys/opencrypto/cryptodev.c:1.95	Thu Jun 15 08:41:18 2017
+++ src/sys/opencrypto/cryptodev.c	Tue Nov 14 09:29:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.95 2017/06/15 12:41:18 knakahara Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.96 2017/11/14 14:29:33 christos Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.95 2017/06/15 12:41:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.96 2017/11/14 14:29:33 christos Exp $");
 
 #include 
 #include 
@@ -2110,6 +2110,8 @@ cryptof_poll(struct file *fp, int events
 void
 cryptoattach(int num)
 {
+	int error;
+
 	crypto_init();
 
 	mutex_init(_mtx, MUTEX_DEFAULT, IPL_NONE);
@@ -2126,8 +2128,9 @@ cryptoattach(int num)
 	 * the negotiation, plus HMAC_SHA1 for the actual SSL records,
 	 * consuming one session here for each algorithm.
 	 */
-	pool_prime(, 64);
-	pool_prime(, 64 * 5);
+	if ((error = pool_prime(, 64)) != 0 ||
+	(error = pool_prime(, 64 * 5)) != 0)
+		panic("%s: can't prime pool: %d", __func__, error);
 }
 
 void	crypto_attach(device_t, device_t, void *);



CVS commit: src/sys/dev/raidframe

2017-11-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 14 14:27:54 UTC 2017

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c rf_reconmap.c

Log Message:
check the result of pool_prime.


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_reconmap.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.351 src/sys/dev/raidframe/rf_netbsdkintf.c:1.352
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.351	Wed Nov  8 20:02:56 2017
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Tue Nov 14 09:27:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.352 2017/11/14 14:27:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.352 2017/11/14 14:27:54 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -3575,9 +3575,12 @@ void
 rf_pool_init(struct pool *p, size_t size, const char *w_chan,
 	 size_t xmin, size_t xmax)
 {
+	int error;
+
 	pool_init(p, size, 0, 0, 0, w_chan, NULL, IPL_BIO);
 	pool_sethiwat(p, xmax);
-	pool_prime(p, xmin);
+	if ((error = pool_prime(p, xmin)) != 0)
+		panic("%s: failed to prime pool: %d", __func__, error);
 	pool_setlowat(p, xmin);
 }
 

Index: src/sys/dev/raidframe/rf_reconmap.c
diff -u src/sys/dev/raidframe/rf_reconmap.c:1.35 src/sys/dev/raidframe/rf_reconmap.c:1.36
--- src/sys/dev/raidframe/rf_reconmap.c:1.35	Wed Jan  4 10:51:41 2017
+++ src/sys/dev/raidframe/rf_reconmap.c	Tue Nov 14 09:27:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconmap.c,v 1.35 2017/01/04 15:51:41 christos Exp $	*/
+/*	$NetBSD: rf_reconmap.c,v 1.36 2017/11/14 14:27:54 christos Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.35 2017/01/04 15:51:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.36 2017/11/14 14:27:54 christos Exp $");
 
 #include "rf_raid.h"
 #include 
@@ -86,6 +86,7 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_S
 	RF_RaidLayout_t *layoutPtr = >Layout;
 	RF_ReconUnitCount_t num_rus = layoutPtr->stripeUnitsPerDisk / layoutPtr->SUsPerRU;
 	RF_ReconMap_t *p;
+	int error;
 
 	RF_Malloc(p, sizeof(RF_ReconMap_t), (RF_ReconMap_t *));
 	p->sectorsPerReconUnit = ru_sectors;
@@ -107,7 +108,8 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_S
 
 	pool_init(>elem_pool, sizeof(RF_ReconMapListElem_t), 0,
 	0, 0, "raidreconpl", NULL, IPL_BIO);
-	pool_prime(>elem_pool, RF_NUM_RECON_POOL_ELEM);
+	if ((error = pool_prime(>elem_pool, RF_NUM_RECON_POOL_ELEM)) != 0)
+		panic("%s: failed to prime pool: %d", __func__, error);
 
 	rf_init_mutex2(p->mutex, IPL_VM);
 	rf_init_cond2(p->cv, "reconupdate");



CVS commit: src/sys/dev/flash

2017-11-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov 14 14:15:30 UTC 2017

Modified Files:
src/sys/dev/flash: files.flash

Log Message:
Add "disk" dependency to flash to set device class to DV_DISK.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/flash/files.flash

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/flash/files.flash
diff -u src/sys/dev/flash/files.flash:1.3 src/sys/dev/flash/files.flash:1.4
--- src/sys/dev/flash/files.flash:1.3	Mon Nov 13 17:35:58 2017
+++ src/sys/dev/flash/files.flash	Tue Nov 14 14:15:29 2017
@@ -1,8 +1,8 @@
-# $NetBSD: files.flash,v 1.3 2017/11/13 17:35:58 jmcneill Exp $
+# $NetBSD: files.flash,v 1.4 2017/11/14 14:15:29 jmcneill Exp $
 
 define	flashbus	{ [offset = 0], [size = 0], [readonly = 0], [dynamic = 0] }
 
-device	flash
+device	flash: disk
 attach	flash at flashbus
 file	dev/flash/flash.c		flash
 file	dev/flash/flash_io.c		flash



CVS commit: src/sys/kern

2017-11-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov 14 14:14:29 UTC 2017

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

Log Message:
Include "flash" in list of block devices that don't use partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/kern/kern_subr.c

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

Modified files:

Index: src/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.218 src/sys/kern/kern_subr.c:1.219
--- src/sys/kern/kern_subr.c:1.218	Thu Nov  9 01:02:55 2017
+++ src/sys/kern/kern_subr.c	Tue Nov 14 14:14:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.218 2017/11/09 01:02:55 christos Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.219 2017/11/14 14:14:29 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.218 2017/11/09 01:02:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.219 2017/11/14 14:14:29 jmcneill Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -163,12 +163,13 @@ uint64_t booted_nblks;
 char *bootspec;
 
 /*
- * Use partition letters if it's a disk class but not a wedge.
- * XXX Check for wedge is kinda gross.
+ * Use partition letters if it's a disk class but not a wedge or flash.
+ * XXX Check for wedge/flash is kinda gross.
  */
 #define	DEV_USES_PARTITIONS(dv)		\
 	(device_class((dv)) == DV_DISK &&\
-	 !device_is_a((dv), "dk"))
+	 !device_is_a((dv), "dk") &&	\
+	 !device_is_a((dv), "flash"))
 
 void
 setroot(device_t bootdv, int bootpartition)



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

2017-11-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 14 13:58:08 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: locore.S redef.h

Log Message:
Remove XXX: set FRAMESIZE to the kernel value. Verily I don't understand
why we are doing that in the non-kaslr kernels, but let's just reproduce
the behavior.

jump_kernel is changed to use callq, so that the stack alignment is
preserved.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/locore.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/stand/prekern/redef.h

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/locore.S
diff -u src/sys/arch/amd64/stand/prekern/locore.S:1.4 src/sys/arch/amd64/stand/prekern/locore.S:1.5
--- src/sys/arch/amd64/stand/prekern/locore.S:1.4	Fri Nov 10 08:05:38 2017
+++ src/sys/arch/amd64/stand/prekern/locore.S	Tue Nov 14 13:58:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.4 2017/11/10 08:05:38 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.5 2017/11/14 13:58:07 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2007, 2008, 2016, 2017 The NetBSD Foundation, Inc.
@@ -623,6 +623,6 @@ END(rdseed)
 
 ENTRY(jump_kernel)
 	movq	_C_LABEL(stkva),%rsp
-	movq	$exec_kernel,%rax
-	jmpq	*%rax
+	xorq	%rbp,%rbp
+	callq	exec_kernel
 END(jump_kernel)

Index: src/sys/arch/amd64/stand/prekern/redef.h
diff -u src/sys/arch/amd64/stand/prekern/redef.h:1.1 src/sys/arch/amd64/stand/prekern/redef.h:1.2
--- src/sys/arch/amd64/stand/prekern/redef.h:1.1	Tue Oct 10 09:29:14 2017
+++ src/sys/arch/amd64/stand/prekern/redef.h	Tue Nov 14 13:58:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: redef.h,v 1.1 2017/10/10 09:29:14 maxv Exp $	*/
+/*	$NetBSD: redef.h,v 1.2 2017/11/14 13:58:07 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -43,5 +43,4 @@
  * -- */
 
 #define PDE_SIZE 8
-#define FRAMESIZE 8 /* XXX */
-
+#define FRAMESIZE 240



CVS commit: src/external/bsd/nvi/dist/vi

2017-11-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Nov 14 12:20:56 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/vi: vs_refresh.c

Log Message:
Fix cursor movement for the case of USE_WIDECHAR != "yes", where the argument
of INTISWIDE() is not evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/nvi/dist/vi/vs_refresh.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/bsd/nvi/dist/vi/vs_refresh.c
diff -u src/external/bsd/nvi/dist/vi/vs_refresh.c:1.7 src/external/bsd/nvi/dist/vi/vs_refresh.c:1.8
--- src/external/bsd/nvi/dist/vi/vs_refresh.c:1.7	Fri Nov 10 14:44:13 2017
+++ src/external/bsd/nvi/dist/vi/vs_refresh.c	Tue Nov 14 12:20:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs_refresh.c,v 1.7 2017/11/10 14:44:13 rin Exp $ */
+/*	$NetBSD: vs_refresh.c,v 1.8 2017/11/14 12:20:55 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: vs_refresh.c,v 10.50 2001/06/25 15:19:37 skimo Exp  (Berkeley) Date: 2001/06/25 15:19:37 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: vs_refresh.c,v 1.7 2017/11/10 14:44:13 rin Exp $");
+__RCSID("$NetBSD: vs_refresh.c,v 1.8 2017/11/14 12:20:55 rin Exp $");
 #endif
 
 #include 
@@ -484,7 +484,8 @@ adjust:	if (!O_ISSET(sp, O_LEFTRIGHT) &&
 		 * boundary, we have no hope to speed it up.  Do it slowly.
 		 */
 		p += OCNO;
-		if (INTISWIDE(ch = (UCHAR_T)*p))
+		ch = (UCHAR_T)*p;
+		if (INTISWIDE(ch))
 			cwtotal = SCNO;
 		else {
 			if (ch == '\t' || (chlen = KEY_LEN(sp, ch)) > SCNO + 1)
@@ -537,7 +538,8 @@ adjust:	if (!O_ISSET(sp, O_LEFTRIGHT) &&
 		 * of wide characters.
 		 */
 		p += OCNO;
-		if (INTISWIDE(ch = (UCHAR_T)*p))
+		ch = (UCHAR_T)*p;
+		if (INTISWIDE(ch))
 			cwtotal = SCNO;
 		else
 			cwtotal = SCNO + 1 - KEY_LEN(sp, ch);
@@ -558,7 +560,8 @@ adjust:	if (!O_ISSET(sp, O_LEFTRIGHT) &&
 goto slow;
 			cwtotal += KEY_COL(sp, ch);
 			cnt--;
-			if (INTISWIDE(ch = (UCHAR_T)*++p)
+			ch = (UCHAR_T)*++p;
+			if (INTISWIDE(ch)
 			&& (chlen = CHAR_WIDTH(sp, ch)) > 1
 			&& cwtotal + chlen >= SCREEN_COLS(sp))
 cwtotal = SCREEN_COLS(sp);



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

2017-11-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 14 10:15:40 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64 kern.ldscript.kaslr

Log Message:
Split each kernel section into sub-blocks of approximately 2MB. The newly
created sections are named .origname.i, for example:

.text -> { .text .text.0 .text.1 .text.2 .text.3 .text.4 }

Each section is randomized independently by the prekern - and in a random
order obviously. As a result we can get intertwined mappings, of the type:

+---+---+--+-+---+---+---+--+-
| text1 | NOTMAPPED | bss0 | rodata1 | NOTMAPPED | data2 | text3 | bss1 |
+---+---+--+-+---+---+---+--+-

   -+-
rodata0 | ...
   -+-

The CTF section is dropped completely, because (a) when split it becomes
enormous for some reason (that I don't quite understand, verily), and (b)
the kernel expects only one CTF and can't handle several of them.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/conf/Makefile.amd64
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/conf/kern.ldscript.kaslr

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/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.62 src/sys/arch/amd64/conf/Makefile.amd64:1.63
--- src/sys/arch/amd64/conf/Makefile.amd64:1.62	Tue Nov 14 09:56:26 2017
+++ src/sys/arch/amd64/conf/Makefile.amd64	Tue Nov 14 10:15:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.62 2017/11/14 09:56:26 maxv Exp $
+#	$NetBSD: Makefile.amd64,v 1.63 2017/11/14 10:15:40 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -62,7 +62,7 @@ KERN_AS=	library
 ##
 TEXTADDR?=	0x8020
 .if defined(KASLR)
-EXTRA_LINKFLAGS=	-r -d
+EXTRA_LINKFLAGS=	--split-by-file=0x20 -r -d
 KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
 .else
 EXTRA_LINKFLAGS=	-z max-page-size=0x20

Index: src/sys/arch/amd64/conf/kern.ldscript.kaslr
diff -u src/sys/arch/amd64/conf/kern.ldscript.kaslr:1.2 src/sys/arch/amd64/conf/kern.ldscript.kaslr:1.3
--- src/sys/arch/amd64/conf/kern.ldscript.kaslr:1.2	Mon Nov 13 20:01:48 2017
+++ src/sys/arch/amd64/conf/kern.ldscript.kaslr	Tue Nov 14 10:15:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.kaslr,v 1.2 2017/11/13 20:01:48 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript.kaslr,v 1.3 2017/11/14 10:15:40 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -57,4 +57,10 @@ SECTIONS
 	{
 		KEEP(*(.note.netbsd.ident));
 	}
+
+	/DISCARD/ :
+	{
+		*(.SUNW_ctf)
+		*(.SUNW_ctf.*)
+	}
 }



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

2017-11-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 14 09:56:26 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64

Log Message:
Remove max-page-size on KASLR, it doesn't play any role.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/amd64/conf/Makefile.amd64

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/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.61 src/sys/arch/amd64/conf/Makefile.amd64:1.62
--- src/sys/arch/amd64/conf/Makefile.amd64:1.61	Thu Nov  9 15:46:48 2017
+++ src/sys/arch/amd64/conf/Makefile.amd64	Tue Nov 14 09:56:26 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.61 2017/11/09 15:46:48 maxv Exp $
+#	$NetBSD: Makefile.amd64,v 1.62 2017/11/14 09:56:26 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -62,7 +62,7 @@ KERN_AS=	library
 ##
 TEXTADDR?=	0x8020
 .if defined(KASLR)
-EXTRA_LINKFLAGS=	-z max-page-size=0x20 -r -d
+EXTRA_LINKFLAGS=	-r -d
 KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
 .else
 EXTRA_LINKFLAGS=	-z max-page-size=0x20



CVS commit: src/sys/arch/i386/stand/boot

2017-11-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 14 09:55:41 UTC 2017

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Add missing ).


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/stand/boot/boot2.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/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.69 src/sys/arch/i386/stand/boot/boot2.c:1.70
--- src/sys/arch/i386/stand/boot/boot2.c:1.69	Wed Nov  8 18:31:00 2017
+++ src/sys/arch/i386/stand/boot/boot2.c	Tue Nov 14 09:55:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.69 2017/11/08 18:31:00 maxv Exp $	*/
+/*	$NetBSD: boot2.c,v 1.70 2017/11/14 09:55:41 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -402,7 +402,7 @@ command_help(char *arg)
 
 	printf("commands are:\n"
 	   "boot [xdNx:][filename] [-12acdqsvxz]\n"
-	   " (ex. \"hd0a:netbsd.old -s\"\n"
+	   " (ex. \"hd0a:netbsd.old -s\")\n"
 	   "pkboot [xdNx:][filename] [-12acdqsvxz]\n"
 #if LIBSA_ENABLE_LS_OP
 	   "ls [path]\n"



CVS commit: src/external/gpl3/gcc

2017-11-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Nov 14 09:04:17 UTC 2017

Modified Files:
src/external/gpl3/gcc/dist/gcc: toplev.c
src/external/gpl3/gcc/dist/libiberty: vprintf-support.c
src/external/gpl3/gcc/lib/liblto_plugin: Makefile

Log Message:
sync with gcc.old.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 src/external/gpl3/gcc/dist/gcc/toplev.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/libiberty/vprintf-support.c
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gcc/lib/liblto_plugin/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/toplev.c
diff -u src/external/gpl3/gcc/dist/gcc/toplev.c:1.1.1.5 src/external/gpl3/gcc/dist/gcc/toplev.c:1.2
--- src/external/gpl3/gcc/dist/gcc/toplev.c:1.1.1.5	Sat Nov 11 23:49:42 2017
+++ src/external/gpl3/gcc/dist/gcc/toplev.c	Tue Nov 14 09:04:16 2017
@@ -1386,8 +1386,7 @@ process_options (void)
 
   if (flag_sanitize & SANITIZE_THREAD)
 	{
-	  error (UNKNOWN_LOCATION,
-		 "%<-fcheck-pointer-bounds%> is not supported with "
+	  error ("%<-fcheck-pointer-bounds%> is not supported with "
 		 "Thread Sanitizer");
 
 	  flag_check_pointer_bounds = 0;

Index: src/external/gpl3/gcc/dist/libiberty/vprintf-support.c
diff -u src/external/gpl3/gcc/dist/libiberty/vprintf-support.c:1.1.1.1 src/external/gpl3/gcc/dist/libiberty/vprintf-support.c:1.2
--- src/external/gpl3/gcc/dist/libiberty/vprintf-support.c:1.1.1.1	Sun Jan 24 06:05:56 2016
+++ src/external/gpl3/gcc/dist/libiberty/vprintf-support.c	Tue Nov 14 09:04:17 2017
@@ -36,6 +36,7 @@ Floor, Boston, MA 02110-1301, USA.  */
 extern unsigned long strtoul ();
 #endif
 #include "libiberty.h"
+#include "vprintf-support.h"
 
 int
 libiberty_vprintf_buffer_size (const char *format, va_list args)

Index: src/external/gpl3/gcc/lib/liblto_plugin/Makefile
diff -u src/external/gpl3/gcc/lib/liblto_plugin/Makefile:1.8 src/external/gpl3/gcc/lib/liblto_plugin/Makefile:1.9
--- src/external/gpl3/gcc/lib/liblto_plugin/Makefile:1.8	Sat Nov 11 07:50:39 2017
+++ src/external/gpl3/gcc/lib/liblto_plugin/Makefile	Tue Nov 14 09:04:17 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2017/11/11 07:50:39 kamil Exp $
+#	$NetBSD: Makefile,v 1.9 2017/11/14 09:04:17 mrg Exp $
 
 .include 
 .include 
@@ -11,8 +11,11 @@ GNUHOSTDIST=	${DIST}
 SRCS=		lto-plugin.c hashtab.c simple-object.c pex-unix.c \
 		pex-common.c argv.c make-temp-file.c concat.c \
 		simple-object-elf.c simple-object-mach-o.c \
-		simple-object-coff.c simple-object-xcoff.c xstrerror.c \
-		safe-ctype.c
+		simple-object-coff.c simple-object-xcoff.c \
+
+# libiberty
+SRCS+=		xstrerror.c xasprintf.c xvasprintf.c safe-ctype.c \
+		vprintf-support.c
 
 CPPFLAGS+=	-I${DIST}/include -I. 
 CPPFLAGS+=	-DHAVE_CONFIG_H



CVS commit: src/external/gpl3/gcc.old

2017-11-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Nov 14 08:52:20 UTC 2017

Modified Files:
src/external/gpl3/gcc.old/dist/libiberty: vprintf-support.c
src/external/gpl3/gcc.old/lib/liblto_plugin: Makefile

Log Message:
attempt to fix liblto_plugin build.  on sparc it at least now
appears to have no missing symbols.  add xasprintf.c, xvasprintf.c,
and vprintf-support.c.

fix vprintf-support.c to include vprintf-support.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc.old/dist/libiberty/vprintf-support.c
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile

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

Modified files:

Index: src/external/gpl3/gcc.old/dist/libiberty/vprintf-support.c
diff -u src/external/gpl3/gcc.old/dist/libiberty/vprintf-support.c:1.1.1.1 src/external/gpl3/gcc.old/dist/libiberty/vprintf-support.c:1.2
--- src/external/gpl3/gcc.old/dist/libiberty/vprintf-support.c:1.1.1.1	Sun Jul 23 01:04:58 2017
+++ src/external/gpl3/gcc.old/dist/libiberty/vprintf-support.c	Tue Nov 14 08:52:20 2017
@@ -36,6 +36,7 @@ Floor, Boston, MA 02110-1301, USA.  */
 extern unsigned long strtoul ();
 #endif
 #include "libiberty.h"
+#include "vprintf-support.h"
 
 int
 libiberty_vprintf_buffer_size (const char *format, va_list args)

Index: src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile
diff -u src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile:1.7 src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile:1.8
--- src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile:1.7	Sat Nov 11 07:49:43 2017
+++ src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile	Tue Nov 14 08:52:20 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2017/11/11 07:49:43 kamil Exp $
+#	$NetBSD: Makefile,v 1.8 2017/11/14 08:52:20 mrg Exp $
 
 .include 
 .include 
@@ -11,8 +11,11 @@ GNUHOSTDIST=	${DIST}
 SRCS=		lto-plugin.c hashtab.c simple-object.c pex-unix.c \
 		pex-common.c argv.c make-temp-file.c concat.c \
 		simple-object-elf.c simple-object-mach-o.c \
-		simple-object-coff.c simple-object-xcoff.c xstrerror.c \
-		safe-ctype.c
+		simple-object-coff.c simple-object-xcoff.c \
+
+# libiberty
+SRCS+=		xstrerror.c xasprintf.c xvasprintf.c safe-ctype.c \
+		vprintf-support.c
 
 CPPFLAGS+=	-I${DIST}/include -I. 
 CPPFLAGS+=	-DHAVE_CONFIG_H