CVS commit: src/doc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 18 07:20:56 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
zlib-1.2.11 is out.


To generate a diff of this commit:
cvs rdiff -u -r1.1417 -r1.1418 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1417 src/doc/3RDPARTY:1.1418
--- src/doc/3RDPARTY:1.1417	Sat Feb 18 07:20:21 2017
+++ src/doc/3RDPARTY	Sat Feb 18 07:20:56 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1417 2017/02/18 07:20:21 nonaka Exp $
+#	$NetBSD: 3RDPARTY,v 1.1418 2017/02/18 07:20:56 nonaka Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1445,7 +1445,7 @@ See /usr/src/external/bsd/wpa/NetBSD-upg
 
 Package:	zlib
 Version:	1.2.10
-Current Vers:	1.2.10
+Current Vers:	1.2.11
 Maintainer:	Jean-loup Gailly and Mark Adler 
 Archive Site:	http://www.zlib.net/
 Home Page:	http://www.zlib.net/



CVS commit: src/doc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Feb 18 07:20:21 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
add gnu-efi.


To generate a diff of this commit:
cvs rdiff -u -r1.1416 -r1.1417 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1416 src/doc/3RDPARTY:1.1417
--- src/doc/3RDPARTY:1.1416	Tue Feb 14 01:18:39 2017
+++ src/doc/3RDPARTY	Sat Feb 18 07:20:21 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1416 2017/02/14 01:18:39 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1417 2017/02/18 07:20:21 nonaka Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1679,3 +1679,14 @@ Mailing List:   none
 Responsible:christos
 License:BSD-like (3-clause)
 Location:   usr.bin/nc
+
+Package:	gnu-efi
+Version:	3.0u
+Current Vers:	3.0.5
+Maintainer:	https://sourceforge.net/projects/gnu-efi/
+Archive Site:	https://sourceforge.net/projects/gnu-efi/
+Home Page:	https://sourceforge.net/projects/gnu-efi/
+Mailing List:	https://sourceforge.net/projects/gnu-efi/
+Responsible:
+License:	BSD-like (3-clause)
+Location:	sys/external/bsd/gnu-efi



CVS commit: src/share/man/man8

2017-02-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 18 05:38:40 UTC 2017

Modified Files:
src/share/man/man8: afterboot.8

