Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/dev Pull up following revision(s) (requested by msait...



details:   https://anonhg.NetBSD.org/src/rev/a51932e25c22
branches:  netbsd-7
changeset: 799810:a51932e25c22
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Feb 26 22:08:17 2016 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1102):
        sys/dev/mii/igphy.c: 1.25
        sys/dev/mii/ukphy.c: 1.48
        sys/dev/pci/if_wm.c: revisions 1.308, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.389 via patch
        sys/dev/pci/if_wmreg.h: revisions 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
        sys/dev/pci/if_wmvar.h: revisions 1.22-1.23, 1.25-1.30 via patch
Sync wm(4) as of if_wm.c rev 1.389 except MSI/MSI-X, multiqueue and NET_MPSAFE:
- Add C2000 KX and 2.5G support.
- Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more than
  4096. Almost the same as other OSes.
- For 82576 and newer devices, the PBA register is deleted. Don't write PBA
  for those chips. Also change the calculation of RX packet buffer size in
  new way.
- Fix a lot of bugs to make 82575 and newer SERDES based systems work.
- Print NVM image version and option ROM version.
- Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
  workaround is required if the NVM image version < 3.25.
- Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
  "drvct -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
- Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
  and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
  version 2.1.4 and newer have this workaround.
- Check PHY type correctly. This change is required to use igphy(4) device
  correctly.
- Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.
- Call wm_get_hw_control() correctly. This change fixes a bug that some AMT
  based systems doesn't linkup at 1000BaseT. The problem was observed on HP
  Compaq dc7700. A lot of fixes have been done for wm(4) and igphy(4), so now
  PR#44893 should be fixed.
- Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
  check the existence of AMT correctly.
- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
  wm_reset() on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix the
  behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change might fix
  a problem that PHY's read/write functions can't get semaphore.
- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS sets
  this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the function
  checks the status correctly but it causes linkdown up to 10 times, so it's
  disabled for the time being.
- PR/50527: David Binderman: Fix impossible code. Odd offsets need special
  treatment.
- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
  determine the range of the RAL.
- Use sc->sc_itr instead of hard-coded number.
- Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as
  mii_tick().
- ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
  No binary change because this definition has not used yet.
- Add ACK data Disable bit's definition (not used yet).
- PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any effect by
  default because WM_WOL is not defined yet and
  m_kmrn_lock_loss_workaround_ich8lan() is broken.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when WM_WOL is
  defined and it's disabled by default.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
  bool. No functional change.
- Reorder function definitions and macro definitions. No functional change.
- Fix comment. Add comment. Update comment.
- KNF.

diffstat:

 sys/dev/mii/igphy.c    |     7 +-
 sys/dev/mii/ukphy.c    |     7 +-
 sys/dev/pci/if_wm.c    |  1534 +++++++++++++++++++++++++++++++++++------------
 sys/dev/pci/if_wmreg.h |    92 ++-
 sys/dev/pci/if_wmvar.h |    28 +-
 5 files changed, 1252 insertions(+), 416 deletions(-)

diffs (truncated from 2911 to 300 lines):

diff -r d60598c97166 -r a51932e25c22 sys/dev/mii/igphy.c
--- a/sys/dev/mii/igphy.c       Fri Feb 26 21:57:12 2016 +0000
+++ b/sys/dev/mii/igphy.c       Fri Feb 26 22:08:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igphy.c,v 1.23 2014/06/16 16:48:16 msaitoh Exp $       */
+/*     $NetBSD: igphy.c,v 1.23.2.1 2016/02/26 22:08:17 snj Exp $       */
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.23 2014/06/16 16:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.23.2.1 2016/02/26 22:08:17 snj Exp $");
 
 #include "opt_mii.h"
 
@@ -154,6 +154,9 @@
        sc->mii_dev = self;
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
+       sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+       sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+       sc->mii_mpd_rev = MII_REV(ma->mii_id2);
        sc->mii_funcs = &igphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
