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

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

Modified Files:
src/sys/dev/pci [netbsd-8]: files.pci
src/sys/dev/pci/ixgbe [netbsd-8]: 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 #1796:

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.388.4.7 -r1.388.4.8 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.24.2.26 -r1.24.2.27 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.53 -r1.88.2.54 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.8.8.7 -r1.8.8.8 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.15.8.8 -r1.15.8.9 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.13.2.12 -r1.13.2.13 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.6.5 -r1.7.6.6 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.56.2.39 -r1.56.2.40 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

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

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

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.508.4.47 -r1.508.4.48 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.15 -r1.98.6.16 src/sys/dev/pci/if_wmreg.h

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



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

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

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

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

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.508.4.47 -r1.508.4.48 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.15 -r1.98.6.16 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.47 src/sys/dev/pci/if_wm.c:1.508.4.48
--- src/sys/dev/pci/if_wm.c:1.508.4.47	Thu Sep  8 10:29:36 2022
+++ src/sys/dev/pci/if_wm.c	Mon Jan 23 14:01:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.47 2022/09/08 10:29:36 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.48 2023/01/23 14:01:25 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.47 2022/09/08 10:29:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.48 2023/01/23 14:01:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -487,6 +487,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 */
@@ -2263,7 +2264,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
@@ -3633,7 +3634,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);
@@ -3794,9 +3795,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
@@ -4093,7 +4094,7 @@ wm_read_mac_addr(struct wm_softc *sc, ui
 
 	return 0;
 
- bad:
+bad:
 	return -1;
 }
 
@@ -4378,11 +4379,11 @@ wm_set_filter(struct wm_softc *sc)
 	ifp->if_flags &= ~IFF_ALLMULTI;
 	goto setit;
 
- allmulti:
+allmulti:
 	ifp->if_flags |= IFF_ALLMULTI;
 	sc->sc_rctl |= RCTL_MPE;
 
- setit:
+setit:
 	CSR_WRITE(sc, WMREG_RCTL, sc->sc_rctl);
 }
 
@@ -4750,7 +4751,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__));
 		wm_write_smbus_addr(sc);
 
@@ -5056,15 +5058,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);
@@ -5468,6 +5470,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:
@@ -6091,7 +6098,7 @@ wm_setup_msix(struct wm_softc *sc)

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

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

Modified Files:
src/sys/dev/pci [netbsd-8]: files.pci
src/sys/dev/pci/ixgbe [netbsd-8]: 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 #1796:

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.388.4.7 -r1.388.4.8 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.24.2.26 -r1.24.2.27 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.53 -r1.88.2.54 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.8.8.7 -r1.8.8.8 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.15.8.8 -r1.15.8.9 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.13.2.12 -r1.13.2.13 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.6.5 -r1.7.6.6 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.56.2.39 -r1.56.2.40 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.388.4.7 src/sys/dev/pci/files.pci:1.388.4.8
--- src/sys/dev/pci/files.pci:1.388.4.7	Sat Oct 23 11:49:22 2021
+++ src/sys/dev/pci/files.pci	Mon Jan 23 14:07:24 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.388.4.7 2021/10/23 11:49:22 martin Exp $
+#	$NetBSD: files.pci,v 1.388.4.8 2023/01/23 14:07:24 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -687,6 +687,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.24.2.26 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.27
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.26	Fri Jun  3 12:31:09 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon Jan 23 14:07:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.27 2023/01/23 14:07:24 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.27 2023/01/23 14:07:24 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.88.2.53 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.54
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.53	Mon Jun  6 11:09:16 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 23 14:07:24 2023
@@ -1,4 +1,4 @@
-/* 

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

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

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

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

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.52.6.3 -r1.52.6.4 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.7.22.2 -r1.7.22.3 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-8] src/sys/dev/pci

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

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

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

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.52.6.3 -r1.52.6.4 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.7.22.2 -r1.7.22.3 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.52.6.3 src/sys/dev/pci/piixpm.c:1.52.6.4
--- src/sys/dev/pci/piixpm.c:1.52.6.3	Tue Nov 30 11:48:29 2021
+++ src/sys/dev/pci/piixpm.c	Mon Jan 23 12:46:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.52.6.3 2021/11/30 11:48:29 martin Exp $ */
+/* $NetBSD: piixpm.c,v 1.52.6.4 2023/01/23 12:46:14 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.52.6.3 2021/11/30 11:48:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.52.6.4 2023/01/23 12:46:14 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-8] src/sys/dev/pci

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

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

Log Message:
Regen for ticket #1783


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.23 -r1.1281.2.24 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.23 -r1.1280.2.24 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

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

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

Log Message:
Regen for ticket #1783


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.23 -r1.1281.2.24 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.23 -r1.1280.2.24 src/sys/dev/pci/pcidevs_data.h

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



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

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

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

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

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.1289.2.23 -r1.1289.2.24 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.14.2.1 -r1.14.2.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.1289.2.23 src/sys/dev/pci/pcidevs:1.1289.2.24
--- src/sys/dev/pci/pcidevs:1.1289.2.23	Tue Oct 11 17:57:17 2022
+++ src/sys/dev/pci/pcidevs	Wed Jan 18 19:31:43 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.23 2022/10/11 17:57:17 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.24 2023/01/18 19:31:43 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	Family16h 

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

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

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

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

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.1289.2.23 -r1.1289.2.24 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.14.2.1 -r1.14.2.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-8] src/sys/dev/pci

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

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

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

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.50.6.5 -r1.50.6.6 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.50.6.5 src/sys/dev/pci/ichsmb.c:1.50.6.6
--- src/sys/dev/pci/ichsmb.c:1.50.6.5	Fri Dec  3 17:54:30 2021
+++ src/sys/dev/pci/ichsmb.c	Sat Oct 15 10:33:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.5 2021/12/03 17:54:30 martin Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.50.6.6 2022/10/15 10:33:42 martin Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.5 2021/12/03 17:54:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.6 2022/10/15 10:33:42 martin Exp $");
 
 #include 
 #include 
@@ -145,6 +145,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-8] src/sys/dev/pci

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

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

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

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.50.6.5 -r1.50.6.6 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-8] src/sys/dev/pci

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

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

Log Message:
regen (Ticket #1771)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.22 -r1.1281.2.23 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.22 -r1.1280.2.23 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

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

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

Log Message:
regen (Ticket #1771)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.22 -r1.1281.2.23 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.22 -r1.1280.2.23 src/sys/dev/pci/pcidevs_data.h

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



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

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

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

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

sys/dev/pci/pcidevs 1.1461-1.1468 via patch

- Add several samsung nvme entries.
- Add more Alder Lake devices.
- Jasper Lake Intel Trace Hub on Compute Die is not 0x4da6 but 0x4e29.
- Add Intel Core 8G (8core, H, Halo) Host Bridge, DRAM.
- Add AMD 19h/6xh Root Complex.
- Add AMD FCH SATA Controller D.
- Add NVIDIA GeForce GTX 770.
- Sort by number.


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

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



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

2022-09-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Sep 29 14:41:43 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1768):
sys/dev/pci/mfii.c: 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.3.2.6 -r1.3.2.7 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-8] src/sys/dev/pci

2022-09-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Sep 29 14:41:43 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1768):
sys/dev/pci/mfii.c: 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.3.2.6 -r1.3.2.7 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.3.2.6 src/sys/dev/pci/mfii.c:1.3.2.7
--- src/sys/dev/pci/mfii.c:1.3.2.6	Fri Sep 16 18:30:15 2022
+++ src/sys/dev/pci/mfii.c	Thu Sep 29 14:41:43 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.3.2.6 2022/09/16 18:30:15 martin Exp $ */
+/* $NetBSD: mfii.c,v 1.3.2.7 2022/09/29 14:41:43 snj Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.6 2022/09/16 18:30:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.7 2022/09/29 14:41:43 snj Exp $");
 
 #include "bio.h"
 
@@ -654,7 +654,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;
@@ -704,12 +704,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))
@@ -818,7 +818,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-8] src/sys/dev/pci

2022-09-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Sep 29 14:38:24 UTC 2022

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

Log Message:
Apply patch (requested by bouyer in ticket #1767):
Convert from pci_intr_map() to pci_intr_alloc(); makes the driver use
MSI/MSI-x when available.


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

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

Modified files:

Index: src/sys/dev/pci/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.8.10.6 src/sys/dev/pci/mpii.c:1.8.10.7
--- src/sys/dev/pci/mpii.c:1.8.10.6	Sun Aug  9 14:17:48 2020
+++ src/sys/dev/pci/mpii.c	Thu Sep 29 14:38:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.6 2020/08/09 14:17:48 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.7 2022/09/29 14:38:24 snj Exp $ */
 /*	OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.6 2020/08/09 14:17:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.7 2022/09/29 14:38:24 snj Exp $");
 
 #include "bio.h"
 
@@ -168,6 +168,7 @@ struct mpii_softc {
 	pcitag_t		sc_tag;
 
 	void			*sc_ih;
+	pci_intr_handle_t	*sc_pihp;
 
 	struct scsipi_adapter	sc_adapt;
 	struct scsipi_channel	sc_chan;
@@ -459,7 +460,6 @@ mpii_attach(device_t parent, device_t se
 	struct pci_attach_args		*pa = aux;
 	pcireg_t			memtype;
 	intr;
-	pci_intr_handle_t		ih;
 	struct mpii_ccb			*ccb;
 	struct scsipi_adapter *adapt = >sc_adapt;
 	struct scsipi_channel *chan = >sc_chan;
@@ -506,13 +506,14 @@ mpii_attach(device_t parent, device_t se
 	MPII_INTR_MASK_DOORBELL);
 
 	/* hook up the interrupt */
