Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic KNF. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/108524c00db8
branches:  trunk
changeset: 450725:108524c00db8
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Apr 24 08:03:07 2019 +0000

description:
KNF. No functional change.

diffstat:

 sys/dev/ic/lemac.c   |  1354 ++++++++++++++++++++++++-------------------------
 sys/dev/ic/mb86950.c |   105 ++-
 2 files changed, 722 insertions(+), 737 deletions(-)

diffs (truncated from 1982 to 300 lines):

diff -r cdac1f572e1d -r 108524c00db8 sys/dev/ic/lemac.c
--- a/sys/dev/ic/lemac.c        Wed Apr 24 07:46:55 2019 +0000
+++ b/sys/dev/ic/lemac.c        Wed Apr 24 08:03:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lemac.c,v 1.50 2019/02/05 06:17:02 msaitoh Exp $ */
+/* $NetBSD: lemac.c,v 1.51 2019/04/24 08:03:07 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1997 Matt Thomas <matt%3am-software.com@localhost>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.50 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.51 2019/04/24 08:03:07 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -55,6 +55,7 @@
 #include <net/route.h>
 #include <net/if_ether.h>
 #include <net/if_media.h>
+#include <net/bpf.h>
 
 #ifdef INET
 #include <netinet/in.h>
@@ -73,8 +74,6 @@
 #include <i386/isa/decether.h>
 #endif
 
-#include <net/bpf.h>
-
 static void lemac_init(lemac_softc_t *sc);
 static void lemac_ifstart(struct ifnet *ifp);
 static void lemac_reset(lemac_softc_t *sc);
@@ -86,14 +85,14 @@
 static void lemac_init_adapmem(lemac_softc_t *sc);
 
 static const u_int16_t lemac_allmulti_mctbl[LEMAC_MCTBL_SIZE/sizeof(u_int16_t)] =  {
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
-    0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
+       0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
 };
 
 /*
@@ -102,248 +101,232 @@
 unsigned lemac_txmax = 16;
 
 static void
-lemac_rxd_intr(
-    lemac_softc_t *sc,
-    unsigned cs_value)
+lemac_rxd_intr(lemac_softc_t *sc, unsigned cs_value)
 {
-    /*
-     * Handle CS_RXD (Receiver disabled) here.
-     *
-     * Check Free Memory Queue Count. If not equal to zero
-     * then just turn Receiver back on. If it is equal to
-     * zero then check to see if transmitter is disabled.
-     * Process transmit TXD loop once more.  If all else
-     * fails then do software init (0xC0 to EEPROM Init)
-     * and rebuild Free Memory Queue.
-     */
+       /*
+        * Handle CS_RXD (Receiver disabled) here.
+        *
+        * Check Free Memory Queue Count. If not equal to zero
+        * then just turn Receiver back on. If it is equal to
+        * zero then check to see if transmitter is disabled.
+        * Process transmit TXD loop once more.  If all else
+        * fails then do software init (0xC0 to EEPROM Init)
+        * and rebuild Free Memory Queue.
+        */
 
-    sc->sc_cntrs.cntr_rxd_intrs++;
+       sc->sc_cntrs.cntr_rxd_intrs++;
 
-    /*
-     *  Re-enable Receiver.
-     */
+       /* Re-enable Receiver. */
+
+       cs_value &= ~LEMAC_CS_RXD;
+       LEMAC_OUTB(sc, LEMAC_REG_CS, cs_value);
 
-    cs_value &= ~LEMAC_CS_RXD;
-    LEMAC_OUTB(sc, LEMAC_REG_CS, cs_value);
-
-    if (LEMAC_INB(sc, LEMAC_REG_FMC) > 0)
-       return;
+       if (LEMAC_INB(sc, LEMAC_REG_FMC) > 0)
+               return;
 
-    if (cs_value & LEMAC_CS_TXD)
-       lemac_txd_intr(sc, cs_value);
+       if (cs_value & LEMAC_CS_TXD)
+               lemac_txd_intr(sc, cs_value);
 
-    if ((LEMAC_INB(sc, LEMAC_REG_CS) & LEMAC_CS_RXD) == 0)
-       return;
+       if ((LEMAC_INB(sc, LEMAC_REG_CS) & LEMAC_CS_RXD) == 0)
+               return;
 
-    printf("%s: fatal RXD error, attempting recovery\n", sc->sc_if.if_xname);
+       printf("%s: fatal RXD error, attempting recovery\n",
+           sc->sc_if.if_xname);
 
-    lemac_reset(sc);
-    if (sc->sc_if.if_flags & IFF_UP) {
-       lemac_init(sc);
-       return;
-    }
+       lemac_reset(sc);
+       if (sc->sc_if.if_flags & IFF_UP) {
+               lemac_init(sc);
+               return;
+       }
 
-    /*
-     *  Error during initialization.  Mark card as disabled.
-     */
-    printf("%s: recovery failed -- board disabled\n", sc->sc_if.if_xname);
+       /* Error during initialization.  Mark card as disabled. */
+       printf("%s: recovery failed -- board disabled\n", sc->sc_if.if_xname);
 }
 
 static void
-lemac_tne_intr(
-    lemac_softc_t *sc)
+lemac_tne_intr(lemac_softc_t *sc)
 {
-    unsigned txcount = LEMAC_INB(sc, LEMAC_REG_TDC);
+       unsigned txcount = LEMAC_INB(sc, LEMAC_REG_TDC);
 
-    sc->sc_cntrs.cntr_tne_intrs++;
-    while (txcount-- > 0) {
-       unsigned txsts = LEMAC_INB(sc, LEMAC_REG_TDQ);
-       sc->sc_if.if_opackets++;                /* another one done */
-       if ((txsts & (LEMAC_TDQ_LCL|LEMAC_TDQ_NCL))
-               || (txsts & LEMAC_TDQ_COL) == LEMAC_TDQ_EXCCOL) {
-           if (txsts & LEMAC_TDQ_NCL)
-               sc->sc_flags &= ~LEMAC_LINKUP;
-           sc->sc_if.if_oerrors++;
-       } else {
-           sc->sc_flags |= LEMAC_LINKUP;
-           if ((txsts & LEMAC_TDQ_COL) != LEMAC_TDQ_NOCOL)
-               sc->sc_if.if_collisions++;
+       sc->sc_cntrs.cntr_tne_intrs++;
+       while (txcount-- > 0) {
+               unsigned txsts = LEMAC_INB(sc, LEMAC_REG_TDQ);
+               sc->sc_if.if_opackets++;                /* another one done */
+               if ((txsts & (LEMAC_TDQ_LCL|LEMAC_TDQ_NCL))
+                   || (txsts & LEMAC_TDQ_COL) == LEMAC_TDQ_EXCCOL) {
+                       if (txsts & LEMAC_TDQ_NCL)
+                               sc->sc_flags &= ~LEMAC_LINKUP;
+                       sc->sc_if.if_oerrors++;
+               } else {
+                       sc->sc_flags |= LEMAC_LINKUP;
+                       if ((txsts & LEMAC_TDQ_COL) != LEMAC_TDQ_NOCOL)
+                               sc->sc_if.if_collisions++;
+               }
        }
-    }
-    sc->sc_if.if_flags &= ~IFF_OACTIVE;
-    if_schedule_deferred_start(&sc->sc_if);
+       sc->sc_if.if_flags &= ~IFF_OACTIVE;
+       if_schedule_deferred_start(&sc->sc_if);
 }
 
 static void
-lemac_txd_intr(
-    lemac_softc_t *sc,
-    unsigned cs_value)
+lemac_txd_intr(lemac_softc_t *sc, unsigned cs_value)
 {
-    /*
-     * Read transmit status, remove transmit buffer from
-     * transmit queue and place on free memory queue,
-     * then reset transmitter.
-     * Increment appropriate counters.
-     */
+       /*
+        * Read transmit status, remove transmit buffer from
+        * transmit queue and place on free memory queue,
+        * then reset transmitter.
+        * Increment appropriate counters.
+        */
 
-    sc->sc_cntrs.cntr_txd_intrs++;
-    if (sc->sc_txctl & LEMAC_TX_STP) {
-       sc->sc_if.if_oerrors++;
-       /* return page to free queue */
-       LEMAC_OUTB(sc, LEMAC_REG_FMQ, LEMAC_INB(sc, LEMAC_REG_TDQ));
-    }
+       sc->sc_cntrs.cntr_txd_intrs++;
+       if (sc->sc_txctl & LEMAC_TX_STP) {
+               sc->sc_if.if_oerrors++;
+               /* return page to free queue */
+               LEMAC_OUTB(sc, LEMAC_REG_FMQ, LEMAC_INB(sc, LEMAC_REG_TDQ));
+       }
 
-    /* Turn back on transmitter if disabled */
-    LEMAC_OUTB(sc, LEMAC_REG_CS, cs_value & ~LEMAC_CS_TXD);
-    sc->sc_if.if_flags &= ~IFF_OACTIVE;
+       /* Turn back on transmitter if disabled */
+       LEMAC_OUTB(sc, LEMAC_REG_CS, cs_value & ~LEMAC_CS_TXD);
+       sc->sc_if.if_flags &= ~IFF_OACTIVE;
 }
 
 static int
-lemac_read_eeprom(
-    lemac_softc_t *sc)
+lemac_read_eeprom(lemac_softc_t *sc)
 {
-    int        word_off, cksum;
-
-    u_char *ep;
+       int     word_off, cksum;
+       u_char *ep;
 
-    cksum = 0;
-    ep = sc->sc_eeprom;
-    for (word_off = 0; word_off < LEMAC_EEP_SIZE / 2; word_off++) {
-       LEMAC_OUTB(sc, LEMAC_REG_PI1, word_off);
-       LEMAC_OUTB(sc, LEMAC_REG_IOP, LEMAC_IOP_EEREAD);
+       cksum = 0;
+       ep = sc->sc_eeprom;
+       for (word_off = 0; word_off < LEMAC_EEP_SIZE / 2; word_off++) {
+               LEMAC_OUTB(sc, LEMAC_REG_PI1, word_off);
+               LEMAC_OUTB(sc, LEMAC_REG_IOP, LEMAC_IOP_EEREAD);
 
-       DELAY(LEMAC_EEP_DELAY);
+               DELAY(LEMAC_EEP_DELAY);
 
-       *ep = LEMAC_INB(sc, LEMAC_REG_EE1);     cksum += *ep++;
-       *ep = LEMAC_INB(sc, LEMAC_REG_EE2);     cksum += *ep++;
-    }
+               *ep = LEMAC_INB(sc, LEMAC_REG_EE1);     cksum += *ep++;
+               *ep = LEMAC_INB(sc, LEMAC_REG_EE2);     cksum += *ep++;
+       }
 
-    /*
-     *  Set up Transmit Control Byte for use later during transmit.
-     */
+       /* Set up Transmit Control Byte for use later during transmit. */
 
-    sc->sc_txctl |= LEMAC_TX_FLAGS;
+       sc->sc_txctl |= LEMAC_TX_FLAGS;
 
-    if ((sc->sc_eeprom[LEMAC_EEP_SWFLAGS] & LEMAC_EEP_SW_SQE) == 0)
-       sc->sc_txctl &= ~LEMAC_TX_SQE;
+       if ((sc->sc_eeprom[LEMAC_EEP_SWFLAGS] & LEMAC_EEP_SW_SQE) == 0)
+               sc->sc_txctl &= ~LEMAC_TX_SQE;
+
+       if (sc->sc_eeprom[LEMAC_EEP_SWFLAGS] & LEMAC_EEP_SW_LAB)
+               sc->sc_txctl |= LEMAC_TX_LAB;
 
-    if (sc->sc_eeprom[LEMAC_EEP_SWFLAGS] & LEMAC_EEP_SW_LAB)
-       sc->sc_txctl |= LEMAC_TX_LAB;
+       memcpy(sc->sc_prodname, &sc->sc_eeprom[LEMAC_EEP_PRDNM],
+           LEMAC_EEP_PRDNMSZ);
+       sc->sc_prodname[LEMAC_EEP_PRDNMSZ] = '\0';
 
-    memcpy(sc->sc_prodname, &sc->sc_eeprom[LEMAC_EEP_PRDNM], LEMAC_EEP_PRDNMSZ);
-    sc->sc_prodname[LEMAC_EEP_PRDNMSZ] = '\0';
-
-    return cksum % 256;
+       return cksum % 256;
 }
 
 static void
-lemac_init_adapmem(
-    lemac_softc_t *sc)
+lemac_init_adapmem(lemac_softc_t *sc)
 {
-    int pg, conf;
+       int pg, conf;
 
-    conf = LEMAC_INB(sc, LEMAC_REG_CNF);
+       conf = LEMAC_INB(sc, LEMAC_REG_CNF);
 
-    if ((sc->sc_eeprom[LEMAC_EEP_SETUP] & LEMAC_EEP_ST_DRAM) == 0) {
-       sc->sc_lastpage = 63;
-       conf &= ~LEMAC_CNF_DRAM;
-    } else {
-       sc->sc_lastpage = 127;



Home | Main Index | Thread Index | Old Index