CVS commit: [pgoyette-localcount] src/sys

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 05:54:40 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: audio.c cgd.c fss.c ld.c md.c
rndpseudo.c vnd.c
src/sys/dev/dm [pgoyette-localcount]: device-mapper.c
src/sys/dev/pad [pgoyette-localcount]: pad.c
src/sys/dev/pci [pgoyette-localcount]: pci_usrreq.c
src/sys/dev/pud [pgoyette-localcount]: pud_dev.c
src/sys/dev/putter [pgoyette-localcount]: putter.c
src/sys/dev/raidframe [pgoyette-localcount]: rf_netbsdkintf.c
src/sys/dev/scsipi [pgoyette-localcount]: cd.c sd.c
src/sys/dev/sysmon [pgoyette-localcount]: sysmon.c
src/sys/dev/usb [pgoyette-localcount]: ucom.c ulpt.c
src/sys/dev/wscons [pgoyette-localcount]: wskbd.c wsmouse.c
src/sys/external/bsd/ipf/netinet [pgoyette-localcount]: ip_fil_netbsd.c
src/sys/kern [pgoyette-localcount]: kern_drvctl.c tty_ptm.c tty_pty.c
tty_tty.c
src/sys/net [pgoyette-localcount]: bpf.c if_tap.c
src/sys/net/npf [pgoyette-localcount]: npf.c
src/sys/netsmb [pgoyette-localcount]: smb_dev.c
src/sys/opencrypto [pgoyette-localcount]: cryptodev.c
src/sys/rump/librump/rumpvfs [pgoyette-localcount]: devnull.c rumpblk.c
src/sys/sys [pgoyette-localcount]: localcount.h

Log Message:
Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT.  This better describes
what we're doing, and why.


To generate a diff of this commit:
cvs rdiff -u -r1.268.2.4 -r1.268.2.5 src/sys/dev/audio.c
cvs rdiff -u -r1.108.2.15 -r1.108.2.16 src/sys/dev/cgd.c
cvs rdiff -u -r1.93.2.2 -r1.93.2.3 src/sys/dev/fss.c
cvs rdiff -u -r1.94.2.2 -r1.94.2.3 src/sys/dev/ld.c
cvs rdiff -u -r1.76.2.2 -r1.76.2.3 src/sys/dev/md.c
cvs rdiff -u -r1.35.2.2 -r1.35.2.3 src/sys/dev/rndpseudo.c
cvs rdiff -u -r1.256.2.6 -r1.256.2.7 src/sys/dev/vnd.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.25.2.3 -r1.25.2.4 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/dev/pci/pci_usrreq.c
cvs rdiff -u -r1.7.2.3 -r1.7.2.4 src/sys/dev/pud/pud_dev.c
cvs rdiff -u -r1.35.8.2 -r1.35.8.3 src/sys/dev/putter/putter.c
cvs rdiff -u -r1.345.2.5 -r1.345.2.6 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.331.2.2 -r1.331.2.3 src/sys/dev/scsipi/cd.c
cvs rdiff -u -r1.317.2.2 -r1.317.2.3 src/sys/dev/scsipi/sd.c
cvs rdiff -u -r1.28.2.2 -r1.28.2.3 src/sys/dev/sysmon/sysmon.c
cvs rdiff -u -r1.113.2.2 -r1.113.2.3 src/sys/dev/usb/ucom.c
cvs rdiff -u -r1.97.2.2 -r1.97.2.3 src/sys/dev/usb/ulpt.c
cvs rdiff -u -r1.136.2.2 -r1.136.2.3 src/sys/dev/wscons/wskbd.c
cvs rdiff -u -r1.66.8.2 -r1.66.8.3 src/sys/dev/wscons/wsmouse.c
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/kern/kern_drvctl.c
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/kern/tty_ptm.c
cvs rdiff -u -r1.142.2.3 -r1.142.2.4 src/sys/kern/tty_pty.c
cvs rdiff -u -r1.40.8.2 -r1.40.8.3 src/sys/kern/tty_tty.c
cvs rdiff -u -r1.199.2.2 -r1.199.2.3 src/sys/net/bpf.c
cvs rdiff -u -r1.84.2.2 -r1.84.2.3 src/sys/net/if_tap.c
cvs rdiff -u -r1.31.2.2 -r1.31.2.3 src/sys/net/npf/npf.c
cvs rdiff -u -r1.44.2.3 -r1.44.2.4 src/sys/netsmb/smb_dev.c
cvs rdiff -u -r1.85.2.2 -r1.85.2.3 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/sys/rump/librump/rumpvfs/devnull.c
cvs rdiff -u -r1.64.2.2 -r1.64.2.3 src/sys/rump/librump/rumpvfs/rumpblk.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/sys/localcount.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.268.2.4 src/sys/dev/audio.c:1.268.2.5
--- src/sys/dev/audio.c:1.268.2.4	Tue Jul 26 03:52:14 2016
+++ src/sys/dev/audio.c	Tue Jul 26 05:54:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $	*/
+/*	$NetBSD: audio.c,v 1.268.2.5 2016/07/26 05:54:39 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.5 2016/07/26 05:54:39 pgoyette Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -348,7 +348,7 @@ dev_type_mmap(audiommap);
 dev_type_kqfilter(audiokqfilter);
 
 const struct cdevsw audio_cdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open = audioopen,
 	.d_close = audioclose,
 	.d_read = audioread,

Index: src/sys/dev/cgd.c
diff -u src/sys/dev/cgd.c:1.108.2.15 src/sys/dev/cgd.c:1.108.2.16
--- src/sys/dev/cgd.c:1.108.2.15	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/cgd.c	Tue Jul 26 05:54:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108.2.15 2016/07/26 03:24:20 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.108.2.16 2016/07/26 05:54:39 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ 

CVS commit: src/sys

2016-07-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jul 26 05:53:30 UTC 2016

Modified Files:
src/sys/netinet: ip_flow.c
src/sys/netinet6: ip6_flow.c

Log Message:
Simplify by using atomic_swap instead of mutex

Suggested by kefren@


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/netinet/ip_flow.c
cvs rdiff -u -r1.28 -r1.29 src/sys/netinet6/ip6_flow.c

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

Modified files:

Index: src/sys/netinet/ip_flow.c
diff -u src/sys/netinet/ip_flow.c:1.73 src/sys/netinet/ip_flow.c:1.74
--- src/sys/netinet/ip_flow.c:1.73	Mon Jul 11 07:37:00 2016
+++ src/sys/netinet/ip_flow.c	Tue Jul 26 05:53:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_flow.c,v 1.73 2016/07/11 07:37:00 ozaki-r Exp $	*/
+/*	$NetBSD: ip_flow.c,v 1.74 2016/07/26 05:53:30 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.73 2016/07/11 07:37:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.74 2016/07/26 05:53:30 ozaki-r Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -430,7 +431,7 @@ ipflow_reap(bool just_one)
 	return NULL;
 }
 
-static bool ipflow_work_enqueued = false;
+static unsigned int ipflow_work_enqueued = 0;
 
 static void
 ipflow_slowtimo_work(struct work *wk, void *arg)
@@ -439,6 +440,9 @@ ipflow_slowtimo_work(struct work *wk, vo
 	struct ipflow *ipf, *next_ipf;
 	uint64_t *ips;
 
+	/* We can allow enqueuing another work at this point */
+	atomic_swap_uint(_work_enqueued, 0);
+
 	mutex_enter(softnet_lock);
 	mutex_enter(_lock);
 	KERNEL_LOCK(1, NULL);
@@ -458,7 +462,6 @@ ipflow_slowtimo_work(struct work *wk, vo
 			ipf->ipf_uses = 0;
 		}
 	}
-	ipflow_work_enqueued = false;
 	KERNEL_UNLOCK_ONE(NULL);
 	mutex_exit(_lock);
 	mutex_exit(softnet_lock);
@@ -469,13 +472,8 @@ ipflow_slowtimo(void)
 {
 
 	/* Avoid enqueuing another work when one is already enqueued */
-	mutex_enter(_lock);
-	if (ipflow_work_enqueued) {
-		mutex_exit(_lock);
+	if (atomic_swap_uint(_work_enqueued, 1) == 1)
 		return;
-	}
-	ipflow_work_enqueued = true;
-	mutex_exit(_lock);
 
 	workqueue_enqueue(ipflow_slowtimo_wq, _slowtimo_wk, NULL);
 }

