iwl-3945-commands.h 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467
  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 General 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_3945_commands_h__
  64. #define __iwl_3945_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. REPLY_3945_RX = 0x1b, /* 3945 only */
  79. REPLY_TX = 0x1c,
  80. REPLY_RATE_SCALE = 0x47, /* 3945 only */
  81. REPLY_LEDS_CMD = 0x48,
  82. REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
  83. /* 802.11h related */
  84. RADAR_NOTIFICATION = 0x70, /* not used */
  85. REPLY_QUIET_CMD = 0x71, /* not used */
  86. REPLY_CHANNEL_SWITCH = 0x72,
  87. CHANNEL_SWITCH_NOTIFICATION = 0x73,
  88. REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
  89. SPECTRUM_MEASURE_NOTIFICATION = 0x75,
  90. /* Power Management */
  91. POWER_TABLE_CMD = 0x77,
  92. PM_SLEEP_NOTIFICATION = 0x7A,
  93. PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
  94. /* Scan commands and notifications */
  95. REPLY_SCAN_CMD = 0x80,
  96. REPLY_SCAN_ABORT_CMD = 0x81,
  97. SCAN_START_NOTIFICATION = 0x82,
  98. SCAN_RESULTS_NOTIFICATION = 0x83,
  99. SCAN_COMPLETE_NOTIFICATION = 0x84,
  100. /* IBSS/AP commands */
  101. BEACON_NOTIFICATION = 0x90,
  102. REPLY_TX_BEACON = 0x91,
  103. WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
  104. /* Miscellaneous commands */
  105. QUIET_NOTIFICATION = 0x96, /* not used */
  106. REPLY_TX_PWR_TABLE_CMD = 0x97,
  107. MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
  108. /* BT config command */
  109. REPLY_BT_CONFIG = 0x9b,
  110. /* 4965 Statistics */
  111. REPLY_STATISTICS_CMD = 0x9c,
  112. STATISTICS_NOTIFICATION = 0x9d,
  113. /* RF-KILL commands and notifications */
  114. REPLY_CARD_STATE_CMD = 0xa0,
  115. CARD_STATE_NOTIFICATION = 0xa1,
  116. /* Missed beacons notification */
  117. MISSED_BEACONS_NOTIFICATION = 0xa2,
  118. REPLY_MAX = 0xff
  119. };
  120. /******************************************************************************
  121. * (0)
  122. * Header
  123. *
  124. *****************************************************************************/
  125. #define IWL_CMD_FAILED_MSK 0x40
  126. struct iwl3945_cmd_header {
  127. u8 cmd;
  128. u8 flags;
  129. /* We have 15 LSB to use as we please (MSB indicates
  130. * a frame Rx'd from the HW). We encode the following
  131. * information into the sequence field:
  132. *
  133. * 0:7 index in fifo
  134. * 8:13 fifo selection
  135. * 14:14 bit indicating if this packet references the 'extra'
  136. * storage at the end of the memory queue
  137. * 15:15 (Rx indication)
  138. *
  139. */
  140. __le16 sequence;
  141. /* command data follows immediately */
  142. u8 data[0];
  143. } __attribute__ ((packed));
  144. /******************************************************************************
  145. * (0a)
  146. * Alive and Error Commands & Responses:
  147. *
  148. *****************************************************************************/
  149. #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
  150. #define INITIALIZE_SUBTYPE (9)
  151. /*
  152. * REPLY_ALIVE = 0x1 (response only, not a command)
  153. */
  154. struct iwl3945_alive_resp {
  155. u8 ucode_minor;
  156. u8 ucode_major;
  157. __le16 reserved1;
  158. u8 sw_rev[8];
  159. u8 ver_type;
  160. u8 ver_subtype;
  161. __le16 reserved2;
  162. __le32 log_event_table_ptr;
  163. __le32 error_event_table_ptr;
  164. __le32 timestamp;
  165. __le32 is_valid;
  166. } __attribute__ ((packed));
  167. struct iwl3945_init_alive_resp {
  168. u8 ucode_minor;
  169. u8 ucode_major;
  170. __le16 reserved1;
  171. u8 sw_rev[8];
  172. u8 ver_type;
  173. u8 ver_subtype;
  174. __le16 reserved2;
  175. __le32 log_event_table_ptr;
  176. __le32 error_event_table_ptr;
  177. __le32 timestamp;
  178. __le32 is_valid;
  179. } __attribute__ ((packed));
  180. union tsf {
  181. u8 byte[8];
  182. __le16 word[4];
  183. __le32 dw[2];
  184. };
  185. /*
  186. * REPLY_ERROR = 0x2 (response only, not a command)
  187. */
  188. struct iwl3945_error_resp {
  189. __le32 error_type;
  190. u8 cmd_id;
  191. u8 reserved1;
  192. __le16 bad_cmd_seq_num;
  193. __le16 reserved2;
  194. __le32 error_info;
  195. union tsf timestamp;
  196. } __attribute__ ((packed));
  197. /******************************************************************************
  198. * (1)
  199. * RXON Commands & Responses:
  200. *
  201. *****************************************************************************/
  202. /*
  203. * Rx config defines & structure
  204. */
  205. /* rx_config device types */
  206. enum {
  207. RXON_DEV_TYPE_AP = 1,
  208. RXON_DEV_TYPE_ESS = 3,
  209. RXON_DEV_TYPE_IBSS = 4,
  210. RXON_DEV_TYPE_SNIFFER = 6,
  211. };
  212. /* rx_config flags */
  213. /* band & modulation selection */
  214. #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
  215. #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
  216. /* auto detection enable */
  217. #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
  218. /* TGg protection when tx */
  219. #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
  220. /* cck short slot & preamble */
  221. #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
  222. #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
  223. /* antenna selection */
  224. #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
  225. #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
  226. #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  227. #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  228. /* radar detection enable */
  229. #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
  230. #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
  231. /* rx response to host with 8-byte TSF
  232. * (according to ON_AIR deassertion) */
  233. #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
  234. /* rx_config filter flags */
  235. /* accept all data frames */
  236. #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
  237. /* pass control & management to host */
  238. #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
  239. /* accept multi-cast */
  240. #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
  241. /* don't decrypt uni-cast frames */
  242. #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
  243. /* don't decrypt multi-cast frames */
  244. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
  245. /* STA is associated */
  246. #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
  247. /* transfer to host non bssid beacons in associated state */
  248. #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
  249. /*
  250. * REPLY_RXON = 0x10 (command, has simple generic response)
  251. */
  252. struct iwl3945_rxon_cmd {
  253. u8 node_addr[6];
  254. __le16 reserved1;
  255. u8 bssid_addr[6];
  256. __le16 reserved2;
  257. u8 wlap_bssid_addr[6];
  258. __le16 reserved3;
  259. u8 dev_type;
  260. u8 air_propagation;
  261. __le16 reserved4;
  262. u8 ofdm_basic_rates;
  263. u8 cck_basic_rates;
  264. __le16 assoc_id;
  265. __le32 flags;
  266. __le32 filter_flags;
  267. __le16 channel;
  268. __le16 reserved5;
  269. } __attribute__ ((packed));
  270. /*
  271. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  272. */
  273. struct iwl3945_rxon_assoc_cmd {
  274. __le32 flags;
  275. __le32 filter_flags;
  276. u8 ofdm_basic_rates;
  277. u8 cck_basic_rates;
  278. __le16 reserved;
  279. } __attribute__ ((packed));
  280. /*
  281. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  282. */
  283. struct iwl3945_rxon_time_cmd {
  284. union tsf timestamp;
  285. __le16 beacon_interval;
  286. __le16 atim_window;
  287. __le32 beacon_init_val;
  288. __le16 listen_interval;
  289. __le16 reserved;
  290. } __attribute__ ((packed));
  291. struct iwl3945_tx_power {
  292. u8 tx_gain; /* gain for analog radio */
  293. u8 dsp_atten; /* gain for DSP */
  294. } __attribute__ ((packed));
  295. struct iwl3945_power_per_rate {
  296. u8 rate; /* plcp */
  297. struct iwl3945_tx_power tpc;
  298. u8 reserved;
  299. } __attribute__ ((packed));
  300. /*
  301. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  302. */
  303. struct iwl3945_channel_switch_cmd {
  304. u8 band;
  305. u8 expect_beacon;
  306. __le16 channel;
  307. __le32 rxon_flags;
  308. __le32 rxon_filter_flags;
  309. __le32 switch_time;
  310. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  311. } __attribute__ ((packed));
  312. /*
  313. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  314. */
  315. struct iwl3945_csa_notification {
  316. __le16 band;
  317. __le16 channel;
  318. __le32 status; /* 0 - OK, 1 - fail */
  319. } __attribute__ ((packed));
  320. /******************************************************************************
  321. * (2)
  322. * Quality-of-Service (QOS) Commands & Responses:
  323. *
  324. *****************************************************************************/
  325. struct iwl3945_ac_qos {
  326. __le16 cw_min;
  327. __le16 cw_max;
  328. u8 aifsn;
  329. u8 reserved1;
  330. __le16 edca_txop;
  331. } __attribute__ ((packed));
  332. /* QoS flags defines */
  333. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
  334. #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
  335. #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
  336. /*
  337. * TXFIFO Queue number defines
  338. */
  339. /* number of Access categories (AC) (EDCA), queues 0..3 */
  340. #define AC_NUM 4
  341. /*
  342. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  343. */
  344. struct iwl3945_qosparam_cmd {
  345. __le32 qos_flags;
  346. struct iwl3945_ac_qos ac[AC_NUM];
  347. } __attribute__ ((packed));
  348. /******************************************************************************
  349. * (3)
  350. * Add/Modify Stations Commands & Responses:
  351. *
  352. *****************************************************************************/
  353. /*
  354. * Multi station support
  355. */
  356. #define IWL_AP_ID 0
  357. #define IWL_MULTICAST_ID 1
  358. #define IWL_STA_ID 2
  359. #define IWL3945_BROADCAST_ID 24
  360. #define IWL3945_STATION_COUNT 25
  361. #define IWL4965_BROADCAST_ID 31
  362. #define IWL4965_STATION_COUNT 32
  363. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  364. #define IWL_INVALID_STATION 255
  365. #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);
  366. #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
  367. #define STA_CONTROL_MODIFY_MSK 0x01
  368. /* key flags __le16*/
  369. #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
  370. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
  371. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
  372. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
  373. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
  374. #define STA_KEY_FLG_KEYID_POS 8
  375. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  376. /* modify flags */
  377. #define STA_MODIFY_KEY_MASK 0x01
  378. #define STA_MODIFY_TID_DISABLE_TX 0x02
  379. #define STA_MODIFY_TX_RATE_MSK 0x04
  380. #define STA_MODIFY_ADDBA_TID_MSK 0x08
  381. #define STA_MODIFY_DELBA_TID_MSK 0x10
  382. #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
  383. /*
  384. * Antenna masks:
  385. * bit14:15 01 B inactive, A active
  386. * 10 B active, A inactive
  387. * 11 Both active
  388. */
  389. #define RATE_MCS_ANT_A_POS 14
  390. #define RATE_MCS_ANT_B_POS 15
  391. #define RATE_MCS_ANT_A_MSK 0x4000
  392. #define RATE_MCS_ANT_B_MSK 0x8000
  393. #define RATE_MCS_ANT_AB_MSK 0xc000
  394. struct iwl3945_keyinfo {
  395. __le16 key_flags;
  396. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  397. u8 reserved1;
  398. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  399. __le16 reserved2;
  400. u8 key[16]; /* 16-byte unicast decryption key */
  401. } __attribute__ ((packed));
  402. struct sta_id_modify {
  403. u8 addr[ETH_ALEN];
  404. __le16 reserved1;
  405. u8 sta_id;
  406. u8 modify_mask;
  407. __le16 reserved2;
  408. } __attribute__ ((packed));
  409. /*
  410. * REPLY_ADD_STA = 0x18 (command)
  411. */
  412. struct iwl3945_addsta_cmd {
  413. u8 mode;
  414. u8 reserved[3];
  415. struct sta_id_modify sta;
  416. struct iwl3945_keyinfo key;
  417. __le32 station_flags;
  418. __le32 station_flags_msk;
  419. __le16 tid_disable_tx;
  420. __le16 rate_n_flags;
  421. u8 add_immediate_ba_tid;
  422. u8 remove_immediate_ba_tid;
  423. __le16 add_immediate_ba_ssn;
  424. } __attribute__ ((packed));
  425. /*
  426. * REPLY_ADD_STA = 0x18 (response)
  427. */
  428. struct iwl3945_add_sta_resp {
  429. u8 status;
  430. } __attribute__ ((packed));
  431. #define ADD_STA_SUCCESS_MSK 0x1
  432. /******************************************************************************
  433. * (4)
  434. * Rx Responses:
  435. *
  436. *****************************************************************************/
  437. struct iwl3945_rx_frame_stats {
  438. u8 phy_count;
  439. u8 id;
  440. u8 rssi;
  441. u8 agc;
  442. __le16 sig_avg;
  443. __le16 noise_diff;
  444. u8 payload[0];
  445. } __attribute__ ((packed));
  446. struct iwl3945_rx_frame_hdr {
  447. __le16 channel;
  448. __le16 phy_flags;
  449. u8 reserved1;
  450. u8 rate;
  451. __le16 len;
  452. u8 payload[0];
  453. } __attribute__ ((packed));
  454. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  455. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  456. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  457. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  458. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  459. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  460. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  461. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  462. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  463. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  464. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  465. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  466. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  467. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  468. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  469. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  470. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  471. struct iwl3945_rx_frame_end {
  472. __le32 status;
  473. __le64 timestamp;
  474. __le32 beacon_timestamp;
  475. } __attribute__ ((packed));
  476. /*
  477. * REPLY_3945_RX = 0x1b (response only, not a command)
  478. *
  479. * NOTE: DO NOT dereference from casts to this structure
  480. * It is provided only for calculating minimum data set size.
  481. * The actual offsets of the hdr and end are dynamic based on
  482. * stats.phy_count
  483. */
  484. struct iwl3945_rx_frame {
  485. struct iwl3945_rx_frame_stats stats;
  486. struct iwl3945_rx_frame_hdr hdr;
  487. struct iwl3945_rx_frame_end end;
  488. } __attribute__ ((packed));
  489. /* Fixed (non-configurable) rx data from phy */
  490. #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
  491. #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
  492. #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
  493. #define IWL_AGC_DB_POS (7)
  494. struct iwl4965_rx_non_cfg_phy {
  495. __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
  496. __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
  497. u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
  498. u8 pad[0];
  499. } __attribute__ ((packed));
  500. /*
  501. * REPLY_4965_RX = 0xc3 (response only, not a command)
  502. * Used only for legacy (non 11n) frames.
  503. */
  504. #define RX_RES_PHY_CNT 14
  505. struct iwl4965_rx_phy_res {
  506. u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
  507. u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
  508. u8 stat_id; /* configurable DSP phy data set ID */
  509. u8 reserved1;
  510. __le64 timestamp; /* TSF at on air rise */
  511. __le32 beacon_time_stamp; /* beacon at on-air rise */
  512. __le16 phy_flags; /* general phy flags: band, modulation, ... */
  513. __le16 channel; /* channel number */
  514. __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
  515. __le32 reserved2;
  516. __le32 rate_n_flags;
  517. __le16 byte_count; /* frame's byte-count */
  518. __le16 reserved3;
  519. } __attribute__ ((packed));
  520. struct iwl4965_rx_mpdu_res_start {
  521. __le16 byte_count;
  522. __le16 reserved;
  523. } __attribute__ ((packed));
  524. /******************************************************************************
  525. * (5)
  526. * Tx Commands & Responses:
  527. *
  528. *****************************************************************************/
  529. /* Tx flags */
  530. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  531. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  532. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  533. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  534. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  535. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  536. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  537. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  538. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  539. /* ucode ignores BT priority for this frame */
  540. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  541. /* ucode overrides sequence control */
  542. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  543. /* signal that this frame is non-last MPDU */
  544. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  545. /* calculate TSF in outgoing frame */
  546. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  547. /* activate TX calibration. */
  548. #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
  549. /* signals that 2 bytes pad was inserted
  550. after the MAC header */
  551. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  552. /* HCCA-AP - disable duration overwriting. */
  553. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  554. /*
  555. * TX command security control
  556. */
  557. #define TX_CMD_SEC_WEP 0x01
  558. #define TX_CMD_SEC_CCM 0x02
  559. #define TX_CMD_SEC_TKIP 0x03
  560. #define TX_CMD_SEC_MSK 0x03
  561. #define TX_CMD_SEC_SHIFT 6
  562. #define TX_CMD_SEC_KEY128 0x08
  563. /*
  564. * TX command Frame life time
  565. */
  566. struct iwl3945_dram_scratch {
  567. u8 try_cnt;
  568. u8 bt_kill_cnt;
  569. __le16 reserved;
  570. } __attribute__ ((packed));
  571. /*
  572. * REPLY_TX = 0x1c (command)
  573. */
  574. struct iwl3945_tx_cmd {
  575. __le16 len;
  576. __le16 next_frame_len;
  577. __le32 tx_flags;
  578. u8 rate;
  579. u8 sta_id;
  580. u8 tid_tspec;
  581. u8 sec_ctl;
  582. u8 key[16];
  583. union {
  584. u8 byte[8];
  585. __le16 word[4];
  586. __le32 dw[2];
  587. } tkip_mic;
  588. __le32 next_frame_info;
  589. union {
  590. __le32 life_time;
  591. __le32 attempt;
  592. } stop_time;
  593. u8 supp_rates[2];
  594. u8 rts_retry_limit; /*byte 50 */
  595. u8 data_retry_limit; /*byte 51 */
  596. union {
  597. __le16 pm_frame_timeout;
  598. __le16 attempt_duration;
  599. } timeout;
  600. __le16 driver_txop;
  601. u8 payload[0];
  602. struct ieee80211_hdr hdr[0];
  603. } __attribute__ ((packed));
  604. /* TX command response is sent after *all* transmission attempts.
  605. *
  606. * NOTES:
  607. *
  608. * TX_STATUS_FAIL_NEXT_FRAG
  609. *
  610. * If the fragment flag in the MAC header for the frame being transmitted
  611. * is set and there is insufficient time to transmit the next frame, the
  612. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  613. *
  614. * TX_STATUS_FIFO_UNDERRUN
  615. *
  616. * Indicates the host did not provide bytes to the FIFO fast enough while
  617. * a TX was in progress.
  618. *
  619. * TX_STATUS_FAIL_MGMNT_ABORT
  620. *
  621. * This status is only possible if the ABORT ON MGMT RX parameter was
  622. * set to true with the TX command.
  623. *
  624. * If the MSB of the status parameter is set then an abort sequence is
  625. * required. This sequence consists of the host activating the TX Abort
  626. * control line, and then waiting for the TX Abort command response. This
  627. * indicates that a the device is no longer in a transmit state, and that the
  628. * command FIFO has been cleared. The host must then deactivate the TX Abort
  629. * control line. Receiving is still allowed in this case.
  630. */
  631. enum {
  632. TX_STATUS_SUCCESS = 0x01,
  633. TX_STATUS_DIRECT_DONE = 0x02,
  634. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  635. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  636. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  637. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  638. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  639. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  640. TX_STATUS_FAIL_DEST_PS = 0x88,
  641. TX_STATUS_FAIL_ABORTED = 0x89,
  642. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  643. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  644. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  645. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  646. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  647. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  648. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  649. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  650. };
  651. #define TX_PACKET_MODE_REGULAR 0x0000
  652. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  653. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  654. enum {
  655. TX_POWER_PA_NOT_ACTIVE = 0x0,
  656. };
  657. enum {
  658. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  659. TX_STATUS_DELAY_MSK = 0x00000040,
  660. TX_STATUS_ABORT_MSK = 0x00000080,
  661. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  662. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  663. TX_RESERVED = 0x00780000, /* bits 19:22 */
  664. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  665. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  666. };
  667. /* *******************************
  668. * TX aggregation state
  669. ******************************* */
  670. enum {
  671. AGG_TX_STATE_TRANSMITTED = 0x00,
  672. AGG_TX_STATE_UNDERRUN_MSK = 0x01,
  673. AGG_TX_STATE_BT_PRIO_MSK = 0x02,
  674. AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
  675. AGG_TX_STATE_ABORT_MSK = 0x08,
  676. AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
  677. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
  678. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
  679. AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
  680. AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
  681. AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
  682. AGG_TX_STATE_DUMP_TX_MSK = 0x200,
  683. AGG_TX_STATE_DELAY_TX_MSK = 0x400
  684. };
  685. #define AGG_TX_STATE_LAST_SENT_MSK \
  686. (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
  687. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
  688. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
  689. #define AGG_TX_STATE_TRY_CNT_POS 12
  690. #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
  691. #define AGG_TX_STATE_SEQ_NUM_POS 16
  692. #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
  693. /*
  694. * REPLY_TX = 0x1c (response)
  695. */
  696. struct iwl3945_tx_resp {
  697. u8 failure_rts;
  698. u8 failure_frame;
  699. u8 bt_kill_count;
  700. u8 rate;
  701. __le32 wireless_media_time;
  702. __le32 status; /* TX status (for aggregation status of 1st frame) */
  703. } __attribute__ ((packed));
  704. /*
  705. * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  706. */
  707. struct iwl3945_compressed_ba_resp {
  708. __le32 sta_addr_lo32;
  709. __le16 sta_addr_hi16;
  710. __le16 reserved;
  711. u8 sta_id;
  712. u8 tid;
  713. __le16 ba_seq_ctl;
  714. __le32 ba_bitmap0;
  715. __le32 ba_bitmap1;
  716. __le16 scd_flow;
  717. __le16 scd_ssn;
  718. } __attribute__ ((packed));
  719. /*
  720. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  721. */
  722. struct iwl3945_txpowertable_cmd {
  723. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  724. u8 reserved;
  725. __le16 channel;
  726. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  727. } __attribute__ ((packed));
  728. struct iwl3945_rate_scaling_info {
  729. __le16 rate_n_flags;
  730. u8 try_cnt;
  731. u8 next_rate_index;
  732. } __attribute__ ((packed));
  733. /**
  734. * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
  735. *
  736. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  737. *
  738. * NOTE: The table of rates passed to the uCode via the
  739. * RATE_SCALE command sets up the corresponding order of
  740. * rates used for all related commands, including rate
  741. * masks, etc.
  742. *
  743. * For example, if you set 9MB (PLCP 0x0f) as the first
  744. * rate in the rate table, the bit mask for that rate
  745. * when passed through ofdm_basic_rates on the REPLY_RXON
  746. * command would be bit 0 (1<<0)
  747. */
  748. struct iwl3945_rate_scaling_cmd {
  749. u8 table_id;
  750. u8 reserved[3];
  751. struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
  752. } __attribute__ ((packed));
  753. /*
  754. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  755. */
  756. struct iwl3945_bt_cmd {
  757. u8 flags;
  758. u8 lead_time;
  759. u8 max_kill;
  760. u8 reserved;
  761. __le32 kill_ack_mask;
  762. __le32 kill_cts_mask;
  763. } __attribute__ ((packed));
  764. /******************************************************************************
  765. * (6)
  766. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  767. *
  768. *****************************************************************************/
  769. /*
  770. * Spectrum Management
  771. */
  772. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  773. RXON_FILTER_CTL2HOST_MSK | \
  774. RXON_FILTER_ACCEPT_GRP_MSK | \
  775. RXON_FILTER_DIS_DECRYPT_MSK | \
  776. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  777. RXON_FILTER_ASSOC_MSK | \
  778. RXON_FILTER_BCON_AWARE_MSK)
  779. struct iwl3945_measure_channel {
  780. __le32 duration; /* measurement duration in extended beacon
  781. * format */
  782. u8 channel; /* channel to measure */
  783. u8 type; /* see enum iwl3945_measure_type */
  784. __le16 reserved;
  785. } __attribute__ ((packed));
  786. /*
  787. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  788. */
  789. struct iwl3945_spectrum_cmd {
  790. __le16 len; /* number of bytes starting from token */
  791. u8 token; /* token id */
  792. u8 id; /* measurement id -- 0 or 1 */
  793. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  794. u8 periodic; /* 1 = periodic */
  795. __le16 path_loss_timeout;
  796. __le32 start_time; /* start time in extended beacon format */
  797. __le32 reserved2;
  798. __le32 flags; /* rxon flags */
  799. __le32 filter_flags; /* rxon filter flags */
  800. __le16 channel_count; /* minimum 1, maximum 10 */
  801. __le16 reserved3;
  802. struct iwl3945_measure_channel channels[10];
  803. } __attribute__ ((packed));
  804. /*
  805. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  806. */
  807. struct iwl3945_spectrum_resp {
  808. u8 token;
  809. u8 id; /* id of the prior command replaced, or 0xff */
  810. __le16 status; /* 0 - command will be handled
  811. * 1 - cannot handle (conflicts with another
  812. * measurement) */
  813. } __attribute__ ((packed));
  814. enum iwl3945_measurement_state {
  815. IWL_MEASUREMENT_START = 0,
  816. IWL_MEASUREMENT_STOP = 1,
  817. };
  818. enum iwl3945_measurement_status {
  819. IWL_MEASUREMENT_OK = 0,
  820. IWL_MEASUREMENT_CONCURRENT = 1,
  821. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  822. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  823. /* 4-5 reserved */
  824. IWL_MEASUREMENT_STOPPED = 6,
  825. IWL_MEASUREMENT_TIMEOUT = 7,
  826. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  827. };
  828. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  829. struct iwl3945_measurement_histogram {
  830. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  831. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  832. } __attribute__ ((packed));
  833. /* clear channel availability counters */
  834. struct iwl3945_measurement_cca_counters {
  835. __le32 ofdm;
  836. __le32 cck;
  837. } __attribute__ ((packed));
  838. enum iwl3945_measure_type {
  839. IWL_MEASURE_BASIC = (1 << 0),
  840. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  841. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  842. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  843. IWL_MEASURE_FRAME = (1 << 4),
  844. /* bits 5:6 are reserved */
  845. IWL_MEASURE_IDLE = (1 << 7),
  846. };
  847. /*
  848. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  849. */
  850. struct iwl3945_spectrum_notification {
  851. u8 id; /* measurement id -- 0 or 1 */
  852. u8 token;
  853. u8 channel_index; /* index in measurement channel list */
  854. u8 state; /* 0 - start, 1 - stop */
  855. __le32 start_time; /* lower 32-bits of TSF */
  856. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  857. u8 channel;
  858. u8 type; /* see enum iwl3945_measurement_type */
  859. u8 reserved1;
  860. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  861. * valid if applicable for measurement type requested. */
  862. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  863. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  864. __le32 cca_time; /* channel load time in usecs */
  865. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  866. * unidentified */
  867. u8 reserved2[3];
  868. struct iwl3945_measurement_histogram histogram;
  869. __le32 stop_time; /* lower 32-bits of TSF */
  870. __le32 status; /* see iwl3945_measurement_status */
  871. } __attribute__ ((packed));
  872. /******************************************************************************
  873. * (7)
  874. * Power Management Commands, Responses, Notifications:
  875. *
  876. *****************************************************************************/
  877. /**
  878. * struct iwl3945_powertable_cmd - Power Table Command
  879. * @flags: See below:
  880. *
  881. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  882. *
  883. * PM allow:
  884. * bit 0 - '0' Driver not allow power management
  885. * '1' Driver allow PM (use rest of parameters)
  886. * uCode send sleep notifications:
  887. * bit 1 - '0' Don't send sleep notification
  888. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  889. * Sleep over DTIM
  890. * bit 2 - '0' PM have to walk up every DTIM
  891. * '1' PM could sleep over DTIM till listen Interval.
  892. * PCI power managed
  893. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  894. * '1' !(PCI_LINK_CTRL & 0x1)
  895. * Force sleep Modes
  896. * bit 31/30- '00' use both mac/xtal sleeps
  897. * '01' force Mac sleep
  898. * '10' force xtal sleep
  899. * '11' Illegal set
  900. *
  901. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  902. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  903. * for every DTIM.
  904. */
  905. #define IWL_POWER_VEC_SIZE 5
  906. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
  907. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
  908. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
  909. struct iwl3945_powertable_cmd {
  910. __le32 flags;
  911. __le32 rx_data_timeout;
  912. __le32 tx_data_timeout;
  913. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  914. } __attribute__((packed));
  915. /*
  916. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  917. * 3945 and 4965 identical.
  918. */
  919. struct iwl3945_sleep_notification {
  920. u8 pm_sleep_mode;
  921. u8 pm_wakeup_src;
  922. __le16 reserved;
  923. __le32 sleep_time;
  924. __le32 tsf_low;
  925. __le32 bcon_timer;
  926. } __attribute__ ((packed));
  927. /* Sleep states. 3945 and 4965 identical. */
  928. enum {
  929. IWL_PM_NO_SLEEP = 0,
  930. IWL_PM_SLP_MAC = 1,
  931. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  932. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  933. IWL_PM_SLP_PHY = 4,
  934. IWL_PM_SLP_REPENT = 5,
  935. IWL_PM_WAKEUP_BY_TIMER = 6,
  936. IWL_PM_WAKEUP_BY_DRIVER = 7,
  937. IWL_PM_WAKEUP_BY_RFKILL = 8,
  938. /* 3 reserved */
  939. IWL_PM_NUM_OF_MODES = 12,
  940. };
  941. /*
  942. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  943. */
  944. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  945. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  946. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  947. struct iwl3945_card_state_cmd {
  948. __le32 status; /* CARD_STATE_CMD_* request new power state */
  949. } __attribute__ ((packed));
  950. /*
  951. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  952. */
  953. struct iwl3945_card_state_notif {
  954. __le32 flags;
  955. } __attribute__ ((packed));
  956. #define HW_CARD_DISABLED 0x01
  957. #define SW_CARD_DISABLED 0x02
  958. #define RF_CARD_DISABLED 0x04
  959. #define RXON_CARD_DISABLED 0x10
  960. struct iwl3945_ct_kill_config {
  961. __le32 reserved;
  962. __le32 critical_temperature_M;
  963. __le32 critical_temperature_R;
  964. } __attribute__ ((packed));
  965. /******************************************************************************
  966. * (8)
  967. * Scan Commands, Responses, Notifications:
  968. *
  969. *****************************************************************************/
  970. struct iwl3945_scan_channel {
  971. /* type is defined as:
  972. * 0:0 active (0 - passive)
  973. * 1:4 SSID direct
  974. * If 1 is set then corresponding SSID IE is transmitted in probe
  975. * 5:7 reserved
  976. */
  977. u8 type;
  978. u8 channel;
  979. struct iwl3945_tx_power tpc;
  980. __le16 active_dwell;
  981. __le16 passive_dwell;
  982. } __attribute__ ((packed));
  983. struct iwl3945_ssid_ie {
  984. u8 id;
  985. u8 len;
  986. u8 ssid[32];
  987. } __attribute__ ((packed));
  988. #define PROBE_OPTION_MAX 0x4
  989. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  990. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  991. #define IWL_MAX_SCAN_SIZE 1024
  992. /*
  993. * REPLY_SCAN_CMD = 0x80 (command)
  994. */
  995. struct iwl3945_scan_cmd {
  996. __le16 len;
  997. u8 reserved0;
  998. u8 channel_count;
  999. __le16 quiet_time; /* dwell only this long on quiet chnl
  1000. * (active scan) */
  1001. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1002. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1003. __le16 reserved1;
  1004. __le32 max_out_time; /* max usec to be out of associated (service)
  1005. * chnl */
  1006. __le32 suspend_time; /* pause scan this long when returning to svc
  1007. * chnl.
  1008. * 3945 -- 31:24 # beacons, 19:0 additional usec,
  1009. * 4965 -- 31:22 # beacons, 21:0 additional usec.
  1010. */
  1011. __le32 flags;
  1012. __le32 filter_flags;
  1013. struct iwl3945_tx_cmd tx_cmd;
  1014. struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1015. u8 data[0];
  1016. /*
  1017. * The channels start after the probe request payload and are of type:
  1018. *
  1019. * struct iwl3945_scan_channel channels[0];
  1020. *
  1021. * NOTE: Only one band of channels can be scanned per pass. You
  1022. * can not mix 2.4GHz channels and 5.2GHz channels and must
  1023. * request a scan multiple times (not concurrently)
  1024. *
  1025. */
  1026. } __attribute__ ((packed));
  1027. /* Can abort will notify by complete notification with abort status. */
  1028. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1029. /* complete notification statuses */
  1030. #define ABORT_STATUS 0x2
  1031. /*
  1032. * REPLY_SCAN_CMD = 0x80 (response)
  1033. */
  1034. struct iwl3945_scanreq_notification {
  1035. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1036. } __attribute__ ((packed));
  1037. /*
  1038. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1039. */
  1040. struct iwl3945_scanstart_notification {
  1041. __le32 tsf_low;
  1042. __le32 tsf_high;
  1043. __le32 beacon_timer;
  1044. u8 channel;
  1045. u8 band;
  1046. u8 reserved[2];
  1047. __le32 status;
  1048. } __attribute__ ((packed));
  1049. #define SCAN_OWNER_STATUS 0x1;
  1050. #define MEASURE_OWNER_STATUS 0x2;
  1051. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1052. /*
  1053. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1054. */
  1055. struct iwl3945_scanresults_notification {
  1056. u8 channel;
  1057. u8 band;
  1058. u8 reserved[2];
  1059. __le32 tsf_low;
  1060. __le32 tsf_high;
  1061. __le32 statistics[NUMBER_OF_STATISTICS];
  1062. } __attribute__ ((packed));
  1063. /*
  1064. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1065. */
  1066. struct iwl3945_scancomplete_notification {
  1067. u8 scanned_channels;
  1068. u8 status;
  1069. u8 reserved;
  1070. u8 last_channel;
  1071. __le32 tsf_low;
  1072. __le32 tsf_high;
  1073. } __attribute__ ((packed));
  1074. /******************************************************************************
  1075. * (9)
  1076. * IBSS/AP Commands and Notifications:
  1077. *
  1078. *****************************************************************************/
  1079. /*
  1080. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1081. */
  1082. struct iwl3945_beacon_notif {
  1083. struct iwl3945_tx_resp beacon_notify_hdr;
  1084. __le32 low_tsf;
  1085. __le32 high_tsf;
  1086. __le32 ibss_mgr_status;
  1087. } __attribute__ ((packed));
  1088. /*
  1089. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1090. */
  1091. struct iwl3945_tx_beacon_cmd {
  1092. struct iwl3945_tx_cmd tx;
  1093. __le16 tim_idx;
  1094. u8 tim_size;
  1095. u8 reserved1;
  1096. struct ieee80211_hdr frame[0]; /* beacon frame */
  1097. } __attribute__ ((packed));
  1098. /******************************************************************************
  1099. * (10)
  1100. * Statistics Commands and Notifications:
  1101. *
  1102. *****************************************************************************/
  1103. #define IWL_TEMP_CONVERT 260
  1104. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1105. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1106. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1107. /* Used for passing to driver number of successes and failures per rate */
  1108. struct rate_histogram {
  1109. union {
  1110. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1111. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1112. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1113. } success;
  1114. union {
  1115. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1116. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1117. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1118. } failed;
  1119. } __attribute__ ((packed));
  1120. /* statistics command response */
  1121. struct statistics_rx_phy {
  1122. __le32 ina_cnt;
  1123. __le32 fina_cnt;
  1124. __le32 plcp_err;
  1125. __le32 crc32_err;
  1126. __le32 overrun_err;
  1127. __le32 early_overrun_err;
  1128. __le32 crc32_good;
  1129. __le32 false_alarm_cnt;
  1130. __le32 fina_sync_err_cnt;
  1131. __le32 sfd_timeout;
  1132. __le32 fina_timeout;
  1133. __le32 unresponded_rts;
  1134. __le32 rxe_frame_limit_overrun;
  1135. __le32 sent_ack_cnt;
  1136. __le32 sent_cts_cnt;
  1137. } __attribute__ ((packed));
  1138. struct statistics_rx_non_phy {
  1139. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1140. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1141. __le32 non_bssid_frames; /* number of frames with BSSID that
  1142. * doesn't belong to the STA BSSID */
  1143. __le32 filtered_frames; /* count frames that were dumped in the
  1144. * filtering process */
  1145. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1146. * our serving channel */
  1147. } __attribute__ ((packed));
  1148. struct statistics_rx {
  1149. struct statistics_rx_phy ofdm;
  1150. struct statistics_rx_phy cck;
  1151. struct statistics_rx_non_phy general;
  1152. } __attribute__ ((packed));
  1153. struct statistics_tx {
  1154. __le32 preamble_cnt;
  1155. __le32 rx_detected_cnt;
  1156. __le32 bt_prio_defer_cnt;
  1157. __le32 bt_prio_kill_cnt;
  1158. __le32 few_bytes_cnt;
  1159. __le32 cts_timeout;
  1160. __le32 ack_timeout;
  1161. __le32 expected_ack_cnt;
  1162. __le32 actual_ack_cnt;
  1163. } __attribute__ ((packed));
  1164. struct statistics_dbg {
  1165. __le32 burst_check;
  1166. __le32 burst_count;
  1167. __le32 reserved[4];
  1168. } __attribute__ ((packed));
  1169. struct statistics_div {
  1170. __le32 tx_on_a;
  1171. __le32 tx_on_b;
  1172. __le32 exec_time;
  1173. __le32 probe_time;
  1174. } __attribute__ ((packed));
  1175. struct statistics_general {
  1176. __le32 temperature;
  1177. struct statistics_dbg dbg;
  1178. __le32 sleep_time;
  1179. __le32 slots_out;
  1180. __le32 slots_idle;
  1181. __le32 ttl_timestamp;
  1182. struct statistics_div div;
  1183. } __attribute__ ((packed));
  1184. /*
  1185. * REPLY_STATISTICS_CMD = 0x9c,
  1186. * 3945 and 4965 identical.
  1187. *
  1188. * This command triggers an immediate response containing uCode statistics.
  1189. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1190. *
  1191. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1192. * internal copy of the statistics (counters) after issuing the response.
  1193. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1194. *
  1195. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1196. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1197. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1198. */
  1199. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1200. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1201. struct iwl3945_statistics_cmd {
  1202. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1203. } __attribute__ ((packed));
  1204. /*
  1205. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1206. *
  1207. * By default, uCode issues this notification after receiving a beacon
  1208. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1209. * REPLY_STATISTICS_CMD 0x9c, above.
  1210. *
  1211. * Statistics counters continue to increment beacon after beacon, but are
  1212. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1213. * 0x9c with CLEAR_STATS bit set (see above).
  1214. *
  1215. * uCode also issues this notification during scans. uCode clears statistics
  1216. * appropriately so that each notification contains statistics for only the
  1217. * one channel that has just been scanned.
  1218. */
  1219. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1220. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1221. struct iwl3945_notif_statistics {
  1222. __le32 flag;
  1223. struct statistics_rx rx;
  1224. struct statistics_tx tx;
  1225. struct statistics_general general;
  1226. } __attribute__ ((packed));
  1227. /*
  1228. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1229. */
  1230. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1231. * then this notification will be sent. */
  1232. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1233. struct iwl3945_missed_beacon_notif {
  1234. __le32 consequtive_missed_beacons;
  1235. __le32 total_missed_becons;
  1236. __le32 num_expected_beacons;
  1237. __le32 num_recvd_beacons;
  1238. } __attribute__ ((packed));
  1239. /******************************************************************************
  1240. * (11)
  1241. * Rx Calibration Commands:
  1242. *
  1243. *****************************************************************************/
  1244. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1245. #define HD_TABLE_SIZE (11)
  1246. struct iwl3945_sensitivity_cmd {
  1247. __le16 control;
  1248. __le16 table[HD_TABLE_SIZE];
  1249. } __attribute__ ((packed));
  1250. struct iwl3945_calibration_cmd {
  1251. u8 opCode;
  1252. u8 flags;
  1253. __le16 reserved;
  1254. s8 diff_gain_a;
  1255. s8 diff_gain_b;
  1256. s8 diff_gain_c;
  1257. u8 reserved1;
  1258. } __attribute__ ((packed));
  1259. /******************************************************************************
  1260. * (12)
  1261. * Miscellaneous Commands:
  1262. *
  1263. *****************************************************************************/
  1264. /*
  1265. * LEDs Command & Response
  1266. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1267. *
  1268. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1269. * this command turns it on or off, or sets up a periodic blinking cycle.
  1270. */
  1271. struct iwl3945_led_cmd {
  1272. __le32 interval; /* "interval" in uSec */
  1273. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1274. u8 off; /* # intervals off while blinking;
  1275. * "0", with >0 "on" value, turns LED on */
  1276. u8 on; /* # intervals on while blinking;
  1277. * "0", regardless of "off", turns LED off */
  1278. u8 reserved;
  1279. } __attribute__ ((packed));
  1280. /******************************************************************************
  1281. * (13)
  1282. * Union of all expected notifications/responses:
  1283. *
  1284. *****************************************************************************/
  1285. struct iwl3945_rx_packet {
  1286. __le32 len;
  1287. struct iwl3945_cmd_header hdr;
  1288. union {
  1289. struct iwl3945_alive_resp alive_frame;
  1290. struct iwl3945_rx_frame rx_frame;
  1291. struct iwl3945_tx_resp tx_resp;
  1292. struct iwl3945_spectrum_notification spectrum_notif;
  1293. struct iwl3945_csa_notification csa_notif;
  1294. struct iwl3945_error_resp err_resp;
  1295. struct iwl3945_card_state_notif card_state_notif;
  1296. struct iwl3945_beacon_notif beacon_status;
  1297. struct iwl3945_add_sta_resp add_sta;
  1298. struct iwl3945_sleep_notification sleep_notif;
  1299. struct iwl3945_spectrum_resp spectrum;
  1300. struct iwl3945_notif_statistics stats;
  1301. __le32 status;
  1302. u8 raw[0];
  1303. } u;
  1304. } __attribute__ ((packed));
  1305. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
  1306. #endif /* __iwl3945_3945_commands_h__ */