pub.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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 <brcmu_wifi.h>
  19. #include "types.h"
  20. #include "defs.h"
  21. enum brcms_srom_id {
  22. BRCMS_SROM_NULL,
  23. BRCMS_SROM_CONT,
  24. BRCMS_SROM_AA2G,
  25. BRCMS_SROM_AA5G,
  26. BRCMS_SROM_AG0,
  27. BRCMS_SROM_AG1,
  28. BRCMS_SROM_AG2,
  29. BRCMS_SROM_AG3,
  30. BRCMS_SROM_ANTSWCTL2G,
  31. BRCMS_SROM_ANTSWCTL5G,
  32. BRCMS_SROM_ANTSWITCH,
  33. BRCMS_SROM_BOARDFLAGS2,
  34. BRCMS_SROM_BOARDFLAGS,
  35. BRCMS_SROM_BOARDNUM,
  36. BRCMS_SROM_BOARDREV,
  37. BRCMS_SROM_BOARDTYPE,
  38. BRCMS_SROM_BW40PO,
  39. BRCMS_SROM_BWDUPPO,
  40. BRCMS_SROM_BXA2G,
  41. BRCMS_SROM_BXA5G,
  42. BRCMS_SROM_CC,
  43. BRCMS_SROM_CCK2GPO,
  44. BRCMS_SROM_CCKBW202GPO,
  45. BRCMS_SROM_CCKBW20UL2GPO,
  46. BRCMS_SROM_CCODE,
  47. BRCMS_SROM_CDDPO,
  48. BRCMS_SROM_DEVID,
  49. BRCMS_SROM_ET1MACADDR,
  50. BRCMS_SROM_EXTPAGAIN2G,
  51. BRCMS_SROM_EXTPAGAIN5G,
  52. BRCMS_SROM_FREQOFFSET_CORR,
  53. BRCMS_SROM_HW_IQCAL_EN,
  54. BRCMS_SROM_IL0MACADDR,
  55. BRCMS_SROM_IQCAL_SWP_DIS,
  56. BRCMS_SROM_LEDBH0,
  57. BRCMS_SROM_LEDBH1,
  58. BRCMS_SROM_LEDBH2,
  59. BRCMS_SROM_LEDBH3,
  60. BRCMS_SROM_LEDDC,
  61. BRCMS_SROM_LEGOFDM40DUPPO,
  62. BRCMS_SROM_LEGOFDMBW202GPO,
  63. BRCMS_SROM_LEGOFDMBW205GHPO,
  64. BRCMS_SROM_LEGOFDMBW205GLPO,
  65. BRCMS_SROM_LEGOFDMBW205GMPO,
  66. BRCMS_SROM_LEGOFDMBW20UL2GPO,
  67. BRCMS_SROM_LEGOFDMBW20UL5GHPO,
  68. BRCMS_SROM_LEGOFDMBW20UL5GLPO,
  69. BRCMS_SROM_LEGOFDMBW20UL5GMPO,
  70. BRCMS_SROM_MACADDR,
  71. BRCMS_SROM_MCS2GPO0,
  72. BRCMS_SROM_MCS2GPO1,
  73. BRCMS_SROM_MCS2GPO2,
  74. BRCMS_SROM_MCS2GPO3,
  75. BRCMS_SROM_MCS2GPO4,
  76. BRCMS_SROM_MCS2GPO5,
  77. BRCMS_SROM_MCS2GPO6,
  78. BRCMS_SROM_MCS2GPO7,
  79. BRCMS_SROM_MCS32PO,
  80. BRCMS_SROM_MCS5GHPO0,
  81. BRCMS_SROM_MCS5GHPO1,
  82. BRCMS_SROM_MCS5GHPO2,
  83. BRCMS_SROM_MCS5GHPO3,
  84. BRCMS_SROM_MCS5GHPO4,
  85. BRCMS_SROM_MCS5GHPO5,
  86. BRCMS_SROM_MCS5GHPO6,
  87. BRCMS_SROM_MCS5GHPO7,
  88. BRCMS_SROM_MCS5GLPO0,
  89. BRCMS_SROM_MCS5GLPO1,
  90. BRCMS_SROM_MCS5GLPO2,
  91. BRCMS_SROM_MCS5GLPO3,
  92. BRCMS_SROM_MCS5GLPO4,
  93. BRCMS_SROM_MCS5GLPO5,
  94. BRCMS_SROM_MCS5GLPO6,
  95. BRCMS_SROM_MCS5GLPO7,
  96. BRCMS_SROM_MCS5GPO0,
  97. BRCMS_SROM_MCS5GPO1,
  98. BRCMS_SROM_MCS5GPO2,
  99. BRCMS_SROM_MCS5GPO3,
  100. BRCMS_SROM_MCS5GPO4,
  101. BRCMS_SROM_MCS5GPO5,
  102. BRCMS_SROM_MCS5GPO6,
  103. BRCMS_SROM_MCS5GPO7,
  104. BRCMS_SROM_MCSBW202GPO,
  105. BRCMS_SROM_MCSBW205GHPO,
  106. BRCMS_SROM_MCSBW205GLPO,
  107. BRCMS_SROM_MCSBW205GMPO,
  108. BRCMS_SROM_MCSBW20UL2GPO,
  109. BRCMS_SROM_MCSBW20UL5GHPO,
  110. BRCMS_SROM_MCSBW20UL5GLPO,
  111. BRCMS_SROM_MCSBW20UL5GMPO,
  112. BRCMS_SROM_MCSBW402GPO,
  113. BRCMS_SROM_MCSBW405GHPO,
  114. BRCMS_SROM_MCSBW405GLPO,
  115. BRCMS_SROM_MCSBW405GMPO,
  116. BRCMS_SROM_MEASPOWER,
  117. BRCMS_SROM_OFDM2GPO,
  118. BRCMS_SROM_OFDM5GHPO,
  119. BRCMS_SROM_OFDM5GLPO,
  120. BRCMS_SROM_OFDM5GPO,
  121. BRCMS_SROM_OPO,
  122. BRCMS_SROM_PA0B0,
  123. BRCMS_SROM_PA0B1,
  124. BRCMS_SROM_PA0B2,
  125. BRCMS_SROM_PA0ITSSIT,
  126. BRCMS_SROM_PA0MAXPWR,
  127. BRCMS_SROM_PA1B0,
  128. BRCMS_SROM_PA1B1,
  129. BRCMS_SROM_PA1B2,
  130. BRCMS_SROM_PA1HIB0,
  131. BRCMS_SROM_PA1HIB1,
  132. BRCMS_SROM_PA1HIB2,
  133. BRCMS_SROM_PA1HIMAXPWR,
  134. BRCMS_SROM_PA1ITSSIT,
  135. BRCMS_SROM_PA1LOB0,
  136. BRCMS_SROM_PA1LOB1,
  137. BRCMS_SROM_PA1LOB2,
  138. BRCMS_SROM_PA1LOMAXPWR,
  139. BRCMS_SROM_PA1MAXPWR,
  140. BRCMS_SROM_PDETRANGE2G,
  141. BRCMS_SROM_PDETRANGE5G,
  142. BRCMS_SROM_PHYCAL_TEMPDELTA,
  143. BRCMS_SROM_RAWTEMPSENSE,
  144. BRCMS_SROM_REGREV,
  145. BRCMS_SROM_REV,
  146. BRCMS_SROM_RSSISAV2G,
  147. BRCMS_SROM_RSSISAV5G,
  148. BRCMS_SROM_RSSISMC2G,
  149. BRCMS_SROM_RSSISMC5G,
  150. BRCMS_SROM_RSSISMF2G,
  151. BRCMS_SROM_RSSISMF5G,
  152. BRCMS_SROM_RXCHAIN,
  153. BRCMS_SROM_RXPO2G,
  154. BRCMS_SROM_RXPO5G,
  155. BRCMS_SROM_STBCPO,
  156. BRCMS_SROM_TEMPCORRX,
  157. BRCMS_SROM_TEMPOFFSET,
  158. BRCMS_SROM_TEMPSENSE_OPTION,
  159. BRCMS_SROM_TEMPSENSE_SLOPE,
  160. BRCMS_SROM_TEMPTHRESH,
  161. BRCMS_SROM_TRI2G,
  162. BRCMS_SROM_TRI5GH,
  163. BRCMS_SROM_TRI5GL,
  164. BRCMS_SROM_TRI5G,
  165. BRCMS_SROM_TRISO2G,
  166. BRCMS_SROM_TRISO5G,
  167. BRCMS_SROM_TSSIPOS2G,
  168. BRCMS_SROM_TSSIPOS5G,
  169. BRCMS_SROM_TXCHAIN,
  170. /*
  171. * per-path identifiers (see srom.c)
  172. */
  173. BRCMS_SROM_ITT2GA0,
  174. BRCMS_SROM_ITT2GA1,
  175. BRCMS_SROM_ITT2GA2,
  176. BRCMS_SROM_ITT2GA3,
  177. BRCMS_SROM_ITT5GA0,
  178. BRCMS_SROM_ITT5GA1,
  179. BRCMS_SROM_ITT5GA2,
  180. BRCMS_SROM_ITT5GA3,
  181. BRCMS_SROM_MAXP2GA0,
  182. BRCMS_SROM_MAXP2GA1,
  183. BRCMS_SROM_MAXP2GA2,
  184. BRCMS_SROM_MAXP2GA3,
  185. BRCMS_SROM_MAXP5GA0,
  186. BRCMS_SROM_MAXP5GA1,
  187. BRCMS_SROM_MAXP5GA2,
  188. BRCMS_SROM_MAXP5GA3,
  189. BRCMS_SROM_MAXP5GHA0,
  190. BRCMS_SROM_MAXP5GHA1,
  191. BRCMS_SROM_MAXP5GHA2,
  192. BRCMS_SROM_MAXP5GHA3,
  193. BRCMS_SROM_MAXP5GLA0,
  194. BRCMS_SROM_MAXP5GLA1,
  195. BRCMS_SROM_MAXP5GLA2,
  196. BRCMS_SROM_MAXP5GLA3,
  197. BRCMS_SROM_PA2GW0A0,
  198. BRCMS_SROM_PA2GW0A1,
  199. BRCMS_SROM_PA2GW0A2,
  200. BRCMS_SROM_PA2GW0A3,
  201. BRCMS_SROM_PA2GW1A0,
  202. BRCMS_SROM_PA2GW1A1,
  203. BRCMS_SROM_PA2GW1A2,
  204. BRCMS_SROM_PA2GW1A3,
  205. BRCMS_SROM_PA2GW2A0,
  206. BRCMS_SROM_PA2GW2A1,
  207. BRCMS_SROM_PA2GW2A2,
  208. BRCMS_SROM_PA2GW2A3,
  209. BRCMS_SROM_PA5GHW0A0,
  210. BRCMS_SROM_PA5GHW0A1,
  211. BRCMS_SROM_PA5GHW0A2,
  212. BRCMS_SROM_PA5GHW0A3,
  213. BRCMS_SROM_PA5GHW1A0,
  214. BRCMS_SROM_PA5GHW1A1,
  215. BRCMS_SROM_PA5GHW1A2,
  216. BRCMS_SROM_PA5GHW1A3,
  217. BRCMS_SROM_PA5GHW2A0,
  218. BRCMS_SROM_PA5GHW2A1,
  219. BRCMS_SROM_PA5GHW2A2,
  220. BRCMS_SROM_PA5GHW2A3,
  221. BRCMS_SROM_PA5GLW0A0,
  222. BRCMS_SROM_PA5GLW0A1,
  223. BRCMS_SROM_PA5GLW0A2,
  224. BRCMS_SROM_PA5GLW0A3,
  225. BRCMS_SROM_PA5GLW1A0,
  226. BRCMS_SROM_PA5GLW1A1,
  227. BRCMS_SROM_PA5GLW1A2,
  228. BRCMS_SROM_PA5GLW1A3,
  229. BRCMS_SROM_PA5GLW2A0,
  230. BRCMS_SROM_PA5GLW2A1,
  231. BRCMS_SROM_PA5GLW2A2,
  232. BRCMS_SROM_PA5GLW2A3,
  233. BRCMS_SROM_PA5GW0A0,
  234. BRCMS_SROM_PA5GW0A1,
  235. BRCMS_SROM_PA5GW0A2,
  236. BRCMS_SROM_PA5GW0A3,
  237. BRCMS_SROM_PA5GW1A0,
  238. BRCMS_SROM_PA5GW1A1,
  239. BRCMS_SROM_PA5GW1A2,
  240. BRCMS_SROM_PA5GW1A3,
  241. BRCMS_SROM_PA5GW2A0,
  242. BRCMS_SROM_PA5GW2A1,
  243. BRCMS_SROM_PA5GW2A2,
  244. BRCMS_SROM_PA5GW2A3,
  245. };
  246. #define BRCMS_NUMRATES 16 /* max # of rates in a rateset */
  247. #define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */
  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 promisc; /* promiscuous destination address */
  365. bool delayed_down; /* down delayed */
  366. bool associated; /* true:part of [I]BSS, false: not */
  367. /* (union of stas_associated, aps_associated) */
  368. bool _ampdu; /* ampdu enabled or not */
  369. u8 _n_enab; /* bitmap of 11N + HT support */
  370. u8 cur_etheraddr[ETH_ALEN]; /* our local ethernet address */
  371. int bcmerror; /* last bcm error */
  372. u32 radio_disabled; /* bit vector for radio disabled reasons */
  373. u16 boardrev; /* version # of particular board */
  374. u8 sromrev; /* version # of the srom */
  375. char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */
  376. u32 boardflags; /* Board specific flags from srom */
  377. u32 boardflags2; /* More board flags if sromrev >= 4 */
  378. bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */
  379. struct wl_cnt *_cnt; /* low-level counters in driver */
  380. };
  381. enum wlc_par_id {
  382. IOV_MPC = 1,
  383. IOV_RTSTHRESH,
  384. IOV_QTXPOWER,
  385. IOV_BCN_LI_BCN /* Beacon listen interval in # of beacons */
  386. };
  387. /***********************************************
  388. * Feature-related macros to optimize out code *
  389. * *********************************************
  390. */
  391. #define ENAB_1x1 0x01
  392. #define ENAB_2x2 0x02
  393. #define ENAB_3x3 0x04
  394. #define ENAB_4x4 0x08
  395. #define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
  396. #define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
  397. /* WL11N Support */
  398. #define AMPDU_AGG_HOST 1
  399. /* pri is priority encoded in the packet. This maps the Packet priority to
  400. * enqueue precedence as defined in wlc_prec_map
  401. */
  402. extern const u8 wlc_prio2prec_map[];
  403. #define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]
  404. #define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
  405. /* Mask to describe all precedence levels */
  406. #define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
  407. /*
  408. * This maps priority to one precedence higher - Used by PS-Poll response
  409. * packets to simulate enqueue-at-head operation, but still maintain the
  410. * order on the queue
  411. */
  412. #define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
  413. BRCMS_PREC_COUNT - 1)
  414. /* Define a bitmap of precedences comprised by each AC */
  415. #define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \
  416. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
  417. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \
  418. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE)))
  419. #define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \
  420. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \
  421. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \
  422. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE)))
  423. #define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \
  424. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \
  425. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \
  426. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI)))
  427. #define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \
  428. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \
  429. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \
  430. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC)))
  431. /* network protection config */
  432. #define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
  433. #define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
  434. #define BRCMS_PROT_G_USER 3 /* gmode specified by user */
  435. #define BRCMS_PROT_OVERLAP 4 /* overlap */
  436. #define BRCMS_PROT_N_USER 10 /* nmode specified by user */
  437. #define BRCMS_PROT_N_CFG 11 /* n protection */
  438. #define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */
  439. #define BRCMS_PROT_N_NONGF 13 /* non-GF protection */
  440. #define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */
  441. #define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */
  442. #define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */
  443. /*
  444. * 54g modes (basic bits may still be overridden)
  445. *
  446. * GMODE_LEGACY_B
  447. * Rateset: 1b, 2b, 5.5, 11
  448. * Preamble: Long
  449. * Shortslot: Off
  450. * GMODE_AUTO
  451. * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
  452. * Extended Rateset: 6, 9, 12, 48
  453. * Preamble: Long
  454. * Shortslot: Auto
  455. * GMODE_ONLY
  456. * Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
  457. * Extended Rateset: 6b, 9, 12b, 48
  458. * Preamble: Short required
  459. * Shortslot: Auto
  460. * GMODE_B_DEFERRED
  461. * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
  462. * Extended Rateset: 6, 9, 12, 48
  463. * Preamble: Long
  464. * Shortslot: On
  465. * GMODE_PERFORMANCE
  466. * Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
  467. * Preamble: Short required
  468. * Shortslot: On and required
  469. * GMODE_LRS
  470. * Rateset: 1b, 2b, 5.5b, 11b
  471. * Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
  472. * Preamble: Long
  473. * Shortslot: Auto
  474. */
  475. #define GMODE_LEGACY_B 0
  476. #define GMODE_AUTO 1
  477. #define GMODE_ONLY 2
  478. #define GMODE_B_DEFERRED 3
  479. #define GMODE_PERFORMANCE 4
  480. #define GMODE_LRS 5
  481. #define GMODE_MAX 6
  482. /* MCS values greater than this enable multiple streams */
  483. #define HIGHEST_SINGLE_STREAM_MCS 7
  484. #define MAXBANDS 2 /* Maximum #of bands */
  485. /* max number of antenna configurations */
  486. #define ANT_SELCFG_MAX 4
  487. struct brcms_antselcfg {
  488. u8 ant_config[ANT_SELCFG_MAX]; /* antenna configuration */
  489. u8 num_antcfg; /* number of available antenna configurations */
  490. };
  491. /* common functions for every port */
  492. extern struct brcms_c_info *
  493. brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
  494. bool piomode, void __iomem *regsva, struct pci_dev *btparam,
  495. uint *perr);
  496. extern uint brcms_c_detach(struct brcms_c_info *wlc);
  497. extern int brcms_c_up(struct brcms_c_info *wlc);
  498. extern uint brcms_c_down(struct brcms_c_info *wlc);
  499. extern bool brcms_c_chipmatch(u16 vendor, u16 device);
  500. extern void brcms_c_init(struct brcms_c_info *wlc);
  501. extern void brcms_c_reset(struct brcms_c_info *wlc);
  502. extern void brcms_c_intrson(struct brcms_c_info *wlc);
  503. extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
  504. extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
  505. extern bool brcms_c_intrsupd(struct brcms_c_info *wlc);
  506. extern bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc);
  507. extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
  508. extern void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc,
  509. struct sk_buff *sdu,
  510. struct ieee80211_hw *hw);
  511. extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
  512. extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx,
  513. int val);
  514. extern int brcms_c_get_header_len(void);
  515. extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc,
  516. int match_reg_offset,
  517. const u8 *addr);
  518. extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
  519. const struct ieee80211_tx_queue_params *arg,
  520. bool suspend);
  521. extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
  522. extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
  523. struct ieee80211_sta *sta, u16 tid);
  524. extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
  525. u8 ba_wsize, uint max_rx_ampdu_bytes);
  526. extern char *getvar(struct si_pub *sih, enum brcms_srom_id id);
  527. extern int getintvar(struct si_pub *sih, enum brcms_srom_id id);
  528. extern int brcms_c_module_register(struct brcms_pub *pub,
  529. const char *name, struct brcms_info *hdl,
  530. int (*down_fn)(void *handle));
  531. extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
  532. struct brcms_info *hdl);
  533. extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
  534. extern void brcms_c_enable_mac(struct brcms_c_info *wlc);
  535. extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
  536. extern void brcms_c_scan_start(struct brcms_c_info *wlc);
  537. extern void brcms_c_scan_stop(struct brcms_c_info *wlc);
  538. extern int brcms_c_get_curband(struct brcms_c_info *wlc);
  539. extern void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc,
  540. bool drop);
  541. extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
  542. extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
  543. extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
  544. struct brcm_rateset *currs);
  545. extern int brcms_c_set_rateset(struct brcms_c_info *wlc,
  546. struct brcm_rateset *rs);
  547. extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
  548. extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
  549. extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
  550. s8 sslot_override);
  551. extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc,
  552. u8 interval);
  553. extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
  554. extern int brcms_c_get_tx_power(struct brcms_c_info *wlc);
  555. extern void brcms_c_set_radio_mon(struct brcms_c_info *wlc);
  556. extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
  557. #endif /* _BRCM_PUB_H_ */