staging: brcm80211: prepared header files for file rename
[deliverable/linux.git] / drivers / staging / brcm80211 / brcmsmac / wlc_main.c
index 18a54638ad3a54295aeed2f15a8dee6599b721af..7c86abc1e0470d51f532dbe183abe4e2ee6b967f 100644 (file)
 
 #include <bcmdefs.h>
 #include <bcmdevs.h>
-#include <bcmutils.h>
-#include <bcmwifi.h>
-#include <bcmnvram.h>
+#include <brcmu_utils.h>
+#include <brcmu_wifi.h>
 #include <aiutils.h>
 #include <bcmsrom.h>
-#include <sbdma.h>
+#include "bcmdma.h"
 #include <bcmdma.h>
 
 #include "wlc_pmu.h"
 #include "wlc_antsel.h"
 #include "wlc_stf.h"
 #include "wlc_ampdu.h"
-#include "wl_export.h"
 #include "wlc_alloc.h"
-#include "wl_dbg.h"
-#include "wl_mac80211.h"
+#include "brcms_mac80211.h"
 
 /*
  * WPA(2) definitions
                                (!AP_ENAB(wlc->pub)) && (wlc->war16165))
 
 /* debug/trace */
-uint wl_msg_level =
+uint brcm_msg_level =
 #if defined(BCMDBG)
-    WL_ERROR_VAL;
+       LOG_ERROR_VAL;
 #else
-    0;
+       0;
 #endif                         /* BCMDBG */
 
 /* Find basic rate for a given rate */
@@ -415,7 +412,7 @@ void wlc_fatal_error(struct wlc_info *wlc)
 {
        wiphy_err(wlc->wiphy, "wl%d: fatal error, reinitializing\n",
                  wlc->pub->unit);
-       wl_init(wlc->wl);
+       brcms_init(wlc->wl);
 }
 
 /* Return the channel the driver should initialize during wlc_init.
@@ -706,8 +703,8 @@ static u8 wlc_local_constraint_qdbm(struct wlc_info *wlc)
 
        local = WLC_TXPWR_MAX;
        if (wlc->pub->associated &&
-           (bcm_chspec_ctlchan(wlc->chanspec) ==
-            bcm_chspec_ctlchan(wlc->home_chanspec))) {
+           (brcmu_chspec_ctlchan(wlc->chanspec) ==
+            brcmu_chspec_ctlchan(wlc->home_chanspec))) {
 
                /* get the local power constraint if we are on the AP's
                 * channel [802.11h, 7.3.2.13]
@@ -1188,7 +1185,7 @@ void wlc_edcf_setparams(struct wlc_info *wlc, bool suspend)
 
 bool wlc_timers_init(struct wlc_info *wlc, int unit)
 {
-       wlc->wdtimer = wl_init_timer(wlc->wl, wlc_watchdog_by_timer,
+       wlc->wdtimer = brcms_init_timer(wlc->wl, wlc_watchdog_by_timer,
                wlc, "watchdog");
        if (!wlc->wdtimer) {
                wiphy_err(wlc->wiphy, "wl%d:  wl_init_timer for wdtimer "
@@ -1196,7 +1193,7 @@ bool wlc_timers_init(struct wlc_info *wlc, int unit)
                goto fail;
        }
 
-       wlc->radio_timer = wl_init_timer(wlc->wl, wlc_radio_timer,
+       wlc->radio_timer = brcms_init_timer(wlc->wl, wlc_radio_timer,
                wlc, "radio");
        if (!wlc->radio_timer) {
                wiphy_err(wlc->wiphy, "wl%d:  wl_init_timer for radio_timer "
@@ -1339,7 +1336,7 @@ struct wlc_pub *wlc_pub(void *wlc)
 /*
  * The common driver entry routine. Error codes should be unique
  */
