CVS commit: [netbsd-8] src/sys/arch/x86/x86

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:44:21 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: viac7temp.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1959):

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.20.1 src/sys/arch/x86/x86/viac7temp.c

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

Modified files:

Index: src/sys/arch/x86/x86/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.8 src/sys/arch/x86/x86/viac7temp.c:1.8.20.1
--- src/sys/arch/x86/x86/viac7temp.c:1.8	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/x86/x86/viac7temp.c	Thu Apr 18 16:44:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: viac7temp.c,v 1.8.20.1 2024/04/18 16:44:20 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8.20.1 2024/04/18 16:44:20 martin Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
 	edata->value_cur += 27315;
 	edata->state = ENVSYS_SVALID;
 }
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:44:21 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: viac7temp.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1959):

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.20.1 src/sys/arch/x86/x86/viac7temp.c

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



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

2024-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 17 16:26:10 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: if_iwn.c

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

sys/dev/pci/if_iwn.c: revision 1.100

if_iwn.c: pick up proper firmware for Centrino Wireless-N 130

Both variants should use iwlwifi-6000g2b-6 not iwlwifi-6000g2a-6. (It
seems only two specific product variants use iwlwifi-6000g2a-6. We
could simplify by reversing the sense of the test, as OpenBSD does, but
it doesn't seem to matter much, as what we now match seems to be the
full gamut possible, so the simpler diff was chosen here.)

Addresses PR kern/58105 from wandrien.dev%gmail.com@localhost, with the
PCI_PRODUCT_INTEL_WIFI_LINK_130_1 match tested by the reporter. Code
inspection of the FreeBSD driver indicates we should safely be able to
match PCI_PRODUCT_INTEL_WIFI_LINK_130_2 also.


To generate a diff of this commit:
cvs rdiff -u -r1.84.6.2 -r1.84.6.3 src/sys/dev/pci/if_iwn.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_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.84.6.2 src/sys/dev/pci/if_iwn.c:1.84.6.3
--- src/sys/dev/pci/if_iwn.c:1.84.6.2	Sun Dec 10 10:10:24 2017
+++ src/sys/dev/pci/if_iwn.c	Wed Apr 17 16:26:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.84.6.2 2017/12/10 10:10:24 snj Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.84.6.3 2024/04/17 16:26:10 martin Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.84.6.2 2017/12/10 10:10:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.84.6.3 2024/04/17 16:26:10 martin Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -785,6 +785,8 @@ iwn5000_attach(struct iwn_softc *sc, pci
 		/* Type 6030 cards return IWN_HW_REV_TYPE_6005 */
 		if (pid == PCI_PRODUCT_INTEL_WIFI_LINK_1030_1 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_1030_2 ||
+		pid == PCI_PRODUCT_INTEL_WIFI_LINK_130_1  ||
+		pid == PCI_PRODUCT_INTEL_WIFI_LINK_130_2  ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6230_1 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6230_2 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6235   ||



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

2024-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 17 16:26:10 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: if_iwn.c

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

sys/dev/pci/if_iwn.c: revision 1.100

if_iwn.c: pick up proper firmware for Centrino Wireless-N 130

Both variants should use iwlwifi-6000g2b-6 not iwlwifi-6000g2a-6. (It
seems only two specific product variants use iwlwifi-6000g2a-6. We
could simplify by reversing the sense of the test, as OpenBSD does, but
it doesn't seem to matter much, as what we now match seems to be the
full gamut possible, so the simpler diff was chosen here.)

Addresses PR kern/58105 from wandrien.dev%gmail.com@localhost, with the
PCI_PRODUCT_INTEL_WIFI_LINK_130_1 match tested by the reporter. Code
inspection of the FreeBSD driver indicates we should safely be able to
match PCI_PRODUCT_INTEL_WIFI_LINK_130_2 also.


To generate a diff of this commit:
cvs rdiff -u -r1.84.6.2 -r1.84.6.3 src/sys/dev/pci/if_iwn.c

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



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

2024-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 25 15:37:25 UTC 2024

Modified Files:
src/sys/dev/qbus [netbsd-8]: if_qe.c

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

sys/dev/qbus/if_qe.c: revision 1.82

vax/qe(4): supply an ipf->if_init() so that if_init() doesn't crash.

convert the existing qeinit() to one compatible with if_init.
should fix PR#58068.


To generate a diff of this commit:
cvs rdiff -u -r1.77.2.1 -r1.77.2.2 src/sys/dev/qbus/if_qe.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/qbus/if_qe.c
diff -u src/sys/dev/qbus/if_qe.c:1.77.2.1 src/sys/dev/qbus/if_qe.c:1.77.2.2
--- src/sys/dev/qbus/if_qe.c:1.77.2.1	Thu Jul 26 23:55:30 2018
+++ src/sys/dev/qbus/if_qe.c	Mon Mar 25 15:37:25 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_qe.c,v 1.77.2.1 2018/07/26 23:55:30 snj Exp $ */
+/*  $NetBSD: if_qe.c,v 1.77.2.2 2024/03/25 15:37:25 martin Exp $ */
 /*
  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.77.2.1 2018/07/26 23:55:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.77.2.2 2024/03/25 15:37:25 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -97,7 +97,7 @@ struct	qe_softc {
 
 static	int	qematch(device_t, cfdata_t, void *);
 static	void	qeattach(device_t, device_t, void *);
-static	void	qeinit(struct qe_softc *);
+static	int	qeinit(struct ifnet *);
 static	void	qestart(struct ifnet *);
 static	void	qeintr(void *);
 static	int	qeioctl(struct ifnet *, u_long, void *);
@@ -341,6 +341,7 @@ qeattach(device_t parent, device_t self,
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = qestart;
+	ifp->if_init = qeinit;
 	ifp->if_ioctl = qeioctl;
 	ifp->if_watchdog = qetimeout;
 	IFQ_SET_READY(>if_snd);
@@ -381,10 +382,10 @@ qeattach(device_t parent, device_t self,
 /*
  * Initialization of interface.
  */
-void
-qeinit(struct qe_softc *sc)
+int
+qeinit(struct ifnet *ifp)
 {
-	struct ifnet *ifp = (struct ifnet *)>sc_if;
+	struct qe_softc *sc = ifp->if_softc;
 	struct qe_cdata *qc = sc->sc_qedata;
 	int i;
 
@@ -411,7 +412,6 @@ qeinit(struct qe_softc *sc)
 		qc->qc_xmit[i].qe_status1 = qc->qc_xmit[i].qe_flag = QE_NOTYET;
 	}
 
-
 	/*
 	 * Init receive descriptors.
 	 */
@@ -436,6 +436,7 @@ qeinit(struct qe_softc *sc)
 	 */
 	qe_setup(sc);
 
+	return 0;
 }
 
 /*
@@ -651,7 +652,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v
 		switch(ifa->ifa_addr->sa_family) {
 #ifdef INET
 		case AF_INET:
-			qeinit(sc);
+			qeinit(ifp);
 			arp_ifinit(ifp, ifa);
 			break;
 #endif
@@ -677,7 +678,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v
 			 * If interface it marked up and it is stopped, then
 			 * start it.
 			 */
-			qeinit(sc);
+			qeinit(ifp);
 			break;
 		case IFF_UP|IFF_RUNNING:
 			/*
@@ -865,5 +866,5 @@ qetimeout(struct ifnet *ifp)
 	 * Do a reset of interface, to get it going again.
 	 * Will it work by just restart the transmit logic?
 	 */
-	qeinit(sc);
+	qeinit(ifp);
 }



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

2024-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 25 15:37:25 UTC 2024

Modified Files:
src/sys/dev/qbus [netbsd-8]: if_qe.c

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

sys/dev/qbus/if_qe.c: revision 1.82

vax/qe(4): supply an ipf->if_init() so that if_init() doesn't crash.

convert the existing qeinit() to one compatible with if_init.
should fix PR#58068.


To generate a diff of this commit:
cvs rdiff -u -r1.77.2.1 -r1.77.2.2 src/sys/dev/qbus/if_qe.c

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



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 12:36:17 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-8]: usbdi.c

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

sys/dev/usb/usbdi.c: revision 1.248

usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783