-	if (pci_intr_map(pa, ) != 0) {
+	if (pci_intr_alloc(pa, >sc_pihp, NULL, 0)) {
 		aprint_error_dev(self, "unable to map interrupt\n");
 		goto unmap;
 	}
-	intrstr = pci_intr_string(pa->pa_pc, ih, intrbuf, sizeof(intrbuf));
-	pci_intr_setattr(pa->pa_pc, , PCI_INTR_MPSAFE, true);
-	sc->sc_ih = pci_intr_establish_xname(pa->pa_pc, ih, IPL_BIO,
+	intrstr = pci_intr_string(pa->pa_pc, sc->sc_pihp[0],
+	intrbuf, sizeof(intrbuf));
+	pci_intr_setattr(pa->pa_pc, >sc_pihp[0], PCI_INTR_MPSAFE, true);
+	sc->sc_ih = pci_intr_establish_xname(pa->pa_pc, sc->sc_pihp[0], IPL_BIO,
 	mpii_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");



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

2022-09-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Sep 29 14:38:24 UTC 2022

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

Log Message:
Apply patch (requested by bouyer in ticket #1767):
Convert from pci_intr_map() to pci_intr_alloc(); makes the driver use
MSI/MSI-x when available.


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

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



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

2022-09-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  8 10:29:36 UTC 2022

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

Log Message:
Undo accidental whitespace changes from applying the patch for
ticket #1759 by applying a patch from msaitoh (NFC).


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.46 src/sys/dev/pci/if_wm.c:1.508.4.47
--- src/sys/dev/pci/if_wm.c:1.508.4.46	Wed Sep  7 10:09:20 2022
+++ src/sys/dev/pci/if_wm.c	Thu Sep  8 10:29:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.46 2022/09/07 10:09:20 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.47 2022/09/08 10:29:36 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.46 2022/09/07 10:09:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.47 2022/09/08 10:29:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3168,16 +3168,16 @@ alloc_retry:
 	NULL, xname, "linkintr");
 
 	if (sc->sc_type >= WM_T_82542_2_1) {
-	evcnt_attach_dynamic(>sc_ev_tx_xoff, EVCNT_TYPE_MISC,
-	NULL, xname, "tx_xoff");
-	evcnt_attach_dynamic(>sc_ev_tx_xon, EVCNT_TYPE_MISC,
-	NULL, xname, "tx_xon");
-	evcnt_attach_dynamic(>sc_ev_rx_xoff, EVCNT_TYPE_MISC,
-	NULL, xname, "rx_xoff");
-	evcnt_attach_dynamic(>sc_ev_rx_xon, EVCNT_TYPE_MISC,
-	NULL, xname, "rx_xon");
-	evcnt_attach_dynamic(>sc_ev_rx_macctl, EVCNT_TYPE_MISC,
-	NULL, xname, "rx_macctl");
+		evcnt_attach_dynamic(>sc_ev_tx_xoff, EVCNT_TYPE_MISC,
+		NULL, xname, "tx_xoff");
+		evcnt_attach_dynamic(>sc_ev_tx_xon, EVCNT_TYPE_MISC,
+		NULL, xname, "tx_xon");
+		evcnt_attach_dynamic(>sc_ev_rx_xoff, EVCNT_TYPE_MISC,
+		NULL, xname, "rx_xoff");
+		evcnt_attach_dynamic(>sc_ev_rx_xon, EVCNT_TYPE_MISC,
+		NULL, xname, "rx_xon");
+		evcnt_attach_dynamic(>sc_ev_rx_macctl, EVCNT_TYPE_MISC,
+		NULL, xname, "rx_macctl");
 	}
 
 	evcnt_attach_dynamic(>sc_ev_crcerrs, EVCNT_TYPE_MISC,
@@ -3359,11 +3359,11 @@ wm_detach(device_t self, int flags __unu
 	evcnt_detach(>sc_ev_linkintr);
 
 	if (sc->sc_type >= WM_T_82542_2_1) {
-	evcnt_detach(>sc_ev_tx_xoff);
-	evcnt_detach(>sc_ev_tx_xon);
-	evcnt_detach(>sc_ev_rx_xoff);
-	evcnt_detach(>sc_ev_rx_xon);
-	evcnt_detach(>sc_ev_rx_macctl);
+		evcnt_detach(>sc_ev_tx_xoff);
+		evcnt_detach(>sc_ev_tx_xon);
+		evcnt_detach(>sc_ev_rx_xoff);
+		evcnt_detach(>sc_ev_rx_xon);
+		evcnt_detach(>sc_ev_rx_macctl);
 	}
 
 	evcnt_detach(>sc_ev_crcerrs);



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

2022-09-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  8 10:29:36 UTC 2022

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

Log Message:
Undo accidental whitespace changes from applying the patch for
ticket #1759 by applying a patch from msaitoh (NFC).


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

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



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

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

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

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

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.508.4.45 -r1.508.4.46 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.14 -r1.98.6.15 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.45 src/sys/dev/pci/if_wm.c:1.508.4.46
--- src/sys/dev/pci/if_wm.c:1.508.4.45	Mon Jul 11 14:15:57 2022
+++ src/sys/dev/pci/if_wm.c	Wed Sep  7 10:09:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.45 2022/07/11 14:15:57 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.46 2022/09/07 10:09:20 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.45 2022/07/11 14:15:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.46 2022/09/07 10:09:20 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -90,26 +90,24 @@ __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 
@@ -495,7 +493,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);
@@ -504,7 +502,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 *);
 };
@@ -593,12 +591,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;	/* Broadcast Packets Tx Count */
+	struct evcnt sc_ev_prc64;	/* Packets Rx (64 

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

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

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

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

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.508.4.45 -r1.508.4.46 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.14 -r1.98.6.15 src/sys/dev/pci/if_wmreg.h

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



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

2022-08-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug  2 15:43:54 UTC 2022

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

Log Message:
regen for ticket 1754


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.21 -r1.1281.2.22 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.21 -r1.1280.2.22 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2022-08-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug  2 15:43:54 UTC 2022

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

Log Message:
regen for ticket 1754


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.21 -r1.1281.2.22 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.21 -r1.1280.2.22 src/sys/dev/pci/pcidevs_data.h

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



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

2022-08-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug  2 15:41:46 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1754):
sys/dev/pci/pcidevs: 1.1445-1.1460 via patch
Update pcidevs:
- Add Intel Alder Lake devices and Intel 600 Series PCH devices.
- Add some Intel Xeon Scalable / Skylake-E devices.
- Fix AMD F16_HB from 0x1568 to 0x1538.
- Add some devices for AMD and improve some descriptions to clarify.
- Add VMware AHCI and NVMe.
- Update Intel 700 series Ethernet devices.
- Add some Broadcom devices.
- Add some Broadcom / LSI RAID cards.
- Fix typos and whitespace.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.21 src/sys/dev/pci/pcidevs:1.1289.2.22
--- src/sys/dev/pci/pcidevs:1.1289.2.21	Fri Dec  3 17:38:16 2021
+++ src/sys/dev/pci/pcidevs	Tue Aug  2 15:41:46 2022
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.21 2021/12/03 17:38:16 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.22 2022/08/02 15:41:46 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -225,7 +225,7 @@ vendor DIGICOM		0x10ab	Digicom
 vendor HONEYWELL	0x10ac	Honeywell IASD
 vendor SYMPHONY		0x10ad	Symphony Labs
 vendor CORNERSTONE	0x10ae	Cornerstone Technology
-vendor MICROCOMPSON	0x10af	Micro Computer Sysytems (M) SON
+vendor MICROCOMPSON	0x10af	Micro Computer Systems (M) SON
 vendor CARDEXPER	0x10b0	CardExpert Technology
 vendor CABLETRON	0x10b1	Cabletron Systems
 vendor RAYETHON		0x10b2	Raytheon
@@ -1007,6 +1007,22 @@ product AMD F15_30_HB		0x1424	Family15h 
 product AMD F15_30_RP_5		0x1425	Family15h Root Port
 product AMD F15_30_RP_6		0x1426	Family15h Root Port
 product AMD F16_GPPB		0x1439	Family16h GPP Bridge
+product AMD F17_7X_DF_1		0x1440	17h/7xh Data Fabric
+product AMD F17_7X_DF_2		0x1441	17h/7xh Data Fabric
+product AMD F17_7X_DF_3		0x1442	17h/7xh Data Fabric
+product AMD F17_7X_DF_4		0x1443	17h/7xh Data Fabric
+product AMD F17_7X_DF_5		0x1444	17h/7xh Data Fabric
+product AMD F17_7X_DF_6		0x1445	17h/7xh Data Fabric
+product AMD F17_7X_DF_7		0x1446	17h/7xh Data Fabric
+product AMD F17_7X_DF_8		0x1447	17h/7xh Data Fabric
+product AMD F17_6X_DF_0		0x1448	17h/6xh Data Fabric
+product AMD F17_6X_DF_1		0x1449	17h/6xh Data Fabric
+product AMD F17_6X_DF_2		0x144a	17h/6xh Data Fabric
+product AMD F17_6X_DF_3		0x144b	17h/6xh Data Fabric
+product AMD F17_6X_DF_4		0x144c	17h/6xh Data Fabric
+product AMD F17_6X_DF_5		0x144d	17h/6xh Data Fabric
+product AMD F17_6X_DF_6		0x144e	17h/6xh Data Fabric
+product AMD F17_6X_DF_7		0x144f	17h/6xh Data Fabric
 product AMD F17_RC		0x1450	Family17h Root Complex
 product AMD F17_IOMMU		0x1451	Family17h IOMMU
 product AMD F17_PCIE_1		0x1452	Family17h PCIe
@@ -1030,8 +1046,12 @@ product AMD F17_PCIE_4		0x1470	Family17h
 product AMD F17_PCIE_5		0x1471	Family17h PCIe
 product AMD F17_7X_RC		0x1480	Family17h/7xh Root Complex
 product AMD F17_7X_IOMMU	0x1481	Family17h/7xh IOMMU
+product AMD F17_7X_HB		0x1482	17h/7xh Host Bridge
+product AMD F17_7X_PCIE_1	0x1483	17h/7xh PCIe
+product AMD F17_7X_PCIE_2	0x1484	17h/7xh PCIe
 product AMD F17_7X_RESV_SPP	0x1485	Family17h/7xh Reserved SPP
 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 F14_RC		0x1510	Family14h Root Complex
 product AMD F14_PCIE_1		0x1512	Family14h PCIe
@@ -1047,37 +1067,45 @@ product AMD F16_CSTATE		0x1534	Family16h
 product AMD F16_MISC		0x1535	Family16h Miscellaneous Configuration
 product AMD F16_RC		0x1536	Family16h Root Complex
 product AMD F16_CCP		0x1537	Family16h Cryptographic Coprocessor
+product AMD F16_HB		0x1538	Family16h Host Bridge
 product AMD F16_30_RC		0x1566	Family16h Root Complex
 product AMD F16_30_IOMMU	0x1567	Family16h IOMMU
-product AMD F16_HB		0x1568	Family16h Host Bridge
 product AMD F16_30_HB		0x156b	Family16h Host Bridge
-product AMD F15_60_PF_0		0x1570	Family15h Processor Function 0
-product AMD F15_60_PF_1		0x1571	Family15h Processor Function 1
-product AMD F15_60_PF_2		0x1572	Family15h Processor Function 2
-product AMD F15_60_PF_3		0x1573	Family15h Processor Function 3
-product AMD F15_60_PF_4		0x1574	Family15h Processor Function 4
-product AMD F15_60_PF_5		0x1575	Family15h Processor Function 5
-product AMD F15_60_RC		0x1576	Family15h Root Complex
-product AMD F15_60_IOMMU	0x1577	Family15h IOMMU
-product AMD F15_60_PSP		0x1578	Family15h PSP
-product AMD F15_60_AC		0x157a	Family15h Audio Controller
-product AMD F15_60_HB		0x157b	Family15h Host Bridge
-product AMD F15_60_RP		0x157c	Family15h Root Port
+product AMD F15_6X_PF_0		0x1570	15h/6xh Processor Function 0
+product AMD F15_6X_PF_1		0x1571	15h/6xh 

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

2022-08-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug  2 15:41:46 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1754):
sys/dev/pci/pcidevs: 1.1445-1.1460 via patch
Update pcidevs:
- Add Intel Alder Lake devices and Intel 600 Series PCH devices.
- Add some Intel Xeon Scalable / Skylake-E devices.
- Fix AMD F16_HB from 0x1568 to 0x1538.
- Add some devices for AMD and improve some descriptions to clarify.
- Add VMware AHCI and NVMe.
- Update Intel 700 series Ethernet devices.
- Add some Broadcom devices.
- Add some Broadcom / LSI RAID cards.
- Fix typos and whitespace.


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

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



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

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

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

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

sys/dev/pci/if_wmreg.h  1.122-1.125 via patch
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.508.4.44 -r1.508.4.45 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.13 -r1.98.6.14 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.33.6.8 -r1.33.6.9 src/sys/dev/pci/if_wmvar.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.44 src/sys/dev/pci/if_wm.c:1.508.4.45
--- src/sys/dev/pci/if_wm.c:1.508.4.44	Sat Nov 20 15:11:31 2021
+++ src/sys/dev/pci/if_wm.c	Mon Jul 11 14:15:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.44 2021/11/20 15:11:31 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.45 2022/07/11 14:15:57 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.508.4.44 2021/11/20 15:11:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.45 2022/07/11 14:15:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -319,9 +319,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 {\
@@ -340,7 +340,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 {
@@ -407,27 +407,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. */
-	WM_Q_EVCNT_DEFINE(txq, tso)	/* TCP seg offload (IPv4) */

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

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

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

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

sys/dev/pci/if_wmreg.h  1.122-1.125 via patch
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.508.4.44 -r1.508.4.45 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.13 -r1.98.6.14 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.33.6.8 -r1.33.6.9 src/sys/dev/pci/if_wmvar.h

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



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

2022-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun  6 11:09:16 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   (apply patch)

Fix the location of "break" statement. No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.52 -r1.88.2.53 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.88.2.52 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.53
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.52	Fri Jun  3 12:31:10 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jun  6 11:09:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.52 2022/06/03 12:31:10 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.53 2022/06/06 11:09:16 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.52 2022/06/03 12:31:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.53 2022/06/06 11:09:16 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3170,8 +3170,8 @@ ixgbe_intr_admin_common(struct adapter *
 	"PHY IS SHUT DOWN!!\n");
 	device_printf(adapter->dev,
 	"System shutdown required!\n");
-	break;
 }
+break;
 			}
 		}
 



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

