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

2023-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 30 11:34:21 UTC 2023

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

Log Message:
Regen for ticket #1580


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.14 -r1.1371.2.15 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.14 -r1.1370.2.15 src/sys/dev/pci/pcidevs_data.h

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



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

2023-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 30 11:34:21 UTC 2023

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

Log Message:
Regen for ticket #1580


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.14 -r1.1371.2.15 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.14 -r1.1370.2.15 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1371.2.14 src/sys/dev/pci/pcidevs.h:1.1371.2.15
--- src/sys/dev/pci/pcidevs.h:1.1371.2.14	Wed Jan 18 19:27:18 2023
+++ src/sys/dev/pci/pcidevs.h	Mon Jan 30 11:33:45 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1371.2.14 2023/01/18 19:27:18 martin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1371.2.15 2023/01/30 11:33:45 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1383.2.14 2023/01/18 19:26:30 martin Exp
+ *	NetBSD: pcidevs,v 1.1383.2.15 2023/01/30 11:32:22 martin Exp
  */
 
 /*
@@ -3212,6 +3212,7 @@
 #define	PCI_PRODUCT_EXAR_XR17D152	0x0152		/* dual-channel Universal PCI UART */
 #define	PCI_PRODUCT_EXAR_XR17D154	0x0154		/* quad-channel Universal PCI UART */
 #define	PCI_PRODUCT_EXAR_XR17D158	0x0158		/* octal-channel Universal PCI UART */
+#define	PCI_PRODUCT_EXAR_XR17V354	0x0354		/* quad-channel Universal PCIe UART */
 
 /* FORE products */
 #define	PCI_PRODUCT_FORE_PCA200	0x0210		/* ATM PCA-200 */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1370.2.14 src/sys/dev/pci/pcidevs_data.h:1.1370.2.15
--- src/sys/dev/pci/pcidevs_data.h:1.1370.2.14	Wed Jan 18 19:27:18 2023
+++ src/sys/dev/pci/pcidevs_data.h	Mon Jan 30 11:33:45 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1370.2.14 2023/01/18 19:27:18 martin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1370.2.15 2023/01/30 11:33:45 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1383.2.14 2023/01/18 19:26:30 martin Exp
+ *	NetBSD: pcidevs,v 1.1383.2.15 2023/01/30 11:32:22 martin Exp
  */
 
 /*
@@ -5243,6 +5243,8 @@ static const uint16_t pci_products[] = {
 	15140, 20295, 615, 7941, 0,
 	PCI_VENDOR_EXAR, PCI_PRODUCT_EXAR_XR17D158, 
 	15153, 20295, 615, 7941, 0,
+	PCI_VENDOR_EXAR, PCI_PRODUCT_EXAR_XR17V354, 
+	15140, 20295, 8154, 7941, 0,
 	PCI_VENDOR_FORE, PCI_PRODUCT_FORE_PCA200, 
 	7083, 20305, 0,
 	PCI_VENDOR_FORE, PCI_PRODUCT_FORE_PCA200E, 
@@ -18827,7 +18829,7 @@ static const char pci_words[] = { "." 
 	"NVMe\0" /* 24 refs @ 7915 */
 	"SSD\0" /* 27 refs @ 7920 */
 	"16650-compatible\0" /* 1 refs @ 7924 */
-	"UART\0" /* 96 refs @ 7941 */
+	"UART\0" /* 97 refs @ 7941 */
 	"Elastic\0" /* 1 refs @ 7946 */
 	"K8\0" /* 4 refs @ 7954 */
 	"AMD64\0" /* 14 refs @ 7957 */
@@ -18856,7 +18858,7 @@ static const char pci_words[] = { "." 
 	"Fabric\0" /* 64 refs @ 8129 */
 	"17h/6xh\0" /* 20 refs @ 8136 */
 	"Family17h\0" /* 21 refs @ 8144 */
-	"PCIe\0" /* 669 refs @ 8154 */
+	"PCIe\0" /* 670 refs @ 8154 */
 	"17h/Axh\0" /* 19 refs @ 8159 */
 	"Dummy\0" /* 6 refs @ 8167 */
 	"Crypto\0" /* 6 refs @ 8173 */
@@ -19902,7 +19904,7 @@ static const char pci_words[] = { "." 
 	"single-channel\0" /* 2 refs @ 15105 */
 	"RS-485\0" /* 8 refs @ 15120 */
 	"dual-channel\0" /* 3 refs @ 15127 */
-	"quad-channel\0" /* 3 refs @ 15140 */
+	"quad-channel\0" /* 4 refs @ 15140 */
 	"octal-channel\0" /* 3 refs @ 15153 */
 	"Isolated\0" /* 4 refs @ 15167 */
 	"PBlaze4\0" /* 1 refs @ 15176 */
@@ -20566,7 +20568,7 @@ static const char pci_words[] = { "." 
 	"OZ711E0\0" /* 1 refs @ 20270 */
 	"Freedom\0" /* 1 refs @ 20278 */
 	"PCI-GBus\0" /* 1 refs @ 20286 */
-	"Universal\0" /* 3 refs @ 20295 */
+	"Universal\0" /* 4 refs @ 20295 */
 	"PCA-200\0" /* 1 refs @ 20305 */
 	"PCA-200e\0" /* 1 refs @ 20313 */
 	"801\0" /* 1 refs @ 20322 */



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

2023-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 30 11:32:22 UTC 2023

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

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

sys/dev/pci/pcidevs: revision 1.1477

Add ID for the EXAR XR17V354 PCIe UART.
PR kern/57202


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.14 -r1.1383.2.15 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.1383.2.14 src/sys/dev/pci/pcidevs:1.1383.2.15
--- src/sys/dev/pci/pcidevs:1.1383.2.14	Wed Jan 18 19:26:30 2023
+++ src/sys/dev/pci/pcidevs	Mon Jan 30 11:32:22 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.14 2023/01/18 19:26:30 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.15 2023/01/30 11:32:22 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3205,6 +3205,7 @@ product ES FREEDOM	0x0001	Freedom PCI-GB
 product EXAR XR17D152	0x0152	dual-channel Universal PCI UART
 product EXAR XR17D154	0x0154	quad-channel Universal PCI UART
 product EXAR XR17D158	0x0158	octal-channel Universal PCI UART
+product EXAR XR17V354	0x0354	quad-channel Universal PCIe UART
 
 /* FORE products */
 product FORE PCA200	0x0210	ATM PCA-200



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

2023-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 30 11:32:22 UTC 2023

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

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

sys/dev/pci/pcidevs: revision 1.1477

Add ID for the EXAR XR17V354 PCIe UART.
PR kern/57202


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

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 14:04:42 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-9]: files.pci
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe_82598.c
ixgbe_api.c ixgbe_common.c ixgbe_netbsd.h ixv.c

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

sys/dev/pci/files.pci   1.442
sys/dev/pci/ixgbe/ix_txrx.c 1.99-1.100
sys/dev/pci/ixgbe/ixgbe.c   1.320-1.324 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.19
sys/dev/pci/ixgbe/ixgbe_api.c   1.28
sys/dev/pci/ixgbe/ixgbe_common.c1.43
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.17
sys/dev/pci/ixgbe/ixv.c 1.183

- Add an option for Tx to use deferred softint regardless of whether
  can get txq lock or not. It's off by default.
- Call txeof first, then rxeof for the consistency.
- Make three "Unsupported SFP+ module..." messages the same.
- KNF. Modify comment. Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.413.2.5 -r1.413.2.6 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.54.2.10 -r1.54.2.11 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.24 -r1.199.2.25 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.12.8.5 -r1.12.8.6 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.23.2.3 -r1.23.2.4 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.11.4.3 -r1.11.4.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.125.2.20 -r1.125.2.21 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/files.pci
diff -u src/sys/dev/pci/files.pci:1.413.2.5 src/sys/dev/pci/files.pci:1.413.2.6
--- src/sys/dev/pci/files.pci:1.413.2.5	Thu Oct 21 14:30:10 2021
+++ src/sys/dev/pci/files.pci	Mon Jan 23 14:04:41 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.413.2.5 2021/10/21 14:30:10 martin Exp $
+#	$NetBSD: files.pci,v 1.413.2.6 2023/01/23 14:04:41 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -691,6 +691,7 @@ file	dev/pci/ixgbe/ixgbe_phy.c	ixg | ixv
 file	dev/pci/ixgbe/ixgbe_vf.c	ixg | ixv
 file	dev/pci/ixgbe/if_bypass.c	ixg | ixv
 file	dev/pci/ixgbe/if_fdir.c		ixg | ixv
+defflag	opt_if_ixg.h	IXGBE_ALWAYS_TXDEFER
 
 # This appears to be the driver for virtual instances of i82599.
 device	ixv: ether, ifnet, arp, mii, mii_phy

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.10 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.11
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.10	Mon May 30 17:01:06 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon Jan 23 14:04:42 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.10 2022/05/30 17:01:06 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.11 2023/01/23 14:04:42 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.10 2022/05/30 17:01:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.11 2023/01/23 14:04:42 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -250,6 +250,11 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 		IXGBE_EVC_ADD(>pcq_drops, 1);
 		return ENOBUFS;
 	}
+#ifdef IXGBE_ALWAYS_TXDEFER
+	kpreempt_disable();
+	softint_schedule(txr->txr_si);
+	kpreempt_enable();
+#else
 	if (IXGBE_TX_TRYLOCK(txr)) {
 		ixgbe_mq_start_locked(ifp, txr);
 		IXGBE_TX_UNLOCK(txr);
@@ -279,6 +284,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 			kpreempt_enable();
 		}
 	}
+#endif
 
 	return (0);
 } /* ixgbe_mq_start */
@@ -316,7 +322,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 #if __FreeBSD_version >= 1100036
 		/*
 		 * Since we're looking at the tx ring, we can check
-		 * to see if we're a VF by examing our tail register
+		 * to see if we're a VF by examining our tail register
 		 * address.
 		 */
 		if ((txr->adapter->feat_en & IXGBE_FEATURE_VF) &&
@@ -1977,7 +1983,7 @@ ixgbe_rxeof(struct ix_queue *que)
 		 * not be fragmented across sequential
 		 * descriptors, rather the next descriptor
 		 * is indicated in bits of the descriptor.
-		 * This also means that we might proceses
+		 * This also means that we might process
 		 * more than one packet at a time, something
 		 * that has never been true before, it
 		 * required eliminating global chain pointers

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.24 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.25
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.24	Fri Jun  3 04:00:49 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 23 14:04:42 2023
@@ -1,4 +1,4 @@

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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 14:04:42 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-9]: files.pci
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe_82598.c
ixgbe_api.c ixgbe_common.c ixgbe_netbsd.h ixv.c

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

sys/dev/pci/files.pci   1.442
sys/dev/pci/ixgbe/ix_txrx.c 1.99-1.100
sys/dev/pci/ixgbe/ixgbe.c   1.320-1.324 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.19
sys/dev/pci/ixgbe/ixgbe_api.c   1.28
sys/dev/pci/ixgbe/ixgbe_common.c1.43
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.17
sys/dev/pci/ixgbe/ixv.c 1.183

- Add an option for Tx to use deferred softint regardless of whether
  can get txq lock or not. It's off by default.
- Call txeof first, then rxeof for the consistency.
- Make three "Unsupported SFP+ module..." messages the same.
- KNF. Modify comment. Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.413.2.5 -r1.413.2.6 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.54.2.10 -r1.54.2.11 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.24 -r1.199.2.25 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.12.8.5 -r1.12.8.6 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.23.2.3 -r1.23.2.4 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.11.4.3 -r1.11.4.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.125.2.20 -r1.125.2.21 src/sys/dev/pci/ixgbe/ixv.c

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 13:59:04 UTC 2023

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

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

sys/dev/pci/if_wm.c 1.764-1.767 via patch
sys/dev/pci/if_wmreg.h  1.128

- Workaround for some hypervisor environments. The environments
  cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
  change.
- Add comment. Modify comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.14 -r1.645.2.15 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.6 -r1.115.2.7 src/sys/dev/pci/if_wmreg.h

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 13:59:04 UTC 2023

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

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

sys/dev/pci/if_wm.c 1.764-1.767 via patch
sys/dev/pci/if_wmreg.h  1.128

- Workaround for some hypervisor environments. The environments
  cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
  change.
