Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314783
b: refs/heads/master
c: 2810a61
h: refs/heads/master
i:
  314781: 1d83cd0
  314779: e196e6a
  314775: 2c5c31d
  314767: d05736a
  314751: 93b430e
v: v3
  • Loading branch information
Seth Forshee authored and John W. Linville committed Jun 20, 2012
1 parent ef7b269 commit 90a0458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 134 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a3ce5cc1a60fd2e237599d4b9bc247422a7523c2
refs/heads/master: 2810a619ca5716e315090119e5695e97814b1e60
138 changes: 5 additions & 133 deletions trunk/drivers/net/wireless/brcm80211/brcmsmac/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,8 @@
LOCALE_CHAN_12_13 | \
LOCALE_CHAN_14)

#define LOCALE_RADAR_SET_NONE 0
#define LOCALE_RADAR_SET_1 1

#define LOCALE_RESTRICTED_NONE 0
#define LOCALE_RESTRICTED_SET_2G_SHORT 1
#define LOCALE_RESTRICTED_CHAN_165 2
#define LOCALE_CHAN_ALL_5G 3
#define LOCALE_RESTRICTED_JAPAN_LEGACY 4
#define LOCALE_RESTRICTED_11D_2G 5
#define LOCALE_RESTRICTED_11D_5G 6
#define LOCALE_RESTRICTED_LOW_HI 7
#define LOCALE_RESTRICTED_12_13_14 8

#define LOCALE_2G_IDX_i 0
#define LOCALE_5G_IDX_11 0
Expand Down Expand Up @@ -118,18 +108,13 @@
(((c) < 100) ? 2 : \
(((c) < 149) ? 3 : 4))))

#define ISDFS_EU(fl) (((fl) & BRCMS_DFS_EU) == BRCMS_DFS_EU)

struct brcms_cm_band {
/* struct locale_info flags */
u8 locale_flags;
/* List of valid channels in the country */
struct brcms_chanvec valid_channels;
/* List of restricted use channels */
const struct brcms_chanvec *restricted_channels;
/* List of radar sensitive channels */
const struct brcms_chanvec *radar_channels;
u8 PAD[8];
};

/* locale per-channel tx power limits for MIMO frames
Expand Down Expand Up @@ -158,7 +143,6 @@ struct brcms_cm_info {
char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */
uint srom_regrev; /* Regulatory Rev for the SROM ccode */
const struct country_info *country; /* current country def */
char ccode[BRCM_CNTRY_BUF_SZ]; /* current internal Country Code */
uint regrev; /* current Regulatory Revision */
char country_abbrev[BRCM_CNTRY_BUF_SZ]; /* current advertised ccode */
/* per-band state (one per phy/radio) */
Expand All @@ -171,14 +155,10 @@ struct brcms_cm_info {
/* locale channel and power info. */
struct locale_info {
u32 valid_channels;
/* List of radar sensitive channels */
u8 radar_channels;
/* List of channels used only if APs are detected */
u8 restricted_channels;
/* Max tx pwr in qdBm for each sub-band */
s8 maxpwr[BRCMS_MAXPWR_TBL_SIZE];
/* Country IE advertised max tx pwr in dBm per sub-band */
s8 pub_maxpwr[BAND_5G_PWR_LVLS];
u8 flags;
};

Expand All @@ -196,46 +176,10 @@ static const struct brcms_chanvec chanvec_none = {
0x00, 0x00, 0x00, 0x00}
};

/* All 2.4 GHz HW channels */
static const struct brcms_chanvec chanvec_all_2G = {
{0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}
};

/* All 5 GHz HW channels */
static const struct brcms_chanvec chanvec_all_5G = {
{0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x11, 0x11,
0x01, 0x00, 0x00, 0x00, 0x10, 0x11, 0x11, 0x11,
0x11, 0x11, 0x20, 0x22, 0x22, 0x00, 0x00, 0x11,
0x11, 0x11, 0x11, 0x01}
};