2022-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun  6 11:09:16 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   (apply patch)

Fix the location of "break" statement. No functional change intended.


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

2022-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun  3 12:31:10 UTC 2022

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

Log Message:
Pull up the following revisions, requestes by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c   1.261,1.263,
1.265-1.268,1.273,
1.275-1.277,1.305,
1.312,
1.316-1.321 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.85 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/ixgbe_type.h  1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
sys/dev/pci/ixgbe/ixv.c 1.178,1.182 via patch

- 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.
  - Use macro.
  - Fix typos in comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.25 -r1.24.2.26 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.51 -r1.88.2.52 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.25 -r1.24.6.26 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6.8.6 -r1.6.8.7 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.7.6.4 -r1.7.6.5 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.22.2.16 -r1.22.2.17 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.11 -r1.5.6.12 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.38 -r1.56.2.39 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.25 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.26
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.25	Tue May 31 14:07:51 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Jun  3 12:31:09 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 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 == 

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

2022-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun  3 12:31:10 UTC 2022

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

Log Message:
Pull up the following revisions, requestes by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c   1.261,1.263,
1.265-1.268,1.273,
1.275-1.277,1.305,
1.312,
1.316-1.321 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.85 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/ixgbe_type.h  1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
sys/dev/pci/ixgbe/ixv.c 1.178,1.182 via patch

- 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.
  - Use macro.
  - Fix typos in comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.25 -r1.24.2.26 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.51 -r1.88.2.52 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.25 -r1.24.6.26 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6.8.6 -r1.6.8.7 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.7.6.4 -r1.7.6.5 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.22.2.16 -r1.22.2.17 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.11 -r1.5.6.12 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.38 -r1.56.2.39 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

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

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98
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

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.

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.24.2.24 -r1.24.2.25 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.50 -r1.88.2.51 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.24 -r1.24.6.25 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.37 -r1.56.2.38 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.25
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.24	Mon May 30 17:05:51 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue May 31 14:07:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -2322,6 +2322,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 */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.51
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50	Mon May 30 17:05:51 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue May 31 14:07:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1091,7 +1091,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;
@@ -5033,7 +5032,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
@@ -5065,7 +5064,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++)
@@ -6710,6 +6709,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);
 	}
 
@@ -6909,7 +6909,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;
@@ -6963,7 +6963,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: 

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

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

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

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98
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

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.

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.24.2.24 -r1.24.2.25 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.50 -r1.88.2.51 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.24 -r1.24.6.25 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.37 -r1.56.2.38 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

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

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

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.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.24.2.23 -r1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.49 -r1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.36 -r1.56.2.37 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.24
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon May 30 17:05:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 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)
 rxr->rx_copies.ev_count++;
 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.88.2.49 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49	Tue Feb  1 11:38:29 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon May 30 17:05:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -233,8 +233,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);
@@ -254,6 +252,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 

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

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

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

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

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.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.24.2.23 -r1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.49 -r1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.36 -r1.56.2.37 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

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

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

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.88.2.48 -r1.88.2.49 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.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.48	Mon Jan 31 17:38:36 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb  1 11:38:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5074,28 +5074,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-8] src/sys/dev/pci/ixgbe

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

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

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

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.88.2.48 -r1.88.2.49 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-8] src/sys/dev/pci/ixgbe

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

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: 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 #1730):

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.1.4.7 -r1.1.4.8 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.47 -r1.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.8 -r1.14.8.9 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.6.8.5 -r1.6.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.4 -r1.10.8.5 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.15 -r1.22.2.16 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.8 -r1.12.8.9 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.7 -r1.9.6.8 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.35 -r1.56.2.36 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: 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 #1730):

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.1.4.7 -r1.1.4.8 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.47 -r1.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.8 -r1.14.8.9 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.6.8.5 -r1.6.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.4 -r1.10.8.5 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.15 -r1.22.2.16 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.8 -r1.12.8.9 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.7 -r1.9.6.8 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.35 -r1.56.2.36 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.1.4.7 src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.8
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.7	Sun Jan 30 16:06:35 2022
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Mon Jan 31 17:38:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.1.4.7 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: if_sriov.c,v 1.1.4.8 2022/01/31 17:38:36 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.1.4.7 2022/01/30 16:06:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.1.4.8 2022/01/31 17:38:36 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.88.2.47 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.48
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.47	Sun Jan 30 16:06:35 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 31 17:38:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.47 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, 

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

2022-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 30 16:06:36 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: 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, requested by msaitoh in ticket #1729:

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.1.4.6 -r1.1.4.7 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.46 -r1.88.2.47 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.23 -r1.24.6.24 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.8.8.6 -r1.8.8.7 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.5.8.2 -r1.5.8.3 src/sys/dev/pci/ixgbe/ixgbe_82598.h
cvs rdiff -u -r1.14.8.7 -r1.14.8.8 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.4.8.2 -r1.4.8.3 src/sys/dev/pci/ixgbe/ixgbe_82599.h
cvs rdiff -u -r1.15.8.7 -r1.15.8.8 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u 

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

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

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

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

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.183.2.13 -r1.183.2.14 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 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.183.2.13 src/sys/dev/pci/pci_subr.c:1.183.2.14
--- src/sys/dev/pci/pci_subr.c:1.183.2.13	Fri Dec  3 19:45:13 2021
+++ src/sys/dev/pci/pci_subr.c	Sat Jan 29 17:11:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.13 2021/12/03 19:45:13 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.14 2022/01/29 17:11:22 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.183.2.13 2021/12/03 19:45:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.14 2022/01/29 17:11:22 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 

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

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

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

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

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.183.2.13 -r1.183.2.14 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 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-8] src/sys/dev/pci/ixgbe

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

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

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

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.8.6.4 -r1.8.6.5 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.33 -r1.56.2.34 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.8.6.4 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.5
--- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.4	Thu Sep 26 18:19:26 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.h	Sat Jan 29 16:45:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.8.6.4 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.8.6.5 2022/01/29 16:45:49 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.56.2.33 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.34
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.33	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Sat Jan 29 16:45:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.56.2.33 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 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.56.2.33 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@ static void	ixv_unregister_vlan(void *, 
 #endif
 
 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 *);
@@ -550,7 +549,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);
 
@@ -2269,34 +2267,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)
@@ -2314,34 +2289,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;
-	adapter->stats.vf.base_vfgptc = adapter->stats.vf.last_vfgptc;
-	

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

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

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

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

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.8.6.4 -r1.8.6.5 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.33 -r1.56.2.34 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

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

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

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.88.2.45 -r1.88.2.46 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-8] src/sys/dev/pci/ixgbe

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

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

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

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.88.2.45 -r1.88.2.46 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.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.46
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.45	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Jan 29 16:36:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1579,13 +1579,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)
@@ -1643,8 +1649,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;
@@ -1696,10 +1701,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);
@@ -1733,7 +1741,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-8] src/sys/dev/pci

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

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

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

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

- Print Bridge Config Retry Enable bit and Retimer Presence Detect
  Supported bit.
- Add PCIe 4.0 stuff a little:
  - 10-bit Tag Requester/Completer.
  - Add Data link Feature extended capability.
  - Add Physical Layer 16.0 GT/s extended capability. Not decode yet.
- Change pci_conf_print() to allocate memory for the regs dynamically
  instead of on-stack.
- Print some DPC register values not with %04x but with %08x because
  those are 32bit.
- Fix a bug that the virtual channel extended configuration's
  arbitration phase register can't be decoded correctly.
