CVS commit: src/lib/libcrypt

2019-10-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Oct 21 05:16:51 UTC 2019

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
Mark up argon2 description. Restore removed lines/text from previous
commit.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libcrypt/crypt.3

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



CVS commit: src/lib/libcrypt

2019-10-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Oct 21 05:16:51 UTC 2019

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
Mark up argon2 description. Restore removed lines/text from previous
commit.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libcrypt/crypt.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/libcrypt/crypt.3
diff -u src/lib/libcrypt/crypt.3:1.28 src/lib/libcrypt/crypt.3:1.29
--- src/lib/libcrypt/crypt.3:1.28	Mon Oct 21 02:36:48 2019
+++ src/lib/libcrypt/crypt.3	Mon Oct 21 05:16:51 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crypt.3,v 1.28 2019/10/21 02:36:48 jhigh Exp $
+.\"	$NetBSD: crypt.3,v 1.29 2019/10/21 05:16:51 wiz Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -241,25 +241,26 @@ A valid password looks like this:
 The entire password string is passed as
 .Fa setting
 for interpretation.
-
 .Ss Argon2 encryption
-
-Argon2 is a memory-hard hashing algorithm. crypt() provides all 
-three variants: argon2i, argon2d, and argon2id. It is recommended 
-to use argon2id, which provides a hybrid combination using argon2i 
-on the first pass, and argon2d on the remaining passes.  We 
-parameterize on three variables.  First, m_cost (m), specifies the 
-memory usage in KB.  Second, t_cost (t), specfies the number of 
-iterations.  Third, parallelism (p) specifies the number of threads.  
-A valid Argon2 encoded password looks similar to 
-
+Argon2 is a memory-hard hashing algorithm.
+.Fn crypt
+provides all three variants: argon2i, argon2d, and argon2id.
+It is recommended to use argon2id, which provides a hybrid combination
+using argon2i on the first pass, and argon2d on the remaining
+passes.
+We parameterize on three variables.
+First, m_cost (m), specifies the memory usage in KB.
+Second, t_cost (t), specfies the number of iterations.
+Third, parallelism (p) specifies the number of threads.
+A valid Argon2 encoded password looks similar to
+.Bd -literal
 $argon2id$v=19$m=4096,t=6,p=1$qCatF9a1s/6TgcYB$ \
yeYYrU/rh7E+LI2CAeHTSHVB3iO+OXiNIUHu6NPeTfo
-
-containing five fields delimited by '$'. The fields, in order, are 
-variant name, version, parameter set , 128-bit salt, and encoded password. 
-The complete password string is required to be processed correctly. 
-
+.Ed
+containing five fields delimited by '$'.
+The fields, in order, are variant name, version, parameter set,
+128-bit salt, and encoded password.
+The complete password string is required to be processed correctly.
 .Ss "Blowfish" crypt
 The
 .Tn Blowfish
@@ -357,14 +358,20 @@ Historically, the functions
 and
 .Fn encrypt
 did not return any value.
-Theyave been provided return values primarily to distinguish
+They have been provided return values primarily to distinguish
 implementations where hardware support is provided but not
 available or where the DES encryption is not available due to the
 usual political silliness.
 .Sh SEE ALSO
 .Xr login 1 ,
 .Xr passwd 1 ,
-.Xr cal Cryptology for Computer Scientists and Mathematicians"
+.Xr pwhash 1 ,
+.Xr getpass 3 ,
+.Xr md5 3 ,
+.Xr passwd 5 ,
+.Xr passwd.conf 5
+.Rs
+.%T "Mathematical Cryptology for Computer Scientists and Mathematicians"
 .%A Wayne Patterson
 .%D 1987
 .%N ISBN 0-8476-7438-X
@@ -376,7 +383,14 @@ usual political silliness.
 .%J "Communications of the ACM"
 .%V vol. 22
 .%P pp. 594-597
-.%D N pp. 32-39
+.%D Nov. 1979
+.Re
+.Rs
+.%T "DES will be Totally Insecure within Ten Years"
+.%A M.E. Hellman
+.%J "IEEE Spectrum"
+.%V vol. 16
+.%P pp. 32-39
 .%D July 1979
 .Re
 .Sh HISTORY
@@ -393,7 +407,7 @@ Dropping the
 .Em least
 significant bit in each character of the argument to
 .Fn des_setkey
-is ri
+is ridiculous.
 .Pp
 The
 .Fn crypt



CVS commit: src

2019-10-20 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 21 02:36:48 UTC 2019

Modified Files:
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile
src/lib/libcrypt: Makefile crypt.3 crypt.c crypt.h pw_gensalt.c
src/usr.bin/pwhash: Makefile pwhash.1 pwhash.c
Added Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
adding argon2 support to libcrypt. argon2 user authentication now
available via MKARGON2=yes (3 variants supported; argon2id recommended)
before using, please read argon2 paper at
https://github.com/P-H-C/phc-winner-argon2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.25 -r1.26 src/lib/libcrypt/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/libcrypt/crypt-argon2.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcrypt/crypt.3
cvs rdiff -u -r1.35 -r1.36 src/lib/libcrypt/crypt.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/pwhash/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/pwhash/pwhash.1
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/pwhash/pwhash.c

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

Modified files:

Index: src/external/apache2/argon2/lib/libargon2/Makefile
diff -u src/external/apache2/argon2/lib/libargon2/Makefile:1.1 src/external/apache2/argon2/lib/libargon2/Makefile:1.2
--- src/external/apache2/argon2/lib/libargon2/Makefile:1.1	Wed Oct  9 13:13:09 2019
+++ src/external/apache2/argon2/lib/libargon2/Makefile	Mon Oct 21 02:36:48 2019
@@ -12,15 +12,7 @@ INCSDIR=	/usr/include
 LIB=	argon2	
 SRCS=	argon2.c core.c blake2b.c thread.c encoding.c ref.c
 
