CVS commit: src/usr.sbin/pstat

2019-12-11 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Dec 12 05:00:33 UTC 2019

Modified Files:
src/usr.sbin/pstat: pstat.8

Log Message:
Comment out xref to tb(4), it does not exist.

XXX: I don't see it mentioned in amd64/GENERIC nor DEVNAMES


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/pstat/pstat.8

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

Modified files:

Index: src/usr.sbin/pstat/pstat.8
diff -u src/usr.sbin/pstat/pstat.8:1.43 src/usr.sbin/pstat/pstat.8:1.44
--- src/usr.sbin/pstat/pstat.8:1.43	Wed Dec 11 19:51:36 2019
+++ src/usr.sbin/pstat/pstat.8	Thu Dec 12 05:00:33 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pstat.8,v 1.43 2019/12/11 19:51:36 ad Exp $
+.\"	$NetBSD: pstat.8,v 1.44 2019/12/12 05:00:33 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -209,8 +209,9 @@ for
 TTYDISC (see
 .Xr termios 4 ) ,
 .Ql tab
-for TABLDISC (see
-.Xr tb 4 ) ,
+for TABLDISC ,
+.\" (see
+.\".Xr tb 4 ) ,
 .Ql slip
 for SLIPDISC (see
 .Xr sl 4 ) ,
@@ -277,7 +278,6 @@ VI_ONWORKLST vnode is on syncer work-lis
 .It M
 VV_MPSAFE file system is multithreaded
 .El
-.Pp
 .It USE
 The number of references to this vnode.
 .It HOLD



CVS commit: src/share/man/man9

2019-12-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec 12 02:34:55 UTC 2019

Modified Files:
src/share/man/man9: condvar.9

Log Message:
Point out that spurious wake-ups are possible, and that an LWP should
check for resource availability after being awoken.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/share/man/man9/condvar.9

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/man9/condvar.9
diff -u src/share/man/man9/condvar.9:1.20 src/share/man/man9/condvar.9:1.21
--- src/share/man/man9/condvar.9:1.20	Fri Apr 12 11:02:22 2019
+++ src/share/man/man9/condvar.9	Thu Dec 12 02:34:55 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: condvar.9,v 1.20 2019/04/12 11:02:22 abhinav Exp $
+.\"	$NetBSD: condvar.9,v 1.21 2019/12/12 02:34:55 pgoyette Exp $
 .\"
 .\" Copyright (c) 2006, 2007, 2008 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 November 12, 2017
+.Dd December 12, 2019
 .Dt CONDVAR 9
 .Os
 .Sh NAME
@@ -144,6 +144,13 @@ as available until the calling LWP has b
 .Pp
 Non-interruptable waits have the potential to deadlock the system, and so must
 be kept short (typically, under one second).
+.Pp
+Upon being awakened, the calling LWP should verify the availability
+of the resource (or other condition).
+It should not blindly assume that the resource is now available.
+If the resource is still not available, the calling LWP may call
+.Fn cv_wait
+again to continue waiting.
 .It Fn cv_wait_sig "cv" "mtx"
 .Pp
 As per



CVS commit: src/sys

2019-12-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec 12 02:15:43 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c netbsd32_machdep_16.c
src/sys/arch/mips/mips: netbsd32_machdep.c netbsd32_machdep_16.c
src/sys/arch/sparc64/sparc64: netbsd32_machdep.c netbsd32_machdep_16.c
src/sys/compat/common: bio_30.c ccd_60.c clockctl_50.c
compat_sysv_50_mod.c ieee80211_20.c if43_20.c if_43.c if_media_80.c
if_spppsubr50.c kern_mod_80.c kern_sig_16.c kern_uipc_socket_50.c
rndpseudo_50.c rtsock_14.c rtsock_50.c rtsock_70.c
sysmon_power_40.c tty_43.c tty_60.c uipc_syscalls_40.c
uipc_syscalls_50.c uipc_usrreq_70.c usb_subr_30.c vfs_syscalls_10.c
vnd_30.c vnd_50.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_compat_80.c
netbsd32_kern_proc.c
src/sys/compat/sunos: sunos_mod.c
src/sys/compat/sunos32: sunos32_mod.c
src/sys/dev/raidframe: rf_compat32.c rf_compat50.c rf_compat80.c
src/sys/dev/wscons: wsevent_50.c
src/sys/fs/puffs: puffs_compat.c
src/sys/kern: kern_core.c kern_module.c
src/sys/net: if_vlan.c
src/sys/opencrypto: ocryptodev.c
src/sys/sys: module_hook.h param.h

