Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Fix a bug that sc->sc_flags can't be passed to i...



details:   https://anonhg.NetBSD.org/src/rev/ba42a0c66596
branches:  trunk
changeset: 355237:ba42a0c66596
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jul 20 10:00:25 2017 +0000

description:
Fix a bug that sc->sc_flags can't be passed to igphy(4). This bug was added
in if_wm.c rev 1.527.

diffstat:

 sys/dev/pci/if_wm.c |  25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diffs (78 lines):

diff -r 5c03379cd7d2 -r ba42a0c66596 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Jul 20 09:31:36 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Jul 20 10:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.528 2017/07/18 08:22:55 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.529 2017/07/20 10:00:25 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.528 2017/07/18 08:22:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.529 2017/07/20 10:00:25 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2480,17 +2480,13 @@
                        sc->sc_nvm_k1_enabled = 0;
        }
 
-       /*
-        * Determine if we're TBI,GMII or SGMII mode, and initialize the
-        * media structures accordingly.
-        */
+       /* Determine if we're GMII, TBI, SERDES or SGMII mode */
        if (sc->sc_type == WM_T_ICH8 || sc->sc_type == WM_T_ICH9
            || sc->sc_type == WM_T_ICH10 || sc->sc_type == WM_T_PCH
            || sc->sc_type == WM_T_PCH2 || sc->sc_type == WM_T_PCH_LPT
            || sc->sc_type == WM_T_PCH_SPT || sc->sc_type == WM_T_82573
            || sc->sc_type == WM_T_82574 || sc->sc_type == WM_T_82583) {
-               /* STATUS_TBIMODE reserved/reused, can't rely on it */
-               wm_gmii_mediainit(sc, wmp->wmp_product);
+               /* Copper only */
        } else if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
            || (sc->sc_type ==WM_T_82580) || (sc->sc_type ==WM_T_I350)
            || (sc->sc_type ==WM_T_I354) || (sc->sc_type ==WM_T_I210)
@@ -2556,11 +2552,6 @@
                else
                        reg &= ~CTRL_EXT_I2C_ENA;
                CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
-
-               if (sc->sc_mediatype == WM_MEDIATYPE_COPPER)
-                       wm_gmii_mediainit(sc, wmp->wmp_product);
-               else
-                       wm_tbi_mediainit(sc);
        } else if (sc->sc_type < WM_T_82543 ||
            (CSR_READ(sc, WMREG_STATUS) & STATUS_TBIMODE) != 0) {
                if (sc->sc_mediatype == WM_MEDIATYPE_COPPER) {
@@ -2568,14 +2559,12 @@
                            "WARNING: TBIMODE set on 1000BASE-T product!\n");
                        sc->sc_mediatype = WM_MEDIATYPE_FIBER;
                }
-               wm_tbi_mediainit(sc);
        } else {
                if (sc->sc_mediatype == WM_MEDIATYPE_FIBER) {
                        aprint_error_dev(sc->sc_dev,
                            "WARNING: TBIMODE clear on 1000BASE-X product!\n");
                        sc->sc_mediatype = WM_MEDIATYPE_COPPER;
                }
-               wm_gmii_mediainit(sc, wmp->wmp_product);
        }
        snprintb(buf, sizeof(buf), WM_FLAGS, sc->sc_flags);
        aprint_verbose_dev(sc->sc_dev, "%s\n", buf);
@@ -2583,6 +2572,12 @@
        /* Set device properties (macflags) */
        prop_dictionary_set_uint32(dict, "macflags", sc->sc_flags);
 
+       /* Initialize the media structures accordingly. */
+       if (sc->sc_mediatype == WM_MEDIATYPE_COPPER)
+               wm_gmii_mediainit(sc, wmp->wmp_product);
+       else
+               wm_tbi_mediainit(sc); /* All others */
+
        ifp = &sc->sc_ethercom.ec_if;
        xname = device_xname(sc->sc_dev);
        strlcpy(ifp->if_xname, xname, IFNAMSIZ);



Home | Main Index | Thread Index | Old Index