- 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.
- Remove unused shift and mask definitions.
- Fix typo in some messages.
- Fix typo in comments.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.2 -r1.19.2.3 src/sys/dev/pci/nvme_pci.c
cvs rdiff -u -r1.183.2.12 -r1.183.2.13 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.9 -r1.130.2.10 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.63.2.2 -r1.63.2.3 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.19.2.2 src/sys/dev/pci/nvme_pci.c:1.19.2.3
--- src/sys/dev/pci/nvme_pci.c:1.19.2.2	Sun Jan 27 18:35:19 2019
+++ src/sys/dev/pci/nvme_pci.c	Fri Dec  3 19:45:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme_pci.c,v 1.19.2.2 2019/01/27 18:35:19 martin Exp $	*/
+/*	$NetBSD: nvme_pci.c,v 1.19.2.3 2021/12/03 19:45:13 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.19.2.2 2019/01/27 18:35:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.19.2.3 2021/12/03 19:45:13 martin Exp $");
 
 #include 
 #include 
@@ -133,7 +133,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_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.183.2.12 src/sys/dev/pci/pci_subr.c:1.183.2.13
--- src/sys/dev/pci/pci_subr.c:1.183.2.12	Thu Sep 26 18:14:54 2019
+++ src/sys/dev/pci/pci_subr.c	Fri Dec  3 19:45:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.12 2019/09/26 18:14:54 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.13 2021/12/03 19:45:13 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.183.2.12 2019/09/26 18:14:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.13 2021/12/03 19:45:13 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #include 
 #include 
+#include 
+
+#define MALLOC(sz)	kmem_alloc(sz, KM_SLEEP)
+#define FREE(p, sz)	kmem_free(p, sz)
+
 #else
 #include 
 #include 
@@ -59,6 +64,10 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #include 
 #include 
+
+#define MALLOC(sz)	malloc(sz)
+#define FREE(p, sz)	free(p)
+
 #endif
 
 #include 
@@ -120,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",		PCI_INTERFACE_NVM_NVMHCI10,	NULL,	},
-	{ "NVMe",		PCI_INTERFACE_NVM_NVME,		NULL,	},
+	{ "NVMe I/O",		PCI_INTERFACE_NVM_NVME_IO,	NULL,	},
+	{ "NVMe admin",		PCI_INTERFACE_NVM_NVME_ADMIN,	NULL,	},
+	{ NULL,			0,NULL,	},
+};
+
+/* UFS programming 

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

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

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

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

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

- Print Bridge Config Retry Enable bit and Retimer Presence Detect
  Supported bit.
- Add PCIe 4.0 stuff a little:
  - 10-bit Tag Requester/Completer.
  - Add Data link Feature extended capability.
  - Add Physical Layer 16.0 GT/s extended capability. Not decode yet.
- Change pci_conf_print() to allocate memory for the regs dynamically
  instead of on-stack.
- Print some DPC register values not with %04x but with %08x because
  those are 32bit.
- Fix a bug that the virtual channel extended configuration's
  arbitration phase register can't be decoded correctly.
- 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.
- Remove unused shift and mask definitions.
- Fix typo in some messages.
- Fix typo in comments.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.2 -r1.19.2.3 src/sys/dev/pci/nvme_pci.c
cvs rdiff -u -r1.183.2.12 -r1.183.2.13 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.9 -r1.130.2.10 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.63.2.2 -r1.63.2.3 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-8] src/sys/dev/pci

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

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

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

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.
- Ignores the SMBALERT# interrupt. Same as other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.4 -r1.50.6.5 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.50.6.4 src/sys/dev/pci/ichsmb.c:1.50.6.5
--- src/sys/dev/pci/ichsmb.c:1.50.6.4	Wed Aug  5 15:54:30 2020
+++ src/sys/dev/pci/ichsmb.c	Fri Dec  3 17:54:30 2021
@@ -1,5 +1,5 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.4 2020/08/05 15:54:30 martin Exp $	*/
-/*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.50.6.5 2021/12/03 17:54:30 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.50.6.4 2020/08/05 15:54:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.5 2021/12/03 17:54:30 martin Exp $");
 
 #include 
 #include 
@@ -119,6 +119,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:
@@ -126,6 +128,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:
@@ -138,6 +142,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;
 		}
 	}
@@ -383,11 +390,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);
@@ -414,9 +416,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);
 
@@ -425,9 +432,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-8] src/sys/dev/pci

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

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

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

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.
- Ignores the SMBALERT# interrupt. Same as other OSes.


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

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

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

Log Message:
regen (ticket #1710)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.20 -r1.1281.2.21 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.20 -r1.1280.2.21 src/sys/dev/pci/pcidevs_data.h

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



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

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

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

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

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.1289.2.20 -r1.1289.2.21 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.20 src/sys/dev/pci/pcidevs:1.1289.2.21
--- src/sys/dev/pci/pcidevs:1.1289.2.20	Sat Oct 23 11:27:26 2021
+++ src/sys/dev/pci/pcidevs	Fri Dec  3 17:38:16 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.20 2021/10/23 11:27:26 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.21 2021/12/03 17:38:16 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5157,6 +5157,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)
@@ -5624,12 +5625,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-8] src/sys/dev/pci

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

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

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

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.1289.2.20 -r1.1289.2.21 src/sys/dev/pci/pcidevs

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



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

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

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

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

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.52.6.2 -r1.52.6.3 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.52.6.2 src/sys/dev/pci/piixpm.c:1.52.6.3
--- src/sys/dev/pci/piixpm.c:1.52.6.2	Wed Aug  5 16:11:56 2020
+++ src/sys/dev/pci/piixpm.c	Tue Nov 30 11:48:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.52.6.2 2020/08/05 16:11:56 martin Exp $ */
+/* $NetBSD: piixpm.c,v 1.52.6.3 2021/11/30 11:48:29 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.52.6.2 2020/08/05 16:11:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.52.6.3 2021/11/30 11:48:29 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-8] src/sys/dev/pci

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

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

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

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.52.6.2 -r1.52.6.3 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-8] src/sys/dev/pci/ixgbe

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

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

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

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.24.2.22 -r1.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.44 -r1.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.22 -r1.24.6.23 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.13 -r1.22.2.14 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.32 -r1.56.2.33 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.22 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.22	Wed Sep 15 16:38:00 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Nov 20 15:21:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.22 2021/09/15 16:38:00 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.22 2021/09/15 16:38:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 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.88.2.44 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.45
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.44	Wed Sep 15 16:38:00 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Nov 20 15:21:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.44 2021/09/15 16:38:00 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.44 2021/09/15 16:38:00 martin Exp $");

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

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

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

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

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.24.2.22 -r1.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.44 -r1.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.22 -r1.24.6.23 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.13 -r1.22.2.14 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.32 -r1.56.2.33 src/sys/dev/pci/ixgbe/ixv.c

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



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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:32:06 UTC 2021

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

Log Message:
Regen for ticket #1700:

- 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.1281.2.19 -r1.1281.2.20 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.19 -r1.1280.2.20 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:32:06 UTC 2021

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

Log Message:
Regen for ticket #1700:

- 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.1281.2.19 -r1.1281.2.20 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.19 -r1.1280.2.20 src/sys/dev/pci/pcidevs_data.h

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



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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:27:26 UTC 2021

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

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

sys/dev/pci/pcidevs 1.1420-1.1440

- 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.1289.2.19 -r1.1289.2.20 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.19 src/sys/dev/pci/pcidevs:1.1289.2.20
--- src/sys/dev/pci/pcidevs:1.1289.2.19	Mon Jul 20 18:53:56 2020
+++ src/sys/dev/pci/pcidevs	Sat Oct 23 11:27:26 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.19 2020/07/20 18:53:56 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.20 2021/10/23 11:27:26 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -687,7 +687,7 @@ vendor ADP		0x9004	Adaptec
 vendor ADP2		0x9005	Adaptec (2nd PCI Vendor ID)
 vendor ATRONICS		0x907f	Atronics
 vendor NETMOS		0x9710	Netmos
-vendor PARALLELS	0x	Parallels	
+vendor PARALLELS	0x	Parallels
 vendor MICRON		0xc0a9	Micron/Crucial Technology
 vendor CHRYSALIS	0xcafe	Chrysalis-ITS
 vendor MIDDLE_DIGITAL	0xdeaf	Middle Digital
@@ -1678,109 +1678,415 @@ 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	

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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:27:26 UTC 2021

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

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

sys/dev/pci/pcidevs 1.1420-1.1440

- 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.1289.2.19 -r1.1289.2.20 src/sys/dev/pci/pcidevs

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



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

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

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

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

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.17.2.2 -r1.17.2.3 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.17.2.2 src/sys/dev/pci/if_vte.c:1.17.2.3
--- src/sys/dev/pci/if_vte.c:1.17.2.2	Wed Nov  6 10:04:47 2019
+++ src/sys/dev/pci/if_vte.c	Fri Sep  3 10:23:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vte.c,v 1.17.2.2 2019/11/06 10:04:47 martin Exp $	*/
+/*	$NetBSD: if_vte.c,v 1.17.2.3 2021/09/03 10:23:17 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.17.2.2 2019/11/06 10:04:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.17.2.3 2021/09/03 10:23:17 martin Exp $");
 
 #include 
 #include 
@@ -1194,9 +1194,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--) {
@@ -1214,6 +1215,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-8] src/sys/dev/pci

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

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

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

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.17.2.2 -r1.17.2.3 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-8] src/sys/dev/pci/ixgbe

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:48:15 UTC 2019

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

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

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.88.2.36 -r1.88.2.37 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.27 -r1.56.2.28 src/sys/dev/pci/ixgbe/ixv.c

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:48:15 UTC 2019

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

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

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.88.2.36 -r1.88.2.37 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.27 -r1.56.2.28 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.88.2.36 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.37
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.36	Thu Oct 17 18:39:41 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Nov 19 10:48:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.36 2019/10/17 18:39:41 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.37 2019/11/19 10:48:15 martin Exp $ */
 
 /**
 
@@ -1333,6 +1333,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.56.2.27 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.28
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.27	Thu Nov 14 15:53:39 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Nov 19 10:48:15 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.27 2019/11/14 15:53:39 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.28 2019/11/19 10:48:15 martin Exp $*/
 
 /**
 
@@ -1623,6 +1623,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-8] src/sys/dev/pci

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:40:40 UTC 2019

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

Log Message:
regen for ticket #1448


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.16 -r1.1281.2.17 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.16 -r1.1280.2.17 src/sys/dev/pci/pcidevs_data.h

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:40:40 UTC 2019

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

Log Message:
regen for ticket #1448


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.16 -r1.1281.2.17 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.16 -r1.1280.2.17 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:36:48 UTC 2019

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

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

sys/dev/pci/pcidevs 1.1384-1.1391

- Add micron/crucial SM2263 NVMe.
- Add some device found on ASUS X570-P with Ryzen 3200G CPU.
- Spell it "PCIe' when using the name.
- Add Mellanox ConnectX-4, ConnectX-4 Lx, ConnectX-5, and ConnectX-5 Ex
- Modify Attansic Ethernet devices' description to clarify.
- Add Killer E2400 and E2500.
- Spell "controller" correctly.
- Add Realtek RTL8125.
- Update Intel's NVMe SSDs.
- Add Intel 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.1289.2.16 -r1.1289.2.17 src/sys/dev/pci/pcidevs

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:36:48 UTC 2019

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

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

sys/dev/pci/pcidevs 1.1384-1.1391

- Add micron/crucial SM2263 NVMe.
- Add some device found on ASUS X570-P with Ryzen 3200G CPU.
- Spell it "PCIe' when using the name.
- Add Mellanox ConnectX-4, ConnectX-4 Lx, ConnectX-5, and ConnectX-5 Ex
- Modify Attansic Ethernet devices' description to clarify.
- Add Killer E2400 and E2500.
- Spell "controller" correctly.
- Add Realtek RTL8125.
- Update Intel's NVMe SSDs.
- Add Intel 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.1289.2.16 -r1.1289.2.17 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.16 src/sys/dev/pci/pcidevs:1.1289.2.17
--- src/sys/dev/pci/pcidevs:1.1289.2.16	Tue Aug  6 15:51:07 2019
+++ src/sys/dev/pci/pcidevs	Tue Nov 19 10:36:47 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.16 2019/08/06 15:51:07 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.17 2019/11/19 10:36:47 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -686,6 +686,7 @@ vendor ADP2		0x9005	Adaptec (2nd PCI Ven
 vendor ATRONICS		0x907f	Atronics
 vendor NETMOS		0x9710	Netmos
 vendor PARALLELS	0x	Parallels	
+vendor MICRON		0xc0a9	Micron/Crucial Technology
 vendor CHRYSALIS	0xcafe	Chrysalis-ITS
 vendor MIDDLE_DIGITAL	0xdeaf	Middle Digital
 vendor ARC		0xedd8	ARC Logic
@@ -963,10 +964,10 @@ product AMAZON NVME	0x8061	NVMe SSD
 product AMAZON ENA	0xec20	Elastic Network Adapter
 
 /* AMD products */
