CVS commit: xsrc/external/mit/xorg-server.old/dist/Xext

2019-10-27 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Mon Oct 28 03:20:13 UTC 2019

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xext: xtest.c

Log Message:
use asprintf() to avoid strncpy warning (as the newer version does)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/Xext/xtest.c

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



CVS commit: src/doc

2019-10-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 28 03:01:55 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
Note vio9p(4) addition and mount_9p(8) update


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2603 src/doc/CHANGES:1.2604
--- src/doc/CHANGES:1.2603	Thu Oct 24 19:28:47 2019
+++ src/doc/CHANGES	Mon Oct 28 03:01:55 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2603 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2604 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -57,3 +57,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	bind: Import version 9.14.7. [christos 20191017]
 	libc: Changed the iconv(3) function signature to the POSIX variation
 		[kamil 20191024]
+	vio9p(4): Add virtio-9p front-end driver. [ozaki-r 20191028]
+	mount_9p(8): Enable to mount a filesystem exported via virtio-9p.
+		[ozaki-r 20191028]



CVS commit: src/doc

2019-10-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 28 03:01:55 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
Note vio9p(4) addition and mount_9p(8) update


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

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



CVS commit: src/usr.sbin/puffs/mount_9p

2019-10-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 28 02:59:25 UTC 2019

Modified Files:
src/usr.sbin/puffs/mount_9p: mount_9p.8 ninebuf.c ninepuffs.c
ninepuffs.h

Log Message:
mount_9p: enable to communicate with vio9p via its character device file

With this feature, we can mount an exported filesystem by a VM host via
virtio-9p.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/puffs/mount_9p/mount_9p.8
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/puffs/mount_9p/ninebuf.c
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_9p/ninepuffs.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/puffs/mount_9p/ninepuffs.h

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/mount_9p.8
diff -u src/usr.sbin/puffs/mount_9p/mount_9p.8:1.10 src/usr.sbin/puffs/mount_9p/mount_9p.8:1.11
--- src/usr.sbin/puffs/mount_9p/mount_9p.8:1.10	Fri Jun  7 05:34:34 2019
+++ src/usr.sbin/puffs/mount_9p/mount_9p.8	Mon Oct 28 02:59:25 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount_9p.8,v 1.10 2019/06/07 05:34:34 ozaki-r Exp $
+.\"	$NetBSD: mount_9p.8,v 1.11 2019/10/28 02:59:25 ozaki-r Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 7, 2019
+.Dd October 24, 2019
 .Dt MOUNT_9P 8
 .Os
 .Sh NAME
@@ -36,6 +36,12 @@
 .Op Fl p Ar port
 .Ar [user@]host[:path]
 .Ar mount_point
+.Nm
+.Fl c
+.Op Fl su
+.Op Fl o Ar mntopts
+.Ar devfile
+.Ar mount_point
 .Sh DESCRIPTION
 The
 .Nm
@@ -52,6 +58,18 @@ is supplied, it is used as the mount roo
 .Ar path
 must be an absolute path.
 .Pp
+The
+.Fl c
+opiton enables to mount a filesystem exported by a VM host through
+a character device file
+.Ar devfile
+backed by the
+.Xr vio9p 4
+driver.
+See
+.Xr vio9p 4
+for more information.
+.Pp
 By default
 .Nm
 runs in the background with
@@ -74,7 +92,8 @@ environments.
 .Sh SEE ALSO
 .Xr puffs 3 ,
 .Xr puffs 4 ,
-.Xr mount 8
+.Xr mount 8 ,
+.Xr vio9p 4
 .Rs
 .%T RFC and standards documents relating the 9P protocol
 .%U http://ericvh.github.io/9p-rfc/
@@ -87,6 +106,11 @@ utility first appeared in
 .Pp
 Experimental 9P2000.u support appeared in
 .Nx 9.0 .
+.Pp
+The
+.Fl c
+option appeared in
+.Nx 10.0 .
 .Sh CAVEATS
 Permissions are not handled well.
 .Pp

Index: src/usr.sbin/puffs/mount_9p/ninebuf.c
diff -u src/usr.sbin/puffs/mount_9p/ninebuf.c:1.8 src/usr.sbin/puffs/mount_9p/ninebuf.c:1.9
--- src/usr.sbin/puffs/mount_9p/ninebuf.c:1.8	Sun Nov  4 22:38:19 2012
+++ src/usr.sbin/puffs/mount_9p/ninebuf.c	Mon Oct 28 02:59:25 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: ninebuf.c,v 1.8 2012/11/04 22:38:19 christos Exp $	*/
+/*  $NetBSD: ninebuf.c,v 1.9 2019/10/28 02:59:25 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ninebuf.c,v 1.8 2012/11/04 22:38:19 christos Exp $");
+__RCSID("$NetBSD: ninebuf.c,v 1.9 2019/10/28 02:59:25 ozaki-r Exp $");
 #endif /* !lint */
 
 #include 
