Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic cosmetic changes before i do some functional chan...



details:   https://anonhg.NetBSD.org/src/rev/27cd5708379a
branches:  trunk
changeset: 477547:27cd5708379a
user:      enami <enami%NetBSD.org@localhost>
date:      Wed Oct 20 16:34:22 1999 +0000

description:
cosmetic changes before i do some functional changes.

diffstat:

 sys/dev/ic/elink3.c |  73 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 40 insertions(+), 33 deletions(-)

diffs (210 lines):

diff -r a12235d363fc -r 27cd5708379a sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c       Wed Oct 20 16:02:01 1999 +0000
+++ b/sys/dev/ic/elink3.c       Wed Oct 20 16:34:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3.c,v 1.59 1999/10/11 17:48:20 thorpej Exp $      */
+/*     $NetBSD: elink3.c,v 1.60 1999/10/20 16:34:22 enami Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -202,11 +202,11 @@
 
 static void eptxstat __P((struct ep_softc *));
 static int epstatus __P((struct ep_softc *));
-void epinit __P((struct ep_softc *));
-int epioctl __P((struct ifnet *, u_long, caddr_t));
-void epstart __P((struct ifnet *));
-void epwatchdog __P((struct ifnet *));
-void epreset __P((struct ep_softc *));
+void   epinit __P((struct ep_softc *));
+int    epioctl __P((struct ifnet *, u_long, caddr_t));
+void   epstart __P((struct ifnet *));
+void   epwatchdog __P((struct ifnet *));
+void   epreset __P((struct ep_softc *));
 static void epshutdown __P((void *));
 void   epread __P((struct ep_softc *));
 struct mbuf *epget __P((struct ep_softc *, int));
@@ -282,7 +282,8 @@
        int i;
 
        for (i = 0; i < 10000; i++) {
-               if ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
+               if ((bus_space_read_2(iot, ioh, ELINK_STATUS) &
+                   S_COMMAND_IN_PROGRESS) == 0)
                        break;
                DELAY(10);
        }
@@ -321,7 +322,8 @@
         * is about right.
         */
        for (i = 0; i < 8000; i++) {
-               if  ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
+               if ((bus_space_read_2(iot, ioh, ELINK_STATUS) &
+                   S_COMMAND_IN_PROGRESS) == 0)
                    return;
        }
 
@@ -378,7 +380,7 @@
         * threshold value was shifted or not.
         */
        bus_space_write_2(iot, ioh, ELINK_COMMAND,
-                         SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE ); 
+           SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE); 
        GO_WINDOW(5);
        i = bus_space_read_2(iot, ioh, ELINK_W5_TX_AVAIL_THRESH);
        GO_WINDOW(1);
@@ -494,13 +496,12 @@
        GO_WINDOW(1);           /* Window 1 is operating window */
 
 #if NBPFILTER > 0
-       bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB,
-                 sizeof(struct ether_header));
+       bpfattach(ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
 #endif
 
 #if NRND > 0
        rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
-                         RND_TYPE_NET, 0);
+           RND_TYPE_NET, 0);
 #endif
 
        sc->tx_start_thresh = 20;       /* probably a good starting point. */
@@ -537,7 +538,8 @@
 
        GO_WINDOW(3);
        config0 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG);
-       config1 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2);
+       config1 = (u_int)bus_space_read_2(iot, ioh,
+           ELINK_W3_INTERNAL_CONFIG + 2);
        GO_WINDOW(0);
 
        ram_size  = (config0 & CONFIG_RAMSIZE) >> CONFIG_RAMSIZE_SHIFT;
@@ -644,7 +646,8 @@
        const char *sep = "", *defmedianame = NULL;
 
        GO_WINDOW(3);
-       config1 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2);
+       config1 = (u_int)bus_space_read_2(iot, ioh,
+           ELINK_W3_INTERNAL_CONFIG + 2);
        reset_options = (int)bus_space_read_1(iot, ioh, ELINK_W3_RESET_OPTIONS);
        GO_WINDOW(0);
 
@@ -741,7 +744,8 @@
        if (sc->bustype != ELINK_BUS_PCI) {
                GO_WINDOW(0);
                bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL, 0);
-               bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
+               bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL,
+                   ENABLE_DRQ_IRQ);
        }
 
        if (sc->bustype == ELINK_BUS_PCMCIA) {
@@ -799,10 +803,12 @@
        }
 
        /* Enable interrupts. */
-       bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE |
-                               S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
-       bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_INTR_MASK | S_CARD_FAILURE |
-                               S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
+       bus_space_write_2(iot, ioh, ELINK_COMMAND,
+           SET_RD_0_MASK | S_CARD_FAILURE | S_RX_COMPLETE | S_TX_COMPLETE |
+           S_TX_AVAIL);
+       bus_space_write_2(iot, ioh, ELINK_COMMAND,
+           SET_INTR_MASK | S_CARD_FAILURE | S_RX_COMPLETE | S_TX_COMPLETE |
+           S_TX_AVAIL);
 
        /*
         * Attempt to get rid of any stray interrupts that occured during
@@ -846,10 +852,10 @@
        register struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
        GO_WINDOW(1);           /* Window 1 is operating window */
-       bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND, SET_RX_FILTER |
-           FIL_INDIVIDUAL | FIL_BRDCST |
-           ((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0 ) |
-           ((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0 ));
+       bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND,
+           SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST |
+           ((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0) |
+           ((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0));
 }
 
 int
@@ -921,8 +927,8 @@
 
                        resopt = bus_space_read_2(iot, ioh,
                            ELINK_W3_RESET_OPTIONS);
-                       bus_space_write_2(iot, ioh,
-                           ELINK_W3_RESET_OPTIONS, resopt|ELINK_RUNNER_ENABLE_MII);
+                       bus_space_write_2(iot, ioh, ELINK_W3_RESET_OPTIONS,
+                           resopt | ELINK_RUNNER_ENABLE_MII);
                }
 #endif
 
@@ -935,7 +941,8 @@
                config1 |= (ELINKMEDIA_MII << CONFIG_MEDIAMASK_SHIFT);
 
                bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG, config0);
-               bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2, config1);
+               bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2,
+                   config1);
                GO_WINDOW(1);   /* back to operating window */
 
                mii_mediachg(&sc->sc_mii);
@@ -1141,7 +1148,7 @@
                return;
        } else {
                bus_space_write_2(iot, ioh, ELINK_COMMAND,
-                   SET_TX_AVAIL_THRESH | ELINK_THRESH_DISABLE );
+                   SET_TX_AVAIL_THRESH | ELINK_THRESH_DISABLE);
        }
 
        IF_DEQUEUE(&ifp->if_snd, m0);
@@ -1149,7 +1156,7 @@
                return;
 
        bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_TX_START_THRESH |
-           ((len / 4 + sc->tx_start_thresh) /* >> sc->ep_pktlenshift*/) );
+           ((len / 4 + sc->tx_start_thresh) /* >> sc->ep_pktlenshift*/));
 
 #if NBPFILTER > 0
        if (ifp->if_bpf)
@@ -1179,7 +1186,7 @@
        bus_space_write_2(iot, ioh, txreg, len);
        bus_space_write_2(iot, ioh, txreg, 0xffff); /* Second is meaningless */
        if (ELINK_IS_BUS_32(sc->bustype)) {
-               for (m = m0; m; ) {
+               for (m = m0; m;) {
                        if (m->m_len > 3)  {
                                /* align our reads from core */
                                if (mtod(m, u_long) & 3)  {
@@ -1205,7 +1212,7 @@
                        m = m0;
                }
        } else {
-               for (m = m0; m; ) {
+               for (m = m0; m;) {
                        if (m->m_len > 1)  {
                                if (mtod(m, u_long) & 1)  {
                                        bus_space_write_1(iot, ioh,
@@ -1328,8 +1335,8 @@
         * We need to read+write TX_STATUS until we get a 0 status
         * in order to turn off the interrupt flag.
         */
-       while ((i = bus_space_read_1(iot, ioh, ep_w1_reg(sc, ELINK_W1_TX_STATUS)))
-           & TXS_COMPLETE) {
+       while ((i = bus_space_read_1(iot, ioh,
+            ep_w1_reg(sc, ELINK_W1_TX_STATUS))) & TXS_COMPLETE) {
                bus_space_write_1(iot, ioh, ep_w1_reg(sc, ELINK_W1_TX_STATUS),
                    0x0);
 
@@ -1536,7 +1543,7 @@
                if ((ifp->if_flags & IFF_PROMISC) &&
                    (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
                    bcmp(eh->ether_dhost, LLADDR(sc->sc_ethercom.ec_if.if_sadl),
-                           sizeof(eh->ether_dhost)) != 0) {
+                       sizeof(eh->ether_dhost)) != 0) {
                        m_freem(m);
                        return;
                }



Home | Main Index | Thread Index | Old Index