/*
* Radar channel sets
*/

/* Channels 52 - 64, 100 - 140 */
static const struct brcms_chanvec radar_set1 = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, /* 52 - 60 */
0x01, 0x00, 0x00, 0x00, 0x10, 0x11, 0x11, 0x11, /* 64, 100 - 124 */
0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 128 - 140 */
0x00, 0x00, 0x00, 0x00}
};

/*
* Restricted channel sets
*/

/* Channels 34, 38, 42, 46 */
static const struct brcms_chanvec restricted_set_japan_legacy = {
{0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}
};

/* Channels 12, 13 */
static const struct brcms_chanvec restricted_set_2g_short = {
{0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -244,47 +188,11 @@ static const struct brcms_chanvec restricted_set_2g_short = {
0x00, 0x00, 0x00, 0x00}
};

/* Channel 165 */
static const struct brcms_chanvec restricted_chan_165 = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}
};

/* Channels 36 - 48 & 149 - 165 */
static const struct brcms_chanvec restricted_low_hi = {
{0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x22, 0x22, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}
};

/* Channels 12 - 14 */
static const struct brcms_chanvec restricted_set_12_13_14 = {
{0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}
};

/* global memory to provide working buffer for expanded locale */

static const struct brcms_chanvec *g_table_radar_set[] = {
&chanvec_none,
&radar_set1
};

static const struct brcms_chanvec *g_table_restricted_chan[] = {
&chanvec_none, /* restricted_set_none */
&restricted_set_2g_short,
&restricted_chan_165,
&chanvec_all_5G,
&restricted_set_japan_legacy,
&chanvec_all_2G, /* restricted_set_11d_2G */
&chanvec_all_5G, /* restricted_set_11d_5G */
&restricted_low_hi,
&restricted_set_12_13_14
};