-product AMD AMD64_HT	0x1100	K8 AMD64 HyperTransport Configuration
-product AMD AMD64_ADDR	0x1101	K8 AMD64 Address Map Configuration
-product AMD AMD64_DRAM	0x1102	K8 AMD64 DRAM Configuration
-product AMD AMD64_MISC	0x1103	K8 AMD64 Miscellaneous Configuration
+product AMD AMD64_HT		0x1100	K8 AMD64 HyperTransport Configuration
+product AMD AMD64_ADDR		0x1101	K8 AMD64 Address Map Configuration
+product AMD AMD64_DRAM		0x1102	K8 AMD64 DRAM Configuration
+product AMD AMD64_MISC		0x1103	K8 AMD64 Miscellaneous Configuration
 product AMD AMD64_F10_HT	0x1200	AMD64 Family10h HyperTransport Configuration
 product AMD AMD64_F10_ADDR	0x1201	AMD64 Family10h Address Map Configuration
 product AMD AMD64_F10_DRAM	0x1202	AMD64 Family10h DRAM Configuration
@@ -977,140 +978,145 @@ product AMD AMD64_F11_ADDR	0x1301	AMD64 
 product AMD AMD64_F11_DRAM	0x1302	AMD64 Family11h DRAM Configuration
 product AMD AMD64_F11_MISC	0x1303	AMD64 Family11h Miscellaneous Configuration
 product AMD AMD64_F11_LINK	0x1304	AMD64 Family11h Link Configuration
-product AMD F15_10_PF_0	0x1400	Family15h Processor Function 0
-product AMD F15_10_PF_1	0x1401	Family15h Processor Function 1
-product AMD F15_10_PF_2	0x1402	Family15h Processor Function 2
-product AMD F15_10_PF_3	0x1403	Family15h Processor Function 3
-product AMD F15_10_PF_4	0x1404	Family15h Processor Function 4
-product AMD F15_10_PF_5	0x1405	Family15h Processor Function 5
-product AMD F15_10_RC	0x1410	Family15h Root Complex
-product AMD F15_10_RP_2	0x1412	Family15h Root Port
-product AMD F15_10_RP_3	0x1413	Family15h Root Port
-product AMD F15_10_RP_4	0x1414	Family15h Root Port
-product AMD F15_10_RP_5	0x1415	Family15h Root Port
-product AMD F15_10_RP_6	0x1416	Family15h Root Port
-product AMD F15_10_RP_7	0x1417	Family15h Root Port
-product AMD F15_10_RP_8	0x1418	Family15h Root Port
+product AMD F15_10_PF_0		0x1400	Family15h Processor Function 0
+product AMD F15_10_PF_1		0x1401	Family15h Processor Function 1
+product AMD F15_10_PF_2		0x1402	Family15h Processor Function 2
+product AMD F15_10_PF_3		0x1403	Family15h Processor Function 3
+product AMD F15_10_PF_4		0x1404	Family15h Processor Function 4
+product AMD F15_10_PF_5		0x1405	Family15h Processor Function 5
+product AMD F15_10_RC		0x1410	Family15h Root Complex
+product AMD F15_10_RP_2		0x1412	Family15h Root Port
+product AMD F15_10_RP_3		0x1413	Family15h Root Port
+product AMD F15_10_RP_4		0x1414	Family15h Root Port
+product AMD F15_10_RP_5		0x1415	Family15h Root Port
+product AMD F15_10_RP_6		0x1416	Family15h Root Port
+product AMD F15_10_RP_7		0x1417	Family15h Root Port
+product AMD F15_10_RP_8		0x1418	Family15h Root Port
 product AMD F15_10_IOMMU	0x1419	Family15h IOMMU
-product AMD F15_30_PF_0	0x141a	Family15h Processor Function 0
-product AMD F15_30_PF_1	0x141b	Family15h Processor Function 1
-product AMD F15_30_PF_2	0x141c	Family15h Processor Function 2
-product AMD F15_30_PF_3	0x141d	Family15h Processor Function 3
-product AMD F15_30_PF_4	0x141e	Family15h Processor Function 4
-product AMD F15_30_PF_5	0x141f	Family15h Processor Function 5
-product AMD F15_30_RC	0x1422	Family15h Root Complex

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

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

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

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

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.56.2.26 -r1.56.2.27 src/sys/dev/pci/ixgbe/ixv.c

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



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

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

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

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

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.56.2.26 -r1.56.2.27 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.56.2.26 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.27
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.26	Tue Oct  8 18:16:50 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Nov 14 15:53:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.26 2019/10/08 18:16:50 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.27 2019/11/14 15:53:39 martin Exp $*/
 
 /**
 
@@ -1931,7 +1931,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-8] src/sys/dev/pci

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

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

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

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.99.8.4 -r1.99.8.5 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.99.8.4 src/sys/dev/pci/pucdata.c:1.99.8.5
--- src/sys/dev/pci/pucdata.c:1.99.8.4	Sun May  5 08:20:08 2019
+++ src/sys/dev/pci/pucdata.c	Thu Nov 14 15:48:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.99.8.4 2019/05/05 08:20:08 martin Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.99.8.5 2019/11/14 15:48:07 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.99.8.4 2019/05/05 08:20:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.99.8.5 2019/11/14 15:48:07 martin Exp $");
 
 #include 
 #include 
@@ -2872,10 +2872,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 },
 	},
 	},
 
@@ -2884,14 +2884,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-8] src/sys/dev/pci

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

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

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

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.99.8.4 -r1.99.8.5 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-8] src/sys/dev/pci/ixgbe

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

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1431):

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

Fix missing kpreempt_disable() before softint_schedule() like if_vmx.c:r1.51.


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

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

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1431):

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

Fix missing kpreempt_disable() before softint_schedule() like if_vmx.c:r1.51.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.17 -r1.24.2.18 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.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.18
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.17	Thu Sep  5 09:06:07 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sun Nov 10 13:36:29 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.17 2019/09/05 09:06:07 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.18 2019/11/10 13:36:29 martin Exp $ */
 
 /**
 
@@ -266,8 +266,11 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 >wq_cookie, curcpu());
 			} else
 percpu_putref(adapter->txr_wq_enqueued);
-		} else
+		} else {
+			kpreempt_disable();
 			softint_schedule(txr->txr_si);
+			kpreempt_enable();
+		}
 	}
 
 	return (0);



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

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

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

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

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.31.8.2 -r1.31.8.3 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.31.8.2 src/sys/dev/pci/if_jme.c:1.31.8.3
--- src/sys/dev/pci/if_jme.c:1.31.8.2	Thu Jul 26 23:55:30 2018
+++ src/sys/dev/pci/if_jme.c	Sun Nov 10 13:34:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_jme.c,v 1.31.8.2 2018/07/26 23:55:30 snj Exp $	*/
+/*	$NetBSD: if_jme.c,v 1.31.8.3 2019/11/10 13:34:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2008 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.31.8.2 2018/07/26 23:55:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.31.8.3 2019/11/10 13:34:46 martin Exp $");
 
 
 #include 
@@ -1450,7 +1450,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-8] src/sys/dev/pci

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

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

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

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.31.8.2 -r1.31.8.3 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-8] src/sys/dev/pci

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

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

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

sys/dev/pci/if_wm.c 1.647, 1.649 via patch

- Use device_printf() instead of printf().
- Fix typo in comment.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.35 src/sys/dev/pci/if_wm.c:1.508.4.36
--- src/sys/dev/pci/if_wm.c:1.508.4.35	Sun Aug  4 10:59:19 2019
+++ src/sys/dev/pci/if_wm.c	Wed Nov  6 10:23:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.35 2019/08/04 10:59:19 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.36 2019/11/06 10:23:06 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.35 2019/08/04 10:59:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.36 2019/11/06 10:23:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4549,8 +4549,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);
 
@@ -4577,8 +4577,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);
@@ -4818,7 +4817,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 */
@@ -8962,7 +8961,8 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
  * Fiber?
  * Shoud not enter here.
  */
-printf("unknown media (%x)\n", active);
+device_printf(sc->sc_dev,
+"unknown media (%x)\n", active);
 break;
 			}
 			if (active & IFM_FDX)
@@ -9705,7 +9705,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,
@@ -10916,7 +10916,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 0;
 	}
 
@@ -10984,7 +10984,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;
 	}
 
@@ -11008,7 +11008,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");
 			}
 		}
 
@@ -12550,12 +12550,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
 	 */
 
 	if ((hsfsts & HSFSTS_FLINPRO) == 0) {
@@ -13569,8 +13569,9 @@ wm_get_swfw_semaphore(struct wm_softc *s
 		delay(5000);
 		timeout--;
 	}
-	printf("%s: failed to get swfw semaphore mask 0x%x swfw 0x%x\n",
-	device_xname(sc->sc_dev), mask, swfw_sync);
+	device_printf(sc->sc_dev,
+	"failed to get swfw semaphore mask 0x%x swfw 0x%x\n",
+	mask, swfw_sync);
 	return 1;
 }
 
@@ -13716,8 

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

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

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

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

sys/dev/pci/if_wm.c 1.647, 1.649 via patch

- Use device_printf() instead of printf().
- Fix typo in comment.


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

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



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

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

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

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

sys/dev/pci/if_bce.c: revision 1.55
sys/dev/pci/if_bce.c: revision 1.56
sys/dev/pci/if_bcereg.h: revision 1.5

- Add missing splnet()/splx() around mii_tick(). Same as OpenBSD rev. 1.23
- Use device_printf() instead of aprint_error_dev)() in bce_watchdog().
- Remove unnecessary inclusion.

 -

>From OpenBSD:
 - Mark ETHERCAP_VLAN_MTU.
 - Clear the powerdown mode. Fixes PR kern/24911 reported by Werner Backes.
 - Set proper LED modes.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.46.4.1 src/sys/dev/pci/if_bce.c
cvs rdiff -u -r1.4 -r1.4.156.1 src/sys/dev/pci/if_bcereg.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_bce.c
diff -u src/sys/dev/pci/if_bce.c:1.46 src/sys/dev/pci/if_bce.c:1.46.4.1
--- src/sys/dev/pci/if_bce.c:1.46	Wed Apr 19 07:35:44 2017
+++ src/sys/dev/pci/if_bce.c	Thu Oct 24 16:03:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bce.c,v 1.46 2017/04/19 07:35:44 msaitoh Exp $	 */
+/* $NetBSD: if_bce.c,v 1.46.4.1 2019/10/24 16:03:38 martin Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.46 2017/04/19 07:35:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.46.4.1 2019/10/24 16:03:38 martin Exp $");
 
 #include "vlan.h"
 
@@ -63,8 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
@@ -419,6 +417,8 @@ bce_attach(device_t parent, device_t sel
 	ifp->if_stop = bce_stop;
 	IFQ_SET_READY(>if_snd);
 
+	sc->ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
 	/* Initialize our media structures and probe the MII. */
 
 	sc->bce_mii.mii_ifp = ifp;