- Add comment. Modify comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.14 -r1.645.2.15 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.6 -r1.115.2.7 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.14 src/sys/dev/pci/if_wm.c:1.645.2.15
--- src/sys/dev/pci/if_wm.c:1.645.2.14	Wed Sep  7 10:05:42 2022
+++ src/sys/dev/pci/if_wm.c	Mon Jan 23 13:59:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.14 2022/09/07 10:05:42 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.15 2023/01/23 13:59:04 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.14 2022/09/07 10:05:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.15 2023/01/23 13:59:04 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -490,6 +490,7 @@ struct wm_queue {
 	char sysctlname[32];		/* Name for sysctl */
 
 	bool wmq_txrx_use_workqueue;
+	bool wmq_wq_enqueued;
 	struct work wmq_cookie;
 	void *wmq_si;
 	krndsource_t rnd_source;	/* random source */
@@ -2289,7 +2290,7 @@ alloc_retry:
 aprint_error_dev(sc->sc_dev,
 "unable to find PCIX capability\n");
 			else if (sc->sc_type != WM_T_82545_3 &&
- sc->sc_type != WM_T_82546_3) {
+			sc->sc_type != WM_T_82546_3) {
 /*
  * Work around a problem caused by the BIOS
  * setting the max memory read byte count
@@ -3673,7 +3674,7 @@ wm_watchdog_txq_locked(struct ifnet *ifp
 		ifp->if_oerrors++;
 #ifdef WM_DEBUG
 		for (i = txq->txq_sdirty; i != txq->txq_snext;
-		i = WM_NEXTTXS(txq, i)) {
+		 i = WM_NEXTTXS(txq, i)) {
 			txs = >txq_soft[i];
 			printf("txs %d tx %d -> %d\n",
 			i, txs->txs_firstdesc, txs->txs_lastdesc);
@@ -3834,9 +3835,9 @@ wm_tick(void *arg)
 	crcerrs + algnerrc + symerrc + rxerrc + sec + cexterr + rlec;
 
 	/*
-	 * WMREG_RNBC is incremented when there are no available buffers in host
-	 * memory. It does not mean the number of dropped packets, because an
-	 * Ethernet controller can receive packets in such case if there is
+	 * WMREG_RNBC is incremented when there are no available buffers in
+	 * host memory. It does not mean the number of dropped packets, because
+	 * an Ethernet controller can receive packets in such case if there is
 	 * space in the phy's FIFO.
 	 *
 	 * If you want to know the nubmer of WMREG_RMBC, you should use such as
@@ -4153,7 +4154,7 @@ wm_read_mac_addr(struct wm_softc *sc, ui
 
 	return 0;
 
- bad:
+bad:
 	return -1;
 }
 
@@ -4442,10 +4443,10 @@ wm_set_filter(struct wm_softc *sc)
 
 	goto setit;
 
- allmulti:
+allmulti:
 	sc->sc_rctl |= RCTL_MPE;
 
- setit:
+setit:
 	if (sc->sc_type >= WM_T_PCH2) {
 		if (((ec->ec_capabilities & ETHERCAP_JUMBO_MTU) != 0)
 		&& (ifp->if_mtu > ETHERMTU))
@@ -4836,7 +4837,8 @@ wm_init_lcd_from_nvm(struct wm_softc *sc
 		 * LCD Write Enable bits are set in the NVM. When both NVM bits
 		 * are cleared, SW will configure them instead.
 		 */
-		DPRINTF(sc, WM_DEBUG_INIT, ("%s: %s: Configure SMBus and LED\n",
+		DPRINTF(sc, WM_DEBUG_INIT,
+		("%s: %s: Configure SMBus and LED\n",
 			device_xname(sc->sc_dev), __func__));
 		if ((rv = wm_write_smbus_addr(sc)) != 0)
 			goto release;
@@ -5147,15 +5149,15 @@ wm_initialize_hardware_bits(struct wm_so
 		CSR_WRITE(sc, WMREG_TARC0, tarc0);
 
 		switch (sc->sc_type) {
-		/*
-		 * 8257[12] Errata No.52, 82573 Errata No.43 and some others.
-		 * Avoid RSS Hash Value bug.
-		 */
 		case WM_T_82571:
 		case WM_T_82572:
 		case WM_T_82573:
 		case WM_T_80003:
 		case WM_T_ICH8:
+			/*
+			 * 8257[12] Errata No.52, 82573 Errata No.43 and some
+			 * others to avoid RSS Hash Value bug.
+			 */
 			reg = CSR_READ(sc, WMREG_RFCTL);
 			reg |= WMREG_RFCTL_NEWIPV6EXDIS |WMREG_RFCTL_IPV6EXDIS;
 			CSR_WRITE(sc, WMREG_RFCTL, reg);
@@ -5560,6 +5562,11 @@ wm_reset(struct wm_softc *sc)
 		CSR_WRITE(sc, WMREG_CTRL, reg);
 		/* Don't insert a completion barrier when reset */
 		delay(20*1000);
+		/*
+		 * The EXTCNFCTR_MDIO_SW_OWNERSHIP bit is cleared by the reset,
+		 * so don't use sc->phy.release(sc). Release sc_ich_phymtx
+		 * only. See also wm_get_swflag_ich8lan().
+		 */
 		mutex_exit(sc->sc_ich_phymtx);
 		break;
 	case WM_T_82580:
@@ 

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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:43:36 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-9]: piixpm.c piixpmreg.h

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

sys/dev/pci/piixpm.c1.66,1.68-1.72 via patch
sys/dev/pci/piixpmreg.h 1.13

Add support new AMD chipsets that do not have indirect access
I/O ports.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.2 -r1.54.2.3 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.8.2.1 -r1.8.2.2 src/sys/dev/pci/piixpmreg.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/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.54.2.2 src/sys/dev/pci/piixpm.c:1.54.2.3
--- src/sys/dev/pci/piixpm.c:1.54.2.2	Tue Nov 30 11:44:39 2021
+++ src/sys/dev/pci/piixpm.c	Mon Jan 23 12:43:35 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.54.2.2 2021/11/30 11:44:39 martin Exp $ */
+/* $NetBSD: piixpm.c,v 1.54.2.3 2023/01/23 12:43:35 martin Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.2 2021/11/30 11:44:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.3 2023/01/23 12:43:35 martin Exp $");
 
 #include 
 #include 
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1
 
 #define PIIXPM_IS_CSB5(sc)		  \
 	(PCI_VENDOR((sc)->sc_id) == PCI_VENDOR_SERVERWORKS &&		  \
-	PCI_PRODUCT((sc)->sc_id) == PCI_PRODUCT_SERVERWORKS_CSB5)
+	PCI_PRODUCT((sc)->sc_id) == PCI_PRODUCT_SERVERWORKS_CSB5)
 #define PIIXPM_DELAY	200
 #define PIIXPM_TIMEOUT	1
 
@@ -75,20 +75,20 @@ __KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1
 struct piixpm_smbus {
 	int			sda;
 	int			sda_save;
-	struct			piixpm_softc *softc;
+	struct piixpm_softc	*softc;
 };
 
 struct piixpm_softc {
 	device_t		sc_dev;
 
 	bus_space_tag_t		sc_iot;
-#define	sc_pm_iot sc_iot
-#define sc_smb_iot sc_iot
+	bus_space_tag_t		sc_sb800_bt;
 	bus_space_handle_t	sc_pm_ioh;
-	bus_space_handle_t	sc_sb800_ioh;
+	bus_space_handle_t	sc_sb800_bh;
 	bus_space_handle_t	sc_smb_ioh;
 	void *			sc_smb_ih;
 	int			sc_poll;
+	bool			sc_sb800_mmio;	/* Use MMIO access */
 	bool			sc_sb800_selen; /* Use SMBUS0SEL */
 
 	pci_chipset_tag_t	sc_pc;
@@ -121,6 +121,7 @@ static void	piixpm_chdet(device_t, devic
 static bool	piixpm_suspend(device_t, const pmf_qual_t *);
 static bool	piixpm_resume(device_t, const pmf_qual_t *);
 
+static uint8_t	piixpm_sb800_pmread(struct piixpm_softc *, bus_size_t);
 static int	piixpm_sb800_init(struct piixpm_softc *);
 static void	piixpm_csb5_reset(void *);
 static int	piixpm_i2c_sb600_acquire_bus(void *, int);
@@ -217,7 +218,7 @@ piixpm_attach(device_t parent, device_t 
 
 	/* Map I/O space */
 	base = pci_conf_read(pa->pa_pc, pa->pa_tag, PIIX_PM_BASE);
-	if (base == 0 || bus_space_map(sc->sc_pm_iot, PCI_MAPREG_IO_ADDR(base),
+	if (base == 0 || bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
 	PIIX_PM_SIZE, 0, >sc_pm_ioh)) {
 		aprint_error_dev(self,
 		"can't map power management I/O space\n");
@@ -229,13 +230,22 @@ piixpm_attach(device_t parent, device_t 
 	 * PIIX4 and PIIX4E have a bug in the timer latch, see Errata #20
 	 * in the "Specification update" (document #297738).
 	 */
-	acpipmtimer_attach(self, sc->sc_pm_iot, sc->sc_pm_ioh, PIIX_PM_PMTMR,
+	acpipmtimer_attach(self, sc->sc_iot, sc->sc_pm_ioh, PIIX_PM_PMTMR,
 	(PCI_REVISION(pa->pa_class) < 3) ? ACPIPMT_BADLATCH : 0);
 
 nopowermanagement:
 
 	/* SB800 rev 0x40+, AMD HUDSON and newer need special initialization */
 	if (PIIXPM_IS_FCHGRP(sc) || PIIXPM_IS_SB800GRP(sc)) {
+		/* Newer chips don't support I/O access */
+		if (PIIXPM_IS_KERNCZ(sc) && (sc->sc_rev >= 0x51)) {
+			sc->sc_sb800_mmio = true;
+			sc->sc_sb800_bt = pa->pa_memt;
+		} else {
+			sc->sc_sb800_mmio = false;
+			sc->sc_sb800_bt = pa->pa_iot;
+		}
+
 		if (piixpm_sb800_init(sc) == 0) {
 			/* Read configuration */
 			conf = bus_space_read_1(sc->sc_iot,
@@ -260,7 +270,7 @@ nopowermanagement:
 	/* Map I/O space */
 	base = pci_conf_read(pa->pa_pc, pa->pa_tag, PIIX_SMB_BASE) & 0x;
 	if (base == 0 ||
-	bus_space_map(sc->sc_smb_iot, PCI_MAPREG_IO_ADDR(base),
+	bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
 	PIIX_SMB_SIZE, 0, >sc_smb_ioh)) {
 		aprint_error_dev(self, "can't map smbus I/O space\n");
 		return;
@@ -395,18 +405,37 @@ piixpm_resume(device_t dv, const pmf_qua
 	return true;
 }
 
+static uint8_t
+piixpm_sb800_pmread(struct piixpm_softc *sc, bus_size_t offset)
+{
+	bus_space_tag_t sbt = sc->sc_sb800_bt;
+	bus_space_handle_t sbh = sc->sc_sb800_bh;
+	uint8_t val;
+
+	if (sc->sc_sb800_mmio)
+		val = bus_space_read_1(sbt, sbh, offset);
+	else {
+		bus_space_write_1(sbt, sbh, SB800_INDIRECTIO_INDEX, offset);
+		val = bus_space_read_1(sbt, sbh, SB800_INDIRECTIO_DATA);
+	}
+
+	return val;
+}
+
 

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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:43:36 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-9]: piixpm.c piixpmreg.h

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

sys/dev/pci/piixpm.c1.66,1.68-1.72 via patch
sys/dev/pci/piixpmreg.h 1.13

Add support new AMD chipsets that do not have indirect access
I/O ports.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.2 -r1.54.2.3 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.8.2.1 -r1.8.2.2 src/sys/dev/pci/piixpmreg.h

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



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

2023-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 18 19:27:51 UTC 2023

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

Log Message:
Regen for ticket #1566


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.13 -r1.1371.2.14 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.13 -r1.1370.2.14 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2023-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 18 19:27:51 UTC 2023

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

Log Message:
Regen for ticket #1566


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.13 -r1.1371.2.14 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.13 -r1.1370.2.14 src/sys/dev/pci/pcidevs_data.h

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



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

2023-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 18 19:26:30 UTC 2023

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

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

sys/dev/pci/sdhc_pci.c: revision 1.20
sys/dev/pci/pcidevs: revision 1.1469
sys/dev/pci/pcidevs: revision 1.1470
sys/dev/pci/pcidevs: revision 1.1471
sys/dev/pci/pcidevs: revision 1.1472
sys/dev/pci/pcidevs: revision 1.1473
sys/dev/pci/pcidevs: revision 1.1474
sys/dev/pci/pcidevs: revision 1.1475
sys/dev/pci/pcidevs: revision 1.1476

Add some AMD 17h/9xh devices from OpenBSD.
Add AMD F17/Axh devices.
Add some Xeon Scalable devices from OpenBSD.
Update Intel Elkhart Lake devices.
Add Elkhart Lake Shared SRAM.
Fix typo. s/SSC/SCC/.
Fix typo. No functional change.
add Aquantia (Marvell) AQC113 ethernet devices and the variants
Add AMD Family 19h/1xh devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.13 -r1.1383.2.14 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.14.16.1 -r1.14.16.2 src/sys/dev/pci/sdhc_pci.c

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1383.2.13 src/sys/dev/pci/pcidevs:1.1383.2.14
--- src/sys/dev/pci/pcidevs:1.1383.2.13	Tue Oct 11 17:49:35 2022
+++ src/sys/dev/pci/pcidevs	Wed Jan 18 19:26:30 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.13 2022/10/11 17:49:35 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.14 2023/01/18 19:26:30 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1028,6 +1028,7 @@ product AMD F17_IOMMU		0x1451	Family17h 
 product AMD F17_PCIE_1		0x1452	Family17h PCIe
 product AMD F17_PCIE_2		0x1453	Family17h PCIe
 product AMD F17_PCIE_3		0x1454	Family17h PCIe
+product AMD F17_AX_PCIE_DUMMY	0x1455	17h/Axh PCIe Dummy Function
 product AMD F17_CCP_1		0x1456	Family17h Crypto
 product AMD F17_HDA		0x1457	Family17h HD Audio
 product AMD F17_PCIE_DUMMY	0x145a	Family17h PCIe Dummy Function
@@ -1053,7 +1054,43 @@ product AMD F17_7X_RESV_SPP	0x1485	Famil
 product AMD F17_7X_CCP		0x1486	Family17h/7xh Crypto
 product AMD F17_3X_HDA		0x1487	17h/7xh HD Audio
 product AMD F17_7X_USB3		0x149c	Family17h/7xh USB 3.0 Host Controller
+product AMD F19_1X_IOMMU	0x149e	19h/7xh IOMMU
+product AMD F19_1X_PCIE_DUMMY_HB 0x149f	19h/7xh PCIe Dummy Host Bridge
+product AMD F19_1X_RC		0x14a4	19h/1xh Root Complex
+product AMD F19_1X_GPPB_0	0x14a5	19h/1xh PCIe GPP Bridge
+product AMD F19_1X_RCEC		0x14a6	19h/1xh RCEC
+product AMD F19_1X_INTNL_GPPB	0x14a7	19h/1xh Internal PCIe GPP Bridge
+product AMD F19_1X_GPPB_1	0x14aa	19h/1xh PCIe GPP Bridge
+product AMD F19_1X_GPPB_2	0x14ab	19h/1xh PCIe GPP Bridge
+product AMD F19_1X_PCIE_DUMMY_0	0x14ac	19h/1xh PCIe Dummy Function
+product AMD F19_1X_DF_0		0x14ad	19h/1xh Data Fabric
+product AMD F19_1X_DF_1		0x14ae	19h/1xh Data Fabric
+product AMD F19_1X_DF_2		0x14af	19h/1xh Data Fabric
+product AMD F19_1X_DF_3		0x14b0	19h/1xh Data Fabric
+product AMD F19_1X_DF_4		0x14b1	19h/1xh Data Fabric
+product AMD F19_1X_DF_5		0x14b2	19h/1xh Data Fabric
+product AMD F19_1X_DF_6		0x14b3	19h/1xh Data Fabric
+product AMD F19_1X_DF_7		0x14b4	19h/1xh Data Fabric
+product AMD F17_AX_RC		0x14b5	17h/Axh Root Complex
+product AMD F17_AX_IOMMU	0x14b6	17h/Axh IOMMU
+product AMD F17_AX_PCIE_DUMMY_HB 0x14b7	17h/Axh PCIe Dummy Host Bridge
+product AMD F17_AX_INTNL_GPPB_0	0x14b9	17h/Axh Internal GPP Bridge 0
+product AMD F17_AX_GPPB		0x14ba	17h/Axh PCIe GPP Bridge
+product AMD F19_1X_NTB_0	0x14c0	19h/1xh Primary PCIe Non Transparent Bridge
+product AMD F19_1X_VNTB		0x14c1	19h/1xh Secondary vNTB
+product AMD F19_1X_PCIE_DUMMY_1	0x14c2	19h/1xh PCIe Dummy Function
+product AMD F19_1X_NTB_1	0x14c3	19h/1xh PCIe Non Transparent Bridge
+product AMD F19_1X_SWDS		0x14c4	19h/1xh Swith NBIF DS
+product AMD F19_1X_NVME		0x14c5	19h/1xh NVMe
+product AMD F19_1X_SWUS		0x14c6	19h/1xh Swith US in PCIe
+product AMD F19_1X_PSP		0x14ca	19h/1xh PSP
+product AMD F19_1X_ACP		0x14cb	19h/1xh ACP
+product AMD F19_1X_HDA		0x14cc	19h/1xh HD Audio
 product AMD F19_6X_RC		0x14d8	19h/6xh Root Complex
+product AMD F17_AX_XHCI_0	0x1503	17h/Axh USB 3.1 xHCI
+product AMD F17_AX_XHCI_1	0x1504	17h/Axh USB 3.1 xHCI
+product AMD F17_AX_USB_BIOM	0x1505	17h/Axh Secure USB BIOmetric
+product AMD F17_AX_GFX		0x1506	17h/Axh Internal GPU
 product AMD F14_RC		0x1510	Family14h Root Complex
 product AMD F14_PCIE_1		0x1512	Family14h PCIe
 product AMD F14_PCIE_2		0x1513	Family14h PCIe
@@ -1085,6 +1122,7 @@ product AMD F15_6X_HDA		0x157a	15h/6xh A
 product AMD F15_6X_HB		0x157b	15h/6xh Host Bridge
 product AMD F15_6X_RP		0x157c	15h/6xh Root Port
 product AMD F15_6X_HB_2		0x157d	15h/6xh Host Bridge
+product AMD F19_1X_XHCI		0x157f	19h/1xh USB 3.2
 product AMD F16_30_HT		0x1580	Family16h HyperTransport Configuration
 product AMD F16_30_ADDR		0x1581	

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

2023-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 18 19:26:30 UTC 2023

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

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

sys/dev/pci/sdhc_pci.c: revision 1.20
sys/dev/pci/pcidevs: revision 1.1469
sys/dev/pci/pcidevs: revision 1.1470
sys/dev/pci/pcidevs: revision 1.1471
sys/dev/pci/pcidevs: revision 1.1472
sys/dev/pci/pcidevs: revision 1.1473
sys/dev/pci/pcidevs: revision 1.1474
sys/dev/pci/pcidevs: revision 1.1475
sys/dev/pci/pcidevs: revision 1.1476

Add some AMD 17h/9xh devices from OpenBSD.
Add AMD F17/Axh devices.
Add some Xeon Scalable devices from OpenBSD.
Update Intel Elkhart Lake devices.
Add Elkhart Lake Shared SRAM.
Fix typo. s/SSC/SCC/.
Fix typo. No functional change.
add Aquantia (Marvell) AQC113 ethernet devices and the variants
Add AMD Family 19h/1xh devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.13 -r1.1383.2.14 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.14.16.1 -r1.14.16.2 src/sys/dev/pci/sdhc_pci.c

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



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

2022-10-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 15 10:29:40 UTC 2022

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

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

sys/dev/pci/ichsmb.c1.76-1.77

Add Intel 600 Series PCH support.


To generate a diff of this commit:
cvs rdiff -u -r1.60.4.3 -r1.60.4.4 src/sys/dev/pci/ichsmb.c

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



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

2022-10-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 15 10:29:40 UTC 2022

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

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

sys/dev/pci/ichsmb.c1.76-1.77

Add Intel 600 Series PCH support.


To generate a diff of this commit:
cvs rdiff -u -r1.60.4.3 -r1.60.4.4 src/sys/dev/pci/ichsmb.c

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

Modified files:

Index: src/sys/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.60.4.3 src/sys/dev/pci/ichsmb.c:1.60.4.4
--- src/sys/dev/pci/ichsmb.c:1.60.4.3	Fri Dec  3 17:49:41 2021
+++ src/sys/dev/pci/ichsmb.c	Sat Oct 15 10:29:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.60.4.3 2021/12/03 17:49:41 martin Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.60.4.4 2022/10/15 10:29:40 martin Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.3 2021/12/03 17:49:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.4 2022/10/15 10:29:40 martin Exp $");
 
 #include 
 #include 
@@ -152,6 +152,8 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_495_YU_SMB:
 		case PCI_PRODUCT_INTEL_5HS_H_SMB:
 		case PCI_PRODUCT_INTEL_5HS_LP_SMB:
+		case PCI_PRODUCT_INTEL_6HS_H_SMB:
+		case PCI_PRODUCT_INTEL_6HS_LP_SMB:
 			return 1;
 		}
 	}



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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:51:46 UTC 2022

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

Log Message:
regen (Ticket #1537)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.12 -r1.1371.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.12 -r1.1370.2.13 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:51:46 UTC 2022

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

Log Message:
regen (Ticket #1537)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.12 -r1.1371.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.12 -r1.1370.2.13 src/sys/dev/pci/pcidevs_data.h

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



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

2022-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 29 18:26:42 UTC 2022

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

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

sys/dev/pci/mfii.c: revision 1.28

Convert from pci_intr_map() to pci_intr_alloc(); makes the driver use
MSI/MSI-x when available. Tested by Edgar Fu?.


To generate a diff of this commit:
cvs rdiff -u -r1.4.4.2 -r1.4.4.3 src/sys/dev/pci/mfii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.4.4.2 src/sys/dev/pci/mfii.c:1.4.4.3
--- src/sys/dev/pci/mfii.c:1.4.4.2	Fri Sep 16 18:27:38 2022
+++ src/sys/dev/pci/mfii.c	Thu Sep 29 18:26:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.4.4.2 2022/09/16 18:27:38 martin Exp $ */
+/* $NetBSD: mfii.c,v 1.4.4.3 2022/09/29 18:26:42 martin Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.4.4.2 2022/09/16 18:27:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.4.4.3 2022/09/29 18:26:42 martin Exp $");
 
 #include "bio.h"
 
@@ -655,7 +655,7 @@ mfii_attach(device_t parent, device_t se
 	struct mfii_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
 	pcireg_t memtype;
-	pci_intr_handle_t ih;
+	pci_intr_handle_t *ihp;
 	char intrbuf[PCI_INTRSTR_LEN];
 	const char *intrstr;
 	u_int32_t status, scpad2, scpad3;
@@ -705,12 +705,12 @@ mfii_attach(device_t parent, device_t se
 	/* disable interrupts */
 	mfii_write(sc, MFI_OMSK, 0x);
 
-	if (pci_intr_map(pa, ) != 0) {
+	if (pci_intr_alloc(pa, , NULL, 0)) {
 		aprint_error(": unable to map interrupt\n");
 		goto pci_unmap;
 	}
-	intrstr = pci_intr_string(pa->pa_pc, ih, intrbuf, sizeof(intrbuf));
-	pci_intr_setattr(pa->pa_pc, , PCI_INTR_MPSAFE, true);
+	intrstr = pci_intr_string(pa->pa_pc, ihp[0], intrbuf, sizeof(intrbuf));
+	pci_intr_setattr(pa->pa_pc, [0], PCI_INTR_MPSAFE, true);
 
 	/* lets get started */
 	if (mfii_transition_firmware(sc))
@@ -819,7 +819,7 @@ mfii_attach(device_t parent, device_t se
 	aprint_normal("\n");
 	aprint_naive("\n");
 
-	sc->sc_ih = pci_intr_establish_xname(sc->sc_pc, ih, IPL_BIO,
+	sc->sc_ih = pci_intr_establish_xname(sc->sc_pc, ihp[0], IPL_BIO,
 	mfii_intr, sc, DEVNAME(sc));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "can't establish interrupt");



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

2022-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 29 18:26:42 UTC 2022

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

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

sys/dev/pci/mfii.c: revision 1.28

Convert from pci_intr_map() to pci_intr_alloc(); makes the driver use
MSI/MSI-x when available. Tested by Edgar Fu?.


To generate a diff of this commit:
cvs rdiff -u -r1.4.4.2 -r1.4.4.3 src/sys/dev/pci/mfii.c

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



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

2022-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep  7 10:05:42 UTC 2022

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

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

sys/dev/pci/if_wm.c 1.741-1.749,
1.753-1.757,
1.762 via patch
sys/dev/pci/if_wmreg.h  1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
  wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
  - Turn a locking botch (shouldn't drop lock on error) into a KASSERT
in wm_deferred_start_locked().
  - Remove unneeded header inclusion.
  - Use __BIT() a little.
  - Modify comment and debug messages.
  - Consistency use -1 instead of 1 for some error code.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.13 -r1.645.2.14 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.5 -r1.115.2.6 src/sys/dev/pci/if_wmreg.h

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



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

2022-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep  7 10:05:42 UTC 2022

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

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

sys/dev/pci/if_wm.c 1.741-1.749,
1.753-1.757,
1.762 via patch
sys/dev/pci/if_wmreg.h  1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
  wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
  - Turn a locking botch (shouldn't drop lock on error) into a KASSERT
in wm_deferred_start_locked().
  - Remove unneeded header inclusion.
  - Use __BIT() a little.
  - Modify comment and debug messages.
  - Consistency use -1 instead of 1 for some error code.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.13 -r1.645.2.14 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.5 -r1.115.2.6 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.13 src/sys/dev/pci/if_wm.c:1.645.2.14
--- src/sys/dev/pci/if_wm.c:1.645.2.13	Mon Jul 11 14:10:18 2022
+++ src/sys/dev/pci/if_wm.c	Wed Sep  7 10:05:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.13 2022/07/11 14:10:18 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.14 2022/09/07 10:05:42 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.13 2022/07/11 14:10:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.14 2022/09/07 10:05:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -90,26 +90,25 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.
 #endif
 
 #include 
-#include 
+
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
+#include 
 #include 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 #include 
-#include 
-
-#include 
 
 #include 
 #include 
@@ -497,7 +496,7 @@ struct wm_queue {
 };
 
 struct wm_phyop {
-	int (*acquire)(struct wm_softc *);
+	int (*acquire)(struct wm_softc *) __attribute__((warn_unused_result));
 	void (*release)(struct wm_softc *);
 	int (*readreg_locked)(device_t, int, int, uint16_t *);
 	int (*writereg_locked)(device_t, int, int, uint16_t);
@@ -506,7 +505,7 @@ struct wm_phyop {
 };
 
 struct wm_nvmop {
-	int (*acquire)(struct wm_softc *);
+	int (*acquire)(struct wm_softc *) __attribute__((warn_unused_result));
 	void (*release)(struct wm_softc *);
 	int (*read)(struct wm_softc *, int, int, uint16_t *);
 };
@@ -597,12 +596,76 @@ struct wm_softc {
 	/* Event counters. */
 	struct evcnt sc_ev_linkintr;	/* Link interrupts */
 
-	/* WM_T_82542_2_1 only */
+	/* >= WM_T_82542_2_1 */
 	struct evcnt sc_ev_tx_xoff;	/* Tx PAUSE(!0) frames */
 	struct evcnt sc_ev_tx_xon;	/* Tx PAUSE(0) frames */
 	struct evcnt sc_ev_rx_xoff;	/* Rx PAUSE(!0) frames */
 	struct evcnt sc_ev_rx_xon;	/* Rx PAUSE(0) frames */
 	struct evcnt sc_ev_rx_macctl;	/* Rx Unsupported */
+
+	struct evcnt sc_ev_crcerrs;	/* CRC Error */
+	struct evcnt sc_ev_algnerrc;	/* Alignment Error */
+	struct evcnt sc_ev_symerrc;	/* Symbol Error */
+	struct evcnt sc_ev_rxerrc;	/* Receive Error */
+	struct evcnt sc_ev_mpc;		/* Missed Packets */
+	struct evcnt sc_ev_colc;	/* Collision */
+	struct evcnt sc_ev_sec;		/* Sequence Error */
+	struct evcnt sc_ev_cexterr;	/* Carrier Extension Error */
+	struct evcnt sc_ev_rlec;	/* Receive Length Error */
+	struct evcnt sc_ev_scc;		/* Single Collision */
+	struct evcnt sc_ev_ecol;	/* Excessive Collision */
+	struct evcnt sc_ev_mcc;		/* Multiple Collision */
+	struct evcnt sc_ev_latecol;	/* Late Collision */
+	struct evcnt sc_ev_dc;		/* Defer */
+	struct evcnt sc_ev_gprc;	/* Good Packets Rx */
+	struct evcnt sc_ev_bprc;	/* Broadcast Packets Rx */
+	struct evcnt sc_ev_mprc;	/* Multicast Packets Rx */
+	struct evcnt sc_ev_gptc;	/* Good Packets Tx */
+	struct evcnt sc_ev_gorc;	/* Good Octets Rx */
+	struct evcnt sc_ev_gotc;	/* Good Octets Tx */
+	struct evcnt sc_ev_rnbc;	/* Rx No Buffers */
+	struct evcnt sc_ev_ruc;		/* Rx Undersize */
+	struct evcnt sc_ev_rfc;		/* Rx Fragment */
+	struct evcnt sc_ev_roc;		/* Rx Oversize */
+	struct evcnt sc_ev_rjc;		/* Rx Jabber */
+	struct evcnt sc_ev_tor;		/* Total Octets Rx */
+	struct evcnt sc_ev_tot;		/* Total Octets Tx */
+	struct evcnt sc_ev_tpr;		/* Total Packets Rx */
+	struct evcnt sc_ev_tpt;		/* Total Packets Tx */
+	struct evcnt sc_ev_mptc;	/* Multicast Packets Tx */
+	struct evcnt sc_ev_bptc;	/* 

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

2022-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 27 14:41:43 UTC 2022

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

Log Message:
regen for ticket #1482


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.11 -r1.1371.2.12 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.11 -r1.1370.2.12 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2022-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 27 14:41:43 UTC 2022

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

Log Message:
regen for ticket #1482


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.11 -r1.1371.2.12 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.11 -r1.1370.2.12 src/sys/dev/pci/pcidevs_data.h

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



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

2022-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 11 14:10:18 UTC 2022

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

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

sys/dev/pci/if_wmreg.h  1.122-1.125
sys/dev/pci/if_wmvar.h  1.48
sys/dev/pci/if_wm.c 1.719-1.720,
1.722-1.725,
1.727-1.740 via patch

- wm_tick: Add missing splx(s) when not WM_MPSAFE.
- Print DMA range info if the system is booting in the verbose mode.
- Micro optimization:
  - Call m_freem(m) only if m0 == NULL.
  - Call wm_xxeof() only when limit > 0.
  - Don't set the more flag when there is no packet to process.
- No functional changes:
  - Call txeof first, then rxeof for the consistency.
  - Remove duplicated break.
  - Remove stray semicolons from struct declaration.
  - Fix value return from void function.
  - Use macros.
  - Modify comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.12 -r1.645.2.13 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.4 -r1.115.2.5 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.44.4.3 -r1.44.4.4 src/sys/dev/pci/if_wmvar.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.12 src/sys/dev/pci/if_wm.c:1.645.2.13
--- src/sys/dev/pci/if_wm.c:1.645.2.12	Sat Nov 20 14:59:04 2021
+++ src/sys/dev/pci/if_wm.c	Mon Jul 11 14:10:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.12 2021/11/20 14:59:04 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.13 2022/07/11 14:10:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -39,21 +39,21 @@
 
   Copyright (c) 2001-2005, Intel Corporation
   All rights reserved.
- 
+
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:
- 
+
1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.
- 
+
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
- 
+
3. Neither the name of the Intel Corporation nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.
- 
+
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.12 2021/11/20 14:59:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.13 2022/07/11 14:10:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -321,9 +321,9 @@ struct wm_softc;
 #endif
 
 #ifdef WM_EVENT_COUNTERS
-#define WM_Q_EVCNT_DEFINE(qname, evname)\
+#define WM_Q_EVCNT_DEFINE(qname, evname) \
 	char qname##_##evname##_evcnt_name[sizeof("qname##XX##evname")]; \
-	struct evcnt qname##_ev_##evname;
+	struct evcnt qname##_ev_##evname
 
 #define WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, evtype)	\
 	do {\
@@ -342,7 +342,7 @@ struct wm_softc;
 	WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, EVCNT_TYPE_INTR)
 
 #define WM_Q_EVCNT_DETACH(qname, evname, q, qnum)	\
-	evcnt_detach(&(q)->qname##_ev_##evname);
+	evcnt_detach(&(q)->qname##_ev_##evname)
 #endif /* WM_EVENT_COUNTERS */
 
 struct wm_txqueue {
@@ -409,27 +409,27 @@ struct wm_txqueue {
 	uint32_t txq_bytes;		/* for AIM */
 #ifdef WM_EVENT_COUNTERS
 	/* TX event counters */
-	WM_Q_EVCNT_DEFINE(txq, txsstall)/* Stalled due to no txs */
-	WM_Q_EVCNT_DEFINE(txq, txdstall)/* Stalled due to no txd */
-	WM_Q_EVCNT_DEFINE(txq, fifo_stall)  /* FIFO stalls (82547) */
-	WM_Q_EVCNT_DEFINE(txq, txdw)	/* Tx descriptor interrupts */
-	WM_Q_EVCNT_DEFINE(txq, txqe)	/* Tx queue empty interrupts */
+	WM_Q_EVCNT_DEFINE(txq, txsstall);   /* Stalled due to no txs */
+	WM_Q_EVCNT_DEFINE(txq, txdstall);   /* Stalled due to no txd */
+	WM_Q_EVCNT_DEFINE(txq, fifo_stall); /* FIFO stalls (82547) */
+	WM_Q_EVCNT_DEFINE(txq, txdw);	/* Tx descriptor interrupts */
+	WM_Q_EVCNT_DEFINE(txq, txqe);	/* Tx queue empty interrupts */
 	/* XXX not used? */
 
-	WM_Q_EVCNT_DEFINE(txq, ipsum)	/* IP checksums comp. */
-	WM_Q_EVCNT_DEFINE(txq, tusum)	/* TCP/UDP cksums comp. */
-	WM_Q_EVCNT_DEFINE(txq, tusum6)	/* TCP/UDP v6 cksums comp. */
-	

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

2022-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 11 14:10:18 UTC 2022

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

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

sys/dev/pci/if_wmreg.h  1.122-1.125
sys/dev/pci/if_wmvar.h  1.48
sys/dev/pci/if_wm.c 1.719-1.720,
1.722-1.725,
1.727-1.740 via patch

- wm_tick: Add missing splx(s) when not WM_MPSAFE.
- Print DMA range info if the system is booting in the verbose mode.
- Micro optimization:
  - Call m_freem(m) only if m0 == NULL.
  - Call wm_xxeof() only when limit > 0.
  - Don't set the more flag when there is no packet to process.
- No functional changes:
  - Call txeof first, then rxeof for the consistency.
  - Remove duplicated break.
  - Remove stray semicolons from struct declaration.
  - Fix value return from void function.
  - Use macros.
  - Modify comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.12 -r1.645.2.13 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.4 -r1.115.2.5 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.44.4.3 -r1.44.4.4 src/sys/dev/pci/if_wmvar.h

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



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

2022-06-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun  3 04:00:49 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1460):
sys/dev/pci/ixgbe/ixgbe.c: patch
Fix previous to re-enable legacy interrupt correctly. It's a part of
ixgbe.c rev. 1.273.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.23 -r1.199.2.24 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.199.2.23 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.24
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.23	Thu Jun  2 10:45:12 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Jun  3 04:00:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.23 2022/06/02 10:45:12 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.24 2022/06/03 04:00:49 snj Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.23 2022/06/02 10:45:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.24 2022/06/03 04:00:49 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -6542,7 +6542,7 @@ ixgbe_handle_que(void *context)
 		ixgbe_enable_queue(adapter, que->msix);
 	} else {
 		/* INTx or MSI */
-		ixgbe_enable_intr(adapter);
+		ixgbe_enable_queue(adapter, 0);
 	}
 
 	return;



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

2022-06-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun  3 04:00:49 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1460):
sys/dev/pci/ixgbe/ixgbe.c: patch
Fix previous to re-enable legacy interrupt correctly. It's a part of
ixgbe.c rev. 1.273.


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

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



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

2022-06-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun  2 10:45:12 UTC 2022

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

Log Message:
Pull up the following revisions, all via patch, requested by msaitoh
in ticket #1459:

sys/dev/pci/ixgbe/ixgbe.c   1.261,1.265-1.268,1.273,1.275-1.277,
1.312,1.316-1.319 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.85 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
sys/dev/pci/ixgbe/ixv.c 1.182

- Reduce code duplication between ixgbe_msix_admin() and
  ixgbe_legacy_irq().
  - Add missing code which was not in ixgbe_msix_admin() from
ixgbe_legacy_irq() and vice versa.
  - Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
  director reinit failed. NetBSD currently doesn't support flow
  director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
  - Add some debug printf()s.
  - Don't use "more" flag for simplify.
  - Fix typos in comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.22 -r1.199.2.23 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.8 -r1.56.2.9 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.41.2.6 -r1.41.2.7 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.15.2.5 -r1.15.2.6 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.125.2.19 -r1.125.2.20 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.199.2.22 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.23
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.22	Tue May 31 14:03:26 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Jun  2 10:45:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.22 2022/05/31 14:03:26 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.23 2022/06/02 10:45:12 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.22 2022/05/31 14:03:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.23 2022/06/02 10:45:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -262,12 +262,11 @@ static int	ixgbe_sysctl_wufc(SYSCTLFN_PR
 /* Support for pluggable optic modules */
 static bool	ixgbe_sfp_probe(struct adapter *);
 
-/* Legacy (single vector) interrupt handler */
-static int	ixgbe_legacy_irq(void *);
-
-/* The MSI/MSI-X Interrupt handlers */
+/* Interrupt functions */
 static int	ixgbe_msix_que(void *);
-static int	ixgbe_msix_link(void *);
+static int	ixgbe_msix_admin(void *);
+static void	ixgbe_intr_admin_common(struct adapter *, u32, u32 *);
+static int	ixgbe_legacy_irq(void *);
 
 /* Software interrupts for deferred work */
 static void	ixgbe_handle_que(void *);
@@ -422,6 +421,9 @@ static int (*ixgbe_ring_empty)(struct if
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
 
+/* Interval between reports of errors */
+static const struct timeval ixgbe_errlog_intrvl = { 60, 0 };	/* 60s */
+
 /
  * ixgbe_initialize_rss_mapping
  /
@@ -624,12 +626,11 @@ ixgbe_initialize_receive_units(struct ad
 		 * so we do not need to clear the bit, but do it just in case
 		 * this code is moved elsewhere.
 		 */
-		if (adapter->num_queues > 1 &&
-		adapter->hw.fc.requested_mode == ixgbe_fc_none) {
+		if ((adapter->num_queues > 1) &&
+		(adapter->hw.fc.requested_mode == ixgbe_fc_none))
 			srrctl |= IXGBE_SRRCTL_DROP_EN;
-		} else {
+		else
 			srrctl &= ~IXGBE_SRRCTL_DROP_EN;
-		}
 
 		IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(j), srrctl);
 
@@ -847,7 +848,8 @@ ixgbe_attach(device_t parent, device_t d
 	 * Initialize the shared code
 	 */
 	if (ixgbe_init_shared_code(hw) != 0) {
-		aprint_error_dev(dev, "Unable to initialize the shared code\n");
+		aprint_error_dev(dev,
+		"Unable to initialize the shared code\n");
 		error = ENXIO;
 		goto err_out;
 	}
@@ -1153,7 +1155,8 @@ ixgbe_attach(device_t parent, device_t d
 	error = ixgbe_start_hw(hw);
 	switch (error) {
 	case IXGBE_ERR_EEPROM_VERSION:
-		aprint_error_dev(dev, "This device is a pre-production adapter/"
+		aprint_error_dev(dev,
+		"This device is a pre-production adapter/"
 		"LOM.  Please be aware there may be issues associated "
 		"with your hardware.\nIf you are experiencing problems "
 		"please contact your Intel or hardware representative "
@@ -1439,60 +1442,45 @@ ixgbe_add_media_types(struct 

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

2022-06-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun  2 10:45:12 UTC 2022

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

Log Message:
Pull up the following revisions, all via patch, requested by msaitoh
in ticket #1459:

sys/dev/pci/ixgbe/ixgbe.c   1.261,1.265-1.268,1.273,1.275-1.277,
1.312,1.316-1.319 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.85 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
sys/dev/pci/ixgbe/ixv.c 1.182

- Reduce code duplication between ixgbe_msix_admin() and
  ixgbe_legacy_irq().
  - Add missing code which was not in ixgbe_msix_admin() from
ixgbe_legacy_irq() and vice versa.
  - Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
  director reinit failed. NetBSD currently doesn't support flow
  director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
  - Add some debug printf()s.
  - Don't use "more" flag for simplify.
  - Fix typos in comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.22 -r1.199.2.23 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.8 -r1.56.2.9 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.41.2.6 -r1.41.2.7 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.15.2.5 -r1.15.2.6 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.125.2.19 -r1.125.2.20 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 31 14:03:27 UTC 2022

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.181
sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.21 -r1.199.2.22 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.7 -r1.56.2.8 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.125.2.18 -r1.125.2.19 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.199.2.21 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.22
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.21	Mon May 30 17:01:06 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue May 31 14:03:26 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.21 2022/05/30 17:01:06 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.22 2022/05/31 14:03:26 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.21 2022/05/30 17:01:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.22 2022/05/31 14:03:26 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1096,7 +1096,6 @@ ixgbe_attach(device_t parent, device_t d
 			ixgbe_free_queues(adapter);
 
 			/* Fallback to legacy interrupt */
-			adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
 			if (adapter->feat_cap & IXGBE_FEATURE_MSI)
 adapter->feat_en |= IXGBE_FEATURE_MSI;
 			adapter->num_queues = 1;
@@ -5054,7 +5053,7 @@ ixgbe_enable_intr(struct adapter *adapte
 	IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask);
 
 	/* With MSI-X we use auto clear */
-	if (adapter->msix_mem) {
+	if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0) {
 		/*
 		 * We use auto clear for RTX_QUEUE only. Don't use other
 		 * interrupts (e.g. link interrupt). BTW, we don't use
@@ -5086,7 +5085,7 @@ ixgbe_disable_intr_internal(struct adapt
 	/* disable interrupts other than queues */
 	IXGBE_WRITE_REG(>hw, IXGBE_EIMC, ~IXGBE_EIMC_RTX_QUEUE);
 
-	if (adapter->msix_mem)
+	if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0)
 		IXGBE_WRITE_REG(>hw, IXGBE_EIAC, 0);
 
 	for (int i = 0; i < adapter->num_queues; i++, que++)
@@ -6743,6 +6742,7 @@ ixgbe_allocate_msix(struct adapter *adap
 	adapter->osdep.nintrs) != 0) {
 		aprint_error_dev(dev,
 		"failed to allocate MSI-X interrupt\n");
+		adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
 		return (ENXIO);
 	}
 
@@ -6942,7 +6942,7 @@ ixgbe_configure_interrupts(struct adapte
 	if (msgs < 2)
 		goto msi;
 
-	adapter->msix_mem = (void *)1; /* XXX */
+	adapter->feat_en |= IXGBE_FEATURE_MSIX;
 
 	/* Figure out a reasonable auto config value */
 	queues = (ncpu > (msgs - 1)) ? (msgs - 1) : ncpu;
@@ -6996,7 +6996,7 @@ msi:
 	adapter->feat_en  &= ~IXGBE_FEATURE_SRIOV;
 
 	msgs = pci_msi_count(adapter->osdep.pc, adapter->osdep.tag);
-	adapter->msix_mem = NULL; /* XXX */
+	adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
 	if (msgs > 1)
 		msgs = 1;
 	if (msgs != 0) {

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.7 src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.8
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.7	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue May 31 14:03:27 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.56.2.7 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.56.2.8 2022/05/31 14:03:27 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -479,7 +479,6 @@ struct adapter {
 	struct if_percpuq	*ipq;	/* softint-based input queues */
 
 	struct resource		*pci_mem;
-	struct resource		*msix_mem;
 
 	/* NetBSD: Interrupt resources are in osdep */
 

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.18 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.19
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.18	Mon May 30 17:01:06 2022
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue May 31 14:03:26 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.125.2.18 2022/05/30 17:01:06 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.125.2.19 2022/05/31 14:03:26 martin 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.125.2.18 2022/05/30 17:01:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.125.2.19 2022/05/31 14:03:26 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3487,7 +3487,6 

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

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 31 14:03:27 UTC 2022

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.181
sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.21 -r1.199.2.22 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.7 -r1.56.2.8 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.125.2.18 -r1.125.2.19 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 30 17:01:06 UTC 2022

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

Log Message:
Pull up the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c   1.270,1.280,1.307-1.311,
1.313-1.314 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97
sys/dev/pci/ixgbe/ixv.c 1.158,1.179-1.180 via patch

- ixg(4): Print Printed Board Assembly (PBA) number.
- ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might
  fix small race but it's not so dangerous.
- Add value check for {tx,rx}_process_limit sysctl to avoid setting
  wrong value.
- Add missing num_tx_desc sysctl.
- No functional change:
  - KNF a bit.
  - Simplify setting of EIAC register.
  - Move the definition of eicr_mask variable.
  - Enclose flow director stuff in ixgbe_intr_admin_common() with
IXGBE_FIR which is not defined in NetBSD.
  - Modify comment for consistency.
  - Use cached rx_copy_len in ixgbe_rxeof().


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.9 -r1.54.2.10 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.20 -r1.199.2.21 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.17 -r1.125.2.18 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.9 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.10
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.9	Fri May 13 11:18:40 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon May 30 17:01:06 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.9 2022/05/13 11:18:40 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.10 2022/05/30 17:01:06 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.9 2022/05/13 11:18:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.10 2022/05/30 17:01:06 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1819,6 +1819,7 @@ ixgbe_rxeof(struct ix_queue *que)
 	u32			staterr = 0;
 	u32			loopcount = 0, numdesc;
 	u32			limit = adapter->rx_process_limit;
+	u32			rx_copy_len = adapter->rx_copy_len;
 	bool			discard_multidesc = rxr->discard_multidesc;
 	bool			wraparound = false;
 	unsigned int		syncremain;
@@ -1929,7 +1930,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			/* Pre-alloc new mbuf. */
 
 			if ((rbuf->fmp == NULL) &&
-			eop && (len <= adapter->rx_copy_len)) {
+			eop && (len <= rx_copy_len)) {
 /* For short packet. See below. */
 sendmp = m_gethdr(M_NOWAIT, MT_DATA);
 if (__predict_false(sendmp == NULL)) {
@@ -2035,7 +2036,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			 * packet.
 			 */
 
-			if (eop && (len <= adapter->rx_copy_len)) {
+			if (eop && (len <= rx_copy_len)) {
 /*
  * Optimize.  This might be a small packet, may
  * be just a TCP ACK. Copy into a new mbuf, and
@@ -2047,7 +2048,7 @@ ixgbe_rxeof(struct ix_queue *que)
 IXGBE_EVC_ADD(>rx_copies, 1);
 rbuf->flags |= IXGBE_RX_COPY;
 			} else {
-/* Non short packet */
+/* For long packet */
 
 /* Update new (used in future) mbuf */
 newmp->m_pkthdr.len = newmp->m_len

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.20 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.21
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.20	Wed Feb  2 14:25:49 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon May 30 17:01:06 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.20 2022/02/02 14:25:49 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.21 2022/05/30 17:01:06 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.20 2022/02/02 14:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.21 2022/05/30 17:01:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -235,8 +235,6 @@ static int	ixgbe_set_advertise(struct ad
 static int	ixgbe_get_default_advertise(struct adapter *);
 
 /* Sysctl handlers */
-static void	ixgbe_set_sysctl_value(struct adapter *, const char *,
-		 const char *, int *, int);
 static int	ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_advertise(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
@@ -256,6 +254,8 @@ static int	ixgbe_sysctl_tdh_handler(SYSC
 static int	ixgbe_sysctl_eee_state(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_debug(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_tx_process_limit(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_rx_process_limit(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO);
 static int	

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

2022-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 30 17:01:06 UTC 2022

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

Log Message:
Pull up the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c   1.270,1.280,1.307-1.311,
1.313-1.314 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97
sys/dev/pci/ixgbe/ixv.c 1.158,1.179-1.180 via patch

- ixg(4): Print Printed Board Assembly (PBA) number.
- ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might
  fix small race but it's not so dangerous.
- Add value check for {tx,rx}_process_limit sysctl to avoid setting
  wrong value.
- Add missing num_tx_desc sysctl.
- No functional change:
  - KNF a bit.
  - Simplify setting of EIAC register.
  - Move the definition of eicr_mask variable.
  - Enclose flow director stuff in ixgbe_intr_admin_common() with
IXGBE_FIR which is not defined in NetBSD.
  - Modify comment for consistency.
  - Use cached rx_copy_len in ixgbe_rxeof().


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.9 -r1.54.2.10 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.20 -r1.199.2.21 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.17 -r1.125.2.18 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-05-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 19 16:24:20 UTC 2022

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

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

sys/dev/pci/if_bge.c: revision 1.353

For chips which contain an ASF/IPMI firmware, instruct the chip to shut
the host ASF firmware down when attaching the device so the IPMI BMC
can use the same physical port even when NetBSD doesn't have a
network configuration on the device.
By contrast, when the device gets a network configuration assigned to
it and bge_init() is called, the host ASF firmware is brought up so
both NetBSD and the IPMI BMc can use the same physical port.

This now matches FreeBSD behavior, as well as  behavior from NetBSD-5.2.

Tested on a Sunfire X2200-M2 system with the following chip:

bge1 at pci7 dev 4 function 1: Broadcom BCM5715 Gigabit Ethernet
bge1: interrupting at ioapic0 pin 11
bge1: HW config 00d4, 0014, ,  
bge1: ASIC BCM5715 A3 (0x9003), Ethernet address 00:1e:68:XX:XX:XX
bge1: setting short Tx thresholds
brgphy1 at bge1 phy 1: BCM5714 1000BASE-T/X media interface, rev. 0
brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.335.2.1 -r1.335.2.2 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.335.2.1 src/sys/dev/pci/if_bge.c:1.335.2.2
--- src/sys/dev/pci/if_bge.c:1.335.2.1	Wed Nov 27 11:08:24 2019
+++ src/sys/dev/pci/if_bge.c	Thu May 19 16:24:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.335.2.1 2019/11/27 11:08:24 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.335.2.2 2022/05/19 16:24:20 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.335.2.1 2019/11/27 11:08:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.335.2.2 2022/05/19 16:24:20 martin Exp $");
 
 #include 
 #include 
@@ -3646,7 +3646,7 @@ bge_attach(device_t parent, device_t sel
 	BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
 
 	bge_stop_fw(sc);
-	bge_sig_pre_reset(sc, BGE_RESET_START);
+	bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN);
 	if (bge_reset(sc))
 		aprint_error_dev(sc->bge_dev, "chip reset failed\n");
 
@@ -3680,8 +3680,8 @@ bge_attach(device_t parent, device_t sel
 	"HW config %08x, %08x, %08x, %08x %08x\n",
 	hwcfg, hwcfg2, hwcfg3, hwcfg4, hwcfg5);
 
-	bge_sig_legacy(sc, BGE_RESET_START);
-	bge_sig_post_reset(sc, BGE_RESET_START);
+	bge_sig_legacy(sc, BGE_RESET_SHUTDOWN);
+	bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN);
 
 	if (bge_chipinit(sc)) {
 		aprint_error_dev(sc->bge_dev, "chip initialization failed\n");



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

2022-05-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 19 16:24:20 UTC 2022

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

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

sys/dev/pci/if_bge.c: revision 1.353

For chips which contain an ASF/IPMI firmware, instruct the chip to shut
the host ASF firmware down when attaching the device so the IPMI BMC
can use the same physical port even when NetBSD doesn't have a
network configuration on the device.
By contrast, when the device gets a network configuration assigned to
it and bge_init() is called, the host ASF firmware is brought up so
both NetBSD and the IPMI BMc can use the same physical port.

This now matches FreeBSD behavior, as well as  behavior from NetBSD-5.2.

Tested on a Sunfire X2200-M2 system with the following chip:

bge1 at pci7 dev 4 function 1: Broadcom BCM5715 Gigabit Ethernet
bge1: interrupting at ioapic0 pin 11
bge1: HW config 00d4, 0014, ,  
bge1: ASIC BCM5715 A3 (0x9003), Ethernet address 00:1e:68:XX:XX:XX
bge1: setting short Tx thresholds
brgphy1 at bge1 phy 1: BCM5714 1000BASE-T/X media interface, rev. 0
brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.335.2.1 -r1.335.2.2 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: [netbsd-9] src/sys/dev/pci/ixgbe

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:18:40 UTC 2022

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

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98

bus_dmamem_unmap() before bus_dmamem_free(), otherwise we may give back meomry
which is still (and will stay) mapped.

Fixes one instance of "panic: HYPERVISOR_mmu_update failed" on Xen.
There may be others.


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.8 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.9
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.8	Wed Feb  2 14:25:49 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri May 13 11:18:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.8 2022/02/02 14:25:49 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.9 2022/05/13 11:18:40 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.8 2022/02/02 14:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.9 2022/05/13 11:18:40 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -2321,6 +2321,7 @@ ixgbe_dma_free(struct adapter *adapter, 
 	bus_dmamap_sync(dma->dma_tag->dt_dmat, dma->dma_map, 0, dma->dma_size,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	ixgbe_dmamap_unload(dma->dma_tag, dma->dma_map);
+	bus_dmamem_unmap(dma->dma_tag->dt_dmat, dma->dma_vaddr, dma->dma_size);
 	bus_dmamem_free(dma->dma_tag->dt_dmat, >dma_seg, 1);
 	ixgbe_dma_tag_destroy(dma->dma_tag);
 } /* ixgbe_dma_free */



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:18:40 UTC 2022

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

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98

bus_dmamem_unmap() before bus_dmamem_free(), otherwise we may give back meomry
which is still (and will stay) mapped.

Fixes one instance of "panic: HYPERVISOR_mmu_update failed" on Xen.
There may be others.


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

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



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

2022-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  2 14:25:49 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe_mbx.c
ixgbe_netbsd.h ixv.c

Log Message:
Pull up the following revisions (requested by msaitoh in ticket #1424):

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c   1.305 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.19
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.15-1.16
sys/dev/pci/ixgbe/ixv.c 1.178 via patch

Use atomic_{load,store}_relaxed() for event counters.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.7 -r1.54.2.8 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.19 -r1.199.2.20 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.11.2.3 -r1.11.2.4 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.11.4.2 -r1.11.4.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.125.2.16 -r1.125.2.17 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.7 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.8
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.7	Sat Nov 20 15:16:53 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Feb  2 14:25:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.7 2021/11/20 15:16:53 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.8 2022/02/02 14:25:49 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.7 2021/11/20 15:16:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.8 2022/02/02 14:25:49 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -247,7 +247,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 
 	if (__predict_false(!pcq_put(txr->txr_interq, m))) {
 		m_freem(m);
-		txr->pcq_drops.ev_count++;
+		IXGBE_EVC_ADD(>pcq_drops, 1);
 		return ENOBUFS;
 	}
 	if (IXGBE_TX_TRYLOCK(txr)) {
@@ -475,7 +475,7 @@ retry:
 	/* Make certain there are enough descriptors */
 	if (txr->tx_avail < (map->dm_nsegs + 2)) {
 		txr->txr_no_space = true;
-		txr->no_desc_avail.ev_count++;
+		IXGBE_EVC_ADD(>no_desc_avail, 1);
 		ixgbe_dmamap_unload(txr->txtag, txbuf->map);
 		return EAGAIN;
 	}
@@ -546,7 +546,7 @@ retry:
 	 * Advance the Transmit Descriptor Tail (Tdt), this tells the
 	 * hardware that this frame is available to transmit.
 	 */
-	++txr->total_packets.ev_count;
+	IXGBE_EVC_ADD(>total_packets, 1);
 	IXGBE_WRITE_REG(>hw, txr->tail, i);
 
 	/*
@@ -583,7 +583,7 @@ ixgbe_drain(struct ifnet *ifp, struct tx
 
 	while ((m = pcq_get(txr->txr_interq)) != NULL) {
 		m_freem(m);
-		txr->pcq_drops.ev_count++;
+		IXGBE_EVC_ADD(>pcq_drops, 1);
 	}
 }
 
@@ -846,7 +846,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 		int rv = ixgbe_tso_setup(txr, mp, cmd_type_len, olinfo_status);
 
 		if (rv != 0)
-			++adapter->tso_err.ev_count;
+			IXGBE_EVC_ADD(>tso_err, 1);
 		return rv;
 	}
 
@@ -1088,7 +1088,7 @@ ixgbe_tso_setup(struct tx_ring *txr, str
 	*cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE;
 	*olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8;
 	*olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT;
-	++txr->tso_tx.ev_count;
+	IXGBE_EVC_ADD(>tso_tx, 1);
 
 	return (0);
 } /* ixgbe_tso_setup */
@@ -1360,7 +1360,7 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 		if (__predict_false(rxbuf->buf == NULL)) {
 			mp = ixgbe_getcl();
 			if (mp == NULL) {
-rxr->no_mbuf.ev_count++;
+IXGBE_EVC_ADD(>no_mbuf, 1);
 goto update;
 			}
 			mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz;
@@ -1549,7 +1549,7 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		rxbuf->flags = 0;
 		rxbuf->buf = ixgbe_getcl();
 		if (rxbuf->buf == NULL) {
-			rxr->no_mbuf.ev_count++;
+			IXGBE_EVC_ADD(>no_mbuf, 1);
 			error = ENOBUFS;
 			goto fail;
 		}
@@ -1582,11 +1582,11 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	rxr->next_to_refresh = adapter->num_rx_desc - 1; /* Fully allocated */
 	rxr->lro_enabled = FALSE;
 	rxr->discard_multidesc = false;
-	rxr->rx_copies.ev_count = 0;
+	IXGBE_EVC_STORE(>rx_copies, 0);
 #if 0 /* NetBSD */
-	rxr->rx_bytes.ev_count = 0;
+	IXGBE_EVC_STORE(>rx_bytes, 0);
 #if 1	/* Fix inconsistency */
-	rxr->rx_packets.ev_count = 0;
+	IXGBE_EVC_STORE(>rx_packets, 0);
 #endif
 #endif
 	rxr->vtag_strip = FALSE;
@@ -1917,7 +1917,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			if (adapter->feat_en & IXGBE_FEATURE_VF)
 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 #endif
-			rxr->rx_discarded.ev_count++;
+			IXGBE_EVC_ADD(>rx_discarded, 1);
 			ixgbe_rx_discard(rxr, i);
 			discard_multidesc = false;
 			goto next_desc;
@@ -1933,14 +1933,14 @@ ixgbe_rxeof(struct ix_queue *que)
 /* For short packet. See below. */
 sendmp = m_gethdr(M_NOWAIT, MT_DATA);
 if 

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

2022-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  2 14:25:49 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe_mbx.c
ixgbe_netbsd.h ixv.c

Log Message:
Pull up the following revisions (requested by msaitoh in ticket #1424):

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c   1.305 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.19
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.15-1.16
sys/dev/pci/ixgbe/ixv.c 1.178 via patch

Use atomic_{load,store}_relaxed() for event counters.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.7 -r1.54.2.8 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.19 -r1.199.2.20 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.11.2.3 -r1.11.2.4 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.11.4.2 -r1.11.4.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.125.2.16 -r1.125.2.17 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  1 11:35:46 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   1.264,1.269,1.272,
1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
  interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
  IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.18 -r1.199.2.19 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.199.2.18 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.19
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.18	Mon Jan 31 17:36:25 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb  1 11:35:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.18 2022/01/31 17:36:25 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.19 2022/02/01 11:35:45 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.18 2022/01/31 17:36:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.19 2022/02/01 11:35:45 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5115,28 +5115,34 @@ ixgbe_legacy_irq(void *arg)
 	struct ix_queue *que = arg;
 	struct adapter	*adapter = que->adapter;
 	struct ixgbe_hw	*hw = >hw;
-	struct ifnet	*ifp = adapter->ifp;
 	struct		tx_ring *txr = adapter->tx_rings;
 	bool		more = false;
 	u32		eicr, eicr_mask;
+	u32		eims_orig;
 
-	/* Silicon errata #26 on 82598 */
+	eims_orig = IXGBE_READ_REG(hw, IXGBE_EIMS);
+	/*
+	 * Silicon errata #26 on 82598. Disable all interrupts before reading
+	 * EICR.
+	 */
 	IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK);
 
 	eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
 
-	adapter->stats.pf.legint.ev_count++;
-	++que->irqs.ev_count;
 	if (eicr == 0) {
 		adapter->stats.pf.intzero.ev_count++;
-		if ((ifp->if_flags & IFF_UP) != 0)
-			ixgbe_enable_intr(adapter);
+		IXGBE_WRITE_REG(hw, IXGBE_EIMS, eims_orig);
 		return 0;
 	}
+	adapter->stats.pf.legint.ev_count++;
+
+	/* Queue (0) intr */
+	if ((eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {
+		++que->irqs.ev_count;
 
-	if ((ifp->if_flags & IFF_RUNNING) != 0) {
 		/*
-		 * The same as ixgbe_msix_que() about "que->txrx_use_workqueue".
+		 * The same as ixgbe_msix_que() about
+		 * "que->txrx_use_workqueue".
 		 */
 		que->txrx_use_workqueue = adapter->txrx_use_workqueue;
 



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

2022-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  1 11:35:46 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   1.264,1.269,1.272,
1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
  interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
  IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.


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

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



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:36:25 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.199.2.17 -r1.199.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.21.4.3 -r1.21.4.4 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.11.2.2 -r1.11.2.3 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.41.2.5 -r1.41.2.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.18.2.5 -r1.18.2.6 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.16.8.3 -r1.16.8.4 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.125.2.15 -r1.125.2.16 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/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.6.2.2 src/sys/dev/pci/ixgbe/if_sriov.c:1.6.2.3
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.6.2.2	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Mon Jan 31 17:36:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.6.2.2 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: if_sriov.c,v 1.6.2.3 2022/01/31 17:36:25 martin Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -34,7 +34,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.6.2.2 2022/01/30 15:58:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.6.2.3 2022/01/31 17:36:25 martin Exp $");
 
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
@@ -99,7 +99,7 @@ ixgbe_send_vf_msg(struct ixgbe_hw *hw, s
 	if (vf->flags & IXGBE_VF_CTS)
 		msg |= IXGBE_VT_MSGTYPE_CTS;
 
-	hw->mbx.ops.write(hw, , 1, vf->pool);
+	hw->mbx.ops[vf->pool].write(hw, , 1, vf->pool);
 }
 
 static inline void
@@ -594,7 +594,8 @@ ixgbe_process_vf_msg(struct adapter *ada
 
 	hw = >hw;
 
-	error = hw->mbx.ops.read(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
+	error = hw->mbx.ops[vf->pool].read(hw, msg, IXGBE_VFMAILBOX_SIZE,
+	vf->pool);
 
 	if (error != 0)
 		return;
@@ -654,16 +655,17 @@ ixgbe_handle_mbx(void *context)
 	for (i = 0; i < adapter->num_vfs; i++) {
 		vf = >vfs[i];
 
-		if (vf->flags & IXGBE_VF_ACTIVE) {
-			if (hw->mbx.ops.check_for_rst(hw, vf->pool) == 0)
-ixgbe_process_vf_reset(adapter, vf);
-
-			if (hw->mbx.ops.check_for_msg(hw, vf->pool) == 0)
-ixgbe_process_vf_msg(adapter, vf);
-
-			if (hw->mbx.ops.check_for_ack(hw, vf->pool) == 0)
-ixgbe_process_vf_ack(adapter, vf);
-		}
+		if ((vf->flags & IXGBE_VF_ACTIVE) == 0)
+			continue;
+
+		if (hw->mbx.ops[vf->pool].check_for_rst(hw, vf->pool) == 0)
+			ixgbe_process_vf_reset(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_msg(hw, vf->pool) == 0)
+			ixgbe_process_vf_msg(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0)
+			ixgbe_process_vf_ack(adapter, vf);
 	}
 	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mbx */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.17 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.18
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.17	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 31 17:36:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.17 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.18 2022/01/31 17:36:25 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 

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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:36:25 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.199.2.17 -r1.199.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.21.4.3 -r1.21.4.4 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.11.2.2 -r1.11.2.3 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.41.2.5 -r1.41.2.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.18.2.5 -r1.18.2.6 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.16.8.3 -r1.16.8.4 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.125.2.15 -r1.125.2.16 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 30 15:58:29 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: if_sriov.c ixgbe.c ixgbe.h
ixgbe_82598.c ixgbe_82598.h ixgbe_82599.c ixgbe_82599.h ixgbe_api.c
ixgbe_api.h ixgbe_bypass.h ixgbe_common.c ixgbe_common.h
ixgbe_dcb.c ixgbe_dcb.h ixgbe_dcb_82598.c ixgbe_dcb_82598.h
ixgbe_dcb_82599.c ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h
ixgbe_mbx.c ixgbe_mbx.h ixgbe_netmap.c ixgbe_osdep.c ixgbe_osdep.h
ixgbe_phy.c ixgbe_phy.h ixgbe_rss.h ixgbe_sriov.h ixgbe_type.h
ixgbe_vf.c ixgbe_vf.h ixgbe_x540.c ixgbe_x540.h ixgbe_x550.c
ixgbe_x550.h ixv.c

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

sys/dev/pci/ixgbe/if_sriov.c1.12-1.16
sys/dev/pci/ixgbe/ixgbe.c   1.295-1.297,1.300,1.304 
via patch
sys/dev/pci/ixgbe/ixgbe.h   1.84
sys/dev/pci/ixgbe/ixgbe_82598.c 1.17-1.18
sys/dev/pci/ixgbe/ixgbe_82598.h 1.9
sys/dev/pci/ixgbe/ixgbe_82599.c 1.24-1.28
sys/dev/pci/ixgbe/ixgbe_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_api.c   1.26-1.27
sys/dev/pci/ixgbe/ixgbe_api.h   1.16
sys/dev/pci/ixgbe/ixgbe_bypass.h1.3
sys/dev/pci/ixgbe/ixgbe_common.c1.34-1.42
sys/dev/pci/ixgbe/ixgbe_common.h1.15-1.16
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.12-1.13
sys/dev/pci/ixgbe/ixgbe_dcb.h   1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.10-1.12
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.8
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_fdir.h  1.4
sys/dev/pci/ixgbe/ixgbe_features.h  1.4
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.13-1.15
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.15-1.18
sys/dev/pci/ixgbe/ixgbe_netmap.c1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.8
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.31
sys/dev/pci/ixgbe/ixgbe_phy.c   1.25-1.29
sys/dev/pci/ixgbe/ixgbe_phy.h   1.13
sys/dev/pci/ixgbe/ixgbe_rss.h   1.6
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.5
sys/dev/pci/ixgbe/ixgbe_type.h  1.51-1.54
sys/dev/pci/ixgbe/ixgbe_vf.c1.28-1.29
sys/dev/pci/ixgbe/ixgbe_vf.h1.15
sys/dev/pci/ixgbe/ixgbe_x540.c  1.20-1.22
sys/dev/pci/ixgbe/ixgbe_x540.h  1.10
sys/dev/pci/ixgbe/ixgbe_x550.c  1.21-1.25
sys/dev/pci/ixgbe/ixgbe_x550.h  1.7
sys/dev/pci/ixgbe/ixv.c 1.170, 1.174-1.175 via 
patch

- Add typecast for type mismatch.
- Fix retry count calculation of I2C read/write.
- Wait longer for link after fiber MAC setup.
- ixv(4): Use adapter->mta for the multicast array memory instead of
  the on-stack array.
- Match X550_PHY_ID correctly on X550.
- Print NVM image version on 82598.
- Use 64bit for lxon + lxoff.
- Don't expose garbage data of hw.ixvN.debug.
- Some NetBSD unrelated changes:
  - Fix infinite recursion on PCIe link down if VMDQ is used.
  - Move PF mailbox initialization from ixgbe_attach() to
ixgbe_init_iov().
  - Add IPv6 mask for flow director.
  - Change error level in ixgbe_fc_autoneg().
  - Check host interface return status when writing NVM.
  - Change DCB credit parameters.
- Restore some mailbox related functions. Revert part of ixgbe_mbx.c
  rev. 1.7 and ixgbe_mbx.h rev. 1.11. No functional change.
- Rename IXGBE_VT_MSGTYPE_{ACK,NACK} to
  IXGBE_VT_MSGTYPE_{SUCCESS,FAILURE}. No functional change.
- Remove unused argument. Change argument.
- Remove unnecessary return value check.
- Remove debug error message.
- Remove dead code.
- Add some unused macros.
- Fix typo in comment.
- Rename some functions.
- Sort lines, modify comment.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.199.2.16 -r1.199.2.17 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.6 -r1.56.2.7 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.12.8.4 -r1.12.8.5 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.8 -r1.8.8.1 src/sys/dev/pci/ixgbe/ixgbe_82598.h
cvs rdiff -u -r1.21.4.2 -r1.21.4.3 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.7 -r1.7.8.1 src/sys/dev/pci/ixgbe/ixgbe_82599.h
cvs rdiff -u -r1.23.2.2 -r1.23.2.3 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u 

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:08:33 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-9]: pci_subr.c pcireg.h

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

sys/dev/pci/pci_subr.c  1.232-1.239 via patch
sys/dev/pci/pcireg.h1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.215.2.5 -r1.215.2.6 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.147.4.3 -r1.147.4.4 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.215.2.5 src/sys/dev/pci/pci_subr.c:1.215.2.6
--- src/sys/dev/pci/pci_subr.c:1.215.2.5	Fri Dec  3 19:40:38 2021
+++ src/sys/dev/pci/pci_subr.c	Sat Jan 29 17:08:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.215.2.5 2021/12/03 19:40:38 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.215.2.6 2022/01/29 17:08:33 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.5 2021/12/03 19:40:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.6 2022/01/29 17:08:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1787,6 +1787,45 @@ pci_print_pcie_link_deemphasis(pcireg_t 
 	}
 }
 
+static const struct _pcie_link_preset_preshoot_deemphasis {
+	const char *preshoot;
+	const char *deemphasis;
+} pcie_link_preset_preshoot_deemphasis[] = {
+	{ "0.0",	"-6.0+-1.5" },	/* P0 */
+	{ "0.0",	"-3.5+-1" },	/* P1 */
+	{ "0.0",	"-4.4+-1.5" },	/* P2 */
+	{ "0.0",	"-2.5+-1" },	/* P3 */
+	{ "0.0",	"0.0" },	/* P4 */
+	{ "1.9+-1",	"0.0" },	/* P5 */
+	{ "2.5+-1",	"0.0" },	/* P6 */
+	{ "3.5+-1",	"-6.0+-1.5" },	/* P7 */
+	{ "3.5+-1",	"-3.5+-1" },	/* P8 */
+	{ "3.5+-1",	"0.0" },	/* P9 */
+	{ "0.0",	NULL }		/* P10 */
+};
+
+static void
+pci_print_pcie_link_preset_preshoot_deemphasis(pcireg_t val)
+{
+	const char *deemphasis;
+
+	if (val >= __arraycount(pcie_link_preset_preshoot_deemphasis)) {
+		/*
+		 * This may be printed because the default value of some
+		 * register fields is 0b.
+		 */
+		printf("reserved value (0x%x)", val);
+		return;
+	}
+
+	printf("Preshoot %sdB",
+	pcie_link_preset_preshoot_deemphasis[val].preshoot);
+	deemphasis = pcie_link_preset_preshoot_deemphasis[val].deemphasis;
+
+	if (deemphasis != NULL)
+		printf(", De-emphasis %sdB", deemphasis);
+}
+
 static void
 pci_conf_print_pcie_cap(const pcireg_t *regs, int capoff)
 {
@@ -2320,8 +2359,8 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		(unsigned int)__SHIFTOUT(reg,  PCIE_LCSR2_TX_MARGIN));
 		onoff("Enter Modified Compliance", reg, PCIE_LCSR2_EN_MCOMP);
 		onoff("Compliance SOS", reg, PCIE_LCSR2_COMP_SOS);
-		printf("  Compliance Present/De-emphasis: ");
-		pci_print_pcie_link_deemphasis(
+		printf("  Compliance Preset/De-emphasis: ");
+		pci_print_pcie_link_preset_preshoot_deemphasis(
 			__SHIFTOUT(reg, PCIE_LCSR2_COMP_DEEMP));
 		printf("\n");
 
@@ -3854,7 +3893,7 @@ pci_conf_print_sec_pcie_cap(const pcireg
 		reg = regs[o2i(pcie_capoff + PCIE_LCAP)];
 		maxlinkwidth = __SHIFTOUT(reg, PCIE_LCAP_MAX_WIDTH);
 	} else {
-		printf("error: falied to get PCIe capablity\n");
+		printf("error: failed to get PCIe capability\n");
 		return;
 	}
 	for (i = 0; i < maxlinkwidth; i++) {
@@ -4220,6 +4259,179 @@ pci_conf_print_dlf_cap(const pcireg_t *r
 	onoff("Remote DLF supported Valid", reg, PCI_DLF_STAT_RMTVALID);
 }
 
+static void
+pci_conf_print_pl16g_cap(const pcireg_t *regs, int extcapoff)
+{
+	pcireg_t reg, lwidth;
+	int pcie_capoff;
+	unsigned int i, j;
+
+	printf("\n  Physical Layer 16.0 GT/s\n");
+	reg = regs[o2i(extcapoff + PCI_PL16G_CAP)];
+	printf("Capability register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_CTL)];
+	printf("Control register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_STAT)];
+	printf("Status register: 0x%08x\n", reg);
+	onoff("Equalization 16.0 GT/s Complete", reg, PCI_PL16G_STAT_EQ_COMPL);
+	onoff("Equalization 16.0 GT/s Phase 1 Successful", reg,
+	PCI_PL16G_STAT_EQ_P1S);
+	onoff("Equalization 16.0 GT/s Phase 2 Successful", reg,
+	PCI_PL16G_STAT_EQ_P2S);
+	onoff("Equalization 16.0 GT/s Phase 3 Successful", reg,
+	PCI_PL16G_STAT_EQ_P3S);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_LDPMS)];
+	printf("Local Data Parity Mismatch Status register: 0x%08x\n",
+	reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_FRDPMS)];
+	printf("First Retimer Data Parity Mismatch Status 

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:08:33 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-9]: pci_subr.c pcireg.h

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

sys/dev/pci/pci_subr.c  1.232-1.239 via patch
sys/dev/pci/pcireg.h1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.215.2.5 -r1.215.2.6 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.147.4.3 -r1.147.4.4 src/sys/dev/pci/pcireg.h

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:43:23 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe_vf.h ixv.c

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1408:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.13.8.1 -r1.13.8.2 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.125.2.13 -r1.125.2.14 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_vf.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13.8.1 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13.8.2
--- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13.8.1	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.h	Sat Jan 29 16:43:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.13.8.1 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.13.8.2 2022/01/29 16:43:23 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -101,29 +101,17 @@ struct ixgbevf_hw_stats {
 	struct evcnt l4cs;
 	struct evcnt l4cs_bad;
 
-	u64 base_vfgprc;
-	u64 base_vfgptc;
-	u64 base_vfgorc;
-	u64 base_vfgotc;
-	u64 base_vfmprc;
-
-	u64 last_vfgprc;
-	u64 last_vfgptc;
+	u32 last_vfgprc;
+	u32 last_vfgptc;
 	u64 last_vfgorc;
 	u64 last_vfgotc;
-	u64 last_vfmprc;
+	u32 last_vfmprc;
 
 	struct evcnt vfgprc;
 	struct evcnt vfgptc;
 	struct evcnt vfgorc;
 	struct evcnt vfgotc;
 	struct evcnt vfmprc;
-
-	u64 saved_reset_vfgprc;
-	u64 saved_reset_vfgptc;
-	u64 saved_reset_vfgorc;
-	u64 saved_reset_vfgotc;
-	u64 saved_reset_vfmprc;
 };
 
 s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.13 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.14
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.13	Sat Nov 20 15:16:53 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Sat Jan 29 16:43:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.125.2.13 2021/11/20 15:16:53 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.125.2.14 2022/01/29 16:43:23 martin 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.125.2.13 2021/11/20 15:16:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.125.2.14 2022/01/29 16:43:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@ static int	ixv_register_vlan(struct adap
 static int	ixv_unregister_vlan(struct adapter *, u16);
 
 static void	ixv_add_device_sysctls(struct adapter *);
-static void	ixv_save_stats(struct adapter *);
 static void	ixv_init_stats(struct adapter *);
 static void	ixv_update_stats(struct adapter *);
 static void	ixv_add_stats_sysctls(struct adapter *);
@@ -538,7 +537,6 @@ ixv_attach(device_t parent, device_t dev
 	}
 
 	/* Do the stats setup */
-	ixv_save_stats(adapter);
 	ixv_init_stats(adapter);
 	ixv_add_stats_sysctls(adapter);
 
@@ -2338,34 +2336,11 @@ ixv_configure_ivars(struct adapter *adap
 
 
 /
- * ixv_save_stats
+ * ixv_init_stats
  *
  *   The VF stats registers never have a truly virgin
- *   starting point, so this routine tries to make an
- *   artificial one, marking ground zero on attach as
- *   it were.
- /
-static void
-ixv_save_stats(struct adapter *adapter)
-{
-	struct ixgbevf_hw_stats *stats = >stats.vf;
-
-	if (stats->vfgprc.ev_count || stats->vfgptc.ev_count) {
-		stats->saved_reset_vfgprc +=
-		stats->vfgprc.ev_count - stats->base_vfgprc;
-		stats->saved_reset_vfgptc +=
-		stats->vfgptc.ev_count - stats->base_vfgptc;
-		stats->saved_reset_vfgorc +=
-		stats->vfgorc.ev_count - stats->base_vfgorc;
-		stats->saved_reset_vfgotc +=
-		stats->vfgotc.ev_count - stats->base_vfgotc;
-		stats->saved_reset_vfmprc +=
-		stats->vfmprc.ev_count - stats->base_vfmprc;
-	}
-} /* ixv_save_stats */
-
-/
- * ixv_init_stats
+ *   starting point, so this routine save initial vaules to
+ *   last_.
  /
 static void
 ixv_init_stats(struct adapter *adapter)
@@ -2383,34 +2358,25 @@ ixv_init_stats(struct adapter *adapter)
 	(((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
 
 	adapter->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
-
-	adapter->stats.vf.base_vfgprc = adapter->stats.vf.last_vfgprc;
-	adapter->stats.vf.base_vfgorc = adapter->stats.vf.last_vfgorc;
-	

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:43:23 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe_vf.h ixv.c

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1408:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.13.8.1 -r1.13.8.2 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.125.2.13 -r1.125.2.14 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:33:10 UTC 2022

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

Log Message:
Pullup the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


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

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:33:10 UTC 2022

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

Log Message:
Pullup the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.15 -r1.199.2.16 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.199.2.15 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.16
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.15	Sat Nov 20 15:16:53 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Jan 29 16:33:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.15 2021/11/20 15:16:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.16 2022/01/29 16:33:10 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.15 2021/11/20 15:16:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.16 2022/01/29 16:33:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1571,13 +1571,19 @@ ixgbe_update_stats_counters(struct adapt
 	struct ixgbe_hw_stats *stats = >stats.pf;
 	u32		  missed_rx = 0, bprc, lxon, lxoff, total;
 	u64		  total_missed_rx = 0;
-	uint64_t	  crcerrs, rlec;
+	uint64_t	  crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
 	unsigned int	  queue_counters;
 	int		  i;
 
-	crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
-	stats->crcerrs.ev_count += crcerrs;
-	stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
+#define READ_COPY_SET(hw, stats, regname, evname)		\
+	do {			\
+		(evname) = IXGBE_READ_REG((hw), regname);	\
+		(stats)->evname.ev_count += (evname);		\
+	} while (/*CONSTCOND*/0)
+	
+	READ_COPY_SET(hw, stats, IXGBE_CRCERRS, crcerrs);
+	READ_COPY_SET(hw, stats, IXGBE_ILLERRC, illerrc);
+
 	stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
 	stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
 	if (hw->mac.type >= ixgbe_mac_X550)
@@ -1635,8 +1641,7 @@ ixgbe_update_stats_counters(struct adapt
 		stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
 		stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
 	}
-	rlec = IXGBE_READ_REG(hw, IXGBE_RLEC);
-	stats->rlec.ev_count += rlec;
+	READ_COPY_SET(hw, stats, IXGBE_RLEC, rlec);
 
 	/* Hardware workaround, gprc counts missed packets */
 	stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
@@ -1688,10 +1693,13 @@ ixgbe_update_stats_counters(struct adapt
 	stats->mptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPTC) - total;
 	stats->ptc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PTC64) - total;
 
-	stats->ruc.ev_count += IXGBE_READ_REG(hw, IXGBE_RUC);
-	stats->rfc.ev_count += IXGBE_READ_REG(hw, IXGBE_RFC);
-	stats->roc.ev_count += IXGBE_READ_REG(hw, IXGBE_ROC);
-	stats->rjc.ev_count += IXGBE_READ_REG(hw, IXGBE_RJC);
+	READ_COPY_SET(hw, stats, IXGBE_RUC, ruc);
+	READ_COPY_SET(hw, stats, IXGBE_RFC, rfc);
+	READ_COPY_SET(hw, stats, IXGBE_ROC, roc);
+	READ_COPY_SET(hw, stats, IXGBE_RJC, rjc);
+
+#undef READ_COPY_SET
+
 	stats->mngprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPRC);
 	stats->mngpdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPDC);
 	stats->mngptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPTC);
@@ -1725,7 +1733,19 @@ ixgbe_update_stats_counters(struct adapt
 
 	/* Rx Errors */
 	ifp->if_iqdrops += total_missed_rx;
-	ifp->if_ierrors += crcerrs + rlec;
+
+	/*
+	 * Aggregate following types of errors as RX errors:
+	 * - CRC error count,
+	 * - illegal byte error count,
+	 * - length error count,
+	 * - undersized packets count,
+	 * - fragmented packets count,
+	 * - oversized packets count,
+	 * - jabber count.
+	 */
+	ifp->if_ierrors +=
+	crcerrs + illerrc + rlec + ruc + rfc + roc + rjc;
 } /* ixgbe_update_stats_counters */
 
 /



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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 19:40:38 UTC 2021

Modified Files:
src/sys/dev/pci [netbsd-9]: nvme_pci.c pci.c pci_subr.c pcireg.h ppb.c

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

sys/dev/pci/pcireg.h1.152-1.154, 1.156-1.161
sys/dev/pci/pci_subr.c  1.222, 1.227-1.232 via patch
sys/dev/pci/nvme_pci.c  1.31
sys/dev/pci/pci.c   1.158, 1.163
sys/dev/pci/ppb.c   1.74

- When parsing Enhanced Allocation entries, use the correct calculation
  for finding the next entry.
- Add 32.0GT/s to the list of pcie speeds (PCIe 5.x.).
- Add Some PCI config information:
  - Lane Margining at the Receiver
  - NVME admin interface
  - UFSHCI
  - InfiniBand
  - Host fabric
  - HDA 1.0 with vendor ext
  - USB4 HCI
  - MIPI I3C
  - Cellular controller/modem (+ Ethernet)
- Change PCI_VENDOR_MASK and PCI_PRODUCT_MASK to unsigned values, to
  prevent sign extension of product ID when shifted up into place in
  PCI_ID_CODE(). Fixes PR kern/56176.
- Add LCAP & LCAP2 definitions.
- Use PCI-SIG official acronyms for some macros.
- Fix typo in some messages.
- Fix typo in comments.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.26.4.1 -r1.26.4.2 src/sys/dev/pci/nvme_pci.c
cvs rdiff -u -r1.154.4.2 -r1.154.4.3 src/sys/dev/pci/pci.c
cvs rdiff -u -r1.215.2.4 -r1.215.2.5 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.147.4.2 -r1.147.4.3 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.69 -r1.69.2.1 src/sys/dev/pci/ppb.c

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



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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 19:40:38 UTC 2021

Modified Files:
src/sys/dev/pci [netbsd-9]: nvme_pci.c pci.c pci_subr.c pcireg.h ppb.c

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

sys/dev/pci/pcireg.h1.152-1.154, 1.156-1.161
sys/dev/pci/pci_subr.c  1.222, 1.227-1.232 via patch
sys/dev/pci/nvme_pci.c  1.31
sys/dev/pci/pci.c   1.158, 1.163
sys/dev/pci/ppb.c   1.74

- When parsing Enhanced Allocation entries, use the correct calculation
  for finding the next entry.
- Add 32.0GT/s to the list of pcie speeds (PCIe 5.x.).
- Add Some PCI config information:
  - Lane Margining at the Receiver
  - NVME admin interface
  - UFSHCI
  - InfiniBand
  - Host fabric
  - HDA 1.0 with vendor ext
  - USB4 HCI
  - MIPI I3C
  - Cellular controller/modem (+ Ethernet)
- Change PCI_VENDOR_MASK and PCI_PRODUCT_MASK to unsigned values, to
  prevent sign extension of product ID when shifted up into place in
  PCI_ID_CODE(). Fixes PR kern/56176.
- Add LCAP & LCAP2 definitions.
- Use PCI-SIG official acronyms for some macros.
- Fix typo in some messages.
- Fix typo in comments.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.26.4.1 -r1.26.4.2 src/sys/dev/pci/nvme_pci.c
cvs rdiff -u -r1.154.4.2 -r1.154.4.3 src/sys/dev/pci/pci.c
cvs rdiff -u -r1.215.2.4 -r1.215.2.5 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.147.4.2 -r1.147.4.3 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.69 -r1.69.2.1 src/sys/dev/pci/ppb.c

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

Modified files:

Index: src/sys/dev/pci/nvme_pci.c
diff -u src/sys/dev/pci/nvme_pci.c:1.26.4.1 src/sys/dev/pci/nvme_pci.c:1.26.4.2
--- src/sys/dev/pci/nvme_pci.c:1.26.4.1	Mon Jun 21 17:25:48 2021
+++ src/sys/dev/pci/nvme_pci.c	Fri Dec  3 19:40:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme_pci.c,v 1.26.4.1 2021/06/21 17:25:48 martin Exp $	*/
+/*	$NetBSD: nvme_pci.c,v 1.26.4.2 2021/12/03 19:40:38 martin Exp $	*/
 /*	$OpenBSD: nvme_pci.c,v 1.3 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.26.4.1 2021/06/21 17:25:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.26.4.2 2021/12/03 19:40:38 martin Exp $");
 
 #include 
 #include 
@@ -135,7 +135,7 @@ nvme_pci_match(device_t parent, cfdata_t
 
 	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_MASS_STORAGE &&
 	PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_NVM &&
-	PCI_INTERFACE(pa->pa_class) == PCI_INTERFACE_NVM_NVME)
+	PCI_INTERFACE(pa->pa_class) == PCI_INTERFACE_NVM_NVME_IO)
 		return 1;
 
 	return 0;

Index: src/sys/dev/pci/pci.c
diff -u src/sys/dev/pci/pci.c:1.154.4.2 src/sys/dev/pci/pci.c:1.154.4.3
--- src/sys/dev/pci/pci.c:1.154.4.2	Wed Nov  6 09:52:20 2019
+++ src/sys/dev/pci/pci.c	Fri Dec  3 19:40:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.154.4.2 2019/11/06 09:52:20 martin Exp $	*/
+/*	$NetBSD: pci.c,v 1.154.4.3 2021/12/03 19:40:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.2 2019/11/06 09:52:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.3 2021/12/03 19:40:38 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -708,7 +708,7 @@ pci_enumerate_bus(struct pci_softc *sc, 
 		if (pci_get_capability(ppbpc, ppbtag, PCI_CAP_PCIEXPRESS,
 		, ) != 0) {
 			switch (PCIE_XCAP_TYPE(capreg)) {
-			case PCIE_XCAP_TYPE_ROOT:
+			case PCIE_XCAP_TYPE_RP:
 			case PCIE_XCAP_TYPE_DOWN:
 			case PCIE_XCAP_TYPE_PCI2PCIE:
 downstream_port = true;
@@ -934,7 +934,7 @@ pci_conf_capture(pci_chipset_tag_t pc, p
 	/* For MSI */
 	if (pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL) != 0) {
 		bool bit64, pvmask;
-		
+
 		pcs->msi_ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL);
 
 		bit64 = pcs->msi_ctl & PCI_MSI_CTL_64BIT_ADDR;

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.215.2.4 src/sys/dev/pci/pci_subr.c:1.215.2.5
--- src/sys/dev/pci/pci_subr.c:1.215.2.4	Sun Jul 26 10:46:14 2020
+++ src/sys/dev/pci/pci_subr.c	Fri Dec  3 19:40:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.215.2.5 2021/12/03 19:40:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.5 2021/12/03 19:40:38 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -129,7 +129,15 @@ static const struct pci_class pci_interf
 static const struct pci_class pci_interface_nvm[] = {
 	{ "vendor specific",	PCI_INTERFACE_NVM_VND,		NULL,	},
 	{ "NVMHCI 1.0",	

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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 17:49:41 UTC 2021

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

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

sys/dev/pci/ichsmb.c1.69, 1.71, 1.73-1.75 via patch

- Add Intel 400, 495, and 500 series support.
- Add Intel Jasper Lake and Elkhart Lake support.
- Ignore the SMBALERT# interrupt. Same as other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.60.4.2 -r1.60.4.3 src/sys/dev/pci/ichsmb.c

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

Modified files:

Index: src/sys/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.60.4.2 src/sys/dev/pci/ichsmb.c:1.60.4.3
--- src/sys/dev/pci/ichsmb.c:1.60.4.2	Fri Jul 10 11:31:59 2020
+++ src/sys/dev/pci/ichsmb.c	Fri Dec  3 17:49:41 2021
@@ -1,5 +1,5 @@
-/*	$NetBSD: ichsmb.c,v 1.60.4.2 2020/07/10 11:31:59 martin Exp $	*/
-/*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.60.4.3 2021/12/03 17:49:41 martin Exp $	*/
+/*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Alexander Yurchenko 
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.2 2020/07/10 11:31:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.3 2021/12/03 17:49:41 martin Exp $");
 
 #include 
 #include 
@@ -126,6 +126,8 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_2HS_SMB:
 		case PCI_PRODUCT_INTEL_3HS_SMB:
 		case PCI_PRODUCT_INTEL_3HS_U_SMB:
+		case PCI_PRODUCT_INTEL_4HS_H_SMB:
+		case PCI_PRODUCT_INTEL_4HS_V_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_CMTLK_SMB:
@@ -133,6 +135,8 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_BSW_PCU_SMB:
 		case PCI_PRODUCT_INTEL_APL_SMB:
 		case PCI_PRODUCT_INTEL_GLK_SMB:
+		case PCI_PRODUCT_INTEL_EHL_SMB:
+		case PCI_PRODUCT_INTEL_JSL_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:
 		case PCI_PRODUCT_INTEL_C600_SMB_1:
@@ -145,6 +149,9 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_DH89XXCL_SMB:
 		case PCI_PRODUCT_INTEL_C2000_PCU_SMBUS:
 		case PCI_PRODUCT_INTEL_C3K_SMBUS_LEGACY:
+		case PCI_PRODUCT_INTEL_495_YU_SMB:
+		case PCI_PRODUCT_INTEL_5HS_H_SMB:
+		case PCI_PRODUCT_INTEL_5HS_LP_SMB:
 			return 1;
 		}
 	}
@@ -424,11 +431,6 @@ timeout:
 	/*
 	 * Transfer timeout. Kill the transaction and clear status bits.
 	 */
-	snprintb(fbuf, sizeof(fbuf), LPCIB_SMB_HS_BITS, st);
-	aprint_error_dev(sc->sc_dev,
-	"exec: op %d, addr 0x%02x, cmdlen %zd, len %zd, "
-	"flags 0x%02x: timeout, status %s\n",
-	op, addr, cmdlen, len, flags, fbuf);
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, LPCIB_SMB_HC,
 	LPCIB_SMB_HC_KILL);
 	DELAY(ICHIIC_DELAY);
@@ -455,9 +457,14 @@ ichsmb_intr(void *arg)
 
 	/* Read status */
 	st = bus_space_read_1(sc->sc_iot, sc->sc_ioh, LPCIB_SMB_HS);
+
+	/* Clear status bits */
+	bus_space_write_1(sc->sc_iot, sc->sc_ioh, LPCIB_SMB_HS, st);
+
+	/* XXX Ignore SMBALERT# for now */
 	if ((st & LPCIB_SMB_HS_BUSY) != 0 || (st & (LPCIB_SMB_HS_INTR |
 	LPCIB_SMB_HS_DEVERR | LPCIB_SMB_HS_BUSERR | LPCIB_SMB_HS_FAILED |
-	LPCIB_SMB_HS_SMBAL | LPCIB_SMB_HS_BDONE)) == 0)
+	LPCIB_SMB_HS_BDONE)) == 0)
 		/* Interrupt was not for us */
 		return (0);
 
@@ -466,9 +473,6 @@ ichsmb_intr(void *arg)
 	printf("%s: intr st %s\n", device_xname(sc->sc_dev), fbuf);
 #endif
 
-	/* Clear status bits */
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, LPCIB_SMB_HS, st);
-
 	/* Check for errors */
 	if (st & (LPCIB_SMB_HS_DEVERR | LPCIB_SMB_HS_BUSERR | LPCIB_SMB_HS_FAILED)) {
 		sc->sc_i2c_xfer.error = 1;



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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 17:49:41 UTC 2021

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

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

sys/dev/pci/ichsmb.c1.69, 1.71, 1.73-1.75 via patch

- Add Intel 400, 495, and 500 series support.
- Add Intel Jasper Lake and Elkhart Lake support.
- Ignore the SMBALERT# interrupt. Same as other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.60.4.2 -r1.60.4.3 src/sys/dev/pci/ichsmb.c

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



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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 17:34:39 UTC 2021

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

Log Message:
regen (ticket #1380)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.10 -r1.1371.2.11 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.10 -r1.1370.2.11 src/sys/dev/pci/pcidevs_data.h

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



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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 17:32:42 UTC 2021

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1380:

sys/dev/pci/pcidevs 1.1441-1.1444

- Add Intel Gemini Lake TXE HECI 1.
- Add Intel Elkhart Lake and Rocket Lake devices.
- Update Jasper Lake's Processor Transaction Routers.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1383.2.10 src/sys/dev/pci/pcidevs:1.1383.2.11
--- src/sys/dev/pci/pcidevs:1.1383.2.10	Thu Oct 21 14:22:56 2021
+++ src/sys/dev/pci/pcidevs	Fri Dec  3 17:32:42 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.10 2021/10/21 14:22:56 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.11 2021/12/03 17:32:42 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5158,6 +5158,7 @@ product INTEL GLK_PMC		0x3194	Gemini Lak
 product INTEL GLK_FASTSPI	0x3196	Gemini Lake Fast SPI
 product INTEL GLK_ESPI		0x3197	Gemini Lake eSPI
 product INTEL GLK_HDA		0x3198	Gemini Lake HD Audio
+product INTEL GLK_TXE_HECI_1	0x319a	Gemini Lake TXE HECI 1
 product INTEL GLK_ISH		0x31a2	Gemini Lake Integrated Sensor Hub
 product INTEL GLK_XHCI		0x31a8	Gemini Lake USB Host (xHCI)
 product INTEL GLK_XDCI		0x31aa	Gemini Lake USB Device (xDCI)
@@ -5625,12 +5626,134 @@ product INTEL 5HS_H_CNVI	0x43f0	500 Seri
 product INTEL 5HS_H_GSPI_2	0x43fb	500 Series PCH-H GSPI 2
 product INTEL 5HS_H_ISH		0x43fc	500 Series PCH-H Integrated Sensor Hub
 product INTEL 5HS_H_GSPI_3	0x43fd	500 Series PCH-H GSPI 3
+product INTEL EHL_TROUTER_3	0x4512	Elkhart Lake Transaction Router (SKU 3)
+product INTEL EHL_TROUTER_3A	0x451e	Elkhart Lake Transaction Router (SKU 3A)
+product INTEL EHL_TROUTER_5	0x4514	Elkhart Lake Transaction Router (SKU 5)
+product INTEL EHL_TROUTER_8	0x4516	Elkhart Lake Transaction Router (SKU 8)
+product INTEL EHL_TROUTER_12	0x4518	Elkhart Lake Transaction Router (SKU 12)
+product INTEL EHL_TROUTER_1	0x4522	Elkhart Lake Transaction Router (SKU 1)
+product INTEL EHL_TROUTER_1A	0x4538	Elkhart Lake Transaction Router (SKU 1A)
+product INTEL EHL_TROUTER_4	0x4526	Elkhart Lake Transaction Router (SKU 4)
+product INTEL EHL_TROUTER_6	0x4528	Elkhart Lake Transaction Router (SKU 6)
+product INTEL EHL_TROUTER_7	0x452a	Elkhart Lake Transaction Router (SKU 7)
+product INTEL EHL_TROUTER_9	0x452c	Elkhart Lake Transaction Router (SKU 9)
+product INTEL EHL_TROUTER_10	0x452e	Elkhart Lake Transaction Router (SKU 10)
+product INTEL EHL_TROUTER_11	0x4532	Elkhart Lake Transaction Router (SKU 11)
+product INTEL EHL_TROUTER_2	0x453a	Elkhart Lake Transaction Router (SKU 2)
+product INTEL EHL_GPU_16	0x4551	Elkhart Lake GPU (16EU)
+product INTEL EHL_GPU_32_SUPER	0x4551	Elkhart Lake GPU (32EU Super)
+product INTEL EHL_GPU_32	0x4551	Elkhart Lake GPU (32EU)
+product INTEL EHL_DPTF		0x4503	Elkhart Lake DPTF
+product INTEL EHL_GNA		0x4511	Elkhart Lake GNA
+product INTEL EHL_TRACE_2	0x4529	Elkhart Lake Trace Hub (Compute Die)
+product INTEL EHL_ESPI		0x4b00	Elkhart Lake eSPI
+product INTEL EHL_P2SB		0x4b20	Elkhart Lake P2SB
+product INTEL EHL_PMC		0x4b21	Elkhart Lake PMC
+product INTEL EHL_SMB		0x4b23	Elkhart Lake SMBus
+product INTEL EHL_SPI_FLASH	0x4b24	Elkhart Lake SPI (FLASH & TPM)
+product INTEL EHL_TRACE_1	0x4b26	Elkhart Lake Trace Hub (PCH)
+product INTEL EHL_SIO_UART_0	0x4b28	Elkhart Lake SIO UART 0
+product INTEL EHL_SIO_UART_1	0x4b29	Elkhart Lake SIO UART 1
+product INTEL EHL_SIO_SPI_0	0x4b2a	Elkhart Lake SIO SPI 0
+product INTEL EHL_SIO_SPI_1	0x4b2b	Elkhart Lake SIO SPI 1
+product INTEL EHL_IEH		0x4b2f	Elkhart Lake IEH
+product INTEL EHL_ETH		0x4b32	Elkhart Lake Ethernet
+product INTEL EHL_SIO_SPI_2	0x4b37	Elkhart Lake SIO SPI 2
+product INTEL EHL_PCIE_RP_0	0x4b38	Elkhart Lake PCIe Root Port 0 (PCIe 0, Single VC)
+product INTEL EHL_PCIE_RP_1	0x4b39	Elkhart Lake PCIe Root Port 1 (PCIe 0, Single VC)
+product INTEL EHL_PCIE_RP_2	0x4b3a	Elkhart Lake PCIe Root Port 2 (PCIe 0, Single VC)
+product INTEL EHL_PCIE_RP_3	0x4b3b	Elkhart Lake PCIe Root Port 3 (PCIe 0, Single VC)
+product INTEL EHL_PCIE_RP_4	0x4b3c	Elkhart Lake PCIe Root Port 4 (PCIe 1, Multi VC)
+product INTEL EHL_PCIE_RP_5	0x4b3d	Elkhart Lake PCIe Root Port 5 (PCIe 2, Multi VC)
+product INTEL EHL_PCIE_RP_6	0x4b3e	Elkhart Lake PCIe Root Port 6 (PCIe 3, Multi VC)
+product INTEL EHL_SIO_I2C_6	0x4b44	Elkhart Lake SIO I2C 6
+product INTEL EHL_SIO_I2C_7	0x4b45	Elkhart Lake SIO I2C 7
+product INTEL EHL_EMMC		0x4b47	Elkhart Lake eMMC
+product INTEL EHL_SDIO		0x4b48	Elkhart Lake SDIO
+product INTEL EHL_SI		0x4b4a	Elkhart Lake Safety Island
+product INTEL EHL_SIO_I2C_4	0x4b4b	Elkhart Lake SIO I2C 4
+product INTEL EHL_SIO_I2C_5	0x4b4c	Elkhart Lake SIO I2C 5

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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 17:32:42 UTC 2021

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1380:

sys/dev/pci/pcidevs 1.1441-1.1444

- Add Intel Gemini Lake TXE HECI 1.
- Add Intel Elkhart Lake and Rocket Lake devices.
- Update Jasper Lake's Processor Transaction Routers.


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

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



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

2021-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 30 11:44:39 UTC 2021

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

Log Message:
Apply patch, requested by msaitoh in ticket #1378:

sys/dev/pci/piixpm.cpatch

Fix a bug that I2C access panics on old AMD chipset (e.g SB600).
Fixes PR kern/56525.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/pci/piixpm.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/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.54.2.1 src/sys/dev/pci/piixpm.c:1.54.2.2
--- src/sys/dev/pci/piixpm.c:1.54.2.1	Thu Jul 16 12:39:11 2020
+++ src/sys/dev/pci/piixpm.c	Tue Nov 30 11:44:39 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.54.2.1 2020/07/16 12:39:11 martin Exp $ */
+/* $NetBSD: piixpm.c,v 1.54.2.2 2021/11/30 11:44:39 martin Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.1 2020/07/16 12:39:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.2 2021/11/30 11:44:39 martin Exp $");
 
 #include 
 #include 
@@ -123,6 +123,8 @@ static bool	piixpm_resume(device_t, cons
 
 static int	piixpm_sb800_init(struct piixpm_softc *);
 static void	piixpm_csb5_reset(void *);
+static int	piixpm_i2c_sb600_acquire_bus(void *, int);
+static void	piixpm_i2c_sb600_release_bus(void *, int);
 static int	piixpm_i2c_sb800_acquire_bus(void *, int);
 static void	piixpm_i2c_sb800_release_bus(void *, int);
 static int	piixpm_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *,
@@ -338,8 +340,8 @@ piixpm_rescan(device_t self, const char 
 			tag->ic_acquire_bus = piixpm_i2c_sb800_acquire_bus;
 			tag->ic_release_bus = piixpm_i2c_sb800_release_bus;
 		} else {
-			tag->ic_acquire_bus = NULL;
-			tag->ic_release_bus = NULL;
+			tag->ic_acquire_bus = piixpm_i2c_sb600_acquire_bus;
+			tag->ic_release_bus = piixpm_i2c_sb600_release_bus;
 		}
 		tag->ic_exec = piixpm_i2c_exec;
 		memset(, 0, sizeof(iba));
@@ -487,6 +489,28 @@ piixpm_csb5_reset(void *arg)
 }
 
 static int
+piixpm_i2c_sb600_acquire_bus(void *cookie, int flags)
+{
+	struct piixpm_smbus *smbus = cookie;
+	struct piixpm_softc *sc = smbus->softc;
+
+	if (!cold)
+		mutex_enter(>sc_i2c_mutex);
+
+	return 0;
+}
+
+static void
+piixpm_i2c_sb600_release_bus(void *cookie, int flags)
+{
+	struct piixpm_smbus *smbus = cookie;
+	struct piixpm_softc *sc = smbus->softc;
+
+	if (!cold)
+		mutex_exit(>sc_i2c_mutex);
+}
+
+static int
 piixpm_i2c_sb800_acquire_bus(void *cookie, int flags)
 {
 	struct piixpm_smbus *smbus = cookie;



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

2021-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 30 11:44:39 UTC 2021

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

Log Message:
Apply patch, requested by msaitoh in ticket #1378:

sys/dev/pci/piixpm.cpatch

Fix a bug that I2C access panics on old AMD chipset (e.g SB600).
Fixes PR kern/56525.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/pci/piixpm.c

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



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

2021-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 20 15:16:53 UTC 2021

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

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

sys/dev/pci/ixgbe/ixgbe.h   1.81-1.83
sys/dev/pci/ixgbe/ixgbe.c   1.291-1.292 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.50
sys/dev/pci/ixgbe/ixv.c 1.167-1.168 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.6 -r1.54.2.7 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.14 -r1.199.2.15 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.5 -r1.56.2.6 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.41.2.3 -r1.41.2.4 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.125.2.12 -r1.125.2.13 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.6 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.7
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.6	Wed Sep 15 16:30:50 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Nov 20 15:16:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.6 2021/09/15 16:30:50 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.7 2021/11/20 15:16:53 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.6 2021/09/15 16:30:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.7 2021/11/20 15:16:53 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1817,9 +1817,11 @@ ixgbe_rxeof(struct ix_queue *que)
 	struct ixgbe_rx_buf	*rbuf, *nbuf;
 	int			i, nextp, processed = 0;
 	u32			staterr = 0;
-	u32			loopcount = 0;
+	u32			loopcount = 0, numdesc;
 	u32			limit = adapter->rx_process_limit;
 	bool			discard_multidesc = rxr->discard_multidesc;
+	bool			wraparound = false;
+	unsigned int		syncremain;
 #ifdef RSS
 	u16			pkt_info;
 #endif
@@ -1836,6 +1838,24 @@ ixgbe_rxeof(struct ix_queue *que)
 	}
 #endif /* DEV_NETMAP */
 
+	/* Sync the ring. The size is rx_process_limit or the first half */
+	if ((rxr->next_to_check + limit) <= rxr->num_desc) {
+		/* Non-wraparound */
+		numdesc = limit;
+		syncremain = 0;
+	} else {
+		/* Wraparound. Sync the first half. */
+		numdesc = rxr->num_desc - rxr->next_to_check;
+
+		/* Set the size of the last half */
+		syncremain = limit - numdesc;
+	}
+	bus_dmamap_sync(rxr->rxdma.dma_tag->dt_dmat,
+	rxr->rxdma.dma_map,
+	sizeof(union ixgbe_adv_rx_desc) * rxr->next_to_check,
+	sizeof(union ixgbe_adv_rx_desc) * numdesc,
+	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
 	/*
 	 * The max number of loop is rx_process_limit. If discard_multidesc is
 	 * true, continue processing to not to send broken packet to the upper
@@ -1852,9 +1872,22 @@ ixgbe_rxeof(struct ix_queue *que)
 		booleop;
 		booldiscard = false;
 
-		/* Sync the ring. */
-		ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
-		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+		if (wraparound) {
+			/* Sync the last half. */
+			KASSERT(syncremain != 0);
+			numdesc = syncremain;
+			wraparound = false;
+		} else if (__predict_false(loopcount >= limit)) {
+			KASSERT(discard_multidesc == true);
+			numdesc = 1;
+		} else
+			numdesc = 0;
+
+		if (numdesc != 0)
+			bus_dmamap_sync(rxr->rxdma.dma_tag->dt_dmat,
+			rxr->rxdma.dma_map, 0,
+			sizeof(union ixgbe_adv_rx_desc) * numdesc,
+			BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
 		cur = >rx_base[i];
 		staterr = le32toh(cur->wb.upper.status_error);
@@ -2118,8 +2151,10 @@ next_desc:
 		BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 		/* Advance our pointers to the next descriptor. */
-		if (++i == rxr->num_desc)
+		if (++i == rxr->num_desc) {
+			wraparound = true;
 			i = 0;
+		}
 		rxr->next_to_check = i;
 
 		/* Now send to the stack or do LRO */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.14 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.15
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.14	Wed Sep 15 16:30:50 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Nov 20 15:16:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.14 2021/09/15 16:30:50 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.15 2021/11/20 15:16:53 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.14 2021/09/15 16:30:50 martin Exp $");
+__KERNEL_RCSID(0, 

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

2021-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 20 15:16:53 UTC 2021

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

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

sys/dev/pci/ixgbe/ixgbe.h   1.81-1.83
sys/dev/pci/ixgbe/ixgbe.c   1.291-1.292 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.50
sys/dev/pci/ixgbe/ixv.c 1.167-1.168 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.6 -r1.54.2.7 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.14 -r1.199.2.15 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.5 -r1.56.2.6 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.41.2.3 -r1.41.2.4 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.125.2.12 -r1.125.2.13 src/sys/dev/pci/ixgbe/ixv.c

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



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

2021-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 21 14:24:46 UTC 2021

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

Log Message:
Regen (for ticket #1362)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.9 -r1.1371.2.10 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.9 -r1.1370.2.10 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2021-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 21 14:24:46 UTC 2021

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

Log Message:
Regen (for ticket #1362)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.9 -r1.1371.2.10 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.9 -r1.1370.2.10 src/sys/dev/pci/pcidevs_data.h

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



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

2021-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 21 14:22:56 UTC 2021

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1362:

sys/dev/pci/pcidevs 1.1419-1.1440

- Add newer ciss(4) devices.
- Add modern QUMRANET/Red Hat VIRTIO range PCI devices.
- Add some more product IDs for mcx(4).
- Add current generation NVIDIA graphics cards (3050-3090 etc.).
- Add RDC R6022 PCI-Host bridge.
- Add a whole bunch of radeon devices.
- Add Realtek RTL8821CE.
- Add Intel 660p SSD, and expand the 760p description.
- Add Intel I219's version number.
- Add Intel I219V 15-19 and I219LM 16-19.
- Add Intel I225V, I225LM and WiFi 6 AX201.
- Add newer Intel PCH internal devices.
- Add Intel Jasper Lake devices.
- PDC20265 is Ultra/100, not 66.
- Fix Realtek RTL8125 description.
- Sort Cavium devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.9 -r1.1383.2.10 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.1383.2.9 src/sys/dev/pci/pcidevs:1.1383.2.10
--- src/sys/dev/pci/pcidevs:1.1383.2.9	Fri Jul 10 10:23:57 2020
+++ src/sys/dev/pci/pcidevs	Thu Oct 21 14:22:56 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.9 2020/07/10 10:23:57 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.10 2021/10/21 14:22:56 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1678,75 +1678,298 @@ product ATI RADEON_R423_5D57	0x5d57	Rade
 product ATI RADEON_X850XT_S	0x5d72	Radeon X850 XT Secondary
 product ATI RADEON_X700		0x5e4b	Radeon X700 Pro
 product ATI RADEON_X700_S	0x5e6b	Radeon X700 Pro Secondary
+product ATI RADEON_HD8670A_1	0x6600	Radeon HD 8670A/8670M/8750M
+product ATI RADEON_HD8730M	0x6601	Radeon HD 8730M
+product ATI RADEON_R7_M265	0x6604	Radeon R7 M265/M365X/M465
+product ATI RADEON_R7_M260X	0x6605	Radeon R7 M260X
 product ATI RADEON_HD8790M	0x6606	Radeon HD 8790M
-product ATI RADEON_HD8530M	0x6607	Radeon HD 8530M
-product ATI RADEON_HD8600	0x6610	Radeon HD 8600
-product ATI RADEON_HD8570	0x6611	Radeon HD 8570
-product ATI RADEON_HD8500	0x6613	Radeon HD 8500
+product ATI RADEON_HD8530M	0x6607	Radeon HD 8530M / R5 M240
+product ATI RADEON_FP_W2100	0x6608	FirePro W2100
+product ATI RADEON_HD8600	0x6610	Radeon HD 8670 / R7 250/350
+product ATI RADEON_HD8570	0x6611	Radeon HD 8570 / R7 240/340 / Radeon 520 OEM
+product ATI RADEON_HD8500	0x6613	Radeon R7 240/340
+product ATI RADEON_FP_M6100	0x6640	FirePro M6100
+product ATI RADEON_HD8930M	0x6641	Radeon HD 8930M
+product ATI RADEON_R9M280X	0x6646	Radeon R9 M280X
+product ATI RADEON_R9M270X	0x6647	Radeon R9 M270X/M280X
+product ATI RADEON_FP_W5100	0x6649	FirePro W5100
+product ATI RADEON_R7_260X	0x6658	Radeon R7 260X/360
+product ATI RADEON_HD7790	0x665C	Radeon HD 7790/8770 / R7 360 / R9 260/360 OEM
+product ATI RADEON_R7_200	0x665D	Radeon R7 200 Series
+product ATI RADEON_R7_360	0x665F	Radeon R7 360 / R9 360 OEM
+product ATI RADEON_HD8670A_2	0x6660	Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile
+product ATI RADEON_HD8570A	0x6663	Radeon HD 8570A/8570M
+product ATI RADEON_R5_M240	0x6664	Radeon R5 M240
+product ATI RADEON_R5_M230	0x6665	Radeon R5 M230 / R7 M260DX / Radeon 520 Mobile
+product ATI RADEON_R5_M230_2	0x6667	Radeon R5 M230
+product ATI RADEON_HD8550M	0x666F	Radeon HD 8550M / R5 M230
+product ATI RADEON_INSTINCT	0x66A0	Radeon Instinct
+product ATI RADEON_VEGA20_1	0x66A1	Vega 20
+product ATI RADEON_VEGA20_2	0x66A2	Vega 20
+product ATI RADEON_VEGA20_3	0x66A3	Vega 20
+product ATI RADEON_VEGA20_PRO	0x66A7	Radeon Pro Vega 20
+product ATI RADEON_VII_1	0x66AF	Radeon VII
+product ATI RADEON_FP_V7900	0x6704	FirePro V7900
+product ATI RADEON_FP_V5900	0x6707	FirePro V5900
 product ATI RADEON_HD6970	0x6718	Radeon HD 6970
 product ATI RADEON_HD6950	0x6719	Radeon HD 6950
 product ATI RADEON_HD6990_1	0x671c	Radeon HD 6990
 product ATI RADEON_HD6990_2	0x671d	Radeon HD 6990
 product ATI RADEON_HD6930	0x671f	Radeon HD 6930
-product ATI RADEON_HD6970M	0x6720	Radeon HD 6970M
+product ATI RADEON_HD6970M	0x6720	Radeon HD 6970M/6990M
 product ATI RADEON_HD6900M	0x6725	Radeon HD 6900M
 product ATI RADEON_HD6870	0x6738	Radeon HD 6870
 product ATI RADEON_HD6850	0x6739	Radeon HD 6850
 product ATI RADEON_HD6790	0x673e	Radeon HD 6790
-product ATI RADEON_HD6730M	0x6740	Radeon HD 6730M
-product ATI RADEON_HD6600M	0x6741	Radeon HD 6600M
-product ATI RADEON_HD6610M	0x6742	Radeon HD 6610M
-product ATI RADEON_HD6650A	0x6750	Radeon HD 6650A
-product ATI RADEON_HD7670A	0x6751	Radeon HD 7670A
-product ATI RADEON_HD6670	0x6758	Radeon HD 6670
-product ATI RADEON_HD6570	0x6759	Radeon HD 6570
+product ATI RADEON_HD6730M	0x6740	Radeon HD 6730M/6770M/7690M XT
+product ATI RADEON_HD6600M	0x6741	Radeon HD 6630M/6650M/6750M/7670M/7690M
+product ATI RADEON_HD6610M	

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

2021-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 21 14:22:56 UTC 2021

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1362:

sys/dev/pci/pcidevs 1.1419-1.1440

- Add newer ciss(4) devices.
- Add modern QUMRANET/Red Hat VIRTIO range PCI devices.
- Add some more product IDs for mcx(4).
- Add current generation NVIDIA graphics cards (3050-3090 etc.).
- Add RDC R6022 PCI-Host bridge.
- Add a whole bunch of radeon devices.
- Add Realtek RTL8821CE.
- Add Intel 660p SSD, and expand the 760p description.
- Add Intel I219's version number.
- Add Intel I219V 15-19 and I219LM 16-19.
- Add Intel I225V, I225LM and WiFi 6 AX201.
- Add newer Intel PCH internal devices.
- Add Intel Jasper Lake devices.
- PDC20265 is Ultra/100, not 66.
- Fix Realtek RTL8125 description.
- Sort Cavium devices.


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

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



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

2021-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  3 10:20:22 UTC 2021

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

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

sys/dev/pci/if_vte.c: revision 1.32

Restore original MDC speed control register value after MAC reset, if
it wasn't default. Fixes PR port-i386/53494.

ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/dev/pci/if_vte.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_vte.c
diff -u src/sys/dev/pci/if_vte.c:1.26.2.1 src/sys/dev/pci/if_vte.c:1.26.2.2
--- src/sys/dev/pci/if_vte.c:1.26.2.1	Wed Nov  6 09:59:39 2019
+++ src/sys/dev/pci/if_vte.c	Fri Sep  3 10:20:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vte.c,v 1.26.2.1 2019/11/06 09:59:39 martin Exp $	*/
+/*	$NetBSD: if_vte.c,v 1.26.2.2 2021/09/03 10:20:22 martin Exp $	*/
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.  All rights reserved.
@@ -55,7 +55,7 @@
 /* Driver for DM Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.26.2.1 2019/11/06 09:59:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.26.2.2 2021/09/03 10:20:22 martin Exp $");
 
 #include 
 #include 
@@ -1200,9 +1200,10 @@ vte_tick(void *arg)
 static void
 vte_reset(struct vte_softc *sc)
 {
-	uint16_t mcr;
+	uint16_t mcr, mdcsc;
 	int i;
 
+	mdcsc = CSR_READ_2(sc, VTE_MDCSC);
 	mcr = CSR_READ_2(sc, VTE_MCR1);
 	CSR_WRITE_2(sc, VTE_MCR1, mcr | MCR1_MAC_RESET);
 	for (i = VTE_RESET_TIMEOUT; i > 0; i--) {
@@ -1220,6 +1221,14 @@ vte_reset(struct vte_softc *sc)
 	CSR_WRITE_2(sc, VTE_MACSM, 0x0002);
 	CSR_WRITE_2(sc, VTE_MACSM, 0);
 	DELAY(5000);
+
+	/*
+	 * On some SoCs (like Vortex86DX3) MDC speed control register value
+	 * needs to be restored to original value instead of default one,
+	 * otherwise some PHY registers may fail to be read.
+	 */
+	if (mdcsc != MDCSC_DEFAULT)
+		CSR_WRITE_2(sc, VTE_MDCSC, mdcsc);
 }
 
 



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

2021-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  3 10:20:22 UTC 2021

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

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

sys/dev/pci/if_vte.c: revision 1.32

Restore original MDC speed control register value after MAC reset, if
it wasn't default. Fixes PR port-i386/53494.

ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/dev/pci/if_vte.c

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



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 14:04:38 UTC 2019

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

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

sys/dev/pci/esm.c: revision 1.64

add missing break.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/dev/pci/esm.c

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



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 14:04:38 UTC 2019

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

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

sys/dev/pci/esm.c: revision 1.64

add missing break.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/dev/pci/esm.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/esm.c
diff -u src/sys/dev/pci/esm.c:1.63 src/sys/dev/pci/esm.c:1.63.2.1
--- src/sys/dev/pci/esm.c:1.63	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/esm.c	Wed Nov 27 14:04:38 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: esm.c,v 1.63 2019/06/08 08:02:38 isaki Exp $  */
+/*  $NetBSD: esm.c,v 1.63.2.1 2019/11/27 14:04:38 martin Exp $  */
 
 /*-
  * Copyright (c) 2002, 2003 Matt Fredette
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.63 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.63.2.1 2019/11/27 14:04:38 martin Exp $");
 
 #include 
 #include 
@@ -1482,6 +1482,7 @@ esm_match(device_t dev, cfdata_t match, 
 		case PCI_PRODUCT_ESSTECH_MAESTRO2E:
 			return 1;
 		}
+		break;
 
 	case PCI_VENDOR_ESSTECH2:
 		switch (PCI_PRODUCT(pa->pa_id)) {



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 11:08:24 UTC 2019

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

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

sys/dev/pci/if_bge.c: revision 1.340
sys/dev/pci/if_bge.c: revision 1.341
sys/dev/pci/if_bge.c: revision 1.342
sys/dev/pci/if_bge.c: revision 1.336

- Avoid undefined behavior in bge_setmulti(). found by kUBSan.
- Avoid undefined behavior when setting the MAC address in bge_init().
  found by kUBSan.

 Fix a bug that SK-9D41 can't detect fiber media. Check the subsystem ID
correctly. This bug was added in if_bge.c rev. 1.161.

- Use *_FLUSH() more. The main purpose is to wait following delay() correctly.
- Add missing DELAY(80) after writing BGE_MI_MODE register.

 Modify PHY initialization code. This change fix a bug that SK-9D21 doesn't
detect MII PHY.
 - Add error check to bge_miibus_writereg().
 - Change return value of bge_miibus_readreg() when a read error occurred.
   It also add error message using with aprint_debug_dev(). This error occurs
   on some devices while detecting MII devices.
 - Move the location of BGE_MI_MODE register's initialization to next to
   bge_chipinit().
 - Set BGE_MAC_MODE before calling ifmedia_init() and/or mii_attach().
 - Add retry code for mii_attach() failed. Same as FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.335.2.1 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.335 src/sys/dev/pci/if_bge.c:1.335.2.1
--- src/sys/dev/pci/if_bge.c:1.335	Tue Jul  9 08:46:58 2019
+++ src/sys/dev/pci/if_bge.c	Wed Nov 27 11:08:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.335 2019/07/09 08:46:58 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.335.2.1 2019/11/27 11:08:24 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.335 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.335.2.1 2019/11/27 11:08:24 martin Exp $");
 
 #include 
 #include 
@@ -1027,10 +1027,10 @@ bge_eeprom_getbyte(struct bge_softc *sc,
 	 * Enable use of auto EEPROM access so we can avoid
 	 * having to use the bitbang method.
 	 */
-	BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
+	BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
 
 	/* Reset the EEPROM, load the clock period. */
-	CSR_WRITE_4(sc, BGE_EE_ADDR,
+	CSR_WRITE_4_FLUSH(sc, BGE_EE_ADDR,
 	BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL));
 	DELAY(20);
 
@@ -1113,9 +1113,11 @@ bge_miibus_readreg(device_t dev, int phy
 	if (i == BGE_TIMEOUT) {
 		aprint_error_dev(sc->bge_dev, "PHY read timed out\n");
 		rv = ETIMEDOUT;
-	} else if ((data & BGE_MICOMM_READFAIL) != 0)
-		rv = -1;
-	else
+	} else if ((data & BGE_MICOMM_READFAIL) != 0) {
+		/* XXX This error occurs on some devices while attaching. */
+		aprint_debug_dev(sc->bge_dev, "PHY read I/O error\n");
+		rv = EIO;
+	} else
 		*val = data & BGE_MICOMM_DATA;
 
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -1133,7 +1135,8 @@ static int
 bge_miibus_writereg(device_t dev, int phy, int reg, uint16_t val)
 {
 	struct bge_softc *sc = device_private(dev);
-	uint32_t autopoll;
+	uint32_t data, autopoll;
+	int rv = 0;
 	int i;
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 &&
@@ -1156,13 +1159,22 @@ bge_miibus_writereg(device_t dev, int ph
 
 	for (i = 0; i < BGE_TIMEOUT; i++) {
 		delay(10);
-		if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) {
+		data = CSR_READ_4(sc, BGE_MI_COMM);
+		if (!(data & BGE_MICOMM_BUSY)) {
 			delay(5);
-			CSR_READ_4(sc, BGE_MI_COMM);
+			data = CSR_READ_4(sc, BGE_MI_COMM);
 			break;
 		}
 	}
 
+	if (i == BGE_TIMEOUT) {
+		aprint_error_dev(sc->bge_dev, "PHY write timed out\n");
+		rv = ETIMEDOUT;
+	} else if ((data & BGE_MICOMM_READFAIL) != 0) {
+		aprint_error_dev(sc->bge_dev, "PHY write I/O error\n");
+		rv = EIO;
+	}
+
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
 		BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL);
 		BGE_SETBIT_FLUSH(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL);
@@ -1176,7 +1188,7 @@ bge_miibus_writereg(device_t dev, int ph
 		return ETIMEDOUT;
 	}
 
-	return 0;
+	return rv;
 }
 
 static void
@@ -1827,7 +1839,7 @@ bge_setmulti(struct bge_softc *sc)
 		/* Just want the 7 least-significant bits. */
 		h &= 0x7f;
 
-		hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
+		hashes[(h & 0x60) >> 5] |= 1U << (h & 0x1F);
 		ETHER_NEXT_MULTI(step, enm);
 	}
 	ETHER_UNLOCK(ec);
@@ -2286,7 +2298,7 @@ bge_chipinit(struct bge_softc *sc)
 #endif
 
 	/* Set the timer prescaler (always 66MHz) */
-	CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
+	CSR_WRITE_4_FLUSH(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
 		DELAY(40);	/* XXX */
@@ 

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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 18:30:57 UTC 2019

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

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

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

Fix IFF_ALLMULTI handling.


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

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



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 18:30:57 UTC 2019

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

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

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

Fix IFF_ALLMULTI handling.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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.1.2.5 src/sys/dev/pci/if_mcx.c:1.1.2.6
--- src/sys/dev/pci/if_mcx.c:1.1.2.5	Mon Nov 18 19:46:33 2019
+++ src/sys/dev/pci/if_mcx.c	Tue Nov 26 18:30:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.1.2.5 2019/11/18 19:46:33 martin Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.1.2.6 2019/11/26 18:30:57 martin Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -6205,8 +6205,11 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 {
 	struct mcx_softc *sc = (struct mcx_softc *)ifp->if_softc;
 	struct ifreq *ifr = (struct ifreq *)data;
+	struct ethercom *ec = >sc_ec;
 	uint8_t addrhi[ETHER_ADDR_LEN], addrlo[ETHER_ADDR_LEN];
-	int s, i, error = 0;
+	struct ether_multi *enm;
+	struct ether_multistep step;
+	int s, i, flags, error = 0;
 
 	s = splnet();
 	switch (cmd) {
@@ -6214,8 +6217,10 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 	case SIOCADDMULTI:
 		if (ether_addmulti(ifreq_getaddr(cmd, ifr), >sc_ec) == ENETRESET) {
 			error = ether_multiaddr(>ifr_addr, addrlo, addrhi);
-			if (error != 0)
+			if (error != 0) {
+splx(s);
 return (error);
+			}
 
 			for (i = 0; i < MCX_NUM_MCAST_FLOWS; i++) {
 if (sc->sc_mcast_flows[i][0] == 0) {
@@ -6238,7 +6243,7 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 	error = ENETRESET;
 }
 
-if (sc->sc_ec.ec_multicnt > 0) {
+if (memcmp(addrlo, addrhi, ETHER_ADDR_LEN)) {
 	SET(ifp->if_flags, IFF_ALLMULTI);
 	error = ENETRESET;
 }
@@ -6249,8 +6254,10 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 	case SIOCDELMULTI:
 		if (ether_delmulti(ifreq_getaddr(cmd, ifr), >sc_ec) == ENETRESET) {
 			error = ether_multiaddr(>ifr_addr, addrlo, addrhi);
-			if (error != 0)
+			if (error != 0) {
+splx(s);
 return (error);
+			}
 
 			for (i = 0; i < MCX_NUM_MCAST_FLOWS; i++) {
 if (memcmp(sc->sc_mcast_flows[i], addrlo,
@@ -6269,10 +6276,23 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 sc->sc_extra_mcast--;
 
 			if (ISSET(ifp->if_flags, IFF_ALLMULTI) &&
-			(sc->sc_extra_mcast == 0) &&
-			(sc->sc_ec.ec_multicnt == 0)) {
-CLR(ifp->if_flags, IFF_ALLMULTI);
-error = ENETRESET;
+			sc->sc_extra_mcast == 0) {
+flags = 0;
+ETHER_LOCK(ec);
+ETHER_FIRST_MULTI(step, ec, enm);
+while (enm != NULL) {
+	if (memcmp(enm->enm_addrlo,
+	enm->enm_addrhi, ETHER_ADDR_LEN)) {
+		SET(flags, IFF_ALLMULTI);
+		break;
+	}
+	ETHER_NEXT_MULTI(step, enm);
+}
+ETHER_UNLOCK(ec);
+if (!ISSET(flags, IFF_ALLMULTI)) {
+	CLR(ifp->if_flags, IFF_ALLMULTI);
+	error = ENETRESET;
+}
 			}
 		}
 		break;



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:20:47 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_age.c if_alc.c if_ale.c if_cas.c

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

sys/dev/pci/if_cas.c: revision 1.36
sys/dev/pci/if_alc.c: revision 1.44
sys/dev/pci/if_ale.c: revision 1.35
sys/dev/pci/if_ale.c: revision 1.36
sys/dev/pci/if_age.c: revision 1.64

Fix a bug that IFF_ALLMULTI is almost always set.
 OpenBSD's ac_multirangecnt is not NetBSD's ec_multicnt.

 Remove accidentally committed debug code. Sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/dev/pci/if_cas.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_age.c
diff -u src/sys/dev/pci/if_age.c:1.60.2.3 src/sys/dev/pci/if_age.c:1.60.2.4
--- src/sys/dev/pci/if_age.c:1.60.2.3	Tue Nov 26 08:18:40 2019
+++ src/sys/dev/pci/if_age.c	Tue Nov 26 08:20:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $ */
+/*	$NetBSD: if_age.c,v 1.60.2.4 2019/11/26 08:20:47 martin Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.4 2019/11/26 08:20:47 martin Exp $");
 
 #include "vlan.h"
 
@@ -2275,27 +2275,37 @@ age_rxfilter(struct age_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_LOCK(ec);
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		ETHER_NEXT_MULTI(step, enm);
+	}
+	ETHER_UNLOCK(ec);
+
+update:
+	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if (ifp->if_flags & IFF_PROMISC) {
 			rxcfg |= MAC_CFG_PROMISC;
-		else
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+		} else
 			rxcfg |= MAC_CFG_ALLMULTI;
 		mchash[0] = mchash[1] = 0x;
-	} else {
-		/* Program new filter. */
-		memset(mchash, 0, sizeof(mchash));
-
-		ETHER_LOCK(ec);
-		ETHER_FIRST_MULTI(step, ec, enm);
-		while (enm != NULL) {
-			crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
-			mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-			ETHER_NEXT_MULTI(step, enm);
-		}
-		ETHER_UNLOCK(ec);
 	}
-
 	CSR_WRITE_4(sc, AGE_MAR0, mchash[0]);
 	CSR_WRITE_4(sc, AGE_MAR1, mchash[1]);
 	CSR_WRITE_4(sc, AGE_MAC_CFG, rxcfg);

Index: src/sys/dev/pci/if_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.38.2.2 src/sys/dev/pci/if_alc.c:1.38.2.3
--- src/sys/dev/pci/if_alc.c:1.38.2.2	Wed Nov  6 09:59:38 2019
+++ src/sys/dev/pci/if_alc.c	Tue Nov 26 08:20:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_alc.c,v 1.38.2.2 2019/11/06 09:59:38 martin Exp $	*/
+/*	$NetBSD: if_alc.c,v 1.38.2.3 2019/11/26 08:20:47 martin Exp $	*/
 /*	$OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $	*/
 /*-
  * Copyright (c) 2009, Pyun YongHyeon 
@@ -3443,27 +3443,37 @@ alc_iff(struct alc_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_LOCK(ec);
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		ETHER_NEXT_MULTI(step, enm);
+	}
+	ETHER_UNLOCK(ec);
+
+update:
+	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if (ifp->if_flags & IFF_PROMISC) {
 			rxcfg |= MAC_CFG_PROMISC;
-		else
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+		} else
 			rxcfg |= MAC_CFG_ALLMULTI;
 		mchash[0] = mchash[1] = 0x;
-	} else {
-		/* Program new filter. */
-		memset(mchash, 0, sizeof(mchash));
-
-		

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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:20:47 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_age.c if_alc.c if_ale.c if_cas.c

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

sys/dev/pci/if_cas.c: revision 1.36
sys/dev/pci/if_alc.c: revision 1.44
sys/dev/pci/if_ale.c: revision 1.35
sys/dev/pci/if_ale.c: revision 1.36
sys/dev/pci/if_age.c: revision 1.64

Fix a bug that IFF_ALLMULTI is almost always set.
 OpenBSD's ac_multirangecnt is not NetBSD's ec_multicnt.

 Remove accidentally committed debug code. Sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/dev/pci/if_cas.c

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



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:18:40 UTC 2019

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

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

sys/dev/pci/if_age.c: revision 1.63

Fix multicast handling. All Atheros controllers use big-endian form
when computing multicast hash. Same as OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/pci/if_age.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_age.c
diff -u src/sys/dev/pci/if_age.c:1.60.2.2 src/sys/dev/pci/if_age.c:1.60.2.3
--- src/sys/dev/pci/if_age.c:1.60.2.2	Wed Nov  6 09:59:39 2019
+++ src/sys/dev/pci/if_age.c	Tue Nov 26 08:18:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.60.2.2 2019/11/06 09:59:39 martin Exp $ */
+/*	$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.2 2019/11/06 09:59:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $");
 
 #include "vlan.h"
 
@@ -2289,7 +2289,7 @@ age_rxfilter(struct age_softc *sc)
 		ETHER_LOCK(ec);
 		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm != NULL) {
-			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
+			crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
 			mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
 			ETHER_NEXT_MULTI(step, enm);
 		}



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:18:40 UTC 2019

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

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

sys/dev/pci/if_age.c: revision 1.63

Fix multicast handling. All Atheros controllers use big-endian form
when computing multicast hash. Same as OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/pci/if_age.c

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:47:16 UTC 2019

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

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

sys/dev/pci/if_vge.c: revision 1.76
sys/dev/pci/if_vge.c: revision 1.77

 Fixes a bug that "ifmedia vge0 media 1000baseT-FDX" causes device timeout.

If the interface's media is NOT in the "best" mode (i.e. other than IFM_AUTO),
control VGE_DIAGCTL_GMII bit.

- Set duplex correctly when user setting is not IFM_AUTO.
- When the link is up, set VGE_DIAGCTL not from user media setting but from
  the current active link status.


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/dev/pci/if_vge.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_vge.c
diff -u src/sys/dev/pci/if_vge.c:1.73.2.1 src/sys/dev/pci/if_vge.c:1.73.2.2
--- src/sys/dev/pci/if_vge.c:1.73.2.1	Thu Oct 17 18:58:33 2019
+++ src/sys/dev/pci/if_vge.c	Mon Nov 25 16:47:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.73.2.1 2019/10/17 18:58:33 martin Exp $ */
+/* $NetBSD: if_vge.c,v 1.73.2.2 2019/11/25 16:47:16 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.73.2.1 2019/10/17 18:58:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.73.2.2 2019/11/25 16:47:16 martin Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -1916,6 +1916,7 @@ vge_miibus_statchg(struct ifnet *ifp)
 	struct vge_softc *sc = ifp->if_softc;
 	struct mii_data *mii = >sc_mii;
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
+	uint8_t dctl;
 
 	/*
 	 * If the user manually selects a media mode, we need to turn
@@ -1927,31 +1928,37 @@ vge_miibus_statchg(struct ifnet *ifp)
 	 * always implied, so we turn on the forced mode bit but leave
 	 * the FDX bit cleared.
 	 */
+	dctl = CSR_READ_1(sc, VGE_DIAGCTL);
 
-	switch (IFM_SUBTYPE(ife->ifm_media)) {
-	case IFM_AUTO:
-		CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
-		CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		break;
-	case IFM_1000_T:
-		CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
-		CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		break;
-	case IFM_100_TX:
-	case IFM_10_T:
-		CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
-		if ((ife->ifm_media & IFM_FDX) != 0) {
-			CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		} else {
-			CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		}
-		break;
-	default:
-		printf("%s: unknown media type: %x\n",
-		device_xname(sc->sc_dev),
-		IFM_SUBTYPE(ife->ifm_media));
-		break;
+	if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
+		dctl &= ~VGE_DIAGCTL_MACFORCE;
+		dctl &= ~VGE_DIAGCTL_FDXFORCE;
+	} else {
+		u_int ifmword;
+
+		/* If the link is up, use the current active media. */
+		if ((mii->mii_media_status & IFM_ACTIVE) != 0)
+			ifmword = mii->mii_media_active;
+		else
+			ifmword = ife->ifm_media;
+
+		dctl |= VGE_DIAGCTL_MACFORCE;
+		if ((ifmword & IFM_FDX) != 0)
+			dctl |= VGE_DIAGCTL_FDXFORCE;
+		else
+			dctl &= ~VGE_DIAGCTL_FDXFORCE;
+
+		if (IFM_SUBTYPE(ifmword) == IFM_1000_T) {
+			/*
+			 * It means the user setting is not auto but it's
+			 * 1000baseT-FDX or 1000baseT.
+			 */
+			dctl |= VGE_DIAGCTL_GMII;
+		} else
+			dctl &= ~VGE_DIAGCTL_GMII;
 	}
+
+	CSR_WRITE_1(sc, VGE_DIAGCTL, dctl);
 }
 
 static int



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:47:16 UTC 2019

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

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

sys/dev/pci/if_vge.c: revision 1.76
sys/dev/pci/if_vge.c: revision 1.77

 Fixes a bug that "ifmedia vge0 media 1000baseT-FDX" causes device timeout.

If the interface's media is NOT in the "best" mode (i.e. other than IFM_AUTO),
control VGE_DIAGCTL_GMII bit.

- Set duplex correctly when user setting is not IFM_AUTO.
- When the link is up, set VGE_DIAGCTL not from user media setting but from
  the current active link status.


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/dev/pci/if_vge.c

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:17:44 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

 XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.6 -r1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.6 -r1.125.2.7 src/sys/dev/pci/ixgbe/ixv.c

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:17:44 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

 XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.6 -r1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.6 -r1.125.2.7 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.199.2.6 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.7
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.6	Thu Oct 17 19:09:14 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Nov 19 13:17:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.6 2019/10/17 19:09:14 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.7 2019/11/19 13:17:44 martin Exp $ */
 
 /**
 
@@ -1338,6 +1338,8 @@ ixgbe_setup_interface(device_t dev, stru
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.7
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6	Thu Nov 14 15:30:19 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Nov 19 13:17:44 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.6 2019/11/14 15:30:19 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.7 2019/11/19 13:17:44 martin Exp $*/
 
 /**
 
@@ -1610,6 +1610,8 @@ ixv_setup_interface(device_t dev, struct
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:07:37 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_msk.c if_skreg.h

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

sys/dev/pci/if_msk.c: revision 1.94
sys/dev/pci/if_skreg.h: revision 1.27

 Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

 At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.


To generate a diff of this commit:
cvs rdiff -u -r1.91.2.1 -r1.91.2.2 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/dev/pci/if_skreg.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.91.2.1 src/sys/dev/pci/if_msk.c:1.91.2.2
--- src/sys/dev/pci/if_msk.c:1.91.2.1	Thu Oct 24 16:19:23 2019
+++ src/sys/dev/pci/if_msk.c	Tue Nov 19 13:07:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $ */
+/* $NetBSD: if_msk.c,v 1.91.2.2 2019/11/19 13:07:37 martin Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91.2.2 2019/11/19 13:07:37 martin Exp $");
 
 #include 
 #include 
@@ -887,10 +887,27 @@ void
 mskc_reset(struct sk_softc *sc)
 {
 	uint32_t imtimer_ticks, reg1;
+	uint16_t status;
 	int reg;
 
 	DPRINTFN(2, ("mskc_reset\n"));
 
+	/* Disable ASF */
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_SUPR)) {
+		CSR_WRITE_4(sc, SK_Y2_CPU_WDOG, 0);
+		status = CSR_READ_2(sc, SK_Y2_ASF_HCU_CCSR);
+		/* Clear AHB bridge & microcontroller reset. */
+		status &= ~(SK_Y2_ASF_HCU_CSSR_ARB_RST |
+		SK_Y2_ASF_HCU_CSSR_CPU_RST_MODE);
+		/* Clear ASF microcontroller state. */
+		status &= ~SK_Y2_ASF_HCU_CSSR_UC_STATE_MSK;
+		status &= ~SK_Y2_ASF_HCU_CSSR_CPU_CLK_DIVIDE_MSK;
+		CSR_WRITE_2(sc, SK_Y2_ASF_HCU_CCSR, status);
+		CSR_WRITE_4(sc, SK_Y2_CPU_WDOG, 0);
+	} else
+		CSR_WRITE_1(sc, SK_Y2_ASF_CSR, SK_Y2_ASF_RESET);
+	CSR_WRITE_2(sc, SK_CSR, SK_CSR_ASF_OFF);
+
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_SW_RESET);
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_MASTER_RESET);
 
@@ -963,10 +980,6 @@ mskc_reset(struct sk_softc *sc)
 	DPRINTFN(2, ("mskc_reset: sk_link_ctrl=%x\n",
 		 CSR_READ_2(sc, SK_LINK_CTRL)));
 
-	/* Disable ASF */
-	CSR_WRITE_1(sc, SK_Y2_ASF_CSR, SK_Y2_ASF_RESET);
-	CSR_WRITE_2(sc, SK_CSR, SK_CSR_ASF_OFF);
-
 	/* Clear I2C IRQ noise */
 	CSR_WRITE_4(sc, SK_I2CHWIRQ, 1);
 
@@ -1102,9 +1115,9 @@ msk_reset(struct sk_if_softc *sc_if)
 {
 	/* GMAC and GPHY Reset */
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_SET);
-	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
+	SK_IF_WRITE_1(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
 	DELAY(1000);
-	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_CLEAR);
+	SK_IF_WRITE_1(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_CLEAR);
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_LOOP_OFF |
 		  SK_GMAC_PAUSE_ON | SK_GMAC_RESET_CLEAR);
 }
@@ -2410,17 +2423,31 @@ msk_init_yukon(struct sk_if_softc *sc_if
 
 	/* Configure RX MAC FIFO */
 	SK_IF_WRITE_1(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_RESET_CLEAR);
-	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_OPERATION_ON |
-	SK_RFCTL_FIFO_FLUSH_ON);
-
-	/* Increase flush threshold to 64 bytes */
-	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD,
-	SK_RFCTL_FIFO_THRESHOLD + 1);
+	v =  SK_RFCTL_OPERATION_ON | SK_RFCTL_FIFO_FLUSH_ON;
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_FE_P))
+		v |= SK_RFCTL_RX_OVER_ON;
+	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, v);
+
+	if ((sc->sk_type == SK_YUKON_FE_P) &&
+	(sc->sk_rev == SK_YUKON_FE_P_REV_A0))
+		v = 0x178; /* Magic value */
+	else {
+		/* Increase flush threshold to 64 bytes */
+		v = SK_RFCTL_FIFO_THRESHOLD + 1;
+	}
+	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD, v);
 
 	/* Configure TX MAC FIFO */
 	SK_IF_WRITE_1(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_RESET_CLEAR);
 	SK_IF_WRITE_2(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_OPERATION_ON);
 
+	if ((sc->sk_type == SK_YUKON_FE_P) &&
+	(sc->sk_rev == SK_YUKON_FE_P_REV_A0)) {
+		v = SK_IF_READ_2(sc_if, 0, SK_TXMF1_END);
+		v &= ~SK_TXEND_WM_ON;
+		SK_IF_WRITE_2(sc_if, 0, SK_TXMF1_END, v);
+	}	
+
 #if 1
 	SK_YU_WRITE_2(sc_if, YUKON_GPCR, YU_GPCR_TXEN | YU_GPCR_RXEN);
 #endif
@@ -2457,7 +2484,7 @@ msk_init(struct ifnet *ifp)
 	/* Configure transmit arbiter(s) */
 	SK_IF_WRITE_1(sc_if, 0, SK_TXAR1_COUNTERCTL, SK_TXARCTL_ON);
 #if 0
-	SK_TXARCTL_ON | SK_TXARCTL_FSYNC_ON);
+/*	SK_TXARCTL_ON | SK_TXARCTL_FSYNC_ON); */
 #endif
 
 	if (sc->sk_ramsize) {
@@ -2565,6 +2592,13 @@ msk_init(struct ifnet *ifp)
 	SK_IF_WRITE_2(sc_if, 0, SK_RXQ1_Y2_PREF_PUTIDX,
 	sc_if->sk_cdata.sk_rx_prod);
 
+	
+	if 

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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:07:37 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_msk.c if_skreg.h

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

sys/dev/pci/if_msk.c: revision 1.94
sys/dev/pci/if_skreg.h: revision 1.27

 Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

 At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.


To generate a diff of this commit:
cvs rdiff -u -r1.91.2.1 -r1.91.2.2 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/dev/pci/if_skreg.h

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:04:44 UTC 2019

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

Log Message:
Regen for ticket #449


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.3 -r1.1371.2.4 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.3 -r1.1370.2.4 src/sys/dev/pci/pcidevs_data.h

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:03:32 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1388
sys/dev/pci/pcidevs: revision 1.1389
sys/dev/pci/pcidevs: revision 1.1390
sys/dev/pci/pcidevs: revision 1.1391

Spell controller correctly
 Add Realtek RTL8125.
- Update Intel's NVMe SSDs.
  - Modify 0x0953's description to "750 or DC P3[567]00 SSD"
  - Add DC P4[56]00
- Add Apollo Lake TXE HECI.
Add D-Link DGE-530T C1 and TP-Link TG-3468 v2.


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

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:03:32 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1388
sys/dev/pci/pcidevs: revision 1.1389
sys/dev/pci/pcidevs: revision 1.1390
sys/dev/pci/pcidevs: revision 1.1391

Spell controller correctly
 Add Realtek RTL8125.
- Update Intel's NVMe SSDs.
  - Modify 0x0953's description to "750 or DC P3[567]00 SSD"
  - Add DC P4[56]00
- Add Apollo Lake TXE HECI.
Add D-Link DGE-530T C1 and TP-Link TG-3468 v2.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.3 -r1.1383.2.4 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.1383.2.3 src/sys/dev/pci/pcidevs:1.1383.2.4
--- src/sys/dev/pci/pcidevs:1.1383.2.3	Thu Oct 24 16:12:42 2019
+++ src/sys/dev/pci/pcidevs	Tue Nov 19 13:03:32 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.3 2019/10/24 16:12:42 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.4 2019/11/19 13:03:32 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2513,6 +2513,7 @@ product DLINK DL4000		0x4000	DL-4000 Gig
 product DLINK DGE550SX		0x4001	DGE-550SX
 product DLINK DFE520TX		0x4200	DFE-520TX 10/100 Ethernet
 product DLINK DGE528T		0x4300	DGE-528T Gigabit Ethernet
+product DLINK DGE530T_C1	0x4302	DGE-530T C1
 product DLINK DGE560T		0x4b00	DGE-560T Gigabit Ethernet
 product DLINK DGE560T_2		0x4b01	DGE-560T_2 Gigabit Ethernet
 product DLINK DGE560SX		0x4b02	DGE-560SX
@@ -3117,7 +3118,7 @@ product INTEL X1000_HS_UART	0x0936	Quark
 product INTEL X1000_MAC		0x0937	Quark X1000 10/100 Ethernet MAC
 product INTEL X1000_EHCI	0x0939	Quark X1000 EHCI
 product INTEL X1000_OHCI	0x093a	Quark X1000 OHCI
-product INTEL PCIE_NVME_SSD	0x0953	PCIe NVMe SSD
+product INTEL PCIE_NVME_SSD	0x0953	750 or DC P3[567]00 SSD
 product INTEL X1000_HB		0x0958	Quark X1000 Host Bridge
 product INTEL WIFI_LINK_7265_1	0x095a	Dual Band Wireless AC 7265
 product INTEL WIFI_LINK_7265_2	0x095b	Dual Band Wireless AC 7265
@@ -3142,6 +3143,8 @@ product INTEL CORE4G_S_ULT_GT3	0x0a2a	HD
 product INTEL CORE4G_R_ULT_GT3_1 0x0a2b	HD Graphics
 product INTEL CORE4G_R_ULT_GT3_2 0x0a2e	Iris Graphics 5100
 product INTEL DC_P3520_SSD	0x0a53	SSD DC P3520
+product INTEL DC_P4500_SSD	0x0a54	SSD DC P4500
+product INTEL DC_P4600_SSD	0x0a55	SSD DC P4600
 product INTEL HASWELL_HOST_DRAM	0x0c00	Haswell Host Bridge, DRAM
 product INTEL HASWELL_PCIE16	0x0c01	Haswell PCI-E x16 Controller
 product INTEL HASWELL_PCIE8	0x0c05	Haswell PCI-E x8 Controller
@@ -4944,6 +4947,9 @@ product INTEL APL_P2SB		0x5a92	Apollo La
 product INTEL APL_PMC		0x5a94	Apollo Lake PMC
 product INTEL APL_FASTSPI	0x5a96	Apollo Lake Fast SPI
 product INTEL APL_HDA		0x5a98	Apollo Lake HD Audio
+product INTEL APL_TXE_HECI_1	0x5a9a	Apollo Lake TXE HECI1
+product INTEL APL_TXE_HECI_2	0x5a9c	Apollo Lake TXE HECI2
+product INTEL APL_TXE_HECI_3	0x5a9e	Apollo Lake TXE HECI3
 product INTEL APL_ISH		0x5aa2	Apollo Lake Integrated Sensor Hub
 product INTEL APL_XHCI		0x5aa8	Apollo Lake USB Host (xHCI)
 product INTEL APL_XDCI		0x5aaa	Apollo Lake USB Device (xDCI)
@@ -5960,6 +5966,9 @@ product MYRICOM MYRINET	0x8043	Myrinet
 /* Myson-Century Technology products */
 product MYSON MTD803	0x0803	MTD803 3-in-1 Fast Ethernet Controller
 
+/* Ncube products */
+product NCUBE TG3648	0x8168	TP-Link TG-3468 v2 Gigabit Ethernet
+
 /* National Datacomm products */
 product NDC NCP130		0x0130 NCP130 Wireless NIC
 product NDC NCP130A2		0x0131 NCP130 rev A2 Wireless NIC
@@ -6839,7 +6848,7 @@ product PROMISE PDC20271	0x6269	PDC20271
 product PROMISE PDC20617	0x6617	PDC20617 Dual Ultra/133 IDE Controller
 product PROMISE PDC20620	0x6620	PDC20620 Dual Ultra/133 IDE Controller
 product PROMISE PDC20621	0x6621	PDC20621 Dual Ultra/133 IDE Controller
-product PROMISE PDC20618	0x6626	PDC20618 Dual Ultra/133 IDE Controler
+product PROMISE PDC20618	0x6626	PDC20618 Dual Ultra/133 IDE Controller
 product PROMISE PDC20619	0x6629	PDC20619 Dual Ultra/133 IDE Controller
 product PROMISE PDC20277	0x7275	PDC20277 Ultra/133 IDE Controller
 
@@ -7031,6 +7040,7 @@ product REALTEK RTL8411		0x5289	RTL8411 
 product REALTEK RT8029		0x8029	8029 Ethernet
 product REALTEK RT8139D		0x8039	8139D 10/100 Ethernet
 product REALTEK RT8100		0x8100	8100 10/100 Ethernet
+product REALTEK RT8125		0x8125	8129 10/100/1G/2.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: [netbsd-9] src/sys/dev/pci

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:41:04 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by hauke in ticket #426):

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

The 16C1054 and 16C1058 serial multi-port controllers need a clock
multiplier of 8, just like the 16C1050 controller.

Verified with an ExSys EX-41388.
ryo@ checked back with the hardware his original commit was based on,
and confirmed the change.

XXX Pull-up to netbsd-{7,8,9}


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

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



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:41:04 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by hauke in ticket #426):

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

The 16C1054 and 16C1058 serial multi-port controllers need a clock
multiplier of 8, just like the 16C1050 controller.

Verified with an ExSys EX-41388.
ryo@ checked back with the hardware his original commit was based on,
and confirmed the change.

XXX Pull-up to netbsd-{7,8,9}


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.2.1 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.104 src/sys/dev/pci/pucdata.c:1.104.2.1
--- src/sys/dev/pci/pucdata.c:1.104	Thu May  2 21:33:12 2019
+++ src/sys/dev/pci/pucdata.c	Thu Nov 14 15:41:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.104 2019/05/02 21:33:12 jdolecek Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.104.2.1 2019/11/14 15:41:03 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.104 2019/05/02 21:33:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.104.2.1 2019/11/14 15:41:03 martin Exp $");
 
 #include 
 #include 
@@ -2883,10 +2883,10 @@ const struct puc_device_description puc_
 	{	PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1054, 0, 0 },
 	{	0x,	0x,		 0, 0 },
 	{
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8 },
 	},
 	},
 
@@ -2895,14 +2895,14 @@ const struct puc_device_description puc_
 	{   PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1058, 0, 0 },
 	{	0x,	0x,		 0, 0 },
 	{
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x20, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x28, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x30, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x38, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x20, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x28, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x30, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x38, COM_FREQ * 8 },
 	},
 	},
 



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:30:19 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5	Tue Oct  8 17:05:16 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Nov 14 15:30:19 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.5 2019/10/08 17:05:16 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.6 2019/11/14 15:30:19 martin Exp $*/
 
 /**
 
@@ -1920,7 +1920,8 @@ ixv_initialize_receive_units(struct adap
 			adapter->num_rx_desc - 1);
 	}
 
-	ixv_initialize_rss_mapping(adapter);
+	if (adapter->hw.mac.type >= ixgbe_mac_X550_vf)
+		ixv_initialize_rss_mapping(adapter);
 } /* ixv_initialize_receive_units */
 
 /



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:30:19 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


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

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:05:15 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by nisimura in ticket #406):

sys/dev/pci/if_kse.c: revision 1.40
sys/dev/pci/if_kse.c: revision 1.41
sys/dev/pci/if_kse.c: revision 1.39

comment touchup

 -

clarify 8842 MAC behaves 100FDX only has no alternative media selection
possible.

 -

major rework to fix link control breakage


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

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:05:15 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by nisimura in ticket #406):

sys/dev/pci/if_kse.c: revision 1.40
sys/dev/pci/if_kse.c: revision 1.41
sys/dev/pci/if_kse.c: revision 1.39

comment touchup

 -

clarify 8842 MAC behaves 100FDX only has no alternative media selection
possible.

 -

major rework to fix link control breakage


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

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

Modified files:

Index: src/sys/dev/pci/if_kse.c
diff -u src/sys/dev/pci/if_kse.c:1.38 src/sys/dev/pci/if_kse.c:1.38.2.1
--- src/sys/dev/pci/if_kse.c:1.38	Wed May 29 10:07:29 2019
+++ src/sys/dev/pci/if_kse.c	Sun Nov 10 13:05:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kse.c,v 1.38 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: if_kse.c,v 1.38.2.1 2019/11/10 13:05:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,9 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.38 2019/05/29 10:07:29 msaitoh Exp $");
+/*
+ * Micrel 8841/8842 10/100 ethernet driver
+ */
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.38.2.1 2019/11/10 13:05:15 martin Exp $");
 
 #include 
 #include 
@@ -58,6 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1
 #include 
 #include 
 
+#define KSE_LINKDEBUG 0
+
 #define CSR_READ_4(sc, off) \
 	bus_space_read_4(sc->sc_st, sc->sc_sh, off)
 #define CSR_WRITE_4(sc, off, val) \
@@ -93,6 +98,17 @@ __KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1
 #define P1SR	0x514	/* port 1 status */
 #define P2CR4	0x532	/* port 2 control 4 */
 #define P2SR	0x534	/* port 2 status */
+#define PxCR_STARTNEG	(1U << 9)	/* restart auto negotiation */
+#define PxCR_AUTOEN	(1U << 7)	/* auto negotiation enable */
+#define PxCR_SPD100	(1U << 6)	/* force speed 100 */
+#define PxCR_USEFDX	(1U << 5)	/* force full duplex */
+#define PxCR_USEFC	(1U << 4)	/* advertise pause flow control */
+#define PxSR_ACOMP	(1U << 6)	/* auto negotiation completed */
+#define PxSR_SPD100	(1U << 10)	/* speed is 100Mbps */
+#define PxSR_FDX	(1U << 9)	/* full duplex */
+#define PxSR_LINKUP	(1U << 5)	/* link is good */
+#define PxSR_RXFLOW	(1U << 12)	/* receive flow control active */
+#define PxSR_TXFLOW	(1U << 11)	/* transmit flow control active */
 
 #define TXC_BS_MSK	0x3f00	/* burst size */
 #define TXC_BS_SFT	(24)		/* 1,2,4,8,16,32 or 0 for unlimited */
@@ -207,8 +223,8 @@ struct kse_softc {
 	void *sc_ih;			/* interrupt cookie */
 
 	struct ifmedia sc_media;	/* ifmedia information */
-	int sc_media_status;		/* PHY */
-	int sc_media_active;		/* PHY */
+	int sc_linkstatus;		/* last P1SR register value */
+
 	callout_t  sc_callout;		/* MII tick callout */
 	callout_t  sc_stat_ch;		/* statistics counter callout */
 
@@ -313,11 +329,10 @@ static int kse_intr(void *);
 static void rxintr(struct kse_softc *);
 static void txreap(struct kse_softc *);
 static void lnkchg(struct kse_softc *);
-static int ifmedia_upd(struct ifnet *);
-static void ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int ksephy_change(struct ifnet *);
+static void ksephy_status(struct ifnet *, struct ifmediareq *);
+static void nopifm_status(struct ifnet *, struct ifmediareq *);
 static void phy_tick(void *);
-static int ifmedia2_upd(struct ifnet *);
-static void ifmedia2_sts(struct ifnet *, struct ifmediareq *);
 #ifdef KSE_EVENT_COUNTERS
 static void stat_tick(void *);
 static void zerostats(struct kse_softc *);
@@ -493,8 +508,9 @@ kse_attach(device_t parent, device_t sel
 	/* Initialize ifmedia structures. */
 	ifm = >sc_media;
 	sc->sc_ethercom.ec_ifmedia = ifm;
+	sc->sc_linkstatus = 0;
 	if (sc->sc_chip == 0x8841) {
-		ifmedia_init(ifm, 0, ifmedia_upd, ifmedia_sts);
+		ifmedia_init(ifm, 0, ksephy_change, ksephy_status);
 		ifmedia_add(ifm, IFM_ETHER | IFM_10_T, 0, NULL);
 		ifmedia_add(ifm, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL);
 		ifmedia_add(ifm, IFM_ETHER | IFM_100_TX, 0, NULL);
@@ -502,9 +518,18 @@ kse_attach(device_t parent, device_t sel
 		ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
 		ifmedia_set(ifm, IFM_ETHER | IFM_AUTO);
 	} else {
-		ifmedia_init(ifm, 0, ifmedia2_upd, ifmedia2_sts);
-		ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
-		ifmedia_set(ifm, IFM_ETHER | IFM_AUTO);
+		/*
+		 * pretend 100FDX w/ no alternative media selection.
+		 * 8842 MAC is tied with a builtin 3 port switch.
+		 * It can do rate control over either of tx / rx direction
+		 * respectively, tough, this driver leaves the rate unlimited
+		 * intending 100Mbps maximum.
+		 * 2 ports behave in AN mode and this driver provides no mean
+		 * to see the exact details.
+		 */
+		ifmedia_init(ifm, 0, NULL, nopifm_status);
+		ifmedia_add(ifm, IFM_ETHER | IFM_100_TX | 

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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 10:07:42 UTC 2019

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

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

sys/dev/pci/if_wm.c: revision 1.646
sys/dev/pci/if_wm.c: revision 1.647
sys/dev/pci/if_wm.c: revision 1.649

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

printf -> device_printf

Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.645.2.1 src/sys/dev/pci/if_wm.c

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



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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 10:07:42 UTC 2019

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

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

sys/dev/pci/if_wm.c: revision 1.646
sys/dev/pci/if_wm.c: revision 1.647
sys/dev/pci/if_wm.c: revision 1.649

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

printf -> device_printf

Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.645.2.1 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645 src/sys/dev/pci/if_wm.c:1.645.2.1
--- src/sys/dev/pci/if_wm.c:1.645	Tue Jul 30 04:42:29 2019
+++ src/sys/dev/pci/if_wm.c	Wed Nov  6 10:07:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645 2019/07/30 04:42:29 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645 2019/07/30 04:42:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4616,8 +4616,8 @@ wm_flush_desc_rings(struct wm_softc *sc)
 		return;
 
 	/* TX */
-	printf("%s: Need TX flush (reg = %08x, len = %u)\n",
-	device_xname(sc->sc_dev), preg, reg);
+	device_printf(sc->sc_dev, "Need TX flush (reg = %08x, len = %u)\n",
+	preg, reg);
 	reg = CSR_READ(sc, WMREG_TCTL);
 	CSR_WRITE(sc, WMREG_TCTL, reg | TCTL_EN);
 
@@ -4644,8 +4644,7 @@ wm_flush_desc_rings(struct wm_softc *sc)
 		return;
 
 	/* RX */
-	printf("%s: Need RX flush (reg = %08x)\n",
-	device_xname(sc->sc_dev), preg);
+	device_printf(sc->sc_dev, "Need RX flush (reg = %08x)\n", preg);
 	rctl = CSR_READ(sc, WMREG_RCTL);
 	CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
 	CSR_WRITE_FLUSH(sc);
@@ -4885,7 +4884,7 @@ wm_reset(struct wm_softc *sc)
 			reg |= CTRL_PHY_RESET;
 			phy_reset = 1;
 		} else
-			printf("XXX reset is blocked!!!\n");
+			device_printf(sc->sc_dev, "XXX reset is blocked!!!\n");
 		sc->phy.acquire(sc);
 		CSR_WRITE(sc, WMREG_CTRL, reg);
 		/* Don't insert a completion barrier when reset */
@@ -9033,7 +9032,8 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
  * Fiber?
  * Shoud not enter here.
  */
-printf("unknown media (%x)\n", active);
+device_printf(dev, "unknown media (%x)\n",
+active);
 break;
 			}
 			if (active & IFM_FDX)
@@ -9893,7 +9893,7 @@ wm_gmii_reset(struct wm_softc *sc)
  * result might be incorrect.
  *
  *  In the second call, PHY OUI and model is used to identify PHY type.
- * It might not be perfpect because of the lack of compared entry, but it
+ * It might not be perfect because of the lack of compared entry, but it
  * would be better than the first call.
  *
  *  If the detected new result and previous assumption is different,
@@ -10413,7 +10413,7 @@ wm_i82543_mii_sendbits(struct wm_softc *
 	v &= ~(MDI_IO | MDI_CLK | (CTRL_SWDPIO_MASK << CTRL_SWDPIO_SHIFT));
 	v |= MDI_DIR | CTRL_SWDPIO(3);
 
-	for (i = 1 << (nbits - 1); i != 0; i >>= 1) {
+	for (i = __BIT(nbits - 1); i != 0; i >>= 1) {
 		if (data & i)
 			v |= MDI_IO;
 		else
@@ -11137,7 +11137,7 @@ wm_gmii_hv_readreg_locked(device_t dev, 
 	 * own func
 	 */
 	if ((page > 0) && (page < HV_INTC_FC_PAGE_START)) {
-		printf("gmii_hv_readreg!!!\n");
+		device_printf(dev, "gmii_hv_readreg!!!\n");
 		return -1;
 	}
 
@@ -11205,7 +11205,7 @@ wm_gmii_hv_writereg_locked(device_t dev,
 	 * own func
 	 */
 	if ((page > 0) && (page < HV_INTC_FC_PAGE_START)) {
-		printf("gmii_hv_writereg!!!\n");
+		device_printf(dev, "gmii_hv_writereg!!!\n");
 		return -1;
 	}
 
@@ -11229,7 +11229,7 @@ wm_gmii_hv_writereg_locked(device_t dev,
 			if ((child != NULL) && (child->mii_mpd_rev >= 1)
 			&& (phy == 2) && ((regnum & MII_ADDRMASK) == 0)
 			&& ((val & (1 << 11)) != 0)) {
-printf("XXX need workaround\n");
+device_printf(dev, "XXX need workaround\n");
 			}
 		}
 
@@ -12851,12 +12851,12 @@ wm_ich8_cycle_init(struct wm_softc *sc)
 	/*
 	 * Either we should have a hardware SPI cycle in progress bit to check
 	 * against, in order to start a new cycle or FDONE bit should be
-	 * changed in the hardware so that it is 1 after harware reset, which
+	 * changed in the hardware so that it is 1 after hardware reset, which
 	 * can then be used as an indication whether a cycle is in progress or
 	 * has been completed .. we should also have some software semaphore
 	 * mechanism to guard FDONE or the cycle in progress bit so that two
 	 * threads access to those bits can be sequentiallized or a way so that
-	 * 2 threads dont start the cycle at the same time
+	 * 2 threads don't start the cycle at the same time
 	 */
 
 	

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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 09:52:20 UTC 2019

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

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

sys/dev/pci/pci.c: revision 1.156

PCIe downstream ports only have a single child device, so limit probing to
dev 0.


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

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



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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 09:52:20 UTC 2019

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

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

sys/dev/pci/pci.c: revision 1.156

PCIe downstream ports only have a single child device, so limit probing to
dev 0.


To generate a diff of this commit:
cvs rdiff -u -r1.154.4.1 -r1.154.4.2 src/sys/dev/pci/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/pci.c
diff -u src/sys/dev/pci/pci.c:1.154.4.1 src/sys/dev/pci/pci.c:1.154.4.2
--- src/sys/dev/pci/pci.c:1.154.4.1	Tue Oct 15 19:33:23 2019
+++ src/sys/dev/pci/pci.c	Wed Nov  6 09:52:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $	*/
+/*	$NetBSD: pci.c,v 1.154.4.2 2019/11/06 09:52:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.2 2019/11/06 09:52:20 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -695,17 +695,26 @@ pci_enumerate_bus(struct pci_softc *sc, 
 
 	device_t bridgedev;
 	bool arien = false;
+	bool downstream_port = false;
 
-	/* Check PCIe ARI */
+	/* Check PCIe ARI and port type */
 	bridgedev = device_parent(sc->sc_dev);
 	if (device_is_a(bridgedev, "ppb")) {
 		struct ppb_softc *ppbsc = device_private(bridgedev);
 		pci_chipset_tag_t ppbpc = ppbsc->sc_pc;
 		pcitag_t ppbtag = ppbsc->sc_tag;
-		pcireg_t pciecap, reg;
+		pcireg_t pciecap, capreg, reg;
 
 		if (pci_get_capability(ppbpc, ppbtag, PCI_CAP_PCIEXPRESS,
-		, NULL) != 0) {
+		, ) != 0) {
+			switch (PCIE_XCAP_TYPE(capreg)) {
+			case PCIE_XCAP_TYPE_ROOT:
+			case PCIE_XCAP_TYPE_DOWN:
+			case PCIE_XCAP_TYPE_PCI2PCIE:
+downstream_port = true;
+break;
+			}
+
 			reg = pci_conf_read(ppbpc, ppbtag, pciecap
 			+ PCIE_DCSR2);
 			if ((reg & PCIE_DCSR2_ARI_FWD) != 0)
@@ -714,6 +723,11 @@ pci_enumerate_bus(struct pci_softc *sc, 
 	}
 
 	n = pci_bus_devorder(sc->sc_pc, sc->sc_bus, devs, __arraycount(devs));
+	if (downstream_port) {
+		/* PCIe downstream ports only have a single child device */
+		n = 1;
+	}
+
 	for (i = 0; i < n; i++) {
 		device = devs[i];
 



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:25:33 UTC 2019

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

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

sys/dev/pci/if_jme.c: revision 1.46

A * is missing here. This could cause a use-after-free.
Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/dev/pci/if_jme.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_jme.c
diff -u src/sys/dev/pci/if_jme.c:1.44 src/sys/dev/pci/if_jme.c:1.44.2.1
--- src/sys/dev/pci/if_jme.c:1.44	Tue Jul  9 08:46:59 2019
+++ src/sys/dev/pci/if_jme.c	Thu Oct 24 16:25:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_jme.c,v 1.44 2019/07/09 08:46:59 msaitoh Exp $	*/
+/*	$NetBSD: if_jme.c,v 1.44.2.1 2019/10/24 16:25:33 martin Exp $	*/
 
 /*
  * Copyright (c) 2008 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.44 2019/07/09 08:46:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.44.2.1 2019/10/24 16:25:33 martin Exp $");
 
 
 #include 
@@ -1453,7 +1453,7 @@ jme_encap(struct jme_softc *sc, struct m
 			"DMA segments, dropping...\n",
 			device_xname(sc->jme_dev));
 			m_freem(*m_head);
-			m_head = NULL;
+			*m_head = NULL;
 		}
 		return (error);
 	}



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:25:33 UTC 2019

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

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

sys/dev/pci/if_jme.c: revision 1.46

A * is missing here. This could cause a use-after-free.
Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/dev/pci/if_jme.c

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



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:19:23 UTC 2019

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

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

sys/dev/pci/if_msk.c: revision 1.92

Fix order of m_freem(). Found by kASan. OK'd by jdolecek and mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/sys/dev/pci/if_msk.c

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



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:19:23 UTC 2019

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

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

sys/dev/pci/if_msk.c: revision 1.92

Fix order of m_freem(). Found by kASan. OK'd by jdolecek and mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.91 src/sys/dev/pci/if_msk.c:1.91.2.1
--- src/sys/dev/pci/if_msk.c:1.91	Mon Jun  3 05:22:57 2019
+++ src/sys/dev/pci/if_msk.c	Thu Oct 24 16:19:23 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.91 2019/06/03 05:22:57 msaitoh Exp $ */
+/* $NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91 2019/06/03 05:22:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $");
 
 #include 
 #include 
@@ -2118,9 +2118,6 @@ msk_txeof(struct sk_if_softc *sc_if)
 		if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) {
 			entry = sc_if->sk_cdata.sk_tx_map[idx];
 
-			m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
-			sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
-
 			bus_dmamap_sync(sc->sc_dmatag, entry->dmamap, 0,
 			entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
 
@@ -2128,6 +2125,8 @@ msk_txeof(struct sk_if_softc *sc_if)
 			SIMPLEQ_INSERT_TAIL(_if->sk_txmap_head, entry,
 	  link);
 			sc_if->sk_cdata.sk_tx_map[idx] = NULL;
+			m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
+			sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
 		}
 		sc_if->sk_cdata.sk_tx_cnt--;
 		SK_INC(idx, MSK_TX_RING_CNT);
@@ -2646,13 +2645,19 @@ msk_stop(struct ifnet *ifp, int disable)
 
 	for (i = 0; i < MSK_TX_RING_CNT; i++) {
 		if (sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf != NULL) {
-			m_freem(sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf);
-			sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
+			dma = sc_if->sk_cdata.sk_tx_map[i];
+
+			bus_dmamap_sync(sc->sc_dmatag, dma->dmamap, 0,
+			dma->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+
+			bus_dmamap_unload(sc->sc_dmatag, dma->dmamap);
 #if 1
 			SIMPLEQ_INSERT_HEAD(_if->sk_txmap_head,
 			sc_if->sk_cdata.sk_tx_map[i], link);
 			sc_if->sk_cdata.sk_tx_map[i] = 0;
 #endif
+			m_freem(sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf);
+			sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
 		}
 	}
 



  1   2   >