CVS commit: src/games/monop

2014-12-29 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Dec 29 10:27:03 UTC 2014

Modified Files:
src/games/monop: cards.c

Log Message:
PR/49513 - Henning Petersen -- tyop


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/games/monop/cards.c

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

Modified files:

Index: src/games/monop/cards.c
diff -u src/games/monop/cards.c:1.25 src/games/monop/cards.c:1.26
--- src/games/monop/cards.c:1.25	Tue Jun 19 05:35:32 2012
+++ src/games/monop/cards.c	Mon Dec 29 10:27:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.25 2012/06/19 05:35:32 dholland Exp $	*/
+/*	$NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)cards.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: cards.c,v 1.25 2012/06/19 05:35:32 dholland Exp $);
+__RCSID($NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $);
 #endif
 #endif /* not lint */
 
@@ -132,7 +132,7 @@ static const struct cardinfo ch_cards[] 
 	{ MU,
 		Advance to the nearest Utility.\n
 		If unowned, you may buy it from the bank.\n
-		If owned, throw dice and pay oner a total of ten times\n
+		If owned, throw dice and pay onwer a total of ten times\n
 		the amount thrown.\n
 	},
 	{ MB3,



CVS commit: src/games/monop

2014-12-29 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Dec 29 10:38:52 UTC 2014

Modified Files:
src/games/monop: cards.c

Log Message:
PR/49513 - Henning Petersen -- tyop


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/games/monop/cards.c

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

Modified files:

Index: src/games/monop/cards.c
diff -u src/games/monop/cards.c:1.26 src/games/monop/cards.c:1.27
--- src/games/monop/cards.c:1.26	Mon Dec 29 10:27:03 2014
+++ src/games/monop/cards.c	Mon Dec 29 10:38:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $	*/
+/*	$NetBSD: cards.c,v 1.27 2014/12/29 10:38:52 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)cards.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: cards.c,v 1.26 2014/12/29 10:27:03 jnemeth Exp $);
+__RCSID($NetBSD: cards.c,v 1.27 2014/12/29 10:38:52 jnemeth Exp $);
 #endif
 #endif /* not lint */
 
@@ -132,7 +132,7 @@ static const struct cardinfo ch_cards[] 
 	{ MU,
 		Advance to the nearest Utility.\n
 		If unowned, you may buy it from the bank.\n
-		If owned, throw dice and pay onwer a total of ten times\n
+		If owned, throw dice and pay owner a total of ten times\n
 		the amount thrown.\n
 	},
 	{ MB3,



CVS commit: src/sys/dev

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 12:03:40 UTC 2014

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

Log Message:
align dk_strategy with checks from ld.c


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/dksubr.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/dksubr.c
diff -u src/sys/dev/dksubr.c:1.54 src/sys/dev/dksubr.c:1.55
--- src/sys/dev/dksubr.c:1.54	Tue Nov  4 07:51:54 2014
+++ src/sys/dev/dksubr.c	Mon Dec 29 12:03:39 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.54 2014/11/04 07:51:54 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.55 2014/12/29 12:03:39 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dksubr.c,v 1.54 2014/11/04 07:51:54 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: dksubr.c,v 1.55 2014/12/29 12:03:39 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -178,9 +178,13 @@ dk_close(struct dk_intf *di, struct dk_s
 void
 dk_strategy(struct dk_intf *di, struct dk_softc *dksc, struct buf *bp)
 {
-	int	s;
+	int	s, part;
 	int	wlabel;
 	daddr_t	blkno;
+	struct disklabel *lp;
+	struct disk *dk;
+	uint64_t numsecs;
+	unsigned secsize;
 
 	DPRINTF_FOLLOW((dk_strategy(%s, %p, %p)\n,
 	di-di_dkname, dksc, bp));
@@ -192,10 +196,25 @@ dk_strategy(struct dk_intf *di, struct d
 		return;
 	}
 
-	/* XXX look for some more errors, c.f. ld.c */
+	lp = dksc-sc_dkdev.dk_label;
+	dk = dksc-sc_dkdev;
+
+	part = DISKPART(bp-b_dev);
+	numsecs = dk-dk_geom.dg_secperunit;
+	secsize = dk-dk_geom.dg_secsize;
 
 	bp-b_resid = bp-b_bcount;
 
+	/*
+	 * The transfer must be a whole number of blocks and the offset must
+	 * not be negative.
+	 */ 
+	if ((bp-b_bcount % secsize) != 0 || bp-b_blkno  0) {
+		bp-b_error = EINVAL;
+		biodone(bp);
+		return;
+	}   
+
 	/* If there is nothing to do, then we are done */
 	if (bp-b_bcount == 0) {
 		biodone(bp);
@@ -203,20 +222,21 @@ dk_strategy(struct dk_intf *di, struct d
 	}
 
 	wlabel = dksc-sc_flags  (DKF_WLABEL|DKF_LABELLING);
-	if (DISKPART(bp-b_dev) != RAW_PART 
-	bounds_check_with_label(dksc-sc_dkdev, bp, wlabel) = 0) {
-		biodone(bp);
-		return;
+	if (part == RAW_PART) {
+		if (bounds_check_with_mediasize(bp, DEV_BSIZE, numsecs) = 0) {
+			biodone(bp);
+			return;
+		}
+	} else {
+		if (bounds_check_with_label(dksc-sc_dkdev, bp, wlabel) = 0) {
+			biodone(bp);
+			return;
+		}
 	}
 
 	blkno = bp-b_blkno;
-	if (DISKPART(bp-b_dev) != RAW_PART) {
-		struct partition *pp;
-
-		pp =
-		dksc-sc_dkdev.dk_label-d_partitions[DISKPART(bp-b_dev)];
-		blkno += pp-p_offset;
-	}
+	if (part != RAW_PART)
+		blkno += lp-d_partitions[DISKPART(bp-b_dev)].p_offset;
 	bp-b_rawblkno = blkno;
 
 	/*



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

2014-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 29 12:53:39 UTC 2014

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

Log Message:
something wrong with MP, turn it off for now


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/ROCKCHIP

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

Modified files:

Index: src/sys/arch/evbarm/conf/ROCKCHIP
diff -u src/sys/arch/evbarm/conf/ROCKCHIP:1.4 src/sys/arch/evbarm/conf/ROCKCHIP:1.5
--- src/sys/arch/evbarm/conf/ROCKCHIP:1.4	Sun Dec 28 16:04:05 2014
+++ src/sys/arch/evbarm/conf/ROCKCHIP	Mon Dec 29 12:53:39 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: ROCKCHIP,v 1.4 2014/12/28 16:04:05 jmcneill Exp $
+#	$NetBSD: ROCKCHIP,v 1.5 2014/12/29 12:53:39 jmcneill Exp $
 #
 #	Rockchip RK3066/RK3188 based SBC (Single Board Computer)
 #
@@ -156,7 +156,7 @@ mainbus0	at root
 
 # The boot cpu
 cpu*		at mainbus?
-options 	MULTIPROCESSOR
+#options 	MULTIPROCESSOR
 
 # A9 core devices
 armperiph0	at mainbus?



CVS commit: src/sys/dev

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 13:13:20 UTC 2014

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

Log Message:
Fix default label for non-standard sector size.
Avoid integer overflow in sanity check.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 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.234 src/sys/dev/vnd.c:1.235
--- src/sys/dev/vnd.c:1.234	Tue Nov  4 07:51:54 2014
+++ src/sys/dev/vnd.c	Mon Dec 29 13:13:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.234 2014/11/04 07:51:54 mlelstv Exp $	*/
+/*	$NetBSD: vnd.c,v 1.235 2014/12/29 13:13:20 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.234 2014/11/04 07:51:54 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.235 2014/12/29 13:13:20 mlelstv Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_vnd.h
@@ -1284,9 +1284,9 @@ vndioctl(dev_t dev, u_long cmd, void *da
 			 * Compute the size (in DEV_BSIZE blocks) specified
 			 * by the geometry.
 			 */
-			geomsize = (vnd-sc_geom.vng_nsectors *
+			geomsize = (int64_t)vnd-sc_geom.vng_nsectors *
 			vnd-sc_geom.vng_ntracks *
-			vnd-sc_geom.vng_ncylinders) *
+			vnd-sc_geom.vng_ncylinders *
 			(vnd-sc_geom.vng_secsize / DEV_BSIZE);
 
 			/*
@@ -1793,13 +1793,15 @@ vndgetdefaultlabel(struct vnd_softc *sc,
 {
 	struct vndgeom *vng = sc-sc_geom;
 	struct partition *pp;
+	unsigned spb;
 
 	memset(lp, 0, sizeof(*lp));
 
-	if (sc-sc_size  UINT32_MAX)
+	spb = vng-vng_secsize / DEV_BSIZE;
+	if (sc-sc_size / spb  UINT32_MAX)
 		lp-d_secperunit = UINT32_MAX;
 	else
-		lp-d_secperunit = sc-sc_size;
+		lp-d_secperunit = sc-sc_size / spb;
 	lp-d_secsize = vng-vng_secsize;
 	lp-d_nsectors = vng-vng_nsectors;
 	lp-d_ntracks = vng-vng_ntracks;



CVS commit: src/sys/net

2014-12-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 29 13:38:13 UTC 2014

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

Log Message:
Remove unnecessary variable bc


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/net/bpf.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/bpf.c
diff -u src/sys/net/bpf.c:1.189 src/sys/net/bpf.c:1.190
--- src/sys/net/bpf.c:1.189	Sat Sep 13 17:18:45 2014
+++ src/sys/net/bpf.c	Mon Dec 29 13:38:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.189 2014/09/13 17:18:45 rmind Exp $	*/
+/*	$NetBSD: bpf.c,v 1.190 2014/12/29 13:38:13 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.189 2014/09/13 17:18:45 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.190 2014/12/29 13:38:13 ozaki-r Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_bpf.h
@@ -1388,7 +1388,6 @@ static inline void
 bpf_deliver(struct bpf_if *bp, void *(*cpfn)(void *, const void *, size_t),
 void *pkt, u_int pktlen, u_int buflen, const bool rcv)
 {
-	const bpf_ctx_t *bc = NULL;
 	uint32_t mem[BPF_MEMWORDS];
 	bpf_args_t args = {
 		.pkt = (const uint8_t *)pkt,
@@ -1415,9 +1414,9 @@ bpf_deliver(struct bpf_if *bp, void *(*c
 		bpf_gstats.bs_recv++;
 
 		if (d-bd_jitcode)
-			slen = d-bd_jitcode(bc, args);
+			slen = d-bd_jitcode(NULL, args);
 		else
-			slen = bpf_filter_ext(bc, d-bd_filter, args);
+			slen = bpf_filter_ext(NULL, d-bd_filter, args);
 
 		if (!slen) {
 			continue;



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

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 14:00:26 UTC 2014

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

Log Message:
Avoid NULL pointer dereference if SMBIOS key system-product does not
exist.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/x86/ipmi.c

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

Modified files:

Index: src/sys/arch/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.59 src/sys/arch/x86/x86/ipmi.c:1.60
--- src/sys/arch/x86/x86/ipmi.c:1.59	Mon Sep 22 13:30:55 2014
+++ src/sys/arch/x86/x86/ipmi.c	Mon Dec 29 14:00:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmi.c,v 1.59 2014/09/22 13:30:55 nat Exp $ */
+/*	$NetBSD: ipmi.c,v 1.60 2014/12/29 14:00:26 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipmi.c,v 1.59 2014/09/22 13:30:55 nat Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipmi.c,v 1.60 2014/12/29 14:00:26 mlelstv Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -891,6 +891,7 @@ dumpb(const char *lbl, int len, const ui
 void
 ipmi_smbios_probe(struct smbios_ipmi *pipmi, struct ipmi_attach_args *ia)
 {
+	const char *platform;
 
 	dbg_printf(1, ipmi_smbios_probe: %02x %02x %02x %02x 
 	%08 PRIx64  %02x %02x\n,
@@ -938,8 +939,9 @@ ipmi_smbios_probe(struct smbios_ipmi *pi
 	if (pipmi-smipmi_base_flags  SMIPMI_FLAG_ODDOFFSET)
 		ia-iaa_if_iobase++;
 
-	if (strcmp(pmf_get_platform(system-product),
-ProLiant MicroServer) == 0) {
+	platform = pmf_get_platform(system-product);
+	if (platform != NULL 
+	strcmp(platform, ProLiant MicroServer) == 0) {
 ia-iaa_if_iospacing = 1;
 ia-iaa_if_iobase = pipmi-smipmi_base_address - 7;
 ia-iaa_if_iotype = 'i';



CVS commit: src/share/man/man5

2014-12-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Dec 29 14:22:25 UTC 2014

Modified Files:
src/share/man/man5: ifconfig.if.5

Log Message:
Add comma in Dd. From Henning Petersen in PR 49515.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man5/ifconfig.if.5

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

Modified files:

Index: src/share/man/man5/ifconfig.if.5
diff -u src/share/man/man5/ifconfig.if.5:1.17 src/share/man/man5/ifconfig.if.5:1.18
--- src/share/man/man5/ifconfig.if.5:1.17	Thu Dec 18 17:10:42 2014
+++ src/share/man/man5/ifconfig.if.5	Mon Dec 29 14:22:25 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.if.5,v 1.17 2014/12/18 17:10:42 roy Exp $
+.\	$NetBSD: ifconfig.if.5,v 1.18 2014/12/29 14:22:25 wiz Exp $
 .\
 .\ Copyright (c) 1996 Matthew R. Green
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd December 18 2014
+.Dd December 18, 2014
 .Dt IFCONFIG.IF 5
 .Os
 .Sh NAME



CVS commit: src/usr.sbin/sysinst

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 14:43:06 UTC 2014

Modified Files:
src/usr.sbin/sysinst: run.c

Log Message:
If we launch a program with RUN_SILENT, give it more than two seconds to
run before we create an output window. On a swapping VAX it can take
seriously longer, and we get interactive status display even if the program
did not produce any error output otherwise.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/run.c

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

Modified files:

Index: src/usr.sbin/sysinst/run.c
diff -u src/usr.sbin/sysinst/run.c:1.3 src/usr.sbin/sysinst/run.c:1.4
--- src/usr.sbin/sysinst/run.c:1.3	Tue Oct 14 16:35:20 2014
+++ src/usr.sbin/sysinst/run.c	Mon Dec 29 14:43:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: run.c,v 1.3 2014/10/14 16:35:20 christos Exp $	*/
+/*	$NetBSD: run.c,v 1.4 2014/12/29 14:43:06 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -497,7 +497,7 @@ launch_subwin(WINDOW **actionwin, char *
 			errx(1, mmsg);
 		}
 		read_fd_set = active_fd_set;
-		tmo.tv_sec = 2;
+		tmo.tv_sec = flags  RUN_SILENT ? 20 : 2;
 		tmo.tv_usec = 0;
 		i = select(FD_SETSIZE, read_fd_set, NULL, NULL, tmo);
 		if (i == 0  *actionwin == NULL)



CVS commit: [netbsd-6] src/sys/arch/x86/include

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 15:14:27 UTC 2014

Modified Files:
src/sys/arch/x86/include [netbsd-6]: cacheinfo.h

Log Message:
Pullup the following revisions, requested by msaitoh in #1219:

sys/arch/x86/include/cacheinfo.h1.14-1.19

Update Intel's cache and TLB descripotr table. This changes the number
of page coloring on some CPUs.
- Add Shared L2 TLB.
- Support prefetch size.
- Add some new TLB and cache entries from the document.
- Fix some entries:
  - Fix 0x0d's DCACHE entry and 0xeb's L3CACHE entry.
  - Desc 0x55 and 0xb1 are Instruction TLB but not fixed to 4K.
  - Desc 0x5a and 0xc0 are Data TLB but not fixed to 4K.
  - Desc 0x57 and 0x59 are 4K fixed DTLB.
  - Fix string of desc 0xc2 and it's not fixed to 4K.
  - Desc 0xca is 4K fixed L2 shared TLB.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/x86/include/cacheinfo.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/x86/include/cacheinfo.h
diff -u src/sys/arch/x86/include/cacheinfo.h:1.13 src/sys/arch/x86/include/cacheinfo.h:1.13.2.1
--- src/sys/arch/x86/include/cacheinfo.h:1.13	Sun Dec  4 17:00:10 2011
+++ src/sys/arch/x86/include/cacheinfo.h	Mon Dec 29 15:14:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheinfo.h,v 1.13 2011/12/04 17:00:10 chs Exp $	*/
+/*	$NetBSD: cacheinfo.h,v 1.13.2.1 2014/12/29 15:14:26 martin Exp $	*/
 
 #ifndef _X86_CACHEINFO_H_
 #define _X86_CACHEINFO_H_
@@ -8,7 +8,10 @@ struct x86_cache_info {
 	uint8_t		cai_desc;
 	uint8_t		cai_associativity;
 	u_int		cai_totalsize; /* #entries for TLB, bytes for cache */
-	u_int		cai_linesize;	/* or page size for TLB */
+	u_int		cai_linesize;	/*
+	 * or page size for TLB,
+	 * or prefetch size
+	 */
 #ifndef _KERNEL
 	const char	*cai_string;
 #endif
@@ -30,8 +33,11 @@ struct x86_cache_info {
 #define CAI_L2_ITLB2	13		/* L2 Instruction TLB (2/4M pages) */
 #define CAI_L2_DTLB	14		/* L2 Data TLB (4K pages) */
 #define CAI_L2_DTLB2	15		/* L2 Data TLB (2/4M pages) */
+#define CAI_L2_STLB	16		/* Shared L2 TLB (4K pages) */
+#define CAI_L2_STLB2	17		/* Shared L2 TLB (4K/2M pages) */
+#define CAI_PREFETCH	18		/* Prefetch */
 
-#define	CAI_COUNT	16
+#define	CAI_COUNT	19
 
 /*
  * AMD Cache Info:
@@ -209,33 +215,55 @@ struct x86_cache_info {
  */
 #define INTEL_CACHE_INFO { \
 __CI_TBL(CAI_ITLB, 0x01,4, 32,4 * 1024, NULL), \
-__CI_TBL(CAI_ITLB, 0xb0,4,128,4 * 1024, NULL), \
 __CI_TBL(CAI_ITLB2,0x02, 0xff,  2, 4 * 1024 * 1024, NULL), \
 __CI_TBL(CAI_DTLB, 0x03,4, 64,4 * 1024, NULL), \
-__CI_TBL(CAI_DTLB, 0xb3,4,128,4 * 1024, NULL), \
-__CI_TBL(CAI_DTLB, 0xb4,4,256,4 * 1024, NULL), \
 __CI_TBL(CAI_DTLB2,0x04,4,  8, 4 * 1024 * 1024, NULL), \
 __CI_TBL(CAI_DTLB2,0x05,4, 32, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,0x0b,4,  4, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_ITLB, 0x4f, 0xff, 32,4 * 1024, NULL), \
 __CI_TBL(CAI_ITLB, 0x50, 0xff, 64,4 * 1024, 4K/4M: 64 entries), \
 __CI_TBL(CAI_ITLB, 0x51, 0xff, 64,4 * 1024, 4K/4M: 128 entries),\
 __CI_TBL(CAI_ITLB, 0x52, 0xff, 64,4 * 1024, 4K/4M: 256 entries),\
-__CI_TBL(CAI_ITLB, 0x55, 0xff, 64,4 * 1024, 2M/4M: 7 entries), \
+__CI_TBL(CAI_ITLB2,0x55, 0xff, 64,4 * 1024, 2M/4M: 7 entries), \
 __CI_TBL(CAI_DTLB2,0x56,4, 16, 4 * 1024 * 1024, NULL), \
-__CI_TBL(CAI_DTLB2,0x57,4, 16,4 * 1024, NULL), \
-__CI_TBL(CAI_DTLB, 0x5a, 0xff, 64,4 * 1024, 2M/4M: 32 entries (L0)), \
+__CI_TBL(CAI_DTLB, 0x57,4, 16,4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB, 0x59, 0xff, 16,4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB2,0x5a, 0xff, 64,4 * 1024, 2M/4M: 32 entries (L0)), \
 __CI_TBL(CAI_DTLB, 0x5b, 0xff, 64,4 * 1024, 4K/4M: 64 entries), \
 __CI_TBL(CAI_DTLB, 0x5c, 0xff, 64,4 * 1024, 4K/4M: 128 entries),\
 __CI_TBL(CAI_DTLB, 0x5d, 0xff, 64,4 * 1024, 4K/4M: 256 entries),\
-__CI_TBL(CAI_ITLB, 0xb1,4, 64,   0, 8 2M/4 4M entries), \
+__CI_TBL(CAI_ITLB, 0x61, 0xff, 48,4 * 1024, NULL), \
+__CI_TBL(CAI_L1_1GBDTLB,0x63,   4,  4,1024*1024 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,0x76, 0xff,  8, 4 * 1024 * 1024, 2M/4M: 8 entries), \
+__CI_TBL(CAI_DTLB, 0xa0, 0xff, 32,4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB, 0xb0,4,128,4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,0xb1,4, 64,   0, 8 2M/4 4M entries), \
 __CI_TBL(CAI_ITLB, 0xb2,4, 64,4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB, 0xb3,4,128,4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB, 0xb4,4,256,4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB, 0xb5,8, 64,4 

CVS commit: src/sys/fs/v7fs

2014-12-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Dec 29 15:28:08 UTC 2014

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.

Should fix the v7fs part of PR kern/48864.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/fs/v7fs/v7fs_vnops.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/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.17 src/sys/fs/v7fs/v7fs_vnops.c:1.18
--- src/sys/fs/v7fs/v7fs_vnops.c:1.17	Fri Aug  8 19:15:33 2014
+++ src/sys/fs/v7fs/v7fs_vnops.c	Mon Dec 29 15:28:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -421,6 +421,11 @@ v7fs_getattr(void *v)
 	vap-va_fsid = v7fsmount-devvp-v_rdev;
 	vap-va_fileid = inode-inode_number;
 	vap-va_size = vp-v_size;
+	if (vp-v_type == VLNK) {
+		/* Ajust for trailing NUL. */
+		KASSERT(vap-va_size  0);
+		vap-va_size -= 1;
+	}
 	vap-va_atime.tv_sec = inode-atime;
 	vap-va_mtime.tv_sec = inode-mtime;
 	vap-va_ctime.tv_sec = inode-ctime;



CVS commit: src/sys/fs/v7fs

2014-12-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Dec 29 15:28:58 UTC 2014

Modified Files:
src/sys/fs/v7fs: v7fs_file.c v7fs_vfsops.c v7fs_vnops.c

Log Message:
Defer deallocating unlinked inodes to v7fs_reclaim().

Remove v7fs_vnode_reload() and always use v7fs_inode_load().  No need
to search for a vnode we already hold a reference on.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/v7fs/v7fs_file.c
cvs rdiff -u -r1.10 -r1.11 src/sys/fs/v7fs/v7fs_vfsops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/v7fs/v7fs_vnops.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/fs/v7fs/v7fs_file.c
diff -u src/sys/fs/v7fs/v7fs_file.c:1.5 src/sys/fs/v7fs/v7fs_file.c:1.6
--- src/sys/fs/v7fs/v7fs_file.c:1.5	Fri Dec  7 06:50:15 2012
+++ src/sys/fs/v7fs/v7fs_file.c	Mon Dec 29 15:28:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_file.c,v 1.5 2012/12/07 06:50:15 msaitoh Exp $	*/
+/*	$NetBSD: v7fs_file.c,v 1.6 2014/12/29 15:28:58 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.5 2012/12/07 06:50:15 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.6 2014/12/29 15:28:58 hannken Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -259,6 +259,9 @@ v7fs_file_deallocate(struct v7fs_self *f
 			DPRINTF(directory not empty.\n);
 			return ENOTEMPTY;/* t_vnops dir_noempty, rename_dir(6)*/
 		}
+		error = v7fs_datablock_size_change(fs, 0, inode);
+		if (error)
+			return error;
 		inode.nlink = 0;	/* remove this. */
 	} else {
 		/* Decrement reference count. */
@@ -271,14 +274,7 @@ v7fs_file_deallocate(struct v7fs_self *f
 		return error;
 	DPRINTF(remove dirent\n);
 
-	if (inode.nlink == 0) {
-		v7fs_datablock_contract(fs, inode, inode.filesize);
-		DPRINTF(remove datablock\n);
-		v7fs_inode_deallocate(fs, ino);
-		DPRINTF(remove inode\n);
-	} else {
-		v7fs_inode_writeback(fs, inode);
-	}
+	v7fs_inode_writeback(fs, inode);
 
 	return 0;
 }

Index: src/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.10 src/sys/fs/v7fs/v7fs_vfsops.c:1.11
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.10	Wed Apr 16 18:55:19 2014
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Mon Dec 29 15:28:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.10 2014/04/16 18:55:19 maxv Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.10 2014/04/16 18:55:19 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -74,7 +74,6 @@ static int v7fs_openfs(struct vnode *, s
 static void v7fs_closefs(struct vnode *, struct mount *);
 static int is_v7fs_partition(struct vnode *);
 static enum vtype v7fs_mode_to_vtype(v7fs_mode_t mode);
-int v7fs_vnode_reload(struct mount *, struct vnode *);
 
 int
 v7fs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
@@ -586,34 +585,3 @@ v7fs_mountroot(void)
 
 	return 0;
 }
-
-/* Reload disk inode information */
-int
-v7fs_vnode_reload(struct mount *mp, struct vnode *vp)
-{
-	struct v7fs_mount *v7fsmount = mp-mnt_data;
-	struct v7fs_self *fs = v7fsmount-core;
-	struct v7fs_node *v7fs_node;
-	struct v7fs_inode *inode = ((struct v7fs_node *)vp-v_data)-inode;
-	int target_ino = inode-inode_number;
-	int error = 0;
-
-	DPRINTF(#%d\n, target_ino);
-	mutex_enter(mntvnode_lock);
-	for (v7fs_node = LIST_FIRST(v7fsmount-v7fs_node_head);
-	 v7fs_node != NULL; v7fs_node = LIST_NEXT(v7fs_node, link)) {
-		inode = v7fs_node-inode;
-		if (!v7fs_inode_allocated(inode)) {
-			continue;
-		}
-		if (inode-inode_number == target_ino) {
-			error = v7fs_inode_load(fs, v7fs_node-inode,
-			target_ino);
-			DPRINTF(sync #%d error=%d\n, target_ino, error);
-			break;
-		}
-	}
-	mutex_exit(mntvnode_lock);
-
-	return error;
-}

Index: src/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.18 src/sys/fs/v7fs/v7fs_vnops.c:1.19
--- src/sys/fs/v7fs/v7fs_vnops.c:1.18	Mon Dec 29 15:28:08 2014
+++ src/sys/fs/v7fs/v7fs_vnops.c	Mon Dec 29 15:28:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.19 2014/12/29 15:28:58 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.19 2014/12/29 15:28:58 hannken Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -64,8 +64,6 @@ __KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c
 #define	DPRINTF(arg...)		((void)0)
 #endif
 
-int v7fs_vnode_reload(struct mount *, struct 

CVS commit: src/sys/fs/v7fs

2014-12-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Dec 29 15:29:38 UTC 2014

Modified Files:
src/sys/fs/v7fs: v7fs_extern.c v7fs_extern.h v7fs_vfsops.c v7fs_vnops.c

Log Message:
Change v7fs to vcache.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_extern.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_extern.h
cvs rdiff -u -r1.11 -r1.12 src/sys/fs/v7fs/v7fs_vfsops.c
cvs rdiff -u -r1.19 -r1.20 src/sys/fs/v7fs/v7fs_vnops.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/fs/v7fs/v7fs_extern.c
diff -u src/sys/fs/v7fs/v7fs_extern.c:1.3 src/sys/fs/v7fs/v7fs_extern.c:1.4
--- src/sys/fs/v7fs/v7fs_extern.c:1.3	Fri Jul 25 08:20:52 2014
+++ src/sys/fs/v7fs/v7fs_extern.c	Mon Dec 29 15:29:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_extern.c,v 1.3 2014/07/25 08:20:52 dholland Exp $	*/
+/*	$NetBSD: v7fs_extern.c,v 1.4 2014/12/29 15:29:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_extern.c,v 1.3 2014/07/25 08:20:52 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_extern.c,v 1.4 2014/12/29 15:29:38 hannken Exp $);
 
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
@@ -235,6 +235,7 @@ struct vfsops v7fs_vfsops = {
 	.vfs_statvfs = v7fs_statvfs,
 	.vfs_sync = v7fs_sync,
 	.vfs_vget = v7fs_vget,
+	.vfs_loadvnode = v7fs_loadvnode,
 	.vfs_fhtovp = v7fs_fhtovp,
 	.vfs_vptofh = v7fs_vptofh,
 	.vfs_init = v7fs_init,

Index: src/sys/fs/v7fs/v7fs_extern.h
diff -u src/sys/fs/v7fs/v7fs_extern.h:1.1 src/sys/fs/v7fs/v7fs_extern.h:1.2
--- src/sys/fs/v7fs/v7fs_extern.h:1.1	Mon Jun 27 11:52:24 2011
+++ src/sys/fs/v7fs/v7fs_extern.h	Mon Dec 29 15:29:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_extern.h,v 1.1 2011/06/27 11:52:24 uch Exp $	*/
+/*	$NetBSD: v7fs_extern.h,v 1.2 2014/12/29 15:29:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -46,7 +46,6 @@ struct v7fs_mount {
 	struct mount *mountp;
 	struct vnode *devvp;		/* block device mounted vnode */
 	struct v7fs_self *core;		/* filesystem dependent implementation*/
-	LIST_HEAD(, v7fs_node) v7fs_node_head;
 };
 
 struct v7fs_node {
@@ -59,8 +58,6 @@ struct v7fs_node {
 	int update_ctime;
 	int update_atime;
 	int update_mtime;
-
-	LIST_ENTRY(v7fs_node) link;
 };
 
 #define	VFSTOV7FS(mp)	((struct v7fs_mount *)((mp)-mnt_data))

Index: src/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.11 src/sys/fs/v7fs/v7fs_vfsops.c:1.12
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.11	Mon Dec 29 15:28:58 2014
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Mon Dec 29 15:29:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.12 2014/12/29 15:29:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.12 2014/12/29 15:29:38 hannken Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -273,8 +273,6 @@ v7fs_mountfs(struct vnode *devvp, struct
 		goto err_exit;
 	}
 
-	LIST_INIT(v7fsmount-v7fs_node_head);
-
 	mp-mnt_data = v7fsmount;
 	mp-mnt_stat.f_fsidx.__fsid_val[0] = (long)devvp-v_rdev;
 	mp-mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_V7FS);
@@ -368,47 +366,46 @@ v7fs_statvfs(struct mount *mp, struct st
 	return 0;
 }
 
+static bool
+v7fs_sync_selector(void *cl, struct vnode *vp)
+{
+	struct v7fs_node *v7fs_node = vp-v_data;
+
+	if (v7fs_node == NULL)
+		return false;
+	if (!v7fs_inode_allocated(v7fs_node-inode))
+		return false;
+
+	return true;
+}
+
 int
 v7fs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
 {
 	struct v7fs_mount *v7fsmount = mp-mnt_data;
 	struct v7fs_self *fs = v7fsmount-core;
-	struct v7fs_node *v7fs_node;
-	struct v7fs_inode *inode;
-	struct vnode *v;
+	struct vnode_iterator *marker;
+	struct vnode *vp;
 	int err, error;
-	int retry_cnt;
 
 	DPRINTF(\n);
 
 	v7fs_superblock_writeback(fs);
-	for (retry_cnt = 0; retry_cnt  2; retry_cnt++) {
-		error = 0;
-
-		mutex_enter(mntvnode_lock);
-		for (v7fs_node = LIST_FIRST(v7fsmount-v7fs_node_head);
-		v7fs_node != NULL; v7fs_node = LIST_NEXT(v7fs_node, link)) {
-			inode = v7fs_node-inode;
-			if (!v7fs_inode_allocated(inode)) {
-continue;
-			}
-			v = v7fs_node-vnode;
-			mutex_enter(v-v_interlock);
-			mutex_exit(mntvnode_lock);
-			err = vget(v, LK_EXCLUSIVE | LK_NOWAIT);
-			if (err == 0) {
-err = VOP_FSYNC(v, cred, FSYNC_WAIT, 0, 0);
-vput(v);
-			}
-			if (err != 0)
-error = err;
-			mutex_enter(mntvnode_lock);
+	error = 0;
+	vfs_vnode_iterator_init(mp, marker);
+	while ((vp = vfs_vnode_iterator_next(marker,
+	v7fs_sync_selector, NULL)) != NULL) {
+		err = vn_lock(vp, LK_EXCLUSIVE);
+		if (err) {
+			vrele(vp);
+			

CVS commit: [netbsd-6] src/sys/arch/x86/include

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 15:31:06 UTC 2014

Modified Files:
src/sys/arch/x86/include [netbsd-6]: specialreg.h

Log Message:
Pull up the following revisisions, requested by msaitoh in #1220:

sys/arch/x86/include/specialreg.h   1.59-1.71, 1.73-1.81 (patch)

Update x86 special register definitions:
- Add latest CR4 bits.
- Recognize the P1GB and RDTSCP which were AMD-only on Intel HW too.
- Add some missing bit definitions for CPUID2 and those for XCR0.
- Fix CPUID_AMD_FLAGS4 to not try to print bits \41 and \42.
- Correct the comment about the extended family and model bits.
- Add some definitions related to the process extended state
  enumeration.
- Add Intel Structured Extended Feature leaf (Fn_0007).
- Sort CPUID definitions in initial EAX value.
- Add Intel Deterministic Cache Parameter Leaf (CPUID leaf 4).
- Add some AMD Fn8001 extended features %ecx bits definitions.
- s/MXX/MMXX/ because this bit is MMX eXtention.
- Add some definitions for cpu 'extended state' enumeration
  (Fn000d).
- Add Energy Performance Bias bit of Fn_0006 %ecx.
- Add MSR_IA32_PLATFORM_ID (0x017)
- Modify comment.
- Style fix.


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.55.2.3 src/sys/arch/x86/include/specialreg.h:1.55.2.4
--- src/sys/arch/x86/include/specialreg.h:1.55.2.3	Mon May  7 16:37:19 2012
+++ src/sys/arch/x86/include/specialreg.h	Mon Dec 29 15:31:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.55.2.3 2012/05/07 16:37:19 riz Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.55.2.4 2014/12/29 15:31:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -68,20 +68,55 @@
 /* the remaining 7 bits of this register are reserved */
 
 /*
- * bits in the pentiums %cr4 register:
+ * bits in the %cr4 control register:
  */
+#define CR4_VME		0x0001 /* virtual 8086 mode extension enable */
+#define CR4_PVI		0x0002 /* protected mode virtual interrupt enable */
+#define CR4_TSD		0x0004 /* restrict RDTSC instruction to cpl 0 */
+#define CR4_DE		0x0008 /* debugging extension */
+#define CR4_PSE		0x0010 /* large (4MB) page size enable */
+#define CR4_PAE		0x0020 /* physical address extension enable */
+#define CR4_MCE		0x0040 /* machine check enable */
+#define CR4_PGE		0x0080 /* page global enable */
+#define CR4_PCE		0x0100 /* enable RDPMC instruction for all cpls */
+#define CR4_OSFXSR	0x0200 /* enable fxsave/fxrestor and SSE */
+#define CR4_OSXMMEXCPT	0x0400 /* enable unmasked SSE exceptions */
+#define CR4_VMXE	0x2000 /* enable VMX operations */
+#define CR4_SMXE	0x4000 /* enable SMX operations */
+#define CR4_FSGSBASE	0x0001 /* enable *FSBASE and *GSBASE instructions */
+#define CR4_PCIDE	0x0002 /* enable Process Context IDentifiers */
+#define CR4_OSXSAVE	0x0004 /* enable xsave and xrestore */
+#define CR4_SMEP	0x0010 /* enable SMEP support */
+#define CR4_SMAP	0x0020 /* enable SMAP support */
+
+/*
+ * Extended Control Register XCR0
+ */
+#define	XCR0_X87	0x0001	/* x87 FPU/MMX state */
+#define	XCR0_SSE	0x0002	/* SSE state */
+#define	XCR0_YMM_Hi128	0x0004	/* AVX-256 (ymmn registers) */
+#define	XCR0_BNDREGS	0x0008	/* Memory protection ext bounds */
+#define	XCR0_BNDCSR	0x0010	/* Memory protection ext state */
+#define	XCR0_Opmask	0x0020	/* AVX-512 Opmask */
+#define	XCR0_ZMM_Hi256	0x0040	/* AVX-512 upper 256 bits low regs */
+#define	XCR0_Hi16_ZMM	0x0080	/* AVX-512 512 bits upper registers */
+
+/*
+ * Known fpu bits - only these get enabled
+ * I think the XCR0_BNDREGS and XCR0_BNDCSR would need saving on
+ * every context switch.
+ * The save are is sized for all the fields below (max 2680 bytes).
+ */
+#define XCR0_FPU	(XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \
+			XCR0_Opmask | XCR0_ZMM_Hi256 | XCR0_Hi16_ZMM)
+
+#define XCR0_BND	(XCR0_BNDREGS | XCR0_BNDCSR)
+
+#define XCR0_FLAGS1	\20 \
+	\1 x87	\2 SSE	\3 AVX \
+	\4 BNDREGS	\5 BNDCSR \
+	\6 Opmask	\7 ZMM_Hi256 \10 Hi16_ZMM
 
-#define CR4_VME	0x0001	/* virtual 8086 mode extension enable */
-#define CR4_PVI 0x0002	/* protected mode virtual interrupt enable */
-#define CR4_TSD 0x0004	/* restrict RDTSC instruction to cpl 0 only */
-#define CR4_DE	0x0008	/* debugging extension */
-#define CR4_PSE	0x0010	/* large (4MB) page size enable */
-#define CR4_PAE 0x0020	/* physical address extension enable */
-#define CR4_MCE	0x0040	/* machine check enable */
-#define CR4_PGE	0x0080	/* page global enable 

CVS commit: src/tests/fs/vfs

2014-12-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Dec 29 15:31:44 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Test v7fs_lstat_symlink is no longer expected to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/tests/fs/vfs/t_vnops.c

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

Modified files:

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.43 src/tests/fs/vfs/t_vnops.c:1.44
--- src/tests/fs/vfs/t_vnops.c:1.43	Tue Sep  9 06:51:00 2014
+++ src/tests/fs/vfs/t_vnops.c	Mon Dec 29 15:31:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.43 2014/09/09 06:51:00 gson Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.44 2014/12/29 15:31:44 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -932,9 +932,6 @@ lstat_symlink(const atf_tc_t *tc, const 
 
 	USES_SYMLINKS;
 
-	if (FSTYPE_V7FS(tc))
-		atf_tc_expect_fail(PR kern/48864);
-
 	FSTEST_ENTER();
 
 	src = source;



CVS commit: [netbsd-6] src/sys/netinet6

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 15:45:45 UTC 2014

Modified Files:
src/sys/netinet6 [netbsd-6]: mld6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1224):
sys/netinet6/mld6.c: revision 1.61
Ensure callout isn't running and pending before callout_destroy
Call callout_halt before callout_destroy. And also let callout (mld_timeo)
not call callout_schedule when we already called callout_halt.
This fixes PR 47881.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/netinet6/mld6.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/netinet6/mld6.c
diff -u src/sys/netinet6/mld6.c:1.55 src/sys/netinet6/mld6.c:1.55.4.1
--- src/sys/netinet6/mld6.c:1.55	Sat Nov 19 22:51:29 2011
+++ src/sys/netinet6/mld6.c	Mon Dec 29 15:45:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mld6.c,v 1.55 2011/11/19 22:51:29 tls Exp $	*/
+/*	$NetBSD: mld6.c,v 1.55.4.1 2014/12/29 15:45:44 martin Exp $	*/
 /*	$KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.55 2011/11/19 22:51:29 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.55.4.1 2014/12/29 15:45:44 martin Exp $);
 
 #include opt_inet.h
 
@@ -195,6 +195,8 @@ mld_starttimer(struct in6_multi *in6m)
 {
 	struct timeval now;
 
+	KASSERT(in6m-in6m_timer != IN6M_TIMER_UNDEF);
+
 	microtime(now);
 	in6m-in6m_timer_expire.tv_sec = now.tv_sec + in6m-in6m_timer / hz;
 	in6m-in6m_timer_expire.tv_usec = now.tv_usec +
@@ -227,6 +229,9 @@ mld_timeo(void *arg)
 	mutex_enter(softnet_lock);
 	KERNEL_LOCK(1, NULL);
 
+	if (in6m-in6m_timer == IN6M_TIMER_UNDEF)
+		goto out;
+
 	in6m-in6m_timer = IN6M_TIMER_UNDEF;
 
 	switch (in6m-in6m_state) {
@@ -238,6 +243,7 @@ mld_timeo(void *arg)
 		break;
 	}
 
+out:
 	KERNEL_UNLOCK_ONE(NULL);
 	mutex_exit(softnet_lock);
 }
@@ -741,7 +747,12 @@ in6_delmulti(struct in6_multi *in6m)
 		 */
 		sockaddr_in6_init(sin6, in6m-in6m_addr, 0, 0, 0);
 		if_mcast_op(in6m-in6m_ifp, SIOCDELMULTI, sin6tosa(sin6));
+
+		/* Tell mld_timeo we're halting the timer */
+		in6m-in6m_timer = IN6M_TIMER_UNDEF;
+		callout_halt(in6m-in6m_timer_ch, softnet_lock);
 		callout_destroy(in6m-in6m_timer_ch);
+
 		free(in6m, M_IPMADDR);
 	}
 	splx(s);



CVS commit: [netbsd-6] src/doc

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 15:47:02 UTC 2014

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Tickets #1219, #1220 and #1224


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.179 -r1.1.2.180 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.179 src/doc/CHANGES-6.2:1.1.2.180
--- src/doc/CHANGES-6.2:1.1.2.179	Sun Dec 28 17:03:52 2014
+++ src/doc/CHANGES-6.2	Mon Dec 29 15:47:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.179 2014/12/28 17:03:52 he Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.180 2014/12/29 15:47:02 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -8867,3 +8867,52 @@ etc/rc.d/ntpd			1.15
 	The new ntpd wants to translate ntp into a port number after chroot,
 	so give it its own small copy of /etc/services in the chroot.
 	[mlelstv, ticket 1223]
+
+sys/arch/x86/include/cacheinfo.h		1.14-1.19
+ 
+	Update Intel's cache and TLB descripotr table. This changes the number
+	of page coloring on some CPUs.
+	- Add Shared L2 TLB.
+	- Support prefetch size.
+	- Add some new TLB and cache entries from the document.
+	- Fix some entries:
+	  - Fix 0x0d's DCACHE entry and 0xeb's L3CACHE entry.
+	  - Desc 0x55 and 0xb1 are Instruction TLB but not fixed to 4K.
+	  - Desc 0x5a and 0xc0 are Data TLB but not fixed to 4K.
+	  - Desc 0x57 and 0x59 are 4K fixed DTLB.
+	  - Fix string of desc 0xc2 and it's not fixed to 4K.
+	  - Desc 0xca is 4K fixed L2 shared TLB.
+	[msaitoh, ticket #1219]
+
+sys/arch/x86/include/specialreg.h		1.59-1.71, 1.73-1.81 (via patch)
+
+	Update x86 special register definitions:
+	- Add latest CR4 bits.
+	- Recognize the P1GB and RDTSCP which were AMD-only on Intel HW too.
+	- Add some missing bit definitions for CPUID2 and those for XCR0.
+	- Fix CPUID_AMD_FLAGS4 to not try to print bits \41 and \42.
+	- Correct the comment about the extended family and model bits.
+	- Add some definitions related to the process extended state
+	  enumeration.
+	- Add Intel Structured Extended Feature leaf (Fn_0007).
+	- Sort CPUID definitions in initial EAX value.
+	- Add Intel Deterministic Cache Parameter Leaf (CPUID leaf 4).
+	- Add some AMD Fn8001 extended features %ecx bits definitions.
+	- s/MXX/MMXX/ because this bit is MMX eXtention.
+	- Add some definitions for cpu 'extended state' enumeration
+	  (Fn000d).
+	- Add Energy Performance Bias bit of Fn_0006 %ecx.
+	- Add MSR_IA32_PLATFORM_ID (0x017)
+	- Modify comment.
+	- Style fix.
+	[msaitoh, ticket #1220]
+
+sys/netinet6/mld6.c1.61
+
+	Ensure callout isn't running and pending before callout_destroy:
+
+	Call callout_halt before callout_destroy. And also let callout
+	(mld_timeo) not call callout_schedule when we already called
+	callout_halt.
+	[ozaki-r, ticket #1224]
+



CVS commit: [netbsd-7] src/sys/external/bsd/vchiq/dist/interface/vchiq_arm

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 16:25:28 UTC 2014

Modified Files:
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm [netbsd-7]:
vchiq_arm.c vchiq_core.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #345):
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c: revision 
1.14
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c: revision 
1.10
Enable state/stats information on vchiq device read.
Allow more space for temp string buffer in service stats display.
Fixes corrupted display when rx and tx count become large.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.2.1 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
cvs rdiff -u -r1.9 -r1.9.6.1 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c

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

Modified files:

Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.1
--- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13	Fri Jul 25 08:10:40 2014
+++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c	Mon Dec 29 16:25:28 2014
@@ -36,6 +36,7 @@
 #include sys/device.h
 #include sys/file.h
 #include sys/filedesc.h
+#include sys/kmem.h
 
 #include vchiq_core.h
 #include vchiq_ioctl.h
@@ -196,9 +197,10 @@ extern struct cfdriver vchiq_cd;
 
 static int	vchiq_ioctl(struct file *, u_long, void *);
 static int	vchiq_close(struct file *);
+static int	vchiq_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
 
 static const struct fileops vchiq_fileops = {
-	.fo_read = fbadop_read,
+	.fo_read = vchiq_read,
 	.fo_write = fbadop_write,
 	.fo_ioctl = vchiq_ioctl,
 	.fo_fcntl = fnullop_fcntl,
@@ -1245,9 +1247,7 @@ vchiq_dump(void *dump_context, const cha
 		copy_bytes = min(len, (int)(context-space - context-actual));
 		if (copy_bytes == 0)
 			return;
-		if (copy_to_user(context-buf + context-actual, str,
-			copy_bytes))
-			context-actual = -EFAULT;
+		memcpy(context-buf + context-actual, str, copy_bytes);
 		context-actual += copy_bytes;
 		len -= copy_bytes;
 
@@ -1256,9 +1256,7 @@ vchiq_dump(void *dump_context, const cha
 		** carriage return. */
 		if ((len == 0)  (str[copy_bytes - 1] == '\0')) {
 			char cr = '\n';
-			if (copy_to_user(context-buf + context-actual - 1,
-cr, 1))
-context-actual = -EFAULT;
+			memcpy(context-buf + context-actual - 1, cr, 1);
 		}
 	}
 }
@@ -1432,6 +1430,7 @@ dump_phys_mem(void *virt_addr, uint32_t 
 
 	kfree(pages);
 }
+#endif
 
 /
 *
@@ -1439,23 +1438,29 @@ dump_phys_mem(void *virt_addr, uint32_t 
 *
 ***/
 
-static ssize_t
-vchiq_read(struct file *file, char __user *buf,
-	size_t count, loff_t *ppos)
+static int
+vchiq_read(struct file *file, off_t *ppos, struct uio *uio, kauth_cred_t cred,
+int flags)
 {
+	int result;
+
+	char *buf = kmem_zalloc(PAGE_SIZE, KM_SLEEP);
+
 	DUMP_CONTEXT_T context;
 	context.buf = buf;
 	context.actual = 0;
-	context.space = count;
+	context.space = PAGE_SIZE;
 	context.offset = *ppos;
 
 	vchiq_dump_state(context, g_state);
 
 	*ppos += context.actual;
 
-	return context.actual;
+	result = uiomove(buf, context.actual, uio);
+	kmem_free(buf, PAGE_SIZE);
+	
+	return result;
 }
-#endif
 
 VCHIQ_STATE_T *
 vchiq_get_state(void)

Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c
diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9.6.1
--- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9	Thu Mar 27 23:03:07 2014
+++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c	Mon Dec 29 16:25:28 2014
@@ -3648,7 +3648,7 @@ vchiq_dump_state(void *dump_context, VCH
 void
 vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service)
 {
-	char buf[80];
+	char buf[120];
 	int len;
 
 	len = snprintf(buf, sizeof(buf), Service %d: %s (ref %u),



CVS commit: src/sbin/gpt

2014-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 29 16:27:06 UTC 2014

Modified Files:
src/sbin/gpt: Makefile gpt.c gpt.h
Added Files:
src/sbin/gpt: drvctl.c

Log Message:
Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/gpt/Makefile
cvs rdiff -u -r0 -r1.1 src/sbin/gpt/drvctl.c
cvs rdiff -u -r1.39 -r1.40 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.17 -r1.18 src/sbin/gpt/gpt.h

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

Modified files:

Index: src/sbin/gpt/Makefile
diff -u src/sbin/gpt/Makefile:1.12 src/sbin/gpt/Makefile:1.13
--- src/sbin/gpt/Makefile:1.12	Tue Sep 30 13:59:59 2014
+++ src/sbin/gpt/Makefile	Mon Dec 29 11:27:06 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2014/09/30 17:59:59 christos Exp $
+# $NetBSD: Makefile,v 1.13 2014/12/29 16:27:06 christos Exp $
 # $FreeBSD: src/sbin/gpt/Makefile,v 1.7 2005/09/01 02:49:20 marcel Exp $
 
 PROG=	gpt
@@ -11,6 +11,16 @@ MAN=	gpt.8
 SRCS+= backup.c restore.c
 LDADD+=	-lprop -lutil
 DPADD+= ${LIBPROP} ${LIBUTIL}
+
+.if ${USE_DRVCTL:Uno} == yes
+CPPFLAGS+=-DUSE_DRVCTL
+SRCS+=drvctl.c
+.else
+.PATH: ${.CURDIR}/../fsck
+CPPFLAGS+=-I${.CURDIR}/../fsck
+SRCS+=partutil.c
+.endif
 .endif
 
+
 .include bsd.prog.mk

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.39 src/sbin/gpt/gpt.c:1.40
--- src/sbin/gpt/gpt.c:1.39	Mon Nov 17 02:15:28 2014
+++ src/sbin/gpt/gpt.c	Mon Dec 29 11:27:06 2014
@@ -35,7 +35,7 @@
 __FBSDID($FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $);
 #endif
 #ifdef __RCSID
-__RCSID($NetBSD: gpt.c,v 1.39 2014/11/17 07:15:28 mlelstv Exp $);
+__RCSID($NetBSD: gpt.c,v 1.40 2014/12/29 16:27:06 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -54,11 +54,6 @@ __RCSID($NetBSD: gpt.c,v 1.39 2014/11/1
 #include string.h
 #include unistd.h
 #include ctype.h
-#ifndef HAVE_NBTOOL_CONFIG_H
-#include prop/proplib.h
-#include sys/drvctlio.h
-#include sys/disk.h
-#endif
 
 #include map.h
 #include gpt.h
@@ -364,96 +359,6 @@ gpt_mbr(int fd, off_t lba)
 	return (0);
 }
 
-#ifndef HAVE_NBTOOL_CONFIG_H
-static int
-drvctl(const char *name, u_int *sector_size, off_t *media_size)
-{
-	prop_dictionary_t command_dict, args_dict, results_dict, data_dict,
-	disk_info, geometry;
-	prop_string_t string;
-	prop_number_t number;
-	int dfd, res;
-	char *dname, *p;
-
-	if (*sector_size  *media_size)
-		return 0;
-
-	if ((dfd = open(/dev/drvctl, O_RDONLY)) == -1) {
-		warn(%s: /dev/drvctl, __func__);
-		return -1;
-	}
-
-	command_dict = prop_dictionary_create();
-	args_dict = prop_dictionary_create();
-
-	string = prop_string_create_cstring_nocopy(get-properties);
-	prop_dictionary_set(command_dict, drvctl-command, string);
-	prop_object_release(string);
-
-	if ((dname = strdup(name[0] == 'r' ? name + 1 : name)) == NULL) {
-		(void)close(dfd);
-		return -1;
-	}
-	for (p = dname; *p; p++)
-		continue;
-	for (--p; p = dname  !isdigit((unsigned char)*p); *p-- = '\0')
-		continue;
-
-	string = prop_string_create_cstring(dname);
-	free(dname);
-	prop_dictionary_set(args_dict, device-name, string);
-	prop_object_release(string);
-
-	prop_dictionary_set(command_dict, drvctl-arguments, args_dict);
-	prop_object_release(args_dict);
-
-	res = prop_dictionary_sendrecv_ioctl(command_dict, dfd, DRVCTLCOMMAND,
-	results_dict);
-	(void)close(dfd);
-	prop_object_release(command_dict);
-	if (res) {
-		warn(%s: prop_dictionary_sendrecv_ioctl, __func__);
-		errno = res;
-		return -1;
-	}
-
-	number = prop_dictionary_get(results_dict, drvctl-error);
-	if ((errno = prop_number_integer_value(number)) != 0)
-		return -1;
-
-	data_dict = prop_dictionary_get(results_dict, drvctl-result-data);
-	if (data_dict == NULL)
-		goto out;
-
-	disk_info = prop_dictionary_get(data_dict, disk-info);
-	if (disk_info == NULL)
-		goto out;
-
-	geometry = prop_dictionary_get(disk_info, geometry);
-	if (geometry == NULL)
-		goto out;
-
-	number = prop_dictionary_get(geometry, sector-size);
-	if (number == NULL)
-		goto out;
-
-	if (*sector_size == 0)
-		*sector_size = prop_number_integer_value(number);
-
-	number = prop_dictionary_get(geometry, sectors-per-unit);
-	if (number == NULL)
-		goto out;
-
-	if (*media_size == 0)
-		*media_size = prop_number_integer_value(number) * *sector_size;
-
-	return 0;
-out:
-	errno = EINVAL;
-	return -1;
-}
-#endif
-
 int
 gpt_gpt(int fd, off_t lba, int found)
 {
@@ -580,9 +485,8 @@ gpt_open(const char *dev)
 		if ((secsz == 0  ioctl(fd, DIOCGSECTORSIZE, secsz) == -1) ||
 		(mediasz == 0  ioctl(fd, DIOCGMEDIASIZE, mediasz) == -1))
 			goto close;
-#endif
-#ifndef HAVE_NBTOOL_CONFIG_H
-		if (drvctl(device_name, secsz, mediasz) == -1)
+#else
+		if (getdisksize(device_name, secsz, mediasz) == -1)
 			goto close;
 #endif
 		if (secsz == 0 || 

CVS commit: src/sbin/fsck

2014-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 29 16:27:43 UTC 2014

Modified Files:
src/sbin/fsck: partutil.c partutil.h

Log Message:
Provide a simple getdisksize() api for gpt(8).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck/partutil.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/fsck/partutil.h

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

Modified files:

Index: src/sbin/fsck/partutil.c
diff -u src/sbin/fsck/partutil.c:1.12 src/sbin/fsck/partutil.c:1.13
--- src/sbin/fsck/partutil.c:1.12	Sat Apr 13 18:08:57 2013
+++ src/sbin/fsck/partutil.c	Mon Dec 29 11:27:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: partutil.c,v 1.12 2013/04/13 22:08:57 jakllsch Exp $	*/
+/*	$NetBSD: partutil.c,v 1.13 2014/12/29 16:27:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: partutil.c,v 1.12 2013/04/13 22:08:57 jakllsch Exp $);
+__RCSID($NetBSD: partutil.c,v 1.13 2014/12/29 16:27:43 christos Exp $);
 
 #include sys/types.h
+#include sys/param.h
 #include sys/disklabel.h
 #include sys/disk.h
 #include sys/ioctl.h
@@ -135,8 +136,10 @@ getdiskinfo(const char *s, int fd, const
 		DIOCGDINFO for disk device %s, s);
 	}
 
-	/* DIOCGDINFO didn't fail */
+	if (dkw == NULL)
+		return 0;
 
+	/* DIOCGDINFO didn't fail */
 	(void)memset(dkw, 0, sizeof(*dkw));
 
 	if (stat(s, sb) == -1)
@@ -161,3 +164,23 @@ getdiskinfo(const char *s, int fd, const
 
 	return 0;
 }
+
+int
+getdisksize(const char *name, u_int *secsize, off_t *mediasize)
+{
+	char buf[MAXPATHLEN];
+	struct disk_geom geo;
+	int fd, error;
+
+	if ((fd = opendisk(name, O_RDONLY, buf, sizeof(buf), 0)) == -1)
+		return -1;
+
+	error = getdiskinfo(name, fd, NULL, geo, NULL);
+	close(fd);
+	if (error)
+		return error;
+
+	*secsize = geo.dg_secsize;
+	*mediasize = geo.dg_secsize * geo.dg_secperunit;
+	return 0;
+}

Index: src/sbin/fsck/partutil.h
diff -u src/sbin/fsck/partutil.h:1.2 src/sbin/fsck/partutil.h:1.3
--- src/sbin/fsck/partutil.h:1.2	Mon Apr 28 16:23:08 2008
+++ src/sbin/fsck/partutil.h	Mon Dec 29 11:27:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: partutil.h,v 1.2 2008/04/28 20:23:08 martin Exp $	*/
+/*	$NetBSD: partutil.h,v 1.3 2014/12/29 16:27:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -32,8 +32,11 @@
 #define _PARTUTIL_H_
 
 __BEGIN_DECLS
+struct dkwedge_info;
+struct disk_geom;
 int getdiskinfo(const char *, int, const char *,
 struct disk_geom *, struct dkwedge_info *);
+int getdisksize(const char *, u_int *, off_t *);
 __END_DECLS
 
 #endif /* _PARTUTIL_H_ */



CVS commit: [netbsd-7] src/sys/ufs/ffs

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 16:28:14 UTC 2014

Modified Files:
src/sys/ufs/ffs [netbsd-7]: ffs_vfsops.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #352):
sys/ufs/ffs/ffs_vfsops.c: revision 1.301
Limit the superblock size to SBLOCKSIZE, not MAXBSIZE. Otherwise memcpy
will read beyond the allocated buffer.
Discussed a bit on tech-kern@.


To generate a diff of this commit:
cvs rdiff -u -r1.299.2.1 -r1.299.2.2 src/sys/ufs/ffs/ffs_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/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.299.2.1 src/sys/ufs/ffs/ffs_vfsops.c:1.299.2.2
--- src/sys/ufs/ffs/ffs_vfsops.c:1.299.2.1	Tue Nov 18 18:40:06 2014
+++ src/sys/ufs/ffs/ffs_vfsops.c	Mon Dec 29 16:28:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.299.2.1 2014/11/18 18:40:06 snj Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.299.2.2 2014/12/29 16:28:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.299.2.1 2014/11/18 18:40:06 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.299.2.2 2014/12/29 16:28:14 martin Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -974,7 +974,7 @@ ffs_mountfs(struct vnode *devvp, struct 
 			continue;
 
 		/* Validate size of superblock */
-		if (sbsize  MAXBSIZE || sbsize  sizeof(struct fs))
+		if (sbsize  SBLOCKSIZE || sbsize  sizeof(struct fs))
 			continue;
 
 		/* Check that we can handle the file system blocksize */



CVS commit: src/sbin/fsck

2014-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 29 16:35:38 UTC 2014

Modified Files:
src/sbin/fsck: partutil.c

Log Message:
abort earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck/partutil.c

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

Modified files:

Index: src/sbin/fsck/partutil.c
diff -u src/sbin/fsck/partutil.c:1.13 src/sbin/fsck/partutil.c:1.14
--- src/sbin/fsck/partutil.c:1.13	Mon Dec 29 11:27:43 2014
+++ src/sbin/fsck/partutil.c	Mon Dec 29 11:35:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: partutil.c,v 1.13 2014/12/29 16:27:43 christos Exp $	*/
+/*	$NetBSD: partutil.c,v 1.14 2014/12/29 16:35:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: partutil.c,v 1.13 2014/12/29 16:27:43 christos Exp $);
+__RCSID($NetBSD: partutil.c,v 1.14 2014/12/29 16:35:38 christos Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -125,6 +125,9 @@ getdiskinfo(const char *s, int fd, const
 		dict2geom(geo, geom_dict);
 	}
 
+	if (dkw == NULL)
+		return 0;
+
 	/* Get info about partition/wedge */
 	if (ioctl(fd, DIOCGWEDGEINFO, dkw) != -1) {
 		/* DIOCGWEDGEINFO didn't fail, we're done */
@@ -136,9 +139,6 @@ getdiskinfo(const char *s, int fd, const
 		DIOCGDINFO for disk device %s, s);
 	}
 
-	if (dkw == NULL)
-		return 0;
-
 	/* DIOCGDINFO didn't fail */
 	(void)memset(dkw, 0, sizeof(*dkw));
 



CVS commit: [netbsd-7] src/sys

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 16:35:51 UTC 2014

Modified Files:
src/sys/compat/common [netbsd-7]: vfs_syscalls_30.c
src/sys/compat/linux/common [netbsd-7]: linux_uselib.c
src/sys/ufs/chfs [netbsd-7]: chfs_vfsops.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #353):
sys/ufs/chfs/chfs_vfsops.c: revision 1.12
sys/compat/common/vfs_syscalls_30.c: revision 1.35
sys/compat/linux/common/linux_uselib.c: revision 1.31
sys/compat/linux/common/linux_uselib.c: revision 1.32
Resource leak.
Memory leaks.
Reject non-regular files.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.34.1 src/sys/compat/common/vfs_syscalls_30.c
cvs rdiff -u -r1.30 -r1.30.38.1 src/sys/compat/linux/common/linux_uselib.c
cvs rdiff -u -r1.11 -r1.11.2.1 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/compat/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.33 src/sys/compat/common/vfs_syscalls_30.c:1.33.34.1
--- src/sys/compat/common/vfs_syscalls_30.c:1.33	Fri Nov 19 06:44:35 2010
+++ src/sys/compat/common/vfs_syscalls_30.c	Mon Dec 29 16:35:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.33 2010/11/19 06:44:35 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.33.34.1 2014/12/29 16:35:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_30.c,v 1.33 2010/11/19 06:44:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_30.c,v 1.33.34.1 2014/12/29 16:35:51 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -356,9 +356,13 @@ compat_30_sys_getfh(struct lwp *l, const
 	}
 	NDINIT(nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
 	error = namei(nd);
-	if (error)
+	if (error) {
+		pathbuf_destroy(pb);
 		return (error);
+	}
 	vp = nd.ni_vp;
+	pathbuf_destroy(pb);
+
 	sz = sizeof(struct compat_30_fhandle);
 	error = vfs_composefh(vp, (void *)fh, sz);
 	vput(vp);

Index: src/sys/compat/linux/common/linux_uselib.c
diff -u src/sys/compat/linux/common/linux_uselib.c:1.30 src/sys/compat/linux/common/linux_uselib.c:1.30.38.1
--- src/sys/compat/linux/common/linux_uselib.c:1.30	Fri Aug 28 01:39:03 2009
+++ src/sys/compat/linux/common/linux_uselib.c	Mon Dec 29 16:35:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_uselib.c,v 1.30 2009/08/28 01:39:03 dholland Exp $	*/
+/*	$NetBSD: linux_uselib.c,v 1.30.38.1 2014/12/29 16:35:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_uselib.c,v 1.30 2009/08/28 01:39:03 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_uselib.c,v 1.30.38.1 2014/12/29 16:35:51 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -100,20 +100,26 @@ linux_sys_uselib(struct lwp *l, const st
 	if (error != 0)
 		return error;
 
+	if (vp-v_type != VREG) {
+		error = EINVAL;
+		goto out;
+	}
+
 	if ((error = vn_rdwr(UIO_READ, vp, (void *) hdr, LINUX_AOUT_HDR_SIZE,
 			 0, UIO_SYSSPACE, IO_NODELOCKED, l-l_cred,
 			 rem, NULL))) {
-		vrele(vp);
-		return error;
+		goto out;
 	}
 
 	if (rem != 0) {
-		vrele(vp);
-		return ENOEXEC;
+		error = ENOEXEC;
+		goto out;
 	}
 
-	if (LINUX_N_MACHTYPE(hdr) != LINUX_MID_MACHINE)
-		return ENOEXEC;
+	if (LINUX_N_MACHTYPE(hdr) != LINUX_MID_MACHINE) {
+		error = ENOEXEC;
+		goto out;
+	}
 
 	magic = LINUX_N_MAGIC(hdr);
 	taddr = hdr.a_entry  (~(PAGE_SIZE - 1));
@@ -123,7 +129,7 @@ linux_sys_uselib(struct lwp *l, const st
 
 	error = vn_marktext(vp);
 	if (error)
-		return (error);
+		goto out;
 
 	vcset.evs_cnt = 0;
 	vcset.evs_used = 0;
@@ -150,7 +156,7 @@ linux_sys_uselib(struct lwp *l, const st
 
 	kill_vmcmds(vcset);
 
+out:
 	vrele(vp);
-
 	return error;
 }

Index: src/sys/ufs/chfs/chfs_vfsops.c
diff -u src/sys/ufs/chfs/chfs_vfsops.c:1.11 src/sys/ufs/chfs/chfs_vfsops.c:1.11.2.1
--- src/sys/ufs/chfs/chfs_vfsops.c:1.11	Wed Apr 16 18:55:19 2014
+++ src/sys/ufs/chfs/chfs_vfsops.c	Mon Dec 29 16:35:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_vfsops.c,v 1.11 2014/04/16 18:55:19 maxv Exp $	*/
+/*	$NetBSD: chfs_vfsops.c,v 1.11.2.1 2014/12/29 16:35:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -152,9 +152,12 @@ chfs_mount(struct mount *mp,
 		}
 		/* Look up the name and verify that it's sane. */
 		NDINIT(nd, LOOKUP, FOLLOW, pb);
-		if ((err = namei(nd)) != 0 )
+		if ((err = namei(nd)) != 0 ) {
+			pathbuf_destroy(pb);
 			return (err);
+		}
 		devvp = nd.ni_vp;
+		pathbuf_destroy(pb);
 
 		/* Be sure this is a valid block device */
 		if (devvp-v_type != VBLK)



CVS commit: src/sys/fs/ntfs

2014-12-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Dec 29 16:37:27 UTC 2014

Modified Files:
src/sys/fs/ntfs: ntfs_subr.c

Log Message:
Typos:
 - nessesary - necessary (comment)
 - UNEXISTED - NON-EXISTENT (dprintf)
 - NON-EXISTANT - NON-EXISTENT (dprintf)
 - reach - reaches (comment)


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/ntfs/ntfs_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/fs/ntfs/ntfs_subr.c
diff -u src/sys/fs/ntfs/ntfs_subr.c:1.55 src/sys/fs/ntfs/ntfs_subr.c:1.56
--- src/sys/fs/ntfs/ntfs_subr.c:1.55	Sun Dec 28 14:42:56 2014
+++ src/sys/fs/ntfs/ntfs_subr.c	Mon Dec 29 16:37:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_subr.c,v 1.55 2014/12/28 14:42:56 maxv Exp $	*/
+/*	$NetBSD: ntfs_subr.c,v 1.56 2014/12/29 16:37:27 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko (sem...@freebsd.org)
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ntfs_subr.c,v 1.55 2014/12/28 14:42:56 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: ntfs_subr.c,v 1.56 2014/12/29 16:37:27 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -150,7 +150,7 @@ ntfs_findvattr(struct ntfsmount *ntmp, s
 /*
  * Search attribute specified in ntnode (load ntnode if necessary).
  * If not found but ATTR_A_ATTRLIST present, read it in and search through.
- * VOP_VGET node needed, and lookup through its ntnode (load if nessesary).
+ * VOP_VGET node needed, and lookup through its ntnode (load if necessary).
  *
  * ntnode should be locked
  */
@@ -186,7 +186,7 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, 
 		return (error);
 
 	if (!lvap) {
-		dprintf((%s: UNEXISTED ATTRIBUTE: 
+		dprintf((%s: NON-EXISTENT ATTRIBUTE: 
 		ino: %llu, type: 0x%x, name: %s, vcn: %qu\n, __func__,
 		(unsigned long long)ip-i_number, type, name,
 		(long long)vcn));
@@ -243,7 +243,7 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, 
 	}
 	error = ENOENT;
 
-	dprintf((%s: NON-EXISTANT ATTRIBUTE: ino: %llu, type: 0x%x, 
+	dprintf((%s: NON-EXISTENT ATTRIBUTE: ino: %llu, type: 0x%x, 
 	name: %.*s, vcn: %qu\n, __func__,
 	(unsigned long long)ip-i_number, type, (int)namelen,
 	name, (long long)vcn));
@@ -433,7 +433,7 @@ ntfs_ntlookup(struct ntfsmount *ntmp, in
 }
 
 /*
- * Decrement usecount of ntnode and unlock it, if usecount reach zero,
+ * Decrement usecount of ntnode and unlock it, if usecount reaches zero,
  * deallocate ntnode.
  *
  * ntnode should be locked on entry, and unlocked on return.



CVS commit: [netbsd-7] src/sys/dev/pci

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 17:01:01 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-7]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #354):
sys/dev/pci/if_vioif.c: revision 1.14
Reuse mbuf when retrying in vioif_start
Otherwise, the old mbuf will leak.


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

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

Modified files:

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.7 src/sys/dev/pci/if_vioif.c:1.7.2.1
--- src/sys/dev/pci/if_vioif.c:1.7	Tue Jul 22 02:21:50 2014
+++ src/sys/dev/pci/if_vioif.c	Mon Dec 29 17:01:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.7 2014/07/22 02:21:50 ozaki-r Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.7.2.1 2014/12/29 17:01:01 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.7 2014/07/22 02:21:50 ozaki-r Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.7.2.1 2014/12/29 17:01:01 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -735,12 +735,13 @@ vioif_start(struct ifnet *ifp)
 		if (m == NULL)
 			break;
 
+retry:
 		r = virtio_enqueue_prep(vsc, vq, slot);
 		if (r == EAGAIN) {
 			ifp-if_flags |= IFF_OACTIVE;
 			vioif_tx_vq_done_locked(vq);
 			if (retry++ == 0)
-continue;
+goto retry;
 			else
 break;
 		}
@@ -763,7 +764,7 @@ vioif_start(struct ifnet *ifp)
 			ifp-if_flags |= IFF_OACTIVE;
 			vioif_tx_vq_done_locked(vq);
 			if (retry++ == 0)
-continue;
+goto retry;
 			else
 break;
 		}



CVS commit: src/sys/fs/hfs

2014-12-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Dec 29 17:02:39 UTC 2014

Modified Files:
src/sys/fs/hfs: libhfs.c

Log Message:
I started to KNF this file but quickly ended up figuring out I was not
courageous enough for such ugliness. So I only KNF'ed the first 300
lines.

I'll come back later.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/fs/hfs/libhfs.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/fs/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.12 src/sys/fs/hfs/libhfs.c:1.13
--- src/sys/fs/hfs/libhfs.c:1.12	Sat Jul 28 00:43:23 2012
+++ src/sys/fs/hfs/libhfs.c	Mon Dec 29 17:02:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libhfs.c,v 1.12 2012/07/28 00:43:23 matt Exp $	*/
+/*	$NetBSD: libhfs.c,v 1.13 2014/12/29 17:02:39 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: libhfs.c,v 1.12 2012/07/28 00:43:23 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: libhfs.c,v 1.13 2014/12/29 17:02:39 maxv Exp $);
 
 #include libhfs.h
 
@@ -59,7 +59,8 @@ hfs_catalog_key_t* hfs_gPrivateObjectKey
 	hfs_gMetadataDirectoryKey,
 	hfs_gJournalInfoBlockFileKey,
 	hfs_gJournalBufferFileKey,
-	NULL};
+	NULL
+};
 
 
 extern uint16_t be16tohp(void** inout_ptr);
@@ -100,21 +101,21 @@ void
 hfslib_init(hfs_callbacks* in_callbacks)
 {
 	unichar_t	temp[256];
-	
-	if(in_callbacks!=NULL)
+
+	if (in_callbacks != NULL)
 		memcpy(hfs_gcb, in_callbacks, sizeof(hfs_callbacks));
-	
+
 	hfs_gcft = NULL;
-	
+
 	/*
 	 * Create keys for the HFS+ private files so we can reuse them whenever
 	 * we perform a user-visible operation, such as listing directory contents.
 	 */
-		
+
 #define ATOU(str, len) /* quick  dirty ascii-to-unicode conversion */ \
 	do{ int i; for(i=0; ilen; i++) temp[i]=str[i]; } \
 	while( /*CONSTCOND*/ 0)
-	
+
 	ATOU(\0\0\0\0HFS+ Private Data, 21);
 	hfslib_make_catalog_key(HFS_CNID_ROOT_FOLDER, 21, temp, 
 		hfs_gMetadataDirectoryKey);
@@ -134,8 +135,8 @@ void
 hfslib_done(void)
 {
 	hfs_callback_args	cbargs;
-	
-	if(hfs_gcft!=NULL) {
+
+	if (hfs_gcft != NULL) {
 		hfslib_init_cbargs(cbargs);
 		hfslib_free(hfs_gcft, cbargs);
 		hfs_gcft = NULL;
@@ -175,102 +176,97 @@ hfslib_open_volume(
 	result = 1;
 	buffer = NULL;
 
-	if(in_device==NULL || out_vol==NULL)
+	if (in_device == NULL || out_vol == NULL)
 		return 1;
 
 	out_vol-readonly = in_readonly;
 	out_vol-offset = 0;
 
-	if(hfslib_openvoldevice(out_vol, in_device, cbargs) != 0)
+	if (hfslib_openvoldevice(out_vol, in_device, cbargs) != 0)
 		HFS_LIBERR(could not open device);
 	isopen = 1;
 
 	/*
-	 *	Read the volume header.
+	 * Read the volume header.
 	 */
 	buffer = hfslib_malloc(max(sizeof(hfs_volume_header_t),
 		sizeof(hfs_hfs_master_directory_block_t)), cbargs);
-	if(buffer==NULL)
+	if (buffer == NULL)
 		HFS_LIBERR(could not allocate volume header);
-	if(hfslib_readd(out_vol, buffer, max(sizeof(hfs_volume_header_t),
-			sizeof(hfs_hfs_master_directory_block_t)),
-	   HFS_VOLUME_HEAD_RESERVE_SIZE, cbargs)!=0)
+	if (hfslib_readd(out_vol, buffer, max(sizeof(hfs_volume_header_t),
+	sizeof(hfs_hfs_master_directory_block_t)),
+	HFS_VOLUME_HEAD_RESERVE_SIZE, cbargs) != 0)
 		HFS_LIBERR(could not read volume header);
 
 	if (be16toh(*((uint16_t *)buffer)) == HFS_SIG_HFS) {
 		if (hfslib_read_master_directory_block(buffer, mdb) == 0)
 			HFS_LIBERR(could not parse master directory block);
-		if (mdb.embedded_signature == HFS_SIG_HFSP)
-		{
+		if (mdb.embedded_signature == HFS_SIG_HFSP) {
 			/* XXX: is 512 always correct? */
 			out_vol-offset =
 			mdb.first_block * 512
 			+ mdb.embedded_extent.start_block
 			* (uint64_t)mdb.block_size;
 
-			if(hfslib_readd(out_vol, buffer,
-			   sizeof(hfs_volume_header_t),
-			   HFS_VOLUME_HEAD_RESERVE_SIZE, cbargs)!=0)
+			if (hfslib_readd(out_vol, buffer,
+			sizeof(hfs_volume_header_t),
+			HFS_VOLUME_HEAD_RESERVE_SIZE, cbargs) != 0)
 HFS_LIBERR(could not read volume header);
-		}
-		else
+		} else
 			HFS_LIBERR(Plain HFS volumes not currently supported);
 	}
 
-	if(hfslib_read_volume_header(buffer, (out_vol-vh))==0)
+	if (hfslib_read_volume_header(buffer, (out_vol-vh)) == 0)
 		HFS_LIBERR(could not parse volume header);
-	
+
 	/*
 	 * Check the volume signature to see if this is a legitimate HFS+ or HFSX
 	 * volume. If so, set the key comparison function pointers appropriately.
 	 */
-	switch(out_vol-vh.signature)
-	{
+	switch(out_vol-vh.signature) {
 		case HFS_SIG_HFSP:
 			out_vol-keycmp = hfslib_compare_catalog_keys_cf;
 			break;
-		
 		case HFS_SIG_HFSX:
 			out_vol-keycmp = NULL; /* will be set below */
 			break;
-			
 		default:
 			/* HFS_LIBERR(unrecognized volume format); */
 			goto error;
 			break;
 	}
 
-
 	/*
-	 *	Read the catalog header.
+	 * Read the catalog header.
 	 */
 	buffer2 = hfslib_realloc(buffer, 512, cbargs);
-	

CVS commit: src/sys/fs/hfs

2014-12-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Dec 29 17:17:54 UTC 2014

Modified Files:
src/sys/fs/hfs: hfs_vfsops.c

Log Message:
Small cleanup:
 - KNF
 - malloc + memset - malloc(|M_ZERO)
 - no need to check data == NULL


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/fs/hfs/hfs_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/fs/hfs/hfs_vfsops.c
diff -u src/sys/fs/hfs/hfs_vfsops.c:1.32 src/sys/fs/hfs/hfs_vfsops.c:1.33
--- src/sys/fs/hfs/hfs_vfsops.c:1.32	Sun Aug 10 08:53:22 2014
+++ src/sys/fs/hfs/hfs_vfsops.c	Mon Dec 29 17:17:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hfs_vfsops.c,v 1.32 2014/08/10 08:53:22 hannken Exp $	*/
+/*	$NetBSD: hfs_vfsops.c,v 1.33 2014/12/29 17:17:54 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hfs_vfsops.c,v 1.32 2014/08/10 08:53:22 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: hfs_vfsops.c,v 1.33 2014/12/29 17:17:54 maxv Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -174,13 +174,12 @@ struct vfsops hfs_vfsops = {
 };
 
 static const struct genfs_ops hfs_genfsops = {
-.gop_size = genfs_size,
+	.gop_size = genfs_size,
 };
 
 static int
 hfs_modcmd(modcmd_t cmd, void *arg)
 {
-
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		return vfs_attach(hfs_vfsops);
@@ -207,10 +206,10 @@ hfs_mount(struct mount *mp, const char *
 	if (*data_len  sizeof *args)
 		return EINVAL;
 
-#ifdef HFS_DEBUG	
+#ifdef HFS_DEBUG
 	printf(vfsop = hfs_mount()\n);
 #endif /* HFS_DEBUG */
-	
+
 	if (mp-mnt_flag  MNT_GETARGS) {
 		hmp = VFSTOHFS(mp);
 		if (hmp == NULL)
@@ -220,9 +219,6 @@ hfs_mount(struct mount *mp, const char *
 		return 0;
 	}
 
-	if (data == NULL)
-		return EINVAL;
-
 /* FIXME: For development ONLY - disallow remounting for now */
 #if 0
 	update = mp-mnt_flag  MNT_UPDATE;
@@ -239,7 +235,7 @@ hfs_mount(struct mount *mp, const char *
 	NSM_FOLLOW_NOEMULROOT, devvp);
 		if (error != 0)
 			return error;
-	
+
 		if (!update) {
 			/*
 			 * Be sure this is a valid block device
@@ -269,7 +265,6 @@ hfs_mount(struct mount *mp, const char *
 		}
 	}
 
-	
 	/*
 	 * If mount by non-root, then verify that user has necessary
 	 * permissions on the device.
@@ -302,14 +297,14 @@ hfs_mount(struct mount *mp, const char *
 
 	if ((error = hfs_mountfs(devvp, mp, l, args-fspec)) != 0)
 		goto error;
-	
+
 	error = set_statvfs_info(path, UIO_USERSPACE, args-fspec, UIO_USERSPACE,
 		mp-mnt_op-vfs_name, mp, l);
 
 #ifdef HFS_DEBUG
 	if(!update) {
 		char* volname;
-		
+
 		hmp = VFSTOHFS(mp);
 		volname = malloc(hmp-hm_vol.name.length + 1, M_TEMP, M_WAITOK);
 		if (volname == NULL)
@@ -324,9 +319,9 @@ hfs_mount(struct mount *mp, const char *
 		}
 	}
 #endif /* HFS_DEBUG */
-		
+
 	return error;
-	
+
 error:
 	vrele(devvp);
 	return error;
@@ -335,8 +330,7 @@ error:
 int
 hfs_start(struct mount *mp, int flags)
 {
-
-#ifdef HFS_DEBUG	
+#ifdef HFS_DEBUG
 	printf(vfsop = hfs_start()\n);
 #endif /* HFS_DEBUG */
 
@@ -353,20 +347,18 @@ hfs_mountfs(struct vnode *devvp, struct 
 	struct hfsmount *hmp;
 	kauth_cred_t cred;
 	int error;
-	
+
 	cred = l ? l-l_cred : NOCRED;
 	error = 0;
 	hmp = NULL;
 
 	/* Create mounted volume structure. */
-	hmp = (struct hfsmount*)malloc(sizeof(struct hfsmount),
-M_HFSMNT, M_WAITOK);
+	hmp = malloc(sizeof(struct hfsmount), M_HFSMNT, M_WAITOK|M_ZERO);
 	if (hmp == NULL) {
 		error = ENOMEM;
 		goto error;
 	}
-	memset(hmp, 0, sizeof(struct hfsmount));
-	
+
 	mp-mnt_data = hmp;
 	mp-mnt_flag |= MNT_LOCAL;
 	vfs_getnewfsid(mp);
@@ -374,12 +366,12 @@ hfs_mountfs(struct vnode *devvp, struct 
 	hmp-hm_mountp = mp;
 	hmp-hm_dev = devvp-v_rdev;
 	hmp-hm_devvp = devvp;
-	
+
 	/*
 	 * Use libhfs to open the volume and read the volume header and other
 	 * useful information.
 	 */
-	 
+
 	hfslib_init_cbargs(cbargs);
 	argsopen.cred = argsread.cred = cred;
 	argsopen.l = argsread.l = l;
@@ -390,7 +382,7 @@ hfs_mountfs(struct vnode *devvp, struct 
 	if ((error = hfslib_open_volume(devpath, mp-mnt_flag  MNT_RDONLY,
 		hmp-hm_vol, cbargs)) != 0)
 		goto error;
-		
+
 	/* Make sure this is not a journaled volume whose journal is dirty. */
 	if (!hfslib_is_journal_clean(hmp-hm_vol)) {
 		printf(volume journal is dirty; not mounting\n);
@@ -399,16 +391,15 @@ hfs_mountfs(struct vnode *devvp, struct 
 	}
 
 	mp-mnt_fs_bshift = 0;
-while ((1  mp-mnt_fs_bshift)  hmp-hm_vol.vh.block_size)
+	while ((1  mp-mnt_fs_bshift)  hmp-hm_vol.vh.block_size)
 		mp-mnt_fs_bshift++;
 	mp-mnt_dev_bshift = DEV_BSHIFT;
 
 	return 0;
-	
+
 error:
 	if (hmp != NULL)
 		free(hmp, M_HFSMNT);
-		
 	return error;
 }
 
@@ -420,17 +411,17 @@ hfs_unmount(struct mount *mp, int mntfla
 	struct hfsmount* hmp;
 	int error;
 	int flags;
-	
-#ifdef HFS_DEBUG	
+
+#ifdef HFS_DEBUG
 	printf(vfsop = hfs_unmount()\n);
 #endif /* HFS_DEBUG */
 
 	

CVS commit: [netbsd-7] src/etc/rc.d

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 17:19:18 UTC 2014

Modified Files:
src/etc/rc.d [netbsd-7]: ntpd

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #355):
etc/rc.d/ntpd: revision 1.15
new ntpd wants to be able to translate ntp into a port number after chroot,
so give it its own small copy of /etc/services in the chroot


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.10.1 src/etc/rc.d/ntpd

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

Modified files:

Index: src/etc/rc.d/ntpd
diff -u src/etc/rc.d/ntpd:1.14 src/etc/rc.d/ntpd:1.14.10.1
--- src/etc/rc.d/ntpd:1.14	Tue Dec  4 16:38:40 2012
+++ src/etc/rc.d/ntpd	Mon Dec 29 17:19:18 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ntpd,v 1.14 2012/12/04 16:38:40 prlw1 Exp $
+# $NetBSD: ntpd,v 1.14.10.1 2014/12/29 17:19:18 martin Exp $
 #
 
 # PROVIDE: ntpd
@@ -50,6 +50,21 @@ ntpd_precmd()
 	fi
 	ln -fs ${ntpd_chrootdir}/var/db/ntp.drift /var/db/ntp.drift
 
+	if [ ! -d ${ntpd_chrootdir}/etc ]; then
+		mkdir ${ntpd_chrootdir}/etc
+	fi
+	if [ ! -f ${ntpd_chrootdir}/etc/services ]; then
+		getent services ntp/udp ntp/tcp \
+			 ${ntpd_chrootdir}/etc/services
+	fi
+	if [ ! -d ${ntpd_chrootdir}/var/db ]; then
+		mkdir -p ${ntpd_chrootdir}/var/db
+	fi
+	if [ ! -f ${ntpd_chrootdir}/var/db/services.cdb ]; then
+		services_mkdb -o ${ntpd_chrootdir}/var/db/services.cdb \
+			${ntpd_chrootdir}/etc/services
+	fi
+
 	#	Change run_rc_commands()'s internal copy of $ntpd_flags
 	#
 	rc_flags=-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags



CVS commit: [netbsd-7] src

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 17:27:29 UTC 2014

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-7]:
mDNSPosix.c
src/external/bsd/dhcpcd/dist [netbsd-7]: dhcpcd.c
src/external/bsd/ipf/dist/lib [netbsd-7]: printhost.c printhostmask.c
printipfexpr.c save_v1trap.c save_v2trap.c
src/external/bsd/ipf/dist/tools [netbsd-7]: lexer.c
src/external/bsd/ppp/usr.sbin/pppd [netbsd-7]: sys-bsd.c
src/external/bsd/tcpdump/bin [netbsd-7]: Makefile
src/sbin/route [netbsd-7]: route.c
src/usr.sbin/lpr/common_source [netbsd-7]: Makefile common.c

Log Message:
Pull up following revision(s) (requested by prlw1 in ticket #358):
sbin/route/route.c: revision 1.149
external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.7
external/bsd/ipf/dist/lib/printhost.c: revision 1.3
usr.sbin/lpr/common_source/common.c: revision 1.43
usr.sbin/lpr/common_source/Makefile: revision 1.12
external/bsd/ipf/dist/lib/printhostmask.c: revision 1.3
external/bsd/ipf/dist/lib/save_v1trap.c: revision 1.2
external/bsd/dhcpcd/dist/dhcpcd.c: revision 1.21
external/bsd/tcpdump/bin/Makefile: revision 1.12
external/bsd/ipf/dist/lib/save_v2trap.c: revision 1.2
external/bsd/ipf/dist/tools/lexer.c: revision 1.2
external/bsd/ppp/usr.sbin/pppd/sys-bsd.c: revision 1.3
external/bsd/ipf/dist/lib/printipfexpr.c: revision 1.2
MKINET6=no build fixes
http://mail-index.netbsd.org/tech-net/2014/12/13/msg004898.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.2 -r1.2.12.1 src/external/bsd/ipf/dist/lib/printhost.c \
src/external/bsd/ipf/dist/lib/printhostmask.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.12.1 \
src/external/bsd/ipf/dist/lib/printipfexpr.c \
src/external/bsd/ipf/dist/lib/save_v1trap.c \
src/external/bsd/ipf/dist/lib/save_v2trap.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.12.1 src/external/bsd/ipf/dist/tools/lexer.c
cvs rdiff -u -r1.1.6.1 -r1.1.6.2 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/external/bsd/tcpdump/bin/Makefile
cvs rdiff -u -r1.144 -r1.144.4.1 src/sbin/route/route.c
cvs rdiff -u -r1.11 -r1.11.40.1 src/usr.sbin/lpr/common_source/Makefile
cvs rdiff -u -r1.42 -r1.42.4.1 src/usr.sbin/lpr/common_source/common.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/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.6 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.6.4.1
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.6	Mon Mar 31 23:26:30 2014
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Mon Dec 29 17:27:28 2014
@@ -718,7 +718,7 @@ mDNSlocal int SetupSocket(struct sockadd
 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_RECVPKTINFO, kOn, sizeof(kOn));
 if (err  0) { err = errno; perror(setsockopt - IPV6_RECVPKTINFO); }
 			}
-#elif defined(IPV6_PKTINFO)
+	#elif defined(IPV6_PKTINFO)
 		if (err == 0)
 			{
 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_PKTINFO, kOn, sizeof(kOn));

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.7.2.1 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.7.2.2
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.7.2.1	Mon Dec 29 16:18:05 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Mon Dec 29 17:27:28 2014
@@ -1,5 +1,5 @@
 #include sys/cdefs.h
- __RCSID($NetBSD: dhcpcd.c,v 1.7.2.1 2014/12/29 16:18:05 martin Exp $);
+ __RCSID($NetBSD: dhcpcd.c,v 1.7.2.2 2014/12/29 17:27:28 martin Exp $);
 
 /*
  * dhcpcd - DHCP client daemon
@@ -745,8 +745,9 @@ dhcpcd_startinterface(void *arg)
 		!(ifo-options  (DHCPCD_INFORM | DHCPCD_PFXDLGONLY)))
 			ipv6nd_startrs(ifp);
 
-		if (ifo-options  DHCPCD_DHCP6)
+		if (ifo-options  DHCPCD_DHCP6) {
 			dhcp6_find_delegates(ifp);
+		}
 
 		if (!(ifo-options  DHCPCD_IPV6RS) ||
 		ifo-options  DHCPCD_IA_FORCED)

Index: src/external/bsd/ipf/dist/lib/printhost.c
diff -u src/external/bsd/ipf/dist/lib/printhost.c:1.2 src/external/bsd/ipf/dist/lib/printhost.c:1.2.12.1
--- src/external/bsd/ipf/dist/lib/printhost.c:1.2	Sun Jul 22 14:27:36 2012
+++ src/external/bsd/ipf/dist/lib/printhost.c	Mon Dec 29 17:27:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: printhost.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $	*/
+/*	$NetBSD: printhost.c,v 1.2.12.1 2014/12/29 17:27:28 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -25,9 +25,9 @@ printhost(family, addr)
 	if ((family == -1) || !*addr)
 		PRINTF(any);
 	else {
+#ifdef  USE_INET6
 		void *ptr = addr;
 
-#ifdef  USE_INET6
 		

CVS commit: [netbsd-7] src/usr.sbin/npf/npfctl

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 17:31:47 UTC 2014

Modified Files:
src/usr.sbin/npf/npfctl [netbsd-7]: npf.conf.5 npf_parse.y npf_scan.l
npfctl.c npfctl.h

Log Message:
Pull up following revision(s) (requested by rmind in ticket #359):
usr.sbin/npf/npfctl/npf_scan.l: revision 1.22
usr.sbin/npf/npfctl/npf.conf.5: revision 1.43
usr.sbin/npf/npfctl/npfctl.c: revision 1.44
usr.sbin/npf/npfctl/npf_parse.y: revision 1.36
usr.sbin/npf/npfctl/npfctl.c: revision 1.45
usr.sbin/npf/npfctl/npfctl.h: revision 1.39
npfctl(8): attempt to preload bpfjit kernel module and print the
warning on failure.
allow turning off the bpf jit loading.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.2.1 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.35 -r1.35.4.1 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.21 -r1.21.2.1 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.42.2.1 -r1.42.2.2 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.38 -r1.38.2.1 src/usr.sbin/npf/npfctl/npfctl.h

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.42 src/usr.sbin/npf/npfctl/npf.conf.5:1.42.2.1
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.42	Sun Aug  3 00:02:56 2014
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Mon Dec 29 17:31:47 2014
@@ -1,4 +1,4 @@
-.\$NetBSD: npf.conf.5,v 1.42 2014/08/03 00:02:56 rmind Exp $
+.\$NetBSD: npf.conf.5,v 1.42.2.1 2014/12/29 17:31:47 martin Exp $
 .\
 .\ Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 2, 2014
+.Dd December 26, 2014
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -240,6 +240,9 @@ var-name	= $ . string
 interface	= interface-name | var-name
 var-def		= var = ( var-value | { value *[ , value ] } )
 
+; Parameter setting
+set-statement	= set parameter value
+
 ; Table definition.  Table ID shall be numeric.  Path is in the double quotes.
 
 table-id	= \*[Lt]table-name\*[Gt]

Index: src/usr.sbin/npf/npfctl/npf_parse.y
diff -u src/usr.sbin/npf/npfctl/npf_parse.y:1.35 src/usr.sbin/npf/npfctl/npf_parse.y:1.35.4.1
--- src/usr.sbin/npf/npfctl/npf_parse.y:1.35	Sat Mar 15 15:22:37 2014
+++ src/usr.sbin/npf/npfctl/npf_parse.y	Mon Dec 29 17:31:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_parse.y,v 1.35 2014/03/15 15:22:37 riastradh Exp $	*/
+/*	$NetBSD: npf_parse.y,v 1.35.4.1 2014/12/29 17:31:47 martin Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 The NetBSD Foundation, Inc.
@@ -92,6 +92,7 @@ yyerror(const char *fmt, ...)
 %token			ARROWLEFT
 %token			ARROWRIGHT
 %token			BLOCK
+%token			BPFJIT
 %token			CDB
 %token			CURLY_CLOSE
 %token			CURLY_OPEN
@@ -118,6 +119,7 @@ yyerror(const char *fmt, ...)
 %token			NAME
 %token			NPT66
 %token			ON
+%token			OFF
 %token			OUT
 %token			PAR_CLOSE
 %token			PAR_OPEN
@@ -134,6 +136,7 @@ yyerror(const char *fmt, ...)
 %token			RETURNRST
 %token			RULESET
 %token			SEPLINE
+%token			SET
 %token			SLASH
 %token			STATEFUL
 %token			STATEFUL_ENDS
@@ -169,9 +172,11 @@ yyerror(const char *fmt, ...)
 %type	filtopts	filt_opts, all_or_filt_opts
 %type	optproto	opt_proto
 %type	rulegroup	group_opts
+%type	tf		onoff
 
 %union {
 	char *		str;
+	bool		tf;
 	unsigned long	num;
 	double		fpnum;
 	npfvar_t *	var;
@@ -200,6 +205,7 @@ line
 	| group
 	| rproc
 	| alg
+	| set
 	|
 	;
 
@@ -210,6 +216,21 @@ alg
 	}
 	;
 
+onoff
+	: ON {
+		$$ = true;
+	}
+	| OFF {
+		$$ = false;
+	}
+	;
+
+set
+	: SET BPFJIT onoff {
+		npfctl_bpfjit($3);
+	}
+	;
+
 /*
  * A value - an element or a list of elements.
  * Can be assigned to a variable or used inline.

Index: src/usr.sbin/npf/npfctl/npf_scan.l
diff -u src/usr.sbin/npf/npfctl/npf_scan.l:1.21 src/usr.sbin/npf/npfctl/npf_scan.l:1.21.2.1
--- src/usr.sbin/npf/npfctl/npf_scan.l:1.21	Sat May 31 22:37:05 2014
+++ src/usr.sbin/npf/npfctl/npf_scan.l	Mon Dec 29 17:31:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_scan.l,v 1.21 2014/05/31 22:37:05 rmind Exp $	*/
+/*	$NetBSD: npf_scan.l,v 1.21.2.1 2014/12/29 17:31:47 martin Exp $	*/
 
 /*-
  * Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@@ -97,6 +97,7 @@ static			return TSTATIC;
 dynamic			return TDYNAMIC;
 file			return TFILE;
 map			return MAP;
+set			return SET;
 -			return ARROWBOTH;
 -			return ARROWLEFT;
 -			return ARROWRIGHT;
@@ -124,6 +125,8 @@ apply			return APPLY;
 final			return FINAL;
 quick			return FINAL;
 on			return ON;
+off			return OFF;
+bpf.jit			return BPFJIT;
 inet6			return INET6;
 inet4			return INET4;
 proto			return PROTO;

Index: src/usr.sbin/npf/npfctl/npfctl.c
diff -u src/usr.sbin/npf/npfctl/npfctl.c:1.42.2.1 src/usr.sbin/npf/npfctl/npfctl.c:1.42.2.2
--- src/usr.sbin/npf/npfctl/npfctl.c:1.42.2.1	Fri Aug 29 11:14:14 2014
+++ 

CVS commit: [netbsd-7] src/sys/netinet6

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 17:33:49 UTC 2014

Modified Files:
src/sys/netinet6 [netbsd-7]: mld6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #360):
sys/netinet6/mld6.c: revision 1.61
Ensure callout isn't running and pending before callout_destroy
Call callout_halt before callout_destroy. And also let callout (mld_timeo)
not call callout_schedule when we already called callout_halt.
This fixes PR 47881.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.59.2.1 src/sys/netinet6/mld6.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/netinet6/mld6.c
diff -u src/sys/netinet6/mld6.c:1.59 src/sys/netinet6/mld6.c:1.59.2.1
--- src/sys/netinet6/mld6.c:1.59	Sat Jul 26 22:21:16 2014
+++ src/sys/netinet6/mld6.c	Mon Dec 29 17:33:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mld6.c,v 1.59 2014/07/26 22:21:16 joerg Exp $	*/
+/*	$NetBSD: mld6.c,v 1.59.2.1 2014/12/29 17:33:49 martin Exp $	*/
 /*	$KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.59 2014/07/26 22:21:16 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.59.2.1 2014/12/29 17:33:49 martin Exp $);
 
 #include opt_inet.h
 
@@ -195,6 +195,8 @@ mld_starttimer(struct in6_multi *in6m)
 {
 	struct timeval now;
 
+	KASSERT(in6m-in6m_timer != IN6M_TIMER_UNDEF);
+
 	microtime(now);
 	in6m-in6m_timer_expire.tv_sec = now.tv_sec + in6m-in6m_timer / hz;
 	in6m-in6m_timer_expire.tv_usec = now.tv_usec +
@@ -227,6 +229,9 @@ mld_timeo(void *arg)
 	mutex_enter(softnet_lock);
 	KERNEL_LOCK(1, NULL);
 
+	if (in6m-in6m_timer == IN6M_TIMER_UNDEF)
+		goto out;
+
 	in6m-in6m_timer = IN6M_TIMER_UNDEF;
 
 	switch (in6m-in6m_state) {
@@ -238,6 +243,7 @@ mld_timeo(void *arg)
 		break;
 	}
 
+out:
 	KERNEL_UNLOCK_ONE(NULL);
 	mutex_exit(softnet_lock);
 }
@@ -741,7 +747,12 @@ in6_delmulti(struct in6_multi *in6m)
 		 */
 		sockaddr_in6_init(sin6, in6m-in6m_addr, 0, 0, 0);
 		if_mcast_op(in6m-in6m_ifp, SIOCDELMULTI, sin6tosa(sin6));
+
+		/* Tell mld_timeo we're halting the timer */
+		in6m-in6m_timer = IN6M_TIMER_UNDEF;
+		callout_halt(in6m-in6m_timer_ch, softnet_lock);
 		callout_destroy(in6m-in6m_timer_ch);
+
 		free(in6m, M_IPMADDR);
 	}
 	splx(s);



CVS commit: src/sys/dev

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 18:23:57 UTC 2014

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

Log Message:
use disk_ioctl to provide DIOCGDISKINFO.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/cgd.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.91 src/sys/dev/cgd.c:1.92
--- src/sys/dev/cgd.c:1.91	Thu Oct  2 21:01:38 2014
+++ src/sys/dev/cgd.c	Mon Dec 29 18:23:57 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.91 2014/10/02 21:01:38 justin Exp $ */
+/* $NetBSD: cgd.c,v 1.92 2014/12/29 18:23:57 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cgd.c,v 1.91 2014/10/02 21:01:38 justin Exp $);
+__KERNEL_RCSID(0, $NetBSD: cgd.c,v 1.92 2014/12/29 18:23:57 mlelstv Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -548,6 +548,7 @@ cgdioctl(dev_t dev, u_long cmd, void *da
 	struct	dk_softc *dksc;
 	int	part = DISKPART(dev);
 	int	pmask = 1  part;
+	int	error;
 
 	DPRINTF_FOLLOW((cgdioctl(0x%PRIx64, %ld, %p, %d, %p)\n,
 	dev, cmd, data, flag, l));
@@ -568,6 +569,10 @@ cgdioctl(dev_t dev, u_long cmd, void *da
 		break;
 	}
 
+	error = disk_ioctl(dksc-sc_dkdev, cmd, data, flag, l);
+	if (error != EPASSTHROUGH)
+		return (error);
+
 	switch (cmd) {
 	case CGDIOCSET:
 		if (dksc-sc_flags  DKF_INITED)



CVS commit: [netbsd-7] src/doc

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 18:26:26 UTC 2014

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

Log Message:
Tickets 207, 345, 352, 353, 354, 355, 358, 359, 360


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.141 -r1.1.2.142 src/doc/CHANGES-7.0

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

Modified files:

Index: src/doc/CHANGES-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.141 src/doc/CHANGES-7.0:1.1.2.142
--- src/doc/CHANGES-7.0:1.1.2.141	Wed Dec 24 00:07:46 2014
+++ src/doc/CHANGES-7.0	Mon Dec 29 18:26:25 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.141 2014/12/24 00:07:46 riz Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.142 2014/12/29 18:26:25 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -6715,3 +6715,137 @@ external/bsd/ntp/scripts/mkver	patch
 	Update ntp to version 4.2.8.
 	[christos, ticket #351]
 
+external/bsd/dhcpcd/dist/arp.c			(patch)
+external/bsd/dhcpcd/dist/arp.h			(patch)
+external/bsd/dhcpcd/dist/auth.c			(patch)
+external/bsd/dhcpcd/dist/auth.h			(patch)
+external/bsd/dhcpcd/dist/bpf-filter.h		(patch)
+external/bsd/dhcpcd/dist/common.c		(patch)
+external/bsd/dhcpcd/dist/common.h		(patch)
+external/bsd/dhcpcd/dist/config.h		(patch)
+external/bsd/dhcpcd/dist/control.c		(patch)
+external/bsd/dhcpcd/dist/control.h		(patch)
+external/bsd/dhcpcd/dist/defs.h			(patch)
+external/bsd/dhcpcd/dist/dev.h			(patch)
+external/bsd/dhcpcd/dist/dhcp-common.c		(patch)
+external/bsd/dhcpcd/dist/dhcp-common.h		(patch)
+external/bsd/dhcpcd/dist/dhcp.c			(patch)
+external/bsd/dhcpcd/dist/dhcp.h			(patch)
+external/bsd/dhcpcd/dist/dhcp6.c		(patch)
+external/bsd/dhcpcd/dist/dhcp6.h		(patch)
+external/bsd/dhcpcd/dist/dhcpcd-definitions.conf	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-embedded.c	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-embedded.h	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in	(patch)
+external/bsd/dhcpcd/dist/dhcpcd.8.in		(patch)
+external/bsd/dhcpcd/dist/dhcpcd.c		(patch)
+external/bsd/dhcpcd/dist/dhcpcd.conf		(patch)
+external/bsd/dhcpcd/dist/dhcpcd.conf.5.in	(patch)
+external/bsd/dhcpcd/dist/dhcpcd.h		(patch)
+external/bsd/dhcpcd/dist/duid.c			(patch)
+external/bsd/dhcpcd/dist/duid.h			(patch)
+external/bsd/dhcpcd/dist/eloop.c		(patch)
+external/bsd/dhcpcd/dist/eloop.h		(patch)
+external/bsd/dhcpcd/dist/if-bsd.c		(patch)
+external/bsd/dhcpcd/dist/if-options.c		(patch)
+external/bsd/dhcpcd/dist/if-options.h		(patch)
+external/bsd/dhcpcd/dist/if.c			(patch)
+external/bsd/dhcpcd/dist/if.h			(patch)
+external/bsd/dhcpcd/dist/ipv4.c			(patch)
+external/bsd/dhcpcd/dist/ipv4.h			(patch)
+external/bsd/dhcpcd/dist/ipv4ll.c		(patch)
+external/bsd/dhcpcd/dist/ipv4ll.h		(patch)
+external/bsd/dhcpcd/dist/ipv6.c			(patch)
+external/bsd/dhcpcd/dist/ipv6.h			(patch)
+external/bsd/dhcpcd/dist/ipv6nd.c		(patch)
+external/bsd/dhcpcd/dist/ipv6nd.h		(patch)
+external/bsd/dhcpcd/dist/script.c		(patch)
+external/bsd/dhcpcd/dist/script.h		(patch)
+external/bsd/dhcpcd/dist/crypt/crypt.h		(patch)
+external/bsd/dhcpcd/dist/crypt/hmac_md5.c	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/02-dump	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/10-wpa_supplicant	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/15-timezone	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf	(patch)
+external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind	(patch)
+
+	Import dhcpcd-6.6.7 (changes too numerous to list here).
+	[roy, ticket #207]
+
+sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c 1.14
+sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c 1.10
+
+	Enable state/stats information on vchiq device read.
+	Allow more space for temp string buffer in service stats display.
+	Fixes corrupted display when rx and tx count become large.
+	[nat, ticket #345]
+
+sys/ufs/ffs/ffs_vfsops.c			1.301
+
+	Limit the superblock size to SBLOCKSIZE, not MAXBSIZE. Otherwise
+	memcpy will read beyond the allocated buffer.
+	[maxv, ticket #352]
+
+sys/compat/common/vfs_syscalls_30.c		1.35
+sys/compat/linux/common/linux_uselib.c		1.31-1.32
+sys/ufs/chfs/chfs_vfsops.c			1.12
+
+	Resource/Memory leaks.
+	Reject non-regular files.
+	[maxv, ticket #353]
+
+sys/dev/pci/if_vioif.c1.14
+
+	Reuse mbuf when retrying in vioif_start
+	Otherwise, the old mbuf will leak.
+	[ozaki-r, ticket #354]
+
+etc/rc.d/ntpd	1.15
+
+	New ntpd wants to be able to translate ntp into a port number
+	after chroot, so give it its own small copy of /etc/services in
+	the chroot
+	[mlelstv, ticket #355]
+

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

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 18:36:27 UTC 2014

Modified Files:
src/tests/lib/libc/gen: t_siginfo.c

Log Message:
Include ieeefp.h even for the fenv.h case since we use fpsetmask()
to detect ARM Cortex NEON fpus.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libc/gen/t_siginfo.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.26 src/tests/lib/libc/gen/t_siginfo.c:1.27
--- src/tests/lib/libc/gen/t_siginfo.c:1.26	Wed Nov 19 10:09:45 2014
+++ src/tests/lib/libc/gen/t_siginfo.c	Mon Dec 29 18:36:27 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.26 2014/11/19 10:09:45 martin Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.27 2014/12/29 18:36:27 martin Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -46,6 +46,7 @@
 
 #ifdef HAVE_FENV
 #include fenv.h
+#include ieeefp.h	/* only need for ARM Cortex/Neon hack */
 #elif defined(_FLOAT_IEEE754)
 #include ieeefp.h
 #endif



CVS commit: src

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 18:41:20 UTC 2014

Modified Files:
src/share/man/man9: disk.9
src/sys/dev: dksubr.c
src/sys/kern: subr_disk.c
src/sys/sys: dkio.h

Log Message:
Implement DIOCGMEDIASIZE and DIOCGSECTORSIZE from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/share/man/man9/disk.9
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/dksubr.c
cvs rdiff -u -r1.103 -r1.104 src/sys/kern/subr_disk.c
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/dkio.h

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

Modified files:

Index: src/share/man/man9/disk.9
diff -u src/share/man/man9/disk.9:1.36 src/share/man/man9/disk.9:1.37
--- src/share/man/man9/disk.9:1.36	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/disk.9	Mon Dec 29 18:41:20 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: disk.9,v 1.36 2010/12/02 12:54:13 wiz Exp $
+.\	$NetBSD: disk.9,v 1.37 2014/12/29 18:41:20 mlelstv Exp $
 .\
 .\ Copyright (c) 1995, 1996 Jason R. Thorpe.
 .\ All rights reserved.
@@ -299,6 +299,10 @@ Get disk buffer queue strategy.
 Set disk buffer queue strategy.
 .It Dv DIOCGDISKINFO struct plistref
 Get disk-info dictionary.
+.It Dv DIOCGMEDIASIZE off_t
+Get disk size in bytes.
+.It Dv DIOCGSECTORSIZE u_int
+Get sector size in bytes.
 .El
 .Sh USING THE FRAMEWORK
 This section includes a description on basic use of the framework

Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.55 src/sys/dev/dksubr.c:1.56
--- src/sys/dev/dksubr.c:1.55	Mon Dec 29 12:03:39 2014
+++ src/sys/dev/dksubr.c	Mon Dec 29 18:41:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.55 2014/12/29 12:03:39 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.56 2014/12/29 18:41:20 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dksubr.c,v 1.55 2014/12/29 12:03:39 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: dksubr.c,v 1.56 2014/12/29 18:41:20 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -311,10 +311,6 @@ dk_ioctl(struct dk_intf *di, struct dk_s
 
 	/* ensure that the pseudo-disk is initialized for these */
 	switch (cmd) {
-#ifdef DIOCGSECTORSIZE
-	case DIOCGSECTORSIZE:
-	case DIOCGMEDIASIZE:
-#endif
 	case DIOCGDINFO:
 	case DIOCSDINFO:
 	case DIOCWDINFO:
@@ -337,17 +333,6 @@ dk_ioctl(struct dk_intf *di, struct dk_s
 	}
 
 	switch (cmd) {
-#ifdef DIOCGSECTORSIZE
-	case DIOCGSECTORSIZE:
-		*(u_int *)data = dksc-sc_dkdev.dk_geom.dg_secsize;
-		return 0;
-	case DIOCGMEDIASIZE:
-		*(off_t *)data =
-		(off_t)dksc-sc_dkdev.dk_geom.dg_secsize *
-		dksc-sc_dkdev.dk_geom.dg_nsectors;
-		return 0;
-#endif
-
 	case DIOCGDINFO:
 		*(struct disklabel *)data = *(dksc-sc_dkdev.dk_label);
 		break;

Index: src/sys/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.103 src/sys/kern/subr_disk.c:1.104
--- src/sys/kern/subr_disk.c:1.103	Sat Oct 19 22:36:57 2013
+++ src/sys/kern/subr_disk.c	Mon Dec 29 18:41:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk.c,v 1.103 2013/10/19 22:36:57 mlelstv Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.104 2014/12/29 18:41:20 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_disk.c,v 1.103 2013/10/19 22:36:57 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_disk.c,v 1.104 2014/12/29 18:41:20 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -502,6 +502,15 @@ disk_ioctl(struct disk *diskp, u_long cm
 		break;
 	}
 
+	case DIOCGSECTORSIZE:
+		*(u_int *)data = diskp-dk_geom.dg_secsize;
+		break;
+
+	case DIOCGMEDIASIZE:
+		*(off_t *)data = (off_t)diskp-dk_geom.dg_secsize *
+		diskp-dk_geom.dg_secperunit;
+		break;
+
 	default:
 		error = EPASSTHROUGH;
 	}

Index: src/sys/sys/dkio.h
diff -u src/sys/sys/dkio.h:1.20 src/sys/sys/dkio.h:1.21
--- src/sys/sys/dkio.h:1.20	Tue Nov  4 07:41:37 2014
+++ src/sys/sys/dkio.h	Mon Dec 29 18:41:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkio.h,v 1.20 2014/11/04 07:41:37 mlelstv Exp $	*/
+/*	$NetBSD: dkio.h,v 1.21 2014/12/29 18:41:20 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -115,4 +115,8 @@
 		/* trigger wedge auto discover */
 #define	DIOCMWEDGES	_IOR('d', 131, int)	/* make wedges */
 
+		/* query disk geometry */
+#define	DIOCGSECTORSIZE	_IOR('d', 133, u_int)	/* sector size in bytes */
+#define	DIOCGMEDIASIZE	_IOR('d', 132, off_t)	/* media size in bytes */
+
 #endif /* _SYS_DKIO_H_ */



CVS commit: src/sys/kern

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 18:54:19 UTC 2014

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

Log Message:
clear error for new ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/kern/subr_disk.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_disk.c
diff -u src/sys/kern/subr_disk.c:1.104 src/sys/kern/subr_disk.c:1.105
--- src/sys/kern/subr_disk.c:1.104	Mon Dec 29 18:41:20 2014
+++ src/sys/kern/subr_disk.c	Mon Dec 29 18:54:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk.c,v 1.104 2014/12/29 18:41:20 mlelstv Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.105 2014/12/29 18:54:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_disk.c,v 1.104 2014/12/29 18:41:20 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_disk.c,v 1.105 2014/12/29 18:54:19 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -487,7 +487,7 @@ int
 disk_ioctl(struct disk *diskp, u_long cmd, void *data, int flag,
 	   struct lwp *l)
 {
-	int error;
+	int error = 0;
 
 	switch (cmd) {
 	case DIOCGDISKINFO:



CVS commit: src/share/man/man9

2014-12-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 29 19:07:03 UTC 2014

Modified Files:
src/share/man/man9: disk.9

Log Message:
document missing disk_set_info function that maintains the device's
disk-info dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/share/man/man9/disk.9

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

Modified files:

Index: src/share/man/man9/disk.9
diff -u src/share/man/man9/disk.9:1.37 src/share/man/man9/disk.9:1.38
--- src/share/man/man9/disk.9:1.37	Mon Dec 29 18:41:20 2014
+++ src/share/man/man9/disk.9	Mon Dec 29 19:07:03 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: disk.9,v 1.37 2014/12/29 18:41:20 mlelstv Exp $
+.\	$NetBSD: disk.9,v 1.38 2014/12/29 19:07:03 mlelstv Exp $
 .\
 .\ Copyright (c) 1995, 1996 Jason R. Thorpe.
 .\ All rights reserved.
@@ -44,7 +44,8 @@
 .Nm disk_unbusy ,
 .Nm disk_isbusy ,
 .Nm disk_find ,
-.Nm disk_blocksize
+.Nm disk_blocksize ,
+.Nm disk_set_info
 .Nd generic disk framework
 .Sh SYNOPSIS
 .In sys/types.h
@@ -70,6 +71,8 @@
 .Fn disk_find const char *
 .Ft void
 .Fn disk_blocksize struct disk * int blocksize
+.Ft void
+.Fn disk_set_info device_t struct disk * const char *type
 .Sh DESCRIPTION
 The
 .Nx
@@ -203,6 +206,13 @@ with suitable values derived from the su
 It is only necessary to call this function if the device's physical blocksize
 is not
 .Dv DEV_BSIZE .
+.It Fn disk_set_info
+Setup disk-info dictionary, the driver must have initialized the
+dk_geom member of
+.Fa struct disk
+with suitable values. If
+.Fa type
+is not NULL, it will be added to the dictionary.
 .El
 .Pp
 The functions typically called by device drivers are
@@ -358,6 +368,10 @@ fooattach(device_t parent, device_t self
 	/* Read geometry and fill in pertinent parts of disklabel. */
 	[ . . . ]
 	disk_blocksize(\*[Am]sc-\*[Gt]sc_dk, bytes_per_sector);
+
+	/* Initialize geometry values of the disk structure */
+	[ . . . ]
+	disk_set_info(\*[Am]self\*[Gt], \*[Am]sc-\*[Gt]sc_dk, type);
 }
 .Ed
 .Pp



CVS commit: src/lib/libm/arch/arm

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 19:11:13 UTC 2014

Modified Files:
src/lib/libm/arch/arm: fenv.c

Log Message:
Fix exception status vs mask confusion, of course feenableexcept(),
fedisableexcept() and fegetexcept() all operate on the mask.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/arch/arm/fenv.c

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

Modified files:

Index: src/lib/libm/arch/arm/fenv.c
diff -u src/lib/libm/arch/arm/fenv.c:1.5 src/lib/libm/arch/arm/fenv.c:1.6
--- src/lib/libm/arch/arm/fenv.c:1.5	Sun Dec 28 10:15:29 2014
+++ src/lib/libm/arch/arm/fenv.c	Mon Dec 29 19:11:13 2014
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: fenv.c,v 1.5 2014/12/28 10:15:29 martin Exp $);
+__RCSID($NetBSD: fenv.c,v 1.6 2014/12/29 19:11:13 martin Exp $);
 
 #include sys/types.h
 #include assert.h
@@ -160,13 +160,13 @@ feenableexcept(int excepts)
 	_DIAGASSERT((except  ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
-	int old = fpgetsticky();
-	fpsetsticky(old | excepts);
+	int old = fpgetmask();
+	fpsetmask(old | excepts);
 	return old;
 #else
 	int fpscr = armreg_fpscr_read();
-	armreg_fpscr_write(fpscr | __SHIFTIN((excepts), VFP_FPSCR_CSUM));
-	return __SHIFTOUT(fpscr, VFP_FPSCR_CSUM)  FE_ALL_EXCEPT;
+	armreg_fpscr_write(fpscr | __SHIFTIN((excepts), VFP_FPSCR_ESUM));
+	return __SHIFTOUT(fpscr, VFP_FPSCR_ESUM)  FE_ALL_EXCEPT;
 #endif
 }
 
@@ -177,13 +177,13 @@ fedisableexcept(int excepts)
 	_DIAGASSERT((except  ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
-	int old = fpgetsticky();
-	fpsetsticky(old  ~excepts);
+	int old = fpgetmask();
+	fpsetmask(old  ~excepts);
 	return old;
 #else
 	int fpscr = armreg_fpscr_read();
-	armreg_fpscr_write(fpscr  ~__SHIFTIN((excepts), VFP_FPSCR_CSUM));
-	return __SHIFTOUT(fpscr, VFP_FPSCR_CSUM)  FE_ALL_EXCEPT;
+	armreg_fpscr_write(fpscr  ~__SHIFTIN((excepts), VFP_FPSCR_ESUM));
+	return __SHIFTOUT(fpscr, VFP_FPSCR_ESUM)  FE_ALL_EXCEPT;
 #endif
 }
 
@@ -206,7 +206,11 @@ fetestexcept(int excepts)
 int 
 fegetexcept(void)
 {
-	return fetestexcept(FE_ALL_EXCEPT);
+#ifdef __SOFTFP__
+	return fpgetmask();
+#else
+	return __SHIFTOUT(armreg_fpscr_read(), VFP_FPSCR_ESUM);
+#endif
 }
 
 /*



CVS commit: src/share/man/man9

2014-12-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Dec 29 19:20:22 UTC 2014

Modified Files:
src/share/man/man9: disk.9

Log Message:
Use more markup. Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man9/disk.9

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

Modified files:

Index: src/share/man/man9/disk.9
diff -u src/share/man/man9/disk.9:1.38 src/share/man/man9/disk.9:1.39
--- src/share/man/man9/disk.9:1.38	Mon Dec 29 19:07:03 2014
+++ src/share/man/man9/disk.9	Mon Dec 29 19:20:22 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: disk.9,v 1.38 2014/12/29 19:07:03 mlelstv Exp $
+.\	$NetBSD: disk.9,v 1.39 2014/12/29 19:20:22 wiz Exp $
 .\
 .\ Copyright (c) 1995, 1996 Jason R. Thorpe.
 .\ All rights reserved.
@@ -30,7 +30,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd December 30, 2009
+.Dd December 29, 2014
 .Dt DISK 9
 .Os
 .Sh NAME
@@ -194,7 +194,9 @@ Returns
 if disk is marked as busy and false if it is not.
 .It Fn disk_find
 Return a pointer to the disk structure corresponding to the name provided,
-or NULL if the disk does not exist.
+or
+.Dv NULL
+if the disk does not exist.
 .It Fn disk_blocksize
 Initialize
 .Fa dk_blkshift
@@ -210,9 +212,12 @@ is not
 Setup disk-info dictionary, the driver must have initialized the
 dk_geom member of
 .Fa struct disk
-with suitable values. If
+with suitable values.
+If
 .Fa type
-is not NULL, it will be added to the dictionary.
+is not
+.Dv NULL ,
+it will be added to the dictionary.
 .El
 .Pp
 The functions typically called by device drivers are



CVS commit: src/tests/lib/libm

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 19:51:53 UTC 2014

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

Log Message:
Skip rounding mode tests on ARM FPUs that do not allow configuration of them.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libm/t_fenv.c

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

Modified files:

Index: src/tests/lib/libm/t_fenv.c
diff -u src/tests/lib/libm/t_fenv.c:1.1 src/tests/lib/libm/t_fenv.c:1.2
--- src/tests/lib/libm/t_fenv.c:1.1	Sun Dec 21 15:37:03 2014
+++ src/tests/lib/libm/t_fenv.c	Mon Dec 29 19:51:53 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fenv.c,v 1.1 2014/12/21 15:37:03 martin Exp $ */
+/* $NetBSD: t_fenv.c,v 1.2 2014/12/29 19:51:53 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fenv.c,v 1.1 2014/12/21 15:37:03 martin Exp $);
+__RCSID($NetBSD: t_fenv.c,v 1.2 2014/12/29 19:51:53 martin Exp $);
 
 #include atf-c.h
 
@@ -46,13 +46,24 @@ __RCSID($NetBSD: t_fenv.c,v 1.1 2014/12
 	 * skip these tests if running on them and compiled for
 	 * hard float.
 	 */
-#define	FPU_PREREQ()			\
+#define	FPU_EXC_PREREQ()		\
 	if (0 == fpsetmask(fpsetmask(FP_X_INV)))			\
 		atf_tc_skip(FPU does not implement exception handling);
+
+	/*
+	 * Same as above: some don't allow configuring the rounding mode.
+	 */
+#define	FPU_RND_PREREQ()		\
+	if (0 == fpsetround(fpsetround(FP_RZ)))\
+		atf_tc_skip(FPU does not implement configurable 	\
+		rounding modes);
 #endif
 
-#ifndef FPU_PREREQ
-#define	FPU_PREREQ()	/* nothing */
+#ifndef FPU_EXC_PREREQ
+#define	FPU_EXC_PREREQ()	/* nothing */
+#endif
+#ifndef FPU_RND_PREREQ
+#define	FPU_RND_PREREQ()	/* nothing */
 #endif
 
 
@@ -67,6 +78,8 @@ ATF_TC_HEAD(fegetround, tc)
 
 ATF_TC_BODY(fegetround, tc)
 {
+	FPU_RND_PREREQ();
+
 	fpsetround(FP_RZ);
 	ATF_CHECK(fegetround() == FE_TOWARDZERO);
 	fpsetround(FP_RM);
@@ -88,6 +101,8 @@ ATF_TC_HEAD(fesetround, tc)
 
 ATF_TC_BODY(fesetround, tc)
 {
+	FPU_RND_PREREQ();
+
 	fesetround(FE_TOWARDZERO);
 	ATF_CHECK(fpgetround() == FP_RZ);
 	fesetround(FE_DOWNWARD);
@@ -109,7 +124,7 @@ ATF_TC_HEAD(fegetexcept, tc)
 
 ATF_TC_BODY(fegetexcept, tc)
 {
-	FPU_PREREQ();
+	FPU_EXC_PREREQ();
 
 	fpsetmask(0);
 	ATF_CHECK(fegetexcept() == 0);
@@ -145,7 +160,7 @@ ATF_TC_HEAD(feenableexcept, tc)
 
 ATF_TC_BODY(feenableexcept, tc)
 {
-	FPU_PREREQ();
+	FPU_EXC_PREREQ();
 
 	fedisableexcept(FE_ALL_EXCEPT);
 	ATF_CHECK(fpgetmask() == 0);



CVS commit: src/lib/librumpuser

2014-12-29 Thread Justin Cormack
Module Name:src
Committed By:   justin
Date:   Mon Dec 29 21:50:09 UTC 2014

Modified Files:
src/lib/librumpuser: rumpfiber.c rumpfiber.h rumpfiber_sp.c

Log Message:
Just abort on currently unsupported functions.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/librumpuser/rumpfiber.c
cvs rdiff -u -r1.2 -r1.3 src/lib/librumpuser/rumpfiber.h \
src/lib/librumpuser/rumpfiber_sp.c

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

Modified files:

Index: src/lib/librumpuser/rumpfiber.c
diff -u src/lib/librumpuser/rumpfiber.c:1.8 src/lib/librumpuser/rumpfiber.c:1.9
--- src/lib/librumpuser/rumpfiber.c:1.8	Sat Nov  8 23:47:15 2014
+++ src/lib/librumpuser/rumpfiber.c	Mon Dec 29 21:50:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfiber.c,v 1.8 2014/11/08 23:47:15 justin Exp $	*/
+/*	$NetBSD: rumpfiber.c,v 1.9 2014/12/29 21:50:09 justin Exp $	*/
 
 /*
  * Copyright (c) 2007-2013 Antti Kantee.  All Rights Reserved.
@@ -68,7 +68,7 @@
 #include rumpuser_port.h
 
 #if !defined(lint)
-__RCSID($NetBSD: rumpfiber.c,v 1.8 2014/11/08 23:47:15 justin Exp $);
+__RCSID($NetBSD: rumpfiber.c,v 1.9 2014/12/29 21:50:09 justin Exp $);
 #endif /* !lint */
 
 #include sys/ioctl.h
@@ -108,6 +108,16 @@ static struct thread *current_thread = N
 
 static void (*scheduler_hook)(void *, void *);
 
+static void printk(const char *s);
+
+static void
+printk(const char *msg)
+{
+	int ret __attribute__((unused));
+
+	ret = write(2, msg, strlen(msg));
+}
+
 static struct thread *
 get_current(void)
 {

Index: src/lib/librumpuser/rumpfiber.h
diff -u src/lib/librumpuser/rumpfiber.h:1.2 src/lib/librumpuser/rumpfiber.h:1.3
--- src/lib/librumpuser/rumpfiber.h:1.2	Sun Aug 24 14:37:31 2014
+++ src/lib/librumpuser/rumpfiber.h	Mon Dec 29 21:50:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfiber.h,v 1.2 2014/08/24 14:37:31 pooka Exp $	*/
+/*	$NetBSD: rumpfiber.h,v 1.3 2014/12/29 21:50:09 justin Exp $	*/
 
 /*
  * Copyright (c) 2014 Justin Cormack.  All Rights Reserved.
@@ -33,16 +33,6 @@
 #include ucontext.h
 #include unistd.h
 
-static void printk(const char *s);
-
-static void
-printk(const char *msg)
-{
-	int ret __attribute__((unused));
-
-	ret = write(2, msg, strlen(msg));
-}
-
 struct thread {
 char *name;
 void *lwp;
Index: src/lib/librumpuser/rumpfiber_sp.c
diff -u src/lib/librumpuser/rumpfiber_sp.c:1.2 src/lib/librumpuser/rumpfiber_sp.c:1.3
--- src/lib/librumpuser/rumpfiber_sp.c:1.2	Sun Aug 24 14:37:31 2014
+++ src/lib/librumpuser/rumpfiber_sp.c	Mon Dec 29 21:50:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfiber_sp.c,v 1.2 2014/08/24 14:37:31 pooka Exp $	*/
+/*	$NetBSD: rumpfiber_sp.c,v 1.3 2014/12/29 21:50:09 justin Exp $	*/
 
 /*
  * Copyright (c) 2014 Justin Cormack.  All Rights Reserved.
@@ -30,7 +30,7 @@
 #include rumpuser_port.h
 
 #if !defined(lint)
-__RCSID($NetBSD: rumpfiber_sp.c,v 1.2 2014/08/24 14:37:31 pooka Exp $);
+__RCSID($NetBSD: rumpfiber_sp.c,v 1.3 2014/12/29 21:50:09 justin Exp $);
 #endif /* !lint */
 
 #include stdlib.h
@@ -60,8 +60,7 @@ int
 rumpuser_sp_raise(void *arg, int signo)
 {
 
-	printk(rumphyper: unimplemented rumpuser_sp_raise\n);
-	exit(1);
+	abort();
 }
 
 /*ARGSUSED*/
@@ -69,8 +68,7 @@ int
 rumpuser_sp_copyin(void *arg, const void *raddr, void *laddr, size_t len)
 {
 
-	printk(rumphyper: unimplemented rumpuser_sp_copyin\n);
-	exit(1);
+	abort();
 }
 
 /*ARGSUSED*/
@@ -78,8 +76,7 @@ int
 rumpuser_sp_copyinstr(void *arg, const void *raddr, void *laddr, size_t *len)
 {
 
-	printk(rumphyper: unimplemented rumpuser_sp_copyinstr\n);
-	exit(1);
+	abort();
 }
 
 /*ARGSUSED*/
@@ -87,8 +84,7 @@ int
 rumpuser_sp_copyout(void *arg, const void *laddr, void *raddr, size_t dlen)
 {
 
-	printk(rumphyper: unimplemented rumpuser_sp_copyout\n);
-	exit(1);
+	abort();
 }
 
 /*ARGSUSED*/
@@ -96,8 +92,7 @@ int
 rumpuser_sp_copyoutstr(void *arg, const void *laddr, void *raddr, size_t *dlen)
 {
 
-	printk(rumphyper: unimplemented rumpuser_sp_copyoutstr\n);
-	exit(1);
+	abort();
 }
 
 /*ARGSUSED*/
@@ -105,6 +100,5 @@ int
 rumpuser_sp_anonmmap(void *arg, size_t howmuch, void **addr)
 {
 
-	printk(rumphyper: unimplemented rumpuser_sp_anonmmap\n);
-	exit(1);
+	abort();
 }



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

2014-12-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec 29 22:34:08 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_i2c.c exynos_soc.c

Log Message:
Trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_soc.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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.11 src/sys/arch/arm/samsung/exynos_gpio.c:1.12
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.11	Wed Sep 24 20:35:43 2014
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Mon Dec 29 22:34:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.11 2014/09/24 20:35:43 reinoud Exp $	*/
+/*	$NetBSD: exynos_gpio.c,v 1.12 2014/12/29 22:34:08 skrll Exp $	*/
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include gpio.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exynos_gpio.c,v 1.11 2014/09/24 20:35:43 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: exynos_gpio.c,v 1.12 2014/12/29 22:34:08 skrll Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -244,7 +244,7 @@ static struct exynos_gpio_pin_group exyn
  *
  * MP2_0-MP2_10: 80 DRAM2 ports NOTE: GPIO registers do not control these
  * ports.
- * 
+ *
  * ETC0, ETC5, ETC6, ETC7, ETC8: 22 in/out ETC ports-JTAG, C2C_CLK (Rx),
  * RESET, CLOCK, USBOTG and USB3, C2C_CLK (Tx)
  */
@@ -381,7 +381,7 @@ exynos_gpio_config_pins(device_t self)
 	/* if no pins available, don't proceed */
 	if (pin_count == 0)
 		return;
-	
+
 	/* allocate pin data */
 	pins = kmem_zalloc(sizeof(gpio_pin_t) * pin_count, KM_SLEEP);
 	KASSERT(pins);

Index: src/sys/arch/arm/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.2 src/sys/arch/arm/samsung/exynos_i2c.c:1.3
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.2	Tue Aug 26 11:45:49 2014
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Mon Dec 29 22:34:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.2 2014/08/26 11:45:49 reinoud Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.3 2014/12/29 22:34:08 skrll Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include exynos_iic.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exynos_i2c.c,v 1.2 2014/08/26 11:45:49 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: exynos_i2c.c,v 1.3 2014/12/29 22:34:08 skrll Exp $);
 
 
 #include sys/param.h
@@ -226,7 +226,7 @@ exynos_iic_attach_i2cbus(struct exynos_i
 	i2c_cntr-ic_initiate_xfer = exynos_iic_initiate_xfer;
 	i2c_cntr-ic_read_byte   = exynos_iic_read_byte;
 	i2c_cntr-ic_write_byte  = exynos_iic_write_byte;
-	
+
 	exynos_gpio_pinset_acquire(pinset);
 	if (ei2c_sc-isc_isgpio) {
 		/* get sda and slc pins */
@@ -289,7 +289,7 @@ exynos_iic_bb_set_dir(void *cookie, uint
 
 	flags = GPIO_PIN_INPUT | GPIO_PIN_TRISTATE;
 	i2c_sc-isc_sda_is_output = ((bits  EXYNOS_IIC_BB_SDA_OUT) != 0);
-	if (i2c_sc-isc_sda_is_output) 
+	if (i2c_sc-isc_sda_is_output)
 		flags = GPIO_PIN_OUTPUT | GPIO_PIN_TRISTATE;
 
 	exynos_gpio_pindata_ctl(i2c_sc-isc_sda, flags);
@@ -343,7 +343,7 @@ exynos_iic_send_start(void *cookie, int 
 	return EINVAL;
 }
 
-static int	
+static int
 exynos_iic_send_stop(void *cookie, int flags)
 {
 	struct exynos_iic_dev_softc *i2c_sc = cookie;
@@ -354,7 +354,7 @@ exynos_iic_send_stop(void *cookie, int f
 	return EINVAL;
 }
 
-static int	
+static int
 exynos_iic_initiate_xfer(void *cookie, i2c_addr_t addr, int flags)
 {
 	struct exynos_iic_dev_softc *i2c_sc = cookie;
@@ -378,7 +378,7 @@ exynos_iic_read_byte(void *cookie, uint8
 	return EINVAL;
 }
 
-static int	
+static int
 exynos_iic_write_byte(void *cookie, uint8_t byte, int flags)
 {
 	struct exynos_iic_dev_softc *i2c_sc = cookie;

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.25 src/sys/arch/arm/samsung/exynos_soc.c:1.26
--- src/sys/arch/arm/samsung/exynos_soc.c:1.25	Thu Oct  2 11:27:09 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Mon Dec 29 22:34:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.25 2014/10/02 11:27:09 reinoud Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.26 2014/12/29 22:34:08 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.25 2014/10/02 11:27:09 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.26 2014/12/29 22:34:08 skrll Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -72,7 +72,7 @@ struct cpu_freq {
 	uint64_t freq;
 	int	 P;
 	int	 M;
-	int	 S; 
+	int	 S;
 };
 
 
@@ -895,7 +895,7 @@ exynos5410_usb2phy_enable(bus_space_hand
 	/* host phy reset */
 	phyhost = ~(HOST_CTRL0_PHY_SWRST | HOST_CTRL0_PHY_SWRST_ALL |
 		HOST_CTRL0_SIDDQ | 

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

2014-12-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec 29 22:58:59 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos5_reg.h exynos_soc.c

Log Message:
Fixup USB Phy initialisation for Exynos5410.

odroid-xu now detects USB devices.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/samsung/exynos5_reg.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/exynos_soc.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/samsung/exynos5_reg.h
diff -u src/sys/arch/arm/samsung/exynos5_reg.h:1.19 src/sys/arch/arm/samsung/exynos5_reg.h:1.20
--- src/sys/arch/arm/samsung/exynos5_reg.h:1.19	Thu Oct  2 16:17:33 2014
+++ src/sys/arch/arm/samsung/exynos5_reg.h	Mon Dec 29 22:58:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos5_reg.h,v 1.19 2014/10/02 16:17:33 skrll Exp $	*/
+/*	$NetBSD: exynos5_reg.h,v 1.20 2014/12/29 22:58:59 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -363,41 +363,42 @@
 
 /* used Exynos5 USB PHY registers */
 #define USB_PHY_HOST_CTRL0		0x00
-#define   HOST_CTRL0_PHY_SWRST		__BIT(0)
-#define   HOST_CTRL0_LINK_SWRST		__BIT(1)
-#define   HOST_CTRL0_UTMI_SWRST		__BIT(2)
-#define   HOST_CTRL0_WORDINTERFACE	__BIT(3)
-#define   HOST_CTRL0_FORCESUSPEND	__BIT(4)
-#define   HOST_CTRL0_FORCESLEEP		__BIT(5)
-#define   HOST_CTRL0_SIDDQ		__BIT(6)
-#define   HOST_CTRL0_COMMONON_N		__BIT(9)	/* common block configuration during suspend */
-#define   HOST_CTRL0_TESTBURNIN		__BIT(11)
-#define   HOST_CTRL0_RETENABLE		__BIT(10)
-#define   HOST_CTRL0_FSEL_MASK		__BITS(16, 18)	/* holds FSEL_CLKSEL_ */
-#define   HOST_CTRL0_REFCLKSEL_MASK	__BITS(19, 20)
-#define   HOST_CTRL0_REFCLKSEL_XTAL	__SHIFTIN(HOST_CRTL0_REFCLK_MASK, 0)
-#define   HOST_CTRL0_REFCLKSEL_EXTL	__SHIFTIN(HOST_CRTL0_REFCLK_MASK, 1)
-#define   HOST_CTRL0_REFCLKSEL_CLKCORE	__SHIFTIN(HOST_CRTL0_REFCLK_MASK, 2)
-#define   HOST_CTRL0_PHY_SWRST_ALL	__BIT(31)
+#define  HOST_CTRL0_PHY_SWRST		__BIT(0)
+#define  HOST_CTRL0_LINK_SWRST		__BIT(1)
+#define  HOST_CTRL0_UTMI_SWRST		__BIT(2)
+#define  HOST_CTRL0_WORDINTERFACE	__BIT(3)
+#define  HOST_CTRL0_FORCESUSPEND	__BIT(4)
+#define  HOST_CTRL0_FORCESLEEP		__BIT(5)
+#define  HOST_CTRL0_SIDDQ		__BIT(6)
+#define  HOST_CTRL0_COMMONON_N		__BIT(9)	/* common block configuration during suspend */
+#define  HOST_CTRL0_RETENABLE		__BIT(10)
+#define  HOST_CTRL0_TESTBURNIN		__BIT(11)
+#define  HOST_CTRL0_FSEL_MASK		__BITS(16, 18)	/* holds FSEL_CLKSEL_ */
+#define  HOST_CTRL0_REFCLKSEL_MASK	__BITS(19, 20)
+#define   HOST_CTRL0_REFCLKSEL_XTAL	0
+#define   HOST_CTRL0_REFCLKSEL_EXTL	1
+#define   HOST_CTRL0_REFCLKSEL_CLKCORE	2
+#define  HOST_CTRL0_PHY_SWRST_ALL __BIT(31)
 
 #define USB_PHY_HSIC_CTRL1		0x10
 #define USB_PHY_HSIC_TUNE1		0x14
 #define USB_PHY_HSIC_CTRL2		0x20
 #define USB_PHY_HSIC_TUNE2		0x24
-#define   HSIC_CTRL_PHY_SWRST		__BIT(0)
-#define   HSIC_CTRL_UTMI_SWRST		__BIT(2)
-#define   HSIC_CTRL_WORDINTERFACE	__BIT(3)
-#define   HSIC_CTRL_FORCESUSPEND	__BIT(4)
-#define   HSIC_CTRL_FORCESLEEP		__BIT(5)
-#define   HSIC_CTRL_SIDDQ		__BIT(6)
-#define   HSIC_CTRL_REFCLKDIV_MASK	__BITS(16,22)
-#define  REFCLKDIV_12		__SHIFTIN(HSIC_CTRL_REFCLKDIV_MASK, 0x24)
-#define  REFCLKDIV_15		__SHIFTIN(HSIC_CTRL_REFCLKDIV_MASK, 0x1c)
-#define  REFCLKDIV_16		__SHIFTIN(HSIC_CTRL_REFCLKDIV_MASK, 0x1a)
-#define  REFCLKDIV_19_2		__SHIFTIN(HSIC_CTRL_REFCLKDIV_MASK, 0x15)
-#define  REFCLKDIV_20		__SHIFTIN(HSIC_CTRL_REFCLKDIV_MASK, 0x14)
-#define   HSIC_CTRL_REFCLKSEL_MASK	__BITS(23, 24)
-#define  REFCLKSEL_HSIC_DEFAULT	__SHIFTIN(HSIC_CTRL_REFCLKSEL_MASK, 2)
+
+#define  HSIC_CTRL_PHY_SWRST		__BIT(0)
+#define  HSIC_CTRL_UTMI_SWRST		__BIT(2)
+#define  HSIC_CTRL_WORDINTERFACE	__BIT(3)
+#define  HSIC_CTRL_FORCESUSPEND	__BIT(4)
+#define  HSIC_CTRL_FORCESLEEP		__BIT(5)
+#define  HSIC_CTRL_SIDDQ		__BIT(6)
+#define  HSIC_CTRL_REFCLKDIV_MASK	__BITS(16,22)
+#defineHSIC_CTRL_REFCLKDIV_12		0x24
+#defineHSIC_CTRL_REFCLKDIV_15		0x1c
+#defineHSIC_CTRL_REFCLKDIV_16		0x1a
+#defineHSIC_CTRL_REFCLKDIV_19_2		0x15
+#defineHSIC_CTRL_REFCLKDIV_20		0x14
+#define  HSIC_CTRL_REFCLKSEL_MASK	__BITS(23, 24)
+#defineHSIC_CTRL_REFCLKSEL_DEFAULT	2
 
 #define USB_PHY_HOST_EHCICTRL		0x30
 #define   HOST_EHCICTRL_ENA_INCR16	__BIT(26)

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.26 src/sys/arch/arm/samsung/exynos_soc.c:1.27
--- src/sys/arch/arm/samsung/exynos_soc.c:1.26	Mon Dec 29 22:34:08 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Mon Dec 29 22:58:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.26 2014/12/29 22:34:08 skrll Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.27 2014/12/29 22:58:59 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.26 2014/12/29 

CVS commit: src/sys/dev/ic

2014-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 29 23:58:25 UTC 2014

Modified Files:
src/sys/dev/ic: dwc_mmc.c dwc_mmc_var.h

Log Message:
- Simplify clock setup
- Add DWC_MMC_F_FORCE_CLK flag, which forces updating clock for each
  command (apparently required by Rockchip)
- Let bus glue limit the max clk speed used


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/dwc_mmc.c \
src/sys/dev/ic/dwc_mmc_var.h

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

Modified files:

Index: src/sys/dev/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.2 src/sys/dev/ic/dwc_mmc.c:1.3
--- src/sys/dev/ic/dwc_mmc.c:1.2	Sat Dec 27 19:18:04 2014
+++ src/sys/dev/ic/dwc_mmc.c	Mon Dec 29 23:58:25 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.2 2014/12/27 19:18:04 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.3 2014/12/29 23:58:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_dwc_mmc.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_mmc.c,v 1.2 2014/12/27 19:18:04 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_mmc.c,v 1.3 2014/12/29 23:58:25 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -105,15 +105,19 @@ dwc_mmc_init(struct dwc_mmc_softc *sc)
 	saa.saa_sct = dwc_mmc_chip_functions;
 	saa.saa_sch = sc;
 	saa.saa_clkmin = 400;
-	saa.saa_clkmax = sc-sc_clock_freq / 1000;
+	if (sc-sc_clock_max) {
+		saa.saa_clkmax = sc-sc_clock_max;
+	} else {
+		saa.saa_clkmax = sc-sc_clock_freq / 1000;
+	}
 	saa.saa_caps = SMC_CAPS_4BIT_MODE|
 		   SMC_CAPS_8BIT_MODE|
 		   SMC_CAPS_SD_HIGHSPEED|
 		   SMC_CAPS_MMC_HIGHSPEED|
 		   SMC_CAPS_AUTO_STOP;
-	saa.saa_dmat = sc-sc_dmat;
 
 #if notyet
+	saa.saa_dmat = sc-sc_dmat;
 	saa.saa_caps |= SMC_CAPS_DMA|
 			SMC_CAPS_MULTI_SEG_DMA;
 #endif
@@ -161,25 +165,16 @@ dwc_mmc_intr(void *priv)
 static int
 dwc_mmc_set_clock(struct dwc_mmc_softc *sc, u_int freq)
 {
-	u_int pll_freq = sc-sc_clock_freq / 1000;
-	u_int clk_div, mmc_div;
+	u_int pll_freq, clk_div;
 
-	mmc_div = min(howmany(pll_freq, freq), 0x3c);
-	clk_div = howmany(pll_freq / mmc_div, freq);
-	if (clk_div  1  (clk_div  1) != 0)
+	pll_freq = sc-sc_clock_freq / 1000;
+	clk_div = (pll_freq / freq)  1;
+	if (pll_freq % freq)
 		clk_div++;
 
-#ifdef DWC_MMC_DEBUG
-	device_printf(sc-sc_dev, %s: mmc_div=%u clk_div=%u freq=%u\n,
-	__func__, mmc_div, clk_div, pll_freq / mmc_div / clk_div);
-#endif
-
 	MMC_WRITE(sc, DWC_MMC_CLKDIV_REG,
-	__SHIFTIN(clk_div  1, DWC_MMC_CLKDIV_CLK_DIVIDER0));
-	if (dwc_mmc_update_clock(sc))
-		return ETIMEDOUT;
-
-	return sc-sc_set_clkdiv(sc, mmc_div);
+	__SHIFTIN(clk_div, DWC_MMC_CLKDIV_CLK_DIVIDER0));
+	return dwc_mmc_update_clock(sc);
 }
 
 static int
@@ -389,6 +384,8 @@ dwc_mmc_bus_clock(sdmmc_chipset_handle_t
 
 	delay(1000);
 
+	sc-sc_cur_freq = freq;
+
 	return 0;
 }
 
@@ -435,6 +432,12 @@ dwc_mmc_exec_command(sdmmc_chipset_handl
 	cmd-c_opcode, cmd-c_flags);
 #endif
 
+	if (sc-sc_flags  DWC_MMC_F_FORCE_CLK) {
+		cmd-c_error = dwc_mmc_bus_clock(sc, sc-sc_cur_freq);
+		if (cmd-c_error)
+			return;
+	}
+
 	if (sc-sc_flags  DWC_MMC_F_USE_HOLD_REG)
 		cmdval |= DWC_MMC_CMD_USE_HOLD_REG;
 
Index: src/sys/dev/ic/dwc_mmc_var.h
diff -u src/sys/dev/ic/dwc_mmc_var.h:1.2 src/sys/dev/ic/dwc_mmc_var.h:1.3
--- src/sys/dev/ic/dwc_mmc_var.h:1.2	Sat Dec 27 19:18:04 2014
+++ src/sys/dev/ic/dwc_mmc_var.h	Mon Dec 29 23:58:25 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_var.h,v 1.2 2014/12/27 19:18:04 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_var.h,v 1.3 2014/12/29 23:58:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -36,10 +36,12 @@ struct dwc_mmc_softc {
 	bus_dma_tag_t		sc_dmat;
 	void			*sc_ih;
 	unsigned int		sc_clock_freq;
+	unsigned int		sc_bus_freq;
 	unsigned int		sc_fifo_depth;
 	uint32_t		sc_flags;
 #define DWC_MMC_F_USE_HOLD_REG	0x0001	/* set USE_HOLD_REG with every cmd */
 #define DWC_MMC_F_PWREN_CLEAR	0x0002	/* clear POWER_ENABLE bit to enable */
+#define DWC_MMC_F_FORCE_CLK	0x0004	/* update clk div with every cmd */
 	int			(*sc_set_clkdiv)(struct dwc_mmc_softc *, int);
 
 	device_t		sc_sdmmc_dev;
@@ -47,6 +49,7 @@ struct dwc_mmc_softc {
 	kcondvar_t		sc_intr_cv;
 
 	uint32_t		sc_intr_rint;
+	u_int			sc_cur_freq;
 };
 
 void	dwc_mmc_init(struct dwc_mmc_softc *);



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

2014-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 29 23:59:52 UTC 2014

Modified Files:
src/sys/arch/arm/rockchip: rockchip_dwcmmc.c

Log Message:
- Set DWC_MMC_F_FORCE_CLK
- Force max sdmmc clk to 24MHz
- Update for simpler dwcmmc clock setup


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rockchip_dwcmmc.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/rockchip/rockchip_dwcmmc.c
diff -u src/sys/arch/arm/rockchip/rockchip_dwcmmc.c:1.3 src/sys/arch/arm/rockchip/rockchip_dwcmmc.c:1.4
--- src/sys/arch/arm/rockchip/rockchip_dwcmmc.c:1.3	Sun Dec 28 16:27:14 2014
+++ src/sys/arch/arm/rockchip/rockchip_dwcmmc.c	Mon Dec 29 23:59:52 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: rockchip_dwcmmc.c,v 1.3 2014/12/28 16:27:14 jmcneill Exp $ */
+/* $NetBSD: rockchip_dwcmmc.c,v 1.4 2014/12/29 23:59:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rockchip_dwcmmc.c,v 1.3 2014/12/28 16:27:14 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: rockchip_dwcmmc.c,v 1.4 2014/12/29 23:59:52 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -48,8 +48,6 @@ static void	rk_dwcmmc_attach(device_t, d
 
 static void	rk_dwcmmc_attach_i(device_t);
 
-static int	rk_dwcmmc_set_clkdiv(struct dwc_mmc_softc *, int);
-
 CFATTACH_DECL_NEW(rkdwcmmc, sizeof(struct dwc_mmc_softc),
 	rk_dwcmmc_match, rk_dwcmmc_attach, NULL, NULL);
 
@@ -65,13 +63,16 @@ rk_dwcmmc_attach(device_t parent, device
 	struct dwc_mmc_softc *sc = device_private(self);
 	struct obio_attach_args * const obio = aux;
 
+	rockchip_mmc0_set_div(1);
+
 	sc-sc_dev = self;
 	sc-sc_bst = obio-obio_bst;
 	sc-sc_dmat = obio-obio_dmat;
-	sc-sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_PWREN_CLEAR;
-	sc-sc_clock_freq = rockchip_ahb_get_rate();
-	sc-sc_fifo_depth = 256;
-	sc-sc_set_clkdiv = rk_dwcmmc_set_clkdiv;
+	sc-sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_PWREN_CLEAR |
+		   DWC_MMC_F_FORCE_CLK;
+	sc-sc_clock_freq = rockchip_mmc0_get_rate();
+	sc-sc_clock_max = 24000;
+	sc-sc_fifo_depth = 32;
 
 	bus_space_subregion(obio-obio_bst, obio-obio_bsh, obio-obio_offset,
 	obio-obio_size, sc-sc_bsh);
@@ -97,9 +98,3 @@ rk_dwcmmc_attach_i(device_t self)
 
 	dwc_mmc_init(sc);
 }
-
-static int
-rk_dwcmmc_set_clkdiv(struct dwc_mmc_softc *sc, int div)
-{
-	return rockchip_mmc0_set_div(div);
-}



CVS commit: src/sys/dev/ic

2014-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 30 00:19:50 UTC 2014

Modified Files:
src/sys/dev/ic: dwc_mmc_var.h

Log Message:
build fix


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

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

Modified files:

Index: src/sys/dev/ic/dwc_mmc_var.h
diff -u src/sys/dev/ic/dwc_mmc_var.h:1.3 src/sys/dev/ic/dwc_mmc_var.h:1.4
--- src/sys/dev/ic/dwc_mmc_var.h:1.3	Mon Dec 29 23:58:25 2014
+++ src/sys/dev/ic/dwc_mmc_var.h	Tue Dec 30 00:19:50 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_var.h,v 1.3 2014/12/29 23:58:25 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_var.h,v 1.4 2014/12/30 00:19:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -36,7 +36,7 @@ struct dwc_mmc_softc {
 	bus_dma_tag_t		sc_dmat;
 	void			*sc_ih;
 	unsigned int		sc_clock_freq;
-	unsigned int		sc_bus_freq;
+	unsigned int		sc_clock_max;
 	unsigned int		sc_fifo_depth;
 	uint32_t		sc_flags;
 #define DWC_MMC_F_USE_HOLD_REG	0x0001	/* set USE_HOLD_REG with every cmd */



CVS commit: src/usr.bin/audio/common

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 01:22:09 UTC 2014

Modified Files:
src/usr.bin/audio/common: audio.c libaudio.h

Log Message:
add a decode_uint() function.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/audio/common/audio.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/audio/common/libaudio.h

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

Modified files:

Index: src/usr.bin/audio/common/audio.c
diff -u src/usr.bin/audio/common/audio.c:1.22 src/usr.bin/audio/common/audio.c:1.23
--- src/usr.bin/audio/common/audio.c:1.22	Fri Aug 30 20:57:26 2013
+++ src/usr.bin/audio/common/audio.c	Tue Dec 30 01:22:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.22 2013/08/30 20:57:26 mrg Exp $	*/
+/*	$NetBSD: audio.c,v 1.23 2014/12/30 01:22:09 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -32,7 +32,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: audio.c,v 1.22 2013/08/30 20:57:26 mrg Exp $);
+__RCSID($NetBSD: audio.c,v 1.23 2014/12/30 01:22:09 mrg Exp $);
 #endif
 
 
@@ -155,6 +155,21 @@ decode_int(const char *arg, int *intp)
 }
 
 void
+decode_uint(const char *arg, unsigned *intp)
+{
+	char	*ep;
+	unsigned	ret;
+
+	ret = (unsigned)strtoul(arg, ep, 10);
+
+	if (ep[0] == '\0') {
+		*intp = ret;
+		return;
+	}
+	errx(1, argument `%s' not a valid integer, arg);
+}
+
+void
 decode_time(const char *arg, struct timeval *tvp)
 {
 	char	*s, *colon, *dot;

Index: src/usr.bin/audio/common/libaudio.h
diff -u src/usr.bin/audio/common/libaudio.h:1.18 src/usr.bin/audio/common/libaudio.h:1.19
--- src/usr.bin/audio/common/libaudio.h:1.18	Fri Aug 30 20:57:26 2013
+++ src/usr.bin/audio/common/libaudio.h	Tue Dec 30 01:22:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libaudio.h,v 1.18 2013/08/30 20:57:26 mrg Exp $	*/
+/*	$NetBSD: libaudio.h,v 1.19 2014/12/30 01:22:09 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2009 Matthew R. Green
@@ -180,6 +180,7 @@ const char *audio_errstring (int);
  * generic routines?
  */
 void	decode_int (const char *, int *);
+void	decode_uint (const char *, unsigned *);
 void	decode_time (const char *, struct timeval *);
 void	decode_encoding (const char *, int *);
 



CVS commit: src/sys/dev

2014-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 30 02:21:10 UTC 2014

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

Log Message:
call disk_ioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/ccd.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/ccd.c
diff -u src/sys/dev/ccd.c:1.154 src/sys/dev/ccd.c:1.155
--- src/sys/dev/ccd.c:1.154	Sat Oct 11 08:36:25 2014
+++ src/sys/dev/ccd.c	Mon Dec 29 21:21:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd.c,v 1.154 2014/10/11 12:36:25 mlelstv Exp $	*/
+/*	$NetBSD: ccd.c,v 1.155 2014/12/30 02:21:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ccd.c,v 1.154 2014/10/11 12:36:25 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: ccd.c,v 1.155 2014/12/30 02:21:10 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -1154,6 +1154,10 @@ ccdioctl(dev_t dev, u_long cmd, void *da
 		}
 	}
 
+	error = disk_ioctl(cs-sc_dkdev, cmd, data, flag, l); 
+	if (error != EPASSTHROUGH)
+		goto out;
+
 	switch (cmd) {
 	case CCDIOCSET:
 		if (cs-sc_flags  CCDF_INITED) {



CVS commit: src/etc/mtree

2014-12-29 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Dec 30 03:52:03 UTC 2014

Modified Files:
src/etc/mtree: special

Log Message:
Add entries, sort, etc.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/etc/mtree/special

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

Modified files:

Index: src/etc/mtree/special
diff -u src/etc/mtree/special:1.149 src/etc/mtree/special:1.150
--- src/etc/mtree/special:1.149	Sat Sep 20 15:10:41 2014
+++ src/etc/mtree/special	Tue Dec 30 03:52:03 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: special,v 1.149 2014/09/20 15:10:41 roy Exp $
+#	$NetBSD: special,v 1.150 2014/12/30 03:52:03 uebayasi Exp $
 #	@(#)special	8.2 (Berkeley) 1/23/94
 #
 # This file may be overwritten on upgrades.
@@ -75,7 +75,7 @@
 ./etc/ftpwelcome		type=file mode=0644 optional
 ./etc/gateways			type=file mode=0644 optional
 ./etc/gettytab			type=file mode=0644
-./etc/gpio.conf			type=file mode=644
+./etc/gpio.conf			type=file mode=0644
 ./etc/group			type=file mode=0644
 ./etc/hesiod.conf		type=file mode=0644 optional
 ./etc/hosts			type=file mode=0644
@@ -173,6 +173,9 @@
 ./etc/printcap			type=file mode=0644
 ./etc/profile			type=file mode=0644
 ./etc/protocols			type=file mode=0644
+./etc/racoon			type=dir  mode=0755 optional
+./etc/racoon/racoon.conf	type=file mode=0644 optional
+./etc/racoon/psk.txt		type=file mode=0600 optional tags=nodiff
 ./etc/rbootd.conf		type=file mode=0644 optional
 ./etc/rc			type=file mode=0644
 ./etc/rc.conf			type=file mode=0644
@@ -195,6 +198,7 @@
 ./etc/rc.d/cron			type=file mode=0555
 ./etc/rc.d/devpubd		type=file mode=0555
 ./etc/rc.d/dhclient		type=file mode=0555
+./etc/rc.d/dhcpcd		type=file mode=0555
 ./etc/rc.d/dhcpd		type=file mode=0555
 ./etc/rc.d/dhcrelay		type=file mode=0555
 ./etc/rc.d/dmesg		type=file mode=0555
@@ -225,6 +229,8 @@
 ./etc/rc.d/local		type=file mode=0555
 ./etc/rc.d/lpd			type=file mode=0555
 ./etc/rc.d/lvm			type=file mode=0555
+./etc/rc.d/makemandb		type=file mode=0555
+./etc/rc.d/mdnsd		type=file mode=0555
 ./etc/rc.d/mixerctl		type=file mode=0555
 ./etc/rc.d/mopd			type=file mode=0555
 ./etc/rc.d/motd			type=file mode=0555
@@ -264,6 +270,11 @@
 ./etc/rc.d/routed		type=file mode=0555
 ./etc/rc.d/rpcbind		type=file mode=0555
 ./etc/rc.d/rtadvd		type=file mode=0555
+./etc/saslc.d			type=dir  mode=0755
+./etc/saslc.d/postfix		type=dir  mode=0755
+./etc/saslc.d/postfix/mech	type=dir  mode=0755
+./etc/saslc.d/saslc		type=dir  mode=0755
+./etc/saslc.d/saslc/mech	type=dir  mode=0755
 ./etc/rc.d/rtclocaltime		type=file mode=0555
 ./etc/rc.d/rwho			type=file mode=0555
 ./etc/rc.d/savecore		type=file mode=0555
@@ -328,10 +339,7 @@
 ./etc/weekly.conf		type=file mode=0644
 ./etc/weekly.local		type=file mode=0644 optional
 ./etc/wscons.conf		type=file mode=0644
-
-./etc/racoon			type=dir  mode=0755 optional
-./etc/racoon/racoon.conf	type=file mode=0644 optional
-./etc/racoon/psk.txt		type=file mode=0600 optional tags=nodiff
+./etc/zfs			type=dir  mode=0755
 
 ./private			type=dir mode=0755 optional
 ./private/tmp			type=dir mode=0111 optional ignore



CVS commit: src/sys/arch

2014-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 30 03:53:52 UTC 2014

Modified Files:
src/sys/arch/arm/rockchip: rockchip_board.c rockchip_crureg.h
rockchip_var.h
src/sys/arch/evbarm/rockchip: rockchip_machdep.c

Log Message:
Add support for setting RK3188/RK3188+ CPU frequency. If the SoC ID is
passed in bootargs matching RK3188 or RK3188+, and the cpu.frequency
option specifies a supported rate (currently 600, 1008, 1608 MHz), the
APLL clock will be adjusted accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rockchip_board.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rockchip_crureg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rockchip_var.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/rockchip/rockchip_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/arm/rockchip/rockchip_board.c
diff -u src/sys/arch/arm/rockchip/rockchip_board.c:1.5 src/sys/arch/arm/rockchip/rockchip_board.c:1.6
--- src/sys/arch/arm/rockchip/rockchip_board.c:1.5	Sat Dec 27 19:14:05 2014
+++ src/sys/arch/arm/rockchip/rockchip_board.c	Tue Dec 30 03:53:52 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: rockchip_board.c,v 1.5 2014/12/27 19:14:05 jmcneill Exp $ */
+/* $NetBSD: rockchip_board.c,v 1.6 2014/12/30 03:53:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -29,13 +29,15 @@
 #include opt_rockchip.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rockchip_board.c,v 1.5 2014/12/27 19:14:05 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: rockchip_board.c,v 1.6 2014/12/30 03:53:52 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
 #include sys/cpu.h
 #include sys/device.h
 
+#include arm/bootconfig.h
+
 #include arm/rockchip/rockchip_reg.h
 #include arm/rockchip/rockchip_crureg.h
 #include arm/rockchip/rockchip_var.h
@@ -59,6 +61,20 @@ rockchip_bootstrap(void)
 		panic(%s: failed to map CORE1 registers: %d, __func__, error);
 }
 
+bool
+rockchip_is_chip(const char *chipver)
+{
+	const size_t chipver_len = 16;
+	char *env_chipver;
+
+	if (get_bootconf_option(boot_args, chipver,
+BOOTOPT_TYPE_STRING, env_chipver) == 0) {
+		return false;
+	}
+
+	return strncmp(env_chipver, chipver, chipver_len) == 0;
+}
+
 static void
 rockchip_get_cru_bsh(bus_space_handle_t *pbsh)
 {
@@ -104,6 +120,177 @@ rockchip_apll_get_rate(void)
 	return rockchip_pll_get_rate(CRU_APLL_CON0_REG, CRU_APLL_CON1_REG);
 }
 
+static u_int
+rk3188_apll_set_rate(u_int rate)
+{
+	bus_space_tag_t bst = rockchip_bs_tag;
+	bus_space_handle_t bsh;
+	uint32_t apll_con0, apll_con1, clksel0_con, clksel1_con;
+	u_int no, nr, nf, core_div, core_periph_div, core_axi_div,
+	  aclk_div, hclk_div, pclk_div, ahb2apb_div;
+	u_int cpu_aclk_div_con;
+
+	rockchip_get_cru_bsh(bsh);
+
+#ifdef ROCKCHIP_CLOCK_DEBUG
+	printf(%s: rate=%u\n, __func__, rate);
+#endif
+
+	switch (rate) {
+	case 160800:
+		nr = 1;
+		nf = 67;
+		no = 1;
+		core_div = 1;
+		core_periph_div = 8;
+		core_axi_div = 4;
+		aclk_div = 4;
+		hclk_div = 2;
+		pclk_div = 4;
+		ahb2apb_div = 2;
+		break;
+	case 100800:
+		nr = 1;
+		nf = 42;
+		no = 1;
+		core_div = 1;
+		core_periph_div = 8;
+		core_axi_div = 3;
+		aclk_div = 3;
+		hclk_div = 2;
+		pclk_div = 4;
+		ahb2apb_div = 2;
+		break;
+	case 6:
+		nr = 1;
+		nf = 50;
+		no = 2;
+		core_div = 1;
+		core_periph_div = 4;
+		core_axi_div = 4;
+		aclk_div = 3;
+		hclk_div = 2;
+		pclk_div = 4;
+		ahb2apb_div = 2;
+		break;
+	default:
+#ifdef ROCKCHIP_CLOCK_DEBUG
+		printf(%s: unsupported rate %u\n, __func__, rate);
+#endif
+		return EINVAL;
+	}
+
+	apll_con0 = CRU_PLL_CON0_CLKR_MASK | CRU_PLL_CON0_CLKOD_MASK;
+	apll_con0 |= __SHIFTIN(no - 1, CRU_PLL_CON0_CLKOD);
+	apll_con0 |= __SHIFTIN(nr - 1, CRU_PLL_CON0_CLKR);
+
+	apll_con1 = CRU_PLL_CON1_CLKF_MASK;
+	apll_con1 |= __SHIFTIN(nf - 1, CRU_PLL_CON1_CLKF);
+
+	clksel0_con = RK3188_CRU_CLKSEL_CON0_A9_CORE_DIV_CON_MASK |
+		  CRU_CLKSEL_CON0_CORE_PERI_DIV_CON_MASK |
+		  CRU_CLKSEL_CON0_A9_CORE_DIV_CON_MASK |
+		  CRU_CLKSEL_CON0_CPU_CLK_PLL_SEL;
+	clksel0_con |= __SHIFTIN(core_div - 1,
+ RK3188_CRU_CLKSEL_CON0_A9_CORE_DIV_CON);
+	clksel0_con |= __SHIFTIN(ffs(core_periph_div) - 2,
+ CRU_CLKSEL_CON0_CORE_PERI_DIV_CON);
+	clksel0_con |= __SHIFTIN(aclk_div - 1,
+ CRU_CLKSEL_CON0_A9_CORE_DIV_CON);
+
+	clksel1_con = RK3188_CRU_CLKSEL_CON1_CPU_ACLK_DIV_CON_MASK |
+		  CRU_CLKSEL_CON1_AHB2APB_PCLKEN_DIV_CON_MASK |
+		  CRU_CLKSEL_CON1_CPU_PCLK_DIV_CON_MASK |
+		  CRU_CLKSEL_CON1_CPU_HCLK_DIV_CON_MASK;
+	
+	switch (core_axi_div) {
+	case 1:	cpu_aclk_div_con = 0; break;
+	case 2: cpu_aclk_div_con = 1; break;
+	case 3: cpu_aclk_div_con = 2; break;
+	case 4: cpu_aclk_div_con = 3; break;
+	case 8: cpu_aclk_div_con = 4; break;
+	default: panic(bad core_axi_div);
+	}
+	clksel1_con |= __SHIFTIN(cpu_aclk_div_con,
+ 

CVS commit: src/usr.bin/midirecord

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 04:14:25 UTC 2014

Added Files:
src/usr.bin/midirecord: Makefile midirecord.1 midirecord.c

Log Message:
add a program to record midi files from /dev/music.

this doesn't process several potential result that netbsd does
not output on /dev/music, and should be largely complete for
our current sequencer(4).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/midirecord/Makefile \
src/usr.bin/midirecord/midirecord.1 src/usr.bin/midirecord/midirecord.c

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

Added files:

Index: src/usr.bin/midirecord/Makefile
diff -u /dev/null src/usr.bin/midirecord/Makefile:1.1
--- /dev/null	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/Makefile	Tue Dec 30 04:14:25 2014
@@ -0,0 +1,15 @@
+#	$NetBSD: Makefile,v 1.1 2014/12/30 04:14:25 mrg Exp $
+
+PROG=	midirecord
+
+.include bsd.own.mk
+
+LIBAUDIO != cd ${.CURDIR}/../audio/common  ${PRINTOBJDIR}
+CPPFLAGS+=-I${.CURDIR}/../audio/common
+DPADD+=	${LIBAUDIO}/libaudio.a
+LDADD+=	-L${LIBAUDIO} -laudio
+
+DPADD+=	${LIBUTIL}
+LDADD+=	-lutil
+
+.include bsd.prog.mk
Index: src/usr.bin/midirecord/midirecord.1
diff -u /dev/null src/usr.bin/midirecord/midirecord.1:1.1
--- /dev/null	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/midirecord.1	Tue Dec 30 04:14:25 2014
@@ -0,0 +1,116 @@
+.\	$NetBSD: midirecord.1,v 1.1 2014/12/30 04:14:25 mrg Exp $
+.\
+.\ Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.Dd December 29, 2014
+.Dt MIDIRECORD 1
+.Os
+.Sh NAME
+.Nm midiorecord
+.Nd record midi files
+.Sh SYNOPSIS
+.Nm
+.Op Fl afhoqV
+.Op Fl B Ar buffersize
+.Op Fl c Ar channels
+.Op Fl d Ar devices
+.Op Fl f Ar sequencerdev
+.Op Fl n Ar notesperbeat
+.Op Fl r Ar raw_output
+.Op Fl t Ar time
+.Op Fl T Ar tempo
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+program converts the sequencer events read on
+.Ar sequencerdev
+to the named MIDI SMF output.
+If the file name is \-, output will go to the standard output.
+.Pp
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width XnXnotesperbeatX
+.It Fl a
+Append to the specified file, rather than overwriting.
+.It Fl B Ar buffersize
+Set the sequencer device read buffer size to
+.Ar buffersize .
+The default value is 32768 bytes.
+.It Fl c Ar channels
+Sets the filter list of channels to
+.Ar channels ,
+which is a comma separated list of channels to filter in.
+.It Fl D
+Enable debug log.
+.It Fl d Ar devices
+Sets the filter list of devices to
+.Ar devices ,
+which is a comma separated list of devices to filter in.
+.It Fl f Ar sequencerdev
+Sets the sequencer device to use to
+.Ar sequencerdev .
+The default is
+.Pa /dev/music .
+.It Fl h
+Print a help message.
+.It Fl n Ar notesperbeat
+Sets the MIDI notes (clocks) per beat to
+.Ar notesperbeat .
+.It Fl r Ar raw_output
+Create the raw output of the sequencer device in
+.Ar raw_output .
+.It Fl q
+Be quiet.
+.It Fl t Ar time
+Sets the maximum amount of time to record.
+Format is [hh:]mm:ss[.dd].
+.It Fl V
+Be verbose.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width MIDIDEVICE
+.It MIDIDEVICE
+the midi device to be used.
+.El
+.Sh SEE ALSO
+.Xr midiplay 1 ,
+.Xr midi 4 ,
+.Xr sequencer 4 .
+.Sh HISTORY
+The
+.Nm
+program was first seen in 
+.Nx 8 .
+.Sh AUTHORS
+The
+.Nm
+program was written by
+.An Matthew R. Green Aq Mt m...@eterna.com.au .
+.Sh BUGS
+SYSEX, LOCAL and FULLSIZE messages are not currently handled, but the
+.Nx
+.Xr sequencer 4
+device does not generate them.
Index: src/usr.bin/midirecord/midirecord.c
diff -u /dev/null src/usr.bin/midirecord/midirecord.c:1.1
--- /dev/null	Tue Dec 

CVS commit: src

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 04:22:18 UTC 2014

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/man: mi
src/usr.bin: Makefile

Log Message:
install midirecord.


To generate a diff of this commit:
cvs rdiff -u -r1.1092 -r1.1093 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.97 -r1.98 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1491 -r1.1492 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.218 -r1.219 src/usr.bin/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1092 src/distrib/sets/lists/base/mi:1.1093
--- src/distrib/sets/lists/base/mi:1.1092	Thu Dec 11 23:24:12 2014
+++ src/distrib/sets/lists/base/mi	Tue Dec 30 04:22:18 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1092 2014/12/11 23:24:12 riastradh Exp $
+# $NetBSD: mi,v 1.1093 2014/12/30 04:22:18 mrg Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -608,6 +608,7 @@
 ./usr/bin/merge	base-util-bin
 ./usr/bin/mesg	base-util-bin
 ./usr/bin/midiplaybase-audio-bin
+./usr/bin/midirecordbase-audio-bin
 ./usr/bin/mixerctlbase-audio-bin
 ./usr/bin/mk_cmdsbase-obsolete		obsolete
 ./usr/bin/mkcsmapperbase-util-bin

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.97 src/distrib/sets/lists/debug/mi:1.98
--- src/distrib/sets/lists/debug/mi:1.97	Sun Dec 21 15:39:37 2014
+++ src/distrib/sets/lists/debug/mi	Tue Dec 30 04:22:18 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.97 2014/12/21 15:39:37 martin Exp $
+# $NetBSD: mi,v 1.98 2014/12/30 04:22:18 mrg Exp $
 
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -618,6 +618,7 @@
 ./usr/libdata/debug/usr/bin/merge.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/mesg.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/midiplay.debug	comp-audio-debug	debug
+./usr/libdata/debug/usr/bin/midirecord.debug	comp-audio-debug	debug
 ./usr/libdata/debug/usr/bin/mixerctl.debug	comp-audio-debug	debug
 ./usr/libdata/debug/usr/bin/mk_cmds.debug	comp-obsolete		obsolete
 ./usr/libdata/debug/usr/bin/mkcsmapper.debug	comp-util-debug		debug

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1491 src/distrib/sets/lists/man/mi:1.1492
--- src/distrib/sets/lists/man/mi:1.1491	Tue Dec  2 03:51:48 2014
+++ src/distrib/sets/lists/man/mi	Tue Dec 30 04:22:18 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1491 2014/12/02 03:51:48 msaitoh Exp $
+# $NetBSD: mi,v 1.1492 2014/12/30 04:22:18 mrg Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -319,6 +319,7 @@
 ./usr/share/man/cat1/merge.0			man-util-catman		.cat
 ./usr/share/man/cat1/mesg.0			man-util-catman		.cat
 ./usr/share/man/cat1/midiplay.0			man-audio-catman	.cat
+./usr/share/man/cat1/midirecord.0		man-audio-catman	.cat
 ./usr/share/man/cat1/mixerctl.0			man-audio-catman	.cat
 ./usr/share/man/cat1/mkdep.0			man-c-catman		.cat
 ./usr/share/man/cat1/mkdir.0			man-util-catman		.cat
@@ -3438,6 +3439,7 @@
 ./usr/share/man/html1/merge.html		man-util-htmlman	html
 ./usr/share/man/html1/mesg.html			man-util-htmlman	html
 ./usr/share/man/html1/midiplay.html		man-audio-htmlman	html
+./usr/share/man/html1/midirecord.html		man-audio-htmlman	html
 ./usr/share/man/html1/mixerctl.html		man-audio-htmlman	html
 ./usr/share/man/html1/mkdep.html		man-c-htmlman		html
 ./usr/share/man/html1/mkdir.html		man-util-htmlman	html
@@ -6195,6 +6197,7 @@
 ./usr/share/man/man1/merge.1			man-util-man		.man
 ./usr/share/man/man1/mesg.1			man-util-man		.man
 ./usr/share/man/man1/midiplay.1			man-audio-man		.man
+./usr/share/man/man1/midirecord.1		man-audio-man		.man
 ./usr/share/man/man1/mixerctl.1			man-audio-man		.man
 ./usr/share/man/man1/mkdep.1			man-c-man		.man
 ./usr/share/man/man1/mkdir.1			man-util-man		.man

Index: src/usr.bin/Makefile
diff -u src/usr.bin/Makefile:1.218 src/usr.bin/Makefile:1.219
--- src/usr.bin/Makefile:1.218	Fri Aug  1 14:01:30 2014
+++ src/usr.bin/Makefile	Tue Dec 30 04:22:18 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.218 2014/08/01 14:01:30 christos Exp $
+#	$NetBSD: Makefile,v 1.219 2014/12/30 04:22:18 mrg Exp $
 #	from: @(#)Makefile	8.3 (Berkeley) 1/7/94
 
 .include bsd.own.mk
@@ -16,9 +16,9 @@ SUBDIR= apply asa at audio audiocfg \
 	head hexdump iconv id indent infocmp innetgr ipcrm ipcs join jot \
 	kdump ktrace ktruss lam last lastcomm ldd leave \
 	locale locate lock logger login logname look lorder m4 \
-	machine mail make man menuc mesg midiplay mixerctl mkcsmapper \
-	mkdep mkesdb mkfifo mklocale mkstr mktemp mkubootimage moduli \
-	msgc msgs \
+	machine mail make man menuc mesg midiplay midirecord mixerctl \
+	mkcsmapper mkdep mkesdb 

CVS commit: src/usr.bin/midirecord

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 06:08:14 UTC 2014

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
only prev_div needs to be static.
add channel to some log messages.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/midirecord/midirecord.c

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

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.1 src/usr.bin/midirecord/midirecord.c:1.2
--- src/usr.bin/midirecord/midirecord.c:1.1	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/midirecord.c	Tue Dec 30 06:08:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.1 2014/12/30 04:14:25 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.2 2014/12/30 06:08:14 mrg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.1 2014/12/30 04:14:25 mrg Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.2 2014/12/30 06:08:14 mrg Exp $);
 #endif
 
 #include sys/param.h
@@ -311,7 +311,8 @@ midi_event_timer_wait_abs_to_output(
 	u_char *buffer,
 	size_t bufsize)
 {
-	static uint32_t prev_div, cur_div;
+	static unsigned prev_div;
+	unsigned cur_div;
 	unsigned val = 0, div;
 	int vallen = 0, i;
 
@@ -330,7 +331,7 @@ midi_event_timer_wait_abs_to_output(
 			vallen++;
 		}
 	} else
-		val = 0, vallen = 1;
+		vallen = 1;
 
 	for (i = 0; i  vallen; i++) {
 		buffer[i] = val  0xff;
@@ -466,8 +467,8 @@ midi_event_chn_voice_to_output(seq_event
 		buffer[1] = e.c_NOTEOFF.key;
 		buffer[2] = e.c_NOTEOFF.velocity;
 
-		LOG(MIDI_NOTEOFF: key %x velocity %x,
-		e.c_NOTEOFF.key, e.c_NOTEOFF.velocity);
+		LOG(MIDI_NOTEOFF: channel %x key %x velocity %x,
+		e.c_NOTEOFF.channel, e.c_NOTEOFF.key, e.c_NOTEOFF.velocity);
 		size = 3;
 		break;
 
@@ -476,8 +477,8 @@ midi_event_chn_voice_to_output(seq_event
 		buffer[1] = e.c_NOTEON.key;
 		buffer[2] = e.c_NOTEON.velocity;
 
-		LOG(MIDI_NOTEON: key %x velocity %x,
-		e.c_NOTEON.key, e.c_NOTEON.velocity);
+		LOG(MIDI_NOTEON: channel %x key %x velocity %x,
+		e.c_NOTEON.channel, e.c_NOTEON.key, e.c_NOTEON.velocity);
 		size = 3;
 		break;
 



CVS commit: src/usr.sbin/postinstall

2014-12-29 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Dec 30 07:02:29 UTC 2014

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
rc_obsolete_vars is a list of pairs, so format it with one pair per line.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.187 src/usr.sbin/postinstall/postinstall:1.188
--- src/usr.sbin/postinstall/postinstall:1.187	Tue Dec 16 05:30:40 2014
+++ src/usr.sbin/postinstall/postinstall	Tue Dec 30 07:02:29 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.187 2014/12/16 05:30:40 jnemeth Exp $
+# $NetBSD: postinstall,v 1.188 2014/12/30 07:02:29 apb Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1451,26 +1451,16 @@ systemfs
 xntpd
 
 rc_obsolete_vars=
-amd
-amd_master
-btcontrol
-btcontrol_devices
-critical_filesystems
-critical_filesystems_beforenet
-mountcritlocal
-mountcritremote
-network
-ip6forwarding
-network
-nfsiod_flags
-sdpd
-sdpd_control
-sdpd
-sdpd_groupname
-sdpd
-sdpd_username
-sysctl
-defcorename
+amd amd_master
+btcontrol btcontrol_devices
+critical_filesystems critical_filesystems_beforenet
+mountcritlocal mountcritremote
+network ip6forwarding
+network nfsiod_flags
+sdpd sdpd_control
+sdpd sdpd_groupname
+sdpd sdpd_username
+sysctl defcorename
 
 
 additem rc /etc/rc* and /etc/rc.d/ being up to date



CVS commit: src/doc

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 07:18:42 UTC 2014

Modified Files:
src/doc: CHANGES

Log Message:
note midirecord.


To generate a diff of this commit:
cvs rdiff -u -r1.2029 -r1.2030 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2029 src/doc/CHANGES:1.2030
--- src/doc/CHANGES:1.2029	Fri Dec 19 20:50:35 2014
+++ src/doc/CHANGES	Tue Dec 30 07:18:42 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.2029 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.2030 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -115,3 +115,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	powerpc: Switch to GCC 4.8. [matt 20141218]
 	dhcpcd(8): Import dhcpcd-6.6.7. [roy 20141219]
 	ntp: Import ntp 4.2.8. [christos 20141219]
+	midirecord(1): Add program to record MIDI files.  [mrg 20141229]



CVS commit: src/sys/dev

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 07:28:35 UTC 2014

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

Log Message:
- check sc-dying after sleeping in several more places, and
  convert it into EIO error where necessary.
- remove a wrong additional mutex_exit() call.
- make sure to check sc-dying under the device lock.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/midi.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/midi.c
diff -u src/sys/dev/midi.c:1.82 src/sys/dev/midi.c:1.83
--- src/sys/dev/midi.c:1.82	Mon Dec 22 07:02:22 2014
+++ src/sys/dev/midi.c	Tue Dec 30 07:28:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: midi.c,v 1.82 2014/12/22 07:02:22 mrg Exp $	*/
+/*	$NetBSD: midi.c,v 1.83 2014/12/30 07:28:34 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: midi.c,v 1.82 2014/12/22 07:02:22 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: midi.c,v 1.83 2014/12/30 07:28:34 mrg Exp $);
 
 #include midi.h
 #include sequencer.h
@@ -880,6 +880,8 @@ midiclose(dev_t dev, int flags, int ifmt
 	mutex_enter(sc-lock);
 	/* midi_start_output(sc); anything buffered = pbus already set! */
 	while (sc-pbus) {
+		if (sc-dying)
+			break;
 		DPRINTFN(8,(midiclose sleep ...\n));
 		cv_wait(sc-wchan, sc-lock);
 	}
@@ -1277,13 +1279,13 @@ midi_intr_out(struct midi_softc *sc)
 		error = sc-hw_if-output(sc-hw_hdl, *buf_cur);
 		if (error   error != EINPROGRESS)
 			break;
-		++ buf_cur;
+		++buf_cur;
 		MIDI_BUF_WRAP(buf);
-		-- msglen;
+		--msglen;
 		if (msglen)
 			*idx_cur = PACK_MB_IDX(MB_IDX_CAT(*idx_cur),msglen);
 		else {
-			++ idx_cur;
+			++idx_cur;
 			MIDI_BUF_WRAP(idx);
 		}
 		if (!error) {
@@ -1362,7 +1364,7 @@ real_writebytes(struct midi_softc *sc, u
 	
 	while (ibuf  iend) {
 		got = midi_fst(sc-xmt, *ibuf, form);
-		++ ibuf;
+		++ibuf;
 		switch ( got) {
 		case FST_MORE:
 			continue;
@@ -1484,7 +1486,6 @@ midiwrite(dev_t dev, struct uio *uio, in
  * the common syscall code will automagically
  * convert this to success with a short count.
  */
-mutex_exit(sc-lock);
 error = EWOULDBLOCK;
 goto out;
 			}
@@ -1495,6 +1496,8 @@ midiwrite(dev_t dev, struct uio *uio, in
 pollout = 0;
 			} else
 error = cv_wait_sig(sc-wchan, sc-lock);
+			if (sc-dying)
+error = EIO;
 			if (error) {
 /*
  * Similarly, the common code will handle
@@ -1532,7 +1535,7 @@ midiwrite(dev_t dev, struct uio *uio, in
 			   xfrcount=%zu inp=%p\n,
 			   error, xfrcount, inp);
 #endif
-		if ( error )
+		if (error)
 			break;
 		
 		/*
@@ -1581,7 +1584,10 @@ midi_writebytes(int unit, u_char *bf, in
 sc, unit, cc, bf[0], bf[1], bf[2]));
 
 	mutex_enter(sc-lock);
-	error = real_writebytes(sc, bf, cc);
+	if (sc-dying)
+		error = EIO;
+	else
+		error = real_writebytes(sc, bf, cc);
 	mutex_exit(sc-lock);
 
 	return error;
@@ -1596,13 +1602,16 @@ midiioctl(dev_t dev, u_long cmd, void *a
 	MIDI_BUF_DECLARE(buf);
 
 	(void)buf_end;
-	sc = device_lookup_private(midi_cd, MIDIUNIT(dev));;
-	if (sc-dying)
+	sc = device_lookup_private(midi_cd, MIDIUNIT(dev));
+
+	mutex_enter(sc-lock);
+	if (sc-dying) {
+		mutex_exit(sc-lock);
 		return EIO;
+	}
 	hw = sc-hw_if;
 	error = 0;
 
-	mutex_enter(sc-lock);
 	sc-refcnt++;
 
 	DPRINTFN(5,(midiioctl: %p cmd=0x%08lx\n, sc, cmd));



CVS commit: src/sys/dev

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 07:33:44 UTC 2014

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

Log Message:
- fix a confusion between midi(4) unit and connected to sequencer
  devices.
- minor comment/debug clean ups.

fixes problems attempting to read or write from the right midi(4)
device using the sequencer(4) device when one or more of the
non-final devices fails to open with midiseq_open().


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/sequencer.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/sequencer.c
diff -u src/sys/dev/sequencer.c:1.61 src/sys/dev/sequencer.c:1.62
--- src/sys/dev/sequencer.c:1.61	Tue Dec 23 11:37:40 2014
+++ src/sys/dev/sequencer.c	Tue Dec 30 07:33:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.61 2014/12/23 11:37:40 mrg Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.62 2014/12/30 07:33:44 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.61 2014/12/23 11:37:40 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.62 2014/12/30 07:33:44 mrg Exp $);
 
 #include sequencer.h
 
@@ -299,7 +299,7 @@ sequenceropen(dev_t dev, int flags, int 
 	struct sequencer_softc *sc;
 	struct midi_dev *md;
 	struct midi_softc *msc;
-	int error, unit;
+	int error, unit, mdno;
 
 	DPRINTF((sequenceropen\n));
 
@@ -342,7 +342,11 @@ sequenceropen(dev_t dev, int flags, int 
 sc-devs[sc-nmidi++] = md;
 md-seq = sc;
 md-doingsysex = 0;
-			}
+DPRINTF((%s: midi unit %d opened as seq %p\n,
+__func__, unit, md));
+			} else
+DPRINTF((%s: midi unit %d not opened as seq\n,
+__func__, unit));
 		}
 		mutex_enter(sc-lock);
 	} else {
@@ -350,10 +354,10 @@ sequenceropen(dev_t dev, int flags, int 
 	}
 
 	/* Only now redirect input from MIDI devices. */
-	for (unit = 0; unit  sc-nmidi; unit++) {
+	for (mdno = 0; mdno  sc-nmidi; mdno++) {
 		extern struct cfdriver midi_cd;
 
-		msc = device_lookup_private(midi_cd, unit);
+		msc = device_lookup_private(midi_cd, sc-devs[mdno]-unit);
 		if (msc) {
 			mutex_enter(msc-lock);
 			msc-seqopen = 1;
@@ -573,7 +577,7 @@ seq_softintr(void *addr)
 	t += sc-timer.divs_lastchange;
 	if (t != sc-input_stamp) {
 		seq_input_event(sc, SEQ_MK_TIMING(WAIT_ABS, .divisions=t));
-		sc-input_stamp = t; /* XXX wha hoppen if timer is reset? */
+		sc-input_stamp = t; /* XXX what happens if timer is reset? */
 	}
 	seq_input_event(sc, ev);
 	mutex_exit(sc-lock);
@@ -587,7 +591,7 @@ sequencerread(dev_t dev, struct uio *uio
 	seq_event_t ev;
 	int error;
 
-	DPRINTFN(20, (sequencerread: %PRIx64, count=%d, ioflag=%x\n,
+	DPRINTFN(2, (sequencerread: %PRIx64, count=%d, ioflag=%x\n,
 	   dev, (int)uio-uio_resid, ioflag));
 
 	if ((error = sequencer_enter(dev, sc)) != 0)
@@ -800,6 +804,7 @@ sequencerioctl(dev_t dev, u_long cmd, vo
 	case SEQUENCER_TMR_TEMPO:
 		error = seq_do_timing(sc,
 		SEQ_MK_TIMING(TEMPO, .bpm=*(int *)addr));
+		RECALC_USPERDIV(sc-timer);
 		if (error == 0)
 			*(int *)addr = sc-timer.tempo_beatpermin;
 		break;



CVS commit: src/sys/dev

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 07:39:15 UTC 2014

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

Log Message:
fix !AUDIO_DEBUG build.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/sequencer.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/sequencer.c
diff -u src/sys/dev/sequencer.c:1.62 src/sys/dev/sequencer.c:1.63
--- src/sys/dev/sequencer.c:1.62	Tue Dec 30 07:33:44 2014
+++ src/sys/dev/sequencer.c	Tue Dec 30 07:39:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.62 2014/12/30 07:33:44 mrg Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.63 2014/12/30 07:39:15 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.62 2014/12/30 07:33:44 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: sequencer.c,v 1.63 2014/12/30 07:39:15 mrg Exp $);
 
 #include sequencer.h
 
@@ -344,9 +344,10 @@ sequenceropen(dev_t dev, int flags, int 
 md-doingsysex = 0;
 DPRINTF((%s: midi unit %d opened as seq %p\n,
 __func__, unit, md));
-			} else
+			} else {
 DPRINTF((%s: midi unit %d not opened as seq\n,
 __func__, unit));
+			}
 		}
 		mutex_enter(sc-lock);
 	} else {