CVS commit: src/sys/dev/pci

2022-10-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Oct  7 02:57:36 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1448 -r1.1449 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1447 -r1.1448 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.



CVS commit: src/sys/dev/pci

2022-10-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Oct  7 02:55:34 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add NVIDIA GeForce GTX 770


To generate a diff of this commit:
cvs rdiff -u -r1.1467 -r1.1468 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.1467 src/sys/dev/pci/pcidevs:1.1468
--- src/sys/dev/pci/pcidevs:1.1467	Sun Oct  2 10:33:00 2022
+++ src/sys/dev/pci/pcidevs	Fri Oct  7 02:55:33 2022
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1467 2022/10/02 10:33:00 martin Exp $
+$NetBSD: pcidevs,v 1.1468 2022/10/07 02:55:33 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -8078,6 +8078,7 @@ product NVIDIA	GEFORCE_610M	0x1058	GeFor
 product NVIDIA	GEFORCE_610M2	0x1059	GeForce 610M
 product NVIDIA	GT610M		0x105A	GeForce GT 610M
 product NVIDIA	GF_GTX680	0x1180 	GeForce GTX 680
+product NVIDIA	GF_GTX770	0x1184	GeForce GTX 770
 product NVIDIA	GF_GTX560_Ti	0x1200	GeForce GTX 560 Ti
 product NVIDIA	GF_GTX560	0x1201	GeForce GTX 560
 product NVIDIA	GF_GTX560_TiOEM	0x1202	GeForce GTX 560 Ti OEM



CVS commit: src/sys/dev/pci

2022-10-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Oct  7 02:55:34 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add NVIDIA GeForce GTX 770


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

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



CVS commit: src/distrib/notes/mvme68k

2022-10-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct  6 20:42:13 UTC 2022

Modified Files:
src/distrib/notes/mvme68k: install

Log Message:
s/immediatedly/immediately/


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/distrib/notes/mvme68k/install

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/mvme68k/install
diff -u src/distrib/notes/mvme68k/install:1.24 src/distrib/notes/mvme68k/install:1.25
--- src/distrib/notes/mvme68k/install:1.24	Fri Jun  3 13:50:32 2022
+++ src/distrib/notes/mvme68k/install	Thu Oct  6 20:42:13 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.24 2022/06/03 13:50:32 andvar Exp $
+.\"	$NetBSD: install,v 1.25 2022/10/06 20:42:13 andvar Exp $
 .\"
 .\" Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -89,7 +89,7 @@ Loading: Operating System
 Volume: NBSD
 
 IPL loaded at:  $003F
-\*[Gt]\*[Gt] BSD MVME147 tapeboot [$Revision: 1.24 $]
+\*[Gt]\*[Gt] BSD MVME147 tapeboot [$Revision: 1.25 $]
 578616+422344+55540+[46032+51284]=0x11a6e4
 Start @ 0x8000 ...
 Copyright (c) 1996, 1997, 1998, 1999, 2000
@@ -270,7 +270,7 @@ installation!
 .Dl Start offset ('x' to start after part 'x') [0c, 0s, 0M]: Ic a
 .Dl Partition size ('$' for all remaining) [0c, 0s, 0M]: Ic 16m
 .Pp
-Here, we specify that the swap partition starts immediatedly after the
+Here, we specify that the swap partition starts immediately after the
 .Sq Li a
 partition and is of size 16MB.
 The length of the swap partition should be at least as large as the
