CVS commit: src/sys/sys

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 01:21:42 UTC 2024

Modified Files:
src/sys/sys: ucontext.h

Log Message:
If  does not define __UCONTEXT_SIZE, define it as
sizeof(ucontext_t).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/ucontext.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/sys/ucontext.h
diff -u src/sys/sys/ucontext.h:1.21 src/sys/sys/ucontext.h:1.22
--- src/sys/sys/ucontext.h:1.21	Sat May 18 01:16:21 2024
+++ src/sys/sys/ucontext.h	Sat May 18 01:21:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.21 2024/05/18 01:16:21 thorpej Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.22 2024/05/18 01:21:42 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2003, 2024 The NetBSD Foundation, Inc.
@@ -82,6 +82,12 @@ struct __ucontext {
 #define _UC_UCONTEXT_ALIGN (~0)
 #endif
 
+#ifdef __UCONTEXT_SIZE
+__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE);
+#else
+#define	__UCONTEXT_SIZE		sizeof(ucontext_t)
+#endif
+
 #ifndef _UC_TLSBASE
 #error	_UC_TLSBASE not defined.
 #endif
@@ -102,10 +108,6 @@ int	setucontext(struct lwp *, const ucon
 void	cpu_getmcontext(struct lwp *, mcontext_t *, unsigned int *);
 int	cpu_setmcontext(struct lwp *, const mcontext_t *, unsigned int);
 int	cpu_mcontext_validate(struct lwp *, const mcontext_t *);
-
-#ifdef __UCONTEXT_SIZE
-__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE);
-#endif
 #endif /* _KERNEL */
 
 #endif /* !_SYS_UCONTEXT_H_ */



CVS commit: src/sys/sys

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 01:21:42 UTC 2024

Modified Files:
src/sys/sys: ucontext.h

Log Message:
If  does not define __UCONTEXT_SIZE, define it as
sizeof(ucontext_t).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/ucontext.h

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



CVS commit: src/sys/sys

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 01:16:21 UTC 2024

Modified Files:
src/sys/sys: ucontext.h

Log Message:
Define the _UC_* flag bits before including .


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/ucontext.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/sys/ucontext.h
diff -u src/sys/sys/ucontext.h:1.20 src/sys/sys/ucontext.h:1.21
--- src/sys/sys/ucontext.h:1.20	Sat May 18 00:37:41 2024
+++ src/sys/sys/ucontext.h	Sat May 18 01:16:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.20 2024/05/18 00:37:41 thorpej Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.21 2024/05/18 01:16:21 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2003, 2024 The NetBSD Foundation, Inc.
@@ -33,24 +33,6 @@
 #define _SYS_UCONTEXT_H_
 
 #include 
-#include 
-
-typedef struct __ucontext	ucontext_t;
-
-struct __ucontext {
-	unsigned int	uc_flags;	/* properties */
-	ucontext_t * 	uc_link;	/* context to resume */
-	sigset_t	uc_sigmask;	/* signals blocked in this context */
-	stack_t		uc_stack;	/* the stack used by this context */
-	mcontext_t	uc_mcontext;	/* machine state */
-#if defined(_UC_MACHINE_PAD)
-	long		__uc_pad[_UC_MACHINE_PAD];
-#endif
-};
-
-#ifndef _UC_UCONTEXT_ALIGN
-#define _UC_UCONTEXT_ALIGN (~0)
-#endif
 
 /* uc_flags */
 #define _UC_SIGMASK	0x01		/* valid uc_sigmask */