@@ -648,7 +648,7 @@ bce_watchdog(struct ifnet *ifp)
 {
 	struct bce_softc *sc = ifp->if_softc;
 
-	aprint_error_dev(sc->bce_dev, "device timeout\n");
+	device_printf(sc->bce_dev, "device timeout\n");
 	ifp->if_oerrors++;
 
 	(void) bce_init(ifp);
@@ -915,10 +915,15 @@ bce_init(struct ifnet *ifp)
 	sc->bce_txsnext = 0;
 	sc->bce_txin = 0;
 
-	/* enable crc32 generation */
+	/* enable crc32 generation and set proper LED modes */
 	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL,
 	bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL) |
-	BCE_EMC_CG);
+	BCE_EMC_CRC32_ENAB | BCE_EMC_LED);
+
+	/* reset or clear powerdown control bit  */
+	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL,
+	bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL) &
+	~BCE_EMC_PDOWN);
 
 	/* setup DMA interrupt control */
 	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_DMAI_CTL, 1 << 24);	/* MAGIC */
@@ -1464,9 +1469,11 @@ static void
 bce_tick(void *v)
 {
 	struct bce_softc *sc = v;
+	int s;
 
-	/* Tick the MII. */
+	s = splnet();
 	mii_tick(>bce_mii);
+	splx(s);
 
 	callout_reset(>bce_timeout, hz, bce_tick, sc);
 }

Index: src/sys/dev/pci/if_bcereg.h
diff -u src/sys/dev/pci/if_bcereg.h:1.4 src/sys/dev/pci/if_bcereg.h:1.4.156.1
--- src/sys/dev/pci/if_bcereg.h:1.4	Sun Dec 11 12:22:49 2005
+++ src/sys/dev/pci/if_bcereg.h	Thu Oct 24 16:03:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bcereg.h,v 1.4 2005/12/11 12:22:49 christos Exp $	 */
+/* $NetBSD: if_bcereg.h,v 1.4.156.1 2019/10/24 16:03:38 martin Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -71,7 +71,10 @@
 /* Ethernet MAC Control */
 #define BCE_MACCTL			0x00A8	/* ethernet mac control */
 /* mac control bits */
-#define BCE_EMC_CG			0x0001	/* crc32 generation */
+#define BCE_EMC_CRC32_ENAB		0x0001	/* crc32 generation */
+#define BCE_EMC_PDOWN			0x0004	/* PHY powerdown */
+#define BCE_EMC_EDET			0x0008	/* PHY energy detect */
+#define BCE_EMC_LED			0x00e0	/* PHY LED control */
 
 /* DMA Interrupt control */
 #define BCE_DMAI_CTL			0x0100



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

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

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

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

sys/dev/pci/if_bce.c: revision 1.55
sys/dev/pci/if_bce.c: revision 1.56
sys/dev/pci/if_bcereg.h: revision 1.5

- Add missing splnet()/splx() around mii_tick(). Same as OpenBSD rev. 1.23
- Use device_printf() instead of aprint_error_dev)() in bce_watchdog().
- Remove unnecessary inclusion.

 -

>From OpenBSD:
 - Mark ETHERCAP_VLAN_MTU.
 - Clear the powerdown mode. Fixes PR kern/24911 reported by Werner Backes.
 - Set proper LED modes.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.46.4.1 src/sys/dev/pci/if_bce.c
cvs rdiff -u -r1.4 -r1.4.156.1 src/sys/dev/pci/if_bcereg.h

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:39:42 UTC 2019

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

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

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

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.35 -r1.88.2.36 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.88.2.35 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.36
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.35	Thu Sep 26 18:19:26 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Oct 17 18:39:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.35 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.36 2019/10/17 18:39:41 martin Exp $ */
 
 /**
 
@@ -5819,7 +5819,7 @@ ixgbe_sysctl_eee_state(SYSCTLFN_ARGS)
 	if ((new_eee < 0) || (new_eee > 1))
 		return (EINVAL);
 
-	retval = adapter->hw.mac.ops.setup_eee(>hw, new_eee);
+	retval = ixgbe_setup_eee(>hw, new_eee);
 	if (retval) {
 		device_printf(dev, "Error in EEE setup: 0x%08X\n", retval);
 		return (EINVAL);
@@ -5993,8 +5993,6 @@ ixgbe_init_device_features(struct adapte
 		 */
 		adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
 		adapter->feat_cap |= IXGBE_FEATURE_FDIR;
-		if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR)
-			adapter->feat_cap |= IXGBE_FEATURE_EEE;
 		break;
 	case ixgbe_mac_X550EM_a:
 		/*



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:39:42 UTC 2019

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

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

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

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:36:44 UTC 2019

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

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

sys/dev/pci/if_et.c 1.27 via patch

Fix a bug that multicast address filter doesn't work correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.14.8.3 -r1.14.8.4 src/sys/dev/pci/if_et.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_et.c
diff -u src/sys/dev/pci/if_et.c:1.14.8.3 src/sys/dev/pci/if_et.c:1.14.8.4
--- src/sys/dev/pci/if_et.c:1.14.8.3	Tue Aug  6 16:10:17 2019
+++ src/sys/dev/pci/if_et.c	Thu Oct 17 18:36:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.14.8.3 2019/08/06 16:10:17 martin Exp $	*/
+/*	$NetBSD: if_et.c,v 1.14.8.4 2019/10/17 18:36:44 martin Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.3 2019/08/06 16:10:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.4 2019/10/17 18:36:44 martin Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -1302,7 +1302,6 @@ et_setmulti(struct et_softc *sc)
 	uint32_t rxmac_ctrl, pktfilt;
 	struct ether_multi *enm;
 	struct ether_multistep step;
-	uint8_t addr[ETHER_ADDR_LEN];
 	int i, count;
 
 	pktfilt = CSR_READ_4(sc, ET_PKTFILT);
@@ -1314,19 +1313,12 @@ et_setmulti(struct et_softc *sc)
 		goto back;
 	}
 
-	bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN);
-
 	count = 0;
 	ETHER_FIRST_MULTI(step, ec, enm);
 	while (enm != NULL) {
 		uint32_t *hp, h;
 
-		for (i = 0; i < ETHER_ADDR_LEN; i++) {
-			addr[i] &= enm->enm_addrlo[i];
-		}
-
-		h = ether_crc32_be(LLADDR((struct sockaddr_dl *)addr),
-		ETHER_ADDR_LEN);
+		h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
 		h = (h & 0x3f80) >> 23;
 
 		hp = [0];



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:36:44 UTC 2019

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

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

sys/dev/pci/if_et.c 1.27 via patch

Fix a bug that multicast address filter doesn't work correctly.


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

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:27:36 UTC 2019

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

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

sys/dev/pci/if_vgereg.h: revision 1.5
sys/dev/pci/if_vge.c: revision 1.75

Copy vge_clrwol() from FreeBSD and call it in vge_attach() to recover from
powerdown mode. Fixes PR kern/41525 reported by Aran Clauson.


To generate a diff of this commit:
cvs rdiff -u -r1.60.8.2 -r1.60.8.3 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.3 -r1.3.134.1 src/sys/dev/pci/if_vgereg.h

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:27:36 UTC 2019

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

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

sys/dev/pci/if_vgereg.h: revision 1.5
sys/dev/pci/if_vge.c: revision 1.75

Copy vge_clrwol() from FreeBSD and call it in vge_attach() to recover from
powerdown mode. Fixes PR kern/41525 reported by Aran Clauson.


To generate a diff of this commit:
cvs rdiff -u -r1.60.8.2 -r1.60.8.3 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.3 -r1.3.134.1 src/sys/dev/pci/if_vgereg.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_vge.c
diff -u src/sys/dev/pci/if_vge.c:1.60.8.2 src/sys/dev/pci/if_vge.c:1.60.8.3
--- src/sys/dev/pci/if_vge.c:1.60.8.2	Mon May 13 12:40:13 2019
+++ src/sys/dev/pci/if_vge.c	Thu Oct 17 18:27:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.60.8.2 2019/05/13 12:40:13 martin Exp $ */
+/* $NetBSD: if_vge.c,v 1.60.8.3 2019/10/17 18:27:36 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.60.8.2 2019/05/13 12:40:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.60.8.3 2019/10/17 18:27:36 martin Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -329,6 +329,7 @@ static void vge_miibus_statchg(struct if
 
 static void vge_cam_clear(struct vge_softc *);
 static int vge_cam_set(struct vge_softc *, uint8_t *);
+static void	vge_clrwol(struct vge_softc *);
 static void vge_setmulti(struct vge_softc *);
 static void vge_reset(struct vge_softc *);
 
@@ -999,6 +1000,9 @@ vge_attach(device_t parent, device_t sel
 	aprint_normal_dev(self, "Ethernet address: %s\n",
 	ether_sprintf(eaddr));
 
+	/* Clear WOL and take hardware from powerdown. */
+	vge_clrwol(sc);
+
 	/*
 	 * Use the 32bit tag. Hardware supports 48bit physical addresses,
 	 * but we don't use that for now.
@@ -2202,3 +2206,30 @@ vge_shutdown(device_t self, int howto)
 
 	return true;
 }
+
+static void
+vge_clrwol(struct vge_softc *sc)
+{
+	uint8_t val;
+
+	val = CSR_READ_1(sc, VGE_PWRSTAT);
+	val &= ~VGE_STICKHW_SWPTAG;
+	CSR_WRITE_1(sc, VGE_PWRSTAT, val);
+	/* Disable WOL and clear power state indicator. */
+	val = CSR_READ_1(sc, VGE_PWRSTAT);
+	val &= ~(VGE_STICKHW_DS0 | VGE_STICKHW_DS1);
+	CSR_WRITE_1(sc, VGE_PWRSTAT, val);
+
+	CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_GMII);
+	CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
+
+	/* Clear WOL on pattern match. */
+	CSR_WRITE_1(sc, VGE_WOLCR0C, VGE_WOLCR0_PATTERN_ALL);
+	/* Disable WOL on magic/unicast packet. */
+	CSR_WRITE_1(sc, VGE_WOLCR1C, 0x0F);
+	CSR_WRITE_1(sc, VGE_WOLCFGC, VGE_WOLCFG_SAB | VGE_WOLCFG_SAM |
+	VGE_WOLCFG_PMEOVR);
+	/* Clear WOL status on pattern match. */
+	CSR_WRITE_1(sc, VGE_WOLSR0C, 0xFF);
+	CSR_WRITE_1(sc, VGE_WOLSR1C, 0xFF);
+}