-
-CPPFLAGS= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc -shared -fPIC
-
-.ifdef NO_THREADS
-CPPFLAGS += -DARGON2_NO_THREADS
-.else
-CPPFLAGS += -pthread
-LDADD+=-lpthread
-.endif
+CPPFLAGS= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc -fPIC -DARGON2_NO_THREADS
 
 OPTTARGET ?= native
 OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \

Index: src/external/apache2/argon2/usr.bin/argon2/Makefile
diff -u src/external/apache2/argon2/usr.bin/argon2/Makefile:1.1 src/external/apache2/argon2/usr.bin/argon2/Makefile:1.2
--- src/external/apache2/argon2/usr.bin/argon2/Makefile:1.1	Wed Oct  9 13:13:10 2019
+++ src/external/apache2/argon2/usr.bin/argon2/Makefile	Mon Oct 21 02:36:48 2019
@@ -10,16 +10,7 @@ SRCS=
 SRCS=   argon2.c core.c blake2b.c thread.c encoding.c ref.c
 SRCS+=   run.c
 
-.ifdef NO_THREADS 
-CPPFLAGS += -DARGON2_NO_THREADS
-.else
-CPPFLAGS += -pthread
-LDADD+=-lpthread
-.endif
-
-CPPFLAGS+= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc #-shared -fPIC
-#LDADD+= -L${LIBARGON2} -largon2
-#DPADD+= ${LIBARGON2_SD}
+CPPFLAGS+= -DARGON2_NO_THREADS -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc 
 
 MAN=argon2.1
 

Index: src/lib/libcrypt/Makefile
diff -u src/lib/libcrypt/Makefile:1.25 src/lib/libcrypt/Makefile:1.26
--- src/lib/libcrypt/Makefile:1.25	Sat Aug 10 18:42:29 2013
+++ src/lib/libcrypt/Makefile	Mon Oct 21 02:36:48 2019
@@ -1,12 +1,24 @@
-#	$NetBSD: Makefile,v 1.25 2013/08/10 18:42:29 dholland Exp $
+#	$NetBSD: Makefile,v 1.26 2019/10/21 02:36:48 jhigh Exp $
+
+.include 
 
 USE_SHLIBDIR=	yes
 
+.if (defined(MKARGON2) && ${MKARGON2} != "no")
+HAVE_ARGON2=1
+.endif
+
 LIB=	crypt
 
 SRCS=	crypt.c md5crypt.c bcrypt.c crypt-sha1.c util.c pw_gensalt.c
 SRCS+=	hmac_sha1.c
 
+.if defined(HAVE_ARGON2)
+SRCS+=		crypt-argon2.c
+CFLAGS+=	-DHAVE_ARGON2 -I../../external/apache2/argon2/dist/phc-winner-argon2/include/
+LDADD+=		-largon2 
+.endif
+
 WARNS?=	5
 
 MAN=	crypt.3

Index: src/lib/libcrypt/crypt.3
diff -u src/lib/libcrypt/crypt.3:1.27 src/lib/libcrypt/crypt.3:1.28
--- src/lib/libcrypt/crypt.3:1.27	Fri Mar 23 18:08:35 2012
+++ src/lib/libcrypt/crypt.3	Mon Oct 21 02:36:48 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crypt.3,v 1.27 2012/03/23 18:08:35 njoly Exp $
+.\"	$NetBSD: crypt.3,v 1.28 2019/10/21 02:36:48 jhigh Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -241,6 +241,25 @@ A valid password looks like this:
 The entire password string is passed as
 .Fa setting
 for interpretation.
+
+.Ss Argon2 encryption
+
+Argon2 is a memory-hard hashing algorithm. crypt() provides all 
+three variants: argon2i, argon2d, and argon2id. It is recommended 
+to use argon2id, which provides a hybrid combination using argon2i 
+on the first pass, and argon2d on the remaining passes.  We 
+parameterize on three variables.  First, m_cost (m), specifies the 
+memory usage in KB.  Second, t_cost (t), specfies the number of 
+iterations.  Third, parallelism (p) specifies the number of threads.  

CVS commit: src

2019-10-20 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 21 02:36:48 UTC 2019

Modified Files:
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile
src/lib/libcrypt: Makefile crypt.3 crypt.c crypt.h pw_gensalt.c
src/usr.bin/pwhash: Makefile pwhash.1 pwhash.c
Added Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
adding argon2 support to libcrypt. argon2 user authentication now
available via MKARGON2=yes (3 variants supported; argon2id recommended)
before using, please read argon2 paper at
https://github.com/P-H-C/phc-winner-argon2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.25 -r1.26 src/lib/libcrypt/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/libcrypt/crypt-argon2.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcrypt/crypt.3
cvs rdiff -u -r1.35 -r1.36 src/lib/libcrypt/crypt.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/pwhash/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/pwhash/pwhash.1
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/pwhash/pwhash.c

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



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

2019-10-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Oct 20 23:47:14 UTC 2019

Added Files:
src/sys/arch/arm/dts/overlays: sunxi-h3-h5-orangepi-zero-nas.dts

Log Message:
Add a device tree Overlay for the Orange Pi Zero NAS expansion board for
Orange Pi Zero and Orange Pi Zero Plus.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/sys/arch/arm/dts/overlays/sunxi-h3-h5-orangepi-zero-nas.dts

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



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

2019-10-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Oct 20 23:47:14 UTC 2019

Added Files:
src/sys/arch/arm/dts/overlays: sunxi-h3-h5-orangepi-zero-nas.dts

Log Message:
Add a device tree Overlay for the Orange Pi Zero NAS expansion board for
Orange Pi Zero and Orange Pi Zero Plus.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/sys/arch/arm/dts/overlays/sunxi-h3-h5-orangepi-zero-nas.dts

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

Added files:

