CVS commit: src/sys/arch

2020-02-16 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Feb 17 06:32:46 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
add kse(4) for i386/amd64 GENERIC


To generate a diff of this commit:
cvs rdiff -u -r1.562 -r1.563 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1224 -r1.1225 src/sys/arch/i386/conf/GENERIC

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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.562 src/sys/arch/amd64/conf/GENERIC:1.563
--- src/sys/arch/amd64/conf/GENERIC:1.562	Sun Feb  9 16:06:18 2020
+++ src/sys/arch/amd64/conf/GENERIC	Mon Feb 17 06:32:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.562 2020/02/09 16:06:18 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.563 2020/02/17 06:32:46 nisimura Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.562 $"
+#ident		"GENERIC-$Revision: 1.563 $"
 
 maxusers	64		# estimated number of users
 
@@ -796,6 +796,7 @@ ex*	at pci? dev ? function ?	# 3Com 90x[
 fxp*	at pci? dev ? function ?	# Intel EtherExpress PRO 10+/100B
 gem*	at pci? dev ? function ?	# Apple GMAC and Sun ERI gigabit enet
 gsip*	at pci? dev ? function ?	# NS83820 Gigabit Ethernet
+hme*	at pci? dev ? function ?	# Sun Microelectronics STP2002-STQ
 ipw*	at pci? dev ? function ?	# Intel PRO/Wireless 2100
 iwi*	at pci? dev ? function ?	# Intel PRO/Wireless 2200BG
 iwm*	at pci? dev ? function ?	# Intel Centrino 7260
@@ -804,7 +805,7 @@ ixg*	at pci? dev ? function ?	# Intel 82
 ixl*	at pci? dev ? function ?	# Intel Ethernet 700 Series
 ixv*	at pci? dev ? function ?	# Intel 8259x 10G virtual function
 jme*	at pci? dev ? function ?	# JMicron JMC2[56]0 ethernet
-hme*	at pci? dev ? function ?	# Sun Microelectronics STP2002-STQ
+kse*	at pci? dev ? function ?	# Micrel KSZ8841/8842 ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet
 malo*	at pci? dev ? function ?	# Marvell Libertas Wireless
 mcx*	at pci? dev ? function ?	# Mellanox 5th generation Ethernet

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1224 src/sys/arch/i386/conf/GENERIC:1.1225
--- src/sys/arch/i386/conf/GENERIC:1.1224	Sun Feb  9 16:06:18 2020
+++ src/sys/arch/i386/conf/GENERIC	Mon Feb 17 06:32:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1224 2020/02/09 16:06:18 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.1225 2020/02/17 06:32:46 nisimura Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1224 $"
+#ident		"GENERIC-$Revision: 1.1225 $"
 
 maxusers	64		# estimated number of users
 
@@ -983,6 +983,7 @@ iwn*	at pci? dev ? function ?	# Intel PR
 ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
 ixl*	at pci? dev ? function ?	# Intel Ethernet 700 Series
 jme*	at pci? dev ? function ?	# JMicron JMC2[56]0 Ethernet
+kse*	at pci? dev ? function ?	# Micrel KSZ8841/8842 ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet
 malo*	at pci? dev ? function ?	# Marvell Libertas Wireless
 mskc*	at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet



CVS commit: src/sys/dev/pci

2020-02-16 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Feb 17 06:05:31 UTC 2020

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

Log Message:
comment mods and code tiddy ups


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/if_kse.c

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

Modified files:

Index: src/sys/dev/pci/if_kse.c
diff -u src/sys/dev/pci/if_kse.c:1.48 src/sys/dev/pci/if_kse.c:1.49
--- src/sys/dev/pci/if_kse.c:1.48	Tue Feb  4 07:37:00 2020
+++ src/sys/dev/pci/if_kse.c	Mon Feb 17 06:05:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kse.c,v 1.48 2020/02/04 07:37:00 skrll Exp $	*/
+/*	$NetBSD: if_kse.c,v 1.49 2020/02/17 06:05:31 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.48 2020/02/04 07:37:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.49 2020/02/17 06:05:31 nisimura Exp $");
 
 #include 
 #include 
@@ -66,9 +66,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1
 #define KSE_LINKDEBUG 0
 
 #define CSR_READ_4(sc, off) \
-	bus_space_read_4(sc->sc_st, sc->sc_sh, off)
+	bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (off))
 #define CSR_WRITE_4(sc, off, val) \
-	bus_space_write_4(sc->sc_st, sc->sc_sh, off, val)
+	bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (off), (val))
 #define CSR_READ_2(sc, off) \
 	bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (off))
 #define CSR_WRITE_2(sc, off, val) \
@@ -833,7 +833,7 @@ kse_init(struct ifnet *ifp)
 		CSR_READ_2(sc, SGCR3) | CR3_USEFC);
 	}
 
-	/* build multicast hash filter if necessary */
+	/* accept multicast frame or run promisc mode */
 	kse_set_filter(sc);
 
 	/* set current media */
@@ -1098,16 +1098,18 @@ kse_set_filter(struct kse_softc *sc)
 	int i;
 
 	sc->sc_rxc &= ~(RXC_MHTE | RXC_RM | RXC_RA);
-	ifp->if_flags &= ~IFF_ALLMULTI;
 
 	if (ifp->if_flags & IFF_PROMISC) {
 		ifp->if_flags |= IFF_ALLMULTI;
 		goto update;
 	}
+	ifp->if_flags &= ~IFF_ALLMULTI;
 
+	/* clear perfect match filter and prepare mcast hash table */
 	for (i = 0; i < 16; i++)
 		 CSR_WRITE_4(sc, MAAH0 + i*8, 0);
 	crc = mchash[0] = mchash[1] = 0;
+
 	ETHER_LOCK(ec);
 	ETHER_FIRST_MULTI(step, ec, enm);
 	i = 0;



CVS commit: src/games/fortune/datfiles

2020-02-16 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 16 23:14:19 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
something I apparently forgot to commit months or years ago


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.86 src/games/fortune/datfiles/fortunes:1.87
--- src/games/fortune/datfiles/fortunes:1.86	Tue Dec  3 22:42:29 2019
+++ src/games/fortune/datfiles/fortunes	Sun Feb 16 23:14:19 2020
@@ -16289,3 +16289,6 @@ I wonder why I wonder.
 I wonder why I wonder why
 I wonder why I wonder!
 		-- Richard P. Feynman, "Always Trying to Escape"
+%
+Fanfare, n.:
+The food available for consumption at a con.



CVS commit: src/sys/dev/fdt

2020-02-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 16 23:05:42 UTC 2020

Added Files:
src/sys/dev/fdt: fdt_private.h

Log Message:
Add fdt_intr_mask() / fdt_intr_unmask() functions, for masking and
unmasking invididual interrupt sources (similar to acpi_intr_mask()
and acpi_intr_unmask()).

(This file was missed in a previous commit.)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_private.h

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

Added files:

Index: src/sys/dev/fdt/fdt_private.h
diff -u /dev/null src/sys/dev/fdt/fdt_private.h:1.1
--- /dev/null	Sun Feb 16 23:05:42 2020
+++ src/sys/dev/fdt/fdt_private.h	Sun Feb 16 23:05:42 2020
@@ -0,0 +1,34 @@
+/* $NetBSD: fdt_private.h,v 1.1 2020/02/16 23:05:42 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DEV_FDT_FDT_PRIVATE_H_
+#define	_DEV_FDT_FDT_PRIVATE_H_
+
+void	fdtbus_intr_init(void);
+
+#endif /* _DEV_FDT_FDT_PRIVATE_H_ */



CVS commit: src/sys/dev/i2c

2020-02-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 16 22:43:27 UTC 2020

Modified Files:
src/sys/dev/i2c: axp20x.c
Removed Files:
src/sys/dev/i2c: axp20xvar.h

