CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 05:53:40 UTC 2021

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

Log Message:
make: remove unnecessary assignment in Job_Start, clean up comments


To generate a diff of this commit:
cvs rdiff -u -r1.417 -r1.418 src/usr.bin/make/job.c

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.417 src/usr.bin/make/job.c:1.418
--- src/usr.bin/make/job.c:1.417	Fri Feb  5 05:15:12 2021
+++ src/usr.bin/make/job.c	Fri Feb  5 05:53:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.417 2021/02/05 05:15:12 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.418 2021/02/05 05:53:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.417 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.418 2021/02/05 05:53:40 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1666,31 +1666,25 @@ JobStart(GNode *gn, Boolean special)
 	(!opts.noExecute && !opts.touchFlag)) {
 		/*
 		 * The above condition looks very similar to
-		 * GNode_ShouldExecute but is subtly different.
-		 * It prevents that .MAKE targets are touched.
+		 * GNode_ShouldExecute but is subtly different.  It prevents
+		 * that .MAKE targets are touched since these are usually
+		 * virtual targets.
 		 */
 
 		JobWriteShellCommands(job, gn, cmdsOK, );
 		(void)fflush(job->cmdFILE);
 	} else if (!GNode_ShouldExecute(gn)) {
 		/*
-		 * Not executing anything -- just print all the commands to
-		 * stdout in one fell swoop. This will still set up
-		 * job->tailCmds correctly.
+		 * Just print all the commands to stdout in one fell swoop.
+		 * This still sets up job->tailCmds correctly.
 		 */
 		SwitchOutputTo(gn);
 		job->cmdFILE = stdout;
 		if (cmdsOK)
 			JobPrintCommands(job);
-		/* Don't execute the shell, thank you. */
 		run = FALSE;
 		(void)fflush(job->cmdFILE);
 	} else {
-		/*
-		 * Just touch the target and note that no shell should be
-		 * executed. Set cmdFILE to stdout to make life easier.
-		 */
-		job->cmdFILE = stdout;
 		Job_Touch(gn, job->echo);
 		run = FALSE;
 	}



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 05:48:19 UTC 2021

Modified Files:
src/usr.bin/make: dir.c dir.h

Log Message:
make: add const to SearchPath_Print


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/usr.bin/make/dir.c
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/make/dir.h

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

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.269 src/usr.bin/make/dir.c:1.270
--- src/usr.bin/make/dir.c:1.269	Fri Feb  5 04:41:17 2021
+++ src/usr.bin/make/dir.c	Fri Feb  5 05:48:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.269 2021/02/05 04:41:17 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.270 2021/02/05 05:48:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.269 2021/02/05 04:41:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.270 2021/02/05 05:48:19 rillig Exp $");
 
 /*
  * A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -1719,7 +1719,7 @@ Dir_PrintDirectories(void)
 }
 
 void
-SearchPath_Print(SearchPath *path)
+SearchPath_Print(const SearchPath *path)
 {
 	SearchPathNode *ln;
 

Index: src/usr.bin/make/dir.h
diff -u src/usr.bin/make/dir.h:1.42 src/usr.bin/make/dir.h:1.43
--- src/usr.bin/make/dir.h:1.42	Sat Jan 23 11:34:41 2021
+++ src/usr.bin/make/dir.h	Fri Feb  5 05:48:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.h,v 1.42 2021/01/23 11:34:41 rillig Exp $	*/
+/*	$NetBSD: dir.h,v 1.43 2021/02/05 05:48:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,7 +92,7 @@ char *SearchPath_ToFlags(SearchPath *, c
 void SearchPath_Clear(SearchPath *);
 void SearchPath_AddAll(SearchPath *, SearchPath *);
 void Dir_PrintDirectories(void);
-void SearchPath_Print(SearchPath *);
+void SearchPath_Print(const SearchPath *);
 SearchPath *Dir_CopyDirSearchPath(void);
 
 /* Stripped-down variant of struct stat. */



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 05:46:27 UTC 2021

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

Log Message:
make: clean up a few comments in parse.c


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.548 src/usr.bin/make/parse.c:1.549
--- src/usr.bin/make/parse.c:1.548	Fri Feb  5 05:15:12 2021
+++ src/usr.bin/make/parse.c	Fri Feb  5 05:46:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.548 2021/02/05 05:15:12 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.549 2021/02/05 05:46:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.548 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.549 2021/02/05 05:46:27 rillig Exp $");
 
 /* types and constants */
 
@@ -247,8 +247,8 @@ CurFile(void)
 }
 
 /* include paths */
-SearchPath *parseIncPath;	/* dirs for "..." includes */
-SearchPath *sysIncPath;		/* dirs for <...> includes */
+SearchPath *parseIncPath;	/* directories for "..." includes */
+SearchPath *sysIncPath;		/* directories for <...> includes */
 SearchPath *defSysIncPath;	/* default for sysIncPath */
 
 /* parser tables */