-void *wlc_attach(struct wl_info *wl, u16 vendor, u16 device, uint unit,
+void *wlc_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
                 bool piomode, void *regsva, uint bustype, void *btparam,
                 uint *perr)
 {
@@ -1669,11 +1666,11 @@ static void wlc_timers_deinit(struct wlc_info *wlc)
 {
        /* free timer state */
        if (wlc->wdtimer) {
-               wl_free_timer(wlc->wl, wlc->wdtimer);
+               brcms_free_timer(wlc->wl, wlc->wdtimer);
                wlc->wdtimer = NULL;
        }
        if (wlc->radio_timer) {
-               wl_free_timer(wlc->wl, wlc->radio_timer);
+               brcms_free_timer(wlc->wl, wlc->radio_timer);
                wlc->radio_timer = NULL;
        }
 }
@@ -1859,7 +1856,7 @@ void wlc_radio_disable(struct wlc_info *wlc)
        }
 
        wlc_radio_monitor_start(wlc);
-       wl_down(wlc->wl);
+       brcms_down(wlc->wl);
 }
 
 static void wlc_radio_enable(struct wlc_info *wlc)
@@ -1870,7 +1867,7 @@ static void wlc_radio_enable(struct wlc_info *wlc)
        if (DEVICEREMOVED(wlc))
                return;
 
-       wl_up(wlc->wl);
+       brcms_up(wlc->wl);
 }
 
 /* periodical query hw radio button while driver is "down" */
@@ -1881,7 +1878,7 @@ static void wlc_radio_timer(void *arg)
        if (DEVICEREMOVED(wlc)) {
                wiphy_err(wlc->wiphy, "wl%d: %s: dead chip\n", wlc->pub->unit,
                        __func__);
-               wl_down(wlc->wl);
+               brcms_down(wlc->wl);
                return;
        }
 
@@ -1901,7 +1898,8 @@ static bool wlc_radio_monitor_start(struct wlc_info *wlc)
 
        wlc->radio_monitor = true;
        wlc_pllreq(wlc, true, WLC_PLLREQ_RADIO_MON);
-       wl_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK, true);
+       brcms_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK,
+                       true);
        return true;
 }
 
@@ -1912,7 +1910,7 @@ bool wlc_radio_monitor_stop(struct wlc_info *wlc)
 
        wlc->radio_monitor = false;
        wlc_pllreq(wlc, false, WLC_PLLREQ_RADIO_MON);
-       return wl_del_timer(wlc->wl, wlc->radio_timer);
+       return brcms_del_timer(wlc->wl, wlc->radio_timer);
 }
 
 static void wlc_watchdog_by_timer(void *arg)
@@ -1935,7 +1933,7 @@ static void wlc_watchdog(void *arg)
        if (DEVICEREMOVED(wlc)) {
                wiphy_err(wlc->wiphy, "wl%d: %s: dead chip\n", wlc->pub->unit,
                          __func__);
-               wl_down(wlc->wl);
+               brcms_down(wlc->wl);
                return;
        }
 
@@ -2070,7 +2068,7 @@ int wlc_up(struct wlc_info *wlc)
                wlc_mhf(wlc, MHF2, MHF2_PCISLOWCLKWAR, MHF2_PCISLOWCLKWAR,
                        WLC_BAND_ALL);
 