Log Message:
- Don't use I2C_F_POLL.
- G/C the non-FDT entry points; nothing uses them anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/i2c/axp20x.c
cvs rdiff -u -r1.3 -r0 src/sys/dev/i2c/axp20xvar.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/i2c/axp20x.c
diff -u src/sys/dev/i2c/axp20x.c:1.15 src/sys/dev/i2c/axp20x.c:1.16
--- src/sys/dev/i2c/axp20x.c:1.15	Mon Dec 23 19:12:22 2019
+++ src/sys/dev/i2c/axp20x.c	Sun Feb 16 22:43:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: axp20x.c,v 1.15 2019/12/23 19:12:22 thorpej Exp $ */
+/* $NetBSD: axp20x.c,v 1.16 2020/02/16 22:43:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -26,10 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "opt_fdt.h"
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.15 2019/12/23 19:12:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.16 2020/02/16 22:43:27 thorpej Exp $");
 
 #include 
 #include 
@@ -39,13 +37,13 @@ __KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1
 #include 
 
 #include 
-#include 
 
 #include 
 
-#ifdef FDT
 #include 
-#endif
+
+#define AXP20X_DCDC22
+#define AXP20X_DCDC33
 
 #define	AXP209_I2C_ADDR		0x34
 
@@ -204,12 +202,10 @@ static int	axp20x_match(device_t, cfdata
 static void	axp20x_attach(device_t, device_t, void *);
 
 static void	axp20x_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
-static int	axp20x_read(struct axp20x_softc *, uint8_t, uint8_t *, size_t, int);
-static int	axp20x_write(struct axp20x_softc *, uint8_t, uint8_t *, size_t, int);
+static int	axp20x_read(struct axp20x_softc *, uint8_t, uint8_t *, size_t);
+static int	axp20x_write(struct axp20x_softc *, uint8_t, uint8_t *, size_t);
 
-#ifdef FDT
 static void	axp20x_fdt_attach(struct axp20x_softc *);
-#endif
 
 CFATTACH_DECL_NEW(axp20x, sizeof(struct axp20x_softc),
 axp20x_match, axp20x_attach, NULL, NULL);
@@ -248,13 +244,13 @@ axp20x_attach(device_t parent, device_t 
 	sc->sc_phandle = ia->ia_cookie;
 
 	error = axp20x_read(sc, AXP_INPUT_STATUS,
-	>sc_inputstatus, 1, 0);
+	>sc_inputstatus, 1);
 	if (error) {
 		aprint_error(": can't read status: %d\n", error);
 		return;
 	}
 	error = axp20x_read(sc, AXP_POWER_MODE,
-	>sc_powermode, 1, 0);
+	>sc_powermode, 1);
 	if (error) {
 		aprint_error(": can't read power mode: %d\n", error);
 		return;
@@ -262,18 +258,18 @@ axp20x_attach(device_t parent, device_t 
 	value = AXP_ADC_EN1_ACV | AXP_ADC_EN1_ACI | AXP_ADC_EN1_VBUSV | AXP_ADC_EN1_VBUSI | AXP_ADC_EN1_APSV | AXP_ADC_EN1_TS;
 	if (sc->sc_powermode & AXP_POWER_MODE_BATTOK)
 		value |= AXP_ADC_EN1_BATTV | AXP_ADC_EN1_BATTI;
-	error = axp20x_write(sc, AXP_ADC_EN1, , 1, 0);
+	error = axp20x_write(sc, AXP_ADC_EN1, , 1);
 	if (error) {
 		aprint_error(": can't set AXP_ADC_EN1\n");
 		return;
 	}
-	error = axp20x_read(sc, AXP_ADC_EN2, , 1, 0);
+	error = axp20x_read(sc, AXP_ADC_EN2, , 1);
 	if (error) {
 		aprint_error(": can't read AXP_ADC_EN2\n");
 		return;
 	}
 	value |= AXP_ADC_EN2_TEMP;
-	error = axp20x_write(sc, AXP_ADC_EN2, , 1, 0);
+	error = axp20x_write(sc, AXP_ADC_EN2, , 1);
 	if (error) {
 		aprint_error(": can't set AXP_ADC_EN2\n");
 		return;
@@ -381,22 +377,22 @@ axp20x_attach(device_t parent, device_t 
 
 	sysmon_envsys_register(sc->sc_sme);
 
-	if (axp20x_read(sc, AXP_DCDC2, , 1, 0) == 0) {
+	if (axp20x_read(sc, AXP_DCDC2, , 1) == 0) {
 		aprint_verbose_dev(sc->sc_dev, "DCDC2 %dmV\n",
 		(int)(700 + (value & AXP_DCDC2_VOLT_MASK) * 25));
 	}
-	if (axp20x_read(sc, AXP_DCDC3, , 1, 0) == 0) {
+	if (axp20x_read(sc, AXP_DCDC3, , 1) == 0) {
 		aprint_verbose_dev(sc->sc_dev, "DCDC3 %dmV\n",
 		(int)(700 + (value & AXP_DCDC3_VOLT_MASK) * 25));
 	}
-	if (axp20x_read(sc, AXP_LDO2_4, , 1, 0) == 0) {
+	if (axp20x_read(sc, AXP_LDO2_4, , 1) == 0) {
 		aprint_verbose_dev(sc->sc_dev, "LDO2 %dmV, LDO4 %dmV\n",
 		(int)(1800 +
 		((value & AXP_LDO2_VOLT_MASK) >> AXP_LDO2_VOLT_SHIFT) * 100
 		),
 		ldo4_mvV[(value & AXP_LDO4_VOLT_MASK) >> AXP_LDO4_VOLT_SHIFT]);
 	}
-	if (axp20x_read(sc, AXP_LDO3, , 1, 0) == 0) {
+	if (axp20x_read(sc, AXP_LDO3, , 1) == 0) {
 		if (value & AXP_LDO3_TRACK) {
 			aprint_verbose_dev(sc->sc_dev, "LDO3: tracking\n");
 		} else {
@@ -405,7 +401,7 @@ axp20x_attach(device_t parent, device_t 
 		}
 	}
 
-	if (axp20x_read(sc, AXP_BKUP_CTRL, , 1, 0) == 0) {
+	if (axp20x_read(sc, AXP_BKUP_CTRL, , 1) == 0) {
 		if (value & AXP_BKUP_CTRL_ENABLE) {
 			aprint_verbose_dev(sc->sc_dev,
 			"RTC supercap charger enabled: %dmV at %duA\n",
@@ -417,9 +413,7 @@ axp20x_attach(device_t parent, device_t 
 		}
 	}
 
-#ifdef FDT
 	axp20x_fdt_attach(sc);
-#endif
 }
 
 static void
@@ -429,7 +423,7 @@ axp20x_sensors_refresh_volt(struct 

CVS commit: src/external/bsd/tcpdump/dist

2020-02-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Feb 16 22:38:28 UTC 2020

Modified Files:
src/external/bsd/tcpdump/dist: tcpdump.1.in

Log Message:
Fix comments to not break formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/tcpdump/dist/tcpdump.1.in

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

Modified files:

Index: src/external/bsd/tcpdump/dist/tcpdump.1.in
diff -u src/external/bsd/tcpdump/dist/tcpdump.1.in:1.15 src/external/bsd/tcpdump/dist/tcpdump.1.in:1.16
--- src/external/bsd/tcpdump/dist/tcpdump.1.in:1.15	Sun Feb 16 22:20:31 2020
+++ src/external/bsd/tcpdump/dist/tcpdump.1.in	Sun Feb 16 22:38:28 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tcpdump.1.in,v 1.15 2020/02/16 22:20:31 gutteridge Exp $
+.\"	$NetBSD: tcpdump.1.in,v 1.16 2020/02/16 22:38:28 uwe Exp $
 .\"
 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
@@ -207,13 +207,13 @@ On platforms that support the SIGINFO si
 (including Mac OS X) and Digital/Tru64 UNIX, it will report those counts
 when it receives a SIGINFO signal (generated, for example, by typing
 your ``status'' character, typically control-T)
-\" , although on some
-\" platforms, such as Mac OS X, the ``status'' character is not set by
-\" default, so you must set it with
-\" .BR stty (1)
-\" in order to use it) and will continue capturing packets. On platforms that
-\" do not support the SIGINFO signal, the same can be achieved by using the
-\" SIGUSR1 signal.
+.\" , although on some
+.\" platforms, such as Mac OS X, the ``status'' character is not set by
+.\" default, so you must set it with
+.\" .BR stty (1)
+.\" in order to use it) and will continue capturing packets. On platforms that
+.\" do not support the SIGINFO signal, the same can be achieved by using the
+.\" SIGUSR1 signal.
 and will continue capturing packets.
 .LP
 Reading packets from a network interface may require that you have



CVS commit: src/external/bsd/tcpdump/dist

2020-02-16 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Feb 16 22:20:31 UTC 2020

Modified Files:
src/external/bsd/tcpdump/dist: tcpdump.1.in

Log Message:
tcpdump.1.in: fix stray line from merge botch


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/tcpdump/dist/tcpdump.1.in

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

Modified files:

Index: src/external/bsd/tcpdump/dist/tcpdump.1.in
diff -u src/external/bsd/tcpdump/dist/tcpdump.1.in:1.14 src/external/bsd/tcpdump/dist/tcpdump.1.in:1.15
--- src/external/bsd/tcpdump/dist/tcpdump.1.in:1.14	Tue Oct  1 16:06:16 2019
+++ src/external/bsd/tcpdump/dist/tcpdump.1.in	Sun Feb 16 22:20:31 2020
@@ -1,4 +1,4 @@
-.\"	NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp 
+.\"	$NetBSD: tcpdump.1.in,v 1.15 2020/02/16 22:20:31 gutteridge Exp $
 .\"
 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
@@ -20,7 +20,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH TCPDUMP 8  "2 February 2017"
+.TH TCPDUMP 8  "16 February 2020"
 .SH NAME
 tcpdump \- dump traffic on a network
 .SH SYNOPSIS
@@ -213,7 +213,7 @@ your ``status'' character, typically con
 \" .BR stty (1)
 \" in order to use it) and will continue capturing packets. On platforms that
 \" do not support the SIGINFO signal, the same can be achieved by using the
-SIGUSR1 signal.
+\" SIGUSR1 signal.
 and will continue capturing packets.
 .LP
 Reading packets from a network interface may require that you have



CVS commit: [ad-namecache] src/sys/kern

2020-02-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Feb 16 22:00:53 UTC 2020

Modified Files:
src/sys/kern [ad-namecache]: vfs_cache.c

Log Message:
Comments.


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.11 -r1.126.2.12 src/sys/kern/vfs_cache.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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.126.2.11 src/sys/kern/vfs_cache.c:1.126.2.12
--- src/sys/kern/vfs_cache.c:1.126.2.11	Fri Jan 24 16:48:59 2020
+++ src/sys/kern/vfs_cache.c	Sun Feb 16 22:00:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.126.2.11 2020/01/24 16:48:59 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.126.2.12 2020/02/16 22:00:53 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -67,8 +67,9 @@
  *	reference.  It is managed LRU, so frequently used names will hang
  *	around.  The cache is indexed by hash value obtained from the name.
  *
- *	The name cache (or directory name lookup cache) is the brainchild of
- *	Robert Elz and made its first appearance in 4.3BSD.
+ *	The name cache is the brainchild of Robert Elz and was introduced in
+ *	4.3BSD.  See "Using gprof to Tune the 4.2BSD Kernel", Marshall Kirk
+ *	McKusick, May 21 1984.
  *
  * Data structures:
  *
@@ -81,7 +82,7 @@
  *	The index is a red-black tree.  There are no special concurrency
  *	requirements placed on it, because it's per-directory and protected
  *	by the namecache's per-directory locks.  It should therefore not be
- *	difficult to experiment with other data structures.
+ *	difficult to experiment with other types of index.
  *
  *	Each cached name is stored in a struct namecache, along with a
  *	pointer to the associated vnode (nc_vp).  Names longer than a
@@ -170,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.11 2020/01/24 16:48:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.12 2020/02/16 22:00:53 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -393,7 +394,7 @@ cache_remove(struct namecache *ncp, cons
 }
 
 /*
- * Find a single cache entry and return it.  The vnode lock must be held.
+ * Find a single cache entry and return it.  vi_nc_lock must be held.
  */
 static struct namecache * __noinline
 cache_lookup_entry(struct vnode *dvp, const char *name, size_t namelen,
@@ -1239,11 +1240,10 @@ cache_deactivate(void)
 	}
 
 	/*
-	 * Aim for a 1:1 ratio of active to inactive.  It's a bit wet finger
-	 * in the air here, but this is to allow each potential victim a
-	 * reasonable amount of time to cycle through the inactive list in
-	 * order to score a hit and be reactivated, while trying not to
-	 * cause reactivations too frequently.
+	 * Aim for a 1:1 ratio of active to inactive.  This is to allow each
+	 * potential victim a reasonable amount of time to cycle through the
+	 * inactive list in order to score a hit and be reactivated, while
+	 * trying not to cause reactivations too frequently.
 	 */
 	if (cache_lru.count[LRU_ACTIVE] < cache_lru.count[LRU_INACTIVE]) {
 		return;



CVS commit: src/sys/kern

2020-02-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Feb 16 21:31:19 UTC 2020

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

Log Message:
nextlwp(): fix a couple of locking bugs including one I introduced yesterday,
and add comments around same.


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/sys/kern/kern_synch.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_synch.c
diff -u src/sys/kern/kern_synch.c:1.339 src/sys/kern/kern_synch.c:1.340
--- src/sys/kern/kern_synch.c:1.339	Sat Feb 15 18:12:15 2020
+++ src/sys/kern/kern_synch.c	Sun Feb 16 21:31:19 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: kern_synch.c,v 1.339 2020/02/15 18:12:15 ad Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.340 2020/02/16 21:31:19 ad Exp $	*/
 
 /*-
- * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019
+ * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019, 2020
  *The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.339 2020/02/15 18:12:15 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.340 2020/02/16 21:31:19 ad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_dtrace.h"
@@ -476,23 +476,34 @@ nextlwp(struct cpu_info *ci, struct sche
 	 * Let sched_nextlwp() select the LWP to run the CPU next.
 	 * If no LWP is runnable, select the idle LWP.
 	 * 
-	 * Note that spc_lwplock might not necessary be held, and
-	 * new thread would be unlocked after setting the LWP-lock.
+	 * On arrival here LWPs on a run queue are locked by spc_mutex which
+	 * is currently held.  Idle LWPs are always locked by spc_lwplock,
+	 * which may or may not be held here.  On exit from this code block,
+	 * in all cases newl is locked by spc_lwplock.
 	 */
 	newl = sched_nextlwp();
 	if (newl != NULL) {
 		sched_dequeue(newl);
 		KASSERT(lwp_locked(newl, spc->spc_mutex));
 		KASSERT(newl->l_cpu == ci);
-		lwp_setlock(newl, spc->spc_lwplock);
+		newl->l_stat = LSONPROC;
+		newl->l_pflag |= LP_RUNNING;
+		spc->spc_curpriority = lwp_eprio(newl);
 		spc->spc_flags &= ~(SPCF_SWITCHCLEAR | SPCF_IDLE);
+		lwp_setlock(newl, spc->spc_lwplock);
 	} else {
+		/*
+		 * Updates to newl here are unlocked, but newl is the idle
+		 * LWP and thus sheltered from outside interference, so no
+		 * harm is going to come of it.
+		 */
 		newl = ci->ci_data.cpu_idlelwp;
+		newl->l_stat = LSONPROC;
+		newl->l_pflag |= LP_RUNNING;
+		spc->spc_curpriority = PRI_IDLE;
 		spc->spc_flags = (spc->spc_flags & ~SPCF_SWITCHCLEAR) |
 		SPCF_IDLE;
 	}
-	newl->l_stat = LSONPROC;
-	newl->l_pflag |= LP_RUNNING;
 
 	/*
 	 * Only clear want_resched if there are no pending (slow) software
@@ -502,7 +513,6 @@ nextlwp(struct cpu_info *ci, struct sche
 	 * the release of spc_mutex becomes globally visible.
 	 */
 	ci->ci_want_resched = ci->ci_data.cpu_softints;
-	spc->spc_curpriority = lwp_eprio(newl);
 
 	return newl;
 }



