CVS commit: src/sys/netinet

2019-10-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  9 05:29:18 UTC 2019

Modified Files:
src/sys/netinet: tcp_congctl.c

Log Message:
 All of snd_wnd, snd_cwnd and snd_ssthresh in stuct tcpcb are u_long,
so use u_long and ulmin() instead of u_int and uimin(). Found by lgtm bot.

XXX TCP's sequence number is uint32_t, so it might be good to change some
entries in struct tcpcb to uint32_t instead of u_long. FreeBSD did it.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/tcp_congctl.c

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



CVS commit: src/sys/netinet

2019-10-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  9 05:29:18 UTC 2019

Modified Files:
src/sys/netinet: tcp_congctl.c

Log Message:
 All of snd_wnd, snd_cwnd and snd_ssthresh in stuct tcpcb are u_long,
so use u_long and ulmin() instead of u_int and uimin(). Found by lgtm bot.

XXX TCP's sequence number is uint32_t, so it might be good to change some
entries in struct tcpcb to uint32_t instead of u_long. FreeBSD did it.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/tcp_congctl.c

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

Modified files:

Index: src/sys/netinet/tcp_congctl.c
diff -u src/sys/netinet/tcp_congctl.c:1.26 src/sys/netinet/tcp_congctl.c:1.27
--- src/sys/netinet/tcp_congctl.c:1.26	Mon Sep  3 16:29:36 2018
+++ src/sys/netinet/tcp_congctl.c	Wed Oct  9 05:29:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_congctl.c,v 1.26 2018/09/03 16:29:36 riastradh Exp $	*/
+/*	$NetBSD: tcp_congctl.c,v 1.27 2019/10/09 05:29:18 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2005, 2006 The NetBSD Foundation, Inc.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.26 2018/09/03 16:29:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.27 2019/10/09 05:29:18 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -427,12 +427,12 @@ tcp_congctl_fillnames(void)
 static void
 tcp_common_congestion_exp(struct tcpcb *tp, int betaa, int betab)
 {
-	u_int win;
+	u_long win;
 
 	/* 
 	 * Reduce the congestion window and the slow start threshold.
 	 */
-	win = uimin(tp->snd_wnd, tp->snd_cwnd) * betaa / betab / tp->t_segsz;
+	win = ulmin(tp->snd_wnd, tp->snd_cwnd) * betaa / betab / tp->t_segsz;
 	if (win < 2)
 		win = 2;
 
