Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010 Broadcom Corporation |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _BRCM_PUB_H_ |
| 18 | #define _BRCM_PUB_H_ |
| 19 | |
| 20 | #include <brcmu_wifi.h> |
| 21 | #include "types.h" |
| 22 | #include "defs.h" |
| 23 | |
| 24 | enum brcms_srom_id { |
| 25 | BRCMS_SROM_NULL, |
| 26 | BRCMS_SROM_CONT, |
| 27 | BRCMS_SROM_AA2G, |
| 28 | BRCMS_SROM_AA5G, |
| 29 | BRCMS_SROM_AG0, |
| 30 | BRCMS_SROM_AG1, |
| 31 | BRCMS_SROM_AG2, |
| 32 | BRCMS_SROM_AG3, |
| 33 | BRCMS_SROM_ANTSWCTL2G, |
| 34 | BRCMS_SROM_ANTSWCTL5G, |
| 35 | BRCMS_SROM_ANTSWITCH, |
| 36 | BRCMS_SROM_BOARDFLAGS2, |
| 37 | BRCMS_SROM_BOARDFLAGS, |
| 38 | BRCMS_SROM_BOARDNUM, |
| 39 | BRCMS_SROM_BOARDREV, |
| 40 | BRCMS_SROM_BOARDTYPE, |
| 41 | BRCMS_SROM_BW40PO, |
| 42 | BRCMS_SROM_BWDUPPO, |
| 43 | BRCMS_SROM_BXA2G, |
| 44 | BRCMS_SROM_BXA5G, |
| 45 | BRCMS_SROM_CC, |
| 46 | BRCMS_SROM_CCK2GPO, |
| 47 | BRCMS_SROM_CCKBW202GPO, |
| 48 | BRCMS_SROM_CCKBW20UL2GPO, |
| 49 | BRCMS_SROM_CCODE, |
| 50 | BRCMS_SROM_CDDPO, |
| 51 | BRCMS_SROM_DEVID, |
| 52 | BRCMS_SROM_ET1MACADDR, |
| 53 | BRCMS_SROM_EXTPAGAIN2G, |
| 54 | BRCMS_SROM_EXTPAGAIN5G, |
| 55 | BRCMS_SROM_FREQOFFSET_CORR, |
| 56 | BRCMS_SROM_HW_IQCAL_EN, |
| 57 | BRCMS_SROM_IL0MACADDR, |
| 58 | BRCMS_SROM_IQCAL_SWP_DIS, |
| 59 | BRCMS_SROM_LEDBH0, |
| 60 | BRCMS_SROM_LEDBH1, |
| 61 | BRCMS_SROM_LEDBH2, |
| 62 | BRCMS_SROM_LEDBH3, |
| 63 | BRCMS_SROM_LEDDC, |
| 64 | BRCMS_SROM_LEGOFDM40DUPPO, |
| 65 | BRCMS_SROM_LEGOFDMBW202GPO, |
| 66 | BRCMS_SROM_LEGOFDMBW205GHPO, |
| 67 | BRCMS_SROM_LEGOFDMBW205GLPO, |
| 68 | BRCMS_SROM_LEGOFDMBW205GMPO, |
| 69 | BRCMS_SROM_LEGOFDMBW20UL2GPO, |
| 70 | BRCMS_SROM_LEGOFDMBW20UL5GHPO, |
| 71 | BRCMS_SROM_LEGOFDMBW20UL5GLPO, |
| 72 | BRCMS_SROM_LEGOFDMBW20UL5GMPO, |
| 73 | BRCMS_SROM_MACADDR, |
| 74 | BRCMS_SROM_MCS2GPO0, |
| 75 | BRCMS_SROM_MCS2GPO1, |
| 76 | BRCMS_SROM_MCS2GPO2, |
| 77 | BRCMS_SROM_MCS2GPO3, |
| 78 | BRCMS_SROM_MCS2GPO4, |
| 79 | BRCMS_SROM_MCS2GPO5, |
| 80 | BRCMS_SROM_MCS2GPO6, |
| 81 | BRCMS_SROM_MCS2GPO7, |
| 82 | BRCMS_SROM_MCS32PO, |
| 83 | BRCMS_SROM_MCS5GHPO0, |
| 84 | BRCMS_SROM_MCS5GHPO1, |
| 85 | BRCMS_SROM_MCS5GHPO2, |
| 86 | BRCMS_SROM_MCS5GHPO3, |
| 87 | BRCMS_SROM_MCS5GHPO4, |
| 88 | BRCMS_SROM_MCS5GHPO5, |
| 89 | BRCMS_SROM_MCS5GHPO6, |
| 90 | BRCMS_SROM_MCS5GHPO7, |
| 91 | BRCMS_SROM_MCS5GLPO0, |
| 92 | BRCMS_SROM_MCS5GLPO1, |
| 93 | BRCMS_SROM_MCS5GLPO2, |
| 94 | BRCMS_SROM_MCS5GLPO3, |
| 95 | BRCMS_SROM_MCS5GLPO4, |
| 96 | BRCMS_SROM_MCS5GLPO5, |
| 97 | BRCMS_SROM_MCS5GLPO6, |
| 98 | BRCMS_SROM_MCS5GLPO7, |
| 99 | BRCMS_SROM_MCS5GPO0, |
| 100 | BRCMS_SROM_MCS5GPO1, |
| 101 | BRCMS_SROM_MCS5GPO2, |
| 102 | BRCMS_SROM_MCS5GPO3, |
| 103 | BRCMS_SROM_MCS5GPO4, |
| 104 | BRCMS_SROM_MCS5GPO5, |
| 105 | BRCMS_SROM_MCS5GPO6, |
| 106 | BRCMS_SROM_MCS5GPO7, |
| 107 | BRCMS_SROM_MCSBW202GPO, |
| 108 | BRCMS_SROM_MCSBW205GHPO, |
| 109 | BRCMS_SROM_MCSBW205GLPO, |
| 110 | BRCMS_SROM_MCSBW205GMPO, |
| 111 | BRCMS_SROM_MCSBW20UL2GPO, |
| 112 | BRCMS_SROM_MCSBW20UL5GHPO, |
| 113 | BRCMS_SROM_MCSBW20UL5GLPO, |
| 114 | BRCMS_SROM_MCSBW20UL5GMPO, |
| 115 | BRCMS_SROM_MCSBW402GPO, |
| 116 | BRCMS_SROM_MCSBW405GHPO, |
| 117 | BRCMS_SROM_MCSBW405GLPO, |
| 118 | BRCMS_SROM_MCSBW405GMPO, |
| 119 | BRCMS_SROM_MEASPOWER, |
| 120 | BRCMS_SROM_OFDM2GPO, |
| 121 | BRCMS_SROM_OFDM5GHPO, |
| 122 | BRCMS_SROM_OFDM5GLPO, |
| 123 | BRCMS_SROM_OFDM5GPO, |
| 124 | BRCMS_SROM_OPO, |
| 125 | BRCMS_SROM_PA0B0, |
| 126 | BRCMS_SROM_PA0B1, |
| 127 | BRCMS_SROM_PA0B2, |
| 128 | BRCMS_SROM_PA0ITSSIT, |
| 129 | BRCMS_SROM_PA0MAXPWR, |
| 130 | BRCMS_SROM_PA1B0, |
| 131 | BRCMS_SROM_PA1B1, |
| 132 | BRCMS_SROM_PA1B2, |
| 133 | BRCMS_SROM_PA1HIB0, |
| 134 | BRCMS_SROM_PA1HIB1, |
| 135 | BRCMS_SROM_PA1HIB2, |
| 136 | BRCMS_SROM_PA1HIMAXPWR, |
| 137 | BRCMS_SROM_PA1ITSSIT, |
| 138 | BRCMS_SROM_PA1LOB0, |
| 139 | BRCMS_SROM_PA1LOB1, |
| 140 | BRCMS_SROM_PA1LOB2, |
| 141 | BRCMS_SROM_PA1LOMAXPWR, |
| 142 | BRCMS_SROM_PA1MAXPWR, |
| 143 | BRCMS_SROM_PDETRANGE2G, |
| 144 | BRCMS_SROM_PDETRANGE5G, |
| 145 | BRCMS_SROM_PHYCAL_TEMPDELTA, |
| 146 | BRCMS_SROM_RAWTEMPSENSE, |
| 147 | BRCMS_SROM_REGREV, |
| 148 | BRCMS_SROM_REV, |
| 149 | BRCMS_SROM_RSSISAV2G, |
| 150 | BRCMS_SROM_RSSISAV5G, |
| 151 | BRCMS_SROM_RSSISMC2G, |
| 152 | BRCMS_SROM_RSSISMC5G, |
| 153 | BRCMS_SROM_RSSISMF2G, |
| 154 | BRCMS_SROM_RSSISMF5G, |
| 155 | BRCMS_SROM_RXCHAIN, |
| 156 | BRCMS_SROM_RXPO2G, |
| 157 | BRCMS_SROM_RXPO5G, |
| 158 | BRCMS_SROM_STBCPO, |
| 159 | BRCMS_SROM_TEMPCORRX, |
| 160 | BRCMS_SROM_TEMPOFFSET, |
| 161 | BRCMS_SROM_TEMPSENSE_OPTION, |
| 162 | BRCMS_SROM_TEMPSENSE_SLOPE, |
| 163 | BRCMS_SROM_TEMPTHRESH, |
| 164 | BRCMS_SROM_TRI2G, |
| 165 | BRCMS_SROM_TRI5GH, |
| 166 | BRCMS_SROM_TRI5GL, |
| 167 | BRCMS_SROM_TRI5G, |
| 168 | BRCMS_SROM_TRISO2G, |
| 169 | BRCMS_SROM_TRISO5G, |
| 170 | BRCMS_SROM_TSSIPOS2G, |
| 171 | BRCMS_SROM_TSSIPOS5G, |
| 172 | BRCMS_SROM_TXCHAIN, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 173 | /* |
| 174 | * per-path identifiers (see srom.c) |
| 175 | */ |
| 176 | BRCMS_SROM_ITT2GA0, |
| 177 | BRCMS_SROM_ITT2GA1, |
| 178 | BRCMS_SROM_ITT2GA2, |
| 179 | BRCMS_SROM_ITT2GA3, |
| 180 | BRCMS_SROM_ITT5GA0, |
| 181 | BRCMS_SROM_ITT5GA1, |
| 182 | BRCMS_SROM_ITT5GA2, |
| 183 | BRCMS_SROM_ITT5GA3, |
| 184 | BRCMS_SROM_MAXP2GA0, |
| 185 | BRCMS_SROM_MAXP2GA1, |
| 186 | BRCMS_SROM_MAXP2GA2, |
| 187 | BRCMS_SROM_MAXP2GA3, |
| 188 | BRCMS_SROM_MAXP5GA0, |
| 189 | BRCMS_SROM_MAXP5GA1, |
| 190 | BRCMS_SROM_MAXP5GA2, |
| 191 | BRCMS_SROM_MAXP5GA3, |
| 192 | BRCMS_SROM_MAXP5GHA0, |
| 193 | BRCMS_SROM_MAXP5GHA1, |
| 194 | BRCMS_SROM_MAXP5GHA2, |
| 195 | BRCMS_SROM_MAXP5GHA3, |
| 196 | BRCMS_SROM_MAXP5GLA0, |
| 197 | BRCMS_SROM_MAXP5GLA1, |
| 198 | BRCMS_SROM_MAXP5GLA2, |
| 199 | BRCMS_SROM_MAXP5GLA3, |
| 200 | BRCMS_SROM_PA2GW0A0, |
| 201 | BRCMS_SROM_PA2GW0A1, |
| 202 | BRCMS_SROM_PA2GW0A2, |
| 203 | BRCMS_SROM_PA2GW0A3, |
| 204 | BRCMS_SROM_PA2GW1A0, |
| 205 | BRCMS_SROM_PA2GW1A1, |
| 206 | BRCMS_SROM_PA2GW1A2, |
| 207 | BRCMS_SROM_PA2GW1A3, |
| 208 | BRCMS_SROM_PA2GW2A0, |
| 209 | BRCMS_SROM_PA2GW2A1, |
| 210 | BRCMS_SROM_PA2GW2A2, |
| 211 | BRCMS_SROM_PA2GW2A3, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 212 | BRCMS_SROM_PA5GHW0A0, |
| 213 | BRCMS_SROM_PA5GHW0A1, |
| 214 | BRCMS_SROM_PA5GHW0A2, |
| 215 | BRCMS_SROM_PA5GHW0A3, |
| 216 | BRCMS_SROM_PA5GHW1A0, |
| 217 | BRCMS_SROM_PA5GHW1A1, |
| 218 | BRCMS_SROM_PA5GHW1A2, |
| 219 | BRCMS_SROM_PA5GHW1A3, |
| 220 | BRCMS_SROM_PA5GHW2A0, |
| 221 | BRCMS_SROM_PA5GHW2A1, |
| 222 | BRCMS_SROM_PA5GHW2A2, |
| 223 | BRCMS_SROM_PA5GHW2A3, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 224 | BRCMS_SROM_PA5GLW0A0, |
| 225 | BRCMS_SROM_PA5GLW0A1, |
| 226 | BRCMS_SROM_PA5GLW0A2, |
| 227 | BRCMS_SROM_PA5GLW0A3, |
| 228 | BRCMS_SROM_PA5GLW1A0, |
| 229 | BRCMS_SROM_PA5GLW1A1, |
| 230 | BRCMS_SROM_PA5GLW1A2, |
| 231 | BRCMS_SROM_PA5GLW1A3, |
| 232 | BRCMS_SROM_PA5GLW2A0, |
| 233 | BRCMS_SROM_PA5GLW2A1, |
| 234 | BRCMS_SROM_PA5GLW2A2, |
| 235 | BRCMS_SROM_PA5GLW2A3, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 236 | BRCMS_SROM_PA5GW0A0, |
| 237 | BRCMS_SROM_PA5GW0A1, |
| 238 | BRCMS_SROM_PA5GW0A2, |
| 239 | BRCMS_SROM_PA5GW0A3, |
| 240 | BRCMS_SROM_PA5GW1A0, |
| 241 | BRCMS_SROM_PA5GW1A1, |
| 242 | BRCMS_SROM_PA5GW1A2, |
| 243 | BRCMS_SROM_PA5GW1A3, |
| 244 | BRCMS_SROM_PA5GW2A0, |
| 245 | BRCMS_SROM_PA5GW2A1, |
| 246 | BRCMS_SROM_PA5GW2A2, |
| 247 | BRCMS_SROM_PA5GW2A3, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 248 | }; |
| 249 | |
| 250 | #define BRCMS_NUMRATES 16 /* max # of rates in a rateset */ |
| 251 | #define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */ |
| 252 | |
| 253 | /* phy types */ |
| 254 | #define PHY_TYPE_A 0 /* Phy type A */ |
| 255 | #define PHY_TYPE_G 2 /* Phy type G */ |
| 256 | #define PHY_TYPE_N 4 /* Phy type N */ |
| 257 | #define PHY_TYPE_LP 5 /* Phy type Low Power A/B/G */ |
| 258 | #define PHY_TYPE_SSN 6 /* Phy type Single Stream N */ |
| 259 | #define PHY_TYPE_LCN 8 /* Phy type Single Stream N */ |
| 260 | #define PHY_TYPE_LCNXN 9 /* Phy type 2-stream N */ |
| 261 | #define PHY_TYPE_HT 7 /* Phy type 3-Stream N */ |
| 262 | |
| 263 | /* bw */ |
| 264 | #define BRCMS_10_MHZ 10 /* 10Mhz nphy channel bandwidth */ |
| 265 | #define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */ |
| 266 | #define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */ |
| 267 | |
| 268 | #define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */ |
| 269 | #define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */ |
| 270 | #define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */ |
| 271 | #define BRCMS_RSSI_LOW -70 /* Low quality cutoffs */ |
| 272 | #define BRCMS_RSSI_GOOD -68 /* Good quality cutoffs */ |
| 273 | #define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */ |
| 274 | #define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */ |
| 275 | |
| 276 | /* a large TX Power as an init value to factor out of min() calculations, |
| 277 | * keep low enough to fit in an s8, units are .25 dBm |
| 278 | */ |
| 279 | #define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */ |
| 280 | |
| 281 | /* rate related definitions */ |
| 282 | #define BRCMS_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */ |
| 283 | #define BRCMS_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */ |
| 284 | |
| 285 | /* legacy rx Antenna diversity for SISO rates */ |
| 286 | #define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */ |
| 287 | #define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */ |
| 288 | #define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */ |
| 289 | #define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */ |
| 290 | #define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */ |
| 291 | /* default antdiv setting */ |
| 292 | #define ANT_RX_DIV_DEF ANT_RX_DIV_START_0 |
| 293 | |
| 294 | /* legacy rx Antenna diversity for SISO rates */ |
| 295 | /* Tx on antenna 0, "legacy term Main" */ |
| 296 | #define ANT_TX_FORCE_0 0 |
| 297 | /* Tx on antenna 1, "legacy term Aux" */ |
| 298 | #define ANT_TX_FORCE_1 1 |
| 299 | /* Tx on phy's last good Rx antenna */ |
| 300 | #define ANT_TX_LAST_RX 3 |
| 301 | /* driver's default tx antenna setting */ |
| 302 | #define ANT_TX_DEF 3 |
| 303 | |
| 304 | /* Tx Chain values */ |
| 305 | /* def bitmap of txchain */ |
| 306 | #define TXCHAIN_DEF 0x1 |
| 307 | /* default bitmap of tx chains for nphy */ |
| 308 | #define TXCHAIN_DEF_NPHY 0x3 |
| 309 | /* default bitmap of tx chains for nphy */ |
| 310 | #define TXCHAIN_DEF_HTPHY 0x7 |
| 311 | /* def bitmap of rxchain */ |
| 312 | #define RXCHAIN_DEF 0x1 |
| 313 | /* default bitmap of rx chains for nphy */ |
| 314 | #define RXCHAIN_DEF_NPHY 0x3 |
| 315 | /* default bitmap of rx chains for nphy */ |
| 316 | #define RXCHAIN_DEF_HTPHY 0x7 |
| 317 | /* no antenna switch */ |
| 318 | #define ANTSWITCH_NONE 0 |
| 319 | /* antenna switch on 4321CB2, 2of3 */ |
| 320 | #define ANTSWITCH_TYPE_1 1 |
| 321 | /* antenna switch on 4321MPCI, 2of3 */ |
| 322 | #define ANTSWITCH_TYPE_2 2 |
| 323 | /* antenna switch on 4322, 2of3 */ |
| 324 | #define ANTSWITCH_TYPE_3 3 |
| 325 | |
| 326 | #define RXBUFSZ PKTBUFSZ |
| 327 | |
| 328 | #define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */ |
| 329 | |
| 330 | struct brcm_rateset { |
| 331 | /* # rates in this set */ |
| 332 | u32 count; |
| 333 | /* rates in 500kbps units w/hi bit set if basic */ |
| 334 | u8 rates[WL_NUMRATES]; |
| 335 | }; |
| 336 | |
| 337 | struct brcms_c_rateset { |
| 338 | uint count; /* number of rates in rates[] */ |
| 339 | /* rates in 500kbps units w/hi bit set if basic */ |
| 340 | u8 rates[BRCMS_NUMRATES]; |
| 341 | u8 htphy_membership; /* HT PHY Membership */ |
| 342 | u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */ |
| 343 | }; |
| 344 | |
| 345 | /* All the HT-specific default advertised capabilities (including AMPDU) |
| 346 | * should be grouped here at one place |
| 347 | */ |
| 348 | #define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */ |
| 349 | |
| 350 | /* wlc internal bss_info */ |
| 351 | struct brcms_bss_info { |
| 352 | u8 BSSID[ETH_ALEN]; /* network BSSID */ |
| 353 | u16 flags; /* flags for internal attributes */ |
| 354 | u8 SSID_len; /* the length of SSID */ |
| 355 | u8 SSID[32]; /* SSID string */ |
| 356 | s16 RSSI; /* receive signal strength (in dBm) */ |
| 357 | s16 SNR; /* receive signal SNR in dB */ |
| 358 | u16 beacon_period; /* units are Kusec */ |
| 359 | u16 chanspec; /* Channel num, bw, ctrl_sb and band */ |
| 360 | struct brcms_c_rateset rateset; /* supported rates */ |
| 361 | }; |
| 362 | |
| 363 | #define MAC80211_PROMISC_BCNS (1 << 0) |
| 364 | #define MAC80211_SCAN (1 << 1) |
| 365 | |
| 366 | /* |
| 367 | * Public portion of common driver state structure. |
| 368 | * The wlc handle points at this. |
| 369 | */ |
| 370 | struct brcms_pub { |
| 371 | struct brcms_c_info *wlc; |
| 372 | struct ieee80211_hw *ieee_hw; |
| 373 | struct scb_ampdu *global_ampdu; |
| 374 | uint mac80211_state; |
| 375 | uint unit; /* device instance number */ |
| 376 | uint corerev; /* core revision */ |
| 377 | struct si_pub *sih; /* SI handle (cookie for siutils calls) */ |
| 378 | bool up; /* interface up and running */ |
| 379 | bool hw_off; /* HW is off */ |
| 380 | bool hw_up; /* one time hw up/down */ |
| 381 | bool _piomode; /* true if pio mode */ |
| 382 | uint _nbands; /* # bands supported */ |
| 383 | uint now; /* # elapsed seconds */ |
| 384 | |
| 385 | bool promisc; /* promiscuous destination address */ |
| 386 | bool delayed_down; /* down delayed */ |
| 387 | bool associated; /* true:part of [I]BSS, false: not */ |
| 388 | /* (union of stas_associated, aps_associated) */ |
| 389 | bool _ampdu; /* ampdu enabled or not */ |
| 390 | u8 _n_enab; /* bitmap of 11N + HT support */ |
| 391 | |
| 392 | u8 cur_etheraddr[ETH_ALEN]; /* our local ethernet address */ |
| 393 | |
| 394 | int bcmerror; /* last bcm error */ |
| 395 | |
| 396 | u32 radio_disabled; /* bit vector for radio disabled reasons */ |
| 397 | |
| 398 | u16 boardrev; /* version # of particular board */ |
| 399 | u8 sromrev; /* version # of the srom */ |
| 400 | char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */ |
| 401 | u32 boardflags; /* Board specific flags from srom */ |
| 402 | u32 boardflags2; /* More board flags if sromrev >= 4 */ |
| 403 | bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */ |
| 404 | |
| 405 | struct wl_cnt *_cnt; /* low-level counters in driver */ |
| 406 | }; |
| 407 | |
| 408 | enum wlc_par_id { |
| 409 | IOV_MPC = 1, |
| 410 | IOV_RTSTHRESH, |
| 411 | IOV_QTXPOWER, |
| 412 | IOV_BCN_LI_BCN /* Beacon listen interval in # of beacons */ |
| 413 | }; |
| 414 | |
| 415 | /*********************************************** |
| 416 | * Feature-related macros to optimize out code * |
| 417 | * ********************************************* |
| 418 | */ |
| 419 | |
| 420 | #define ENAB_1x1 0x01 |
| 421 | #define ENAB_2x2 0x02 |
| 422 | #define ENAB_3x3 0x04 |
| 423 | #define ENAB_4x4 0x08 |
| 424 | #define SUPPORT_11N (ENAB_1x1|ENAB_2x2) |
| 425 | #define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3) |
| 426 | |
| 427 | /* WL11N Support */ |
| 428 | #define AMPDU_AGG_HOST 1 |
| 429 | |
| 430 | /* pri is priority encoded in the packet. This maps the Packet priority to |
| 431 | * enqueue precedence as defined in wlc_prec_map |
| 432 | */ |
| 433 | extern const u8 wlc_prio2prec_map[]; |
| 434 | #define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7] |
| 435 | |
| 436 | #define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */ |
| 437 | |
| 438 | /* Mask to describe all precedence levels */ |
| 439 | #define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT) |
| 440 | |
| 441 | /* |
| 442 | * This maps priority to one precedence higher - Used by PS-Poll response |
| 443 | * packets to simulate enqueue-at-head operation, but still maintain the |
| 444 | * order on the queue |
| 445 | */ |
| 446 | #define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\ |
| 447 | BRCMS_PREC_COUNT - 1) |
| 448 | |
| 449 | /* Define a bitmap of precedences comprised by each AC */ |
| 450 | #define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \ |
| 451 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \ |
| 452 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \ |
| 453 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE))) |
| 454 | #define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \ |
| 455 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \ |
| 456 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \ |
| 457 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE))) |
| 458 | #define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \ |
| 459 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \ |
| 460 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \ |
| 461 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI))) |
| 462 | #define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \ |
| 463 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \ |
| 464 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \ |
| 465 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC))) |
| 466 | |
| 467 | /* network protection config */ |
| 468 | #define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */ |
| 469 | #define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */ |
| 470 | #define BRCMS_PROT_G_USER 3 /* gmode specified by user */ |
| 471 | #define BRCMS_PROT_OVERLAP 4 /* overlap */ |
| 472 | #define BRCMS_PROT_N_USER 10 /* nmode specified by user */ |
| 473 | #define BRCMS_PROT_N_CFG 11 /* n protection */ |
| 474 | #define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */ |
| 475 | #define BRCMS_PROT_N_NONGF 13 /* non-GF protection */ |
| 476 | #define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */ |
| 477 | #define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */ |
| 478 | #define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */ |
| 479 | |
| 480 | /* |
| 481 | * 54g modes (basic bits may still be overridden) |
| 482 | * |
| 483 | * GMODE_LEGACY_B |
| 484 | * Rateset: 1b, 2b, 5.5, 11 |
| 485 | * Preamble: Long |
| 486 | * Shortslot: Off |
| 487 | * GMODE_AUTO |
| 488 | * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 |
| 489 | * Extended Rateset: 6, 9, 12, 48 |
| 490 | * Preamble: Long |
| 491 | * Shortslot: Auto |
| 492 | * GMODE_ONLY |
| 493 | * Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54 |
| 494 | * Extended Rateset: 6b, 9, 12b, 48 |
| 495 | * Preamble: Short required |
| 496 | * Shortslot: Auto |
| 497 | * GMODE_B_DEFERRED |
| 498 | * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 |
| 499 | * Extended Rateset: 6, 9, 12, 48 |
| 500 | * Preamble: Long |
| 501 | * Shortslot: On |
| 502 | * GMODE_PERFORMANCE |
| 503 | * Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54 |
| 504 | * Preamble: Short required |
| 505 | * Shortslot: On and required |
| 506 | * GMODE_LRS |
| 507 | * Rateset: 1b, 2b, 5.5b, 11b |
| 508 | * Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54 |
| 509 | * Preamble: Long |
| 510 | * Shortslot: Auto |
| 511 | */ |
| 512 | #define GMODE_LEGACY_B 0 |
| 513 | #define GMODE_AUTO 1 |
| 514 | #define GMODE_ONLY 2 |
| 515 | #define GMODE_B_DEFERRED 3 |
| 516 | #define GMODE_PERFORMANCE 4 |
| 517 | #define GMODE_LRS 5 |
| 518 | #define GMODE_MAX 6 |
| 519 | |
| 520 | /* MCS values greater than this enable multiple streams */ |
| 521 | #define HIGHEST_SINGLE_STREAM_MCS 7 |
| 522 | |
| 523 | #define MAXBANDS 2 /* Maximum #of bands */ |
| 524 | |
| 525 | /* max number of antenna configurations */ |
| 526 | #define ANT_SELCFG_MAX 4 |
| 527 | |
| 528 | struct brcms_antselcfg { |
| 529 | u8 ant_config[ANT_SELCFG_MAX]; /* antenna configuration */ |
| 530 | u8 num_antcfg; /* number of available antenna configurations */ |
| 531 | }; |
| 532 | |
| 533 | /* common functions for every port */ |
Alwin Beukers | 94bdc2a | 2011-10-12 20:51:13 +0200 | [diff] [blame] | 534 | extern struct brcms_c_info * |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 535 | brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, |
| 536 | bool piomode, void __iomem *regsva, struct pci_dev *btparam, |
| 537 | uint *perr); |
| 538 | extern uint brcms_c_detach(struct brcms_c_info *wlc); |
| 539 | extern int brcms_c_up(struct brcms_c_info *wlc); |
| 540 | extern uint brcms_c_down(struct brcms_c_info *wlc); |
| 541 | |
| 542 | extern bool brcms_c_chipmatch(u16 vendor, u16 device); |
Roland Vossen | dc46012 | 2011-10-21 16:16:28 +0200 | [diff] [blame^] | 543 | extern void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 544 | extern void brcms_c_reset(struct brcms_c_info *wlc); |
| 545 | |
| 546 | extern void brcms_c_intrson(struct brcms_c_info *wlc); |
| 547 | extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc); |
| 548 | extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask); |
| 549 | extern bool brcms_c_intrsupd(struct brcms_c_info *wlc); |
| 550 | extern bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc); |
| 551 | extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded); |
| 552 | extern void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, |
| 553 | struct sk_buff *sdu, |
| 554 | struct ieee80211_hw *hw); |
| 555 | extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 556 | extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, |
| 557 | int val); |
| 558 | extern int brcms_c_get_header_len(void); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 559 | extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc, |
| 560 | int match_reg_offset, |
| 561 | const u8 *addr); |
| 562 | extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, |
| 563 | const struct ieee80211_tx_queue_params *arg, |
| 564 | bool suspend); |
| 565 | extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 566 | extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, |
| 567 | struct ieee80211_sta *sta, u16 tid); |
| 568 | extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, |
| 569 | u8 ba_wsize, uint max_rx_ampdu_bytes); |
| 570 | extern char *getvar(struct si_pub *sih, enum brcms_srom_id id); |
| 571 | extern int getintvar(struct si_pub *sih, enum brcms_srom_id id); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 572 | extern int brcms_c_module_register(struct brcms_pub *pub, |
| 573 | const char *name, struct brcms_info *hdl, |
| 574 | int (*down_fn)(void *handle)); |
| 575 | extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name, |
| 576 | struct brcms_info *hdl); |
| 577 | extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc); |
| 578 | extern void brcms_c_enable_mac(struct brcms_c_info *wlc); |
| 579 | extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state); |
| 580 | extern void brcms_c_scan_start(struct brcms_c_info *wlc); |
| 581 | extern void brcms_c_scan_stop(struct brcms_c_info *wlc); |
| 582 | extern int brcms_c_get_curband(struct brcms_c_info *wlc); |
| 583 | extern void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, |
| 584 | bool drop); |
Alwin Beukers | 94bdc2a | 2011-10-12 20:51:13 +0200 | [diff] [blame] | 585 | extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel); |
| 586 | extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl); |
| 587 | extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 588 | struct brcm_rateset *currs); |
Alwin Beukers | 94bdc2a | 2011-10-12 20:51:13 +0200 | [diff] [blame] | 589 | extern int brcms_c_set_rateset(struct brcms_c_info *wlc, |
| 590 | struct brcm_rateset *rs); |
| 591 | extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period); |
| 592 | extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx); |
| 593 | extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 594 | s8 sslot_override); |
Alwin Beukers | 94bdc2a | 2011-10-12 20:51:13 +0200 | [diff] [blame] | 595 | extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, |
| 596 | u8 interval); |
| 597 | extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr); |
| 598 | extern int brcms_c_get_tx_power(struct brcms_c_info *wlc); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 599 | extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); |
Roland Vossen | dc46012 | 2011-10-21 16:16:28 +0200 | [diff] [blame^] | 600 | extern void brcms_c_mute(struct brcms_c_info *wlc, bool on); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 601 | |
| 602 | #endif /* _BRCM_PUB_H_ */ |