CVS commit: src/sys/net

2019-03-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Mar 14 03:52:40 UTC 2019

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

Log Message:
Fix ipsecif(4) memory leak in some ioctl cases.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/net/if_ipsec.c

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

Modified files:

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.20 src/sys/net/if_ipsec.c:1.21
--- src/sys/net/if_ipsec.c:1.20	Wed Dec 26 08:55:14 2018
+++ src/sys/net/if_ipsec.c	Thu Mar 14 03:52:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.20 2018/12/26 08:55:14 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.21 2019/03/14 03:52:40 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.20 2018/12/26 08:55:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.21 2019/03/14 03:52:40 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1105,6 +1105,7 @@ if_ipsec_delete_tunnel(struct ifnet *ifp
 		mutex_exit(>ipsec_lock);
 		encap_lock_exit();
 		kmem_free(nvar, sizeof(*nvar));
+		kmem_free(nullvar, sizeof(*nullvar));
 		return;
 	}
 
@@ -1192,6 +1193,8 @@ if_ipsec_ensure_flags(struct ifnet *ifp,
 		/* nothing to do */
 		mutex_exit(>ipsec_lock);
 		encap_lock_exit();
+		kmem_free(nvar, sizeof(*nvar));
+		kmem_free(nullvar, sizeof(*nullvar));
 		return 0;
 	}
 



CVS commit: src/lib/libcurses

2019-03-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar 14 00:36:06 UTC 2019

Modified Files:
src/lib/libcurses: get_wch.c getch.c

Log Message:
Rename global variable "state" to "_cursesi_state".

Until now, if application happens to have a global variable of the same
name, it was overridden by curses routines. This is the scenario in
which aspell crashes when linked to our curses, reported in pkg/44005.

We need to wipe out global/static variables like "_cursesi_state" or
"wstate" for thread safety. But it would be a future task...

XXX pullup to netbsd-8 and netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libcurses/get_wch.c
cvs rdiff -u -r1.70 -r1.71 src/lib/libcurses/getch.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/libcurses/get_wch.c
diff -u src/lib/libcurses/get_wch.c:1.20 src/lib/libcurses/get_wch.c:1.21
--- src/lib/libcurses/get_wch.c:1.20	Thu Nov 22 22:16:45 2018
+++ src/lib/libcurses/get_wch.c	Thu Mar 14 00:36:06 2019
@@ -1,4 +1,4 @@
-/*   $NetBSD: get_wch.c,v 1.20 2018/11/22 22:16:45 uwe Exp $ */
+/*   $NetBSD: get_wch.c,v 1.21 2019/03/14 00:36:06 rin Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: get_wch.c,v 1.20 2018/11/22 22:16:45 uwe Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.21 2019/03/14 00:36:06 rin Exp $");
 #endif		  /* not lint */
 
 #include 
