CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sat Jun 5 10:51:41 UTC 2021 Modified Files: src/sys/dev/pci [netbsd-9]: if_iwmreg.h Log Message: Pull up following revision(s) (requested by nia in ticket #1282): 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.7 -r1.7.8.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.7 src/sys/dev/pci/if_iwmreg.h:1.7.8.1 --- src/sys/dev/pci/if_iwmreg.h:1.7 Thu Apr 19 21:50:09 2018 +++ src/sys/dev/pci/if_iwmreg.h Sat Jun 5 10:51:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwmreg.h,v 1.7 2018/04/19 21:50:09 christos Exp $ */ +/* $NetBSD: if_iwmreg.h,v 1.7.8.1 2021/06/05 10:51:41 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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Mon May 17 15:50:35 UTC 2021 Modified Files: src/sys/dev/pci [netbsd-9]: xhci_pci.c Log Message: Pull up following revision(s) (requested by jakllsch in ticket #1273): sys/dev/pci/xhci_pci.c: revision 1.26 xhci_pci: avoid potential double free of interrupt handles Found by Kouichi Hashikawa in PR 55855. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.21.4.1 src/sys/dev/pci/xhci_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/xhci_pci.c diff -u src/sys/dev/pci/xhci_pci.c:1.21 src/sys/dev/pci/xhci_pci.c:1.21.4.1 --- src/sys/dev/pci/xhci_pci.c:1.21 Wed Jan 23 06:56:19 2019 +++ src/sys/dev/pci/xhci_pci.c Mon May 17 15:50:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci_pci.c,v 1.21 2019/01/23 06:56:19 msaitoh Exp $ */ +/* $NetBSD: xhci_pci.c,v 1.21.4.1 2021/05/17 15:50:35 martin Exp $ */ /* OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp */ /* @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.21 2019/01/23 06:56:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.21.4.1 2021/05/17 15:50:35 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_xhci_pci.h" @@ -213,7 +213,7 @@ xhci_pci_attach(device_t parent, device_ xhci_intr, sc, device_xname(sc->sc_dev)); if (psc->sc_ih == NULL) { pci_intr_release(pc, psc->sc_pihp, 1); - psc->sc_ih = NULL; + psc->sc_pihp = NULL; aprint_error_dev(self, "couldn't establish interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr);
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun May 9 07:09:27 UTC 2021 Modified Files: src/sys/dev/pci [netbsd-9]: siisata_pci.c Log Message: Pull up following revision(s) (requested by dolecek in ticket #1270): sys/dev/pci/siisata_pci.c: revision 1.21 disable MSI for SiI3124 - interrupts don't seem to work on this old board when MSI is enabled, maybe because it's behind a PCI bridge PR kern/55115 by John D. Baker To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/dev/pci/siisata_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/siisata_pci.c diff -u src/sys/dev/pci/siisata_pci.c:1.20 src/sys/dev/pci/siisata_pci.c:1.20.4.1 --- src/sys/dev/pci/siisata_pci.c:1.20 Thu Oct 25 21:03:19 2018 +++ src/sys/dev/pci/siisata_pci.c Sun May 9 07:09:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: siisata_pci.c,v 1.20 2018/10/25 21:03:19 jdolecek Exp $ */ +/* $NetBSD: siisata_pci.c,v 1.20.4.1 2021/05/09 07:09:27 martin Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.20 2018/10/25 21:03:19 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.20.4.1 2021/05/09 07:09:27 martin Exp $"); #include #include @@ -82,14 +82,22 @@ struct siisata_pci_board { pci_product_id_t spb_prod; uint16_t spb_port; uint16_t spb_chip; + uint8_t sbp_flags; }; +#define SIISATA_BROKEN_MSI 0x01 + static const struct siisata_pci_board siisata_pci_boards[] = { { .spb_vend = PCI_VENDOR_CMDTECH, .spb_prod = PCI_PRODUCT_CMDTECH_3124, .spb_port = 4, .spb_chip = 3124, + /* + * SiI3124 seems to be PCI/PCI-X chip behind PCI-e bridge, + * claims MSI support but interrups don't work with MSI on. + */ + .sbp_flags = SIISATA_BROKEN_MSI, }, { .spb_vend = PCI_VENDOR_CMDTECH, @@ -157,6 +165,9 @@ siisata_pci_attach(device_t parent, devi bus_size_t grsize, prsize; char intrbuf[PCI_INTRSTR_LEN]; + spbp = siisata_pci_lookup(pa); + KASSERT(spbp != NULL); + sc->sc_atac.atac_dev = self; psc->sc_pc = pa->pa_pc; @@ -210,8 +221,19 @@ siisata_pci_attach(device_t parent, devi else sc->sc_dmat = pa->pa_dmat; + int counts[PCI_INTR_TYPE_SIZE] = { + [PCI_INTR_TYPE_INTX] = 1, + [PCI_INTR_TYPE_MSI] = 1, + [PCI_INTR_TYPE_MSIX] = 1, + }; + int max_type = PCI_INTR_TYPE_MSIX; + + if (spbp->sbp_flags & SIISATA_BROKEN_MSI) { + max_type = PCI_INTR_TYPE_INTX; + } + /* map interrupt */ - if (pci_intr_alloc(pa, &psc->sc_pihp, NULL, 0) != 0) { + if (pci_intr_alloc(pa, &psc->sc_pihp, counts, max_type) != 0) { bus_space_unmap(sc->sc_grt, sc->sc_grh, grsize); bus_space_unmap(sc->sc_prt, sc->sc_prh, prsize); aprint_error_dev(self, "couldn't map interrupt\n"); @@ -235,8 +257,6 @@ siisata_pci_attach(device_t parent, devi intrstr ? intrstr : "unknown interrupt"); /* fill in number of ports on this device */ - spbp = siisata_pci_lookup(pa); - KASSERT(spbp != NULL); sc->sc_atac.atac_nchannels = spbp->spb_port; /* set the necessary bits in case the firmware didn't */
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sat Jan 23 13:01:10 UTC 2021 Modified Files: src/sys/dev/pci [netbsd-9]: if_ena.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #1186): sys/dev/pci/if_ena.c: revision 1.27 PR kern/55942: destroyed ena(4) evcnts cause panic Fix event counter teardown code. From KUSABA Takeshi To generate a diff of this commit: cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/sys/dev/pci/if_ena.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_ena.c diff -u src/sys/dev/pci/if_ena.c:1.15.2.3 src/sys/dev/pci/if_ena.c:1.15.2.4 --- src/sys/dev/pci/if_ena.c:1.15.2.3 Wed Aug 5 14:59:41 2020 +++ src/sys/dev/pci/if_ena.c Sat Jan 23 13:01:10 2021 @@ -36,7 +36,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.3 2020/08/05 14:59:41 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.4 2021/01/23 13:01:10 martin Exp $"); #include #include @@ -470,18 +470,20 @@ ena_alloc_counters_hwstats(struct ena_hw + sizeof(st->rx_drops) == sizeof(*st)); } static inline void -ena_free_counters(struct evcnt *begin, int size) +ena_free_counters(struct evcnt *begin, int size, int offset) { struct evcnt *end = (struct evcnt *)((char *)begin + size); + begin = (struct evcnt *)((char *)begin + offset); for (; begin < end; ++begin) counter_u64_free(*begin); } static inline void -ena_reset_counters(struct evcnt *begin, int size) +ena_reset_counters(struct evcnt *begin, int size, int offset) { struct evcnt *end = (struct evcnt *)((char *)begin + size); + begin = (struct evcnt *)((char *)begin + offset); for (; begin < end; ++begin) counter_u64_zero(*begin); @@ -566,9 +568,9 @@ ena_free_io_ring_resources(struct ena_ad struct ena_ring *rxr = &adapter->rx_ring[qid]; ena_free_counters((struct evcnt *)&txr->tx_stats, - sizeof(txr->tx_stats)); + sizeof(txr->tx_stats), offsetof(struct ena_stats_tx, cnt)); ena_free_counters((struct evcnt *)&rxr->rx_stats, - sizeof(rxr->rx_stats)); + sizeof(rxr->rx_stats), offsetof(struct ena_stats_rx, cnt)); ENA_RING_MTX_LOCK(txr); drbr_free(txr->br, M_DEVBUF); @@ -670,7 +672,8 @@ ena_setup_tx_resources(struct ena_adapte /* Reset TX statistics. */ ena_reset_counters((struct evcnt *)&tx_ring->tx_stats, - sizeof(tx_ring->tx_stats)); + sizeof(tx_ring->tx_stats), + offsetof(struct ena_stats_tx, cnt)); tx_ring->next_to_use = 0; tx_ring->next_to_clean = 0; @@ -867,7 +870,8 @@ ena_setup_rx_resources(struct ena_adapte /* Reset RX statistics. */ ena_reset_counters((struct evcnt *)&rx_ring->rx_stats, - sizeof(rx_ring->rx_stats)); + sizeof(rx_ring->rx_stats), + offsetof(struct ena_stats_rx, cnt)); rx_ring->next_to_clean = 0; rx_ring->next_to_use = 0; @@ -2210,7 +2214,8 @@ ena_up_complete(struct ena_adapter *adap ena_refill_all_rx_bufs(adapter); ena_reset_counters((struct evcnt *)&adapter->hw_stats, - sizeof(adapter->hw_stats)); + sizeof(adapter->hw_stats), + offsetof(struct ena_hw_stats, rx_packets)); return (0); } @@ -3905,9 +3910,11 @@ ena_detach(device_t pdev, int flags) ena_free_all_io_rings_resources(adapter); ena_free_counters((struct evcnt *)&adapter->hw_stats, - sizeof(struct ena_hw_stats)); + sizeof(struct ena_hw_stats), + offsetof(struct ena_hw_stats, rx_packets)); ena_free_counters((struct evcnt *)&adapter->dev_stats, - sizeof(struct ena_stats_dev)); + sizeof(struct ena_stats_dev), +offsetof(struct ena_stats_dev, wd_expired)); if (likely(adapter->rss_support)) ena_com_rss_destroy(ena_dev);
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Mon Nov 16 18:21:45 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c Log Message: Pull up following revision(s) (requested by rin in ticket #1133): 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.645.2.9 -r1.645.2.10 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.9 src/sys/dev/pci/if_wm.c:1.645.2.10 --- src/sys/dev/pci/if_wm.c:1.645.2.9 Wed Nov 4 11:48:26 2020 +++ src/sys/dev/pci/if_wm.c Mon Nov 16 18:21:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.10 2020/11/16 18:21:45 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.10 2020/11/16 18:21:45 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -8875,9 +8875,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; } @@ -,9 +8890,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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Wed Nov 4 11:48:26 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c if_wmvar.h Log Message: Pull up following revision(s) (requested by knakahara in ticket #1126): 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.645.2.8 -r1.645.2.9 src/sys/dev/pci/if_wm.c cvs rdiff -u -r1.44.4.2 -r1.44.4.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.645.2.8 src/sys/dev/pci/if_wm.c:1.645.2.9 --- src/sys/dev/pci/if_wm.c:1.645.2.8 Fri Oct 16 08:03:36 2020 +++ src/sys/dev/pci/if_wm.c Wed Nov 4 11:48:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.8 2020/10/16 08:03:36 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.8 2020/10/16 08:03:36 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -375,7 +375,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; @@ -1031,6 +1032,9 @@ static void wm_toggle_lanphypc_pch_lpt(s static int wm_platform_pm_pch_lpt(struct wm_softc *, bool); static int 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); @@ -3077,6 +3081,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)) @@ -3455,6 +3462,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->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->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] * @@ -3498,6 +3548,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); @@ -3512,8 +3568,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 @@ -7627,6 +7692,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] * @@ -7721,6 +7796,23 @@ wm_send_commo
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Oct 16 08:03:36 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1114): 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.645.2.7 -r1.645.2.8 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.7 src/sys/dev/pci/if_wm.c:1.645.2.8 --- src/sys/dev/pci/if_wm.c:1.645.2.7 Wed Sep 23 08:46:54 2020 +++ src/sys/dev/pci/if_wm.c Fri Oct 16 08:03:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.7 2020/09/23 08:46:54 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.8 2020/10/16 08:03:36 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.7 2020/09/23 08:46:54 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.8 2020/10/16 08:03:36 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2860,7 +2860,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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Sep 20 10:16:50 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: virtio_pci.c Log Message: Pull up following revision(s) (requested by jakllsch in ticket #1090): sys/dev/pci/virtio_pci.c: revision 1.13 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.7.4.1 -r1.7.4.2 src/sys/dev/pci/virtio_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/virtio_pci.c diff -u src/sys/dev/pci/virtio_pci.c:1.7.4.1 src/sys/dev/pci/virtio_pci.c:1.7.4.2 --- src/sys/dev/pci/virtio_pci.c:1.7.4.1 Sun Sep 20 10:03:11 2020 +++ src/sys/dev/pci/virtio_pci.c Sun Sep 20 10:16:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $ */ +/* $NetBSD: virtio_pci.c,v 1.7.4.2 2020/09/20 10:16:50 martin Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7.4.2 2020/09/20 10:16:50 martin Exp $"); #include #include @@ -662,10 +662,13 @@ virtio_pci_setup_interrupts(struct virti struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc; device_t self = sc->sc_dev; pci_chipset_tag_t pc = psc->sc_pa.pa_pc; + pcitag_t tag = psc->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(psc->sc_pa.pa_pc, psc->sc_pa.pa_tag); aprint_debug_dev(self, "pci_msix_count=%d\n", nmsix); @@ -726,6 +729,13 @@ retry: psc->sc_ihs_num = 1; psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI; + + error = pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, 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); + } } return 0;
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Sep 20 10:03:11 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: virtio_pci.c Log Message: Pull up following revision(s) (requested by jakllsch in ticket #1089): 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.7 -r1.7.4.1 src/sys/dev/pci/virtio_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/virtio_pci.c diff -u src/sys/dev/pci/virtio_pci.c:1.7 src/sys/dev/pci/virtio_pci.c:1.7.4.1 --- src/sys/dev/pci/virtio_pci.c:1.7 Sun Jan 27 02:08:42 2019 +++ src/sys/dev/pci/virtio_pci.c Sun Sep 20 10:03:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $ */ +/* $NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $"); #include #include @@ -697,7 +697,7 @@ retry: } if (pci_intr_type(pc, psc->sc_ihp[0]) == PCI_INTR_TYPE_MSIX) { - psc->sc_ihs = kmem_alloc(sizeof(*psc->sc_ihs) * nmsix, + psc->sc_ihs = kmem_zalloc(sizeof(*psc->sc_ihs) * nmsix, KM_SLEEP); error = virtio_pci_setup_msix_interrupts(sc, &psc->sc_pa); @@ -714,7 +714,7 @@ retry: psc->sc_ihs_num = nmsix; psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI; } else if (pci_intr_type(pc, psc->sc_ihp[0]) == PCI_INTR_TYPE_INTX) { - psc->sc_ihs = kmem_alloc(sizeof(*psc->sc_ihs) * 1, + psc->sc_ihs = kmem_zalloc(sizeof(*psc->sc_ihs) * 1, KM_SLEEP); error = virtio_pci_setup_intx_interrupt(sc, &psc->sc_pa);
CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Wed Sep 2 12:34:55 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: if_bypass.c ixgbe.c ixgbe_common.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1070): 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.4.8.1 -r1.4.8.2 src/sys/dev/pci/ixgbe/if_bypass.c cvs rdiff -u -r1.199.2.11 -r1.199.2.12 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.25.2.2 -r1.25.2.3 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.4.8.1 src/sys/dev/pci/ixgbe/if_bypass.c:1.4.8.2 --- src/sys/dev/pci/ixgbe/if_bypass.c:1.4.8.1 Sun Jan 26 11:03:17 2020 +++ src/sys/dev/pci/ixgbe/if_bypass.c Wed Sep 2 12:34:55 2020 @@ -45,9 +45,9 @@ static void ixgbe_bypass_mutex_enter(struct adapter *adapter) { - while (atomic_cas_uint(&adapter->bypass.low, 0, 1) == 0) + while (atomic_cas_uint(&adapter->bypass.low, 0, 1) != 0) usec_delay(3000); - while (atomic_cas_uint(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cas_uint(&adapter->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(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cas_uint(&adapter->bypass.high, 1, 0) != 1) usec_delay(6000); - while (atomic_cas_uint(&adapter->bypass.low, 1, 0) == 0) + while (atomic_cas_uint(&adapter->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(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cas_uint(&adapter->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(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cas_uint(&adapter->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(&adapter->bypass.log, 0, 1) == 0) + while (atomic_cas_uint(&adapter->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(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cas_uint(&adapter->bypass.log, 1, 0) != 1) usec_delay(3000); return (error); unlock_err: ixgbe_bypass_mutex_clear(adapter); status = 0; /* reset */ - while (atomic_cas_uint(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cas_uint(&adapter->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.199.2.11 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.12 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.11 Fri Jul 10 11:35:51 2020 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Sep 2 12:34:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.11 2020/07/10 11:35:51 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.12 2020/09/02 12:34:55 martin Exp $ */ /** @@ -861,7 +861,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.25.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.3 --- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.2 Fri Jul 10 11:35:51 2020 +++ src/sys/dev/pci/ixgbe/ixgbe_common.c Wed Sep 2 12:34:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_common.c,v 1.25.2.2 2020/07/10 11:35:51 martin Exp $ */ +/* $NetBSD: ixgbe_common.c,v 1.25.2.3 2020/09/02 1
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Mon Aug 17 11:29:31 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: cmdide.c Log Message: Pull up following revision(s) (requested by jdolecek in ticket #1054): sys/dev/pci/cmdide.c: revision 1.46 remove explicit irqack() call for unexpected interrupt; this happens normally during boot when running identify for the drive as polled command, and fixes hard hang caused by the irqack() on a sun machine the unexpected interrupt happens because cmdide doesn't respect WDCTL_IDS bit and triggers interrupt also for polled commands also reclassify the "bogus intr" as aprint_verbose() to avoid noise on boot discussed and tested by Martin Husemann To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.43.10.1 src/sys/dev/pci/cmdide.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/cmdide.c diff -u src/sys/dev/pci/cmdide.c:1.43 src/sys/dev/pci/cmdide.c:1.43.10.1 --- src/sys/dev/pci/cmdide.c:1.43 Sun Oct 22 13:13:55 2017 +++ src/sys/dev/pci/cmdide.c Mon Aug 17 11:29:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cmdide.c,v 1.43 2017/10/22 13:13:55 jdolecek Exp $ */ +/* $NetBSD: cmdide.c,v 1.43.10.1 2020/08/17 11:29:31 martin Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.43 2017/10/22 13:13:55 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.43.10.1 2020/08/17 11:29:31 martin Exp $"); #include #include @@ -245,10 +245,9 @@ cmd_pci_intr(void *arg) (i == 1 && (secirq & CMD_ARTTIM23_IRQ))) { crv = wdcintr(wdc_cp); if (crv == 0) { -aprint_error("%s:%d: bogus intr\n", +aprint_verbose("%s:%d: bogus intr\n", device_xname( sc->sc_wdcdev.sc_atac.atac_dev), i); -sc->sc_wdcdev.irqack(wdc_cp); } else rv = 1; }
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Aug 9 14:14:34 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: mpii.c Log Message: Pull up following revision(s) (requested by jnemeth in ticket #1044): 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.22 -r1.22.4.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.22 src/sys/dev/pci/mpii.c:1.22.4.1 --- src/sys/dev/pci/mpii.c:1.22 Mon Mar 11 14:35:22 2019 +++ src/sys/dev/pci/mpii.c Sun Aug 9 14:14:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mpii.c,v 1.22 2019/03/11 14:35:22 kardel Exp $ */ +/* $NetBSD: mpii.c,v 1.22.4.1 2020/08/09 14:14:34 martin Exp $ */ /* $OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $ */ /* * Copyright (c) 2010, 2012 Mike Belopuhov @@ -20,7 +20,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.22 2019/03/11 14:35:22 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.22.4.1 2020/08/09 14:14:34 martin Exp $"); #include "bio.h" @@ -244,8 +244,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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Wed Aug 5 14:59:42 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_ena.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #1038): sys/dev/pci/if_ena.c: revision 1.25 PR port-arm/55532: kernel panic with ena on AWS a1.2xlarge Do not mark callout and workqueues as mpsafe unless the NET_MPSAFE option is present. To generate a diff of this commit: cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/dev/pci/if_ena.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_ena.c diff -u src/sys/dev/pci/if_ena.c:1.15.2.2 src/sys/dev/pci/if_ena.c:1.15.2.3 --- src/sys/dev/pci/if_ena.c:1.15.2.2 Sun Mar 8 14:44:06 2020 +++ src/sys/dev/pci/if_ena.c Wed Aug 5 14:59:41 2020 @@ -27,11 +27,16 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#ifdef _KERNEL_OPT +#include "opt_net_mpsafe.h" +#endif + #include #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.2 2020/03/08 14:44:06 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.3 2020/08/05 14:59:41 martin Exp $"); #include #include @@ -56,6 +61,14 @@ __KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1 #include +#ifdef NET_MPSAFE +#define WQ_FLAGS WQ_MPSAFE +#define CALLOUT_FLAGS CALLOUT_MPSAFE +#else +#define WQ_FLAGS 0 +#define CALLOUT_FLAGS 0 +#endif + /* * Function prototypes */ @@ -682,7 +695,7 @@ ena_setup_tx_resources(struct ena_adapte /* Allocate workqueues */ int rc = workqueue_create(&tx_ring->enqueue_tq, "ena_tx_enq", - ena_deferred_mq_start, tx_ring, 0, IPL_NET, WQ_PERCPU | WQ_MPSAFE); + ena_deferred_mq_start, tx_ring, 0, IPL_NET, WQ_PERCPU | WQ_FLAGS); if (unlikely(rc != 0)) { ena_trace(ENA_ALERT, "Unable to create workqueue for enqueue task\n"); @@ -889,7 +902,7 @@ ena_setup_rx_resources(struct ena_adapte /* Allocate workqueues */ int rc = workqueue_create(&rx_ring->cmpl_tq, "ena_rx_comp", - ena_deferred_rx_cleanup, rx_ring, 0, IPL_NET, WQ_PERCPU | WQ_MPSAFE); + ena_deferred_rx_cleanup, rx_ring, 0, IPL_NET, WQ_PERCPU | WQ_FLAGS); if (unlikely(rc != 0)) { ena_trace(ENA_ALERT, "Unable to create workqueue for RX completion task\n"); @@ -3807,11 +3820,11 @@ ena_attach(device_t parent, device_t sel goto err_ifp_free; } - callout_init(&adapter->timer_service, CALLOUT_MPSAFE); + callout_init(&adapter->timer_service, CALLOUT_FLAGS); /* Initialize reset task queue */ rc = workqueue_create(&adapter->reset_tq, "ena_reset_enq", - ena_reset_task, adapter, 0, IPL_NET, WQ_PERCPU | WQ_MPSAFE); + ena_reset_task, adapter, 0, IPL_NET, WQ_PERCPU | WQ_FLAGS); if (unlikely(rc != 0)) { ena_trace(ENA_ALERT, "Unable to create workqueue for reset task\n");
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Jul 26 10:46:14 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pci_subr.c Log Message: Pull up following revision(s) (requested by jdolecek in ticket #1024): sys/dev/pci/pci_subr.c: revision 1.224 change pci_conf_print() to allocate memory for the regs dynamically instead of on-stack To generate a diff of this commit: cvs rdiff -u -r1.215.2.3 -r1.215.2.4 src/sys/dev/pci/pci_subr.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_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.215.2.3 src/sys/dev/pci/pci_subr.c:1.215.2.4 --- src/sys/dev/pci/pci_subr.c:1.215.2.3 Thu Mar 19 19:05:34 2020 +++ src/sys/dev/pci/pci_subr.c Sun Jul 26 10:46:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $ */ +/* $NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v #include #include #include +#include + +#define MALLOC(sz) kmem_alloc(sz, KM_SLEEP) +#define FREE(p, sz) kmem_free(p, sz) + #else #include #include @@ -59,6 +64,10 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v #include #include #include + +#define MALLOC(sz) malloc(sz) +#define FREE(p, sz) free(p) + #endif #include @@ -4811,7 +4820,7 @@ pci_conf_print( #endif ) { - pcireg_t regs[o2i(PCI_EXTCONF_SIZE)]; + pcireg_t *regs; int off, capoff, endoff, hdrtype; const char *type_name; #ifdef _KERNEL @@ -4820,6 +4829,8 @@ pci_conf_print( void (*type_printfn)(const pcireg_t *); #endif + regs = MALLOC(PCI_EXTCONF_SIZE); + printf("PCI configuration registers:\n"); for (off = 0; off < PCI_EXTCONF_SIZE; off += 4) { @@ -4916,7 +4927,7 @@ pci_conf_print( if (regs[o2i(PCI_EXTCAPLIST_BASE)] == 0x || regs[o2i(PCI_EXTCAPLIST_BASE)] == 0) - return; + goto out; printf("\n"); #ifdef _KERNEL @@ -4929,4 +4940,7 @@ pci_conf_print( /* Extended Configuration Space, if present */ printf(" Extended Configuration Space:\n"); pci_conf_print_regs(regs, PCI_EXTCAPLIST_BASE, PCI_EXTCONF_SIZE); + +out: + FREE(regs, PCI_EXTCONF_SIZE); }
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jul 17 15:30:26 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: radeonfb.c radeonfbvar.h Log Message: Pull up following revision(s) (requested by macallan in ticket #1019): sys/dev/pci/radeonfbvar.h: revision 1.21 sys/dev/pci/radeonfb.c: revision 1.107 reduce stack usage in radeonfb_pickres() and radeonfb_set_cursor() forgot to commit a header change, again... To generate a diff of this commit: cvs rdiff -u -r1.104.4.1 -r1.104.4.2 src/sys/dev/pci/radeonfb.c cvs rdiff -u -r1.20 -r1.20.26.1 src/sys/dev/pci/radeonfbvar.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/radeonfb.c diff -u src/sys/dev/pci/radeonfb.c:1.104.4.1 src/sys/dev/pci/radeonfb.c:1.104.4.2 --- src/sys/dev/pci/radeonfb.c:1.104.4.1 Sun Aug 18 09:58:49 2019 +++ src/sys/dev/pci/radeonfb.c Fri Jul 17 15:30:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: radeonfb.c,v 1.104.4.1 2019/08/18 09:58:49 martin Exp $ */ +/* $NetBSD: radeonfb.c,v 1.104.4.2 2020/07/17 15:30:26 martin Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.104.4.1 2019/08/18 09:58:49 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.104.4.2 2020/07/17 15:30:26 martin Exp $"); #include #include @@ -80,6 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v #include #include #include +#include #include #include @@ -3691,12 +3692,12 @@ radeonfb_set_cursor(struct radeonfb_disp unsigned index, count; int i, err; int pitch, size; - struct radeonfb_cursor nc; + struct radeonfb_cursor *nc = &dp->rd_tempcursor; flags = wc->which; /* copy old values */ - nc = dp->rd_cursor; + memcpy(nc, &dp->rd_cursor, sizeof(struct radeonfb_cursor)); if (flags & WSDISPLAY_CURSOR_DOCMAP) { index = wc->cmap.index; @@ -3716,7 +3717,7 @@ radeonfb_set_cursor(struct radeonfb_disp return err; for (i = index; i < index + count; i++) { - nc.rc_cmap[i] = + nc->rc_cmap[i] = (r[i] << 16) + (g[i] << 8) + (b[i] << 0); } } @@ -3731,46 +3732,46 @@ radeonfb_set_cursor(struct radeonfb_disp size = pitch * wc->size.y; /* clear the old cursor and mask */ - memset(nc.rc_image, 0, 512); - memset(nc.rc_mask, 0, 512); + memset(nc->rc_image, 0, 512); + memset(nc->rc_mask, 0, 512); - nc.rc_size = wc->size; + nc->rc_size = wc->size; - if ((err = copyin(wc->image, nc.rc_image, size)) != 0) + if ((err = copyin(wc->image, nc->rc_image, size)) != 0) return err; - if ((err = copyin(wc->mask, nc.rc_mask, size)) != 0) + if ((err = copyin(wc->mask, nc->rc_mask, size)) != 0) return err; } if (flags & WSDISPLAY_CURSOR_DOHOT) { - nc.rc_hot = wc->hot; - if (nc.rc_hot.x >= nc.rc_size.x) - nc.rc_hot.x = nc.rc_size.x - 1; - if (nc.rc_hot.y >= nc.rc_size.y) - nc.rc_hot.y = nc.rc_size.y - 1; + nc->rc_hot = wc->hot; + if (nc->rc_hot.x >= nc->rc_size.x) + nc->rc_hot.x = nc->rc_size.x - 1; + if (nc->rc_hot.y >= nc->rc_size.y) + nc->rc_hot.y = nc->rc_size.y - 1; } if (flags & WSDISPLAY_CURSOR_DOPOS) { - nc.rc_pos = wc->pos; - if (nc.rc_pos.x >= dp->rd_virtx) - nc.rc_pos.x = dp->rd_virtx - 1; + nc->rc_pos = wc->pos; + if (nc->rc_pos.x >= dp->rd_virtx) + nc->rc_pos.x = dp->rd_virtx - 1; #if 0 - if (nc.rc_pos.x < 0) - nc.rc_pos.x = 0; + if (nc->rc_pos.x < 0) + nc->rc_pos.x = 0; #endif - if (nc.rc_pos.y >= dp->rd_virty) - nc.rc_pos.y = dp->rd_virty - 1; + if (nc->rc_pos.y >= dp->rd_virty) + nc->rc_pos.y = dp->rd_virty - 1; #if 0 - if (nc.rc_pos.y < 0) - nc.rc_pos.y = 0; + if (nc->rc_pos.y < 0) + nc->rc_pos.y = 0; #endif } if (flags & WSDISPLAY_CURSOR_DOCUR) { - nc.rc_visible = wc->enable; + nc->rc_visible = wc->enable; } - dp->rd_cursor = nc; + memcpy(&dp->rd_cursor, nc, sizeof(struct radeonfb_cursor)); radeonfb_cursor_update(dp, wc->which); return 0; @@ -4171,10 +4172,14 @@ radeonfb_pickres(struct radeonfb_display } } else { - struct videomode modes[64]; + struct videomode *modes; + size_t smodes; int nmodes = 0; int valid = 0; + smodes = sizeof(struct videomode) * 64; + modes = kmem_alloc(smodes, KM_SLEEP); + for (i = 0; i < dp->rd_ncrtcs; i++) { /* * pick the largest resolution in common. @@ -4243,6 +4248,8 @@ radeonfb_pickres(struct radeonfb_display *y = modes[i].vdisplay; } } + kmem_free(modes, smodes); + } if ((*x == 0) || (*y == 0)) { Index: src/sys/dev/pci/radeonfbvar.h diff -u src/sys/dev/pci/radeonfbvar.h:1.20 src/sys/dev/pci/radeonfbvar.h:1.20.26.1 --- src/sys/dev/pci/radeonfbvar.h:1.20 Wed Nov 5 19:39:17 2014 +++ src/sys/dev/pci/radeonfbvar.h Fri Jul 17 15:30:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: radeonfbvar.h,v 1.20 2014/11/05 19:39:17 macallan Exp $ */ +/* $NetBSD: radeonfbvar.h,v 1.20.26.1 2020/07/17 15:30:26 martin Exp $ */ /*- * Copy
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Jul 16 12:39:11 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: piixpm.c piixpmreg.h Log Message: Pull up the following revisions, requested by msaitoh in ticket #1017: 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 and 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.54 -r1.54.2.1 src/sys/dev/pci/piixpm.c cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/dev/pci/piixpmreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/piixpm.c diff -u src/sys/dev/pci/piixpm.c:1.54 src/sys/dev/pci/piixpm.c:1.54.2.1 --- src/sys/dev/pci/piixpm.c:1.54 Sat Jul 13 09:24:17 2019 +++ src/sys/dev/pci/piixpm.c Thu Jul 16 12:39:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: piixpm.c,v 1.54 2019/07/13 09:24:17 msaitoh Exp $ */ +/* $NetBSD: piixpm.c,v 1.54.2.1 2020/07/16 12:39:11 martin Exp $ */ /* $OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $ */ /* @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54 2019/07/13 09:24:17 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.1 2020/07/16 12:39:11 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->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->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->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(&iba, 0, sizeof(iba)); iba.iba_type = I2C_TYPE_SMBUS; - iba.iba_tag = &sc->sc_i2c_tags[i]; + iba.iba_tag = tag; sc->sc_i2c_device[i] = config_found_ia(self, ifattr, &iba, 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, &ioh)) { @@ -420,6 +432,8 @@ piixpm_sb800_init(struct piixpm_softc *s val = bus
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Wed Jul 15 17:16:59 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_ti.c if_tireg.h Log Message: Pull up the following revisions, requested by msaitoh in ticket #1014: sys/dev/pci/if_ti.c 1.116-1.120 via patch sys/dev/pci/if_tireg.h 1.26 - Don't clear CFI and priority bit to pass them to the upper layer. - Add support for Farallon PN9000SX from FreeBSD. - Fix typo in comment. - Style fix. To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.112.2.1 src/sys/dev/pci/if_ti.c cvs rdiff -u -r1.21 -r1.21.4.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.112 src/sys/dev/pci/if_ti.c:1.112.2.1 --- src/sys/dev/pci/if_ti.c:1.112 Tue Jul 9 08:46:59 2019 +++ src/sys/dev/pci/if_ti.c Wed Jul 15 17:16:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ti.c,v 1.112 2019/07/09 08:46:59 msaitoh Exp $ */ +/* $NetBSD: if_ti.c,v 1.112.2.1 2020/07/15 17:16:59 martin Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.112 2019/07/09 08:46:59 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.112.2.1 2020/07/15 17:16:59 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 } }; @@ -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) { @@ -762,7 +764,7 @@ ti_newbuf_std(struct ti_softc *sc, int i } /* - * Intialize a mini receive ring descriptor. This only applies to + * Initialize a mini receive ring descriptor. This only applies to * the Tigon 2. */ static int @@ -903,7 +905,7 @@ ti_init_rx_ring_std(struct ti_softc *sc) for (i = 0; i < TI_SSLOTS; i++) { if (ti_newbuf_std(sc, i, NULL, 0) == ENOBUFS) return (ENOBUFS); - }; + } TI_UPDATE_STDPROD(sc, i - 1); sc->ti_std = i - 1; @@ -941,7 +943,7 @@ ti_init_rx_ring_jumbo(struct ti_softc *s for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) return (ENOBUFS); - }; + } TI_UPDATE_JUMBOPROD(sc, i - 1); sc->ti_jumbo = i - 1; @@ -974,7 +976,7 @@ ti_init_rx_ring_mini(struct ti_softc *sc for (i = 0; i < TI_MSLOTS; i++) { if (ti_newbuf_mini(sc, i, NULL, 0) == ENOBUFS) return (ENOBUFS); - }; + } TI_UPDATE_MINIPROD(sc, i - 1); sc->ti_mini = i - 1; @@ -2026,10 +2028,8 @@ ti_rxeof(struct ti_softc *sc) break; } - if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { - /* ti_vlan_tag also has the priority, trim it */ - vlan_set_tag(m, cur_rx->ti_vlan_tag & 0x0fff); - } + if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) + vlan_set_tag(m, cur_rx->ti_vlan_tag); if_percpuq_enqueue(ifp->if_percpuq, m); } @@ -2205,7 +2205,7 @@ ti_stats_update(struct ti_softc *sc) } /* - * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data + * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data * pointers to descriptors. */ static int @@ -2684,7 +2684,7 @@ ti_ifmedia_sts(struct ifnet *ifp, struct static int ti_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data) { - struct ifaddr *ifa = (struct ifaddr *) data; + struct ifaddr *ifa = (struct ifaddr *)data; struct ti_softc *sc = ifp->if_softc; if ((ifp->if_flags & IFF_UP) == 0) { @@ -2717,7 +2717,7 @@ static int ti_ioctl(struct ifnet *ifp, u_long command, void *data) { struct ti_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; struct ti_cmd_desc cmd; Index: src/sys/dev/pci/if_tireg.h diff -u src/sys/dev/pci/if_tireg.h:1.21 src/sys/dev/pci/if_tireg.h:1.21.4.1 --- src/sys/dev/pci/if_tireg.h:1.21 Tue Mar 5 08:25:02 2019 +++ src/sys/dev/pci/if_tireg.h Wed Jul 15 17:16:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tireg.h,v 1.21 2019/03/05 08:25:02 msaitoh Exp $ */ +/* $NetBSD: if_tireg.h,v 1.21.4.1 2020/07/15 17:16:59 martin Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -39,7 +39,7 @@ * which can be accessed with the CSR_READ_4()/CSR_WRITE_4() macros. * Each register must be accessed using 32 bit operations. * - * All reegisters are accessed through a 16K shared memory block. + * All registers are accessed through a 16K shared memory block. * The first group of registers are actually copies of the PCI * configuration space registers. */
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Mon Jul 13 14:11:55 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: vioscsi.c Log Message: Pull up following revision(s) (requested by kim in ticket #1001): 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.21 -r1.21.4.1 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.21 src/sys/dev/pci/vioscsi.c:1.21.4.1 --- src/sys/dev/pci/vioscsi.c:1.21 Sat Apr 13 06:17:33 2019 +++ src/sys/dev/pci/vioscsi.c Mon Jul 13 14:11:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vioscsi.c,v 1.21 2019/04/13 06:17:33 maxv Exp $ */ +/* $NetBSD: vioscsi.c,v 1.21.4.1 2020/07/13 14:11:55 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.21 2019/04/13 06:17:33 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.21.4.1 2020/07/13 14:11:55 martin Exp $"); #include #include @@ -194,7 +194,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->sc_channel, scsiprint); @@ -318,7 +318,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-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Fri Jul 10 11:35:51 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: 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 #997: 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 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.54.2.3 -r1.54.2.4 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.199.2.10 -r1.199.2.11 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.56.2.2 -r1.56.2.3 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.12.8.2 -r1.12.8.3 src/sys/dev/pci/ixgbe/ixgbe_82598.c cvs rdiff -u -r1.25.2.1 -r1.25.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.c cvs rdiff -u -r1.9.4.2 -r1.9.4.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c cvs rdiff -u -r1.23.6.2 -r1.23.6.3 src/sys/dev/pci/ixgbe/ixgbe_osdep.h cvs rdiff -u -r1.18.4.2 -r1.18.4.3 src/sys/dev/pci/ixgbe/ixgbe_phy.c cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/sys/dev/pci/ixgbe/ixgbe_vf.c cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/dev/pci/ixgbe/ixgbe_x550.c cvs rdiff -u -r1.125.2.9 -r1.125.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/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.3 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.4 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.3 Sun Jan 26 11:03:17 2020 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Fri Jul 10 11:35:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.54.2.3 2020/01/26 11:03:17 martin Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.54.2.4 2020/07/10 11:35:51 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.199.2.10 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.11 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.10 Tue Jan 28 11:09:27 2020 +++ src/sys/dev/pci/ixgbe/ixgbe.c Fri Jul 10 11:35:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.10 2020/01/28 11:09:27 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.11 2020/07/10 11:35:51 martin Exp $ */ /***
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jul 10 11:31:59 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: ichsmb.c Log Message: Pull up the following revisions, via patch, requested by msaitoh in ticket #996: sys/dev/pci/ichsmb.c1.62, 1.66-1.68 - Fix LOCKDEBUG panic on detach when attach failed. - Add Comet Lake, Whiskey Lake U and Amber Lake Y support. - Whitespace fix. To generate a diff of this commit: cvs rdiff -u -r1.60.4.1 -r1.60.4.2 src/sys/dev/pci/ichsmb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ichsmb.c diff -u src/sys/dev/pci/ichsmb.c:1.60.4.1 src/sys/dev/pci/ichsmb.c:1.60.4.2 --- src/sys/dev/pci/ichsmb.c:1.60.4.1 Sun Mar 1 12:48:25 2020 +++ src/sys/dev/pci/ichsmb.c Fri Jul 10 11:31:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ichsmb.c,v 1.60.4.1 2020/03/01 12:48:25 martin Exp $ */ +/* $NetBSD: ichsmb.c,v 1.60.4.2 2020/07/10 11:31:59 martin Exp $ */ /* $OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $ */ /* @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.1 2020/03/01 12:48:25 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.2 2020/07/10 11:31:59 martin Exp $"); #include #include @@ -125,8 +125,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: @@ -163,6 +165,7 @@ ichsmb_attach(device_t parent, device_t sc->sc_pc = pa->pa_pc; pci_aprint_devinfo(pa, NULL); + mutex_init(&sc->sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE); /* Read configuration */ conf = pci_conf_read(pa->pa_pc, pa->pa_tag, LPCIB_SMB_HOSTC); @@ -208,7 +211,6 @@ ichsmb_attach(device_t parent, device_t sc->sc_i2c_device = NULL; flags = 0; - mutex_init(&sc->sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE); ichsmb_rescan(self, "i2cbus", &flags); out: if (!pmf_device_register(self, NULL, NULL)) @@ -322,7 +324,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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jul 10 10:45:56 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c if_wmreg.h if_wmvar.h Log Message: Pull up the following revisions, requested by msaitoh in ticket #994: sys/dev/pci/if_wm.c 1.655-1.658, 1.660, 1.662, 1.664-1.668, 1.671-1.674, 1.678,1.680-1.681 via patch sys/dev/pci/if_wmreg.c 1.118-1.119 sys/dev/pci/if_wmvar.c 1.45 - Add SFP support. Module insertion/removal is not supported yet. Currently, SFP detection is only done in the driver's attach phase. - Detect the Media Auto Sense feature. Not supported yet. - Fix SFF_SFP_ETH_FLAGS_100FX. It's not 0x10 but 0x20. - Add extra delay in wm_serdes_power_up_link_82575(). - Add Intel I219 LM10-LM15 and V10-V14. - wm(4) can use workqueue as deferred Rx/Tx handler. Set hw.wm*.txrx_workqueue=1 to use workqueue instead of softint. The default value of hw.wm*.txrx_workqueue is 0 which use softint as before. - Unset RSS UDP flags like ixg(4) and other OSes. To handle IP fragmented UDP, first packet and second packet should be processed in the same Rx queue. - It's useless to not to set PCI_PMCSR_PME_STS bit when writing because the bit is W1C. Instead, always write PCI_PMCSR_PME_STS bit to clear in case it's already set. - Actually writing always the checksum offload context descriptor makes the HW do extra processing, avoid doing that if possible. - Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if the system uses iNVM. - "wmX: 0" on 82542 is difficult to understand, so don't print it. - Rename some macros and function. - KNF. Add comment. To generate a diff of this commit: cvs rdiff -u -r1.645.2.4 -r1.645.2.5 src/sys/dev/pci/if_wm.c cvs rdiff -u -r1.115.2.1 -r1.115.2.2 src/sys/dev/pci/if_wmreg.h cvs rdiff -u -r1.44 -r1.44.4.1 src/sys/dev/pci/if_wmvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.4 src/sys/dev/pci/if_wm.c:1.645.2.5 --- src/sys/dev/pci/if_wm.c:1.645.2.4 Sun Jan 26 11:13:27 2020 +++ src/sys/dev/pci/if_wm.c Fri Jul 10 10:45:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.4 2020/01/26 11:13:27 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.5 2020/07/10 10:45:56 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.4 2020/01/26 11:13:27 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.5 2020/07/10 10:45:56 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -105,6 +105,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1. #include #include #include +#include +#include #include @@ -156,7 +158,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1. #define WM_DEBUG_LOCK __BIT(7) 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) do { if (wm_debug & (x)) printf y; } while (0) #else #define DPRINTF(x, y) __nothing @@ -164,11 +165,17 @@ int wm_debug = WM_DEBUG_TX | WM_DEBUG_RX #ifdef NET_MPSAFE #define WM_MPSAFE 1 -#define CALLOUT_FLAGS CALLOUT_MPSAFE +#define WM_CALLOUT_FLAGS CALLOUT_MPSAFE +#define WM_SOFTINT_FLAGS SOFTINT_MPSAFE +#define WM_WORKQUEUE_FLAGS WQ_PERCPU | WQ_MPSAFE #else -#define CALLOUT_FLAGS 0 +#define WM_CALLOUT_FLAGS 0 +#define WM_SOFTINT_FLAGS 0 +#define WM_WORKQUEUE_FLAGS WQ_PERCPU #endif +#define WM_WORKQUEUE_PRI PRI_SOFTNET + /* * This device driver's max interrupt numbers. */ @@ -374,6 +381,12 @@ struct wm_txqueue { bool txq_sending; time_t txq_lastsent; + /* Checksum flags used for previous packet */ + uint32_t txq_last_hw_cmd; + uint8_t txq_last_hw_fields; + uint16_t txq_last_hw_ipcs; + uint16_t txq_last_hw_tucs; + uint32_t txq_packets; /* for AIM */ uint32_t txq_bytes; /* for AIM */ #ifdef WM_EVENT_COUNTERS @@ -398,6 +411,7 @@ struct wm_txqueue { 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 */ + WM_Q_EVCNT_DEFINE(txq, skipcontext) /* Tx skip wring cksum context */ char txq_txseg_evcnt_names[WM_NTXSEGS][sizeof("txqXXtxsegXXX")]; struct evcnt txq_ev_txseg[WM_NTXSEGS]; /* Tx packets w/ N segments */ @@ -457,6 +471,8 @@ struct wm_queue { struct wm_txqueue wmq_txq; struct wm_rxqueue wmq_rxq; + bool wmq_txrx_use_workqueue; + struct work wmq_cookie; void *wmq_si; krndsource_t rnd_source; /* random source */ }; @@ -467,6 +483,7 @@ struct wm_phyop { int (*readreg_locked)(device_t, int, int, uint16_t *); int (*writereg_locked)(device_t, int, int, uint16_t); int reset_delay_us; + bool no_errprint; }; struct w
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jul 10 10:25:25 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pcidevs.h pcidevs_data.h Log Message: Regen for ticket #991 To generate a diff of this commit: cvs rdiff -u -r1.1371.2.8 -r1.1371.2.9 src/sys/dev/pci/pcidevs.h cvs rdiff -u -r1.1370.2.8 -r1.1370.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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jul 10 10:23:57 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pcidevs Log Message: Pull up the following revisions, requested by msaitoh in ticket #991: sys/dev/pci/pcidevs 1.1403-1.1407, 1.1409, 1.1412-1.1418 via patch - Add NVIDIA Quadro NVS 295. - Add more RDC products from Andrius V. - Add some Intel UHD Graphics devices. Mainly taken from OpenBSD. - 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.1383.2.8 -r1.1383.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.1383.2.8 src/sys/dev/pci/pcidevs:1.1383.2.9 --- src/sys/dev/pci/pcidevs:1.1383.2.8 Tue Jul 7 10:29:05 2020 +++ src/sys/dev/pci/pcidevs Fri Jul 10 10:23:57 2020 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1383.2.8 2020/07/07 10:29:05 martin Exp $ +$NetBSD: pcidevs,v 1.1383.2.9 2020/07/10 10:23:57 martin Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -654,6 +654,7 @@ 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 @@ -1024,11 +1025,13 @@ 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 @@ -1219,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 @@ -1293,7 +1306,6 @@ product AQUANTIA AQC100 0x00b1 AQC100 1 product AQUANTIA AQC107 0x07b1 AQC107 10 Gigabit Network Adapter product AQUANTIA AQC108 0x08b1 AQC108 5 Gigabit Network Adapter product AQUANTIA AQC109 0x09b1 AQC109 2.5 Gigabit Network Adapter -product AQUANTIA AQC100 0x00b1 AQC100 10 Gigabit Network Adapter product AQUANTIA AQC111 0x11b1 AQC111 5 Gigabit Network Adapter product AQUANTIA AQC112 0x12b1 AQC112 2.5 Gigabit Network Adapter product AQUANTIA AQC100S 0x80b1 AQC100S 10 Gigabit Network Adapter @@ -1336,6 +1348,7 @@ product ARECA ARC1880 0x1880 ARC-1880 /* ASIX Electronics products */ product ASIX AX88140A 0x1400 AX88140A 10/100 Ethernet +product ASIX AX99100 0x9100 AX99100 Multi I/O Controller /* ASMedia products */ product ASMEDIA ASM1061_01 0x0601 ASM1061 AHCI SATA III Controller @@ -1786,6 +1799,7 @@ product ATI RADEON_HD6320 0x9806 Radeon product ATI RADEON_HD7340 0x9808 Radeon HD7340 Graphics product ATI RADEON_HDMI_DP_AUDIO 0x9840 HDMI/DP Audio product ATI RADEON_R2_R3_R3E_R4 0x9854 Radeon R2/R3/R4 Graphics +product ATI RADEON_R5_R6_R7 0x9874 Radeon R5/R6/R7 Graphics product ATI RADEON_HD2900_HDA 0xaa00 Radeon HD 2900 HD Audio Controller product ATI RADEON_HD3650_HDA 0xaa01 Radeon HD 3650/3730/3750 HD Audio Controller product ATI RADEON_HD2600_HDA 0xaa08 Radeon HD 2600 HD Audio Controller @@ -3085,6 +3099,41 @@ product INTEL IVYBRIDGE_PCIE_3 0x015d Iv product INTEL IVYBRIDGE_IGD_1 0x0162 Ivy Bridge I
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Jul 7 12:02:29 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_aq.c Log Message: Also pull up more cosmetic revisions to minimize diffs with HEAD, requested by jmcneill in ticket #980: sys/dev/pci/if_aq.c 1.8,1.17 constify, remove duplicate ; To generate a diff of this commit: cvs rdiff -u -r1.17.2.2 -r1.17.2.3 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.17.2.2 src/sys/dev/pci/if_aq.c:1.17.2.3 --- src/sys/dev/pci/if_aq.c:1.17.2.2 Tue Jul 7 10:29:05 2020 +++ src/sys/dev/pci/if_aq.c Tue Jul 7 12:02:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.17.2.2 2020/07/07 10:29:05 martin Exp $ */ +/* $NetBSD: if_aq.c,v 1.17.2.3 2020/07/07 12:02:29 martin Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.17.2.2 2020/07/07 10:29:05 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.17.2.3 2020/07/07 12:02:29 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -952,7 +952,7 @@ struct aq_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_size_t sc_iosize; - bus_dma_tag_t sc_dmat;; + bus_dma_tag_t sc_dmat; void *sc_ihs[AQ_NINTR_MAX]; pci_intr_handle_t *sc_intrs; @@ -985,7 +985,7 @@ struct aq_softc { kmutex_t sc_mutex; kmutex_t sc_mpi_mutex; - struct aq_firmware_ops *sc_fw_ops; + const struct aq_firmware_ops *sc_fw_ops; uint64_t sc_fw_caps; enum aq_media_type sc_media_type; aq_link_speed_t sc_available_rates; @@ -1124,7 +1124,7 @@ static int fw2x_get_stats(struct aq_soft static int fw2x_get_temperature(struct aq_softc *, uint32_t *); #endif -static struct aq_firmware_ops aq_fw1x_ops = { +static const struct aq_firmware_ops aq_fw1x_ops = { .reset = fw1x_reset, .set_mode = fw1x_set_mode, .get_mode = fw1x_get_mode, @@ -1134,7 +1134,7 @@ static struct aq_firmware_ops aq_fw1x_op #endif }; -static struct aq_firmware_ops aq_fw2x_ops = { +static const struct aq_firmware_ops aq_fw2x_ops = { .reset = fw2x_reset, .set_mode = fw2x_set_mode, .get_mode = fw2x_get_mode,
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Jul 7 10:46:27 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: auixp.c Log Message: Pull up following revision(s) (requested by isaki in ticket #983): sys/dev/pci/auixp.c: revision 1.50 Fix an argument passes to auixp_intr(). This is rest of rev 1.39 (split device_t/softc) in 2012. Problem reported and tested by Riccardo Mottola. To generate a diff of this commit: cvs rdiff -u -r1.47.2.1 -r1.47.2.2 src/sys/dev/pci/auixp.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/auixp.c diff -u src/sys/dev/pci/auixp.c:1.47.2.1 src/sys/dev/pci/auixp.c:1.47.2.2 --- src/sys/dev/pci/auixp.c:1.47.2.1 Sat Mar 21 15:31:50 2020 +++ src/sys/dev/pci/auixp.c Tue Jul 7 10:46:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: auixp.c,v 1.47.2.1 2020/03/21 15:31:50 martin Exp $ */ +/* $NetBSD: auixp.c,v 1.47.2.2 2020/07/07 10:46:27 martin Exp $ */ /* * Copyright (c) 2004, 2005 Reinoud Zandijk @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.47.2.1 2020/03/21 15:31:50 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.47.2.2 2020/07/07 10:46:27 martin Exp $"); #include #include @@ -1123,7 +1123,7 @@ auixp_attach(device_t parent, device_t s /* establish interrupt routine hookup at IPL_AUDIO level */ sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_AUDIO, auixp_intr, - self, device_xname(self)); + sc, device_xname(self)); if (sc->sc_ih == NULL) { aprint_error_dev(sc->sc_dev, "can't establish interrupt"); if (intrstr != NULL)
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Jul 7 10:31:09 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pcidevs.h pcidevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.1371.2.7 -r1.1371.2.8 src/sys/dev/pci/pcidevs.h cvs rdiff -u -r1.1370.2.7 -r1.1370.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. diffs are larger than 1MB and have been omitted
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Apr 28 15:44:07 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_mcx.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #858): sys/dev/pci/if_mcx.c: revision 1.13 mcx: sync with OpenBSD sys/dev/pci/if_mcx.c r1.44 1.44: Fix typo which could lead into a double free 1.43: Commands that create objects return a 24 bit object ID, so mask off the high 8 bits of the value we extract, in case the firmware leaves junk there. Hrvoje Popovski has seen this with newer firmware on a ConnectX 5 card, which now works properly. 1.42: Increase the completion queue size to prevent overflow. Under reasonably unlikely circumstances - lots of single-fragment packets being sent, a significant number of packets being received, while the interrupt handler was unable to process the completion queue - the completion queue could overflow, which would result in the interface locking up. 1.41: Check if we've reached the end of the current mailbox before writing past the end of it, rather than after. Now we can actually allocate queues big enough to need multiple mailboxes. 1.40: Don't call mcx_intr() from mcx_cmdq_poll(); this was a leftover from early development that I forgot about, but turns out to be a potential race with the actual interrupt handler. 1.39: fix previous: use the correct offset for sq/rq creation, and don't reset the mbox counter to 0 after calculating it. 1.38: Add a helper function for writing physical addresses for queues into command queue mailboxes, and use this for all queue setup commands. Previously we just assumed the addresses would fit in the first mailbox, which is currently true but may not be for much longer. 1.37: (skipped) 1.36: The event queue consumer counter also needs to be unsigned like the others. 1.35: try to make if_baudrate look plausible. this updates the eth proto capability map so it records the baudrate against the different link types and their media, and then reads it when the link state changes. 1.34: (skipped) To generate a diff of this commit: cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/dev/pci/if_mcx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_mcx.c diff -u src/sys/dev/pci/if_mcx.c:1.1.2.9 src/sys/dev/pci/if_mcx.c:1.1.2.10 --- src/sys/dev/pci/if_mcx.c:1.1.2.9 Sun Mar 1 12:47:10 2020 +++ src/sys/dev/pci/if_mcx.c Tue Apr 28 15:44:06 2020 @@ -1,5 +1,5 @@ -/* $NetBSD: if_mcx.c,v 1.1.2.9 2020/03/01 12:47:10 martin Exp $ */ -/* $OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */ +/* $NetBSD: if_mcx.c,v 1.1.2.10 2020/04/28 15:44:06 martin Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.44 2020/04/24 07:28:37 mestre Exp $ */ /* * Copyright (c) 2017 David Gwynne @@ -82,7 +82,7 @@ /* queue sizes */ #define MCX_LOG_EQ_SIZE 6 /* one page */ -#define MCX_LOG_CQ_SIZE 11 +#define MCX_LOG_CQ_SIZE 12 #define MCX_LOG_RQ_SIZE 10 #define MCX_LOG_SQ_SIZE 11 @@ -154,33 +154,33 @@ #define MCX_REG_PPCNT 0x5008 #define MCX_REG_MCIA 0x9014 -#define MCX_ETHER_CAP_SGMII (1 << 0) -#define MCX_ETHER_CAP_1000_KX (1 << 1) -#define MCX_ETHER_CAP_10G_CX4 (1 << 2) -#define MCX_ETHER_CAP_10G_KX4 (1 << 3) -#define MCX_ETHER_CAP_10G_KR (1 << 4) -#define MCX_ETHER_CAP_20G_KR2 (1 << 5) -#define MCX_ETHER_CAP_40G_CR4 (1 << 6) -#define MCX_ETHER_CAP_40G_KR4 (1 << 7) -#define MCX_ETHER_CAP_56G_R4 (1 << 8) -#define MCX_ETHER_CAP_10G_CR (1 << 12) -#define MCX_ETHER_CAP_10G_SR (1 << 13) -#define MCX_ETHER_CAP_10G_LR (1 << 14) -#define MCX_ETHER_CAP_40G_SR4 (1 << 15) -#define MCX_ETHER_CAP_40G_LR4 (1 << 16) -#define MCX_ETHER_CAP_50G_SR2 (1 << 18) -#define MCX_ETHER_CAP_100G_CR4 (1 << 20) -#define MCX_ETHER_CAP_100G_SR4 (1 << 21) -#define MCX_ETHER_CAP_100G_KR4 (1 << 22) -#define MCX_ETHER_CAP_100G_LR4 (1 << 23) -#define MCX_ETHER_CAP_100_TX (1 << 24) -#define MCX_ETHER_CAP_1000_T (1 << 25) -#define MCX_ETHER_CAP_10G_T (1 << 26) -#define MCX_ETHER_CAP_25G_CR (1 << 27) -#define MCX_ETHER_CAP_25G_KR (1 << 28) -#define MCX_ETHER_CAP_25G_SR (1 << 29) -#define MCX_ETHER_CAP_50G_CR2 (1 << 30) -#define MCX_ETHER_CAP_50G_KR2 (1 << 31) +#define MCX_ETHER_CAP_SGMII 0 +#define MCX_ETHER_CAP_1000_KX 1 +#define MCX_ETHER_CAP_10G_CX4 2 +#define MCX_ETHER_CAP_10G_KX4 3 +#define MCX_ETHER_CAP_10G_KR 4 +#define MCX_ETHER_CAP_20G_KR2 5 +#define MCX_ETHER_CAP_40G_CR4 6 +#define MCX_ETHER_CAP_40G_KR4 7 +#define MCX_ETHER_CAP_56G_R4 8 +#define MCX_ETHER_CAP_10G_CR 12 +#define MCX_ETHER_CAP_10G_SR 13 +#define MCX_ETHER_CAP_10G_LR 14 +#define MCX_ETHER_CAP_40G_SR4 15 +#define MCX_ETHER_CAP_40G_LR4 16 +#define MCX_ETHER_CAP_50G_SR2 18 +#define MCX_ETHER_CAP_100G_CR4 20 +#define MCX_ETHER_CAP_100G_SR4 21 +#define MCX_ETHER_CAP_100G_KR4 22 +#define MCX_ETHER_CAP_100G_LR4 23 +#define MCX_ETHER_CAP_100_TX 24 +#define MCX_ETHER_CAP_1000_T 25 +#define MCX_ETHER_CAP_10G_T 26 +#define MCX
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Apr 16 14:02:36 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: machfb.c Log Message: Pull up following revision(s) (requested by jdc in ticket #836): sys/dev/pci/machfb.c: revision 1.98 clean up the video mode selection logic, switch modes only when actually necessary while there make some debug output optional To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.97.4.1 src/sys/dev/pci/machfb.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/machfb.c diff -u src/sys/dev/pci/machfb.c:1.97 src/sys/dev/pci/machfb.c:1.97.4.1 --- src/sys/dev/pci/machfb.c:1.97 Tue Feb 5 06:12:39 2019 +++ src/sys/dev/pci/machfb.c Thu Apr 16 14:02:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machfb.c,v 1.97 2019/02/05 06:12:39 mrg Exp $ */ +/* $NetBSD: machfb.c,v 1.97.4.1 2020/04/16 14:02:36 martin Exp $ */ /* * Copyright (c) 2002 Bang Jun-Young @@ -34,7 +34,7 @@ #include __KERNEL_RCSID(0, - "$NetBSD: machfb.c,v 1.97 2019/02/05 06:12:39 mrg Exp $"); + "$NetBSD: machfb.c,v 1.97.4.1 2020/04/16 14:02:36 martin Exp $"); #include #include @@ -68,6 +68,12 @@ __KERNEL_RCSID(0, #include "opt_machfb.h" #include "opt_glyphcache.h" +#ifdef MACHFB_DEBUG +#define DPRINTF printf +#else +#define DPRINTF while (0) printf +#endif + #define MACH64_REG_SIZE 0x800 #define MACH64_REG_OFF 0x7ff800 @@ -140,6 +146,7 @@ struct mach64_softc { int sc_edid_size; uint8_t sc_edid_data[1024]; struct edid_info sc_ei; + int sc_setmode; u_char sc_cmap_red[256]; u_char sc_cmap_green[256]; @@ -221,7 +228,9 @@ static void mach64_init(struct mach64_so static int mach64_get_memsize(struct mach64_softc *); static int mach64_get_max_ramdac(struct mach64_softc *); +#if 0 static void mach64_get_mode(struct mach64_softc *, struct videomode *); +#endif static int mach64_calc_crtcregs(struct mach64_softc *, struct mach64_crtcregs *, @@ -408,7 +417,7 @@ mach64_attach(device_t parent, device_t const char **memtype_names; struct wsemuldisplaydev_attach_args aa; long defattr; - int setmode = 0, width, height; + int width = 1024, height = 768; pcireg_t screg; uint32_t reg; const pcireg_t enables = PCI_COMMAND_MEM_ENABLE; @@ -426,6 +435,7 @@ mach64_attach(device_t parent, device_t sc->sc_iot = pa->pa_iot; sc->sc_accessops.ioctl = mach64_ioctl; sc->sc_accessops.mmap = mach64_mmap; + sc->sc_setmode = 0; pci_aprint_devinfo(pa, "Graphics processor"); #ifdef MACHFB_DEBUG @@ -498,6 +508,9 @@ mach64_attach(device_t parent, device_t prop_dictionary_get_uint32(device_properties(self), "width", &width); prop_dictionary_get_uint32(device_properties(self), "height", &height); + default_mode.hdisplay = width; + default_mode.vdisplay = height; + memset(&sc->sc_ei, 0, sizeof(sc->sc_ei)); if ((edid_data = prop_dictionary_get(device_properties(self), "EDID")) != NULL) { @@ -513,7 +526,6 @@ mach64_attach(device_t parent, device_t edid_print(&sc->sc_ei); #endif } - is_gx = 0; switch(mach64_chip_id) { case PCI_PRODUCT_ATI_MACH64_GX: @@ -561,9 +573,9 @@ mach64_attach(device_t parent, device_t aprint_debug("using clock %d\n", sc->sc_clock); sc->ref_div = regrb_pll(sc, PLL_REF_DIV); - aprint_error("ref_div: %d\n", sc->ref_div); + DPRINTF("ref_div: %d\n", sc->ref_div); sc->mclk_fb_div = regrb_pll(sc, MCLK_FB_DIV); - aprint_error("mclk_fb_div: %d\n", sc->mclk_fb_div); + DPRINTF("mclk_fb_div: %d\n", sc->mclk_fb_div); sc->mem_freq = (2 * sc->ref_freq * sc->mclk_fb_div) / (sc->ref_div * 2); sc->mclk_post_div = (sc->mclk_fb_div * 2 * sc->ref_freq) / @@ -572,7 +584,7 @@ mach64_attach(device_t parent, device_t { sc->minref = sc->ramdac_freq / 510; sc->m = sc->ref_freq / sc->minref; - aprint_error("minref: %d m: %d\n", sc->minref, sc->m); + DPRINTF("minref: %d m: %d\n", sc->minref, sc->m); } aprint_normal_dev(sc->sc_dev, "%ld KB %s %d.%d MHz, maximum RAMDAC clock %d MHz\n", @@ -604,10 +616,10 @@ mach64_attach(device_t parent, device_t aprint_debug("gen_cntl: %08x\n", regr(sc, CRTC_GEN_CNTL)); #define MODE_IS_VALID(m) ((sc->ramdac_freq >= (m)->dot_clock) && \ - ((m)->hdisplay <= 11280)) + ((m)->hdisplay <= 1280)) /* no mode setting support on ancient chips with external clocks */ - setmode = 0; + sc->sc_setmode = 0; if (!is_gx) { /* * Now pick a mode. @@ -617,7 +629,7 @@ mach64_attach(device_t parent, device_t if (MODE_IS_VALID(m)) { memcpy(&default_mode, m, sizeof(struct videomode)); -setmode = 1; +sc->sc_setmode = 1; } else { aprint_error_dev(sc->sc_dev, "unable to use preferred mode\n"); @@ -627,7 +639,7 @@ mach64_attach(device_t parent, device_t * if we can't use the preferred mode go look for the * best one we can support */ - if (setmode == 0) { + if (sc->sc_setmode == 0) {
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Mar 19 19:13:33 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pcidevs Log Message: Pull up following revision(s) (requested by msaitoh in ticket #784): sys/dev/pci/pcidevs: revision 1.1398 sys/dev/pci/pcidevs: revision 1.1399 sys/dev/pci/pcidevs: revision 1.1400 sys/dev/pci/pcidevs: revision 1.1401 sys/dev/pci/pcidevs: revision 1.1402 add a couple of GPUs i have: product ATI RADEON_HD4290 0x9714 Radeon HD4290 Graphics product NVIDIA GF_440 0x0de0 GeForce GT 440 Add Farallon PN9000SX Ethernet. NVIDIA 0x036[0-7] are nForce MCP55 LPC Bridge. Add device IDs of the VIA VX900 chipset. Add some GeForce devices. To generate a diff of this commit: cvs rdiff -u -r1.1383.2.5 -r1.1383.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.1383.2.5 src/sys/dev/pci/pcidevs:1.1383.2.6 --- src/sys/dev/pci/pcidevs:1.1383.2.5 Fri Jan 31 11:06:31 2020 +++ src/sys/dev/pci/pcidevs Thu Mar 19 19:13:33 2020 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1383.2.5 2020/01/31 11:06:31 martin Exp $ +$NetBSD: pcidevs,v 1.1383.2.6 2020/03/19 19:13:33 martin Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -1775,6 +1775,7 @@ product ATI RADEON_HD6480G_1 0x9648 Rade product ATI RADEON_HD6480G_2 0x9649 Radeon HD 6480G product ATI RADEON_HD6530D 0x964a Radeon HD 6530D product ATI RADEON_HD4200 0x9712 Radeon HD4200 Mobility +product ATI RADEON_HD4290 0x9714 Radeon HD4290 Graphics product ATI RADEON_HD4250 0x9715 Radeon HD4250 GPU (RS880) product ATI RADEON_HD6310 0x9802 Radeon HD6310 Graphics product ATI RADEON_HD6320 0x9806 Radeon HD6320 Graphics @@ -2478,6 +2479,7 @@ product DEC DEFPA 0x000f DEFPA product DEC 21041 0x0014 DC21041 (\"Tulip Plus\") Ethernet product DEC DGLPB 0x0016 DGLPB (\"OPPO\") product DEC 21142 0x0019 DC21142/21143 10/100 Ethernet +product DEC PN9000SX 0x001a Farallon PN9000SX Ethernet product DEC 21052 0x0021 DC21052 PCI-PCI Bridge product DEC 21150 0x0022 DC21150 PCI-PCI Bridge product DEC 21152 0x0024 DC21152 PCI-PCI Bridge @@ -6495,9 +6497,14 @@ product NVIDIA GF_FX5900XT 0x0332 GeForc product NVIDIA GF_FX5950U 0x0333 GeForce FX 5950 Ultra product NVIDIA QUADRO_FX_3000 0x0338 Quadro FX 3000 product NVIDIA GF_FX5700_LE 0x0343 GeForce FX 5700 LE +product NVIDIA MCP55_LPC1 0x0360 nForce MCP55 LPC Bridge product NVIDIA MCP55_LPC2 0x0361 nForce MCP55 LPC Bridge -product NVIDIA MCP55_ISA 0x0362 nForce MCP55 PCI-ISA Bridge -product NVIDIA MCP55_LPC 0x0364 nForce MCP55 LPC Bridge +product NVIDIA MCP55_LPC3 0x0362 nForce MCP55 LPC Bridge +product NVIDIA MCP55_LPC4 0x0363 nForce MCP55 LPC Bridge +product NVIDIA MCP55_LPC5 0x0364 nForce MCP55 LPC Bridge +product NVIDIA MCP55_LPC6 0x0365 nForce MCP55 LPC Bridge +product NVIDIA MCP55_LPC7 0x0366 nForce MCP55 LPC Bridge +product NVIDIA MCP55_LPC8 0x0367 nForce MCP55 LPC Bridge product NVIDIA MCP55_SMB 0x0368 nForce MCP55 SMBus Controller product NVIDIA MCP55_MEM 0x0369 nForce MCP55 Memory Controller product NVIDIA MCP55_MEM2 0x036a nForce MCP55 Memory Controller @@ -6513,6 +6520,9 @@ product NVIDIA MCP55_PCIE2 0x0378 nForce product NVIDIA MCP55_SATA 0x037e nForce MCP55 Serial ATA Controller product NVIDIA MCP55_SATA2 0x037f nForce MCP55 Serial ATA Controller product NVIDIA GF_GO_7600 0x0398 GeForce Go 7600 +product NVIDIA GF_6100_430 0x03d0 GeForce 6100 nForce 430 +product NVIDIA GF_6100_405 0x03d1 GeForce 6100 nForce 405 +product NVIDIA GF_7025_630A 0x03d6 GeForce 7025 nForce 630a product NVIDIA MCP61_ISA 0x03e0 nForce MCP61 PCI-ISA Bridge product NVIDIA MCP61_HDA 0x03e4 nForce MCP61 High Definition Audio Controller product NVIDIA MCP61_LAN1 0x03e5 nForce MCP61 Gigabit Ethernet Controller @@ -6664,6 +6674,7 @@ product NVIDIA GEFORCE_210_HDA 0x0be3 Ge product NVIDIA GF100_HDA 0x0be5 GF100 HD Audio product NVIDIA GF108_HDA 0x0bea GF108 HD Audio product NVIDIA GF116_HDA 0x0bee GF116 HD Audio +product NVIDIA GF_440 0x0de0 GeForce GT 440 product NVIDIA GF_GT640M 0x0fd2 GeForce GT 640M product NVIDIA GT520 0x1040 GeForce GT 520 product NVIDIA GEFORCE_510 0x1042 GeForce 510 @@ -7736,12 +7747,14 @@ product VIATECH VT82C570MV 0x1006 VT82C5 product VIATECH KT880_1 0x1269 KT880 CPU to PCI Bridge product VIATECH VT3351_HB_1351 0x1351 VT3351 Host Bridge product VIATECH P4M900_1 0x1364 CN896/P4M900 Host Bridge +product VIATECH VX900_ERR 0x1410 VX900 Error Reporting product VIATECH VT82C586_IDE 0x1571 VT82C586 IDE Controller product VIATECH VT82C595_2 0x1595 VT82C595 (Apollo VP2) Host-PCI Bridge product VIATECH VT6105M_BOM 0x2006 VT6105M_BOM (Rhine III) 10/100 Ethernet product VIATECH KT880_2 0x2269 KT880 CPU to PCI Bridge product VIATECH VT3351_HB_2351 0x2351 VT3351 Host Bridge product VIATECH P4M900_2 0x2364 CN896/P
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Mar 19 19:05:34 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pci_subr.c pcireg.h Log Message: Pull up following revision(s) (requested by msaitoh in ticket #782): sys/dev/pci/pcireg.h: revision 1.150 sys/dev/pci/pcireg.h: revision 1.151 sys/dev/pci/pci_subr.c: revision 1.220 sys/dev/pci/pci_subr.c: revision 1.221 sys/dev/pci/pcireg.h: revision 1.149 - Print Bridge Config Retry Enable bit and Retimer Presence Detect Supported bit. - Avoid using magic number. Add PCIe 4.0 stuff a little: - 10-bit Tag Requester/Completer. - Add Data link Feature extended capability. - Add Physical Layer 16.0 GT/s extended capability. Not decode yet. Remove unused shift and mask definitions. Add comment. To generate a diff of this commit: cvs rdiff -u -r1.215.2.2 -r1.215.2.3 src/sys/dev/pci/pci_subr.c cvs rdiff -u -r1.147.4.1 -r1.147.4.2 src/sys/dev/pci/pcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.215.2.2 src/sys/dev/pci/pci_subr.c:1.215.2.3 --- src/sys/dev/pci/pci_subr.c:1.215.2.2 Tue Jan 21 15:15:23 2020 +++ src/sys/dev/pci/pci_subr.c Thu Mar 19 19:05:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.215.2.2 2020/01/21 15:15:23 martin Exp $ */ +/* $NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.2 2020/01/21 15:15:23 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -1869,6 +1869,9 @@ pci_conf_print_pcie_cap(const pcireg_t * onoff("Enable No Snoop", reg, PCIE_DCSR_ENA_NO_SNOOP); printf(" Max Read Request Size: %d byte\n", 128 << __SHIFTOUT(reg, PCIE_DCSR_MAX_READ_REQ)); + if (pcie_devtype == PCIE_XCAP_TYPE_PCIE2PCI) + onoff("Bridge Config Retry Enable", reg, + PCIE_DCSR_BRDG_CFG_RETRY); /* Device Status Register */ reg = regs[o2i(capoff + PCIE_DCSR)]; @@ -2162,6 +2165,8 @@ pci_conf_print_pcie_cap(const pcireg_t * printf("Reserved\n"); break; } + onoff("10-bit Tag Completer Supported", reg, PCIE_DCAP2_TBT_COMP); + onoff("10-bit Tag Requester Supported", reg, PCIE_DCAP2_TBT_REQ); printf(" OBFF Supported: "); switch (__SHIFTOUT(reg, PCIE_DCAP2_OBFF)) { case 0x0: @@ -2214,6 +2219,7 @@ pci_conf_print_pcie_cap(const pcireg_t * onoff("LTR Mechanism Enabled", reg, PCIE_DCSR2_LTR_MEC); onoff("Emergency Power Reduction Request", reg, PCIE_DCSR2_EMGPWRRED_REQ); + onoff("10-bit Tag Requester Enabled", reg, PCIE_DCSR2_TBT_REQ); printf(" OBFF: "); switch (__SHIFTOUT(reg, PCIE_DCSR2_OBFF_EN)) { case 0x0: @@ -2254,6 +2260,8 @@ pci_conf_print_pcie_cap(const pcireg_t * pci_print_pcie_linkspeedvector( __SHIFTOUT(reg, PCIE_LCAP2_LOWSKPOS_RECSUPPSV)); printf("\n"); + onoff("Retimer Presence Detect Supported", reg, + PCIE_LCAP2_RETIMERPD); onoff("DRS Supported", reg, PCIE_LCAP2_DRS); drs_supported = (reg & PCIE_LCAP2_DRS) ? true : false; } @@ -2273,7 +2281,7 @@ pci_conf_print_pcie_cap(const pcireg_t * __SHIFTOUT(reg, PCIE_LCSR2_SEL_DEEMP)); printf("\n"); printf(" Transmit Margin: %u\n", - (unsigned int)(reg & PCIE_LCSR2_TX_MARGIN) >> 7); + (unsigned int)__SHIFTOUT(reg, PCIE_LCSR2_TX_MARGIN)); onoff("Enter Modified Compliance", reg, PCIE_LCSR2_EN_MCOMP); onoff("Compliance SOS", reg, PCIE_LCSR2_COMP_SOS); printf(" Compliance Present/De-emphasis: "); @@ -4160,6 +4168,24 @@ pci_conf_print_ptm_cap(const pcireg_t *r /* XXX pci_conf_print_rtr_cap */ /* XXX pci_conf_print_desigvndsp_cap */ /* XXX pci_conf_print_vf_resizbar_cap */ + +static void +pci_conf_print_dlf_cap(const pcireg_t *regs, int extcapoff) +{ + pcireg_t reg; + + printf("\n Data link Feature Register\n"); + reg = regs[o2i(extcapoff + PCI_DLF_CAP)]; + printf("Capability register: 0x%08x\n", reg); + onoff("Scaled Flow Control", reg, PCI_DLF_LFEAT_SCLFCTL); + onoff("DLF Exchange enable", reg, PCI_DLF_CAP_XCHG); + + reg = regs[o2i(extcapoff + PCI_DLF_STAT)]; + printf("Status register: 0x%08x\n", reg); + onoff("Scaled Flow Control", reg, PCI_DLF_LFEAT_SCLFCTL); + onoff("Remote DLF supported Valid", reg, PCI_DLF_STAT_RMTVALID); +} + /* XXX pci_conf_print_hierarchyid_cap */ /* XXX pci_conf_print_npem_cap */ @@ -4246,8 +4272,8 @@ static struct { NULL }, { PCI_EXTCAP_VF_RESIZBAR, "VF Resizable BARs", NULL }, - { 0x25, "unknown", NULL }, - { 0x26, "unknown", NULL }, + { PCI_EXTCAP_DLF, "Data link Feature", pci_conf_print_dlf_cap }, + { PCI_EXTCAP_PYSLAY_16GT, "Physical Layer 16.0 GT/s", NULL }, { 0x27, "unknown", NULL }, { PCI_EXTCAP_HIERARCHYID, "Hierarchy ID",
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Mar 8 14:44:06 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_ena.c Log Message: Pull up following revision(s) (requested by jdolecek in ticket #759): sys/dev/pci/if_ena.c: revision 1.24 replace #if condition for irq_slot with __diagused on the cleanup path fixes PR kern/55044 by Uwe Toenjes To generate a diff of this commit: cvs rdiff -u -r1.15.2.1 -r1.15.2.2 src/sys/dev/pci/if_ena.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_ena.c diff -u src/sys/dev/pci/if_ena.c:1.15.2.1 src/sys/dev/pci/if_ena.c:1.15.2.2 --- src/sys/dev/pci/if_ena.c:1.15.2.1 Fri Aug 9 16:06:39 2019 +++ src/sys/dev/pci/if_ena.c Sun Mar 8 14:44:06 2020 @@ -31,7 +31,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.1 2019/08/09 16:06:39 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.2 2020/03/08 14:44:06 martin Exp $"); #include #include @@ -2085,9 +2085,7 @@ err: kcpuset_destroy(affinity); for (i--; i >= 0; i--) { -#if defined(DEBUG) || defined(DIAGNOSTIC) - int irq_slot = i + irq_off; -#endif + int irq_slot __diagused = i + irq_off; KASSERT(adapter->sc_ihs[irq_slot] != NULL); pci_intr_disestablish(adapter->sc_pa.pa_pc, adapter->sc_ihs[i]); adapter->sc_ihs[i] = NULL;
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Mar 1 12:48:25 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: ichsmb.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #748): sys/dev/pci/ichsmb.c: revision 1.61 If attach fails, don't panic on detach. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.60.4.1 src/sys/dev/pci/ichsmb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ichsmb.c diff -u src/sys/dev/pci/ichsmb.c:1.60 src/sys/dev/pci/ichsmb.c:1.60.4.1 --- src/sys/dev/pci/ichsmb.c:1.60 Mon Dec 10 06:23:54 2018 +++ src/sys/dev/pci/ichsmb.c Sun Mar 1 12:48:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ichsmb.c,v 1.60 2018/12/10 06:23:54 jdolecek Exp $ */ +/* $NetBSD: ichsmb.c,v 1.60.4.1 2020/03/01 12:48:25 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.60 2018/12/10 06:23:54 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.60.4.1 2020/03/01 12:48:25 martin Exp $"); #include #include @@ -265,7 +265,8 @@ ichsmb_detach(device_t self, int flags) sc->sc_pihp = NULL; } - bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size); + if (sc->sc_size != 0) + bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size); return 0; }
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Mar 1 12:47:10 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_mcx.c Log Message: Pull up following revision(s) (requested by thorpej in ticket #747): sys/dev/pci/if_mcx.c: revision 1.11 Use the 64-bit PCI DMA tag if available. Otherwise, we are needlessly allocating (and using) bounce buffers on sytems with >4GB of RAM. XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/dev/pci/if_mcx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_mcx.c diff -u src/sys/dev/pci/if_mcx.c:1.1.2.8 src/sys/dev/pci/if_mcx.c:1.1.2.9 --- src/sys/dev/pci/if_mcx.c:1.1.2.8 Fri Jan 31 11:14:50 2020 +++ src/sys/dev/pci/if_mcx.c Sun Mar 1 12:47:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mcx.c,v 1.1.2.8 2020/01/31 11:14:50 martin Exp $ */ +/* $NetBSD: if_mcx.c,v 1.1.2.9 2020/03/01 12:47:10 martin Exp $ */ /* $OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */ /* @@ -2215,7 +2215,10 @@ mcx_attach(device_t parent, device_t sel sc->sc_dev = self; sc->sc_pc = pa->pa_pc; sc->sc_tag = pa->pa_tag; - sc->sc_dmat = pa->pa_dmat; + if (pci_dma64_available(pa)) + sc->sc_dmat = pa->pa_dmat64; + else + sc->sc_dmat = pa->pa_dmat; /* Map the PCI memory space */ memtype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, MCX_HCA_BAR);
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jan 31 11:07:51 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pcidevs.h pcidevs_data.h Log Message: regen (for ticket #670) To generate a diff of this commit: cvs rdiff -u -r1.1371.2.4 -r1.1371.2.5 src/sys/dev/pci/pcidevs.h cvs rdiff -u -r1.1370.2.4 -r1.1370.2.5 src/sys/dev/pci/pcidevs_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. diffs are larger than 1MB and have been omitted
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Fri Jan 31 11:06:31 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pcidevs Log Message: Pull up following revision(s) (requested by msaitoh in ticket #670): sys/dev/pci/pcidevs: revision 1.1396 sys/dev/pci/pcidevs: revision 1.1397 sys/dev/pci/pcidevs: revision 1.1392 sys/dev/pci/pcidevs: revision 1.1393 sys/dev/pci/pcidevs: revision 1.1394 sys/dev/pci/pcidevs: revision 1.1395 - Add Xeon D-1500 NTB-secondary - Add Xeon D NS QuickData DMA channel 0-7 Add AMD Family14h PCIe. Killer E3000 from OpenBSD add Aquantia AQC 10G network adapters Add Intel I219 LM10-LM15 and V10-V14 from OpenBSD. Remove duplicated entries. To generate a diff of this commit: cvs rdiff -u -r1.1383.2.4 -r1.1383.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.1383.2.4 src/sys/dev/pci/pcidevs:1.1383.2.5 --- src/sys/dev/pci/pcidevs:1.1383.2.4 Tue Nov 19 13:03:32 2019 +++ src/sys/dev/pci/pcidevs Fri Jan 31 11:06:31 2020 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1383.2.4 2019/11/19 13:03:32 martin Exp $ +$NetBSD: pcidevs,v 1.1383.2.5 2020/01/31 11:06:31 martin Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -651,6 +651,7 @@ vendor SYMPHONY2 0x1c1c Symphony Labs (2 vendor HGST 0x1c58 HGST, Inc. vendor BEIJING_MEMBLAZE 0x1c5f Beijing Memblaze Technology Co. Ltd. vendor AMAZON 0x1d0f Amazon.com, Inc. +vendor AQUANTIA 0x1d6a Aquantia vendor ROCKCHIP 0x1d87 Rockchip vendor TEKRAM2 0x1de1 Tekram Technology (2nd PCI Vendor ID) vendor SUNIX2 0x1fd4 SUNIX Co @@ -1030,6 +1031,11 @@ product AMD F17_7X_IOMMU 0x1481 Family17 product AMD F17_7X_RESV_SPP 0x1485 Family17h/7xh Reserved SPP 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 @@ -1282,6 +1288,21 @@ product APPLE INTREPID2_FW 0x006a Intrep product APPLE INTREPID2_GMAC 0x006b Intrepid 2 GMAC product APPLE BCM5701 0x1645 BCM5701 +/* Aquantia Corp. */ +product AQUANTIA AQC107 0x07b1 AQC107 10 Gigabit Network Adapter +product AQUANTIA AQC108 0x08b1 AQC108 5 Gigabit Network Adapter +product AQUANTIA AQC109 0x09b1 AQC109 2.5 Gigabit Network Adapter +product AQUANTIA AQC111 0x11b1 AQC111 5 Gigabit Network Adapter +product AQUANTIA AQC112 0x12b1 AQC112 2.5 Gigabit Network Adapter +product AQUANTIA AQC107S 0x87b1 AQC107S 10 Gigabit Network Adapter +product AQUANTIA AQC108S 0x88b1 AQC108S 5 Gigabit Network Adapter +product AQUANTIA AQC109S 0x89b1 AQC109S 2.5 Gigabit Network Adapter +product AQUANTIA AQC111S 0x91b1 AQC111S 5 Gigabit Network Adapter +product AQUANTIA AQC112S 0x92b1 AQC112S 2.5 Gigabit Network Adapter +product AQUANTIA D107 0xd107 D107 10 Gigabit Network Adapter +product AQUANTIA D108 0xd108 D108 5 Gigabit Network Adapter +product AQUANTIA D109 0xd109 D109 2.5 Gigabit Network Adapter + /* ARC Logic products */ product ARC 1000PV 0xa091 1000PV product ARC 2000PV 0xa099 2000PV @@ -3169,6 +3190,12 @@ product INTEL S1200_ILB 0x0c60 Atom S12 product INTEL S1200_S1220 0x0c72 Atom S1220 Internal product INTEL S1200_S1240 0x0c73 Atom S1240 Internal product INTEL S1200_S1260 0x0c75 Atom S1260 Internal +product INTEL I219_LM11 0x0d4c I219-LM Ethernet Connection +product INTEL I219_V11 0x0d4d I219-V Ethernet Connection +product INTEL I219_LM10 0x0d4e I219-LM Ethernet Connection +product INTEL I219_V10 0x0d4f I219-V Ethernet Connection +product INTEL I219_LM12 0x0d53 I219-LM Ethernet Connection +product INTEL I219_V12 0x0d55 I219-V Ethernet Connection product INTEL E5V2_DMI2 0x0e00 E5 v2 DMI2 product INTEL E5V2_PCIE_1 0x0e01 E5 v2 PCIe x4 (DMI2 Mode) product INTEL E5V2_PCIE_2 0x0e02 E5 v2 PCIe @@ -3196,8 +3223,6 @@ product INTEL E5V2_ADDRMAP 0x0e28 E5 v2 product INTEL E5V2_HOTPLUG 0x0e29 E5 v2 Hot-Plug product INTEL E5V2_IIO_RAS 0x0e2a E5 v2 IIO RAS product INTEL E5V2_IOAPIC 0x0e2c E5 v2 I/O APIC -product INTEL E5_IOAT_RAID_1 0x3c2e E5 I/OAT DMA (RAID 5/6) -product INTEL E5_IOAT_RAID_2 0x3c2f E5 I/OAT DMA (RAID 5/6) product INTEL E5V2_HA_2 0x0e30 E5 v2 Home Agent product INTEL E5V2_PCIE_PM_1 0x0e34 E5 v2 PCIe Performance Monitor product INTEL E5V2_QPI_PM_1 0x0e36 E5 v2 QPI Performance Monitor @@ -3602,7 +3627,12 @@ product INTEL I219_V9 0x15e2 I219-V Eth product INTEL I219_LM5 0x15e3 I219-LM Ethernet Connection product INTEL C3K_X553_SGMII 0
CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Tue Jan 28 11:09:27 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: 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 #664): 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.199.2.9 -r1.199.2.10 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.12.8.1 -r1.12.8.2 src/sys/dev/pci/ixgbe/ixgbe_82598.c cvs rdiff -u -r1.21 -r1.21.4.1 src/sys/dev/pci/ixgbe/ixgbe_82599.c cvs rdiff -u -r1.18.4.1 -r1.18.4.2 src/sys/dev/pci/ixgbe/ixgbe_phy.c cvs rdiff -u -r1.41.2.1 -r1.41.2.2 src/sys/dev/pci/ixgbe/ixgbe_type.h cvs rdiff -u -r1.15.2.1 -r1.15.2.2 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.199.2.9 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.10 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.9 Sun Jan 26 11:03:17 2020 +++ src/sys/dev/pci/ixgbe/ixgbe.c Tue Jan 28 11:09:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.9 2020/01/26 11:03:17 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.10 2020/01/28 11:09:27 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]; @@ -959,8 +960,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; @@ -1129,13 +1130,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; } @@ -1168,16 +1162,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); @@ -3896,6 +3896,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! */ @@ -3903,6 +3904,7 @@ ixgbe_init_locked(struct adapter *adapte KASSERT(mutex_owned(&adapter->core_mtx)); INIT_DEBUGOUT("ixgbe_init_locked: begin"); + hw->need_unsupported_sfp_recovery = false; hw->adapter_stopped = FALSE; ixgbe_stop_adapter(hw); callout_stop(&adapter->timer); @@ -4076,12 +4078,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 moderati
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Jan 26 11:17:12 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_mcx.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #651): sys/dev/pci/if_mcx.c: revision 1.8 sys/dev/pci/if_mcx.c: revision 1.9 - Change IFM_10G_T(10GBase-T) entry to IFM_10G_CR1(10GBASE-CR1) - Add the following entries: 20GBASE-KR2 56GBASE-R4 100GBASE-LR4 100BaseTX 1000baseT 10GBase-T Set if_baudrate. To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/dev/pci/if_mcx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_mcx.c diff -u src/sys/dev/pci/if_mcx.c:1.1.2.6 src/sys/dev/pci/if_mcx.c:1.1.2.7 --- src/sys/dev/pci/if_mcx.c:1.1.2.6 Tue Nov 26 18:30:57 2019 +++ src/sys/dev/pci/if_mcx.c Sun Jan 26 11:17:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mcx.c,v 1.1.2.6 2019/11/26 18:30:57 martin Exp $ */ +/* $NetBSD: if_mcx.c,v 1.1.2.7 2020/01/26 11:17:11 martin Exp $ */ /* $OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */ /* @@ -159,8 +159,10 @@ #define MCX_ETHER_CAP_10G_CX4 (1 << 2) #define MCX_ETHER_CAP_10G_KX4 (1 << 3) #define MCX_ETHER_CAP_10G_KR (1 << 4) +#define MCX_ETHER_CAP_20G_KR2 (1 << 5) #define MCX_ETHER_CAP_40G_CR4 (1 << 6) #define MCX_ETHER_CAP_40G_KR4 (1 << 7) +#define MCX_ETHER_CAP_56G_R4 (1 << 8) #define MCX_ETHER_CAP_10G_CR (1 << 12) #define MCX_ETHER_CAP_10G_SR (1 << 13) #define MCX_ETHER_CAP_10G_LR (1 << 14) @@ -170,6 +172,10 @@ #define MCX_ETHER_CAP_100G_CR4 (1 << 20) #define MCX_ETHER_CAP_100G_SR4 (1 << 21) #define MCX_ETHER_CAP_100G_KR4 (1 << 22) +#define MCX_ETHER_CAP_100G_LR4 (1 << 23) +#define MCX_ETHER_CAP_100_TX (1 << 24) +#define MCX_ETHER_CAP_1000_T (1 << 25) +#define MCX_ETHER_CAP_10G_T (1 << 26) #define MCX_ETHER_CAP_25G_CR (1 << 27) #define MCX_ETHER_CAP_25G_KR (1 << 28) #define MCX_ETHER_CAP_25G_SR (1 << 29) @@ -2146,14 +2152,14 @@ static const uint64_t mcx_eth_cap_map[] IFM_10G_CX4, IFM_10G_KX4, IFM_10G_KR, - 0, + IFM_20G_KR2, IFM_40G_CR4, IFM_40G_KR4, + IFM_56G_R4, 0, 0, 0, - 0, - IFM_10G_T, + IFM_10G_CR1, IFM_10G_SR, IFM_10G_LR, IFM_40G_SR4, @@ -2164,10 +2170,10 @@ static const uint64_t mcx_eth_cap_map[] IFM_100G_CR4, IFM_100G_SR4, IFM_100G_KR4, - 0, - 0, - 0, - 0, + IFM_100G_LR4, + IFM_100_TX, + IFM_1000_T, + IFM_10G_T, IFM_25G_CR, IFM_25G_KR, IFM_25G_SR, @@ -6647,6 +6653,7 @@ mcx_port_change(struct work *wk, void *x struct ifnet *ifp = &sc->sc_ec.ec_if; struct mcx_reg_paos paos; int link_state = LINK_STATE_DOWN; + struct ifmediareq ifmr; memset(&paos, 0, sizeof(paos)); paos.rp_local_port = 1; @@ -6654,6 +6661,8 @@ mcx_port_change(struct work *wk, void *x sizeof(paos)) == 0) { if (paos.rp_oper_status == MCX_REG_PAOS_OPER_STATUS_UP) link_state = LINK_STATE_UP; + mcx_media_status(ifp, &ifmr); + ifp->if_baudrate = ifmedia_baudrate(ifmr.ifm_active); } if (link_state != ifp->if_link_state) {
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Sun Jan 26 11:13:28 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c if_wmreg.h Log Message: Pull up the following (via patch), requested by msaitoh in ticket #650: sys/dev/pci/if_wm.c 1.650, 1.652-1.654 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.645.2.3 -r1.645.2.4 src/sys/dev/pci/if_wm.c cvs rdiff -u -r1.115 -r1.115.2.1 src/sys/dev/pci/if_wmreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.3 src/sys/dev/pci/if_wm.c:1.645.2.4 --- src/sys/dev/pci/if_wm.c:1.645.2.3 Thu Jan 23 10:10:57 2020 +++ src/sys/dev/pci/if_wm.c Sun Jan 26 11:13:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.3 2020/01/23 10:10:57 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.4 2020/01/26 11:13:27 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.3 2020/01/23 10:10:57 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.4 2020/01/26 11:13:27 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2656,10 +2656,11 @@ alloc_retry: } } - /* XXX For other than 82580? */ - if (sc->sc_type == WM_T_82580) { - wm_nvm_read(sc, NVM_OFF_CFG3_PORTA, 1, &nvmword); - 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, &nvmword); + if (nvmword & NVM_CFG3_ILOS) sc->sc_ctrl |= CTRL_ILOS; } @@ -6047,8 +6048,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; @@ -6088,8 +6088,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); @@ -9286,7 +9289,7 @@ wm_linkintr_serdes(struct wm_softc *sc, { struct ifnet *ifp = &sc->sc_ethercom.ec_if; struct mii_data *mii = &sc->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), @@ -9629,11 +9632,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; @@ -11411,7 +11415,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); @@ -11426,7 +11430,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); @@ -12085,7 +12089,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 @@ -12192,7 +12197,7 @@ wm_serdes_mediastatus(struct ifnet *ifp, { struct wm_softc *sc = ifp->if_softc; struct mii_data *mii = &sc->sc_mii; - struct ifmedia_entry *ife = sc-
CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Sun Jan 26 11:03:17 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: 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 (via patch), requested by msaitoh in ticket #648 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.220-1.221 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.142,1.144 - Free RX structure correctly when detaching. - Remove unused code. - Fix some typos in comment. - Remove extra spaces. - KNF. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.8.1 src/sys/dev/pci/ixgbe/if_bypass.c cvs rdiff -u -r1.54.2.2 -r1.54.2.3 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.199.2.8 -r1.199.2.9 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.56.2.1 -r1.56.2.2 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.12 -r1.12.8.1 src/sys/dev/pci/ixgbe/ixgbe_82598.c cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/dev/pci/ixgbe/ixgbe_api.c cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/pci/ixgbe/ixgbe_common.c cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c cvs rdiff -u -r1.4.8.1 -r1.4.8.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.c cvs rdiff -u -r1.23.6.1 -r1.23.6.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.h cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/dev/pci/ixgbe/ixgbe_phy.c cvs rdiff -u -r1.125.2.8 -r1.125.2.9 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.4 src/sys/dev/pci/ixgbe/if_bypass.c:1.4.8.1 --- src/sys/dev/pci/ixgbe/if_bypass.c:1.4 Wed Apr 4 08:13:07 2018 +++ src/sys/dev/pci/ixgbe/if_bypass.c Sun Jan 26 11:03:17 2020 @@ -101,7 +101,7 @@ ixgbe_get_bypass_time(u32 *year, u32 *se nanotime(¤t); *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.54.2.2 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.3 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.2 Fri Nov 1 09:34:27 2019 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Sun Jan 26 11:03:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.54.2.2 2019/11/01 09:34:27 martin Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.54.2.3 2020/01/26 11:03:17 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(&ifp->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 = &adapter->queues[i]; + mutex_destroy(&que->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.199.2.8 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.9 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.8 Tue Dec 24 17:44:22 2019 +++ src/sys/dev/pci/ixgbe/ixgbe.c Sun Jan 26 11:03:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.8 2019/12/24 17:44:22 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.9 2020/01/26 11:03:17 martin Exp $ */ /** @@ -353,7 +353,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix * Number of Queues, can be set to 0, * it then autoco
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Jan 23 10:10:57 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c Log Message: Pull up following revision(s) (requested by knakahara in ticket #643): 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.645.2.2 -r1.645.2.3 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.2 src/sys/dev/pci/if_wm.c:1.645.2.3 --- src/sys/dev/pci/if_wm.c:1.645.2.2 Wed Dec 11 14:48:31 2019 +++ src/sys/dev/pci/if_wm.c Thu Jan 23 10:10:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.2 2019/12/11 14:48:31 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.3 2020/01/23 10:10: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.645.2.2 2019/12/11 14:48:31 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.3 2020/01/23 10:10:57 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -3043,6 +3043,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-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Jan 21 15:15:23 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: pci_subr.c pcireg.h Log Message: Pull up the following, requested by msaitoh in ticket #629: sys/dev/pci/pcireg.h1.148 sys/dev/pci/pci_subr.c 1.218-1.219 - Fix a bug that the virtual channel extended configuration's arbitration phase register can't be decoded correctly. - Fix typo. To generate a diff of this commit: cvs rdiff -u -r1.215.2.1 -r1.215.2.2 src/sys/dev/pci/pci_subr.c cvs rdiff -u -r1.147 -r1.147.4.1 src/sys/dev/pci/pcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.215.2.1 src/sys/dev/pci/pci_subr.c:1.215.2.2 --- src/sys/dev/pci/pci_subr.c:1.215.2.1 Thu Sep 26 18:52:57 2019 +++ src/sys/dev/pci/pci_subr.c Tue Jan 21 15:15:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.215.2.1 2019/09/26 18:52:57 martin Exp $ */ +/* $NetBSD: pci_subr.c,v 1.215.2.2 2020/01/21 15:15:23 martin Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.1 2019/09/26 18:52:57 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.2 2020/01/21 15:15:23 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -2864,36 +2864,42 @@ pci_conf_print_aer_cap(const pcireg_t *r } } +/* + * Helper function to print the arbitration phase register. + * + * phases: Number of phases in the arbitration tables. + * arbsize: Number of bits in each phase. + * indent: Add more two spaces if it's true. + */ static void pci_conf_print_vc_cap_arbtab(const pcireg_t *regs, int off, const char *name, -pcireg_t parbsel, int parbsize) +const int phases, int arbsize, bool indent) { pcireg_t reg; - int num = 16 << parbsel; - int num_per_reg = sizeof(pcireg_t) / parbsize; + int num_per_reg = 32 / arbsize; int i, j; - /* First, dump the table */ - for (i = 0; i < num; i += num_per_reg) { - reg = regs[o2i(off + i / num_per_reg)]; - printf("%s Arbitration Table: 0x%08x\n", name, reg); - } - /* And then, decode each entry */ - for (i = 0; i < num; i += num_per_reg) { - reg = regs[o2i(off + i / num_per_reg)]; - for (j = 0; j < num_per_reg; j++) - printf(" Phase[%d]: %d\n", j, reg); + printf("%s%s Arbitration Table:\n", indent ? " " : "", name); + for (i = 0; i < phases; i += num_per_reg) { + reg = regs[o2i(off + (sizeof(uint32_t) * (i / num_per_reg)))]; + for (j = 0; j < num_per_reg; j++) { + printf("%s Phase[%d]: 0x%x\n", indent ? " " : "", + i + j, + (uint32_t)(reg & __BITS(arbsize - 1, 0))); + reg >>= arbsize; + } } } +/* For VC, bit 4-7 are reserved. For Port, bit 6-7 are reserved */ +static const int arb_phases[8] = {0, 32, 64, 128, 128, 256, 0, 0 }; + static void pci_conf_print_vc_cap(const pcireg_t *regs, int extcapoff) { pcireg_t reg, n; - int parbtab, parbsize; - pcireg_t parbsel; - int varbtab, varbsize; - pcireg_t varbsel; + int arbtab, parbsize; + pcireg_t arbsel; int i, count; printf("\n Virtual Channel Register\n"); @@ -2919,19 +2925,23 @@ pci_conf_print_vc_cap(const pcireg_t *re reg, PCI_VC_CAP2_ARB_CAP_WRR_64); onoff("WRR arbitration with 128 phases", reg, PCI_VC_CAP2_ARB_CAP_WRR_128); - varbtab = __SHIFTOUT(reg, PCI_VC_CAP2_ARB_TABLE_OFFSET); - printf(" VC Arbitration Table Offset: 0x%x\n", varbtab); + arbtab = __SHIFTOUT(reg, PCI_VC_CAP2_ARB_TABLE_OFFSET); + printf(" VC Arbitration Table Offset: 0x%x\n", arbtab); reg = regs[o2i(extcapoff + PCI_VC_CONTROL)] & 0x; printf("Port VC Control register: 0x%04x\n", reg); - varbsel = __SHIFTOUT(reg, PCI_VC_CONTROL_VC_ARB_SELECT); - printf(" VC Arbitration Select: 0x%x\n", varbsel); + arbsel = __SHIFTOUT(reg, PCI_VC_CONTROL_VC_ARB_SELECT); + printf(" VC Arbitration Select: 0x%x\n", arbsel); reg = regs[o2i(extcapoff + PCI_VC_STATUS)] >> 16; printf("Port VC Status register: 0x%04x\n", reg); onoff("VC Arbitration Table Status", reg, PCI_VC_STATUS_LOAD_VC_ARB_TABLE); + if ((arbtab != 0) && (arbsel != 0)) + pci_conf_print_vc_cap_arbtab(regs, extcapoff + (arbtab * 16), + "VC", arb_phases[arbsel], 4, false); + for (i = 0; i < count + 1; i++) { reg = regs[o2i(extcapoff + PCI_VC_RESOURCE_CAP(i))]; printf("VC number %d\n", i); @@ -2954,9 +2964,10 @@ pci_conf_print_vc_cap(const pcireg_t *re reg, PCI_VC_RESOURCE_CAP_REJCT_SNOOP_TRANS); n = __SHIFTOUT(reg, PCI_VC_RESOURCE_CAP_MAX_TIME_SLOTS) + 1; printf("Maximum Time Slots: %d\n", n); - parbtab = reg >> PCI_VC_RESOURCE_CAP_PORT_ARB_TABLE_OFFSET_S; + arbtab = __SHIFTOUT(reg, + PCI_VC_RESOURCE_CAP_PORT_ARB_TABLE_OFFSET); printf("Port Arbitration Table offset: 0x%02x\n", - par
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Jan 21 15:10:51 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_stgereg.h Log Message: Pull up following revision(s) (requested by msaitoh in ticket #627): 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.94.1 -r1.5.94.2 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.94.1 src/sys/dev/pci/if_stgereg.h:1.5.94.2 --- src/sys/dev/pci/if_stgereg.h:1.5.94.1 Mon Nov 25 16:44:31 2019 +++ src/sys/dev/pci/if_stgereg.h Tue Jan 21 15:10:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_stgereg.h,v 1.5.94.1 2019/11/25 16:44:31 martin Exp $ */ +/* $NetBSD: if_stgereg.h,v 1.5.94.2 2020/01/21 15:10:51 martin Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -323,7 +323,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-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Tue Dec 24 17:44:22 UTC 2019 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixgbe_osdep.c ixgbe_osdep.h ixv.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #580): sys/dev/pci/ixgbe/ixgbe.c: revision 1.217 sys/dev/pci/ixgbe/ixgbe.c: revision 1.218 sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.6 sys/dev/pci/ixgbe/ixv.c: revision 1.143 sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.25 Use bus_space_barrier() instead of x86 specific *fence instruction. Written by riastradh@. Add missing core lock in ixgbe_handle_mod(). To generate a diff of this commit: cvs rdiff -u -r1.199.2.7 -r1.199.2.8 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.4 -r1.4.8.1 src/sys/dev/pci/ixgbe/ixgbe_osdep.c cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/dev/pci/ixgbe/ixgbe_osdep.h cvs rdiff -u -r1.125.2.7 -r1.125.2.8 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.8 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.7 Tue Nov 19 13:17:44 2019 +++ src/sys/dev/pci/ixgbe/ixgbe.c Tue Dec 24 17:44:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.7 2019/11/19 13:17:44 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.8 2019/12/24 17:44:22 martin Exp $ */ /** @@ -4021,7 +4021,7 @@ ixgbe_init_locked(struct adapter *adapte else msec_delay(1); } - wmb(); + IXGBE_WRITE_BARRIER(hw); /* * In netmap mode, we must preserve the buffers made @@ -4613,6 +4613,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) { @@ -4630,14 +4631,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) @@ -4648,9 +4649,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 */ Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.c diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.4 src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.4.8.1 --- src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.4 Wed Apr 4 08:13:07 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_osdep.c Tue Dec 24 17:44:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_osdep.c,v 1.4 2018/04/04 08:13:07 msaitoh Exp $ */ +/* $NetBSD: ixgbe_osdep.c,v 1.4.8.1 2019/12/24 17:44:22 martin Exp $ */ /** @@ -116,3 +116,12 @@ ixgbe_write_reg_array(struct ixgbe_hw *h ((struct adapter *)hw->back)->osdep.mem_bus_space_handle, reg + (offset << 2), val); } + +inline void +ixgbe_write_barrier(struct ixgbe_hw *hw) +{ + bus_space_barrier(((struct adapter *)hw->back)->osdep.mem_bus_space_tag, + ((struct adapter *)hw->back)->osdep.mem_bus_space_handle, + 0, ((struct adapter *)hw->back)->osdep.mem_size, + BUS_SPACE_BARRIER_WRITE); +} Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.h diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.23 src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.23.6.1 --- src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.23 Tue Jul 31 09:19:34 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h Tue Dec 24 17:44:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_osdep.h,v 1.23 2018/07/31 09:19:34 msaitoh Exp $ */ +/* $NetBSD: ixgbe_osdep.h,v 1.23.6.1 2019/12/24 17:44:22 martin Exp $ */ /** SPDX-License-Identifier: BSD-3-Clause @@ -157,18 +157,6 @@ typedef uint64_t u64; /* This device driver's max interrupt numbers. */ #define IXG_MAX_NINTR 64 -#if __FreeBSD_version < 80 -#if defined(__i386__) || defined(__amd64__) -#define mb() __asm volatile("mfence" ::: "memory") -#define wmb() __asm volatile("sfence" ::: "memory") -#define rmb() __asm volatile("lfence" ::: "memory") -#else -#define mb() -#define rmb() -#define wmb() -#endif -#endif - #if defined(__i386__) || defined(__amd64__) static __inline void prefetch(void *x) @@ -241,4 +229,8 @@ extern void ixgbe_write_reg_array(struct #define IXGBE_WRITE_REG_ARRAY(a, reg, offset, val) \ ixgbe_write_reg_array(a, reg, offset, val) +extern void ixgbe_write_barrier(struct ixgbe_hw *); +#define IXGBE_WRITE_BARRIER(a) \ +ix
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Wed Dec 11 14:48:31 UTC 2019 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #541): sys/dev/pci/if_wm.c: revision 1.651 Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't occurred. To generate a diff of this commit: cvs rdiff -u -r1.645.2.1 -r1.645.2.2 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.1 src/sys/dev/pci/if_wm.c:1.645.2.2 --- src/sys/dev/pci/if_wm.c:1.645.2.1 Wed Nov 6 10:07:42 2019 +++ src/sys/dev/pci/if_wm.c Wed Dec 11 14:48:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.2 2019/12/11 14:48:31 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.2 2019/12/11 14:48:31 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -11625,7 +11625,7 @@ wm_sgmii_readreg_locked(device_t dev, in { struct wm_softc *sc = device_private(dev); uint32_t i2ccmd; - int i, rv; + int i, rv = 0; i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT) | (phy << I2CCMD_PHY_ADDR_SHIFT) | I2CCMD_OPCODE_READ;