Source-Changes-HG archive

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

[src/trunk]: src/sys/dev split if_wi



details:   https://anonhg.NetBSD.org/src/rev/f05768155d2b
branches:  trunk
changeset: 758985:f05768155d2b
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 23 04:33:09 2010 +0000

description:
split if_wi

diffstat:

 sys/dev/ic/wi.c               |  110 ++++++++++++++++++++++-------------------
 sys/dev/ic/wivar.h            |    7 +-
 sys/dev/pci/if_wi_pci.c       |   54 +++++++++-----------
 sys/dev/pcmcia/if_wi_pcmcia.c |  106 +++++++++++++++++++--------------------
 4 files changed, 138 insertions(+), 139 deletions(-)

diffs (truncated from 802 to 300 lines):

diff -r 6ebd1635a457 -r f05768155d2b sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c   Tue Nov 23 00:02:20 2010 +0000
+++ b/sys/dev/ic/wi.c   Tue Nov 23 04:33:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wi.c,v 1.233 2010/04/05 07:19:37 joerg Exp $   */
+/*     $NetBSD: wi.c,v 1.234 2010/11/23 04:33:09 christos Exp $        */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.233 2010/04/05 07:19:37 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.234 2010/11/23 04:33:09 christos Exp $");
 
 #define WI_HERMES_AUTOINC_WAR  /* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR    /* Work around stats counter bug. */
@@ -405,7 +405,7 @@
        /* Read NIC identification */
        wi_read_nicid(sc);
 
-       memcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+       memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
        ifp->if_softc = sc;
        ifp->if_start = wi_start;
        ifp->if_ioctl = wi_ioctl;
@@ -426,7 +426,7 @@
        /* Find available channel */
        if (wi_read_xrid(sc, WI_RID_CHANNEL_LIST, &chanavail,
                         sizeof(chanavail)) != 0) {
-               aprint_normal_dev(&sc->sc_dev, "using default channel list\n");
+               aprint_normal_dev(sc->sc_dev, "using default channel list\n");
                chanavail = htole16(0x1fff);    /* assume 1-13 */
        }
        for (chan = 16; chan > 0; chan--) {
@@ -445,7 +445,7 @@
                        ic->ic_ibss_chan = &ic->ic_channels[chan];
        }
        if (ic->ic_ibss_chan == NULL) {
-               aprint_error_dev(&sc->sc_dev, "no available channel\n");
+               aprint_error_dev(sc->sc_dev, "no available channel\n");
                return 1;
        }
 
@@ -526,7 +526,7 @@
                    &ratebuf.rates[0], nrate);
                ic->ic_sup_rates[IEEE80211_MODE_11B].rs_nrates = nrate;
        } else {
-               aprint_error_dev(&sc->sc_dev, "no supported rate list\n");
+               aprint_error_dev(sc->sc_dev, "no supported rate list\n");
                return 1;
        }
 
@@ -621,7 +621,7 @@
        u_int16_t status;
 
        if (sc->sc_enabled == 0 ||
-           !device_is_active(&sc->sc_dev) ||
+           !device_is_active(sc->sc_dev) ||
            (ifp->if_flags & IFF_RUNNING) == 0)
                return 0;
 
@@ -730,7 +730,7 @@
        DPRINTF(("wi_init: enabled %d\n", sc->sc_enabled));
        wasenabled = sc->sc_enabled;
        if (!sc->sc_enabled) {
-               if ((error = (*sc->sc_enable)(sc)) != 0)
+               if ((error = (*sc->sc_enable)(sc->sc_dev, 1)) != 0)
                        goto out;
                sc->sc_enabled = 1;
        } else
@@ -878,7 +878,8 @@
                        error = wi_alloc_fid(sc, sc->sc_buflen,
                            &sc->sc_txd[i].d_fid);
                        if (error) {
-                               aprint_error_dev(&sc->sc_dev, "tx buffer allocation failed\n");
+                               aprint_error_dev(sc->sc_dev,
+                                   "tx buffer allocation failed\n");
                                goto out;
                        }
                        DPRINTF2(("wi_init: txbuf %d allocated %x\n", i,
@@ -930,7 +931,7 @@
 
  out:
        if (error) {
-               printf("%s: interface not running\n", device_xname(&sc->sc_dev));
+               printf("%s: interface not running\n", device_xname(sc->sc_dev));
                wi_stop(ifp, 0);
        }
        DPRINTF(("wi_init: return %d\n", error));
@@ -988,8 +989,7 @@
        ifp->if_timer = 0;
 
        if (disable) {
-               if (sc->sc_disable)
-                       (*sc->sc_disable)(sc);
+               (*sc->sc_enable)(sc->sc_dev, 0);
                sc->sc_enabled = 0;
        }
        splx(s);
@@ -1191,7 +1191,7 @@
                off = sizeof(frmhdr);
                if (wi_write_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr)) != 0 ||
                    wi_mwrite_bap(sc, fid, off, m0, m0->m_pkthdr.len) != 0) {
-                       aprint_error_dev(&sc->sc_dev, "%s write fid %x failed\n",
+                       aprint_error_dev(sc->sc_dev, "%s write fid %x failed\n",
                            __func__, fid);
                        ifp->if_oerrors++;
                        m_freem(m0);
@@ -1204,13 +1204,13 @@
 #ifdef DIAGNOSTIC
                        if (cur != sc->sc_txstart)
                                printf("%s: ring is desynchronized\n",
-                                   device_xname(&sc->sc_dev));
+                                   device_xname(sc->sc_dev));
 #endif
                        wi_push_packet(sc);
                } else {
 #ifdef WI_RING_DEBUG
        printf("%s: queue %04x, alloc %d queue %d start %d alloced %d queued %d started %d\n",
-           device_xname(&sc->sc_dev), fid,
+           device_xname(sc->sc_dev), fid,
            sc->sc_txalloc, sc->sc_txqueue, sc->sc_txstart,
            sc->sc_txalloced, sc->sc_txqueued, sc->sc_txstarted);
 #endif
@@ -1245,7 +1245,7 @@
                        break;
        }
        if (error) {
-               aprint_error_dev(&sc->sc_dev, "init failed\n");
+               aprint_error_dev(sc->sc_dev, "init failed\n");
                return error;
        }
        CSR_WRITE_2(sc, WI_INT_EN, 0);
