pub.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. BRCMS_SROM_TXPID2GA0,
  171. BRCMS_SROM_TXPID2GA1,
  172. BRCMS_SROM_TXPID2GA2,
  173. BRCMS_SROM_TXPID2GA3,
  174. BRCMS_SROM_TXPID5GA0,
  175. BRCMS_SROM_TXPID5GA1,
  176. BRCMS_SROM_TXPID5GA2,
  177. BRCMS_SROM_TXPID5GA3,
  178. BRCMS_SROM_TXPID5GHA0,
  179. BRCMS_SROM_TXPID5GHA1,
  180. BRCMS_SROM_TXPID5GHA2,
  181. BRCMS_SROM_TXPID5GHA3,
  182. BRCMS_SROM_TXPID5GLA0,
  183. BRCMS_SROM_TXPID5GLA1,
  184. BRCMS_SROM_TXPID5GLA2,
  185. BRCMS_SROM_TXPID5GLA3,
  186. /*
  187. * per-path identifiers (see srom.c)
  188. */
  189. BRCMS_SROM_ITT2GA0,
  190. BRCMS_SROM_ITT2GA1,
  191. BRCMS_SROM_ITT2GA2,
  192. BRCMS_SROM_ITT2GA3,
  193. BRCMS_SROM_ITT5GA0,
  194. BRCMS_SROM_ITT5GA1,
  195. BRCMS_SROM_ITT5GA2,
  196. BRCMS_SROM_ITT5GA3,
  197. BRCMS_SROM_MAXP2GA0,
  198. BRCMS_SROM_MAXP2GA1,
  199. BRCMS_SROM_MAXP2GA2,
  200. BRCMS_SROM_MAXP2GA3,
  201. BRCMS_SROM_MAXP5GA0,
  202. BRCMS_SROM_MAXP5GA1,
  203. BRCMS_SROM_MAXP5GA2,
  204. BRCMS_SROM_MAXP5GA3,
  205. BRCMS_SROM_MAXP5GHA0,
  206. BRCMS_SROM_MAXP5GHA1,
  207. BRCMS_SROM_MAXP5GHA2,
  208. BRCMS_SROM_MAXP5GHA3,
  209. BRCMS_SROM_MAXP5GLA0,
  210. BRCMS_SROM_MAXP5GLA1,
  211. BRCMS_SROM_MAXP5GLA2,
  212. BRCMS_SROM_MAXP5GLA3,
  213. BRCMS_SROM_PA2GW0A0,
  214. BRCMS_SROM_PA2GW0A1,
  215. BRCMS_SROM_PA2GW0A2,
  216. BRCMS_SROM_PA2GW0A3,
  217. BRCMS_SROM_PA2GW1A0,
  218. BRCMS_SROM_PA2GW1A1,
  219. BRCMS_SROM_PA2GW1A2,
  220. BRCMS_SROM_PA2GW1A3,
  221. BRCMS_SROM_PA2GW2A0,
  222. BRCMS_SROM_PA2GW2A1,
  223. BRCMS_SROM_PA2GW2A2,
  224. BRCMS_SROM_PA2GW2A3,
  225. BRCMS_SROM_PA2GW3A0,
  226. BRCMS_SROM_PA2GW3A1,
  227. BRCMS_SROM_PA2GW3A2,
  228. BRCMS_SROM_PA2GW3A3,
  229. BRCMS_SROM_PA5GHW0A0,
  230. BRCMS_SROM_PA5GHW0A1,
  231. BRCMS_SROM_PA5GHW0A2,
  232. BRCMS_SROM_PA5GHW0A3,
  233. BRCMS_SROM_PA5GHW1A0,
  234. BRCMS_SROM_PA5GHW1A1,
  235. BRCMS_SROM_PA5GHW1A2,
  236. BRCMS_SROM_PA5GHW1A3,
  237. BRCMS_SROM_PA5GHW2A0,
  238. BRCMS_SROM_PA5GHW2A1,
  239. BRCMS_SROM_PA5GHW2A2,
  240. BRCMS_SROM_PA5GHW2A3,
  241. BRCMS_SROM_PA5GHW3A0,
  242. BRCMS_SROM_PA5GHW3A1,
  243. BRCMS_SROM_PA5GHW3A2,
  244. BRCMS_SROM_PA5GHW3A3,
  245. BRCMS_SROM_PA5GLW0A0,
  246. BRCMS_SROM_PA5GLW0A1,
  247. BRCMS_SROM_PA5GLW0A2,
  248. BRCMS_SROM_PA5GLW0A3,
  249. BRCMS_SROM_PA5GLW1A0,
  250. BRCMS_SROM_PA5GLW1A1,
  251. BRCMS_SROM_PA5GLW1A2,
  252. BRCMS_SROM_PA5GLW1A3,
  253. BRCMS_SROM_PA5GLW2A0,
  254. BRCMS_SROM_PA5GLW2A1,
  255. BRCMS_SROM_PA5GLW2A2,
  256. BRCMS_SROM_PA5GLW2A3,
  257. BRCMS_SROM_PA5GLW3A0,
  258. BRCMS_SROM_PA5GLW3A1,
  259. BRCMS_SROM_PA5GLW3A2,
  260. BRCMS_SROM_PA5GLW3A3,
  261. BRCMS_SROM_PA5GW0A0,
  262. BRCMS_SROM_PA5GW0A1,
  263. BRCMS_SROM_PA5GW0A2,
  264. BRCMS_SROM_PA5GW0A3,
  265. BRCMS_SROM_PA5GW1A0,
  266. BRCMS_SROM_PA5GW1A1,
  267. BRCMS_SROM_PA5GW1A2,
  268. BRCMS_SROM_PA5GW1A3,
  269. BRCMS_SROM_PA5GW2A0,
  270. BRCMS_SROM_PA5GW2A1,
  271. BRCMS_SROM_PA5GW2A2,
  272. BRCMS_SROM_PA5GW2A3,
  273. BRCMS_SROM_PA5GW3A0,
  274. BRCMS_SROM_PA5GW3A1,
  275. BRCMS_SROM_PA5GW3A2,
  276. BRCMS_SROM_PA5GW3A3,
  277. };
  278. #define BRCMS_NUMRATES 16 /* max # of rates in a rateset */
  279. #define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */
  280. /* phy types */
  281. #define PHY_TYPE_A 0 /* Phy type A */
  282. #define PHY_TYPE_G 2 /* Phy type G */
  283. #define PHY_TYPE_N 4 /* Phy type N */
  284. #define PHY_TYPE_LP 5 /* Phy type Low Power A/B/G */
  285. #define PHY_TYPE_SSN 6 /* Phy type Single Stream N */
  286. #define PHY_TYPE_LCN 8 /* Phy type Single Stream N */
  287. #define PHY_TYPE_LCNXN 9 /* Phy type 2-stream N */
  288. #define PHY_TYPE_HT 7 /* Phy type 3-Stream N */
  289. /* bw */
  290. #define BRCMS_10_MHZ 10 /* 10Mhz nphy channel bandwidth */
  291. #define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */
  292. #define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */
  293. #define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
  294. #define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
  295. #define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
  296. #define BRCMS_RSSI_LOW -70 /* Low quality cutoffs */
  297. #define BRCMS_RSSI_GOOD -68 /* Good quality cutoffs */
  298. #define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
  299. #define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
  300. /* a large TX Power as an init value to factor out of min() calculations,
  301. * keep low enough to fit in an s8, units are .25 dBm
  302. */
  303. #define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */
  304. /* rate related definitions */
  305. #define BRCMS_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */
  306. #define BRCMS_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */
  307. /* legacy rx Antenna diversity for SISO rates */
  308. #define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */
  309. #define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */
  310. #define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */
  311. #define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */
  312. #define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */
  313. /* default antdiv setting */
  314. #define ANT_RX_DIV_DEF ANT_RX_DIV_START_0
  315. /* legacy rx Antenna diversity for SISO rates */
  316. /* Tx on antenna 0, "legacy term Main" */
  317. #define ANT_TX_FORCE_0 0
  318. /* Tx on antenna 1, "legacy term Aux" */
  319. #define ANT_TX_FORCE_1 1
  320. /* Tx on phy's last good Rx antenna */
  321. #define ANT_TX_LAST_RX 3
  322. /* driver's default tx antenna setting */
  323. #define ANT_TX_DEF 3
  324. /* Tx Chain values */
  325. /* def bitmap of txchain */
  326. #define TXCHAIN_DEF 0x1
  327. /* default bitmap of tx chains for nphy */
  328. #define TXCHAIN_DEF_NPHY 0x3
  329. /* default bitmap of tx chains for nphy */
  330. #define TXCHAIN_DEF_HTPHY 0x7
  331. /* def bitmap of rxchain */
  332. #define RXCHAIN_DEF 0x1
  333. /* default bitmap of rx chains for nphy */
  334. #define RXCHAIN_DEF_NPHY 0x3
  335. /* default bitmap of rx chains for nphy */
  336. #define RXCHAIN_DEF_HTPHY 0x7
  337. /* no antenna switch */
  338. #define ANTSWITCH_NONE 0
  339. /* antenna switch on 4321CB2, 2of3 */
  340. #define ANTSWITCH_TYPE_1 1
  341. /* antenna switch on 4321MPCI, 2of3 */
  342. #define ANTSWITCH_TYPE_2 2
  343. /* antenna switch on 4322, 2of3 */
  344. #define ANTSWITCH_TYPE_3 3
  345. #define RXBUFSZ PKTBUFSZ
  346. #define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */
  347. struct brcm_rateset {
  348. /* # rates in this set */
  349. u32 count;
  350. /* rates in 500kbps units w/hi bit set if basic */
  351. u8 rates[WL_NUMRATES];
  352. };
  353. struct brcms_c_rateset {
  354. uint count; /* number of rates in rates[] */
  355. /* rates in 500kbps units w/hi bit set if basic */
  356. u8 rates[BRCMS_NUMRATES];
  357. u8 htphy_membership; /* HT PHY Membership */
  358. u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */
  359. };
  360. /* All the HT-specific default advertised capabilities (including AMPDU)
  361. * should be grouped here at one place
  362. */
  363. #define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */
  364. /* wlc internal bss_info */
  365. struct brcms_bss_info {
  366. u8 BSSID[ETH_ALEN]; /* network BSSID */
  367. u16 flags; /* flags for internal attributes */
  368. u8 SSID_len; /* the length of SSID */
  369. u8 SSID[32]; /* SSID string */
  370. s16 RSSI; /* receive signal strength (in dBm) */
  371. s16 SNR; /* receive signal SNR in dB */
  372. u16 beacon_period; /* units are Kusec */
  373. u16 chanspec; /* Channel num, bw, ctrl_sb and band */
  374. struct brcms_c_rateset rateset; /* supported rates */
  375. };
  376. #define MAC80211_PROMISC_BCNS (1 << 0)
  377. #define MAC80211_SCAN (1 << 1)
  378. /*
  379. * Public portion of common driver state structure.
  380. * The wlc handle points at this.
  381. */
  382. struct brcms_pub {
  383. struct brcms_c_info *wlc;
  384. struct ieee80211_hw *ieee_hw;
  385. struct scb_ampdu *global_ampdu;
  386. uint mac80211_state;
  387. uint unit; /* device instance number */
  388. uint corerev; /* core revision */
  389. struct si_pub *sih; /* SI handle (cookie for siutils calls) */
  390. bool up; /* interface up and running */
  391. bool hw_off; /* HW is off */
  392. bool hw_up; /* one time hw up/down */
  393. bool _piomode; /* true if pio mode */
  394. uint _nbands; /* # bands supported */
  395. uint now; /* # elapsed seconds */
  396. bool promisc; /* promiscuous destination address */
  397. bool delayed_down; /* down delayed */
  398. bool associated; /* true:part of [I]BSS, false: not */
  399. /* (union of stas_associated, aps_associated) */
  400. bool _ampdu; /* ampdu enabled or not */
  401. u8 _n_enab; /* bitmap of 11N + HT support */
  402. u8 cur_etheraddr[ETH_ALEN]; /* our local ethernet address */
  403. int bcmerror; /* last bcm error */
  404. u32 radio_disabled; /* bit vector for radio disabled reasons */
  405. u16 boardrev; /* version # of particular board */
  406. u8 sromrev; /* version # of the srom */
  407. char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */
  408. u32 boardflags; /* Board specific flags from srom */
  409. u32 boardflags2; /* More board flags if sromrev >= 4 */
  410. bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */
  411. struct wl_cnt *_cnt; /* low-level counters in driver */
  412. };
  413. enum wlc_par_id {
  414. IOV_MPC = 1,
  415. IOV_RTSTHRESH,
  416. IOV_QTXPOWER,
  417. IOV_BCN_LI_BCN /* Beacon listen interval in # of beacons */
  418. };
  419. /***********************************************
  420. * Feature-related macros to optimize out code *
  421. * *********************************************
  422. */
  423. #define ENAB_1x1 0x01
  424. #define ENAB_2x2 0x02
  425. #define ENAB_3x3 0x04
  426. #define ENAB_4x4 0x08
  427. #define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
  428. #define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
  429. /* WL11N Support */
  430. #define AMPDU_AGG_HOST 1
  431. /* pri is priority encoded in the packet. This maps the Packet priority to
  432. * enqueue precedence as defined in wlc_prec_map
  433. */
  434. extern const u8 wlc_prio2prec_map[];
  435. #define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]
  436. #define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
  437. /* Mask to describe all precedence levels */
  438. #define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
  439. /*
  440. * This maps priority to one precedence higher - Used by PS-Poll response
  441. * packets to simulate enqueue-at-head operation, but still maintain the
  442. * order on the queue
  443. */
  444. #define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
  445. BRCMS_PREC_COUNT - 1)
  446. /* Define a bitmap of precedences comprised by each AC */
  447. #define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \
  448. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
  449. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \
  450. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE)))
  451. #define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \
  452. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \
  453. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \
  454. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE)))
  455. #define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \
  456. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \
  457. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \
  458. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI)))
  459. #define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \
  460. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \
  461. NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \
  462. NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC)))
  463. /* network protection config */
  464. #define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
  465. #define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
  466. #define BRCMS_PROT_G_USER 3 /* gmode specified by user */
  467. #define BRCMS_PROT_OVERLAP 4 /* overlap */
  468. #define BRCMS_PROT_N_USER 10 /* nmode specified by user */
  469. #define BRCMS_PROT_N_CFG 11 /* n protection */
  470. #define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */
  471. #define BRCMS_PROT_N_NONGF 13 /* non-GF protection */
  472. #define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */
  473. #define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */
  474. #define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */
  475. /*
  476. * 54g modes (basic bits may still be overridden)
  477. *
  478. * GMODE_LEGACY_B
  479. * Rateset: 1b, 2b, 5.5, 11
  480. * Preamble: Long
  481. * Shortslot: Off
  482. * GMODE_AUTO
  483. * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
  484. * Extended Rateset: 6, 9, 12, 48
  485. * Preamble: Long
  486. * Shortslot: Auto
  487. * GMODE_ONLY
  488. * Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
  489. * Extended Rateset: 6b, 9, 12b, 48
  490. * Preamble: Short required
  491. * Shortslot: Auto
  492. * GMODE_B_DEFERRED
  493. * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
  494. * Extended Rateset: 6, 9, 12, 48
  495. * Preamble: Long
  496. * Shortslot: On
  497. * GMODE_PERFORMANCE
  498. * Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
  499. * Preamble: Short required
  500. * Shortslot: On and required
  501. * GMODE_LRS
  502. * Rateset: 1b, 2b, 5.5b, 11b
  503. * Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
  504. * Preamble: Long
  505. * Shortslot: Auto
  506. */
  507. #define GMODE_LEGACY_B 0
  508. #define GMODE_AUTO 1
  509. #define GMODE_ONLY 2
  510. #define GMODE_B_DEFERRED 3
  511. #define GMODE_PERFORMANCE 4
  512. #define GMODE_LRS 5
  513. #define GMODE_MAX 6
  514. /* MCS values greater than this enable multiple streams */
  515. #define HIGHEST_SINGLE_STREAM_MCS 7
  516. #define MAXBANDS 2 /* Maximum #of bands */
  517. /* max number of antenna configurations */
  518. #define ANT_SELCFG_MAX 4
  519. struct brcms_antselcfg {
  520. u8 ant_config[ANT_SELCFG_MAX]; /* antenna configuration */
  521. u8 num_antcfg; /* number of available antenna configurations */
  522. };
  523. /* common functions for every port */
  524. extern struct brcms_c_info *
  525. brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
  526. bool piomode, void __iomem *regsva, struct pci_dev *btparam,
  527. uint *perr);
  528. extern uint brcms_c_detach(struct brcms_c_info *wlc);
  529. extern int brcms_c_up(struct brcms_c_info *wlc);
  530. extern uint brcms_c_down(struct brcms_c_info *wlc);
  531. extern bool brcms_c_chipmatch(u16 vendor, u16 device);
  532. extern void brcms_c_init(struct brcms_c_info *wlc);
  533. extern void brcms_c_reset(struct brcms_c_info *wlc);
  534. extern void brcms_c_intrson(struct brcms_c_info *wlc);
  535. extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
  536. extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
  537. extern bool brcms_c_intrsupd(struct brcms_c_info *wlc);
  538. extern bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc);
  539. extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
  540. extern void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc,
  541. struct sk_buff *sdu,
  542. struct ieee80211_hw *hw);
  543. extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
  544. extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx,
  545. int val);
  546. extern int brcms_c_get_header_len(void);
  547. extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc,
  548. int match_reg_offset,
  549. const u8 *addr);
  550. extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
  551. const struct ieee80211_tx_queue_params *arg,
  552. bool suspend);
  553. extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
  554. extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
  555. struct ieee80211_sta *sta, u16 tid);
  556. extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
  557. u8 ba_wsize, uint max_rx_ampdu_bytes);
  558. extern char *getvar(struct si_pub *sih, enum brcms_srom_id id);
  559. extern int getintvar(struct si_pub *sih, enum brcms_srom_id id);
  560. extern int brcms_c_module_register(struct brcms_pub *pub,
  561. const char *name, struct brcms_info *hdl,
  562. int (*down_fn)(void *handle));
  563. extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
  564. struct brcms_info *hdl);
  565. extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
  566. extern void brcms_c_enable_mac(struct brcms_c_info *wlc);
  567. extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
  568. extern void brcms_c_scan_start(struct brcms_c_info *wlc);
  569. extern void brcms_c_scan_stop(struct brcms_c_info *wlc);
  570. extern int brcms_c_get_curband(struct brcms_c_info *wlc);
  571. extern void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc,
  572. bool drop);
  573. extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
  574. extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
  575. extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
  576. struct brcm_rateset *currs);
  577. extern int brcms_c_set_rateset(struct brcms_c_info *wlc,
  578. struct brcm_rateset *rs);
  579. extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
  580. extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
  581. extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
  582. s8 sslot_override);
  583. extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc,
  584. u8 interval);
  585. extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
  586. extern int brcms_c_get_tx_power(struct brcms_c_info *wlc);
  587. extern void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc);
  588. extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
  589. #endif /* _BRCM_PUB_H_ */