mac.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. /*
  2. * Copyright (c) 2008-2011 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 MAC_H
  17. #define MAC_H
  18. #include <net/cfg80211.h>
  19. #define set11nTries(_series, _index) \
  20. (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
  21. #define set11nRate(_series, _index) \
  22. (SM((_series)[_index].Rate, AR_XmitRate##_index))
  23. #define set11nPktDurRTSCTS(_series, _index) \
  24. (SM((_series)[_index].PktDuration, AR_PacketDur##_index) | \
  25. ((_series)[_index].RateFlags & ATH9K_RATESERIES_RTS_CTS ? \
  26. AR_RTSCTSQual##_index : 0))
  27. #define set11nRateFlags(_series, _index) \
  28. (((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ? \
  29. AR_2040_##_index : 0) \
  30. |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ? \
  31. AR_GI##_index : 0) \
  32. |((_series)[_index].RateFlags & ATH9K_RATESERIES_STBC ? \
  33. AR_STBC##_index : 0))
  34. #define set11nChainSel(_series, _index) \
  35. (SM((_series)[_index].ChSel, AR_ChainSel##_index))
  36. #define CCK_SIFS_TIME 10
  37. #define CCK_PREAMBLE_BITS 144
  38. #define CCK_PLCP_BITS 48
  39. #define OFDM_SIFS_TIME 16
  40. #define OFDM_PREAMBLE_TIME 20
  41. #define OFDM_PLCP_BITS 22
  42. #define OFDM_SYMBOL_TIME 4
  43. #define OFDM_SIFS_TIME_HALF 32
  44. #define OFDM_PREAMBLE_TIME_HALF 40
  45. #define OFDM_PLCP_BITS_HALF 22
  46. #define OFDM_SYMBOL_TIME_HALF 8
  47. #define OFDM_SIFS_TIME_QUARTER 64
  48. #define OFDM_PREAMBLE_TIME_QUARTER 80
  49. #define OFDM_PLCP_BITS_QUARTER 22
  50. #define OFDM_SYMBOL_TIME_QUARTER 16
  51. #define INIT_AIFS 2
  52. #define INIT_CWMIN 15
  53. #define INIT_CWMIN_11B 31
  54. #define INIT_CWMAX 1023
  55. #define INIT_SH_RETRY 10
  56. #define INIT_LG_RETRY 10
  57. #define INIT_SSH_RETRY 32
  58. #define INIT_SLG_RETRY 32
  59. #define ATH9K_TXERR_XRETRY 0x01
  60. #define ATH9K_TXERR_FILT 0x02
  61. #define ATH9K_TXERR_FIFO 0x04
  62. #define ATH9K_TXERR_XTXOP 0x08
  63. #define ATH9K_TXERR_TIMER_EXPIRED 0x10
  64. #define ATH9K_TX_ACKED 0x20
  65. #define ATH9K_TX_FLUSH 0x40
  66. #define ATH9K_TXERR_MASK \
  67. (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \
  68. ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED | ATH9K_TX_FLUSH)
  69. #define ATH9K_TX_BA 0x01
  70. #define ATH9K_TX_PWRMGMT 0x02
  71. #define ATH9K_TX_DESC_CFG_ERR 0x04
  72. #define ATH9K_TX_DATA_UNDERRUN 0x08
  73. #define ATH9K_TX_DELIM_UNDERRUN 0x10
  74. #define ATH9K_TX_SW_FILTERED 0x80
  75. /* 64 bytes */
  76. #define MIN_TX_FIFO_THRESHOLD 0x1
  77. /*
  78. * Single stream device AR9285 and AR9271 require 2 KB
  79. * to work around a hardware issue, all other devices
  80. * have can use the max 4 KB limit.
  81. */
  82. #define MAX_TX_FIFO_THRESHOLD ((4096 / 64) - 1)
  83. struct ath_tx_status {
  84. u32 ts_tstamp;
  85. u16 ts_seqnum;
  86. u8 ts_status;
  87. u8 ts_rateindex;
  88. int8_t ts_rssi;
  89. u8 ts_shortretry;
  90. u8 ts_longretry;
  91. u8 ts_virtcol;
  92. u8 ts_flags;
  93. int8_t ts_rssi_ctl0;
  94. int8_t ts_rssi_ctl1;
  95. int8_t ts_rssi_ctl2;
  96. int8_t ts_rssi_ext0;
  97. int8_t ts_rssi_ext1;
  98. int8_t ts_rssi_ext2;
  99. u8 qid;
  100. u16 desc_id;
  101. u8 tid;
  102. struct_group(ba,
  103. u32 ba_low;
  104. u32 ba_high;
  105. );
  106. u32 evm0;
  107. u32 evm1;
  108. u32 evm2;
  109. u32 duration;
  110. };
  111. struct ath_rx_status {
  112. u32 rs_tstamp;
  113. u16 rs_datalen;
  114. u8 rs_status;
  115. u8 rs_phyerr;
  116. int8_t rs_rssi;
  117. u8 rs_keyix;
  118. u8 rs_rate;
  119. u8 rs_antenna;
  120. u8 rs_more;
  121. int8_t rs_rssi_ctl[3];
  122. int8_t rs_rssi_ext[3];
  123. u8 rs_isaggr;
  124. u8 rs_firstaggr;
  125. u8 rs_moreaggr;
  126. u8 rs_num_delims;
  127. u8 rs_flags;
  128. bool is_mybeacon;
  129. u32 evm0;
  130. u32 evm1;
  131. u32 evm2;
  132. u32 evm3;
  133. u32 evm4;
  134. u16 enc_flags;
  135. enum rate_info_bw bw;
  136. };
  137. struct ath_htc_rx_status {
  138. __be64 rs_tstamp;
  139. __be16 rs_datalen;
  140. u8 rs_status;
  141. u8 rs_phyerr;
  142. int8_t rs_rssi;
  143. int8_t rs_rssi_ctl[3];
  144. int8_t rs_rssi_ext[3];
  145. u8 rs_keyix;
  146. u8 rs_rate;
  147. u8 rs_antenna;
  148. u8 rs_more;
  149. u8 rs_isaggr;
  150. u8 rs_moreaggr;
  151. u8 rs_num_delims;
  152. u8 rs_flags;
  153. u8 rs_dummy;
  154. /* FIXME: evm* never used? */
  155. __be32 evm0;
  156. __be32 evm1;
  157. __be32 evm2;
  158. };
  159. #define ATH9K_RXERR_CRC 0x01
  160. #define ATH9K_RXERR_PHY 0x02
  161. #define ATH9K_RXERR_FIFO 0x04
  162. #define ATH9K_RXERR_DECRYPT 0x08
  163. #define ATH9K_RXERR_MIC 0x10
  164. #define ATH9K_RXERR_KEYMISS 0x20
  165. #define ATH9K_RXERR_CORRUPT_DESC 0x40
  166. #define ATH9K_RX_MORE 0x01
  167. #define ATH9K_RX_MORE_AGGR 0x02
  168. #define ATH9K_RX_GI 0x04
  169. #define ATH9K_RX_2040 0x08
  170. #define ATH9K_RX_DELIM_CRC_PRE 0x10
  171. #define ATH9K_RX_DELIM_CRC_POST 0x20
  172. #define ATH9K_RX_DECRYPT_BUSY 0x40
  173. #define ATH9K_RXKEYIX_INVALID ((u8)-1)
  174. #define ATH9K_TXKEYIX_INVALID ((u8)-1)
  175. enum ath9k_phyerr {
  176. ATH9K_PHYERR_UNDERRUN = 0, /* Transmit underrun */
  177. ATH9K_PHYERR_TIMING = 1, /* Timing error */
  178. ATH9K_PHYERR_PARITY = 2, /* Illegal parity */
  179. ATH9K_PHYERR_RATE = 3, /* Illegal rate */
  180. ATH9K_PHYERR_LENGTH = 4, /* Illegal length */
  181. ATH9K_PHYERR_RADAR = 5, /* Radar detect */
  182. ATH9K_PHYERR_SERVICE = 6, /* Illegal service */
  183. ATH9K_PHYERR_TOR = 7, /* Transmit override receive */
  184. ATH9K_PHYERR_OFDM_TIMING = 17,
  185. ATH9K_PHYERR_OFDM_SIGNAL_PARITY = 18,
  186. ATH9K_PHYERR_OFDM_RATE_ILLEGAL = 19,
  187. ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL = 20,
  188. ATH9K_PHYERR_OFDM_POWER_DROP = 21,
  189. ATH9K_PHYERR_OFDM_SERVICE = 22,
  190. ATH9K_PHYERR_OFDM_RESTART = 23,
  191. ATH9K_PHYERR_CCK_BLOCKER = 24,
  192. ATH9K_PHYERR_CCK_TIMING = 25,
  193. ATH9K_PHYERR_CCK_HEADER_CRC = 26,
  194. ATH9K_PHYERR_CCK_RATE_ILLEGAL = 27,
  195. ATH9K_PHYERR_CCK_LENGTH_ILLEGAL = 28,
  196. ATH9K_PHYERR_CCK_POWER_DROP = 29,
  197. ATH9K_PHYERR_CCK_SERVICE = 30,
  198. ATH9K_PHYERR_CCK_RESTART = 31,
  199. ATH9K_PHYERR_HT_CRC_ERROR = 32,
  200. ATH9K_PHYERR_HT_LENGTH_ILLEGAL = 33,
  201. ATH9K_PHYERR_HT_RATE_ILLEGAL = 34,
  202. ATH9K_PHYERR_HT_ZLF = 35,
  203. ATH9K_PHYERR_FALSE_RADAR_EXT = 36,
  204. ATH9K_PHYERR_GREEN_FIELD = 37,
  205. ATH9K_PHYERR_SPECTRAL = 38,
  206. ATH9K_PHYERR_MAX = 39,
  207. };
  208. struct ath_desc {
  209. u32 ds_link;
  210. u32 ds_data;
  211. u32 ds_ctl0;
  212. u32 ds_ctl1;
  213. u32 ds_hw[20];
  214. void *ds_vdata;
  215. } __packed __aligned(4);
  216. #define ATH9K_TXDESC_NOACK 0x0002
  217. #define ATH9K_TXDESC_RTSENA 0x0004
  218. #define ATH9K_TXDESC_CTSENA 0x0008
  219. /* ATH9K_TXDESC_INTREQ forces a tx interrupt to be generated for
  220. * the descriptor its marked on. We take a tx interrupt to reap
  221. * descriptors when the h/w hits an EOL condition or
  222. * when the descriptor is specifically marked to generate
  223. * an interrupt with this flag. Descriptors should be
  224. * marked periodically to insure timely replenishing of the
  225. * supply needed for sending frames. Defering interrupts
  226. * reduces system load and potentially allows more concurrent
  227. * work to be done but if done to aggressively can cause
  228. * senders to backup. When the hardware queue is left too
  229. * large rate control information may also be too out of
  230. * date. An Alternative for this is TX interrupt mitigation
  231. * but this needs more testing. */
  232. #define ATH9K_TXDESC_INTREQ 0x0010
  233. #define ATH9K_TXDESC_VEOL 0x0020
  234. #define ATH9K_TXDESC_EXT_ONLY 0x0040
  235. #define ATH9K_TXDESC_EXT_AND_CTL 0x0080
  236. #define ATH9K_TXDESC_VMF 0x0100
  237. #define ATH9K_TXDESC_FRAG_IS_ON 0x0200
  238. #define ATH9K_TXDESC_LOWRXCHAIN 0x0400
  239. #define ATH9K_TXDESC_LDPC 0x0800
  240. #define ATH9K_TXDESC_CLRDMASK 0x1000
  241. #define ATH9K_TXDESC_PAPRD 0x70000
  242. #define ATH9K_TXDESC_PAPRD_S 16
  243. #define ATH9K_RXDESC_INTREQ 0x0020
  244. struct ar5416_desc {
  245. u32 ds_link;
  246. u32 ds_data;
  247. u32 ds_ctl0;
  248. u32 ds_ctl1;
  249. union {
  250. struct {
  251. u32 ctl2;
  252. u32 ctl3;
  253. u32 ctl4;
  254. u32 ctl5;
  255. u32 ctl6;
  256. u32 ctl7;
  257. u32 ctl8;
  258. u32 ctl9;
  259. u32 ctl10;
  260. u32 ctl11;
  261. u32 status0;
  262. u32 status1;
  263. u32 status2;
  264. u32 status3;
  265. u32 status4;
  266. u32 status5;
  267. u32 status6;
  268. u32 status7;
  269. u32 status8;
  270. u32 status9;
  271. } tx;
  272. struct {
  273. u32 status0;
  274. u32 status1;
  275. u32 status2;
  276. u32 status3;
  277. u32 status4;
  278. u32 status5;
  279. u32 status6;
  280. u32 status7;
  281. u32 status8;
  282. } rx;
  283. } u;
  284. } __packed __aligned(4);
  285. #define AR5416DESC(_ds) ((struct ar5416_desc *)(_ds))
  286. #define AR5416DESC_CONST(_ds) ((const struct ar5416_desc *)(_ds))
  287. #define ds_ctl2 u.tx.ctl2
  288. #define ds_ctl3 u.tx.ctl3
  289. #define ds_ctl4 u.tx.ctl4
  290. #define ds_ctl5 u.tx.ctl5
  291. #define ds_ctl6 u.tx.ctl6
  292. #define ds_ctl7 u.tx.ctl7
  293. #define ds_ctl8 u.tx.ctl8
  294. #define ds_ctl9 u.tx.ctl9
  295. #define ds_ctl10 u.tx.ctl10
  296. #define ds_ctl11 u.tx.ctl11
  297. #define ds_txstatus0 u.tx.status0
  298. #define ds_txstatus1 u.tx.status1
  299. #define ds_txstatus2 u.tx.status2
  300. #define ds_txstatus3 u.tx.status3
  301. #define ds_txstatus4 u.tx.status4
  302. #define ds_txstatus5 u.tx.status5
  303. #define ds_txstatus6 u.tx.status6
  304. #define ds_txstatus7 u.tx.status7
  305. #define ds_txstatus8 u.tx.status8
  306. #define ds_txstatus9 u.tx.status9
  307. #define ds_rxstatus0 u.rx.status0
  308. #define ds_rxstatus1 u.rx.status1
  309. #define ds_rxstatus2 u.rx.status2
  310. #define ds_rxstatus3 u.rx.status3
  311. #define ds_rxstatus4 u.rx.status4
  312. #define ds_rxstatus5 u.rx.status5
  313. #define ds_rxstatus6 u.rx.status6
  314. #define ds_rxstatus7 u.rx.status7
  315. #define ds_rxstatus8 u.rx.status8
  316. #define AR_FrameLen 0x00000fff
  317. #define AR_VirtMoreFrag 0x00001000
  318. #define AR_TxCtlRsvd00 0x0000e000
  319. #define AR_XmitPower0 0x003f0000
  320. #define AR_XmitPower0_S 16
  321. #define AR_XmitPower1 0x3f000000
  322. #define AR_XmitPower1_S 24
  323. #define AR_XmitPower2 0x3f000000
  324. #define AR_XmitPower2_S 24
  325. #define AR_XmitPower3 0x3f000000
  326. #define AR_XmitPower3_S 24
  327. #define AR_RTSEnable 0x00400000
  328. #define AR_VEOL 0x00800000
  329. #define AR_ClrDestMask 0x01000000
  330. #define AR_TxCtlRsvd01 0x1e000000
  331. #define AR_TxIntrReq 0x20000000
  332. #define AR_DestIdxValid 0x40000000
  333. #define AR_CTSEnable 0x80000000
  334. #define AR_TxMore 0x00001000
  335. #define AR_DestIdx 0x000fe000
  336. #define AR_DestIdx_S 13
  337. #define AR_FrameType 0x00f00000
  338. #define AR_FrameType_S 20
  339. #define AR_NoAck 0x01000000
  340. #define AR_InsertTS 0x02000000
  341. #define AR_CorruptFCS 0x04000000
  342. #define AR_ExtOnly 0x08000000
  343. #define AR_ExtAndCtl 0x10000000
  344. #define AR_MoreAggr 0x20000000
  345. #define AR_IsAggr 0x40000000
  346. #define AR_BurstDur 0x00007fff
  347. #define AR_BurstDur_S 0
  348. #define AR_DurUpdateEna 0x00008000
  349. #define AR_XmitDataTries0 0x000f0000
  350. #define AR_XmitDataTries0_S 16
  351. #define AR_XmitDataTries1 0x00f00000
  352. #define AR_XmitDataTries1_S 20
  353. #define AR_XmitDataTries2 0x0f000000
  354. #define AR_XmitDataTries2_S 24
  355. #define AR_XmitDataTries3 0xf0000000
  356. #define AR_XmitDataTries3_S 28
  357. #define AR_XmitRate0 0x000000ff
  358. #define AR_XmitRate0_S 0
  359. #define AR_XmitRate1 0x0000ff00
  360. #define AR_XmitRate1_S 8
  361. #define AR_XmitRate2 0x00ff0000
  362. #define AR_XmitRate2_S 16
  363. #define AR_XmitRate3 0xff000000
  364. #define AR_XmitRate3_S 24
  365. #define AR_PacketDur0 0x00007fff
  366. #define AR_PacketDur0_S 0
  367. #define AR_RTSCTSQual0 0x00008000
  368. #define AR_PacketDur1 0x7fff0000
  369. #define AR_PacketDur1_S 16
  370. #define AR_RTSCTSQual1 0x80000000
  371. #define AR_PacketDur2 0x00007fff
  372. #define AR_PacketDur2_S 0
  373. #define AR_RTSCTSQual2 0x00008000
  374. #define AR_PacketDur3 0x7fff0000
  375. #define AR_PacketDur3_S 16
  376. #define AR_RTSCTSQual3 0x80000000
  377. #define AR_AggrLen 0x0000ffff
  378. #define AR_AggrLen_S 0
  379. #define AR_TxCtlRsvd60 0x00030000
  380. #define AR_PadDelim 0x03fc0000
  381. #define AR_PadDelim_S 18
  382. #define AR_EncrType 0x0c000000
  383. #define AR_EncrType_S 26
  384. #define AR_TxCtlRsvd61 0xf0000000
  385. #define AR_LDPC 0x80000000
  386. #define AR_2040_0 0x00000001
  387. #define AR_GI0 0x00000002
  388. #define AR_ChainSel0 0x0000001c
  389. #define AR_ChainSel0_S 2
  390. #define AR_2040_1 0x00000020
  391. #define AR_GI1 0x00000040
  392. #define AR_ChainSel1 0x00000380
  393. #define AR_ChainSel1_S 7
  394. #define AR_2040_2 0x00000400
  395. #define AR_GI2 0x00000800
  396. #define AR_ChainSel2 0x00007000
  397. #define AR_ChainSel2_S 12
  398. #define AR_2040_3 0x00008000
  399. #define AR_GI3 0x00010000
  400. #define AR_ChainSel3 0x000e0000
  401. #define AR_ChainSel3_S 17
  402. #define AR_RTSCTSRate 0x0ff00000
  403. #define AR_RTSCTSRate_S 20
  404. #define AR_STBC0 0x10000000
  405. #define AR_STBC1 0x20000000
  406. #define AR_STBC2 0x40000000
  407. #define AR_STBC3 0x80000000
  408. #define AR_TxRSSIAnt00 0x000000ff
  409. #define AR_TxRSSIAnt00_S 0
  410. #define AR_TxRSSIAnt01 0x0000ff00
  411. #define AR_TxRSSIAnt01_S 8
  412. #define AR_TxRSSIAnt02 0x00ff0000
  413. #define AR_TxRSSIAnt02_S 16
  414. #define AR_TxStatusRsvd00 0x3f000000
  415. #define AR_TxBaStatus 0x40000000
  416. #define AR_TxStatusRsvd01 0x80000000
  417. /*
  418. * AR_FrmXmitOK - Frame transmission success flag. If set, the frame was
  419. * transmitted successfully. If clear, no ACK or BA was received to indicate
  420. * successful transmission when we were expecting an ACK or BA.
  421. */
  422. #define AR_FrmXmitOK 0x00000001
  423. #define AR_ExcessiveRetries 0x00000002
  424. #define AR_FIFOUnderrun 0x00000004
  425. #define AR_Filtered 0x00000008
  426. #define AR_RTSFailCnt 0x000000f0
  427. #define AR_RTSFailCnt_S 4
  428. #define AR_DataFailCnt 0x00000f00
  429. #define AR_DataFailCnt_S 8
  430. #define AR_VirtRetryCnt 0x0000f000
  431. #define AR_VirtRetryCnt_S 12
  432. #define AR_TxDelimUnderrun 0x00010000
  433. #define AR_TxDataUnderrun 0x00020000
  434. #define AR_DescCfgErr 0x00040000
  435. #define AR_TxTimerExpired 0x00080000
  436. #define AR_TxStatusRsvd10 0xfff00000
  437. #define AR_SendTimestamp ds_txstatus2
  438. #define AR_BaBitmapLow ds_txstatus3
  439. #define AR_BaBitmapHigh ds_txstatus4
  440. #define AR_TxRSSIAnt10 0x000000ff
  441. #define AR_TxRSSIAnt10_S 0
  442. #define AR_TxRSSIAnt11 0x0000ff00
  443. #define AR_TxRSSIAnt11_S 8
  444. #define AR_TxRSSIAnt12 0x00ff0000
  445. #define AR_TxRSSIAnt12_S 16
  446. #define AR_TxRSSICombined 0xff000000
  447. #define AR_TxRSSICombined_S 24
  448. #define AR_TxTid 0xf0000000
  449. #define AR_TxTid_S 28
  450. #define AR_TxEVM0 ds_txstatus5
  451. #define AR_TxEVM1 ds_txstatus6
  452. #define AR_TxEVM2 ds_txstatus7
  453. #define AR_TxDone 0x00000001
  454. #define AR_SeqNum 0x00001ffe
  455. #define AR_SeqNum_S 1
  456. #define AR_TxStatusRsvd80 0x0001e000
  457. #define AR_TxOpExceeded 0x00020000
  458. #define AR_TxStatusRsvd81 0x001c0000
  459. #define AR_FinalTxIdx 0x00600000
  460. #define AR_FinalTxIdx_S 21
  461. #define AR_TxStatusRsvd82 0x01800000
  462. #define AR_PowerMgmt 0x02000000
  463. #define AR_TxStatusRsvd83 0xfc000000
  464. #define AR_RxCTLRsvd00 0xffffffff
  465. #define AR_RxCtlRsvd00 0x00001000
  466. #define AR_RxIntrReq 0x00002000
  467. #define AR_RxCtlRsvd01 0xffffc000
  468. #define AR_RxRSSIAnt00 0x000000ff
  469. #define AR_RxRSSIAnt00_S 0
  470. #define AR_RxRSSIAnt01 0x0000ff00
  471. #define AR_RxRSSIAnt01_S 8
  472. #define AR_RxRSSIAnt02 0x00ff0000
  473. #define AR_RxRSSIAnt02_S 16
  474. #define AR_RxRate 0xff000000
  475. #define AR_RxRate_S 24
  476. #define AR_RxStatusRsvd00 0xff000000
  477. #define AR_DataLen 0x00000fff
  478. #define AR_RxMore 0x00001000
  479. #define AR_NumDelim 0x003fc000
  480. #define AR_NumDelim_S 14
  481. #define AR_RxStatusRsvd10 0xff800000
  482. #define AR_RcvTimestamp ds_rxstatus2
  483. #define AR_GI 0x00000001
  484. #define AR_2040 0x00000002
  485. #define AR_Parallel40 0x00000004
  486. #define AR_Parallel40_S 2
  487. #define AR_STBC 0x00000008 /* on ar9280 and later */
  488. #define AR_RxStatusRsvd30 0x000000f0
  489. #define AR_RxAntenna 0xffffff00
  490. #define AR_RxAntenna_S 8
  491. #define AR_RxRSSIAnt10 0x000000ff
  492. #define AR_RxRSSIAnt10_S 0
  493. #define AR_RxRSSIAnt11 0x0000ff00
  494. #define AR_RxRSSIAnt11_S 8
  495. #define AR_RxRSSIAnt12 0x00ff0000
  496. #define AR_RxRSSIAnt12_S 16
  497. #define AR_RxRSSICombined 0xff000000
  498. #define AR_RxRSSICombined_S 24
  499. #define AR_RxEVM0 ds_rxstatus4
  500. #define AR_RxEVM1 ds_rxstatus5
  501. #define AR_RxEVM2 ds_rxstatus6
  502. #define AR_RxDone 0x00000001
  503. #define AR_RxFrameOK 0x00000002
  504. #define AR_CRCErr 0x00000004
  505. #define AR_DecryptCRCErr 0x00000008
  506. #define AR_PHYErr 0x00000010
  507. #define AR_MichaelErr 0x00000020
  508. #define AR_PreDelimCRCErr 0x00000040
  509. #define AR_RxStatusRsvd70 0x00000080
  510. #define AR_RxKeyIdxValid 0x00000100
  511. #define AR_KeyIdx 0x0000fe00
  512. #define AR_KeyIdx_S 9
  513. #define AR_PHYErrCode 0x0000ff00
  514. #define AR_PHYErrCode_S 8
  515. #define AR_RxMoreAggr 0x00010000
  516. #define AR_RxAggr 0x00020000
  517. #define AR_PostDelimCRCErr 0x00040000
  518. #define AR_RxStatusRsvd71 0x3ff80000
  519. #define AR_RxFirstAggr 0x20000000
  520. #define AR_DecryptBusyErr 0x40000000
  521. #define AR_KeyMiss 0x80000000
  522. enum ath9k_tx_queue {
  523. ATH9K_TX_QUEUE_INACTIVE = 0,
  524. ATH9K_TX_QUEUE_DATA,
  525. ATH9K_TX_QUEUE_BEACON,
  526. ATH9K_TX_QUEUE_CAB,
  527. ATH9K_TX_QUEUE_UAPSD,
  528. ATH9K_TX_QUEUE_PSPOLL
  529. };
  530. #define ATH9K_NUM_TX_QUEUES 10
  531. /* Used as a queue subtype instead of a WMM AC */
  532. #define ATH9K_WME_UPSD 4
  533. enum ath9k_tx_queue_flags {
  534. TXQ_FLAG_TXINT_ENABLE = 0x0001,
  535. TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
  536. TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
  537. TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
  538. TXQ_FLAG_BACKOFF_DISABLE = 0x0010,
  539. TXQ_FLAG_COMPRESSION_ENABLE = 0x0020,
  540. TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040,
  541. TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080,
  542. };
  543. #define ATH9K_TXQ_USEDEFAULT ((u32) -1)
  544. #define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
  545. #define ATH9K_DECOMP_MASK_SIZE 128
  546. enum ath9k_pkt_type {
  547. ATH9K_PKT_TYPE_NORMAL = 0,
  548. ATH9K_PKT_TYPE_ATIM,
  549. ATH9K_PKT_TYPE_PSPOLL,
  550. ATH9K_PKT_TYPE_BEACON,
  551. ATH9K_PKT_TYPE_PROBE_RESP,
  552. ATH9K_PKT_TYPE_CHIRP,
  553. ATH9K_PKT_TYPE_GRP_POLL,
  554. };
  555. struct ath9k_tx_queue_info {
  556. u32 tqi_ver;
  557. enum ath9k_tx_queue tqi_type;
  558. int tqi_subtype;
  559. enum ath9k_tx_queue_flags tqi_qflags;
  560. u32 tqi_priority;
  561. u32 tqi_aifs;
  562. u32 tqi_cwmin;
  563. u32 tqi_cwmax;
  564. u16 tqi_shretry;
  565. u16 tqi_lgretry;
  566. u32 tqi_cbrPeriod;
  567. u32 tqi_cbrOverflowLimit;
  568. u32 tqi_burstTime;
  569. u32 tqi_readyTime;
  570. u32 tqi_physCompBuf;
  571. u32 tqi_intFlags;
  572. };
  573. enum ath9k_rx_filter {
  574. ATH9K_RX_FILTER_UCAST = 0x00000001,
  575. ATH9K_RX_FILTER_MCAST = 0x00000002,
  576. ATH9K_RX_FILTER_BCAST = 0x00000004,
  577. ATH9K_RX_FILTER_CONTROL = 0x00000008,
  578. ATH9K_RX_FILTER_BEACON = 0x00000010,
  579. ATH9K_RX_FILTER_PROM = 0x00000020,
  580. ATH9K_RX_FILTER_PROBEREQ = 0x00000080,
  581. ATH9K_RX_FILTER_PHYERR = 0x00000100,
  582. ATH9K_RX_FILTER_MYBEACON = 0x00000200,
  583. ATH9K_RX_FILTER_COMP_BAR = 0x00000400,
  584. ATH9K_RX_FILTER_COMP_BA = 0x00000800,
  585. ATH9K_RX_FILTER_UNCOMP_BA_BAR = 0x00001000,
  586. ATH9K_RX_FILTER_PSPOLL = 0x00004000,
  587. ATH9K_RX_FILTER_PHYRADAR = 0x00002000,
  588. ATH9K_RX_FILTER_MCAST_BCAST_ALL = 0x00008000,
  589. ATH9K_RX_FILTER_CONTROL_WRAPPER = 0x00080000,
  590. ATH9K_RX_FILTER_4ADDRESS = 0x00100000,
  591. };
  592. #define ATH9K_RATESERIES_RTS_CTS 0x0001
  593. #define ATH9K_RATESERIES_2040 0x0002
  594. #define ATH9K_RATESERIES_HALFGI 0x0004
  595. #define ATH9K_RATESERIES_STBC 0x0008
  596. struct ath9k_11n_rate_series {
  597. u32 Tries;
  598. u32 Rate;
  599. u32 PktDuration;
  600. u32 ChSel;
  601. u32 RateFlags;
  602. };
  603. enum aggr_type {
  604. AGGR_BUF_NONE,
  605. AGGR_BUF_FIRST,
  606. AGGR_BUF_MIDDLE,
  607. AGGR_BUF_LAST,
  608. };
  609. enum ath9k_key_type {
  610. ATH9K_KEY_TYPE_CLEAR,
  611. ATH9K_KEY_TYPE_WEP,
  612. ATH9K_KEY_TYPE_AES,
  613. ATH9K_KEY_TYPE_TKIP,
  614. };
  615. struct ath_tx_info {
  616. u8 qcu;
  617. bool is_first;
  618. bool is_last;
  619. enum aggr_type aggr;
  620. u8 ndelim;
  621. u16 aggr_len;
  622. dma_addr_t link;
  623. int pkt_len;
  624. u32 flags;
  625. dma_addr_t buf_addr[4];
  626. int buf_len[4];
  627. struct ath9k_11n_rate_series rates[4];
  628. u8 rtscts_rate;
  629. bool dur_update;
  630. enum ath9k_pkt_type type;
  631. enum ath9k_key_type keytype;
  632. u8 keyix;
  633. u8 txpower[4];
  634. };
  635. struct ath_hw;
  636. struct ath9k_channel;
  637. enum ath9k_int;
  638. u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q);
  639. void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp);
  640. void ath9k_hw_txstart(struct ath_hw *ah, u32 q);
  641. u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
  642. bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
  643. bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q);
  644. void ath9k_hw_abort_tx_dma(struct ath_hw *ah);
  645. bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
  646. const struct ath9k_tx_queue_info *qinfo);
  647. bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q,
  648. struct ath9k_tx_queue_info *qinfo);
  649. int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type,
  650. const struct ath9k_tx_queue_info *qinfo);
  651. bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q);
  652. bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q);
  653. int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
  654. struct ath_rx_status *rs);
  655. void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
  656. u32 size, u32 flags);
  657. bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set);
  658. void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
  659. void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning);
  660. void ath9k_hw_abortpcurecv(struct ath_hw *ah);
  661. bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset);
  662. int ath9k_hw_beaconq_setup(struct ath_hw *ah);
  663. void ath9k_hw_set_tx_filter(struct ath_hw *ah, u8 destidx, bool set);
  664. /* Interrupt Handling */
  665. bool ath9k_hw_intrpend(struct ath_hw *ah);
  666. void ath9k_hw_set_interrupts(struct ath_hw *ah);
  667. void ath9k_hw_enable_interrupts(struct ath_hw *ah);
  668. void ath9k_hw_disable_interrupts(struct ath_hw *ah);
  669. void ath9k_hw_kill_interrupts(struct ath_hw *ah);
  670. void ath9k_hw_resume_interrupts(struct ath_hw *ah);
  671. void ar9002_hw_attach_mac_ops(struct ath_hw *ah);
  672. #endif /* MAC_H */