diff -r d60598c97166 -r a51932e25c22 sys/dev/mii/ukphy.c
--- a/sys/dev/mii/ukphy.c       Fri Feb 26 21:57:12 2016 +0000
+++ b/sys/dev/mii/ukphy.c       Fri Feb 26 22:08:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ukphy.c,v 1.46 2013/06/11 16:18:48 msaitoh Exp $       */
+/*     $NetBSD: ukphy.c,v 1.46.8.1 2016/02/26 22:08:17 snj Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukphy.c,v 1.46 2013/06/11 16:18:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukphy.c,v 1.46.8.1 2016/02/26 22:08:17 snj Exp $");
 
 #include "opt_mii.h"
 
@@ -121,6 +121,9 @@
        sc->mii_dev = self;
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
+       sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+       sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+       sc->mii_mpd_rev = MII_REV(ma->mii_id2);
        sc->mii_funcs = &ukphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
diff -r d60598c97166 -r a51932e25c22 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Feb 26 21:57:12 2016 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Feb 26 22:08:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.289.2.8 2015/06/10 16:43:51 snj Exp $      */
+/*     $NetBSD: if_wm.c,v 1.289.2.9 2016/02/26 22:08:17 snj Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -75,13 +75,16 @@
  *     - Check XXX'ed comments
  *     - EEE (Energy Efficiency Ethernet)
  *     - MSI/MSI-X
+ *     - Multi queue
+ *     - Image Unique ID
+ *     - Disable D0 LPLU on 8257[12356], 82580 and I350.
  *     - Virtual Function
  *     - Set LED correctly (based on contents in EEPROM)
  *     - Rework how parameters are loaded from the EEPROM.
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.8 2015/06/10 16:43:51 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.9 2016/02/26 22:08:17 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -249,6 +252,10 @@
        SWFW_PHY3_SM
 };
 
+static const uint32_t wm_82580_rxpbs_table[] = {
+       36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140
+};
+
 /*
  * Software state per device.
  */
@@ -262,6 +269,7 @@
        bus_size_t sc_ios;              /* I/O space size */
        bus_space_tag_t sc_flasht;      /* flash registers space tag */
        bus_space_handle_t sc_flashh;   /* flash registers space handle */
+       bus_size_t sc_flashs;           /* flash registers space size */
        bus_dma_tag_t sc_dmat;          /* bus DMA tag */
 
        struct ethercom sc_ethercom;    /* ethernet common data */
@@ -291,8 +299,11 @@
        callout_t sc_tick_ch;           /* tick callout */
        bool sc_stopping;
 
+       int sc_nvm_ver_major;
+       int sc_nvm_ver_minor;
+       int sc_nvm_ver_build;
        int sc_nvm_addrbits;            /* NVM address bits */
-       unsigned int sc_nvm_wordsize;           /* NVM word size */
+       unsigned int sc_nvm_wordsize;   /* NVM word size */
        int sc_ich8_flash_base;
        int sc_ich8_flash_bank_size;
        int sc_nvm_k1_enabled;
@@ -334,7 +345,7 @@
        struct evcnt sc_ev_txtsopain;   /* painful header manip. for TSO */
 
        struct evcnt sc_ev_txseg[WM_NTXSEGS]; /* Tx packets w/ N segments */
-       struct evcnt sc_ev_txdrop;      /* Tx packets dropped (too many segs) */
+       struct evcnt sc_ev_txdrop;      /* Tx packets dropped(too many segs) */
 
        struct evcnt sc_ev_tu;          /* Tx underrun */
 
@@ -384,8 +395,8 @@
        uint32_t sc_pba;                /* prototype PBA register */
 
        int sc_tbi_linkup;              /* TBI link status */
-       int sc_tbi_anegticks;           /* autonegotiation ticks */
-       int sc_tbi_ticks;               /* tbi ticks */
+       int sc_tbi_serdes_anegticks;    /* autonegotiation ticks */
+       int sc_tbi_serdes_ticks;        /* tbi ticks */
 
        int sc_mchash_type;             /* multicast filter offset */
 
@@ -518,7 +529,7 @@
        __rxd->wrx_status = 0;                                          \
        __rxd->wrx_errors = 0;                                          \
        __rxd->wrx_special = 0;                                         \
-       WM_CDRXSYNC((sc), (x), BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); \
+       WM_CDRXSYNC((sc), (x), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \
                                                                        \
        CSR_WRITE((sc), (sc)->sc_rdt_reg, (x));                         \
 } while (/*CONSTCOND*/0)
@@ -562,6 +573,7 @@
 static void    wm_lan_init_done(struct wm_softc *);
 static void    wm_get_cfg_done(struct wm_softc *);
 static void    wm_initialize_hardware_bits(struct wm_softc *);
