Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/ic pull up rev. 1.12 (approved by thorpej):



details:   https://anonhg.NetBSD.org/src/rev/277000a49502
branches:  netbsd-1-5
changeset: 489427:277000a49502
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Sep 11 14:06:33 2000 +0000

description:
pull up rev. 1.12 (approved by thorpej):
-fix multicast filter programming
-support access to MII_ANER too for completeness
-remove some hacks which disappeared in FreeBSD if_rl.c
 rev. 1.25 (Aug 31 14:45:49 1999)
(the driver could need more updating, but this is what I've tested
for months)

diffstat:

 sys/dev/ic/rtl81x9.c |  44 +++++++++++++++++++++-----------------------
 1 files changed, 21 insertions(+), 23 deletions(-)

diffs (113 lines):

diff -r 009032e99897 -r 277000a49502 sys/dev/ic/rtl81x9.c
--- a/sys/dev/ic/rtl81x9.c      Sun Sep 10 18:35:03 2000 +0000
+++ b/sys/dev/ic/rtl81x9.c      Mon Sep 11 14:06:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl81x9.c,v 1.11 2000/05/21 13:00:46 tsutsui Exp $     */
+/*     $NetBSD: rtl81x9.c,v 1.11.4.1 2000/09/11 14:06:33 drochner Exp $        */
 
 /*
  * Copyright (c) 1997, 1998
@@ -468,6 +468,9 @@
                case MII_ANAR:
                        rtk8139_reg = RTK_ANAR;
                        break;
+               case MII_ANER:
+                       rtk8139_reg = RTK_ANER;
+                       break;
                case MII_ANLPAR:
                        rtk8139_reg = RTK_LPAR;
                        break;
@@ -513,6 +516,9 @@
                case MII_ANAR:
                        rtk8139_reg = RTK_ANAR;
                        break;
+               case MII_ANER:
+                       rtk8139_reg = RTK_ANER;
+                       break;
                case MII_ANLPAR:
                        rtk8139_reg = RTK_LPAR;
                        break;
@@ -1367,19 +1373,10 @@
        struct ifnet            *ifp = &sc->ethercom.ec_if;
        int                     s, i;
        u_int32_t               rxcfg;
-       u_int16_t               phy_bmcr = 0;
 
        s = splnet();
 
        /*
-        * XXX Hack for the 8139: the built-in autoneg logic's state
-        * gets reset by rtk_init() when we don't want it to. Try
-        * to preserve it.
-        */
-       if (sc->rtk_type == RTK_8139)
-               phy_bmcr = rtk_phy_readreg((struct device *)sc, 7, MII_BMCR);
-
-       /*
         * Cancel pending I/O and free all RX/TX buffers.
         */
        rtk_stop(sc);
@@ -1448,10 +1445,6 @@
        /* Enable receiver and transmitter. */
        CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB|RTK_CMD_RX_ENB);
 
-       /* Restore state of BMCR */
-       if (sc->rtk_type == RTK_8139)
-               rtk_phy_writereg((struct device *)sc, 7, MII_BMCR, phy_bmcr);
-
        CSR_WRITE_1(sc, RTK_CFG1, RTK_CFG1_DRVLOAD|RTK_CFG1_FULLDUPLEX);
 
        /*
@@ -1474,13 +1467,8 @@
        struct ifnet            *ifp;
 {
        struct rtk_softc        *sc;
-       struct ifmedia          *ifm;
 
        sc = ifp->if_softc;
-       ifm = &sc->mii.mii_media;
-
-       if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
-               return(EINVAL);
 
        return (mii_mediachg(&sc->mii));
 }
@@ -1564,7 +1552,7 @@
 
        s = splnet();
 
-       switch(command) {
+       switch (command) {
        case SIOCSIFADDR:
        case SIOCGIFADDR:
        case SIOCSIFMTU:
@@ -1585,8 +1573,18 @@
                break;
        case SIOCADDMULTI:
        case SIOCDELMULTI:
-               rtk_setmulti(sc);
-               error = 0;
+               error = (command == SIOCADDMULTI) ?
+                   ether_addmulti(ifr, &sc->ethercom) :
+                   ether_delmulti(ifr, &sc->ethercom);
+
+               if (error == ENETRESET) { 
+                       /*
+                        * Multicast list has changed; set the hardware filter
+                        * accordingly.
+                        */
+                       rtk_setmulti(sc);
+                       error = 0;
+               }
                break;
        case SIOCGIFMEDIA:
        case SIOCSIFMEDIA:
@@ -1597,7 +1595,7 @@
                break;
        }
 
-       (void)splx(s);
+       splx(s);
 
        return(error);
 }



Home | Main Index | Thread Index | Old Index