-       wl_init(wlc->wl);
+       brcms_init(wlc->wl);
        wlc->pub->up = true;
 
        if (wlc->bandinit_pending) {
@@ -2090,7 +2088,7 @@ int wlc_up(struct wlc_info *wlc)
        wlc_wme_retries_write(wlc);
 
        /* start one second watchdog timer */
-       wl_add_timer(wlc->wl, wlc->wdtimer, TIMER_INTERVAL_WATCHDOG, true);
+       brcms_add_timer(wlc->wl, wlc->wdtimer, TIMER_INTERVAL_WATCHDOG, true);
        wlc->WDarmed = true;
 
        /* ensure antenna config is up to date */
@@ -2168,7 +2166,7 @@ uint wlc_down(struct wlc_info *wlc)
 
        /* cancel the watchdog timer */
        if (wlc->WDarmed) {
-               if (!wl_del_timer(wlc->wl, wlc->wdtimer))
+               if (!brcms_del_timer(wlc->wl, wlc->wdtimer))
                        callbacks++;
                wlc->WDarmed = false;
        }
@@ -2184,7 +2182,7 @@ uint wlc_down(struct wlc_info *wlc)
 
        /* flush tx queues */
        for (qi = wlc->tx_queues; qi != NULL; qi = qi->next) {
-               bcm_pktq_flush(&qi->q, true, NULL, NULL);
+               brcmu_pktq_flush(&qi->q, true, NULL, NULL);
        }
 
        callbacks += wlc_bmac_down_finish(wlc->hw);
@@ -2528,7 +2526,7 @@ _wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len,
        if (!wlc->pub->hw_off && DEVICEREMOVED(wlc)) {
                wiphy_err(wlc->wiphy, "wl%d: %s: dead chip\n", wlc->pub->unit,
                          __func__);
-               wl_down(wlc->wl);
+               brcms_down(wlc->wl);
                return -EBADE;
        }
 
@@ -2986,16 +2984,16 @@ void wlc_print_txdesc(d11txh_t *txh)
        printk(KERN_DEBUG "XtraFrameTypes: %04x ", xtraft);
        printk(KERN_DEBUG "\n");
 
-       bcm_format_hex(hexbuf, iv, sizeof(txh->IV));
+       brcmu_format_hex(hexbuf, iv, sizeof(txh->IV));
        printk(KERN_DEBUG "SecIV:       %s\n", hexbuf);
-       bcm_format_hex(hexbuf, ra, sizeof(txh->TxFrameRA));
+       brcmu_format_hex(hexbuf, ra, sizeof(txh->TxFrameRA));
        printk(KERN_DEBUG "RA:          %s\n", hexbuf);
 
        printk(KERN_DEBUG "Fb FES Time: %04x ", tfestfb);
-       bcm_format_hex(hexbuf, rtspfb, sizeof(txh->RTSPLCPFallback));
+       brcmu_format_hex(hexbuf, rtspfb, sizeof(txh->RTSPLCPFallback));
        printk(KERN_DEBUG "RTS PLCP: %s ", hexbuf);
        printk(KERN_DEBUG "RTS DUR: %04x ", rtsdfb);
-       bcm_format_hex(hexbuf, fragpfb, sizeof(txh->FragPLCPFallback));
+       brcmu_format_hex(hexbuf, fragpfb, sizeof(txh->FragPLCPFallback));
        printk(KERN_DEBUG "PLCP: %s ", hexbuf);
        printk(KERN_DEBUG "DUR: %04x", fragdfb);
        printk(KERN_DEBUG "\n");
@@ -3011,9 +3009,9 @@ void wlc_print_txdesc(d11txh_t *txh)
        printk(KERN_DEBUG "MaxAggbyte_fb:  %04x\n", mabyte_f);
        printk(KERN_DEBUG "MinByte:     %04x\n", mmbyte);
 
-       bcm_format_hex(hexbuf, rtsph, sizeof(txh->RTSPhyHeader));
+       brcmu_format_hex(hexbuf, rtsph, sizeof(txh->RTSPhyHeader));
        printk(KERN_DEBUG "RTS PLCP: %s ", hexbuf);
-       bcm_format_hex(hexbuf, (u8 *) &rts, sizeof(txh->rts_frame));
+       brcmu_format_hex(hexbuf, (u8 *) &rts, sizeof(txh->rts_frame));
        printk(KERN_DEBUG "RTS Frame: %s", hexbuf);
        printk(KERN_DEBUG "\n");
 }