Index: src/sys/netinet6/ip6_flow.c
diff -u src/sys/netinet6/ip6_flow.c:1.28 src/sys/netinet6/ip6_flow.c:1.29
--- src/sys/netinet6/ip6_flow.c:1.28	Mon Jul 11 07:37:00 2016
+++ src/sys/netinet6/ip6_flow.c	Tue Jul 26 05:53:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_flow.c,v 1.28 2016/07/11 07:37:00 ozaki-r Exp $	*/
+/*	$NetBSD: ip6_flow.c,v 1.29 2016/07/26 05:53:30 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.28 2016/07/11 07:37:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.29 2016/07/26 05:53:30 ozaki-r Exp $");
 
 #include 
 #include 
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -466,13 +467,16 @@ ip6flow_reap(int just_one)
 	return ip6f;
 }
 
-static bool ip6flow_work_enqueued = false;
+static unsigned int ip6flow_work_enqueued = 0;
 
 void
 ip6flow_slowtimo_work(struct work *wk, void *arg)
 {
 	struct ip6flow *ip6f, *next_ip6f;
 
+	/* We can allow enqueuing another work at this point */
+	atomic_swap_uint(_work_enqueued, 0);
+
 	mutex_enter(softnet_lock);
 	mutex_enter(_lock);
 	KERNEL_LOCK(1, NULL);
@@ -490,7 +494,6 @@ ip6flow_slowtimo_work(struct work *wk, v
 			ip6f->ip6f_forwarded = 0;
 		}
 	}
-	ip6flow_work_enqueued = false;
 
 	KERNEL_UNLOCK_ONE(NULL);
 	mutex_exit(_lock);
@@ -502,13 +505,8 @@ ip6flow_slowtimo(void)
 {
 
 	/* Avoid enqueuing another work when one is already enqueued */
-	mutex_enter(_lock);
-	if (ip6flow_work_enqueued) {
-		mutex_exit(_lock);
+	if (atomic_swap_uint(_work_enqueued, 1) == 1)
 		return;
-	}
-	ip6flow_work_enqueued = true;
-	mutex_exit(_lock);
 
 	workqueue_enqueue(ip6flow_slowtimo_wq, _slowtimo_wk, NULL);
 }



CVS commit: src/sys/arch/mips/mips

2016-07-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 26 05:52:55 UTC 2016

Modified Files:
src/sys/arch/mips/mips: locore.S

Log Message:
Set the cause register to zero after disabling interrupts now that spl0
doesn't do it.

My cobalt now boots (again again)


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/sys/arch/mips/mips/locore.S

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

Modified files:

Index: src/sys/arch/mips/mips/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.202 src/sys/arch/mips/mips/locore.S:1.203
--- src/sys/arch/mips/mips/locore.S:1.202	Mon Jul 11 16:15:36 2016
+++ src/sys/arch/mips/mips/locore.S	Tue Jul 26 05:52:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.202 2016/07/11 16:15:36 matt Exp $	*/
+/*	$NetBSD: locore.S,v 1.203 2016/07/26 05:52:55 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -97,6 +97,8 @@ _C_LABEL(kernel_text):
 	mtc0	zero, MIPS_COP_0_STATUS		# Disable interrupts
 	COP0_SYNC
 #endif
+	mtc0	zero, MIPS_COP_0_CAUSE
+	COP0_SYNC
 #ifdef MIPS64_OCTEON
 	//
 	// U-boot on the erlite starts all cpus at the kernel entry point.



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 04:30:50 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Fix some sloppy typos


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.5 -r1.256.2.6 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.5 src/sys/dev/vnd.c:1.256.2.6
--- src/sys/dev/vnd.c:1.256.2.5	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/vnd.c	Tue Jul 26 04:30:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.5 2016/07/26 03:24:20 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.6 2016/07/26 04:30:50 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.5 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.6 2016/07/26 04:30:50 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -312,7 +312,7 @@ vnd_spawn(int unit)
 	if (config_attach_pseudo(cf) == NULL)
 		return NULL;
 
-	*self = device_lookup_acquire(_cd, unit);
+	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return NULL;
 	else {  
@@ -320,7 +320,7 @@ vnd_spawn(int unit)
 		 * Note that we return while still holding a reference
 		 * to the device!
 		 */
-		return device_private(*self);
+		return device_private(self);
 	}
 }
 
