CVS commit: src/lib/libc/gen

2021-06-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 18 10:57:14 UTC 2021

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
PR/56260: Alex Richardson: Out-of-bounds stack read in lib/libc/gen/vis.c
Also sync with other FreeBSD changes.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/lib/libc/gen/vis.c

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

Modified files:

Index: src/lib/libc/gen/vis.c
diff -u src/lib/libc/gen/vis.c:1.74 src/lib/libc/gen/vis.c:1.75
--- src/lib/libc/gen/vis.c:1.74	Mon Nov 27 11:37:21 2017
+++ src/lib/libc/gen/vis.c	Fri Jun 18 06:57:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $	*/
+/*	$NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID("$FreeBSD$");
@@ -353,12 +353,15 @@ makeextralist(int flags, const char *src
 	wchar_t *dst, *d;
 	size_t len;
 	const wchar_t *s;
+	mbstate_t mbstate;
 
 	len = strlen(src);
 	if ((dst = calloc(len + MAXEXTRAS, sizeof(*dst))) == NULL)
 		return NULL;
 
-	if ((flags & VIS_NOLOCALE) || mbstowcs(dst, src, len) == (size_t)-1) {
+	memset(&mbstate, 0, sizeof(mbstate));
+	if ((flags & VIS_NOLOCALE)
+	|| mbsrtowcs(dst, &src, len, &mbstate) == (size_t)-1) {
 		size_t i;
 		for (i = 0; i < len; i++)
 			dst[i] = (wchar_t)(u_char)src[i];
@@ -401,6 +404,7 @@ istrsenvisx(char **mbdstp, size_t *dlen,
 	int clen = 0, cerr, error = -1, i, shft;
 	char *mbdst, *mdst;
 	ssize_t mbslength, maxolen;
+	mbstate_t mbstate;
 
 	_DIAGASSERT(mbdstp != NULL);
 	_DIAGASSERT(mbsrc != NULL || mblength == 0);
@@ -458,10 +462,12 @@ istrsenvisx(char **mbdstp, size_t *dlen,
 	 * stop at NULs because we may be processing a block of data
 	 * that includes NULs.
 	 */