Index: src/sys/arch/arm/dts/overlays/sunxi-h3-h5-orangepi-zero-nas.dts
diff -u /dev/null src/sys/arch/arm/dts/overlays/sunxi-h3-h5-orangepi-zero-nas.dts:1.1
--- /dev/null	Sun Oct 20 23:47:14 2019
+++ src/sys/arch/arm/dts/overlays/sunxi-h3-h5-orangepi-zero-nas.dts	Sun Oct 20 23:47:14 2019
@@ -0,0 +1,56 @@
+/* $NetBSD: sunxi-h3-h5-orangepi-zero-nas.dts,v 1.1 2019/10/20 23:47:14 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jason R Thorpe
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Overlay for the Orange Pi Zero NAS expansion board for Orange Pi Zero
+ * and Orange Pi Zero Plus.
+ *
+ * https://www.aliexpress.com/item/Orange-Pi-Zero-NAS-Expansion-board-Interface-board-Development-board-beyond-Raspberry-Pi/32789632568.html
+ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "xunlong,orangepi-zero-plus", "xunlong,orangepi-zero";
+
+	/* ohci2/ehci2 has the JMS578 USB2->SATA bridge. */
+	fragment@0 {
+		target = <>;
+		__overlay__ {
+			status = "okay";
+		};
+	};
+
+	fragment@1 {
+		target = <>;
+		__overlay__ {
+			status = "okay";
+		};
+	};
+};



CVS commit: src/share/misc

2019-10-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Oct 20 21:53:43 UTC 2019

Modified Files:
src/share/misc: acronyms acronyms.comp

Log Message:
CIA ISMS


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/share/misc/acronyms
cvs rdiff -u -r1.293 -r1.294 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.288 src/share/misc/acronyms:1.289
--- src/share/misc/acronyms:1.288	Mon Sep  9 12:42:52 2019
+++ src/share/misc/acronyms	Sun Oct 20 21:53:42 2019
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.288 2019/09/09 12:42:52 sevan Exp $
+$NetBSD: acronyms,v 1.289 2019/10/20 21:53:42 sevan Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -94,6 +94,7 @@ CFV	call for votes
 CFY	calling for you
 CG	center of gravity
 CHANOPS	channel operator status
+CIA	central intelligence agency
 CMIIW	correct me if I'm wrong
 CNP	continued [in my] next post
 COB	close of business [day]

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.293 src/share/misc/acronyms.comp:1.294
--- src/share/misc/acronyms.comp:1.293	Sun Oct  6 15:17:39 2019
+++ src/share/misc/acronyms.comp	Sun Oct 20 21:53:42 2019
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.293 2019/10/06 15:17:39 sevan Exp $
+$NetBSD: acronyms.comp,v 1.294 2019/10/20 21:53:42 sevan Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -241,6 +241,7 @@ CHFS	chip file system
 CHS	cylinder/head/sector
 CI	continuous integration
 CI	{common,component} interface
+CIA	confidentiality, integrity, availability
 CIDR	Classless Inter-Domain Routing
 CIF	common intermediate format
 CIFS	Common Internet File System
@@ -769,6 +770,7 @@ ISDN	integrated services digital network
 ISI	inter-symbol interference
 ISL	initial system load
 ISM	industrial, scientific, [and] medical
+ISMS	information system management system
 ISN	initial serial number
 ISO	International Standards Organization
 ISOC	Internet Society



CVS commit: src/share/misc

2019-10-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Oct 20 21:53:43 UTC 2019

Modified Files:
src/share/misc: acronyms acronyms.comp

Log Message:
CIA ISMS


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/share/misc/acronyms
cvs rdiff -u -r1.293 -r1.294 src/share/misc/acronyms.comp

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



CVS commit: src/usr.sbin/gpioctl

2019-10-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct 20 17:45:08 UTC 2019

Modified Files:
src/usr.sbin/gpioctl: gpioctl.8

Log Message:
Be consistent in not marking up "GPIO".


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/gpioctl/gpioctl.8

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



CVS commit: src/usr.sbin/gpioctl

2019-10-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct 20 17:45:08 UTC 2019

Modified Files:
src/usr.sbin/gpioctl: gpioctl.8

Log Message:
Be consistent in not marking up "GPIO".


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/gpioctl/gpioctl.8

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

Modified files:

Index: src/usr.sbin/gpioctl/gpioctl.8
diff -u src/usr.sbin/gpioctl/gpioctl.8:1.23 src/usr.sbin/gpioctl/gpioctl.8:1.24
--- src/usr.sbin/gpioctl/gpioctl.8:1.23	Sun Oct 20 09:41:53 2019
+++ src/usr.sbin/gpioctl/gpioctl.8	Sun Oct 20 17:45:08 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpioctl.8,v 1.23 2019/10/20 09:41:53 tnn Exp $
+.\" $NetBSD: gpioctl.8,v 1.24 2019/10/20 17:45:08 wiz Exp $
 .\"
 .\" Copyright (c) 2009, 2010, 2011, 2013 Marc Balmer 
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -155,9 +155,7 @@ When executed with only the
 .Xr gpio 4
 device name as argument,
 .Nm
-reads information about the
-.Tn GPIO
-device and displays it.
+reads information about the GPIO device and displays it.
 At securelevel 0 the number of physically available pins is displayed,
 at higher securelevels the number of configured (set) pins is displayed.
 .Pp



CVS commit: src/tests/kernel

2019-10-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 20 16:02:11 UTC 2019

Modified Files:
src/tests/kernel: t_fcntl.c

Log Message:
opening a symlink with O_NOFOLLOW is expected to fail.


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

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



CVS commit: src/tests/kernel

2019-10-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 20 16:02:11 UTC 2019

Modified Files:
src/tests/kernel: t_fcntl.c