@@ -48,8 +48,8 @@ __RCSID("$NetBSD: get_wch.c,v 1.20 2018/
 #include "curses_private.h"
 #include "keymap.h"
 
-static short   wstate;		  /* state of the wcinkey function */
-extern short state;		/* storage declared in getch.c */
+static short wstate;		/* state of the wcinkey function */
+extern short _cursesi_state;	/* storage declared in getch.c */
 
 /* prototypes for private functions */
 static int inkey(wchar_t *wc, int to, int delay);
@@ -216,7 +216,7 @@ inkey(wchar_t *wc, int to, int delay)
 *wc = inbuf[*start];
 *working = *start = (*start +1) % MAX_CBUF_SIZE;
 if (*start == *end) {
-	state = wstate = INKEY_NORM;
+	_cursesi_state = wstate = INKEY_NORM;
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 	"inkey: WCASSEMBLING=>NORM, "
@@ -224,7 +224,7 @@ inkey(wchar_t *wc, int to, int delay)
 	*start, *working, *end);
 #endif /* DEBUG */
 } else {
-	state = wstate = INKEY_BACKOUT;
+	_cursesi_state = wstate = INKEY_BACKOUT;
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 	"inkey: WCASSEMBLING=>BACKOUT, "
@@ -283,7 +283,7 @@ inkey(wchar_t *wc, int to, int delay)
 
 if (*start == *end) {
 	/* only one char processed */
-	state = wstate = INKEY_NORM;
+	_cursesi_state = wstate = INKEY_NORM;
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 	"inkey: WCASSEMBLING=>NORM, "
@@ -293,7 +293,7 @@ inkey(wchar_t *wc, int to, int delay)
 } else {
 	/* otherwise we must have more than
 	 * one char to backout */
-	state = wstate = INKEY_BACKOUT;
+	_cursesi_state = wstate = INKEY_BACKOUT;
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 	"inkey: WCASSEMBLING=>BACKOUT, "
@@ -381,7 +381,7 @@ inkey(wchar_t *wc, int to, int delay)
 			}
 
 			if (*start == *end) {	/* only one char processed */
-state = wstate = INKEY_NORM;
+_cursesi_state = wstate = INKEY_NORM;
 #ifdef DEBUG
 __CTRACE(__CTRACE_INPUT,
 "inkey: Empty cbuf=>NORM, "
@@ -391,7 +391,7 @@ inkey(wchar_t *wc, int to, int delay)
 			} else {
 /* otherwise we must have more than one
  * char to backout */
-state = wstate = INKEY_BACKOUT;
+_cursesi_state = wstate = INKEY_BACKOUT;
 #ifdef DEBUG
 __CTRACE(__CTRACE_INPUT,
 "inkey: Non-empty cbuf=>BACKOUT, "
@@ -416,7 +416,7 @@ inkey(wchar_t *wc, int to, int delay)
 #endif /* DEBUG */
 if (*start == *end) {
 	/* if it is go back to normal */
-	state = wstate = INKEY_NORM;
+	_cursesi_state = wstate = INKEY_NORM;
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 	"[inkey]=>NORM, start(%d), "
@@ -425,7 +425,7 @@ inkey(wchar_t *wc, int to, int delay)
 #endif /* DEBUG */
 } else {
 	/* otherwise go to backout state */
-	state = wstate = INKEY_BACKOUT;
+	_cursesi_state = wstate = INKEY_BACKOUT;
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 	"[inkey]=>BACKOUT, start(%d), "

Index: src/lib/libcurses/getch.c
diff -u src/lib/libcurses/getch.c:1.70 src/lib/libcurses/getch.c:1.71
--- src/lib/libcurses/getch.c:1.70	Fri Sep 28 15:03:48 2018
+++ src/lib/libcurses/getch.c	Thu Mar 14 00:36:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: getch.c,v 1.70 2018/09/28 15:03:48 roy Exp $	*/
+/*	$NetBSD: getch.c,v 1.71 2019/03/14 00:36:06 rin Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)getch.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: getch.c,v 1.70 2018/09/28 15:03:48 roy Exp $");
+__RCSID("$NetBSD: getch.c,v 

CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64

2019-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 13 23:37:48 UTC 2019

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64:
ppccpuid.S

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ppccpuid.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ppccpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ppccpuid.S:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ppccpuid.S:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ppccpuid.S:1.3	Sun Sep 23 09:33:05 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ppccpuid.S	Wed Mar 13 19:37:48 2019
@@ -137,21 +137,36 @@ OPENSSL_atomic_add:
 .long	0
 
 
-.globl	OPENSSL_rdtsc
-.type	OPENSSL_rdtsc,@function
+.globl	OPENSSL_rdtsc_mftb
+.type	OPENSSL_rdtsc_mftb,@function
 .section	".opd","aw"
 .align	3
-OPENSSL_rdtsc:
-.quad	.OPENSSL_rdtsc,.TOC.@tocbase,0
+OPENSSL_rdtsc_mftb:
+.quad	.OPENSSL_rdtsc_mftb,.TOC.@tocbase,0
 .previous
 .align	4
-.OPENSSL_rdtsc:
+.OPENSSL_rdtsc_mftb:
 	mftb	3
 	blr	
 .long	0
 .byte	0,12,0x14,0,0,0,0,0
 
 
+.globl	OPENSSL_rdtsc_mfspr268
+.type	OPENSSL_rdtsc_mfspr268,@function
+.section	".opd","aw"
+.align	3
+OPENSSL_rdtsc_mfspr268:
+.quad	.OPENSSL_rdtsc_mfspr268,.TOC.@tocbase,0
+.previous
+.align	4
+.OPENSSL_rdtsc_mfspr268:
+	mfspr	3,268
+	blr	
+.long	0
+.byte	0,12,0x14,0,0,0,0,0
+
+
 .globl	OPENSSL_cleanse
 .type	OPENSSL_cleanse,@function
 .section	".opd","aw"
@@ -222,15 +237,15 @@ CRYPTO_memcmp:
 .byte	0,12,0x14,0,0,0,3,0
 .long	0
 
-.globl	OPENSSL_instrument_bus
-.type	OPENSSL_instrument_bus,@function
+.globl	OPENSSL_instrument_bus_mftb
+.type	OPENSSL_instrument_bus_mftb,@function
 .section	".opd","aw"
 .align	3
-OPENSSL_instrument_bus:
-.quad	.OPENSSL_instrument_bus,.TOC.@tocbase,0
+OPENSSL_instrument_bus_mftb:
+.quad	.OPENSSL_instrument_bus_mftb,.TOC.@tocbase,0
 .previous
 .align	4
-.OPENSSL_instrument_bus:
+.OPENSSL_instrument_bus_mftb:
 	mtctr	4
 
 	mftb	7
@@ -260,15 +275,15 @@ OPENSSL_instrument_bus:
 .long	0
 
 
-.globl	OPENSSL_instrument_bus2
-.type	OPENSSL_instrument_bus2,@function
+.globl	OPENSSL_instrument_bus2_mftb
+.type	OPENSSL_instrument_bus2_mftb,@function
 .section	".opd","aw"
 .align	3
-OPENSSL_instrument_bus2:
-.quad	.OPENSSL_instrument_bus2,.TOC.@tocbase,0
+OPENSSL_instrument_bus2_mftb:
+.quad	.OPENSSL_instrument_bus2_mftb,.TOC.@tocbase,0
 .previous
 .align	4
-.OPENSSL_instrument_bus2:
+.OPENSSL_instrument_bus2_mftb:
 	mr	0,4
 	slwi	4,4,2
 
@@ -317,3 +332,99 @@ OPENSSL_instrument_bus2:
 .byte	0,12,0x14,0,0,0,3,0
 .long	0
 
+
+.globl	OPENSSL_instrument_bus_mfspr268
+.type	OPENSSL_instrument_bus_mfspr268,@function
+.section	".opd","aw"
+.align	3
+OPENSSL_instrument_bus_mfspr268:
+.quad	.OPENSSL_instrument_bus_mfspr268,.TOC.@tocbase,0
+.previous
+.align	4
+.OPENSSL_instrument_bus_mfspr268:
+	mtctr	4
+
+	mfspr	7,268
+	li	8,0
+
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+
+.Loop3:	mfspr	6,268
+	sub	8,6,7
+	mr	7,6
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+	addi	3,3,4
+	bc	16,0,.Loop3
+
+	mr	3,4
+	blr	
+.long	0
+.byte	0,12,0x14,0,0,0,2,0
+.long	0
+
+
+.globl	OPENSSL_instrument_bus2_mfspr268
+.type	OPENSSL_instrument_bus2_mfspr268,@function
+.section	".opd","aw"
+.align	3
+OPENSSL_instrument_bus2_mfspr268:
+.quad	.OPENSSL_instrument_bus2_mfspr268,.TOC.@tocbase,0
+.previous
+.align	4
+.OPENSSL_instrument_bus2_mfspr268:
+	mr	0,4
+	slwi	4,4,2
+
+	mfspr	7,268
+	li	8,0
+
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+
+	mfspr	6,268
+	sub	8,6,7
+	mr	7,6
+	mr	9,8
+.Loop4:
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+
+	addic.	5,5,-1
+	beq	.Ldone4
+
+	mfspr	6,268
+	sub	8,6,7
+	mr	7,6
+	cmplw	7,8,9
+	mr	9,8
+
+	mfcr	6
+	not	6,6
+	rlwinm	6,6,1,29,29
+
+	sub.	4,4,6
+	add	3,3,6
+	bne	.Loop4
+
+.Ldone4:
+	srwi	4,4,2
+	sub	3,0,4
+	blr	
+.long	0
+.byte	0,12,0x14,0,0,0,3,0
+.long	0
+



CVS commit: src/sys/dev/sbus

2019-03-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar 13 22:30:01 UTC 2019

Modified Files:
src/sys/dev/sbus: zx.c

Log Message:
In zx_cursor_color(), don't throw away the second half of the color
map data.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sbus/zx.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/sbus/zx.c
diff -u src/sys/dev/sbus/zx.c:1.43 src/sys/dev/sbus/zx.c:1.44
--- src/sys/dev/sbus/zx.c:1.43	Wed Mar 13 22:12:46 2019
+++ src/sys/dev/sbus/zx.c	Wed Mar 13 22:30:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $	*/
+/*	$NetBSD: zx.c,v 1.44 2019/03/13 22:30:01 thorpej Exp $	*/
 
 /*
  *  Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.44 2019/03/13 22:30:01 thorpej Exp $");
 
 #include 
 #include 
@@ -771,7 +771,7 @@ zx_cursor_color(struct zx_softc *sc)
 
 	tmp = sc->sc_curcmap[1] | (sc->sc_curcmap[3] << 8) |
 	(sc->sc_curcmap[5] << 16);
-	bus_space_write_4(sc->sc_bt, sc->sc_bhzcu, zcu_data, sc->sc_curcmap[1]);
+	bus_space_write_4(sc->sc_bt, sc->sc_bhzcu, zcu_data, tmp);
 
 	bus_space_write_4(sc->sc_bt, sc->sc_bhzcu, zcu_misc,
 	bus_space_read_4(sc->sc_bt, sc->sc_bhzcu, zcu_misc) | 0x03);



CVS commit: src/sys/dev/sbus

2019-03-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar 13 22:12:47 UTC 2019

Modified Files:
src/sys/dev/sbus: zx.c

Log Message:
Fix an issue with FIOCSCURSOR FB_CUR_SETCMAP on zx described here:

http://mail-index.netbsd.org/port-sparc/2019/02/11/msg002134.html

by replacing the fubyte() calls with copyin() into temporary buffers.

The other issue in zx_cursor_color() mentioned in that message will
be addressed separately.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/sbus/zx.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/sbus/zx.c
diff -u src/sys/dev/sbus/zx.c:1.42 src/sys/dev/sbus/zx.c:1.43
--- src/sys/dev/sbus/zx.c:1.42	Mon Sep  3 16:29:33 2018
+++ src/sys/dev/sbus/zx.c	Wed Mar 13 22:12:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zx.c,v 1.42 2018/09/03 16:29:33 riastradh Exp $	*/
+/*	$NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $	*/
 
 /*
  *  Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.42 2018/09/03 16:29:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.43 2019/03/13 22:12:46 thorpej Exp $");
 
 #include 
 #include 
@@ -475,16 +475,24 @@ zxioctl(dev_t dev, u_long cmd, void *dat
 			if (cu->cmap.index > 2 ||
 			cu->cmap.count > 2 - cu->cmap.index)
 return (EINVAL);
-			for (i = 0; i < cu->cmap.count; i++) {
-if ((v = fubyte(>cmap.red[i])) < 0)
-	return (EFAULT);
-sc->sc_curcmap[i + cu->cmap.index + 0] = v;
-if ((v = fubyte(>cmap.green[i])) < 0)
-	return (EFAULT);
-sc->sc_curcmap[i + cu->cmap.index + 2] = v;
-if ((v = fubyte(>cmap.blue[i])) < 0)
-	return (EFAULT);
-sc->sc_curcmap[i + cu->cmap.index + 4] = v;
+
+			uint8_t red[2], green[2], blue[2];
+			const u_int cnt = cu->cmap.count;
+
+			if (cnt &&
+			((error = copyin(cu->cmap.red,   red,   cnt)) ||
+			 (error = copyin(cu->cmap.green, green, cnt)) ||
+			 (error = copyin(cu->cmap.blue,  blue,  cnt {
+return error;
+			}
+
+			for (i = 0; i < cnt; i++) {
+sc->sc_curcmap[i + cu->cmap.index + 0] =
+red[i];
+sc->sc_curcmap[i + cu->cmap.index + 2] =
+green[i];
+sc->sc_curcmap[i + cu->cmap.index + 4] =
+blue[i];
 			}
 			zx_cursor_color(sc);
 		}



CVS commit: src/sys/kern

2019-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Mar 13 20:56:33 UTC 2019

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

Log Message:
style


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

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

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.235 src/sys/kern/subr_pool.c:1.236
--- src/sys/kern/subr_pool.c:1.235	Mon Mar 11 20:38:27 2019
+++ src/sys/kern/subr_pool.c	Wed Mar 13 20:56:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.235 2019/03/11 20:38:27 maxv Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.236 2019/03/13 20:56:33 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.235 2019/03/11 20:38:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.236 2019/03/13 20:56:33 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -139,7 +139,7 @@ static int pool_bigidx(size_t);
 int pool_inactive_time = 10;
 
 /* Next candidate for drainage (see pool_drain()) */
-static struct pool	*drainpp;
+static struct pool *drainpp;
 
 /* This lock protects both pool_head and drainpp. */
 static kmutex_t pool_head_lock;
@@ -383,16 +383,15 @@ phtree_compare(struct pool_item_header *
 {
 
 	/*
-	 * we consider pool_item_header with smaller ph_page bigger.
-	 * (this unnatural ordering is for the benefit of pr_find_pagehead.)
+	 * We consider pool_item_header with smaller ph_page bigger. This
+	 * unnatural ordering is for the benefit of pr_find_pagehead.
 	 */
-
 	if (a->ph_page < b->ph_page)
-		return (1);
+		return 1;
 	else if (a->ph_page > b->ph_page)
-		return (-1);
+		return -1;
 	else
-		return (0);
+		return 0;
 }
 
 SPLAY_PROTOTYPE(phtree, pool_item_header, ph_node, phtree_compare);
@@ -592,7 +591,7 @@ pool_init(struct pool *pp, size_t size, 
 			palloc = _allocator_kmem_fullpage;
 		else if (palloc == _allocator_nointr)
 			palloc = _allocator_nointr_fullpage;
-	}		
+	}
 #endif /* POOL_SUBPAGE */
 	if (!cold)
 		mutex_enter(_allocator_lock);
@@ -653,21 +652,20 @@ pool_init(struct pool *pp, size_t size, 
 	pp->pr_freecheck = NULL;
 	pool_redzone_init(pp, size);
 
+	/* Silently enforce '0 <= ioff < align'. */
+	ioff %= align;
+
 	/*
-	 * Decide whether to put the page header off page to avoid
-	 * wasting too large a part of the page or too big item.
-	 * Off-page page headers go on a hash table, so we can match
-	 * a returned item with its header based on the page address.
-	 * We use 1/16 of the page size and about 8 times of the item
-	 * size as the threshold (XXX: tune)
-	 *
-	 * However, we'll put the header into the page if we can put
-	 * it without wasting any items.
+	 * Decide whether to put the page header off page to avoid wasting too
+	 * large a part of the page or too big item. Off-page page headers go
+	 * on a hash table, so we can match a returned item with its header
+	 * based on the page address. We use 1/16 of the page size and about 8
+	 * times of the item size as the threshold. (XXX: tune)
 	 *
-	 * Silently enforce `0 <= ioff < align'.
+	 * However, we'll put the header into the page if we can put it without
+	 * wasting any items.
 	 */
-	pp->pr_itemoffset = ioff %= align;
-	/* See the comment below about reserved bytes. */
+	pp->pr_itemoffset = ioff;
 	trysize = palloc->pa_pagesz - ((align - ioff) % align);
 	phsize = ALIGN(sizeof(struct pool_item_header));
 	if (pp->pr_roflags & PR_PHINPAGE ||
@@ -829,7 +827,7 @@ pool_alloc_item_header(struct pool *pp, 
 	else
 		ph = pool_get(pp->pr_phpool, flags);
 
-	return (ph);
+	return ph;
 }
 
 /*
@@ -900,7 +898,7 @@ pool_get(struct pool *pp, int flags)
 
 		mutex_exit(>pr_lock);
 		KASSERT((flags & (PR_NOWAIT|PR_LIMITFAIL)) != 0);
-		return (NULL);
+		return NULL;
 	}
 
 	/*
@@ -943,7 +941,7 @@ pool_get(struct pool *pp, int flags)
 			pp->pr_nfail++;
 			mutex_exit(>pr_lock);
 			KASSERT((flags & (PR_WAITOK|PR_NOWAIT)) == PR_NOWAIT);
-			return (NULL);
+			return NULL;
 		}
 
 		/* Start the allocation process over. */
@@ -1126,6 +1124,9 @@ pool_put(struct pool *pp, void *v)
 static int
 pool_grow(struct pool *pp, int flags)
 {
+	struct pool_item_header *ph;
+	char *cp;
+
 	/*
 	 * If there's a pool_grow in progress, wait for it to complete
 	 * and try again from the top.
@@ -1157,11 +1158,11 @@ pool_grow(struct pool *pp, int flags)
 	else
 		pp->pr_flags |= PR_GROWINGNOWAIT;
 
-	char *cp = pool_allocator_alloc(pp, flags);
+	cp = pool_allocator_alloc(pp, flags);
 	if (__predict_false(cp == NULL))
 		goto out;
 
-	struct pool_item_header *ph = pool_alloc_item_header(pp, cp, flags);
+	ph = pool_alloc_item_header(pp, cp, flags);
 	if (__predict_false(ph == NULL)) {
 		pool_allocator_free(pp, cp);
 		goto out;
@@ -1226,10 +1227,10 @@ pool_prime(struct pool *pp, int n)
 static void
 pool_prime_page(struct pool 

CVS commit: [netbsd-7-0] src/doc

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 12:36:14 UTC 2019

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

Log Message:
Ticket #1684.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.137 -r1.1.2.138 src/doc/CHANGES-7.0.3

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.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.137 src/doc/CHANGES-7.0.3:1.1.2.138
--- src/doc/CHANGES-7.0.3:1.1.2.137	Thu Mar  7 16:52:15 2019
+++ src/doc/CHANGES-7.0.3	Wed Mar 13 12:36:14 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.137 2019/03/07 16:52:15 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.138 2019/03/13 12:36:14 msaitoh Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5768,3 +5768,7 @@ sys/dev/scsipi/st.c1.236 (patch), 1.
 	st(4): Fix (but disable by default) SUN compatibility mode.
 	[kardel, ticket #1682]
 
+external/bsd/bzip2/dist/bzip2recover.c		1.4
+
+	Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover
+	[martin, ticket #1684]



CVS commit: [netbsd-7-1] src/doc

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 12:35:45 UTC 2019

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

Log Message:
Ticket #1684.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.44 -r1.1.2.45 src/doc/CHANGES-7.1.3

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.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.44 src/doc/CHANGES-7.1.3:1.1.2.45
--- src/doc/CHANGES-7.1.3:1.1.2.44	Thu Mar  7 16:51:23 2019
+++ src/doc/CHANGES-7.1.3	Wed Mar 13 12:35:45 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.44 2019/03/07 16:51:23 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.45 2019/03/13 12:35:45 msaitoh Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -460,3 +460,7 @@ sys/dev/scsipi/st.c1.236 (patch), 1.
 	st(4): Fix (but disable by default) SUN compatibility mode.
 	[kardel, ticket #1682]
 
+external/bsd/bzip2/dist/bzip2recover.c		1.4
+
+	Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover
+	[martin, ticket #1684]



CVS commit: [netbsd-7] src/doc

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 12:34:15 UTC 2019

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

Log Message:
 Ticket 1683-1685.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.42 -r1.1.2.43 src/doc/CHANGES-7.3

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.3
diff -u src/doc/CHANGES-7.3:1.1.2.42 src/doc/CHANGES-7.3:1.1.2.43
--- src/doc/CHANGES-7.3:1.1.2.42	Thu Mar  7 16:49:40 2019
+++ src/doc/CHANGES-7.3	Wed Mar 13 12:34:15 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.42 2019/03/07 16:49:40 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.43 2019/03/13 12:34:15 msaitoh Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -479,3 +479,17 @@ sys/dev/scsipi/st.c1.236 (patch), 1.
 	st(4): Fix (but disable by default) SUN compatibility mode.
 	[kardel, ticket #1682]
 
+sys/compat/netbsd32/netbsd32_compat_60.c	1.3
+
+	Don't forget to convert the timespec.
+	[martin, ticket #1683]
+
+external/bsd/bzip2/dist/bzip2recover.c		1.4
+
+	Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover
+	[martin, ticket #1684]
+
+sys/arch/mvme68k/dev/pcctwo_68k.c		1.11
+
+	Fix small (but fatal) oversight in device/softc split.
+	[martin, ticket #1685]



CVS commit: src/sys/dev/fdt

2019-03-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Mar 13 12:17:45 UTC 2019

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: arasan_sdhc_fdt.c

Log Message:
Add support for Arasan SDHCI 5.1


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/arasan_sdhc_fdt.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/fdt/files.fdt

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/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.43 src/sys/dev/fdt/files.fdt:1.44
--- src/sys/dev/fdt/files.fdt:1.43	Sun Mar  3 12:54:07 2019
+++ src/sys/dev/fdt/files.fdt	Wed Mar 13 12:17:45 2019
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.43 2019/03/03 12:54:07 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.44 2019/03/13 12:17:45 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -144,3 +144,7 @@ file	dev/fdt/dwiic_fdt.c			dwiic_fdt
 # AMD Cryptographic Coprocessor
 attach	amdccp at fdt with amdccp_fdt
 file	dev/fdt/amdccp_fdt.c			amdccp_fdt
+
+# Arasan SDHCI controller
+attach	sdhc at fdt with arasan_sdhc_fdt
+file	dev/fdt/arasan_sdhc_fdt.c		arasan_sdhc_fdt

Added files:

Index: src/sys/dev/fdt/arasan_sdhc_fdt.c
diff -u /dev/null src/sys/dev/fdt/arasan_sdhc_fdt.c:1.1
--- /dev/null	Wed Mar 13 12:17:45 2019
+++ src/sys/dev/fdt/arasan_sdhc_fdt.c	Wed Mar 13 12:17:45 2019
@@ -0,0 +1,306 @@
+/* $NetBSD: arasan_sdhc_fdt.c,v 1.1 2019/03/13 12:17:45 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.1 2019/03/13 12:17:45 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#define	RK3399_GRF_EMMCCORE_CON0	0xf000
+#define	 RK3399_CORECFG_BASECLKFREQ		__BITS(15,8)
+#define	 RK3399_CORECFG_TIMEOUTCLKUNIT		__BIT(7)
+#define	 RK3399_CORECFG_TUNINGCOUNT		__BITS(5,0)
+#define	RK3399_GRF_EMMCCORE_CON11	0xf02c
+#define	 RK3399_CORECFG_CLOCKMULTIPLIER		__BITS(7,0)
+
+enum arasan_sdhc_type {
+	AS_TYPE_RK3399 = 1,
+};
+
+struct arasan_sdhc_softc {
+	struct sdhc_softc	sc_base;
+	struct sdhc_host	*sc_host[1];
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+	bus_size_t		sc_bsz;
+	int			sc_phandle;
+	struct fdtbus_phy	*sc_phy;
+	struct syscon		*sc_syscon;
+	struct clk		*sc_clk_xin;
+	struct clk		*sc_clk_ahb;
+	enum arasan_sdhc_type	sc_type;
+	struct clk_domain	sc_clkdom;
+	struct clk		sc_clk_card;
+};
+
+static const struct of_compat_data compat_data[] = {
+	{ "rockchip,rk3399-sdhci-5.1",		AS_TYPE_RK3399 },
+	{ NULL }
+};
+
+static struct clk *
+arasan_sdhc_clk_decode(device_t dev, int cc_phandle, const void *data, size_t len)
+{
+	struct arasan_sdhc_softc * const sc = device_private(dev);
+
+	if (len != 0)
+		return NULL;
+
+	return >sc_clk_card;
+}
+
+static const struct fdtbus_clock_controller_func arasan_sdhc_fdt_clk_funcs = {
+	.decode = arasan_sdhc_clk_decode,
+};
+
+static struct clk *
+arasan_sdhc_clk_get(void *priv, const char *name)
+{
+	struct arasan_sdhc_softc * const sc = priv;
+
+	if (strcmp(name, sc->sc_clk_card.name) != 0)
+		return NULL;
+
+	return >sc_clk_card;
+}
+
+static u_int
+arasan_sdhc_clk_get_rate(void *priv, struct clk *clk)
+{
+	struct arasan_sdhc_softc * const sc = priv;
+
+	return clk_get_rate(sc->sc_clk_xin);
+}
+
+static const struct clk_funcs arasan_sdhc_clk_funcs = {
+	.get = arasan_sdhc_clk_get,
+	.get_rate = arasan_sdhc_clk_get_rate,
+};
+
+static int
+arasan_sdhc_signal_voltage(struct sdhc_softc *sdhc, int signal_voltage)
+{
+	if (signal_voltage == SDMMC_SIGNAL_VOLTAGE_180)
+		

CVS commit: src/sys/dev/sdmmc

2019-03-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Mar 13 12:16:49 UTC 2019

Modified Files:
src/sys/dev/sdmmc: sdhc.c sdhcvar.h

Log Message:
Add vendor callback for post-bus clock ops and add SDHC_FLAG_STOP_WITH_TC flag


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sdmmc/sdhcvar.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/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.101 src/sys/dev/sdmmc/sdhc.c:1.102
--- src/sys/dev/sdmmc/sdhc.c:1.101	Fri Jun 23 08:43:59 2017
+++ src/sys/dev/sdmmc/sdhc.c	Wed Mar 13 12:16:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.101 2017/06/23 08:43:59 ryo Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.102 2019/03/13 12:16:49 jmcneill Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.101 2017/06/23 08:43:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.102 2019/03/13 12:16:49 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1236,6 +1236,12 @@ sdhc_bus_clock_ddr(sdmmc_chipset_handle_
 			HCLR1(hp, SDHC_HOST_CTL, SDHC_HIGH_SPEED);
 	}
 
+	if (hp->sc->sc_vendor_bus_clock_post) {
+		error = (*hp->sc->sc_vendor_bus_clock_post)(hp->sc, freq);
+		if (error != 0)
+			goto out;
+	}
+
 out:
 	mutex_exit(>intr_lock);
 
@@ -1556,6 +1562,11 @@ sdhc_exec_command(sdmmc_chipset_handle_t
 		}
 	}
 
+	if (ISSET(hp->sc->sc_flags, SDHC_FLAG_STOP_WITH_TC)) {
+		if (cmd->c_opcode == MMC_STOP_TRANSMISSION)
+			SET(cmd->c_flags, SCF_RSP_BSY);
+	}
+
 	/*
 	 * Start the MMC command, or mark `cmd' as failed and return.
 	 */

Index: src/sys/dev/sdmmc/sdhcvar.h
diff -u src/sys/dev/sdmmc/sdhcvar.h:1.29 src/sys/dev/sdmmc/sdhcvar.h:1.30
--- src/sys/dev/sdmmc/sdhcvar.h:1.29	Sat Apr 22 21:49:41 2017
+++ src/sys/dev/sdmmc/sdhcvar.h	Wed Mar 13 12:16:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhcvar.h,v 1.29 2017/04/22 21:49:41 jmcneill Exp $	*/
+/*	$NetBSD: sdhcvar.h,v 1.30 2019/03/13 12:16:49 jmcneill Exp $	*/
 /*	$OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $	*/
 
 /*
@@ -61,6 +61,7 @@ struct sdhc_softc {
 #define	SDHC_FLAG_USDHC		0x0080 /* Freescale uSDHC */
 #define	SDHC_FLAG_NO_AUTO_STOP	0x0100 /* No auto CMD12 */
 #define	SDHC_FLAG_NO_BUSY_INTR	0x0200 /* No intr when RESP_BUSY */
+#define	SDHC_FLAG_STOP_WITH_TC	0x0400 /* CMD12 can set xfer complete w/o SCF_RSP_BSY */
 
 	uint32_t		sc_clkbase;
 	int			sc_clkmsk;	/* Mask for SDCLK */
@@ -72,6 +73,7 @@ struct sdhc_softc {
 	int (*sc_vendor_card_detect)(struct sdhc_softc *);
 	int (*sc_vendor_bus_width)(struct sdhc_softc *, int);
 	int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
+	int (*sc_vendor_bus_clock_post)(struct sdhc_softc *, int);
 	int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
 	void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *);
 	int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int);



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

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 11:47:40 UTC 2019

Modified Files:
src/sys/arch/mvme68k/dev [netbsd-7]: pcctwo_68k.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1685):
sys/arch/mvme68k/dev/pcctwo_68k.c: revision 1.11
Fix small (but fatal) oversight in device/softc split.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.12.1 src/sys/arch/mvme68k/dev/pcctwo_68k.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/mvme68k/dev/pcctwo_68k.c
diff -u src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10 src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10.12.1
--- src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10	Sat Oct 27 17:18:04 2012
+++ src/sys/arch/mvme68k/dev/pcctwo_68k.c	Wed Mar 13 11:47:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $	*/
+/*	$NetBSD: pcctwo_68k.c,v 1.10.12.1 2019/03/13 11:47:40 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10.12.1 2019/03/13 11:47:40 msaitoh Exp $");
 
 #include 
 #include 
@@ -187,6 +187,7 @@ pcctwoattach(device_t parent, device_t s
 	uint8_t cid;
 
 	sc = sys_pcctwo = device_private(self);
+	sc->sc_dev = self;
 	ma = aux;
 
 	/* Get a handle to the PCCChip2's registers */



CVS commit: [netbsd-7-0] src/external/bsd/bzip2/dist

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 11:30:23 UTC 2019

Modified Files:
src/external/bsd/bzip2/dist [netbsd-7-0]: bzip2recover.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1684):
external/bsd/bzip2/dist/bzip2recover.c: revision 1.4
Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.16.1 src/external/bsd/bzip2/dist/bzip2recover.c

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

Modified files:

Index: src/external/bsd/bzip2/dist/bzip2recover.c
diff -u src/external/bsd/bzip2/dist/bzip2recover.c:1.3 src/external/bsd/bzip2/dist/bzip2recover.c:1.3.16.1
--- src/external/bsd/bzip2/dist/bzip2recover.c:1.3	Mon May  7 00:45:47 2012
+++ src/external/bsd/bzip2/dist/bzip2recover.c	Wed Mar 13 11:30:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bzip2recover.c,v 1.3 2012/05/07 00:45:47 wiz Exp $	*/
+/*	$NetBSD: bzip2recover.c,v 1.3.16.1 2019/03/13 11:30:23 msaitoh Exp $	*/
 
 /*---*/
 /*--- Block recoverer program for bzip2   ---*/
@@ -472,6 +472,7 @@ Int32 main ( Int32 argc, Char** argv )
 bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
 bsPutUInt32 ( bsWr, blockCRC );
 bsClose ( bsWr );
+outFile = NULL;
  }
  if (wrBlock >= rbCtr) break;
  wrBlock++;



CVS commit: [netbsd-7-1] src/external/bsd/bzip2/dist

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 11:29:57 UTC 2019

Modified Files:
src/external/bsd/bzip2/dist [netbsd-7-1]: bzip2recover.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1684):
external/bsd/bzip2/dist/bzip2recover.c: revision 1.4
Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.24.1 src/external/bsd/bzip2/dist/bzip2recover.c

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

Modified files:

Index: src/external/bsd/bzip2/dist/bzip2recover.c
diff -u src/external/bsd/bzip2/dist/bzip2recover.c:1.3 src/external/bsd/bzip2/dist/bzip2recover.c:1.3.24.1
--- src/external/bsd/bzip2/dist/bzip2recover.c:1.3	Mon May  7 00:45:47 2012
+++ src/external/bsd/bzip2/dist/bzip2recover.c	Wed Mar 13 11:29:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bzip2recover.c,v 1.3 2012/05/07 00:45:47 wiz Exp $	*/
+/*	$NetBSD: bzip2recover.c,v 1.3.24.1 2019/03/13 11:29:57 msaitoh Exp $	*/
 
 /*---*/
 /*--- Block recoverer program for bzip2   ---*/
@@ -472,6 +472,7 @@ Int32 main ( Int32 argc, Char** argv )
 bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
 bsPutUInt32 ( bsWr, blockCRC );
 bsClose ( bsWr );
+outFile = NULL;
  }
  if (wrBlock >= rbCtr) break;
  wrBlock++;



CVS commit: [netbsd-7] src/external/bsd/bzip2/dist

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 11:29:28 UTC 2019

Modified Files:
src/external/bsd/bzip2/dist [netbsd-7]: bzip2recover.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1684):
external/bsd/bzip2/dist/bzip2recover.c: revision 1.4
Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.14.1 src/external/bsd/bzip2/dist/bzip2recover.c

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

Modified files:

Index: src/external/bsd/bzip2/dist/bzip2recover.c
diff -u src/external/bsd/bzip2/dist/bzip2recover.c:1.3 src/external/bsd/bzip2/dist/bzip2recover.c:1.3.14.1
--- src/external/bsd/bzip2/dist/bzip2recover.c:1.3	Mon May  7 00:45:47 2012
+++ src/external/bsd/bzip2/dist/bzip2recover.c	Wed Mar 13 11:29:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bzip2recover.c,v 1.3 2012/05/07 00:45:47 wiz Exp $	*/
+/*	$NetBSD: bzip2recover.c,v 1.3.14.1 2019/03/13 11:29:28 msaitoh Exp $	*/
 
 /*---*/
 /*--- Block recoverer program for bzip2   ---*/
@@ -472,6 +472,7 @@ Int32 main ( Int32 argc, Char** argv )
 bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
 bsPutUInt32 ( bsWr, blockCRC );
 bsClose ( bsWr );
+outFile = NULL;
  }
  if (wrBlock >= rbCtr) break;
  wrBlock++;