@@ -681,7 +681,7 @@ Parse_Error(ParseErrorLevel type, const 
 
 
 /*
- * Parse and handle a .info, .warning or .error directive.
+ * Parse and handle an .info, .warning or .error directive.
  * For an .error directive, immediately exit.
  */
 static void
@@ -872,11 +872,9 @@ static void
 ParseDependencySourceMain(const char *src)
 {
 	/*
-	 * In a line like ".MAIN: source1 source2", it means we need to add
-	 * the sources of said target to the list of things to create.
-	 *
-	 * Note that this will only be invoked if the user didn't specify a
-	 * target on the command line and the .MAIN occurs for the first time.
+	 * In a line like ".MAIN: source1 source2", add all sources to the
+	 * list of things to create, but only if the user didn't specify a
+	 * target on the command line and .MAIN occurs for the first time.
 	 *
 	 * See ParseDoDependencyTargetSpecial, branch SP_MAIN.
 	 * See unit-tests/cond-func-make-main.mk.
@@ -923,12 +921,11 @@ ParseDependencySourceOther(const char *s
 	GNode *gn;
 
 	/*
-	 * If the source is not an attribute, we need to find/create
-	 * a node for it. After that we can apply any operator to it
-	 * from a special target or link it to its parents, as
-	 * appropriate.
+	 * The source is not an attribute, so find/create a node for it.
+	 * After that, apply any operator to it from a special target or
+	 * link it to its parents, as appropriate.
 	 *
-	 * In the case of a source that was the object of a :: operator,
+	 * In the case of a source that was the object of a '::' operator,
 	 * the attribute is applied to all of its instances (as kept in
 	 * the 'cohorts' list of the node) or all the cohorts are linked
 	 * to all the targets.



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 05:42:39 UTC 2021

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

Log Message:
make: improve documentation about variable scopes

In an experiment, I tried to separate the concepts of a GNode and a
variable scope.  The global variables SCOPE_GLOBAL, SCOPE_INTERNAL and
SCOPE_CMDLINE are implemented as GNode even though they only need the
members 'name' and 'vars'.  All their other members are unused.
Therefore it seemed natural to extract this part of the GNode into a
separate type called Scope.

The resulting code was harder to read though since it had split the
namespace of the functions into several parts that were not obviously
related: The Var_ functions, the Scope_ functions, and the short-cut
Global_ functions.  Because of this, I threw away the experiment.

All that is left are a few updated comments.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/make.h
cvs rdiff -u -r1.806 -r1.807 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.254 src/usr.bin/make/make.h:1.255
--- src/usr.bin/make/make.h:1.254	Thu Feb  4 21:50:39 2021
+++ src/usr.bin/make/make.h	Fri Feb  5 05:42:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.254 2021/02/04 21:50:39 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.255 2021/02/05 05:42:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -500,7 +500,7 @@ extern GNode *defaultNode;
  * by makefiles.
  */
 extern GNode *SCOPE_INTERNAL;
-/* Variables defined in a global scope, e.g in the Makefile itself. */
+/* Variables defined in a global scope, e.g in the makefile itself. */
 extern GNode *SCOPE_GLOBAL;
 /* Variables defined on the command line. */
 extern GNode *SCOPE_CMDLINE;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.806 src/usr.bin/make/var.c:1.807
--- src/usr.bin/make/var.c:1.806	Fri Feb  5 05:19:57 2021
+++ src/usr.bin/make/var.c	Fri Feb  5 05:42:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.806 2021/02/05 05:19:57 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.807 2021/02/05 05:42:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.806 2021/02/05 05:19:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.807 2021/02/05 05:42:39 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -289,22 +289,29 @@ static char varUndefined[] = "";
 static Boolean save_dollars = TRUE;
 
 /*
- * Internally, variables are contained in four different scopes.
- *	1) the environment. They cannot be changed. If an environment
- *	   variable is appended to, the result is placed in the global
- *	   scope.
- *	2) the global scope. Variables set in the makefiles are located
- *	   here.
- *	3) the command-line scope. All variables set on the command line
- *	   are placed in this scope.
- *	4) the local scope, containing only the 7 local variables such as
- *	   '.TARGET'.
- * The four scopes are searched in the reverse order from which they are
- * listed (but see opts.checkEnvFirst).
- */
-GNode  *SCOPE_INTERNAL;	/* variables from make itself */
-GNode  *SCOPE_GLOBAL;	/* variables from the makefile */
-GNode  *SCOPE_CMDLINE;	/* variables defined on the command-line */
+ * A scope collects variable names and their values.
+ *
+ * The main scope is SCOPE_GLOBAL, which contains the variables that are set
+ * in the makefiles.  SCOPE_INTERNAL acts as a fallback for SCOPE_GLOBAL and
+ * contains some internal make variables.  These internal variables can thus
+ * be overridden, they can also be restored by undefining the overriding
+ * variable.
+ *
+ * SCOPE_CMDLINE contains variables from the command line arguments.  These
+ * override variables from SCOPE_GLOBAL.
+ *
+ * There is no scope for environment variables, these are generated on-the-fly
+ * whenever they are referenced.  If there were such a scope, each change to
+ * environment variables would have to be reflected in that scope, which may
+ * be simpler or more complex than the current implementation.
+ *
+ * Each target has its own scope, containing the 7 target-local variables
+ * .TARGET, .ALLSRC, etc.  No other variables are in these scopes.
+ */
+
+GNode *SCOPE_CMDLINE;
+GNode *SCOPE_GLOBAL;
+GNode *SCOPE_INTERNAL;
 
 ENUM_FLAGS_RTTI_6(VarFlags,
 		  VAR_IN_USE, VAR_FROM_ENV,
@@ -2379,6 +2386,10 @@ ApplyModifier_Loop(const char **pp, cons
 	ModifyWords(val, ModifyWord_Loop, , st->oneBigWord, st->sep));
 	st->sep = prev_sep;
 	/* XXX: Consider restoring the previous variable instead of deleting. */
+	/*
+	 * XXX: The variable name should not be expanded here, see
+	 * ModifyWord_Loop.
+	 */
 	Var_DeleteExpand(st->scope, args.tvar);
 	free(args.tvar);
 	free(args.str);



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 05:19:58 UTC 2021

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

Log Message:
make: rename remaining ctx to scope

One less small inconsistency.  Everywhere else, that variable had been
named ctxt, not ctx.


To generate a diff of this commit:
cvs rdiff -u -r1.805 -r1.806 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.805 src/usr.bin/make/var.c:1.806
--- src/usr.bin/make/var.c:1.805	Fri Feb  5 05:15:12 2021
+++ src/usr.bin/make/var.c	Fri Feb  5 05:19:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.805 2021/02/05 05:15:12 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.806 2021/02/05 05:19:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.805 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.806 2021/02/05 05:19:57 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -1435,7 +1435,7 @@ SysVMatch(const char *word, const char *
 }
 
 struct ModifyWord_SYSVSubstArgs {
-	GNode *ctx;
+	GNode *scope;
 	const char *lhs;
 	const char *rhs;
 };
@@ -1462,7 +1462,7 @@ ModifyWord_SYSVSubst(const char *word, S
 	 * match, but only if the lhs had a '%' as well.
 	 */
 
-	(void)Var_Subst(args->rhs, args->ctx, VARE_WANTRES, _expanded);
+	(void)Var_Subst(args->rhs, args->scope, VARE_WANTRES, _expanded);
 	/* TODO: handle errors */
 
 	rhs = rhs_expanded;
@@ -1664,7 +1664,7 @@ tryagain:
 
 
 struct ModifyWord_LoopArgs {
-	GNode *ctx;
+	GNode *scope;
 	char *tvar;		/* name of temporary variable */
 	char *str;		/* string to expand */
 	VarEvalFlags eflags;
@@ -1682,8 +1682,9 @@ ModifyWord_Loop(const char *word, SepBuf
 
 	args = data;
 	/* XXX: The variable name should not be expanded here. */
-	Var_SetExpandWithFlags(args->ctx, args->tvar, word, VAR_SET_NO_EXPORT);
-	(void)Var_Subst(args->str, args->ctx, args->eflags, );
+	Var_SetExpandWithFlags(args->scope, args->tvar, word,
+	VAR_SET_NO_EXPORT);
+	(void)Var_Subst(args->str, args->scope, args->eflags, );
 	/* TODO: handle errors */
 
 	DEBUG4(VAR, "ModifyWord_Loop: "
@@ -2353,7 +2354,7 @@ ApplyModifier_Loop(const char **pp, cons
 	char prev_sep;
 	VarParseResult res;
 
-	args.ctx = st->scope;
+	args.scope = st->scope;
 
 	(*pp)++;		/* Skip the first '@' */
 	res = ParseModifierPart(pp, '@', VARE_NONE, st, );



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 05:15:13 UTC 2021

Modified Files:
src/usr.bin/make: arch.c compat.c cond.c job.c main.c make.c meta.c
nonints.h parse.c suff.c trace.c var.c

Log Message:
make: in the Var_ functions, move the scope to the front

This change provides for a more natural reading order in the code.
Placing the scope first makes it immediately clear in which context the
remaining parameters are interpreted.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/usr.bin/make/arch.c
cvs rdiff -u -r1.223 -r1.224 src/usr.bin/make/compat.c
cvs rdiff -u -r1.255 -r1.256 src/usr.bin/make/cond.c
cvs rdiff -u -r1.416 -r1.417 src/usr.bin/make/job.c
cvs rdiff -u -r1.531 -r1.532 src/usr.bin/make/main.c
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/make.c
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/make/meta.c
cvs rdiff -u -r1.201 -r1.202 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.547 -r1.548 src/usr.bin/make/parse.c
cvs rdiff -u -r1.344 -r1.345 src/usr.bin/make/suff.c
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/trace.c
cvs rdiff -u -r1.804 -r1.805 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.196 src/usr.bin/make/arch.c:1.197
--- src/usr.bin/make/arch.c:1.196	Thu Feb  4 21:42:46 2021
+++ src/usr.bin/make/arch.c	Fri Feb  5 05:15:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.196 2021/02/04 21:42:46 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.197 2021/02/05 05:15:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.196 2021/02/04 21:42:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.197 2021/02/05 05:15:12 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -973,9 +973,9 @@ Arch_FindLib(GNode *gn, SearchPath *path
 	free(libName);
 
 #ifdef LIBRARIES
-	Var_Set(TARGET, gn->name, gn);
+	Var_Set(gn, TARGET, gn->name);
 #else
-	Var_Set(TARGET, GNode_Path(gn), gn);
+	Var_Set(gn, TARGET, GNode_Path(gn));
 #endif
 }
 

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.223 src/usr.bin/make/compat.c:1.224
--- src/usr.bin/make/compat.c:1.223	Thu Feb  4 21:42:46 2021
+++ src/usr.bin/make/compat.c	Fri Feb  5 05:15:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.223 2021/02/04 21:42:46 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.224 2021/02/05 05:15:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.223 2021/02/04 21:42:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.224 2021/02/05 05:15:12 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -509,7 +509,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 	}
 
 	if (Lst_FindDatum(>implicitParents, pgn) != NULL)
-		Var_Set(IMPSRC, GNode_VarTarget(gn), pgn);
+		Var_Set(pgn, IMPSRC, GNode_VarTarget(gn));
 
 	/*
 	 * All the children were made ok. Now youngestChild->mtime contains the
@@ -602,7 +602,7 @@ MakeOther(GNode *gn, GNode *pgn)
 
 	if (Lst_FindDatum(>implicitParents, pgn) != NULL) {
 		const char *target = GNode_VarTarget(gn);
-		Var_Set(IMPSRC, target != NULL ? target : "", pgn);
+		Var_Set(pgn, IMPSRC, target != NULL ? target : "");
 	}
 
 	switch (gn->made) {

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.255 src/usr.bin/make/cond.c:1.256
--- src/usr.bin/make/cond.c:1.255	Thu Feb  4 21:33:13 2021
+++ src/usr.bin/make/cond.c	Fri Feb  5 05:15:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.255 2021/02/04 21:33:13 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.256 2021/02/05 05:15:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.255 2021/02/04 21:33:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.256 2021/02/05 05:15:12 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -303,7 +303,7 @@ ParseFuncArg(CondParser *par, const char
 static Boolean
 FuncDefined(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
-	FStr value = Var_Value(arg, SCOPE_CMDLINE);
+	FStr value = Var_Value(SCOPE_CMDLINE, arg);
 	Boolean result = value.str != NULL;
 	FStr_Done();
 	return result;

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.416 src/usr.bin/make/job.c:1.417
--- src/usr.bin/make/job.c:1.416	Thu Feb  4 21:33:13 2021
+++ src/usr.bin/make/job.c	Fri Feb  5 05:15:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.416 2021/02/04 21:33:13 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.417 2021/02/05 05:15:12 rillig 

CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Feb  5 04:41:17 UTC 2021

Modified Files:
src/usr.bin/make: dir.c main.c nonints.h parse.c var.c

Log Message:
make: add shortcut Global_Delete for deleting a global variable


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/usr.bin/make/dir.c
cvs rdiff -u -r1.530 -r1.531 src/usr.bin/make/main.c
cvs rdiff -u -r1.200 -r1.201 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.546 -r1.547 src/usr.bin/make/parse.c
cvs rdiff -u -r1.803 -r1.804 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.268 src/usr.bin/make/dir.c:1.269
--- src/usr.bin/make/dir.c:1.268	Thu Feb  4 21:33:13 2021
+++ src/usr.bin/make/dir.c	Fri Feb  5 04:41:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.268 2021/02/04 21:33:13 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.269 2021/02/05 04:41:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.268 2021/02/04 21:33:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.269 2021/02/05 04:41:17 rillig Exp $");
 
 /*
  * A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -549,7 +549,7 @@ Dir_SetPATH(void)
 	CachedDirListNode *ln;
 	Boolean seenDotLast = FALSE;	/* true if we should search '.' last */
 
-	Var_Delete(".PATH", SCOPE_GLOBAL);
+	Global_Delete(".PATH");
 
 	if ((ln = dirSearchPath.dirs.first) != NULL) {
 		CachedDir *dir = ln->datum;

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.530 src/usr.bin/make/main.c:1.531
--- src/usr.bin/make/main.c:1.530	Thu Feb  4 21:33:13 2021
+++ src/usr.bin/make/main.c	Fri Feb  5 04:41:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.530 2021/02/04 21:33:13 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.531 2021/02/05 04:41:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.530 2021/02/04 21:33:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.531 2021/02/05 04:41:17 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -2105,7 +2105,7 @@ SetErrorVars(GNode *gn)
 	 * We can print this even if there is no .ERROR target.
 	 */
 	Global_Set(".ERROR_TARGET", gn->name);
-	Var_Delete(".ERROR_CMD", SCOPE_GLOBAL);
+	Global_Delete(".ERROR_CMD");
 
 	for (ln = gn->commands.first; ln != NULL; ln = ln->next) {
 		const char *cmd = ln->datum;

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.200 src/usr.bin/make/nonints.h:1.201
--- src/usr.bin/make/nonints.h:1.200	Thu Feb  4 21:50:39 2021
+++ src/usr.bin/make/nonints.h	Fri Feb  5 04:41:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.200 2021/02/04 21:50:39 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.201 2021/02/05 04:41:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -393,6 +393,7 @@ void Var_UnExport(Boolean, const char *)
 void Global_Set(const char *, const char *);
 void Global_SetExpand(const char *, const char *);
 void Global_Append(const char *, const char *);
+void Global_Delete(const char *);
 
 /* util.c */
 typedef void (*SignalProc)(int);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.546 src/usr.bin/make/parse.c:1.547
--- src/usr.bin/make/parse.c:1.546	Thu Feb  4 21:42:46 2021
+++ src/usr.bin/make/parse.c	Fri Feb  5 04:41:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.546 2021/02/04 21:42:46 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.547 2021/02/05 04:41:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.546 2021/02/04 21:42:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.547 2021/02/05 04:41:17 rillig Exp $");
 
 /* types and constants */
 
@@ -2321,8 +2321,8 @@ ParseSetParseFile(const char *filename)
 		SetFilenameVars(including,
 		".INCLUDEDFROMDIR", ".INCLUDEDFROMFILE");
 	} else {
-		Var_Delete(".INCLUDEDFROMDIR", SCOPE_GLOBAL);
-		Var_Delete(".INCLUDEDFROMFILE", SCOPE_GLOBAL);
+		Global_Delete(".INCLUDEDFROMDIR");
+		Global_Delete(".INCLUDEDFROMFILE");
 	}
 }
 
@@ -2594,10 +2594,10 @@ ParseEOF(void)
 
 	if (includes.len == 0) {
 		/* We've run out of input */
-		Var_Delete(".PARSEDIR", SCOPE_GLOBAL);
-		Var_Delete(".PARSEFILE", SCOPE_GLOBAL);
-		Var_Delete(".INCLUDEDFROMDIR", SCOPE_GLOBAL);
-		Var_Delete(".INCLUDEDFROMFILE", SCOPE_GLOBAL);
+		Global_Delete(".PARSEDIR");
+		Global_Delete(".PARSEFILE");
+		Global_Delete(".INCLUDEDFROMDIR");
+		Global_Delete(".INCLUDEDFROMFILE");
 		return FALSE;
 	}
 


CVS commit: src/doc

2021-02-04 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Fri Feb  5 03:27:59 UTC 2021

Modified Files:
src/doc: 3RDPARTY

Log Message:
Latest acpica version is 20210105.


To generate a diff of this commit:
cvs rdiff -u -r1.1775 -r1.1776 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1775 src/doc/3RDPARTY:1.1776
--- src/doc/3RDPARTY:1.1775	Wed Jan 27 15:29:27 2021
+++ src/doc/3RDPARTY	Fri Feb  5 03:27:58 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1775 2021/01/27 15:29:27 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1776 2021/02/05 03:27:58 taca Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -42,7 +42,7 @@
 
 Package:	acpica
 Version:	20201113
-Current Vers:	20201113
+Current Vers:	20210105
 Maintainer:	Intel
 Archive Site:	http://www.acpica.org/downloads/
 Home Page:	http://www.acpica.org/



CVS commit: src/sys/arch/powerpc/powerpc

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb  5 00:06:12 UTC 2021

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
s/bootspec/bstr/g to avoid shadowing a global.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/powerpc/openfirm.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/powerpc/powerpc/openfirm.c
diff -u src/sys/arch/powerpc/powerpc/openfirm.c:1.31 src/sys/arch/powerpc/powerpc/openfirm.c:1.32
--- src/sys/arch/powerpc/powerpc/openfirm.c:1.31	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/openfirm.c	Fri Feb  5 00:06:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.31 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.32 2021/02/05 00:06:11 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.31 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.32 2021/02/05 00:06:11 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -603,7 +603,7 @@ OF_start_cpu(int phandle, u_int pc, int 
 #endif
 
 void
-OF_boot(const char *bootspec)
+OF_boot(const char *bstr)
 {
 	static struct {
 		const char *name;
@@ -617,10 +617,10 @@ OF_boot(const char *bootspec)
 	};
 	int l;
 
-	if ((l = strlen(bootspec)) >= PAGE_SIZE)
+	if ((l = strlen(bstr)) >= PAGE_SIZE)
 		panic("OF_boot");
 	ofw_stack();
-	ofbcopy(bootspec, OF_buf, l + 1);
+	ofbcopy(bstr, OF_buf, l + 1);
 	args.bootspec = OF_buf;
 	openfirmware();
 	panic("OF_boot didn't");



CVS commit: src/sys/dev/acpi

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 23:59:46 UTC 2021

Modified Files:
src/sys/dev/acpi: dwiic_acpi.c

Log Message:
Use acpi_compatible_match().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/dwiic_acpi.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/acpi/dwiic_acpi.c
diff -u src/sys/dev/acpi/dwiic_acpi.c:1.6 src/sys/dev/acpi/dwiic_acpi.c:1.7
--- src/sys/dev/acpi/dwiic_acpi.c:1.6	Tue Jan 26 00:19:53 2021
+++ src/sys/dev/acpi/dwiic_acpi.c	Thu Feb  4 23:59:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic_acpi.c,v 1.6 2021/01/26 00:19:53 jmcneill Exp $ */
+/* $NetBSD: dwiic_acpi.c,v 1.7 2021/02/04 23:59:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.6 2021/01/26 00:19:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.7 2021/02/04 23:59:46 thorpej Exp $");
 
 #include 
 #include 
@@ -59,12 +59,12 @@ static void	dwiic_acpi_configure(struct 
 
 CFATTACH_DECL_NEW(dwiic_acpi, sizeof(struct dwiic_softc), dwiic_acpi_match, dwiic_acpi_attach, NULL, NULL);
 
-static const char * const compatible[] = {
-	"AMD0010",	/* AMD FCH */
-	"AMDI0010",	/* AMD FCH */
-	"AMDI0510",	/* AMD Seattle */
-	"APMC0D0F",	/* Ampere eMAG */
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "AMD0010" },	/* AMD FCH */
+	{ .compat = "AMDI0010" },	/* AMD FCH */
+	{ .compat = "AMDI0510" },	/* AMD Seattle */
+	{ .compat = "APMC0D0F" },	/* Ampere eMAG */
+	DEVICE_COMPAT_EOL
 };
 
 static int
@@ -72,10 +72,7 @@ dwiic_acpi_match(device_t parent, cfdata
 {
 	struct acpi_attach_args *aa = aux;
 
-	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
-		return 0;
-
-	return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+	return acpi_compatible_match(aa, compat_data);
 }
 
 static void



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

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 23:54:48 UTC 2021

Modified Files:
src/sys/arch/x86/acpi: acpi_machdep.c

Log Message:
Call acpi_device_register() as appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/acpi/acpi_machdep.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.30 src/sys/arch/x86/acpi/acpi_machdep.c:1.31
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.30	Sat May  2 16:44:35 2020
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Thu Feb  4 23:54:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.30 2020/05/02 16:44:35 bouyer Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.31 2021/02/04 23:54:48 thorpej Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.30 2020/05/02 16:44:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.31 2021/02/04 23:54:48 thorpej Exp $");
 
 #include 
 #include 
@@ -603,6 +603,8 @@ device_acpi_register(device_t dev, void 
 	if (parent == NULL)
 		return;
 
+	acpi_device_register(dev, aux);
+
 	device_is_vga = device_is_a(dev, "vga") || device_is_a(dev, "genfb");
 	device_is_pci = device_is_a(parent, "pci");
 	device_is_isa = device_is_a(parent, "isa");



CVS commit: src/sys

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 23:29:16 UTC 2021

Modified Files:
src/sys/kern: subr_device.c
src/sys/sys: device.h

Log Message:
Add device_attached_to_iattr(), which return true if the device
attached to the specified interface attribute.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_device.c
cvs rdiff -u -r1.164 -r1.165 src/sys/sys/device.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/subr_device.c
diff -u src/sys/kern/subr_device.c:1.4 src/sys/kern/subr_device.c:1.5
--- src/sys/kern/subr_device.c:1.4	Thu Jan 28 15:53:46 2021
+++ src/sys/kern/subr_device.c	Thu Feb  4 23:29:16 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: subr_device.c,v 1.4 2021/01/28 15:53:46 thorpej Exp $	*/
+/*	$NetBSD: subr_device.c,v 1.5 2021/02/04 23:29:16 thorpej Exp $	*/
 
 /*
- * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.4 2021/01/28 15:53:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.5 2021/02/04 23:29:16 thorpej Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ device_t			root_device;
 /*
  * Accessor functions for the device_t type.
  */
+
 devclass_t
 device_class(device_t dev)
 {
@@ -182,3 +183,22 @@ device_is_a(device_t dev, const char *dn
 
 	return strcmp(dev->dv_cfdriver->cd_name, dname) == 0;
 }
+
+/*
+ * device_attached_to_iattr:
+ *
+ *	Returns true if the device attached to the specified interface
+ *	attribute.
+ */
+bool
+device_attached_to_iattr(device_t dev, const char *iattr)
+{
+	cfdata_t cfdata = device_cfdata(dev);
+	const struct cfparent *pspec;
+
+	if (cfdata == NULL || (pspec = cfdata->cf_pspec) == NULL) {
+		return false;
+	}
+
+	return strcmp(pspec->cfp_iattr, iattr) == 0;
+}

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.164 src/sys/sys/device.h:1.165
--- src/sys/sys/device.h:1.164	Wed Jan 27 04:54:08 2021
+++ src/sys/sys/device.h	Thu Feb  4 23:29:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.164 2021/01/27 04:54:08 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.165 2021/02/04 23:29:16 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -544,6 +544,7 @@ void		device_active_deregister(device_t,
  void (*)(device_t, devactive_t));
 
 bool		device_is_a(device_t, const char *);
+bool		device_attached_to_iattr(device_t, const char *);
 
 device_t	device_find_by_xname(const char *);
 device_t	device_find_by_driver_unit(const char *, int);



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

2021-02-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb  4 22:55:36 UTC 2021

Modified Files:
src/sys/arch/arm/amlogic: mesong12_clkc.c

Log Message:
Fix C error in G12_CLK_vid_pll


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/amlogic/mesong12_clkc.c

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

Modified files:

Index: src/sys/arch/arm/amlogic/mesong12_clkc.c
diff -u src/sys/arch/arm/amlogic/mesong12_clkc.c:1.5 src/sys/arch/arm/amlogic/mesong12_clkc.c:1.6
--- src/sys/arch/arm/amlogic/mesong12_clkc.c:1.5	Wed Jan 27 03:10:18 2021
+++ src/sys/arch/arm/amlogic/mesong12_clkc.c	Thu Feb  4 22:55:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mesong12_clkc.c,v 1.5 2021/01/27 03:10:18 thorpej Exp $ */
+/* $NetBSD: mesong12_clkc.c,v 1.6 2021/02/04 22:55:36 joerg Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mesong12_clkc.c,v 1.5 2021/01/27 03:10:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mesong12_clkc.c,v 1.6 2021/02/04 22:55:36 joerg Exp $");
 
 #include 
 #include 
@@ -939,7 +939,7 @@ struct mesong12_clkc_config {
 	__BIT(18),			/* sel */			\
 	0)
 #define G12_CLK_vid_pll			\
-	MESON_CLK_GATE(MESONG12_CLOCK_VID_PLL_DIV, "vid_pll",		\
+	MESON_CLK_GATE(MESONG12_CLOCK_VID_PLL, "vid_pll",		\
 	"vid_pll_sel",		/* parent */			\
 	HHI_VID_PLL_CLK_DIV,	/* reg */			\
 	19)/* bit */



CVS commit: src/sys/arch/arm

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 22:36:54 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c
src/sys/arch/arm/altera: cycv_platform.c
src/sys/arch/arm/amlogic: meson_platform.c
src/sys/arch/arm/broadcom: bcm283x_platform.c
src/sys/arch/arm/fdt: arm_platform.c
src/sys/arch/arm/nvidia: tegra_platform.c
src/sys/arch/arm/nxp: imx6_platform.c
src/sys/arch/arm/rockchip: rk_platform.c
src/sys/arch/arm/samsung: exynos_platform.c
src/sys/arch/arm/sunxi: sunxi_platform.c
src/sys/arch/arm/ti: omap3_platform.c
src/sys/arch/arm/vexpress: vexpress_platform.c
src/sys/arch/arm/virt: virt_platform.c
src/sys/arch/arm/xilinx: zynq_platform.c

Log Message:
Call acpi_device_register() / fdtbus_device_register() as approrpriate.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/altera/cycv_platform.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/amlogic/meson_platform.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/arm/broadcom/bcm283x_platform.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/fdt/arm_platform.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/nvidia/tegra_platform.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/nxp/imx6_platform.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/rockchip/rk_platform.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/sunxi/sunxi_platform.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/ti/omap3_platform.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/vexpress/vexpress_platform.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/virt/virt_platform.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/xilinx/zynq_platform.c

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.22 src/sys/arch/arm/acpi/acpi_platform.c:1.23
--- src/sys/arch/arm/acpi/acpi_platform.c:1.22	Sun Dec  6 14:01:40 2020
+++ src/sys/arch/arm/acpi/acpi_platform.c	Thu Feb  4 22:36:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.22 2020/12/06 14:01:40 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.23 2021/02/04 22:36:52 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.22 2020/12/06 14:01:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.23 2021/02/04 22:36:52 thorpej Exp $");
 
 #include 
 #include 
@@ -279,6 +279,10 @@ acpi_platform_init_attach_args(struct fd
 static void
 acpi_platform_device_register(device_t self, void *aux)
 {
+	/* XXX Not ideal, but the only reasonable solution atm. */
+	acpi_device_register(self, aux);
+	fdtbus_device_register(self, aux);
+
 #if NCOM > 0
 	prop_dictionary_t prop = device_properties(self);
 	ACPI_STATUS rv;

Index: src/sys/arch/arm/altera/cycv_platform.c
diff -u src/sys/arch/arm/altera/cycv_platform.c:1.16 src/sys/arch/arm/altera/cycv_platform.c:1.17
--- src/sys/arch/arm/altera/cycv_platform.c:1.16	Fri Jan 29 13:10:07 2021
+++ src/sys/arch/arm/altera/cycv_platform.c	Thu Feb  4 22:36:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.16 2021/01/29 13:10:07 rin Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.17 2021/02/04 22:36:52 thorpej Exp $ */
 
 /* This file is in the public domain. */
 
@@ -7,7 +7,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.16 2021/01/29 13:10:07 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.17 2021/02/04 22:36:52 thorpej Exp $");
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include 
@@ -137,9 +137,12 @@ cycv_platform_init_attach_args(struct fd
 }
 
 static void
-cycv_platform_device_register(device_t dev, void *aux) {
+cycv_platform_device_register(device_t dev, void *aux)
+{
 	prop_dictionary_t dict = device_properties(dev);
 
+	fdtbus_device_register(dev, aux);
+
 	if (device_is_a(dev, "arma9tmr")) {
 		prop_dictionary_set_uint32(dict, "frequency",
 			cycv_clkmgr_early_get_mpu_clk() / 4);

Index: src/sys/arch/arm/amlogic/meson_platform.c
diff -u src/sys/arch/arm/amlogic/meson_platform.c:1.17 src/sys/arch/arm/amlogic/meson_platform.c:1.18
--- src/sys/arch/arm/amlogic/meson_platform.c:1.17	Fri Jan 29 13:10:07 2021
+++ src/sys/arch/arm/amlogic/meson_platform.c	Thu Feb  4 22:36:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.17 2021/01/29 13:10:07 rin Exp $ */
+/* $NetBSD: meson_platform.c,v 1.18 2021/02/04 22:36:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.17 2021/01/29 13:10:07 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.18 2021/02/04 

CVS commit: src/sys/dev/fdt

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 22:14:08 UTC 2021

Modified Files:
src/sys/dev/fdt: fdtbus.c fdtvar.h

Log Message:
Add fdtbus_device_register().  Just a placeholder for now.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/fdt/fdtvar.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/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.38 src/sys/dev/fdt/fdtbus.c:1.39
--- src/sys/dev/fdt/fdtbus.c:1.38	Wed Jan 27 03:10:21 2021
+++ src/sys/dev/fdt/fdtbus.c	Thu Feb  4 22:14:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.38 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: fdtbus.c,v 1.39 2021/02/04 22:14:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.38 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.39 2021/02/04 22:14:08 thorpej Exp $");
 
 #include 
 #include 
@@ -550,3 +550,9 @@ fdtbus_print(void *aux, const char *pnp)
 
 	return UNCONF;
 }
+
+void
+fdtbus_device_register(device_t dev __unused, void *aux __unused)
+{
+	/* Placeholder. */
+}

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.68 src/sys/dev/fdt/fdtvar.h:1.69
--- src/sys/dev/fdt/fdtvar.h:1.68	Sat Jan 16 09:09:37 2021
+++ src/sys/dev/fdt/fdtvar.h	Thu Feb  4 22:14:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.68 2021/01/16 09:09:37 ryo Exp $ */
+/* $NetBSD: fdtvar.h,v 1.69 2021/02/04 22:14:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -434,7 +434,9 @@ void		fdt_add_child(device_t, int, struc
 void		fdt_remove_byhandle(int);
 void		fdt_remove_bycompat(const char *[]);
 int		fdt_find_with_property(const char *, int *);
+
 int		fdtbus_print(void *, const char *);
+void		fdtbus_device_register(device_t, void *);
 
 bus_dma_tag_t	fdtbus_dma_tag_create(int, const struct fdt_dma_range *,
 		u_int);



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 21:50:39 UTC 2021

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

Log Message:
make: rename Var_ValueDirect to GNode_ValueDirect


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/make.h
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.802 -r1.803 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.253 src/usr.bin/make/make.h:1.254
--- src/usr.bin/make/make.h:1.253	Thu Feb  4 21:42:46 2021
+++ src/usr.bin/make/make.h	Thu Feb  4 21:50:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.253 2021/02/04 21:42:46 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.254 2021/02/04 21:50:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -751,19 +751,19 @@ GNode_IsError(const GNode *gn)
 }
 
 MAKE_INLINE const char *
-GNode_VarTarget(GNode *gn) { return Var_ValueDirect(TARGET, gn); }
+GNode_VarTarget(GNode *gn) { return GNode_ValueDirect(gn, TARGET); }
 MAKE_INLINE const char *
-GNode_VarOodate(GNode *gn) { return Var_ValueDirect(OODATE, gn); }
+GNode_VarOodate(GNode *gn) { return GNode_ValueDirect(gn, OODATE); }
 MAKE_INLINE const char *
-GNode_VarAllsrc(GNode *gn) { return Var_ValueDirect(ALLSRC, gn); }
+GNode_VarAllsrc(GNode *gn) { return GNode_ValueDirect(gn, ALLSRC); }
 MAKE_INLINE const char *
-GNode_VarImpsrc(GNode *gn) { return Var_ValueDirect(IMPSRC, gn); }
+GNode_VarImpsrc(GNode *gn) { return GNode_ValueDirect(gn, IMPSRC); }
 MAKE_INLINE const char *
-GNode_VarPrefix(GNode *gn) { return Var_ValueDirect(PREFIX, gn); }
+GNode_VarPrefix(GNode *gn) { return GNode_ValueDirect(gn, PREFIX); }
 MAKE_INLINE const char *
-GNode_VarArchive(GNode *gn) { return Var_ValueDirect(ARCHIVE, gn); }
+GNode_VarArchive(GNode *gn) { return GNode_ValueDirect(gn, ARCHIVE); }
 MAKE_INLINE const char *
-GNode_VarMember(GNode *gn) { return Var_ValueDirect(MEMBER, gn); }
+GNode_VarMember(GNode *gn) { return GNode_ValueDirect(gn, MEMBER); }
 
 #ifdef __GNUC__
 #define UNCONST(ptr)	({		\

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.199 src/usr.bin/make/nonints.h:1.200
--- src/usr.bin/make/nonints.h:1.199	Thu Feb  4 20:14:33 2021
+++ src/usr.bin/make/nonints.h	Thu Feb  4 21:50:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.199 2021/02/04 20:14:33 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.200 2021/02/04 21:50:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -380,7 +380,7 @@ void Var_AppendExpand(const char *, cons
 Boolean Var_Exists(const char *, GNode *);
 Boolean Var_ExistsExpand(const char *, GNode *);
 FStr Var_Value(const char *, GNode *);
-const char *Var_ValueDirect(const char *, GNode *);
+const char *GNode_ValueDirect(GNode *, const char *);
 VarParseResult Var_Parse(const char **, GNode *, VarEvalFlags, FStr *);
 VarParseResult Var_Subst(const char *, GNode *, VarEvalFlags, char **);
 void Var_Stats(void);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.802 src/usr.bin/make/var.c:1.803
--- src/usr.bin/make/var.c:1.802	Thu Feb  4 21:42:46 2021
+++ src/usr.bin/make/var.c	Thu Feb  4 21:50:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.802 2021/02/04 21:42:46 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.803 2021/02/04 21:50:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.802 2021/02/04 21:42:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.803 2021/02/04 21:50:39 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -1228,9 +1228,9 @@ Var_Value(const char *name, GNode *scope
  * up the variable in any other scope.
  */
 const char *
-Var_ValueDirect(const char *name, GNode *scope)
+GNode_ValueDirect(GNode *gn, const char *name)
 {
-	Var *v = VarFind(name, scope, FALSE);
+	Var *v = VarFind(name, gn, FALSE);
 	return v != NULL ? v->val.data : NULL;
 }
 



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 21:42:47 UTC 2021

Modified Files:
src/usr.bin/make: arch.c compat.c make.1 make.c make.h parse.c suff.c
targ.c var.c
src/usr.bin/make/unit-tests: envfirst.mk vardebug.mk varmisc.mk
varmod-loop.mk varname-dot-shell.mk varparse-dynamic.mk

Log Message:
make: rename context and ctxt to scope

This continues the previous commit, in which VAR_GLOBAL, VAR_INTERNAL
and VAR_CMDLINE were renamed.

Renaming the variable 'ctxt' was trivial since that word is used nowhere
else.  In the comments though, each occurrence of the word 'context' had
to be checked individually since the word 'context' was not only used
for referring to a variable scope.  It is also used to distinguish
different situations where characters are escaped in a certain way
('parsing context') and in a few other expressions.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/usr.bin/make/arch.c
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/make/compat.c
cvs rdiff -u -r1.295 -r1.296 src/usr.bin/make/make.1
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/make/make.c
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/make/make.h
cvs rdiff -u -r1.545 -r1.546 src/usr.bin/make/parse.c
cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/suff.c
cvs rdiff -u -r1.164 -r1.165 src/usr.bin/make/targ.c
cvs rdiff -u -r1.801 -r1.802 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/envfirst.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/vardebug.mk \
src/usr.bin/make/unit-tests/varname-dot-shell.mk
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/varmisc.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-loop.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varparse-dynamic.mk

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.195 src/usr.bin/make/arch.c:1.196
--- src/usr.bin/make/arch.c:1.195	Thu Feb  4 19:50:29 2021
+++ src/usr.bin/make/arch.c	Thu Feb  4 21:42:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.195 2021/02/04 19:50:29 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.196 2021/02/04 21:42:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.195 2021/02/04 19:50:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.196 2021/02/04 21:42:46 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -176,14 +176,14 @@ ArchFree(void *ap)
  * Input:
  *	pp		The start of the specification.
  *	gns		The list on which to place the nodes.
- *	ctxt		The context in which to expand variables.
+ *	scope		The scope in which to expand variables.
  *
  * Output:
  *	return		TRUE if it was a valid specification.
  *	*pp		Points to the first non-space after the archive spec.
  */
 Boolean
-Arch_ParseArchive(char **pp, GNodeList *gns, GNode *ctxt)
+Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 {
 	char *cp;		/* Pointer into line */
 	GNode *gn;		/* New node */
@@ -206,7 +206,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 			Boolean isError;
 
 			/* XXX: is expanded twice: once here and once below */
-			(void)Var_Parse(_p, ctxt,
+			(void)Var_Parse(_p, scope,
 	VARE_WANTRES | VARE_UNDEFERR, );
 			/* TODO: handle errors */
 			isError = result.str == var_Error;
@@ -223,7 +223,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 	*cp++ = '\0';
 	if (expandLibName) {
 		char *expanded;
-		(void)Var_Subst(libName.str, ctxt,
+		(void)Var_Subst(libName.str, scope,
 		VARE_WANTRES | VARE_UNDEFERR, );
 		/* TODO: handle errors */
 		libName = MFStr_InitOwn(expanded);
@@ -249,7 +249,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 Boolean isError;
 const char *nested_p = cp;
 
-(void)Var_Parse(_p, ctxt,
+(void)Var_Parse(_p, scope,
 		VARE_WANTRES | VARE_UNDEFERR,
 		);
 /* TODO: handle errors */
@@ -306,7 +306,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 			char *p;
 			char *unexpandedMemName = memName;
 
-			(void)Var_Subst(memName, ctxt,
+			(void)Var_Subst(memName, scope,
 	VARE_WANTRES | VARE_UNDEFERR,
 	);
 			/* TODO: handle errors */
@@ -330,7 +330,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 gn->type |= OP_ARCHV;
 Lst_Append(gns, gn);
 
-			} else if (!Arch_ParseArchive(, gns, ctxt)) {
+			} else if (!Arch_ParseArchive(, gns, scope)) {
 /* Error in nested call. */
 free(fullName);
 /* XXX: does unexpandedMemName leak? */

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.222 src/usr.bin/make/compat.c:1.223
--- src/usr.bin/make/compat.c:1.222	Tue Feb  2 17:47:56 2021
+++ src/usr.bin/make/compat.c	Thu Feb  4 21:42:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.222 2021/02/02 17:47:56 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 

CVS commit: src/sys/dev/acpi

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 21:39:00 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi.c acpivar.h

Log Message:
Add acpi_device_register().  Just a placeholder for now.


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/acpi/acpivar.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/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.288 src/sys/dev/acpi/acpi.c:1.289
--- src/sys/dev/acpi/acpi.c:1.288	Sun Dec 13 20:24:26 2020
+++ src/sys/dev/acpi/acpi.c	Thu Feb  4 21:39:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.288 2020/12/13 20:24:26 jmcneill Exp $	*/
+/*	$NetBSD: acpi.c,v 1.289 2021/02/04 21:39:00 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.288 2020/12/13 20:24:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.289 2021/02/04 21:39:00 thorpej Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -1125,6 +1125,17 @@ acpi_print(void *aux, const char *pnp)
 }
 
 /*
+ * acpi_device_register --
+ *	Called by the platform device_register() routine when
+ *	attaching devices.
+ */
+void
+acpi_device_register(device_t dev __unused, void *v __unused)
+{
+	/* Placeholder. */
+}
+
+/*
  * Notify.
  */
 static void

Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.84 src/sys/dev/acpi/acpivar.h:1.85
--- src/sys/dev/acpi/acpivar.h:1.84	Wed Jan 27 05:11:54 2021
+++ src/sys/dev/acpi/acpivar.h	Thu Feb  4 21:39:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.84 2021/01/27 05:11:54 thorpej Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.85 2021/02/04 21:39:00 thorpej Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -319,6 +319,7 @@ const struct device_compatible_entry *
 		const struct device_compatible_entry *);
 
 bool	acpi_device_present(ACPI_HANDLE);
+void		acpi_device_register(device_t, void *);
 
 int		acpi_reset(void);
 



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 21:33:14 UTC 2021

Modified Files:
src/usr.bin/make: cond.c dir.c for.c job.c main.c make.h meta.c parse.c
targ.c trace.c var.c
src/usr.bin/make/unit-tests: varname-make_print_var_on_error-jobs.mk
varname-make_print_var_on_error.mk

Log Message:
make: rename some VAR constants to SCOPE

The word "context" does not fit perfectly to the variables that are
associate with a GNode, as the context is usually something from the
outside and the variables are more like properties inherent to the
GNode.

The term "global context" fits even less.  Since the thing where
variables are looked up is commonly named a scope, use that term
instead.

This commit only renames the global variables VAR_GLOBAL, VAR_INTERNAL
and VAR_CMDLINE, plus a few very closely related comments.  These are:

GNode.vars (because of line breaks)
GNode_Free (dito)
varname-make_print_var_on_error.mk
varname-make_print_var_on_error-jobs.mk

The debug message in Var_Stats is left as-is since there is no unit test
for it yet.

The other renamings (variable names "context", "ctxt", as well as
further comments) will be done in a follow-up commit.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/cond.c
cvs rdiff -u -r1.267 -r1.268 src/usr.bin/make/dir.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/for.c
cvs rdiff -u -r1.415 -r1.416 src/usr.bin/make/job.c
cvs rdiff -u -r1.529 -r1.530 src/usr.bin/make/main.c
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/make/make.h
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/make/meta.c
cvs rdiff -u -r1.544 -r1.545 src/usr.bin/make/parse.c
cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/targ.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/trace.c
cvs rdiff -u -r1.800 -r1.801 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk
cvs rdiff -u -r1.5 -r1.6 \
src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk

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

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.254 src/usr.bin/make/cond.c:1.255
--- src/usr.bin/make/cond.c:1.254	Sat Jan 30 20:53:29 2021
+++ src/usr.bin/make/cond.c	Thu Feb  4 21:33:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.254 2021/01/30 20:53:29 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.255 2021/02/04 21:33:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.254 2021/01/30 20:53:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.255 2021/02/04 21:33:13 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -268,7 +268,7 @@ ParseFuncArg(CondParser *par, const char
 			? VARE_WANTRES | VARE_UNDEFERR
 			: VARE_NONE;
 			FStr nestedVal;
-			(void)Var_Parse(, VAR_CMDLINE, eflags, );
+			(void)Var_Parse(, SCOPE_CMDLINE, eflags, );
 			/* TODO: handle errors */
 			Buf_AddStr(, nestedVal.str);
 			FStr_Done();
@@ -303,7 +303,7 @@ ParseFuncArg(CondParser *par, const char
 static Boolean
 FuncDefined(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
-	FStr value = Var_Value(arg, VAR_CMDLINE);
+	FStr value = Var_Value(arg, SCOPE_CMDLINE);
 	Boolean result = value.str != NULL;
 	FStr_Done();
 	return result;
@@ -426,7 +426,7 @@ CondParser_StringExpr(CondParser *par, c
 
 	nested_p = par->p;
 	atStart = nested_p == start;
-	parseResult = Var_Parse(_p, VAR_CMDLINE, eflags, inout_str);
+	parseResult = Var_Parse(_p, SCOPE_CMDLINE, eflags, inout_str);
 	/* TODO: handle errors */
 	if (inout_str->str == var_Error) {
 		if (parseResult == VPR_ERR) {
@@ -741,7 +741,7 @@ ParseEmptyArg(CondParser *par MAKE_ATTR_
 	*out_arg = NULL;
 
 	(*pp)--;		/* Make (*pp)[1] point to the '('. */
-	(void)Var_Parse(pp, VAR_CMDLINE, doEval ? VARE_WANTRES : VARE_NONE,
+	(void)Var_Parse(pp, SCOPE_CMDLINE, doEval ? VARE_WANTRES : VARE_NONE,
 	);
 	/* TODO: handle errors */
 	/* If successful, *pp points beyond the closing ')' now. */

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.267 src/usr.bin/make/dir.c:1.268
--- src/usr.bin/make/dir.c:1.267	Wed Feb  3 13:53:12 2021
+++ src/usr.bin/make/dir.c	Thu Feb  4 21:33:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.267 2021/02/03 13:53:12 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.268 2021/02/04 21:33:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.267 2021/02/03 13:53:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.268 2021/02/04 21:33:13 rillig Exp $");
 
 /*
  * A search path is a list of CachedDir structures. A 

CVS commit: src/sys

2021-02-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Feb  4 21:07:06 UTC 2021

Modified Files:
src/sys/kern: vfs_init.c vfs_subr.c
src/sys/sys: mount.h

Log Message:
introduce vfs.generic.timestamp_precision sysctl to control precision
of the timer used for vfs_timestamp(); default stays the same
to use nanotime(9), but option is there to use the faster, albeit
less precise methods

code taken from FreeBSD

suggested by Mateusz Guzik in:
http://mail-index.netbsd.org/tech-kern/2020/07/19/msg026620.html


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/kern/vfs_init.c
cvs rdiff -u -r1.489 -r1.490 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.236 -r1.237 src/sys/sys/mount.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/vfs_init.c
diff -u src/sys/kern/vfs_init.c:1.51 src/sys/kern/vfs_init.c:1.52
--- src/sys/kern/vfs_init.c:1.51	Sat May 16 18:31:50 2020
+++ src/sys/kern/vfs_init.c	Thu Feb  4 21:07:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_init.c,v 1.51 2020/05/16 18:31:50 christos Exp $	*/
+/*	$NetBSD: vfs_init.c,v 1.52 2021/02/04 21:07:06 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_init.c,v 1.51 2020/05/16 18:31:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_init.c,v 1.52 2021/02/04 21:07:06 jdolecek Exp $");
 
 #include 
 #include 
@@ -151,6 +151,7 @@ static void
 sysctl_vfs_setup(void)
 {
 	extern int vfs_magiclinks;
+	extern int vfs_timestamp_precision;
 
 	sysctl_createv(_sysctllog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT,
@@ -170,6 +171,13 @@ sysctl_vfs_setup(void)
 		   SYSCTL_DESCR("Whether \"magic\" symlinks are expanded"),
 		   NULL, 0, _magiclinks, 0,
 		   CTL_VFS, VFS_GENERIC, VFS_MAGICLINKS, CTL_EOL);
+	sysctl_createv(_sysctllog, 0, NULL, NULL,
+			CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+			CTLTYPE_INT, "timestamp_precision",
+			SYSCTL_DESCR("File timestamp precision"),
+			NULL, 0, _timestamp_precision, 0,
+			CTL_VFS, VFS_GENERIC, VFS_TIMESTAMP_PRECISION,
+			CTL_EOL);
 }
 
 

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.489 src/sys/kern/vfs_subr.c:1.490
--- src/sys/kern/vfs_subr.c:1.489	Sun Jul 26 21:28:33 2020
+++ src/sys/kern/vfs_subr.c	Thu Feb  4 21:07:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.489 2020/07/26 21:28:33 christos Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.490 2021/02/04 21:07:06 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008, 2019, 2020
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.489 2020/07/26 21:28:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.490 2021/02/04 21:07:06 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1253,11 +1253,40 @@ set_statvfs_info(const char *onp, int uk
 	return 0;
 }
 
-void
-vfs_timestamp(struct timespec *ts)
-{
-
-	nanotime(ts);
+/*
+ * Knob to control the precision of file timestamps:
+ *
+ *   0 = seconds only; nanoseconds zeroed.
+ *   1 = seconds and nanoseconds, accurate within 1/HZ.
+ *   2 = seconds and nanoseconds, truncated to microseconds.
+ * >=3 = seconds and nanoseconds, maximum precision.
+ */
+enum { TSP_SEC, TSP_HZ, TSP_USEC, TSP_NSEC };
+
+int vfs_timestamp_precision __read_mostly = TSP_NSEC;
+
+void
+vfs_timestamp(struct timespec *tsp)
+{
+	struct timeval tv;
+
+	switch (vfs_timestamp_precision) {
+	case TSP_SEC:
+		tsp->tv_sec = time_second;
+		tsp->tv_nsec = 0;
+		break;
+	case TSP_HZ:
+		getnanotime(tsp);
+		break;
+	case TSP_USEC:
+		microtime();
+		TIMEVAL_TO_TIMESPEC(, tsp);
+		break;
+	case TSP_NSEC:
+	default:
+		nanotime(tsp);
+		break;
+	}
 }
 
 /*

Index: src/sys/sys/mount.h
diff -u src/sys/sys/mount.h:1.236 src/sys/sys/mount.h:1.237
--- src/sys/sys/mount.h:1.236	Fri Jan 17 20:08:10 2020
+++ src/sys/sys/mount.h	Thu Feb  4 21:07:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount.h,v 1.236 2020/01/17 20:08:10 ad Exp $	*/
+/*	$NetBSD: mount.h,v 1.237 2021/02/04 21:07:06 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -115,6 +115,7 @@
 	   as next argument */
 #define VFS_USERMOUNT	3		/* enable/disable fs mnt by non-root */
 #define	VFS_MAGICLINKS  4		/* expand 'magic' symlinks */
+#define	VFS_TIMESTAMP_PRECISION  5	/* file timestamp precision */
 
 /* vfsquery flags for kqueue(2) */
 #define VQ_MOUNT	0x0001	/* new filesystem arrived */



CVS commit: src/sys/dev/ofw

2021-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  4 20:19:09 UTC 2021

Modified Files:
src/sys/dev/ofw: files.ofw ofw_subr.c
Added Files:
src/sys/dev/ofw: ofw_i2c_subr.c ofw_spi_subr.c

Log Message:
Split the i2c and spi stuff out into their own files.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ofw/files.ofw
cvs rdiff -u -r0 -r1.1 src/sys/dev/ofw/ofw_i2c_subr.c \
src/sys/dev/ofw/ofw_spi_subr.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ofw/ofw_subr.c

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

Modified files:

Index: src/sys/dev/ofw/files.ofw
diff -u src/sys/dev/ofw/files.ofw:1.15 src/sys/dev/ofw/files.ofw:1.16
--- src/sys/dev/ofw/files.ofw:1.15	Fri Apr  3 06:02:51 2020
+++ src/sys/dev/ofw/files.ofw	Thu Feb  4 20:19:09 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ofw,v 1.15 2020/04/03 06:02:51 macallan Exp $
+#	$NetBSD: files.ofw,v 1.16 2021/02/04 20:19:09 thorpej Exp $
 #
 # First cut on Openfirmware interface
 #
@@ -13,7 +13,9 @@ file 	dev/ofw/ofw_sysctl.c		openfirm | o
 
 file	dev/ofw/ofw_subr.c		ofbus | openfirm | ofw_subr
 
+file	dev/ofw/ofw_i2c_subr.c		ofbus | openfirm | ofw_subr
 file	dev/ofw/ofw_network_subr.c	of_network_dev
+file	dev/ofw/ofw_spi_subr.c		ofbus | openfirm | ofw_subr
 
 # Generic disk support
 device	ofdisk: disk

Index: src/sys/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.55 src/sys/dev/ofw/ofw_subr.c:1.56
--- src/sys/dev/ofw/ofw_subr.c:1.55	Wed Jan 27 04:55:42 2021
+++ src/sys/dev/ofw/ofw_subr.c	Thu Feb  4 20:19:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.55 2021/01/27 04:55:42 thorpej Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.56 2021/02/04 20:19:09 thorpej Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,14 +34,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.55 2021/01/27 04:55:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.56 2021/02/04 20:19:09 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #define	OFW_MAX_STACK_BUF_SIZE	256
 #define	OFW_PATH_BUF_SIZE	512
@@ -431,129 +430,6 @@ of_get_mode_string(char *buffer, int len
 }
 
 /*
- * Iterate over the subtree of a i2c controller node.
- * Add all sub-devices into an array as part of the controller's
- * device properties.
- * This is used by the i2c bus attach code to do direct configuration.
- */
-void
-of_enter_i2c_devs(prop_dictionary_t props, int ofnode, size_t cell_size,
-int addr_shift)
-{
-	int node, len;
-	char name[32];
-	uint64_t reg64;
-	uint32_t reg32;
-	uint64_t addr;
-	prop_array_t array = NULL;
-	prop_dictionary_t dev;
-
-	for (node = OF_child(ofnode); node; node = OF_peer(node)) {
-		if (OF_getprop(node, "name", name, sizeof(name)) <= 0)
-			continue;
-		len = OF_getproplen(node, "reg");
-		addr = 0;
-		if (cell_size == 8 && len >= sizeof(reg64)) {
-			if (OF_getprop(node, "reg", , sizeof(reg64))
-			< sizeof(reg64))
-continue;
-			addr = be64toh(reg64);
-			/*
-			 * The i2c bus number (0 or 1) is encoded in bit 33
-			 * of the register, but we encode it in bit 8 of
-			 * i2c_addr_t.
-			 */
-			if (addr & 0x1)
-addr = (addr & 0xff) | 0x100;
-		} else if (cell_size == 4 && len >= sizeof(reg32)) {
-			if (OF_getprop(node, "reg", , sizeof(reg32))
-			< sizeof(reg32))
-continue;
-			addr = be32toh(reg32);
-		} else {
-			continue;
-		}
-		addr >>= addr_shift;
-		if (addr == 0) continue;
-
-		if (array == NULL)
-			array = prop_array_create();
-
-		dev = prop_dictionary_create();
-		prop_dictionary_set_string(dev, "name", name);
-		prop_dictionary_set_uint32(dev, "addr", addr);
-		prop_dictionary_set_uint64(dev, "cookie", node);
-		prop_dictionary_set_uint32(dev, "cookietype", I2C_COOKIE_OF);
-		of_to_dataprop(dev, node, "compatible", "compatible");
-		prop_array_add(array, dev);
-		prop_object_release(dev);
-	}
-
-	if (array != NULL) {
-		prop_dictionary_set(props, "i2c-child-devices", array);
-		prop_object_release(array);
-	}
-}
-
-void
-of_enter_spi_devs(prop_dictionary_t props, int ofnode, size_t cell_size)
-{
-	int node, len;
-	char name[32];
-	uint64_t reg64;
-	uint32_t reg32;
-	uint32_t slave;
-	u_int32_t maxfreq;
-	prop_array_t array = NULL;
-	prop_dictionary_t dev;
-	int mode;
-
-	for (node = OF_child(ofnode); node; node = OF_peer(node)) {
-		if (OF_getprop(node, "name", name, sizeof(name)) <= 0)
-			continue;
-		len = OF_getproplen(node, "reg");
-		slave = 0;
-		if (cell_size == 8 && len >= sizeof(reg64)) {
-			if (OF_getprop(node, "reg", , sizeof(reg64))
-			< sizeof(reg64))
-continue;
-			slave = be64toh(reg64);
-		} else if (cell_size == 4 && len >= sizeof(reg32)) {
-			if (OF_getprop(node, "reg", , sizeof(reg32))
-			< sizeof(reg32))
-continue;
-			slave = be32toh(reg32);
-		} else {
-			continue;
-		}
-		if (of_getprop_uint32(node, "spi-max-frequency", )) {
-			maxfreq = 0;
-		}
-		mode = ((int)of_hasprop(node, "cpol") << 1) | 

CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 20:14:33 UTC 2021

Modified Files:
src/usr.bin/make: nonints.h

Log Message:
make: group shortcuts for manipulating global variables

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/nonints.h

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.198 src/usr.bin/make/nonints.h:1.199
--- src/usr.bin/make/nonints.h:1.198	Thu Feb  4 19:15:13 2021
+++ src/usr.bin/make/nonints.h	Thu Feb  4 20:14:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.198 2021/02/04 19:15:13 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.199 2021/02/04 20:14:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -371,15 +371,12 @@ typedef enum VarExportMode {
 void Var_Delete(const char *, GNode *);
 void Var_DeleteExpand(const char *, GNode *);
 void Var_Undef(const char *);
-void Global_Set(const char *, const char *);
-void Global_SetExpand(const char *, const char *);
 void Var_Set(const char *, const char *, GNode *);
 void Var_SetExpand(const char *, const char *, GNode *);
 void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags);
 void Var_SetExpandWithFlags(const char *, const char *, GNode *, VarSetFlags);
 void Var_Append(const char *, const char *, GNode *);
 void Var_AppendExpand(const char *, const char *, GNode *);
-void Global_Append(const char *, const char *);
 Boolean Var_Exists(const char *, GNode *);
 Boolean Var_ExistsExpand(const char *, GNode *);
 FStr Var_Value(const char *, GNode *);
@@ -393,6 +390,10 @@ void Var_Export(VarExportMode, const cha
 void Var_ExportVars(const char *);
 void Var_UnExport(Boolean, const char *);
 
+void Global_Set(const char *, const char *);
+void Global_SetExpand(const char *, const char *);
+void Global_Append(const char *, const char *);
+
 /* util.c */
 typedef void (*SignalProc)(int);
 SignalProc bmake_signal(int, SignalProc);



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 19:50:29 UTC 2021

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

Log Message:
make: merge duplicate code in Arch_FindLib

No functional change.  Furthermore, this only affects builds that
explicitly disable LIBRARIES in config.h.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/make/arch.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.194 src/usr.bin/make/arch.c:1.195
--- src/usr.bin/make/arch.c:1.194	Sat Jan 23 10:48:49 2021
+++ src/usr.bin/make/arch.c	Thu Feb  4 19:50:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.194 2021/01/23 10:48:49 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.195 2021/02/04 19:50:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.194 2021/01/23 10:48:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.195 2021/02/04 19:50:29 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -975,7 +975,7 @@ Arch_FindLib(GNode *gn, SearchPath *path
 #ifdef LIBRARIES
 	Var_Set(TARGET, gn->name, gn);
 #else
-	Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn);
+	Var_Set(TARGET, GNode_Path(gn), gn);
 #endif
 }
 



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 19:43:00 UTC 2021

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

Log Message:
make: merge SetVar into Var_SetWithFlags

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.799 -r1.800 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.799 src/usr.bin/make/var.c:1.800
--- src/usr.bin/make/var.c:1.799	Thu Feb  4 19:15:13 2021
+++ src/usr.bin/make/var.c	Thu Feb  4 19:43:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.799 2021/02/04 19:15:13 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.800 2021/02/04 19:43:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.799 2021/02/04 19:15:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.800 2021/02/04 19:43:00 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -919,8 +919,9 @@ Var_UnExport(Boolean isEnv, const char *
 }
 
 /* Set the variable to the value; the name is not expanded. */
-static void
-SetVar(const char *name, const char *val, GNode *ctxt, VarSetFlags flags)
+void
+Var_SetWithFlags(const char *name, const char *val, GNode *ctxt,
+		 VarSetFlags flags)
 {
 	Var *v;
 
@@ -1001,13 +1002,6 @@ SetVar(const char *name, const char *val
 		VarFreeEnv(v, TRUE);
 }
 
-void
-Var_SetWithFlags(const char *name, const char *val, GNode *ctxt,
-		 VarSetFlags flags)
-{
-	SetVar(name, val, ctxt, flags);
-}
-
 /* See Var_Set for documentation. */
 void
 Var_SetExpandWithFlags(const char *name, const char *val, GNode *ctxt,
@@ -1030,7 +1024,7 @@ Var_SetExpandWithFlags(const char *name,
 			"name expands to empty string - ignored\n",
 		unexpanded_name, val);
 	} else
-		SetVar(varname.str, val, ctxt, flags);
+		Var_SetWithFlags(varname.str, val, ctxt, flags);
 
 	FStr_Done();
 }
@@ -1038,7 +1032,7 @@ Var_SetExpandWithFlags(const char *name,
 void
 Var_Set(const char *name, const char *val, GNode *ctxt)
 {
-	SetVar(name, val, ctxt, VAR_SET_NONE);
+	Var_SetWithFlags(name, val, ctxt, VAR_SET_NONE);
 }
 
 /*
@@ -1061,7 +1055,7 @@ Var_SetExpand(const char *name, const ch
 void
 Global_Set(const char *name, const char *value)
 {
-	SetVar(name, value, VAR_GLOBAL, VAR_SET_NONE);
+	Var_Set(name, value, VAR_GLOBAL);
 }
 
 void
@@ -1084,7 +1078,7 @@ Var_Append(const char *name, const char 
 	v = VarFind(name, ctxt, ctxt == VAR_GLOBAL);
 
 	if (v == NULL) {
-		SetVar(name, val, ctxt, VAR_SET_NONE);
+		Var_SetWithFlags(name, val, ctxt, VAR_SET_NONE);
 	} else if (v->flags & VAR_READONLY) {
 		DEBUG1(VAR, "Ignoring append to %s since it is read-only\n",
 		name);



CVS commit: [netbsd-9] src/doc

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 19:31:25 UTC 2021

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

Log Message:
Tickets #1191 - #1197


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.38 -r1.1.2.39 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.38 src/doc/CHANGES-9.2:1.1.2.39
--- src/doc/CHANGES-9.2:1.1.2.38	Fri Jan 29 21:01:53 2021
+++ src/doc/CHANGES-9.2	Thu Feb  4 19:31:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.38 2021/01/29 21:01:53 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.39 2021/02/04 19:31:25 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1440,3 +1440,46 @@ usr.bin/ftp/version.h1.92
 	PR 55857: ftp(1): don't use restartable signals.
 	[lukem, ticket #1190]
 
+sys/kern/kern_event.c1.110-1.115
+
+	Fix kevent(2) race causing missed events, and Go timer latency issues.
+	[jdolecek, ticket #1191]
+
+sys/dev/hyperv/hvkbd.c1.7 (patch)
+sys/dev/hyperv/if_hvn.c1.20 (patch)
+sys/dev/hyperv/vmbus.c1.12 (patch)
+
+	hvkbd(4), vmbus(4), hvn(4): don't wait forever.
+	[nonaka, ticket #1192]
+
+share/mk/bsd.own.mk1.1229
+
+	PR 55751: use gzip'd sets for alpha.
+	[tsutsui, ticket #1193]
+
+xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c	1.3
+
+	Fix "no output of xdpyinfo(1) on redirect or pipe" problem.
+	[tsutsui, ticket #1194]
+
+sys/miscfs/procfs/procfs_vfsops.c		1.110
+
+	Fix procfs environ node.
+	[riastradh, ticket #1195]
+
+sys/dev/usb/uhid.c1.115 (patch)
+sys/dev/usb/uhidev.c1.79 (patch)
+sys/dev/usb/uhidev.h1.21 (patch)
+
+	Fix uhid and uhidev locking.
+	[riastradh, ticket #1196]
+
+sys/dev/usb/if_urtwn.c1.89,1.90
+sys/dev/usb/usbdevs1.788,1.789
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	urtwn(4): add TPLINK WN821N and another TPLINK RTL8192EU variant.
+	To avoid confusion use TP-Link's names for these variants.
+	[nia, ticket #1197]
+



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

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 19:24:01 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
regen (for ticket #1197)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.6 -r1.760.4.7 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.760.4.6 src/sys/dev/usb/usbdevs.h:1.760.4.7
--- src/sys/dev/usb/usbdevs.h:1.760.4.6	Wed Apr 29 13:54:48 2020
+++ src/sys/dev/usb/usbdevs.h	Thu Feb  4 19:23:59 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.760.4.6 2020/04/29 13:54:48 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.760.4.7 2021/02/04 19:23:59 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.6 2020/04/29 13:53:51 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.7 2021/02/04 19:23:10 martin Exp
  */
 
 /*-
@@ -3391,7 +3391,9 @@
 
 /* TP-Link products */
 #define	USB_PRODUCT_TPLINK_RTL8192CU	0x0100		/* RTL8192CU */
-#define	USB_PRODUCT_TPLINK_RTL8192EU	0x0109		/* RTL8192EU */
+#define	USB_PRODUCT_TPLINK_WN821NV5	0x0107		/* TL-WN821N v5 */
+#define	USB_PRODUCT_TPLINK_WN822NV4	0x0108		/* TL-WN822N v4 */
+#define	USB_PRODUCT_TPLINK_WN823NV2	0x0109		/* TL-WN823N v2 */
 #define	USB_PRODUCT_TPLINK_RTL8188EU	0x010c		/* RTL8188EU */
 
 /* Trek Technology products */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.760.4.6 src/sys/dev/usb/usbdevs_data.h:1.760.4.7
--- src/sys/dev/usb/usbdevs_data.h:1.760.4.6	Wed Apr 29 13:54:48 2020
+++ src/sys/dev/usb/usbdevs_data.h	Thu Feb  4 19:23:59 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.760.4.6 2020/04/29 13:54:48 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.760.4.7 2021/02/04 19:23:59 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.6 2020/04/29 13:53:51 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.7 2021/02/04 19:23:10 martin Exp
  */
 
 /*-
@@ -4644,64 +4644,68 @@ static const uint16_t usb_products[] = {
 	8669, 6484, 5028, 5798, 0,
 	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192CU, 
 	5207, 0,
-	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU, 
-	17050, 0,
+	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_WN821NV5, 
+	19515, 19525, 0,
+	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_WN822NV4, 
+	19528, 18404, 0,
+	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_WN823NV2, 
+	19538, 7496, 0,
 	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8188EU, 
 	5217, 0,
 	USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE, 
-	19515, 0,
+	19548, 0,
 	USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE_8MB, 
-	19515, 19526, 0,
+	19548, 19559, 0,
 	USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8192CU, 
 	5207, 0,
 	USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8188CU, 
 	5227, 0,
 	USB_VENDOR_TRIPPLITE, USB_PRODUCT_TRIPPLITE_U209, 
-	19530, 6908, 4932, 0,
+	19563, 6908, 4932, 0,
 	USB_VENDOR_TRIPPLITE2, USB_PRODUCT_TRIPPLITE2_UPS, 
 	3179, 3185, 480, 0,
 	USB_VENDOR_TRIPPLITE2, USB_PRODUCT_TRIPPLITE2_SMARTLCD, 
-	19535, 480, 0,
+	19568, 480, 0,
 	USB_VENDOR_TRIPPLITE2, USB_PRODUCT_TRIPPLITE2_AVR550U, 
-	3179, 3185, 19544, 0,
+	3179, 3185, 19577, 0,
 	USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_T33521, 
-	19552, 19560, 0,
+	19585, 19593, 0,
 	USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_XXX1100, 
-	15921, 19568, 0,
+	15921, 19601, 0,
 	USB_VENDOR_TSUNAMI, USB_PRODUCT_TSUNAMI_SM2000, 
-	19573, 0,
+	19606, 0,
 	USB_VENDOR_TWINMOS, USB_PRODUCT_TWINMOS_G240, 
-	19581, 0,
+	19614, 0,
 	USB_VENDOR_ULTIMA, USB_PRODUCT_ULTIMA_1200UBPLUS, 
 	11239, 14841, 11129, 7209, 0,
 	USB_VENDOR_ULTIMA, USB_PRODUCT_ULTIMA_T14BR, 
-	19586, 19592, 6818, 0,
+	19619, 19625, 6818, 0,
 	USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA1236U, 
-	19598, 5714, 19604, 0,
+	19631, 5714, 19637, 0,
 	USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA1220U, 
-	19598, 19612, 19604, 0,
+	19631, 19645, 19637, 0,
 	USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA2000U, 
-	19598, 19618, 19604, 0,
+	19631, 19651, 19637, 0,
 	USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA3400, 
-	19598, 19624, 19604, 0,
+	19631, 19657, 19637, 0,
 	USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA2100U, 
-	19598, 19629, 19604, 0,
+	19631, 19662, 19637, 0,
 	USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA2200U, 
-	19598, 19635, 19604, 0,
+	19631, 19668, 19637, 0,
 	USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UB_A, 
-	19641, 0,
+	19674, 0,
 	USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UB, 
-	19653, 0,
+	19686, 0,
 	USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UBC1, 
-	   

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

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 19:23:10 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: if_urtwn.c usbdevs

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

sys/dev/usb/if_urtwn.c: revision 1.89,1.90
sys/dev/usb/usbdevs: revision 1.788,1.789

urtwn(4): add TPLINK WN821N to the list of USB device ids
reported by kfmut on the unitedbsd forums.

add another TPLINK RTL8192EU variant
to avoid confusion use TP-Link's names for these variants, matching
FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.3 -r1.71.2.4 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.770.4.6 -r1.770.4.7 src/sys/dev/usb/usbdevs

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/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71.2.3 src/sys/dev/usb/if_urtwn.c:1.71.2.4
--- src/sys/dev/usb/if_urtwn.c:1.71.2.3	Fri Apr 24 17:28:21 2020
+++ src/sys/dev/usb/if_urtwn.c	Thu Feb  4 19:23:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.71.2.3 2020/04/24 17:28:21 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.71.2.4 2021/02/04 19:23:10 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.3 2020/04/24 17:28:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.4 2021/02/04 19:23:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -199,7 +199,9 @@ static const struct urtwn_dev {
 	/* URTWN_RTL8192EU */
 	URTWN_RTL8192EU_DEV(DLINK,	DWA131E),
 	URTWN_RTL8192EU_DEV(REALTEK,	RTL8192EU),
-	URTWN_RTL8192EU_DEV(TPLINK,	RTL8192EU),
+	URTWN_RTL8192EU_DEV(TPLINK,	WN821NV5),
+	URTWN_RTL8192EU_DEV(TPLINK,	WN822NV4),
+	URTWN_RTL8192EU_DEV(TPLINK,	WN823NV2),
 };
 #undef URTWN_DEV
 #undef URTWN_RTL8188E_DEV

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770.4.6 src/sys/dev/usb/usbdevs:1.770.4.7
--- src/sys/dev/usb/usbdevs:1.770.4.6	Wed Apr 29 13:53:51 2020
+++ src/sys/dev/usb/usbdevs	Thu Feb  4 19:23:10 2021
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.6 2020/04/29 13:53:51 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.7 2021/02/04 19:23:10 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -3384,7 +3384,9 @@ product TOSHIBA HSDPA_MODEM_EU870DT1	0x1
 
 /* TP-Link products */
 product TPLINK RTL8192CU	0x0100	RTL8192CU
-product TPLINK RTL8192EU	0x0109	RTL8192EU
+product	TPLINK WN821NV5		0x0107	TL-WN821N v5
+product	TPLINK WN822NV4		0x0108	TL-WN822N v4
+product	TPLINK WN823NV2		0x0109	TL-WN823N v2
 product TPLINK RTL8188EU	0x010c	RTL8188EU
 
 /* Trek Technology products */



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

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 19:16:02 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: uhid.c uhidev.c uhidev.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1196):

sys/dev/usb/uhid.c: revision 1.115
sys/dev/usb/uhidev.h: revision 1.21
sys/dev/usb/uhidev.c: revision 1.79
(all via patch)

usb: Overhaul uhid(4) and uhidev(4) locking.

- uhidev API rules:
  1. Call uhidev_open when you want exclusive use of a report id.
 After it succeeds, you will get interrupts.
  2. Call uhidev_close when done with exclusive use of a report id.
 After it returns, you will no longer get interrupts.
 => uhidev_open/close do not nest.
  3. uhidev_write no longer requires the caller to have exclusive
 access -- if there is a write in progress, it will block
 interruptibly until done.  This way drivers for individual
 report ids need not work separately to coordinate their writes.
  4. You must uhidev_stop to abort any pending writes on the same
 report id.  (uhidev_stop no longer does anything else -- to
 ensure no more interrupts, just use uhidev_close.)
- Fix uhidev_open/close locking -- uhidev now has an interruptible
  config lock held only on first open and last close by any report id
  in the device, to serialize the transition between zero and nonzero
  numbers of references which requires opening/closing pipes and
  allocating/freeing buffers.
- Make /dev/uhidN selnotify(POLLHUP) when the device is yanked.
- Factor uhid device lookup and reference counting and dying
  detection and so on into uhid_enter/exit.
- Nix struct uhid_softc::sc_access_lock.  This served no purpose but
  to confuse me when trying to understand the logic of this beast
  (and to ensure uhidev_write exclusion, but it was uninterruptible,
  which is wrong for something that implements userland operations,
  and didn't actually work because uhidev_write did nothing to
  coordinate between different report ids).
- Fix locking in select/poll.
- Use atomics to manage UHID_IMMED to keep it simple.  (sc_lock would
  be fine too but it makes the code more verbose.)
- Omit needless UHID_ASLP -- cv_broadcast already has this
  micro-optimization.

With these changes, my Pinebook survives

for i in `jot 100`; do
echo '###' $i
for j in `jot 16`; do
usbhidctl -rf /dev/uhid$j >/dev/null &
done
wait
done

while plugging and unplugging uhid(4) devices (U2F keys), and the U2F
keys still work as U2F keys.

ok nick, mrg

XXX pullup-9
XXX pullup-8?

Note on ABI and pullups: This changes the layout of struct
uhidev_softc, but with the sole exception of ucycom(4) -- which at
the moment is completely broken and unusable -- the only members that
USB HID drivers use are sc_udev and sc_iface, which haven't changed.
The layout of struct uhidev, which is allocated by each USB HID
driver in its own softc structure, is unchanged.


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.2 -r1.108.2.3 src/sys/dev/usb/uhid.c
cvs rdiff -u -r1.75 -r1.75.2.1 src/sys/dev/usb/uhidev.c
cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/dev/usb/uhidev.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/usb/uhid.c
diff -u src/sys/dev/usb/uhid.c:1.108.2.2 src/sys/dev/usb/uhid.c:1.108.2.3
--- src/sys/dev/usb/uhid.c:1.108.2.2	Wed Jul 15 14:09:04 2020
+++ src/sys/dev/usb/uhid.c	Thu Feb  4 19:16:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhid.c,v 1.108.2.2 2020/07/15 14:09:04 martin Exp $	*/
+/*	$NetBSD: uhid.c,v 1.108.2.3 2021/02/04 19:16:01 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.108.2.2 2020/07/15 14:09:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.108.2.3 2021/02/04 19:16:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -43,21 +43,24 @@ __KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.1
 #endif
 
 #include 
-#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
 
 #include 
 #include 
@@ -84,8 +87,7 @@ int	uhiddebug = 0;
 struct uhid_softc {
 	struct uhidev sc_hdev;
 
-	kmutex_t sc_access_lock; /* serialises syscall accesses */
-	kmutex_t sc_lock;	/* protects refcnt, others */
+	kmutex_t sc_lock;
 	kcondvar_t sc_cv;
 	kcondvar_t sc_detach_cv;
 
@@ -99,12 +101,12 @@ struct uhid_softc {
 	struct selinfo sc_rsel;
 	proc_t *sc_async;	/* process that wants SIGIO */
 	void *sc_sih;
-	u_char sc_state;	/* driver state */
-#define	UHID_ASLP	0x01	/* waiting for device data */
+	volatile uint32_t sc_state;	/* driver state */
 

CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 19:15:13 UTC 2021

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

Log Message:
make: rename Var_SetWithFlags to Var_SetExpandWithFlags

Add back Var_SetWithFlags for the one call that doesn't need to expand
the name.

Now one of the flags is encoded in the function name while the others
are encoded in VarSetFlags.  This is inconsistent.  Maybe there is a
better way to model the different variants of setting a variable.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.798 -r1.799 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.197 src/usr.bin/make/nonints.h:1.198
--- src/usr.bin/make/nonints.h:1.197	Thu Feb  4 19:00:45 2021
+++ src/usr.bin/make/nonints.h	Thu Feb  4 19:15:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.197 2021/02/04 19:00:45 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.198 2021/02/04 19:15:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -376,6 +376,7 @@ void Global_SetExpand(const char *, cons
 void Var_Set(const char *, const char *, GNode *);
 void Var_SetExpand(const char *, const char *, GNode *);
 void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags);
+void Var_SetExpandWithFlags(const char *, const char *, GNode *, VarSetFlags);
 void Var_Append(const char *, const char *, GNode *);
 void Var_AppendExpand(const char *, const char *, GNode *);
 void Global_Append(const char *, const char *);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.798 src/usr.bin/make/var.c:1.799
--- src/usr.bin/make/var.c:1.798	Thu Feb  4 19:00:45 2021
+++ src/usr.bin/make/var.c	Thu Feb  4 19:15:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.798 2021/02/04 19:00:45 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.799 2021/02/04 19:15:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.798 2021/02/04 19:00:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.799 2021/02/04 19:15:13 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -1001,11 +1001,18 @@ SetVar(const char *name, const char *val
 		VarFreeEnv(v, TRUE);
 }
 
-/* See Var_Set for documentation. */
 void
 Var_SetWithFlags(const char *name, const char *val, GNode *ctxt,
 		 VarSetFlags flags)
 {
+	SetVar(name, val, ctxt, flags);
+}
+
+/* See Var_Set for documentation. */
+void
+Var_SetExpandWithFlags(const char *name, const char *val, GNode *ctxt,
+		 VarSetFlags flags)
+{
 	const char *unexpanded_name = name;
 	FStr varname = FStr_InitRefer(name);
 
@@ -1048,7 +1055,7 @@ Var_Set(const char *name, const char *va
 void
 Var_SetExpand(const char *name, const char *val, GNode *ctxt)
 {
-	Var_SetWithFlags(name, val, ctxt, VAR_SET_NONE);
+	Var_SetExpandWithFlags(name, val, ctxt, VAR_SET_NONE);
 }
 
 void
@@ -1675,7 +1682,8 @@ ModifyWord_Loop(const char *word, SepBuf
 		return;
 
 	args = data;
-	Var_SetWithFlags(args->tvar, word, args->ctx, VAR_SET_NO_EXPORT);
+	/* XXX: The variable name should not be expanded here. */
+	Var_SetExpandWithFlags(args->tvar, word, args->ctx, VAR_SET_NO_EXPORT);
 	(void)Var_Subst(args->str, args->ctx, args->eflags, );
 	/* TODO: handle errors */
 



CVS commit: [netbsd-9] src/share/mk

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 19:05:01 UTC 2021

Modified Files:
src/share/mk [netbsd-9]: bsd.own.mk

Log Message:
Fix editor mishap in previous merge


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1149.2.5 src/share/mk/bsd.own.mk:1.1149.2.6
--- src/share/mk/bsd.own.mk:1.1149.2.5	Thu Feb  4 17:12:10 2021
+++ src/share/mk/bsd.own.mk	Thu Feb  4 19:05:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1149.2.5 2021/02/04 17:12:10 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1149.2.6 2021/02/04 19:05:00 martin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1395,7 +1395,7 @@ ${var}?= no
 # format if USE_PIGZGZIP is enabled.
 .if ${USE_PIGZGZIP} == "no" && \
 		(${MACHINE} == "amd64" || \
-		 ${MACHINE} == "sparc64"
+		 ${MACHINE} == "sparc64")
 USE_XZ_SETS?= yes
 .else
 USE_XZ_SETS?= no



CVS commit: src/usr.bin/make

2021-02-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb  4 19:00:45 UTC 2021

Modified Files:
src/usr.bin/make: nonints.h parse.c var.c

Log Message:
make: rename Var_Set to Var_SetExpand

After doing the textual renaming across all files, I added a new
function Var_Set that does not expand the variable name.  I then undid
the renaming for all calls where the variable name cannot ever contain a
dollar sign.  I omitted the word "Expand" from the textual references in
the unit tests and in the debug logging messages since the focus is
usually on the "Set" part, not on the "Expand".

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.543 -r1.544 src/usr.bin/make/parse.c
cvs rdiff -u -r1.797 -r1.798 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.196 src/usr.bin/make/nonints.h:1.197
--- src/usr.bin/make/nonints.h:1.196	Wed Feb  3 15:08:17 2021
+++ src/usr.bin/make/nonints.h	Thu Feb  4 19:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.196 2021/02/03 15:08:17 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.197 2021/02/04 19:00:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -374,6 +374,7 @@ void Var_Undef(const char *);
 void Global_Set(const char *, const char *);
 void Global_SetExpand(const char *, const char *);
 void Var_Set(const char *, const char *, GNode *);
+void Var_SetExpand(const char *, const char *, GNode *);
 void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags);
 void Var_Append(const char *, const char *, GNode *);
 void Var_AppendExpand(const char *, const char *, GNode *);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.543 src/usr.bin/make/parse.c:1.544
--- src/usr.bin/make/parse.c:1.543	Wed Feb  3 14:33:09 2021
+++ src/usr.bin/make/parse.c	Thu Feb  4 19:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.543 2021/02/03 14:33:09 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.544 2021/02/04 19:00:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.543 2021/02/03 14:33:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.544 2021/02/04 19:00:45 rillig Exp $");
 
 /* types and constants */
 
@@ -1898,13 +1898,13 @@ VarAssign_EvalSubst(const char *name, co
 	 *  apart from making the debug log longer.
 	 */
 	if (!Var_ExistsExpand(name, ctxt))
-		Var_Set(name, "", ctxt);
+		Var_SetExpand(name, "", ctxt);
 
 	(void)Var_Subst(uvalue, ctxt,
 	VARE_WANTRES | VARE_KEEP_DOLLAR | VARE_KEEP_UNDEF, );
 	/* TODO: handle errors */
 
-	Var_Set(name, evalue, ctxt);
+	Var_SetExpand(name, evalue, ctxt);
 
 	*out_avalue = FStr_InitOwn(evalue);
 }
@@ -1927,7 +1927,7 @@ VarAssign_EvalShell(const char *name, co
 	}
 
 	cmdOut = Cmd_Exec(cmd.str, );
-	Var_Set(name, cmdOut, ctxt);
+	Var_SetExpand(name, cmdOut, ctxt);
 	*out_avalue = FStr_InitOwn(cmdOut);
 
 	if (errfmt != NULL)
@@ -1964,7 +1964,7 @@ VarAssign_Eval(const char *name, VarAssi
 			return FALSE;
 
 		/* Normal assignment -- just do it. */
-		Var_Set(name, uvalue, ctxt);
+		Var_SetExpand(name, uvalue, ctxt);
 	}
 
 	*out_TRUE_avalue = avalue;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.797 src/usr.bin/make/var.c:1.798
--- src/usr.bin/make/var.c:1.797	Wed Feb  3 15:08:17 2021
+++ src/usr.bin/make/var.c	Thu Feb  4 19:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.797 2021/02/03 15:08:17 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.798 2021/02/04 19:00:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -80,7 +80,9 @@
  *
  *	Var_End		Clean up the module.
  *
- *	Var_Set		Set the value of the variable, creating it if
+ *	Var_Set
+ *	Var_SetExpand
+ *			Set the value of the variable, creating it if
  *			necessary.
  *
  *	Var_Append
@@ -137,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.797 2021/02/03 15:08:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.798 2021/02/04 19:00:45 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -1026,6 +1028,12 @@ Var_SetWithFlags(const char *name, const
 	FStr_Done();
 }
 
+void
+Var_Set(const char *name, const char *val, GNode *ctxt)
+{
+	SetVar(name, val, ctxt, VAR_SET_NONE);
+}
+
 /*
  * Set the variable name to the value val in the given context.
  *
@@ -1038,7 +1046,7 @@ Var_SetWithFlags(const char *name, const
  *	ctxt		context in which to set it
  */
 void
-Var_Set(const char *name, const char *val, GNode *ctxt)
+Var_SetExpand(const char *name, const char *val, GNode *ctxt)
 {
 	Var_SetWithFlags(name, val, ctxt, VAR_SET_NONE);
 }
@@ -1052,7 +1060,7 @@ Global_Set(const char *name, const char 
 void
 Global_SetExpand(const char *name, const 

CVS commit: [netbsd-9] src/sys/miscfs/procfs

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 17:20:45 UTC 2021

Modified Files:
src/sys/miscfs/procfs [netbsd-9]: procfs_vfsops.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1195):

sys/miscfs/procfs/procfs_vfsops.c: revision 1.110

Fix procfs environ node.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.4.1 src/sys/miscfs/procfs/procfs_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/miscfs/procfs/procfs_vfsops.c
diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.101 src/sys/miscfs/procfs/procfs_vfsops.c:1.101.4.1
--- src/sys/miscfs/procfs/procfs_vfsops.c:1.101	Sat Mar 30 23:28:30 2019
+++ src/sys/miscfs/procfs/procfs_vfsops.c	Thu Feb  4 17:20:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_vfsops.c,v 1.101 2019/03/30 23:28:30 christos Exp $	*/
+/*	$NetBSD: procfs_vfsops.c,v 1.101.4.1 2021/02/04 17:20:45 martin Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.101 2019/03/30 23:28:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.101.4.1 2021/02/04 17:20:45 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -388,6 +388,7 @@ procfs_loadvnode(struct mount *mp, struc
 	case PFSmap:		/* /proc/N/map = -r */
 	case PFSmaps:		/* /proc/N/maps = -r */
 	case PFSauxv:		/* /proc/N/auxv = -r */
+	case PFSenviron:	/* /proc/N/environ = -r */
 		pfs->pfs_mode = S_IRUSR;
 		vp->v_type = VREG;
 		break;
@@ -395,7 +396,6 @@ procfs_loadvnode(struct mount *mp, struc
 	case PFSstatus:		/* /proc/N/status = -r--r--r-- */
 	case PFSstat:		/* /proc/N/stat = -r--r--r-- */
 	case PFScmdline:	/* /proc/N/cmdline = -r--r--r-- */
-	case PFSenviron:	/* /proc/N/environ = -r--r--r-- */
 	case PFSemul:		/* /proc/N/emul = -r--r--r-- */
 	case PFSmeminfo:	/* /proc/meminfo = -r--r--r-- */
 	case PFScpustat:	/* /proc/stat = -r--r--r-- */



CVS commit: [netbsd-9] xsrc/external/mit/libXxf86dga/dist/src

2021-02-04 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Feb  4 17:15:55 UTC 2021

Modified Files:
xsrc/external/mit/libXxf86dga/dist/src [netbsd-9]: XF86DGA.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1194):

external/mit/libXxf86dga/dist/src/XF86DGA.c: revision 1.3

Fix "no output of xdpyinfo(1) on redirect or pipe" problem.

XF86cleanup() in libXxf86dga invoked via atexit(3)
(or __attribute__((__destructor__)) in NetBSD xsrc)
calls _exit(2) directly so fflush(3) via normal exit(3)
is not called.  Analyzed by rin@, ryo@, and soda@:

 https://mail-index.netbsd.org/tech-x11/2021/01/20/msg002192.html

Should be pulled up to netbsd-9.

XXX1: The original XF86cleanup() is not async-signale-safe.
XXX2: XF86DGAGetVideo() implicitly overrides signal handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c

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

Modified files:

Index: xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c
diff -u xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2.2.1
--- xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2	Fri Jan  4 18:59:45 2019
+++ xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c	Thu Feb  4 17:15:55 2021
@@ -650,14 +650,14 @@ static void
 #ifdef __NetBSD__
 __attribute__ ((__destructor__))
 #endif
-XF86cleanup(int sig)
+XF86cleanup_atexit(void)
 {
 ScrPtr sp;
 int i;
 static char beenhere = 0;
 
 if (beenhere)
-	_exit(3);
+	return;
 beenhere = 1;
 
 for (i = 0; i < numScrs; i++) {
@@ -665,6 +665,14 @@ XF86cleanup(int sig)
 	XF86DGADirectVideo(sp->display, sp->screen, 0);
 	XSync(sp->display, False);
 }
+}
+
+static void
+XF86cleanup(int sig)
+{
+/* XXX FIXME XF86cleanup_atexit() is not async-signal-safe */
+XF86cleanup_atexit();
+
 _exit(3);
 }
 
@@ -707,7 +715,7 @@ XF86DGAGetVideo(
 if (!beenHere) {
 	beenHere = 1;
 #ifndef __NetBSD__
-	atexit((void(*)(void))XF86cleanup);
+	atexit((void(*)(void))XF86cleanup_atexit);
 #endif
 	/* one shot XF86cleanup attempts */
 	signal(SIGSEGV, XF86cleanup);



CVS commit: [netbsd-9] src/share/mk

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 17:12:10 UTC 2021

Modified Files:
src/share/mk [netbsd-9]: bsd.own.mk

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1193):

share/mk/bsd.own.mk: revision 1.1229

Switch alpha to USE_XZ_SETS=no, i.e. using gzip for installation sets.

Ok'ed by martin@ in PR/55751.  Maybe worth to pullup to netbsd-9.


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1149.2.4 src/share/mk/bsd.own.mk:1.1149.2.5
--- src/share/mk/bsd.own.mk:1.1149.2.4	Fri Aug 14 11:02:42 2020
+++ src/share/mk/bsd.own.mk	Thu Feb  4 17:12:10 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1149.2.4 2020/08/14 11:02:42 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1149.2.5 2021/02/04 17:12:10 martin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1395,8 +1395,7 @@ ${var}?= no
 # format if USE_PIGZGZIP is enabled.
 .if ${USE_PIGZGZIP} == "no" && \
 		(${MACHINE} == "amd64" || \
-		 ${MACHINE} == "sparc64" || \
-		 ${MACHINE} == "alpha")
+		 ${MACHINE} == "sparc64"
 USE_XZ_SETS?= yes
 .else
 USE_XZ_SETS?= no



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

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 17:04:14 UTC 2021

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvkbd.c if_hvn.c vmbus.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1192):

sys/dev/hyperv/if_hvn.c: revision 1.20 (via patch)
sys/dev/hyperv/hvkbd.c: revision 1.7 (via patch)
sys/dev/hyperv/vmbus.c: revision 1.12 (via patch)

hvkbd(4): Don't wait forever.
vmbus(4): Don't wait forever.
hvn(4): Don't wait forever.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.4.2.6 -r1.4.2.7 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/hyperv/vmbus.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.2.2.2 src/sys/dev/hyperv/hvkbd.c:1.2.2.3
--- src/sys/dev/hyperv/hvkbd.c:1.2.2.2	Sun Nov 24 08:13:07 2019
+++ src/sys/dev/hyperv/hvkbd.c	Thu Feb  4 17:04:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.2.2.2 2019/11/24 08:13:07 martin Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.2.2.3 2021/02/04 17:04:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2.2.2 2019/11/24 08:13:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2.2.3 2021/02/04 17:04:14 martin Exp $");
 
 #include 
 #include 
@@ -365,7 +365,8 @@ hvkbd_connect(struct hvkbd_softc *sc)
 			hvkbd_intr(sc);
 			splx(s);
 		} else
-			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
+			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon",
+			uimax(1, mstohz(1)));
 	} while (--timo > 0 && sc->sc_connected == 0);
 
 	if (timo == 0 && sc->sc_connected == 0) {

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.4.2.6 src/sys/dev/hyperv/if_hvn.c:1.4.2.7
--- src/sys/dev/hyperv/if_hvn.c:1.4.2.6	Fri Dec 11 15:43:16 2020
+++ src/sys/dev/hyperv/if_hvn.c	Thu Feb  4 17:04:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.4.2.6 2020/12/11 15:43:16 martin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.4.2.7 2021/02/04 17:04:14 martin Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.6 2020/12/11 15:43:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.7 2021/02/04 17:04:14 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1054,7 +1054,8 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			if (cold)
 delay(1000);
 			else
-tsleep(cmd, PRIBIO, "nvsout", mstohz(1));
+tsleep(cmd, PRIBIO, "nvsout",
+uimax(1, mstohz(1)));
 		} else if (rv) {
 			DPRINTF("%s: NVSP operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->nvs_type, rv);
@@ -1079,7 +1080,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			splx(s);
 		} else
 			tsleep(sc->sc_nvsrsp, PRIBIO | PCATCH, "nvscmd",
-			mstohz(1));
+			uimax(1, mstohz(1)));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {
@@ -1377,7 +1378,8 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			if (cold)
 delay(1000);
 			else
-tsleep(rc, PRIBIO, "rndisout", mstohz(1));
+tsleep(rc, PRIBIO, "rndisout",
+uimax(1, mstohz(1)));
 		} else if (rv) {
 			DPRINTF("%s: RNDIS operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->rm_type, rv);
@@ -1402,7 +1404,8 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			hvn_nvs_intr(sc);
 			splx(s);
 		} else
-			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
+			tsleep(rc, PRIBIO | PCATCH, "rndiscmd",
+			uimax(1, mstohz(1)));
 	} while (--timo > 0 && rc->rc_done != 1);
 
 	bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,

Index: src/sys/dev/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.4.2.1 src/sys/dev/hyperv/vmbus.c:1.4.2.2
--- src/sys/dev/hyperv/vmbus.c:1.4.2.1	Sun Nov 24 08:13:07 2019
+++ src/sys/dev/hyperv/vmbus.c	Thu Feb  4 17:04:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.4.2.1 2019/11/24 08:13:07 martin Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.4.2.2 2021/02/04 17:04:14 martin Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4.2.1 2019/11/24 08:13:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4.2.2 2021/02/04 17:04:14 martin Exp $");
 
 #include 
 #include 
@@ -604,7 +604,8 @@ vmbus_start(struct vmbus_softc *sc, stru
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wchan, mstohz(delays[i]));
+			tsleep(wchan, PRIBIO, wchan,
+			uimax(1, mstohz(delays[i] / 1000)));
 	}
 	if (status != HYPERCALL_STATUS_SUCCESS) {
 		device_printf(sc->sc_dev,
@@ -667,7 +668,7 @@ vmbus_wait(struct vmbus_softc *sc,
 			splx(s);
 		} else
 			tsleep(wchan, PRIBIO, wmsg ? wmsg : 

CVS commit: [netbsd-9] src/sys/kern

2021-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  4 16:57:25 UTC 2021

Modified Files:
src/sys/kern [netbsd-9]: kern_event.c

Log Message:
Pullup the following (requested by jdolecek in ticket #1191):

sys/kern/kern_event.c   r1.110-1.115 (via patch)

fix a race in kqueue_scan() - when multiple threads check the same
kqueue, it could happen other thread seen empty kqueue while kevent
was being checked for re-firing and re-queued

make sure to keep retrying if there are outstanding kevents even
if no kevent is found on first pass through the queue, and only
kq_count when actually completely done with the kevent

PR kern/50094 by Christof Meerwal

Also fixes timer latency in Go, as reported in
https://github.com/golang/go/issues/42515 by Michael Pratt


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.4.1 src/sys/kern/kern_event.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/kern_event.c
diff -u src/sys/kern/kern_event.c:1.104 src/sys/kern/kern_event.c:1.104.4.1
--- src/sys/kern/kern_event.c:1.104	Tue Nov 13 06:58:14 2018
+++ src/sys/kern/kern_event.c	Thu Feb  4 16:57:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.104 2018/11/13 06:58:14 maxv Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.104.4.1 2021/02/04 16:57:25 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.104 2018/11/13 06:58:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.104.4.1 2021/02/04 16:57:25 martin Exp $");
 
 #include 
 #include 
@@ -166,6 +166,8 @@ static int	kq_calloutmax = (4 * 1024);
 
 extern const struct filterops sig_filtops;
 
+#define KQ_FLUX_WAKEUP(kq)	cv_broadcast(>kq_cv)
+
 /*
  * Table for for all system-defined filters.
  * These should be listed in the numeric order of the EVFILT_* defines.
@@ -1226,7 +1228,10 @@ kqueue_check(const char *func, size_t li
 			}
 			count++;
 			if (count > kq->kq_count) {
-goto bad;
+panic("%s,%zu: kq=%p kq->kq_count(%d) != "
+"count(%d), nmarker=%d",
+				func, line, kq, kq->kq_count, count,
+nmarker);
 			}
 		} else {
 			nmarker++;
@@ -1240,11 +1245,6 @@ kqueue_check(const char *func, size_t li
 #endif
 		}
 	}
-	if (kq->kq_count != count) {
-bad:
-		panic("%s,%zu: kq=%p kq->kq_count(%d) != count(%d), nmarker=%d",
-		func, line, kq, kq->kq_count, count, nmarker);
-	}
 }
 #define kq_check(a) kqueue_check(__func__, __LINE__, (a))
 #else /* defined(DEBUG) */
@@ -1268,7 +1268,7 @@ kqueue_scan(file_t *fp, size_t maxevents
 	struct timespec	ats, sleepts;
 	struct knote	*kn, *marker, morker;
 	size_t		count, nkev, nevents;
-	int		timeout, error, rv;
+	int		timeout, error, rv, influx;
 	filedesc_t	*fdp;
 
 	fdp = curlwp->l_fd;
@@ -1317,119 +1317,140 @@ kqueue_scan(file_t *fp, size_t maxevents
 			}
 		}
 		mutex_spin_exit(>kq_lock);
-	} else {
-		/* mark end of knote list */
-		TAILQ_INSERT_TAIL(>kq_head, marker, kn_tqe);
+		goto done;
+	}
 
-		/*
-		 * Acquire the fdp->fd_lock interlock to avoid races with
-		 * file creation/destruction from other threads.
-		 */
-		mutex_spin_exit(>kq_lock);
-		mutex_enter(>fd_lock);
-		mutex_spin_enter(>kq_lock);
+	/* mark end of knote list */
+	TAILQ_INSERT_TAIL(>kq_head, marker, kn_tqe);
+	influx = 0;
 
-		while (count != 0) {
-			kn = TAILQ_FIRST(>kq_head);	/* get next knote */
-			while ((kn->kn_status & KN_MARKER) != 0) {
-if (kn == marker) {
-	/* it's our marker, stop */
-	TAILQ_REMOVE(>kq_head, kn, kn_tqe);
-	if (count < maxevents || (tsp != NULL &&
-	(timeout = gettimeleft(,
-	)) <= 0))
-		goto done;
-	mutex_exit(>fd_lock);
-	goto retry;
-}
-/* someone else's marker. */
-kn = TAILQ_NEXT(kn, kn_tqe);
+	/*
+	 * Acquire the fdp->fd_lock interlock to avoid races with
+	 * file creation/destruction from other threads.
+	 */
+relock:
+	mutex_spin_exit(>kq_lock);
+	mutex_enter(>fd_lock);
+	mutex_spin_enter(>kq_lock);
+
+	while (count != 0) {
+		kn = TAILQ_FIRST(>kq_head);	/* get next knote */
+
+		if ((kn->kn_status & KN_MARKER) != 0 && kn != marker) {
+			if (influx) {
+influx = 0;
+KQ_FLUX_WAKEUP(kq);
 			}
-			kq_check(kq);
+			mutex_exit(>fd_lock);
+			(void)cv_wait(>kq_cv, >kq_lock);
+			goto relock;
+		}
+
+		TAILQ_REMOVE(>kq_head, kn, kn_tqe);
+		if (kn == marker) {
+			/* it's our marker, stop */
+			KQ_FLUX_WAKEUP(kq);
+			if (count == maxevents) {
+mutex_exit(>fd_lock);
+goto retry;
+			}
+			break;
+		}
+		KASSERT((kn->kn_status & KN_BUSY) == 0);
+
+		kq_check(kq);
+		kn->kn_status &= ~KN_QUEUED;
+		kn->kn_status |= KN_BUSY;
+		kq_check(kq);
+		if (kn->kn_status & KN_DISABLED) {
+			kn->kn_status &= ~KN_BUSY;
 			kq->kq_count--;
-			TAILQ_REMOVE(>kq_head, kn, kn_tqe);
-			kn->kn_status &= ~KN_QUEUED;
-			kn->kn_status |= KN_BUSY;
-			kq_check(kq);
-			if 

CVS commit: src/sys/arch/hppa/gsc

2021-02-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Feb  4 15:08:45 UTC 2021

Modified Files:
src/sys/arch/hppa/gsc: harmony.c

Log Message:
Simplify harmony_speed_bits().
It no longer needs to write back the speed value.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/gsc/harmony.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/hppa/gsc/harmony.c
diff -u src/sys/arch/hppa/gsc/harmony.c:1.9 src/sys/arch/hppa/gsc/harmony.c:1.10
--- src/sys/arch/hppa/gsc/harmony.c:1.9	Thu Feb  4 15:06:11 2021
+++ src/sys/arch/hppa/gsc/harmony.c	Thu Feb  4 15:08:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.9 2021/02/04 15:06:11 isaki Exp $	*/
+/*	$NetBSD: harmony.c,v 1.10 2021/02/04 15:08:44 isaki Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -165,7 +165,7 @@ CFATTACH_DECL_NEW(harmony, sizeof(struct
 int harmony_intr(void *);
 void harmony_intr_enable(struct harmony_softc *);
 void harmony_intr_disable(struct harmony_softc *);
-uint32_t harmony_speed_bits(struct harmony_softc *, u_int *);
+uint32_t harmony_speed_bits(struct harmony_softc *, u_int);
 int harmony_set_gainctl(struct harmony_softc *);
 void harmony_reset_codec(struct harmony_softc *);
 void harmony_start_cp(struct harmony_softc *, int);
@@ -441,7 +441,6 @@ harmony_set_format(void *vsc, int setmod
 {
 	struct harmony_softc *sc;
 	uint32_t bits;
-	int rate;
 
 	sc = vsc;
 
@@ -464,10 +463,7 @@ harmony_set_format(void *vsc, int setmod
 		bits |= CNTL_OLB;
 
 	bits |= CNTL_CHANS_STEREO;
-
-	/* XXX modify harmony_speed_bits() not to rewrite rate */
-	rate = play->sample_rate;
-	bits |= harmony_speed_bits(sc, );
+	bits |= harmony_speed_bits(sc, play->sample_rate);
 	sc->sc_cntlbits = bits;
 	sc->sc_need_commit = 1;
 
@@ -1161,39 +1157,17 @@ static const struct speed_struct {
 };
 
 uint32_t
-harmony_speed_bits(struct harmony_softc *sc, u_int *speedp)
+harmony_speed_bits(struct harmony_softc *sc, u_int speed)
 {
-	int i, n, selected;
-
-	selected = -1;
-	n = sizeof(harmony_speeds) / sizeof(harmony_speeds[0]);
+	int i;
 
-	if ((*speedp) <= harmony_speeds[0].speed)
-		selected = 0;
-	else if ((*speedp) >= harmony_speeds[n - 1].speed)
-		selected = n - 1;
-	else {
-		for (i = 1; selected == -1 && i < n; i++) {
-			if ((*speedp) == harmony_speeds[i].speed)
-selected = i;
-			else if ((*speedp) < harmony_speeds[i].speed) {
-int diff1, diff2;
-
-diff1 = (*speedp) - harmony_speeds[i - 1].speed;
-diff2 = harmony_speeds[i].speed - (*speedp);
-if (diff1 < diff2)
-	selected = i - 1;
-else
-	selected = i;
-			}
+	for (i = 0; i < __arraycount(harmony_speeds); i++) {
+		if (speed == harmony_speeds[i].speed) {
+			return harmony_speeds[i].bits;
 		}
 	}
-
-	if (selected == -1)
-		selected = 2;
-
-	*speedp = harmony_speeds[selected].speed;
-	return harmony_speeds[selected].bits;
+	/* If this happens, harmony_formats[] is wrong */
+	panic("speed %u not supported", speed);
 }
 
 int



CVS commit: src/sys/arch/hppa/gsc

2021-02-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Feb  4 15:06:11 UTC 2021

Modified Files:
src/sys/arch/hppa/gsc: harmony.c

Log Message:
Fix my mistakes in rev1.6.
- I had to merge the channel bit and the speed bits.
  Reported by macallan@.
- I also fix my indent, while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/gsc/harmony.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/hppa/gsc/harmony.c
diff -u src/sys/arch/hppa/gsc/harmony.c:1.8 src/sys/arch/hppa/gsc/harmony.c:1.9
--- src/sys/arch/hppa/gsc/harmony.c:1.8	Wed Feb  3 15:13:49 2021
+++ src/sys/arch/hppa/gsc/harmony.c	Thu Feb  4 15:06:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.8 2021/02/03 15:13:49 isaki Exp $	*/
+/*	$NetBSD: harmony.c,v 1.9 2021/02/04 15:06:11 isaki Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -437,7 +437,7 @@ harmony_query_format(void *vsc, audio_fo
 int
 harmony_set_format(void *vsc, int setmode,
 const audio_params_t *play, const audio_params_t *rec,
-	audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
+audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
 {
 	struct harmony_softc *sc;
 	uint32_t bits;
@@ -467,7 +467,8 @@ harmony_set_format(void *vsc, int setmod
 
 	/* XXX modify harmony_speed_bits() not to rewrite rate */
 	rate = play->sample_rate;
-	sc->sc_cntlbits |= harmony_speed_bits(sc, );
+	bits |= harmony_speed_bits(sc, );
+	sc->sc_cntlbits = bits;
 	sc->sc_need_commit = 1;
 
 	return 0;



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

2021-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  4 08:51:42 UTC 2021

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
Use t9 instead of $25 in the SETUP_GP64 macro to hopefully make things
a bit clearer.  Same libc binary after.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mips/include/asm.h

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

Modified files:

Index: src/sys/arch/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.62 src/sys/arch/mips/include/asm.h:1.63
--- src/sys/arch/mips/include/asm.h:1.62	Sat Sep 26 08:19:11 2020
+++ src/sys/arch/mips/include/asm.h	Thu Feb  4 08:51:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.62 2020/09/26 08:19:11 simonb Exp $	*/
+/*	$NetBSD: asm.h,v 1.63 2021/02/04 08:51:42 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -619,7 +619,7 @@ _C_LABEL(x):
 #define	SETUP_GPX(r)		/* o32 specific */
 #define	SETUP_GPX_L(r,lbl)	/* o32 specific */
 #define	SAVE_GP(x)		/* o32 specific */
-#define	SETUP_GP64(a,b)		.cpsetup $25, a, b
+#define	SETUP_GP64(a,b)		.cpsetup t9, a, b
 #define	SETUP_GPX64(a,b)	\
 .set push;			\
 move	b,ra;			\