CVS commit: src/sys/dev/i2c

2020-02-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 16 20:32:29 UTC 2020

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

Log Message:
Don't access the i2c bus in interrupt context.  Instead, mask the
interrupt and process it on a work queue.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/i2c/axppmic.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/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.28 src/sys/dev/i2c/axppmic.c:1.29
--- src/sys/dev/i2c/axppmic.c:1.28	Mon Dec 23 14:34:23 2019
+++ src/sys/dev/i2c/axppmic.c	Sun Feb 16 20:32:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.28 2019/12/23 14:34:23 thorpej Exp $ */
+/* $NetBSD: axppmic.c,v 1.29 2020/02/16 20:32:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.28 2019/12/23 14:34:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.29 2020/02/16 20:32:29 thorpej Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -366,6 +367,13 @@ struct axppmic_softc {
 	i2c_addr_t	sc_addr;
 	int		sc_phandle;
 
+	void		*sc_ih;
+	struct workqueue *sc_wq;
+
+	kmutex_t	sc_intr_lock;
+	struct work	sc_work;
+	bool		sc_work_scheduled;
+
 	const struct axppmic_config *sc_conf;
 
 	struct sysmon_pswitch sc_smpsw;
@@ -481,7 +489,6 @@ axppmic_write(i2c_tag_t tag, i2c_addr_t 
 static int
 axppmic_set_voltage(i2c_tag_t tag, i2c_addr_t addr, const struct axppmic_ctrl *c, u_int min, u_int max)
 {
-	const int flags = 0;
 	u_int vol, reg_val;
 	int nstep, error;
 	uint8_t val;
@@ -512,13 +519,13 @@ axppmic_set_voltage(i2c_tag_t tag, i2c_a
 	if (vol > max)
 		return EINVAL;
 
-	iic_acquire_bus(tag, flags);
-	if ((error = axppmic_read(tag, addr, c->c_voltage_reg, , flags)) == 0) {
+	iic_acquire_bus(tag, 0);
+	if ((error = axppmic_read(tag, addr, c->c_voltage_reg, , 0)) == 0) {
 		val &= ~c->c_voltage_mask;
 		val |= __SHIFTIN(reg_val, c->c_voltage_mask);
-		error = axppmic_write(tag, addr, c->c_voltage_reg, val, flags);
+		error = axppmic_write(tag, addr, c->c_voltage_reg, val, 0);
 	}
-	iic_release_bus(tag, flags);
+	iic_release_bus(tag, 0);
 
 	return error;
 }
@@ -526,16 +533,15 @@ axppmic_set_voltage(i2c_tag_t tag, i2c_a
 static int
 axppmic_get_voltage(i2c_tag_t tag, i2c_addr_t addr, const struct axppmic_ctrl *c, u_int *pvol)
 {
-	const int flags = 0;
 	int reg_val, error;
 	uint8_t val;
 
 	if (!c->c_voltage_mask)
 		return EINVAL;
 
-	iic_acquire_bus(tag, flags);
-	error = axppmic_read(tag, addr, c->c_voltage_reg, , flags);
-	iic_release_bus(tag, flags);
+	iic_acquire_bus(tag, 0);
+	error = axppmic_read(tag, addr, c->c_voltage_reg, , 0);
+	iic_release_bus(tag, 0);
 	if (error)
 		return error;
 
@@ -561,11 +567,11 @@ axppmic_power_poweroff(device_t dev)
 
 	delay(100);
 
-	error = iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
+	error = iic_acquire_bus(sc->sc_i2c, 0);
 	if (error == 0) {
 		error = axppmic_write(sc->sc_i2c, sc->sc_addr,
-		AXP_POWER_DISABLE_REG, AXP_POWER_DISABLE_CTRL, I2C_F_POLL);
-		iic_release_bus(sc->sc_i2c, I2C_F_POLL);
+		AXP_POWER_DISABLE_REG, AXP_POWER_DISABLE_CTRL, 0);
+		iic_release_bus(sc->sc_i2c, 0);
 	}
 	if (error) {
 		device_printf(dev, "WARNING: unable to power off, error %d\n",
@@ -590,7 +596,6 @@ axppmic_sensor_update(struct sysmon_envs
 {
 	struct axppmic_softc *sc = sme->sme_cookie;
 	const struct axppmic_config *c = sc->sc_conf;
-	const int flags = I2C_F_POLL;
 	uint8_t val, lo, hi;
 
 	e->state = ENVSYS_SINVALID;
@@ -601,19 +606,19 @@ axppmic_sensor_update(struct sysmon_envs
 
 	switch (e->private) {
 	case AXP_SENSOR_ACIN_PRESENT:
-		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , flags) == 0) {
+		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , 0) == 0) {
 			e->state = ENVSYS_SVALID;
 			e->value_cur = !!(val & AXP_POWER_SOURCE_ACIN_PRESENT);
 		}
 		break;
 	case AXP_SENSOR_VBUS_PRESENT:
-		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , flags) == 0) {
+		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , 0) == 0) {
 			e->state = ENVSYS_SVALID;
 			e->value_cur = !!(val & AXP_POWER_SOURCE_VBUS_PRESENT);
 		}
 		break;
 	case AXP_SENSOR_BATT_PRESENT:
-		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , flags) == 0) {
+		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , 0) == 0) {
 			if (val & AXP_POWER_MODE_BATT_VALID) {
 e->state = ENVSYS_SVALID;
 e->value_cur = !!(val & AXP_POWER_MODE_BATT_PRESENT);
@@ -621,14 +626,14 @@ axppmic_sensor_update(struct sysmon_envs
 		}
 		break;
 	case AXP_SENSOR_BATT_CHARGING:
-		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , flags) == 0) {
+		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , 0) == 

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

2020-02-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 16 20:29:36 UTC 2020

Modified Files:
src/sys/arch/arm/sunxi: sunxi_nmi.c

Log Message:
Provide a back-end for fdt_intr_mask() / fdt_intr_unmask().


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_nmi.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/sunxi/sunxi_nmi.c
diff -u src/sys/arch/arm/sunxi/sunxi_nmi.c:1.4 src/sys/arch/arm/sunxi/sunxi_nmi.c:1.5
--- src/sys/arch/arm/sunxi/sunxi_nmi.c:1.4	Tue Jan  7 10:20:07 2020
+++ src/sys/arch/arm/sunxi/sunxi_nmi.c	Sun Feb 16 20:29:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_nmi.c,v 1.4 2020/01/07 10:20:07 skrll Exp $ */
+/* $NetBSD: sunxi_nmi.c,v 1.5 2020/02/16 20:29:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -29,7 +29,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,v 1.4 2020/01/07 10:20:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,v 1.5 2020/02/16 20:29:36 thorpej Exp $");
 
 #include 
 #include 
@@ -37,6 +37,8 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -99,10 +101,12 @@ struct sunxi_nmi_softc {
 	bus_space_handle_t sc_bsh;
 	int sc_phandle;
 
+	kmutex_t sc_intr_lock;
+
 	const struct sunxi_nmi_config *sc_config;
 
-	int (*sc_func)(void *);
-	void *sc_arg;
+	struct intrsource sc_is;
+	void	*sc_ih;
 };
 
 #define NMI_READ(sc, reg) \
@@ -148,11 +152,17 @@ static int
 sunxi_nmi_intr(void *priv)
 {
 	struct sunxi_nmi_softc * const sc = priv;
+	int (*func)(void *);
 	int rv = 0;
 
-	if (sc->sc_func)
-		rv = sc->sc_func(sc->sc_arg);
-
+	func = atomic_load_acquire(>sc_is.is_func);
+	if (func)
+		rv = func(sc->sc_is.is_arg);
+
+	/*
+	 * We don't serialize access to this register because we're the
+	 * only thing fiddling wth it.
+	 */
 	sunxi_nmi_irq_ack(sc);
 
 	return rv;