CVS commit: [netbsd-7] src/sys/compat/netbsd32

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 11:13:48 UTC 2019

Modified Files:
src/sys/compat/netbsd32 [netbsd-7]: netbsd32_compat_60.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1683):
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.3
don't forget to convert the timespec.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.14.1 src/sys/compat/netbsd32/netbsd32_compat_60.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/netbsd32/netbsd32_compat_60.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_60.c:1.1 src/sys/compat/netbsd32/netbsd32_compat_60.c:1.1.14.1
--- src/sys/compat/netbsd32/netbsd32_compat_60.c:1.1	Fri Mar 29 01:13:54 2013
+++ src/sys/compat/netbsd32/netbsd32_compat_60.c	Wed Mar 13 11:13:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_60.c,v 1.1 2013/03/29 01:13:54 christos Exp $	*/
+/*	$NetBSD: netbsd32_compat_60.c,v 1.1.14.1 2019/03/13 11:13:48 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_60.c,v 1.1 2013/03/29 01:13:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_60.c,v 1.1.14.1 2019/03/13 11:13:48 msaitoh Exp $");
 
 #include 
 #include 
@@ -71,6 +71,7 @@ compat_60_netbsd32__lwp_park(struct lwp 
 		error = copyin(SCARG_P32(uap, ts), , sizeof ts32);
 		if (error != 0)
 			return error;
+		netbsd32_to_timespec(, );
 		tsp = 
 	}
 



CVS commit: [netbsd-8] src/doc

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 10:53:16 UTC 2019

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

Log Message:
Ticket #1213.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.116 -r1.1.2.117 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.116 src/doc/CHANGES-8.1:1.1.2.117
--- src/doc/CHANGES-8.1:1.1.2.116	Tue Mar 12 17:48:50 2019
+++ src/doc/CHANGES-8.1	Wed Mar 13 10:53:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.116 2019/03/12 17:48:50 snj Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.117 2019/03/13 10:53:16 msaitoh Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2706,3 +2706,7 @@ external/bsd/bzip2/dist/bzip2recover.c		
 	CVE-2016-3189 bzip2: heap use after free in bzip2recover
 	[martin, ticket #1212]
 
+sys/arch/mvme68k/dev/pcctwo_68k.c		1.11
+
+	Fix small (but fatal) oversight in device/softc split.
+	[martin, ticket #1213]



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

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 10:51:36 UTC 2019

Modified Files:
src/sys/arch/mvme68k/dev [netbsd-8]: pcctwo_68k.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1213):
sys/arch/mvme68k/dev/pcctwo_68k.c: revision 1.11
Fix small (but fatal) oversight in device/softc split.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.30.1 src/sys/arch/mvme68k/dev/pcctwo_68k.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/mvme68k/dev/pcctwo_68k.c
diff -u src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10 src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10.30.1
--- src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10	Sat Oct 27 17:18:04 2012
+++ src/sys/arch/mvme68k/dev/pcctwo_68k.c	Wed Mar 13 10:51:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $	*/
+/*	$NetBSD: pcctwo_68k.c,v 1.10.30.1 2019/03/13 10:51:36 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10.30.1 2019/03/13 10:51:36 msaitoh Exp $");
 
 #include 
 #include 
@@ -187,6 +187,7 @@ pcctwoattach(device_t parent, device_t s
 	uint8_t cid;
 
 	sc = sys_pcctwo = device_private(self);
+	sc->sc_dev = self;
 	ma = aux;
 
 	/* Get a handle to the PCCChip2's registers */



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