@@ -138,7 +138,7 @@ p9pbuf_write(struct puffs_usermount *pu,
 		winlen = howmuch;
 		if (puffs_framebuf_getwindow(pb, CUROFF(pb), , )==-1)
 			return errno;
-		n = send(fd, win, winlen, MSG_NOSIGNAL);
+		n = write(fd, win, winlen);
 		switch (n) {
 		case 0:
 			return ECONNRESET;

Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c
diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.26 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.27
--- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.26	Mon May 20 08:55:31 2019
+++ src/usr.sbin/puffs/mount_9p/ninepuffs.c	Mon Oct 28 02:59:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ninepuffs.c,v 1.26 2019/05/20 08:55:31 ozaki-r Exp $	*/
+/*	$NetBSD: ninepuffs.c,v 1.27 2019/10/28 02:59:25 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ninepuffs.c,v 1.26 2019/05/20 08:55:31 ozaki-r Exp $");
+__RCSID("$NetBSD: ninepuffs.c,v 1.27 2019/10/28 02:59:25 ozaki-r Exp $");
 #endif /* !lint */
 
 #include 
@@ -60,6 +60,8 @@ usage(void)
 
 	fprintf(stderr, "usage: %s [-su] [-o mntopts] [-p port] "
 	"[user@]server[:path] mountpoint\n", getprogname());
+	fprintf(stderr, "   %s -c [-su] [-o mntopts] devfile mountpoint\n",
+	getprogname());
 	exit(1);
 }
 
@@ -72,7 +74,7 @@ serverconnect(const char *addr, unsigned
 {
 	struct sockaddr_in mysin;
 	struct hostent *he;
-	int s;
+	int s, ret, opt;
 
 	he = gethostbyname2(addr, AF_INET);
 	if (he == NULL) {
@@ -84,6 +86,11 @@ serverconnect(const char *addr, unsigned
 	if (s == -1)
 		err(1, "socket");
 
+	opt = 1;
+	ret = setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, , sizeof(opt));
+	if (ret == -1)
+		err(1, "setsockopt(SO_NOSIGPIPE)");
+
 	memset(, 0, sizeof(struct sockaddr_in));
 	mysin.sin_family = AF_INET;
 	mysin.sin_port = htons(port);
@@ -95,6 

CVS commit: src/usr.sbin/puffs/mount_9p

2019-10-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 28 02:59:25 UTC 2019

Modified Files:
src/usr.sbin/puffs/mount_9p: mount_9p.8 ninebuf.c ninepuffs.c
ninepuffs.h

Log Message:
mount_9p: enable to communicate with vio9p via its character device file

With this feature, we can mount an exported filesystem by a VM host via
virtio-9p.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/puffs/mount_9p/mount_9p.8
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/puffs/mount_9p/ninebuf.c
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_9p/ninepuffs.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/puffs/mount_9p/ninepuffs.h

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



CVS commit: [netbsd-9] src/doc

2019-10-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 28 02:58:09 UTC 2019

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

Log Message:
 Ticket #380 and #382.


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.87 src/doc/CHANGES-9.0:1.1.2.88
--- src/doc/CHANGES-9.0:1.1.2.87	Fri Oct 25 16:02:11 2019
+++ src/doc/CHANGES-9.0	Mon Oct 28 02:58:09 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.87 2019/10/25 16:02:11 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.88 2019/10/28 02:58:09 msaitoh Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -5287,3 +5287,22 @@ sys/arch/evbarm/conf/mk.beagle			1.13
 	BEAGLE* kernel expects NetBSD bootargs (command line, no FDT).
 	[mlelstv, ticket #381]
 
+usr.sbin/sysinst/part_edit.c			1.8
+
+	When we fail to setup for "all of the disk for NetBSD" report failure,
+	instead of silently aborting the install.
+	[martin, ticket #380]
+
+usr.sbin/sysinst/bsddisklabel.c			1.29
+usr.sbin/sysinst/disks.c			1.54
+usr.sbin/sysinst/part_edit.c			1.9-1.10
+usr.sbin/sysinst/partitions.c			1.3-1.4
+usr.sbin/sysinst/partitions.h			1.7
+
+	- Honor the "no_mbr" flag (used especially for raid and xbd devices).
+	- On device where we do not want a MBR (raid, xbd) skip the MBR
+	  partitioning scheme when trying to read partitions from disk.
+	  The generic reader will fall back to disklabel then.
+	- In non-MBR specific files, #ifdef all tests for MBR for architectures
+	  that do not even compile in MBR support.
+	[martin, ticket #382]



CVS commit: src

2019-10-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 28 02:56:41 UTC 2019

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile
src/sys/conf: majors
src/sys/dev/pci: files.virtio
src/sys/modules: Makefile
Added Files:
src/share/man/man4: vio9p.4
src/sys/dev/pci: vio9p.c
src/sys/modules/vio9p: Makefile vio9p.ioconf

Log Message:
Implement a front-end driver of virtio-9p called vio9p

In conjunction with mount_9p, it enables a NetBSD system running as a VM guest
to mount an exported filesystem by the host via virtio-9p.  It exports a 9p
end-point of virtio-9p via a character device file for mount_9p.

Reviewed by yamaguchi@


To generate a diff of this commit:
cvs rdiff -u -r1.1658 -r1.1659 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.685 -r1.686 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/vio9p.4
cvs rdiff -u -r1.89 -r1.90 src/sys/conf/majors
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/files.virtio
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/vio9p.c
cvs rdiff -u -r1.227 -r1.228 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/vio9p/Makefile \
src/sys/modules/vio9p/vio9p.ioconf

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1658 src/distrib/sets/lists/man/mi:1.1659
--- src/distrib/sets/lists/man/mi:1.1658	Fri Oct 25 17:39:56 2019
+++ src/distrib/sets/lists/man/mi	Mon Oct 28 02:56:40 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1658 2019/10/25 17:39:56 martin Exp $
+# $NetBSD: mi,v 1.1659 2019/10/28 02:56:40 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1990,6 +1990,7 @@
 ./usr/share/man/cat4/viapm.0			man-obsolete		obsolete
 ./usr/share/man/cat4/video.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vinum.0			man-obsolete		obsolete
+./usr/share/man/cat4/vio9p.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vioif.0			man-sys-catman		.cat
 ./usr/share/man/cat4/viomb.0			man-sys-catman		.cat
 ./usr/share/man/cat4/viornd.0			man-sys-catman		.cat
@@ -5085,6 +5086,7 @@
 ./usr/share/man/html4/viaenv.html		man-sys-htmlman		html
 ./usr/share/man/html4/viaide.html		man-sys-htmlman		html
 ./usr/share/man/html4/video.html		man-sys-htmlman		html
+./usr/share/man/html4/vio9p.html		man-sys-htmlman		html
 ./usr/share/man/html4/vioif.html		man-sys-htmlman		html
 ./usr/share/man/html4/viomb.html		man-sys-htmlman		html
 ./usr/share/man/html4/viornd.html		man-sys-htmlman		html
@@ -8112,6 +8114,7 @@
 ./usr/share/man/man4/viapm.4			man-obsolete		obsolete
 ./usr/share/man/man4/video.4			man-sys-man		.man
 ./usr/share/man/man4/vinum.4			man-obsolete		obsolete
+./usr/share/man/man4/vio9p.4			man-sys-man		.man
 ./usr/share/man/man4/vioif.4			man-sys-man		.man
 ./usr/share/man/man4/viomb.4			man-sys-man		.man
 ./usr/share/man/man4/viornd.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.685 src/share/man/man4/Makefile:1.686
--- src/share/man/man4/Makefile:1.685	Fri Oct 25 17:39:57 2019
+++ src/share/man/man4/Makefile	Mon Oct 28 02:56:40 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.685 2019/10/25 17:39:57 martin Exp $
+#	$NetBSD: Makefile,v 1.686 2019/10/28 02:56:40 ozaki-r Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -66,9 +66,9 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	trm.4 tsllux.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \
 	uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 umb.4 \
 	unix.4 userconf.4 \
-	vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 vioif.4 viomb.4 \
-	viornd.4 vioscsi.4 virt.4 \
-	virtio.4 vlan.4 vmmon.4 vmnet.4 vnd.4 voodoofb.4 vr.4 vte.4 \
+	vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 \
+	vio9p.4 vioif.4 viomb.4 viornd.4 vioscsi.4 virt.4 virtio.4 \
+	vlan.4 vmmon.4 vmnet.4 vnd.4 voodoofb.4 vr.4 vte.4 \
 	wapbl.4 wb.4 wbsio.4 wd.4 wdc.4 wi.4 wm.4 wpi.4 \
 	wsbell.4 wscons.4 wsdisplay.4 wsfont.4 wskbd.4 wsmouse.4 wsmux.4 \
 	xbox.4 xge.4 \

Index: src/sys/conf/majors
diff -u src/sys/conf/majors:1.89 src/sys/conf/majors:1.90
--- src/sys/conf/majors:1.89	Sun Sep 15 11:45:47 2019
+++ src/sys/conf/majors	Mon Oct 28 02:56:40 2019
@@ -1,4 +1,4 @@
-# $NetBSD: majors,v 1.89 2019/09/15 11:45:47 maxv Exp $
+# $NetBSD: majors,v 1.90 2019/10/28 02:56:40 ozaki-r Exp $
 #
 # Device majors for Machine-Independent drivers.
 #
@@ -87,3 +87,4 @@ device-major spi   char 347		   spi
 # Major 353 is reserved for external/cddl/osnet/dev/sdt/sdt.c
 device-major ipmi  char 354		   ipmi
 device-major vhci  char 355vhci
+device-major vio9p char 356		   vio9p

Index: src/sys/dev/pci/files.virtio
diff -u src/sys/dev/pci/files.virtio:1.1 src/sys/dev/pci/files.virtio:1.2
--- src/sys/dev/pci/files.virtio:1.1	Wed Aug  2 08:39:14 2017
+++ 

CVS commit: [netbsd-9] src/usr.sbin/sysinst

2019-10-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 28 02:53:17 UTC 2019

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: bsddisklabel.c disks.c part_edit.c
partitions.c partitions.h

Log Message:
Pull up following revision(s) (requested by martin in ticket #382):
usr.sbin/sysinst/part_edit.c: revision 1.10
usr.sbin/sysinst/part_edit.c: revision 1.9
usr.sbin/sysinst/partitions.c: revision 1.3
usr.sbin/sysinst/partitions.c: revision 1.4
usr.sbin/sysinst/partitions.h: revision 1.7
usr.sbin/sysinst/bsddisklabel.c: revision 1.29
usr.sbin/sysinst/disks.c: revision 1.54
Honor the "no_mbr" flag (used especially for raid and xbd devices)
On device where we do not want a MBR (raid, xbd) skip the MBR partitioning
scheme when trying to read partitions from disk. The generic reader will
fall back to disklabel then.
In non-MBR specific files, #ifdef all tests for MBR for architectures
that do not even compile in MBR support.


To generate a diff of this commit:
cvs rdiff -u -r1.23.2.4 -r1.23.2.5 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.44.2.9 -r1.44.2.10 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/usr.sbin/sysinst/part_edit.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/sysinst/partitions.c
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/usr.sbin/sysinst/partitions.h

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.4 src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.5
--- src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.4	Wed Oct 23 06:04:44 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c	Mon Oct 28 02:53:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.23.2.4 2019/10/23 06:04:44 msaitoh Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.23.2.5 2019/10/28 02:53:17 msaitoh Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1341,7 +1341,7 @@ make_bsd_partitions(struct install_parti
 		return true;
 
 	if (parts == NULL) {
-		pscheme = select_part_scheme(pm, NULL, true, NULL);
+		pscheme = select_part_scheme(pm, NULL, !pm->no_mbr, NULL);
 		if (pscheme == NULL)
 			return false;
 		parts = pscheme->create_new_for_disk(pm->diskdev,

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.44.2.9 src/usr.sbin/sysinst/disks.c:1.44.2.10
--- src/usr.sbin/sysinst/disks.c:1.44.2.9	Wed Oct 23 06:30:16 2019
+++ src/usr.sbin/sysinst/disks.c	Mon Oct 28 02:53:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.44.2.9 2019/10/23 06:30:16 msaitoh Exp $ */
+/*	$NetBSD: disks.c,v 1.44.2.10 2019/10/28 02:53:17 msaitoh Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -901,7 +901,8 @@ find_disks(const char *doingwhat, bool a
 		pm_i->parts =
 		partitions_read_disk(
 		pm_i->diskdev,
-		disk->dd_totsec);
+		disk->dd_totsec,
+		disk->dd_no_mbr);
 	}
 }
 continue;
@@ -929,7 +930,8 @@ find_disks(const char *doingwhat, bool a
 			pm->dlsize = disk->dd_cyl * disk->dd_head
 			* disk->dd_sec;
 
-		pm->parts = partitions_read_disk(pm->diskdev, disk->dd_totsec);
+		pm->parts = partitions_read_disk(pm->diskdev,
+		disk->dd_totsec, disk->dd_no_mbr);
 
 again:
 
@@ -1443,7 +1445,7 @@ find_part_by_name(const char *name, stru
 			if (strcmp(disks[n].dd_name, pm->diskdev) == 0)
 continue;
 			ps = partitions_read_disk(disks[n].dd_name,
-			disks[n].dd_totsec);
+			disks[n].dd_totsec, disks[n].dd_no_mbr);
 			if (ps == NULL)
 continue;
 			if (ps->pscheme->find_by_name == NULL)

Index: src/usr.sbin/sysinst/part_edit.c
diff -u src/usr.sbin/sysinst/part_edit.c:1.7.2.1 src/usr.sbin/sysinst/part_edit.c:1.7.2.2
--- src/usr.sbin/sysinst/part_edit.c:1.7.2.1	Mon Oct 28 02:49:12 2019
+++ src/usr.sbin/sysinst/part_edit.c	Mon Oct 28 02:53:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: part_edit.c,v 1.7.2.1 2019/10/28 02:49:12 msaitoh Exp $ */
+/*	$NetBSD: part_edit.c,v 1.7.2.2 2019/10/28 02:53:17 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -1218,6 +1218,10 @@ select_part_scheme(
 		if (bootable && p->have_boot_support != NULL &&
 		!p->have_boot_support(dev->diskdev))
 			continue;
+#ifdef HAVE_MBR
+		if (dev->no_mbr && p->name == MSG_parttype_mbr)
+			continue;
+#endif
 		if (p->size_limit && dev->dlsize > p->size_limit) {
 			char buf[255], hum_lim[5];
 

Index: src/usr.sbin/sysinst/partitions.c
diff -u src/usr.sbin/sysinst/partitions.c:1.1.2.1 src/usr.sbin/sysinst/partitions.c:1.1.2.2
--- src/usr.sbin/sysinst/partitions.c:1.1.2.1	Sun Aug 18 13:21:40 2019
+++ src/usr.sbin/sysinst/partitions.c	Mon Oct 28 02:53:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: partitions.c,v 1.1.2.1 2019/08/18 13:21:40 msaitoh Exp $	*/
+/*	$NetBSD: partitions.c,v 1.1.2.2 2019/10/28 02:53:17 msaitoh Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ 

CVS commit: src/etc

2019-10-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 28 02:53:29 UTC 2019

Modified Files:
src/etc: MAKEDEV.awk

Log Message:
Allow including numbers in %XXX_chr% parameter (for upcoming vio9p driver)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/etc/MAKEDEV.awk

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

Modified files:

Index: src/etc/MAKEDEV.awk
diff -u src/etc/MAKEDEV.awk:1.26 src/etc/MAKEDEV.awk:1.27
--- src/etc/MAKEDEV.awk:1.26	Thu Jun 13 20:54:04 2019
+++ src/etc/MAKEDEV.awk	Mon Oct 28 02:53:29 2019
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -
 #
-#	$NetBSD: MAKEDEV.awk,v 1.26 2019/06/13 20:54:04 christos Exp $
+#	$NetBSD: MAKEDEV.awk,v 1.27 2019/10/28 02:53:29 ozaki-r Exp $
 #
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -214,7 +214,7 @@ BEGIN {
 	print "# Generated from:"
 
 	# MAKEDEV.awk (this script) RCS Id
-	ARCSID = "$NetBSD: MAKEDEV.awk,v 1.26 2019/06/13 20:54:04 christos Exp $"
+	ARCSID = "$NetBSD: MAKEDEV.awk,v 1.27 2019/10/28 02:53:29 ozaki-r Exp $"
 	gsub(/\$/, "", ARCSID)
 	print "#	" ARCSID
 	
@@ -305,7 +305,7 @@ BEGIN {
 		# or block device definition remains within the entry,
 		# print it to output, otherwise scrap it.
 		parsed = ""
-		while (match(deventry, /%[a-z]*_(blk|chr)%/)) {
+		while (match(deventry, /%[a-z0-9]*_(blk|chr)%/)) {
 			nam = substr(deventry, RSTART + 1, RLENGTH - 6);
 			typ = substr(deventry, RSTART + RLENGTH - 4, 3);
 			if (typ == "blk") {



CVS commit: [netbsd-9] src/usr.sbin/sysinst

2019-10-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 28 02:53:17 UTC 2019

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: bsddisklabel.c disks.c part_edit.c
partitions.c partitions.h

Log Message:
Pull up following revision(s) (requested by martin in ticket #382):
usr.sbin/sysinst/part_edit.c: revision 1.10
usr.sbin/sysinst/part_edit.c: revision 1.9
usr.sbin/sysinst/partitions.c: revision 1.3
usr.sbin/sysinst/partitions.c: revision 1.4
usr.sbin/sysinst/partitions.h: revision 1.7
usr.sbin/sysinst/bsddisklabel.c: revision 1.29
usr.sbin/sysinst/disks.c: revision 1.54
Honor the "no_mbr" flag (used especially for raid and xbd devices)
On device where we do not want a MBR (raid, xbd) skip the MBR partitioning
scheme when trying to read partitions from disk. The generic reader will
fall back to disklabel then.
In non-MBR specific files, #ifdef all tests for MBR for architectures
that do not even compile in MBR support.


To generate a diff of this commit:
cvs rdiff -u -r1.23.2.4 -r1.23.2.5 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.44.2.9 -r1.44.2.10 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/usr.sbin/sysinst/part_edit.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/sysinst/partitions.c
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/usr.sbin/sysinst/partitions.h

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



CVS commit: [netbsd-9] src/usr.sbin/sysinst

2019-10-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 28 02:49:12 UTC 2019

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: part_edit.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #380):
usr.sbin/sysinst/part_edit.c: revision 1.8
When we fail to setup for "all of the disk for NetBSD" report
failure, instead of silently aborting the install.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.sbin/sysinst/part_edit.c

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



CVS commit: [netbsd-9] src/usr.sbin/sysinst

2019-10-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 28 02:49:12 UTC 2019

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: part_edit.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #380):
usr.sbin/sysinst/part_edit.c: revision 1.8
When we fail to setup for "all of the disk for NetBSD" report
failure, instead of silently aborting the install.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.sbin/sysinst/part_edit.c

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

Modified files:

Index: src/usr.sbin/sysinst/part_edit.c
diff -u src/usr.sbin/sysinst/part_edit.c:1.7 src/usr.sbin/sysinst/part_edit.c:1.7.2.1
--- src/usr.sbin/sysinst/part_edit.c:1.7	Fri Jul 12 18:25:08 2019
+++ src/usr.sbin/sysinst/part_edit.c	Mon Oct 28 02:49:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: part_edit.c,v 1.7 2019/07/12 18:25:08 martin Exp $ */
+/*	$NetBSD: part_edit.c,v 1.7.2.1 2019/10/28 02:49:12 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -1152,8 +1152,10 @@ edit_outer_parts(struct disk_partitions 
 return false;
 			}
 		}
-		if (!md_parts_use_wholedisk(parts))
+		if (!md_parts_use_wholedisk(parts)) {
+			hit_enter_to_continue(MSG_No_free_space, NULL);
 			return false;
+		}
 		if (parts->pscheme->post_edit_verify) {
 			return
 			parts->pscheme->post_edit_verify(parts, true) == 2;



CVS commit: src/games/fortune/datfiles

2019-10-27 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Oct 27 23:31:15 UTC 2019

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Chris' happiest moment
http://bbc.co.uk/programmes/b09b1zbb


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.83 src/games/fortune/datfiles/fortunes:1.84
--- src/games/fortune/datfiles/fortunes:1.83	Thu Aug 22 22:51:47 2019
+++ src/games/fortune/datfiles/fortunes	Sun Oct 27 23:31:15 2019
@@ -16273,3 +16273,9 @@ you derive from that?
 		   December 9th, 1968
 %
 They made me do it
+%
+It was the first thing that I formed a really powerful bond with.
+It was some sort of mental love missile and I just lit the touch paper and
+fired myself into it, at oblivious speed, and it exploded, and sparkled and it
+was totally beautiful.
+		-- Chris Packham and the kestrel



CVS commit: src/games/fortune/datfiles

2019-10-27 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Oct 27 23:31:15 UTC 2019

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Chris' happiest moment
http://bbc.co.uk/programmes/b09b1zbb


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/games/fortune/datfiles/fortunes

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/ti

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

Modified Files:
src/sys/arch/arm/ti: if_cpsw.c

Log Message:
Get mac address from DT


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ti/if_cpsw.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/ti/if_cpsw.c
diff -u src/sys/arch/arm/ti/if_cpsw.c:1.6 src/sys/arch/arm/ti/if_cpsw.c:1.7
--- src/sys/arch/arm/ti/if_cpsw.c:1.6	Wed May 29 06:17:27 2019
+++ src/sys/arch/arm/ti/if_cpsw.c	Sun Oct 27 23:25:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cpsw.c,v 1.6 2019/05/29 06:17:27 msaitoh Exp $	*/
+/*	$NetBSD: if_cpsw.c,v 1.7 2019/10/27 23:25:38 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6 2019/05/29 06:17:27 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.7 2019/10/27 23:25:38 jmcneill Exp $");
 
 #include 
 #include 
@@ -398,14 +398,14 @@ cpsw_attach(device_t parent, device_t se
 {
 	struct fdt_attach_args * const faa = aux;
 	struct cpsw_softc * const sc = device_private(self);
-	prop_dictionary_t dict = device_properties(self);
 	struct ethercom * const ec = >sc_ec;
 	struct ifnet * const ifp = >ec_if;
 	struct mii_data * const mii = >sc_mii;
 	const int phandle = faa->faa_phandle;
+	const uint8_t *macaddr;
 	bus_addr_t addr;
 	bus_size_t size;
-	int error;
+	int error, slave, len;
 	u_int i;
 
 	KERNHIST_INIT(cpswhist, 4096);
@@ -423,8 +423,14 @@ cpsw_attach(device_t parent, device_t se
 	callout_init(>sc_tick_ch, 0);
 	callout_setfunc(>sc_tick_ch, cpsw_tick, sc);
 
-	prop_data_t eaprop = prop_dictionary_get(dict, "mac-address");
-	if (eaprop == NULL) {
+	macaddr = NULL;
+	slave = of_find_firstchild_byname(phandle, "slave");
+	if (slave > 0) {
+		macaddr = fdtbus_get_prop(slave, "mac-address", );
+		if (len != ETHER_ADDR_LEN)
+			macaddr = NULL;
+	}
+	if (macaddr == NULL) {
 #if 0
 		/* grab mac_id0 from AM335x control module */
 		uint32_t reg_lo, reg_hi;
@@ -461,10 +467,7 @@ cpsw_attach(device_t parent, device_t se
 #endif
 		}
 	} else {
-		KASSERT(prop_object_type(eaprop) == PROP_TYPE_DATA);
-		KASSERT(prop_data_size(eaprop) == ETHER_ADDR_LEN);
-		memcpy(sc->sc_enaddr, prop_data_data_nocopy(eaprop),
-		ETHER_ADDR_LEN);
+		memcpy(sc->sc_enaddr, macaddr, ETHER_ADDR_LEN);
 	}
 
 #if 0



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

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

Modified Files:
src/sys/arch/arm/ti: if_cpsw.c

Log Message:
Get mac address from DT


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ti/if_cpsw.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/sdmmc

2019-10-27 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Oct 27 21:39:50 UTC 2019

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

Log Message:
white space police.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/sdmmc/if_bwfm_sdio.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/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.6 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.7
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.6	Wed Sep 25 16:21:14 2019
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Sun Oct 27 21:39:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.6 2019/09/25 16:21:14 mlelstv Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.7 2019/10/27 21:39:50 bad Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -171,9 +171,9 @@ voidbwfm_sdio_rx_frames(stru
 voidbwfm_sdio_rx_glom(struct bwfm_sdio_softc *,
 		uint16_t *, int, uint16_t *);
 
-#ifdef BWFM_DEBUG 
+#ifdef BWFM_DEBUG
 void		bwfm_sdio_debug_console(struct bwfm_sdio_softc *);
-#endif 
+#endif
 
 struct bwfm_bus_ops bwfm_sdio_bus_ops = {
 	.bs_init = NULL,
@@ -203,22 +203,22 @@ static const struct bwfm_sdio_product {
 } bwfm_sdio_products[] = {
 	{
 		SDMMC_VENDOR_BROADCOM,
-		SDMMC_PRODUCT_BROADCOM_BCM4330, 
+		SDMMC_PRODUCT_BROADCOM_BCM4330,
 		SDMMC_CIS_BROADCOM_BCM4330
 	},
 	{
 		SDMMC_VENDOR_BROADCOM,
-		SDMMC_PRODUCT_BROADCOM_BCM4334, 
+		SDMMC_PRODUCT_BROADCOM_BCM4334,
 		SDMMC_CIS_BROADCOM_BCM4334
 	},
 	{
 		SDMMC_VENDOR_BROADCOM,
-		SDMMC_PRODUCT_BROADCOM_BCM43143, 
+		SDMMC_PRODUCT_BROADCOM_BCM43143,
 		SDMMC_CIS_BROADCOM_BCM43143
 	},
 	{
 		SDMMC_VENDOR_BROADCOM,
-		SDMMC_PRODUCT_BROADCOM_BCM43430, 
+		SDMMC_PRODUCT_BROADCOM_BCM43430,
 		SDMMC_CIS_BROADCOM_BCM43430
 	},
 };
@@ -296,14 +296,14 @@ bwfm_sdio_attach(device_t parent, device
 	sdmmc_io_set_blocklen(sc->sc_sf[1]->sc, sc->sc_sf[1], 64);
 	sdmmc_io_set_blocklen(sc->sc_sf[2]->sc, sc->sc_sf[2], 512);
 
-/* Enable Function 1. */
-if (sdmmc_io_function_enable(sc->sc_sf[1]) != 0) {
-printf("%s: cannot enable function 1\n", DEVNAME(sc));
-return;
-}
+	/* Enable Function 1. */
+	if (sdmmc_io_function_enable(sc->sc_sf[1]) != 0) {
+		printf("%s: cannot enable function 1\n", DEVNAME(sc));
+		return;
+	}
 
-DPRINTF(("%s: F1 signature read @0x1800=%x\n", DEVNAME(sc),
-bwfm_sdio_read_4(sc, 0x1800)));
+	DPRINTF(("%s: F1 signature read @0x1800=%x\n", DEVNAME(sc),
+	bwfm_sdio_read_4(sc, 0x1800)));
 
 	/* Force PLL off */
 	bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_CHIPCLKCSR,
@@ -486,8 +486,8 @@ bwfm_sdio_attachhook(device_t self)
 	bwfm_sdio_dev_write(sc, SDPCMD_TOSBMAILBOXDATA,
 	SDPCM_PROT_VERSION << SDPCM_PROT_VERSION_SHIFT);
 	if (sdmmc_io_function_enable(sc->sc_sf[2])) {
-printf("%s: cannot enable function 2\n", DEVNAME(sc));
-goto err;
+		printf("%s: cannot enable function 2\n", DEVNAME(sc));
+		goto err;
 	}
 
 	bwfm_sdio_dev_write(sc, SDPCMD_HOSTINTMASK,
@@ -1264,7 +1264,7 @@ bwfm_sdio_intr(void *v)
 {
 	struct bwfm_sdio_softc *sc = (void *)v;
 
-DPRINTF(("%s: sdio_intr\n", DEVNAME(sc)));
+	DPRINTF(("%s: sdio_intr\n", DEVNAME(sc)));
 
 	mutex_enter(>sc_intr_lock);
 	if (!sdmmc_task_pending(>sc_task))
@@ -1312,7 +1312,7 @@ bwfm_sdio_task1(struct bwfm_sdio_softc *
 	}
 
 	intstat = bwfm_sdio_dev_read(sc, BWFM_SDPCMD_INTSTATUS);
-DPRINTF(("%s: intstat 0x%" PRIx32 "\n", DEVNAME(sc), intstat));
+	DPRINTF(("%s: intstat 0x%" PRIx32 "\n", DEVNAME(sc), intstat));
 	intstat &= (SDPCMD_INTSTATUS_HMB_SW_MASK|SDPCMD_INTSTATUS_CHIPACTIVE);
 	/* XXX fc state */
 	if (intstat)
@@ -1320,7 +1320,7 @@ bwfm_sdio_task1(struct bwfm_sdio_softc *
 
 	if (intstat & SDPCMD_INTSTATUS_HMB_HOST_INT) {
 		hostint = bwfm_sdio_dev_read(sc, SDPCMD_TOHOSTMAILBOXDATA);
-	DPRINTF(("%s: hostint 0x%" PRIx32 "\n", DEVNAME(sc), hostint));
+		DPRINTF(("%s: hostint 0x%" PRIx32 "\n", DEVNAME(sc), hostint));
 		bwfm_sdio_dev_write(sc, SDPCMD_TOSBMAILBOX,
 		SDPCMD_TOSBMAILBOX_INT_ACK);
 		if (hostint & SDPCMD_TOHOSTMAILBOXDATA_NAKHANDLED)
@@ -1345,7 +1345,7 @@ bwfm_sdio_tx_ok(struct bwfm_sdio_softc *
 	((uint8_t)(sc->sc_tx_max_seq - sc->sc_tx_seq) & 0x80) == 0;
 }
 
-void
+void
 bwfm_sdio_tx_frames(struct bwfm_sdio_softc *sc)
 {
 	struct mbuf *m;
@@ -1365,7 +1365,7 @@ bwfm_sdio_tx_frames(struct bwfm_sdio_sof
 		if (m->m_type == MT_CONTROL)
 			bwfm_sdio_tx_ctrlframe(sc, m);
 		else {
-			bwfm_sdio_tx_dataframe(sc, m);  
+			bwfm_sdio_tx_dataframe(sc, m);
 			ifp->if_opackets++;
 			ifstart = true;
 		}
@@ -1385,7 +1385,7 @@ bwfm_sdio_tx_ctrlframe(struct bwfm_sdio_
 	struct bwfm_sdio_hwhdr *hwhdr;
 	struct bwfm_sdio_swhdr *swhdr;
 	size_t len, roundto;
-	
+
 	len = sizeof(*hwhdr) + sizeof(*swhdr) + m->m_len;
 
 	/* Zero-pad to 

CVS commit: src/sys/dev/sdmmc

2019-10-27 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Oct 27 21:39:50 UTC 2019

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

Log Message:
white space police.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/sdmmc/if_bwfm_sdio.c

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



CVS commit: src/distrib/utils/embedded

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 21:38:58 UTC 2019

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf
src/distrib/utils/embedded/files: armv7_boot.cmd

Log Message:
Switch to GENERIC kernels only.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/distrib/utils/embedded/conf/armv7.conf
cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/files/armv7_boot.cmd

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



CVS commit: src/distrib/utils/embedded

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 21:38:58 UTC 2019

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf
src/distrib/utils/embedded/files: armv7_boot.cmd

Log Message:
Switch to GENERIC kernels only.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/distrib/utils/embedded/conf/armv7.conf
cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/files/armv7_boot.cmd

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.35 src/distrib/utils/embedded/conf/armv7.conf:1.36
--- src/distrib/utils/embedded/conf/armv7.conf:1.35	Sun Jul 21 16:05:24 2019
+++ src/distrib/utils/embedded/conf/armv7.conf	Sun Oct 27 21:38:58 2019
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.35 2019/07/21 16:05:24 rin Exp $
+# $NetBSD: armv7.conf,v 1.36 2019/10/27 21:38:58 jmcneill Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -7,10 +7,7 @@ resize=true
 
 . ${DIR}/conf/evbarm.conf
 
-# altera, exynos, sunxi, tegra
 kernels_generic="GENERIC"
-# non-FDTised / special kernels
-kernels_beagle="BEAGLEBOARD BEAGLEBONE"
 
 make_label() {
 	make_label_evbarm
@@ -50,10 +47,6 @@ populate_common() {
 	"${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/armv7 boot" "${mnt}/boot/boot.cmd" "${mnt}/boot/boot.scr"
 }
 
-populate_beagle() {
-	:
-}
-
 populate_rpi() {
 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
 	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
@@ -105,10 +98,6 @@ EOF
 	>> "$tmp/selected_sets"
 }
 
-populate_altera() {
-	:
-}
-
 populate_amlogic() {
 	odroidc1_kernelimg=netbsd-GENERIC.ub
 
@@ -122,19 +111,11 @@ run bootcmd
 EOF
 }
 
-populate_sunxi() {
-	:
-}
-
-populate_tegra() {
-	:
-}
-
 populate() {
 	echo "${bar} looking for kernels in ${kernel} ${bar}"
 	kernels=""
 	# .ub kernels
-	for k in $kernels_generic $kernels_beagle; do
+	for k in $kernels_generic; do
 		f="${kernel}/netbsd-${k}.ub.gz"
 		test -f "${f}" && kernels="${kernels} ${f}"
 	done
@@ -170,12 +151,8 @@ populate() {
 	done
 
 	# board specific configuration
-	populate_altera
 	populate_amlogic
-	populate_beagle
 	populate_rpi
-	populate_sunxi
-	populate_tegra
 
 	# common configuration
 	populate_common

Index: src/distrib/utils/embedded/files/armv7_boot.cmd
diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.14 src/distrib/utils/embedded/files/armv7_boot.cmd:1.15
--- src/distrib/utils/embedded/files/armv7_boot.cmd:1.14	Thu Apr  4 14:26:39 2019
+++ src/distrib/utils/embedded/files/armv7_boot.cmd	Sun Oct 27 21:38:58 2019
@@ -1,21 +1,8 @@
-if test "${board}" = "am335x" ; then
-	setenv kernel netbsd-BEAGLEBONE.ub
-	setenv mmcpart 0:1
-	setenv bootargs root=ld0a
-else
-	setenv use_efi 1
-fi
-
 if test "${soc}" = "tegra210" ; then
 	# enable PCIe
 	pci enum
 fi
 
-if test "${use_efi}" = "1" ; then
-	setenv boot_scripts
-	setenv boot_script_dhcp
-	run distro_bootcmd
-else
-	fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel}
-	bootm ${kernel_addr_r} ${bootargs}
-fi
+setenv boot_scripts
+setenv boot_script_dhcp
+run distro_bootcmd



CVS commit: src/distrib/utils/embedded/files

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 21:35:02 UTC 2019

Modified Files:
src/distrib/utils/embedded/files: armv7_boot_nonefi.cmd

Log Message:
No support for tegra210 in armv7 kernel


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd

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

Modified files:

Index: src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd
diff -u src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.1 src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.2
--- src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.1	Sun Jul 21 16:05:24 2019
+++ src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd	Sun Oct 27 21:35:02 2019
@@ -33,15 +33,6 @@ if test "${soc}" = "tegra124" ; then
 	setenv mmcpart 1:1
 	setenv use_fdt 1
 fi
-if test "${soc}" = "tegra210" ; then
-	setenv kernel netbsd.ub
-	setenv bootargs root=wd0a
-	setenv mmcpart 1:1
-	setenv use_fdt 1
-	setenv fdtfile ${soc}-${board}.dtb
-	# enable PCIe
-	pci enum
-fi
 
 if test "${kernel}" = "" ; then
 	echo '>>>'



CVS commit: src/distrib/utils/embedded/files

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 21:35:02 UTC 2019

Modified Files:
src/distrib/utils/embedded/files: armv7_boot_nonefi.cmd

Log Message:
No support for tegra210 in armv7 kernel


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd

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



CVS commit: src/sys/arch/alpha/include

2019-10-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 27 21:27:10 UTC 2019

Modified Files:
src/sys/arch/alpha/include: fenv.h

Log Message:
elide gcc-8 shadow warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/include/fenv.h

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



CVS commit: src/sys/arch/alpha/include

2019-10-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 27 21:27:10 UTC 2019

Modified Files:
src/sys/arch/alpha/include: fenv.h

Log Message:
elide gcc-8 shadow warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/include/fenv.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/alpha/include/fenv.h
diff -u src/sys/arch/alpha/include/fenv.h:1.2 src/sys/arch/alpha/include/fenv.h:1.3
--- src/sys/arch/alpha/include/fenv.h:1.2	Wed Aug 24 02:22:20 2016
+++ src/sys/arch/alpha/include/fenv.h	Sun Oct 27 17:27:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.2 2016/08/24 06:22:20 christos Exp $	*/
+/*	$NetBSD: fenv.h,v 1.3 2019/10/27 21:27:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004-2005 David Schultz 
@@ -72,6 +72,11 @@ __BEGIN_DECLS
 extern const fenv_t	__fe_dfl_env;
 #define	FE_DFL_ENV	(&__fe_dfl_env)
 
+#if __GNUC_PREREQ__(8, 0)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
 static __inline int
 feclearexcept(int __excepts)
 {
@@ -169,6 +174,10 @@ fesetround(int __round)
 	return 0;
 }
 
+#if __GNUC_PREREQ__(8, 0)
+#pragma GCC diagnostic pop
+#endif
+
 int	fegetenv(fenv_t *);
 int	feholdexcept(fenv_t *);
 int	fesetenv(const fenv_t *);



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 21:26:04 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_platform.c

Log Message:
Fix early putchar, add reset func


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/ti/ti_platform.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/ti/ti_platform.c
diff -u src/sys/arch/arm/ti/ti_platform.c:1.8 src/sys/arch/arm/ti/ti_platform.c:1.9
--- src/sys/arch/arm/ti/ti_platform.c:1.8	Sun Oct 27 17:58:42 2019
+++ src/sys/arch/arm/ti/ti_platform.c	Sun Oct 27 21:26:04 2019
@@ -1,9 +1,9 @@
-/* $NetBSD: ti_platform.c,v 1.8 2019/10/27 17:58:42 jmcneill Exp $ */
+/* $NetBSD: ti_platform.c,v 1.9 2019/10/27 21:26:04 jmcneill Exp $ */
 
 #include "opt_console.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_platform.c,v 1.8 2019/10/27 17:58:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_platform.c,v 1.9 2019/10/27 21:26:04 jmcneill Exp $");
 
 #include 
 
@@ -26,7 +26,7 @@ void
 am33xx_platform_early_putchar(char c)
 {
 #ifdef CONSADDR
-#define CONSADDR_VA ((CONSADDR - 0x44c0) + 0xe4c0)
+#define CONSADDR_VA ((CONSADDR - 0x44c0) + (KERNEL_IO_VBASE | 0x04c0))
 	volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ?
 	(volatile uint32_t *)CONSADDR_VA :
 	(volatile uint32_t *)CONSADDR;
@@ -130,12 +130,21 @@ am33xx_platform_delay(u_int n)
 	}
 }
 
+static void
+am33xx_platform_reset(void)
+{
+	volatile uint32_t *resetaddr = (volatile uint32_t *)(KERNEL_IO_VBASE | 0x04e00f00);
+
+	*resetaddr = 1;
+}
+
 static const struct arm_platform am33xx_platform = {
 	.ap_devmap = am33xx_platform_devmap,
 	.ap_init_attach_args = am33xx_platform_init_attach_args,
 	.ap_bootstrap = am33xx_platform_bootstrap,
 	.ap_uart_freq = am33xx_platform_uart_freq,
 	.ap_delay = am33xx_platform_delay,
+	.ap_reset = am33xx_platform_reset,
 };
 
 ARM_PLATFORM(am33xx, "ti,am33xx", _platform);



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 21:26:04 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_platform.c

Log Message:
Fix early putchar, add reset func


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/ti/ti_platform.c

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



CVS commit: src/external/gpl3/gcc/usr.bin/gcc/arch/alpha

2019-10-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 27 21:07:37 UTC 2019

Modified Files:
src/external/gpl3/gcc/usr.bin/gcc/arch/alpha: defs.mk

Log Message:
remove build output.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk

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



CVS commit: src/external/gpl3/gcc/usr.bin/gcc/arch/alpha

2019-10-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 27 21:07:37 UTC 2019

Modified Files:
src/external/gpl3/gcc/usr.bin/gcc/arch/alpha: defs.mk

Log Message:
remove build output.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk
diff -u src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk:1.16 src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk:1.17
--- src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk:1.16	Wed Oct  2 03:15:01 2019
+++ src/external/gpl3/gcc/usr.bin/gcc/arch/alpha/defs.mk	Sun Oct 27 17:07:37 2019
@@ -1,854 +1,7 @@
 # This file is automatically generated.  DO NOT EDIT!
-# Generated from: NetBSD: mknative-gcc,v 1.101 2019/02/23 06:54:45 mrg Exp 
+# Generated from: NetBSD: mknative-gcc,v 1.103 2019/10/24 03:19:14 christos Exp 
 # Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp 
 #
-running CONFIG_SHELL=/bin/sh /bin/sh /usr/src/external/gpl3/gcc/dist/gcc/configure --srcdir=/usr/src/tools/gcc/../../external/gpl3/gcc/dist/gcc --cache-file=./config.cache --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/support/send-pr.html --with-pkgversion=NetBSD nb1 20190930 --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/alpha/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/alpha/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/alpha/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/alpha --enable-tls --disable-multilib --disable-libstdcxx-pch --with-sysroot=/var/obj/mknative/alpha/usr
 /src/destdir.alpha --enable-languages=c,c++,lto,objc --program-transform-name=s,y,y, --disable-option-checking --build=x86_64-unknown-netbsd9.0 --host=alpha--netbsd --target=alpha--netbsd build_alias=x86_64-unknown-netbsd9.0 host_alias=alpha--netbsd target_alias=alpha--netbsd CC=/var/obj/mknative/alpha/usr/src/tooldir.NetBSD-9.0_BETA-amd64/bin/alpha--netbsd-gcc --sysroot=/var/obj/mknative/alpha/usr/src/destdir.alpha -L/var/obj/mknative/alpha/usr/src/destdir.alpha/lib -L/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/lib -B/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/lib/ -I/var/obj/mknative/alpha/usr/src/tools/gcc/.native/gcc/include CFLAGS= LDFLAGS=-static-libstdc++ -static-libgcc  CPPFLAGS= CXX=/var/obj/mknative/alpha/usr/src/tooldir.NetBSD-9.0_BETA-amd64/bin/alpha--netbsd-c++ --sysroot=/var/obj/mknative/alpha/usr/src/destdir.alpha -L/var/obj/mknative/alpha/usr/src/destdir.alpha/lib -L/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/lib -B/var/obj/mknative/alpha/usr/src/de
 stdir.alpha/usr/lib/ -I/var/obj/mknative/alpha/usr/src/tools/gcc/.native/gcc/include --sysroot=/var/obj/mknative/alpha/usr/src/destdir.alpha CXXFLAGS= CPP=/var/obj/mknative/alpha/usr/src/tooldir.NetBSD-9.0_BETA-amd64/bin/alpha--netbsd-cpp -I/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/include -I/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/include/g++/bits GMPLIBS=-L/var/obj/mknative/alpha/usr/src/external/lgpl3/gmp/lib/libgmp -L/var/obj/mknative/alpha/usr/src/external/lgpl3/mpfr/lib/libmpfr -L/var/obj/mknative/alpha/usr/src/external/lgpl3/mpc/lib/libmpc -lmpc -lmpfr -lgmp GMPINC=-I/usr/src/external/lgpl3/gmp/lib/libgmp/arch/alpha -I/usr/src/external/lgpl3/mpfr/dist/src -I/usr/src/external/lgpl3/mpc/dist/src  ISLLIBS= ISLINC= --no-create --no-recursion
-configure: loading cache ./config.cache
-checking build system type... (cached) x86_64-unknown-netbsd9.0
-checking host system type... (cached) alpha--netbsd
-checking target system type... (cached) alpha--netbsd
-checking LIBRARY_PATH variable... ok
-checking GCC_EXEC_PREFIX variable... ok
-checking whether to place generated files in the source directory... no
-checking whether a default linker was specified... no
-checking whether a default assembler was specified... no
-checking for alpha--netbsd-gcc... (cached) /var/obj/mknative/alpha/usr/src/tooldir.NetBSD-9.0_BETA-amd64/bin/alpha--netbsd-gcc --sysroot=/var/obj/mknative/alpha/usr/src/destdir.alpha -L/var/obj/mknative/alpha/usr/src/destdir.alpha/lib -L/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/lib -B/var/obj/mknative/alpha/usr/src/destdir.alpha/usr/lib/ -I/var/obj/mknative/alpha/usr/src/tools/gcc/.native/gcc/include
-checking for C compiler default output file name... a.out
-checking whether the C compiler works... yes
-checking whether we are cross compiling... yes
-checking for suffix of executables... 
-checking for 

CVS commit: src

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 20:17:36 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm.c nvmm.h
src/sys/dev/nvmm: nvmm.c

Log Message:
Change the way root_owner works: consider the calling process as root_owner
not if it has root privileges, but if the /dev/nvmm device was opened with
write permissions. Introduce the undocumented nvmm_root_init() function to
achieve that.

The goal is to simplify the logic and have more granularity, eg if we want
a monitoring agent to access VMs but don't want to give this agent real
root access on the system.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libnvmm/libnvmm.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/nvmm/nvmm.c

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



CVS commit: src

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 20:17:36 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm.c nvmm.h
src/sys/dev/nvmm: nvmm.c

Log Message:
Change the way root_owner works: consider the calling process as root_owner
not if it has root privileges, but if the /dev/nvmm device was opened with
write permissions. Introduce the undocumented nvmm_root_init() function to
achieve that.

The goal is to simplify the logic and have more granularity, eg if we want
a monitoring agent to access VMs but don't want to give this agent real
root access on the system.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libnvmm/libnvmm.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/nvmm/nvmm.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/libnvmm/libnvmm.c
diff -u src/lib/libnvmm/libnvmm.c:1.17 src/lib/libnvmm/libnvmm.c:1.18
--- src/lib/libnvmm/libnvmm.c:1.17	Sun Oct 27 07:08:15 2019
+++ src/lib/libnvmm/libnvmm.c	Sun Oct 27 20:17:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm.c,v 1.17 2019/10/27 07:08:15 maxv Exp $	*/
+/*	$NetBSD: libnvmm.c,v 1.18 2019/10/27 20:17:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -180,6 +180,29 @@ nvmm_init(void)
 }
 
 int
+nvmm_root_init(void)
+{
+	if (nvmm_fd != -1)
+		return 0;
+	nvmm_fd = open("/dev/nvmm", O_WRONLY | O_CLOEXEC);
+	if (nvmm_fd == -1)
+		return -1;
+	if (nvmm_capability(&__capability) == -1) {
+		close(nvmm_fd);
+		nvmm_fd = -1;
+		return -1;
+	}
+	if (__capability.version != NVMM_KERN_VERSION) {
+		close(nvmm_fd);
+		nvmm_fd = -1;
+		errno = EPROGMISMATCH;
+		return -1;
+	}
+
+	return 0;
+}
+
+int
 nvmm_capability(struct nvmm_capability *cap)
 {
 	struct nvmm_ioc_capability args;

Index: src/lib/libnvmm/nvmm.h
diff -u src/lib/libnvmm/nvmm.h:1.15 src/lib/libnvmm/nvmm.h:1.16
--- src/lib/libnvmm/nvmm.h:1.15	Sun Oct 27 07:08:15 2019
+++ src/lib/libnvmm/nvmm.h	Sun Oct 27 20:17:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.h,v 1.15 2019/10/27 07:08:15 maxv Exp $	*/
+/*	$NetBSD: nvmm.h,v 1.16 2019/10/27 20:17:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@ struct nvmm_mem {
 typedef uint64_t nvmm_prot_t;
 
 int nvmm_init(void);
+int nvmm_root_init(void);
 
 int nvmm_capability(struct nvmm_capability *);
 

Index: src/sys/dev/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.23 src/sys/dev/nvmm/nvmm.c:1.24
--- src/sys/dev/nvmm/nvmm.c:1.23	Wed Oct 23 07:01:11 2019
+++ src/sys/dev/nvmm/nvmm.c	Sun Oct 27 20:17:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.23 2019/10/23 07:01:11 maxv Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.24 2019/10/27 20:17:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.23 2019/10/23 07:01:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.24 2019/10/27 20:17:36 maxv Exp $");
 
 #include 
 #include 
@@ -889,7 +889,7 @@ out:
 /* -- */
 
 static int
-nvmm_ctl_mach_info(struct nvmm_ioc_ctl *args)
+nvmm_ctl_mach_info(struct nvmm_owner *owner, struct nvmm_ioc_ctl *args)
 {
 	struct nvmm_ctl_mach_info ctl;
 	struct nvmm_machine *mach;
@@ -903,7 +903,7 @@ nvmm_ctl_mach_info(struct nvmm_ioc_ctl *
 	if (error)
 		return error;
 
-	error = nvmm_machine_get(_owner, ctl.machid, , true);
+	error = nvmm_machine_get(owner, ctl.machid, , true);
 	if (error)
 		return error;
 
@@ -930,16 +930,9 @@ nvmm_ctl_mach_info(struct nvmm_ioc_ctl *
 static int
 nvmm_ctl(struct nvmm_owner *owner, struct nvmm_ioc_ctl *args)
 {
-	int error;
-
-	error = kauth_authorize_device(curlwp->l_cred, KAUTH_DEVICE_NVMM_CTL,
-	NULL, NULL, NULL, NULL);
-	if (error)
-		return error;
-
 	switch (args->op) {
 	case NVMM_CTL_MACH_INFO:
-		return nvmm_ctl_mach_info(args);
+		return nvmm_ctl_mach_info(owner, args);
 	default:
 		return EINVAL;
 	}
@@ -1047,8 +1040,12 @@ nvmm_open(dev_t dev, int flags, int type
 	if (error)
 		return error;
 
-	owner = kmem_alloc(sizeof(*owner), KM_SLEEP);
-	owner->pid = l->l_proc->p_pid;
+	if (OFLAGS(flags) & O_WRONLY) {
+		owner = _owner;
+	} else {
+		owner = kmem_alloc(sizeof(*owner), KM_SLEEP);
+		owner->pid = l->l_proc->p_pid;
+	}
 
 	return fd_clone(fp, fd, flags, _fileops, owner);
 }
@@ -1060,7 +1057,9 @@ nvmm_close(file_t *fp)
 
 	KASSERT(owner != NULL);
 	nvmm_kill_machines(owner);
-	kmem_free(owner, sizeof(*owner));
+	if (owner != _owner) {
+		kmem_free(owner, sizeof(*owner));
+	}
 	fp->f_data = NULL;
 
	return 0;



CVS commit: src/sys/dev/i2c

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

Modified Files:
src/sys/dev/i2c: files.i2c tps65217pmic.c

Log Message:
Add FDT support


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/tps65217pmic.c

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



CVS commit: src/sys/dev/i2c

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

Modified Files:
src/sys/dev/i2c: files.i2c tps65217pmic.c

Log Message:
Add FDT support


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/tps65217pmic.c

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

Modified files:

Index: src/sys/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.100 src/sys/dev/i2c/files.i2c:1.101
--- src/sys/dev/i2c/files.i2c:1.100	Wed Jul 24 05:25:32 2019
+++ src/sys/dev/i2c/files.i2c	Sun Oct 27 20:11:13 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.100 2019/07/24 05:25:32 thorpej Exp $
+#	$NetBSD: files.i2c,v 1.101 2019/10/27 20:11:13 jmcneill Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -202,8 +202,10 @@ attach	tps65950pm at iic
 file	dev/i2c/tps65950.c		tps65950pm
 
 # TI TPS65217
-device	tps65217pmic: sysmon_envsys
+device	tps65217pmic { }: sysmon_envsys
+device	tps65217reg: tps65217pmic
 attach	tps65217pmic at iic
+attach	tps65217reg at tps65217pmic
 file	dev/i2c/tps65217pmic.c 		tps65217pmic	needs-flag
 
 # Microchip MCP980x

Index: src/sys/dev/i2c/tps65217pmic.c
diff -u src/sys/dev/i2c/tps65217pmic.c:1.12 src/sys/dev/i2c/tps65217pmic.c:1.13
--- src/sys/dev/i2c/tps65217pmic.c:1.12	Sat Jun 16 21:22:13 2018
+++ src/sys/dev/i2c/tps65217pmic.c	Sun Oct 27 20:11:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tps65217pmic.c,v 1.12 2018/06/16 21:22:13 thorpej Exp $ */
+/*	$NetBSD: tps65217pmic.c,v 1.13 2019/10/27 20:11:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,8 +34,10 @@
  * TODO: battery, sequencer, pgood
  */
 
+#include "opt_fdt.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tps65217pmic.c,v 1.12 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tps65217pmic.c,v 1.13 2019/10/27 20:11:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -51,16 +53,23 @@ __KERNEL_RCSID(0, "$NetBSD: tps65217pmic
 #include 
 #include 
 
+#ifdef FDT
+#include 
+#endif
+
 #define NTPS_REG	7
 #define SNUM_REGS	NTPS_REG-1
 #define SNUM_USBSTATUS	NTPS_REG
 #define SNUM_ACSTATUS	NTPS_REG+1
 
+struct tps_reg_param;
+
 struct tps65217pmic_softc {
 	device_t		sc_dev;
 
 	i2c_tag_t		sc_tag;
 	i2c_addr_t		sc_addr;
+	int			sc_phandle;
 
 	uint8_t			sc_version;
 	uint8_t			sc_revision;
@@ -83,6 +92,17 @@ struct tps65217pmic_softc {
 	struct sysmon_pswitch	sc_smpsw;
 };
 
+struct tps65217reg_softc {
+	device_t		sc_dev;
+	int			sc_phandle;
+	struct tps_reg_param	*sc_param;
+};
+
+struct tps65217reg_attach_args {
+	struct tps_reg_param	*reg_param;
+	int			reg_phandle;
+};
+
 /* Voltage regulators */
 enum tps_reg_num {
 	TPS65217PMIC_LDO1,
@@ -159,6 +179,10 @@ static void tps65217pmic_wled_init(struc
 CFATTACH_DECL_NEW(tps65217pmic, sizeof (struct tps65217pmic_softc),
 tps65217pmic_match, tps65217pmic_attach, NULL, NULL);
 
+#ifdef FDT
+static void tps65217pmic_regulator_attach(struct tps65217pmic_softc *);
+#endif
+
 /* Possible settings of LDO1 in mV. */
 static const uint16_t ldo1voltages[] = { 1000, 1100, 1200, 1250, 1300, 1350,
 1400, 1500, 1600, 1800, 2500, 2750, 2800, 3000, 3100, 3300 };
@@ -177,7 +201,7 @@ static const uint16_t ldo3voltages[] = {
 
 static struct tps_reg_param tps_regulators[] = {
 	{
-		.name = "LDO1",
+		.name = "ldo1",
 		.voltage_min = 1000,
 		.voltage_max = 3300,
 		.voltages = ldo1voltages,
@@ -190,7 +214,7 @@ static struct tps_reg_param tps_regulato
 		.enable_bit = TPS65217PMIC_ENABLE_LDO1
 	},
 	{
-		.name = "LDO2",
+		.name = "ldo2",
 		.voltage_min = 900,
 		.voltage_max = 3300,
 		.voltages = ldo2voltages,
@@ -203,7 +227,7 @@ static struct tps_reg_param tps_regulato
 		.enable_bit = TPS65217PMIC_ENABLE_LDO2
 	},
 	{
-		.name = "LDO3",
+		.name = "ldo3",
 		.voltage_min = 1500,
 		.voltage_max = 3300,
 		.voltages = ldo3voltages,
@@ -216,7 +240,7 @@ static struct tps_reg_param tps_regulato
 		.enable_bit = TPS65217PMIC_ENABLE_LDO3
 	},
 	{
-		.name = "LDO4",
+		.name = "ldo4",
 		.voltage_min = 1500,
 		.voltage_max = 3300,
 		.voltages = ldo3voltages,
@@ -229,7 +253,7 @@ static struct tps_reg_param tps_regulato
 		.enable_bit = TPS65217PMIC_ENABLE_LDO4
 	},
 	{
-		.name = "DCDC1",
+		.name = "dcdc1",
 		.voltage_min = 900,
 		.voltage_max = 3300,
 		.voltages = ldo2voltages,
@@ -242,7 +266,7 @@ static struct tps_reg_param tps_regulato
 		.enable_bit = TPS65217PMIC_ENABLE_DCDC1
 	},
 	{
-		.name = "DCDC2",
+		.name = "dcdc2",
 		.voltage_min = 900,
 		.voltage_max = 3300,
 		.voltages = ldo2voltages,
@@ -255,7 +279,7 @@ static struct tps_reg_param tps_regulato
 		.enable_bit = TPS65217PMIC_ENABLE_DCDC2
 	},
 	{
-		.name = "DCDC3",
+		.name = "dcdc3",
 		.voltage_min = 900,
 		.voltage_max = 3300,
 		.voltages = ldo2voltages,
@@ -271,10 +295,19 @@ static struct tps_reg_param tps_regulato
 
 static bool matched = false;
 
+static const struct 

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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 19:11:24 UTC 2019

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

Log Message:
Add tiiic, tps65217pmic


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.56 src/sys/arch/evbarm/conf/GENERIC:1.57
--- src/sys/arch/evbarm/conf/GENERIC:1.56	Sun Oct 27 18:00:46 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Sun Oct 27 19:11:24 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.56 2019/10/27 18:00:46 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.57 2019/10/27 19:11:24 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -492,6 +492,7 @@ exyoi2c* 	at fdt?			# Samsung Exynos I2C
 sunxirsb* 	at fdt? pass 4		# Allwinner RSB
 sunxitwi* 	at fdt?			# Allwinner TWI
 tegrai2c* 	at fdt? pass 4		# NVIDIA Tegra I2C
+tiiic*		at fdt? pass 4		# TI OMAP I2C
 iic* 		at i2cbus?
 
 # I2C devices
@@ -510,6 +511,7 @@ sy8106a* 	at iic?			# Silergy SY81061 re
 tcakp* 		at iic?			# TI TCA8418 Keypad Scan IC
 tcagpio* 	at iic?
 titemp* 	at iic?
+tps65217pmic*	at iic?			# TI TPS65217 Power Management IC
 wskbd* 		at tcakp? console ?
 
 # CAN bus



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 19:11:24 UTC 2019

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

Log Message:
Add tiiic, tps65217pmic


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

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



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 19:11:07 UTC 2019

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c files.ti
Added Files:
src/sys/arch/arm/ti: ti_iic.c ti_iicreg.h

Log Message:
Add I2C support.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_iic.c \
src/sys/arch/arm/ti/ti_iicreg.h

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/ti

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 19:11:07 UTC 2019

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c files.ti
Added Files:
src/sys/arch/arm/ti: ti_iic.c ti_iicreg.h

Log Message:
Add I2C support.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_iic.c \
src/sys/arch/arm/ti/ti_iicreg.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/arm/ti/am3_prcm.c
diff -u src/sys/arch/arm/ti/am3_prcm.c:1.3 src/sys/arch/arm/ti/am3_prcm.c:1.4
--- src/sys/arch/arm/ti/am3_prcm.c:1.3	Sun Oct 27 16:31:26 2019
+++ src/sys/arch/arm/ti/am3_prcm.c	Sun Oct 27 19:11:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: am3_prcm.c,v 1.3 2019/10/27 16:31:26 jmcneill Exp $ */
+/* $NetBSD: am3_prcm.c,v 1.4 2019/10/27 19:11:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.3 2019/10/27 16:31:26 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.4 2019/10/27 19:11:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -97,6 +97,10 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER("uart4", 0x78, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("uart5", 0x38, "PERIPH_CLK"),
 
+	AM3_PRCM_HWMOD_WKUP("i2c1", 0xb8, "PERIPH_CLK"),
+	AM3_PRCM_HWMOD_PER("i2c2", 0x48, "PERIPH_CLK"),
+	AM3_PRCM_HWMOD_PER("i2c3", 0x44, "PERIPH_CLK"),
+
 	AM3_PRCM_HWMOD_WKUP("timer0", 0x10, "FIXED_32K"),
 	AM3_PRCM_HWMOD_PER("timer2", 0x80, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("timer3", 0x84, "PERIPH_CLK"),

Index: src/sys/arch/arm/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.10 src/sys/arch/arm/ti/files.ti:1.11
--- src/sys/arch/arm/ti/files.ti:1.10	Sun Oct 27 16:31:26 2019
+++ src/sys/arch/arm/ti/files.ti	Sun Oct 27 19:11:07 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.10 2019/10/27 16:31:26 jmcneill Exp $
+#	$NetBSD: files.ti,v 1.11 2019/10/27 19:11:07 jmcneill Exp $
 #
 
 file	arch/arm/ti/ti_platform.c	soc_ti
@@ -31,6 +31,11 @@ device	omaptimer
 attach  omaptimer at fdt
 file	arch/arm/ti/ti_omaptimer.c	omaptimer
 
+# I2C
+device	tiiic: i2cbus, i2cexec
+attach	tiiic at fdt with ti_iic
+file	arch/arm/ti/ti_iic.c		ti_iic
+
 # Ethernet
 device  cpsw: ether, ifnet, arp, mii, mii_phy
 attach  cpsw at fdt

Added files:

Index: src/sys/arch/arm/ti/ti_iic.c
diff -u /dev/null src/sys/arch/arm/ti/ti_iic.c:1.1
--- /dev/null	Sun Oct 27 19:11:07 2019
+++ src/sys/arch/arm/ti/ti_iic.c	Sun Oct 27 19:11:07 2019
@@ -0,0 +1,629 @@
+/* $NetBSD: ti_iic.c,v 1.1 2019/10/27 19:11:07 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2013 Manuel Bouyer.  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.
+ */
+
+/*-
+ * Copyright (c) 2012 Jared D. McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * 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 

CVS commit: src/sys/dev/i2c

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 19:10:38 UTC 2019

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

Log Message:
Add atmel,24c256 compat data


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/i2c/at24cxx.c

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

Modified files:

Index: src/sys/dev/i2c/at24cxx.c
diff -u src/sys/dev/i2c/at24cxx.c:1.31 src/sys/dev/i2c/at24cxx.c:1.32
--- src/sys/dev/i2c/at24cxx.c:1.31	Tue Mar 26 09:22:17 2019
+++ src/sys/dev/i2c/at24cxx.c	Sun Oct 27 19:10:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: at24cxx.c,v 1.31 2019/03/26 09:22:17 mlelstv Exp $	*/
+/*	$NetBSD: at24cxx.c,v 1.32 2019/10/27 19:10:38 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.31 2019/03/26 09:22:17 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.32 2019/10/27 19:10:38 jmcneill Exp $");
 
 #include 
 #include 
@@ -125,6 +125,7 @@ static const struct device_compatible_en
 	{ "i2c-at34c02",		256 },
 	{ "atmel,24c02",		256 },
 	{ "atmel,24c16",		2048 },
+	{ "atmel,24c256",		32768 },
 	{ NULL,0 }
 };
 



CVS commit: src/sys/dev/i2c

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 19:10:38 UTC 2019

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

Log Message:
Add atmel,24c256 compat data


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/i2c/at24cxx.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/nvmm/x86

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 18:26:54 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c

Log Message:
Add PCID support in the guests. This speeds up most 64bit guests, because
since Meltdown, everybody uses PCID (including NetBSD).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.42 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.43
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.42	Sun Oct 27 11:11:09 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Sun Oct 27 18:26:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.42 2019/10/27 11:11:09 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.43 2019/10/27 18:26:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.42 2019/10/27 11:11:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.43 2019/10/27 18:26:54 maxv Exp $");
 
 #include 
 #include 
@@ -1150,6 +1150,9 @@ vmx_inkernel_handle_cpuid(struct nvmm_cp
 
 		cpudata->gprs[NVMM_X64_GPR_RCX] &= nvmm_cpuid_0001.ecx;
 		cpudata->gprs[NVMM_X64_GPR_RCX] |= CPUID2_RAZ;
+		if (vmx_procbased_ctls2 & PROC_CTLS2_INVPCID_ENABLE) {
+			cpudata->gprs[NVMM_X64_GPR_RCX] |= CPUID2_PCID;
+		}
 
 		cpudata->gprs[NVMM_X64_GPR_RDX] &= nvmm_cpuid_0001.edx;
 
@@ -1171,6 +1174,9 @@ vmx_inkernel_handle_cpuid(struct nvmm_cp
 		cpudata->gprs[NVMM_X64_GPR_RBX] &= nvmm_cpuid_0007.ebx;
 		cpudata->gprs[NVMM_X64_GPR_RCX] &= nvmm_cpuid_0007.ecx;
 		cpudata->gprs[NVMM_X64_GPR_RDX] &= nvmm_cpuid_0007.edx;
+		if (vmx_procbased_ctls2 & PROC_CTLS2_INVPCID_ENABLE) {
+			cpudata->gprs[NVMM_X64_GPR_RBX] |= CPUID_SEF_INVPCID;
+		}
 		break;
 	case 0x000A:
 		cpudata->gprs[NVMM_X64_GPR_RAX] = 0;
@@ -2893,6 +2899,40 @@ vmx_machine_configure(struct nvmm_machin
 
 /* -- */
 
+#define CTLS_ONE_ALLOWED(msrval, bitoff) \
+	((msrval & __BIT(32 + bitoff)) != 0)
+#define CTLS_ZERO_ALLOWED(msrval, bitoff) \
+	((msrval & __BIT(bitoff)) == 0)
+
+static int
+vmx_check_ctls(uint64_t msr_ctls, uint64_t msr_true_ctls, uint64_t set_one)
+{
+	uint64_t basic, val, true_val;
+	bool has_true;
+	size_t i;
+
+	basic = rdmsr(MSR_IA32_VMX_BASIC);
+	has_true = (basic & IA32_VMX_BASIC_TRUE_CTLS) != 0;
+
+	val = rdmsr(msr_ctls);
+	if (has_true) {
+		true_val = rdmsr(msr_true_ctls);
+	} else {
+		true_val = val;
+	}
+
+	for (i = 0; i < 32; i++) {
+		if (!(set_one & __BIT(i))) {
+			continue;
+		}
+		if (!CTLS_ONE_ALLOWED(true_val, i)) {
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
 static int
 vmx_init_ctls(uint64_t msr_ctls, uint64_t msr_true_ctls,
 uint64_t set_one, uint64_t set_zero, uint64_t *res)
@@ -2911,14 +2951,9 @@ vmx_init_ctls(uint64_t msr_ctls, uint64_
 		true_val = val;
 	}
 
-#define ONE_ALLOWED(msrval, bitoff) \
-	((msrval & __BIT(32 + bitoff)) != 0)
-#define ZERO_ALLOWED(msrval, bitoff) \
-	((msrval & __BIT(bitoff)) == 0)
-
 	for (i = 0; i < 32; i++) {
-		one_allowed = ONE_ALLOWED(true_val, i);
-		zero_allowed = ZERO_ALLOWED(true_val, i);
+		one_allowed = CTLS_ONE_ALLOWED(true_val, i);
+		zero_allowed = CTLS_ZERO_ALLOWED(true_val, i);
 
 		if (zero_allowed && !one_allowed) {
 			if (set_one & __BIT(i))
@@ -2935,9 +2970,9 @@ vmx_init_ctls(uint64_t msr_ctls, uint64_
 *res |= __BIT(i);
 			} else if (!has_true) {
 *res &= ~__BIT(i);
-			} else if (ZERO_ALLOWED(val, i)) {
+			} else if (CTLS_ZERO_ALLOWED(val, i)) {
 *res &= ~__BIT(i);
-			} else if (ONE_ALLOWED(val, i)) {
+			} else if (CTLS_ONE_ALLOWED(val, i)) {
 *res |= __BIT(i);
 			} else {
 return -1;
@@ -3011,6 +3046,12 @@ vmx_ident(void)
 	if (ret == -1) {
 		return false;
 	}
+	ret = vmx_check_ctls(
+	MSR_IA32_VMX_PROCBASED_CTLS2, MSR_IA32_VMX_PROCBASED_CTLS2,
+	PROC_CTLS2_INVPCID_ENABLE);
+	if (ret != -1) {
+		vmx_procbased_ctls2 |= PROC_CTLS2_INVPCID_ENABLE;
+	}
 	ret = vmx_init_ctls(
 	MSR_IA32_VMX_ENTRY_CTLS, MSR_IA32_VMX_TRUE_ENTRY_CTLS,
 	VMX_ENTRY_CTLS_ONE, VMX_ENTRY_CTLS_ZERO,



CVS commit: src/sys/dev/nvmm/x86

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 18:26:54 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c

Log Message:
Add PCID support in the guests. This speeds up most 64bit guests, because
since Meltdown, everybody uses PCID (including NetBSD).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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



Re: CVS commit: xsrc/external/mit/mkfontscale/dist

2019-10-27 Thread maya
On Sun, Oct 27, 2019 at 05:38:08PM +, Maya Rashish wrote:
> Module Name:  xsrc
> Committed By: maya
> Date: Sun Oct 27 17:38:08 UTC 2019
> 
> Modified Files:
>   xsrc/external/mit/mkfontscale/dist: mkfontscale.c
> 
> Log Message:
> Use a case insensitive comparison. Add ExtraBold.

+Plain


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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 18:00:46 UTC 2019

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

Log Message:
Add support for TI AM335x


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

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



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 18:00:46 UTC 2019

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

Log Message:
Add support for TI AM335x


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.55 src/sys/arch/evbarm/conf/GENERIC:1.56
--- src/sys/arch/evbarm/conf/GENERIC:1.55	Sat Oct 26 15:01:18 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Sun Oct 27 18:00:46 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.55 2019/10/26 15:01:18 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.56 2019/10/27 18:00:46 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -16,6 +16,37 @@ makeoptions	DTSARCH="arm"
 makeoptions	DTSGNUARCH="arm"
 makeoptions	DTSSUBDIR=""
 makeoptions	DTS="
+	am335x-baltos-ir2110.dts
+	am335x-baltos-ir3220.dts
+	am335x-baltos-ir5221.dts
+	am335x-base0033.dts
+	am335x-bone.dts
+	am335x-boneblack-wireless.dts
+	am335x-boneblack.dts
+	am335x-boneblue.dts
+	am335x-bonegreen-wireless.dts
+	am335x-bonegreen.dts
+	am335x-chiliboard.dts
+	am335x-cm-t335.dts
+	am335x-evm.dts
+	am335x-evmsk.dts
+	am335x-guardian.dts
+	am335x-icev2.dts
+	am335x-lxm.dts
+	am335x-moxa-uc-2101.dts
+	am335x-moxa-uc-8100-me-t.dts
+	am335x-nano.dts
+	am335x-osd3358-sm-red.dts
+	am335x-pdu001.dts
+	am335x-pepper.dts
+	am335x-phycore-rdk.dts
+	am335x-pocketbeagle.dts
+	am335x-sancloud-bbe.dts
+	am335x-sbc-t335.dts
+	am335x-shc.dts
+	am335x-sl50.dts
+	am335x-wega-rdk.dts
+
 	bcm2836-rpi-2-b.dts
 	bcm2837-rpi-3-a-plus.dts
 	bcm2837-rpi-3-b.dts
@@ -193,6 +224,8 @@ options 	SOC_SUN9I_A80
 
 options 	SOC_TEGRA124
 
+options 	SOC_TI_AM335X
+
 options 	SOC_VIRT
 
 options 	SOC_ZYNQ7000
@@ -212,6 +245,8 @@ options 	MSGBUFSIZE=32768
 
 # EARLYCONS is required for early init messages from VERBOSE_INIT_ARM.
 
+#options 	EARLYCONS=am33xx, CONSADDR=0x44e09000
+
 # ODROID-C1
 #options 	EARLYCONS=meson, CONSADDR=0xc81004c0
 
@@ -259,6 +294,7 @@ cpufreqdt*	at cpu?
 psci*		at fdt?
 
 # Clock and reset controllers
+am3prcm*	at fdt? pass 1		# TI AM335x PRCM
 cycvclkmgr* 	at fdt? pass 1		# Cyclone V clock manager
 cycvrstmgr* 	at fdt? pass 0		# Cyclone V reset manager
 exy5410clk* 	at fdt? pass 3		# Exynos5410 clock controller
@@ -298,6 +334,7 @@ sunxisramc* 	at fdt? pass 4		# SRAM cont
 
 # System Controller
 syscon*		at fdt? pass 1		# Generic System Controller
+tisysc*		at fdt? pass 2		# TI sysc interconnect
 #zynqslcr*	at fdt? pass 1		# Zynq 7000 system Controller
 
 # Timer
@@ -309,6 +346,7 @@ gtmr*		at fdt? pass 1		# ARM Generic Tim
 armgtmr0	at gtmr?
 mct*		at fdt? pass 2		# Exynos Multi Core Timer (MCT)
 armgtmr*	at mct?
+omaptimer*	at fdt?			# TI OMAP Timer
 meson6timer* 	at fdt?			# Amlogic Timer
 sunxitimer* 	at fdt?			# Allwinner async timer
 sunxihstimer* 	at fdt?			# Allwinner High-Speed timer
@@ -325,6 +363,7 @@ gic*		at fdt? pass 1		# ARM GIC
 armgic0		at gic?
 bcmicu* 	at fdt? pass 1		# Broadcom BCM283x ICU
 exyointr* 	at fdt? pass 1		# Samsung Exynos ICU
+omapintc*	at fdt? pass 2		# TI OMAP INTC
 tegralic* 	at fdt? pass 1		# NVIDIA Tegra LIC
 sunxiintc* 	at fdt? pass 1		# Allwinner INTC
 sunxinmi* 	at fdt? pass 2		# Allwinner NMI / R_INTC
@@ -346,6 +385,8 @@ bcmdmac* 	at fdt?			# Broadcom BCM283x D
 sun4idma* 	at fdt? pass 4		# Allwinner DMA controller (sun4i)
 sun6idma* 	at fdt?	pass 4		# Allwinner DMA controller (sun6i)
 tegraapbdma* 	at fdt? pass 4		# NVIDIA Tegra APB DMA
+tiedma*		at fdt? pass 4		# TI EDMA3 (TPCC)
+titptc*		at fdt? pass 3		# TI EDMA3 (TPTC)
 
 # FUSE controller
 tegrafuse* 	at fdt? pass 4		# NVIDIA Tegra FUSE
@@ -371,6 +412,7 @@ tegragpio* 	at fdt? pass 2		# NVIDIA Teg
 gpio* 		at gpiobus?
 
 # MPIO / Pinmux
+pinctrl*	at fdt? pass 2		# Generic pinctrl driver
 tegrapinmux* 	at fdt?			# NVIDIA Tegra MPIO
 
 # PWM controller
@@ -398,6 +440,7 @@ pci* 		at ppb?
 # Ethernet
 awge* 		at fdt?			# Allwinner Gigabit Ethernet (GMAC)
 cemac* 		at fdt?			# Cadence EMAC/GEM ethernet controller
+cpsw*		at fdt?			# TI CPSW 3-port Ethernet Switch
 emac* 		at fdt?			# Allwinner Fast/Gigabit Ethernet (EMAC)
 smsh* 		at fdt?			# SMSC LAN9118
 
@@ -618,6 +661,7 @@ sun9iusbphy* 	at fdt? pass 9		# Allwinne
 sunxiusbphy* 	at fdt? pass 9		# Allwinner USB PHY
 sunxiusb3phy* 	at fdt? pass 9		# Allwinner USB3 PHY
 tegrausbphy* 	at fdt?			# NVIDIA Tegra USB PHY
+tiotg*		at fdt?			# TI dual port OTG
 dwctwo* 	at fdt?			# Designware USB DRD
 ehci* 		at fdt?			# EHCI
 motg* 		at fdt?			# Mentor Graphics USB OTG



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 17:59:21 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_omaptimer.c

Log Message:
Use Timer2 for timecounter, and enable hw module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_omaptimer.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/ti/ti_omaptimer.c
diff -u src/sys/arch/arm/ti/ti_omaptimer.c:1.1 src/sys/arch/arm/ti/ti_omaptimer.c:1.2
--- src/sys/arch/arm/ti/ti_omaptimer.c:1.1	Thu Oct 26 01:16:32 2017
+++ src/sys/arch/arm/ti/ti_omaptimer.c	Sun Oct 27 17:59:21 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: ti_omaptimer.c,v 1.1 2017/10/26 01:16:32 jakllsch Exp $	*/
+/*	$NetBSD: ti_omaptimer.c,v 1.2 2019/10/27 17:59:21 jmcneill Exp $	*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_omaptimer.c,v 1.1 2017/10/26 01:16:32 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_omaptimer.c,v 1.2 2019/10/27 17:59:21 jmcneill Exp $");
 
 #include 
 #include 
@@ -15,6 +15,23 @@ __KERNEL_RCSID(0, "$NetBSD: ti_omaptimer
 
 #include 
 
+#include 
+
+#define	TIMER_IRQENABLE_SET	0x2c
+#define	TIMER_IRQENABLE_CLR	0x30
+#define	 MAT_EN_FLAG		__BIT(0)
+#define	 OVF_EN_FLAG		__BIT(1)
+#define	 TCAR_EN_FLAG		__BIT(2)
+#define	TIMER_TCLR		0x38
+#define	 TCLR_ST		__BIT(0)
+#define	 TCLR_AR		__BIT(1)
+#define	TIMER_TCRR		0x3c
+#define	TIMER_TLDR		0x40
+
+/* XXX */
+#define	IS_TIMER2(addr)	((addr) == 0x4804)
+#define	IS_TIMER3(addr)	((addr) == 0x48042000)
+
 static const char * const compatible[] = {
 	"ti,am335x-timer-1ms",
 	"ti,am335x-timer",
@@ -61,12 +78,16 @@ omaptimer_cpu_initclocks(void)
 	
 	aprint_normal_dev(sc->sc_dev, "interrupting on %s\n", intrstr);
 
-	uint32_t value;
-	value = (0x - ((2400UL / hz) - 1));
-	bus_space_write_4(sc->sc_bst, sc->sc_bsh, 0x40, value);
-	bus_space_write_4(sc->sc_bst, sc->sc_bsh, 0x3c, value);
-	bus_space_write_4(sc->sc_bst, sc->sc_bsh, 0x2c, 2);
-	bus_space_write_4(sc->sc_bst, sc->sc_bsh, 0x38, 3);
+	/* Enable interrupts */
+	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TIMER_IRQENABLE_SET, OVF_EN_FLAG);
+}
+
+static u_int
+omaptimer_get_timecount(struct timecounter *tc)
+{
+	struct omaptimer_softc * const sc = tc->tc_priv;
+
+	return bus_space_read_4(sc->sc_bst, sc->sc_bsh, TIMER_TCRR);
 }
 
 static int
@@ -83,6 +104,7 @@ omaptimer_attach(device_t parent, device
 	struct omaptimer_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
+	struct timecounter *tc = >sc_tc;
 	bus_addr_t addr;
 	bus_size_t size;
 
@@ -107,13 +129,37 @@ omaptimer_attach(device_t parent, device
 		return;
 	}
 
+	if (ti_prcm_enable_hwmod(OF_parent(phandle), 0) != 0) {
+		aprint_error(": couldn't enable module\n");
+		return;
+	}
+
 	aprint_naive("\n");
 	aprint_normal(": Timer\n");
 
-	/* Use this as the OS timer in UP configurations */
-	if (!arm_has_mpext_p && addr == 0x48042000) { /* TIMER3 */
-		timer_softc = sc;
-		arm_fdt_timer_register(omaptimer_cpu_initclocks);
+	if (IS_TIMER2(addr)) {
+		/* Install timecounter */
+		tc->tc_get_timecount = omaptimer_get_timecount;
+		tc->tc_counter_mask = ~0u;
+		tc->tc_frequency = 2400;
+		tc->tc_name = "Timer2";
+		tc->tc_quality = 200;
+		tc->tc_priv = sc;
+		tc_init(tc);
+	} else if (IS_TIMER3(addr)) {
+		/* Configure the timer */
+		const uint32_t value = (0x - ((2400UL / hz) - 1));
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, TIMER_TLDR, value);
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, TIMER_TCRR, value);
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, TIMER_IRQENABLE_CLR, 
+		MAT_EN_FLAG | OVF_EN_FLAG | TCAR_EN_FLAG);
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, TIMER_TCLR, TCLR_ST | TCLR_AR);
+
+		/* Use this as the OS timer in UP configurations */
+		if (!arm_has_mpext_p) {
+			timer_softc = sc;
+			arm_fdt_timer_register(omaptimer_cpu_initclocks);
+		}
 	}
 }
 



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 17:59:21 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_omaptimer.c

Log Message:
Use Timer2 for timecounter, and enable hw module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_omaptimer.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/ti

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

Modified Files:
src/sys/arch/arm/ti: ti_platform.c

Log Message:
Place devmap above KERNEL_IO_VBASE


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/ti/ti_platform.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/ti

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

Modified Files:
src/sys/arch/arm/ti: ti_platform.c

Log Message:
Place devmap above KERNEL_IO_VBASE


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/ti/ti_platform.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/ti/ti_platform.c
diff -u src/sys/arch/arm/ti/ti_platform.c:1.7 src/sys/arch/arm/ti/ti_platform.c:1.8
--- src/sys/arch/arm/ti/ti_platform.c:1.7	Sat Oct 26 15:58:15 2019
+++ src/sys/arch/arm/ti/ti_platform.c	Sun Oct 27 17:58:42 2019
@@ -1,9 +1,9 @@
-/* $NetBSD: ti_platform.c,v 1.7 2019/10/26 15:58:15 jmcneill Exp $ */
+/* $NetBSD: ti_platform.c,v 1.8 2019/10/27 17:58:42 jmcneill Exp $ */
 
 #include "opt_console.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_platform.c,v 1.7 2019/10/26 15:58:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_platform.c,v 1.8 2019/10/27 17:58:42 jmcneill Exp $");
 
 #include 
 
@@ -14,6 +14,8 @@ __KERNEL_RCSID(0, "$NetBSD: ti_platform.
 
 #include 
 
+#include 
+
 extern struct bus_space armv7_generic_bs_tag;
 extern struct bus_space armv7_generic_a4x_bs_tag;
 extern struct arm32_bus_dma_tag arm_generic_dma_tag;
@@ -41,9 +43,9 @@ static const struct pmap_devmap *
 am33xx_platform_devmap(void)
 {
 	static const struct pmap_devmap devmap[] = {
-		DEVMAP_ENTRY(0xe4c0, 0x44c0, 0x0040),
-		DEVMAP_ENTRY(0xe800, 0x4800, 0x0100),
-		DEVMAP_ENTRY(0xea00, 0x4a00, 0x0100),
+		DEVMAP_ENTRY(KERNEL_IO_VBASE | 0x04c0, 0x44c0, 0x0040),
+		DEVMAP_ENTRY(KERNEL_IO_VBASE | 0x0800, 0x4800, 0x0100),
+		DEVMAP_ENTRY(KERNEL_IO_VBASE | 0x0a00, 0x4a00, 0x0100),
 		DEVMAP_ENTRY_END
 	};
 
@@ -120,10 +122,10 @@ am33xx_platform_delay(u_int n)
 	prev = bus_space_read_4(bst, bsh, 0x3c);
 	while (ticks > 0) {
 		cur = bus_space_read_4(bst, bsh, 0x3c);
-		if (cur > prev)
+		if (cur >= prev)
 			ticks -= (cur - prev);
 		else
-			ticks -= (UINT32_MAX - prev + 1 - cur);
+			ticks -= (UINT32_MAX - cur + prev);
 		prev = cur;
 	}
 }
@@ -136,12 +138,4 @@ static const struct arm_platform am33xx_
 	.ap_delay = am33xx_platform_delay,
 };
 
-void dummysetstatclockrate(int);
-void
-dummysetstatclockrate(int newhz)
-{
-}
-__weak_alias(setstatclockrate, dummysetstatclockrate);
-
 ARM_PLATFORM(am33xx, "ti,am33xx", _platform);
-



CVS commit: xsrc/external/mit/mkfontscale/dist

2019-10-27 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Sun Oct 27 17:38:08 UTC 2019

Modified Files:
xsrc/external/mit/mkfontscale/dist: mkfontscale.c

Log Message:
Use a case insensitive comparison. Add ExtraBold.

Fixes PR xsrc/40609: Problem with mkfontscale and fonts/freefonts with
xfree/xorg


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/mkfontscale/dist/mkfontscale.c

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

Modified files:

Index: xsrc/external/mit/mkfontscale/dist/mkfontscale.c
diff -u xsrc/external/mit/mkfontscale/dist/mkfontscale.c:1.8 xsrc/external/mit/mkfontscale/dist/mkfontscale.c:1.9
--- xsrc/external/mit/mkfontscale/dist/mkfontscale.c:1.8	Sun Mar  3 09:27:12 2019
+++ xsrc/external/mit/mkfontscale/dist/mkfontscale.c	Sun Oct 27 17:38:08 2019
@@ -435,33 +435,37 @@ t1Weight(const char *weight)
 {
 if(!weight)
 return NULL;
-if(strcmp(weight, "Thin") == 0)
+if(strcasecmp(weight, "Thin") == 0)
 return "thin";
-if(strcmp(weight, "ExtraLight") == 0) /* FontForge uses this for 200*/
+if(strcasecmp(weight, "ExtraLight") == 0) /* FontForge uses this for 200*/
 return "extralight";
-if(strcmp(weight, "Light") == 0)
+if(strcasecmp(weight, "Light") == 0)
 return "light";
-if(strcmp(weight, "Regular") == 0)
+if(strcasecmp(weight, "Regular") == 0)
 return "medium";
-if(strcmp(weight, "Normal") == 0)
+if(strcasecmp(weight, "Plain") == 0)
 return "medium";
-if(strcmp(weight, "Medium") == 0)
+if(strcasecmp(weight, "Normal") == 0)
 return "medium";
-if(strcmp(weight, "Book") == 0)
+if(strcasecmp(weight, "Medium") == 0)
 return "medium";
-if(strcmp(weight, "Roman") == 0) /* Some URW++ fonts do that! */
+if(strcasecmp(weight, "Book") == 0)
 return "medium";
-if(strcmp(weight, "Demi") == 0)
+if(strcasecmp(weight, "Roman") == 0) /* Some URW++ fonts do that! */
+return "medium";
+if(strcasecmp(weight, "Demi") == 0)
 return "semibold";
-if(strcmp(weight, "DemiBold") == 0)
+if(strcasecmp(weight, "DemiBold") == 0)
 return "semibold";
-if(strcmp(weight, "SemiBold") == 0) /* some TeX fonts apparently do that */
+if(strcasecmp(weight, "SemiBold") == 0) /* some TeX fonts apparently do that */
 return "semibold";
-else if(strcmp(weight, "Bold") == 0)
+else if(strcasecmp(weight, "Bold") == 0)
 return "bold";
-else if(strcmp(weight, "Heavy") == 0) /* FontForge uses this for 800*/
+else if(strcasecmp(weight, "Heavy") == 0) /* FontForge uses this for 800*/
+return "extrabold";
+else if(strcasecmp(weight, "ExtraBold") == 0) /* freefonts uses this */
 return "extrabold";
-else if(strcmp(weight, "Black") == 0)
+else if(strcasecmp(weight, "Black") == 0)
 return "black";
 else {
 fprintf(stderr, "Unknown Type 1 weight \"%s\"\n", weight);



CVS commit: xsrc/external/mit/mkfontscale/dist

2019-10-27 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Sun Oct 27 17:38:08 UTC 2019

Modified Files:
xsrc/external/mit/mkfontscale/dist: mkfontscale.c

Log Message:
Use a case insensitive comparison. Add ExtraBold.

Fixes PR xsrc/40609: Problem with mkfontscale and fonts/freefonts with
xfree/xorg


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/mkfontscale/dist/mkfontscale.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/ti

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 17:21:23 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_sdhc.c ti_sdhcreg.h

Log Message:
Disable autoidle


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_sdhc.c \
src/sys/arch/arm/ti/ti_sdhcreg.h

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/ti

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 17:21:23 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_sdhc.c ti_sdhcreg.h

Log Message:
Disable autoidle


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_sdhc.c \
src/sys/arch/arm/ti/ti_sdhcreg.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/arm/ti/ti_sdhc.c
diff -u src/sys/arch/arm/ti/ti_sdhc.c:1.1 src/sys/arch/arm/ti/ti_sdhc.c:1.2
--- src/sys/arch/arm/ti/ti_sdhc.c:1.1	Sun Oct 27 15:43:46 2019
+++ src/sys/arch/arm/ti/ti_sdhc.c	Sun Oct 27 17:21:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ti_sdhc.c,v 1.1 2019/10/27 15:43:46 jmcneill Exp $	*/
+/*	$NetBSD: ti_sdhc.c,v 1.2 2019/10/27 17:21:23 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.1 2019/10/27 15:43:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.2 2019/10/27 17:21:23 jmcneill Exp $");
 
 #include 
 #include 
@@ -297,8 +297,12 @@ no_dma:
 		aprint_error_dev(dev, "Soft reset timeout\n");
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, MMCHS_SYSCONFIG,
 	SYSCONFIG_ENAWAKEUP |
+#if notyet
 	SYSCONFIG_AUTOIDLE |
 	SYSCONFIG_SIDLEMODE_AUTO |
+#else
+	SYSCONFIG_SIDLEMODE_IGNORE |
+#endif
 	SYSCONFIG_CLOCKACTIVITY_FCLK |
 	SYSCONFIG_CLOCKACTIVITY_ICLK);
 
Index: src/sys/arch/arm/ti/ti_sdhcreg.h
diff -u src/sys/arch/arm/ti/ti_sdhcreg.h:1.1 src/sys/arch/arm/ti/ti_sdhcreg.h:1.2
--- src/sys/arch/arm/ti/ti_sdhcreg.h:1.1	Sun Oct 27 15:43:46 2019
+++ src/sys/arch/arm/ti/ti_sdhcreg.h	Sun Oct 27 17:21:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ti_sdhcreg.h,v 1.1 2019/10/27 15:43:46 jmcneill Exp $	*/
+/*	$NetBSD: ti_sdhcreg.h,v 1.2 2019/10/27 17:21:23 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -61,6 +61,7 @@
 #  define SYSCONFIG_CLOCKACTIVITY_ICLK	(1 << 8)
 #  define SYSCONFIG_SIDLEMODE_MASK	(3 << 3)
 #  define SYSCONFIG_SIDLEMODE_AUTO	(2 << 3)
+#  define SYSCONFIG_SIDLEMODE_IGNORE	(1 << 3)
 #  define SYSCONFIG_ENAWAKEUP		(1 << 2)
 #  define SYSCONFIG_SOFTRESET		(1 << 1)
 #  define SYSCONFIG_AUTOIDLE		(1 << 0)



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 16:31:26 UTC 2019

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c files.ti
Added Files:
src/sys/arch/arm/ti: ti_motg.c ti_otg.c ti_otgreg.h

Log Message:
Add USB support.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_motg.c \
src/sys/arch/arm/ti/ti_otg.c src/sys/arch/arm/ti/ti_otgreg.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/arm/ti/am3_prcm.c
diff -u src/sys/arch/arm/ti/am3_prcm.c:1.2 src/sys/arch/arm/ti/am3_prcm.c:1.3
--- src/sys/arch/arm/ti/am3_prcm.c:1.2	Sun Oct 27 12:14:51 2019
+++ src/sys/arch/arm/ti/am3_prcm.c	Sun Oct 27 16:31:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: am3_prcm.c,v 1.2 2019/10/27 12:14:51 jmcneill Exp $ */
+/* $NetBSD: am3_prcm.c,v 1.3 2019/10/27 16:31:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.2 2019/10/27 12:14:51 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.3 2019/10/27 16:31:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -113,6 +113,8 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER("tptc0", 0x24, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("tptc1", 0xfc, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("tptc2", 0x100, "PERIPH_CLK"),
+
+	AM3_PRCM_HWMOD_PER("usb_otg_hs", 0x1c, "PERIPH_CLK"),
 };
 
 static int

Index: src/sys/arch/arm/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.9 src/sys/arch/arm/ti/files.ti:1.10
--- src/sys/arch/arm/ti/files.ti:1.9	Sun Oct 27 15:43:46 2019
+++ src/sys/arch/arm/ti/files.ti	Sun Oct 27 16:31:26 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.9 2019/10/27 15:43:46 jmcneill Exp $
+#	$NetBSD: files.ti,v 1.10 2019/10/27 16:31:26 jmcneill Exp $
 #
 
 file	arch/arm/ti/ti_platform.c	soc_ti
@@ -48,6 +48,14 @@ file	arch/arm/ti/ti_tptc.c		ti_tptc
 attach	sdhc at fdt with ti_sdhc: ti_edma, ti_prcm
 file	arch/arm/ti/ti_sdhc.c		ti_sdhc
 
+# USB
+device	tiotg { } : fdt
+attach	tiotg at fdt with ti_otg
+file	arch/arm/ti/ti_otg.c		ti_otg
+
+attach	motg at fdt with ti_motg
+file	arch/arm/ti/ti_motg.c		ti_motg
+
 # SOC parameters
 defflag	opt_soc.h			SOC_TI
 defflag	opt_soc.h			SOC_TI_AM335X: SOC_TI

Added files:

Index: src/sys/arch/arm/ti/ti_motg.c
diff -u /dev/null src/sys/arch/arm/ti/ti_motg.c:1.1
--- /dev/null	Sun Oct 27 16:31:26 2019
+++ src/sys/arch/arm/ti/ti_motg.c	Sun Oct 27 16:31:26 2019
@@ -0,0 +1,237 @@
+/* $NetBSD: ti_motg.c,v 1.1 2019/10/27 16:31:26 jmcneill Exp $ */
+/*
+ * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *	notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *	notice, this list of conditions and the following disclaimer in the
+ *	documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ti_motg.c,v 1.1 2019/10/27 16:31:26 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifdef USB_DEBUG
+#ifndef MOTG_DEBUG
+#define motgdebug 0
+#else
+extern int motgdebug;
+#endif /* MOTG_DEBUG */
+#endif /* USB_DEBUG */
+
+#define	DPRINTF(FMT,A,B,C,D)	USBHIST_LOGN(motgdebug,1,FMT,A,B,C,D)
+#define	MOTGHIST_FUNC()		USBHIST_FUNC()
+#define	MOTGHIST_CALLED(name)	USBHIST_CALLED(motgdebug)
+
+static const char * compatible [] = {
+	"ti,musb-am33xx",
+	NULL
+};
+
+/*
+ * motg device attachement and driver,
+ * for the per-port part of the controller: TI-specific part, phy and
+ * MI Mentor OTG.
+ */
+
+struct ti_motg_softc {
+	struct motg_softc	sc_motg;
+	bus_space_tag_t		sc_ctrliot;
+	bus_space_handle_t	

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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 16:31:26 UTC 2019

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c files.ti
Added Files:
src/sys/arch/arm/ti: ti_motg.c ti_otg.c ti_otgreg.h

Log Message:
Add USB support.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_motg.c \
src/sys/arch/arm/ti/ti_otg.c src/sys/arch/arm/ti/ti_otgreg.h

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/ti

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 15:43:46 UTC 2019

Modified Files:
src/sys/arch/arm/ti: files.ti
Added Files:
src/sys/arch/arm/ti: ti_sdhc.c ti_sdhcreg.h

Log Message:
Add MMCHS support.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_sdhc.c \
src/sys/arch/arm/ti/ti_sdhcreg.h

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/ti

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 15:43:46 UTC 2019

Modified Files:
src/sys/arch/arm/ti: files.ti
Added Files:
src/sys/arch/arm/ti: ti_sdhc.c ti_sdhcreg.h

Log Message:
Add MMCHS support.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_sdhc.c \
src/sys/arch/arm/ti/ti_sdhcreg.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/arm/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.8 src/sys/arch/arm/ti/files.ti:1.9
--- src/sys/arch/arm/ti/files.ti:1.8	Sun Oct 27 12:14:51 2019
+++ src/sys/arch/arm/ti/files.ti	Sun Oct 27 15:43:46 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.8 2019/10/27 12:14:51 jmcneill Exp $
+#	$NetBSD: files.ti,v 1.9 2019/10/27 15:43:46 jmcneill Exp $
 #
 
 file	arch/arm/ti/ti_platform.c	soc_ti
@@ -44,6 +44,10 @@ device	titptc
 attach	titptc at fdt with ti_tptc
 file	arch/arm/ti/ti_tptc.c		ti_tptc
 
+# MMCHS
+attach	sdhc at fdt with ti_sdhc: ti_edma, ti_prcm
+file	arch/arm/ti/ti_sdhc.c		ti_sdhc
+
 # SOC parameters
 defflag	opt_soc.h			SOC_TI
 defflag	opt_soc.h			SOC_TI_AM335X: SOC_TI

Added files:

Index: src/sys/arch/arm/ti/ti_sdhc.c
diff -u /dev/null src/sys/arch/arm/ti/ti_sdhc.c:1.1
--- /dev/null	Sun Oct 27 15:43:46 2019
+++ src/sys/arch/arm/ti/ti_sdhc.c	Sun Oct 27 15:43:46 2019
@@ -0,0 +1,672 @@
+/*	$NetBSD: ti_sdhc.c,v 1.1 2019/10/27 15:43:46 jmcneill Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.1 2019/10/27 15:43:46 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#define EDMA_MAX_PARAMS		32
+
+#ifdef TISDHC_DEBUG
+int tisdhcdebug = 1;
+#define DPRINTF(n,s)do { if ((n) <= tisdhcdebug) device_printf s; } while (0)
+#else
+#define DPRINTF(n,s)do {} while (0)
+#endif
+
+
+#define CLKD(kz)	(sc->sc.sc_clkbase / (kz))
+
+#define SDHC_READ(sc, reg) \
+	bus_space_read_4((sc)->sc_bst, (sc)->sc_sdhc_bsh, (reg))
+#define SDHC_WRITE(sc, reg, val) \
+	bus_space_write_4((sc)->sc_bst, (sc)->sc_sdhc_bsh, (reg), (val))
+
+struct ti_sdhc_config {
+	bus_size_t		regoff;
+	uint32_t		flags;
+};
+
+static const struct ti_sdhc_config omap2_hsmmc_config = {
+};
+
+static const struct ti_sdhc_config omap3_pre_es3_hsmmc_config = {
+	.flags = SDHC_FLAG_SINGLE_ONLY
+};
+
+static const struct ti_sdhc_config omap4_hsmmc_config = {
+	.regoff = 0x100
+};
+
+static const struct of_compat_data compat_data[] = {
+	{ "ti,omap2-hsmmc",		(uintptr_t)_hsmmc_config },
+	{ "ti,omap3-hsmmc",		(uintptr_t)_hsmmc_config },
+	{ "ti,omap3-pre-es3-hsmmc",	(uintptr_t)_pre_es3_hsmmc_config },
+	{ "ti,omap4-hsmmc",		(uintptr_t)_hsmmc_config },
+	{ NULL }
+};
+
+enum {
+	EDMA_CHAN_TX,
+	EDMA_CHAN_RX,
+	EDMA_NCHAN
+};
+
+struct ti_sdhc_softc {
+	struct sdhc_softc	sc;
+	int			sc_phandle;
+	bus_addr_t		sc_addr;
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+	bus_space_handle_t	sc_hl_bsh;
+	bus_space_handle_t	sc_sdhc_bsh;
+	struct sdhc_host	*sc_hosts[1];
+	void 			*sc_ih;		/* interrupt vectoring */
+
+	int			sc_edma_chan[EDMA_NCHAN];
+	struct edma_channel	*sc_edma_tx;
+	struct edma_channel	*sc_edma_rx;
+	uint16_t		sc_edma_param_tx[EDMA_MAX_PARAMS];
+	uint16_t		

CVS commit: src/sys/dev/fdt

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 15:31:15 UTC 2019

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

Log Message:
Add driver for one-register-per-pin type pinctrl devices.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/pinctrl_single.c

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

Modified files:

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.45 src/sys/dev/fdt/files.fdt:1.46
--- src/sys/dev/fdt/files.fdt:1.45	Tue Aug 13 16:46:49 2019
+++ src/sys/dev/fdt/files.fdt	Sun Oct 27 15:31:15 2019
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.45 2019/08/13 16:46:49 tnn Exp $
+# $NetBSD: files.fdt,v 1.46 2019/10/27 15:31:15 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -82,6 +82,10 @@ device	syscon { } : fdt
 attach	syscon at fdt
 file	dev/fdt/syscon.c			syscon
 
+device	pinctrl
+attach	pinctrl at fdt with pinctrl_single
+file	dev/fdt/pinctrl_single.c		pinctrl_single
+
 device	pwmbacklight
 attach	pwmbacklight at fdt
 file	dev/fdt/pwm_backlight.c			pwmbacklight

Added files:

Index: src/sys/dev/fdt/pinctrl_single.c
diff -u /dev/null src/sys/dev/fdt/pinctrl_single.c:1.1
--- /dev/null	Sun Oct 27 15:31:15 2019
+++ src/sys/dev/fdt/pinctrl_single.c	Sun Oct 27 15:31:15 2019
@@ -0,0 +1,204 @@
+/* $NetBSD: pinctrl_single.c,v 1.1 2019/10/27 15:31:15 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.1 2019/10/27 15:31:15 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define	PINCTRL_FLAG_PINCONF	__BIT(0)	/* supports generic pinconf */
+
+struct pinctrl_single_config {
+	uint32_t	flags;
+};
+
+static const struct pinctrl_single_config pinctrl_config = {
+};
+
+static const struct pinctrl_single_config pinconf_config = {
+	.flags = PINCTRL_FLAG_PINCONF
+};
+
+static const struct of_compat_data compat_data[] = {
+	{ "pinctrl-single",		(uintptr_t)_config },
+	{ "pinconf-single",		(uintptr_t)_config },
+	{ NULL }
+};
+
+struct pinctrl_single_softc {
+	device_t			sc_dev;
+	intsc_phandle;
+	bus_space_tag_t			sc_bst;
+	bus_space_handle_t		sc_bsh;
+	uint32_t			sc_flags;
+	u_intsc_regwidth;
+	u_intsc_funcmask;
+};
+
+static void
+pinctrl_single_pins_write(struct pinctrl_single_softc *sc, u_int off, u_int val)
+{
+	union {
+		uint32_t reg32;
+		uint16_t reg16;
+		uint8_t reg8;
+	} u;
+
+	aprint_debug_dev(sc->sc_dev, "writing %#x with %#x\n", off, val);
+
+	switch (sc->sc_regwidth) {
+	case 8:
+		u.reg8 = bus_space_read_1(sc->sc_bst, sc->sc_bsh, off);
+		u.reg8 &= ~sc->sc_funcmask;
+		u.reg8 |= val;
+		bus_space_write_1(sc->sc_bst, sc->sc_bsh, off, u.reg8);
+		break;
+	case 16:
+		u.reg16 = bus_space_read_2(sc->sc_bst, sc->sc_bsh, off);
+		u.reg16 &= ~sc->sc_funcmask;
+		u.reg16 |= val;
+		bus_space_write_2(sc->sc_bst, sc->sc_bsh, off, u.reg16);
+		break;
+	case 32:
+		u.reg32 = bus_space_read_4(sc->sc_bst, sc->sc_bsh, off);
+		u.reg32 &= ~sc->sc_funcmask;
+		u.reg32 |= val;
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, u.reg32);
+		break;
+	default:
+		device_printf(sc->sc_dev, "%s: unsupported reg width %d\n",
+		__func__, sc->sc_regwidth);
+		break;
+	}
+}
+
+static int
+pinctrl_single_pins_set_config(device_t dev, const void *data, size_t len)
+{
+	struct pinctrl_single_softc * const sc = device_private(dev);
+	const u_int *pins;
+	int pinslen;
+
+	if (len != 4)
+		return -1;
+
+	const int phandle = 

CVS commit: src/sys/dev/fdt

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 15:31:15 UTC 2019

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

Log Message:
Add driver for one-register-per-pin type pinctrl devices.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/pinctrl_single.c

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



CVS commit: src/lib/libc/sys

2019-10-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 27 12:28:13 UTC 2019

Modified Files:
src/lib/libc/sys: accept.2

Log Message:
accept() is a function, not an argument!


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/accept.2

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



CVS commit: src/lib/libc/sys

2019-10-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 27 12:28:13 UTC 2019

Modified Files:
src/lib/libc/sys: accept.2

Log Message:
accept() is a function, not an argument!


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/accept.2

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

Modified files:

Index: src/lib/libc/sys/accept.2
diff -u src/lib/libc/sys/accept.2:1.33 src/lib/libc/sys/accept.2:1.34
--- src/lib/libc/sys/accept.2:1.33	Tue May  9 06:41:56 2017
+++ src/lib/libc/sys/accept.2	Sun Oct 27 12:28:13 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: accept.2,v 1.33 2017/05/09 06:41:56 abhinav Exp $
+.\"	$NetBSD: accept.2,v 1.34 2019/10/27 12:28:13 pgoyette Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)accept.2	8.2 (Berkeley) 12/11/93
 .\"
-.Dd February 8, 2017
+.Dd October 27, 2019
 .Dt ACCEPT 2
 .Os
 .Sh NAME
@@ -58,7 +58,7 @@ and is listening for connections after a
 .Xr listen 2 .
 The
 .Fn accept
-argument
+function
 extracts the first connection request on the queue of pending
 connections, creates a new socket with the same properties of
 .Fa s



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

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

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c files.ti ti_com.c ti_prcm.c ti_prcm.h
Added Files:
src/sys/arch/arm/ti: ti_edma.c ti_edma.h ti_tptc.c

Log Message:
Add EDMA TPCC and TPTC drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/am3_prcm.c \
src/sys/arch/arm/ti/ti_prcm.c src/sys/arch/arm/ti/ti_prcm.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ti/ti_com.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_edma.c \
src/sys/arch/arm/ti/ti_edma.h src/sys/arch/arm/ti/ti_tptc.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/ti/am3_prcm.c
diff -u src/sys/arch/arm/ti/am3_prcm.c:1.1 src/sys/arch/arm/ti/am3_prcm.c:1.2
--- src/sys/arch/arm/ti/am3_prcm.c:1.1	Thu Oct 26 23:28:15 2017
+++ src/sys/arch/arm/ti/am3_prcm.c	Sun Oct 27 12:14:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: am3_prcm.c,v 1.1 2017/10/26 23:28:15 jmcneill Exp $ */
+/* $NetBSD: am3_prcm.c,v 1.2 2019/10/27 12:14:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.1 2017/10/26 23:28:15 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.2 2019/10/27 12:14:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -108,6 +108,11 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER("mmc0", 0x3c, "MMC_CLK"),
 	AM3_PRCM_HWMOD_PER("mmc1", 0xf4, "MMC_CLK"),
 	AM3_PRCM_HWMOD_PER("mmc2", 0xf8, "MMC_CLK"),
+
+	AM3_PRCM_HWMOD_PER("tpcc", 0xbc, "PERIPH_CLK"),
+	AM3_PRCM_HWMOD_PER("tptc0", 0x24, "PERIPH_CLK"),
+	AM3_PRCM_HWMOD_PER("tptc1", 0xfc, "PERIPH_CLK"),
+	AM3_PRCM_HWMOD_PER("tptc2", 0x100, "PERIPH_CLK"),
 };
 
 static int
Index: src/sys/arch/arm/ti/ti_prcm.c
diff -u src/sys/arch/arm/ti/ti_prcm.c:1.1 src/sys/arch/arm/ti/ti_prcm.c:1.2
--- src/sys/arch/arm/ti/ti_prcm.c:1.1	Thu Oct 26 23:28:15 2017
+++ src/sys/arch/arm/ti/ti_prcm.c	Sun Oct 27 12:14:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_prcm.c,v 1.1 2017/10/26 23:28:15 jmcneill Exp $ */
+/* $NetBSD: ti_prcm.c,v 1.2 2019/10/27 12:14:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_prcm.c,v 1.1 2017/10/26 23:28:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_prcm.c,v 1.2 2019/10/27 12:14:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -255,3 +255,15 @@ ti_prcm_get_hwmod(const int phandle, u_i
 
 	return NULL;
 }
+
+int
+ti_prcm_enable_hwmod(const int phandle, u_int index)
+{
+	struct clk *clk;
+
+	clk = ti_prcm_get_hwmod(phandle, index);
+	if (clk == NULL)
+		return ENOENT;
+
+	return clk_enable(clk);
+}
Index: src/sys/arch/arm/ti/ti_prcm.h
diff -u src/sys/arch/arm/ti/ti_prcm.h:1.1 src/sys/arch/arm/ti/ti_prcm.h:1.2
--- src/sys/arch/arm/ti/ti_prcm.h:1.1	Thu Oct 26 23:28:15 2017
+++ src/sys/arch/arm/ti/ti_prcm.h	Sun Oct 27 12:14:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_prcm.h,v 1.1 2017/10/26 23:28:15 jmcneill Exp $ */
+/* $NetBSD: ti_prcm.h,v 1.2 2019/10/27 12:14:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -165,5 +165,6 @@ struct ti_prcm_softc {
 #endif /* !TI_PRCM_PRIVATE */
 
 struct clk *	ti_prcm_get_hwmod(const int, u_int);
+int		ti_prcm_enable_hwmod(const int, u_int);
 
 #endif /* !_ARM_TI_PRCM_H */

Index: src/sys/arch/arm/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.7 src/sys/arch/arm/ti/files.ti:1.8
--- src/sys/arch/arm/ti/files.ti:1.7	Sun Oct 27 11:33:56 2019
+++ src/sys/arch/arm/ti/files.ti	Sun Oct 27 12:14:51 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.7 2019/10/27 11:33:56 jmcneill Exp $
+#	$NetBSD: files.ti,v 1.8 2019/10/27 12:14:51 jmcneill Exp $
 #
 
 file	arch/arm/ti/ti_platform.c	soc_ti
@@ -36,6 +36,14 @@ device  cpsw: ether, ifnet, arp, mii, mi
 attach  cpsw at fdt
 filearch/arm/ti/if_cpsw.c		cpsw
 
+# EDMA
+device	tiedma
+attach	tiedma at fdt with ti_edma
+file	arch/arm/ti/ti_edma.c		ti_edma
+device	titptc
+attach	titptc at fdt with ti_tptc
+file	arch/arm/ti/ti_tptc.c		ti_tptc
+
 # SOC parameters
 defflag	opt_soc.h			SOC_TI
 defflag	opt_soc.h			SOC_TI_AM335X: SOC_TI

Index: src/sys/arch/arm/ti/ti_com.c
diff -u src/sys/arch/arm/ti/ti_com.c:1.6 src/sys/arch/arm/ti/ti_com.c:1.7
--- src/sys/arch/arm/ti/ti_com.c:1.6	Sun Oct 27 11:33:56 2019
+++ src/sys/arch/arm/ti/ti_com.c	Sun Oct 27 12:14:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_com.c,v 1.6 2019/10/27 11:33:56 jmcneill Exp $ */
+/* $NetBSD: ti_com.c,v 1.7 2019/10/27 12:14:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: ti_com.c,v 1.6 2019/10/27 11:33:56 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ti_com.c,v 1.7 2019/10/27 12:14:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -79,7 +79,6 @@ ti_com_attach(device_t parent, device_t 
 	

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

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

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c files.ti ti_com.c ti_prcm.c ti_prcm.h
Added Files:
src/sys/arch/arm/ti: ti_edma.c ti_edma.h ti_tptc.c

Log Message:
Add EDMA TPCC and TPTC drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/am3_prcm.c \
src/sys/arch/arm/ti/ti_prcm.c src/sys/arch/arm/ti/ti_prcm.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ti/ti_com.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/ti_edma.c \
src/sys/arch/arm/ti/ti_edma.h src/sys/arch/arm/ti/ti_tptc.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/ti

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 11:33:56 UTC 2019

Modified Files:
src/sys/arch/arm/ti: files.ti ti_com.c

Log Message:
Make com work again


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/ti/ti_com.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/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.6 src/sys/arch/arm/ti/files.ti:1.7
--- src/sys/arch/arm/ti/files.ti:1.6	Sat Oct 26 15:58:55 2019
+++ src/sys/arch/arm/ti/files.ti	Sun Oct 27 11:33:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.6 2019/10/26 15:58:55 jmcneill Exp $
+#	$NetBSD: files.ti,v 1.7 2019/10/27 11:33:56 jmcneill Exp $
 #
 
 file	arch/arm/ti/ti_platform.c	soc_ti
@@ -23,10 +23,8 @@ attach	am3prcm at fdt with am3_prcm
 file	arch/arm/ti/am3_prcm.c		am3_prcm
 
 # UART
-ifdef soc_ti
 attach	com at fdt with ti_com: ti_prcm
 file	arch/arm/ti/ti_com.c		ti_com needs-flag
-endif
 
 # Timer
 device	omaptimer

Index: src/sys/arch/arm/ti/ti_com.c
diff -u src/sys/arch/arm/ti/ti_com.c:1.5 src/sys/arch/arm/ti/ti_com.c:1.6
--- src/sys/arch/arm/ti/ti_com.c:1.5	Fri Oct 18 06:58:06 2019
+++ src/sys/arch/arm/ti/ti_com.c	Sun Oct 27 11:33:56 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_com.c,v 1.5 2019/10/18 06:58:06 skrll Exp $ */
+/* $NetBSD: ti_com.c,v 1.6 2019/10/27 11:33:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: ti_com.c,v 1.5 2019/10/18 06:58:06 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ti_com.c,v 1.6 2019/10/27 11:33:56 jmcneill Exp $");
 
 #include 
 #include 
@@ -106,7 +106,7 @@ ti_com_attach(device_t parent, device_t 
 		return;
 	}
 
-	hwmod = ti_prcm_get_hwmod(phandle, 0);
+	hwmod = ti_prcm_get_hwmod(OF_parent(phandle), 0);
 	KASSERT(hwmod != NULL);
 	if (clk_enable(hwmod) != 0) {
 		aprint_error(": couldn't enable module\n");



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

2019-10-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 27 11:33:56 UTC 2019

Modified Files:
src/sys/arch/arm/ti: files.ti ti_com.c

Log Message:
Make com work again


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/ti/ti_com.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/luna68k/stand/boot

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:21:52 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Back out previous - fixed differently by rin already.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/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/luna68k/stand/boot/machdep.c
diff -u src/sys/arch/luna68k/stand/boot/machdep.c:1.7 src/sys/arch/luna68k/stand/boot/machdep.c:1.8
--- src/sys/arch/luna68k/stand/boot/machdep.c:1.7	Sun Oct 27 11:08:04 2019
+++ src/sys/arch/luna68k/stand/boot/machdep.c	Sun Oct 27 11:21:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.7 2019/10/27 11:08:04 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.8 2019/10/27 11:21:52 martin Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -71,9 +71,7 @@
  */
 
 #include 
-#define _KERNEL	/* we need the register defines (PC/SP/...) */
 #include 
-#undef _KERNEL
 #include 
 
 static void dumpmem(int *, int, int);



CVS commit: src/sys/arch/luna68k/stand/boot

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:21:52 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Back out previous - fixed differently by rin already.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/machdep.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/nvmm/x86

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 11:11:09 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c

Log Message:
Mask CPUID leaf 0x0A on Intel, because we don't want the guest to try (and
fail) to probe the PMC MSRs. This avoids "Unexpected WRMSR" warnings in
qemu-nvmm.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 11:11:09 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c

Log Message:
Mask CPUID leaf 0x0A on Intel, because we don't want the guest to try (and
fail) to probe the PMC MSRs. This avoids "Unexpected WRMSR" warnings in
qemu-nvmm.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.41 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.42
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.41	Sun Oct 27 10:28:55 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Sun Oct 27 11:11:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.41 2019/10/27 10:28:55 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.42 2019/10/27 11:11:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.41 2019/10/27 10:28:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.42 2019/10/27 11:11:09 maxv Exp $");
 
 #include 
 #include 
@@ -1172,6 +1172,12 @@ vmx_inkernel_handle_cpuid(struct nvmm_cp
 		cpudata->gprs[NVMM_X64_GPR_RCX] &= nvmm_cpuid_0007.ecx;
 		cpudata->gprs[NVMM_X64_GPR_RDX] &= nvmm_cpuid_0007.edx;
 		break;
+	case 0x000A:
+		cpudata->gprs[NVMM_X64_GPR_RAX] = 0;
+		cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
+		cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
+		cpudata->gprs[NVMM_X64_GPR_RDX] = 0;
+		break;
 	case 0x000D:
 		if (vmx_xcr0_mask == 0) {
 			break;



CVS commit: src/sys/arch/luna68k/stand/boot

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:08:04 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Define _KERNEL while including reg.h: we need the (now protected) register
names.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/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/luna68k/stand/boot/machdep.c
diff -u src/sys/arch/luna68k/stand/boot/machdep.c:1.6 src/sys/arch/luna68k/stand/boot/machdep.c:1.7
--- src/sys/arch/luna68k/stand/boot/machdep.c:1.6	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/luna68k/stand/boot/machdep.c	Sun Oct 27 11:08:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.6 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.7 2019/10/27 11:08:04 martin Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -71,7 +71,9 @@
  */
 
 #include 
+#define _KERNEL	/* we need the register defines (PC/SP/...) */
 #include 
+#undef _KERNEL
 #include 
 
 static void dumpmem(int *, int, int);



CVS commit: src/sys/arch/luna68k/stand/boot

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:08:04 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Define _KERNEL while including reg.h: we need the (now protected) register
names.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/machdep.c

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



CVS commit: src

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 10:28:55 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm.3
src/sys/dev/nvmm/x86: nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c

Log Message:
Add a new VCPU conf option, that allows userland to request VMEXITs after a
TPR change. This is supported on all Intel CPUs, and not-too-old AMD CPUs.

The reason for wanting this option is that certain OSes (like Win10 64bit)
manage interrupt priority in hardware via CR8 directly, and for these OSes,
the emulator may want to sync its internal TPR state on each change.

Add two new fields in cap.arch, to report the conf capabilities. Report TPR
only on Intel for now, not AMD, because I don't have a recent AMD CPU on
which to test.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libnvmm/libnvmm.3
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/nvmm/x86/nvmm_x86.h
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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



CVS commit: src

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 10:28:55 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm.3
src/sys/dev/nvmm/x86: nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c

Log Message:
Add a new VCPU conf option, that allows userland to request VMEXITs after a
TPR change. This is supported on all Intel CPUs, and not-too-old AMD CPUs.

The reason for wanting this option is that certain OSes (like Win10 64bit)
manage interrupt priority in hardware via CR8 directly, and for these OSes,
the emulator may want to sync its internal TPR state on each change.

Add two new fields in cap.arch, to report the conf capabilities. Report TPR
only on Intel for now, not AMD, because I don't have a recent AMD CPU on
which to test.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libnvmm/libnvmm.3
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/nvmm/x86/nvmm_x86.h
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/libnvmm/libnvmm.3
diff -u src/lib/libnvmm/libnvmm.3:1.21 src/lib/libnvmm/libnvmm.3:1.22
--- src/lib/libnvmm/libnvmm.3:1.21	Sun Oct 27 07:08:15 2019
+++ src/lib/libnvmm/libnvmm.3	Sun Oct 27 10:28:55 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libnvmm.3,v 1.21 2019/10/27 07:08:15 maxv Exp $
+.\"	$NetBSD: libnvmm.3,v 1.22 2019/10/27 10:28:55 maxv Exp $
 .\"
 .\" Copyright (c) 2018, 2019 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, 2019
+.Dd October 27, 2019
 .Dt LIBNVMM 3
 .Os
 .Sh NAME
@@ -489,6 +489,7 @@ structure is used to handle VM exits:
 #define NVMM_VCPU_EXIT_INT_READY	0x1001ULL
 #define NVMM_VCPU_EXIT_NMI_READY	0x1002ULL
 #define NVMM_VCPU_EXIT_HALTED		0x1003ULL
+#define NVMM_VCPU_EXIT_TPR_CHANGED	0x1004ULL
 /* x86: instructions. */
 #define NVMM_VCPU_EXIT_RDMSR		0x2000ULL
 #define NVMM_VCPU_EXIT_WRMSR		0x2001ULL

Index: src/sys/dev/nvmm/x86/nvmm_x86.h
diff -u src/sys/dev/nvmm/x86/nvmm_x86.h:1.16 src/sys/dev/nvmm/x86/nvmm_x86.h:1.17
--- src/sys/dev/nvmm/x86/nvmm_x86.h:1.16	Wed Oct 23 07:01:11 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86.h	Sun Oct 27 10:28:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86.h,v 1.16 2019/10/23 07:01:11 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86.h,v 1.17 2019/10/27 10:28:55 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -84,6 +84,7 @@ struct nvmm_x86_exit_invalid {
 #define NVMM_VCPU_EXIT_INT_READY	0x1001ULL
 #define NVMM_VCPU_EXIT_NMI_READY	0x1002ULL
 #define NVMM_VCPU_EXIT_HALTED		0x1003ULL
+#define NVMM_VCPU_EXIT_TPR_CHANGED	0x1004ULL
 /* x86: instructions. */
 #define NVMM_VCPU_EXIT_RDMSR		0x2000ULL
 #define NVMM_VCPU_EXIT_WRMSR		0x2001ULL
@@ -118,10 +119,16 @@ struct nvmm_x86_event {
 };
 
 struct nvmm_cap_md {
+	uint64_t mach_conf_support;
+
+	uint64_t vcpu_conf_support;
+#define NVMM_CAP_ARCH_VCPU_CONF_CPUID	__BIT(0)
+#define NVMM_CAP_ARCH_VCPU_CONF_TPR	__BIT(1)
+
 	uint64_t xcr0_mask;
 	uint32_t mxcsr_mask;
 	uint32_t conf_cpuid_maxops;
-	uint64_t rsvd[6];
+	uint64_t rsvd[4];
 };
 
 #endif
@@ -261,6 +268,7 @@ struct nvmm_x64_state {
 };
 
 #define NVMM_VCPU_CONF_CPUID	NVMM_VCPU_CONF_MD_BEGIN
+#define NVMM_VCPU_CONF_TPR	(NVMM_VCPU_CONF_MD_BEGIN + 1)
 
 struct nvmm_vcpu_conf_cpuid {
 	/* The options. */
@@ -290,13 +298,18 @@ struct nvmm_vcpu_conf_cpuid {
 	} u;
 };
 
+struct nvmm_vcpu_conf_tpr {
+	uint32_t exit_changed:1;
+	uint32_t rsvd:31;
+};
+
 #define nvmm_vcpu_exit		nvmm_x86_exit
 #define nvmm_vcpu_event		nvmm_x86_event
 #define nvmm_vcpu_state		nvmm_x64_state
 
 #ifdef _KERNEL
 #define NVMM_X86_MACH_NCONF	0
-#define NVMM_X86_VCPU_NCONF	1
+#define NVMM_X86_VCPU_NCONF	2
 struct nvmm_x86_cpuid_mask {
 	uint32_t eax;
 	uint32_t ebx;

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.51 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.52
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.51	Wed Oct 23 07:01:11 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Sun Oct 27 10:28:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.51 2019/10/23 07:01:11 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.52 2019/10/27 10:28:55 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.51 2019/10/23 07:01:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.52 2019/10/27 10:28:55 maxv Exp $");
 
 #include 
 #include 
@@ -509,7 +509,9 @@ struct svm_machdata {
 
 static const size_t svm_vcpu_conf_sizes[NVMM_X86_VCPU_NCONF] = {
 	[NVMM_VCPU_CONF_MD(NVMM_VCPU_CONF_CPUID)] =
-	

CVS commit: src/sys/arch/m68k/include

2019-10-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Oct 27 09:38:10 UTC 2019

Modified Files:
src/sys/arch/m68k/include: reg.h

Log Message:
Expose register difinitions for _STANDALONE.
Fix build failure in arch/luna68k/stand/boot.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/include/reg.h

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

Modified files:

Index: src/sys/arch/m68k/include/reg.h
diff -u src/sys/arch/m68k/include/reg.h:1.20 src/sys/arch/m68k/include/reg.h:1.21
--- src/sys/arch/m68k/include/reg.h:1.20	Sat Oct 26 17:49:34 2019
+++ src/sys/arch/m68k/include/reg.h	Sun Oct 27 09:38:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: reg.h,v 1.20 2019/10/26 17:49:34 christos Exp $	*/
+/*	$NetBSD: reg.h,v 1.21 2019/10/27 09:38:09 rin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -57,7 +57,7 @@ struct fpreg {
 	int	r_fpiar;
 };
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 
 /*  this is historical (but it can't be deprecated quite yet) */
 /*
@@ -95,10 +95,14 @@ struct fpreg {
 #define	R0	D1
 #define	R1	A0
 
+#endif /* _KERNEL || _STANDALONE */
+
+#ifdef _KERNEL
+
 struct lwp;
 int	process_read_regs(struct lwp *, struct reg *);
 int	process_read_fpregs(struct lwp *, struct fpreg *, size_t *);
 
-#endif
+#endif /* _KERNEL */
 
 #endif /* !_M68K_REG_H_ */



CVS commit: src/sys/arch/m68k/include

2019-10-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Oct 27 09:38:10 UTC 2019

Modified Files:
src/sys/arch/m68k/include: reg.h

Log Message:
Expose register difinitions for _STANDALONE.
Fix build failure in arch/luna68k/stand/boot.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/include/reg.h

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



CVS commit: src/lib/libnvmm

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 08:30:05 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Use the new PTE naming, and define CR3_FRAME_* separately. No functional
change.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libnvmm/libnvmm_x86.c

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



CVS commit: src/lib/libnvmm

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 08:30:05 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Use the new PTE naming, and define CR3_FRAME_* separately. No functional
change.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libnvmm/libnvmm_x86.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/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.37 src/lib/libnvmm/libnvmm_x86.c:1.38
--- src/lib/libnvmm/libnvmm_x86.c:1.37	Wed Oct 23 12:02:55 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Sun Oct 27 08:30:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.37 2019/10/23 12:02:55 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.38 2019/10/27 08:30:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -116,7 +116,7 @@ nvmm_vcpu_dump(struct nvmm_machine *mach
 #define pte32_l1idx(va)	(((va) & PTE32_L1_MASK) >> PTE32_L1_SHIFT)
 #define pte32_l2idx(va)	(((va) & PTE32_L2_MASK) >> PTE32_L2_SHIFT)
 
-#define CR3_FRAME_32BIT	PG_FRAME
+#define CR3_FRAME_32BIT	__BITS(31, 12)
 
 typedef uint32_t pte_32bit_t;
 
@@ -138,36 +138,36 @@ x86_gva_to_gpa_32bit(struct nvmm_machine
 		return -1;
 	pdir = (pte_32bit_t *)L2hva;
 	pte = pdir[pte32_l2idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte & PTE_P) == 0)
 		return -1;
-	if ((pte & PG_u) == 0)
+	if ((pte & PTE_U) == 0)
 		*prot &= ~NVMM_PROT_USER;
-	if ((pte & PG_KW) == 0)
+	if ((pte & PTE_W) == 0)
 		*prot &= ~NVMM_PROT_WRITE;
-	if ((pte & PG_PS) && !has_pse)
+	if ((pte & PTE_PS) && !has_pse)
 		return -1;
-	if (pte & PG_PS) {
+	if (pte & PTE_PS) {
 		*gpa = (pte & PTE32_L2_FRAME);
 		*gpa = *gpa + (gva & PTE32_L1_MASK);
 		return 0;
 	}
 
 	/* Parse L1. */
-	L1gpa = (pte & PG_FRAME);
+	L1gpa = (pte & PTE_FRAME);
 	if (nvmm_gpa_to_hva(mach, L1gpa, , ) == -1)
 		return -1;
 	pdir = (pte_32bit_t *)L1hva;
 	pte = pdir[pte32_l1idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte & PTE_P) == 0)
 		return -1;
-	if ((pte & PG_u) == 0)
+	if ((pte & PTE_U) == 0)
 		*prot &= ~NVMM_PROT_USER;
-	if ((pte & PG_KW) == 0)
+	if ((pte & PTE_W) == 0)
 		*prot &= ~NVMM_PROT_WRITE;
-	if (pte & PG_PS)
+	if (pte & PTE_PS)
 		return -1;
 
-	*gpa = (pte & PG_FRAME);
+	*gpa = (pte & PTE_FRAME);
 	return 0;
 }
 
@@ -211,51 +211,51 @@ x86_gva_to_gpa_32bit_pae(struct nvmm_mac
 		return -1;
 	pdir = (pte_32bit_pae_t *)L3hva;
 	pte = pdir[pte32_pae_l3idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte & PTE_P) == 0)
 		return -1;
-	if (pte & PG_NX)
+	if (pte & PTE_NX)
 		*prot &= ~NVMM_PROT_EXEC;
-	if (pte & PG_PS)
+	if (pte & PTE_PS)
 		return -1;
 
 	/* Parse L2. */
-	L2gpa = (pte & PG_FRAME);
+	L2gpa = (pte & PTE_FRAME);
 	if (nvmm_gpa_to_hva(mach, L2gpa, , ) == -1)
 		return -1;
 	pdir = (pte_32bit_pae_t *)L2hva;
 	pte = pdir[pte32_pae_l2idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte & PTE_P) == 0)
 		return -1;
-	if ((pte & PG_u) == 0)
+	if ((pte & PTE_U) == 0)
 		*prot &= ~NVMM_PROT_USER;
-	if ((pte & PG_KW) == 0)
+	if ((pte & PTE_W) == 0)
 		*prot &= ~NVMM_PROT_WRITE;
-	if (pte & PG_NX)
+	if (pte & PTE_NX)
 		*prot &= ~NVMM_PROT_EXEC;
-	if (pte & PG_PS) {
+	if (pte & PTE_PS) {
 		*gpa = (pte & PTE32_PAE_L2_FRAME);
 		*gpa = *gpa + (gva & PTE32_PAE_L1_MASK);
 		return 0;
 	}
 
 	/* Parse L1. */
-	L1gpa = (pte & PG_FRAME);
+	L1gpa = (pte & PTE_FRAME);
 	if (nvmm_gpa_to_hva(mach, L1gpa, , ) == -1)
 		return -1;
 	pdir = (pte_32bit_pae_t *)L1hva;
 	pte = pdir[pte32_pae_l1idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte & PTE_P) == 0)
 		return -1;
-	if ((pte & PG_u) == 0)
+	if ((pte & PTE_U) == 0)
 		*prot &= ~NVMM_PROT_USER;
-	if ((pte & PG_KW) == 0)
+	if ((pte & PTE_W) == 0)
 		*prot &= ~NVMM_PROT_WRITE;
-	if (pte & PG_NX)
+	if (pte & PTE_NX)
 		*prot &= ~NVMM_PROT_EXEC;
-	if (pte & PG_PS)
+	if (pte & PTE_PS)
 		return -1;
 
-	*gpa = (pte & PG_FRAME);
+	*gpa = (pte & PTE_FRAME);
 	return 0;
 }
 
@@ -281,7 +281,7 @@ x86_gva_to_gpa_32bit_pae(struct nvmm_mac
 #define pte64_l3idx(va)	(((va) & PTE64_L3_MASK) >> PTE64_L3_SHIFT)
 #define pte64_l4idx(va)	(((va) & PTE64_L4_MASK) >> PTE64_L4_SHIFT)
 
-#define CR3_FRAME_64BIT	PG_FRAME
+#define CR3_FRAME_64BIT	__BITS(51, 12)
 
 typedef uint64_t pte_64bit_t;
 
@@ -314,75 +314,75 @@ x86_gva_to_gpa_64bit(struct nvmm_machine
 		return -1;
 	pdir = (pte_64bit_t *)L4hva;
 	pte = pdir[pte64_l4idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte & PTE_P) == 0)
 		return -1;
-	if ((pte & PG_u) == 0)
+	if ((pte & PTE_U) == 0)
 		*prot &= ~NVMM_PROT_USER;
-	if ((pte & PG_KW) == 0)
+	if ((pte & PTE_W) == 0)
 		*prot &= ~NVMM_PROT_WRITE;
-	if (pte & PG_NX)
+	if (pte & PTE_NX)
 		*prot &= ~NVMM_PROT_EXEC;
-	if (pte & PG_PS)
+	if (pte & PTE_PS)
 		return -1;
 
 	/* Parse L3. */
-	L3gpa = (pte & PG_FRAME);
+	L3gpa = (pte & PTE_FRAME);
 	if (nvmm_gpa_to_hva(mach, L3gpa, , ) == -1)
 		return -1;
 	pdir = (pte_64bit_t *)L3hva;
 	pte = pdir[pte64_l3idx(gva)];
-	if ((pte & PG_V) == 0)
+	if ((pte 

CVS commit: src

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 07:08:15 UTC 2019

Modified Files:
src/etc: MAKEDEV.tmpl group
src/lib/libnvmm: libnvmm.3 libnvmm.c nvmm.h
src/tests/lib/libnvmm: h_io_assist.c h_mem_assist.c

Log Message:
Add the "nvmm" group, and make nvmm_init() public. Sent to tech-kern@ a few
days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.34 -r1.35 src/etc/group
cvs rdiff -u -r1.20 -r1.21 src/lib/libnvmm/libnvmm.3
cvs rdiff -u -r1.16 -r1.17 src/lib/libnvmm/libnvmm.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libnvmm/h_io_assist.c
cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libnvmm/h_mem_assist.c

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.208 src/etc/MAKEDEV.tmpl:1.209
--- src/etc/MAKEDEV.tmpl:1.208	Thu Sep 19 01:44:48 2019
+++ src/etc/MAKEDEV.tmpl	Sun Oct 27 07:08:15 2019
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.208 2019/09/19 01:44:48 thorpej Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.209 2019/10/27 07:08:15 maxv Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -500,6 +500,7 @@ setup()
 	g_gpio="%gid__gpio%"
 	g_kmem="%gid_kmem%"
 	g_ntpd="%gid_ntpd%"
+	g_nvmm="%gid_nvmm%"
 	g_operator="%gid_operator%"
 	g_wheel="%gid_wheel%"
 	dialin=0
@@ -2227,7 +2228,7 @@ nvme[0-9]*)
 	;;
 
 nvmm)
-	mkdev nvmm c %nvmm_chr% 0
+	mkdev nvmm c %nvmm_chr% 0 640 $g_nvmm
 	;;
 
 autofs)

Index: src/etc/group
diff -u src/etc/group:1.34 src/etc/group:1.35
--- src/etc/group:1.34	Sat Jan  7 20:00:33 2017
+++ src/etc/group	Sun Oct 27 07:08:15 2019
@@ -29,6 +29,7 @@ _rtadvd:*:30:
 guest:*:31:root
 _unbound:*:32:
 _nsd:*:33:
+nvmm:*:34:root
 nobody:*:39:
 utmp:*:45:
 authpf:*:72:

Index: src/lib/libnvmm/libnvmm.3
diff -u src/lib/libnvmm/libnvmm.3:1.20 src/lib/libnvmm/libnvmm.3:1.21
--- src/lib/libnvmm/libnvmm.3:1.20	Fri Oct 25 09:09:24 2019
+++ src/lib/libnvmm/libnvmm.3	Sun Oct 27 07:08:15 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libnvmm.3,v 1.20 2019/10/25 09:09:24 maxv Exp $
+.\"	$NetBSD: libnvmm.3,v 1.21 2019/10/27 07:08:15 maxv Exp $
 .\"
 .\" Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -38,6 +38,8 @@
 .Sh SYNOPSIS
 .In nvmm.h
 .Ft int
+.Fn nvmm_init "void"
+.Ft int
 .Fn nvmm_capability "struct nvmm_capability *cap"
 .Ft int
 .Fn nvmm_machine_create "struct nvmm_machine *mach"
@@ -98,6 +100,12 @@ to manage virtual machines.
 A virtual CPU is described by a public structure,
 .Cd nvmm_vcpu .
 .Pp
+.Fn nvmm_init
+initializes NVMM.
+See
+.Sx NVMM Initialization
+below for details.
+.Pp
 .Fn nvmm_capability
 gets the capabilities of NVMM.
 See
@@ -277,6 +285,23 @@ from machine
 See
 .Sx Mem Assist
 below for details.
+.Ss NVMM Initialization
+NVMM initialization is performed by the
+.Fn nvmm_init
+function, which must be invoked by emulator software before any other NVMM
+function.
+.Pp
+.Fn nvmm_init
+opens the NVMM device, and expects to have the proper permissions to do so.
+In a default configuration, this implies being part of the "nvmm" group.
+If using a special configuration, emulator software should arrange to have the
+proper permissions before invoking
+.Fn nvmm_init ,
+and can drop them after the call has completed.
+.Pp
+It is to be noted that
+.Fn nvmm_init
+may perform non-re-entrant operations, and should be called only once.
 .Ss NVMM Capability
 The
 .Cd nvmm_capability

Index: src/lib/libnvmm/libnvmm.c
diff -u src/lib/libnvmm/libnvmm.c:1.16 src/lib/libnvmm/libnvmm.c:1.17
--- src/lib/libnvmm/libnvmm.c:1.16	Wed Oct 23 12:02:55 2019
+++ src/lib/libnvmm/libnvmm.c	Sun Oct 27 07:08:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm.c,v 1.16 2019/10/23 12:02:55 maxv Exp $	*/
+/*	$NetBSD: libnvmm.c,v 1.17 2019/10/27 07:08:15 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@ __area_remove_all(struct nvmm_machine *m
 
 /* -- */
 
-static int
+int
 nvmm_init(void)
 {
 	if (nvmm_fd != -1)
@@ -185,10 +185,6 @@ nvmm_capability(struct nvmm_capability *
 	struct nvmm_ioc_capability args;
 	int ret;
 
-	if (nvmm_init() == -1) {
-		return -1;
-	}
-
 	ret = ioctl(nvmm_fd, NVMM_IOC_CAPABILITY, );
 	if (ret == -1)
 		return -1;
@@ -206,10 +202,6 @@ nvmm_machine_create(struct nvmm_machine 
 	area_list_t *areas;
 	int ret;
 
-	if (nvmm_init() == -1) {
-		return -1;
-	}
-
 	areas = calloc(1, sizeof(*areas));
 	if (areas == NULL)
 		return -1;
@@ -537,10 +529,6 @@ nvmm_ctl(int op, void *data, size_t size
 	struct nvmm_ioc_ctl args;
 	int ret;
 
-	if (nvmm_init() == -1) {
-		return -1;
-	}
-
 	args.op = op;
 	args.data = data;
 	args.size = size;

Index: src/lib/libnvmm/nvmm.h
diff -u src/lib/libnvmm/nvmm.h:1.14 src/lib/libnvmm/nvmm.h:1.15
--- 

CVS commit: src

2019-10-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 27 07:08:15 UTC 2019

Modified Files:
src/etc: MAKEDEV.tmpl group
src/lib/libnvmm: libnvmm.3 libnvmm.c nvmm.h
src/tests/lib/libnvmm: h_io_assist.c h_mem_assist.c

Log Message:
Add the "nvmm" group, and make nvmm_init() public. Sent to tech-kern@ a few
days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.34 -r1.35 src/etc/group
cvs rdiff -u -r1.20 -r1.21 src/lib/libnvmm/libnvmm.3
cvs rdiff -u -r1.16 -r1.17 src/lib/libnvmm/libnvmm.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libnvmm/h_io_assist.c
cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libnvmm/h_mem_assist.c

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