@@ -164,19 +174,13 @@ sunxi_nmi_fdt_establish(device_t dev, u_
 {
 	struct sunxi_nmi_softc * const sc = device_private(dev);
 	u_int irq_type;
+	int ist;
 
 	/* 1st cell is the interrupt number */
 	const u_int irq = be32toh(specifier[0]);
 	/* 2nd cell is polarity */
 	const u_int pol = be32toh(specifier[1]);
 
-	if (sc->sc_func != NULL) {
-#ifdef DIAGNOSTIC
-		device_printf(dev, "%s in use\n", sc->sc_config->name);
-#endif
-		return NULL;
-	}
-
 	if (irq != 0) {
 #ifdef DIAGNOSTIC
 		device_printf(dev, "IRQ %u is invalid\n", irq);
@@ -187,42 +191,100 @@ sunxi_nmi_fdt_establish(device_t dev, u_
 	switch (pol & 0x7) {
 	case 1:	/* IRQ_TYPE_EDGE_RISING */
 		irq_type = NMI_CTRL_IRQ_HIGH_EDGE;
+		ist = IST_EDGE;
 		break;
 	case 2:	/* IRQ_TYPE_EDGE_FALLING */
 		irq_type = NMI_CTRL_IRQ_LOW_EDGE;
+		ist = IST_EDGE;
 		break;
 	case 3:	/* IRQ_TYPE_LEVEL_HIGH */
 		irq_type = NMI_CTRL_IRQ_HIGH_LEVEL;
+		ist = IST_LEVEL;
 		break;
 	case 4:	/* IRQ_TYPE_LEVEL_LOW */
 		irq_type = NMI_CTRL_IRQ_LOW_LEVEL;
+		ist = IST_LEVEL;
 		break;
 	default:
 		irq_type = NMI_CTRL_IRQ_LOW_LEVEL;
+		ist = IST_LEVEL;
 		break;
 	}
 
-	sc->sc_func = func;
-	sc->sc_arg = arg;
+	mutex_enter(>sc_intr_lock);
+
+	if (atomic_load_relaxed(>sc_is.is_func) != NULL) {
+		mutex_exit(>sc_intr_lock);
+#ifdef DIAGNOSTIC
+		device_printf(dev, "%s in use\n", sc->sc_config->name);
+#endif
+		return NULL;
+	}
+
+	sc->sc_is.is_arg = arg;
+	atomic_store_release(>sc_is.is_func, func);
+
+	sc->sc_is.is_type = ist;
+	sc->sc_is.is_ipl = ipl;
+	sc->sc_is.is_mpsafe = (flags & FDT_INTR_MPSAFE) ? true : false;
+
+	mutex_exit(>sc_intr_lock);
+
+	sc->sc_ih = fdtbus_intr_establish(sc->sc_phandle, 0, ipl, flags,
+	sunxi_nmi_intr, sc);
 
+	mutex_enter(>sc_intr_lock);
 	sunxi_nmi_irq_set_type(sc, irq_type);
 	sunxi_nmi_irq_enable(sc, true);
+	mutex_exit(>sc_intr_lock);
 
-	return fdtbus_intr_establish(sc->sc_phandle, 0, ipl, flags,
-	sunxi_nmi_intr, sc);
+	return >sc_is;
+}
+
+static void
+sunxi_nmi_fdt_mask(device_t dev, void *ih __unused)
+{
+	struct sunxi_nmi_softc * const sc = device_private(dev);
+
+	mutex_enter(>sc_intr_lock);
+	if (sc->sc_is.is_mask_count++ == 0) {
+		sunxi_nmi_irq_enable(sc, false);
+	}
+	mutex_exit(>sc_intr_lock);
+}
+
+static void
+sunxi_nmi_fdt_unmask(device_t dev, void *ih __unused)
+{
+	struct sunxi_nmi_softc * const sc = device_private(dev);
+
+	mutex_enter(>sc_intr_lock);
+	if (sc->sc_is.is_mask_count-- == 1) {
+		sunxi_nmi_irq_enable(sc, true);
+	}
+	mutex_exit(>sc_intr_lock);
 }
 
 static void
 sunxi_nmi_fdt_disestablish(device_t dev, void *ih)
 {
 	struct sunxi_nmi_softc * const sc = device_private(dev);
+	struct intrsource * const is = ih;
+
+	KASSERT(is == >sc_is);
 
+	mutex_enter(>sc_intr_lock);
 	sunxi_nmi_irq_enable(sc, false);
+	is->is_mask_count = 0;
+	mutex_exit(>sc_intr_lock);
 
-	fdtbus_intr_disestablish(sc->sc_phandle, ih);
+	fdtbus_intr_disestablish(sc->sc_phandle, sc->sc_ih);
+	sc->sc_ih = NULL;
 
-	sc->sc_func = NULL;
-	

CVS commit: src/sys/dev/fdt

2020-02-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 16 20:28:18 UTC 2020

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

Log Message:
Add fdt_intr_mask() / fdt_intr_unmask() functions, for masking and
unmasking invididual interrupt sources (similar to acpi_intr_mask()
and acpi_intr_unmask()).


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/fdt/fdt_intr.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.58 -r1.59 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/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.24 src/sys/dev/fdt/fdt_intr.c:1.25
--- src/sys/dev/fdt/fdt_intr.c:1.24	Tue Dec 31 20:47:05 2019
+++ src/sys/dev/fdt/fdt_intr.c	Sun Feb 16 20:28:18 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.24 2019/12/31 20:47:05 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.25 2020/02/16 20:28:18 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,15 +27,19 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.24 2019/12/31 20:47:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.25 2020/02/16 20:28:18 thorpej Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
+#include 
 
 struct fdtbus_interrupt_controller {
 	device_t ic_dev;
@@ -53,14 +57,26 @@ struct fdtbus_interrupt_cookie {
 	void *c_ih;
 
 	LIST_ENTRY(fdtbus_interrupt_cookie) c_next;
+	uint32_t c_refcnt;
 };
 
 static LIST_HEAD(, fdtbus_interrupt_cookie) fdtbus_interrupt_cookies =
 LIST_HEAD_INITIALIZER(fdtbus_interrupt_cookies);
+static kmutex_t fdtbus_interrupt_cookie_mutex;
+static kcondvar_t fdtbus_interrupt_cookie_wait;
+static bool fdtbus_interrupt_cookies_wanted;
 
 static const u_int *	get_specifier_by_index(int, int, int *);
 static const u_int *	get_specifier_from_map(int, const u_int *, int *);
 
+void
+fdtbus_intr_init(void)
+{
+
+	mutex_init(_interrupt_cookie_mutex, MUTEX_SPIN, IPL_HIGH);
+	cv_init(_interrupt_cookie_wait, "fdtintr");
+}
+
 /*
  * Find the interrupt controller for a given node. This function will either
  * return the phandle of the interrupt controller for this node, or the phandle
@@ -130,6 +146,37 @@ fdtbus_register_interrupt_controller(dev
 	return 0;
 }
 
+static struct fdtbus_interrupt_cookie *
+fdtbus_get_interrupt_cookie(void *cookie)
+{
+	struct fdtbus_interrupt_cookie *c;
+
+	mutex_enter(_interrupt_cookie_mutex);
+	LIST_FOREACH(c, _interrupt_cookies, c_next) {
+		if (c->c_ih == cookie) {
+			c->c_refcnt++;
+			KASSERT(c->c_refcnt > 0);
+			break;
+		}
+	}
+	mutex_exit(_interrupt_cookie_mutex);
+	return c;
+}
+
+static void
+fdtbus_put_interrupt_cookie(struct fdtbus_interrupt_cookie *c)
+{
+
+	mutex_enter(_interrupt_cookie_mutex);
+	KASSERT(c->c_refcnt > 0);
+	c->c_refcnt--;
+	if (fdtbus_interrupt_cookies_wanted) {
+		fdtbus_interrupt_cookies_wanted = false;
+		cv_signal(_interrupt_cookie_wait);
+	}
+	mutex_exit(_interrupt_cookie_mutex);
+}
+
 void *
 fdtbus_intr_establish(int phandle, u_int index, int ipl, int flags,
 int (*func)(void *), void *arg)
@@ -173,13 +220,29 @@ fdtbus_intr_establish_raw(int ihandle, c
 		return NULL;
 	}
 
+	c = kmem_zalloc(sizeof(*c), KM_SLEEP);
+	c->c_ic = ic;
+	mutex_enter(_interrupt_cookie_mutex);
+	LIST_INSERT_HEAD(_interrupt_cookies, c, c_next);
+	mutex_exit(_interrupt_cookie_mutex);
+
+	/*
+	 * XXX This leaves a small window where the handler is registered
+	 * (and thus could be called) before the cookie on the list has a
+	 * valid lookup key (and thus can be found).  This will cause a
+	 * panic in fdt_intr_mask() if that is called from the handler before
+	 * this situation is resolved.  For now we just cross our fingers
+	 * and hope that the device won't actually interrupt until we return.
+	 */
 	ih = ic->ic_funcs->establish(ic->ic_dev, __UNCONST(specifier),
 	ipl, flags, func, arg);
 	if (ih != NULL) {
-		c = kmem_alloc(sizeof(*c), KM_SLEEP);
-		c->c_ic = ic;
-		c->c_ih = ih;
-		LIST_INSERT_HEAD(_interrupt_cookies, c, c_next);
+		atomic_store_release(>c_ih, ih);
+	} else {
+		mutex_enter(_interrupt_cookie_mutex);
+		LIST_REMOVE(c, c_next);
+		mutex_exit(_interrupt_cookie_mutex);
+		kmem_free(c, sizeof(*c));
 	}
 
 	return ih;
@@ -188,22 +251,70 @@ fdtbus_intr_establish_raw(int ihandle, c
 void
 fdtbus_intr_disestablish(int phandle, void *cookie)
 {
-	struct fdtbus_interrupt_controller *ic = NULL;
 	struct fdtbus_interrupt_cookie *c;
 
-	LIST_FOREACH(c, _interrupt_cookies, c_next) {
-		if (c->c_ih == cookie) {
-			ic = c->c_ic;
-			LIST_REMOVE(c, c_next);
-			kmem_free(c, sizeof(*c));
-			break;
-		}
+	if ((c = fdtbus_get_interrupt_cookie(cookie)) == NULL) {
+		panic("%s: interrupt handle not valid", __func__);
 	}
 
-	if (ic == NULL)
+	const struct fdtbus_interrupt_controller *ic = c->c_ic;
+	ic->ic_funcs->disestablish(ic->ic_dev, cookie);

CVS commit: src/lib/libpthread

2020-02-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 16 17:45:12 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c pthread_int.h pthread_mutex.c
pthread_tsd.c

Log Message:
Revert "Enhance the pthread(3) + malloc(3) init model"

It is reported to hand on aarch64 with gzip.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.102 -r1.103 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.75 -r1.76 src/lib/libpthread/pthread_mutex.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libpthread/pthread_tsd.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.166 src/lib/libpthread/pthread.c:1.167
--- src/lib/libpthread/pthread.c:1.166	Sun Feb 16 17:14:31 2020
+++ src/lib/libpthread/pthread.c	Sun Feb 16 17:45:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.166 2020/02/16 17:14:31 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.167 2020/02/16 17:45:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.166 2020/02/16 17:14:31 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.167 2020/02/16 17:45:11 kamil Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -181,7 +181,7 @@ pthread__init(void)
 	 * while pthread_keys descriptors are not
 	 * yet allocated.
 	 */
-	pthread__main = pthread_tsd_earlyinit(&__pthread_st_size);
+	pthread__main = pthread_tsd_init(&__pthread_st_size);
 	if (pthread__main == NULL)
 		err(EXIT_FAILURE, "Cannot allocate pthread storage");
 
@@ -257,23 +257,9 @@ pthread__init(void)
 		}
 	}
 
-	/*
-	 * We are officially threded now.
-	 *
-	 * libc must be informed about this before bootstrapping malloc(3).
-	 */
-	__isthreaded = 1;
-
-	/*
-	 * Tell libc that we're here and it should role-play accordingly.
-	 *
-	 * pthread_atfork(3) calls malloc(3) and initializes the system malloc.
-	 * At this point all POSIX thread inferfaces must be functional.
-	 */
+	/* Tell libc that we're here and it should role-play accordingly. */
 	pthread_atfork(NULL, NULL, pthread__fork_callback);
-
-	/* Register atfork handlers for TSD. */
-	pthread_tsd_init();
+	__isthreaded = 1;
 }
 
 static void

Index: src/lib/libpthread/pthread_int.h
diff -u src/lib/libpthread/pthread_int.h:1.102 src/lib/libpthread/pthread_int.h:1.103
--- src/lib/libpthread/pthread_int.h:1.102	Sat Feb 15 23:59:30 2020
+++ src/lib/libpthread/pthread_int.h	Sun Feb 16 17:45:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_int.h,v 1.102 2020/02/15 23:59:30 kamil Exp $	*/
+/*	$NetBSD: pthread_int.h,v 1.103 2020/02/16 17:45:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -294,8 +294,7 @@ pthread__self(void)
 	} \
 } while (/*CONSTCOND*/0)
 
-void 	*pthread_tsd_earlyinit(size_t *) PTHREAD_HIDE;
-void 	pthread_tsd_init(void) PTHREAD_HIDE;
+void 	*pthread_tsd_init(size_t *) PTHREAD_HIDE;
 void	pthread__destroy_tsd(pthread_t) PTHREAD_HIDE;
 void	pthread__copy_tsd(pthread_t) PTHREAD_HIDE;
 

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.75 src/lib/libpthread/pthread_mutex.c:1.76
--- src/lib/libpthread/pthread_mutex.c:1.75	Sat Feb 15 23:59:30 2020
+++ src/lib/libpthread/pthread_mutex.c	Sun Feb 16 17:45:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.75 2020/02/15 23:59:30 kamil Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.76 2020/02/16 17:45:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.75 2020/02/15 23:59:30 kamil Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.76 2020/02/16 17:45:11 kamil Exp $");
 
 #include 
 #include 
@@ -122,12 +122,14 @@ pthread_mutex_init(pthread_mutex_t *ptm,
 {
 	uintptr_t type, proto, val, ceil;
 
+#if 0
 	/*
 	 * Always initialize the mutex structure, maybe be used later
 	 * and the cost should be minimal.
 	 */
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_init_stub(ptm, attr);
+#endif
 
 	pthread__error(EINVAL, "Invalid mutes attribute",
 	attr == NULL || attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
@@ -617,9 +619,10 @@ pthread__mutex_wakeup(pthread_t self, pt
 int
 pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
-
+#if 0
 	if (__predict_false(__uselibcstub))
 		return __libc_mutexattr_init_stub(attr);
+#endif
 
 	attr->ptma_magic = _PT_MUTEXATTR_MAGIC;
 	attr->ptma_private = (void *)PTHREAD_MUTEX_DEFAULT;

Index: src/lib/libpthread/pthread_tsd.c
diff -u src/lib/libpthread/pthread_tsd.c:1.19 src/lib/libpthread/pthread_tsd.c:1.20
--- src/lib/libpthread/pthread_tsd.c:1.19	Sat Feb 15 23:59:30 2020
+++ src/lib/libpthread/pthread_tsd.c	Sun Feb 16 17:45:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_tsd.c,v 1.19 2020/02/15 23:59:30 kamil Exp $	*/
+/*	$NetBSD: 

CVS commit: src/lib/libpthread

2020-02-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 16 17:14:31 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Set __isthreaded before bootstrapping malloc(3)

jemalloc depends on the __isthreaded dynamic state logic.

Reported by  for mpv and by  for gzip.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.165 src/lib/libpthread/pthread.c:1.166
--- src/lib/libpthread/pthread.c:1.165	Sat Feb 15 23:59:30 2020
+++ src/lib/libpthread/pthread.c	Sun Feb 16 17:14:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.165 2020/02/15 23:59:30 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.166 2020/02/16 17:14:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.165 2020/02/15 23:59:30 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.166 2020/02/16 17:14:31 kamil Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -258,16 +258,22 @@ pthread__init(void)
 	}
 
 	/*
+	 * We are officially threded now.
+	 *
+	 * libc must be informed about this before bootstrapping malloc(3).
+	 */
+	__isthreaded = 1;
+
+	/*
 	 * Tell libc that we're here and it should role-play accordingly.
 	 *
 	 * pthread_atfork(3) calls malloc(3) and initializes the system malloc.
+	 * At this point all POSIX thread inferfaces must be functional.
 	 */
 	pthread_atfork(NULL, NULL, pthread__fork_callback);
 
-	/* Requires functional malloc(3). */
+	/* Register atfork handlers for TSD. */
 	pthread_tsd_init();
-
-	__isthreaded = 1;
 }
 
 static void



CVS commit: src/crypto/external/bsd/openssl/dist/crypto

2020-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 16 15:03:22 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/md4: md4_dgst.c
src/crypto/external/bsd/openssl/dist/crypto/ripemd: rmd_dgst.c

Log Message:
use unsigned to avoid undefined behavior in shifts (nisharg joshi)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/openssl/dist/crypto/md4/md4_dgst.c
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/md4/md4_dgst.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/md4/md4_dgst.c:1.6 src/crypto/external/bsd/openssl/dist/crypto/md4/md4_dgst.c:1.7
--- src/crypto/external/bsd/openssl/dist/crypto/md4/md4_dgst.c:1.6	Thu Feb  8 16:51:29 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/md4/md4_dgst.c	Sun Feb 16 10:03:22 2020
@@ -37,10 +37,10 @@ int MD4_Init(MD4_CTX *c)
 void md4_block_data_order(MD4_CTX *c, const void *data_, size_t num)
 {
 const unsigned char *data = data_;
-register MD32_REG_T A, B, C, D, l;
+register unsigned MD32_REG_T A, B, C, D, l;
 # ifndef MD32_XARRAY
 /* See comment in crypto/sha/sha_locl.h for details. */
-MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
+unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
 XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15;
 #  define X(i)   XX##i
 # else

Index: src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c:1.6 src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c:1.7
--- src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c:1.6	Thu Feb  8 16:51:31 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c	Sun Feb 16 10:03:22 2020
@@ -36,11 +36,11 @@ int RIPEMD160_Init(RIPEMD160_CTX *c)
 void ripemd160_block_data_order(RIPEMD160_CTX *ctx, const void *p, size_t num)
 {
 const unsigned char *data = p;
-register MD32_REG_T A, B, C, D, E;
-MD32_REG_T a, b, c, d, e, l;
+register unsigned MD32_REG_T A, B, C, D, E;
+unsigned MD32_REG_T a, b, c, d, e, l;
 # ifndef MD32_XARRAY
 /* See comment in crypto/sha/sha_locl.h for details. */
-MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
+unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
 XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15;
 #  define X(i)   XX##i
 # else



CVS commit: src/sys

2020-02-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb 16 14:56:52 UTC 2020

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/dev/fdt: fdt_subr.c fdtvar.h

Log Message:
Rename fdtbus_set_data() to fdtbus_init().  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.57 -r1.58 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/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.66 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.67
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.66	Tue Jan 21 10:54:11 2020
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Sun Feb 16 14:56:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.66 2020/01/21 10:54:11 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.67 2020/02/16 14:56:52 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.66 2020/01/21 10:54:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.67 2020/02/16 14:56:52 thorpej Exp $");
 
 #include "opt_machdep.h"
 #include "opt_bootconfig.h"
@@ -494,7 +494,7 @@ initarm(void *arg)
 		error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data));
 		if (error != 0)
 			panic("fdt_move failed: %s", fdt_strerror(error));
-		fdtbus_set_data(fdt_data);
+		fdtbus_init(fdt_data);
 	} else {
 		panic("fdt_check_header failed: %s", fdt_strerror(error));
 	}

Index: src/sys/dev/fdt/fdt_subr.c
diff -u src/sys/dev/fdt/fdt_subr.c:1.31 src/sys/dev/fdt/fdt_subr.c:1.32
--- src/sys/dev/fdt/fdt_subr.c:1.31	Tue Sep 24 15:23:34 2019
+++ src/sys/dev/fdt/fdt_subr.c	Sun Feb 16 14:56:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.31 2019/09/24 15:23:34 jmcneill Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.32 2020/02/16 14:56:52 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.31 2019/09/24 15:23:34 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.32 2020/02/16 14:56:52 thorpej Exp $");
 
 #include "opt_fdt.h"
 
@@ -43,7 +43,7 @@ static struct fdt_conslist fdt_console_l
 TAILQ_HEAD_INITIALIZER(fdt_console_list);
 
 bool
-fdtbus_set_data(const void *data)
+fdtbus_init(const void *data)
 {
 	KASSERT(fdt_data == NULL);
 	if (fdt_check_header(data) != 0) {

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.57 src/sys/dev/fdt/fdtvar.h:1.58
--- src/sys/dev/fdt/fdtvar.h:1.57	Sat Nov  9 23:28:26 2019
+++ src/sys/dev/fdt/fdtvar.h	Sun Feb 16 14:56:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.57 2019/11/09 23:28:26 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.58 2020/02/16 14:56:52 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -396,7 +396,7 @@ void		fdtbus_power_poweroff(void);
 device_t	fdtbus_attach_i2cbus(device_t, int, i2c_tag_t, cfprint_t);
 device_t	fdtbus_attach_spibus(device_t, int, cfprint_t);
 
-bool		fdtbus_set_data(const void *);
+bool		fdtbus_init(const void *);
 const void *	fdtbus_get_data(void);
 int		fdtbus_phandle2offset(int);
 int		fdtbus_offset2phandle(int);



CVS commit: src/external/cddl/osnet/dist/cmd/zpool

2020-02-16 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Feb 16 14:06:10 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/cmd/zpool: zpool_vdev.c

Log Message:
zpool: The NetBSD specific ioctl needs to include sys/ioctl.h


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c

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

Modified files:

Index: src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c
diff -u src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.4 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.5
--- src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.4	Mon May 28 21:05:04 2018
+++ src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c	Sun Feb 16 14:06:10 2020
@@ -80,6 +80,7 @@
 #endif
 #ifdef __NetBSD__
 #include 
+#include 
 #endif
 
 #include "zpool_util.h"



CVS commit: [netbsd-9] src/doc

2020-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 16 12:21:24 UTC 2020

Added Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #709 and #710


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/doc/CHANGES-9.1

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

Added files:

Index: src/doc/CHANGES-9.1
diff -u /dev/null src/doc/CHANGES-9.1:1.1.2.1
--- /dev/null	Sun Feb 16 12:21:24 2020
+++ src/doc/CHANGES-9.1	Sun Feb 16 12:21:24 2020
@@ -0,0 +1,21 @@
+# $NetBSD: CHANGES-9.1,v 1.1.2.1 2020/02/16 12:21:24 martin Exp $
+
+A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
+release:
+
+external/gpl2/groff/tmac/mdoc.local patched by hand
+sys/sys/param.h patched by hand
+
+Welcome to 9.0_STABLE.
+[martin]
+
+external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c 1.57
+
+	zfs_netbsd_setattr: ignore size changes on device nodes.
+	[hannken, ticket #709]
+
+external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c 1.58
+
+	Teach zfs to revoke vnodes the usual way.
+	[riastradh, ticket #710]
+



CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 16 12:20:02 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: zfs_vnops.c

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

external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c: revision 1.58

Teach zfs to revoke vnodes the usual way.
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.4 -r1.50.2.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.5
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.4	Sun Feb 16 12:18:27 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Feb 16 12:20:02 2020
@@ -6286,6 +6286,7 @@ const struct vnodeopv_entry_desc zfs_vno
 	{ _ioctl_desc,		zfs_netbsd_ioctl },
 	{ _poll_desc,		genfs_poll },
 	{ _kqfilter_desc,		genfs_kqfilter },
+	{ _revoke_desc,		genfs_revoke },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		zfs_netbsd_remove },
 	{ _link_desc,		zfs_netbsd_link },
@@ -6330,6 +6331,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _ioctl_desc,		spec_ioctl },
 	{ _poll_desc,		spec_poll },
 	{ _kqfilter_desc,		spec_kqfilter },
+	{ _revoke_desc,		spec_revoke },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		spec_remove },
 	{ _link_desc,		spec_link },
@@ -6374,6 +6376,7 @@ const struct vnodeopv_entry_desc zfs_fif
 	{ _ioctl_desc,		vn_fifo_bypass },
 	{ _poll_desc,		vn_fifo_bypass },
 	{ _kqfilter_desc,		vn_fifo_bypass },
+	{ _revoke_desc,		vn_fifo_bypass },
 	{ _fsync_desc,		zfs_netbsd_fsync },
 	{ _remove_desc,		vn_fifo_bypass },
 	{ _link_desc,		vn_fifo_bypass },



CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 16 12:18:27 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: zfs_vnops.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #709):

external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c: revision 1.57

zfs_netbsd_setattr: ignore size changes on device nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.3 -r1.50.2.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50.2.3	Sun Oct  6 11:18:01 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Feb 16 12:18:27 2020
@@ -5553,6 +5553,9 @@ zfs_netbsd_setattr(void *v)
 
 	zflags = VTOZ(vp)->z_pflags;
 
+	/* Ignore size changes on device nodes. */
+	if (vp->v_type == VBLK || vp->v_type == VCHR)
+		xvap.xva_vattr.va_mask &= ~AT_SIZE;
 	if (vap->va_flags != VNOVAL) {
 		int error;
 



CVS commit: [netbsd-9] src

2020-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 16 12:16:28 UTC 2020

Modified Files:
src/external/gpl2/groff/tmac [netbsd-9]: mdoc.local
src/sys/sys [netbsd-9]: param.h

Log Message:
Welcome to 9.0_STABLE


To generate a diff of this commit:
cvs rdiff -u -r1.5.6.4 -r1.5.6.5 src/external/gpl2/groff/tmac/mdoc.local
cvs rdiff -u -r1.599.2.5 -r1.599.2.6 src/sys/sys/param.h

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

Modified files:

Index: src/external/gpl2/groff/tmac/mdoc.local
diff -u src/external/gpl2/groff/tmac/mdoc.local:1.5.6.4 src/external/gpl2/groff/tmac/mdoc.local:1.5.6.5
--- src/external/gpl2/groff/tmac/mdoc.local:1.5.6.4	Fri Feb 14 00:06:28 2020
+++ src/external/gpl2/groff/tmac/mdoc.local	Sun Feb 16 12:16:28 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdoc.local,v 1.5.6.4 2020/02/14 00:06:28 martin Exp $
+.\" $NetBSD: mdoc.local,v 1.5.6.5 2020/02/16 12:16:28 martin Exp $
 .\"
 .\" Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,9 +44,9 @@
 .as doc-str-St--ieee1275-94 " (\*[Lq]\*[doc-Tn-font-size]Open Firmware\*[doc-str-St]\*[Rq])
 .
 .\" Default .Os value
-.ds doc-operating-system NetBSD\~9.0
+.ds doc-operating-system NetBSD\~9.0_STABLE
 .\" Default footer operating system value
-.ds doc-default-operating-system NetBSD\~9.0
+.ds doc-default-operating-system NetBSD\~9.0_STABLE
 .\" Other known versions, not yet in groff distribution
 .ds doc-operating-system-NetBSD-1.3.3  1.3.3
 .ds doc-operating-system-NetBSD-1.6.3  1.6.3

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.599.2.5 src/sys/sys/param.h:1.599.2.6
--- src/sys/sys/param.h:1.599.2.5	Fri Feb 14 00:06:28 2020
+++ src/sys/sys/param.h	Sun Feb 16 12:16:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.599.2.5 2020/02/14 00:06:28 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.599.2.6 2020/02/16 12:16:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	9	/* NetBSD 9.0 */
+#define	__NetBSD_Version__	9	/* NetBSD 9.0_STABLE */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/share/man/man4

2020-02-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb 16 10:45:42 UTC 2020

Modified Files:
src/share/man/man4: hdaudio.4

Log Message:
Remove azalia(4) references, spotted by maxv


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/hdaudio.4

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

Modified files:

Index: src/share/man/man4/hdaudio.4
diff -u src/share/man/man4/hdaudio.4:1.14 src/share/man/man4/hdaudio.4:1.15
--- src/share/man/man4/hdaudio.4:1.14	Fri Sep 19 17:27:12 2014
+++ src/share/man/man4/hdaudio.4	Sun Feb 16 10:45:42 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hdaudio.4,v 1.14 2014/09/19 17:27:12 christos Exp $
+.\"	$NetBSD: hdaudio.4,v 1.15 2020/02/16 10:45:42 jmcneill Exp $
 .\"
 .\" Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 19, 2014
+.Dd February 16, 2020
 .Dt HDAUDIO 4
 .Os
 .Sh NAME
@@ -46,8 +46,6 @@ The
 .Nm
 device driver is expected to support any PCI device which is
 compliant to the High Definition Audio Specification 1.0.
-It is a replacement for
-.Xr azalia 4 .
 It was written from scratch following the Intel HD Audio and Microsoft
 Universal Audio Architecture specifications.
 .Pp
@@ -76,11 +74,6 @@ controls.
 As part of this process, loops in the inter-codec links must be detected
 and muted, bi-directional pins must be set up appropriately and the locations
 of pins determined.
-Unlike the
-.Xr azalia 4
-driver (which tends to generate a large number of unclearly named
-.Xr mixer 4
-controls),
 .Nm
 works backwards by starting with a list of desired, consistent and compatible
 .Xr mixer 4



CVS commit: src/sys/dev/usb

2020-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb 16 09:53:55 UTC 2020

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

Log Message:
Improve the check, to prevent more surprises.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/usb/usbdi_util.c

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

Modified files:

Index: src/sys/dev/usb/usbdi_util.c
diff -u src/sys/dev/usb/usbdi_util.c:1.80 src/sys/dev/usb/usbdi_util.c:1.81
--- src/sys/dev/usb/usbdi_util.c:1.80	Sun Feb 16 09:40:35 2020
+++ src/sys/dev/usb/usbdi_util.c	Sun Feb 16 09:53:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.c,v 1.80 2020/02/16 09:40:35 maxv Exp $	*/
+/*	$NetBSD: usbdi_util.c,v 1.81 2020/02/16 09:53:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.80 2020/02/16 09:40:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.81 2020/02/16 09:53:54 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -739,8 +739,8 @@ usb_desc_iter_peek(usbd_desc_iter_t *ite
 		return NULL;
 	}
 	desc = (const usb_descriptor_t *)iter->cur;
-	if (desc->bLength == 0) {
-		printf("%s: descriptor length = 0\n", __func__);
+	if (desc->bLength < USB_DESCRIPTOR_SIZE) {
+		printf("%s: descriptor length too small\n", __func__);
 		return NULL;
 	}
 	if (iter->cur + desc->bLength > iter->end) {



CVS commit: src/sys/dev/usb

2020-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb 16 09:40:35 UTC 2020

Modified Files:
src/sys/dev/usb: usbdi.c usbdi.h usbdi_util.c usbdi_util.h

Log Message:
Move usb_desc_* into usbdi_util.c, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/usb/usbdi.h
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/usb/usbdi_util.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/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.192 src/sys/dev/usb/usbdi.c:1.193
--- src/sys/dev/usb/usbdi.c:1.192	Wed Feb 12 16:01:00 2020
+++ src/sys/dev/usb/usbdi.c	Sun Feb 16 09:40:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.192 2020/02/12 16:01:00 riastradh Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.193 2020/02/16 09:40:35 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.192 2020/02/12 16:01:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.193 2020/02/16 09:40:35 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1271,80 +1271,6 @@ usb_match_device(const struct usb_devno 
 	return NULL;
 }
 
-
-void
-usb_desc_iter_init(struct usbd_device *dev, usbd_desc_iter_t *iter)
-{
-	const usb_config_descriptor_t *cd = usbd_get_config_descriptor(dev);
-
-	iter->cur = (const uByte *)cd;
-	iter->end = (const uByte *)cd + UGETW(cd->wTotalLength);
-}
-
-const usb_descriptor_t *
-usb_desc_iter_peek(usbd_desc_iter_t *iter)
-{
-	const usb_descriptor_t *desc;
-
-	if (iter->cur + sizeof(usb_descriptor_t) >= iter->end) {
-		if (iter->cur != iter->end)
-			printf("%s: bad descriptor\n", __func__);
-		return NULL;
-	}
-	desc = (const usb_descriptor_t *)iter->cur;
-	if (desc->bLength == 0) {
-		printf("%s: descriptor length = 0\n", __func__);
-		return NULL;
-	}
-	if (iter->cur + desc->bLength > iter->end) {
-		printf("%s: descriptor length too large\n", __func__);
-		return NULL;
-	}
-	return desc;
-}
-
-const usb_descriptor_t *
-usb_desc_iter_next(usbd_desc_iter_t *iter)
-{
-	const usb_descriptor_t *desc = usb_desc_iter_peek(iter);
-	if (desc == NULL)
-		return NULL;
-	iter->cur += desc->bLength;
-	return desc;
-}
-
-/* Return the next interface descriptor, skipping over any other
- * descriptors.  Returns NULL at the end or on error. */
-const usb_interface_descriptor_t *
-usb_desc_iter_next_interface(usbd_desc_iter_t *iter)
-{
-	const usb_descriptor_t *desc;
-
-	while ((desc = usb_desc_iter_peek(iter)) != NULL &&
-	   desc->bDescriptorType != UDESC_INTERFACE)
-	{
-		usb_desc_iter_next(iter);
-	}
-
-	return (const usb_interface_descriptor_t *)usb_desc_iter_next(iter);
-}
-
-/* Returns the next non-interface descriptor, returning NULL when the
- * next descriptor would be an interface descriptor. */
-const usb_descriptor_t *
-usb_desc_iter_next_non_interface(usbd_desc_iter_t *iter)
-{
-	const usb_descriptor_t *desc;
-
-	if ((desc = usb_desc_iter_peek(iter)) != NULL &&
-	desc->bDescriptorType != UDESC_INTERFACE)
-	{
-		return usb_desc_iter_next(iter);
-	} else {
-		return NULL;
-	}
-}
-
 usbd_status
 usbd_get_string(struct usbd_device *dev, int si, char *buf)
 {

Index: src/sys/dev/usb/usbdi.h
diff -u src/sys/dev/usb/usbdi.h:1.101 src/sys/dev/usb/usbdi.h:1.102
--- src/sys/dev/usb/usbdi.h:1.101	Wed Feb 12 16:01:00 2020
+++ src/sys/dev/usb/usbdi.h	Sun Feb 16 09:40:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.h,v 1.101 2020/02/12 16:01:00 riastradh Exp $	*/
+/*	$NetBSD: usbdi.h,v 1.102 2020/02/16 09:40:35 maxv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -193,17 +193,6 @@ void usbd_xfer_schedule_timeout(struct u
 bool usbd_xfer_trycomplete(struct usbd_xfer *);
 void usbd_xfer_abort(struct usbd_xfer *);
 
-/* An iterator for descriptors. */
-typedef struct {
-	const uByte *cur;
-	const uByte *end;
-} usbd_desc_iter_t;
-void usb_desc_iter_init(struct usbd_device *, usbd_desc_iter_t *);
-const usb_descriptor_t *usb_desc_iter_peek(usbd_desc_iter_t *);
-const usb_descriptor_t *usb_desc_iter_next(usbd_desc_iter_t *);
-const usb_interface_descriptor_t *usb_desc_iter_next_interface(usbd_desc_iter_t *);
-const usb_descriptor_t *usb_desc_iter_next_non_interface(usbd_desc_iter_t *);
-
 /* Used to clear endpoint stalls from the softint */
 void usbd_clear_endpoint_stall_task(void *);
 

Index: src/sys/dev/usb/usbdi_util.c
diff -u src/sys/dev/usb/usbdi_util.c:1.79 src/sys/dev/usb/usbdi_util.c:1.80
--- src/sys/dev/usb/usbdi_util.c:1.79	Mon Feb 10 09:15:27 2020
+++ src/sys/dev/usb/usbdi_util.c	Sun Feb 16 09:40:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.c,v 1.79 2020/02/10 09:15:27 skrll Exp $	*/
+/*	$NetBSD: usbdi_util.c,v 1.80 2020/02/16 09:40:35 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD