ath9k.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
  1. /*
  2. * Copyright (c) 2008 Atheros Communications Inc.
  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
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef ATH9K_H
  17. #define ATH9K_H
  18. #include <linux/io.h>
  19. #define ATHEROS_VENDOR_ID 0x168c
  20. #define AR5416_DEVID_PCI 0x0023
  21. #define AR5416_DEVID_PCIE 0x0024
  22. #define AR9160_DEVID_PCI 0x0027
  23. #define AR9280_DEVID_PCI 0x0029
  24. #define AR9280_DEVID_PCIE 0x002a
  25. #define AR5416_AR9100_DEVID 0x000b
  26. #define AR_SUBVENDOR_ID_NOG 0x0e11
  27. #define AR_SUBVENDOR_ID_NEW_A 0x7065
  28. #define ATH9K_TXERR_XRETRY 0x01
  29. #define ATH9K_TXERR_FILT 0x02
  30. #define ATH9K_TXERR_FIFO 0x04
  31. #define ATH9K_TXERR_XTXOP 0x08
  32. #define ATH9K_TXERR_TIMER_EXPIRED 0x10
  33. #define ATH9K_TX_BA 0x01
  34. #define ATH9K_TX_PWRMGMT 0x02
  35. #define ATH9K_TX_DESC_CFG_ERR 0x04
  36. #define ATH9K_TX_DATA_UNDERRUN 0x08
  37. #define ATH9K_TX_DELIM_UNDERRUN 0x10
  38. #define ATH9K_TX_SW_ABORTED 0x40
  39. #define ATH9K_TX_SW_FILTERED 0x80
  40. #define NBBY 8
  41. struct ath_tx_status {
  42. u32 ts_tstamp;
  43. u16 ts_seqnum;
  44. u8 ts_status;
  45. u8 ts_ratecode;
  46. u8 ts_rateindex;
  47. int8_t ts_rssi;
  48. u8 ts_shortretry;
  49. u8 ts_longretry;
  50. u8 ts_virtcol;
  51. u8 ts_antenna;
  52. u8 ts_flags;
  53. int8_t ts_rssi_ctl0;
  54. int8_t ts_rssi_ctl1;
  55. int8_t ts_rssi_ctl2;
  56. int8_t ts_rssi_ext0;
  57. int8_t ts_rssi_ext1;
  58. int8_t ts_rssi_ext2;
  59. u8 pad[3];
  60. u32 ba_low;
  61. u32 ba_high;
  62. u32 evm0;
  63. u32 evm1;
  64. u32 evm2;
  65. };
  66. struct ath_rx_status {
  67. u32 rs_tstamp;
  68. u16 rs_datalen;
  69. u8 rs_status;
  70. u8 rs_phyerr;
  71. int8_t rs_rssi;
  72. u8 rs_keyix;
  73. u8 rs_rate;
  74. u8 rs_antenna;
  75. u8 rs_more;
  76. int8_t rs_rssi_ctl0;
  77. int8_t rs_rssi_ctl1;
  78. int8_t rs_rssi_ctl2;
  79. int8_t rs_rssi_ext0;
  80. int8_t rs_rssi_ext1;
  81. int8_t rs_rssi_ext2;
  82. u8 rs_isaggr;
  83. u8 rs_moreaggr;
  84. u8 rs_num_delims;
  85. u8 rs_flags;
  86. u32 evm0;
  87. u32 evm1;
  88. u32 evm2;
  89. };
  90. #define ATH9K_RXERR_CRC 0x01
  91. #define ATH9K_RXERR_PHY 0x02
  92. #define ATH9K_RXERR_FIFO 0x04
  93. #define ATH9K_RXERR_DECRYPT 0x08
  94. #define ATH9K_RXERR_MIC 0x10
  95. #define ATH9K_RX_MORE 0x01
  96. #define ATH9K_RX_MORE_AGGR 0x02
  97. #define ATH9K_RX_GI 0x04
  98. #define ATH9K_RX_2040 0x08
  99. #define ATH9K_RX_DELIM_CRC_PRE 0x10
  100. #define ATH9K_RX_DELIM_CRC_POST 0x20
  101. #define ATH9K_RX_DECRYPT_BUSY 0x40
  102. #define ATH9K_RXKEYIX_INVALID ((u8)-1)
  103. #define ATH9K_TXKEYIX_INVALID ((u32)-1)
  104. struct ath_desc {
  105. u32 ds_link;
  106. u32 ds_data;
  107. u32 ds_ctl0;
  108. u32 ds_ctl1;
  109. u32 ds_hw[20];
  110. union {
  111. struct ath_tx_status tx;
  112. struct ath_rx_status rx;
  113. void *stats;
  114. } ds_us;
  115. void *ds_vdata;
  116. } __packed;
  117. #define ds_txstat ds_us.tx
  118. #define ds_rxstat ds_us.rx
  119. #define ds_stat ds_us.stats
  120. #define ATH9K_TXDESC_CLRDMASK 0x0001
  121. #define ATH9K_TXDESC_NOACK 0x0002
  122. #define ATH9K_TXDESC_RTSENA 0x0004
  123. #define ATH9K_TXDESC_CTSENA 0x0008
  124. #define ATH9K_TXDESC_INTREQ 0x0010
  125. #define ATH9K_TXDESC_VEOL 0x0020
  126. #define ATH9K_TXDESC_EXT_ONLY 0x0040
  127. #define ATH9K_TXDESC_EXT_AND_CTL 0x0080
  128. #define ATH9K_TXDESC_VMF 0x0100
  129. #define ATH9K_TXDESC_FRAG_IS_ON 0x0200
  130. #define ATH9K_RXDESC_INTREQ 0x0020
  131. enum ath9k_hw_caps {
  132. ATH9K_HW_CAP_CHAN_SPREAD = BIT(0),
  133. ATH9K_HW_CAP_MIC_AESCCM = BIT(1),
  134. ATH9K_HW_CAP_MIC_CKIP = BIT(2),
  135. ATH9K_HW_CAP_MIC_TKIP = BIT(3),
  136. ATH9K_HW_CAP_CIPHER_AESCCM = BIT(4),
  137. ATH9K_HW_CAP_CIPHER_CKIP = BIT(5),
  138. ATH9K_HW_CAP_CIPHER_TKIP = BIT(6),
  139. ATH9K_HW_CAP_VEOL = BIT(7),
  140. ATH9K_HW_CAP_BSSIDMASK = BIT(8),
  141. ATH9K_HW_CAP_MCAST_KEYSEARCH = BIT(9),
  142. ATH9K_HW_CAP_CHAN_HALFRATE = BIT(10),
  143. ATH9K_HW_CAP_CHAN_QUARTERRATE = BIT(11),
  144. ATH9K_HW_CAP_HT = BIT(12),
  145. ATH9K_HW_CAP_GTT = BIT(13),
  146. ATH9K_HW_CAP_FASTCC = BIT(14),
  147. ATH9K_HW_CAP_RFSILENT = BIT(15),
  148. ATH9K_HW_CAP_WOW = BIT(16),
  149. ATH9K_HW_CAP_CST = BIT(17),
  150. ATH9K_HW_CAP_ENHANCEDPM = BIT(18),
  151. ATH9K_HW_CAP_AUTOSLEEP = BIT(19),
  152. ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(20),
  153. ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT = BIT(21),
  154. };
  155. enum ath9k_capability_type {
  156. ATH9K_CAP_CIPHER = 0,
  157. ATH9K_CAP_TKIP_MIC,
  158. ATH9K_CAP_TKIP_SPLIT,
  159. ATH9K_CAP_PHYCOUNTERS,
  160. ATH9K_CAP_DIVERSITY,
  161. ATH9K_CAP_TXPOW,
  162. ATH9K_CAP_PHYDIAG,
  163. ATH9K_CAP_MCAST_KEYSRCH,
  164. ATH9K_CAP_TSF_ADJUST,
  165. ATH9K_CAP_WME_TKIPMIC,
  166. ATH9K_CAP_RFSILENT,
  167. ATH9K_CAP_ANT_CFG_2GHZ,
  168. ATH9K_CAP_ANT_CFG_5GHZ
  169. };
  170. struct ath9k_hw_capabilities {
  171. u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
  172. u32 wireless_modes;
  173. u16 total_queues;
  174. u16 keycache_size;
  175. u16 low_5ghz_chan, high_5ghz_chan;
  176. u16 low_2ghz_chan, high_2ghz_chan;
  177. u16 num_mr_retries;
  178. u16 rts_aggr_limit;
  179. u8 tx_chainmask;
  180. u8 rx_chainmask;
  181. u16 tx_triglevel_max;
  182. u16 reg_cap;
  183. u8 num_gpio_pins;
  184. u8 num_antcfg_2ghz;
  185. u8 num_antcfg_5ghz;
  186. };
  187. struct ath9k_ops_config {
  188. int dma_beacon_response_time;
  189. int sw_beacon_response_time;
  190. int additional_swba_backoff;
  191. int ack_6mb;
  192. int cwm_ignore_extcca;
  193. u8 pcie_powersave_enable;
  194. u8 pcie_l1skp_enable;
  195. u8 pcie_clock_req;
  196. u32 pcie_waen;
  197. int pcie_power_reset;
  198. u8 pcie_restore;
  199. u8 analog_shiftreg;
  200. u8 ht_enable;
  201. u32 ofdm_trig_low;
  202. u32 ofdm_trig_high;
  203. u32 cck_trig_high;
  204. u32 cck_trig_low;
  205. u32 enable_ani;
  206. u8 noise_immunity_level;
  207. u32 ofdm_weaksignal_det;
  208. u32 cck_weaksignal_thr;
  209. u8 spur_immunity_level;
  210. u8 firstep_level;
  211. int8_t rssi_thr_high;
  212. int8_t rssi_thr_low;
  213. u16 diversity_control;
  214. u16 antenna_switch_swap;
  215. int serialize_regmode;
  216. int intr_mitigation;
  217. #define SPUR_DISABLE 0
  218. #define SPUR_ENABLE_IOCTL 1
  219. #define SPUR_ENABLE_EEPROM 2
  220. #define AR_EEPROM_MODAL_SPURS 5
  221. #define AR_SPUR_5413_1 1640
  222. #define AR_SPUR_5413_2 1200
  223. #define AR_NO_SPUR 0x8000
  224. #define AR_BASE_FREQ_2GHZ 2300
  225. #define AR_BASE_FREQ_5GHZ 4900
  226. #define AR_SPUR_FEEQ_BOUND_HT40 19
  227. #define AR_SPUR_FEEQ_BOUND_HT20 10
  228. int spurmode;
  229. u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
  230. };
  231. enum ath9k_tx_queue {
  232. ATH9K_TX_QUEUE_INACTIVE = 0,
  233. ATH9K_TX_QUEUE_DATA,
  234. ATH9K_TX_QUEUE_BEACON,
  235. ATH9K_TX_QUEUE_CAB,
  236. ATH9K_TX_QUEUE_UAPSD,
  237. ATH9K_TX_QUEUE_PSPOLL
  238. };
  239. #define ATH9K_NUM_TX_QUEUES 10
  240. enum ath9k_tx_queue_subtype {
  241. ATH9K_WME_AC_BK = 0,
  242. ATH9K_WME_AC_BE,
  243. ATH9K_WME_AC_VI,
  244. ATH9K_WME_AC_VO,
  245. ATH9K_WME_UPSD
  246. };
  247. enum ath9k_tx_queue_flags {
  248. TXQ_FLAG_TXOKINT_ENABLE = 0x0001,
  249. TXQ_FLAG_TXERRINT_ENABLE = 0x0001,
  250. TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
  251. TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
  252. TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
  253. TXQ_FLAG_BACKOFF_DISABLE = 0x0010,
  254. TXQ_FLAG_COMPRESSION_ENABLE = 0x0020,
  255. TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040,
  256. TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080,
  257. };
  258. #define ATH9K_TXQ_USEDEFAULT ((u32) -1)
  259. #define ATH9K_DECOMP_MASK_SIZE 128
  260. #define ATH9K_READY_TIME_LO_BOUND 50
  261. #define ATH9K_READY_TIME_HI_BOUND 96
  262. enum ath9k_pkt_type {
  263. ATH9K_PKT_TYPE_NORMAL = 0,
  264. ATH9K_PKT_TYPE_ATIM,
  265. ATH9K_PKT_TYPE_PSPOLL,
  266. ATH9K_PKT_TYPE_BEACON,
  267. ATH9K_PKT_TYPE_PROBE_RESP,
  268. ATH9K_PKT_TYPE_CHIRP,
  269. ATH9K_PKT_TYPE_GRP_POLL,
  270. };
  271. struct ath9k_tx_queue_info {
  272. u32 tqi_ver;
  273. enum ath9k_tx_queue tqi_type;
  274. enum ath9k_tx_queue_subtype tqi_subtype;
  275. enum ath9k_tx_queue_flags tqi_qflags;
  276. u32 tqi_priority;
  277. u32 tqi_aifs;
  278. u32 tqi_cwmin;
  279. u32 tqi_cwmax;
  280. u16 tqi_shretry;
  281. u16 tqi_lgretry;
  282. u32 tqi_cbrPeriod;
  283. u32 tqi_cbrOverflowLimit;
  284. u32 tqi_burstTime;
  285. u32 tqi_readyTime;
  286. u32 tqi_physCompBuf;
  287. u32 tqi_intFlags;
  288. };
  289. enum ath9k_rx_filter {
  290. ATH9K_RX_FILTER_UCAST = 0x00000001,
  291. ATH9K_RX_FILTER_MCAST = 0x00000002,
  292. ATH9K_RX_FILTER_BCAST = 0x00000004,
  293. ATH9K_RX_FILTER_CONTROL = 0x00000008,
  294. ATH9K_RX_FILTER_BEACON = 0x00000010,
  295. ATH9K_RX_FILTER_PROM = 0x00000020,
  296. ATH9K_RX_FILTER_PROBEREQ = 0x00000080,
  297. ATH9K_RX_FILTER_PSPOLL = 0x00004000,
  298. ATH9K_RX_FILTER_PHYERR = 0x00000100,
  299. ATH9K_RX_FILTER_PHYRADAR = 0x00002000,
  300. };
  301. enum ath9k_int {
  302. ATH9K_INT_RX = 0x00000001,
  303. ATH9K_INT_RXDESC = 0x00000002,
  304. ATH9K_INT_RXNOFRM = 0x00000008,
  305. ATH9K_INT_RXEOL = 0x00000010,
  306. ATH9K_INT_RXORN = 0x00000020,
  307. ATH9K_INT_TX = 0x00000040,
  308. ATH9K_INT_TXDESC = 0x00000080,
  309. ATH9K_INT_TIM_TIMER = 0x00000100,
  310. ATH9K_INT_TXURN = 0x00000800,
  311. ATH9K_INT_MIB = 0x00001000,
  312. ATH9K_INT_RXPHY = 0x00004000,
  313. ATH9K_INT_RXKCM = 0x00008000,
  314. ATH9K_INT_SWBA = 0x00010000,
  315. ATH9K_INT_BMISS = 0x00040000,
  316. ATH9K_INT_BNR = 0x00100000,
  317. ATH9K_INT_TIM = 0x00200000,
  318. ATH9K_INT_DTIM = 0x00400000,
  319. ATH9K_INT_DTIMSYNC = 0x00800000,
  320. ATH9K_INT_GPIO = 0x01000000,
  321. ATH9K_INT_CABEND = 0x02000000,
  322. ATH9K_INT_CST = 0x10000000,
  323. ATH9K_INT_GTT = 0x20000000,
  324. ATH9K_INT_FATAL = 0x40000000,
  325. ATH9K_INT_GLOBAL = 0x80000000,
  326. ATH9K_INT_BMISC = ATH9K_INT_TIM |
  327. ATH9K_INT_DTIM |
  328. ATH9K_INT_DTIMSYNC |
  329. ATH9K_INT_CABEND,
  330. ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
  331. ATH9K_INT_RXDESC |
  332. ATH9K_INT_RXEOL |
  333. ATH9K_INT_RXORN |
  334. ATH9K_INT_TXURN |
  335. ATH9K_INT_TXDESC |
  336. ATH9K_INT_MIB |
  337. ATH9K_INT_RXPHY |
  338. ATH9K_INT_RXKCM |
  339. ATH9K_INT_SWBA |
  340. ATH9K_INT_BMISS |
  341. ATH9K_INT_GPIO,
  342. ATH9K_INT_NOCARD = 0xffffffff
  343. };
  344. struct ath9k_rate_table {
  345. int rateCount;
  346. u8 rateCodeToIndex[256];
  347. struct {
  348. u8 valid;
  349. u8 phy;
  350. u32 rateKbps;
  351. u8 rateCode;
  352. u8 shortPreamble;
  353. u8 dot11Rate;
  354. u8 controlRate;
  355. u16 lpAckDuration;
  356. u16 spAckDuration;
  357. } info[32];
  358. };
  359. #define ATH9K_RATESERIES_RTS_CTS 0x0001
  360. #define ATH9K_RATESERIES_2040 0x0002
  361. #define ATH9K_RATESERIES_HALFGI 0x0004
  362. struct ath9k_11n_rate_series {
  363. u32 Tries;
  364. u32 Rate;
  365. u32 PktDuration;
  366. u32 ChSel;
  367. u32 RateFlags;
  368. };
  369. #define CHANNEL_CW_INT 0x00002
  370. #define CHANNEL_CCK 0x00020
  371. #define CHANNEL_OFDM 0x00040
  372. #define CHANNEL_2GHZ 0x00080
  373. #define CHANNEL_5GHZ 0x00100
  374. #define CHANNEL_PASSIVE 0x00200
  375. #define CHANNEL_DYN 0x00400
  376. #define CHANNEL_HALF 0x04000
  377. #define CHANNEL_QUARTER 0x08000
  378. #define CHANNEL_HT20 0x10000
  379. #define CHANNEL_HT40PLUS 0x20000
  380. #define CHANNEL_HT40MINUS 0x40000
  381. #define CHANNEL_INTERFERENCE 0x01
  382. #define CHANNEL_DFS 0x02
  383. #define CHANNEL_4MS_LIMIT 0x04
  384. #define CHANNEL_DFS_CLEAR 0x08
  385. #define CHANNEL_DISALLOW_ADHOC 0x10
  386. #define CHANNEL_PER_11D_ADHOC 0x20
  387. #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
  388. #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
  389. #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
  390. #define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20)
  391. #define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20)
  392. #define CHANNEL_G_HT40PLUS (CHANNEL_2GHZ|CHANNEL_HT40PLUS)
  393. #define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS)
  394. #define CHANNEL_A_HT40PLUS (CHANNEL_5GHZ|CHANNEL_HT40PLUS)
  395. #define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS)
  396. #define CHANNEL_ALL \
  397. (CHANNEL_OFDM| \
  398. CHANNEL_CCK| \
  399. CHANNEL_2GHZ | \
  400. CHANNEL_5GHZ | \
  401. CHANNEL_HT20 | \
  402. CHANNEL_HT40PLUS | \
  403. CHANNEL_HT40MINUS)
  404. struct ath9k_channel {
  405. u16 channel;
  406. u32 channelFlags;
  407. u8 privFlags;
  408. int8_t maxRegTxPower;
  409. int8_t maxTxPower;
  410. int8_t minTxPower;
  411. u32 chanmode;
  412. int32_t CalValid;
  413. bool oneTimeCalsDone;
  414. int8_t iCoff;
  415. int8_t qCoff;
  416. int16_t rawNoiseFloor;
  417. int8_t antennaMax;
  418. u32 regDmnFlags;
  419. u32 conformanceTestLimit[3]; /* 0:11a, 1: 11b, 2:11g */
  420. #ifdef ATH_NF_PER_CHAN
  421. struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
  422. #endif
  423. };
  424. #define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \
  425. (((_c)->channelFlags & CHANNEL_A_HT20) == CHANNEL_A_HT20) || \
  426. (((_c)->channelFlags & CHANNEL_A_HT40PLUS) == CHANNEL_A_HT40PLUS) || \
  427. (((_c)->channelFlags & CHANNEL_A_HT40MINUS) == CHANNEL_A_HT40MINUS))
  428. #define IS_CHAN_B(_c) (((_c)->channelFlags & CHANNEL_B) == CHANNEL_B)
  429. #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
  430. (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \
  431. (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \
  432. (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS))
  433. #define IS_CHAN_CCK(_c) (((_c)->channelFlags & CHANNEL_CCK) != 0)
  434. #define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)
  435. #define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)
  436. #define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
  437. #define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)
  438. #define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
  439. #define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
  440. /* These macros check chanmode and not channelFlags */
  441. #define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) || \
  442. ((_c)->chanmode == CHANNEL_G_HT20))
  443. #define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) || \
  444. ((_c)->chanmode == CHANNEL_A_HT40MINUS) || \
  445. ((_c)->chanmode == CHANNEL_G_HT40PLUS) || \
  446. ((_c)->chanmode == CHANNEL_G_HT40MINUS))
  447. #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c)))
  448. #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)
  449. #define IS_CHAN_A_5MHZ_SPACED(_c) \
  450. ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \
  451. (((_c)->channel % 20) != 0) && \
  452. (((_c)->channel % 10) != 0))
  453. struct ath9k_keyval {
  454. u8 kv_type;
  455. u8 kv_pad;
  456. u16 kv_len;
  457. u8 kv_val[16];
  458. u8 kv_mic[8];
  459. u8 kv_txmic[8];
  460. };
  461. enum ath9k_key_type {
  462. ATH9K_KEY_TYPE_CLEAR,
  463. ATH9K_KEY_TYPE_WEP,
  464. ATH9K_KEY_TYPE_AES,
  465. ATH9K_KEY_TYPE_TKIP,
  466. };
  467. enum ath9k_cipher {
  468. ATH9K_CIPHER_WEP = 0,
  469. ATH9K_CIPHER_AES_OCB = 1,
  470. ATH9K_CIPHER_AES_CCM = 2,
  471. ATH9K_CIPHER_CKIP = 3,
  472. ATH9K_CIPHER_TKIP = 4,
  473. ATH9K_CIPHER_CLR = 5,
  474. ATH9K_CIPHER_MIC = 127
  475. };
  476. #define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001
  477. #define AR_EEPROM_EEPCAP_AES_DIS 0x0002
  478. #define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004
  479. #define AR_EEPROM_EEPCAP_BURST_DIS 0x0008
  480. #define AR_EEPROM_EEPCAP_MAXQCU 0x01F0
  481. #define AR_EEPROM_EEPCAP_MAXQCU_S 4
  482. #define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200
  483. #define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000
  484. #define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12
  485. #define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  486. #define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  487. #define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  488. #define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  489. #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  490. #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  491. #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000
  492. #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000
  493. #define SD_NO_CTL 0xE0
  494. #define NO_CTL 0xff
  495. #define CTL_MODE_M 7
  496. #define CTL_11A 0
  497. #define CTL_11B 1
  498. #define CTL_11G 2
  499. #define CTL_2GHT20 5
  500. #define CTL_5GHT20 6
  501. #define CTL_2GHT40 7
  502. #define CTL_5GHT40 8
  503. #define AR_EEPROM_MAC(i) (0x1d+(i))
  504. #define EEP_SCALE 100
  505. #define EEP_DELTA 10
  506. #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c
  507. #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2
  508. #define AR_EEPROM_RFSILENT_POLARITY 0x0002
  509. #define AR_EEPROM_RFSILENT_POLARITY_S 1
  510. #define CTRY_DEBUG 0x1ff
  511. #define CTRY_DEFAULT 0
  512. enum reg_ext_bitmap {
  513. REG_EXT_JAPAN_MIDBAND = 1,
  514. REG_EXT_FCC_DFS_HT40 = 2,
  515. REG_EXT_JAPAN_NONDFS_HT40 = 3,
  516. REG_EXT_JAPAN_DFS_HT40 = 4
  517. };
  518. struct ath9k_country_entry {
  519. u16 countryCode;
  520. u16 regDmnEnum;
  521. u16 regDmn5G;
  522. u16 regDmn2G;
  523. u8 isMultidomain;
  524. u8 iso[3];
  525. };
  526. #define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sh + _reg)
  527. #define REG_READ(_ah, _reg) ioread32(_ah->ah_sh + _reg)
  528. #define SM(_v, _f) (((_v) << _f##_S) & _f)
  529. #define MS(_v, _f) (((_v) & _f) >> _f##_S)
  530. #define REG_RMW(_a, _r, _set, _clr) \
  531. REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set))
  532. #define REG_RMW_FIELD(_a, _r, _f, _v) \
  533. REG_WRITE(_a, _r, \
  534. (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f))
  535. #define REG_SET_BIT(_a, _r, _f) \
  536. REG_WRITE(_a, _r, REG_READ(_a, _r) | _f)
  537. #define REG_CLR_BIT(_a, _r, _f) \
  538. REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f)
  539. #define ATH9K_COMP_BUF_MAX_SIZE 9216
  540. #define ATH9K_COMP_BUF_ALIGN_SIZE 512
  541. #define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
  542. #define INIT_AIFS 2
  543. #define INIT_CWMIN 15
  544. #define INIT_CWMIN_11B 31
  545. #define INIT_CWMAX 1023
  546. #define INIT_SH_RETRY 10
  547. #define INIT_LG_RETRY 10
  548. #define INIT_SSH_RETRY 32
  549. #define INIT_SLG_RETRY 32
  550. #define WLAN_CTRL_FRAME_SIZE (2+2+6+4)
  551. #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
  552. #define ATH_AMPDU_LIMIT_DEFAULT ATH_AMPDU_LIMIT_MAX
  553. #define IEEE80211_WEP_IVLEN 3
  554. #define IEEE80211_WEP_KIDLEN 1
  555. #define IEEE80211_WEP_CRCLEN 4
  556. #define IEEE80211_MAX_MPDU_LEN (3840 + FCS_LEN + \
  557. (IEEE80211_WEP_IVLEN + \
  558. IEEE80211_WEP_KIDLEN + \
  559. IEEE80211_WEP_CRCLEN))
  560. #define IEEE80211_MAX_LEN (2300 + FCS_LEN + \
  561. (IEEE80211_WEP_IVLEN + \
  562. IEEE80211_WEP_KIDLEN + \
  563. IEEE80211_WEP_CRCLEN))
  564. #define MAX_REG_ADD_COUNT 129
  565. #define MAX_RATE_POWER 63
  566. enum ath9k_power_mode {
  567. ATH9K_PM_AWAKE = 0,
  568. ATH9K_PM_FULL_SLEEP,
  569. ATH9K_PM_NETWORK_SLEEP,
  570. ATH9K_PM_UNDEFINED
  571. };
  572. #define HAL_ANTENNA_MIN_MODE 0
  573. #define HAL_ANTENNA_FIXED_A 1
  574. #define HAL_ANTENNA_FIXED_B 2
  575. #define HAL_ANTENNA_MAX_MODE 3
  576. struct ath9k_mib_stats {
  577. u32 ackrcv_bad;
  578. u32 rts_bad;
  579. u32 rts_good;
  580. u32 fcs_bad;
  581. u32 beacons;
  582. };
  583. enum ath9k_ant_setting {
  584. ATH9K_ANT_VARIABLE = 0,
  585. ATH9K_ANT_FIXED_A,
  586. ATH9K_ANT_FIXED_B
  587. };
  588. enum ath9k_opmode {
  589. ATH9K_M_STA = 1,
  590. ATH9K_M_IBSS = 0,
  591. ATH9K_M_HOSTAP = 6,
  592. ATH9K_M_MONITOR = 8
  593. };
  594. #define ATH9K_SLOT_TIME_6 6
  595. #define ATH9K_SLOT_TIME_9 9
  596. #define ATH9K_SLOT_TIME_20 20
  597. enum ath9k_ht_macmode {
  598. ATH9K_HT_MACMODE_20 = 0,
  599. ATH9K_HT_MACMODE_2040 = 1,
  600. };
  601. enum ath9k_ht_extprotspacing {
  602. ATH9K_HT_EXTPROTSPACING_20 = 0,
  603. ATH9K_HT_EXTPROTSPACING_25 = 1,
  604. };
  605. struct ath9k_ht_cwm {
  606. enum ath9k_ht_macmode ht_macmode;
  607. enum ath9k_ht_extprotspacing ht_extprotspacing;
  608. };
  609. enum hal_freq_band {
  610. HAL_FREQ_BAND_5GHZ = 0,
  611. HAL_FREQ_BAND_2GHZ = 1,
  612. };
  613. enum ath9k_ani_cmd {
  614. ATH9K_ANI_PRESENT = 0x1,
  615. ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
  616. ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
  617. ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
  618. ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
  619. ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
  620. ATH9K_ANI_MODE = 0x40,
  621. ATH9K_ANI_PHYERR_RESET = 0x80,
  622. ATH9K_ANI_ALL = 0xff
  623. };
  624. enum phytype {
  625. PHY_DS,
  626. PHY_FH,
  627. PHY_OFDM,
  628. PHY_HT,
  629. PHY_MAX
  630. };
  631. #define PHY_CCK PHY_DS
  632. enum start_adhoc_option {
  633. START_ADHOC_NO_11A,
  634. START_ADHOC_PER_11D,
  635. START_ADHOC_IN_11A,
  636. START_ADHOC_IN_11B,
  637. };
  638. enum ath9k_tp_scale {
  639. ATH9K_TP_SCALE_MAX = 0,
  640. ATH9K_TP_SCALE_50,
  641. ATH9K_TP_SCALE_25,
  642. ATH9K_TP_SCALE_12,
  643. ATH9K_TP_SCALE_MIN
  644. };
  645. enum ser_reg_mode {
  646. SER_REG_MODE_OFF = 0,
  647. SER_REG_MODE_ON = 1,
  648. SER_REG_MODE_AUTO = 2,
  649. };
  650. #define AR_PHY_CCA_MAX_GOOD_VALUE -85
  651. #define AR_PHY_CCA_MAX_HIGH_VALUE -62
  652. #define AR_PHY_CCA_MIN_BAD_VALUE -121
  653. #define AR_PHY_CCA_FILTERWINDOW_LENGTH_INIT 3
  654. #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5
  655. #define ATH9K_NF_CAL_HIST_MAX 5
  656. #define NUM_NF_READINGS 6
  657. struct ath9k_nfcal_hist {
  658. int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX];
  659. u8 currIndex;
  660. int16_t privNF;
  661. u8 invalidNFcount;
  662. };
  663. struct ath9k_beacon_state {
  664. u32 bs_nexttbtt;
  665. u32 bs_nextdtim;
  666. u32 bs_intval;
  667. #define ATH9K_BEACON_PERIOD 0x0000ffff
  668. #define ATH9K_BEACON_ENA 0x00800000
  669. #define ATH9K_BEACON_RESET_TSF 0x01000000
  670. u32 bs_dtimperiod;
  671. u16 bs_cfpperiod;
  672. u16 bs_cfpmaxduration;
  673. u32 bs_cfpnext;
  674. u16 bs_timoffset;
  675. u16 bs_bmissthreshold;
  676. u32 bs_sleepduration;
  677. };
  678. struct ath9k_node_stats {
  679. u32 ns_avgbrssi;
  680. u32 ns_avgrssi;
  681. u32 ns_avgtxrssi;
  682. u32 ns_avgtxrate;
  683. };
  684. #define ATH9K_RSSI_EP_MULTIPLIER (1<<7)
  685. enum ath9k_gpio_output_mux_type {
  686. ATH9K_GPIO_OUTPUT_MUX_AS_OUTPUT,
  687. ATH9K_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED,
  688. ATH9K_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED,
  689. ATH9K_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED,
  690. ATH9K_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED,
  691. ATH9K_GPIO_OUTPUT_MUX_NUM_ENTRIES
  692. };
  693. enum {
  694. ATH9K_RESET_POWER_ON,
  695. ATH9K_RESET_WARM,
  696. ATH9K_RESET_COLD,
  697. };
  698. #define AH_USE_EEPROM 0x1
  699. struct ath_hal {
  700. u32 ah_magic;
  701. u16 ah_devid;
  702. u16 ah_subvendorid;
  703. struct ath_softc *ah_sc;
  704. void __iomem *ah_sh;
  705. u16 ah_countryCode;
  706. u32 ah_macVersion;
  707. u16 ah_macRev;
  708. u16 ah_phyRev;
  709. u16 ah_analog5GhzRev;
  710. u16 ah_analog2GhzRev;
  711. u8 ah_decompMask[ATH9K_DECOMP_MASK_SIZE];
  712. u32 ah_flags;
  713. enum ath9k_opmode ah_opmode;
  714. struct ath9k_ops_config ah_config;
  715. struct ath9k_hw_capabilities ah_caps;
  716. int16_t ah_powerLimit;
  717. u16 ah_maxPowerLevel;
  718. u32 ah_tpScale;
  719. u16 ah_currentRD;
  720. u16 ah_currentRDExt;
  721. u16 ah_currentRDInUse;
  722. u16 ah_currentRD5G;
  723. u16 ah_currentRD2G;
  724. char ah_iso[4];
  725. enum start_adhoc_option ah_adHocMode;
  726. bool ah_commonMode;
  727. struct ath9k_channel ah_channels[150];
  728. u32 ah_nchan;
  729. struct ath9k_channel *ah_curchan;
  730. u16 ah_rfsilent;
  731. bool ah_rfkillEnabled;
  732. bool ah_isPciExpress;
  733. u16 ah_txTrigLevel;
  734. #ifndef ATH_NF_PER_CHAN
  735. struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
  736. #endif
  737. };
  738. enum wireless_mode {
  739. WIRELESS_MODE_11a = 0,
  740. WIRELESS_MODE_11b = 2,
  741. WIRELESS_MODE_11g = 3,
  742. WIRELESS_MODE_11NA_HT20 = 6,
  743. WIRELESS_MODE_11NG_HT20 = 7,
  744. WIRELESS_MODE_11NA_HT40PLUS = 8,
  745. WIRELESS_MODE_11NA_HT40MINUS = 9,
  746. WIRELESS_MODE_11NG_HT40PLUS = 10,
  747. WIRELESS_MODE_11NG_HT40MINUS = 11,
  748. WIRELESS_MODE_MAX
  749. };
  750. enum {
  751. ATH9K_MODE_SEL_11A = 0x00001,
  752. ATH9K_MODE_SEL_11B = 0x00002,
  753. ATH9K_MODE_SEL_11G = 0x00004,
  754. ATH9K_MODE_SEL_11NG_HT20 = 0x00008,
  755. ATH9K_MODE_SEL_11NA_HT20 = 0x00010,
  756. ATH9K_MODE_SEL_11NG_HT40PLUS = 0x00020,
  757. ATH9K_MODE_SEL_11NG_HT40MINUS = 0x00040,
  758. ATH9K_MODE_SEL_11NA_HT40PLUS = 0x00080,
  759. ATH9K_MODE_SEL_11NA_HT40MINUS = 0x00100,
  760. ATH9K_MODE_SEL_2GHZ = (ATH9K_MODE_SEL_11B |
  761. ATH9K_MODE_SEL_11G |
  762. ATH9K_MODE_SEL_11NG_HT20),
  763. ATH9K_MODE_SEL_5GHZ = (ATH9K_MODE_SEL_11A |
  764. ATH9K_MODE_SEL_11NA_HT20),
  765. ATH9K_MODE_SEL_ALL = 0xffffffff
  766. };
  767. struct chan_centers {
  768. u16 synth_center;
  769. u16 ctl_center;
  770. u16 ext_center;
  771. };
  772. int ath_hal_getcapability(struct ath_hal *ah,
  773. enum ath9k_capability_type type,
  774. u32 capability,
  775. u32 *result);
  776. const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah,
  777. u32 mode);
  778. void ath9k_hw_detach(struct ath_hal *ah);
  779. struct ath_hal *ath9k_hw_attach(u16 devid,
  780. struct ath_softc *sc,
  781. void __iomem *mem,
  782. int *error);
  783. bool ath9k_regd_init_channels(struct ath_hal *ah,
  784. u32 maxchans, u32 *nchans,
  785. u8 *regclassids,
  786. u32 maxregids, u32 *nregids,
  787. u16 cc, u32 modeSelect,
  788. bool enableOutdoor,
  789. bool enableExtendedChannels);
  790. u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags);
  791. enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah,
  792. enum ath9k_int ints);
  793. bool ath9k_hw_reset(struct ath_hal *ah, enum ath9k_opmode opmode,
  794. struct ath9k_channel *chan,
  795. enum ath9k_ht_macmode macmode,
  796. u8 txchainmask, u8 rxchainmask,
  797. enum ath9k_ht_extprotspacing extprotspacing,
  798. bool bChannelChange,
  799. int *status);
  800. bool ath9k_hw_phy_disable(struct ath_hal *ah);
  801. void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
  802. bool *isCalDone);
  803. void ath9k_hw_ani_monitor(struct ath_hal *ah,
  804. const struct ath9k_node_stats *stats,
  805. struct ath9k_channel *chan);
  806. bool ath9k_hw_calibrate(struct ath_hal *ah,
  807. struct ath9k_channel *chan,
  808. u8 rxchainmask,
  809. bool longcal,
  810. bool *isCalDone);
  811. int16_t ath9k_hw_getchan_noise(struct ath_hal *ah,
  812. struct ath9k_channel *chan);
  813. void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid,
  814. u16 assocId);
  815. void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits);
  816. void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid,
  817. u16 assocId);
  818. bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q);
  819. void ath9k_hw_reset_tsf(struct ath_hal *ah);
  820. bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry);
  821. bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry,
  822. const u8 *mac);
  823. bool ath9k_hw_set_keycache_entry(struct ath_hal *ah,
  824. u16 entry,
  825. const struct ath9k_keyval *k,
  826. const u8 *mac,
  827. int xorKey);
  828. bool ath9k_hw_set_tsfadjust(struct ath_hal *ah,
  829. u32 setting);
  830. void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore);
  831. bool ath9k_hw_intrpend(struct ath_hal *ah);
  832. bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked);
  833. bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah,
  834. bool bIncTrigLevel);
  835. void ath9k_hw_procmibevent(struct ath_hal *ah,
  836. const struct ath9k_node_stats *stats);
  837. bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set);
  838. void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode);
  839. bool ath9k_hw_phycounters(struct ath_hal *ah);
  840. bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry);
  841. bool ath9k_hw_getcapability(struct ath_hal *ah,
  842. enum ath9k_capability_type type,
  843. u32 capability,
  844. u32 *result);
  845. bool ath9k_hw_setcapability(struct ath_hal *ah,
  846. enum ath9k_capability_type type,
  847. u32 capability,
  848. u32 setting,
  849. int *status);
  850. u32 ath9k_hw_getdefantenna(struct ath_hal *ah);
  851. void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac);
  852. void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask);
  853. bool ath9k_hw_setbssidmask(struct ath_hal *ah,
  854. const u8 *mask);
  855. bool ath9k_hw_setpower(struct ath_hal *ah,
  856. enum ath9k_power_mode mode);
  857. enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah);
  858. u64 ath9k_hw_gettsf64(struct ath_hal *ah);
  859. u32 ath9k_hw_getdefantenna(struct ath_hal *ah);
  860. bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us);
  861. bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
  862. enum ath9k_ant_setting settings,
  863. struct ath9k_channel *chan,
  864. u8 *tx_chainmask,
  865. u8 *rx_chainmask,
  866. u8 *antenna_cfgd);
  867. void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna);
  868. int ath9k_hw_select_antconfig(struct ath_hal *ah,
  869. u32 cfg);
  870. bool ath9k_hw_puttxbuf(struct ath_hal *ah, u32 q,
  871. u32 txdp);
  872. bool ath9k_hw_txstart(struct ath_hal *ah, u32 q);
  873. u16 ath9k_hw_computetxtime(struct ath_hal *ah,
  874. const struct ath9k_rate_table *rates,
  875. u32 frameLen, u16 rateix,
  876. bool shortPreamble);
  877. void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
  878. struct ath_desc *lastds,
  879. u32 durUpdateEn, u32 rtsctsRate,
  880. u32 rtsctsDuration,
  881. struct ath9k_11n_rate_series series[],
  882. u32 nseries, u32 flags);
  883. void ath9k_hw_set11n_burstduration(struct ath_hal *ah,
  884. struct ath_desc *ds,
  885. u32 burstDuration);
  886. void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds);
  887. u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  888. bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q);
  889. u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan);
  890. u32 ath9k_regd_get_antenna_allowed(struct ath_hal *ah,
  891. struct ath9k_channel *chan);
  892. u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags);
  893. bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
  894. struct ath9k_tx_queue_info *qinfo);
  895. bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
  896. const struct ath9k_tx_queue_info *qinfo);
  897. struct ath9k_channel *ath9k_regd_check_channel(struct ath_hal *ah,
  898. const struct ath9k_channel *c);
  899. void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
  900. u32 pktLen, enum ath9k_pkt_type type,
  901. u32 txPower, u32 keyIx,
  902. enum ath9k_key_type keyType, u32 flags);
  903. bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds,
  904. u32 segLen, bool firstSeg,
  905. bool lastSeg,
  906. const struct ath_desc *ds0);
  907. u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah,
  908. u32 *rxc_pcnt,
  909. u32 *rxf_pcnt,
  910. u32 *txf_pcnt);
  911. void ath9k_hw_dmaRegDump(struct ath_hal *ah);
  912. void ath9k_hw_beaconinit(struct ath_hal *ah,
  913. u32 next_beacon, u32 beacon_period);
  914. void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah,
  915. const struct ath9k_beacon_state *bs);
  916. bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds,
  917. u32 size, u32 flags);
  918. void ath9k_hw_putrxbuf(struct ath_hal *ah, u32 rxdp);
  919. void ath9k_hw_rxena(struct ath_hal *ah);
  920. void ath9k_hw_setopmode(struct ath_hal *ah);
  921. bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
  922. void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0,
  923. u32 filter1);
  924. u32 ath9k_hw_getrxfilter(struct ath_hal *ah);
  925. void ath9k_hw_startpcureceive(struct ath_hal *ah);
  926. void ath9k_hw_stoppcurecv(struct ath_hal *ah);
  927. bool ath9k_hw_stopdmarecv(struct ath_hal *ah);
  928. int ath9k_hw_rxprocdesc(struct ath_hal *ah,
  929. struct ath_desc *ds, u32 pa,
  930. struct ath_desc *nds, u64 tsf);
  931. u32 ath9k_hw_gettxbuf(struct ath_hal *ah, u32 q);
  932. int ath9k_hw_txprocdesc(struct ath_hal *ah,
  933. struct ath_desc *ds);
  934. void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds,
  935. u32 numDelims);
  936. void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds,
  937. u32 aggrLen);
  938. void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds);
  939. bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q);
  940. void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u32 *txqs);
  941. void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds);
  942. void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah,
  943. struct ath_desc *ds, u32 vmf);
  944. bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit);
  945. bool ath9k_regd_is_public_safety_sku(struct ath_hal *ah);
  946. int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
  947. const struct ath9k_tx_queue_info *qinfo);
  948. u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q);
  949. const char *ath9k_hw_probe(u16 vendorid, u16 devid);
  950. bool ath9k_hw_disable(struct ath_hal *ah);
  951. void ath9k_hw_rfdetach(struct ath_hal *ah);
  952. void ath9k_hw_get_channel_centers(struct ath_hal *ah,
  953. struct ath9k_channel *chan,
  954. struct chan_centers *centers);
  955. bool ath9k_get_channel_edges(struct ath_hal *ah,
  956. u16 flags, u16 *low,
  957. u16 *high);
  958. #endif