static const struct brcms_chanvec locale_2g_01_11 = {
Expand Down Expand Up @@ -445,11 +353,9 @@ static void brcms_c_locale_get_channels(const struct locale_info *locale,
*/
static const struct locale_info locale_i = { /* locale i. channel 1 - 13 */
LOCALE_CHAN_01_11 | LOCALE_CHAN_12_13,
LOCALE_RADAR_SET_NONE,
LOCALE_RESTRICTED_SET_2G_SHORT,
{QDB(19), QDB(19), QDB(19),
QDB(19), QDB(19), QDB(19)},
{20, 20, 20, 0},
BRCMS_EIRP
};

Expand All @@ -459,10 +365,8 @@ static const struct locale_info locale_i = { /* locale i. channel 1 - 13 */
static const struct locale_info locale_11 = {
/* locale 11. channel 36 - 48, 52 - 64, 100 - 140, 149 - 165 */
LOCALE_CHAN_36_64 | LOCALE_CHAN_100_140 | LOCALE_CHAN_149_165,
LOCALE_RADAR_SET_1,
LOCALE_RESTRICTED_NONE,
{QDB(21), QDB(21), QDB(21), QDB(21), QDB(21)},
{23, 23, 23, 30, 30},
BRCMS_EIRP | BRCMS_DFS_EU
};

Expand Down Expand Up @@ -544,13 +448,6 @@ static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx)
return g_mimo_5g_table[locale_idx];
}

static int
brcms_c_country_aggregate_map(struct brcms_cm_info *wlc_cm, const char *ccode,
char *mapped_ccode, uint *mapped_regrev)
{
return false;
}

/*
* Indicates whether the country provided is valid to pass
* to cfg80211 or not.
Expand Down Expand Up @@ -620,7 +517,6 @@ brcms_c_countrycode_map(struct brcms_cm_info *wlc_cm, const char *ccode,
const struct country_info *country;
uint srom_regrev = wlc_cm->srom_regrev;
const char *srom_ccode = wlc_cm->srom_ccode;
int mapped;

/* check for currently supported ccode size */
if (strlen(ccode) > (BRCM_CNTRY_BUF_SZ - 1)) {
Expand All @@ -639,12 +535,7 @@ brcms_c_countrycode_map(struct brcms_cm_info *wlc_cm, const char *ccode,
*/
if (!strcmp(srom_ccode, ccode)) {
*mapped_regrev = srom_regrev;
mapped = 0;
wiphy_err(wlc->wiphy, "srom_code == ccode %s\n", __func__);
} else {
mapped =
brcms_c_country_aggregate_map(wlc_cm, ccode, mapped_ccode,
mapped_regrev);
}

/* find the matching built-in country definition */
Expand Down Expand Up @@ -902,8 +793,6 @@ brcms_c_channels_init(struct brcms_cm_info *wlc_cm,

wlc_cm->bandstate[band->bandunit].restricted_channels =
g_table_restricted_chan[li->restricted_channels];
wlc_cm->bandstate[band->bandunit].radar_channels =
g_table_radar_set[li->radar_channels];

/*
* set the channel availability, masking out the channels
Expand Down Expand Up @@ -938,17 +827,11 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
{
const struct locale_info *locale;
struct brcms_c_info *wlc = wlc_cm->wlc;
char prev_country_abbrev[BRCM_CNTRY_BUF_SZ];

/* save current country state */
wlc_cm->country = country;

memset(&prev_country_abbrev, 0, BRCM_CNTRY_BUF_SZ);
strncpy(prev_country_abbrev, wlc_cm->country_abbrev,
BRCM_CNTRY_BUF_SZ - 1);

strncpy(wlc_cm->country_abbrev, country_abbrev, BRCM_CNTRY_BUF_SZ - 1);
strncpy(wlc_cm->ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
wlc_cm->regrev = regrev;

if ((wlc->pub->_n_enab & SUPPORT_11N) !=
Expand Down Expand Up @@ -1014,16 +897,12 @@ brcms_c_set_countrycode_rev(struct brcms_cm_info *wlc_cm,
static int
brcms_c_set_countrycode(struct brcms_cm_info *wlc_cm, const char *ccode)
{
char country_abbrev[BRCM_CNTRY_BUF_SZ];
strncpy(country_abbrev, ccode, BRCM_CNTRY_BUF_SZ);
return brcms_c_set_countrycode_rev(wlc_cm, country_abbrev, ccode, -1);
return brcms_c_set_countrycode_rev(wlc_cm, ccode, ccode, -1);
}

struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
{
struct brcms_cm_info *wlc_cm;
char country_abbrev[BRCM_CNTRY_BUF_SZ];
const struct country_info *country;
struct brcms_pub *pub = wlc->pub;
struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom;

Expand All @@ -1040,21 +919,14 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
if (sprom->alpha2 && brcms_c_country_valid(sprom->alpha2))
strncpy(wlc->pub->srom_ccode, sprom->alpha2, sizeof(sprom->alpha2));

/*
* internal country information which must match
* regulatory constraints in firmware
*/
memset(country_abbrev, 0, BRCM_CNTRY_BUF_SZ);
strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1);
country = brcms_c_country_lookup(wlc, country_abbrev);

/* save default country for exiting 11d regulatory mode */
strncpy(wlc->country_default, country_abbrev, BRCM_CNTRY_BUF_SZ - 1);
strncpy(wlc->country_default, "X2", BRCM_CNTRY_BUF_SZ - 1);

/* initialize autocountry_default to driver default */
strncpy(wlc->autocountry_default, "X2", BRCM_CNTRY_BUF_SZ - 1);
strncpy(wlc->autocountry_default, wlc->country_default,
BRCM_CNTRY_BUF_SZ - 1);

brcms_c_set_countrycode(wlc_cm, country_abbrev);
brcms_c_set_countrycode(wlc_cm, wlc->country_default);

return wlc_cm;
}
Expand Down

0 comments on commit 90a0458

Please sign in to comment.