CVS commit: src/sys/dev/ic

2021-01-29 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Jan 30 07:53:01 UTC 2021

Modified Files:
src/sys/dev/ic: gem.c gemvar.h

Log Message:
Improve handling of receive overflows.  When we get an overflow, don't
reset the chip if we are still receiving packets.  Real overflows can
happen when network and CPU(s) are loaded, so the reset is not needed
in this case.
Add a counter to track receive overflows (when GEM_COUNTERS is defined).

This reverts some changes (always reset on overflow) from
PR port-sparc64/46260.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/ic/gem.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/gemvar.h

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

Modified files:

Index: src/sys/dev/ic/gem.c
diff -u src/sys/dev/ic/gem.c:1.132 src/sys/dev/ic/gem.c:1.133
--- src/sys/dev/ic/gem.c:1.132	Tue Sep 15 08:33:40 2020
+++ src/sys/dev/ic/gem.c	Sat Jan 30 07:53:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.132 2020/09/15 08:33:40 mrg Exp $ */
+/*	$NetBSD: gem.c,v 1.133 2021/01/30 07:53:01 jdc Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.132 2020/09/15 08:33:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.133 2021/01/30 07:53:01 jdc Exp $");
 
 #include "opt_inet.h"
 
@@ -169,6 +169,7 @@ gem_detach(struct gem_softc *sc, int fla
 		evcnt_detach(>sc_ev_rxfull);
 		evcnt_detach(>sc_ev_rxint);
 		evcnt_detach(>sc_ev_txint);
+		evcnt_detach(>sc_ev_rxoverflow);
 #endif
 		evcnt_detach(>sc_ev_intr);
 
@@ -596,6 +597,8 @@ gem_attach(struct gem_softc *sc, const u
 	>sc_ev_rxint, device_xname(sc->sc_dev), "rx ring full");
 	evcnt_attach_dynamic(>sc_ev_rxnobuf, EVCNT_TYPE_INTR,
 	>sc_ev_rxint, device_xname(sc->sc_dev), "rx malloc failure");
+	evcnt_attach_dynamic(>sc_ev_rxoverflow, EVCNT_TYPE_INTR,
+	>sc_ev_rxint, device_xname(sc->sc_dev), "rx overflow");
 	evcnt_attach_dynamic(>sc_ev_rxhist[0], EVCNT_TYPE_INTR,
 	>sc_ev_rxint, device_xname(sc->sc_dev), "rx 0desc");
 	evcnt_attach_dynamic(>sc_ev_rxhist[1], EVCNT_TYPE_INTR,
@@ -1803,8 +1806,8 @@ gem_rint(struct gem_softc *sc)
 
 		if (rxstat & GEM_RD_BAD_CRC) {
 			if_statinc(ifp, if_ierrors);
-			aprint_error_dev(sc->sc_dev,
-			"receive error: CRC error\n");
+			DPRINTF(sc, ("%s: receive error: CRC error\n",
+			device_xname(sc->sc_dev)));
 			GEM_INIT_RXDESC(sc, i);
 			continue;
 		}
@@ -2215,8 +2218,11 @@ gem_intr(void *v)
 		 */
 		if (rxstat & GEM_MAC_RX_OVERFLOW) {
 			if_statinc(ifp, if_ierrors);
+			GEM_COUNTER_INCR(sc, sc_ev_rxoverflow);
+#ifdef GEM_DEBUG
 			aprint_error_dev(sc->sc_dev,
 			"receive error: RX overflow sc->rxptr %d, complete %d\n", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION));
+#endif
 			sc->sc_rx_fifo_wr_ptr =
 bus_space_read_4(t, h, GEM_RX_FIFO_WR_PTR);
 			sc->sc_rx_fifo_rd_ptr =
@@ -2282,25 +2288,33 @@ gem_rx_watchdog(void *arg)
 		"receiver stuck in overflow, resetting\n");
 		gem_init(ifp);
 	} else {
+		int needreset = 1;
 		if ((state & GEM_MAC_STATE_OVERFLOW) != GEM_MAC_STATE_OVERFLOW) {
-			aprint_error_dev(sc->sc_dev,
-"rx_watchdog: not in overflow state: 0x%x\n",
-state);
+			DPRINTF(sc,
+			("%s: rx_watchdog: not in overflow state: 0x%x\n",
+			device_xname(sc->sc_dev), state));
 		}
 		if (rx_fifo_wr_ptr != rx_fifo_rd_ptr) {
-			aprint_error_dev(sc->sc_dev,
-"rx_watchdog: wr & rd ptr different\n");
+			DPRINTF(sc,
+			("%s: rx_watchdog: wr & rd ptr different\n",
+			device_xname(sc->sc_dev), state));
+			needreset = 0;
 		}
 		if (sc->sc_rx_fifo_wr_ptr != rx_fifo_wr_ptr) {
-			aprint_error_dev(sc->sc_dev,
-"rx_watchdog: wr pointer != saved\n");
+			DPRINTF(sc, ("%s: rx_watchdog: wr pointer != saved\n",
+			device_xname(sc->sc_dev), state));
+			needreset = 0;
 		}
 		if (sc->sc_rx_fifo_rd_ptr != rx_fifo_rd_ptr) {
+			DPRINTF(sc, ("%s: rx_watchdog: rd pointer != saved\n",
+			device_xname(sc->sc_dev), state));
+			needreset = 0;
+		}
+		if (needreset) {
 			aprint_error_dev(sc->sc_dev,
-"rx_watchdog: rd pointer != saved\n");
+			"rx_watchdog: resetting anyway\n");
+			gem_init(ifp);
 		}
-		aprint_error_dev(sc->sc_dev, "resetting anyway\n");
-		gem_init(ifp);
 	}
 }
 

Index: src/sys/dev/ic/gemvar.h
diff -u src/sys/dev/ic/gemvar.h:1.27 src/sys/dev/ic/gemvar.h:1.28
--- src/sys/dev/ic/gemvar.h:1.27	Sun Mar  1 05:50:56 2020
+++ src/sys/dev/ic/gemvar.h	Sat Jan 30 07:53:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gemvar.h,v 1.27 2020/03/01 05:50:56 thorpej Exp $ */
+/*	$NetBSD: gemvar.h,v 1.28 2021/01/30 07:53:01 jdc Exp $ */
 
 /*
  *
@@ -219,6 +219,7 @@ struct gem_softc {
 #ifdef GEM_COUNTERS
 	struct evcnt sc_ev_txint;
 	struct evcnt sc_ev_rxint;
+	struct evcnt sc_ev_rxoverflow;
 	struct evcnt sc_ev_rxnobuf;
 	struct evcnt sc_ev_rxfull;
 	struct evcnt sc_ev_rxhist[9];



CVS commit: src/sys/dev/i2c

2021-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 30 01:23:08 UTC 2021

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

Log Message:
Add a proper compat string for this device, following the standard
conventions.


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

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

Modified files:

Index: src/sys/dev/i2c/sgsmix.c
diff -u src/sys/dev/i2c/sgsmix.c:1.9 src/sys/dev/i2c/sgsmix.c:1.10
--- src/sys/dev/i2c/sgsmix.c:1.9	Sat Jun 16 21:22:13 2018
+++ src/sys/dev/i2c/sgsmix.c	Sat Jan 30 01:23:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sgsmix.c,v 1.9 2018/06/16 21:22:13 thorpej Exp $	*/
+/*	$NetBSD: sgsmix.c,v 1.10 2021/01/30 01:23:08 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sgsmix.c,v 1.9 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgsmix.c,v 1.10 2021/01/30 01:23:08 thorpej Exp $");
 
 #include 
 #include 
@@ -75,6 +75,11 @@ static void sgsmix_writereg(struct sgsmi
 CFATTACH_DECL_NEW(sgsmix, sizeof(struct sgsmix_softc),
 sgsmix_match, sgsmix_attach, NULL, NULL);
 
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "st,tda7433" },
+	DEVICE_COMPAT_EOL
+};
+
 static int
 sgsmix_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -83,7 +88,7 @@ sgsmix_match(device_t parent, cfdata_t c
 	uint8_t out[2] = {1, 0x20};
 	int match_result;
 
-	if (iic_use_direct_match(args, cf, NULL, _result))
+	if (iic_use_direct_match(args, cf, compat_data, _result))
 		return match_result;
 
 	/* see if we can talk to something at address 0x8a */