Log Message:
Suggest `service xyz start/stop/...' instead of /etc/rc.d/xyz.

>From cfkoch.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/share/man/man8/afterboot.8

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/man8/afterboot.8
diff -u src/share/man/man8/afterboot.8:1.53 src/share/man/man8/afterboot.8:1.54
--- src/share/man/man8/afterboot.8:1.53	Sat Dec 17 07:37:24 2016
+++ src/share/man/man8/afterboot.8	Sat Feb 18 05:38:40 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: afterboot.8,v 1.53 2016/12/17 07:37:24 maya Exp $
+.\"	$NetBSD: afterboot.8,v 1.54 2017/02/18 05:38:40 riastradh Exp $
 .\"	$OpenBSD: afterboot.8,v 1.72 2002/02/22 02:02:33 miod Exp $
 .\"
 .\" Originally created by Marshall M. Midden -- 1997-10-20, m...@umn.edu
@@ -327,7 +327,7 @@ or in the file
 If you need to edit this file, a painless way to reconfigure the network
 afterwards is to issue
 .Bd -literal -offset indent
-.Ic /etc/rc.d/network restart
+.Ic service network restart
 .Ed
 .Pp
 Or, you may prefer to manually configure using a series of
@@ -340,7 +340,7 @@ If you run
 .Xr dhcpcd 8
 you will have to kill it by running
 .Bd -literal -offset indent
-.Ic /etc/rc.d/dhcpcd stop
+.Ic service dhcpcd stop
 .Ed
 .Pp
 before you flush the routes.
@@ -368,7 +368,7 @@ in
 .Pa /etc/rc.conf
 and then starting the server with the command
 .Bd -literal -offset indent
-.Ic /etc/rc.d/sshd start
+.Ic service sshd start
 .Ed
 .Pp
 The first time the server is started, it will generate a new keypair,
@@ -390,7 +390,7 @@ in
 .Pa /etc/rc.conf
 and either rebooting or running the following command:
 .Bd -literal -offset indent
-.Ic /etc/rc.d/named start
+.Ic service named start
 .Ed
 .Pp
 .Xr named 8
@@ -753,9 +753,9 @@ Edit
 and get it correct.
 After this, you can start the server by issuing:
 .Bd -literal -offset indent
-.Ic /etc/rc.d/rpcbind start
-.Ic /etc/rc.d/mountd start
-.Ic /etc/rc.d/nfsd start
+.Ic service rpcbind start
+.Ic service mountd start
+.Ic service nfsd start
 .Ed
 which will also start dependencies.
 .Ss HP remote boot server



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

2017-02-17 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Feb 18 05:08:47 UTC 2017

Modified Files:
src/sys/arch/evbppc/conf: files.evbppc files.mpc85xx files.obs600
files.pmppc

Log Message:
Factorize kern/subr_disk_mbr.c into files.evbppc, and make EVBPPC_HAS_MBR
more like a normal option. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbppc/conf/files.evbppc \
src/sys/arch/evbppc/conf/files.pmppc
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbppc/conf/files.mpc85xx
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/conf/files.obs600

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/evbppc/conf/files.evbppc
diff -u src/sys/arch/evbppc/conf/files.evbppc:1.6 src/sys/arch/evbppc/conf/files.evbppc:1.7
--- src/sys/arch/evbppc/conf/files.evbppc:1.6	Wed Oct 17 19:54:16 2007
+++ src/sys/arch/evbppc/conf/files.evbppc	Sat Feb 18 05:08:47 2017
@@ -1,10 +1,11 @@
-#	$NetBSD: files.evbppc,v 1.6 2007/10/17 19:54:16 garbled Exp $
+#	$NetBSD: files.evbppc,v 1.7 2017/02/18 05:08:47 rin Exp $
 
 # maxpartitions must be first item in files.${ARCH}
 maxpartitions 16
 
 maxusers 2 8 64
 
+file	kern/subr_disk_mbr.c			disk & evbppc_has_mbr
 file	arch/evbppc/evbppc/disksubr.c		disk & !evbppc_has_mbr
 file	arch/evbppc/evbppc/evbppc_machdep.c	ppc_ibm4xx
 
Index: src/sys/arch/evbppc/conf/files.pmppc
diff -u src/sys/arch/evbppc/conf/files.pmppc:1.6 src/sys/arch/evbppc/conf/files.pmppc:1.7
--- src/sys/arch/evbppc/conf/files.pmppc:1.6	Wed Jun 22 18:06:32 2011
+++ src/sys/arch/evbppc/conf/files.pmppc	Sat Feb 18 05:08:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pmppc,v 1.6 2011/06/22 18:06:32 matt Exp $
+#	$NetBSD: files.pmppc,v 1.7 2017/02/18 05:08:47 rin Exp $
 #
 #
 maxpartitions 16
@@ -9,7 +9,6 @@ include "arch/powerpc/pic/files.pic"
 
 file	arch/evbppc/pmppc/autoconf.c
 file	arch/powerpc/powerpc/clock.c
-file	kern/subr_disk_mbr.c			disk
 file	arch/evbppc/pmppc/pic_cpc700.c
 file	arch/evbppc/pmppc/machdep.c
 

Index: src/sys/arch/evbppc/conf/files.mpc85xx
diff -u src/sys/arch/evbppc/conf/files.mpc85xx:1.10 src/sys/arch/evbppc/conf/files.mpc85xx:1.11
--- src/sys/arch/evbppc/conf/files.mpc85xx:1.10	Sat Dec 27 16:19:33 2014
+++ src/sys/arch/evbppc/conf/files.mpc85xx	Sat Feb 18 05:08:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mpc85xx,v 1.10 2014/12/27 16:19:33 nonaka Exp $
+#	$NetBSD: files.mpc85xx,v 1.11 2017/02/18 05:08:47 rin Exp $
 #
 # mpc85xx-specific configuration info
 
@@ -13,9 +13,6 @@ file	arch/powerpc/booke/e500_intr.c
 file	arch/powerpc/booke/e500_timer.c
 file	arch/powerpc/booke/e500_tlb.c
 
-# we usr MBR
-file	kern/subr_disk_mbr.c			disk
-
 # Memory Disk for install kernel
 file	dev/md_root.cmemory_disk_hooks
 

Index: src/sys/arch/evbppc/conf/files.obs600
diff -u src/sys/arch/evbppc/conf/files.obs600:1.2 src/sys/arch/evbppc/conf/files.obs600:1.3
--- src/sys/arch/evbppc/conf/files.obs600:1.2	Thu Nov 21 14:03:02 2013
+++ src/sys/arch/evbppc/conf/files.obs600	Sat Feb 18 05:08:47 2017
@@ -1,12 +1,10 @@
-#	$NetBSD: files.obs600,v 1.2 2013/11/21 14:03:02 kiyohara Exp $
+#	$NetBSD: files.obs600,v 1.3 2017/02/18 05:08:47 rin Exp $
 #
 # obs600-specific configuration info
 
 file	arch/evbppc/obs405/obs600_autoconf.c
 file	arch/evbppc/obs405/obs600_machdep.c
 
-file	kern/subr_disk_mbr.c			disk
-
 include "dev/usb/files.usb"
 
 include "dev/bluetooth/files.bluetooth"



CVS commit: src/tests/kernel/arch/amd64

2017-02-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 18 04:30:34 UTC 2017

Modified Files:
src/tests/kernel/arch/amd64: t_ptrace_wait.c

Log Message:
Synchronize struct dbreg with FreeBSD - rename field member .dbregs to .dr

Currently this code is disabled in HEAD and the dbreg struct has to be
committed first in order to be used. Before enabling it I'm working on
reducing needless differences with FreeBSD and Linux.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/kernel/arch/amd64/t_ptrace_wait.c

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

Modified files:

Index: src/tests/kernel/arch/amd64/t_ptrace_wait.c
diff -u src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.13 src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.14
--- src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.13	Sat Feb 18 02:28:21 2017
+++ src/tests/kernel/arch/amd64/t_ptrace_wait.c	Sat Feb 18 04:30:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.13 2017/02/18 02:28:21 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.14 2017/02/18 04:30:34 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.13 2017/02/18 02:28:21 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.14 2017/02/18 04:30:34 kamil Exp $");
 
 #include 
 #include 
@@ -209,8 +209,8 @@ ATF_TC_BODY(dbregs_print, tc)
 	ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r, 0) != -1);
 
 	printf("State of the debug registers:\n");
-	for (i = 0; i < __arraycount(r.dbregs); i++)
-		printf("r[%zu]=%#lx\n", i, r.dbregs[i]);
+	for (i = 0; i < __arraycount(r.dr); i++)
+		printf("r[%zu]=%#lx\n", i, r.dr[i]);
 
 	printf("Before resuming the child process where it left off and "
 	"without signal to be sent\n");
@@ -251,8 +251,8 @@ ATF_TC_BODY(dbregs_preserve_dr0, tc)
 
 	printf("Assert that known number of Debug Registers (%zu) is valid\n",
 	len);
-	ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-	ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+	ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+	ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
 	printf("Before forking process PID=%d\n", getpid());
 	ATF_REQUIRE((child = fork()) != -1);
@@ -277,15 +277,15 @@ ATF_TC_BODY(dbregs_preserve_dr0, tc)
 	ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
 	printf("State of the debug registers (r1):\n");
-	for (i = 0; i < __arraycount(r1.dbregs); i++)
-		printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+	for (i = 0; i < __arraycount(r1.dr); i++)
+		printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-	r1.dbregs[0] = (long)(intptr_t)&watchme;
-	printf("Set DR0 (r1.dbregs[0]) to new value %#lx\n", r1.dbregs[0]);
+	r1.dr[0] = (long)(intptr_t)&watchme;
+	printf("Set DR0 (r1.dr[0]) to new value %#lx\n", r1.dr[0]);
 
 	printf("New state of the debug registers (r1):\n");
-	for (i = 0; i < __arraycount(r1.dbregs); i++)
-		printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+	for (i = 0; i < __arraycount(r1.dr); i++)
+		printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
 	printf("Call SETDBREGS for the child process (r1)\n");
 	ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -335,8 +335,8 @@ ATF_TC_BODY(dbregs_preserve_dr1, tc)
 
 	printf("Assert that known number of Debug Registers (%zu) is valid\n",
 	len);
-	ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-	ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+	ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+	ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
 	printf("Before forking process PID=%d\n", getpid());
 	ATF_REQUIRE((child = fork()) != -1);
@@ -361,15 +361,15 @@ ATF_TC_BODY(dbregs_preserve_dr1, tc)
 	ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
 
 	printf("State of the debug registers (r1):\n");
-	for (i = 0; i < __arraycount(r1.dbregs); i++)
-		printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+	for (i = 0; i < __arraycount(r1.dr); i++)
+		printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
-	r1.dbregs[1] = (long)(intptr_t)&watchme;
-	printf("Set DR1 (r1.dbregs[1]) to new value %#lx\n", r1.dbregs[1]);
+	r1.dr[1] = (long)(intptr_t)&watchme;
+	printf("Set DR1 (r1.dr[1]) to new value %#lx\n", r1.dr[1]);
 
 	printf("New state of the debug registers (r1):\n");
-	for (i = 0; i < __arraycount(r1.dbregs); i++)
-		printf("r1[%zu]=%#lx\n", i, r1.dbregs[i]);
+	for (i = 0; i < __arraycount(r1.dr); i++)
+		printf("r1[%zu]=%#lx\n", i, r1.dr[i]);
 
 	printf("Call SETDBREGS for the child process (r1)\n");
 	ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
@@ -419,8 +419,8 @@ ATF_TC_BODY(dbregs_preserve_dr2, tc)
 
 	printf("Assert that known number of Debug Registers (%zu) is valid\n",
 	len);
-	ATF_REQUIRE_EQ(__arraycount(r1.dbregs), len);
-	ATF_REQUIRE_EQ(__arraycount(r2.dbregs), len);
+	ATF_REQUIRE_EQ(__arraycount(r1.dr), len);
+	ATF_REQUIRE_EQ(__arraycount(r2.dr), len);
 
 	printf("Before forking process PID=%d\n", getpid());
 	ATF_REQUIRE((child = fork()) != -1);
@@ -445,15 +445,15 @@

CVS commit: src/tests/kernel/arch/amd64

2017-02-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 18 02:28:21 UTC 2017

Modified Files:
src/tests/kernel/arch/amd64: t_ptrace_wait.c

Log Message:
Fix dbregs_dr[0123]_trap_variable in arch/amd64/t_ptrace_wait*

Add missing PT_CONTINUE between two wait(2)-like calls.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/kernel/arch/amd64/t_ptrace_wait.c

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

Modified files:

Index: src/tests/kernel/arch/amd64/t_ptrace_wait.c
diff -u src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.12 src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.13
--- src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.12	Thu Feb 16 15:57:45 2017
+++ src/tests/kernel/arch/amd64/t_ptrace_wait.c	Sat Feb 18 02:28:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.12 2017/02/16 15:57:45 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.13 2017/02/18 02:28:21 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.12 2017/02/16 15:57:45 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.13 2017/02/18 02:28:21 kamil Exp $");
 
 #include 
 #include 
@@ -1392,6 +1392,9 @@ ATF_TC_BODY(dbregs_dr0_trap_variable, tc
 
 	validate_status_stopped(status, SIGTRAP);
 
+	printf("Call CONTINUE for the child process\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
 	printf("Before calling %s() for the child\n", TWAIT_FNAME);
 	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
 
@@ -1503,6 +1506,9 @@ ATF_TC_BODY(dbregs_dr1_trap_variable, tc
 
 	validate_status_stopped(status, SIGTRAP);
 
+	printf("Call CONTINUE for the child process\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
 	printf("Before calling %s() for the child\n", TWAIT_FNAME);
 	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
 
@@ -1614,6 +1620,9 @@ ATF_TC_BODY(dbregs_dr2_trap_variable, tc
 
 	validate_status_stopped(status, SIGTRAP);
 
+	printf("Call CONTINUE for the child process\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
 	printf("Before calling %s() for the child\n", TWAIT_FNAME);
 	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
 
@@ -1725,6 +1734,9 @@ ATF_TC_BODY(dbregs_dr3_trap_variable, tc
 
 	validate_status_stopped(status, SIGTRAP);
 
+	printf("Call CONTINUE for the child process\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
 	printf("Before calling %s() for the child\n", TWAIT_FNAME);
 	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
 



CVS commit: src/sys/kern

2017-02-17 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Feb 18 01:29:09 UTC 2017

Modified Files:
src/sys/kern: exec_elf.c kern_pax.c

Log Message:
obey the executable's ELF alignment constraints for PIE.
this fixes gdb of PIE binaries on mac68k (and other platforms
which use an ELF alignment that is larger than PAGE_SIZE).


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/kern/exec_elf.c
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_pax.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.88 src/sys/kern/exec_elf.c:1.89
--- src/sys/kern/exec_elf.c:1.88	Sun Feb 12 21:52:46 2017
+++ src/sys/kern/exec_elf.c	Sat Feb 18 01:29:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.88 2017/02/12 21:52:46 uwe Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.89 2017/02/18 01:29:09 chs Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005, 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.88 2017/02/12 21:52:46 uwe Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.89 2017/02/18 01:29:09 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -134,7 +134,9 @@ elf_placedynexec(struct exec_package *ep
 			align = ph[i].p_align;
 
 	offset = (Elf_Addr)pax_aslr_exec_offset(epp, align);
-	offset += epp->ep_vm_minaddr;
+	if (offset < epp->ep_vm_minaddr)
+		offset = roundup(epp->ep_vm_minaddr, align);
+	KASSERT((offset & (align - 1)) == 0);
 
 	for (i = 0; i < eh->e_phnum; i++)
 		ph[i].p_vaddr += offset;

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.57 src/sys/kern/kern_pax.c:1.58
--- src/sys/kern/kern_pax.c:1.57	Sat Sep 17 02:29:11 2016
+++ src/sys/kern/kern_pax.c	Sat Feb 18 01:29:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.57 2016/09/17 02:29:11 christos Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.58 2017/02/18 01:29:09 chs Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.57 2016/09/17 02:29:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.58 2017/02/18 01:29:09 chs Exp $");
 
 #include "opt_pax.h"
 
@@ -578,7 +578,7 @@ pax_aslr_offset(vaddr_t align)
 	uint32_t rand;
 	vaddr_t offset;
 
-	pax_align = align == 0 ? PGSHIFT : align;
+	pax_align = align == 0 ? PAGE_SIZE : align;
 	l2 = ilog2(pax_align);
 
 	rand = cprng_fast32();
@@ -590,7 +590,8 @@ pax_aslr_offset(vaddr_t align)
 #define	PAX_TRUNC(a, b)	((a) & ~((b) - 1))
 
 	delta = PAX_ASLR_DELTA(rand, l2, PAX_ASLR_DELTA_EXEC_LEN);
-	offset = PAX_TRUNC(delta, pax_align) + PAGE_SIZE;
+	offset = PAX_TRUNC(delta, pax_align);
+	offset = MAX(offset, pax_align);
 
 	PAX_DPRINTF("rand=%#x l2=%#zx pax_align=%#zx delta=%#zx offset=%#jx",
 	rand, l2, pax_align, delta, (uintmax_t)offset);
@@ -608,9 +609,9 @@ pax_aslr_exec_offset(struct exec_package
 	if (pax_aslr_flags & PAX_ASLR_EXEC_OFFSET)
 		goto out;
 #endif
-	return pax_aslr_offset(align) + PAGE_SIZE;
+	return pax_aslr_offset(align);
 out:
-	return MAX(align, PAGE_SIZE);
+	return 0;
 }
 
 voff_t



CVS commit: src/external/bsd/blacklist/bin

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 18 00:26:16 UTC 2017

Modified Files:
src/external/bsd/blacklist/bin: blacklistd.c

Log Message:
more debugging from Kurt Lidl


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/external/bsd/blacklist/bin/blacklistd.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/blacklist/bin/blacklistd.c
diff -u src/external/bsd/blacklist/bin/blacklistd.c:1.36 src/external/bsd/blacklist/bin/blacklistd.c:1.37
--- src/external/bsd/blacklist/bin/blacklistd.c:1.36	Sun Jan  8 22:05:48 2017
+++ src/external/bsd/blacklist/bin/blacklistd.c	Fri Feb 17 19:26:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: blacklistd.c,v 1.36 2017/01/09 03:05:48 christos Exp $	*/
+/*	$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "config.h"
 #endif
 #include 
-__RCSID("$NetBSD: blacklistd.c,v 1.36 2017/01/09 03:05:48 christos Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $");
 
 #include 
 #include 
@@ -207,7 +207,7 @@ process(bl_t bl)
 
 	if (debug) {
 		char b1[128], b2[128];
-		(*lfun)(LOG_DEBUG, "%s: db state info for %s: count=%d/%d "
+		(*lfun)(LOG_DEBUG, "%s: initial db state for %s: count=%d/%d "
 		"last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail,
 		fmttime(b1, sizeof(b1), dbi.last),
 		fmttime(b2, sizeof(b2), ts.tv_sec));
@@ -246,15 +246,24 @@ process(bl_t bl)
 	case BL_DELETE:
 		if (dbi.last == 0)
 			goto out;
+		dbi.count = 0;
 		dbi.last = 0;
 		break;
 	default:
 		(*lfun)(LOG_ERR, "unknown message %d", bi->bi_type); 
 	}
-	if (state_put(state, &c, &dbi) == -1)
-		goto out;
+	state_put(state, &c, &dbi);
+
 out:
 	close(bi->bi_fd);
+
+	if (debug) {
+		char b1[128], b2[128];
+		(*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d "
+		"last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail,
+		fmttime(b1, sizeof(b1), dbi.last),
+		fmttime(b2, sizeof(b2), ts.tv_sec));
+	}
 }
 
 static void
@@ -393,7 +402,7 @@ rules_restore(void)
 int
 main(int argc, char *argv[])
 {
-	int c, tout, flags, flush, restore;
+	int c, tout, flags, flush, restore, ret;
 	const char *spath, **blsock;
 	size_t nblsock, maxblsock;
 
@@ -528,7 +537,10 @@ main(int argc, char *argv[])
 			readconf = 0;
 			conf_parse(configfile);
 		}
-		switch (poll(pfd, (nfds_t)nfd, tout)) {
+		ret = poll(pfd, (nfds_t)nfd, tout);
+		if (debug)
+			(*lfun)(LOG_DEBUG, "received %d from poll()", ret);
+		switch (ret) {
 		case -1:
 			if (errno == EINTR)
 continue;



CVS commit: src/share/man/man9

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 17 22:31:08 UTC 2017

Modified Files:
src/share/man/man9/man9.i386: bios32_service.9
src/share/man/man9/man9.x86: rdmsr.9 tsc.9 x86_msr_xcall.9

Log Message:
Fix cross references


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/man9.i386/bios32_service.9
cvs rdiff -u -r1.3 -r1.4 src/share/man/man9/man9.x86/rdmsr.9
cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/man9.x86/tsc.9
cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/man9.x86/x86_msr_xcall.9

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

Modified files:

Index: src/share/man/man9/man9.i386/bios32_service.9
diff -u src/share/man/man9/man9.i386/bios32_service.9:1.7 src/share/man/man9/man9.i386/bios32_service.9:1.8
--- src/share/man/man9/man9.i386/bios32_service.9:1.7	Mon Jan  6 08:59:00 2014
+++ src/share/man/man9/man9.i386/bios32_service.9	Fri Feb 17 17:31:08 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: bios32_service.9,v 1.7 2014/01/06 13:59:00 njoly Exp $
+.\" $NetBSD: bios32_service.9,v 1.8 2017/02/17 22:31:08 christos Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 17, 2001
+.Dd February 17, 2017
 .Dt BIOS32_SERVICE 9 i386
 .Os
 .Sh NAME
@@ -48,4 +48,4 @@ and fills in the entry point information
 and
 .Fa ei .
 .Sh SEE ALSO
-.Xr bioscall 9
+.Xr i386/bioscall 9

Index: src/share/man/man9/man9.x86/rdmsr.9
diff -u src/share/man/man9/man9.x86/rdmsr.9:1.3 src/share/man/man9/man9.x86/rdmsr.9:1.4
--- src/share/man/man9/man9.x86/rdmsr.9:1.3	Fri Oct 28 03:23:18 2011
+++ src/share/man/man9/man9.x86/rdmsr.9	Fri Feb 17 17:31:08 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: rdmsr.9,v 1.3 2011/10/28 07:23:18 jruoho Exp $
+.\" $NetBSD: rdmsr.9,v 1.4 2017/02/17 22:31:08 christos Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 28, 2011
+.Dd February 17, 2017
 .Dt RDMSR 9 x86
 .Os
 .Sh NAME
@@ -116,4 +116,4 @@ via
 .Fn x86_cpuid .
 .Sh SEE ALSO
 .Xr rdtsc 9 ,
-.Xr x86_msr_xcall 9
+.Xr x86/x86_msr_xcall 9

Index: src/share/man/man9/man9.x86/tsc.9
diff -u src/share/man/man9/man9.x86/tsc.9:1.6 src/share/man/man9/man9.x86/tsc.9:1.7
--- src/share/man/man9/man9.x86/tsc.9:1.6	Mon May  4 04:15:21 2015
+++ src/share/man/man9/man9.x86/tsc.9	Fri Feb 17 17:31:08 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: tsc.9,v 1.6 2015/05/04 08:15:21 pgoyette Exp $
+.\" $NetBSD: tsc.9,v 1.7 2017/02/17 22:31:08 christos Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 4, 2015
+.Dd February 17, 2017
 .Dt TSC 9 x86
 .Os
 .Sh NAME
@@ -148,5 +148,5 @@ attach.
 .Xr gettimeofday 2 ,
 .Xr hpet 4 ,
 .Xr hz 9 ,
-.Xr rdmsr 9 ,
+.Xr x86/rdmsr 9 ,
 .Xr timecounter 9

Index: src/share/man/man9/man9.x86/x86_msr_xcall.9
diff -u src/share/man/man9/man9.x86/x86_msr_xcall.9:1.4 src/share/man/man9/man9.x86/x86_msr_xcall.9:1.5
--- src/share/man/man9/man9.x86/x86_msr_xcall.9:1.4	Tue Oct 25 01:04:33 2011
+++ src/share/man/man9/man9.x86/x86_msr_xcall.9	Fri Feb 17 17:31:08 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: x86_msr_xcall.9,v 1.4 2011/10/25 05:04:33 jruoho Exp $
+.\" $NetBSD: x86_msr_xcall.9,v 1.5 2017/02/17 22:31:08 christos Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 25, 2011
+.Dd February 17, 2017
 .Dt X86_MSR_XCALL 9 x86
 .Os
 .Sh NAME
@@ -94,5 +94,5 @@ xc = xc_broadcast(0, (xcfunc_t)x86_msr_x
 xc_wait(xc);
 .Ed
 .Sh SEE ALSO
-.Xr rdmsr 9 ,
+.Xr x86/rdmsr 9 ,
 .Xr xcall 9



CVS commit: src/share/man/man8

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 17 22:30:28 UTC 2017

Modified Files:
src/share/man/man8/man8.acorn32: nbfs.8
src/share/man/man8/man8.alpha: boot.8 mkbootimage.8 setnetbootinfo.8
src/share/man/man8/man8.amiga: boot.8 installboot.8
src/share/man/man8/man8.atari: ahdilabel.8 boot.8 bootpref.8
installboot.8
src/share/man/man8/man8.hpcmips: boot.8
src/share/man/man8/man8.macppc: boot.8
src/share/man/man8/man8.prep: boot.8 mkbootimage.8
src/share/man/man8/man8.sgimips: boot.8 sgivol.8
src/share/man/man8/man8.vax: drtest.8 format.8
src/share/man/man8/man8.x68k: loadbsd.8 newdisk.8
src/share/man/man8/man8.x86: boot.8 boot_console.8 dosboot.8 mbr.8
pxeboot.8

Log Message:
fix crossrefs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man8/man8.acorn32/nbfs.8
cvs rdiff -u -r1.13 -r1.14 src/share/man/man8/man8.alpha/boot.8
cvs rdiff -u -r1.7 -r1.8 src/share/man/man8/man8.alpha/mkbootimage.8
cvs rdiff -u -r1.11 -r1.12 src/share/man/man8/man8.alpha/setnetbootinfo.8
cvs rdiff -u -r1.14 -r1.15 src/share/man/man8/man8.amiga/boot.8
cvs rdiff -u -r1.21 -r1.22 src/share/man/man8/man8.amiga/installboot.8
cvs rdiff -u -r1.11 -r1.12 src/share/man/man8/man8.atari/ahdilabel.8
cvs rdiff -u -r1.13 -r1.14 src/share/man/man8/man8.atari/boot.8 \
src/share/man/man8/man8.atari/installboot.8
cvs rdiff -u -r1.12 -r1.13 src/share/man/man8/man8.atari/bootpref.8
cvs rdiff -u -r1.4 -r1.5 src/share/man/man8/man8.hpcmips/boot.8
cvs rdiff -u -r1.6 -r1.7 src/share/man/man8/man8.macppc/boot.8
cvs rdiff -u -r1.3 -r1.4 src/share/man/man8/man8.prep/boot.8
cvs rdiff -u -r1.6 -r1.7 src/share/man/man8/man8.prep/mkbootimage.8
cvs rdiff -u -r1.6 -r1.7 src/share/man/man8/man8.sgimips/boot.8
cvs rdiff -u -r1.9 -r1.10 src/share/man/man8/man8.sgimips/sgivol.8
cvs rdiff -u -r1.14 -r1.15 src/share/man/man8/man8.vax/drtest.8
cvs rdiff -u -r1.12 -r1.13 src/share/man/man8/man8.vax/format.8
cvs rdiff -u -r1.4 -r1.5 src/share/man/man8/man8.x68k/loadbsd.8
cvs rdiff -u -r1.10 -r1.11 src/share/man/man8/man8.x68k/newdisk.8
cvs rdiff -u -r1.8 -r1.9 src/share/man/man8/man8.x86/boot.8
cvs rdiff -u -r1.2 -r1.3 src/share/man/man8/man8.x86/boot_console.8 \
src/share/man/man8/man8.x86/dosboot.8 \
src/share/man/man8/man8.x86/pxeboot.8
cvs rdiff -u -r1.1 -r1.2 src/share/man/man8/man8.x86/mbr.8

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/man8/man8.acorn32/nbfs.8
diff -u src/share/man/man8/man8.acorn32/nbfs.8:1.2 src/share/man/man8/man8.acorn32/nbfs.8:1.3
--- src/share/man/man8/man8.acorn32/nbfs.8:1.2	Thu Nov 25 04:13:37 2010
+++ src/share/man/man8/man8.acorn32/nbfs.8	Fri Feb 17 17:30:27 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: nbfs.8,v 1.2 2010/11/25 09:13:37 wiz Exp $
+.\" $NetBSD: nbfs.8,v 1.3 2017/02/17 22:30:27 christos Exp $
 .\"
 .\" Copyright (c) 2006 Ben Harris
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (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 July 3, 2006
+.Dd February 17, 2017
 .Dt NBFS 8 acorn32
 .Os
 .Sh NAME
@@ -73,7 +73,7 @@ on the partition mentioned above would b
 .Nm
 is very limited.
 .Sh SEE ALSO
-.Xr boot32 8
+.Xr acorn32/boot32 8
 .Rs
 .%Q Acorn Computers Ltd
 .%T RISC OS 3.7 User Guide

Index: src/share/man/man8/man8.alpha/boot.8
diff -u src/share/man/man8/man8.alpha/boot.8:1.13 src/share/man/man8/man8.alpha/boot.8:1.14
--- src/share/man/man8/man8.alpha/boot.8:1.13	Thu Aug  7 06:31:22 2003
+++ src/share/man/man8/man8.alpha/boot.8	Fri Feb 17 17:30:27 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: boot.8,v 1.13 2003/08/07 10:31:22 agc Exp $
+.\" $NetBSD: boot.8,v 1.14 2017/02/17 22:30:27 christos Exp $
 .\"
 .\" Copyright (c) 1999 Christopher G. Demetriou
 .\" All rights reserved.
@@ -66,7 +66,7 @@
 .\"
 .\" @(#)boot_hp300.88.2 (Berkeley) 4/19/94
 .\"
-.Dd May 29, 2003
+.Dd February 17, 2017
 .Dt BOOT 8 alpha
 .Os
 .Sh NAME
@@ -515,11 +515,11 @@ disk and tape bootstrap
 .Xr diskless 8 ,
 .Xr init 8 ,
 .Xr installboot 8 ,
-.Xr mkbootimage 8 ,
+.Xr alpha/mkbootimage 8 ,
 .Xr rc 8 ,
 .Xr reboot 8 ,
 .Xr savecore 8 ,
-.Xr setnetbootinfo 8 ,
+.Xr alpha/setnetbootinfo 8 ,
 .Xr shutdown 8
 .Rs
 .%T "Alpha Architecture Reference Manual Third Edition"

Index: src/share/man/man8/man8.alpha/mkbootimage.8
diff -u src/share/man/man8/man8.alpha/mkbootimage.8:1.7 src/share/man/man8/man8.alpha/mkbootimage.8:1.8
--- src/share/man/man8/man8.alpha/mkbootimage.8:1.7	Sat Jul 26 16:17:38 2003
+++ src/share/man/man8/man8.alpha/mkbootimage.8	Fri Feb 17 17:30:27 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: mkbootimage.8,v 1.7 2003/07/26 20:17:38 salo Exp $
+.\" $NetBSD: mkbootimage.8,v 1.8 2017/02/17 22:30:27 christos Exp $
 .\"
 .\" Copyright (c) 1999 Christopher G. Demetriou
 .\" All rights 

CVS commit: src/share/man/man4/man4.acorn32

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 17 22:19:00 UTC 2017

Modified Files:
src/share/man/man4/man4.acorn32: asc.4 autoconf.4 cosc.4 csc.4 ie.4
intro.4 iomdkbc.4 ptsc.4

Log Message:
fix cross references


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/man4.acorn32/asc.4 \
src/share/man/man4/man4.acorn32/autoconf.4 \
src/share/man/man4/man4.acorn32/cosc.4 \
src/share/man/man4/man4.acorn32/csc.4 \
src/share/man/man4/man4.acorn32/ie.4 \
src/share/man/man4/man4.acorn32/ptsc.4
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/man4.acorn32/intro.4 \
src/share/man/man4/man4.acorn32/iomdkbc.4

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/man4.acorn32/asc.4
diff -u src/share/man/man4/man4.acorn32/asc.4:1.2 src/share/man/man4/man4.acorn32/asc.4:1.3
--- src/share/man/man4/man4.acorn32/asc.4:1.2	Thu Apr 17 06:32:39 2003
+++ src/share/man/man4/man4.acorn32/asc.4	Fri Feb 17 17:19:00 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: asc.4,v 1.2 2003/04/17 10:32:39 wiz Exp $
+.\" $NetBSD: asc.4,v 1.3 2017/02/17 22:19:00 christos Exp $
 .\"
 .\" Copyright (c) 1995 Mark Brinicombe
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (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 April 6, 1999
+.Dd February 17, 2017
 .Dt ASC 4 acorn32
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ The
 .Nm
 interface provides access to Acorn SCSI Card interfaces.
 .Sh SEE ALSO
-.Xr cosc 4 ,
-.Xr csc 4 ,
+.Xr acorn32/cosc 4 ,
+.Xr acorn32/csc 4 ,
 .Xr oak 4 ,
-.Xr ptsc 4
+.Xr acorn32/ptsc 4
Index: src/share/man/man4/man4.acorn32/autoconf.4
diff -u src/share/man/man4/man4.acorn32/autoconf.4:1.2 src/share/man/man4/man4.acorn32/autoconf.4:1.3
--- src/share/man/man4/man4.acorn32/autoconf.4:1.2	Mon Jun 20 09:25:24 2005
+++ src/share/man/man4/man4.acorn32/autoconf.4	Fri Feb 17 17:19:00 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: autoconf.4,v 1.2 2005/06/20 13:25:24 peter Exp $
+.\" $NetBSD: autoconf.4,v 1.3 2017/02/17 22:19:00 christos Exp $
 .\"
 .\" Copyright (c) 1995 Mark Brinicombe
 .\" Copyright (c) 1994 Christopher G. Demetriou
@@ -29,7 +29,7 @@
 .\" (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 June 14, 2000
+.Dd February 17, 2017
 .Dt AUTOCONF 4 acorn32
 .Os
 .Sh NAME
@@ -61,5 +61,5 @@ doesn't) understand.
 .El
 .Sh SEE ALSO
 .Xr config 1 ,
-.Xr intro 4 ,
+.Xr acorn32/intro 4 ,
 .Xr boot 8
Index: src/share/man/man4/man4.acorn32/cosc.4
diff -u src/share/man/man4/man4.acorn32/cosc.4:1.2 src/share/man/man4/man4.acorn32/cosc.4:1.3
--- src/share/man/man4/man4.acorn32/cosc.4:1.2	Thu Apr 17 06:32:39 2003
+++ src/share/man/man4/man4.acorn32/cosc.4	Fri Feb 17 17:19:00 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: cosc.4,v 1.2 2003/04/17 10:32:39 wiz Exp $
+.\" $NetBSD: cosc.4,v 1.3 2017/02/17 22:19:00 christos Exp $
 .\"
 .\" Copyright (c) 1996 Mark Brinicombe
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 15, 1999
+.Dd February 17, 2017
 .Dt COSC 4 acorn32
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ The
 .Nm
 interface provides access to MCS Connect32 interfaces.
 .Sh SEE ALSO
-.Xr asc 4 ,
-.Xr csc 4 ,
+.Xr acorn32/asc 4 ,
+.Xr acorn32/csc 4 ,
 .Xr oak 4 ,
-.Xr ptsc 4
+.Xr acorn32/ptsc 4
Index: src/share/man/man4/man4.acorn32/csc.4
diff -u src/share/man/man4/man4.acorn32/csc.4:1.2 src/share/man/man4/man4.acorn32/csc.4:1.3
--- src/share/man/man4/man4.acorn32/csc.4:1.2	Thu Apr 17 06:32:39 2003
+++ src/share/man/man4/man4.acorn32/csc.4	Fri Feb 17 17:19:00 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: csc.4,v 1.2 2003/04/17 10:32:39 wiz Exp $
+.\" $NetBSD: csc.4,v 1.3 2017/02/17 22:19:00 christos Exp $
 .\"
 .\" Copyright (c) 1995 Mark Brinicombe
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (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 April 6, 1999
+.Dd February 17, 2017
 .Dt CSC 4 acorn32
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ The
 .Nm
 interface provides access to Cumana SCSI II interfaces.
 .Sh SEE ALSO
-.Xr asc 4 ,
-.Xr cosc 4 ,
+.Xr acorn32/asc 4 ,
+.Xr acorn32/cosc 4 ,
 .Xr oak 4 ,
-.Xr ptsc 4
+.Xr acorn32/ptsc 4
Index: src/share/man/man4/man4.acorn32/ie.4
diff -u src/share/man/man4/man4.acorn32/ie.4:1.2 src/share/man/man4/man4.acorn32/ie.4:1.3
--- src/share/man/man4/man4.acorn32/ie.4:1.2	Thu Apr 17 06:32:39 2003
+++ src/share/man/man4/man4.acorn32/ie.4	Fri Feb 17 17:19:00 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: ie.4,v 1.2 2003/04/17 10:32:39 wiz Exp $
+.\" $NetBSD: ie.4,v 1.3 2017/02/17 22:19:00 christos Exp $
 .\"
 .\" Copyright (c) 1995

CVS commit: src/share/man/man4/man4.x86

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 17 22:10:47 UTC 2017

Modified Files:
src/share/man/man4/man4.x86: amdpcib.4 apic.4 est.4 fwhrng.4 ichlpcib.4
odcm.4 powernow.4

Log Message:
Fix .Xr


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/man4.x86/amdpcib.4 \
src/share/man/man4/man4.x86/powernow.4
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.x86/apic.4 \
src/share/man/man4/man4.x86/fwhrng.4
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/man4.x86/est.4 \
src/share/man/man4/man4.x86/odcm.4
cvs rdiff -u -r1.10 -r1.11 src/share/man/man4/man4.x86/ichlpcib.4

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/man4.x86/amdpcib.4
diff -u src/share/man/man4/man4.x86/amdpcib.4:1.2 src/share/man/man4/man4.x86/amdpcib.4:1.3
--- src/share/man/man4/man4.x86/amdpcib.4:1.2	Fri Aug  6 12:44:06 2010
+++ src/share/man/man4/man4.x86/amdpcib.4	Fri Feb 17 17:10:47 2017
@@ -1,11 +1,11 @@
-.\"	$NetBSD: amdpcib.4,v 1.2 2010/08/06 16:44:06 jruoho Exp $
+.\"	$NetBSD: amdpcib.4,v 1.3 2017/02/17 22:10:47 christos Exp $
 .\"
 .\" $OpenBSD: amdpcib.4,v 1.4 2007/10/08 12:48:21 jmc Exp $
 .\"
 .\" Marc Balmer, 2007. Public Domain.
 .\" Jukka Ruohonen, 2010. Public Domain.
 .\"
-.Dd August 8, 2010
+.Dd February 17, 2017
 .Dt AMDPCIB 4 x86
 .Os
 .Sh NAME
@@ -23,7 +23,7 @@ driver provides support for the AMD-8111
 bridge and implements a 32/64-bit
 14.3 MHz (or variable) timecounter using the HPET timer.
 .Sh SEE ALSO
-.Xr hpet 4 ,
+.Xr x86/hpet 4 ,
 .Xr isa 4 ,
 .Xr pci 4
 .Rs
Index: src/share/man/man4/man4.x86/powernow.4
diff -u src/share/man/man4/man4.x86/powernow.4:1.2 src/share/man/man4/man4.x86/powernow.4:1.3
--- src/share/man/man4/man4.x86/powernow.4:1.2	Fri Mar  4 00:58:07 2011
+++ src/share/man/man4/man4.x86/powernow.4	Fri Feb 17 17:10:47 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: powernow.4,v 1.2 2011/03/04 05:58:07 jruoho Exp $
+.\" $NetBSD: powernow.4,v 1.3 2017/02/17 22:10:47 christos Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 4, 2011
+.Dd February 17, 2017
 .Dt POWERNOW 4
 .Os
 .Sh NAME
@@ -61,8 +61,8 @@ not guaranteed to exist in the future ve
 .Nx .
 .Sh SEE ALSO
 .Xr acpicpu 4 ,
-.Xr est 4 ,
-.Xr odcm 4
+.Xr x86/est 4 ,
+.Xr x86/odcm 4
 .Sh CAVEATS
 The
 .Nm

Index: src/share/man/man4/man4.x86/apic.4
diff -u src/share/man/man4/man4.x86/apic.4:1.1 src/share/man/man4/man4.x86/apic.4:1.2
--- src/share/man/man4/man4.x86/apic.4:1.1	Mon Jun  6 12:52:15 2011
+++ src/share/man/man4/man4.x86/apic.4	Fri Feb 17 17:10:47 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: apic.4,v 1.1 2011/06/06 16:52:15 jruoho Exp $
+.\" $NetBSD: apic.4,v 1.2 2017/02/17 22:10:47 christos Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 6, 2011
+.Dd February 17, 2017
 .Dt APIC 4 x86
 .Os
 .Sh NAME
@@ -121,7 +121,7 @@ But the widespread use of
 systems has made this mainly a fallback option.
 .Sh SEE ALSO
 .Xr acpi 4 ,
-.Xr ichlpcib 4 ,
+.Xr x86/ichlpcib 4 ,
 .Xr mainbus 4
 .Rs
 .%A Intel Corporation
Index: src/share/man/man4/man4.x86/fwhrng.4
diff -u src/share/man/man4/man4.x86/fwhrng.4:1.1 src/share/man/man4/man4.x86/fwhrng.4:1.2
--- src/share/man/man4/man4.x86/fwhrng.4:1.1	Fri Aug  6 13:00:13 2010
+++ src/share/man/man4/man4.x86/fwhrng.4	Fri Feb 17 17:10:47 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fwhrng.4,v 1.1 2010/08/06 17:00:13 jruoho Exp $
+.\"	$NetBSD: fwhrng.4,v 1.2 2017/02/17 22:10:47 christos Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 29, 2010
+.Dd February 17, 2017
 .Dt FWHRNG 4 x86
 .Os
 .Sh NAME
@@ -48,7 +48,7 @@ through an
 controller hub
 .Pq Tn ICH .
 .Sh SEE ALSO
-.Xr ichlpcib 4 ,
+.Xr x86/ichlpcib 4 ,
 .Xr rnd 4
 .Rs
 .%A Intel Corporation

Index: src/share/man/man4/man4.x86/est.4
diff -u src/share/man/man4/man4.x86/est.4:1.4 src/share/man/man4/man4.x86/est.4:1.5
--- src/share/man/man4/man4.x86/est.4:1.4	Thu Oct 20 09:54:38 2011
+++ src/share/man/man4/man4.x86/est.4	Fri Feb 17 17:10:47 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: est.4,v 1.4 2011/10/20 13:54:38 jruoho Exp $
+.\" $NetBSD: est.4,v 1.5 2017/02/17 22:10:47 christos Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 20, 2011
+.Dd February 17, 2017
 .Dt EST 4
 .Os
 .Sh NAME
@@ -57,8 +57,8 @@ not guaranteed to exist in t

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

2017-02-17 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Feb 17 21:51:47 UTC 2017

Modified Files:
src/sys/arch/xen/conf: files.xen

Log Message:
Copy maxv's files.i386 change to files.xen ... this might fix the i386
xen kernel builds (I am doing a test build in parallel with this commit,
this shouldn't make things worse ... I will make further changes if
needed after my build finishes.)

Note: I am not currently in a position to test a Xen3 DomU kernel
(let alone Dom0) so I have no way of knowing whether a Xen kernel
with PMC included will actually work correctly or not.

If this results in a system that builds, I'd appreciate it if someone
who can test the Xen3_DOMU kernel could do so.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/xen/conf/files.xen

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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.143 src/sys/arch/xen/conf/files.xen:1.144
--- src/sys/arch/xen/conf/files.xen:1.143	Thu Dec 15 12:04:18 2016
+++ src/sys/arch/xen/conf/files.xen	Fri Feb 17 21:51:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.143 2016/12/15 12:04:18 kamil Exp $
+#	$NetBSD: files.xen,v 1.144 2017/02/17 21:51:47 kre Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -50,12 +50,11 @@ file	arch/i386/i386/kobj_machdep.c	modul
 file	arch/i386/i386/machdep.c
 file	arch/i386/i386/longrun.c
 file	arch/i386/i386/mtrr_k6.c	mtrr
+file	arch/i386/i386/pmc.c
 file	arch/i386/i386/process_machdep.c
 file	arch/i386/i386/trap.c
 file	arch/i386/i386/lock_stubs.S
 
-file	arch/i386/i386/pmc.c			perfctrs
-
 file	crypto/des/arch/i386/des_enc.S		des
 file	crypto/des/arch/i386/des_cbc.S		des
 



CVS commit: src

2017-02-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 17 21:34:19 UTC 2017

Modified Files:
src: UPDATING

Log Message:
Remove entry for "TRAP_HWWPT renamed to TRAP_DBREG" from UPDATING

Suggested by K.R.Elz


To generate a diff of this commit:
cvs rdiff -u -r1.282 -r1.283 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.282 src/UPDATING:1.283
--- src/UPDATING:1.282	Fri Feb 17 01:42:59 2017
+++ src/UPDATING	Fri Feb 17 21:34:19 2017
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.282 2017/02/17 01:42:59 kamil Exp $
+$NetBSD: UPDATING,v 1.283 2017/02/17 21:34:19 kamil Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,11 +19,6 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
-20170217:
-	TRAP_HWWPT renamed to TRAP_DBREG, remove obj copy of siginfo.c
-	(usr.bin/kdump/siginfo.c and rescue/kdump/siginfo.c) to regenerate
-	if you build.sh -u
-
 20170211:
 	a new terminfo database has been imported.
 	The structure of it has changed slightly from prior versions and



CVS commit: src/share/man/man8/man8.x86

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 17 21:31:49 UTC 2017

Modified Files:
src/share/man/man8/man8.x86: boot.8 boot_console.8

Log Message:
fix cross references.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man8/man8.x86/boot.8
cvs rdiff -u -r1.1 -r1.2 src/share/man/man8/man8.x86/boot_console.8

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/man8/man8.x86/boot.8
diff -u src/share/man/man8/man8.x86/boot.8:1.7 src/share/man/man8/man8.x86/boot.8:1.8
--- src/share/man/man8/man8.x86/boot.8:1.7	Sun Jun 19 18:27:56 2016
+++ src/share/man/man8/man8.x86/boot.8	Fri Feb 17 16:31:49 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: boot.8,v 1.7 2016/06/19 22:27:56 pgoyette Exp $
+.\"	$NetBSD: boot.8,v 1.8 2017/02/17 21:31:49 christos Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)boot_i386.8	8.2 (Berkeley) 4/19/94
 .\"
-.Dd April 25, 2015
+.Dd February 17, 2017
 .Dt BOOT 8 x86
 .Os
 .Sh NAME
@@ -54,18 +54,18 @@ or
 can use any of the following boot procedures, depending on what the hardware and
 .Tn BIOS
 support:
-.Bl -tag -width "pxeboot(8)"
+.Bl -tag -width "x86/pxeboot(8)"
 .It boot
 bootstrap
 .Nx
 from the system
 .Tn BIOS
-.It Xr dosboot 8
+.It Xr x86/dosboot 8
 bootstrap
 .Nx
 from
 .Tn MS-DOS
-.It Xr pxeboot 8
+.It Xr x86/pxeboot 8
 network bootstrap
 .Nx
 from a
@@ -95,7 +95,7 @@ or by a boot selector program (such as O
 .Nx Ns 's
 .No boot-selecting
 master boot record - see
-.Xr mbr 8 ) .
+.Xr x86/mbr 8 ) .
 .Ss Normal Operation
 Once running, a banner similar to the following will appear:
 .Bd -unfilled -offset indent
@@ -160,7 +160,7 @@ to the kernel as strings.
 If the first stage boot fails to load the boot, it will print a terse
 message indicating the reason for the failure.
 The possible error messages and their cause are listed in
-.Xr mbr 8 .
+.Xr x86/mbr 8 .
 .Pp
 If the first stage boot succeeds, the banner will be shown and the
 error messages should be self-explanatory.
@@ -169,7 +169,7 @@ In interactive mode, the boot loader wil
 input of these commands:
 .\" NOTE: much of this text is duplicated in the MI boot.8.
 .\" Some of it is
-.\" also duplicated in the x86-specific dosboot.8 and pxeboot.8;
+.\" also duplicated in the x86-specific x86/dosboot.8 and x86/pxeboot.8;
 .\" please try to keep all relevant files synchronized.
 .Bl -tag -width 04n -offset 04n
 .It Ic boot Oo Va device : Oc Ns Oo Va filename Oc Oo Fl 1234abcdmqsvxz Oc
@@ -341,7 +341,7 @@ or
 See
 .Sx Console Selection Policy
 in
-.Xr boot_console 8 .
+.Xr x86/boot_console 8 .
 .It Ic dev Op Va device
 Set the default drive and partition for subsequent file system
 operations.
@@ -411,7 +411,7 @@ for cases where the root file system has
 from network (see the
 .Sx BUGS
 section in
-.Xr pxeboot 8 ) .
+.Xr x86/pxeboot 8 ) .
 .It Ic console Ns = Ns Ar dev
 Console used by DOM0 kernel during boot.
 .Ar dev
@@ -421,7 +421,7 @@ command.
 See
 .Sx Console Selection Policy
 in
-.Xr boot_console 8 .
+.Xr x86/boot_console 8 .
 .It Xo Ic ip Ns = Ns
 .Ar my_ip Ns : Ns Ar serv_ip Ns : Ns Ar gw_ip Ns : Ns
 .Ar mask Ns : Ns Ar host Ns : Ns Ar iface
@@ -530,7 +530,7 @@ A
 kernel that was built with
 .Cd options MULTIBOOT
 (see
-.Xr multiboot 8 )
+.Xr x86/multiboot 8 )
 may be booted with either the
 .Ic boot
 or
@@ -707,16 +707,16 @@ partition by
 .Xr pciback 4 ,
 .Xr userconf 4 ,
 .Xr boot.cfg 5 ,
-.Xr boot_console 8 ,
-.Xr dosboot 8 ,
 .Xr halt 8 ,
 .Xr installboot 8 ,
-.Xr mbr 8 ,
-.Xr multiboot 8 ,
-.Xr pxeboot 8 ,
 .Xr reboot 8 ,
 .Xr rescue 8 ,
 .Xr shutdown 8 ,
+.Xr x86/boot_console 8 ,
+.Xr x86/dosboot 8 ,
+.Xr x86/mbr 8 ,
+.Xr x86/multiboot 8 ,
+.Xr x86/pxeboot 8 ,
 .Xr boothowto 9
 .Sh BUGS
 The kernel file name must be specified before, not after, the boot options.

Index: src/share/man/man8/man8.x86/boot_console.8
diff -u src/share/man/man8/man8.x86/boot_console.8:1.1 src/share/man/man8/man8.x86/boot_console.8:1.2
--- src/share/man/man8/man8.x86/boot_console.8:1.1	Wed Jul 31 17:01:13 2013
+++ src/share/man/man8/man8.x86/boot_console.8	Fri Feb 17 16:31:49 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: boot_console.8,v 1.1 2013/07/31 21:01:13 soren Exp $
+.\"	$NetBSD: boot_console.8,v 1.2 2017/02/17 21:31:49 christos Exp $
 .\"
 .\" Copyright (c) 1997
 .\" 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 3, 2004
+.Dd February 17, 2017
 .Dt BOOT_CONSOLE 8 x86
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@ When booting from the system BIOS, the c
 are saved in the primary bootstrap by
 .Xr installboot 8 .
 For other boot procedures (such as
-.Xr dosboot 8 )
+.Xr x86/dosboot 8 )
 the selection process is controlled by bootloader compile-time
 options and system setup at the bootloader star

CVS commit: src/doc

2017-02-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 17 21:22:03 UTC 2017

Modified Files:
src/doc: TODO.ptrace

Log Message:
Add new entry in TODO.ptrace

Research kgdb. It should be supported by GDB and LLDB.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/doc/TODO.ptrace

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

Modified files:

Index: src/doc/TODO.ptrace
diff -u src/doc/TODO.ptrace:1.21 src/doc/TODO.ptrace:1.22
--- src/doc/TODO.ptrace:1.21	Tue Feb 14 18:38:07 2017
+++ src/doc/TODO.ptrace	Fri Feb 17 21:22:02 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.ptrace,v 1.21 2017/02/14 18:38:07 kamil Exp $
+$NetBSD: TODO.ptrace,v 1.22 2017/02/17 21:22:02 kamil Exp $
 
 Items we (currently) plan to finish in the ptrace(2) field:
 
@@ -30,6 +30,7 @@ Items we (currently) plan to finish in t
  - research support PT_SYSCALL & PT_STEP combined like in Linux
  - fix more calls for netbsd32 compat
  - research ipkdb(4)
+ - research kgdb(4)
 
 and of course: fix as many bugs as possible.
 



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

2017-02-17 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb 17 20:53:17 UTC 2017

Modified Files:
src/sys/arch/sparc64/dev: vbus.c

Log Message:
sun4v: Fix potential memory leaks - spotted by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/vbus.c

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

Modified files:

Index: src/sys/arch/sparc64/dev/vbus.c
diff -u src/sys/arch/sparc64/dev/vbus.c:1.2 src/sys/arch/sparc64/dev/vbus.c:1.3
--- src/sys/arch/sparc64/dev/vbus.c:1.2	Tue Jun 21 20:36:02 2016
+++ src/sys/arch/sparc64/dev/vbus.c	Fri Feb 17 20:53:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vbus.c,v 1.2 2016/06/21 20:36:02 palle Exp $	*/
+/*	$NetBSD: vbus.c,v 1.3 2017/02/17 20:53:17 palle Exp $	*/
 /*	$OpenBSD: vbus.c,v 1.8 2015/09/27 11:29:20 kettenis Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis
@@ -159,15 +159,15 @@ vbus_intr_map(int node, int ino, uint64_
 	if (imap_mask == NULL)
 		return (-1);
 	if (OF_getprop(parent, "interrupt-map-mask", imap_mask, len) != len)
-		return (-1);
+		goto out;
 
 	if (prom_getprop(parent, "interrupt-map", sizeof(int), &nimap, (void **)&imap))
-	  panic("vbus: can't get interrupt-map");
+		panic("vbus: can't get interrupt-map");
 
 	if (prom_getprop(node, "reg", sizeof(*reg), &nreg, (void **)®))
-		  panic("vbus: can't get reg");
+		panic("vbus: can't get reg");
 	if (nreg < address_cells)
-		return (-1);
+		goto out;
 
 	while (nimap >= address_cells + interrupt_cells + 2) {
 		if (vbus_cmp_cells(imap, reg, imap_mask, address_cells) &&
@@ -180,21 +180,24 @@ vbus_intr_map(int node, int ino, uint64_
 			reg = NULL;
 
 			if (prom_getprop(node, "reg", sizeof(*reg), &nreg, (void **)®))
-			  panic("vbus: can't get reg");
+panic("vbus: can't get reg");
 
 			devhandle = reg[0] & 0x0fff;
 
 			err = hv_intr_devino_to_sysino(devhandle, devino, sysino);
 			if (err != H_EOK)
-			  return (-1);
+goto out;
 
 			KASSERT(*sysino == INTVEC(*sysino));
+			free(imap_mask, M_DEVBUF);
 			return (0);
 		}
 		imap += address_cells + interrupt_cells + 2;
 		nimap -= address_cells + interrupt_cells + 2;
 	}
 
+out:
+	free(imap_mask, M_DEVBUF);
 	return (-1);
 }
 



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

2017-02-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 17 19:43:40 UTC 2017

Modified Files:
src/sys/arch/shark/conf: majors.shark

Log Message:
add major number for pci ( same as in arch/arm/conf )


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/shark/conf/majors.shark

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/shark/conf/majors.shark
diff -u src/sys/arch/shark/conf/majors.shark:1.27 src/sys/arch/shark/conf/majors.shark:1.28
--- src/sys/arch/shark/conf/majors.shark:1.27	Thu Jun 30 20:09:36 2011
+++ src/sys/arch/shark/conf/majors.shark	Fri Feb 17 19:43:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.shark,v 1.27 2011/06/30 20:09:36 wiz Exp $
+#	$NetBSD: majors.shark,v 1.28 2017/02/17 19:43:40 macallan Exp $
 #
 # Device majors for shark
 #
@@ -60,6 +60,7 @@ device-major	openfirm	char 77			openfirm
 
 device-major	clockctl	char 84			clockctl
 device-major	ksyms		char 86			ksyms
+device-major	pci		char 88			pci
 
 device-major	nsmb		char 98			nsmb
 



CVS commit: src/sys/netinet

2017-02-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 18:09:25 UTC 2017

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

Log Message:
Fix return value


To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.351 src/sys/netinet/ip_input.c

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

Modified files:

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.350 src/sys/netinet/ip_input.c:1.351
--- src/sys/netinet/ip_input.c:1.350	Fri Feb 17 04:32:10 2017
+++ src/sys/netinet/ip_input.c	Fri Feb 17 18:09:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.350 2017/02/17 04:32:10 ozaki-r Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.351 2017/02/17 18:09:25 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.350 2017/02/17 04:32:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.351 2017/02/17 18:09:25 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1619,7 +1619,7 @@ sysctl_net_inet_ip_pmtudto(SYSCTLFN_ARGS
 	error = 0;
 out:
 	icmp_mtudisc_unlock();
-	return 0;
+	return error;
 }
 
 static int



CVS commit: src/sys/arch/shark

2017-02-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Feb 17 18:07:51 UTC 2017

Modified Files:
src/sys/arch/shark/conf: GENERIC files.shark
Added Files:
src/sys/arch/shark/ofw: vlpci.c

Log Message:
Add initial basic driver for DNARD's VT82C505 VL to PCI bridge.

Currently only allows configuration space, and I/O space access, the
latter of which has not yet been tested.  DMA support is currently
unimplemented.

Add commented lines to GENERIC.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/shark/conf/GENERIC
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/shark/conf/files.shark
cvs rdiff -u -r0 -r1.1 src/sys/arch/shark/ofw/vlpci.c

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

Modified files:

Index: src/sys/arch/shark/conf/GENERIC
diff -u src/sys/arch/shark/conf/GENERIC:1.126 src/sys/arch/shark/conf/GENERIC:1.127
--- src/sys/arch/shark/conf/GENERIC:1.126	Tue Dec 13 20:42:20 2016
+++ src/sys/arch/shark/conf/GENERIC	Fri Feb 17 18:07:51 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.126 2016/12/13 20:42:20 christos Exp $
+#	$NetBSD: GENERIC,v 1.127 2017/02/17 18:07:51 jakllsch Exp $
 #
 # Generic Shark configuration.
 #
@@ -7,7 +7,7 @@ include	"arch/shark/conf/std.shark"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.126 $"
+#ident		"GENERIC-$Revision: 1.127 $"
 
 # estimated number of users
 maxusers	32
@@ -276,6 +276,10 @@ spkr*		at audio?		# PC speaker (synthesi
 # Joystick @OFW
 joy*		at ofisa?
 
+# PCI @OFW
+#vlpci*		at ofbus?
+#pci*		at vlpci?
+
 # Pull in optional local configuration
 cinclude "arch/shark/conf/GENERIC.local"
 

Index: src/sys/arch/shark/conf/files.shark
diff -u src/sys/arch/shark/conf/files.shark:1.18 src/sys/arch/shark/conf/files.shark:1.19
--- src/sys/arch/shark/conf/files.shark:1.18	Wed Mar 23 04:06:03 2011
+++ src/sys/arch/shark/conf/files.shark	Fri Feb 17 18:07:51 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.shark,v 1.18 2011/03/23 04:06:03 macallan Exp $
+#	$NetBSD: files.shark,v 1.19 2017/02/17 18:07:51 jakllsch Exp $
 #
 # First try for arm-specific configuration info
 #
@@ -18,6 +18,12 @@ defflag	COMPAT_OLD_BOOTLOADER
 define todservice {}
 
 #
+# PCI drivers
+#
+include "dev/i2o/files.i2o"
+include "dev/pci/files.pci"
+
+#
 # ISA and mixed ISA+EISA or ISA+PCI drivers
 #
 include "dev/isa/files.isa"
@@ -130,6 +136,11 @@ file	arch/shark/ofw/igsfb_ofbus.c		igsfb
 attach	chipsfb at ofbus with chipsfb_ofbus
 file	arch/shark/ofw/chipsfb_ofbus.c		chipsfb_ofbus needs-flag
 
+# ofbus VLB Host to PCI Bridge (VIA VT82C505)
+device	vlpci: pcibus
+file	arch/shark/ofw/vlpci.c			vlpci
+attach	vlpci at ofbus
+
 # Smart Card Reader
 device	scr: tty
 file	arch/shark/shark/scr.c			scr needs-flag

Added files:

Index: src/sys/arch/shark/ofw/vlpci.c
diff -u /dev/null src/sys/arch/shark/ofw/vlpci.c:1.1
--- /dev/null	Fri Feb 17 18:07:51 2017
+++ src/sys/arch/shark/ofw/vlpci.c	Fri Feb 17 18:07:51 2017
@@ -0,0 +1,231 @@
+/*	$NetBSD: vlpci.c,v 1.1 2017/02/17 18:07:51 jakllsch Exp $	*/
+
+/*
+ * Copyright (c) 2017 Jonathan A. Kollasch
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: vlpci.c,v 1.1 2017/02/17 18:07:51 jakllsch Exp $");
+
+#include "opt_pci.h"
+#include "pci.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+static int	vlpci_match(device_t, struct cfdata *, void *);
+static void	vlpci_attach(device_t, device_t, void *);
+
+static void	vlpci_pc_attach_hook(device_t, device_t,
+struct pcibus_attach_args *);
+static int	vlpci_pc_

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

2017-02-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 17 17:33:00 UTC 2017

Modified Files:
src/external/bsd/file/dist/src: apprentice.c

Log Message:
Ignore files that start with .


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/file/dist/src/apprentice.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/file/dist/src/apprentice.c
diff -u src/external/bsd/file/dist/src/apprentice.c:1.16 src/external/bsd/file/dist/src/apprentice.c:1.17
--- src/external/bsd/file/dist/src/apprentice.c:1.16	Fri Feb 10 13:06:59 2017
+++ src/external/bsd/file/dist/src/apprentice.c	Fri Feb 17 12:33:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: apprentice.c,v 1.16 2017/02/10 18:06:59 christos Exp $	*/
+/*	$NetBSD: apprentice.c,v 1.17 2017/02/17 17:33:00 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
 #if 0
 FILE_RCSID("@(#)$File: apprentice.c,v 1.257 2017/02/04 16:46:16 christos Exp $")
 #else
-__RCSID("$NetBSD: apprentice.c,v 1.16 2017/02/10 18:06:59 christos Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.17 2017/02/17 17:33:00 christos Exp $");
 #endif
 #endif	/* lint */
 
@@ -1322,6 +1322,8 @@ apprentice_load(struct magic_set *ms, co
 			goto out;
 		}
 		while ((d = readdir(dir)) != NULL) {
+			if (d->d_name[0] == '.')
+continue;
 			if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) {
 file_oomem(ms,
 strlen(fn) + strlen(d->d_name) + 2);



CVS commit: src/sys/dev/pci

2017-02-17 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 17 12:16:37 UTC 2017

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

Log Message:
unify Tx softint and Rx softint to uniform ixg(4) design.

Furthermore, that can remove wm_deferred_start() which holds all txq's
txq_lock, so it would reduce lock contention between Tx interrupt handler and
Tx softint handler.


To generate a diff of this commit:
cvs rdiff -u -r1.483 -r1.484 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.483 src/sys/dev/pci/if_wm.c:1.484
--- src/sys/dev/pci/if_wm.c:1.483	Fri Feb 17 11:57:26 2017
+++ src/sys/dev/pci/if_wm.c	Fri Feb 17 12:16:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.483 2017/02/17 11:57:26 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.484 2017/02/17 12:16:37 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.483 2017/02/17 11:57:26 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.484 2017/02/17 12:16:37 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -404,6 +404,8 @@ struct wm_queue {
 
 	struct wm_txqueue wmq_txq;
 	struct wm_rxqueue wmq_rxq;
+
+	void *wmq_si;
 };
 
 struct wm_phyop {
@@ -709,8 +711,8 @@ static void	wm_nq_start_locked(struct if
 static int	wm_nq_transmit(struct ifnet *, struct mbuf *);
 static void	wm_nq_transmit_locked(struct ifnet *, struct wm_txqueue *);
 static void	wm_nq_send_common_locked(struct ifnet *, struct wm_txqueue *, bool);
-static void	wm_deferred_start(struct ifnet *);
 static void	wm_deferred_start_locked(struct wm_txqueue *);
+static void	wm_handle_queue(void *);
 /* Interrupt */
 static int	wm_txeof(struct wm_softc *, struct wm_txqueue *);
 static void	wm_rxeof(struct wm_rxqueue *);
@@ -1645,7 +1647,6 @@ wm_attach(device_t parent, device_t self
 	bool force_clear_smbi;
 	uint32_t link_mode;
 	uint32_t reg;
-	void (*deferred_start_func)(struct ifnet *) = NULL;
 
 	sc->sc_dev = self;
 	callout_init(&sc->sc_tick_ch, CALLOUT_FLAGS);
@@ -2539,16 +2540,12 @@ alloc_retry:
 	ifp->if_ioctl = wm_ioctl;
 	if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
 		ifp->if_start = wm_nq_start;
-		if (sc->sc_nqueues > 1) {
+		if (sc->sc_nqueues > 1)
 			ifp->if_transmit = wm_nq_transmit;
-			deferred_start_func = wm_deferred_start;
-		}
 	} else {
 		ifp->if_start = wm_start;
-		if (sc->sc_nqueues > 1) {
+		if (sc->sc_nqueues > 1)
 			ifp->if_transmit = wm_transmit;
-			deferred_start_func = wm_deferred_start;
-		}
 	}
 	ifp->if_watchdog = wm_watchdog;
 	ifp->if_init = wm_init;
@@ -2649,7 +2646,6 @@ alloc_retry:
 	/* Attach the interface. */
 	if_initialize(ifp);
 	sc->sc_ipq = if_percpuq_create(&sc->sc_ethercom.ec_if);
-	if_deferred_start_init(ifp, deferred_start_func);
 	ether_ifattach(ifp, enaddr);
 	if_register(ifp);
 	ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb);
@@ -4680,8 +4676,19 @@ wm_setup_msix(struct wm_softc *sc)
 			"for TX and RX interrupting at %s\n", intrstr);
 		}
 		sc->sc_ihs[intr_idx] = vih;
-		wmq->wmq_id= qidx;
+		wmq->wmq_id = qidx;
 		wmq->wmq_intr_idx = intr_idx;
+		wmq->wmq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
+		wm_handle_queue, wmq);
+		if (wmq->wmq_si == NULL) {
+			aprint_error_dev(sc->sc_dev,
+			"unable to establish queue[%d] handler\n",
+			wmq->wmq_id);
+			pci_intr_disestablish(sc->sc_pc,
+			sc->sc_ihs[wmq->wmq_intr_idx]);
+			sc->sc_ihs[wmq->wmq_intr_idx] = NULL;
+			goto fail;
+		}
 
 		txrx_established++;
 		intr_idx++;
@@ -7085,11 +7092,11 @@ wm_nq_transmit(struct ifnet *ifp, struct
 	 * The situations which this mutex_tryenter() fails at running time
 	 * are below two patterns.
 	 * (1) contention with interrupt handler(wm_txrxintr_msix())
-	 * (2) contention with deferred if_start softint(wm_deferred_start())
+	 * (2) contention with deferred if_start softint(wm_handle_queue())
 	 * In the case of (1), the last packet enqueued to txq->txq_interq is
-	 * dequeued by wm_deferred_start(). So, it does not get stuck.
+	 * dequeued by wm_deferred_start_locked(). So, it does not get stuck.
 	 * In the case of (2), the last packet enqueued to txq->txq_interq is also
-	 * dequeued by wm_deferred_start(). So, it does not get stuck, either.
+	 * dequeued by wm_deferred_start_locked(). So, it does not get stuck, either.
 	 */
 	if (mutex_tryenter(txq->txq_lock)) {
 		if (!txq->txq_stopping)
@@ -7395,34 +7402,6 @@ wm_nq_send_common_locked(struct ifnet *i
 }
 
 static void
-wm_deferred_start(struct ifnet *ifp)
-{
-	struct wm_softc *sc = ifp->if_softc;
-	int qid = 0;
-
-	/*
-	 * Try to transmit on all Tx queues. Passing a txq somehow and
-	 * transmitting only on the txq may be better.
-	 */
-	for (; qid < sc->sc_nqueues; qid++) {
-		struct wm_txqueue *txq = &sc->sc_queue[qid].wmq_txq;
-
-		/

CVS commit: src/sys/arch

2017-02-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 17 12:10:40 UTC 2017

Modified Files:
src/sys/arch/i386/conf: GENERIC files.i386
src/sys/arch/i386/i386: machdep.c pmc.c
src/sys/arch/i386/include: pmc.h
src/sys/arch/x86/x86: sys_machdep.c

Log Message:
Support PMCs on multi-processor systems. Still several things to fix, but
at least it works a little. Will be improved and moved into x86/ soon.


To generate a diff of this commit:
cvs rdiff -u -r1.1146 -r1.1147 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.376 -r1.377 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.778 -r1.779 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/i386/pmc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/include/pmc.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/x86/sys_machdep.c

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

Modified files:

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1146 src/sys/arch/i386/conf/GENERIC:1.1147
--- src/sys/arch/i386/conf/GENERIC:1.1146	Thu Jan 12 05:24:36 2017
+++ src/sys/arch/i386/conf/GENERIC	Fri Feb 17 12:10:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1146 2017/01/12 05:24:36 ryo Exp $
+# $NetBSD: GENERIC,v 1.1147 2017/02/17 12:10:40 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.1146 $"
+#ident		"GENERIC-$Revision: 1.1147 $"
 
 maxusers	64		# estimated number of users
 
@@ -42,7 +42,6 @@ viac7temp*	at cpu?		# VIA C7 temperature
 vmt0		at cpu0		# VMware Tools
 
 options 	MTRR		# memory-type range register syscall support
-# doesn't work with MP just yet..
 #options 	PERFCTRS	# performance-monitoring counters support
 
 options 	MULTIBOOT	# Multiboot support (see multiboot(8))

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.376 src/sys/arch/i386/conf/files.i386:1.377
--- src/sys/arch/i386/conf/files.i386:1.376	Thu Dec 15 12:04:18 2016
+++ src/sys/arch/i386/conf/files.i386	Fri Feb 17 12:10:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.376 2016/12/15 12:04:18 kamil Exp $
+#	$NetBSD: files.i386,v 1.377 2017/02/17 12:10:40 maxv Exp $
 #
 # new style config file for i386 architecture
 #
@@ -74,6 +74,7 @@ file	arch/i386/i386/kobj_machdep.c	modul
 file	arch/i386/i386/machdep.c
 file 	arch/i386/i386/longrun.c
 file	arch/i386/i386/mtrr_k6.c	mtrr
+file	arch/i386/i386/pmc.c
 file	arch/i386/i386/process_machdep.c
 file	arch/x86/x86/convert_xmm_s87.c
 file	arch/i386/i386/trap.c
@@ -83,8 +84,6 @@ file	arch/x86/x86/dbregs.c
 
 file	arch/i386/i386/mptramp.S	multiprocessor
 
-file	arch/i386/i386/pmc.c		perfctrs
-
 file	crypto/des/arch/i386/des_enc.S		des
 file	crypto/des/arch/i386/des_cbc.S		des
 

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.778 src/sys/arch/i386/i386/machdep.c:1.779
--- src/sys/arch/i386/i386/machdep.c:1.778	Sun Feb  5 10:42:21 2017
+++ src/sys/arch/i386/i386/machdep.c	Fri Feb 17 12:10:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.778 2017/02/05 10:42:21 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.779 2017/02/17 12:10:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.778 2017/02/05 10:42:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.779 2017/02/17 12:10:40 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -135,6 +135,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1402,6 +1403,8 @@ init386(paddr_t first_avail)
 	}
 
 	rw_init(&svr4_fasttrap_lock);
+
+	pmc_init();
 }
 
 #include 		/* for NVRAM POST */

Index: src/sys/arch/i386/i386/pmc.c
diff -u src/sys/arch/i386/i386/pmc.c:1.21 src/sys/arch/i386/i386/pmc.c:1.22
--- src/sys/arch/i386/i386/pmc.c:1.21	Thu Nov 21 22:04:40 2013
+++ src/sys/arch/i386/i386/pmc.c	Fri Feb 17 12:10:40 2017
@@ -1,6 +1,35 @@
-/*	$NetBSD: pmc.c,v 1.21 2013/11/21 22:04:40 riz Exp $	*/
+/*	$NetBSD: pmc.c,v 1.22 2017/02/17 12:10:40 maxv Exp $	*/
 
-/*-
+/*
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Maxime Villard.
+ *
+ * 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 

CVS commit: src/sys/dev/pci

2017-02-17 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 17 11:57:26 UTC 2017

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

Log Message:
rxq_ptr must be updated holding rxq_lock consistent with the Rx processing.

In previous implementation, wm_rxeof() temporarily unlock rxq->rxq_lock to
call if_percpuq_enqueue(), and then re-lock rxq->rxq_lock to update
rxq->rxq_ptr. So, if multiple CPUs share the same rxq, there is race e.g.
- CPU A: lock rxq->rxq_lock
- CPU A: Rx processing include increment local variable "i"
- CPU A: unlock rxq->rxq_lock
- CPU A: call if_percpuq_enqueue()
- CPU B: lock rxq->rxq_lock
- CPU B: Rx processing include increment local variable "i"
- CPU B: unlock rxq->rxq_lock
- CPU B: call if_percpuq_enqueue()
- CPU B: lock rxq->rxq_lock
- CPU B: update rxq->rxq_ptr, that is, set CPU B's local "i" to rxq->rxq_ptr
- CPU B: unlock rxq->rxq_lock
- CPU A: lock rxq->rxq_lock
- CPU A: update rxq->rxq_ptr, that is, set CPU A's local "i" to rxq->rxq_ptr
- CPU A: unlock rxq->rxq_lock


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.482 src/sys/dev/pci/if_wm.c:1.483
--- src/sys/dev/pci/if_wm.c:1.482	Fri Feb 17 07:21:28 2017
+++ src/sys/dev/pci/if_wm.c	Fri Feb 17 11:57:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.482 2017/02/17 07:21:28 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.483 2017/02/17 11:57:26 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.482 2017/02/17 07:21:28 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.483 2017/02/17 11:57:26 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -7799,8 +7799,14 @@ wm_rxeof(struct wm_rxqueue *rxq)
 		uint8_t rsstype = wm_rxdesc_get_rsstype(rxq, i);
 #endif
 
-		if (!wm_rxdesc_dd(rxq, i, status))
+		if (!wm_rxdesc_dd(rxq, i, status)) {
+			/*
+			 * Update the receive pointer holding rxq_lock
+			 * consistent with increment counter.
+			 */
+			rxq->rxq_ptr = i;
 			break;
+		}
 
 		count++;
 		if (__predict_false(rxq->rxq_discard)) {
@@ -7924,7 +7930,11 @@ wm_rxeof(struct wm_rxqueue *rxq)
 
 		/* Set up checksum info for this packet. */
 		wm_rxdesc_ensure_checksum(rxq, status, errors, m);
-
+		/*
+		 * Update the receive pointer holding rxq_lock consistent with
+		 * increment counter.
+		 */
+		rxq->rxq_ptr = i;
 		mutex_exit(rxq->rxq_lock);
 
 		/* Pass it on. */
@@ -7936,8 +7946,6 @@ wm_rxeof(struct wm_rxqueue *rxq)
 			break;
 	}
 
-	/* Update the receive pointer. */
-	rxq->rxq_ptr = i;
 	if (count != 0)
 		rnd_add_uint32(&sc->rnd_source, count);
 



CVS commit: src/lib/libcurses

2017-02-17 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Feb 17 11:23:21 UTC 2017

Modified Files:
src/lib/libcurses: curses_tty.3

Log Message:
Note that typeahead(3) is no longer set to infd by default.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libcurses/curses_tty.3

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

Modified files:

Index: src/lib/libcurses/curses_tty.3
diff -u src/lib/libcurses/curses_tty.3:1.11 src/lib/libcurses/curses_tty.3:1.12
--- src/lib/libcurses/curses_tty.3:1.11	Wed Jan 25 12:42:05 2017
+++ src/lib/libcurses/curses_tty.3	Fri Feb 17 11:23:21 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses_tty.3,v 1.11 2017/01/25 12:42:05 roy Exp $
+.\"	$NetBSD: curses_tty.3,v 1.12 2017/02/17 11:23:21 roy Exp $
 .\"
 .\" Copyright (c) 2002
 .\"	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd January 25, 2017
+.Dd February 17, 2017
 .Dt CURSES_TTY 3
 .Os
 .Sh NAME
@@ -342,11 +342,6 @@ is a valid file descriptor, typeahead is
 Curses periodically checks
 .Ar filedes
 for input and aborts the refresh if any character is available.
-(This is the initial setting and the typeahead file descriptor corresponds
-to the input file associated with the screen created by
-.Fn initscr
-or
-.Fn newterm .
 The value of
 .Ar filedes
 need not be the file descriptor on which the refresh is occurring.



CVS commit: src/lib/libcurses

2017-02-17 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Feb 17 11:18:38 UTC 2017

Modified Files:
src/lib/libcurses: screen.c

Log Message:
Disable typeahead being set to infd by default as this seems to cause
refresh issues in nvi.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libcurses/screen.c

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

Modified files:

Index: src/lib/libcurses/screen.c
diff -u src/lib/libcurses/screen.c:1.31 src/lib/libcurses/screen.c:1.32
--- src/lib/libcurses/screen.c:1.31	Tue Jan 31 09:17:53 2017
+++ src/lib/libcurses/screen.c	Fri Feb 17 11:18:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: screen.c,v 1.31 2017/01/31 09:17:53 roy Exp $	*/
+/*	$NetBSD: screen.c,v 1.32 2017/02/17 11:18:38 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)screen.c	8.2 (blymn) 11/27/2001";
 #else
-__RCSID("$NetBSD: screen.c,v 1.31 2017/01/31 09:17:53 roy Exp $");
+__RCSID("$NetBSD: screen.c,v 1.32 2017/02/17 11:18:38 roy Exp $");
 #endif
 #endif	/* not lint */
 
@@ -135,7 +135,15 @@ newterm(char *type, FILE *outfd, FILE *i
 #endif
 
 	new_screen->infd = infd;
-	new_screen->checkfd = fileno(infd);
+	/*
+	 * POSIX standard says this should be set to infd by default,
+	 * but this seems to break nvi by leaving an unrefreshed screen.
+	 * Also, the line breakout optimisation advertised in ncurses
+	 * doesn't actually do anything, so explicitly disabling it here makes
+	 * sense for the time being.
+	 * A caller can always enable it by calling typeahead(3) anyway.
+	 */
+	new_screen->checkfd = -1; // fileno(infd);
 	new_screen->outfd = outfd;
 	new_screen->echoit = new_screen->nl = 1;
 	new_screen->pfast = new_screen->rawmode = new_screen->noqch = 0;



CVS commit: src/sys/dev

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:51:48 UTC 2017

Modified Files:
src/sys/dev/acpi: sdhc_acpi.c
src/sys/dev/pci: sdhc_pci.c
src/sys/dev/sdmmc: sdhc.c sdhcvar.h sdmmc.c sdmmc_mem.c sdmmcchip.h
sdmmcreg.h sdmmcvar.h

Log Message:
sdhc(4): hardware reset support for Intel eMMC controller


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/sdhc_acpi.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/sdhc_pci.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sdmmc/sdhcvar.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sdmmc/sdmmc.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/sdmmc/sdmmc_mem.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/sdmmc/sdmmcchip.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sdmmc/sdmmcreg.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sdmmc/sdmmcvar.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/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.3 src/sys/dev/acpi/sdhc_acpi.c:1.4
--- src/sys/dev/acpi/sdhc_acpi.c:1.3	Thu Aug 11 01:54:30 2016
+++ src/sys/dev/acpi/sdhc_acpi.c	Fri Feb 17 10:51:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.3 2016/08/11 01:54:30 nonaka Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.4 2017/02/17 10:51:48 nonaka Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.3 2016/08/11 01:54:30 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.4 2017/02/17 10:51:48 nonaka Exp $");
 
 #include 
 #include 
@@ -50,6 +50,9 @@ static bool	sdhc_acpi_resume(device_t, c
 
 struct sdhc_acpi_softc {
 	struct sdhc_softc sc;
+	bus_space_tag_t sc_memt;
+	bus_space_handle_t sc_memh;
+	bus_size_t sc_memsize;
 	int sc_irq;
 
 	ACPI_HANDLE sc_crs, sc_srs;
@@ -59,14 +62,58 @@ struct sdhc_acpi_softc {
 CFATTACH_DECL_NEW(sdhc_acpi, sizeof(struct sdhc_acpi_softc),
 sdhc_acpi_match, sdhc_acpi_attach, sdhc_acpi_detach, NULL);
 
-static uint32_t sdhc_acpi_intr(void *);
-
-static const char * const sdhc_acpi_ids[] = {
-	"80860F14",
-	"80860F16",
-	NULL
+static uint32_t	sdhc_acpi_intr(void *);
+static void	sdhc_acpi_intel_emmc_hw_reset(struct sdhc_softc *,
+		struct sdhc_host *);
+
+static const struct sdhc_acpi_slot {
+	const char *hid;
+	const char *uid;
+	int type;
+#define	SLOT_TYPE_SD	0	/* SD or SDIO */
+#define	SLOT_TYPE_EMMC	1	/* eMMC */
+} sdhc_acpi_slot_map[] = {
+	{ "80865ACA",	NULL,	SLOT_TYPE_SD },
+	{ "80865ACC",	NULL,	SLOT_TYPE_EMMC },
+	{ "80865AD0",	NULL,	SLOT_TYPE_SD },
+	{ "80860F14",   "1",	SLOT_TYPE_EMMC },
+	{ "80860F14",   "3",	SLOT_TYPE_SD },
+	{ "80860F16",   NULL,	SLOT_TYPE_SD },
+	{ "INT33BB",	"2",	SLOT_TYPE_SD },
+	{ "INT33BB",	"3",	SLOT_TYPE_SD },
+	{ "INT33C6",	NULL,	SLOT_TYPE_SD },
+	{ "INT3436",	NULL,	SLOT_TYPE_SD },
+	{ "INT344D",	NULL,	SLOT_TYPE_SD },
+	{ "PNP0D40",	NULL,	SLOT_TYPE_SD },
+	{ "PNP0FFF",	"3",	SLOT_TYPE_SD },
 };
 
+static const struct sdhc_acpi_slot *
+sdhc_acpi_find_slot(ACPI_DEVICE_INFO *ad)
+{
+	const struct sdhc_acpi_slot *slot;
+	const char *hid, *uid;
+	size_t i;
+
+	hid = ad->HardwareId.String;
+	uid = ad->UniqueId.String;
+
+	if (!(ad->Valid & ACPI_VALID_HID) || hid == NULL)
+		return NULL;
+
+	for (i = 0; i < __arraycount(sdhc_acpi_slot_map); i++) {
+		slot = &sdhc_acpi_slot_map[i];
+		if (strcmp(hid, slot->hid) == 0) {
+			if (slot->uid == NULL ||
+			((ad->Valid & ACPI_VALID_UID) != 0 &&
+			 uid != NULL &&
+			 strcmp(uid, slot->uid) == 0))
+return slot;
+		}
+	}
+	return NULL;
+}
+
 static int
 sdhc_acpi_match(device_t parent, cfdata_t match, void *opaque)
 {
@@ -75,7 +122,7 @@ sdhc_acpi_match(device_t parent, cfdata_
 	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
 		return 0;
 
-	return acpi_match_hid(aa->aa_node->ad_devinfo, sdhc_acpi_ids);
+	return sdhc_acpi_find_slot(aa->aa_node->ad_devinfo) != NULL;
 }
 
 static void
@@ -83,17 +130,22 @@ sdhc_acpi_attach(device_t parent, device
 {
 	struct sdhc_acpi_softc *sc = device_private(self);
 	struct acpi_attach_args *aa = opaque;
+	const struct sdhc_acpi_slot *slot;
 	struct acpi_resources res;
 	struct acpi_mem *mem;
 	struct acpi_irq *irq;
-	bus_space_handle_t memh;
 	ACPI_STATUS rv;
 
 	sc->sc.sc_dev = self;
 	sc->sc.sc_dmat = aa->aa_dmat;
 	sc->sc.sc_host = NULL;
+	sc->sc_memt = aa->aa_memt;
 	sc->sc_irq = -1;
 
+	slot = sdhc_acpi_find_slot(aa->aa_node->ad_devinfo);
+	if (slot->type == SLOT_TYPE_EMMC)
+		sc->sc.sc_vendor_hw_reset = sdhc_acpi_intel_emmc_hw_reset;
+
 	rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
 	&res, &acpi_resource_parse_ops_default);
 	if (ACPI_FAILURE(rv))
@@ -116,9 +168,10 @@ sdhc_acpi_attach(device_t parent, device
 		aprint_error_dev(self, "incomplete resources\n");
 		goto cleanup;
 	}
+	sc->sc_memsize = mem->ar_length;
 
-	if (bus_space_map(aa->aa_memt, mem->ar_base, mem->ar_length, 0,
-	&memh)) {
+	if (bus_

CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:50:43 UTC 2017

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

Log Message:
sdhc(4), sdmmc(4): Added MMC HS DDR52 support.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sdmmc/sdmmc_mem.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/sdmmc/sdmmcchip.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.97 src/sys/dev/sdmmc/sdhc.c:1.98
--- src/sys/dev/sdmmc/sdhc.c:1.97	Sat Jan  7 15:05:08 2017
+++ src/sys/dev/sdmmc/sdhc.c	Fri Feb 17 10:50:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.97 2017/01/07 15:05:08 kiyohara Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.98 2017/02/17 10:50:43 nonaka Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.97 2017/01/07 15:05:08 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.98 2017/02/17 10:50:43 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1107,7 +1107,13 @@ sdhc_bus_clock_ddr(sdmmc_chipset_handle_
 		if (freq > 10) {
 			HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR104);
 		} else if (freq > 5) {
-			HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR50);
+			if (ddr) {
+HSET2(hp, SDHC_HOST_CTL2,
+SDHC_UHS_MODE_SELECT_DDR50);
+			} else {
+HSET2(hp, SDHC_HOST_CTL2,
+SDHC_UHS_MODE_SELECT_SDR50);
+			}
 		} else if (freq > 25000) {
 			if (ddr) {
 HSET2(hp, SDHC_HOST_CTL2,
@@ -1335,6 +1341,9 @@ sdhc_signal_voltage(sdmmc_chipset_handle
 {
 	struct sdhc_host *hp = (struct sdhc_host *)sch;
 
+	if (hp->specver < SDHC_SPEC_VERS_300)
+		return EINVAL;
+
 	mutex_enter(&hp->intr_lock);
 	switch (signal_voltage) {
 	case SDMMC_SIGNAL_VOLTAGE_180:

Index: src/sys/dev/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.53 src/sys/dev/sdmmc/sdmmc_mem.c:1.54
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.53	Fri Feb 17 10:48:19 2017
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Fri Feb 17 10:50:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.53 2017/02/17 10:48:19 nonaka Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.54 2017/02/17 10:50:43 nonaka Exp $	*/
 /*	$OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.53 2017/02/17 10:48:19 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.54 2017/02/17 10:50:43 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -907,6 +907,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 	int width, value, hs_timing, bus_clock, error;
 	uint8_t ext_csd[512];
 	uint32_t sectors = 0;
+	bool ddr = false;
 
 	sc->sc_transfer_mode = NULL;
 
@@ -934,11 +935,15 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			return ENOTSUP;
 		}
 
-		sc->sc_transfer_mode = NULL;
 		if (ISSET(sc->sc_caps, SMC_CAPS_MMC_HS200) &&
 		ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_HS200_1_8V) {
 			sf->csd.tran_speed = 20;	/* 200MHz SDR */
 			hs_timing = EXT_CSD_HS_TIMING_HS200;
+		} else if (ISSET(sc->sc_caps, SMC_CAPS_MMC_DDR52) &&
+		ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_DDR52_1_8V) {
+			sf->csd.tran_speed = 52000;	/* 52MHz */
+			hs_timing = EXT_CSD_HS_TIMING_HIGHSPEED;
+			ddr = true;
 		} else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_52M) {
 			sf->csd.tran_speed = 52000;	/* 52MHz */
 			hs_timing = EXT_CSD_HS_TIMING_HIGHSPEED;
@@ -1022,6 +1027,47 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			}
 		}
 
+		/*
+		 * HS_TIMING must be set to “0x1” before setting BUS_WIDTH
+		 * for dual data rate operation
+		 */
+		if (ddr &&
+		hs_timing == EXT_CSD_HS_TIMING_HIGHSPEED &&
+		width > 1) {
+			error = sdmmc_mem_mmc_switch(sf,
+			EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,
+			(width == 8) ? EXT_CSD_BUS_WIDTH_8_DDR :
+			  EXT_CSD_BUS_WIDTH_4_DDR);
+			if (error) {
+DPRINTF(("%s: can't switch to DDR"
+" (%d bit)\n", SDMMCDEVNAME(sc), width));
+return error;
+			}
+
+			delay(1);
+
+			error = sdmmc_mem_signal_voltage(sc,
+			SDMMC_SIGNAL_VOLTAGE_180);
+			if (error) {
+aprint_error_dev(sc->sc_dev,
+"can't switch signaling voltage\n");
+return error;
+			}
+
+			error = sdmmc_chip_bus_clock(sc->sc_sct, sc->sc_sch,
+			sc->sc_busclk, ddr);
+			if (error) {
+aprint_error_dev(sc->sc_dev,
+"can't change bus clock\n");
+return error;
+			}
+
+			delay(1);
+
+			sc->sc_transfer_mode = "DDR52";
+			sc->sc_busddr = ddr;
+		}
+
 		sectors = ext_csd[EXT_CSD_SEC_COUNT + 0] << 0 |
 		ext_csd[EXT_CSD_SEC_COUNT + 1] << 8  |
 		ext_csd[EXT_CSD_SEC_COUNT + 2] << 16 |
@@ -1041,8 +1087,6 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 "can't execute MMC tuning\n");

CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:49:47 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcvar.h

Log Message:
sdmmc(4): Add MMC HS DDR52 timing support bit and use __BIT() macro.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sdmmc/sdmmcvar.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcvar.h
diff -u src/sys/dev/sdmmc/sdmmcvar.h:1.21 src/sys/dev/sdmmc/sdmmcvar.h:1.22
--- src/sys/dev/sdmmc/sdmmcvar.h:1.21	Sun Nov 29 23:38:47 2015
+++ src/sys/dev/sdmmc/sdmmcvar.h	Fri Feb 17 10:49:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcvar.h,v 1.21 2015/11/29 23:38:47 jmcneill Exp $	*/
+/*	$NetBSD: sdmmcvar.h,v 1.22 2017/02/17 10:49:47 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcvar.h,v 1.13 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -222,21 +222,25 @@ struct sdmmc_softc {
 #define SMF_UHS_MODE		0x1	/* host in UHS mode */
 
 	uint32_t sc_caps;		/* host capability */
-#define SMC_CAPS_AUTO_STOP	0x0001	/* send CMD12 automagically by host */
-#define SMC_CAPS_4BIT_MODE	0x0002	/* 4-bits data bus width */
-#define SMC_CAPS_DMA		0x0004	/* DMA transfer */
-#define SMC_CAPS_SPI_MODE	0x0008	/* SPI mode */
-#define SMC_CAPS_POLL_CARD_DET	0x0010	/* Polling card detect */
-#define SMC_CAPS_SINGLE_ONLY	0x0020	/* only single read/write */
-#define SMC_CAPS_8BIT_MODE	0x0040	/* 8-bits data bus width */
-#define SMC_CAPS_MULTI_SEG_DMA	0x0080	/* multiple segment DMA transfer */
-#define SMC_CAPS_SD_HIGHSPEED	0x0100	/* SD high-speed timing */
-#define SMC_CAPS_MMC_HIGHSPEED	0x0200	/* MMC high-speed timing */
-#define SMC_CAPS_UHS_SDR50	0x1000	/* UHS SDR50 timing */
-#define SMC_CAPS_UHS_SDR104	0x2000	/* UHS SDR104 timing */
-#define SMC_CAPS_UHS_DDR50	0x4000	/* UHS DDR50 timing */
-#define SMC_CAPS_UHS_MASK	0x7000
-#define SMC_CAPS_MMC_HS200	0x8000	/* eMMC HS200 timing */
+#define SMC_CAPS_AUTO_STOP	__BIT(0)	/* send CMD12 automagically by host */
+#define SMC_CAPS_4BIT_MODE	__BIT(1)	/* 4-bits data bus width */
+#define SMC_CAPS_DMA		__BIT(2)	/* DMA transfer */
+#define SMC_CAPS_SPI_MODE	__BIT(3)	/* SPI mode */
+#define SMC_CAPS_POLL_CARD_DET	__BIT(4)	/* Polling card detect */
+#define SMC_CAPS_SINGLE_ONLY	__BIT(5)	/* only single read/write */
+#define SMC_CAPS_8BIT_MODE	__BIT(6)	/* 8-bits data bus width */
+#define SMC_CAPS_MULTI_SEG_DMA	__BIT(7)	/* multiple segment DMA transfer */
+#define SMC_CAPS_SD_HIGHSPEED	__BIT(8)	/* SD high-speed timing */
+#define SMC_CAPS_MMC_HIGHSPEED	__BIT(9)	/* MMC high-speed timing */
+#define SMC_CAPS_MMC_DDR52	__BIT(10)	/* MMC HS DDR52 timing */
+/*__BIT(11)	*/
+#define SMC_CAPS_UHS_SDR50	__BIT(12)	/* UHS SDR50 timing */
+#define SMC_CAPS_UHS_SDR104	__BIT(13)	/* UHS SDR104 timing */
+#define SMC_CAPS_UHS_DDR50	__BIT(14)	/* UHS DDR50 timing */
+#define SMC_CAPS_UHS_MASK	(SMC_CAPS_UHS_SDR50 \
+| SMC_CAPS_UHS_SDR104 \
+| SMC_CAPS_UHS_DDR50)
+#define SMC_CAPS_MMC_HS200	__BIT(15)	/* eMMC HS200 timing */
 
 	/* function */
 	int sc_function_count;		/* number of I/O functions (SDIO) */



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:48:19 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmc_mem.c

Log Message:
sdmmc(4): Use EXT_CSD[HS_TIMING] definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sdmmc/sdmmc_mem.c

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.52 src/sys/dev/sdmmc/sdmmc_mem.c:1.53
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.52	Thu Aug 11 01:33:25 2016
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Fri Feb 17 10:48:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.52 2016/08/11 01:33:25 nonaka Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.53 2017/02/17 10:48:19 nonaka Exp $	*/
 /*	$OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.52 2016/08/11 01:33:25 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.53 2017/02/17 10:48:19 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -938,13 +938,13 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 		if (ISSET(sc->sc_caps, SMC_CAPS_MMC_HS200) &&
 		ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_HS200_1_8V) {
 			sf->csd.tran_speed = 20;	/* 200MHz SDR */
-			hs_timing = 2;
+			hs_timing = EXT_CSD_HS_TIMING_HS200;
 		} else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_52M) {
 			sf->csd.tran_speed = 52000;	/* 52MHz */
-			hs_timing = 1;
+			hs_timing = EXT_CSD_HS_TIMING_HIGHSPEED;
 		} else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_26M) {
 			sf->csd.tran_speed = 26000;	/* 26MHz */
-			hs_timing = 0;
+			hs_timing = EXT_CSD_HS_TIMING_LEGACY;
 		} else {
 			aprint_error_dev(sc->sc_dev,
 			"unknown CARD_TYPE: 0x%x\n",
@@ -980,11 +980,11 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 		}
 		sf->width = width;
 
-		if (hs_timing == 1 &&
+		if (hs_timing == EXT_CSD_HS_TIMING_HIGHSPEED &&
 		!ISSET(sc->sc_caps, SMC_CAPS_MMC_HIGHSPEED)) {
-			hs_timing = 0;
+			hs_timing = EXT_CSD_HS_TIMING_LEGACY;
 		}
-		if (hs_timing) {
+		if (hs_timing != EXT_CSD_HS_TIMING_LEGACY) {
 			error = sdmmc_mem_mmc_switch(sf, EXT_CSD_CMD_SET_NORMAL,
 			EXT_CSD_HS_TIMING, hs_timing);
 			if (error) {
@@ -1007,7 +1007,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			}
 		}
 
-		if (hs_timing) {
+		if (hs_timing != EXT_CSD_HS_TIMING_LEGACY) {
 			error = sdmmc_mem_send_cxd_data(sc,
 			MMC_SEND_EXT_CSD, ext_csd, sizeof(ext_csd));
 			if (error) {
@@ -1031,7 +1031,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			sf->csd.capacity = sectors;
 		}
 
-		if (hs_timing == 2) {
+		if (hs_timing == EXT_CSD_HS_TIMING_HS200) {
 			sc->sc_transfer_mode = "HS200";
 
 			/* execute tuning (HS200) */



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:47:09 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcreg.h

Log Message:
sdmmc(4): Added EXT_CSD[HS_TIMING] definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sdmmc/sdmmcreg.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.27 src/sys/dev/sdmmc/sdmmcreg.h:1.28
--- src/sys/dev/sdmmc/sdmmcreg.h:1.27	Fri Feb 17 10:46:20 2017
+++ src/sys/dev/sdmmc/sdmmcreg.h	Fri Feb 17 10:47:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.27 2017/02/17 10:46:20 nonaka Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.28 2017/02/17 10:47:09 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -134,6 +134,12 @@
 #define EXT_CSD_BUS_WIDTH_4_DDR		5	/* 4 bit mode (DDR) */
 #define EXT_CSD_BUS_WIDTH_8_DDR		6	/* 8 bit mode (DDR) */
 
+/* EXT_CSD_HS_TIMING */
+#define EXT_CSD_HS_TIMING_LEGACY	0
+#define EXT_CSD_HS_TIMING_HIGHSPEED	1
+#define EXT_CSD_HS_TIMING_HS200		2
+#define EXT_CSD_HS_TIMING_HS400		3
+
 /* EXT_CSD_STRUCTURE */
 #define EXT_CSD_STRUCTURE_VER_1_0	0	/* CSD Version No.1.0 */
 #define EXT_CSD_STRUCTURE_VER_1_1	1	/* CSD Version No.1.1 */



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:46:21 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcreg.h

Log Message:
sdmmc(4): Change EXT_CSD[CARD_TYPE] HS DDR 52 MHz definition.

Because it has been difficult to understand from the definition is DDR.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sdmmc/sdmmcreg.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.26 src/sys/dev/sdmmc/sdmmcreg.h:1.27
--- src/sys/dev/sdmmc/sdmmcreg.h:1.26	Fri Feb 17 10:45:23 2017
+++ src/sys/dev/sdmmc/sdmmcreg.h	Fri Feb 17 10:46:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.26 2017/02/17 10:45:23 nonaka Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.27 2017/02/17 10:46:20 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -142,8 +142,8 @@
 /* EXT_CSD_CARD_TYPE */
 #define EXT_CSD_CARD_TYPE_F_26M		(1 << 0) /* HS 26 MHz */
 #define EXT_CSD_CARD_TYPE_F_52M		(1 << 1) /* HS 52 MHz */
-#define EXT_CSD_CARD_TYPE_F_52M_1_8V	(1 << 2) /* HS DDR 52 MHz 1.8V or 3V */
-#define EXT_CSD_CARD_TYPE_F_52M_1_2V	(1 << 3) /* HS DDR 52 MHz 1.2V */
+#define EXT_CSD_CARD_TYPE_F_DDR52_1_8V	(1 << 2) /* HS DDR 52 MHz 1.8V or 3V */
+#define EXT_CSD_CARD_TYPE_F_DDR52_1_2V	(1 << 3) /* HS DDR 52 MHz 1.2V */
 #define EXT_CSD_CARD_TYPE_F_HS200_1_8V	(1 << 4) /* HS200 SDR 200 MHz 1.8V */
 #define EXT_CSD_CARD_TYPE_F_HS200_1_2V	(1 << 5) /* HS200 SDR 200 MHz 1.2V */
 #define EXT_CSD_CARD_TYPE_F_HS400_1_8V	(1 << 6) /* HS400 DDR 200 MHz 1.8V */



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:45:23 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcreg.h

Log Message:
sdmmc(4): Remove unused EXT_CSD[CARD_TYPE] definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sdmmc/sdmmcreg.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.25 src/sys/dev/sdmmc/sdmmcreg.h:1.26
--- src/sys/dev/sdmmc/sdmmcreg.h:1.25	Fri Feb 17 10:44:31 2017
+++ src/sys/dev/sdmmc/sdmmcreg.h	Fri Feb 17 10:45:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.25 2017/02/17 10:44:31 nonaka Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.26 2017/02/17 10:45:23 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -148,11 +148,6 @@
 #define EXT_CSD_CARD_TYPE_F_HS200_1_2V	(1 << 5) /* HS200 SDR 200 MHz 1.2V */
 #define EXT_CSD_CARD_TYPE_F_HS400_1_8V	(1 << 6) /* HS400 DDR 200 MHz 1.8V */
 #define EXT_CSD_CARD_TYPE_F_HS400_1_2V	(1 << 7) /* HS400 DDR 200 MHz 1.2V */
-#define EXT_CSD_CARD_TYPE_26M		0x01
-#define EXT_CSD_CARD_TYPE_52M		0x03
-#define EXT_CSD_CARD_TYPE_52M_V18	0x07
-#define EXT_CSD_CARD_TYPE_52M_V12	0x0b
-#define EXT_CSD_CARD_TYPE_52M_V12_18	0x0f
 
 /* MMC_SWITCH access mode */
 #define MMC_SWITCH_MODE_CMD_SET		0x00	/* Change the command set */



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:44:31 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcreg.h

Log Message:
sdmmc(4): Added comments at EXT_CSD[CARD_TYPE] definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/sdmmc/sdmmcreg.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.24 src/sys/dev/sdmmc/sdmmcreg.h:1.25
--- src/sys/dev/sdmmc/sdmmcreg.h:1.24	Fri Feb 17 10:43:47 2017
+++ src/sys/dev/sdmmc/sdmmcreg.h	Fri Feb 17 10:44:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.24 2017/02/17 10:43:47 nonaka Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.25 2017/02/17 10:44:31 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -140,14 +140,14 @@
 #define EXT_CSD_STRUCTURE_VER_1_2	2	/* Version 4.1-4.2-4.3 */
 
 /* EXT_CSD_CARD_TYPE */
-#define EXT_CSD_CARD_TYPE_F_26M		(1 << 0)
-#define EXT_CSD_CARD_TYPE_F_52M		(1 << 1)
-#define EXT_CSD_CARD_TYPE_F_52M_1_8V	(1 << 2)
-#define EXT_CSD_CARD_TYPE_F_52M_1_2V	(1 << 3)
-#define EXT_CSD_CARD_TYPE_F_HS200_1_8V	(1 << 4)
-#define EXT_CSD_CARD_TYPE_F_HS200_1_2V	(1 << 5)
-#define EXT_CSD_CARD_TYPE_F_HS400_1_8V	(1 << 6)
-#define EXT_CSD_CARD_TYPE_F_HS400_1_2V	(1 << 7)
+#define EXT_CSD_CARD_TYPE_F_26M		(1 << 0) /* HS 26 MHz */
+#define EXT_CSD_CARD_TYPE_F_52M		(1 << 1) /* HS 52 MHz */
+#define EXT_CSD_CARD_TYPE_F_52M_1_8V	(1 << 2) /* HS DDR 52 MHz 1.8V or 3V */
+#define EXT_CSD_CARD_TYPE_F_52M_1_2V	(1 << 3) /* HS DDR 52 MHz 1.2V */
+#define EXT_CSD_CARD_TYPE_F_HS200_1_8V	(1 << 4) /* HS200 SDR 200 MHz 1.8V */
+#define EXT_CSD_CARD_TYPE_F_HS200_1_2V	(1 << 5) /* HS200 SDR 200 MHz 1.2V */
+#define EXT_CSD_CARD_TYPE_F_HS400_1_8V	(1 << 6) /* HS400 DDR 200 MHz 1.8V */
+#define EXT_CSD_CARD_TYPE_F_HS400_1_2V	(1 << 7) /* HS400 DDR 200 MHz 1.2V */
 #define EXT_CSD_CARD_TYPE_26M		0x01
 #define EXT_CSD_CARD_TYPE_52M		0x03
 #define EXT_CSD_CARD_TYPE_52M_V18	0x07



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:43:47 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcreg.h

Log Message:
sdmmc(4): Added 4 and 8 bit mode DDR definitions at EXT_CSD[BUS_WIDTH].


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sdmmc/sdmmcreg.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.23 src/sys/dev/sdmmc/sdmmcreg.h:1.24
--- src/sys/dev/sdmmc/sdmmcreg.h:1.23	Fri Feb 17 10:43:03 2017
+++ src/sys/dev/sdmmc/sdmmcreg.h	Fri Feb 17 10:43:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.23 2017/02/17 10:43:03 nonaka Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.24 2017/02/17 10:43:47 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -131,6 +131,8 @@
 #define EXT_CSD_BUS_WIDTH_1		0	/* 1 bit mode */
 #define EXT_CSD_BUS_WIDTH_4		1	/* 4 bit mode */
 #define EXT_CSD_BUS_WIDTH_8		2	/* 8 bit mode */
+#define EXT_CSD_BUS_WIDTH_4_DDR		5	/* 4 bit mode (DDR) */
+#define EXT_CSD_BUS_WIDTH_8_DDR		6	/* 8 bit mode (DDR) */
 
 /* EXT_CSD_STRUCTURE */
 #define EXT_CSD_STRUCTURE_VER_1_0	0	/* CSD Version No.1.0 */



CVS commit: src/sys/dev/sdmmc

2017-02-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Feb 17 10:43:03 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmcreg.h

Log Message:
sdmmc(4): Fix cell type in comments.

>From JEDEC Standard No.84-B51, 7.4. Extended CSD register.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sdmmc/sdmmcreg.h

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

Modified files:

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.22 src/sys/dev/sdmmc/sdmmcreg.h:1.23
--- src/sys/dev/sdmmc/sdmmcreg.h:1.22	Wed Aug 10 04:24:17 2016
+++ src/sys/dev/sdmmc/sdmmcreg.h	Fri Feb 17 10:43:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.22 2016/08/10 04:24:17 nonaka Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.23 2017/02/17 10:43:03 nonaka Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -115,12 +115,12 @@
 #define SD_ARG_BUS_WIDTH_4		2
 
 /* EXT_CSD fields */
-#define EXT_CSD_BUS_WIDTH		183	/* WO */
-#define EXT_CSD_HS_TIMING		185	/* R/W */
-#define EXT_CSD_REV			192	/* RO */
-#define EXT_CSD_STRUCTURE		194	/* RO */
-#define EXT_CSD_CARD_TYPE		196	/* RO */
-#define EXT_CSD_SEC_COUNT		212	/* RO */
+#define EXT_CSD_BUS_WIDTH		183	/* W/E_P */
+#define EXT_CSD_HS_TIMING		185	/* R/W/E_P */
+#define EXT_CSD_REV			192	/* R */
+#define EXT_CSD_STRUCTURE		194	/* R */
+#define EXT_CSD_CARD_TYPE		196	/* R */
+#define EXT_CSD_SEC_COUNT		212	/* R */
 
 /* EXT_CSD field definitions */
 #define EXT_CSD_CMD_SET_NORMAL		(1U << 0)



CVS commit: src/sbin/newfs_msdos

2017-02-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Feb 17 09:29:35 UTC 2017

Modified Files:
src/sbin/newfs_msdos: mkfs_msdos.h newfs_msdos.8

Log Message:
file system police.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/newfs_msdos/mkfs_msdos.h
cvs rdiff -u -r1.22 -r1.23 src/sbin/newfs_msdos/newfs_msdos.8

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

Modified files:

Index: src/sbin/newfs_msdos/mkfs_msdos.h
diff -u src/sbin/newfs_msdos/mkfs_msdos.h:1.5 src/sbin/newfs_msdos/mkfs_msdos.h:1.6
--- src/sbin/newfs_msdos/mkfs_msdos.h:1.5	Thu Feb 16 22:42:25 2017
+++ src/sbin/newfs_msdos/mkfs_msdos.h	Fri Feb 17 09:29:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs_msdos.h,v 1.5 2017/02/16 22:42:25 christos Exp $	*/
+/*	$NetBSD: mkfs_msdos.h,v 1.6 2017/02/17 09:29:35 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@ AOPT('C', off_t, create_size, 0, "Create
 AOPT('F', uint8_t,  fat_type, 12, "FAT type (12, 16, or 32)") \
 AOPT('I', uint32_t, volume_id, 0, "Volume ID") \
 AOPT('L', char *, volume_label, -1, "Volume Label") \
-AOPT('N', bool, no_create, -2, "Don't create filesystem, print params only") \
+AOPT('N', bool, no_create, -2, "Don't create file system, print params only") \
 AOPT('O', char *, OEM_string, -1, "OEM string") \
 AOPT('S', uint16_t, bytes_per_sector, 1, "Bytes per sector") \
 AOPT('a', uint32_t, sectors_per_fat, 1, "Sectors per FAT") \

Index: src/sbin/newfs_msdos/newfs_msdos.8
diff -u src/sbin/newfs_msdos/newfs_msdos.8:1.22 src/sbin/newfs_msdos/newfs_msdos.8:1.23
--- src/sbin/newfs_msdos/newfs_msdos.8:1.22	Thu Feb 16 18:49:31 2017
+++ src/sbin/newfs_msdos/newfs_msdos.8	Fri Feb 17 09:29:35 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: newfs_msdos.8,v 1.22 2017/02/16 18:49:31 christos Exp $
+.\" $NetBSD: newfs_msdos.8,v 1.23 2017/02/17 09:29:35 wiz Exp $
 .\"
 .\" Copyright (c) 1998 Robert Nordier
 .\" All rights reserved.
@@ -149,7 +149,7 @@ Number of reserved sectors.
 .It Fl s Ar total
 File system size.
 .It Fl T At timestamp
-Specify a timestamp to be used for filesystem creation so that
+Specify a timestamp to be used for file system creation so that
 it can be consistent for reproducible builds.
 The timestamp can be a pathname, where the timestamps are derived from
 that file, a parseable date for parsedate(3) (this option is not



CVS commit: src/sys/sys

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:32:04 UTC 2017

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

Log Message:
Welcome to 7.99.60


To generate a diff of this commit:
cvs rdiff -u -r1.526 -r1.527 src/sys/sys/param.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/param.h
diff -u src/sys/sys/param.h:1.526 src/sys/sys/param.h:1.527
--- src/sys/sys/param.h:1.526	Fri Jan 13 23:05:24 2017
+++ src/sys/sys/param.h	Fri Feb 17 08:32:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.526 2017/01/13 23:05:24 kamil Exp $	*/
+/*	$NetBSD: param.h,v 1.527 2017/02/17 08:32:04 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799005900	/* NetBSD 7.99.59 */
+#define	__NetBSD_Version__	799006000	/* NetBSD 7.99.60 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:31:26 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vfsops.c
src/sys/coda: coda_vfsops.c
src/sys/fs/adosfs: advfsops.c
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/efs: efs_vfsops.c
src/sys/fs/filecorefs: filecore_vfsops.c
src/sys/fs/hfs: hfs_vfsops.c
src/sys/fs/msdosfs: msdosfs_vfsops.c
src/sys/fs/nilfs: nilfs_vfsops.c
src/sys/fs/ntfs: ntfs_vfsops.c
src/sys/fs/ptyfs: ptyfs_vfsops.c
src/sys/fs/puffs: puffs_vfsops.c
src/sys/fs/smbfs: smbfs_vfsops.c
src/sys/fs/sysvbfs: sysvbfs.c
src/sys/fs/tmpfs: tmpfs_vfsops.c
src/sys/fs/udf: udf_vfsops.c
src/sys/fs/union: union_vfsops.c
src/sys/fs/v7fs: v7fs_extern.c
src/sys/miscfs/fdesc: fdesc_vfsops.c
src/sys/miscfs/genfs: genfs.h genfs_vfsops.c layer_extern.h
layer_vfsops.c
src/sys/miscfs/kernfs: kernfs_vfsops.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/procfs: procfs_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c
src/sys/nfs: nfs_vfsops.c
src/sys/rump/librump/rumpvfs: rumpfs.c
src/sys/ufs/chfs: chfs_vfsops.c
src/sys/ufs/ext2fs: ext2fs_vfsops.c
src/sys/ufs/ffs: ffs_vfsops.c
src/sys/ufs/lfs: lfs_vfsops.c
src/sys/ufs/mfs: mfs_vfsops.c

Log Message:
Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.75 -r1.76 src/sys/fs/adosfs/advfsops.c
cvs rdiff -u -r1.90 -r1.91 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.27 -r1.28 src/sys/fs/efs/efs_vfsops.c
cvs rdiff -u -r1.78 -r1.79 src/sys/fs/filecorefs/filecore_vfsops.c
cvs rdiff -u -r1.33 -r1.34 src/sys/fs/hfs/hfs_vfsops.c
cvs rdiff -u -r1.121 -r1.122 src/sys/fs/msdosfs/msdosfs_vfsops.c
cvs rdiff -u -r1.22 -r1.23 src/sys/fs/nilfs/nilfs_vfsops.c
cvs rdiff -u -r1.104 -r1.105 src/sys/fs/ntfs/ntfs_vfsops.c
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/ptyfs/ptyfs_vfsops.c
cvs rdiff -u -r1.118 -r1.119 src/sys/fs/puffs/puffs_vfsops.c
cvs rdiff -u -r1.104 -r1.105 src/sys/fs/smbfs/smbfs_vfsops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/sysvbfs/sysvbfs.c
cvs rdiff -u -r1.69 -r1.70 src/sys/fs/tmpfs/tmpfs_vfsops.c
cvs rdiff -u -r1.73 -r1.74 src/sys/fs/udf/udf_vfsops.c
cvs rdiff -u -r1.75 -r1.76 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_extern.c
cvs rdiff -u -r1.91 -r1.92 src/sys/miscfs/fdesc/fdesc_vfsops.c
cvs rdiff -u -r1.32 -r1.33 src/sys/miscfs/genfs/genfs.h
cvs rdiff -u -r1.3 -r1.4 src/sys/miscfs/genfs/genfs_vfsops.c
cvs rdiff -u -r1.37 -r1.38 src/sys/miscfs/genfs/layer_extern.h
cvs rdiff -u -r1.46 -r1.47 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.95 -r1.96 src/sys/miscfs/kernfs/kernfs_vfsops.c
cvs rdiff -u -r1.90 -r1.91 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.63 -r1.64 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.95 -r1.96 src/sys/miscfs/procfs/procfs_vfsops.c
cvs rdiff -u -r1.95 -r1.96 src/sys/miscfs/umapfs/umap_vfsops.c
cvs rdiff -u -r1.231 -r1.232 src/sys/nfs/nfs_vfsops.c
cvs rdiff -u -r1.143 -r1.144 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/chfs/chfs_vfsops.c
cvs rdiff -u -r1.204 -r1.205 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.344 -r1.345 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.351 -r1.352 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.110 -r1.111 src/sys/ufs/mfs/mfs_vfsops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.14 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.15
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.14	Fri Dec  5 09:13:32 2014
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Fri Feb 17 08:31:23 2017
@@ -116,6 +116,7 @@ static struct vfsops zfs_vfsops_template
 	.vfs_fhtovp = (void *)eopnotsupp,
 	.vfs_quotactl = (void *)eopnotsupp,
 	.vfs_extattrctl = (void *)eopnotsupp,
+	.vfs_suspendctl = genfs_suspendctl,
 	.vfs_snapshot = (void *)eopnotsupp,
 	.vfs_fsync = (void *)eopnotsupp,
 };

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.84 src/sys/coda/coda_vfsops.c:1.85
--- src/sys/coda/coda_vfsops.c:1.84	Sat Dec 13 15:59:30 2014
+++ src/sys/coda/coda_vfsops.c	Fri Feb 17 08:31:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.84 2014/12/13 15:59:30 hannken Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.85 2017/02/17 08:31:23 hannken Exp $	*/
 
 /*
  *
@@ -45

CVS commit: src/sys

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:30:00 UTC 2017

Modified Files:
src/sys/dev: fss.c
src/sys/kern: vfs_vnode.c
src/sys/sys: vnode.h
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Bring back vrele_flush() to flush deferred vrele() o an suspended file system.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/fss.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.273 -r1.274 src/sys/sys/vnode.h
cvs rdiff -u -r1.144 -r1.145 src/sys/ufs/ffs/ffs_snapshot.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/fss.c
diff -u src/sys/dev/fss.c:1.96 src/sys/dev/fss.c:1.97
--- src/sys/dev/fss.c:1.96	Fri Feb 17 08:29:11 2017
+++ src/sys/dev/fss.c	Fri Feb 17 08:30:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $	*/
+/*	$NetBSD: fss.c,v 1.97 2017/02/17 08:30:00 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.97 2017/02/17 08:30:00 hannken Exp $");
 
 #include 
 #include 
@@ -851,6 +851,7 @@ fss_create_snapshot(struct fss_softc *sc
 
 	microtime(&sc->sc_time);
 
+	vrele_flush(sc->sc_mount);
 	error = VFS_SYNC(sc->sc_mount, MNT_WAIT, curlwp->l_cred);
 	if (error == 0)
 		error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc);

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.74 src/sys/kern/vfs_vnode.c:1.75
--- src/sys/kern/vfs_vnode.c:1.74	Fri Feb 17 08:27:58 2017
+++ src/sys/kern/vfs_vnode.c	Fri Feb 17 08:30:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.75 2017/02/17 08:30:00 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.75 2017/02/17 08:30:00 hannken Exp $");
 
 #include 
 #include 
@@ -455,6 +455,45 @@ lru_requeue(vnode_t *vp, vnodelst_t *lis
 }
 
 /*
+ * Release deferred vrele vnodes for this mount.
+ * Called with file system suspended.
+ */
+void
+vrele_flush(struct mount *mp)
+{
+	vnode_impl_t *vip, *marker;
+
+	KASSERT(fstrans_is_owner(mp));
+
+	marker = VNODE_TO_VIMPL(vnalloc_marker(NULL));
+
+	mutex_enter(&vdrain_lock);
+	TAILQ_INSERT_HEAD(&lru_vrele_list, marker, vi_lrulist);
+
+	while ((vip = TAILQ_NEXT(marker, vi_lrulist))) {
+		TAILQ_REMOVE(&lru_vrele_list, marker, vi_lrulist);
+		TAILQ_INSERT_AFTER(&lru_vrele_list, vip, marker, vi_lrulist);
+		if (vnis_marker(VIMPL_TO_VNODE(vip)))
+			continue;
+
+		KASSERT(vip->vi_lrulisthd == &lru_vrele_list);
+		TAILQ_REMOVE(vip->vi_lrulisthd, vip, vi_lrulist);
+		vip->vi_lrulisthd = &lru_hold_list;
+		TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist);
+		mutex_exit(&vdrain_lock);
+
+		vrele(VIMPL_TO_VNODE(vip));
+
+		mutex_enter(&vdrain_lock);
+	}
+
+	TAILQ_REMOVE(&lru_vrele_list, marker, vi_lrulist);
+	mutex_exit(&vdrain_lock);
+
+	vnfree_marker(VIMPL_TO_VNODE(marker));
+}
+
+/*
  * Reclaim a cached vnode.  Used from vdrain_thread only.
  */
 static __inline void
@@ -556,6 +595,8 @@ vdrain_thread(void *cookie)
 TAILQ_REMOVE(listhd[i], marker, vi_lrulist);
 TAILQ_INSERT_AFTER(listhd[i], vip, marker,
 vi_lrulist);
+if (vnis_marker(VIMPL_TO_VNODE(vip)))
+	continue;
 if (listhd[i] == &lru_vrele_list)
 	vdrain_vrele(VIMPL_TO_VNODE(vip));
 else if (numvnodes < target)

Index: src/sys/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.273 src/sys/sys/vnode.h:1.274
--- src/sys/sys/vnode.h:1.273	Wed Jan 11 12:17:34 2017
+++ src/sys/sys/vnode.h	Fri Feb 17 08:30:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.273 2017/01/11 12:17:34 joerg Exp $	*/
+/*	$NetBSD: vnode.h,v 1.274 2017/02/17 08:30:00 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -515,6 +515,7 @@ void 	vput(struct vnode *);
 bool	vrecycle(struct vnode *);
 void 	vrele(struct vnode *);
 void 	vrele_async(struct vnode *);
+void	vrele_flush(struct mount *);
 int	vtruncbuf(struct vnode *, daddr_t, bool, int);
 void	vwakeup(struct buf *);
 int	vdead_check(struct vnode *, int);

Index: src/sys/ufs/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.144 src/sys/ufs/ffs/ffs_snapshot.c:1.145
--- src/sys/ufs/ffs/ffs_snapshot.c:1.144	Fri Feb 17 08:29:11 2017
+++ src/sys/ufs/ffs/ffs_snapshot.c	Fri Feb 17 08:30:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.145 2017/02/17 08:30:00 hannken Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 

CVS commit: src/sys

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:29:11 UTC 2017

Modified Files:
src/sys/dev: fss.c
src/sys/fs/msdosfs: msdosfs_vfsops.c
src/sys/ufs/ffs: ffs_snapshot.c ffs_vfsops.c

Log Message:
Untangle VFS_SYNC() from VFS_SUSPENDCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/fss.c
cvs rdiff -u -r1.120 -r1.121 src/sys/fs/msdosfs/msdosfs_vfsops.c
cvs rdiff -u -r1.143 -r1.144 src/sys/ufs/ffs/ffs_snapshot.c
cvs rdiff -u -r1.343 -r1.344 src/sys/ufs/ffs/ffs_vfsops.c

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

Modified files:

Index: src/sys/dev/fss.c
diff -u src/sys/dev/fss.c:1.95 src/sys/dev/fss.c:1.96
--- src/sys/dev/fss.c:1.95	Sun Jul 31 12:17:36 2016
+++ src/sys/dev/fss.c	Fri Feb 17 08:29:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.95 2016/07/31 12:17:36 hannken Exp $	*/
+/*	$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.95 2016/07/31 12:17:36 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $");
 
 #include 
 #include 
@@ -851,7 +851,9 @@ fss_create_snapshot(struct fss_softc *sc
 
 	microtime(&sc->sc_time);
 
-	error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc);
+	error = VFS_SYNC(sc->sc_mount, MNT_WAIT, curlwp->l_cred);
+	if (error == 0)
+		error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc);
 	if (error == 0)
 		sc->sc_flags |= FSS_ACTIVE;
 

Index: src/sys/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.120 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.121
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.120	Fri Feb 17 08:27:20 2017
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Fri Feb 17 08:29:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.121 2017/02/17 08:29:11 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.121 2017/02/17 08:29:11 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1120,10 +1120,7 @@ msdosfs_suspendctl(struct mount *mp, int
 	case SUSPEND_SUSPEND:
 		if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0)
 			return error;
-		error = msdosfs_sync(mp, MNT_WAIT, l->l_proc->p_cred);
-		if (error == 0)
-			error = fstrans_setstate(mp, FSTRANS_SUSPENDED);
-		if (error != 0) {
+		if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDED)) != 0) {
 			(void) fstrans_setstate(mp, FSTRANS_NORMAL);
 			return error;
 		}

Index: src/sys/ufs/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.143 src/sys/ufs/ffs/ffs_snapshot.c:1.144
--- src/sys/ufs/ffs/ffs_snapshot.c:1.143	Fri Oct 28 20:38:12 2016
+++ src/sys/ufs/ffs/ffs_snapshot.c	Fri Feb 17 08:29:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.143 2016/10/28 20:38:12 jdolecek Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.143 2016/10/28 20:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -254,10 +254,13 @@ ffs_snapshot(struct mount *mp, struct vn
 	 * All allocations are done, so we can now suspend the filesystem.
 	 */
 	error = vfs_suspend(vp->v_mount, 0);
+	if (error == 0) {
+		suspended = true;
+		error = VFS_SYNC(vp->v_mount, MNT_WAIT, curlwp->l_cred);
+	}
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	if (error)
 		goto out;
-	suspended = true;
 	getmicrotime(&starttime);
 	/*
 	 * First, copy all the cylinder group maps that have changed.

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.343 src/sys/ufs/ffs/ffs_vfsops.c:1.344
--- src/sys/ufs/ffs/ffs_vfsops.c:1.343	Fri Feb 17 08:26:41 2017
+++ src/sys/ufs/ffs/ffs_vfsops.c	Fri Feb 17 08:29:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.344 2017/02/17 08:29:11 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.344 2017/02/17 08:29:11 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2408,14 +2408,7 @@ ffs_suspendctl(struct mount *mp, int cmd
 	case SUSPEND_SUSPEND:
 		if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0)
 			return error;
-		error = ffs_sync(mp, MNT_WAIT, l-

CVS commit: src/sys/kern

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:27:58 UTC 2017

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

Log Message:
Make sure vcache_reclaim() will complete before file system suspension.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/kern/vfs_vnode.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/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.73 src/sys/kern/vfs_vnode.c:1.74
--- src/sys/kern/vfs_vnode.c:1.73	Fri Jan 27 10:50:10 2017
+++ src/sys/kern/vfs_vnode.c	Fri Feb 17 08:27:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.73 2017/01/27 10:50:10 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.73 2017/01/27 10:50:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $");
 
 #include 
 #include 
@@ -1441,6 +1441,7 @@ vcache_reclaim(vnode_t *vp)
 {
 	lwp_t *l = curlwp;
 	vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
+	struct mount *mp = vp->v_mount;
 	uint32_t hash;
 	uint8_t temp_buf[64], *temp_key;
 	size_t temp_key_len;
@@ -1477,6 +1478,8 @@ vcache_reclaim(vnode_t *vp)
 	vip->vi_key.vk_key = temp_key;
 	mutex_exit(&vcache_lock);
 
+	fstrans_start(mp, FSTRANS_LAZY);
+
 	/*
 	 * Clean out any cached data associated with the vnode.
 	 * If purging an active vnode, it must be closed and
@@ -1537,6 +1540,8 @@ vcache_reclaim(vnode_t *vp)
 	vp->v_tag = VT_NON;
 	KNOTE(&vp->v_klist, NOTE_REVOKE);
 
+	fstrans_done(mp);
+
 	KASSERT((vp->v_iflag & VI_ONWORKLST) == 0);
 }
 



CVS commit: src/sys/fs/msdosfs

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:27:20 UTC 2017

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Take vnode lock for VOP_FSYNC().


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/fs/msdosfs/msdosfs_vfsops.c

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

Modified files:

Index: src/sys/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.119 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.120
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.119	Wed Dec 14 15:48:54 2016
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Fri Feb 17 08:27:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.119 2016/12/14 15:48:54 hannken Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.119 2016/12/14 15:48:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1032,9 +1032,11 @@ msdosfs_sync(struct mount *mp, int waitf
 	/*
 	 * Force stale file system control information to be flushed.
 	 */
+	vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY);
 	if ((error = VOP_FSYNC(pmp->pm_devvp, cred,
 	waitfor == MNT_WAIT ? FSYNC_WAIT : 0, 0, 0)) != 0)
 		allerror = error;
+	VOP_UNLOCK(pmp->pm_devvp);
 	fstrans_done(mp);
 	return (allerror);
 }



CVS commit: src/sys/ufs/ffs

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:26:41 UTC 2017

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Flush the log to disk when ffs_sync() gets called with MNT_WAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.342 -r1.343 src/sys/ufs/ffs/ffs_vfsops.c

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

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.342 src/sys/ufs/ffs/ffs_vfsops.c:1.343
--- src/sys/ufs/ffs/ffs_vfsops.c:1.342	Tue Dec 27 10:54:38 2016
+++ src/sys/ufs/ffs/ffs_vfsops.c	Fri Feb 17 08:26:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.342 2016/12/27 10:54:38 hannken Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.342 2016/12/27 10:54:38 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1973,7 +1973,7 @@ ffs_sync(struct mount *mp, int waitfor, 
 
 #ifdef WAPBL
 	if (mp->mnt_wapbl) {
-		error = wapbl_flush(mp->mnt_wapbl, 0);
+		error = wapbl_flush(mp->mnt_wapbl, (waitfor == MNT_WAIT));
 		if (error)
 			allerror = error;
 	}



CVS commit: src/sys/kern

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:26:07 UTC 2017

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

Log Message:
Take fstrans_start before syncing a file system.


To generate a diff of this commit:
cvs rdiff -u -r1.505 -r1.506 src/sys/kern/vfs_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/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.505 src/sys/kern/vfs_syscalls.c:1.506
--- src/sys/kern/vfs_syscalls.c:1.505	Sun Jul 31 20:34:04 2016
+++ src/sys/kern/vfs_syscalls.c	Fri Feb 17 08:26:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.505 2016/07/31 20:34:04 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.506 2017/02/17 08:26:07 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.505 2016/07/31 20:34:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.506 2017/02/17 08:26:07 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -87,6 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -638,6 +639,7 @@ do_sys_sync(struct lwp *l)
 		if (vfs_busy(mp, &nmp)) {
 			continue;
 		}
+		fstrans_start(mp, FSTRANS_SHARED);
 		mutex_enter(&mp->mnt_updating);
 		if ((mp->mnt_flag & MNT_RDONLY) == 0) {
 			asyncflag = mp->mnt_flag & MNT_ASYNC;
@@ -647,6 +649,7 @@ do_sys_sync(struct lwp *l)
  mp->mnt_flag |= MNT_ASYNC;
 		}
 		mutex_exit(&mp->mnt_updating);
+		fstrans_done(mp);
 		vfs_unbusy(mp, false, &nmp);
 	}
 	mutex_exit(&mountlist_lock);



CVS commit: src/sys/kern

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:25:15 UTC 2017

Modified Files:
src/sys/kern: vfs_subr.c vfs_trans.c

Log Message:
Let syncer try fstrans_start() before running VFS_SYNC() to get rid
of the syncer lock/unlock from vfs_suspend().


To generate a diff of this commit:
cvs rdiff -u -r1.459 -r1.460 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/vfs_trans.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/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.459 src/sys/kern/vfs_subr.c:1.460
--- src/sys/kern/vfs_subr.c:1.459	Wed Jan 11 14:52:02 2017
+++ src/sys/kern/vfs_subr.c	Fri Feb 17 08:25:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.459 2017/01/11 14:52:02 hannken Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.460 2017/02/17 08:25:15 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.459 2017/01/11 14:52:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.460 2017/02/17 08:25:15 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -782,7 +783,10 @@ sched_sync(void *arg)
 			mp->mnt_synclist_slot = sync_delay_slot(sync_delay(mp));
 			if (vfs_busy(mp, &nmp))
 continue;
-			VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
+			if (fstrans_start_nowait(mp, FSTRANS_SHARED) == 0) {
+VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
+fstrans_done(mp);
+			}
 			vfs_unbusy(mp, false, &nmp);
 		}
 		mutex_exit(&mountlist_lock);

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.35 src/sys/kern/vfs_trans.c:1.36
--- src/sys/kern/vfs_trans.c:1.35	Fri Feb 17 08:24:07 2017
+++ src/sys/kern/vfs_trans.c	Fri Feb 17 08:25:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.35 2017/02/17 08:24:07 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.36 2017/02/17 08:25:15 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.35 2017/02/17 08:24:07 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.36 2017/02/17 08:25:15 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -506,11 +506,8 @@ vfs_suspend(struct mount *mp, int nowait
 	} else
 		mutex_enter(&vfs_suspend_lock);
 
-	mutex_enter(&syncer_mutex);
-	if ((error = VFS_SUSPENDCTL(mp, SUSPEND_SUSPEND)) != 0) {
-		mutex_exit(&syncer_mutex);
+	if ((error = VFS_SUSPENDCTL(mp, SUSPEND_SUSPEND)) != 0)
 		mutex_exit(&vfs_suspend_lock);
-	}
 
 	return error;
 }
@@ -523,7 +520,6 @@ vfs_resume(struct mount *mp)
 {
 
 	VFS_SUSPENDCTL(mp, SUSPEND_RESUME);
-	mutex_exit(&syncer_mutex);
 	mutex_exit(&vfs_suspend_lock);
 }
 



CVS commit: src/sys/kern

2017-02-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 17 08:24:07 UTC 2017

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

Log Message:
Protect attaching and detaching lwp_info to mount with a mutex.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/vfs_trans.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/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.34 src/sys/kern/vfs_trans.c:1.35
--- src/sys/kern/vfs_trans.c:1.34	Mon Aug 24 22:50:32 2015
+++ src/sys/kern/vfs_trans.c	Fri Feb 17 08:24:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.34 2015/08/24 22:50:32 pooka Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.35 2017/02/17 08:24:07 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.34 2015/08/24 22:50:32 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.35 2017/02/17 08:24:07 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -78,6 +78,7 @@ struct fstrans_mount_info {
 static specificdata_key_t lwp_data_key;	/* Our specific data key. */
 static kmutex_t vfs_suspend_lock;	/* Serialize suspensions. */
 static kmutex_t fstrans_lock;		/* Fstrans big lock. */
+static kmutex_t fstrans_mount_lock;	/* Fstrans mount big lock. */
 static kcondvar_t fstrans_state_cv;	/* Fstrans or cow state changed. */
 static kcondvar_t fstrans_count_cv;	/* Fstrans or cow count changed. */
 static pserialize_t fstrans_psz;	/* Pserialize state. */
@@ -106,6 +107,7 @@ fstrans_init(void)
 
 	mutex_init(&vfs_suspend_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(&fstrans_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(&fstrans_mount_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&fstrans_state_cv, "fstchg");
 	cv_init(&fstrans_count_cv, "fstcnt");
 	fstrans_psz = pserialize_create();
@@ -140,17 +142,25 @@ fstrans_mount_dtor(struct mount *mp)
 {
 	struct fstrans_mount_info *fmi;
 
+	mutex_enter(&fstrans_mount_lock);
+
 	fmi = mp->mnt_transinfo;
-	if (atomic_dec_uint_nv(&fmi->fmi_ref_cnt) > 0)
+	KASSERT(fmi != NULL);
+	fmi->fmi_ref_cnt -= 1;
+	if (fmi->fmi_ref_cnt > 0) {
+		mutex_exit(&fstrans_mount_lock);
 		return;
+	}
 
 	KASSERT(fmi->fmi_state == FSTRANS_NORMAL);
 	KASSERT(LIST_FIRST(&fmi->fmi_cow_handler) == NULL);
 
-	kmem_free(fmi, sizeof(*fmi));
 	mp->mnt_iflag &= ~IMNT_HAS_TRANS;
 	mp->mnt_transinfo = NULL;
 
+	mutex_exit(&fstrans_mount_lock);
+
+	kmem_free(fmi, sizeof(*fmi));
 	vfs_destroy(mp);
 }
 
@@ -172,8 +182,10 @@ fstrans_mount(struct mount *mp)
 	LIST_INIT(&newfmi->fmi_cow_handler);
 	newfmi->fmi_cow_change = false;
 
+	mutex_enter(&fstrans_mount_lock);
 	mp->mnt_transinfo = newfmi;
 	mp->mnt_iflag |= IMNT_HAS_TRANS;
+	mutex_exit(&fstrans_mount_lock);
 
 	vfs_unbusy(mp, true, NULL);
 
@@ -236,6 +248,7 @@ fstrans_get_lwp_info(struct mount *mp, b
 		mutex_enter(&fstrans_lock);
 		LIST_FOREACH(fli, &fstrans_fli_head, fli_list) {
 			if (fli->fli_self == NULL) {
+KASSERT(fli->fli_mount == NULL);
 KASSERT(fli->fli_trans_cnt == 0);
 KASSERT(fli->fli_cow_cnt == 0);
 fli->fli_self = curlwp;
@@ -260,9 +273,16 @@ fstrans_get_lwp_info(struct mount *mp, b
 	/*
 	 * Attach the entry to the mount.
 	 */
-	fmi = mp->mnt_transinfo;
-	fli->fli_mount = mp;
-	atomic_inc_uint(&fmi->fmi_ref_cnt);
+	mutex_enter(&fstrans_mount_lock);
+	if (mp == NULL || (mp->mnt_iflag & IMNT_HAS_TRANS) == 0) {
+		fli = NULL;
+	} else {
+		fmi = mp->mnt_transinfo;
+		KASSERT(fmi != NULL);
+		fli->fli_mount = mp;
+		fmi->fmi_ref_cnt += 1;
+	}
+	mutex_exit(&fstrans_mount_lock);
 
 	return fli;
 }
@@ -297,11 +317,9 @@ _fstrans_start(struct mount *mp, enum fs
 
 	ASSERT_SLEEPABLE();
 
-	if (mp == NULL || (mp->mnt_iflag & IMNT_HAS_TRANS) == 0)
+	if (mp == NULL || (fli = fstrans_get_lwp_info(mp, true)) == NULL)
 		return 0;
 
-	fli = fstrans_get_lwp_info(mp, true);
-
 	if (fli->fli_trans_cnt > 0) {
 		KASSERT(lock_type != FSTRANS_EXCL);
 		fli->fli_trans_cnt += 1;
@@ -343,11 +361,9 @@ fstrans_done(struct mount *mp)
 	struct fstrans_lwp_info *fli;
 	struct fstrans_mount_info *fmi;
 
-	if (mp == NULL || (mp->mnt_iflag & IMNT_HAS_TRANS) == 0)
+	if (mp == NULL || (fli = fstrans_get_lwp_info(mp, true)) == NULL)
 		return;
 
-	fli = fstrans_get_lwp_info(mp, false);
-	KASSERT(fli != NULL);
 	KASSERT(fli->fli_trans_cnt > 0);
 
 	if (fli->fli_trans_cnt > 1) {
@@ -380,11 +396,10 @@ fstrans_is_owner(struct mount *mp)
 {
 	struct fstrans_lwp_info *fli;
 
-	if (mp == NULL || (mp->mnt_iflag & IMNT_HAS_TRANS) == 0)
+	if (mp == NULL || (fli = fstrans_get_lwp_info(mp, false)) == NULL)
 		return 0;
 
-	fli = fstrans_get_lwp_info(mp, false);
-	if (fli == NULL || fli->fli_trans_cnt == 0)
+	if (fli->fli_trans_cnt == 0)
 		return 0;
 
 	KASSERT(fli->fli_mount == mp);