Log Message:
opening a symlink with O_NOFOLLOW is expected to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_fcntl.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/t_fcntl.c
diff -u src/tests/kernel/t_fcntl.c:1.1 src/tests/kernel/t_fcntl.c:1.2
--- src/tests/kernel/t_fcntl.c:1.1	Sun Sep 15 12:25:58 2019
+++ src/tests/kernel/t_fcntl.c	Sun Oct 20 12:02:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fcntl.c,v 1.1 2019/09/15 16:25:58 christos Exp $	*/
+/*	$NetBSD: t_fcntl.c,v 1.2 2019/10/20 16:02:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@ static const struct {
 	{ "/bin/sh", 0 },
 	{ "/dev/zero", 0 },
 	{ "/dev/null", 0 },
-	{ "/bin/chgrp", 0 },
+	{ "/sbin/chown", 0 },
 	{ "/", ENOENT },
 };
 
@@ -64,7 +64,7 @@ ATF_TC_BODY(getpath, tc)
 
 	for (size_t i = 0; i < __arraycount(files); i++) {
 		fd = open(files[i].name, O_RDONLY|O_NOFOLLOW);
-		ATF_REQUIRE(fd != -1);
+		ATF_REQUIRE_MSG(fd != -1, "Cannot open `%s'", files[i].name);
 		rv = fcntl(fd, F_GETPATH, path);
 		if (files[i].rv) {
 			ATF_REQUIRE_MSG(errno == files[i].rv,



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

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 14:25:14 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arm/arm32/cpu.c

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

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.133 src/sys/arch/arm/arm32/cpu.c:1.134
--- src/sys/arch/arm/arm32/cpu.c:1.133	Sat Oct 19 18:04:26 2019
+++ src/sys/arch/arm/arm32/cpu.c	Sun Oct 20 14:25:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.133 2019/10/19 18:04:26 jmcneill Exp $	*/
+/*	$NetBSD: cpu.c,v 1.134 2019/10/20 14:25:14 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.133 2019/10/19 18:04:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.134 2019/10/20 14:25:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -239,12 +239,14 @@ cpu_attach(device_t dv, cpuid_t id)
 	vfp_attach(ci);		/* XXX SMP */
 }
 
+#ifdef MULTIPROCESSOR
 bool
 cpu_hatched_p(u_int cpuindex)
 {
 	membar_consumer();
 	return (arm_cpu_hatched & __BIT(cpuindex)) != 0;
 }