CVS commit: src/sys/dev/i2c

2021-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 30 01:22:06 UTC 2021

Modified Files:
src/sys/dev/i2c: adm1021.c dbcool.c dstemp.c lm75.c

Log Message:
If we're going to keep a reference on the "props" dictionary from
the i2c_attach_args, we should retain it.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/i2c/adm1021.c
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/i2c/dbcool.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/dstemp.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/i2c/lm75.c

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

Modified files:

Index: src/sys/dev/i2c/adm1021.c
diff -u src/sys/dev/i2c/adm1021.c:1.26 src/sys/dev/i2c/adm1021.c:1.27
--- src/sys/dev/i2c/adm1021.c:1.26	Thu Jan 28 14:35:11 2021
+++ src/sys/dev/i2c/adm1021.c	Sat Jan 30 01:22:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: adm1021.c,v 1.26 2021/01/28 14:35:11 thorpej Exp $ */
+/*	$NetBSD: adm1021.c,v 1.27 2021/01/30 01:22:06 thorpej Exp $ */
 /*	$OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.26 2021/01/28 14:35:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.27 2021/01/30 01:22:06 thorpej Exp $");
 
 #include 
 #include 
@@ -342,6 +342,7 @@ admtemp_attach(device_t parent, device_t
 	sc->sc_tag = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
 	sc->sc_prop = ia->ia_prop;
+	prop_object_retain(sc->sc_prop);
 
 	iic_acquire_bus(sc->sc_tag, 0);
 	cmd = ADM1021_CONFIG_READ;

Index: src/sys/dev/i2c/dbcool.c
diff -u src/sys/dev/i2c/dbcool.c:1.59 src/sys/dev/i2c/dbcool.c:1.60
--- src/sys/dev/i2c/dbcool.c:1.59	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/dbcool.c	Sat Jan 30 01:22:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbcool.c,v 1.59 2021/01/27 02:29:48 thorpej Exp $ */
+/*	$NetBSD: dbcool.c,v 1.60 2021/01/30 01:22:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.59 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.60 2021/01/30 01:22:06 thorpej Exp $");
 
 #include 
 #include 
@@ -776,6 +776,7 @@ dbcool_attach(device_t parent, device_t 
 	sc->sc_dc.dc_writereg = dbcool_writereg;
 	sc->sc_dev = self;
 	sc->sc_prop = args->ia_prop;
+	prop_object_retain(sc->sc_prop);
 
 	if (dbcool_chip_ident(>sc_dc) < 0 || sc->sc_dc.dc_chip == NULL)
 		panic("could not identify chip at addr %d", args->ia_addr);

Index: src/sys/dev/i2c/dstemp.c
diff -u src/sys/dev/i2c/dstemp.c:1.9 src/sys/dev/i2c/dstemp.c:1.10
--- src/sys/dev/i2c/dstemp.c:1.9	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/dstemp.c	Sat Jan 30 01:22:06 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: dstemp.c,v 1.9 2021/01/27 02:29:48 thorpej Exp $ */
+/* $NetBSD: dstemp.c,v 1.10 2021/01/30 01:22:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.9 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.10 2021/01/30 01:22:06 thorpej Exp $");
 
 #include 
 #include 
@@ -109,6 +109,7 @@ dstemp_attach(device_t parent, device_t 
 	sc->sc_i2c = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
 	sc->sc_prop = ia->ia_prop;
+	prop_object_retain(sc->sc_prop);
 
 	aprint_naive("\n");
 	aprint_normal(": DS1361\n");

Index: src/sys/dev/i2c/lm75.c
diff -u src/sys/dev/i2c/lm75.c:1.39 src/sys/dev/i2c/lm75.c:1.40
--- src/sys/dev/i2c/lm75.c:1.39	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/lm75.c	Sat Jan 30 01:22:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm75.c,v 1.39 2021/01/27 02:29:48 thorpej Exp $	*/
+/*	$NetBSD: lm75.c,v 1.40 2021/01/30 01:22:06 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.39 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.40 2021/01/30 01:22:06 thorpej Exp $");
 
 #include 
 #include 
@@ -188,6 +188,7 @@ lmtemp_attach(device_t parent, device_t 
 	sc->sc_tag = ia->ia_tag;
 	sc->sc_address = ia->ia_addr;
 	sc->sc_prop = ia->ia_prop;
+	prop_object_retain(sc->sc_prop);
 
 	aprint_naive(": Temperature Sensor\n");
 	if (ia->ia_name) {



CVS commit: src/usr.bin/make

2021-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 29 23:45:35 UTC 2021

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

Log Message:
make(1): explain seemingly redundant condition in jobs mode


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 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.401 src/usr.bin/make/job.c:1.402
--- src/usr.bin/make/job.c:1.401	Fri Jan 29 23:33:24 2021
+++ src/usr.bin/make/job.c	Fri Jan 29 23:45:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.401 2021/01/29 23:33:24 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.402 2021/01/29 23:45:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.401 2021/01/29 23:33:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.402 2021/01/29 23:45:35 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1672,9 +1672,11 @@ JobStart(GNode *gn, Boolean special)
 	} else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
 	(!opts.noExecute && !opts.touchFlag)) {
 		/*
-		 * XXX: The above conditions seem needlessly repeated but
-		 * are subtly different.
+		 * The above conditions look very similar to
+		 * GNode_ShouldExecute but are subtly different.
+		 * They prevent that .MAKE targets are touched.
 		 */
