iwl-commands.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU Geeral Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * James P. Ketrenos <ipw2100-admin@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __iwl_commands_h__
  64. #define __iwl_commands_h__
  65. enum {
  66. REPLY_ALIVE = 0x1,
  67. REPLY_ERROR = 0x2,
  68. /* RXON and QOS commands */
  69. REPLY_RXON = 0x10,
  70. REPLY_RXON_ASSOC = 0x11,
  71. REPLY_QOS_PARAM = 0x13,
  72. REPLY_RXON_TIMING = 0x14,
  73. /* Multi-Station support */
  74. REPLY_ADD_STA = 0x18,
  75. REPLY_REMOVE_STA = 0x19, /* not used */
  76. REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
  77. /* RX, TX, LEDs */
  78. #if IWL == 3945
  79. REPLY_3945_RX = 0x1b, /* 3945 only */
  80. #endif
  81. REPLY_TX = 0x1c,
  82. REPLY_RATE_SCALE = 0x47, /* 3945 only */
  83. REPLY_LEDS_CMD = 0x48,
  84. REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
  85. /* 802.11h related */
  86. RADAR_NOTIFICATION = 0x70, /* not used */
  87. REPLY_QUIET_CMD = 0x71, /* not used */
  88. REPLY_CHANNEL_SWITCH = 0x72,
  89. CHANNEL_SWITCH_NOTIFICATION = 0x73,
  90. REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
  91. SPECTRUM_MEASURE_NOTIFICATION = 0x75,
  92. /* Power Management */
  93. POWER_TABLE_CMD = 0x77,
  94. PM_SLEEP_NOTIFICATION = 0x7A,
  95. PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
  96. /* Scan commands and notifications */
  97. REPLY_SCAN_CMD = 0x80,
  98. REPLY_SCAN_ABORT_CMD = 0x81,
  99. SCAN_START_NOTIFICATION = 0x82,
  100. SCAN_RESULTS_NOTIFICATION = 0x83,
  101. SCAN_COMPLETE_NOTIFICATION = 0x84,
  102. /* IBSS/AP commands */
  103. BEACON_NOTIFICATION = 0x90,
  104. REPLY_TX_BEACON = 0x91,
  105. WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
  106. /* Miscellaneous commands */
  107. QUIET_NOTIFICATION = 0x96, /* not used */
  108. REPLY_TX_PWR_TABLE_CMD = 0x97,
  109. MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
  110. /* BT config command */
  111. REPLY_BT_CONFIG = 0x9b,
  112. /* 4965 Statistics */
  113. REPLY_STATISTICS_CMD = 0x9c,
  114. STATISTICS_NOTIFICATION = 0x9d,
  115. /* RF-KILL commands and notifications */
  116. REPLY_CARD_STATE_CMD = 0xa0,
  117. CARD_STATE_NOTIFICATION = 0xa1,
  118. /* Missed beacons notification */
  119. MISSED_BEACONS_NOTIFICATION = 0xa2,
  120. #if IWL == 4965
  121. REPLY_CT_KILL_CONFIG_CMD = 0xa4,
  122. SENSITIVITY_CMD = 0xa8,
  123. REPLY_PHY_CALIBRATION_CMD = 0xb0,
  124. REPLY_RX_PHY_CMD = 0xc0,
  125. REPLY_RX_MPDU_CMD = 0xc1,
  126. REPLY_4965_RX = 0xc3,
  127. REPLY_COMPRESSED_BA = 0xc5,
  128. #endif
  129. REPLY_MAX = 0xff
  130. };
  131. /******************************************************************************
  132. * (0)
  133. * Header
  134. *
  135. *****************************************************************************/
  136. #define IWL_CMD_FAILED_MSK 0x40
  137. struct iwl_cmd_header {
  138. u8 cmd;
  139. u8 flags;
  140. /* We have 15 LSB to use as we please (MSB indicates
  141. * a frame Rx'd from the HW). We encode the following
  142. * information into the sequence field:
  143. *
  144. * 0:7 index in fifo
  145. * 8:13 fifo selection
  146. * 14:14 bit indicating if this packet references the 'extra'
  147. * storage at the end of the memory queue
  148. * 15:15 (Rx indication)
  149. *
  150. */
  151. __le16 sequence;
  152. /* command data follows immediately */
  153. u8 data[0];
  154. } __attribute__ ((packed));
  155. /******************************************************************************
  156. * (0a)
  157. * Alive and Error Commands & Responses:
  158. *
  159. *****************************************************************************/
  160. #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
  161. #define INITIALIZE_SUBTYPE (9)
  162. /*
  163. * REPLY_ALIVE = 0x1 (response only, not a command)
  164. */
  165. struct iwl_alive_resp {
  166. u8 ucode_minor;
  167. u8 ucode_major;
  168. __le16 reserved1;
  169. u8 sw_rev[8];
  170. u8 ver_type;
  171. u8 ver_subtype;
  172. __le16 reserved2;
  173. __le32 log_event_table_ptr;
  174. __le32 error_event_table_ptr;
  175. __le32 timestamp;
  176. __le32 is_valid;
  177. } __attribute__ ((packed));
  178. struct iwl_init_alive_resp {
  179. u8 ucode_minor;
  180. u8 ucode_major;
  181. __le16 reserved1;
  182. u8 sw_rev[8];
  183. u8 ver_type;
  184. u8 ver_subtype;
  185. __le16 reserved2;
  186. __le32 log_event_table_ptr;
  187. __le32 error_event_table_ptr;
  188. __le32 timestamp;
  189. __le32 is_valid;
  190. #if IWL == 4965
  191. /* calibration values from "initialize" uCode */
  192. __le32 voltage; /* signed */
  193. __le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */
  194. __le32 therm_r2[2]; /* signed */
  195. __le32 therm_r3[2]; /* signed */
  196. __le32 therm_r4[2]; /* signed */
  197. __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
  198. * 2 Tx chains */
  199. #endif
  200. } __attribute__ ((packed));
  201. union tsf {
  202. u8 byte[8];
  203. __le16 word[4];
  204. __le32 dw[2];
  205. };
  206. /*
  207. * REPLY_ERROR = 0x2 (response only, not a command)
  208. */
  209. struct iwl_error_resp {
  210. __le32 error_type;
  211. u8 cmd_id;
  212. u8 reserved1;
  213. __le16 bad_cmd_seq_num;
  214. #if IWL == 3945
  215. __le16 reserved2;
  216. #endif
  217. __le32 error_info;
  218. union tsf timestamp;
  219. } __attribute__ ((packed));
  220. /******************************************************************************
  221. * (1)
  222. * RXON Commands & Responses:
  223. *
  224. *****************************************************************************/
  225. /*
  226. * Rx config defines & structure
  227. */
  228. /* rx_config device types */
  229. enum {
  230. RXON_DEV_TYPE_AP = 1,
  231. RXON_DEV_TYPE_ESS = 3,
  232. RXON_DEV_TYPE_IBSS = 4,
  233. RXON_DEV_TYPE_SNIFFER = 6,
  234. };
  235. /* rx_config flags */
  236. /* band & modulation selection */
  237. #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
  238. #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
  239. /* auto detection enable */
  240. #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
  241. /* TGg protection when tx */
  242. #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
  243. /* cck short slot & preamble */
  244. #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
  245. #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
  246. /* antenna selection */
  247. #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
  248. #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
  249. #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  250. #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  251. /* radar detection enable */
  252. #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
  253. #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
  254. /* rx response to host with 8-byte TSF
  255. * (according to ON_AIR deassertion) */
  256. #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
  257. /* rx_config filter flags */
  258. /* accept all data frames */
  259. #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
  260. /* pass control & management to host */
  261. #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
  262. /* accept multi-cast */
  263. #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
  264. /* don't decrypt uni-cast frames */
  265. #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
  266. /* don't decrypt multi-cast frames */
  267. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
  268. /* STA is associated */
  269. #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
  270. /* transfer to host non bssid beacons in associated state */
  271. #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
  272. /*
  273. * REPLY_RXON = 0x10 (command, has simple generic response)
  274. */
  275. struct iwl_rxon_cmd {
  276. u8 node_addr[6];
  277. __le16 reserved1;
  278. u8 bssid_addr[6];
  279. __le16 reserved2;
  280. u8 wlap_bssid_addr[6];
  281. __le16 reserved3;
  282. u8 dev_type;
  283. u8 air_propagation;
  284. #if IWL == 3945
  285. __le16 reserved4;
  286. #elif IWL == 4965
  287. __le16 rx_chain;
  288. #endif
  289. u8 ofdm_basic_rates;
  290. u8 cck_basic_rates;
  291. __le16 assoc_id;
  292. __le32 flags;
  293. __le32 filter_flags;
  294. __le16 channel;
  295. #if IWL == 3945
  296. __le16 reserved5;
  297. #elif IWL == 4965
  298. u8 ofdm_ht_single_stream_basic_rates;
  299. u8 ofdm_ht_dual_stream_basic_rates;
  300. #endif
  301. } __attribute__ ((packed));
  302. /*
  303. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  304. */
  305. struct iwl_rxon_assoc_cmd {
  306. __le32 flags;
  307. __le32 filter_flags;
  308. u8 ofdm_basic_rates;
  309. u8 cck_basic_rates;
  310. #if IWL == 4965
  311. u8 ofdm_ht_single_stream_basic_rates;
  312. u8 ofdm_ht_dual_stream_basic_rates;
  313. __le16 rx_chain_select_flags;
  314. #endif
  315. __le16 reserved;
  316. } __attribute__ ((packed));
  317. /*
  318. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  319. */
  320. struct iwl_rxon_time_cmd {
  321. union tsf timestamp;
  322. __le16 beacon_interval;
  323. __le16 atim_window;
  324. __le32 beacon_init_val;
  325. __le16 listen_interval;
  326. __le16 reserved;
  327. } __attribute__ ((packed));
  328. struct iwl_tx_power {
  329. u8 tx_gain; /* gain for analog radio */
  330. u8 dsp_atten; /* gain for DSP */
  331. } __attribute__ ((packed));
  332. #if IWL == 3945
  333. struct iwl_power_per_rate {
  334. u8 rate; /* plcp */
  335. struct iwl_tx_power tpc;
  336. u8 reserved;
  337. } __attribute__ ((packed));
  338. #elif IWL == 4965
  339. #define POWER_TABLE_NUM_ENTRIES 33
  340. #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
  341. #define POWER_TABLE_CCK_ENTRY 32
  342. struct tx_power_dual_stream {
  343. __le32 dw;
  344. } __attribute__ ((packed));
  345. struct iwl_tx_power_db {
  346. struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
  347. } __attribute__ ((packed));
  348. #endif
  349. /*
  350. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  351. */
  352. struct iwl_channel_switch_cmd {
  353. u8 band;
  354. u8 expect_beacon;
  355. __le16 channel;
  356. __le32 rxon_flags;
  357. __le32 rxon_filter_flags;
  358. __le32 switch_time;
  359. #if IWL == 3945
  360. struct iwl_power_per_rate power[IWL_MAX_RATES];
  361. #elif IWL == 4965
  362. struct iwl_tx_power_db tx_power;
  363. #endif
  364. } __attribute__ ((packed));
  365. /*
  366. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  367. */
  368. struct iwl_csa_notification {
  369. __le16 band;
  370. __le16 channel;
  371. __le32 status; /* 0 - OK, 1 - fail */
  372. } __attribute__ ((packed));
  373. /******************************************************************************
  374. * (2)
  375. * Quality-of-Service (QOS) Commands & Responses:
  376. *
  377. *****************************************************************************/
  378. struct iwl_ac_qos {
  379. __le16 cw_min;
  380. __le16 cw_max;
  381. u8 aifsn;
  382. u8 reserved1;
  383. __le16 edca_txop;
  384. } __attribute__ ((packed));
  385. /* QoS flags defines */
  386. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
  387. #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
  388. #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
  389. /*
  390. * TXFIFO Queue number defines
  391. */
  392. /* number of Access categories (AC) (EDCA), queues 0..3 */
  393. #define AC_NUM 4
  394. /*
  395. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  396. */
  397. struct iwl_qosparam_cmd {
  398. __le32 qos_flags;
  399. struct iwl_ac_qos ac[AC_NUM];
  400. } __attribute__ ((packed));
  401. /******************************************************************************
  402. * (3)
  403. * Add/Modify Stations Commands & Responses:
  404. *
  405. *****************************************************************************/
  406. /*
  407. * Multi station support
  408. */
  409. #define IWL_AP_ID 0
  410. #define IWL_MULTICAST_ID 1
  411. #define IWL_STA_ID 2
  412. #define IWL3945_BROADCAST_ID 24
  413. #define IWL3945_STATION_COUNT 25
  414. #define IWL4965_BROADCAST_ID 31
  415. #define IWL4965_STATION_COUNT 32
  416. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  417. #define IWL_INVALID_STATION 255
  418. #if IWL == 3945
  419. #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);
  420. #endif
  421. #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
  422. #define STA_CONTROL_MODIFY_MSK 0x01
  423. /* key flags __le16*/
  424. #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
  425. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
  426. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
  427. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
  428. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
  429. #define STA_KEY_FLG_KEYID_POS 8
  430. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  431. /* modify flags */
  432. #define STA_MODIFY_KEY_MASK 0x01
  433. #define STA_MODIFY_TID_DISABLE_TX 0x02
  434. #define STA_MODIFY_TX_RATE_MSK 0x04
  435. #define STA_MODIFY_ADDBA_TID_MSK 0x08
  436. #define STA_MODIFY_DELBA_TID_MSK 0x10
  437. #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
  438. /*
  439. * Antenna masks:
  440. * bit14:15 01 B inactive, A active
  441. * 10 B active, A inactive
  442. * 11 Both active
  443. */
  444. #define RATE_MCS_ANT_A_POS 14
  445. #define RATE_MCS_ANT_B_POS 15
  446. #define RATE_MCS_ANT_A_MSK 0x4000
  447. #define RATE_MCS_ANT_B_MSK 0x8000
  448. #define RATE_MCS_ANT_AB_MSK 0xc000
  449. struct iwl_keyinfo {
  450. __le16 key_flags;
  451. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  452. u8 reserved1;
  453. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  454. __le16 reserved2;
  455. u8 key[16]; /* 16-byte unicast decryption key */
  456. } __attribute__ ((packed));
  457. struct sta_id_modify {
  458. u8 addr[ETH_ALEN];
  459. __le16 reserved1;
  460. u8 sta_id;
  461. u8 modify_mask;
  462. __le16 reserved2;
  463. } __attribute__ ((packed));
  464. /*
  465. * REPLY_ADD_STA = 0x18 (command)
  466. */
  467. struct iwl_addsta_cmd {
  468. u8 mode;
  469. u8 reserved[3];
  470. struct sta_id_modify sta;
  471. struct iwl_keyinfo key;
  472. __le32 station_flags;
  473. __le32 station_flags_msk;
  474. __le16 tid_disable_tx;
  475. #if IWL == 3945
  476. __le16 rate_n_flags;
  477. #else
  478. __le16 reserved1;
  479. #endif
  480. u8 add_immediate_ba_tid;
  481. u8 remove_immediate_ba_tid;
  482. __le16 add_immediate_ba_ssn;
  483. #if IWL == 4965
  484. __le32 reserved2;
  485. #endif
  486. } __attribute__ ((packed));
  487. /*
  488. * REPLY_ADD_STA = 0x18 (response)
  489. */
  490. struct iwl_add_sta_resp {
  491. u8 status;
  492. } __attribute__ ((packed));
  493. #define ADD_STA_SUCCESS_MSK 0x1
  494. /******************************************************************************
  495. * (4)
  496. * Rx Responses:
  497. *
  498. *****************************************************************************/
  499. struct iwl_rx_frame_stats {
  500. u8 phy_count;
  501. u8 id;
  502. u8 rssi;
  503. u8 agc;
  504. __le16 sig_avg;
  505. __le16 noise_diff;
  506. u8 payload[0];
  507. } __attribute__ ((packed));
  508. struct iwl_rx_frame_hdr {
  509. __le16 channel;
  510. __le16 phy_flags;
  511. u8 reserved1;
  512. u8 rate;
  513. __le16 len;
  514. u8 payload[0];
  515. } __attribute__ ((packed));
  516. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  517. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  518. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  519. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  520. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  521. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  522. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  523. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  524. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  525. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  526. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  527. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  528. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  529. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  530. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  531. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  532. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  533. struct iwl_rx_frame_end {
  534. __le32 status;
  535. __le64 timestamp;
  536. __le32 beacon_timestamp;
  537. } __attribute__ ((packed));
  538. /*
  539. * REPLY_3945_RX = 0x1b (response only, not a command)
  540. *
  541. * NOTE: DO NOT dereference from casts to this structure
  542. * It is provided only for calculating minimum data set size.
  543. * The actual offsets of the hdr and end are dynamic based on
  544. * stats.phy_count
  545. */
  546. struct iwl_rx_frame {
  547. struct iwl_rx_frame_stats stats;
  548. struct iwl_rx_frame_hdr hdr;
  549. struct iwl_rx_frame_end end;
  550. } __attribute__ ((packed));
  551. /* Fixed (non-configurable) rx data from phy */
  552. #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
  553. #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
  554. #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
  555. #define IWL_AGC_DB_POS (7)
  556. struct iwl4965_rx_non_cfg_phy {
  557. __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
  558. __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
  559. u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
  560. u8 pad[0];
  561. } __attribute__ ((packed));
  562. /*
  563. * REPLY_4965_RX = 0xc3 (response only, not a command)
  564. * Used only for legacy (non 11n) frames.
  565. */
  566. #define RX_RES_PHY_CNT 14
  567. struct iwl4965_rx_phy_res {
  568. u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
  569. u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
  570. u8 stat_id; /* configurable DSP phy data set ID */
  571. u8 reserved1;
  572. __le64 timestamp; /* TSF at on air rise */
  573. __le32 beacon_time_stamp; /* beacon at on-air rise */
  574. __le16 phy_flags; /* general phy flags: band, modulation, ... */
  575. __le16 channel; /* channel number */
  576. __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
  577. __le32 reserved2;
  578. __le32 rate_n_flags;
  579. __le16 byte_count; /* frame's byte-count */
  580. __le16 reserved3;
  581. } __attribute__ ((packed));
  582. struct iwl4965_rx_mpdu_res_start {
  583. __le16 byte_count;
  584. __le16 reserved;
  585. } __attribute__ ((packed));
  586. /******************************************************************************
  587. * (5)
  588. * Tx Commands & Responses:
  589. *
  590. *****************************************************************************/
  591. /* Tx flags */
  592. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  593. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  594. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  595. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  596. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  597. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  598. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  599. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  600. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  601. /* ucode ignores BT priority for this frame */
  602. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  603. /* ucode overrides sequence control */
  604. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  605. /* signal that this frame is non-last MPDU */
  606. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  607. /* calculate TSF in outgoing frame */
  608. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  609. /* activate TX calibration. */
  610. #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
  611. /* signals that 2 bytes pad was inserted
  612. after the MAC header */
  613. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  614. /* HCCA-AP - disable duration overwriting. */
  615. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  616. /*
  617. * TX command security control
  618. */
  619. #define TX_CMD_SEC_WEP 0x01
  620. #define TX_CMD_SEC_CCM 0x02
  621. #define TX_CMD_SEC_TKIP 0x03
  622. #define TX_CMD_SEC_MSK 0x03
  623. #define TX_CMD_SEC_SHIFT 6
  624. #define TX_CMD_SEC_KEY128 0x08
  625. /*
  626. * TX command Frame life time
  627. */
  628. struct iwl_dram_scratch {
  629. u8 try_cnt;
  630. u8 bt_kill_cnt;
  631. __le16 reserved;
  632. } __attribute__ ((packed));
  633. /*
  634. * REPLY_TX = 0x1c (command)
  635. */
  636. struct iwl_tx_cmd {
  637. __le16 len;
  638. __le16 next_frame_len;
  639. __le32 tx_flags;
  640. #if IWL == 3945
  641. u8 rate;
  642. u8 sta_id;
  643. u8 tid_tspec;
  644. #elif IWL == 4965
  645. struct iwl_dram_scratch scratch;
  646. __le32 rate_n_flags;
  647. u8 sta_id;
  648. #endif
  649. u8 sec_ctl;
  650. #if IWL == 4965
  651. u8 initial_rate_index;
  652. u8 reserved;
  653. #endif
  654. u8 key[16];
  655. #if IWL == 3945
  656. union {
  657. u8 byte[8];
  658. __le16 word[4];
  659. __le32 dw[2];
  660. } tkip_mic;
  661. __le32 next_frame_info;
  662. #elif IWL == 4965
  663. __le16 next_frame_flags;
  664. __le16 reserved2;
  665. #endif
  666. union {
  667. __le32 life_time;
  668. __le32 attempt;
  669. } stop_time;
  670. #if IWL == 3945
  671. u8 supp_rates[2];
  672. #elif IWL == 4965
  673. __le32 dram_lsb_ptr;
  674. u8 dram_msb_ptr;
  675. #endif
  676. u8 rts_retry_limit; /*byte 50 */
  677. u8 data_retry_limit; /*byte 51 */
  678. #if IWL == 4965
  679. u8 tid_tspec;
  680. #endif
  681. union {
  682. __le16 pm_frame_timeout;
  683. __le16 attempt_duration;
  684. } timeout;
  685. __le16 driver_txop;
  686. u8 payload[0];
  687. struct ieee80211_hdr hdr[0];
  688. } __attribute__ ((packed));
  689. /* TX command response is sent after *all* transmission attempts.
  690. *
  691. * NOTES:
  692. *
  693. * TX_STATUS_FAIL_NEXT_FRAG
  694. *
  695. * If the fragment flag in the MAC header for the frame being transmitted
  696. * is set and there is insufficient time to transmit the next frame, the
  697. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  698. *
  699. * TX_STATUS_FIFO_UNDERRUN
  700. *
  701. * Indicates the host did not provide bytes to the FIFO fast enough while
  702. * a TX was in progress.
  703. *
  704. * TX_STATUS_FAIL_MGMNT_ABORT
  705. *
  706. * This status is only possible if the ABORT ON MGMT RX parameter was
  707. * set to true with the TX command.
  708. *
  709. * If the MSB of the status parameter is set then an abort sequence is
  710. * required. This sequence consists of the host activating the TX Abort
  711. * control line, and then waiting for the TX Abort command response. This
  712. * indicates that a the device is no longer in a transmit state, and that the
  713. * command FIFO has been cleared. The host must then deactivate the TX Abort
  714. * control line. Receiving is still allowed in this case.
  715. */
  716. enum {
  717. TX_STATUS_SUCCESS = 0x01,
  718. TX_STATUS_DIRECT_DONE = 0x02,
  719. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  720. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  721. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  722. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  723. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  724. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  725. TX_STATUS_FAIL_DEST_PS = 0x88,
  726. TX_STATUS_FAIL_ABORTED = 0x89,
  727. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  728. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  729. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  730. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  731. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  732. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  733. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  734. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  735. };
  736. #define TX_PACKET_MODE_REGULAR 0x0000
  737. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  738. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  739. enum {
  740. TX_POWER_PA_NOT_ACTIVE = 0x0,
  741. };
  742. enum {
  743. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  744. TX_STATUS_DELAY_MSK = 0x00000040,
  745. TX_STATUS_ABORT_MSK = 0x00000080,
  746. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  747. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  748. TX_RESERVED = 0x00780000, /* bits 19:22 */
  749. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  750. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  751. };
  752. /* *******************************
  753. * TX aggregation state
  754. ******************************* */
  755. enum {
  756. AGG_TX_STATE_TRANSMITTED = 0x00,
  757. AGG_TX_STATE_UNDERRUN_MSK = 0x01,
  758. AGG_TX_STATE_BT_PRIO_MSK = 0x02,
  759. AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
  760. AGG_TX_STATE_ABORT_MSK = 0x08,
  761. AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
  762. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
  763. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
  764. AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
  765. AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
  766. AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
  767. AGG_TX_STATE_DUMP_TX_MSK = 0x200,
  768. AGG_TX_STATE_DELAY_TX_MSK = 0x400
  769. };
  770. #define AGG_TX_STATE_LAST_SENT_MSK \
  771. (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
  772. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
  773. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
  774. #define AGG_TX_STATE_TRY_CNT_POS 12
  775. #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
  776. #define AGG_TX_STATE_SEQ_NUM_POS 16
  777. #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
  778. /*
  779. * REPLY_TX = 0x1c (response)
  780. */
  781. #if IWL == 4965
  782. struct iwl_tx_resp {
  783. u8 frame_count; /* 1 no aggregation, >1 aggregation */
  784. u8 bt_kill_count;
  785. u8 failure_rts;
  786. u8 failure_frame;
  787. __le32 rate_n_flags;
  788. __le16 wireless_media_time;
  789. __le16 reserved;
  790. __le32 pa_power1;
  791. __le32 pa_power2;
  792. __le32 status; /* TX status (for aggregation status of 1st frame) */
  793. } __attribute__ ((packed));
  794. #elif IWL == 3945
  795. struct iwl_tx_resp {
  796. u8 failure_rts;
  797. u8 failure_frame;
  798. u8 bt_kill_count;
  799. u8 rate;
  800. __le32 wireless_media_time;
  801. __le32 status; /* TX status (for aggregation status of 1st frame) */
  802. } __attribute__ ((packed));
  803. #endif
  804. /*
  805. * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  806. */
  807. struct iwl_compressed_ba_resp {
  808. __le32 sta_addr_lo32;
  809. __le16 sta_addr_hi16;
  810. __le16 reserved;
  811. u8 sta_id;
  812. u8 tid;
  813. __le16 ba_seq_ctl;
  814. __le32 ba_bitmap0;
  815. __le32 ba_bitmap1;
  816. __le16 scd_flow;
  817. __le16 scd_ssn;
  818. } __attribute__ ((packed));
  819. /*
  820. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  821. */
  822. struct iwl_txpowertable_cmd {
  823. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  824. u8 reserved;
  825. __le16 channel;
  826. #if IWL == 3945
  827. struct iwl_power_per_rate power[IWL_MAX_RATES];
  828. #elif IWL == 4965
  829. struct iwl_tx_power_db tx_power;
  830. #endif
  831. } __attribute__ ((packed));
  832. #if IWL == 3945
  833. struct iwl_rate_scaling_info {
  834. __le16 rate_n_flags;
  835. u8 try_cnt;
  836. u8 next_rate_index;
  837. } __attribute__ ((packed));
  838. /**
  839. * struct iwl_rate_scaling_cmd - Rate Scaling Command & Response
  840. *
  841. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  842. *
  843. * NOTE: The table of rates passed to the uCode via the
  844. * RATE_SCALE command sets up the corresponding order of
  845. * rates used for all related commands, including rate
  846. * masks, etc.
  847. *
  848. * For example, if you set 9MB (PLCP 0x0f) as the first
  849. * rate in the rate table, the bit mask for that rate
  850. * when passed through ofdm_basic_rates on the REPLY_RXON
  851. * command would be bit 0 (1<<0)
  852. */
  853. struct iwl_rate_scaling_cmd {
  854. u8 table_id;
  855. u8 reserved[3];
  856. struct iwl_rate_scaling_info table[IWL_MAX_RATES];
  857. } __attribute__ ((packed));
  858. #elif IWL == 4965
  859. /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
  860. #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0)
  861. #define LINK_QUAL_AC_NUM AC_NUM
  862. #define LINK_QUAL_MAX_RETRY_NUM 16
  863. #define LINK_QUAL_ANT_A_MSK (1<<0)
  864. #define LINK_QUAL_ANT_B_MSK (1<<1)
  865. #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
  866. struct iwl_link_qual_general_params {
  867. u8 flags;
  868. u8 mimo_delimiter;
  869. u8 single_stream_ant_msk;
  870. u8 dual_stream_ant_msk;
  871. u8 start_rate_index[LINK_QUAL_AC_NUM];
  872. } __attribute__ ((packed));
  873. struct iwl_link_qual_agg_params {
  874. __le16 agg_time_limit;
  875. u8 agg_dis_start_th;
  876. u8 agg_frame_cnt_limit;
  877. __le32 reserved;
  878. } __attribute__ ((packed));
  879. /*
  880. * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
  881. */
  882. struct iwl_link_quality_cmd {
  883. u8 sta_id;
  884. u8 reserved1;
  885. __le16 control;
  886. struct iwl_link_qual_general_params general_params;
  887. struct iwl_link_qual_agg_params agg_params;
  888. struct {
  889. __le32 rate_n_flags;
  890. } rs_table[LINK_QUAL_MAX_RETRY_NUM];
  891. __le32 reserved2;
  892. } __attribute__ ((packed));
  893. #endif
  894. /*
  895. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  896. */
  897. struct iwl_bt_cmd {
  898. u8 flags;
  899. u8 lead_time;
  900. u8 max_kill;
  901. u8 reserved;
  902. __le32 kill_ack_mask;
  903. __le32 kill_cts_mask;
  904. } __attribute__ ((packed));
  905. /******************************************************************************
  906. * (6)
  907. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  908. *
  909. *****************************************************************************/
  910. /*
  911. * Spectrum Management
  912. */
  913. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  914. RXON_FILTER_CTL2HOST_MSK | \
  915. RXON_FILTER_ACCEPT_GRP_MSK | \
  916. RXON_FILTER_DIS_DECRYPT_MSK | \
  917. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  918. RXON_FILTER_ASSOC_MSK | \
  919. RXON_FILTER_BCON_AWARE_MSK)
  920. struct iwl_measure_channel {
  921. __le32 duration; /* measurement duration in extended beacon
  922. * format */
  923. u8 channel; /* channel to measure */
  924. u8 type; /* see enum iwl_measure_type */
  925. __le16 reserved;
  926. } __attribute__ ((packed));
  927. /*
  928. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  929. */
  930. struct iwl_spectrum_cmd {
  931. __le16 len; /* number of bytes starting from token */
  932. u8 token; /* token id */
  933. u8 id; /* measurement id -- 0 or 1 */
  934. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  935. u8 periodic; /* 1 = periodic */
  936. __le16 path_loss_timeout;
  937. __le32 start_time; /* start time in extended beacon format */
  938. __le32 reserved2;
  939. __le32 flags; /* rxon flags */
  940. __le32 filter_flags; /* rxon filter flags */
  941. __le16 channel_count; /* minimum 1, maximum 10 */
  942. __le16 reserved3;
  943. struct iwl_measure_channel channels[10];
  944. } __attribute__ ((packed));
  945. /*
  946. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  947. */
  948. struct iwl_spectrum_resp {
  949. u8 token;
  950. u8 id; /* id of the prior command replaced, or 0xff */
  951. __le16 status; /* 0 - command will be handled
  952. * 1 - cannot handle (conflicts with another
  953. * measurement) */
  954. } __attribute__ ((packed));
  955. enum iwl_measurement_state {
  956. IWL_MEASUREMENT_START = 0,
  957. IWL_MEASUREMENT_STOP = 1,
  958. };
  959. enum iwl_measurement_status {
  960. IWL_MEASUREMENT_OK = 0,
  961. IWL_MEASUREMENT_CONCURRENT = 1,
  962. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  963. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  964. /* 4-5 reserved */
  965. IWL_MEASUREMENT_STOPPED = 6,
  966. IWL_MEASUREMENT_TIMEOUT = 7,
  967. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  968. };
  969. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  970. struct iwl_measurement_histogram {
  971. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  972. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  973. } __attribute__ ((packed));
  974. /* clear channel availability counters */
  975. struct iwl_measurement_cca_counters {
  976. __le32 ofdm;
  977. __le32 cck;
  978. } __attribute__ ((packed));
  979. enum iwl_measure_type {
  980. IWL_MEASURE_BASIC = (1 << 0),
  981. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  982. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  983. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  984. IWL_MEASURE_FRAME = (1 << 4),
  985. /* bits 5:6 are reserved */
  986. IWL_MEASURE_IDLE = (1 << 7),
  987. };
  988. /*
  989. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  990. */
  991. struct iwl_spectrum_notification {
  992. u8 id; /* measurement id -- 0 or 1 */
  993. u8 token;
  994. u8 channel_index; /* index in measurement channel list */
  995. u8 state; /* 0 - start, 1 - stop */
  996. __le32 start_time; /* lower 32-bits of TSF */
  997. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  998. u8 channel;
  999. u8 type; /* see enum iwl_measurement_type */
  1000. u8 reserved1;
  1001. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  1002. * valid if applicable for measurement type requested. */
  1003. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  1004. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  1005. __le32 cca_time; /* channel load time in usecs */
  1006. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  1007. * unidentified */
  1008. u8 reserved2[3];
  1009. struct iwl_measurement_histogram histogram;
  1010. __le32 stop_time; /* lower 32-bits of TSF */
  1011. __le32 status; /* see iwl_measurement_status */
  1012. } __attribute__ ((packed));
  1013. /******************************************************************************
  1014. * (7)
  1015. * Power Management Commands, Responses, Notifications:
  1016. *
  1017. *****************************************************************************/
  1018. /**
  1019. * struct iwl_powertable_cmd - Power Table Command
  1020. * @flags: See below:
  1021. *
  1022. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  1023. *
  1024. * PM allow:
  1025. * bit 0 - '0' Driver not allow power management
  1026. * '1' Driver allow PM (use rest of parameters)
  1027. * uCode send sleep notifications:
  1028. * bit 1 - '0' Don't send sleep notification
  1029. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  1030. * Sleep over DTIM
  1031. * bit 2 - '0' PM have to walk up every DTIM
  1032. * '1' PM could sleep over DTIM till listen Interval.
  1033. * PCI power managed
  1034. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  1035. * '1' !(PCI_LINK_CTRL & 0x1)
  1036. * Force sleep Modes
  1037. * bit 31/30- '00' use both mac/xtal sleeps
  1038. * '01' force Mac sleep
  1039. * '10' force xtal sleep
  1040. * '11' Illegal set
  1041. *
  1042. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  1043. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  1044. * for every DTIM.
  1045. */
  1046. #define IWL_POWER_VEC_SIZE 5
  1047. #if IWL == 3945
  1048. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
  1049. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
  1050. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
  1051. struct iwl_powertable_cmd {
  1052. __le32 flags;
  1053. __le32 rx_data_timeout;
  1054. __le32 tx_data_timeout;
  1055. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  1056. } __attribute__((packed));
  1057. #elif IWL == 4965
  1058. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0)
  1059. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
  1060. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
  1061. struct iwl_powertable_cmd {
  1062. __le16 flags;
  1063. u8 keep_alive_seconds;
  1064. u8 debug_flags;
  1065. __le32 rx_data_timeout;
  1066. __le32 tx_data_timeout;
  1067. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  1068. __le32 keep_alive_beacons;
  1069. } __attribute__ ((packed));
  1070. #endif
  1071. /*
  1072. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  1073. * 3945 and 4965 identical.
  1074. */
  1075. struct iwl_sleep_notification {
  1076. u8 pm_sleep_mode;
  1077. u8 pm_wakeup_src;
  1078. __le16 reserved;
  1079. __le32 sleep_time;
  1080. __le32 tsf_low;
  1081. __le32 bcon_timer;
  1082. } __attribute__ ((packed));
  1083. /* Sleep states. 3945 and 4965 identical. */
  1084. enum {
  1085. IWL_PM_NO_SLEEP = 0,
  1086. IWL_PM_SLP_MAC = 1,
  1087. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  1088. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  1089. IWL_PM_SLP_PHY = 4,
  1090. IWL_PM_SLP_REPENT = 5,
  1091. IWL_PM_WAKEUP_BY_TIMER = 6,
  1092. IWL_PM_WAKEUP_BY_DRIVER = 7,
  1093. IWL_PM_WAKEUP_BY_RFKILL = 8,
  1094. /* 3 reserved */
  1095. IWL_PM_NUM_OF_MODES = 12,
  1096. };
  1097. /*
  1098. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  1099. */
  1100. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  1101. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  1102. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  1103. struct iwl_card_state_cmd {
  1104. __le32 status; /* CARD_STATE_CMD_* request new power state */
  1105. } __attribute__ ((packed));
  1106. /*
  1107. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  1108. */
  1109. struct iwl_card_state_notif {
  1110. __le32 flags;
  1111. } __attribute__ ((packed));
  1112. #define HW_CARD_DISABLED 0x01
  1113. #define SW_CARD_DISABLED 0x02
  1114. #define RF_CARD_DISABLED 0x04
  1115. #define RXON_CARD_DISABLED 0x10
  1116. struct iwl_ct_kill_config {
  1117. __le32 reserved;
  1118. __le32 critical_temperature_M;
  1119. __le32 critical_temperature_R;
  1120. } __attribute__ ((packed));
  1121. /******************************************************************************
  1122. * (8)
  1123. * Scan Commands, Responses, Notifications:
  1124. *
  1125. *****************************************************************************/
  1126. struct iwl_scan_channel {
  1127. /* type is defined as:
  1128. * 0:0 active (0 - passive)
  1129. * 1:4 SSID direct
  1130. * If 1 is set then corresponding SSID IE is transmitted in probe
  1131. * 5:7 reserved
  1132. */
  1133. u8 type;
  1134. u8 channel;
  1135. struct iwl_tx_power tpc;
  1136. __le16 active_dwell;
  1137. __le16 passive_dwell;
  1138. } __attribute__ ((packed));
  1139. struct iwl_ssid_ie {
  1140. u8 id;
  1141. u8 len;
  1142. u8 ssid[32];
  1143. } __attribute__ ((packed));
  1144. #define PROBE_OPTION_MAX 0x4
  1145. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  1146. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  1147. #define IWL_MAX_SCAN_SIZE 1024
  1148. /*
  1149. * REPLY_SCAN_CMD = 0x80 (command)
  1150. */
  1151. struct iwl_scan_cmd {
  1152. __le16 len;
  1153. u8 reserved0;
  1154. u8 channel_count;
  1155. __le16 quiet_time; /* dwell only this long on quiet chnl
  1156. * (active scan) */
  1157. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1158. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1159. #if IWL == 3945
  1160. __le16 reserved1;
  1161. #elif IWL == 4965
  1162. __le16 rx_chain;
  1163. #endif
  1164. __le32 max_out_time; /* max usec to be out of associated (service)
  1165. * chnl */
  1166. __le32 suspend_time; /* pause scan this long when returning to svc
  1167. * chnl.
  1168. * 3945 -- 31:24 # beacons, 19:0 additional usec,
  1169. * 4965 -- 31:22 # beacons, 21:0 additional usec.
  1170. */
  1171. __le32 flags;
  1172. __le32 filter_flags;
  1173. struct iwl_tx_cmd tx_cmd;
  1174. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1175. u8 data[0];
  1176. /*
  1177. * The channels start after the probe request payload and are of type:
  1178. *
  1179. * struct iwl_scan_channel channels[0];
  1180. *
  1181. * NOTE: Only one band of channels can be scanned per pass. You
  1182. * can not mix 2.4GHz channels and 5.2GHz channels and must
  1183. * request a scan multiple times (not concurrently)
  1184. *
  1185. */
  1186. } __attribute__ ((packed));
  1187. /* Can abort will notify by complete notification with abort status. */
  1188. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1189. /* complete notification statuses */
  1190. #define ABORT_STATUS 0x2
  1191. /*
  1192. * REPLY_SCAN_CMD = 0x80 (response)
  1193. */
  1194. struct iwl_scanreq_notification {
  1195. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1196. } __attribute__ ((packed));
  1197. /*
  1198. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1199. */
  1200. struct iwl_scanstart_notification {
  1201. __le32 tsf_low;
  1202. __le32 tsf_high;
  1203. __le32 beacon_timer;
  1204. u8 channel;
  1205. u8 band;
  1206. u8 reserved[2];
  1207. __le32 status;
  1208. } __attribute__ ((packed));
  1209. #define SCAN_OWNER_STATUS 0x1;
  1210. #define MEASURE_OWNER_STATUS 0x2;
  1211. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1212. /*
  1213. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1214. */
  1215. struct iwl_scanresults_notification {
  1216. u8 channel;
  1217. u8 band;
  1218. u8 reserved[2];
  1219. __le32 tsf_low;
  1220. __le32 tsf_high;
  1221. __le32 statistics[NUMBER_OF_STATISTICS];
  1222. } __attribute__ ((packed));
  1223. /*
  1224. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1225. */
  1226. struct iwl_scancomplete_notification {
  1227. u8 scanned_channels;
  1228. u8 status;
  1229. u8 reserved;
  1230. u8 last_channel;
  1231. __le32 tsf_low;
  1232. __le32 tsf_high;
  1233. } __attribute__ ((packed));
  1234. /******************************************************************************
  1235. * (9)
  1236. * IBSS/AP Commands and Notifications:
  1237. *
  1238. *****************************************************************************/
  1239. /*
  1240. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1241. */
  1242. struct iwl_beacon_notif {
  1243. struct iwl_tx_resp beacon_notify_hdr;
  1244. __le32 low_tsf;
  1245. __le32 high_tsf;
  1246. __le32 ibss_mgr_status;
  1247. } __attribute__ ((packed));
  1248. /*
  1249. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1250. */
  1251. struct iwl_tx_beacon_cmd {
  1252. struct iwl_tx_cmd tx;
  1253. __le16 tim_idx;
  1254. u8 tim_size;
  1255. u8 reserved1;
  1256. struct ieee80211_hdr frame[0]; /* beacon frame */
  1257. } __attribute__ ((packed));
  1258. /******************************************************************************
  1259. * (10)
  1260. * Statistics Commands and Notifications:
  1261. *
  1262. *****************************************************************************/
  1263. #define IWL_TEMP_CONVERT 260
  1264. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1265. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1266. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1267. /* Used for passing to driver number of successes and failures per rate */
  1268. struct rate_histogram {
  1269. union {
  1270. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1271. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1272. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1273. } success;
  1274. union {
  1275. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1276. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1277. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1278. } failed;
  1279. } __attribute__ ((packed));
  1280. /* statistics command response */
  1281. struct statistics_rx_phy {
  1282. __le32 ina_cnt;
  1283. __le32 fina_cnt;
  1284. __le32 plcp_err;
  1285. __le32 crc32_err;
  1286. __le32 overrun_err;
  1287. __le32 early_overrun_err;
  1288. __le32 crc32_good;
  1289. __le32 false_alarm_cnt;
  1290. __le32 fina_sync_err_cnt;
  1291. __le32 sfd_timeout;
  1292. __le32 fina_timeout;
  1293. __le32 unresponded_rts;
  1294. __le32 rxe_frame_limit_overrun;
  1295. __le32 sent_ack_cnt;
  1296. __le32 sent_cts_cnt;
  1297. #if IWL == 4965
  1298. __le32 sent_ba_rsp_cnt;
  1299. __le32 dsp_self_kill;
  1300. __le32 mh_format_err;
  1301. __le32 re_acq_main_rssi_sum;
  1302. __le32 reserved3;
  1303. #endif
  1304. } __attribute__ ((packed));
  1305. #if IWL == 4965
  1306. struct statistics_rx_ht_phy {
  1307. __le32 plcp_err;
  1308. __le32 overrun_err;
  1309. __le32 early_overrun_err;
  1310. __le32 crc32_good;
  1311. __le32 crc32_err;
  1312. __le32 mh_format_err;
  1313. __le32 agg_crc32_good;
  1314. __le32 agg_mpdu_cnt;
  1315. __le32 agg_cnt;
  1316. __le32 reserved2;
  1317. } __attribute__ ((packed));
  1318. #endif
  1319. struct statistics_rx_non_phy {
  1320. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1321. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1322. __le32 non_bssid_frames; /* number of frames with BSSID that
  1323. * doesn't belong to the STA BSSID */
  1324. __le32 filtered_frames; /* count frames that were dumped in the
  1325. * filtering process */
  1326. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1327. * our serving channel */
  1328. #if IWL == 4965
  1329. __le32 channel_beacons; /* beacons with our bss id and in our
  1330. * serving channel */
  1331. __le32 num_missed_bcon; /* number of missed beacons */
  1332. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  1333. * ADC was in saturation */
  1334. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  1335. * for INA */
  1336. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  1337. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  1338. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  1339. __le32 interference_data_flag; /* flag for interference data
  1340. * availability. 1 when data is
  1341. * available. */
  1342. __le32 channel_load; /* counts RX Enable time */
  1343. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  1344. * and CCK) counter */
  1345. __le32 beacon_rssi_a;
  1346. __le32 beacon_rssi_b;
  1347. __le32 beacon_rssi_c;
  1348. __le32 beacon_energy_a;
  1349. __le32 beacon_energy_b;
  1350. __le32 beacon_energy_c;
  1351. #endif
  1352. } __attribute__ ((packed));
  1353. struct statistics_rx {
  1354. struct statistics_rx_phy ofdm;
  1355. struct statistics_rx_phy cck;
  1356. struct statistics_rx_non_phy general;
  1357. #if IWL == 4965
  1358. struct statistics_rx_ht_phy ofdm_ht;
  1359. #endif
  1360. } __attribute__ ((packed));
  1361. #if IWL == 4965
  1362. struct statistics_tx_non_phy_agg {
  1363. __le32 ba_timeout;
  1364. __le32 ba_reschedule_frames;
  1365. __le32 scd_query_agg_frame_cnt;
  1366. __le32 scd_query_no_agg;
  1367. __le32 scd_query_agg;
  1368. __le32 scd_query_mismatch;
  1369. __le32 frame_not_ready;
  1370. __le32 underrun;
  1371. __le32 bt_prio_kill;
  1372. __le32 rx_ba_rsp_cnt;
  1373. __le32 reserved2;
  1374. __le32 reserved3;
  1375. } __attribute__ ((packed));
  1376. #endif
  1377. struct statistics_tx {
  1378. __le32 preamble_cnt;
  1379. __le32 rx_detected_cnt;
  1380. __le32 bt_prio_defer_cnt;
  1381. __le32 bt_prio_kill_cnt;
  1382. __le32 few_bytes_cnt;
  1383. __le32 cts_timeout;
  1384. __le32 ack_timeout;
  1385. __le32 expected_ack_cnt;
  1386. __le32 actual_ack_cnt;
  1387. #if IWL == 4965
  1388. __le32 dump_msdu_cnt;
  1389. __le32 burst_abort_next_frame_mismatch_cnt;
  1390. __le32 burst_abort_missing_next_frame_cnt;
  1391. __le32 cts_timeout_collision;
  1392. __le32 ack_or_ba_timeout_collision;
  1393. struct statistics_tx_non_phy_agg agg;
  1394. #endif
  1395. } __attribute__ ((packed));
  1396. struct statistics_dbg {
  1397. __le32 burst_check;
  1398. __le32 burst_count;
  1399. __le32 reserved[4];
  1400. } __attribute__ ((packed));
  1401. struct statistics_div {
  1402. __le32 tx_on_a;
  1403. __le32 tx_on_b;
  1404. __le32 exec_time;
  1405. __le32 probe_time;
  1406. #if IWL == 4965
  1407. __le32 reserved1;
  1408. __le32 reserved2;
  1409. #endif
  1410. } __attribute__ ((packed));
  1411. struct statistics_general {
  1412. __le32 temperature;
  1413. #if IWL == 4965
  1414. __le32 temperature_m;
  1415. #endif
  1416. struct statistics_dbg dbg;
  1417. __le32 sleep_time;
  1418. __le32 slots_out;
  1419. __le32 slots_idle;
  1420. __le32 ttl_timestamp;
  1421. struct statistics_div div;
  1422. #if IWL == 4965
  1423. __le32 rx_enable_counter;
  1424. __le32 reserved1;
  1425. __le32 reserved2;
  1426. __le32 reserved3;
  1427. #endif
  1428. } __attribute__ ((packed));
  1429. /*
  1430. * REPLY_STATISTICS_CMD = 0x9c,
  1431. * 3945 and 4965 identical.
  1432. *
  1433. * This command triggers an immediate response containing uCode statistics.
  1434. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1435. *
  1436. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1437. * internal copy of the statistics (counters) after issuing the response.
  1438. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1439. *
  1440. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1441. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1442. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1443. */
  1444. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1445. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1446. struct iwl_statistics_cmd {
  1447. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1448. } __attribute__ ((packed));
  1449. /*
  1450. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1451. *
  1452. * By default, uCode issues this notification after receiving a beacon
  1453. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1454. * REPLY_STATISTICS_CMD 0x9c, above.
  1455. *
  1456. * Statistics counters continue to increment beacon after beacon, but are
  1457. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1458. * 0x9c with CLEAR_STATS bit set (see above).
  1459. *
  1460. * uCode also issues this notification during scans. uCode clears statistics
  1461. * appropriately so that each notification contains statistics for only the
  1462. * one channel that has just been scanned.
  1463. */
  1464. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1465. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1466. struct iwl_notif_statistics {
  1467. __le32 flag;
  1468. struct statistics_rx rx;
  1469. struct statistics_tx tx;
  1470. struct statistics_general general;
  1471. } __attribute__ ((packed));
  1472. /*
  1473. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1474. */
  1475. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1476. * then this notification will be sent. */
  1477. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1478. struct iwl_missed_beacon_notif {
  1479. __le32 consequtive_missed_beacons;
  1480. __le32 total_missed_becons;
  1481. __le32 num_expected_beacons;
  1482. __le32 num_recvd_beacons;
  1483. } __attribute__ ((packed));
  1484. /******************************************************************************
  1485. * (11)
  1486. * Rx Calibration Commands:
  1487. *
  1488. *****************************************************************************/
  1489. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1490. #define HD_TABLE_SIZE (11)
  1491. struct iwl_sensitivity_cmd {
  1492. __le16 control;
  1493. __le16 table[HD_TABLE_SIZE];
  1494. } __attribute__ ((packed));
  1495. struct iwl_calibration_cmd {
  1496. u8 opCode;
  1497. u8 flags;
  1498. __le16 reserved;
  1499. s8 diff_gain_a;
  1500. s8 diff_gain_b;
  1501. s8 diff_gain_c;
  1502. u8 reserved1;
  1503. } __attribute__ ((packed));
  1504. /******************************************************************************
  1505. * (12)
  1506. * Miscellaneous Commands:
  1507. *
  1508. *****************************************************************************/
  1509. /*
  1510. * LEDs Command & Response
  1511. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1512. *
  1513. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1514. * this command turns it on or off, or sets up a periodic blinking cycle.
  1515. */
  1516. struct iwl_led_cmd {
  1517. __le32 interval; /* "interval" in uSec */
  1518. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1519. u8 off; /* # intervals off while blinking;
  1520. * "0", with >0 "on" value, turns LED on */
  1521. u8 on; /* # intervals on while blinking;
  1522. * "0", regardless of "off", turns LED off */
  1523. u8 reserved;
  1524. } __attribute__ ((packed));
  1525. /******************************************************************************
  1526. * (13)
  1527. * Union of all expected notifications/responses:
  1528. *
  1529. *****************************************************************************/
  1530. struct iwl_rx_packet {
  1531. __le32 len;
  1532. struct iwl_cmd_header hdr;
  1533. union {
  1534. struct iwl_alive_resp alive_frame;
  1535. struct iwl_rx_frame rx_frame;
  1536. struct iwl_tx_resp tx_resp;
  1537. struct iwl_spectrum_notification spectrum_notif;
  1538. struct iwl_csa_notification csa_notif;
  1539. struct iwl_error_resp err_resp;
  1540. struct iwl_card_state_notif card_state_notif;
  1541. struct iwl_beacon_notif beacon_status;
  1542. struct iwl_add_sta_resp add_sta;
  1543. struct iwl_sleep_notification sleep_notif;
  1544. struct iwl_spectrum_resp spectrum;
  1545. struct iwl_notif_statistics stats;
  1546. #if IWL == 4965
  1547. struct iwl_compressed_ba_resp compressed_ba;
  1548. struct iwl_missed_beacon_notif missed_beacon;
  1549. #endif
  1550. __le32 status;
  1551. u8 raw[0];
  1552. } u;
  1553. } __attribute__ ((packed));
  1554. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame))
  1555. #endif /* __iwl_commands_h__ */