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

2025-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 22 12:19:57 UTC 2025

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1055):

sys/dev/pci/if_vioif.c: revision 1.114

PR kern/59086:
use right byte size of data resource to be freed instead of sizeof pointer
use of sizeof pointer frees only 8 bytes of the large vioif_tx_context struct
which leaks the rest of the memory


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.5 -r1.82.4.6 src/sys/dev/pci/if_vioif.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_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.82.4.5 src/sys/dev/pci/if_vioif.c:1.82.4.6
--- src/sys/dev/pci/if_vioif.c:1.82.4.5	Wed Aug  7 09:58:20 2024
+++ src/sys/dev/pci/if_vioif.c	Sat Feb 22 12:19:57 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.82.4.5 2024/08/07 09:58:20 martin Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.82.4.6 2025/02/22 12:19:57 martin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.5 2024/08/07 09:58:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.6 2025/02/22 12:19:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1291,7 +1291,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 
 		for (i = 0; i < vq_num; i++) {
 			maps[i].vnm_hdr = &hdrs[i];
-	
+
 			r = vioif_dmamap_create_load(sc, &maps[i].vnm_hdr_map,
 			maps[i].vnm_hdr, sc->sc_hdr_size, 1,
 			dmaparams[dir].dma_flag, dmaparams[dir].msg_hdr);
@@ -1531,7 +1531,7 @@ err:
 			softint_disestablish(txc->txc_deferred_transmit);
 		if (txc->txc_intrq != NULL)
 			pcq_destroy(txc->txc_intrq);
-		kmem_free(txc, sizeof(txc));
+		kmem_free(txc, sizeof(*txc));
 	}
 
 	vioif_work_set(&netq->netq_work, NULL, NULL);



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

2025-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 22 12:19:57 UTC 2025

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1055):

sys/dev/pci/if_vioif.c: revision 1.114

PR kern/59086:
use right byte size of data resource to be freed instead of sizeof pointer
use of sizeof pointer frees only 8 bytes of the large vioif_tx_context struct
which leaks the rest of the memory


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.5 -r1.82.4.6 src/sys/dev/pci/if_vioif.c

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



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

2025-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 22 12:08:10 UTC 2025

Modified Files:
src/sys/dev/pci [netbsd-10]: if_gem_pci.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1054):

sys/dev/pci/if_gem_pci.c: revision 1.54
sys/dev/pci/if_gem_pci.c: revision 1.55

use the right buffer size for shared pin check and debug
avoid the use of sizeof(pointer) and use the Temp BUF limit.

Use "int" format for constant "GEM_TMP_BUFSIZE - 1".
Kernel ALL/amd64 builds again.


To generate a diff of this commit:
cvs rdiff -u -r1.52.20.1 -r1.52.20.2 src/sys/dev/pci/if_gem_pci.c

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



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

2025-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 22 12:08:10 UTC 2025

Modified Files:
src/sys/dev/pci [netbsd-10]: if_gem_pci.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1054):

sys/dev/pci/if_gem_pci.c: revision 1.54
sys/dev/pci/if_gem_pci.c: revision 1.55

use the right buffer size for shared pin check and debug
avoid the use of sizeof(pointer) and use the Temp BUF limit.

Use "int" format for constant "GEM_TMP_BUFSIZE - 1".
Kernel ALL/amd64 builds again.


To generate a diff of this commit:
cvs rdiff -u -r1.52.20.1 -r1.52.20.2 src/sys/dev/pci/if_gem_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/if_gem_pci.c
diff -u src/sys/dev/pci/if_gem_pci.c:1.52.20.1 src/sys/dev/pci/if_gem_pci.c:1.52.20.2
--- src/sys/dev/pci/if_gem_pci.c:1.52.20.1	Sat Feb 22 12:04:11 2025
+++ src/sys/dev/pci/if_gem_pci.c	Sat Feb 22 12:08:10 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gem_pci.c,v 1.52.20.1 2025/02/22 12:04:11 martin Exp $ */
+/*	$NetBSD: if_gem_pci.c,v 1.52.20.2 2025/02/22 12:08:10 martin Exp $ */
 
 /*
  *
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.52.20.1 2025/02/22 12:04:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.52.20.2 2025/02/22 12:08:10 martin Exp $");
 
 #include 
 #include 
@@ -268,7 +268,7 @@ gem_pci_attach(device_t parent, device_t
 			/* Check for "shared-pins = serdes" in FCode. */
 			i = 0;
 			serdes = 0;
-			while (i < (sizeof buf) - sizeof "serdes") {
+			while (i < GEM_TMP_BUFSIZE - sizeof "serdes") {
 if (!serdes) {
 	if (isserdes(&buf[i]))
 		serdes = 1;
@@ -284,12 +284,12 @@ gem_pci_attach(device_t parent, device_t
 			}
 #ifdef GEM_DEBUG
 			/* PROM dump */
-			printf("%s: PROM dump (0x to %04zx)\n",
-			device_xname(sc->sc_dev), (sizeof buf) - 1);
+			printf("%s: PROM dump (0x to %04x)\n",
+			device_xname(sc->sc_dev), GEM_TMP_BUFSIZE - 1);
 			i = 0;
 			j = 0;
 			printf("  %04x  ", i);
-			while (i < sizeof buf) {
+			while (i < GEM_TMP_BUFSIZE ) {
 printf("%02x ", buf[i]);
 if (i && !(i % 8))
 	printf(" ");



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

2025-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 22 12:04:11 UTC 2025

Modified Files:
src/sys/dev/pci [netbsd-10]: if_gem_pci.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1053):

sys/dev/pci/if_gem_pci.c: revision 1.53

fix: wrong size of buffer limit used when reading through the pci bus
use the GEM_TMP_BUFSIZE rather than the sizeof pointer


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.20.1 src/sys/dev/pci/if_gem_pci.c

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



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

2025-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 22 12:04:11 UTC 2025

Modified Files:
src/sys/dev/pci [netbsd-10]: if_gem_pci.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1053):

sys/dev/pci/if_gem_pci.c: revision 1.53

fix: wrong size of buffer limit used when reading through the pci bus
use the GEM_TMP_BUFSIZE rather than the sizeof pointer


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.20.1 src/sys/dev/pci/if_gem_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/if_gem_pci.c
diff -u src/sys/dev/pci/if_gem_pci.c:1.52 src/sys/dev/pci/if_gem_pci.c:1.52.20.1
--- src/sys/dev/pci/if_gem_pci.c:1.52	Thu Jul  2 09:02:04 2020
+++ src/sys/dev/pci/if_gem_pci.c	Sat Feb 22 12:04:11 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gem_pci.c,v 1.52 2020/07/02 09:02:04 msaitoh Exp $ */
+/*	$NetBSD: if_gem_pci.c,v 1.52.20.1 2025/02/22 12:04:11 martin Exp $ */
 
 /*
  *
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.52 2020/07/02 09:02:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.52.20.1 2025/02/22 12:04:11 martin Exp $");
 
 #include 
 #include 
@@ -263,7 +263,7 @@ gem_pci_attach(device_t parent, device_t
 
 			/* read PCI Expansion PROM Header */
 			bus_space_read_region_1(sc->sc_bustag,
-			romh, 0, buf, sizeof buf);
+			romh, 0, buf, GEM_TMP_BUFSIZE);
 
 			/* Check for "shared-pins = serdes" in FCode. */
 			i = 0;



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

2024-12-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 31 01:30:24 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: virtio_pci.c virtioreg.h

Log Message:
Pull up following revision(s) (requested by martin in ticket #1032):
sys/dev/pci/virtioreg.h: 1.13
sys/dev/pci/virtio_pci.c: 1.44
Define the VIRTIO_F_ACCESS_PLATFORM, VIRTIO_F_RING_PACKED,
VIRTIO_F_ORDER_PLATFORM, and VIRTIO_F_SR_IOV feature bits.
--
On alpha and sparc64, use VirtIO 1.0 and VIRTIO_F_ACCESS_PLATFORM so
that DMA to PCI-attached VirtIO devices works properly.  This is needed
for Qemu to select the appropriate address space for PCI DMA.


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.5 -r1.38.4.6 src/sys/dev/pci/virtio_pci.c
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/dev/pci/virtioreg.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/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.38.4.5 src/sys/dev/pci/virtio_pci.c:1.38.4.6
--- src/sys/dev/pci/virtio_pci.c:1.38.4.5	Thu Nov 28 16:33:25 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Dec 31 01:30:24 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.38.4.5 2024/11/28 16:33:25 martin Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.38.4.6 2024/12/31 01:30:24 snj Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.38.4.5 2024/11/28 16:33:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.38.4.6 2024/12/31 01:30:24 snj Exp $");
 
 #include 
 #include 
@@ -51,6 +51,15 @@ __KERNEL_RCSID(0, "$NetBSD: virtio_pci.c
 #define VIRTIO_PRIVATE
 #include  /* XXX: move to non-pci */
 
+#if defined(__alpha__) || defined(__sparc64__)
+/*
+ * XXX VIRTIO_F_ACCESS_PLATFORM is required for standard PCI DMA
+ * XXX to work on these platforms, at least by Qemu.
+ * XXX
+ * XXX Generalize this later.
+ */
+#define	__NEED_VIRTIO_F_ACCESS_PLATFORM
+#endif /* __alpha__ || __sparc64__ */
 
 #define VIRTIO_PCI_LOG(_sc, _use_log, _fmt, _args...)	\
 do {			\
@@ -277,8 +286,28 @@ virtio_pci_attach(device_t parent, devic
 		ret = virtio_pci_attach_10(self, aux);
 	}
 	if (ret == 0 && revision == 0) {
-		/* revision 0 means 0.9 only or both 0.9 and 1.0 */
+		/*
+		 * revision 0 means 0.9 only or both 0.9 and 1.0.  The
+		 * latter are so-called "Transitional Devices".  For
+		 * those devices, we want to use the 1.0 interface if
+		 * possible.
+		 *
+		 * XXX Currently only on platforms that require 1.0
+		 * XXX features, such as VIRTIO_F_ACCESS_PLATFORM.
+		 */
+#ifdef __NEED_VIRTIO_F_ACCESS_PLATFORM
+		/* First, try to attach 1.0 */
+		ret = virtio_pci_attach_10(self, aux);
+		if (ret != 0) {
+			aprint_error_dev(self,
+			"VirtIO 1.0 error = %d, falling back to 0.9\n",
+			ret);
+			/* Fall back to 0.9. */
+			ret = virtio_pci_attach_09(self, aux);
+		}
+#else
 		ret = virtio_pci_attach_09(self, aux);
+#endif /* __NEED_VIRTIO_F_ACCESS_PLATFORM */
 	}
 	if (ret) {
 		aprint_error_dev(self, "cannot attach (%d)\n", ret);
@@ -798,6 +827,10 @@ virtio_pci_negotiate_features_10(struct 
 	uint64_t host, negotiated, device_status;
 
 	guest_features |= VIRTIO_F_VERSION_1;
+#ifdef __NEED_VIRTIO_F_ACCESS_PLATFORM
+	/* XXX This could use some work. */
+	guest_features |= VIRTIO_F_ACCESS_PLATFORM;
+#endif /* __NEED_VIRTIO_F_ACCESS_PLATFORM */
 	/* notify on empty is 0.9 only */
 	guest_features &= ~VIRTIO_F_NOTIFY_ON_EMPTY;
 	sc->sc_active_features = 0;

Index: src/sys/dev/pci/virtioreg.h
diff -u src/sys/dev/pci/virtioreg.h:1.11.2.1 src/sys/dev/pci/virtioreg.h:1.11.2.2
--- src/sys/dev/pci/virtioreg.h:1.11.2.1	Sat May 13 10:56:10 2023
+++ src/sys/dev/pci/virtioreg.h	Tue Dec 31 01:30:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtioreg.h,v 1.11.2.1 2023/05/13 10:56:10 martin Exp $	*/
+/*	$NetBSD: virtioreg.h,v 1.11.2.2 2024/12/31 01:30:24 snj Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -84,6 +84,10 @@
 #define  VIRTIO_F_RING_EVENT_IDX		__BIT(29)
 #define  VIRTIO_F_BAD_FEATURE			__BIT(30)
 #define  VIRTIO_F_VERSION_1			__BIT(32)
+#define  VIRTIO_F_ACCESS_PLATFORM		__BIT(33)
+#define  VIRTIO_F_RING_PACKED			__BIT(34)
+#define  VIRTIO_F_ORDER_PLATFORM		__BIT(36)
+#define  VIRTIO_F_SR_IOV			__BIT(37)
 
 /* common device status flags */
 #define  VIRTIO_CONFIG_DEVICE_STATUS_RESET		  0
@@ -101,6 +105,10 @@
 /* common device/guest features */
 #define VIRTIO_COMMON_FLAG_BITS			\
 "\177\020"\
+	"b\x24" "SR_IOV\0"			\
+	"b\x23" "ORDER_PLATFORM\0"		\
+	"b\x22" "RING_PACKED\0"			\
+	"b\x21" "ACCESS_PLATFORM\0"		\
 	"b\x20" "V1\0"\
 	"b\x1e" "BAD_FEATURE\0"			\
 	"b\x1d" "EVENT_IDX\0"			\



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

2024-12-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 31 01:30:24 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: virtio_pci.c virtioreg.h

Log Message:
Pull up following revision(s) (requested by martin in ticket #1032):
sys/dev/pci/virtioreg.h: 1.13
sys/dev/pci/virtio_pci.c: 1.44
Define the VIRTIO_F_ACCESS_PLATFORM, VIRTIO_F_RING_PACKED,
VIRTIO_F_ORDER_PLATFORM, and VIRTIO_F_SR_IOV feature bits.
--
On alpha and sparc64, use VirtIO 1.0 and VIRTIO_F_ACCESS_PLATFORM so
that DMA to PCI-attached VirtIO devices works properly.  This is needed
for Qemu to select the appropriate address space for PCI DMA.


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.5 -r1.38.4.6 src/sys/dev/pci/virtio_pci.c
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/dev/pci/virtioreg.h

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



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

2024-12-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  6 20:18:59 UTC 2024

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

Log Message:
regen for ticket 1024


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.14 -r1.1452.2.15 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.14 -r1.1451.2.15 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-10] src/sys/dev/pci

2024-12-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  6 20:18:59 UTC 2024

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

Log Message:
regen for ticket 1024


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.14 -r1.1452.2.15 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.14 -r1.1451.2.15 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-10] src/sys/dev/pci

2024-12-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  6 20:15:04 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1024):
sys/dev/pci/pcidevs: 1.504-1.506, 1.508-1.513
Update pcidevs:
 - Add Zhaoxin devices, mainly from my TVS-675 NAS device, and some additional
   to fill the gaps from pci-ids database.
 - Add Phison PS5021 and PS5026.
 - Add some Intel Rapotr Lake graphics.
 - Add Realtek RTL8126.
 - Add the intel "arc" a-series of cards.
 - Add Areca ARC-1224.
 - Add some AMD devices.
 - Add Raspberry Pi5 Ethernet.
 - Add many Brainboxes devices. Reported in PR kern/55824 by Cameron Williams.


To generate a diff of this commit:
cvs rdiff -u -r1.1471.2.13 -r1.1471.2.14 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.1471.2.13 src/sys/dev/pci/pcidevs:1.1471.2.14
--- src/sys/dev/pci/pcidevs:1.1471.2.13	Sat Aug 24 08:29:47 2024
+++ src/sys/dev/pci/pcidevs	Fri Dec  6 20:15:04 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1471.2.13 2024/08/24 08:29:47 martin Exp $
+$NetBSD: pcidevs,v 1.1471.2.14 2024/12/06 20:15:04 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -652,9 +652,11 @@ vendor SYMPHONY2	0x1c1c	Symphony Labs (2
 vendor HGST		0x1c58	HGST, Inc.
 vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor AMAZON		0x1d0f	Amazon.com, Inc.
+vendor ZHAOXIN		0x1d17	Zhaoxin
 vendor AQUANTIA		0x1d6a	Aquantia
 vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
+vendor RASPBERRYPI	0x1de4	Raspberry Pi (Trading) Limited
 vendor AMPERE		0x1def	Ampere Computing
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
@@ -976,6 +978,14 @@ product AMD AMD64_F10_ADDR	0x1201	AMD64 
 product AMD AMD64_F10_DRAM	0x1202	AMD64 Family10h DRAM Configuration
 product AMD AMD64_F10_MISC	0x1203	AMD64 Family10h Miscellaneous Configuration
 product AMD AMD64_F10_LINK	0x1204	AMD64 Family10h Link Configuration
+product AMD F1A_0X_DF_0		0x12c0	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_1		0x12c1	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_2		0x12c2	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_3		0x12c3	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_4		0x12c4	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_5		0x12c5	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_6		0x12c6	1Ah/0xh Data Fabric
+product AMD F1A_0X_DF_7		0x12c7	1Ah/0xh Data Fabric
 product AMD AMD64_F11_HT	0x1300	AMD64 Family11h HyperTransport Configuration
 product AMD AMD64_F11_ADDR	0x1301	AMD64 Family11h Address Map Configuration
 product AMD AMD64_F11_DRAM	0x1302	AMD64 Family11h DRAM Configuration
@@ -1121,9 +1131,23 @@ product AMD F16_MISC		0x1535	Family16h M
 product AMD F16_RC		0x1536	Family16h Root Complex
 product AMD F16_CCP		0x1537	Family16h Cryptographic Coprocessor
 product AMD F16_HB		0x1538	Family16h Host Bridge
+product AMD F1A_0X_RC		0x153a	1Ah/0xh Root Complex
+product AMD F1A_0X_IOMMU	0x153b	1Ah/0xh IOMMU
+product AMD F1A_0X_PCIE_DUMMY_HB 0x153d	1Ah/0xh PCIe Dummy Host Bridge
+product AMD F1A_0X_GPPB_1	0x153e	1Ah/0xh PCIe GPP Bridge
+product AMD F1A_0X_GPPB_2	0x153f	1Ah/0xh PCIe GPP Bridge
+product AMD F1A_0X_GPPB_3	0x1554	1Ah/0xh PCIe GPP Bridge
+product AMD F1A_0X_INTNL_GPPB	0x1555	1Ah/0xh Internal PCIe GPP Bridge
+product AMD F1A_0X_PCIE_DUMMY	0x1556	1Ah/0xh PCIe Dummy Function
+product AMD F1A_0X_XHCI_0	0x1557	1Ah/0xh USB 3.2 xHCI
+product AMD F1A_0X_SW_US	0x1558	1Ah/0xh SW.US
+product AMD F1A_0X_PCIE_DUMMY_2	0x1559	1Ah/0xh Secondary PCIe Dummy Function
+product AMD F1A_0X_NTB_1	0x155a	1Ah/0xh PCIe Non Transparent Bridge
 product AMD F16_30_RC		0x1566	Family16h Root Complex
 product AMD F16_30_IOMMU	0x1567	Family16h IOMMU
 product AMD F16_30_HB		0x156b	Family16h Host Bridge
+product AMD F1A_0X_SW_DS	0x156c	1Ah/0xh SW.DS
+product AMD F1A_0X_ASP		0x156e	1Ah/0xh ASP
 product AMD F15_6X_PF_0		0x1570	15h/6xh Processor Function 0
 product AMD F15_6X_PF_1		0x1571	15h/6xh Processor Function 1
 product AMD F15_6X_PF_2		0x1572	15h/6xh Processor Function 2
@@ -1493,6 +1517,7 @@ product ARECA ARC1203		0x1203	ARC-1203
 product ARECA ARC1210		0x1210	ARC-1210
 product ARECA ARC1214 		0x1214	ARC-1214
 product ARECA ARC1220		0x1220	ARC-1220
+product ARECA ARC1224		0x1224	ARC-1224
 product ARECA ARC1230		0x1230	ARC-1230
 product ARECA ARC1260		0x1260	ARC-1260
 product ARECA ARC1270		0x1270	ARC-1270
@@ -2557,7 +2582,37 @@ product BRAINBOXES IS100	0x0d60	Intashie
 product BRAINBOXES IS200	0x0d80	Intashield IS-200
 product BRAINBOXES IS300	0x0da0	Intashield IS-300
 product BRAINBOXES IS400	0x0dc0	Intashield IS-400
+product BRAINBOXES PX279	0x0e41	Brainboxes PX-279
 product BRAINBOXES UC414	0x0e61	Brainboxes UC-414
+product BRAINBOXES PX420	0x4000	Brainboxes PX-420
+product BRAINBOXES PX431	0x4001	Brainboxes PX-431
+produc

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

2024-12-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  6 20:15:04 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1024):
sys/dev/pci/pcidevs: 1.504-1.506, 1.508-1.513
Update pcidevs:
 - Add Zhaoxin devices, mainly from my TVS-675 NAS device, and some additional
   to fill the gaps from pci-ids database.
 - Add Phison PS5021 and PS5026.
 - Add some Intel Rapotr Lake graphics.
 - Add Realtek RTL8126.
 - Add the intel "arc" a-series of cards.
 - Add Areca ARC-1224.
 - Add some AMD devices.
 - Add Raspberry Pi5 Ethernet.
 - Add many Brainboxes devices. Reported in PR kern/55824 by Cameron Williams.


To generate a diff of this commit:
cvs rdiff -u -r1.1471.2.13 -r1.1471.2.14 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-10] src/sys/dev/pci

2024-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 28 16:33:25 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: virtio_pci.c

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

sys/dev/pci/virtio_pci.c: revision 1.55

Wrong byte order of config space write in big-endian (gorg)

In virtio_pci.c, the function virtio_pci_bus_space_write_8 writes
the first 4 bytes and second 4 bytes of an 8-byte value in the same
or swapped order within the device's config space depending on the
endianness of the system it is compiled for. However, the BUS_ADDR_LO32
and BUS_ADDR_HI32 always produce the least-significant and
most-significant 4 bytes of an 8-byte value, respectively, regardless
of the endianness of the system. Since virtio_pci_bus_space_write_8
is always used only for writing to little-endian parts of the config
space, the least significant 4 bytes must always be written to the
first 4 bytes in the config space value, and the most significant
4 bytes must always be written to the last 4 bytes of the config
space value.  Therefore, swapping the byte order produces incorrect
behaviour on big-endian systems.

The incorrect behaviour seems to have been introduced in revision
1.19 of virtio_pci.c, which this change would mostly reversed


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.4 -r1.38.4.5 src/sys/dev/pci/virtio_pci.c

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



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

2024-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 28 16:33:25 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: virtio_pci.c

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

sys/dev/pci/virtio_pci.c: revision 1.55

Wrong byte order of config space write in big-endian (gorg)

In virtio_pci.c, the function virtio_pci_bus_space_write_8 writes
the first 4 bytes and second 4 bytes of an 8-byte value in the same
or swapped order within the device's config space depending on the
endianness of the system it is compiled for. However, the BUS_ADDR_LO32
and BUS_ADDR_HI32 always produce the least-significant and
most-significant 4 bytes of an 8-byte value, respectively, regardless
of the endianness of the system. Since virtio_pci_bus_space_write_8
is always used only for writing to little-endian parts of the config
space, the least significant 4 bytes must always be written to the
first 4 bytes in the config space value, and the most significant
4 bytes must always be written to the last 4 bytes of the config
space value.  Therefore, swapping the byte order produces incorrect
behaviour on big-endian systems.

The incorrect behaviour seems to have been introduced in revision
1.19 of virtio_pci.c, which this change would mostly reversed


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.4 -r1.38.4.5 src/sys/dev/pci/virtio_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/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.38.4.4 src/sys/dev/pci/virtio_pci.c:1.38.4.5
--- src/sys/dev/pci/virtio_pci.c:1.38.4.4	Wed Oct  2 18:20:48 2024
+++ src/sys/dev/pci/virtio_pci.c	Thu Nov 28 16:33:25 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.38.4.4 2024/10/02 18:20:48 martin Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.38.4.5 2024/11/28 16:33:25 martin Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.38.4.4 2024/10/02 18:20:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.38.4.5 2024/11/28 16:33:25 martin Exp $");
 
 #include 
 #include 
@@ -726,13 +726,8 @@ static __inline void
 virtio_pci_bus_space_write_8(bus_space_tag_t iot, bus_space_handle_t ioh,
 bus_size_t offset, uint64_t value)
 {
-#if _QUAD_HIGHWORD
 	bus_space_write_4(iot, ioh, offset, BUS_ADDR_LO32(value));
 	bus_space_write_4(iot, ioh, offset + 4, BUS_ADDR_HI32(value));
-#else
-	bus_space_write_4(iot, ioh, offset, BUS_ADDR_HI32(value));
-	bus_space_write_4(iot, ioh, offset + 4, BUS_ADDR_LO32(value));
-#endif
 }
 
 static void



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

2024-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 13 15:44:54 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_bge.c if_bgevar.h

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

sys/dev/pci/if_bgevar.h: revision 1.41
sys/dev/pci/if_bgevar.h: revision 1.42
sys/dev/pci/if_bge.c: revision 1.394

s/jumo/jumbo/ in comments.

Apply changes from PR/58584 after testing (and fixing).
Tested on an Apple M1.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.388.2.1 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.40 -r1.40.4.1 src/sys/dev/pci/if_bgevar.h

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



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

2024-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 13 15:44:54 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_bge.c if_bgevar.h

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

sys/dev/pci/if_bgevar.h: revision 1.41
sys/dev/pci/if_bgevar.h: revision 1.42
sys/dev/pci/if_bge.c: revision 1.394

s/jumo/jumbo/ in comments.

Apply changes from PR/58584 after testing (and fixing).
Tested on an Apple M1.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.388.2.1 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.40 -r1.40.4.1 src/sys/dev/pci/if_bgevar.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.388 src/sys/dev/pci/if_bge.c:1.388.2.1
--- src/sys/dev/pci/if_bge.c:1.388	Tue Oct 11 22:03:37 2022
+++ src/sys/dev/pci/if_bge.c	Sun Oct 13 15:44:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.388 2022/10/11 22:03:37 andvar Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.388.2.1 2024/10/13 15:44:54 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.388 2022/10/11 22:03:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.388.2.1 2024/10/13 15:44:54 martin Exp $");
 
 #include 
 #include 
@@ -203,9 +203,7 @@ static void bge_start_locked(struct ifne
 static int bge_ifflags_cb(struct ethercom *);
 static int bge_ioctl(struct ifnet *, u_long, void *);
 static int bge_init(struct ifnet *);
-static int bge_init_locked(struct ifnet *);
 static void bge_stop(struct ifnet *, int);
-static void bge_stop_locked(struct ifnet *, bool);
 static bool bge_watchdog_tick(struct ifnet *);
 static int bge_ifmedia_upd(struct ifnet *);
 static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -1091,6 +1089,8 @@ bge_miibus_readreg(device_t dev, int phy
 	int rv = 0;
 	int i;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0)
 		return -1;
 
@@ -1144,6 +1144,8 @@ bge_miibus_writereg(device_t dev, int ph
 	int rv = 0;
 	int i;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 &&
 	(reg == MII_GTCR || reg == BRGPHY_MII_AUXCTL))
 		return 0;
@@ -1198,6 +1200,8 @@ bge_miibus_statchg(struct ifnet *ifp)
 	struct mii_data *mii = &sc->bge_mii;
 	uint32_t mac_mode, rx_mode, tx_mode;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	/*
 	 * Get flow control negotiation result.
 	 */
@@ -1840,7 +1844,7 @@ bge_setmulti(struct bge_softc *sc)
 	uint32_t		h;
 	int			i;
 
-	KASSERT(mutex_owned(sc->sc_core_lock));
+	KASSERT(mutex_owned(sc->sc_mcast_lock));
 	if (sc->bge_if_flags & IFF_PROMISC)
 		goto allmulti;
 
@@ -2768,10 +2772,16 @@ bge_blockinit(struct bge_softc *sc)
 
 	/* 5718 step 35, 36, 37 */
 	/* Set up host coalescing defaults */
-	CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS, sc->bge_rx_coal_ticks);
-	CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS, sc->bge_tx_coal_ticks);
-	CSR_WRITE_4(sc, BGE_HCC_RX_MAX_COAL_BDS, sc->bge_rx_max_coal_bds);
-	CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS, sc->bge_tx_max_coal_bds);
+	mutex_enter(sc->sc_intr_lock);
+	const uint32_t rx_coal_ticks = sc->bge_rx_coal_ticks;
+	const uint32_t tx_coal_ticks = sc->bge_tx_coal_ticks;
+	const uint32_t rx_max_coal_bds = sc->bge_rx_max_coal_bds;
+	const uint32_t tx_max_coal_bds = sc->bge_tx_max_coal_bds;
+	mutex_exit(sc->sc_intr_lock);
+	CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS, rx_coal_ticks);
+	CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS, tx_coal_ticks);
+	CSR_WRITE_4(sc, BGE_HCC_RX_MAX_COAL_BDS, rx_max_coal_bds);
+	CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS, tx_max_coal_bds);
 	if (!(BGE_IS_5705_PLUS(sc))) {
 		CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS_INT, 0);
 		CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS_INT, 0);
@@ -3297,7 +3307,6 @@ bge_attach(device_t parent, device_t sel
 		return;
 	}
 
-	sc->bge_stopping = false;
 	sc->bge_txrx_stopping = false;
 
 	/* Save various chip information. */
@@ -3871,7 +3880,7 @@ bge_attach(device_t parent, device_t sel
 	else
 		sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT;
 
-	sc->sc_core_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+	sc->sc_mcast_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_SOFTNET);
 	sc->sc_intr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET);
 
 	/* Set up ifnet structure */
@@ -3990,6 +3999,7 @@ bge_attach(device_t parent, device_t sel
 			mii_flags |= MIIF_HAVEFIBER;
 again:
 		bge_asf_driver_up(sc);
+		mutex_enter(sc->sc_intr_lock);
 		rv = bge_miibus_readreg(sc->bge_dev, sc->bge_phy_addr,
 		MII_BMCR, &phyreg);
 		if ((rv != 0) || ((phyreg & BMCR_PDOWN) != 0)) {
@@ -4006,6 +4016,7 @@ again:
 DELAY(1000);
 			}
 		}
+		mutex_exit(sc->sc_intr_lock);
 
 		mii_attach(sc->bge_dev, mii, capmask, sc->bge_phy_addr,
 		MII_OFFSET_ANY, mii_flags);
@@ -4080,6 +4091,8 @@ again:
 #ifdef BGE_DEBUG
 	bge_debug_info(sc);

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

2024-09-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 21 12:30:43 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vmx.c

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

sys/dev/pci/if_vmx.c: revision 1.12

vmxnet(4): Fix various MP bugs.
- Defer reset to workqueue.
   => vmxnet3_stop_locked is forbidden in softint.
   => XXX Problem: We still take the core lock in softint, and we
  still take the core lock around vmxnet3_stop_locked.  TBD.
- Touch if_flags only under IFNET_LOCK.
   => Cache ifp->if_flags & IFF_PROMISC in vmxnet3_ifflags_cb.
   => Don't call vmxnet3_set_rxfilter unless up and running; cache
  this as vmx_mcastactive.  Use ENETRESET in vmxnet3_ifflags_cb
  instead of calling vmxnet3_set_rxfilter directly.
  . (The cache is currently serialized by the core lock, but it
might reasonably be serialized by an independent lock like in
usbnet(9).)
- Fix vmxnet3_stop_rendezvous so it actually does something.
   => New vxtxq_stopping, vxrxq_stopping variables synchronize with
  Rx/Tx interrupt handlers.
- Sprinkle IFNET_LOCK and core lock assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/dev/pci/if_vmx.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_vmx.c
diff -u src/sys/dev/pci/if_vmx.c:1.11.4.1 src/sys/dev/pci/if_vmx.c:1.11.4.2
--- src/sys/dev/pci/if_vmx.c:1.11.4.1	Sat May 11 14:49:51 2024
+++ src/sys/dev/pci/if_vmx.c	Sat Sep 21 12:30:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.11.4.1 2024/05/11 14:49:51 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.11.4.2 2024/09/21 12:30:43 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.11.4.1 2024/05/11 14:49:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.11.4.2 2024/09/21 12:30:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_vmx.h"
@@ -212,6 +212,8 @@ struct vmxnet3_txqueue {
 	struct evcnt vxtxq_watchdogto;
 	struct evcnt vxtxq_defragged;
 	struct evcnt vxtxq_defrag_failed;
+
+	bool vxtxq_stopping;
 };
 
 
@@ -230,6 +232,8 @@ struct vmxnet3_rxqueue {
 	struct evcnt vxrxq_deferreq;
 	struct evcnt vxrxq_mgetcl_failed;
 	struct evcnt vxrxq_mbuf_load_failed;
+
+	bool vxrxq_stopping;
 };
 
 struct vmxnet3_queue {
@@ -291,6 +295,9 @@ struct vmxnet3_softc {
 
 	kmutex_t *vmx_mtx;
 
+	int vmx_if_flags;
+	bool vmx_promisc;
+	bool vmx_mcastactive;
 	uint8_t *vmx_mcast;
 	void *vmx_qs;
 	struct vmxnet3_rss_shared *vmx_rss;
@@ -311,6 +318,10 @@ struct vmxnet3_softc {
 
 	bool vmx_txrx_workqueue;
 	struct workqueue *vmx_queue_wq;
+
+	struct workqueue *vmx_reset_wq;
+	struct work vmx_reset_work;
+	bool vmx_reset_pending;
 };
 
 #define VMXNET3_STAT
@@ -435,6 +446,7 @@ static int vmxnet3_ifflags_cb(struct eth
 static int vmxnet3_watchdog(struct vmxnet3_txqueue *);
 static void vmxnet3_refresh_host_stats(struct vmxnet3_softc *);
 static void vmxnet3_tick(void *);
+static void vmxnet3_reset_work(struct work *, void *);
 static void vmxnet3_if_link_status(struct vmxnet3_softc *);
 static bool vmxnet3_cmd_link_status(struct ifnet *);
 static void vmxnet3_ifmedia_status(struct ifnet *, struct ifmediareq *);
@@ -633,6 +645,18 @@ vmxnet3_attach(device_t parent, device_t
 	if (error)
 		return;
 
+	char buf[128];
+	snprintf(buf, sizeof(buf), "%s_reset", device_xname(sc->vmx_dev));
+	error = workqueue_create(&sc->vmx_reset_wq, "%s_reset",
+	vmxnet3_reset_work, sc, VMXNET3_WORKQUEUE_PRI, IPL_SOFTCLOCK,
+	WQ_MPSAFE);
+	if (error) {
+		aprint_error_dev(sc->vmx_dev,
+		"failed to create reset workqueue: %d\n",
+		error);
+		return;
+	}
+
 	sc->vmx_flags |= VMXNET3_FLAG_ATTACHED;
 }
 
@@ -1124,6 +1148,8 @@ vmxnet3_init_rxq(struct vmxnet3_softc *s
 		rxq->vxrxq_comp_ring.vxcr_ndesc += sc->vmx_nrxdescs;
 	}
 
+	rxq->vxrxq_stopping = true;
+
 	return (0);
 }
 
@@ -1159,6 +1185,8 @@ vmxnet3_init_txq(struct vmxnet3_softc *s
 
 	txq->vxtxq_interq = pcq_create(sc->vmx_ntxdescs, KM_SLEEP);
 
+	txq->vxtxq_stopping = true;
+
 	return (0);
 }
 
@@ -2336,7 +2364,7 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *
 
 	VMXNET3_RXQ_LOCK_ASSERT(rxq);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
+	if (rxq->vxrxq_stopping)
 		return more;
 
 	m_head = rxq->vxrxq_mhead;
@@ -2442,7 +2470,7 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *
 			m_head = m_tail = NULL;
 
 			/* Must recheck after dropping the Rx lock. */
-			if ((ifp->if_flags & IFF_RUNNING) == 0)
+			if (rxq->vxrxq_stopping)
 break;
 		}
 
@@ -2711,11 +2739,13 @@ vmxnet3_stop_rendezvous(struct vmxnet3_s
 	for (i = 0; i < sc->vmx_nrxqueues; i++) {
 		rxq = &sc->vmx_queue[i].vxq_rxqueue;
 		VMXNET3_RXQ_LOCK(rxq);
+		rxq->vxrxq_stopping = true;
 		VMXNET3_RXQ_UNLOCK(rxq);
 	}
 	for (i = 0; i < sc->vmx_ntxqueues; i++) {
 		txq = &sc->vmx_queue[i]

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

2024-09-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 21 12:30:43 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vmx.c

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

sys/dev/pci/if_vmx.c: revision 1.12

vmxnet(4): Fix various MP bugs.
- Defer reset to workqueue.
   => vmxnet3_stop_locked is forbidden in softint.
   => XXX Problem: We still take the core lock in softint, and we
  still take the core lock around vmxnet3_stop_locked.  TBD.
- Touch if_flags only under IFNET_LOCK.
   => Cache ifp->if_flags & IFF_PROMISC in vmxnet3_ifflags_cb.
   => Don't call vmxnet3_set_rxfilter unless up and running; cache
  this as vmx_mcastactive.  Use ENETRESET in vmxnet3_ifflags_cb
  instead of calling vmxnet3_set_rxfilter directly.
  . (The cache is currently serialized by the core lock, but it
might reasonably be serialized by an independent lock like in
usbnet(9).)
- Fix vmxnet3_stop_rendezvous so it actually does something.
   => New vxtxq_stopping, vxrxq_stopping variables synchronize with
  Rx/Tx interrupt handlers.
- Sprinkle IFNET_LOCK and core lock assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/dev/pci/if_vmx.c

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



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

2024-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 11 15:56:21 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ehci_pci.c

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

sys/dev/pci/ehci_pci.c: revision 1.77

ehci(4): properly handle failed attach

thinkpad a475 fails to attach an ehci instance:

ehci0: pre-2.0 USB rev, device ignored

which ends up stopping suspend/resume working as the device has no
pmf handlers installed.  put most of the teardown code into a new
common function that is called from failed attach and detach.  if
attach fails, register NULL pmf handlers.  don't check the return
value of pmf_device_register*().

re-order several parts of detach to match the reverse attach order.
tested on rockpro64, thinkpad a475, and xps 1645, the a475 can now
suspend/resume almost fully successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/pci/ehci_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/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.75.2.1 src/sys/dev/pci/ehci_pci.c:1.75.2.2
--- src/sys/dev/pci/ehci_pci.c:1.75.2.1	Mon Mar 11 20:08:15 2024
+++ src/sys/dev/pci/ehci_pci.c	Wed Sep 11 15:56:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.75.2.1 2024/03/11 20:08:15 martin Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.75.2.2 2024/09/11 15:56:21 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.75.2.1 2024/03/11 20:08:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.75.2.2 2024/09/11 15:56:21 martin Exp $");
 
 #include 
 #include 
@@ -85,10 +85,12 @@ struct ehci_pci_softc {
 	void 			*sc_ih;		/* interrupt vectoring */
 	enum {
 		EHCI_INIT_NONE,
+		EHCI_INIT_OWNER,
 		EHCI_INIT_INITED
 	} sc_init_state;
 };
 
+static void ehci_pci_release_resources(struct ehci_pci_softc *);
 static int ehci_sb700_match(const struct pci_attach_args *);
 static int ehci_apply_amd_quirks(struct ehci_pci_softc *);
 static enum ehci_pci_quirk_flags ehci_pci_lookup_quirkdata(pci_vendor_id_t,
@@ -200,9 +202,6 @@ ehci_pci_attach(device_t parent, device_
 	sc->sc_ih = pci_intr_establish_xname(pc, sc->sc_pihp[0], IPL_USB,
 	ehci_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {
-		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
-		sc->sc_pihp = NULL;
-
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
 			aprint_error(" at %s", intrstr);
@@ -258,6 +257,7 @@ ehci_pci_attach(device_t parent, device_
 	sc->sc.sc_ncomp = ncomp;
 
 	ehci_get_ownership(&sc->sc, pc, tag);
+	sc->sc_init_state = EHCI_INIT_OWNER;
 
 	int err = ehci_init(&sc->sc);
 	if (err) {
@@ -266,9 +266,8 @@ ehci_pci_attach(device_t parent, device_
 	}
 	sc->sc_init_state = EHCI_INIT_INITED;
 
-	if (!pmf_device_register1(self, ehci_pci_suspend, ehci_pci_resume,
-	ehci_shutdown))
-		aprint_error_dev(self, "couldn't establish power handler\n");
+	pmf_device_register1(self, ehci_pci_suspend, ehci_pci_resume,
+	ehci_shutdown);
 
 	/* Attach usb device. */
 	sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint,
@@ -276,15 +275,31 @@ ehci_pci_attach(device_t parent, device_
 	return;
 
 fail:
+	ehci_pci_release_resources(sc);
+	pmf_device_register(self, NULL, NULL);
+}
+
+static void
+ehci_pci_release_resources(struct ehci_pci_softc *sc)
+{
+	if (sc->sc_init_state >= EHCI_INIT_OWNER)
+		ehci_release_ownership(&sc->sc, sc->sc_pc, sc->sc_tag);
+
 	if (sc->sc_ih) {
 		pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
 		sc->sc_ih = NULL;
 	}
+	if (sc->sc_pihp != NULL) {
+		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
+		sc->sc_pihp = NULL;
+	}
+
 	if (sc->sc.sc_size) {
-		ehci_release_ownership(&sc->sc, sc->sc_pc, sc->sc_tag);
 		bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
 		sc->sc.sc_size = 0;
 	}
+
+	sc->sc_init_state = EHCI_INIT_NONE;
 }
 
 static int
@@ -302,26 +317,14 @@ ehci_pci_detach(device_t self, int flags
 	pmf_device_deregister(self);
 	ehci_shutdown(self, flags);
 
-	/* disable interrupts */
-	EOWRITE4(&sc->sc, EHCI_USBINTR, 0);
-	/* XXX grotty hack to flush the write */
-	(void)EOREAD4(&sc->sc, EHCI_USBINTR);
-
-	if (sc->sc_ih != NULL) {
-		pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
-		sc->sc_ih = NULL;
-	}
-
-	if (sc->sc_pihp != NULL) {
-		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
-		sc->sc_pihp = NULL;
+	if (sc->sc_init_state >= EHCI_INIT_INITED) {
+		/* disable interrupts */
+		EOWRITE4(&sc->sc, EHCI_USBINTR, 0);
+		/* XXX grotty hack to flush the write */
+		(void)EOREAD4(&sc->sc, EHCI_USBINTR);
 	}
 
-	if (sc->sc.sc_size) {
-		ehci_release_ownership(&sc->sc, sc->sc_pc, sc->sc_tag);
-		bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
-		sc->sc.sc_size = 0;
-	}
+	ehci_pci_release_resources(sc);
 
 #if 1
 	/* XXX created in ehci.c */



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

2024-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 11 15:56:21 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ehci_pci.c

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

sys/dev/pci/ehci_pci.c: revision 1.77

ehci(4): properly handle failed attach

thinkpad a475 fails to attach an ehci instance:

ehci0: pre-2.0 USB rev, device ignored

which ends up stopping suspend/resume working as the device has no
pmf handlers installed.  put most of the teardown code into a new
common function that is called from failed attach and detach.  if
attach fails, register NULL pmf handlers.  don't check the return
value of pmf_device_register*().

re-order several parts of detach to match the reverse attach order.
tested on rockpro64, thinkpad a475, and xps 1645, the a475 can now
suspend/resume almost fully successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/pci/ehci_pci.c

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



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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 16:32:00 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: cy82c693.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #809):

sys/dev/pci/cy82c693.c: revision 1.11

Make the cyhc lock a regular mutex rather than a spin mutex.  Simplify
some interaction with the lock by converting some open-coded test/panic
blocks to KASSERT()s that can be safely tested outside the lock perimeter.

PR port-alpha/58602


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.34.1 src/sys/dev/pci/cy82c693.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/cy82c693.c
diff -u src/sys/dev/pci/cy82c693.c:1.10 src/sys/dev/pci/cy82c693.c:1.10.34.1
--- src/sys/dev/pci/cy82c693.c:1.10	Wed Jun  6 01:49:08 2018
+++ src/sys/dev/pci/cy82c693.c	Sat Aug 24 16:32:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cy82c693.c,v 1.10 2018/06/06 01:49:08 maya Exp $ */
+/* $NetBSD: cy82c693.c,v 1.10.34.1 2024/08/24 16:32:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.10 2018/06/06 01:49:08 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.10.34.1 2024/08/24 16:32:00 martin Exp $");
 
 #include 
 #include 
@@ -54,14 +54,13 @@ ONCE_DECL(cyhc_once);
 static struct cy82c693_handle cyhc_handle;
 static int cyhc_initialized;
 
-static kmutex_t cyhc_slock;
+static kmutex_t cyhc_lock;
 
 static int
 cy82c693_onceinit(void)
 {
 
-	mutex_init(&cyhc_slock, MUTEX_DEFAULT, IPL_HIGH);
-
+	mutex_init(&cyhc_lock, MUTEX_DEFAULT, IPL_NONE);
 	return 0;
 }
 
@@ -75,16 +74,16 @@ cy82c693_init(bus_space_tag_t iot)
 	if (err)
 		return NULL;
 	
-	mutex_spin_enter(&cyhc_slock);
+	mutex_enter(&cyhc_lock);
 
 	if (cyhc_initialized) {
-		mutex_spin_exit(&cyhc_slock);
+		mutex_exit(&cyhc_lock);
 		KASSERT(bus_space_is_equal(iot, cyhc_handle.cyhc_iot));
 		return &cyhc_handle;
 	}
 
 	if (bus_space_map(iot, CYHC_CONFIG_ADDR, 2, 0, &ioh) != 0) {
-		mutex_spin_exit(&cyhc_slock);
+		mutex_exit(&cyhc_lock);
 		return NULL;
 	}
 
@@ -93,7 +92,7 @@ cy82c693_init(bus_space_tag_t iot)
 
 	cyhc_initialized = 1;
 
-	mutex_spin_exit(&cyhc_slock);
+	mutex_exit(&cyhc_lock);
 
 	return &cyhc_handle;
 }
@@ -103,17 +102,15 @@ cy82c693_read(const struct cy82c693_hand
 {
 	uint8_t rv;
 
-	mutex_spin_enter(&cyhc_slock);
+	KASSERT(cyhc != NULL);
+	KASSERT(cyhc_initialized);
 
-	if (cyhc_initialized == 0) {
-		mutex_spin_exit(&cyhc_slock);
-		panic("cy82c693_read");
-	}
+	mutex_enter(&cyhc_lock);
 
 	bus_space_write_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 0, reg);
 	rv = bus_space_read_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 1);
 
-	mutex_spin_exit(&cyhc_slock);
+	mutex_exit(&cyhc_lock);
 
 	return rv;
 }
@@ -122,15 +119,13 @@ void
 cy82c693_write(const struct cy82c693_handle *cyhc, int reg, u_int8_t val)
 {
 
-	mutex_spin_enter(&cyhc_slock);
+	KASSERT(cyhc != NULL);
+	KASSERT(cyhc_initialized);
 
-	if (cyhc_initialized == 0) {
-		mutex_spin_exit(&cyhc_slock);
-		panic("cy82c693_write");
-	}
+	mutex_enter(&cyhc_lock);
 
 	bus_space_write_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 0, reg);
 	bus_space_write_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 1, val);
 
-	mutex_spin_exit(&cyhc_slock);
+	mutex_exit(&cyhc_lock);
 }



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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 16:32:00 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: cy82c693.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #809):

sys/dev/pci/cy82c693.c: revision 1.11

Make the cyhc lock a regular mutex rather than a spin mutex.  Simplify
some interaction with the lock by converting some open-coded test/panic
blocks to KASSERT()s that can be safely tested outside the lock perimeter.

PR port-alpha/58602


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.34.1 src/sys/dev/pci/cy82c693.c

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



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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 16:10:58 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: pucdata.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #806):

sys/dev/pci/pucdata.c: revision 1.116

Add Brainboxes puc(4) devices
>From Cameron Williams in PR 58358.


To generate a diff of this commit:
cvs rdiff -u -r1.113.4.1 -r1.113.4.2 src/sys/dev/pci/pucdata.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/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.113.4.1 src/sys/dev/pci/pucdata.c:1.113.4.2
--- src/sys/dev/pci/pucdata.c:1.113.4.1	Mon Jan 30 11:44:39 2023
+++ src/sys/dev/pci/pucdata.c	Sat Aug 24 16:10:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.113.4.1 2023/01/30 11:44:39 martin Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.113.4.2 2024/08/24 16:10:57 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.113.4.1 2023/01/30 11:44:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.113.4.2 2024/08/24 16:10:57 martin Exp $");
 
 #include 
 #include 
@@ -222,6 +222,438 @@ const struct puc_device_description puc_
 	},
 
 	/*
+	 * Brainboxes Ltd
+	 */
+	{ "Brainboxes IS-100",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_IS100, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+	},
+	},
+	{ "Brainboxes IS-200",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_IS200, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes IS-300",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_IS300, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+	},
+	},
+	{ "Brainboxes IS-400",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_IS400, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0010, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0018, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-101",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC101, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-203",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC203, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-203",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC203R3, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-246",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC246, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-246",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC246R3, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-253",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC253, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-257",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC257, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-257",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC257R3, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-257",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC257R4, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC-260",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC260, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0008, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0010, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x0018, COM_FREQ },
+	},
+	},
+	{ "Brainboxes UC

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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 16:10:58 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: pucdata.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #806):

sys/dev/pci/pucdata.c: revision 1.116

Add Brainboxes puc(4) devices
>From Cameron Williams in PR 58358.


To generate a diff of this commit:
cvs rdiff -u -r1.113.4.1 -r1.113.4.2 src/sys/dev/pci/pucdata.c

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



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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 08:32:15 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_re_pci.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #805):

sys/dev/pci/pcidevs: revision 1.1503
sys/dev/pci/if_re_pci.c: revision 1.53

Add (Realtek/)Killer E2600 Ethernet
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.24.1 src/sys/dev/pci/if_re_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/if_re_pci.c
diff -u src/sys/dev/pci/if_re_pci.c:1.52 src/sys/dev/pci/if_re_pci.c:1.52.24.1
--- src/sys/dev/pci/if_re_pci.c:1.52	Tue Feb 18 03:48:22 2020
+++ src/sys/dev/pci/if_re_pci.c	Sat Aug 24 08:32:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_pci.c,v 1.52 2020/02/18 03:48:22 msaitoh Exp $	*/
+/*	$NetBSD: if_re_pci.c,v 1.52.24.1 2024/08/24 08:32:15 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.52 2020/02/18 03:48:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.52.24.1 2024/08/24 08:32:15 martin Exp $");
 
 #include 
 
@@ -108,6 +108,9 @@ static const struct rtk_type re_devs[] =
 	{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC,
 	RTK_8169,
 	"RealTek 8169SC/8110SC Single-chip Gigabit Ethernet" },
+	{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_E2600,
+	RTK_8169,
+	"Killer E2600 Gigabit Ethernet" },
 	{ PCI_VENDOR_COREGA, PCI_PRODUCT_COREGA_LAPCIGT,
 	RTK_8169,
 	"Corega CG-LAPCIGT Gigabit Ethernet" },



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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 08:32:15 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_re_pci.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #805):

sys/dev/pci/pcidevs: revision 1.1503
sys/dev/pci/if_re_pci.c: revision 1.53

Add (Realtek/)Killer E2600 Ethernet
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.24.1 src/sys/dev/pci/if_re_pci.c

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



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

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 08:31:33 UTC 2024

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

Log Message:
Regen for ticket #805


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.13 -r1.1452.2.14 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.13 -r1.1451.2.14 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-10] src/sys/dev/pci

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 08:29:47 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #805):

sys/dev/pci/pcidevs: revision 1.1503
sys/dev/pci/if_re_pci.c: revision 1.53

Add (Realtek/)Killer E2600 Ethernet
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.1471.2.12 -r1.1471.2.13 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-10] src/sys/dev/pci

2024-08-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 24 08:29:47 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #805):

sys/dev/pci/pcidevs: revision 1.1503
sys/dev/pci/if_re_pci.c: revision 1.53

Add (Realtek/)Killer E2600 Ethernet
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.1471.2.12 -r1.1471.2.13 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.1471.2.12 src/sys/dev/pci/pcidevs:1.1471.2.13
--- src/sys/dev/pci/pcidevs:1.1471.2.12	Wed Jul  3 17:19:00 2024
+++ src/sys/dev/pci/pcidevs	Sat Aug 24 08:29:47 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1471.2.12 2024/07/03 17:19:00 martin Exp $
+$NetBSD: pcidevs,v 1.1471.2.13 2024/08/24 08:29:47 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -9244,6 +9244,7 @@ product RDC	R6060_OHCI	0x6060	R6060 USB 
 product RDC	R6061_EHCI	0x6061	R6061 USB EHCI
 
 /* Realtek products */
+product REALTEK E2600 		0x2600	Killer E2600
 product REALTEK E3000 		0x3000	Killer E3000
 product REALTEK RTS5208		0x5208	RTS5208 PCI-E Card Reader
 product REALTEK RTS5209		0x5209	RTS5209 PCI-E Card Reader



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

2024-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 22 19:22:35 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #782):

sys/dev/pci/if_rge.c: revision 1.29

- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start

Should fix PR 57694


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.3 -r1.24.4.4 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.24.4.3 src/sys/dev/pci/if_rge.c:1.24.4.4
--- src/sys/dev/pci/if_rge.c:1.24.4.3	Sun Oct 22 06:25:32 2023
+++ src/sys/dev/pci/if_rge.c	Thu Aug 22 19:22:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.24.4.3 2023/10/22 06:25:32 martin Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.24.4.4 2024/08/22 19:22:35 martin Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.3 2023/10/22 06:25:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.4 2024/08/22 19:22:35 martin Exp $");
 
 #include 
 
@@ -351,6 +351,7 @@ rge_attach(device_t parent, device_t sel
 	sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media;
 
 	if_attach(ifp);
+	if_deferred_start_init(ifp, NULL);
 	ether_ifattach(ifp, eaddr);
 
 	if (pmf_device_register(self, NULL, NULL))
@@ -1385,10 +1386,14 @@ rge_txeof(struct rge_softc *sc)
 		m_freem(txq->txq_mbuf);
 		txq->txq_mbuf = NULL;
 
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (txstat & (RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL))
-			if_statinc(ifp, if_collisions);
+			if_statinc_ref(nsr, if_collisions);
 		if (txstat & RGE_TDCMDSTS_TXERR)
-			if_statinc(ifp, if_oerrors);
+			if_statinc_ref(nsr, if_oerrors);
+		else
+			if_statinc_ref(nsr, if_opackets);
+		IF_STAT_PUTREF(ifp);
 
 		bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map,
 		idx * sizeof(struct rge_tx_desc),
@@ -1404,24 +1409,12 @@ rge_txeof(struct rge_softc *sc)
 
 	sc->rge_ldata.rge_txq_considx = cons;
 
-#if 0
-	if (ifq_is_oactive(&ifp->if_snd))
-		ifq_restart(&ifp->if_snd);
-	else if (free == 2)
-		ifq_serialize(&ifp->if_snd, &sc->sc_task);
-	else
-		ifp->if_timer = 0;
-#else
-#if 0
-	if (!IF_IS_EMPTY(&ifp->if_snd))
-		rge_start(ifp);
-	else
 	if (free == 2)
-		if (0) { rge_txstart(&sc->sc_task, sc); }
-	else
-#endif
-		ifp->if_timer = 0;
-#endif
+		rge_txstart(&sc->sc_task, sc);
+
+	CLR(ifp->if_flags, IFF_OACTIVE);
+	ifp->if_timer = 0;
+	if_schedule_deferred_start(ifp);
 
 	return (1);
 }



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

2024-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 22 19:22:35 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #782):

sys/dev/pci/if_rge.c: revision 1.29

- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start

Should fix PR 57694


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.3 -r1.24.4.4 src/sys/dev/pci/if_rge.c

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



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

2024-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  7 09:58:20 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #772):

sys/dev/pci/if_vioif.c: revision 1.111

Ensure that the number of bus_dma segments doesn't exceed VirtIO queue size.

This fixes reproducible panics when the host's VirtIO queue size is too small,
less than or equal to VIRTIO_NET_TX_MAXNSEGS(=16).

PR kern/58049.


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.4 -r1.82.4.5 src/sys/dev/pci/if_vioif.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_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.82.4.4 src/sys/dev/pci/if_vioif.c:1.82.4.5
--- src/sys/dev/pci/if_vioif.c:1.82.4.4	Wed Aug  7 09:12:55 2024
+++ src/sys/dev/pci/if_vioif.c	Wed Aug  7 09:58:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.82.4.4 2024/08/07 09:12:55 martin Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.82.4.5 2024/08/07 09:58:20 martin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.4 2024/08/07 09:12:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.5 2024/08/07 09:58:20 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1280,12 +1280,14 @@ vioif_alloc_mems(struct vioif_softc *sc)
 
 		struct virtio_net_hdr *hdrs;
 		int dir;
+		int nsegs;
 
 		dir = VIOIF_NETQ_DIR(qid);
 		netq = &sc->sc_netqs[qid];
 		vq_num = netq->netq_vq->vq_num;
 		maps = netq->netq_maps;
 		hdrs = netq->netq_maps_kva;
+		nsegs = uimin(dmaparams[dir].dma_nsegs, vq_num - 1/*hdr*/);
 
 		for (i = 0; i < vq_num; i++) {
 			maps[i].vnm_hdr = &hdrs[i];
@@ -1297,7 +1299,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 goto err_reqs;
 
 			r = vioif_dmamap_create(sc, &maps[i].vnm_mbuf_map,
-			dmaparams[dir].dma_size, dmaparams[dir].dma_nsegs,
+			dmaparams[dir].dma_size, nsegs,
 			dmaparams[dir].msg_payload);
 			if (r != 0)
 goto err_reqs;



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

2024-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  7 09:58:20 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #772):

sys/dev/pci/if_vioif.c: revision 1.111

Ensure that the number of bus_dma segments doesn't exceed VirtIO queue size.

This fixes reproducible panics when the host's VirtIO queue size is too small,
less than or equal to VIRTIO_NET_TX_MAXNSEGS(=16).

PR kern/58049.


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.4 -r1.82.4.5 src/sys/dev/pci/if_vioif.c

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



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

2024-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  7 09:12:55 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vioif.c

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

sys/dev/pci/if_vioif.c: revision 1.108

Fix missing check for netq->netq_stopping in vioif_rx_intr()


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.3 -r1.82.4.4 src/sys/dev/pci/if_vioif.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_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.82.4.3 src/sys/dev/pci/if_vioif.c:1.82.4.4
--- src/sys/dev/pci/if_vioif.c:1.82.4.3	Sat May 13 10:56:10 2023
+++ src/sys/dev/pci/if_vioif.c	Wed Aug  7 09:12:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.82.4.3 2023/05/13 10:56:10 martin Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.82.4.4 2024/08/07 09:12:55 martin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.3 2023/05/13 10:56:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.4 2024/08/07 09:12:55 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1924,6 +1924,9 @@ vioif_rx_intr(void *arg)
 	if (netq->netq_running_handle)
 		goto done;
 
+	if (netq->netq_stopping)
+		goto done;
+
 	netq->netq_running_handle = true;
 
 	limit = sc->sc_rx_intr_process_limit;



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

2024-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  7 09:12:55 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vioif.c

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

sys/dev/pci/if_vioif.c: revision 1.108

Fix missing check for netq->netq_stopping in vioif_rx_intr()


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.3 -r1.82.4.4 src/sys/dev/pci/if_vioif.c

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



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

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:20:06 UTC 2024

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

Log Message:
Regen for ticket #730 (Brainboxes devices)


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.12 -r1.1452.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.12 -r1.1451.2.13 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-10] src/sys/dev/pci

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:20:06 UTC 2024

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

Log Message:
Regen for ticket #730 (Brainboxes devices)


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.12 -r1.1452.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.12 -r1.1451.2.13 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-10] src/sys/dev/pci

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:19:00 UTC 2024

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

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

sys/dev/pci/pcidevs: revision 1.1507

Add Brainboxes and devices
>From Cameron Williams in PR 58358.


To generate a diff of this commit:
cvs rdiff -u -r1.1471.2.11 -r1.1471.2.12 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.1471.2.11 src/sys/dev/pci/pcidevs:1.1471.2.12
--- src/sys/dev/pci/pcidevs:1.1471.2.11	Sat Feb  3 11:19:21 2024
+++ src/sys/dev/pci/pcidevs	Wed Jul  3 17:19:00 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1471.2.11 2024/02/03 11:19:21 martin Exp $
+$NetBSD: pcidevs,v 1.1471.2.12 2024/07/03 17:19:00 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -545,6 +545,7 @@ vendor FORTEMEDIA	0x1319	Forte Media
 vendor SIIG		0x131f	Siig
 vendor MICROMEMORY	0x1332	Micro Memory
 vendor DOMEX		0x134a	Domex
+vendor BRAINBOXES	0x135a	Brainboxes Ltd
 vendor QUATECH		0x135c	Quatech
 vendor LMC		0x1376	LAN Media
 vendor NETGEAR		0x1385	Netgear
@@ -2505,6 +2506,59 @@ product BIT3 PCIVME2706		0x0300	PCI-VME 
 product BLUESTEEL 5501		0x	5501
 product BLUESTEEL 5601		0x5601	5601
 
+/* Brainboxes products */
+product BRAINBOXES UC268	0x0841	Brainboxes UC-268
+product BRAINBOXES UC257	0x0861	Brainboxes UC-257
+product BRAINBOXES UC257R3	0x0862	Brainboxes UC-257
+product BRAINBOXES UC257R4	0x0863	Brainboxes UC-257
+product BRAINBOXES UC279	0x0881	Brainboxes UC-279
+product BRAINBOXES UC313	0x08a1	Brainboxes UC-313
+product BRAINBOXES UC313R3	0x08a2	Brainboxes UC-313
+product BRAINBOXES UC313R4	0x08a3	Brainboxes UC-313
+product BRAINBOXES UC310	0x08c1	Brainboxes UC-310
+product BRAINBOXES UC302	0x08e1	Brainboxes UC-302
+product BRAINBOXES UC302R3	0x08e2	Brainboxes UC-302
+product BRAINBOXES UC302R4	0x08e3	Brainboxes UC-302
+product BRAINBOXES UC431	0x0901	Brainboxes UC-431
+product BRAINBOXES UC420	0x0921	Brainboxes UC-420
+product BRAINBOXES UC475	0x0981	Brainboxes UC-475
+product BRAINBOXES UC475R3	0x0982	Brainboxes UC-475
+product BRAINBOXES UC607	0x09a1	Brainboxes UC-607
+product BRAINBOXES UC607R3	0x09a2	Brainboxes UC-607
+product BRAINBOXES UC607R4	0x09a3	Brainboxes UC-607
+product BRAINBOXES UC324	0x0a61	Brainboxes UC-324
+product BRAINBOXES UC357	0x0a81	Brainboxes UC-357
+product BRAINBOXES UC357R3	0x0a82	Brainboxes UC-357
+product BRAINBOXES UC357R4	0x0a83	Brainboxes UC-357
+product BRAINBOXES UC246	0x0aa1	Brainboxes UC-246
+product BRAINBOXES UC246R3	0x0aa2	Brainboxes UC-246
+product BRAINBOXES UP189	0x0ac1	Brainboxes UP-189
+product BRAINBOXES UP189R3	0x0ac2	Brainboxes UP-189
+product BRAINBOXES UP189R4	0x0ac3	Brainboxes UP-189
+product BRAINBOXES UC346	0x0b01	Brainboxes UC-346
+product BRAINBOXES UC346R3	0x0b02	Brainboxes UC-346
+product BRAINBOXES UP200	0x0b21	Brainboxes UP-200
+product BRAINBOXES UP200R3	0x0b22	Brainboxes UP-200
+product BRAINBOXES UP200R4	0x0b23	Brainboxes UP-200
+product BRAINBOXES UC101	0x0ba1	Brainboxes UC-101
+product BRAINBOXES UC203	0x0bc1	Brainboxes UC-203
+product BRAINBOXES UC203R3	0x0bc2	Brainboxes UC-203
+product BRAINBOXES UP869	0x0c01	Brainboxes UP-869
+product BRAINBOXES UP869R3	0x0c02	Brainboxes UP-869
+product BRAINBOXES UP869R4	0x0c03	Brainboxes UP-869
+product BRAINBOXES UP880	0x0c21	Brainboxes UP-880
+product BRAINBOXES UP880R3	0x0c22	Brainboxes UP-880
+product BRAINBOXES UP880R4	0x0c23	Brainboxes UP-880
+product BRAINBOXES UC368	0x0c41	Brainboxes UC-368
+product BRAINBOXES UC253	0x0ca1	Brainboxes UC-253
+product BRAINBOXES UC260	0x0d21	Brainboxes UC-260
+product BRAINBOXES UC836	0x0d41	Brainboxes UC-836
+product BRAINBOXES IS100	0x0d60	Intashield IS-100
+product BRAINBOXES IS200	0x0d80	Intashield IS-200
+product BRAINBOXES IS300	0x0da0	Intashield IS-300
+product BRAINBOXES IS400	0x0dc0	Intashield IS-400
+product BRAINBOXES UC414	0x0e61	Brainboxes UC-414
+
 /* Broadcom products */
 product BROADCOM BCM5752	0x1600	BCM5752 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5752M	0x1601	BCM5752M NetXtreme 1000baseT Ethernet



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

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:19:00 UTC 2024

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

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

sys/dev/pci/pcidevs: revision 1.1507

Add Brainboxes and devices
>From Cameron Williams in PR 58358.


To generate a diff of this commit:
cvs rdiff -u -r1.1471.2.11 -r1.1471.2.12 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-10] src/sys/dev/pci/igc

2024-06-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 27 19:33:11 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.h

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

sys/dev/pci/igc/if_igc.h: revision 1.3

igc: Use __HAVE_ATOMIC64_LOADSTORE instead of __HAVE_ATOMIC64_OPS
to detect atomic_loadstore(9) is applicable to 64-bit integers.

Thanks riastradh@ for explanation in PR kern/58340


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/if_igc.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/igc/if_igc.h
diff -u src/sys/dev/pci/igc/if_igc.h:1.2.2.2 src/sys/dev/pci/igc/if_igc.h:1.2.2.3
--- src/sys/dev/pci/igc/if_igc.h:1.2.2.2	Sun Oct  8 13:19:34 2023
+++ src/sys/dev/pci/igc/if_igc.h	Thu Jun 27 19:33:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.h,v 1.2.2.2 2023/10/08 13:19:34 martin Exp $	*/
+/*	$NetBSD: if_igc.h,v 1.2.2.3 2024/06/27 19:33:11 martin Exp $	*/
 /*	$OpenBSD: if_igc.h,v 1.2 2022/01/09 05:42:50 jsg Exp $	*/
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -39,13 +39,14 @@
 #endif
 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 #include 
 
-#ifdef __HAVE_ATOMIC64_OPS
+#ifdef __HAVE_ATOMIC64_LOADSTORE
 #define	IGC_EVENT_COUNTERS
 #endif
 



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

2024-06-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 27 19:33:11 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.h

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

sys/dev/pci/igc/if_igc.h: revision 1.3

igc: Use __HAVE_ATOMIC64_LOADSTORE instead of __HAVE_ATOMIC64_OPS
to detect atomic_loadstore(9) is applicable to 64-bit integers.

Thanks riastradh@ for explanation in PR kern/58340


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/if_igc.h

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



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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 11:01:18 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: pcireg.h

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

sys/dev/pci/pcireg.h: revision 1.171

PCI_CLASS_MASK: Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.168.2.1 src/sys/dev/pci/pcireg.h

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



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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 11:01:18 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: pcireg.h

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

sys/dev/pci/pcireg.h: revision 1.171

PCI_CLASS_MASK: Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.168.2.1 src/sys/dev/pci/pcireg.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/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.168 src/sys/dev/pci/pcireg.h:1.168.2.1
--- src/sys/dev/pci/pcireg.h:1.168	Mon Oct 17 03:05:32 2022
+++ src/sys/dev/pci/pcireg.h	Sat Jun 22 11:01:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.168 2022/10/17 03:05:32 mrg Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.168.2.1 2024/06/22 11:01:18 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -135,7 +135,7 @@ typedef u_int8_t pci_interface_t;
 typedef u_int8_t pci_revision_t;
 
 #define	PCI_CLASS_SHIFT			24
-#define	PCI_CLASS_MASK			0xff
+#define	PCI_CLASS_MASK			0xffU
 #define	PCI_CLASS(cr) \
 	(((cr) >> PCI_CLASS_SHIFT) & PCI_CLASS_MASK)
 



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

2024-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 21 10:54:50 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.c

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

sys/dev/pci/igc/if_igc.c: revision 1.14
sys/dev/pci/igc/if_igc.c: revision 1.7
sys/dev/pci/igc/if_igc.c: revision 1.8
sys/dev/pci/igc/if_igc.c: revision 1.9

Fix build of the MODULAR kernel, which explicitly excludes vlans.

igc(4): Notify which of 64- or 32-bit DMA is used

Remove unnecssary #include

igc: Add missing '\n' to a DPRINTF message


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.4 -r1.3.2.5 src/sys/dev/pci/igc/if_igc.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/igc/if_igc.c
diff -u src/sys/dev/pci/igc/if_igc.c:1.3.2.4 src/sys/dev/pci/igc/if_igc.c:1.3.2.5
--- src/sys/dev/pci/igc/if_igc.c:1.3.2.4	Fri Feb 23 18:41:02 2024
+++ src/sys/dev/pci/igc/if_igc.c	Fri Jun 21 10:54:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.3.2.5 2024/06/21 10:54:50 martin Exp $	*/
 /*	$OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $	*/
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -30,10 +30,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.5 2024/06/21 10:54:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_net_mpsafe.h"
 #include "opt_if_igc.h"
 #if 0 /* notyet */
 #include "vlan.h"
@@ -354,7 +353,6 @@ igc_attach(device_t parent, device_t sel
 
 	const struct igc_product *igcp = igc_lookup(pa);
 	KASSERT(igcp != NULL);
-	pci_aprint_devinfo_fancy(pa, "Ethernet controller", igcp->igcp_name, 1);
 
 	sc->sc_dev = self;
 	callout_init(&sc->sc_tick_ch, CALLOUT_MPSAFE);
@@ -363,17 +361,23 @@ igc_attach(device_t parent, device_t sel
 
 	sc->osdep.os_sc = sc;
 	sc->osdep.os_pa = *pa;
-#ifdef __aarch64__
+#ifndef __aarch64__
 	/*
 	 * XXX PR port-arm/57643
 	 * 64-bit DMA does not work at least for LX2K with 32/64GB memory.
 	 * smmu(4) support may be required.
 	 */
-	sc->osdep.os_dmat = pa->pa_dmat;
-#else
-	sc->osdep.os_dmat = pci_dma64_available(pa) ?
-	pa->pa_dmat64 : pa->pa_dmat;
+	if (pci_dma64_available(pa)) {
+		aprint_verbose(", 64-bit DMA");
+		sc->osdep.os_dmat = pa->pa_dmat64;
+	} else
 #endif
+	{
+		aprint_verbose(", 32-bit DMA");
+		sc->osdep.os_dmat = pa->pa_dmat;
+	}
+
+	pci_aprint_devinfo_fancy(pa, "Ethernet controller", igcp->igcp_name, 1);
 
 	/* Determine hardware and mac info */
 	igc_identify_hardware(sc);
@@ -2119,7 +2123,9 @@ igc_rxeof(struct rx_ring *rxr, u_int lim
 		const bool eop = staterr & IGC_RXD_STAT_EOP;
 		const uint16_t len = le16toh(rxdesc->wb.upper.length);
 
+#if NVLAN > 0
 		const uint16_t vtag = le16toh(rxdesc->wb.upper.vlan);
+#endif
 
 		const uint32_t ptype = le32toh(rxdesc->wb.lower.lo_dword.data) &
 		IGC_PKTTYPE_MASK;
@@ -2800,7 +2806,7 @@ igc_intr(void *arg)
 
 	/* Definitely not our interrupt. */
 	if (reg_icr == 0x0) {
-		DPRINTF(MISC, "not for me");
+		DPRINTF(MISC, "not for me\n");
 		return 0;
 	}
 



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

2024-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 21 10:54:50 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.c

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

sys/dev/pci/igc/if_igc.c: revision 1.14
sys/dev/pci/igc/if_igc.c: revision 1.7
sys/dev/pci/igc/if_igc.c: revision 1.8
sys/dev/pci/igc/if_igc.c: revision 1.9

Fix build of the MODULAR kernel, which explicitly excludes vlans.

igc(4): Notify which of 64- or 32-bit DMA is used

Remove unnecssary #include

igc: Add missing '\n' to a DPRINTF message


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.4 -r1.3.2.5 src/sys/dev/pci/igc/if_igc.c

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



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 17:57:35 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: eap.c

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

sys/dev/pci/eap.c: revision 1.103

eap(4): Restore the full set of supported hardware encodings from netbsd-7

Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.28.1 src/sys/dev/pci/eap.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/eap.c
diff -u src/sys/dev/pci/eap.c:1.102 src/sys/dev/pci/eap.c:1.102.28.1
--- src/sys/dev/pci/eap.c:1.102	Thu Jul 25 15:06:07 2019
+++ src/sys/dev/pci/eap.c	Mon Jun 17 17:57:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $	*/
+/*	$NetBSD: eap.c,v 1.102.28.1 2024/06/17 17:57:35 martin Exp $	*/
 /*  $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */
 
 /*
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.102.28.1 2024/06/17 17:57:35 martin Exp $");
 
 #include "midi.h"
 #include "joy_eap.h"
@@ -218,9 +218,39 @@ static const struct audio_format eap_for
 		.precision	= 16,
 		.channels	= 2,
 		.channel_mask	= AUFMT_STEREO,
-		.frequency_type	= 2,
+		.frequency_type	= 0,
 		.frequency	= { 4000, 48000 },
 	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_LE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 1,
+		.channel_mask	= AUFMT_MONAURAL,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_ULINEAR_LE,
+		.validbits	= 8,
+		.precision	= 8,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_ULINEAR_LE,
+		.validbits	= 8,
+		.precision	= 8,
+		.channels	= 1,
+		.channel_mask	= AUFMT_MONAURAL,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	}
 };
 #define EAP_NFORMATS	__arraycount(eap_formats)
 



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 17:57:35 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: eap.c

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

sys/dev/pci/eap.c: revision 1.103

eap(4): Restore the full set of supported hardware encodings from netbsd-7

Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.28.1 src/sys/dev/pci/eap.c

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



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

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:49:51 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vmx.c

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

sys/dev/pci/if_vmx.c: revision 1.13

Set IFM_FDX flag if the link is up.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/dev/pci/if_vmx.c

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



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

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:49:51 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_vmx.c

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

sys/dev/pci/if_vmx.c: revision 1.13

Set IFM_FDX flag if the link is up.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/dev/pci/if_vmx.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_vmx.c
diff -u src/sys/dev/pci/if_vmx.c:1.11 src/sys/dev/pci/if_vmx.c:1.11.4.1
--- src/sys/dev/pci/if_vmx.c:1.11	Fri Sep 16 07:55:34 2022
+++ src/sys/dev/pci/if_vmx.c	Sat May 11 14:49:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.11 2022/09/16 07:55:34 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.11.4.1 2024/05/11 14:49:51 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.11 2022/09/16 07:55:34 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.11.4.1 2024/05/11 14:49:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_vmx.h"
@@ -3544,7 +3544,7 @@ vmxnet3_ifmedia_status(struct ifnet *ifp
 	ifmr->ifm_status |= IFM_ACTIVE;
 
 	if (ifp->if_baudrate >= IF_Gbps(10ULL))
-		ifmr->ifm_active |= IFM_10G_T;
+		ifmr->ifm_active |= IFM_10G_T | IFM_FDX;
 }
 
 static int



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

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

Modified Files:
src/sys/dev/pci [netbsd-10]: if_mcx.c

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

sys/dev/pci/if_mcx.c: revision 1.27

mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124.  OK'd by msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/dev/pci/if_mcx.c

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



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

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

Modified Files:
src/sys/dev/pci [netbsd-10]: if_mcx.c

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

sys/dev/pci/if_mcx.c: revision 1.27

mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124.  OK'd by msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/dev/pci/if_mcx.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_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.25.4.1 src/sys/dev/pci/if_mcx.c:1.25.4.2
--- src/sys/dev/pci/if_mcx.c:1.25.4.1	Fri Nov  3 08:59:29 2023
+++ src/sys/dev/pci/if_mcx.c	Thu Apr 18 16:29:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.25.4.1 2023/11/03 08:59:29 martin Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.25.4.2 2024/04/18 16:29:47 martin Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.25.4.1 2023/11/03 08:59:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.25.4.2 2024/04/18 16:29:47 martin Exp $");
 
 #include 
 #include 
@@ -8072,7 +8072,7 @@ mcx_media_status(struct ifnet *ifp, stru
 	ifmr->ifm_status = IFM_AVALID;
 	if (proto_oper != 0) {
 		ifmr->ifm_status |= IFM_ACTIVE;
-		ifmr->ifm_active = IFM_ETHER | IFM_AUTO | media_oper;
+		ifmr->ifm_active = IFM_ETHER | IFM_FDX | IFM_AUTO | media_oper;
 		/* txpause, rxpause, duplex? */
 	}
 }



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

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

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

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

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.99 -r1.99.4.1 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.99 src/sys/dev/pci/if_iwn.c:1.99.4.1
--- src/sys/dev/pci/if_iwn.c:1.99	Mon Apr 25 02:29:14 2022
+++ src/sys/dev/pci/if_iwn.c	Wed Apr 17 16:23:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.99 2022/04/25 02:29:14 gutteridge Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.99.4.1 2024/04/17 16:23:08 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.99 2022/04/25 02:29:14 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.99.4.1 2024/04/17 16:23:08 martin Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -846,6 +846,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-10] src/sys/dev/pci

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

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

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

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.99 -r1.99.4.1 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-10] src/sys/dev/pci

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 20:09:49 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: xhci_pci.c

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

sys/dev/pci/xhci_pci.c: revision 1.33

Consistently use cached chipset tag value.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.2.1 src/sys/dev/pci/xhci_pci.c

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



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 20:09:49 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: xhci_pci.c

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

sys/dev/pci/xhci_pci.c: revision 1.33

Consistently use cached chipset tag value.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.2.1 src/sys/dev/pci/xhci_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/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.32 src/sys/dev/pci/xhci_pci.c:1.32.2.1
--- src/sys/dev/pci/xhci_pci.c:1.32	Fri Oct 28 21:57:58 2022
+++ src/sys/dev/pci/xhci_pci.c	Mon Mar 11 20:09:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.32 2022/10/28 21:57:58 riastradh Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.32.2.1 2024/03/11 20:09:49 martin Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.32 2022/10/28 21:57:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.32.2.1 2024/03/11 20:09:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -229,7 +229,7 @@ xhci_pci_attach(device_t parent, device_
 	}
 	intrstr = pci_intr_string(pc, psc->sc_pihp[0], intrbuf,
 	sizeof(intrbuf));
-	pci_intr_setattr(pa->pa_pc, &psc->sc_pihp[0], PCI_INTR_MPSAFE, true);
+	pci_intr_setattr(pc, &psc->sc_pihp[0], PCI_INTR_MPSAFE, true);
 	psc->sc_ih = pci_intr_establish_xname(pc, psc->sc_pihp[0], IPL_USB,
 	xhci_intr, sc, device_xname(sc->sc_dev));
 	if (psc->sc_ih == NULL) {



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 20:08:16 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ehci_pci.c

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

sys/dev/pci/ehci_pci.c: revision 1.76

Consistently use cached chipset tag value.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.75.2.1 src/sys/dev/pci/ehci_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/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.75 src/sys/dev/pci/ehci_pci.c:1.75.2.1
--- src/sys/dev/pci/ehci_pci.c:1.75	Fri Oct 28 21:56:44 2022
+++ src/sys/dev/pci/ehci_pci.c	Mon Mar 11 20:08:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.75 2022/10/28 21:56:44 riastradh Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.75.2.1 2024/03/11 20:08:15 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.75 2022/10/28 21:56:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.75.2.1 2024/03/11 20:08:15 martin Exp $");
 
 #include 
 #include 
@@ -196,7 +196,7 @@ ehci_pci_attach(device_t parent, device_
 	 * Allocate IRQ
 	 */
 	intrstr = pci_intr_string(pc, sc->sc_pihp[0], intrbuf, sizeof(intrbuf));
-	pci_intr_setattr(pa->pa_pc, &sc->sc_pihp[0], PCI_INTR_MPSAFE, true);
+	pci_intr_setattr(pc, &sc->sc_pihp[0], PCI_INTR_MPSAFE, true);
 	sc->sc_ih = pci_intr_establish_xname(pc, sc->sc_pihp[0], IPL_USB,
 	ehci_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 20:08:16 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ehci_pci.c

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

sys/dev/pci/ehci_pci.c: revision 1.76

Consistently use cached chipset tag value.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.75.2.1 src/sys/dev/pci/ehci_pci.c

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



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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:54:36 UTC 2024

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

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

sys/dev/pci/if_wm.c: revision 1.795
sys/dev/pci/if_wm.c: revision 1.796
sys/dev/pci/if_wm.c: revision 1.797
sys/dev/pci/if_wmreg.h: revision 1.131

wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

 The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

 Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

 Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

wm(4): Fix compile error without WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.7 -r1.767.2.8 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.128.2.1 -r1.128.2.2 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.767.2.7 src/sys/dev/pci/if_wm.c:1.767.2.8
--- src/sys/dev/pci/if_wm.c:1.767.2.7	Fri Feb 23 18:45:46 2024
+++ src/sys/dev/pci/if_wm.c	Fri Feb 23 18:54:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.767.2.8 2024/02/23 18:54:36 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.767.2.7 2024/02/23 18:45:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.8 2024/02/23 18:54:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -460,9 +460,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
 };
 
@@ -6639,6 +6639,7 @@ wm_update_stats(struct wm_softc *sc)
 	struct ifnet *ifp = &sc->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);
@@ -6787,6 +6788,22 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(&sc->sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(&sc->sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(&sc->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->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->sc_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));
@@ -6815,7 +6832,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.
 	 */
-	if_statadd_ref(nsr, if_iqdrops, mpc);
+	if_statadd_ref(nsr, if_iqdrops, mpc + total_qdrop);
 	IF_STAT_PUTREF(ifp);
 }
 
@@ -6833,6 +6850,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 */
@@ -8195,9 +8214,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++;
@@ -8248,6 +8268,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);
@@ -8437,6 +8459,8 @@ wm_init_rx_regs(struct wm_softc *sc, str
 		

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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:54:36 UTC 2024

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

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

sys/dev/pci/if_wm.c: revision 1.795
sys/dev/pci/if_wm.c: revision 1.796
sys/dev/pci/if_wm.c: revision 1.797
sys/dev/pci/if_wmreg.h: revision 1.131

wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

 The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

 Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

 Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

wm(4): Fix compile error without WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.7 -r1.767.2.8 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.128.2.1 -r1.128.2.2 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-10] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:45:46 UTC 2024

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

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

sys/dev/pci/if_wm.c: revision 1.794
sys/dev/pci/if_wm.c: revision 1.798

wm(4): Print RX packet buffer size.

wm(4): Fix upper 16bit of Image Unique ID(EtrackID).

 Don't override uid1 variable while reading option ROM version
to print Image Unique ID correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.6 -r1.767.2.7 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.767.2.6 src/sys/dev/pci/if_wm.c:1.767.2.7
--- src/sys/dev/pci/if_wm.c:1.767.2.6	Sat Feb  3 12:01:59 2024
+++ src/sys/dev/pci/if_wm.c	Fri Feb 23 18:45:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.767.2.6 2024/02/03 12:01:59 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 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.767.2.6 2024/02/03 12:01:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -2722,6 +2722,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.
 	 *
@@ -15328,16 +15332,17 @@ printver:
 		/* Option ROM Version */
 		if ((off != 0x) && (off != 0x)) {
 			int rv;
+			uint16_t oid0, oid1;
 
 			off += NVM_COMBO_VER_OFF;
-			rv = wm_nvm_read(sc, off + 1, 1, &uid1);
-			rv |= wm_nvm_read(sc, off, 1, &uid0);
-			if ((rv == 0) && (uid0 != 0) && (uid0 != 0x)
-			&& (uid1 != 0) && (uid1 != 0x)) {
+			rv = wm_nvm_read(sc, off + 1, 1, &oid1);
+			rv |= wm_nvm_read(sc, off, 1, &oid0);
+			if ((rv == 0) && (oid0 != 0) && (oid0 != 0x)
+			&& (oid1 != 0) && (oid1 != 0x)) {
 /* 16bits */
-major = uid0 >> 8;
-build = (uid0 << 8) | (uid1 >> 8);
-patch = uid1 & 0x00ff;
+major = oid0 >> 8;
+build = (oid0 << 8) | (oid1 >> 8);
+patch = oid1 & 0x00ff;
 aprint_verbose(", option ROM Version %d.%d.%d",
 major, build, patch);
 			}



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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:45:46 UTC 2024

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

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

sys/dev/pci/if_wm.c: revision 1.794
sys/dev/pci/if_wm.c: revision 1.798

wm(4): Print RX packet buffer size.

wm(4): Fix upper 16bit of Image Unique ID(EtrackID).

 Don't override uid1 variable while reading option ROM version
to print Image Unique ID correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.6 -r1.767.2.7 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-10] src/sys/dev/pci/igc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:41:02 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.c igc_defines.h

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

sys/dev/pci/igc/if_igc.c: revision 1.12
sys/dev/pci/igc/if_igc.c: revision 1.13
sys/dev/pci/igc/igc_defines.h: revision 1.3
sys/dev/pci/igc/if_igc.c: revision 1.10
sys/dev/pci/igc/if_igc.c: revision 1.11

igc(4): Count iqdrops.

 TODO: RQDPC should be visible via evcnt(9).

igc: Add missing igc_check_for_link() call.

 It's required to set the collision distance, configure flow control
from the negotiated result and set the LTR thresholds.

With this change, ifconfig igcN show the flow control status correctly.

igc(4): Modify dmesg output of PHY and NVM info.
 - Print PHY info first and then print NVM info.
 - Remove debug output.

igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/igc_defines.h

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



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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:41:02 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.c igc_defines.h

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

sys/dev/pci/igc/if_igc.c: revision 1.12
sys/dev/pci/igc/if_igc.c: revision 1.13
sys/dev/pci/igc/igc_defines.h: revision 1.3
sys/dev/pci/igc/if_igc.c: revision 1.10
sys/dev/pci/igc/if_igc.c: revision 1.11

igc(4): Count iqdrops.

 TODO: RQDPC should be visible via evcnt(9).

igc: Add missing igc_check_for_link() call.

 It's required to set the collision distance, configure flow control
from the negotiated result and set the LTR thresholds.

With this change, ifconfig igcN show the flow control status correctly.

igc(4): Modify dmesg output of PHY and NVM info.
 - Print PHY info first and then print NVM info.
 - Remove debug output.

igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/igc_defines.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/igc/if_igc.c
diff -u src/sys/dev/pci/igc/if_igc.c:1.3.2.3 src/sys/dev/pci/igc/if_igc.c:1.3.2.4
--- src/sys/dev/pci/igc/if_igc.c:1.3.2.3	Sat Oct 14 06:49:37 2023
+++ src/sys/dev/pci/igc/if_igc.c	Fri Feb 23 18:41:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $	*/
 /*	$OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $	*/
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1112,11 +1112,35 @@ igc_update_counters(struct igc_softc *sc
 
 	/* Mac statistics */
 	struct igc_hw *hw = &sc->hw;
+	struct ifnet *ifp = &sc->sc_ec.ec_if;
+	uint64_t iqdrops = 0;
 
 	for (int cnt = 0; cnt < IGC_MAC_COUNTERS; cnt++) {
-		IGC_MAC_COUNTER_ADD(sc, cnt, igc_read_mac_counter(hw,
-		igc_mac_counters[cnt].reg, igc_mac_counters[cnt].is64));
+		uint64_t val;
+		bus_size_t regaddr = igc_mac_counters[cnt].reg;
+
+		val = igc_read_mac_counter(hw, regaddr,
+		igc_mac_counters[cnt].is64);
+		IGC_MAC_COUNTER_ADD(sc, cnt, val);
+		/* XXX Count MPC to iqdrops. */
+		if (regaddr == IGC_MPC)
+			iqdrops += val;
+	}
+
+	for (int iq = 0; iq < sc->sc_nqueues; iq++) {
+		uint32_t val;
+
+		/* XXX RQDPC should be visible via evcnt(9). */
+		val = IGC_READ_REG(hw, IGC_RQDPC(iq));
+
+		/* RQDPC is not cleard on read. */
+		if (val != 0)
+			IGC_WRITE_REG(hw, IGC_RQDPC(iq), 0);
+		iqdrops += val;
 	}
+
+	if (iqdrops != 0)
+		if_statadd(ifp, if_iqdrops, iqdrops);
 #endif
 }
 
@@ -2518,6 +2542,9 @@ igc_update_link_status(struct igc_softc 
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	struct igc_hw *hw = &sc->hw;
 
+	if (hw->mac.get_link_status == true)
+		igc_check_for_link(hw);
+
 	if (IGC_READ_REG(&sc->hw, IGC_STATUS) & IGC_STATUS_LU) {
 		if (sc->link_active == 0) {
 			igc_get_speed_and_duplex(hw, &sc->link_speed,
@@ -3817,7 +3844,7 @@ igc_print_devinfo(struct igc_softc *sc)
 	struct igc_hw *hw = &sc->hw;
 	struct igc_phy_info *phy = &hw->phy;
 	u_int oui, model, rev;
-	uint16_t id1, id2, nvm_ver, phy_ver;
+	uint16_t id1, id2, nvm_ver, phy_ver, etk_lo, etk_hi;
 	char descr[MII_MAX_DESCR_LEN];
 
 	/* Print PHY Info */
@@ -3829,23 +3856,26 @@ igc_print_devinfo(struct igc_softc *sc)
 	rev = MII_REV(id2);
 	mii_get_descr(descr, sizeof(descr), oui, model);
 	if (descr[0])
-		aprint_normal_dev(dev, "PHY: %s, rev. %d\n",
+		aprint_normal_dev(dev, "PHY: %s, rev. %d",
 		descr, rev);
 	else
 		aprint_normal_dev(dev,
-		"PHY OUI 0x%06x, model 0x%04x, rev. %d\n",
+		"PHY OUI 0x%06x, model 0x%04x, rev. %d",
 		oui, model, rev);
 
-	/* Get NVM version */
+	/* PHY FW version */
+	phy->ops.read_reg(hw, 0x1e, &phy_ver);
+	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+
+	/* NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, &nvm_ver);
 
-	/* Get PHY FW version */
-	phy->ops.read_reg(hw, 0x1e, &phy_ver);
+	/* EtrackID */
+	hw->nvm.ops.read(hw, NVM_ETKID_LO, 1, &etk_lo);
+	hw->nvm.ops.read(hw, NVM_ETKID_HI, 1, &etk_hi);
 
-	aprint_normal_dev(dev, "ROM image version %x.%02x",
+	aprint_normal_dev(dev,
+	"NVM image version %x.%02x, EtrackID %04hx%04hx\n",
 	(nvm_ver & NVM_VERSION_MAJOR) >> NVM_VERSION_MAJOR_SHIFT,
-	(nvm_ver & NVM_VERSION_MINOR));
-	aprint_debug("(0x%04hx)", nvm_ver);
-
-	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+	nvm_ver & NVM_VERSION_MINOR, etk_hi, etk_lo);
 }

Index: src/sys/dev/pci/igc/igc_defines.h
diff -u src/sys/dev/pci/igc/igc_defines.h:1.2.2.2 src/sys/dev/pci/igc/igc_de

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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:36:00 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-10]: ixgbe.c

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.349

ixgbe: Add QPRDC into iqdrops.

 A receive packet might drop at two different locations.

One is the packet buffer that packets are received into the chip first.
If the packet buffer is overflowed, the MPC register is incremented.
It's currently added to iqdrops. It's no problem.

Another is descriptor ring(s). A packet from the packet buffer is DMA'ed
into main memory base on the descriptor ring. If the ring is full, the packet
is dropped and the QPRDC register is incremented. It should be added to
iqdrops but it was not done. Fix it.

Reported by ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.324.2.7 -r1.324.2.8 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.7 src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.8
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.7	Sat Feb  3 11:58:53 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Feb 23 18:35:59 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.324.2.7 2024/02/03 11:58:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.324.2.8 2024/02/23 18:35:59 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.7 2024/02/03 11:58:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.8 2024/02/23 18:35:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1637,7 +1637,7 @@ ixgbe_update_stats_counters(struct ixgbe
 	struct ixgbe_hw	  *hw = &sc->hw;
 	struct ixgbe_hw_stats *stats = &sc->stats.pf;
 	u32		  missed_rx = 0, bprc, lxontxc, lxofftxc;
-	u64		  total, total_missed_rx = 0;
+	u64		  total, total_missed_rx = 0, total_qprdc = 0;
 	uint64_t	  crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
 	unsigned int	  queue_counters;
 	int		  i;
@@ -1656,13 +1656,18 @@ ixgbe_update_stats_counters(struct ixgbe
 		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) {
+			uint32_t qprdc;
+
 			IXGBE_EVC_ADD(&stats->qbrc[i],
 			IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)) +
 			((u64)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32));
 			IXGBE_EVC_ADD(&stats->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]);
+			/* QPRDC will be added to iqdrops. */
+			qprdc = IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
+			IXGBE_EVC_ADD(&stats->qprdc[i], qprdc);
+			total_qprdc += qprdc;
 		} else {
 			/* 82598 */
 			IXGBE_EVC_REGADD(hw, stats, IXGBE_QBRC(i), qbrc[i]);
@@ -1793,7 +1798,7 @@ ixgbe_update_stats_counters(struct ixgbe
 	 * normal RX counters are prepared in ether_input().
 	 */
 	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
-	if_statadd_ref(nsr, if_iqdrops, total_missed_rx);
+	if_statadd_ref(nsr, if_iqdrops, total_missed_rx + total_qprdc);
 
 	/*
 	 * Aggregate following types of errors as RX errors:



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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:36:00 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-10]: ixgbe.c

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.349

ixgbe: Add QPRDC into iqdrops.

 A receive packet might drop at two different locations.

One is the packet buffer that packets are received into the chip first.
If the packet buffer is overflowed, the MPC register is incremented.
It's currently added to iqdrops. It's no problem.

Another is descriptor ring(s). A packet from the packet buffer is DMA'ed
into main memory base on the descriptor ring. If the ring is full, the packet
is dropped and the QPRDC register is incremented. It should be added to
iqdrops but it was not done. Fix it.

Reported by ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.324.2.7 -r1.324.2.8 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2024-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  6 12:34:48 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ppb.c

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

sys/dev/pci/ppb.c: revision 1.75

ppb(4): Print out PCIe Gen5 link speed correctly


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.74.4.1 src/sys/dev/pci/ppb.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/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.74 src/sys/dev/pci/ppb.c:1.74.4.1
--- src/sys/dev/pci/ppb.c:1.74	Sun Oct 10 23:28:36 2021
+++ src/sys/dev/pci/ppb.c	Tue Feb  6 12:34:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.74 2021/10/10 23:28:36 msaitoh Exp $	*/
+/*	$NetBSD: ppb.c,v 1.74.4.1 2024/02/06 12:34:47 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.74 2021/10/10 23:28:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.74.4.1 2024/02/06 12:34:47 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppb.h"
@@ -58,8 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.74
 	(PCIE_SLCSR_ABP | PCIE_SLCSR_PFD | PCIE_SLCSR_MSC |	\
 	 PCIE_SLCSR_PDC | PCIE_SLCSR_CC | PCIE_SLCSR_LACS)
 
-static const char pcie_linkspeed_strings[5][5] = {
-	"1.25", "2.5", "5.0", "8.0", "16.0"
+static const char pcie_linkspeed_strings[6][5] = {
+	"1.25", "2.5", "5.0", "8.0", "16.0", "32.0",
 };
 
 int	ppb_printevent = 0; /* Print event type if the value is not 0 */



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

2024-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  6 12:34:48 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ppb.c

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

sys/dev/pci/ppb.c: revision 1.75

ppb(4): Print out PCIe Gen5 link speed correctly


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.74.4.1 src/sys/dev/pci/ppb.c

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



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

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

Modified Files:
src/sys/dev/pci [netbsd-10]: agp_i810.c

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

sys/dev/pci/agp_i810.c: revision 1.126

agp_i810(4): Use ipi(9) for chipset flush on all CPUs, not xcall(9).

i915 now calls into this with a spin lock held, so we have to use
ipi(9), which spin-waits for the other CPUs to complete, rather than
xcall(9), which may sleep-wait.

Fortunately, this is just to execute WBINVD on x86 (and if this code
ever runs on other architectures, which it probably doesn't, it'll be
a similar barrier instruction), so spinning to wait for that on all
CPUs isn't too costly.

PR kern/57878


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.125.4.1 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.125 src/sys/dev/pci/agp_i810.c:1.125.4.1
--- src/sys/dev/pci/agp_i810.c:1.125	Sun Jul 17 10:10:45 2022
+++ src/sys/dev/pci/agp_i810.c	Sat Feb  3 14:17:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.125 2022/07/17 10:10:45 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.125.4.1 2024/02/03 14:17:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.125 2022/07/17 10:10:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.125.4.1 2024/02/03 14:17:03 martin Exp $");
 
 #include 
 #include 
@@ -180,7 +180,7 @@ agp_i810_post_gtt_entry(struct agp_i810_
 }
 
 static void
-agp_flush_cache_xc(void *a __unused, void *b __unused)
+agp_flush_cache_ipi(void *cookie __unused)
 {
 
 	agp_flush_cache();
@@ -204,11 +204,19 @@ agp_i810_chipset_flush(struct agp_i810_s
 		 * XXX Come to think of it, do these chipsets appear in
 		 * any multi-CPU systems?
 		 */
-		if (cold)
+		if (cold) {
 			agp_flush_cache();
-		else
-			xc_wait(xc_broadcast(0, &agp_flush_cache_xc,
-NULL, NULL));
+		} else {
+			/*
+			 * Caller may hold a spin lock, so use ipi(9)
+			 * rather than xcall(9) here.
+			 */
+			ipi_msg_t msg = { .func = agp_flush_cache_ipi };
+			kpreempt_disable();
+			ipi_broadcast(&msg, /*skip_self*/false);
+			ipi_wait(&msg);
+			kpreempt_enable();
+		}
 		WRITE4(AGP_I830_HIC, READ4(AGP_I830_HIC) | __BIT(31));
 		while (ISSET(READ4(AGP_I830_HIC), __BIT(31))) {
 			if (timo-- == 0)



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

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

Modified Files:
src/sys/dev/pci [netbsd-10]: agp_i810.c

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

sys/dev/pci/agp_i810.c: revision 1.126

agp_i810(4): Use ipi(9) for chipset flush on all CPUs, not xcall(9).

i915 now calls into this with a spin lock held, so we have to use
ipi(9), which spin-waits for the other CPUs to complete, rather than
xcall(9), which may sleep-wait.

Fortunately, this is just to execute WBINVD on x86 (and if this code
ever runs on other architectures, which it probably doesn't, it'll be
a similar barrier instruction), so spinning to wait for that on all
CPUs isn't too costly.

PR kern/57878


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.125.4.1 src/sys/dev/pci/agp_i810.c

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



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

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

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

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

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.767.2.5 -r1.767.2.6 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.767.2.5 src/sys/dev/pci/if_wm.c:1.767.2.6
--- src/sys/dev/pci/if_wm.c:1.767.2.5	Wed Oct 18 14:27:38 2023
+++ src/sys/dev/pci/if_wm.c	Sat Feb  3 12:01:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.767.2.5 2023/10/18 14:27:38 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.767.2.6 2024/02/03 12:01:59 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.767.2.5 2023/10/18 14:27:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.6 2024/02/03 12:01:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -1752,6 +1752,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) */
@@ -1812,6 +1818,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-10] src/sys/dev/pci

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

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

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

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.767.2.5 -r1.767.2.6 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-10] src/sys/dev/pci/ixgbe

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

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

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.110
sys/dev/pci/ixgbe/ixgbe.c: revision 1.345
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.111
sys/dev/pci/ixgbe/ixgbe.c: revision 1.346
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.112
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.62
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.113
sys/dev/pci/ixgbe/ixgbe.c: revision 1.348
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.114
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.115
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.116
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.105
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.106
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.107
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.108
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.109
sys/dev/pci/ixgbe/ixv.c: revision 1.193
sys/dev/pci/ixgbe/ixv.c: revision 1.195
sys/dev/pci/ixgbe/ixv.c: revision 1.196
sys/dev/pci/ixgbe/ixgbe.h: revision 1.94
sys/dev/pci/ixgbe/ixgbe.h: revision 1.95
sys/dev/pci/ixgbe/ixgbe.h: revision 1.96
sys/dev/pci/ixgbe/ixgbe.h: revision 1.97
sys/dev/pci/ixgbe/ixgbe.h: revision 1.98

ixgbe: Fix comment. No functional change.
ixgbe: Whitespace. No functional change.
ixgbe(4): Move assignment of TXD. NFCI.
ixgbe(4): Modify comment. No functional change.
 ixgbe_tx_ctx_setup() may or may not consume one TX descriptor.
ixv(4): Remove unused IFF_OACTIVE. No functional change.
ixgbe: Clear the WTHRESH bit field before writing it.
ixgbe: Modify for the readability. No functional change.
ixgbe: micro-optimize ixgbe_txeof()
 Update txr->tx_avail and txr->txr_no_space outside the loop in ixgbe_txeof().
ixgbe: Update if_opackets outside the loop in ixgbe_txeof().
ixgbe: micro-optimize ixgbe_txeof()
 Update txr->packets outside the loop in ixgbe_txeof().
ixgbe: Use #ifdef IXGBE_FDIR more
 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.
ixgbe: Simplify. No functional change.
 The descriptor ring size and the alignment are tested in the attach
function, so it's not required to use roundup2(size, DBA_ALIGN).
ixgbe: Use kmem_zalloc() instead of malloc(,M_ZERO).
ixgbe: Remove unused to reduce the size of struct rx_ring.
ixgbe: Use #ifdef LRO more to reduce the size of struct rx_ring.
ixgbe: 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.
ixgbe: Use #ifdef RSC
 This feature (hardware receive side coalescing) has been disabled all along,
so enclose the code with #ifdef RSC.


To generate a diff of this commit:
cvs rdiff -u -r1.100.4.4 -r1.100.4.5 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.324.2.6 -r1.324.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.86.4.4 -r1.86.4.5 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.55.4.5 -r1.55.4.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.183.4.5 -r1.183.4.6 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.100.4.4 src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.5
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.4	Wed Oct 18 11:53:22 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Feb  3 11:58:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.100.4.4 2023/10/18 11:53:22 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.100.4.5 2024/02/03 11:58:53 martin Exp $ */
 
 /**
 
@@ -64,13 +64,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.4 2023/10/18 11:53:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.5 2024/02/03 11:58:53 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,
 

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

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

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

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.110
sys/dev/pci/ixgbe/ixgbe.c: revision 1.345
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.111
sys/dev/pci/ixgbe/ixgbe.c: revision 1.346
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.112
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.62
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.113
sys/dev/pci/ixgbe/ixgbe.c: revision 1.348
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.114
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.115
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.116
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.105
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.106
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.107
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.108
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.109
sys/dev/pci/ixgbe/ixv.c: revision 1.193
sys/dev/pci/ixgbe/ixv.c: revision 1.195
sys/dev/pci/ixgbe/ixv.c: revision 1.196
sys/dev/pci/ixgbe/ixgbe.h: revision 1.94
sys/dev/pci/ixgbe/ixgbe.h: revision 1.95
sys/dev/pci/ixgbe/ixgbe.h: revision 1.96
sys/dev/pci/ixgbe/ixgbe.h: revision 1.97
sys/dev/pci/ixgbe/ixgbe.h: revision 1.98

ixgbe: Fix comment. No functional change.
ixgbe: Whitespace. No functional change.
ixgbe(4): Move assignment of TXD. NFCI.
ixgbe(4): Modify comment. No functional change.
 ixgbe_tx_ctx_setup() may or may not consume one TX descriptor.
ixv(4): Remove unused IFF_OACTIVE. No functional change.
ixgbe: Clear the WTHRESH bit field before writing it.
ixgbe: Modify for the readability. No functional change.
ixgbe: micro-optimize ixgbe_txeof()
 Update txr->tx_avail and txr->txr_no_space outside the loop in ixgbe_txeof().
ixgbe: Update if_opackets outside the loop in ixgbe_txeof().
ixgbe: micro-optimize ixgbe_txeof()
 Update txr->packets outside the loop in ixgbe_txeof().
ixgbe: Use #ifdef IXGBE_FDIR more
 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.
ixgbe: Simplify. No functional change.
 The descriptor ring size and the alignment are tested in the attach
function, so it's not required to use roundup2(size, DBA_ALIGN).
ixgbe: Use kmem_zalloc() instead of malloc(,M_ZERO).
ixgbe: Remove unused to reduce the size of struct rx_ring.
ixgbe: Use #ifdef LRO more to reduce the size of struct rx_ring.
ixgbe: 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.
ixgbe: Use #ifdef RSC
 This feature (hardware receive side coalescing) has been disabled all along,
so enclose the code with #ifdef RSC.


To generate a diff of this commit:
cvs rdiff -u -r1.100.4.4 -r1.100.4.5 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.324.2.6 -r1.324.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.86.4.4 -r1.86.4.5 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.55.4.5 -r1.55.4.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.183.4.5 -r1.183.4.6 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-10] src/sys/dev/pci

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

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

Log Message:
regen (ticket #560)


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.11 -r1.1452.2.12 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.11 -r1.1451.2.12 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-10] src/sys/dev/pci

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

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

Log Message:
regen (ticket #560)


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.11 -r1.1452.2.12 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.11 -r1.1451.2.12 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-10] src/sys/dev/pci

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

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

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

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 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)
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.1471.2.10 -r1.1471.2.11 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.1471.2.10 src/sys/dev/pci/pcidevs:1.1471.2.11
--- src/sys/dev/pci/pcidevs:1.1471.2.10	Fri Nov  3 08:59:29 2023
+++ src/sys/dev/pci/pcidevs	Sat Feb  3 11:19:21 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1471.2.10 2023/11/03 08:59:29 martin Exp $
+$NetBSD: pcidevs,v 1.1471.2.11 2024/02/03 11:19:21 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
@@ -5960,7 +5963,7 @@ product INTEL ADL_U15_2_4_HOST	0x4609	Al
 product INTEL ADL_U9_2_4_HOST	0x460a	Alder Lake (U9,2+4) Host
 product INTEL ADL_PCIE_RP_0	0x460d	Alder Lake PCIe G5 Root Port 0 (x16)
 product INTEL ADL_XDCI		0x460e	Alder Lake USB-C Device (xDCI)
-product INTEL ADL_S_2_0_HOST	0x4610	Alder Lake (S,2+0) Host
+product INTEL ADL_S_2_0_HOST	0x4610	Alder Lake Refresh (S,2+0) Host
 product INTEL ADL_N_8_HOST	0x4617	Alder Lake-N (0+8) Host
 product INTEL ADL_U15_1_4_HOST	0x4619	Alder Lake (U15,1+4) Host
 product INTEL ADL_U9_1_4_HOST	0x461a	Alder Lake (U9,1+4) Host
@@ -5982,7 +5985,9 @@ product INTEL ADL_HX_6_8_HOST	0x463b	Ald
 product INTEL ADL_PCIE_RP_3	0x463d	Alder Lake PCIe G4 Root Port 3 (x4)
 product INTEL ADL_TBTDMA_0	0x463e	Alder Lake Thunderbolt DMA 0
 product INTEL ADL_TBT_PCIE_1	0x463f	Alder Lake Thunderbolt PCIe 1
+product INTEL RPL_S_6_8_HOST_2	0x4640	Raptor Lake (S,6+8) Host
 product INTEL ADL_H_6_8_HOST	0x4641	Alder Lake (H,6+8) Host
+product INTEL RPL_HX_6_4_HOST_2	0x4647	Raptor Lake (HX,6+4) Host
 product INTEL ADL_S_6_4_HOST	0x4648	Alder Lake (S,6+4) Host
 product INTEL ADL_H_6_4_HOST	0x4649	Alder Lake (H,6+4) Host
 product INTEL ADL_PCIE_RP_2	0x464d	Alder Lake PCIe G4 Root Port 2 (x4)
@@ -6302,6 +6307,10 @@ product INTEL I219_LM18		0x550a	I219-LM 
 product INTEL I219_V18		0x550b	I219-V (18) Ethernet Connection
 product INTEL I219_LM19		0x550c	I219-LM (19) Ethernet Connection
 product INTEL I219_V19		0x550d	I219-V (19) Ethernet Connection
+product INTEL I219_LM20		0x550e	I219-LM (20) Ethernet Connection
+product INTEL I219_V20		0x550f	I219-V (20) Ethernet Connection
+product INTEL I219_LM21		0x5510	I219-LM (21) Ethernet Connection
+product INTEL I219_V21		0x5511	I219-V (21) Ethernet Connection
 product INTEL CORE7G_H_M_D_HOST_DRAM 0x5900 Core 7G (H, Mobile, Dual) Host Bridge, DRAM
 product INTEL CORE7G_PCIE_X16	0x5901	Core 7G PCIe x16
 product INTEL CORE7G_S_GT1	0x5902	HD Graphics 610 (GT1)
@@ -6505,6 +6514,8 @@ product INTEL I740		0x7800	i740 Graphics
 product INTEL 7HS_Z790_ESPI	0x7a04	Z790 eSPI
 product INTEL 7HS_H770_ESPI	0x7a05	H770 eSPI
 product INTEL 7HS_B760_ESPI	0x7a06	B760 eSPI
+product INTEL 7HS_C266_ESPI	0x7a13	C266 eSPI
+product INTEL 7HS_C262_ESPI	0x7a14	C262 eSPI
 product INTEL 7HS_P2SB		0x7a20	700 Series PCH P2SB
 product INTEL 7HS_PMC		0x7a21	700 Series PCH PMC
 product INTEL 7HS_SMB		0x7a23	700 Series PCH SMBus
@@ -7431,7 +7442,12 @@ product INTEL RPL_S_6_4_HOST	0xa705	Rapt
 product INTEL RPL_H_6_8_HOST	0xa706	Raptor Lake (H,6+8) Host
 product INTEL RPL_H_4_8_HOST	0xa707	Raptor Lake (H,4+8) Host
 product INTEL RPL_U_2_8_HOST	0xa708	Raptor Lake (U,2+8) Host
+product INTEL RPL_PX_6_8_HOST	0xa709	Raptor Lake (PX,6+8) Host
+product INTEL RPL_PX_4_8_HOST	0xa70a	Raptor Lake (PX,4+8) Host
 product INTEL RPL_PCIE_RP_0	0xa70d	Raptor Lake PCIe G5 Root Port 0 (x16)
+product INTEL RPL_E_8_0_HOST	0xa711	Raptor Lake (E,8+0) Host
+product INTEL RP

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

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

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

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

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 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)
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.1471.2.10 -r1.1471.2.11 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-10] src/sys/dev/pci

2024-01-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 14 15:24:06 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: cmpci.c fms.c sv.c yds.c

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

sys/dev/pci/yds.c: revision 1.69
sys/dev/pci/cmpci.c: revision 1.61
sys/dev/pci/sv.c: revision 1.62
sys/dev/pci/fms.c: revision 1.50

mpu / opl: add an interface attribute to config_found() calls for these

specify an interface attribute when attaching mpu and opl devices.
the PCI devices that are the parents of these midi devices
(cmpci, eso, fms, sv, yds) have two interface attributes:
"audiobus", and also one named the same as the parent device,
eg. "cmpci" has an interface attribute named "cmpci".
we must specify the latter one to attach these children.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.4.1 src/sys/dev/pci/cmpci.c
cvs rdiff -u -r1.49 -r1.49.6.1 src/sys/dev/pci/fms.c
cvs rdiff -u -r1.61 -r1.61.6.1 src/sys/dev/pci/sv.c
cvs rdiff -u -r1.68 -r1.68.6.1 src/sys/dev/pci/yds.c

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



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

2024-01-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 14 15:24:06 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: cmpci.c fms.c sv.c yds.c

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

sys/dev/pci/yds.c: revision 1.69
sys/dev/pci/cmpci.c: revision 1.61
sys/dev/pci/sv.c: revision 1.62
sys/dev/pci/fms.c: revision 1.50

mpu / opl: add an interface attribute to config_found() calls for these

specify an interface attribute when attaching mpu and opl devices.
the PCI devices that are the parents of these midi devices
(cmpci, eso, fms, sv, yds) have two interface attributes:
"audiobus", and also one named the same as the parent device,
eg. "cmpci" has an interface attribute named "cmpci".
we must specify the latter one to attach these children.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.4.1 src/sys/dev/pci/cmpci.c
cvs rdiff -u -r1.49 -r1.49.6.1 src/sys/dev/pci/fms.c
cvs rdiff -u -r1.61 -r1.61.6.1 src/sys/dev/pci/sv.c
cvs rdiff -u -r1.68 -r1.68.6.1 src/sys/dev/pci/yds.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/cmpci.c
diff -u src/sys/dev/pci/cmpci.c:1.60 src/sys/dev/pci/cmpci.c:1.60.4.1
--- src/sys/dev/pci/cmpci.c:1.60	Tue May 31 08:43:15 2022
+++ src/sys/dev/pci/cmpci.c	Sun Jan 14 15:24:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmpci.c,v 1.60 2022/05/31 08:43:15 andvar Exp $	*/
+/*	$NetBSD: cmpci.c,v 1.60.4.1 2024/01/14 15:24:06 martin Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.60 2022/05/31 08:43:15 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.60.4.1 2024/01/14 15:24:06 martin Exp $");
 
 #if defined(AUDIO_DEBUG) || defined(DEBUG)
 #define DPRINTF(x) if (cmpcidebug) printf x
@@ -419,7 +419,7 @@ cmpci_attach(device_t parent, device_t s
 	aa.type = AUDIODEV_TYPE_OPL;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	(void)config_found(sc->sc_dev, &aa, audioprint, CFARGS_NONE);
+	(void)config_found(sc->sc_dev, &aa, audioprint, CFARGS(.iattr = "cmpci"));
 
 	/* attach MPU-401 device */
 	aa.type = AUDIODEV_TYPE_MPU;
@@ -428,7 +428,7 @@ cmpci_attach(device_t parent, device_t s
 	if (bus_space_subregion(sc->sc_iot, sc->sc_ioh,
 	CMPCI_REG_MPU_BASE, CMPCI_REG_MPU_SIZE, &sc->sc_mpu_ioh) == 0)
 		sc->sc_mpudev = config_found(sc->sc_dev, &aa, audioprint,
-		CFARGS_NONE);
+		CFARGS(.iattr = "cmpci"));
 
 	/* get initial value (this is 0 and may be omitted but just in case) */
 	sc->sc_reg_misc = bus_space_read_4(sc->sc_iot, sc->sc_ioh,

Index: src/sys/dev/pci/fms.c
diff -u src/sys/dev/pci/fms.c:1.49 src/sys/dev/pci/fms.c:1.49.6.1
--- src/sys/dev/pci/fms.c:1.49	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/fms.c	Sun Jan 14 15:24:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fms.c,v 1.49 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: fms.c,v 1.49.6.1 2024/01/14 15:24:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.49 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.49.6.1 2024/01/14 15:24:06 martin Exp $");
 
 #include "mpu.h"
 
@@ -325,12 +325,13 @@ fms_attach(device_t parent, device_t sel
 	aa.type = AUDIODEV_TYPE_OPL;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	config_found(sc->sc_dev, &aa, audioprint, CFARGS_NONE);
+	config_found(sc->sc_dev, &aa, audioprint, CFARGS(.iattr = "fms"));
 
 	aa.type = AUDIODEV_TYPE_MPU;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	sc->sc_mpu_dev = config_found(sc->sc_dev, &aa, audioprint, CFARGS_NONE);
+	sc->sc_mpu_dev = config_found(sc->sc_dev, &aa, audioprint,
+	CFARGS(.iattr = "fms"));
 }
 
 /*

Index: src/sys/dev/pci/sv.c
diff -u src/sys/dev/pci/sv.c:1.61 src/sys/dev/pci/sv.c:1.61.6.1
--- src/sys/dev/pci/sv.c:1.61	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/sv.c	Sun Jan 14 15:24:06 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: sv.c,v 1.61 2021/08/07 16:19:14 thorpej Exp $ */
+/*  $NetBSD: sv.c,v 1.61.6.1 2024/01/14 15:24:06 martin Exp $ */
 /*  $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */
 
 /*
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.61 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.61.6.1 2024/01/14 15:24:06 martin Exp $");
 
 #include 
 #include 
@@ -449,7 +449,7 @@ sv_attach(device_t parent, device_t self
 	arg.type = AUDIODEV_TYPE_OPL;
 	arg.hwif = 0;
 	arg.hdl = 0;
-	(void)config_found(self, &arg, audioprint, CFARGS_NONE);
+	(void)config_found(self, &arg, audioprint, CFARGS(.iattr = "sv"));
 
 	sc->sc_pa = *pa;	/* for deferred setup */
 	config_defer(self, sv_defer);

Index: src/sys/dev/pci/yds.c
diff -u src/sys/dev/pci/yds.c:1.68 src/sys/dev/pci/yds.c:1.68.6.1
--- src/sys/dev/pci/yds.c:1.68	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/yds.c	Sun Jan 1

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

2024-01-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 14 15:20:19 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ips.c

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

sys/dev/pci/ips.c: revision 1.7

ips: fix a couple more device_t/softc split bugs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/dev/pci/ips.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/ips.c
diff -u src/sys/dev/pci/ips.c:1.6 src/sys/dev/pci/ips.c:1.6.4.1
--- src/sys/dev/pci/ips.c:1.6	Sat Feb 12 02:58:50 2022
+++ src/sys/dev/pci/ips.c	Sun Jan 14 15:20:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ips.c,v 1.6 2022/02/12 02:58:50 riastradh Exp $	*/
+/*	$NetBSD: ips.c,v 1.6.4.1 2024/01/14 15:20:19 martin Exp $	*/
 /*	$OpenBSD: ips.c,v 1.113 2016/08/14 04:08:03 dlg Exp $	*/
 
 /*-
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ips.c,v 1.6 2022/02/12 02:58:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ips.c,v 1.6.4.1 2024/01/14 15:20:19 martin Exp $");
 
 #include "bio.h"
 
@@ -458,7 +458,7 @@ struct ips_softc {
 };
 
 int	ips_match(device_t, cfdata_t, void *);
-void	ips_attach(struct device *, struct device *, void *);
+void	ips_attach(device_t, device_t, void *);
 
 void	ips_scsi_cmd(struct ips_ccb *);
 void	ips_scsi_pt_cmd(struct scsipi_xfer *);
@@ -617,9 +617,9 @@ ips_match(device_t parent, cfdata_t cfda
 }
 
 void
-ips_attach(struct device *parent, struct device *self, void *aux)
+ips_attach(device_t parent, device_t self, void *aux)
 {
-	struct ips_softc *sc = (struct ips_softc *)self;
+	struct ips_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
 	struct ips_ccb ccb0;
 	struct ips_adapterinfo *ai;
@@ -1042,7 +1042,7 @@ ips_scsi_ioctl(struct scsipi_channel *ch
 int
 ips_ioctl(device_t dev, u_long cmd, void *data)
 {
-	struct ips_softc *sc = (struct ips_softc *)dev;
+	struct ips_softc *sc = device_private(dev);
 
 	DPRINTF(IPS_D_INFO, ("%s: ips_ioctl: cmd %lu\n",
 	device_xname(sc->sc_dev), cmd));
@@ -1086,7 +1086,7 @@ ips_ioctl_vol(struct ips_softc *sc, stru
 	struct ips_rblstat *rblstat = &sc->sc_info->rblstat;
 	struct ips_ld *ld;
 	int vid = bv->bv_volid;
-	struct device *dv;
+	device_t dv;
 	int error, rebuild = 0;
 	u_int32_t total = 0, done = 0;
 



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

2024-01-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 14 15:20:19 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: ips.c

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

sys/dev/pci/ips.c: revision 1.7

ips: fix a couple more device_t/softc split bugs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/dev/pci/ips.c

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



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

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

Modified Files:
src/sys/dev/pci [netbsd-10]: pci_resource.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #483):

sys/dev/pci/pci_resource.c: revision 1.4

pci: Improve resource allocation for non-prefetchable BARs.

When allocating resources for PCI devices, use the following criteria:
  - Prefetchable memory must be allocated from the prefetchable range
of the parent bridge.
  - For 64-bit MMIO, try the prefetchable range first, and fallback to
the non-prefetchable range. The idea here is to preserve 32-bit resources
for 32-bit BARs.
  - For 32-bit MMIO, try the non-prefetchable range first. If that fails,
make one last attempt at allocating from the prefetchable range, in the
event that it has resources below 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/dev/pci/pci_resource.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/pci_resource.c
diff -u src/sys/dev/pci/pci_resource.c:1.3 src/sys/dev/pci/pci_resource.c:1.3.2.1
--- src/sys/dev/pci/pci_resource.c:1.3	Sat Oct 15 20:11:44 2022
+++ src/sys/dev/pci/pci_resource.c	Wed Nov 29 12:34:46 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_resource.c,v 1.3 2022/10/15 20:11:44 riastradh Exp $ */
+/* $NetBSD: pci_resource.c,v 1.3.2.1 2023/11/29 12:34:46 martin Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_resource.c,v 1.3 2022/10/15 20:11:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_resource.c,v 1.3.2.1 2023/11/29 12:34:46 martin Exp $");
 
 #include 
 #include 
@@ -684,13 +684,46 @@ pci_resource_init_device(struct pci_reso
 
 		KASSERT(pi->pi_type == PCI_MAPREG_TYPE_MEM);
 		error = ERANGE;
-		if (pi->pi_mem.prefetch && res_pmem != NULL) {
-			error = pci_resource_claim(res_pmem, pi->pi_base,
-			pi->pi_base + pi->pi_size - 1);
-		}
-		if (error && res_mem != NULL) {
-			error = pci_resource_claim(res_mem, pi->pi_base,
-			pi->pi_base + pi->pi_size - 1);
+		if (pi->pi_mem.prefetch) {
+			/*
+			 * Prefetchable memory must be allocated from the
+			 * bridge's prefetchable region.
+			 */
+			if (res_pmem != NULL) {
+error = pci_resource_claim(res_pmem, pi->pi_base,
+pi->pi_base + pi->pi_size - 1);
+			}
+		} else if (pi->pi_mem.memtype == PCI_MAPREG_MEM_TYPE_64BIT) {
+			/*
+			 * Non-prefetchable 64-bit memory can be allocated from
+			 * any range. Prefer allocations from the prefetchable
+			 * region to save 32-bit only resources for 32-bit BARs.
+			 */
+			if (res_pmem != NULL) {
+error = pci_resource_claim(res_pmem, pi->pi_base,
+pi->pi_base + pi->pi_size - 1);
+			}
+			if (error && res_mem != NULL) {
+error = pci_resource_claim(res_mem, pi->pi_base,
+pi->pi_base + pi->pi_size - 1);
+			}
+		} else {
+			/*
+			 * Non-prefetchable 32-bit memory can be allocated from
+			 * any range, provided that the range is below 4GB. Try
+			 * the non-prefetchable range first, and if that fails,
+			 * make one last attempt at allocating from the
+			 * prefetchable range in case the platform provides
+			 * memory below 4GB.
+			 */
+			if (res_mem != NULL) {
+error = pci_resource_claim(res_mem, pi->pi_base,
+pi->pi_base + pi->pi_size - 1);
+			}
+			if (error && res_pmem != NULL) {
+error = pci_resource_claim(res_pmem, pi->pi_base,
+pi->pi_base + pi->pi_size - 1);
+			}
 		}
 		if (error) {
 			DPRINT("PCI: " PCI_SBDF_FMT " [device] mem"



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

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

Modified Files:
src/sys/dev/pci [netbsd-10]: pci_resource.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #483):

sys/dev/pci/pci_resource.c: revision 1.4

pci: Improve resource allocation for non-prefetchable BARs.

When allocating resources for PCI devices, use the following criteria:
  - Prefetchable memory must be allocated from the prefetchable range
of the parent bridge.
  - For 64-bit MMIO, try the prefetchable range first, and fallback to
the non-prefetchable range. The idea here is to preserve 32-bit resources
for 32-bit BARs.
  - For 32-bit MMIO, try the non-prefetchable range first. If that fails,
make one last attempt at allocating from the prefetchable range, in the
event that it has resources below 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/dev/pci/pci_resource.c

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



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

2023-11-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Nov 26 12:38:56 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: pciide_common.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #470):
sys/dev/pci/pciide_common.c: revision 1.70
pciide_dma_dmamap_setup(): If we end up with a DMA segment with an odd
length or odd starting address, unload the map and return EINVAL.  Some
controllers get really upset if a DMA segment has an odd address or length.
This can happen if a physio user performs a virtually-contiguous I/O that
starts at an odd address and spans a page boundary where the resulting
physical pages are discontiguous.  The EINVAL return will cause the upper
layers in the ATA code to re-try the I/O using PIO, which should (will
in all of my tests) succeed.
PR port-alpha/56434


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.67.20.1 src/sys/dev/pci/pciide_common.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/pciide_common.c
diff -u src/sys/dev/pci/pciide_common.c:1.67 src/sys/dev/pci/pciide_common.c:1.67.20.1
--- src/sys/dev/pci/pciide_common.c:1.67	Mon Aug 24 05:37:41 2020
+++ src/sys/dev/pci/pciide_common.c	Sun Nov 26 12:38:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_common.c,v 1.67 2020/08/24 05:37:41 msaitoh Exp $	*/
+/*	$NetBSD: pciide_common.c,v 1.67.20.1 2023/11/26 12:38:56 bouyer Exp $	*/
 
 
 /*
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.67 2020/08/24 05:37:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.67.20.1 2023/11/26 12:38:56 bouyer Exp $");
 
 #include 
 
@@ -721,25 +721,51 @@ pciide_dma_dmamap_setup(struct pciide_so
 	BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 
 	for (seg = 0; seg < dma_maps->dmamap_xfer->dm_nsegs; seg++) {
+		bus_addr_t phys = dma_maps->dmamap_xfer->dm_segs[seg].ds_addr;
+		bus_size_t len = dma_maps->dmamap_xfer->dm_segs[seg].ds_len;
+
 #ifdef DIAGNOSTIC
 		/* A segment must not cross a 64k boundary */
 		{
-		u_long phys = dma_maps->dmamap_xfer->dm_segs[seg].ds_addr;
-		u_long len = dma_maps->dmamap_xfer->dm_segs[seg].ds_len;
 		if ((phys & ~IDEDMA_BYTE_COUNT_MASK) !=
 		((phys + len - 1) & ~IDEDMA_BYTE_COUNT_MASK)) {
-			printf("pciide_dma: segment %d physical addr 0x%lx"
-			" len 0x%lx not properly aligned\n",
-			seg, phys, len);
+			printf("pciide_dma: seg %d addr 0x%" PRIx64
+			" len 0x%" PRIx64 " not properly aligned\n",
+			seg, (uint64_t)phys, (uint64_t)len);
 			panic("pciide_dma: buf align");
 		}
 		}
 #endif
-		dma_maps->dma_table[seg].base_addr =
-		htole32(dma_maps->dmamap_xfer->dm_segs[seg].ds_addr);
+		/*
+		 * Some controllers get really upset if the length
+		 * of any DMA segment is odd.  This isn't something
+		 * that's going to happen in normal steady-state
+		 * operation (reading VM pages, etc.), but physio users
+		 * don't have as many guard rails.
+		 *
+		 * Consider an 8K read request that starts at an odd
+		 * offset within a page.  At first blush, all of the
+		 * checks pass because it's a sector-rounded size, but
+		 * unless the buffer spans 2 physically contiguous pages,
+		 * it's going to result in 2 odd-length DMA segments.
+		 *
+		 * Odd start addresses are also frowned upon, so we
+		 * catch those here, too.
+		 *
+		 * Returning EINVAL here will cause the upper layers to
+		 * fall back onto PIO.
+		 */
+		if ((phys & 1) != 0 || (len & 1) != 0) {
+			aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev,
+			"Invalid DMA segment: "
+			"seg %d addr 0x%" PRIx64 " len 0x%" PRIx64 "\n",
+			seg, (uint64_t)phys, (uint64_t)len);
+			bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_xfer);
+			return EINVAL;
+		}
+		dma_maps->dma_table[seg].base_addr = htole32(phys);
 		dma_maps->dma_table[seg].byte_count =
-		htole32(dma_maps->dmamap_xfer->dm_segs[seg].ds_len &
-		IDEDMA_BYTE_COUNT_MASK);
+		htole32(len & IDEDMA_BYTE_COUNT_MASK);
 		ATADEBUG_PRINT(("\t seg %d len %d addr 0x%x\n",
 		   seg, le32toh(dma_maps->dma_table[seg].byte_count),
 		   le32toh(dma_maps->dma_table[seg].base_addr)), DEBUG_DMA);



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

2023-11-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Nov 26 12:38:56 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: pciide_common.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #470):
sys/dev/pci/pciide_common.c: revision 1.70
pciide_dma_dmamap_setup(): If we end up with a DMA segment with an odd
length or odd starting address, unload the map and return EINVAL.  Some
controllers get really upset if a DMA segment has an odd address or length.
This can happen if a physio user performs a virtually-contiguous I/O that
starts at an odd address and spans a page boundary where the resulting
physical pages are discontiguous.  The EINVAL return will cause the upper
layers in the ATA code to re-try the I/O using PIO, which should (will
in all of my tests) succeed.
PR port-alpha/56434


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.67.20.1 src/sys/dev/pci/pciide_common.c

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



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

2023-11-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  3 09:00:33 UTC 2023

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

Log Message:
Regen for ticket #447 (Add Mellanox ConnectX-6 Lx)


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.10 -r1.1452.2.11 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.10 -r1.1451.2.11 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.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1452.2.10 src/sys/dev/pci/pcidevs.h:1.1452.2.11
--- src/sys/dev/pci/pcidevs.h:1.1452.2.10	Wed Oct 18 14:33:15 2023
+++ src/sys/dev/pci/pcidevs.h	Fri Nov  3 09:00:14 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1452.2.10 2023/10/18 14:33:15 martin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1452.2.11 2023/11/03 09:00:14 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1471.2.9 2023/10/18 14:27:37 martin Exp
+ *	NetBSD: pcidevs,v 1.1471.2.10 2023/11/03 08:59:29 martin Exp
  */
 
 /*
@@ -7674,6 +7674,7 @@
 #define	PCI_PRODUCT_MELLANOX_MT28908	0x101b		/* ConnectX-6 */
 #define	PCI_PRODUCT_MELLANOX_MT28908VF	0x101c		/* ConnectX-6 VF */
 #define	PCI_PRODUCT_MELLANOX_MT2892	0x101d		/* ConnectX-6 Dx */
+#define	PCI_PRODUCT_MELLANOX_MT2894	0x101f		/* ConnectX-6 Lx */
 #define	PCI_PRODUCT_MELLANOX_MT23108	0x5a44		/* InfiniHost (Tavor) */
 #define	PCI_PRODUCT_MELLANOX_MT23108_PCI	0x5a46		/* InfiniHost PCI Bridge (Tavor) */
 #define	PCI_PRODUCT_MELLANOX_MT25204_OLD	0x5e8c		/* InfiniHost III Lx (old Sinai) */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1451.2.10 src/sys/dev/pci/pcidevs_data.h:1.1451.2.11
--- src/sys/dev/pci/pcidevs_data.h:1.1451.2.10	Wed Oct 18 14:33:15 2023
+++ src/sys/dev/pci/pcidevs_data.h	Fri Nov  3 09:00:14 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1451.2.10 2023/10/18 14:33:15 martin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1451.2.11 2023/11/03 09:00:14 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1471.2.9 2023/10/18 14:27:37 martin Exp
+ *	NetBSD: pcidevs,v 1.1471.2.10 2023/11/03 08:59:29 martin Exp
  */
 
 /*
@@ -13953,6 +13953,8 @@ static const uint32_t pci_products[] = {
 	32374, 15370, 0,
 	PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT2892, 
 	32374, 32385, 0,
+	PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT2894, 
+	32374, 32357, 0,
 	PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT23108, 
 	32388, 32399, 0,
 	PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT23108_PCI, 
@@ -22912,10 +22914,10 @@ static const char pci_words[] = { "." 
 	"G550\0" /* 1 refs @ 32335 */
 	"MQ200\0" /* 1 refs @ 32340 */
 	"ConnectX-4\0" /* 4 refs @ 32346 */
-	"Lx\0" /* 4 refs @ 32357 */
+	"Lx\0" /* 5 refs @ 32357 */
 	"ConnectX-5\0" /* 4 refs @ 32360 */
 	"Ex\0" /* 4 refs @ 32371 */
-	"ConnectX-6\0" /* 3 refs @ 32374 */
+	"ConnectX-6\0" /* 4 refs @ 32374 */
 	"Dx\0" /* 1 refs @ 32385 */
 	"InfiniHost\0" /* 6 refs @ 32388 */
 	"(Tavor)\0" /* 2 refs @ 32399 */



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

2023-11-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  3 09:00:33 UTC 2023

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

Log Message:
Regen for ticket #447 (Add Mellanox ConnectX-6 Lx)


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.10 -r1.1452.2.11 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.10 -r1.1451.2.11 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-10] src/sys/dev/pci

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

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

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

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.29 -r1.29.6.1 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.29 src/sys/dev/pci/mpii.c:1.29.6.1
--- src/sys/dev/pci/mpii.c:1.29	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/mpii.c	Thu Oct 26 15:11:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.29 2021/08/07 16:19:14 thorpej Exp $ */
+/* $NetBSD: mpii.c,v 1.29.6.1 2023/10/26 15:11:02 martin Exp $ */
 /*	$OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $	*/
 /*
  * Copyright (c) 2010, 2012 Mike Belopuhov
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.29 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.29.6.1 2023/10/26 15:11:02 martin Exp $");
 
 #include "bio.h"
 
@@ -3204,7 +3204,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) {
@@ -3264,7 +3263,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-10] src/sys/dev/pci

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

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

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

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.29 -r1.29.6.1 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-10] src/sys/dev/pci

2023-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 22 06:25:32 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #434):

sys/dev/pci/if_rge.c: revision 1.26
sys/dev/pci/if_rge.c: revision 1.28

rge(4): check for all errors in rx buffer allocation
should fix a crash seen by by Chavdar Ivanov reported on current-users.
move the rx and tx list clean up into their own functions, and call the
rx clean up function from the init function if something fails.  this
should fix a potential leak in this case, and generally frees up memory
that won't be used without a successful init phase again.
slight application of 'static', much more could be done.

rge: properly handle mbuf allocation failures in rx interrupts
several changes that should fix crashes seen after an mbuf
allocation failure:
- create RX ring dma maps with BUS_DMA_ALLOCNOW, so that any
  future bus_dmamap_load*() call will succeed.  this avoids one
  error case in rge_newbuf(), that similar cases in eg wm(4)
  actually call panic for now (i think this idea can be copied
  into wm(4) as well.)
- extract the RX descriptor set into a common function that
  both rge_newbuf() and rge_rxeof() can both use.  it's almost
  identical to the old rge_discard_rxbuf() except it also sets
  the rge_addr (this is needed for the newbuf case.)
- move the bus_dmamap_unload() into rge_newbuf(), so that the
  existing mbuf will remain mapped until a new mbuf is allocated.
  (this part is what should fix crashes seen by wiz and Chavdar,
  as the unload follow by sync is what triggers the assert in
  x86 bus_dma.  without the assert, it will would have shortly
  triggered a page fault.)  remove the assignment to NULL for
  the rxq mbuf pointer, it is required for reload.
- add a couple of missing if_statinc() calls.

tested on amd64 and arm64.


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.2 -r1.24.4.3 src/sys/dev/pci/if_rge.c

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



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

2023-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 22 06:25:32 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #434):

sys/dev/pci/if_rge.c: revision 1.26
sys/dev/pci/if_rge.c: revision 1.28

rge(4): check for all errors in rx buffer allocation
should fix a crash seen by by Chavdar Ivanov reported on current-users.
move the rx and tx list clean up into their own functions, and call the
rx clean up function from the init function if something fails.  this
should fix a potential leak in this case, and generally frees up memory
that won't be used without a successful init phase again.
slight application of 'static', much more could be done.

rge: properly handle mbuf allocation failures in rx interrupts
several changes that should fix crashes seen after an mbuf
allocation failure:
- create RX ring dma maps with BUS_DMA_ALLOCNOW, so that any
  future bus_dmamap_load*() call will succeed.  this avoids one
  error case in rge_newbuf(), that similar cases in eg wm(4)
  actually call panic for now (i think this idea can be copied
  into wm(4) as well.)
- extract the RX descriptor set into a common function that
  both rge_newbuf() and rge_rxeof() can both use.  it's almost
  identical to the old rge_discard_rxbuf() except it also sets
  the rge_addr (this is needed for the newbuf case.)
- move the bus_dmamap_unload() into rge_newbuf(), so that the
  existing mbuf will remain mapped until a new mbuf is allocated.
  (this part is what should fix crashes seen by wiz and Chavdar,
  as the unload follow by sync is what triggers the assert in
  x86 bus_dma.  without the assert, it will would have shortly
  triggered a page fault.)  remove the assignment to NULL for
  the rxq mbuf pointer, it is required for reload.
- add a couple of missing if_statinc() calls.

tested on amd64 and arm64.


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.2 -r1.24.4.3 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.24.4.2 src/sys/dev/pci/if_rge.c:1.24.4.3
--- src/sys/dev/pci/if_rge.c:1.24.4.2	Sat Oct 14 06:59:43 2023
+++ src/sys/dev/pci/if_rge.c	Sun Oct 22 06:25:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.24.4.2 2023/10/14 06:59:43 martin Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.24.4.3 2023/10/22 06:25:32 martin Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.2 2023/10/14 06:59:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.3 2023/10/22 06:25:32 martin Exp $");
 
 #include 
 
@@ -106,9 +106,10 @@ int		rge_ifmedia_upd(struct ifnet *);
 void		rge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 int		rge_allocmem(struct rge_softc *);
 int		rge_newbuf(struct rge_softc *, int);
-void		rge_discard_rxbuf(struct rge_softc *, int);
-int		rge_rx_list_init(struct rge_softc *);
-void		rge_tx_list_init(struct rge_softc *);
+static int	rge_rx_list_init(struct rge_softc *);
+static void	rge_rx_list_fini(struct rge_softc *);
+static void	rge_tx_list_init(struct rge_softc *);
+static void	rge_tx_list_fini(struct rge_softc *);
 int		rge_rxeof(struct rge_softc *);
 int		rge_txeof(struct rge_softc *);
 void		rge_reset(struct rge_softc *);
@@ -650,7 +651,7 @@ rge_init(struct ifnet *ifp)
 {
 	struct rge_softc *sc = ifp->if_softc;
 	uint32_t val;
-	int i;
+	unsigned i;
 
 	rge_stop(ifp, 0);
 
@@ -661,11 +662,12 @@ rge_init(struct ifnet *ifp)
 	RGE_WRITE_2(sc, RGE_RXMAXSIZE, RGE_JUMBO_FRAMELEN);
 
 	/* Initialize RX descriptors list. */
-	if (rge_rx_list_init(sc) == ENOBUFS) {
+	int error = rge_rx_list_init(sc);
+	if (error != 0) {
 		device_printf(sc->sc_dev,
 		"init failed: no memory for RX buffers\n");
 		rge_stop(ifp, 1);
-		return (ENOBUFS);
+		return error;
 	}
 
 	/* Initialize TX descriptors. */
@@ -836,7 +838,6 @@ void
 rge_stop(struct ifnet *ifp, int disable)
 {
 	struct rge_softc *sc = ifp->if_softc;
-	int i;
 
 	callout_halt(&sc->sc_timeout, NULL);
 
@@ -867,25 +868,8 @@ rge_stop(struct ifnet *ifp, int disable)
 		sc->rge_head = sc->rge_tail = NULL;
 	}
 
-	/* Free the TX list buffers. */
-	for (i = 0; i < RGE_TX_LIST_CNT; i++) {
-		if (sc->rge_ldata.rge_txq[i].txq_mbuf != NULL) {
-			bus_dmamap_unload(sc->sc_dmat,
-			sc->rge_ldata.rge_txq[i].txq_dmamap);
-			m_freem(sc->rge_ldata.rge_txq[i].txq_mbuf);
-			sc->rge_ldata.rge_txq[i].txq_mbuf = NULL;
-		}
-	}
-
-	/* Free the RX list buffers. */
-	for (i = 0; i < RGE_RX_LIST_CNT; i++) {
-		if (sc->rge_ldata.rge_rxq[i].rxq_mbuf != NULL) {
-			bus_dmamap_unload(sc->sc_dmat,
-			sc->rge_ldata.rge_rxq[i].rxq_dmamap);
-			m_freem(sc->rge_ldata.rge_rxq[i].rxq_mbuf);
-			sc->rge_ldata.rge_rxq[i].rxq_mbuf = NULL;
-		}
-	}
+	rge_tx_list_fini(sc);
+	rge_rx_list_fin

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

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

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

Log Message:
Regen for ticket #421


To generate a diff of this commit:
cvs rdiff -u -r1.1452.2.9 -r1.1452.2.10 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1451.2.9 -r1.1451.2.10 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-10] src/sys/dev/pci

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

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

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

sys/dev/pci/pcidevs: revision 1.1497
sys/dev/pci/if_wm.c: revision 1.790
sys/dev/pci/if_wm.c: revision 1.791
sys/dev/pci/if_wmvar.h: revision 1.51

pcidevs: Add Intel I219{V,LM}({22,23})

wm(4): Add a new workaround for Tiger Lake and newer.
 - Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
   Note that we don't define WM_T_PCH_ADP because we have no any
   Alder Lake specific workaround yet.
 - Add new workaround for Tiger Lake (and newer) in wm_init_locked()
   to avoid packet loss.

wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.4 -r1.767.2.5 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.48.4.2 -r1.48.4.3 src/sys/dev/pci/if_wmvar.h
cvs rdiff -u -r1.1471.2.8 -r1.1471.2.9 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.767.2.4 src/sys/dev/pci/if_wm.c:1.767.2.5
--- src/sys/dev/pci/if_wm.c:1.767.2.4	Sun Oct  8 15:23:26 2023
+++ src/sys/dev/pci/if_wm.c	Wed Oct 18 14:27:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.767.2.4 2023/10/08 15:23:26 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.767.2.5 2023/10/18 14:27:38 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.767.2.4 2023/10/08 15:23:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.5 2023/10/18 14:27:38 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -1733,25 +1733,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 },
@@ -1787,25 +1793,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 (

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

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

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

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

sys/dev/pci/pcidevs: revision 1.1497
sys/dev/pci/if_wm.c: revision 1.790
sys/dev/pci/if_wm.c: revision 1.791
sys/dev/pci/if_wmvar.h: revision 1.51

pcidevs: Add Intel I219{V,LM}({22,23})

wm(4): Add a new workaround for Tiger Lake and newer.
 - Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
   Note that we don't define WM_T_PCH_ADP because we have no any
   Alder Lake specific workaround yet.
 - Add new workaround for Tiger Lake (and newer) in wm_init_locked()
   to avoid packet loss.

wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.4 -r1.767.2.5 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.48.4.2 -r1.48.4.3 src/sys/dev/pci/if_wmvar.h
cvs rdiff -u -r1.1471.2.8 -r1.1471.2.9 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-10] src/sys/dev/pci/ixgbe

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 11:53:22 UTC 2023

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.340
sys/dev/pci/ixgbe/ixgbe.c: revision 1.341
sys/dev/pci/ixgbe/ixgbe.c: revision 1.342
sys/dev/pci/ixgbe/ixgbe.c: revision 1.343
sys/dev/pci/ixgbe/ixgbe.c: revision 1.344
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.61
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.104
sys/dev/pci/ixgbe/ixv.c: revision 1.190
sys/dev/pci/ixgbe/ixv.c: revision 1.191
sys/dev/pci/ixgbe/ixv.c: revision 1.192
sys/dev/pci/ixgbe/ixgbe.h: revision 1.93

ixg(4): Print DEVICE_CAPS register.

ixgbe: Whitespace. No functional change.

ixg(4): Don't print wrong error message about ixgbe_num_queues.
 Don't override the ixgbe_num_queues global variable. It's the default
value of the number of queues and should not override it because it
will be referenced by later device attach. For example, the number of
MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted
to a machine that the number of CPU is 24 and X540 is probed earlier,
ixgbe_num_queues is overridden to 24 and the following error message is
printed when attaching 82599:
ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large,
using reduced amount (17).

Note that the number of queues is in sc->num_queuss and referenced
by hw.ixgN.num_queues sysctl.

ixgbe: Don't override the {ixgbe,ixv}_max_interrupt_rate global variable.

 Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change all
devices all queues default interrupt rate.

ixgbe: Whitespace. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.100.4.3 -r1.100.4.4 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.324.2.4 -r1.324.2.5 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.86.4.3 -r1.86.4.4 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.55.4.4 -r1.55.4.5 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.183.4.3 -r1.183.4.4 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.100.4.3 src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.4
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.3	Fri Oct 13 18:55:12 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Oct 18 11:53:22 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.100.4.3 2023/10/13 18:55:12 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.100.4.4 2023/10/18 11:53:22 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.3 2023/10/13 18:55:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.4 2023/10/18 11:53:22 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1274,9 +1274,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 = &sc->hw;
-	u32  rscctrl, rdrxctl;
+	struct ixgbe_softc *sc = rxr->sc;
+	struct ixgbe_hw	*hw = &sc->hw;
+	u32		rscctrl, rdrxctl;
 
 	/* If turning LRO/RSC off we need to disable it */
 	if ((sc->ifp->if_capenable & IFCAP_LRO) == 0) {

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.4 src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.5
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.4	Fri Oct 13 18:55:12 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Oct 18 11:53:21 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.324.2.4 2023/10/13 18:55:12 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.324.2.5 2023/10/18 11:53:21 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.4 2023/10/13 18:55:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.5 2023/10/18 11:53:21 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -809,7 +809,7 @@ ixgbe_attach(device_t parent, device_t d
 	struct ixgbe_hw *hw;
 	int		error = -1;
 	u32		ctrl_ext;
-	u16		high, low, nvmreg;
+	u16		high, low, nvmreg, dev_caps;
 	pcireg_t	id, subid;
 	const ixgbe_vendor_info_t *ent;
 	struct pci_attach_args *pa = aux;
@@ -1277,10 +1277,15 @@ ixgbe_attach(device_t parent, device_t d
 	if (sc->feat_en & IXGBE_FEATURE_NETMAP)
 		ixgbe_netmap_attach(sc);
 
+	/* Print some flags */
 	snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, sc->feat_cap);
 	aprint_verbose_dev(dev, "feature cap %s\n", buf);
 	snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, sc->feat_en);
 	aprint_verbose_dev(dev, "feature ena %s\n", buf);
+	if (ixgbe_get_d

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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 11:53:22 UTC 2023

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.340
sys/dev/pci/ixgbe/ixgbe.c: revision 1.341
sys/dev/pci/ixgbe/ixgbe.c: revision 1.342
sys/dev/pci/ixgbe/ixgbe.c: revision 1.343
sys/dev/pci/ixgbe/ixgbe.c: revision 1.344
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.61
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.104
sys/dev/pci/ixgbe/ixv.c: revision 1.190
sys/dev/pci/ixgbe/ixv.c: revision 1.191
sys/dev/pci/ixgbe/ixv.c: revision 1.192
sys/dev/pci/ixgbe/ixgbe.h: revision 1.93

ixg(4): Print DEVICE_CAPS register.

ixgbe: Whitespace. No functional change.

ixg(4): Don't print wrong error message about ixgbe_num_queues.
 Don't override the ixgbe_num_queues global variable. It's the default
value of the number of queues and should not override it because it
will be referenced by later device attach. For example, the number of
MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted
to a machine that the number of CPU is 24 and X540 is probed earlier,
ixgbe_num_queues is overridden to 24 and the following error message is
printed when attaching 82599:
ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large,
using reduced amount (17).

Note that the number of queues is in sc->num_queuss and referenced
by hw.ixgN.num_queues sysctl.

ixgbe: Don't override the {ixgbe,ixv}_max_interrupt_rate global variable.

 Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change all
devices all queues default interrupt rate.

ixgbe: Whitespace. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.100.4.3 -r1.100.4.4 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.324.2.4 -r1.324.2.5 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.86.4.3 -r1.86.4.4 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.55.4.4 -r1.55.4.5 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.183.4.3 -r1.183.4.4 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-10] src/sys/dev/pci

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 11:30:30 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_ixl.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #417):

sys/dev/pci/if_ixl.c: revision 1.94
sys/dev/pci/if_ixl.c: revision 1.95

ixl(4): added ETHERCAP_VLAN_MTU support
PR kern/57652

ixl(4): limit receive frame size upto 9600 even if ETHERCAP_VLAN_MTU is enabled


To generate a diff of this commit:
cvs rdiff -u -r1.88.4.1 -r1.88.4.2 src/sys/dev/pci/if_ixl.c

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

Modified files:

Index: src/sys/dev/pci/if_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.88.4.1 src/sys/dev/pci/if_ixl.c:1.88.4.2
--- src/sys/dev/pci/if_ixl.c:1.88.4.1	Sat Oct 14 06:43:06 2023
+++ src/sys/dev/pci/if_ixl.c	Wed Oct 18 11:30:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.88.4.1 2023/10/14 06:43:06 martin Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.88.4.2 2023/10/18 11:30:29 martin Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.88.4.1 2023/10/14 06:43:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.88.4.2 2023/10/18 11:30:29 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -166,7 +166,8 @@ struct ixl_softc; /* defined */
 
 #define IXL_MCLBYTES			(MCLBYTES - ETHER_ALIGN)
 #define IXL_MTU_ETHERLEN		ETHER_HDR_LEN		\
-	+ ETHER_CRC_LEN
+	+ ETHER_CRC_LEN		\
+	+ ETHER_VLAN_ENCAP_LEN
 #if 0
 #define IXL_MAX_MTU			(9728 - IXL_MTU_ETHERLEN)
 #else
@@ -1322,6 +1323,7 @@ ixl_attach(device_t parent, device_t sel
 #endif
 	ether_set_vlan_cb(&sc->sc_ec, ixl_vlan_cb);
 	sc->sc_ec.ec_capabilities |= ETHERCAP_JUMBO_MTU;
+	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_MTU;
 	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING;
 	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_HWFILTER;
 
@@ -3066,6 +3068,8 @@ ixl_rxr_config(struct ixl_softc *sc, str
 
 	memset(&rxq, 0, sizeof(rxq));
 	rxmax = ifp->if_mtu + IXL_MTU_ETHERLEN;
+	if (!ISSET(sc->sc_ec.ec_capenable, ETHERCAP_VLAN_MTU))
+		rxmax -= ETHER_VLAN_ENCAP_LEN;
 
 	rxq.head = htole16(rxr->rxr_cons);
 	rxq.base = htole64(IXL_DMA_DVA(&rxr->rxr_mem) / IXL_HMC_RXQ_BASE_UNIT);
@@ -5671,14 +5675,14 @@ ixl_ifflags_cb(struct ethercom *ec)
 {
 	struct ifnet *ifp = &ec->ec_if;
 	struct ixl_softc *sc = ifp->if_softc;
-	int rv, change;
+	int rv, change, reset_bits;
 
 	mutex_enter(&sc->sc_cfg_lock);
 
 	change = ec->ec_capenable ^ sc->sc_cur_ec_capenable;
-
-	if (ISSET(change, ETHERCAP_VLAN_HWTAGGING)) {
-		sc->sc_cur_ec_capenable ^= ETHERCAP_VLAN_HWTAGGING;
+	reset_bits = change & (ETHERCAP_VLAN_HWTAGGING | ETHERCAP_VLAN_MTU);
+	if (reset_bits != 0) {
+		sc->sc_cur_ec_capenable ^= reset_bits;
 		rv = ENETRESET;
 		goto out;
 	}



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 11:30:30 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_ixl.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #417):

sys/dev/pci/if_ixl.c: revision 1.94
sys/dev/pci/if_ixl.c: revision 1.95

ixl(4): added ETHERCAP_VLAN_MTU support
PR kern/57652

ixl(4): limit receive frame size upto 9600 even if ETHERCAP_VLAN_MTU is enabled


To generate a diff of this commit:
cvs rdiff -u -r1.88.4.1 -r1.88.4.2 src/sys/dev/pci/if_ixl.c

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 14 06:59:43 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c

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

sys/dev/pci/if_rge.c: revision 1.27

rge(4): callout_stop can't be right here; just do callout_halt.


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.1 -r1.24.4.2 src/sys/dev/pci/if_rge.c

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



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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 14 06:59:43 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c

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

sys/dev/pci/if_rge.c: revision 1.27

rge(4): callout_stop can't be right here; just do callout_halt.


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.1 -r1.24.4.2 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.24.4.1 src/sys/dev/pci/if_rge.c:1.24.4.2
--- src/sys/dev/pci/if_rge.c:1.24.4.1	Wed Dec 21 09:36:42 2022
+++ src/sys/dev/pci/if_rge.c	Sat Oct 14 06:59:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.24.4.1 2022/12/21 09:36:42 martin Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.24.4.2 2023/10/14 06:59:43 martin Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.1 2022/12/21 09:36:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.2 2023/10/14 06:59:43 martin Exp $");
 
 #include 
 
@@ -838,10 +838,7 @@ rge_stop(struct ifnet *ifp, int disable)
 	struct rge_softc *sc = ifp->if_softc;
 	int i;
 
-	if (disable) {
-		callout_halt(&sc->sc_timeout, NULL);
-	} else
-		callout_stop(&sc->sc_timeout);
+	callout_halt(&sc->sc_timeout, NULL);
 
 	ifp->if_timer = 0;
 	ifp->if_flags &= ~IFF_RUNNING;



  1   2   >