2019-03-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Mar 13 10:29:56 UTC 2019

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

Log Message:
Fix aclk_emmc register offset, set RK_COMPOSITE_ROUND_DOWN for SD/EMMC clocks, 
and add a few more emmc clock nodes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk3399_cru.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/rk3399_cru.c
diff -u src/sys/arch/arm/rockchip/rk3399_cru.c:1.5 src/sys/arch/arm/rockchip/rk3399_cru.c:1.6
--- src/sys/arch/arm/rockchip/rk3399_cru.c:1.5	Sun Mar 10 11:09:35 2019
+++ src/sys/arch/arm/rockchip/rk3399_cru.c	Wed Mar 13 10:29:56 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_cru.c,v 1.5 2019/03/10 11:09:35 jmcneill Exp $ */
+/* $NetBSD: rk3399_cru.c,v 1.6 2019/03/13 10:29:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.5 2019/03/10 11:09:35 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.6 2019/03/13 10:29:56 jmcneill Exp $");
 
 #include 
 #include 
@@ -594,21 +594,21 @@ static struct rk_cru_clk rk3399_cru_clks
 		 __BITS(12,8),	/* div_mask */
 		 CLKGATE_CON(12),	/* gate_reg */
 		 __BIT(13),		/* gate_mask */
-		 0),
+		 RK_COMPOSITE_ROUND_DOWN),
 	RK_COMPOSITE(RK3399_SCLK_SDIO, "clk_sdio", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_parents,
 		 CLKSEL_CON(15),	/* muxdiv_reg */
 		 __BITS(10,8),	/* mux_mask */
 		 __BITS(6,0),	/* div_mask */
 		 CLKGATE_CON(6),	/* gate_reg */
 		 __BIT(0),		/* gate_mask */
-		 0),
+		 RK_COMPOSITE_ROUND_DOWN),
 	RK_COMPOSITE(RK3399_SCLK_SDMMC, "clk_sdmmc", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_parents,
 		 CLKSEL_CON(16),	/* muxdiv_reg */
 		 __BITS(10,8),	/* mux_mask */
 		 __BITS(6,0),	/* div_mask */
 		 CLKGATE_CON(6),	/* gate_reg */
 		 __BIT(1),		/* gate_mask */
-		 0),
+		 RK_COMPOSITE_ROUND_DOWN),
 	RK_GATE(RK3399_HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", CLKGATE_CON(33), 8),
 	RK_GATE(RK3399_HCLK_SDIO, "hclk_sdio", "pclk_perilp1", CLKGATE_CON(34), 4),
 
@@ -621,14 +621,17 @@ static struct rk_cru_clk rk3399_cru_clks
 		 __BITS(6,0),	/* div_mask */
 		 CLKGATE_CON(6),	/* gate_reg */
 		 __BIT(14),		/* gate_mask */
-		 0),
+		 RK_COMPOSITE_ROUND_DOWN),
 	RK_GATE(0, "cpll_aclk_emmc_src", "cpll", CLKGATE_CON(6), 13),
 	RK_GATE(0, "gpll_aclk_emmc_src", "gpll", CLKGATE_CON(6), 12),
 	RK_COMPOSITE_NOGATE(RK3399_ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_parents,
-			CLKSEL_CON(22),	/* muxdiv_reg */
+			CLKSEL_CON(21),	/* muxdiv_reg */
 			__BIT(7),		/* mux_mask */
 			__BITS(4,0),	/* div_mask */
 			0),
+	RK_GATE(RK3399_ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLKGATE_CON(32), 8),
+	RK_GATE(RK3399_ACLK_EMMC_NOC, "aclk_emmc_noc", "aclk_emmc", CLKGATE_CON(32), 9),
+	RK_GATE(RK3399_ACLK_EMMC_GRF, "aclk_emmcgrf", "aclk_emmc", CLKGATE_CON(32), 10),
 
 	/*
 	 * GMAC



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

2019-03-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Mar 13 10:28:37 UTC 2019

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

Log Message:
Set drive strength and output tap delay


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_emmcphy.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/rk_emmcphy.c
diff -u src/sys/arch/arm/rockchip/rk_emmcphy.c:1.2 src/sys/arch/arm/rockchip/rk_emmcphy.c:1.3
--- src/sys/arch/arm/rockchip/rk_emmcphy.c:1.2	Sun Mar 10 19:47:03 2019
+++ src/sys/arch/arm/rockchip/rk_emmcphy.c	Wed Mar 13 10:28:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_emmcphy.c,v 1.2 2019/03/10 19:47:03 jmcneill Exp $ */
+/* $NetBSD: rk_emmcphy.c,v 1.3 2019/03/13 10:28:37 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_emmcphy.c,v 1.2 2019/03/10 19:47:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_emmcphy.c,v 1.3 2019/03/13 10:28:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -139,6 +139,18 @@ rk_emmcphy_enable(device_t dev, void *pr
 
 	syscon_lock(sc->sc_syscon);
 
+	if (enable) {
+		/* Drive strength */
+		mask = PHYCTRL_DR_TY;
+		val = __SHIFTIN(0, PHYCTRL_DR_TY);
+		WR4(sc, GRF_EMMCPHY_CON6, (mask << 16) | val);
+
+		/* Enable output tap delay */
+		mask = PHYCTRL_OTAPDLYENA | PHYCTRL_OTAPDLYSEL;
+		val = PHYCTRL_OTAPDLYENA | __SHIFTIN(4, PHYCTRL_OTAPDLYSEL);
+		WR4(sc, GRF_EMMCPHY_CON0, (mask << 16) | val);
+	}
+
 	/* Power down PHY and disable DLL before making changes */
 	mask = PHYCTRL_ENDLL | PHYCTRL_PDB;
 	val = 0;



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

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 10:08:02 UTC 2019

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