@@ -519,7 +519,7 @@ tcp_reno_fast_retransmit(struct tcpcb *t
 static void
 tcp_reno_slow_retransmit(struct tcpcb *tp)
 {
-	u_int win;
+	u_long win;
 
 	/*
 	 * Close the congestion window down to one segment
@@ -546,7 +546,7 @@ tcp_reno_slow_retransmit(struct tcpcb *t
 	 * to go below this.)
 	 */
 
-	win = uimin(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_segsz;
+	win = ulmin(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_segsz;
 	if (win < 2)
 		win = 2;
 	/* Loss Window MUST be one segment. */



CVS commit: src/sys/rump/librump/rumpkern

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  9 01:43:35 UTC 2019

Modified Files:
src/sys/rump/librump/rumpkern: rump_syscalls.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/rump/librump/rumpkern/rump_syscalls.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/rump/librump/rumpkern/rump_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.c:1.142 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.143
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.142	Sun Sep 22 19:03:21 2019
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Tue Oct  8 21:43:35 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.142 2019/09/22 23:03:21 christos Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.143 2019/10/09 01:43:35 christos Exp $ */
 
 /*
  * System call vector and marshalling for rump.
@@ -15,7 +15,7 @@
 
 #ifdef __NetBSD__
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.142 2019/09/22 23:03:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.143 2019/10/09 01:43:35 christos Exp $");
 
 #include 
 #include 
@@ -6553,1999 +6553,1999 @@ int rumpns_enosys(void);
 
 struct sysent rump_sysent[] = {
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 },		/* 0 = syscall */
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 },		/* 1 = exit */
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 },		/* 2 = fork */
 	{
 		ns(struct sys_read_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 3 = read */
 	{
 		ns(struct sys_write_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 4 = write */
 	{
 		ns(struct sys_open_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 5 = open */
 	{
 		ns(struct sys_close_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 6 = close */
 	{
 		.sy_flags = SYCALL_NOSYS,
-		.sy_call = (sy_call_t *)rumpns_sys_nomodule,
+		.sy_call = (sy_call_t *)(void *)rumpns_sys_nomodule,
 },		/* 7 = wait4 */
 	{
 		.sy_flags = SYCALL_NOSYS,
-		.sy_call = (sy_call_t *)rumpns_sys_nomodule,
+		.sy_call = (sy_call_t *)(void *)rumpns_sys_nomodule,
 },		/* 8 = ocreat */
 	{
 		ns(struct sys_link_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 9 = link */
 	{
 		ns(struct sys_unlink_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 10 = unlink */
 	{
 		.sy_flags = SYCALL_NOSYS,
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 11 = filler */
 	{
 		ns(struct sys_chdir_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 12 = chdir */
 	{
 		ns(struct sys_fchdir_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 13 = fchdir */
 	{
 		ns(struct compat_50_sys_mknod_args),
-		.sy_call = (sy_call_t *)rumpns_sys_nomodule,
+		.sy_call = (sy_call_t *)(void *)rumpns_sys_nomodule,
 	},		/* 14 = compat_50_mknod */
 	{
 		ns(struct sys_chmod_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 15 = chmod */
 	{
 		ns(struct sys_chown_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 16 = chown */
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 },		/* 17 = break */
 	{
 		.sy_flags = SYCALL_NOSYS,
-		.sy_call = (sy_call_t *)rumpns_sys_nomodule,
+		.sy_call = (sy_call_t *)(void *)rumpns_sys_nomodule,
 },		/* 18 = getfsstat */
 	{
 		.sy_flags = SYCALL_NOSYS,
-		.sy_call = (sy_call_t *)rumpns_sys_nomodule,
+		.sy_call = (sy_call_t *)(void *)rumpns_sys_nomodule,
 },		/* 19 = olseek */
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 20 = getpid */
 	{
 		.sy_flags = SYCALL_NOSYS,
-		.sy_call = (sy_call_t *)rumpns_sys_nomodule,
+		.sy_call = (sy_call_t *)(void *)rumpns_sys_nomodule,
 },		/* 21 = mount */
 	{
 		ns(struct sys_unmount_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 22 = unmount */
 	{
 		ns(struct sys_setuid_args),
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 23 = setuid */
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = (sy_call_t *)(void *)rumpns_enosys,
 	},		/* 24 = getuid */
 	{
-		.sy_call = (sy_call_t *)rumpns_enosys,
+		.sy_call = 

CVS commit: src/sys/rump/librump/rumpkern

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  9 01:43:35 UTC 2019

Modified Files:
src/sys/rump/librump/rumpkern: rump_syscalls.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/rump/librump/rumpkern/rump_syscalls.c

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



CVS commit: src/sys/kern

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  9 01:43:00 UTC 2019

Modified Files:
src/sys/kern: makesyscalls.sh

Log Message:
- cast through void * for rump
- don't generate bogus filenames /dev/null.bottom etc.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/kern/makesyscalls.sh

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



CVS commit: src/sys/kern

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  9 01:43:00 UTC 2019

Modified Files:
src/sys/kern: makesyscalls.sh

Log Message:
- cast through void * for rump
- don't generate bogus filenames /dev/null.bottom etc.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/kern/makesyscalls.sh

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/makesyscalls.sh
diff -u src/sys/kern/makesyscalls.sh:1.173 src/sys/kern/makesyscalls.sh:1.174
--- src/sys/kern/makesyscalls.sh:1.173	Tue Jun 18 12:24:17 2019
+++ src/sys/kern/makesyscalls.sh	Tue Oct  8 21:43:00 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: makesyscalls.sh,v 1.173 2019/06/18 16:24:17 christos Exp $
+#	$NetBSD: makesyscalls.sh,v 1.174 2019/10/09 01:43:00 christos Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -70,8 +70,8 @@ rumpcallshdr="/dev/null"
 rumpsysmap="/dev/null"
 rumpsysent="rumpsysent.tmp"
 rumpnoflags="\n\t\t.sy_flags = SYCALL_NOSYS,"
-rumpnosys="(sy_call_t *)rumpns_enosys"
-rumpnomodule="(sy_call_t *)rumpns_sys_nomodule"
+rumpnosys="(sy_call_t *)(void *)rumpns_enosys"
+rumpnomodule="(sy_call_t *)(void *)rumpns_sys_nomodule"
 
 case $1 in
 /*)	. $1;;
@@ -84,6 +84,15 @@ errmsg()
 	printf '%s: %s\n' "$0" "$*" >&2
 }
 
+addsuffix()
+{
+	if [ "$1" = "/dev/null" -o -z "$2" ]; then
+		echo $1
+	else
+		echo $1.$2
+	fi
+}
+
 fail=false
 case "${nsysent:-0}" in
 *[!0-9]*)	errmsg "Non numeric value for nsysent:" "${nsysent}";;
@@ -94,13 +103,13 @@ esac
 $fail && exit 1
 
 # tmp files:
-sysautoloadbottom="$sysautoload.bottom"
+sysautoloadbottom=$(addsuffix $sysautoload "bottom")
 sysdcl="sysent.dcl"
 sysprotos="sys.protos"
 syscompat_pref="sysent."
 sysent="sysent.switch"
-sysnamesbottom="$sysnames.bottom"
-sysnamesfriendly="$sysnames.friendly"
+sysnamesbottom=$(addsuffix $sysnames "bottom")
+sysnamesfriendly=$(addsuffix $sysnames "friendly")
 rumptypes="rumphdr.types"
 rumpprotos="rumphdr.protos"
 systracetmp="systrace.$$"
@@ -174,7 +183,7 @@ BEGIN {
 	systracetmp = \"$systracetmp\"
 	systraceret = \"$systraceret\"
 	sysautoload = \"$sysautoload\"
-	sysautoloadbottom = \"${sysautoload}.bottom\"
+	sysautoloadbottom = \"$sysautoloadbottom\"
 	rumpcalls = \"$rumpcalls\"
 	rumpcallshdr = \"$rumpcallshdr\"
 	rumpsysent = \"$rumpsysent\"
@@ -193,8 +202,8 @@ BEGIN {
 	sysdcl = \"$sysdcl\"
 	syscompat_pref = \"$syscompat_pref\"
 	sysent = \"$sysent\"
-	sysnamesbottom = \"${sysnames}.bottom\"
-	sysnamesfriendly = \"${sysnames}.friendly\"
+	sysnamesbottom = \"$sysnamesbottom\"
+	sysnamesfriendly = \"$sysnamesfriendly\"
 	rumpprotos = \"$rumpprotos\"
 	rumptypes = \"$rumptypes\"
 	sys_nosys = \"$sys_nosys\"



CVS commit: src/external/bsd/atf/dist

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  9 01:18:55 UTC 2019

Modified Files:
src/external/bsd/atf/dist/atf-c++: build.cpp
src/external/bsd/atf/dist/atf-sh: atf-check.cpp
src/external/bsd/atf/dist/tools: process.cpp

Log Message:
the cast police is looking for me.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/atf/dist/atf-c++/build.cpp
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/atf/dist/atf-sh/atf-check.cpp
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/atf/dist/tools/process.cpp

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/atf/dist/atf-c++/build.cpp
diff -u src/external/bsd/atf/dist/atf-c++/build.cpp:1.1.1.2 src/external/bsd/atf/dist/atf-c++/build.cpp:1.2
--- src/external/bsd/atf/dist/atf-c++/build.cpp:1.1.1.2	Wed Oct 20 05:14:20 2010
+++ src/external/bsd/atf/dist/atf-c++/build.cpp	Tue Oct  8 21:18:55 2019
@@ -63,7 +63,7 @@ atf::process::argv_array
 cargv_to_argv_and_free(char** l)
 {
 try {
-atf::process::argv_array argv((const char* const*)l);
+atf::process::argv_array argv(const_cast(l));
 atf_utils_free_charpp(l);
 return argv;
 } catch (...) {

Index: src/external/bsd/atf/dist/atf-sh/atf-check.cpp
diff -u src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.11 src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.12
--- src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.11	Fri Oct  4 05:19:18 2019
+++ src/external/bsd/atf/dist/atf-sh/atf-check.cpp	Tue Oct  8 21:18:55 2019
@@ -498,7 +498,7 @@ decode(const std::string& s)
 {
 int count = 3;
 c = 0;
-while (--count >= 0 && (unsigned)(s[i] - '0') < 8)
+while (--count >= 0 && static_cast(s[i] - '0') < 8)
 c = (c << 3) + (s[i++] - '0');
 break;
 }

Index: src/external/bsd/atf/dist/tools/process.cpp
diff -u src/external/bsd/atf/dist/tools/process.cpp:1.5 src/external/bsd/atf/dist/tools/process.cpp:1.6
--- src/external/bsd/atf/dist/tools/process.cpp:1.5	Sat Feb  3 20:41:05 2018
+++ src/external/bsd/atf/dist/tools/process.cpp	Tue Oct  8 21:18:55 2019
@@ -102,8 +102,7 @@ static
 int
 const_execvp(const char *file, const char *const *argv)
 {
-#define UNCONST(a) ((void *)(unsigned long)(const void *)(a))
-return ::execvp(file, (char* const*)(UNCONST(argv)));
+return ::execvp(file, const_cast(argv));
 #undef UNCONST
 }
 



CVS commit: src/external/bsd/atf/dist

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  9 01:18:55 UTC 2019

Modified Files:
src/external/bsd/atf/dist/atf-c++: build.cpp
src/external/bsd/atf/dist/atf-sh: atf-check.cpp
src/external/bsd/atf/dist/tools: process.cpp

Log Message:
the cast police is looking for me.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/atf/dist/atf-c++/build.cpp
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/atf/dist/atf-sh/atf-check.cpp
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/atf/dist/tools/process.cpp

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



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

2019-10-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Oct  8 23:03:01 UTC 2019

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

Log Message:
Add sun8i-h3-nanopi-duo2.dts and sun8i-h3-nanopi-r1.dts.

The former is untested.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/conf/GENERIC

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.53 src/sys/arch/evbarm/conf/GENERIC:1.54
--- src/sys/arch/evbarm/conf/GENERIC:1.53	Sun Oct  6 07:36:46 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Tue Oct  8 23:03:01 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.53 2019/10/06 07:36:46 skrll Exp $
+#	$NetBSD: GENERIC,v 1.54 2019/10/08 23:03:01 bad Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -124,8 +124,10 @@ makeoptions	DTS="
 	sun8i-h3-beelink-x2.dts
 	sun8i-h3-libretech-all-h3-cc.dts
 	sun8i-h3-mapleboard-mp130.dts
+	sun8i-h3-nanopi-duo2.dts
 	sun8i-h3-nanopi-m1-plus.dts
 	sun8i-h3-nanopi-m1.dts
+	sun8i-h3-nanopi-r1.dts
 	sun8i-h3-nanopi-neo.dts
 	sun8i-h3-nanopi-neo-air.dts
 	sun8i-h3-orangepi-2.dts



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

2019-10-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Oct  8 23:03:01 UTC 2019

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

Log Message:
Add sun8i-h3-nanopi-duo2.dts and sun8i-h3-nanopi-r1.dts.

The former is untested.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/conf/GENERIC

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



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

2019-10-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Oct  8 23:00:36 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-r1.dts

Log Message:
Cherry pick a few changes from the armbian u-boot patch.

Makes my NanoPi R1 boot reliably.
>From 
>https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/add-nano+pi-r1-and-duo2.patch


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts

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



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

2019-10-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Oct  8 23:00:36 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-r1.dts

Log Message:
Cherry pick a few changes from the armbian u-boot patch.

Makes my NanoPi R1 boot reliably.
>From 
>https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/add-nano+pi-r1-and-duo2.patch


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts

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/dts/sun8i-h3-nanopi-r1.dts
diff -u src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts:1.1 src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts:1.2
--- src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts:1.1	Tue Oct  8 22:55:58 2019
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts	Tue Oct  8 23:00:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3-nanopi-r1.dts,v 1.1 2019/10/08 22:55:58 bad Exp $ */
+/* $NetBSD: sun8i-h3-nanopi-r1.dts,v 1.2 2019/10/08 23:00:36 bad Exp $ */
 
 /*
  * Copyright (C) 2019 Igor Pecovnik 
@@ -63,6 +63,7 @@
 
 	reg_gmac_3v3: gmac-3v3 {
 		compatible = "regulator-fixed";
+		pinctrl-names = "default";
 		regulator-name = "gmac-3v3";
 		regulator-min-microvolt = <330>;
 		regulator-max-microvolt = <330>;
@@ -129,6 +130,15 @@
 	};
 };
 
+#if 0 /* XXX u-boot dts for NanoPi R1 has this but not needed? */
+ {
+	gmac_power_pin_nanopi: gmac_power_pin@0 {
+		pins = "PD6";
+		function = "gpio_out";
+	};
+};
+#endif
+
  {
 	pinctrl-names = "default";
 	pinctrl-0 = <_rgmii_pins>;
@@ -170,6 +180,11 @@
 	vqmmc-supply = <_vcc3v3>;
 	bus-width = <8>;
 	non-removable;
+	cap-mmc-hw-reset;
+	status = "okay";
+};
+
+ {
 	status = "okay";
 };
 



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

2019-10-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Oct  8 22:55:59 UTC 2019

Added Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-duo2.dts sun8i-h3-nanopi-r1.dts

Log Message:
Add sun8i-h3-nanopi-r1.dts and sun8i-h3-nanopi-duo2.dts.

>From 
>https://github.com/armbian/build/blob/master/patch/kernel/sunxi-next/xxx-add-nanopi-r1-and-duo2.patch


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts \
src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts

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



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

2019-10-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Oct  8 22:55:59 UTC 2019

Added Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-duo2.dts sun8i-h3-nanopi-r1.dts

Log Message:
Add sun8i-h3-nanopi-r1.dts and sun8i-h3-nanopi-duo2.dts.

>From 
>https://github.com/armbian/build/blob/master/patch/kernel/sunxi-next/xxx-add-nanopi-r1-and-duo2.patch


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts \
src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts

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

Added files:

Index: src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts:1.1
--- /dev/null	Tue Oct  8 22:55:59 2019
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts	Tue Oct  8 22:55:58 2019
@@ -0,0 +1,99 @@
+/* $NetBSD: sun8i-h3-nanopi-duo2.dts,v 1.1 2019/10/08 22:55:58 bad Exp $ */
+
+/*
+ * Copyright (C) 2019 Igor 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun8i-h3-nanopi.dtsi"
+
+/ {
+	model = "FriendlyElec NanoPi-Duo2";
+	compatible = "friendlyarm,nanopi-duo2", "allwinner,sun8i-h3";
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		reset-gpios = <_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+		post-power-on-delay-ms = <200>;
+	};
+
+};
+
+_pio {
+	wifi_en_npi: wifi_en_pin {
+		pins = "PL7";
+		function = "gpio_out";
+	};
+};
+
+ {
+	vmmc-supply = <_vcc3v3>;
+	vqmmc-supply = <_vcc3v3>;
+	mmc-pwrseq = <_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+
+	sdio_wifi: sdio_wifi@1 {
+		reg = <1>;
+		compatible = "brcm,bcm4329-fmac";
+		interrupt-parent = <>;
+		interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
+		interrupt-names = "host-wake";
+	};
+
+};
+
+ {
+	phy-handle = <_mii_phy>;
+	phy-mode = "mii";
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
+_otg {
+	dr_mode = "peripheral";
+	status = "okay";
+};
+
+ {
+	status = "okay";
+};
Index: src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts:1.1
--- /dev/null	Tue Oct  8 22:55:59 2019
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts	Tue Oct  8 22:55:58 2019
@@ -0,0 +1,191 @@
+/* $NetBSD: sun8i-h3-nanopi-r1.dts,v 1.1 2019/10/08 22:55:58 bad Exp $ */
+
+/*
+ * Copyright (C) 2019 Igor Pecovnik 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or 

CVS commit: src/sys/dev/i2c

2019-10-08 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Oct  8 21:16:11 UTC 2019

Modified Files:
src/sys/dev/i2c: hytp14.c

Log Message:
enable FDT direct configuration.
remove address test as the i2c address can be changed on this device.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/hytp14.c

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



CVS commit: src/sys/dev/i2c

2019-10-08 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Oct  8 21:16:11 UTC 2019

Modified Files:
src/sys/dev/i2c: hytp14.c

Log Message:
enable FDT direct configuration.
remove address test as the i2c address can be changed on this device.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/hytp14.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/i2c/hytp14.c
diff -u src/sys/dev/i2c/hytp14.c:1.8 src/sys/dev/i2c/hytp14.c:1.9
--- src/sys/dev/i2c/hytp14.c:1.8	Sat Jun 16 21:24:36 2018
+++ src/sys/dev/i2c/hytp14.c	Tue Oct  8 21:16:11 2019
@@ -36,8 +36,32 @@
  *  $FILE/AHHYTM_E2.1.pdf
  */ 
 
+/*
+ * FDT direct configuration fragment to be added to i2cX definition in dtsi file
+ * like in bcm2835-rpi.dtsi or another specific file.
+ *
+ *  { 
+ * pinctrl-names = "default";
+ * pinctrl-0 = <_gpio2>;
+ * status = "okay";
+ * clock-frequency = <10>;
+ * #address-cells = <1>;
+ * #size-cells = <0>;
+ * hythygtemp@28 { 
+ * compatible = "ist-ag,i2c-hytp14";
+ * reg = <0x28>;
+ * status = "okay";
+ * };
+ * hythygtemp@29 { 
+ * compatible = "ist-ag,i2c-hytp14";
+ * reg = <0x29>;
+ * status = "okay";
+ * };
+ * };
+ */
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.8 2018/06/16 21:24:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.9 2019/10/08 21:16:11 kardel Exp $");
 
 #include 
 #include 
@@ -95,29 +119,30 @@ static struct hytp14_sensor hytp14_senso
 	}
 };
 
+static const struct device_compatible_entry compat_data[] = {
+{ "i2c-hytp14",   0 },
+{ NULL,   0 }
+}; 
+
 static int
 hytp14_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct i2c_attach_args *ia = aux;
 	int match_result;
 
-	if (iic_use_direct_match(ia, match, NULL, _result))
+	if (iic_use_direct_match(ia, match, compat_data, _result))
 		return match_result;
 
-	if (ia->ia_addr == 0x28)
-		return I2C_MATCH_ADDRESS_ONLY;
-	
 	/*
-	 * XXXJRT
-	 * This device is an odd-ball; the i2c address can be changed
-	 * at run-time using a command sequence documented in the
-	 * application note, but the timing is critical (within 10ms
-	 * after power-on of the device), and the device always starts
-	 * up at address 0x28.
-	 *
-	 * How should we handle this?
+	 * This device can be reprogrammed to use a different
+	 * I2C address, thus checking for specific addresses 
+	 * is not helpful here.
+ * reprogramming is done via setting new values in
+ * the device EEPROM via the hytctl utility and
+	 * a special GPIO setup - see hythygtemp(4) for more
+	 * information.
 	 */
-	return 0;
+	return I2C_MATCH_ADDRESS_ONLY;
 }
 
 static void



CVS commit: src/external/bsd/iscsi/dist/src/lib

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 20:02:45 UTC 2019

Modified Files:
src/external/bsd/iscsi/dist/src/lib: target.c

Log Message:
grow the buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/iscsi/dist/src/lib/target.c

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



CVS commit: src/external/bsd/iscsi/dist/src/lib

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 20:02:45 UTC 2019

Modified Files:
src/external/bsd/iscsi/dist/src/lib: target.c

Log Message:
grow the buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/iscsi/dist/src/lib/target.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/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.9 src/external/bsd/iscsi/dist/src/lib/target.c:1.10
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.9	Fri Nov 14 20:15:45 2014
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Tue Oct  8 16:02:44 2019
@@ -2089,7 +2089,7 @@ iscsi_target_listen(iscsi_target_t *tgt)
 	target_session_t	*sess;
 	socklen_t		remoteAddrLen;
 	socklen_t		localAddrLen;
-	char			targetaddress[1024];
+	char			targetaddress[2 * 1024];
 	char			remote[1024];
 	char			local[1024];
 	char			*config;



CVS commit: src/lib/libisns

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:38:27 UTC 2019

Modified Files:
src/lib/libisns: isns.c

Log Message:
use strlcpy (the buffer is already zeroed)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/lib/libisns/isns.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/libisns/isns.c
diff -u src/lib/libisns/isns.c:1.1.1.1 src/lib/libisns/isns.c:1.2
--- src/lib/libisns/isns.c:1.1.1.1	Sat Jan 15 20:22:50 2011
+++ src/lib/libisns/isns.c	Tue Oct  8 15:38:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: isns.c,v 1.1.1.1 2011/01/16 01:22:50 agc Exp $	*/
+/*	$NetBSD: isns.c,v 1.2 2019/10/08 19:38:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: isns.c,v 1.1.1.1 2011/01/16 01:22:50 agc Exp $");
+__RCSID("$NetBSD: isns.c,v 1.2 2019/10/08 19:38:27 christos Exp $");
 
 /*
  * isns.c
@@ -153,7 +153,7 @@ isns_add_servercon(ISNS_HANDLE isns_hand
 			return ENOMEM;
 		}
 		memset(ai_p->ai_canonname, '\0', len + 1);
-		strncpy(ai_p->ai_canonname, ai->ai_canonname, len);
+		strlcpy(ai_p->ai_canonname, ai->ai_canonname, len + 1);
 	} else
 		ai_p->ai_canonname = NULL;
 	if (ai->ai_addr != NULL) { 



CVS commit: src/lib/libisns

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:38:38 UTC 2019

Modified Files:
src/lib/libisns: isns_pdu.h

Log Message:
remove useless packed attributes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libisns/isns_pdu.h

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



CVS commit: src/lib/libisns

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:38:38 UTC 2019

Modified Files:
src/lib/libisns: isns_pdu.h

Log Message:
remove useless packed attributes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libisns/isns_pdu.h

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

Modified files:

Index: src/lib/libisns/isns_pdu.h
diff -u src/lib/libisns/isns_pdu.h:1.3 src/lib/libisns/isns_pdu.h:1.4
--- src/lib/libisns/isns_pdu.h:1.3	Mon Nov 28 07:44:18 2011
+++ src/lib/libisns/isns_pdu.h	Tue Oct  8 15:38:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: isns_pdu.h,v 1.3 2011/11/28 12:44:18 joerg Exp $	*/
+/*	$NetBSD: isns_pdu.h,v 1.4 2019/10/08 19:38:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
@@ -171,12 +171,12 @@ struct isns_trans_s {
 };
 
 struct isns_pdu_hdr_s {
-	uint16_t isnsp_version	__packed;
-	uint16_t func_id	__packed;
-	uint16_t payload_len	__packed;
-	uint16_t flags		__packed;
-	uint16_t trans_id	__packed;
-	uint16_t seq_id		__packed;
+	uint16_t isnsp_version;
+	uint16_t func_id;
+	uint16_t payload_len;
+	uint16_t flags;
+	uint16_t trans_id;
+	uint16_t seq_id;
 };
 
 struct isns_pdu_s {



CVS commit: src/lib/libisns

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:38:27 UTC 2019

Modified Files:
src/lib/libisns: isns.c

Log Message:
use strlcpy (the buffer is already zeroed)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/lib/libisns/isns.c

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



CVS commit: src/lib/libedit

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:21:40 UTC 2019

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
remore error(1) comment


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/lib/libedit/filecomplete.c

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



CVS commit: src/lib/libedit

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:21:40 UTC 2019

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
remore error(1) comment


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/lib/libedit/filecomplete.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/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.59 src/lib/libedit/filecomplete.c:1.60
--- src/lib/libedit/filecomplete.c:1.59	Tue Oct  8 15:17:57 2019
+++ src/lib/libedit/filecomplete.c	Tue Oct  8 15:21:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.59 2019/10/08 19:17:57 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.60 2019/10/08 19:21:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.59 2019/10/08 19:17:57 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.60 2019/10/08 19:21:40 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -462,7 +462,6 @@ out:
  */
 char ** completion_matches(const char *, char *(*)(const char *, int));
 char **
-/*###467 [lint] completion_matches arg 1 declared inconsistently (pointer to const char != pointer to char) filecomplete.c(467) :: readline.c?(53)%%%*/
 completion_matches(const char *text, char *(*genfunc)(const char *, int))
 {
 	char **match_list = NULL, *retstr, *prevstr;



CVS commit: src/lib/libedit

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:17:57 UTC 2019

Modified Files:
src/lib/libedit: filecomplete.c history.c readline.c

Log Message:
Change strncpy to either memcpy (when we know the len), or strlcpy (when
we used to NUL terminate explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/lib/libedit/filecomplete.c
cvs rdiff -u -r1.62 -r1.63 src/lib/libedit/history.c
cvs rdiff -u -r1.157 -r1.158 src/lib/libedit/readline.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/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.58 src/lib/libedit/filecomplete.c:1.59
--- src/lib/libedit/filecomplete.c:1.58	Sun Sep  8 01:50:58 2019
+++ src/lib/libedit/filecomplete.c	Tue Oct  8 15:17:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.58 2019/09/08 05:50:58 abhinav Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.59 2019/10/08 19:17:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.58 2019/09/08 05:50:58 abhinav Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.59 2019/10/08 19:17:57 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -86,8 +86,7 @@ fn_tilde_expand(const char *txt)
 		temp = el_calloc(len, sizeof(*temp));
 		if (temp == NULL)
 			return NULL;
-		(void)strncpy(temp, txt + 1, len - 2);
-		temp[len - 2] = '\0';
+		(void)strlcpy(temp, txt + 1, len - 2);
 	}
 	if (temp[0] == 0) {
 #ifdef HAVE_GETPW_R_POSIX
@@ -354,8 +353,7 @@ fn_filename_completion_function(const ch
 return NULL;
 			}
 			dirname = nptr;
-			(void)strncpy(dirname, text, len);
-			dirname[len] = '\0';
+			(void)strlcpy(dirname, text, len);
 		} else {
 			el_free(filename);
 			if (*text == 0)
@@ -464,6 +462,7 @@ out:
  */
 char ** completion_matches(const char *, char *(*)(const char *, int));
 char **
+/*###467 [lint] completion_matches arg 1 declared inconsistently (pointer to const char != pointer to char) filecomplete.c(467) :: readline.c?(53)%%%*/
 completion_matches(const char *text, char *(*genfunc)(const char *, int))
 {
 	char **match_list = NULL, *retstr, *prevstr;
@@ -509,8 +508,7 @@ completion_matches(const char *text, cha
 		el_free(match_list);
 		return NULL;
 	}
-	(void)strncpy(retstr, match_list[1], max_equal);
-	retstr[max_equal] = '\0';
+	(void)strlcpy(retstr, match_list[1], max_equal);
 	match_list[0] = retstr;
 
 	/* add NULL as last pointer to the array */

Index: src/lib/libedit/history.c
diff -u src/lib/libedit/history.c:1.62 src/lib/libedit/history.c:1.63
--- src/lib/libedit/history.c:1.62	Thu Sep 13 05:03:40 2018
+++ src/lib/libedit/history.c	Tue Oct  8 15:17:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.62 2018/09/13 09:03:40 kre Exp $	*/
+/*	$NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.62 2018/09/13 09:03:40 kre Exp $");
+__RCSID("$NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -411,21 +411,23 @@ static int
 history_def_add(void *p, TYPE(HistEvent) *ev, const Char *str)
 {
 	history_t *h = (history_t *) p;
-	size_t len;
+	size_t len, elen, slen;
 	Char *s;
 	HistEventPrivate *evp = (void *)>cursor->ev;
 
 	if (h->cursor == >list)
 		return history_def_enter(p, ev, str);
-	len = Strlen(evp->str) + Strlen(str) + 1;
+	elen = Strlen(evp->str);
+	slen = Strlen(str);
+	len = elen + slen + 1;
 	s = h_malloc(len * sizeof(*s));
 	if (s == NULL) {
 		he_seterrev(ev, _HE_MALLOC_FAILED);
 		return -1;
 	}
-	(void) Strncpy(s, h->cursor->ev.str, len);
+	memcpy(s, evp->str, elen * sizeof(*s));
+	memcpy(s + elen, str, slen * sizeof(*s)); 
 s[len - 1] = '\0';
-	(void) Strncat(s, str, len - Strlen(s) - 1);
 	h_free(evp->str);
 	evp->str = s;
 	*ev = h->cursor->ev;

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.157 src/lib/libedit/readline.c:1.158
--- src/lib/libedit/readline.c:1.157	Wed Aug 21 07:11:48 2019
+++ src/lib/libedit/readline.c	Tue Oct  8 15:17:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.158 2019/10/08 19:17:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.158 2019/10/08 19:17:57 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -521,7 +521,7 @@ _rl_compat_sub(const char *str, const ch
 	s = str;
 	while (*s) {
 		if (*s == *what && !strncmp(s, what, what_len)) {
-			(void)strncpy(r, 

CVS commit: src/lib/libedit

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 19:17:57 UTC 2019

Modified Files:
src/lib/libedit: filecomplete.c history.c readline.c

Log Message:
Change strncpy to either memcpy (when we know the len), or strlcpy (when
we used to NUL terminate explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/lib/libedit/filecomplete.c
cvs rdiff -u -r1.62 -r1.63 src/lib/libedit/history.c
cvs rdiff -u -r1.157 -r1.158 src/lib/libedit/readline.c

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



CVS commit: src/sys/arch

2019-10-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Oct  8 18:50:44 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
No I/O ports for TPM-ISA, only MMIO, so remove commented-out options.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.537 -r1.538 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.471 -r1.472 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1211 -r1.1212 src/sys/arch/i386/conf/GENERIC

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



CVS commit: src/lib/libutil

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 18:50:34 UTC 2019

Modified Files:
src/lib/libutil: Makefile

Log Message:
-Wstringop-truncation is only gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/lib/libutil/Makefile

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



CVS commit: src/lib/libutil

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 18:50:34 UTC 2019

Modified Files:
src/lib/libutil: Makefile

Log Message:
-Wstringop-truncation is only gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/lib/libutil/Makefile

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

Modified files:

Index: src/lib/libutil/Makefile
diff -u src/lib/libutil/Makefile:1.83 src/lib/libutil/Makefile:1.84
--- src/lib/libutil/Makefile:1.83	Thu Oct  3 20:03:56 2019
+++ src/lib/libutil/Makefile	Tue Oct  8 14:50:34 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.83 2019/10/04 00:03:56 christos Exp $
+#	$NetBSD: Makefile,v 1.84 2019/10/08 18:50:34 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=	yes
@@ -39,10 +39,10 @@ CPPFLAGS.sockaddr_snprintf.c+=-DHAVE_UTI
 CPPFLAGS.sockaddr_snprintf.c+=-DHAVE_NETATALK_AT_H
 CPPFLAGS.sockaddr_snprintf.c+=-DHAVE_NET_IF_DL_H
 
-#.if ${HAVE_GCC:U0} > 7
+.if ${ACTIVE_CC} == "gcc"
 COPTS.logwtmp.c += -Wno-stringop-truncation
 COPTS.logwtmpx.c += -Wno-stringop-truncation
-#.endif
+.endif
 
 YPREFIX=__pd
 .PATH:	${NETBSDSRCDIR}/lib/libc/gen



CVS commit: src/sys/arch

2019-10-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Oct  8 18:50:44 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
No I/O ports for TPM-ISA, only MMIO, so remove commented-out options.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.537 -r1.538 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.471 -r1.472 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1211 -r1.1212 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.124 src/sys/arch/amd64/conf/ALL:1.125
--- src/sys/arch/amd64/conf/ALL:1.124	Mon Oct  7 11:53:40 2019
+++ src/sys/arch/amd64/conf/ALL	Tue Oct  8 18:50:44 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.124 2019/10/07 11:53:40 msaitoh Exp $
+# $NetBSD: ALL,v 1.125 2019/10/08 18:50:44 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.124 $"
+#ident		"ALL-$Revision: 1.125 $"
 
 maxusers	64		# estimated number of users
 
@@ -1549,13 +1549,8 @@ btsco* at bthub?
 hifn*	at pci? dev ? function ?	# Hifn 7755/7811/795x
 ubsec*	at pci? dev ? function ?	# Broadcom 5501/5601/580x/582x
 
-
 # Trusted Platform Module
 tpm*	at isa? iomem 0xfed4 irq 7
-#tpm*	at isa? port 0x02e
-#tpm*	at isa? port 0x04e
-#tpm*	at isa? port 0x07e
-#tpm*	at isa? port 0x0ee
 
 # Joysticks
 

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.537 src/sys/arch/amd64/conf/GENERIC:1.538
--- src/sys/arch/amd64/conf/GENERIC:1.537	Mon Oct  7 11:53:40 2019
+++ src/sys/arch/amd64/conf/GENERIC	Tue Oct  8 18:50:44 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.537 2019/10/07 11:53:40 msaitoh Exp $
+# $NetBSD: GENERIC,v 1.538 2019/10/08 18:50:44 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.537 $"
+#ident		"GENERIC-$Revision: 1.538 $"
 
 maxusers	64		# estimated number of users
 
@@ -437,10 +437,6 @@ ubsec*	at pci? dev ? function ?	# Broadc
 
 # Trusted Platform Module
 tpm*	at isa? iomem 0xfed4 irq 7
-#tpm*	at isa? port 0x02e
-#tpm*	at isa? port 0x04e
-#tpm*	at isa? port 0x07e
-#tpm*	at isa? port 0x0ee
 
 # Serial Devices
 

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.471 src/sys/arch/i386/conf/ALL:1.472
--- src/sys/arch/i386/conf/ALL:1.471	Mon Oct  7 11:53:40 2019
+++ src/sys/arch/i386/conf/ALL	Tue Oct  8 18:50:44 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.471 2019/10/07 11:53:40 msaitoh Exp $
+# $NetBSD: ALL,v 1.472 2019/10/08 18:50:44 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.471 $"
+#ident		"ALL-$Revision: 1.472 $"
 
 maxusers	64		# estimated number of users
 
@@ -1667,13 +1667,8 @@ glxsb*	at pci? dev ? function ?	# AMD Ge
 hifn*	at pci? dev ? function ?	# Hifn 7755/7811/795x
 ubsec*	at pci? dev ? function ?	# Broadcom 5501/5601/580x/582x
 
-
 # Trusted Platform Module
 tpm*	at isa? iomem 0xfed4 irq 7
-#tpm*	at isa? port 0x02e
-#tpm*	at isa? port 0x04e
-#tpm*	at isa? port 0x07e
-#tpm*	at isa? port 0x0ee
 
 # Joysticks
 

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1211 src/sys/arch/i386/conf/GENERIC:1.1212
--- src/sys/arch/i386/conf/GENERIC:1.1211	Mon Oct  7 11:53:40 2019
+++ src/sys/arch/i386/conf/GENERIC	Tue Oct  8 18:50:44 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1211 2019/10/07 11:53:40 msaitoh Exp $
+# $NetBSD: GENERIC,v 1.1212 2019/10/08 18:50:44 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1211 $"
+#ident		"GENERIC-$Revision: 1.1212 $"
 
 maxusers	64		# estimated number of users
 
@@ -1367,10 +1367,6 @@ ubsec*	at pci? dev ? function ?	# Broadc
 
 # Trusted Platform Module
 tpm*	at isa? iomem 0xfed4 irq 7
-#tpm*	at isa? port 0x02e
-#tpm*	at isa? port 0x04e
-#tpm*	at isa? port 0x07e
-#tpm*	at isa? port 0x0ee
 
 # Joysticks
 



CVS commit: src/crypto/external/bsd/netpgp/dist/src/netpgpverify

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 18:47:11 UTC 2019

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: libverify.c

Log Message:
grow the buffer a little.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c

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



CVS commit: src/crypto/external/bsd/netpgp/dist/src/netpgpverify

2019-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  8 18:47:11 UTC 2019

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: libverify.c

Log Message:
grow the buffer a little.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.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/netpgp/dist/src/netpgpverify/libverify.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.13 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.14
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.13	Mon Apr 17 15:50:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c	Tue Oct  8 14:47:10 2019
@@ -2622,7 +2622,7 @@ read_ssh_file(pgpv_t *pgp, pgpv_primaryk
 	int64_t			 off;
 	va_list			 args;
 	char			 hostname[256];
-	char			 owner[256];
+	char			 owner[2 * 256];
 	char			*space;
 	char		 	*buf;
 	char		 	*bin;



CVS commit: src

2019-10-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Oct  8 18:43:03 UTC 2019

Modified Files:
src/share/man/man4: tpm.4
src/sys/dev/acpi: tpm_acpi.c
src/sys/dev/ic: tpm.c tpmreg.h tpmvar.h
src/sys/dev/isa: tpm_isa.c

Log Message:
Improvements in tpm(4):
 - Remove interrupt support, do polling only, avoids unnecessary trouble.
 - Simplify a few things.
 - Fix the suspend function, the SaveState command is 0x98, not 0x9C.
 - Make the driver MP-safe.
 - Sync the man page with reality.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/tpm.4
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/tpm_acpi.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/tpm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/tpmreg.h src/sys/dev/ic/tpmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/isa/tpm_isa.c

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

Modified files:

Index: src/share/man/man4/tpm.4
diff -u src/share/man/man4/tpm.4:1.4 src/share/man/man4/tpm.4:1.5
--- src/share/man/man4/tpm.4:1.4	Thu Feb 22 01:40:49 2018
+++ src/share/man/man4/tpm.4	Tue Oct  8 18:43:03 2019
@@ -1,20 +1,33 @@
-.\"	$NetBSD: tpm.4,v 1.4 2018/02/22 01:40:49 pgoyette Exp $
+.\"	$NetBSD: tpm.4,v 1.5 2019/10/08 18:43:03 maxv Exp $
 .\"
-.\" Copyright (c) 2010 Hans-Jörg Höxer, 
+.\" Copyright (c) 2019 The NetBSD Foundation, Inc.
+.\" All rights reserved.
 .\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Maxime Villard.
 .\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\" 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.
 .\"
-.Dd February 22, 2018
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``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 FOUNDATION OR CONTRIBUTORS
+.\" 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 October 6, 2019
 .Dt TPM 4
 .Os
 .Sh NAME
@@ -22,40 +35,22 @@
 .Nd Trusted Platform Module
 .Sh SYNOPSIS
 .Cd "tpm* at isa? iomem 0xfed4"
-.Cd "tpm* at isa? iomem 0xfed4 irq 7"
 .Cd "tpm* at acpi?"
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for various trusted platform modules (TPM) that can
-store cryptographic keys.
+driver provides support for various Trusted Platform Module (TPM) chips.
 .Pp
 Supported modules:
 .Pp
 .Bl -bullet -compact -offset indent
 .It
-Atmel 97SC3203
-.It
-Broadcom BCM0102
-.It
-Infineon IFX SLD 9630 TT 1.1 and IFX SLB 9635 TT 1.2
-.It
-Intel INTC0102
-.It
-Sinosun SNS SSX35
-.It
-STM ST19WP18
+TPM 2.0 chips over ACPI
 .It
-Winbond WEC WPCT200
+TPM 1.2 chips over ISA
 .El
 .Pp
-The driver can be configured to use an IRQ by providing a free ISA
-interrupt vector using the keyword
-.Em irq
-in the kernel configuration file or using
-.Xr config 1 .
-If not IRQ is specified, the driver uses polling.
-This is the default configuration.
+Note that the supported interface version is TIS1.2 in each case.
 .Sh SEE ALSO
 .Xr config 1 ,
 .Xr intro 4
@@ -64,6 +59,7 @@ This is the default configuration.
 The
 .Nm
 driver was written by
+.An Maxime Villard ,
 .An Michael Shalayeff
 and
 .An Hans-Joerg Hoexer .

Index: src/sys/dev/acpi/tpm_acpi.c
diff -u 

CVS commit: src

2019-10-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Oct  8 18:43:03 UTC 2019

Modified Files:
src/share/man/man4: tpm.4
src/sys/dev/acpi: tpm_acpi.c
src/sys/dev/ic: tpm.c tpmreg.h tpmvar.h
src/sys/dev/isa: tpm_isa.c

Log Message:
Improvements in tpm(4):
 - Remove interrupt support, do polling only, avoids unnecessary trouble.
 - Simplify a few things.
 - Fix the suspend function, the SaveState command is 0x98, not 0x9C.
 - Make the driver MP-safe.
 - Sync the man page with reality.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/tpm.4
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/tpm_acpi.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/tpm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/tpmreg.h src/sys/dev/ic/tpmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/isa/tpm_isa.c

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



CVS commit: [netbsd-8] src/doc

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:18:30 UTC 2019

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

Log Message:
Tickets #1401 - #1403


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.48 -r1.1.2.49 src/doc/CHANGES-8.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-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.48 src/doc/CHANGES-8.2:1.1.2.49
--- src/doc/CHANGES-8.2:1.1.2.48	Fri Oct  4 11:35:44 2019
+++ src/doc/CHANGES-8.2	Tue Oct  8 18:18:30 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.48 2019/10/04 11:35:44 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.49 2019/10/08 18:18:30 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1254,3 +1254,20 @@ sys/arch/i386/stand/pxeboot/start_pxe.S	
 	Incrase pxeboot code size limit from 64k to 128k.
 	[manu, ticket #1400]
 
+sys/net/if_ethersubr.c1.255
+
+	The ALTQ classifier for Ethernet frames did not work in some
+	cases.
+	[ozaki-r, ticket #1401]
+
+
+sys/net/if_ethersubr.c1.277
+
+	Increment if_iqdrops when dropping an oversized frame.
+	[msaitoh, ticket #1402]
+
+sys/dev/pci/ixgbe/ixv.c1.139
+
+	ixv(4): set MTU correctly if mtu > 1500.
+	[msaitoh, ticket #1403]
+



CVS commit: [netbsd-8] src/doc

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:18:30 UTC 2019

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

Log Message:
Tickets #1401 - #1403


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.48 -r1.1.2.49 src/doc/CHANGES-8.2

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



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

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:16:50 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1403):

sys/dev/pci/ixgbe/ixv.c: revision 1.139

Set MTU correctly if mtu > 1500.


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.25 -r1.56.2.26 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.



CVS commit: [netbsd-8] src/sys/net

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:12:44 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1402):

sys/net/if_ethersubr.c: revision 1.277

Increment if_iqdrops when dropping an oversized frame.


To generate a diff of this commit:
cvs rdiff -u -r1.242.6.6 -r1.242.6.7 src/sys/net/if_ethersubr.c

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



CVS commit: [netbsd-8] src/sys/net

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:12:44 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1402):

sys/net/if_ethersubr.c: revision 1.277

Increment if_iqdrops when dropping an oversized frame.


To generate a diff of this commit:
cvs rdiff -u -r1.242.6.6 -r1.242.6.7 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.242.6.6 src/sys/net/if_ethersubr.c:1.242.6.7
--- src/sys/net/if_ethersubr.c:1.242.6.6	Tue Oct  8 18:09:41 2019
+++ src/sys/net/if_ethersubr.c	Tue Oct  8 18:12:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.242.6.6 2019/10/08 18:09:41 martin Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.242.6.7 2019/10/08 18:12:44 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.6 2019/10/08 18:09:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.7 2019/10/08 18:12:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -603,6 +603,7 @@ ether_input(struct ifnet *ifp, struct mb
 			ifp->if_xname, m->m_pkthdr.len);
 		}
 		mutex_exit(_lock);
+		ifp->if_iqdrops++;
 		m_freem(m);
 		return;
 	}



CVS commit: [netbsd-8] src/sys/net

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:09:41 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1401):

sys/net/if_ethersubr.c: revision 1.255

Fix two bugs in altq_etherclassify. When scanning the mbuf chain we need
to make sure that m_next is not NULL, otherwise NULL deref. After that,
we must not touch m->m_pkthdr, given that 'm' may not be the first mbuf
of the chain anymore.

Declare mtop, and add a KASSERT to make sure it has M_PKTHDR set.


To generate a diff of this commit:
cvs rdiff -u -r1.242.6.5 -r1.242.6.6 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.242.6.5 src/sys/net/if_ethersubr.c:1.242.6.6
--- src/sys/net/if_ethersubr.c:1.242.6.5	Tue Mar 13 15:40:25 2018
+++ src/sys/net/if_ethersubr.c	Tue Oct  8 18:09:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.242.6.5 2018/03/13 15:40:25 martin Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.242.6.6 2019/10/08 18:09:41 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.5 2018/03/13 15:40:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.6 2019/10/08 18:09:41 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -463,10 +463,13 @@ void
 altq_etherclassify(struct ifaltq *ifq, struct mbuf *m)
 {
 	struct ether_header *eh;
+	struct mbuf *mtop = m;
 	uint16_t ether_type;
 	int hlen, af, hdrsize;
 	void *hdr;
 
+	KASSERT((mtop->m_flags & M_PKTHDR) != 0);
+
 	hlen = ETHER_HDR_LEN;
 	eh = mtod(m, struct ether_header *);
 
@@ -508,7 +511,10 @@ altq_etherclassify(struct ifaltq *ifq, s
 	while (m->m_len <= hlen) {
 		hlen -= m->m_len;
 		m = m->m_next;
+		if (m == NULL)
+			goto bad;
 	}
+
 	if (m->m_len < (hlen + hdrsize)) {
 		/*
 		 * protocol header not in a single mbuf.
@@ -527,11 +533,12 @@ altq_etherclassify(struct ifaltq *ifq, s
 
 	hdr = mtod(m, void *);
 
-	if (ALTQ_NEEDS_CLASSIFY(ifq))
-		m->m_pkthdr.pattr_class =
+	if (ALTQ_NEEDS_CLASSIFY(ifq)) {
+		mtop->m_pkthdr.pattr_class =
 		(*ifq->altq_classify)(ifq->altq_clfier, m, af);
-	m->m_pkthdr.pattr_af = af;
-	m->m_pkthdr.pattr_hdr = hdr;
+	}
+	mtop->m_pkthdr.pattr_af = af;
+	mtop->m_pkthdr.pattr_hdr = hdr;
 
 	m->m_data -= hlen;
 	m->m_len += hlen;
@@ -539,9 +546,9 @@ altq_etherclassify(struct ifaltq *ifq, s
 	return;
 
 bad:
-	m->m_pkthdr.pattr_class = NULL;
-	m->m_pkthdr.pattr_hdr = NULL;
-	m->m_pkthdr.pattr_af = AF_UNSPEC;
+	mtop->m_pkthdr.pattr_class = NULL;
+	mtop->m_pkthdr.pattr_hdr = NULL;
+	mtop->m_pkthdr.pattr_af = AF_UNSPEC;
 }
 #endif /* ALTQ */
 



CVS commit: src/sys/kern

2019-10-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Oct  8 18:02:46 UTC 2019

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

Log Message:
Enhance reliability of ptrace(2) in a debuggee with multiple LWPs

Stop competing between threads which one emits event signal quicker and
overwriting the signal from another thread.

This fixes missed in action signals.

NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without
reports of missed ones.

his was one of the reasons why debuggee with multiple threads misbehaved
under a debugger.

This change is v.2 of the previously reverted commit for the same fix.

This version contains recovery path that stopps triggering event SIGTRAP
for a detached debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/kern/kern_sig.c

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



CVS commit: src/sys/kern

2019-10-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Oct  8 18:02:46 UTC 2019

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

Log Message:
Enhance reliability of ptrace(2) in a debuggee with multiple LWPs

Stop competing between threads which one emits event signal quicker and
overwriting the signal from another thread.

This fixes missed in action signals.

NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without
reports of missed ones.

his was one of the reasons why debuggee with multiple threads misbehaved
under a debugger.

This change is v.2 of the previously reverted commit for the same fix.

This version contains recovery path that stopps triggering event SIGTRAP
for a detached debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.366 src/sys/kern/kern_sig.c:1.367
--- src/sys/kern/kern_sig.c:1.366	Thu Oct  3 22:48:44 2019
+++ src/sys/kern/kern_sig.c	Tue Oct  8 18:02:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.366 2019/10/03 22:48:44 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.367 2019/10/08 18:02:46 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.366 2019/10/03 22:48:44 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.367 2019/10/08 18:02:46 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -913,6 +913,7 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -926,6 +927,16 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 		/* NOTREACHED */
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, false);
+		mutex_enter(proc_lock);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	mask = >l_sigmask;
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;
@@ -1589,11 +1600,12 @@ eventswitch(int code, int pe_report_even
 	KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) ||
 	(code == TRAP_EXEC));
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
 	 * This avoids notifying tracer and deadlocking.
-	*/
+	 */
 	if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) {
 		mutex_exit(p->p_lock);
 		mutex_exit(proc_lock);
@@ -1603,6 +1615,17 @@ eventswitch(int code, int pe_report_even
 	}
 
 	/*
+	 * If we are no longer traced, abandon this event signal.
+	 *
+	 * This avoids killing a process after detaching the debugger.
+	 */
+	if (__predict_false(!ISSET(p->p_slflag, PSL_TRACED))) {
+		mutex_exit(p->p_lock);
+		mutex_exit(proc_lock);
+		return;
+	}
+
+	/*
 	 * If there's a pending SIGKILL process it immediately.
 	 */
 	if (p->p_xsig == SIGKILL ||
@@ -1612,6 +1635,16 @@ eventswitch(int code, int pe_report_even
 		return;
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, false);
+		mutex_enter(proc_lock);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	KSI_INIT_TRAP();
 	ksi.ksi_lid = l->l_lid;
 	ksi.ksi_signo = signo;
@@ -2448,6 +2481,7 @@ proc_stoptrace(int trapno, int sysnum, c
 
 	mutex_enter(p->p_lock);
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -2469,6 +2503,25 @@ proc_stoptrace(int trapno, int sysnum, c
 		return;
 	}
 
+	/*
+	 * If we are no longer traced, abandon this event signal.
+	 *
+	 * This avoids killing a process after detaching the debugger.
+	 */
+	if (__predict_false(!ISSET(p->p_slflag, PSL_TRACED))) {
+		mutex_exit(p->p_lock);
+		return;
+	}
+
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, true);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	/* Needed for ktrace */
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;



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

2019-10-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct  8 17:41:04 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h

Log Message:
 Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.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/external/bsd/drm2/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.12 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.13
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.12	Tue Oct  1 18:41:58 2019
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Tue Oct  8 17:41:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_reg.h,v 1.12 2019/10/01 18:41:58 msaitoh Exp $	*/
+/*	$NetBSD: i915_reg.h,v 1.13 2019/10/08 17:41:04 msaitoh Exp $	*/
 
 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -1645,7 +1645,7 @@ enum skl_disp_power_wells {
 
 #define ERROR_GEN6	0x040a0
 #define GEN7_ERR_INT	0x44040
-#define   ERR_INT_POISON		(1<<31)
+#define   ERR_INT_POISON		(1U<<31)
 #define   ERR_INT_MMIO_UNCLAIMED	(1<<13)
 #define   ERR_INT_PIPE_CRC_DONE_C	(1<<8)
 #define   ERR_INT_FIFO_UNDERRUN_C	(1<<6)
@@ -3481,7 +3481,7 @@ enum skl_disp_power_wells {
 #define   VIDEO_DIP_VSC_DATA_SIZE	36
 #define VIDEO_DIP_CTL		0x61170
 /* Pre HSW: */
-#define   VIDEO_DIP_ENABLE		(1 << 31)
+#define   VIDEO_DIP_ENABLE		(1U << 31)
 #define   VIDEO_DIP_PORT(port)		((port) << 29)
 #define   VIDEO_DIP_PORT_MASK		(3 << 29)
 #define   VIDEO_DIP_ENABLE_GCP		(1 << 25)
@@ -6091,7 +6091,7 @@ enum skl_disp_power_wells {
 #define SDEIER  0xc400c
 
 #define SERR_INT			0xc4040
-#define  SERR_INT_POISON		(1<<31)
+#define  SERR_INT_POISON		(1U<<31)
 #define  SERR_INT_TRANS_C_FIFO_UNDERRUN	(1<<6)
 #define  SERR_INT_TRANS_B_FIFO_UNDERRUN	(1<<3)
 #define  SERR_INT_TRANS_A_FIFO_UNDERRUN	(1<<0)



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

2019-10-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct  8 17:41:04 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h

Log Message:
 Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h

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



CVS commit: [netbsd-9] src/doc

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:06:28 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #291 - #293


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.71 -r1.1.2.72 src/doc/CHANGES-9.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-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.71 src/doc/CHANGES-9.0:1.1.2.72
--- src/doc/CHANGES-9.0:1.1.2.71	Sun Oct  6 11:20:50 2019
+++ src/doc/CHANGES-9.0	Tue Oct  8 17:06:28 2019
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-9.0,v 1.1.2.71 2019/10/06 11:20:50 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.72 2019/10/08 17:06:28 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -4340,3 +4340,19 @@ sys/arch/evbarm/conf/GENERIC			1.53
 	Disable tegradrm for now as it causes random crashes.
 	[skrll, ticket #290]
 
+sys/dev/fdt/cpufreq_dt.c			1.9,1.10
+
+	Change sysctl to be named after the first CPU in the DVFS domain.
+	[jmcneill, ticket #291]
+
+sys/net/if_ethersubr.c1.277,1.278
+
+	- Increment if_iqdrops when dropping an oversized frame.
+	- Print oversized frame message only when DIAGNOSTIC is set.
+	[msaitoh, ticket #292]
+
+sys/dev/pci/ixgbe/ixv.c1.139
+
+	ixv(4): set MTU correctly if mtu > 1500.
+	[msaitoh, ticket #293]
+



CVS commit: [netbsd-9] src/doc

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:06:28 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #291 - #293


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.71 -r1.1.2.72 src/doc/CHANGES-9.0

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



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

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:05:16 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #293):

sys/dev/pci/ixgbe/ixv.c: revision 1.139

Set MTU correctly if mtu > 1500.


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.4 -r1.125.2.5 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.125.2.4 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.4	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Oct  8 17:05:16 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.4 2019/09/26 19:07:22 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.5 2019/10/08 17:05:16 martin Exp $*/
 
 /**
 
@@ -716,6 +716,9 @@ ixv_init_locked(struct adapter *adapter)
 	for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++)
 		que->disabled_count = 0;
 
+	adapter->max_frame_size =
+	ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
 	/* reprogram the RAR[0] in case user changed it. */
 	hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
 
@@ -748,10 +751,10 @@ ixv_init_locked(struct adapter *adapter)
 	 * Determine the correct mbuf pool
 	 * for doing jumbo/headersplit
 	 */
-	if (ifp->if_mtu > ETHERMTU)
-		adapter->rx_mbuf_sz = MJUMPAGESIZE;
-	else
+	if (adapter->max_frame_size <= MCLBYTES)
 		adapter->rx_mbuf_sz = MCLBYTES;
+	else
+		adapter->rx_mbuf_sz = MJUMPAGESIZE;
 
 	/* Prepare receive descriptors and buffers */
 	if (ixgbe_setup_receive_structures(adapter)) {



CVS commit: [netbsd-9] src/sys/net

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:02:25 UTC 2019

Modified Files:
src/sys/net [netbsd-9]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #292):

sys/net/if_ethersubr.c: revision 1.277
sys/net/if_ethersubr.c: revision 1.278

Increment if_iqdrops when dropping an oversized frame.

 -

Print oversized frame's message only when DIAGNOSTIC is set. The message
is not so important because we increment if_iqdrops now.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.276.2.1 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.276 src/sys/net/if_ethersubr.c:1.276.2.1
--- src/sys/net/if_ethersubr.c:1.276	Wed Jul 17 03:26:24 2019
+++ src/sys/net/if_ethersubr.c	Tue Oct  8 17:02:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.276 2019/07/17 03:26:24 msaitoh Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.276.2.1 2019/10/08 17:02:24 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.276 2019/07/17 03:26:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.276.2.1 2019/10/08 17:02:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -164,10 +164,12 @@ extern u_char	aarp_org_code[3];
 #include 
 #endif
 
+#ifdef DIAGNOSTIC
 static struct timeval bigpktppslim_last;
 static int bigpktppslim = 2;	/* XXX */
 static int bigpktpps_count;
 static kmutex_t bigpktpps_lock __cacheline_aligned;
+#endif
 
 const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN] =
 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -612,6 +614,7 @@ ether_input(struct ifnet *ifp, struct mb
 	 */
 	if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len >
 	ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) {
+#ifdef DIAGNOSTIC
 		mutex_enter(_lock);
 		if (ppsratecheck(_last, _count,
 		bigpktppslim)) {
@@ -619,6 +622,8 @@ ether_input(struct ifnet *ifp, struct mb
 			ifp->if_xname, m->m_pkthdr.len);
 		}
 		mutex_exit(_lock);
+#endif
+		ifp->if_iqdrops++;
 		m_freem(m);
 		return;
 	}
@@ -1717,6 +1722,8 @@ void
 etherinit(void)
 {
 
+#ifdef DIAGNOSTIC
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NET);
+#endif
 	ether_sysctl_setup(NULL);
 }



CVS commit: [netbsd-9] src/sys/net

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 17:02:25 UTC 2019

Modified Files:
src/sys/net [netbsd-9]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #292):

sys/net/if_ethersubr.c: revision 1.277
sys/net/if_ethersubr.c: revision 1.278

Increment if_iqdrops when dropping an oversized frame.

 -

Print oversized frame's message only when DIAGNOSTIC is set. The message
is not so important because we increment if_iqdrops now.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.276.2.1 src/sys/net/if_ethersubr.c

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



CVS commit: [netbsd-9] src/sys/dev/fdt

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 16:56:37 UTC 2019

Modified Files:
src/sys/dev/fdt [netbsd-9]: cpufreq_dt.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #291):

sys/dev/fdt/cpufreq_dt.c: revision 1.9
sys/dev/fdt/cpufreq_dt.c: revision 1.10

Change sysctl to be named after the first CPU in the DVFS domain.
  old: machdep.cpu.frequency.*, machdep.cpufreqdt4.frequency.*
  new: machdep.cpufreq.cpu0.*, machdep.cpufreq.cpu4.*


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/dev/fdt/cpufreq_dt.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/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.8 src/sys/dev/fdt/cpufreq_dt.c:1.8.2.1
--- src/sys/dev/fdt/cpufreq_dt.c:1.8	Tue May 21 22:15:26 2019
+++ src/sys/dev/fdt/cpufreq_dt.c	Tue Oct  8 16:56:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.8 2019/05/21 22:15:26 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.8.2.1 2019/10/08 16:56:37 martin Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.8 2019/05/21 22:15:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.8.2.1 2019/10/08 16:56:37 martin Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -250,14 +251,36 @@ cpufreq_dt_sysctl_helper(SYSCTLFN_ARGS)
 	return error;
 }
 
+static struct cpu_info *
+cpufreq_dt_cpu_lookup(cpuid_t mpidr)
+{
+	CPU_INFO_ITERATOR cii;
+	struct cpu_info *ci;
+
+	for (CPU_INFO_FOREACH(cii, ci)) {
+		if (ci->ci_cpuid == mpidr)
+			return ci;
+	}
+
+	return NULL;
+}
+
 static void
 cpufreq_dt_init_sysctl(struct cpufreq_dt_softc *sc)
 {
-	const struct sysctlnode *node, *cpunode, *freqnode;
+	const struct sysctlnode *node, *cpunode;
 	struct sysctllog *cpufreq_log = NULL;
-	const char *cpunodename;
+	struct cpu_info *ci;
+	bus_addr_t mpidr;
 	int error, i;
 
+	if (fdtbus_get_reg(sc->sc_phandle, 0, , 0) != 0)
+		return;
+
+	ci = cpufreq_dt_cpu_lookup(mpidr);
+	if (ci == NULL)
+		return;
+
 	sc->sc_freq_available = kmem_zalloc(strlen(" ") * sc->sc_nopp, KM_SLEEP);
 	for (i = 0; i < sc->sc_nopp; i++) {
 		char buf[6];
@@ -265,28 +288,23 @@ cpufreq_dt_init_sysctl(struct cpufreq_dt
 		strcat(sc->sc_freq_available, buf);
 	}
 
-	if (device_unit(sc->sc_dev) == 0)
-		cpunodename = "cpu";
-	else
-		cpunodename = device_xname(sc->sc_dev);
-
 	error = sysctl_createv(_log, 0, NULL, ,
 	CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
 	NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
 	if (error)
 		goto sysctl_failed;
-	error = sysctl_createv(_log, 0, , ,
-	0, CTLTYPE_NODE, cpunodename, NULL,
+	error = sysctl_createv(_log, 0, , ,
+	0, CTLTYPE_NODE, "cpufreq", NULL,
 	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 	if (error)
 		goto sysctl_failed;
-	error = sysctl_createv(_log, 0, , ,
-	0, CTLTYPE_NODE, "frequency", NULL,
+	error = sysctl_createv(_log, 0, , ,
+	0, CTLTYPE_NODE, cpu_name(ci), NULL,
 	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 	if (error)
 		goto sysctl_failed;
 
-	error = sysctl_createv(_log, 0, , ,
+	error = sysctl_createv(_log, 0, , ,
 	CTLFLAG_READWRITE, CTLTYPE_INT, "target", NULL,
 	cpufreq_dt_sysctl_helper, 0, (void *)sc, 0,
 	CTL_CREATE, CTL_EOL);
@@ -294,7 +312,7 @@ cpufreq_dt_init_sysctl(struct cpufreq_dt
 		goto sysctl_failed;
 	sc->sc_node_target = node->sysctl_num;
 
-	error = sysctl_createv(_log, 0, , ,
+	error = sysctl_createv(_log, 0, , ,
 	CTLFLAG_READWRITE, CTLTYPE_INT, "current", NULL,
 	cpufreq_dt_sysctl_helper, 0, (void *)sc, 0,
 	CTL_CREATE, CTL_EOL);
@@ -302,7 +320,7 @@ cpufreq_dt_init_sysctl(struct cpufreq_dt
 		goto sysctl_failed;
 	sc->sc_node_current = node->sysctl_num;
 
-	error = sysctl_createv(_log, 0, , ,
+	error = sysctl_createv(_log, 0, , ,
 	0, CTLTYPE_STRING, "available", NULL,
 	NULL, 0, sc->sc_freq_available, 0,
 	CTL_CREATE, CTL_EOL);



CVS commit: [netbsd-9] src/sys/dev/fdt

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 16:56:37 UTC 2019

Modified Files:
src/sys/dev/fdt [netbsd-9]: cpufreq_dt.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #291):

sys/dev/fdt/cpufreq_dt.c: revision 1.9
sys/dev/fdt/cpufreq_dt.c: revision 1.10

Change sysctl to be named after the first CPU in the DVFS domain.
  old: machdep.cpu.frequency.*, machdep.cpufreqdt4.frequency.*
  new: machdep.cpufreq.cpu0.*, machdep.cpufreq.cpu4.*


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/dev/fdt/cpufreq_dt.c

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



CVS commit: src/sys/dev/pci

2019-10-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct  8 14:26:27 UTC 2019

Modified Files:
src/sys/dev/pci: if_vge.c if_vgereg.h

Log Message:
 Copy vge_clrwol() from FreeBSD and call it in vge_attach() to recover from
powerdown mode. Fixes PR kern/41525 reported by Aran Clauson.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_vgereg.h

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

Modified files:

Index: src/sys/dev/pci/if_vge.c
diff -u src/sys/dev/pci/if_vge.c:1.74 src/sys/dev/pci/if_vge.c:1.75
--- src/sys/dev/pci/if_vge.c:1.74	Fri Sep 13 07:55:07 2019
+++ src/sys/dev/pci/if_vge.c	Tue Oct  8 14:26:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.74 2019/09/13 07:55:07 msaitoh Exp $ */
+/* $NetBSD: if_vge.c,v 1.75 2019/10/08 14:26:27 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.74 2019/09/13 07:55:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.75 2019/10/08 14:26:27 msaitoh Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -328,6 +328,7 @@ static void vge_miibus_statchg(struct if
 
 static void vge_cam_clear(struct vge_softc *);
 static int vge_cam_set(struct vge_softc *, uint8_t *);
+static void	vge_clrwol(struct vge_softc *);
 static void vge_setmulti(struct vge_softc *);
 static void vge_reset(struct vge_softc *);
 
@@ -953,6 +954,9 @@ vge_attach(device_t parent, device_t sel
 	aprint_normal_dev(self, "Ethernet address %s\n",
 	ether_sprintf(eaddr));
 
+	/* Clear WOL and take hardware from powerdown. */
+	vge_clrwol(sc);
+
 	/*
 	 * Use the 32bit tag. Hardware supports 48bit physical addresses,
 	 * but we don't use that for now.
@@ -2156,3 +2160,30 @@ vge_shutdown(device_t self, int howto)
 
 	return true;
 }
+
+static void
+vge_clrwol(struct vge_softc *sc)
+{
+	uint8_t val;
+
+	val = CSR_READ_1(sc, VGE_PWRSTAT);
+	val &= ~VGE_STICKHW_SWPTAG;
+	CSR_WRITE_1(sc, VGE_PWRSTAT, val);
+	/* Disable WOL and clear power state indicator. */
+	val = CSR_READ_1(sc, VGE_PWRSTAT);
+	val &= ~(VGE_STICKHW_DS0 | VGE_STICKHW_DS1);
+	CSR_WRITE_1(sc, VGE_PWRSTAT, val);
+
+	CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_GMII);
+	CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
+
+	/* Clear WOL on pattern match. */
+	CSR_WRITE_1(sc, VGE_WOLCR0C, VGE_WOLCR0_PATTERN_ALL);
+	/* Disable WOL on magic/unicast packet. */
+	CSR_WRITE_1(sc, VGE_WOLCR1C, 0x0F);
+	CSR_WRITE_1(sc, VGE_WOLCFGC, VGE_WOLCFG_SAB | VGE_WOLCFG_SAM |
+	VGE_WOLCFG_PMEOVR);
+	/* Clear WOL status on pattern match. */
+	CSR_WRITE_1(sc, VGE_WOLSR0C, 0xFF);
+	CSR_WRITE_1(sc, VGE_WOLSR1C, 0xFF);
+}

Index: src/sys/dev/pci/if_vgereg.h
diff -u src/sys/dev/pci/if_vgereg.h:1.4 src/sys/dev/pci/if_vgereg.h:1.5
--- src/sys/dev/pci/if_vgereg.h:1.4	Thu Jul 11 03:49:51 2019
+++ src/sys/dev/pci/if_vgereg.h	Tue Oct  8 14:26:27 2019
@@ -540,6 +540,31 @@
 #define VGE_TXBLOCK_128PKTS	0x08
 #define VGE_TXBLOCK_8PKTS	0x0C
 
+/* Sticky bit shadow register */
+
+#define	VGE_STICKHW_DS0		0x01
+#define	VGE_STICKHW_DS1		0x02
+#define	VGE_STICKHW_WOL_ENB	0x04
+#define	VGE_STICKHW_WOL_STS	0x08
+#define	VGE_STICKHW_SWPTAG	0x10
+
+/* WOL pattern control */
+#define	VGE_WOLCR0_PATTERN0	0x01
+#define	VGE_WOLCR0_PATTERN1	0x02
+#define	VGE_WOLCR0_PATTERN2	0x04
+#define	VGE_WOLCR0_PATTERN3	0x08
+#define	VGE_WOLCR0_PATTERN4	0x10
+#define	VGE_WOLCR0_PATTERN5	0x20
+#define	VGE_WOLCR0_PATTERN6	0x40
+#define	VGE_WOLCR0_PATTERN7	0x80
+#define	VGE_WOLCR0_PATTERN_ALL	0xFF
+
+/* WOL config register */
+#define	VGE_WOLCFG_PHYINT_ENB	0x01
+#define	VGE_WOLCFG_SAB		0x10
+#define	VGE_WOLCFG_SAM		0x20
+#define	VGE_WOLCFG_PMEOVR	0x80
+
 /* EEPROM control/status register */
 
 #define VGE_EECSR_EDO		0x01	/* data out pin */



CVS commit: src/sys/dev/pci

2019-10-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct  8 14:26:27 UTC 2019

Modified Files:
src/sys/dev/pci: if_vge.c if_vgereg.h

Log Message:
 Copy vge_clrwol() from FreeBSD and call it in vge_attach() to recover from
powerdown mode. Fixes PR kern/41525 reported by Aran Clauson.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_vgereg.h

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



CVS commit: src/sys/sys

2019-10-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Oct  8 12:49:56 UTC 2019

Modified Files:
src/sys/sys: conf.h

Log Message:
Convert ttynodisc() to devenodev and ttyerr*() to ttyenodev too.

Missed in previous.  Of these - only ttyerrio() is used, the rest are
just courtesy "for those defining their own line disciplines".  So may
be we should bring back ttyerrinput() too.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/sys/conf.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/sys/conf.h
diff -u src/sys/sys/conf.h:1.153 src/sys/sys/conf.h:1.154
--- src/sys/sys/conf.h:1.153	Tue Oct  8 07:33:14 2019
+++ src/sys/sys/conf.h	Tue Oct  8 12:49:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.153 2019/10/08 07:33:14 mrg Exp $	*/
+/*	$NetBSD: conf.h,v 1.154 2019/10/08 12:49:56 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -223,10 +223,10 @@ struct linesw *ttyldisc_default(void);
 void	   ttyldisc_release(struct linesw *);
 
 /* For those defining their own line disciplines: */
-#define	ttynodisc ((int (*)(dev_t, struct tty *))enodev)
-#define	ttyerrclose ((int (*)(struct tty *, int))enodev)
-#define	ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev)
-#define	ttyerrstart ((int (*)(struct tty *))enodev)
+#define	ttynodisc ((int (*)(dev_t, struct tty *))devenodev)
+#define	ttyerrclose ((int (*)(struct tty *, int))ttyenodev)
+#define	ttyerrio ((int (*)(struct tty *, struct uio *, int))ttyenodev)
+#define	ttyerrstart ((int (*)(struct tty *))ttyenodev)
 
 int	ttyerrpoll (struct tty *, int, struct lwp *);
 int	ttynullioctl(struct tty *, u_long, void *, int, struct lwp *);



CVS commit: src/sys/sys

2019-10-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Oct  8 12:49:56 UTC 2019

Modified Files:
src/sys/sys: conf.h

Log Message:
Convert ttynodisc() to devenodev and ttyerr*() to ttyenodev too.

Missed in previous.  Of these - only ttyerrio() is used, the rest are
just courtesy "for those defining their own line disciplines".  So may
be we should bring back ttyerrinput() too.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/sys/conf.h

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



CVS commit: src/sys/kern

2019-10-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Oct  8 12:29:57 UTC 2019

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

Log Message:
Correct the same expression on both sides of |

PR sw-bug/54610 by David Binderman


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/sys_ptrace_common.c

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



CVS commit: src/sys/kern

2019-10-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Oct  8 12:29:57 UTC 2019

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

Log Message:
Correct the same expression on both sides of |

PR sw-bug/54610 by David Binderman


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/sys_ptrace_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/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.64 src/sys/kern/sys_ptrace_common.c:1.65
--- src/sys/kern/sys_ptrace_common.c:1.64	Mon Oct  7 21:32:51 2019
+++ src/sys/kern/sys_ptrace_common.c	Tue Oct  8 12:29:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.64 2019/10/07 21:32:51 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.65 2019/10/08 12:29:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.64 2019/10/07 21:32:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.65 2019/10/08 12:29:57 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -1261,7 +1261,7 @@ do_ptrace(struct ptrace_methods *ptm, st
 	break;
 			}
 		} else {
-			if (lt->l_flag & (LW_WSUSPEND | LW_WSUSPEND)) {
+			if (lt->l_flag & (LW_WSUSPEND | LW_DBGSUSPEND)) {
 error = EDEADLK;
 break;
 			}



CVS commit: src/sys

2019-10-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Oct  8 07:33:15 UTC 2019

Modified Files:
src/sys/kern: kern_stub.c
src/sys/sys: conf.h

Log Message:
steal an idea from uwe@ and implement gcc-8 function type cast
friendly methods for sys/conf.h that needs it.

one alias per return type and first function are are needed,
though they can be stubbed to existing code.  the only cost is
the symbol itself, the codegen it the same.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/kern_stub.c
cvs rdiff -u -r1.152 -r1.153 src/sys/sys/conf.h

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



CVS commit: src/sys

2019-10-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Oct  8 07:33:15 UTC 2019

Modified Files:
src/sys/kern: kern_stub.c
src/sys/sys: conf.h

Log Message:
steal an idea from uwe@ and implement gcc-8 function type cast
friendly methods for sys/conf.h that needs it.

one alias per return type and first function are are needed,
though they can be stubbed to existing code.  the only cost is
the symbol itself, the codegen it the same.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/kern_stub.c
cvs rdiff -u -r1.152 -r1.153 src/sys/sys/conf.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/kern/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.47 src/sys/kern/kern_stub.c:1.48
--- src/sys/kern/kern_stub.c:1.47	Sun Jan 27 02:55:26 2019
+++ src/sys/kern/kern_stub.c	Tue Oct  8 07:33:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $	*/
+/*	$NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ktrace.h"
@@ -185,6 +185,16 @@ __strong_alias(dosa_register,sys_nosys);
 __strong_alias(sa_stacks1,sys_nosys);
 
 /*
+ * Stubs for drivers.  See sys/conf.h.
+ */
+__strong_alias(devenodev,enodev);
+__strong_alias(deveopnotsupp,eopnotsupp);
+__strong_alias(devnullop,nullop);
+__strong_alias(ttyenodev,enodev);
+__strong_alias(ttyvenodev,voidop);
+__strong_alias(ttyvnullop,nullop);
+
+/*
  * Stubs for architectures that do not support kernel preemption.
  */
 #ifndef __HAVE_PREEMPTION

Index: src/sys/sys/conf.h
diff -u src/sys/sys/conf.h:1.152 src/sys/sys/conf.h:1.153
--- src/sys/sys/conf.h:1.152	Tue Oct  8 07:16:25 2019
+++ src/sys/sys/conf.h	Tue Oct  8 07:33:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.152 2019/10/08 07:16:25 mrg Exp $	*/
+/*	$NetBSD: conf.h,v 1.153 2019/10/08 07:33:14 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -126,30 +126,37 @@ devmajor_t cdevsw_lookup_major(const str
 #define	dev_type_kqfilter(n)	int n (dev_t, struct knote *)
 #define dev_type_discard(n)	int n (dev_t, off_t, off_t)
 
-#define	noopen		((dev_type_open((*)))enodev)
-#define	noclose		((dev_type_close((*)))enodev)
-#define	noread		((dev_type_read((*)))enodev)
-#define	nowrite		((dev_type_write((*)))enodev)
-#define	noioctl		((dev_type_ioctl((*)))enodev)
-#define	nostop		((dev_type_stop((*)))enodev)
+int devenodev(dev_t, ...);
+int deveopnotsupp(dev_t, ...);
+int devnullop(dev_t, ...);
+int ttyenodev(struct tty *, ...);
+void ttyvenodev(struct tty *, ...);
+void ttyvnullop(struct tty *, ...);
+
+#define	noopen		((dev_type_open((*)))devenodev)
+#define	noclose		((dev_type_close((*)))devenodev)
+#define	noread		((dev_type_read((*)))devenodev)
+#define	nowrite		((dev_type_write((*)))devenodev)
+#define	noioctl		((dev_type_ioctl((*)))devenodev)
+#define	nostop		((dev_type_stop((*)))ttyvenodev)
 #define	notty		NULL
 #define	nopoll		seltrue
 paddr_t	nommap(dev_t, off_t, int);
-#define	nodump		((dev_type_dump((*)))enodev)
+#define	nodump		((dev_type_dump((*)))devenodev)
 #define	nosize		NULL
 #define	nokqfilter	seltrue_kqfilter
-#define nodiscard	((dev_type_discard((*)))enodev)
+#define	nodiscard	((dev_type_discard((*)))devenodev)
 
-#define	nullopen	((dev_type_open((*)))nullop)
-#define	nullclose	((dev_type_close((*)))nullop)
-#define	nullread	((dev_type_read((*)))nullop)
-#define	nullwrite	((dev_type_write((*)))nullop)
-#define	nullioctl	((dev_type_ioctl((*)))nullop)
-#define	nullstop	((dev_type_stop((*)))nullop)
-#define	nullpoll	((dev_type_poll((*)))nullop)
-#define	nulldump	((dev_type_dump((*)))nullop)
-#define	nullkqfilter	((dev_type_kqfilter((*)))eopnotsupp)
-#define nulldiscard	((dev_type_discard((*)))nullop)
+#define	nullopen	((dev_type_open((*)))devnullop)
+#define	nullclose	((dev_type_close((*)))devnullop)
+#define	nullread	((dev_type_read((*)))devnullop)
+#define	nullwrite	((dev_type_write((*)))devnullop)
+#define	nullioctl	((dev_type_ioctl((*)))devnullop)
+#define	nullstop	((dev_type_stop((*)))ttyvnullop)
+#define	nullpoll	((dev_type_poll((*)))devnullop)
+#define	nulldump	((dev_type_dump((*)))devnullop)
+#define	nullkqfilter	((dev_type_kqfilter((*)))deveopnotsupp)
+#define	nulldiscard	((dev_type_discard((*)))devnullop)
 
 /* device access wrappers. */
 



CVS commit: src/sys/dev/usb

2019-10-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Oct  8 07:30:58 UTC 2019

Modified Files:
src/sys/dev/usb: if_run.c if_runvar.h

Log Message:
Merge more changes from FreeBSD/OpenBSD. My two run(4) devices now work
again.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/if_runvar.h

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



CVS commit: src/sys/dev/usb

2019-10-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Oct  8 07:30:58 UTC 2019

Modified Files:
src/sys/dev/usb: if_run.c if_runvar.h

Log Message:
Merge more changes from FreeBSD/OpenBSD. My two run(4) devices now work
again.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/if_runvar.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/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.32 src/sys/dev/usb/if_run.c:1.33
--- src/sys/dev/usb/if_run.c:1.32	Tue Jan 22 06:47:20 2019
+++ src/sys/dev/usb/if_run.c	Tue Oct  8 07:30:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.32 2019/01/22 06:47:20 skrll Exp $	*/
+/*	$NetBSD: if_run.c,v 1.33 2019/10/08 07:30:58 mlelstv Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -18,12 +18,12 @@
  */
 
 /*-
- * Ralink Technology RT2700U/RT2800U/RT3000U chipset driver.
+ * Ralink Technology RT2700U/RT2800U/RT3000U/RT3900E chipset driver.
  * http://www.ralinktech.com/
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.32 2019/01/22 06:47:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.33 2019/10/08 07:30:58 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -122,6 +122,8 @@ static const struct usb_devno run_devs[]
 	USB_ID(ASUSTEK,		RT2870_5),
 	USB_ID(ASUSTEK,		RT3070),
 	USB_ID(ASUSTEK,		RT3070_1),
+	USB_ID(ASUSTEK,		USBN53),
+	USB_ID(ASUSTEK,		USBN66),
 	USB_ID(ASUSTEK2,	USBN11),
 	USB_ID(AZUREWAVE,	RT2870_1),
 	USB_ID(AZUREWAVE,	RT2870_2),
@@ -138,6 +140,7 @@ static const struct usb_devno run_devs[]
 	USB_ID(BELKIN,		F7D1101V2),
 	USB_ID(BELKIN,		RT2870_1),
 	USB_ID(BELKIN,		RT2870_2),
+	USB_ID(BELKIN,		RTL8192CU_2),
 	USB_ID(BEWAN,		RT3070),
 	USB_ID(CISCOLINKSYS,	AE1000),
 	USB_ID(CISCOLINKSYS,	AM10),
@@ -162,6 +165,10 @@ static const struct usb_devno run_devs[]
 	USB_ID(CYBERTAN,	RT2870),
 	USB_ID(DLINK,		RT2870),
 	USB_ID(DLINK,		RT3072),
+	USB_ID(DLINK,		DWA127),
+	USB_ID(DLINK,		DWA140B3),
+	USB_ID(DLINK,		DWA160B2),
+	USB_ID(DLINK,		DWA162),
 	USB_ID(DLINK2,		DWA130),
 	USB_ID(DLINK2,		RT2870_1),
 	USB_ID(DLINK2,		RT2870_2),
@@ -203,6 +210,9 @@ static const struct usb_devno run_devs[]
 	USB_ID(LINKSYS4,	WUSB600N),
 	USB_ID(LINKSYS4,	WUSB600NV2),
 	USB_ID(LOGITEC,		LANW300NU2),
+	USB_ID(LOGITEC,		LANW300NU2S),
+	USB_ID(LOGITEC,		LAN_W300ANU2),
+	USB_ID(LOGITEC,		LAN_W450ANU2E),
 	USB_ID(LOGITEC,		RT2870_1),
 	USB_ID(LOGITEC,		RT2870_2),
 	USB_ID(LOGITEC,		RT2870_3),
@@ -257,6 +267,7 @@ static const struct usb_devno run_devs[]
 	USB_ID(RALINK,		RT3072),
 	USB_ID(RALINK,		RT3370),
 	USB_ID(RALINK,		RT3572),
+	USB_ID(RALINK,		RT3573),
 	USB_ID(RALINK,		RT5370),
 	USB_ID(RALINK,		RT5572),
 	USB_ID(RALINK,		RT8070),
@@ -276,9 +287,11 @@ static const struct usb_devno run_devs[]
 	USB_ID(SITECOMEU,	RT2870_2),
 	USB_ID(SITECOMEU,	RT2870_3),
 	USB_ID(SITECOMEU,	RT3070_1),
+	USB_ID(SITECOMEU,	RT3070_3),
 	USB_ID(SITECOMEU,	RT3072_3),
 	USB_ID(SITECOMEU,	RT3072_4),
 	USB_ID(SITECOMEU,	RT3072_5),
+	USB_ID(SITECOMEU,	RT3072_6),
 	USB_ID(SITECOMEU,	WL302),
 	USB_ID(SITECOMEU,	WL315),
 	USB_ID(SITECOMEU,	WL321),
@@ -352,7 +365,7 @@ static int		run_rt3070_rf_write(struct r
 static int		run_bbp_read(struct run_softc *, uint8_t, uint8_t *);
 static int		run_bbp_write(struct run_softc *, uint8_t, uint8_t);
 static int		run_mcu_cmd(struct run_softc *, uint8_t, uint16_t);
-static const char *	run_get_rf(int);
+static const char *	run_get_rf(uint16_t);
 static void		run_rt3593_get_txpower(struct run_softc *);
 static void		run_get_txpower(struct run_softc *);
 static int		run_read_eeprom(struct run_softc *);
@@ -850,6 +863,11 @@ run_alloc_tx_ring(struct run_softc *sc, 
 {
 	struct run_tx_ring *txq = >txq[qid];
 	int i, error;
+	uint16_t txwisize;
+
+	txwisize = sizeof(struct rt2860_txwi);
+	if (sc->mac_ver == 0x5592)
+		txwisize += sizeof(uint32_t);
 
 	txq->cur = txq->queued = 0;
 
@@ -870,8 +888,7 @@ run_alloc_tx_ring(struct run_softc *sc, 
 
 		data->buf = usbd_get_buffer(data->xfer);
 		/* zeroize the TXD + TXWI part */
-		memset(data->buf, 0, sizeof(struct rt2870_txd) +
-		sizeof(struct rt2860_txwi));
+		memset(data->buf, 0, sizeof(struct rt2870_txd) + txwisize);
 	}
 	if (error != 0)
 fail:		run_free_tx_ring(sc, qid);
@@ -942,7 +959,9 @@ run_load_microcode(struct run_softc *sc)
 		return error;
 
 	usbd_delay_ms(sc->sc_udev, 10);
+	run_write(sc, RT2860_H2M_BBPAGENT, 0);
 	run_write(sc, RT2860_H2M_MAILBOX, 0);
+	run_write(sc, RT2860_H2M_INTSRC, 0);
 	if ((error = run_mcu_cmd(sc, RT2860_MCU_CMD_RFRESET, 0)) != 0)
 		return error;
 
@@ -1106,6 +1125,7 @@ run_efuse_read(struct run_softc *sc, uin
 	if ((error = run_read(sc, reg, )) != 0)
 		return error;
 
+	tmp >>= (8 * (addr & 0x3));
 	*val = (addr & 1) ? tmp >> 16 : tmp & 0x;
 	return 0;
 }
@@ -1315,7 +1335,7 @@ b4inc(uint32_t b32, int8_t delta)
 }
 
 static const 

CVS commit: src/sys/sys

2019-10-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Oct  8 07:16:25 UTC 2019

Modified Files:
src/sys/sys: conf.h

Log Message:
remove unused ttyerrinput.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/sys/conf.h

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



CVS commit: src/sys/sys

2019-10-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Oct  8 07:16:25 UTC 2019

Modified Files:
src/sys/sys: conf.h

Log Message:
remove unused ttyerrinput.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/sys/conf.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/sys/conf.h
diff -u src/sys/sys/conf.h:1.151 src/sys/sys/conf.h:1.152
--- src/sys/sys/conf.h:1.151	Sat Dec 17 03:46:52 2016
+++ src/sys/sys/conf.h	Tue Oct  8 07:16:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.151 2016/12/17 03:46:52 riastradh Exp $	*/
+/*	$NetBSD: conf.h,v 1.152 2019/10/08 07:16:25 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -219,7 +219,6 @@ void	   ttyldisc_release(struct line
 #define	ttynodisc ((int (*)(dev_t, struct tty *))enodev)
 #define	ttyerrclose ((int (*)(struct tty *, int))enodev)
 #define	ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev)
-#define	ttyerrinput ((int (*)(int, struct tty *))enodev)
 #define	ttyerrstart ((int (*)(struct tty *))enodev)
 
 int	ttyerrpoll (struct tty *, int, struct lwp *);