@@ -435,7 +435,7 @@ For all board types, the boot messages a
 .Pp
 .(disp
 Start @ 0x8000 ...
-\*[Gt]\*[Gt] BSD MVME147 netboot (via sboot) [$Revision: 1.24 $]
+\*[Gt]\*[Gt] BSD MVME147 netboot (via sboot) [$Revision: 1.25 $]
 device: le0 attached to 08:00:3e:20:cb:87
 boot: client IP address: 192.168.1.4
 boot: client name: soapy



CVS commit: src/distrib/notes/mvme68k

2022-10-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct  6 20:42:13 UTC 2022

Modified Files:
src/distrib/notes/mvme68k: install

Log Message:
s/immediatedly/immediately/


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/distrib/notes/mvme68k/install

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



CVS commit: src/sys/dev/ic

2022-10-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  6 19:59:55 UTC 2022

Modified Files:
src/sys/dev/ic: comreg.h comvar.h ns16550reg.h st16650reg.h

Log Message:
com(4): Add include guards.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/comreg.h
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/ic/comvar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ns16550reg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/st16650reg.h

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



CVS commit: src/sys/dev/ic

2022-10-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  6 19:59:55 UTC 2022

Modified Files:
src/sys/dev/ic: comreg.h comvar.h ns16550reg.h st16650reg.h

Log Message:
com(4): Add include guards.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/comreg.h
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/ic/comvar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ns16550reg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/st16650reg.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/ic/comreg.h
diff -u src/sys/dev/ic/comreg.h:1.27 src/sys/dev/ic/comreg.h:1.28
--- src/sys/dev/ic/comreg.h:1.27	Mon Sep 28 11:33:15 2020
+++ src/sys/dev/ic/comreg.h	Thu Oct  6 19:59:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: comreg.h,v 1.27 2020/09/28 11:33:15 jmcneill Exp $	*/
+/*	$NetBSD: comreg.h,v 1.28 2022/10/06 19:59:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -31,6 +31,9 @@
  *	@(#)comreg.h	7.2 (Berkeley) 5/9/91
  */
 
+#ifndef	_SYS_DEV_IC_COMREG_H_
+#define	_SYS_DEV_IC_COMREG_H_
+
 #include 
 
 #ifdef _KERNEL_OPT
@@ -168,3 +171,5 @@
 
 /* XXX ISA-specific. */
 #define	COM_NPORTS	8
+
+#endif	/* _SYS_DEV_IC_COMREG_H_ */

Index: src/sys/dev/ic/comvar.h
diff -u src/sys/dev/ic/comvar.h:1.96 src/sys/dev/ic/comvar.h:1.97
--- src/sys/dev/ic/comvar.h:1.96	Fri Nov 12 21:57:13 2021
+++ src/sys/dev/ic/comvar.h	Thu Oct  6 19:59:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: comvar.h,v 1.96 2021/11/12 21:57:13 jmcneill Exp $	*/
+/*	$NetBSD: comvar.h,v 1.97 2022/10/06 19:59:55 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -30,6 +30,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef	_SYS_DEV_IC_COMVAR_H_
+#define	_SYS_DEV_IC_COMVAR_H_
+
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
 #include "opt_com.h"
@@ -230,3 +233,5 @@ bool com_suspend(device_t, const pmf_qua
 #define	IPL_SERIAL	IPL_TTY
 #define	splserial()	spltty()
 #endif
+
+#endif	/* _SYS_DEV_IC_COMVAR_H_ */

Index: src/sys/dev/ic/ns16550reg.h
diff -u src/sys/dev/ic/ns16550reg.h:1.13 src/sys/dev/ic/ns16550reg.h:1.14
--- src/sys/dev/ic/ns16550reg.h:1.13	Fri Jan 11 23:10:41 2019
+++ src/sys/dev/ic/ns16550reg.h	Thu Oct  6 19:59:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ns16550reg.h,v 1.13 2019/01/11 23:10:41 thorpej Exp $	*/
+/*	$NetBSD: ns16550reg.h,v 1.14 2022/10/06 19:59:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -31,6 +31,9 @@
  *	@(#)ns16550.h	7.1 (Berkeley) 5/9/91
  */
 
+#ifndef	_SYS_DEV_IC_NS16550REG_H_
+#define	_SYS_DEV_IC_NS16550REG_H_
+
 /*
  * NS16550 UART registers
  */
@@ -65,3 +68,5 @@
 #define	com_tfl		32	/* transmit fifo level (R) (SUNXI) */
 #define	com_rfl		33	/* receive fifo level (R) (SUNXI) */
 #define	com_halt	41	/* halt tx (R/W) (SUNXI) */
+
+#endif	/* _SYS_DEV_IC_NS16550REG_H_ */

Index: src/sys/dev/ic/st16650reg.h
diff -u src/sys/dev/ic/st16650reg.h:1.3 src/sys/dev/ic/st16650reg.h:1.4
--- src/sys/dev/ic/st16650reg.h:1.3	Sun Dec 11 12:21:28 2005
+++ src/sys/dev/ic/st16650reg.h	Thu Oct  6 19:59:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: st16650reg.h,v 1.3 2005/12/11 12:21:28 christos Exp $	*/
+/*	$NetBSD: st16650reg.h,v 1.4 2022/10/06 19:59:55 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1991 The Regents of the University of California.
@@ -31,6 +31,9 @@
  *	@(#)ns16550.h	7.1 (Berkeley) 5/9/91
  */
 
+#ifndef	_SYS_DEV_IC_ST16650REG_H_
+#define	_SYS_DEV_IC_ST16650REG_H_
+
 /*
  * ST16650A UART registers
  */
@@ -52,3 +55,5 @@
 #define	com_xoff1	6	/* XOFF 1 character (R/W) */
 #define	com_scratch	7	/* scratch register (R/W) */
 #define	com_xoff2	7	/* XOFF 2 character (R/W) */
+
+#endif	/* _SYS_DEV_IC_ST16650REG_H_ */



CVS commit: src/sys/dev

2022-10-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  6 19:59:35 UTC 2022

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

Log Message:
console(4), constty(4): Rip off the kernel lock, take two.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/cons.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/cons.c
diff -u src/sys/dev/cons.c:1.87 src/sys/dev/cons.c:1.88
--- src/sys/dev/cons.c:1.87	Thu Oct  6 19:58:41 2022
+++ src/sys/dev/cons.c	Thu Oct  6 19:59:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.87 2022/10/06 19:58:41 riastradh Exp $	*/
+/*	$NetBSD: cons.c,v 1.88 2022/10/06 19:59:35 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.87 2022/10/06 19:58:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.88 2022/10/06 19:59:35 riastradh Exp $");
 
 #include 
 #include 
@@ -84,7 +84,7 @@ const struct cdevsw cons_cdevsw = {
 	.d_mmap = nommap,
 	.d_kqfilter = cnkqfilter,
 	.d_discard = nodiscard,
-	.d_flag = D_TTY
+	.d_flag = D_TTY|D_MPSAFE,
 };
 
 static struct kmutex cn_lock;



CVS commit: src/sys/dev

2022-10-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  6 19:59:35 UTC 2022

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

Log Message:
console(4), constty(4): Rip off the kernel lock, take two.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/cons.c

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



CVS commit: src/sys

2022-10-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  6 19:58:41 UTC 2022

Modified Files:
src/sys/dev: cons.c
src/sys/kern: subr_prf.c tty.c
src/sys/sys: tty.h

Log Message:
constty(4): Make MP-safe.

Access to the global constty variable is coordinated as follows:

1. Setting constty to nonnull, with atomic_store_release, is allowed
   only under the new adaptive constty_lock in thread context.  This
   serializes TIOCCONS operations and ensures unlocked readers can
   safely use a constty pointer read with atomic_load_consume.

2. Changing constty from nonnull to null, with atomic_cas_ptr, is
   allowed in any context -- printf(9) uses this to disable a broken
   constty.

3. Reading constty under constty_lock is allowed with
   atomic_load_relaxed, because while constty_lock is held, it can
   only be made null by some other thread/CPU, never made nonnull.

4. Reading constty outside constty_lock is allowed with
   atomic_load_consume in a pserialize read section -- constty is
   only ever made nonnull with atomic_store_release, in (1).
   ttyclose will wait for all these pserialize read sections to
   complete before flushing the tty.

5. To continue to use a struct tty pointer in (4) after the
   pserialize read section has completed, caller must use tty_acquire
   during the pserialize read section and then tty_release when done.
   ttyclose will wait for all these references to drain before
   returning.

These access rules allow us to serialize TIOCCONS, and safely destroy
ttys, without putting any locks on the access paths like printf(9)
that use constty.  Once we set D_MPSAFE, operations on /dev/console
will contend only with other users of the same tty as constty, which
will be an improvement over contending with all other kernel lock
users in the system.

Changes second time around:
- Fix initialization of ok in cons.c cn_redirect.
- Fix reversed sense of conditional in subr_prf.c putone.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/cons.c
cvs rdiff -u -r1.191 -r1.192 src/sys/kern/subr_prf.c
cvs rdiff -u -r1.303 -r1.304 src/sys/kern/tty.c
cvs rdiff -u -r1.99 -r1.100 src/sys/sys/tty.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/cons.c
diff -u src/sys/dev/cons.c:1.86 src/sys/dev/cons.c:1.87
--- src/sys/dev/cons.c:1.86	Tue Oct  4 05:20:01 2022
+++ src/sys/dev/cons.c	Thu Oct  6 19:58:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.86 2022/10/04 05:20:01 riastradh Exp $	*/
+/*	$NetBSD: cons.c,v 1.87 2022/10/06 19:58:41 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.86 2022/10/04 05:20:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.87 2022/10/06 19:58:41 riastradh Exp $");
 
 #include 
 #include 
@@ -54,6 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.8
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -67,7 +69,8 @@ dev_type_ioctl(cnioctl);
 dev_type_poll(cnpoll);
 dev_type_kqfilter(cnkqfilter);
 
-static bool cn_redirect(dev_t *, int, int *);
+static bool cn_redirect(dev_t *, int, int *, struct tty **);
+static void cn_release(struct tty *);
 
 const struct cdevsw cons_cdevsw = {
 	.d_open = cnopen,
@@ -86,7 +89,7 @@ const struct cdevsw cons_cdevsw = {
 
 static struct kmutex cn_lock;
 
-struct	tty *constty = NULL;	/* virtual console output device */
+struct	tty *volatile constty;	/* virtual console output device */
 struct	consdev *cn_tab;	/* physical console device info */
 struct	vnode *cn_devvp[2];	/* vnode for underlying device. */
 
@@ -199,6 +202,7 @@ out:	mutex_exit(_lock);
 int
 cnread(dev_t dev, struct uio *uio, int flag)
 {
+	struct tty *ctp = NULL;
 	int error;
 
 	/*
@@ -208,25 +212,31 @@ cnread(dev_t dev, struct uio *uio, int f
 	 * input (except a shell in single-user mode, but then,
 	 * one wouldn't TIOCCONS then).
 	 */
-	if (!cn_redirect(, 1, ))
+	if (!cn_redirect(, 1, , ))
 		return error;
-	return cdev_read(dev, uio, flag);
+	error = cdev_read(dev, uio, flag);
+	cn_release(ctp);
+	return error;
 }
 
 int
 cnwrite(dev_t dev, struct uio *uio, int flag)
 {
+	struct tty *ctp = NULL;
 	int error;
 
 	/* Redirect output, if that's appropriate. */
-	if (!cn_redirect(, 0, ))
+	if (!cn_redirect(, 0, , ))
 		return error;
-	return cdev_write(dev, uio, flag);
+	error = cdev_write(dev, uio, flag);
+	cn_release(ctp);
+	return error;
 }
 
 int
 cnioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
+	struct tty *ctp = NULL;
 	int error;
 
 	error = 0;
@@ -235,29 +245,41 @@ cnioctl(dev_t dev, u_long cmd, void *dat
 	 * Superuser can always use this to wrest control of console
 	 * output from the "virtual" console.
 	 */
-	if (cmd == TIOCCONS && constty != NULL) {
+	if (cmd == TIOCCONS) {
+		struct tty *tp;
+
+		mutex_enter(_lock);
+		tp = atomic_load_relaxed();
+		if 

CVS commit: src/sys

2022-10-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  6 19:58:41 UTC 2022

Modified Files:
src/sys/dev: cons.c
src/sys/kern: subr_prf.c tty.c
src/sys/sys: tty.h

Log Message:
constty(4): Make MP-safe.

Access to the global constty variable is coordinated as follows:

1. Setting constty to nonnull, with atomic_store_release, is allowed
   only under the new adaptive constty_lock in thread context.  This
   serializes TIOCCONS operations and ensures unlocked readers can
   safely use a constty pointer read with atomic_load_consume.

2. Changing constty from nonnull to null, with atomic_cas_ptr, is
   allowed in any context -- printf(9) uses this to disable a broken
   constty.

3. Reading constty under constty_lock is allowed with
   atomic_load_relaxed, because while constty_lock is held, it can
   only be made null by some other thread/CPU, never made nonnull.

4. Reading constty outside constty_lock is allowed with
   atomic_load_consume in a pserialize read section -- constty is
   only ever made nonnull with atomic_store_release, in (1).
   ttyclose will wait for all these pserialize read sections to
   complete before flushing the tty.

5. To continue to use a struct tty pointer in (4) after the
   pserialize read section has completed, caller must use tty_acquire
   during the pserialize read section and then tty_release when done.
   ttyclose will wait for all these references to drain before
   returning.

These access rules allow us to serialize TIOCCONS, and safely destroy
ttys, without putting any locks on the access paths like printf(9)
that use constty.  Once we set D_MPSAFE, operations on /dev/console
will contend only with other users of the same tty as constty, which
will be an improvement over contending with all other kernel lock
users in the system.

Changes second time around:
- Fix initialization of ok in cons.c cn_redirect.
- Fix reversed sense of conditional in subr_prf.c putone.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/cons.c
cvs rdiff -u -r1.191 -r1.192 src/sys/kern/subr_prf.c
cvs rdiff -u -r1.303 -r1.304 src/sys/kern/tty.c
cvs rdiff -u -r1.99 -r1.100 src/sys/sys/tty.h

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



CVS commit: src/sys/dev

2022-10-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct  6 19:38:54 UTC 2022

Modified Files:
src/sys/dev/adb: adb_ktm.c
src/sys/dev/ic: scmd.c

Log Message:
fix few typos in comments and node description.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/adb/adb_ktm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/scmd.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/adb/adb_ktm.c
diff -u src/sys/dev/adb/adb_ktm.c:1.5 src/sys/dev/adb/adb_ktm.c:1.6
--- src/sys/dev/adb/adb_ktm.c:1.5	Wed Apr  6 17:37:31 2022
+++ src/sys/dev/adb/adb_ktm.c	Thu Oct  6 19:38:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ktm.c,v 1.5 2022/04/06 17:37:31 macallan Exp $	*/
+/*	$NetBSD: adb_ktm.c,v 1.6 2022/10/06 19:38:54 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.5 2022/04/06 17:37:31 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.6 2022/10/06 19:38:54 andvar Exp $");
 
 #include 
 #include 
@@ -250,13 +250,13 @@ ktm_init(struct ktm_softc *sc)
 
 	ret = sysctl_createv(NULL, 0, NULL, ,
 	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
-	CTLTYPE_INT, "left", "left button assigmnent",
+	CTLTYPE_INT, "left", "left button assignment",
 	sysctl_ktm_left, 1, (void *)sc, 0,
 	CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	ret = sysctl_createv(NULL, 0, NULL, ,
 	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
-	CTLTYPE_INT, "right", "right button assigmnent",
+	CTLTYPE_INT, "right", "right button assignment",
 	sysctl_ktm_right, 1, (void *)sc, 0,
 	CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL);
 	__USE(ret);

Index: src/sys/dev/ic/scmd.c
diff -u src/sys/dev/ic/scmd.c:1.2 src/sys/dev/ic/scmd.c:1.3
--- src/sys/dev/ic/scmd.c:1.2	Thu Mar 31 19:30:16 2022
+++ src/sys/dev/ic/scmd.c	Thu Oct  6 19:38:54 2022
@@ -1,5 +1,5 @@
 
-/*	$NetBSD: scmd.c,v 1.2 2022/03/31 19:30:16 pgoyette Exp $	*/
+/*	$NetBSD: scmd.c,v 1.3 2022/10/06 19:38:54 andvar Exp $	*/
 
 /*
  * Copyright (c) 2021 Brad Spencer 
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scmd.c,v 1.2 2022/03/31 19:30:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scmd.c,v 1.3 2022/10/06 19:38:54 andvar Exp $");
 
 /*
  * Common driver for the Sparkfun Serial motor controller.
@@ -274,7 +274,7 @@ scmd_open(dev_t dev, int flags, int fmt,
 	if (sc->sc_opened)
 		return EBUSY;
 
-	/* This is a meaningless assigment to keep GCC from
+	/* This is a meaningless assignment to keep GCC from
 	 * complaining.
 	 */
 	sc->sc_func_attach = _attach;
@@ -521,7 +521,7 @@ scmd_write(dev_t dev, struct uio *uio, i
 			 * can perform re-enumeration, then do the wait thing.
 			 * It is not as important that this be done for remote module
 			 * access as the only thing that you could really do there is
-			 * a restart and not re-emumeration, which is really what the wait
+			 * a restart and not re-enumeration, which is really what the wait
 			 * is all about.
 			 */
 			if (reg_addr == SCMD_REG_CONTROL_1) {



CVS commit: src/sys/dev

2022-10-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct  6 19:38:54 UTC 2022

Modified Files:
src/sys/dev/adb: adb_ktm.c
src/sys/dev/ic: scmd.c

Log Message:
fix few typos in comments and node description.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/adb/adb_ktm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/scmd.c

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



CVS commit: src/sys/net

2022-10-06 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Oct  6 06:59:25 UTC 2022

Modified Files:
src/sys/net: if_ipsec.c

Log Message:
Fix overflow case detected by clang.  Pointed out by wsh@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_ipsec.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/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.32 src/sys/net/if_ipsec.c:1.33
--- src/sys/net/if_ipsec.c:1.32	Fri Sep 30 07:36:36 2022
+++ src/sys/net/if_ipsec.c	Thu Oct  6 06:59:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.32 2022/09/30 07:36:36 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.33 2022/10/06 06:59:24 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.32 2022/09/30 07:36:36 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.33 2022/10/06 06:59:24 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1798,12 +1798,12 @@ if_ipsec_get_reqids(struct ipsec_variant
 
 	mutex_enter(_softcs.lock);
 	if (ipsec_softcs.use_fixed_reqid) {
-		u_int16_t reqid_base;
+		uint32_t reqid_base;
 
 		reqid_base = ipsec_softcs.reqid_base + ifp->if_index * 2;
 		if (reqid_base + 1 > ipsec_softcs.reqid_last) {
 			log(LOG_ERR,
-			"%s: invalid fixed reqid(%"PRIu16"), "
+			"%s: invalid fixed reqid(%"PRIu32"), "
 			"current range %"PRIu16" <= reqid <= %"PRIu16"\n",
 			ifp->if_xname, reqid_base + 1,
 			ipsec_softcs.reqid_base, ipsec_softcs.reqid_last);



CVS commit: src/sys/net

2022-10-06 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Oct  6 06:59:25 UTC 2022

Modified Files:
src/sys/net: if_ipsec.c

Log Message:
Fix overflow case detected by clang.  Pointed out by wsh@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_ipsec.c

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



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

2022-10-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  6 06:51:37 UTC 2022

Modified Files:
src/sys/arch/x86/include: i82093reg.h

Log Message:
IOAPIC_ID_MASK is 8 bits these days. Fixes PR kern/54276.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/include/i82093reg.h

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



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

2022-10-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  6 06:51:37 UTC 2022

Modified Files:
src/sys/arch/x86/include: i82093reg.h

Log Message:
IOAPIC_ID_MASK is 8 bits these days. Fixes PR kern/54276.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/include/i82093reg.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/x86/include/i82093reg.h
diff -u src/sys/arch/x86/include/i82093reg.h:1.6 src/sys/arch/x86/include/i82093reg.h:1.7
--- src/sys/arch/x86/include/i82093reg.h:1.6	Wed Jun 19 06:32:46 2019
+++ src/sys/arch/x86/include/i82093reg.h	Thu Oct  6 06:51:36 2022
@@ -1,4 +1,4 @@
-/* 	$NetBSD: i82093reg.h,v 1.6 2019/06/19 06:32:46 msaitoh Exp $ */
+/* 	$NetBSD: i82093reg.h,v 1.7 2022/10/06 06:51:36 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 #define IOAPIC_ID		0x00
 
 #define 	IOAPIC_ID_SHIFT		24
-#define		IOAPIC_ID_MASK		0x0f00
+#define		IOAPIC_ID_MASK		0xff00
 
 /* Version, and maximum interrupt pin number. */
   



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

2022-10-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  6 06:42:46 UTC 2022

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

Log Message:
Print detail about misconfigured APIC ID.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/x86/ioapic.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/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.65 src/sys/arch/x86/x86/ioapic.c:1.66
--- src/sys/arch/x86/x86/ioapic.c:1.65	Thu Oct  7 12:52:27 2021
+++ src/sys/arch/x86/x86/ioapic.c	Thu Oct  6 06:42:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ioapic.c,v 1.65 2021/10/07 12:52:27 msaitoh Exp $	*/
+/*	$NetBSD: ioapic.c,v 1.66 2022/10/06 06:42:46 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.65 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.66 2022/10/06 06:42:46 msaitoh Exp $");
 
 #include "opt_ddb.h"
 
@@ -374,8 +374,9 @@ ioapic_attach(device_t parent, device_t 
 	 * mapping later ...
 	 */
 	if (apic_id != sc->sc_pic.pic_apicid) {
-		aprint_debug_dev(sc->sc_dev, "misconfigured as apic %d\n",
- apic_id);
+		aprint_debug_dev(sc->sc_dev,
+		"apid is misconfigured (%d != %d)\n",
+		apic_id, sc->sc_pic.pic_apicid);
 
 		ioapic_write(sc, IOAPIC_ID,
 		(ioapic_read(sc, IOAPIC_ID) & ~IOAPIC_ID_MASK)
@@ -386,7 +387,8 @@ ioapic_attach(device_t parent, device_t 
 
 		if (apic_id != sc->sc_pic.pic_apicid)
 			aprint_error_dev(sc->sc_dev,
-			"can't remap to apid %d\n", sc->sc_pic.pic_apicid);
+			"can't remap apid from %d to %d\n",
+			apic_id, sc->sc_pic.pic_apicid);
 		else
 			aprint_debug_dev(sc->sc_dev, "remapped to apic %d\n",
 			sc->sc_pic.pic_apicid);



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

2022-10-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  6 06:42:46 UTC 2022

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

Log Message:
Print detail about misconfigured APIC ID.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/x86/ioapic.c

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



CVS commit: src/tests/lib/libc/inet

2022-10-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Oct  6 06:05:31 UTC 2022

Modified Files:
src/tests/lib/libc/inet: t_inet_network.c

Log Message:
add tests for PR/57046.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/inet/t_inet_network.c

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

Modified files:

Index: src/tests/lib/libc/inet/t_inet_network.c
diff -u src/tests/lib/libc/inet/t_inet_network.c:1.4 src/tests/lib/libc/inet/t_inet_network.c:1.5
--- src/tests/lib/libc/inet/t_inet_network.c:1.4	Thu Apr  9 16:47:56 2015
+++ src/tests/lib/libc/inet/t_inet_network.c	Thu Oct  6 06:05:31 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: t_inet_network.c,v 1.4 2015/04/09 16:47:56 ginsbach Exp $ */
+/* $NetBSD: t_inet_network.c,v 1.5 2022/10/06 06:05:31 ryo Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_inet_network.c,v 1.4 2015/04/09 16:47:56 ginsbach Exp $");
+__RCSID("$NetBSD: t_inet_network.c,v 1.5 2022/10/06 06:05:31 ryo Exp $");
 
 #include 
 
@@ -92,6 +92,9 @@ ATF_TC_BODY(inet_network_err, tc)
 		0x);
 	H_REQUIRE("255.255.255.255", 0x);
 	H_REQUIRE("x", 0x);
+	H_REQUIRE("x1", 0x);
+	H_REQUIRE("xab", 0x);
+	H_REQUIRE("x100", 0x);
 	H_REQUIRE("078", 0x);
 	H_REQUIRE("127.0xfff", 0x);
 }



CVS commit: src/tests/lib/libc/inet

2022-10-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Oct  6 06:05:31 UTC 2022

Modified Files:
src/tests/lib/libc/inet: t_inet_network.c

Log Message:
add tests for PR/57046.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/inet/t_inet_network.c

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



CVS commit: src/lib/libc/inet

2022-10-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Oct  6 06:03:06 UTC 2022

Modified Files:
src/lib/libc/inet: inet_network.c

Log Message:
fix fixPR/57046. inet_network(3) returns INADDR_NONE when network names such as 
/x[0-9a-f][0-9a-f]/.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/inet/inet_network.c

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



CVS commit: src/lib/libc/inet

2022-10-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Oct  6 06:03:06 UTC 2022

Modified Files:
src/lib/libc/inet: inet_network.c

Log Message:
fix fixPR/57046. inet_network(3) returns INADDR_NONE when network names such as 
/x[0-9a-f][0-9a-f]/.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/inet/inet_network.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/inet/inet_network.c
diff -u src/lib/libc/inet/inet_network.c:1.4 src/lib/libc/inet/inet_network.c:1.5
--- src/lib/libc/inet/inet_network.c:1.4	Sun Jan 20 04:56:08 2008
+++ src/lib/libc/inet/inet_network.c	Thu Oct  6 06:03:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet_network.c,v 1.4 2008/01/20 04:56:08 christos Exp $	*/
+/*	$NetBSD: inet_network.c,v 1.5 2022/10/06 06:03:06 ryo Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)inet_network.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: inet_network.c,v 1.4 2008/01/20 04:56:08 christos Exp $");
+__RCSID("$NetBSD: inet_network.c,v 1.5 2022/10/06 06:03:06 ryo Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -71,10 +71,11 @@ inet_network(const char *cp)
 
 again:
 	val = 0; base = 10; digit = 0;
-	if (*cp == '0')
+	if (*cp == '0') {
 		digit = 1, base = 8, cp++;
-	if (*cp == 'x' || *cp == 'X')
-		digit = 0, base = 16, cp++;
+		if (*cp == 'x' || *cp == 'X')
+			digit = 0, base = 16, cp++;
+	}
 	while ((c = *cp) != 0) {
 		if (isdigit(c)) {
 			if (base == 8 && (c == '8' || c == '9'))