Log Message:
 Fix a bug that the VLAN HW filter function is not correctly disabled when
all vlan is detached. Part of ixgbe.c rev. 1.177.


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.109 src/sys/dev/pci/ixgbe/ixv.c:1.110
--- src/sys/dev/pci/ixgbe/ixv.c:1.109	Fri Feb 22 06:49:15 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Mar 13 10:08:02 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.109 2019/02/22 06:49:15 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.110 2019/03/13 10:08:02 msaitoh Exp $*/
 
 /**
 
@@ -1972,27 +1972,31 @@ ixv_setup_vlan_support(struct adapter *a
 	struct ixgbe_hw *hw = >hw;
 	struct rx_ring  *rxr;
 	u32		ctrl, vid, vfta, retry;
+	bool		hwtagging;
 
 	/*
-	 * We get here thru init_locked, meaning
-	 * a soft reset, this has already cleared
-	 * the VFTA and other state, so if there
-	 * have been no vlan's registered do nothing.
+	 *  This function is called from both if_init and ifflags_cb()
+	 * on NetBSD.
 	 */
-	if (!VLAN_ATTACHED(ec))
-		return;
+
+	/* Enalble HW tagging only if any vlan is attached */
+	hwtagging = (ec->ec_capenable & ETHERCAP_VLAN_HWTAGGING)
+	&& VLAN_ATTACHED(>osdep.ec);
 
 	/* Enable the queues */
 	for (int i = 0; i < adapter->num_queues; i++) {
 		rxr = >rx_rings[i];
 		ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(rxr->me));
-		ctrl |= IXGBE_RXDCTL_VME;
+		if (hwtagging)
+			ctrl |= IXGBE_RXDCTL_VME;
+		else
+			ctrl &= ~IXGBE_RXDCTL_VME;
 		IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(rxr->me), ctrl);
 		/*
 		 * Let Rx path know that it needs to store VLAN tag
 		 * as part of extra mbuf info.
 		 */
-		rxr->vtag_strip = TRUE;
+		rxr->vtag_strip = hwtagging ? TRUE : FALSE;
 	}
 
 #if 1



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

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 10:02:13 UTC 2019

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

Log Message:
- Fix a bug that the VLAN HW filter function is not correctly disabled
  when all vlan is detached.