@@ -353,7 +353,7 @@ vndopen(dev_t dev, int flags, int mode, 
 #endif
 	self = device_lookup_acquire(_cd, unit);
 	if (self != NULL)
-		sc = device-private(self);
+		sc = device_private(self);
 	else {
 		sc = vnd_spawn(unit);
 		if (sc == NULL)
@@ -1055,7 +1055,7 @@ vndwrite(dev_t dev, struct uio *uio, int
 	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return ENXIO;
-	sc = device_lookup_private_acquire(_cd, unit, );
+	sc = device_private(self);
 
 	if ((sc->sc_flags & VNF_INITED) == 0) {
 		device_release(self);
@@ -1079,7 +1079,7 @@ vnd_cget(struct lwp *l, int unit, int *u
 	if (*un < 0)
 		return EINVAL;
 
-	self - device_lookup_acquire(_cd, unit);
+	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return -1;
 	vnd = device_private(self);
@@ -1226,12 +1226,11 @@ vndioctl(dev_t dev, u_long cmd, void *da
 		break;
 	}
 
-	vnd = device_lookup_private(_cd, unit);
-	if (vnd == NULL) {
-		if (self != NULL)
-			device_release(self);
+	self = device_lookup_acquire(_cd, unit);
+	if (self != NULL)
 		return ENXIO;
-	}
+	vnd = device_private(self);
+
 	vio = (struct vnd_ioctl *)data;
 
 	/* Must be open for writes for these commands... */



CVS commit: othersrc/external/bsd/delta/dist

2016-07-25 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jul 26 04:24:27 UTC 2016

Modified Files:
othersrc/external/bsd/delta/dist: delta.1 delta.h libdelta.c main.c

Log Message:
Update delta to version 20160725 in light of the SA to bspatch at
https://www.freebsd.org/security/advisories/FreeBSD-SA-16:25.bspatch.asc

+ check for negative offsets provided in the binary patch file.
Bug reported (independently) by The Chromium Project and Lu Ting-Pin.

+ add a -V option to delta to print the version number of the
delta(1) utility to stderr, and then exit


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/delta/dist/delta.1 \
othersrc/external/bsd/delta/dist/delta.h \
othersrc/external/bsd/delta/dist/libdelta.c \
othersrc/external/bsd/delta/dist/main.c

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

Modified files:

Index: othersrc/external/bsd/delta/dist/delta.1
diff -u othersrc/external/bsd/delta/dist/delta.1:1.1 othersrc/external/bsd/delta/dist/delta.1:1.2
--- othersrc/external/bsd/delta/dist/delta.1:1.1	Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/delta.1	Tue Jul 26 04:24:27 2016
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.1,v 1.1 2005/08/06 01:59:05 cperciva Exp $
 .\"
-.Dd April 14, 2016
+.Dd July 25, 2016
 .Dt DELTA 1
 .Os
 .Sh NAME
@@ -33,7 +33,7 @@
 .Nd manage deltas between two binary files
 .Sh SYNOPSIS
 .Nm
-.Op Fl dp
+.Op Fl Vdp
 .Ar oldfile newfile patchfile
 .Sh DESCRIPTION
 .Nm
Index: othersrc/external/bsd/delta/dist/delta.h
diff -u othersrc/external/bsd/delta/dist/delta.h:1.1 othersrc/external/bsd/delta/dist/delta.h:1.2
--- othersrc/external/bsd/delta/dist/delta.h:1.1	Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/delta.h	Tue Jul 26 04:24:27 2016
@@ -23,7 +23,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef DELTA_H_
-#define DELTA_H_	20160414
+#define DELTA_H_	20160725
+
+#define DELTA_VERSION	"20160725"
 
 struct delta_t;
 typedef struct delta_t	delta_t;
Index: othersrc/external/bsd/delta/dist/libdelta.c
diff -u othersrc/external/bsd/delta/dist/libdelta.c:1.1 othersrc/external/bsd/delta/dist/libdelta.c:1.2
--- othersrc/external/bsd/delta/dist/libdelta.c:1.1	Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/libdelta.c	Tue Jul 26 04:24:27 2016
@@ -659,9 +659,14 @@ delta_patch_mem(delta_t *delta, const vo
 			ctrl[i] = get64(>control.v[ctlc], );
 			ctlc += len;
 		}
+		/* sanity check for negative offsets */
+		if (ctrl[0] < 0 || ctrl[1] < 0) {
+			warnx("negative offset, found corrupt patch");
+			return 0;
+		}
 		/* Sanity-check */
 		if (newpos + ctrl[0] > delta->newsize) {
-			warnx("Corrupt patch 1\n");
+			warnx("Corrupt patch 1");
 			return 0;
 		}
 		/* Read diff string */
@@ -678,7 +683,7 @@ delta_patch_mem(delta_t *delta, const vo
 		oldpos += ctrl[0];
 		/* Sanity-check */
 		if (newpos + ctrl[1] > delta->newsize) {
-			warnx("Corrupt patch 2\n");
+			warnx("Corrupt patch 2");
 			return 0;
 		}
 		/* Read extra string */
Index: othersrc/external/bsd/delta/dist/main.c
diff -u othersrc/external/bsd/delta/dist/main.c:1.1 othersrc/external/bsd/delta/dist/main.c:1.2
--- othersrc/external/bsd/delta/dist/main.c:1.1	Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/main.c	Tue Jul 26 04:24:27 2016
@@ -39,8 +39,11 @@ main(int argc, char **argv)
 	int	i;
 
 	dodiff = 0;
-	while ((i = getopt(argc, argv, "dp")) != -1) {
+	while ((i = getopt(argc, argv, "Vdp")) != -1) {
 		switch(i) {
+		case 'V':
+			fprintf(stderr, "delta-%s\n", DELTA_VERSION);
+			exit(EXIT_SUCCESS);
 		case 'd':
 			dodiff = 1;
 			break;



CVS commit: src/doc

2016-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 26 04:18:04 UTC 2016

Added Files:
src/doc: TODO.8

Log Message:
First cut at netbsd-8 branch objectives.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/doc/TODO.8

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

Added files:

Index: src/doc/TODO.8
diff -u /dev/null src/doc/TODO.8:1.1
--- /dev/null	Tue Jul 26 04:18:04 2016
+++ src/doc/TODO.8	Tue Jul 26 04:18:04 2016
@@ -0,0 +1,12 @@
+$NetBSD: TODO.8,v 1.1 2016/07/26 04:18:04 martin Exp $
+
+Items we (currently) plan to finish before branching netbsd-8:
+
+ - find a releng release driver volunteer
+ - import binutils 2.26.1
+ - switch all architectures to gcc 5.4
+ - switch all architectures to new binutils and gdb
+ - enable PIE/ASLR on all architectures (that have switched to gcc 5.4 if
+   we fail previous item) where it works
+
+and of course: fix as many bugs as possible.



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 03:52:14 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: audio.c

Log Message:
Fix typo in local copy


To generate a diff of this commit:
cvs rdiff -u -r1.268.2.3 -r1.268.2.4 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.268.2.3 src/sys/dev/audio.c:1.268.2.4
--- src/sys/dev/audio.c:1.268.2.3	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/audio.c	Tue Jul 26 03:52:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.268.2.3 2016/07/26 03:24:20 pgoyette Exp $	*/
+/*	$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.3 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1186,7 +1186,7 @@ audio_enter(dev_t dev, krw_t rw, struct 
 	struct audio_softc *sc;
 
 	/* First, find the device and take sc_lock. */
-	self = device_lookup_acquire(_cd, ADUIOUNIT(dev));
+	self = device_lookup_acquire(_cd, AUDIOUNIT(dev));
 	if (self == NULL)
 		return ENXIO;
 	sc = device_private(self);



CVS commit: [pgoyette-localcount] src

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 03:24:25 UTC 2016

Modified Files:
src/crypto/external/cpl/tpm-tools/bin/tpm_sealdata 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_unsealdata 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_unseal 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_utils 
[pgoyette-localcount]:
Makefile
src/doc [pgoyette-localcount]: 3RDPARTY BRANCHES CHANGES
src/etc [pgoyette-localcount]: MAKEDEV.tmpl
src/etc/rc.d [pgoyette-localcount]: mountcritlocal
src/external/bsd/mdocml/bin/mandoc [pgoyette-localcount]: Makefile
src/external/bsd/mdocml/dist [pgoyette-localcount]: INSTALL LICENSE
Makefile Makefile.depend NEWS TODO apropos.1 att.c cgi.c
cgi.h.example chars.c compat_fts.c compat_fts.h compat_getsubopt.c
compat_ohash.c compat_ohash.h compat_reallocarray.c
compat_sqlite3_errstr.c compat_strcasestr.c compat_strsep.c
compat_strtonum.c configure configure.local.example demandoc.1
demandoc.c eqn.7 eqn.c eqn_html.c eqn_term.c gmdiff html.c html.h
lib.c lib.in libman.h libmandoc.h libmdoc.h libroff.h main.c main.h
makewhatis.8 man.1 man.7 man.c man.cgi.8 man.h man_hash.c
man_html.c man_macro.c man_term.c man_validate.c mandoc.1 mandoc.3
mandoc.c mandoc.db.5 mandoc.h mandoc_aux.c mandoc_aux.h
mandoc_char.7 mandoc_escape.3 mandoc_headers.3 mandoc_html.3
mandoc_malloc.3 mandocdb.c manpage.c manpath.c mansearch.3
mansearch.c mansearch.h mansearch_const.c mchars_alloc.3 mdoc.7
mdoc.c mdoc.h mdoc_argv.c mdoc_hash.c mdoc_html.c mdoc_macro.c
mdoc_man.c mdoc_term.c mdoc_validate.c msec.c msec.in out.c out.h
preconv.c predefs.in read.c roff.7 roff.c st.c st.in tbl.3 tbl.7
tbl.c tbl_data.c tbl_html.c tbl_layout.c tbl_opts.c tbl_term.c
term.c term.h term_ascii.c term_ps.c test-dirent-namlen.c
test-fts.c test-getsubopt.c test-mmap.c test-ohash.c
test-reallocarray.c test-sqlite3.c test-sqlite3_errstr.c
test-strcasestr.c test-strlcat.c test-strlcpy.c test-strptime.c
test-strsep.c test-strtonum.c test-wchar.c tree.c
src/external/bsd/mdocml/include [pgoyette-localcount]: config.h
src/external/bsd/mdocml/lib/libmandoc [pgoyette-localcount]: Makefile
src/external/bsd/mdocml/man [pgoyette-localcount]: Makefile
src/external/gpl3/binutils/dist/bfd [pgoyette-localcount]: elf32-vax.c
src/external/gpl3/binutils/lib/libbfd [pgoyette-localcount]: Makefile
src/games/fortune/datfiles [pgoyette-localcount]: fortunes
src/include [pgoyette-localcount]: limits.h
src/lib/libc/arch/hppa/gen [pgoyette-localcount]: __setjmp14.S
src/lib/libc/gen [pgoyette-localcount]: arc4random.3
src/lib/libc/sys [pgoyette-localcount]: sigaction.2
src/lib/libpthread [pgoyette-localcount]: pthread_mutex.c
pthread_types.h
src/libexec/ftpd [pgoyette-localcount]: ftpd.c
src/libexec/httpd [pgoyette-localcount]: content-bozo.c
src/libexec/mail.local [pgoyette-localcount]: mail.local.c
src/libexec/tftpd [pgoyette-localcount]: tftpd.c
src/sbin/mount_null [pgoyette-localcount]: mount_null.c
src/share/man/man9 [pgoyette-localcount]: driver.9
src/share/misc [pgoyette-localcount]: acronyms
src/sys/arch/amd64/acpi [pgoyette-localcount]: acpi_wakecode.S
acpi_wakeup_low.S
src/sys/arch/amd64/amd64 [pgoyette-localcount]: locore.S machdep.c
mptramp.S
src/sys/arch/amd64/include [pgoyette-localcount]: pmap.h
src/sys/arch/arm/arm32 [pgoyette-localcount]: arm32_machdep.c
src/sys/arch/arm/include [pgoyette-localcount]: cpufunc.h
src/sys/arch/evbarm/conf [pgoyette-localcount]: VTC100
src/sys/arch/i386/acpi [pgoyette-localcount]: acpi_wakecode.S
acpi_wakeup_low.S
src/sys/arch/i386/i386 [pgoyette-localcount]: locore.S machdep.c
src/sys/arch/macppc/dev [pgoyette-localcount]: awacs.c dbdma.c dbdma.h
esp.c if_bm.c if_mc.c kauai.c mesh.c snapper.c wdc_obio.c
src/sys/arch/mips/include [pgoyette-localcount]: cpu.h
src/sys/arch/mips/mips [pgoyette-localcount]: bus_dma.c
bus_space_alignstride_chipdep.c locore_mips1.S mipsX_subr.S
mips_machdep.c spl.S
src/sys/arch/mips/sibyte/dev [pgoyette-localcount]: sbbuswatch.c
sbmac.c sbobio.c sbscn.c sbtimer.c sbwdog.c
src/sys/arch/mips/sibyte/pci [pgoyette-localcount]: sbbrz.c sbbrz_pci.c
src/sys/arch/newsmips/apbus [pgoyette-localcount]: xafb.c
src/sys/arch/newsmips/dev 

CVS commit: src/sys/arch/alpha/tc

2016-07-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 26 03:09:55 UTC 2016

Modified Files:
src/sys/arch/alpha/tc: tc_bus_mem.c

Log Message:
>From Felix Deichmann:
While writing "slhci at tc" support, I noticed TC bus_space functions
for alpha don't work as they should (tc_bus_mem.c). Consideration of
dense vs. sparse space seems problematic, especially for widths < 4.

I found information mainly in

[1] https://web-docs.gsi.de/~kraemer/COLLECTION/DEC/d3syspmb.pdf
[2]
http://h20565.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c04623255

and a dirty (but tested) hack based on this is attached as an example.
It would be great if someone could have a look and do a cleaner version
preferably.

Especially the end of ([2] section 12.2.2) provides a summary of which
"instruction" to use for which data width in which space, and possible
side effects (unintentional double reads/writes) in dense space...


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/tc/tc_bus_mem.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/alpha/tc/tc_bus_mem.c
diff -u src/sys/arch/alpha/tc/tc_bus_mem.c:1.35 src/sys/arch/alpha/tc/tc_bus_mem.c:1.36
--- src/sys/arch/alpha/tc/tc_bus_mem.c:1.35	Mon Nov  4 11:55:31 2013
+++ src/sys/arch/alpha/tc/tc_bus_mem.c	Mon Jul 25 23:09:55 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: tc_bus_mem.c,v 1.35 2013/11/04 16:55:31 christos Exp $ */
+/* $NetBSD: tc_bus_mem.c,v 1.36 2016/07/26 03:09:55 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tc_bus_mem.c,v 1.35 2013/11/04 16:55:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tc_bus_mem.c,v 1.36 2016/07/26 03:09:55 christos Exp $");
 
 #include 
 #include 
@@ -364,32 +364,49 @@ tc_mem_barrier(void *v, bus_space_handle
 		alpha_wmb();
 }
 
+/*
+ * https://web-docs.gsi.de/~kraemer/COLLECTION/DEC/d3syspmb.pdf
+ * http://h20565.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c04623255
+ */
+#define TC_SPARSE_PTR(memh, off) \
+((void *)((memh)+ ((off & ((bus_size_t)-1 << 2)) << 1)))
+
 static inline uint8_t
 tc_mem_read_1(void *v, bus_space_handle_t memh, bus_size_t off)
 {
-	volatile uint8_t *p;
 
 	alpha_mb();		/* XXX XXX XXX */
 
-	if ((memh & TC_SPACE_SPARSE) != 0)
-		panic("tc_mem_read_1 not implemented for sparse space");
+	if ((memh & TC_SPACE_SPARSE) != 0) {
+		volatile uint32_t *p;
 
-	p = (uint8_t *)(memh + off);
-	return (*p);
+		p = TC_SPARSE_PTR(memh, off);
+		return ((*p >> ((off & 3) * 8)) & 0xff);
+	} else {
+		volatile uint8_t *p;
+
+		p = (uint8_t *)(memh + off);
+		return (*p);
+	}
 }
 
 static inline uint16_t
 tc_mem_read_2(void *v, bus_space_handle_t memh, bus_size_t off)
 {
-	volatile uint16_t *p;
 
 	alpha_mb();		/* XXX XXX XXX */
 
-	if ((memh & TC_SPACE_SPARSE) != 0)
-		panic("tc_mem_read_2 not implemented for sparse space");
+	if ((memh & TC_SPACE_SPARSE) != 0) {
+		volatile uint32_t *p;
 
-	p = (uint16_t *)(memh + off);
-	return (*p);
+		p = TC_SPARSE_PTR(memh, off);
+		return ((*p >> ((off & 2) * 8)) & 0x);
+	} else {
+		volatile uint16_t *p;
+
+		p = (uint16_t *)(memh + off);
+		return (*p);
+	}
 }
 
 static inline uint32_t
@@ -467,17 +484,13 @@ tc_mem_write_1(void *v, bus_space_handle
 
 	if ((memh & TC_SPACE_SPARSE) != 0) {
 		volatile uint64_t *p;
-		off &= 0x3;
-
-		p = (uint64_t *)(memh + (off << 1));
+		uint64_t mask = UINT64_C(0x1) << (32 + (off & 3));
 
-		*p = val;
-	} else {
-		volatile uint8_t *p;
+		p = TC_SPARSE_PTR(memh, off);
+		*p = mask | ((uint64_t)val << ((off & 3) * 8));
+	} else
+		panic("tc_mem_write_1 not implemented for dense space");
 
-		p = (uint8_t *)(memh + off);
-		*p = val;
-	}
 	alpha_mb();		/* XXX XXX XXX */
 }
 
@@ -487,18 +500,13 @@ tc_mem_write_2(void *v, bus_space_handle
 
 	if ((memh & TC_SPACE_SPARSE) != 0) {
 		volatile uint64_t *p;
+		uint64_t mask = UINT64_C(0x3) << (32 + (off & 2));
 
-		off &= 0x3;
+		p = TC_SPARSE_PTR(memh, off);
+		*p = mask | ((uint64_t)val << ((off & 2) * 8));
+	} else
+		panic("tc_mem_write_2 not implemented for dense space");
 
-		p = (uint64_t *)(memh + (off << 1));
-
-		*p = val;
-	} else {
-		volatile uint16_t *p;
-
-		p = (uint16_t *)(memh + off);
-		*p = val;
-	}
 	alpha_mb();		/* XXX XXX XXX */
 }
 
@@ -513,6 +521,7 @@ tc_mem_write_4(void *v, bus_space_handle
 	else
 		p = (uint32_t *)(memh + off);
 	*p = val;
+
 	alpha_mb();		/* XXX XXX XXX */
 }
 
@@ -526,6 +535,7 @@ tc_mem_write_8(void *v, bus_space_handle
 
 	p = (uint64_t *)(memh + off);
 	*p = val;
+
 	alpha_mb();		/* XXX XXX XXX */
 }
 



CVS commit: src/sys

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 01:49:49 UTC 2016

Modified Files:
src/sys/dev: vnd.c
src/sys/rump/dev/lib/libvnd: vnd_component.c

Log Message:
When calling devsw_attach() we need to use the expected/official driver
name (as listed in the devsw_conv[] table) to get the expected device
majors.  Once rump initialization is finished (ie, it has created its
required device nodes), we need to detach the [bc]devsw so the module
initialization code doesn't get EEXIST.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/dev/vnd.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libvnd/vnd_component.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256 src/sys/dev/vnd.c:1.257
--- src/sys/dev/vnd.c:1.256	Tue Dec  8 20:36:14 2015
+++ src/sys/dev/vnd.c	Tue Jul 26 01:49:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256 2015/12/08 20:36:14 christos Exp $	*/
+/*	$NetBSD: vnd.c,v 1.257 2016/07/26 01:49:48 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256 2015/12/08 20:36:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.257 2016/07/26 01:49:48 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -118,6 +118,7 @@ __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.25
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2041,10 +2042,6 @@ vnd_set_geometry(struct vnd_softc *vnd)
 	disk_set_info(vnd->sc_dev, >sc_dkdev, NULL);
 }
 
-#ifdef _MODULE
-
-#include 
-
 #ifdef VND_COMPRESSION
 #define VND_DEPENDS "zlib"
 #else
@@ -2052,15 +2049,21 @@ vnd_set_geometry(struct vnd_softc *vnd)
 #endif
 
 MODULE(MODULE_CLASS_DRIVER, vnd, VND_DEPENDS);
+
+#ifdef _MODULE
+int vnd_bmajor = -1, vnd_cmajor = -1;
+
 CFDRIVER_DECL(vnd, DV_DISK, NULL);
+#endif
 
 static int
 vnd_modcmd(modcmd_t cmd, void *arg)
 {
-	int bmajor = -1, cmajor = -1,  error = 0;
+	int error = 0;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+#ifdef _MODULE
 		error = config_cfdriver_attach(_cd);
 		if (error)
 			break;
@@ -2068,27 +2071,57 @@ vnd_modcmd(modcmd_t cmd, void *arg)
 		error = config_cfattach_attach(vnd_cd.cd_name, _ca);
 	if (error) {
 			config_cfdriver_detach(_cd);
-			aprint_error("%s: unable to register cfattach\n",
-			vnd_cd.cd_name);
+			aprint_error("%s: unable to register cfattach for \n"
+			"%s, error %d", __func__, vnd_cd.cd_name, error);
 			break;
 		}
 
-		error = devsw_attach("vnd", _bdevsw, ,
-		_cdevsw, );
+/*
+ * Attach the {b,c}devsw's
+ */
+		error = devsw_attach("vnd", _bdevsw, _bmajor,
+		_cdevsw, _cmajor);
+/*
+ * If devsw_attach fails, remove from autoconf database
+ */
 		if (error) {
 			config_cfattach_detach(vnd_cd.cd_name, _ca);
 			config_cfdriver_detach(_cd);
+aprint_error("%s: unable to attach %s devsw, "
+"error %d", __func__, vnd_cd.cd_name, error);
 			break;
 		}
-
+#endif
 		break;
 
 	case MODULE_CMD_FINI:
-		error = config_cfattach_detach(vnd_cd.cd_name, _ca);
-		if (error)
-			break;
-		config_cfdriver_detach(_cd);
+#ifdef _MODULE
+/*
+ * Remove {b,c}devsw's
+ */
 		devsw_detach(_bdevsw, _cdevsw);
+
+/*
+ * Now remove device from autoconf database
+ */
+		error = config_cfattach_detach(vnd_cd.cd_name, _ca);
+if (error) { 
+error = devsw_attach("vnd", _bdevsw, _bmajor,
+_cdevsw, _cmajor);
+aprint_error("%s: failed to detach %s cfattach, "
+"error %d\n", __func__, vnd_cd.cd_name, error);
+break;
+}
+error = config_cfdriver_detach(_cd);
+if (error) {
+config_cfattach_attach(vnd_cd.cd_name, _ca); 
+devsw_attach("vnd", _bdevsw, _bmajor,
+_cdevsw, _cmajor);
+aprint_error("%s: failed to detach %s cfdriver, "
+"error %d\n", __func__, vnd_cd.cd_name, error);
+break;
+}
+#endif
 		break;
 
 	case MODULE_CMD_STAT:
@@ -2100,5 +2133,3 @@ vnd_modcmd(modcmd_t cmd, void *arg)
 
 	return error;
 }
-
-#endif

Index: src/sys/rump/dev/lib/libvnd/vnd_component.c
diff -u src/sys/rump/dev/lib/libvnd/vnd_component.c:1.2 src/sys/rump/dev/lib/libvnd/vnd_component.c:1.3
--- src/sys/rump/dev/lib/libvnd/vnd_component.c:1.2	Tue Jan 26 23:12:16 2016
+++ src/sys/rump/dev/lib/libvnd/vnd_component.c	Tue Jul 26 01:49:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd_component.c,v 1.2 

CVS commit: src/sys/arch/powerpc/booke/dev

2016-07-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Jul 26 01:36:51 UTC 2016

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
IFQ_PURGE() must be called only after call if_initialize().
it lock ifp->if_snd.ifq_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/booke/dev/pq3etsec.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/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.27 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.28
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.27	Fri Jun 10 13:27:12 2016
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Tue Jul 26 01:36:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.27 2016/06/10 13:27:12 ozaki-r Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.28 2016/07/26 01:36:50 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.27 2016/06/10 13:27:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.28 2016/07/26 01:36:50 nonaka Exp $");
 
 #include 
 #include 
@@ -791,8 +791,6 @@ pq3etsec_attach(device_t parent, device_
 	ifp->if_stop = pq3etsec_ifstop;
 	IFQ_SET_READY(>if_snd);
 
-	pq3etsec_ifstop(ifp, true);
-
 	/*
 	 * Attach the interface.
 	 */
@@ -800,6 +798,8 @@ pq3etsec_attach(device_t parent, device_
 	ether_ifattach(ifp, enaddr);
 	if_register(ifp);
 
+	pq3etsec_ifstop(ifp, true);
+
 	evcnt_attach_dynamic(>sc_ev_rx_stall, EVCNT_TYPE_MISC,
 	NULL, xname, "rx stall");
 	evcnt_attach_dynamic(>sc_ev_tx_stall, EVCNT_TYPE_MISC,



CVS commit: src/sys/net

2016-07-25 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Mon Jul 25 23:46:09 UTC 2016

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

Log Message:
Restore correct test for return value from aarpresolve().


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.225 src/sys/net/if_ethersubr.c:1.226
--- src/sys/net/if_ethersubr.c:1.225	Tue Jun 21 03:54:04 2016
+++ src/sys/net/if_ethersubr.c	Mon Jul 25 23:46:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.225 2016/06/21 03:54:04 knakahara Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.226 2016/07/25 23:46:09 rjs Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.225 2016/06/21 03:54:04 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.226 2016/07/25 23:46:09 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -300,7 +300,7 @@ ether_output(struct ifnet * const ifp0, 
 #ifdef NETATALK
 case AF_APPLETALK:
 		KERNEL_LOCK(1, NULL);
-		if (aarpresolve(ifp, m, (const struct sockaddr_at *)dst, edst)) {
+		if (!aarpresolve(ifp, m, (const struct sockaddr_at *)dst, edst)) {
 #ifdef NETATALKDEBUG
 			printf("aarpresolv failed\n");
 #endif /* NETATALKDEBUG */



CVS commit: [pgoyette-localcount] src/sys/dev/isa

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 23:40:33 UTC 2016

Modified Files:
src/sys/dev/isa [pgoyette-localcount]: fd.c isv.c mcd.c

Log Message:
Redo previous


To generate a diff of this commit:
cvs rdiff -u -r1.110.2.1 -r1.110.2.2 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.7.8.1 -r1.7.8.2 src/sys/dev/isa/isv.c
cvs rdiff -u -r1.116.2.1 -r1.116.2.2 src/sys/dev/isa/mcd.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/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.110.2.1 src/sys/dev/isa/fd.c:1.110.2.2
--- src/sys/dev/isa/fd.c:1.110.2.1	Mon Jul 25 03:30:51 2016
+++ src/sys/dev/isa/fd.c	Mon Jul 25 23:40:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.110.2.1 2016/07/25 03:30:51 pgoyette Exp $	*/
+/*	$NetBSD: fd.c,v 1.110.2.2 2016/07/25 23:40:33 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110.2.1 2016/07/25 03:30:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110.2.2 2016/07/25 23:40:33 pgoyette Exp $");
 
 #include "opt_ddb.h"
 
@@ -695,9 +695,8 @@ fd_dev_to_type(struct fd_softc *fd, dev_
 void
 fdstrategy(struct buf *bp)
 {
-	device_t self;
-	struct fd_softc *fd =
-	device_lookup_private_acquire(_cd, FDUNIT(bp->b_dev), );
+	device_t self = device_lookup_acquire(_cd, FDUNIT(bp->b_dev));
+	struct fd_softc *fd = device_private(self);
 	struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
 	int sz;
 
@@ -925,12 +924,10 @@ fdopen(dev_t dev, int flags, int mode, s
 	struct fd_softc *fd;
 	const struct fd_type *type;
 
-	fd = device_lookup_private_acquire(_cd, FDUNIT(dev), );
-	if (fd == NULL) {
-		if (self != NULL)
-			device_release(self);
-		return (ENXIO);
-	}
+	self = device_lookup_acquire(_cd, FDUNIT(dev));
+	if (self == NULL)
+		return ENXIO;
+	fd = device_private(self);
 
 	type = fd_dev_to_type(fd, dev);
 	if (type == NULL) {
@@ -958,9 +955,8 @@ fdopen(dev_t dev, int flags, int mode, s
 int
 fdclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
-	device_t self;
-	struct fd_softc *fd =
-	device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	device_t self = device_lookup_acquire(_cd, FDUNIT(dev));
+	struct fd_softc *fd = device_private(self);
 
 	fd->sc_flags &= ~FD_OPEN;
 	fd->sc_opts &= ~(FDOPT_NORETRY|FDOPT_SILENT);
@@ -1411,9 +1407,8 @@ fdcretry(struct fdc_softc *fdc)
 int
 fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
 {
-	device_t self;
-	struct fd_softc *fd =
-	device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	device_t self = device_lookup_acquire(_cd, FDUNIT(dev));
+	struct fd_softc *fd = device_private(self);
 	struct fdformat_parms *form_parms;
 	struct fdformat_cmd *form_cmd;
 	struct ne7_fd_formb *fd_formb;
@@ -1642,10 +1637,9 @@ fdioctl(dev_t dev, u_long cmd, void *add
 int
 fdformat(dev_t dev, struct ne7_fd_formb *finfo, struct lwp *l)
 {
-	device_t self;
+	device_t self = device_lookup_acquire(_cd, FDUNIT(dev));
 	int rv = 0;
-	struct fd_softc *fd = 
-	device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	struct fd_softc *fd = device_private(self);
 	struct fd_type *type = fd->sc_type;
 	struct buf *bp;
 

Index: src/sys/dev/isa/isv.c
diff -u src/sys/dev/isa/isv.c:1.7.8.1 src/sys/dev/isa/isv.c:1.7.8.2
--- src/sys/dev/isa/isv.c:1.7.8.1	Mon Jul 25 03:30:51 2016
+++ src/sys/dev/isa/isv.c	Mon Jul 25 23:40:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: isv.c,v 1.7.8.1 2016/07/25 03:30:51 pgoyette Exp $ */
+/*	$NetBSD: isv.c,v 1.7.8.2 2016/07/25 23:40:33 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isv.c,v 1.7.8.1 2016/07/25 03:30:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isv.c,v 1.7.8.2 2016/07/25 23:40:33 pgoyette Exp $");
 
 #include 
 #include 
@@ -259,16 +259,14 @@ isv_attach(device_t parent, device_t sel
 int
 isv_open(dev_t dev, int flag, int devtype, lwp_t *l)
 {
-	device_t self;
+	device_t self = device_lookup_acquire(_cd, minor(dev));
 	vaddr_t va;
-	struct isv_softc *sc =
-	device_lookup_private_acquire(_cd, minor(dev), );
+	struct isv_softc *sc;
 
-	if (sc == NULL) {
-		if (self != NULL)
-			device_release(self);
+	if (self == NULL)
 		return ENXIO;
-	}
+
+	sc = device_private(self);
 	if (sc->sc_frame != NULL) {
 		device_release(self);
 		return 0;
@@ -412,10 +410,9 @@ isv_capture(struct isv_softc *sc)
 int
 isv_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
 {
-	device_t self;
+	device_t self = device_lookup_acquire(_cd, minor(dev));
 	struct isv_cmd ic;
-	struct isv_softc *sc =
-	device_lookup_private_acquire(_cd, minor(dev), );
+	struct isv_softc *sc;
 	int error;
 
 	if (cmd != ISV_CMD) {
@@ -432,6 +429,11 @@ isv_ioctl(dev_t dev, u_long cmd, void *d
 		return EINVAL;
 	}
 
+	if (self == NULL)
+		return ENXIO;
+
+	sc = device_private(self);
+
 	ic.c_frameno = 

CVS commit: src/sys/arch/mips/mips

2016-07-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 25 22:10:03 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
xburst needs CPU_MIPS_D_CACHE_COHERENT


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.272 src/sys/arch/mips/mips/mips_machdep.c:1.273
--- src/sys/arch/mips/mips/mips_machdep.c:1.272	Mon Jul 11 18:56:41 2016
+++ src/sys/arch/mips/mips/mips_machdep.c	Mon Jul 25 22:10:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.272 2016/07/11 18:56:41 skrll Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.273 2016/07/25 22:10:03 macallan Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.272 2016/07/11 18:56:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.273 2016/07/25 22:10:03 macallan Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -660,7 +660,8 @@ static const struct pridtab cputab[] = {
 
 	/* Ingenic XBurst */
 	{ MIPS_PRID_CID_INGENIC, MIPS_XBURST,  -1, -1,	-1, 0,
-	  MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "XBurst"		},
+	  MIPS32_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_DOUBLE_COUNT,
+	  0, 0, "XBurst"		},
 
 	{ 0, 0, 0,0, 0, 0,
 	  0, 0, 0,NULL			}



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 22:06:09 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Update vnd for using localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.3 -r1.256.2.4 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.3 src/sys/dev/vnd.c:1.256.2.4
--- src/sys/dev/vnd.c:1.256.2.3	Tue Jul 19 06:26:58 2016
+++ src/sys/dev/vnd.c	Mon Jul 25 22:06:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.3 2016/07/19 06:26:58 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.4 2016/07/25 22:06:09 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.3 2016/07/19 06:26:58 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.4 2016/07/25 22:06:09 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -324,6 +324,7 @@ vnd_destroy(device_t dev)
 static int
 vndopen(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 	int error = 0, part, pmask;
@@ -333,7 +334,7 @@ vndopen(dev_t dev, int flags, int mode, 
 	if (vnddebug & VDB_FOLLOW)
 		printf("vndopen(0x%"PRIx64", 0x%x, 0x%x, %p)\n", dev, flags, mode, l);
 #endif
-	sc = device_lookup_private(_cd, unit);
+	sc = device_lookup_private_acquire(_cd, unit, );
 	if (sc == NULL) {
 		sc = vnd_spawn(unit);
 		if (sc == NULL)
@@ -410,12 +411,14 @@ vndopen(dev_t dev, int flags, int mode, 
  done:
 	mutex_exit(>sc_dkdev.dk_openlock);
 	vndunlock(sc);
+	device_release(self);
 	return error;
 }
 
 static int
 vndclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 	int error = 0, part;
@@ -424,12 +427,17 @@ vndclose(dev_t dev, int flags, int mode,
 	if (vnddebug & VDB_FOLLOW)
 		printf("vndclose(0x%"PRIx64", 0x%x, 0x%x, %p)\n", dev, flags, mode, l);
 #endif
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
+	sc = device_lookup_private_acquire(_cd, unit, );
+	if (sc == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return ENXIO;
+	}
 
-	if ((error = vndlock(sc)) != 0)
+	if ((error = vndlock(sc)) != 0) {
+		device_release(self);
 		return error;
+	}
 
 	mutex_enter(>sc_dkdev.dk_openlock);
 
@@ -462,10 +470,12 @@ vndclose(dev_t dev, int flags, int mode,
 		if ((error = vnd_destroy(sc->sc_dev)) != 0) {
 			aprint_error_dev(sc->sc_dev,
 			"unable to detach instance\n");
+			device_release(self);
 			return error;
 		}
 	}
 
+	device_release(self);
 	return 0;
 }
 
@@ -475,9 +485,10 @@ vndclose(dev_t dev, int flags, int mode,
 static void
 vndstrategy(struct buf *bp)
 {
+	device_t self;
 	int unit = vndunit(bp->b_dev);
 	struct vnd_softc *vnd =
-	device_lookup_private(_cd, unit);
+	device_lookup_private_acquire(_cd, unit, );
 	struct disklabel *lp;
 	daddr_t blkno;
 	int s = splbio();
@@ -561,12 +572,15 @@ vndstrategy(struct buf *bp)
 	bufq_put(vnd->sc_tab, bp);
 	wakeup(>sc_tab);
 	splx(s);
+	device_release(self);
 	return;
 
 done:
 	bp->b_resid = bp->b_bcount;
 	biodone(bp);
 	splx(s);
+	if (self != NULL)
+		device_release(self);
 }
 
 static bool
@@ -981,6 +995,8 @@ vndiodone(struct buf *bp)
 static int
 vndread(dev_t dev, struct uio *uio, int flags)
 {
+	device_t self;
+	int error;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 
@@ -989,20 +1005,29 @@ vndread(dev_t dev, struct uio *uio, int 
 		printf("vndread(0x%"PRIx64", %p)\n", dev, uio);
 #endif
 
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
+	sc = device_lookup_private_acquire(_cd, unit, );
+	if (sc == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return ENXIO;
+	}
 
-	if ((sc->sc_flags & VNF_INITED) == 0)
+	if ((sc->sc_flags & VNF_INITED) == 0) {
+		device_release(self);
 		return ENXIO;
+	}
 
-	return physio(vndstrategy, NULL, dev, B_READ, minphys, uio);
+	error = physio(vndstrategy, NULL, dev, B_READ, minphys, uio);
+	device_release(self);
+	return error;
 }
 
 /* ARGSUSED */
 static int
 vndwrite(dev_t dev, struct uio *uio, int flags)
 {
+	device_t self;
+	int error;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 
@@ -1011,19 +1036,27 @@ vndwrite(dev_t dev, struct uio *uio, int
 		printf("vndwrite(0x%"PRIx64", %p)\n", dev, uio);
 #endif
 
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
+	sc = device_lookup_private_acquire(_cd, unit, );
+	if (sc == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return ENXIO;
+	}
 
-	if ((sc->sc_flags & VNF_INITED) == 0)
+	if ((sc->sc_flags & VNF_INITED) == 0) {
+		device_release(self);
 		return ENXIO;
+	}
 
-	return physio(vndstrategy, NULL, dev, B_WRITE, minphys, uio);
+	error = physio(vndstrategy, NULL, dev, B_WRITE, minphys, uio);
+	device_release(self);
+	

CVS commit: src/lib/libc/sys

2016-07-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jul 25 22:00:36 UTC 2016

Modified Files:
src/lib/libc/sys: sigaction.2

Log Message:
Remove one of the two SEE ALSO sections.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/sys/sigaction.2

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

Modified files:

Index: src/lib/libc/sys/sigaction.2
diff -u src/lib/libc/sys/sigaction.2:1.48 src/lib/libc/sys/sigaction.2:1.49
--- src/lib/libc/sys/sigaction.2:1.48	Sat Jul  9 23:08:32 2016
+++ src/lib/libc/sys/sigaction.2	Mon Jul 25 22:00:36 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sigaction.2,v 1.48 2016/07/09 23:08:32 dholland Exp $
+.\"	$NetBSD: sigaction.2,v 1.49 2016/07/25 22:00:36 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -434,25 +434,6 @@ below is unsafe to use in signal handler
 .Xr wait 2 ,
 .Xr waitpid 2 ,
 .Xr write 2 .
-.Sh SEE ALSO
-.Xr kill 1 ,
-.Xr kill 2 ,
-.Xr ptrace 2 ,
-.Xr sigaction 2 ,
-.Xr sigaltstack 2 ,
-.Xr sigprocmask 2 ,
-.Xr sigstack 2 ,
-.Xr sigsuspend 2 ,
-.Xr fpgetmask 3 ,
-.Xr fpsetmask 3 ,
-.Xr setjmp 3 ,
-.Xr sigblock 3 ,
-.Xr siginterrupt 3 ,
-.Xr signal 3 ,
-.Xr sigpause 3 ,
-.Xr sigsetmask 3 ,
-.Xr sigsetops 3 ,
-.Xr tty 4
 .Sh NOTES
 The mask specified in
 .Fa act
@@ -502,13 +483,19 @@ and
 .Xr kill 2 ,
 .Xr ptrace 2 ,
 .Xr sigaltstack 2 ,
-.Xr siginfo 2 ,
 .Xr sigprocmask 2 ,
+.Xr sigstack 2 ,
 .Xr sigsuspend 2 ,
+.Xr fpgetmask 3 ,
+.Xr fpsetmask 3 ,
 .Xr setjmp 3 ,
+.Xr sigblock 3 ,
+.Xr siginterrupt 3 ,
+.Xr signal 3 ,
+.Xr sigpause 3 ,
+.Xr sigsetmask 3 ,
 .Xr sigsetops 3 ,
-.Xr tty 4 ,
-.Xr signal 7
+.Xr tty 4
 .Sh STANDARDS
 The
 .Fn sigaction



CVS commit: src/sys/arch

2016-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jul 25 16:03:38 UTC 2016

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S

Log Message:
Remove lapic_id, lapic_ppr and lapic_isr. We need to be careful though: the
offset of lapic_tpr must not change, and the whole area must be exactly one
page.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/i386/i386/locore.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.107 src/sys/arch/amd64/amd64/locore.S:1.108
--- src/sys/arch/amd64/amd64/locore.S:1.107	Mon Jul 11 14:52:54 2016
+++ src/sys/arch/amd64/amd64/locore.S	Mon Jul 25 16:03:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.107 2016/07/11 14:52:54 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.108 2016/07/25 16:03:38 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -316,30 +316,16 @@
 #if NLAPIC > 0
 	.align	PAGE_SIZE
 	.globl	_C_LABEL(local_apic)
-	.globl	_C_LABEL(lapic_id)
 	.globl	_C_LABEL(lapic_tpr)
 
 	.type	_C_LABEL(local_apic), @object
 LABEL(local_apic)
-	.space	LAPIC_ID
+	.space	LAPIC_TPRI
 END(local_apic)
-	.type	_C_LABEL(lapic_id), @object
-LABEL(lapic_id)
-	.long	0x
-	.space	LAPIC_TPRI-(LAPIC_ID+4)
-END(lapic_id)
 	.type	_C_LABEL(lapic_tpr), @object
 LABEL(lapic_tpr)
-	.space	LAPIC_PPRI-LAPIC_TPRI
+	.space	PAGE_SIZE-LAPIC_TPRI
 END(lapic_tpr)
-	.type	_C_LABEL(lapic_ppr), @object
-_C_LABEL(lapic_ppr):
-	.space	LAPIC_ISR-LAPIC_PPRI
-END(lapic_ppr)
-	.type	_C_LABEL(lapic_isr), @object
-_C_LABEL(lapic_isr):
-	.space	PAGE_SIZE-LAPIC_ISR
-END(lapic_isr)
 #endif /* NLAPIC > 0 */
 
 	.globl	_C_LABEL(tablesize)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.136 src/sys/arch/i386/i386/locore.S:1.137
--- src/sys/arch/i386/i386/locore.S:1.136	Mon Jul 25 15:18:41 2016
+++ src/sys/arch/i386/i386/locore.S	Mon Jul 25 16:03:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.136 2016/07/25 15:18:41 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.137 2016/07/25 16:03:38 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.136 2016/07/25 15:18:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.137 2016/07/25 16:03:38 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -275,29 +275,15 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 #if NLAPIC > 0
 	.align	PAGE_SIZE
 	.globl	_C_LABEL(local_apic)
-	.globl	_C_LABEL(lapic_id)
 
 	.type	_C_LABEL(local_apic), @object
 LABEL(local_apic)
-	.space	LAPIC_ID
+	.space	LAPIC_TPRI
 END(local_apic)
-	.type	_C_LABEL(lapic_id), @object
-LABEL(lapic_id)
-	.long	0x
-	.space	LAPIC_TPRI-(LAPIC_ID+4)
-END(lapic_id)
 	.type	_C_LABEL(lapic_tpr), @object
 LABEL(lapic_tpr)
-	.space	LAPIC_PPRI-LAPIC_TPRI
+	.space	PAGE_SIZE-LAPIC_TPRI
 END(lapic_tpr)
-	.type	_C_LABEL(lapic_ppr), @object
-_C_LABEL(lapic_ppr):
-	.space	LAPIC_ISR-LAPIC_PPRI
-END(lapic_ppr)
-	.type	_C_LABEL(lapic_isr), @object
-_C_LABEL(lapic_isr):
-	.space	PAGE_SIZE-LAPIC_ISR
-END(lapic_isr)
 #else
 	.type	_C_LABEL(lapic_tpr), @object
 LABEL(lapic_tpr)



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

2016-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jul 25 15:29:06 UTC 2016

Modified Files:
src/sys/arch/amd64/amd64: mptramp.S

Log Message:
Unused.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amd64/amd64/mptramp.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/mptramp.S
diff -u src/sys/arch/amd64/amd64/mptramp.S:1.22 src/sys/arch/amd64/amd64/mptramp.S:1.23
--- src/sys/arch/amd64/amd64/mptramp.S:1.22	Thu May 12 09:40:23 2016
+++ src/sys/arch/amd64/amd64/mptramp.S	Mon Jul 25 15:29:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mptramp.S,v 1.22 2016/05/12 09:40:23 maxv Exp $	*/
+/*	$NetBSD: mptramp.S,v 1.23 2016/07/25 15:29:06 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000, 2016 The NetBSD Foundation, Inc.
@@ -116,7 +116,6 @@
 	.global _C_LABEL(cpu_spinup_trampoline_end)
 	.global _C_LABEL(cpu_hatch)
 	.global _C_LABEL(mp_pdirpa)
-	.global _C_LABEL(local_apic)
 
 	.text
 	.align 4,0x0



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

2016-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jul 25 15:18:41 UTC 2016

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
This needs to be page-aligned anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/i386/i386/locore.S

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

Modified files:

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.135 src/sys/arch/i386/i386/locore.S:1.136
--- src/sys/arch/i386/i386/locore.S:1.135	Sat Jul  9 06:58:06 2016
+++ src/sys/arch/i386/i386/locore.S	Mon Jul 25 15:18:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.135 2016/07/09 06:58:06 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.136 2016/07/25 15:18:41 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.135 2016/07/09 06:58:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.136 2016/07/25 15:18:41 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -273,11 +273,7 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 	.globl	_C_LABEL(lapic_tpr)
 
 #if NLAPIC > 0
-#ifdef __ELF__
 	.align	PAGE_SIZE
-#else
-	.align	12
-#endif
 	.globl	_C_LABEL(local_apic)
 	.globl	_C_LABEL(lapic_id)
 



CVS commit: src/sys

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 12:45:13 UTC 2016

Modified Files:
src/sys/dev: cgd.c
src/sys/rump/dev/lib/libcgd: cgd_component.c

Log Message:
When initializing the rump cgd component, use the correct driver name
(as found in the devsw_conv[] table).  This will get us the "official"
major numbers for the cgd device.

After creating the rump file-space nodes for /dev/cgd* we then need to
detach the [bc]devsw's because normal module initialization will do its
own attachment, and we don't want that to fail.

While here, since we're doing the devsw_attach() twice, share the
results from the first call rather than starting from scratch.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/cgd.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libcgd/cgd_component.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/cgd.c
diff -u src/sys/dev/cgd.c:1.108 src/sys/dev/cgd.c:1.109
--- src/sys/dev/cgd.c:1.108	Sun Jul 10 17:40:23 2016
+++ src/sys/dev/cgd.c	Mon Jul 25 12:45:13 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108 2016/07/10 17:40:23 riastradh Exp $ */
+/* $NetBSD: cgd.c,v 1.109 2016/07/25 12:45:13 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108 2016/07/10 17:40:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.109 2016/07/25 12:45:13 pgoyette Exp $");
 
 #include 
 #include 
@@ -1028,6 +1028,8 @@ MODULE(MODULE_CLASS_DRIVER, cgd, "dk_sub
 
 #ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);
+
+devmajor_t cgd_bmajor = -1, cgd_cmajor = -1;
 #endif
 
 static int
@@ -1035,10 +1037,6 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 {
 	int error = 0;
 
-#ifdef _MODULE
-	devmajor_t bmajor = -1, cmajor = -1;
-#endif
-
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
@@ -1049,16 +1047,24 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 		error = config_cfattach_attach(cgd_cd.cd_name, _ca);
 	if (error) {
 			config_cfdriver_detach(_cd);
-			aprint_error("%s: unable to register cfattach\n",
-			cgd_cd.cd_name);
+			aprint_error("%s: unable to register cfattach for"
+			"%s, error %d\n", __func__, cgd_cd.cd_name, error);
 			break;
 		}
+		/*
+		 * Attach the {b,c}devsw's
+		 */
+		error = devsw_attach("cgd", _bdevsw, _bmajor,
+		_cdevsw, _cmajor);
 
-		error = devsw_attach("cgd", _bdevsw, ,
-		_cdevsw, );
+		/*
+		 * If devsw_attach fails, remove from autoconf database
+		 */
 		if (error) {
 			config_cfattach_detach(cgd_cd.cd_name, _ca);
 			config_cfdriver_detach(_cd);
+			aprint_error("%s: unable to attach %s devsw, "
+			"error %d", __func__, cgd_cd.cd_name, error);
 			break;
 		}
 #endif
@@ -1066,19 +1072,40 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 
 	case MODULE_CMD_FINI:
 #ifdef _MODULE
+		/*
+		 * Remove {b,c}devsw's
+		 */
+		devsw_detach(_bdevsw, _cdevsw);
+
+		/*
+		 * Now remove device from autoconf database
+		 */
 		error = config_cfattach_detach(cgd_cd.cd_name, _ca);
-		if (error)
+		if (error) {
+			error = devsw_attach("cgd", _bdevsw, _bmajor,
+			_cdevsw, _cmajor);
+			aprint_error("%s: failed to detach %s cfattach, "
+			"error %d\n", __func__, cgd_cd.cd_name, error);
+ 			break;
+		}
+		error = config_cfdriver_detach(_cd);
+		if (error) {
+			config_cfattach_attach(cgd_cd.cd_name, _ca);
+			devsw_attach("cgd", _bdevsw, _bmajor,
+			_cdevsw, _cmajor);
+			aprint_error("%s: failed to detach %s cfdriver, "
+			"error %d\n", __func__, cgd_cd.cd_name, error);
 			break;
-		config_cfdriver_detach(_cd);
-		devsw_detach(_bdevsw, _cdevsw);
+		}
 #endif
 		break;
 
 	case MODULE_CMD_STAT:
-		return ENOTTY;
-
+		error = ENOTTY;
+		break;
 	default:
-		return ENOTTY;
+		error = ENOTTY;
+		break;
 	}
 
 	return error;

Index: src/sys/rump/dev/lib/libcgd/cgd_component.c
diff -u src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2 src/sys/rump/dev/lib/libcgd/cgd_component.c:1.3
--- src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2	Tue Jan 26 23:12:15 2016
+++ src/sys/rump/dev/lib/libcgd/cgd_component.c	Mon Jul 25 12:45:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgd_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $	*/
+/*	$NetBSD: cgd_component.c,v 1.3 2016/07/25 12:45:13 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.3 2016/07/25 12:45:13 pgoyette Exp $");
 
 #include 
 #include 
@@ -40,20 +40,21 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
 	extern const struct bdevsw cgd_bdevsw;
 	extern const struct cdevsw cgd_cdevsw;
-	devmajor_t bmaj, cmaj;
+	extern devmajor_t cgd_bmajor, cgd_cmajor;
 	int error;
 
 	/* go, mydevfs */
-	bmaj = cmaj = -1;
 
-	if ((error = devsw_attach("/dev/cgd0", _bdevsw, ,
-	

CVS commit: src/sys/arch/x86

2016-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jul 25 12:11:40 UTC 2016

Modified Files:
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: lapic.c pmap.c

Log Message:
The L1 entry of the first page of the data segment is overwritten for the
LAPIC page, and set as RWX+PG_N. The LAPIC pa is fixed, and its va resides
in the data segment. Because of this error-prone design, the kernel image
map is not linear, and I first thought it was a bug (as I vaguely said in
PR/51148). Using large pages for the data segment is therefore wrong, since
the first page does not actually belong to the data segment (even if its va
is in the range). This bug is not triggered currently, since local_apic is
not large-page-aligned.

We will certainly have to allocate a va dynamically instead of using the
first page of data; but for now, disable large pages on the data segment,
and map the LAPIC as RW.

This is the last x86-specific RWX page.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/x86/lapic.c
cvs rdiff -u -r1.216 -r1.217 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.58 src/sys/arch/x86/include/pmap.h:1.59
--- src/sys/arch/x86/include/pmap.h:1.58	Fri Jul  1 11:10:48 2016
+++ src/sys/arch/x86/include/pmap.h	Mon Jul 25 12:11:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.58 2016/07/01 11:10:48 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.59 2016/07/25 12:11:40 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -209,6 +209,7 @@ struct pmap {
 extern u_long PDPpaddr;
 
 extern pd_entry_t pmap_pg_g;			/* do we support PG_G? */
+extern pd_entry_t pmap_pg_nx;			/* do we support PG_NX? */
 extern long nkptp[PTP_LEVELS];
 
 /*

Index: src/sys/arch/x86/x86/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.51 src/sys/arch/x86/x86/lapic.c:1.52
--- src/sys/arch/x86/x86/lapic.c:1.51	Mon Jul 27 15:45:20 2015
+++ src/sys/arch/x86/x86/lapic.c	Mon Jul 25 12:11:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.51 2015/07/27 15:45:20 msaitoh Exp $	*/
+/*	$NetBSD: lapic.c,v 1.52 2016/07/25 12:11:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.51 2015/07/27 15:45:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.52 2016/07/25 12:11:40 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -125,7 +125,7 @@ lapic_map(paddr_t lapic_base)
 	 */
 
 	pte = kvtopte(va);
-	*pte = lapic_base | PG_RW | PG_V | PG_N | pmap_pg_g;
+	*pte = lapic_base | PG_RW | PG_V | PG_N | pmap_pg_g | pmap_pg_nx;
 	invlpg(va);
 
 #ifdef MULTIPROCESSOR

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.216 src/sys/arch/x86/x86/pmap.c:1.217
--- src/sys/arch/x86/x86/pmap.c:1.216	Fri Jul 22 14:08:33 2016
+++ src/sys/arch/x86/x86/pmap.c	Mon Jul 25 12:11:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.216 2016/07/22 14:08:33 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.217 2016/07/25 12:11:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.216 2016/07/22 14:08:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.217 2016/07/25 12:11:40 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1573,7 +1573,9 @@ pmap_remap_largepages(void)
 {
 	extern char __rodata_start;
 	extern char __data_start;
+#if 0
 	extern char __kernel_end;
+#endif
 	pd_entry_t *pde;
 	vaddr_t kva, kva_end;
 	paddr_t pa;
@@ -1604,6 +1606,7 @@ pmap_remap_largepages(void)
 		tlbflushg();
 	}
 
+#if 0
 	/* Remap the kernel data+bss using large pages. */
 	kva = roundup((vaddr_t)&__data_start, NBPD_L2);
 	kva_end = rounddown((vaddr_t)&__kernel_end, NBPD_L1);
@@ -1613,6 +1616,7 @@ pmap_remap_largepages(void)
 		*pde = pa | pmap_pg_g | PG_PS | pmap_pg_nx | PG_KW | PG_V;
 		tlbflushg();
 	}
+#endif
 }
 #endif /* !XEN */
 



CVS commit: src/sys/compat/common

2016-07-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jul 25 08:30:19 UTC 2016

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
Apply if_get/if_put to compat_ifioctl


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/if_43.c

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

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.11 src/sys/compat/common/if_43.c:1.12
--- src/sys/compat/common/if_43.c:1.11	Sat Jul 11 07:43:32 2015
+++ src/sys/compat/common/if_43.c	Mon Jul 25 08:30:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $	*/
+/*	$NetBSD: if_43.c,v 1.12 2016/07/25 08:30:19 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.12 2016/07/25 08:30:19 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -218,11 +218,16 @@ compat_ifioctl(struct socket *so, u_long
 	struct ifreq *ifr = (struct ifreq *)data;
 	struct ifreq ifrb;
 	struct oifreq *oifr = NULL;
-	struct ifnet *ifp = ifunit(ifr->ifr_name);
+	struct ifnet *ifp;
 	struct sockaddr *sa;
+	struct psref psref;
+	int bound = curlwp_bind();
 
-	if (ifp == NULL)
+	ifp = if_get(ifr->ifr_name, );
+	if (ifp == NULL) {
+		curlwp_bindx(bound);
 		return ENXIO;
+	}
 
 	/*
 	 * If we have not been converted, make sure that we are.
@@ -257,6 +262,8 @@ compat_ifioctl(struct socket *so, u_long
 	}
 
 	error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so, cmd, ifr, ifp);
+	if_put(ifp, );
+	curlwp_bindx(bound);
 
 	switch (ocmd) {
 	case OOSIOCGIFADDR: