CVS commit: src/sys/dev/pci

2024-07-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 17 03:13:37 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen after intel arc.


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

2024-07-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 17 03:13:12 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add the intel "arc" a-series of cards.


To generate a diff of this commit:
cvs rdiff -u -r1.1508 -r1.1509 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.1508 src/sys/dev/pci/pcidevs:1.1509
--- src/sys/dev/pci/pcidevs:1.1508	Thu Jul 11 03:58:07 2024
+++ src/sys/dev/pci/pcidevs	Wed Jul 17 03:13:12 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1508 2024/07/11 03:58:07 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1509 2024/07/17 03:13:12 mrg Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6366,6 +6366,26 @@ product INTEL I219_LM20		0x550e	I219-LM 
 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 ARC_A770M		0x5690	Arc A770M Graphics
+product INTEL ARC_A730M		0x5691	Arc A730M Graphics
+product INTEL ARC_A550M		0x5692	Arc A550M Graphics
+product INTEL ARC_A370M		0x5693	Arc A370M Graphics
+product INTEL ARC_A350M		0x5694	Arc A350M Graphics
+product INTEL ARC_A570M		0x5696	Arc A570M Graphics
+product INTEL ARC_A530M		0x5697	Arc A530M Graphics
+product INTEL ARC_A770		0x56A0	Arc A770 Graphics
+product INTEL ARC_A750		0x56A1	Arc A750 Graphics
+product INTEL ARC_A580		0x56A2	Arc A580 Graphics
+product INTEL ARC_A380		0x56A5	Arc A380 Graphics
+product INTEL ARC_A310		0x56A6	Arc A310 Graphics
+product INTEL ARC_PRO_A30M	0x56B0	Arc Pro A30M Graphics
+product INTEL ARC_PRO_A40	0x56B1	Arc Pro A40/A50 Graphics
+product INTEL ARC_PRO_A60M	0x56B2	Arc Pro A60M Graphics
+product INTEL ARC_PRO_A60	0x56B3	Arc Pro A60 Graphics
+product INTEL ARC_A810E		0x56BA	Arc A810E Graphics
+product INTEL ARC_A310E		0x56BB	Arc A310E Graphics
+product INTEL ARC_A370E		0x56BC	Arc A370E Graphics
+product INTEL ARC_A350E		0x56BD	Arc A350E Graphics
 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)



CVS commit: src/sys/dev/pci

2024-07-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 17 03:13:12 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add the intel "arc" a-series of cards.


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

2024-07-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 11 04:47:10 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


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

2024-07-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 11 03:58:07 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Realtek RTL8126.


To generate a diff of this commit:
cvs rdiff -u -r1.1507 -r1.1508 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.1507 src/sys/dev/pci/pcidevs:1.1508
--- src/sys/dev/pci/pcidevs:1.1507	Sun Jun 23 17:22:51 2024
+++ src/sys/dev/pci/pcidevs	Thu Jul 11 03:58:07 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1507 2024/06/23 17:22:51 jakllsch Exp $
+$NetBSD: pcidevs,v 1.1508 2024/07/11 03:58:07 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -9266,6 +9266,7 @@ product REALTEK RT8029		0x8029	8029 Ethe
 product REALTEK RT8139D		0x8039	8139D 10/100 Ethernet
 product REALTEK RT8100		0x8100	8100 10/100 Ethernet
 product REALTEK RT8125		0x8125	8125 10/100/1G/2.5G Ethernet
+product REALTEK RT8126		0x8126	8126 10/100/1G/2.5G/5G Ethernet
 product REALTEK RT8129		0x8129	8129 10/100 Ethernet
 product REALTEK RT8101E		0x8136	8100E/8101E/8102E 10/100 Ethernet
 product REALTEK RT8138		0x8138	8138 10/100 Ethernet



CVS commit: src/sys/dev/pci

2024-07-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 11 03:58:07 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Realtek RTL8126.


To generate a diff of this commit:
cvs rdiff -u -r1.1507 -r1.1508 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: src/sys/dev/pci/ixgbe

2024-07-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 10 03:26:30 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
ixgbe: Remove ifdef NET_MPSAFE. Make ixgbe MP-scalable by default.

 Same as wm(4).


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.197 -r1.198 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: src/sys/dev/pci/ixgbe

2024-07-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 10 03:26:30 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
ixgbe: Remove ifdef NET_MPSAFE. Make ixgbe MP-scalable by default.

 Same as wm(4).


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.197 -r1.198 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/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.353 src/sys/dev/pci/ixgbe/ixgbe.c:1.354
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.353	Wed Jul 10 03:23:02 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Jul 10 03:26:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.353 2024/07/10 03:23:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.354 2024/07/10 03:26:30 msaitoh Exp $ */
 
 /**
 
@@ -64,12 +64,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.353 2024/07/10 03:23:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.354 2024/07/10 03:26:30 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
 #include "opt_inet6.h"
-#include "opt_net_mpsafe.h"
 #endif
 
 #include "ixgbe.h"
@@ -411,17 +410,6 @@ static int (*ixgbe_start_locked)(struct 
 static int (*ixgbe_ring_empty)(struct ifnet *, pcq_t *);
 #endif
 
-#ifdef NET_MPSAFE
-#define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
-#define IXGBE_SOFTINT_FLAGS	SOFTINT_MPSAFE
-#define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU | WQ_MPSAFE
-#define IXGBE_TASKLET_WQ_FLAGS	WQ_MPSAFE
-#else
-#define IXGBE_CALLOUT_FLAGS	0
-#define IXGBE_SOFTINT_FLAGS	0
-#define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU
-#define IXGBE_TASKLET_WQ_FLAGS	0
-#endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
 
 /* Interval between reports of errors */
@@ -844,11 +832,10 @@ ixgbe_attach(device_t parent, device_t d
 	IXGBE_CORE_LOCK_INIT(sc, device_xname(dev));
 
 	/* Set up the timer callout and workqueue */
-	callout_init(>timer, IXGBE_CALLOUT_FLAGS);
+	callout_init(>timer, CALLOUT_MPSAFE);
 	snprintf(wqname, sizeof(wqname), "%s-timer", device_xname(dev));
 	error = workqueue_create(>timer_wq, wqname,
-	ixgbe_handle_timer, sc, IXGBE_WORKQUEUE_PRI, IPL_NET,
-	IXGBE_TASKLET_WQ_FLAGS);
+	ixgbe_handle_timer, sc, IXGBE_WORKQUEUE_PRI, IPL_NET, WQ_MPSAFE);
 	if (error) {
 		aprint_error_dev(dev,
 		"could not create timer workqueue (%d)\n", error);
@@ -1178,8 +1165,7 @@ ixgbe_attach(device_t parent, device_t d
 	mutex_init(&(sc)->admin_mtx, MUTEX_DEFAULT, IPL_NET);
 	snprintf(wqname, sizeof(wqname), "%s-admin", device_xname(dev));
 	error = workqueue_create(>admin_wq, wqname,
-	ixgbe_handle_admin, sc, IXGBE_WORKQUEUE_PRI, IPL_NET,
-	IXGBE_TASKLET_WQ_FLAGS);
+	ixgbe_handle_admin, sc, IXGBE_WORKQUEUE_PRI, IPL_NET, WQ_MPSAFE);
 	if (error) {
 		aprint_error_dev(dev,
 		"could not create admin workqueue (%d)\n", error);
@@ -1296,13 +1282,12 @@ ixgbe_attach(device_t parent, device_t d
 		sc->recovery_mode = 0;
 
 		/* Set up the timer callout */
-		callout_init(>recovery_mode_timer,
-		IXGBE_CALLOUT_FLAGS);
+		callout_init(>recovery_mode_timer, CALLOUT_MPSAFE);
 		snprintf(wqname, sizeof(wqname), "%s-recovery",
 		device_xname(dev));
 		error = workqueue_create(>recovery_mode_timer_wq,
 		wqname, ixgbe_handle_recovery_mode_timer, sc,
-		IXGBE_WORKQUEUE_PRI, IPL_NET, IXGBE_TASKLET_WQ_FLAGS);
+		IXGBE_WORKQUEUE_PRI, IPL_NET, WQ_MPSAFE);
 		if (error) {
 			aprint_error_dev(dev, "could not create "
 			"recovery_mode_timer workqueue (%d)\n", error);
@@ -6835,22 +6820,22 @@ alloc_retry:
 	 */
 	if (!(sc->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 		txr->txr_si =
-		softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
+		softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
 			ixgbe_deferred_mq_start, txr);
 
 		snprintf(wqname, sizeof(wqname), "%sdeferTx",
 		device_xname(dev));
 		defertx_error = workqueue_create(>txr_wq, wqname,
 		ixgbe_deferred_mq_start_work, sc, IXGBE_WORKQUEUE_PRI,
-		IPL_NET, IXGBE_WORKQUEUE_FLAGS);
+		IPL_NET, WQ_PERCPU | WQ_MPSAFE);
 		sc->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
 	}
-	que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
+	que->que_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
 	ixgbe_handle_que, que);
 	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
 	error = workqueue_create(>que_wq, wqname,
 	ixgbe_handle_que_work, sc, IXGBE_WORKQUEUE_PRI, IPL_NET,
-	IXGBE_WORKQUEUE_FLAGS);
+	WQ_PERCPU | WQ_MPSAFE);
 
 	if ((!(sc->feat_en & IXGBE_FEATURE_LEGACY_TX)
 		&& ((txr->txr_si == NULL) || defertx_error != 0))
@@ -6985,7 +6970,7 @@ ixgbe_allocate_msix(struct ixgbe_softc *
 
 		if (!(sc->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 			txr->txr_si = softint_establish(
-SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
+SOFTINT_NET | SOFTINT_MPSAFE,
 			

CVS commit: src/sys/dev/pci/ixgbe

2024-07-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 10 03:23:02 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
ixgbe: ixgbe is always MP-safe, so remove IXGBE_MPSAFE macro.

 Before this change, IXGBE_MPSAFE is not defined if NET_MPSAFE is not set.
In this case, the PCI_INTR_MPSAFE flag is not set by pci_intr_setattr()
and interrupt_distribute() fails on arm. Always enable IXGBE_MPSAFE
funciton by removing the macro.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.196 -r1.197 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/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.352 src/sys/dev/pci/ixgbe/ixgbe.c:1.353
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.352	Sat Jun 29 12:11:12 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Jul 10 03:23:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.352 2024/06/29 12:11:12 riastradh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.353 2024/07/10 03:23:02 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.352 2024/06/29 12:11:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.353 2024/07/10 03:23:02 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -412,7 +412,6 @@ static int (*ixgbe_ring_empty)(struct if
 #endif
 
 #ifdef NET_MPSAFE
-#define IXGBE_MPSAFE		1
 #define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
 #define IXGBE_SOFTINT_FLAGS	SOFTINT_MPSAFE
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU | WQ_MPSAFE
@@ -1385,9 +1384,7 @@ ixgbe_setup_interface(device_t dev, stru
 	ifp->if_stop = ixgbe_ifstop;
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-#ifdef IXGBE_MPSAFE
 	ifp->if_extflags = IFEF_MPSAFE;
-#endif
 	ifp->if_ioctl = ixgbe_ioctl;
 #if __FreeBSD_version >= 1100045
 	/* TSO parameters */
@@ -6929,10 +6926,9 @@ ixgbe_allocate_msix(struct ixgbe_softc *
 		device_xname(dev), i);
 		intrstr = pci_intr_string(pc, sc->osdep.intrs[i], intrbuf,
 		sizeof(intrbuf));
-#ifdef IXGBE_MPSAFE
 		pci_intr_setattr(pc, >osdep.intrs[i], PCI_INTR_MPSAFE,
 		true);
-#endif
+
 		/* Set the handler function */
 		que->res = sc->osdep.ihs[i] = pci_intr_establish_xname(pc,
 		sc->osdep.intrs[i], IPL_NET, ixgbe_msix_que, que,
@@ -7034,10 +7030,8 @@ ixgbe_allocate_msix(struct ixgbe_softc *
 	sc->vector = vector;
 	intrstr = pci_intr_string(pc, sc->osdep.intrs[vector], intrbuf,
 	sizeof(intrbuf));
-#ifdef IXGBE_MPSAFE
-	pci_intr_setattr(pc, >osdep.intrs[vector], PCI_INTR_MPSAFE,
-	true);
-#endif
+	pci_intr_setattr(pc, >osdep.intrs[vector], PCI_INTR_MPSAFE, true);
+
 	/* Set the link handler function */
 	sc->osdep.ihs[vector] = pci_intr_establish_xname(pc,
 	sc->osdep.intrs[vector], IPL_NET, ixgbe_msix_admin, sc,

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.196 src/sys/dev/pci/ixgbe/ixv.c:1.197
--- src/sys/dev/pci/ixgbe/ixv.c:1.196	Wed Nov 15 03:50:22 2023
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Jul 10 03:23:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.196 2023/11/15 03:50:22 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.197 2024/07/10 03:23:02 msaitoh Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.196 2023/11/15 03:50:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.197 2024/07/10 03:23:02 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -229,7 +229,6 @@ static int ixv_enable_legacy_tx = 0;
 TUNABLE_INT("hw.ixv.enable_legacy_tx", _enable_legacy_tx);
 
 #ifdef NET_MPSAFE
-#define IXGBE_MPSAFE		1
 #define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
 #define IXGBE_SOFTINT_FLAGS	SOFTINT_MPSAFE
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU | WQ_MPSAFE
@@ -1657,9 +1656,7 @@ ixv_setup_interface(device_t dev, struct
 	ifp->if_stop = ixv_ifstop;
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-#ifdef IXGBE_MPSAFE
 	ifp->if_extflags = IFEF_MPSAFE;
-#endif
 	ifp->if_ioctl = ixv_ioctl;
 	if (sc->feat_en & IXGBE_FEATURE_LEGACY_TX) {
 #if 0
@@ -3407,10 +3404,9 @@ ixv_allocate_msix(struct ixgbe_softc *sc
 		device_xname(dev), i);
 		intrstr = pci_intr_string(pc, sc->osdep.intrs[i], intrbuf,
 		sizeof(intrbuf));
-#ifdef IXGBE_MPSAFE
 		pci_intr_setattr(pc, >osdep.intrs[i], PCI_INTR_MPSAFE,
 		true);
-#endif
+
 		/* Set the handler function */
 		que->res = sc->osdep.ihs[i] = pci_intr_establish_xname(pc,
 		sc->osdep.intrs[i], IPL_NET, ixv_msix_que, que,
@@ -3476,10 +3472,8 @@ ixv_allocate_msix(struct ixgbe_softc *sc
 	sc->vector = vector;
 	intrstr = pci_intr_string(pc, sc->osdep.intrs[vector], 

CVS commit: src/sys/dev/pci/ixgbe

2024-07-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 10 03:23:02 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
ixgbe: ixgbe is always MP-safe, so remove IXGBE_MPSAFE macro.

 Before this change, IXGBE_MPSAFE is not defined if NET_MPSAFE is not set.
In this case, the PCI_INTR_MPSAFE flag is not set by pci_intr_setattr()
and interrupt_distribute() fails on arm. Always enable IXGBE_MPSAFE
funciton by removing the macro.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.196 -r1.197 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: src/sys/dev/pci

2024-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Jul  7 23:29:04 UTC 2024

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

Log Message:
mcx(4): Match on ConnectX-6 virtual functions, too. From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/dev/pci/if_mcx.c:1.29
--- src/sys/dev/pci/if_mcx.c:1.28	Fri Jul  5 04:31:51 2024
+++ src/sys/dev/pci/if_mcx.c	Sun Jul  7 23:29:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.28 2024/07/05 04:31:51 rin Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.29 2024/07/07 23:29:04 msaitoh 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.28 2024/07/05 04:31:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.29 2024/07/07 23:29:04 msaitoh Exp $");
 
 #include 
 #include 
@@ -2678,6 +2678,7 @@ static const struct {
 	{ PCI_VENDOR_MELLANOX,	PCI_PRODUCT_MELLANOX_MT28800 },
 	{ PCI_VENDOR_MELLANOX,	PCI_PRODUCT_MELLANOX_MT28800VF },
 	{ PCI_VENDOR_MELLANOX,	PCI_PRODUCT_MELLANOX_MT28908 },
+	{ PCI_VENDOR_MELLANOX,	PCI_PRODUCT_MELLANOX_MT28908VF },
 	{ PCI_VENDOR_MELLANOX,	PCI_PRODUCT_MELLANOX_MT2892 },
 	{ PCI_VENDOR_MELLANOX,	PCI_PRODUCT_MELLANOX_MT2894 },
 };



CVS commit: src/sys/dev/pci

2024-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Jul  7 23:29:04 UTC 2024

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

Log Message:
mcx(4): Match on ConnectX-6 virtual functions, too. From OpenBSD.


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

2024-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jun 30 09:30:45 UTC 2024

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

Log Message:
pci_resource: Make unexpected bus numbers in bridges non-fatal.

Firmware bugs happen. Log a warning and continue instead of panicing.


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

2024-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jun 30 09:30:45 UTC 2024

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

Log Message:
pci_resource: Make unexpected bus numbers in bridges non-fatal.

Firmware bugs happen. Log a warning and continue instead of panicing.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/dev/pci/pci_resource.c:1.5
--- src/sys/dev/pci/pci_resource.c:1.4	Sun Nov 12 13:56:20 2023
+++ src/sys/dev/pci/pci_resource.c	Sun Jun 30 09:30:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_resource.c,v 1.4 2023/11/12 13:56:20 jmcneill Exp $ */
+/* $NetBSD: pci_resource.c,v 1.5 2024/06/30 09:30:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_resource.c,v 1.4 2023/11/12 13:56:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_resource.c,v 1.5 2024/06/30 09:30:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -136,7 +136,7 @@ struct pci_resources {
 	vmem_t		*pr_res[NUM_PCI_RANGES];
 };
 
-static void	pci_resource_scan_bus(struct pci_resources *,
+static int	pci_resource_scan_bus(struct pci_resources *,
 		struct pci_device *, uint8_t);
 
 #define	PCI_SBDF_FMT			"%04x:%02x:%02x.%u"
@@ -524,7 +524,11 @@ pci_resource_scan_device(struct pci_reso
 		bridge_bus = pci_conf_read(pr->pr_pc, tag, PCI_BRIDGE_BUS_REG);
 		sec_bus = PCI_BRIDGE_BUS_NUM_SECONDARY(bridge_bus);
 		if (sec_bus <= pr->pr_endbus) {
-			pci_resource_scan_bus(pr, pd, sec_bus);
+			if (pci_resource_scan_bus(pr, pd, sec_bus) != 0) {
+DPRINT("PCI: " PCI_SBDF_FMT " bus %u "
+   "already scanned (firmware bug!)\n",
+   PCI_SBDF_FMT_ARGS(pr, pd), sec_bus);
+			}
 		}
 	}
 
@@ -536,7 +540,7 @@ pci_resource_scan_device(struct pci_reso
  *
  *   Enumerate devices on a bus, recursively.
  */
-static void
+static int
 pci_resource_scan_bus(struct pci_resources *pr,
 struct pci_device *bridge_dev, uint8_t busno)
 {
@@ -552,8 +556,7 @@ pci_resource_scan_bus(struct pci_resourc
 		 * Firmware has configured more than one bridge with the
 		 * same secondary bus number.
 		 */
-		panic("Bus %u already scanned (firmware bug!)", busno);
-		return;
+		return EINVAL;
 	}
 
 	pb = pci_new_bus(pr, busno, bridge_dev);
@@ -570,6 +573,8 @@ pci_resource_scan_bus(struct pci_resourc
 			pci_resource_scan_device(pr, pb, devno, funcno);
 		}
 	}
+
+	return 0;
 }
 
 /*



CVS commit: src/sys/dev/pci/igc

2024-06-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun 27 07:31:42 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.h

Log Message:
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 -r1.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 src/sys/dev/pci/igc/if_igc.h:1.3
--- src/sys/dev/pci/igc/if_igc.h:1.2	Wed Oct  4 07:35:27 2023
+++ src/sys/dev/pci/igc/if_igc.h	Thu Jun 27 07:31:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.h,v 1.2 2023/10/04 07:35:27 rin Exp $	*/
+/*	$NetBSD: if_igc.h,v 1.3 2024/06/27 07:31:41 rin 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: src/sys/dev/pci/igc

2024-06-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun 27 07:31:42 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.h

Log Message:
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 -r1.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: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:55:23 UTC 2024

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

Log Message:
virtio_pci.c: Use container_of, not cast.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 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.53 src/sys/dev/pci/virtio_pci.c:1.54
--- src/sys/dev/pci/virtio_pci.c:1.53	Tue Jun 25 14:55:09 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:55:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.53 2024/06/25 14:55:09 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.54 2024/06/25 14:55:23 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.53 2024/06/25 14:55:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.54 2024/06/25 14:55:23 riastradh Exp $");
 
 #include 
 #include 
@@ -618,7 +618,8 @@ virtio_pci_find_cap(struct virtio_pci_so
 static void
 virtio_pci_kick_09(struct virtio_softc *sc, uint16_t idx)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 
 	bus_space_write_2(psc->sc_notify_iot, psc->sc_notify_ioh, 0, idx);
 }
@@ -648,7 +649,8 @@ virtio_pci_adjust_config_region(struct v
 static uint16_t
 virtio_pci_read_queue_size_09(struct virtio_softc *sc, uint16_t idx)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 
 	bus_space_write_2(psc->sc_iot, psc->sc_ioh,
 	VIRTIO_CONFIG_QUEUE_SELECT, idx);
@@ -659,7 +661,8 @@ virtio_pci_read_queue_size_09(struct vir
 static void
 virtio_pci_setup_queue_09(struct virtio_softc *sc, uint16_t idx, uint64_t addr)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 
 	bus_space_write_2(psc->sc_iot, psc->sc_ioh,
 	VIRTIO_CONFIG_QUEUE_SELECT, idx);
@@ -678,7 +681,8 @@ virtio_pci_setup_queue_09(struct virtio_
 static void
 virtio_pci_set_status_09(struct virtio_softc *sc, int status)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 	int old = 0;
 
 	if (status != 0) {
@@ -693,7 +697,8 @@ static void
 virtio_pci_negotiate_features_09(struct virtio_softc *sc,
 uint64_t guest_features)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 	uint32_t r;
 
 	r = bus_space_read_4(psc->sc_iot, psc->sc_ioh,
@@ -714,7 +719,8 @@ virtio_pci_negotiate_features_09(struct 
 static void
 virtio_pci_kick_10(struct virtio_softc *sc, uint16_t idx)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 	unsigned offset = sc->sc_vqs[idx].vq_notify_off *
 	psc->sc_notify_off_multiplier;
 
@@ -724,8 +730,9 @@ virtio_pci_kick_10(struct virtio_softc *
 static uint16_t
 virtio_pci_read_queue_size_10(struct virtio_softc *sc, uint16_t idx)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
-	bus_space_tag_t	   iot = psc->sc_iot;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
+	bus_space_tag_t iot = psc->sc_iot;
 	bus_space_handle_t ioh = psc->sc_ioh;
 
 	bus_space_write_2(iot, ioh, VIRTIO_CONFIG1_QUEUE_SELECT, idx);
@@ -760,7 +767,8 @@ virtio_pci_bus_space_write_8(bus_space_t
 static void
 virtio_pci_setup_queue_10(struct virtio_softc *sc, uint16_t idx, uint64_t addr)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
 	struct virtqueue *vq = >sc_vqs[idx];
 	bus_space_tag_t iot = psc->sc_iot;
 	bus_space_handle_t ioh = psc->sc_ioh;
@@ -800,8 +808,9 @@ virtio_pci_setup_queue_10(struct virtio_
 static void
 virtio_pci_set_status_10(struct virtio_softc *sc, int status)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
-	bus_space_tag_t	   iot = psc->sc_iot;
+	struct virtio_pci_softc * const psc = container_of(sc,
+	struct virtio_pci_softc, sc_sc);
+	bus_space_tag_t iot = psc->sc_iot;
 	bus_space_handle_t ioh = psc->sc_ioh;
 	int old = 0;
 
@@ -815,9 +824,10 @@ void
 virtio_pci_negotiate_features_10(struct virtio_softc *sc,
 uint64_t guest_features)
 {
-	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
-	device_t self 

CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:55:23 UTC 2024

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

Log Message:
virtio_pci.c: Use container_of, not cast.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:55:09 UTC 2024

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

Log Message:
virtio_pci.c: Sprinkle const.

No functional change intended.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:55:09 UTC 2024

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

Log Message:
virtio_pci.c: Sprinkle const.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/dev/pci/virtio_pci.c:1.53
--- src/sys/dev/pci/virtio_pci.c:1.52	Tue Jun 25 14:54:55 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:55:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.52 2024/06/25 14:54:55 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.53 2024/06/25 14:55:09 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.52 2024/06/25 14:54:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.53 2024/06/25 14:55:09 riastradh Exp $");
 
 #include 
 #include 
@@ -142,9 +142,9 @@ static int	virtio_pci_msix_config_intr(v
 static int	virtio_pci_setup_interrupts_09(struct virtio_softc *, int);
 static int	virtio_pci_setup_interrupts_10(struct virtio_softc *, int);
 static int	virtio_pci_establish_msix_interrupts(struct virtio_softc *,
-		struct pci_attach_args *);
+		const struct pci_attach_args *);
 static int	virtio_pci_establish_intx_interrupt(struct virtio_softc *,
-		struct pci_attach_args *);
+		const struct pci_attach_args *);
 static bool	virtio_pci_msix_enabled(struct virtio_pci_softc *);
 
 #define VIRTIO_MSIX_CONFIG_VECTOR_INDEX	0
@@ -205,9 +205,8 @@ static const struct virtio_ops virtio_pc
 static int
 virtio_pci_match(device_t parent, cfdata_t match, void *aux)
 {
-	struct pci_attach_args *pa;
+	const struct pci_attach_args * const pa = aux;
 
-	pa = (struct pci_attach_args *)aux;
 	switch (PCI_VENDOR(pa->pa_id)) {
 	case PCI_VENDOR_QUMRANET:
 		/* Transitional devices MUST have a PCI Revision ID of 0. */
@@ -240,7 +239,7 @@ virtio_pci_attach(device_t parent, devic
 {
 	struct virtio_pci_softc * const psc = device_private(self);
 	struct virtio_softc * const sc = >sc_sc;
-	struct pci_attach_args *pa = (struct pci_attach_args *)aux;
+	const struct pci_attach_args * const pa = aux;
 	pci_chipset_tag_t pc = pa->pa_pc;
 	pcitag_t tag = pa->pa_tag;
 	int revision;
@@ -394,7 +393,7 @@ static int
 virtio_pci_attach_09(device_t self, void *aux)
 {
 	struct virtio_pci_softc * const psc = device_private(self);
-	struct pci_attach_args *pa = (struct pci_attach_args *)aux;
+	const struct pci_attach_args * const pa = aux;
 	struct virtio_softc * const sc = >sc_sc;
 
 	/* complete IO region */
@@ -433,10 +432,10 @@ static int
 virtio_pci_attach_10(device_t self, void *aux)
 {
 	struct virtio_pci_softc * const psc = device_private(self);
-	struct pci_attach_args *pa = (struct pci_attach_args *)aux;
+	const struct pci_attach_args * const pa = aux;
 	struct virtio_softc * const sc = >sc_sc;
-	pci_chipset_tag_t pc = pa->pa_pc;
-	pcitag_t tag = pa->pa_tag;
+	const pci_chipset_tag_t pc = pa->pa_pc;
+	const pcitag_t tag = pa->pa_tag;
 
 	struct virtio_pci_cap common, isr, device;
 	struct virtio_pci_notify_cap notify;
@@ -959,7 +958,7 @@ virtio_pci_setup_interrupts_09(struct vi
 
 static int
 virtio_pci_establish_msix_interrupts(struct virtio_softc *sc,
-struct pci_attach_args *pa)
+const struct pci_attach_args *pa)
 {
 	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
 	device_t self = sc->sc_dev;
@@ -1096,7 +1095,7 @@ error:
 
 static int
 virtio_pci_establish_intx_interrupt(struct virtio_softc *sc,
-struct pci_attach_args *pa)
+const struct pci_attach_args *pa)
 {
 	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
 	device_t self = sc->sc_dev;



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:54:55 UTC 2024

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

Log Message:
virtio_pci.c: Sprinkle KNF.

- No parameter names in function prototypes.
- Fix indentation.
- Break overlong lines.
- Blank line between declarations and rest of block.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 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.51 src/sys/dev/pci/virtio_pci.c:1.52
--- src/sys/dev/pci/virtio_pci.c:1.51	Tue Jun 25 14:54:03 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:54:55 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.51 2024/06/25 14:54:03 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.52 2024/06/25 14:54:55 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.51 2024/06/25 14:54:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.52 2024/06/25 14:54:55 riastradh Exp $");
 
 #include 
 #include 
@@ -116,22 +116,27 @@ struct virtio_pci_softc {
 static int	virtio_pci_attach_09(device_t, void *);
 static void	virtio_pci_kick_09(struct virtio_softc *, uint16_t);
 static uint16_t	virtio_pci_read_queue_size_09(struct virtio_softc *, uint16_t);
-static void	virtio_pci_setup_queue_09(struct virtio_softc *, uint16_t, uint64_t);
+static void	virtio_pci_setup_queue_09(struct virtio_softc *, uint16_t,
+		uint64_t);
 static void	virtio_pci_set_status_09(struct virtio_softc *, int);
-static void	virtio_pci_negotiate_features_09(struct virtio_softc *, uint64_t);
+static void	virtio_pci_negotiate_features_09(struct virtio_softc *,
+		uint64_t);
 
 static int	virtio_pci_attach_10(device_t, void *);
 static void	virtio_pci_kick_10(struct virtio_softc *, uint16_t);
 static uint16_t	virtio_pci_read_queue_size_10(struct virtio_softc *, uint16_t);
-static void	virtio_pci_setup_queue_10(struct virtio_softc *, uint16_t, uint64_t);
+static void	virtio_pci_setup_queue_10(struct virtio_softc *, uint16_t,
+		uint64_t);
 static void	virtio_pci_set_status_10(struct virtio_softc *, int);
-static void	virtio_pci_negotiate_features_10(struct virtio_softc *, uint64_t);
-static int	virtio_pci_find_cap(struct virtio_pci_softc *psc, int cfg_type, void *buf, int buflen);
+static void	virtio_pci_negotiate_features_10(struct virtio_softc *,
+		uint64_t);
+static int	virtio_pci_find_cap(struct virtio_pci_softc *, int, void *,
+		int);
 
 static int	virtio_pci_alloc_interrupts(struct virtio_softc *);
 static void	virtio_pci_free_interrupts(struct virtio_softc *);
-static int	virtio_pci_adjust_config_region(struct virtio_pci_softc *psc);
-static int	virtio_pci_intr(void *arg);
+static int	virtio_pci_adjust_config_region(struct virtio_pci_softc *);
+static int	virtio_pci_intr(void *);
 static int	virtio_pci_msix_queue_intr(void *);
 static int	virtio_pci_msix_config_intr(void *);
 static int	virtio_pci_setup_interrupts_09(struct virtio_softc *, int);
@@ -207,10 +212,10 @@ virtio_pci_match(device_t parent, cfdata
 	case PCI_VENDOR_QUMRANET:
 		/* Transitional devices MUST have a PCI Revision ID of 0. */
 		if (((PCI_PRODUCT_QUMRANET_VIRTIO_1000 <=
-		  PCI_PRODUCT(pa->pa_id)) &&
-		 (PCI_PRODUCT(pa->pa_id) <=
-		  PCI_PRODUCT_QUMRANET_VIRTIO_103F)) &&
-	  PCI_REVISION(pa->pa_class) == 0)
+			PCI_PRODUCT(pa->pa_id)) &&
+			(PCI_PRODUCT(pa->pa_id) <=
+			PCI_PRODUCT_QUMRANET_VIRTIO_103F)) &&
+		PCI_REVISION(pa->pa_class) == 0)
 			return 1;
 		/*
 		 * Non-transitional devices SHOULD have a PCI Revision
@@ -218,11 +223,11 @@ virtio_pci_match(device_t parent, cfdata
 		 * Revision ID value.
 		 */
 		if (((PCI_PRODUCT_QUMRANET_VIRTIO_1040 <=
-		  PCI_PRODUCT(pa->pa_id)) &&
-		 (PCI_PRODUCT(pa->pa_id) <=
-		  PCI_PRODUCT_QUMRANET_VIRTIO_107F)) &&
-		  /* XXX: TODO */
-		  PCI_REVISION(pa->pa_class) == 1)
+			PCI_PRODUCT(pa->pa_id)) &&
+			(PCI_PRODUCT(pa->pa_id) <=
+			PCI_PRODUCT_QUMRANET_VIRTIO_107F)) &&
+		/* XXX: TODO */
+		PCI_REVISION(pa->pa_class) == 1)
 			return 1;
 		break;
 	}
@@ -255,7 +260,7 @@ virtio_pci_attach(device_t parent, devic
 		break;
 	default:
 		aprint_normal(": unknown revision 0x%02x; giving up\n",
-			  revision);
+		revision);
 		return;
 	}
 
@@ -394,14 +399,14 @@ virtio_pci_attach_09(device_t self, void
 
 	/* complete IO region */
 	if (pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_IO, 0,
-			   >sc_iot, >sc_ioh, NULL, >sc_iosize)) {
+		>sc_iot, >sc_ioh, NULL, >sc_iosize)) {
 		aprint_error_dev(self, "can't map i/o space\n");
 		return EIO;
 	}
 
 	/* queue space */
 	if (bus_space_subregion(psc->sc_iot, psc->sc_ioh,
-			VIRTIO_CONFIG_QUEUE_NOTIFY, 2, >sc_notify_ioh)) {
+		

CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:54:55 UTC 2024

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

Log Message:
virtio_pci.c: Sprinkle KNF.

- No parameter names in function prototypes.
- Fix indentation.
- Break overlong lines.
- Blank line between declarations and rest of block.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:54:03 UTC 2024

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

Log Message:
virtio_pci.c: Omit needless blank lines and commented code.

No functional change intended.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:54:03 UTC 2024

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

Log Message:
virtio_pci.c: Omit needless blank lines and commented code.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 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.50 src/sys/dev/pci/virtio_pci.c:1.51
--- src/sys/dev/pci/virtio_pci.c:1.50	Tue Jun 25 14:53:45 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:54:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.50 2024/06/25 14:53:45 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.51 2024/06/25 14:54:03 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.50 2024/06/25 14:53:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.51 2024/06/25 14:54:03 riastradh Exp $");
 
 #include 
 #include 
@@ -78,7 +78,6 @@ static void	virtio_pci_attach(device_t, 
 static int	virtio_pci_rescan(device_t, const char *, const int *);
 static int	virtio_pci_detach(device_t, int);
 
-
 #define NMAPREG		((PCI_MAPREG_END - PCI_MAPREG_START) / \
 sizeof(pcireg_t))
 struct virtio_pci_softc {
@@ -172,7 +171,6 @@ static bool	virtio_pci_msix_enabled(stru
 #	define STRUCT_ENDIAN_10	LITTLE_ENDIAN
 #endif
 
-
 CFATTACH_DECL3_NEW(virtio_pci, sizeof(struct virtio_pci_softc),
 virtio_pci_match, virtio_pci_attach, virtio_pci_detach, NULL,
 virtio_pci_rescan, NULL, 0);
@@ -351,7 +349,6 @@ virtio_pci_rescan(device_t self, const c
 	return 0;
 }
 
-
 static int
 virtio_pci_detach(device_t self, int flags)
 {
@@ -388,16 +385,12 @@ virtio_pci_detach(device_t self, int fla
 	return 0;
 }
 
-
 static int
 virtio_pci_attach_09(device_t self, void *aux)
-	//struct virtio_pci_softc *psc, struct pci_attach_args *pa)
 {
 	struct virtio_pci_softc * const psc = device_private(self);
 	struct pci_attach_args *pa = (struct pci_attach_args *)aux;
 	struct virtio_softc * const sc = >sc_sc;
-//	pci_chipset_tag_t pc = pa->pa_pc;
-//	pcitag_t tag = pa->pa_tag;
 
 	/* complete IO region */
 	if (pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_IO, 0,
@@ -431,7 +424,6 @@ virtio_pci_attach_09(device_t self, void
 	return 0;
 }
 
-
 static int
 virtio_pci_attach_10(device_t self, void *aux)
 {
@@ -611,7 +603,6 @@ virtio_pci_find_cap(struct virtio_pci_so
 	return 0;
 }
 
-
 /* -
  * Version 0.9 support
  * -*/
@@ -721,7 +712,6 @@ virtio_pci_kick_10(struct virtio_softc *
 	bus_space_write_2(psc->sc_notify_iot, psc->sc_notify_ioh, offset, idx);
 }
 
-
 static uint16_t
 virtio_pci_read_queue_size_10(struct virtio_softc *sc, uint16_t idx)
 {
@@ -864,7 +854,6 @@ virtio_pci_negotiate_features_10(struct 
 	return;
 }
 
-
 /* -
  * Generic PCI interrupt code
  * -*/



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:53:45 UTC 2024

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

Log Message:
virtio_pci.c: Sort includes.

No functional change intended.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:53:45 UTC 2024

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

Log Message:
virtio_pci.c: Sort includes.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 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.49 src/sys/dev/pci/virtio_pci.c:1.50
--- src/sys/dev/pci/virtio_pci.c:1.49	Tue Jun 25 14:22:48 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:53:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.49 2024/06/25 14:22:48 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.50 2024/06/25 14:53:45 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,17 +28,18 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.49 2024/06/25 14:22:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.50 2024/06/25 14:53:45 riastradh Exp $");
 
 #include 
-#include 
-#include 
-#include 
+#include 
+
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
-
-#include 
+#include 
 
 #include 
 #include 



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:48 UTC 2024

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

Log Message:
virtio@pci: Zero sc_bars_iosize[i] on unmap.

No functional change intended, but this makes the code less brittle.

Prompted by PR kern/58335.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/dev/pci/virtio_pci.c:1.49
--- src/sys/dev/pci/virtio_pci.c:1.48	Tue Jun 25 14:22:30 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:22:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.48 2024/06/25 14:22:30 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.49 2024/06/25 14:22:48 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.48 2024/06/25 14:22:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.49 2024/06/25 14:22:48 riastradh Exp $");
 
 #include 
 #include 
@@ -556,7 +556,8 @@ err:
 		if (psc->sc_bars_iosize[i] == 0)
 			continue;
 		bus_space_unmap(psc->sc_bars_iot[i], psc->sc_bars_ioh[i],
-psc->sc_bars_iosize[i]);
+		psc->sc_bars_iosize[i]);
+		psc->sc_bars_iosize[i] = 0;
 	}
 	return ret;
 }



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:48 UTC 2024

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

Log Message:
virtio@pci: Zero sc_bars_iosize[i] on unmap.

No functional change intended, but this makes the code less brittle.

Prompted by PR kern/58335.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:31 UTC 2024

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

Log Message:
virtio@pci: Don't detach on shutdown.

The virtio bus does not keep state in memory that needs to flushed to
persistent storage.  Typically DVF_DETACH_SHUTDOWN is only needed by,
e.g., disk drivers to flush disk caches (although really, vfs sync
should do that anyway, so maybe we should just nix the option
altogether).

Prompted by PR kern/58335.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 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.47 src/sys/dev/pci/virtio_pci.c:1.48
--- src/sys/dev/pci/virtio_pci.c:1.47	Tue Jun 25 14:22:16 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:22:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.47 2024/06/25 14:22:16 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.48 2024/06/25 14:22:30 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.47 2024/06/25 14:22:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.48 2024/06/25 14:22:30 riastradh Exp $");
 
 #include 
 #include 
@@ -174,7 +174,7 @@ static bool	virtio_pci_msix_enabled(stru
 
 CFATTACH_DECL3_NEW(virtio_pci, sizeof(struct virtio_pci_softc),
 virtio_pci_match, virtio_pci_attach, virtio_pci_detach, NULL,
-virtio_pci_rescan, NULL, DVF_DETACH_SHUTDOWN);
+virtio_pci_rescan, NULL, 0);
 
 static const struct virtio_ops virtio_pci_ops_09 = {
 	.kick = virtio_pci_kick_09,



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:31 UTC 2024

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

Log Message:
virtio@pci: Don't detach on shutdown.

The virtio bus does not keep state in memory that needs to flushed to
persistent storage.  Typically DVF_DETACH_SHUTDOWN is only needed by,
e.g., disk drivers to flush disk caches (although really, vfs sync
should do that anyway, so maybe we should just nix the option
altogether).

Prompted by PR kern/58335.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:16 UTC 2024

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

Log Message:
virtio@pci: Nix useless sc_mapped_iosize.

This appears to have been a mistaken attempt to pass the subregion
length through to bus_space_unmap, which doesn't make any sense --
bus_space_subregion does not allocate anything and the resulting
handle must not be passed to bus_space_unmap.

Once we pass the size that was actually returned by pci_mapreg_map to
bus_space_unmap, which matches the size passed internally by
pci_mapreg_map to bus_space_map, sc_mapped_iosize is no longer used
and can be flushed.

Prompted by PR kern/58335.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/dev/pci/virtio_pci.c:1.47
--- src/sys/dev/pci/virtio_pci.c:1.46	Tue Jun 25 14:22:03 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:22:16 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.46 2024/06/25 14:22:03 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.47 2024/06/25 14:22:16 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.46 2024/06/25 14:22:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.47 2024/06/25 14:22:16 riastradh Exp $");
 
 #include 
 #include 
@@ -88,7 +88,6 @@ struct virtio_pci_softc {
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
 	bus_size_t		sc_iosize;
-	bus_size_t		sc_mapped_iosize;
 
 	/* BARs */
 	bus_space_tag_t		sc_bars_iot[NMAPREG];
@@ -380,7 +379,7 @@ virtio_pci_detach(device_t self, int fla
 	} else {
 		if (psc->sc_iosize) {
 			bus_space_unmap(psc->sc_iot, psc->sc_ioh,
-			psc->sc_mapped_iosize);
+			psc->sc_iosize);
 			psc->sc_iosize = 0;
 		}
 	}
@@ -405,7 +404,6 @@ virtio_pci_attach_09(device_t self, void
 		aprint_error_dev(self, "can't map i/o space\n");
 		return EIO;
 	}
-	psc->sc_mapped_iosize = psc->sc_iosize;
 
 	/* queue space */
 	if (bus_space_subregion(psc->sc_iot, psc->sc_ioh,
@@ -543,7 +541,6 @@ virtio_pci_attach_10(device_t self, void
 	}
 	psc->sc_iosize = common.length;
 	psc->sc_iot = psc->sc_bars_iot[i];
-	psc->sc_mapped_iosize = psc->sc_bars_iosize[i];
 
 	psc->sc_sc.sc_version_1 = 1;
 



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:16 UTC 2024

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

Log Message:
virtio@pci: Nix useless sc_mapped_iosize.

This appears to have been a mistaken attempt to pass the subregion
length through to bus_space_unmap, which doesn't make any sense --
bus_space_subregion does not allocate anything and the resulting
handle must not be passed to bus_space_unmap.

Once we pass the size that was actually returned by pci_mapreg_map to
bus_space_unmap, which matches the size passed internally by
pci_mapreg_map to bus_space_map, sc_mapped_iosize is no longer used
and can be flushed.

Prompted by PR kern/58335.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:03 UTC 2024

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

Log Message:
virtio@pci: Unmap the BARs we actually mapped on >=1.0 detach.

PR kern/58335


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 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.45 src/sys/dev/pci/virtio_pci.c:1.46
--- src/sys/dev/pci/virtio_pci.c:1.45	Tue Jun 25 14:21:45 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:22:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.45 2024/06/25 14:21:45 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.46 2024/06/25 14:22:03 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.45 2024/06/25 14:21:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.46 2024/06/25 14:22:03 riastradh Exp $");
 
 #include 
 #include 
@@ -357,6 +357,7 @@ virtio_pci_detach(device_t self, int fla
 {
 	struct virtio_pci_softc * const psc = device_private(self);
 	struct virtio_softc * const sc = >sc_sc;
+	unsigned i;
 	int r;
 
 	r = config_detach_children(self, flags);
@@ -368,10 +369,21 @@ virtio_pci_detach(device_t self, int fla
 	KASSERT(sc->sc_vqs == NULL);
 	KASSERT(psc->sc_ihs_num == 0);
 
-	if (psc->sc_iosize)
-		bus_space_unmap(psc->sc_iot, psc->sc_ioh,
-			psc->sc_mapped_iosize);
-	psc->sc_iosize = 0;
+	if (sc->sc_version_1) {
+		for (i = 0; i < __arraycount(psc->sc_bars_iot); i++) {
+			if (psc->sc_bars_iosize[i] == 0)
+continue;
+			bus_space_unmap(psc->sc_bars_iot[i],
+			psc->sc_bars_ioh[i], psc->sc_bars_iosize[i]);
+			psc->sc_bars_iosize[i] = 0;
+		}
+	} else {
+		if (psc->sc_iosize) {
+			bus_space_unmap(psc->sc_iot, psc->sc_ioh,
+			psc->sc_mapped_iosize);
+			psc->sc_iosize = 0;
+		}
+	}
 
 	return 0;
 }



CVS commit: src/sys/dev/pci

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:22:03 UTC 2024

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

Log Message:
virtio@pci: Unmap the BARs we actually mapped on >=1.0 detach.

PR kern/58335


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:21:45 UTC 2024

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

Log Message:
virtio_pci.c: Nix trailing whitespace.


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

2024-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 25 14:21:45 UTC 2024

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

Log Message:
virtio_pci.c: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 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.44 src/sys/dev/pci/virtio_pci.c:1.45
--- src/sys/dev/pci/virtio_pci.c:1.44	Sun Nov 19 19:49:44 2023
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:21:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.44 2023/11/19 19:49:44 thorpej Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.45 2024/06/25 14:21:45 riastradh Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.44 2023/11/19 19:49:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.45 2024/06/25 14:21:45 riastradh Exp $");
 
 #include 
 #include 
@@ -542,7 +542,7 @@ virtio_pci_attach_10(device_t self, void
 	return 0;
 
 err:
-	/* undo our pci_mapreg_map()s */ 
+	/* undo our pci_mapreg_map()s */
 	for (i = 0; i < __arraycount(bars); i++) {
 		if (psc->sc_bars_iosize[i] == 0)
 			continue;



CVS commit: src/sys/dev/pci

2024-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 23 17:27:29 UTC 2024

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

Log Message:
Add Brainboxes puc(4) devices

>From Cameron Williams in PR 58358.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 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.115 src/sys/dev/pci/pucdata.c:1.116
--- src/sys/dev/pci/pucdata.c:1.115	Fri Feb  9 22:08:36 2024
+++ src/sys/dev/pci/pucdata.c	Sun Jun 23 17:27:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.115 2024/02/09 22:08:36 andvar Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.116 2024/06/23 17:27:29 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.115 2024/02/09 22:08:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.116 2024/06/23 17:27:29 jakllsch 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-268",
+	{ PCI_VENDOR_BRAINBOXES, PCI_PRODUCT_BRAINBOXES_UC268, 0, 0 },
+	{ 0x, 0x, 0, 0 },
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR2, 0x, 

CVS commit: src/sys/dev/pci

2024-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 23 17:27:29 UTC 2024

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

Log Message:
Add Brainboxes puc(4) devices

>From Cameron Williams in PR 58358.


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

2024-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 23 17:26:03 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.

For PR 58358


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

2024-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 23 17:26:03 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.

For PR 58358


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

2024-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 23 17:22:51 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Brainboxes and devices

>From Cameron Williams in PR 58358.


To generate a diff of this commit:
cvs rdiff -u -r1.1506 -r1.1507 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.1506 src/sys/dev/pci/pcidevs:1.1507
--- src/sys/dev/pci/pcidevs:1.1506	Sun May 12 23:30:07 2024
+++ src/sys/dev/pci/pcidevs	Sun Jun 23 17:22:51 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1506 2024/05/12 23:30:07 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1507 2024/06/23 17:22:51 jakllsch 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
@@ -2506,6 +2507,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: src/sys/dev/pci

2024-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 23 17:22:51 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Brainboxes and devices

>From Cameron Williams in PR 58358.


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

2024-06-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 14 03:15:04 UTC 2024

Modified Files:
src/sys/dev/pci: pcireg.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 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.170 src/sys/dev/pci/pcireg.h:1.171
--- src/sys/dev/pci/pcireg.h:1.170	Fri Apr 19 21:24:00 2024
+++ src/sys/dev/pci/pcireg.h	Fri Jun 14 03:15:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.170 2024/04/19 21:24:00 andvar Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.171 2024/06/14 03:15:04 msaitoh 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: src/sys/dev/pci

2024-06-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 14 03:15:04 UTC 2024

Modified Files:
src/sys/dev/pci: pcireg.h

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


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

2024-06-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 12 16:51:54 UTC 2024

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

Log Message:
ld@virtio(4): Fix maximum size parameters.

- SEG_MAX is the maximum number of segments.
- SIZE_MAX is the maximum number of bytes in a single segment.

The maximum transfer size is, therefore, SEG_MAX * SIZE_MAX.

=> Don't add two extra segments in the dmamap vr_payload for the
   header and status -- we already have a separate dmamap vr_cmdsts
   for that.

=> Don't recalculate payload dmamap parameters based on division by
   NBPG, just use the ones specified by the host.

=> Allow SIZE_MAX below MAXPHYS as long as SIZE_MAX*SEG_MAX >=
   MAXPHYS.

Even though ldattach clamps ld->sc_maxxfer to MAXPHYS, make sure to
clamp it in ld_virtio_attach before ld_virtio_alloc_reqs since it
determines the dmamap sizes and bounce buffer allocation and there's
no sense in allocating those larger than ld will use anyway.

PR kern/58338


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/ld_virtio.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/ld_virtio.c
diff -u src/sys/dev/pci/ld_virtio.c:1.34 src/sys/dev/pci/ld_virtio.c:1.35
--- src/sys/dev/pci/ld_virtio.c:1.34	Sat Mar  9 11:04:22 2024
+++ src/sys/dev/pci/ld_virtio.c	Wed Jun 12 16:51:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $	*/
+/*	$NetBSD: ld_virtio.c,v 1.35 2024/06/12 16:51:53 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.35 2024/06/12 16:51:53 riastradh Exp $");
 
 #include 
 #include 
@@ -128,6 +128,9 @@ struct ld_virtio_softc {
 	struct ld_softc		sc_ld;
 	device_t		sc_dev;
 
+	uint32_t		sc_seg_max; /* max number of segs in xfer */
+	uint32_t		sc_size_max; /* max size of single seg */
+
 	struct virtio_softc	*sc_virtio;
 	struct virtqueue	sc_vq;
 
@@ -220,11 +223,10 @@ ld_virtio_alloc_reqs(struct ld_virtio_so
 			goto err_reqs;
 		}
 		r = bus_dmamap_create(virtio_dmat(sc->sc_virtio),
-  ld->sc_maxxfer,
-  (ld->sc_maxxfer / NBPG) +
-  VIRTIO_BLK_CTRL_SEGMENTS,
-  ld->sc_maxxfer,
-  0,
+  /*size*/ld->sc_maxxfer,
+  /*nseg*/sc->sc_seg_max,
+  /*maxsegsz*/sc->sc_size_max,
+  /*boundary*/0,
   BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW,
   >vr_payload);
 		if (r != 0) {
@@ -264,7 +266,7 @@ ld_virtio_attach(device_t parent, device
 	struct ld_softc *ld = >sc_ld;
 	struct virtio_softc *vsc = device_private(parent);
 	uint64_t features;
-	int qsize, maxxfersize, maxnsegs;
+	int qsize;
 
 	if (virtio_child(vsc) != NULL) {
 		aprint_normal(": child already attached for %s; "
@@ -296,46 +298,53 @@ ld_virtio_attach(device_t parent, device
 	} else
 		ld->sc_secsize = VIRTIO_BLK_BSIZE;
 
-	/* At least genfs_io assumes maxxfer == MAXPHYS. */
-	if (features & VIRTIO_BLK_F_SIZE_MAX) {
-		maxxfersize = virtio_read_device_config_4(vsc,
-		VIRTIO_BLK_CONFIG_SIZE_MAX);
-		if (maxxfersize < MAXPHYS) {
-			aprint_error_dev(sc->sc_dev,
-			"Too small SIZE_MAX %dK minimum is %dK\n",
-			maxxfersize / 1024, MAXPHYS / 1024);
-			// goto err;
-			maxxfersize = MAXPHYS;
-		} else if (maxxfersize > MAXPHYS) {
-			aprint_normal_dev(sc->sc_dev,
-			"Clip SIZE_MAX from %dK to %dK\n",
-			maxxfersize / 1024,
-			MAXPHYS / 1024);
-			maxxfersize = MAXPHYS;
-		}
-	} else
-		maxxfersize = MAXPHYS;
-
 	if (features & VIRTIO_BLK_F_SEG_MAX) {
-		maxnsegs = virtio_read_device_config_4(vsc,
+		sc->sc_seg_max = virtio_read_device_config_4(vsc,
 		VIRTIO_BLK_CONFIG_SEG_MAX);
-		if (maxnsegs == 0) {
+		if (sc->sc_seg_max == 0) {
 			aprint_error_dev(sc->sc_dev,
-			"Invalid SEG_MAX %d\n", maxnsegs);
+			"Invalid SEG_MAX %d\n", sc->sc_seg_max);
 			goto err;
 		}
-	} else
-		maxnsegs = maxxfersize / NBPG;
+	} else {
+		sc->sc_seg_max = 1;
+		aprint_verbose_dev(sc->sc_dev,
+		"Unknown SEG_MAX, assuming %"PRIu32"\n", sc->sc_seg_max);
+	}
 
-	maxnsegs += VIRTIO_BLK_CTRL_SEGMENTS;
+	/* At least genfs_io assumes size_max*seg_max >= MAXPHYS. */
+	if (features & VIRTIO_BLK_F_SIZE_MAX) {
+		sc->sc_size_max = virtio_read_device_config_4(vsc,
+		VIRTIO_BLK_CONFIG_SIZE_MAX);
+		if (sc->sc_size_max < MAXPHYS/sc->sc_seg_max) {
+			aprint_error_dev(sc->sc_dev,
+			"Too small SIZE_MAX %d minimum is %d\n",
+			sc->sc_size_max, MAXPHYS/sc->sc_seg_max);
+			// goto err;
+			sc->sc_size_max = MAXPHYS/sc->sc_seg_max;
+		} else if (sc->sc_size_max > MAXPHYS) {
+			aprint_verbose_dev(sc->sc_dev,
+			"Clip SIZE_MAX from %d to %d\n",
+			sc->sc_size_max, MAXPHYS);
+			sc->sc_size_max = MAXPHYS;
+		}
+	} else {
+		sc->sc_size_max = MAXPHYS;
+		aprint_verbose_dev(sc->sc_dev,
+		

CVS commit: src/sys/dev/pci

2024-06-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 12 16:51:54 UTC 2024

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

Log Message:
ld@virtio(4): Fix maximum size parameters.

- SEG_MAX is the maximum number of segments.
- SIZE_MAX is the maximum number of bytes in a single segment.

The maximum transfer size is, therefore, SEG_MAX * SIZE_MAX.

=> Don't add two extra segments in the dmamap vr_payload for the
   header and status -- we already have a separate dmamap vr_cmdsts
   for that.

=> Don't recalculate payload dmamap parameters based on division by
   NBPG, just use the ones specified by the host.

=> Allow SIZE_MAX below MAXPHYS as long as SIZE_MAX*SEG_MAX >=
   MAXPHYS.

Even though ldattach clamps ld->sc_maxxfer to MAXPHYS, make sure to
clamp it in ld_virtio_attach before ld_virtio_alloc_reqs since it
determines the dmamap sizes and bounce buffer allocation and there's
no sense in allocating those larger than ld will use anyway.

PR kern/58338


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/ld_virtio.c

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



CVS commit: src/sys/dev/pci/igc

2024-06-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 12 06:21:37 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/dev/pci/igc/if_igc.c:1.14
--- src/sys/dev/pci/igc/if_igc.c:1.13	Wed Feb 21 12:39:39 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Jun 12 06:21:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.14 2024/06/12 06:21:37 rin 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.13 2024/02/21 12:39:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.14 2024/06/12 06:21:37 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -2806,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: src/sys/dev/pci/igc

2024-06-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 12 06:21:37 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

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


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

2024-06-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jun  8 21:02:29 UTC 2024

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

Log Message:
s/amound/amount/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/emuxki.c

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



CVS commit: src/sys/dev/pci

2024-06-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jun  8 21:02:29 UTC 2024

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

Log Message:
s/amound/amount/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/emuxki.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/emuxki.c
diff -u src/sys/dev/pci/emuxki.c:1.78 src/sys/dev/pci/emuxki.c:1.79
--- src/sys/dev/pci/emuxki.c:1.78	Wed Dec 20 05:08:34 2023
+++ src/sys/dev/pci/emuxki.c	Sat Jun  8 21:02:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.78 2023/12/20 05:08:34 thorpej Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.79 2024/06/08 21:02:29 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.78 2023/12/20 05:08:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.79 2024/06/08 21:02:29 andvar Exp $");
 
 #include 
 #include 
@@ -801,7 +801,7 @@ emuxki_play_start(struct emuxki_softc *s
 	volume = 32767;
 
 	emuxki_write(sc, ch, EMU_CHAN_DSL,
-	(0 << 24) |	/* send amound D = 0 */
+	(0 << 24) |	/* send amount D = 0 */
 	end);
 
 	emuxki_write(sc, ch, EMU_CHAN_PSST,



CVS commit: src/sys/dev/pci/ixgbe

2024-05-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 30 08:55:02 UTC 2024

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

Log Message:
Move RECOVERY_MODE feature test code for readability. No functional change.

 ixgbe.c rev. 1.169 inserted RECOVERY_MODE feature test in between
 MSI-X allocation and legacy allocation. To improve code readability,
move it to earlier location.


To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.351 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.350 src/sys/dev/pci/ixgbe/ixgbe.c:1.351
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.350	Mon May 13 03:15:33 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu May 30 08:55:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.350 2024/05/13 03:15:33 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.351 2024/05/30 08:55:02 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.350 2024/05/13 03:15:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.351 2024/05/30 08:55:02 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1136,6 +1136,21 @@ ixgbe_attach(device_t parent, device_t d
 	error = ixgbe_read_pba_string(hw, buf, IXGBE_PBANUM_LENGTH);
 	aprint_normal_dev(dev, "PBA number %s\n", error ? "unknown" : buf);
 
+	/* Recovery mode */
+	switch (sc->hw.mac.type) {
+	case ixgbe_mac_X550:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
+		/* >= 2.00 */
+		if (hw->eeprom.nvm_image_ver_high >= 2) {
+			sc->feat_cap |= IXGBE_FEATURE_RECOVERY_MODE;
+			sc->feat_en |= IXGBE_FEATURE_RECOVERY_MODE;
+		}
+		break;
+	default:
+		break;
+	}
+
 	if (sc->feat_en & IXGBE_FEATURE_MSIX) {
 		error = ixgbe_allocate_msix(sc, pa);
 		if (error) {
@@ -1155,21 +1170,6 @@ ixgbe_attach(device_t parent, device_t d
 		}
 	}
 
-	/* Recovery mode */
-	switch (sc->hw.mac.type) {
-	case ixgbe_mac_X550:
-	case ixgbe_mac_X550EM_x:
-	case ixgbe_mac_X550EM_a:
-		/* >= 2.00 */
-		if (hw->eeprom.nvm_image_ver_high >= 2) {
-			sc->feat_cap |= IXGBE_FEATURE_RECOVERY_MODE;
-			sc->feat_en |= IXGBE_FEATURE_RECOVERY_MODE;
-		}
-		break;
-	default:
-		break;
-	}
-
 	if ((sc->feat_en & IXGBE_FEATURE_MSIX) == 0)
 		error = ixgbe_allocate_legacy(sc, pa);
 	if (error)



CVS commit: src/sys/dev/pci/ixgbe

2024-05-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 30 08:55:02 UTC 2024

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

Log Message:
Move RECOVERY_MODE feature test code for readability. No functional change.

 ixgbe.c rev. 1.169 inserted RECOVERY_MODE feature test in between
 MSI-X allocation and legacy allocation. To improve code readability,
move it to earlier location.


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

2024-05-21 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 21 22:47:11 UTC 2024

Modified Files:
src/sys/dev/pci: eapreg.h

Log Message:
eap(4): re-organize mixer controls to put classes first

some software (understandably) doesn't like it if you declare a
mixer node's child before the parent, notably ossxmix in pkgsrc


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/eapreg.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/eapreg.h
diff -u src/sys/dev/pci/eapreg.h:1.13 src/sys/dev/pci/eapreg.h:1.14
--- src/sys/dev/pci/eapreg.h:1.13	Mon Apr 28 20:23:54 2008
+++ src/sys/dev/pci/eapreg.h	Tue May 21 22:47:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eapreg.h,v 1.13 2008/04/28 20:23:54 martin Exp $	*/
+/*	$NetBSD: eapreg.h,v 1.14 2024/05/21 22:47:11 nia Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -292,20 +292,20 @@
 #define VOL_0DB 200
 
 /* Futzable parms */
-#define EAP_MASTER_VOL		0
-#define EAP_VOICE_VOL		1
-#define EAP_FM_VOL		2
-#define EAP_VIDEO_VOL		2	/* ES1371 */
-#define EAP_CD_VOL		3
-#define EAP_LINE_VOL		4
-#define EAP_AUX_VOL		5
-#define EAP_MIC_VOL		6
-#define	EAP_RECORD_SOURCE	7
-#define EAP_INPUT_SOURCE	8
-#define	EAP_MIC_PREAMP		9
-#define EAP_OUTPUT_CLASS	10
-#define EAP_RECORD_CLASS	11
-#define EAP_INPUT_CLASS		12
+#define EAP_OUTPUT_CLASS	0
+#define EAP_RECORD_CLASS	1
+#define EAP_INPUT_CLASS		2
+#define EAP_MASTER_VOL		3
+#define EAP_VOICE_VOL		4
+#define EAP_FM_VOL		5
+#define EAP_VIDEO_VOL		5	/* ES1371 */
+#define EAP_CD_VOL		6
+#define EAP_LINE_VOL		7
+#define EAP_AUX_VOL		8
+#define EAP_MIC_VOL		9
+#define	EAP_RECORD_SOURCE	10
+#define EAP_INPUT_SOURCE	11
+#define	EAP_MIC_PREAMP		12
 
 #define MIDI_BUSY_WAIT		100
 #define MIDI_BUSY_DELAY		100	/* Delay when UART is busy */



CVS commit: src/sys/dev/pci

2024-05-21 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 21 22:47:11 UTC 2024

Modified Files:
src/sys/dev/pci: eapreg.h

Log Message:
eap(4): re-organize mixer controls to put classes first

some software (understandably) doesn't like it if you declare a
mixer node's child before the parent, notably ossxmix in pkgsrc


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/eapreg.h

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



CVS commit: src/sys/dev/pci

2024-05-17 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May 17 12:20:02 UTC 2024

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

Log Message:
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.103 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.103
--- src/sys/dev/pci/eap.c:1.102	Thu Jul 25 15:06:07 2019
+++ src/sys/dev/pci/eap.c	Fri May 17 12:20:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $	*/
+/*	$NetBSD: eap.c,v 1.103 2024/05/17 12:20:02 nia 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.103 2024/05/17 12:20:02 nia 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: src/sys/dev/pci

2024-05-17 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May 17 12:20:02 UTC 2024

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

Log Message:
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.103 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: src/sys/dev/pci/ixgbe

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 03:15:33 UTC 2024

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

Log Message:
Modify comment. The number of queues is not limited to 8.

The number of queue is calculated from both the number of CPUs and
the number of MSI-X vectors.


To generate a diff of this commit:
cvs rdiff -u -r1.349 -r1.350 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.349 src/sys/dev/pci/ixgbe/ixgbe.c:1.350
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.349	Wed Jan 24 05:18:59 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon May 13 03:15:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.350 2024/05/13 03:15:33 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.350 2024/05/13 03:15:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -358,8 +358,8 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix
 /*
  * Number of Queues, can be set to 0,
  * it then autoconfigures based on the
- * number of cpus with a max of 8. This
- * can be overridden manually here.
+ * number of cpus and number of MSI-X vectors.
+ * This can be overridden manually here.
  */
 static int ixgbe_num_queues = 0;
 SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, CTLFLAG_RDTUN, _num_queues, 0,



CVS commit: src/sys/dev/pci/ixgbe

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 03:15:33 UTC 2024

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

Log Message:
Modify comment. The number of queues is not limited to 8.

The number of queue is calculated from both the number of CPUs and
the number of MSI-X vectors.


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

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:30:37 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


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

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:30:07 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add some Intel Rapotr Lake graphics.


To generate a diff of this commit:
cvs rdiff -u -r1.1505 -r1.1506 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.1505 src/sys/dev/pci/pcidevs:1.1506
--- src/sys/dev/pci/pcidevs:1.1505	Sun May 12 23:29:14 2024
+++ src/sys/dev/pci/pcidevs	Sun May 12 23:30:07 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1505 2024/05/12 23:29:14 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1506 2024/05/12 23:30:07 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7476,6 +7476,9 @@ product INTEL RPL_IGD_6		0xa7a0	Raptor L
 product INTEL RPL_IGD_7		0xa7a1	Raptor Lake Graphics (96 or 80EU)
 product INTEL RPL_IGD_8		0xa7a8	Raptor Lake Graphics (64 or 48EU)
 product INTEL RPL_IGD_9		0xa7a9	Raptor Lake Graphics (64 or 48EU)
+product INTEL RPL_IGD_10	0xa7aa	Raptor Lake Graphics (96 or 80EU)
+product INTEL RPL_IGD_11	0xa7ac	Raptor Lake Graphics (96 or 80EU)
+product INTEL RPL_IGD_12	0xa7ad	Raptor Lake Graphics (64EU)
 product INTEL 21152		0xb152	S21152BB PCI-PCI Bridge
 product INTEL 21154		0xb154	S21152BA,S21154AE/BE PCI-PCI Bridge
 product INTEL 21555		0xb555	21555 Non-Transparent PCI-PCI Bridge



CVS commit: src/sys/dev/pci

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:30:07 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add some Intel Rapotr Lake graphics.


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

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:29:14 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Phison PS5021 and PS5026.


To generate a diff of this commit:
cvs rdiff -u -r1.1504 -r1.1505 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.1504 src/sys/dev/pci/pcidevs:1.1505
--- src/sys/dev/pci/pcidevs:1.1504	Sat Apr  6 09:10:11 2024
+++ src/sys/dev/pci/pcidevs	Sun May 12 23:29:14 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1504 2024/04/06 09:10:11 andvar Exp $
+$NetBSD: pcidevs,v 1.1505 2024/05/12 23:29:14 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7856,8 +7856,10 @@ product PHILIPS SAA7135HL	0x7135	SAA7135
 product PHILIPS SAA7146AH	0x7146	SAA7146AH PCI Multimedia Bridge
 
 /* Phison products */
-product PHISON PS5000		0x5000 PS5000
-product PHISON PS5016		0x5016 PS5016
+product PHISON PS5000		0x5000	PS5000
+product PHISON PS5016		0x5016	PS5016
+product PHISON PS5021		0x5021	PS5021
+product PHISON PS5026		0x5026	PS5026
 
 /* NCR/Symbios Logic products */
 product SYMBIOS 810			0x0001	53c810



CVS commit: src/sys/dev/pci

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:29:14 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Phison PS5021 and PS5026.


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

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

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

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.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/btvmeii.c
diff -u src/sys/dev/pci/btvmeii.c:1.27 src/sys/dev/pci/btvmeii.c:1.28
--- src/sys/dev/pci/btvmeii.c:1.27	Tue Dec  5 15:58:32 2023
+++ src/sys/dev/pci/btvmeii.c	Wed Apr 24 02:31:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $ */
+/* $NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $");
 
 #include 
 #include 
@@ -328,7 +328,7 @@ b3_2706_map_vme(void *vsc, vme_addr_t vm
 			0,			/* boundary */
 			VMEM_ADDR_MIN,		/* minaddr */
 			VMEM_ADDR_MAX,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			)) {
 		sc->windowused[wnd] = 0;
 		return (ENOMEM);



CVS commit: src/sys/dev/pci

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

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

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.c

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



CVS commit: src/sys/dev/pci

2024-04-23 Thread Hans Rosenfeld
Module Name:src
Committed By:   hans
Date:   Tue Apr 23 15:34:07 UTC 2024

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

Log Message:
Sync the statistics DMA memory correctly before it is accessed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_bnx.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.113 src/sys/dev/pci/if_bnx.c:1.114
--- src/sys/dev/pci/if_bnx.c:1.113	Fri Feb  9 22:08:35 2024
+++ src/sys/dev/pci/if_bnx.c	Tue Apr 23 15:34:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.113 2024/02/09 22:08:35 andvar Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.114 2024/04/23 15:34:07 hans Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.113 2024/02/09 22:08:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.114 2024/04/23 15:34:07 hans Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -5667,7 +5667,7 @@ bnx_stats_update(struct bnx_softc *sc)
 	struct statistics_block	*stats;
 
 	DBPRINT(sc, BNX_EXCESSIVE, "Entering %s()\n", __func__);
-	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, BNX_STATUS_BLK_SZ,
+	bus_dmamap_sync(sc->bnx_dmatag, sc->stats_map, 0, BNX_STATS_BLK_SZ,
 	BUS_DMASYNC_POSTREAD);
 
 	stats = (struct statistics_block *)sc->stats_block;
@@ -6257,7 +6257,7 @@ void
 bnx_dump_stats_block(struct bnx_softc *sc)
 {
 	struct statistics_block	*sblk;
-	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, BNX_STATUS_BLK_SZ,
+	bus_dmamap_sync(sc->bnx_dmatag, sc->stats_map, 0, BNX_STATS_BLK_SZ,
 	BUS_DMASYNC_POSTREAD);
 
 	sblk = sc->stats_block;



CVS commit: src/sys/dev/pci

2024-04-23 Thread Hans Rosenfeld
Module Name:src
Committed By:   hans
Date:   Tue Apr 23 15:34:07 UTC 2024

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

Log Message:
Sync the statistics DMA memory correctly before it is accessed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_bnx.c

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



CVS commit: src/sys/dev/pci

2024-04-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr 19 21:24:00 UTC 2024

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
s/Resorce/Resource/ in comment and log message.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.169 -r1.170 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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.243 src/sys/dev/pci/pci_subr.c:1.244
--- src/sys/dev/pci/pci_subr.c:1.243	Thu Aug 10 20:02:56 2023
+++ src/sys/dev/pci/pci_subr.c	Fri Apr 19 21:24:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.243 2023/08/10 20:02:56 andvar Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.244 2024/04/19 21:24:00 andvar Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.243 2023/08/10 20:02:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.244 2024/04/19 21:24:00 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -2559,10 +2559,10 @@ pci_conf_print_ea_cap_prop(unsigned int 
 		printf("I/O Space\n");
 		break;
 	case PCI_EA_PROP_VF_MEM_NONPREF:
-		printf("Resorce for VF use, Memory Space, Non-Prefetchable\n");
+		printf("Resource for VF use, Memory Space, Non-Prefetchable\n");
 		break;
 	case PCI_EA_PROP_VF_MEM_PREF:
-		printf("Resorce for VF use, Memory Space, Prefetch\n");
+		printf("Resource for VF use, Memory Space, Prefetch\n");
 		break;
 	case PCI_EA_PROP_BB_MEM_NONPREF:
 		printf("Behind the Bridge, Memory Space, Non-Pref\n");

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.169 src/sys/dev/pci/pcireg.h:1.170
--- src/sys/dev/pci/pcireg.h:1.169	Fri Feb  2 22:19:13 2024
+++ src/sys/dev/pci/pcireg.h	Fri Apr 19 21:24:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.169 2024/02/02 22:19:13 andvar Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.170 2024/04/19 21:24:00 andvar Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1963,8 +1963,8 @@ struct pci_rom {
 #define  PCI_EA_PROP_MEM_NONPREF	0x00	/* Memory Space, Non-Prefetchable */
 #define  PCI_EA_PROP_MEM_PREF		0x01	/* Memory Space, Prefetchable */
 #define  PCI_EA_PROP_IO			0x02	/* I/O Space */
-#define  PCI_EA_PROP_VF_MEM_NONPREF	0x03	/* Resorce for VF use. Mem. Non-Pref */
-#define  PCI_EA_PROP_VF_MEM_PREF	0x04	/* Resorce for VF use. Mem. Prefetch */
+#define  PCI_EA_PROP_VF_MEM_NONPREF	0x03	/* Resource for VF use. Mem. Non-Pref */
+#define  PCI_EA_PROP_VF_MEM_PREF	0x04	/* Resource for VF use. Mem. Prefetch */
 #define  PCI_EA_PROP_BB_MEM_NONPREF	0x05	/* Behind Bridge: MEM. Non-Pref */
 #define  PCI_EA_PROP_BB_MEM_PREF	0x06	/* Behind Bridge: MEM. Prefetch */
 #define  PCI_EA_PROP_BB_IO		0x07	/* Behind Bridge: I/O Space */



CVS commit: src/sys/dev/pci

2024-04-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr 19 21:24:00 UTC 2024

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
s/Resorce/Resource/ in comment and log message.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.169 -r1.170 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: src/sys/dev/pci

2024-04-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Apr 11 10:42:42 UTC 2024

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

Log Message:
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.26 -r1.27 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: src/sys/dev/pci

2024-04-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Apr 11 10:42:42 UTC 2024

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

Log Message:
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.26 -r1.27 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.26 src/sys/dev/pci/if_mcx.c:1.27
--- src/sys/dev/pci/if_mcx.c:1.26	Thu Oct 26 03:44:12 2023
+++ src/sys/dev/pci/if_mcx.c	Thu Apr 11 10:42:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.26 2023/10/26 03:44:12 msaitoh Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.27 2024/04/11 10:42:42 andvar 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.26 2023/10/26 03:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.27 2024/04/11 10:42:42 andvar 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: src/sys/dev/pci

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:11:50 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen.


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

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:11:50 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen.


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

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:10:11 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Zhaoxin devices, mainly from my TVS-675 NAS device, and some additional
to fill the gaps from pci-ids database.


To generate a diff of this commit:
cvs rdiff -u -r1.1503 -r1.1504 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.1503 src/sys/dev/pci/pcidevs:1.1504
--- src/sys/dev/pci/pcidevs:1.1503	Wed Feb 28 18:51:34 2024
+++ src/sys/dev/pci/pcidevs	Sat Apr  6 09:10:11 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1503 2024/02/28 18:51:34 jakllsch Exp $
+$NetBSD: pcidevs,v 1.1504 2024/04/06 09:10:11 andvar Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -651,6 +651,7 @@ 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)
@@ -10173,6 +10174,47 @@ product ZEINET 1221	0x0001	1221
 /* Ziatech products */
 product ZIATECH ZT8905	0x8905 PCI-ST32 Bridge
 
+/* Zhaoxin products */
+product ZHAOXIN ZX100_PCIE		0x0708	ZX-100 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_0		0x0710	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_1		0x0711	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_2		0x0712	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_3		0x0713	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_4		0x0714	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_5		0x0715	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZXD_PCIE		0x0716	ZX-D PCI Express Root Port
+product ZHAOXIN KX_PCIE_0		0x0717	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_1		0x0718	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_2		0x0719	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_3		0x071a	KX-5000|6000(G) / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_4		0x071b	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_5		0x071c	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_6		0x071d	KX-5000|6000(G) / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_7		0x071e	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN ZX200_UP_PCIE_SWITCH	0x071f	ZX-200 Upstream Port of PCI Express Switch
+product ZHAOXIN ZX200_DP_PCIE_SWITCH	0x0721	ZX-200 Downstream Port of PCI Express Switch
+product ZHAOXIN ZX200_PCIE_PC2_BRIDGE	0x0722	ZX-200 PCIE P2C bridge
+product ZHAOXIN ZX_MISC_BUS		0x1001	ZX-D/ZX-E/KH-4/KX-7000 Miscellaneous Bus
+product ZHAOXIN ZX_PCHB_0		0x1003	ZX-E Standard Host Bridge
+product ZHAOXIN ZX_UHCI			0x3038	USB UHCI Controller
+product ZHAOXIN ZX_EHCI			0x3104	USB EHCI Controller
+product ZHAOXIN ZX_PCHB_1		0x31b0	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Standard Host Bridge
+product ZHAOXIN ZX_PCHB_2		0x31b1	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Standard Host Bridge
+product ZHAOXIN ZX_DRAM			0x31b2	ZX-100 / KX-5000|6000(G)|7000 / KH-4 DRAM Controller
+product ZHAOXIN ZX_PMC			0x31b3	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Power Management Controller
+product ZHAOXIN ZX_IOAPIC		0x31b4	ZX-100 / KX-5000|6000(G)|7000 / KH-4 I/O APIC
+product ZHAOXIN ZX_SCRATCH		0x31b5	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Scratch Device
+product ZHAOXIN ZX_PCHB_3		0x31b7	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Standard Host Bridge
+product ZHAOXIN C320_GPU		0x3a02	ZX-100 C-320 GPU
+product ZHAOXIN C860_GPU		0x3a03	ZX-D C-860 Integrated Graphics
+product ZHAOXIN C960_GPU		0x3a04	KX-6000 C-960 Integrated Graphics
+product ZHAOXIN C1190_GPU		0x3a05	KX-7000 C-1190 Integrated Graphics
+product ZHAOXIN ZX200_AHCI		0x9083	StorX AHCI Controller
+product ZHAOXIN ZXE_HDAUDIO 		0x9144	ZX-E High Definition Audio Controller
+product ZHAOXIN ZX100_XHCI		0x9202	ZX-100 USB xHCI Controller
+product ZHAOXIN ZX200_XHCI		0x9203	ZX-200 USB xHCI Controller
+product ZHAOXIN KX_XHCI			0x9204	KX-6000(G)|7000 USB xHCI Controller
+
 /* Zoran products */
 product ZORAN ZR36057	0x6057 ZR36057 Multimedia Controller
 product ZORAN ZR36120	0x6120 ZR36120 Video Controller



CVS commit: src/sys/dev/pci

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:10:11 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Zhaoxin devices, mainly from my TVS-675 NAS device, and some additional
to fill the gaps from pci-ids database.


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

2024-04-02 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Apr  3 01:13:41 UTC 2024

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

Log Message:
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@gmail.com, 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.100 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.100
--- 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  3 01:13:41 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.100 2024/04/03 01:13:41 gutteridge 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.100 2024/04/03 01:13:41 gutteridge 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: src/sys/dev/pci

2024-04-02 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Apr  3 01:13:41 UTC 2024

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

Log Message:
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@gmail.com, 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.100 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: src/sys/dev/pci

2024-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr  1 22:56:56 UTC 2024

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

Log Message:
s/Doucments/Documents/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/dev/pci/if_bge.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.390 src/sys/dev/pci/if_bge.c:1.391
--- src/sys/dev/pci/if_bge.c:1.390	Fri Feb  9 22:08:35 2024
+++ src/sys/dev/pci/if_bge.c	Mon Apr  1 22:56:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.390 2024/02/09 22:08:35 andvar Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.391 2024/04/01 22:56:55 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.390 2024/02/09 22:08:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.391 2024/04/01 22:56:55 andvar Exp $");
 
 #include 
 #include 
@@ -5746,7 +5746,7 @@ bge_init_locked(struct ifnet *ifp)
 
 	/* 5718 step 12, 57XX step 37 */
 	/*
-	 * XXX Doucments of 5718 series and 577xx say the recommended value
+	 * XXX Documents of 5718 series and 577xx say the recommended value
 	 * is 1, but tg3 set 1 only on 57765 series.
 	 */
 	if (BGE_IS_57765_PLUS(sc))



CVS commit: src/sys/dev/pci

2024-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr  1 22:56:56 UTC 2024

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

Log Message:
s/Doucments/Documents/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/dev/pci/if_bge.c

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



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

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

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 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.70 src/sys/dev/pci/pciide_common.c:1.71
--- src/sys/dev/pci/pciide_common.c:1.70	Mon Nov 20 21:59:38 2023
+++ src/sys/dev/pci/pciide_common.c	Sun Mar 31 18:59:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $	*/
+/*	$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $	*/
 
 
 /*
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $");
 
 #include 
 
@@ -484,6 +484,16 @@ pciide_mapreg_dma(struct pciide_softc *s
 			aprint_verbose(
 			", but unused (forced off by config file)");
 			sc->sc_dma_ok = 0;
+		} else {
+			bool disable;
+
+			if (prop_dictionary_get_bool(
+			device_properties(sc->sc_wdcdev.sc_atac.atac_dev),
+			"pciide-disable-dma", ) && disable) {
+aprint_verbose(
+", but unused (disabled by platform)");
+sc->sc_dma_ok = 0;
+			}
 		}
 		break;
 



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

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

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


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

2024-03-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 24 03:29:03 UTC 2024

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

Log Message:
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.76 -r1.77 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.76 src/sys/dev/pci/ehci_pci.c:1.77
--- src/sys/dev/pci/ehci_pci.c:1.76	Tue Jan 24 08:40:46 2023
+++ src/sys/dev/pci/ehci_pci.c	Sun Mar 24 03:29:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.76 2023/01/24 08:40:46 mlelstv Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.77 2024/03/24 03:29:02 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.76 2023/01/24 08:40:46 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.77 2024/03/24 03:29:02 mrg 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, pc, tag);
+	sc->sc_init_state = EHCI_INIT_OWNER;
 
 	int err = ehci_init(>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_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_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_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, EHCI_USBINTR, 0);
-	/* XXX grotty hack to flush the write */
-	(void)EOREAD4(>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, EHCI_USBINTR, 0);
+		/* XXX grotty hack to flush the write */
+		(void)EOREAD4(>sc, EHCI_USBINTR);
 	}
 
-	if (sc->sc.sc_size) {
-		ehci_release_ownership(>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: src/sys/dev/pci

2024-03-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 24 03:29:03 UTC 2024

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

Log Message:
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.76 -r1.77 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: src/sys/dev/pci

2024-03-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Mar 21 12:33:21 UTC 2024

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

Log Message:
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.110 -r1.111 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.110 src/sys/dev/pci/if_vioif.c:1.111
--- src/sys/dev/pci/if_vioif.c:1.110	Fri Feb  9 22:08:36 2024
+++ src/sys/dev/pci/if_vioif.c	Thu Mar 21 12:33:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.110 2024/02/09 22:08:36 andvar Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.111 2024/03/21 12:33:21 isaki Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.110 2024/02/09 22:08:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.111 2024/03/21 12:33:21 isaki 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_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 = [i];
@@ -1297,7 +1299,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 goto err_reqs;
 
 			r = vioif_dmamap_create(sc, [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: src/sys/dev/pci

2024-03-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Mar 21 12:33:21 UTC 2024

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

Log Message:
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.110 -r1.111 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: src/sys/dev/pci

2024-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar  9 22:03:32 UTC 2024

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

Log Message:
aq(4): always poll for link status

some devices don't have working link status and rather than have
a likely incomplete list of issues, always poll as well as use
the interrupt if possible.

fixes link status on this device:

aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev. 
0x02)
aq0: Atlantic revision B1, F/W version 3.1.88

(was otherwise functional, just didn't report status, which likely
meant eg, dhcpcd would be upset?)

idea via mlelstv@ from linux.

remove sc_detect_linkstat and rename sc_poll_linkstat to
sc_no_link_intr, as the meaning has changed.  simplify the signature
for aq_setup_msix() and aq_establish_msix_intr(), removing forward
decls that aren't required.  obsolete AQ_FORCE_POLL_LINKSTAT.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/if_aq.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_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.46 src/sys/dev/pci/if_aq.c:1.47
--- src/sys/dev/pci/if_aq.c:1.46	Wed Feb  7 04:20:28 2024
+++ src/sys/dev/pci/if_aq.c	Sat Mar  9 22:03:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.46 2024/02/07 04:20:28 msaitoh Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.47 2024/03/09 22:03:32 mrg Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.46 2024/02/07 04:20:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.47 2024/03/09 22:03:32 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1330,8 +1330,7 @@ struct aq_softc {
 	int sc_rx_irq[AQ_RSSQUEUE_MAX];
 	int sc_linkstat_irq;
 	bool sc_use_txrx_independent_intr;
-	bool sc_poll_linkstat;
-	bool sc_detect_linkstat;
+	bool sc_no_link_intr;
 
 #if NSYSMON_ENVSYS > 0
 	struct sysmon_envsys *sc_sme;
@@ -1443,11 +1442,9 @@ static int aq_match(device_t, cfdata_t, 
 static void aq_attach(device_t, device_t, void *);
 static int aq_detach(device_t, int);
 
-static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *, int,
-bool, bool);
+static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *);
 static int aq_setup_legacy(struct aq_softc *, struct pci_attach_args *,
 pci_intr_type_t);
-static int aq_establish_msix_intr(struct aq_softc *, bool, bool);
 
 static int aq_ifmedia_change(struct ifnet * const);
 static void aq_ifmedia_status(struct ifnet * const, struct ifmediareq *);
@@ -1784,67 +1781,57 @@ aq_attach(device_t parent, device_t self
 	if (msixcount >= (sc->sc_nqueues * 2 + 1)) {
 		/* TX intrs + RX intrs + LINKSTAT intrs */
 		sc->sc_use_txrx_independent_intr = true;
-		sc->sc_poll_linkstat = false;
 		sc->sc_msix = true;
 	} else if (msixcount >= (sc->sc_nqueues * 2)) {
 		/* TX intrs + RX intrs */
 		sc->sc_use_txrx_independent_intr = true;
-		sc->sc_poll_linkstat = true;
 		sc->sc_msix = true;
 	} else
 #endif
 	if (msixcount >= (sc->sc_nqueues + 1)) {
 		/* TX/RX intrs LINKSTAT intrs */
 		sc->sc_use_txrx_independent_intr = false;
-		sc->sc_poll_linkstat = false;
 		sc->sc_msix = true;
 	} else if (msixcount >= sc->sc_nqueues) {
 		/* TX/RX intrs */
 		sc->sc_use_txrx_independent_intr = false;
-		sc->sc_poll_linkstat = true;
+		sc->sc_no_link_intr = true;
 		sc->sc_msix = true;
 	} else {
 		/* giving up using MSI-X */
 		sc->sc_msix = false;
 	}
 
-	/* on AQ1a0, AQ2, or FIBRE, linkstat interrupt doesn't work? */
-	if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE ||
-	(HWTYPE_AQ1_P(sc) && FW_VERSION_MAJOR(sc) == 1) ||
-	HWTYPE_AQ2_P(sc))
-		sc->sc_poll_linkstat = true;
-
-#ifdef AQ_FORCE_POLL_LINKSTAT
-	sc->sc_poll_linkstat = true;
-#endif
-
 	aprint_debug_dev(sc->sc_dev,
 	"ncpu=%d, pci_msix_count=%d."
 	" allocate %d interrupts for %d%s queues%s\n",
 	ncpu, msixcount,
 	(sc->sc_use_txrx_independent_intr ?
 	(sc->sc_nqueues * 2) : sc->sc_nqueues) +
-	(sc->sc_poll_linkstat ? 0 : 1),
+	(sc->sc_no_link_intr ? 0 : 1),
 	sc->sc_nqueues,
 	sc->sc_use_txrx_independent_intr ? "*2" : "",
-	sc->sc_poll_linkstat ? "" : ", and link status");
+	(sc->sc_no_link_intr) ? "" : ", and link status");
 
 	if (sc->sc_msix)
-		error = aq_setup_msix(sc, pa, sc->sc_nqueues,
-		sc->sc_use_txrx_independent_intr, !sc->sc_poll_linkstat);
+		error = aq_setup_msix(sc, pa);
 	else
 		error = ENODEV;
 
 	if (error != 0) {
 		/* if MSI-X failed, fallback to MSI with single queue */
 		sc->sc_use_txrx_independent_intr = false;
-		sc->sc_poll_linkstat = false;
 		sc->sc_msix = false;
 		sc->sc_nqueues = 1;
+		sc->sc_no_link_intr = false;
+		aprint_debug_dev(sc->sc_dev, "MSI-X failed: %d, trying MSI",
+		error);
 		error = aq_setup_legacy(sc, pa, PCI_INTR_TYPE_MSI);
 	}
 	if (error != 0) {
 		/* if MSI failed, fallback to INTx */
+		aprint_debug_dev(sc->sc_dev, 

CVS commit: src/sys/dev/pci

2024-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar  9 22:03:32 UTC 2024

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

Log Message:
aq(4): always poll for link status

some devices don't have working link status and rather than have
a likely incomplete list of issues, always poll as well as use
the interrupt if possible.

fixes link status on this device:

aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev. 
0x02)
aq0: Atlantic revision B1, F/W version 3.1.88

(was otherwise functional, just didn't report status, which likely
meant eg, dhcpcd would be upset?)

idea via mlelstv@ from linux.

remove sc_detect_linkstat and rename sc_poll_linkstat to
sc_no_link_intr, as the meaning has changed.  simplify the signature
for aq_setup_msix() and aq_establish_msix_intr(), removing forward
decls that aren't required.  obsolete AQ_FORCE_POLL_LINKSTAT.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/if_aq.c

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



CVS commit: src/sys/dev/pci

2024-03-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  9 11:04:22 UTC 2024

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

Log Message:
Modify a confused expression in ld_virtio_attach().
VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments,
so I rename it to VIRTIO_BLK_CTRL_SEGMENTS.
PR kern/57981.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ld_virtio.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/ld_virtio.c
diff -u src/sys/dev/pci/ld_virtio.c:1.33 src/sys/dev/pci/ld_virtio.c:1.34
--- src/sys/dev/pci/ld_virtio.c:1.33	Mon Feb 12 02:28:28 2024
+++ src/sys/dev/pci/ld_virtio.c	Sat Mar  9 11:04:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $	*/
+/*	$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,
  * Each block request uses at least two segments - one for the header
  * and one for the status.
 */
-#define	VIRTIO_BLK_MIN_SEGMENTS	2
+#define	VIRTIO_BLK_CTRL_SEGMENTS	2
 
 #define VIRTIO_BLK_FLAG_BITS			\
 	VIRTIO_COMMON_FLAG_BITS			\
@@ -222,7 +222,7 @@ ld_virtio_alloc_reqs(struct ld_virtio_so
 		r = bus_dmamap_create(virtio_dmat(sc->sc_virtio),
   ld->sc_maxxfer,
   (ld->sc_maxxfer / NBPG) +
-  VIRTIO_BLK_MIN_SEGMENTS,
+  VIRTIO_BLK_CTRL_SEGMENTS,
   ld->sc_maxxfer,
   0,
   BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW,
@@ -319,18 +319,15 @@ ld_virtio_attach(device_t parent, device
 	if (features & VIRTIO_BLK_F_SEG_MAX) {
 		maxnsegs = virtio_read_device_config_4(vsc,
 		VIRTIO_BLK_CONFIG_SEG_MAX);
-		if (maxnsegs < VIRTIO_BLK_MIN_SEGMENTS) {
+		if (maxnsegs == 0) {
 			aprint_error_dev(sc->sc_dev,
-			"Too small SEG_MAX %d minimum is %d\n",
-			maxnsegs, VIRTIO_BLK_MIN_SEGMENTS);
-			maxnsegs = maxxfersize / NBPG;
-			// goto err;
+			"Invalid SEG_MAX %d\n", maxnsegs);
+			goto err;
 		}
 	} else
 		maxnsegs = maxxfersize / NBPG;
 
-	/* 2 for the minimum size */
-	maxnsegs += VIRTIO_BLK_MIN_SEGMENTS;
+	maxnsegs += VIRTIO_BLK_CTRL_SEGMENTS;
 
 	virtio_init_vq_vqdone(vsc, >sc_vq, 0,
 	ld_virtio_vq_done);
@@ -414,7 +411,7 @@ ld_virtio_start(struct ld_softc *ld, str
 	}
 
 	r = virtio_enqueue_reserve(vsc, vq, slot, vr->vr_payload->dm_nsegs +
-	VIRTIO_BLK_MIN_SEGMENTS);
+	VIRTIO_BLK_CTRL_SEGMENTS);
 	if (r != 0) {
 		bus_dmamap_unload(virtio_dmat(vsc), vr->vr_payload);
 		return r;
@@ -543,7 +540,7 @@ ld_virtio_dump(struct ld_softc *ld, void
 		return r;
 
 	r = virtio_enqueue_reserve(vsc, vq, slot, vr->vr_payload->dm_nsegs +
-	VIRTIO_BLK_MIN_SEGMENTS);
+	VIRTIO_BLK_CTRL_SEGMENTS);
 	if (r != 0) {
 		bus_dmamap_unload(virtio_dmat(vsc), vr->vr_payload);
 		return r;
@@ -679,7 +676,7 @@ ld_virtio_flush(struct ld_softc *ld, boo
 	vr = >sc_reqs[slot];
 	KASSERT(vr->vr_bp == NULL);
 
-	r = virtio_enqueue_reserve(vsc, vq, slot, VIRTIO_BLK_MIN_SEGMENTS);
+	r = virtio_enqueue_reserve(vsc, vq, slot, VIRTIO_BLK_CTRL_SEGMENTS);
 	if (r != 0) {
 		return r;
 	}



CVS commit: src/sys/dev/pci

2024-03-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  9 11:04:22 UTC 2024

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

Log Message:
Modify a confused expression in ld_virtio_attach().
VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments,
so I rename it to VIRTIO_BLK_CTRL_SEGMENTS.
PR kern/57981.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ld_virtio.c

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



CVS commit: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:55:11 UTC 2024

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

Log Message:
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.53
--- 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	Wed Feb 28 18:55:11 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.53 2024/02/28 18:55:11 jakllsch 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.53 2024/02/28 18:55:11 jakllsch 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: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:55:11 UTC 2024

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

Log Message:
Add Killer E2600, adapted from PR 57969


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

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:54:04 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


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

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:51:34 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add (Realtek/)Killer E2600 Ethernet


To generate a diff of this commit:
cvs rdiff -u -r1.1502 -r1.1503 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.1502 src/sys/dev/pci/pcidevs:1.1503
--- src/sys/dev/pci/pcidevs:1.1502	Thu Jan 18 03:15:26 2024
+++ src/sys/dev/pci/pcidevs	Wed Feb 28 18:51:34 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1502 2024/01/18 03:15:26 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1503 2024/02/28 18:51:34 jakllsch Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -9190,6 +9190,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: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:51:34 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add (Realtek/)Killer E2600 Ethernet


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

2024-02-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb 23 22:03:45 UTC 2024

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

Log Message:
s/opetions/options/ in hw.ubsec node description.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ubsec.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/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.64 src/sys/dev/pci/ubsec.c:1.65
--- src/sys/dev/pci/ubsec.c:1.64	Fri Aug  4 07:38:53 2023
+++ src/sys/dev/pci/ubsec.c	Fri Feb 23 22:03:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.64 2023/08/04 07:38:53 riastradh Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.65 2024/02/23 22:03:45 andvar Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.64 2023/08/04 07:38:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.65 2024/02/23 22:03:45 andvar Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -609,7 +609,7 @@ SYSCTL_SETUP(ubsec_sysctl_init, "ubsec s
 	sysctl_createv(clog, 0, NULL, ,
 		CTLFLAG_PERMANENT,
 		CTLTYPE_NODE, "ubsec",
-		SYSCTL_DESCR("ubsec opetions"),
+		SYSCTL_DESCR("ubsec options"),
 		NULL, 0, NULL, 0,
 		CTL_HW, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, , NULL,



CVS commit: src/sys/dev/pci

2024-02-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb 23 22:03:45 UTC 2024

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

Log Message:
s/opetions/options/ in hw.ubsec node description.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ubsec.c

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



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:39:39 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c igc_defines.h

Log Message:
igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2 -r1.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.12 src/sys/dev/pci/igc/if_igc.c:1.13
--- src/sys/dev/pci/igc/if_igc.c:1.12	Wed Feb 21 12:34:06 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Feb 21 12:39:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh 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.12 2024/02/21 12:34:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -3850,7 +3850,7 @@ igc_print_devinfo(struct igc_softc *sc)
 	struct igc_hw *hw = >hw;
 	struct igc_phy_info *phy = >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 */
@@ -3873,10 +3873,15 @@ igc_print_devinfo(struct igc_softc *sc)
 	phy->ops.read_reg(hw, 0x1e, _ver);
 	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
 
-	/* Get NVM version */
+	/* NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver);
 
-	aprint_normal_dev(dev, "ROM image version %x.%02x\n",
+	/* EtrackID */
+	hw->nvm.ops.read(hw, NVM_ETKID_LO, 1, _lo);
+	hw->nvm.ops.read(hw, NVM_ETKID_HI, 1, _hi);
+
+	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));
+	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 src/sys/dev/pci/igc/igc_defines.h:1.3
--- src/sys/dev/pci/igc/igc_defines.h:1.2	Wed Oct  4 07:35:27 2023
+++ src/sys/dev/pci/igc/igc_defines.h	Wed Feb 21 12:39:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: igc_defines.h,v 1.2 2023/10/04 07:35:27 rin Exp $	*/
+/*	$NetBSD: igc_defines.h,v 1.3 2024/02/21 12:39:39 msaitoh Exp $	*/
 /*	$OpenBSD: igc_defines.h,v 1.1 2021/10/31 14:52:57 patrick Exp $	*/
 
 /*-
@@ -982,6 +982,8 @@
 #define NVM_CFG0x0012
 #define NVM_ALT_MAC_ADDR_PTR		0x0037
 #define NVM_CHECKSUM_REG		0x003F
+#define NVM_ETKID_LO			0x0042
+#define NVM_ETKID_HI			0x0043
 
 #define IGC_NVM_CFG_DONE_PORT_0	0x04 /* MNG config cycle done */
 #define IGC_NVM_CFG_DONE_PORT_1	0x08 /* ...for second port */



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:39:39 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c igc_defines.h

Log Message:
igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2 -r1.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: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:34:06 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Modify dmesg output of PHY and NVM info.

 - Print PHY info first and then print NVM info.
 - Remove debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/dev/pci/igc/if_igc.c:1.12
--- src/sys/dev/pci/igc/if_igc.c:1.11	Thu Feb  8 09:59:35 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Feb 21 12:34:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh 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.11 2024/02/08 09:59:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -3862,23 +3862,21 @@ 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);
 
+	/* PHY FW version */
+	phy->ops.read_reg(hw, 0x1e, _ver);
+	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+
 	/* Get NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver);
 
-	/* Get PHY FW version */
-	phy->ops.read_reg(hw, 0x1e, _ver);
-
-	aprint_normal_dev(dev, "ROM image version %x.%02x",
+	aprint_normal_dev(dev, "ROM image version %x.%02x\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);
 }



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:34:06 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Modify dmesg output of PHY and NVM info.

 - Print PHY info first and then print NVM info.
 - Remove debug output.


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



  1   2   3   4   5   6   7   8   9   10   >