@@ -81,6 +63,25 @@ struct __ucontext {
  *	_UC_CLRSTACK	Context does not use signal stack
  */
 
+#include 
+
+typedef struct __ucontext	ucontext_t;
+
+struct __ucontext {
+	unsigned int	uc_flags;	/* properties */
+	ucontext_t * 	uc_link;	/* context to resume */
+	sigset_t	uc_sigmask;	/* signals blocked in this context */
+	stack_t		uc_stack;	/* the stack used by this context */
+	mcontext_t	uc_mcontext;	/* machine state */
+#if defined(_UC_MACHINE_PAD)
+	long		__uc_pad[_UC_MACHINE_PAD];
+#endif
+};
+
+#ifndef _UC_UCONTEXT_ALIGN
+#define _UC_UCONTEXT_ALIGN (~0)
+#endif
+
 #ifndef _UC_TLSBASE
 #error	_UC_TLSBASE not defined.
 #endif



CVS commit: src/sys/sys

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 01:16:21 UTC 2024

Modified Files:
src/sys/sys: ucontext.h

Log Message:
Define the _UC_* flag bits before including .


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

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



CVS commit: src/sys

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:37:42 UTC 2024

Modified Files:
src/sys/arch/alpha/include: mcontext.h
src/sys/arch/amd64/include: mcontext.h
src/sys/arch/arm/include: mcontext.h
src/sys/arch/hppa/include: mcontext.h
src/sys/arch/i386/include: mcontext.h
src/sys/arch/m68k/include: mcontext.h
src/sys/arch/powerpc/include: mcontext.h
src/sys/arch/sh3/include: mcontext.h
src/sys/arch/sparc/include: mcontext.h
src/sys/arch/sparc64/include: mcontext.h
src/sys/arch/vax/include: mcontext.h
src/sys/sys: ucontext.h

Log Message:
Clean up the  <->  interface up
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
  and use those constants to define the machine-dependent bits as well
  as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
  _UC_CLRSTACK are not defined by .


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/include/mcontext.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/mcontext.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/include/mcontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/include/mcontext.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/include/mcontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/include/mcontext.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/include/mcontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/include/mcontext.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc/include/mcontext.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc64/include/mcontext.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/ucontext.h

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

Modified files:

Index: src/sys/arch/alpha/include/mcontext.h
diff -u src/sys/arch/alpha/include/mcontext.h:1.11 src/sys/arch/alpha/include/mcontext.h:1.12
--- src/sys/arch/alpha/include/mcontext.h:1.11	Mon May 24 21:00:12 2021
+++ src/sys/arch/alpha/include/mcontext.h	Sat May 18 00:37:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.11 2021/05/24 21:00:12 thorpej Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.12 2024/05/18 00:37:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -93,9 +93,9 @@ typedef struct {
 } mcontext_t;
 
 /* Machine-dependent uc_flags */
-#define _UC_TLSBASE	0x20	/* valid process-unique value in _REG_UNIQUE */
-#define _UC_SETSTACK	0x0001
-#define _UC_CLRSTACK	0x0002
+#define _UC_TLSBASE	_UC_MD_BIT5	/* valid value in _REG_UNIQUE */
+#define _UC_SETSTACK	_UC_MD_BIT16
+#define _UC_CLRSTACK	_UC_MD_BIT17
 
 #define _UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_SP])
 #define _UC_MACHINE_FP(uc)	((uc)->uc_mcontext.__gregs[_REG_S6])

Index: src/sys/arch/amd64/include/mcontext.h
diff -u src/sys/arch/amd64/include/mcontext.h:1.20 src/sys/arch/amd64/include/mcontext.h:1.21
--- src/sys/arch/amd64/include/mcontext.h:1.20	Fri Dec 27 00:32:16 2019
+++ src/sys/arch/amd64/include/mcontext.h	Sat May 18 00:37:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.20 2019/12/27 00:32:16 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.21 2024/05/18 00:37:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -74,13 +74,13 @@ typedef struct {
 
 #define	_UC_MACHINE_SET_PC(uc, pc)	_UC_MACHINE_PC(uc) = (pc)
 
-#define	_UC_TLSBASE	0x0008
+#define	_UC_TLSBASE	_UC_MD_BIT19
 
 /*
  * mcontext extensions to handle signal delivery.
  */
-#define _UC_SETSTACK	0x0001
-#define _UC_CLRSTACK	0x0002
+#define _UC_SETSTACK	_UC_MD_BIT16
+#define _UC_CLRSTACK	_UC_MD_BIT17
 
 #define	__UCONTEXT_SIZE	784
 
@@ -155,7 +155,7 @@ typedef struct {
 	uint32_t	_mc_tlsbase;
 } mcontext32_t;
 
-#define _UC_FXSAVE   0x20/* FP state is in FXSAVE format in XMM space */
+#define _UC_FXSAVE   _UC_MD_BIT5/* FP state is in FXSAVE format in XMM space */
 
 #define	_UC_MACHINE32_PAD	4
 #define	__UCONTEXT32_SIZE	776

Index: src/sys/arch/arm/include/mcontext.h
diff -u src/sys/arch/arm/include/mcontext.h:1.23 src/sys/arch/arm/include/mcontext.h:1.24
--- src/sys/arch/arm/include/mcontext.h:1.23	Wed Oct  6 05:33:15 2021
+++ src/sys/arch/arm/include/mcontext.h	Sat May 18 00:37:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.23 2021/10/06 05:33:15 skrll Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.24 2024/05/18 00:37:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -257,14 +257,14 @@ __END_DECLS
 #endif /* _RTLD_SOURCE || _LIBC_SOURCE || __LIBPTHREAD_SOURCE__ */
 
 /* Machine-dependent uc_flags */
-#define _UC_TLSBASE	0x0008	/* see  */
+#define _UC_TLSBASE	_UC_MD_BIT19	/* see  */
 
 /* Machine-dependent uc_flags for arm */
-#define	_UC_ARM_VFP	0x0001	/* FPU field is VFP */
+#define	_UC_ARM_VFP	_UC_MD_BIT16	/* FPU field is VFP */
 
 

CVS commit: src/sys

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:37:42 UTC 2024

Modified Files:
src/sys/arch/alpha/include: mcontext.h
src/sys/arch/amd64/include: mcontext.h
src/sys/arch/arm/include: mcontext.h
src/sys/arch/hppa/include: mcontext.h
src/sys/arch/i386/include: mcontext.h
src/sys/arch/m68k/include: mcontext.h
src/sys/arch/powerpc/include: mcontext.h
src/sys/arch/sh3/include: mcontext.h
src/sys/arch/sparc/include: mcontext.h
src/sys/arch/sparc64/include: mcontext.h
src/sys/arch/vax/include: mcontext.h
src/sys/sys: ucontext.h

Log Message:
Clean up the  <->  interface up
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
  and use those constants to define the machine-dependent bits as well
  as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
  _UC_CLRSTACK are not defined by .


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/include/mcontext.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/mcontext.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/include/mcontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/include/mcontext.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/include/mcontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/include/mcontext.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/include/mcontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/include/mcontext.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc/include/mcontext.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc64/include/mcontext.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/ucontext.h

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



CVS commit: src/sys/miscfs/procfs

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:05:50 UTC 2024

Modified Files:
src/sys/miscfs/procfs: procfs_cmdline.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/miscfs/procfs/procfs_cmdline.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/miscfs/procfs/procfs_cmdline.c
diff -u src/sys/miscfs/procfs/procfs_cmdline.c:1.32 src/sys/miscfs/procfs/procfs_cmdline.c:1.33
--- src/sys/miscfs/procfs/procfs_cmdline.c:1.32	Fri Sep 27 14:36:18 2019
+++ src/sys/miscfs/procfs/procfs_cmdline.c	Sat May 18 00:05:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_cmdline.c,v 1.32 2019/09/27 14:36:18 christos Exp $	*/
+/*	$NetBSD: procfs_cmdline.c,v 1.33 2024/05/18 00:05:50 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1999 Jaromir Dolecek 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.32 2019/09/27 14:36:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.33 2024/05/18 00:05:50 thorpej Exp $");
 
 #include 
 #include 
@@ -39,7 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_cmdli
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 



CVS commit: src/sys/miscfs/procfs

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:05:50 UTC 2024

Modified Files:
src/sys/miscfs/procfs: procfs_cmdline.c

Log Message:
Remove unnecessary include of .


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

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



CVS commit: src/sys/fs/unionfs

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:05:18 UTC 2024

Modified Files:
src/sys/fs/unionfs: unionfs_vfsops.c

Log Message:
Remove unecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/unionfs/unionfs_vfsops.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/fs/unionfs/unionfs_vfsops.c
diff -u src/sys/fs/unionfs/unionfs_vfsops.c:1.16 src/sys/fs/unionfs/unionfs_vfsops.c:1.17
--- src/sys/fs/unionfs/unionfs_vfsops.c:1.16	Mon Sep 12 13:11:41 2022
+++ src/sys/fs/unionfs/unionfs_vfsops.c	Sat May 18 00:05:18 2024
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/fs/unionfs

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:05:18 UTC 2024

Modified Files:
src/sys/fs/unionfs: unionfs_vfsops.c

Log Message:
Remove unecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/unionfs/unionfs_vfsops.c

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



CVS commit: src/sys/fs/union

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:04:46 UTC 2024

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/fs/union/union_vfsops.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/fs/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.87 src/sys/fs/union/union_vfsops.c:1.88
--- src/sys/fs/union/union_vfsops.c:1.87	Mon Feb 13 08:39:40 2023
+++ src/sys/fs/union/union_vfsops.c	Sat May 18 00:04:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.88 2024/05/18 00:04:46 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.88 2024/05/18 00:04:46 thorpej Exp $");
 
 #include 
 #include 
@@ -87,7 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: union_vfsops
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/fs/union

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:04:46 UTC 2024

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
Remove unnecessary include of .


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

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



CVS commit: src/sys/fs/udf

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:04:01 UTC 2024

Modified Files:
src/sys/fs/udf: udf.h udf_rename.c

Log Message:
Move the include of  to where it's truly needed.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/udf/udf_rename.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/fs/udf/udf.h
diff -u src/sys/fs/udf/udf.h:1.55 src/sys/fs/udf/udf.h:1.56
--- src/sys/fs/udf/udf.h:1.55	Tue Jun 27 09:58:50 2023
+++ src/sys/fs/udf/udf.h	Sat May 18 00:04:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.h,v 1.55 2023/06/27 09:58:50 reinoud Exp $ */
+/* $NetBSD: udf.h,v 1.56 2024/05/18 00:04:01 thorpej Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* debug section */

Index: src/sys/fs/udf/udf_rename.c
diff -u src/sys/fs/udf/udf_rename.c:1.15 src/sys/fs/udf/udf_rename.c:1.16
--- src/sys/fs/udf/udf_rename.c:1.15	Fri Jun  2 08:51:48 2023
+++ src/sys/fs/udf/udf_rename.c	Sat May 18 00:04:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_rename.c,v 1.15 2023/06/02 08:51:48 andvar Exp $ */
+/* $NetBSD: udf_rename.c,v 1.16 2024/05/18 00:04:01 thorpej Exp $ */
 
 /*
  * Copyright (c) 2013 Reinoud Zandijk
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udf_rename.c,v 1.15 2023/06/02 08:51:48 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_rename.c,v 1.16 2024/05/18 00:04:01 thorpej Exp $");
 
 #include 
 #include 
@@ -36,7 +36,6 @@ __KERNEL_RCSID(0, "$NetBSD: udf_rename.c
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/fs/udf

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:04:01 UTC 2024

Modified Files:
src/sys/fs/udf: udf.h udf_rename.c

Log Message:
Move the include of  to where it's truly needed.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/udf/udf_rename.c

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



CVS commit: src/sys/dev/i2c

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:02:04 UTC 2024

Modified Files:
src/sys/dev/i2c: dbcool.c sgsmix.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/i2c/dbcool.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/sgsmix.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/dbcool.c
diff -u src/sys/dev/i2c/dbcool.c:1.64 src/sys/dev/i2c/dbcool.c:1.65
--- src/sys/dev/i2c/dbcool.c:1.64	Wed Mar 30 00:06:50 2022
+++ src/sys/dev/i2c/dbcool.c	Sat May 18 00:02:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbcool.c,v 1.64 2022/03/30 00:06:50 pgoyette Exp $ */
+/*	$NetBSD: dbcool.c,v 1.65 2024/05/18 00:02:04 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,13 +50,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.64 2022/03/30 00:06:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.65 2024/05/18 00:02:04 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Index: src/sys/dev/i2c/sgsmix.c
diff -u src/sys/dev/i2c/sgsmix.c:1.10 src/sys/dev/i2c/sgsmix.c:1.11
--- src/sys/dev/i2c/sgsmix.c:1.10	Sat Jan 30 01:23:08 2021
+++ src/sys/dev/i2c/sgsmix.c	Sat May 18 00:02:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sgsmix.c,v 1.10 2021/01/30 01:23:08 thorpej Exp $	*/
+/*	$NetBSD: sgsmix.c,v 1.11 2024/05/18 00:02:04 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz.
@@ -31,13 +31,12 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sgsmix.c,v 1.10 2021/01/30 01:23:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgsmix.c,v 1.11 2024/05/18 00:02:04 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 



CVS commit: src/sys/dev/i2c

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 18 00:02:04 UTC 2024

Modified Files:
src/sys/dev/i2c: dbcool.c sgsmix.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/i2c/dbcool.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/sgsmix.c

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



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:57:46 UTC 2024

Modified Files:
src/sys/coda: coda_namecache.c coda_psdev.c coda_subr.c coda_venus.c
coda_vfsops.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_namecache.c
cvs rdiff -u -r1.64 -r1.65 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.90 -r1.91 src/sys/coda/coda_vfsops.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/coda/coda_namecache.c
diff -u src/sys/coda/coda_namecache.c:1.29 src/sys/coda/coda_namecache.c:1.30
--- src/sys/coda/coda_namecache.c:1.29	Fri Feb  9 22:08:34 2024
+++ src/sys/coda/coda_namecache.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_namecache.c,v 1.29 2024/02/09 22:08:34 andvar Exp $	*/
+/*	$NetBSD: coda_namecache.c,v 1.30 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -77,11 +77,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_namecache.c,v 1.29 2024/02/09 22:08:34 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_namecache.c,v 1.30 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Index: src/sys/coda/coda_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.64 src/sys/coda/coda_psdev.c:1.65
--- src/sys/coda/coda_psdev.c:1.64	Tue Feb 13 21:39:02 2024
+++ src/sys/coda/coda_psdev.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.64 2024/02/13 21:39:02 andvar Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.65 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -54,14 +54,13 @@
 /* These routines are the device entry points for Venus. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.64 2024/02/13 21:39:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.65 2024/05/17 23:57:46 thorpej Exp $");
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.32 src/sys/coda/coda_subr.c:1.33
--- src/sys/coda/coda_subr.c:1.32	Mon Apr 13 19:23:17 2020
+++ src/sys/coda/coda_subr.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.32 2020/04/13 19:23:17 ad Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.33 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -55,11 +55,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.32 2020/04/13 19:23:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.33 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/coda/coda_venus.c
diff -u src/sys/coda/coda_venus.c:1.30 src/sys/coda/coda_venus.c:1.31
--- src/sys/coda/coda_venus.c:1.30	Thu Oct 17 20:56:02 2013
+++ src/sys/coda/coda_venus.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.c,v 1.30 2013/10/17 20:56:02 christos Exp $	*/
+/*	$NetBSD: coda_venus.c,v 1.31 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -32,11 +32,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.30 2013/10/17 20:56:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.31 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.90 src/sys/coda/coda_vfsops.c:1.91
--- src/sys/coda/coda_vfsops.c:1.90	Mon Mar 28 12:37:46 2022
+++ src/sys/coda/coda_vfsops.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.90 2022/03/28 12:37:46 riastradh Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.91 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -45,12 +45,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.90 2022/03/28 12:37:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.91 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:57:46 UTC 2024

Modified Files:
src/sys/coda: coda_namecache.c coda_psdev.c coda_subr.c coda_venus.c
coda_vfsops.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_namecache.c
cvs rdiff -u -r1.64 -r1.65 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.90 -r1.91 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:56:24 UTC 2024

Modified Files:
src/sys/coda: cnode.h

Log Message:
 -> 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/coda/cnode.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/coda/cnode.h
diff -u src/sys/coda/cnode.h:1.20 src/sys/coda/cnode.h:1.21
--- src/sys/coda/cnode.h:1.20	Sat Dec 13 15:59:30 2014
+++ src/sys/coda/cnode.h	Fri May 17 23:56:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cnode.h,v 1.20 2014/12/13 15:59:30 hannken Exp $	*/
+/*	$NetBSD: cnode.h,v 1.21 2024/05/17 23:56:24 thorpej Exp $	*/
 
 /*
  *
@@ -49,7 +49,7 @@
 
 #include 
 #ifdef _KERNEL
-#include 
+#include 
 
 MALLOC_DECLARE(M_CODA);
 #endif



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:56:24 UTC 2024

Modified Files:
src/sys/coda: cnode.h

Log Message:
 -> 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/coda/cnode.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/vax/include

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 22:21:17 UTC 2024

Modified Files:
src/sys/arch/vax/include: proc.h

Log Message:
G/C MDP_AST -- it's not referenced anywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/vax/include/proc.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/vax/include

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 22:21:17 UTC 2024

Modified Files:
src/sys/arch/vax/include: proc.h

Log Message:
G/C MDP_AST -- it's not referenced anywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/vax/include/proc.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/vax/include/proc.h
diff -u src/sys/arch/vax/include/proc.h:1.15 src/sys/arch/vax/include/proc.h:1.16
--- src/sys/arch/vax/include/proc.h:1.15	Sun Jul  3 02:18:20 2011
+++ src/sys/arch/vax/include/proc.h	Fri May 17 22:21:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.15 2011/07/03 02:18:20 matt Exp $	*/
+/*	$NetBSD: proc.h,v 1.16 2024/05/17 22:21:17 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1991 Regents of the University of California.
@@ -51,9 +51,6 @@ struct mdproc {
 
 };
 
-/* md_flags */
-#define	MDP_AST		0x0001	/* async trap pending */
-
 /* kernel stack params */
 #define	KSTACK_LOWEST_ADDR(l)	\
 	((char *)(l)->l_addr + (REDZONEADDR + VAX_NBPG))



CVS commit: src/sys/arch/vax

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 21:37:07 UTC 2024

Modified Files:
src/sys/arch/vax/include: mcontext.h
src/sys/arch/vax/vax: machdep.c sig_machdep.c

Log Message:
Implement _UC_SETSTACK / _UC_CLRSTACK.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/vax/vax/machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/vax/vax/sig_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/vax/include/mcontext.h
diff -u src/sys/arch/vax/include/mcontext.h:1.10 src/sys/arch/vax/include/mcontext.h:1.11
--- src/sys/arch/vax/include/mcontext.h:1.10	Fri Dec 27 00:32:17 2019
+++ src/sys/arch/vax/include/mcontext.h	Fri May 17 21:37:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:17 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.11 2024/05/17 21:37:07 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,9 @@ typedef struct {
 } mcontext_t;
 
 /* Machine-dependent uc_flags */
-#define _UC_TLSBASE	0x0008
+#define	_UC_SETSTACK	0x0001
+#define	_UC_CLRSTACK	0x0002
+#define	_UC_TLSBASE	0x0008
 
 #define	_UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_SP])
 #define	_UC_MACHINE_FP(uc)	((uc)->uc_mcontext.__gregs[_REG_FP])

Index: src/sys/arch/vax/vax/machdep.c
diff -u src/sys/arch/vax/vax/machdep.c:1.199 src/sys/arch/vax/vax/machdep.c:1.200
--- src/sys/arch/vax/vax/machdep.c:1.199	Tue Mar  5 14:15:36 2024
+++ src/sys/arch/vax/vax/machdep.c	Fri May 17 21:37:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.199 2024/03/05 14:15:36 thorpej Exp $	 */
+/* $NetBSD: machdep.c,v 1.200 2024/05/17 21:37:07 thorpej Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.199 2024/03/05 14:15:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.200 2024/05/17 21:37:07 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -696,6 +696,14 @@ cpu_setmcontext(struct lwp *l, const mco
 		lwp_setprivate(l, tlsbase);
 		tf->tf_sp += sizeof(tlsbase);
 	}
+
+	mutex_enter(l->l_proc->p_lock);
+	if (flags & _UC_SETSTACK)
+		l->l_sigstk.ss_flags |= SS_ONSTACK;
+	if (flags & _UC_CLRSTACK)
+		l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+	mutex_exit(l->l_proc->p_lock);
+
 	return 0;
 }
 

Index: src/sys/arch/vax/vax/sig_machdep.c
diff -u src/sys/arch/vax/vax/sig_machdep.c:1.26 src/sys/arch/vax/vax/sig_machdep.c:1.27
--- src/sys/arch/vax/vax/sig_machdep.c:1.26	Mon Nov  1 05:07:16 2021
+++ src/sys/arch/vax/vax/sig_machdep.c	Fri May 17 21:37:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.26 2021/11/01 05:07:16 thorpej Exp $	 */
+/* $NetBSD: sig_machdep.c,v 1.27 2024/05/17 21:37:07 thorpej Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.26 2021/11/01 05:07:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.27 2024/05/17 21:37:07 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -171,6 +171,8 @@ setupstack_siginfo3(const struct ksiginf
 	uc.uc_flags = _UC_SIGMASK;
 	uc.uc_sigmask = *mask;
 	uc.uc_link = l->l_ctxlink;
+	uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+	? _UC_SETSTACK : _UC_CLRSTACK;
 	sendsig_reset(l, ksi->ksi_signo);
 	mutex_exit(p->p_lock);
 	cpu_getmcontext(l, _mcontext, _flags);



CVS commit: src/sys/arch/vax

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 21:37:07 UTC 2024

Modified Files:
src/sys/arch/vax/include: mcontext.h
src/sys/arch/vax/vax: machdep.c sig_machdep.c

Log Message:
Implement _UC_SETSTACK / _UC_CLRSTACK.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/vax/vax/machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/vax/vax/sig_machdep.c

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



CVS commit: src/sys/dev/usb

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Apr 25 01:33:04 UTC 2024

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

Log Message:
Add a match quirk to prevent matching any interface on SiPEED FPGA
development boards (e.g. Tang Nano 9K).  The FT2232s on these boards
are wired up only for JTAG.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uftdi.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/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.78 src/sys/dev/usb/uftdi.c:1.79
--- src/sys/dev/usb/uftdi.c:1.78	Wed Apr 17 02:34:45 2024
+++ src/sys/dev/usb/uftdi.c	Thu Apr 25 01:33:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.79 2024/04/25 01:33:03 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.79 2024/04/25 01:33:03 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -229,7 +229,19 @@ static const struct uftdi_match_quirk_en
 	  .vendor_str	= "SecuringHardware.com",
 	  .product_str	= "Tigard V1.1",
 	  .match_ret	= UMATCH_NONE,
-	}
+	},
+	/*
+	 * The SiPEED Tang Nano 9K (and other SiPEED Tang FPGA development
+	 * boards) have an FT2232 on-board, wired up only for JTAG.
+	 */
+	{
+	  .vendor_id	= USB_VENDOR_FTDI,
+	  .product_id	= USB_PRODUCT_FTDI_SERIAL_2232C,
+	  .iface_no	= -1,
+	  .vendor_str	= "SIPEED",
+	  .product_str	= "JTAG Debugger",
+	  .match_ret	= UMATCH_NONE,
+	},
 };
 
 static int
@@ -243,7 +255,7 @@ uftdi_quirk_match(struct usbif_attach_ar
 		q = _match_quirks[i];
 		if (uiaa->uiaa_vendor != q->vendor_id ||
 		uiaa->uiaa_product != q->product_id ||
-		uiaa->uiaa_ifaceno != q->iface_no) {
+		(q->iface_no != -1 && uiaa->uiaa_ifaceno != q->iface_no)) {
 			continue;
 		}
 		if (q->vendor_str != NULL &&



CVS commit: src/sys/dev/usb

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Apr 25 01:33:04 UTC 2024

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

Log Message:
Add a match quirk to prevent matching any interface on SiPEED FPGA
development boards (e.g. Tang Nano 9K).  The FT2232s on these boards
are wired up only for JTAG.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uftdi.c

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



CVS commit: src/sys/dev/goldfish

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 14:41:13 UTC 2024

Modified Files:
src/sys/dev/goldfish: gfpic.c

Log Message:
Remove a superflouous printf().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/goldfish/gfpic.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/goldfish/gfpic.c
diff -u src/sys/dev/goldfish/gfpic.c:1.1 src/sys/dev/goldfish/gfpic.c:1.2
--- src/sys/dev/goldfish/gfpic.c:1.1	Tue Jan  2 07:27:51 2024
+++ src/sys/dev/goldfish/gfpic.c	Wed Apr 24 14:41:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gfpic.c,v 1.1 2024/01/02 07:27:51 thorpej Exp $	*/
+/*	$NetBSD: gfpic.c,v 1.2 2024/04/24 14:41:13 thorpej Exp $	*/
 
 /*- 
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gfpic.c,v 1.1 2024/01/02 07:27:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gfpic.c,v 1.2 2024/04/24 14:41:13 thorpej Exp $");
 
 #include 
 #include 
@@ -79,8 +79,6 @@ gfpic_enable(struct gfpic_softc *sc, int
 	KASSERT(pirq >= 0);
 	KASSERT(pirq <= 31);
 
-	device_printf(sc->sc_dev, "enabling IRQ %d (0x%08x)\n",
-	pirq, (1U << pirq));
 	REG_WRITE(sc, GFPIC_ENABLE, (1U << pirq));
 }
 



CVS commit: src/sys/dev/goldfish

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 14:41:13 UTC 2024

Modified Files:
src/sys/dev/goldfish: gfpic.c

Log Message:
Remove a superflouous printf().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/goldfish/gfpic.c

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



CVS commit: src/sys/kern

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:08:03 UTC 2024

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
vmem_init(): Ensure that the quantum is a power of 2, and that if private
tags are being used, they are added to the arena before the first span is
added.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/subr_vmem.c

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



CVS commit: src/sys/dev/pci

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

Modified Files:
src/sys/dev/pci: btvmeii.c

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.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/pci/btvmeii.c
diff -u src/sys/dev/pci/btvmeii.c:1.27 src/sys/dev/pci/btvmeii.c:1.28
--- src/sys/dev/pci/btvmeii.c:1.27	Tue Dec  5 15:58:32 2023
+++ src/sys/dev/pci/btvmeii.c	Wed Apr 24 02:31:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $ */
+/* $NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $");
 
 #include 
 #include 
@@ -328,7 +328,7 @@ b3_2706_map_vme(void *vsc, vme_addr_t vm
 			0,			/* boundary */
 			VMEM_ADDR_MIN,		/* minaddr */
 			VMEM_ADDR_MAX,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			)) {
 		sc->windowused[wnd] = 0;
 		return (ENOMEM);



CVS commit: src/sys/dev/pci

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

Modified Files:
src/sys/dev/pci: btvmeii.c

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.c

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



CVS commit: src/sys/dev/vme

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:27:33 UTC 2024

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

Log Message:
_vme_space_get(): Use VM_BESTFIT.


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

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



CVS commit: src/sys/dev/vme

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:27:33 UTC 2024

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

Log Message:
_vme_space_get(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/vme/vme.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/vme/vme.c
diff -u src/sys/dev/vme/vme.c:1.30 src/sys/dev/vme/vme.c:1.31
--- src/sys/dev/vme/vme.c:1.30	Mon Dec  4 01:49:29 2023
+++ src/sys/dev/vme/vme.c	Wed Apr 24 02:27:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $ */
+/* $NetBSD: vme.c,v 1.31 2024/04/24 02:27:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.31 2024/04/24 02:27:33 thorpej Exp $");
 
 #include 
 #include 
@@ -336,7 +336,7 @@ _vme_space_get(struct vmebus_softc *sc, 
 			  0,			/* nocross */
 			  VMEM_ADDR_MIN,	/* minaddr */
 			  VMEM_ADDR_MAX,	/* maxaddr */
-			  VM_NOSLEEP,
+			  VM_BESTFIT | VM_NOSLEEP,
 			  );
 	if (!res)
 		*addr = help;



CVS commit: src/sys/kern

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:08:03 UTC 2024

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
vmem_init(): Ensure that the quantum is a power of 2, and that if private
tags are being used, they are added to the arena before the first span is
added.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/subr_vmem.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/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.115 src/sys/kern/subr_vmem.c:1.116
--- src/sys/kern/subr_vmem.c:1.115	Sun Dec  3 19:34:08 2023
+++ src/sys/kern/subr_vmem.c	Wed Apr 24 02:08:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.115 2023/12/03 19:34:08 thorpej Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.116 2024/04/24 02:08:03 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.115 2023/12/03 19:34:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.116 2024/04/24 02:08:03 thorpej Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -971,6 +971,14 @@ vmem_init(vmem_t *vm, const char *name,
 	KASSERT((flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
 	KASSERT((~flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
 	KASSERT(quantum > 0);
+	KASSERT(powerof2(quantum));
+
+	/*
+	 * If private tags are going to be used, they must
+	 * be added to the arena before the first span is
+	 * added.
+	 */
+	KASSERT((flags & VM_PRIVTAGS) == 0 || size == 0);
 
 #if defined(_KERNEL)
 	/* XXX: SMP, we get called early... */



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

2024-04-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr  3 04:30:30 UTC 2024

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

Log Message:
Add a missing barrier in irongate_conf_read0().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/irongate_pci.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/alpha/pci

2024-04-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr  3 04:30:30 UTC 2024

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

Log Message:
Add a missing barrier in irongate_conf_read0().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/irongate_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/arch/alpha/pci/irongate_pci.c
diff -u src/sys/arch/alpha/pci/irongate_pci.c:1.12 src/sys/arch/alpha/pci/irongate_pci.c:1.13
--- src/sys/arch/alpha/pci/irongate_pci.c:1.12	Fri Jun 25 03:45:59 2021
+++ src/sys/arch/alpha/pci/irongate_pci.c	Wed Apr  3 04:30:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $ */
+/* $NetBSD: irongate_pci.c,v 1.13 2024/04/03 04:30:30 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.13 2024/04/03 04:30:30 thorpej Exp $");
 
 #include 
 #include 
@@ -106,6 +106,7 @@ irongate_conf_read0(void *ipv, pcitag_t 
 	REGVAL(PCI_CONF_ADDR) = (CONFADDR_ENABLE | tag | (offset & 0xff));
 	alpha_mb();
 	data = REGVAL(PCI_CONF_DATA);
+	alpha_mb();
 	REGVAL(PCI_CONF_ADDR) = 0;
 	alpha_mb();
 	PCI_CONF_UNLOCK(s);



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:11:21 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: dec_6600.c
src/sys/arch/alpha/include: rpb.h

Log Message:
In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true.  This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/include/rpb.h

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



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:11:21 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: dec_6600.c
src/sys/arch/alpha/include: rpb.h

Log Message:
In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true.  This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/include/rpb.h

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

Modified files:

Index: src/sys/arch/alpha/alpha/dec_6600.c
diff -u src/sys/arch/alpha/alpha/dec_6600.c:1.37 src/sys/arch/alpha/alpha/dec_6600.c:1.38
--- src/sys/arch/alpha/alpha/dec_6600.c:1.37	Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_6600.c	Sun Mar 31 19:11:21 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_6600.c,v 1.37 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_6600.c,v 1.38 2024/03/31 19:11:21 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.37 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.38 2024/03/31 19:11:21 thorpej Exp $");
 
 #include 
 #include 
@@ -101,15 +101,36 @@ static const char *kgdb_devlist[] = {
 };
 #endif /* KGDB */
 
+static const struct alpha_variation_table dec_6600_variations[] = {
+	{ SV_ST_DP264, "AlphaPC DP264" },
+	{ SV_ST_CLIPPER, "AlphaServer ES40 (\"Clipper\")" },
+	{ SV_ST_GOLDRUSH, "AlphaServer DS20 (\"GoldRush\")" },
+	{ SV_ST_WEBBRICK, "AlphaServer DS10 (\"WebBrick\")" },
+	{ SV_ST_SHARK, "AlphaServer DS20L (\"Shark\")" },
+	{ 0, NULL },
+};
+
+static const struct alpha_variation_table dec_titan_variations[] = {
+	{ 0, NULL },
+};
+
 void
 dec_6600_init(void)
 {
+	uint64_t variation;
 
-	platform.family = "6600";
+	platform.family = (hwrpb->rpb_type == ST_DEC_TITAN) ? "Titan"
+			: "6600";
 
 	if ((platform.model = alpha_dsr_sysname()) == NULL) {
-		/* XXX Don't know the system variations, yet. */
-		platform.model = alpha_unknown_sysname();
+		const struct alpha_variation_table *vartab =
+		(hwrpb->rpb_type == ST_DEC_TITAN) ? dec_titan_variations
+		  : dec_6600_variations;
+		variation = hwrpb->rpb_variation & SV_ST_MASK;
+		if ((platform.model = alpha_variation_name(variation,
+			   vartab)) == NULL) {
+			platform.model = alpha_unknown_sysname();
+		}
 	}
 
 	platform.iobus = "tsc";
@@ -203,6 +224,37 @@ dec_6600_device_register(device_t dev, v
 	struct bootdev_data *b = bootdev_data;
 	device_t parent = device_parent(dev);
 
+	/*
+	 * First section: Deal with system-specific quirks.
+	 */
+
+	if ((hwrpb->rpb_variation & SV_ST_MASK) == SV_ST_WEBBRICK) {
+		/*
+		 * DMA on the on-board ALI IDE controller is not
+		 * working correctly; disable it for now to let
+		 * the systems at least hobble along.
+		 *
+		 * N.B. There's only one Pchip on a DS10, do there
+		 * is not need to determine which hose we have here.
+		 *
+		 * XXX This is meant to be temporary until we can find
+		 * XXX and fix the issue with bus-master DMA.
+		 */
+		if (device_is_a(parent, "pci") && device_is_a(dev, "aceride")) {
+			struct pci_attach_args *pa = aux;
+
+			if (pa->pa_bus == 0 && pa->pa_device == 13 &&
+			pa->pa_function == 0) {
+prop_dictionary_set_bool(device_properties(dev),
+"pciide-disable-dma", true);
+			}
+		}
+	}
+
+	/*
+	 * Second section: Boot device detection.
+	 */
+
 	if (b == NULL || found)
 		return;
 

Index: src/sys/arch/alpha/include/rpb.h
diff -u src/sys/arch/alpha/include/rpb.h:1.44 src/sys/arch/alpha/include/rpb.h:1.45
--- src/sys/arch/alpha/include/rpb.h:1.44	Sat Oct  3 17:33:23 2020
+++ src/sys/arch/alpha/include/rpb.h	Sun Mar 31 19:11:21 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: rpb.h,v 1.44 2020/10/03 17:33:23 thorpej Exp $ */
+/* $NetBSD: rpb.h,v 1.45 2024/03/31 19:11:21 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -185,6 +185,23 @@ struct rpb {
  */
 #define	SV_ST_MIATA_1_5		0x4c00	/* Miata 1.5 */
 
+/*
+ * System types for the Tsunami family.
+ * XXX These are not very complete!
+ */
+#define	SV_ST_DP264		0x0400	/* AlphaPC DP264 */
+#define	SV_ST_WARHOL		0x0800
+#define	SV_ST_WINDJAMMER	0x0c00
+#define	SV_ST_MONET		0x1000
+#define	SV_ST_CLIPPER		0x1400	/* AlphaServer ES40 */
+#define	SV_ST_GOLDRUSH		0x1800	/* AlphaServer DS20 */
+#define	SV_ST_WEBBRICK		0x1c00	/* AlphaServer DS10 */
+#define	SV_ST_CATAMARAN		0x2000
+#define	SV_ST_BRISBANE		0x2400
+#define	SV_ST_MALBOURNE		0x2800
+#define	SV_ST_FLYINGCLIPPER	0x2c00
+#define	SV_ST_SHARK		0x3000	/* AlphaServer DS20L */
+
 	uint64_t	rpb_variation;		/*  58 */
 
 	

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

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:06:31 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c
dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c
dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c
dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c
dec_kn300.c dec_kn8ae.c

Log Message:
Always call platform.device_register(), even if bootdev_data is NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/autoconf.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_300.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/alpha/dec_3000_500.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_kn300.c \
src/sys/arch/alpha/alpha/dec_kn8ae.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/alpha/api_up1000.c
diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.32 src/sys/arch/alpha/alpha/api_up1000.c:1.33
--- src/sys/arch/alpha/alpha/api_up1000.c:1.32	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/alpha/api_up1000.c	Sun Mar 31 19:06:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -34,7 +34,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ api_up1000_device_register(device_t dev,
 	struct bootdev_data *b = bootdev_data;
 	device_t parent = device_parent(dev);
 
-	if (found)
+	if (b == NULL || found)
 		return;
 
 	if (!initted) {

Index: src/sys/arch/alpha/alpha/autoconf.c
diff -u src/sys/arch/alpha/alpha/autoconf.c:1.58 src/sys/arch/alpha/alpha/autoconf.c:1.59
--- src/sys/arch/alpha/alpha/autoconf.c:1.58	Fri Jul  9 01:29:20 2021
+++ src/sys/arch/alpha/alpha/autoconf.c	Sun Mar 31 19:06:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $ */
+/* $NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $");
 
 #include "pci.h"
 
@@ -324,13 +324,6 @@ device_register(device_t dev, void *aux)
 	if (parent != NULL && device_is_a(parent, "pci"))
 		device_pci_register(dev, aux);
 #endif
-
-	if (bootdev_data == NULL) {
-		/*
-		 * There is no hope.
-		 */
-		return;
-	}
 	if (platform.device_register)
 		(*platform.device_register)(dev, aux);
 }

Index: src/sys/arch/alpha/alpha/dec_1000a.c
diff -u src/sys/arch/alpha/alpha/dec_1000a.c:1.34 src/sys/arch/alpha/alpha/dec_1000a.c:1.35
--- src/sys/arch/alpha/alpha/dec_1000a.c:1.34	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/alpha/dec_1000a.c	Sun Mar 31 19:06:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $");
 
 #include 
 #include 
@@ -254,7 +254,7 @@ dec_1000a_device_register(device_t dev, 
 	struct bootdev_data *b = bootdev_data;
 	device_t parent = device_parent(dev);
 
-	if (found)
+	if (b == NULL || found)
 		return;
 
 	if (!initted) {

Index: src/sys/arch/alpha/alpha/dec_2000_300.c
diff -u src/sys/arch/alpha/alpha/dec_2000_300.c:1.21 src/sys/arch/alpha/alpha/dec_2000_300.c:1.22
--- src/sys/arch/alpha/alpha/dec_2000_300.c:1.21	Mon 

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

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:06:31 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c
dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c
dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c
dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c
dec_kn300.c dec_kn8ae.c

Log Message:
Always call platform.device_register(), even if bootdev_data is NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/autoconf.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_300.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/alpha/dec_3000_500.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_kn300.c \
src/sys/arch/alpha/alpha/dec_kn8ae.c

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



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

Modified Files:
src/sys/dev/pci: pciide_common.c

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/pciide_common.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/pci/pciide_common.c
diff -u src/sys/dev/pci/pciide_common.c:1.70 src/sys/dev/pci/pciide_common.c:1.71
--- src/sys/dev/pci/pciide_common.c:1.70	Mon Nov 20 21:59:38 2023
+++ src/sys/dev/pci/pciide_common.c	Sun Mar 31 18:59:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $	*/
+/*	$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $	*/
 
 
 /*
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $");
 
 #include 
 
@@ -484,6 +484,16 @@ pciide_mapreg_dma(struct pciide_softc *s
 			aprint_verbose(
 			", but unused (forced off by config file)");
 			sc->sc_dma_ok = 0;
+		} else {
+			bool disable;
+
+			if (prop_dictionary_get_bool(
+			device_properties(sc->sc_wdcdev.sc_atac.atac_dev),
+			"pciide-disable-dma", ) && disable) {
+aprint_verbose(
+", but unused (disabled by platform)");
+sc->sc_dma_ok = 0;
+			}
 		}
 		break;
 



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

Modified Files:
src/sys/dev/pci: pciide_common.c

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/pciide_common.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/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 17:13:29 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/alpha/include: cpu.h

Log Message:
Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/alpha/include/cpu.h

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

Modified files:

Index: src/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.378 src/sys/arch/alpha/alpha/machdep.c:1.379
--- src/sys/arch/alpha/alpha/machdep.c:1.378	Tue Mar  5 14:15:28 2024
+++ src/sys/arch/alpha/alpha/machdep.c	Sun Mar 31 17:13:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.378 2024/03/05 14:15:28 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.379 2024/03/31 17:13:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.378 2024/03/05 14:15:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.379 2024/03/31 17:13:29 thorpej Exp $");
 
 #include 
 #include 
@@ -1652,6 +1652,16 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		   CTLTYPE_INT, "fp_complete_debug", NULL,
 		   NULL, 0, _fp_complete_debug, 0,
 		   CTL_MACHDEP, CPU_FP_COMPLETE_DEBUG, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT,
+		   CTLTYPE_QUAD, "rpb_type", NULL,
+		   NULL, 0, >rpb_type, 0,
+		   CTL_MACHDEP, CPU_RPB_TYPE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT,
+		   CTLTYPE_QUAD, "rpb_variation", NULL,
+		   NULL, 0, >rpb_variation, 0,
+		   CTL_MACHDEP, CPU_RPB_VARIATION, CTL_EOL);
 }
 
 /*

Index: src/sys/arch/alpha/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.105 src/sys/arch/alpha/include/cpu.h:1.106
--- src/sys/arch/alpha/include/cpu.h:1.105	Wed Nov 22 01:56:14 2023
+++ src/sys/arch/alpha/include/cpu.h	Sun Mar 31 17:13:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.105 2023/11/22 01:56:14 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.106 2024/03/31 17:13:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -241,6 +241,8 @@ void	cpu_signotify(struct lwp *);
 #define	CPU_CCTR		8	/* int: using CC timecounter */
 #define	CPU_IS_QEMU		9	/* int: running under Qemu */
 #define	CPU_FP_COMPLETE_DEBUG	10	/* int: enable FP completion debug */
+#define	CPU_RPB_TYPE		11	/* quad: system type (from RPB) */
+#define	CPU_RPB_VARIATION	12	/* quad: system variation (from RPB) */
 
 
 #ifdef _KERNEL



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 17:13:29 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/alpha/include: cpu.h

Log Message:
Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/alpha/include/cpu.h

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 16:47:55 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-minipro

Log Message:
Add an example devpubd hook that looks for Minipro-compatible EEPROM
programmers and sets the access permissions to 0660.


To generate a diff of this commit:
cvs rdiff -u -r1.1337 -r1.1338 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-minipro
cvs rdiff -u -r1.2 -r1.3 src/share/examples/devpubd/hooks/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/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1337 src/distrib/sets/lists/base/mi:1.1338
--- src/distrib/sets/lists/base/mi:1.1337	Sat Mar 30 06:42:10 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 16:47:55 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1337 2024/03/30 06:42:10 thorpej Exp $
+# $NetBSD: mi,v 1.1338 2024/03/30 16:47:55 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2488,6 +2488,7 @@
 ./usr/share/examples/devpubd			base-sys-examples
 ./usr/share/examples/devpubd/hooks		base-sys-examples
 ./usr/share/examples/devpubd/hooks/99-ucom-symlinks	base-sys-examples
+./usr/share/examples/devpubd/hooks/99-ugen-perms-minipro base-sys-examples
 ./usr/share/examples/devpubd/hooks/99-ugen-perms-tigard	base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples

Index: src/share/examples/devpubd/hooks/Makefile
diff -u src/share/examples/devpubd/hooks/Makefile:1.2 src/share/examples/devpubd/hooks/Makefile:1.3
--- src/share/examples/devpubd/hooks/Makefile:1.2	Sat Mar 30 06:42:10 2024
+++ src/share/examples/devpubd/hooks/Makefile	Sat Mar 30 16:47:55 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2024/03/30 06:42:10 thorpej Exp $
+#	$NetBSD: Makefile,v 1.3 2024/03/30 16:47:55 thorpej Exp $
 
 NOOBJ=	# defined
 
@@ -6,6 +6,7 @@ NOOBJ=	# defined
 
 .if ${MKSHARE} != "no"
 FILES=	99-ucom-symlinks
+FILES+=	99-ugen-perms-minipro
 FILES+=	99-ugen-perms-tigard
 FILESDIR=/usr/share/examples/devpubd/hooks
 .endif

Added files:

Index: src/share/examples/devpubd/hooks/99-ugen-perms-minipro
diff -u /dev/null src/share/examples/devpubd/hooks/99-ugen-perms-minipro:1.1
--- /dev/null	Sat Mar 30 16:47:55 2024
+++ src/share/examples/devpubd/hooks/99-ugen-perms-minipro	Sat Mar 30 16:47:55 2024
@@ -0,0 +1,144 @@
+#!/bin/sh -x
+#
+# $NetBSD: 99-ugen-perms-minipro,v 1.1 2024/03/30 16:47:55 thorpej Exp $
+#
+# Look for a "Minipro" (https://gitlab.com/DavidGriffith/minipro) compatible
+# EEPROM programmer and change change the permissions to 0660.
+#
+# Written by Jason R. Thorpe, March 2024.  Public domain.
+#
+
+export LC_ALL=C
+
+event="$1"
+shift
+devices=$@
+
+orig_perms=0600
+new_perms=0660
+
+orig_group=wheel
+new_group=wheel
+
+device_name=minipro
+
+is_target_device()
+{
+	local vendor_string
+	local product_string
+	local vendor_id
+	local product_id
+
+	#
+	# TL866A/TL866CS programmers have:
+	#
+	#	VID = 0x04d8 (1240)	# Microchip
+	#	PID = 0xe11c (57628)	# probably some PIC microcontroller
+	#
+	# XXX It's probably better to match on vendor-string / product-string
+	# in this case because of the use of the generic Microchip VID.
+	#
+	# The XGecu-branded TL866II+ devices have:
+	#
+	#	vendor-string="Xingong Electronicg Co.."
+	#	product-string="Xingong XGecu USB Prog.. Device"
+	#
+	# ...but they also have seemingly unique VID/PID (not the
+	# generic Microchip VID the older TL866A/CS programmers have):
+	#
+	#	VID = 0xa466 (42086)
+	#	PID = 0x0a53 (2643)
+	#
+	# XXX Add the XGecu T48 programmer info here.
+	#
+
+	vendor_string="$(drvctl -p $1 vendor-string)"
+	product_string="$(drvctl -p $1 product-string)"
+	vendor_id="$(drvctl -p $1 vendor-id)"
+	product_id="$(drvctl -p $1 product-id)"
+
+	#
+	# TL866A / TL866CS
+	#
+	if [ x"$vendor_id" = x"1240" -a \
+	 x"$product_id" = x"57628" ]; then
+		echo "yes"
+		return;
+	fi
+
+	#
+	# TL866II+
+	#
+	if [ x"$vendor_id" = x"42086" -a \
+	 x"$product_id" = x"2643" ]; then
+		echo "yes"
+		return
+	fi
+
+	echo "no"
+}
+
+set_permissions()
+{
+	if [ x$(is_target_device $1) = xyes ]; then
+		chgrp $new_group /dev/"${2}".*
+		chmod $new_perms /dev/"${2}".*
+		#
+		# We need to create a symlink here to remember
+		# the ugen device node that was used, since we
+		# can't recover it from the device name that
+		# comes from the kernel later because we get the
+		# event *after* the device is gone, and 

CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 16:47:55 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-minipro

Log Message:
Add an example devpubd hook that looks for Minipro-compatible EEPROM
programmers and sets the access permissions to 0660.


To generate a diff of this commit:
cvs rdiff -u -r1.1337 -r1.1338 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-minipro
cvs rdiff -u -r1.2 -r1.3 src/share/examples/devpubd/hooks/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:42:10 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-tigard

Log Message:
Add an example devpubd hook that detects the generic USB interface
portion of a Tigard debug board and changes the permissions of the
appropriate /dev/ugenN.* nodes to allow access without superuser
permissions, suitable for using e.g. openocd with the device.

This example can be easily modified to support other generic USB devices
that have user-space drivers where running as the superuser is not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.1336 -r1.1337 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-tigard
cvs rdiff -u -r1.1 -r1.2 src/share/examples/devpubd/hooks/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:42:10 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-tigard

Log Message:
Add an example devpubd hook that detects the generic USB interface
portion of a Tigard debug board and changes the permissions of the
appropriate /dev/ugenN.* nodes to allow access without superuser
permissions, suitable for using e.g. openocd with the device.

This example can be easily modified to support other generic USB devices
that have user-space drivers where running as the superuser is not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.1336 -r1.1337 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-tigard
cvs rdiff -u -r1.1 -r1.2 src/share/examples/devpubd/hooks/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/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1336 src/distrib/sets/lists/base/mi:1.1337
--- src/distrib/sets/lists/base/mi:1.1336	Sat Mar 30 06:29:01 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 06:42:10 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1336 2024/03/30 06:29:01 thorpej Exp $
+# $NetBSD: mi,v 1.1337 2024/03/30 06:42:10 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2488,6 +2488,7 @@
 ./usr/share/examples/devpubd			base-sys-examples
 ./usr/share/examples/devpubd/hooks		base-sys-examples
 ./usr/share/examples/devpubd/hooks/99-ucom-symlinks	base-sys-examples
+./usr/share/examples/devpubd/hooks/99-ugen-perms-tigard	base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples
 ./usr/share/examples/dhcpcd/hooks		base-dhcpcd-examples

Index: src/share/examples/devpubd/hooks/Makefile
diff -u src/share/examples/devpubd/hooks/Makefile:1.1 src/share/examples/devpubd/hooks/Makefile:1.2
--- src/share/examples/devpubd/hooks/Makefile:1.1	Sat Mar 30 06:29:01 2024
+++ src/share/examples/devpubd/hooks/Makefile	Sat Mar 30 06:42:10 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2024/03/30 06:29:01 thorpej Exp $
+#	$NetBSD: Makefile,v 1.2 2024/03/30 06:42:10 thorpej Exp $
 
 NOOBJ=	# defined
 
@@ -6,6 +6,7 @@ NOOBJ=	# defined
 
 .if ${MKSHARE} != "no"
 FILES=	99-ucom-symlinks
+FILES+=	99-ugen-perms-tigard
 FILESDIR=/usr/share/examples/devpubd/hooks
 .endif
 

Added files:

Index: src/share/examples/devpubd/hooks/99-ugen-perms-tigard
diff -u /dev/null src/share/examples/devpubd/hooks/99-ugen-perms-tigard:1.1
--- /dev/null	Sat Mar 30 06:42:10 2024
+++ src/share/examples/devpubd/hooks/99-ugen-perms-tigard	Sat Mar 30 06:42:10 2024
@@ -0,0 +1,105 @@
+#!/bin/sh -
+#
+# $NetBSD: 99-ugen-perms-tigard,v 1.1 2024/03/30 06:42:10 thorpej Exp $
+#
+# Look for a Tigard (https://github.com/tigard-tools/tigard) debug
+# board and change the permissions to 0660.
+#
+# Written by Jason R. Thorpe, March 2024.  Public domain.
+#
+
+export LC_ALL=C
+
+event="$1"
+shift
+devices=$@
+
+orig_perms=0600
+new_perms=0660
+
+orig_group=wheel
+new_group=wheel
+
+device_name=tigard
+
+is_target_device()
+{
+	local vendor_string
+	local product_string
+
+	vendor_string="$(drvctl -p $1 vendor-string)"
+	product_string="$(drvctl -p $1 product-string)"
+
+	if [ x"$vendor_string" = x"SecuringHardware.com" -a \
+	 x"$product_string" = x"Tigard V1.1" ]; then
+		echo "yes"
+		return
+	fi
+
+	echo "no"
+}
+
+set_permissions()
+{
+	if [ x$(is_target_device $1) = xyes ]; then
+		chgrp $new_group /dev/"${2}".*
+		chmod $new_perms /dev/"${2}".*
+		#
+		# We need to create a symlink here to remember
+		# the ugen device node that was used, since we
+		# can't recover it from the device name that
+		# comes from the kernel later because we get the
+		# event *after* the device is gone, and thus
+		# cannot query any properties.
+		#
+		rm -f /dev/${1}-${device_name}
+		ln -sf ${2} /dev/${1}-${device_name}
+	fi
+}
+
+restore_permissions()
+{
+	if [ -h "/dev/${1}-${device_name}" ]; then
+		devnode=$(readlink "/dev/${1}-${device_name}")
+		if [ x"$devnode" != x ]; then
+			chmod $orig_perms /dev/"${devnode}".*
+			chgrp $orig_group /dev/"${devnode}".*
+		fi
+		rm -f "/dev/${1}-${device_name}"
+	fi
+}
+
+get_ugen_devnode()
+{
+	# Because "ugen" and "ugenif" share the same /dev/ugenN.*
+	# namespace, we have to query an additional property to
+	# determine which one it is.
+	local ugen_unit
+
+	ugen_unit=$(drvctl -p $1 ugen-unit)
+	case "$ugen_unit" in
+	[0-9]*)
+		echo "ugen$ugen_unit"
+		;;
+	esac
+}

CVS commit: src/share/examples

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:34 UTC 2024

Modified Files:
src/share/examples: Makefile
Added Files:
src/share/examples/devpubd: Makefile

Log Message:
Descend into share/examples/devpubd/hooks


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/examples/Makefile
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/Makefile

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

Modified files:

Index: src/share/examples/Makefile
diff -u src/share/examples/Makefile:1.24 src/share/examples/Makefile:1.25
--- src/share/examples/Makefile:1.24	Tue Oct 15 18:32:59 2019
+++ src/share/examples/Makefile	Sat Mar 30 06:29:33 2024
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.24 2019/10/15 18:32:59 christos Exp $
+#	$NetBSD: Makefile,v 1.25 2024/03/30 06:29:33 thorpej Exp $
 
-SUBDIR= amd apm asm disktab emul fstab ftpd getdate hostapd \
+SUBDIR= amd apm asm devpubd disktab emul fstab ftpd getdate hostapd \
 lua npf pppd racoon syslogd wpa_supplicant wsmoused
 
 .include 

Added files:

Index: src/share/examples/devpubd/Makefile
diff -u /dev/null src/share/examples/devpubd/Makefile:1.1
--- /dev/null	Sat Mar 30 06:29:34 2024
+++ src/share/examples/devpubd/Makefile	Sat Mar 30 06:29:33 2024
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile,v 1.1 2024/03/30 06:29:33 thorpej Exp $
+
+SUBDIR= hooks
+
+.include 



CVS commit: src/share/examples

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:34 UTC 2024

Modified Files:
src/share/examples: Makefile
Added Files:
src/share/examples/devpubd: Makefile

Log Message:
Descend into share/examples/devpubd/hooks


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/examples/Makefile
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:01 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
Added Files:
src/share/examples/devpubd/hooks: 99-ucom-symlinks Makefile

Log Message:
Add an example devpubd hook that makes stable path names, using symlinks,
for USB serial interfaces, regardless of where the interface is connected
or the order of enumeration.  This requires the USB device to have a
"serialnumber" to function.  Examples:

- uftdi serial adapter with two ports:

/dev/tty-uftdi-FT64S4YP-1 -> /dev/ttyU0
/dev/tty-uftdi-FT64S4YP-2 -> /dev/ttyU1

- uslsa serial adapter:

/dev/tty-uslsa-01E7ABCC -> /dev/ttyU4

This allows something like the following in /etc/remote:

sun3:dv=/dev/tty-uftdi-FT64S4YP-1:br#9600:pa=none:dc:

That path will always be stable regardless of which /dev/ttyU* node is
actually assigned when the serial adapter is plugged in.


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ucom-symlinks \
src/share/examples/devpubd/hooks/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:01 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
Added Files:
src/share/examples/devpubd/hooks: 99-ucom-symlinks Makefile

Log Message:
Add an example devpubd hook that makes stable path names, using symlinks,
for USB serial interfaces, regardless of where the interface is connected
or the order of enumeration.  This requires the USB device to have a
"serialnumber" to function.  Examples:

- uftdi serial adapter with two ports:

/dev/tty-uftdi-FT64S4YP-1 -> /dev/ttyU0
/dev/tty-uftdi-FT64S4YP-2 -> /dev/ttyU1

- uslsa serial adapter:

/dev/tty-uslsa-01E7ABCC -> /dev/ttyU4

This allows something like the following in /etc/remote:

sun3:dv=/dev/tty-uftdi-FT64S4YP-1:br#9600:pa=none:dc:

That path will always be stable regardless of which /dev/ttyU* node is
actually assigned when the serial adapter is plugged in.


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ucom-symlinks \
src/share/examples/devpubd/hooks/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/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1335 src/distrib/sets/lists/base/mi:1.1336
--- src/distrib/sets/lists/base/mi:1.1335	Sat Mar 30 06:11:59 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 06:29:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1335 2024/03/30 06:11:59 thorpej Exp $
+# $NetBSD: mi,v 1.1336 2024/03/30 06:29:01 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2487,6 +2487,7 @@
 ./usr/share/examples/certctl/certs.conf		base-sysutil-examples
 ./usr/share/examples/devpubd			base-sys-examples
 ./usr/share/examples/devpubd/hooks		base-sys-examples
+./usr/share/examples/devpubd/hooks/99-ucom-symlinks	base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples
 ./usr/share/examples/dhcpcd/hooks		base-dhcpcd-examples

Added files:

Index: src/share/examples/devpubd/hooks/99-ucom-symlinks
diff -u /dev/null src/share/examples/devpubd/hooks/99-ucom-symlinks:1.1
--- /dev/null	Sat Mar 30 06:29:01 2024
+++ src/share/examples/devpubd/hooks/99-ucom-symlinks	Sat Mar 30 06:29:01 2024
@@ -0,0 +1,134 @@
+#!/bin/sh -
+#
+# $NetBSD: 99-ucom-symlinks,v 1.1 2024/03/30 06:29:01 thorpej Exp $
+#
+# Attempt to create stable names (using symbolic links) to USB serial
+# devices, regardless of device enumeration order, suitable for use in
+# configuration files.  The format of the stable names is:
+#
+#	/dev/{cdt}ty-$driver-$serialnumber-$portnumber
+# - or -
+#	/dev/{cdt}ty-$driver-$serialnumber
+#
+# depending on whether or not the device is a multi-port adapter.
+#
+# e.g.
+#
+#	/dev/tty-uftdi-FT64S4YP-1 -> /dev/ttyU0
+#
+#	/dev/tty-uslsa-01E7ABCC -> /dev/ttyU4
+#
+# If $driver or $serialnumber cannot be determined, then no symbolic link
+# will be created.
+#
+# Written by Jason R. Thorpe, December 2022.  Public domain.
+#
+
+export LC_ALL=C
+
+event="$1"
+shift
+devices=$@
+
+symlink_name()
+{
+	local parent
+	local portnum
+	local serialnum
+	local driver
+
+	parent=$(drvctl -p $1 device-parent)
+	if [ x"$parent" != x ]; then
+		driver=$(drvctl -p $parent device-driver)
+		serialnum=$(drvctl -p $parent serialnumber)
+	fi
+
+	# If the device is a single-port device, it may have the default
+	# port number locator of '-1'.  In that case, elide the port
+	# number.
+	portnum=$(drvctl -p $1 port)
+	if [ x"$portnum" = x"-1" -o x"$portnum" = x ]; then
+		portnum=""
+	else
+		portnum="-${portnum}"
+	fi
+
+	if [ x"$driver" != x -a x"$serialnum" != x ]; then
+		echo "${driver}-${serialnum}${portnum}"
+	else
+		echo ""
+	fi
+}
+
+remove_ucom_symlink()
+{
+	local name
+	local unit
+
+	name=$(readlink "/dev/${1}")
+
+	if [ x"$name" != x ]; then
+		rm -f "/dev/tty-${name}"
+		rm -f "/dev/dty-${name}"
+		rm -f "/dev/cty-${name}"
+		rm -f "/dev/${1}"
+	fi
+}
+
+add_ucom_symlink()
+{
+	local name
+	local tty_path
+	local dty_path
+	local cty_path
+
+	name=$(symlink_name $1)
+	unit=$(drvctl -p $1 device-unit)
+
+	if [ x"$name" != x -a x"$unit" != x ]; then
+		#
+		# We need to make two sets of symlinks:
+		#
+		# /dev/tty-uslsa-01E7ABCC -> /dev/ttyU4
+		#
+		# /dev/ucom4 -> uslsa-01E7ABCC
+		#
+		# This is needed because when we get the detach event
+		# for e.g. ucom4, the parent device (e.g. uslsa0) may
+		# already be gone, meaning we cannot query it.  So
+		# what we're doing is stashing the information in the
+		# second symlink so we can readlink(

CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:11:59 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/etc/mtree: NetBSD.dist.base

Log Message:
Add an examples directory for devpubd hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.1334 -r1.1335 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.255 -r1.256 src/etc/mtree/NetBSD.dist.base

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:11:59 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/etc/mtree: NetBSD.dist.base

Log Message:
Add an examples directory for devpubd hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.1334 -r1.1335 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.255 -r1.256 src/etc/mtree/NetBSD.dist.base

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1334 src/distrib/sets/lists/base/mi:1.1335
--- src/distrib/sets/lists/base/mi:1.1334	Sun Mar  3 04:35:18 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 06:11:59 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1334 2024/03/03 04:35:18 riastradh Exp $
+# $NetBSD: mi,v 1.1335 2024/03/30 06:11:59 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2485,6 +2485,8 @@
 ./usr/share/examples/blocklist/npf.conf		base-sys-examples
 ./usr/share/examples/certctl			base-sysutil-examples
 ./usr/share/examples/certctl/certs.conf		base-sysutil-examples
+./usr/share/examples/devpubd			base-sys-examples
+./usr/share/examples/devpubd/hooks		base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples
 ./usr/share/examples/dhcpcd/hooks		base-dhcpcd-examples

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.255 src/etc/mtree/NetBSD.dist.base:1.256
--- src/etc/mtree/NetBSD.dist.base:1.255	Sat Jan 27 21:06:09 2024
+++ src/etc/mtree/NetBSD.dist.base	Sat Mar 30 06:11:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.255 2024/01/27 21:06:09 riastradh Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.256 2024/03/30 06:11:58 thorpej Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -479,6 +479,8 @@
 ./usr/share/examples/atf
 ./usr/share/examples/blocklist
 ./usr/share/examples/certctl
+./usr/share/examples/devpubd
+./usr/share/examples/devpubd/hooks
 ./usr/share/examples/dhcp
 ./usr/share/examples/dhcpcd
 ./usr/share/examples/dhcpcd/hooks



CVS commit: src/sys/dev/usb

2024-03-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 29 19:30:09 UTC 2024

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

Log Message:
ugen and ugenif share the same /dev/ugenN.xx namespace in such a way
that the device unit number does not necessarily match the /dev/ugenN.xx
unit number (N).  If you ONLY have ugen devices, it happens to work out
and devpubd scripts can be extremely naive.  If you ONLY have ugenif
devices, it also happens to work out, but your devpubd scripts have to
slightly more informed.  If you have a mix of ugen AND ugenif devices,
though, you're pretty much out of luck.

So, this change adds a "ugen-unit" device property which devpubd scripts
can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif
device is using.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/ugen.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/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.176 src/sys/dev/usb/ugen.c:1.177
--- src/sys/dev/usb/ugen.c:1.176	Tue Mar 26 03:24:14 2024
+++ src/sys/dev/usb/ugen.c	Fri Mar 29 19:30:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $	*/
+/*	$NetBSD: ugen.c,v 1.177 2024/03/29 19:30:09 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.177 2024/03/29 19:30:09 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -238,12 +238,18 @@ ugenif_get_unit(struct ugen_softc *sc)
 	KASSERT(sc0 == sc);
 	KASSERT(rb_tree_find_node(, ) == sc);
 	mutex_exit();
+
+	prop_dictionary_set_uint(device_properties(sc->sc_dev),
+	"ugen-unit", sc->sc_unit);
 }
 
 static void
 ugenif_put_unit(struct ugen_softc *sc)
 {
 
+	prop_dictionary_remove(device_properties(sc->sc_dev),
+	"ugen-unit");
+
 	mutex_enter();
 	KASSERT(rb_tree_find_node(, >sc_unit) == sc);
 	rb_tree_remove_node(, sc);



CVS commit: src/sys/dev/usb

2024-03-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 29 19:30:09 UTC 2024

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

Log Message:
ugen and ugenif share the same /dev/ugenN.xx namespace in such a way
that the device unit number does not necessarily match the /dev/ugenN.xx
unit number (N).  If you ONLY have ugen devices, it happens to work out
and devpubd scripts can be extremely naive.  If you ONLY have ugenif
devices, it also happens to work out, but your devpubd scripts have to
slightly more informed.  If you have a mix of ugen AND ugenif devices,
though, you're pretty much out of luck.

So, this change adds a "ugen-unit" device property which devpubd scripts
can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif
device is using.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/ugen.c

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



CVS commit: src/sys/dev/usb

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:38:02 UTC 2024

Modified Files:
src/sys/dev/usb: uftdi.c usbdevices.config

Log Message:
Add a "match quirk" mechanism to the uftdi driver that allows it to
selectively reject individual interfaces based on the combination of
- Vendor ID
- Product ID
- Interface number
- Vendor string
- Product string

This is necessary[*] to allow some devices that would otherwise match
uftdi (and thus instantiate a ucom) to be matched by ugenif instead,
which is required to make the device available to libusb1.

[*] ...due to a deficiency in the USB stack that does not provide a
mechanism for a user-space driver to claim a device from a kernel driver
and then return it back at a later time.

Use this new match quirk mechanism to reject "interface 1" of the
FTDI 2232C-based Tigard debug board; On this board, "interface 0"
is brought out to regular TTL-level UART pins, but "interface 1" is
brought out to SWD and JTAG headers, and is really only useful when
used with something like openocd.  Because the FTDI 2232C on this board
just uses the standard FTDI vendor and product IDs, it can only be
distinguished by the strings, which cannot be specified usbdevices.config,
thus necessitating the match quirk entry (that works in combination
with the ugenif entry added in usbdevices.config).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/usbdevices.config

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/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.76 src/sys/dev/usb/uftdi.c:1.77
--- src/sys/dev/usb/uftdi.c:1.76	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/usb/uftdi.c	Tue Mar 26 03:38:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.76 2021/08/07 16:19:17 thorpej Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.76 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -184,10 +185,72 @@ static int	uftdi_detach(device_t, int);
 CFATTACH_DECL2_NEW(uftdi, sizeof(struct uftdi_softc), uftdi_match,
 uftdi_attach, uftdi_detach, NULL, NULL, uftdi_childdet);
 
+struct uftdi_match_quirk_entry {
+	uint16_t	vendor_id;
+	uint16_t	product_id;
+	int		iface_no;
+	const char *	vendor_str;
+	const char *	product_str;
+	int		match_ret;
+};
+
+static const struct uftdi_match_quirk_entry uftdi_match_quirks[] = {
+	/*
+	 * The Tigard board (https://github.com/tigard-tools/tigard)
+	 * has two interfaces, one of which is meant to act as a
+	 * regular USB serial port (interface 0), the other of which
+	 * is meant for other protocols (SWD, JTAG, etc.).  We must
+	 * reject interface 1 so that ugenif matches, thus allowing
+	 * full user-space control of that port.
+	 */
+	{
+	  .vendor_id	= USB_VENDOR_FTDI,
+	  .product_id	= USB_PRODUCT_FTDI_SERIAL_2232C,
+	  .iface_no	= 1,
+	  .vendor_str	= "SecuringHardware.com",
+	  .product_str	= "Tigard V1.1",
+	  .match_ret	= UMATCH_NONE,
+	}
+};
+
+static int
+uftdi_quirk_match(struct usbif_attach_arg *uiaa, int rv)
+{
+	struct usbd_device *dev = uiaa->uiaa_device;
+	const struct uftdi_match_quirk_entry *q;
+	int i;
+
+	for (i = 0; i < __arraycount(uftdi_match_quirks); i++) {
+		q = _match_quirks[i];
+		if (uiaa->uiaa_vendor != q->vendor_id ||
+		uiaa->uiaa_product != q->product_id ||
+		uiaa->uiaa_ifaceno != q->iface_no) {
+			continue;
+		}
+		if (q->vendor_str != NULL &&
+		(dev->ud_vendor == NULL ||
+		 strcmp(dev->ud_vendor, q->vendor_str) != 0)) {
+			continue;
+		}
+		if (q->product_str != NULL &&
+		(dev->ud_product == NULL ||
+		 strcmp(dev->ud_product, q->product_str) != 0)) {
+			continue;
+		}
+		/*
+		 * Got a match!
+		 */
+		rv = q->match_ret;
+		break;
+	}
+	return rv;
+}
+
 static int
 uftdi_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct usbif_attach_arg *uiaa = aux;
+	int rv;
 
 	DPRINTFN(20,("uftdi: vendor=%#x, product=%#x\n",
 		 uiaa->uiaa_vendor, uiaa->uiaa_product));
@@ -195,8 +258,12 @@ uftdi_match(device_t parent, cfdata_t ma
 	if (uiaa->uiaa_configno != UFTDI_CONFIG_NO)
 		return UMATCH_NONE;
 
-	return uftdi_lookup(uiaa->uiaa_vendor, uiaa->uiaa_product) != NULL ?
+	rv = uftdi_lookup(uiaa->uiaa_vendor, uiaa->uiaa_product) != NULL ?
 		UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE;
+	if (rv != UMATCH_NONE) {
+		rv = uftdi_quirk_match(uiaa, rv);
+	}
+	return rv;
 }
 
 static void

Index: src/sys/dev/usb/usbdevices.config
diff -u src/sys/dev/usb/usbdevices.config:1.42 src/sys/dev/usb/usbdevices.config:1.43

CVS commit: src/sys/dev/usb

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:38:02 UTC 2024

Modified Files:
src/sys/dev/usb: uftdi.c usbdevices.config

Log Message:
Add a "match quirk" mechanism to the uftdi driver that allows it to
selectively reject individual interfaces based on the combination of
- Vendor ID
- Product ID
- Interface number
- Vendor string
- Product string

This is necessary[*] to allow some devices that would otherwise match
uftdi (and thus instantiate a ucom) to be matched by ugenif instead,
which is required to make the device available to libusb1.

[*] ...due to a deficiency in the USB stack that does not provide a
mechanism for a user-space driver to claim a device from a kernel driver
and then return it back at a later time.

Use this new match quirk mechanism to reject "interface 1" of the
FTDI 2232C-based Tigard debug board; On this board, "interface 0"
is brought out to regular TTL-level UART pins, but "interface 1" is
brought out to SWD and JTAG headers, and is really only useful when
used with something like openocd.  Because the FTDI 2232C on this board
just uses the standard FTDI vendor and product IDs, it can only be
distinguished by the strings, which cannot be specified usbdevices.config,
thus necessitating the match quirk entry (that works in combination
with the ugenif entry added in usbdevices.config).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/usbdevices.config

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



CVS commit: src

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:24:14 UTC 2024

Modified Files:
src/share/man/man4: ugen.4
src/sys/dev/usb: ugen.c

Log Message:
Define a "flags 1" config directive for ugenif, which is similar to ugen's,
but rather forces the ugenif to match at the *lowest* match priority rather
than the highest.  This allows ugenif to claim only otherwise unclaimed
interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man4/ugen.4
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/share/man/man4/ugen.4
diff -u src/share/man/man4/ugen.4:1.38 src/share/man/man4/ugen.4:1.39
--- src/share/man/man4/ugen.4:1.38	Fri Aug 28 16:07:49 2020
+++ src/share/man/man4/ugen.4	Tue Mar 26 03:24:14 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: ugen.4,v 1.38 2020/08/28 16:07:49 fcambus Exp $
+.\" $NetBSD: ugen.4,v 1.39 2024/03/26 03:24:14 thorpej Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 14, 2019
+.Dd March 25, 2024
 .Dt UGEN 4
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Cd "ugen* at uhub? flags N"
 .Cd "ugen* at uhub? vendor V product P flags 1"
 .Cd "ugenif* at uhub? vendor V product P configuration C interface I"
+.Cd "ugenif* at uhub? vendor V product P configuration C interface I flags 1"
 .Sh DESCRIPTION
 The
 .Nm
@@ -62,7 +63,9 @@ locators this can be used to force the
 driver to be used for a certain
 device.
 .Pp
-The second form of attachment can be used to
+The
+.Sq ugenif
+form of attachment can be used to
 .Dq steal
 only one interface from some device for use by the
 .Nm
@@ -74,6 +77,12 @@ as otherwise the
 driver would capture all of your
 .Nm usb
 devices.
+If
+.Dq flags 1
+is specified, the
+.Sq ugenif
+form will match at the lowest priority, thus allowing it to match only
+otherwise unclaimed interfaces.
 .Em NOTE :
 You have to be extremely careful,
 when using this form,

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.175 src/sys/dev/usb/ugen.c:1.176
--- src/sys/dev/usb/ugen.c:1.175	Mon Nov  6 12:16:52 2023
+++ src/sys/dev/usb/ugen.c	Tue Mar 26 03:24:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.175 2023/11/06 12:16:52 hannken Exp $	*/
+/*	$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.175 2023/11/06 12:16:52 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -367,8 +367,12 @@ ugen_match(device_t parent, cfdata_t mat
 static int
 ugenif_match(device_t parent, cfdata_t match, void *aux)
 {
-	/* Assume that they knew what they configured! (see ugenif(4)) */
-	return UMATCH_HIGHEST;
+	/*
+	 * Like ugen(4), ugenif(4) also has an override flag.  It has the
+	 * opposite effect, however, causing us to match with GENERIC
+	 * priority rather than HIGHEST.
+	 */
+	return (match->cf_flags & 1) ? UMATCH_GENERIC : UMATCH_HIGHEST;
 }
 
 static void



CVS commit: src

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:24:14 UTC 2024

Modified Files:
src/share/man/man4: ugen.4
src/sys/dev/usb: ugen.c

Log Message:
Define a "flags 1" config directive for ugenif, which is similar to ugen's,
but rather forces the ugenif to match at the *lowest* match priority rather
than the highest.  This allows ugenif to claim only otherwise unclaimed
interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man4/ugen.4
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/usb/ugen.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/alpha

2024-03-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 13:37:35 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/tlsb: tlsb.c tlsbvar.h

Log Message:
Tidy up TLSB autoconfiguration just a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/tlsb/tlsb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/tlsb/tlsbvar.h

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

Modified files:

Index: src/sys/arch/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.420 src/sys/arch/alpha/conf/GENERIC:1.421
--- src/sys/arch/alpha/conf/GENERIC:1.420	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/conf/GENERIC	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.420 2024/03/02 20:15:33 thorpej Exp $
+# $NetBSD: GENERIC,v 1.421 2024/03/06 13:37:35 thorpej Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.420 $"
+ident		"GENERIC-$Revision: 1.421 $"
 
 maxusers 32
 
@@ -191,9 +191,9 @@ qemu*	at	mainbus?
 
 # TurboLaser bus support and devices
 tlsb*	at	mainbus?
-gbus*	at	tlsb? node ? offset ?
-tlsbmem* at	tlsb? node ? offset ?
-kft*	at	tlsb? node ? offset ?
+gbus*	at	tlsb? node ?
+tlsbmem* at	tlsb? node ?
+kft*	at	tlsb? node ?
 
 # Gbus Devices
 mcclock* at	gbus? offset ?

Index: src/sys/arch/alpha/conf/INSTALL
diff -u src/sys/arch/alpha/conf/INSTALL:1.119 src/sys/arch/alpha/conf/INSTALL:1.120
--- src/sys/arch/alpha/conf/INSTALL:1.119	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/conf/INSTALL	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.119 2024/03/02 20:15:33 thorpej Exp $
+# $NetBSD: INSTALL,v 1.120 2024/03/06 13:37:35 thorpej Exp $
 #
 # Alpha INSTALL kernel.
 
@@ -92,9 +92,9 @@ qemu*	at	mainbus?
 
 # TurboLaser bus support and devices
 tlsb*	at	mainbus?
-gbus*	at	tlsb? node ? offset ?
-tlsbmem* at	tlsb? node ? offset ?
-kft*	at	tlsb? node ? offset ?
+gbus*	at	tlsb? node ?
+tlsbmem* at	tlsb? node ?
+kft*	at	tlsb? node ?
 
 # Gbus Devices
 mcclock* at	gbus? offset ?

Index: src/sys/arch/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.197 src/sys/arch/alpha/conf/files.alpha:1.198
--- src/sys/arch/alpha/conf/files.alpha:1.197	Wed Mar  6 05:33:09 2024
+++ src/sys/arch/alpha/conf/files.alpha	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.197 2024/03/06 05:33:09 thorpej Exp $
+# $NetBSD: files.alpha,v 1.198 2024/03/06 13:37:35 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -85,7 +85,7 @@ file	dev/md_root.c			memory_disk_hooks
 # TurboLaser Bus Support
 #
 
-device	tlsb { node = -1, offset = -1 }
+device	tlsb { node = -1 }
 attach	tlsb at mainbus
 file	arch/alpha/tlsb/tlsb.c		tlsb & dec_kn8ae
 

Index: src/sys/arch/alpha/tlsb/tlsb.c
diff -u src/sys/arch/alpha/tlsb/tlsb.c:1.41 src/sys/arch/alpha/tlsb/tlsb.c:1.42
--- src/sys/arch/alpha/tlsb/tlsb.c:1.41	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/alpha/tlsb/tlsb.c	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: tlsb.c,v 1.41 2021/08/07 16:18:41 thorpej Exp $ */
+/* $NetBSD: tlsb.c,v 1.42 2024/03/06 13:37:35 thorpej Exp $ */
 /*
  * Copyright (c) 1997 by Matthew Jacob
  * NASA AMES Research Center.
@@ -39,7 +39,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.41 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.42 2024/03/06 13:37:35 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -70,7 +70,7 @@ CFATTACH_DECL_NEW(tlsb, 0,
 extern struct cfdriver tlsb_cd;
 
 static int	tlsbprint(void *, const char *);
-static const char *tlsb_node_type_str(uint32_t);
+static const char *tlsb_node_type_str(uint32_t, char *, size_t);
 
 /*
  * There can be only one TurboLaser, and we'll overload it
@@ -87,13 +87,15 @@ static int
 tlsbprint(void *aux, const char *pnp)
 {
 	struct tlsb_dev_attach_args *tap = aux;
+	char buf[64];
 
 	if (pnp)
 		aprint_normal("%s at %s node %d",
-		tlsb_node_type_str(tap->ta_dtype), pnp, tap->ta_node);
+		tlsb_node_type_str(tap->ta_dtype, buf, sizeof(buf)),
+		pnp, tap->ta_node);
 	else
 		aprint_normal(" node %d: %s", tap->ta_node,
-		tlsb_node_type_str(tap->ta_dtype));
+		tlsb_node_type_str(tap->ta_dtype, buf, sizeof(buf)));
 
 	return (UNCONF);
 }
@@ -124,7 +126,9 @@ tlsbattach(device_t parent, device_t sel
 	struct tlsb_dev_attach_args ta;
 	uint32_t tldev;
 	int node;
+	int ionodes = 0;
 	int locs[TLSBCF_NLOCS];
+	char buf[64];
 
 	printf("\n");
 
@@ -158,9 +162,11 @@ tlsbattach(device_t parent, device_t sel
 		 * 

CVS commit: src/sys/arch/alpha

2024-03-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 13:37:35 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/tlsb: tlsb.c tlsbvar.h

Log Message:
Tidy up TLSB autoconfiguration just a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/tlsb/tlsb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/tlsb/tlsbvar.h

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



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:34:11 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module.  The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/gbus/mcclock_gbus.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/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:34:11 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module.  The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/gbus/mcclock_gbus.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/alpha/mcclock.c
diff -u src/sys/arch/alpha/alpha/mcclock.c:1.22 src/sys/arch/alpha/alpha/mcclock.c:1.23
--- src/sys/arch/alpha/alpha/mcclock.c:1.22	Wed Mar  6 06:30:48 2024
+++ src/sys/arch/alpha/alpha/mcclock.c	Wed Mar  6 07:34:11 2024
@@ -1,4 +1,33 @@
-/* $NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $ */
+/* $NetBSD: mcclock.c,v 1.23 2024/03/06 07:34:11 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,9 +58,10 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.23 2024/03/06 07:34:11 thorpej Exp $");
 
 #include "opt_clock_compat_osf1.h"
+#include "opt_multiprocessor.h"
 
 #include 
 #include 
@@ -40,6 +70,9 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 
 #include 
 #include 
 #include 
+#if defined(MULTIPROCESSOR)
+#include 
+#endif
 
 #include 
 
@@ -64,18 +97,95 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 
 #define UNIX_YEAR_OFFSET 0
 #endif
 
-
 static void mcclock_set_pcc_freq(struct mc146818_softc *);
 static void mcclock_init(void *);
 
+#if defined(MULTIPROCESSOR)
+struct mcclock_trampoline_arg {
+	todr_chip_handle_t	handle;	/* IN */
+	struct clock_ymdhms	*dt;	/* IN */
+	int			rv;	/* OUT */
+};
+
+static void
+mcclock_trampoline(void *arg1, void *arg2)
+{
+	int (*func)(todr_chip_handle_t, struct clock_ymdhms *) = arg1;
+	struct mcclock_trampoline_arg *arg = arg2;
+
+	arg->rv = (*func)(arg->handle, arg->dt);
+}
+
+static int
+mcclock_bounce(int (*func)(todr_chip_handle_t, struct clock_ymdhms *),
+struct mcclock_trampoline_arg *arg)
+{
+	/*
+	 * If we're not on the primary CPU, then we need to make
+	 * a cross-call to the primary to access the clock registers.
+	 * But we do a little work to avoid even calling into the
+	 * cross-call code if we can avoid it.
+	 */
+	int bound = curlwp_bind();
+
+	if (CPU_IS_PRIMARY(curcpu())) {
+		mcclock_trampoline(func, arg);
+		curlwp_bindx(bound);
+	} else {
+		curlwp_bindx(bound);
+		uint64_t token = xc_unicast(0, mcclock_trampoline

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

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:22:45 UTC 2024

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

Log Message:
Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/alpha/alpha/cpu.c

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



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

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:22:45 UTC 2024

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

Log Message:
Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/alpha/alpha/cpu.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/cpu.c
diff -u src/sys/arch/alpha/alpha/cpu.c:1.107 src/sys/arch/alpha/alpha/cpu.c:1.108
--- src/sys/arch/alpha/alpha/cpu.c:1.107	Sun May 22 11:27:33 2022
+++ src/sys/arch/alpha/alpha/cpu.c	Wed Mar  6 07:22:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.107 2022/05/22 11:27:33 andvar Exp $ */
+/* $NetBSD: cpu.c,v 1.108 2024/03/06 07:22:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.107 2022/05/22 11:27:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.108 2024/03/06 07:22:45 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -82,7 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10
 #include 
 
 struct cpu_info cpu_info_primary __cacheline_aligned = {
-	.ci_curlwp = 
+	.ci_curlwp = ,
+	.ci_flags  = CPUF_PRIMARY|CPUF_RUNNING,
 };
 struct cpu_info *cpu_info_list __read_mostly = _info_primary;
 
@@ -450,7 +451,8 @@ cpuattach(device_t parent, device_t self
 	if (primary) {
 		cpu_announce_extensions(ci);
 #if defined(MULTIPROCESSOR)
-		ci->ci_flags |= CPUF_PRIMARY|CPUF_RUNNING;
+		KASSERT(ci->ci_flags & CPUF_PRIMARY);
+		KASSERT(ci->ci_flags & CPUF_RUNNING);
 		atomic_or_ulong(_booted, (1UL << ma->ma_slot));
 		atomic_or_ulong(_running, (1UL << ma->ma_slot));
 #endif /* MULTIPROCESSOR */



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 06:30:49 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c
src/sys/arch/alpha/isa: mcclock_isa.c
src/sys/arch/alpha/jensenio: mcclock_jensenio.c
src/sys/arch/alpha/tc: mcclock_ioasic.c

Log Message:
Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/isa/mcclock_isa.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/jensenio/mcclock_jensenio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/tc/mcclock_ioasic.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/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 06:30:49 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c
src/sys/arch/alpha/isa: mcclock_isa.c
src/sys/arch/alpha/jensenio: mcclock_jensenio.c
src/sys/arch/alpha/tc: mcclock_ioasic.c

Log Message:
Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/isa/mcclock_isa.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/jensenio/mcclock_jensenio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/tc/mcclock_ioasic.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/alpha/mcclock.c
diff -u src/sys/arch/alpha/alpha/mcclock.c:1.21 src/sys/arch/alpha/alpha/mcclock.c:1.22
--- src/sys/arch/alpha/alpha/mcclock.c:1.21	Thu Oct  1 07:21:36 2020
+++ src/sys/arch/alpha/alpha/mcclock.c	Wed Mar  6 06:30:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock.c,v 1.21 2020/10/01 07:21:36 skrll Exp $ */
+/* $NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.21 2020/10/01 07:21:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $");
 
 #include "opt_clock_compat_osf1.h"
 
@@ -69,8 +69,9 @@ static void mcclock_set_pcc_freq(struct 
 static void mcclock_init(void *);
 
 void
-mcclock_attach(struct mc146818_softc *sc)
+mcclock_attach(struct mcclock_softc *msc)
 {
+	struct mc146818_softc *sc = >sc_mc146818;
 
 	sc->sc_year0 = 1900 + UNIX_YEAR_OFFSET;
 	sc->sc_flag = 0;	/* BINARY, 24HR */

Index: src/sys/arch/alpha/alpha/mcclockvar.h
diff -u src/sys/arch/alpha/alpha/mcclockvar.h:1.5 src/sys/arch/alpha/alpha/mcclockvar.h:1.6
--- src/sys/arch/alpha/alpha/mcclockvar.h:1.5	Sat Jul 21 11:59:56 2007
+++ src/sys/arch/alpha/alpha/mcclockvar.h	Wed Mar  6 06:30:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclockvar.h,v 1.5 2007/07/21 11:59:56 tsutsui Exp $ */
+/* $NetBSD: mcclockvar.h,v 1.6 2024/03/06 06:30:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -27,4 +27,13 @@
  * rights to redistribute these changes.
  */
 
-void mcclock_attach(struct mc146818_softc *);
+#ifndef _ALPHA_ALPHA_MCCLOCKVAR_H_
+#define	_ALPHA_ALPHA_MCCLOCKVAR_H_
+
+struct mcclock_softc {
+	struct mc146818_softc	sc_mc146818;
+};
+
+void	mcclock_attach(struct mcclock_softc *);
+
+#endif /* _ALPHA_ALPHA_MCCLOCKVAR_H_ */

Index: src/sys/arch/alpha/gbus/mcclock_gbus.c
diff -u src/sys/arch/alpha/gbus/mcclock_gbus.c:1.3 src/sys/arch/alpha/gbus/mcclock_gbus.c:1.4
--- src/sys/arch/alpha/gbus/mcclock_gbus.c:1.3	Wed Mar  6 05:44:44 2024
+++ src/sys/arch/alpha/gbus/mcclock_gbus.c	Wed Mar  6 06:30:49 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $ */
+/* $NetBSD: mcclock_gbus.c,v 1.4 2024/03/06 06:30:49 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.4 2024/03/06 06:30:49 thorpej Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
 static int	mcclock_gbus_match(device_t, cfdata_t, void *);
 static void	mcclock_gbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mc146818_softc),
+CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_softc),
 mcclock_gbus_match, mcclock_gbus_attach, NULL, NULL);
 
 static void	mcclock_gbus_write(struct mc146818_softc *, u_int, u_int);
@@ -74,7 +74,8 @@ mcclock_gbus_match(device_t parent, cfda
 static void
 mcclock_gbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mc146818_softc *sc = device_private(self);
+	struct mcclock_softc *msc = device_private(self);
+	struct mc146818_softc *sc = >sc_mc146818;
 	struct gbus_attach_args *ga = aux;
 
 	sc->sc_dev = self;
@@ -88,7 +89,7 @@ mcclock_gbus_attach(device_t parent, dev
 	sc->sc_mcread  = mcclock_gbus_read;
 	sc->sc_mcwrite = mcclock_gbus_write;
 
-	mcclock_attach(sc);
+	mcclock_attach(msc);
 }
 
 static void

Index: src/sys/arch/alpha/isa/mcclock_isa.c
diff -u src/sys/arch/alpha/isa/mcclock_isa.c:1.21 src/sys/arch/alpha/isa/mcclock_isa.c:1.22
--- src/sys/arch/alpha/isa/mcclock_isa.c:1.21	Fri May  7 16:58:33 2021
+++ 

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

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:44:44 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
bus_space-ify.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/gbus/mcclock_gbus.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/gbus/mcclock_gbus.c
diff -u src/sys/arch/alpha/gbus/mcclock_gbus.c:1.2 src/sys/arch/alpha/gbus/mcclock_gbus.c:1.3
--- src/sys/arch/alpha/gbus/mcclock_gbus.c:1.2	Sat Mar  2 22:58:29 2024
+++ src/sys/arch/alpha/gbus/mcclock_gbus.c	Wed Mar  6 05:44:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $ */
+/* $NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $");
 
 #include 
 #include 
@@ -43,8 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
 
 #include 
 
-#include 		/* XXX */
-
 #include 
 
 #include 
@@ -54,27 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
 
 #include "ioconf.h"
 
-#define	KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
-/*
- * Registers are 64 bytes apart (and 1 byte wide)
- */
-#define	REGSHIFT	6
-
-struct mcclock_gbus_softc {
-	struct mc146818_softc	sc_mc146818;
-	unsigned long regbase;
-};
-
 static int	mcclock_gbus_match(device_t, cfdata_t, void *);
 static void	mcclock_gbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_gbus_softc),
+CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mc146818_softc),
 mcclock_gbus_match, mcclock_gbus_attach, NULL, NULL);
 
 static void	mcclock_gbus_write(struct mc146818_softc *, u_int, u_int);
 static u_int	mcclock_gbus_read(struct mc146818_softc *, u_int);
 
-
 static int
 mcclock_gbus_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -88,14 +74,17 @@ mcclock_gbus_match(device_t parent, cfda
 static void
 mcclock_gbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mcclock_gbus_softc *tsc = device_private(self);
+	struct mc146818_softc *sc = device_private(self);
 	struct gbus_attach_args *ga = aux;
-	struct mc146818_softc *sc = >sc_mc146818;
-
-	/* XXX Should be bus.h'd, so we can accommodate the kn7aa. */
-	tsc->regbase = TLSB_GBUS_BASE + ga->ga_offset;
 
 	sc->sc_dev = self;
+	sc->sc_bst = ga->ga_iot;
+
+	if (bus_space_map(sc->sc_bst, ga->ga_offset, MC_NREGS+MC_NVRAM_SIZE,
+			  0, >sc_bsh) != 0) {
+		panic("mcclock_gbus_attach: couldn't map clock I/O space");
+	}
+
 	sc->sc_mcread  = mcclock_gbus_read;
 	sc->sc_mcwrite = mcclock_gbus_write;
 
@@ -105,19 +94,11 @@ mcclock_gbus_attach(device_t parent, dev
 static void
 mcclock_gbus_write(struct mc146818_softc *sc, u_int reg, u_int val)
 {
-	struct mcclock_gbus_softc *tsc = (void *)sc;
-	unsigned char *ptr = (unsigned char *)
-		KV(tsc->regbase + (reg << REGSHIFT));
-
-	*ptr = val;
+	bus_space_write_1(sc->sc_bst, sc->sc_bsh, reg, (uint8_t)val);
 }
 
 static u_int
 mcclock_gbus_read(struct mc146818_softc *sc, u_int reg)
 {
-	struct mcclock_gbus_softc *tsc = (void *)sc;
-	unsigned char *ptr = (unsigned char *)
-		KV(tsc->regbase + (reg << REGSHIFT));
-
-	return *ptr;
+	return bus_space_read_1(sc->sc_bst, sc->sc_bsh, reg);
 }



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

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:44:44 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
bus_space-ify.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/gbus/mcclock_gbus.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/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:33:09 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
src/sys/arch/alpha/gbus: gbus.c gbusvar.h
Added Files:
src/sys/arch/alpha/gbus: gbus_io.c

Log Message:
Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus_io.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/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.196 src/sys/arch/alpha/conf/files.alpha:1.197
--- src/sys/arch/alpha/conf/files.alpha:1.196	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/conf/files.alpha	Wed Mar  6 05:33:09 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.196 2024/03/02 20:15:33 thorpej Exp $
+# $NetBSD: files.alpha,v 1.197 2024/03/06 05:33:09 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -104,6 +104,7 @@ file	arch/alpha/tlsb/tlsbmem.c	tlsbmem
 device	gbus { offset = -1 }
 attach	gbus at tlsb
 file	arch/alpha/gbus/gbus.c		gbus
+file	arch/alpha/gbus/gbus_io.c	gbus
 
 #
 # MCBUS support

Index: src/sys/arch/alpha/gbus/gbus.c
diff -u src/sys/arch/alpha/gbus/gbus.c:1.1 src/sys/arch/alpha/gbus/gbus.c:1.2
--- src/sys/arch/alpha/gbus/gbus.c:1.1	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/gbus/gbus.c	Wed Mar  6 05:33:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+/* $NetBSD: gbus.c,v 1.2 2024/03/06 05:33:09 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -37,7 +37,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.2 2024/03/06 05:33:09 thorpej Exp $");
 
 #include 
 #include 
@@ -70,10 +70,10 @@ CFATTACH_DECL_NEW(gbus, sizeof(struct gb
 static int	gbusprint(void *, const char *);
 
 static const struct gbus_attach_args gbus_children[] = {
-	{ "zsc",	GBUS_DUART0_OFFSET },
-	{ "zsc",	GBUS_DUART1_OFFSET },
-	{ "mcclock",	GBUS_CLOCK_OFFSET },
-	{ NULL,		0 },
+	{ "zsc",	NULL,	GBUS_DUART0_OFFSET },
+	{ "zsc",	NULL,	GBUS_DUART1_OFFSET },
+	{ "mcclock",	NULL,	GBUS_CLOCK_OFFSET },
+	{ NULL,		NULL,	0 },
 };
 
 static int
@@ -113,6 +113,7 @@ gbusattach(device_t parent, device_t sel
 	struct gbus_softc *sc = device_private(self);
 	struct tlsb_dev_attach_args *ta = aux;
 	const struct gbus_attach_args *ga;
+	bus_space_tag_t iot = gbus_io_init(TLSB_GBUS_BASE);
 	int locs[GBUSCF_NLOCS];
 
 	aprint_normal("\n");
@@ -123,6 +124,7 @@ gbusattach(device_t parent, device_t sel
 	/* Attach the children. */
 	for (ga = gbus_children; ga->ga_name != NULL; ga++) {
 		struct gbus_attach_args gaa = *ga;
+		gaa.ga_iot = iot;
 		locs[GBUSCF_OFFSET] = gaa.ga_offset;
 		config_found(self, , gbusprint,
 		CFARGS(.submatch = config_stdsubmatch,
Index: src/sys/arch/alpha/gbus/gbusvar.h
diff -u src/sys/arch/alpha/gbus/gbusvar.h:1.1 src/sys/arch/alpha/gbus/gbusvar.h:1.2
--- src/sys/arch/alpha/gbus/gbusvar.h:1.1	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/gbus/gbusvar.h	Wed Mar  6 05:33:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: gbusvar.h,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+/* $NetBSD: gbusvar.h,v 1.2 2024/03/06 05:33:09 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,6 +30,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _ALPHA_GBUS_GBUSVAR_H_
+#define	_ALPHA_GBUS_GBUSVAR_H_
+
 /*
  * Autoconfiguration definitions for the Gbus found on TurboLaser CPU modules.
  */
@@ -37,6 +40,11 @@
 #include 
 
 struct gbus_attach_args {
-	const char *ga_name;		/* name of device */
-	bus_addr_t  ga_offset;		/* offset from Gbus base */
+	const char *	ga_name;	/* name of device */
+	bus_space_tag_t	ga_iot;		/* I/O space tag */
+	bus_addr_t	ga_offset;	/* offset from Gbus base */
 };
+
+bus_space_tag_t	gbus_io_init(paddr_t);
+
+#endif /* _ALPHA_GBUS_GBUSVAR_H_ */

Added files:

Index: src/sys/arch/alpha/gbus/gbus_io.c
diff -u /dev/null src/sys/arch/alpha/gbus/gbus_io.c:1.1
--- /dev/null	Wed Mar  6 05:33:10 2024
+++ src/sys/arch/alpha/gbus/gbus_io.c	Wed Mar  6 05:33:09 2024
@@ -0,0 +1,177 @@
+/* $NetBSD: gbus_io.c,v 1.1 2024/03/06 05:33:09 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redi

CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:33:09 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
src/sys/arch/alpha/gbus: gbus.c gbusvar.h
Added Files:
src/sys/arch/alpha/gbus: gbus_io.c

Log Message:
Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus_io.c

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



CVS commit: src/sys/dev/ic

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 02:31:44 UTC 2024

Modified Files:
src/sys/dev/ic: mc146818.c mc146818var.h

Log Message:
Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override
these function pointers in the TODR handle, allowing the front-end to
wrap mc146818_{get,set}time_ymdhms() with special handling, if needed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.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/mc146818.c
diff -u src/sys/dev/ic/mc146818.c:1.20 src/sys/dev/ic/mc146818.c:1.21
--- src/sys/dev/ic/mc146818.c:1.20	Wed Jan  1 19:24:03 2020
+++ src/sys/dev/ic/mc146818.c	Wed Mar  6 02:31:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $	*/
+/*	$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $");
 
 #include 
 #include 
@@ -43,9 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: mc146818.c,v
 #include 
 #include 
 
-int mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
-int mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
-
 void
 mc146818_attach(struct mc146818_softc *sc)
 {
@@ -61,11 +58,14 @@ mc146818_attach(struct mc146818_softc *s
 
 	handle = >sc_handle;
 	handle->cookie = sc;
-	handle->todr_gettime = NULL;
-	handle->todr_settime = NULL;
-	handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms;
-	handle->todr_settime_ymdhms = mc146818_settime_ymdhms;
-	handle->todr_setwen  = NULL;
+	KASSERT(handle->todr_gettime == NULL);
+	KASSERT(handle->todr_settime == NULL);
+	if (handle->todr_gettime_ymdhms == NULL) {
+		handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms;
+	}
+	if (handle->todr_settime_ymdhms == NULL) {
+		handle->todr_settime_ymdhms = mc146818_settime_ymdhms;
+	}
 
 	todr_attach(handle);
 }
@@ -103,7 +103,7 @@ mc146818_gettime_ymdhms(todr_chip_handle
 	dt->dt_wday = FROMREG((*sc->sc_mcread)(sc, MC_DOW));
 	dt->dt_day  = FROMREG((*sc->sc_mcread)(sc, MC_DOM));
 	dt->dt_mon  = FROMREG((*sc->sc_mcread)(sc, MC_MONTH));
-	year   = FROMREG((*sc->sc_mcread)(sc, MC_YEAR));
+	year= FROMREG((*sc->sc_mcread)(sc, MC_YEAR));
 	if (sc->sc_getcent) {
 		cent = (*sc->sc_getcent)(sc);
 		year += cent * 100;

Index: src/sys/dev/ic/mc146818var.h
diff -u src/sys/dev/ic/mc146818var.h:1.7 src/sys/dev/ic/mc146818var.h:1.8
--- src/sys/dev/ic/mc146818var.h:1.7	Wed May 14 13:29:29 2008
+++ src/sys/dev/ic/mc146818var.h	Wed Mar  6 02:31:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mc146818var.h,v 1.7 2008/05/14 13:29:29 tsutsui Exp $	*/
+/*	$NetBSD: mc146818var.h,v 1.8 2024/03/06 02:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -24,6 +24,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _DEV_IC_MC146818VAR_H_
+#define	_DEV_IC_MC146818VAR_H_
+
 struct mc146818_softc {
 	device_t sc_dev;
 
@@ -45,4 +48,8 @@ struct mc146818_softc {
 	void (*sc_setcent)(struct mc146818_softc *, u_int);
 };
 
-void mc146818_attach(struct mc146818_softc *);
+void	mc146818_attach(struct mc146818_softc *);
+int	mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+int	mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+
+#endif /* _DEV_IC_MC146818VAR_H_ */



CVS commit: src/sys/dev/ic

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 02:31:44 UTC 2024

Modified Files:
src/sys/dev/ic: mc146818.c mc146818var.h

Log Message:
Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override
these function pointers in the TODR handle, allowing the front-end to
wrap mc146818_{get,set}time_ymdhms() with special handling, if needed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.h

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



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 20:59:41 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Revert previous until I can diagnose a failure reported by gson.


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/kern/init_main.c
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.53 -r1.54 src/sys/sys/cpu.h

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



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 20:59:41 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Revert previous until I can diagnose a failure reported by gson.


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/kern/init_main.c
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.53 -r1.54 src/sys/sys/cpu.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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.548 src/sys/kern/init_main.c:1.549
--- src/sys/kern/init_main.c:1.548	Tue Mar  5 14:39:29 2024
+++ src/sys/kern/init_main.c	Tue Mar  5 20:59:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $	*/
+/*	$NetBSD: init_main.c,v 1.549 2024/03/05 20:59:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2023 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.549 2024/03/05 20:59:41 thorpej Exp $");
 
 #include "opt_cnmagic.h"
 #include "opt_ddb.h"
@@ -275,8 +275,7 @@ main(void)
 #ifdef DIAGNOSTIC
 	/*
 	 * Verify that CPU_INFO_FOREACH() knows about the boot CPU
-	 * and only the boot CPU at this point.  The boot CPU should
-	 * also be marked PRIMARY.
+	 * and only the boot CPU at this point.
 	 */
 	int cpucount = 0;
 	for (CPU_INFO_FOREACH(cii, ci)) {
@@ -284,12 +283,8 @@ main(void)
 		cpucount++;
 	}
 	KASSERT(cpucount == 1);
-	KASSERT(CPU_IS_PRIMARY(curcpu()));
 #endif
 
-	/* Stash a pointer to the boot CPU for quick reference wheen needed. */
-	boot_cpu = curcpu();
-
 	l = 
 #ifndef LWP0_CPU_INFO
 	l->l_cpu = curcpu();

Index: src/sys/kern/subr_cpu.c
diff -u src/sys/kern/subr_cpu.c:1.21 src/sys/kern/subr_cpu.c:1.22
--- src/sys/kern/subr_cpu.c:1.21	Tue Mar  5 14:39:29 2024
+++ src/sys/kern/subr_cpu.c	Tue Mar  5 20:59:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $	*/
+/*	$NetBSD: subr_cpu.c,v 1.22 2024/03/05 20:59:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.22 2024/03/05 20:59:41 thorpej Exp $");
 
 #include 
 #include 
@@ -86,9 +86,6 @@ int64_t		cpu_counts[CPU_COUNT_MAX];
 /* An array of CPUs.  There are ncpu entries. */
 struct cpu_info **cpu_infos		__read_mostly;
 
-/* A pointer to the boot CPU, for quick reference when needed. */
-struct cpu_info *boot_cpu		__read_mostly;
-
 /* Note: set on mi_cpu_attach() and idle_loop(). */
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;

Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.53 src/sys/sys/cpu.h:1.54
--- src/sys/sys/cpu.h:1.53	Tue Mar  5 14:39:29 2024
+++ src/sys/sys/cpu.h	Tue Mar  5 20:59:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.53 2024/03/05 14:39:29 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.54 2024/03/05 20:59:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -100,7 +100,6 @@ void	cpu_topology_init(void);
 extern kmutex_t cpu_lock;
 extern u_int maxcpus;
 extern struct cpu_info **cpu_infos;
-extern struct cpu_info *boot_cpu;
 extern kcpuset_t *kcpuset_attached;
 extern kcpuset_t *kcpuset_running;
 



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:39:30 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Early in main(), assert that curcpu() evaluates as the primary CPU and
stash away a pointer to it as the boot CPU for quick reference later.


To generate a diff of this commit:
cvs rdiff -u -r1.547 -r1.548 src/sys/kern/init_main.c
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.52 -r1.53 src/sys/sys/cpu.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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.547 src/sys/kern/init_main.c:1.548
--- src/sys/kern/init_main.c:1.547	Wed Jan 17 10:18:41 2024
+++ src/sys/kern/init_main.c	Tue Mar  5 14:39:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.547 2024/01/17 10:18:41 hannken Exp $	*/
+/*	$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2023 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.547 2024/01/17 10:18:41 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $");
 
 #include "opt_cnmagic.h"
 #include "opt_ddb.h"
@@ -275,7 +275,8 @@ main(void)
 #ifdef DIAGNOSTIC
 	/*
 	 * Verify that CPU_INFO_FOREACH() knows about the boot CPU
-	 * and only the boot CPU at this point.
+	 * and only the boot CPU at this point.  The boot CPU should
+	 * also be marked PRIMARY.
 	 */
 	int cpucount = 0;
 	for (CPU_INFO_FOREACH(cii, ci)) {
@@ -283,8 +284,12 @@ main(void)
 		cpucount++;
 	}
 	KASSERT(cpucount == 1);
+	KASSERT(CPU_IS_PRIMARY(curcpu()));
 #endif
 
+	/* Stash a pointer to the boot CPU for quick reference wheen needed. */
+	boot_cpu = curcpu();
+
 	l = 
 #ifndef LWP0_CPU_INFO
 	l->l_cpu = curcpu();

Index: src/sys/kern/subr_cpu.c
diff -u src/sys/kern/subr_cpu.c:1.20 src/sys/kern/subr_cpu.c:1.21
--- src/sys/kern/subr_cpu.c:1.20	Thu Jan  4 11:18:19 2024
+++ src/sys/kern/subr_cpu.c	Tue Mar  5 14:39:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $	*/
+/*	$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $");
 
 #include 
 #include 
@@ -86,6 +86,9 @@ int64_t		cpu_counts[CPU_COUNT_MAX];
 /* An array of CPUs.  There are ncpu entries. */
 struct cpu_info **cpu_infos		__read_mostly;
 
+/* A pointer to the boot CPU, for quick reference when needed. */
+struct cpu_info *boot_cpu		__read_mostly;
+
 /* Note: set on mi_cpu_attach() and idle_loop(). */
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;

Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.52 src/sys/sys/cpu.h:1.53
--- src/sys/sys/cpu.h:1.52	Sat Jul  8 13:59:05 2023
+++ src/sys/sys/cpu.h	Tue Mar  5 14:39:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.52 2023/07/08 13:59:05 riastradh Exp $	*/
+/*	$NetBSD: cpu.h,v 1.53 2024/03/05 14:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -100,6 +100,7 @@ void	cpu_topology_init(void);
 extern kmutex_t cpu_lock;
 extern u_int maxcpus;
 extern struct cpu_info **cpu_infos;
+extern struct cpu_info *boot_cpu;
 extern kcpuset_t *kcpuset_attached;
 extern kcpuset_t *kcpuset_running;
 



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:39:30 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Early in main(), assert that curcpu() evaluates as the primary CPU and
stash away a pointer to it as the boot CPU for quick reference later.


To generate a diff of this commit:
cvs rdiff -u -r1.547 -r1.548 src/sys/kern/init_main.c
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.52 -r1.53 src/sys/sys/cpu.h

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



CVS commit: src/sys/uvm

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:33:50 UTC 2024

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

Log Message:
Rename the local "boot_cpu" variable to "uvm_boot_cpu".


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/uvm/uvm_page.c

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



CVS commit: src/sys/uvm

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:33:50 UTC 2024

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

Log Message:
Rename the local "boot_cpu" variable to "uvm_boot_cpu".


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/uvm/uvm_page.c

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

Modified files:

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.255 src/sys/uvm/uvm_page.c:1.256
--- src/sys/uvm/uvm_page.c:1.255	Sat Feb 10 09:24:18 2024
+++ src/sys/uvm/uvm_page.c	Tue Mar  5 14:33:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.255 2024/02/10 09:24:18 andvar Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.256 2024/03/05 14:33:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.255 2024/02/10 09:24:18 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.256 2024/03/05 14:33:50 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -328,7 +328,7 @@ uvm_page_init_bucket(struct pgfreelist *
 void
 uvm_page_init(vaddr_t *kvm_startp, vaddr_t *kvm_endp)
 {
-	static struct uvm_cpu boot_cpu __cacheline_aligned;
+	static struct uvm_cpu uvm_boot_cpu __cacheline_aligned;
 	psize_t freepages, pagecount, bucketsize, n;
 	struct pgflbucket *pgb;
 	struct vm_page *pagearray;
@@ -344,7 +344,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr
 	 * structures).
 	 */
 
-	curcpu()->ci_data.cpu_uvm = _cpu;
+	curcpu()->ci_data.cpu_uvm = _boot_cpu;
 	uvmpdpol_init();
 	for (b = 0; b < __arraycount(uvm_freelist_locks); b++) {
 		mutex_init(_freelist_locks[b].lock, MUTEX_DEFAULT, IPL_VM);



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:15:36 UTC 2024

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_reboot.c
src/sys/arch/algor/algor: machdep.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/amiga/amiga: machdep.c
src/sys/arch/amigappc/amigappc: machdep.c
src/sys/arch/amigappc/include: autoconf.h
src/sys/arch/arc/arc: machdep.c
src/sys/arch/arm/arm32: arm32_machdep.c
src/sys/arch/atari/atari: machdep.c
src/sys/arch/bebox/bebox: machdep.c
src/sys/arch/cesfic/cesfic: machdep.c
src/sys/arch/cobalt/cobalt: machdep.c
src/sys/arch/dreamcast/dreamcast: machdep.c
src/sys/arch/emips/emips: machdep.c
src/sys/arch/evbarm/imx23_olinuxino: imx23_olinuxino_machdep.c
src/sys/arch/evbmips/adm5120: machdep.c
src/sys/arch/evbmips/alchemy: machdep.c
src/sys/arch/evbmips/atheros: machdep.c
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/evbmips/gdium: machdep.c
src/sys/arch/evbmips/ingenic: machdep.c
src/sys/arch/evbmips/loongson: machdep.c
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/evbmips/mipssim: machdep.c
src/sys/arch/evbmips/rasoc: machdep.c
src/sys/arch/evbmips/rmixl: machdep.c
src/sys/arch/evbmips/sbmips: machdep.c
src/sys/arch/evbppc/ev64260: machdep.c
src/sys/arch/evbppc/pmppc: machdep.c
src/sys/arch/evbppc/wii: machdep.c
src/sys/arch/ews4800mips/ews4800mips: machdep.c
src/sys/arch/hp300/hp300: machdep.c
src/sys/arch/hpcmips/hpcmips: machdep.c
src/sys/arch/hpcsh/hpcsh: machdep.c
src/sys/arch/hppa/hppa: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/arch/ibmnws/ibmnws: machdep.c
src/sys/arch/landisk/landisk: machdep.c
src/sys/arch/luna68k/luna68k: machdep.c
src/sys/arch/macppc/macppc: machdep.c
src/sys/arch/mipsco/mipsco: machdep.c
src/sys/arch/mvme68k/mvme68k: machdep.c
src/sys/arch/mvmeppc/mvmeppc: machdep.c
src/sys/arch/news68k/news68k: machdep.c
src/sys/arch/newsmips/newsmips: machdep.c
src/sys/arch/next68k/next68k: machdep.c
src/sys/arch/ofppc/include: autoconf.h
src/sys/arch/ofppc/ofppc: machdep.c
src/sys/arch/playstation2/playstation2: machdep.c
src/sys/arch/pmax/pmax: machdep.c
src/sys/arch/powerpc/booke: booke_machdep.c
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c
src/sys/arch/prep/prep: machdep.c
src/sys/arch/riscv/riscv: riscv_machdep.c
src/sys/arch/rs6000/include: autoconf.h
src/sys/arch/sandpoint/sandpoint: machdep.c
src/sys/arch/sbmips/sbmips: machdep.c
src/sys/arch/sgimips/sgimips: machdep.c
src/sys/arch/sparc/sparc: machdep.c
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/arch/vax/vax: machdep.c
src/sys/arch/virt68k/virt68k: machdep.c
src/sys/arch/zaurus/zaurus: machdep.c
src/sys/kern: kern_reboot.c

Log Message:
Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/aarch64_reboot.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/algor/algor/machdep.c
cvs rdiff -u -r1.377 -r1.378 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.367 -r1.368 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.254 -r1.255 src/sys/arch/amiga/amiga/machdep.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amigappc/amigappc/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amigappc/include/autoconf.h
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/bebox/bebox/machdep.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/cesfic/cesfic/machdep.c
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/cobalt/cobalt/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/dreamcast/dreamcast/machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/emips/emips/machdep.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/adm5120/machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbmips/alchemy/machdep.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbmips/atheros/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbmips/gdium/machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbmips/ingenic/machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/loongson/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/mipssim/machdep.c
cvs 

CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:15:36 UTC 2024

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_reboot.c
src/sys/arch/algor/algor: machdep.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/amiga/amiga: machdep.c
src/sys/arch/amigappc/amigappc: machdep.c
src/sys/arch/amigappc/include: autoconf.h
src/sys/arch/arc/arc: machdep.c
src/sys/arch/arm/arm32: arm32_machdep.c
src/sys/arch/atari/atari: machdep.c
src/sys/arch/bebox/bebox: machdep.c
src/sys/arch/cesfic/cesfic: machdep.c
src/sys/arch/cobalt/cobalt: machdep.c
src/sys/arch/dreamcast/dreamcast: machdep.c
src/sys/arch/emips/emips: machdep.c
src/sys/arch/evbarm/imx23_olinuxino: imx23_olinuxino_machdep.c
src/sys/arch/evbmips/adm5120: machdep.c
src/sys/arch/evbmips/alchemy: machdep.c
src/sys/arch/evbmips/atheros: machdep.c
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/evbmips/gdium: machdep.c
src/sys/arch/evbmips/ingenic: machdep.c
src/sys/arch/evbmips/loongson: machdep.c
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/evbmips/mipssim: machdep.c
src/sys/arch/evbmips/rasoc: machdep.c
src/sys/arch/evbmips/rmixl: machdep.c
src/sys/arch/evbmips/sbmips: machdep.c
src/sys/arch/evbppc/ev64260: machdep.c
src/sys/arch/evbppc/pmppc: machdep.c
src/sys/arch/evbppc/wii: machdep.c
src/sys/arch/ews4800mips/ews4800mips: machdep.c
src/sys/arch/hp300/hp300: machdep.c
src/sys/arch/hpcmips/hpcmips: machdep.c
src/sys/arch/hpcsh/hpcsh: machdep.c
src/sys/arch/hppa/hppa: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/arch/ibmnws/ibmnws: machdep.c
src/sys/arch/landisk/landisk: machdep.c
src/sys/arch/luna68k/luna68k: machdep.c
src/sys/arch/macppc/macppc: machdep.c
src/sys/arch/mipsco/mipsco: machdep.c
src/sys/arch/mvme68k/mvme68k: machdep.c
src/sys/arch/mvmeppc/mvmeppc: machdep.c
src/sys/arch/news68k/news68k: machdep.c
src/sys/arch/newsmips/newsmips: machdep.c
src/sys/arch/next68k/next68k: machdep.c
src/sys/arch/ofppc/include: autoconf.h
src/sys/arch/ofppc/ofppc: machdep.c
src/sys/arch/playstation2/playstation2: machdep.c
src/sys/arch/pmax/pmax: machdep.c
src/sys/arch/powerpc/booke: booke_machdep.c
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c
src/sys/arch/prep/prep: machdep.c
src/sys/arch/riscv/riscv: riscv_machdep.c
src/sys/arch/rs6000/include: autoconf.h
src/sys/arch/sandpoint/sandpoint: machdep.c
src/sys/arch/sbmips/sbmips: machdep.c
src/sys/arch/sgimips/sgimips: machdep.c
src/sys/arch/sparc/sparc: machdep.c
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/arch/vax/vax: machdep.c
src/sys/arch/virt68k/virt68k: machdep.c
src/sys/arch/zaurus/zaurus: machdep.c
src/sys/kern: kern_reboot.c

Log Message:
Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/aarch64_reboot.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/algor/algor/machdep.c
cvs rdiff -u -r1.377 -r1.378 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.367 -r1.368 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.254 -r1.255 src/sys/arch/amiga/amiga/machdep.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amigappc/amigappc/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amigappc/include/autoconf.h
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/bebox/bebox/machdep.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/cesfic/cesfic/machdep.c
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/cobalt/cobalt/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/dreamcast/dreamcast/machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/emips/emips/machdep.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/adm5120/machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbmips/alchemy/machdep.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbmips/atheros/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbmips/gdium/machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbmips/ingenic/machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/loongson/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/mipssim/machdep.c
cvs 

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

2024-03-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  3 19:56:30 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: prom.c

Log Message:
prom_uses_prom_console() needs to consider ST_DEC_7000, as well.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/prom.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/alpha/alpha

2024-03-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  3 19:56:30 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: prom.c

Log Message:
prom_uses_prom_console() needs to consider ST_DEC_7000, as well.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/prom.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/alpha/prom.c
diff -u src/sys/arch/alpha/alpha/prom.c:1.58 src/sys/arch/alpha/alpha/prom.c:1.59
--- src/sys/arch/alpha/alpha/prom.c:1.58	Sat Oct  3 17:31:46 2020
+++ src/sys/arch/alpha/alpha/prom.c	Sun Mar  3 19:56:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.58 2020/10/03 17:31:46 thorpej Exp $ */
+/* $NetBSD: prom.c,v 1.59 2024/03/03 19:56:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
@@ -27,7 +27,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.58 2020/10/03 17:31:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.59 2024/03/03 19:56:29 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -89,7 +89,7 @@ bool
 prom_uses_prom_console(void)
 {
 #ifdef _PROM_MAY_USE_PROM_CONSOLE
-	return (cputype == ST_DEC_21000);
+	return (cputype == ST_DEC_7000 || cputype == ST_DEC_21000);
 #else
 	return false;
 #endif



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

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 22:58:29 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
tlsb -> gbus.  No functional change.


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

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 22:58:29 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
tlsb -> gbus.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/mcclock_gbus.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/gbus/mcclock_gbus.c
diff -u src/sys/arch/alpha/gbus/mcclock_gbus.c:1.1 src/sys/arch/alpha/gbus/mcclock_gbus.c:1.2
--- src/sys/arch/alpha/gbus/mcclock_gbus.c:1.1	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/gbus/mcclock_gbus.c	Sat Mar  2 22:58:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock_gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+/* $NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $");
 
 #include 
 #include 
@@ -60,23 +60,23 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
  */
 #define	REGSHIFT	6
 
-struct mcclock_tlsb_softc {
+struct mcclock_gbus_softc {
 	struct mc146818_softc	sc_mc146818;
 	unsigned long regbase;
 };
 
-static int	mcclock_tlsb_match(device_t, cfdata_t, void *);
-static void	mcclock_tlsb_attach(device_t, device_t, void *);
+static int	mcclock_gbus_match(device_t, cfdata_t, void *);
+static void	mcclock_gbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_tlsb_softc),
-mcclock_tlsb_match, mcclock_tlsb_attach, NULL, NULL);
+CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_gbus_softc),
+mcclock_gbus_match, mcclock_gbus_attach, NULL, NULL);
 
-static void	mcclock_tlsb_write(struct mc146818_softc *, u_int, u_int);
-static u_int	mcclock_tlsb_read(struct mc146818_softc *, u_int);
+static void	mcclock_gbus_write(struct mc146818_softc *, u_int, u_int);
+static u_int	mcclock_gbus_read(struct mc146818_softc *, u_int);
 
 
 static int
-mcclock_tlsb_match(device_t parent, cfdata_t cf, void *aux)
+mcclock_gbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct gbus_attach_args *ga = aux;
 
@@ -86,9 +86,9 @@ mcclock_tlsb_match(device_t parent, cfda
 }
 
 static void
-mcclock_tlsb_attach(device_t parent, device_t self, void *aux)
+mcclock_gbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mcclock_tlsb_softc *tsc = device_private(self);
+	struct mcclock_gbus_softc *tsc = device_private(self);
 	struct gbus_attach_args *ga = aux;
 	struct mc146818_softc *sc = >sc_mc146818;
 
@@ -96,16 +96,16 @@ mcclock_tlsb_attach(device_t parent, dev
 	tsc->regbase = TLSB_GBUS_BASE + ga->ga_offset;
 
 	sc->sc_dev = self;
-	sc->sc_mcread  = mcclock_tlsb_read;
-	sc->sc_mcwrite = mcclock_tlsb_write;
+	sc->sc_mcread  = mcclock_gbus_read;
+	sc->sc_mcwrite = mcclock_gbus_write;
 
 	mcclock_attach(sc);
 }
 
 static void
-mcclock_tlsb_write(struct mc146818_softc *sc, u_int reg, u_int val)
+mcclock_gbus_write(struct mc146818_softc *sc, u_int reg, u_int val)
 {
-	struct mcclock_tlsb_softc *tsc = (void *)sc;
+	struct mcclock_gbus_softc *tsc = (void *)sc;
 	unsigned char *ptr = (unsigned char *)
 		KV(tsc->regbase + (reg << REGSHIFT));
 
@@ -113,9 +113,9 @@ mcclock_tlsb_write(struct mc146818_softc
 }
 
 static u_int
-mcclock_tlsb_read(struct mc146818_softc *sc, u_int reg)
+mcclock_gbus_read(struct mc146818_softc *sc, u_int reg)
 {
-	struct mcclock_tlsb_softc *tsc = (void *)sc;
+	struct mcclock_gbus_softc *tsc = (void *)sc;
 	unsigned char *ptr = (unsigned char *)
 		KV(tsc->regbase + (reg << REGSHIFT));
 



CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 20:15:33 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: cpuconf.c
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/include: prom.h
Added Files:
src/sys/arch/alpha/alpha: dec_kn7aa.c

Log Message:
Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 1.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/cpuconf.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/alpha/dec_kn7aa.c
cvs rdiff -u -r1.419 -r1.420 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/include/prom.h

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



CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
57 2024
+++ src/sys/arch/alpha/conf/files.alpha	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.195 2024/03/02 19:57:57 thorpej Exp $
+# $NetBSD: files.alpha,v 1.196 2024/03/02 20:15:33 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -19,6 +19,7 @@ defflag		DEC_AXPPCI_33	# NoName:	AXPpci3
 defflag		DEC_EB164	# EB164:	AlphaPC 164
 defflag		DEC_EB64PLUS	# EB64+:	AlphaPC 64, etc.
 defflag		DEC_KN20AA	# KN20AA:	AlphaStation 500 and 600
+defflag		DEC_KN7AA	# KN7AA:	DEC 7000 and 1
 defflag		DEC_KN8AE	# KN8AE:	AlphaServer 8200 and 8400
 defflag		DEC_KN300	# KN300:	AlphaServer 4X00
 defflag		DEC_1000	# Mikasa etc:	AlphaServer 1000
@@ -416,6 +417,7 @@ file	arch/alpha/alpha/dec_eb164.c		dec_e
 file	arch/alpha/alpha/dec_eb64plus.c		dec_eb64plus
 file	arch/alpha/alpha/dec_eb66.c		dec_eb66
 file	arch/alpha/alpha/dec_kn20aa.c		dec_kn20aa
+file	arch/alpha/alpha/dec_kn7aa.c		dec_kn7aa
 file	arch/alpha/alpha/dec_kn8ae.c		dec_kn8ae
 file	arch/alpha/alpha/dec_kn300.c		dec_kn300
 file	arch/alpha/alpha/api_up1000.c		api_up1000

Index: src/sys/arch/alpha/include/prom.h
diff -u src/sys/arch/alpha/include/prom.h:1.16 src/sys/arch/alpha/include/prom.h:1.17
--- src/sys/arch/alpha/include/prom.h:1.16	Sat Oct  3 17:31:46 2020
+++ src/sys/arch/alpha/include/prom.h	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.h,v 1.16 2020/10/03 17:31:46 thorpej Exp $ */
+/* $NetBSD: prom.h,v 1.17 2024/03/02 20:15:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -121,10 +121,11 @@ void	hwrpb_restart_setup(void);
 #ifdef _KERNEL
 
 #ifdef _KERNEL_OPT
+#include "opt_dec_kn7aa.h"
 #include "opt_dec_kn8ae.h"
 
-#if defined(DEC_KN8AE)
-#define _PROM_MAY_USE_PROM_CONSOLE
+#if defined(DEC_KN7AA) || defined(DEC_KN8AE)
+#define _PROM_MAY_USE_PROM_CONSOLE	/* XXX */
 #endif /* DEC_KN8AE */
 #endif /* _KERNEL_OPT */
 

Added files:

Index: src/sys/arch/alpha/alpha/dec_kn7aa.c
diff -u /dev/null src/sys/arch/alpha/alpha/dec_kn7aa.c:1.1
--- /dev/null	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/alpha/dec_kn7aa.c	Sat Mar  2 20:15:33 2024
@@ -0,0 +1,84 @@
+/* $NetBSD: dec_kn7aa.c,v 1.1 2024/03/02 20:15:33 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 			/* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: dec_kn7aa.c,v 1.1 2024/03/02 20:15:33 thorpej Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+void		dec_kn7aa_init(void);
+void		dec_kn7aa_cons_init(void);
+static void	dec_kn7aa_device_register(device_t, void *);
+
+const struct alpha_variation_table dec_kn7aa_variations[] = {
+	{ 0, "DEC 7000" },
+	{ 1, "DEC 1" },
+	{ 0, NULL },
+};
+
+void
+dec_kn7aa_init(void)
+{
+	uint64_t variation;
+
+	platform.family = "KN7AA (\"Ruby\")";
+
+	if ((platform.model = alpha_dsr_sysname()) == NULL) {
+		variation = hwrpb->rpb_variation & SV_ST_MASK;
+		if ((platform.model = alpha_variation_name(variation,
+		dec_kn7aa_variations)) == NULL)
+			platform.model = alpha_unknown_sysname();
+	}
+
+	platform.iobus = "lsb";
+	platform.cons_init = dec_kn7aa_cons_init;
+	platform.device_register = dec_kn7aa_device_register;
+}
+
+void
+dec_kn7aa_cons_init(void)
+{
+}
+
+static void
+dec_kn7aa_device_register(device_t dev, void *aux)
+{
+}



CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
 OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Autoconfiguration and support routines for the Gbus: the internal
+ * bus on AlphaServer CPU modules.
+ */
+
+#include 			/* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "locators.h"
+
+#define KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
+
+struct gbus_softc {
+	device_t	sc_dev;
+	int		sc_tlsbnode;	/* node on the TurboLaser */
+};
+
+static int	gbusmatch(device_t, cfdata_t, void *);
+static void	gbusattach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(gbus, sizeof(struct gbus_softc),
+gbusmatch, gbusattach, NULL, NULL);
+
+static int	gbusprint(void *, const char *);
+
+static const struct gbus_attach_args gbus_children[] = {
+	{ "zsc",	GBUS_DUART0_OFFSET },
+	{ "zsc",	GBUS_DUART1_OFFSET },
+	{ "mcclock",	GBUS_CLOCK_OFFSET },
+	{ NULL,		0 },
+};
+
+static int
+gbusprint(void *aux, const char *pnp)
+{
+	struct gbus_attach_args *ga = aux;
+
+	if (pnp)
+		aprint_normal("%s at %s", ga->ga_name, pnp);
+	aprint_normal(" offset 0x%lx", ga->ga_offset);
+	return (UNCONF);
+}
+
+static int
+gbusmatch(device_t parent, cfdata_t cf, void *aux)
+{
+	struct tlsb_dev_attach_args *ta = aux;
+
+	/*
+	 * Make sure we're looking for a Gbus.  The Gbus only
+	 * "exists" on the CPU module that holds the primary CPU.
+	 *
+	 * Compute which node this should exist on by dividing the
+	 * primary CPU by 2 (since there are up to 2 CPUs per CPU
+	 * module).
+	 */
+	if (TLDEV_ISCPU(ta->ta_dtype) &&
+	ta->ta_node == (hwrpb->rpb_primary_cpu_id / 2))
+		return (1);
+
+	return (0);
+}
+
+static void
+gbusattach(device_t parent, device_t self, void *aux)
+{
+	struct gbus_softc *sc = device_private(self);
+	struct tlsb_dev_attach_args *ta = aux;
+	const struct gbus_attach_args *ga;
+	int locs[GBUSCF_NLOCS];
+
+	aprint_normal("\n");
+
+	sc->sc_dev = self;
+	sc->sc_tlsbnode = ta->ta_node;
+
+	/* Attach the children. */
+	for (ga = gbus_children; ga->ga_name != NULL; ga++) {
+		struct gbus_attach_args gaa = *ga;
+		locs[GBUSCF_OFFSET] = gaa.ga_offset;
+		config_found(self, , gbusprint,
+		CFARGS(.submatch = config_stdsubmatch,
+			   .locators = locs));
+	}
+}
Index: src/sys/arch/alpha/gbus/gbusreg.h
diff -u /dev/null src/sys/arch/alpha/gbus/gbusreg.h:1.1
--- /dev/null	Sat Mar  2 19:57:58 2024
+++ src/sys/arch/alpha/gbus/gbusreg.h	Sat Mar  2 19:57:57 2024
@@ -0,0 +1,39 @@
+/* $NetBSD: gbusreg.h,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Register definitions for the Gbus found on TurboLaser CPU modules.
+ */
+
+#define GBUS_DUART0_OFFSET	0x1000		/* duart 0 */
+#define GBUS_DUART1_OFFSET	0x1100		/* duart 1 */
+#define GBUS_CLOCK_OFFSET	0x2000		/* clock */
Index: src/sys/arch/alpha/gbus/gbusvar.h
diff -u /dev/null src/sys/arch/alpha/gbus/gbusvar.h:1.1
--- /dev/null	Sat Mar  2 19:57:58 2024
+++ src/sys/arch/alpha/gbus/gbusvar.h	Sat Mar  2 19:57:57 2024
@@ -0,0 +1,42 @@
+/* $NetBSD: gbusvar.h,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc

CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 19:57:58 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
Added Files:
src/sys/arch/alpha/gbus: gbus.c gbusreg.h gbusvar.h mcclock_gbus.c
Removed Files:
src/sys/arch/alpha/tlsb: gbus.c gbusreg.h gbusvar.h mcclock_tlsb.c

Log Message:
Shuffle GBus-related files into their own directory in preparation for
other GBus attachments.  No functional change here; just minimal editing
to reflect path differences after moving the files.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusreg.h src/sys/arch/alpha/gbus/gbusvar.h \
src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.25 -r0 src/sys/arch/alpha/tlsb/gbus.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/alpha/tlsb/gbusreg.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/alpha/tlsb/gbusvar.h
cvs rdiff -u -r1.18 -r0 src/sys/arch/alpha/tlsb/mcclock_tlsb.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/evbcf/include

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:07:08 UTC 2024

Modified Files:
src/sys/arch/evbcf/include: cpu.h

Log Message:
Revert the CLOCK_FORMAT0 work-around.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbcf/include/cpu.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/evbcf/include/cpu.h
diff -u src/sys/arch/evbcf/include/cpu.h:1.10 src/sys/arch/evbcf/include/cpu.h:1.11
--- src/sys/arch/evbcf/include/cpu.h:1.10	Tue Feb 27 16:07:02 2024
+++ src/sys/arch/evbcf/include/cpu.h	Wed Feb 28 13:07:07 2024
@@ -1,7 +1,3 @@
-/*	$NetBSD: cpu.h,v 1.10 2024/02/27 16:07:02 nat Exp $	*/
-
-#ifndef CLOCK_FORMAT0
-#define CLOCK_FORMAT0
-#endif
+/*	$NetBSD: cpu.h,v 1.11 2024/02/28 13:07:07 thorpej Exp $	*/
 
 #include 



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

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:07:08 UTC 2024

Modified Files:
src/sys/arch/evbcf/include: cpu.h

Log Message:
Revert the CLOCK_FORMAT0 work-around.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbcf/include/cpu.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

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:05:40 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h
src/sys/arch/mac68k/dev: adb_direct.c
src/sys/arch/mac68k/include: cpu.h intr.h
src/sys/arch/mac68k/mac68k: intr.c locore.s via.c

Log Message:
Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around.  As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mac68k/dev/adb_direct.c
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/include/intr.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/mac68k/mac68k/via.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/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.24 src/sys/arch/m68k/include/cpu.h:1.25
--- src/sys/arch/m68k/include/cpu.h:1.24	Tue Feb 27 16:07:02 2024
+++ src/sys/arch/m68k/include/cpu.h	Wed Feb 28 13:05:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.24 2024/02/27 16:07:02 nat Exp $	*/
+/*	$NetBSD: cpu.h,v 1.25 2024/02/28 13:05:39 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -149,10 +149,8 @@ void	cpu_proc_fork(struct proc *, struct
  * what the interrupt stub puts on the stack before calling C code.
  */
 struct clockframe {
-#ifndef CLOCK_FORMAT0
 	/* regs saved on the stack by the interrupt stub */
 	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
-#endif
 	/* hardware frame */
 	u_short	cf_sr;		/* sr at time of interrupt */
 	u_long	cf_pc;		/* pc at time of interrupt */

Index: src/sys/arch/mac68k/dev/adb_direct.c
diff -u src/sys/arch/mac68k/dev/adb_direct.c:1.70 src/sys/arch/mac68k/dev/adb_direct.c:1.71
--- src/sys/arch/mac68k/dev/adb_direct.c:1.70	Fri Feb  9 18:20:00 2024
+++ src/sys/arch/mac68k/dev/adb_direct.c	Wed Feb 28 13:05:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_direct.c,v 1.70 2024/02/09 18:20:00 andvar Exp $	*/
+/*	$NetBSD: adb_direct.c,v 1.71 2024/02/28 13:05:39 thorpej Exp $	*/
 
 /* From: adb_direct.c 2.02 4/18/97 jpw */
 
@@ -62,7 +62,7 @@
 #ifdef __NetBSD__
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_direct.c,v 1.70 2024/02/09 18:20:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_direct.c,v 1.71 2024/02/28 13:05:39 thorpej Exp $");
 
 #include "opt_adb.h"
 
@@ -78,6 +78,8 @@ __KERNEL_RCSID(0, "$NetBSD: adb_direct.c
 #include 			/* required for adbvar.h */
 #include 			/* required for IOP support */
 
+#include 
+
 #include 
 #include 
 #define printf_intr printf
@@ -353,6 +355,17 @@ print_single(u_char *str)
 }
 #endif
 
+static inline void
+adb_process_serial_intrs(void)
+{
+	/* grab any serial interrupts (autovector IPL 4) */
+	struct clockframe dummy_frame = {
+		.cf_sr = PSL_S,
+		.cf_vo = VECI_TO_VECO(VECI_INTRAV4),
+	};
+	(void)intr_dispatch(dummy_frame);
+}
+
 void
 adb_cuda_tickle(void)
 {
@@ -720,7 +733,7 @@ adb_intr_II(void *arg)
 
 	delay(ADB_DELAY);	/* yuck (don't remove) */
 
-	(void)intr_dispatch(0x70); /* grab any serial interrupts */
+	adb_process_serial_intrs();
 
 	if (ADB_INTR_IS_ON)
 		intr_on = 1;	/* save for later */
@@ -768,7 +781,7 @@ switch_start:
 			adbActionState = ADB_ACTION_IN;
 		}
 		delay(ADB_DELAY);
-		(void)intr_dispatch(0x70); /* grab any serial interrupts */
+		adb_process_serial_intrs();
 		goto switch_start;
 		break;
 	case ADB_ACTION_IDLE:
@@ -1262,7 +1275,7 @@ switch_start:
 		ADB_SET_STATE_ACKON();	/* start ACK to ADB chip */
 		delay(ADB_DELAY);	/* delay */
 		ADB_SET_STATE_ACKOFF();	/* end ACK to ADB chip */
-		(void)intr_dispatch(0x70); /* grab any serial interrupts */
+		adb_process_serial_intrs();
 		break;
 
 	case ADB_ACTION_IN:
@@ -1276,7 +1289,7 @@ switch_start:
 		ADB_SET_STATE_ACKON();	/* start ACK to ADB chip */
 		delay(ADB_DELAY);	/* delay */
 		ADB_SET_STATE_ACKOFF();	/* end ACK to ADB chip */
-		(void)intr_dispatch(0x70); /* grab any serial interrupts */
+		adb_process_serial_intrs();
 
 		if (1 == ending) {	/* end of message? */
 			ADB_SET_STATE_INACTIVE();	/* signal end of frame */
@@ -1323,7 +1336,7 @@ switch_start:
 adbActionState = ADB_ACTION_OUT;	/* set next state */
 
 delay(ADB_DELAY);	/* delay */
-(void)intr_dispatch(0x70); /* grab any serial interrupts */
+adb_process_serial_intrs();
 
 if (ADB_INTR_IS_ON) {	/* ADB intr low during
 			 * write */
@@ -1364,13 +1377,13 @@ switch_start:
 			adbWriteDelay = 1;	/* must retry when done with
 		 * read */
 			delay(ADB_DELAY);	/* delay */
-			(void)intr_dispatch(0x70); /* grab any serial interrupts */
+			adb_process_serial_intrs();

CVS commit: src/sys/arch

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:05:40 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h
src/sys/arch/mac68k/dev: adb_direct.c
src/sys/arch/mac68k/include: cpu.h intr.h
src/sys/arch/mac68k/mac68k: intr.c locore.s via.c

Log Message:
Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around.  As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mac68k/dev/adb_direct.c
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/include/intr.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/mac68k/mac68k/via.c

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



CVS commit: src/sys/dev/spi

2024-02-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 23 23:45:54 UTC 2024

Modified Files:
src/sys/dev/spi: spivar.h

Log Message:
Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA.  Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/spi/spivar.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/spi/spivar.h
diff -u src/sys/dev/spi/spivar.h:1.12 src/sys/dev/spi/spivar.h:1.13
--- src/sys/dev/spi/spivar.h:1.12	Wed Jan 19 13:33:11 2022
+++ src/sys/dev/spi/spivar.h	Fri Feb 23 23:45:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: spivar.h,v 1.12 2022/01/19 13:33:11 thorpej Exp $ */
+/* $NetBSD: spivar.h,v 1.13 2024/02/23 23:45:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -55,16 +55,24 @@
 struct spi_handle;
 struct spi_transfer;
 
+#define	SPI_MODE_CPHA	__BIT(0)
+#define	SPI_MODE_CPOL	__BIT(1)
+
 /*
  * De facto standard latching modes.
  */
-#define	SPI_MODE_0	0	/* CPOL = 0, CPHA = 0 */
-#define	SPI_MODE_1	1	/* CPOL = 0, CPHA = 1 */
-#define	SPI_MODE_2	2	/* CPOL = 1, CPHA = 0 */
-#define	SPI_MODE_3	3	/* CPOL = 1, CPHA = 1 */
+#define	SPI_MODE_0	0
+#define	SPI_MODE_1	SPI_MODE_CPHA
+#define	SPI_MODE_2	SPI_MODE_CPOL
+#define	SPI_MODE_3	(SPI_MODE_CPHA | SPI_MODE_CPOL)
+
 /* Philips' Microwire is just Mode 0 */
 #define	SPI_MODE_MICROWIRE	SPI_MODE_0
 
+/* SPI transfer speed helper macros -- converts to Hz for spi_configure(). */
+#define	SPI_FREQ_kHz(x)	((x) * 1000)
+#define	SPI_FREQ_MHz(x)	((x) * 100)
+
 struct spi_controller {
 	void	*sct_cookie;	/* controller private data */
 	int	sct_nslaves;



CVS commit: src/sys/dev/spi

2024-02-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 23 23:45:54 UTC 2024

Modified Files:
src/sys/dev/spi: spivar.h

Log Message:
Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA.  Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/spi/spivar.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/sun

2024-02-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 13:46:14 UTC 2024

Modified Files:
src/sys/dev/sun: sireg.h

Log Message:
Add the Sun3 obio flavor's DMA controller access registers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sun/sireg.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/sun

2024-02-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 13:46:14 UTC 2024

Modified Files:
src/sys/dev/sun: sireg.h

Log Message:
Add the Sun3 obio flavor's DMA controller access registers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sun/sireg.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/sun/sireg.h
diff -u src/sys/dev/sun/sireg.h:1.1 src/sys/dev/sun/sireg.h:1.2
--- src/sys/dev/sun/sireg.h:1.1	Tue Feb 13 05:35:13 2024
+++ src/sys/dev/sun/sireg.h	Tue Feb 13 13:46:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sireg.h,v 1.1 2024/02/13 05:35:13 thorpej Exp $	*/
+/*	$NetBSD: sireg.h,v 1.2 2024/02/13 13:46:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -54,7 +54,9 @@ struct si_regs {
 	u_short	dma_counth;	/* DMA count   (VME only) */
 	u_short	dma_countl;	/* (high word, low word)  */
 
-	u_int	pad0;		/* no-existent register */
+	/* AMD 9516 regs (OBIO only) see am9516.h */
+	u_short udc_data;	/* Am9516, reg data (OBIO only) */
+	u_short udc_addr;	/* Am9516, reg addr (OBIO only) */
 
 	u_short	fifo_data;	/* fifo data register */
 	u_short	fifo_count;	/* fifo count register */
@@ -83,6 +85,8 @@ struct si_regs {
 #define SIREG_DMA_ADDRL	(NCR5380REGS_SZ + 2)	/* DMA address, low word */
 #define SIREG_DMA_CNTH	(NCR5380REGS_SZ + 4)	/* DMA count, high word */
 #define SIREG_DMA_CNTL	(NCR5380REGS_SZ + 6)	/* DMA count, low word */
+#define SIREG_UDC_DATA	(NCR5380REGS_SZ + 8)	/* UDC reg data */
+#define SIREG_UDC_ADDR	(NCR5380REGS_SZ + 10)	/* UDC reg addr */
 #define SIREG_FIFO_DATA	(NCR5380REGS_SZ + 12)	/* FIFO data */
 #define SIREG_FIFO_CNT	(NCR5380REGS_SZ + 14)	/* FIFO count, low word */
 #define SIREG_CSR	(NCR5380REGS_SZ + 16)	/* Control/status register */



CVS commit: src/sys/dev

2024-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 05:35:13 UTC 2024

Modified Files:
src/sys/dev/vme: si.c
Added Files:
src/sys/dev/sun: sireg.h
Removed Files:
src/sys/dev/vme: sireg.h

Log Message:
Move sireg.h from vme/ to sun/ -- the same (or nearly so) register defns
are used by multiple bus attachments.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/sun/sireg.h
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/vme/si.c
cvs rdiff -u -r1.4 -r0 src/sys/dev/vme/sireg.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/vme/si.c
diff -u src/sys/dev/vme/si.c:1.24 src/sys/dev/vme/si.c:1.25
--- src/sys/dev/vme/si.c:1.24	Sun Nov 10 21:16:38 2019
+++ src/sys/dev/vme/si.c	Tue Feb 13 05:35:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: si.c,v 1.24 2019/11/10 21:16:38 chs Exp $	*/
+/*	$NetBSD: si.c,v 1.25 2024/02/13 05:35:13 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996,2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: si.c,v 1.24 2019/11/10 21:16:38 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: si.c,v 1.25 2024/02/13 05:35:13 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: si.c,v 1.24 
 #include 
 #include 
 
-#include 
+#include 
 
 /*
  * Transfers smaller than this are done using PIO

Added files:

Index: src/sys/dev/sun/sireg.h
diff -u /dev/null src/sys/dev/sun/sireg.h:1.1
--- /dev/null	Tue Feb 13 05:35:13 2024
+++ src/sys/dev/sun/sireg.h	Tue Feb 13 05:35:13 2024
@@ -0,0 +1,129 @@
+/*	$NetBSD: sireg.h,v 1.1 2024/02/13 05:35:13 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Register map for the VME SCSI-3 adapter (si)
+ * The first part of this register map is an NCR5380
+ * SCSI Bus Interface Controller (SBIC).  The rest is a
+ * DMA controller and custom logic.
+ */
+
+
+#if __for_reference_only__
+/*
+ * Am5380 Register map (no padding). See dev/ic/ncr5380reg.h
+ */
+struct ncr5380regs {
+	u_char r[8];
+};
+
+struct si_regs {
+	struct ncr5380regs sci;
+
+	/* DMA controller registers */
+	u_short	dma_addrh;	/* DMA address (VME only) */
+	u_short	dma_addrl;	/* (high word, low word)  */
+	u_short	dma_counth;	/* DMA count   (VME only) */
+	u_short	dma_countl;	/* (high word, low word)  */
+
+	u_int	pad0;		/* no-existent register */
+
+	u_short	fifo_data;	/* fifo data register */
+	u_short	fifo_count;	/* fifo count register */
+	u_short	si_csr;		/* si control/status */
+	u_short	bprh;		/* VME byte pack high */
+	u_short	bprl;		/* VME byte pack low */
+	u_short	iv_am;		/* bits 0-7: intr vector */
+/* bits 8-13: addr modifier (VME only) */
+/* bits 14-15: unused */
+	u_short	fifo_cnt_hi;	/* high part of fifo_count (VME only) */
+
+	/* Whole thing repeats after 32 bytes. */
+	u_short	_space[3];
+};
+#endif
+
+/*
+ * Size of NCR5380 registers located at the bottom of the register bank
+ */
+#define NCR5380REGS_SZ	8
+
+/*
+ * Register definition for the `si' VME controller
+ */
+#define SIREG_DMA_ADDRH	(NCR5380REGS_SZ + 0)	/* DMA address, high word */
+#define SIREG_DMA_ADDRL	(NCR5380REGS_SZ + 2)	/* DMA address, low word */
+#define SIREG_DMA_CNTH	(NCR5380REGS_SZ + 4)	/* DMA count, high word */
+#define SIREG_DMA_CNTL	(NCR5380REGS_SZ + 6)	/* DMA count, low word */
+#define SIREG_FIFO_DATA	(NCR5380REGS_SZ + 12)	/* FIFO data */
+#define SIREG_FIFO_CNT	(NCR5380REGS_SZ + 14)	/* FIFO count, low word */
+#define 

CVS commit: src/sys/dev

2024-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 05:35:13 UTC 2024

Modified Files:
src/sys/dev/vme: si.c
Added Files:
src/sys/dev/sun: sireg.h
Removed Files:
src/sys/dev/vme: sireg.h

Log Message:
Move sireg.h from vme/ to sun/ -- the same (or nearly so) register defns
are used by multiple bus attachments.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/sun/sireg.h
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/vme/si.c
cvs rdiff -u -r1.4 -r0 src/sys/dev/vme/sireg.h

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



  1   2   3   4   5   6   7   8   9   10   >