Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/10cfcc4144c5
branches:  trunk
changeset: 447348:10cfcc4144c5
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jan 08 06:17:40 2019 +0000

description:
KNF. No functional change.

diffstat:

 sys/dev/pci/if_de.c    |  9385 +++++++++++++++++++++++------------------------
 sys/dev/pci/if_devar.h |     4 +-
 2 files changed, 4675 insertions(+), 4714 deletions(-)

diffs (truncated from 10387 to 300 lines):

diff -r a5afff012e6f -r 10cfcc4144c5 sys/dev/pci/if_de.c
--- a/sys/dev/pci/if_de.c       Tue Jan 08 06:04:29 2019 +0000
+++ b/sys/dev/pci/if_de.c       Tue Jan 08 06:17:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_de.c,v 1.156 2018/12/09 11:14:02 jdolecek Exp $     */
+/*     $NetBSD: if_de.c,v 1.157 2019/01/08 06:17:40 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1994-1997 Matt Thomas (matt%3am-software.com@localhost)
@@ -37,7 +37,7 @@
  *   board which support 21040, 21041, or 21140 (mostly).
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.156 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.157 2019/01/08 06:17:40 msaitoh Exp $");
 
 #define        TULIP_HDR_DATA
 
@@ -166,7 +166,8 @@
  *     the DEC 21041 PCI Ethernet Controller.
  *     the DEC 21140 PCI Fast Ethernet Controller.
  */
-static void tulip_mii_autonegotiate(tulip_softc_t * const sc, const unsigned phyaddr);
+static void tulip_mii_autonegotiate(tulip_softc_t * const sc,
+    const unsigned phyaddr);
 static tulip_intrfunc_t tulip_intr_shared(void *arg);
 static tulip_intrfunc_t tulip_intr_normal(void *arg);
 static void tulip_init(tulip_softc_t * const sc);
@@ -177,14 +178,18 @@
 static void tulip_txput_setup(tulip_softc_t * const sc);
 static void tulip_rx_intr(tulip_softc_t * const sc);
 static void tulip_addr_filter(tulip_softc_t * const sc);
-static unsigned tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr, unsigned regno);
-static void tulip_mii_writereg(tulip_softc_t * const sc, unsigned devaddr, unsigned regno, unsigned data);
-static int tulip_mii_map_abilities(tulip_softc_t * const sc, unsigned abilities);
+static unsigned tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr,
+    unsigned regno);
+static void tulip_mii_writereg(tulip_softc_t * const sc, unsigned devaddr,
+    unsigned regno, unsigned data);
+static int tulip_mii_map_abilities(tulip_softc_t * const sc,
+    unsigned abilities);
 static tulip_media_t tulip_mii_phy_readspecific(tulip_softc_t * const sc);
 static int tulip_srom_decode(tulip_softc_t * const sc);
 #if defined(IFM_ETHER)
 static int tulip_ifmedia_change(struct ifnet * const ifp);
-static void tulip_ifmedia_status(struct ifnet * const ifp, struct ifmediareq *req);
+static void tulip_ifmedia_status(struct ifnet * const ifp,
+    struct ifmediareq *req);
 #endif
 /* static void tulip_21140_map_media(tulip_softc_t *sc); */
 
@@ -215,96 +220,91 @@
 
 
 static void
-tulip_timeout_callback(
-    void *arg)
+tulip_timeout_callback(void *arg)
 {
-    tulip_softc_t * const sc = arg;
-    tulip_spl_t s = TULIP_RAISESPL();
-
-    TULIP_PERFSTART(timeout)
-
-    sc->tulip_flags &= ~TULIP_TIMEOUTPENDING;
-    sc->tulip_probe_timeout -= 1000 / TULIP_HZ;
-    (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER);
-
-    TULIP_PERFEND(timeout);
-    TULIP_RESTORESPL(s);
+       tulip_softc_t * const sc = arg;
+       tulip_spl_t s = TULIP_RAISESPL();
+
+       TULIP_PERFSTART(timeout);
+
+       sc->tulip_flags &= ~TULIP_TIMEOUTPENDING;
+       sc->tulip_probe_timeout -= 1000 / TULIP_HZ;
+       (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER);
+
+       TULIP_PERFEND(timeout);
+       TULIP_RESTORESPL(s);
 }
 
 static void
-tulip_timeout(
-    tulip_softc_t * const sc)
+tulip_timeout(tulip_softc_t * const sc)
 {
-    if (sc->tulip_flags & TULIP_TIMEOUTPENDING)
-       return;
-    sc->tulip_flags |= TULIP_TIMEOUTPENDING;
-    callout_reset(&sc->tulip_to_ch, (hz + TULIP_HZ / 2) / TULIP_HZ,
-       tulip_timeout_callback, sc);
+       if (sc->tulip_flags & TULIP_TIMEOUTPENDING)
+               return;
+       sc->tulip_flags |= TULIP_TIMEOUTPENDING;
+       callout_reset(&sc->tulip_to_ch, (hz + TULIP_HZ / 2) / TULIP_HZ,
+           tulip_timeout_callback, sc);
 }
 
 #if defined(TULIP_NEED_FASTTIMEOUT)
 static void
-tulip_fasttimeout_callback(
-    void *arg)
+tulip_fasttimeout_callback(void *arg)
 {
-    tulip_softc_t * const sc = arg;
-    tulip_spl_t s = TULIP_RAISESPL();
-
-    sc->tulip_flags &= ~TULIP_FASTTIMEOUTPENDING;
-    (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_FASTTIMER);
-    TULIP_RESTORESPL(s);
+       tulip_softc_t * const sc = arg;
+       tulip_spl_t s = TULIP_RAISESPL();
+
+       sc->tulip_flags &= ~TULIP_FASTTIMEOUTPENDING;
+       (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_FASTTIMER);
+       TULIP_RESTORESPL(s);
 }
 
 static void
-tulip_fasttimeout(
-    tulip_softc_t * const sc)
+tulip_fasttimeout(tulip_softc_t * const sc)
 {
-    if (sc->tulip_flags & TULIP_FASTTIMEOUTPENDING)
-       return;
-    sc->tulip_flags |= TULIP_FASTTIMEOUTPENDING;
-    callout_reset(&sc->tulip_fto_ch, 1, tulip_fasttimeout_callback, sc);
+       if (sc->tulip_flags & TULIP_FASTTIMEOUTPENDING)
+               return;
+       sc->tulip_flags |= TULIP_FASTTIMEOUTPENDING;
+       callout_reset(&sc->tulip_fto_ch, 1, tulip_fasttimeout_callback, sc);
 }
 #endif
 
 static int
-tulip_txprobe(
-    tulip_softc_t * const sc)
+tulip_txprobe(tulip_softc_t * const sc)
 {
-    struct mbuf *m;
-    /*
-     * Before we are sure this is the right media we need
-     * to send a small packet to make sure there's carrier.
-     * Strangely, BNC and AUI will "see" receive data if
-     * either is connected so the transmit is the only way
-     * to verify the connectivity.
-     */
-    MGETHDR(m, M_DONTWAIT, MT_DATA);
-    if (m == NULL)
-       return 0;
-    /*
-     * Construct a LLC TEST message which will point to ourselves.
-     */
-    memcpy(mtod(m, struct ether_header *)->ether_dhost, sc->tulip_enaddr,
-       ETHER_ADDR_LEN);
-    memcpy(mtod(m, struct ether_header *)->ether_shost, sc->tulip_enaddr,
-       ETHER_ADDR_LEN);
-    mtod(m, struct ether_header *)->ether_type = htons(3);
-    mtod(m, unsigned char *)[14] = 0;
-    mtod(m, unsigned char *)[15] = 0;
-    mtod(m, unsigned char *)[16] = 0xE3;       /* LLC Class1 TEST (no poll) */
-    m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3;
-    /*
-     * send it!
-     */
-    sc->tulip_cmdmode |= TULIP_CMD_TXRUN;
-    sc->tulip_intrmask |= TULIP_STS_TXINTR;
-    sc->tulip_flags |= TULIP_TXPROBE_ACTIVE;
-    TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
-    TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
-    if ((m = tulip_txput(sc, m)) != NULL)
-       m_freem(m);
-    sc->tulip_probe.probe_txprobes++;
-    return 1;
+       struct mbuf *m;
+       /*
+        * Before we are sure this is the right media we need
+        * to send a small packet to make sure there's carrier.
+        * Strangely, BNC and AUI will "see" receive data if
+        * either is connected so the transmit is the only way
+        * to verify the connectivity.
+        */
+       MGETHDR(m, M_DONTWAIT, MT_DATA);
+       if (m == NULL)
+               return 0;
+       /*
+        * Construct a LLC TEST message which will point to ourselves.
+        */
+       memcpy(mtod(m, struct ether_header *)->ether_dhost, sc->tulip_enaddr,
+           ETHER_ADDR_LEN);
+       memcpy(mtod(m, struct ether_header *)->ether_shost, sc->tulip_enaddr,
+           ETHER_ADDR_LEN);
+       mtod(m, struct ether_header *)->ether_type = htons(3);
+       mtod(m, unsigned char *)[14] = 0;
+       mtod(m, unsigned char *)[15] = 0;
+       mtod(m, unsigned char *)[16] = 0xE3;    /* LLC Class1 TEST (no poll) */
+       m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3;
+       /*
+        * send it!
+        */
+       sc->tulip_cmdmode |= TULIP_CMD_TXRUN;
+       sc->tulip_intrmask |= TULIP_STS_TXINTR;
+       sc->tulip_flags |= TULIP_TXPROBE_ACTIVE;
+       TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
+       TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
+       if ((m = tulip_txput(sc, m)) != NULL)
+               m_freem(m);
+       sc->tulip_probe.probe_txprobes++;
+       return 1;
 }
 
 #ifdef BIG_PACKET
@@ -314,1640 +314,1639 @@
 #endif
 
 static void
-tulip_media_set(
-    tulip_softc_t * const sc,
-    tulip_media_t media)
+tulip_media_set(tulip_softc_t * const sc, tulip_media_t media)
 {
-    const tulip_media_info_t *mi = sc->tulip_mediums[media];
-
-    if (mi == NULL)
-       return;
-
-    /* Reset the SIA first
-     */
-    if (mi->mi_type == TULIP_MEDIAINFO_SIA || (sc->tulip_features & TULIP_HAVE_SIANWAY)) {
-       TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET);
-    }
-
-    /* Next, set full duplex if needed.
-     */
-    if (sc->tulip_flags & TULIP_FULLDUPLEX) {
-#ifdef TULIP_DEBUG
-       if (TULIP_CSR_READ(sc, csr_command) & (TULIP_CMD_RXRUN|TULIP_CMD_TXRUN)) {
-           printf(TULIP_PRINTF_FMT ": warning: board is running (FD).\n",
-                  TULIP_PRINTF_ARGS);
-       }
-#endif
-       if ((TULIP_CSR_READ(sc, csr_command) & TULIP_CMD_FULLDUPLEX) == 0) {
-           loudprintf(TULIP_PRINTF_FMT ": setting full duplex.\n",
-                      TULIP_PRINTF_ARGS);
+       const tulip_media_info_t *mi = sc->tulip_mediums[media];
+
+       if (mi == NULL)
+               return;
+
+       /* Reset the SIA first
+        */
+       if (mi->mi_type == TULIP_MEDIAINFO_SIA
+           || (sc->tulip_features & TULIP_HAVE_SIANWAY)) {
+               TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET);
        }
-       sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX;
-       TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode & ~(TULIP_CMD_RXRUN|TULIP_CMD_TXRUN));
-    }
-
-    /* Now setup the media.
-     */
-    /*
-     * If we are switching media, make sure we don't think there's
-     * any stale RX activity
-     */
-    sc->tulip_flags &= ~TULIP_RXACT;
-    if (mi->mi_type == TULIP_MEDIAINFO_SIA) {
-       TULIP_CSR_WRITE(sc, csr_sia_tx_rx,        mi->mi_sia_tx_rx);
-       if (sc->tulip_features & TULIP_HAVE_SIAGP) {
-           TULIP_CSR_WRITE(sc, csr_sia_general,  mi->mi_sia_gp_control|mi->mi_sia_general|TULIP_SIAGEN_WATCHDOG);
-           DELAY(50);
-           TULIP_CSR_WRITE(sc, csr_sia_general,  mi->mi_sia_gp_data|mi->mi_sia_general|TULIP_SIAGEN_WATCHDOG);
-       } else {
-           TULIP_CSR_WRITE(sc, csr_sia_general,  mi->mi_sia_general|TULIP_SIAGEN_WATCHDOG);
-       }
-       TULIP_CSR_WRITE(sc, csr_sia_connectivity, mi->mi_sia_connectivity);
-    } else if (mi->mi_type == TULIP_MEDIAINFO_GPR) {
-#define        TULIP_GPR_CMDBITS       (TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION|TULIP_CMD_SCRAMBLER|TULIP_CMD_TXTHRSHLDCTL)
-       /*
-        * If the cmdmode bits don't match the currently operating mode,
-        * set the cmdmode appropriately and reset the chip.
+
+       /* Next, set full duplex if needed.
         */
-       if (((mi->mi_cmdmode ^ TULIP_CSR_READ(sc, csr_command)) & TULIP_GPR_CMDBITS) != 0) {
-           sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS;
-           sc->tulip_cmdmode |= mi->mi_cmdmode;
-           tulip_reset(sc);
+       if (sc->tulip_flags & TULIP_FULLDUPLEX) {
+#ifdef TULIP_DEBUG
+               if (TULIP_CSR_READ(sc, csr_command)
+                   & (TULIP_CMD_RXRUN|TULIP_CMD_TXRUN)) {
+                       printf(TULIP_PRINTF_FMT
+                           ": warning: board is running (FD).\n",
+                           TULIP_PRINTF_ARGS);
+               }
+#endif
+               if ((TULIP_CSR_READ(sc, csr_command) & TULIP_CMD_FULLDUPLEX)



Home | Main Index | Thread Index | Old Index