@@ -3031,7 +3029,7 @@ void wlc_print_rxh(d11rxhdr_t *rxh)
        u16 macstatus2 = rxh->RxStatus2;
        char flagstr[64];
        char lenbuf[20];
-       static const bcm_bit_desc_t macstat_flags[] = {
+       static const struct brcmu_bit_desc macstat_flags[] = {
                {RXS_FCSERR, "FCSErr"},
                {RXS_RESPFRAMETX, "Reply"},
                {RXS_PBPRES, "PADDING"},
@@ -3044,7 +3042,7 @@ void wlc_print_rxh(d11rxhdr_t *rxh)
        printk(KERN_DEBUG "Raw RxDesc:\n");
        print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, rxh, sizeof(d11rxhdr_t));
 
-       bcm_format_flags(macstat_flags, macstatus1, flagstr, 64);
+       brcmu_format_flags(macstat_flags, macstatus1, flagstr, 64);
 
        snprintf(lenbuf, sizeof(lenbuf), "0x%x", len);
 
@@ -3092,7 +3090,7 @@ wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt,
        if (pktq_pfull(q, prec))
                eprec = prec;
        else if (pktq_full(q)) {
-               p = bcm_pktq_peek_tail(q, &eprec);
+               p = brcmu_pktq_peek_tail(q, &eprec);
                if (eprec > prec) {
                        wiphy_err(wlc->wiphy, "%s: Failing: eprec %d > prec %d"
                                  "\n", __func__, eprec, prec);
@@ -3114,16 +3112,16 @@ wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt,
                }
 
                /* Evict packet according to discard policy */
-               p = discard_oldest ? bcm_pktq_pdeq(q, eprec) :
-                       bcm_pktq_pdeq_tail(q, eprec);
-               bcm_pkt_buf_free_skb(p);
+               p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
+                       brcmu_pktq_pdeq_tail(q, eprec);
+               brcmu_pkt_buf_free_skb(p);
        }
 
        /* Enqueue */
        if (head)
-               p = bcm_pktq_penq_head(q, prec, pkt);
+               p = brcmu_pktq_penq_head(q, prec, pkt);
        else
-               p = bcm_pktq_penq(q, prec, pkt);
+               p = brcmu_pktq_penq(q, prec, pkt);
 
        return true;
 }
@@ -3148,7 +3146,7 @@ void wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
                 * XXX we might hit this condtion in case
                 * packet flooding from mac80211 stack
                 */
-               bcm_pkt_buf_free_skb(sdu);
+               brcmu_pkt_buf_free_skb(sdu);
        }
 
        /* Check if flow control needs to be turned on after enqueuing the packet
@@ -3212,7 +3210,7 @@ void wlc_send_q(struct wlc_info *wlc)
        /* Send all the enq'd pkts that we can.
         * Dequeue packets with precedence with empty HW fifo only
         */
