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

2021-06-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  5 10:57:11 UTC 2021

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

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

sys/dev/pci/if_iwmreg.h: revision 1.8

Can't left shift a signed int by 31. Found by kubsan.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.6.1 src/sys/dev/pci/if_iwmreg.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_iwmreg.h
diff -u src/sys/dev/pci/if_iwmreg.h:1.6 src/sys/dev/pci/if_iwmreg.h:1.6.6.1
--- src/sys/dev/pci/if_iwmreg.h:1.6	Tue Mar 14 23:59:26 2017
+++ src/sys/dev/pci/if_iwmreg.h	Sat Jun  5 10:57:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwmreg.h,v 1.6 2017/03/14 23:59:26 nonaka Exp $	*/
+/*	$NetBSD: if_iwmreg.h,v 1.6.6.1 2021/06/05 10:57:11 martin Exp $	*/
 /*	OpenBSD: if_iwmreg.h,v 1.19 2016/09/20 11:46:09 stsp Exp 	*/
 
 /*-
@@ -191,7 +191,7 @@
 
 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
  * acknowledged (reset) by host writing "1" to flagged bits. */
-#define IWM_CSR_INT_BIT_FH_RX	(1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
+#define IWM_CSR_INT_BIT_FH_RX	(1U << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
 #define IWM_CSR_INT_BIT_HW_ERR	(1 << 29) /* DMA hardware error FH_INT[31] */
 #define IWM_CSR_INT_BIT_RX_PERIODIC	(1 << 28) /* Rx periodic */
 #define IWM_CSR_INT_BIT_FH_TX	(1 << 27) /* Tx DMA FH_INT[1:0] */
@@ -214,7 +214,7 @@
  IWM_CSR_INT_BIT_RX_PERIODIC)
 
 /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
-#define IWM_CSR_FH_INT_BIT_ERR   (1 << 31) /* Error */
+#define IWM_CSR_FH_INT_BIT_ERR   (1U << 31) /* Error */
 #define IWM_CSR_FH_INT_BIT_HI_PRIOR  (1 << 30) /* High priority Rx, bypass coalescing */
 #define IWM_CSR_FH_INT_BIT_RX_CHNL1  (1 << 17) /* Rx channel 1 */
 #define IWM_CSR_FH_INT_BIT_RX_CHNL0  (1 << 16) /* Rx channel 0 */
@@ -405,7 +405,7 @@
 #define IWM_CSR_DBG_HPET_MEM_REG_VAL	(0x)
 
 /* DRAM INT TABLE */
-#define IWM_CSR_DRAM_INT_TBL_ENABLE		(1 << 31)
+#define IWM_CSR_DRAM_INT_TBL_ENABLE		(1U << 31)
 #define IWM_CSR_DRAM_INIT_TBL_WRITE_POINTER	(1 << 28)
 #define IWM_CSR_DRAM_INIT_TBL_WRAP_CHECK	(1 << 27)
 
@@ -558,7 +558,7 @@ enum iwm_secure_load_status_reg {
 #define IWM_HOST_INT_TIMEOUT_MAX	(0xFF)
 #define IWM_HOST_INT_TIMEOUT_DEF	(0x40)
 #define IWM_HOST_INT_TIMEOUT_MIN	(0x0)
-#define IWM_HOST_INT_OPER_MODE		(1 << 31)
+#define IWM_HOST_INT_OPER_MODE		(1U << 31)
 
 /*
  *7000/3000 series SHR DTS addresses *
@@ -643,7 +643,7 @@ enum iwm_ucode_tlv_flag {
 	IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD	= (1 << 26),
 	IWM_UCODE_TLV_FLAGS_BCAST_FILTERING	= (1 << 29),
 	IWM_UCODE_TLV_FLAGS_GO_UAPSD		= (1 << 30),
-	IWM_UCODE_TLV_FLAGS_LTE_COEX		= (1 << 31),
+	IWM_UCODE_TLV_FLAGS_LTE_COEX		= (1U << 31),
 };
 #define IWM_UCODE_TLV_FLAG_BITS \
 	"\020\1PAN\2NEWSCAN\3MFP\4P2P\5DW_BC_TABLE\6NEWBT_COEX\7PM_CMD\10SHORT_BL\11RX_ENERGY\12TIME_EVENT_V2\13D3_6_IPV6\14BF_UPDATED\15NO_BASIC_SSID\17D3_CONTINUITY\20NEW_NSOFFL_S\21NEW_NSOFFL_L\22SCHED_SCAN\24STA_KEY_CMD\25DEVICE_PS_CMD\26P2P_PS\27P2P_PS_DCM\30P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40LTE_COEX"
@@ -4369,7 +4369,7 @@ enum iwm_tx_flags {
 	IWM_TX_CMD_FLG_FW_DROP		= (1 << 26),
 	IWM_TX_CMD_FLG_EXEC_PAPD	= (1 << 27),
 	IWM_TX_CMD_FLG_PAPD_TYPE	= (1 << 28),
-	IWM_TX_CMD_FLG_HCCA_CHUNK	= (1 << 31)
+	IWM_TX_CMD_FLG_HCCA_CHUNK	= (1U << 31)
 }; /* IWM_TX_FLAGS_BITS_API_S_VER_1 */
 
 /**



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

2020-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 16 18:18:15 UTC 2020

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

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

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

Fix little-endian dependence in wm_rxeof(), by which packets cannot be
received by 82574 and successors on big-endian machines.

Tested by aarch64eb with I210-T1 on ROCKPro64.

Thanks msaitoh for discussion!
XXX
pullup to netbsd-9 and netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.41 -r1.508.4.42 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.41 src/sys/dev/pci/if_wm.c:1.508.4.42
--- src/sys/dev/pci/if_wm.c:1.508.4.41	Wed Nov  4 11:51:57 2020
+++ src/sys/dev/pci/if_wm.c	Mon Nov 16 18:18:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.42 2020/11/16 18:18:14 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.41 2020/11/04 11:51:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.42 2020/11/16 18:18:14 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8790,9 +8790,11 @@ wm_rxdesc_get_status(struct wm_rxqueue *
 	struct wm_softc *sc = rxq->rxq_sc;
 
 	if (sc->sc_type == WM_T_82574)
-		return EXTRXC_STATUS(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat);
+		return EXTRXC_STATUS(
+		le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat));
 	else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0)
-		return NQRXC_STATUS(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat);
+		return NQRXC_STATUS(
+		le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat));
 	else
 		return rxq->rxq_descs[idx].wrx_status;
 }
@@ -8803,9 +8805,11 @@ wm_rxdesc_get_errors(struct wm_rxqueue *
 	struct wm_softc *sc = rxq->rxq_sc;
 
 	if (sc->sc_type == WM_T_82574)
-		return EXTRXC_ERROR(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat);
+		return EXTRXC_ERROR(
+		le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat));
 	else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0)
-		return NQRXC_ERROR(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat);
+		return NQRXC_ERROR(
+		le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat));
 	else
 		return rxq->rxq_descs[idx].wrx_errors;
 }



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

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 11:51:57 UTC 2020

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

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

sys/dev/pci/if_wm.c: revision 1.694
sys/dev/pci/if_wm.c: revision 1.695 (via patch)
sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.40 -r1.508.4.41 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.33.6.6 -r1.33.6.7 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.40 src/sys/dev/pci/if_wm.c:1.508.4.41
--- src/sys/dev/pci/if_wm.c:1.508.4.40	Fri Oct 16 08:06:02 2020
+++ src/sys/dev/pci/if_wm.c	Wed Nov  4 11:51:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.40 2020/10/16 08:06:02 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 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.40 2020/10/16 08:06:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -374,7 +374,8 @@ struct wm_txqueue {
 	 * to manage Tx H/W queue's busy flag.
 	 */
 	int txq_flags;			/* flags for H/W queue, see below */
-#define	WM_TXQ_NO_SPACE	0x1
+#define	WM_TXQ_NO_SPACE		0x1
+#define	WM_TXQ_LINKDOWN_DISCARD	0x2
 
 	bool txq_stopping;
 
@@ -1018,6 +1019,9 @@ static void	wm_toggle_lanphypc_pch_lpt(s
 static int	wm_platform_pm_pch_lpt(struct wm_softc *, bool);
 static void	wm_pll_workaround_i210(struct wm_softc *);
 static void	wm_legacy_irq_quirk_spt(struct wm_softc *);
+static bool	wm_phy_need_linkdown_discard(struct wm_softc *);
+static void	wm_set_linkdown_discard(struct wm_softc *);
+static void	wm_clear_linkdown_discard(struct wm_softc *);
 
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
 wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
@@ -3041,6 +3045,9 @@ alloc_retry:
 
 	sc->sc_txrx_use_workqueue = false;
 
+	if (wm_phy_need_linkdown_discard(sc))
+		wm_set_linkdown_discard(sc);
+
 	wm_init_sysctls(sc);
 
 	if (pmf_device_register(self, wm_suspend, wm_resume))
@@ -3399,6 +3406,49 @@ out:
 	return rc;
 }
 
+static bool
+wm_phy_need_linkdown_discard(struct wm_softc *sc)
+{
+
+	switch(sc->sc_phytype) {
+	case WMPHY_82577: /* ihphy */
+	case WMPHY_82578: /* atphy */
+	case WMPHY_82579: /* ihphy */
+	case WMPHY_I217: /* ihphy */
+	case WMPHY_82580: /* ihphy */
+	case WMPHY_I350: /* ihphy */
+		return true;
+	default:
+		return false;
+	}
+}
+
+static void
+wm_set_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags |= WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
+static void
+wm_clear_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags &= ~WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
 /*
  * wm_ioctl:		[ifnet interface function]
  *
@@ -3442,6 +3492,12 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 #ifdef WM_MPSAFE
 		splx(s);
 #endif
+		if (error == 0 && wm_phy_need_linkdown_discard(sc)) {
+			if (IFM_SUBTYPE(ifr->ifr_media) == IFM_NONE)
+wm_set_linkdown_discard(sc);
+			else
+wm_clear_linkdown_discard(sc);
+		}
 		break;
 	case SIOCINITIFADDR:
 		WM_CORE_LOCK(sc);
@@ -3456,8 +3512,17 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 			break;
 		}
 		WM_CORE_UNLOCK(sc);
+		if (((ifp->if_flags & IFF_UP) == 0) && wm_phy_need_linkdown_discard(sc))
+			wm_clear_linkdown_discard(sc);
 		/*FALLTHROUGH*/
 	default:
+		if (cmd == SIOCSIFFLAGS && wm_phy_need_linkdown_discard(sc)) {
+			if (((ifp->if_flags & IFF_UP) == 0) && ((ifr->ifr_flags & IFF_UP) != 0)) {
+wm_clear_linkdown_discard(sc);
+			} else if (((ifp->if_flags & IFF_UP) != 0) && ((ifr->ifr_flags & IFF_UP) == 0)) {
+wm_set_linkdown_discard(sc);
+			}
+		}
 #ifdef WM_MPSAFE
 		s = splnet();
 #endif
@@ -7542,6 +7607,16 @@ wm_select_txqueue(struct ifnet *ifp, str
 	return ((cpuid + ncpu - sc->sc_affinity_offset) % ncpu) % sc->sc_nqueues;
 }
 
+static inline bool
+wm_linkdown_discard(struct wm_txqueue *txq)
+{
+
+	if ((txq->txq_flags & WM_TXQ_LINKDOWN_DISCARD) != 0)
+		return true;
+
+	return false;
+}
+
 /*
  * wm_start:		[ifnet interface function]
  *
@@ -7636,6 +7711,23 @@ 

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

2020-10-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 16 08:06:02 UTC 2020

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

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

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

  Fixes a problem that the attach function reported
"wm_gmii_setup_phytype: Unknown PHY model. OUI=00, model=" and
"PHY type is still unknown." Don't call wm_gmii_setup_phytype() three times if
the interface uses SGMII with internal MDIO.

  Tested with I354(Rangeley(SGMII(MDIO))) and I350(SERDES(SFP), SGMII(SFP)).


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.39 -r1.508.4.40 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.39 src/sys/dev/pci/if_wm.c:1.508.4.40
--- src/sys/dev/pci/if_wm.c:1.508.4.39	Wed Aug  5 17:22:45 2020
+++ src/sys/dev/pci/if_wm.c	Fri Oct 16 08:06:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.39 2020/08/05 17:22:45 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.40 2020/10/16 08:06:02 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.39 2020/08/05 17:22:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.40 2020/10/16 08:06:02 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2847,7 +2847,8 @@ alloc_retry:
 			reg &= ~CTRL_EXT_I2C_ENA;
 		CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
 		if ((sc->sc_flags & WM_F_SGMII) != 0) {
-			wm_gmii_setup_phytype(sc, 0, 0);
+			if (!wm_sgmii_uses_mdio(sc))
+wm_gmii_setup_phytype(sc, 0, 0);
 			wm_reset_mdicnfg_82580(sc);
 		}
 	} else if (sc->sc_type < WM_T_82543 ||



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

2020-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 23 14:31:47 UTC 2020

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

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

sys/dev/pci/virtio_pci.c: revision 1.13 (patch)
(applied to sys/dev/pci/virtio.c)

Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.

The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.

This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.


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

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

Modified files:

Index: src/sys/dev/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.28.2.2 src/sys/dev/pci/virtio.c:1.28.2.3
--- src/sys/dev/pci/virtio.c:1.28.2.2	Sun Sep 20 10:14:20 2020
+++ src/sys/dev/pci/virtio.c	Wed Sep 23 14:31:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.28.2.2 2020/09/20 10:14:20 martin Exp $	*/
+/*	$NetBSD: virtio.c,v 1.28.2.3 2020/09/23 14:31:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.2 2020/09/20 10:14:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.3 2020/09/23 14:31:46 martin Exp $");
 
 #include 
 #include 
@@ -280,10 +280,13 @@ virtio_setup_interrupts(struct virtio_so
 {
 	device_t self = sc->sc_dev;
 	pci_chipset_tag_t pc = sc->sc_pa.pa_pc;
+	pcitag_t tag = sc->sc_pa.pa_tag;
 	int error;
 	int nmsix;
+	int off;
 	int counts[PCI_INTR_TYPE_SIZE];
 	pci_intr_type_t max_type;
+	pcireg_t ctl;
 
 	nmsix = pci_msix_count(sc->sc_pa.pa_pc, sc->sc_pa.pa_tag);
 	aprint_debug_dev(self, "pci_msix_count=%d\n", nmsix);
@@ -338,6 +341,13 @@ virtio_setup_interrupts(struct virtio_so
 
 		sc->sc_ihs_num = 1;
 		sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI;
+
+		error = pci_get_capability(pc, tag, PCI_CAP_MSIX, , NULL);
+		if (error != 0) {
+			ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
+			ctl &= ~PCI_MSIX_CTL_ENABLE;
+			pci_conf_write(pc, tag, off + PCI_MSIX_CTL, ctl);
+		}
 	}
 
 	KASSERT(sc->sc_soft_ih == NULL);



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

2020-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 20 10:14:20 UTC 2020

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

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

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

Ensure interrupt handles buffer is zeroed on allocation
Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me


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

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

Modified files:

Index: src/sys/dev/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.28.2.1 src/sys/dev/pci/virtio.c:1.28.2.2
--- src/sys/dev/pci/virtio.c:1.28.2.1	Mon Feb 19 18:19:15 2018
+++ src/sys/dev/pci/virtio.c	Sun Sep 20 10:14:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.28.2.1 2018/02/19 18:19:15 snj Exp $	*/
+/*	$NetBSD: virtio.c,v 1.28.2.2 2020/09/20 10:14:20 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.1 2018/02/19 18:19:15 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.2 2020/09/20 10:14:20 martin Exp $");
 
 #include 
 #include 
@@ -309,7 +309,7 @@ virtio_setup_interrupts(struct virtio_so
 	}
 
 	if (pci_intr_type(pc, sc->sc_ihp[0]) == PCI_INTR_TYPE_MSIX) {
-		sc->sc_ihs = kmem_alloc(sizeof(*sc->sc_ihs) * 2,
+		sc->sc_ihs = kmem_zalloc(sizeof(*sc->sc_ihs) * 2,
 		KM_SLEEP);
 
 		error = virtio_setup_msix_interrupts(sc, >sc_pa);
@@ -326,7 +326,7 @@ virtio_setup_interrupts(struct virtio_so
 		sc->sc_ihs_num = 2;
 		sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI;
 	} else if (pci_intr_type(pc, sc->sc_ihp[0]) == PCI_INTR_TYPE_INTX) {
-		sc->sc_ihs = kmem_alloc(sizeof(*sc->sc_ihs) * 1,
+		sc->sc_ihs = kmem_zalloc(sizeof(*sc->sc_ihs) * 1,
 		KM_SLEEP);
 
 		error = virtio_setup_intx_interrupt(sc, >sc_pa);



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

2020-09-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep  2 12:27:54 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_82598.c ixgbe_82599.c
ixgbe_phy.c ixgbe_type.h ixgbe_x550.c

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

sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe.c: revision 1.219
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.22
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.44

Add recovery code for unsupported SFP+.

Before this commit:
   If an unsupported SFP module is inserted before booting, the driver attach
   failed and there was no way to recover form it without rebooting or
   detaching/reattaching driver (drvctl -d && drvctl -r pciN).

After this commit:
   We can automatically recover any time by replacing it with a supported
   module.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.41 -r1.88.2.42 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.8.8.4 -r1.8.8.5 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.14.8.5 -r1.14.8.6 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.11.6.6 -r1.11.6.7 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.22.2.11 -r1.22.2.12 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.8 -r1.5.6.9 src/sys/dev/pci/ixgbe/ixgbe_x550.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.41 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.42
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.41	Wed Sep  2 12:24:08 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Sep  2 12:27:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.41 2020/09/02 12:24:08 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.42 2020/09/02 12:27:54 martin Exp $ */
 
 /**
 
@@ -776,6 +776,7 @@ ixgbe_attach(device_t parent, device_t d
 	pcireg_t	id, subid;
 	const ixgbe_vendor_info_t *ent;
 	struct pci_attach_args *pa = aux;
+	bool unsupported_sfp = false;
 	const char *str;
 	char buf[256];
 
@@ -956,8 +957,8 @@ ixgbe_attach(device_t parent, device_t d
 		error = IXGBE_SUCCESS;
 	} else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) {
 		aprint_error_dev(dev, "Unsupported SFP+ module detected!\n");
-		error = EIO;
-		goto err_late;
+		unsupported_sfp = true;
+		error = IXGBE_SUCCESS;
 	} else if (error) {
 		aprint_error_dev(dev, "Hardware initialization failed\n");
 		error = EIO;
@@ -1126,13 +1127,6 @@ ixgbe_attach(device_t parent, device_t d
 		"please contact your Intel or hardware representative "
 		"who provided you with this hardware.\n");
 		break;
-	case IXGBE_ERR_SFP_NOT_SUPPORTED:
-		aprint_error_dev(dev, "Unsupported SFP+ Module\n");
-		error = EIO;
-		goto err_late;
-	case IXGBE_ERR_SFP_NOT_PRESENT:
-		aprint_error_dev(dev, "No SFP+ Module found\n");
-		/* falls thru */
 	default:
 		break;
 	}
@@ -1165,16 +1159,22 @@ ixgbe_attach(device_t parent, device_t d
 			oui, model, rev);
 	}
 
-	/* Enable the optics for 82599 SFP+ fiber */
-	ixgbe_enable_tx_laser(hw);
-
 	/* Enable EEE power saving */
 	if (adapter->feat_cap & IXGBE_FEATURE_EEE)
 		hw->mac.ops.setup_eee(hw,
 		adapter->feat_en & IXGBE_FEATURE_EEE);
 
 	/* Enable power to the phy. */
-	ixgbe_set_phy_power(hw, TRUE);
+	if (!unsupported_sfp) {
+		/* Enable the optics for 82599 SFP+ fiber */
+		ixgbe_enable_tx_laser(hw);
+
+		/*
+		 * XXX Currently, ixgbe_set_phy_power() supports only copper
+		 * PHY, so it's not required to test with !unsupported_sfp.
+		 */
+		ixgbe_set_phy_power(hw, TRUE);
+	}
 
 	/* Initialize statistics */
 	ixgbe_update_stats_counters(adapter);
@@ -3860,6 +3860,7 @@ ixgbe_init_locked(struct adapter *adapte
 	u32		txdctl, mhadd;
 	u32		rxdctl, rxctrl;
 	u32		ctrl_ext;
+	bool		unsupported_sfp = false;
 	int		i, j, err;
 
 	/* XXX check IFF_UP and IFF_RUNNING, power-saving state! */
@@ -3867,6 +3868,7 @@ ixgbe_init_locked(struct adapter *adapte
 	KASSERT(mutex_owned(>core_mtx));
 	INIT_DEBUGOUT("ixgbe_init_locked: begin");
 
+	hw->need_unsupported_sfp_recovery = false;
 	hw->adapter_stopped = FALSE;
 	ixgbe_stop_adapter(hw);
 	callout_stop(>timer);
@@ -4040,12 +4042,14 @@ ixgbe_init_locked(struct adapter *adapte
 	 */
 	if (hw->phy.type == ixgbe_phy_none) {
 		err = hw->phy.ops.identify(hw);
-		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-			device_printf(dev,
-			"Unsupported SFP+ module type was detected.\n");
-			return;
-		}
-	}
+		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED)
+			unsupported_sfp = true;
+	} else if (hw->phy.type == ixgbe_phy_sfp_unsupported)
+		unsupported_sfp = true;
+
+	if (unsupported_sfp)
+		device_printf(dev,
+		"Unsupported SFP+ module type was detected.\n");
 
 	/* Set moderation on the Link 

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

2020-09-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep  2 12:24:09 UTC 2020

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

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

sys/dev/pci/ixgbe/if_bypass.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.28
sys/dev/pci/ixgbe/ixgbe.c: revision 1.246

Fix checking return value of atomic_cas_uint().

This change fixes a bug that extra delay() is called only once even if
atomic_cas_uint() isn't failed or delay() isn't called when atomic_cas_uint()
failed.

The reason of this bug was that I simply converted FreeBSD' atomic_cmpset_int()
to atomic_cas_uint(). The return value's semantics is different.

 -

Minor change.
  - Print "X550EM X" instead of "X550EM" for Xeon D devices.
  - Fix typo in comment. Same as FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.5 -r1.2.4.6 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.88.2.40 -r1.88.2.41 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.9 -r1.13.2.10 src/sys/dev/pci/ixgbe/ixgbe_common.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.5 src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.6
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.5	Fri Jan 24 18:37:31 2020
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Wed Sep  2 12:24:08 2020
@@ -45,9 +45,9 @@
 static void
 ixgbe_bypass_mutex_enter(struct adapter *adapter)
 {
-	while (atomic_cas_uint(>bypass.low, 0, 1) == 0)
+	while (atomic_cas_uint(>bypass.low, 0, 1) != 0)
 		usec_delay(3000);
-	while (atomic_cas_uint(>bypass.high, 0, 1) == 0)
+	while (atomic_cas_uint(>bypass.high, 0, 1) != 0)
 		usec_delay(3000);
 	return;
 } /* ixgbe_bypass_mutex_enter */
@@ -58,9 +58,9 @@ ixgbe_bypass_mutex_enter(struct adapter 
 static void
 ixgbe_bypass_mutex_clear(struct adapter *adapter)
 {
-	while (atomic_cas_uint(>bypass.high, 1, 0) == 0)
+	while (atomic_cas_uint(>bypass.high, 1, 0) != 1)
 		usec_delay(6000);
-	while (atomic_cas_uint(>bypass.low, 1, 0) == 0)
+	while (atomic_cas_uint(>bypass.low, 1, 0) != 1)
 		usec_delay(6000);
 	return;
 } /* ixgbe_bypass_mutex_clear */
@@ -73,7 +73,7 @@ ixgbe_bypass_mutex_clear(struct adapter 
 static void
 ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
 {
-	while (atomic_cas_uint(>bypass.high, 0, 1) == 0)
+	while (atomic_cas_uint(>bypass.high, 0, 1) != 0)
 		usec_delay(3000);
 	return;
 } /* ixgbe_bypass_wd_mutex_enter */
@@ -84,7 +84,7 @@ ixgbe_bypass_wd_mutex_enter(struct adapt
 static void
 ixgbe_bypass_wd_mutex_clear(struct adapter *adapter)
 {
-	while (atomic_cas_uint(>bypass.high, 1, 0) == 0)
+	while (atomic_cas_uint(>bypass.high, 1, 0) != 1)
 		usec_delay(6000);
 	return;
 } /* ixgbe_bypass_wd_mutex_clear */
@@ -585,7 +585,7 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
 		return (error);
 
 	/* Keep the log display single-threaded */
-	while (atomic_cas_uint(>bypass.log, 0, 1) == 0)
+	while (atomic_cas_uint(>bypass.log, 0, 1) != 0)
 		usec_delay(3000);
 
 	ixgbe_bypass_mutex_enter(adapter);
@@ -713,14 +713,14 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
 
 	status = 0; /* reset */
 	/* Another log command can now run */
-	while (atomic_cas_uint(>bypass.log, 1, 0) == 0)
+	while (atomic_cas_uint(>bypass.log, 1, 0) != 1)
 		usec_delay(3000);
 	return (error);
 
 unlock_err:
 	ixgbe_bypass_mutex_clear(adapter);
 	status = 0; /* reset */
-	while (atomic_cas_uint(>bypass.log, 1, 0) == 0)
+	while (atomic_cas_uint(>bypass.log, 1, 0) != 1)
 		usec_delay(3000);
 	return (EINVAL);
 } /* ixgbe_bp_log */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.40 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.41
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.40	Wed Aug  5 15:58:02 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Sep  2 12:24:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.40 2020/08/05 15:58:02 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.41 2020/09/02 12:24:08 martin Exp $ */
 
 /**
 
@@ -858,7 +858,7 @@ ixgbe_attach(device_t parent, device_t d
 		str = "X550";
 		break;
 	case ixgbe_mac_X550EM_x:
-		str = "X550EM";
+		str = "X550EM X";
 		break;
 	case ixgbe_mac_X550EM_a:
 		str = "X550EM A";

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.9 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.10
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.9	Wed Aug  5 15:58:02 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Wed Sep  2 12:24:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.13.2.9 2020/08/05 15:58:02 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.13.2.10 2020/09/02 12:24:08 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -5234,7 

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

2020-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug  9 14:17:48 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1596):

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

make this compile without bio(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.5 -r1.8.10.6 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.5 src/sys/dev/pci/mpii.c:1.8.10.6
--- src/sys/dev/pci/mpii.c:1.8.10.5	Fri Mar 15 14:50:36 2019
+++ src/sys/dev/pci/mpii.c	Sun Aug  9 14:17:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.5 2019/03/15 14:50:36 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.6 2020/08/09 14:17:48 martin Exp $ */
 /*	OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.5 2019/03/15 14:50:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.6 2020/08/09 14:17:48 martin Exp $");
 
 #include "bio.h"
 
@@ -243,8 +243,10 @@ struct mpii_softc {
 	struct workqueue	*sc_evt_ack_wq;
 	struct work		sc_evt_ack_work;
 
+#if NBIO > 0
 	struct sysmon_envsys	*sc_sme;
 	envsys_data_t		*sc_sensors;
+#endif
 };
 
 int	mpii_match(device_t, cfdata_t, void *);



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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 16:11:56 UTC 2020

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

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

sys/dev/pci/piixpm.c1.57-1.59,
1.61-1.63 via patch
sys/dev/pci/piixpmreg.h 1.9-1.12

- Fix number of port for Hudson rev. 0x1f and newer.
- Read SB800_SMB_HOSTC correctly. This register is not in the PCI
  config space but in the I/O space.
- The bit 0 of SB800_SMB_HOSTC is 0 on SMI or 1 on IRQ, so invert the
  check.
- Don't force using SMBUS0SEL register.
- Acquire/release host semaphore to share SMBus between the host and
  the embedded controller (IMC). Without this change, "shutdown -r"
  does power off and not boot on some machines.
- Save/restore port number before selecting port.
- Modify comment.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.52.6.1 -r1.52.6.2 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.7.22.1 -r1.7.22.2 src/sys/dev/pci/piixpmreg.h

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

Modified files:

Index: src/sys/dev/pci/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.52.6.1 src/sys/dev/pci/piixpm.c:1.52.6.2
--- src/sys/dev/pci/piixpm.c:1.52.6.1	Tue Aug  6 16:02:54 2019
+++ src/sys/dev/pci/piixpm.c	Wed Aug  5 16:11:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.52.6.1 2019/08/06 16:02:54 martin Exp $ */
+/* $NetBSD: piixpm.c,v 1.52.6.2 2020/08/05 16:11:56 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.1 2019/08/06 16:02:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.52.6.2 2020/08/05 16:11:56 martin Exp $");
 
 #include 
 #include 
@@ -70,8 +70,11 @@ __KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1
 
 #define PIIXPM_IS_FCHGRP(sc)	(PIIXPM_IS_HUDSON(sc) || PIIXPM_IS_KERNCZ(sc))
 
+#define PIIX_SB800_TIMEOUT 500
+
 struct piixpm_smbus {
 	int			sda;
+	int			sda_save;
 	struct			piixpm_softc *softc;
 };
 
@@ -86,6 +89,7 @@ struct piixpm_softc {
 	bus_space_handle_t	sc_smb_ioh;
 	void *			sc_smb_ih;
 	int			sc_poll;
+	bool			sc_sb800_selen; /* Use SMBUS0SEL */
 
 	pci_chipset_tag_t	sc_pc;
 	pcitag_t		sc_pcitag;
@@ -119,8 +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_acquire_bus(void *, int);
-static void	piixpm_i2c_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 *,
 size_t, void *, size_t, int);
 
@@ -231,15 +235,10 @@ nopowermanagement:
 	/* SB800 rev 0x40+, AMD HUDSON and newer need special initialization */
 	if (PIIXPM_IS_FCHGRP(sc) || PIIXPM_IS_SB800GRP(sc)) {
 		if (piixpm_sb800_init(sc) == 0) {
-			sc->sc_numbusses = 4;
-
 			/* Read configuration */
-			conf = pci_conf_read(pa->pa_pc, pa->pa_tag,
-			SB800_SMB_HOSTC);
-			DPRINTF(("%s: conf 0x%08x\n", device_xname(self),
-conf));
-
-			usesmi = conf & SB800_SMB_HOSTC_SMI;
+			conf = bus_space_read_1(sc->sc_iot,
+			sc->sc_smb_ioh, SB800_SMB_HOSTC);
+			usesmi = ((conf & SB800_SMB_HOSTC_IRQ) == 0);
 			goto setintr;
 		}
 		aprint_normal_dev(self, "SMBus initialization failed\n");
@@ -328,17 +327,24 @@ piixpm_rescan(device_t self, const char 
 	/* Attach I2C bus */
 
 	for (i = 0; i < sc->sc_numbusses; i++) {
+		struct i2c_controller *tag = >sc_i2c_tags[i];
+
 		if (sc->sc_i2c_device[i])
 			continue;
 		sc->sc_busses[i].sda = i;
 		sc->sc_busses[i].softc = sc;
-		sc->sc_i2c_tags[i].ic_cookie = >sc_busses[i];
-		sc->sc_i2c_tags[i].ic_acquire_bus = piixpm_i2c_acquire_bus;
-		sc->sc_i2c_tags[i].ic_release_bus = piixpm_i2c_release_bus;
-		sc->sc_i2c_tags[i].ic_exec = piixpm_i2c_exec;
+		tag->ic_cookie = >sc_busses[i];
+		if (PIIXPM_IS_SB800GRP(sc) || PIIXPM_IS_FCHGRP(sc)) {
+			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_exec = piixpm_i2c_exec;
 		memset(, 0, sizeof(iba));
 		iba.iba_type = I2C_TYPE_SMBUS;
-		iba.iba_tag = >sc_i2c_tags[i];
+		iba.iba_tag = tag;
 		sc->sc_i2c_device[i] = config_found_ia(self, ifattr, ,
 		piixpm_iicbus_print);
 	}
@@ -401,6 +407,12 @@ piixpm_sb800_init(struct piixpm_softc *s
 	uint16_t val, base_addr;
 	bool enabled;
 
+	if (PIIXPM_IS_KERNCZ(sc) ||
+	(PIIXPM_IS_HUDSON(sc) && (sc->sc_rev >= 0x1f)))
+		sc->sc_numbusses = 2;
+	else
+		sc->sc_numbusses = 4;
+
 	/* Fetch SMB base address */
 	if (bus_space_map(iot,
 	SB800_INDIRECTIO_BASE, SB800_INDIRECTIO_SIZE, 0, )) {
@@ 

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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 16:08:10 UTC 2020

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

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

sys/dev/pci/if_ti.c 1.103, 1.106, 1.108,
1.116-1.120 via patch
sys/dev/pci/if_tireg.h  1.26

- Use pci_intr_establish_xname()
- Don't clear CFI and priority bit to pass them to the upper layer.
- Add support for Farallon PN9000SX from FreeBSD.
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- Fix typo in comment.
- Style fix.


To generate a diff of this commit:
cvs rdiff -u -r1.101.8.2 -r1.101.8.3 src/sys/dev/pci/if_ti.c
cvs rdiff -u -r1.20 -r1.20.30.1 src/sys/dev/pci/if_tireg.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_ti.c
diff -u src/sys/dev/pci/if_ti.c:1.101.8.2 src/sys/dev/pci/if_ti.c:1.101.8.3
--- src/sys/dev/pci/if_ti.c:1.101.8.2	Mon May 13 12:40:13 2019
+++ src/sys/dev/pci/if_ti.c	Wed Aug  5 16:08:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.101.8.2 2019/05/13 12:40:13 martin Exp $ */
+/* $NetBSD: if_ti.c,v 1.101.8.3 2020/08/05 16:08:09 martin Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.101.8.2 2019/05/13 12:40:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.101.8.3 2020/08/05 16:08:09 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -140,6 +140,8 @@ static const struct ti_type ti_devs[] = 
 		"Netgear GA620 1000BASE-T Ethernet" },
 	{ PCI_VENDOR_SGI, PCI_PRODUCT_SGI_TIGON,
 		"Silicon Graphics Gigabit Ethernet" },
+	{ PCI_VENDOR_DEC, PCI_PRODUCT_DEC_PN9000SX,
+		"Farallon PN9000SX Gigabit Ethernet" },
 	{ 0, 0, NULL }
 };
 
@@ -152,8 +154,8 @@ static void ti_txeof_tigon2(struct ti_so
 static void ti_rxeof(struct ti_softc *);
 
 static void ti_stats_update(struct ti_softc *);
-static int ti_encap_tigon1(struct ti_softc *, struct mbuf *, u_int32_t *);
-static int ti_encap_tigon2(struct ti_softc *, struct mbuf *, u_int32_t *);
+static int ti_encap_tigon1(struct ti_softc *, struct mbuf *, uint32_t *);
+static int ti_encap_tigon2(struct ti_softc *, struct mbuf *, uint32_t *);
 
 static int ti_intr(void *);
 static void ti_start(struct ifnet *);
@@ -165,15 +167,15 @@ static void ti_watchdog(struct ifnet *);
 static int ti_ifmedia_upd(struct ifnet *);
 static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
-static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int);
-static u_int8_t	ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *);
+static uint32_t ti_eeprom_putbyte(struct ti_softc *, int);
+static uint8_t	ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *);
 static int ti_read_eeprom(struct ti_softc *, void *, int, int);
 
 static void ti_add_mcast(struct ti_softc *, struct ether_addr *);
 static void ti_del_mcast(struct ti_softc *, struct ether_addr *);
 static void ti_setmulti(struct ti_softc *);
 
-static void ti_mem(struct ti_softc *, u_int32_t, u_int32_t, const void *);
+static void ti_mem(struct ti_softc *, uint32_t, uint32_t, const void *);
 static void ti_loadfw(struct ti_softc *);
 static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *);
 static void ti_cmd_ext(struct ti_softc *, struct ti_cmd_desc *, void *, int);
@@ -205,7 +207,7 @@ CFATTACH_DECL_NEW(ti, sizeof(struct ti_s
 /*
  * Send an instruction or address to the EEPROM, check for ACK.
  */
-static u_int32_t
+static uint32_t
 ti_eeprom_putbyte(struct ti_softc *sc, int byte)
 {
 	int i, ack = 0;
@@ -216,7 +218,7 @@ ti_eeprom_putbyte(struct ti_softc *sc, i
 	TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN);
 
 	/*
-	 * Feed in each bit and stobe the clock.
+	 * Feed in each bit and strobe the clock.
 	 */
 	for (i = 0x80; i; i >>= 1) {
 		if (byte & i) {
@@ -250,11 +252,11 @@ ti_eeprom_putbyte(struct ti_softc *sc, i
  * We have to send two address bytes since the EEPROM can hold
  * more than 256 bytes of data.
  */
-static u_int8_t
-ti_eeprom_getbyte(struct ti_softc *sc, int addr, u_int8_t *dest)
+static uint8_t
+ti_eeprom_getbyte(struct ti_softc *sc, int addr, uint8_t *dest)
 {
 	int		i;
-	u_int8_t		byte = 0;
+	uint8_t		byte = 0;
 
 	EEPROM_START();
 
@@ -327,7 +329,7 @@ ti_read_eeprom(struct ti_softc *sc, void
 {
 	char *dest = destv;
 	int err = 0, i;
-	u_int8_t byte = 0;
+	uint8_t byte = 0;
 
 	for (i = 0; i < cnt; i++) {
 		err = ti_eeprom_getbyte(sc, off + i, );
@@ -344,7 +346,7 @@ ti_read_eeprom(struct ti_softc *sc, void
  * of NIC local memory or (if tbuf is non-NULL) copy data into it.
  */
 static void
-ti_mem(struct ti_softc *sc, u_int32_t addr, u_int32_t len, const void *xbuf)
+ti_mem(struct ti_softc *sc, uint32_t addr, uint32_t len, const void *xbuf)
 {
 	int			segptr, segsize, cnt;
 	const void		*ptr;
@@ -368,11 +370,11 @@ ti_mem(struct 

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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 15:58:03 UTC 2020

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

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

sys/dev/pci/ixgbe/ix_txrx.c 1.62-1.63 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.225, 1.228-1.229,
1.232 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.64, 1.66
sys/dev/pci/ixgbe/ixv.c 1.146, 1.148-1.150
via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.27
sys/dev/pci/ixgbe/ixgbe_vf.c1.23
sys/dev/pci/ixgbe/ixgbe_82598.c 1.15
sys/dev/pci/ixgbe/ixgbe_x550.c  1.18
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.14
sys/dev/pci/ixgbe/ixgbe_phy.c   1.21
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.26

- Fix IXGBE_LE32_TO_CPUS() macro for big endian machine. This problem
  was only on X550.
- Add debug printf()s.
- Use unsigned to avoid undefined behavior in
  ixgbe_fc_enable_generic().
- Modify a little to reduce diff between ixgbe.c and ixv.c.
  No functional change.
- Modify comment.
- Remove unused macros.
- Whitespace fix.
- Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.19 -r1.24.2.20 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.39 -r1.88.2.40 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.19 -r1.24.6.20 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.8.8.3 -r1.8.8.4 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.13.2.8 -r1.13.2.9 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.5 -r1.6.2.6 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.17.6.6 -r1.17.6.7 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.11.6.5 -r1.11.6.6 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.12.8.4 -r1.12.8.5 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.5.6.7 -r1.5.6.8 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.29 -r1.56.2.30 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.19 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.20
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.19	Fri Jan 24 18:37:31 2020
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Aug  5 15:58:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.19 2020/01/24 18:37:31 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.20 2020/08/05 15:58:02 martin Exp $ */
 
 /**
 
@@ -926,7 +926,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 	vlan_macip_lens |= ip_hlen;
 
 	/* No support for offloads for non-L4 next headers */
- 	switch (ipproto) {
+	switch (ipproto) {
 	case IPPROTO_TCP:
 		if (mp->m_pkthdr.csum_flags &
 		(M_CSUM_TCPv4 | M_CSUM_TCPv6))
@@ -1569,7 +1569,6 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		rxbuf->addr = htole64(rxbuf->pmap->dm_segs[0].ds_addr);
 	}
 
-
 	/* Setup our descriptor indices */
 	rxr->next_to_check = 0;
 	rxr->next_to_refresh = 0;
@@ -1625,6 +1624,7 @@ ixgbe_setup_receive_structures(struct ad
 	struct rx_ring *rxr = adapter->rx_rings;
 	intj;
 
+	INIT_DEBUGOUT("ixgbe_setup_receive_structures");
 	for (j = 0; j < adapter->num_queues; j++, rxr++)
 		if (ixgbe_setup_receive_ring(rxr))
 			goto fail;
@@ -2233,7 +2233,7 @@ ixgbe_allocate_queues(struct adapter *ad
 
 	/* First, allocate the top level queue structs */
 	adapter->queues = (struct ix_queue *)malloc(sizeof(struct ix_queue) *
-adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO);
+	adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO);
 if (adapter->queues == NULL) {
 		aprint_error_dev(dev, "Unable to allocate queue memory\n");
 error = ENOMEM;
@@ -2300,7 +2300,7 @@ ixgbe_allocate_queues(struct adapter *ad
 			"Critical Failure setting up transmit buffers\n");
 			error = ENOMEM;
 			goto err_tx_desc;
-	}
+		}
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 			/* Allocate a buf ring */
 			txr->txr_interq = pcq_create(IXGBE_BR_SIZE, KM_SLEEP);

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.39 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.40
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.39	Fri Jan 24 18:37:31 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Aug  5 15:58:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.39 2020/01/24 18:37:31 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.40 2020/08/05 15:58:02 martin Exp $ */
 
 

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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 15:54:30 UTC 2020

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

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

sys/dev/pci/ichsmb.c1.66-1.68 via patch

- Add Comet Lake, Whiskey Lake U and Amber Lake Y support.
- Whitespace fix.


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

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

Modified files:

Index: src/sys/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.50.6.3 src/sys/dev/pci/ichsmb.c:1.50.6.4
--- src/sys/dev/pci/ichsmb.c:1.50.6.3	Thu Jul 26 20:32:38 2018
+++ src/sys/dev/pci/ichsmb.c	Wed Aug  5 15:54:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.3 2018/07/26 20:32:38 snj Exp $	*/
+/*	$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 $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.3 2018/07/26 20:32:38 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.4 2020/08/05 15:54:30 martin Exp $");
 
 #include 
 #include 
@@ -118,8 +118,10 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_100SERIES_LP_SMB:
 		case PCI_PRODUCT_INTEL_2HS_SMB:
 		case PCI_PRODUCT_INTEL_3HS_SMB:
+		case PCI_PRODUCT_INTEL_3HS_U_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
+		case PCI_PRODUCT_INTEL_CMTLK_SMB:
 		case PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB:
 		case PCI_PRODUCT_INTEL_BSW_PCU_SMB:
 		case PCI_PRODUCT_INTEL_APL_SMB:
@@ -237,7 +239,6 @@ ichsmb_chdet(device_t self, device_t chi
 
 	if (sc->sc_i2c_device == child)
 		sc->sc_i2c_device = NULL;
-
 }
 
 static int
@@ -282,7 +283,7 @@ ichsmb_i2c_exec(void *cookie, i2c_op_t o
 	LPCIB_SMB_HS_INTR | LPCIB_SMB_HS_DEVERR |
 	LPCIB_SMB_HS_BUSERR | LPCIB_SMB_HS_FAILED);
 	bus_space_barrier(sc->sc_iot, sc->sc_ioh, LPCIB_SMB_HS, 1,
-	BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);  
+	BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 
 	/* Wait for bus to be idle */
 	for (retries = 100; retries > 0; retries--) {



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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:53:56 UTC 2020

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

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

sys/dev/pci/pcidevs 1.1392-1.1403, 1.1406-1.1419

- Add Intel Xeon D-1500 NTB-secondary and Xeon D NS QuickData DMA
  channel 0-7.
- Add Intel I219 LM10-LM15 and V10-V14.
- Add AMD Family14h PCIe.
- Add Realtek Killer E3000.
- Add Aquantia AQC 10G network adapters.
- Add Radeon HD4290
- Add Farallon PN9000SX Ethernet.
- NVIDIA 0x036[0-7] are nForce MCP55 LPC Bridge.
- Add VIA VX900 chipset.
- Add some NVIDIA devices.
- Add some Intel UHD Graphics devices.
- Add Intel Comet Lake, Whiskey Lake U and Amber Lake Y devices.
- Modify description of Intel 0x591e from HD Graphics to UHD Graphics.
- Add Intel XMM 7360 LTE Modem.
- Add Western Digital WD Blue SN550 NVMe SSD.
- Add ATI Radeon R5/R6/R7 Graphics.
- Add IDs for Ampere eMAG PCIe Root Ports.
- Add RTL8192EE Wireless LAN 802.11n PCI-E NIC.
- Add ASIX AX99100 Multi I/O (Serial,Parallel,I2C,SPI,LocalBus,GPIO)
  Controller.
- Add a couple of additional device IDs for the AMD Cryptographic
  Coprocessor.
- Remove duplicated entries.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.18 -r1.1289.2.19 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.18 src/sys/dev/pci/pcidevs:1.1289.2.19
--- src/sys/dev/pci/pcidevs:1.1289.2.18	Mon Jul 20 18:47:16 2020
+++ src/sys/dev/pci/pcidevs	Mon Jul 20 18:53:56 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.18 2020/07/20 18:47:16 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.19 2020/07/20 18:53:56 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -651,8 +651,10 @@ vendor SYMPHONY2	0x1c1c	Symphony Labs (2
 vendor HGST		0x1c58	HGST, Inc.
 vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor AMAZON		0x1d0f	Amazon.com, Inc.
+vendor AQUANTIA		0x1d6a	Aquantia
 vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
+vendor AMPERE		0x1def	Ampere Computing
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
 vendor 3DLABS		0x3d3d	3D Labs
@@ -1023,13 +1025,20 @@ product AMD F17_DF_5		0x1464	Family17h D
 product AMD F17_DF_6		0x1465	Family17h Data Fabric
 product AMD F17_DF_7		0x1466	Family17h Data Fabric
 product AMD F17_DF_8		0x1467	Family17h Data Fabric
+product AMD F17_CCP_2		0x1468	Family17h Crypto
 product AMD F17_PCIE_4		0x1470	Family17h PCIe
 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_RESV_SPP	0x1485	Family17h/7xh Reserved SPP
+product AMD F17_7X_CCP		0x1486	Family17h/7xh Crypto
 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
+product AMD F14_PCIE_2		0x1513	Family14h PCIe
+product AMD F14_PCIE_3		0x1514	Family14h PCIe
+product AMD F14_PCIE_4		0x1515	Family14h PCIe
+product AMD F14_PCIE_5		0x1516	Family14h PCIe
 product AMD F16_HT		0x1530	Family16h HyperTransport Configuration
 product AMD F16_ADDR		0x1531	Family16h Address Map Configuration
 product AMD F16_DRAM		0x1532	Family16h DRAM Configuration
@@ -1103,7 +1112,7 @@ product AMD PCSCSI_PCI		0x2020	PCscsi-PC
 product AMD GEODELX_PCHB	0x2080	Geode LX Host-PCI Bridge
 product AMD GEODELX_VGA 	0x2081	Geode LX VGA Controller
 product AMD GEODELX_AES 	0x2082	Geode LX AES Security Block
-product	AMD CS5536_PCISB	0x208f	CS5536 GeodeLink PCI South Bridge
+product AMD CS5536_PCISB	0x208f	CS5536 GeodeLink PCI South Bridge
 product AMD CS5536_PCIB		0x2090	CS5536 PCI-ISA Bridge
 product AMD CS5536_FLASH	0x2091	CS5536 Flash
 product AMD CS5536_AUDIO	0x2093	CS5536 Audio
@@ -1213,6 +1222,16 @@ product AMI MEGARAID3		0x1960	MegaRAID 3
 product AMI MEGARAID		0x9010	MegaRAID
 product AMI MEGARAID2		0x9060	MegaRAID 2
 
+/* Ampere Computing products */
+product AMPERE EMAG_PCIE_0	0xe005	eMAG PCIe Root Port 0
+product AMPERE EMAG_PCIE_1	0xe006	eMAG PCIe Root Port 1
+product AMPERE EMAG_PCIE_2	0xe007	eMAG PCIe Root Port 2
+product AMPERE EMAG_PCIE_3	0xe008	eMAG PCIe Root Port 3
+product AMPERE EMAG_PCIE_4	0xe009	eMAG PCIe Root Port 4
+product AMPERE EMAG_PCIE_5	0xe00a	eMAG PCIe Root Port 5
+product AMPERE EMAG_PCIE_6	0xe00b	eMAG PCIe Root Port 6
+product AMPERE EMAG_PCIE_7	0xe00c	eMAG PCIe Root Port 7
+
 /* Analog Devices products */
 product ANALOG AD1889	0x1889	AD1889 PCI SoundMAX Controller
 product ANALOG SAFENET	0x2f44	SafeNet Crypto Accelerator ADSP-2141
@@ -1282,6 +1301,24 @@ product APPLE INTREPID2_FW	0x006a	Intrep
 product APPLE INTREPID2_GMAC	0x006b	Intrepid 2 GMAC
 product APPLE BCM5701		0x1645	BCM5701

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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:55:52 UTC 2020

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

Log Message:
Regen for ticket #1579


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

2020-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 13 14:13:12 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by kim in ticket #1572):

sys/dev/pci/vioscsi.c: revision 1.22

Fix off-by-one SCSI target reporting

Use max_target as the controller ID instead of zero, so that the device
located at SCSI ID zero (e.g. a disk) is not obscured through not being
probed by scsi_probe_bus() (which skips the controller ID).

Copy the target requested onto the wire without decrementing it by one.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/dev/pci/vioscsi.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/vioscsi.c
diff -u src/sys/dev/pci/vioscsi.c:1.19.2.1 src/sys/dev/pci/vioscsi.c:1.19.2.2
--- src/sys/dev/pci/vioscsi.c:1.19.2.1	Mon Jul 15 08:23:23 2019
+++ src/sys/dev/pci/vioscsi.c	Mon Jul 13 14:13:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vioscsi.c,v 1.19.2.1 2019/07/15 08:23:23 martin Exp $	*/
+/*	$NetBSD: vioscsi.c,v 1.19.2.2 2020/07/13 14:13:12 martin Exp $	*/
 /*	$OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.19.2.1 2019/07/15 08:23:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.19.2.2 2020/07/13 14:13:12 martin Exp $");
 
 #include 
 #include 
@@ -198,7 +198,7 @@ vioscsi_attach(device_t parent, device_t
 	chan->chan_channel = 0;
 	chan->chan_ntargets = MIN(max_target, 16);	/* cap reasonably */
 	chan->chan_nluns = MIN(max_lun, 1024);		/* cap reasonably */
-	chan->chan_id = 0;
+	chan->chan_id = max_target;
 	chan->chan_flags = SCSIPI_CHAN_NOSETTLE;
 
 	config_found(self, >sc_channel, scsiprint);
@@ -322,7 +322,7 @@ vioscsi_scsipi_request(struct scsipi_cha
 	}
 
 	req->lun[0] = 1;
-	req->lun[1] = periph->periph_target - 1;
+	req->lun[1] = periph->periph_target;
 	req->lun[2] = 0x40 | ((periph->periph_lun >> 8) & 0x3F);
 	req->lun[3] = periph->periph_lun & 0xFF;
 	memset(req->lun + 4, 0, 4);



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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 10:57:29 UTC 2020

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

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

sys/dev/pci/if_stgereg.h: revision 1.7

 Fix address of STGE_MaxFrameSize. Same as other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.80.1 src/sys/dev/pci/if_stgereg.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_stgereg.h
diff -u src/sys/dev/pci/if_stgereg.h:1.5 src/sys/dev/pci/if_stgereg.h:1.5.80.1
--- src/sys/dev/pci/if_stgereg.h:1.5	Mon Apr 28 20:23:55 2008
+++ src/sys/dev/pci/if_stgereg.h	Fri Jan 31 10:57:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stgereg.h,v 1.5 2008/04/28 20:23:55 martin Exp $	*/
+/*	$NetBSD: if_stgereg.h,v 1.5.80.1 2020/01/31 10:57:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -319,7 +319,7 @@ struct stge_rfd {
 
 #define	STGE_VLANId			0x80
 
-#define	STGE_MaxFrameSize		0x84
+#define	STGE_MaxFrameSize		0x86
 
 #define	STGE_ReceiveMode		0x88	/* 16-bit */
 #define	RM_ReceiveUnicast		(1U << 0)



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

2020-01-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 24 18:43:35 UTC 2020

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

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

sys/dev/pci/if_wm.c 1.650, 1.652-1.654 via patch
sys/dev/pci/if_wmreg.h  1.116-1.117

- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580
  port 1, 2, 3 and newer chips. This change fixes a bug that some
  fiber, serdes or SFP devices don't detect the link status correctly.
- Simplify code by using "struct mii_data *mii" more. No functional
  change.
- MSI-X doesn't use sc->sc_icr variable, so move the code into
  non-MSI-X part. No functional change intended.
- Modify debug printfs a bit.
- Rename macro.
- Use __BIT()
- Fix comment. Add comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.37 -r1.508.4.38 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.10 -r1.98.6.11 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.37 src/sys/dev/pci/if_wm.c:1.508.4.38
--- src/sys/dev/pci/if_wm.c:1.508.4.37	Thu Jan 23 10:17:41 2020
+++ src/sys/dev/pci/if_wm.c	Fri Jan 24 18:43:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.37 2020/01/23 10:17:41 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.38 2020/01/24 18:43:35 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.37 2020/01/23 10:17:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.38 2020/01/24 18:43:35 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2645,10 +2645,11 @@ alloc_retry:
 		}
 	}
 
-	/* XXX For other than 82580? */
-	if (sc->sc_type == WM_T_82580) {
-		wm_nvm_read(sc, NVM_OFF_CFG3_PORTA, 1, );
-		if (nvmword & __BIT(13))
+	if ((sc->sc_type >= WM_T_82580) && (sc->sc_type <= WM_T_I211)) {
+		wm_nvm_read(sc,
+		NVM_OFF_LAN_FUNC_82580(sc->sc_funcid) + NVM_OFF_CFG3_PORTA,
+		1, );
+		if (nvmword & NVM_CFG3_ILOS)
 			sc->sc_ctrl |= CTRL_ILOS;
 	}
 
@@ -5981,8 +5982,7 @@ wm_init_locked(struct ifnet *ifp)
 
 	/* Set up the interrupt registers. */
 	CSR_WRITE(sc, WMREG_IMC, 0xU);
-	sc->sc_icr = ICR_TXDW | ICR_LSC | ICR_RXSEQ | ICR_RXDMT0 |
-	ICR_RXO | ICR_RXT0;
+
 	if (wm_is_using_msix(sc)) {
 		uint32_t mask;
 		struct wm_queue *wmq;
@@ -6022,8 +6022,11 @@ wm_init_locked(struct ifnet *ifp)
 			CSR_WRITE(sc, WMREG_IMS, ICR_LSC);
 			break;
 		}
-	} else
+	} else {
+		sc->sc_icr = ICR_TXDW | ICR_LSC | ICR_RXSEQ | ICR_RXDMT0 |
+		ICR_RXO | ICR_RXT0;
 		CSR_WRITE(sc, WMREG_IMS, sc->sc_icr);
+	}
 
 	/* Set up the inter-packet gap. */
 	CSR_WRITE(sc, WMREG_TIPG, sc->sc_tipg);
@@ -9098,7 +9101,7 @@ wm_linkintr_serdes(struct wm_softc *sc, 
 {
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	struct mii_data *mii = >sc_mii;
-	struct ifmedia_entry *ife = sc->sc_mii.mii_media.ifm_cur;
+	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
 	uint32_t pcs_adv, pcs_lpab, reg;
 
 	DPRINTF(WM_DEBUG_LINK, ("%s: %s:\n", device_xname(sc->sc_dev),
@@ -9441,11 +9444,12 @@ wm_linkintr_msix(void *arg)
 	uint32_t reg;
 	bool has_rxo;
 
-	DPRINTF(WM_DEBUG_LINK,
-	("%s: LINK: got link intr\n", device_xname(sc->sc_dev)));
-
 	reg = CSR_READ(sc, WMREG_ICR);
 	WM_CORE_LOCK(sc);
+	DPRINTF(WM_DEBUG_LINK,
+	("%s: LINK: got link intr. ICR = %08x\n",
+		device_xname(sc->sc_dev), reg));
+
 	if (sc->sc_core_stopping)
 		goto out;
 
@@ -11180,7 +11184,7 @@ wm_gmii_statchg(struct ifnet *ifp)
 			sc->sc_ctrl |= CTRL_RFCE;
 	}
 
-	if (sc->sc_mii.mii_media_active & IFM_FDX) {
+	if (mii->mii_media_active & IFM_FDX) {
 		DPRINTF(WM_DEBUG_LINK,
 		("%s: LINK: statchg: FDX\n", ifp->if_xname));
 		sc->sc_tctl |= TCTL_COLD(TX_COLLISION_DISTANCE_FDX);
@@ -11195,7 +11199,7 @@ wm_gmii_statchg(struct ifnet *ifp)
 	CSR_WRITE(sc, (sc->sc_type < WM_T_82543) ? WMREG_OLD_FCRTL
 		 : WMREG_FCRTL, sc->sc_fcrtl);
 	if (sc->sc_type == WM_T_80003) {
-		switch (IFM_SUBTYPE(sc->sc_mii.mii_media_active)) {
+		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 		case IFM_1000_T:
 			wm_kmrn_writereg(sc, KUMCTRLSTA_OFFSET_HD_CTRL,
 			KUMCTRLSTA_HD_CTRL_1000_DEFAULT);
@@ -11784,7 +11788,8 @@ wm_tbi_tick(struct wm_softc *sc)
 		if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO)
 		&& (++sc->sc_tbi_serdes_ticks
 			>= sc->sc_tbi_serdes_anegticks)) {
-			DPRINTF(WM_DEBUG_LINK, ("EXPIRE\n"));
+			DPRINTF(WM_DEBUG_LINK, ("%s: %s: EXPIRE\n",
+device_xname(sc->sc_dev), __func__));
 			sc->sc_tbi_serdes_ticks = 0;
 			/*
 			 * Reset the link, and let autonegotiation do
@@ -11891,7 +11896,7 @@ wm_serdes_mediastatus(struct ifnet *ifp,
 {
 	struct wm_softc *sc = ifp->if_softc;
 	struct mii_data *mii = >sc_mii;
-	struct ifmedia_entry *ife = 

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

2020-01-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 24 18:37:32 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82598.c ixgbe_api.c ixgbe_common.c ixgbe_netbsd.c
ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixv.c

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

sys/dev/pci/ixgbe/if_bypass.c   1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.5
sys/dev/pci/ixgbe/ix_txrx.c 1.58-1.60
sys/dev/pci/ixgbe/ixgbe.c   1.195,1.220-1.221 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.60-1.2
sys/dev/pci/ixgbe/ixgbe_api.c   1.24
sys/dev/pci/ixgbe/ixgbe_common.c1.26
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.11-1.12
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.24
sys/dev/pci/ixgbe/ixgbe_phy.c   1.19
sys/dev/pci/ixgbe/ixgbe_82598.c 1.14
sys/dev/pci/ixgbe/ixv.c 1.122,1.142,1.144 via patch

- Use unsigned to avoid undefined behavior in
  ix{gbe,v}_[un]register_vlan().
- Free RX structure correctly when detaching.
- Remove unused code.
- Remove extra spaces.
- Fix some typos in comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.4 -r1.2.4.5 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.24.2.18 -r1.24.2.19 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.38 -r1.88.2.39 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.18 -r1.24.6.19 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.8.8.2 -r1.8.8.3 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.15.8.5 -r1.15.8.6 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.13.2.7 -r1.13.2.8 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.4 -r1.6.2.5 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.1.12.3 -r1.1.12.4 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.17.6.5 -r1.17.6.6 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.11.6.4 -r1.11.6.5 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.56.2.28 -r1.56.2.29 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_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.4 src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.5
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.4	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Fri Jan 24 18:37:31 2020
@@ -101,7 +101,7 @@ ixgbe_get_bypass_time(u32 *year, u32 *se
 	nanotime();
 	*sec = current.tv_sec;
 
-	while(*sec > SEC_THIS_YEAR(*year)) {
+	while (*sec > SEC_THIS_YEAR(*year)) {
 		*sec -= SEC_THIS_YEAR(*year);
 		(*year)++;
 	}

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.18 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.19
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.18	Sun Nov 10 13:36:29 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.18 2019/11/10 13:36:29 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.19 2020/01/24 18:37:31 martin Exp $ */
 
 /**
 
@@ -148,7 +148,7 @@ ixgbe_legacy_start_locked(struct ifnet *
 		return (ENETDOWN);
 	if (txr->txr_no_space)
 		return (ENETDOWN);
-	
+
 	while (!IFQ_IS_EMPTY(>if_snd)) {
 		if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
 			break;
@@ -1693,6 +1693,10 @@ ixgbe_free_receive_buffers(struct rx_rin
 rxbuf->pmap = NULL;
 			}
 		}
+
+		/* NetBSD specific. See ixgbe_netbsd.c */
+		ixgbe_jcl_destroy(adapter, rxr);
+
 		if (rxr->rx_buffers != NULL) {
 			free(rxr->rx_buffers, M_DEVBUF);
 			rxr->rx_buffers = NULL;
@@ -2379,3 +2383,24 @@ tx_fail:
 fail:
 	return (error);
 } /* ixgbe_allocate_queues */
+
+/
+ * ixgbe_free_queues
+ *
+ *   Free descriptors for the transmit and receive rings, and then
+ *   the memory associated with each.
+ /
+void
+ixgbe_free_queues(struct adapter *adapter)
+{
+	struct ix_queue *que;
+	int i;
+
+	ixgbe_free_transmit_structures(adapter);
+	ixgbe_free_receive_structures(adapter);
+	for (i = 0; i < adapter->num_queues; i++) {
+		que = >queues[i];
+		mutex_destroy(>dc_mtx);
+	}
+	free(adapter->queues, M_DEVBUF);
+} /* ixgbe_free_queues */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.38 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.39
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.38	Thu Dec 26 20:25:07 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.38 2019/12/26 20:25:07 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.39 2020/01/24 18:37:31 martin Exp $ */
 
 /**
 

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

2020-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 23 10:17:42 UTC 2020

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

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

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

fix softint_disestablish() in wm_detach().

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


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.36 -r1.508.4.37 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.36 src/sys/dev/pci/if_wm.c:1.508.4.37
--- src/sys/dev/pci/if_wm.c:1.508.4.36	Wed Nov  6 10:23:06 2019
+++ src/sys/dev/pci/if_wm.c	Thu Jan 23 10:17:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.36 2019/11/06 10:23:06 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.37 2020/01/23 10:17:41 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.36 2019/11/06 10:23:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.37 2020/01/23 10:17:41 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3017,6 +3017,9 @@ wm_detach(device_t self, int flags __unu
 	}
 	pci_intr_release(sc->sc_pc, sc->sc_intrs, sc->sc_nintrs);
 
+	for (i = 0; i < sc->sc_nqueues; i++)
+		softint_disestablish(sc->sc_queue[i].wmq_si);
+
 	wm_free_txrx_queues(sc);
 
 	/* Unmap the registers */



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

2019-12-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 26 20:25:07 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 #1478):

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

 Add missing core lock in ixgbe_handle_mod().


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.37 -r1.88.2.38 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.37 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.38
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.37	Tue Nov 19 10:48:15 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Dec 26 20:25:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.37 2019/11/19 10:48:15 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.38 2019/12/26 20:25:07 martin Exp $ */
 
 /**
 
@@ -4572,6 +4572,7 @@ ixgbe_handle_mod(void *context)
 	device_t	dev = adapter->dev;
 	u32		err, cage_full = 0;
 
+	IXGBE_CORE_LOCK(adapter);
 	++adapter->mod_sicount.ev_count;
 	if (adapter->hw.need_crosstalk_fix) {
 		switch (hw->mac.type) {
@@ -4589,14 +4590,14 @@ ixgbe_handle_mod(void *context)
 		}
 
 		if (!cage_full)
-			return;
+			goto out;
 	}
 
 	err = hw->phy.ops.identify_sfp(hw);
 	if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
 		device_printf(dev,
 		"Unsupported SFP+ module type was detected.\n");
-		return;
+		goto out;
 	}
 
 	if (hw->mac.type == ixgbe_mac_82598EB)
@@ -4607,9 +4608,11 @@ ixgbe_handle_mod(void *context)
 	if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
 		device_printf(dev,
 		"Setup failure - unsupported SFP+ module type.\n");
-		return;
+		goto out;
 	}
 	softint_schedule(adapter->msf_si);
+out:
+	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mod */
 
 



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

2019-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 16:50:54 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1464):
sys/dev/pci/if_alc.c1.44 via patch
sys/dev/pci/if_ale.c1.35-1.36 via patch
sys/dev/pci/if_cas.c1.36 via patch
- Fix a bug that IFF_ALLMULTI is almost always set.
- Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.24.8.4 -r1.24.8.5 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.22.2.2 -r1.22.2.3 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.26 -r1.26.8.1 src/sys/dev/pci/if_cas.c

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

Modified files:

Index: src/sys/dev/pci/if_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.24.8.4 src/sys/dev/pci/if_alc.c:1.24.8.5
--- src/sys/dev/pci/if_alc.c:1.24.8.4	Wed Nov  6 10:04:47 2019
+++ src/sys/dev/pci/if_alc.c	Thu Dec  5 16:50:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_alc.c,v 1.24.8.4 2019/11/06 10:04:47 martin Exp $	*/
+/*	$NetBSD: if_alc.c,v 1.24.8.5 2019/12/05 16:50:54 bouyer Exp $	*/
 /*	$OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $	*/
 /*-
  * Copyright (c) 2009, Pyun YongHyeon 
@@ -745,7 +745,6 @@ alc_get_macaddr_816x(struct alc_softc *s
 	alc_get_macaddr_par(sc);
 }
 
-
 static void
 alc_get_macaddr_par(struct alc_softc *sc)
 {
@@ -2776,7 +2775,6 @@ alc_init_backend(struct ifnet *ifp, bool
 	} else
 		CSR_WRITE_4(sc, ALC_CLK_GATING_CFG, 0);
  
-
 	/* Reprogram the station address. */
 	memcpy(eaddr, CLLADDR(ifp->if_sadl), sizeof(eaddr));
 	CSR_WRITE_4(sc, ALC_PAR0,
@@ -2832,7 +2830,7 @@ alc_init_backend(struct ifnet *ifp, bool
 		CSR_WRITE_4(sc, ALC_RRD1_HEAD_ADDR_LO, 0);
 		CSR_WRITE_4(sc, ALC_RRD2_HEAD_ADDR_LO, 0);
 		CSR_WRITE_4(sc, ALC_RRD3_HEAD_ADDR_LO, 0);
-	}\
+	}
 	/* Set Rx return descriptor counter. */
 	CSR_WRITE_4(sc, ALC_RRD_RING_CNT,
 	(ALC_RR_RING_CNT << RRD_RING_CNT_SHIFT) & RRD_RING_CNT_MASK);
@@ -3403,25 +3401,35 @@ alc_iff(struct alc_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		ETHER_NEXT_MULTI(step, enm);
+	}
+
+update:
+	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if (ifp->if_flags & IFF_PROMISC) {
 			rxcfg |= MAC_CFG_PROMISC;
-		else
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+		} else
 			rxcfg |= MAC_CFG_ALLMULTI;
 		mchash[0] = mchash[1] = 0x;
-	} else {
-		/* Program new filter. */
-		memset(mchash, 0, sizeof(mchash));
-
-		ETHER_FIRST_MULTI(step, ec, enm);
-		while (enm != NULL) {
-			crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
-			mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-			ETHER_NEXT_MULTI(step, enm);
-		}
 	}
-
 	CSR_WRITE_4(sc, ALC_MAR0, mchash[0]);
 	CSR_WRITE_4(sc, ALC_MAR1, mchash[1]);
 	CSR_WRITE_4(sc, ALC_MAC_CFG, rxcfg);

Index: src/sys/dev/pci/if_ale.c
diff -u src/sys/dev/pci/if_ale.c:1.22.2.2 src/sys/dev/pci/if_ale.c:1.22.2.3
--- src/sys/dev/pci/if_ale.c:1.22.2.2	Wed Nov  6 10:04:47 2019
+++ src/sys/dev/pci/if_ale.c	Thu Dec  5 16:50:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ale.c,v 1.22.2.2 2019/11/06 10:04:47 martin Exp $	*/
+/*	$NetBSD: if_ale.c,v 1.22.2.3 2019/12/05 16:50:54 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008, Pyun YongHyeon 
@@ -32,7 +32,7 @@
 /* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.22.2.2 2019/11/06 10:04:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.22.2.3 2019/12/05 16:50:54 bouyer Exp $");
 
 #include "vlan.h"
 
@@ -1990,25 +1990,35 @@ ale_rxfilter(struct ale_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		

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

2019-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 16:47:17 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1462):
sys/dev/pci/if_age.c: revision 1.61, 1.63-1.64 via patch

- Fix direction of the loop in age_get_macaddr().
- Fix multicast handling. All Atheros controllers use big-endian form
  when computing multicast hash.
- Fix a bug that IFF_ALLMULTI is almost always set.


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

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

Modified files:

Index: src/sys/dev/pci/if_age.c
diff -u src/sys/dev/pci/if_age.c:1.50.8.2 src/sys/dev/pci/if_age.c:1.50.8.3
--- src/sys/dev/pci/if_age.c:1.50.8.2	Wed Nov  6 10:04:47 2019
+++ src/sys/dev/pci/if_age.c	Thu Dec  5 16:47:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.50.8.2 2019/11/06 10:04:47 martin Exp $ */
+/*	$NetBSD: if_age.c,v 1.50.8.3 2019/12/05 16:47:17 bouyer Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.50.8.2 2019/11/06 10:04:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.50.8.3 2019/12/05 16:47:17 bouyer Exp $");
 
 #include "vlan.h"
 
@@ -572,7 +572,7 @@ age_get_macaddr(struct age_softc *sc, ui
 		 */
 		CSR_WRITE_4(sc, AGE_TWSI_CTRL, CSR_READ_4(sc, AGE_TWSI_CTRL) |
 		TWSI_CTRL_SW_LD_START);
-		for (i = 100; i > 0; i++) {
+		for (i = 100; i > 0; i--) {
 			DELAY(1000);
 			reg = CSR_READ_4(sc, AGE_TWSI_CTRL);
 			if ((reg & TWSI_CTRL_SW_LD_START) == 0)
@@ -2274,25 +2274,35 @@ age_rxfilter(struct age_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		ETHER_NEXT_MULTI(step, enm);
+	}
+
+update:
+	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if (ifp->if_flags & IFF_PROMISC) {
 			rxcfg |= MAC_CFG_PROMISC;
-		else
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+		} else
 			rxcfg |= MAC_CFG_ALLMULTI;
 		mchash[0] = mchash[1] = 0x;
-	} else {
-		/* Program new filter. */
-		memset(mchash, 0, sizeof(mchash));
-
-		ETHER_FIRST_MULTI(step, ec, enm);
-		while (enm != NULL) {
-			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
-			mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-			ETHER_NEXT_MULTI(step, enm);
-		}
 	}
-
 	CSR_WRITE_4(sc, AGE_MAR0, mchash[0]);
 	CSR_WRITE_4(sc, AGE_MAR1, mchash[1]);
 	CSR_WRITE_4(sc, AGE_MAC_CFG, rxcfg);



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

2019-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 16:44:32 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1462):
sys/dev/pci/if_bge.c: revision 1.340
sys/dev/pci/if_bge.c: revision 1.341
sys/dev/pci/if_bge.c: revision 1.336
- Avoid undefined behavior in bge_setmulti(). found by kUBSan.
- Avoid undefined behavior when setting the MAC address in bge_init().
  found by kUBSan.
 Fix a bug that SK-9D41 can't detect fiber media. Check the subsystem ID
correctly. This bug was added in if_bge.c rev. 1.161.
- Use *_FLUSH() more. The main purpose is to wait following delay() correctly.
- Add missing DELAY(80) after writing BGE_MI_MODE register.


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

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.310.2.7 src/sys/dev/pci/if_bge.c:1.310.2.8
--- src/sys/dev/pci/if_bge.c:1.310.2.7	Mon May 13 12:40:13 2019
+++ src/sys/dev/pci/if_bge.c	Thu Dec  5 16:44:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.310.2.7 2019/05/13 12:40:13 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.310.2.8 2019/12/05 16:44:32 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.7 2019/05/13 12:40:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.8 2019/12/05 16:44:32 bouyer Exp $");
 
 #include 
 #include 
@@ -1030,10 +1030,10 @@ bge_eeprom_getbyte(struct bge_softc *sc,
 	 * Enable use of auto EEPROM access so we can avoid
 	 * having to use the bitbang method.
 	 */
-	BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
+	BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
 
 	/* Reset the EEPROM, load the clock period. */
-	CSR_WRITE_4(sc, BGE_EE_ADDR,
+	CSR_WRITE_4_FLUSH(sc, BGE_EE_ADDR,
 	BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL));
 	DELAY(20);
 
@@ -1825,7 +1825,7 @@ bge_setmulti(struct bge_softc *sc)
 		/* Just want the 7 least-significant bits. */
 		h &= 0x7f;
 
-		hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
+		hashes[(h & 0x60) >> 5] |= 1U << (h & 0x1F);
 		ETHER_NEXT_MULTI(step, enm);
 	}
 
@@ -2283,7 +2283,7 @@ bge_chipinit(struct bge_softc *sc)
 #endif
 
 	/* Set the timer prescaler (always 66MHz) */
-	CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
+	CSR_WRITE_4_FLUSH(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
 		DELAY(40);	/* XXX */
@@ -3439,6 +3439,7 @@ bge_attach(device_t parent, device_t sel
 	else
 		mimode |= BGE_MIMODE_BASE;
 	CSR_WRITE_4(sc, BGE_MI_MODE, mimode);
+	DELAY(80);
 
 	/*
 	 * When using the BCM5701 in PCI-X mode, data corruption has
@@ -3638,10 +3639,10 @@ alloc_retry:
 	 * Reset NVRAM before bge_reset(). It's required to acquire NVRAM
 	 * lock in bge_reset().
 	 */
-	CSR_WRITE_4(sc, BGE_EE_ADDR,
+	CSR_WRITE_4_FLUSH(sc, BGE_EE_ADDR,
 	BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL));
 	delay(1000);
-	BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
+	BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
 
 	bge_stop_fw(sc);
 	bge_sig_pre_reset(sc, BGE_RESET_START);
@@ -3854,7 +3855,7 @@ alloc_retry:
 	 * by its PCI subsystem ID, as we do below for the SysKonnect SK-9D41.
 	 * The SysKonnect SK-9D41 is a 1000baseSX card.
 	 */
-	if (PCI_PRODUCT(pa->pa_id) == SK_SUBSYSID_9D41 ||
+	if (PCI_PRODUCT(subid) == SK_SUBSYSID_9D41 ||
 	(hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) {
 		if (BGE_IS_5705_PLUS(sc)) {
 			sc->bge_flags |= BGEF_FIBER_MII;
@@ -5534,7 +5535,8 @@ bge_init(struct ifnet *ifp)
 	/* Load our MAC address. */
 	m = (const uint16_t *)&(CLLADDR(ifp->if_sadl)[0]);
 	CSR_WRITE_4(sc, BGE_MAC_ADDR1_LO, htons(m[0]));
-	CSR_WRITE_4(sc, BGE_MAC_ADDR1_HI, (htons(m[1]) << 16) | htons(m[2]));
+	CSR_WRITE_4(sc, BGE_MAC_ADDR1_HI,
+	((uint32_t)htons(m[1]) << 16) | htons(m[2]));
 
 	/* Enable or disable promiscuous mode as needed. */
 	if (ifp->if_flags & IFF_PROMISC)
@@ -5680,10 +5682,10 @@ bge_ifmedia_upd(struct ifnet *ifp)
 			break;
 		case IFM_1000_SX:
 			if ((ifm->ifm_media & IFM_FDX) != 0) {
-BGE_CLRBIT(sc, BGE_MAC_MODE,
+BGE_CLRBIT_FLUSH(sc, BGE_MAC_MODE,
 BGE_MACMODE_HALF_DUPLEX);
 			} else {
-BGE_SETBIT(sc, BGE_MAC_MODE,
+BGE_SETBIT_FLUSH(sc, BGE_MAC_MODE,
 BGE_MACMODE_HALF_DUPLEX);
 			}
 			DELAY(40);
@@ -6081,7 +6083,7 @@ bge_link_upd(struct bge_softc *sc)
 BGE_STS_SETBIT(sc, BGE_STS_LINK);
 if (BGE_ASICREV(sc->bge_chipid)
 == BGE_ASICREV_BCM5704) {
-	BGE_CLRBIT(sc, BGE_MAC_MODE,
+	BGE_CLRBIT_FLUSH(sc, BGE_MAC_MODE,
 	BGE_MACMODE_TBI_SEND_CFGS);
 	DELAY(40);
 }



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

2019-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  5 08:20:08 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #1255):

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

add NetMos NM9912 entries

PR kern/54149 by Mouse


To generate a diff of this commit:
cvs rdiff -u -r1.99.8.3 -r1.99.8.4 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.3 src/sys/dev/pci/pucdata.c:1.99.8.4
--- src/sys/dev/pci/pucdata.c:1.99.8.3	Thu Jun  7 18:12:17 2018
+++ src/sys/dev/pci/pucdata.c	Sun May  5 08:20:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.99.8.3 2018/06/07 18:12:17 martin Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.99.8.4 2019/05/05 08:20:08 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.3 2018/06/07 18:12:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.99.8.4 2019/05/05 08:20:08 martin Exp $");
 
 #include 
 #include 
@@ -999,6 +999,23 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* NetMos PCIe NM9912 */
+	{ "NetMos NM9912 Dual PCI-E UART and 1284 Printer Port",
+	{   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9912, 0, 0x1000 },
+	{   0x, 0x, 0, 0x },
+	{
+		{ PUC_PORT_TYPE_COM, 0x10, 0x, 0 },
+	},
+	},
+
+	{ "NetMos NM9912 Dual PCI-E UART and 1284 Printer Port",
+	{   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9912, 0, 0x2000 },
+	{   0x, 0x, 0, 0x },
+	{
+		{ PUC_PORT_TYPE_LPT, 0x10, 0x, 0 },
+	},
+	},
+
 	/* NetMos PCIe NM9922 (PCI multi function): 2S */
 	{   "NetMos NM9922 UART",
 	{   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9922, 0, 0 },



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

2019-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 26 19:04:19 UTC 2019

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

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

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

Clean up timeout logic. Now the system survives to a ccb timeout; before
the filesystem would stall because one I/O did never completes.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 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.3 src/sys/dev/pci/mfii.c:1.3.2.4
--- src/sys/dev/pci/mfii.c:1.3.2.3	Sat Dec  8 12:17:13 2018
+++ src/sys/dev/pci/mfii.c	Fri Apr 26 19:04:19 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.3.2.3 2018/12/08 12:17:13 martin Exp $ */
+/* $NetBSD: mfii.c,v 1.3.2.4 2019/04/26 19:04:19 martin 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.3 2018/12/08 12:17:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.4 2019/04/26 19:04:19 martin Exp $");
 
 #include "bio.h"
 
@@ -264,7 +264,6 @@ struct mfii_ccb {
 	u_int32_t		ccb_flags;
 #define MFI_CCB_F_ERR			(1<<0)
 	u_int			ccb_smid;
-	u_int			ccb_refcnt;
 	SIMPLEQ_ENTRY(mfii_ccb)	ccb_link;
 };
 SIMPLEQ_HEAD(mfii_ccb_list, mfii_ccb);
@@ -2159,7 +2158,6 @@ mfii_scsipi_request(struct scsipi_channe
 		return;
 	}
 
-	ccb->ccb_refcnt = 2; /* one for the chip, one for the timeout */
 	mfii_start(sc, ccb);
 
 	return;
@@ -2176,10 +2174,9 @@ mfii_scsi_cmd_done(struct mfii_softc *sc
 	struct scsipi_xfer *xs = ccb->ccb_cookie;
 	struct mpii_msg_scsi_io *io = ccb->ccb_request;
 	struct mfii_raid_context *ctx = (struct mfii_raid_context *)(io + 1);
-	u_int refs = 2;
 
 	if (callout_stop(>xs_callout) != 0)
-		refs = 1;
+		return;
 
 	switch (ctx->status) {
 	case MFI_STAT_OK:
@@ -2201,10 +2198,8 @@ mfii_scsi_cmd_done(struct mfii_softc *sc
 		break;
 	}
 
-	if (atomic_add_int_nv(>ccb_refcnt, -refs) == 0) {
-		scsipi_done(xs);
-		mfii_put_ccb(sc, ccb);
-	}
+	scsipi_done(xs);
+	mfii_put_ccb(sc, ccb);
 }
 
 int
@@ -2343,7 +2338,6 @@ mfii_pd_scsi_cmd(struct scsipi_xfer *xs)
 		return;
 	}
 
-	ccb->ccb_refcnt = 2; /* one for the chip, one for the timeout */
 	// XXX timeout_add_msec(>stimeout, xs->timeout);
 	mfii_start(sc, ccb);
 
@@ -2543,10 +2537,9 @@ mfii_abort_task(struct work *wk, void *s
 
 		if (!sc->sc_ld[periph->periph_target].ld_present) {
 			/* device is gone */
-			if (atomic_dec_uint_nv(>ccb_refcnt) == 0) {
-scsipi_done(xs);
-mfii_put_ccb(sc, ccb);
-			}
+			xs->error = XS_SELTIMEOUT;
+			scsipi_done(xs);
+			mfii_put_ccb(sc, ccb);
 			continue;
 		}
 
@@ -2591,12 +2584,11 @@ mfii_scsi_cmd_abort_done(struct mfii_sof
 	/* XXX check accb completion? */
 
 	mfii_put_ccb(sc, accb);
+	printf("%s: cmd aborted ccb %p\n", DEVNAME(sc), ccb);
 
-	if (atomic_dec_uint_nv(>ccb_refcnt) == 0) {
-		xs->error = XS_TIMEOUT;
-		scsipi_done(xs);
-		mfii_put_ccb(sc, ccb);
-	}
+	xs->error = XS_TIMEOUT;
+	scsipi_done(xs);
+	mfii_put_ccb(sc, ccb);
 }
 
 struct mfii_ccb *
@@ -2627,8 +2619,6 @@ mfii_scrub_ccb(struct mfii_ccb *ccb)
 	ccb->ccb_dma64 = false;
 	ccb->ccb_len = 0;
 	ccb->ccb_sgl_len = 0;
-	ccb->ccb_refcnt = 1;
-
 	memset(>ccb_req, 0, sizeof(ccb->ccb_req));
 	memset(ccb->ccb_request, 0, MFII_REQUEST_SIZE);
 	memset(ccb->ccb_mfi, 0, MFI_FRAME_SIZE);



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

2019-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr  7 13:46:39 UTC 2019

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

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

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

Fix ASIC check, BGE_ASICREV(sc->bge_chipid) is not a chipid.

Fixes bogus input error reporting in stat. This is cosmetic, exept for
routed(8) which thinks that the interface is broken and stops accepting routes
from it.


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

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.310.2.5 src/sys/dev/pci/if_bge.c:1.310.2.6
--- src/sys/dev/pci/if_bge.c:1.310.2.5	Thu Mar  7 17:38:59 2019
+++ src/sys/dev/pci/if_bge.c	Sun Apr  7 13:46:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.310.2.5 2019/03/07 17:38:59 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.310.2.6 2019/04/07 13:46:39 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.5 2019/03/07 17:38:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.6 2019/04/07 13:46:39 martin Exp $");
 
 #include 
 #include 
@@ -4769,8 +4769,8 @@ bge_stats_update_regs(struct bge_softc *
 	 * ignore the counter
 	 */
 	if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 &&
-	BGE_ASICREV(sc->bge_chipid) != BGE_CHIPID_BCM5719_A0 &&
-	BGE_ASICREV(sc->bge_chipid) != BGE_CHIPID_BCM5720_A0) {
+	sc->bge_chipid != BGE_CHIPID_BCM5719_A0 &&
+	sc->bge_chipid != BGE_CHIPID_BCM5720_A0) {
 		ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
 	}
 	ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS);



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

2019-04-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  1 12:35:38 UTC 2019

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

Log Message:
Pull up the following, requested by msaitohin ticket #1225:

sys/dev/pci/ixgbe/ixgbe.c   1.175-1.178
sys/dev/pci/ixgbe/ixv.c 1.110-1.111 via patch

- NetBSD currently uses traffic class 0 only. Other traffic classes
  aren't used yet. When IXGBE_TC_COUNTER_NUM is set to lower than
  IXGBE_DCB_MAX_TRAFFIC_CLASS (e.g. 1), other traffic classes' counters
  are not used. It means we don't generate evcnt for them and don't
  add the values in ixgbe_update_stats_counters().
- It's not required to calculate unused queues' statistics.
- Fix a bug that the VLAN HW tagging function is not correctly disabled
  when all vlan is detached.
- Fix a bug that VLAN HW tagging function is not correctly controlled
  on 82598.
- Control VLAN HW filter function correctly. Note that currently
  VLAN HW filter function doesn't work because NetBSD doesn't support
  it yet.
- Don't clear IXGBE_VLNCTRL_CFIEN bit When ETHERCAP_VLAN_HWFILTER is
  set. I think it's not required (and Linux doesn't do it). This change
  has no effect to NetBSD because ETHERCAP_VLAN_HWFILTER is not
  supported yet.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.28 -r1.88.2.29 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.22.2.7 -r1.22.2.8 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.20 -r1.56.2.21 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.28 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.29
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.28	Fri Mar  1 17:33:24 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Apr  1 12:35:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.28 2019/03/01 17:33:24 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.29 2019/04/01 12:35:38 martin Exp $ */
 
 /**
 
@@ -1558,8 +1558,8 @@ ixgbe_update_stats_counters(struct adapt
 		}
 	}
 
-	/* 8 registers */
-	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+	/* 8 registers exist */
+	for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
 		uint32_t mp;
 
 		/* MPC */
@@ -1739,7 +1739,7 @@ ixgbe_add_hw_stats(struct adapter *adapt
 
 	/* Max number of traffic class is 8 */
 	KASSERT(IXGBE_DCB_MAX_TRAFFIC_CLASS == 8);
-	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+	for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
 		snprintf(adapter->tcs[i].evnamebuf,
 		sizeof(adapter->tcs[i].evnamebuf), "%s tc%d",
 		xname, i);
@@ -2038,7 +2038,7 @@ ixgbe_clear_evcnt(struct adapter *adapte
 	adapter->msf_sicount.ev_count = 0;
 	adapter->phy_sicount.ev_count = 0;
 
-	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+	for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
 		if (i < __arraycount(stats->mpc)) {
 			stats->mpc[i].ev_count = 0;
 			if (hw->mac.type == ixgbe_mac_82598EB)
@@ -2310,33 +2310,34 @@ ixgbe_setup_vlan_hw_support(struct adapt
 	struct rx_ring	*rxr;
 	int i;
 	u32		ctrl;
-
+	bool		hwtagging;
 
 	/*
-	 * We get here thru init_locked, meaning
-	 * a soft reset, this has already cleared
-	 * the VFTA and other state, so if there
-	 * have been no vlan's registered do nothing.
+	 *  This function is called from both if_init and ifflags_cb()
+	 * on NetBSD.
 	 */
-	if (!VLAN_ATTACHED(>osdep.ec))
-		return;
+
+	/* Enable HW tagging only if any vlan is attached */
+	hwtagging = (ec->ec_capenable & ETHERCAP_VLAN_HWTAGGING)
+	&& VLAN_ATTACHED(ec);
 
 	/* Setup the queues for vlans */
-	if (ec->ec_capenable & ETHERCAP_VLAN_HWTAGGING) {
-		for (i = 0; i < adapter->num_queues; i++) {
-			rxr = >rx_rings[i];
-			/* On 82599 the VLAN enable is per/queue in RXDCTL */
-			if (hw->mac.type != ixgbe_mac_82598EB) {
-ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me));
+	for (i = 0; i < adapter->num_queues; i++) {
+		rxr = >rx_rings[i];
+		/*
+		 * On 82599 and later, the VLAN enable is per/queue in RXDCTL.
+		 */
+		if (hw->mac.type != ixgbe_mac_82598EB) {
+			ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me));
+			if (hwtagging)
 ctrl |= IXGBE_RXDCTL_VME;
-IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), ctrl);
-			}
-			rxr->vtag_strip = TRUE;
+			else
+ctrl &= ~IXGBE_RXDCTL_VME;
+			IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), ctrl);
 		}
+		rxr->vtag_strip = hwtagging ? TRUE : FALSE;
 	}
 
-	if ((ec->ec_capenable & ETHERCAP_VLAN_HWFILTER) == 0)
-		return;
 	/*
 	 * A soft reset zero's out the VFTA, so
 	 * we need to repopulate it now.
@@ -2348,12 +2349,17 @@ ixgbe_setup_vlan_hw_support(struct adapt
 
 	ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 	/* Enable the Filter Table if enabled */
-	if (ec->ec_capenable & ETHERCAP_VLAN_HWFILTER) {
-		ctrl &= ~IXGBE_VLNCTRL_CFIEN;
+	if 

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

2019-03-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 15 14:50:36 UTC 2019

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

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

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

PR/54045

fix mpii to adhere to physio diagnostic invariant that
fully processed data must not post an error:

1) verify expected scspi state via KASSERT() instead of just
setting the variables.
2) set xs->resid only in known good conditions
3) insure setting errors in all error paths and refrain
from clearing xs->resid in error paths.

While there do some cosmectic clean up:
1) extend and relocate some debug output
2) mpii HBAs can also manage non-disk devices like tapes etc,
so log that physical "devices" instead of physical "disks" are
attached or detached.

Tested with NEOSeries FlexStor II and luckily a broken tape drive 8-(

mpii0 at pci1 dev 0 function 0: vendor 1000 product 00ab (rev. 0x01)
mpii0: interrupting at irq 11
mpii0: HBA 9400-8i8e, firmware 3.0.4.0, MPI 2.6
mpii0: physical device inserted in slot 9
mpii0: physical device inserted in slot 13
mpii0: physical device inserted in slot 16
st0 at scsibus0 target 9 lun 0:  tape removable
st0: density code 92, variable blocks, write-enabled
ch0 at scsibus0 target 9 lun 1:  changer removable
ch0: 23 slots, 2 drives, 1 picker, 1 portal
st0: tagged queueing
ch0: tagged queueing
st1 at scsibus0 target 13 lun 0:  tape removable
st1: density code 92, variable blocks, write-enabled
st1: tagged queueing
ses0 at scsibus0 target 16 lun 0:  enclosure
services fixed

Note: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.4 -r1.8.10.5 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.4 src/sys/dev/pci/mpii.c:1.8.10.5
--- src/sys/dev/pci/mpii.c:1.8.10.4	Mon Jan  7 13:49:39 2019
+++ src/sys/dev/pci/mpii.c	Fri Mar 15 14:50:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.4 2019/01/07 13:49:39 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.5 2019/03/15 14:50:36 martin Exp $ */
 /*	OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.4 2019/01/07 13:49:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.5 2019/03/15 14:50:36 martin Exp $");
 
 #include "bio.h"
 
@@ -1920,7 +1920,7 @@ mpii_event_sas(struct mpii_softc *sc, st
 free(dev, M_DEVBUF);
 break;
 			}
-			printf("%s: physical disk inserted in slot %d\n",
+			printf("%s: physical device inserted in slot %d\n",
 			DEVNAME(sc), dev->slot);
 			mutex_exit(>sc_devs_mtx);
 			break;
@@ -1994,7 +1994,7 @@ mpii_event_sas_work(struct work *wq, voi
 }
 
 printf(
-"%s: physical disk removed from slot %d\n",
+"%s: physical device removed from slot %d\n",
 DEVNAME(sc), dev->slot);
 mpii_remove_dev(sc, dev);
 mutex_exit(>sc_devs_mtx);
@@ -3021,8 +3021,8 @@ mpii_scsipi_request(struct scsipi_channe
 		scsipi_done(xs);
 		return;
 	}
-	DNPRINTF(MPII_D_CMD, "%s: ccb_smid: %d xs->xs_control: 0x%x\n",
-	DEVNAME(sc), ccb->ccb_smid, xs->xs_control);
+	DNPRINTF(MPII_D_CMD, "%s: ccb_smid: %d xs->cmd->opcode: 0x%02x xs->xs_control: 0x%x\n",
+	DEVNAME(sc), ccb->ccb_smid, xs->cmd->opcode, xs->xs_control);
 
 	ccb->ccb_cookie = xs;
 	ccb->ccb_done = mpii_scsi_cmd_done;
@@ -3220,13 +3220,14 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 
 		bus_dmamap_unload(sc->sc_dmat, dmap);
 	}
-
-	xs->error = XS_NOERROR;
-	xs->resid = 0;
-
+	
+	KASSERT(xs->error == XS_NOERROR);
+	KASSERT(xs->resid == xs->datalen);
+	KASSERT(xs->status == SCSI_OK);
+	
 	if (ccb->ccb_rcb == NULL) {
 		/* no scsi error, we're ok so drop out early */
-		xs->status = SCSI_OK;
+		xs->resid = 0;
 		goto done;
 	}
 
@@ -3276,9 +3277,11 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 	case MPII_IOCSTATUS_SCSI_RECOVERED_ERROR:
 		switch (sie->scsi_status) {
 		case MPII_SCSIIO_STATUS_GOOD:
+			xs->resid = 0;
 			break;
 
 		case MPII_SCSIIO_STATUS_CHECK_COND:
+			xs->resid = 0;
 			xs->error = XS_SENSE;
 			break;
 
@@ -3317,12 +3320,14 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 	if (sie->scsi_state & MPII_SCSIIO_STATE_AUTOSENSE_VALID)
 		memcpy(>sense, sense, sizeof(xs->sense));
 
-	DNPRINTF(MPII_D_CMD, "%s:  xs err: %d status: %#x\n", DEVNAME(sc),
-	xs->error, xs->status);
-
 	mpii_push_reply(sc, ccb->ccb_rcb);
-done:
+
+ done:
 	mpii_put_ccb(sc, ccb);
+
+	DNPRINTF(MPII_D_CMD, "%s: xs err: %d status: %#x len: %d resid: %d\n",
+		 DEVNAME(sc), xs->error, xs->status, xs->datalen, xs->resid);
+
 	scsipi_done(xs);
 }
 



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

2019-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  7 17:38:59 UTC 2019

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

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

sys/dev/pci/if_bge.c1.323-1.327
sys/dev/pci/if_bgereg.h 1.95
sys/dev/mii/brgphy.c1.80
share/man/man4/bge.41.16

- Add BCM5717's another device ID support.
- Add BCM5702FE, another BCM5704S and SysKonnect SK-9Mxx support.
- Add support for BCM5762 ASIC devices.
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.
- Simplify PCI device table.
- Add /* FALLTHROUGH */


To generate a diff of this commit:
cvs rdiff -u -r1.310.2.4 -r1.310.2.5 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.93.4.1 -r1.93.4.2 src/sys/dev/pci/if_bgereg.h

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.310.2.4 src/sys/dev/pci/if_bge.c:1.310.2.5
--- src/sys/dev/pci/if_bge.c:1.310.2.4	Sat Dec  8 12:10:22 2018
+++ src/sys/dev/pci/if_bge.c	Thu Mar  7 17:38:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.310.2.4 2018/12/08 12:10:22 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.310.2.5 2019/03/07 17:38:59 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.4 2018/12/08 12:10:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.5 2019/03/07 17:38:59 martin Exp $");
 
 #include 
 #include 
@@ -297,371 +297,116 @@ void		bge_debug_info(struct bge_softc *)
 #define	BGE_EVCNT_UPD(ev, val)	/* nothing */
 #endif
 
+#define VIDDID(a, b) PCI_VENDOR_ ## a, PCI_PRODUCT_ ## a ## _ ## b
+/*
+ * The BCM5700 documentation seems to indicate that the hardware still has the
+ * Alteon vendor ID burned into it, though it should always be overridden by
+ * the value in the EEPROM.  We'll check for it anyway.
+ */
 static const struct bge_product {
 	pci_vendor_id_t		bp_vendor;
 	pci_product_id_t	bp_product;
 	const char		*bp_name;
 } bge_products[] = {
-	/*
-	 * The BCM5700 documentation seems to indicate that the hardware
-	 * still has the Alteon vendor ID burned into it, though it
-	 * should always be overridden by the value in the EEPROM.  We'll
-	 * check for it anyway.
-	 */
-	{ PCI_VENDOR_ALTEON,
-	  PCI_PRODUCT_ALTEON_BCM5700,
-	  "Broadcom BCM5700 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_ALTEON,
-	  PCI_PRODUCT_ALTEON_BCM5701,
-	  "Broadcom BCM5701 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC1000,
-	  "Altima AC1000 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC1001,
-	  "Altima AC1001 Gigabit Ethernet",
-	   },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC1003,
-	  "Altima AC1003 Gigabit Ethernet",
-	   },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC9100,
-	  "Altima AC9100 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_APPLE,
-	  PCI_PRODUCT_APPLE_BCM5701,
-	  "APPLE BCM5701 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5700,
-	  "Broadcom BCM5700 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5701,
-	  "Broadcom BCM5701 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5702,
-	  "Broadcom BCM5702 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5702X,
-	  "Broadcom BCM5702X Gigabit Ethernet" },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5703,
-	  "Broadcom BCM5703 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5703X,
-	  "Broadcom BCM5703X Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5703_ALT,
-	  "Broadcom BCM5703 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5704C,
-	  "Broadcom BCM5704C Dual Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5704S,
-	  "Broadcom BCM5704S Dual Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705,
-	  "Broadcom BCM5705 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705F,
-	  "Broadcom BCM5705F Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705K,
-	  "Broadcom BCM5705K Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705M,
-	  "Broadcom BCM5705M Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705M_ALT,
-	  "Broadcom BCM5705M Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5714,
-	  "Broadcom BCM5714 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5714S,
-	  "Broadcom BCM5714S Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5715,
-	  "Broadcom BCM5715 

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

2019-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  7 17:11:53 UTC 2019

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

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

sys/dev/pci/if_wmreg.h  1.113
sys/dev/pci/if_wmvar.h  1.43-1.44
sys/dev/pci/if_wm.c 1.626-1.627, 1.629-1.636 via 
patch

- Add support for I210 SGMII Flash-less device.
- Add I219 variations for Cannon Lake.
- Add missing rnd_detach_source().
- Use  do { ... } while (0) for DPRINTF(x, y).
- Swap enumeration of 82578 and 82577 PHY in if_wmvar.h. No functional
  change.
- Add KASSERT.
- Update TODO list. Add comment. Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.30 -r1.508.4.31 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.7 -r1.98.6.8 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.33.6.4 -r1.33.6.5 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.30 src/sys/dev/pci/if_wm.c:1.508.4.31
--- src/sys/dev/pci/if_wm.c:1.508.4.30	Mon Feb 11 13:44:34 2019
+++ src/sys/dev/pci/if_wm.c	Thu Mar  7 17:11:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.30 2019/02/11 13:44:34 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.31 2019/03/07 17:11:53 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -79,11 +79,10 @@
  *	- Virtual Function
  *	- Set LED correctly (based on contents in EEPROM)
  *	- Rework how parameters are loaded from the EEPROM.
- *	- Image Unique ID
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.30 2019/02/11 13:44:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.31 2019/03/07 17:11:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -157,7 +156,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.
 int	wm_debug = WM_DEBUG_TX | WM_DEBUG_RX | WM_DEBUG_LINK | WM_DEBUG_GMII
 | WM_DEBUG_MANAGE | WM_DEBUG_NVM | WM_DEBUG_INIT | WM_DEBUG_LOCK;
 
-#define	DPRINTF(x, y)	if (wm_debug & (x)) printf y
+#define	DPRINTF(x, y)	do { if (wm_debug & (x)) printf y; } while (0)
 #else
 #define	DPRINTF(x, y)	__nothing
 #endif /* WM_DEBUG */
@@ -1465,7 +1464,7 @@ static const struct wm_product {
 	  WM_T_I210,		WMP_F_COPPER },
 
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_COPPER_WOF,
-	  "I210 Ethernet (FLASH less)",
+	  "I210 Ethernet (Copper, FLASH less)",
 	  WM_T_I210,		WMP_F_COPPER },
 
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_FIBER,
@@ -1477,13 +1476,17 @@ static const struct wm_product {
 	  WM_T_I210,		WMP_F_SERDES },
 
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_SERDES_WOF,
-	  "I210 Gigabit Ethernet (FLASH less)",
+	  "I210 Gigabit Ethernet (SERDES, FLASH less)",
 	  WM_T_I210,		WMP_F_SERDES },
 
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_SGMII,
 	  "I210 Gigabit Ethernet (SGMII)",
 	  WM_T_I210,		WMP_F_COPPER },
 
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_SGMII_WOF,
+	  "I210 Gigabit Ethernet (SGMII, FLASH less)",
+	  WM_T_I210,		WMP_F_COPPER },
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I211_COPPER,
 	  "I211 Ethernet (COPPER)",
 	  WM_T_I211,		WMP_F_COPPER },
@@ -1511,18 +1514,6 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I218_LM3,
 	  "I218 LM Ethernet Connection",
 	  WM_T_PCH_LPT,		WMP_F_COPPER },
-	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V,
-	  "I219 V Ethernet Connection",
-	  WM_T_PCH_SPT,		WMP_F_COPPER },
-	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V2,
-	  "I219 V Ethernet Connection",
-	  WM_T_PCH_SPT,		WMP_F_COPPER },
-	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V4,
-	  "I219 V Ethernet Connection",
-	  WM_T_PCH_SPT,		WMP_F_COPPER },
-	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V5,
-	  "I219 V Ethernet Connection",
-	  WM_T_PCH_SPT,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM,
 	  "I219 LM Ethernet Connection",
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
@@ -1538,17 +1529,41 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM5,
 	  "I219 LM Ethernet Connection",
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM6,
+	  "I219 LM Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM7,
+	  "I219 LM Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM8,
+	  "I219 LM Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM9,
+	  "I219 LM Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V,
+	  "I219 V Ethernet Connection",
+	  WM_T_PCH_SPT,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V2,
+	  "I219 V Ethernet Connection",
+	  WM_T_PCH_SPT,		WMP_F_COPPER },
+	{ 

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

2019-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  7 17:03:52 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1363
sys/dev/pci/pcidevs: revision 1.1364
sys/dev/pci/pcidevs: revision 1.1365
sys/dev/pci/pcidevs: revision 1.1366

  Add Tundra (now IDT) TSI381 and PEB383 from OpenBSD.

  Add some Broadcom Ethernet devices from {Open,Free}BSD.

  Add SK-NET SK-9Mxx Gigabit Ethernet.

  Add Intel I219 variations for Cannon Lake.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.13 src/sys/dev/pci/pcidevs:1.1289.2.14
--- src/sys/dev/pci/pcidevs:1.1289.2.13	Mon Feb 11 13:34:09 2019
+++ src/sys/dev/pci/pcidevs	Thu Mar  7 17:03:52 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.13 2019/02/11 13:34:09 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.14 2019/03/07 17:03:52 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1861,6 +1861,12 @@ product BROADCOM BCM5709	0x1639	BCM5709 
 product BROADCOM BCM5709S	0x163a	BCM5709 NetXtreme II 1000baseSX Ethernet
 product BROADCOM BCM5716	0x163b	BCM5716 NetXtreme II 1000baseT Ethernet
 product BROADCOM BCM5716S	0x163c	BCM5716 NetXtreme II 1000baseSX Ethernet
+product BROADCOM BCM57811	0x163d	BCM57811 10Gb Ethernet
+product BROADCOM BCM57811_MF	0x163e	BCM57811 10Gb MF Ethernet
+product BROADCOM BCM57811_VF	0x163f	BCM57811 10Gb Ehternet VF
+product BROADCOM BCM57787	0x1641	BCM57787 Gigabit Ethernet
+product BROADCOM BCM57764	0x1642	BCM57764 Gigabit Ethernet
+product BROADCOM BCM5725	0x1643	BCM5725 Gigabit Ethernet
 product BROADCOM BCM5700	0x1644	BCM5700 10/100/1000 Ethernet
 product BROADCOM BCM5701	0x1645	BCM5701 10/100/1000 Ethernet
 product BROADCOM BCM5702	0x1646	BCM5702 10/100/1000 Ethernet
@@ -1886,11 +1892,13 @@ product BROADCOM BCM5705M	0x165d	BCM5705
 product BROADCOM BCM5705M_ALT	0x165e	BCM5705M 10/100/1000 Ethernet
 product BROADCOM BCM5720	0x165f	BCM5720 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM57712	0x1662	BCM57712 NetXtreme II 10Gb Ethernet
-product BROADCOM BCM57712E	0x1663	BCM57712E NetXtreme II 10Gb Ethernet
+product BROADCOM BCM57712_MF	0x1663	BCM57712 NetXtreme II 10Gb Ethernet MF
+product BROADCOM BCM5717C	0x1665	BCM5717 10/100/1000 Ethernet
 product BROADCOM BCM5714	0x1668	BCM5714 1000baseT Ethernet
 product BROADCOM BCM5714S	0x1669	BCM5714S 1000baseSX Ethernet
 product BROADCOM BCM5780	0x166a	BCM5780 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5780S	0x166b	BCM5780S NetXtreme 1000baseSX Ethernet
+product BROADCOM BCM57712_VF	0x166f	BCM57712 NetXtreme II 10Gb Ethernet VF
 product BROADCOM BCM5705F	0x166e	BCM5705F 10/100 Ethernet
 product BROADCOM BCM5754M	0x1672	BCM5754M NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5755M	0x1673	BCM5755M NetXtreme 1000baseT Ethernet
@@ -1908,11 +1916,15 @@ product BROADCOM BCM5787F	0x167f	BCM5787
 product BROADCOM BCM5761E	0x1680	BCM5761E 10/100/1000 Ethernet
 product BROADCOM BCM5761	0x1681	BCM5761 10/100/1000 Ethernet
 product BROADCOM BCM57762	0x1682	BCM57762 Gigabit Ethernet
+product BROADCOM BCM57767	0x1683	BCM57767 Gigabit Ethernet
 product BROADCOM BCM5764	0x1684	BCM5764 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM57766	0x1686	BCM57766 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5762	0x1687	BCM5762 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5761S	0x1688	BCM5761S 10/100/1000 Ethernet
 product BROADCOM BCM5761SE	0x1689	BCM5761SE 10/100/1000 Ethernet
+product BROADCOM BCM57800	0x168a	BCM57800 NetXtreme II 10Gb Ethernet
+product BROADCOM BCM57840_OBS	0x168d	BCM57840 10Gb Ethernet
+product BROADCOM BCM57810	0x168e	BCM57810 10Gb Ethernet
 product BROADCOM BCM57760	0x1690	BCM57760 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM57788	0x1691	BCM57788 NetLink 1000baseT Ethernet
 product BROADCOM BCM57780	0x1692	BCM57780 NetXtreme 1000baseT Ethernet
@@ -1926,11 +1938,20 @@ product BROADCOM BCM5787	0x169b	BCM5787 
 product BROADCOM BCM5788	0x169c	BCM5788 10/100/1000 Ethernet
 product BROADCOM BCM5789	0x169d	BCM5789 NetLink 1000baseT Ethernet
 product BROADCOM BCM5785F	0x16a0	BCM5785F 10/100 Ethernet
+product BROADCOM BCM57840_4_10	0x16a1	BCM57840 4x10Gb Ethernet
+product BROADCOM BCM57840_2_20	0x16a2	BCM57840 2x20Gb Ethernet
+product BROADCOM BCM57840_MF	0x16a4	BCM57840 10Gb Ethernet MF
+product BROADCOM BCM57800_MF	0x16a5	BCM57800 10Gb Ethernet MF
 product BROADCOM BCM5702X	0x16a6	BCM5702X 10/100/1000 Ethernet
 product BROADCOM BCM5703X	0x16a7	BCM5703X 10/100/1000 Ethernet
 product BROADCOM BCM5704S	0x16a8	BCM5704S 1000baseSX Ethernet
+product BROADCOM BCM57800_VF	0x16a9	BCM57800 10Gb Ethernet VF
 product BROADCOM BCM5706S	0x16aa	

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

2019-03-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar  1 17:33:25 UTC 2019

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 #1199):

sys/dev/pci/ixgbe/ixv.c: revision 1.109
sys/dev/pci/ixgbe/ixgbe.h: revision 1.54
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.52
sys/dev/pci/ixgbe/ixgbe.c: revision 1.174

  Fix a bug that if_link_state_change(ifp, LINK_STATE_DOWN) isn't called unless
link goes up at least one time. Without this change, never linkup-ed media
keeps LINK_STATE_UNKNOWN instead of LINK_STATE_DOWN.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.14 -r1.24.2.15 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.27 -r1.88.2.28 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.15 -r1.24.6.16 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.19 -r1.56.2.20 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.14 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.15
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.14	Thu Dec 20 11:34:33 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Mar  1 17:33:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.14 2018/12/20 11:34:33 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.15 2019/03/01 17:33:24 martin Exp $ */
 
 /**
 
@@ -136,7 +136,7 @@ ixgbe_legacy_start_locked(struct ifnet *
 
 	IXGBE_TX_LOCK_ASSERT(txr);
 
-	if (!adapter->link_active) {
+	if (adapter->link_active != LINK_STATE_UP) {
 		/*
 		 * discard all packets buffered in IFQ to avoid
 		 * sending old packets at next link up timing.
@@ -282,7 +282,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 	struct mbuf*next;
 	intenqueued = 0, err = 0;
 
-	if (!txr->adapter->link_active) {
+	if (txr->adapter->link_active != LINK_STATE_UP) {
 		/*
 		 * discard all packets buffered in txr_interq to avoid
 		 * sending old packets at next link up timing.

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.27 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.28
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.27	Mon Jan 28 13:03:02 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Mar  1 17:33:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.27 2019/01/28 13:03:02 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.28 2019/03/01 17:33:24 martin Exp $ */
 
 /**
 
@@ -1594,7 +1594,7 @@ ixgbe_update_stats_counters(struct adapt
 	stats->mpctotal.ev_count += total_missed_rx;
 
 	/* Document says M[LR]FC are valid when link is up and 10Gbps */
-	if ((adapter->link_active == TRUE)
+	if ((adapter->link_active == LINK_STATE_UP)
 	&& (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)) {
 		stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
 		stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
@@ -2692,7 +2692,7 @@ ixgbe_media_status(struct ifnet *ifp, st
 	ifmr->ifm_status = IFM_AVALID;
 	ifmr->ifm_active = IFM_ETHER;
 
-	if (!adapter->link_active) {
+	if (adapter->link_active != LINK_STATE_UP) {
 		ifmr->ifm_active |= IFM_NONE;
 		IXGBE_CORE_UNLOCK(adapter);
 		return;
@@ -4665,7 +4665,7 @@ ixgbe_update_link_status(struct adapter 
 	KASSERT(mutex_owned(>core_mtx));
 
 	if (adapter->link_up) {
-		if (adapter->link_active == FALSE) {
+		if (adapter->link_active != LINK_STATE_UP) {
 			/*
 			 * To eliminate influence of the previous state
 			 * in the same way as ixgbe_init_locked().
@@ -4714,7 +4714,7 @@ ixgbe_update_link_status(struct adapter 
 device_printf(dev, "Link is up %s %s \n",
 bpsmsg, "Full Duplex");
 			}
-			adapter->link_active = TRUE;
+			adapter->link_active = LINK_STATE_UP;
 			/* Update any Flow Control changes */
 			ixgbe_fc_enable(>hw);
 			/* Update DMA coalescing config */
@@ -4724,12 +4724,17 @@ ixgbe_update_link_status(struct adapter 
 			if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
 ixgbe_ping_all_vfs(adapter);
 		}
-	} else { /* Link down */
-		if (adapter->link_active == TRUE) {
+	} else {
+		/*
+		 * Do it when link active changes to DOWN. i.e.
+		 * a) LINK_STATE_UNKNOWN -> LINK_STATE_DOWN
+		 * b) LINK_STATE_UP  -> LINK_STATE_DOWN
+		 */
+		if (adapter->link_active != LINK_STATE_DOWN) {
 			if (bootverbose)
 device_printf(dev, "Link is Down\n");
 			if_link_state_change(ifp, LINK_STATE_DOWN);
-			adapter->link_active = FALSE;
+			adapter->link_active = LINK_STATE_DOWN;
 			if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
 ixgbe_ping_all_vfs(adapter);
 			ixgbe_drain_all(adapter);

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.15 src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.16
--- 

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

2019-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 11 13:44:34 UTC 2019

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

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

sys/dev/pci/if_wm.c: revision 1.622
sys/dev/pci/if_wm.c: revision 1.624
sys/dev/pci/if_wm.c: revision 1.625

 We now have IFM_2500_KX and IFM_1000_KX, so use them.

 -

 I21[01]'s RAL size is not 15 but 16(== 82575's value). Same as other OSes.

 -

 Fix a bug that WOL didn't work on some chips since if_wm.c rev. 1.610.

Set WUC_APME bit older than PCH. Will fixes PR kern/53945 reported by kardel@.
Tested with my own 82574 card.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.29 -r1.508.4.30 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.29 src/sys/dev/pci/if_wm.c:1.508.4.30
--- src/sys/dev/pci/if_wm.c:1.508.4.29	Thu Jan 31 06:43:48 2019
+++ src/sys/dev/pci/if_wm.c	Mon Feb 11 13:44:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.29 2019/01/31 06:43:48 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.30 2019/02/11 13:44:34 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.29 2019/01/31 06:43:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.30 2019/02/11 13:44:34 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3597,6 +3597,8 @@ wm_rar_count(struct wm_softc *sc)
 		size = WM_RAL_TABSIZE_PCH_LPT;
 		break;
 	case WM_T_82575:
+	case WM_T_I210:
+	case WM_T_I211:
 		size = WM_RAL_TABSIZE_82575;
 		break;
 	case WM_T_82576:
@@ -11895,9 +11897,9 @@ wm_serdes_mediastatus(struct ifnet *ifp,
 		status = CSR_READ(sc, WMREG_STATUS);
 		if (((status & STATUS_2P5_SKU) != 0)
 		&& ((status & STATUS_2P5_SKU_OVER) == 0)) {
-			ifmr->ifm_active |= IFM_2500_SX; /* XXX KX */
+			ifmr->ifm_active |= IFM_2500_KX;
 		} else
-			ifmr->ifm_active |= IFM_1000_SX; /* XXX KX */
+			ifmr->ifm_active |= IFM_1000_KX;
 	} else {
 		switch (__SHIFTOUT(reg, PCS_LSTS_SPEED)) {
 		case PCS_LSTS_SPEED_10:
@@ -14700,7 +14702,7 @@ wm_enable_wakeup(struct wm_softc *sc)
 			goto pme;
 	} else {
 		/* Enable wakeup by the MAC */
-		CSR_WRITE(sc, WMREG_WUC, WUC_PME_EN);
+		CSR_WRITE(sc, WMREG_WUC, WUC_APME | WUC_PME_EN);
 		CSR_WRITE(sc, WMREG_WUFC, WUFC_MAG);
 	}
 



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

2019-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 11 13:38:19 UTC 2019

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

Log Message:
Regen for ticket #1188


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.12 -r1.1281.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.12 -r1.1280.2.13 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2019-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 11 13:34:09 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1360
sys/dev/pci/pcidevs: revision 1.1361
sys/dev/pci/pcidevs: revision 1.1362
sys/dev/pci/pcidevs: revision 1.1357
sys/dev/pci/pcidevs: revision 1.1359

 Add yet another Intel Core QuickPath Generic Non-Core Register.

 Add some RADEON devices. Mainly taken from OpenBSD.

 Add AMD Family 17h devices from OpenBSD.

>From OpenBSD:
- Add NetXen's vendor ID and devices.
- Add Sun Neptune.

- Add Some Freescale MPC834x devices from OpenBSD.

- Add Intel I210 SGMII Flash-less device from the spec update document.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.12 src/sys/dev/pci/pcidevs:1.1289.2.13
--- src/sys/dev/pci/pcidevs:1.1289.2.12	Tue Dec  4 12:02:12 2018
+++ src/sys/dev/pci/pcidevs	Mon Feb 11 13:34:09 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.12 2018/12/04 12:02:12 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.13 2019/02/11 13:34:09 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -657,6 +657,7 @@ vendor HINT		0x3388	HiNT
 vendor 3DLABS		0x3d3d	3D Labs
 vendor AVANCE2		0x4005	Avance Logic (2nd PCI Vendor ID)
 vendor ADDTRON		0x4033	Addtron Technology
+vendor NETXEN		0x4040	NetXen
 vendor QINHENG		0x4348	Nanjing QinHeng Electronics
 vendor ICOMPRESSION	0x	Conexant (iCompression)
 vendor INDCOMPSRC	0x494f	Industrial Computer Source
@@ -1002,6 +1003,24 @@ product AMD F15_30_HB	0x1424	Family15h H
 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_RC	0x1450	Family17h Root Complex
+product AMD F17_IOMMU	0x1451	Family17h IOMMU
+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_HDA	0x1457	Family17h HD Audio
+product AMD F17_XHCI	0x145c	Family17h xHCI
+product AMD F17_XHCI_2	0x145f	Family17h xHCI
+product AMD F17_DF_1	0x1460	Family17h Data Fabric
+product AMD F17_DF_2	0x1461	Family17h Data Fabric
+product AMD F17_DF_3	0x1462	Family17h Data Fabric
+product AMD F17_DF_4	0x1463	Family17h Data Fabric
+product AMD F17_DF_5	0x1464	Family17h Data Fabric
+product AMD F17_DF_6	0x1465	Family17h Data Fabric
+product AMD F17_DF_7	0x1466	Family17h Data Fabric
+product AMD F17_DF_8	0x1467	Family17h Data Fabric
+product AMD F17_PCIE_4	0x1470	Family17h PCIE
+product AMD F17_PCIE_5	0x1471	Family17h PCIE
 product AMD F14_RC	0x1510	Family14h Root Complex
 product AMD F16_HT	0x1530	Family16h HyperTransport Configuration
 product AMD F16_ADDR	0x1531	Family16h Address Map Configuration
@@ -1033,6 +1052,21 @@ product AMD F16_30_DRAM	0x1582	Family16h
 product AMD F16_30_NB	0x1583	Family16h North Bridge Configuration
 product AMD F16_30_CSTATE	0x1584	Family16h CPU C-state Configuration
 product AMD F16_30_MISC	0x1585	Family16h Miscellaneous Configuration
+product AMD F17_1X_RC	0x15d0	Family17h/1xh Root Complex
+product AMD F17_1X_IOMMU 0x15d1	Family17h/1xh IOMMU
+product AMD F17_1X_PCIE_1 0x15d3 Family17h/1xh PCIE
+product AMD F17_1X_PCIE_2 0x15db Family17h/1xh PCIE
+product AMD F17_1X_PCIE_3 0x15dc Family17h/1xh PCIE
+product AMD F17_1X_XHCI_1 0x15e0 Family17h/1xh xHCI
+product AMD F17_1X_XHCI_2 0x15e1 Family17h/1xh xHCI
+product AMD F17_1X_DF_0	0x15e8	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_1	0x15e9	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_2	0x15ea	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_3	0x15eb	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_4	0x15ec	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_5	0x15ed	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_6	0x15ee	Family17h/1xh Data Fabric
+product AMD F17_1X_DF_7	0x15ef	Family17h/1xh Data Fabric
 product AMD F15_HT	0x1600	Family15h HyperTransport Configuration
 product AMD F15_ADDR	0x1601	Family15h Address Map Configuration
 product AMD F15_DRAM	0x1602	Family15h DRAM Configuration
@@ -1576,7 +1610,44 @@ product ATI RADEON_HD8530M	0x6607	Radeon
 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_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_HD6900M	0x6725	Radeon HD 6900M
+product ATI 

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

2019-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb  1 11:25:13 UTC 2019

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

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

sys/dev/pci/ppb.c: revision 1.66
sys/dev/pci/ppb.c: revision 1.67

  Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.

 -

  If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


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

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

Modified files:

Index: src/sys/dev/pci/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.63 src/sys/dev/pci/ppb.c:1.63.2.1
--- src/sys/dev/pci/ppb.c:1.63	Wed May 10 03:24:31 2017
+++ src/sys/dev/pci/ppb.c	Fri Feb  1 11:25:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.63 2017/05/10 03:24:31 msaitoh Exp $	*/
+/*	$NetBSD: ppb.c,v 1.63.2.1 2019/02/01 11:25:13 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.63 2017/05/10 03:24:31 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.63.2.1 2019/02/01 11:25:13 martin Exp $");
 
 #include 
 #include 
@@ -214,6 +214,7 @@ ppbattach(device_t parent, device_t self
 	char intrbuf[PCI_INTRSTR_LEN];
 #endif
 	pcireg_t busdata, reg;
+	bool second_configured = false;
 
 	pci_aprint_devinfo(pa, NULL);
 
@@ -350,6 +351,73 @@ ppbattach(device_t parent, device_t self
 	}
 #endif /* PPB_USEINTR */
 
+	/* Configuration test */
+	if (PPB_BUSINFO_SECONDARY(busdata) != 0) {
+		uint32_t base, limit;
+
+		/* I/O region test */
+		reg = pci_conf_read(pc, pa->pa_tag, PCI_BRIDGE_STATIO_REG);
+		base = (reg & PCI_BRIDGE_STATIO_IOBASE_MASK) << 8;
+		limit = ((reg >> PCI_BRIDGE_STATIO_IOLIMIT_SHIFT)
+		& PCI_BRIDGE_STATIO_IOLIMIT_MASK) << 8;
+		limit |= 0x0fff;
+		if (PCI_BRIDGE_IO_32BITS(reg)) {
+			reg = pci_conf_read(pc, pa->pa_tag,
+			PCI_BRIDGE_IOHIGH_REG);
+			base |= ((reg >> PCI_BRIDGE_IOHIGH_BASE_SHIFT)
+			& 0x) << 16;
+			limit |= ((reg >> PCI_BRIDGE_IOHIGH_LIMIT_SHIFT)
+			& 0x) << 16;
+		}
+		if (base < limit) {
+			second_configured = true;
+			goto configure;
+		}
+
+		/* Non-prefetchable memory region test */
+		reg = pci_conf_read(pc, pa->pa_tag, PCI_BRIDGE_MEMORY_REG);
+		base = ((reg >> PCI_BRIDGE_MEMORY_BASE_SHIFT)
+		& PCI_BRIDGE_MEMORY_BASE_MASK) << 20;
+		limit = (((reg >> PCI_BRIDGE_MEMORY_LIMIT_SHIFT)
+		& PCI_BRIDGE_MEMORY_LIMIT_MASK) << 20) | 0x000f;
+		if (base < limit) {
+			second_configured = true;
+			goto configure;
+		}
+
+		/* Prefetchable memory region test */
+		reg = pci_conf_read(pc, pa->pa_tag,
+		PCI_BRIDGE_PREFETCHMEM_REG);
+		base = ((reg >> PCI_BRIDGE_PREFETCHMEM_BASE_SHIFT)
+		& PCI_BRIDGE_PREFETCHMEM_BASE_MASK) << 20;
+		limit = (((reg >> PCI_BRIDGE_PREFETCHMEM_LIMIT_SHIFT)
+			& PCI_BRIDGE_PREFETCHMEM_LIMIT_MASK) << 20) | 0x000f;
+		if (PCI_BRIDGE_PREFETCHMEM_64BITS(reg)) {
+			reg = pci_conf_read(pc, pa->pa_tag,
+			PCI_BRIDGE_IOHIGH_REG);
+			base |= (uint64_t)pci_conf_read(pc, pa->pa_tag,
+			PCI_BRIDGE_PREFETCHBASE32_REG) << 32;
+			limit |= (uint64_t)pci_conf_read(pc, pa->pa_tag,
+			PCI_BRIDGE_PREFETCHLIMIT32_REG) << 32;
+		}
+		if (base < limit) {
+			second_configured = true;
+			goto configure;
+		}
+	}
+
+configure:
+	/*
+	 * If the secondary bus is configured and the bus mastering is not
+	 * enabled, enable it.
+	 */
+	if (second_configured) {
+		reg = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+		if ((reg & PCI_COMMAND_MASTER_ENABLE) == 0)
+			pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
+			reg | PCI_COMMAND_MASTER_ENABLE);
+	}
+
 	if (!pmf_device_register(self, ppb_suspend, ppb_resume))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 



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

2019-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 31 06:02:50 UTC 2019

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

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

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

  Clearing PCI_PMCSR_PME_STS(W1C) bit is required to stop asserting PME#.

This change would prevent unexpected rebooting from shutdown -p or
unexpected resuming from suspend.


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

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

Modified files:

Index: src/sys/dev/pci/pci.c
diff -u src/sys/dev/pci/pci.c:1.152.6.1 src/sys/dev/pci/pci.c:1.152.6.2
--- src/sys/dev/pci/pci.c:1.152.6.1	Fri Dec  7 13:27:19 2018
+++ src/sys/dev/pci/pci.c	Thu Jan 31 06:02:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.152.6.1 2018/12/07 13:27:19 martin Exp $	*/
+/*	$NetBSD: pci.c,v 1.152.6.2 2019/01/31 06:02:50 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.152.6.1 2018/12/07 13:27:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.152.6.2 2019/01/31 06:02:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1221,16 +1221,36 @@ pci_child_suspend(device_t dv, const pmf
 	return true;
 }
 
+static void
+pci_pme_check_and_clear(device_t dv, pci_chipset_tag_t pc, pcitag_t tag,
+int off)
+{
+	pcireg_t pmcsr;
+
+	pmcsr = pci_conf_read(pc, tag, off + PCI_PMCSR);
+
+	if (pmcsr & PCI_PMCSR_PME_STS) {
+		/* Clear W1C bit */
+		pmcsr |= PCI_PMCSR_PME_STS;
+		pci_conf_write(pc, tag, off + PCI_PMCSR, pmcsr);
+		aprint_verbose_dev(dv, "Clear PME# now\n");
+	}
+}
+
 static bool
 pci_child_resume(device_t dv, const pmf_qual_t *qual)
 {
 	struct pci_child_power *priv = device_pmf_bus_private(dv);
 
-	if (priv->p_has_pm &&
-	pci_set_powerstate_int(priv->p_pc, priv->p_tag,
-	PCI_PMCSR_STATE_D0, priv->p_pm_offset, priv->p_pm_cap)) {
-		aprint_error_dev(dv, "unsupported state, continuing.\n");
-		return false;
+	if (priv->p_has_pm) {
+		if (pci_set_powerstate_int(priv->p_pc, priv->p_tag,
+		PCI_PMCSR_STATE_D0, priv->p_pm_offset, priv->p_pm_cap)) {
+			aprint_error_dev(dv,
+			"unsupported state, continuing.\n");
+			return false;
+		}
+		pci_pme_check_and_clear(dv, priv->p_pc, priv->p_tag,
+		priv->p_pm_offset);
 	}
 
 	pci_conf_restore(priv->p_pc, priv->p_tag, >p_pciconf);
@@ -1286,6 +1306,7 @@ pci_child_register(device_t child)
 		priv->p_has_pm = true;
 		priv->p_pm_offset = off;
 		priv->p_pm_cap = reg;
+		pci_pme_check_and_clear(child, priv->p_pc, priv->p_tag, off);
 	} else {
 		priv->p_has_pm = false;
 		priv->p_pm_offset = -1;



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

2019-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 28 13:03:02 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.168
sys/dev/pci/ixgbe/ixgbe.h: revision 1.52
sys/dev/pci/ixgbe/ixgbe.c: revision 1.172
sys/dev/pci/ixgbe/ixgbe.c: revision 1.173

  Some counters are not per queue but per traffic class. Make new evcnt group
"ixgM tcN" (N = 0..7) and move those counters into it. We are using only
traffic class 0, so we will see only tc0's counter are updated.

 -

  Call ixgbe_init_swfw_semaphore(hw) before calling ixgbe_check_wol_support()
because ixgbe_check_wol_support()->ixgbe_check_wol_support()->
ixgbe_get_device_caps() accesses semaphore.

 -

- Move the location of calling setup_eee() in ixgbe_attach(). The previous
   location was too early. The new location is before calling
   ixgbe_set_phy_power().
- Restore call of setup_eee() in ixgbe_init_locked(). It was removed in
   rev. 1.99 (FreeBSD r320688).
- When calling setup_eee(), pass enable/disable correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.26 -r1.88.2.27 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.14 -r1.24.6.15 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.26 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.27
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.26	Sun Jan 27 18:35:19 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 28 13:03:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.26 2019/01/27 18:35:19 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.27 2019/01/28 13:03:02 martin Exp $ */
 
 /**
 
@@ -873,6 +873,9 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_segs = IXGBE_82598_SCATTER;
 
+	/* Ensure SW/FW semaphore is free */
+	ixgbe_init_swfw_semaphore(hw);
+
 	hw->mac.ops.set_lan_id(hw);
 	ixgbe_init_device_features(adapter);
 
@@ -899,13 +902,6 @@ ixgbe_attach(device_t parent, device_t d
 		ixgbe_check_fan_failure(adapter, esdp, FALSE);
 	}
 
-	/* Ensure SW/FW semaphore is free */
-	ixgbe_init_swfw_semaphore(hw);
-
-	/* Enable EEE power saving */
-	if (adapter->feat_en & IXGBE_FEATURE_EEE)
-		hw->mac.ops.setup_eee(hw, TRUE);
-
 	/* Set an initial default flow control value */
 	hw->fc.requested_mode = ixgbe_flow_control;
 
@@ -1148,6 +1144,11 @@ ixgbe_attach(device_t parent, device_t d
 	/* Enable the optics for 82599 SFP+ fiber */
 	ixgbe_enable_tx_laser(hw);
 
+	/* Enable EEE power saving */
+	if (adapter->feat_cap & IXGBE_FEATURE_EEE)
+		hw->mac.ops.setup_eee(hw,
+		adapter->feat_en & IXGBE_FEATURE_EEE);
+
 	/* Enable power to the phy. */
 	ixgbe_set_phy_power(hw, TRUE);
 
@@ -1535,6 +1536,7 @@ ixgbe_update_stats_counters(struct adapt
 	u32   missed_rx = 0, bprc, lxon, lxoff, total;
 	u64   total_missed_rx = 0;
 	uint64_t  crcerrs, rlec;
+	int		  i, j;
 
 	crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
 	stats->crcerrs.ev_count += crcerrs;
@@ -1545,8 +1547,8 @@ ixgbe_update_stats_counters(struct adapt
 		stats->mbsdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MBSDC);
 
 	/* 16 registers */
-	for (int i = 0; i < __arraycount(stats->qprc); i++) {
-		int j = i % adapter->num_queues;
+	for (i = 0; i < __arraycount(stats->qprc); i++) {
+		j = i % adapter->num_queues;
 
 		stats->qprc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPRC(i));
 		stats->qptc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPTC(i));
@@ -1557,36 +1559,35 @@ ixgbe_update_stats_counters(struct adapt
 	}
 
 	/* 8 registers */
-	for (int i = 0; i < __arraycount(stats->mpc); i++) {
+	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
 		uint32_t mp;
-		int j = i % adapter->num_queues;
 
 		/* MPC */
 		mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
 		/* global total per queue */
-		stats->mpc[j].ev_count += mp;
+		stats->mpc[i].ev_count += mp;
 		/* running comprehensive total for stats display */
 		total_missed_rx += mp;
 
 		if (hw->mac.type == ixgbe_mac_82598EB)
-			stats->rnbc[j].ev_count
+			stats->rnbc[i].ev_count
 			+= IXGBE_READ_REG(hw, IXGBE_RNBC(i));
 
-		stats->pxontxc[j].ev_count
+		stats->pxontxc[i].ev_count
 		+= IXGBE_READ_REG(hw, IXGBE_PXONTXC(i));
-		stats->pxofftxc[j].ev_count
+		stats->pxofftxc[i].ev_count
 		+= IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i));
 		if (hw->mac.type >= ixgbe_mac_82599EB) {
-			stats->pxonrxc[j].ev_count
+			stats->pxonrxc[i].ev_count
 			+= IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i));
-			stats->pxoffrxc[j].ev_count
+			stats->pxoffrxc[i].ev_count
 			+= IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i));
-			stats->pxon2offc[j].ev_count
+			stats->pxon2offc[i].ev_count
 			+= 

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

2019-01-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 27 18:35:20 UTC 2019

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

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

sys/dev/pci/nvme_pci.c: revision 1.26
sys/dev/pci/xhci_pci.c: revision 1.21
sys/dev/pci/ixgbe/ixv.c: revision 1.108
sys/dev/pci/ixgbe/ixgbe.c: revision 1.171
sys/dev/pci/if_fxp_pci.c: revision 1.84
sys/dev/pci/if_fxp_pci.c: revision 1.85
sys/dev/pci/xhci_pci.c: revision 1.16

remove #ifdef DEBUG printf, it seems to have outlived it's usefulness

 -

  KNF. No functional change.

 -

  Nowadays some UEFI BIOSes don't enable some PCI devices' address decoding.
To resolve this problem, pci_map.c rev. 1.34-1.36 changed the
pci_mapreg_(sub)map()'s to set the decode bit if it's not set. It's good for
almost all drivers, but some other drivers don't use pci_mapreg_map().
In drivers which don't use pci_mapreg_map(), some of them explicitly enable
decoding but others don't. Add code to enable decoding to them.

  See also the following discussion:
http://mail-index.netbsd.org/tech-kern/2017/03/22/msg021678.html


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.82.10.1 src/sys/dev/pci/if_fxp_pci.c
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/dev/pci/nvme_pci.c
cvs rdiff -u -r1.8.6.1 -r1.8.6.2 src/sys/dev/pci/xhci_pci.c
cvs rdiff -u -r1.88.2.25 -r1.88.2.26 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.18 -r1.56.2.19 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/if_fxp_pci.c
diff -u src/sys/dev/pci/if_fxp_pci.c:1.82 src/sys/dev/pci/if_fxp_pci.c:1.82.10.1
--- src/sys/dev/pci/if_fxp_pci.c:1.82	Mon Apr 13 16:33:25 2015
+++ src/sys/dev/pci/if_fxp_pci.c	Sun Jan 27 18:35:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fxp_pci.c,v 1.82 2015/04/13 16:33:25 riastradh Exp $	*/
+/*	$NetBSD: if_fxp_pci.c,v 1.82.10.1 2019/01/27 18:35:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.82 2015/04/13 16:33:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.82.10.1 2019/01/27 18:35:19 martin Exp $");
 
 #include 
 #include 
@@ -190,13 +190,13 @@ fxp_pci_lookup(const struct pci_attach_a
 	const struct fxp_pci_product *fpp;
 
 	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL)
-		return (NULL);
+		return NULL;
 
 	for (fpp = fxp_pci_products; fpp->fpp_name != NULL; fpp++)
 		if (PCI_PRODUCT(pa->pa_id) == fpp->fpp_prodid)
-			return (fpp);
+			return fpp;
 
-	return (NULL);
+	return NULL;
 }
 
 static int
@@ -205,9 +205,9 @@ fxp_pci_match(device_t parent, cfdata_t 
 	struct pci_attach_args *pa = aux;
 
 	if (fxp_pci_lookup(pa) != NULL)
-		return (1);
+		return 1;
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -245,8 +245,7 @@ fxp_pci_confreg_restore(struct fxp_pci_s
 	reg = pci_conf_read(psc->psc_pc, psc->psc_tag, PCI_COMMAND_STATUS_REG);
 #endif
 
-	pci_conf_write(psc->psc_pc, psc->psc_tag,
-	PCI_COMMAND_STATUS_REG,
+	pci_conf_write(psc->psc_pc, psc->psc_tag, PCI_COMMAND_STATUS_REG,
 	(reg & 0x) |
 	(psc->psc_regs[PCI_COMMAND_STATUS_REG>>2] & 0x));
 	pci_conf_write(psc->psc_pc, psc->psc_tag, PCI_BHLC_REG,
@@ -303,6 +302,7 @@ fxp_pci_attach(device_t parent, device_t
 	bus_space_handle_t ioh, memh;
 	int ioh_valid, memh_valid;
 	bus_addr_t addr;
+	pcireg_t csr;
 	int flags;
 	int error;
 	char intrbuf[PCI_INTRSTR_LEN];
@@ -312,8 +312,7 @@ fxp_pci_attach(device_t parent, device_t
 	/*
 	 * Map control/status registers.
 	 */
-	ioh_valid = (pci_mapreg_map(pa, FXP_PCI_IOBA,
-	PCI_MAPREG_TYPE_IO, 0,
+	ioh_valid = (pci_mapreg_map(pa, FXP_PCI_IOBA, PCI_MAPREG_TYPE_IO, 0,
 	, , NULL, NULL) == 0);
 
 	/*
@@ -352,6 +351,15 @@ fxp_pci_attach(device_t parent, device_t
 	if (memh_valid) {
 		sc->sc_st = memt;
 		sc->sc_sh = memh;
+		/*
+		 * Enable address decoding for memory range in case BIOS or
+		 * UEFI didn't set it.
+		 */
+		csr = pci_conf_read(pa->pa_pc, pa->pa_tag,
+		PCI_COMMAND_STATUS_REG);
+		csr |= PCI_COMMAND_MEM_ENABLE;
+		pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
+		csr);
 	} else if (ioh_valid) {
 		sc->sc_st = iot;
 		sc->sc_sh = ioh;
@@ -541,5 +549,5 @@ fxp_pci_enable(struct fxp_softc *sc)
 	/* Now restore the configuration registers. */
 	fxp_pci_confreg_restore(psc);
 
-	return (0);
+	return 0;
 }

Index: src/sys/dev/pci/nvme_pci.c
diff -u src/sys/dev/pci/nvme_pci.c:1.19.2.1 src/sys/dev/pci/nvme_pci.c:1.19.2.2
--- src/sys/dev/pci/nvme_pci.c:1.19.2.1	Thu Apr 19 15:37:56 2018
+++ src/sys/dev/pci/nvme_pci.c	Sun Jan 27 18:35:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme_pci.c,v 1.19.2.1 2018/04/19 15:37:56 martin Exp $	*/
+/*	

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

2019-01-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  7 13:49:39 UTC 2019

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

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

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

fix LUN handling (byte order issue)

now ch0 on a NEOSeries FlexStor II is detected again on LUN 1
this is a regression introduced in 1.15 update and 1.8.10.3 pullup

Tested with NEOSeries FlexStor II:
mpii0 at pci1 dev 0 function 0: vendor 1000 product 00ab (rev. 0x01)
mpii0: interrupting at irq 11
mpii0: HBA 9400-8i8e, firmware 3.0.4.0, MPI 2.6
mpii0: physical disk inserted in slot 9
mpii0: physical disk inserted in slot 13
mpii0: physical disk inserted in slot 16
st0 at scsibus0 target 9 lun 0:  tape removable
st0: drive empty
st0: tagged queueing
st1 at scsibus0 target 13 lun 0:  tape removable
st1: drive empty
ch0 at scsibus0 target 13 lun 1:  changer removable
ch0: 23 slots, 2 drives, 1 picker, 1 portal
st1: tagged queueing
ch0: tagged queueing
ses0 at scsibus0 target 16 lun 0:  enclosure
services fixed
ses0: SCSI-3 SES Device


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.3 -r1.8.10.4 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.3 src/sys/dev/pci/mpii.c:1.8.10.4
--- src/sys/dev/pci/mpii.c:1.8.10.3	Sat Dec  8 12:17:13 2018
+++ src/sys/dev/pci/mpii.c	Mon Jan  7 13:49:39 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.3 2018/12/08 12:17:13 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.4 2019/01/07 13:49:39 martin Exp $ */
 /*	OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.3 2018/12/08 12:17:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.4 2019/01/07 13:49:39 martin Exp $");
 
 #include "bio.h"
 
@@ -3035,7 +3035,7 @@ mpii_scsipi_request(struct scsipi_channe
 	io->sgl_offset0 = sizeof(struct mpii_msg_scsi_io) / 4;
 	io->io_flags = htole16(xs->cmdlen);
 	io->dev_handle = htole16(ccb->ccb_dev_handle);
-	io->lun[0] = htole16(periph->periph_lun);
+	io->lun[0] = htobe16(periph->periph_lun);
 
 	switch (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
 	case XS_CTL_DATA_IN:



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

2018-12-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 20 11:34:33 UTC 2018

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

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

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

Apply the same fix as if_wm.c:r1.606 to ixg(4). Pointed out by msaitoh@n.o, 
thanks.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.13 -r1.24.2.14 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.13 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.14
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.13	Fri Sep  7 12:37:20 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Dec 20 11:34:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.13 2018/09/07 12:37:20 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.14 2018/12/20 11:34:33 martin Exp $ */
 
 /**
 
@@ -230,7 +230,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 			i = m->m_pkthdr.flowid % adapter->num_queues;
 	} else
 #endif /* 0 */
-		i = cpu_index(curcpu()) % adapter->num_queues;
+		i = (cpu_index(curcpu()) % ncpu) % adapter->num_queues;
 
 	/* Check for a hung queue and pick alternative */
 	if (((1 << i) & adapter->active_queues) == 0)



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

2018-12-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 18 18:26:23 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by is in ticket #1139):

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

add AHCI_PCI_QUIRK_FORCE for apu2 to be recognized; patch by Mike Pumford
on current-users@


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

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

Modified files:

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



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

2018-12-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 18 18:24:09 UTC 2018

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

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

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

Fix txqueue assignment. Pointed out by yamaguchi@n.o, thanks.

E.g. When ncpu is six and nqueue is four, the sequence error occurs.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.27 -r1.508.4.28 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.27 src/sys/dev/pci/if_wm.c:1.508.4.28
--- src/sys/dev/pci/if_wm.c:1.508.4.27	Tue Dec  4 11:21:32 2018
+++ src/sys/dev/pci/if_wm.c	Tue Dec 18 18:24:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.27 2018/12/04 11:21:32 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.28 2018/12/18 18:24:09 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.27 2018/12/04 11:21:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.28 2018/12/18 18:24:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -7211,7 +7211,7 @@ wm_select_txqueue(struct ifnet *ifp, str
 	 * TODO:
 	 * distribute by flowid(RSS has value).
 	 */
-	return (cpuid + ncpu - sc->sc_affinity_offset) % sc->sc_nqueues;
+	return ((cpuid + ncpu - sc->sc_affinity_offset) % ncpu) % sc->sc_nqueues;
 }
 
 /*



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

2018-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec  8 12:10:22 UTC 2018

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

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

sys/dev/pci/if_bge.c: revision 1.320
sys/dev/pci/if_bgevar.h: revision 1.24
sys/dev/pci/if_bge.c: revision 1.317
sys/dev/pci/if_bgereg.h: revision 1.94

More TSO4 fixes, from the freebsd driver:
- the chip doens't want the lenght of options, but the complete lenght of
  ip headers (ip + tcp + options). Fix this for the BGE_IS_5717_PLUS()
  and BGE_IS_5705_PLUS() cases; FreeBSD doens't cover the last case so
  leave it as is for now. This fixes checksum failures for heavy transfers.
- It looks like the transmit engine hangs if the TCP segment crosses a 4GB
  boundary. FreeBSD fixes it by mapping everything below 4GB; instead
  try detect when this happens and do the bounce only when needed.

With these fixes I could transfers 3GB images over ftp at gigabit speed
(112MB/s with wget) without problems. Tested on a
bge0 at pci4 dev 0 function 0: Broadcom BCM5720 Gigabit Ethernet
bge0: APE firmware NCSI 1.4.22.0
bge0: interrupting at msi1 vec 0
bge0: HW config 002b1194, 6014, 0002aa38,  000c
bge0: ASIC BCM5720 A0 (0x572), Ethernet address d0:94:66:8b:9c:18
bge0: setting short Tx thresholds
brgphy0 at bge0 phy 1: BCM5720C 1000BASE-T media interface, rev. 0

 -

Don't destroy the dma maps if we're not disabling the adapter, avoids
a KASSERT() when bus_dmamap_destroy() is called from interrupt
context via bge_watchdog()

Set IFF_OACTIVE only when bge_encap() fails on adapter ressource shortage.
Otherwise we may set IFF_OACTIVE while no transmit is in progress, and
nothing will clear it.

If bus_dmamap_load_mbuf() fails with EFBIG, m_defrag() the chain and retry.
Refine the check for the 4GB boundary workaround (a fragment should also
not cross the boundary), and do it only for TSO.

If bge_encap() fails and didn't set IFF_OACTIVE, drop the packet.

Bring in more hardware bug workarounds from freebsd.

With these it seems that a BCM5720 A0 can survive a few hours of internet
load with TSO4 enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.310.2.3 -r1.310.2.4 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.93 -r1.93.4.1 src/sys/dev/pci/if_bgereg.h
cvs rdiff -u -r1.23 -r1.23.4.1 src/sys/dev/pci/if_bgevar.h

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.310.2.3 src/sys/dev/pci/if_bge.c:1.310.2.4
--- src/sys/dev/pci/if_bge.c:1.310.2.3	Mon Nov 26 17:22:32 2018
+++ src/sys/dev/pci/if_bge.c	Sat Dec  8 12:10:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.310.2.3 2018/11/26 17:22:32 snj Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.310.2.4 2018/12/08 12:10:22 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.3 2018/11/26 17:22:32 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.4 2018/12/08 12:10:22 martin Exp $");
 
 #include 
 #include 
@@ -233,10 +233,10 @@ static int bge_newbuf_std(struct bge_sof
 			   bus_dmamap_t);
 static int bge_newbuf_jumbo(struct bge_softc *, int, struct mbuf *);
 static int bge_init_rx_ring_std(struct bge_softc *);
-static void bge_free_rx_ring_std(struct bge_softc *);
+static void bge_free_rx_ring_std(struct bge_softc *m, bool);
 static int bge_init_rx_ring_jumbo(struct bge_softc *);
 static void bge_free_rx_ring_jumbo(struct bge_softc *);
-static void bge_free_tx_ring(struct bge_softc *);
+static void bge_free_tx_ring(struct bge_softc *m, bool);
 static int bge_init_tx_ring(struct bge_softc *);
 
 static int bge_chipinit(struct bge_softc *);
@@ -1713,6 +1713,9 @@ bge_newbuf_std(struct bge_softc *sc, int
 	struct bge_rx_bd	*r;
 	int			error;
 
+	if (dmamap == NULL)
+		dmamap = sc->bge_cdata.bge_rx_std_map[i];
+
 	if (dmamap == NULL) {
 		error = bus_dmamap_create(sc->bge_dmatag, MCLBYTES, 1,
 		MCLBYTES, 0, BUS_DMA_NOWAIT, );
@@ -1852,7 +1855,7 @@ bge_init_rx_ring_std(struct bge_softc *s
 }
 
 static void
-bge_free_rx_ring_std(struct bge_softc *sc)
+bge_free_rx_ring_std(struct bge_softc *sc, bool disable)
 {
 	int i;
 
@@ -1863,8 +1866,11 @@ bge_free_rx_ring_std(struct bge_softc *s
 		if (sc->bge_cdata.bge_rx_std_chain[i] != NULL) {
 			m_freem(sc->bge_cdata.bge_rx_std_chain[i]);
 			sc->bge_cdata.bge_rx_std_chain[i] = NULL;
-			bus_dmamap_destroy(sc->bge_dmatag,
-			sc->bge_cdata.bge_rx_std_map[i]);
+			if (disable) {
+bus_dmamap_destroy(sc->bge_dmatag,
+sc->bge_cdata.bge_rx_std_map[i]);
+sc->bge_cdata.bge_rx_std_map[i] = NULL;
+			}
 		}
 		memset((char *)>bge_rdata->bge_rx_std_ring[i], 0,
 		sizeof(struct bge_rx_bd));
@@ -1920,7 +1926,7 @@ bge_free_rx_ring_jumbo(struct bge_softc 
 }
 
 static void

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

2018-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  7 13:27:19 UTC 2018

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

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

sys/dev/pci/pcivar.h: revision 1.113
sys/dev/pci/pci.c: revision 1.153

  Save control registers in PCI-X, PCIe, MSI and MSI-X capability area when
suspend and restore them when resume. For PCIe capabilities register, it's
required to check the existence of each register to not to write the next area.

  This change fixes a stability of suspend/resume.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.152.6.1 src/sys/dev/pci/pci.c
cvs rdiff -u -r1.109.8.1 -r1.109.8.2 src/sys/dev/pci/pcivar.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.c
diff -u src/sys/dev/pci/pci.c:1.152 src/sys/dev/pci/pci.c:1.152.6.1
--- src/sys/dev/pci/pci.c:1.152	Wed Apr  5 04:04:54 2017
+++ src/sys/dev/pci/pci.c	Fri Dec  7 13:27:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.152 2017/04/05 04:04:54 msaitoh Exp $	*/
+/*	$NetBSD: pci.c,v 1.152.6.1 2018/12/07 13:27:19 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.152 2017/04/05 04:04:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.152.6.1 2018/12/07 13:27:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -881,7 +881,70 @@ pci_conf_capture(pci_chipset_tag_t pc, p
 	for (off = 0; off < 16; off++)
 		pcs->reg[off] = pci_conf_read(pc, tag, (off * 4));
 
-	return;
+	/* For PCI-X */
+	if (pci_get_capability(pc, tag, PCI_CAP_PCIX, , NULL) != 0)
+		pcs->x_csr = pci_conf_read(pc, tag, off + PCIX_CMD);
+
+	/* For PCIe */
+	if (pci_get_capability(pc, tag, PCI_CAP_PCIEXPRESS, , NULL) != 0) {
+		pcireg_t xcap = pci_conf_read(pc, tag, off + PCIE_XCAP);
+		unsigned int devtype;
+
+		devtype = PCIE_XCAP_TYPE(xcap);
+		pcs->e_dcr = (uint16_t)pci_conf_read(pc, tag, off + PCIE_DCSR);
+
+		if (PCIE_HAS_LINKREGS(devtype))
+			pcs->e_lcr = (uint16_t)pci_conf_read(pc, tag,
+			off + PCIE_LCSR);
+
+		if ((xcap & PCIE_XCAP_SI) != 0)
+			pcs->e_slcr = (uint16_t)pci_conf_read(pc, tag,
+			off + PCIE_SLCSR);
+
+		if (PCIE_HAS_ROOTREGS(devtype))
+			pcs->e_rcr = (uint16_t)pci_conf_read(pc, tag,
+			off + PCIE_RCR);
+
+		if (__SHIFTOUT(xcap, PCIE_XCAP_VER_MASK) >= 2) {
+			pcs->e_dcr2 = (uint16_t)pci_conf_read(pc, tag,
+			off + PCIE_DCSR2);
+
+			if (PCIE_HAS_LINKREGS(devtype))
+pcs->e_lcr2 = (uint16_t)pci_conf_read(pc, tag,
+			off + PCIE_LCSR2);
+
+			/* XXX PCIE_SLCSR2 (It's reserved by the PCIe spec) */
+		}
+	}
+
+	/* For MSI */
+	if (pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL) != 0) {
+		bool bit64, pvmask;
+		
+		pcs->msi_ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL);
+
+		bit64 = pcs->msi_ctl & PCI_MSI_CTL_64BIT_ADDR;
+		pvmask = pcs->msi_ctl & PCI_MSI_CTL_PERVEC_MASK;
+
+		/* Address */
+		pcs->msi_maddr = pci_conf_read(pc, tag, off + PCI_MSI_MADDR);
+		if (bit64)
+			pcs->msi_maddr64_hi = pci_conf_read(pc, tag,
+			off + PCI_MSI_MADDR64_HI);
+
+		/* Data */
+		pcs->msi_mdata = pci_conf_read(pc, tag,
+		off + (bit64 ? PCI_MSI_MDATA64 : PCI_MSI_MDATA));
+
+		/* Per-vector masking */
+		if (pvmask)
+			pcs->msi_mask = pci_conf_read(pc, tag,
+			off + (bit64 ? PCI_MSI_MASK64 : PCI_MSI_MASK));
+	}
+
+	/* For MSI-X */
+	if (pci_get_capability(pc, tag, PCI_CAP_MSIX, , NULL) != 0)
+		pcs->msix_ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
 }
 
 void
@@ -897,7 +960,80 @@ pci_conf_restore(pci_chipset_tag_t pc, p
 			pci_conf_write(pc, tag, (off * 4), pcs->reg[off]);
 	}
 
-	return;
+	/* For PCI-X */
+	if (pci_get_capability(pc, tag, PCI_CAP_PCIX, , NULL) != 0)
+		pci_conf_write(pc, tag, off + PCIX_CMD, pcs->x_csr);
+
+	/* For PCIe */
+	if (pci_get_capability(pc, tag, PCI_CAP_PCIEXPRESS, , NULL) != 0) {
+		pcireg_t xcap = pci_conf_read(pc, tag, off + PCIE_XCAP);
+		unsigned int devtype;
+
+		devtype = PCIE_XCAP_TYPE(xcap);
+		pci_conf_write(pc, tag, off + PCIE_DCSR, pcs->e_dcr);
+
+		/*
+		 * PCIe capability is variable sized. To not to write the next
+		 * area, check the existence of each register.
+		 */
+		if (PCIE_HAS_LINKREGS(devtype))
+			pci_conf_write(pc, tag, off + PCIE_LCSR, pcs->e_lcr);
+
+		if ((xcap & PCIE_XCAP_SI) != 0)
+			pci_conf_write(pc, tag, off + PCIE_SLCSR, pcs->e_slcr);
+
+		if (PCIE_HAS_ROOTREGS(devtype))
+			pci_conf_write(pc, tag, off + PCIE_RCR, pcs->e_rcr);
+
+		if (__SHIFTOUT(xcap, PCIE_XCAP_VER_MASK) >= 2) {
+			pci_conf_write(pc, tag, off + PCIE_DCSR2, pcs->e_dcr2);
+
+			if (PCIE_HAS_LINKREGS(devtype))
+pci_conf_write(pc, tag, off + PCIE_LCSR2,
+pcs->e_lcr2);
+
+			/* XXX PCIE_SLCSR2 (It's reserved by the PCIe spec) */
+		}
+	}
+
+	/* For MSI */
+	if (pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL) != 0) {
+		pcireg_t reg;
+		bool 

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

2018-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  4 12:04:02 UTC 2018

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

Log Message:
Regen for ticket #1123


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.11 -r1.1281.2.12 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.11 -r1.1280.2.12 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1281.2.11 src/sys/dev/pci/pcidevs.h:1.1281.2.12
--- src/sys/dev/pci/pcidevs.h:1.1281.2.11	Tue Dec  4 11:43:54 2018
+++ src/sys/dev/pci/pcidevs.h	Tue Dec  4 12:03:43 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1281.2.11 2018/12/04 11:43:54 martin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1281.2.12 2018/12/04 12:03:43 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1289.2.11 2018/12/04 11:34:59 martin Exp
+ *	NetBSD: pcidevs,v 1.1289.2.12 2018/12/04 12:02:12 martin Exp
  */
 
 /*
@@ -5842,9 +5842,11 @@
 #define	PCI_PRODUCT_SYMBIOS_SAS3108_4	0x0095		/* SAS3108 */
 #define	PCI_PRODUCT_SYMBIOS_SAS3004	0x0096		/* SAS3004 */
 #define	PCI_PRODUCT_SYMBIOS_SAS3008	0x0097		/* SAS3008 */
-#define	PCI_PRODUCT_SYMBIOS_SAS3516	0x00ab		/* SAS3516 */
+#define	PCI_PRODUCT_SYMBIOS_SAS3516	0x00aa		/* SAS3516 */
+#define	PCI_PRODUCT_SYMBIOS_SAS3516_1	0x00ab		/* SAS3516 */
 #define	PCI_PRODUCT_SYMBIOS_SAS3416	0x00ac		/* SAS3416 */
-#define	PCI_PRODUCT_SYMBIOS_SAS3508	0x00ae		/* SAS3508 */
+#define	PCI_PRODUCT_SYMBIOS_SAS3508	0x00ad		/* SAS3508 */
+#define	PCI_PRODUCT_SYMBIOS_SAS3508_1	0x00ae		/* SAS3508 */
 #define	PCI_PRODUCT_SYMBIOS_SAS3408	0x00af		/* SAS3408 */
 #define	PCI_PRODUCT_SYMBIOS_SAS3504	0x00be		/* SAS3504 */
 #define	PCI_PRODUCT_SYMBIOS_SAS3404	0x00bf		/* SAS3404 */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1280.2.11 src/sys/dev/pci/pcidevs_data.h:1.1280.2.12
--- src/sys/dev/pci/pcidevs_data.h:1.1280.2.11	Tue Dec  4 11:43:54 2018
+++ src/sys/dev/pci/pcidevs_data.h	Tue Dec  4 12:03:43 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1280.2.11 2018/12/04 11:43:54 martin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1280.2.12 2018/12/04 12:03:43 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1289.2.11 2018/12/04 11:34:59 martin Exp
+ *	NetBSD: pcidevs,v 1.1289.2.12 2018/12/04 12:02:12 martin Exp
  */
 
 /*
@@ -10214,10 +10214,14 @@ static const uint16_t pci_products[] = {
 	27572, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3516, 
 	27388, 0,
+	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3516_1, 
+	27388, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3416, 
 	27396, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3508, 
 	27404, 0,
+	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3508_1, 
+	27404, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3408, 
 	27412, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS3504, 
@@ -17145,9 +17149,9 @@ static const char pci_words[] = { "." 
 	"53c1510\0" /* 1 refs @ 27364 */
 	"53c895A\0" /* 1 refs @ 27372 */
 	"53c875A\0" /* 1 refs @ 27380 */
-	"SAS3516\0" /* 2 refs @ 27388 */
+	"SAS3516\0" /* 3 refs @ 27388 */
 	"SAS3416\0" /* 2 refs @ 27396 */
-	"SAS3508\0" /* 2 refs @ 27404 */
+	"SAS3508\0" /* 3 refs @ 27404 */
 	"SAS3408\0" /* 2 refs @ 27412 */
 	"SAS3504\0" /* 2 refs @ 27420 */
 	"SAS3404\0" /* 2 refs @ 27428 */



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

2018-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  4 12:02:12 UTC 2018

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

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

sys/dev/pci/pcidevs: revision 1.1356

Add 2 Symbios products, from OpenBSD


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.11 src/sys/dev/pci/pcidevs:1.1289.2.12
--- src/sys/dev/pci/pcidevs:1.1289.2.11	Tue Dec  4 11:34:59 2018
+++ src/sys/dev/pci/pcidevs	Tue Dec  4 12:02:12 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.11 2018/12/04 11:34:59 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.12 2018/12/04 12:02:12 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5835,9 +5835,11 @@ product SYMBIOS SAS3108_3		0x0094	SAS310
 product SYMBIOS SAS3108_4		0x0095	SAS3108
 product SYMBIOS SAS3004			0x0096	SAS3004
 product SYMBIOS SAS3008			0x0097	SAS3008
-product	SYMBIOS	SAS3516			0x00ab	SAS3516
+product SYMBIOS SAS3516			0x00aa  SAS3516
+product	SYMBIOS	SAS3516_1		0x00ab	SAS3516
 product	SYMBIOS	SAS3416			0x00ac	SAS3416
-product	SYMBIOS	SAS3508			0x00ae	SAS3508
+product	SYMBIOS	SAS3508			0x00ad	SAS3508
+product SYMBIOS SAS3508_1		0x00ae  SAS3508
 product	SYMBIOS	SAS3408			0x00af	SAS3408
 product	SYMBIOS	SAS3504			0x00be	SAS3504
 product	SYMBIOS	SAS3404			0x00bf	SAS3404



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

2018-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  4 11:44:13 UTC 2018

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

Log Message:
Regen for #1119


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.10 -r1.1281.2.11 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.10 -r1.1280.2.11 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2018-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  4 11:35:00 UTC 2018

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

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

sys/dev/pci/pcidevs: revision 1.1350
sys/dev/pci/pcidevs: revision 1.1351
sys/dev/pci/pcidevs: revision 1.1352
sys/dev/pci/pcidevs: revision 1.1353
sys/dev/pci/pcidevs: revision 1.1354
sys/dev/pci/pcidevs: revision 1.1355
sys/dev/pci/pcidevs: revision 1.1345
sys/dev/pci/pcidevs: revision 1.1346
sys/dev/pci/pcidevs: revision 1.1347
sys/dev/pci/pcidevs: revision 1.1349

  Add some Intel devices. Some of them are found in Core i7-8550U.

  Add Toshiba's XG4 and XG5 NVMe SSD.

- Add C62x to the descriptions of Intel C620 series devices.
- Add 0xa1ca for Intel C629 LPC or eSPI.

Add AMD Seattle Host Bridge and PCIE root port devices

Add two otehr I2C devices of Intel.

"s/ are are / are /" in comment. No functional change.

Add some Intel 100 series and C230 series devices.

Add a whole bunch of Cavium ThunderX devices

Add Rockchip vendor ID and a device. Requested by jak@
 From OpenBSD

Add Amazon.com UART, NVMe, and ENA PCI IDs.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.10 src/sys/dev/pci/pcidevs:1.1289.2.11
--- src/sys/dev/pci/pcidevs:1.1289.2.10	Wed Oct 17 13:45:31 2018
+++ src/sys/dev/pci/pcidevs	Tue Dec  4 11:34:59 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.10 2018/10/17 13:45:31 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.11 2018/12/04 11:34:59 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -649,6 +649,8 @@ vendor QINHENG2		0x1c00	Nanjing QinHeng 
 vendor SYMPHONY2	0x1c1c	Symphony Labs (2nd PCI Vendor ID)
 vendor HGST		0x1c58	HGST, Inc.
 vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
+vendor AMAZON		0x1d0f	Amazon.com, Inc.
+vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
@@ -953,6 +955,11 @@ product ALTIMA AC1001	0x03e9	AC1001 Giga
 product ALTIMA AC9100	0x03ea	AC9100 Gigabit Ethernet
 product ALTIMA AC1003	0x03eb	AC1003 Gigabit Ethernet
 
+/* Amazon.com, Inc. products */
+product AMAZON UART	0x8250	16650-compatible UART
+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
@@ -1042,6 +1049,9 @@ product AMD F12_GPP0	0x1709	Family12h GP
 product AMD F14_MISC	0x1716	Family12h/14h Misc. Configuration
 product AMD F14_HB18	0x1718	Family12h/14h Host Bridge
 product AMD F14_HB19	0x1719	Family12h/14h Host Bridge
+product AMD SEATTLE_PCHB_1	0x1a00	Seattle Host Bridge
+product AMD SEATTLE_PCHB_2	0x1a01	Seattle Host Bridge
+product AMD SEATTLE_PCIE	0x1a02	Seattle PCIE Root Port
 product AMD PCNET_PCI	0x2000	PCnet-PCI Ethernet
 product AMD PCNET_HOME	0x2001	PCnet-Home HomePNA Ethernet
 product AMD AM_1771_MBW	0x2003	Alchemy AM 1771 MBW
@@ -1932,7 +1942,58 @@ product BUSLOGIC FLASHPOINT	0x8130	Flash
 product C4T GPPCI		0x6773	GPPCI
 
 /* Cavium products */
-product CAVIUM NITROX		0x0001	Nitrox XL
+product CAVIUM NITROX			0x0001	Nitrox XL
+product CAVIUM THUNDERX_MRML		0xa001	Master RML Bridge to RSL devices
+product CAVIUM THUNDERX_PCIB		0xa002	PCI Bridge
+product CAVIUM THUNDERX_RESET		0xa00e	Reset Controller
+product CAVIUM THUNDERX_RNG		0xa018	Random Number Generator
+product CAVIUM THUNDERX_XHCI		0xa01b	xHCI USB Controller
+product CAVIUM THUNDERX_AHCI		0xa01c	AHCI SATA Controller
+product CAVIUM THUNDERX_RAID		0xa01d	RAID Coprocessor
+product CAVIUM THUNDERX_NIC		0xa01e	Network Interface Controller
+product CAVIUM THUNDERX_TNS		0xa01f	Traffic Network Switch
+product CAVIUM THUNDERX_LMC		0xa022	DRAM Controller
+product CAVIUM THUNDERX_BGX		0xa026	Common Ethernet Interface
+product CAVIUM THUNDERX_L2C_TAD		0xa02e	Level 2 cache tag and data
+product CAVIUM THUNDERX_L2C_CBC		0xa02f	L2C-CBC
+product CAVIUM THUNDERX_L2C_MCI		0xa030	L2C-MCI
+
+product CAVIUM THUNDERX_SMMU		0xa008	SMMU
+product CAVIUM THUNDERX_GIC		0xa009	Generic Interrupt Controller
+product CAVIUM THUNDERX_GPIO		0xa00a	GPIO Controller
+product CAVIUM THUNDERX_MPI_SPI		0xa00b	MPI / SPI Controller
+product CAVIUM THUNDERX_MIO_PTP		0xa00c	MIO-PTP Controller
+product CAVIUM THUNDERX_MIX		0xa00d	MIX Network Controller
+product CAVIUM THUNDERX_UART		0xa00f	UART Controller
+product CAVIUM THUNDERX_EMMC_SD		0xa010	eMMC/SD Controller
+product CAVIUM THUNDERX_MIO_BOOT	0xa011	MIO-BOOT Controller
+product CAVIUM THUNDERX_TWSI_I2C	0xa012	TWSI / I2C 

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

2018-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  4 11:29:41 UTC 2018

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

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

sys/dev/pci/pci_subr.c: revision 1.210
sys/dev/pci/pci_subr.c: revision 1.207
sys/dev/pci/pcireg.h: revision 1.143
sys/dev/pci/pci_subr.c: revision 1.208
sys/dev/pci/pcireg.h: revision 1.144
sys/dev/pci/pci_subr.c: revision 1.209
sys/dev/pci/pcireg.h: revision 1.145
sys/dev/pci/pcireg.h: revision 1.146

  Decode PCI Enhanced Allocation.

  The register offset of the mask and pending register is depend on the 64bit
address capable bit, so fix the definition of PCI MSI vector mask and pending
register. This problem was not a real bug because PCI_MSI{MASK,PENDING} were
not used from anywhere.

  The downstream port of PCIe switch is not a root port, so don't print
root port related register. For example, Intel 63xxESB controller's
downstream port device was printed by pcictl(8) with this bug:

-
PCI configuration registers:
   Common header:
 0x00: 0x35108086 0x00100147 0x06040001 0x00010010
 Vendor Name: Intel (0x8086)
 Device Name: 63xxESB PCI Express Downstream Port #1 (0x3510)
(snip)
   Capability register at 0x44   <=
 type: 0x10 (PCI Express)
   Capability register at 0x60   <= 0x60 - 0x44 = 0x1c
 type: 0x05 (MSI)
   Capability register at 0x70
 type: 0x01 (Power Management)
   Capability register at 0x80
 type: 0x0d (Subsystem vendor ID)
(snip)
   PCI Message Signaled Interrupt
 Message Control register: 0x0080
   MSI Enabled: off
   Multiple Message Capable: no (1 vector)
   Multiple Message Enabled: off (1 vector)
   64 Bit Address Capable: on
   Per-Vector Masking Capable: off
   Extended Message Data Capable: off
   Extended Message Data Enable: off
 Message Address (lower) register: 0x
 Message Address (upper) register: 0x
 Message Data register: 0x
(snip)
   PCI Express Capabilities Register
(snip)
 Root Control Register: 0x7005  <=== 0x7005 is the first two byte
   SERR on Correctable Error Enable: on   of the MSI capability structure
   SERR on Non-Fatal Error Enable: off
   SERR on Fatal Error Enable: on
   PME Interrupt Enable: off
   CRS Software Visibility Enable: off
 Root Capability Register: 0x0080
   CRS Software Visibility: off
 Root Status Register: 0x
   PME Requester ID: 0x
   PME was asserted: off
   another PME is pending: off
   Device-dependent header:
 0x40: 0x00c0 0x00616010 0x0001 0x5026  |   |<- PCIe  |
 0x50: 0x0203f441 0x10010020 0x 0x004803c0  |   ->|
 0x60: 0x00807005 0x 0x 0x  |<- MSI ->|
 0x70: 0xc8028001 0x0100 0x 0x  |<- PM  ->|
 0x80: 0x000d 0x 0x 0x  |<- subsystem ID  |
--

  Add new macro PCIE_HAS_ROOTREGS(pcie_devtype) and use it. No functional
change.

  Add new PCIE_HAS_LINKREGS(pcie_devtype) and use it. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.8 -r1.183.2.9 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.7 -r1.130.2.8 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.8 src/sys/dev/pci/pci_subr.c:1.183.2.9
--- src/sys/dev/pci/pci_subr.c:1.183.2.8	Tue Oct 30 09:32:32 2018
+++ src/sys/dev/pci/pci_subr.c	Tue Dec  4 11:29:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.8 2018/10/30 09:32:32 sborrill Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.9 2018/12/04 11:29:41 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.8 2018/10/30 09:32:32 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.9 2018/12/04 11:29:41 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1756,9 +1756,8 @@ pci_conf_print_pcie_cap(const pcireg_t *
 {
 	pcireg_t reg; /* for each register */
 	pcireg_t val; /* for each bitfield */
-	bool check_link = true;
 	bool check_slot = false;
-	bool check_rootport = false;
+	unsigned int pcie_devtype;
 	bool check_upstreamport = false;
 	unsigned int pciever;
 	unsigned int i;
@@ -1770,7 +1769,8 @@ pci_conf_print_pcie_cap(const pcireg_t *
 	pciever = (unsigned int)(PCIE_XCAP_VER(reg));
 	printf("  Capability version: %u\n", pciever);
 	printf("  Device type: ");
-	switch (PCIE_XCAP_TYPE(reg)) {
+	pcie_devtype = PCIE_XCAP_TYPE(reg);
+	switch (pcie_devtype) {
 	case 

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

2018-11-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Nov 26 17:24:51 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1108):
sys/dev/pci/if_wm.c: revision 1.599
- Fix a bug that i82578 PHY can't detect correctly.
- Print PHY OUI and model number if a PHY's can't be identified.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.25 -r1.508.4.26 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.25 src/sys/dev/pci/if_wm.c:1.508.4.26
--- src/sys/dev/pci/if_wm.c:1.508.4.25	Thu Nov  8 12:09:18 2018
+++ src/sys/dev/pci/if_wm.c	Mon Nov 26 17:24:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.25 2018/11/08 12:09:18 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.26 2018/11/26 17:24:51 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.25 2018/11/08 12:09:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.26 2018/11/26 17:24:51 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9534,7 +9534,7 @@ wm_gmii_setup_phytype(struct wm_softc *s
 	} else {
 		/* It's not the first call. Use PHY OUI and model */
 		switch (phy_oui) {
-		case MII_OUI_ATHEROS: /* XXX ??? */
+		case MII_OUI_ATTANSIC: /* XXX ??? */
 			switch (phy_model) {
 			case 0x0004: /* XXX */
 new_phytype = WMPHY_82578;
@@ -9611,8 +9611,9 @@ wm_gmii_setup_phytype(struct wm_softc *s
 			break;
 		}
 		if (new_phytype == WMPHY_UNKNOWN)
-			aprint_verbose_dev(dev, "%s: unknown PHY model\n",
-			__func__);
+			aprint_verbose_dev(dev,
+			"%s: unknown PHY model. OUI=%06x, model=%04x\n",
+			__func__, phy_oui, phy_model);
 
 		if ((sc->sc_phytype != WMPHY_UNKNOWN)
 		&& (sc->sc_phytype != new_phytype )) {



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

2018-11-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Nov 26 17:22:32 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1107):
sys/dev/pci/if_bge.c: revision 1.316
5717 and newer handle TSO in a sighly different way. From FreeBSD.
While there, use different lowat/hiwat values if MTU is larger than ETHERMTU,
from FreeBSD.
Tested at LIP6 on a
bge0 at pci4 dev 0 function 0: Broadcom BCM5720 Gigabit Ethernet
bge0: APE firmware NCSI 1.4.22.0
bge0: interrupting at msi1 vec 0
bge0: HW config 002b1194, 6014, 0002aa38,  000c
bge0: ASIC BCM5720 A0 (0x572), Ethernet address d0:94:66:8b:9c:18
bge0: setting short Tx thresholds
brgphy0 at bge0 phy 1: BCM5720C 1000BASE-T media interface, rev. 0
with all ipv4 checksums and TSO4 enabled.


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

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.310.2.2 src/sys/dev/pci/if_bge.c:1.310.2.3
--- src/sys/dev/pci/if_bge.c:1.310.2.2	Fri Nov 24 08:39:09 2017
+++ src/sys/dev/pci/if_bge.c	Mon Nov 26 17:22:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.310.2.2 2017/11/24 08:39:09 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.310.2.3 2018/11/26 17:22:32 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.2 2017/11/24 08:39:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.310.2.3 2018/11/26 17:22:32 snj Exp $");
 
 #include 
 #include 
@@ -2555,8 +2555,13 @@ bge_blockinit(struct bge_softc *sc)
 	 */
 	if (BGE_IS_5717_PLUS(sc)) {
 		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
-		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a);
-		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0);
+		if (ifp->if_mtu > ETHERMTU) {
+			CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e);
+			CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xea);
+		} else {
+			CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a);
+			CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0);
+		}
 	} else if (BGE_IS_5705_PLUS(sc)) {
 		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
 
@@ -3060,8 +3065,11 @@ bge_blockinit(struct bge_softc *sc)
 		if (ifp->if_mtu <= ETHERMTU)
 			val |= BGE_RDMAMODE_JMB_2K_MMRR;
 	}
-	if (sc->bge_flags & BGEF_TSO)
+	if (sc->bge_flags & BGEF_TSO) {
 		val |= BGE_RDMAMODE_TSO4_ENABLE;
+		if (BGE_IS_5717_PLUS(sc))
+			val |= BGE_RDMAMODE_TSO6_ENABLE;
+	}
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5720) {
 		val |= CSR_READ_4(sc, BGE_RDMA_MODE) &
@@ -3641,6 +3649,10 @@ bge_attach(device_t parent, device_t sel
 		if ((PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_BROADCOM_BCM5754) &&
 		(PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_BROADCOM_BCM5754M))
 			sc->bge_flags |= BGEF_TSO;
+		/* TSO on BCM5719 A0 does not work. */
+		if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5719) &&
+		(sc->bge_chipid == BGE_CHIPID_BCM5719_A0))
+			sc->bge_flags &= ~BGEF_TSO;
 	}
 
 	capmask = 0x; /* XXX BMSR_DEFCAPMASK */
@@ -5221,7 +5233,7 @@ doit:
 		if (__predict_false(m0->m_len <
 (hlen + sizeof(struct tcphdr {
 
-			aprint_debug_dev(sc->bge_dev,
+			aprint_error_dev(sc->bge_dev,
 			"TSO: hard case m0->m_len == %d < ip/tcp hlen %zd,"
 			"not handled yet\n",
 			 m0->m_len, hlen+ sizeof(struct tcphdr));
@@ -5298,7 +5310,13 @@ doit:
 		 */
 		tcp_seg_flags = 0;
 		if (iptcp_opt_words) {
-			if (BGE_IS_5705_PLUS(sc)) {
+			if (BGE_IS_5717_PLUS(sc)) {
+tcp_seg_flags =
+	(iptcp_opt_words & 0x3) << 14;
+txbd_tso_flags |=
+((iptcp_opt_words & 0xF8) << 7) |
+((iptcp_opt_words & 0x4) << 2);
+			} else if (BGE_IS_5705_PLUS(sc)) {
 tcp_seg_flags =
 	iptcp_opt_words << 11;
 			} else {



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

2018-11-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov  8 12:04:49 UTC 2018

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 #1084):

sys/dev/pci/ixgbe/ixv.c: revision 1.107
sys/dev/pci/ixgbe/ixgbe.c: revision 1.167

  Don't set LRO capability flag because we don't support it yet.

This doesn't change any behavior other than if_capabilities' visibility
(e.g. ifconfig).


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.24 -r1.88.2.25 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.17 -r1.56.2.18 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.24 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.25
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.24	Sun Sep 23 17:43:36 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Nov  8 12:04:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.24 2018/09/23 17:43:36 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.25 2018/11/08 12:04:48 martin Exp $ */
 
 /**
 
@@ -1312,8 +1312,7 @@ ixgbe_setup_interface(device_t dev, stru
 	ifp->if_capabilities |= IFCAP_RXCSUM
 			 |  IFCAP_TXCSUM
 			 |  IFCAP_TSOv4
-			 |  IFCAP_TSOv6
-			 |  IFCAP_LRO;
+			 |  IFCAP_TSOv6;
 	ifp->if_capenable = 0;
 
 	ec->ec_capabilities |= ETHERCAP_VLAN_HWTAGGING

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.17 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.18
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.17	Sat Jun  9 14:59:43 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Nov  8 12:04:48 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.17 2018/06/09 14:59:43 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.18 2018/11/08 12:04:48 martin Exp $*/
 
 /**
 
@@ -1554,9 +1554,9 @@ ixv_setup_interface(device_t dev, struct
 	ec->ec_capenable = ec->ec_capabilities;
 
 	/* Don't enable LRO by default */
-	ifp->if_capabilities |= IFCAP_LRO;
 #if 0
-	ifp->if_capenable = ifp->if_capabilities;
+	/* NetBSD doesn't support LRO yet */
+	ifp->if_capabilities |= IFCAP_LRO;
 #endif
 
 	/*



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

2018-11-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  2 07:55:06 UTC 2018

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

Log Message:
Additional pullup for ticket #1072:

sys/dev/pci/if_bwfm_pci.c   1.5

Make this compilable with 32bit paddr_t.


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

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

Modified files:

Index: src/sys/dev/pci/if_bwfm_pci.c
diff -u src/sys/dev/pci/if_bwfm_pci.c:1.4.2.2 src/sys/dev/pci/if_bwfm_pci.c:1.4.2.3
--- src/sys/dev/pci/if_bwfm_pci.c:1.4.2.2	Wed Oct 31 09:23:00 2018
+++ src/sys/dev/pci/if_bwfm_pci.c	Fri Nov  2 07:55:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwfm_pci.c,v 1.4.2.2 2018/10/31 09:23:00 martin Exp $	*/
+/*	$NetBSD: if_bwfm_pci.c,v 1.4.2.3 2018/11/02 07:55:06 martin Exp $	*/
 /*	$OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $	*/
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -199,7 +199,7 @@ struct bwfm_pci_dmamem {
 
 #define BWFM_PCI_DMA_MAP(_bdm)	((_bdm)->bdm_map)
 #define BWFM_PCI_DMA_LEN(_bdm)	((_bdm)->bdm_size)
-#define BWFM_PCI_DMA_DVA(_bdm)	((_bdm)->bdm_map->dm_segs[0].ds_addr)
+#define BWFM_PCI_DMA_DVA(_bdm)	(uint64_t)((_bdm)->bdm_map->dm_segs[0].ds_addr)
 #define BWFM_PCI_DMA_KVA(_bdm)	((_bdm)->bdm_kva)
 
 static u_int	 if_rxr_get(struct if_rxring *rxr, unsigned int max);
@@ -1006,6 +1006,7 @@ bwfm_pci_fill_rx_ioctl_ring(struct bwfm_
 	uint32_t pktid;
 	paddr_t paddr;
 	int s, slots;
+	uint64_t devaddr;
 
 	s = splnet();
 	for (slots = if_rxr_get(rxring, 8); slots > 0; slots--) {
@@ -1025,12 +1026,13 @@ bwfm_pci_fill_rx_ioctl_ring(struct bwfm_
 			m_freem(m);
 			break;
 		}
+		devaddr = paddr;
 		memset(req, 0, sizeof(*req));
 		req->msg.msgtype = msgtype;
 		req->msg.request_id = htole32(pktid);
 		req->host_buf_len = htole16(MSGBUF_MAX_PKT_SIZE);
-		req->host_buf_addr.high_addr = htole32(paddr >> 32);
-		req->host_buf_addr.low_addr = htole32(paddr & 0x);
+		req->host_buf_addr.high_addr = htole32(devaddr >> 32);
+		req->host_buf_addr.low_addr = htole32(devaddr & 0x);
 		bwfm_pci_ring_write_commit(sc, >sc_ctrl_submit);
 	}
 	if_rxr_put(rxring, slots);
@@ -1045,6 +1047,7 @@ bwfm_pci_fill_rx_buf_ring(struct bwfm_pc
 	uint32_t pktid;
 	paddr_t paddr;
 	int s, slots;
+	uint64_t devaddr;
 
 	s = splnet();
 	for (slots = if_rxr_get(>sc_rxbuf_ring, sc->sc_max_rxbufpost);
@@ -1065,12 +1068,13 @@ bwfm_pci_fill_rx_buf_ring(struct bwfm_pc
 			m_freem(m);
 			break;
 		}
+		devaddr = paddr;
 		memset(req, 0, sizeof(*req));
 		req->msg.msgtype = MSGBUF_TYPE_RXBUF_POST;
 		req->msg.request_id = htole32(pktid);
 		req->data_buf_len = htole16(MSGBUF_MAX_PKT_SIZE);
-		req->data_buf_addr.high_addr = htole32(paddr >> 32);
-		req->data_buf_addr.low_addr = htole32(paddr & 0x);
+		req->data_buf_addr.high_addr = htole32(devaddr >> 32);
+		req->data_buf_addr.low_addr = htole32(devaddr & 0x);
 		bwfm_pci_ring_write_commit(sc, >sc_rxpost_submit);
 	}
 	if_rxr_put(>sc_rxbuf_ring, slots);
@@ -1898,6 +1902,7 @@ bwfm_pci_txdata(struct bwfm_softc *bwfm,
 	struct msgbuf_tx_msghdr *tx;
 	uint32_t pktid;
 	paddr_t paddr;
+	uint64_t devaddr;
 	struct ether_header *eh;
 	int flowid, ret, ac;
 
@@ -1952,12 +1957,12 @@ bwfm_pci_txdata(struct bwfm_softc *bwfm,
 		bwfm_pci_ring_write_cancel(sc, ring, 1);
 		return ret;
 	}
-	paddr += ETHER_HDR_LEN;
+	devaddr = paddr + ETHER_HDR_LEN;
 
 	tx->msg.request_id = htole32(pktid);
 	tx->data_len = htole16((*mp)->m_len - ETHER_HDR_LEN);
-	tx->data_buf_addr.high_addr = htole32(paddr >> 32);
-	tx->data_buf_addr.low_addr = htole32(paddr & 0x);
+	tx->data_buf_addr.high_addr = htole32(devaddr >> 32);
+	tx->data_buf_addr.low_addr = htole32(devaddr & 0x);
 
 	bwfm_pci_ring_write_commit(sc, ring);
 	return 0;



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

2018-10-30 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Oct 30 09:32:32 UTC 2018

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

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1074):
sys/dev/pci/pci_subr.c: revision 1.204-1.206
sys/dev/pci/pcireg.h:   revision 1.141-1.142

Root Complex Event Collector Bus Number Association ECN.
- If capability version is 2 (or greater), decode RCEC Associated Bus Numbers
  register.
- Don't print TPH requester's ST Table Size if the ST table location field
  is not PCI_TPH_REQ_STTBLLOC_TPHREQ because the size field is only applicable
  for PCI_TPH_REQ_STTBLLOC_TPHREQ case.
- Add comment.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.7 -r1.183.2.8 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.6 -r1.130.2.7 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.7 src/sys/dev/pci/pci_subr.c:1.183.2.8
--- src/sys/dev/pci/pci_subr.c:1.183.2.7	Sun Sep 23 17:40:37 2018
+++ src/sys/dev/pci/pci_subr.c	Tue Oct 30 09:32:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.7 2018/09/23 17:40:37 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.8 2018/10/30 09:32:32 sborrill 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.7 2018/09/23 17:40:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.8 2018/10/30 09:32:32 sborrill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3061,6 +3061,18 @@ pci_conf_print_rcec_assoc_cap(const pcir
 	reg = regs[o2i(extcapoff + PCI_RCEC_ASSOC_ASSOCBITMAP)];
 	printf("Association Bitmap for Root Complex Integrated Devices:"
 	" 0x%08x\n", reg);
+
+	if (PCI_EXTCAPLIST_VERSION(regs[o2i(extcapoff)]) >= 2) {
+		reg = regs[o2i(extcapoff + PCI_RCEC_ASSOC_ASSOCBUSNUM)];
+		printf("RCEC Associated Bus Numbers register: 0x%08x\n",
+		reg);
+		printf("  RCEC Next Bus: %u\n",
+		(unsigned int)__SHIFTOUT(reg,
+			PCI_RCEC_ASSOCBUSNUM_RCECNEXT));
+		printf("  RCEC Last Bus: %u\n",
+		(unsigned int)__SHIFTOUT(reg,
+			PCI_RCEC_ASSOCBUSNUM_RCECLAST));
+	}
 }
 
 /* XXX pci_conf_print_mfvc_cap */
@@ -3526,7 +3538,7 @@ static void
 pci_conf_print_tph_req_cap(const pcireg_t *regs, int extcapoff)
 {
 	pcireg_t reg;
-	int size, i, j;
+	int size = 0, i, j;
 	uint8_t sttbloc;
 
 	printf("\n  TPH Requester Extended Capability\n");
@@ -3540,8 +3552,10 @@ pci_conf_print_tph_req_cap(const pcireg_
 	sttbloc = __SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLLOC);
 	printf("  ST Table Location: %s\n",
 	pci_conf_print_tph_req_cap_sttabloc(sttbloc));
-	size = __SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLSIZ) + 1;
-	printf("  ST Table Size: %d\n", size);
+	if (sttbloc == PCI_TPH_REQ_STTBLLOC_TPHREQ) {
+		size = __SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLSIZ) + 1;
+		printf("  ST Table Size: %d\n", size);
+	}
 
 	reg = regs[o2i(extcapoff + PCI_TPH_REQ_CTL)];
 	printf("TPH Requester Control register: 0x%08x\n", reg);
@@ -4700,19 +4714,19 @@ pci_conf_print(
 	/* device-dependent header */
 	printf("  Device-dependent header:\n");
 	pci_conf_print_regs(regs, endoff, PCI_CONF_SIZE);
-	printf("\n");
 #ifdef _KERNEL
+	printf("\n");
 	if (printfn)
 		(*printfn)(pc, tag, regs);
 	else
 		printf("Don't know how to pretty-print device-dependent header.\n");
-	printf("\n");
 #endif /* _KERNEL */
 
 	if (regs[o2i(PCI_EXTCAPLIST_BASE)] == 0x ||
 	regs[o2i(PCI_EXTCAPLIST_BASE)] == 0)
 		return;
 
+	printf("\n");
 #ifdef _KERNEL
 	pci_conf_print_extcaplist(pc, tag, regs);
 #else

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.130.2.6 src/sys/dev/pci/pcireg.h:1.130.2.7
--- src/sys/dev/pci/pcireg.h:1.130.2.6	Sun Sep 23 17:40:37 2018
+++ src/sys/dev/pci/pcireg.h	Tue Oct 30 09:32:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.130.2.6 2018/09/23 17:40:37 martin Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.130.2.7 2018/10/30 09:32:32 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1186,8 +1186,8 @@ struct pci_msix_table_entry {
 	uint32_t pci_msix_vector_control;
 };
 #define	PCI_MSIX_VECTCTL_MASK	__BIT(0)
-#define	PCI_MSIX_VECTCTL_STLO	__BITS(23, 16)
-#define	PCI_MSIX_VECTCTL_STUP	__BITS(31, 24)
+#define	PCI_MSIX_VECTCTL_STLO	__BITS(23, 16)	/* ST lower */
+#define	PCI_MSIX_VECTCTL_STUP	__BITS(31, 24)	/* ST upper */
 
  /* Max number of MSI-X vectors. See PCI-SIG specification. */
 #define	PCI_MSIX_MAX_VECTORS	2048
@@ -1699,7 +1699,10 @@ struct pci_rom {
  * Extended capability ID: 0x0007
  * Root Complex Event Collector Association
  */
-#define	PCI_RCEC_ASSOC_ASSOCBITMAP 0x04
+#define	PCI_RCEC_ASSOC_ASSOCBITMAP 0x04	/* Association Bitmap */
+#define	PCI_RCEC_ASSOC_ASSOCBUSNUM 0x08	/* Associcated Bus Number */

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

2018-10-30 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Oct 30 09:25:13 UTC 2018

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

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1075):
sys/dev/pci/if_wm.c:revision 1.589

Fix KASSERT to prevent panic on CNP (Intel 300 series + I219) with INTx
interrupt (Xen dom0 or pre netbsd-8)


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.23 -r1.508.4.24 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.23 src/sys/dev/pci/if_wm.c:1.508.4.24
--- src/sys/dev/pci/if_wm.c:1.508.4.23	Sun Sep 23 17:39:02 2018
+++ src/sys/dev/pci/if_wm.c	Tue Oct 30 09:25:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.23 2018/09/23 17:39:02 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.24 2018/10/30 09:25:13 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.23 2018/09/23 17:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.24 2018/10/30 09:25:13 sborrill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -14789,7 +14789,8 @@ wm_legacy_irq_quirk_spt(struct wm_softc 
 
 	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
 		device_xname(sc->sc_dev), __func__));
-	KASSERT(sc->sc_type == WM_T_PCH_SPT);
+	KASSERT((sc->sc_type == WM_T_PCH_SPT)
+	|| (sc->sc_type == WM_T_PCH_CNP));
 
 	reg = CSR_READ(sc, WMREG_FEXTNVM7);
 	reg |= FEXTNVM7_SIDE_CLK_UNGATE;



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

2018-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 17 13:46:58 UTC 2018

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

Log Message:
Regen for ticket #1064


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.9 -r1.1281.2.10 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.9 -r1.1280.2.10 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2018-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 17 13:45:31 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1064):

sys/dev/pci/aac_pci.c: revision 1.39
sys/dev/pci/pcidevs: revision 1.1348

Add Adaptec RAID 2445 and 2805.
>From Dima Veselov.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.8.1 src/sys/dev/pci/aac_pci.c
cvs rdiff -u -r1.1289.2.9 -r1.1289.2.10 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/aac_pci.c
diff -u src/sys/dev/pci/aac_pci.c:1.38 src/sys/dev/pci/aac_pci.c:1.38.8.1
--- src/sys/dev/pci/aac_pci.c:1.38	Tue Sep 27 03:33:32 2016
+++ src/sys/dev/pci/aac_pci.c	Wed Oct 17 13:45:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: aac_pci.c,v 1.38 2016/09/27 03:33:32 pgoyette Exp $	*/
+/*	$NetBSD: aac_pci.c,v 1.38.8.1 2018/10/17 13:45:31 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aac_pci.c,v 1.38 2016/09/27 03:33:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aac_pci.c,v 1.38.8.1 2018/10/17 13:45:31 martin Exp $");
 
 #include 
 #include 
@@ -364,6 +364,22 @@ static struct aac_ident {
 	{	PCI_VENDOR_ADP2,
 		PCI_PRODUCT_ADP2_ASR2200S,
 		PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_2445,
+		AAC_HWIF_I960RX,
+		0,
+		"Adaptec RAID 2445"
+	},
+	{	PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_ASR2200S,
+		PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_2805,
+		AAC_HWIF_I960RX,
+		0,
+		"Adaptec RAID 2805"
+	},
+	{	PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_ASR2200S,
+		PCI_VENDOR_ADP2,
 		PCI_PRODUCT_ADP2_3405,
 		AAC_HWIF_I960RX,
 		0,

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.9 src/sys/dev/pci/pcidevs:1.1289.2.10
--- src/sys/dev/pci/pcidevs:1.1289.2.9	Thu Jul 26 23:14:37 2018
+++ src/sys/dev/pci/pcidevs	Wed Oct 17 13:45:31 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.9 2018/07/26 23:14:37 snj Exp $
+$NetBSD: pcidevs,v 1.1289.2.10 2018/10/17 13:45:31 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -891,6 +891,8 @@ product ADP2 AAR2810SA		0x0292	AAR-2810S
 product ADP2 3405		0x02bb	RAID 3405
 product ADP2 3805		0x02bc	RAID 3805
 product ADP2 2405		0x02d5	RAID 2405
+product ADP2 2445		0x02d6	RAID 2445
+product ADP2 2805		0x02d7	RAID 2805
 product ADP2 AAC364		0x0364	AAC-364
 product ADP2 ASR5400S		0x0365	ASR-5400S
 product ADP2 PERC_2QC		0x1364	Dell PERC 2/QC



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 18:00:53 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1035):

sys/dev/pci/files.pci: revision 1.403

ixg and ixv depend on mii and mii_phy.


To generate a diff of this commit:
cvs rdiff -u -r1.388.4.1 -r1.388.4.2 src/sys/dev/pci/files.pci

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.1 src/sys/dev/pci/files.pci:1.388.4.2
--- src/sys/dev/pci/files.pci:1.388.4.1	Thu Dec 21 19:28:53 2017
+++ src/sys/dev/pci/files.pci	Sun Sep 23 18:00:53 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.388.4.1 2017/12/21 19:28:53 snj Exp $
+#	$NetBSD: files.pci,v 1.388.4.2 2018/09/23 18:00:53 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -665,7 +665,7 @@ attach	stge at pci
 file	dev/pci/if_stge.c		stge
 
 # Intel i82598 & i82599 10-Gigabit Ethernet
-device	ixg: ether, ifnet, arp
+device	ixg: ether, ifnet, arp, mii, mii_phy
 attach	ixg at pci
 file	dev/pci/ixgbe/ixgbe.c		ixg | ixv
 file	dev/pci/ixgbe/ix_txrx.c		ixg | ixv
@@ -684,7 +684,7 @@ file	dev/pci/ixgbe/if_bypass.c	ixg | ixv
 file	dev/pci/ixgbe/if_fdir.c		ixg | ixv
 
 # This appears to be the driver for virtual instances of i82599.
-device	ixv: ether, ifnet, arp
+device	ixv: ether, ifnet, arp, mii, mii_phy
 attach	ixv at pci
 file	dev/pci/ixgbe/ixv.c		ixv
 



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:43:37 UTC 2018

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

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

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

- Fix a bug that Denverton accessed wrong register in
   ixgbe_setup_low_power_mode(). The location of some registers in Denverton
   were changed. The GRC register is one of them, so use IXGBE_GRC_BY_MAC(hw)
   instead of IXGBE_GRC.

- ixgbe_check_wol_support() tests the capability of WOL, but the sysctl
   knobs for WOL were added only for IXGBE_DEV_ID_X550EM_X_10G_T. Add the
   knobs when adapter->wol_support is not 0.

XXX pullup-8


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.23 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.24
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.23	Wed Sep  5 08:42:22 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sun Sep 23 17:43:36 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.23 2018/09/05 08:42:22 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.24 2018/09/23 17:43:36 martin Exp $ */
 
 /**
 
@@ -3277,7 +3277,7 @@ ixgbe_add_device_sysctls(struct adapter 
 			aprint_error_dev(dev, "could not create sysctl\n");
 
 	/* for WoL-capable devices */
-	if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) {
+	if (adapter->wol_support) {
 		if (sysctl_createv(log, 0, , , CTLFLAG_READWRITE,
 		CTLTYPE_BOOL, "wol_enable",
 		SYSCTL_DESCR("Enable/Disable Wake on LAN"),
@@ -3663,8 +3663,8 @@ ixgbe_setup_low_power_mode(struct adapte
 		IXGBE_WRITE_REG(hw, IXGBE_WUC, 0);
 	} else {
 		/* Turn off support for APM wakeup. (Using ACPI instead) */
-		IXGBE_WRITE_REG(hw, IXGBE_GRC,
-		IXGBE_READ_REG(hw, IXGBE_GRC) & ~(u32)2);
+		IXGBE_WRITE_REG(hw, IXGBE_GRC_BY_MAC(hw),
+		IXGBE_READ_REG(hw, IXGBE_GRC_BY_MAC(hw)) & ~(u32)2);
 
 		/*
 		 * Clear Wake Up Status register to prevent any previous wakeup



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:40:38 UTC 2018

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

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

sys/dev/pci/pci_subr.c: revision 1.203
sys/dev/pci/pcireg.h: revision 1.140

  Add ATS Relaxed Ordering supported bit described in Address Translation
Relaxed Ordering ECN.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.6 -r1.183.2.7 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.5 -r1.130.2.6 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.6 src/sys/dev/pci/pci_subr.c:1.183.2.7
--- src/sys/dev/pci/pci_subr.c:1.183.2.6	Thu Jul 26 23:11:59 2018
+++ src/sys/dev/pci/pci_subr.c	Sun Sep 23 17:40:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.6 2018/07/26 23:11:59 snj Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.7 2018/09/23 17:40:37 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.6 2018/07/26 23:11:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.7 2018/09/23 17:40:37 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3152,6 +3152,7 @@ pci_conf_print_ats_cap(const pcireg_t *r
 	printf("  Invalidate Queue Depth: %u\n", num);
 	onoff("Page Aligned Request", reg, PCI_ATS_CAP_PALIGNREQ);
 	onoff("Global Invalidate", reg, PCI_ATS_CAP_GLOBALINVL);
+	onoff("Relaxed Ordering", reg, PCI_ATS_CAP_RELAXORD);
 
 	printf("Control register: 0x%04x\n", ctl);
 	printf("  Smallest Translation Unit: %u\n",

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.130.2.5 src/sys/dev/pci/pcireg.h:1.130.2.6
--- src/sys/dev/pci/pcireg.h:1.130.2.5	Thu Jul 26 23:11:59 2018
+++ src/sys/dev/pci/pcireg.h	Sun Sep 23 17:40:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.130.2.5 2018/07/26 23:11:59 snj Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.130.2.6 2018/09/23 17:40:37 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1770,6 +1770,7 @@ struct pci_rom {
 #define	PCI_ATS_CAP_INVQDEPTH	__BITS(4, 0)	/* Invalidate Queue Depth */
 #define	PCI_ATS_CAP_PALIGNREQ	__BIT(5)	/* Page Aligned Request */
 #define	PCI_ATS_CAP_GLOBALINVL	__BIT(6)	/* Global Invalidate Support */
+#define	PCI_ATS_CAP_RELAXORD	__BIT(7)	/* Relaxed Ordering */
 #define	PCI_ATS_CTL	0x04	/* Control Register */
 #define	PCI_ATS_CTL_STU		__BITS(20, 16)	/* Smallest Translation Unit */
 #define	PCI_ATS_CTL_EN		__BIT(31)	/* Enable */



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:39:02 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1027):
sys/dev/pci/if_wm.c: revision 1.586
sys/dev/pci/if_wm.c: revision 1.587
sys/dev/pci/if_wm.c: revision 1.588

- Split txdrop evcnt into pcqdrop and descdrop.
- Simplify evcnt name by removing duplicated "tx" or "rx".
- s/tu/underrun/

- Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
   returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
   incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
   event counter is incremented.

- Reduce the max number of DMA segments from 256 to 64 (it's the same value
   as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
   value (40)) because we do m_defrag() now.

  Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.22 -r1.508.4.23 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.22 src/sys/dev/pci/if_wm.c:1.508.4.23
--- src/sys/dev/pci/if_wm.c:1.508.4.22	Sat Aug 11 14:47:31 2018
+++ src/sys/dev/pci/if_wm.c	Sun Sep 23 17:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.22 2018/08/11 14:47:31 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.23 2018/09/23 17:39:02 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.22 2018/08/11 14:47:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.23 2018/09/23 17:39:02 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -197,11 +197,12 @@ static int wm_watchdog_timeout = WM_WATC
  * of packets, and we go ahead and manage up to 64 (16 for the i82547)
  * of them at a time.
  *
- * We allow up to 256 (!) DMA segments per packet.  Pathological packet
+ * We allow up to 64 DMA segments per packet.  Pathological packet
  * chains containing many small mbufs have been observed in zero-copy
- * situations with jumbo frames.
+ * situations with jumbo frames. If a mbuf chain has more than 64 DMA segments,
+ * m_defrag() is called to reduce it.
  */
-#define	WM_NTXSEGS		256
+#define	WM_NTXSEGS		64
 #define	WM_IFQUEUELEN		256
 #define	WM_TXQUEUELEN_MAX	64
 #define	WM_TXQUEUELEN_MAX_82547	16
@@ -376,23 +377,27 @@ struct wm_txqueue {
 	uint32_t txq_packets;		/* for AIM */
 	uint32_t txq_bytes;		/* for AIM */
 #ifdef WM_EVENT_COUNTERS
-	WM_Q_EVCNT_DEFINE(txq, txsstall)	/* Tx stalled due to no txs */
-	WM_Q_EVCNT_DEFINE(txq, txdstall)	/* Tx stalled due to no txd */
-	WM_Q_EVCNT_DEFINE(txq, txfifo_stall)	/* Tx 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, txipsum)		/* IP checksums comp. out-bound */
-	WM_Q_EVCNT_DEFINE(txq, txtusum)		/* TCP/UDP cksums comp. out-bound */
-	WM_Q_EVCNT_DEFINE(txq, txtusum6)	/* TCP/UDP v6 cksums comp. out-bound */
-	WM_Q_EVCNT_DEFINE(txq, txtso)		/* TCP seg offload out-bound (IPv4) */
-	WM_Q_EVCNT_DEFINE(txq, txtso6)		/* TCP seg offload out-bound (IPv6) */
-	WM_Q_EVCNT_DEFINE(txq, txtsopain)	/* painful header manip. for TSO */
-
-	WM_Q_EVCNT_DEFINE(txq, txdrop)		/* Tx packets dropped(too many segs) */
-
-	WM_Q_EVCNT_DEFINE(txq, tu)		/* Tx underrun */
+	/* 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 */
+	/* 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) */
+	WM_Q_EVCNT_DEFINE(txq, tso6)	/* TCP seg offload (IPv6) */
+	WM_Q_EVCNT_DEFINE(txq, tsopain) /* Painful header manip. for TSO */
+	WM_Q_EVCNT_DEFINE(txq, pcqdrop)	/* Pkt dropped in pcq */
+	WM_Q_EVCNT_DEFINE(txq, descdrop)/* Pkt dropped in MAC desc ring */
+	/* other than toomanyseg */
+
+	WM_Q_EVCNT_DEFINE(txq, toomanyseg)  /* Pkt dropped(toomany DMA segs) */
+	WM_Q_EVCNT_DEFINE(txq, defrag)	/* m_defrag() */
+	WM_Q_EVCNT_DEFINE(txq, underrun)/* Tx underrun */
 
 	char txq_txseg_evcnt_names[WM_NTXSEGS][sizeof("txqXXtxsegXXX")];
 	struct evcnt txq_ev_txseg[WM_NTXSEGS]; /* Tx packets w/ N segments */
@@ -433,11 +438,12 @@ struct wm_rxqueue {
 	uint32_t rxq_packets;		/* 

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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:22:52 UTC 2018

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

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

sys/dev/pci/hdaudio_pci.c: revision 1.9
sys/dev/pci/hdaudio_pci.c: revision 1.10

use pci_mapreg_type() instead of assuming PCI_MAPREG_TYPE_MEM.
suggested by riastradh@.

fixes hdaudio on thinkpad P51 where the registers are mapped
over 4GB range.  probably fixes intel X10-based systems that
map hdaudio high as well, but i was able to work around that
in the BIOS.  not so for the P51.

XXX: pullup-7, pullup-8.

use pa_dmat64 if pci_dma64_available().


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/dev/pci/hdaudio_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/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio_pci.c:1.7.2.1 src/sys/dev/pci/hdaudio_pci.c:1.7.2.2
--- src/sys/dev/pci/hdaudio_pci.c:1.7.2.1	Mon Jun  5 08:13:05 2017
+++ src/sys/dev/pci/hdaudio_pci.c	Sun Sep 23 17:22:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.7.2.1 2017/06/05 08:13:05 snj Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.7.2.2 2018/09/23 17:22:51 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7.2.1 2017/06/05 08:13:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7.2.2 2018/09/23 17:22:51 martin Exp $");
 
 #include 
 #include 
@@ -107,8 +107,8 @@ hdaudio_pci_attach(device_t parent, devi
 	struct hdaudio_pci_softc *sc = device_private(self);
 	struct pci_attach_args *pa = opaque;
 	const char *intrstr;
-	pcireg_t csr;
-	int err;
+	pcireg_t csr, maptype;
+	int err, reg;
 	char intrbuf[PCI_INTRSTR_LEN];
 
 	aprint_naive("\n");
@@ -127,7 +127,9 @@ hdaudio_pci_attach(device_t parent, devi
 	pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG, csr);
 
 	/* Map MMIO registers */
-	err = pci_mapreg_map(pa, HDAUDIO_PCI_AZBARL, PCI_MAPREG_TYPE_MEM, 0,
+	reg = HDAUDIO_PCI_AZBARL;
+	maptype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, reg);
+	err = pci_mapreg_map(pa, reg, maptype, 0,
 			 >sc_hdaudio.sc_memt,
 			 >sc_hdaudio.sc_memh,
 			 >sc_hdaudio.sc_membase,
@@ -137,7 +139,10 @@ hdaudio_pci_attach(device_t parent, devi
 		return;
 	}
 	sc->sc_hdaudio.sc_memvalid = true;
-	sc->sc_hdaudio.sc_dmat = pa->pa_dmat;
+	if (pci_dma64_available(pa))
+		sc->sc_hdaudio.sc_dmat = pa->pa_dmat64;
+	else
+		sc->sc_hdaudio.sc_dmat = pa->pa_dmat;
 
 	/* Map interrupt and establish handler */
 	if (pci_intr_alloc(pa, >sc_pihp, NULL, 0)) {



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

2018-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  7 12:37:20 UTC 2018

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

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

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

  Fix a bug that ixgbe_mq_start(an if_transmit function) returned wrong
value on error. pcq_put returns false on error, so returning it to caller
indicated no error.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.12 -r1.24.2.13 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.12 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.13
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.12	Tue Aug  7 13:33:23 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Sep  7 12:37:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.12 2018/08/07 13:33:23 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.13 2018/09/07 12:37:20 martin Exp $ */
 
 /**
 
@@ -202,7 +202,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 {
 	struct adapter	*adapter = ifp->if_softc;
 	struct tx_ring	*txr;
-	int 		i, err = 0;
+	int 		i;
 #ifdef RSS
 	uint32_t bucket_id;
 #endif
@@ -238,11 +238,10 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 
 	txr = >tx_rings[i];
 
-	err = pcq_put(txr->txr_interq, m);
-	if (err == false) {
+	if (__predict_false(!pcq_put(txr->txr_interq, m))) {
 		m_freem(m);
 		txr->pcq_drops.ev_count++;
-		return (err);
+		return ENOBUFS;
 	}
 	if (IXGBE_TX_TRYLOCK(txr)) {
 		ixgbe_mq_start_locked(ifp, txr);



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

2018-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep  5 08:42:22 UTC 2018

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

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

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

  Fix a bug that media change may fail. I noticed that ifconfig ixgN media XXX
took a 10 or more seconds on a Denverton machie. I occurred by trying take a
lock and timed out. The reason was that ixgbe_media_change() didn't take
CORE_LOCK. Do it.

  This problem was from FreeBSD's pre-iflib ixgbe (I don't know whether this
problem really occurs on FreeBSD or not). Post-iflib ixgbe has no problem
because iflib_media_change() takes a lock.
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.22 -r1.88.2.23 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.22 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.23
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.22	Tue Aug  7 13:33:23 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Sep  5 08:42:22 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.22 2018/08/07 13:33:23 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.23 2018/09/05 08:42:22 martin Exp $ */
 
 /**
 
@@ -2841,6 +2841,7 @@ ixgbe_media_change(struct ifnet *ifp)
 	if (hw->phy.media_type == ixgbe_media_type_backplane)
 		return (EPERM);
 
+	IXGBE_CORE_LOCK(adapter);
 	/*
 	 * We don't actually need to check against the supported
 	 * media types of the adapter; ifmedia will take care of
@@ -2853,6 +2854,7 @@ ixgbe_media_change(struct ifnet *ifp)
 		if (err != IXGBE_SUCCESS) {
 			device_printf(adapter->dev, "Unable to determine "
 			"supported advertise speeds\n");
+			IXGBE_CORE_UNLOCK(adapter);
 			return (ENODEV);
 		}
 		speed |= link_caps;
@@ -2913,10 +2915,12 @@ ixgbe_media_change(struct ifnet *ifp)
 			adapter->advertise |= 1 << 5;
 	}
 
+	IXGBE_CORE_UNLOCK(adapter);
 	return (0);
 
 invalid:
 	device_printf(adapter->dev, "Invalid media type!\n");
+	IXGBE_CORE_UNLOCK(adapter);
 
 	return (EINVAL);
 } /* ixgbe_media_change */



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

2018-08-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 11 14:47:32 UTC 2018

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

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

sys/dev/pci/if_wm.c: revision 1.584
sys/dev/pci/if_wmvar.h: revision 1.39

Add MDIC_WA and CLSEMWA to snprintb() string for WM_F_* flags.

Fix two bugs for non-SERDES fiber. Tested on 82544EI(0x1009), 82545GM(0x1027),
82546GB(0x107a), 82571GB(0x105f), 82572EI(0x107e). Tested on SERDES
82580(0x150e (Winyao SERDES SFP)) and 82580(0x150e) as regression test:

- Fix a bug that the link can't detect in link interrupt function for
   non-SERDES fiber. When the signal is detected & STATUS_LU == 0 & RXCW == 0,
   it's required to set CTRL_SLU and CTRL_FD bit. wm_check_for_link() is the
   function to do it. If a link status change interrupt occurred, call
   wm_check_for_link() before checking current link status.

- Fix a bug that 82542 misunderstand fiber's signal detection. CTRL_SWDPIN(1)
   is used for fiber's signal and it's value is reversed only on 82543 and
   82544. Simplify the code and move it into a new function wm_tbi_havesignal()
   and use it.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.21 -r1.508.4.22 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.33.6.2 -r1.33.6.3 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.21 src/sys/dev/pci/if_wm.c:1.508.4.22
--- src/sys/dev/pci/if_wm.c:1.508.4.21	Thu Jul 26 20:40:39 2018
+++ src/sys/dev/pci/if_wm.c	Sat Aug 11 14:47:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.21 2018/07/26 20:40:39 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.22 2018/08/11 14:47:31 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.21 2018/07/26 20:40:39 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.22 2018/08/11 14:47:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -842,6 +842,7 @@ static bool	wm_sgmii_uses_mdio(struct wm
 static int	wm_sgmii_readreg(device_t, int, int);
 static void	wm_sgmii_writereg(device_t, int, int, int);
 /* TBI related */
+static bool	wm_tbi_havesignal(struct wm_softc *, uint32_t);
 static void	wm_tbi_mediainit(struct wm_softc *);
 static int	wm_tbi_mediachange(struct ifnet *);
 static void	wm_tbi_mediastatus(struct ifnet *, struct ifmediareq *);
@@ -8755,6 +8756,7 @@ wm_linkintr_tbi(struct wm_softc *sc, uin
 
 	status = CSR_READ(sc, WMREG_STATUS);
 	if (icr & ICR_LSC) {
+		wm_check_for_link(sc);
 		if (status & STATUS_LU) {
 			DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> up %s\n",
 device_xname(sc->sc_dev),
@@ -10962,6 +10964,23 @@ wm_sgmii_writereg(device_t dev, int phy,
 
 /* TBI related */
 
+static bool
+wm_tbi_havesignal(struct wm_softc *sc, uint32_t ctrl)
+{
+	bool sig;
+
+	sig = ctrl & CTRL_SWDPIN(1);
+
+	/*
+	 * On 82543 and 82544, the CTRL_SWDPIN(1) bit will be 0 if the optics
+	 * detect a signal, 1 if they don't.
+	 */
+	if ((sc->sc_type == WM_T_82543) || (sc->sc_type == WM_T_82544))
+		sig = !sig;
+
+	return sig;
+}
+
 /*
  * wm_tbi_mediainit:
  *
@@ -11053,9 +11072,11 @@ wm_tbi_mediachange(struct ifnet *ifp)
 {
 	struct wm_softc *sc = ifp->if_softc;
 	struct ifmedia_entry *ife = sc->sc_mii.mii_media.ifm_cur;
-	uint32_t status;
+	uint32_t status, ctrl;
+	bool signal;
 	int i;
 
+	KASSERT(sc->sc_mediatype != WM_MEDIATYPE_COPPER);
 	if (sc->sc_mediatype == WM_MEDIATYPE_SERDES) {
 		/* XXX need some work for >= 82571 and < 82575 */
 		if (sc->sc_type < WM_T_82575)
@@ -11085,14 +11106,13 @@ wm_tbi_mediachange(struct ifnet *ifp)
 	CSR_WRITE_FLUSH(sc);
 	delay(1000);
 
-	i = CSR_READ(sc, WMREG_CTRL) & CTRL_SWDPIN(1);
-	DPRINTF(WM_DEBUG_LINK,("%s: i = 0x%x\n", device_xname(sc->sc_dev),i));
+	ctrl =  CSR_READ(sc, WMREG_CTRL);
+	signal = wm_tbi_havesignal(sc, ctrl);
 
-	/*
-	 * On 82544 chips and later, the CTRL_SWDPIN(1) bit will be set if the
-	 * optics detect a signal, 0 if they don't.
-	 */
-	if (((i != 0) && (sc->sc_type > WM_T_82544)) || (i == 0)) {
+	DPRINTF(WM_DEBUG_LINK, ("%s: signal = %d\n", device_xname(sc->sc_dev),
+		signal));
+
+	if (signal) {
 		/* Have signal; wait for the link to come up. */
 		for (i = 0; i < WM_LINKUP_TIMEOUT; i++) {
 			delay(1);
@@ -11198,7 +11218,10 @@ wm_check_for_link(struct wm_softc *sc)
 	uint32_t rxcw;
 	uint32_t ctrl;
 	uint32_t status;
-	uint32_t sig;
+	bool signal;
+
+	DPRINTF(WM_DEBUG_LINK, ("%s: %s called\n",
+		device_xname(sc->sc_dev), __func__));
 
 	if (sc->sc_mediatype == WM_MEDIATYPE_SERDES) {
 		/* XXX need some work for >= 82571 */
@@ -11211,13 +11234,11 @@ wm_check_for_link(struct wm_softc *sc)
 	rxcw = CSR_READ(sc, WMREG_RXCW);
 	ctrl = CSR_READ(sc, WMREG_CTRL);
 	status = CSR_READ(sc, 

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

2018-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  7 13:33:23 UTC 2018

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

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

sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe.h: revision 1.51
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.36
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.23
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe.c: revision 1.163
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.49

  Add force_10_100_autonego sysctl. The default value is 0(false).

This sysctl is only for 550EM_a with PHY firmware for a while.

  Make jcl allocation per queue to reduce mutex spin. Tested by me and
knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.11 -r1.24.2.12 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.21 -r1.88.2.22 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.13 -r1.24.6.14 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.17.6.4 -r1.17.6.5 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.22.2.6 -r1.22.2.7 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.4 -r1.5.6.5 src/sys/dev/pci/ixgbe/ixgbe_x550.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.11 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.12
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.11	Sat Jun  9 14:59:43 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue Aug  7 13:33:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.11 2018/06/09 14:59:43 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.12 2018/08/07 13:33:23 martin Exp $ */
 
 /**
 
@@ -1343,7 +1343,7 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 	while (j != limit) {
 		rxbuf = >rx_buffers[i];
 		if (rxbuf->buf == NULL) {
-			mp = ixgbe_getjcl(>jcl_head, M_NOWAIT,
+			mp = ixgbe_getjcl(>jcl_head, M_NOWAIT,
 			MT_DATA, M_PKTHDR, rxr->mbuf_sz);
 			if (mp == NULL) {
 rxr->no_jmbuf.ev_count++;
@@ -1505,6 +1505,17 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	/* Free current RX buffer structs and their mbufs */
 	ixgbe_free_receive_ring(rxr);
 
+	IXGBE_RX_UNLOCK(rxr);
+	/*
+	 * Now reinitialize our supply of jumbo mbufs.  The number
+	 * or size of jumbo mbufs may have changed.
+	 * Assume all of rxr->ptag are the same.
+	 */
+	ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr,
+	(2 * adapter->num_rx_desc), adapter->rx_mbuf_sz);
+
+	IXGBE_RX_LOCK(rxr);
+
 	/* Now replenish the mbufs */
 	for (int j = 0; j != rxr->num_desc; ++j) {
 		struct mbuf *mp;
@@ -1534,7 +1545,7 @@ ixgbe_setup_receive_ring(struct rx_ring 
 #endif /* DEV_NETMAP */
 
 		rxbuf->flags = 0;
-		rxbuf->buf = ixgbe_getjcl(>jcl_head, M_NOWAIT,
+		rxbuf->buf = ixgbe_getjcl(>jcl_head, M_NOWAIT,
 		MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz);
 		if (rxbuf->buf == NULL) {
 			error = ENOBUFS;
@@ -1611,15 +1622,6 @@ ixgbe_setup_receive_structures(struct ad
 	struct rx_ring *rxr = adapter->rx_rings;
 	intj;
 
-	/*
-	 * Now reinitialize our supply of jumbo mbufs.  The number
-	 * or size of jumbo mbufs may have changed.
-	 * Assume all of rxr->ptag are the same.
-	 */
-	ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat,
-	(2 * adapter->num_rx_desc) * adapter->num_queues,
-	adapter->rx_mbuf_sz);
-
 	for (j = 0; j < adapter->num_queues; j++, rxr++)
 		if (ixgbe_setup_receive_ring(rxr))
 			goto fail;

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.21 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.22
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.21	Thu Jul 26 23:21:54 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Aug  7 13:33:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.21 2018/07/26 23:21:54 snj Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.22 2018/08/07 13:33:23 martin Exp $ */
 
 /**
 
@@ -3315,6 +3315,15 @@ ixgbe_add_device_sysctls(struct adapter 
 			aprint_error_dev(dev, "could not create sysctl\n");
 	}
 
+	if ((hw->mac.type == ixgbe_mac_X550EM_a)
+	&& (hw->phy.type == ixgbe_phy_fw))
+		if (sysctl_createv(log, 0, , , CTLFLAG_READWRITE,
+		CTLTYPE_BOOL, "force_10_100_autonego",
+		SYSCTL_DESCR("Force autonego on 10M and 100M"),
+		NULL, 0, >phy.force_10_100_autonego, 0,
+		CTL_CREATE, CTL_EOL) != 0)
+			aprint_error_dev(dev, "could not create sysctl\n");
+
 	if (adapter->feat_cap & IXGBE_FEATURE_EEE) {
 		if (sysctl_createv(log, 0, , , CTLFLAG_READWRITE,
 		CTLTYPE_INT, "eee_state",

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u 

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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 16:03:37 UTC 2018

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

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

sys/dev/pci/if_de.c: revision 1.153

Remove bpf_tap() call in rx. It's done in if_percpuq_softint().


To generate a diff of this commit:
cvs rdiff -u -r1.150.8.1 -r1.150.8.2 src/sys/dev/pci/if_de.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_de.c
diff -u src/sys/dev/pci/if_de.c:1.150.8.1 src/sys/dev/pci/if_de.c:1.150.8.2
--- src/sys/dev/pci/if_de.c:1.150.8.1	Thu Jul 26 23:55:30 2018
+++ src/sys/dev/pci/if_de.c	Tue Jul 31 16:03:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_de.c,v 1.150.8.1 2018/07/26 23:55:30 snj Exp $	*/
+/*	$NetBSD: if_de.c,v 1.150.8.2 2018/07/31 16:03:37 martin Exp $	*/
 
 /*-
  * Copyright (c) 1994-1997 Matt Thomas (m...@3am-software.com)
@@ -37,7 +37,7 @@
  *   board which support 21040, 21041, or 21140 (mostly).
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.150.8.1 2018/07/26 23:55:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.150.8.2 2018/07/31 16:03:37 martin Exp $");
 
 #define	TULIP_HDR_DATA
 
@@ -3639,10 +3639,6 @@ tulip_rx_intr(
 #endif /* TULIP_BUS_DMA */
 
 	eh = *mtod(ms, struct ether_header *);
-	if (sc->tulip_bpf != NULL) {
-		if (me == ms)
-		bpf_tap(ifp, mtod(ms, void *), total_len);
-	}
 	sc->tulip_flags |= TULIP_RXACT;
 	if ((sc->tulip_flags & (TULIP_PROMISC|TULIP_HASHONLY))
 		&& (eh.ether_dhost[0] & 1) == 0



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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 23:21:54 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_82599.c ixgbe_api.c
ixgbe_type.h ixgbe_x540.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #935):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.162
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.21
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.35
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.16
Apply changes of FreeBSD ix-3.2.18.tgz:
  - Add IXGBE_DEV_ID_82599_LS(0x154f) support.
  - Increase timeout for newer than ixgbe_mac_X550 (i.e. Xeon-D and Denverton)
in ixgbe_acquire_swfw_sync_X540().
  - Add some unused macros (IXGBE_FW_LESM_*).
--
Remove nmbclusters check. We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.
The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.20 -r1.88.2.21 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.3 -r1.14.8.4 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.15.8.3 -r1.15.8.4 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.22.2.5 -r1.22.2.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.9.6.3 -r1.9.6.4 src/sys/dev/pci/ixgbe/ixgbe_x540.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.20 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.21
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.20	Sat Jun  9 14:59:43 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Jul 26 23:21:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.20 2018/06/09 14:59:43 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.21 2018/07/26 23:21:54 snj Exp $ */
 
 /**
 
@@ -392,9 +392,6 @@ static int ixgbe_enable_rss = 1;
 SYSCTL_INT(_hw_ix, OID_AUTO, enable_rss, CTLFLAG_RDTUN, _enable_rss, 0,
 "Enable Receive-Side Scaling (RSS)");
 
-/* Keep running tab on them for sanity check */
-static int ixgbe_total_ports;
-
 #if 0
 static int (*ixgbe_start_locked)(struct ifnet *, struct tx_ring *);
 static int (*ixgbe_ring_empty)(struct ifnet *, pcq_t *);
@@ -929,21 +926,6 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_tx_desc = ixgbe_txd;
 
-	/*
-	 * With many RX rings it is easy to exceed the
-	 * system mbuf allocation. Tuning nmbclusters
-	 * can alleviate this.
-	 */
-	if (nmbclusters > 0) {
-		int s;
-		s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports;
-		if (s > nmbclusters) {
-			aprint_error_dev(dev, "RX Descriptors exceed "
-			"system mbuf max, using default instead!\n");
-			ixgbe_rxd = DEFAULT_RXD;
-		}
-	}
-
 	if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
 	ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) {
 		aprint_error_dev(dev, "RXD config issue, using default!\n");
@@ -5956,7 +5938,6 @@ ixgbe_lookup(const struct pci_attach_arg
 			(ent->subvendor_id == 0)) &&
 		((PCI_SUBSYS_ID(subid) == ent->subdevice_id) ||
 			(ent->subdevice_id == 0))) {
-			++ixgbe_total_ports;
 			return ent;
 		}
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.14.8.3 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.14.8.4
--- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.14.8.3	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c	Thu Jul 26 23:21:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82599.c,v 1.14.8.3 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe_82599.c,v 1.14.8.4 2018/07/26 23:21:54 snj Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -566,6 +566,9 @@ enum ixgbe_media_type ixgbe_get_media_ty
 	case IXGBE_DEV_ID_82599_T3_LOM:
 		media_type = ixgbe_media_type_copper;
 		break;
+	case IXGBE_DEV_ID_82599_LS:
+		media_type = ixgbe_media_type_fiber_lco;
+		break;
 	case IXGBE_DEV_ID_82599_QSFP_SF_QP:
 		media_type = ixgbe_media_type_fiber_qsfp;
 		break;

Index: src/sys/dev/pci/ixgbe/ixgbe_api.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_api.c:1.15.8.3 src/sys/dev/pci/ixgbe/ixgbe_api.c:1.15.8.4
--- src/sys/dev/pci/ixgbe/ixgbe_api.c:1.15.8.3	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_api.c	Thu Jul 26 23:21:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.c,v 1.15.8.3 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe_api.c,v 1.15.8.4 2018/07/26 23:21:54 snj Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -173,6 +173,7 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *
 	case IXGBE_DEV_ID_82599_SFP_SF_QP:
 	case 

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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 23:16:10 UTC 2018

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

Log Message:
regen for ticket 934


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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 23:14:37 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #934):
sys/dev/pci/pcidevs: 1.1332-1333, 1335-1339, 1341-1344 via patch
- Add Symbios/LSI RAID and SAS controllers.
- Add some broadcom 802.11ac wifi devices.
- Add some Marvell Yukon devices.
- Add Intel 82Q45 IDER.
- Add some Intel 4 series chipset devices.
- Add some Intel 82965 devices.
- Change Intel 0x2a06 from IDE to IDER.
- Add a bunch of nvidia devices from various generations.
- Add two more Yukon variants (from OpenBSD).
- Add Mobility Radeon HD 4300(0x9552) and Mobility Radeon HD
  4500(0x9553) from OpenBSD.
- Add nSYS Technologies.
- Add Western Digital (Sandisk)  WD Black NVMe SSD as per suggestion
  from thorpej@


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.8 src/sys/dev/pci/pcidevs:1.1289.2.9
--- src/sys/dev/pci/pcidevs:1.1289.2.8	Thu Jun 14 19:57:24 2018
+++ src/sys/dev/pci/pcidevs	Thu Jul 26 23:14:37 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.8 2018/06/14 19:57:24 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.9 2018/07/26 23:14:37 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -596,6 +596,7 @@ vendor GEOCAST		0x15a1	Geocast Network S
 vendor BLUESTEEL	0x15ab	Bluesteel Networks
 vendor VMWARE		0x15ad	VMware
 vendor MELLANOX		0x15b3	Mellanox Technologies
+vendor SANDISK		0x15b7	Western Digital (SanDisk)
 vendor AGILENT		0x15bc	Agilent Technologies
 vendor SUPERMICRO	0x15d9	Super Micro Computer Inc
 vendor NDC		0x15e8	National Datacomm
@@ -613,6 +614,7 @@ vendor LINKSYS		0x1737	Linksys
 vendor ALTIMA		0x173b	Altima
 vendor ANTARES		0x1754	Antares Microsystems
 vendor CAVIUM		0x177d	Cavium
+vendor NSYS		0x1794	nSYS Technologies
 vendor FZJZEL		0x1796	FZ Juelich / ZEL
 vendor BELKIN		0x1799	Belkin
 vendor HAWKING		0x17b3	Hawking Technology
@@ -1605,6 +1607,8 @@ product ATI RADEON_HD2400_M72	0x94c9	Mob
 product ATI RADEON_HD2400	0x94cc	Radeon HD 2400
 product ATI RADEON_HD3870	0x9501	Radeon HD3870
 product ATI RADEON_HD4350	0x954f	Radeon HD4350
+product ATI RADEON_HD4300_M	0x9552	Mobility Radeon HD 4300
+product ATI RADEON_HD4500_M	0x9553	Mobility Radeon HD 4500
 product ATI RADEON_HD4500_M93	0x9555	Mobility Radeon HD 4500
 product ATI RADEON_HD2600_M76	0x9581	Mobility Radeon HD 2600
 product ATI RADEON_HD2600PROAGP	0x9587	Radeon HD2600 Pro AGP
@@ -1889,6 +1893,8 @@ product BROADCOM BCM43224	0x4353	BCM4322
 product BROADCOM BCM43225	0x4357	BCM43225 2.4GHz 802.11
 product BROADCOM BCM43227	0x4358	BCM43227 2.4GHz 802.11
 product BROADCOM BCM43228	0x4359	BCM43228 Dualband 802.11
+product BROADCOM BCM4350	0x43a3	BCM4350 802.11ac Wireless Network Adapter
+product BROADCOM BCM43602	0x43ba	BCM43602 802.11ac Wireless LAN SoC
 product BROADCOM BCM4401	0x4401	BCM4401 10/100 Ethernet
 product BROADCOM BCM4401_B0	0x4401	BCM4401-B0 10/100 Ethernet
 product BROADCOM BCM4727	0x4727	BCM4727 802.11b/g/n
@@ -2280,6 +2286,7 @@ product DLINK DGE528T		0x4300	DGE-528T G
 product DLINK DGE560T		0x4b00	DGE-560T Gigabit Ethernet
 product DLINK DGE560T_2		0x4b01	DGE-560T_2 Gigabit Ethernet
 product DLINK DGE560SX		0x4b02	DGE-560SX
+product DLINK DGE550T_B1	0x4b03	DGE-550T B1
 product DLINK DGE530T		0x4c00	DGE-530T Gigabit Ethernet
 
 /* Distributed Processing Technology products */
@@ -2500,6 +2507,7 @@ product MARVELL YUKON_8039	0x4353	Yukon 
 product MARVELL YUKON_8040	0x4354	Yukon 88E8040
 product MARVELL YUKON_8040T	0x4355	Yukon 88E8040T
 product MARVELL YUKON_C033	0x4356	Yukon 88EC033
+product MARVELL YUKON_8042	0x4357	Yukon 88E8042
 product MARVELL YUKON_8052	0x4360	Yukon 88E8052
 product MARVELL YUKON_8050	0x4361	Yukon 88E8050
 product MARVELL YUKON_8053	0x4362	Yukon 88E8053
@@ -2511,6 +2519,13 @@ product MARVELL YUKON_C032	0x4367	Yukon 
 product MARVELL YUKON_C034	0x4368	Yukon 88EC034
 product MARVELL YUKON_C042	0x4369	Yukon 88EC042
 product MARVELL YUKON_8058	0x436a	Yukon 88E8058
+product MARVELL YUKON_8071	0x436b	Yukon 88E8071
+product MARVELL YUKON_8072	0x436c	Yukon 88E8072
+product MARVELL YUKON_8055_2	0x436d	Yukon 88E8055
+product MARVELL YUKON_8075	0x4370	Yukon 88E8075
+product MARVELL YUKON_8057	0x4380	Yukon 88E8057
+product MARVELL YUKON_8059	0x4381	Yukon 88E8059
+product MARVELL YUKON_8079	0x4382	Yukon 88E8079
 product MARVELL GT64120		0x4620	GT-64120 System Controller
 product MARVELL BELKIN		0x5005	Belkin Gigabit Ethernet
 product MARVELL 88SX5040	0x5040	88SX5040 SATA
@@ -4023,14 +4038,24 @@ product INTEL 80862A01		0x2a01  80862A01
 product INTEL 82965PM_IGD	0x2a02	82965PM Integrated Graphics Device
 product INTEL 82965PM_IGD_1	0x2a03	82965PM Integrated Graphics Device
 product INTEL 

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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 23:11:59 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #933):
sys/dev/pci/pci_subr.c: revision 1.202
sys/dev/pci/pcireg.h: revision 1.139
sys/dev/pci/ppbreg.h: revision 1.9
VGA 16 bit decode bit is not bit 3 but bit 4.
--
- Print Power Management Control/status register in 32bit.
- Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.5 -r1.183.2.6 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.4 -r1.130.2.5 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/dev/pci/ppbreg.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.5 src/sys/dev/pci/pci_subr.c:1.183.2.6
--- src/sys/dev/pci/pci_subr.c:1.183.2.5	Thu Jul 26 21:07:19 2018
+++ src/sys/dev/pci/pci_subr.c	Thu Jul 26 23:11:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.5 2018/07/26 21:07:19 snj Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.6 2018/07/26 23:11:59 snj 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.5 2018/07/26 21:07:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.6 2018/07/26 23:11:59 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1172,11 +1172,9 @@ static void
 pci_conf_print_pcipm_cap(const pcireg_t *regs, int capoff)
 {
 	uint16_t caps, pmcsr;
-	pcireg_t reg;
 
 	caps = regs[o2i(capoff)] >> PCI_PMCR_SHIFT;
-	reg = regs[o2i(capoff + PCI_PMCSR)];
-	pmcsr = reg & 0x;
+	pmcsr = regs[o2i(capoff + PCI_PMCSR)];
 
 	printf("\n  PCI Power Management Capabilities Register\n");
 
@@ -1195,7 +1193,7 @@ pci_conf_print_pcipm_cap(const pcireg_t 
 	onoff("PME# support D3 hot", caps, PCI_PMCR_PME_D3HOT);
 	onoff("PME# support D3 cold", caps, PCI_PMCR_PME_D3COLD);
 
-	printf("Control/status register: 0x%04x\n", pmcsr);
+	printf("Control/status register: 0x%08x\n", pmcsr);
 	printf("  Power state: D%d\n", pmcsr & PCI_PMCSR_STATE_MASK);
 	onoff("PCI Express reserved", (pmcsr >> 2), 1);
 	onoff("No soft reset", pmcsr, PCI_PMCSR_NO_SOFTRST);
@@ -1207,11 +1205,11 @@ pci_conf_print_pcipm_cap(const pcireg_t 
 	__SHIFTOUT(pmcsr, PCI_PMCSR_DATASCL_MASK));
 	onoff("PME# status", pmcsr, PCI_PMCSR_PME_STS);
 	printf("Bridge Support Extensions register: 0x%02x\n",
-	(reg >> 16) & 0xff);
-	onoff("B2/B3 support", reg, PCI_PMCSR_B2B3_SUPPORT);
-	onoff("Bus Power/Clock Control Enable", reg, PCI_PMCSR_BPCC_EN);
-	printf("Data register: 0x%02x\n", __SHIFTOUT(reg, PCI_PMCSR_DATA));
-	
+	(pmcsr >> 16) & 0xff);
+	onoff("B2/B3 support", pmcsr, PCI_PMCSR_B2B3_SUPPORT);
+	onoff("Bus Power/Clock Control Enable", pmcsr, PCI_PMCSR_BPCC_EN);
+	printf("Data register: 0x%02x\n",
+	   __SHIFTOUT(pmcsr, PCI_PMCSR_DATA));
 }
 
 /* XXX pci_conf_print_vpd_cap */

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.130.2.4 src/sys/dev/pci/pcireg.h:1.130.2.5
--- src/sys/dev/pci/pcireg.h:1.130.2.4	Thu Jul 26 21:07:19 2018
+++ src/sys/dev/pci/pcireg.h	Thu Jul 26 23:11:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.130.2.4 2018/07/26 21:07:19 snj Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.130.2.5 2018/07/26 23:11:59 snj Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1327,7 +1327,7 @@ typedef u_int8_t pci_intr_line_t;
 #define   PCI_BRIDGE_CONTROL_SERR		(1 <<  1)
 #define   PCI_BRIDGE_CONTROL_ISA		(1 <<  2)
 #define   PCI_BRIDGE_CONTROL_VGA		(1 <<  3)
-#define   PCI_BRIDGE_CONTROL_VGA16		(1 <<  3)
+#define   PCI_BRIDGE_CONTROL_VGA16		(1 <<  4)
 #define   PCI_BRIDGE_CONTROL_MABRT		(1 <<  5)
 #define   PCI_BRIDGE_CONTROL_SECBR		(1 <<  6)
 #define   PCI_BRIDGE_CONTROL_SECFASTB2B		(1 <<  7)

Index: src/sys/dev/pci/ppbreg.h
diff -u src/sys/dev/pci/ppbreg.h:1.7.2.1 src/sys/dev/pci/ppbreg.h:1.7.2.2
--- src/sys/dev/pci/ppbreg.h:1.7.2.1	Mon Feb 26 00:56:29 2018
+++ src/sys/dev/pci/ppbreg.h	Thu Jul 26 23:11:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppbreg.h,v 1.7.2.1 2018/02/26 00:56:29 snj Exp $	*/
+/*	$NetBSD: ppbreg.h,v 1.7.2.2 2018/07/26 23:11:59 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -100,7 +100,7 @@
 #define PPB_BC_SERR_ENABLE (1U << (1 + PPB_BC_BITBASE))
 #define PPB_BC_ISA_ENABLE  (1U << (2 + PPB_BC_BITBASE))
 #define PPB_BC_VGA_ENABLE  (1U << (3 + PPB_BC_BITBASE))
-#define PPB_BC_VGA16_ENABLE(1U << (3 + PPB_BC_BITBASE))
+#define PPB_BC_VGA16_ENABLE(1U << (4 + PPB_BC_BITBASE))
 #define PPB_BC_MASTER_ABORT_MODE   (1U << (5 + PPB_BC_BITBASE))
 #define PPB_BC_SECONDARY_RESET (1U << (6 + PPB_BC_BITBASE))
 #define	PPB_BC_FAST_B2B_ENABLE		   

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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 21:07:19 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #930):
sys/dev/pci/pci_subr.c: revision 1.201
sys/dev/pci/pcireg.h: revision 1.138
  Fix typo. s/TPL/TLP/


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.4 -r1.183.2.5 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.3 -r1.130.2.4 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.183.2.4 src/sys/dev/pci/pci_subr.c:1.183.2.5
--- src/sys/dev/pci/pci_subr.c:1.183.2.4	Mon Feb 26 00:56:29 2018
+++ src/sys/dev/pci/pci_subr.c	Thu Jul 26 21:07:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.4 2018/02/26 00:56:29 snj Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.5 2018/07/26 21:07:19 snj 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.4 2018/02/26 00:56:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.5 2018/07/26 21:07:19 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3846,7 +3846,7 @@ pci_conf_print_dpc_cap(const pcireg_t *r
 	extcapoff + PCI_DPC_RPPIO_HLOG);
 	printf("RP PIO ImpSpec Log Register: start from 0x%03x\n",
 	extcapoff + PCI_DPC_RPPIO_IMPSLOG);
-	printf("RP PIO TPL Prefix Log Register: start from 0x%03x\n",
+	printf("RP PIO TLP Prefix Log Register: start from 0x%03x\n",
 	extcapoff + PCI_DPC_RPPIO_TLPPLOG);
 }
 

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.130.2.3 src/sys/dev/pci/pcireg.h:1.130.2.4
--- src/sys/dev/pci/pcireg.h:1.130.2.3	Mon Feb 26 00:56:29 2018
+++ src/sys/dev/pci/pcireg.h	Thu Jul 26 21:07:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.130.2.3 2018/02/26 00:56:29 snj Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.130.2.4 2018/07/26 21:07:19 snj Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -2029,7 +2029,7 @@ struct pci_rom {
   /* Same */
 #define	PCI_DPC_RPPIO_HLOG 0x20	/* RP PIO Header Log Register */
 #define	PCI_DPC_RPPIO_IMPSLOG 0x30 /* RP PIO ImpSpec Log Register */
-#define	PCI_DPC_RPPIO_TLPPLOG 0x34 /* RP PIO TPL Prefix Log Register */
+#define	PCI_DPC_RPPIO_TLPPLOG 0x34 /* RP PIO TLP Prefix Log Register */
 
 /*
  * Extended capability ID: 0x001e



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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 20:40:39 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #928):
sys/dev/pci/if_wm.c: 1.573-1.576, 1.579 and 1.582 via patch
wm(4):
- Count timeout correctly. This change reduce timeout value for 80003
  as expected. Reported by mouse@.
- Print "device timeout (lost interrupt)"  when all descriptors in a
  queue are free.
- Rename txq_watchdog to txq_sending to make the meaning clear.
- KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.20 -r1.508.4.21 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.20 src/sys/dev/pci/if_wm.c:1.508.4.21
--- src/sys/dev/pci/if_wm.c:1.508.4.20	Thu Jun  7 17:42:25 2018
+++ src/sys/dev/pci/if_wm.c	Thu Jul 26 20:40:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.20 2018/06/07 17:42:25 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.21 2018/07/26 20:40:39 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.20 2018/06/07 17:42:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.21 2018/07/26 20:40:39 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -193,7 +193,7 @@ static int wm_watchdog_timeout = WM_WATC
 /*
  * Transmit descriptor list size.  Due to errata, we can only have
  * 256 hardware descriptors in the ring on < 82544, but we use 4096
- * on >= 82544.  We tell the upper layers that they can queue a lot
+ * on >= 82544. We tell the upper layers that they can queue a lot
  * of packets, and we go ahead and manage up to 64 (16 for the i82547)
  * of them at a time.
  *
@@ -247,13 +247,13 @@ static int wm_watchdog_timeout = WM_WATC
 
 typedef union txdescs {
 	wiseman_txdesc_t sctxu_txdescs[WM_NTXDESC_82544];
-	nq_txdesc_t  sctxu_nq_txdescs[WM_NTXDESC_82544];
+	nq_txdesc_t	 sctxu_nq_txdescs[WM_NTXDESC_82544];
 } txdescs_t;
 
 typedef union rxdescs {
 	wiseman_rxdesc_t sctxu_rxdescs[WM_NRXDESC];
-	ext_rxdesc_t  sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
-	nq_rxdesc_t  sctxu_nq_rxdescs[WM_NRXDESC]; /* 82575 and newer */
+	ext_rxdesc_t	  sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
+	nq_rxdesc_t	 sctxu_nq_rxdescs[WM_NRXDESC]; /* 82575 and newer */
 } rxdescs_t;
 
 #define	WM_CDTXOFF(txq, x)	((txq)->txq_descsize * (x))
@@ -271,9 +271,9 @@ struct wm_txsoft {
 };
 
 /*
- * Software state for receive buffers.  Each descriptor gets a
- * 2k (MCLBYTES) buffer and a DMA map.  For packets which fill
- * more than one buffer, we chain them together.
+ * Software state for receive buffers. Each descriptor gets a 2k (MCLBYTES)
+ * buffer and a DMA map. For packets which fill more than one buffer, we chain
+ * them together.
  */
 struct wm_rxsoft {
 	struct mbuf *rxs_mbuf;		/* head of our mbuf chain */
@@ -301,14 +301,14 @@ struct wm_softc;
 	struct evcnt qname##_ev_##evname;
 
 #define WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, evtype)	\
-	do{\
+	do {\
 		snprintf((q)->qname##_##evname##_evcnt_name,		\
 		sizeof((q)->qname##_##evname##_evcnt_name),		\
 		"%s%02d%s", #qname, (qnum), #evname);		\
 		evcnt_attach_dynamic(&(q)->qname##_ev_##evname,		\
 		(evtype), NULL, (xname),\
 		(q)->qname##_##evname##_evcnt_name);		\
-	}while(0)
+	} while (0)
 
 #define WM_Q_MISC_EVCNT_ATTACH(qname, evname, q, qnum, xname)		\
 	WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, EVCNT_TYPE_MISC)
@@ -333,7 +333,7 @@ struct wm_txqueue {
 	int txq_ndesc;			/* must be a power of two */
 	size_t txq_descsize;		/* a tx descriptor size */
 	txdescs_t *txq_descs_u;
-bus_dmamap_t txq_desc_dmamap;	/* control data DMA map */
+	bus_dmamap_t txq_desc_dmamap;	/* control data DMA map */
 	bus_dma_segment_t txq_desc_seg;	/* control data segment */
 	int txq_desc_rseg;		/* real number of control segment */
 #define	txq_desc_dma	txq_desc_dmamap->dm_segs[0].ds_addr
@@ -370,7 +370,7 @@ struct wm_txqueue {
 
 	bool txq_stopping;
 
-	bool txq_watchdog;
+	bool txq_sending;
 	time_t txq_lastsent;
 
 	uint32_t txq_packets;		/* for AIM */
@@ -384,7 +384,7 @@ struct wm_txqueue {
 		/* XXX not used? */
 
 	WM_Q_EVCNT_DEFINE(txq, txipsum)		/* IP checksums comp. out-bound */
-	WM_Q_EVCNT_DEFINE(txq,txtusum)		/* TCP/UDP cksums comp. out-bound */
+	WM_Q_EVCNT_DEFINE(txq, txtusum)		/* TCP/UDP cksums comp. out-bound */
 	WM_Q_EVCNT_DEFINE(txq, txtusum6)	/* TCP/UDP v6 cksums comp. out-bound */
 	WM_Q_EVCNT_DEFINE(txq, txtso)		/* TCP seg offload out-bound (IPv4) */
 	WM_Q_EVCNT_DEFINE(txq, txtso6)		/* TCP seg offload out-bound (IPv6) */
@@ -442,7 +442,7 @@ struct wm_rxqueue {
 };
 
 struct wm_queue {
-	int wmq_id;			/* index of transmit and 

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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 20:32:38 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #926):
sys/dev/pci/ichsmb.c: 1.52, 1.56
Add C620 devices.
--
Add Apollo Lake and Gemini Lake devices.


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

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

Modified files:

Index: src/sys/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.50.6.2 src/sys/dev/pci/ichsmb.c:1.50.6.3
--- src/sys/dev/pci/ichsmb.c:1.50.6.2	Mon Apr 16 14:21:48 2018
+++ src/sys/dev/pci/ichsmb.c	Thu Jul 26 20:32:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.2 2018/04/16 14:21:48 martin Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.50.6.3 2018/07/26 20:32:38 snj Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.2 2018/04/16 14:21:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.3 2018/07/26 20:32:38 snj Exp $");
 
 #include 
 #include 
@@ -122,11 +122,15 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB:
 		case PCI_PRODUCT_INTEL_BSW_PCU_SMB:
+		case PCI_PRODUCT_INTEL_APL_SMB:
+		case PCI_PRODUCT_INTEL_GLK_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:
 		case PCI_PRODUCT_INTEL_C600_SMB_1:
 		case PCI_PRODUCT_INTEL_C600_SMB_2:
 		case PCI_PRODUCT_INTEL_C610_SMB:
+		case PCI_PRODUCT_INTEL_C620_SMB:
+		case PCI_PRODUCT_INTEL_C620_SMB_S:
 		case PCI_PRODUCT_INTEL_EP80579_SMB:
 		case PCI_PRODUCT_INTEL_DH89XXCC_SMB:
 		case PCI_PRODUCT_INTEL_DH89XXCL_SMB:



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

2018-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 22 10:15:18 UTC 2018

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

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

sys/dev/pci/ld_virtio.c: revision 1.19-1.21,1.23

remove trailing whitespace

add feature/register definitions from virtio-v1.0-cs04

unload payload dma map upon command completion

Make ld_virtio aware of a possible device-side write cache.

The virtio block device capacity config item is expressed always in
request protocol sector units of 512 bytes.

Also, add and use a symbolic constant to refer to request protocol
sector units.

destroy 'sc_sync_wait' condvar and mutex upon detach


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

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

Modified files:

Index: src/sys/dev/pci/ld_virtio.c
diff -u src/sys/dev/pci/ld_virtio.c:1.15.6.1 src/sys/dev/pci/ld_virtio.c:1.15.6.2
--- src/sys/dev/pci/ld_virtio.c:1.15.6.1	Fri Sep  1 09:59:11 2017
+++ src/sys/dev/pci/ld_virtio.c	Fri Jun 22 10:15:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_virtio.c,v 1.15.6.1 2017/09/01 09:59:11 martin Exp $	*/
+/*	$NetBSD: ld_virtio.c,v 1.15.6.2 2018/06/22 10:15:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.15.6.1 2017/09/01 09:59:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.15.6.2 2018/06/22 10:15:18 martin Exp $");
 
 #include 
 #include 
@@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,
 #define VIRTIO_BLK_CONFIG_GEOMETRY_H	18 /* 8bit */
 #define VIRTIO_BLK_CONFIG_GEOMETRY_S	19 /* 8bit */
 #define VIRTIO_BLK_CONFIG_BLK_SIZE	20 /* 32bit */
+#define VIRTIO_BLK_CONFIG_WRITEBACK	32 /* 8bit */
 
 /* Feature bits */
 #define VIRTIO_BLK_F_BARRIER	(1<<0)
@@ -70,15 +71,19 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,
 #define VIRTIO_BLK_F_BLK_SIZE	(1<<6)
 #define VIRTIO_BLK_F_SCSI	(1<<7)
 #define VIRTIO_BLK_F_FLUSH	(1<<9)
+#define VIRTIO_BLK_F_TOPOLOGY	(1<<10)
+#define VIRTIO_BLK_F_CONFIG_WCE	(1<<11)
 
-/*  
+/*
  * Each block request uses at least two segments - one for the header
  * and one for the status.
-*/ 
+*/
 #define	VIRTIO_BLK_MIN_SEGMENTS	2
 
 #define VIRTIO_BLK_FLAG_BITS \
 	VIRTIO_COMMON_FLAG_BITS \
+	"\x0c""CONFIG_WCE" \
+	"\x0b""TOPOLOGY" \
 	"\x0a""FLUSH" \
 	"\x08""SCSI" \
 	"\x07""BLK_SIZE" \
@@ -91,11 +96,16 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,
 /* Command */
 #define VIRTIO_BLK_T_IN		0
 #define VIRTIO_BLK_T_OUT	1
+#define VIRTIO_BLK_T_FLUSH	4
 #define VIRTIO_BLK_T_BARRIER	0x8000
 
+/* Sector */
+#define VIRTIO_BLK_BSIZE	512
+
 /* Status */
 #define VIRTIO_BLK_S_OK		0
 #define VIRTIO_BLK_S_IOERR	1
+#define VIRTIO_BLK_S_UNSUPP	2
 
 /* Request header structure */
 struct virtio_blk_req_hdr {
@@ -103,7 +113,7 @@ struct virtio_blk_req_hdr {
 	uint32_t	ioprio;
 	uint64_t	sector;
 } __packed;
-/* 512*virtio_blk_req_hdr.sector byte payload and 1 byte status follows */
+/* payload and 1 byte status follows */
 
 
 /*
@@ -113,6 +123,7 @@ struct virtio_blk_req {
 	struct virtio_blk_req_hdr	vr_hdr;
 	uint8_tvr_status;
 	struct buf			*vr_bp;
+#define DUMMY_VR_BP((void *)1)
 	bus_dmamap_t			vr_cmdsts;
 	bus_dmamap_t			vr_payload;
 };
@@ -128,6 +139,13 @@ struct ld_virtio_softc {
 	bus_dma_segment_t	sc_reqs_seg;
 
 	int			sc_readonly;
+
+	enum {
+		SYNC_FREE, SYNC_BUSY, SYNC_DONE
+	}			sc_sync_use;
+	kcondvar_t		sc_sync_wait;
+	kmutex_t		sc_sync_wait_lock;
+	uint8_t			sc_sync_status;
 };
 
 static int	ld_virtio_match(device_t, cfdata_t, void *);
@@ -151,6 +169,7 @@ ld_virtio_match(device_t parent, cfdata_
 static int ld_virtio_vq_done(struct virtqueue *);
 static int ld_virtio_dump(struct ld_softc *, void *, int, int);
 static int ld_virtio_start(struct ld_softc *, struct buf *);
+static int ld_virtio_ioctl(struct ld_softc *, u_long, void *, int32_t, bool);
 
 static int
 ld_virtio_alloc_reqs(struct ld_virtio_softc *sc, int qsize)
@@ -263,7 +282,8 @@ ld_virtio_attach(device_t parent, device
 	virtio_child_attach_start(vsc, self, IPL_BIO, >sc_vq,
 	NULL, virtio_vq_intr, 0,
 	(VIRTIO_BLK_F_SIZE_MAX | VIRTIO_BLK_F_SEG_MAX |
-	 VIRTIO_BLK_F_GEOMETRY | VIRTIO_BLK_F_RO | VIRTIO_BLK_F_BLK_SIZE),
+	 VIRTIO_BLK_F_GEOMETRY | VIRTIO_BLK_F_RO | VIRTIO_BLK_F_BLK_SIZE |
+	 VIRTIO_BLK_F_FLUSH | VIRTIO_BLK_F_CONFIG_WCE),
 	VIRTIO_BLK_FLAG_BITS);
 
 	features = virtio_features(vsc);
@@ -277,7 +297,7 @@ ld_virtio_attach(device_t parent, device
 		ld->sc_secsize = virtio_read_device_config_4(vsc,
 	VIRTIO_BLK_CONFIG_BLK_SIZE);
 	} else
-		ld->sc_secsize = 512;
+		ld->sc_secsize = VIRTIO_BLK_BSIZE;
 
 	/* At least genfs_io assumes maxxfer == MAXPHYS. */
 	if (features & VIRTIO_BLK_F_SIZE_MAX) {
@@ -327,7 +347,7 @@ ld_virtio_attach(device_t parent, device
 
 	ld->sc_dv = self;
 	

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

2018-06-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 15 02:13:50 UTC 2018

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

Log Message:
 Regen for ticket #878.


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.7 -r1.1281.2.8 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.7 -r1.1280.2.8 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1281.2.7 src/sys/dev/pci/pcidevs.h:1.1281.2.8
--- src/sys/dev/pci/pcidevs.h:1.1281.2.7	Thu Jun  7 18:13:38 2018
+++ src/sys/dev/pci/pcidevs.h	Fri Jun 15 02:13:36 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1281.2.7 2018/06/07 18:13:38 martin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1281.2.8 2018/06/15 02:13:36 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1289.2.7 2018/06/07 18:12:17 martin Exp
+ *	NetBSD: pcidevs,v 1.1289.2.8 2018/06/14 19:57:24 martin Exp
  */
 
 /*
@@ -6516,6 +6516,7 @@
 #define	PCI_PRODUCT_REALTEK_RTS5227	0x5227		/* RTS5227 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTS5229	0x5229		/* RTS5229 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTS5249	0x5249		/* RTS5249 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTS525A	0x525A		/* RTS525A PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8402	0x5286		/* RTL8402 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8411B	0x5287		/* RTL8411B PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8411	0x5289		/* RTL8411 PCI-E Card Reader */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1280.2.7 src/sys/dev/pci/pcidevs_data.h:1.1280.2.8
--- src/sys/dev/pci/pcidevs_data.h:1.1280.2.7	Thu Jun  7 18:13:39 2018
+++ src/sys/dev/pci/pcidevs_data.h	Fri Jun 15 02:13:36 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1280.2.7 2018/06/07 18:13:39 martin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1280.2.8 2018/06/15 02:13:36 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1289.2.7 2018/06/07 18:12:17 martin Exp
+ *	NetBSD: pcidevs,v 1.1289.2.8 2018/06/14 19:57:24 martin Exp
  */
 
 /*
@@ -11406,436 +11406,438 @@ static const uint16_t pci_products[] = {
 	29725, 16793, 11252, 15400, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5249, 
 	29733, 16793, 11252, 15400, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8402, 
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS525A, 
 	29741, 16793, 11252, 15400, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8402, 
 	29749, 16793, 11252, 15400, 0,
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	29757, 16793, 11252, 15400, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411, 
-	29758, 16793, 11252, 15400, 0,
+	29766, 16793, 11252, 15400, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029, 
-	29766, 5603, 0,
+	29774, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139D, 
-	29771, 5705, 5603, 0,
+	29779, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8100, 
-	29777, 5705, 5603, 0,
+	29785, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, 
-	29782, 5705, 5603, 0,
+	29790, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
-	29787, 5705, 5603, 0,
+	29795, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138, 
-	29805, 5705, 5603, 0,
+	29813, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, 
 	7475, 5705, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC, 
-	29810, 5618, 5603, 0,
+	29818, 5618, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8168, 
-	29824, 5618, 5603, 0,
+	29832, 5618, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169, 
-	29834, 5618, 5603, 0,
+	29842, 5618, 5603, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188CE, 
-	29844, 4759, 4534, 29854, 16793, 17328, 0,
+	29852, 4759, 4534, 29862, 16793, 17328, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192CE, 
-	29862, 4759, 4534, 29854, 16793, 17328, 0,
+	29870, 4759, 4534, 29862, 16793, 17328, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188EE, 
-	29872, 4759, 4534, 29854, 16793, 17328, 0,
+	29880, 4759, 4534, 29862, 16793, 17328, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180, 
-	29882, 7562, 0,
+	29890, 7562, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
-	29887, 29892, 0,
+	29895, 29900, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_PPB, 
-	29904, 8258, 0,
+	29912, 8258, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_QXL, 
-	29909, 234, 0,
+	29917, 234, 0,
 	

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

2018-06-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  9 14:59:43 UTC 2018

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

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

sys/dev/pci/ixgbe/ix_txrx.c 1.40-1.47 (patch)
sys/dev/pci/ixgbe/ixgbe.c   1.148,1.149,1.151,
1.152,1.154,
1.155,1.157-1.160 
(patch)
sys/dev/pci/ixgbe/ixgbe.h   1.43,1.44,1.46,1.49 
(patch)
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.7 (patch)
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.8 (patch)
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.22 (patch)
sys/dev/pci/ixgbe/ixv.c 1.100-1.104 (patch)
sys/dev/pci/ixgbe/ixv.c 1.94,1.95,1.99 (patch)

 Remove unused structure entries. No functional change.
 -
 Remove unused IXGBE_FC_HI and IXGBE_FC_LO. The watermark of the flow control
is automatically calculated from the size of the packet buffer.
 -
 Use ixgbe_eitr_write() when writing the EITR for the link interrupt like
queue's EITR to write the register safely. This change is not relatively
so important than queue's EITR because link's EITR is written in if_init().
 -
 Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

 One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

 Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

 I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.
 -
Count some register correctly:
- QPRDC register is only for 82599 and newer.
- Count IXGBE_QPRDC, PX{ON,OFF}{T,R}XC[NT].
 The TQSMR register is not for receiving but for transmitting, so move the
initialization from ixgbe_initialize_receive_units() to
ixgbe_initialize_transmit_units(). No functional change.
 -
 Whitespace fix. No functional change.
 -
 Add rxd_nxck (Receive Descriptor next to check) read only sysctl.
 Don't check IFF_RUNNING in ixgbe_rxeof(). Doing break and leaving a deacriptor
with DD bit is worse than just processing the entry. And it's also racy to
check IFF_RUNNING in rxeof(). If you'd like to strictly obey IFF_RUNNING,
it would be better to do it in the upper layer.
 Same as DragonFly (a part of 79251f5ebe4cf9dd2f3e6aed590e09d756d39922).
 Add "bool txr_no_space" for TX descriptor shortage. Use it like IFF_OACTIVE.
 Clear que->disabled_count in {ixgbe,ixv}_init_locked(). Without this,
interrupt mask state and EIMS may mismatch and if_init doesn't recover
from TX/RX stall problem.
 This change itself doesn't fix PR#53294.
 -
 Add hw.ixgN.debug sysctl. "sysctl -w hw.ixgN.debug=1" dumps some registers
to console.
 -
Constify several variables in ixgbe/ so that they land in .rodata (1038
bytes).
 -
 Don't call ixgbe_rearm_queues() in ixgbe_local_timer1().
   ixgbe_enable_queue() and ixgbe_disable_queue() try to enable/disable queue
  interrupt safely. It has the internal counter. When a queue's MSI-X is
  received, ixgbe_msix_que() is called (IPL_NET). This function disable the
  queue's interrupt by ixgbe_disable_queue() and issues an softint.
  ixgbe_handle() queue is called by the softint (IPL_SOFTNET), process TX, RX
  and call ixgbe_enable_queue() at the end.

   ixgbe_local_timer1() is a callout and run always on CPU 0 (IPL_SOFTCLOCK).
  When ixgbe_rearm_queues() called, an MSI-X interrupt is issued for a specific
  queue. It may not CPU 0. If this interrupt's ixgbe_msix_que() is called and
  sofint_schedule() is called before the last sofint's softint_execute() is not
  called, the softint_schedule() fails because of SOFTINT_PENDING. It result
  in breaking ixgbe_{enable,disable}_queue()'s internal counter.
   ixgbe_local_timer1() is written not to call ixgbe_rearm_queues() if
  the interrupt is disabled, but it's called because of unknown bug or a race.

  One solution to avoid this problem is to not to use the internal counter,
  but it's little difficult. Another solution is stop using
  ixgbe_rearm_queues() at all. Essentially, ixgbe_rearm_queues() is not
  required (it 

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

2018-06-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  9 14:32:52 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maya in ticket #857):

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

PR/52330: Jia-Ju Bai: mpii driver: a sleep-in-interrupt bug in mpii_intr
Since the enclosing routime mpii_event_raid already calls malloc with
M_NOWAIT, fix the cache routine to do the same. While there check the
result of the cache routine and change some error prints to aprint.


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

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

Modified files:

Index: src/sys/dev/pci/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.8 src/sys/dev/pci/mpii.c:1.8.10.1
--- src/sys/dev/pci/mpii.c:1.8	Mon May  2 19:18:29 2016
+++ src/sys/dev/pci/mpii.c	Sat Jun  9 14:32:52 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8 2016/05/02 19:18:29 christos Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.1 2018/06/09 14:32:52 martin Exp $ */
 /*	OpenBSD: mpii.c,v 1.51 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 2016/05/02 19:18:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.1 2018/06/09 14:32:52 martin Exp $");
 
 #include "bio.h"
 
@@ -3434,26 +3434,34 @@ mpii_event_raid(struct mpii_softc *sc, s
 			case MPII_EVT_IR_CFG_ELEMENT_RC_VOLUME_CREATED:
 if (mpii_find_dev(sc,
 le16toh(ce->vol_dev_handle))) {
-	printf("%s: device %#x is already "
-	"configured\n", DEVNAME(sc),
+	aprint_error_dev(sc->sc_dev,
+	"device %#x is already "
+	"configured\n",
 	le16toh(ce->vol_dev_handle));
 	break;
 }
 dev = malloc(sizeof(*dev), M_DEVBUF,
 M_NOWAIT | M_ZERO);
 if (!dev) {
-	printf("%s: failed to allocate a "
-	"device structure\n", DEVNAME(sc));
+	aprint_error_dev(sc->sc_dev,
+	"can't allocate device structure\n");
 	break;
 }
 SET(dev->flags, MPII_DF_VOLUME);
 dev->slot = sc->sc_vd_id_low;
 dev->dev_handle = le16toh(ce->vol_dev_handle);
 if (mpii_insert_dev(sc, dev)) {
+	aprint_error_dev(sc->sc_dev,
+	"can't insert device structure\n");
+	free(dev, M_DEVBUF);
+	break;
+}
+if (mpii_cache_enable(sc, dev)) {
+	aprint_error_dev(sc->sc_dev,
+	"can't enable device cache\n");
 	free(dev, M_DEVBUF);
 	break;
 }
-mpii_cache_enable(sc, dev);
 sc->sc_vd_count++;
 break;
 			case MPII_EVT_IR_CFG_ELEMENT_RC_REMOVED:
@@ -3515,15 +3523,15 @@ mpii_event_sas(struct mpii_softc *sc, st
 		switch (pe->phy_status & MPII_EVENT_SAS_TOPO_PS_RC_MASK) {
 		case MPII_EVENT_SAS_TOPO_PS_RC_ADDED:
 			if (mpii_find_dev(sc, le16toh(pe->dev_handle))) {
-printf("%s: device %#x is already "
-"configured\n", DEVNAME(sc),
+aprint_error_dev(sc->sc_dev,
+"device %#x is already configured\n",
 le16toh(pe->dev_handle));
 break;
 			}
 			dev = malloc(sizeof(*dev), M_DEVBUF, M_NOWAIT | M_ZERO);
 			if (!dev) {
-printf("%s: failed to allocate a "
-"device structure\n", DEVNAME(sc));
+aprint_error_dev(sc->sc_dev, "can't allocate "
+"device structure\n");
 break;
 			}
 			dev->slot = sc->sc_pd_id_start + tcl->start_phy_num + i;
@@ -3534,6 +3542,8 @@ mpii_event_sas(struct mpii_softc *sc, st
 			dev->enclosure = le16toh(tcl->enclosure_handle);
 			dev->expander = le16toh(tcl->expander_handle);
 			if (mpii_insert_dev(sc, dev)) {
+aprint_error_dev(sc->sc_dev, "can't insert "
+"device structure\n");
 free(dev, M_DEVBUF);
 break;
 			}
@@ -3550,9 +3560,9 @@ mpii_event_sas(struct mpii_softc *sc, st
 DVACT_DEACTIVATE);
 if (scsi_task(mpii_event_defer, sc,
 dev, 0) != 0)
-	printf("%s: unable to run device "
-	"detachment routine\n",
-	DEVNAME(sc));
+	aprint_error_dev(sc->sc_dev, 
+	"unable to run device "
+	"detachment routine\n");
 			}
 #else
 			mpii_event_defer(sc, dev);
@@ -4979,7 +4989,7 @@ mpii_cache_enable(struct mpii_softc *sc,
 		return (EINVAL);
 
 	pagelen = hdr.page_length * 4;
-	vpg = malloc(pagelen, M_TEMP, M_WAITOK | M_CANFAIL | M_ZERO);
+	vpg = malloc(pagelen, M_TEMP, M_NOWAIT | M_ZERO);
 	if (vpg == NULL)
 		return (ENOMEM);
 



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

2018-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun  7 18:12:18 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #846):

sys/dev/pci/pcidevs: revision 1.1334
sys/dev/pci/pucdata.c: revision 1.102

add Oxford Semiconductor OXPCIe954 PCIe 4-port serial card


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.6 -r1.1289.2.7 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.99.8.2 -r1.99.8.3 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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.6 src/sys/dev/pci/pcidevs:1.1289.2.7
--- src/sys/dev/pci/pcidevs:1.1289.2.6	Wed Apr 18 14:20:25 2018
+++ src/sys/dev/pci/pcidevs	Thu Jun  7 18:12:17 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.6 2018/04/18 14:20:25 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.7 2018/06/07 18:12:17 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6250,6 +6250,7 @@ product OXFORDSEMI OXPCIE952_3	0xc140	OX
 product OXFORDSEMI OXPCIE952_4	0xc141	OXPCIe952
 product OXFORDSEMI OXPCIE952_5	0xc144	OXPCIe952
 product OXFORDSEMI OXPCIE952_6	0xc145	OXPCIe952
+product OXFORDSEMI OXPCIE954	0xc208	OXPCIe954
 
 /* Packet Engines products */
 product PACKETENGINES GNICII	0x0911	G-NIC II Ethernet

Index: src/sys/dev/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.99.8.2 src/sys/dev/pci/pucdata.c:1.99.8.3
--- src/sys/dev/pci/pucdata.c:1.99.8.2	Mon Apr 16 14:21:48 2018
+++ src/sys/dev/pci/pucdata.c	Thu Jun  7 18:12:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.99.8.2 2018/04/16 14:21:48 martin Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.99.8.3 2018/06/07 18:12:17 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.2 2018/04/16 14:21:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.99.8.3 2018/06/07 18:12:17 martin Exp $");
 
 #include 
 #include 
@@ -1108,6 +1108,19 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Oxford Semiconductor OXPCIe954 PCIe UARTs */
+	{   "Oxford Semiconductor OXPCIe954 UART",
+	{	PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE954,
+		0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1000, COM_FREQ * 0x22 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1200, COM_FREQ * 0x22 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1400, COM_FREQ * 0x22 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x1600, COM_FREQ * 0x22 },
+	},
+	},
+
 	/* Oxford Semiconductor OXmPCI952 PCI UARTs */
 	{   "Oxford Semiconductor OXmPCI952 UARTs",
 	{	PCI_VENDOR_OXFORDSEMI,	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41092,



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

2018-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 17 13:58:08 UTC 2018

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

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

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

rxipsum and rxtusum are not interrupt counter, so use EVCNT_TYPE_MISC
instead of EVCNT_TYPE_INTR.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.18 -r1.508.4.19 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.18 src/sys/dev/pci/if_wm.c:1.508.4.19
--- src/sys/dev/pci/if_wm.c:1.508.4.18	Wed May  9 15:28:44 2018
+++ src/sys/dev/pci/if_wm.c	Thu May 17 13:58:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.19 2018/05/17 13:58:07 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.19 2018/05/17 13:58:07 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6501,8 +6501,8 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 		WM_Q_INTR_EVCNT_ATTACH(rxq, rxintr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, rxdefer, rxq, i, xname);
 
-		WM_Q_INTR_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname);
-		WM_Q_INTR_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname);
+		WM_Q_MISC_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname);
+		WM_Q_MISC_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;



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

2018-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 13:37:24 UTC 2018

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

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

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

Fix panic or hangup when "sysctl -w hw.ixgN.debug=1".
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.14 -r1.56.2.15 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.14 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.15
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.14	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue May 15 13:37:24 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.14 2018/04/14 10:25:11 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.15 2018/05/15 13:37:24 martin Exp $*/
 
 /**
 
@@ -2603,21 +2603,18 @@ ixv_print_debug_info(struct adapter *ada
 static int
 ixv_sysctl_debug(SYSCTLFN_ARGS)
 {
-	struct sysctlnode node;
-	struct adapter *adapter;
+	struct sysctlnode node = *rnode;
+	struct adapter *adapter = (struct adapter *)node.sysctl_data;
 	interror, result;
 
-	node = *rnode;
 	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 
 	if (error || newp == NULL)
 		return error;
 
-	if (result == 1) {
-		adapter = (struct adapter *)node.sysctl_data;
+	if (result == 1)
 		ixv_print_debug_info(adapter);
-	}
 
 	return 0;
 } /* ixv_sysctl_debug */



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

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:28:44 UTC 2018

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

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

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

  Fix a bug that TX might stall because WM_TXQ_NO_SPACE is not cleared in
if_init() (though I've never seen this problem). Clear txq->txq_flags in
wm_init_tx_queue(). OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.17 -r1.508.4.18 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.17 src/sys/dev/pci/if_wm.c:1.508.4.18
--- src/sys/dev/pci/if_wm.c:1.508.4.17	Mon Apr 16 14:25:49 2018
+++ src/sys/dev/pci/if_wm.c	Wed May  9 15:28:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.17 2018/04/16 14:25:49 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.17 2018/04/16 14:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6696,6 +6696,7 @@ wm_init_tx_queue(struct wm_softc *sc, st
 	wm_init_tx_regs(sc, wmq, txq);
 	wm_init_tx_buffer(sc, txq);
 
+	txq->txq_flags = 0; /* Clear WM_TXQ_NO_SPACE */
 	txq->txq_watchdog = false;
 }
 



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

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 14:52:40 UTC 2018

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

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

sys/dev/pci/if_bnxvar.h: revision 1.7
sys/dev/pci/if_bnx.c: revision 1.64

- Fix a bug that bnx(4) panics on shutdown. Stop callout before restroy.
   Reported by Andreas Gustafsson in PR#53265.
- Make sure not to re-arm the callout when we are about to detach. Same as
   if_bge.c rev. 1.292.
- Use pci_intr_establish_xname().


To generate a diff of this commit:
cvs rdiff -u -r1.61.8.1 -r1.61.8.2 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.6 -r1.6.22.1 src/sys/dev/pci/if_bnxvar.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.61.8.1 src/sys/dev/pci/if_bnx.c:1.61.8.2
--- src/sys/dev/pci/if_bnx.c:1.61.8.1	Tue Oct 24 08:38:59 2017
+++ src/sys/dev/pci/if_bnx.c	Wed May  9 14:52:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.61.8.1 2017/10/24 08:38:59 snj Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.61.8.2 2018/05/09 14:52:40 martin Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.61.8.1 2017/10/24 08:38:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.61.8.2 2018/05/09 14:52:40 martin Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -792,7 +792,8 @@ bnx_attach(device_t parent, device_t sel
 	IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
 
 	/* Hookup IRQ last. */
-	sc->bnx_intrhand = pci_intr_establish(pc, ih, IPL_NET, bnx_intr, sc);
+	sc->bnx_intrhand = pci_intr_establish_xname(pc, ih, IPL_NET, bnx_intr,
+	sc, device_xname(self));
 	if (sc->bnx_intrhand == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
@@ -890,17 +891,7 @@ bnx_detach(device_t dev, int flags)
 
 	/* Stop and reset the controller. */
 	s = splnet();
-	if (ifp->if_flags & IFF_RUNNING)
-		bnx_stop(ifp, 1);
-	else {
-		/* Disable the transmit/receive blocks. */
-		REG_WR(sc, BNX_MISC_ENABLE_CLR_BITS, 0x5ff);
-		REG_RD(sc, BNX_MISC_ENABLE_CLR_BITS);
-		DELAY(20);
-		bnx_disable_intr(sc);
-		bnx_reset(sc, BNX_DRV_MSG_CODE_RESET);
-	}
-
+	bnx_stop(ifp, 1);
 	splx(s);
 
 	pmf_device_deregister(dev);
@@ -3371,10 +3362,11 @@ bnx_stop(struct ifnet *ifp, int disable)
 
 	DBPRINT(sc, BNX_VERBOSE_RESET, "Entering %s()\n", __func__);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
-		return;
-
-	callout_stop(>bnx_timeout);
+	if (disable) {
+		sc->bnx_detaching = 1;
+		callout_halt(>bnx_timeout, NULL);
+	} else
+		callout_stop(>bnx_timeout);
 
 	mii_down(>bnx_mii);
 
@@ -5694,9 +5686,6 @@ bnx_tick(void *xsc)
 	/* Update the statistics from the hardware statistics block. */
 	bnx_stats_update(sc);
 
-	/* Schedule the next tick. */
-	callout_reset(>bnx_timeout, hz, bnx_tick, sc);
-
 	mii = >bnx_mii;
 	mii_tick(mii);
 
@@ -5707,6 +5696,11 @@ bnx_tick(void *xsc)
 	bnx_get_buf(sc, , _prod, _bseq);
 	sc->rx_prod = prod;
 	sc->rx_prod_bseq = prod_bseq;
+
+	/* Schedule the next tick. */
+	if (!sc->bnx_detaching)
+		callout_reset(>bnx_timeout, hz, bnx_tick, sc);
+
 	splx(s);
 	return;
 }

Index: src/sys/dev/pci/if_bnxvar.h
diff -u src/sys/dev/pci/if_bnxvar.h:1.6 src/sys/dev/pci/if_bnxvar.h:1.6.22.1
--- src/sys/dev/pci/if_bnxvar.h:1.6	Tue Jul  1 17:11:35 2014
+++ src/sys/dev/pci/if_bnxvar.h	Wed May  9 14:52:40 2018
@@ -210,6 +210,7 @@ struct bnx_softc
 	uint32_t		tx_prod_bseq;	/* Counts the bytes used.  */
 
 	struct callout		bnx_timeout;
+	int			bnx_detaching;
 
 	/* Frame size and mbuf allocation size for RX frames. */
 	uint32_t		max_frame_size;



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

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:21:50 UTC 2018

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

Log Message:
regen for ticket #780


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

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:20:26 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #780):

sys/dev/pci/pcidevs: revision 1.1328-1.1330

Add some 8th Generation Intel Core Processor devices.
Add Intel SSD 760p.
Added some NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.5 -r1.1289.2.6 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.5 src/sys/dev/pci/pcidevs:1.1289.2.6
--- src/sys/dev/pci/pcidevs:1.1289.2.5	Sat Apr 14 10:32:05 2018
+++ src/sys/dev/pci/pcidevs	Wed Apr 18 14:20:25 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.5 2018/04/14 10:32:05 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.6 2018/04/18 14:20:25 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -645,6 +645,8 @@ vendor MARVELL2		0x1b4b	Marvell
 vendor FRESCO		0x1b73	Fresco Logic
 vendor QINHENG2		0x1c00	Nanjing QinHeng Electronics (PCIe)
 vendor SYMPHONY2	0x1c1c	Symphony Labs (2nd PCI Vendor ID)
+vendor HGST		0x1c58	HGST, Inc.
+vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
@@ -1742,6 +1744,9 @@ product BBELEC ISOLATED_2_PORT		0x4212	d
 product BBELEC ISOLATED_4_PORT		0x4214	quad-channel Isolated RS-485 PCI UART
 product BBELEC ISOLATED_8_PORT		0x4218	octal-channel Isolated RS-485 PCI UART
 
+/* Beijing Memblaze Technology Co. Ltd. products */
+product BEIJING_MEMBLAZE PBLAZE4	0x0540	PBlaze4 NVMe SSD
+
 /* Belkin products */
 product BELKIN F5D6001		0x6001	F5D6001
 product BELKIN F5D6020V3	0x6020	F5D6020v3 802.11b
@@ -2631,6 +2636,10 @@ product HP ILO3_SLAVE		0x3306	iLO3 Slave
 product HP ILO3_MGMT		0x3307	iLO3 Management
 product HP RS780_PPB_GFX	0x9602  (AMD) RS780 PCI-PCI Bridge (int gfx)
 
+/* HGST Inc. products */
+product HGST SN100	0x0003	Ultrastar SN100 Series NVMe SSD
+product HGST SN200	0x0023	Ultrastar SN200 Series NVMe SSD
+
 /* Hifn products */
 product HIFN 7751	0x0005	7751
 product HIFN 6500	0x0006	6500
@@ -4469,6 +4478,11 @@ product INTEL E5_UNICAST	0x3ce8	E5 Unica
 product INTEL E5_SAD_1		0x3cf4	E5 SAD
 product INTEL E5_BROADCAST	0x3cf5	E5 Broadcast
 product INTEL E5_SAD_2		0x3cf6	E5 SAD
+product INTEL CORE8G_S_HOST_DRAM_4C 0x3e1f Core 8G (S) Host Bridge, DRAM
+product INTEL CORE8G_S_HOST_DRAM_6C 0x3ec2 Core 8G (S) Host Bridge, DRAM
+product INTEL CORE8G_PCIE_X16	0x3e81 Core 8G (S) PCIe x16
+product INTEL CORE8G_PCIE_X8	0x3e85 Core 8G (S) PCIe x16
+product INTEL CORE8G_PCIE_X4	0x3e89 Core 8G (S) PCIe x16
 product INTEL COFLK_IGD_1	0x3e90	UHD Graphics 610
 product INTEL COFLK_IGD_2	0x3e91	UHD Graphics 630
 product INTEL COFLK_IGD_3	0x3e92	UHD Graphics 630
@@ -5286,6 +5300,7 @@ product INTEL CP_SS_REGS	0xd156	Core Pro
 product INTEL CP_SCS_REGS	0xd157	Core Processor System Control and Status Registers
 product INTEL CP_MISC_REGS	0xd158	Core Processor Miscellaneous Registers
 product INTEL HANKSVILLE	0xf0fe	HANKSVILLE LAN Controller
+product INTEL SSD_760P		0xf1a6	SSD 760p
 
 /* Intergraph products */
 product INTERGRAPH 4D60T	0x00e3	Powerstorm 4D60T
@@ -6610,6 +6625,8 @@ product SAFENET SAFEXCEL	0x1141 SafeXcel
 product SAMSUNGELEC3	XP941		0xa800	XP941 M.2 SSD
 product SAMSUNGELEC3	SM951		0xa801	SM951 M.2 SSD
 product SAMSUNGELEC3	SM951_NVME	0xa802	SM951 M.2 NVMe SSD
+product SAMSUNGELEC3	172X		0xa821	NVMe SSD Controller 172X
+product SAMSUNGELEC3	172XAB		0xa822	NVMe SSD Controller 172Xa/172Xb
 
 /* Samsung Semiconductor products */
 product SAMSUNGSEMI	KS8920	0x8920	KS8920 10/100 Ethernet



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:20:06 UTC 2018

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.147
sys/dev/pci/ixgbe/ixgbe.h: revision 1.42

Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.
The operation is not supported, however causing panic is problem.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.17 -r1.88.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.10 -r1.24.6.11 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.17 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.18
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.17	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Apr 17 08:20:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.17 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.18 2018/04/17 08:20:06 martin Exp $ */
 
 /**
 
@@ -2487,7 +2487,7 @@ static inline void
 ixgbe_sched_handle_que(struct adapter *adapter, struct ix_queue *que)
 {
 
-	if (adapter->txrx_use_workqueue) {
+	if(que->txrx_use_workqueue) {
 		/*
 		 * adapter->que_wq is bound to each CPU instead of
 		 * each NIC queue to reduce workqueue kthread. As we
@@ -2531,6 +2531,12 @@ ixgbe_msix_que(void *arg)
 	ixgbe_disable_queue(adapter, que->msix);
 	++que->irqs.ev_count;
 
+	/*
+	 * Don't change "que->txrx_use_workqueue" from this point to avoid
+	 * flip-flopping softint/workqueue mode in one deferred processing.
+	 */
+	que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 	/* Don't run ixgbe_rxeof in interrupt context */
 	more = true;
@@ -3174,6 +3180,16 @@ ixgbe_add_device_sysctls(struct adapter 
 	CTL_EOL) != 0)
 		aprint_error_dev(dev, "could not create sysctl\n");
 
+	/*
+	 * If each "que->txrx_use_workqueue" is changed in sysctl handler,
+	 * it causesflip-flopping softint/workqueue mode in one deferred
+	 * processing. Therefore, preempt_disable()/preempt_enable() are
+	 * required in ixgbe_sched_handle_que() to avoid
+	 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule().
+	 * I think changing "que->txrx_use_workqueue" in interrupt handler
+	 * is lighter than doing preempt_disable()/preempt_enable() in every
+	 * ixgbe_sched_handle_que().
+	 */
 	adapter->txrx_use_workqueue = ixgbe_txrx_workqueue;
 	if (sysctl_createv(log, 0, , , CTLFLAG_READWRITE,
 	CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"),
@@ -4798,6 +4814,11 @@ ixgbe_legacy_irq(void *arg)
 	}
 
 	if ((ifp->if_flags & IFF_RUNNING) != 0) {
+		/*
+		 * The same as ixgbe_msix_que() about "que->txrx_use_workqueue".
+		 */
+		que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 		/* Don't run ixgbe_rxeof in interrupt context */
 		more = true;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.10 src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.11
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.10	Sat Apr 14 10:25:12 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Apr 17 08:20:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.10 2018/04/14 10:25:12 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.11 2018/04/17 08:20:06 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -346,6 +346,7 @@ struct ix_queue {
 	 * > 0 : this queue is disabled
 	 *   the value is ixgbe_disable_queue() called count
 	 */
+	bool txrx_use_workqueue;
 };
 
 /*



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

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:21:48 UTC 2018

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

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

sys/dev/pci/ichsmb.c: revision 1.57
sys/dev/pci/pucdata.c: revision 1.101

Add 300 series chipset support.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.1 -r1.50.6.2 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.99.8.1 -r1.99.8.2 src/sys/dev/pci/pucdata.c

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

Modified files:

Index: src/sys/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.50.6.1 src/sys/dev/pci/ichsmb.c:1.50.6.2
--- src/sys/dev/pci/ichsmb.c:1.50.6.1	Mon Feb 26 00:05:04 2018
+++ src/sys/dev/pci/ichsmb.c	Mon Apr 16 14:21:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.1 2018/02/26 00:05:04 snj Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.50.6.2 2018/04/16 14:21:48 martin Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.1 2018/02/26 00:05:04 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.2 2018/04/16 14:21:48 martin Exp $");
 
 #include 
 #include 
@@ -117,6 +117,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_100SERIES_SMB:
 		case PCI_PRODUCT_INTEL_100SERIES_LP_SMB:
 		case PCI_PRODUCT_INTEL_2HS_SMB:
+		case PCI_PRODUCT_INTEL_3HS_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB:

Index: src/sys/dev/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.99.8.1 src/sys/dev/pci/pucdata.c:1.99.8.2
--- src/sys/dev/pci/pucdata.c:1.99.8.1	Sat Jan 13 05:36:03 2018
+++ src/sys/dev/pci/pucdata.c	Mon Apr 16 14:21:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.99.8.1 2018/01/13 05:36:03 snj Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.99.8.2 2018/04/16 14:21:48 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.1 2018/01/13 05:36:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.99.8.2 2018/04/16 14:21:48 martin Exp $");
 
 #include 
 #include 
@@ -1936,7 +1936,16 @@ const struct puc_device_description puc_
 		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
 	},
 	},
-	
+
+	/* Intel 300 Series KT */
+	{   "Intel 300 Series KT",
+	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3HS_KT, 0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
+	},
+	},
+
 	/* Intel C600/X79 Series KT */
 	{   "Intel C600/X79 Series KT",
 	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_KT, 0, 0 },



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

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:32:05 UTC 2018

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

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

sys/dev/pci/pcidevs: revision 1.1308
sys/dev/pci/pcidevs: revision 1.1327

Add Nvidia GeForce 9400M as found in the late 2009 13" MacBook (MacBook6,1)

Add new I219 devices (using with 300 series chipset).


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.4 -r1.1289.2.5 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.4 src/sys/dev/pci/pcidevs:1.1289.2.5
--- src/sys/dev/pci/pcidevs:1.1289.2.4	Mon Apr  9 18:18:49 2018
+++ src/sys/dev/pci/pcidevs	Sat Apr 14 10:32:05 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.4 2018/04/09 18:18:49 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.5 2018/04/14 10:32:05 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3302,6 +3302,10 @@ product INTEL C3K_X553_VF_HYPV	0x15b4	C3
 product INTEL I219_LM2		0x15b7	I219-LM Ethernet Connection
 product INTEL I219_V2		0x15b8	I219-V Ethernet Connection
 product INTEL I219_LM3		0x15b9	I219-LM Ethernet Connection
+product INTEL I219_LM7		0x15bb	I219-LM Ethernet Connection
+product INTEL I219_V7		0x15bc	I219-V Ethernet Connection
+product INTEL I219_LM6		0x15bd	I219-LM Ethernet Connection
+product INTEL I219_V6		0x15be	I219-V Ethernet Connection
 product INTEL C3K_X553_KRKX	0x15c2	C3000 X553 Backplane (KR/KX 10G SKU)
 product INTEL C3K_X553_KX_25G	0x15c3	C3000 X553 Backplane (KX 2.5G)
 product INTEL C3K_X553_SFI_SFP	0x15c4	C3000 X553 10G SFP+ (SFI)
@@ -6121,6 +6125,7 @@ product NVIDIA	MCP73_AHCI_11	0x07fa	nFor
 product NVIDIA	MCP73_AHCI_12	0x07fb	nForce MCP73 AHCI Controller
 product NVIDIA	MCP73_HDA_1	0x07fc	nForce MCP73 High Definition Audio Controller
 product NVIDIA	MCP73_HDA_2	0x07fd	nForce MCP73 High Definition Audio Controller
+product NVIDIA	GEFORCE_9400M	0x0863	GeForce 9400M
 product NVIDIA	GEFORCE_210	0x0a65	GeForce 210
 product NVIDIA	MCP79_SMB	0x0aa2	nForce MCP79 SMBus Controller
 product NVIDIA	MCP79_LAN1	0x0ab0	nForce MCP79 Gigabit Ethernet Controller



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

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:25:12 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82598.h ixgbe_82599.c
ixgbe_82599.h ixgbe_api.c ixgbe_api.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_mbx.c
ixgbe_mbx.h 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 ixv.c

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

sys/dev/pci/ixgbe/ixgbe_x540.h: revision 1.8
sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.11
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.12
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: revision 1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h: revision 1.6
sys/dev/pci/ixgbe/ixgbe_fdir.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h: revision 1.6
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.18
sys/dev/pci/ixgbe/if_sriov.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: revision 1.7
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.7
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_dcb.h: revision 1.6
sys/dev/pci/ixgbe/if_bypass.c: revision 1.4
sys/dev/pci/ixgbe/ixv.c: revision 1.91
sys/dev/pci/ixgbe/ixgbe_rss.h: revision 1.4
sys/dev/pci/ixgbe/ixv.c: revision 1.92
sys/dev/pci/ixgbe/ixv.c: revision 1.93
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.4
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_api.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.12
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.33
sys/dev/pci/ixgbe/if_fdir.c: revision 1.2
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.34
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.39
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_sriov.h: revision 1.3
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.21
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.21
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.22
sys/dev/pci/ixgbe/ixgbe_82599.h: revision 1.7
sys/dev/pci/ixgbe/ixgbe.c: revision 1.144
sys/dev/pci/ixgbe/ixgbe.c: revision 1.145
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe.c: revision 1.146
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_82598.h: revision 1.8
sys/dev/pci/ixgbe/ixgbe.h: revision 1.41
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.10
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.14
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.15
sys/dev/pci/ixgbe/ixgbe_phy.h: revision 1.11

Sync with the remaining part of FreeBSD r328265 except sfp_reinit stuff:
 - Always schedule module intterrupt in ixgbe_config_link() when a device is
   SFP+ based.
 - Use not loop index but txr->me in ixv_initialize_{transmit,receive}_units().
   It's required for VMDQ but NetBSD doesn't use it, so it's not a bug in
   NetBSD.
 - Simplify ixgbe_bp_wd_set(). No functional change.
 - Whitespace.

Sync with FreeBSD r331224 except ixv_if_update_admin_status()'s change:
 - Fix length of reading buffer when the command is Read Flash in
   ixgbe_host_interface_command().
 - Add missing start_hw() call in ixv_init_locked(). This is not a real bug
   because start_hw just set hw->adapter_stopped to false and anyone refer it.
 - Style change.
 - Update comment.

Read sc_if_flags after taking core lock. Same as if_wm.c rev. 1.418.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.3 -r1.2.4.4 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/if_fdir.c \
src/sys/dev/pci/ixgbe/ixgbe_fdir.h
cvs rdiff -u -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/if_sriov.c \
src/sys/dev/pci/ixgbe/ixgbe_sriov.h
cvs rdiff -u -r1.24.2.9 -r1.24.2.10 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.16 -r1.88.2.17 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.9 -r1.24.6.10 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.8.8.1 -r1.8.8.2 src/sys/dev/pci/ixgbe/ixgbe_82598.c \

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

2018-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  9 18:20:18 UTC 2018

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

Log Message:
Regen (ticket #723)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.3 -r1.1281.2.4 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.3 -r1.1280.2.4 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2018-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  9 18:18:49 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #723):
sys/dev/pci/pcidevs: revision 1.1314
sys/dev/pci/pcidevs: revision 1.1315
sys/dev/pci/pcidevs: revision 1.1316
sys/dev/pci/pcidevs: revision 1.1317
sys/dev/pci/pcidevs: revision 1.1318
sys/dev/pci/pcidevs: revision 1.1302
sys/dev/pci/pcidevs: revision 1.1303
sys/dev/pci/pcidevs: revision 1.1304
sys/dev/pci/pcidevs: revision 1.1305
sys/dev/pci/pcidevs: revision 1.1306
sys/dev/pci/pcidevs: revision 1.1307
sys/dev/pci/pcidevs: revision 1.1309
sys/dev/pci/pcidevs: revision 1.1320
sys/dev/pci/pcidevs: revision 1.1321
sys/dev/pci/pcidevs: revision 1.1322
sys/dev/pci/pcidevs: revision 1.1324
sys/dev/pci/pcidevs: revision 1.1325
sys/dev/pci/pcidevs: revision 1.1326
sys/dev/pci/pcidevs: revision 1.1310
sys/dev/pci/pcidevs: revision 1.1311
sys/dev/pci/pcidevs: revision 1.1312
sys/dev/pci/pcidevs: revision 1.1313

 Add some Chelsio devices.
- s/MMC/eMMC/ for Intel 0x0f14 (Bay Trail)
- Add Atom E3800 (Bay Trail) eMMC 4.5

 Add Intel Apollo Lake devices.

Add the GeForce4 MX440 Go, as found on the 17" flat panel G4 iMac (PowerMac4,5).
Thanks to Jasper Wallace  for the loan of the 
hardware.

Add Nvidia GeForce FX Go5200, as found in the PowerBook6,4

Add Marvell Yukon 88E8040T

grammar

 Add some ServerEngines (Emulex) products from OpenBSD.
 Add some Intel Ethernet devices.
 Add C620 devices.
 Fix C62x9 sSATA Controller (RAID) device ID.

s/C62x9/C62x/

 Add some Xeon E5 (v1) and E5 v2 devices.

Add AMD KERNCZ chipset for Zen processors.

 Add Intel Gemini Lake devices.
apply some updates and recommended corrections to pcidevs descriptions
PR kern/45733 by Greg A.Woods

 Intel 0x15c4 is SFI based and 0x15ce is KR based.

Add Intel Wireless AC 9260.

 Add two VIA xHCI devices from OpenBSD.

 Add Intel X299 and Z370 LPC.

 Add Intel Coffee Lake internal graphics devices. From ark.intel.com.

 Add Intel 300 series devices.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.3 src/sys/dev/pci/pcidevs:1.1289.2.4
--- src/sys/dev/pci/pcidevs:1.1289.2.3	Thu Mar  8 14:31:18 2018
+++ src/sys/dev/pci/pcidevs	Mon Apr  9 18:18:49 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.3 2018/03/08 14:31:18 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.4 2018/04/09 18:18:49 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -449,7 +449,7 @@ vendor MINDSHARE	0x119a	Mind Share
 vendor OMEGA		0x119b	Omega Micro
 vendor ITI		0x119c	Information Technology Institute
 vendor BUG		0x119d	Bug Sapporo
-vendor FUJITSU3		0x119e	Fujitsu (3th PCI Vendor ID)
+vendor FUJITSU3		0x119e	Fujitsu (3rd PCI Vendor ID)
 vendor BULL		0x119f	Bull Hn Information Systems
 vendor CONVEX		0x11a0	Convex Computer
 vendor HAMAMATSU	0x11a1	Hamamatsu Photonics
@@ -632,6 +632,7 @@ vendor RENESAS		0x1912	Renesas Technolog
 vendor FREESCALE	0x1957	Freescale Semiconductor
 vendor ATTANSIC		0x1969	Attansic Technologies
 vendor JMICRON		0x197b	JMicron Technology
+vendor SERVERENGINES	0x19a2	ServerEngines
 vendor HUAWEI		0x19e5	Huaewi Technology
 vendor ASPEED		0x1a03	ASPEED Technology
 vendor AWT		0x1a3b	AWT
@@ -1114,6 +1115,7 @@ product AMD HUDSON_PCI		0x780f	Hudson PC
 product AMD HUDSON_XHCI		0x7812	Hudson USB xHCI Controller
 product AMD FCH_SDHC		0x7813	FCH SD Flash Controller
 product AMD FCH_XHCI		0x7814	FCH USB xHCI Controller
+product AMD KERNCZ_SMB		0x790b	X370/X399 SMBus Controller
 product AMD RS780_HB		0x9600	RS780 Host Bridge
 product AMD RS880_HB		0x9601	RS785/RS880 Host Bridge
 product AMD RS780_PPB_GFX	0x9602	RS780/RS880 PCI-PCI Bridge (int gfx)
@@ -1920,6 +1922,7 @@ product C4T GPPCI		0x6773	GPPCI
 product CAVIUM NITROX		0x0001	Nitrox XL
 
 /* Chelsio products */
+product CHELSIO PE9000		0x0020	PE9000 10GbE
 product CHELSIO T302E		0x0021	T302e
 product CHELSIO	T310E		0x0022	T310e
 product CHELSIO	T320X		0x0023	T320x
@@ -1929,6 +1932,57 @@ product CHELSIO	T310X		0x0026	T310x
 product CHELSIO	T3B10		0x0030	T3B10
 product CHELSIO	T3B20		0x0031	T3B20
 product CHELSIO	T3B02		0x0032	T3B02
+product CHELSIO	T3B04		0x0033	T3B04
+product CHELSIO	T3C10		0x0035	T3C10
+product CHELSIO	S320E_CR	0x0036	S320E-CR
+product CHELSIO	N320E_G2	0x0037	N320E-G2
+product CHELSIO	T440_DBG	0x4400	T440-dbg
+product CHELSIO	T420_CR		0x4401	T420-CR
+product CHELSIO	T422_CR		0x4402	T422-CR
+product CHELSIO	T440_CR		0x4403	T440-CR
+product CHELSIO	T420_BCH	0x4404	T420-BCH
+product CHELSIO	T440_BCH	0x4405	T440-BCH
+product 

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

2018-04-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Apr  9 13:25:36 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #719):
sys/dev/pci/if_rtwn.c: revision 1.15
in rtwn_attach(): return; before unconditionally running into fail:


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/dev/pci/if_rtwn.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_rtwn.c
diff -u src/sys/dev/pci/if_rtwn.c:1.12.2.1 src/sys/dev/pci/if_rtwn.c:1.12.2.2
--- src/sys/dev/pci/if_rtwn.c:1.12.2.1	Sun Dec 10 10:10:24 2017
+++ src/sys/dev/pci/if_rtwn.c	Mon Apr  9 13:25:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rtwn.c,v 1.12.2.1 2017/12/10 10:10:24 snj Exp $	*/
+/*	$NetBSD: if_rtwn.c,v 1.12.2.2 2018/04/09 13:25:36 bouyer Exp $	*/
 /*	$OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $	*/
 #define	IEEE80211_NO_HT
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.12.2.1 2017/12/10 10:10:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.12.2.2 2018/04/09 13:25:36 bouyer Exp $");
 
 #include 
 #include 
@@ -396,6 +396,8 @@ rtwn_attach(device_t parent, device_t se
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
+	return;
+
 fail:
 	rtwn_detach(self, 0);
 }



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

2018-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr  4 16:18:49 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #690):
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe.c: revision 1.138
sys/dev/pci/ixgbe/ixv.c: revision 1.90
sys/dev/pci/ixgbe/ixgbe.c: revision 1.139
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.11
sys/dev/pci/ixgbe/ixgbe.h: revision 1.38
sys/dev/pci/ixgbe/ixgbe_api.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe.h: revision 1.39
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.10
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.11
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.37
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.38
sys/dev/pci/ixgbe/ixgbe.c: revision 1.140
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe.c: revision 1.141
sys/dev/pci/ixgbe/ixgbe.c: revision 1.142
sys/dev/pci/ixgbe/ixgbe.c: revision 1.143
sys/dev/pci/ixgbe/ixgbe.h: revision 1.40
sys/dev/pci/ixgbe/ixgbe_x550.h: revision 1.4

Fix the problem between eitr and link_speed.

In ixgbe_msix_que(), que->eitr_setting is limited to IXGBE_MIN_RSC_EITR_10G1G
when link_speed is 1Gbps or 10Gbps. However, que->eitr_setting is set to EITR
register in the *next* Tx/Rx interrupt. If link_speed changes from 100Mbps to
1Gbps ro 10Gbps, que->eitr_setting which is not limited can be set to EITR
register, that is, the problem fixed by ixgbe.c:r1.124 can occur in this case.

To fix this case, que->eitr_setting should be clear when link_speed is changed
or link state is changed.

Furthermore, expand the variants used for AIM (txr->bytes, txr->packets,
rxr->bytes and rxr->packets) from u32 to u64 to avoid wraparound which causes
que->eitr_setting calculation mistake.
XXX pullup-8

Don't write EIMC directly. It is required to manage with struct ix_queue status.
XXX pullup-8

-  Add missing IFM_NONE support. If a interface support linkdown,
  "ifconfig ixgN media none" drpos link.  Not all interface can do link down.
 Tested:
82598 AT2 (T)
92599 SF+(SFI) (X520-DA2)
X540
X550-T1
X550EM_x (X10SDV-8C-TLN4F)
X550EM_a (A2SDi-H-TP4F port 0, 1 (T))
 Doesn't work:
X550EM_a (A2SDi-H-TP4F port 2, 3 (SFP+ (KR)))
X550EM_a (MA10-ST0 port 2, 3 (SFP+ (SFI)))
(Denverton SFP+ can't force link down because SFP+'s TX_DISABLE pin is
pull down. Is there a way to shutdown SFP+ cage's power?)
 Not tested:
82598 fiber.
- Change some functions static.

Avoid issues caused by sending old packets at next link-up time.

This modification consists by the following two parts.
- drain packets in if_snd queue or corresponding txr->txr_interq
  when link_active == false in ifp->if_start(), ifp->if_transmit(),
  and deferred Tx processing
- drain packets in if_snd queue and all of txr->txr_interq's
  at link-down time
ok by msaitoh@n.o.

 Fix long standing bug that 82598 SFP+ panics in ixgbe_handle_mod() because
hw->mac.ops.setup_sfp is NULL. This change is a part of FreeBSD r327031.

Fix a bug that "ifconfig ixgN down up" forgot IFM_NONE setting.
 - Don't assume autoneg == 0 is the first call of ixgbe_config_link().
   Check ifm_media, too.
 - Don't override autoneg_advertised in ixgbe_get_phy_id_fw() to not to
   be inconsistent with if_media value.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.8 -r1.24.2.9 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.15 -r1.88.2.16 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.8 -r1.24.6.9 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.1 -r1.14.8.2 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.9.8.1 -r1.9.8.2 src/sys/dev/pci/ixgbe/ixgbe_api.h
cvs rdiff -u -r1.13.2.2 -r1.13.2.3 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.2 -r1.7.8.3 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.5.6.2 -r1.5.6.3 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.2.12.1 -r1.2.12.2 src/sys/dev/pci/ixgbe/ixgbe_x550.h
cvs rdiff -u -r1.56.2.12 -r1.56.2.13 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.8 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.9
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.8	Fri Mar 30 12:07:34 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Apr  4 16:18:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.8 2018/03/30 12:07:34 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.9 2018/04/04 16:18:49 martin Exp $ */
 
 

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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 12:07:35 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_sriov.c ix_txrx.c
ixgbe.c ixgbe.h ixgbe_common.c ixgbe_common.h ixgbe_osdep.c
ixgbe_osdep.h ixgbe_phy.c ixgbe_sriov.h ixgbe_type.h ixgbe_vf.h
ixgbe_x540.c ixgbe_x550.c ixv.c

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

sys/dev/pci/ixgbe/if_sriov.c: revision 1.2
sys/dev/pci/ixgbe/ixgbe.c: revision 1.135
sys/dev/pci/ixgbe/ixgbe.c: revision 1.136
sys/dev/pci/ixgbe/ixgbe.c: revision 1.137
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.17
sys/dev/pci/ixgbe/if_bypass.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.10
sys/dev/pci/ixgbe/ixgbe.h: revision 1.36
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe.h: revision 1.37
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.36
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.32
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe_sriov.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.20
sys/dev/pci/ixgbe/ixv.c: revision 1.88
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.15
sys/dev/pci/ixgbe/ixv.c: revision 1.89
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.9

Add some changes from ix-3.2.17.tar.gz and r328265. Not fully synchronized.

Some others (e.g. sfp cage interrupt and bypass adapter  stuff) will be merged
later:

- Initialize firmware command buffer correctly in ixgbe_read_ee_hostif_X550()
  and ixgbe_read_ee_hostif_buffer_X550(). These functions are used when reading
  NVM.
- Fix a bug that ixgbe_mng_present() misunderstand management capability on
  X550 and newer on some environment. X550 changed FWSM bit definition.
  See X540 document and X550's document and compare them.
- Fix checksum calculation in ixgbe_set_fw_drv_ver_generic(). This function is
  not used in NetBSD.
- Add some unused funtions.
- Whitespace fix.
- Check offset correctly in ixgbe_get_oem_prod_version(). Note that this
  function is not used.
- Set PHY correctly in ixgbe_setup_mac_link_sfp_x550a() if a device is a
  C3000 KR SFP+.

Fix race about writing adapter->link_active for ixg(4).
adapter->link_active is updated by ixgbe_update_link_status() only.

The function is called from the following four functions.
- ixgbe_media_status()
- ixgbe_local_timer1()
- ixgbe_stop()
- ixgbe_handle_link()

The functions other than ixgbe_handle_link() call ixgbe_update_link_status()
with holding IXGBE_CORE_LOCK, however ixgbe_handle_link() calls it without
holding IXGBE_CORE_LOCK. That can cause race. So, add IXGBE_CORE_LOCK to
ixgbe_handle_link().

Tested by msaitoh@n.o and me.

Fix race about writing adapter->link_active for ixv(4).
adapter->link_active is updated by ixv_update_link_status() only.

The function is called from the following two functions.
- ixv_media_status()
- ixv_handle_link()

ixv_media_status() calls ixv_update_link_status() with holding
IXGBE_CORE_LOCK, however ixv_handle_link() calls it without
holding IXGBE_CORE_LOCK, the same as ixg(4).

ok by msaitoh@n.o.

- Add link related softint's counter.
- Fix indent.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/if_sriov.c \
src/sys/dev/pci/ixgbe/ixgbe_sriov.h
cvs rdiff -u -r1.24.2.7 -r1.24.2.8 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.14 -r1.88.2.15 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.7 -r1.24.6.8 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.1 -r1.7.8.2 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.1.12.1 -r1.1.12.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.17.6.1 -r1.17.6.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.11.6.1 -r1.11.6.2 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.22.2.3 -r1.22.2.4 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.8.6.1 -r1.8.6.2 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.9.6.1 -r1.9.6.2 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.11 -r1.56.2.12 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_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.2 src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.3
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.2	Thu Dec 21 19:28:54 2017
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Fri Mar 30 12:07:34 

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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 14:59:06 UTC 2018

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 #626):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.134
sys/dev/pci/ixgbe/ixgbe.h: revision 1.35
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.35
sys/dev/pci/ixgbe/ixv.c: revision 1.87
  Make some event counters MP safe. Now all of the event counters are
MP safe.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.6 -r1.24.2.7 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.13 -r1.88.2.14 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.6 -r1.24.6.7 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.10 -r1.56.2.11 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.6 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.7
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.6	Tue Mar  6 11:12:40 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue Mar 13 14:59:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.6 2018/03/06 11:12:40 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.7 2018/03/13 14:59:06 martin Exp $ */
 
 /**
 
@@ -392,10 +392,10 @@ retry:
 
 		switch (error) {
 		case EAGAIN:
-			adapter->eagain_tx_dma_setup.ev_count++;
+			txr->q_eagain_tx_dma_setup++;
 			return EAGAIN;
 		case ENOMEM:
-			adapter->enomem_tx_dma_setup.ev_count++;
+			txr->q_enomem_tx_dma_setup++;
 			return EAGAIN;
 		case EFBIG:
 			/* Try it again? - one try */
@@ -405,23 +405,23 @@ retry:
  * XXX: m_defrag will choke on
  * non-MCLBYTES-sized clusters
  */
-adapter->efbig_tx_dma_setup.ev_count++;
+txr->q_efbig_tx_dma_setup++;
 m = m_defrag(m_head, M_NOWAIT);
 if (m == NULL) {
-	adapter->mbuf_defrag_failed.ev_count++;
+	txr->q_mbuf_defrag_failed++;
 	return ENOBUFS;
 }
 m_head = m;
 goto retry;
 			} else {
-adapter->efbig2_tx_dma_setup.ev_count++;
+txr->q_efbig2_tx_dma_setup++;
 return error;
 			}
 		case EINVAL:
-			adapter->einval_tx_dma_setup.ev_count++;
+			txr->q_einval_tx_dma_setup++;
 			return error;
 		default:
-			adapter->other_tx_dma_setup.ev_count++;
+			txr->q_other_tx_dma_setup++;
 			return error;
 		}
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.13 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.14
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.13	Thu Mar  8 12:31:25 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Mar 13 14:59:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.13 2018/03/08 12:31:25 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.14 2018/03/13 14:59:06 martin Exp $ */
 
 /**
 
@@ -1980,8 +1980,8 @@ ixgbe_clear_evcnt(struct adapter *adapte
 	adapter->other_tx_dma_setup.ev_count = 0;
 	adapter->eagain_tx_dma_setup.ev_count = 0;
 	adapter->enomem_tx_dma_setup.ev_count = 0;
-	adapter->watchdog_events.ev_count = 0;
 	adapter->tso_err.ev_count = 0;
+	adapter->watchdog_events.ev_count = 0;
 	adapter->link_irq.ev_count = 0;
 
 	txr = adapter->tx_rings;
@@ -1995,6 +1995,14 @@ ixgbe_clear_evcnt(struct adapter *adapte
 #ifndef IXGBE_LEGACY_TX
 		txr->pcq_drops.ev_count = 0;
 #endif
+		txr->q_efbig_tx_dma_setup = 0;
+		txr->q_mbuf_defrag_failed = 0;
+		txr->q_efbig2_tx_dma_setup = 0;
+		txr->q_einval_tx_dma_setup = 0;
+		txr->q_other_tx_dma_setup = 0;
+		txr->q_eagain_tx_dma_setup = 0;
+		txr->q_enomem_tx_dma_setup = 0;
+		txr->q_tso_err = 0;
 
 		if (i < __arraycount(stats->mpc)) {
 			stats->mpc[i].ev_count = 0;
@@ -4190,7 +4198,9 @@ ixgbe_local_timer1(void *arg)
 	device_t	dev = adapter->dev;
 	struct ix_queue *que = adapter->queues;
 	u64		queues = 0;
+	u64		v0, v1, v2, v3, v4, v5, v6, v7;
 	int		hung = 0;
+	int		i;
 
 	KASSERT(mutex_owned(>core_mtx));
 
@@ -4202,12 +4212,37 @@ ixgbe_local_timer1(void *arg)
 	ixgbe_update_link_status(adapter);
 	ixgbe_update_stats_counters(adapter);
 
+	/* Update some event counters */
+	v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = 0;
+	que = adapter->queues;
+	for (i = 0; i < adapter->num_queues; i++, que++) {
+		struct tx_ring  *txr = que->txr;
+
+		v0 += txr->q_efbig_tx_dma_setup;
+		v1 += txr->q_mbuf_defrag_failed;
+		v2 += txr->q_efbig2_tx_dma_setup;
+		v3 += txr->q_einval_tx_dma_setup;
+		v4 += txr->q_other_tx_dma_setup;
+		v5 += txr->q_eagain_tx_dma_setup;
+		v6 += txr->q_enomem_tx_dma_setup;
+		v7 += txr->q_tso_err;
+	}
+	adapter->efbig_tx_dma_setup.ev_count = v0;
+	adapter->mbuf_defrag_failed.ev_count = v1;
+	adapter->efbig2_tx_dma_setup.ev_count = v2;
+	adapter->einval_tx_dma_setup.ev_count = v3;
+	adapter->other_tx_dma_setup.ev_count = v4;
+	

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

2018-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  8 14:32:57 UTC 2018

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

Log Message:
Regen for ticket #616


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.2 -r1.1281.2.3 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.2 -r1.1280.2.3 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1281.2.2 src/sys/dev/pci/pcidevs.h:1.1281.2.3
--- src/sys/dev/pci/pcidevs.h:1.1281.2.2	Tue Nov 21 14:51:04 2017
+++ src/sys/dev/pci/pcidevs.h	Thu Mar  8 14:32:49 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1281.2.2 2017/11/21 14:51:04 martin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1281.2.3 2018/03/08 14:32:49 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1289.2.2 2017/11/21 14:48:23 martin Exp
+ *	NetBSD: pcidevs,v 1.1289.2.3 2018/03/08 14:31:18 martin Exp
  */
 
 /*
@@ -41,7 +41,7 @@
 /*
  * NOTE: a fairly complete list of PCI codes can be found at:
  *
- *	http://www.pcidatabase.com/
+ *	https://pci-ids.ucw.cz/
  *
  * (but it doesn't always seem to match vendor documentation)
  *
@@ -2457,7 +2457,7 @@
 #define	PCI_PRODUCT_MARVELL_YUKON_C032	0x4367		/* Yukon 88EC032 */
 #define	PCI_PRODUCT_MARVELL_YUKON_C034	0x4368		/* Yukon 88EC034 */
 #define	PCI_PRODUCT_MARVELL_YUKON_C042	0x4369		/* Yukon 88EC042 */
-#define	PCI_PRODUCT_MARVELL_YUKON_C055	0x436a		/* Yukon 88EC055 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8058	0x436a		/* Yukon 88E8058 */
 #define	PCI_PRODUCT_MARVELL_GT64120	0x4620		/* GT-64120 System Controller */
 #define	PCI_PRODUCT_MARVELL_BELKIN	0x5005		/* Belkin Gigabit Ethernet */
 #define	PCI_PRODUCT_MARVELL_88SX5040	0x5040		/* 88SX5040 SATA */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1280.2.2 src/sys/dev/pci/pcidevs_data.h:1.1280.2.3
--- src/sys/dev/pci/pcidevs_data.h:1.1280.2.2	Tue Nov 21 14:51:04 2017
+++ src/sys/dev/pci/pcidevs_data.h	Thu Mar  8 14:32:49 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1280.2.2 2017/11/21 14:51:04 martin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1280.2.3 2018/03/08 14:32:49 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1289.2.2 2017/11/21 14:48:23 martin Exp
+ *	NetBSD: pcidevs,v 1.1289.2.3 2018/03/08 14:31:18 martin Exp
  */
 
 /*
@@ -3725,7 +3725,7 @@ static const uint16_t pci_products[] = {
 	15916, 16026, 0,
 	PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C042, 
 	15916, 16034, 0,
-	PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C055, 
+	PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8058, 
 	15916, 16042, 0,
 	PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64120, 
 	16050, 6, 6300, 0,
@@ -14190,7 +14190,7 @@ static const char pci_words[] = { "." 
 	"88EC032\0" /* 1 refs @ 16018 */
 	"88EC034\0" /* 1 refs @ 16026 */
 	"88EC042\0" /* 1 refs @ 16034 */
-	"88EC055\0" /* 1 refs @ 16042 */
+	"88E8058\0" /* 1 refs @ 16042 */
 	"GT-64120\0" /* 1 refs @ 16050 */
 	"88SX5040\0" /* 1 refs @ 16059 */
 	"88SX5041\0" /* 1 refs @ 16068 */



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

2018-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  8 14:31:18 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #616):
sys/dev/pci/if_msk.c: revision 1.55
sys/dev/pci/pcidevs: revision 1.1299
update entry for Marvel Yukon 8058, and fix URL for pci ids (Rocky Hotas)


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.8.1 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.1289.2.2 -r1.1289.2.3 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.54 src/sys/dev/pci/if_msk.c:1.54.8.1
--- src/sys/dev/pci/if_msk.c:1.54	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/pci/if_msk.c	Thu Mar  8 14:31:18 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.54 2016/12/15 09:28:05 ozaki-r Exp $ */
+/* $NetBSD: if_msk.c,v 1.54.8.1 2018/03/08 14:31:18 martin Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.54 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.54.8.1 2018/03/08 14:31:18 martin Exp $");
 
 #include 
 #include 
@@ -160,7 +160,6 @@ static const struct msk_product {
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_C034 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_C036 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_C042 },
-	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_C055 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8035 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8036 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8038 },
@@ -171,6 +170,7 @@ static const struct msk_product {
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8053 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8055 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8056 },
+	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKON_8058 },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKONII_8021CU },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKONII_8021X },
 	{ PCI_VENDOR_MARVELL,		PCI_PRODUCT_MARVELL_YUKONII_8022CU },

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.2 src/sys/dev/pci/pcidevs:1.1289.2.3
--- src/sys/dev/pci/pcidevs:1.1289.2.2	Tue Nov 21 14:48:23 2017
+++ src/sys/dev/pci/pcidevs	Thu Mar  8 14:31:18 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.2 2017/11/21 14:48:23 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.3 2018/03/08 14:31:18 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -34,7 +34,7 @@ $NetBSD: pcidevs,v 1.1289.2.2 2017/11/21
 /*
  * NOTE: a fairly complete list of PCI codes can be found at:
  *
- *	http://www.pcidatabase.com/
+ *	https://pci-ids.ucw.cz/
  *
  * (but it doesn't always seem to match vendor documentation)
  *
@@ -2450,7 +2450,7 @@ product MARVELL YUKON_C036	0x4366	Yukon 
 product MARVELL YUKON_C032	0x4367	Yukon 88EC032
 product MARVELL YUKON_C034	0x4368	Yukon 88EC034
 product MARVELL YUKON_C042	0x4369	Yukon 88EC042
-product MARVELL YUKON_C055	0x436a	Yukon 88EC055
+product MARVELL YUKON_8058	0x436a	Yukon 88E8058
 product MARVELL GT64120		0x4620	GT-64120 System Controller
 product MARVELL BELKIN		0x5005	Belkin Gigabit Ethernet
 product MARVELL 88SX5040	0x5040	88SX5040 SATA



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

2018-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  8 12:31:25 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #612):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.129-1.133
sys/dev/pci/ixgbe/ixgbe.h: revision 1.34
sys/dev/pci/ixgbe/ixv.c: revision 1.85,1.86

- Make "Handled queue in softint" and "Requeued in softint" evcnt(9) per queue
  and count them correctly.
- Remove #if 0'ed code.

Don't increment que->req.ev_count in MSI-X interrupt because it's not
reschedule.

Fix another poll mode assumption breaking. Implemented by msaitoh@n.o, I just 
commit by proxy.
ixgbe_rearm_queues() writes EICS register(s). 82599, X540 and X550
specifications say "Following a write of 1b to any bit in the EICS register
(interrupt cause set), its corresponding bit in the EIMS register is auto
set as well enabling its interrupt." in "Extended Interrupt Auto Mask Enable
(EIAM) Register" section. That is, ixgbe_rearm_queues() causes interrupts
regardless of the status managed by ixgbe_enable_queue()/ixgbe_disable_queue().

That can break poll mode assumption.

In fact, the problem occurs in the following situation
- CPU#A has high load traffic, in contrast, CPU#B has not so high load 
traffic
- CPU#A is occurred interrupt by its NIC queue
  - CPU#A calls ixgbe_disable_queue() in interrupt handler(ixgbe_msix_que())
  - CPU#A kick softint handler(ixgbe_handle_que())
- CPU#A begins softint
- CPU#A's NIC queue is set que->txr->busy flag
- With some reason, CPU#A can do ixg interrupt handler
  E.g. when one of CPU#A's softnet handlers sleeps, ipl is lowered
- CPU#B starts callout
  - CPU#B calls ixgbe_local_timer1()
- CPU#B writes EICS bit corresponding CPU#A's NIC queue bit
- CPU#A's NIC queue causes interrupt whie CPU#A is running in poll mode
  - CPU#A calls ixgbe_disable_queue() in interrupt handler *again*
- CPU#A has done polling, and then CPU#A calls ixgbe_enable_queue() *once*
- CPU#A's NIC queue interrupt is disabled until ixg is detached as
  ixgbe_disable_queue() is called twice though ixgbe_disable_queue() is
  called once only
NOTE:
82598 does not say so, but it is treated in the same way because of no harm.
By the way, we will refactor ixgbe_local_timer(watchdog processing) later.

Fix INTx/MSI handler did not schedule workqueue. Pointed out by msaitoh@n.o.

Reduce duplicated code which schedule deferred packet processing. No functional 
change.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.12 -r1.88.2.13 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.5 -r1.24.6.6 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.9 -r1.56.2.10 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.12 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.13
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.12	Tue Mar  6 11:12:41 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar  8 12:31:25 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.12 2018/03/06 11:12:41 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.13 2018/03/08 12:31:25 martin Exp $ */
 
 /**
 
@@ -1686,10 +1686,6 @@ ixgbe_add_hw_stats(struct adapter *adapt
 	const char *xname = device_xname(dev);
 
 	/* Driver Statistics */
-	evcnt_attach_dynamic(>handleq, EVCNT_TYPE_MISC,
-	NULL, xname, "Handled queue in softint");
-	evcnt_attach_dynamic(>req, EVCNT_TYPE_MISC,
-	NULL, xname, "Requeued in softint");
 	evcnt_attach_dynamic(>efbig_tx_dma_setup, EVCNT_TYPE_MISC,
 	NULL, xname, "Driver tx dma soft fail EFBIG");
 	evcnt_attach_dynamic(>mbuf_defrag_failed, EVCNT_TYPE_MISC,
@@ -1736,15 +1732,6 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		(void *)>queues[i], 0, CTL_CREATE, CTL_EOL) != 0)
 			break;
 
-#if 0 /* XXX msaitoh */
-		if (sysctl_createv(log, 0, , ,
-		CTLFLAG_READONLY, CTLTYPE_QUAD,
-		"irqs", SYSCTL_DESCR("irqs on this queue"),
-			NULL, 0, &(adapter->queues[i].irqs),
-		0, CTL_CREATE, CTL_EOL) != 0)
-			break;
-#endif
-
 		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY, CTLTYPE_INT,
 		"txd_head", SYSCTL_DESCR("Transmit Descriptor Head"),
@@ -1761,6 +1748,11 @@ ixgbe_add_hw_stats(struct adapter *adapt
 
 		evcnt_attach_dynamic(>queues[i].irqs, EVCNT_TYPE_INTR,
 		NULL, adapter->queues[i].evnamebuf, "IRQs on queue");
+		evcnt_attach_dynamic(>queues[i].handleq,
+		EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
+		"Handled queue in softint");
+		evcnt_attach_dynamic(>queues[i].req, EVCNT_TYPE_MISC,
+		NULL, adapter->queues[i].evnamebuf, "Requeued in softint");
 		evcnt_attach_dynamic(>tso_tx, EVCNT_TYPE_MISC,
 		NULL, 

  1   2   >