Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/dev/ic pullup-1-6 ticket #505 (chuq).



details:   https://anonhg.NetBSD.org/src/rev/3e4d8114eeda
branches:  netbsd-1-6
changeset: 528433:3e4d8114eeda
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jul 15 16:30:15 2002 +0000

description:
pullup-1-6 ticket #505 (chuq).

Original log message:
use the SROM info to set the media in 2114[23] autonegotiation
rather than just fiddling the opmode CSR, since we might
need to change the SIA CSRs as well (eg. for some ZNYX cards).
from PR 17510.

diffstat:

 sys/dev/ic/tulip.c |  46 ++++++++++++++++++++++------------------------
 1 files changed, 22 insertions(+), 24 deletions(-)

diffs (94 lines):

diff -r 0da82e28d8d7 -r 3e4d8114eeda sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Mon Jul 15 16:27:48 2002 +0000
+++ b/sys/dev/ic/tulip.c        Mon Jul 15 16:30:15 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.113.4.1 2002/07/10 01:37:56 lukem Exp $    */
+/*     $NetBSD: tulip.c,v 1.113.4.2 2002/07/15 16:30:15 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.113.4.1 2002/07/10 01:37:56 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.113.4.2 2002/07/15 16:30:15 thorpej Exp $");
 
 #include "bpfilter.h"
 
@@ -3936,6 +3936,7 @@
 void   tlp_sia_update_link __P((struct tulip_softc *));
 void   tlp_sia_get __P((struct tulip_softc *, struct ifmediareq *));
 int    tlp_sia_set __P((struct tulip_softc *));
+int    tlp_sia_media __P((struct tulip_softc *, struct ifmedia_entry *));
 void   tlp_sia_fixup __P((struct tulip_softc *));
 
 void
@@ -4077,10 +4078,17 @@
 tlp_sia_set(sc)
        struct tulip_softc *sc;
 {
+
+       return (tlp_sia_media(sc, TULIP_CURRENT_MEDIA(sc)));
+}
+
+int
+tlp_sia_media(sc, ife)
+       struct tulip_softc *sc;
        struct ifmedia_entry *ife;
+{
        struct tulip_21x4x_media *tm;
 
-       ife = TULIP_CURRENT_MEDIA(sc);
        tm = ife->ifm_aux;
 
        /*
@@ -4109,7 +4117,7 @@
                TULIP_WRITE(sc, CSR_SIAGEN, tm->tm_siagen | tm->tm_gpdata);
                break;
        default:
-               TULIP_WRITE(sc, CSR_SIAGEN,  tm->tm_siagen);
+               TULIP_WRITE(sc, CSR_SIAGEN, tm->tm_siagen);
        }
 
        TULIP_WRITE(sc, CSR_SIACONN, tm->tm_siaconn);
@@ -5018,29 +5026,19 @@
 {
        struct tulip_softc *sc = (struct tulip_softc *)self;
        struct mii_data *mii = &sc->sc_mii;
+       struct ifmedia_entry *ife;
 
        if (IFM_SUBTYPE(mii->mii_media_active) == IFM_NONE)
                return;
-
-       /* Idle the transmit and receive processes. */
-       tlp_idle(sc, OPMODE_ST|OPMODE_SR);
-
-       sc->sc_opmode &= ~(OPMODE_TTM|OPMODE_FD|OPMODE_PS|OPMODE_PCS|
-           OPMODE_SCR|OPMODE_HBD);
-
-       if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T)
-               sc->sc_opmode |= OPMODE_TTM;
-       else
-               sc->sc_opmode |= OPMODE_PS|OPMODE_PCS|OPMODE_SCR|OPMODE_HBD;
-
-       if (mii->mii_media_active & IFM_FDX)
-               sc->sc_opmode |= OPMODE_FD|OPMODE_HBD;
-
-       /*
-        * Write new OPMODE bits.  This also restarts the transmit
-        * and receive processes.
-        */
-       TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
+       
+       if ((ife = ifmedia_match(&mii->mii_media, mii->mii_media_active, 
+           mii->mii_media.ifm_mask)) == NULL) {
+               printf("tlp_2114x_nway_statchg: no match for media 0x%x/0x%x\n",
+                   mii->mii_media_active, ~mii->mii_media.ifm_mask);
+               panic("tlp_2114x_nway_statchg");
+       }
+
+       tlp_sia_media(sc, ife);
 }
 
 void



Home | Main Index | Thread Index | Old Index