-       while (prec_map && (pkt[0] = bcm_pktq_mdeq(q, prec_map, &prec))) {
+       while (prec_map && (pkt[0] = brcmu_pktq_mdeq(q, prec_map, &prec))) {
                tx_info = IEEE80211_SKB_CB(pkt[0]);
                if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
                        err = wlc_sendampdu(wlc->ampdu, qi, pkt, prec);
@@ -3227,7 +3225,7 @@ void wlc_send_q(struct wlc_info *wlc)
                }
 
                if (err == -EBUSY) {
-                       bcm_pktq_penq_head(q, prec, pkt[0]);
+                       brcmu_pktq_penq_head(q, prec, pkt[0]);
                        /* If send failed due to any other reason than a change in
                         * HW FIFO condition, quit. Otherwise, read the new prec_map!
                         */
@@ -3650,7 +3648,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
        qos = ieee80211_is_data_qos(h->frame_control);
 
        /* compute length of frame in bytes for use in PLCP computations */
-       len = bcm_pkttotlen(p);
+       len = brcmu_pkttotlen(p);
        phylen = len + FCS_LEN;
 
        /* If WEP enabled, add room in phylen for the additional bytes of
@@ -4382,7 +4380,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
                        tx_info->flags |= IEEE80211_TX_STAT_ACK;
        }
 
-       totlen = bcm_pkttotlen(p);
+       totlen = brcmu_pkttotlen(p);
        free_pdu = true;
 
        wlc_txfifo_complete(wlc, queue, 1);
@@ -4403,7 +4401,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
 
  fatal:
        if (p)
-               bcm_pkt_buf_free_skb(p);
+               brcmu_pkt_buf_free_skb(p);
 
        return true;
 
@@ -4701,7 +4699,7 @@ void wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
        return;
 
  toss:
-       bcm_pkt_buf_free_skb(p);
+       brcmu_pkt_buf_free_skb(p);
 }
 
 /* calculate frame duration for Mixed-mode L-SIG spoofing, return
@@ -5817,7 +5815,7 @@ wlc_txflowcontrol_signal(struct wlc_info *wlc, struct wlc_txq_info *qi, bool on,
 
        for (wlcif = wlc->wlcif_list; wlcif != NULL; wlcif = wlcif->next) {
                if (wlcif->qi == qi && wlcif->flags & WLC_IF_LINKED)
-                       wl_txflowcontrol(wlc->wl, wlcif->wlif, on, prio);
+                       brcms_txflowcontrol(wlc->wl, wlcif->wlif, on, prio);
        }
 #endif
 }
@@ -5834,7 +5832,7 @@ static struct wlc_txq_info *wlc_txq_alloc(struct wlc_info *wlc)
                 * leave PS mode. The watermark for flowcontrol to OS packets
                 * will remain the same
                 */
-               bcm_pktq_init(&qi->q, WLC_PREC_COUNT,
+               brcmu_pktq_init(&qi->q, WLC_PREC_COUNT,
                          (2 * wlc->pub->tunables->datahiwat) + PKTQ_LEN_DEFAULT
                          + wlc->pub->psq_pkts_total);
 
@@ -5918,12 +5916,12 @@ void wlc_wait_for_tx_completion(struct wlc_info *wlc, bool drop)
 {
        /* flush packet queue when requested */
        if (drop)
-               bcm_pktq_flush(&wlc->pkt_queue->q, false, NULL, NULL);
+               brcmu_pktq_flush(&wlc->pkt_queue->q, false, NULL, NULL);
 
        /* wait for queue and DMA fifos to run dry */
        while (!pktq_empty(&wlc->pkt_queue->q) ||
               TXPKTPENDTOT(wlc) > 0) {
-               wl_msleep(wlc->wl, 1);
+               brcms_msleep(wlc->wl, 1);
        }
 }
 
@@ -5994,3 +5992,46 @@ int wlc_get_par(struct wlc_info *wlc, enum wlc_par_id par_id, int *ret_int_ptr)
        }
        return err;
 }
+
+/*
+ * Search the name=value vars for a specific one and return its value.
+ * Returns NULL if not found.
+ */
+char *getvar(char *vars, const char *name)
+{
+       char *s;
+       int len;
+
+       if (!name)
+               return NULL;
+
+       len = strlen(name);
+       if (len == 0)
+               return NULL;
+
+       /* first look in vars[] */
+       for (s = vars; s && *s;) {
+               if ((memcmp(s, name, len) == 0) && (s[len] == '='))
+                       return &s[len + 1];
+
+               while (*s++)
+                       ;
+       }
+       /* nothing found */
+       return NULL;
+}
+
+/*
+ * Search the vars for a specific one and return its value as
+ * an integer. Returns 0 if not found.
+ */
+int getintvar(char *vars, const char *name)
+{
+       char *val;
+
+       val = getvar(vars, name);
+       if (val == NULL)
+               return 0;
+
+       return simple_strtoul(val, NULL, 0);
+}
This page took 0.069483 seconds and 5 git commands to generate.