- Fix a bug that VLAN HW filter function is not correctly controlled on 82598.
- Control VLAN HW filter function correctly.
- Don't clear IXGBE_VLNCTRL_CFIEN bit When ETHERCAP_VLAN_HWFILTER is set.
  I think it's not required (and Linux doesn't do it). This change has no
  effect to NetBSD because ETHERCAP_VLAN_HWFILTER is not supported yet.


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.176 src/sys/dev/pci/ixgbe/ixgbe.c:1.177
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.176	Tue Mar  5 10:26:08 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Mar 13 10:02:13 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.176 2019/03/05 10:26:08 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.177 2019/03/13 10:02:13 msaitoh Exp $ */
 
 /**
 
@@ -2369,33 +2369,32 @@ ixgbe_setup_vlan_hw_support(struct adapt
 	struct rx_ring	*rxr;
 	int i;
 	u32		ctrl;
-
+	bool		hwtagging;
 
 	/*
-	 * We get here thru init_locked, meaning
-	 * a soft reset, this has already cleared
-	 * the VFTA and other state, so if there
-	 * have been no vlan's registered do nothing.
+	 *  This function is called from both if_init and ifflags_cb()
+	 * on NetBSD.
 	 */
-	if (!VLAN_ATTACHED(>osdep.ec))
-		return;
+
+	/* Enalble HW tagging only if any vlan is attached */
+	hwtagging = (ec->ec_capenable & ETHERCAP_VLAN_HWTAGGING)
+	&& VLAN_ATTACHED(>osdep.ec);
 
 	/* Setup the queues for vlans */
-	if (ec->ec_capenable & ETHERCAP_VLAN_HWTAGGING) {
-		for (i = 0; i < adapter->num_queues; i++) {
-			rxr = >rx_rings[i];
-			/* On 82599 the VLAN enable is per/queue in RXDCTL */
-			if (hw->mac.type != ixgbe_mac_82598EB) {
-ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me));
+	for (i = 0; i < adapter->num_queues; i++) {
+		rxr = >rx_rings[i];
+		/* On 82599 the VLAN enable is per/queue in RXDCTL */
+		if (hw->mac.type != ixgbe_mac_82598EB) {
+			ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me));
+			if (hwtagging)
 ctrl |= IXGBE_RXDCTL_VME;
-IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), ctrl);
-			}
-			rxr->vtag_strip = TRUE;
+			else
+ctrl &= ~IXGBE_RXDCTL_VME;
+			IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), ctrl);
 		}
+		rxr->vtag_strip = hwtagging ? TRUE : FALSE;
 	}
 
-	if ((ec->ec_capenable & ETHERCAP_VLAN_HWFILTER) == 0)
-		return;
 	/*
 	 * A soft reset zero's out the VFTA, so
 	 * we need to repopulate it now.
@@ -2407,12 +2406,17 @@ ixgbe_setup_vlan_hw_support(struct adapt
 
 	ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 	/* Enable the Filter Table if enabled */
-	if (ec->ec_capenable & ETHERCAP_VLAN_HWFILTER) {
-		ctrl &= ~IXGBE_VLNCTRL_CFIEN;
+	if (ec->ec_capenable & ETHERCAP_VLAN_HWFILTER)
 		ctrl |= IXGBE_VLNCTRL_VFE;
+	else
+		ctrl &= ~IXGBE_VLNCTRL_VFE;
+	/* VLAN hw tagging for 82598 */
+	if (hw->mac.type == ixgbe_mac_82598EB) {
+		if (hwtagging)
+			ctrl |= IXGBE_VLNCTRL_VME;
+		else
+			ctrl &= ~IXGBE_VLNCTRL_VME;
 	}
-	if (hw->mac.type == ixgbe_mac_82598EB)
-		ctrl |= IXGBE_VLNCTRL_VME;
 	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
 } /* ixgbe_setup_vlan_hw_support */
 



CVS commit: src/crypto/external/bsd/openssl/dist/crypto

2019-03-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 13 09:42:01 UTC 2019

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: armcap.c

Log Message:
fix merge botch in previous.  i *think* this is now right.  it sure builds..


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/dist/crypto/armcap.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/armcap.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/armcap.c:1.9 src/crypto/external/bsd/openssl/dist/crypto/armcap.c:1.10
--- src/crypto/external/bsd/openssl/dist/crypto/armcap.c:1.9	Tue Mar 12 16:58:12 2019
+++ src/crypto/external/bsd/openssl/dist/crypto/armcap.c	Wed Mar 13 09:42:01 2019
@@ -206,6 +206,7 @@ void OPENSSL_cpuid_setup(void)
 }
 # endif
 