+static uint32_t        wm_rxpbs_adjust_82580(uint32_t);
 static void    wm_reset(struct wm_softc *);
 static int     wm_add_rxbuf(struct wm_softc *, int);
 static void    wm_rxdrain(struct wm_softc *);
@@ -586,6 +598,7 @@
 static void    wm_rxintr(struct wm_softc *);
 static void    wm_linkintr_gmii(struct wm_softc *, uint32_t);
 static void    wm_linkintr_tbi(struct wm_softc *, uint32_t);
+static void    wm_linkintr_serdes(struct wm_softc *, uint32_t);
 static void    wm_linkintr(struct wm_softc *, uint32_t);
 static int     wm_intr(void *);
 
@@ -593,12 +606,14 @@
  * Media related.
  * GMII, SGMII, TBI, SERDES and SFP.
  */
+/* Common */
+static void    wm_tbi_serdes_set_linkled(struct wm_softc *);
 /* GMII related */
 static void    wm_gmii_reset(struct wm_softc *);
 static int     wm_get_phy_id_82575(struct wm_softc *);
 static void    wm_gmii_mediainit(struct wm_softc *, pci_product_id_t);
+static int     wm_gmii_mediachange(struct ifnet *);
 static void    wm_gmii_mediastatus(struct ifnet *, struct ifmediareq *);
-static int     wm_gmii_mediachange(struct ifnet *);
 static void    wm_i82543_mii_sendbits(struct wm_softc *, uint32_t, int);
 static uint32_t        wm_i82543_mii_recvbits(struct wm_softc *);
 static int     wm_gmii_i82543_readreg(device_t, int, int);
@@ -614,6 +629,8 @@
 static void    wm_gmii_hv_writereg(device_t, int, int, int);
 static int     wm_gmii_82580_readreg(device_t, int, int);
 static void    wm_gmii_82580_writereg(device_t, int, int, int);
+static int     wm_gmii_gs40g_readreg(device_t, int, int);
+static void    wm_gmii_gs40g_writereg(device_t, int, int, int);
 static void    wm_gmii_statchg(struct ifnet *);
 static int     wm_kmrn_readreg(struct wm_softc *, int);
 static void    wm_kmrn_writereg(struct wm_softc *, int, int);
@@ -622,12 +639,16 @@
 static int     wm_sgmii_readreg(device_t, int, int);
 static void    wm_sgmii_writereg(device_t, int, int, int);
 /* TBI related */
-static int     wm_check_for_link(struct wm_softc *);
 static void    wm_tbi_mediainit(struct wm_softc *);
+static int     wm_tbi_mediachange(struct ifnet *);
 static void    wm_tbi_mediastatus(struct ifnet *, struct ifmediareq *);
-static int     wm_tbi_mediachange(struct ifnet *);
-static void    wm_tbi_set_linkled(struct wm_softc *);
-static void    wm_tbi_check_link(struct wm_softc *);
+static int     wm_check_for_link(struct wm_softc *);
+static void    wm_tbi_tick(struct wm_softc *);
+/* SERDES related */
+static void    wm_serdes_power_up_link_82575(struct wm_softc *);
+static int     wm_serdes_mediachange(struct ifnet *);
+static void    wm_serdes_mediastatus(struct ifnet *, struct ifmediareq *);
+static void    wm_serdes_tick(struct wm_softc *);
 /* SFP related */
 static int     wm_sfp_read_data_byte(struct wm_softc *, uint16_t, uint8_t *);
 static uint32_t        wm_sfp_get_media_type(struct wm_softc *);
@@ -667,6 +688,8 @@
 static int     wm_nvm_is_onboard_eeprom(struct wm_softc *);
 static int     wm_nvm_get_flash_presence_i210(struct wm_softc *);
 static int     wm_nvm_validate_checksum(struct wm_softc *);
+static void    wm_nvm_version_invm(struct wm_softc *);
+static void    wm_nvm_version(struct wm_softc *);
 static int     wm_nvm_read(struct wm_softc *, int, int, uint16_t *);
 
 /*
@@ -686,12 +709,14 @@
  * Management mode and power management related subroutines.
  * BMC, AMT, suspend/resume and EEE.
  */
