CVS commit: src/sys/arch/mac68k/mac68k

2020-07-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 21 05:45:38 UTC 2020

Modified Files:
src/sys/arch/mac68k/mac68k: locore.s

Log Message:
Align tmpstk to 4-byte boundary as required by System V (ELF) ABI.

Fix GCC8-compiled kernel crash during very early boot stage when
printf decimal numbers; __umoddi3 corrupts stack frame which is not
aligned properly.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/mac68k/mac68k/locore.s

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

Modified files:

Index: src/sys/arch/mac68k/mac68k/locore.s
diff -u src/sys/arch/mac68k/mac68k/locore.s:1.171 src/sys/arch/mac68k/mac68k/locore.s:1.172
--- src/sys/arch/mac68k/mac68k/locore.s:1.171	Wed Dec 19 13:57:48 2018
+++ src/sys/arch/mac68k/mac68k/locore.s	Tue Jul 21 05:45:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.171 2018/12/19 13:57:48 maxv Exp $	*/
+/*	$NetBSD: locore.s,v 1.172 2020/07/21 05:45:38 rin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1367,6 +1367,7 @@ GLOBAL(sanity_check)
 	.long	0x18621862	| this is our stack overflow checker.
 
 	.space	4 * PAGE_SIZE
+	.align	4
 ASLOCAL(tmpstk)
 
 GLOBAL(machineid)



CVS commit: src/sys/compat/netbsd32

2020-07-20 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Jul 21 05:33:51 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Add lockstat(1) ioctl handling.

mrg@: "looks ok."


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.71 -r1.72 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.113 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.114
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.113	Sat Jul 18 12:46:19 2020
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Tue Jul 21 05:33:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.113 2020/07/18 12:46:19 jmcneill Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.113 2020/07/18 12:46:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -1043,6 +1043,54 @@ netbsd32_from_dkwedge_list(const struct 
 	s32p->dkwl_ncopied = p->dkwl_ncopied;
 }
 
+static inline void
+netbsd32_to_lsenable(struct netbsd32_lsenable *le32, struct lsenable *le,
+u_long cmd)
+{
+
+	le->le_csstart = le32->le_csstart;
+	le->le_csend = le32->le_csend;
+	le->le_lockstart = le32->le_lockstart;
+	le->le_lockend = le32->le_lockend;
+	le->le_nbufs = le32->le_nbufs;
+	le->le_flags = le32->le_flags;
+	le->le_mask = le32->le_mask;
+}
+
+static inline void
+netbsd32_from_lsenable(struct lsenable *le, struct netbsd32_lsenable *le32,
+u_long cmd)
+{
+
+	le32->le_csstart = le->le_csstart;
+	le32->le_csend = le->le_csend;
+	le32->le_lockstart = le->le_lockstart;
+	le32->le_lockend = le->le_lockend;
+	le32->le_nbufs = le->le_nbufs;
+	le32->le_flags = le->le_flags;
+	le32->le_mask = le->le_mask;
+}
+
+static inline void
+netbsd32_to_lsdisable(struct netbsd32_lsdisable *ld32, struct lsdisable *ld,
+u_long cmd)
+{
+
+	ld->ld_size = ld32->ld_size;
+	netbsd32_to_timespec(>ld_time, >ld_time);
+	memcpy(>ld_time, >ld_time, sizeof(ld->ld_time));
+}
+
+static inline void
+netbsd32_from_lsdisable(struct lsdisable *ld, struct netbsd32_lsdisable *ld32,
+u_long cmd)
+{
+
+	ld->ld_size = ld32->ld_size;
+	netbsd32_from_timespec(>ld_time, >ld_time);
+	memcpy(>ld_time, >ld_time, sizeof(ld->ld_time));
+}
+
 #ifdef NTP
 static int
 netbsd32_do_clockctl_ntp_adjtime(struct file *fp,
@@ -1540,6 +1588,11 @@ netbsd32_ioctl(struct lwp *l,
 	case DIOCLWEDGES32:
 		IOCTL_STRUCT_CONV_TO(DIOCLWEDGES, dkwedge_list);
 
+	case IOC_LOCKSTAT_ENABLE32:
+		IOCTL_STRUCT_CONV_TO(IOC_LOCKSTAT_ENABLE, lsenable);
+	case IOC_LOCKSTAT_DISABLE32:
+		IOCTL_STRUCT_CONV_TO(IOC_LOCKSTAT_DISABLE, lsdisable);
+
 	default:
 #ifdef NETBSD32_DRMKMS
 		if (IOCGROUP(com) == 'd') {

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.71 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.72
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.71	Sat Jul 18 12:46:19 2020
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Tue Jul 21 05:33:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.71 2020/07/18 12:46:19 jmcneill Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.72 2020/07/21 05:33:51 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -35,6 +35,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -629,4 +630,24 @@ struct netbsd32_disk_strategy {
 #define DIOCGSTRATEGY32		_IOR('d', 125, struct netbsd32_disk_strategy)
 #define DIOCSSTRATEGY32		_IOW('d', 126, struct netbsd32_disk_strategy)
 
+/* from  */
+struct netbsd32_lsenable {
+	netbsd32_uintptr_t	le_csstart;	/* callsite start */
+	netbsd32_uintptr_t	le_csend;	/* callsite end */
+	netbsd32_uintptr_t	le_lockstart;	/* lock address start */
+	netbsd32_uintptr_t	le_lockend;	/* lock address end */
+	netbsd32_uintptr_t	le_nbufs;	/* buffers to allocate, 0 = default */
+	u_int			le_flags;	/* request flags */
+	u_int			le_mask;	/* event mask (LB_*) */
+};
+
+struct netbsd32_lsdisable {
+	netbsd32_size_t		ld_size;	/* buffer space allocated */
+	struct netbsd32_timespec ld_time;	/* time spent enabled */
+	uint64_t		ld_freq[64];	/* counter HZ by CPU number */
+} __packed;
+
+#define	IOC_LOCKSTAT_ENABLE32	_IOW('L', 1, struct netbsd32_lsenable)
+#define	IOC_LOCKSTAT_DISABLE32	_IOR('L', 2, struct netbsd32_lsdisable)
+
 int	netbsd32_drm_ioctl(struct file *, unsigned long, void *, struct lwp *);



CVS commit: src/usr.bin/netstat

2020-07-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Jul 21 04:58:44 UTC 2020

Modified Files:
src/usr.bin/netstat: netstat.1

Log Message:
netstat.1: add various xrefs present in the body to "See Also"


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/netstat/netstat.1

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

Modified files:

Index: src/usr.bin/netstat/netstat.1
diff -u src/usr.bin/netstat/netstat.1:1.73 src/usr.bin/netstat/netstat.1:1.74
--- src/usr.bin/netstat/netstat.1:1.73	Thu May 12 03:44:11 2016
+++ src/usr.bin/netstat/netstat.1	Tue Jul 21 04:58:43 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: netstat.1,v 1.73 2016/05/12 03:44:11 ozaki-r Exp $
+.\"	$NetBSD: netstat.1,v 1.74 2020/07/21 04:58:43 gutteridge Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1992, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)netstat.1	8.8 (Berkeley) 4/18/94
 .\"
-.Dd May 12, 2016
+.Dd July 21, 2020
 .Dt NETSTAT 1
 .Os
 .Sh NAME
@@ -432,12 +432,17 @@ And the fifth character shows the header
 .Xr sockstat 1 ,
 .Xr vmstat 1 ,
 .Xr inet 3 ,
+.Xr kvm 3 ,
+.Xr kvm_openfiles 3 ,
+.Xr sysctl 3 ,
 .Xr bpf 4 ,
+.Xr route 4 ,
 .Xr hosts 5 ,
 .Xr networks 5 ,
 .Xr protocols 5 ,
 .Xr services 5 ,
 .Xr iostat 8 ,
+.Xr route 8 ,
 .Xr trpt 8
 .Sh HISTORY
 The



CVS commit: src/games/fortune

2020-07-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jul 21 03:05:40 UTC 2020

Modified Files:
src/games/fortune/fortune: fortune.c
src/games/fortune/strfile: strfile.c

Log Message:
fortune: arc4random_uniform for better uniform values than random() % ...


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/games/fortune/fortune/fortune.c
cvs rdiff -u -r1.40 -r1.41 src/games/fortune/strfile/strfile.c

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/fortune/fortune.c
diff -u src/games/fortune/fortune/fortune.c:1.64 src/games/fortune/fortune/fortune.c:1.65
--- src/games/fortune/fortune/fortune.c:1.64	Tue Jun 19 05:46:08 2012
+++ src/games/fortune/fortune/fortune.c	Tue Jul 21 03:05:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fortune.c,v 1.64 2012/06/19 05:46:08 dholland Exp $	*/
+/*	$NetBSD: fortune.c,v 1.65 2020/07/21 03:05:40 nia Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)fortune.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.64 2012/06/19 05:46:08 dholland Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.65 2020/07/21 03:05:40 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -190,7 +190,6 @@ static size_t maxlen_in_list(FILEDESC *)
 int
 main(int ac, char *av[])
 {
-	struct timeval tv;
 #ifdef OK_TO_WRITE_DISK
 	int fd;
 #endif /* OK_TO_WRITE_DISK */
@@ -203,12 +202,6 @@ main(int ac, char *av[])
 #endif
 
 	init_prob();