Index: src/sys/dev/pci/if_vgereg.h
diff -u src/sys/dev/pci/if_vgereg.h:1.3 src/sys/dev/pci/if_vgereg.h:1.3.134.1
--- src/sys/dev/pci/if_vgereg.h:1.3	Tue Oct 31 14:13:30 2006
+++ src/sys/dev/pci/if_vgereg.h	Thu Oct 17 18:27:36 2019
@@ -540,6 +540,31 @@
 #define VGE_TXBLOCK_128PKTS	0x08
 #define VGE_TXBLOCK_8PKTS	0x0C
 
+/* Sticky bit shadow register */
+
+#define	VGE_STICKHW_DS0		0x01
+#define	VGE_STICKHW_DS1		0x02
+#define	VGE_STICKHW_WOL_ENB	0x04
+#define	VGE_STICKHW_WOL_STS	0x08
+#define	VGE_STICKHW_SWPTAG	0x10
+
+/* WOL pattern control */
+#define	VGE_WOLCR0_PATTERN0	0x01
+#define	VGE_WOLCR0_PATTERN1	0x02
+#define	VGE_WOLCR0_PATTERN2	0x04
+#define	VGE_WOLCR0_PATTERN3	0x08
+#define	VGE_WOLCR0_PATTERN4	0x10
+#define	VGE_WOLCR0_PATTERN5	0x20
+#define	VGE_WOLCR0_PATTERN6	0x40
+#define	VGE_WOLCR0_PATTERN7	0x80
+#define	VGE_WOLCR0_PATTERN_ALL	0xFF
+
+/* WOL config register */
+#define	VGE_WOLCFG_PHYINT_ENB	0x01
+#define	VGE_WOLCFG_SAB		0x10
+#define	VGE_WOLCFG_SAM		0x20
+#define	VGE_WOLCFG_PMEOVR	0x80
+
 /* EEPROM control/status register */
 
 #define VGE_EECSR_EDO		0x01	/* data out pin */



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

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:16:50 UTC 2019

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

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

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

Set MTU correctly if mtu > 1500.


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

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



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

2019-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 26 18:14:54 UTC 2019

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

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

sys/dev/pci/pcireg.h1.147 via patch
sys/dev/pci/pci_subr.c  1.212, 1.215-1.217 via 
patch

- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard
  Timer Status and Discard Timer SERR# Enable bit in pci_subr.c.
- Print some DPC register values not with %04x but with %08x because
  those are 32bit.
- Remove whitespace for consistency.
- Use macro.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.11 -r1.183.2.12 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.8 -r1.130.2.9 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.183.2.11 src/sys/dev/pci/pci_subr.c:1.183.2.12
--- src/sys/dev/pci/pci_subr.c:1.183.2.11	Wed Jul 17 15:55:31 2019
+++ src/sys/dev/pci/pci_subr.c	Thu Sep 26 18:14:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.11 2019/07/17 15:55:31 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.12 2019/09/26 18:14:54 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.183.2.11 2019/07/17 15:55:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.12 2019/09/26 18:14:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -209,7 +209,7 @@ static const struct pci_class pci_subcla
 
 /* PCI bridge programming interface */
 static const struct pci_class pci_interface_pcibridge[] = {
-	{ "",			PCI_INTERFACE_BRIDGE_PCI_PCI, NULL,	},
+	{ "",			PCI_INTERFACE_BRIDGE_PCI_PCI,	NULL,	},
 	{ "subtractive decode",	PCI_INTERFACE_BRIDGE_PCI_SUBDEC, NULL,	},
 	{ NULL,			0,NULL,	},
 };
@@ -223,8 +223,8 @@ static const struct pci_class pci_interf
 
 /* Advanced Switching programming interface */
 static const struct pci_class pci_interface_advsw[] = {
-	{ "custom interface",	PCI_INTERFACE_ADVSW_CUSTOM, NULL, },
-	{ "ASI-SIG",		PCI_INTERFACE_ADVSW_ASISIG, NULL, },
+	{ "custom interface",	PCI_INTERFACE_ADVSW_CUSTOM,	NULL, },
+	{ "ASI-SIG",		PCI_INTERFACE_ADVSW_ASISIG,	NULL, },
 	{ NULL,			0,NULL,	},
 };
 
@@ -304,7 +304,7 @@ static const struct pci_class pci_subcla
 /*
  * Class 0x08.
  * Base system peripheral.
- */ 
+ */
 
 /* PIC programming interface */
 static const struct pci_class pci_interface_pic[] = {
@@ -429,10 +429,10 @@ static const struct pci_class pci_interf
 
 /* IPMI programming interface */
 static const struct pci_class pci_interface_ipmi[] = {
-	{ "SMIC",		PCI_INTERFACE_IPMI_SMIC,		NULL,},
-	{ "keyboard",		PCI_INTERFACE_IPMI_KBD,			NULL,},
-	{ "block transfer",	PCI_INTERFACE_IPMI_BLOCKXFER,		NULL,},
-	{ NULL,			0,	NULL,},
+	{ "SMIC",		PCI_INTERFACE_IPMI_SMIC,	NULL,	},
+	{ "keyboard",		PCI_INTERFACE_IPMI_KBD,		NULL,	},
+	{ "block transfer",	PCI_INTERFACE_IPMI_BLOCKXFER,	NULL,	},
+	{ NULL,			0,NULL,	},
 };
 
 /* Subclasses */
@@ -478,8 +478,8 @@ static const struct pci_class pci_subcla
 
 /* Intelligent IO programming interface */
 static const struct pci_class pci_interface_i2o[] = {
-	{ "FIFO at offset 0x40", PCI_INTERFACE_I2O_FIFOAT40,		NULL,},
-	{ NULL,			0,	NULL,},
+	{ "FIFO at offset 0x40", PCI_INTERFACE_I2O_FIFOAT40,	NULL,	},
+	{ NULL,			0,NULL,	},
 };
 
 /* Subclasses */
@@ -494,9 +494,9 @@ static const struct pci_class pci_subcla
  * Satellite communication controller.
  */
 static const struct pci_class pci_subclass_satcom[] = {
-	{ "TV",			PCI_SUBCLASS_SATCOM_TV,	 	NULL,	},
-	{ "audio",		PCI_SUBCLASS_SATCOM_AUDIO, 	NULL,	},
-	{ "voice",		PCI_SUBCLASS_SATCOM_VOICE, 	NULL,	},
+	{ "TV",			PCI_SUBCLASS_SATCOM_TV,		NULL,	},
+	{ "audio",		PCI_SUBCLASS_SATCOM_AUDIO,	NULL,	},
+	{ "voice",		PCI_SUBCLASS_SATCOM_VOICE,	NULL,	},
 	{ "data",		PCI_SUBCLASS_SATCOM_DATA,	NULL,	},
 	{ "miscellaneous",	PCI_SUBCLASS_SATCOM_MISC,	NULL,	},
 	{ NULL,			0,NULL,	},
@@ -507,9 +507,9 @@ static const struct pci_class pci_subcla
  * Encryption/Decryption controller.
  */
 static const struct pci_class pci_subclass_crypto[] = {
-	{ "network/computing",	PCI_SUBCLASS_CRYPTO_NETCOMP, 	NULL,	},
+	{ "network/computing",	PCI_SUBCLASS_CRYPTO_NETCOMP,	NULL,	},
 	{ "entertainment",	PCI_SUBCLASS_CRYPTO_ENTERTAINMENT, NULL,},
-	{ "miscellaneous",	PCI_SUBCLASS_CRYPTO_MISC, 	NULL,	},
+	{ "miscellaneous",	PCI_SUBCLASS_CRYPTO_MISC,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
 
@@ -585,7 +585,7 @@ DEV_VERBOSE_DEFINE(pci);
  * a positive value if the dest buffer would have overflowed.
  */
 
-static int __printflike(3,4)
+static int __printflike(3, 4)
 snappendf(char **dest, size_t 

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

2019-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 26 18:14:54 UTC 2019

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

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

sys/dev/pci/pcireg.h1.147 via patch
sys/dev/pci/pci_subr.c  1.212, 1.215-1.217 via 
patch

- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard
  Timer Status and Discard Timer SERR# Enable bit in pci_subr.c.
- Print some DPC register values not with %04x but with %08x because
  those are 32bit.
- Remove whitespace for consistency.
- Use macro.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.11 -r1.183.2.12 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.8 -r1.130.2.9 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-8] src/sys/dev/pci/ixgbe

2019-09-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  6 13:44:36 UTC 2019

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

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

fix mistake in previous.


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

2019-09-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  6 13:44:36 UTC 2019

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

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

fix mistake in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.33 -r1.88.2.34 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.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.34
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.33	Thu Sep  5 09:06:07 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Sep  6 13:44:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.33 2019/09/05 09:06:07 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.34 2019/09/06 13:44:36 martin Exp $ */
 
 /**
 
@@ -1397,6 +1397,7 @@ static void
 ixgbe_add_media_types(struct adapter *adapter)
 {
 	struct ixgbe_hw *hw = >hw;
+	device_t	dev = adapter->dev;
 	u64		layer;
 
 	layer = adapter->phy_layer;



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

2019-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  5 09:06:08 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_common.c
ixgbe_netbsd.c ixgbe_x550.c ixv.c

Log Message:
Apply patch, requested by msaitoh in ticket #1367, to pull up the following
revisions:

sys/dev/pci/ixgbe/ixgbe_x550.c  1.16
sys/dev/pci/ixgbe/ixgbe.c   1.180,1.203-1.204,
1.207-1.208 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.55
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.10
sys/dev/pci/ixgbe/ixgbe_common.c1.25
sys/dev/pci/ixgbe/ixv.c 1.129-1.130

- X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
- An interrupt might not arrive when a module is inserted. When an link
  status change interrupt occurred and the driver still regard SFP as
  unplugged, issue the module softint before issuing LSC softint.
- Add 1BASE-LX media if it's 1000BASE-BX.
- printf -> device_printf
- Avoid undefined behavior of VLAN filter setting.
- Simplify code.
- Fix typo in unused code.
- Fix typo in comment. Found by Wataru Ashihara.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.16 -r1.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.32 -r1.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.6 -r1.13.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.5.6.6 -r1.5.6.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.23 -r1.56.2.24 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.16 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.17
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.16	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Sep  5 09:06:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.16 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.17 2019/09/05 09:06:07 martin Exp $ */
 
 /**
 
@@ -1363,7 +1363,9 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 			error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat,
 			rxbuf->pmap, mp, BUS_DMA_NOWAIT);
 			if (error != 0) {
-printf("Refresh mbufs: payload dmamap load failure - %d\n", error);
+device_printf(adapter->dev, "Refresh mbufs: "
+"payload dmamap load failure - %d\n",
+error);
 m_free(mp);
 rxbuf->buf = NULL;
 goto update;

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.33
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32	Thu Aug 29 16:31:53 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Sep  5 09:06:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.32 2019/08/29 16:31:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.33 2019/09/05 09:06:07 martin Exp $ */
 
 /**
 
@@ -1397,7 +1397,6 @@ static void
 ixgbe_add_media_types(struct adapter *adapter)
 {
 	struct ixgbe_hw *hw = >hw;
-	device_t	dev = adapter->dev;
 	u64		layer;
 
 	layer = adapter->phy_layer;
@@ -1449,7 +1448,7 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_10G_KR | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
-		ADD(AIFM_10G_KX4 | IFM_FDX, 0);
+		ADD(IFM_10G_KX4 | IFM_FDX, 0);
 	}
 #else
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
@@ -1476,7 +1475,7 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_5000_T | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
-		device_printf(dev, "Media supported: 1000baseBX\n");
+		ADD(IFM_1000_LX | IFM_FDX, 0); /* IFM_1000_BX */
 	/* XXX no ifmedia_set? */
 
 	ADD(IFM_AUTO, 0);
@@ -1496,6 +1495,8 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 			return (TRUE);
 		return (FALSE);
 	case ixgbe_mac_82599EB:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
 		switch (hw->mac.ops.get_media_type(hw)) {
 		case ixgbe_media_type_fiber:
 		case ixgbe_media_type_fiber_qsfp:
@@ -1503,11 +1504,6 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 		default:
 			return (FALSE);
 		}
-	case ixgbe_mac_X550EM_x:
-	case ixgbe_mac_X550EM_a:
-		if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber)
-			return (TRUE);
-		return (FALSE);
 	default:
 		return (FALSE);
 	}
@@ -2542,7 +2538,7 @@ ixgbe_enable_queue(struct adapter *adapt
 {
 	struct ixgbe_hw *hw = >hw;
 	struct ix_queue *que = >queues[vector];
-	u64		queue = (u64)(1ULL << vector);
+	u64		queue = 1ULL << vector;
 	u32		mask;
 
 	mutex_enter(>dc_mtx);
@@ -3077,6 +3073,34 @@ ixgbe_msix_link(void *arg)
 	/* Clear interrupt with write */
 	IXGBE_WRITE_REG(hw, 

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

2019-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  5 09:06:08 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_common.c
ixgbe_netbsd.c ixgbe_x550.c ixv.c

Log Message:
Apply patch, requested by msaitoh in ticket #1367, to pull up the following
revisions:

sys/dev/pci/ixgbe/ixgbe_x550.c  1.16
sys/dev/pci/ixgbe/ixgbe.c   1.180,1.203-1.204,
1.207-1.208 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.55
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.10
sys/dev/pci/ixgbe/ixgbe_common.c1.25
sys/dev/pci/ixgbe/ixv.c 1.129-1.130

- X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
- An interrupt might not arrive when a module is inserted. When an link
  status change interrupt occurred and the driver still regard SFP as
  unplugged, issue the module softint before issuing LSC softint.
- Add 1BASE-LX media if it's 1000BASE-BX.
- printf -> device_printf
- Avoid undefined behavior of VLAN filter setting.
- Simplify code.
- Fix typo in unused code.
- Fix typo in comment. Found by Wataru Ashihara.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.16 -r1.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.32 -r1.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.6 -r1.13.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.5.6.6 -r1.5.6.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.23 -r1.56.2.24 src/sys/dev/pci/ixgbe/ixv.c

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



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

2019-08-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 29 16:31:53 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1347):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o
pullup-8, pullup-9

 -

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by 
nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o
pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.31 -r1.88.2.32 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.88.2.31 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.31	Thu Aug  1 14:14:30 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Aug 29 16:31:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.31 2019/08/01 14:14:30 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.32 2019/08/29 16:31:53 martin Exp $ */
 
 /**
 
@@ -6410,7 +6410,9 @@ ixgbe_allocate_legacy(struct adapter *ad
 	int		counts[PCI_INTR_TYPE_SIZE];
 	pci_intr_type_t intr_type, max_type;
 	char		intrbuf[PCI_INTRSTR_LEN];
+	char		wqname[MAXCOMLEN];
 	const char	*intrstr = NULL;
+	int defertx_error = 0, error;
 
 	/* We allocate a single interrupt resource */
 	max_type = PCI_INTR_TYPE_MSI;
@@ -6472,15 +6474,27 @@ alloc_retry:
 	 * Try allocating a fast interrupt and the associated deferred
 	 * processing contexts.
 	 */
-	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
+	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 		txr->txr_si =
 		softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 			ixgbe_deferred_mq_start, txr);
+
+		snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
+		defertx_error = workqueue_create(>txr_wq, wqname,
+		ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI,
+		IPL_NET, IXGBE_WORKQUEUE_FLAGS);
+		adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
+	}
 	que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 	ixgbe_handle_que, que);
+	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
+	error = workqueue_create(>que_wq, wqname,
+	ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
+	IXGBE_WORKQUEUE_FLAGS);
 
 	if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)