To generate a diff of this commit:
cvs rdiff -u -r1.173.2.5 -r1.173.2.6 src/sys/dev/usb/usbdi.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.c
diff -u src/sys/dev/usb/usbdi.c:1.173.2.5 src/sys/dev/usb/usbdi.c:1.173.2.6
--- src/sys/dev/usb/usbdi.c:1.173.2.5	Fri Jan 11 15:52:24 2019
+++ src/sys/dev/usb/usbdi.c	Tue Mar 12 12:36:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.173.2.5 2019/01/11 15:52:24 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.173.2.6 2024/03/12 12:36:17 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.173.2.5 2019/01/11 15:52:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.173.2.6 2024/03/12 12:36:17 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1169,14 +1169,34 @@ usbd_dopoll(struct usbd_interface *iface
 void
 usbd_set_polling(struct usbd_device *dev, int on)
 {
-	if (on)
-		dev->ud_bus->ub_usepolling++;
-	else
-		dev->ud_bus->ub_usepolling--;
 
-	/* Kick the host controller when switching modes */
 	mutex_enter(dev->ud_bus->ub_lock);
-	dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	if (on) {
+		/*
+		 * Enabling polling.  If we're enabling for the first
+		 * time, call the softint routine on transition while
+		 * we hold the lock and polling is still disabled, and
+		 * then enable polling -- once polling is enabled, we
+		 * must not hold the lock when we call the softint
+		 * routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling < __type_max(char));
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+		dev->ud_bus->ub_usepolling++;
+	} else {
+		/*
+		 * Disabling polling.  If we're disabling polling for
+		 * the last time, disable polling first and then call
+		 * the softint routine while we hold the lock -- until
+		 * polling is disabled, we must not hold the lock when
+		 * we call the softint routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling > 0);
+		dev->ud_bus->ub_usepolling--;
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	}
 	mutex_exit(dev->ud_bus->ub_lock);
 }
 



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 12:36:17 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-8]: usbdi.c

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

sys/dev/usb/usbdi.c: revision 1.248

usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783


To generate a diff of this commit:
cvs rdiff -u -r1.173.2.5 -r1.173.2.6 src/sys/dev/usb/usbdi.c

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



CVS commit: [netbsd-8] src/sys/net

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 19:31:31 UTC 2024

Modified Files:
src/sys/net [netbsd-8]: if_tun.c

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

sys/net/if_tun.c: revision 1.175

tun(4): Allow IPv6 packets with TUNSLMODE configured.
PR kern/58013


To generate a diff of this commit:
cvs rdiff -u -r1.139.2.4 -r1.139.2.5 src/sys/net/if_tun.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/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.139.2.4 src/sys/net/if_tun.c:1.139.2.5
--- src/sys/net/if_tun.c:1.139.2.4	Wed Aug 15 12:07:30 2018
+++ src/sys/net/if_tun.c	Mon Mar 11 19:31:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.139.2.4 2018/08/15 12:07:30 martin Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.139.2.5 2024/03/11 19:31:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139.2.4 2018/08/15 12:07:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139.2.5 2024/03/11 19:31:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -577,9 +577,7 @@ tun_output(struct ifnet *ifp, struct mbu
 goto out;
 			}
 			memcpy(mtod(m0, char *), dst, dst->sa_len);
-		}
-
-		if (tp->tun_flags & TUN_IFHEAD) {
+		} else if (tp->tun_flags & TUN_IFHEAD) {
 			/* Prepend the address family */
 			M_PREPEND(m0, sizeof(*af), M_DONTWAIT);
 			if (m0 == NULL) {



CVS commit: [netbsd-8] src/sys/net

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 19:31:31 UTC 2024

Modified Files:
src/sys/net [netbsd-8]: if_tun.c

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

sys/net/if_tun.c: revision 1.175

tun(4): Allow IPv6 packets with TUNSLMODE configured.
PR kern/58013


To generate a diff of this commit:
cvs rdiff -u -r1.139.2.4 -r1.139.2.5 src/sys/net/if_tun.c

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



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 18:04:54 UTC 2024

Modified Files:
src/sys/kern [netbsd-8]: sysv_shm.c

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

sys/kern/sysv_shm.c: revision 1.142 (patch)

Avoid overflow when computing kern.ipc.shmmax. Keep shmmax (bytes) and
shmall (pages) values aligned and use arithmetic everywhere instead
of shifts.

Should fix PR 57979


To generate a diff of this commit:
cvs rdiff -u -r1.131.10.2 -r1.131.10.3 src/sys/kern/sysv_shm.c

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



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 18:04:54 UTC 2024

Modified Files:
src/sys/kern [netbsd-8]: sysv_shm.c

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

sys/kern/sysv_shm.c: revision 1.142 (patch)

Avoid overflow when computing kern.ipc.shmmax. Keep shmmax (bytes) and
shmall (pages) values aligned and use arithmetic everywhere instead
of shifts.

Should fix PR 57979


To generate a diff of this commit:
cvs rdiff -u -r1.131.10.2 -r1.131.10.3 src/sys/kern/sysv_shm.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/sysv_shm.c
diff -u src/sys/kern/sysv_shm.c:1.131.10.2 src/sys/kern/sysv_shm.c:1.131.10.3
--- src/sys/kern/sysv_shm.c:1.131.10.2	Tue Jan 21 18:12:54 2020
+++ src/sys/kern/sysv_shm.c	Mon Mar 11 18:04:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_shm.c,v 1.131.10.2 2020/01/21 18:12:54 martin Exp $	*/
+/*	$NetBSD: sysv_shm.c,v 1.131.10.3 2024/03/11 18:04:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.131.10.2 2020/01/21 18:12:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.131.10.3 2024/03/11 18:04:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -1004,10 +1004,10 @@ shminit(struct sysctllog **clog)
 	ALIGN(shminfo.shmmni * sizeof(struct shmid_ds)));
 
 	if (shminfo.shmmax == 0)
-		shminfo.shmmax = max(physmem / 4, 1024) * PAGE_SIZE;
+		shminfo.shmall = max(physmem / 4, 1024);
 	else
-		shminfo.shmmax *= PAGE_SIZE;
-	shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
+		shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
+	shminfo.shmmax = (uint64_t)shminfo.shmall * PAGE_SIZE;
 
 	for (i = 0; i < shminfo.shmmni; i++) {
 		cv_init(_cv[i], "shmwait");
@@ -1129,7 +1129,7 @@ sysctl_ipc_shmmax(SYSCTLFN_ARGS)
 		return EINVAL;
 
 	shminfo.shmmax = round_page(newsize);
-	shminfo.shmall = shminfo.shmmax >> PAGE_SHIFT;
+	shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
 
 	return 0;
 }



CVS commit: [netbsd-8] src/sys/netinet6

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 19:13:09 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-8]: in6.c

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

sys/netinet6/in6.c: revision 1.292

netinet6: Avoid NPD on `ifconfig ifN inet6 ... pltime 0 vltime 0'.
PR kern/53922


To generate a diff of this commit:
cvs rdiff -u -r1.245.2.14 -r1.245.2.15 src/sys/netinet6/in6.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.245.2.14 src/sys/netinet6/in6.c:1.245.2.15
--- src/sys/netinet6/in6.c:1.245.2.14	Fri Aug  4 14:38:09 2023
+++ src/sys/netinet6/in6.c	Sun Mar 10 19:13:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.245.2.14 2023/08/04 14:38:09 martin Exp $	*/
+/*	$NetBSD: in6.c,v 1.245.2.15 2024/03/10 19:13:09 martin Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.14 2023/08/04 14:38:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.15 2024/03/10 19:13:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -708,7 +708,14 @@ in6_control1(struct socket *so, u_long c
 		int s = splsoftnet();
 		error = in6_update_ifa1(ifp, ifra, , , 0);
 		splx(s);
-		if (error)
+		/*
+		 * in6_update_ifa1 doesn't create the address if its
+		 * valid lifetime (vltime) is zero, since we would just
+		 * delete the address immediately in that case anyway.
+		 * So it may succeed but return null ia.  In that case,
+		 * nothing left to do.
+		 */
+		if (error || ia == NULL)
 			break;
 		pfil_run_addrhooks(if_pfil, cmd, >ia_ifa);
 		break;



CVS commit: [netbsd-8] src/sys/netinet6

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 19:13:09 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-8]: in6.c

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

sys/netinet6/in6.c: revision 1.292

netinet6: Avoid NPD on `ifconfig ifN inet6 ... pltime 0 vltime 0'.
PR kern/53922


To generate a diff of this commit:
cvs rdiff -u -r1.245.2.14 -r1.245.2.15 src/sys/netinet6/in6.c

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



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

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 19:00:27 UTC 2024

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

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

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965


To generate a diff of this commit:
cvs rdiff -u -r1.53.2.6 -r1.53.2.7 src/sys/dev/usb/if_urtwn.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/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.53.2.6 src/sys/dev/usb/if_urtwn.c:1.53.2.7
--- src/sys/dev/usb/if_urtwn.c:1.53.2.6	Sat Dec 14 12:33:47 2019
+++ src/sys/dev/usb/if_urtwn.c	Sun Mar 10 19:00:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.53.2.6 2019/12/14 12:33:47 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.53.2.7 2024/03/10 19:00:27 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.53.2.6 2019/12/14 12:33:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.53.2.7 2024/03/10 19:00:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -808,6 +808,24 @@ urtwn_free_tx_list(struct urtwn_softc *s
 }
 
 static void
+urtwn_cmdq_invariants(struct urtwn_softc *sc)
+{
+	struct urtwn_host_cmd_ring *const ring __diagused = >cmdq;
+
+	KASSERT(mutex_owned(>sc_task_mtx));
+	KASSERTMSG((ring->cur >= 0 && ring->cur < URTWN_HOST_CMD_RING_COUNT),
+	"%s: cur=%d next=%d queued=%d",
+	device_xname(sc->sc_dev), ring->cur, ring->next, ring->queued);
+	KASSERTMSG((ring->next >= 0 && ring->next < URTWN_HOST_CMD_RING_COUNT),
+	"%s: cur=%d next=%d queued=%d",
+	device_xname(sc->sc_dev), ring->cur, ring->next, ring->queued);
+	KASSERTMSG((ring->queued >= 0 &&
+		ring->queued <= URTWN_HOST_CMD_RING_COUNT),
+	"%s: %d commands queued",
+	device_xname(sc->sc_dev), ring->queued);
+}
+
+static void
 urtwn_task(void *arg)
 {
 	struct urtwn_softc *sc = arg;
@@ -820,7 +838,11 @@ urtwn_task(void *arg)
 	/* Process host commands. */
 	s = splusb();
 	mutex_spin_enter(>sc_task_mtx);
+	urtwn_cmdq_invariants(sc);
 	while (ring->next != ring->cur) {
+		KASSERTMSG(ring->queued > 0, "%s: cur=%d next=%d queued=%d",
+		device_xname(sc->sc_dev),
+		ring->cur, ring->next, ring->queued);
 		cmd = >cmd[ring->next];
 		mutex_spin_exit(>sc_task_mtx);
 		splx(s);
@@ -828,6 +850,10 @@ urtwn_task(void *arg)
 		cmd->cb(sc, cmd->data);
 		s = splusb();
 		mutex_spin_enter(>sc_task_mtx);
+		urtwn_cmdq_invariants(sc);
+		KASSERTMSG(ring->queued > 0, "%s: cur=%d next=%d queued=%d",
+		device_xname(sc->sc_dev),
+		ring->cur, ring->next, ring->queued);
 		ring->queued--;
 		ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
 	}
@@ -842,6 +868,7 @@ urtwn_do_async(struct urtwn_softc *sc, v
 {
 	struct urtwn_host_cmd_ring *ring = >cmdq;
 	struct urtwn_host_cmd *cmd;
+	bool schedtask = false;
 	int s;
 
 	DPRINTFN(DBG_FN, ("%s: %s: cb=%p, arg=%p, len=%d\n",
@@ -849,19 +876,27 @@ urtwn_do_async(struct urtwn_softc *sc, v
 
 	s = splusb();
 	mutex_spin_enter(>sc_task_mtx);
+	urtwn_cmdq_invariants(sc);
 	cmd = >cmd[ring->cur];
 	cmd->cb = cb;
 	KASSERT(len <= sizeof(cmd->data));
 	memcpy(cmd->data, arg, len);
 	ring->cur = (ring->cur + 1) % URTWN_HOST_CMD_RING_COUNT;
 
-	/* If there is no pending command already, schedule a task. */
-	if (!sc->sc_dying && ++ring->queued == 1) {
-		mutex_spin_exit(>sc_task_mtx);
-		usb_add_task(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
-	} else
-		mutex_spin_exit(>sc_task_mtx);
+	/*
+	 * Schedule a task to process the command if need be.
+	 */
+	if (!sc->sc_dying) {
+		if (ring->queued == URTWN_HOST_CMD_RING_COUNT)
+			device_printf(sc->sc_dev, "command queue overflow\n");
+		else if (ring->queued++ == 0)
+			schedtask = true;
+	}
+	mutex_spin_exit(>sc_task_mtx);
 	splx(s);
+
+	if (schedtask)
+		usb_add_task(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
 }
 
 static void



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

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 19:00:27 UTC 2024

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

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

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965


To generate a diff of this commit:
cvs rdiff -u -r1.53.2.6 -r1.53.2.7 src/sys/dev/usb/if_urtwn.c

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



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

2024-02-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 29 10:46:28 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmreg.h

Log Message:
Pull up the following, requested by msaitoh in ticket #1938:

sys/dev/pci/if_wm.c 1.792,1.794-1.798 via patch
sys/dev/pci/if_wmreg.h  1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue system.
- Improve dmesg output.
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).
- Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.54 -r1.508.4.55 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.18 -r1.98.6.19 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.



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

2024-02-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 29 10:46:28 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmreg.h

Log Message:
Pull up the following, requested by msaitoh in ticket #1938:

sys/dev/pci/if_wm.c 1.792,1.794-1.798 via patch
sys/dev/pci/if_wmreg.h  1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue system.
- Improve dmesg output.
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).
- Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.54 -r1.508.4.55 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.18 -r1.98.6.19 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.508.4.54 src/sys/dev/pci/if_wm.c:1.508.4.55
--- src/sys/dev/pci/if_wm.c:1.508.4.54	Sat Feb  3 12:04:06 2024
+++ src/sys/dev/pci/if_wm.c	Thu Feb 29 10:46:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.54 2024/02/03 12:04:06 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.55 2024/02/29 10:46:27 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.508.4.54 2024/02/03 12:04:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.55 2024/02/29 10:46:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -469,9 +469,9 @@ struct wm_rxqueue {
 	/* RX event counters */
 	WM_Q_EVCNT_DEFINE(rxq, intr);	/* Interrupts */
 	WM_Q_EVCNT_DEFINE(rxq, defer);	/* Rx deferred processing */
-
 	WM_Q_EVCNT_DEFINE(rxq, ipsum);	/* IP checksums checked */
 	WM_Q_EVCNT_DEFINE(rxq, tusum);	/* TCP/UDP cksums checked */
+	WM_Q_EVCNT_DEFINE(rxq, qdrop);	/* Rx queue drop packet */
 #endif
 };
 
@@ -2693,6 +2693,10 @@ alloc_retry:
 	/* Reset the chip to a known state. */
 	wm_reset(sc);
 
+	/* sc->sc_pba is set in wm_reset(). */
+	aprint_verbose_dev(sc->sc_dev, "RX packet buffer size: %uKB\n",
+	sc->sc_pba);
+
 	/*
 	 * Check for I21[01] PLL workaround.
 	 *
@@ -6526,6 +6530,7 @@ wm_update_stats(struct wm_softc *sc)
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	uint64_t crcerrs, algnerrc, symerrc, mpc, colc,  sec, rlec, rxerrc,
 	cexterr;
+	uint64_t total_qdrop = 0;
 
 	crcerrs = CSR_READ(sc, WMREG_CRCERRS);
 	symerrc = CSR_READ(sc, WMREG_SYMERRC);
@@ -6674,6 +6679,22 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(>sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(>sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(>sc_ev_hrmpc, CSR_READ(sc, WMREG_HRMPC));
+#ifdef WM_EVENT_COUNTERS
+		for (int i = 0; i < sc->sc_nqueues; i++) {
+			struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
+			uint32_t rqdpc;
+
+			rqdpc = CSR_READ(sc, WMREG_RQDPC(i));
+			/*
+			 * On I210 and newer device, the RQDPC register is not
+			 * cleard on read.
+			 */
+			if ((rqdpc != 0) && (sc->sc_type >= WM_T_I210))
+CSR_WRITE(sc, WMREG_RQDPC(i), 0);
+			WM_Q_EVCNT_ADD(rxq, qdrop, rqdpc);
+			total_qdrop += rqdpc;
+		}
+#endif
 	}
 	if ((sc->sc_type >= WM_T_I350) && !WM_IS_ICHPCH(sc)) {
 		WM_EVCNT_ADD(>sc_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));
@@ -6702,7 +6723,7 @@ wm_update_stats(struct wm_softc *sc)
 	 * If you want to know the nubmer of WMREG_RMBC, you should use such as
 	 * own EVCNT instead of if_iqdrops.
 	 */
-	ifp->if_iqdrops += mpc;
+	ifp->if_iqdrops += mpc + total_qdrop;
 }
 
 void
@@ -6719,6 +6740,8 @@ wm_clear_evcnt(struct wm_softc *sc)
 		WM_Q_EVCNT_STORE(rxq, defer, 0);
 		WM_Q_EVCNT_STORE(rxq, ipsum, 0);
 		WM_Q_EVCNT_STORE(rxq, tusum, 0);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_STORE(rxq, qdrop, 0);
 	}
 
 	/* TX queues */
@@ -8052,9 +8075,10 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 
 		WM_Q_INTR_EVCNT_ATTACH(rxq, intr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, defer, rxq, i, xname);
-
 		WM_Q_MISC_EVCNT_ATTACH(rxq, ipsum, rxq, i, xname);
 		WM_Q_MISC_EVCNT_ATTACH(rxq, tusum, rxq, i, xname);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_MISC_EVCNT_ATTACH(rxq, qdrop, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;
@@ -8117,6 +8141,8 @@ wm_free_txrx_queues(struct wm_softc *sc)
 		WM_Q_EVCNT_DETACH(rxq, defer, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, ipsum, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, tusum, rxq, i);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_DETACH(rxq, qdrop, rxq, i);
 #endif /* WM_EVENT_COUNTERS */
 
 		wm_free_rx_buffer(sc, rxq);
@@ -8306,6 +8332,8 @@ wm_init_rx_regs(struct wm_softc *sc, str
 		rxq->rxq_descsize * rxq->rxq_ndesc);
 
 		if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
+			uint32_t srrctl;
+
 			if (MCLBYTES & ((1 << SRRCTL_BSIZEPKT_SHIFT) - 1))
 panic("%s: MCLBYTES %d unsupported for 

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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 14:27:05 UTC 2024

Modified Files:
src/sys/dev/hdaudio [netbsd-8]: hdafg.c

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

sys/dev/hdaudio/hdafg.c: revision 1.29

ignore NULL for hdaudio_audiodev in hdafg_freem

also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/dev/hdaudio/hdafg.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/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.12.2.2 src/sys/dev/hdaudio/hdafg.c:1.12.2.3
--- src/sys/dev/hdaudio/hdafg.c:1.12.2.2	Tue Oct  9 10:09:51 2018
+++ src/sys/dev/hdaudio/hdafg.c	Sat Feb  3 14:27:05 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.12.2.2 2018/10/09 10:09:51 martin Exp $ */
+/* $NetBSD: hdafg.c,v 1.12.2.3 2024/02/03 14:27:05 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.12.2.2 2018/10/09 10:09:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.12.2.3 2024/02/03 14:27:05 martin Exp $");
 
 #include 
 #include 
@@ -4224,9 +4224,12 @@ hdafg_freem(void *opaque, void *addr, si
 	struct hdaudio_audiodev *ad = opaque;
 	struct hdaudio_stream *st;
 
-	if (addr == DMA_KERNADDR(>ad_playback->st_data))
+	if (ad == NULL)
+		return;
+
+	if (ad->ad_playback != NULL && addr == DMA_KERNADDR(>ad_playback->st_data))
 		st = ad->ad_playback;
-	else if (addr == DMA_KERNADDR(>ad_capture->st_data))
+	else if (ad->ad_capture != NULL && addr == DMA_KERNADDR(>ad_capture->st_data))
 		st = ad->ad_capture;
 	else
 		return;



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 14:27:05 UTC 2024

Modified Files:
src/sys/dev/hdaudio [netbsd-8]: hdafg.c

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

sys/dev/hdaudio/hdafg.c: revision 1.29

ignore NULL for hdaudio_audiodev in hdafg_freem

also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/dev/hdaudio/hdafg.c

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



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:17:03 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

Log Message:
Pull up the following, requested by msaitoh in ticket #1933:

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.345-1.346,1.349 via 
patch
sys/dev/pci/ixgbe/ixgbe.h   1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h  1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
  - Move assignment of TXD.
  - ixv(4): Remove unused IFF_OACTIVE.
  - Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
  - The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
  - Use #ifdef LRO more to reduce the size of struct rx_ring.
  - Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
  - Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
  - Remove unused.
  - Modify for the readability.
  - Modify comment.
  - Fix comment. Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.30 -r1.24.2.31 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.58 -r1.88.2.59 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.29 -r1.24.6.30 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.21 -r1.22.2.22 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.43 -r1.56.2.44 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.30 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.31
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.30	Wed Oct 18 14:23:15 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Feb  3 12:17:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.31 2024/02/03 12:17:03 martin Exp $ */
 
 /**
 
@@ -64,13 +64,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.31 2024/02/03 12:17:03 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include "ixgbe.h"
 
+#ifdef RSC
 /*
  * HW RSC control:
  *  this feature only works with
@@ -84,7 +85,9 @@ __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 
  *  to enable.
  */
 static bool ixgbe_rsc_enable = FALSE;
+#endif
 
+#ifdef IXGBE_FDIR
 /*
  * For Flow Director: this is the
  * number of TX packets we sample
@@ -95,6 +98,7 @@ static bool ixgbe_rsc_enable = FALSE;
  * setting this to 0.
  */
 static int atr_sample_rate = 20;
+#endif
 
 #define IXGBE_M_ADJ(sc, rxr, mp)	\
 	if (sc->max_frame_size <= (rxr->mbuf_sz - ETHER_ALIGN))	\
@@ -122,8 +126,9 @@ static __inline void ixgbe_rx_input(stru
 static int   ixgbe_dma_malloc(struct ixgbe_softc *, bus_size_t,
   struct ixgbe_dma_alloc *, int);
 static void  ixgbe_dma_free(struct ixgbe_softc *, struct ixgbe_dma_alloc *);
-
-static void	ixgbe_setup_hw_rsc(struct rx_ring *);
+#ifdef RSC
+static void	 ixgbe_setup_hw_rsc(struct rx_ring *);
+#endif
 
 /
  * ixgbe_legacy_start_locked - Transmit entry point
@@ -406,7 +411,7 @@ ixgbe_drain_all(struct ixgbe_softc *sc)
 static int
 ixgbe_xmit(struct tx_ring *txr, struct mbuf *m_head)
 {
-	struct ixgbe_softc  *sc = txr->sc;
+	struct ixgbe_softc  *sc = txr->sc;
 	struct ixgbe_tx_buf *txbuf;
 	union ixgbe_adv_tx_desc *txd = NULL;
 	struct ifnet	*ifp = sc->ifp;
@@ -487,8 +492,8 @@ retry:
 	}
 
 	/*
-	 * Set up the appropriate offload context
-	 * this will consume the first descriptor
+	 * Set up the appropriate offload context if requested,
+	 * this may consume one TX descriptor.
 	 */
 	error = ixgbe_tx_ctx_setup(txr, m_head, _type_len, _status);
 	if (__predict_false(error)) {
@@ -625,14 +630,8 @@ ixgbe_allocate_transmit_buffers(struct t
 		goto fail;
 	}
 
-	txr->tx_buffers =
-	(struct ixgbe_tx_buf *) malloc(sizeof(struct ixgbe_tx_buf) *
-	sc->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (txr->tx_buffers == NULL) {
-		aprint_error_dev(dev, "Unable 

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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:17:03 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

Log Message:
Pull up the following, requested by msaitoh in ticket #1933:

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.345-1.346,1.349 via 
patch
sys/dev/pci/ixgbe/ixgbe.h   1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h  1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
  - Move assignment of TXD.
  - ixv(4): Remove unused IFF_OACTIVE.
  - Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
  - The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
  - Use #ifdef LRO more to reduce the size of struct rx_ring.
  - Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
  - Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
  - Remove unused.
  - Modify for the readability.
  - Modify comment.
  - Fix comment. Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.30 -r1.24.2.31 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.58 -r1.88.2.59 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.29 -r1.24.6.30 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.21 -r1.22.2.22 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.43 -r1.56.2.44 src/sys/dev/pci/ixgbe/ixv.c

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



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:04:07 UTC 2024

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

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

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

Add Intel I219-{LM,V}(20,21) support.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.53 -r1.508.4.54 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.508.4.53 src/sys/dev/pci/if_wm.c:1.508.4.54
--- src/sys/dev/pci/if_wm.c:1.508.4.53	Wed Oct 18 14:41:54 2023
+++ src/sys/dev/pci/if_wm.c	Sat Feb  3 12:04:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.53 2023/10/18 14:41:54 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.54 2024/02/03 12:04:06 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.508.4.53 2023/10/18 14:41:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.54 2024/02/03 12:04:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1732,6 +1732,12 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM19,
 	  "I219 LM (19) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM20,
+	  "I219 LM (20) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM21,
+	  "I219 LM (21) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM22,
 	  "I219 LM (22) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
@@ -1792,6 +1798,12 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V19,
 	  "I219 V (19) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V20,
+	  "I219 V (20) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V21,
+	  "I219 V (21) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V22,
 	  "I219 V (22) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:04:07 UTC 2024

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

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

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

Add Intel I219-{LM,V}(20,21) support.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.53 -r1.508.4.54 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.



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:32:33 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (ticket #1931)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.30 -r1.1281.2.31 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.30 -r1.1280.2.31 src/sys/dev/pci/pcidevs_data.h

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



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:32:33 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (ticket #1931)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.30 -r1.1281.2.31 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.30 -r1.1280.2.31 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:30:32 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1477
sys/dev/pci/pcidevs: revision 1.1494
sys/dev/pci/pcidevs: revision 1.1498
sys/dev/pci/pcidevs: revision 1.1499
sys/dev/pci/pcidevs: revision 1.1500
sys/dev/pci/pcidevs: revision 1.1501
sys/dev/pci/pcidevs: revision 1.1502

Add ID for the EXAR XR17V354 PCIe UART.
>From Hakan Engvall.
PR kern/57202

pcidevs: Add missing I225/I226 series devices

pcidevs: Add Mellanox ConnectX-6 Lx.

add some newer Areca boards in prep for updating driver

Add Intel C26[26] eSPI.

Update Intel Raptor Lake devices.

Add Intel I219-{LM,V}(20,21)


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.30 -r1.1289.2.31 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.30 src/sys/dev/pci/pcidevs:1.1289.2.31
--- src/sys/dev/pci/pcidevs:1.1289.2.30	Wed Oct 18 14:41:55 2023
+++ src/sys/dev/pci/pcidevs	Sat Feb  3 11:30:32 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.30 2023/10/18 14:41:55 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.31 2024/02/03 11:30:32 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1488,6 +1488,7 @@ product ARECA ARC1170		0x1170	ARC-1170
 product ARECA ARC1200		0x1200	ARC-1200
 product ARECA ARC1200_B		0x1201	ARC-1200 rev B
 product ARECA ARC1202		0x1202	ARC-1202
+product ARECA ARC1203		0x1203	ARC-1203
 product ARECA ARC1210		0x1210	ARC-1210
 product ARECA ARC1214 		0x1214	ARC-1214
 product ARECA ARC1220		0x1220	ARC-1220
@@ -1500,6 +1501,8 @@ product ARECA ARC1381		0x1381	ARC-1381
 product ARECA ARC1680		0x1680	ARC-1680
 product ARECA ARC1681		0x1681	ARC-1681
 product ARECA ARC1880 		0x1880	ARC-1880
+product ARECA ARC1884 		0x1884	ARC-1884
+product ARECA ARC1886 		0x1886	ARC-1886
 
 /* ASIX Electronics products */
 product ASIX AX88140A	0x1400	AX88140A 10/100 Ethernet
@@ -3225,6 +3228,7 @@ product ES FREEDOM	0x0001	Freedom PCI-GB
 product EXAR XR17D152	0x0152	dual-channel Universal PCI UART
 product EXAR XR17D154	0x0154	quad-channel Universal PCI UART
 product EXAR XR17D158	0x0158	octal-channel Universal PCI UART
+product EXAR XR17V354	0x0354	quad-channel Universal PCIe UART
 
 /* FORE products */
 product FORE PCA200	0x0210	ATM PCA-200
@@ -3932,6 +3936,7 @@ product INTEL I219_LM11		0x0d4c	I219-LM 
 product INTEL I219_V11		0x0d4d	I219-V (11) Ethernet Connection
 product INTEL I219_LM10		0x0d4e	I219-LM (10) Ethernet Connection
 product INTEL I219_V10		0x0d4f	I219-V (10) Ethernet Connection
+product INTEL I225_IT		0x0d9f	I225-IT Ethernet Connection
 product INTEL I219_LM12		0x0d53	I219-LM (12) Ethernet Connection
 product INTEL I219_V12		0x0d55	I219-V (12) Ethernet Connection
 product INTEL I219_LM23		0x0dc5	I219-LM (23) Ethernet Connection
@@ -4252,6 +4257,8 @@ product INTEL 82439HX		0x1250	82439HX (T
 product INTEL I226_LM		0x125b	I226-LM Ethernet
 product INTEL I226_V		0x125c	I226-V Ethernet
 product INTEL I226_IT		0x125d	I226-IT Ethernet
+product INTEL I221_V		0x125e	I221-V Ethernet Connection
+product INTEL I226_BLANK_NVM	0x125f	I226 Ethernet Connection (blankNVM)
 product INTEL C3K_X553_10G	0x1306	C3000 X553 10G Ethernet
 product INTEL C3K_X553_1G	0x1307	C3000 X553 1G Ethernet
 product INTEL 82870P2_PPB	0x1460	82870P2 P64H2 PCI-PCI Bridge
@@ -4378,9 +4385,12 @@ product INTEL C3K_X553_SGMII	0x15e4	C300
 product INTEL C3K_X553_SGMII_L	0x15e5	C3000 X553 1GbE SGMII (non-10G SKU)
 product INTEL I225_LM		0x15f2	I225 LM Ethernet
 product INTEL I225_V		0x15f3	I225 V Ethernet
+product INTEL I220_V		0x15f7	I220-V Ethernet Connection
+product INTEL I225_BLANK_NVM	0x15fd	I225 Ethernet Connection (blankNVM)
 product INTEL I219_LM15		0x15f4	I219-LM (15) Ethernet Connection
 product INTEL I219_V15		0x15f5	I219-V (15) Ethernet Connection
 product INTEL I210_SGMII_WOF	0x15f6	I210 Ethernet (SGMII)
+product INTEL I225_I		0x15f8	I225-I Ethernet Connection
 product INTEL I219_LM14		0x15f9	I219-LM (14) Ethernet Connection
 product INTEL I219_V14		0x15fa	I219-V (14) Ethernet Connection
 product INTEL I219_LM13		0x15fb	I219-LM (13) Ethernet Connection
@@ -5413,6 +5423,9 @@ product INTEL XE5_V3_BRA4	0x2ffb  Xeon E
 product INTEL XE5_V3_SADBR1	0x2ffc  Xeon E7 v3/Xeon E5 v3/Core i7 System Address Decoder & Broadcast Registers
 product INTEL XE5_V3_SADBR2	0x2ffd  Xeon E7 v3/Xeon E5 v3/Core i7 System Address Decoder & Broadcast Registers
 product INTEL XE5_V3_SADBR3	0x2ffe  Xeon E7 v3/Xeon E5 v3/Core i7 System Address Decoder & Broadcast Registers
+product INTEL I225_K		0x3100	I225-K Ethernet Connection
+product INTEL I225_K2		0x3101	I225-K2 Ethernet Connection
+product INTEL I226_K		0x3102	I226-K Ethernet 

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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:30:32 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1477
sys/dev/pci/pcidevs: revision 1.1494
sys/dev/pci/pcidevs: revision 1.1498
sys/dev/pci/pcidevs: revision 1.1499
sys/dev/pci/pcidevs: revision 1.1500
sys/dev/pci/pcidevs: revision 1.1501
sys/dev/pci/pcidevs: revision 1.1502

Add ID for the EXAR XR17V354 PCIe UART.
>From Hakan Engvall.
PR kern/57202

pcidevs: Add missing I225/I226 series devices

pcidevs: Add Mellanox ConnectX-6 Lx.

add some newer Areca boards in prep for updating driver

Add Intel C26[26] eSPI.

Update Intel Raptor Lake devices.

Add Intel I219-{LM,V}(20,21)


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.30 -r1.1289.2.31 src/sys/dev/pci/pcidevs

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



CVS commit: [netbsd-8] src/sys/conf

2024-01-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  1 11:39:25 UTC 2024

Modified Files:
src/sys/conf [netbsd-8]: copyright

Log Message:
Pull up following revision(s) (requested by hgutch in ticket #1929):

sys/conf/copyright: revision 1.22

Update copyright notice for 2024.


To generate a diff of this commit:
cvs rdiff -u -r1.15.8.5 -r1.15.8.6 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.15.8.5 src/sys/conf/copyright:1.15.8.6
--- src/sys/conf/copyright:1.15.8.5	Tue Jan  3 16:41:52 2023
+++ src/sys/conf/copyright	Mon Jan  1 11:39:25 2024
@@ -1,6 +1,6 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
-2018, 2019, 2020, 2021, 2022, 2023
+2018, 2019, 2020, 2021, 2022, 2023, 2024
 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-8] src/sys/conf

2024-01-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  1 11:39:25 UTC 2024

Modified Files:
src/sys/conf [netbsd-8]: copyright

Log Message:
Pull up following revision(s) (requested by hgutch in ticket #1929):

sys/conf/copyright: revision 1.22

Update copyright notice for 2024.


To generate a diff of this commit:
cvs rdiff -u -r1.15.8.5 -r1.15.8.6 src/sys/conf/copyright

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



CVS commit: [netbsd-8] src/sys/nfs

2023-12-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 12 16:48:59 UTC 2023

Modified Files:
src/sys/nfs [netbsd-8]: nfs_vnops.c

Log Message:
Pull up following revision(s) (requested by schmonz in ticket #1927):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.310.4.1 src/sys/nfs/nfs_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/sys/nfs/nfs_vnops.c
diff -u src/sys/nfs/nfs_vnops.c:1.310 src/sys/nfs/nfs_vnops.c:1.310.4.1
--- src/sys/nfs/nfs_vnops.c:1.310	Wed Apr 26 03:02:49 2017
+++ src/sys/nfs/nfs_vnops.c	Tue Dec 12 16:48:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_vnops.c,v 1.310 2017/04/26 03:02:49 riastradh Exp $	*/
+/*	$NetBSD: nfs_vnops.c,v 1.310.4.1 2023/12/12 16:48:59 martin Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.310 2017/04/26 03:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.310.4.1 2023/12/12 16:48:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -2466,8 +2466,13 @@ nfs_readdirrpc(struct vnode *vp, struct 
 txdr_cookie3(uiop->uio_offset, tl);
 			}
 			tl += 2;
-			*tl++ = dnp->n_cookieverf.nfsuquad[0];
-			*tl++ = dnp->n_cookieverf.nfsuquad[1];
+			if (uiop->uio_offset == 0) {
+*tl++ = 0;
+*tl++ = 0;
+			} else {
+*tl++ = dnp->n_cookieverf.nfsuquad[0];
+*tl++ = dnp->n_cookieverf.nfsuquad[1];
+			}
 		} else
 #endif
 		{
@@ -2676,8 +2681,13 @@ nfs_readdirplusrpc(struct vnode *vp, str
 			txdr_cookie3(uiop->uio_offset, tl);
 		}
 		tl += 2;
-		*tl++ = dnp->n_cookieverf.nfsuquad[0];
-		*tl++ = dnp->n_cookieverf.nfsuquad[1];
+		if (uiop->uio_offset == 0) {
+			*tl++ = 0;
+			*tl++ = 0;
+		} else {
+			*tl++ = dnp->n_cookieverf.nfsuquad[0];
+			*tl++ = dnp->n_cookieverf.nfsuquad[1];
+		}
 		*tl++ = txdr_unsigned(nmp->nm_readdirsize);
 		*tl = txdr_unsigned(nmp->nm_rsize);
 		nfsm_request(dnp, NFSPROC_READDIRPLUS, curlwp, cred);



CVS commit: [netbsd-8] src/sys/nfs

2023-12-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 12 16:48:59 UTC 2023

Modified Files:
src/sys/nfs [netbsd-8]: nfs_vnops.c

Log Message:
Pull up following revision(s) (requested by schmonz in ticket #1927):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.310.4.1 src/sys/nfs/nfs_vnops.c

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



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

2023-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 29 12:29:06 UTC 2023

Modified Files:
src/sys/kern [netbsd-8]: exec_subr.c

Log Message:
Additionally pull up the following for ticket #1920:

sys/kern/exec_subr.c1.87

Fix build for kernels w/o PAX_MPROTECT.


To generate a diff of this commit:
cvs rdiff -u -r1.78.2.4 -r1.78.2.5 src/sys/kern/exec_subr.c

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

Modified files:

Index: src/sys/kern/exec_subr.c
diff -u src/sys/kern/exec_subr.c:1.78.2.4 src/sys/kern/exec_subr.c:1.78.2.5
--- src/sys/kern/exec_subr.c:1.78.2.4	Tue Nov 28 13:00:52 2023
+++ src/sys/kern/exec_subr.c	Wed Nov 29 12:29:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_subr.c,v 1.78.2.4 2023/11/28 13:00:52 martin Exp $	*/
+/*	$NetBSD: exec_subr.c,v 1.78.2.5 2023/11/29 12:29:05 martin Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.78.2.4 2023/11/28 13:00:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.78.2.5 2023/11/29 12:29:05 martin Exp $");
 
 #include "opt_pax.h"
 
@@ -162,7 +162,7 @@ static int
 vmcmd_get_prot(struct lwp *l, const struct exec_vmcmd *cmd, vm_prot_t *prot,
 vm_prot_t *maxprot)
 {
-	vm_prot_t extraprot = PROT_MPROTECT_EXTRACT(cmd->ev_prot);
+	vm_prot_t extraprot __unused = PROT_MPROTECT_EXTRACT(cmd->ev_prot);
 
 	*prot = cmd->ev_prot & UVM_PROT_ALL;
 	*maxprot = PAX_MPROTECT_MAXPROTECT(l, *prot, extraprot, UVM_PROT_ALL);



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

2023-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 29 12:29:06 UTC 2023

Modified Files:
src/sys/kern [netbsd-8]: exec_subr.c

Log Message:
Additionally pull up the following for ticket #1920:

sys/kern/exec_subr.c1.87

Fix build for kernels w/o PAX_MPROTECT.


To generate a diff of this commit:
cvs rdiff -u -r1.78.2.4 -r1.78.2.5 src/sys/kern/exec_subr.c

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



CVS commit: [netbsd-8] src/sys/ufs/ffs

2023-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 28 13:13:29 UTC 2023

Modified Files:
src/sys/ufs/ffs [netbsd-8]: ffs_vfsops.c

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

sys/ufs/ffs/ffs_vfsops.c: revision 1.382

ffs_sync: Avoid unlocked access to v_numoutput/v_dirtyblkhd.

Found by lockdoc.

PR kern/57606


To generate a diff of this commit:
cvs rdiff -u -r1.353.4.2 -r1.353.4.3 src/sys/ufs/ffs/ffs_vfsops.c

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



CVS commit: [netbsd-8] src/sys/ufs/ffs

2023-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 28 13:13:29 UTC 2023

Modified Files:
src/sys/ufs/ffs [netbsd-8]: ffs_vfsops.c

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

sys/ufs/ffs/ffs_vfsops.c: revision 1.382

ffs_sync: Avoid unlocked access to v_numoutput/v_dirtyblkhd.

Found by lockdoc.

PR kern/57606


To generate a diff of this commit:
cvs rdiff -u -r1.353.4.2 -r1.353.4.3 src/sys/ufs/ffs/ffs_vfsops.c

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

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.353.4.2 src/sys/ufs/ffs/ffs_vfsops.c:1.353.4.3
--- src/sys/ufs/ffs/ffs_vfsops.c:1.353.4.2	Wed Apr 11 14:49:08 2018
+++ src/sys/ufs/ffs/ffs_vfsops.c	Tue Nov 28 13:13:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.353.4.2 2018/04/11 14:49:08 martin Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.353.4.3 2023/11/28 13:13:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.353.4.2 2018/04/11 14:49:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.353.4.3 2023/11/28 13:13:29 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1926,14 +1926,25 @@ ffs_sync(struct mount *mp, int waitfor, 
 	/*
 	 * Force stale file system control information to be flushed.
 	 */
-	if (waitfor != MNT_LAZY && (ump->um_devvp->v_numoutput > 0 ||
-	!LIST_EMPTY(>um_devvp->v_dirtyblkhd))) {
-		vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
-		if ((error = VOP_FSYNC(ump->um_devvp, cred,
-		(waitfor == MNT_WAIT ? FSYNC_WAIT : 0) | FSYNC_NOLOG,
-		0, 0)) != 0)
-			allerror = error;
-		VOP_UNLOCK(ump->um_devvp);
+	if (waitfor != MNT_LAZY)  {
+		bool need_devvp_fsync;
+
+		mutex_enter(ump->um_devvp->v_interlock);
+		need_devvp_fsync = (ump->um_devvp->v_numoutput > 0 ||
+		!LIST_EMPTY(>um_devvp->v_dirtyblkhd));
+		mutex_exit(ump->um_devvp->v_interlock);
+		if (need_devvp_fsync) {
+			int flags = FSYNC_NOLOG;
+
+			if (waitfor == MNT_WAIT)
+flags |= FSYNC_WAIT;
+
+			vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
+			if ((error = VOP_FSYNC(ump->um_devvp, cred, flags, 0,
+0)) != 0)
+allerror = error;
+			VOP_UNLOCK(ump->um_devvp);
+		}
 	}
 #if defined(QUOTA) || defined(QUOTA2)
 	qsync(mp);



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

2023-10-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 26 15:13:38 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: mpii.c

Log Message:
Pull up following revision(s) (requested by buhrow in ticket #1916):

sys/dev/pci/mpii.c: revision 1.30

Fixes for PR kern/57133:

I can now explain why this assert is firing and have a fix for it.  It is a  
regression introduced in R1.22 of mpii.c.

If a request comes in and the IOC returns a 
MPII_SCSIIO_STATUS_CHECK_COND condition, after
 a successful transfer, or one that is a recovered error,
 mpii(4) correctly sets the xs->error to XS_SENSE, but incorrectly sets 
xs->resid to 0 before
 returning the xfer to the upper scsi layers.  Once the upper layers get it, 
they notice the
 XS_SENSE check condition and because it's a retryable error, they increment 
xs_requeuecnt, set
 ERESTART and send the xfer request down to the mpii(4) layer again for a 
retry. What they do
 not do is reset xs->resid equal to xs->datalen.  When the xfer comes down to 
mpii(4) again, the
 assert happens.  The fix is for the mpii(4) driver to leave xs->resid alone 
when it encounters
 a MPII_SCSIIO_STATUS_CHECK_COND condition.

This bug affects NetBSD-10, netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.7 -r1.8.10.8 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.8.10.7 src/sys/dev/pci/mpii.c:1.8.10.8
--- src/sys/dev/pci/mpii.c:1.8.10.7	Thu Sep 29 14:38:24 2022
+++ src/sys/dev/pci/mpii.c	Thu Oct 26 15:13:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.7 2022/09/29 14:38:24 snj Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.8 2023/10/26 15:13:38 martin Exp $ */
 /*	OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.7 2022/09/29 14:38:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.8 2023/10/26 15:13:38 martin Exp $");
 
 #include "bio.h"
 
@@ -3225,7 +3225,6 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 	}
 	
 	KASSERT(xs->error == XS_NOERROR);
-	KASSERT(xs->resid == xs->datalen);
 	KASSERT(xs->status == SCSI_OK);
 	
 	if (ccb->ccb_rcb == NULL) {
@@ -3284,7 +3283,6 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 			break;
 
 		case MPII_SCSIIO_STATUS_CHECK_COND:
-			xs->resid = 0;
 			xs->error = XS_SENSE;
 			break;
 



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

2023-10-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 26 15:13:38 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: mpii.c

Log Message:
Pull up following revision(s) (requested by buhrow in ticket #1916):

sys/dev/pci/mpii.c: revision 1.30

Fixes for PR kern/57133:

I can now explain why this assert is firing and have a fix for it.  It is a  
regression introduced in R1.22 of mpii.c.

If a request comes in and the IOC returns a 
MPII_SCSIIO_STATUS_CHECK_COND condition, after
 a successful transfer, or one that is a recovered error,
 mpii(4) correctly sets the xs->error to XS_SENSE, but incorrectly sets 
xs->resid to 0 before
 returning the xfer to the upper scsi layers.  Once the upper layers get it, 
they notice the
 XS_SENSE check condition and because it's a retryable error, they increment 
xs_requeuecnt, set
 ERESTART and send the xfer request down to the mpii(4) layer again for a 
retry. What they do
 not do is reset xs->resid equal to xs->datalen.  When the xfer comes down to 
mpii(4) again, the
 assert happens.  The fix is for the mpii(4) driver to leave xs->resid alone 
when it encounters
 a MPII_SCSIIO_STATUS_CHECK_COND condition.

This bug affects NetBSD-10, netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.7 -r1.8.10.8 src/sys/dev/pci/mpii.c

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



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:44:00 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (for ticket #1915)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.29 -r1.1281.2.30 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.29 -r1.1280.2.30 src/sys/dev/pci/pcidevs_data.h

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



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:41:55 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmreg.h if_wmvar.h pcidevs

Log Message:
Pull up the following, requested by msaitoh in ticket #1915:

sys/dev/pci/pcidevs 1.1497
sys/dev/pci/if_wm.c 1.689,1.790-1.791 via patch
sys/dev/pci/if_wmreg.h  1.120 via patch
sys/dev/pci/if_wmvar.h  1.51

- Use 12K for packet buffer for jumbo frame on PCH2 and newer.
- Add new workaround for Tiger Lake and newer to avoid packet loss.
- Add I219{V,LM}({22,23}) devices (Raptor Lake).


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.52 -r1.508.4.53 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.17 -r1.98.6.18 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.33.6.11 -r1.33.6.12 src/sys/dev/pci/if_wmvar.h
cvs rdiff -u -r1.1289.2.29 -r1.1289.2.30 src/sys/dev/pci/pcidevs

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.508.4.52 src/sys/dev/pci/if_wm.c:1.508.4.53
--- src/sys/dev/pci/if_wm.c:1.508.4.52	Sun Oct  8 15:31:17 2023
+++ src/sys/dev/pci/if_wm.c	Wed Oct 18 14:41:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.52 2023/10/08 15:31:17 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.53 2023/10/18 14:41:54 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.508.4.52 2023/10/08 15:31:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.53 2023/10/18 14:41:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1713,25 +1713,31 @@ static const struct wm_product {
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM13,
 	  "I219 LM (13) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM14,
 	  "I219 LM (14) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM15,
 	  "I219 LM (15) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM16,
 	  "I219 LM (16) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM17,
 	  "I219 LM (17) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM18,
 	  "I219 LM (18) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM19,
 	  "I219 LM (19) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM22,
+	  "I219 LM (22) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM23,
+	  "I219 LM (23) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V,
 	  "I219 V Ethernet Connection",
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
@@ -1767,25 +1773,31 @@ static const struct wm_product {
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V13,
 	  "I219 V (13) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V14,
 	  "I219 V (14) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V15,
 	  "I219 V (15) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V16,
 	  "I219 V (16) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V17,
 	  "I219 V (17) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V18,
 	  "I219 V (18) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V19,
 	  "I219 V (19) Ethernet Connection",
-	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V22,
+	  "I219 V (22) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V23,
+	  "I219 V (23) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
 	

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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:41:55 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmreg.h if_wmvar.h pcidevs

Log Message:
Pull up the following, requested by msaitoh in ticket #1915:

sys/dev/pci/pcidevs 1.1497
sys/dev/pci/if_wm.c 1.689,1.790-1.791 via patch
sys/dev/pci/if_wmreg.h  1.120 via patch
sys/dev/pci/if_wmvar.h  1.51

- Use 12K for packet buffer for jumbo frame on PCH2 and newer.
- Add new workaround for Tiger Lake and newer to avoid packet loss.
- Add I219{V,LM}({22,23}) devices (Raptor Lake).


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.52 -r1.508.4.53 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.17 -r1.98.6.18 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.33.6.11 -r1.33.6.12 src/sys/dev/pci/if_wmvar.h
cvs rdiff -u -r1.1289.2.29 -r1.1289.2.30 src/sys/dev/pci/pcidevs

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



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:23:15 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_api.c ixgbe_bypass.h ixgbe_common.c
ixgbe_common.h ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_type.h
ixgbe_x540.c ixgbe_x550.c ixv.c

Log Message:
Pull up the following, requested by msaitoh in ticket #1914:

sys/dev/pci/ixgbe/ix_txrx.c 1.103-1.104
sys/dev/pci/ixgbe/ixgbe.c   1.334-1.338,
1.341-1.344 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.90-1.93
sys/dev/pci/ixgbe/ixgbe_82599.c 1.31-1.32
sys/dev/pci/ixgbe/ixgbe_api.c   1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h1.5
sys/dev/pci/ixgbe/ixgbe_common.c1.46-1.47
sys/dev/pci/ixgbe/ixgbe_common.h1.18
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.14-1.15
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.13
sys/dev/pci/ixgbe/ixgbe_type.h  1.59-1.61
sys/dev/pci/ixgbe/ixgbe_x540.c  1.24
sys/dev/pci/ixgbe/ixgbe_x550.c  1.28
sys/dev/pci/ixgbe/ixv.c 1.187-1.192 via patch

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
  limited to a small number or wrong error message may be printed
  when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
  all devices all queues default interrupt rate.
- Cleanup the code.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.29 -r1.24.2.30 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.57 -r1.88.2.58 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.28 -r1.24.6.29 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.10 -r1.14.8.11 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.15.8.9 -r1.15.8.10 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.13.2.15 -r1.13.2.16 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.7 -r1.7.8.8 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.4.8.4 -r1.4.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.3.8.4 -r1.3.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
cvs rdiff -u -r1.22.2.20 -r1.22.2.21 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.9.6.8 -r1.9.6.9 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.5.6.13 -r1.5.6.14 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.42 -r1.56.2.43 src/sys/dev/pci/ixgbe/ixv.c

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



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:23:15 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_api.c ixgbe_bypass.h ixgbe_common.c
ixgbe_common.h ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_type.h
ixgbe_x540.c ixgbe_x550.c ixv.c

Log Message:
Pull up the following, requested by msaitoh in ticket #1914:

sys/dev/pci/ixgbe/ix_txrx.c 1.103-1.104
sys/dev/pci/ixgbe/ixgbe.c   1.334-1.338,
1.341-1.344 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.90-1.93
sys/dev/pci/ixgbe/ixgbe_82599.c 1.31-1.32
sys/dev/pci/ixgbe/ixgbe_api.c   1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h1.5
sys/dev/pci/ixgbe/ixgbe_common.c1.46-1.47
sys/dev/pci/ixgbe/ixgbe_common.h1.18
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.14-1.15
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.13
sys/dev/pci/ixgbe/ixgbe_type.h  1.59-1.61
sys/dev/pci/ixgbe/ixgbe_x540.c  1.24
sys/dev/pci/ixgbe/ixgbe_x550.c  1.28
sys/dev/pci/ixgbe/ixv.c 1.187-1.192 via patch

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
  limited to a small number or wrong error message may be printed
  when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
  all devices all queues default interrupt rate.
- Cleanup the code.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.29 -r1.24.2.30 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.57 -r1.88.2.58 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.28 -r1.24.6.29 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.10 -r1.14.8.11 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.15.8.9 -r1.15.8.10 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.13.2.15 -r1.13.2.16 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.7 -r1.7.8.8 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.4.8.4 -r1.4.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.3.8.4 -r1.3.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
cvs rdiff -u -r1.22.2.20 -r1.22.2.21 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.9.6.8 -r1.9.6.9 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.5.6.13 -r1.5.6.14 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.42 -r1.56.2.43 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.29 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.30
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.29	Fri Oct 13 18:32:38 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Oct 18 14:23:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.29 2023/10/13 18:32:38 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.29 2023/10/13 18:32:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -846,7 +846,6 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 	u8   ipproto = 0;
 	char *l3d;
 
-
 	/* First check if TSO is to be used */
 	if (mp->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) {
 		int rv = ixgbe_tso_setup(txr, mp, cmd_type_len, olinfo_status);
@@ -1282,9 +1281,9 @@ ixgbe_rsc_count(union ixgbe_adv_rx_desc 
 static void
 ixgbe_setup_hw_rsc(struct rx_ring *rxr)
 {
-	struct	ixgbe_softc *sc = rxr->sc;
-	struct	ixgbe_hw *hw = >hw;
-	u32  rscctrl, rdrxctl;
+	struct ixgbe_softc *sc = rxr->sc;
+	struct ixgbe_hw	*hw = >hw;
+	u32		rscctrl, rdrxctl;
 
 	/* If turning LRO/RSC off we need to disable it */
 	if ((sc->ifp->if_capenable & IFCAP_LRO) == 0) {
@@ -1746,9 +1745,9 @@ ixgbe_rx_input(struct rx_ring *rxr, stru
 (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) {
 /*
  * Send to the stack if:
- **  - LRO not enabled, or
- **  - no LRO resources, or
- **  - lro enqueue fails
+ *  - LRO not enabled, or
+

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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:47:08 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
Regen for ticket #1913 (Intel 82599 LS and Pericom(Diodes) PCIe switches added)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.28 -r1.1281.2.29 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.28 -r1.1280.2.29 src/sys/dev/pci/pcidevs_data.h

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:44:59 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1493
sys/dev/pci/pcidevs: revision 1.1495

Add Intel 82599 LS.
Add Pericom(Diodes) PCIe switches.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.28 -r1.1289.2.29 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.28 src/sys/dev/pci/pcidevs:1.1289.2.29
--- src/sys/dev/pci/pcidevs:1.1289.2.28	Fri Oct 13 17:54:46 2023
+++ src/sys/dev/pci/pcidevs	Fri Oct 13 18:44:59 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.28 2023/10/13 17:54:46 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.29 2023/10/13 18:44:59 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4302,6 +4302,7 @@ product INTEL I350_DA4	 	0x1546	I350 Qua
 product INTEL 82599_SFP_SF_QP	0x154a	82599 10 GbE Controller
 product INTEL XL710_VF		0x154c	XL710 Ethernet Virtual Function
 product INTEL 82599_SFP_SF2	0x154d	82599 (SFP+) 10 GbE Controller
+product INTEL 82599_LS		0x154f	82599 LS 10G Ethernet
 product INTEL 82599EN_SFP	0x1557	82599 10 GbE Controller
 product INTEL 82599_QSFP_SF_QP	0x1558	X520 10 GbE QSFP+
 product INTEL I218_V		0x1559	I218-V Ethernet Connection
@@ -8805,7 +8806,21 @@ product PERICOM PI7C21P100	0x01a7	PI7C21
 product PERICOM PI7C9X20303UL	0x0303	PI7C9X20303UL 3port 3lane PCIe switch
 product PERICOM PI7C9X20505GP	0x0505	PI7C9X20505GP 5port 5lane PCIe switch
 product PERICOM PI7C9X20508GP	0x0508	PI7C9X20508GP 5port 8lane PCIe switch
+product PERICOM PI7C9X2G303EL	0x2303	PI7C9X2G303EL 3port 3lane PCIe Gen2 switch
+product PERICOM PI7C9X2G304EL	0x2304	PI7C9X2G304EL 3port 4lane PCIe Gen2 switch
+product PERICOM PI7C9X2G308GP	0x2308	PI7C9X2G308GP 3port 8lane PCIe Gen2 switch
+product PERICOM PI7C9X2G312GP	0x2312	PI7C9X2G312GP 3port 12lane PCIe Gen2 switch
 product PERICOM PI7C9X2G404SL	0x2404	PI7C9X2G404SL 4port 4lane PCIe Gen2 switch
+product PERICOM PI7C9X2G608GP	0x2608	PI7C9X2G608GP 6port 8lane PCIe Gen2 switch
+product PERICOM PI7C9X2G612GP	0x2612	PI7C9X2G612GP 6port 12lane PCIe Gen2 switch
+product PERICOM PI7C9X2G912GP	0x2912	PI7C9X2G912GP 9port 12lane PCIe Gen2 switch
+product PERICOM PI7C9X2G808PR	0x8608	PI7C9X2G808PR 8port 8lane PCIe Gen2 switch
+product PERICOM PI7C9X2G304EV	0xb304	PI7C9X2G304EV 3port 4lane PCIe Gen2 switch
+product PERICOM PI7C9X2G404EV	0xb404	PI7C9X2G404EV 4port 4lane PCIe Gen2 switch
+product PERICOM PI7C9X3G808GP	0xc008	PI7C9X3G808GP 8port 8lane PCIe Gen3 switch
+product PERICOM PI7C9X3G816GP	0xc016	PI7C9X3G816GP 8port 16lane PCIe Gen3 switch
+product PERICOM PI7C9X3G1224GP	0xc124	PI7C9X3G1224GP 12port 24lane PCIe Gen3 switch
+product PERICOM PI7C9X3G1632GP	0xc232	PI7C9X3G1632GP 16port 32lane PCIe Gen3 switch
 product PERICOM PI7C8140A	0x8140	PI7C8140A 2 port PCI-PCI Bridge
 product PERICOM PI7C8148	0x8148	PI7C8148 Asynchronous 2 port PCI-PCI Bridge
 product PERICOM PI7C8152	0x8152	PI7C8152 2 port PCI-PCI Bridge



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:44:59 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1493
sys/dev/pci/pcidevs: revision 1.1495

Add Intel 82599 LS.
Add Pericom(Diodes) PCIe switches.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.28 -r1.1289.2.29 src/sys/dev/pci/pcidevs

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:32:39 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_api.h ixgbe_bypass.h ixgbe_common.c
ixgbe_common.h ixgbe_fdir.h ixgbe_netmap.c ixgbe_netmap.h
ixgbe_osdep.c ixgbe_sriov.h ixgbe_type.h ixgbe_x550.c ixv.c

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

sys/dev/pci/ixgbe/if_bypass.c   1.10
sys/dev/pci/ixgbe/if_fdir.c 1.6 via patch
sys/dev/pci/ixgbe/if_sriov.c1.18 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.102 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.333,1.339 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.89
sys/dev/pci/ixgbe/ixgbe_api.h   1.17
sys/dev/pci/ixgbe/ixgbe_common.h1.17
sys/dev/pci/ixgbe/ixgbe_bypass.h1.4
sys/dev/pci/ixgbe/ixgbe_common.c1.45
sys/dev/pci/ixgbe/ixgbe_fdir.h  1.5
sys/dev/pci/ixgbe/ixgbe_netmap.h1.3
sys/dev/pci/ixgbe/ixgbe_netmap.c1.6
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.9
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.6
sys/dev/pci/ixgbe/ixgbe_type.h  1.58
sys/dev/pci/ixgbe/ixgbe_x550.c  1.27
sys/dev/pci/ixgbe/ixv.c 1.186 via patch

ixgbe: Rename some definitions, modify comment. No functional change.
 Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
- struct adapter *adapter -> struct ixgbe_softc *sc
- master -> primary
- black -> block

ixg(4): Whitespace. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.7 -r1.2.4.8 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.1.4.4 -r1.1.4.5 src/sys/dev/pci/ixgbe/if_fdir.c \
src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.1.4.8 -r1.1.4.9 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.24.2.28 -r1.24.2.29 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.56 -r1.88.2.57 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.27 -r1.24.6.28 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.9.8.5 -r1.9.8.6 src/sys/dev/pci/ixgbe/ixgbe_api.h
cvs rdiff -u -r1.13.2.14 -r1.13.2.15 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.6 -r1.7.8.7 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/ixgbe_fdir.h \
src/sys/dev/pci/ixgbe/ixgbe_netmap.c
cvs rdiff -u -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_netmap.h
cvs rdiff -u -r1.1.12.6 -r1.1.12.7 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.1.4.6 -r1.1.4.7 src/sys/dev/pci/ixgbe/ixgbe_sriov.h
cvs rdiff -u -r1.22.2.19 -r1.22.2.20 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.12 -r1.5.6.13 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.41 -r1.56.2.42 src/sys/dev/pci/ixgbe/ixv.c

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:02:02 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: ahcisata_pci.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1911):

sys/dev/pci/ahcisata_pci.c: revision 1.71

Add support for ASMEDIA 0x0624
... an AHCI SATA adaptor which identifies itself as an IDE storage device


To generate a diff of this commit:
cvs rdiff -u -r1.38.8.1 -r1.38.8.2 src/sys/dev/pci/ahcisata_pci.c

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

Modified files:

Index: src/sys/dev/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.38.8.1 src/sys/dev/pci/ahcisata_pci.c:1.38.8.2
--- src/sys/dev/pci/ahcisata_pci.c:1.38.8.1	Tue Dec 18 18:26:23 2018
+++ src/sys/dev/pci/ahcisata_pci.c	Fri Oct 13 18:02:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.38.8.1 2018/12/18 18:26:23 martin Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.38.8.2 2023/10/13 18:02:02 martin Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.38.8.1 2018/12/18 18:26:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.38.8.2 2023/10/13 18:02:02 martin Exp $");
 
 #include 
 #include 
@@ -194,6 +194,8 @@ static const struct ahci_pci_quirk ahci_
 	AHCI_PCI_QUIRK_FORCE },
 	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_12,
 	AHCI_PCI_QUIRK_FORCE },
+	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1062_JMB575,
+	AHCI_PCI_QUIRK_FORCE },
 	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_SATA,
 	AHCI_PCI_QUIRK_FORCE },
 };



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:02:02 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: ahcisata_pci.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1911):

sys/dev/pci/ahcisata_pci.c: revision 1.71

Add support for ASMEDIA 0x0624
... an AHCI SATA adaptor which identifies itself as an IDE storage device


To generate a diff of this commit:
cvs rdiff -u -r1.38.8.1 -r1.38.8.2 src/sys/dev/pci/ahcisata_pci.c

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 17:57:27 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
Regen for ticket #1911 (add ASMEDIA 0x0624 - ASM1062 + JMB575 Port Multiplier)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.27 -r1.1281.2.28 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.27 -r1.1280.2.28 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 17:57:27 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
Regen for ticket #1911 (add ASMEDIA 0x0624 - ASM1062 + JMB575 Port Multiplier)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.27 -r1.1281.2.28 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.27 -r1.1280.2.28 src/sys/dev/pci/pcidevs_data.h

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 17:54:46 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up following revision(s) (requested by abs in ticket #1911):

sys/dev/pci/pcidevs: revision 1.1496

Add entry for ASMEDIA 0x0624 - ASM1062 + JMB575 Port Multiplier


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.27 -r1.1289.2.28 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.27 src/sys/dev/pci/pcidevs:1.1289.2.28
--- src/sys/dev/pci/pcidevs:1.1289.2.27	Mon Aug 21 12:37:34 2023
+++ src/sys/dev/pci/pcidevs	Fri Oct 13 17:54:46 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.27 2023/08/21 12:37:34 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.28 2023/10/13 17:54:46 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1510,6 +1510,7 @@ product ASMEDIA ASM1061_01	0x0601	ASM106
 product ASMEDIA ASM1061_02	0x0602	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_11	0x0611	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_12	0x0612	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM1062_JMB575	0x0624	ASM1062 + JMB575 Port Multiplier
 product ASMEDIA ASM106X		0x0625	ASM106x AHCI SATA III Controller
 product	ASMEDIA	ASM1042		0x1042	ASM1042 USB 3.0 Host Controller
 product ASMEDIA ASM1083		0x1080	ASM1083/1085 PCIe-PCI Bridge



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 17:54:46 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up following revision(s) (requested by abs in ticket #1911):

sys/dev/pci/pcidevs: revision 1.1496

Add entry for ASMEDIA 0x0624 - ASM1062 + JMB575 Port Multiplier


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.27 -r1.1289.2.28 src/sys/dev/pci/pcidevs

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



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

2023-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  8 15:31:18 UTC 2023

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

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

sys/dev/pci/if_wm.c: revision 1.785
sys/dev/pci/if_wm.c: revision 1.786
sys/dev/pci/if_wm.c: revision 1.787
sys/dev/pci/if_wm.c: revision 1.788
sys/dev/pci/if_wm.c: revision 1.789

wm(4): Use SCVPC and HRMPC for 82575 and newer.
  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

wm(4): Add some info to some event counters.
 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

wm(4): Modify descriptions of flow control related event counters.

wm(4): Replace /* nothing */ to __nothing for evcnt macros
Prevent empty if bodies for !WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.51 -r1.508.4.52 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.



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

2023-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  8 15:31:18 UTC 2023

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

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

sys/dev/pci/if_wm.c: revision 1.785
sys/dev/pci/if_wm.c: revision 1.786
sys/dev/pci/if_wm.c: revision 1.787
sys/dev/pci/if_wm.c: revision 1.788
sys/dev/pci/if_wm.c: revision 1.789

wm(4): Use SCVPC and HRMPC for 82575 and newer.
  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

wm(4): Add some info to some event counters.
 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

wm(4): Modify descriptions of flow control related event counters.

wm(4): Replace /* nothing */ to __nothing for evcnt macros
Prevent empty if bodies for !WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.51 -r1.508.4.52 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.508.4.51 src/sys/dev/pci/if_wm.c:1.508.4.52
--- src/sys/dev/pci/if_wm.c:1.508.4.51	Mon Sep  4 17:57:49 2023
+++ src/sys/dev/pci/if_wm.c	Sun Oct  8 15:31:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.51 2023/09/04 17:57:49 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.52 2023/10/08 15:31:17 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.508.4.51 2023/09/04 17:57:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.52 2023/10/08 15:31:17 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -770,13 +770,13 @@ do {	\
 #define WM_Q_EVCNT_ADD(qname, evname, val)		\
 	WM_EVCNT_ADD(&(qname)->qname##_ev_##evname, (val))
 #else /* !WM_EVENT_COUNTERS */
-#define	WM_EVCNT_INCR(ev)	/* nothing */
-#define	WM_EVCNT_STORE(ev, val)	/* nothing */
-#define	WM_EVCNT_ADD(ev, val)	/* nothing */
-
-#define WM_Q_EVCNT_INCR(qname, evname)		/* nothing */
-#define WM_Q_EVCNT_STORE(qname, evname, val)	/* nothing */
-#define WM_Q_EVCNT_ADD(qname, evname, val)	/* nothing */
+#define	WM_EVCNT_INCR(ev)	__nothing
+#define	WM_EVCNT_STORE(ev, val)	__nothing
+#define	WM_EVCNT_ADD(ev, val)	__nothing
+
+#define WM_Q_EVCNT_INCR(qname, evname)		__nothing
+#define WM_Q_EVCNT_STORE(qname, evname, val)	__nothing
+#define WM_Q_EVCNT_ADD(qname, evname, val)	__nothing
 #endif /* !WM_EVENT_COUNTERS */
 
 #define	CSR_READ(sc, reg)		\
@@ -3274,15 +3274,15 @@ alloc_retry:
 
 	if (sc->sc_type >= WM_T_82542_2_1) {
 		evcnt_attach_dynamic(>sc_ev_tx_xoff, EVCNT_TYPE_MISC,
-		NULL, xname, "tx_xoff");
+		NULL, xname, "XOFF Transmitted");
 		evcnt_attach_dynamic(>sc_ev_tx_xon, EVCNT_TYPE_MISC,
-		NULL, xname, "tx_xon");
+		NULL, xname, "XON Transmitted");
 		evcnt_attach_dynamic(>sc_ev_rx_xoff, EVCNT_TYPE_MISC,
-		NULL, xname, "rx_xoff");
+		NULL, xname, "XOFF Received");
 		evcnt_attach_dynamic(>sc_ev_rx_xon, EVCNT_TYPE_MISC,
-		NULL, xname, "rx_xon");
+		NULL, xname, "XON Received");
 		evcnt_attach_dynamic(>sc_ev_rx_macctl, EVCNT_TYPE_MISC,
-		NULL, xname, "rx_macctl");
+		NULL, xname, "FC Received Unsupported");
 	}
 
 	evcnt_attach_dynamic(>sc_ev_scc, EVCNT_TYPE_MISC,
@@ -3327,13 +3327,13 @@ alloc_retry:
 	evcnt_attach_dynamic(>sc_ev_rnbc, EVCNT_TYPE_MISC,
 	NULL, xname, "Rx No Buffers");
 	evcnt_attach_dynamic(>sc_ev_ruc, EVCNT_TYPE_MISC,
-	NULL, xname, "Rx Undersize");
+	NULL, xname, "Rx Undersize (valid CRC)");
 	evcnt_attach_dynamic(>sc_ev_rfc, EVCNT_TYPE_MISC,
-	NULL, xname, "Rx Fragment");
+	NULL, xname, "Rx Fragment (bad CRC)");
 	evcnt_attach_dynamic(>sc_ev_roc, EVCNT_TYPE_MISC,
-	NULL, xname, "Rx Oversize");
+	NULL, xname, "Rx Oversize (valid CRC)");
 	evcnt_attach_dynamic(>sc_ev_rjc, EVCNT_TYPE_MISC,
-	NULL, xname, "Rx Jabber");
+	NULL, xname, "Rx Jabber (bad CRC)");
 	if (sc->sc_type >= WM_T_82540) {
 		evcnt_attach_dynamic(>sc_ev_mgtprc, EVCNT_TYPE_MISC,
 		NULL, xname, "Management Packets RX");
@@ -3366,8 +3366,9 @@ alloc_retry:
 	NULL, xname, "Multicast Packets Tx");
 	evcnt_attach_dynamic(>sc_ev_bptc, EVCNT_TYPE_MISC,
 	NULL, xname, "Broadcast Packets Tx");
-	evcnt_attach_dynamic(>sc_ev_iac, EVCNT_TYPE_MISC,
-	NULL, xname, "Interrupt Assertion");
+	if (sc->sc_type >= WM_T_82571) /* PCIe, 80003 and ICH/PCHs */
+		

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

2023-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  8 15:19:32 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_vf.h ixv.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.327-1.332 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.87-1.88
sys/dev/pci/ixgbe/ixv.c 1.184-1.185
sys/dev/pci/ixgbe/ix_txrx.c 1.101
sys/dev/pci/ixgbe/ixgbe_82599.c 1.30
sys/dev/pci/ixgbe/ixgbe_vf.c1.32-1.33
sys/dev/pci/ixgbe/ixgbe_vf.h1.18
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.20
sys/dev/pci/ixgbe/ixgbe_type.h  1.57

- Reorder some event counters for readability.
- Rename some descriptions of event counters.
- Count Queue Bytes {Transmit, Receive} counter.
- Improve error check in ixgbe_check_mac_link_vf().
- Add new IXGBE_VF_GET_LINK_STATE message support.
  The VF's link state can be forced to down by PF.
- Update FCTRL after writing multicast filter.
- Update comments.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.27 -r1.24.2.28 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.55 -r1.88.2.56 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.26 -r1.24.6.27 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.9 -r1.14.8.10 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.10.8.5 -r1.10.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.18 -r1.22.2.19 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.9 -r1.12.8.10 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.8.6.6 -r1.8.6.7 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.40 -r1.56.2.41 src/sys/dev/pci/ixgbe/ixv.c

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



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

2023-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  8 15:19:32 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_vf.h ixv.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.327-1.332 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.87-1.88
sys/dev/pci/ixgbe/ixv.c 1.184-1.185
sys/dev/pci/ixgbe/ix_txrx.c 1.101
sys/dev/pci/ixgbe/ixgbe_82599.c 1.30
sys/dev/pci/ixgbe/ixgbe_vf.c1.32-1.33
sys/dev/pci/ixgbe/ixgbe_vf.h1.18
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.20
sys/dev/pci/ixgbe/ixgbe_type.h  1.57

- Reorder some event counters for readability.
- Rename some descriptions of event counters.
- Count Queue Bytes {Transmit, Receive} counter.
- Improve error check in ixgbe_check_mac_link_vf().
- Add new IXGBE_VF_GET_LINK_STATE message support.
  The VF's link state can be forced to down by PF.
- Update FCTRL after writing multicast filter.
- Update comments.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.27 -r1.24.2.28 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.55 -r1.88.2.56 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.26 -r1.24.6.27 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.9 -r1.14.8.10 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.10.8.5 -r1.10.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.18 -r1.22.2.19 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.9 -r1.12.8.10 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.8.6.6 -r1.8.6.7 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.40 -r1.56.2.41 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.27 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.28
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.27	Mon Jan 23 14:07:24 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sun Oct  8 15:19:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.27 2023/01/23 14:07:24 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.28 2023/10/08 15:19:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.27 2023/01/23 14:07:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.28 2023/10/08 15:19:31 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1341,11 +1341,6 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
  *  exhaustion are unnecessary, if an mbuf cannot be obtained
  *  it just returns, keeping its placeholder, thus it can simply
  *  be recalled to try again.
- *
- *   XXX NetBSD TODO:
- *- The ixgbe_rxeof() function always preallocates mbuf cluster,
- *  so the ixgbe_refresh_mbufs() function can be simplified.
- *
  /
 static void
 ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.55 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.56
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.55	Wed Jun 21 19:28:12 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sun Oct  8 15:19:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.56 2023/10/08 15:19:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.56 2023/10/08 15:19:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1601,8 +1601,19 @@ ixgbe_update_stats_counters(struct adapt
 	for (i = 0; i < queue_counters; i++) {
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRC(i), qprc[i]);
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_QPTC(i), qptc[i]);
-		if (hw->mac.type >= ixgbe_mac_82599EB)
+		if (hw->mac.type >= ixgbe_mac_82599EB) {
+			IXGBE_EVC_ADD(>qbrc[i],
+			IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)) +
+			((u64)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32));
+			IXGBE_EVC_ADD(>qbtc[i],
+			IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)) +
+			((u64)IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)) << 32));
 			IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRDC(i), qprdc[i]);
+		} else {
+			/* 82598 */
+			IXGBE_EVC_REGADD(hw, stats, IXGBE_QBRC(i), qbrc[i]);
+			IXGBE_EVC_REGADD(hw, stats, IXGBE_QBTC(i), qbtc[i]);
+		}
 	}
 
 	/* 8 registers exist */
@@ -1813,28 +1824,28 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		if (i < __arraycount(stats->pxontxc)) {
 			

CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2023-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 15:44:20 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficpufunc.c eficpufunc.h

Log Message:
Pull up following revision(s) (requested by rin in ticket #1897):

sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.22
sys/arch/i386/stand/efiboot/eficpufunc.c: revision 1.1
sys/arch/i386/stand/efiboot/eficpufunc.h: revision 1.1
sys/arch/i386/stand/efiboot/eficons.c: revision 1.13
sys/arch/i386/stand/efiboot/eficons.c: revision 1.14

efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.
``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.
Proposed as PR port-amd64/57523

efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.9.2.5 -r1.9.2.6 \
src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.4.2.6 -r1.4.2.7 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1.6.2 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.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/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9.2.5 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9.2.6
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9.2.5	Wed Sep 18 17:30:05 2019
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Fri Sep 15 15:44:20 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.9.2.5 2019/09/18 17:30:05 martin Exp $
+# $NetBSD: Makefile.efiboot,v 1.9.2.6 2023/09/15 15:44:20 martin Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -10,9 +10,11 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 
 SOURCES= start.S boot.c conf.c devopen.c dev_net.c self_reloc.c panic.c
 SOURCES+= efiboot.c efichar.c eficons.c efidelay.c efidev.c
+SOURCES+= eficpufunc.c
 SOURCES+= efidisk.c efidisk_ll.c efigetsecs.c efimemory.c
 SOURCES+= efinet.c efipxe.c
 LIBI386SRCS= biosdisk.c bootinfo.c bootinfo_biosgeom.c bootmenu.c
+LIBI386SRCS+= comio_direct.c
 LIBI386SRCS+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
 LIBI386SRCS+= exec_multiboot1.c exec_multiboot2.c
 # use our own nfs implementation

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.6 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.7
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.6	Mon Mar  9 09:48:00 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Fri Sep 15 15:44:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.6 2020/03/09 09:48:00 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.7 2023/09/15 15:44:20 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,9 +26,12 @@
  * SUCH DAMAGE.
  */
 
+#include 
 #include 
 #include 
 
+#include 
+
 #include "efiboot.h"
 
 #include "bootinfo.h"
@@ -60,6 +63,8 @@ static u_char serbuf[16];
 static int serbuf_read = 0;
 static int serbuf_write = 0;
 
+static int raw_com_addr = 0;
+
 static void eficons_init_video(void);
 static void efi_switch_video_to_text_mode(void);
 
@@ -76,6 +81,12 @@ static int efi_com_putc(int);
 static int efi_com_status(int);
 static int efi_com_waitforinputevent(uint64_t);
 
+static int raw_com_init(int, int);
+static int raw_com_getc(void);
+static int raw_com_putc(int);
+static int raw_com_status(int);
+static int raw_com_waitforinputevent(uint64_t);
+
 static int efi_find_gop_mode(char *);
 
 static int iodev;
@@ -134,11 +145,8 @@ ok:
 	case CONSDEV_COM3:
 		iodev = dev;
 		btinfo_console.addr = ioport;
-		if (btinfo_console.addr == 0) {
-			if (!efi_valid_com(iodev))
-goto nocom;
+		if (btinfo_console.addr == 0)
 			btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
-		}
 		if (speed != 0)
 			btinfo_console.speed = speed;
 		efi_com_init(btinfo_console.addr, btinfo_console.speed);
@@ -149,8 +157,6 @@ ok:
 	case CONSDEV_COM2KBD:
 	case CONSDEV_COM3KBD:
 		iodev = dev - CONSDEV_COM0KBD + CONSDEV_COM0;
-		if (!efi_valid_com(iodev))
-			goto nocom;
 		btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
 
 		efi_cons_putc('0' + iodev - CONSDEV_COM0);
@@ -868,7 +874,7 @@ efi_com_init(int addr, int speed)
 		return 0;
 
 	if (!efi_valid_com(iodev))
-		return 0;
+		return raw_com_init(addr, speed);
 
 	serio = serios[iodev - CONSDEV_COM0];
 
@@ -884,6 +890,7 @@ efi_com_init(int addr, int speed)
 		}
 	}
 
+	

CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2023-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 15:44:20 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficpufunc.c eficpufunc.h

Log Message:
Pull up following revision(s) (requested by rin in ticket #1897):

sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.22
sys/arch/i386/stand/efiboot/eficpufunc.c: revision 1.1
sys/arch/i386/stand/efiboot/eficpufunc.h: revision 1.1
sys/arch/i386/stand/efiboot/eficons.c: revision 1.13
sys/arch/i386/stand/efiboot/eficons.c: revision 1.14

efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.
``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.
Proposed as PR port-amd64/57523

efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.9.2.5 -r1.9.2.6 \
src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.4.2.6 -r1.4.2.7 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1.6.2 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.h

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



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

2023-09-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Sep  4 17:57:50 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmvar.h

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

sys/dev/pci/if_wmvar.h: revision 1.50
sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.50 -r1.508.4.51 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.33.6.10 -r1.33.6.11 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.508.4.50 src/sys/dev/pci/if_wm.c:1.508.4.51
--- src/sys/dev/pci/if_wm.c:1.508.4.50	Tue Jun 27 18:36:53 2023
+++ src/sys/dev/pci/if_wm.c	Mon Sep  4 17:57:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.50 2023/06/27 18:36:53 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.51 2023/09/04 17:57:49 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.508.4.50 2023/06/27 18:36:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.51 2023/09/04 17:57:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -547,7 +547,7 @@ struct wm_softc {
 #define	WM_MEDIATYPE_COPPER		0x02
 #define	WM_MEDIATYPE_SERDES		0x03 /* Internal SERDES */
 	int sc_funcid;			/* unit number of the chip (0 to 3) */
-	int sc_flags;			/* flags; see below */
+	u_int sc_flags;			/* flags; see below */
 	int sc_if_flags;		/* last if_flags */
 	int sc_flowflags;		/* 802.3x flow control flags */
 	int sc_align_tweak;
@@ -717,6 +717,7 @@ struct wm_softc {
 	int sc_tbi_linkup;		/* TBI link status */
 	int sc_tbi_serdes_anegticks;	/* autonegotiation ticks */
 	int sc_tbi_serdes_ticks;	/* tbi ticks */
+	struct timeval sc_linkup_delay_time; /* delay LINK_STATE_UP */
 
 	int sc_mchash_type;		/* multicast filter offset */
 
@@ -3046,6 +3047,23 @@ alloc_retry:
 	|| (sc->sc_type == WM_T_I210) || (sc->sc_type == WM_T_I211))
 		sc->sc_flags |= WM_F_CRC_STRIP;
 
+	/*
+	 * Workaround for some chips to delay sending LINK_STATE_UP.
+	 * Some systems can't send packet soon after linkup. See also
+	 * wm_linkintr_gmii(), wm_tick() and wm_gmii_mediastatus().
+	 */
+	switch (sc->sc_type) {
+	case WM_T_I350:
+	case WM_T_I354:
+	case WM_T_I210:
+	case WM_T_I211:
+		if (sc->sc_mediatype == WM_MEDIATYPE_COPPER)
+			sc->sc_flags |= WM_F_DELAY_LINKUP;
+		break;
+	default:
+		break;
+	}
+
 	/* Set device properties (macflags) */
 	prop_dictionary_set_uint32(dict, "macflags", sc->sc_flags);
 
@@ -3834,9 +3852,29 @@ wm_tick(void *arg)
 
 	wm_update_stats(sc);
 
-	if (sc->sc_flags & WM_F_HAS_MII)
-		mii_tick(>sc_mii);
-	else if ((sc->sc_type >= WM_T_82575) && (sc->sc_type <= WM_T_I211)
+	if (sc->sc_flags & WM_F_HAS_MII) {
+		bool dotick = true;
+
+		/*
+		 * Workaround for some chips to delay sending LINK_STATE_UP.
+		 * See also wm_linkintr_gmii() and wm_gmii_mediastatus().
+		 */
+		if ((sc->sc_flags & WM_F_DELAY_LINKUP) != 0) {
+			struct timeval now;
+
+			getmicrotime();
+			if (timercmp(, >sc_linkup_delay_time, <))
+dotick = false;
+			else if (sc->sc_linkup_delay_time.tv_sec != 0) {
+/* Simplify by checking tv_sec only. */
+
+sc->sc_linkup_delay_time.tv_sec = 0;
+sc->sc_linkup_delay_time.tv_usec = 0;
+			}
+		}
+		if (dotick)
+			mii_tick(>sc_mii);
+	} else if ((sc->sc_type >= WM_T_82575) && (sc->sc_type <= WM_T_I211)
 	&& (sc->sc_mediatype == WM_MEDIATYPE_SERDES))
 		wm_serdes_tick(sc);
 	else
@@ -10169,6 +10207,7 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
 {
 	uint32_t status, reg;
 	bool link;
+	bool dopoll = true;
 
 	KASSERT(WM_CORE_LOCKED(sc));
 
@@ -10214,7 +10253,42 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
 
 	DPRINTF(sc, WM_DEBUG_LINK, ("%s: LINK: LSC -> mii_pollstat\n",
 		device_xname(sc->sc_dev)));
-	mii_pollstat(>sc_mii);
+	if ((sc->sc_flags & WM_F_DELAY_LINKUP) != 0) {
+		if (link) {
+			/* Wait 1 second. */
+			dopoll = false;
+			getmicrotime(>sc_linkup_delay_time);
+			sc->sc_linkup_delay_time.tv_sec += 1;
+		} else if (sc->sc_linkup_delay_time.tv_sec != 0) {
+			

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

2023-09-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Sep  4 17:57:50 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmvar.h

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

sys/dev/pci/if_wmvar.h: revision 1.50
sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.50 -r1.508.4.51 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.33.6.10 -r1.33.6.11 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.



CVS commit: [netbsd-8] src/sys/net/npf

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 18:25:04 UTC 2023

Modified Files:
src/sys/net/npf [netbsd-8]: npf_ruleset.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1893):

sys/net/npf/npf_ruleset.c: revision 1.52

The analysis documented in PR misc/56990 is correct.

Fix by not returning when encountering a ruleset rule.

The code up to now would stop at any group rule.
ruleset rules are marked as group rule and a dynamic rule.
processing is only finished when a result is present AND
we are looking at a plain group rule.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.6.1 src/sys/net/npf/npf_ruleset.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/net/npf/npf_ruleset.c
diff -u src/sys/net/npf/npf_ruleset.c:1.45 src/sys/net/npf/npf_ruleset.c:1.45.6.1
--- src/sys/net/npf/npf_ruleset.c:1.45	Sun Jan 29 00:15:54 2017
+++ src/sys/net/npf/npf_ruleset.c	Wed Aug 23 18:25:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ruleset.c,v 1.45 2017/01/29 00:15:54 christos Exp $	*/
+/*	$NetBSD: npf_ruleset.c,v 1.45.6.1 2023/08/23 18:25:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ruleset.c,v 1.45 2017/01/29 00:15:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ruleset.c,v 1.45.6.1 2023/08/23 18:25:04 martin Exp $");
 
 #include 
 #include 
@@ -944,7 +944,7 @@ npf_ruleset_inspect(npf_cache_t *npc, co
 		KASSERT(n < skip_to);
 
 		/* Group is a barrier: return a matching if found any. */
-		if ((attr & NPF_RULE_GROUP) != 0 && final_rl) {
+		if ((attr & NPF_DYNAMIC_GROUP) == NPF_RULE_GROUP && final_rl) {
 			break;
 		}
 



CVS commit: [netbsd-8] src/sys/net/npf

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 18:25:04 UTC 2023

Modified Files:
src/sys/net/npf [netbsd-8]: npf_ruleset.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1893):

sys/net/npf/npf_ruleset.c: revision 1.52

The analysis documented in PR misc/56990 is correct.

Fix by not returning when encountering a ruleset rule.

The code up to now would stop at any group rule.
ruleset rules are marked as group rule and a dynamic rule.
processing is only finished when a result is present AND
we are looking at a plain group rule.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.6.1 src/sys/net/npf/npf_ruleset.c

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



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

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 17:16:13 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: ichsmb.c ismt.c

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

sys/dev/pci/ichsmb.c: revision 1.85
sys/dev/pci/ismt.c: revision 1.11

ichsmb(4),ismt(4): Add Snow Ridge support.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.7 -r1.50.6.8 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/dev/pci/ismt.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/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.50.6.7 src/sys/dev/pci/ichsmb.c:1.50.6.8
--- src/sys/dev/pci/ichsmb.c:1.50.6.7	Sat Jul 29 10:54:05 2023
+++ src/sys/dev/pci/ichsmb.c	Wed Aug 23 17:16:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.7 2023/07/29 10:54:05 martin Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.50.6.8 2023/08/23 17:16:13 martin Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.7 2023/07/29 10:54:05 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.8 2023/08/23 17:16:13 martin Exp $");
 
 #include 
 #include 
@@ -130,6 +130,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_GLK_SMB:
 		case PCI_PRODUCT_INTEL_EHL_SMB:
 		case PCI_PRODUCT_INTEL_JSL_SMB:
+		case PCI_PRODUCT_INTEL_SNR_SMB_LEGACY:
 		case PCI_PRODUCT_INTEL_ADL_N_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:

Index: src/sys/dev/pci/ismt.c
diff -u src/sys/dev/pci/ismt.c:1.5.2.1 src/sys/dev/pci/ismt.c:1.5.2.2
--- src/sys/dev/pci/ismt.c:1.5.2.1	Mon Feb 26 00:05:04 2018
+++ src/sys/dev/pci/ismt.c	Wed Aug 23 17:16:13 2023
@@ -60,7 +60,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ismt/ismt.c 266474 2014-05-20 19:55:06Z jimharris $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.5.2.1 2018/02/26 00:05:04 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.5.2.2 2023/08/23 17:16:13 martin Exp $");
 
 #include 
 #include 
@@ -802,6 +802,7 @@ ismt_match(device_t parent, cfdata_t mat
 	case PCI_PRODUCT_INTEL_S1200_SMBUS_1:
 	case PCI_PRODUCT_INTEL_C2000_SMBUS:
 	case PCI_PRODUCT_INTEL_C3K_SMBUS:
+	case PCI_PRODUCT_INTEL_SNR_SMB_HOST:
 		break;
 	default:
 		return 0;



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

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 17:16:13 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: ichsmb.c ismt.c

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

sys/dev/pci/ichsmb.c: revision 1.85
sys/dev/pci/ismt.c: revision 1.11

ichsmb(4),ismt(4): Add Snow Ridge support.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.7 -r1.50.6.8 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/dev/pci/ismt.c

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



CVS commit: [netbsd-8] src/sys/arch/x86/pci

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 17:10:58 UTC 2023

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: pci_machdep.c

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

sys/arch/x86/pci/pci_machdep.c: revision 1.94

Fix detection of availability of MSI/MSI-X on some systems.

Try to find all functions on bus 0, device 0 to find a PCI host bridge.
Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge.


To generate a diff of this commit:
cvs rdiff -u -r1.79.2.2 -r1.79.2.3 src/sys/arch/x86/pci/pci_machdep.c

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



CVS commit: [netbsd-8] src/sys/arch/x86/pci

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 17:10:58 UTC 2023

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: pci_machdep.c

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

sys/arch/x86/pci/pci_machdep.c: revision 1.94

Fix detection of availability of MSI/MSI-X on some systems.

Try to find all functions on bus 0, device 0 to find a PCI host bridge.
Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge.


To generate a diff of this commit:
cvs rdiff -u -r1.79.2.2 -r1.79.2.3 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.79.2.2 src/sys/arch/x86/pci/pci_machdep.c:1.79.2.3
--- src/sys/arch/x86/pci/pci_machdep.c:1.79.2.2	Wed Jun 12 10:17:33 2019
+++ src/sys/arch/x86/pci/pci_machdep.c	Wed Aug 23 17:10:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.79.2.2 2019/06/12 10:17:33 martin Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.79.2.3 2023/08/23 17:10:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.79.2.2 2019/06/12 10:17:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.79.2.3 2023/08/23 17:10:57 martin Exp $");
 
 #include 
 #include 
@@ -456,6 +456,8 @@ pci_attach_hook(device_t parent, device_
 	pci_chipset_tag_t pc = pba->pba_pc;
 	pcitag_t tag;
 	pcireg_t id, class;
+	int i;
+	bool havehb = false;
 #endif
 
 	if (pba->pba_bus == 0)
@@ -473,19 +475,25 @@ pci_attach_hook(device_t parent, device_
 #ifdef __HAVE_PCI_MSI_MSIX
 	/*
 	 * In order to decide whether the system supports MSI we look
-	 * at the host bridge, which should be device 0 function 0 on
-	 * bus 0.  It is better to not enable MSI on systems that
+	 * at the host bridge, which should be device 0 on bus 0.
+	 * It is better to not enable MSI on systems that
 	 * support it than the other way around, so be conservative
 	 * here.  So we don't enable MSI if we don't find a host
 	 * bridge there.  We also deliberately don't enable MSI on
 	 * chipsets from low-end manifacturers like VIA and SiS.
 	 */
-	tag = pci_make_tag(pc, 0, 0, 0);
-	id = pci_conf_read(pc, tag, PCI_ID_REG);
-	class = pci_conf_read(pc, tag, PCI_CLASS_REG);
-
-	if (PCI_CLASS(class) != PCI_CLASS_BRIDGE ||
-	PCI_SUBCLASS(class) != PCI_SUBCLASS_BRIDGE_HOST)
+	for (i = 0; i <= 7; i++) {
+		tag = pci_make_tag(pc, 0, 0, i);
+		id = pci_conf_read(pc, tag, PCI_ID_REG);
+		class = pci_conf_read(pc, tag, PCI_CLASS_REG);
+
+		if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
+		PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) {
+			havehb = true;
+			break;
+		}
+	}
+	if (havehb == false)
 		return;
 
 	/* VMware and KVM use old chipset, but they can use MSI/MSI-X */



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

2023-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 22 16:19:57 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: sdhc_pci.c

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

sys/dev/pci/sdhc_pci.c: revision 1.21

Add quirk setting for some Intel eMMC devices.

 On some Intel eMMC controllers, the driver reports "autoconfiguration error:
couldn't enable card: 60" even though they really have eMMC device.

This change fixes the problem on some machines. It might be required more
quirks for newer devices (or HS400 support). At least, this change fixes the
problem on GIGABYTE MA10-ST0.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/pci/sdhc_pci.c

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



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

2023-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 22 16:19:57 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: sdhc_pci.c

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

sys/dev/pci/sdhc_pci.c: revision 1.21

Add quirk setting for some Intel eMMC devices.

 On some Intel eMMC controllers, the driver reports "autoconfiguration error:
couldn't enable card: 60" even though they really have eMMC device.

This change fixes the problem on some machines. It might be required more
quirks for newer devices (or HS400 support). At least, this change fixes the
problem on GIGABYTE MA10-ST0.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/pci/sdhc_pci.c

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

Modified files:

Index: src/sys/dev/pci/sdhc_pci.c
diff -u src/sys/dev/pci/sdhc_pci.c:1.14.2.2 src/sys/dev/pci/sdhc_pci.c:1.14.2.3
--- src/sys/dev/pci/sdhc_pci.c:1.14.2.2	Wed Jan 18 19:31:43 2023
+++ src/sys/dev/pci/sdhc_pci.c	Tue Aug 22 16:19:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_pci.c,v 1.14.2.2 2023/01/18 19:31:43 martin Exp $	*/
+/*	$NetBSD: sdhc_pci.c,v 1.14.2.3 2023/08/22 16:19:57 martin Exp $	*/
 /*	$OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.14.2.2 2023/01/18 19:31:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.14.2.3 2023/08/22 16:19:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -155,7 +155,8 @@ static const struct sdhc_pci_quirk {
 		0x,
 		0x,
 		~0,
-		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
 	},
 
 	{
@@ -166,6 +167,97 @@ static const struct sdhc_pci_quirk {
 		~0,
 		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET
 	},
+
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_C3K_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_BAYTRAIL_SCC_MMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_BAYTRAIL_SCC_MMC2,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_APL_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_GLK_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_3HS_U_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_495_YU_PCIE_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_CMTLK_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_JSL_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
+	{
+		PCI_VENDOR_INTEL,
+		PCI_PRODUCT_INTEL_EHL_EMMC,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_INTEL_EMMC_HW_RESET |
+		SDHC_PCI_QUIRK_NO_PWR0
+	},
 };
 
 static void sdhc_pci_quirk_ti_hack(struct pci_attach_args *);



CVS commit: [netbsd-8] src/sys/arch/x86/pci

2023-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 22 16:12:55 UTC 2023

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c

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

sys/arch/x86/pci/amdzentemp.c: revision 1.20
sys/arch/x86/pci/amdsmn.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.19

Add Zen4 Ryzen "Phoenix" support.
Add Zen2 Mendocino APU support.
Add Zen4 Phoenix support.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.6 -r1.3.2.7 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.7.2.5 -r1.7.2.6 src/sys/arch/x86/pci/amdzentemp.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.3.2.6 src/sys/arch/x86/pci/amdsmn.c:1.3.2.7
--- src/sys/arch/x86/pci/amdsmn.c:1.3.2.6	Wed Jun 21 18:58:22 2023
+++ src/sys/arch/x86/pci/amdsmn.c	Tue Aug 22 16:12:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.3.2.6 2023/06/21 18:58:22 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.3.2.7 2023/08/22 16:12:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.6 2023/06/21 18:58:22 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.7 2023/08/22 16:12:54 martin Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -112,6 +112,11 @@ static const struct pciid {
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F19_7X_RC,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
 };
 
 static int amdsmn_match(device_t, cfdata_t, void *);

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.7.2.5 src/sys/arch/x86/pci/amdzentemp.c:1.7.2.6
--- src/sys/arch/x86/pci/amdzentemp.c:1.7.2.5	Wed Jun 21 18:58:22 2023
+++ src/sys/arch/x86/pci/amdzentemp.c	Tue Aug 22 16:12:54 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.7.2.5 2023/06/21 18:58:22 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.7.2.6 2023/08/22 16:12:54 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.7.2.5 2023/06/21 18:58:22 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.7.2.6 2023/08/22 16:12:54 martin Exp $ ");
 
 #include 
 #include 
@@ -370,15 +370,19 @@ amdzentemp_probe_ccd_sensors17h(struct a
 {
 	int maxreg;
 
-	sc->sc_ccd_offset = 0x154;
-
 	switch (model) {
 	case 0x00 ... 0x2f: /* Zen1, Zen+ */
+		sc->sc_ccd_offset = 0x154;
 		maxreg = 4;
 		break;
 	case 0x30 ... 0x3f: /* Zen2 TR (Castle Peak)/EPYC (Rome) */
 	case 0x60 ... 0x7f: /* Zen2 Ryzen (Renoir APU, Matisse) */
 	case 0x90 ... 0x9f: /* Zen2 Ryzen (Van Gogh APU) */
+		sc->sc_ccd_offset = 0x154;
+		maxreg = 8;
+		break;
+	case 0xa0 ... 0xaf: /* Zen2 Ryzen (Mendocino APU) */
+		sc->sc_ccd_offset = 0x300;
 		maxreg = 8;
 		break;
 	default:
@@ -403,6 +407,7 @@ amdzentemp_probe_ccd_sensors19h(struct a
 		maxreg = 8;
 		break;
 	case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */
+	case 0x70 ... 0x7f: /* Zen4 Ryzen "Phoenix" */
 		sc->sc_ccd_offset = 0x308;
 		maxreg = 8;
 		break;



CVS commit: [netbsd-8] src/sys/arch/x86/pci

2023-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 22 16:12:55 UTC 2023

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c

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

sys/arch/x86/pci/amdzentemp.c: revision 1.20
sys/arch/x86/pci/amdsmn.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.19

Add Zen4 Ryzen "Phoenix" support.
Add Zen2 Mendocino APU support.
Add Zen4 Phoenix support.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.6 -r1.3.2.7 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.7.2.5 -r1.7.2.6 src/sys/arch/x86/pci/amdzentemp.c

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



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

2023-08-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 21 12:39:45 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (for ticket #1887)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.26 -r1.1281.2.27 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.26 -r1.1280.2.27 src/sys/dev/pci/pcidevs_data.h

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



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

2023-08-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 21 12:39:45 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (for ticket #1887)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.26 -r1.1281.2.27 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.26 -r1.1280.2.27 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2023-08-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 21 12:37:34 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1483-1.1492

Add AMD 19h/7xh Root Complex.
pcidevs: add ASMedia ASM106x

Add Intel Snow Ridge devices.

Fix some descriptions of Intel Snow Ridge.

Add Intel I226 devices.

Add device ids of the VX800 chipset and s3 chrome 500 series GPU.
Descriptions mainly aligned with VX800/820 Series System Programming Manual.
fix duplicate definition.

Add some Intel Xeon D-2100 devices. Fix description of Intel 0x37d0.

Simplify descriptions of Snow Ridge internal Ethernet devices.

Rename PCI to PCIE for naming consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.26 -r1.1289.2.27 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.26 src/sys/dev/pci/pcidevs:1.1289.2.27
--- src/sys/dev/pci/pcidevs:1.1289.2.26	Sat Jul 29 10:42:39 2023
+++ src/sys/dev/pci/pcidevs	Mon Aug 21 12:37:34 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.26 2023/07/29 10:42:39 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.27 2023/08/21 12:37:34 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1100,6 +1100,7 @@ product AMD F19_6X_DF_4		0x14e4	19h/6xh 
 product AMD F19_6X_DF_5		0x14e5	19h/6xh Data Fabric 5
 product AMD F19_6X_DF_6		0x14e6	19h/6xh Data Fabric 6
 product AMD F19_6X_DF_7		0x14e7	19h/6xh Data Fabric 7
+product AMD F19_7X_RC		0x14e8	19h/7xh Root Complex
 product AMD F17_AX_XHCI_0	0x1503	17h/Axh USB 3.1 xHCI
 product AMD F17_AX_XHCI_1	0x1504	17h/Axh USB 3.1 xHCI
 product AMD F17_AX_USB_BIOM	0x1505	17h/Axh Secure USB BIOmetric
@@ -1509,6 +1510,7 @@ product ASMEDIA ASM1061_01	0x0601	ASM106
 product ASMEDIA ASM1061_02	0x0602	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_11	0x0611	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_12	0x0612	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM106X		0x0625	ASM106x AHCI SATA III Controller
 product	ASMEDIA	ASM1042		0x1042	ASM1042 USB 3.0 Host Controller
 product ASMEDIA ASM1083		0x1080	ASM1083/1085 PCIe-PCI Bridge
 product	ASMEDIA	ASM1042A	0x1142	ASM1042A USB 3.0 Host Controller
@@ -3873,6 +3875,13 @@ product INTEL WIFI_LINK_7265_2	0x095b	Du
 product INTEL X1000_LB		0x095e	Quark X1000 Legacy Bridge
 product INTEL 80960RM		0x0962	i960 RM PCI-PCI
 product INTEL 80960RN		0x0964	i960 RN PCI-PCI
+product INTEL SNR_IEH		0x0998	Snow Ridge IEH
+product INTEL SNR_M2IIO_VTD	0x09a2	Snow Ridge Mesh2IIO MMAP/VT-d
+product INTEL SNR_M2IIO_RAS	0x09a3	Snow Ridge Mesh2IIO RAS
+product INTEL SNR_M2IIO_PMU	0x09a4	Snow Ridge Mesh2IIO PMU/PMON
+product INTEL SNR_M2IIO_DFX	0x09a5	Snow Ridge Mesh2IIO DFx
+product INTEL SNR_PECI_OOB_MSM	0x09a6	Snow Ridge PECI OOB-MSM
+product INTEL SNR_PECI_OOB_MSM_PMU 0x09a7 Snow Ridge PECI OOB-MSM PMU
 product INTEL CORE4G_D_ULT_GT1	0x0a02	HD Graphics
 product INTEL CORE4G_M_HOST_DRAM 0x0a04	Core 4G (mobile) Host Bridge, DRAM
 product INTEL CORE4G_M_ULT_GT1	0x0a06	HD Graphics (GT1)
@@ -3893,6 +3902,7 @@ product INTEL CORE4G_R_ULT_GT3_2 0x0a2e	
 product INTEL DC_P3520_SSD	0x0a53	SSD DC P3520
 product INTEL DC_P4500_SSD	0x0a54	SSD DC P4500
 product INTEL DC_P4600_SSD	0x0a55	SSD DC P4600
+product INTEL SNR_DMA		0x0b00	Snow Ridge DMA
 product INTEL HASWELL_HOST_DRAM	0x0c00	Haswell Host Bridge, DRAM
 product INTEL HASWELL_PCIE16	0x0c01	Haswell PCI-E x16 Controller
 product INTEL HASWELL_PCIE8	0x0c05	Haswell PCI-E x8 Controller
@@ -4234,6 +4244,9 @@ product INTEL 82441FX		0x1237	82441FX (P
 product INTEL 82380AB		0x123c	82380AB (MISA) Mobile PCI-ISA Bridge
 product INTEL 82380FB		0x124b	82380FB (MPCI2) Mobile PCI-PCI Bridge
 product INTEL 82439HX		0x1250	82439HX (TXC) System Controller
+product INTEL I226_LM		0x125b	I226-LM Ethernet
+product INTEL I226_V		0x125c	I226-V Ethernet
+product INTEL I226_IT		0x125d	I226-IT Ethernet
 product INTEL C3K_X553_10G	0x1306	C3000 X553 10G Ethernet
 product INTEL C3K_X553_1G	0x1307	C3000 X553 1G Ethernet
 product INTEL 82870P2_PPB	0x1460	82870P2 P64H2 PCI-PCI Bridge
@@ -4374,6 +4387,43 @@ product INTEL CORE5G_M_GT2_1	0x1616	HD G
 product INTEL CORE5G_M_GT2_2	0x161e	HD Graphics 5300
 product INTEL CORE5G_M_GT3_15W	0x1626	HD Graphics 6000
 product INTEL CORE5G_M_GT3_28W	0x162b	Iris Graphics 6100
+product INTEL SNR_E882_C_BP	0x1890	E882-C for backplane
+product INTEL SNR_E882_C_QSFP	0x1891	E882-C for QSFP
+product INTEL SNR_E882_C_SFP	0x1892	E882-C for SFP
+product INTEL SNR_E882_C_10GT	0x1893	E882-C/X557-AT 10GBASE-T
+product INTEL SNR_E882_C_1G	0x1894	E882-C 1G
+product INTEL SNR_E882_X	0x1895	E882-X (for BMSM)
+product INTEL SNR_E882_L_BP	0x1897	E882-L for backplane
+product INTEL SNR_E882_L_SFP	0x1898	E882-L for SFP
+product INTEL 

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

2023-08-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 21 12:37:34 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

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

sys/dev/pci/pcidevs: revision 1.1483-1.1492

Add AMD 19h/7xh Root Complex.
pcidevs: add ASMedia ASM106x

Add Intel Snow Ridge devices.

Fix some descriptions of Intel Snow Ridge.

Add Intel I226 devices.

Add device ids of the VX800 chipset and s3 chrome 500 series GPU.
Descriptions mainly aligned with VX800/820 Series System Programming Manual.
fix duplicate definition.

Add some Intel Xeon D-2100 devices. Fix description of Intel 0x37d0.

Simplify descriptions of Snow Ridge internal Ethernet devices.

Rename PCI to PCIE for naming consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.26 -r1.1289.2.27 src/sys/dev/pci/pcidevs

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



CVS commit: [netbsd-8] src/sys/net

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 15:00:28 UTC 2023

Modified Files:
src/sys/net [netbsd-8]: bpf.c

Log Message:
Apply patch, requested by ozaki-r in ticket #1885:

sys/net/bpf.c   (apply patch)

bpf: allow to read with no filter (regressed at revision 1.213,
fixed differently in -current)


To generate a diff of this commit:
cvs rdiff -u -r1.216.6.8 -r1.216.6.9 src/sys/net/bpf.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/net/bpf.c
diff -u src/sys/net/bpf.c:1.216.6.8 src/sys/net/bpf.c:1.216.6.9
--- src/sys/net/bpf.c:1.216.6.8	Wed Feb 22 19:51:47 2023
+++ src/sys/net/bpf.c	Fri Aug  4 15:00:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.216.6.8 2023/02/22 19:51:47 martin Exp $	*/
+/*	$NetBSD: bpf.c,v 1.216.6.9 2023/08/04 15:00:28 martin Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216.6.8 2023/02/22 19:51:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216.6.9 2023/08/04 15:00:28 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -1605,6 +1605,8 @@ bpf_deliver(struct bpf_if *bp, void *(*c
 			else
 slen = bpf_filter_ext(NULL, filter->bf_insn,
 );
+		} else {
+			slen = (u_int)-1; /* No filter means accept all */
 		}
 
 		if (!slen) {



CVS commit: [netbsd-8] src/sys/net

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 15:00:28 UTC 2023

Modified Files:
src/sys/net [netbsd-8]: bpf.c

Log Message:
Apply patch, requested by ozaki-r in ticket #1885:

sys/net/bpf.c   (apply patch)

bpf: allow to read with no filter (regressed at revision 1.213,
fixed differently in -current)


To generate a diff of this commit:
cvs rdiff -u -r1.216.6.8 -r1.216.6.9 src/sys/net/bpf.c

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



CVS commit: [netbsd-8] src/sys/netinet6

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 14:38:09 UTC 2023

Modified Files:
src/sys/netinet6 [netbsd-8]: in6.c ip6_output.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1884):

sys/netinet6/in6.c: revision 1.289
sys/netinet6/ip6_output.c: revision 1.234

in6: clear ND6_IFF_IFDISABLED to allow DAD again on link-up

in6: don't send any IPv6 packets over a disabled interface


To generate a diff of this commit:
cvs rdiff -u -r1.245.2.13 -r1.245.2.14 src/sys/netinet6/in6.c
cvs rdiff -u -r1.191.6.5 -r1.191.6.6 src/sys/netinet6/ip6_output.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.245.2.13 src/sys/netinet6/in6.c:1.245.2.14
--- src/sys/netinet6/in6.c:1.245.2.13	Thu Oct  8 18:06:13 2020
+++ src/sys/netinet6/in6.c	Fri Aug  4 14:38:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.245.2.13 2020/10/08 18:06:13 martin Exp $	*/
+/*	$NetBSD: in6.c,v 1.245.2.14 2023/08/04 14:38:09 martin Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.13 2020/10/08 18:06:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.14 2023/08/04 14:38:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2311,6 +2311,10 @@ in6_if_link_down(struct ifnet *ifp)
 	}
 	pserialize_read_exit(s);
 	curlwp_bindx(bound);
+
+	/* Clear ND6_IFF_IFDISABLED to allow DAD again on link-up. */
+	if (ifp->if_afdata[AF_INET6] != NULL)
+		ND_IFINFO(ifp)->flags &= ~ND6_IFF_IFDISABLED;
 }
 
 void

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.191.6.5 src/sys/netinet6/ip6_output.c:1.191.6.6
--- src/sys/netinet6/ip6_output.c:1.191.6.5	Thu Mar 23 12:08:39 2023
+++ src/sys/netinet6/ip6_output.c	Fri Aug  4 14:38:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.191.6.5 2023/03/23 12:08:39 martin Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.191.6.6 2023/08/04 14:38:09 martin Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.191.6.5 2023/03/23 12:08:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.191.6.6 2023/08/04 14:38:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -197,6 +197,12 @@ ip6_if_output(struct ifnet * const ifp, 
 		}
 	}
 
+	/* discard the packet if IPv6 operation is disabled on the interface */
+	if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)) {
+		m_freem(m);
+		return ENETDOWN; /* better error? */
+	}
+
 	if ((ifp->if_flags & IFF_LOOPBACK) != 0)
 		error = if_output_lock(ifp, origifp, m, sin6tocsa(dst), rt);
 	else



CVS commit: [netbsd-8] src/sys/netinet6

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 14:38:09 UTC 2023

Modified Files:
src/sys/netinet6 [netbsd-8]: in6.c ip6_output.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1884):

sys/netinet6/in6.c: revision 1.289
sys/netinet6/ip6_output.c: revision 1.234

in6: clear ND6_IFF_IFDISABLED to allow DAD again on link-up

in6: don't send any IPv6 packets over a disabled interface


To generate a diff of this commit:
cvs rdiff -u -r1.245.2.13 -r1.245.2.14 src/sys/netinet6/in6.c
cvs rdiff -u -r1.191.6.5 -r1.191.6.6 src/sys/netinet6/ip6_output.c

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



CVS commit: [netbsd-8] src/sys/netinet6

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 14:24:16 UTC 2023

Modified Files:
src/sys/netinet6 [netbsd-8]: in6_src.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1883):

sys/netinet6/in6_src.c: revision 1.92

in6: add missing rtcache_unref to in6_selectroute

By default, this issue is harmless.  However, if NET_MPSAFE
is enabled, it could eventually lead to a kernel panic.


To generate a diff of this commit:
cvs rdiff -u -r1.79.6.3 -r1.79.6.4 src/sys/netinet6/in6_src.c

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



CVS commit: [netbsd-8] src/sys/netinet6

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 14:24:16 UTC 2023

Modified Files:
src/sys/netinet6 [netbsd-8]: in6_src.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1883):

sys/netinet6/in6_src.c: revision 1.92

in6: add missing rtcache_unref to in6_selectroute

By default, this issue is harmless.  However, if NET_MPSAFE
is enabled, it could eventually lead to a kernel panic.


To generate a diff of this commit:
cvs rdiff -u -r1.79.6.3 -r1.79.6.4 src/sys/netinet6/in6_src.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/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.79.6.3 src/sys/netinet6/in6_src.c:1.79.6.4
--- src/sys/netinet6/in6_src.c:1.79.6.3	Wed Aug 11 17:24:42 2021
+++ src/sys/netinet6/in6_src.c	Fri Aug  4 14:24:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.79.6.3 2021/08/11 17:24:42 martin Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.79.6.4 2023/08/04 14:24:16 martin Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.79.6.3 2021/08/11 17:24:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.79.6.4 2023/08/04 14:24:16 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -704,6 +704,7 @@ in6_selectroute(struct sockaddr_in6 *dst
 			if (count_discard)
 in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard);
 			error = EHOSTUNREACH;
+			rtcache_unref(rt, *ro);
 			rt = NULL;
 		}
 	}



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

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 13:58:11 UTC 2023

Modified Files:
src/sys/kern [netbsd-8]: init_main.c

Log Message:
Apply patch, requested by riastradh in ticket #1882 (issue solved differently
in -current):

sys/kern/init_main.c(apply patch)

PR kern/55906: create the aiodone workqueue before running mountroothooks.


To generate a diff of this commit:
cvs rdiff -u -r1.490.6.2 -r1.490.6.3 src/sys/kern/init_main.c

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



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

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 13:58:11 UTC 2023

Modified Files:
src/sys/kern [netbsd-8]: init_main.c

Log Message:
Apply patch, requested by riastradh in ticket #1882 (issue solved differently
in -current):

sys/kern/init_main.c(apply patch)

PR kern/55906: create the aiodone workqueue before running mountroothooks.


To generate a diff of this commit:
cvs rdiff -u -r1.490.6.2 -r1.490.6.3 src/sys/kern/init_main.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/init_main.c
diff -u src/sys/kern/init_main.c:1.490.6.2 src/sys/kern/init_main.c:1.490.6.3
--- src/sys/kern/init_main.c:1.490.6.2	Sat Feb  6 15:22:19 2021
+++ src/sys/kern/init_main.c	Fri Aug  4 13:58:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.490.6.2 2021/02/06 15:22:19 martin Exp $	*/
+/*	$NetBSD: init_main.c,v 1.490.6.3 2023/08/04 13:58:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.2 2021/02/06 15:22:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.3 2023/08/04 13:58:11 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -638,6 +638,11 @@ main(void)
 	cpu_rootconf();
 	cpu_dumpconf();
 
+	/* Create the aiodone daemon kernel thread. */
+	if (workqueue_create(_queue, "aiodoned",
+	uvm_aiodone_worker, NULL, PRI_VM, IPL_NONE, WQ_MPSAFE))
+		panic("fork aiodoned");
+
 	/* Mount the root file system. */
 	do {
 		domountroothook(root_device);
@@ -697,11 +702,6 @@ main(void)
 	NULL, NULL, "ioflush"))
 		panic("fork syncer");
 
-	/* Create the aiodone daemon kernel thread. */
-	if (workqueue_create(_queue, "aiodoned",
-	uvm_aiodone_worker, NULL, PRI_VM, IPL_NONE, WQ_MPSAFE))
-		panic("fork aiodoned");
-
 	/* Wait for final configure threads to complete. */
 	config_finalize_mountroot();
 



CVS commit: [netbsd-8] src/sys/uvm

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 13:15:25 UTC 2023

Modified Files:
src/sys/uvm [netbsd-8]: uvm_map.c

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

sys/uvm/uvm_map.c: revision 1.403 (patch)

mmap(2): Avoid arithmetic overflow in search for free space.

PR kern/56900


To generate a diff of this commit:
cvs rdiff -u -r1.351.2.5 -r1.351.2.6 src/sys/uvm/uvm_map.c

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



CVS commit: [netbsd-8] src/sys/uvm

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 13:15:25 UTC 2023

Modified Files:
src/sys/uvm [netbsd-8]: uvm_map.c

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

sys/uvm/uvm_map.c: revision 1.403 (patch)

mmap(2): Avoid arithmetic overflow in search for free space.

PR kern/56900


To generate a diff of this commit:
cvs rdiff -u -r1.351.2.5 -r1.351.2.6 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.351.2.5 src/sys/uvm/uvm_map.c:1.351.2.6
--- src/sys/uvm/uvm_map.c:1.351.2.5	Sat Apr  1 16:05:00 2023
+++ src/sys/uvm/uvm_map.c	Fri Aug  4 13:15:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.351.2.5 2023/04/01 16:05:00 martin Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.351.2.6 2023/08/04 13:15:25 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.351.2.5 2023/04/01 16:05:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.351.2.6 2023/08/04 13:15:25 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -2014,7 +2014,21 @@ uvm_map_findspace(struct vm_map *map, va
 	/* Try to find the space in the red-black tree */
 
 	/* Check slot before any entry */
-	hint = topdown ? entry->next->start - length : entry->end;
+	if (topdown) {
+		KASSERTMSG(entry->next->start >= vm_map_min(map),
+		"map=%p entry=%p entry->next=%p"
+		" entry->next->start=0x%"PRIxVADDR" min=0x%"PRIxVADDR,
+		map, entry, entry->next,
+		entry->next->start, vm_map_min(map));
+		if (length > entry->next->start - vm_map_min(map))
+			hint = vm_map_min(map); /* XXX goto wraparound? */
+		else
+			hint = entry->next->start - length;
+		KASSERT(hint >= vm_map_min(map));
+	} else {
+		hint = entry->end;
+	}
+
 	switch (uvm_map_space_avail(, length, uoffset, align, flags,
 	topdown, entry)) {
 	case 1:



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

2023-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug  3 08:05:16 UTC 2023

Modified Files:
src/sys/dev [netbsd-8]: spkr.c

Log Message:
Apply addition patch to fix the build, requested by riastradh
in ticket #1868:

sys/dev/spkr.c  (apply patch)

Pacify -Wsign-compare.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/dev/spkr.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/spkr.c
diff -u src/sys/dev/spkr.c:1.7.2.1 src/sys/dev/spkr.c:1.7.2.2
--- src/sys/dev/spkr.c:1.7.2.1	Tue Aug  1 13:05:57 2023
+++ src/sys/dev/spkr.c	Thu Aug  3 08:05:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.7.2.1 2023/08/01 13:05:57 martin Exp $	*/
+/*	$NetBSD: spkr.c,v 1.7.2.2 2023/08/03 08:05:16 martin Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.7.2.1 2023/08/01 13:05:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.7.2.2 2023/08/03 08:05:16 martin Exp $");
 
 #include 
 #include 
@@ -164,7 +164,7 @@ playtone(struct spkr_softc *sc, int pitc
 		* snum / (val * sdenom));
 		return;
 	}
-	KASSERTMSG(pitch < __arraycount(pitchtab), "pitch=%d", pitch);
+	KASSERTMSG((size_t)pitch < __arraycount(pitchtab), "pitch=%d", pitch);
 
 	int fac = sc->sc_whole * (FILLTIME - sc->sc_fill);
 	int fval = FILLTIME * val;
@@ -300,7 +300,7 @@ playstring(struct spkr_softc *sc, const 
 		case 'N':
 			GETNUM(cp, pitch);
 			KASSERTMSG(pitch >= 0, "pitch=%d", pitch);
-			if (pitch >= __arraycount(pitchtab))
+			if ((size_t)pitch >= __arraycount(pitchtab))
 break;
 			for (sustain = 0; slen > 0 && cp[1] == '.'; cp++) {
 slen--;



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

2023-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug  3 08:05:16 UTC 2023

Modified Files:
src/sys/dev [netbsd-8]: spkr.c

Log Message:
Apply addition patch to fix the build, requested by riastradh
in ticket #1868:

sys/dev/spkr.c  (apply patch)

Pacify -Wsign-compare.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/dev/spkr.c

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



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

2023-08-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  2 10:24:17 UTC 2023

Modified Files:
src/sys/dev/usb [netbsd-8]: ehci.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1877):

sys/dev/usb/ehci.c: revision 1.317

PR 57518: usb keyboard causes host controller to miss microframe

As per the USB 2.0 specification section 11.18.4; paragraph 3.b
For interrupt IN/OUT full-/low-speed transactions, the host must  schedule a
complete-split transaction in each of the two microframes following the
first microframe in which the full-/low-speed transaction is budgeted. An
additional complete-split must also be scheduled in the third following
microframe unless the full-/low-speed transaction was budgeted to start
in microframe Y6.


To generate a diff of this commit:
cvs rdiff -u -r1.254.8.7 -r1.254.8.8 src/sys/dev/usb/ehci.c

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



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

2023-08-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  2 10:24:17 UTC 2023

Modified Files:
src/sys/dev/usb [netbsd-8]: ehci.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1877):

sys/dev/usb/ehci.c: revision 1.317

PR 57518: usb keyboard causes host controller to miss microframe

As per the USB 2.0 specification section 11.18.4; paragraph 3.b
For interrupt IN/OUT full-/low-speed transactions, the host must  schedule a
complete-split transaction in each of the two microframes following the
first microframe in which the full-/low-speed transaction is budgeted. An
additional complete-split must also be scheduled in the third following
microframe unless the full-/low-speed transaction was budgeted to start
in microframe Y6.


To generate a diff of this commit:
cvs rdiff -u -r1.254.8.7 -r1.254.8.8 src/sys/dev/usb/ehci.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.254.8.7 src/sys/dev/usb/ehci.c:1.254.8.8
--- src/sys/dev/usb/ehci.c:1.254.8.7	Tue Feb 25 18:52:44 2020
+++ src/sys/dev/usb/ehci.c	Wed Aug  2 10:24:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.254.8.7 2020/02/25 18:52:44 martin Exp $ */
+/*	$NetBSD: ehci.c,v 1.254.8.8 2023/08/02 10:24:16 martin Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.254.8.7 2020/02/25 18:52:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.254.8.8 2023/08/02 10:24:16 martin Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1989,14 +1989,17 @@ ehci_open(struct usbd_pipe *pipe)
 		);
 		sqh->qh.qh_endphub = htole32(
 		EHCI_QH_SET_MULT(1) |
-		EHCI_QH_SET_SMASK(xfertype == UE_INTERRUPT ? 0x02 : 0)
+		(xfertype == UE_INTERRUPT ?
+			EHCI_QH_SET_SMASK(__BIT(1))	   /* Start Split Y1 */
+			: 0)
 		);
 		if (speed != EHCI_QH_SPEED_HIGH)
 			sqh->qh.qh_endphub |= htole32(
 			EHCI_QH_SET_PORT(hshubport) |
 			EHCI_QH_SET_HUBA(hshubaddr) |
 			(xfertype == UE_INTERRUPT ?
- EHCI_QH_SET_CMASK(0x08) : 0)
+ EHCI_QH_SET_CMASK(__BITS(3,5)) /* CS Y[345] */
+ : 0)
 			);
 		sqh->qh.qh_curqtd = EHCI_NULL;
 		/* Fill the overlay qTD */



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:29:15 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

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

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.5 -r1.2.10.6 \
src/sys/external/bsd/drm2/linux/linux_ww_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/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.5 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.6
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.5	Tue Aug  1 17:19:57 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 17:29:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.6 2023/08/01 17:29:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.6 2023/08/01 17:29:15 martin Exp $");
 
 #include 
 #include 
@@ -271,8 +271,14 @@ ww_mutex_state_wait(struct ww_mutex *mut
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (mutex->wwm_state == state);
+
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state)
+			break;
+	}
+
+	KASSERT(mutex->wwm_state != state);
 }
 
 /*
@@ -295,18 +301,26 @@ ww_mutex_state_wait_sig(struct ww_mutex 
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do {
+
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
 			break;
 		}
-	} while (mutex->wwm_state == state);
+	}
 
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERTMSG(ret != 0 || mutex->wwm_state != state,
+	"ret=%d mutex=%p mutex->wwm_state=%d state=%d",
+	ret, mutex, mutex->wwm_state, state);
 	return ret;
 }
 
@@ -348,12 +362,18 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		 (mutex->wwm_u.ctx == ctx)));
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx)
+			break;
+	}
 
 	rb_tree_remove_node(>wwm_waiters, ctx);
+
+	KASSERT(mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(mutex->wwm_u.ctx == ctx);
 }
 
 /*
@@ -396,21 +416,29 @@ ww_mutex_lock_wait_sig(struct ww_mutex *
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do {
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
-			goto out;
+			break;
 		}
-	} while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		(mutex->wwm_u.ctx == ctx)));
+	}
+
+	rb_tree_remove_node(>wwm_waiters, ctx);
 
-out:	rb_tree_remove_node(>wwm_waiters, ctx);
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERT(ret != 0 ||
+	mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(ret != 0 || mutex->wwm_u.ctx == ctx);
 	return ret;
 }
 



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:29:15 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

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

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.5 -r1.2.10.6 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:19:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

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

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.10

drm: Spruce up ww_mutex comments.  Audit return values.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.4 -r1.2.10.5 \
src/sys/external/bsd/drm2/linux/linux_ww_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/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.4 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.5
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.4	Tue Aug  1 16:58:07 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 17:19:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $");
 
 #include 
 #include 
@@ -168,6 +168,13 @@ static lockops_t ww_lockops = {
 };
 #endif
 
+/*
+ * ww_mutex_init(mutex, class)
+ *
+ *	Initialize mutex in the given class.  Must precede any other
+ *	ww_mutex_* operations.  After done, mutex must be destroyed
+ *	with ww_mutex_destroy.
+ */
 void
 ww_mutex_init(struct ww_mutex *mutex, struct ww_class *class)
 {
@@ -187,6 +194,13 @@ ww_mutex_init(struct ww_mutex *mutex, st
 #endif
 }
 
+/*
+ * ww_mutex_destroy(mutex)
+ *
+ *	Destroy mutex initialized by ww_mutex_init.  Caller must not be
+ *	with any other ww_mutex_* operations except after
+ *	reinitializing with ww_mutex_init.
+ */
 void
 ww_mutex_destroy(struct ww_mutex *mutex)
 {
@@ -205,9 +219,15 @@ ww_mutex_destroy(struct ww_mutex *mutex)
 }
 
 /*
- * XXX WARNING: This returns true if it is locked by ANYONE.  Does not
- * mean `Do I hold this lock?' (answering which really requires an
- * acquire context).
+ * ww_mutex_is_locked(mutex)
+ *
+ *	True if anyone holds mutex locked at the moment, false if not.
+ *	Answer is stale as soon returned unless mutex is held by
+ *	caller.
+ *
+ *	XXX WARNING: This returns true if it is locked by ANYONE.  Does
+ *	not mean `Do I hold this lock?' (answering which really
+ *	requires an acquire context).
  */
 bool
 ww_mutex_is_locked(struct ww_mutex *mutex)
@@ -233,33 +253,78 @@ ww_mutex_is_locked(struct ww_mutex *mute
 	return locked;
 }
 
+/*
+ * ww_mutex_state_wait(mutex, state)
+ *
+ *	Wait for mutex, which must be in the given state, to transition
+ *	to another state.  Uninterruptible; never fails.
+ *
+ *	Caller must hold mutex's internal lock.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static void
 ww_mutex_state_wait(struct ww_mutex *mutex, enum ww_mutex_state state)
 {
 
+	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
 	do cv_wait(>wwm_cv, >wwm_lock);
 	while (mutex->wwm_state == state);
 }
 
+/*
+ * ww_mutex_state_wait_sig(mutex, state)
+ *
+ *	Wait for mutex, which must be in the given state, to transition
+ *	to another state, or fail if interrupted by a signal.  Return 0
+ *	on success, -EINTR if interrupted by a signal.
+ *
+ *	Caller must hold mutex's internal lock.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static int
 ww_mutex_state_wait_sig(struct ww_mutex *mutex, enum ww_mutex_state state)
 {
 	int ret;
 
+	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
 	do {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
-		if (ret == -ERESTART)
-			ret = -ERESTARTSYS;
-		if (ret)
+		if (ret) {
+			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
+			"ret=%d", ret);
+			ret = -EINTR;
 			break;
+		}
 	} while (mutex->wwm_state == state);
 
+	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
 	return ret;
 }
 
+/*
+ * ww_mutex_lock_wait(mutex, ctx)
+ *
+ *	With mutex locked and in the WW_CTX or WW_WANTOWN state, owned
+ *	by another thread with an acquire context, wait to acquire
+ *	mutex.  While waiting, record ctx in the tree of waiters.  Does
+ *	not update the mutex state otherwise.
+ *
+ *	Caller must not already hold mutex.  Caller must hold mutex's
+ *	internal lock.  Uninterruptible; never fails.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static void
 ww_mutex_lock_wait(struct ww_mutex *mutex, struct ww_acquire_ctx *ctx)
 {
@@ -291,6 +356,22 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	rb_tree_remove_node(>wwm_waiters, ctx);
 }
 
+/*
+ * ww_mutex_lock_wait_sig(mutex, ctx)
+ *
+ *	With mutex locked and in the WW_CTX or 

CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:19:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

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

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.10

drm: Spruce up ww_mutex comments.  Audit return values.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.4 -r1.2.10.5 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:58:07 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

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

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.3 -r1.2.10.4 \
src/sys/external/bsd/drm2/linux/linux_ww_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/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.3 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.4
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.3	Tue Apr 23 10:16:52 2019
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 16:58:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.3 2019/04/23 10:16:52 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.3 2019/04/23 10:16:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ ww_acquire_ctx_compare(void *cookie __un
 	if (ctx_a->wwx_ticket < ctx_b->wwx_ticket)
 		return -1;
 	if (ctx_a->wwx_ticket > ctx_b->wwx_ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 
@@ -76,7 +76,7 @@ ww_acquire_ctx_compare_key(void *cookie 
 	if (ctx->wwx_ticket < ticket)
 		return -1;
 	if (ctx->wwx_ticket > ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:58:07 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

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

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.3 -r1.2.10.4 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:40:09 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-8]: acpi_func.h

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

sys/dev/acpi/acpica/acpi_func.h: revision 1.7 (patch)

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.52.1 src/sys/dev/acpi/acpica/acpi_func.h

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

Modified files:

Index: src/sys/dev/acpi/acpica/acpi_func.h
diff -u src/sys/dev/acpi/acpica/acpi_func.h:1.4 src/sys/dev/acpi/acpica/acpi_func.h:1.4.52.1
--- src/sys/dev/acpi/acpica/acpi_func.h:1.4	Sat Jul 24 21:53:54 2010
+++ src/sys/dev/acpi/acpica/acpi_func.h	Tue Aug  1 15:40:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_func.h,v 1.4 2010/07/24 21:53:54 jruoho Exp $	*/
+/*	$NetBSD: acpi_func.h,v 1.4.52.1 2023/08/01 15:40:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Michael Smith
@@ -62,6 +62,7 @@ acpi_acquire_global_lock(uint32_t *lock)
 		((old >> 1) & GL_BIT_PENDING);
 		val = atomic_cas_32(lock, old, new);
 	} while (__predict_false(val != old));
+	membar_enter();		/* XXX expensive for acquire semantics */
 
 	return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
 }
@@ -71,6 +72,7 @@ acpi_release_global_lock(uint32_t *lock)
 {
 	uint32_t new, old, val;
 
+	membar_exit();		/* release semantics */
 	do {
 		old = *lock;
 		new = old & ~GL_BIT_MASK;



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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:40:09 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-8]: acpi_func.h

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

sys/dev/acpi/acpica/acpi_func.h: revision 1.7 (patch)

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.52.1 src/sys/dev/acpi/acpica/acpi_func.h

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



CVS commit: [netbsd-8] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:32:23 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-8]: tmpfs_subr.c

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

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.8.1 src/sys/fs/tmpfs/tmpfs_subr.c

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

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.102 src/sys/fs/tmpfs/tmpfs_subr.c:1.102.8.1
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.102	Wed Jan  4 10:06:43 2017
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Tue Aug  1 15:32:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $	*/
+/*	$NetBSD: tmpfs_subr.c,v 1.102.8.1 2023/08/01 15:32:23 martin Exp $	*/
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.102.8.1 2023/08/01 15:32:23 martin Exp $");
 
 #include 
 #include 
@@ -514,6 +514,7 @@ tmpfs_dir_attach(tmpfs_node_t *dnode, tm
 
 	/* Insert the entry to the directory (parent of inode). */
 	TAILQ_INSERT_TAIL(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size <= __type_max(off_t) - sizeof(tmpfs_dirent_t));
 	dnode->tn_size += sizeof(tmpfs_dirent_t);
 	uvm_vnp_setsize(dvp, dnode->tn_size);
 
@@ -580,6 +581,7 @@ tmpfs_dir_detach(tmpfs_node_t *dnode, tm
 		dnode->tn_spec.tn_dir.tn_readdir_lastp = NULL;
 	}
 	TAILQ_REMOVE(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size >= sizeof(tmpfs_dirent_t));
 	dnode->tn_size -= sizeof(tmpfs_dirent_t);
 	tmpfs_dir_putseq(dnode, de);
 
@@ -908,6 +910,9 @@ tmpfs_reg_resize(struct vnode *vp, off_t
 	KASSERT(vp->v_type == VREG);
 	KASSERT(newsize >= 0);
 
+	if (newsize > __type_max(off_t) - PAGE_SIZE + 1)
+		return EFBIG;
+
 	oldsize = node->tn_size;
 	oldpages = round_page(oldsize) >> PAGE_SHIFT;
 	newpages = round_page(newsize) >> PAGE_SHIFT;



CVS commit: [netbsd-8] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:32:23 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-8]: tmpfs_subr.c

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

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.8.1 src/sys/fs/tmpfs/tmpfs_subr.c

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



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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:01:56 UTC 2023

Modified Files:
src/sys/dev/isapnp [netbsd-8]: sb_isapnp.c
src/sys/dev/ofisa [netbsd-8]: sb_ofisa.c

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

sys/dev/isapnp/sb_isapnp.c: revision 1.54
sys/dev/ofisa/sb_ofisa.c: revision 1.24

sb(4): Fix missing mutex initialization at isapnp and ofisa.
PR kern/57363


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.84.1 src/sys/dev/isapnp/sb_isapnp.c
cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/dev/ofisa/sb_ofisa.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/isapnp/sb_isapnp.c
diff -u src/sys/dev/isapnp/sb_isapnp.c:1.52 src/sys/dev/isapnp/sb_isapnp.c:1.52.84.1
--- src/sys/dev/isapnp/sb_isapnp.c:1.52	Sat Mar 15 21:09:02 2008
+++ src/sys/dev/isapnp/sb_isapnp.c	Tue Aug  1 15:01:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sb_isapnp.c,v 1.52 2008/03/15 21:09:02 cube Exp $	*/
+/*	$NetBSD: sb_isapnp.c,v 1.52.84.1 2023/08/01 15:01:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sb_isapnp.c,v 1.52 2008/03/15 21:09:02 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sb_isapnp.c,v 1.52.84.1 2023/08/01 15:01:55 martin Exp $");
 
 #include 
 #include 
@@ -159,6 +159,9 @@ sb_isapnp_attach(device_t parent, device
 		return;
 	}
 
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
+
 	sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
 	ipa->ipa_irq[0].type, IPL_AUDIO, sbdsp_intr, sc);
 

Index: src/sys/dev/ofisa/sb_ofisa.c
diff -u src/sys/dev/ofisa/sb_ofisa.c:1.18 src/sys/dev/ofisa/sb_ofisa.c:1.18.8.1
--- src/sys/dev/ofisa/sb_ofisa.c:1.18	Fri Dec  9 17:18:35 2016
+++ src/sys/dev/ofisa/sb_ofisa.c	Tue Aug  1 15:01:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sb_ofisa.c,v 1.18 2016/12/09 17:18:35 christos Exp $	*/
+/*	$NetBSD: sb_ofisa.c,v 1.18.8.1 2023/08/01 15:01:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sb_ofisa.c,v 1.18 2016/12/09 17:18:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sb_ofisa.c,v 1.18.8.1 2023/08/01 15:01:56 martin Exp $");
 
 #include 
 #include 
@@ -175,6 +175,9 @@ sb_ofisa_attach(device_t parent, device_
 		return;
 	}
 
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
+
 	sc->sc_ih = isa_intr_establish(aa->ic, intr.irq, IST_EDGE, IPL_AUDIO,
 	sbdsp_intr, sc);
 



  1   2   3   4   5   6   7   >