Source-Changes-HG archive

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

[src/netbsd-6]: src Pull up following revision(s) (requested by msaitoh in ti...



details:   https://anonhg.NetBSD.org/src/rev/157176987323
branches:  netbsd-6
changeset: 774268:157176987323
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Jun 28 16:06:36 2012 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #362):
sys/dev/pci/if_wm.c             1.228
        sys/dev/pci/if_wmreg.h          1.47
        sys/dev/pci/if_wmvar.h          1.13
        sys/dev/pci/pcidevs             1.1117
        sys/dev/pci/pcidevs.h           regen
        sys/dev/pci/pcidevs_data.h      regen
        share/man/man4/wm.4             1.22-1.25

                Add support for Intel I350 Ethernet.
                Update document.

diffstat:

 share/man/man4/wm.4    |   22 +++++++-
 sys/dev/pci/if_wm.c    |  121 +++++++++++++++++++++++++++++++++++++++++-------
 sys/dev/pci/if_wmreg.h |   18 ++++++-
 sys/dev/pci/if_wmvar.h |    4 +-
 sys/dev/pci/pcidevs    |    6 ++-
 5 files changed, 146 insertions(+), 25 deletions(-)

diffs (truncated from 475 to 300 lines):

diff -r b14798fef72a -r 157176987323 share/man/man4/wm.4
--- a/share/man/man4/wm.4       Thu Jun 28 04:56:00 2012 +0000
+++ b/share/man/man4/wm.4       Thu Jun 28 16:06:36 2012 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wm.4,v 1.21 2011/04/23 16:46:51 tron Exp $
+.\"    $NetBSD: wm.4,v 1.21.6.1 2012/06/28 16:06:36 riz Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 23, 2011
+.Dd June 20, 2012
 .Dt WM 4
 .Os
 .Sh NAME
@@ -120,11 +120,27 @@
 .It
 Intel i82573 1000BASE-T Ethernet
 .It
+Intel i82575 1000BASE-T Ethernet
+.It
+Intel i82576 Ethernet (Copper, Fiber)
+.It
+Intel i80003 Ethernet (Copper, Fiber)
+.It
 Intel i82801H (ICH8 LAN) 1000BASE-T Ethernet
 .It
 Intel i82801I (ICH9 LAN) 1000BASE-T Ethernet
 .It
-Intel i80003 1000BASE-T Ethernet
+Intel i82801J (ICH10 LAN) 1000BASE-T Ethernet
+.It
+Intel 82578 with Intel 5 series chipset (PCH)
+.It
+Intel 82579 with Intel 6 or 7 series chipset (PCH2)
+.It
+Intel 82580 Ethernet (Copper, Fiber)
+.It
+Intel 82583 1000BASE-T Ethernet
+.It
+Intel I350 Ethernet (Copper, Fiber)
 .El
 .Pp
 In addition to Intel's own
diff -r b14798fef72a -r 157176987323 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Jun 28 04:56:00 2012 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Jun 28 16:06:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.227 2012/02/02 19:43:05 tls Exp $  */
+/*     $NetBSD: if_wm.c,v 1.227.2.1 2012/06/28 16:06:36 riz Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227 2012/02/02 19:43:05 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.1 2012/06/28 16:06:36 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -603,6 +603,7 @@
 static void    wm_enable_wakeup(struct wm_softc *);
 #endif
 static void    wm_init_manageability(struct wm_softc *);
+static void    wm_set_eee_i350(struct wm_softc *);
 
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
     wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
@@ -1001,6 +1002,20 @@
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_82580_QUAD_FIBER,
          "82580 quad-1000BaseX Ethernet",
          WM_T_82580,           WMP_F_1000X },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I350_COPPER,
+         "I350 Gigabit Network Connection",
+         WM_T_I350,            WMP_F_1000T },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I350_FIBER,
+         "I350 Gigabit Fiber Network Connection",
+         WM_T_I350,            WMP_F_1000X },
+#if 0
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I350_SERDES,
+         "I350 Gigabit Backplane Connection",
+         WM_T_I350,            WMP_F_SERDES },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I350_SGMII,
+         "I350 Gigabit Connection",
+         WM_T_I350,            WMP_F_1000T },
+#endif
        { 0,                    0,
          NULL,
          0,                    0 },
@@ -1151,7 +1166,8 @@
        }
 
        if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
-           || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER))
+           || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
+           || (sc->sc_type == WM_T_I350))
                sc->sc_flags |= WM_F_NEWQUEUE;
 
        /* Set device properties (mactype) */
@@ -1264,7 +1280,8 @@
        if ((sc->sc_type == WM_T_82546) || (sc->sc_type == WM_T_82546_3)
            || (sc->sc_type ==  WM_T_82571) || (sc->sc_type == WM_T_80003)
            || (sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
-           || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER))
+           || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
+           || (sc->sc_type == WM_T_I350))
                sc->sc_funcid = (CSR_READ(sc, WMREG_STATUS)
                    >> STATUS_FUNCID_SHIFT) & STATUS_FUNCID_MASK;
        else
