pub.h 19 KB

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