-	if (gettimeofday(, NULL) != 0)
-		err(1, "gettimeofday()");
-	srandom(((unsigned long)tv.tv_sec)*
-((unsigned long)tv.tv_usec+1) *
-	((unsigned long)getpid()+1)   *
-((unsigned long)getppid()+1));
 	do {
 		get_fort();
 	} while ((Short_only && fortlen() > SLEN) ||
@@ -933,7 +926,7 @@ get_fort(void)
 	if (File_list->next == NULL || File_list->percent == NO_PROB)
 		fp = File_list;
 	else {
-		choice = random() % 100;
+		choice = arc4random_uniform(100);
 		DPRINTF(1, (stderr, "choice = %d\n", choice));
 		for (fp = File_list; fp->percent != NO_PROB; fp = fp->next)
 			if (choice < fp->percent)
@@ -953,7 +946,7 @@ get_fort(void)
 	else {
 		if (fp->next != NULL) {
 			sum_noprobs(fp);
-			choice = random() % Noprob_tbl.str_numstr;
+			choice = arc4random_uniform(Noprob_tbl.str_numstr);
 			DPRINTF(1, (stderr, "choice = %d (of %d) \n", choice,
 Noprob_tbl.str_numstr));
 			while ((u_int32_t)choice >= fp->tbl.str_numstr) {
@@ -994,7 +987,7 @@ pick_child(FILEDESC *parent)
 	int  choice;
 
 	if (Equal_probs) {
-		choice = random() % parent->num_children;
+		choice = arc4random_uniform(parent->num_children);
 		DPRINTF(1, (stderr, "choice = %d (of %d)\n",
 			choice, parent->num_children));
 		for (fp = parent->child; choice--; fp = fp->next)
@@ -1004,7 +997,7 @@ pick_child(FILEDESC *parent)
 	}
 	else {
 		get_tbl(parent);
-		choice = random() % parent->tbl.str_numstr;
+		choice = arc4random_uniform(parent->tbl.str_numstr);
 		DPRINTF(1, (stderr, "choice = %d (of %d)\n",
 			choice, parent->tbl.str_numstr));
 		for (fp = parent->child; (u_int32_t)choice >= fp->tbl.str_numstr;
@@ -1084,13 +1077,13 @@ get_pos(FILEDESC *fp)
 #ifdef OK_TO_WRITE_DISK
 		if ((fd = open(fp->posfile, O_RDONLY)) < 0 ||
 		read(fd, >pos, sizeof fp->pos) != sizeof fp->pos)
-			fp->pos = random() % fp->tbl.str_numstr;
+			fp->pos = arc4random_uniform(fp->tbl.str_numstr);
 		else if (fp->pos >= fp->tbl.str_numstr)
 			fp->pos %= fp->tbl.str_numstr;
 		if (fd >= 0)
 			(void) close(fd);
 #else
-		fp->pos = random() % fp->tbl.str_numstr;
+		fp->pos = arc4random_uniform(fp->tbl.str_numstr);
 #endif /* OK_TO_WRITE_DISK */
 	}
 	if ((u_int64_t)++(fp->pos) >= fp->tbl.str_numstr)

Index: src/games/fortune/strfile/strfile.c
diff -u src/games/fortune/strfile/strfile.c:1.40 src/games/fortune/strfile/strfile.c:1.41
--- src/games/fortune/strfile/strfile.c:1.40	Thu Apr 30 12:32:26 2020
+++ src/games/fortune/strfile/strfile.c	Tue Jul 21 03:05:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strfile.c,v 1.40 2020/04/30 12:32:26 christos Exp $	*/
+/*	$NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)strfile.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: strfile.c,v 1.40 2020/04/30 12:32:26 christos Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $");
 #endif
 #endif /* not lint */
 #endif /* __NetBSD__ */
@@ -438,8 +438,6 @@ randomize(void)
 	off_t	tmp;
 	off_t	*sp;
 
-	srandom((int)(time(NULL) + getpid()));
-
 	Tbl.str_flags |= STR_RANDOM;
 	cnt = Tbl.str_numstr;
 
@@ -448,7 +446,7 @@ randomize(void)
 	 */
 
 	for (sp = Seekpts; cnt > 0; cnt--, sp++) {
-		i = random() % cnt;
+		i = arc4random_uniform(cnt);
 		tmp = sp[0];
 		sp[0] = sp[i];
 		sp[i] = tmp;



CVS commit: src/games/tetris

2020-07-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jul 21 02:42:05 UTC 2020

Modified Files:
src/games/tetris: tetris.c tetris.h

Log Message:
tetris: Use arc4random_uniform instead of modulo for better randomness


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/games/tetris/tetris.c
cvs rdiff -u -r1.15 -r1.16 src/games/tetris/tetris.h

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

Modified files:

Index: src/games/tetris/tetris.c
diff -u src/games/tetris/tetris.c:1.32 src/games/tetris/tetris.c:1.33
--- src/games/tetris/tetris.c:1.32	Thu Mar  3 21:38:55 2016
+++ src/games/tetris/tetris.c	Tue Jul 21 02:42:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tetris.c,v 1.32 2016/03/03 21:38:55 nat Exp $	*/
+/*	$NetBSD: tetris.c,v 1.33 2020/07/21 02:42:05 nia Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -207,7 +207,6 @@ main(int argc, char *argv[])
 	scr_init();
 	setup_board();
 
-	srandom(getpid());
 	scr_set();
 
 	pos = A_FIRST*B_COLS + (B_COLS/2)-1;

Index: src/games/tetris/tetris.h
diff -u src/games/tetris/tetris.h:1.15 src/games/tetris/tetris.h:1.16
--- src/games/tetris/tetris.h:1.15	Thu Mar  3 21:38:55 2016
+++ src/games/tetris/tetris.h	Tue Jul 21 02:42:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tetris.h,v 1.15 2016/03/03 21:38:55 nat Exp $	*/
+/*	$NetBSD: tetris.h,v 1.16 2020/07/21 02:42:05 nia Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -130,7 +130,7 @@ struct shape {
 };
 
 extern const struct shape shapes[];
-#define	randshape() ([random() % 7])
+#define	randshape() ([arc4random_uniform(7)])
 
 extern const struct shape *nextshape;
 



CVS commit: src/distrib/notes/evbarm

2020-07-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Jul 21 02:21:12 UTC 2020

Modified Files:
src/distrib/notes/evbarm: contents

Log Message:
Fix location of device trees


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/notes/evbarm/contents

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

Modified files:

Index: src/distrib/notes/evbarm/contents
diff -u src/distrib/notes/evbarm/contents:1.10 src/distrib/notes/evbarm/contents:1.11
--- src/distrib/notes/evbarm/contents:1.10	Sat Jul 18 17:20:59 2020
+++ src/distrib/notes/evbarm/contents	Tue Jul 21 02:21:12 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.10 2020/07/18 17:20:59 nia Exp $
+.\"	$NetBSD: contents,v 1.11 2020/07/21 02:21:12 nia Exp $
 .\"
 .\" Copyright (c) 1999-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -61,8 +61,6 @@ operating system for a range of 64-bit d
 A gzipped writable image containing the complete 32-bit
 .Nx
 operating system for Raspberry Pi variants only (includes RPI kernels).
-.			It Pa *.dtb.gz
-Gzipped board-specific device trees.
 .		tag) \" binary/gzimg/
 .		It Pa kernel/
 .		(tag netbsd.gz -compact \" binary/kernel
@@ -76,6 +74,8 @@ do not need board-specific kernels.
 A gzipped ARMv6 kernel which supports the Raspberry Pi 1 only.
 .			It Pa netbsd-RPI2.gz
 A gzipped ARMv6 kernel which supports the Raspberry Pi 2 only.
+.			It Pa *.dtb.gz
+Gzipped board-specific device trees.
 .		tag) \" binary/kernel/
 .
 .		It Pa sets/



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 21:33:13 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): extract :ts modifier into separate function


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.288 src/usr.bin/make/var.c:1.289
--- src/usr.bin/make/var.c:1.288	Mon Jul 20 20:56:39 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 21:33:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.288 2020/07/20 20:56:39 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.289 2020/07/20 21:33:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.288 2020/07/20 20:56:39 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.289 2020/07/20 21:33:13 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.288 2020/07/20 20:56:39 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.289 2020/07/20 21:33:13 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2599,101 +2599,101 @@ VarModify_Copy(GNode *ctx MAKE_ATTR_UNUS
 SepBuf_AddBytes(buf, word, strlen(word));
 }
 
-/* :tA, :tu, :tl, etc. */
+/* :ts */
+static Boolean
+ApplyModifier_ToSep(ApplyModifiersState *st)
+{
+const char *sep = st->tstr + 2;
+
+if (sep[0] != st->endc && (sep[1] == st->endc || sep[1] == ':')) {
+	/* ":ts" or ":ts:" */
+	st->parsestate.varSpace = sep[0];
+	st->cp = sep + 1;
+} else if (sep[0] == st->endc || sep[0] == ':') {
+	/* ":ts" or ":ts:" */
+	st->parsestate.varSpace = 0;	/* no separator */
+	st->cp = sep;
+} else if (sep[0] == '\\') {
+	const char *xp = sep + 1;
+	int base = 8;		/* assume octal */
+
+	switch (sep[1]) {
+	case 'n':
+	st->parsestate.varSpace = '\n';
+	st->cp = sep + 2;
+	break;
+	case 't':
+	st->parsestate.varSpace = '\t';
+	st->cp = sep + 2;
+	break;
+	case 'x':
+	base = 16;
+	xp++;
+	goto get_numeric;
+	case '0':
+	base = 0;
+	goto get_numeric;
+	default:
+	if (!isdigit((unsigned char)sep[1]))
+		return FALSE;	/* ":ts". */
+
+	char *end;
+	get_numeric:
+	st->parsestate.varSpace = strtoul(sep + 1 + (sep[1] == 'x'), , base);
+	if (*end != ':' && *end != st->endc)
+	return FALSE;
+	st->cp = end;
+	break;
+	}
+} else {
+	return FALSE;		/* Found ":ts". */
+}
+
+st->termc = *st->cp;
+st->newStr = VarModify(st->ctxt, >parsestate, st->nstr,
+			   VarModify_Copy, NULL);
+return TRUE;
+}
+
+/* :tA, :tu, :tl, :ts, etc. */
 static Boolean
 ApplyModifier_To(ApplyModifiersState *st)
 {
 st->cp = st->tstr + 1;	/* make sure it is set */
-if (st->tstr[1] != st->endc && st->tstr[1] != ':') {
-	if (st->tstr[1] == 's') {
-	/* Use the char (if any) at st->tstr[2] as the word separator. */
-
-	if (st->tstr[2] != st->endc &&
-		(st->tstr[3] == st->endc || st->tstr[3] == ':')) {
-		/* ":ts" or
-		 * ":ts:" */
-		st->parsestate.varSpace = st->tstr[2];
-		st->cp = st->tstr + 3;
-	} else if (st->tstr[2] == st->endc || st->tstr[2] == ':') {
-		/* ":ts" or ":ts:" */
-		st->parsestate.varSpace = 0;	/* no separator */
-		st->cp = st->tstr + 2;
-	} else if (st->tstr[2] == '\\') {
-		const char *xp = >tstr[3];
-		int base = 8;	/* assume octal */
-
-		switch (st->tstr[3]) {
-		case 'n':
-		st->parsestate.varSpace = '\n';
-		st->cp = st->tstr + 4;
-		break;
-		case 't':
-		st->parsestate.varSpace = '\t';
-		st->cp = st->tstr + 4;
-		break;
-		case 'x':
-		base = 16;
-		xp++;
-		goto get_numeric;
-		case '0':
-		base = 0;
-		goto get_numeric;
-		default:
-		if (isdigit((unsigned char)st->tstr[3])) {
-			char *ep;
-		get_numeric:
-			st->parsestate.varSpace = strtoul(xp, , base);
-			if (*ep != ':' && *ep != st->endc)
-			return FALSE;
-			st->cp = ep;
-		} else {
-			/* ":ts". */
-			return FALSE;
-		}
-		break;
-		}
-	} else {
-		/* Found ":ts". */
-		return FALSE;
-	}
+if (st->tstr[1] == st->endc || st->tstr[1] == ':')
+	return FALSE;		/* Found ":t" or ":t:". */
 
-	st->termc = *st->cp;
-	st->newStr = VarModify(st->ctxt, >parsestate, st->nstr,
-   VarModify_Copy, NULL);
-	} else if (st->tstr[2] == st->endc || st->tstr[2] == ':') {
-	/* Check for two-character options: ":tu", ":tl" */
-	if (st->tstr[1] == 'A') {	/* absolute path */
-		st->newStr = VarModify(
-			st->ctxt, >parsestate, st->nstr, VarRealpath, NULL);
-		st->cp = st->tstr + 2;
-		st->termc = *st->cp;
-	} else if (st->tstr[1] == 'u') {
-		char *dp = bmake_strdup(st->nstr);
-		for (st->newStr = dp; *dp; dp++)
-		*dp = toupper((unsigned char)*dp);
-		st->cp = st->tstr + 2;
-		st->termc = *st->cp;
-	   

CVS commit: src/sys/external/bsd/drm2/via

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 21:29:38 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/via: via_pci.c

Log Message:
viadrmums: Stop gracefully at the end of the PCI id list.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/via/via_pci.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/external/bsd/drm2/via/via_pci.c
diff -u src/sys/external/bsd/drm2/via/via_pci.c:1.3 src/sys/external/bsd/drm2/via/via_pci.c:1.4
--- src/sys/external/bsd/drm2/via/via_pci.c:1.3	Mon Aug 27 14:12:44 2018
+++ src/sys/external/bsd/drm2/via/via_pci.c	Mon Jul 20 21:29:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: via_pci.c,v 1.3 2018/08/27 14:12:44 riastradh Exp $	*/
+/*	$NetBSD: via_pci.c,v 1.4 2020/07/20 21:29:38 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: via_pci.c,v 1.3 2018/08/27 14:12:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_pci.c,v 1.4 2020/07/20 21:29:38 riastradh Exp $");
 
 #include 
 #include 
@@ -70,6 +70,9 @@ viadrm_lookup(const struct pci_attach_ar
 	unsigned i;
 
 	for (i = 0; i < __arraycount(viadrm_pci_ids); i++) {
+		if (viadrm_pci_ids[i].vendor == 0 &&
+		viadrm_pci_ids[i].device == 0)
+			break;
 		KASSERT(viadrm_pci_ids[i].subvendor == PCI_ANY_ID);
 		KASSERT(viadrm_pci_ids[i].subdevice == PCI_ANY_ID);
 		KASSERT(viadrm_pci_ids[i].class == 0);



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 20:56:39 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): clean up implementation of :[...] and other modifiers


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.287 src/usr.bin/make/var.c:1.288
--- src/usr.bin/make/var.c:1.287	Mon Jul 20 19:53:40 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 20:56:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.287 2020/07/20 19:53:40 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.288 2020/07/20 20:56:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.287 2020/07/20 19:53:40 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.288 2020/07/20 20:56:39 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.287 2020/07/20 19:53:40 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.288 2020/07/20 20:56:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -240,8 +240,8 @@ typedef enum {
 VARP_SUB_GLOBAL	= 0x01,	/* Apply substitution globally */
 VARP_SUB_ONE	= 0x02,	/* Apply substitution to one word */
 VARP_SUB_MATCHED	= 0x04,	/* There was a match */
-VARP_MATCH_START	= 0x08,	/* Match at start of word */
-VARP_MATCH_END	= 0x10	/* Match at end of word */
+VARP_ANCHOR_START	= 0x08,	/* Match at start of word */
+VARP_ANCHOR_END	= 0x10	/* Match at end of word */
 } VarPatternFlags;
 
 typedef enum {
@@ -1354,12 +1354,12 @@ VarSubstitute(GNode *ctx MAKE_ATTR_UNUSE
 	(VARP_SUB_ONE | VARP_SUB_MATCHED))
 	goto nosub;
 
-if (args->pflags & VARP_MATCH_START) {
+if (args->pflags & VARP_ANCHOR_START) {
 	if (wordLen < args->lhsLen ||
 	memcmp(word, args->lhs, args->lhsLen) != 0)
 	goto nosub;
 
-	if (args->pflags & VARP_MATCH_END) {
+	if (args->pflags & VARP_ANCHOR_END) {
 	if (wordLen != args->lhsLen)
 		goto nosub;
 
@@ -1373,7 +1373,7 @@ VarSubstitute(GNode *ctx MAKE_ATTR_UNUSE
 	return;
 }
 
-if (args->pflags & VARP_MATCH_END) {
+if (args->pflags & VARP_ANCHOR_END) {
 	if (wordLen < args->lhsLen)
 	goto nosub;
 	const char *start = word + (wordLen - args->lhsLen);
@@ -1886,7 +1886,7 @@ VarRange(const char *str, int ac)
  *
  * If length is specified, return the string length of the buffer.
  * If mpflags is specified and the last character of the pattern is a $,
- * set the VARP_MATCH_END bit of mpflags.
+ * set the VARP_ANCHOR_END bit of mpflags.
  */
 static char *
 ParseModifierPart(GNode *ctxt, const char **tstr, int delim,
@@ -1916,15 +1916,11 @@ ParseModifierPart(GNode *ctxt, const cha
 	Buf_AddByte(, cp[1]);
 	cp++;
 	} else if (*cp == '$') {
-	if (cp[1] == delim) {
+	if (cp[1] == delim) {	/* Unescaped $ at end of pattern */
 		if (mpflags == NULL)
 		Buf_AddByte(, *cp);
 		else
-		/*
-		 * Unescaped $ at end of pattern => anchor
-		 * pattern at end.
-		 */
-		*mpflags |= VARP_MATCH_END;
+		*mpflags |= VARP_ANCHOR_END;
 	} else {
 		if (!(eflags & VARE_NOSUBST)) {
 		char   *cp2;
@@ -2164,13 +2160,15 @@ ApplyModifier_At(ApplyModifiersState *st
 
 st->cp = ++st->tstr;
 st->delim = '@';
-loop.tvar = ParseModifierPart(
-	st->ctxt, >cp, st->delim, st->eflags | VARE_NOSUBST, NULL, NULL, NULL);
+loop.tvar = ParseModifierPart(st->ctxt, >cp, st->delim,
+  st->eflags | VARE_NOSUBST,
+  NULL, NULL, NULL);
 if (loop.tvar == NULL)
 	return FALSE;
 
-loop.str = ParseModifierPart(
-	st->ctxt, >cp, st->delim, st->eflags | VARE_NOSUBST, NULL, NULL, NULL);
+loop.str = ParseModifierPart(st->ctxt, >cp, st->delim,
+ st->eflags | VARE_NOSUBST,
+ NULL, NULL, NULL);
 if (loop.str == NULL)
 	return FALSE;
 
@@ -2389,22 +2387,14 @@ ApplyModifier_Range(ApplyModifiersState 
 static void
 ApplyModifier_Match(ApplyModifiersState *st)
 {
-char*pattern;
-const char *endpat;		/* points just after end of pattern */
-char*cp2;
-Boolean copy;		/* pattern should be, or has been, copied */
-Boolean needSubst;
-int nest;
-
-copy = FALSE;
-needSubst = FALSE;
-nest = 1;
+Boolean copy = FALSE;	/* pattern should be, or has been, copied */
+Boolean needSubst = FALSE;
 /*
- * In the loop below, ignore ':' unless we are at
- * (or back to) the original brace level.
- * XXX This will likely not work right if $() and ${}
- * are intermixed.
+ * In the loop below, ignore ':' unless we are at (or back to) the
+ * original brace level.
+ * XXX This will likely not work right if $() and ${} are intermixed.
  */
+int nest = 1;
 for (st->cp = st->tstr 

CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 19:53:40 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h var.c
src/usr.bin/make/unit-tests: modmisc.exp

Log Message:
make(1): fix edge cases with $ at the end of the :@ modifier

In both parts of the :@ modifier, by passing  to
ParseModifierPart, a final $ was interpreted as an anchor, which only
makes sense in the :S and :C modifiers.

This edge case is neither used by src nor by pkgsrc, except for the unit
tests that have been adjusted.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/var.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/modmisc.exp

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.81 src/usr.bin/make/nonints.h:1.82
--- src/usr.bin/make/nonints.h:1.81	Mon Jul 20 18:12:48 2020
+++ src/usr.bin/make/nonints.h	Mon Jul 20 19:53:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.81 2020/07/20 18:12:48 sjg Exp $	*/
+/*	$NetBSD: nonints.h,v 1.82 2020/07/20 19:53:40 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -179,9 +179,14 @@ void Targ_Propagate_Wait(void);
 /* var.c */
 
 typedef enum {
-	VARE_UNDEFERR = 1,
-	VARE_WANTRES = 2,
-	VARE_ASSIGN = 4
+/* Treat undefined variables as errors. */
+VARE_UNDEFERR	= 0x01,
+/* Actually evaluate the text, fully expanding variables.
+ * Without this flag, the text is only parsed but not evaluated. */
+VARE_WANTRES	= 0x02,
+VARE_ASSIGN		= 0x04,
+/* Return the literal text, without expanding variables. */
+VARE_NOSUBST	= 0x08
 } VarEvalFlags;
 
 void Var_Delete(const char *, GNode *);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.286 src/usr.bin/make/var.c:1.287
--- src/usr.bin/make/var.c:1.286	Mon Jul 20 18:12:48 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 19:53:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.286 2020/07/20 18:12:48 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.287 2020/07/20 19:53:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.286 2020/07/20 18:12:48 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.287 2020/07/20 19:53:40 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.286 2020/07/20 18:12:48 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.287 2020/07/20 19:53:40 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -241,11 +241,7 @@ typedef enum {
 VARP_SUB_ONE	= 0x02,	/* Apply substitution to one word */
 VARP_SUB_MATCHED	= 0x04,	/* There was a match */
 VARP_MATCH_START	= 0x08,	/* Match at start of word */
-VARP_MATCH_END	= 0x10,	/* Match at end of word */
-
-/* FIXME: This constant doesn't belong here.
- * It is not related to pattern matching. */
-VAR_NOSUBST	= 0x20		/* don't expand vars in ParseModifierPart */
+VARP_MATCH_END	= 0x10	/* Match at end of word */
 } VarPatternFlags;
 
 typedef enum {
@@ -1879,7 +1875,7 @@ VarRange(const char *str, int ac)
 /*-
  * Parse a text part of a modifier such as the "from" and "to" in :S/from/to/
  * or the :@ modifier. Nested variables in the text are expanded unless
- * VAR_NOSUBST is set.
+ * VARE_NOSUBST is set.
  *
  * The text part is parsed until the next delimiter.  To escape the delimiter,
  * a backslash or a dollar, put a backslash before it.
@@ -1930,8 +1926,7 @@ ParseModifierPart(GNode *ctxt, const cha
 		 */
 		*mpflags |= VARP_MATCH_END;
 	} else {
-		/* FIXME: mismatch between mpflags and VAR_NOSUBST */
-		if (mpflags == NULL || !(*mpflags & VAR_NOSUBST)) {
+		if (!(eflags & VARE_NOSUBST)) {
 		char   *cp2;
 		int len;
 		void   *freeIt;
@@ -2166,17 +2161,16 @@ typedef struct {
 static Boolean
 ApplyModifier_At(ApplyModifiersState *st) {
 VarLoop loop;
-VarPatternFlags pflags = VAR_NOSUBST; /* FIXME: mismatch between pflags and VAR_NOSUBST */
 
 st->cp = ++st->tstr;
 st->delim = '@';
 loop.tvar = ParseModifierPart(
-	st->ctxt, >cp, st->delim, st->eflags, , NULL, NULL);
+	st->ctxt, >cp, st->delim, st->eflags | VARE_NOSUBST, NULL, NULL, NULL);
 if (loop.tvar == NULL)
 	return FALSE;
 
 loop.str = ParseModifierPart(
-	st->ctxt, >cp, st->delim, st->eflags, , NULL, NULL);
+	st->ctxt, >cp, st->delim, st->eflags | VARE_NOSUBST, NULL, NULL, NULL);
 if (loop.str == NULL)
 	return FALSE;
 
@@ -2942,8 +2936,6 @@ ApplyModifier_Assign(ApplyModifiersState
 	return 'd';		/* "::" */
 
 GNode *v_ctxt;		/* context where v belongs */
-VarPatternFlags pflags;
-/* FIXME: Assign has nothing to do with VarPatternFlags */
 
 if (st->v->name[0] == 0)
 	return 'b';
@@ -2977,9 +2969,9 @@ 

CVS commit: src/usr.bin/make/unit-tests

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 19:03:26 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk

Log Message:
make(1): add test for nested assignments

This test demonstrates that in ApplyModifier_Assign, the call to
ParseModifierPart must get its pflags.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/modmisc.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.21 src/usr.bin/make/unit-tests/modmisc.exp:1.22
--- src/usr.bin/make/unit-tests/modmisc.exp:1.21	Mon Jul 20 16:12:02 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Mon Jul 20 19:03:25 2020
@@ -78,5 +78,9 @@ mod-assign: appended=1 2 3.
 3
 mod-assign: ran:3.
 mod-assign: global: 1, 3, 1 2 3, 3.
+mod-assign-nested: then1t1
+mod-assign-nested: else2e2
+mod-assign-nested: then3t3
+mod-assign-nested: else4e4
 mod-tu-space: A   B
 exit status 0

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.17 src/usr.bin/make/unit-tests/modmisc.mk:1.18
--- src/usr.bin/make/unit-tests/modmisc.mk:1.17	Mon Jul 20 16:12:02 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Mon Jul 20 19:03:25 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.17 2020/07/20 16:12:02 rillig Exp $
+# $Id: modmisc.mk,v 1.18 2020/07/20 19:03:25 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -20,6 +20,7 @@ all:	mod-S mod-C mod-at-varname mod-at-r
 all:	mod-subst-dollar mod-loop-dollar
 all:	mod-C-limits
 all:	mod-assign
+all:	mod-assign-nested
 all:	mod-tu-space
 
 modsysv:
@@ -158,6 +159,14 @@ mod-assign:
 	# preserved even after the shell command has been run.
 	@echo $@: global: ${FIRST:Q}, ${LAST:Q}, ${APPENDED:Q}, ${RAN:Q}.
 
+mod-assign-nested:
+	@echo $@: ${1:?${THEN1::=then1${IT1::=t1}}:${ELSE1::=else1${IE1::=e1}}}${THEN1}${ELSE1}${IT1}${IE1}
+	@echo $@: ${0:?${THEN2::=then2${IT2::=t2}}:${ELSE2::=else2${IE2::=e2}}}${THEN2}${ELSE2}${IT2}${IE2}
+	@echo $@: ${SINK3:Q}
+	@echo $@: ${SINK4:Q}
+SINK3:=	${1:?${THEN3::=then3${IT3::=t3}}:${ELSE3::=else3${IE3::=e3}}}${THEN3}${ELSE3}${IT3}${IE3}
+SINK4:=	${0:?${THEN4::=then4${IT4::=t4}}:${ELSE4::=else4${IE4::=e4}}}${THEN4}${ELSE4}${IT4}${IE4}
+
 mod-tu-space:
 	# The :tu and :tl modifiers operate on the variable value
 	# as a single string, not as a list of words. Therefore,



CVS commit: [netbsd-8] src/doc

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 19:02:43 UTC 2020

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

Log Message:
Tickets #1577 - #1581


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.22 src/doc/CHANGES-8.3:1.1.2.23
--- src/doc/CHANGES-8.3:1.1.2.22	Fri Jul 17 15:29:12 2020
+++ src/doc/CHANGES-8.3	Mon Jul 20 19:02:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.22 2020/07/17 15:29:12 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.23 2020/07/20 19:02:43 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -299,3 +299,61 @@ sys/net/if.c	1.479
 	ioctl(SIOCGIFCONF): do not accept negative buffer length values.
 	[msaitoh, ticket #1576]
 
+sys/dev/mii/miidevs1.168
+sys/dev/mii/miidevs.h(regen)
+sys/dev/mii/miidevs_data.h			(regen)
+
+	Add some Microsemi (Vitesse) devices.
+	[msaitoh, ticket #1577]
+
+sys/arch/x86/pci/rdcpcib.c			1.3
+sys/dev/pci/pcidevs1.1404,1.1405
+sys/dev/pci/pcidevs.h(regen)
+sys/dev/pci/pcidevs_data.h			(regen)
+
+	Add more RDC products.
+	[msaitoh, ticket #1578]
+
+sys/dev/pci/pcidevs1.1392-1.1403, 1.1406-1.1419
+sys/dev/pci/pcidevs.h(regen)
+sys/dev/pci/pcidevs_data.h			(regen)
+
+	- Add Intel Xeon D-1500 NTB-secondary and Xeon D NS QuickData DMA
+	  channel 0-7.
+	- Add Intel I219 LM10-LM15 and V10-V14.
+	- Add AMD Family14h PCIe.
+	- Add Realtek Killer E3000.
+	- Add Aquantia AQC 10G network adapters.
+	- Add Radeon HD4290
+	- Add Farallon PN9000SX Ethernet.
+	- NVIDIA 0x036[0-7] are nForce MCP55 LPC Bridge.
+	- Add VIA VX900 chipset.
+	- Add some NVIDIA devices.
+	- Add some Intel UHD Graphics devices.
+	- Add Intel Comet Lake, Whiskey Lake U and Amber Lake Y devices.
+	- Modify description of Intel 0x591e from HD Graphics to UHD Graphics.
+	- Add Intel XMM 7360 LTE Modem.
+	- Add Western Digital WD Blue SN550 NVMe SSD.
+	- Add ATI Radeon R5/R6/R7 Graphics.
+	- Add IDs for Ampere eMAG PCIe Root Ports.
+	- Add RTL8192EE Wireless LAN 802.11n PCI-E NIC.
+	- Add ASIX AX99100 Multi I/O (Serial,Parallel,I2C,SPI,LocalBus,GPIO)
+	  Controller.
+	- Add a couple of additional device IDs for the AMD Cryptographic
+	  Coprocessor.
+	- Remove duplicated entries.
+	[msaitoh, ticket #1579]
+
+sys/dev/i2c/sdtemp.c			1.35, 1.37-1.39
+
+	- Check the return value of iic_acquire_bus() because this function
+	  may fail.
+	- Fix typo in comment.
+	- KNF.
+	[msaitoh, ticket #1580]
+
+sys/arch/x86/x86/procfs_machdep.c		1.37,1.38
+
+	Add AMD protected processor identification number (ppin).
+	[msaitoh, ticket #1581]
+



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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 19:00:40 UTC 2020

Modified Files:
src/sys/dev/i2c [netbsd-8]: sdtemp.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1580:

sys/dev/i2c/sdtemp.c1.35, 1.37-1.39

- Check the return value of iic_acquire_bus() because this function
  may fail.
- Fix typo in comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.32.8.1 -r1.32.8.2 src/sys/dev/i2c/sdtemp.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/sdtemp.c
diff -u src/sys/dev/i2c/sdtemp.c:1.32.8.1 src/sys/dev/i2c/sdtemp.c:1.32.8.2
--- src/sys/dev/i2c/sdtemp.c:1.32.8.1	Thu Mar  8 14:29:12 2018
+++ src/sys/dev/i2c/sdtemp.c	Mon Jul 20 19:00:40 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: sdtemp.c,v 1.32.8.1 2018/03/08 14:29:12 martin Exp $*/
+/*  $NetBSD: sdtemp.c,v 1.32.8.2 2020/07/20 19:00:40 martin Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.32.8.1 2018/03/08 14:29:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.32.8.2 2020/07/20 19:00:40 martin Exp $");
 
 #include 
 #include 
@@ -214,8 +214,13 @@ sdtemp_match(device_t parent, cfdata_t c
 	if ((ia->ia_addr & SDTEMP_ADDRMASK) != SDTEMP_ADDR)
 		return 0;
 
-	/* Verify that we can read the manufacturer ID, Device ID and the capability */
-	iic_acquire_bus(sc.sc_tag, 0);
+	/*
+	 * Verify that we can read the manufacturer ID, Device ID and the
+	 * capability
+	 */
+	error = iic_acquire_bus(sc.sc_tag, 0);
+	if (error)
+		return 0;
 	error = sdtemp_read_16(, SDTEMP_REG_MFG_ID,  ) |
 		sdtemp_read_16(, SDTEMP_REG_DEV_REV, ) |
 		sdtemp_read_16(, SDTEMP_REG_CAPABILITY, );
@@ -234,8 +239,8 @@ sdtemp_match(device_t parent, cfdata_t c
 	}
 
 	/*
-	 * Check by SDTEMP_IS_TSE2004AV() might not be enough, so check the alarm
-	 * capability, too.
+	 * Check by SDTEMP_IS_TSE2004AV() might not be enough, so check the
+	 * alarm capability, too.
 	 */
 	if ((cap & SDTEMP_CAP_HAS_ALARM) == 0)
 		return 0;
@@ -255,7 +260,10 @@ sdtemp_attach(device_t parent, device_t 
 	sc->sc_address = ia->ia_addr;
 	sc->sc_dev = self;
 
-	iic_acquire_bus(sc->sc_tag, 0);
+	error = iic_acquire_bus(sc->sc_tag, 0);
+	if (error)
+		return;
+
 	if ((error = sdtemp_read_16(sc, SDTEMP_REG_MFG_ID,  )) != 0 ||
 	(error = sdtemp_read_16(sc, SDTEMP_REG_DEV_REV, )) != 0) {
 		iic_release_bus(sc->sc_tag, 0);
@@ -297,7 +305,7 @@ sdtemp_attach(device_t parent, device_t 
 	 * IDT's devices and some Microchip's devices have the resolution
 	 * register in the vendor specific registers area. The devices'
 	 * resolution bits in the capability register are not the maximum
-	 * resolution but the current vaule of the setting.
+	 * resolution but the current value of the setting.
 	 */
 	if (sdtemp_dev_table[i].sdtemp_config != NULL)
 		sdtemp_dev_table[i].sdtemp_config(sc);
@@ -428,7 +436,9 @@ sdtemp_get_limits(struct sysmon_envsys *
 	uint16_t lim;
 
 	*props = 0;
-	iic_acquire_bus(sc->sc_tag, 0);
+	if (iic_acquire_bus(sc->sc_tag, 0) != 0)
+		return;
+
 	if (sdtemp_read_16(sc, SDTEMP_REG_LOWER_LIM, ) == 0 && lim != 0) {
 		limits->sel_warnmin = sdtemp_decode_temp(sc, lim);
 		*props |= PROP_WARNMIN;
@@ -458,7 +468,9 @@ sdtemp_set_limits(struct sysmon_envsys *
 		limits = >sc_deflims;
 		props  = >sc_defprops;
 	}
-	iic_acquire_bus(sc->sc_tag, 0);
+	if (iic_acquire_bus(sc->sc_tag, 0) != 0)
+		return;
+
 	if (*props & PROP_WARNMIN) {
 		val = __UK2C(limits->sel_warnmin);
 		(void)sdtemp_write_16(sc, SDTEMP_REG_LOWER_LIM,
@@ -570,7 +582,12 @@ sdtemp_refresh(struct sysmon_envsys *sme
 	uint16_t val;
 	int error;
 
-	iic_acquire_bus(sc->sc_tag, 0);
+	error = iic_acquire_bus(sc->sc_tag, 0);
+	if (error) {
+		edata->state = ENVSYS_SINVALID;
+		return;
+	}
+
 	error = sdtemp_read_16(sc, SDTEMP_REG_AMBIENT_TEMP, );
 	iic_release_bus(sc->sc_tag, 0);
 
@@ -598,7 +615,7 @@ sdtemp_refresh(struct sysmon_envsys *sme
 }
 
 /*
- * power management functions
+ * Power management functions
  *
  * We go into "shutdown" mode at suspend time, and return to normal
  * mode upon resume.  This reduces power consumption by disabling
@@ -612,7 +629,10 @@ sdtemp_pmf_suspend(device_t dev, const p
 	int error;
 	uint16_t config;
 
-	iic_acquire_bus(sc->sc_tag, 0);
+	error = iic_acquire_bus(sc->sc_tag, 0);
+	if (error != 0)
+		return false;
+
 	error = sdtemp_read_16(sc, SDTEMP_REG_CONFIG, );
 	if (error == 0) {
 		config |= SDTEMP_CONFIG_SHUTDOWN_MODE;
@@ -629,7 +649,10 @@ sdtemp_pmf_resume(device_t dev, const pm
 	int error;
 	uint16_t config;
 
-	iic_acquire_bus(sc->sc_tag, 0);
+	error = iic_acquire_bus(sc->sc_tag, 0);
+	if (error != 0)
+		return false;
+
 	error = sdtemp_read_16(sc, SDTEMP_REG_CONFIG, );
 	if (error == 0) {
 		config &= ~SDTEMP_CONFIG_SHUTDOWN_MODE;



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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:53:56 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1579:

sys/dev/pci/pcidevs 1.1392-1.1403, 1.1406-1.1419

- Add Intel Xeon D-1500 NTB-secondary and Xeon D NS QuickData DMA
  channel 0-7.
- Add Intel I219 LM10-LM15 and V10-V14.
- Add AMD Family14h PCIe.
- Add Realtek Killer E3000.
- Add Aquantia AQC 10G network adapters.
- Add Radeon HD4290
- Add Farallon PN9000SX Ethernet.
- NVIDIA 0x036[0-7] are nForce MCP55 LPC Bridge.
- Add VIA VX900 chipset.
- Add some NVIDIA devices.
- Add some Intel UHD Graphics devices.
- Add Intel Comet Lake, Whiskey Lake U and Amber Lake Y devices.
- Modify description of Intel 0x591e from HD Graphics to UHD Graphics.
- Add Intel XMM 7360 LTE Modem.
- Add Western Digital WD Blue SN550 NVMe SSD.
- Add ATI Radeon R5/R6/R7 Graphics.
- Add IDs for Ampere eMAG PCIe Root Ports.
- Add RTL8192EE Wireless LAN 802.11n PCI-E NIC.
- Add ASIX AX99100 Multi I/O (Serial,Parallel,I2C,SPI,LocalBus,GPIO)
  Controller.
- Add a couple of additional device IDs for the AMD Cryptographic
  Coprocessor.
- Remove duplicated entries.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.18 -r1.1289.2.19 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.18 src/sys/dev/pci/pcidevs:1.1289.2.19
--- src/sys/dev/pci/pcidevs:1.1289.2.18	Mon Jul 20 18:47:16 2020
+++ src/sys/dev/pci/pcidevs	Mon Jul 20 18:53:56 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.18 2020/07/20 18:47:16 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.19 2020/07/20 18:53:56 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -651,8 +651,10 @@ vendor SYMPHONY2	0x1c1c	Symphony Labs (2
 vendor HGST		0x1c58	HGST, Inc.
 vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor AMAZON		0x1d0f	Amazon.com, Inc.
+vendor AQUANTIA		0x1d6a	Aquantia
 vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
+vendor AMPERE		0x1def	Ampere Computing
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
 vendor 3DLABS		0x3d3d	3D Labs
@@ -1023,13 +1025,20 @@ product AMD F17_DF_5		0x1464	Family17h D
 product AMD F17_DF_6		0x1465	Family17h Data Fabric
 product AMD F17_DF_7		0x1466	Family17h Data Fabric
 product AMD F17_DF_8		0x1467	Family17h Data Fabric
+product AMD F17_CCP_2		0x1468	Family17h Crypto
 product AMD F17_PCIE_4		0x1470	Family17h PCIe
 product AMD F17_PCIE_5		0x1471	Family17h PCIe
 product AMD F17_7X_RC		0x1480	Family17h/7xh Root Complex
 product AMD F17_7X_IOMMU	0x1481	Family17h/7xh IOMMU
 product AMD F17_7X_RESV_SPP	0x1485	Family17h/7xh Reserved SPP
+product AMD F17_7X_CCP		0x1486	Family17h/7xh Crypto
 product AMD F17_7X_USB3		0x149c	Family17h/7xh USB 3.0 Host Controller
 product AMD F14_RC		0x1510	Family14h Root Complex
+product AMD F14_PCIE_1		0x1512	Family14h PCIe
+product AMD F14_PCIE_2		0x1513	Family14h PCIe
+product AMD F14_PCIE_3		0x1514	Family14h PCIe
+product AMD F14_PCIE_4		0x1515	Family14h PCIe
+product AMD F14_PCIE_5		0x1516	Family14h PCIe
 product AMD F16_HT		0x1530	Family16h HyperTransport Configuration
 product AMD F16_ADDR		0x1531	Family16h Address Map Configuration
 product AMD F16_DRAM		0x1532	Family16h DRAM Configuration
@@ -1103,7 +1112,7 @@ product AMD PCSCSI_PCI		0x2020	PCscsi-PC
 product AMD GEODELX_PCHB	0x2080	Geode LX Host-PCI Bridge
 product AMD GEODELX_VGA 	0x2081	Geode LX VGA Controller
 product AMD GEODELX_AES 	0x2082	Geode LX AES Security Block
-product	AMD CS5536_PCISB	0x208f	CS5536 GeodeLink PCI South Bridge
+product AMD CS5536_PCISB	0x208f	CS5536 GeodeLink PCI South Bridge
 product AMD CS5536_PCIB		0x2090	CS5536 PCI-ISA Bridge
 product AMD CS5536_FLASH	0x2091	CS5536 Flash
 product AMD CS5536_AUDIO	0x2093	CS5536 Audio
@@ -1213,6 +1222,16 @@ product AMI MEGARAID3		0x1960	MegaRAID 3
 product AMI MEGARAID		0x9010	MegaRAID
 product AMI MEGARAID2		0x9060	MegaRAID 2
 
+/* Ampere Computing products */
+product AMPERE EMAG_PCIE_0	0xe005	eMAG PCIe Root Port 0
+product AMPERE EMAG_PCIE_1	0xe006	eMAG PCIe Root Port 1
+product AMPERE EMAG_PCIE_2	0xe007	eMAG PCIe Root Port 2
+product AMPERE EMAG_PCIE_3	0xe008	eMAG PCIe Root Port 3
+product AMPERE EMAG_PCIE_4	0xe009	eMAG PCIe Root Port 4
+product AMPERE EMAG_PCIE_5	0xe00a	eMAG PCIe Root Port 5
+product AMPERE EMAG_PCIE_6	0xe00b	eMAG PCIe Root Port 6
+product AMPERE EMAG_PCIE_7	0xe00c	eMAG PCIe Root Port 7
+
 /* Analog Devices products */
 product ANALOG AD1889	0x1889	AD1889 PCI SoundMAX Controller
 product ANALOG SAFENET	0x2f44	SafeNet Crypto Accelerator ADSP-2141
@@ -1282,6 +1301,24 @@ product APPLE INTREPID2_FW	0x006a	Intrep
 product APPLE INTREPID2_GMAC	0x006b	Intrepid 2 GMAC
 product APPLE BCM5701		0x1645	BCM5701

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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:55:52 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
Regen for ticket #1579


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.18 -r1.1281.2.19 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.18 -r1.1280.2.19 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: [netbsd-8] src/sys

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:47:16 UTC 2020

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: rdcpcib.c
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1404
sys/dev/pci/pcidevs: revision 1.1405
sys/arch/x86/pci/rdcpcib.c: revision 1.3

Add more RDC products (Andrius V)

Recognize more rdc devices (Andrius V.)

Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.46.1 src/sys/arch/x86/pci/rdcpcib.c
cvs rdiff -u -r1.1289.2.17 -r1.1289.2.18 src/sys/dev/pci/pcidevs

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/x86/pci/rdcpcib.c
diff -u src/sys/arch/x86/pci/rdcpcib.c:1.2 src/sys/arch/x86/pci/rdcpcib.c:1.2.46.1
--- src/sys/arch/x86/pci/rdcpcib.c:1.2	Fri Jul  1 18:22:08 2011
+++ src/sys/arch/x86/pci/rdcpcib.c	Mon Jul 20 18:47:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rdcpcib.c,v 1.2 2011/07/01 18:22:08 dyoung Exp $	*/
+/*	$NetBSD: rdcpcib.c,v 1.2.46.1 2020/07/20 18:47:16 martin Exp $	*/
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rdcpcib.c,v 1.2 2011/07/01 18:22:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rdcpcib.c,v 1.2.46.1 2020/07/20 18:47:16 martin Exp $");
 
 #include 
 #include 
@@ -88,6 +88,17 @@ CFATTACH_DECL2_NEW(rdcpcib, sizeof(struc
 rdcpcibmatch, rdcpcibattach, rdcpcibdetach, NULL,
 pcibrescan, pcibchilddet);
 
+
+static const struct rdcpcib_device {
+	pcireg_t vendor, product;
+} rdcpcib_devices[] = {
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6011_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6013_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6031_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6035_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6036_PCIB},
+};
+
 static int
 rdcpcibmatch(device_t parent, cfdata_t match, void *aux)
 {
@@ -97,9 +108,11 @@ rdcpcibmatch(device_t parent, cfdata_t m
 	PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_ISA)
 		return 0;
 
-	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RDC &&
-	PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RDC_PCIB)
+	for (size_t i = 0; i < __arraycount(rdcpcib_devices); i++) {
+		if (PCI_VENDOR(pa->pa_id) == rdcpcib_devices[i].vendor &&
+		PCI_PRODUCT(pa->pa_id) == rdcpcib_devices[i].product)
 			return 10;
+	}
 
 	return 0;
 }

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.17 src/sys/dev/pci/pcidevs:1.1289.2.18
--- src/sys/dev/pci/pcidevs:1.1289.2.17	Tue Nov 19 10:36:47 2019
+++ src/sys/dev/pci/pcidevs	Mon Jul 20 18:47:16 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.17 2019/11/19 10:36:47 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.18 2020/07/20 18:47:16 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7015,13 +7015,28 @@ product RALINK	RT5390_5	0x539f	RT5390
 product RATOC	REXPCI31	0x0853	REX PCI-31/33 SCSI
 
 /* RDC Semiconductor products */
-product RDC	R1010_IDE	0x1010	R1010 IDE controller
-product RDC	R1011_IDE	0x1011	R1011 IDE controller
-product RDC	R1012_IDE	0x1012	R1012 IDE controller
+product RDC	R1010_IDE	0x1010	R1010 IDE Controller
+product RDC	R1011_IDE	0x1011	R1011 IDE Controller
+product RDC	R1012_IDE	0x1012	R1012 IDE Controller
+product RDC	R1031_PPB	0x1031	R1031 PCI-PCIE Bridge
+product RDC	R1060_USBD	0x1060	R1060 USB Device
+product RDC	R1061_USBD	0x1061	R1061 USB Device
+product RDC	R1070_CAN	0x1070	R1070 CANbus
+product RDC	R1331_MC	0x1331	R1331 Motion Control
+product RDC	R1710_SPI	0x1710	R1710 SPI
+product RDC	R1930_HBRD	0x1930	R1930 Hybrid Function Control Register
+product RDC	R2010_VGA	0x2010	R2010 VGA Controller
+product RDC	R2012_VGA	0x2012	R2012 VGA Controller
+product RDC	R2015_VGA	0x2015	R2015 VGA Controller
+product RDC	R6011_PCIB	0x6011	R6011 PCI-ISA bridge
+product RDC	R6013_PCIB	0x6013	R6013 PCI-ISA bridge
 product RDC	R6021_HB	0x6021	R6021 Host
+product RDC	R6023_HB	0x6023	R6023 Host
 product RDC	R6025_HB	0x6025	R6025 Host
-product RDC	R6031_ISA	0x6031	R6031 PCI-ISA bridge
-product RDC	PCIB		0x6036	R6036 PCI-ISA bridge
+product RDC	R6026_HB	0x6026	R6026 Host
+product RDC	R6031_PCIB	0x6031	R6031 PCI-ISA bridge
+product RDC	R6035_PCIB	0x6035	R6035 PCI-ISA bridge
+product RDC	R6036_PCIB	0x6036	R6036 PCI-ISA bridge
 product RDC	R6040		0x6040	R6040 10/100 Ethernet
 product RDC	R6060_OHCI	0x6060	R6060 USB OHCI
 product RDC	R6061_EHCI	0x6061	R6061 USB EHCI



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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:43:25 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-8]: miidevs.h miidevs_data.h

Log Message:
regen for ticket #1577


To generate a diff of this commit:
cvs rdiff -u -r1.128.6.9 -r1.128.6.10 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.116.6.9 -r1.116.6.10 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.128.6.9 src/sys/dev/mii/miidevs.h:1.128.6.10
--- src/sys/dev/mii/miidevs.h:1.128.6.9	Tue Apr 14 18:11:35 2020
+++ src/sys/dev/mii/miidevs.h	Mon Jul 20 18:43:25 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.128.6.9 2020/04/14 18:11:35 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.128.6.10 2020/07/20 18:43:25 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.125.6.9 2020/04/14 17:57:17 martin Exp
+ *	NetBSD: miidevs,v 1.125.6.10 2020/07/20 18:42:47 martin Exp
  */
 
 /*-
@@ -616,8 +616,28 @@
 #define	MII_STR_xxVITESSE_VSC8601	"VSC8601 10/100/1000 PHY"
 #define	MII_MODEL_xxVITESSE_VSC8641	0x0003
 #define	MII_STR_xxVITESSE_VSC8641	"Vitesse VSC8641 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8504	0x000c
+#define	MII_STR_xxVITESSE_VSC8504	"Vitesse VSC8504 quad 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8552	0x000e
+#define	MII_STR_xxVITESSE_VSC8552	"Vitesse VSC8552 dual 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8502	0x0012
+#define	MII_STR_xxVITESSE_VSC8502	"Vitesse VSC8502 dual 10/100/1000TX PHY"
 #define	MII_MODEL_xxVITESSE_VSC8501	0x0013
 #define	MII_STR_xxVITESSE_VSC8501	"Vitesse VSC8501 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8531	0x0017
+#define	MII_STR_xxVITESSE_VSC8531	"Vitesse VSC8531 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8662	0x0026
+#define	MII_STR_xxVITESSE_VSC8662	"Vitesse VSC866[24] dual/quad 1000T 100FX 1000X PHY"
+#define	MII_MODEL_xxVITESSE_VSC8514	0x0027
+#define	MII_STR_xxVITESSE_VSC8514	"Vitesse VSC8514 quad 1000T PHY"
+#define	MII_MODEL_xxVITESSE_VSC8512	0x002e
+#define	MII_STR_xxVITESSE_VSC8512	"Vitesse VSC8512 12port 1000T PHY"
+#define	MII_MODEL_xxVITESSE_VSC8522	0x002f
+#define	MII_STR_xxVITESSE_VSC8522	"Vitesse VSC8522 12port 1000T PHY"
+#define	MII_MODEL_xxVITESSE_VSC8658	0x0035
+#define	MII_STR_xxVITESSE_VSC8658	"Vitesse VSC8658 octal 1000T 100FX 1000X PHY"
+#define	MII_MODEL_xxVITESSE_VSC8541	0x0037
+#define	MII_STR_xxVITESSE_VSC8541	"Vitesse VSC8541 1000T PHY"
 
 /* XaQti Corp. PHYs */
 #define	MII_MODEL_xxXAQTI_XMACII	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.116.6.9 src/sys/dev/mii/miidevs_data.h:1.116.6.10
--- src/sys/dev/mii/miidevs_data.h:1.116.6.9	Tue Apr 14 18:11:35 2020
+++ src/sys/dev/mii/miidevs_data.h	Mon Jul 20 18:43:25 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.116.6.9 2020/04/14 18:11:35 martin Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.116.6.10 2020/07/20 18:43:25 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.125.6.9 2020/04/14 17:57:17 martin Exp
+ *	NetBSD: miidevs,v 1.125.6.10 2020/07/20 18:42:47 martin Exp
  */
 
 /*-
@@ -246,7 +246,17 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_xxVIA, MII_MODEL_xxVIA_VT6103_2, MII_STR_xxVIA_VT6103_2 },
  { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8601, MII_STR_xxVITESSE_VSC8601 },
  { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8641, MII_STR_xxVITESSE_VSC8641 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8504, MII_STR_xxVITESSE_VSC8504 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8552, MII_STR_xxVITESSE_VSC8552 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8502, MII_STR_xxVITESSE_VSC8502 },
  { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8501, MII_STR_xxVITESSE_VSC8501 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8531, MII_STR_xxVITESSE_VSC8531 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8662, MII_STR_xxVITESSE_VSC8662 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8514, MII_STR_xxVITESSE_VSC8514 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8512, MII_STR_xxVITESSE_VSC8512 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8522, MII_STR_xxVITESSE_VSC8522 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8658, MII_STR_xxVITESSE_VSC8658 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8541, MII_STR_xxVITESSE_VSC8541 },
  { MII_OUI_xxXAQTI, MII_MODEL_xxXAQTI_XMACII, MII_STR_xxXAQTI_XMACII },
  { 0, 0, NULL }
 };



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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:42:47 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-8]: miidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1577):
sys/dev/mii/miidevs: revision 1.168
  Add some Microsemi (Vitesse) devices.


To generate a diff of this commit:
cvs rdiff -u -r1.125.6.9 -r1.125.6.10 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.125.6.9 src/sys/dev/mii/miidevs:1.125.6.10
--- src/sys/dev/mii/miidevs:1.125.6.9	Tue Apr 14 17:57:17 2020
+++ src/sys/dev/mii/miidevs	Mon Jul 20 18:42:47 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.125.6.9 2020/04/14 17:57:17 martin Exp $
+$NetBSD: miidevs,v 1.125.6.10 2020/07/20 18:42:47 martin Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -400,7 +400,17 @@ model xxVIA VT6103_2		0x0034	VT6103 10/1
 /* Vitesse PHYs (Now Microsemi) */
 model xxVITESSE VSC8601		0x0002 VSC8601 10/100/1000 PHY
 model xxVITESSE VSC8641		0x0003 Vitesse VSC8641 10/100/1000TX PHY
+model xxVITESSE VSC8504		0x000c Vitesse VSC8504 quad 10/100/1000TX PHY
+model xxVITESSE VSC8552		0x000e Vitesse VSC8552 dual 10/100/1000TX PHY
+model xxVITESSE VSC8502		0x0012 Vitesse VSC8502 dual 10/100/1000TX PHY
 model xxVITESSE VSC8501		0x0013 Vitesse VSC8501 10/100/1000TX PHY
+model xxVITESSE VSC8531		0x0017 Vitesse VSC8531 10/100/1000TX PHY
+model xxVITESSE VSC8662		0x0026 Vitesse VSC866[24] dual/quad 1000T 100FX 1000X PHY
+model xxVITESSE VSC8514		0x0027 Vitesse VSC8514 quad 1000T PHY
+model xxVITESSE VSC8512		0x002e Vitesse VSC8512 12port 1000T PHY
+model xxVITESSE VSC8522		0x002f Vitesse VSC8522 12port 1000T PHY
+model xxVITESSE VSC8658		0x0035 Vitesse VSC8658 octal 1000T 100FX 1000X PHY
+model xxVITESSE VSC8541		0x0037 Vitesse VSC8541 1000T PHY
 
 /* XaQti Corp. PHYs */
 model xxXAQTI XMACII		0x XaQti Corp. XMAC II gigabit interface



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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:40:09 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.37
sys/arch/x86/x86/procfs_machdep.c: revision 1.38

  Add AMD protected processor identification number (PPIN).

  Lowercase ppin.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.10 -r1.15.2.11 src/sys/arch/x86/x86/procfs_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/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.10 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.11
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.10	Wed Apr 15 14:25:09 2020
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jul 20 18:40:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.10 2020/04/15 14:25:09 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.10 2020/04/15 14:25:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ static const char * const x86_features[]
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
 	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */



CVS commit: [netbsd-9] src/doc

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:35:18 UTC 2020

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

Log Message:
Tickets #1021 and #1022


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.82 -r1.1.2.83 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.82 src/doc/CHANGES-9.1:1.1.2.83
--- src/doc/CHANGES-9.1:1.1.2.82	Sat Jul 18 15:10:21 2020
+++ src/doc/CHANGES-9.1	Mon Jul 20 18:35:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.82 2020/07/18 15:10:21 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.83 2020/07/20 18:35:18 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -3488,3 +3488,19 @@ sys/dev/usb/usbdi.c1.203
 	states.
 	[mrg, ticket #1020]
 
+sys/dev/sdmmc/sdhc.c1.107
+sys/dev/sdmmc/sdhcreg.h1.21
+
+	Identify SDHC 4.1 and 4.2.
+	[msaitoh, ticket #1021]
+
+distrib/notes/evbarm/Makefile			1.3
+distrib/notes/evbarm/contents			1.9,1.10
+distrib/notes/evbarm/hardware			1.11-1.14
+distrib/notes/evbarm/install			1.11-1.14
+distrib/notes/evbarm/prep			1.12
+distrib/notes/evbarm/xfer			1.3,1.4
+
+	Modernize evbarm install instructions.
+	[nia, ticket #1022]
+



CVS commit: [netbsd-9] src/distrib/notes/evbarm

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:32:55 UTC 2020

Modified Files:
src/distrib/notes/evbarm [netbsd-9]: Makefile contents hardware install
prep xfer

Log Message:
Pull up following revision(s) (requested by nia in ticket #1022):

distrib/notes/evbarm/install: revision 1.14
distrib/notes/evbarm/hardware: revision 1.11
distrib/notes/evbarm/hardware: revision 1.12
distrib/notes/evbarm/hardware: revision 1.13
distrib/notes/evbarm/hardware: revision 1.14
distrib/notes/evbarm/Makefile: revision 1.3
distrib/notes/evbarm/xfer: revision 1.3
distrib/notes/evbarm/xfer: revision 1.4
distrib/notes/evbarm/prep: revision 1.12
distrib/notes/evbarm/contents: revision 1.9
distrib/notes/evbarm/contents: revision 1.10
distrib/notes/evbarm/install: revision 1.11
distrib/notes/evbarm/install: revision 1.12
distrib/notes/evbarm/install: revision 1.13

First attempt at modernising the evbarm install guide and hardware lists
- Install instructions mostly based on wiki pages
- Supported hardware lists mostly based on GENERIC and GENERIC64 kernels
s/boards/devices/

Briefly explain how to pkgsrc u-boot. Pointed out by maya.

more modernization of evbarm install instructions

safe estimation of required storage

more contents

more hardware

missing e.g.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.102.1 src/distrib/notes/evbarm/Makefile
cvs rdiff -u -r1.4.4.2 -r1.4.4.3 src/distrib/notes/evbarm/contents
cvs rdiff -u -r1.10 -r1.10.66.1 src/distrib/notes/evbarm/hardware
cvs rdiff -u -r1.9.64.1 -r1.9.64.2 src/distrib/notes/evbarm/install
cvs rdiff -u -r1.11 -r1.11.34.1 src/distrib/notes/evbarm/prep
cvs rdiff -u -r1.2 -r1.2.48.1 src/distrib/notes/evbarm/xfer

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

Modified files:

Index: src/distrib/notes/evbarm/Makefile
diff -u src/distrib/notes/evbarm/Makefile:1.2 src/distrib/notes/evbarm/Makefile:1.2.102.1
--- src/distrib/notes/evbarm/Makefile:1.2	Sun Jul 21 08:14:48 2002
+++ src/distrib/notes/evbarm/Makefile	Mon Jul 20 18:32:55 2020
@@ -1,5 +1,3 @@
-#	$NetBSD: Makefile,v 1.2 2002/07/21 08:14:48 lukem Exp $
-
-MERGED_SRCS+=	${COMMON}/xfer
+#	$NetBSD: Makefile,v 1.2.102.1 2020/07/20 18:32:55 martin Exp $
 
 .include 

Index: src/distrib/notes/evbarm/contents
diff -u src/distrib/notes/evbarm/contents:1.4.4.2 src/distrib/notes/evbarm/contents:1.4.4.3
--- src/distrib/notes/evbarm/contents:1.4.4.2	Mon Nov 25 05:50:20 2019
+++ src/distrib/notes/evbarm/contents	Mon Jul 20 18:32:55 2020
@@ -1,6 +1,6 @@
-.\"	$NetBSD: contents,v 1.4.4.2 2019/11/25 05:50:20 msaitoh Exp $
+.\"	$NetBSD: contents,v 1.4.4.3 2020/07/20 18:32:55 martin Exp $
 .\"
-.\" Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1999-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -45,66 +45,81 @@ The
 file contains underlined text using the
 .Xr more 1
 conventions for indicating italic and bold display.
-.
-.\" MD binary and installation directories ---
-.
 .	It Pa binary/
-.
 .	(tag kernel/ -compact \" binary/
-.
+.		It Pa gzimg/
+.		(tag armv7.img.gz -compact \" binary/gzimg
+.			It Pa armv7.img.gz
+A gzipped writable image containing the complete
+.Nx
+operating system for a range of 32-bit devices (includes a GENERIC kernel).
+.			It Pa arm64.img.gz
+A gzipped writable image containing the complete
+.Nx
+operating system for a range of 64-bit devices (includes a GENERIC64 kernel).
+.			It Pa rpi.img.gz
+A gzipped writable image containing the complete 32-bit
+.Nx
+operating system for Raspberry Pi variants only (includes RPI kernels).
+.			It Pa *.dtb.gz
+Gzipped board-specific device trees.
+.		tag) \" binary/gzimg/
 .		It Pa kernel/
-.
 .		(tag netbsd.gz -compact \" binary/kernel
 .			It Pa netbsd-GENERIC.gz
-A gzipped
-.Nx
-kernel containing code for everything supported in this release.
-.
+A gzipped ARMv7 kernel which supports a range of 32-bit devices that
+do not need board-specific kernels.
+.			It Pa netbsd-GENERIC64.gz
+A gzipped AArch64 kernel which supports a range of 64-bit devices that
+do not need board-specific kernels.
+.			It Pa netbsd-RPI.gz
+A gzipped ARMv6 kernel which supports the Raspberry Pi 1 only.
+.			It Pa netbsd-RPI2.gz
+A gzipped ARMv6 kernel which supports the Raspberry Pi 2 only.
 .		tag) \" binary/kernel/
 .
 .		It Pa sets/
-.
 \*M binary distribution sets;
 see below.
 .
 .	tag) \" binary/
-.
 .	It Pa installation/
 .
 .	(tag miniroot/ -compact \" installation/
 .
-.		It Pa misc/
+.		It Pa miniroot/
+.
+\*M kernel modules providing memory disk
+root file systems for expert usage.
 .
-Miscellaneous \*M installation utilities; see
-installation section below.
+.		It Pa misc/
+.		(tag bootaa64.efi -compact \" 

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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:15:43 UTC 2020

Modified Files:
src/sys/dev/sdmmc [netbsd-9]: sdhc.c sdhcreg.h

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

sys/dev/sdmmc/sdhc.c: revision 1.107
sys/dev/sdmmc/sdhcreg.h: revision 1.21

Identify SDHC 4.1 and 4.2. From {DragonFly,Free}BSD.


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.1 -r1.103.2.2 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.19 -r1.19.12.1 src/sys/dev/sdmmc/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/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.103.2.1 src/sys/dev/sdmmc/sdhc.c:1.103.2.2
--- src/sys/dev/sdmmc/sdhc.c:1.103.2.1	Tue Feb 25 18:40:43 2020
+++ src/sys/dev/sdmmc/sdhc.c	Mon Jul 20 18:15:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.103.2.1 2020/02/25 18:40:43 martin Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.103.2.2 2020/07/20 18:15:43 martin Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.103.2.1 2020/02/25 18:40:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.103.2.2 2020/07/20 18:15:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -324,6 +324,12 @@ sdhc_host_found(struct sdhc_softc *sc, b
 	case SDHC_SPEC_VERS_400:
 		aprint_normal("4.0");
 		break;
+	case SDHC_SPEC_VERS_410:
+		aprint_normal("4.1");
+		break;
+	case SDHC_SPEC_VERS_420:
+		aprint_normal("4.2");
+		break;
 	case SDHC_SPEC_NOVERS:
 		hp->specver = -1;
 		aprint_normal("NO-VERS");

Index: src/sys/dev/sdmmc/sdhcreg.h
diff -u src/sys/dev/sdmmc/sdhcreg.h:1.19 src/sys/dev/sdmmc/sdhcreg.h:1.19.12.1
--- src/sys/dev/sdmmc/sdhcreg.h:1.19	Fri Jun 23 08:43:59 2017
+++ src/sys/dev/sdmmc/sdhcreg.h	Mon Jul 20 18:15:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhcreg.h,v 1.19 2017/06/23 08:43:59 ryo Exp $	*/
+/*	$NetBSD: sdhcreg.h,v 1.19.12.1 2020/07/20 18:15:43 martin Exp $	*/
 /*	$OpenBSD: sdhcreg.h,v 1.4 2006/07/30 17:20:40 fgsch Exp $	*/
 
 /*
@@ -246,6 +246,8 @@
 #define SDHC_SPEC_VERS_200		0x01
 #define SDHC_SPEC_VERS_300		0x02
 #define SDHC_SPEC_VERS_400		0x03
+#define SDHC_SPEC_VERS_410		0x04
+#define SDHC_SPEC_VERS_420		0x05
 #define SDHC_SPEC_NOVERS		0xff	/* dummy */
 
 /* SDHC_CAPABILITIES decoding */



CVS commit: src/usr.bin/make

2020-07-20 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Jul 20 18:12:48 UTC 2020

Modified Files:
src/usr.bin/make: hash.c hash.h main.c nonints.h targ.c var.c

Log Message:
Make DEBUG_HASH less of a fire-hose.

Reporting keys on every lookup is overkill unless
playing with a new HASH, so wrap in #ifdef DEBUG_HASH_LOOKUP
Also add some stats at the end so we can see
final size and max chain length - maxchain is a better
variable name than maxlen.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/hash.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/hash.h
cvs rdiff -u -r1.282 -r1.283 src/usr.bin/make/main.c
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/make/targ.c
cvs rdiff -u -r1.285 -r1.286 src/usr.bin/make/var.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.bin/make/hash.c
diff -u src/usr.bin/make/hash.c:1.24 src/usr.bin/make/hash.c:1.25
--- src/usr.bin/make/hash.c:1.24	Sun Jul 19 15:42:25 2020
+++ src/usr.bin/make/hash.c	Mon Jul 20 18:12:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.24 2020/07/19 15:42:25 riastradh Exp $	*/
+/*	$NetBSD: hash.c,v 1.25 2020/07/20 18:12:48 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: hash.c,v 1.24 2020/07/19 15:42:25 riastradh Exp $";
+static char rcsid[] = "$NetBSD: hash.c,v 1.25 2020/07/20 18:12:48 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)hash.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: hash.c,v 1.24 2020/07/19 15:42:25 riastradh Exp $");
+__RCSID("$NetBSD: hash.c,v 1.25 2020/07/20 18:12:48 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -108,12 +108,15 @@ static void RebuildTable(Hash_Table *);
 #define rebuildLimit 3
 
 /* The hash function(s) */
-/* This one matches Gosling's emacs */
+
+#ifndef HASH
+/* The default: this one matches Gosling's emacs */
 #define HASH(h, key, p) do { \
 	for (h = 0, p = key; *p;) \
 		h = (h << 5) - h + *p++; \
 	} while (0)
 
+#endif
 
 /*
  *-
@@ -154,7 +157,7 @@ Hash_InitTable(Hash_Table *t, int numBuc
 			 continue;
 	}
 	t->numEntries = 0;
-	t->maxlen = 0;
+	t->maxchain = 0;
 	t->size = i;
 	t->mask = i - 1;
 	t->bucketPtr = hp = bmake_malloc(sizeof(*hp) * i);
@@ -236,17 +239,19 @@ Hash_FindEntry(Hash_Table *t, const char
 	}
 	HASH(h, key, p);
 	p = key;
+	chainlen = 0;
+#ifdef DEBUG_HASH_LOOKUP
 	if (DEBUG(HASH))
 		fprintf(debug_file, "%s: %p h=%x key=%s\n", __func__,
 		t, h, key);
-	chainlen = 0;
+#endif
 	for (e = t->bucketPtr[h & t->mask]; e != NULL; e = e->next) {
 		chainlen++;
 		if (e->namehash == h && strcmp(e->name, p) == 0)
 			break;
 	}
-	if (chainlen > t->maxlen)
-		t->maxlen = chainlen;
+	if (chainlen > t->maxchain)
+		t->maxchain = chainlen;
 	return e;
 }
 
@@ -292,10 +297,12 @@ Hash_CreateEntry(Hash_Table *t, const ch
 	HASH(h, key, p);
 	keylen = p - key;
 	p = key;
+	chainlen = 0;
+#ifdef DEBUG_HASH_LOOKUP
 	if (DEBUG(HASH))
 		fprintf(debug_file, "%s: %p h=%x key=%s\n", __func__,
 		t, h, key);
-	chainlen = 0;
+#endif
 	for (e = t->bucketPtr[h & t->mask]; e != NULL; e = e->next) {
 		chainlen++;
 		if (e->namehash == h && strcmp(e->name, p) == 0) {
@@ -304,8 +311,8 @@ Hash_CreateEntry(Hash_Table *t, const ch
 			break;
 		}
 	}
-	if (chainlen > t->maxlen)
-		t->maxlen = chainlen;
+	if (chainlen > t->maxchain)
+		t->maxchain = chainlen;
 	if (e)
 		return e;
 
@@ -490,9 +497,9 @@ RebuildTable(Hash_Table *t)
 	}
 	free(oldhp);
 	if (DEBUG(HASH))
-		fprintf(debug_file, "%s: %p size=%d entries=%d maxlen=%d\n",
-		__func__, t, t->size, t->numEntries, t->maxlen);
-	t->maxlen = 0;
+		fprintf(debug_file, "%s: %p size=%d entries=%d maxchain=%d\n",
+		__func__, t, t->size, t->numEntries, t->maxchain);
+	t->maxchain = 0;
 }
 
 void Hash_ForEach(Hash_Table *t, void (*action)(void *, void *), void *data)
@@ -505,3 +512,11 @@ void Hash_ForEach(Hash_Table *t, void (*
 	 e = Hash_EnumNext())
 		action(Hash_GetValue(e), data);
 }
+
+void
+Hash_DebugStats(Hash_Table *t, const char *name)
+{
+if (DEBUG(HASH))
+	fprintf(debug_file, "Hash_Table %s: size=%d numEntries=%d maxchain=%d\n",
+		name, t->size, t->numEntries, t->maxchain);
+}

Index: src/usr.bin/make/hash.h
diff -u src/usr.bin/make/hash.h:1.14 src/usr.bin/make/hash.h:1.15
--- src/usr.bin/make/hash.h:1.14	Sat Jul 18 21:37:38 2020
+++ src/usr.bin/make/hash.h	Mon Jul 20 18:12:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.h,v 1.14 2020/07/18 21:37:38 sjg Exp $	*/
+/*	$NetBSD: hash.h,v 1.15 2020/07/20 18:12:48 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -100,7 +100,7 @@ typedef struct Hash_Table {
 int 	size;		/* Actual size of array. */
 int 	numEntries;	/* Number 

CVS commit: src/sys/arch/mips/cavium/dev

2020-07-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul 20 17:56:13 UTC 2020

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_ciureg.h

Log Message:
Fix coreX/IP4 summary register offsets


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/cavium/dev/octeon_ciureg.h

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

Modified files:

Index: src/sys/arch/mips/cavium/dev/octeon_ciureg.h
diff -u src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.10 src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.11
--- src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.10	Fri Jul 17 21:59:30 2020
+++ src/sys/arch/mips/cavium/dev/octeon_ciureg.h	Mon Jul 20 17:56:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_ciureg.h,v 1.10 2020/07/17 21:59:30 jmcneill Exp $	*/
+/*	$NetBSD: octeon_ciureg.h,v 1.11 2020/07/20 17:56:13 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -85,7 +85,7 @@
 #define	CIU_PCI_INTAUINT64_C(0x000107000750)
 #define	CIU_INT4_SUM0UINT64_C(0x000107000c00)
 #define	CIU_INT4_SUM1UINT64_C(0x000107000c08)
-#define	CIU_IP4_SUM0(n)(CIU_INT4_SUM0 + 0x10 * (n))
+#define	CIU_IP4_SUM0(n)(CIU_INT4_SUM0 + 0x8 * (n))
 #define	CIU_INT4_EN00UINT64_C(0x000107000c80)
 #define	CIU_INT4_EN01UINT64_C(0x000107000c88)
 #define	CIU_INT4_EN10UINT64_C(0x000107000c90)



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 16:55:10 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): make conditions work without pattern flags

The "pattern flag" VARP_NOSUBST was used to prevent evaluating
irrelevant conditions.  Omitting the evaluation flag VARE_WANTRES has the
same effect.


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.284 src/usr.bin/make/var.c:1.285
--- src/usr.bin/make/var.c:1.284	Mon Jul 20 16:32:14 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 16:55:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.284 2020/07/20 16:32:14 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.285 2020/07/20 16:55:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.284 2020/07/20 16:32:14 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.285 2020/07/20 16:55:10 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.284 2020/07/20 16:32:14 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.285 2020/07/20 16:55:10 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2865,32 +2865,29 @@ ApplyModifier_Order(ApplyModifiersState 
 static Boolean
 ApplyModifier_IfElse(ApplyModifiersState *st)
 {
-Boolean value;
-int cond_rc;
-VarPatternFlags then_flags, else_flags;
-/* FIXME: IfElse has nothing to do with VarPatternFlags */
+Boolean value = FALSE;
+int cond_rc = 0;
+VarEvalFlags then_eflags = st->eflags & ~VARE_WANTRES;
+VarEvalFlags else_eflags = st->eflags & ~VARE_WANTRES;
 
-/* find ':', and then substitute accordingly */
 if (st->eflags & VARE_WANTRES) {
 	cond_rc = Cond_EvalExpression(NULL, st->v->name, , 0, FALSE);
-	then_flags = cond_rc != COND_INVALID && value ? 0 : VAR_NOSUBST;
-	else_flags = cond_rc != COND_INVALID && !value ? 0 : VAR_NOSUBST;
-} else {
-	/* we are just consuming and discarding */
-	cond_rc = value = 0;
-	then_flags = else_flags = VAR_NOSUBST;
+	if (cond_rc != COND_INVALID && value)
+	then_eflags |= VARE_WANTRES;
+	if (cond_rc != COND_INVALID && !value)
+	else_eflags |= VARE_WANTRES;
 }
 
 st->cp = ++st->tstr;
 st->delim = ':';
 char *then_expr = ParseModifierPart(
-	st->ctxt, >cp, st->delim, st->eflags, _flags, NULL, NULL);
+	st->ctxt, >cp, st->delim, then_eflags, NULL, NULL, NULL);
 if (then_expr == NULL)
 	return FALSE;
 
 st->delim = st->endc;	/* BRCLOSE or PRCLOSE */
 char *else_expr = ParseModifierPart(
-	st->ctxt, >cp, st->delim, st->eflags, _flags, NULL, NULL);
+	st->ctxt, >cp, st->delim, else_eflags, NULL, NULL, NULL);
 if (else_expr == NULL)
 	return FALSE;
 



CVS commit: src/sys/arch/x86/x86

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 16:45:41 UTC 2020

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Revert 1.112 "Disable x86 in-kernel AES temporarily."

The bug in fpu_kern_enter motivating this appears to have been fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.112 src/sys/arch/x86/x86/identcpu.c:1.113
--- src/sys/arch/x86/x86/identcpu.c:1.112	Mon Jul 20 15:11:29 2020
+++ src/sys/arch/x86/x86/identcpu.c	Mon Jul 20 16:45:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.112 2020/07/20 15:11:29 riastradh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.113 2020/07/20 16:45:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.112 2020/07/20 15:11:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.113 2020/07/20 16:45:41 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -1007,17 +1007,17 @@ cpu_probe(struct cpu_info *ci)
 		 * disabled temporarily while we diagnose the bug.
 		 */
 #ifdef __x86_64__	/* not yet implemented on i386 */
-		if (0 & cpu_feature[1] & CPUID2_AES)
+		if (cpu_feature[1] & CPUID2_AES)
 			aes_md_init(_ni_impl);
 		else
 #endif
-		if (0 & cpu_feature[4] & CPUID_VIA_HAS_ACE)
+		if (cpu_feature[4] & CPUID_VIA_HAS_ACE)
 			aes_md_init(_via_impl);
-		else if (0 & i386_has_sse && i386_has_sse2 &&
+		else if (i386_has_sse && i386_has_sse2 &&
 		(cpu_feature[1] & CPUID2_SSE3) &&
 		(cpu_feature[1] & CPUID2_SSSE3))
 			aes_md_init(_ssse3_impl);
-		else if (0 & i386_has_sse && i386_has_sse2)
+		else if (i386_has_sse && i386_has_sse2)
 			aes_md_init(_sse2_impl);
 	} else {
 		/*



CVS commit: src/sys/arch/x86/x86

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 16:43:03 UTC 2020

Modified Files:
src/sys/arch/x86/x86: fpu.c

Log Message:
Fix fpu_kern_enter in a softint that interrupted a softint.

We need to find the lwp that was originally interrupted to save its
fpu state.

With this, fpu-heavy programs (like firefox) are once again stable,
at least under modest stress testing, on systems configured to use
wifi with WPA2 and CCMP.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/x86/x86/fpu.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/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.71 src/sys/arch/x86/x86/fpu.c:1.72
--- src/sys/arch/x86/x86/fpu.c:1.71	Mon Jul 20 16:41:18 2020
+++ src/sys/arch/x86/x86/fpu.c	Mon Jul 20 16:43:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.71 2020/07/20 16:41:18 riastradh Exp $	*/
+/*	$NetBSD: fpu.c,v 1.72 2020/07/20 16:43:03 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.71 2020/07/20 16:41:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.72 2020/07/20 16:43:03 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -380,11 +380,9 @@ fpu_kern_enter(void)
 	 * If we are in a softint and have a pinned lwp, the fpu state is that
 	 * of the pinned lwp, so save it there.
 	 */
-	if ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL)) {
-		fpu_save_lwp(l->l_switchto);
-	} else {
-		fpu_save_lwp(l);
-	}
+	while ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
+		l = l->l_switchto;
+	fpu_save_lwp(l);
 
 	/*
 	 * Clear CR0_TS, which fpu_save_lwp set if it saved anything --



CVS commit: src/sys/arch/x86/x86

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 16:41:18 UTC 2020

Modified Files:
src/sys/arch/x86/x86: fpu.c

Log Message:
Save fpu state at IPL_VM to exclude fpu_kern_enter/leave.

This way fpu_kern_enter/leave cannot interrupt the transition, so the
transition from state-on-CPU to state-in-memory (with TS set) is
atomic whether in an interrupt or not.

(I am not 100% convinced that this is necessary, but it makes
reasoning about the transition simpler.)


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/x86/x86/fpu.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/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.70 src/sys/arch/x86/x86/fpu.c:1.71
--- src/sys/arch/x86/x86/fpu.c:1.70	Mon Jul 20 16:38:47 2020
+++ src/sys/arch/x86/x86/fpu.c	Mon Jul 20 16:41:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.70 2020/07/20 16:38:47 riastradh Exp $	*/
+/*	$NetBSD: fpu.c,v 1.71 2020/07/20 16:41:18 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.70 2020/07/20 16:38:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.71 2020/07/20 16:41:18 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -151,14 +151,15 @@ fpu_save_lwp(struct lwp *l)
 {
 	struct pcb *pcb = lwp_getpcb(l);
 	union savefpu *area = >pcb_savefpu;
+	int s;
 
-	kpreempt_disable();
+	s = splvm();
 	if (l->l_md.md_flags & MDL_FPU_IN_CPU) {
 		KASSERT((l->l_flag & LW_SYSTEM) == 0);
 		fpu_area_save(area, x86_xsave_features);
 		l->l_md.md_flags &= ~MDL_FPU_IN_CPU;
 	}
-	kpreempt_enable();
+	splx(s);
 }
 
 /*
@@ -299,8 +300,12 @@ fpu_handle_deferred(void)
 void
 fpu_switch(struct lwp *oldlwp, struct lwp *newlwp)
 {
+	struct cpu_info *ci __diagused = curcpu();
 	struct pcb *pcb;
 
+	KASSERTMSG(ci->ci_ilevel >= IPL_SCHED, "cpu%d ilevel=%d",
+	cpu_index(ci), ci->ci_ilevel);
+
 	if (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU) {
 		KASSERT(!(oldlwp->l_flag & LW_SYSTEM));
 		pcb = lwp_getpcb(oldlwp);
@@ -334,11 +339,13 @@ fpu_lwp_fork(struct lwp *l1, struct lwp 
 void
 fpu_lwp_abandon(struct lwp *l)
 {
+	int s;
+
 	KASSERT(l == curlwp);
-	kpreempt_disable();
+	s = splvm();
 	l->l_md.md_flags &= ~MDL_FPU_IN_CPU;
 	stts();
-	kpreempt_enable();
+	splx(s);
 }
 
 /* -- */



CVS commit: src/sys/arch/x86/x86

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 16:38:47 UTC 2020

Modified Files:
src/sys/arch/x86/x86: fpu.c

Log Message:
Revert 1.66 "Fix race in fpu save with fpu_kern_enter in softint."

This only fixed part of the race, and we can do it more simply.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/x86/x86/fpu.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/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.69 src/sys/arch/x86/x86/fpu.c:1.70
--- src/sys/arch/x86/x86/fpu.c:1.69	Mon Jul 20 16:37:34 2020
+++ src/sys/arch/x86/x86/fpu.c	Mon Jul 20 16:38:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.69 2020/07/20 16:37:34 riastradh Exp $	*/
+/*	$NetBSD: fpu.c,v 1.70 2020/07/20 16:38:47 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.69 2020/07/20 16:37:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.70 2020/07/20 16:38:47 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -126,8 +126,6 @@ __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.69
 #define stts() HYPERVISOR_fpu_taskswitch(1)
 #endif
 
-static void fpu_area_do_save(void *, uint64_t);
-
 void fpu_handle_deferred(void);
 void fpu_switch(struct lwp *, struct lwp *);
 
@@ -157,24 +155,8 @@ fpu_save_lwp(struct lwp *l)
 	kpreempt_disable();
 	if (l->l_md.md_flags & MDL_FPU_IN_CPU) {
 		KASSERT((l->l_flag & LW_SYSTEM) == 0);
-
-		/*
-		 * Order is important, in case we are interrupted and
-		 * the interrupt calls fpu_kern_enter, triggering
-		 * reentry of fpu_save_lwp:
-		 *
-		 * 1. Save FPU state.
-		 * 2. Note FPU state has been saved.
-		 * 3. Disable FPU access so the kernel doesn't
-		 *accidentally use it.
-		 *
-		 * Steps (1) and (2) are both idempotent until step
-		 * (3), after which point attempting to save the FPU
-		 * state will trigger #NM/fpudna fault.
-		 */
-		fpu_area_do_save(area, x86_xsave_features);
+		fpu_area_save(area, x86_xsave_features);
 		l->l_md.md_flags &= ~MDL_FPU_IN_CPU;
-		stts();
 	}
 	kpreempt_enable();
 }
@@ -263,8 +245,8 @@ fpu_errata_amd(void)
 	fldummy();
 }
 
-static void
-fpu_area_do_save(void *area, uint64_t xsave_features)
+void
+fpu_area_save(void *area, uint64_t xsave_features)
 {
 	switch (x86_fpu_save) {
 	case FPU_SAVE_FSAVE:
@@ -280,13 +262,7 @@ fpu_area_do_save(void *area, uint64_t xs
 		xsaveopt(area, xsave_features);
 		break;
 	}
-}
-
-void
-fpu_area_save(void *area, uint64_t xsave_features)
-{
 
-	fpu_area_do_save(area, xsave_features);
 	stts();
 }
 



CVS commit: src/sys/arch/x86/x86

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 16:37:35 UTC 2020

Modified Files:
src/sys/arch/x86/x86: fpu.c

Log Message:
Revert 1.67 "Restore the lwp's fpu state, not zeros, and leave with fpu 
enabled."

This didn't actually avoid double-restore, and it doesn't solve the
problem anyway, and made it harder to detect in-kernel fpu abuse.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/x86/x86/fpu.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/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.68 src/sys/arch/x86/x86/fpu.c:1.69
--- src/sys/arch/x86/x86/fpu.c:1.68	Mon Jul 13 16:51:51 2020
+++ src/sys/arch/x86/x86/fpu.c	Mon Jul 20 16:37:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.68 2020/07/13 16:51:51 riastradh Exp $	*/
+/*	$NetBSD: fpu.c,v 1.69 2020/07/20 16:37:34 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.68 2020/07/13 16:51:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.69 2020/07/20 16:37:34 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -421,9 +421,6 @@ void
 fpu_kern_leave(void)
 {
 	static const union savefpu zero_fpu __aligned(64);
-	const union savefpu *savefpu;
-	struct lwp *l = curlwp;
-	struct pcb *pcb;
 	struct cpu_info *ci = curcpu();
 	int s;
 
@@ -431,18 +428,17 @@ fpu_kern_leave(void)
 	KASSERT(ci->ci_kfpu_spl != -1);
 
 	/*
-	 * Restore the FPU state immediately to avoid leaking any
-	 * kernel secrets, or zero it if this is a kthread.
+	 * Zero the fpu registers; otherwise we might leak secrets
+	 * through Spectre-class attacks to userland, even if there are
+	 * no bugs in fpu state management.
 	 */
-	if ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
-		l = l->l_switchto;
-	if (l->l_flag & LW_SYSTEM) {
-		savefpu = _fpu;
-	} else {
-		pcb = lwp_getpcb(l);
-		savefpu = >pcb_savefpu;
-	}
-	fpu_area_restore(savefpu, x86_xsave_features);
+	fpu_area_restore(_fpu, x86_xsave_features);
+
+	/*
+	 * Set CR0_TS again so that the kernel can't accidentally use
+	 * the FPU.
+	 */
+	stts();
 
 	s = ci->ci_kfpu_spl;
 	ci->ci_kfpu_spl = -1;



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 16:32:14 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: sysv.exp

Log Message:
make(1): fix obscure edge case for ${VAR:e$=x}

The characters "$=" do not occur in either src or pkgsrc, therefore this
case is unlikely to occur in practice.


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/usr.bin/make/var.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/sysv.exp

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.283 src/usr.bin/make/var.c:1.284
--- src/usr.bin/make/var.c:1.283	Mon Jul 20 16:12:52 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 16:32:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.284 2020/07/20 16:32:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.284 2020/07/20 16:32:14 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.284 2020/07/20 16:32:14 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3080,12 +3080,8 @@ ApplyModifier_SysV(ApplyModifiersState *
 
 st->delim = '=';
 st->cp = st->tstr;
-VarPatternFlags pflags = 0;
-/* FIXME: There's no point in having a single $ at the end of a
- * SysV substitution since that will not be interpreted as an
- * anchor anyway. */
 char *lhs = ParseModifierPart(st->ctxt, >cp, st->delim, st->eflags,
-  , NULL, NULL);
+  NULL, NULL, NULL);
 if (lhs == NULL)
 	return 'c';
 

Index: src/usr.bin/make/unit-tests/sysv.exp
diff -u src/usr.bin/make/unit-tests/sysv.exp:1.7 src/usr.bin/make/unit-tests/sysv.exp:1.8
--- src/usr.bin/make/unit-tests/sysv.exp:1.7	Mon Jul 20 16:27:55 2020
+++ src/usr.bin/make/unit-tests/sysv.exp	Mon Jul 20 16:32:14 2020
@@ -15,6 +15,6 @@ a.c.c
 ax:Q b c d eb
 bcd.e
 &
-anchor-dollar: valux
+anchor-dollar: value
 anchor-dollar: valux
 exit status 0



CVS commit: src/usr.bin/make/unit-tests

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 16:27:55 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: sysv.exp sysv.mk

Log Message:
make(1): demonstrate obscure edge case in SysV modifier


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/sysv.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/sysv.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/sysv.exp
diff -u src/usr.bin/make/unit-tests/sysv.exp:1.6 src/usr.bin/make/unit-tests/sysv.exp:1.7
--- src/usr.bin/make/unit-tests/sysv.exp:1.6	Sun Jul 19 22:04:27 2020
+++ src/usr.bin/make/unit-tests/sysv.exp	Mon Jul 20 16:27:55 2020
@@ -15,4 +15,6 @@ a.c.c
 ax:Q b c d eb
 bcd.e
 &
+anchor-dollar: valux
+anchor-dollar: valux
 exit status 0

Index: src/usr.bin/make/unit-tests/sysv.mk
diff -u src/usr.bin/make/unit-tests/sysv.mk:1.7 src/usr.bin/make/unit-tests/sysv.mk:1.8
--- src/usr.bin/make/unit-tests/sysv.mk:1.7	Sun Jul 19 22:04:27 2020
+++ src/usr.bin/make/unit-tests/sysv.mk	Mon Jul 20 16:27:55 2020
@@ -1,6 +1,6 @@
-# $Id: sysv.mk,v 1.7 2020/07/19 22:04:27 rillig Exp $
+# $Id: sysv.mk,v 1.8 2020/07/20 16:27:55 rillig Exp $
 
-all: foo fun sam bla words ampersand
+all: foo fun sam bla words ampersand anchor-dollar
 
 FOO ?=
 FOOBAR = ${FOO:=bar}
@@ -54,3 +54,10 @@ words:
 ampersand:
 	@echo ${:U${a.bcd.e:L:a.%=%}:Q}
 	@echo ${:U${a.bcd.e:L:a.%=&}:Q}
+
+# Before 2020-07-20, when a SysV modifier was parsed, a single dollar
+# before the '=' was interpreted as an anchor, which doesn't make sense
+# since the anchor was discarded immediately.
+anchor-dollar:
+	@echo $@: ${:U${value:L:e$=x}:Q}
+	@echo $@: ${:U${value:L:e=x}:Q}



CVS commit: src/usr.bin/make/unit-tests

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 16:12:02 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk

Log Message:
make(1): add test for :tu modifier with spaces


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/modmisc.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.20 src/usr.bin/make/unit-tests/modmisc.exp:1.21
--- src/usr.bin/make/unit-tests/modmisc.exp:1.20	Mon Jul 20 14:50:41 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Mon Jul 20 16:12:02 2020
@@ -78,4 +78,5 @@ mod-assign: appended=1 2 3.
 3
 mod-assign: ran:3.
 mod-assign: global: 1, 3, 1 2 3, 3.
+mod-tu-space: A   B
 exit status 0

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.16 src/usr.bin/make/unit-tests/modmisc.mk:1.17
--- src/usr.bin/make/unit-tests/modmisc.mk:1.16	Sun Jul 19 20:49:44 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Mon Jul 20 16:12:02 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.16 2020/07/19 20:49:44 rillig Exp $
+# $Id: modmisc.mk,v 1.17 2020/07/20 16:12:02 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -20,6 +20,7 @@ all:	mod-S mod-C mod-at-varname mod-at-r
 all:	mod-subst-dollar mod-loop-dollar
 all:	mod-C-limits
 all:	mod-assign
+all:	mod-tu-space
 
 modsysv:
 	@echo "The answer is ${libfoo.a:L:libfoo.a=42}"
@@ -156,3 +157,9 @@ mod-assign:
 	# The assignments happen in the global scope and thus are
 	# preserved even after the shell command has been run.
 	@echo $@: global: ${FIRST:Q}, ${LAST:Q}, ${APPENDED:Q}, ${RAN:Q}.
+
+mod-tu-space:
+	# The :tu and :tl modifiers operate on the variable value
+	# as a single string, not as a list of words. Therefore,
+	# the adjacent spaces are preserved.
+	@echo $@: ${a   b:L:tu:Q}



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 16:12:52 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): move documentation for assignment modifiers


To generate a diff of this commit:
cvs rdiff -u -r1.282 -r1.283 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.282 src/usr.bin/make/var.c:1.283
--- src/usr.bin/make/var.c:1.282	Mon Jul 20 15:48:50 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 16:12:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2914,7 +2914,27 @@ ApplyModifier_IfElse(ApplyModifiersState
 return TRUE;
 }
 
-/* "::=", "::!=", "::+=", or "::?=" */
+/*
+ * The ::= modifiers actually assign a value to the variable.
+ * Their main purpose is in supporting modifiers of .for loop
+ * iterators and other obscure uses.  They always expand to
+ * nothing.  In a target rule that would otherwise expand to an
+ * empty line they can be preceded with @: to keep make happy.
+ * Eg.
+ *
+ * foo:	.USE
+ * .for i in ${.TARGET} ${.TARGET:R}.gz
+ * 	@: ${t::=$i}
+ *	@echo blah ${t:T}
+ * .endfor
+ *
+ *	  ::=	Assigns  as the new value of variable.
+ *	  ::?=	Assigns  as value of variable if
+ *			it was not already set.
+ *	  ::+=	Appends  to variable.
+ *	  ::!=	Assigns output of  as the new value of
+ *			variable.
+ */
 static int
 ApplyModifier_Assign(ApplyModifiersState *st)
 {
@@ -3158,25 +3178,7 @@ ApplyModifier_SysV(ApplyModifiersState *
  *			the form '${x:P}'.
  *	  :!!	Run cmd much the same as :sh run's the
  *			current value of the variable.
- * The ::= modifiers, actually assign a value to the variable.
- * Their main purpose is in supporting modifiers of .for loop
- * iterators and other obscure uses.  They always expand to
- * nothing.  In a target rule that would otherwise expand to an
- * empty line they can be preceded with @: to keep make happy.
- * Eg.
- *
- * foo:	.USE
- * .for i in ${.TARGET} ${.TARGET:R}.gz
- * 	@: ${t::=$i}
- *	@echo blah ${t:T}
- * .endfor
- *
- *	  ::=	Assigns  as the new value of variable.
- *	  ::?=	Assigns  as value of variable if
- *			it was not already set.
- *	  ::+=	Appends  to variable.
- *	  ::!=	Assigns output of  as the new value of
- *			variable.
+ * Assignment operators (see ApplyModifier_Assign).
  */
 static char *
 ApplyModifiers(char *nstr, const char *tstr,



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 15:48:50 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): prefer memcmp over strncmp


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.281 src/usr.bin/make/var.c:1.282
--- src/usr.bin/make/var.c:1.281	Mon Jul 20 15:44:12 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 15:48:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.281 2020/07/20 15:44:12 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.281 2020/07/20 15:44:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.281 2020/07/20 15:44:12 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1359,7 +1359,8 @@ VarSubstitute(GNode *ctx MAKE_ATTR_UNUSE
 	goto nosub;
 
 if (args->pflags & VARP_MATCH_START) {
-	if (strncmp(word, args->lhs, args->lhsLen) != 0)
+	if (wordLen < args->lhsLen ||
+	memcmp(word, args->lhs, args->lhsLen) != 0)
 	goto nosub;
 
 	if (args->pflags & VARP_MATCH_END) {



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 15:44:12 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): fix type of VarPattern.lhsLen and rhsLen

String length is measured in size_t, not int.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.280 src/usr.bin/make/var.c:1.281
--- src/usr.bin/make/var.c:1.280	Mon Jul 20 15:15:32 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 15:44:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.280 2020/07/20 15:15:32 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.281 2020/07/20 15:44:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.280 2020/07/20 15:15:32 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.281 2020/07/20 15:44:12 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.280 2020/07/20 15:15:32 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.281 2020/07/20 15:44:12 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -266,15 +266,14 @@ typedef struct {
  * several space-separated words). */
 } Var_Parse_State;
 
-/* struct passed as 'void *' to VarSubstitute() for ":S/lhs/rhs/",
- * to VarSYSVMatch() for ":lhs=rhs". */
+/* struct passed as 'void *' to VarSubstitute() for ":S/lhs/rhs/" */
 typedef struct {
-const char   *lhs;		/* String to match */
-int		  leftLen;	/* Length of string */
-const char   *rhs;		/* Replacement string (w/ &'s removed) */
-int		  rightLen;	/* Length of replacement */
+const char	*lhs;
+size_t	lhsLen;
+const char	*rhs;
+size_t	rhsLen;
 VarPatternFlags pflags;
-} VarPattern;
+} VarSubstituteArgs;
 
 /* struct passed as 'void *' to VarLoopExpand() for ":@tvar@str@" */
 typedef struct {
@@ -1352,55 +1351,54 @@ VarSubstitute(GNode *ctx MAKE_ATTR_UNUSE
 	  void *data)
 {
 size_t wordLen = strlen(word);
-VarPattern *pattern = data;
-const VarPatternFlags pflags = pattern->pflags;
+VarSubstituteArgs *args = data;
+const VarPatternFlags pflags = args->pflags;
 
 if ((pflags & (VARP_SUB_ONE | VARP_SUB_MATCHED)) ==
 	(VARP_SUB_ONE | VARP_SUB_MATCHED))
 	goto nosub;
 
-if (pattern->pflags & VARP_MATCH_START) {
-	if (strncmp(word, pattern->lhs, pattern->leftLen) != 0)
+if (args->pflags & VARP_MATCH_START) {
+	if (strncmp(word, args->lhs, args->lhsLen) != 0)
 	goto nosub;
 
-	if (pattern->pflags & VARP_MATCH_END) {
-	if (wordLen != (size_t)pattern->leftLen)
+	if (args->pflags & VARP_MATCH_END) {
+	if (wordLen != args->lhsLen)
 		goto nosub;
 
-	SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-	pattern->pflags |= VARP_SUB_MATCHED;
+	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
+	args->pflags |= VARP_SUB_MATCHED;
 	} else {
-	SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-	SepBuf_AddBytes(buf, word + pattern->leftLen,
-			wordLen - pattern->leftLen);
-	pattern->pflags |= VARP_SUB_MATCHED;
+	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
+	SepBuf_AddBytes(buf, word + args->lhsLen, wordLen - args->lhsLen);
+	args->pflags |= VARP_SUB_MATCHED;
 	}
 	return;
 }
 
-if (pattern->pflags & VARP_MATCH_END) {
-	if (wordLen < (size_t)pattern->leftLen)
+if (args->pflags & VARP_MATCH_END) {
+	if (wordLen < args->lhsLen)
 	goto nosub;
-	const char *start = word + (wordLen - pattern->leftLen);
-	if (memcmp(start, pattern->lhs, pattern->leftLen) != 0)
+	const char *start = word + (wordLen - args->lhsLen);
+	if (memcmp(start, args->lhs, args->lhsLen) != 0)
 	goto nosub;
 
 	SepBuf_AddBytes(buf, word, start - word);
-	SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-	pattern->pflags |= VARP_SUB_MATCHED;
+	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
+	args->pflags |= VARP_SUB_MATCHED;
 	return;
 }
 
 /* unanchored */
 const char *cp;
-while ((cp = Str_FindSubstring(word, pattern->lhs)) != NULL) {
+while ((cp = Str_FindSubstring(word, args->lhs)) != NULL) {
 	SepBuf_AddBytes(buf, word, cp - word);
-	SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-	wordLen -= (cp - word) + pattern->leftLen;
-	word = cp + pattern->leftLen;
-	if (wordLen == 0 || !(pattern->pflags & VARP_SUB_GLOBAL))
+	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
+	wordLen -= (cp - word) + args->lhsLen;
+	word = cp + args->lhsLen;
+	if (wordLen == 0 || !(args->pflags & VARP_SUB_GLOBAL))
 	break;
-	pattern->pflags |= VARP_SUB_MATCHED;
+	args->pflags |= VARP_SUB_MATCHED;
 }
 nosub:
 SepBuf_AddBytes(buf, word, wordLen);
@@ -1896,12 +1894,12 @@ VarRange(const char *str, int ac)
 static char *
 ParseModifierPart(GNode 

CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 15:15:32 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): fix undefined behavior in :S modifier

The expression word + wordLen - leftLen had resulted in an out-of-bounds
pointer before.  Luckily the heap addresses were high enough in typical
applications to prevent a wrap-around.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.279 src/usr.bin/make/var.c:1.280
--- src/usr.bin/make/var.c:1.279	Mon Jul 20 15:10:35 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 15:15:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.279 2020/07/20 15:10:35 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.280 2020/07/20 15:15:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.279 2020/07/20 15:10:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.280 2020/07/20 15:15:32 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.279 2020/07/20 15:10:35 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.280 2020/07/20 15:15:32 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1379,11 +1379,13 @@ VarSubstitute(GNode *ctx MAKE_ATTR_UNUSE
 }
 
 if (pattern->pflags & VARP_MATCH_END) {
-	const char *cp = word + (wordLen - pattern->leftLen);
-	if (cp < word || strncmp(cp, pattern->lhs, pattern->leftLen) != 0)
+	if (wordLen < (size_t)pattern->leftLen)
+	goto nosub;
+	const char *start = word + (wordLen - pattern->leftLen);
+	if (memcmp(start, pattern->lhs, pattern->leftLen) != 0)
 	goto nosub;
 
-	SepBuf_AddBytes(buf, word, cp - word);
+	SepBuf_AddBytes(buf, word, start - word);
 	SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
 	pattern->pflags |= VARP_SUB_MATCHED;
 	return;



CVS commit: src/sys/arch/x86/x86

2020-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 20 15:11:29 UTC 2020

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Disable x86 in-kernel AES temporarily.

There's a bug in the FPU state handling that it triggers -- likely
limited to the softint path since I've only ever seen it on a system
using wifi configured with WPA2 and CCMP, which uses AES heavily in
softint.

This is to be reverted once we diagnose the bug.  (There is also a
performance regression on wifi with WPA2 and CCMP, which I plan to
fix too once we figure out the FPU state handling bug.)


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.111 src/sys/arch/x86/x86/identcpu.c:1.112
--- src/sys/arch/x86/x86/identcpu.c:1.111	Mon Jun 29 23:51:35 2020
+++ src/sys/arch/x86/x86/identcpu.c	Mon Jul 20 15:11:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.111 2020/06/29 23:51:35 riastradh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.112 2020/07/20 15:11:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.111 2020/06/29 23:51:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.112 2020/07/20 15:11:29 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -1000,18 +1000,24 @@ cpu_probe(struct cpu_info *ci)
 		/* Early patch of text segment. */
 		x86_patch(true);
 #endif
+		/*
+		 * XXX There is a bug with FPU in kernel that we
+		 * haven't been able to track down yet, and all of the
+		 * accelerated AES code relies on that, so it is
+		 * disabled temporarily while we diagnose the bug.
+		 */
 #ifdef __x86_64__	/* not yet implemented on i386 */
-		if (cpu_feature[1] & CPUID2_AES)
+		if (0 & cpu_feature[1] & CPUID2_AES)
 			aes_md_init(_ni_impl);
 		else
 #endif
-		if (cpu_feature[4] & CPUID_VIA_HAS_ACE)
+		if (0 & cpu_feature[4] & CPUID_VIA_HAS_ACE)
 			aes_md_init(_via_impl);
-		else if (i386_has_sse && i386_has_sse2 &&
+		else if (0 & i386_has_sse && i386_has_sse2 &&
 		(cpu_feature[1] & CPUID2_SSE3) &&
 		(cpu_feature[1] & CPUID2_SSSE3))
 			aes_md_init(_ssse3_impl);
-		else if (i386_has_sse && i386_has_sse2)
+		else if (0 & i386_has_sse && i386_has_sse2)
 			aes_md_init(_sse2_impl);
 	} else {
 		/*



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 15:10:35 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): make implementation of the :S modifier simpler


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/usr.bin/make/var.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.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.278 src/usr.bin/make/var.c:1.279
--- src/usr.bin/make/var.c:1.278	Mon Jul 20 14:50:41 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 15:10:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.278 2020/07/20 14:50:41 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.279 2020/07/20 15:10:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.278 2020/07/20 14:50:41 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.279 2020/07/20 15:10:35 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.278 2020/07/20 14:50:41 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.279 2020/07/20 15:10:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1351,96 +1351,55 @@ static void
 VarSubstitute(GNode *ctx MAKE_ATTR_UNUSED, const char *word, SepBuf *buf,
 	  void *data)
 {
-int wordLen = strlen(word);
-const char *cp;		/* General pointer */
+size_t wordLen = strlen(word);
 VarPattern *pattern = data;
+const VarPatternFlags pflags = pattern->pflags;
 
-if ((pattern->pflags & (VARP_SUB_ONE | VARP_SUB_MATCHED)) !=
-	(VARP_SUB_ONE | VARP_SUB_MATCHED)) {
-	/*
-	 * Still substituting -- break it down into simple anchored cases
-	 * and if none of them fits, perform the general substitution case.
-	 */
-	if ((pattern->pflags & VARP_MATCH_START) &&
-	(strncmp(word, pattern->lhs, pattern->leftLen) == 0)) {
-	/*
-	 * Anchored at start and beginning of word matches pattern
-	 */
-	if ((pattern->pflags & VARP_MATCH_END) &&
-	(wordLen == pattern->leftLen)) {
-		/*
-		 * Also anchored at end and matches to the end (word
-		 * is same length as pattern).
-		 */
-		SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-		pattern->pflags |= VARP_SUB_MATCHED;
-	} else if (pattern->pflags & VARP_MATCH_END) {
-		/*
-		 * Doesn't match to end -- copy word wholesale
-		 */
-		goto nosub;
-	} else {
-		/*
-		 * Matches at start but need to copy in trailing characters
-		 */
-		SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-		SepBuf_AddBytes(buf, word + pattern->leftLen,
-			wordLen - pattern->leftLen);
-		pattern->pflags |= VARP_SUB_MATCHED;
-	}
-	} else if (pattern->pflags & VARP_MATCH_START) {
-	/*
-	 * Had to match at start of word and didn't -- copy whole word.
-	 */
+if ((pflags & (VARP_SUB_ONE | VARP_SUB_MATCHED)) ==
+	(VARP_SUB_ONE | VARP_SUB_MATCHED))
+	goto nosub;
+
+if (pattern->pflags & VARP_MATCH_START) {
+	if (strncmp(word, pattern->lhs, pattern->leftLen) != 0)
 	goto nosub;
-	} else if (pattern->pflags & VARP_MATCH_END) {
-	/*
-	 * Anchored at end, Find only place match could occur (leftLen
-	 * characters from the end of the word) and see if it does. Note
-	 * that because the $ will be left at the end of the lhs, we have
-	 * to use strncmp.
-	 */
-	cp = word + (wordLen - pattern->leftLen);
-	if (cp >= word &&
-		strncmp(cp, pattern->lhs, pattern->leftLen) == 0) {
-		/*
-		 * Match found. Stuff in the initial, unmatched part of the
-		 * word followed by the right-hand-side.
-		 */
-		SepBuf_AddBytes(buf, word, cp - word);
-		SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-		pattern->pflags |= VARP_SUB_MATCHED;
-	} else {
-		/*
-		 * Had to match at end and didn't. Copy entire word.
-		 */
+
+	if (pattern->pflags & VARP_MATCH_END) {
+	if (wordLen != (size_t)pattern->leftLen)
 		goto nosub;
-	}
+
+	SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
+	pattern->pflags |= VARP_SUB_MATCHED;
 	} else {
-	/*
-	 * Pattern is unanchored: search for the pattern in the word using
-	 * String_FindSubstring, copying unmatched portions and the
-	 * right-hand-side for each match found, handling non-global
-	 * substitutions correctly, etc. When the loop is done, any
-	 * remaining part of the word (word and wordLen are adjusted
-	 * accordingly through the loop) is copied straight into the
-	 * buffer.
-	 */
-	while ((cp = Str_FindSubstring(word, pattern->lhs)) != NULL) {
-		SepBuf_AddBytes(buf, word, cp - word);
-		SepBuf_AddBytes(buf, pattern->rhs, pattern->rightLen);
-		wordLen -= (cp - word) + pattern->leftLen;
-		word = cp + pattern->leftLen;
-		if (wordLen == 0)
-		break;
-		if ((pattern->pflags & VARP_SUB_GLOBAL) == 0)
-		break;
-		pattern->pflags |= 

CVS commit: src/sys/arch/mips/mips

2020-07-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul 20 14:59:57 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
No need for cpu_hatch_lock after all since we hatch secondaries one at a time


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.54 src/sys/arch/mips/mips/cpu_subr.c:1.55
--- src/sys/arch/mips/mips/cpu_subr.c:1.54	Mon Jul 20 14:38:38 2020
+++ src/sys/arch/mips/mips/cpu_subr.c	Mon Jul 20 14:59:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.54 2020/07/20 14:38:38 skrll Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.55 2020/07/20 14:59:57 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.54 2020/07/20 14:38:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.55 2020/07/20 14:59:57 jmcneill Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -106,8 +106,6 @@ const pcu_ops_t * const pcu_ops_md_defs[
 };
 
 #ifdef MULTIPROCESSOR
-static kmutex_t cpu_hatch_lock;
-
 struct cpu_info * cpuid_infos[MAXCPUS] = {
 	[0] = _info_store,
 };
@@ -951,9 +949,7 @@ cpu_hatch(struct cpu_info *ci)
 	 * Let this CPU do its own post-running initialization
 	 * (for things that have to be done on the local CPU).
 	 */
-	mutex_enter(_hatch_lock);
 	(*mips_locoresw.lsw_cpu_run)(ci);
-	mutex_exit(_hatch_lock);
 
 	/*
 	 * Now turn on interrupts (and verify they are on).
@@ -977,8 +973,6 @@ cpu_boot_secondary_processors(void)
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci;
 
-	mutex_init(_hatch_lock, MUTEX_DEFAULT, IPL_HIGH);
-
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		if (CPU_IS_PRIMARY(ci))
 			continue;



CVS commit: src/usr.bin/make

2020-07-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jul 20 14:50:41 UTC 2020

Modified Files:
src/usr.bin/make: parse.c var.c
src/usr.bin/make/unit-tests: modmisc.exp

Log Message:
make(1): make modifier handling simpler

Implementing a modifier such as :S or :M should not be concerned with
separating the words of the resulting string.  Ideally this should be
done in the same way by all modifiers.

Before, the :R (filename root) modifier added a separator even if the
resulting filename root was an empty string.  The chances that this
change in behavior breaks anything are epsilon.

The :@ modifier, if it appeared after a :ts modifier, did not use the
word separator from the :ts modifier (which all other modifiers do) but
always added a space.  This behavior has been preserved for now.  It's an
unnecessary inconsistency though.

In contrast to Buffer, the newly added SepBuf uses size_t for memory
sizes and also uses the conventional parameter order (mem, memsize)
instead of the unusual (memsize, mem).


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/make/parse.c
cvs rdiff -u -r1.277 -r1.278 src/usr.bin/make/var.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/modmisc.exp

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.237 src/usr.bin/make/parse.c:1.238
--- src/usr.bin/make/parse.c:1.237	Sun Jul 19 12:26:17 2020
+++ src/usr.bin/make/parse.c	Mon Jul 20 14:50:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.237 2020/07/19 12:26:17 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.238 2020/07/20 14:50:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.237 2020/07/19 12:26:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.238 2020/07/20 14:50:41 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.237 2020/07/19 12:26:17 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.238 2020/07/20 14:50:41 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1938,9 +1938,8 @@ Parse_DoVar(char *line, GNode *ctxt)
 	break;
 }
 
-while (isspace ((unsigned char)*cp)) {
+while (isspace((unsigned char)*cp))
 	cp++;
-}
 
 if (type == VAR_APPEND) {
 	Var_Append(line, cp, ctxt);
@@ -1980,7 +1979,7 @@ Parse_DoVar(char *line, GNode *ctxt)
 	/*
 	 * There's a dollar sign in the command, so perform variable
 	 * expansion on the whole thing. The resulting string will need
-	 * freeing when we're done, so set freeCmd to TRUE.
+	 * freeing when we're done.
 	 */
 	cp = Var_Subst(NULL, cp, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES);
 	freeCp = TRUE;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.277 src/usr.bin/make/var.c:1.278
--- src/usr.bin/make/var.c:1.277	Sun Jul 19 22:22:01 2020
+++ src/usr.bin/make/var.c	Mon Jul 20 14:50:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.277 2020/07/19 22:22:01 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.278 2020/07/20 14:50:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.277 2020/07/19 22:22:01 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.278 2020/07/20 14:50:41 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.277 2020/07/19 22:22:01 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.278 2020/07/20 14:50:41 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1106,103 +1106,110 @@ Var_Value(const char *name, GNode *ctxt,
 }
 
 
+/* SepBuf is a string being built from "words", interleaved with separators. */
+typedef struct {
+Buffer buf;
+Boolean needSep;
+char sep;
+} SepBuf;
+
+static void
+SepBuf_Init(SepBuf *buf, char sep)
+{
+Buf_Init(>buf, 32 /* bytes */);
+buf->needSep = FALSE;
+buf->sep = sep;
+}
+
+static void
+SepBuf_Sep(SepBuf *buf)
+{
+buf->needSep = TRUE;
+}
+
+static void
+SepBuf_AddBytes(SepBuf *buf, const void *mem, size_t mem_size)
+{
+if (mem_size == 0)
+	return;
+if (buf->needSep && buf->sep != '\0') {
+	Buf_AddByte(>buf, buf->sep);
+	buf->needSep = FALSE;
+}
+Buf_AddBytes(>buf, mem_size, mem);
+}
+
+static char *
+SepBuf_Destroy(SepBuf *buf, Boolean free_buf)
+{
+return Buf_Destroy(>buf, free_buf);
+}
+
+
 /* This callback for VarModify gets a single word from an expression and
  * typically adds a modification of this word to the buffer. It may also do
- * nothing or add several words.
- *
- * If addSpaces is TRUE, it must add a space before adding anything else to
- * the buffer.
- *
- * It returns the addSpace value for the next 

CVS commit: src/sys/arch/mips/mips

2020-07-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 20 14:38:38 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
Fix non-MULTIPROCESSOR build


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.53 src/sys/arch/mips/mips/cpu_subr.c:1.54
--- src/sys/arch/mips/mips/cpu_subr.c:1.53	Mon Jul 20 14:19:41 2020
+++ src/sys/arch/mips/mips/cpu_subr.c	Mon Jul 20 14:38:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.53 2020/07/20 14:19:41 jmcneill Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.54 2020/07/20 14:38:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.53 2020/07/20 14:19:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.54 2020/07/20 14:38:38 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -75,8 +75,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v
 extern struct cpu_softc octeon_cpu_softc[];
 #endif
 
-static kmutex_t cpu_hatch_lock;
-
 struct cpu_info cpu_info_store
 #if defined(MULTIPROCESSOR) && !defined(MIPS64_OCTEON)
 	__section(".data1")
@@ -108,6 +106,8 @@ const pcu_ops_t * const pcu_ops_md_defs[
 };
 
 #ifdef MULTIPROCESSOR
+static kmutex_t cpu_hatch_lock;
+
 struct cpu_info * cpuid_infos[MAXCPUS] = {
 	[0] = _info_store,
 };



CVS commit: src/share/mk

2020-07-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul 20 14:24:13 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Switch ports using MI wsfb drivers to HAVE_XORG_SERVER_VER=120.

Xorg wsfb servers from 1.20 for dreamcast (16bpp), hp300 (8bpp), and
luna68k (1bpp) work fine even on NetBSD 9.0, and zaurus is also
confirmed working.

Discussed with mrg@ and macallan@ on tech-x11:
 https://mail-index.netbsd.org/tech-x11/2020/07/thread1.html#002098


To generate a diff of this commit:
cvs rdiff -u -r1.1200 -r1.1201 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1200 src/share/mk/bsd.own.mk:1.1201
--- src/share/mk/bsd.own.mk:1.1200	Sat Jul  4 21:02:16 2020
+++ src/share/mk/bsd.own.mk	Mon Jul 20 14:24:13 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1200 2020/07/04 21:02:16 chs Exp $
+#	$NetBSD: bsd.own.mk,v 1.1201 2020/07/20 14:24:13 tsutsui Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1517,17 +1517,11 @@ X11SRCDIR.${_proto}proto?=		${X11SRCDIRM
 .if \
 ${MACHINE} == "alpha"	|| \
 ${MACHINE} == "amiga"	|| \
-${MACHINE} == "ews4800mips"	|| \
-${MACHINE} == "hpcarm"	|| \
-${MACHINE} == "hpcmips"	|| \
-${MACHINE} == "hpcsh"	|| \
 ${MACHINE} == "mac68k"	|| \
 ${MACHINE} == "netwinder"	|| \
-${MACHINE} == "newsmips"	|| \
 ${MACHINE} == "sgimips"	|| \
 ${MACHINE} == "vax"		|| \
-${MACHINE} == "x68k"	|| \
-${MACHINE} == "zaurus"
+${MACHINE} == "x68k"
 HAVE_XORG_SERVER_VER?=110
 .else
 HAVE_XORG_SERVER_VER?=120



CVS commit: src/sys/arch/mips/mips

2020-07-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul 20 14:19:41 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
Serialize CPU hatch annoucement printfs and wait for CPUs to start before
returning from cpu_boot_secondary_processors.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.52 src/sys/arch/mips/mips/cpu_subr.c:1.53
--- src/sys/arch/mips/mips/cpu_subr.c:1.52	Mon Jul 20 10:53:47 2020
+++ src/sys/arch/mips/mips/cpu_subr.c	Mon Jul 20 14:19:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.52 2020/07/20 10:53:47 skrll Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.53 2020/07/20 14:19:41 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.52 2020/07/20 10:53:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.53 2020/07/20 14:19:41 jmcneill Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -75,6 +75,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v
 extern struct cpu_softc octeon_cpu_softc[];
 #endif
 
+static kmutex_t cpu_hatch_lock;
+
 struct cpu_info cpu_info_store
 #if defined(MULTIPROCESSOR) && !defined(MIPS64_OCTEON)
 	__section(".data1")
@@ -949,7 +951,9 @@ cpu_hatch(struct cpu_info *ci)
 	 * Let this CPU do its own post-running initialization
 	 * (for things that have to be done on the local CPU).
 	 */
+	mutex_enter(_hatch_lock);
 	(*mips_locoresw.lsw_cpu_run)(ci);
+	mutex_exit(_hatch_lock);
 
 	/*
 	 * Now turn on interrupts (and verify they are on).
@@ -973,6 +977,8 @@ cpu_boot_secondary_processors(void)
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci;
 
+	mutex_init(_hatch_lock, MUTEX_DEFAULT, IPL_HIGH);
+
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		if (CPU_IS_PRIMARY(ci))
 			continue;
@@ -988,8 +994,8 @@ cpu_boot_secondary_processors(void)
 		atomic_or_ulong(>ci_flags, CPUF_RUNNING);
 		kcpuset_set(cpus_running, cpu_index(ci));
 		// Spin until the cpu calls idle_loop
-		for (u_int i = 0; i < 100; i++) {
-			if (kcpuset_isset(cpus_running, cpu_index(ci)))
+		for (u_int i = 0; i < 1; i++) {
+			if (kcpuset_isset(kcpuset_running, cpu_index(ci)))
 break;
 			delay(1000);
 		}



CVS commit: src/sys/arch/mips/cavium

2020-07-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul 20 14:05:51 UTC 2020

Modified Files:
src/sys/arch/mips/cavium: octeon_intr.c

Log Message:
Simplify IPI handling even more for now and run everything at IPL_HIGH.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/cavium/octeon_intr.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/mips/cavium/octeon_intr.c
diff -u src/sys/arch/mips/cavium/octeon_intr.c:1.19 src/sys/arch/mips/cavium/octeon_intr.c:1.20
--- src/sys/arch/mips/cavium/octeon_intr.c:1.19	Mon Jul 20 13:30:41 2020
+++ src/sys/arch/mips/cavium/octeon_intr.c	Mon Jul 20 14:05:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_intr.c,v 1.19 2020/07/20 13:30:41 jmcneill Exp $	*/
+/*	$NetBSD: octeon_intr.c,v 1.20 2020/07/20 14:05:51 jmcneill Exp $	*/
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
  * All rights reserved.
@@ -44,7 +44,7 @@
 #define __INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_intr.c,v 1.19 2020/07/20 13:30:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_intr.c,v 1.20 2020/07/20 14:05:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -158,42 +158,19 @@ struct octeon_intrhand {
 static int octeon_send_ipi(struct cpu_info *, int);
 static int octeon_ipi_intr(void *);
 
-struct octeon_intrhand ipi_intrhands[2] = {
+struct octeon_intrhand ipi_intrhands[1] = {
 	[0] = {
 		.ih_func = octeon_ipi_intr,
 		.ih_arg = (void *)(uintptr_t)__BITS(15,0),
 		.ih_irq = CIU_INT_MBOX_15_0,
-		.ih_ipl = IPL_SCHED,
-	},
-	[1] = {
-		.ih_func = octeon_ipi_intr,
-		.ih_arg = (void *)(uintptr_t)__BITS(31,16),
-		.ih_irq = CIU_INT_MBOX_31_16,
 		.ih_ipl = IPL_HIGH,
 	},
 };
-
-#define	OCTEON_IPI_SCHED(n)	__BIT((n) + 0)
-#define	OCTEON_IPI_HIGH(n)	__BIT((n) + 16)
-
-static uint32_t octeon_ipi_mbox_mask[NIPIS] = {
-	[IPI_NOP]		= OCTEON_IPI_SCHED(IPI_NOP),
-	[IPI_AST]		= OCTEON_IPI_SCHED(IPI_AST),
-	[IPI_SHOOTDOWN]		= OCTEON_IPI_SCHED(IPI_SHOOTDOWN),
-	[IPI_SYNCICACHE]	= OCTEON_IPI_SCHED(IPI_SYNCICACHE),
-	[IPI_KPREEMPT]		= OCTEON_IPI_SCHED(IPI_KPREEMPT),
-	[IPI_SUSPEND]		= OCTEON_IPI_HIGH(IPI_SUSPEND),
-	[IPI_HALT]		= OCTEON_IPI_HIGH(IPI_HALT),
-	[IPI_XCALL]		= OCTEON_IPI_HIGH(IPI_XCALL),
-	[IPI_GENERIC]		= OCTEON_IPI_HIGH(IPI_GENERIC),
-	[IPI_WDOG]		= OCTEON_IPI_HIGH(IPI_WDOG),
-};
 #endif
 
 struct octeon_intrhand *octciu_intrs[NIRQS] = {
 #ifdef MULTIPROCESSOR
 	[CIU_INT_MBOX_15_0] = _intrhands[0],
-	[CIU_INT_MBOX_31_16] = _intrhands[1],
 #endif
 };
 
@@ -270,8 +247,7 @@ octeon_intr_init(struct cpu_info *ci)
 
 #ifdef MULTIPROCESSOR
 	// Enable the IPIs
-	cpu->cpu_ip3_enable[0] |= __BIT(CIU_INT_MBOX_15_0);
-	cpu->cpu_ip4_enable[0] |= __BIT(CIU_INT_MBOX_31_16);
+	cpu->cpu_ip4_enable[0] |= __BIT(CIU_INT_MBOX_15_0);
 #endif
 
 	if (ci->ci_dev) {
@@ -516,21 +492,16 @@ octeon_ipi_intr(void *arg)
 {
 	struct cpu_info * const ci = curcpu();
 	struct cpu_softc * const cpu = ci->ci_softc;
-	uint32_t mbox_mask = (uintptr_t) arg;
-	uint32_t ipi_mask;
+	uint32_t ipi_mask = (uintptr_t) arg;
 
-	KASSERTMSG((mbox_mask & __BITS(31,16)) == 0 || ci->ci_cpl >= IPL_SCHED,
-	"mbox_mask %#"PRIx32" cpl %d", mbox_mask, ci->ci_cpl);
+	KASSERTMSG(ci->ci_cpl == IPL_HIGH,
+	"ipi_mask %#"PRIx32" cpl %d", ipi_mask, ci->ci_cpl);
 
-	mbox_mask &= mips3_ld(cpu->cpu_mbox_set);
-	if (mbox_mask == 0)
+	ipi_mask &= mips3_ld(cpu->cpu_mbox_set);
+	if (ipi_mask == 0)
 		return 0;
 
-	mips3_sd(cpu->cpu_mbox_clr, mbox_mask);
-
-	ipi_mask = mbox_mask;
-	if (ci->ci_cpl >= IPL_SCHED)
-		ipi_mask >>= 16;
+	mips3_sd(cpu->cpu_mbox_clr, ipi_mask);
 
 	KASSERT(ipi_mask < __BIT(NIPIS));
 
@@ -578,12 +549,11 @@ octeon_send_ipi(struct cpu_info *ci, int
 		return -1;
 
 	struct cpu_softc * const cpu = ci->ci_softc;
-	const uint32_t mbox_mask = octeon_ipi_mbox_mask[req];
 	const uint32_t ipi_mask = __BIT(req);
 
 	atomic_or_64(>ci_request_ipis, ipi_mask);
 
-	mips3_sd(cpu->cpu_mbox_set, mbox_mask);
+	mips3_sd(cpu->cpu_mbox_set, ipi_mask);
 
 	return 0;
 }



CVS commit: src/external/mit/xorg/server

2020-07-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul 20 13:59:57 UTC 2020

Modified Files:
src/external/mit/xorg/server/xorg-server.old/hw/xnest: Makefile
src/external/mit/xorg/server/xorg-server/hw/xnest: Makefile

Log Message:
Remove extra "-I" for ${X11INCS.DIX} macro.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile
cvs rdiff -u -r1.21 -r1.22 \
src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile
diff -u src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile:1.3 src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile:1.4
--- src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile:1.3	Sun May 21 15:28:40 2017
+++ src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile	Mon Jul 20 13:59:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2017/05/21 15:28:40 riastradh Exp $
+#	$NetBSD: Makefile,v 1.4 2020/07/20 13:59:57 tsutsui Exp $
 
 .include 
 
@@ -28,7 +28,7 @@ CPPFLAGS+=	-I${X11SRCDIR.xorg-server}/hw
 		-I${DESTDIR}${X11INCDIR}/X11/extensions \
 		-I${DESTDIR}${X11INCDIR}/pixman-1 \
 		-I${X11SRCDIR.xorg-server}/../include \
-		-I${X11INCS.DIX}
+		${X11INCS.DIX}
 
 CPPFLAGS+=	${X11FLAGS.OS_DEFINES} \
 		${X11FLAGS.EXTENSION} \

Index: src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile
diff -u src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile:1.21 src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile:1.22
--- src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile:1.21	Mon Dec 31 11:14:06 2018
+++ src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile	Mon Jul 20 13:59:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2018/12/31 11:14:06 mrg Exp $
+#	$NetBSD: Makefile,v 1.22 2020/07/20 13:59:57 tsutsui Exp $
 
 .include 
 
@@ -30,7 +30,7 @@ CPPFLAGS+=	-I${X11SRCDIR.xorg-server}/hw
 		-I${DESTDIR}${X11INCDIR}/X11/extensions \
 		-I${DESTDIR}${X11INCDIR}/pixman-1 \
 		-I${X11SRCDIR.xorg-server}/../include \
-		-I${X11INCS.DIX}
+		${X11INCS.DIX}
 
 CPPFLAGS+=	${X11FLAGS.OS_DEFINES} \
 		${X11FLAGS.EXTENSION} \



CVS commit: src/share/wscons/fonts

2020-07-20 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Mon Jul 20 13:58:52 UTC 2020

Modified Files:
src/share/wscons/fonts: spleen-12x24.fnt.uue spleen-16x32.fnt.uue
spleen-32x64.fnt.uue spleen-5x8.fnt.uue spleen-6x12.fnt.uue
spleen-8x16.fnt.uue

Log Message:
Update Spleen wscons fonts to version 1.8.1, bringing the following
improvements:

- Center tilde vertically for all sizes, as modern fonts do


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/wscons/fonts/spleen-12x24.fnt.uue \
src/share/wscons/fonts/spleen-16x32.fnt.uue \
src/share/wscons/fonts/spleen-32x64.fnt.uue \
src/share/wscons/fonts/spleen-6x12.fnt.uue \
src/share/wscons/fonts/spleen-8x16.fnt.uue
cvs rdiff -u -r1.2 -r1.3 src/share/wscons/fonts/spleen-5x8.fnt.uue

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

Modified files:

Index: src/share/wscons/fonts/spleen-12x24.fnt.uue
diff -u src/share/wscons/fonts/spleen-12x24.fnt.uue:1.1 src/share/wscons/fonts/spleen-12x24.fnt.uue:1.2
--- src/share/wscons/fonts/spleen-12x24.fnt.uue:1.1	Sun Jun 28 14:26:18 2020
+++ src/share/wscons/fonts/spleen-12x24.fnt.uue	Mon Jul 20 13:58:52 2020
@@ -133,8 +133,8 @@ M`&``P'^``'_@`&``P`&
 M```!X`,`!@`&``8`!@`&``8`!@`,`#@`.``,``8`!@`&``8`
 M!@`&``8``P`!X```!@`&``8`!@`&``8`!@`&``8`!@`&``8`!@`&
 M``8`!@`&``8\``8``P`#``,``P`#``,``P`!@`#@`.`!@`,`
-M`P`#``,``P`#``,`!@`\.&!L8,;`PX``
-M
+M`P`#``,``P`#``,`!@`\```X8@QL##
+M@```
 M
 M
 M
Index: src/share/wscons/fonts/spleen-16x32.fnt.uue
diff -u src/share/wscons/fonts/spleen-16x32.fnt.uue:1.1 src/share/wscons/fonts/spleen-16x32.fnt.uue:1.2
--- src/share/wscons/fonts/spleen-16x32.fnt.uue:1.1	Sun Jun 28 14:26:18 2020
+++ src/share/wscons/fonts/spleen-16x32.fnt.uue	Mon Jul 20 13:58:52 2020
@@ -178,8 +178,8 @@ M``#\`?P#@`,``P`#``,``P`#``,``P`'`#X`/``
 M`P`#``,``X`!_`#\`8`!@`&``8`!@`&``8`!@`&``8`!
 M@`&``8`!@`&``8`!@`&``8`!@`&``8`!@`&`/P`_@`'`
 M`,``P`#``,``P`#``,``P`#@`'P`/``\`'P`X`#``,``P`#``,``P`#``,`!
-MP#^`/P`.#!\,.YPQ^##P
-M
+MP#^`/PX,'PP[G#'X
+M,/``
 M
 M
 M
Index: src/share/wscons/fonts/spleen-32x64.fnt.uue
diff -u src/share/wscons/fonts/spleen-32x64.fnt.uue:1.1 src/share/wscons/fonts/spleen-32x64.fnt.uue:1.2
--- src/share/wscons/fonts/spleen-32x64.fnt.uue:1.1	Sun Jun 28 14:26:18 2020
+++ src/share/wscons/fonts/spleen-32x64.fnt.uue	Mon Jul 20 13:58:52 2020
@@ -716,10 +716,10 @@ M`/#P\/#X_'X
 M#__P```?\```/_```'X```#\^/#P\/#P
 M\/#P\/#P\/#P\?``
 M``/@``__X``/_\``#_^```_^
-M>`#P`?X`\`/_`/`'_X#P#\_!\`^'
-MX_`/`__@#P'_P`\`_X`/`#X`
 M
 M
+M``!X`/`!_@#P`_\`\`?_@/`/S\'P#X?C\`\#_^`/`?_`
+M#P#_@`\`/@``
 M
 M
 M
Index: src/share/wscons/fonts/spleen-6x12.fnt.uue
diff -u src/share/wscons/fonts/spleen-6x12.fnt.uue:1.1 src/share/wscons/fonts/spleen-6x12.fnt.uue:1.2
--- src/share/wscons/fonts/spleen-6x12.fnt.uue:1.1	Wed Jul  8 11:24:49 2020
+++ src/share/wscons/fonts/spleen-6x12.fnt.uue	Mon Jul 20 13:58:52 2020
@@ -32,7 +32,7 @@ M\*BHJ(B(\(B(B(B(```
 MB(CP@("`>(B(B(AX"`@(>(B`@("`>(!P"`CP`$!`
 MX$!`0$`PB(B(B(AXB(B(B%`@B(BH^-B(
 MB(AP<(B(B(B(B(AX"`CP^`@0($#X`!@@(&!@("`8
-M`"`@("`@("`@`&`0$!@8$!!@`$BP
+M`"`@("`@("`@`&`0$!@8$!!@``!(L```
 M
 M
 M
Index: src/share/wscons/fonts/spleen-8x16.fnt.uue
diff -u 

CVS commit: src/share/mk

2020-07-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jul 20 13:55:08 UTC 2020

Modified Files:
src/share/mk: bsd.x11.mk

Log Message:
Fix typos in ${X11INCS.DIX} include paths. PR/55500


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/share/mk/bsd.x11.mk

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

Modified files:

Index: src/share/mk/bsd.x11.mk
diff -u src/share/mk/bsd.x11.mk:1.134 src/share/mk/bsd.x11.mk:1.135
--- src/share/mk/bsd.x11.mk:1.134	Sun Feb 23 10:28:16 2020
+++ src/share/mk/bsd.x11.mk	Mon Jul 20 13:55:08 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.x11.mk,v 1.134 2020/02/23 10:28:16 mrg Exp $
+#	$NetBSD: bsd.x11.mk,v 1.135 2020/07/20 13:55:08 tsutsui Exp $
 
 .include 
 
@@ -46,8 +46,8 @@ X11FLAGS.EXTENSION=	${X11FLAGS.BASE_EXTE
 X11FLAGS.DIX=		-DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \
 			-DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS=200112L \
 			-DHAVE_XORG_CONFIG_H
-X11INCS.DIX=		-I${X11INCSDIR}/freetype2  \
-			-I${X11INCSDIR}/pixman-1 \
+X11INCS.DIX=		-I${X11INCDIR}/freetype2  \
+			-I${X11INCDIR}/pixman-1 \
 			-I$(X11SRCDIR.xorg-server)/include \
 			-I$(X11SRCDIR.xorg-server)/Xext \
 			-I$(X11SRCDIR.xorg-server)/composite \



CVS commit: src/sys/dev/wsfont

2020-07-20 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Mon Jul 20 13:41:16 UTC 2020

Modified Files:
src/sys/dev/wsfont: spleen12x24.h spleen16x32.h spleen32x64.h
spleen5x8.h spleen6x12.h spleen8x16.h

Log Message:
Update Spleen kernel fonts to version 1.8.1, bringing the following
improvements:

- Center tilde vertically for all sizes, as modern fonts do


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wsfont/spleen12x24.h \
src/sys/dev/wsfont/spleen32x64.h src/sys/dev/wsfont/spleen5x8.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wsfont/spleen16x32.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wsfont/spleen6x12.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/wsfont/spleen8x16.h

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

Modified files:

Index: src/sys/dev/wsfont/spleen12x24.h
diff -u src/sys/dev/wsfont/spleen12x24.h:1.6 src/sys/dev/wsfont/spleen12x24.h:1.7
--- src/sys/dev/wsfont/spleen12x24.h:1.6	Mon Jul  6 20:19:14 2020
+++ src/sys/dev/wsfont/spleen12x24.h	Mon Jul 20 13:41:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spleen12x24.h,v 1.6 2020/07/06 20:19:14 fcambus Exp $ */
+/*	$NetBSD: spleen12x24.h,v 1.7 2020/07/20 13:41:16 fcambus Exp $ */
 /*	$OpenBSD: spleen12x24.h,v 1.2 2019/03/08 10:53:59 fcambus Exp $ */
 
 /*
@@ -2396,10 +2396,6 @@ static u_char spleen12x24_data[] = {
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
-	0x38, 0x60, 	/* ..*****. */
-	0x6c, 0x60, 	/* .**.**...**. */
-	0xc6, 0xc0, 	/* **...**.**.. */
-	0xc3, 0x80, 	/* *****... */
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
@@ -2407,6 +2403,10 @@ static u_char spleen12x24_data[] = {
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
+	0x38, 0x60, 	/* ..*****. */
+	0x6c, 0x60, 	/* .**.**...**. */
+	0xc6, 0xc0, 	/* **...**.**.. */
+	0xc3, 0x80, 	/* *****... */
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
 	0x00, 0x00, 	/*  */
Index: src/sys/dev/wsfont/spleen32x64.h
diff -u src/sys/dev/wsfont/spleen32x64.h:1.6 src/sys/dev/wsfont/spleen32x64.h:1.7
--- src/sys/dev/wsfont/spleen32x64.h:1.6	Mon Jul  6 20:19:14 2020
+++ src/sys/dev/wsfont/spleen32x64.h	Mon Jul 20 13:41:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spleen32x64.h,v 1.6 2020/07/06 20:19:14 fcambus Exp $ */
+/*	$NetBSD: spleen32x64.h,v 1.7 2020/07/20 13:41:16 fcambus Exp $ */
 /*	$OpenBSD: spleen32x64.h,v 1.2 2019/03/08 10:53:59 fcambus Exp $ */
 
 /*
@@ -6161,16 +6161,6 @@ static u_char spleen32x64_data[] = {
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
-	0x00, 0x78, 0x00, 0xf0, 	/* .... */
-	0x01, 0xfe, 0x00, 0xf0, 	/* .... */
-	0x03, 0xff, 0x00, 0xf0, 	/* ..** */
-	0x07, 0xff, 0x80, 0xf0, 	/* .... */
-	0x0f, 0xcf, 0xc1, 0xf0, 	/* **..**.* */
-	0x0f, 0x87, 0xe3, 0xf0, 	/* ***...** */
-	0x0f, 0x03, 0xff, 0xe0, 	/* ..*. */
-	0x0f, 0x01, 0xff, 0xc0, 	/* ...***.. */
-	0x0f, 0x00, 0xff, 0x80, 	/* *... */
-	0x0f, 0x00, 0x3e, 0x00, 	/* ..*. */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
@@ -6191,6 +6181,16 @@ static u_char spleen32x64_data[] = {
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
+	0x00, 0x78, 0x00, 0xf0, 	/* .... */
+	0x01, 0xfe, 0x00, 0xf0, 	/* .... */
+	0x03, 0xff, 0x00, 0xf0, 	/* ..** */
+	0x07, 0xff, 0x80, 0xf0, 	/* .... */
+	0x0f, 0xcf, 0xc1, 0xf0, 	/* **..**.* */
+	0x0f, 0x87, 0xe3, 0xf0, 	/* ***...** */
+	0x0f, 0x03, 0xff, 0xe0, 	/* ..*. */
+	0x0f, 0x01, 0xff, 0xc0, 	/* ...***.. */
+	0x0f, 0x00, 0xff, 0x80, 	/* *... */
+	0x0f, 0x00, 0x3e, 0x00, 	/* ..*. */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
 	0x00, 0x00, 0x00, 0x00, 	/*  */
Index: src/sys/dev/wsfont/spleen5x8.h
diff -u 

CVS commit: src/sys/arch/mips/cavium

2020-07-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul 20 13:30:41 UTC 2020

Modified Files:
src/sys/arch/mips/cavium: octeon_intr.c

Log Message:
Fix confusion between ipi bitmask and mbox register bit assignments.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/cavium/octeon_intr.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/mips/cavium/octeon_intr.c
diff -u src/sys/arch/mips/cavium/octeon_intr.c:1.18 src/sys/arch/mips/cavium/octeon_intr.c:1.19
--- src/sys/arch/mips/cavium/octeon_intr.c:1.18	Fri Jul 17 21:59:30 2020
+++ src/sys/arch/mips/cavium/octeon_intr.c	Mon Jul 20 13:30:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_intr.c,v 1.18 2020/07/17 21:59:30 jmcneill Exp $	*/
+/*	$NetBSD: octeon_intr.c,v 1.19 2020/07/20 13:30:41 jmcneill Exp $	*/
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
  * All rights reserved.
@@ -44,7 +44,7 @@
 #define __INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_intr.c,v 1.18 2020/07/17 21:59:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_intr.c,v 1.19 2020/07/20 13:30:41 jmcneill Exp $");
 
 #include 
 #include 
@@ -176,7 +176,7 @@ struct octeon_intrhand ipi_intrhands[2] 
 #define	OCTEON_IPI_SCHED(n)	__BIT((n) + 0)
 #define	OCTEON_IPI_HIGH(n)	__BIT((n) + 16)
 
-static uint64_t octeon_ipi_mask[NIPIS] = {
+static uint32_t octeon_ipi_mbox_mask[NIPIS] = {
 	[IPI_NOP]		= OCTEON_IPI_SCHED(IPI_NOP),
 	[IPI_AST]		= OCTEON_IPI_SCHED(IPI_AST),
 	[IPI_SHOOTDOWN]		= OCTEON_IPI_SCHED(IPI_SHOOTDOWN),
@@ -516,16 +516,21 @@ octeon_ipi_intr(void *arg)
 {
 	struct cpu_info * const ci = curcpu();
 	struct cpu_softc * const cpu = ci->ci_softc;
-	uint32_t ipi_mask = (uintptr_t) arg;
+	uint32_t mbox_mask = (uintptr_t) arg;
+	uint32_t ipi_mask;
 
-	KASSERTMSG((ipi_mask & __BITS(31,16)) == 0 || ci->ci_cpl >= IPL_SCHED,
-	"ipi_mask %#"PRIx32" cpl %d", ipi_mask, ci->ci_cpl);
+	KASSERTMSG((mbox_mask & __BITS(31,16)) == 0 || ci->ci_cpl >= IPL_SCHED,
+	"mbox_mask %#"PRIx32" cpl %d", mbox_mask, ci->ci_cpl);
 
-	ipi_mask &= mips3_ld(cpu->cpu_mbox_set);
-	if (ipi_mask == 0)
+	mbox_mask &= mips3_ld(cpu->cpu_mbox_set);
+	if (mbox_mask == 0)
 		return 0;
 
-	mips3_sd(cpu->cpu_mbox_clr, ipi_mask);
+	mips3_sd(cpu->cpu_mbox_clr, mbox_mask);
+
+	ipi_mask = mbox_mask;
+	if (ci->ci_cpl >= IPL_SCHED)
+		ipi_mask >>= 16;
 
 	KASSERT(ipi_mask < __BIT(NIPIS));
 
@@ -573,11 +578,12 @@ octeon_send_ipi(struct cpu_info *ci, int
 		return -1;
 
 	struct cpu_softc * const cpu = ci->ci_softc;
-	const uint64_t ipi_mask = octeon_ipi_mask[req];
+	const uint32_t mbox_mask = octeon_ipi_mbox_mask[req];
+	const uint32_t ipi_mask = __BIT(req);
 
 	atomic_or_64(>ci_request_ipis, ipi_mask);
 
-	mips3_sd(cpu->cpu_mbox_set, ipi_mask);
+	mips3_sd(cpu->cpu_mbox_set, mbox_mask);
 
 	return 0;
 }



CVS commit: src/sys/arch/mips/mips

2020-07-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 20 10:53:48 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
Move exc_step definition under MIPS64_OCTEON and use it in the zeroising
memset as length for correctness.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.51 src/sys/arch/mips/mips/cpu_subr.c:1.52
--- src/sys/arch/mips/mips/cpu_subr.c:1.51	Mon Jul 20 03:26:07 2020
+++ src/sys/arch/mips/mips/cpu_subr.c	Mon Jul 20 10:53:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.51 2020/07/20 03:26:07 simonb Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.52 2020/07/20 10:53:47 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.51 2020/07/20 03:26:07 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.52 2020/07/20 10:53:47 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -122,17 +122,17 @@ struct cpu_info *
 cpu_info_alloc(struct pmap_tlb_info *ti, cpuid_t cpu_id, cpuid_t cpu_package_id,
 	cpuid_t cpu_core_id, cpuid_t cpu_smt_id)
 {
-	const int exc_step = 1 << MIPS_EBASE_EXC_BASE_SHIFT;
 
 	KASSERT(cpu_id < MAXCPUS);
 
 #ifdef MIPS64_OCTEON
+	const int exc_step = 1 << MIPS_EBASE_EXC_BASE_SHIFT;
 	vaddr_t exc_page = MIPS_UTLB_MISS_EXC_VEC + exc_step * cpu_id;
 	__CTASSERT(sizeof(struct cpu_info) + sizeof(struct pmap_tlb_info)
 	<= exc_step - 0x280);
 
 	struct cpu_info * const ci = ((struct cpu_info *)(exc_page + exc_step)) - 1;
-	memset((void *)exc_page, 0, PAGE_SIZE);
+	memset((void *)exc_page, 0, exc_step);
 
 	if (ti == NULL) {
 		ti = ((struct pmap_tlb_info *)ci) - 1;



CVS commit: src/sys/dev/sdmmc

2020-07-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jul 20 06:47:03 UTC 2020

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

Log Message:
clear all interrupts, not just those we expect from the hostintmask.

this removes the final hard hang i have seen in pinebookpro wifi,
though one may still need to 'ifconfig bwfm0 down up' occasionally,
so we still have bugs to fix here (the hang is usually associated
with 'checksum error' from bwfm/sdio.)


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.21
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.20	Mon Jul 20 06:44:55 2020
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Mon Jul 20 06:47:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.20 2020/07/20 06:44:55 mrg Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.21 2020/07/20 06:47:02 mrg Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -1466,7 +1466,6 @@ 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));
-	intstat &= (SDPCMD_INTSTATUS_HMB_SW_MASK|SDPCMD_INTSTATUS_CHIPACTIVE);
 	if (intstat)
 		bwfm_sdio_dev_write(sc, BWFM_SDPCMD_INTSTATUS, intstat);
 



CVS commit: src/sys/dev/sdmmc

2020-07-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jul 20 06:44:55 UTC 2020

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

Log Message:
only ask for SDPCMD_INTSTATUS_HMB_SW_MASK and SDPCMD_INTSTATUS_CHIPACTIVE
interrupts, not all of them.  we only ack these ones.

mostly fixes pinebookpro wifi hard hangs.  still is problematic and can
trigger interrupt storm that appears as a hard hang without NET_MPSAFE,
and a follow up, less clearly right, change will reduce that to a soft
hang of the interface that can be cleared with 'ifconfig bwfm0 down up',
and even often recovers itself now.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.20
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.19	Tue Jun 23 10:09:33 2020
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Mon Jul 20 06:44:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.19 2020/06/23 10:09:33 martin Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.20 2020/07/20 06:44:55 mrg Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -505,9 +505,8 @@ bwfm_sdio_attachhook(device_t self)
 		goto err;
 	}
 
-//	bwfm_sdio_dev_write(sc, SDPCMD_HOSTINTMASK,
-//	SDPCMD_INTSTATUS_HMB_SW_MASK | SDPCMD_INTSTATUS_CHIPACTIVE);
-	bwfm_sdio_dev_write(sc, SDPCMD_HOSTINTMASK, 0x);
+	bwfm_sdio_dev_write(sc, SDPCMD_HOSTINTMASK,
+	SDPCMD_INTSTATUS_HMB_SW_MASK | SDPCMD_INTSTATUS_CHIPACTIVE);
 	bwfm_sdio_write_1(sc, BWFM_SDIO_WATERMARK, 8);
 
 	if (bwfm_chip_sr_capable(bwfm)) {