@@ -1551,6 +1568,7 @@
        case WM_T_82576:
        case WM_T_82580:
        case WM_T_82580ER:
+       case WM_T_I350:
        case WM_T_80003:
                /* SPI */
                wm_set_spiaddrbits(sc);
@@ -1696,11 +1714,13 @@
        case WM_T_82576:
        case WM_T_82580:
        case WM_T_82580ER:
+       case WM_T_I350:
        case WM_T_ICH8:
        case WM_T_ICH9:
        case WM_T_ICH10:
        case WM_T_PCH:
        case WM_T_PCH2:
+               /* XXX The funcid should be checked on some devices */
                apme_mask = WUC_APME;
                eeprom_data = CSR_READ(sc, WMREG_WUC);
                break;
@@ -1818,6 +1838,7 @@
                case WM_T_82576:
                case WM_T_82580:
                case WM_T_82580ER:
+               case WM_T_I350:
                        reg = CSR_READ(sc, WMREG_CTRL_EXT);
                        switch (reg & CTRL_EXT_LINK_MODE_MASK) {
                        case CTRL_EXT_LINK_MODE_SGMII:
@@ -1878,6 +1899,7 @@
        case WM_T_82576:
        case WM_T_82580:
        case WM_T_82580ER:
+       case WM_T_I350:
        case WM_T_80003:
        case WM_T_ICH9:
        case WM_T_ICH10:
@@ -3114,18 +3136,24 @@
 
                /*
                 * Okay, we have the entire packet now.  The chip is
-                * configured to include the FCS (not all chips can
-                * be configured to strip it), so we need to trim it.
+                * configured to include the FCS except I350
+                * (not all chips can be configured to strip it),
+                * so we need to trim it.
                 * May need to adjust length of previous mbuf in the
                 * chain if the current mbuf is too short.
+                * For an eratta, the RCTL_SECRC bit in RCTL register
+                * is always set in I350, so we don't trim it.
                 */
-               if (m->m_len < ETHER_CRC_LEN) {
-                       sc->sc_rxtail->m_len -= (ETHER_CRC_LEN - m->m_len);
-                       m->m_len = 0;
-               } else {
-                       m->m_len -= ETHER_CRC_LEN;
-               }
-               len = sc->sc_rxlen - ETHER_CRC_LEN;
+               if (sc->sc_type != WM_T_I350) {
+                       if (m->m_len < ETHER_CRC_LEN) {
+                               sc->sc_rxtail->m_len
+                                   -= (ETHER_CRC_LEN - m->m_len);
+                               m->m_len = 0;
+                       } else
+                               m->m_len -= ETHER_CRC_LEN;
+                       len = sc->sc_rxlen - ETHER_CRC_LEN;
+               } else
+                       len = sc->sc_rxlen;
 
                WM_RXCHAIN_LINK(sc, m);
 
@@ -3448,6 +3476,7 @@
        case WM_T_82571:
        case WM_T_82572:
        case WM_T_82575:        /* XXX need special handing for jumbo frames */
+       case WM_T_I350:
        case WM_T_80003:
                sc->sc_pba = PBA_32K;
                break;
@@ -3499,7 +3528,8 @@
        }
 
        /* Set the completion timeout for interface */