+	memset(&mbstate, 0, sizeof(mbstate));
 	while (mbslength > 0) {
 		/* Convert one multibyte character to wchar_t. */
 		if (!cerr)
-			clen = mbtowc(src, mbsrc, MB_LEN_MAX);
+			clen = mbrtowc(src, mbsrc, MIN(mbslength, MB_LEN_MAX),
+			&mbstate);
 		if (cerr || clen < 0) {
 			/* Conversion error, process as a byte instead. */
 			*src = (wint_t)(u_char)*mbsrc;
@@ -534,9 +540,10 @@ istrsenvisx(char **mbdstp, size_t *dlen,
 	len = wcslen(start);
 	maxolen = dlen ? *dlen : (wcslen(start) * MB_LEN_MAX + 1);
 	olen = 0;
+	memset(&mbstate, 0, sizeof(mbstate));
 	for (dst = start; len > 0; len--) {
 		if (!cerr)
-			clen = wctomb(mbdst, *dst);
+			clen = wcrtomb(mbdst, *dst, &mbstate);
 		if (cerr || clen < 0) {
 			/*
 			 * Conversion error, process as a byte(s) instead.



CVS commit: src/usr.bin/make

2021-06-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 18 12:54:17 UTC 2021

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

Log Message:
make: clean up access to character iterator

Having both p[0] and *p intermixed was inconsistent.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.539 -r1.540 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.539 src/usr.bin/make/main.c:1.540
--- src/usr.bin/make/main.c:1.539	Mon Apr 19 16:35:11 2021
+++ src/usr.bin/make/main.c	Fri Jun 18 12:54:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.539 2021/04/19 16:35:11 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.540 2021/06/18 12:54:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.539 2021/04/19 16:35:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.540 2021/06/18 12:54:17 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -349,16 +349,16 @@ debug_setbuf:
 static bool
 IsRelativePath(const char *path)
 {
-	const char *cp;
+	const char *p;
 
 	if (path[0] != '/')
 		return true;
-	cp = path;
-	while ((cp = strstr(cp, "/.")) != NULL) {
-		cp += 2;
-		if (*cp == '.')
-			cp++;
-		if (cp[0] == '/' || cp[0] == '\0')
+	p = path;
+	while ((p = strstr(p, "/.")) != NULL) {
+		p += 2;
+		if (*p == '.')
+			p++;
+		if (*p == '/' || *p == '\0')
 			return true;
 	}
 	return false;



CVS commit: src/usr.bin/calendar/calendars

2021-06-18 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri Jun 18 13:13:45 UTC 2021

Modified Files:
src/usr.bin/calendar/calendars: calendar.holiday

Log Message:
June 19 is Juneteenth in USA


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/calendar/calendars/calendar.holiday

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/calendar/calendars/calendar.holiday
diff -u src/usr.bin/calendar/calendars/calendar.holiday:1.32 src/usr.bin/calendar/calendars/calendar.holiday:1.33
--- src/usr.bin/calendar/calendars/calendar.holiday:1.32	Thu Jun 17 11:48:19 2021
+++ src/usr.bin/calendar/calendars/calendar.holiday	Fri Jun 18 13:13:44 2021
@@ -205,6 +205,7 @@
 06/19	Emancipation Day in Texas
 06/19	Labor Day in Trinidad, Tobago
 06/19	Revolution Day in Algeria
+06/19	Juneteenth National Independence Day in United States
 06/20	Flag Day in Argentina
 06/20	West Virginia Day in West Virginia
 06/22	National Sovereignty Day in Haiti



CVS commit: src/external/bsd/libfido2

2021-06-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 18 13:57:52 UTC 2021

Modified Files:
src/external/bsd/libfido2: Makefile.inc
src/external/bsd/libfido2/bin: Makefile.inc
src/external/bsd/libfido2/lib: Makefile

Log Message:
fix sun2 build


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libfido2/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libfido2/bin/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/libfido2/lib/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/bsd/libfido2/Makefile.inc
diff -u src/external/bsd/libfido2/Makefile.inc:1.3 src/external/bsd/libfido2/Makefile.inc:1.4
--- src/external/bsd/libfido2/Makefile.inc:1.3	Wed Jun 16 21:15:44 2021
+++ src/external/bsd/libfido2/Makefile.inc	Fri Jun 18 09:57:52 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.3 2021/06/17 01:15:44 christos Exp $
+# $NetBSD: Makefile.inc,v 1.4 2021/06/18 13:57:52 christos Exp $
 
 DIST:=${.PARSEDIR}/dist
 
@@ -13,6 +13,3 @@ FIDO_VERSION=${FIDO_MAJOR}.${FIDO_MINOR}
 CPPFLAGS+=-D_FIDO_MAJOR=${FIDO_MAJOR} -D_FIDO_MINOR=${FIDO_MINOR}
 CPPFLAGS+=-D_FIDO_PATCH=${FIDO_PATCH}
 CPPFLAGS+=-DHAVE_UNISTD_H -DHAVE_ARC4RANDOM_BUF -DHAVE_TIMESPECSUB
-
-LDFLAGS+=-lz
-DPFLAGS+=${LIBZ}

Index: src/external/bsd/libfido2/bin/Makefile.inc
diff -u src/external/bsd/libfido2/bin/Makefile.inc:1.2 src/external/bsd/libfido2/bin/Makefile.inc:1.3
--- src/external/bsd/libfido2/bin/Makefile.inc:1.2	Wed Mar  4 12:31:08 2020
+++ src/external/bsd/libfido2/bin/Makefile.inc	Fri Jun 18 09:57:52 2021
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.2 2020/03/04 17:31:08 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2021/06/18 13:57:52 christos Exp $
 
 .include "${.PARSEDIR}/../Makefile.inc"
 
 .PATH: ${DIST}/tools ${DIST}/man ${DIST}/openbsd-compat
 
-LDADD+=-lfido2 -lcbor -lusbhid -lcrypto  -lm
-DPADD+=${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM}
+LDADD+=-lfido2 -lcbor -lusbhid -lcrypto -lz -lm 
+DPADD+=${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBZ} ${LIBM}

Index: src/external/bsd/libfido2/lib/Makefile
diff -u src/external/bsd/libfido2/lib/Makefile:1.6 src/external/bsd/libfido2/lib/Makefile:1.7
--- src/external/bsd/libfido2/lib/Makefile:1.6	Thu Jun 17 08:38:53 2021
+++ src/external/bsd/libfido2/lib/Makefile	Fri Jun 18 09:57:52 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2021/06/17 12:38:53 christos Exp $
+# $NetBSD: Makefile,v 1.7 2021/06/18 13:57:52 christos Exp $
 
 NOLINT=
 .include 
@@ -8,8 +8,8 @@ NOLINT=
 
 CPPFLAGS+= -D_FIDO_INTERNAL -I${DIST}/src
 
-LDADD+=-lusbhid -lcbor
-DPADD+=${LIBUSBHID} ${LIBCBOR}
+LDADD+=-lusbhid -lcbor -lz
+DPADD+=${LIBUSBHID} ${LIBCBOR} ${LIBZ}
 
 LDFLAGS+=-Wl,--version-script=${DIST}/src/export.gnu
 



CVS commit: src/usr.bin/xlint/lint1

2021-06-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 18 20:29:00 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: fix hang on unfinished string literal at end-of-file

The input file that triggered this bug was:

a"b"c"d

Found using afl.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/xlint/lint1/lex.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/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.37 src/usr.bin/xlint/lint1/lex.c:1.38
--- src/usr.bin/xlint/lint1/lex.c:1.37	Tue Jun 15 20:46:45 2021
+++ src/usr.bin/xlint/lint1/lex.c	Fri Jun 18 20:29:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.37 2021/06/15 20:46:45 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.38 2021/06/18 20:29:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.37 2021/06/15 20:46:45 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.38 2021/06/18 20:29:00 rillig Exp $");
 #endif
 
 #include 
@@ -1304,7 +1304,7 @@ lex_string(void)
 	s = xmalloc(max = 64);
 
 	len = 0;
-	while ((c = get_escaped_char('"')) >= 0) {
+	while ((c = get_escaped_char('"')) > 0) {
 		/* +1 to reserve space for a trailing NUL character */
 		if (len + 1 == max)
 			s = xrealloc(s, max *= 2);



CVS commit: src/distrib/sun2/ramdisk

2021-06-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jun 18 20:30:58 UTC 2021

Modified Files:
src/distrib/sun2/ramdisk: Makefile

Log Message:
make this build with GCC 10.

change makefs flags from:
   density=2048
to:
   density=3072,bsize=4096,fsize=512,optimization=space

so that everything fits again.  add some comment GCC flags
that may help reduce size a little more.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/distrib/sun2/ramdisk/Makefile

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

Modified files:

Index: src/distrib/sun2/ramdisk/Makefile
diff -u src/distrib/sun2/ramdisk/Makefile:1.26 src/distrib/sun2/ramdisk/Makefile:1.27
--- src/distrib/sun2/ramdisk/Makefile:1.26	Mon Mar  1 16:50:01 2021
+++ src/distrib/sun2/ramdisk/Makefile	Fri Jun 18 20:30:58 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2021/03/01 16:50:01 martin Exp $
+#	$NetBSD: Makefile,v 1.27 2021/06/18 20:30:58 mrg Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -6,10 +6,28 @@
 
 IMAGE=		ramdisk.fs
 IMAGESIZE=	600k
-MAKEFS_FLAGS+=	-f 15 -o density=2048
+MAKEFS_FLAGS+=	-f 15 -o density=3072,bsize=4096,fsize=512,optimization=space
 
 WARNS=		1
-DBG=		-Os -fno-unwind-tables
+DBG=		-Os -fno-unwind-tables -fno-ident
+
+# XXXMRG - see if these help/hinder reduced size?
+#-fno-jump-tables 
+#-fzero-initialized-in-bss
+#-fgcse-after-reload
+#-fdelete-null-pointer-checks
+#-fno-sched-interblock
+#-fno-sched-spec
+#-fsched-pressure
+#-fcode-hoisting
+#-ftree-partial-pre
+#-fno-ipa-cp
+#-ftree-builtin-call-dce
+#-fno-align-functions
+#-fno-align-loops
+#-fno-align-jumps
+#-fno-align-labels
+#-fallow-store-data-races
 
 CRUNCHBIN=	rd_bin
 LISTS=		${.CURDIR}/list



CVS commit: src/share/misc

2021-06-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun 18 21:58:20 UTC 2021

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

Log Message:
EEE: embrace, extend, extinguish; or eastern equine encephalitis


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/share/misc/acronyms
cvs rdiff -u -r1.323 -r1.324 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.309 src/share/misc/acronyms:1.310
--- src/share/misc/acronyms:1.309	Fri Apr 16 15:53:55 2021
+++ src/share/misc/acronyms	Fri Jun 18 21:58:20 2021
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.309 2021/04/16 15:53:55 pgoyette Exp $
+$NetBSD: acronyms,v 1.310 2021/06/18 21:58:20 riastradh Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -143,6 +143,7 @@ DYK	do you know?
 EA	early adopter
 ECR	electronic cash register
 EDS	eternal downward spiral
+EEE	eastern equine encephalitis
 EFT	electronic funds transfer
 EG	evil grin
 EIE	enough is enough

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.323 src/share/misc/acronyms.comp:1.324
--- src/share/misc/acronyms.comp:1.323	Fri Apr 16 15:53:55 2021
+++ src/share/misc/acronyms.comp	Fri Jun 18 21:58:20 2021
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.323 2021/04/16 15:53:55 pgoyette Exp $
+$NetBSD: acronyms.comp,v 1.324 2021/06/18 21:58:20 riastradh Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -517,6 +517,7 @@ EDS	electronical data sheet
 EDSAC	electronic delay storage automatic calculator
 EDVAC	electronic discrete variable automatic computer
 EEE	energy efficient ethernet
+EEE	embrace, extend, extinguish
 EEPROM	electrically erasable programmable read only memory
 EFI	extensible firmware interface
 EFL	emitter follower logic



CVS commit: src/external/mit/libuv/lib

2021-06-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jun 18 22:12:02 UTC 2021

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
don't install the libuv.pc file for pic (but private) libs as well.

avoids triggering a makefs warning when building a file system out
of the DESTDIR directly, using the METALOG files etc:

makefs: Can't open `././libuv.pc' for reading: No such file or directory

(the file was installed, and the obsoleted.)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mit/libuv/lib/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/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.4 src/external/mit/libuv/lib/Makefile:1.5
--- src/external/mit/libuv/lib/Makefile:1.4	Mon Jun  1 14:39:42 2020
+++ src/external/mit/libuv/lib/Makefile	Fri Jun 18 22:12:02 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/06/01 14:39:42 christos Exp $
+# $NetBSD: Makefile,v 1.5 2021/06/18 22:12:02 mrg Exp $
 
 LIBISPRIVATE=pic
 
@@ -61,7 +61,7 @@ CPPFLAGS+=	-I${LIBUVDIR}/include -I${LIB
 
 LIBDPLIBS+=	kvm ${NETBSDSRCDIR}/lib/libkvm
 
-.if ${LIBISPRIVATE} != "yes"
+.if ${LIBISPRIVATE} != "yes" && ${LIBISPRIVATE} != "pic"
 SHLIB_MAJOR=	1
 SHLIB_MINOR=	0
 



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

2021-06-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jun 18 22:17:53 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: apecs.c cia.c irongate.c lca.c mcpcia.c

Log Message:
Sprinkle some static.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/pci/mcpcia.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/alpha/pci/apecs.c
diff -u src/sys/arch/alpha/pci/apecs.c:1.55 src/sys/arch/alpha/pci/apecs.c:1.56
--- src/sys/arch/alpha/pci/apecs.c:1.55	Sat Apr 24 23:36:23 2021
+++ src/sys/arch/alpha/pci/apecs.c	Fri Jun 18 22:17:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: apecs.c,v 1.55 2021/04/24 23:36:23 thorpej Exp $ */
+/* $NetBSD: apecs.c,v 1.56 2021/06/18 22:17:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.55 2021/04/24 23:36:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.56 2021/06/18 22:17:53 thorpej Exp $");
 
 #include 
 #include 
@@ -106,7 +106,7 @@ static int apecs_bus_get_window(int, int
 struct alpha_bus_space_translation *);
 
 /* There can be only one. */
-int apecsfound;
+static int apecsfound;
 struct apecs_config apecs_configuration;
 
 static int
@@ -234,7 +234,8 @@ apecsattach(device_t parent, device_t se
 }
 
 static int
-apecs_bus_get_window(int type, int window, struct alpha_bus_space_translation *abst)
+apecs_bus_get_window(int type, int window,
+struct alpha_bus_space_translation *abst)
 {
 	struct apecs_config *acp = &apecs_configuration;
 	bus_space_tag_t st;

Index: src/sys/arch/alpha/pci/cia.c
diff -u src/sys/arch/alpha/pci/cia.c:1.75 src/sys/arch/alpha/pci/cia.c:1.76
--- src/sys/arch/alpha/pci/cia.c:1.75	Sat Apr 24 23:36:23 2021
+++ src/sys/arch/alpha/pci/cia.c	Fri Jun 18 22:17:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cia.c,v 1.75 2021/04/24 23:36:23 thorpej Exp $ */
+/* $NetBSD: cia.c,v 1.76 2021/06/18 22:17:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.75 2021/04/24 23:36:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.76 2021/06/18 22:17:53 thorpej Exp $");
 
 #include 
 #include 
@@ -102,18 +102,19 @@ __KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.75
 #include 
 #endif
 
-int	ciamatch(device_t, cfdata_t, void *);
-void	ciaattach(device_t, device_t, void *);
+static int	ciamatch(device_t, cfdata_t, void *);
+static void	ciaattach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(cia, sizeof(struct cia_softc),
 ciamatch, ciaattach, NULL, NULL);
 
 extern struct cfdriver cia_cd;
 
-int	cia_bus_get_window(int, int, struct alpha_bus_space_translation *);
+static int	cia_bus_get_window(int, int,
+		struct alpha_bus_space_translation *);
 
 /* There can be only one. */
-int ciafound;
+static int ciafound;
 struct cia_config cia_configuration;
 
 /*
@@ -147,7 +148,7 @@ int	cia_pci_use_bwx = CIA_PCI_USE_BWX;
 int	cia_bus_use_bwx = CIA_BUS_USE_BWX;
 int	cia_pyxis_force_bwx = CIA_PYXIS_FORCE_BWX;
 
-int
+static int
 ciamatch(device_t parent, cfdata_t match, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
@@ -260,7 +261,7 @@ cia_init(struct cia_config *ccp, int mal
 	ccp->cc_initted = 1;
 }
 
-void
+static void
 ciaattach(device_t parent, device_t self, void *aux)
 {
 	struct cia_softc *sc = device_private(self);
@@ -404,8 +405,9 @@ ciaattach(device_t parent, device_t self
 	config_found(self, &pba, pcibusprint, CFARG_EOL);
 }
 
-int
-cia_bus_get_window(int type, int window, struct alpha_bus_space_translation *abst)
+static int
+cia_bus_get_window(int type, int window,
+struct alpha_bus_space_translation *abst)
 {
 	struct cia_config *ccp = &cia_configuration;
 	bus_space_tag_t st;

Index: src/sys/arch/alpha/pci/irongate.c
diff -u src/sys/arch/alpha/pci/irongate.c:1.17 src/sys/arch/alpha/pci/irongate.c:1.18
--- src/sys/arch/alpha/pci/irongate.c:1.17	Sat Apr 24 23:36:23 2021
+++ src/sys/arch/alpha/pci/irongate.c	Fri Jun 18 22:17:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: irongate.c,v 1.17 2021/04/24 23:36:23 thorpej Exp $ */
+/* $NetBSD: irongate.c,v 1.18 2021/06/18 22:17:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: irongate.c,v 1.17 2021/04/24 23:36:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irongate.c,v 1.18 2021/06/18 22:17:53 thorpej Exp $");
 
 #include 
 #include 
@@ -57,8 +57,8 @@ __KERNEL_RCSID(0, "$NetBSD: irongate.c,v
 #include 
 #endif
 
-int	irongate_match(device_t, cfdata_t, void *);
-void	

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

2021-06-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jun 18 22:18:10 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: cia_dma.c

Log Message:
Wrap a couple of long lines.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/pci/cia_dma.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/alpha/pci/cia_dma.c
diff -u src/sys/arch/alpha/pci/cia_dma.c:1.32 src/sys/arch/alpha/pci/cia_dma.c:1.33
--- src/sys/arch/alpha/pci/cia_dma.c:1.32	Wed May  5 02:15:18 2021
+++ src/sys/arch/alpha/pci/cia_dma.c	Fri Jun 18 22:18:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cia_dma.c,v 1.32 2021/05/05 02:15:18 thorpej Exp $ */
+/* $NetBSD: cia_dma.c,v 1.33 2021/06/18 22:18:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.32 2021/05/05 02:15:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.33 2021/06/18 22:18:10 thorpej Exp $");
 
 #include 
 #include 
@@ -321,7 +321,8 @@ cia_bus_dmamap_create_direct(
  * Load a CIA SGMAP-mapped DMA map with a linear buffer.
  */
 static int
-cia_bus_dmamap_load_sgmap(bus_dma_tag_t t, bus_dmamap_t map, void *buf, bus_size_t buflen, struct proc *p, int flags)
+cia_bus_dmamap_load_sgmap(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
+bus_size_t buflen, struct proc *p, int flags)
 {
 	int error;
 
@@ -337,7 +338,8 @@ cia_bus_dmamap_load_sgmap(bus_dma_tag_t 
  * Load a CIA SGMAP-mapped DMA map with an mbuf chain.
  */
 static int
-cia_bus_dmamap_load_mbuf_sgmap(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m, int flags)
+cia_bus_dmamap_load_mbuf_sgmap(bus_dma_tag_t t, bus_dmamap_t map,
+struct mbuf *m, int flags)
 {
 	int error;
 
@@ -352,7 +354,8 @@ cia_bus_dmamap_load_mbuf_sgmap(bus_dma_t
  * Load a CIA SGMAP-mapped DMA map with a uio.
  */
 static int
-cia_bus_dmamap_load_uio_sgmap(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio, int flags)
+cia_bus_dmamap_load_uio_sgmap(bus_dma_tag_t t, bus_dmamap_t map,
+struct uio *uio, int flags)
 {
 	int error;
 
@@ -367,7 +370,8 @@ cia_bus_dmamap_load_uio_sgmap(bus_dma_ta
  * Load a CIA SGMAP-mapped DMA map with raw memory.
  */
 static int
-cia_bus_dmamap_load_raw_sgmap(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
+cia_bus_dmamap_load_raw_sgmap(bus_dma_tag_t t, bus_dmamap_t map,
+bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
 {
 	int error;
 



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 22:24:51 UTC 2021

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

Log Message:
defflag LMU_DEBUG and PSOC_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/macppc/conf/files.macppc

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/macppc/conf/files.macppc
diff -u src/sys/arch/macppc/conf/files.macppc:1.118 src/sys/arch/macppc/conf/files.macppc:1.119
--- src/sys/arch/macppc/conf/files.macppc:1.118	Wed May 12 23:22:33 2021
+++ src/sys/arch/macppc/conf/files.macppc	Fri Jun 18 22:24:51 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.118 2021/05/12 23:22:33 thorpej Exp $
+#	$NetBSD: files.macppc,v 1.119 2021/06/18 22:24:51 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -319,8 +319,10 @@ file arch/macppc/dev/platinumfb.c			plat
 device	psoc: sysmon_envsys
 attach	psoc at iic
 file	arch/macppc/dev/psoc.cpsoc
+defflag opt_psoc.h PSOC_DEBUG
 
 # 'lmu-micro' found in late PowerBooks
 device	lmu: sysmon_envsys
 attach	lmu at iic
 file	arch/macppc/dev/lmu.clmu
+defflag opt_lmu.h LMU_DEBUG



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 22:52:04 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: lmu.c

Log Message:
use opt_lmu.h
while there, remove an obsolete comment


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/lmu.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/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.8 src/sys/arch/macppc/dev/lmu.c:1.9
--- src/sys/arch/macppc/dev/lmu.c:1.8	Wed Jan 27 02:17:28 2021
+++ src/sys/arch/macppc/dev/lmu.c	Fri Jun 18 22:52:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.8 2021/01/27 02:17:28 thorpej Exp $ */
+/* $NetBSD: lmu.c,v 1.9 2021/06/18 22:52:04 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.8 2021/01/27 02:17:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.9 2021/06/18 22:52:04 macallan Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.8 
 #include 
 
 #include 
+#include "opt_lmu.h"
 
 #ifdef LMU_DEBUG
 #define DPRINTF printf
@@ -208,7 +209,6 @@ lmu_attach(device_t parent, device_t sel
 
 	sysmon_envsys_register(sc->sc_sme);
 
-	/* TODO: make this adjustable via sysctl */
 	sc->sc_thresh = 300;
 	sc->sc_hyst = 30;
 	sc->sc_level = 16;



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 22:57:18 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
use opt_psoc.h, suppress some debug output in !PSOC_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/dev/psoc.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/macppc/dev/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.6 src/sys/arch/macppc/dev/psoc.c:1.7
--- src/sys/arch/macppc/dev/psoc.c:1.6	Wed Jan 27 02:17:28 2021
+++ src/sys/arch/macppc/dev/psoc.c	Fri Jun 18 22:57:18 2021
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.6 2021/01/27 02:17:28 thorpej Exp $ */
+ /* $NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $ */
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.6 2021/01/27 02:17:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $");
 
 #include 
 #include 
@@ -57,6 +57,13 @@ __KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.6
 
 #include 
 
+#include "opt_psoc.h"
+#ifdef PSOC_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
 struct psoc_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -117,10 +124,10 @@ psoc_attach(device_t parent, device_t se
 
 	error = OF_package_to_path(sc->sc_node, path, 256);
 	path[error] = 0;
-	printf("path [%s]\n", path);
+	DPRINTF("path [%s]\n", path);
 	ih = OF_open("fan");
 	OF_call_method_1("fan-init", ih, 0);
-	printf("ih %08x\n", ih);
+	DPRINTF("ih %08x\n", ih);
 
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);



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

2021-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 18 23:00:47 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
do ii2 locking dance in psoc_dump()


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/dev/psoc.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/macppc/dev/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.7 src/sys/arch/macppc/dev/psoc.c:1.8
--- src/sys/arch/macppc/dev/psoc.c:1.7	Fri Jun 18 22:57:18 2021
+++ src/sys/arch/macppc/dev/psoc.c	Fri Jun 18 23:00:47 2021
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.8 2021/06/18 23:00:47 macallan Exp $ */
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.7 2021/06/18 22:57:18 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.8 2021/06/18 23:00:47 macallan Exp $");
 
 #include 
 #include 
@@ -221,6 +221,8 @@ psoc_dump(struct psoc_softc *sc)
 {
 	int i, j;
 	uint8_t data, cmd;
+
+	iic_acquire_bus(sc->sc_i2c, 0);
 	for (i = 0x20; i < 0x5f; i+= 8) {
 		printf("%02x:", i);
 		for (j = 0; j < 8; j++) {
@@ -232,4 +234,5 @@ psoc_dump(struct psoc_softc *sc)
 		}
 		printf("\n");
 	}
+	iic_release_bus(sc->sc_i2c, 0);
 }



CVS commit: src/distrib

2021-06-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jun 18 23:55:20 UTC 2021

Modified Files:
src/distrib/sun2/miniroot: Makefile
src/distrib/sun3/miniroot: Makefile

Log Message:
Replace RELEASE and VERSION strings proplery.

sun2 and sun3 don't use MI src/distrib/miniroot/list so this should
have been sync'ed with it.
http://cvsweb.netbsd.org/bsdweb.cgi/src/distrib/miniroot/list#rev1.36
>> Use proper release version strings ("9.1" rather than "91") in banners.
>>
>> Also define and use "MACHINE" variable to describe port names
>> (no uname(1) or sysctl(8) in miniroot binary list by default).

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/distrib/sun2/miniroot/Makefile
cvs rdiff -u -r1.49 -r1.50 src/distrib/sun3/miniroot/Makefile

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

Modified files:

Index: src/distrib/sun2/miniroot/Makefile
diff -u src/distrib/sun2/miniroot/Makefile:1.39 src/distrib/sun2/miniroot/Makefile:1.40
--- src/distrib/sun2/miniroot/Makefile:1.39	Mon Mar  1 09:24:27 2021
+++ src/distrib/sun2/miniroot/Makefile	Fri Jun 18 23:55:20 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.39 2021/03/01 09:24:27 martin Exp $
+#	$NetBSD: Makefile,v 1.40 2021/06/18 23:55:20 tsutsui Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -57,7 +57,9 @@ HACKSRC=	${DISTRIBDIR}/utils/libhack
 ${CRUNCHBIN}:	libhack.o
 
 install.sub: ${DISTRIBDIR}/miniroot/install.sub
-	${TOOL_SED} -e "/^VERSION=/s/=.*/=${DISTRIBREV}/" < $? > $@
+	${TOOL_SED} -e "/^VERSION=/s/=.*/=${DISTRIBREV}/" \
+		-e "/^RELEASE=/s/=.*/=${DISTRIBVER}/" \
+		-e "/^MACHINE=/s/=.*/=${MACHINE}/" < $? > $@
 
 CLEANFILES+= install.sub
 

Index: src/distrib/sun3/miniroot/Makefile
diff -u src/distrib/sun3/miniroot/Makefile:1.49 src/distrib/sun3/miniroot/Makefile:1.50
--- src/distrib/sun3/miniroot/Makefile:1.49	Sun Dec 29 18:26:19 2019
+++ src/distrib/sun3/miniroot/Makefile	Fri Jun 18 23:55:20 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2019/12/29 18:26:19 christos Exp $
+#	$NetBSD: Makefile,v 1.50 2021/06/18 23:55:20 tsutsui Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -52,7 +52,9 @@ HACK_CURSES=yes
 ${CRUNCHBIN}:	libhack.o
 
 install.sub: ${DISTRIBDIR}/miniroot/install.sub
-	${TOOL_SED} -e "/^VERSION=/s/=.*/=${DISTRIBREV}/" < $? > $@
+	${TOOL_SED} -e "/^VERSION=/s/=.*/=${DISTRIBREV}/" \
+		-e "/^RELEASE=/s/=.*/=${DISTRIBVER}/" \
+		-e "/^MACHINE=/s/=.*/=${MACHINE}/" < $? > $@
 
 CLEANFILES+= install.sub
 



CVS commit: src/distrib/miniroot

2021-06-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 19 00:00:27 UTC 2021

Modified Files:
src/distrib/miniroot: install.sub

Log Message:
Remove netstat(1) calls to print resolver info on upgrade using miniroot.

netstat(1) was removed from miniroot 25 years ago.
 http://cvsweb.netbsd.org/bsdweb.cgi/src/distrib/miniroot/list#rev1.5


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/distrib/miniroot/install.sub

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

Modified files:

Index: src/distrib/miniroot/install.sub
diff -u src/distrib/miniroot/install.sub:1.60 src/distrib/miniroot/install.sub:1.61
--- src/distrib/miniroot/install.sub:1.60	Sat May 29 23:46:14 2021
+++ src/distrib/miniroot/install.sub	Sat Jun 19 00:00:26 2021
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: install.sub,v 1.60 2021/05/29 23:46:14 tsutsui Exp $
+#	$NetBSD: install.sub,v 1.61 2021/06/19 00:00:26 tsutsui Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -606,12 +606,8 @@ fi
 	echo	""
 
 	if [ "${_resolver_enabled:-FALSE}" = "TRUE" ]; then
-		netstat -r
-		echo	""
 		echo	"Resolver enabled."
 	else
-		netstat -rn
-		echo	""
 		echo	"Resolver not enabled."
 	fi
 



CVS commit: src/distrib/miniroot

2021-06-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 19 00:54:27 UTC 2021

Modified Files:
src/distrib/miniroot: install.sub

Log Message:
The modules and rescue sets are also required on upgrade.

Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/distrib/miniroot/install.sub

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

Modified files:

Index: src/distrib/miniroot/install.sub
diff -u src/distrib/miniroot/install.sub:1.61 src/distrib/miniroot/install.sub:1.62
--- src/distrib/miniroot/install.sub:1.61	Sat Jun 19 00:00:26 2021
+++ src/distrib/miniroot/install.sub	Sat Jun 19 00:54:27 2021
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: install.sub,v 1.61 2021/06/19 00:00:26 tsutsui Exp $
+#	$NetBSD: install.sub,v 1.62 2021/06/19 00:54:27 tsutsui Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -40,7 +40,7 @@ RELEASE=10.0# updated by distrib/min
 export RELEASE
 
 ALLSETS="base comp etc games man misc modules rescue text"	# default install sets
-UPGRSETS="base comp games man misc text"		# default upgrade sets
+UPGRSETS="base comp games man misc modules rescue text"		# default upgrade sets
 THESETS=		# one of the above
 
 local_sets_dir=""			# Path searched for sets by install_sets



CVS commit: src/sys/dev/usb

2021-06-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun 19 05:50:48 UTC 2021

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Relax identification of interfaces and endpoints. Now also attaches
headsets like Jabra Evolve 75.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/dev/usb/uaudio.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/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.171 src/sys/dev/usb/uaudio.c:1.172
--- src/sys/dev/usb/uaudio.c:1.171	Sun Jun 13 07:51:09 2021
+++ src/sys/dev/usb/uaudio.c	Sat Jun 19 05:50:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.172 2021/06/19 05:50:48 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.172 2021/06/19 05:50:48 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -561,8 +561,14 @@ uaudio_find_iface(const char *tbuf, int 
 {
 	const usb_interface_descriptor_t *d;
 
-	while (*offsp < size) {
+	while (*offsp + sizeof(*d) <= size) {
 		d = (const void *)(tbuf + *offsp);
+		DPRINTFN(3, "%d + %d <= %d type %d class %d/%d iface %d\n",
+		*offsp, d->bLength, size,
+		d->bDescriptorType,
+		d->bInterfaceClass,
+		d->bInterfaceSubClass,
+		d->bInterfaceNumber);
 		*offsp += d->bLength;
 		if (d->bDescriptorType == UDESC_INTERFACE &&
 		d->bInterfaceClass == UICLASS_AUDIO &&
@@ -1533,7 +1539,6 @@ uaudio_add_alt(struct uaudio_softc *sc, 
 Static usbd_status
 uaudio_process_as(struct uaudio_softc *sc, const char *tbuf, int *offsp,
 		  int size, const usb_interface_descriptor_t *id)
-#define offs (*offsp)
 {
 	const struct usb_audio_streaming_interface_descriptor *asid;
 	const struct usb_audio_streaming_type1_descriptor *asf1d;
@@ -1541,55 +1546,151 @@ uaudio_process_as(struct uaudio_softc *s
 	const usb_endpoint_descriptor_audio_t *epdesc1;
 	const struct usb_audio_streaming_endpoint_descriptor *sed;
 	int format, chan __unused, prec, enc;
-	int dir, type, sync;
+	int dir, type, sync, epcount;
 	struct as_info ai;
 	const char *format_str __unused;
+	const uaudio_cs_descriptor_t *desc;
 
-	asid = (const void *)(tbuf + offs);
-	if (asid->bDescriptorType != UDESC_CS_INTERFACE ||
-	asid->bDescriptorSubtype != AS_GENERAL)
-		return USBD_INVAL;
-	DPRINTF("asid: bTerminalLink=%d wFormatTag=%d\n",
-		 asid->bTerminalLink, UGETW(asid->wFormatTag));
-	offs += asid->bLength;
-	if (offs > size)
-		return USBD_INVAL;
+	DPRINTF("offset = %d < %d\n", *offsp, size);
 
-	asf1d = (const void *)(tbuf + offs);
-	if (asf1d->bDescriptorType != UDESC_CS_INTERFACE ||
-	asf1d->bDescriptorSubtype != FORMAT_TYPE)
-		return USBD_INVAL;
-	offs += asf1d->bLength;
-	if (offs > size)
-		return USBD_INVAL;
+	epcount = 0;
+	asid = NULL;
+	asf1d = NULL;
+	ed = NULL;
+	epdesc1 = NULL;
+	sed = NULL;
 
-	if (asf1d->bFormatType != FORMAT_TYPE_I) {
-		aprint_normal_dev(sc->sc_dev,
-		"ignored setting with type %d format\n", UGETW(asid->wFormatTag));
-		return USBD_NORMAL_COMPLETION;
+	while (*offsp < size) {
+		desc = (const uaudio_cs_descriptor_t *)(tbuf + *offsp);
+		if (*offsp + desc->bLength > size)
+			return USBD_INVAL;
+
+		switch (desc->bDescriptorType) {
+		case UDESC_CS_INTERFACE:
+			switch (desc->bDescriptorSubtype) {
+			case AS_GENERAL:
+if (asid != NULL)
+	goto ignore;
+asid = (const struct usb_audio_streaming_interface_descriptor *) desc;
+DPRINTF("asid: bTerminalLink=%d wFormatTag=%d bLength=%d\n",
+	 asid->bTerminalLink, UGETW(asid->wFormatTag), asid->bLength);
+break;
+			case FORMAT_TYPE:
+if (asf1d != NULL)
+	goto ignore;
+asf1d = (const struct usb_audio_streaming_type1_descriptor *) desc;
+DPRINTF("asf1d: bDescriptorType=%d bDescriptorSubtype=%d\n",
+ asf1d->bDescriptorType, asf1d->bDescriptorSubtype);
+if (asf1d->bFormatType != FORMAT_TYPE_I) {
+	aprint_normal_dev(sc->sc_dev,
+	"ignored setting with type %d format\n", UGETW(asid->wFormatTag));
+	return USBD_NORMAL_COMPLETION;
+}
+break;
+			default:
+goto ignore;
+			}
+			break;
+		case UDESC_ENDPOINT:
+			epcount++;
+			if (epcount > id->bNumEndpoints)
+goto ignore;
+			switch (epcount) {
+			case 1:
+ed = (const usb_endpoint_descriptor_audio_t *) desc;
+DPRINTF("endpoint[0] bLength=%d bDescriptorType=%d "
+	 "bEndpointAddress=%d bmAttributes=%#x wMaxPacketSize=%d "
+	 "bInterval=%d bRefresh=%d bSynchAddress=%d\n",
+	 ed->bLength, ed->bDescriptorType, ed->bEndpointAddress,
+	 ed->bmAttributes, UGETW(ed->wMaxPacketSize),
+	 ed->bInterval, ed->bRefresh, ed->bSynchAddress);
+if (UE_GET_XFERTYPE(ed->bmAttributes) != UE_ISOCHRONOUS)
+	return USBD_INVAL;
+			

CVS commit: src

2021-06-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jun 19 06:19:36 UTC 2021

Modified Files:
src/doc: CHANGES
src/external/gpl3/gcc: README.gcc10
src/share/mk: bsd.own.mk

Log Message:
switch m68000, m68k and 32 bit arm to GCC 10.  just sh3 left!

special thanks to rin for fixing arm32.


To generate a diff of this commit:
cvs rdiff -u -r1.2811 -r1.2812 src/doc/CHANGES
cvs rdiff -u -r1.22 -r1.23 src/external/gpl3/gcc/README.gcc10
cvs rdiff -u -r1.1256 -r1.1257 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/doc/CHANGES
diff -u src/doc/CHANGES:1.2811 src/doc/CHANGES:1.2812
--- src/doc/CHANGES:1.2811	Thu Jun 17 01:16:55 2021
+++ src/doc/CHANGES	Sat Jun 19 06:19:35 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2811 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2812 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -378,6 +378,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	raid(4): Add support for swapped-endian autoconfiguration.
 		[mrg 20210525]
 	dhcp: Import version 4.4.2-P1. [christos 20210526]
-	mips: Switch to GCC 10.  [mrg 20210426]
-	i386: Switch to GCC 10.  [mrg 20210426]
+	mips: Switch to GCC 10.  [mrg 20210526]
+	i386: Switch to GCC 10.  [mrg 20210526]
 	libfido2: Import 1.7.0 [christos 20210616]
+	m68k: Switch to GCC 10.  [mrg 20210619]
+	arm: Switch to GCC 10.  [mrg 20210619]

Index: src/external/gpl3/gcc/README.gcc10
diff -u src/external/gpl3/gcc/README.gcc10:1.22 src/external/gpl3/gcc/README.gcc10:1.23
--- src/external/gpl3/gcc/README.gcc10:1.22	Wed Jun 16 00:56:16 2021
+++ src/external/gpl3/gcc/README.gcc10	Sat Jun 19 06:19:35 2021
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc10,v 1.22 2021/06/16 00:56:16 rin Exp $
+$NetBSD: README.gcc10,v 1.23 2021/06/19 06:19:35 mrg Exp $
 
 
 new stuff:
@@ -33,25 +33,25 @@ architecture	tools	kernels	libgcc	native
 aarch64		y	y	y	y		y		y	y	y
 aarch64eb	y	y	y	y		y		y	y	y
 alpha		y	y	y	y		y		y	y	y
-earmv4		y	y	y	y		y		y	?	n
-earmv4eb	y	b	y	y		y		?	?	?
-earmv5		y	b	y	y		y		y	y	n
-earmv5eb	y	b	y	y		y		?	?	?
-earmv5hf	y	y	y	y		y		?	?	?
-earmv5hfeb	y	b	y	y		y		?	?	?
-earmv6		y	b	y	y		y		y	y	n
-earmv6eb	y	b	y	y		y		y	y	n
-earmv6hf	y	y	y	y		y		y	y	n
-earmv6hfeb	y	y	y	y		y		y	y	n
-earmv7		y	b	y	y		y		y	y	n
-earmv7eb	y	b	y	y		y		y	y	n
-earmv7hf	y	y	y	y		y		y	y	n
-earmv7hfeb	y	y	y	y		y		y	y	n
+earmv4		y	y	y	y		y		y	?	y
+earmv4eb	y	b	y	y		y		?	?	y
+earmv5		y	b	y	y		y		y	y	y
+earmv5eb	y	b	y	y		y		?	?	y
+earmv5hf	y	y	y	y		y		?	?	y
+earmv5hfeb	y	b	y	y		y		?	?	y
+earmv6		y	b	y	y		y		y	y	y
+earmv6eb	y	b	y	y		y		y	y	y
+earmv6hf	y	y	y	y		y		y	y	y
+earmv6hfeb	y	y	y	y		y		y	y	y
+earmv7		y	b	y	y		y		y	y	y
+earmv7eb	y	b	y	y		y		y	y	y
+earmv7hf	y	y	y	y		y		y	y	y
+earmv7hfeb	y	y	y	y		y		y	y	y
 hppa		y	y	y	y		y		y	y	y
 i386		y	y	y	y		y		y	n[8]	y
 ia64		y	y	y	y		y		?	N/A	y
-m68000		y	b	y	y		n[1]		?	?	?
-m68k		y	y	y	y		y[9]		y	?	n
+m68000		y	b	y	y		y		n[1]	?	y
+m68k		y	y	y	y		y		y	?	y
 mipseb		y	y	y	y		y		y	?	y
 mipsel		y	y	y	y		y		y	?	y
 mips64eb	y	y	y	y		y		y	y	y
@@ -71,23 +71,13 @@ coldfire	?	N/A	?	?		?		N/A	N/A
 	-	---	--	--			---
 architecture	tools	kernels	libgcc	native-gcc	make release	runs	atf
 
-[1] - ramdisk.fs is too large, needs fixing.
+[1] - kernel may be too large, does not boot.  GCC 9 is the same, though.
 [6] - vax vs c++ exceptions issue, same as it ever was
 [7] - fails just as poorly in gxemul/landisk as GCC 9
 [8] - i386 seems to have a signal delivery issue.  pthread tests hang and then
   complain with eg:
 	  threads_and_exec: q[ 627.6700846] sorry, pid 3154 was killed: orphaned traced process
   this problem occurs with GCC 9 as well.  works in qemu?
-[9] - x68k/stand fails with:
-  link  loadbsd/loadbsd.x
-  loadbsd1: program header #1 is not loadable
-  problem is understood (thanks tsutsui@): previously loadbsd was linked
-  against normal userland libc components for m68k, which allows it to
-  detect running on m68000 CPU and sanely fail, instead of an barf error.
-  new gcc built libc includes TLS support, that isn't compatible with this
-  and the conversion process fails.  can be fixed by using libkern instead,
-  and accepting the poor error on m68000.
-
 
 
 CPU vs platform test table (for CPUs with multiple ports).  this is "make release" or just kernels.
@@ -105,7 +95,7 @@ earmv7:		 		 	 	y		y
 earmv7hf:	 		 	 	y		y
 
 		amiga		atari	cesfic	hp300		luna68k		mac68k		mvme68k		news68k		next68k		sun3	x68k
-m68k:		y		y	y	y		y		y		y		y		y		y 	n[9]
+m68k:		y		y	y	y		y		y		y		y		y		y 	y
 
 		evbmips		emips		ews4800mips	mipsco		newsmips	sgimips
 mipseb:		y		y		y		y		y		y

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1256 src/share/mk/bsd.own.mk:1.1257
--- src/share/mk/bsd.own.mk:1.1256	Thu Jun  3 07:40:48 2021
+++ src/share/mk/bsd