+#if __ARM_MAX_ARCH__>=7
 /* Things that getauxval didn't tell us */
 if (sigsetjmp(ill_jmp, 1) == 0) {
 _armv7_tick();



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc

2019-03-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 13 09:23:59 UTC 2019

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc: ppccpuid.S

Log Message:
regen for openssl 1.1.1b.

not 100% sure this is right but my build works now.  here's what i did:

   % cd crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc
   % make regen

after checking that the openssl generator calling code had not change
(but the relevant .pl file had.)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S:1.11 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S:1.12
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S:1.11	Sun Jan  6 22:22:02 2019
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S	Wed Mar 13 09:23:59 2019
@@ -102,10 +102,11 @@ OPENSSL_atomic_add:
 .long	0
 
 
-.globl	OPENSSL_rdtsc
-.type	OPENSSL_rdtsc,@function
+.globl	OPENSSL_rdtsc_mftb
+.type	OPENSSL_rdtsc_mftb,@function
 .align	4
-OPENSSL_rdtsc:
+OPENSSL_rdtsc_mftb:
+	mftb	3
 	mfspr	0,287
 	srwi	0,0,0x10
 	cmplwi	0,0x1
@@ -128,6 +129,16 @@ OPENSSL_rdtsc:
 .byte	0,12,0x14,0,0,0,0,0
 
 
+.globl	OPENSSL_rdtsc_mfspr268
+.type	OPENSSL_rdtsc_mfspr268,@function
+.align	4
+OPENSSL_rdtsc_mfspr268:
+	mfspr	3,268
+	blr	
+.long	0
+.byte	0,12,0x14,0,0,0,0,0
+
+
 .globl	OPENSSL_cleanse
 .type	OPENSSL_cleanse,@function
 .align	4
@@ -188,10 +199,10 @@ CRYPTO_memcmp:
 .byte	0,12,0x14,0,0,0,3,0
 .long	0
 
-.globl	OPENSSL_instrument_bus
-.type	OPENSSL_instrument_bus,@function
+.globl	OPENSSL_instrument_bus_mftb
+.type	OPENSSL_instrument_bus_mftb,@function
 .align	4
-OPENSSL_instrument_bus:
+OPENSSL_instrument_bus_mftb:
 	mtctr	4
 
 	mftb	7
@@ -221,10 +232,10 @@ OPENSSL_instrument_bus:
 .long	0
 
 
-.globl	OPENSSL_instrument_bus2
-.type	OPENSSL_instrument_bus2,@function
+.globl	OPENSSL_instrument_bus2_mftb
+.type	OPENSSL_instrument_bus2_mftb,@function
 .align	4
-OPENSSL_instrument_bus2:
+OPENSSL_instrument_bus2_mftb:
 	mr	0,4
 	slwi	4,4,2
 
@@ -273,3 +284,89 @@ OPENSSL_instrument_bus2:
 .byte	0,12,0x14,0,0,0,3,0
 .long	0
 
+
+.globl	OPENSSL_instrument_bus_mfspr268
+.type	OPENSSL_instrument_bus_mfspr268,@function
+.align	4
+OPENSSL_instrument_bus_mfspr268:
+	mtctr	4
+
+	mfspr	7,268
+	li	8,0
+
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+
+.Loop3:	mfspr	6,268
+	sub	8,6,7
+	mr	7,6
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+	addi	3,3,4
+	bc	16,0,.Loop3
+
+	mr	3,4
+	blr	
+.long	0
+.byte	0,12,0x14,0,0,0,2,0
+.long	0
+
+
+.globl	OPENSSL_instrument_bus2_mfspr268
+.type	OPENSSL_instrument_bus2_mfspr268,@function
+.align	4
+OPENSSL_instrument_bus2_mfspr268:
+	mr	0,4
+	slwi	4,4,2
+
+	mfspr	7,268
+	li	8,0
+
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+
+	mfspr	6,268
+	sub	8,6,7
+	mr	7,6
+	mr	9,8
+.Loop4:
+	dcbf	0,3
+	lwarx	6,0,3
+	add	6,6,8
+	stwcx.	6,0,3
+	stwx	6,0,3
+
+	addic.	5,5,-1
+	beq	.Ldone4
+
+	mfspr	6,268
+	sub	8,6,7
+	mr	7,6
+	.long	0x7f884840
+	mr	9,8
+
+	mfcr	6
+	not	6,6
+	rlwinm	6,6,1,29,29
+
+	sub.	4,4,6
+	add	3,3,6
+	bne	.Loop4
+
+.Ldone4:
+	srwi	4,4,2
+	sub	3,0,4
+	blr	
+.long	0
+.byte	0,12,0x14,0,0,0,3,0
+.long	0
+



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

2019-03-13 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 13 08:50:12 UTC 2019

Modified Files:
src/tests/lib/libc/sys: t_mlock.c

Log Message:
Add a bunch of fprintf(stderr,...) diagnostics to try and help determine
what is going wrong which is causing this test to crash the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/sys/t_mlock.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/sys/t_mlock.c
diff -u src/tests/lib/libc/sys/t_mlock.c:1.6 src/tests/lib/libc/sys/t_mlock.c:1.7
--- src/tests/lib/libc/sys/t_mlock.c:1.6	Tue Aug  9 12:02:44 2016
+++ src/tests/lib/libc/sys/t_mlock.c	Wed Mar 13 08:50:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $ */
+/* $NetBSD: t_mlock.c,v 1.7 2019/03/13 08:50:12 kre Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $");
+__RCSID("$NetBSD: t_mlock.c,v 1.7 2019/03/13 08:50:12 kre Exp $");
 
 #include 
 #include 
@@ -41,6 +41,7 @@ __RCSID("$NetBSD: t_mlock.c,v 1.6 2016/0
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static long page = 0;
@@ -55,16 +56,26 @@ ATF_TC_HEAD(mlock_clip, tc)
 ATF_TC_BODY(mlock_clip, tc)
 {
 	void *buf;
+	int err1, err2;
 
 	buf = malloc(page);
 	ATF_REQUIRE(buf != NULL);
+	fprintf(stderr, "mlock_clip: buf = %p (page=%ld)\n", buf, page);
 
 	if (page < 1024)
 		atf_tc_skip("page size too small");
 
 	for (size_t i = page; i >= 1; i = i - 1024) {
-		(void)mlock(buf, page - i);
-		(void)munlock(buf, page - i);
+		err1 = mlock(buf, page - i);
+		if (err1 != 0)
+			fprintf(stderr, "mlock_clip: page=%ld i=%zu,"
+			" mlock(%p, %ld): %s\n", page, i, buf, page - i,
+			strerror(errno));
+		err2 = munlock(buf, page - i);
+		if (err2 != 0)
+			fprintf(stderr, "mlock_clip: page=%ld i=%zu,"
+			" munlock(%p, %ld): %s (mlock %s)\n", page, i,
+			buf, page - i, strerror(errno), err1?"failed":"ok");
 	}
 
 	free(buf);
@@ -81,6 +92,7 @@ ATF_TC_BODY(mlock_err, tc)
 {
 	void *invalid_ptr;
 	void *buf;
+	int mlock_err, munlock_err;
 
 	/*
 	 * Any bad address must return ENOMEM (for lock & unlock)
@@ -105,6 +117,7 @@ ATF_TC_BODY(mlock_err, tc)
 
 	buf = malloc(page);
 	ATF_REQUIRE(buf != NULL);
+	fprintf(stderr, "mlock_err: buf = %p (page=%ld)\n", buf, page);
 
 	/*
 	 * unlocking memory that is not locked is an error...
@@ -116,8 +129,18 @@ ATF_TC_BODY(mlock_err, tc)
 	/*
 	 * These are permitted to fail (EINVAL) but do not on NetBSD
 	 */
-	ATF_REQUIRE(mlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0);
-	ATF_REQUIRE(munlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0);
+	mlock_err = mlock((void *)(((uintptr_t)buf) + page/3), page/5);
+	if (mlock_err != 0)
+	fprintf(stderr, "mlock_err: mlock(%p, %ld): %d [%d] %s\n",
+		(void *)(((uintptr_t)buf) + page/3), page/5, mlock_err,
+		errno, strerror(errno));
+	ATF_REQUIRE(mlock_err == 0);
+	munlock_err= munlock((void *)(((uintptr_t)buf) + page/3), page/5);
+	if (munlock_err != 0)
+	fprintf(stderr, "mlock_err: munlock(%p, %ld): %d [%d] %s\n",
+		(void *)(((uintptr_t)buf) + page/3), page/5, munlock_err,
+		errno, strerror(errno));
+	ATF_REQUIRE(munlock_err == 0);
 
 	(void)free(buf);
 
@@ -150,6 +173,7 @@ ATF_TC_BODY(mlock_limits, tc)
 
 	buf = malloc(page);
 	ATF_REQUIRE(buf != NULL);
+	fprintf(stderr, "mlock_limits: buf = %p (page=%ld)\n", buf, page);
 
 	pid = fork();
 	ATF_REQUIRE(pid >= 0);
@@ -161,7 +185,7 @@ ATF_TC_BODY(mlock_limits, tc)
 			res.rlim_cur = i - 1;
 			res.rlim_max = i - 1;
 
-			(void)fprintf(stderr, "trying to lock %zd bytes "
+			(void)fprintf(stderr, "trying to lock %zu bytes "
 			"with %zu byte limit\n", i, (size_t)res.rlim_cur);
 
 			if (setrlimit(RLIMIT_MEMLOCK, ) != 0)
@@ -169,7 +193,9 @@ ATF_TC_BODY(mlock_limits, tc)
 
 			errno = 0;
 
-			if (mlock(buf, i) != -1 || errno != EAGAIN) {
+			if ((sta = mlock(buf, i)) != -1 || errno != EAGAIN) {
+fprintf(stderr, "mlock(%p, %zu): %d [%d] %s\n",
+buf, i, sta, errno, strerror(errno));
 (void)munlock(buf, i);
 _exit(EXIT_FAILURE);
 			}
@@ -203,20 +229,39 @@ ATF_TC_BODY(mlock_mmap, tc)
 	 */
 	buf = mmap(NULL, page, PROT_READ | PROT_WRITE, flags, -1, 0);
 
+	if (buf == MAP_FAILED)
+		fprintf(stderr,
+		"mlock_mmap: mmap(NULL, %ld, %#x, %#x, -1, 0): MAP_FAILED"
+		" [%d] %s\n", page, PROT_READ | PROT_WRITE, flags, errno,
+		strerror(errno));
+
 	ATF_REQUIRE(buf != MAP_FAILED);
+
+	fprintf(stderr, "mlock_mmap: buf=%p, page=%ld\n", buf, page);
+
 	ATF_REQUIRE(mlock(buf, page) == 0);
 	ATF_REQUIRE(munlock(buf, page) == 0);
 	ATF_REQUIRE(munmap(buf, page) == 0);
 	ATF_REQUIRE(munlock(buf, page) != 0);
 
+	fprintf(stderr, "mlock_mmap: first test succeeded\n");
+
 	/*
 	 * But it should be impossible to mlock(2) a PROT_NONE mapping.
 	 */

CVS commit: src/sys/arch/mvme68k/dev

2019-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Mar 13 06:27:34 UTC 2019

Modified Files:
src/sys/arch/mvme68k/dev: pcctwo_68k.c

Log Message:
Fix small (but fatal) oversight in device/softc split.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mvme68k/dev/pcctwo_68k.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/mvme68k/dev/pcctwo_68k.c
diff -u src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10 src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.11
--- src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10	Sat Oct 27 17:18:04 2012
+++ src/sys/arch/mvme68k/dev/pcctwo_68k.c	Wed Mar 13 06:27:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $	*/
+/*	$NetBSD: pcctwo_68k.c,v 1.11 2019/03/13 06:27:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.11 2019/03/13 06:27:34 martin Exp $");
 
 #include 
 #include 
@@ -187,6 +187,7 @@ pcctwoattach(device_t parent, device_t s
 	uint8_t cid;
 
 	sc = sys_pcctwo = device_private(self);
+	sc->sc_dev = self;
 	ma = aux;
 
 	/* Get a handle to the PCCChip2's registers */