-       if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576))
+       if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
+           || (sc->sc_type == WM_T_I350))
                wm_set_pcie_completion_timeout(sc);
 
        /* Clear interrupt */
@@ -3622,6 +3652,7 @@
        case WM_T_82580:
        case WM_T_82580ER:
        case WM_T_82583:
+       case WM_T_I350:
        default:
                /* Everything else can safely use the documented method. */
                CSR_WRITE(sc, WMREG_CTRL, CSR_READ(sc, WMREG_CTRL) | CTRL_RST);
@@ -3681,6 +3712,7 @@
        case WM_T_82576:
        case WM_T_82580:
        case WM_T_82580ER:
+       case WM_T_I350:
        case WM_T_80003:
        case WM_T_ICH8:
        case WM_T_ICH9:
@@ -3704,6 +3736,7 @@
        case WM_T_82580:
        case WM_T_82580ER:
 #endif
+       case WM_T_I350:
        case WM_T_ICH8:
        case WM_T_ICH9:
                if ((CSR_READ(sc, WMREG_EECD) & EECD_EE_PRES) == 0) {
@@ -3712,7 +3745,8 @@
                        if ((sc->sc_type == WM_T_82575)
                            || (sc->sc_type == WM_T_82576)
                            || (sc->sc_type == WM_T_82580)
-                           || (sc->sc_type == WM_T_82580ER))
+                           || (sc->sc_type == WM_T_82580ER)
+                           || (sc->sc_type == WM_T_I350))
                                wm_reset_init_script_82575(sc);
                }
                break;
@@ -3720,7 +3754,8 @@
                break;
        }
 
-       if ((sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)) {
+       if ((sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
+           || (sc->sc_type == WM_T_I350)) {
                /* clear global device reset status bit */
                CSR_WRITE(sc, WMREG_STATUS, STATUS_DEV_RST_SET);
        }
@@ -3732,6 +3767,9 @@
        /* reload sc_ctrl */
        sc->sc_ctrl = CSR_READ(sc, WMREG_CTRL);
 
+       if (sc->sc_type == WM_T_I350)
+               wm_set_eee_i350(sc);
+
        /* dummy read from WUC */
        if (sc->sc_type == WM_T_PCH)
                reg = wm_gmii_hv_readreg(sc->sc_dev, 1, BM_WUC);
@@ -3772,7 +3810,7 @@
 {
        struct wm_softc *sc = ifp->if_softc;
        struct wm_rxsoft *rxs;
-       int i, error = 0;
+       int i, j, trynum, error = 0;
        uint32_t reg;
 
        /*
@@ -3951,8 +3989,13 @@
         * Clear out the VLAN table -- we don't use it (yet).
         */
        CSR_WRITE(sc, WMREG_VET, 0);
+       if (sc->sc_type == WM_T_I350)
+               trynum = 10; /* Due to hw errata */
+       else
+               trynum = 1;
        for (i = 0; i < WM_VLAN_TABSIZE; i++)
-               CSR_WRITE(sc, WMREG_VFTA + (i << 2), 0);
+               for (j = 0; j < trynum; j++)
+                       CSR_WRITE(sc, WMREG_VFTA + (i << 2), 0);
 
        /*
         * Set up flow-control parameters.
@@ -4140,6 +4183,13 @@
        sc->sc_rctl = RCTL_EN | RCTL_LBM_NONE | RCTL_RDMTS_1_2 | RCTL_DPF
            | RCTL_MO(sc->sc_mchash_type);
 
+       /*
+        * The I350 has a bug where it always strips the CRC whether
+        * asked to or not. So ask for stripped CRC here and cope in rxeof
+        */
+       if (sc->sc_type == WM_T_I350)
+               sc->sc_rctl |= RCTL_SECRC;
+
        if (((sc->sc_ethercom.ec_capabilities & ETHERCAP_JUMBO_MTU) != 0)
            && (ifp->if_mtu > ETHERMTU)) {
                sc->sc_rctl |= RCTL_LPE;
@@ -4295,6 +4345,7 @@
        case WM_T_82576:
        case WM_T_82580:
        case WM_T_82580ER:



Home | Main Index | Thread Index | Old Index