-		& (txr->txr_si == NULL)) || (que->que_si == NULL)) {
+		&& ((txr->txr_si == NULL) || defertx_error != 0))
+	|| (que->que_si == NULL) || error != 0) {
 		aprint_error_dev(dev,
 		"could not establish software interrupts\n");
 



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

2019-08-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 29 16:31:53 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1347):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o
pullup-8, pullup-9

 -

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by 
nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o
pullup-8, pullup-9


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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:10:17 UTC 2019

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

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

sys/dev/pci/if_etreg.h  1.2-1.3
sys/dev/pci/if_et.c 1.23,1.25 and 1.26
via patch

Make et(4) work:
- Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags
  controllable.
- Enabling TX/RX in et_init() will always fail when cable is not
  plugged in. If this happens, we delay TX/RX enablement until link is
  up.
- Modify flow control stuff a little. It still doesn't work.
- Avoid undefined behavior when reset the chip.
- Code cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.14.8.2 -r1.14.8.3 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.1 -r1.1.54.1 src/sys/dev/pci/if_etreg.h

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



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:10:17 UTC 2019

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

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

sys/dev/pci/if_etreg.h  1.2-1.3
sys/dev/pci/if_et.c 1.23,1.25 and 1.26
via patch

Make et(4) work:
- Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags
  controllable.
- Enabling TX/RX in et_init() will always fail when cable is not
  plugged in. If this happens, we delay TX/RX enablement until link is
  up.
- Modify flow control stuff a little. It still doesn't work.
- Avoid undefined behavior when reset the chip.
- Code cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.14.8.2 -r1.14.8.3 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.1 -r1.1.54.1 src/sys/dev/pci/if_etreg.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_et.c
diff -u src/sys/dev/pci/if_et.c:1.14.8.2 src/sys/dev/pci/if_et.c:1.14.8.3
--- src/sys/dev/pci/if_et.c:1.14.8.2	Mon May 13 12:40:13 2019
+++ src/sys/dev/pci/if_et.c	Tue Aug  6 16:10:17 2019
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_et.c,v 1.14.8.2 2019/05/13 12:40:13 martin Exp $	*/
-/*	$OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $	*/
+/*	$NetBSD: if_et.c,v 1.14.8.3 2019/08/06 16:10:17 martin Exp $	*/
+/*	$OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.2 2019/05/13 12:40:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.3 2019/08/06 16:10:17 martin Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -83,17 +83,19 @@ __KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.
 
 int	et_match(device_t, cfdata_t, void *);
 void	et_attach(device_t, device_t, void *);
-int	et_detach(device_t, int flags);
+int	et_detach(device_t, int);
 int	et_shutdown(device_t);
 
 int	et_miibus_readreg(device_t, int, int);
 void	et_miibus_writereg(device_t, int, int, int);
 void	et_miibus_statchg(struct ifnet *);
 
-int	et_init(struct ifnet *ifp);
+int	et_init(struct ifnet *);
 int	et_ioctl(struct ifnet *, u_long, void *);
 void	et_start(struct ifnet *);
 void	et_watchdog(struct ifnet *);
+static int	et_ifmedia_upd(struct ifnet *);
+static void	et_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
 int	et_intr(void *);
 void	et_enable_intrs(struct et_softc *, uint32_t);
@@ -131,7 +133,6 @@ int	et_start_rxdma(struct et_softc *);
 int	et_start_txdma(struct et_softc *);
 int	et_stop_rxdma(struct et_softc *);
 int	et_stop_txdma(struct et_softc *);
-int	et_enable_txrx(struct et_softc *);
 void	et_reset(struct et_softc *);
 int	et_bus_config(struct et_softc *);
 void	et_get_eaddr(struct et_softc *, uint8_t[]);
@@ -189,6 +190,8 @@ et_attach(device_t parent, device_t self
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	struct ifnet *ifp = >sc_ethercom.ec_if;
+	struct mii_data * const mii = >sc_miibus;
+	uint32_t pmcfg;
 	pcireg_t memtype;
 	int error;
 	char intrbuf[PCI_INTRSTR_LEN];
@@ -232,6 +235,9 @@ et_attach(device_t parent, device_t self
 	sc->sc_pct = pa->pa_pc;
 	sc->sc_pcitag = pa->pa_tag;
 
+	if (pa->pa_id == PCI_PRODUCT_LUCENT_ET1301)
+		sc->sc_flags |= ET_FLAG_FASTETHER;
+
 	error = et_bus_config(sc);
 	if (error)
 		goto fail;
@@ -241,8 +247,11 @@ et_attach(device_t parent, device_t self
 	aprint_normal_dev(self, "Ethernet address %s\n",
 	ether_sprintf(sc->sc_enaddr));
 
-	CSR_WRITE_4(sc, ET_PM,
-		ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE);
+	/* Take PHY out of COMA and enable clocks. */
+	pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE;
+	if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0)
+		pmcfg |= EM_PM_GIGEPHY_ENB;
+	CSR_WRITE_4(sc, ET_PM, pmcfg);
 
 	et_reset(sc);
 
@@ -265,23 +274,21 @@ et_attach(device_t parent, device_t self
 
 	et_chip_attach(sc);
 
-	sc->sc_miibus.mii_ifp = ifp;
-	sc->sc_miibus.mii_readreg = et_miibus_readreg;
-	sc->sc_miibus.mii_writereg = et_miibus_writereg;
-	sc->sc_miibus.mii_statchg = et_miibus_statchg;
-
-	sc->sc_ethercom.ec_mii = >sc_miibus;
-	ifmedia_init(>sc_miibus.mii_media, 0, ether_mediachange,
-	ether_mediastatus);
-	mii_attach(self, >sc_miibus, 0x, MII_PHY_ANY,
-	MII_OFFSET_ANY, 0);
-	if (LIST_FIRST(>sc_miibus.mii_phys) == NULL) {
+	mii->mii_ifp = ifp;
+	mii->mii_readreg = et_miibus_readreg;
+	mii->mii_writereg = et_miibus_writereg;
+	mii->mii_statchg = et_miibus_statchg;
+
+	sc->sc_ethercom.ec_mii = mii;
+	ifmedia_init(>mii_media, 0, et_ifmedia_upd, et_ifmedia_sts);
+	mii_attach(self, mii, 0x, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (LIST_FIRST(>mii_phys) == NULL) {
 		aprint_error_dev(self, "no PHY found!\n");
-		ifmedia_add(>sc_miibus.mii_media, 

  1   2   >