+
 		JobWriteShellCommands(job, gn, cmdsOK, );
 		(void)fflush(job->cmdFILE);
 	} else if (!GNode_ShouldExecute(gn)) {



CVS commit: src/usr.bin/make

2021-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 29 23:33:24 UTC 2021

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

Log Message:
make(1): remove unnecessary fflush for empty shell files

If nothing is done to any file, there is no need to flush stdout.  Move
the call to each of the remaining branches, except for -t mode, where
Job_Touch already takes care of everything.


To generate a diff of this commit:
cvs rdiff -u -r1.400 -r1.401 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.400 src/usr.bin/make/job.c:1.401
--- src/usr.bin/make/job.c:1.400	Fri Jan 29 23:06:41 2021
+++ src/usr.bin/make/job.c	Fri Jan 29 23:33:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.400 2021/01/29 23:06:41 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.401 2021/01/29 23:33:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.400 2021/01/29 23:06:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.401 2021/01/29 23:33:24 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1667,13 +1667,16 @@ JobStart(GNode *gn, Boolean special)
 	 * flag *was* given, we just set the file to be stdout. Cute, huh?
 	 */
 	if (Lst_IsEmpty(>commands)) {
-		/* XXX: No need to flush stdout here */
 		job->cmdFILE = stdout;
 		run = FALSE;
 	} else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
 	(!opts.noExecute && !opts.touchFlag)) {
-		/* XXX: The above conditions are needlessly repeated */
+		/*
+		 * XXX: The above conditions seem needlessly repeated but
+		 * are subtly different.
+		 */
 		JobWriteShellCommands(job, gn, cmdsOK, );
+		(void)fflush(job->cmdFILE);
 	} else if (!GNode_ShouldExecute(gn)) {
 		/*
 		 * Not executing anything -- just print all the commands to
@@ -1692,6 +1695,7 @@ JobStart(GNode *gn, Boolean special)
 			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
@@ -1701,8 +1705,6 @@ JobStart(GNode *gn, Boolean special)
 		Job_Touch(gn, job->echo);
 		run = FALSE;
 	}
-	/* Just in case it isn't already... */
-	(void)fflush(job->cmdFILE);
 
 	/* If we're not supposed to execute a shell, don't. */
 	if (!run) {



CVS commit: src/usr.bin/make

2021-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 29 23:06:41 UTC 2021

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

Log Message:
make(1): rename JobOpenTmpFile to JobWriteShellCommands

The old name didn't reflect that the function not only opens the
temporary file for writing but also actually writes the shell commands
to that file.


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 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.399 src/usr.bin/make/job.c:1.400
--- src/usr.bin/make/job.c:1.399	Fri Jan 29 22:52:29 2021
+++ src/usr.bin/make/job.c	Fri Jan 29 23:06:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.399 2021/01/29 22:52:29 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.400 2021/01/29 23:06:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.399 2021/01/29 22:52:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.400 2021/01/29 23:06:41 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1557,7 +1557,7 @@ JobMakeArgv(Job *job, char **argv)
 }
 
 static void
-JobOpenTmpFile(Job *job, GNode *gn, Boolean cmdsOK, Boolean *out_run)
+JobWriteShellCommands(Job *job, GNode *gn, Boolean cmdsOK, Boolean *out_run)
 {
 	/*
 	 * tfile is the name of a file into which all shell commands
@@ -1673,7 +1673,7 @@ JobStart(GNode *gn, Boolean special)
 	} else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
 	(!opts.noExecute && !opts.touchFlag)) {
 		/* XXX: The above conditions are needlessly repeated */
-		JobOpenTmpFile(job, gn, cmdsOK, );
+		JobWriteShellCommands(job, gn, cmdsOK, );
 	} else if (!GNode_ShouldExecute(gn)) {
 		/*
 		 * Not executing anything -- just print all the commands to
@@ -1696,8 +1696,6 @@ JobStart(GNode *gn, Boolean special)
 		/*
 		 * Just touch the target and note that no shell should be
 		 * executed. Set cmdFILE to stdout to make life easier.
-		 * Check the commands, too, but don't die if they're no
-		 * good -- it does no harm to keep working up the graph.
 		 */
 		job->cmdFILE = stdout;
 		Job_Touch(gn, job->echo);



CVS commit: src/usr.bin/make

2021-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 29 22:52:29 UTC 2021

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

Log Message:
make(1): do not create empty shell files in jobs mode

In a chain of dependencies such as "all: build; build: do-build", the
intermediate targets do not have any commands.  In jobs mode,
nevertheless, an empty file was created and fed to the shell.  This was
unnecessary.  See jobs-empty-commands.mk.

The case of the special command line "...", which was suggested on
current-users, is not optimized since it doesn't occur in practice.

Suggested by Mateusz Guzik on current-users:
https://mail-index.netbsd.org/current-users/2021/01/26/msg040215.html


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 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.398 src/usr.bin/make/job.c:1.399
--- src/usr.bin/make/job.c:1.398	Tue Jan 19 20:51:46 2021
+++ src/usr.bin/make/job.c	Fri Jan 29 22:52:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.398 2021/01/19 20:51:46 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.399 2021/01/29 22:52:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.398 2021/01/19 20:51:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.399 2021/01/29 22:52:29 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1666,8 +1666,13 @@ JobStart(GNode *gn, Boolean special)
 	 * we don't need to reopen it to feed it to the shell. If the -n
 	 * flag *was* given, we just set the file to be stdout. Cute, huh?
 	 */
-	if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
+	if (Lst_IsEmpty(>commands)) {
+		/* XXX: No need to flush stdout here */
+		job->cmdFILE = stdout;
+		run = FALSE;
+	} else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
 	(!opts.noExecute && !opts.touchFlag)) {
+		/* XXX: The above conditions are needlessly repeated */
 		JobOpenTmpFile(job, gn, cmdsOK, );
 	} else if (!GNode_ShouldExecute(gn)) {
 		/*



CVS commit: src

2021-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 29 22:38:17 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: jobs-empty-commands.exp
jobs-empty-commands.mk

Log Message:
make(1): demonstrate unnecessary creation of empty files in jobs mode


To generate a diff of this commit:
cvs rdiff -u -r1.1012 -r1.1013 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.262 -r1.263 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/jobs-empty-commands.exp \
src/usr.bin/make/unit-tests/jobs-empty-commands.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1012 src/distrib/sets/lists/tests/mi:1.1013
--- src/distrib/sets/lists/tests/mi:1.1012	Sun Jan 17 23:00:41 2021
+++ src/distrib/sets/lists/tests/mi	Fri Jan 29 22:38:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1012 2021/01/17 23:00:41 rillig Exp $
+# $NetBSD: mi,v 1.1013 2021/01/29 22:38:17 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5146,6 +5146,8 @@
 ./usr/tests/usr.bin/make/unit-tests/job-flags.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-nested-make.exp			tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.262 src/usr.bin/make/unit-tests/Makefile:1.263
--- src/usr.bin/make/unit-tests/Makefile:1.262	Sat Jan 23 07:34:00 2021
+++ src/usr.bin/make/unit-tests/Makefile	Fri Jan 29 22:38:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.262 2021/01/23 07:34:00 rillig Exp $
+# $NetBSD: Makefile,v 1.263 2021/01/29 22:38:17 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -201,6 +201,7 @@ TESTS+=		impsrc
 TESTS+=		include-main
 TESTS+=		job-flags
 TESTS+=		job-output-long-lines
+TESTS+=		jobs-empty-commands
 TESTS+=		jobs-error-indirect
 TESTS+=		jobs-error-nested
 TESTS+=		jobs-error-nested-make

Added files:

Index: src/usr.bin/make/unit-tests/jobs-empty-commands.exp
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-empty-commands.exp:1.1
--- /dev/null	Fri Jan 29 22:38:17 2021
+++ src/usr.bin/make/unit-tests/jobs-empty-commands.exp	Fri Jan 29 22:38:17 2021
@@ -0,0 +1,2 @@
+action
+exit status 0
Index: src/usr.bin/make/unit-tests/jobs-empty-commands.mk
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-empty-commands.mk:1.1
--- /dev/null	Fri Jan 29 22:38:17 2021
+++ src/usr.bin/make/unit-tests/jobs-empty-commands.mk	Fri Jan 29 22:38:17 2021
@@ -0,0 +1,17 @@
+# $NetBSD: jobs-empty-commands.mk,v 1.1 2021/01/29 22:38:17 rillig Exp $
+#
+# In jobs mode, the shell commands for creating a target are written to a
+# temporary file first, which is then run by the shell.  In chains of
+# dependencies, these files would end up empty.  This can be avoided easily.
+#
+# https://mail-index.netbsd.org/current-users/2021/01/26/msg040215.html
+
+.MAKEFLAGS: -j1
+#.MAKEFLAGS: -dn		# to see the created temporary files
+
+all: .PHONY step-1
+.for i i_plus_1 in ${:U:range=100:@i@$i $i@:[2..199]}
+step-$i: .PHONY step-${i_plus_1}
+.endfor
+step-100: .PHONY
+	@echo 'action'



CVS commit: [netbsd-9] src/doc

2021-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 29 21:01:53 UTC 2021

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

Log Message:
Tickets #1189 and #1190


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.37 -r1.1.2.38 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.37 src/doc/CHANGES-9.2:1.1.2.38
--- src/doc/CHANGES-9.2:1.1.2.37	Mon Jan 25 14:16:00 2021
+++ src/doc/CHANGES-9.2	Fri Jan 29 21:01:53 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.37 2021/01/25 14:16:00 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.38 2021/01/29 21:01:53 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1426,3 +1426,17 @@ sys/arch/arm/broadcom/bcm2835_vcaudio.c	
 	vcaudio: make vcaudio accurately report lack of CAPTURE.
 	[nia, ticket #1188]
 
+usr.bin/progress/progress.c			1.23
+
+	PR 55914: progress(1): handle EINTR in writes.
+	[lukem, ticket #1189]
+
+usr.bin/ftp/ftp.c1.171
+usr.bin/ftp/progressbar.c			1.24
+usr.bin/ftp/progressbar.h			1.9
+usr.bin/ftp/ssl.c1.9
+usr.bin/ftp/version.h1.92
+
+	PR 55857: ftp(1): don't use restartable signals.
+	[lukem, ticket #1190]
+



CVS commit: [netbsd-9] src/usr.bin/ftp

2021-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 29 20:58:19 UTC 2021

Modified Files:
src/usr.bin/ftp [netbsd-9]: ftp.c progressbar.c progressbar.h ssl.c
version.h

Log Message:
Pull up following revision(s) (requested by lukem in ticket #1190):

usr.bin/ftp/progressbar.c: revision 1.24
usr.bin/ftp/ssl.c: revision 1.9
usr.bin/ftp/progressbar.h: revision 1.9
usr.bin/ftp/ftp.c: revision 1.171
usr.bin/ftp/version.h: revision 1.92

ftp: don't use restartable signals

Refactor to not rely upon restartable signals (SA_RESTART),
possibly fixing intermittent failures with -q QUITTIME.
ftp transfers: handle EINTR/EAGAIN in copy_bytes(),
instead of relying upon restartable signals.

http/https transfers: Explicitly print an error similar to
progressmeter() when timing-out for -Q QUITTIME in fetch_wait(),
and set errno to ETIMEDOUT so that the warn() in fetch_url()
prints a more accurate error message.

PR/55857


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.168.2.1 src/usr.bin/ftp/ftp.c
cvs rdiff -u -r1.23 -r1.23.2.1 src/usr.bin/ftp/progressbar.c
cvs rdiff -u -r1.8 -r1.8.48.1 src/usr.bin/ftp/progressbar.h
cvs rdiff -u -r1.8 -r1.8.2.1 src/usr.bin/ftp/ssl.c
cvs rdiff -u -r1.87 -r1.87.18.1 src/usr.bin/ftp/version.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/ftp/ftp.c
diff -u src/usr.bin/ftp/ftp.c:1.168 src/usr.bin/ftp/ftp.c:1.168.2.1
--- src/usr.bin/ftp/ftp.c:1.168	Mon Feb  4 04:09:13 2019
+++ src/usr.bin/ftp/ftp.c	Fri Jan 29 20:58:19 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: ftp.c,v 1.168 2019/02/04 04:09:13 mrg Exp $	*/
+/*	$NetBSD: ftp.c,v 1.168.2.1 2021/01/29 20:58:19 martin Exp $	*/
 
 /*-
- * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -92,7 +92,7 @@
 #if 0
 static char sccsid[] = "@(#)ftp.c	8.6 (Berkeley) 10/27/94";
 #else
-__RCSID("$NetBSD: ftp.c,v 1.168 2019/02/04 04:09:13 mrg Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.168.2.1 2021/01/29 20:58:19 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -578,7 +578,7 @@ abortxfer(int notused)
 
 /*
  * Read data from infd & write to outfd, using buf/bufsize as the temporary
- * buffer, dealing with short writes.
+ * buffer, dealing with short reads or writes.
  * If rate_limit != 0, rate-limit the transfer.
  * If hash_interval != 0, fputc('c', ttyout) every hash_interval bytes.
  * Updates global variables: bytes.
@@ -612,15 +612,25 @@ copy_bytes(int infd, int outfd, char *bu
 		bufrem = bufchunk;
 		while (bufrem > 0) {
 			inc = read(infd, buf, MIN((off_t)bufsize, bufrem));
-			if (inc <= 0)
+			if (inc < 0) {
+if (errno == EINTR || errno == EAGAIN) {
+	continue;
+}
+goto copy_done;
+			} else if (inc == 0) {
 goto copy_done;
+			}
 			bytes += inc;
 			bufrem -= inc;
 			bufp = buf;
 			while (inc > 0) {
 outc = write(outfd, bufp, inc);
-if (outc < 0)
+if (outc < 0) {
+	if (errno == EINTR || errno == EAGAIN) {
+		continue;
+	}
 	goto copy_done;
+}
 inc -= outc;
 bufp += outc;
 			}

Index: src/usr.bin/ftp/progressbar.c
diff -u src/usr.bin/ftp/progressbar.c:1.23 src/usr.bin/ftp/progressbar.c:1.23.2.1
--- src/usr.bin/ftp/progressbar.c:1.23	Sat Jun 22 23:40:33 2019
+++ src/usr.bin/ftp/progressbar.c	Fri Jan 29 20:58:19 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: progressbar.c,v 1.23 2019/06/22 23:40:33 christos Exp $	*/
+/*	$NetBSD: progressbar.c,v 1.23.2.1 2021/01/29 20:58:19 martin Exp $	*/
 
 /*-
- * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: progressbar.c,v 1.23 2019/06/22 23:40:33 christos Exp $");
+__RCSID("$NetBSD: progressbar.c,v 1.23.2.1 2021/01/29 20:58:19 martin Exp $");
 #endif /* not lint */
 
 /*
@@ -193,7 +193,7 @@ progressmeter(int flag)
 	if (quit_time > 0 || progress) {
 #endif /* !STANDALONE_PROGRESS */
 		if (flag == -1) {
-			(void)xsignal_restart(SIGALRM, updateprogressmeter, 1);
+			(void)xsignal(SIGALRM, updateprogressmeter);
 			alarmtimer(1);		/* set alarm timer for 1 Hz */
 		} else if (flag == 1) {
 			alarmtimer(0);
@@ -404,73 +404,21 @@ alarmtimer(int wait)
 	setitimer(ITIMER_REAL, , NULL);
 }
 
-
 /*
- * Install a POSIX signal handler, allowing the invoker to set whether
- * the signal should be restartable or not
+ * Install a non-restartable POSIX signal handler.
  */
 sigfunc
-xsignal_restart(int sig, sigfunc func, int restartable)
+xsignal(int sig, sigfunc func)
 {
 	struct sigaction act, oact;
 	act.sa_handler = func;
 
 	sigemptyset(_mask);
-#if defined(SA_RESTART)			/* 4.4BSD, Posix(?), SVR4 */
-	

CVS commit: [netbsd-9] src/usr.bin/progress

2021-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 29 18:27:05 UTC 2021

Modified Files:
src/usr.bin/progress [netbsd-9]: progress.c

Log Message:
Pull up following revision(s) (requested by lukem in ticket #1189):

usr.bin/progress/progress.c: revision 1.23

progress: handle EINTR in writes. PR/55914


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.18.1 src/usr.bin/progress/progress.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/progress/progress.c
diff -u src/usr.bin/progress/progress.c:1.21 src/usr.bin/progress/progress.c:1.21.18.1
--- src/usr.bin/progress/progress.c:1.21	Sat Jan 17 10:57:51 2015
+++ src/usr.bin/progress/progress.c	Fri Jan 29 18:27:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: progress.c,v 1.21 2015/01/17 10:57:51 gson Exp $ */
+/*	$NetBSD: progress.c,v 1.21.18.1 2021/01/29 18:27:05 martin Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: progress.c,v 1.21 2015/01/17 10:57:51 gson Exp $");
+__RCSID("$NetBSD: progress.c,v 1.21.18.1 2021/01/29 18:27:05 martin Exp $");
 #endif/* not lint */
 
 #include 
@@ -237,6 +237,10 @@ main(int argc, char *argv[])
 		for (off = 0; nr; nr -= nw, off += nw, bytes += nw)
 			if ((nw = write(outpipe[1], fb_buf + off,
 			(size_t) nr)) < 0) {
+if (errno == EINTR) {
+	nw = 0;
+	continue;
+}
 progressmeter(1);
 err(1, "writing %u bytes to output pipe",
 			(unsigned) nr);



CVS commit: [netbsd-8] src/doc

2021-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 29 18:19:22 UTC 2021

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

Log Message:
Ticket #1647


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

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.66 src/doc/CHANGES-8.3:1.1.2.67
--- src/doc/CHANGES-8.3:1.1.2.66	Fri Jan  8 13:03:54 2021
+++ src/doc/CHANGES-8.3	Fri Jan 29 18:19:21 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.66 2021/01/08 13:03:54 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.67 2021/01/29 18:19:21 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1525,3 +1525,10 @@ external/bsd/ipf/Makefile.inc			1.6
 	userland is 32bit). Works around missing COMPAT_NETBSD32 for ipf.
 	[simonb, ticket #1646]
 
+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 #1647]
+



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

2021-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 29 18:18:25 UTC 2021

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

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

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.1.4.6 -r1.1.4.7 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.2.2.8 -r1.2.2.9 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.2.2.5 -r1.2.2.6 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.1.4.6 src/sys/dev/hyperv/hvkbd.c:1.1.4.7
--- src/sys/dev/hyperv/hvkbd.c:1.1.4.6	Sun Nov 24 08:11:06 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Jan 29 18:18:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.1.4.6 2019/11/24 08:11:06 martin Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.1.4.7 2021/01/29 18:18:25 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.1.4.6 2019/11/24 08:11:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.1.4.7 2021/01/29 18:18:25 martin Exp $");
 
 #include 
 #include 
@@ -363,7 +363,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",
+			max(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.2.2.8 src/sys/dev/hyperv/if_hvn.c:1.2.2.9
--- src/sys/dev/hyperv/if_hvn.c:1.2.2.8	Fri Dec 11 15:48:02 2020
+++ src/sys/dev/hyperv/if_hvn.c	Fri Jan 29 18:18:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.2.2.8 2020/12/11 15:48:02 martin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.2.2.9 2021/01/29 18:18:25 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.2.2.8 2020/12/11 15:48:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.2.2.9 2021/01/29 18:18:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1065,7 +1065,8 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			if (cold)
 delay(1000);
 			else
-tsleep(cmd, PRIBIO, "nvsout", mstohz(1));
+tsleep(cmd, PRIBIO, "nvsout",
+max(1, mstohz(1)));
 		} else if (rv) {
 			DPRINTF("%s: NVSP operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->nvs_type, rv);
@@ -1090,7 +1091,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			splx(s);
 		} else
 			tsleep(sc->sc_nvsrsp, PRIBIO | PCATCH, "nvscmd",
-			mstohz(1));
+			max(1, mstohz(1)));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {
@@ -1388,7 +1389,8 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			if (cold)
 delay(1000);
 			else
-tsleep(rc, PRIBIO, "rndisout", mstohz(1));
+tsleep(rc, PRIBIO, "rndisout",
+max(1, mstohz(1)));
 		} else if (rv) {
 			DPRINTF("%s: RNDIS operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->rm_type, rv);
@@ -1413,7 +1415,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",
+			max(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.2.2.5 src/sys/dev/hyperv/vmbus.c:1.2.2.6
--- src/sys/dev/hyperv/vmbus.c:1.2.2.5	Sun Nov 24 08:11:06 2019
+++ src/sys/dev/hyperv/vmbus.c	Fri Jan 29 18:18:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.2.2.5 2019/11/24 08:11:06 martin Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.2.2.6 2021/01/29 18:18:25 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.2.2.5 2019/11/24 08:11:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.2.2.6 2021/01/29 18:18:25 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,
+			max(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 : "hvwait",
-		

CVS commit: src/sys/dev/acpi

2021-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 29 15:49:55 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_cppc.c acpi_ec.c acpi_fan.c acpi_ged.c
acpi_lid.c acpi_pcd.c acpi_pmtr.c aibs_acpi.c amdccp_acpi.c
apple_smc_acpi.c asus_acpi.c atppc_acpi.c attimer_acpi.c
dalb_acpi.c ehci_acpi.c fdc_acpi.c fujbp_acpi.c fujhk_acpi.c
genet_acpi.c hpacel_acpi.c hpet_acpi.c hpqlb_acpi.c ipmi_acpi.c
joy_acpi.c lpt_acpi.c mpu_acpi.c pcppi_acpi.c plgpio_acpi.c
qemufwcfg_acpi.c smbus_acpi.c sony_acpi.c spic_acpi.c
thinkpad_acpi.c ug_acpi.c vald_acpi.c valz_acpi.c virtio_acpi.c
vmbus_acpi.c xhci_acpi.c
src/sys/dev/acpi/wmi: wmi_acpi.c

Log Message:
Use acpi_compatible_match().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_cppc.c \
src/sys/dev/acpi/acpi_pcd.c src/sys/dev/acpi/qemufwcfg_acpi.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/acpi/acpi_ec.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpi_fan.c \
src/sys/dev/acpi/acpi_pmtr.c src/sys/dev/acpi/spic_acpi.c \
src/sys/dev/acpi/valz_acpi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/acpi_ged.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/acpi/acpi_lid.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/aibs_acpi.c \
src/sys/dev/acpi/plgpio_acpi.c src/sys/dev/acpi/ug_acpi.c \
src/sys/dev/acpi/virtio_acpi.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/amdccp_acpi.c \
src/sys/dev/acpi/apple_smc_acpi.c src/sys/dev/acpi/ehci_acpi.c \
src/sys/dev/acpi/fujbp_acpi.c src/sys/dev/acpi/fujhk_acpi.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/acpi/asus_acpi.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/acpi/atppc_acpi.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/acpi/attimer_acpi.c \
src/sys/dev/acpi/smbus_acpi.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/dalb_acpi.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/acpi/fdc_acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/genet_acpi.c \
src/sys/dev/acpi/ipmi_acpi.c src/sys/dev/acpi/vmbus_acpi.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/hpacel_acpi.c \
src/sys/dev/acpi/vald_acpi.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/hpet_acpi.c \
src/sys/dev/acpi/joy_acpi.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/hpqlb_acpi.c \
src/sys/dev/acpi/xhci_acpi.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/acpi/lpt_acpi.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/acpi/mpu_acpi.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/pcppi_acpi.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/acpi/sony_acpi.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/acpi/thinkpad_acpi.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/acpi/wmi/wmi_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/acpi_cppc.c
diff -u src/sys/dev/acpi/acpi_cppc.c:1.1 src/sys/dev/acpi/acpi_cppc.c:1.2
--- src/sys/dev/acpi/acpi_cppc.c:1.1	Sun Dec 13 20:39:20 2020
+++ src/sys/dev/acpi/acpi_cppc.c	Fri Jan 29 15:49:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cppc.c,v 1.1 2020/12/13 20:39:20 jmcneill Exp $ */
+/* $NetBSD: acpi_cppc.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cppc.c,v 1.1 2020/12/13 20:39:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cppc.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $");
 
 #include 
 #include 
@@ -104,9 +104,9 @@ static ACPI_STATUS	cppc_write(struct cpp
 CFATTACH_DECL_NEW(acpicppc, sizeof(struct cppc_softc),
 cppc_match, cppc_attach, NULL, NULL);
 
-static const char * const compatible[] = {
-	"ACPI0007",	/* ACPI Processor Device */
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "ACPI0007" },	/* ACPI Processor Device */
+	DEVICE_COMPAT_EOL
 };
 
 static int
@@ -116,13 +116,8 @@ cppc_match(device_t parent, cfdata_t cf,
 	ACPI_HANDLE handle;
 	ACPI_STATUS rv;
 
-	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE) {
+	if (acpi_compatible_match(aa, compat_data) == 0)
 		return 0;
-	}
-
-	if (acpi_match_hid(aa->aa_node->ad_devinfo, compatible) == 0) {
-		return 0;
-	}
 
 	rv = AcpiGetHandle(aa->aa_node->ad_handle, "_CPC", );
 	if (ACPI_FAILURE(rv)) {
@@ -134,7 +129,7 @@ cppc_match(device_t parent, cfdata_t cf,
 	}
 
 	/* When CPPC and P-states/T-states are both available, prefer CPPC */
-	return 20;
+	return ACPI_MATCHSCORE_CID_MAX + 1;
 }
 
 static void
Index: src/sys/dev/acpi/acpi_pcd.c
diff -u src/sys/dev/acpi/acpi_pcd.c:1.1 src/sys/dev/acpi/acpi_pcd.c:1.2
--- src/sys/dev/acpi/acpi_pcd.c:1.1	Mon Dec  7 10:57:41 2020
+++ src/sys/dev/acpi/acpi_pcd.c	Fri Jan 29 15:49:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pcd.c,v 1.1 2020/12/07 10:57:41 jmcneill Exp $ */
+/* $NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pcd.c,v 1.1 2020/12/07 10:57:41 

CVS commit: src/sys/dev/acpi

2021-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 29 15:24:00 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_button.c com_acpi.c pckbc_acpi.c tpm_acpi.c

Log Message:
Use acpi_compatible_match() / acpi_compatible_lookup().


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/acpi/acpi_button.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/acpi/com_acpi.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/acpi/pckbc_acpi.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/tpm_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/acpi_button.c
diff -u src/sys/dev/acpi/acpi_button.c:1.42 src/sys/dev/acpi/acpi_button.c:1.43
--- src/sys/dev/acpi/acpi_button.c:1.42	Thu Apr 23 23:23:00 2015
+++ src/sys/dev/acpi/acpi_button.c	Fri Jan 29 15:24:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_button.c,v 1.42 2015/04/23 23:23:00 pgoyette Exp $	*/
+/*	$NetBSD: acpi_button.c,v 1.43 2021/01/29 15:24:00 thorpej Exp $	*/
 
 /*
  * Copyright 2001, 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_button.c,v 1.42 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_button.c,v 1.43 2021/01/29 15:24:00 thorpej Exp $");
 
 #include 
 #include 
@@ -61,14 +61,25 @@ struct acpibut_softc {
 	struct sysmon_pswitch	 sc_smpsw;
 };
 
-static const char * const power_button_hid[] = {
-	"PNP0C0C",
-	NULL
+struct button_type {
+	const char *desc;
+	int type;
+};
+
+static const struct button_type power_button_type = {
+	.desc = "Power",
+	.type = PSWITCH_TYPE_POWER
 };
 
-static const char * const sleep_button_hid[] = {
-	"PNP0C0E",
-	NULL
+static const struct button_type sleep_button_type = {
+	.desc = "Sleep",
+	.type = PSWITCH_TYPE_SLEEP
+};
+
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "PNP0C0C",	.data = _button_type },
+	{ .compat = "PNP0C0E",	.data = _button_type },
+	DEVICE_COMPAT_EOL
 };
 
 static int	acpibut_match(device_t, cfdata_t, void *);
@@ -90,16 +101,7 @@ acpibut_match(device_t parent, cfdata_t 
 {
 	struct acpi_attach_args *aa = aux;
 
-	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
-		return 0;
-
-	if (acpi_match_hid(aa->aa_node->ad_devinfo, power_button_hid))
-		return 1;
-
-	if (acpi_match_hid(aa->aa_node->ad_devinfo, sleep_button_hid))
-		return 1;
-
-	return 0;
+	return acpi_compatible_match(aa, compat_data);
 }
 
 /*
@@ -112,22 +114,20 @@ acpibut_attach(device_t parent, device_t
 {
 	struct acpibut_softc *sc = device_private(self);
 	struct acpi_attach_args *aa = aux;
+	const struct device_compatible_entry *dce;
+	const struct button_type *type;
 	struct acpi_wakedev *aw;
-	const char *desc;
 
 	sc->sc_smpsw.smpsw_name = device_xname(self);
 
-	if (acpi_match_hid(aa->aa_node->ad_devinfo, power_button_hid)) {
-		sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_POWER;
-		desc = "Power";
-	} else if (acpi_match_hid(aa->aa_node->ad_devinfo, sleep_button_hid)) {
-		sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_SLEEP;
-		desc = "Sleep";
-	} else
-		panic("%s: impossible", __func__);
+	dce = acpi_compatible_lookup(aa, compat_data);
+	KASSERT(dce != NULL);
+	type = dce->data;
+
+	sc->sc_smpsw.smpsw_type = type->type;
 
-	aprint_naive(": ACPI %s Button\n", desc);
-	aprint_normal(": ACPI %s Button\n", desc);
+	aprint_naive(": ACPI %s Button\n", type->desc);
+	aprint_normal(": ACPI %s Button\n", type->desc);
 
 	sc->sc_node = aa->aa_node;
 	aw = sc->sc_node->ad_wakedev;

Index: src/sys/dev/acpi/com_acpi.c
diff -u src/sys/dev/acpi/com_acpi.c:1.40 src/sys/dev/acpi/com_acpi.c:1.41
--- src/sys/dev/acpi/com_acpi.c:1.40	Fri Mar  1 09:21:06 2019
+++ src/sys/dev/acpi/com_acpi.c	Fri Jan 29 15:24:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: com_acpi.c,v 1.40 2019/03/01 09:21:06 mlelstv Exp $ */
+/* $NetBSD: com_acpi.c,v 1.41 2021/01/29 15:24:00 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.40 2019/03/01 09:21:06 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.41 2021/01/29 15:24:00 thorpej Exp $");
 
 #include 
 #include 
@@ -53,27 +53,38 @@ CFATTACH_DECL_NEW(com_acpi, sizeof(struc
  * Supported device IDs
  */
 
-static const char * const com_acpi_ids[] = {
-	"PNP0500",	/* Standard PC COM port */
-	"PNP0501",	/* 16550A-compatible COM port */
-	"PNP0510",	/* Generic IRDA-compatible device */
-	"PNP0511",	/* Generic IRDA-compatible device */
-	"IBM0071",	/* IBM ThinkPad IRDA device */
-	"SMCF010",	/* SMC SuperIO IRDA device */
-	"NSC6001",	/* NSC IRDA device */
-	"FUJ02E6",	/* Fujitsu Serial Pen Tablet */
-	"HISI0031",	/* Hisilicon UART */
-	"8250dw",	/* Designware APB UART */
-	NULL
-};
+static const struct device_compatible_entry compat_data[] = {
+	/* Standard PC COM port */
+	{ .compat = "PNP0500",		.value = COM_TYPE_NORMAL },
 
-/*
- * Subset of supported device IDs of type COM_TYPE_DW_APB
- */
-static const char * const 

CVS commit: src/sys/dev/acpi

2021-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 29 15:20:13 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_acad.c acpi_bat.c

Log Message:
Use acpi_compatible_match().


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/acpi/acpi_acad.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/acpi/acpi_bat.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/acpi_acad.c
diff -u src/sys/dev/acpi/acpi_acad.c:1.51 src/sys/dev/acpi/acpi_acad.c:1.52
--- src/sys/dev/acpi/acpi_acad.c:1.51	Thu Apr 23 23:23:00 2015
+++ src/sys/dev/acpi/acpi_acad.c	Fri Jan 29 15:20:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_acad.c,v 1.51 2015/04/23 23:23:00 pgoyette Exp $	*/
+/*	$NetBSD: acpi_acad.c,v 1.52 2021/01/29 15:20:13 thorpej Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_acad.c,v 1.51 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_acad.c,v 1.52 2021/01/29 15:20:13 thorpej Exp $");
 
 #include 
 #include 
@@ -64,9 +64,9 @@ struct acpiacad_softc {
 	int			 sc_status;
 };
 
-static const char * const acad_hid[] = {
-	"ACPI0003",
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "ACPI0003" },
+	DEVICE_COMPAT_EOL
 };
 
 static int	acpiacad_match(device_t, cfdata_t, void *);
@@ -90,10 +90,7 @@ acpiacad_match(device_t parent, cfdata_t
 {
 	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, acad_hid);
+	return acpi_compatible_match(aa, compat_data);
 }
 
 /*

Index: src/sys/dev/acpi/acpi_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.116 src/sys/dev/acpi/acpi_bat.c:1.117
--- src/sys/dev/acpi/acpi_bat.c:1.116	Fri Aug 10 17:11:56 2018
+++ src/sys/dev/acpi/acpi_bat.c	Fri Jan 29 15:20:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.116 2018/08/10 17:11:56 riastradh Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.117 2021/01/29 15:20:13 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.116 2018/08/10 17:11:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.117 2021/01/29 15:20:13 thorpej Exp $");
 
 #include 
 #include 
@@ -159,9 +159,9 @@ struct acpibat_softc {
 	int  sc_present;
 };
 
-static const char * const bat_hid[] = {
-	"PNP0C0A",
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "PNP0C0A" },
+	DEVICE_COMPAT_EOL
 };
 
 #define ACPIBAT_PWRUNIT_MA	0x0001  /* mA not mW */
@@ -207,10 +207,7 @@ acpibat_match(device_t parent, cfdata_t 
 {
 	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, bat_hid);
+	return acpi_compatible_match(aa, compat_data);
 }
 
 /*



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

2021-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 14:12:01 UTC 2021

Modified Files:
src/sys/arch/arm/altera: cycv_dwcmmc.c cycv_gmac.c

Log Message:
fdtbus_intr_establish -> fdtbus_intr_establish_xname


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/altera/cycv_dwcmmc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/altera/cycv_gmac.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/altera/cycv_dwcmmc.c
diff -u src/sys/arch/arm/altera/cycv_dwcmmc.c:1.6 src/sys/arch/arm/altera/cycv_dwcmmc.c:1.7
--- src/sys/arch/arm/altera/cycv_dwcmmc.c:1.6	Wed Jan 27 03:10:18 2021
+++ src/sys/arch/arm/altera/cycv_dwcmmc.c	Fri Jan 29 14:12:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_dwcmmc.c,v 1.6 2021/01/27 03:10:18 thorpej Exp $ */
+/* $NetBSD: cycv_dwcmmc.c,v 1.7 2021/01/29 14:12:01 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.6 2021/01/27 03:10:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.7 2021/01/29 14:12:01 skrll Exp $");
 
 #include 
 #include 
@@ -157,8 +157,8 @@ cycv_dwcmmc_attach(device_t parent, devi
 	if (dwc_mmc_init(sc) != 0)
 		return;
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
-	dwc_mmc_intr, sc);
+	sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_BIO, 0,
+	dwc_mmc_intr, sc, device_xname(sc->sc_dev));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
 		intrstr);

Index: src/sys/arch/arm/altera/cycv_gmac.c
diff -u src/sys/arch/arm/altera/cycv_gmac.c:1.5 src/sys/arch/arm/altera/cycv_gmac.c:1.6
--- src/sys/arch/arm/altera/cycv_gmac.c:1.5	Wed Jan 27 03:10:18 2021
+++ src/sys/arch/arm/altera/cycv_gmac.c	Fri Jan 29 14:12:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_gmac.c,v 1.5 2021/01/27 03:10:18 thorpej Exp $ */
+/* $NetBSD: cycv_gmac.c,v 1.6 2021/01/29 14:12:01 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: cycv_gmac.c,v 1.5 2021/01/27 03:10:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_gmac.c,v 1.6 2021/01/29 14:12:01 skrll Exp $");
 
 #include 
 #include 
@@ -132,8 +132,8 @@ cycv_gmac_attach(device_t parent, device
 	aprint_naive("\n");
 	aprint_normal(": GMAC\n");
 
-	if (fdtbus_intr_establish(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE,
-  cycv_gmac_intr, sc) == NULL) {
+	if (fdtbus_intr_establish_xname(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE,
+	 cycv_gmac_intr, sc, device_xname(sc->sc_dev)) == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
  intrstr);
 		return;



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

2021-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 14:11:14 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_bsc_fdt.c bcm2835_com.c
bcm2835_dmac.c bcm2835_dwctwo.c bcm2835_emmc.c bcm2835_gpio.c
bcm2835_mbox_fdt.c bcm2835_sdhost.c bcm2835_spi.c bcm2835_tmr.c

Log Message:
fdtbus_intr_establish -> fdtbus_intr_establish_xname


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/broadcom/bcm2835_com.c \
src/sys/arch/arm/broadcom/bcm2835_sdhost.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/broadcom/bcm2835_dmac.c \
src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm2835_dwctwo.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/arm/broadcom/bcm2835_emmc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_mbox_fdt.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_spi.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/broadcom/bcm2835_tmr.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/broadcom/bcm2835_bsc_fdt.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.5 src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.6
--- src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.5	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c	Fri Jan 29 14:11:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_bsc_fdt.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_bsc_fdt.c,v 1.6 2021/01/29 14:11:14 skrll Exp $	*/
 
 /*
  * Copyright (c) 2019 Jason R. Thorpe
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc_fdt.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc_fdt.c,v 1.6 2021/01/29 14:11:14 skrll Exp $");
 
 #include 
 #include 
@@ -118,8 +118,8 @@ bsciic_fdt_attach(device_t parent, devic
 		aprint_error_dev(sc->sc_dev, "failed to decode interrupt\n");
 		return;
 	}
-	sc->sc_inth = fdtbus_intr_establish(phandle, 0, IPL_VM,
-	FDT_INTR_MPSAFE, bsciic_intr, sc);
+	sc->sc_inth = fdtbus_intr_establish_xname(phandle, 0, IPL_VM,
+	FDT_INTR_MPSAFE, bsciic_intr, sc, device_xname(sc->sc_dev));
 	if (sc->sc_inth == NULL) {
 		aprint_error_dev(sc->sc_dev,
 		"failed to establish interrupt %s\n", intrstr);

Index: src/sys/arch/arm/broadcom/bcm2835_com.c
diff -u src/sys/arch/arm/broadcom/bcm2835_com.c:1.7 src/sys/arch/arm/broadcom/bcm2835_com.c:1.8
--- src/sys/arch/arm/broadcom/bcm2835_com.c:1.7	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_com.c	Fri Jan 29 14:11:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_com.c,v 1.7 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.7 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $");
 
 #include 
 #include 
@@ -116,8 +116,8 @@ bcm_com_attach(device_t parent, device_t
 		return;
 	}
 
-	ih = fdtbus_intr_establish(phandle, 0, IPL_SERIAL, FDT_INTR_MPSAFE,
-	comintr, sc);
+	ih = fdtbus_intr_establish_xname(phandle, 0, IPL_SERIAL, FDT_INTR_MPSAFE,
+	comintr, sc, device_xname(sc->sc_dev));
 	if (ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %s\n",
 		intrstr);
Index: src/sys/arch/arm/broadcom/bcm2835_sdhost.c
diff -u src/sys/arch/arm/broadcom/bcm2835_sdhost.c:1.7 src/sys/arch/arm/broadcom/bcm2835_sdhost.c:1.8
--- src/sys/arch/arm/broadcom/bcm2835_sdhost.c:1.7	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_sdhost.c	Fri Jan 29 14:11:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_sdhost.c,v 1.7 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: bcm2835_sdhost.c,v 1.8 2021/01/29 14:11:14 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_sdhost.c,v 1.7 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_sdhost.c,v 1.8 2021/01/29 14:11:14 skrll Exp $");
 
 #include "bcmdmac.h"
 
@@ -243,8 +243,8 @@ sdhost_attach(device_t parent, device_t 
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_SDMMC,
-	FDT_INTR_MPSAFE, sdhost_intr, sc);
+	sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_SDMMC,
+	FDT_INTR_MPSAFE, sdhost_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %s\n",
 		intrstr);

Index: src/sys/arch/arm/broadcom/bcm2835_dmac.c
diff -u src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.18 src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.19
--- src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.18	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_dmac.c	Fri Jan 29 14:11:14 2021
@@ -1,4 +1,4 

CVS commit: src/sys/arch/arm

2021-01-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jan 29 13:10:08 UTC 2021

Modified Files:
src/sys/arch/arm/altera: cycv_platform.c
src/sys/arch/arm/amlogic: meson_platform.c
src/sys/arch/arm/nxp: imx6_platform.c
src/sys/arch/arm/ti: ti_gpio.c

Log Message:
Fix build without MULTIPROCESSOR.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/altera/cycv_platform.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/amlogic/meson_platform.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nxp/imx6_platform.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/ti/ti_gpio.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/altera/cycv_platform.c
diff -u src/sys/arch/arm/altera/cycv_platform.c:1.15 src/sys/arch/arm/altera/cycv_platform.c:1.16
--- src/sys/arch/arm/altera/cycv_platform.c:1.15	Fri Nov 27 07:11:49 2020
+++ src/sys/arch/arm/altera/cycv_platform.c	Fri Jan 29 13:10:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.15 2020/11/27 07:11:49 skrll Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.16 2021/01/29 13:10:07 rin 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.15 2020/11/27 07:11:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.16 2021/01/29 13:10:07 rin Exp $");
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include 
@@ -79,10 +79,12 @@ cycv_platform_bootstrap(void)
 static int
 cycv_mpstart(void)
 {
+	int ret = 0;
+
+#ifdef MULTIPROCESSOR
 	bus_space_tag_t bst = _generic_bs_tag;
 	bus_space_handle_t bsh_rst;
 	bus_space_handle_t bsh_scu;
-	int ret = 0;
 
 	bus_space_map(bst, CYCV_RSTMGR_BASE, CYCV_RSTMGR_SIZE, 0, _rst);
 	bus_space_map(bst, CYCV_SCU_BASE, CYCV_SCU_SIZE, 0, _scu);
@@ -123,6 +125,7 @@ cycv_mpstart(void)
 		aprint_error("cpu%d: WARNING: AP failed to start\n", 1);
 		ret++;
 	}
+#endif
 
 	return ret;
 }

Index: src/sys/arch/arm/amlogic/meson_platform.c
diff -u src/sys/arch/arm/amlogic/meson_platform.c:1.16 src/sys/arch/arm/amlogic/meson_platform.c:1.17
--- src/sys/arch/arm/amlogic/meson_platform.c:1.16	Mon Sep 28 11:54:22 2020
+++ src/sys/arch/arm/amlogic/meson_platform.c	Fri Jan 29 13:10:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.16 2020/09/28 11:54:22 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.17 2021/01/29 13:10:07 rin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.16 2020/09/28 11:54:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.17 2021/01/29 13:10:07 rin Exp $");
 
 #include 
 #include 
@@ -319,16 +319,19 @@ meson8b_platform_reset(void)
 	}
 }
 
+#ifdef MULTIPROCESSOR
 static void
 meson8b_mpinit_delay(u_int n)
 {
 	for (volatile int i = 0; i < n; i++)
 		;
 }
+#endif
 
 static int
 cpu_enable_meson8b(int phandle)
 {
+#ifdef MULTIPROCESSOR
 	const bus_addr_t cbar = armreg_cbar_read();
 	bus_space_tag_t bst = _generic_bs_tag;
 
@@ -396,6 +399,7 @@ cpu_enable_meson8b(int phandle)
 	uint32_t ctrl = bus_space_read_4(bst, cpuconf_bsh, MESON8B_SRAM_CPUCONF_CTRL_REG);
 	ctrl |= __BITS(cpuno,0);
 	bus_space_write_4(bst, cpuconf_bsh, MESON8B_SRAM_CPUCONF_CTRL_REG, ctrl);
+#endif
 
 	return 0;
 }

Index: src/sys/arch/arm/nxp/imx6_platform.c
diff -u src/sys/arch/arm/nxp/imx6_platform.c:1.2 src/sys/arch/arm/nxp/imx6_platform.c:1.3
--- src/sys/arch/arm/nxp/imx6_platform.c:1.2	Wed Jan 27 03:10:20 2021
+++ src/sys/arch/arm/nxp/imx6_platform.c	Fri Jan 29 13:10:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.2 2021/01/27 03:10:20 thorpej Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.3 2021/01/29 13:10:07 rin Exp $	*/
 
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.2 2021/01/27 03:10:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.3 2021/01/29 13:10:07 rin Exp $");
 
 #include "arml2cc.h"
 #include "opt_console.h"
@@ -191,6 +191,8 @@ imx_platform_mpstart(void)
 	bus_space_unmap(bst, bsh, AIPS1_SRC_SIZE);
 
 	return arm_fdt_cpu_mpstart();
+#else
+	return 0;
 #endif
 }
 

Index: src/sys/arch/arm/ti/ti_gpio.c
diff -u src/sys/arch/arm/ti/ti_gpio.c:1.11 src/sys/arch/arm/ti/ti_gpio.c:1.12
--- src/sys/arch/arm/ti/ti_gpio.c:1.11	Fri Jan 29 13:07:32 2021
+++ src/sys/arch/arm/ti/ti_gpio.c	Fri Jan 29 13:10:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_gpio.c,v 1.11 2021/01/29 13:07:32 rin Exp $ */
+/* $NetBSD: ti_gpio.c,v 1.12 2021/01/29 13:10:07 rin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.11 2021/01/29 13:07:32 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.12 2021/01/29 13:10:07 rin Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ 

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

2021-01-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jan 29 13:07:32 UTC 2021

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c

Log Message:
Sort headers. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ti/ti_gpio.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/ti/ti_gpio.c
diff -u src/sys/arch/arm/ti/ti_gpio.c:1.10 src/sys/arch/arm/ti/ti_gpio.c:1.11
--- src/sys/arch/arm/ti/ti_gpio.c:1.10	Wed Jan 27 03:10:20 2021
+++ src/sys/arch/arm/ti/ti_gpio.c	Fri Jan 29 13:07:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_gpio.c,v 1.10 2021/01/27 03:10:20 thorpej Exp $ */
+/* $NetBSD: ti_gpio.c,v 1.11 2021/01/29 13:07:32 rin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,17 +27,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.10 2021/01/27 03:10:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.11 2021/01/29 13:07:32 rin Exp $");
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
+#include 
+#include 
 
 #include 
 #include