+#ifdef WM_WOL
 static int     wm_check_mng_mode(struct wm_softc *);
 static int     wm_check_mng_mode_ich8lan(struct wm_softc *);
 static int     wm_check_mng_mode_82574(struct wm_softc *);
 static int     wm_check_mng_mode_generic(struct wm_softc *);
+#endif
 static int     wm_enable_mng_pass_thru(struct wm_softc *);
-static int     wm_check_reset_block(struct wm_softc *);
+static bool    wm_phy_resetisblocked(struct wm_softc *);
 static void    wm_get_hw_control(struct wm_softc *);
 static void    wm_release_hw_control(struct wm_softc *);
 static void    wm_gate_hw_phy_config_ich8lan(struct wm_softc *, int);
@@ -704,6 +729,9 @@
 static void    wm_igp3_phy_powerdown_workaround_ich8lan(struct wm_softc *);
 static void    wm_enable_wakeup(struct wm_softc *);
 #endif
+/* LPLU (Low Power Link Up) */
+static void    wm_lplu_d0_disable(struct wm_softc *);
+static void    wm_lplu_d0_disable_pch(struct wm_softc *);
 /* EEE */
 static void    wm_set_eee_i350(struct wm_softc *);
 
@@ -719,6 +747,8 @@
 static void    wm_set_mdio_slow_mode_hv(struct wm_softc *);
 static void    wm_configure_k1_ich8lan(struct wm_softc *, int);
 static void    wm_reset_init_script_82575(struct wm_softc *);
+static void    wm_reset_mdicnfg_82580(struct wm_softc *);
+static void    wm_pll_workaround_i210(struct wm_softc *);
 
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
     wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
@@ -1168,9 +1198,18 @@
          "I350 Gigabit Connection",
          WM_T_I350,            WMP_F_COPPER },
 
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_C2000_1000KX,
+         "I354 Gigabit Ethernet (KX)",
+         WM_T_I354,            WMP_F_SERDES },
+
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_C2000_SGMII,
-         "I354 Gigabit Connection",
+         "I354 Gigabit Ethernet (SGMII)",
          WM_T_I354,            WMP_F_COPPER },
+
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_C2000_25GBE,
+         "I354 Gigabit Ethernet (2.5G)",
+         WM_T_I354,            WMP_F_COPPER },
+
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I210_T1,
          "I210-T1 Ethernet Server Adapter",
          WM_T_I210,            WMP_F_COPPER },
@@ -1348,7 +1387,7 @@
        prop_data_t ea;
        prop_number_t pn;
        uint8_t enaddr[ETHER_ADDR_LEN];
-       uint16_t cfg1, cfg2, swdpin, io3;
+       uint16_t cfg1, cfg2, swdpin, nvmword;
        pcireg_t preg, memtype;
        uint16_t eeprom_data, apme_mask;
        bool force_clear_smbi;
@@ -1378,7 +1417,7 @@
                sc->sc_dmat = pa->pa_dmat;
 
        sc->sc_pcidevid = PCI_PRODUCT(pa->pa_id);
-       sc->sc_rev = PCI_REVISION(pci_conf_read(pc, pa->pa_tag, PCI_CLASS_REG));
+       sc->sc_rev = PCI_REVISION(pci_conf_read(pc, pa->pa_tag,PCI_CLASS_REG));
        pci_aprint_devinfo_fancy(pa, "Ethernet controller", wmp->wmp_name, 1);
 
        sc->sc_type = wmp->wmp_type;
@@ -1580,11 +1619,9 @@
                                pcix_sts = pci_conf_read(pa->pa_pc, pa->pa_tag,
                                    sc->sc_pcixe_capoff + PCIX_STATUS);
 
-                               bytecnt =
-                                   (pcix_cmd & PCIX_CMD_BYTECNT_MASK) >>
+                               bytecnt = (pcix_cmd & PCIX_CMD_BYTECNT_MASK) >>
                                    PCIX_CMD_BYTECNT_SHIFT;
-                               maxb =
-                                   (pcix_sts & PCIX_STATUS_MAXB_MASK) >>
+                               maxb = (pcix_sts & PCIX_STATUS_MAXB_MASK) >>
                                    PCIX_STATUS_MAXB_SHIFT;



Home | Main Index | Thread Index | Old Index