Log Message:
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/amd64/netbsd32_machdep_16.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/mips/netbsd32_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/mips/netbsd32_machdep_16.c
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/sparc64/sparc64/netbsd32_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/sparc64/netbsd32_machdep_16.c
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/bio_30.c \
src/sys/compat/common/clockctl_50.c src/sys/compat/common/if_spppsubr50.c \
src/sys/compat/common/kern_uipc_socket_50.c \
src/sys/compat/common/sysmon_power_40.c src/sys/compat/common/vnd_30.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/ccd_60.c
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/compat_sysv_50_mod.c \
src/sys/compat/common/if43_20.c src/sys/compat/common/kern_sig_16.c \
src/sys/compat/common/uipc_usrreq_70.c \
src/sys/compat/common/vfs_syscalls_10.c src/sys/compat/common/vnd_50.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/ieee80211_20.c \
src/sys/compat/common/kern_mod_80.c src/sys/compat/common/rndpseudo_50.c \
src/sys/compat/common/usb_subr_30.c
cvs rdiff -u -r1.23 -r1.24 src/sys/compat/common/if_43.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/if_media_80.c
cvs rdiff -u -r1.8 -r1.9 src/sys/compat/common/rtsock_14.c \
src/sys/compat/common/tty_60.c src/sys/compat/common/uipc_syscalls_50.c
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/rtsock_50.c
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/common/rtsock_70.c
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/common/tty_43.c
cvs rdiff -u -r1.20 -r1.21 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.41 -r1.42 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/netbsd32/netbsd32_compat_80.c
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/netbsd32/netbsd32_kern_proc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sunos/sunos_mod.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sunos32/sunos32_mod.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_compat32.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/raidframe/rf_compat50.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/raidframe/rf_compat80.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/wscons/wsevent_50.c
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/puffs/puffs_compat.c
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/kern_core.c
cvs rdiff -u -r1.138 -r1.139 src/sys/kern/kern_module.c
cvs rdiff -u -r1.148 -r1.149 src/sys/net/if_vlan.c
cvs rdiff -u -r1.13 -r1.14 src/sys/opencrypto/ocryptodev.c
cvs rdiff -u -r1.4 -r1.5 src/sys/sys/module_hook.h
cvs rdiff -u -r1.622 -r1.623 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/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.132 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.133
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.132	Wed Nov 27 09:16:58 2019
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Thu Dec 12 02:15:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.132 2019/11/27 09:16:58 rin Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.133 2019/12/12 02:15:42 pgoyette Exp $	*/
 
 /*
  * 

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

2019-12-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Dec 12 00:46:32 UTC 2019

Modified Files:
src/sys/arch/arm/dts: rk3328-rock64.dts rk3328.dtsi

Log Message:
Enable USB3 support on RK3328


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/rk3328-rock64.dts
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/rk3328.dtsi

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/dts/rk3328-rock64.dts
diff -u src/sys/arch/arm/dts/rk3328-rock64.dts:1.4 src/sys/arch/arm/dts/rk3328-rock64.dts:1.5
--- src/sys/arch/arm/dts/rk3328-rock64.dts:1.4	Thu May 23 20:50:29 2019
+++ src/sys/arch/arm/dts/rk3328-rock64.dts	Thu Dec 12 00:46:31 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328-rock64.dts,v 1.4 2019/05/23 20:50:29 jmcneill Exp $ */
+/* $NetBSD: rk3328-rock64.dts,v 1.5 2019/12/12 00:46:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,8 +31,4 @@
 
  {
 	status = "okay";
-	snps,phyif-utmi-bits = <16>;
-	snps,dis-enblslpm-quirk;
-	snps,dis-u2-freeclk-exists-quirk;
-	snps,dis_u2_susphy_quirk;
 };

Index: src/sys/arch/arm/dts/rk3328.dtsi
diff -u src/sys/arch/arm/dts/rk3328.dtsi:1.1 src/sys/arch/arm/dts/rk3328.dtsi:1.2
--- src/sys/arch/arm/dts/rk3328.dtsi:1.1	Thu Jun 21 10:46:39 2018
+++ src/sys/arch/arm/dts/rk3328.dtsi	Thu Dec 12 00:46:31 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328.dtsi,v 1.1 2018/06/21 10:46:39 jmcneill Exp $ */
+/* $NetBSD: rk3328.dtsi,v 1.2 2019/12/12 00:46:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -40,6 +40,14 @@
 			reg = <0x0 0xff60 0x0 0x10>;
 			interrupts = ;
 			dr_mode = "host";
+
+			phy_type = "utmi_wide";
+			snps,dis_enblslpm_quirk;
+			snps,dis-u2-freeclk-exists-quirk;
+			snps,dis_u2_susphy_quirk;
+			snps,dis_u3_susphy_quirk;
+			snps,dis-del-phy-power-chg-quirk;
+			snps,dis-tx-ipgap-linecheck-quirk;
 		};
 	};
 };



CVS commit: src/sys/dev/fdt

2019-12-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Dec 12 00:45:59 UTC 2019

Modified Files:
src/sys/dev/fdt: dwc3_fdt.c

Log Message:
Add support for snps,dis-tx-ipgap-linecheck-quirk quirk


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/dwc3_fdt.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/fdt/dwc3_fdt.c
diff -u src/sys/dev/fdt/dwc3_fdt.c:1.7 src/sys/dev/fdt/dwc3_fdt.c:1.8
--- src/sys/dev/fdt/dwc3_fdt.c:1.7	Fri Apr 19 19:05:56 2019
+++ src/sys/dev/fdt/dwc3_fdt.c	Thu Dec 12 00:45:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc3_fdt.c,v 1.7 2019/04/19 19:05:56 jmcneill Exp $ */
+/* $NetBSD: dwc3_fdt.c,v 1.8 2019/12/12 00:45:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.7 2019/04/19 19:05:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.8 2019/12/12 00:45:59 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,6 +52,9 @@ __KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v
 #define	  GCTL_PRTCAP_OTG		3
 #define	 GCTL_CORESOFTRESET		__BIT(11)
 
+#define	DWC3_GUCTL1			0xc11c
+#define	 GUCTL1_TX_IPGAP_LINECHECK_DIS	__BIT(28)
+
 #define	DWC3_SNPSID			0xc120
 #define	 DWC3_SNPSID_REV		__BITS(15,0)
 
@@ -120,7 +123,7 @@ dwc3_fdt_soft_reset(struct xhci_softc *s
 }
 
 static void
-dwc3_fdt_enable_phy(struct xhci_softc *sc, const int phandle)
+dwc3_fdt_enable_phy(struct xhci_softc *sc, const int phandle, u_int rev)
 {
 	const char *max_speed, *phy_type;
 	u_int phyif_utmi_bits;
@@ -162,6 +165,13 @@ dwc3_fdt_enable_phy(struct xhci_softc *s
 		val &= ~GUSB3PIPECTL_DEPOCHANGE;
 	WR4(sc, DWC3_GUSB3PIPECTL(0), val);
 
+	if (rev >= 0x250a) {
+		val = RD4(sc, DWC3_GUCTL1);
+		if (of_hasprop(phandle, "snps,dis-tx-ipgap-linecheck-quirk"))
+			val |= GUCTL1_TX_IPGAP_LINECHECK_DIS;
+		WR4(sc, DWC3_GUCTL1, val);
+	}
+
 	max_speed = fdtbus_get_string(phandle, "maximum-speed");
 	if (max_speed == NULL)
 		max_speed = "super-speed";
@@ -279,7 +289,7 @@ dwc3_fdt_attach(device_t parent, device_
 	}
 
 	dwc3_fdt_soft_reset(sc);
-	dwc3_fdt_enable_phy(sc, dwc3_phandle);
+	dwc3_fdt_enable_phy(sc, dwc3_phandle, rev);
 	dwc3_fdt_set_mode(sc, GCTL_PRTCAP_HOST);
 
 	if (!fdtbus_intr_str(dwc3_phandle, 0, intrstr, sizeof(intrstr))) {



CVS commit: src/share/man/man4/man4.macppc

2019-12-11 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Dec 11 21:05:17 UTC 2019

Modified Files:
src/share/man/man4/man4.macppc: platinumfb.4

Log Message:
Synchronize htdocs, manual, comments, and code so that enabling the platinumfb 
is done using "platinum" in openfirmware settings.  Remove "screen" option 
which was somewhat disingenuous.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/man4.macppc/platinumfb.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/man4.macppc/platinumfb.4
diff -u src/share/man/man4/man4.macppc/platinumfb.4:1.4 src/share/man/man4/man4.macppc/platinumfb.4:1.5
--- src/share/man/man4/man4.macppc/platinumfb.4:1.4	Thu Sep 15 15:25:11 2016
+++ src/share/man/man4/man4.macppc/platinumfb.4	Wed Dec 11 21:05:17 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: platinumfb.4,v 1.4 2016/09/15 15:25:11 wiz Exp $
+.\" $NetBSD: platinumfb.4,v 1.5 2019/12/11 21:05:17 scole Exp $
 .\"
 .\" Copyright (c) 2016 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 14, 2016
+.Dd December 11, 2019
 .Dt PLATINUMFB 4 macppc
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ couple early model PowerMacs such as the
 This driver should support console output (with rastor ops) and X
 (in unaccelerated modes).
 .Pp
-It may be required to set the output-device to 'screen' in Open Firmware.
+It may be required to set the output-device to 'platinum' in Open Firmware.
 .Sh SEE ALSO
 .Xr wsdisplay 4 ,
 .Xr rasops 9



CVS commit: src/sys/arch/macppc

2019-12-11 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Dec 11 21:04:47 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC_601 INSTALL_601
src/sys/arch/macppc/dev: platinumfb.c

Log Message:
Synchronize htdocs, manual, comments, and code so that enabling the platinumfb 
is done using "platinum" in openfirmware settings.  Remove "screen" option 
which was somewhat disingenuous.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/conf/GENERIC_601
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/conf/INSTALL_601
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/platinumfb.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/macppc/conf/GENERIC_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.24 src/sys/arch/macppc/conf/GENERIC_601:1.25
--- src/sys/arch/macppc/conf/GENERIC_601:1.24	Fri Apr 26 22:46:03 2019
+++ src/sys/arch/macppc/conf/GENERIC_601	Wed Dec 11 21:04:47 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_601,v 1.24 2019/04/26 22:46:03 sevan Exp $
+# $NetBSD: GENERIC_601,v 1.25 2019/12/11 21:04:47 scole Exp $
 #
 # GENERIC machine description file
 # 
@@ -28,7 +28,7 @@ include 	"arch/macppc/conf/std.macppc.60
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident 		"GENERIC-$Revision: 1.24 $"
+ident 		"GENERIC-$Revision: 1.25 $"
 
 maxusers	32
 
@@ -217,8 +217,8 @@ ahc*	at pci? dev ? function ?	# Adaptec 
 # official Macintosh firmware from 3Dfx. The others should work but are
 # untested with OF 1.0.5
 
-# this will take over the console if output-device is set to 'screen' or
-# 'platinum'. It will provide a NetBSD console, but still won't work with OF
+# this will take over the console if output-device is set to 'platinum'.
+# It will provide a NetBSD console, but still won't work with OF
 platinumfb0 	at mainbus?
 
 #gffb*		at pci?	function ?	# NVIDIA GeForce2 MX

Index: src/sys/arch/macppc/conf/INSTALL_601
diff -u src/sys/arch/macppc/conf/INSTALL_601:1.3 src/sys/arch/macppc/conf/INSTALL_601:1.4
--- src/sys/arch/macppc/conf/INSTALL_601:1.3	Sun Dec  8 21:30:00 2019
+++ src/sys/arch/macppc/conf/INSTALL_601	Wed Dec 11 21:04:47 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_601,v 1.3 2019/12/08 21:30:00 scole Exp $
+#	$NetBSD: INSTALL_601,v 1.4 2019/12/11 21:04:47 scole Exp $
 #
 # config file for INSTALL
 #
@@ -82,8 +82,8 @@ ahc*	at pci? dev ? function ?	# Adaptec 
 # The only cards known to work ( so far ) are PCI Voodoo3s flashed with the
 # official Macintosh firmware from 3Dfx. The others should work but are
 # untested with OF 1.0.5
-# this will take over the console if output-device is set to 'screen' or
-# 'platinum'. It will provide a NetBSD console, but still won't work with OF
+# this will take over the console if output-device is set to 'platinum'.
+# It will provide a NetBSD console, but still won't work with OF
 platinumfb0 	at mainbus?
 
 #gffb*		at pci?	function ?	# NVIDIA GeForce2 MX

Index: src/sys/arch/macppc/dev/platinumfb.c
diff -u src/sys/arch/macppc/dev/platinumfb.c:1.3 src/sys/arch/macppc/dev/platinumfb.c:1.4
--- src/sys/arch/macppc/dev/platinumfb.c:1.3	Fri Sep 16 17:32:36 2016
+++ src/sys/arch/macppc/dev/platinumfb.c	Wed Dec 11 21:04:47 2019
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: platinumfb.c,v 1.3 2016/09/16 17:32:36 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: platinumfb.c,v 1.4 2019/12/11 21:04:47 scole Exp $");
 
 #include 
 #include 
@@ -569,8 +569,8 @@ platinumfb_init(device_t self)
 	int i;
 
 	/*
-	 * become console if OF variable "output-device" is "screen" or
-	 * contains "platinum", since normal OF video variables are unavailable
+	 * become console if OF variable "output-device" contains "platinum",
+	 * since normal OF video variables are unavailable
 	 */
 	int options;
 	char output_device[128];