@@ -1297,7 +1297,7 @@
        struct ifreq *ifr = (struct ifreq *)data;
        int s, error = 0;
 
-       if (!device_is_active(&sc->sc_dev))
+       if (!device_is_active(sc->sc_dev))
                return ENXIO;
 
        s = splnet();
@@ -1537,7 +1537,7 @@
 
        /* First read in the frame header */
        if (wi_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr))) {
-               aprint_error_dev(&sc->sc_dev, "%s read fid %x failed\n",
+               aprint_error_dev(sc->sc_dev, "%s read fid %x failed\n",
                    __func__, fid);
                ifp->if_ierrors++;
                return;
@@ -1655,7 +1655,7 @@
        fid = CSR_READ_2(sc, WI_TX_CMP_FID);
        /* Read in the frame header */
        if (wi_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr)) != 0) {
-               aprint_error_dev(&sc->sc_dev, "%s read fid %x failed\n",
+               aprint_error_dev(sc->sc_dev, "%s read fid %x failed\n",
                    __func__, fid);
                wi_rssdescs_reset(ic, &sc->sc_rssd, &sc->sc_rssdfree,
                    &sc->sc_txpending);
@@ -1663,8 +1663,8 @@
        }
 
        if (frmhdr.wi_tx_idx >= WI_NTXRSS) {
-               printf("%s: %s bad idx %02x\n",
-                   device_xname(&sc->sc_dev), __func__, frmhdr.wi_tx_idx);
+               aprint_error_dev(sc->sc_dev, "%s bad idx %02x\n",
+                   __func__, frmhdr.wi_tx_idx);
                wi_rssdescs_reset(ic, &sc->sc_rssd, &sc->sc_rssdfree,
                    &sc->sc_txpending);
                goto out;
@@ -1678,7 +1678,7 @@
         * as an output error.
         */
        if (ppsratecheck(&lasttxerror, &curtxeps, wi_txerate)) {
-               aprint_error_dev(&sc->sc_dev, "tx failed");
+               aprint_error_dev(sc->sc_dev, "tx failed");
                if (status & WI_TXSTAT_RET_ERR)
                        printf(", retry limit exceeded");
                if (status & WI_TXSTAT_AGED_ERR)
@@ -1703,13 +1703,13 @@
        id->id_node = NULL;
 
        if (ni == NULL) {
-               aprint_error_dev(&sc->sc_dev, "%s null node, rssdesc %02x\n",
+               aprint_error_dev(sc->sc_dev, "%s null node, rssdesc %02x\n",
                    __func__, frmhdr.wi_tx_idx);
                goto out;
        }
 
        if (sc->sc_txpending[id->id_rateidx]-- == 0) {
-               aprint_error_dev(&sc->sc_dev, "%s txpending[%i] wraparound",
+               aprint_error_dev(sc->sc_dev, "%s txpending[%i] wraparound",
                    __func__, id->id_rateidx);
                sc->sc_txpending[id->id_rateidx] = 0;
        }
@@ -1731,7 +1731,7 @@
 #ifdef DIAGNOSTIC
        if (sc->sc_txstarted == 0) {
                printf("%s: spurious alloc %x != %x, alloc %d queue %d start %d alloced %d queued %d started %d\n",
-                   device_xname(&sc->sc_dev), fid, sc->sc_txd[cur].d_fid, cur,
+                   device_xname(sc->sc_dev), fid, sc->sc_txd[cur].d_fid, cur,
                    sc->sc_txqueue, sc->sc_txstart, sc->sc_txalloced, sc->sc_txqueued, sc->sc_txstarted);
                return;
        }
@@ -1742,7 +1742,7 @@
        sc->sc_txalloc = (cur + 1) % WI_NTXBUF;
 #ifdef WI_RING_DEBUG
        printf("%s: alloc %04x, alloc %d queue %d start %d alloced %d queued %d started %d\n",
-           device_xname(&sc->sc_dev), fid,
+           device_xname(sc->sc_dev), fid,
            sc->sc_txalloc, sc->sc_txqueue, sc->sc_txstart,
            sc->sc_txalloced, sc->sc_txqueued, sc->sc_txstarted);
 #endif
@@ -1768,7 +1768,7 @@
                ifp->if_flags &= ~IFF_OACTIVE;
 #ifdef WI_RING_DEBUG
        printf("%s: cmd       , alloc %d queue %d start %d alloced %d queued %d started %d\n",
-           device_xname(&sc->sc_dev),
+           device_xname(sc->sc_dev),
            sc->sc_txalloc, sc->sc_txqueue, sc->sc_txstart,
            sc->sc_txalloced, sc->sc_txqueued, sc->sc_txstarted);
 #endif
@@ -1788,7 +1788,7 @@
        KASSERT(sc->sc_txcmds == 0);
 
        if (wi_cmd_start(sc, WI_CMD_TX | WI_RECLAIM, fid, 0, 0)) {
-               aprint_error_dev(&sc->sc_dev, "xmit failed\n");
+               aprint_error_dev(sc->sc_dev, "xmit failed\n");
                /* XXX ring might have a hole */
        }
 
@@ -1798,14 +1798,14 @@
        ++sc->sc_txstarted;
 #ifdef DIAGNOSTIC
        if (sc->sc_txstarted > WI_NTXBUF)
-               aprint_error_dev(&sc->sc_dev, "too many buffers started\n");
+               aprint_error_dev(sc->sc_dev, "too many buffers started\n");
 #endif
        sc->sc_txstart = (cur + 1) % WI_NTXBUF;
        sc->sc_tx_timer = 5;
        ifp->if_timer = 1;
 #ifdef WI_RING_DEBUG
        printf("%s: push  %04x, alloc %d queue %d start %d alloced %d queued %d started %d\n",
-           device_xname(&sc->sc_dev), fid,
+           device_xname(sc->sc_dev), fid,
            sc->sc_txalloc, sc->sc_txqueue, sc->sc_txstart,
            sc->sc_txalloced, sc->sc_txqueued, sc->sc_txstarted);
 #endif
@@ -1826,7 +1826,7 @@
        /* Read in the frame header */
        if (wi_read_bap(sc, fid, offsetof(struct wi_frame, wi_tx_swsup2),
                        &frmhdr.wi_tx_swsup2, 2) != 0) {
-               aprint_error_dev(&sc->sc_dev, "%s read fid %x failed\n",
+               aprint_error_dev(sc->sc_dev, "%s read fid %x failed\n",
                    __func__, fid);
                wi_rssdescs_reset(ic, &sc->sc_rssd, &sc->sc_rssdfree,
                    &sc->sc_txpending);
@@ -1834,7 +1834,7 @@
        }
 
        if (frmhdr.wi_tx_idx >= WI_NTXRSS) {
-               aprint_error_dev(&sc->sc_dev, "%s bad idx %02x\n",
+               aprint_error_dev(sc->sc_dev, "%s bad idx %02x\n",
                    __func__, frmhdr.wi_tx_idx);
                wi_rssdescs_reset(ic, &sc->sc_rssd, &sc->sc_rssdfree,
                    &sc->sc_txpending);
@@ -1849,13 +1849,13 @@
        id->id_node = NULL;
 
        if (ni == NULL) {
-               aprint_error_dev(&sc->sc_dev, "%s null node, rssdesc %02x\n",
+               aprint_error_dev(sc->sc_dev, "%s null node, rssdesc %02x\n",
                    __func__, frmhdr.wi_tx_idx);
                goto out;
        }
 
        if (sc->sc_txpending[id->id_rateidx]-- == 0) {
-               aprint_error_dev(&sc->sc_dev, "%s txpending[%i] wraparound",
+               aprint_error_dev(sc->sc_dev, "%s txpending[%i] wraparound",
                    __func__, id->id_rateidx);
                sc->sc_txpending[id->id_rateidx] = 0;
        }
@@ -1994,7 +1994,7 @@
        memset(ver, 0, sizeof(ver));
        len = sizeof(ver);
        wi_read_rid(sc, WI_RID_CARD_ID, ver, &len);
-       printf("%s: using ", device_xname(&sc->sc_dev));
+       printf("%s: using ", device_xname(sc->sc_dev));
 DPRINTF2(("wi_read_nicid: CARD_ID: %x %x %x %x\n", le16toh(ver[0]), le16toh(ver[1]), le16toh(ver[2]), le16toh(ver[3])));
 
        sc->sc_firmware_type = WI_NOTYPE;
@@ -2047,7 +2047,7 @@
                }
        }
 
-       printf("\n%s: %s Firmware: ", device_xname(&sc->sc_dev),
+       printf("\n%s: %s Firmware: ", device_xname(sc->sc_dev),



Home | Main Index | Thread Index | Old Index