diff options
Diffstat (limited to 'drivers/staging/brcm80211/sys/wlc_channel.c')
-rw-r--r-- | drivers/staging/brcm80211/sys/wlc_channel.c | 102 |
1 files changed, 56 insertions, 46 deletions
diff --git a/drivers/staging/brcm80211/sys/wlc_channel.c b/drivers/staging/brcm80211/sys/wlc_channel.c index 509280337e34..a35c15214880 100644 --- a/drivers/staging/brcm80211/sys/wlc_channel.c +++ b/drivers/staging/brcm80211/sys/wlc_channel.c @@ -19,16 +19,21 @@ #include <bcmdefs.h> #include <wlc_cfg.h> #include <osl.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> #include <bcmutils.h> #include <siutils.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <wlioctl.h> #include <wlc_pub.h> #include <wlc_key.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_bmac.h> #include <wlc_stf.h> #include <wlc_channel.h> +#include <wl_dbg.h> typedef struct wlc_cm_band { u8 locale_flags; /* locale_info_t flags */ @@ -39,8 +44,8 @@ typedef struct wlc_cm_band { } wlc_cm_band_t; struct wlc_cm_info { - wlc_pub_t *pub; - wlc_info_t *wlc; + struct wlc_pub *pub; + struct wlc_info *wlc; char srom_ccode[WLC_CNTRY_BUF_SZ]; /* Country Code in SROM */ uint srom_regrev; /* Regulatory Rev for the SROM ccode */ const country_info_t *country; /* current country def */ @@ -377,7 +382,7 @@ void wlc_locale_get_channels(const locale_info_t *locale, chanvec_t *channels) { u8 i; - bzero(channels, sizeof(chanvec_t)); + memset(channels, 0, sizeof(chanvec_t)); for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) { if (locale->valid_channels & (1 << i)) { @@ -562,8 +567,8 @@ struct chan20_info chan20_info[] = { const locale_info_t *wlc_get_locale_2g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) { - WL_ERROR(("%s: locale 2g index size out of range %d\n", - __func__, locale_idx)); + WL_ERROR("%s: locale 2g index size out of range %d\n", + __func__, locale_idx); ASSERT(locale_idx < ARRAY_SIZE(g_locale_2g_table)); return NULL; } @@ -573,8 +578,8 @@ const locale_info_t *wlc_get_locale_2g(u8 locale_idx) const locale_info_t *wlc_get_locale_5g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) { - WL_ERROR(("%s: locale 5g index size out of range %d\n", - __func__, locale_idx)); + WL_ERROR("%s: locale 5g index size out of range %d\n", + __func__, locale_idx); ASSERT(locale_idx < ARRAY_SIZE(g_locale_5g_table)); return NULL; } @@ -584,8 +589,8 @@ const locale_info_t *wlc_get_locale_5g(u8 locale_idx) const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) { - WL_ERROR(("%s: mimo 2g index size out of range %d\n", __func__, - locale_idx)); + WL_ERROR("%s: mimo 2g index size out of range %d\n", + __func__, locale_idx); return NULL; } return g_mimo_2g_table[locale_idx]; @@ -594,26 +599,26 @@ const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) { - WL_ERROR(("%s: mimo 5g index size out of range %d\n", __func__, - locale_idx)); + WL_ERROR("%s: mimo 5g index size out of range %d\n", + __func__, locale_idx); return NULL; } return g_mimo_5g_table[locale_idx]; } -wlc_cm_info_t *wlc_channel_mgr_attach(wlc_info_t *wlc) +wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc) { wlc_cm_info_t *wlc_cm; char country_abbrev[WLC_CNTRY_BUF_SZ]; const country_info_t *country; - wlc_pub_t *pub = wlc->pub; + struct wlc_pub *pub = wlc->pub; char *ccode; - WL_TRACE(("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit); wlc_cm = kzalloc(sizeof(wlc_cm_info_t), GFP_ATOMIC); if (wlc_cm == NULL) { - WL_ERROR(("wl%d: %s: out of memory", pub->unit, __func__)); + WL_ERROR("wl%d: %s: out of memory", pub->unit, __func__); return NULL; } wlc_cm->pub = pub; @@ -624,12 +629,13 @@ wlc_cm_info_t *wlc_channel_mgr_attach(wlc_info_t *wlc) ccode = getvar(wlc->pub->vars, "ccode"); if (ccode) { strncpy(wlc->pub->srom_ccode, ccode, WLC_CNTRY_BUF_SZ - 1); - WL_NONE(("%s: SROM country code is %c%c\n", __func__, - wlc->pub->srom_ccode[0], wlc->pub->srom_ccode[1])); + WL_NONE("%s: SROM country code is %c%c\n", + __func__, + wlc->pub->srom_ccode[0], wlc->pub->srom_ccode[1]); } /* internal country information which must match regulatory constraints in firmware */ - bzero(country_abbrev, WLC_CNTRY_BUF_SZ); + memset(country_abbrev, 0, WLC_CNTRY_BUF_SZ); strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1); country = wlc_country_lookup(wlc, country_abbrev); @@ -659,7 +665,7 @@ const char *wlc_channel_country_abbrev(wlc_cm_info_t *wlc_cm) u8 wlc_channel_locale_flags(wlc_cm_info_t *wlc_cm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return wlc_cm->bandstate[wlc->band->bandunit].locale_flags; } @@ -711,7 +717,9 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, char mapped_ccode[WLC_CNTRY_BUF_SZ]; uint mapped_regrev; - WL_NONE(("%s: (country_abbrev \"%s\", ccode \"%s\", regrev %d) SPROM \"%s\"/%u\n", __func__, country_abbrev, ccode, regrev, wlc_cm->srom_ccode, wlc_cm->srom_regrev)); + WL_NONE("%s: (country_abbrev \"%s\", ccode \"%s\", regrev %d) SPROM \"%s\"/%u\n", + __func__, country_abbrev, ccode, regrev, + wlc_cm->srom_ccode, wlc_cm->srom_regrev); /* if regrev is -1, lookup the mapped country code, * otherwise use the ccode and regrev directly @@ -750,7 +758,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, { const locale_mimo_info_t *li_mimo; const locale_info_t *locale; - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; char prev_country_abbrev[WLC_CNTRY_BUF_SZ]; ASSERT(country != NULL); @@ -758,7 +766,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, /* save current country state */ wlc_cm->country = country; - bzero(&prev_country_abbrev, WLC_CNTRY_BUF_SZ); + memset(&prev_country_abbrev, 0, WLC_CNTRY_BUF_SZ); strncpy(prev_country_abbrev, wlc_cm->country_abbrev, WLC_CNTRY_BUF_SZ - 1); @@ -814,7 +822,7 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, char *mapped_ccode, uint *mapped_regrev) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; const country_info_t *country; uint srom_regrev = wlc_cm->srom_regrev; const char *srom_ccode = wlc_cm->srom_ccode; @@ -822,8 +830,8 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, /* check for currently supported ccode size */ if (strlen(ccode) > (WLC_CNTRY_BUF_SZ - 1)) { - WL_ERROR(("wl%d: %s: ccode \"%s\" too long for match\n", - wlc->pub->unit, __func__, ccode)); + WL_ERROR("wl%d: %s: ccode \"%s\" too long for match\n", + wlc->pub->unit, __func__, ccode); return NULL; } @@ -838,7 +846,7 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, if (!strcmp(srom_ccode, ccode)) { *mapped_regrev = srom_regrev; mapped = 0; - WL_ERROR(("srom_code == ccode %s\n", __func__)); + WL_ERROR("srom_code == ccode %s\n", __func__); ASSERT(0); } else { mapped = @@ -890,7 +898,7 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode, } } - WL_ERROR(("%s: Returning NULL\n", __func__)); + WL_ERROR("%s: Returning NULL\n", __func__); ASSERT(0); return NULL; } @@ -898,9 +906,9 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode, static int wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint i, j; - wlcband_t *band; + struct wlcband *band; const locale_info_t *li; chanvec_t sup_chan; const locale_mimo_info_t *li_mimo; @@ -952,7 +960,7 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) */ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint chan; struct txpwr_limits txpwr; @@ -969,7 +977,9 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) if (chan == INVCHANNEL) { /* country/locale with no valid channels, set the radio disable bit */ mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); - WL_ERROR(("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n", wlc->pub->unit, __func__, wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked)); + WL_ERROR("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n", + wlc->pub->unit, __func__, + wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked); } else if (mboolisset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE)) { @@ -998,12 +1008,12 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) /* reset the quiet channels vector to the union of the restricted and radar channel sets */ void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint i, j; - wlcband_t *band; + struct wlcband *band; const chanvec_t *chanvec; - bzero(&wlc_cm->quiet_channels, sizeof(chanvec_t)); + memset(&wlc_cm->quiet_channels, 0, sizeof(chanvec_t)); band = wlc->band; for (i = 0; i < NBANDS(wlc); @@ -1036,7 +1046,7 @@ bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec) */ bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return VALID_CHANNEL20(wlc, val) || (!wlc->bandlocked @@ -1054,7 +1064,7 @@ wlc_valid_channel20_in_band(wlc_cm_info_t *wlc_cm, uint bandunit, uint val) /* Is the channel valid for the current locale and current band? */ bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return ((val < MAXCHANNEL) && isset(wlc_cm->bandstate[wlc->band->bandunit].valid_channels.vec, @@ -1064,7 +1074,7 @@ bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val) /* Is the 40 MHz allowed for the current locale and specified band? */ bool wlc_valid_40chanspec_in_band(wlc_cm_info_t *wlc_cm, uint bandunit) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return (((wlc_cm->bandstate[bandunit]. locale_flags & (WLC_NO_MIMO | WLC_NO_40MHZ)) == 0) @@ -1162,7 +1172,7 @@ void wlc_channel_set_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, u8 local_constraint_qdbm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; struct txpwr_limits txpwr; wlc_channel_reg_limits(wlc_cm, chanspec, &txpwr); @@ -1179,7 +1189,7 @@ int wlc_channel_set_txpower_limit(wlc_cm_info_t *wlc_cm, u8 local_constraint_qdbm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; struct txpwr_limits txpwr; wlc_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); @@ -1299,13 +1309,13 @@ void wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, txpwr_limits_t *txpwr) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint i; uint chan; int maxpwr; int delta; const country_info_t *country; - wlcband_t *band; + struct wlcband *band; const locale_info_t *li; int conducted_max; int conducted_ofdm_max; @@ -1314,7 +1324,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, int maxpwr_idx; uint j; - bzero(txpwr, sizeof(txpwr_limits_t)); + memset(txpwr, 0, sizeof(txpwr_limits_t)); if (!wlc_valid_chanspec_db(wlc_cm, chanspec)) { country = wlc_country_lookup(wlc, wlc->autocountry_default); @@ -1528,13 +1538,13 @@ static bool wlc_japan_ccode(const char *ccode) static bool wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; u8 channel = CHSPEC_CHANNEL(chspec); /* check the chanspec */ if (wf_chspec_malformed(chspec)) { - WL_ERROR(("wl%d: malformed chanspec 0x%x\n", wlc->pub->unit, - chspec)); + WL_ERROR("wl%d: malformed chanspec 0x%x\n", + wlc->pub->unit, chspec); ASSERT(0); return false; } |