@@ -582,8 +582,7 @@ platinumfb_init(device_t self)
 		aprint_error_dev(sc->sc_dev,
 		"could not get output-device prop, assuming not console\n");
 	} else {
-		if (strstr(output_device,"platinum") ||
-		strcmp(output_device,"screen") == 0 ) {
+		if (strstr(output_device,"platinum")) {
 			is_console = TRUE;
 		}
 	}	



CVS commit: src/sys/dev/i2c

2019-12-11 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Dec 11 21:00:11 UTC 2019

Modified Files:
src/sys/dev/i2c: adm1026.c adm1026reg.h

Log Message:
Chip matching improvements:
  only match for currently known addresses
  don't generate messages when matching
Tested on Sun Blade 2500 by martin@.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/adm1026.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/adm1026reg.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/adm1026.c
diff -u src/sys/dev/i2c/adm1026.c:1.5 src/sys/dev/i2c/adm1026.c:1.6
--- src/sys/dev/i2c/adm1026.c:1.5	Tue Jun 26 06:03:57 2018
+++ src/sys/dev/i2c/adm1026.c	Wed Dec 11 21:00:11 2019
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm1026.c,v 1.5 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1026.c,v 1.6 2019/12/11 21:00:11 jdc Exp $");
 
 #include 
 #include 
@@ -99,11 +99,11 @@ struct adm1026_softc {
 };
 
 static int adm1026_match(device_t, cfdata_t, void *);
-static int adm1026_ident(struct adm1026_softc *sc);
+static int adm1026_ident(struct adm1026_softc *, int);
 static void adm1026_attach(device_t, device_t, void *);
 static int adm1026_detach(device_t, int);
-bool adm1026_pmf_suspend(device_t dev, const pmf_qual_t *qual);
-bool adm1026_pmf_resume(device_t dev, const pmf_qual_t *qual);
+bool adm1026_pmf_suspend(device_t, const pmf_qual_t *);
+bool adm1026_pmf_resume(device_t, const pmf_qual_t *);
 
 static void adm1026_setup_fans(struct adm1026_softc *sc, int div2_val);
 static void adm1026_setup_temps(struct adm1026_softc *sc);
@@ -141,15 +141,14 @@ adm1026_match(device_t parent, cfdata_t 
 	if (iic_use_direct_match(ia, cf, compat_data, _result))
 		return match_result;
 
-	if ((ia->ia_addr & ADM1026_ADDRMASK) == ADM1026_ADDR &&
-	adm1026_ident())
+	if (ia->ia_addr == ADM1026_ADDR1 && adm1026_ident(, 1))
 		return I2C_MATCH_ADDRESS_AND_PROBE;
 
 	return 0;
 }
 
 static int
-adm1026_ident(struct adm1026_softc *sc)
+adm1026_ident(struct adm1026_softc *sc, int probe_only)
 {
 	uint8_t val;
 	int err;
@@ -157,14 +156,16 @@ adm1026_ident(struct adm1026_softc *sc)
 	/* Manufacturer ID and revision/stepping */
 	err = adm1026_read_reg(sc, ADM1026_ID, );
 	if (err || val != ADM1026_MANF_ID) {
-		aprint_verbose("adm1026_ident: "
-		"manufacturer ID invalid or missing\n");
+		if (!probe_only)
+			aprint_verbose("adm1026_ident: "
+			"manufacturer ID invalid or missing\n");
 		return 0;
 	}
 	err = adm1026_read_reg(sc, ADM1026_REV, >sc_rev);
 	if (err || ADM1026_REVISION(sc->sc_rev) != ADM1026_MANF_REV) {
-		aprint_verbose("adm1026_ident: "
-		"manufacturer revision invalid or missing\n");
+		if (!probe_only)
+			aprint_verbose("adm1026_ident: "
+			"manufacturer revision invalid or missing\n");
 		return 0;
 	}
 	return 1;
@@ -191,7 +192,7 @@ adm1026_attach(device_t parent, device_t
 	else
 		div2_val = -1;
 
-	(void) adm1026_ident(sc);
+	(void) adm1026_ident(sc, 0);
 	aprint_normal(": ADM1026 hardware monitor: rev. 0x%x, step. 0x%x\n",
 	ADM1026_REVISION(sc->sc_rev), ADM1026_STEPPING(sc->sc_rev));
 

Index: src/sys/dev/i2c/adm1026reg.h
diff -u src/sys/dev/i2c/adm1026reg.h:1.2 src/sys/dev/i2c/adm1026reg.h:1.3
--- src/sys/dev/i2c/adm1026reg.h:1.2	Sun Oct 13 07:44:51 2019
+++ src/sys/dev/i2c/adm1026reg.h	Wed Dec 11 21:00:11 2019
@@ -37,10 +37,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm1026reg.h,v 1.2 2019/10/13 07:44:51 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1026reg.h,v 1.3 2019/12/11 21:00:11 jdc Exp $");
 
-#define	ADM1026_ADDRMASK	0x2f	/* 010 11xx */
-#define ADM1026_ADDR		0x2c
+#define ADM1026_ADDR1		0x2c
 
 #define ADM1026_CONF1		0x00
 #define ADM1026_CONF2		0x01



CVS commit: src/sys/kern

2019-12-11 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Dec 11 20:50:32 UTC 2019

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

Log Message:
Add a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.282 -r1.283 src/sys/kern/vfs_bio.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_bio.c
diff -u src/sys/kern/vfs_bio.c:1.282 src/sys/kern/vfs_bio.c:1.283
--- src/sys/kern/vfs_bio.c:1.282	Sun Dec  8 20:35:23 2019
+++ src/sys/kern/vfs_bio.c	Wed Dec 11 20:50:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.282 2019/12/08 20:35:23 ad Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.283 2019/12/11 20:50:32 ad Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.282 2019/12/08 20:35:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.283 2019/12/11 20:50:32 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1145,6 +1145,16 @@ already_queued:
 	/* Unlock the buffer. */
 	CLR(bp->b_cflags, BC_AGE|BC_BUSY|BC_NOCACHE);
 	CLR(bp->b_flags, B_ASYNC);
+
+	/*
+	 * Wake only the highest priority waiter on the lock, in order to
+	 * prevent a thundering herd: many LWPs simultaneously awakening and
+	 * competing for the buffer's lock.  Testing in 2019 revealed this
+	 * to reduce contention on bufcache_lock tenfold during a kernel
+	 * compile.  Elsewhere, when the buffer is changing identity, being
+	 * disposed of, or moving from one list to another, we wake all lock
+	 * requestors.
+	 */
 	cv_signal(>b_busy);
 
 	if (bp->b_bufsize <= 0)



CVS commit: src/sys/kern

2019-12-11 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Dec 11 20:46:06 UTC 2019

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

Log Message:
Comment on previous explaining why it's needed.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/kern/kern_mutex.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_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.85 src/sys/kern/kern_mutex.c:1.86
--- src/sys/kern/kern_mutex.c:1.85	Wed Dec 11 20:34:06 2019
+++ src/sys/kern/kern_mutex.c	Wed Dec 11 20:46:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.85 2019/12/11 20:34:06 ad Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.86 2019/12/11 20:46:06 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.85 2019/12/11 20:34:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.86 2019/12/11 20:46:06 ad Exp $");
 
 #include 
 #include 
@@ -720,6 +720,11 @@ mutex_vector_exit(kmutex_t *mtx)
 	}
 
 #ifndef __HAVE_MUTEX_STUBS
+	/*
+	 * On some architectures without mutex stubs, we can enter here to
+	 * release mutexes before interrupts and whatnot are up and running. 
+	 * We need this hack to keep them sweet.
+	 */
 	if (__predict_false(cold)) {
 		MUTEX_UNLOCKED(mtx);
 		MUTEX_RELEASE(mtx);



CVS commit: src/sys/kern

2019-12-11 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Dec 11 20:34:06 UTC 2019

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

Log Message:
mutex_vector_exit: if the arch doesn't have assembly stubs, we need to
unconditionally release the lock if(cold), so mutexes can be used before
interrupts are set up.  Removed with panicstr checks in 1.81.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/kern/kern_mutex.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_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.84 src/sys/kern/kern_mutex.c:1.85
--- src/sys/kern/kern_mutex.c:1.84	Tue Dec 10 13:36:44 2019
+++ src/sys/kern/kern_mutex.c	Wed Dec 11 20:34:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.84 2019/12/10 13:36:44 kre Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.85 2019/12/11 20:34:06 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.84 2019/12/10 13:36:44 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.85 2019/12/11 20:34:06 ad Exp $");
 
 #include 
 #include 
@@ -719,6 +719,14 @@ mutex_vector_exit(kmutex_t *mtx)
 		return;
 	}
 
+#ifndef __HAVE_MUTEX_STUBS
+	if (__predict_false(cold)) {
+		MUTEX_UNLOCKED(mtx);
+		MUTEX_RELEASE(mtx);
+		return;
+	}
+#endif
+
 	curthread = (uintptr_t)curlwp;
 	MUTEX_DASSERT(mtx, curthread != 0);
 	MUTEX_ASSERT(mtx, MUTEX_OWNER(mtx->mtx_owner) == curthread);



CVS commit: src/lib/libkvm

2019-12-11 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Dec 11 20:19:27 UTC 2019

Modified Files:
src/lib/libkvm: kvm_proc.c

Log Message:
Redo previous more conventionally.  Requested by kre@.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/lib/libkvm/kvm_proc.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/libkvm/kvm_proc.c
diff -u src/lib/libkvm/kvm_proc.c:1.93 src/lib/libkvm/kvm_proc.c:1.94
--- src/lib/libkvm/kvm_proc.c:1.93	Tue Dec 10 18:13:07 2019
+++ src/lib/libkvm/kvm_proc.c	Wed Dec 11 20:19:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_proc.c,v 1.93 2019/12/10 18:13:07 ad Exp $	*/
+/*	$NetBSD: kvm_proc.c,v 1.94 2019/12/11 20:19:27 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_proc.c	8.3 (Berkeley) 9/23/93";
 #else
-__RCSID("$NetBSD: kvm_proc.c,v 1.93 2019/12/10 18:13:07 ad Exp $");
+__RCSID("$NetBSD: kvm_proc.c,v 1.94 2019/12/11 20:19:27 ad Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -260,7 +260,7 @@ _kvm_ureadm(kvm_t *kd, const struct mini
 			return (NULL);
 
 		if (_kvm_pread(kd, kd->pmfd, kd->swapspc, (size_t)kd->nbpg,
-		(off_t)pg.phys_addr & -kd->nbpg) != kd->nbpg)
+		(off_t)pg.phys_addr & ~(kd->nbpg - 1)) != kd->nbpg)
 			return (NULL);
 	} else {
 		if (kd->swfd < 0 ||



CVS commit: src/usr.sbin/pstat

2019-12-11 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Dec 11 19:51:36 UTC 2019

Modified Files:
src/usr.sbin/pstat: pstat.8 pstat.c

Log Message:
Report on whether vnodes are MPSAFE.  For diagnosing perf problems.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/pstat/pstat.8
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/pstat/pstat.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.sbin/pstat/pstat.8
diff -u src/usr.sbin/pstat/pstat.8:1.42 src/usr.sbin/pstat/pstat.8:1.43
--- src/usr.sbin/pstat/pstat.8:1.42	Mon Jul  3 21:35:31 2017
+++ src/usr.sbin/pstat/pstat.8	Wed Dec 11 19:51:36 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pstat.8,v 1.42 2017/07/03 21:35:31 wiz Exp $
+.\"	$NetBSD: pstat.8,v 1.43 2019/12/11 19:51:36 ad Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" from: @(#)pstat.8	8.5 (Berkeley) 5/13/94
 .\"
-.Dd March 24, 2014
+.Dd December 11, 2019
 .Dt PSTAT 8
 .Os
 .Sh NAME
@@ -261,19 +261,21 @@ A list of letters representing vnode fla
 .Pp
 .Bl -tag -width indent -compact
 .It R
-VROOT root of its file system.
+VV_ROOT root of its file system.
 .It T
-VTEXT pure text prototype.
+VI_TEXT pure text prototype.
 .It S
-VSYSTEM vnode being used by kernel.
+VV_SYSTEM vnode being used by kernel.
 .It I
-VISTTY vnode is a tty.
+VV_ISTTY vnode is a tty.
 .It E
-VEXECMAP vnode has PROT_EXEC mappings.
+VI_EXECMAP vnode has PROT_EXEC mappings.
 .It D
-VDIROP lfs vnode involved in directory op.
+VU_DIROP lfs vnode involved in directory op.
 .It O
-VONWORKLST vnode is on syncer work-list.
+VI_ONWORKLST vnode is on syncer work-list.
+.It M
+VV_MPSAFE file system is multithreaded
 .El
 .Pp
 .It USE

Index: src/usr.sbin/pstat/pstat.c
diff -u src/usr.sbin/pstat/pstat.c:1.129 src/usr.sbin/pstat/pstat.c:1.130
--- src/usr.sbin/pstat/pstat.c:1.129	Sun Dec  1 14:04:52 2019
+++ src/usr.sbin/pstat/pstat.c	Wed Dec 11 19:51:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $	*/
+/*	$NetBSD: pstat.c,v 1.130 2019/12/11 19:51:36 ad Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)pstat.c	8.16 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.130 2019/12/11 19:51:36 ad Exp $");
 #endif
 #endif /* not lint */
 
@@ -390,6 +390,7 @@ const struct flagbit_desc vnode_flags[] 
 	{ VI_EXECMAP,	'E' },
 	{ VU_DIROP,	'D' },
 	{ VI_ONWORKLST,	'O' },
+	{ VV_MPSAFE,'M' },
 	{ 0,		'\0' },
 };
 



CVS commit: src/usr.sbin/sysinst/arch/amiga

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 19:25:50 UTC 2019

Modified Files:
src/usr.sbin/sysinst/arch/amiga: md.h

Log Message:
For now rely on the kernel mapping native RDB partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/arch/amiga/md.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.sbin/sysinst/arch/amiga/md.h
diff -u src/usr.sbin/sysinst/arch/amiga/md.h:1.4 src/usr.sbin/sysinst/arch/amiga/md.h:1.5
--- src/usr.sbin/sysinst/arch/amiga/md.h:1.4	Wed Oct  2 11:16:01 2019
+++ src/usr.sbin/sysinst/arch/amiga/md.h	Wed Dec 11 19:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.h,v 1.4 2019/10/02 11:16:01 maya Exp $	*/
+/*	$NetBSD: md.h,v 1.5 2019/12/11 19:25:50 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -71,6 +71,13 @@
 
 
 /*
+ * We rely on kernel support to translate native RDB partitions
+ * to in-core disklabels, so we can not check for existance of "real"
+ * disklabels on-disk before offering disklabel partitions.
+ */
+#define	DISKLABEL_NO_ONDISK_VERIFY	1
+
+/*
  *  prototypes for MD code.
  */
 



CVS commit: src/usr.sbin/sysinst

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 19:23:38 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disks.c label.c msg.mi.de msg.mi.en msg.mi.es
msg.mi.fr msg.mi.pl
src/usr.sbin/sysinst/arch/cobalt: md.h

Log Message:
PR 54065: add optional "old compat" variant of ext2fs in file system
type selection and use that as default for the cobalt boot file system.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/arch/cobalt/md.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.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.57 src/usr.sbin/sysinst/disks.c:1.58
--- src/usr.sbin/sysinst/disks.c:1.57	Sat Nov 16 20:26:59 2019
+++ src/usr.sbin/sysinst/disks.c	Wed Dec 11 19:23:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.57 2019/11/16 20:26:59 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.58 2019/12/11 19:23:37 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -113,6 +113,8 @@ getfslabelname(uint f, uint f_version)
 	else if (f == FS_BSDFFS && f_version > 0)
 		return f_version == 2 ?
 		msg_string(MSG_fs_type_ffsv2) : msg_string(MSG_fs_type_ffs);
+	else if (f == FS_EX2FS && f_version == 1)
+		return msg_string(MSG_fs_type_ext2old);
 	else if (f >= __arraycount(fstypenames) || fstypenames[f] == NULL)
 		return "invalid";
 	return fstypenames[f];
@@ -1177,7 +1179,10 @@ make_filesystems(struct install_partitio
 			fsname = "v7fs";
 			break;
 		case FS_EX2FS:
-			asprintf(, "/sbin/newfs_ext2fs");
+			asprintf(,
+			ptn->fs_version == 1 ?
+"/sbin/newfs_ext2fs -O 0" :
+"/sbin/newfs_ext2fs");
 			mnt_opts = "-text2fs";
 			fsname = "ext2fs";
 			break;

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.14 src/usr.sbin/sysinst/label.c:1.15
--- src/usr.sbin/sysinst/label.c:1.14	Wed Nov 13 18:57:26 2019
+++ src/usr.sbin/sysinst/label.c	Wed Dec 11 19:23:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.14 2019/11/13 18:57:26 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.15 2019/12/11 19:23:37 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.14 2019/11/13 18:57:26 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.15 2019/12/11 19:23:37 martin Exp $");
 #endif
 
 #include 
@@ -461,6 +461,9 @@ init_fs_type_ext(menudesc *menu, void *a
 		else
 			menu->cursel = 1;
 		return;
+	} else if (t == FS_EX2FS && edit->info.fs_sub_type == 1) {
+		menu->cursel = FSMAXTYPES;
+		return;
 	}
 	/* skip the two FFS entries, and do not add FFS later again */
 	for (ndx = 2, i = 0; i < FSMAXTYPES && ndx < max; i++) {
@@ -488,13 +491,11 @@ set_fstype_ext(menudesc *menu, void *arg
 	if (menu->cursel == 0 || menu->cursel == 1) {
 		edit->info.fs_type = FS_BSDFFS;
 		edit->info.fs_sub_type = menu->cursel == 0 ? 2 : 1;
-		edit->info.nat_type = edit->pset->parts->pscheme->
-		get_fs_part_type(edit->info.fs_type,
-		edit->info.fs_sub_type);
-		edit->wanted->type = edit->info.nat_type->generic_ptype;
-		edit->wanted->fs_type = edit->info.fs_type;
-		edit->wanted->fs_version = edit->info.fs_sub_type;
-		return 1;
+		goto found_type;
+	} else if (menu->cursel == FSMAXTYPES) {
+		edit->info.fs_type = FS_EX2FS;
+		edit->info.fs_sub_type = 1;
+		goto found_type;
 	}
 
 	for (ndx = 2, i = 0; i < FSMAXTYPES && ndx < max; i++) {
@@ -508,19 +509,22 @@ set_fstype_ext(menudesc *menu, void *arg
 		if (ndx == (size_t)menu->cursel) {
 			edit->info.fs_type = i;
 			edit->info.fs_sub_type = 0;
-			edit->info.nat_type = edit->pset->parts->pscheme->
-			get_fs_part_type(i, 0);
-			if (edit->info.nat_type == NULL)
-edit->info.nat_type = edit->pset->parts->
-pscheme->get_generic_part_type(PT_root);
-			edit->wanted->type = edit->info.nat_type->generic_ptype;
-			edit->wanted->fs_type = edit->info.fs_type;
-			edit->wanted->fs_version = edit->info.fs_sub_type;
-			break;
+			goto found_type;
 		}
 		ndx++;
 	}
 	return 1;
+
+found_type:
+	edit->info.nat_type = edit->pset->parts->pscheme->
+	get_fs_part_type(edit->info.fs_type, edit->info.fs_sub_type);
+	if (edit->info.nat_type == NULL)
+		edit->info.nat_type = edit->pset->parts->pscheme->
+		get_generic_part_type(PT_root);
+	edit->wanted->type = edit->info.nat_type->generic_ptype;
+	edit->wanted->fs_type = edit->info.fs_type;
+	edit->wanted->fs_version = edit->info.fs_sub_type;
+	return 1;
 }
 
 /*
@@ -534,7 +538,7 @@ 

CVS commit: src/sys/arch/emips/emips

2019-12-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Dec 11 16:16:13 UTC 2019

Modified Files:
src/sys/arch/emips/emips: interrupt.c

Log Message:
Fix a longstanding "freeze right after enabling interrupt" problem.

With this fix, finally NetBSD/emips on Giano is fully functional.
See PR/45080 for more details.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/emips/emips/interrupt.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/emips/emips/interrupt.c
diff -u src/sys/arch/emips/emips/interrupt.c:1.7 src/sys/arch/emips/emips/interrupt.c:1.8
--- src/sys/arch/emips/emips/interrupt.c:1.7	Mon Dec  9 16:19:11 2019
+++ src/sys/arch/emips/emips/interrupt.c	Wed Dec 11 16:16:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.7 2019/12/09 16:19:11 tsutsui Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.8 2019/12/11 16:16:13 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.7 2019/12/09 16:19:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.8 2019/12/11 16:16:13 tsutsui Exp $");
 
 #include 
 #include 
@@ -102,6 +102,19 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 
 	curcpu()->ci_data.cpu_nintr++;
 
+#if 0
+	/*
+	 * According to Giano simulator sources (Cpus/mips_cpu.cpp),
+	 * interrupt register bits in CAUSE register are updated
+	 * only when the exception is triggered. This means checking
+	 * CAUSE register via splintr() in a while loop in this
+	 * interrupt handler doesn't work as expected on Giano.
+	 *
+	 * I don't know whether the real FPGA eMIPS has the same
+	 * design as the Giano simulator, but for now I'd like to
+	 * choose 'call only one handler per each interrupt' strategy,
+	 * as the original NetBSD/emips implementation.
+	 */
 	while (ppl < (ipl = splintr())) {
 		splx(ipl);
 		/* device interrupts */
@@ -110,6 +123,14 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 		}
 		(void)splhigh();
 	}
+#else
+	ipl = splintr();
+	__USE(ipl);
+	/* device interrupts */
+	if (ipending & MIPS_INT_MASK_5) {
+		(*platform.iointr)(status, pc, ipending);
+	}
+#endif
 }
 
 /*



CVS commit: src/usr.sbin/sysinst

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 15:08:45 UTC 2019

Modified Files:
src/usr.sbin/sysinst: defs.h main.c
src/usr.sbin/sysinst/arch/evbarm: md.c menus.md.en menus.md.es
menus.md.fr menus.md.pl

Log Message:
Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/sysinst/main.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/evbarm/md.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/arch/evbarm/menus.md.en \
src/usr.sbin/sysinst/arch/evbarm/menus.md.es \
src/usr.sbin/sysinst/arch/evbarm/menus.md.fr \
src/usr.sbin/sysinst/arch/evbarm/menus.md.pl

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

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.48 src/usr.sbin/sysinst/defs.h:1.49
--- src/usr.sbin/sysinst/defs.h:1.48	Thu Nov 14 13:58:22 2019
+++ src/usr.sbin/sysinst/defs.h	Wed Dec 11 15:08:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.48 2019/11/14 13:58:22 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.49 2019/12/11 15:08:45 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -583,7 +583,6 @@ void remove_gpt_options(void);
 
 /* Machine dependent functions  */
 void	md_init(void);
-void	md_prelim_menu(void);
 void	md_init_set_status(int); /* SFLAG_foo */
 
  /* MD functions if user selects install - in order called */

Index: src/usr.sbin/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.18 src/usr.sbin/sysinst/main.c:1.19
--- src/usr.sbin/sysinst/main.c:1.18	Tue Nov 12 16:33:14 2019
+++ src/usr.sbin/sysinst/main.c	Wed Dec 11 15:08:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.18 2019/11/12 16:33:14 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.19 2019/12/11 15:08:45 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -164,9 +164,6 @@ init_lang(void)
 	multname = msg_string(MSG_secname);
 }
 
-__weakref_visible void prelim_menu(void)
-__weak_reference(md_prelim_menu);
-
 int
 main(int argc, char **argv)
 {
@@ -264,12 +261,6 @@ main(int argc, char **argv)
 	get_kb_encoding();
 	init_lang();
 
-#ifdef __weak_reference
-	/* if md wants to ask anything before we start, do it now */
-	if (prelim_menu != 0)
-		prelim_menu();
-#endif
-
 	/* Menu processing */
 	if (partman_go)
 		partman();

Index: src/usr.sbin/sysinst/arch/evbarm/md.c
diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.9 src/usr.sbin/sysinst/arch/evbarm/md.c:1.10
--- src/usr.sbin/sysinst/arch/evbarm/md.c:1.9	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/evbarm/md.c	Wed Dec 11 15:08:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.9 2019/08/14 12:55:36 martin Exp $ */
+/*	$NetBSD: md.c,v 1.10 2019/12/11 15:08:45 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -48,18 +48,20 @@
 #include "msg_defs.h"
 #include "menu_defs.h"
 
-int boardtype = 0;
-
-void
-md_prelim_menu(void)
-{
-	/* get the boardtype from the user */
-	process_menu(MENU_prelim, NULL);
-}
+int boardtype = BOARD_TYPE_NORMAL;
 
 void
 md_init(void)
 {
+	int rv;
+
+	rv =run_program(RUN_SILENT|RUN_ERROR_OK, "sh -c 'ofctl -p / model | "
+	"fgrep \"Raspberry Pi\"'");
+	if (rv != 0)
+		return;
+
+	/* this is some kind of Raspberry Pi */
+	boardtype = BOARD_TYPE_RPI;
 }
 
 void

Index: src/usr.sbin/sysinst/arch/evbarm/menus.md.en
diff -u src/usr.sbin/sysinst/arch/evbarm/menus.md.en:1.1 src/usr.sbin/sysinst/arch/evbarm/menus.md.en:1.2
--- src/usr.sbin/sysinst/arch/evbarm/menus.md.en:1.1	Sat Jul 26 19:30:45 2014
+++ src/usr.sbin/sysinst/arch/evbarm/menus.md.en	Wed Dec 11 15:08:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: menus.md.en,v 1.1 2014/07/26 19:30:45 dholland Exp $	*/
+/*	$NetBSD: menus.md.en,v 1.2 2019/12/11 15:08:45 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -35,7 +35,3 @@
 
 /* evbarm machine dependent menus, english */
 
-menu prelim, title "What kind of system do you have?", y=-10;
-	option "Raspberry PI", exit, action { boardtype = 1; };
-	option "Other", exit, action { boardtype = 0; };
-
Index: src/usr.sbin/sysinst/arch/evbarm/menus.md.es
diff -u src/usr.sbin/sysinst/arch/evbarm/menus.md.es:1.1 src/usr.sbin/sysinst/arch/evbarm/menus.md.es:1.2
--- src/usr.sbin/sysinst/arch/evbarm/menus.md.es:1.1	Sat Jul 26 19:30:45 2014
+++ src/usr.sbin/sysinst/arch/evbarm/menus.md.es	Wed Dec 11 15:08:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: menus.md.es,v 1.1 2014/07/26 19:30:45 dholland Exp $	*/
+/*	$NetBSD: menus.md.es,v 1.2 2019/12/11 15:08:45 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -35,7 +35,3 @@
 
 /* evbarm machine dependent menus, spanish */
 
-menu prelim, title "What kind of system do you have?", y=-10;
-	option "Raspberry PI", exit, action { boardtype = 1; };
-	option 

CVS commit: [netbsd-9] src/doc

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:58:03 UTC 2019

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

Log Message:
Tickets #539 - #544


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.133 -r1.1.2.134 src/doc/CHANGES-9.0

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.0
diff -u src/doc/CHANGES-9.0:1.1.2.133 src/doc/CHANGES-9.0:1.1.2.134
--- src/doc/CHANGES-9.0:1.1.2.133	Mon Dec  9 19:33:56 2019
+++ src/doc/CHANGES-9.0	Wed Dec 11 14:58:03 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.133 2019/12/09 19:33:56 bouyer Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.134 2019/12/11 14:58:03 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -6934,3 +6934,36 @@ usr.sbin/sysinst/bsddisklabel.c			1.32
 	relative offsets.
 	[martin, ticket #538]
 
+etc/rc.d/zfs	1.4,1.5
+
+	Fix unload, remove all mount/unmount actions (let mountall
+	or the operator deal with those).
+	[sevan, ticket #539]
+
+external/cddl/osnet/dist/uts/common/fs/zfs/arc.c 1.16
+
+	Avoid a warning not applicable for NetBSD.
+	[sevan, ticket #540]
+
+sys/dev/pci/if_wm.c1.651
+
+	Fix a bug that wm_sgmii_readreg_locked() may return an error even
+	if no error occurred.
+	[msaitoh, ticket #541]
+
+bin/sh/eval.c	1.176
+bin/sh/trap.c	1.53
+
+	PR bin/54743: avoid unnecessary fork and trap handling.
+	[kre, ticket #542]
+
+sys/dev/mii/files.mii1.54
+
+	Make kernels with ipgphy(4) but wihtout ukphy(4) buildable.
+	[msaitoh, ticket #543]
+
+sys/dev/usb/ugen.c1.148
+
+	Avoid NULL pointer dereference.
+	[bouyer, ticket #544]
+



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

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:56:36 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #544):

sys/dev/usb/ugen.c: revision 1.148

reading usbdi.c it looks like usbd_get_config_descriptor() can actually
return NULL, so check for this.

I got NULL pointer dereference here with a device showing:
[   303.732632] ugen0: autoconfiguration error: setting configuration index 0 
failed


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

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.146 src/sys/dev/usb/ugen.c:1.146.2.1
--- src/sys/dev/usb/ugen.c:1.146	Sun May  5 03:17:54 2019
+++ src/sys/dev/usb/ugen.c	Wed Dec 11 14:56:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.146 2019/05/05 03:17:54 mrg Exp $	*/
+/*	$NetBSD: ugen.c,v 1.146.2.1 2019/12/11 14:56:36 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.146 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.146.2.1 2019/12/11 14:56:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1406,6 +1406,8 @@ ugen_get_cdesc(struct ugen_softc *sc, in
 
 	if (index == USB_CURRENT_CONFIG_INDEX) {
 		tdesc = usbd_get_config_descriptor(sc->sc_udev);
+		if (tdesc == NULL)
+			return NULL;
 		len = UGETW(tdesc->wTotalLength);
 		if (lenp)
 			*lenp = len;



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

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:54:47 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: files.mii

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #543):

sys/dev/mii/files.mii: revision 1.54

 Add ukphy_subr flag to ipgphy to make kernel compilable with ipgphy and
without ukphy. Pointed out by Hauke.


To generate a diff of this commit:
cvs rdiff -u -r1.50.26.2 -r1.50.26.3 src/sys/dev/mii/files.mii

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/mii/files.mii
diff -u src/sys/dev/mii/files.mii:1.50.26.2 src/sys/dev/mii/files.mii:1.50.26.3
--- src/sys/dev/mii/files.mii:1.50.26.2	Mon Nov 25 16:53:55 2019
+++ src/sys/dev/mii/files.mii	Wed Dec 11 14:54:47 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mii,v 1.50.26.2 2019/11/25 16:53:55 martin Exp $
+#	$NetBSD: files.mii,v 1.50.26.3 2019/12/11 14:54:47 martin Exp $
 
 defflag	opt_mii.h	MIIVERBOSE
 
@@ -99,7 +99,7 @@ device	ikphy: mii_phy
 attach	ikphy at mii
 file	dev/mii/ikphy.cikphy
 
-device	ipgphy: mii_phy
+device	ipgphy: mii_phy, ukphy_subr
 attach	ipgphy at mii
 file	dev/mii/ipgphy.c			ipgphy
 



CVS commit: [netbsd-9] src/bin/sh

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:52:50 UTC 2019

Modified Files:
src/bin/sh [netbsd-9]: eval.c trap.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #542):

bin/sh/eval.c: revision 1.176
bin/sh/trap.c: revision 1.53

PR bin/54743

Having traps set should not enforce a fork for the next command,
whatever that command happens to be, only for commands which would
normally fork if they weren't the last command expected to be
executed (ie: builtins and functions shouldn't be exexuted in a
sub-shell merely because a trap is set).

As it was (for example)
trap 'whatever' SIGANY; wait $anypid
was guaranteed to fail the wait, as the subshell it was executed
in could not have any children.

XXX pullup -9

PR bin/54743

If a builtin command or function is the final command intended to be
executed, and is interrupted by a caught signal, the trap handler for
that signal was not executed - the shell simply exited (an exit trap
handler would still have been run - if there was one the handler
for the signal may have been invoked during the execution of the
exit trap handler, which, if it happened, is incorrect sequencing).

Now, if we're exiting, and there are pending signals, run their handlers
just before running the EXIT trap handler, if any.
There are almost certainly plenty more issues with traps that need
solving.   Later,

XXX pullup -9
(-8 is too different in this area, and this problem suitably obscure,
that we won't bother) (the -7 sh is simply obsolete).


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.175.2.1 src/bin/sh/eval.c
cvs rdiff -u -r1.52 -r1.52.2.1 src/bin/sh/trap.c

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

Modified files:

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.175 src/bin/sh/eval.c:1.175.2.1
--- src/bin/sh/eval.c:1.175	Sat May  4 02:52:55 2019
+++ src/bin/sh/eval.c	Wed Dec 11 14:52:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.175 2019/05/04 02:52:55 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.175.2.1 2019/12/11 14:52:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.175 2019/05/04 02:52:55 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.175.2.1 2019/12/11 14:52:50 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -1061,13 +1061,18 @@ evalcommand(union node *cmd, int flgs, s
 		free_traps();
 
 	/* Fork off a child process if necessary. */
-	if (cmd->ncmd.backgnd || (have_traps() && (flags & EV_EXIT) != 0)
-	 || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN)
-	 && (flags & EV_EXIT) == 0)
-	 || ((flags & EV_BACKCMD) != 0 &&
-	((cmdentry.cmdtype != CMDBUILTIN && cmdentry.cmdtype != CMDSPLBLTIN)
-		 || cmdentry.u.bltin == dotcmd
-		 || cmdentry.u.bltin == evalcmd))) {
+	if (cmd->ncmd.backgnd
+	  || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN)
+	 && (have_traps() || (flags & EV_EXIT) == 0))
+#ifdef notyet			/* EV_BACKCMD is never set currently */
+			/* this will need more work if/when it gets used */
+	  || ((flags & EV_BACKCMD) != 0
+	 && (cmdentry.cmdtype != CMDBUILTIN
+	 && cmdentry.cmdtype != CMDSPLBLTIN)
+	   || cmdentry.u.bltin == dotcmd
+	   || cmdentry.u.bltin == evalcmd)
+#endif
+	 ) {
 		INTOFF;
 		jp = makejob(cmd, 1);
 		mode = cmd->ncmd.backgnd;

Index: src/bin/sh/trap.c
diff -u src/bin/sh/trap.c:1.52 src/bin/sh/trap.c:1.52.2.1
--- src/bin/sh/trap.c:1.52	Thu Apr 25 03:54:10 2019
+++ src/bin/sh/trap.c	Wed Dec 11 14:52:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52 2019/04/25 03:54:10 kre Exp $	*/
+/*	$NetBSD: trap.c,v 1.52.2.1 2019/12/11 14:52:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)trap.c	8.5 (Berkeley) 6/5/95";
 #else
-__RCSID("$NetBSD: trap.c,v 1.52 2019/04/25 03:54:10 kre Exp $");
+__RCSID("$NetBSD: trap.c,v 1.52.2.1 2019/12/11 14:52:50 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -854,6 +854,12 @@ exitshell_savedstatus(void)
 	}
 	exitstatus = exiting_status;
 
+	if (pendingsigs && !setjmp(loc.loc)) {
+		handler = 
+
+		dotrap();
+	}
+
 	if (!setjmp(loc.loc)) {
 		handler = 
 



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

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:48:31 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #541):

sys/dev/pci/if_wm.c: revision 1.651

 Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't
occurred.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.1 -r1.645.2.2 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.1 src/sys/dev/pci/if_wm.c:1.645.2.2
--- src/sys/dev/pci/if_wm.c:1.645.2.1	Wed Nov  6 10:07:42 2019
+++ src/sys/dev/pci/if_wm.c	Wed Dec 11 14:48:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.2 2019/12/11 14:48:31 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.2 2019/12/11 14:48:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -11625,7 +11625,7 @@ wm_sgmii_readreg_locked(device_t dev, in
 {
 	struct wm_softc *sc = device_private(dev);
 	uint32_t i2ccmd;
-	int i, rv;
+	int i, rv = 0;
 
 	i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT)
 	| (phy << I2CCMD_PHY_ADDR_SHIFT) | I2CCMD_OPCODE_READ;



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

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:46:28 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by sevan in ticket #540):

external/cddl/osnet/dist/uts/common/fs/zfs/arc.c: revision 1.16

We currently lack a tunable to control ZFS prefetch, so skip the warning and
FreeBSD specific instructions on settings.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14.2.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14.2.2
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14.2.1	Sun Dec  8 15:54:34 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Wed Dec 11 14:46:28 2019
@@ -6218,6 +6218,7 @@ arc_init(void)
 	}
 
 #ifdef _KERNEL
+#ifdef __FreeBSD__
 	if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", _prefetch_disable))
 		prefetch_tunable_set = 1;
 
@@ -6239,6 +6240,7 @@ arc_init(void)
 		zfs_prefetch_disable = 1;
 	}
 #endif
+#endif
 	/* Warn about ZFS memory and address space requirements. */
 	if (((uint64_t)physmem * PAGESIZE) < (256 + 128 + 64) * (1 << 20)) {
 		printf("ZFS WARNING: Recommended minimum RAM size is 512MB; "
@@ -6247,9 +6249,11 @@ arc_init(void)
 	if (kmem_size() < 512 * (1 << 20)) {
 		printf("ZFS WARNING: Recommended minimum kmem_size is 512MB; "
 		"expect unstable behavior.\n");
+#ifdef __FreeBSD__
 		printf(" Consider tuning vm.kmem_size and "
 		"vm.kmem_size_max\n");
 		printf(" in /boot/loader.conf.\n");
+#endif
 	}
 #endif
 }



CVS commit: [netbsd-9] src/etc/rc.d

2019-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 11 14:13:40 UTC 2019

Modified Files:
src/etc/rc.d [netbsd-9]: zfs

Log Message:
Pull up following revision(s) (requested by sevan in ticket #539):

etc/rc.d/zfs: revision 1.4
etc/rc.d/zfs: revision 1.5

We don't need to require the presence of /etc/zfs/zpool.cache to unmount &
unload the module, just like for the start target.

This script just makes sure that the ZFS module loads and unloads, mountall
script takes care of mounting filesystems.

Don't try to unmount all file systems before unloading the ZFS module, leave
that to the operator in preperation or the mountall script to take care
of. Module will of course fail to unload then if file systems are still
mounted.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/etc/rc.d/zfs

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

Modified files:

Index: src/etc/rc.d/zfs
diff -u src/etc/rc.d/zfs:1.1.2.3 src/etc/rc.d/zfs:1.1.2.4
--- src/etc/rc.d/zfs:1.1.2.3	Sun Dec  8 14:42:01 2019
+++ src/etc/rc.d/zfs	Wed Dec 11 14:13:40 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: zfs,v 1.1.2.3 2019/12/08 14:42:01 martin Exp $
+# $NetBSD: zfs,v 1.1.2.4 2019/12/11 14:13:40 martin Exp $
 #
 
 # PROVIDE: zfs
@@ -28,8 +28,7 @@ zfs_start()
 
 zfs_stop()
 {
-	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
-		zfs unmount -a
+	if [ -x /sbin/zfs ]; then
 		modunload zfs
 	fi
 	return 0;



CVS commit: src/sys/dev/dm

2019-12-11 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec 11 14:03:37 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Revert "Fix error handling in dmioctl()" for now

This change seems to break "deps" in dm ioctl(2) for linear target.
Revert the change, will revisit later.
https://mail-index.netbsd.org/current-users/2019/12/11/msg037179.html


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/dm/device-mapper.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/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.48 src/sys/dev/dm/device-mapper.c:1.49
--- src/sys/dev/dm/device-mapper.c:1.48	Mon Dec  9 15:54:59 2019
+++ src/sys/dev/dm/device-mapper.c	Wed Dec 11 14:03:37 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.48 2019/12/09 15:54:59 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.49 2019/12/11 14:03:37 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -377,8 +377,8 @@ dmioctl(dev_t dev, const u_long cmd, voi
 		if ((r = dm_cmd_to_fun(dm_dict_in)) != 0)
 			goto cleanup_exit;
 
-		r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in);
 cleanup_exit:
+		r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in);
 		prop_object_release(dm_dict_in);
 	}
 



CVS commit: src/sys/dev/usb

2019-12-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Dec 11 11:54:23 UTC 2019

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

Log Message:
reading usbdi.c it looks like usbd_get_config_descriptor() can actually
return NULL, so check for this.
I got NULL pointer dereference here with a device showing:
[   303.732632] ugen0: autoconfiguration error: setting configuration index 0 
failed


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

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.147 src/sys/dev/usb/ugen.c:1.148
--- src/sys/dev/usb/ugen.c:1.147	Sun Dec  1 08:27:54 2019
+++ src/sys/dev/usb/ugen.c	Wed Dec 11 11:54:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.147 2019/12/01 08:27:54 maxv Exp $	*/
+/*	$NetBSD: ugen.c,v 1.148 2019/12/11 11:54:23 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.147 2019/12/01 08:27:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.148 2019/12/11 11:54:23 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1406,6 +1406,8 @@ ugen_get_cdesc(struct ugen_softc *sc, in
 
 	if (index == USB_CURRENT_CONFIG_INDEX) {
 		tdesc = usbd_get_config_descriptor(sc->sc_udev);
+		if (tdesc == NULL)
+			return NULL;
 		len = UGETW(tdesc->wTotalLength);
 		if (lenp)
 			*lenp = len;



CVS commit: src/sys/dev/pci

2019-12-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 11 10:28:19 UTC 2019

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Add SFP support part 1. The code for SerDes and SGMII setting is not include
in this commit. SFP module removal interrupt detects but not used yet:
- Detect SFP's 1000BASE-SX, 1000BASE-LX, 100BASE-FX and 1000BASE-T correctly.
- Detect the Media Auto Sense feature. Not supported yet.
- Add comment.


To generate a diff of this commit:
cvs rdiff -u -r1.654 -r1.655 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/if_wmvar.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.654 src/sys/dev/pci/if_wm.c:1.655
--- src/sys/dev/pci/if_wm.c:1.654	Wed Dec 11 09:48:16 2019
+++ src/sys/dev/pci/if_wm.c	Wed Dec 11 10:28:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.654 2019/12/11 09:48:16 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.655 2019/12/11 10:28:19 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.654 2019/12/11 09:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.655 2019/12/11 10:28:19 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -507,6 +507,7 @@ struct wm_softc {
 	wm_chip_type sc_type;		/* MAC type */
 	int sc_rev;			/* MAC revision */
 	wm_phy_type sc_phytype;		/* PHY type */
+	uint8_t sc_sfptype;		/* SFP type */
 	uint32_t sc_mediatype;		/* Media type (Copper, Fiber, SERDES)*/
 #define	WM_MEDIATYPE_UNKNOWN		0x00
 #define	WM_MEDIATYPE_FIBER		0x01
@@ -2604,11 +2605,20 @@ alloc_retry:
 		break;
 	}
 
-	if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)) {
-		/* Check NVM for autonegotiation */
+	if (sc->sc_type >= WM_T_82575) {
 		if (wm_nvm_read(sc, NVM_OFF_COMPAT, 1, ) == 0) {
-			if ((nvmword & NVM_COMPAT_SERDES_FORCE_MODE) != 0)
-sc->sc_flags |= WM_F_PCS_DIS_AUTONEGO;
+			if ((sc->sc_type == WM_T_82575) ||
+			(sc->sc_type == WM_T_82576)) {
+/* Check NVM for autonegotiation */
+if ((nvmword & NVM_COMPAT_SERDES_FORCE_MODE)
+!= 0)
+	sc->sc_flags |= WM_F_PCS_DIS_AUTONEGO;
+			}
+			if ((sc->sc_type == WM_T_82575) ||
+			(sc->sc_type == WM_T_I350)) {
+if (nvmword & NVM_COMPAT_MAS_EN(sc->sc_funcid))
+	sc->sc_flags |= WM_F_MAS;
+			}
 		}
 	}
 
@@ -2716,12 +2726,12 @@ alloc_retry:
 		link_mode = reg & CTRL_EXT_LINK_MODE_MASK;
 		switch (link_mode) {
 		case CTRL_EXT_LINK_MODE_1000KX:
-			aprint_verbose_dev(sc->sc_dev, "1000KX\n");
+			aprint_normal_dev(sc->sc_dev, "1000KX\n");
 			sc->sc_mediatype = WM_MEDIATYPE_SERDES;
 			break;
 		case CTRL_EXT_LINK_MODE_SGMII:
 			if (wm_sgmii_uses_mdio(sc)) {
-aprint_verbose_dev(sc->sc_dev,
+aprint_normal_dev(sc->sc_dev,
 "SGMII(MDIO)\n");
 sc->sc_flags |= WM_F_SGMII;
 sc->sc_mediatype = WM_MEDIATYPE_COPPER;
@@ -2736,6 +2746,8 @@ alloc_retry:
 == CTRL_EXT_LINK_MODE_SGMII) {
 	sc->sc_mediatype = WM_MEDIATYPE_COPPER;
 	sc->sc_flags |= WM_F_SGMII;
+	aprint_verbose_dev(sc->sc_dev,
+	"SGMII\n");
 } else {
 	sc->sc_mediatype = WM_MEDIATYPE_SERDES;
 	aprint_verbose_dev(sc->sc_dev,
@@ -2744,25 +2756,26 @@ alloc_retry:
 break;
 			}
 			if (sc->sc_mediatype == WM_MEDIATYPE_SERDES)
-aprint_verbose_dev(sc->sc_dev, "SERDES\n");
+aprint_normal_dev(sc->sc_dev, "SERDES(SFP)\n");
+			else if (sc->sc_mediatype == WM_MEDIATYPE_COPPER) {
+aprint_normal_dev(sc->sc_dev, "SGMII(SFP)\n");
+sc->sc_flags |= WM_F_SGMII;
+			}
+			/* Do not change link mode for 100BaseFX */
+			if (sc->sc_sfptype == SFF_SFP_ETH_FLAGS_100FX)
+break;
 
 			/* Change current link mode setting */
 			reg &= ~CTRL_EXT_LINK_MODE_MASK;
-			switch (sc->sc_mediatype) {
-			case WM_MEDIATYPE_COPPER:
+			if (sc->sc_mediatype == WM_MEDIATYPE_COPPER)
 reg |= CTRL_EXT_LINK_MODE_SGMII;
-break;
-			case WM_MEDIATYPE_SERDES:
+			else
 reg |= CTRL_EXT_LINK_MODE_PCIE_SERDES;
-break;
-			default:
-break;
-			}
 			CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
 			break;
 		case CTRL_EXT_LINK_MODE_GMII:
 		default:
-			aprint_verbose_dev(sc->sc_dev, "Copper\n");
+			aprint_normal_dev(sc->sc_dev, "Copper\n");
 			sc->sc_mediatype = WM_MEDIATYPE_COPPER;
 			break;
 		}
@@ -5695,7 +5708,7 @@ wm_init_locked(struct ifnet *ifp)
 	struct wm_softc *sc = ifp->if_softc;
 	struct ethercom *ec = >sc_ethercom;
 	int i, j, trynum, error = 0;
-	uint32_t reg;
+	uint32_t reg, sfp_mask = 0;
 
 	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
 		device_xname(sc->sc_dev), __func__));
@@ -6047,6 +6060,13 @@ wm_init_locked(struct ifnet *ifp)
 	/* Set up the interrupt registers. */
 	CSR_WRITE(sc, WMREG_IMC, 0xU);
 
+	/* Enable SFP module insertion interrupt if it's 

CVS commit: src/sys/dev/pci

2019-12-11 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Dec 11 10:03:08 UTC 2019

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

Log Message:
Fix to detect link state down

Link status event that is used to update link status sometimes
is not notified when link down. So, use Get Link Status response
that has the same information with the event.
The handling of the event is needed to detect link state
up because the response sometimes does not notify link up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_ixl.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.3 src/sys/dev/pci/if_ixl.c:1.4
--- src/sys/dev/pci/if_ixl.c:1.3	Wed Dec 11 05:50:03 2019
+++ src/sys/dev/pci/if_ixl.c	Wed Dec 11 10:03:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.3 2019/12/11 05:50:03 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.4 2019/12/11 10:03:08 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -475,7 +475,8 @@ struct ixl_queue_pair {
 
 struct ixl_atq {
 	struct ixl_aq_desc	 iatq_desc;
-	void			(*iatq_fn)(struct ixl_softc *);
+	void			(*iatq_fn)(struct ixl_softc *,
+const struct ixl_aq_desc *);
 };
 SIMPLEQ_HEAD(ixl_atq_list, ixl_atq);
 
@@ -616,7 +617,8 @@ static void	ixl_arq_unfill(struct ixl_so
 
 static int	ixl_atq_poll(struct ixl_softc *, struct ixl_aq_desc *,
 		unsigned int);
-static void	ixl_atq_set(struct ixl_atq *, void (*)(struct ixl_softc *));
+static void	ixl_atq_set(struct ixl_atq *,
+		void (*)(struct ixl_softc *, const struct ixl_aq_desc *));
 static int	ixl_atq_post(struct ixl_softc *, struct ixl_atq *);
 static int	ixl_atq_post_locked(struct ixl_softc *, struct ixl_atq *);
 static void	ixl_atq_done(struct ixl_softc *);
@@ -635,7 +637,8 @@ static void	ixl_hmc_free(struct ixl_soft
 static int	ixl_get_vsi(struct ixl_softc *);
 static int	ixl_set_vsi(struct ixl_softc *);
 static void	ixl_set_filter_control(struct ixl_softc *);
-static int	ixl_get_link_status(struct ixl_softc *);
+static void	ixl_get_link_status(void *);
+static int	ixl_get_link_status_poll(struct ixl_softc *);
 static int	ixl_set_link_status(struct ixl_softc *,
 		const struct ixl_aq_desc *);
 static void	ixl_config_rss(struct ixl_softc *);
@@ -644,7 +647,6 @@ static int	ixl_add_macvlan(struct ixl_so
 static int	ixl_remove_macvlan(struct ixl_softc *, uint8_t *, uint16_t,
 		uint16_t);
 static void	ixl_arq(void *);
-static void	ixl_link_state_update(void *);
 static void	ixl_hmc_pack(void *, const void *,
 		const struct ixl_hmc_pack *, unsigned int);
 static uint32_t	ixl_rd_rx_csr(struct ixl_softc *, uint32_t);
@@ -719,7 +721,8 @@ static void	ixl_work_wait(struct workque
 static void	ixl_workq_work(struct work *, void *);
 static const struct ixl_product *
 		ixl_lookup(const struct pci_attach_args *pa);
-static void	ixl_link_status(struct ixl_softc *);
+static void	ixl_link_state_update(struct ixl_softc *,
+		const struct ixl_aq_desc *);
 static int	ixl_set_macvlan(struct ixl_softc *);
 static int	ixl_setup_interrupts(struct ixl_softc *);;
 static void	ixl_teardown_interrupts(struct ixl_softc *);
@@ -1109,7 +1112,7 @@ ixl_attach(device_t parent, device_t sel
 		goto free_hmc;
 	}
 
-	rv = ixl_get_link_status(sc);
+	rv = ixl_get_link_status_poll(sc);
 	if (rv != 0) {
 		aprint_error_dev(self, "GET LINK STATUS %s\n",
 		rv == ETIMEDOUT ? "timeout" : "error");
@@ -1204,7 +1207,7 @@ ixl_attach(device_t parent, device_t sel
 	ether_set_ifflags_cb(>sc_ec, ixl_ifflags_cb);
 	(void)ixl_get_link_status(sc);
 
-	ixl_work_set(>sc_link_state_task, ixl_link_state_update, sc);
+	ixl_work_set(>sc_link_state_task, ixl_get_link_status, sc);
 
 	ixl_config_other_intr(sc);
 
@@ -1787,7 +1790,8 @@ ixl_init_locked(struct ixl_softc *sc)
 
 	SET(ifp->if_flags, IFF_RUNNING);
 	CLR(ifp->if_flags, IFF_OACTIVE);
-	ixl_link_status(sc);
+
+	(void)ixl_get_link_status_poll(sc);
 
 	ixl_config_rss(sc);
 	ixl_config_queue_intr(sc);
@@ -3128,14 +3132,15 @@ ixl_other_intr(void *xsc)
 }
 
 static void
-ixl_link_state_update_done(struct ixl_softc *sc)
+ixl_get_link_status_done(struct ixl_softc *sc,
+const struct ixl_aq_desc *iaq)
 {
 
-	/* IXL_AQ_OP_PHY_LINK_STATUS already posted to admin reply queue */
+	ixl_link_state_update(sc, iaq);
 }
 
 static void
-ixl_link_state_update(void *xsc)
+ixl_get_link_status(void *xsc)
 {
 	struct ixl_softc *sc = xsc;
 	struct ixl_aq_desc *iaq;
@@ -3147,12 +3152,12 @@ ixl_link_state_update(void *xsc)
 	param = (struct ixl_aq_link_param *)iaq->iaq_param;
 	param->notify = IXL_AQ_LINK_NOTIFY;
 
-	ixl_atq_set(>sc_link_state_atq, ixl_link_state_update_done);
+	ixl_atq_set(>sc_link_state_atq, ixl_get_link_status_done);
 	(void)ixl_atq_post(sc, >sc_link_state_atq);
 }
 
 static void
-ixl_arq_link_status(struct ixl_softc *sc, const struct ixl_aq_desc *iaq)
+ixl_link_state_update(struct ixl_softc 

CVS commit: src/sys/dev/pci

2019-12-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 11 09:48:16 UTC 2019

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580 port 1, 2, 3 and
  newer chips. This change fixes a bug that some fiber, serdes or SFP devices
  don't detect the link status correctly.
  XXX We should check for other NVM reads if they have the same problem. One of
  the solution to avoid this type of bug is to check the register layout
  in wm_nvm_read().
- Use __BIT()
- Add comment


To generate a diff of this commit:
cvs rdiff -u -r1.653 -r1.654 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/if_wmreg.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.653 src/sys/dev/pci/if_wm.c:1.654
--- src/sys/dev/pci/if_wm.c:1.653	Wed Dec 11 09:27:46 2019
+++ src/sys/dev/pci/if_wm.c	Wed Dec 11 09:48:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.653 2019/12/11 09:27:46 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.654 2019/12/11 09:48:16 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.653 2019/12/11 09:27:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.654 2019/12/11 09:48:16 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2656,10 +2656,11 @@ alloc_retry:
 		}
 	}
 
-	/* XXX For other than 82580? */
-	if (sc->sc_type == WM_T_82580) {
-		wm_nvm_read(sc, NVM_OFF_CFG3_PORTA, 1, );
-		if (nvmword & __BIT(13))
+	if ((sc->sc_type >= WM_T_82580) && (sc->sc_type <= WM_T_I211)) {
+		wm_nvm_read(sc,
+		NVM_OFF_LAN_FUNC_82580(sc->sc_funcid) + NVM_OFF_CFG3_PORTA,
+		1, );
+		if (nvmword & NVM_CFG3_ILOS)
 			sc->sc_ctrl |= CTRL_ILOS;
 	}
 

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.116 src/sys/dev/pci/if_wmreg.h:1.117
--- src/sys/dev/pci/if_wmreg.h:1.116	Wed Dec 11 09:12:29 2019
+++ src/sys/dev/pci/if_wmreg.h	Wed Dec 11 09:48:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.116 2019/12/11 09:12:29 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.117 2019/12/11 09:48:16 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -1487,9 +1487,10 @@ struct livengood_tcpip_ctxdesc {
 
 #define NVM_3GIO_3_ASPM_MASK	(0x3 << 2)	/* Active State PM Support */
 
-#define NVM_CFG3_APME		(1U << 10)	
-#define NVM_CFG3_PORTA_EXT_MDIO	(1U << 2)	/* External MDIO Interface */
-#define NVM_CFG3_PORTA_COM_MDIO	(1U << 3)	/* MDIO Interface is shared */
+#define NVM_CFG3_PORTA_EXT_MDIO	__BIT(2)	/* External MDIO Interface */
+#define NVM_CFG3_PORTA_COM_MDIO	__BIT(3)	/* MDIO Interface is shared */
+#define NVM_CFG3_APME		__BIT(10)	/* APM Enable */
+#define NVM_CFG3_ILOS		__BIT(13)	/* Invert loss of signal */
 
 #define	NVM_OFF_MACADDR_82571(x)	(3 * (x))
 



CVS commit: src/sys/dev/pci

2019-12-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 11 09:27:46 UTC 2019

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

Log Message:
- MSI-X doesn't use sc->sc_icr variable, so move the code into non-MSI-X part.
  No functional change intended. OK'd by knakahara.
- Modify debug printfs a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.652 -r1.653 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.652 src/sys/dev/pci/if_wm.c:1.653
--- src/sys/dev/pci/if_wm.c:1.652	Wed Dec 11 09:12:29 2019
+++ src/sys/dev/pci/if_wm.c	Wed Dec 11 09:27:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.652 2019/12/11 09:12:29 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.653 2019/12/11 09:27:46 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.652 2019/12/11 09:12:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.653 2019/12/11 09:27:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6045,8 +6045,7 @@ wm_init_locked(struct ifnet *ifp)
 
 	/* Set up the interrupt registers. */
 	CSR_WRITE(sc, WMREG_IMC, 0xU);
-	sc->sc_icr = ICR_TXDW | ICR_LSC | ICR_RXSEQ | ICR_RXDMT0 |
-	ICR_RXO | ICR_RXT0;
+
 	if (wm_is_using_msix(sc)) {
 		uint32_t mask;
 		struct wm_queue *wmq;
@@ -6086,8 +6085,11 @@ wm_init_locked(struct ifnet *ifp)
 			CSR_WRITE(sc, WMREG_IMS, ICR_LSC);
 			break;
 		}
-	} else
+	} else {
+		sc->sc_icr = ICR_TXDW | ICR_LSC | ICR_RXSEQ | ICR_RXDMT0 |
+		ICR_RXO | ICR_RXT0;
 		CSR_WRITE(sc, WMREG_IMS, sc->sc_icr);
+	}
 
 	/* Set up the inter-packet gap. */
 	CSR_WRITE(sc, WMREG_TIPG, sc->sc_tipg);
@@ -9627,11 +9629,12 @@ wm_linkintr_msix(void *arg)
 	uint32_t reg;
 	bool has_rxo;
 
-	DPRINTF(WM_DEBUG_LINK,
-	("%s: LINK: got link intr\n", device_xname(sc->sc_dev)));
-
 	reg = CSR_READ(sc, WMREG_ICR);
 	WM_CORE_LOCK(sc);
+	DPRINTF(WM_DEBUG_LINK,
+	("%s: LINK: got link intr. ICR = %08x\n",
+		device_xname(sc->sc_dev), reg));
+
 	if (sc->sc_core_stopping)
 		goto out;
 
@@ -12083,7 +12086,8 @@ wm_tbi_tick(struct wm_softc *sc)
 		if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO)
 		&& (++sc->sc_tbi_serdes_ticks
 			>= sc->sc_tbi_serdes_anegticks)) {
-			DPRINTF(WM_DEBUG_LINK, ("EXPIRE\n"));
+			DPRINTF(WM_DEBUG_LINK, ("%s: %s: EXPIRE\n",
+device_xname(sc->sc_dev), __func__));
 			sc->sc_tbi_serdes_ticks = 0;
 			/*
 			 * Reset the link, and let autonegotiation do
@@ -12308,7 +12312,8 @@ wm_serdes_tick(struct wm_softc *sc)
 		if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO)
 		&& (++sc->sc_tbi_serdes_ticks
 			>= sc->sc_tbi_serdes_anegticks)) {
-			DPRINTF(WM_DEBUG_LINK, ("EXPIRE\n"));
+			DPRINTF(WM_DEBUG_LINK, ("%s: %s: EXPIRE\n",
+device_xname(sc->sc_dev), __func__));
 			sc->sc_tbi_serdes_ticks = 0;
 			/* XXX */
 			wm_serdes_mediachange(ifp);



CVS commit: src/sys/dev/pci

2019-12-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 11 09:12:29 UTC 2019

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
No functional change:
 - Add defintion of CONNSW register and PCS_NPTX (not used yet).
 - Add some bit definitions of PCS_LCTL.
 - Renae macro.
 - Fix comment. Add comment.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.651 -r1.652 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/if_wmreg.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.651 src/sys/dev/pci/if_wm.c:1.652
--- src/sys/dev/pci/if_wm.c:1.651	Mon Dec  9 02:30:30 2019
+++ src/sys/dev/pci/if_wm.c	Wed Dec 11 09:12:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.651 2019/12/09 02:30:30 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.652 2019/12/11 09:12:29 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.651 2019/12/09 02:30:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.652 2019/12/11 09:12:29 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -12370,6 +12370,7 @@ wm_sfp_get_media_type(struct wm_softc *s
 	}
 	if (rv != 0)
 		goto out;
+
 	switch (val) {
 	case SFF_SFP_ID_SFF:
 		aprint_normal_dev(sc->sc_dev,
@@ -12385,9 +12386,8 @@ wm_sfp_get_media_type(struct wm_softc *s
 	}
 
 	rv = wm_sfp_read_data_byte(sc, SFF_SFP_ETH_FLAGS_OFF, );
-	if (rv != 0) {
+	if (rv != 0)
 		goto out;
-	}
 
 	if ((val & (SFF_SFP_ETH_FLAGS_1000SX | SFF_SFP_ETH_FLAGS_1000LX)) != 0)
 		mediatype = WM_MEDIATYPE_SERDES;

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.115 src/sys/dev/pci/if_wmreg.h:1.116
--- src/sys/dev/pci/if_wmreg.h:1.115	Tue Jul 23 09:37:08 2019
+++ src/sys/dev/pci/if_wmreg.h	Wed Dec 11 09:12:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.115 2019/07/23 09:37:08 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.116 2019/12/11 09:12:29 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -435,7 +435,7 @@ struct livengood_tcpip_ctxdesc {
 #define CTRL_D_UD_EN	(1U << 13)	/* Dock/Undock enable */
 #define CTRL_D_UD_POL	(1U << 14)	/* Defined polarity of Dock/Undock indication in SDP[0] */
 #define CTRL_F_PHY_R 	(1U << 15)	/* Reset both PHY ports, through PHYRST_N pin */
-#define CTRL_EXT_LINK_EN (1U << 16)	/* enable link status from external LINK_0 and LINK_1 pins */
+#define CTRL_EXTLINK_EN (1U << 16)	/* enable link status from external LINK_0 and LINK_1 pins */
 #define CTRL_LANPHYPC_OVERRIDE (1U << 16) /* SW control of LANPHYPC */
 #define CTRL_LANPHYPC_VALUE (1U << 17)	/* SW value of LANPHYPC */
 #define	CTRL_SWDPINS_SHIFT	18
@@ -639,6 +639,14 @@ struct livengood_tcpip_ctxdesc {
 #define	KUMCTRLSTA_OPMODE_MASK	0x000c
 #define	KUMCTRLSTA_OPMODE_INBAND_MDIO 0x0004
 
+#define	WMREG_CONNSW	0x0034	/* Copper/Fiber Switch Control (>= 82575) */
+#define	CONNSW_AUTOSENSE_EN	__BIT(0)	/* Auto Sense Enable */
+#define	CONNSW_AUTOSENSE_CONF	__BIT(1)	/* Auto Sense Config Mode */
+#define	CONNSW_ENRGSRC		__BIT(2)	/* SerDes Energy Detect Src */
+#define	CONNSW_SERDESD		__BIT(9)	/* SerDes Signal Detect Ind. */
+#define	CONNSW_PHYSD		__BIT(10)	/* PHY Signal Detect Ind. */
+#define	CONNSW_PHY_PDN		__BIT(11)	/* Internal PHY in powerdown */
+
 #define	WMREG_VET	0x0038	/* VLAN Ethertype */
 #define	WMREG_MDPHYA	0x003c	/* PHY address - RW */
 
@@ -1153,13 +1161,23 @@ struct livengood_tcpip_ctxdesc {
 #define	PCS_CFG_PCS_EN	__BIT(3)
 
 #define	WMREG_PCS_LCTL	0x4208	/* PCS Link Control */
-#define	PCS_LCTL_FSV_1000 __BIT(2)	/* AN Timeout Enable */
-#define	PCS_LCTL_FDV_FULL __BIT(3)	/* AN Timeout Enable */
-#define	PCS_LCTL_FSD __BIT(4)	/* AN Timeout Enable */
-#define	PCS_LCTL_FORCE_FC __BIT(7)	/* AN Timeout Enable */
-#define	PCS_LCTL_AN_ENABLE __BIT(16)	/* AN Timeout Enable */
-#define	PCS_LCTL_AN_RESTART __BIT(17)	/* AN Timeout Enable */
-#define	PCS_LCTL_AN_TIMEOUT __BIT(18)	/* AN Timeout Enable */
+#define	PCS_LCTL_FLV_LINK_UP	__BIT(0)	/* Forced Link Value */
+#define	PCS_LCTL_FSV_MASK	__BITS(2, 1)	/* Forced Speed Value */
+#define	PCS_LCTL_FSV_10			0		/* 10Mbps */
+#define	PCS_LCTL_FSV_100		__BIT(1)	/* 100Mbps */
+#define	PCS_LCTL_FSV_1000		__BIT(2)	/* 1Gpbs */
+#define	PCS_LCTL_FDV_FULL	__BIT(3)	/* Force Duplex Value */
+#define	PCS_LCTL_FSD		__BIT(4)	/* Force Speed and Duplex */
+#define	PCS_LCTL_FORCE_LINK	__BIT(5)	/* Force Link */
+#define	PCS_LCTL_LINK_LATCH_LOW	__BIT(6)	/* Link Latch Low */
+#define	PCS_LCTL_FORCE_FC	__BIT(7)	/* Force Flow Control */
+#define	PCS_LCTL_AN_ENABLE	__BIT(16)	/* AN enable */
+#define	PCS_LCTL_AN_RESTART	__BIT(17)	/* AN restart */
+#define	PCS_LCTL_AN_TIMEOUT	__BIT(18)	/* AN Timeout Enable */
+#define	PCS_LCTL_AN_SGMII_BYP	__BIT(19)	/* AN SGMII Bypass */
+#define	PCS_LCTL_AN_SGMII_TRIG	__BIT(20)	/* AN SGMII Trigger */