+#endif
 
 enum cpu_class {
 	CPU_CLASS_NONE,



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

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 14:25:14 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arm/arm32/cpu.c

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



CVS commit: src/sys/arch/aarch64/aarch64

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 14:03:51 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c locore.S

Log Message:
Use separate cacheline aligned arrays for mbox and hatched as before.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/aarch64/aarch64/locore.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.24 src/sys/arch/aarch64/aarch64/cpu.c:1.25
--- src/sys/arch/aarch64/aarch64/cpu.c:1.24	Sun Oct 20 11:17:41 2019
+++ src/sys/arch/aarch64/aarch64/cpu.c	Sun Oct 20 14:03:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.24 2019/10/20 11:17:41 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.25 2019/10/20 14:03:51 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.24 2019/10/20 11:17:41 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.25 2019/10/20 14:03:51 jmcneill Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -69,9 +69,8 @@ static void cpu_setup_sysctl(device_t, s
 #ifdef MULTIPROCESSOR
 uint64_t cpu_mpidr[MAXCPUS];
 
-volatile u_int aarch64_cpu_mbox[MAXCPUS] __cacheline_aligned = { 0 };
-#define CPU_MBOX_HATCHED	__BIT(0)
-#define	CPU_MBOX_START		__BIT(1)
+volatile u_int aarch64_cpu_mbox[howmany(MAXCPUS, sizeof(u_int))] __cacheline_aligned = { 0 };
+volatile u_int aarch64_cpu_hatched[howmany(MAXCPUS, sizeof(u_int))] __cacheline_aligned = { 0 };
 u_int arm_cpu_max = 1;
 
 static kmutex_t cpu_hatch_lock;
@@ -500,7 +499,7 @@ cpu_setup_sysctl(device_t dv, struct cpu
 void
 cpu_boot_secondary_processors(void)
 {
-	u_int cpuno;
+	u_int n, bit;
 
 	if ((boothowto & RB_MD1) != 0)
 		return;
@@ -510,22 +509,20 @@ cpu_boot_secondary_processors(void)
 	VPRINTF("%s: starting secondary processors\n", __func__);
 
 	/* send mbox to have secondary processors do cpu_hatch() */
-	for (cpuno = 1; cpuno < ncpu; cpuno++) {
-		if (cpu_hatched_p(cpuno) == false)
-			continue;
-		atomic_or_uint(_cpu_mbox[cpuno], CPU_MBOX_START);
-	}
+	for (n = 0; n < __arraycount(aarch64_cpu_mbox); n++)
+		atomic_or_uint(_cpu_mbox[n], aarch64_cpu_hatched[n]);
 	__asm __volatile ("sev; sev; sev");
 
 	/* wait all cpus have done cpu_hatch() */
-	for (cpuno = 1; cpuno < ncpu; cpuno++) {
-		if (cpu_hatched_p(cpuno) == 0)
-			continue;
-		while (membar_consumer(), aarch64_cpu_mbox[cpuno] & CPU_MBOX_START) {
+	for (n = 0; n < __arraycount(aarch64_cpu_mbox); n++) {
+		while (membar_consumer(), aarch64_cpu_mbox[n] & aarch64_cpu_hatched[n]) {
 			__asm __volatile ("wfe");
 		}
-		/* Add processor to kcpuset */
-		kcpuset_set(kcpuset_attached, cpuno);
+		/* Add processors to kcpuset */
+		for (bit = 0; bit < 32; bit++) {
+			if (aarch64_cpu_hatched[n] & __BIT(bit))
+kcpuset_set(kcpuset_attached, n * 32 + bit);
+		}
 	}
 
 	VPRINTF("%s: secondary processors hatched\n", __func__);
@@ -563,15 +560,18 @@ cpu_hatch(struct cpu_info *ci)
 	 * ci_index are each cpu0=0, cpu1=1, cpu2=undef, cpu3=2.
 	 * therefore we have to use device_unit instead of ci_index for mbox.
 	 */
-	const u_int cpuno = device_unit(ci->ci_dev);
-	atomic_and_uint(_cpu_mbox[cpuno], ~(u_int)CPU_MBOX_START);
+	const u_int off = device_unit(ci->ci_dev) / 32;
+	const u_int bit = device_unit(ci->ci_dev) % 32;
+	atomic_and_uint(_cpu_mbox[off], ~__BIT(bit));
 	__asm __volatile ("sev; sev; sev");
 }
 
 bool
 cpu_hatched_p(u_int cpuindex)
 {
-	aarch64_dcache_inv_range((vaddr_t)_cpu_mbox[cpuindex], 4);
-	return (aarch64_cpu_mbox[cpuindex] & CPU_MBOX_HATCHED) != 0;
+	const u_int off = cpuindex / 32;
+	const u_int bit = cpuindex % 32;
+	membar_consumer();
+	return (aarch64_cpu_hatched[off] & __BIT(bit)) != 0;
 }
 #endif /* MULTIPROCESSOR */

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.43 src/sys/arch/aarch64/aarch64/locore.S:1.44
--- src/sys/arch/aarch64/aarch64/locore.S:1.43	Sun Oct 20 12:25:43 2019
+++ src/sys/arch/aarch64/aarch64/locore.S	Sun Oct 20 14:03:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.43 2019/10/20 12:25:43 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.44 2019/10/20 14:03:51 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.43 2019/10/20 12:25:43 skrll Exp $")
+RCSID("$NetBSD: locore.S,v 1.44 2019/10/20 14:03:51 jmcneill Exp $")
 
 
 /*#define DEBUG_LOCORE			/* debug print */
@@ -361,19 +361,16 @@ ENTRY_NP(cpu_mpstart)
 	mov	x1, xzr
 1:
 	add	x1, x1, #1
-	cmp	x1, MAXCPUS		/* cpuindex >= MAXCPUS ? */
+	cmp	x1, #MAXCPUS		/* cpuindex >= MAXCPUS ? */
 	bge	toomanycpus
 	ldr	x2, [x0, x1, lsl #3]	/* cpu_mpidr[cpuindex] */
 	cmp	x2, x3			/* == mpidr_el1 & MPIDR_AFF ? */
 	bne	1b
 
 	mov	x27, x1			/* x27 = cpuindex */
-	ADDR	x0, 

CVS commit: src/sys/arch/aarch64/aarch64

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 14:03:51 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c locore.S

Log Message:
Use separate cacheline aligned arrays for mbox and hatched as before.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/aarch64/aarch64/locore.S

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



CVS commit: src/sys/arch/aarch64/aarch64

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 12:25:43 UTC 2019

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

Log Message:
Avoid overlap between BP and last AP stack. AP stacks are now in order of
increasing address order.

Spotted by and idea from mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/aarch64/aarch64/locore.S

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



CVS commit: src/sys/arch/aarch64/aarch64

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 12:25:43 UTC 2019

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

Log Message:
Avoid overlap between BP and last AP stack. AP stacks are now in order of
increasing address order.

Spotted by and idea from mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/aarch64/aarch64/locore.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.42 src/sys/arch/aarch64/aarch64/locore.S:1.43
--- src/sys/arch/aarch64/aarch64/locore.S:1.42	Sat Oct 19 18:04:26 2019
+++ src/sys/arch/aarch64/aarch64/locore.S	Sun Oct 20 12:25:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.42 2019/10/19 18:04:26 jmcneill Exp $	*/
+/*	$NetBSD: locore.S,v 1.43 2019/10/20 12:25:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.42 2019/10/19 18:04:26 jmcneill Exp $")
+RCSID("$NetBSD: locore.S,v 1.43 2019/10/20 12:25:43 skrll Exp $")
 
 
 /*#define DEBUG_LOCORE			/* debug print */
@@ -379,9 +379,8 @@ ENTRY_NP(cpu_mpstart)
 	/* set stack pointer for boot */
 	mov	x1, #BOOT_AP_STACKSIZE
 	mul	x1, x1, x27
-	ADDR	x0, bootstk_cpus
-	sub	sp, x0, x1  /* sp = bootstk_cpus-(BOOT_AP_STACKSIZE*cpuindex) */
-
+	ADDR	x0, bootstk
+	add	sp, x0, x1  /* sp = bootstk + (BOOT_AP_STACKSIZE * cpuindex) */
 
 	bl	1f
 1:	CPU_DPRINTREG("PC   = ", lr)
@@ -1038,7 +1037,6 @@ bootstk:
 
 #ifdef MULTIPROCESSOR
 	.space	BOOT_AP_STACKSIZE * (MAXCPUS - 1)
-bootstk_cpus:
 #endif
 
 	.section ".init_pagetable", "aw", %nobits



CVS commit: src/sys/arch/aarch64/aarch64

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 11:17:42 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c

Log Message:
Invalidate dcache before polling AP hatched status


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/aarch64/aarch64/cpu.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/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.23 src/sys/arch/aarch64/aarch64/cpu.c:1.24
--- src/sys/arch/aarch64/aarch64/cpu.c:1.23	Sat Oct 19 18:04:26 2019
+++ src/sys/arch/aarch64/aarch64/cpu.c	Sun Oct 20 11:17:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.23 2019/10/19 18:04:26 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.24 2019/10/20 11:17:41 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.23 2019/10/19 18:04:26 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.24 2019/10/20 11:17:41 jmcneill Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -571,7 +571,7 @@ cpu_hatch(struct cpu_info *ci)
 bool
 cpu_hatched_p(u_int cpuindex)
 {
-	membar_consumer();
+	aarch64_dcache_inv_range((vaddr_t)_cpu_mbox[cpuindex], 4);
 	return (aarch64_cpu_mbox[cpuindex] & CPU_MBOX_HATCHED) != 0;
 }
 #endif /* MULTIPROCESSOR */



CVS commit: src/sys/arch/aarch64/aarch64

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 11:17:42 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c

Log Message:
Invalidate dcache before polling AP hatched status


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/aarch64/aarch64/cpu.c

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



CVS commit: src/usr.sbin/gpioctl

2019-10-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 20 09:41:53 UTC 2019

Modified Files:
src/usr.sbin/gpioctl: gpioctl.8 gpioctl.c

Log Message:
gpioctl: implement support for "gpioctl gpioN list". Like pcictl(8).

For drivers that name their pins, this can be used to determine how the
logical pins are mapped to physical pins. Example from sunxigpio(4):

# gpioctl gpio0 list
0: PA0
1: PA1
2: PA2
...


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/gpioctl/gpioctl.8
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/gpioctl/gpioctl.c

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

Modified files:

Index: src/usr.sbin/gpioctl/gpioctl.8
diff -u src/usr.sbin/gpioctl/gpioctl.8:1.22 src/usr.sbin/gpioctl/gpioctl.8:1.23
--- src/usr.sbin/gpioctl/gpioctl.8:1.22	Wed Feb 13 11:40:41 2019
+++ src/usr.sbin/gpioctl/gpioctl.8	Sun Oct 20 09:41:53 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpioctl.8,v 1.22 2019/02/13 11:40:41 wiz Exp $
+.\" $NetBSD: gpioctl.8,v 1.23 2019/10/20 09:41:53 tnn Exp $
 .\"
 .\" Copyright (c) 2009, 2010, 2011, 2013 Marc Balmer 
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd February 12, 2019
+.Dd October 20, 2019
 .Dt GPIOCTL 8
 .Os
 .Sh NAME
@@ -55,6 +55,10 @@
 .Ar device
 .Ar pin
 .Cm unset
+.Nm gpioctl
+.Op Fl q
+.Ar device
+.Ar list
 .Sh DESCRIPTION
 The
 .Nm
@@ -203,6 +207,10 @@ Configure pin 5 as output and name it er
 Toggle the error_led:
 .Pp
 .Dl # gpioctl gpio0 error_led 2
+.Pp
+Enumerate all pins and display their symbolic names:
+.Pp
+.Dl # gpioctl gpio0 list
 .Sh SEE ALSO
 .Xr gpio 4 ,
 .Xr drvctl 8

Index: src/usr.sbin/gpioctl/gpioctl.c
diff -u src/usr.sbin/gpioctl/gpioctl.c:1.26 src/usr.sbin/gpioctl/gpioctl.c:1.27
--- src/usr.sbin/gpioctl/gpioctl.c:1.26	Sun Jan 27 02:08:51 2019
+++ src/usr.sbin/gpioctl/gpioctl.c	Sun Oct 20 09:41:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioctl.c,v 1.26 2019/01/27 02:08:51 pgoyette Exp $ */
+/* $NetBSD: gpioctl.c,v 1.27 2019/10/20 09:41:53 tnn Exp $ */
 
 /*
  * Copyright (c) 2008, 2010, 2011, 2013 Marc Balmer 
@@ -17,7 +17,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include 
-__RCSID("$NetBSD: gpioctl.c,v 1.26 2019/01/27 02:08:51 pgoyette Exp $");
+__RCSID("$NetBSD: gpioctl.c,v 1.27 2019/10/20 09:41:53 tnn Exp $");
 
 /*
  * Program to control GPIO devices.
@@ -48,6 +48,7 @@ static void gpioread(int, char *);
 static void gpiowrite(int, char *, int);
 static void gpioset(int pin, char *name, int flags, char *alias);
 static void gpiounset(int pin, char *name);
+static void gpiolist(void);
 static void devattach(char *, int, uint32_t, uint32_t);
 __dead static void usage(void);
 
@@ -160,6 +161,9 @@ main(int argc, char *argv[])
 		}
 		devattach(driver, ga_offset, ga_mask, ga_flags);
 		return EXIT_SUCCESS;
+	} else if (!strcmp(argv[1], "list")) {
+		gpiolist();
+		return EXIT_SUCCESS;
 	} else {
 		char *nm = NULL;
 
@@ -345,6 +349,26 @@ gpiounset(int pin, char *name)
 }
 
 static void
+gpiolist()
+{
+	struct gpio_info info;
+	struct gpio_req req;
+	int i;
+
+	if (ioctl(devfd, GPIOINFO, ) == -1)
+		err(EXIT_FAILURE, "GPIOINFO");
+
+	for (i = 0; i < info.gpio_npins; i++) {
+		memset(, 0, sizeof(req));
+		req.gp_pin = i;
+		if (ioctl(devfd, GPIOREAD, ) == -1)
+			err(EXIT_FAILURE, "GPIOREAD");
+		if (!quiet)
+			printf("%d: %s\n", i, req.gp_name);
+	}
+}
+
+static void
 devattach(char *dvname, int offset, uint32_t mask, uint32_t flags)
 {
 	struct gpio_attach attach;
@@ -372,6 +396,7 @@ usage(void)
 	fprintf(stderr, "   %s [-q] device attach device offset mask "
 	"[flag]\n",
 	progname);
+	fprintf(stderr, "   %s [-q] device list\n", progname);
 
 	exit(EXIT_FAILURE);
 }



CVS commit: src/usr.sbin/gpioctl

2019-10-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 20 09:41:53 UTC 2019

Modified Files:
src/usr.sbin/gpioctl: gpioctl.8 gpioctl.c

Log Message:
gpioctl: implement support for "gpioctl gpioN list". Like pcictl(8).

For drivers that name their pins, this can be used to determine how the
logical pins are mapped to physical pins. Example from sunxigpio(4):

# gpioctl gpio0 list
0: PA0
1: PA1
2: PA2
...


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/gpioctl/gpioctl.8
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/gpioctl/gpioctl.c

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



CVS commit: src/sys/dev/gpio

2019-10-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 20 09:35:18 UTC 2019

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

Log Message:
gpio: make GPIOREAD return also the symbolic name of the pin, if it is set


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/gpio/gpio.c

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



CVS commit: src/sys/dev/gpio

2019-10-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Oct 20 09:35:18 UTC 2019

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

Log Message:
gpio: make GPIOREAD return also the symbolic name of the pin, if it is set


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/gpio/gpio.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/gpio/gpio.c
diff -u src/sys/dev/gpio/gpio.c:1.63 src/sys/dev/gpio/gpio.c:1.64
--- src/sys/dev/gpio/gpio.c:1.63	Tue Oct 15 00:13:53 2019
+++ src/sys/dev/gpio/gpio.c	Sun Oct 20 09:35:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.63 2019/10/15 00:13:53 chs Exp $ */
+/* $NetBSD: gpio.c,v 1.64 2019/10/20 09:35:18 tnn Exp $ */
 /*	$OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.63 2019/10/15 00:13:53 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.64 2019/10/20 09:35:18 tnn Exp $");
 
 /*
  * General Purpose Input/Output framework.
@@ -722,9 +722,8 @@ gpio_ioctl(struct gpio_softc *sc, u_long
 		req = data;
 
 		if (req->gp_name[0] != '\0')
-			pin = gpio_pinbyname(sc, req->gp_name);
-		else
-			pin = req->gp_pin;
+			req->gp_pin = gpio_pinbyname(sc, req->gp_name);
+		pin = req->gp_pin;
 
 		if (pin < 0 || pin >= sc->sc_npins)
 			return EINVAL;
@@ -736,6 +735,11 @@ gpio_ioctl(struct gpio_softc *sc, u_long
 
 		/* return read value */
 		req->gp_value = gpiobus_pin_read(gc, pin);
+		LIST_FOREACH(nm, >sc_names, gp_next)
+			if (nm->gp_pin == pin) {
+strlcpy(req->gp_name, nm->gp_name, GPIOMAXNAME);
+break;
+			}
 		break;
 	case GPIOWRITE:
 		if ((flag & FWRITE) == 0)



CVS commit: src/sys

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 08:29:38 UTC 2019

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c
src/sys/uvm/pmap: pmap.c vmpagemd.h

Log Message:
Define and use VM_PAGEMD_PVLIST_EMPTY_P


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/mips/pmap_machdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/vmpagemd.h

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



CVS commit: src/sys

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 08:29:38 UTC 2019

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c
src/sys/uvm/pmap: pmap.c vmpagemd.h

Log Message:
Define and use VM_PAGEMD_PVLIST_EMPTY_P


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/mips/pmap_machdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/vmpagemd.h

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

Modified files:

Index: src/sys/arch/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.25 src/sys/arch/mips/mips/pmap_machdep.c:1.26
--- src/sys/arch/mips/mips/pmap_machdep.c:1.25	Thu Aug 15 12:24:08 2019
+++ src/sys/arch/mips/mips/pmap_machdep.c	Sun Oct 20 08:29:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.25 2019/08/15 12:24:08 maxv Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.26 2019/10/20 08:29:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.25 2019/08/15 12:24:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.26 2019/10/20 08:29:38 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -643,7 +643,7 @@ pmap_copy_page(paddr_t src_pa, paddr_t d
 	const register_t src_va = pmap_md_map_ephemeral_page(src_pg, false,
 	VM_PROT_READ, _pte);
 
-	KASSERT(VM_PAGE_TO_MD(dst_pg)->mdpg_first.pv_pmap == NULL);
+	KASSERT(VM_PAGEMD_PVLIST_EMPTY_P(VM_PAGE_TO_MD(dst_pg)));
 	KASSERT(!VM_PAGEMD_EXECPAGE_P(VM_PAGE_TO_MD(dst_pg)));
 	const register_t dst_va = pmap_md_map_ephemeral_page(dst_pg, false,
 	VM_PROT_READ|VM_PROT_WRITE, _pte);

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.43 src/sys/uvm/pmap/pmap.c:1.44
--- src/sys/uvm/pmap/pmap.c:1.43	Sun Oct 20 07:18:22 2019
+++ src/sys/uvm/pmap/pmap.c	Sun Oct 20 08:29:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.43 2019/10/20 07:18:22 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.44 2019/10/20 08:29:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.43 2019/10/20 07:18:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.44 2019/10/20 08:29:38 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1045,7 +1045,7 @@ pmap_pte_protect(pmap_t pmap, vaddr_t sv
 		if (pg != NULL && pte_modified_p(pte)) {
 			struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
 			if (VM_PAGEMD_EXECPAGE_P(mdpg)) {
-KASSERT(mdpg->mdpg_first.pv_pmap != NULL);
+KASSERT(!VM_PAGEMD_PVLIST_EMPTY_P(mdpg));
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
 if (VM_PAGEMD_CACHED_P(mdpg)) {
 #endif

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.14 src/sys/uvm/pmap/vmpagemd.h:1.15
--- src/sys/uvm/pmap/vmpagemd.h:1.14	Sun Oct 20 07:58:21 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Sun Oct 20 08:29:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.14 2019/10/20 07:58:21 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.15 2019/10/20 08:29:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -107,6 +107,8 @@ struct vm_page_md {
 #define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)	pmap_pvlist_locked_p(mdpg)
 #define	VM_PAGEMD_PVLIST_GEN(mdpg)	((mdpg)->mdpg_attrs >> 16)
 
+#define	VM_PAGEMD_PVLIST_EMPTY_P(mdpg)	((mdpg)->mdpg_first.pv_pmap == NULL)
+
 #ifdef _KERNEL
 #if defined(MULTIPROCESSOR) || defined(MODULAR)
 kmutex_t *pmap_pvlist_lock_addr(struct vm_page_md *);



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:58:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/vmpagemd.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/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.13 src/sys/uvm/pmap/vmpagemd.h:1.14
--- src/sys/uvm/pmap/vmpagemd.h:1.13	Sun Oct 20 07:54:29 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Sun Oct 20 07:58:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.13 2019/10/20 07:54:29 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.14 2019/10/20 07:58:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -101,11 +101,11 @@ struct vm_page_md {
 #define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg)	__nothing
 #endif /* MULTIPROCESSOR || MODULAR */
 
-#define	VM_PAGEMD_PVLIST_LOCK(mdpg)		pmap_pvlist_lock(mdpg, 1)
-#define	VM_PAGEMD_PVLIST_READLOCK(mdpg)		pmap_pvlist_lock(mdpg, 0)
-#define	VM_PAGEMD_PVLIST_UNLOCK(mdpg)		pmap_pvlist_unlock(mdpg)
-#define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)		pmap_pvlist_locked_p(mdpg)
-#define	VM_PAGEMD_PVLIST_GEN(mdpg)		((mdpg)->mdpg_attrs >> 16)
+#define	VM_PAGEMD_PVLIST_LOCK(mdpg)	pmap_pvlist_lock(mdpg, 1)
+#define	VM_PAGEMD_PVLIST_READLOCK(mdpg)	pmap_pvlist_lock(mdpg, 0)
+#define	VM_PAGEMD_PVLIST_UNLOCK(mdpg)	pmap_pvlist_unlock(mdpg)
+#define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)	pmap_pvlist_locked_p(mdpg)
+#define	VM_PAGEMD_PVLIST_GEN(mdpg)	((mdpg)->mdpg_attrs >> 16)
 
 #ifdef _KERNEL
 #if defined(MULTIPROCESSOR) || defined(MODULAR)



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:58:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/vmpagemd.h

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



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:54:30 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Re-order _P() macros to match bit definitions.  NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/vmpagemd.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/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.12 src/sys/uvm/pmap/vmpagemd.h:1.13
--- src/sys/uvm/pmap/vmpagemd.h:1.12	Fri Jul 12 10:39:12 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Sun Oct 20 07:54:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.12 2019/07/12 10:39:12 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.13 2019/10/20 07:54:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -75,14 +75,14 @@ typedef struct pv_entry {
 #define	VM_PAGEMD_UNCACHED	__BIT(4)	/* page is mapped uncached */
 #endif
 
+#define	VM_PAGEMD_REFERENCED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_REFERENCED) != 0)
+#define	VM_PAGEMD_MODIFIED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_MODIFIED) != 0)
+#define	VM_PAGEMD_POOLPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_POOLPAGE) != 0)
+#define	VM_PAGEMD_EXECPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_EXECPAGE) != 0)
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
 #define	VM_PAGEMD_CACHED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_UNCACHED) == 0)
 #define	VM_PAGEMD_UNCACHED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_UNCACHED) != 0)
 #endif
-#define	VM_PAGEMD_MODIFIED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_MODIFIED) != 0)
-#define	VM_PAGEMD_REFERENCED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_REFERENCED) != 0)
-#define	VM_PAGEMD_POOLPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_POOLPAGE) != 0)
-#define	VM_PAGEMD_EXECPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_EXECPAGE) != 0)
 
 #endif /* !_MODULE */
 



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:54:30 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Re-order _P() macros to match bit definitions.  NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/vmpagemd.h

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



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:22:51 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap_segtab.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/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.10 src/sys/uvm/pmap/pmap_segtab.c:1.11
--- src/sys/uvm/pmap/pmap_segtab.c:1.10	Mon Sep 23 18:20:07 2019
+++ src/sys/uvm/pmap/pmap_segtab.c	Sun Oct 20 07:22:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.10 2019/09/23 18:20:07 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.11 2019/10/20 07:22:51 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.10 2019/09/23 18:20:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.11 2019/10/20 07:22:51 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -139,10 +139,10 @@ pmap_check_stp(pmap_segtab_t *stp, const
 #ifdef DEBUG_NOISY
 			for (size_t j = i; j < PMAP_SEGTABSIZE; j++)
 printf("%s: pm_segtab.seg_tab[%zu] = 0x%p\n",
-   caller, j, stp->seg_tab[j]);
+caller, j, stp->seg_tab[j]);
 #endif
 			panic("%s: pm_segtab.seg_tab[%zu] != 0 (0x%p): %s",
-			  caller, i, stp->seg_tab[i], why);
+			caller, i, stp->seg_tab[i], why);
 		}
 	}
 #endif



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:22:51 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap_segtab.c

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



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:18:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Remove KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg)) - can only assert that it
is owned


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/pmap/pmap.c

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

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.42 src/sys/uvm/pmap/pmap.c:1.43
--- src/sys/uvm/pmap/pmap.c:1.42	Fri Jul 12 10:39:12 2019
+++ src/sys/uvm/pmap/pmap.c	Sun Oct 20 07:18:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.42 2019/07/12 10:39:12 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.43 2019/10/20 07:18:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.42 2019/07/12 10:39:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.43 2019/10/20 07:18:22 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1655,7 +1655,6 @@ pmap_clear_modify(struct vm_page *pg)
 	 * flush the VAC first if there is one.
 	 */
 	kpreempt_disable();
-	KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg));
 	VM_PAGEMD_PVLIST_READLOCK(mdpg);
 	pmap_pvlist_check(mdpg);
 	for (; pv != NULL; pv = pv_next) {



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:18:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Remove KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg)) - can only assert that it
is owned


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/pmap/pmap.c

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