iwl-3945-commands.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317
  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 - 2008 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. * Intel Linux Wireless <ilw@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 - 2008 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. /*
  64. * Please use this file (iwl-3945-commands.h) only for uCode API definitions.
  65. * Please use iwl-3945-hw.h for hardware-related definitions.
  66. * Please use iwl-3945.h for driver implementation definitions.
  67. */
  68. #ifndef __iwl_3945_commands_h__
  69. #define __iwl_3945_commands_h__
  70. /* uCode version contains 4 values: Major/Minor/API/Serial */
  71. #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
  72. #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
  73. #define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
  74. #define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
  75. /* Tx rates */
  76. #define IWL_CCK_RATES 4
  77. #define IWL_OFDM_RATES 8
  78. #define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES)
  79. /******************************************************************************
  80. * (0)
  81. * Commonly used structures and definitions:
  82. * Command header, txpower
  83. *
  84. *****************************************************************************/
  85. /* iwl3945_cmd_header flags value */
  86. #define IWL_CMD_FAILED_MSK 0x40
  87. /**
  88. * struct iwl3945_cmd_header
  89. *
  90. * This header format appears in the beginning of each command sent from the
  91. * driver, and each response/notification received from uCode.
  92. */
  93. struct iwl3945_cmd_header {
  94. u8 cmd; /* Command ID: REPLY_RXON, etc. */
  95. u8 flags; /* IWL_CMD_* */
  96. /*
  97. * The driver sets up the sequence number to values of its choosing.
  98. * uCode does not use this value, but passes it back to the driver
  99. * when sending the response to each driver-originated command, so
  100. * the driver can match the response to the command. Since the values
  101. * don't get used by uCode, the driver may set up an arbitrary format.
  102. *
  103. * There is one exception: uCode sets bit 15 when it originates
  104. * the response/notification, i.e. when the response/notification
  105. * is not a direct response to a command sent by the driver. For
  106. * example, uCode issues REPLY_3945_RX when it sends a received frame
  107. * to the driver; it is not a direct response to any driver command.
  108. *
  109. * The Linux driver uses the following format:
  110. *
  111. * 0:7 index/position within Tx queue
  112. * 8:13 Tx queue selection
  113. * 14:14 driver sets this to indicate command is in the 'huge'
  114. * storage at the end of the command buffers, i.e. scan cmd
  115. * 15:15 uCode sets this in uCode-originated response/notification
  116. */
  117. __le16 sequence;
  118. /* command or response/notification data follows immediately */
  119. u8 data[0];
  120. } __attribute__ ((packed));
  121. /**
  122. * struct iwl3945_tx_power
  123. *
  124. * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
  125. *
  126. * Each entry contains two values:
  127. * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
  128. * linear value that multiplies the output of the digital signal processor,
  129. * before being sent to the analog radio.
  130. * 2) Radio gain. This sets the analog gain of the radio Tx path.
  131. * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
  132. *
  133. * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
  134. */
  135. struct iwl3945_tx_power {
  136. u8 tx_gain; /* gain for analog radio */
  137. u8 dsp_atten; /* gain for DSP */
  138. } __attribute__ ((packed));
  139. /**
  140. * struct iwl3945_power_per_rate
  141. *
  142. * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
  143. */
  144. struct iwl3945_power_per_rate {
  145. u8 rate; /* plcp */
  146. struct iwl3945_tx_power tpc;
  147. u8 reserved;
  148. } __attribute__ ((packed));
  149. /******************************************************************************
  150. * (0a)
  151. * Alive and Error Commands & Responses:
  152. *
  153. *****************************************************************************/
  154. #define UCODE_VALID_OK cpu_to_le32(0x1)
  155. #define INITIALIZE_SUBTYPE (9)
  156. /*
  157. * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
  158. *
  159. * uCode issues this "initialize alive" notification once the initialization
  160. * uCode image has completed its work, and is ready to load the runtime image.
  161. * This is the *first* "alive" notification that the driver will receive after
  162. * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
  163. *
  164. * See comments documenting "BSM" (bootstrap state machine).
  165. */
  166. struct iwl3945_init_alive_resp {
  167. u8 ucode_minor;
  168. u8 ucode_major;
  169. __le16 reserved1;
  170. u8 sw_rev[8];
  171. u8 ver_type;
  172. u8 ver_subtype; /* "9" for initialize alive */
  173. __le16 reserved2;
  174. __le32 log_event_table_ptr;
  175. __le32 error_event_table_ptr;
  176. __le32 timestamp;
  177. __le32 is_valid;
  178. } __attribute__ ((packed));
  179. /**
  180. * REPLY_ALIVE = 0x1 (response only, not a command)
  181. *
  182. * uCode issues this "alive" notification once the runtime image is ready
  183. * to receive commands from the driver. This is the *second* "alive"
  184. * notification that the driver will receive after rebooting uCode;
  185. * this "alive" is indicated by subtype field != 9.
  186. *
  187. * See comments documenting "BSM" (bootstrap state machine).
  188. *
  189. * This response includes two pointers to structures within the device's
  190. * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
  191. *
  192. * 1) log_event_table_ptr indicates base of the event log. This traces
  193. * a 256-entry history of uCode execution within a circular buffer.
  194. *
  195. * 2) error_event_table_ptr indicates base of the error log. This contains
  196. * information about any uCode error that occurs.
  197. *
  198. * The Linux driver can print both logs to the system log when a uCode error
  199. * occurs.
  200. */
  201. struct iwl3945_alive_resp {
  202. u8 ucode_minor;
  203. u8 ucode_major;
  204. __le16 reserved1;
  205. u8 sw_rev[8];
  206. u8 ver_type;
  207. u8 ver_subtype; /* not "9" for runtime alive */
  208. __le16 reserved2;
  209. __le32 log_event_table_ptr; /* SRAM address for event log */
  210. __le32 error_event_table_ptr; /* SRAM address for error log */
  211. __le32 timestamp;
  212. __le32 is_valid;
  213. } __attribute__ ((packed));
  214. union tsf {
  215. u8 byte[8];
  216. __le16 word[4];
  217. __le32 dw[2];
  218. };
  219. /*
  220. * REPLY_ERROR = 0x2 (response only, not a command)
  221. */
  222. struct iwl3945_error_resp {
  223. __le32 error_type;
  224. u8 cmd_id;
  225. u8 reserved1;
  226. __le16 bad_cmd_seq_num;
  227. __le16 reserved2;
  228. __le32 error_info;
  229. union tsf timestamp;
  230. } __attribute__ ((packed));
  231. /******************************************************************************
  232. * (1)
  233. * RXON Commands & Responses:
  234. *
  235. *****************************************************************************/
  236. /* rx_config flags */
  237. /* band & modulation selection */
  238. #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
  239. #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
  240. /* auto detection enable */
  241. #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
  242. /* TGg protection when tx */
  243. #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
  244. /* cck short slot & preamble */
  245. #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
  246. #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
  247. /* antenna selection */
  248. #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
  249. #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
  250. #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
  251. #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
  252. /* radar detection enable */
  253. #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
  254. #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
  255. /* rx response to host with 8-byte TSF
  256. * (according to ON_AIR deassertion) */
  257. #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
  258. /* rx_config filter flags */
  259. /* accept all data frames */
  260. #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
  261. /* pass control & management to host */
  262. #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
  263. /* accept multi-cast */
  264. #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
  265. /* don't decrypt uni-cast frames */
  266. #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
  267. /* don't decrypt multi-cast frames */
  268. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
  269. /* STA is associated */
  270. #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
  271. /* transfer to host non bssid beacons in associated state */
  272. #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
  273. /**
  274. * REPLY_RXON = 0x10 (command, has simple generic response)
  275. *
  276. * RXON tunes the radio tuner to a service channel, and sets up a number
  277. * of parameters that are used primarily for Rx, but also for Tx operations.
  278. *
  279. * NOTE: When tuning to a new channel, driver must set the
  280. * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
  281. * info within the device, including the station tables, tx retry
  282. * rate tables, and txpower tables. Driver must build a new station
  283. * table and txpower table before transmitting anything on the RXON
  284. * channel.
  285. *
  286. * NOTE: All RXONs wipe clean the internal txpower table. Driver must
  287. * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
  288. * regardless of whether RXON_FILTER_ASSOC_MSK is set.
  289. */
  290. struct iwl3945_rxon_cmd {
  291. u8 node_addr[6];
  292. __le16 reserved1;
  293. u8 bssid_addr[6];
  294. __le16 reserved2;
  295. u8 wlap_bssid_addr[6];
  296. __le16 reserved3;
  297. u8 dev_type;
  298. u8 air_propagation;
  299. __le16 reserved4;
  300. u8 ofdm_basic_rates;
  301. u8 cck_basic_rates;
  302. __le16 assoc_id;
  303. __le32 flags;
  304. __le32 filter_flags;
  305. __le16 channel;
  306. __le16 reserved5;
  307. } __attribute__ ((packed));
  308. /*
  309. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  310. */
  311. struct iwl3945_rxon_assoc_cmd {
  312. __le32 flags;
  313. __le32 filter_flags;
  314. u8 ofdm_basic_rates;
  315. u8 cck_basic_rates;
  316. __le16 reserved;
  317. } __attribute__ ((packed));
  318. /*
  319. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  320. */
  321. struct iwl3945_rxon_time_cmd {
  322. union tsf timestamp;
  323. __le16 beacon_interval;
  324. __le16 atim_window;
  325. __le32 beacon_init_val;
  326. __le16 listen_interval;
  327. __le16 reserved;
  328. } __attribute__ ((packed));
  329. /*
  330. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  331. */
  332. struct iwl3945_channel_switch_cmd {
  333. u8 band;
  334. u8 expect_beacon;
  335. __le16 channel;
  336. __le32 rxon_flags;
  337. __le32 rxon_filter_flags;
  338. __le32 switch_time;
  339. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  340. } __attribute__ ((packed));
  341. /*
  342. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  343. */
  344. struct iwl3945_csa_notification {
  345. __le16 band;
  346. __le16 channel;
  347. __le32 status; /* 0 - OK, 1 - fail */
  348. } __attribute__ ((packed));
  349. /******************************************************************************
  350. * (2)
  351. * Quality-of-Service (QOS) Commands & Responses:
  352. *
  353. *****************************************************************************/
  354. /**
  355. * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
  356. * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
  357. *
  358. * @cw_min: Contention window, start value in numbers of slots.
  359. * Should be a power-of-2, minus 1. Device's default is 0x0f.
  360. * @cw_max: Contention window, max value in numbers of slots.
  361. * Should be a power-of-2, minus 1. Device's default is 0x3f.
  362. * @aifsn: Number of slots in Arbitration Interframe Space (before
  363. * performing random backoff timing prior to Tx). Device default 1.
  364. * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
  365. *
  366. * Device will automatically increase contention window by (2*CW) + 1 for each
  367. * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
  368. * value, to cap the CW value.
  369. */
  370. struct iwl3945_ac_qos {
  371. __le16 cw_min;
  372. __le16 cw_max;
  373. u8 aifsn;
  374. u8 reserved1;
  375. __le16 edca_txop;
  376. } __attribute__ ((packed));
  377. /* QoS flags defines */
  378. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
  379. #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
  380. #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
  381. /* Number of Access Categories (AC) (EDCA), queues 0..3 */
  382. #define AC_NUM 4
  383. /*
  384. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  385. *
  386. * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
  387. * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
  388. */
  389. struct iwl3945_qosparam_cmd {
  390. __le32 qos_flags;
  391. struct iwl3945_ac_qos ac[AC_NUM];
  392. } __attribute__ ((packed));
  393. /******************************************************************************
  394. * (3)
  395. * Add/Modify Stations Commands & Responses:
  396. *
  397. *****************************************************************************/
  398. /*
  399. * Multi station support
  400. */
  401. /* Special, dedicated locations within device's station table */
  402. #define IWL_AP_ID 0
  403. #define IWL_MULTICAST_ID 1
  404. #define IWL_STA_ID 2
  405. #define IWL3945_BROADCAST_ID 24
  406. #define IWL3945_STATION_COUNT 25
  407. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  408. #define IWL_INVALID_STATION 255
  409. #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2);
  410. #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8);
  411. /* Use in mode field. 1: modify existing entry, 0: add new station entry */
  412. #define STA_CONTROL_MODIFY_MSK 0x01
  413. /* key flags __le16*/
  414. #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
  415. #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
  416. #define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
  417. #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
  418. #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
  419. #define STA_KEY_FLG_KEYID_POS 8
  420. #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
  421. /* wep key is either from global key (0) or from station info array (1) */
  422. #define STA_KEY_FLG_WEP_KEY_MAP_MSK cpu_to_le16(0x0008)
  423. /* wep key in STA: 5-bytes (0) or 13-bytes (1) */
  424. #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
  425. #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
  426. /* Flags indicate whether to modify vs. don't change various station params */
  427. #define STA_MODIFY_KEY_MASK 0x01
  428. #define STA_MODIFY_TID_DISABLE_TX 0x02
  429. #define STA_MODIFY_TX_RATE_MSK 0x04
  430. struct iwl3945_keyinfo {
  431. __le16 key_flags;
  432. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  433. u8 reserved1;
  434. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  435. u8 key_offset;
  436. u8 reserved2;
  437. u8 key[16]; /* 16-byte unicast decryption key */
  438. } __attribute__ ((packed));
  439. /*
  440. * REPLY_ADD_STA = 0x18 (command)
  441. *
  442. * The device contains an internal table of per-station information,
  443. * with info on security keys, aggregation parameters, and Tx rates for
  444. * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
  445. * 3945 uses REPLY_RATE_SCALE to set up rate tables).
  446. *
  447. * REPLY_ADD_STA sets up the table entry for one station, either creating
  448. * a new entry, or modifying a pre-existing one.
  449. *
  450. * NOTE: RXON command (without "associated" bit set) wipes the station table
  451. * clean. Moving into RF_KILL state does this also. Driver must set up
  452. * new station table before transmitting anything on the RXON channel
  453. * (except active scans or active measurements; those commands carry
  454. * their own txpower/rate setup data).
  455. *
  456. * When getting started on a new channel, driver must set up the
  457. * IWL_BROADCAST_ID entry (last entry in the table). For a client
  458. * station in a BSS, once an AP is selected, driver sets up the AP STA
  459. * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
  460. * are all that are needed for a BSS client station. If the device is
  461. * used as AP, or in an IBSS network, driver must set up station table
  462. * entries for all STAs in network, starting with index IWL_STA_ID.
  463. */
  464. struct iwl3945_addsta_cmd {
  465. u8 mode; /* 1: modify existing, 0: add new station */
  466. u8 reserved[3];
  467. struct sta_id_modify sta;
  468. struct iwl3945_keyinfo key;
  469. __le32 station_flags; /* STA_FLG_* */
  470. __le32 station_flags_msk; /* STA_FLG_* */
  471. /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
  472. * corresponding to bit (e.g. bit 5 controls TID 5).
  473. * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
  474. __le16 tid_disable_tx;
  475. __le16 rate_n_flags;
  476. /* TID for which to add block-ack support.
  477. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  478. u8 add_immediate_ba_tid;
  479. /* TID for which to remove block-ack support.
  480. * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
  481. u8 remove_immediate_ba_tid;
  482. /* Starting Sequence Number for added block-ack support.
  483. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  484. __le16 add_immediate_ba_ssn;
  485. } __attribute__ ((packed));
  486. #define ADD_STA_SUCCESS_MSK 0x1
  487. #define ADD_STA_NO_ROOM_IN_TABLE 0x2
  488. #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
  489. /*
  490. * REPLY_ADD_STA = 0x18 (response)
  491. */
  492. struct iwl3945_add_sta_resp {
  493. u8 status; /* ADD_STA_* */
  494. } __attribute__ ((packed));
  495. /******************************************************************************
  496. * (4)
  497. * Rx Responses:
  498. *
  499. *****************************************************************************/
  500. struct iwl3945_rx_frame_stats {
  501. u8 phy_count;
  502. u8 id;
  503. u8 rssi;
  504. u8 agc;
  505. __le16 sig_avg;
  506. __le16 noise_diff;
  507. u8 payload[0];
  508. } __attribute__ ((packed));
  509. struct iwl3945_rx_frame_hdr {
  510. __le16 channel;
  511. __le16 phy_flags;
  512. u8 reserved1;
  513. u8 rate;
  514. __le16 len;
  515. u8 payload[0];
  516. } __attribute__ ((packed));
  517. #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
  518. #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
  519. #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
  520. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
  521. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
  522. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
  523. #define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0)
  524. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  525. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  526. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  527. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  528. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  529. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  530. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  531. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  532. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  533. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  534. struct iwl3945_rx_frame_end {
  535. __le32 status;
  536. __le64 timestamp;
  537. __le32 beacon_timestamp;
  538. } __attribute__ ((packed));
  539. /*
  540. * REPLY_3945_RX = 0x1b (response only, not a command)
  541. *
  542. * NOTE: DO NOT dereference from casts to this structure
  543. * It is provided only for calculating minimum data set size.
  544. * The actual offsets of the hdr and end are dynamic based on
  545. * stats.phy_count
  546. */
  547. struct iwl3945_rx_frame {
  548. struct iwl3945_rx_frame_stats stats;
  549. struct iwl3945_rx_frame_hdr hdr;
  550. struct iwl3945_rx_frame_end end;
  551. } __attribute__ ((packed));
  552. /******************************************************************************
  553. * (5)
  554. * Tx Commands & Responses:
  555. *
  556. * Driver must place each REPLY_TX command into one of the prioritized Tx
  557. * queues in host DRAM, shared between driver and device. When the device's
  558. * Tx scheduler and uCode are preparing to transmit, the device pulls the
  559. * Tx command over the PCI bus via one of the device's Tx DMA channels,
  560. * to fill an internal FIFO from which data will be transmitted.
  561. *
  562. * uCode handles all timing and protocol related to control frames
  563. * (RTS/CTS/ACK), based on flags in the Tx command.
  564. *
  565. * uCode handles retrying Tx when an ACK is expected but not received.
  566. * This includes trying lower data rates than the one requested in the Tx
  567. * command, as set up by the REPLY_RATE_SCALE (for 3945) or
  568. * REPLY_TX_LINK_QUALITY_CMD (4965).
  569. *
  570. * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
  571. * This command must be executed after every RXON command, before Tx can occur.
  572. *****************************************************************************/
  573. /* REPLY_TX Tx flags field */
  574. /* 1: Use Request-To-Send protocol before this frame.
  575. * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
  576. #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
  577. /* 1: Transmit Clear-To-Send to self before this frame.
  578. * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
  579. * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
  580. #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
  581. /* 1: Expect ACK from receiving station
  582. * 0: Don't expect ACK (MAC header's duration field s/b 0)
  583. * Set this for unicast frames, but not broadcast/multicast. */
  584. #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
  585. /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
  586. * Tx command's initial_rate_index indicates first rate to try;
  587. * uCode walks through table for additional Tx attempts.
  588. * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
  589. * This rate will be used for all Tx attempts; it will not be scaled. */
  590. #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
  591. /* 1: Expect immediate block-ack.
  592. * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
  593. #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
  594. /* 1: Frame requires full Tx-Op protection.
  595. * Set this if either RTS or CTS Tx Flag gets set. */
  596. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
  597. /* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
  598. * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
  599. #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
  600. #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
  601. #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
  602. /* 1: Ignore Bluetooth priority for this frame.
  603. * 0: Delay Tx until Bluetooth device is done (normal usage). */
  604. #define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12)
  605. /* 1: uCode overrides sequence control field in MAC header.
  606. * 0: Driver provides sequence control field in MAC header.
  607. * Set this for management frames, non-QOS data frames, non-unicast frames,
  608. * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
  609. #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
  610. /* 1: This frame is non-last MPDU; more fragments are coming.
  611. * 0: Last fragment, or not using fragmentation. */
  612. #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
  613. /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
  614. * 0: No TSF required in outgoing frame.
  615. * Set this for transmitting beacons and probe responses. */
  616. #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
  617. /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
  618. * alignment of frame's payload data field.
  619. * 0: No pad
  620. * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
  621. * field (but not both). Driver must align frame data (i.e. data following
  622. * MAC header) to DWORD boundary. */
  623. #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
  624. /* HCCA-AP - disable duration overwriting. */
  625. #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
  626. /*
  627. * TX command security control
  628. */
  629. #define TX_CMD_SEC_WEP 0x01
  630. #define TX_CMD_SEC_CCM 0x02
  631. #define TX_CMD_SEC_TKIP 0x03
  632. #define TX_CMD_SEC_MSK 0x03
  633. #define TX_CMD_SEC_SHIFT 6
  634. #define TX_CMD_SEC_KEY128 0x08
  635. /*
  636. * REPLY_TX = 0x1c (command)
  637. */
  638. struct iwl3945_tx_cmd {
  639. /*
  640. * MPDU byte count:
  641. * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
  642. * + 8 byte IV for CCM or TKIP (not used for WEP)
  643. * + Data payload
  644. * + 8-byte MIC (not used for CCM/WEP)
  645. * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
  646. * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
  647. * Range: 14-2342 bytes.
  648. */
  649. __le16 len;
  650. /*
  651. * MPDU or MSDU byte count for next frame.
  652. * Used for fragmentation and bursting, but not 11n aggregation.
  653. * Same as "len", but for next frame. Set to 0 if not applicable.
  654. */
  655. __le16 next_frame_len;
  656. __le32 tx_flags; /* TX_CMD_FLG_* */
  657. u8 rate;
  658. /* Index of recipient station in uCode's station table */
  659. u8 sta_id;
  660. u8 tid_tspec;
  661. u8 sec_ctl;
  662. u8 key[16];
  663. union {
  664. u8 byte[8];
  665. __le16 word[4];
  666. __le32 dw[2];
  667. } tkip_mic;
  668. __le32 next_frame_info;
  669. union {
  670. __le32 life_time;
  671. __le32 attempt;
  672. } stop_time;
  673. u8 supp_rates[2];
  674. u8 rts_retry_limit; /*byte 50 */
  675. u8 data_retry_limit; /*byte 51 */
  676. union {
  677. __le16 pm_frame_timeout;
  678. __le16 attempt_duration;
  679. } timeout;
  680. /*
  681. * Duration of EDCA burst Tx Opportunity, in 32-usec units.
  682. * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
  683. */
  684. __le16 driver_txop;
  685. /*
  686. * MAC header goes here, followed by 2 bytes padding if MAC header
  687. * length is 26 or 30 bytes, followed by payload data
  688. */
  689. u8 payload[0];
  690. struct ieee80211_hdr hdr[0];
  691. } __attribute__ ((packed));
  692. /*
  693. * REPLY_TX = 0x1c (response)
  694. */
  695. struct iwl3945_tx_resp {
  696. u8 failure_rts;
  697. u8 failure_frame;
  698. u8 bt_kill_count;
  699. u8 rate;
  700. __le32 wireless_media_time;
  701. __le32 status; /* TX status */
  702. } __attribute__ ((packed));
  703. /*
  704. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  705. */
  706. struct iwl3945_txpowertable_cmd {
  707. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  708. u8 reserved;
  709. __le16 channel;
  710. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  711. } __attribute__ ((packed));
  712. struct iwl3945_rate_scaling_info {
  713. __le16 rate_n_flags;
  714. u8 try_cnt;
  715. u8 next_rate_index;
  716. } __attribute__ ((packed));
  717. /**
  718. * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
  719. *
  720. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  721. *
  722. * NOTE: The table of rates passed to the uCode via the
  723. * RATE_SCALE command sets up the corresponding order of
  724. * rates used for all related commands, including rate
  725. * masks, etc.
  726. *
  727. * For example, if you set 9MB (PLCP 0x0f) as the first
  728. * rate in the rate table, the bit mask for that rate
  729. * when passed through ofdm_basic_rates on the REPLY_RXON
  730. * command would be bit 0 (1 << 0)
  731. */
  732. struct iwl3945_rate_scaling_cmd {
  733. u8 table_id;
  734. u8 reserved[3];
  735. struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
  736. } __attribute__ ((packed));
  737. /*
  738. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  739. *
  740. * 3945 and 4965 support hardware handshake with Bluetooth device on
  741. * same platform. Bluetooth device alerts wireless device when it will Tx;
  742. * wireless device can delay or kill its own Tx to accommodate.
  743. */
  744. struct iwl3945_bt_cmd {
  745. u8 flags;
  746. u8 lead_time;
  747. u8 max_kill;
  748. u8 reserved;
  749. __le32 kill_ack_mask;
  750. __le32 kill_cts_mask;
  751. } __attribute__ ((packed));
  752. /******************************************************************************
  753. * (6)
  754. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  755. *
  756. *****************************************************************************/
  757. /*
  758. * Spectrum Management
  759. */
  760. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  761. RXON_FILTER_CTL2HOST_MSK | \
  762. RXON_FILTER_ACCEPT_GRP_MSK | \
  763. RXON_FILTER_DIS_DECRYPT_MSK | \
  764. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  765. RXON_FILTER_ASSOC_MSK | \
  766. RXON_FILTER_BCON_AWARE_MSK)
  767. struct iwl3945_measure_channel {
  768. __le32 duration; /* measurement duration in extended beacon
  769. * format */
  770. u8 channel; /* channel to measure */
  771. u8 type; /* see enum iwl3945_measure_type */
  772. __le16 reserved;
  773. } __attribute__ ((packed));
  774. #define HW_CARD_DISABLED 0x01
  775. #define SW_CARD_DISABLED 0x02
  776. #define RF_CARD_DISABLED 0x04
  777. #define RXON_CARD_DISABLED 0x10
  778. struct iwl3945_ct_kill_config {
  779. __le32 reserved;
  780. __le32 critical_temperature_M;
  781. __le32 critical_temperature_R;
  782. } __attribute__ ((packed));
  783. /******************************************************************************
  784. * (8)
  785. * Scan Commands, Responses, Notifications:
  786. *
  787. *****************************************************************************/
  788. /**
  789. * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
  790. *
  791. * One for each channel in the scan list.
  792. * Each channel can independently select:
  793. * 1) SSID for directed active scans
  794. * 2) Txpower setting (for rate specified within Tx command)
  795. * 3) How long to stay on-channel (behavior may be modified by quiet_time,
  796. * quiet_plcp_th, good_CRC_th)
  797. *
  798. * To avoid uCode errors, make sure the following are true (see comments
  799. * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
  800. * 1) If using passive_dwell (i.e. passive_dwell != 0):
  801. * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
  802. * 2) quiet_time <= active_dwell
  803. * 3) If restricting off-channel time (i.e. max_out_time !=0):
  804. * passive_dwell < max_out_time
  805. * active_dwell < max_out_time
  806. */
  807. struct iwl3945_scan_channel {
  808. /*
  809. * type is defined as:
  810. * 0:0 1 = active, 0 = passive
  811. * 1:4 SSID direct bit map; if a bit is set, then corresponding
  812. * SSID IE is transmitted in probe request.
  813. * 5:7 reserved
  814. */
  815. u8 type;
  816. u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
  817. struct iwl3945_tx_power tpc;
  818. __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
  819. __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
  820. } __attribute__ ((packed));
  821. /**
  822. * struct iwl3945_ssid_ie - directed scan network information element
  823. *
  824. * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
  825. * in struct iwl3945_scan_channel; each channel may select different ssids from
  826. * among the 4 entries. SSID IEs get transmitted in reverse order of entry.
  827. */
  828. struct iwl3945_ssid_ie {
  829. u8 id;
  830. u8 len;
  831. u8 ssid[32];
  832. } __attribute__ ((packed));
  833. /* uCode API-1 take 4 probes */
  834. #define PROBE_OPTION_MAX_API1 0x4
  835. #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
  836. #define IWL_GOOD_CRC_TH cpu_to_le16(1)
  837. #define IWL_MAX_SCAN_SIZE 1024
  838. /*
  839. * REPLY_SCAN_CMD = 0x80 (command)
  840. *
  841. * The hardware scan command is very powerful; the driver can set it up to
  842. * maintain (relatively) normal network traffic while doing a scan in the
  843. * background. The max_out_time and suspend_time control the ratio of how
  844. * long the device stays on an associated network channel ("service channel")
  845. * vs. how long it's away from the service channel, tuned to other channels
  846. * for scanning.
  847. *
  848. * max_out_time is the max time off-channel (in usec), and suspend_time
  849. * is how long (in "extended beacon" format) that the scan is "suspended"
  850. * after returning to the service channel. That is, suspend_time is the
  851. * time that we stay on the service channel, doing normal work, between
  852. * scan segments. The driver may set these parameters differently to support
  853. * scanning when associated vs. not associated, and light vs. heavy traffic
  854. * loads when associated.
  855. *
  856. * After receiving this command, the device's scan engine does the following;
  857. *
  858. * 1) Sends SCAN_START notification to driver
  859. * 2) Checks to see if it has time to do scan for one channel
  860. * 3) Sends NULL packet, with power-save (PS) bit set to 1,
  861. * to tell AP that we're going off-channel
  862. * 4) Tunes to first channel in scan list, does active or passive scan
  863. * 5) Sends SCAN_RESULT notification to driver
  864. * 6) Checks to see if it has time to do scan on *next* channel in list
  865. * 7) Repeats 4-6 until it no longer has time to scan the next channel
  866. * before max_out_time expires
  867. * 8) Returns to service channel
  868. * 9) Sends NULL packet with PS=0 to tell AP that we're back
  869. * 10) Stays on service channel until suspend_time expires
  870. * 11) Repeats entire process 2-10 until list is complete
  871. * 12) Sends SCAN_COMPLETE notification
  872. *
  873. * For fast, efficient scans, the scan command also has support for staying on
  874. * a channel for just a short time, if doing active scanning and getting no
  875. * responses to the transmitted probe request. This time is controlled by
  876. * quiet_time, and the number of received packets below which a channel is
  877. * considered "quiet" is controlled by quiet_plcp_threshold.
  878. *
  879. * For active scanning on channels that have regulatory restrictions against
  880. * blindly transmitting, the scan can listen before transmitting, to make sure
  881. * that there is already legitimate activity on the channel. If enough
  882. * packets are cleanly received on the channel (controlled by good_CRC_th,
  883. * typical value 1), the scan engine starts transmitting probe requests.
  884. *
  885. * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
  886. *
  887. * To avoid uCode errors, see timing restrictions described under
  888. * struct iwl3945_scan_channel.
  889. */
  890. struct iwl3945_scan_cmd {
  891. __le16 len;
  892. u8 reserved0;
  893. u8 channel_count; /* # channels in channel list */
  894. __le16 quiet_time; /* dwell only this # millisecs on quiet channel
  895. * (only for active scan) */
  896. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  897. __le16 good_CRC_th; /* passive -> active promotion threshold */
  898. __le16 reserved1;
  899. __le32 max_out_time; /* max usec to be away from associated (service)
  900. * channel */
  901. __le32 suspend_time; /* pause scan this long (in "extended beacon
  902. * format") when returning to service channel:
  903. * 3945; 31:24 # beacons, 19:0 additional usec,
  904. * 4965; 31:22 # beacons, 21:0 additional usec.
  905. */
  906. __le32 flags; /* RXON_FLG_* */
  907. __le32 filter_flags; /* RXON_FILTER_* */
  908. /* For active scans (set to all-0s for passive scans).
  909. * Does not include payload. Must specify Tx rate; no rate scaling. */
  910. struct iwl3945_tx_cmd tx_cmd;
  911. /* For directed active scans (set to all-0s otherwise) */
  912. struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
  913. /*
  914. * Probe request frame, followed by channel list.
  915. *
  916. * Size of probe request frame is specified by byte count in tx_cmd.
  917. * Channel list follows immediately after probe request frame.
  918. * Number of channels in list is specified by channel_count.
  919. * Each channel in list is of type:
  920. *
  921. * struct iwl3945_scan_channel channels[0];
  922. *
  923. * NOTE: Only one band of channels can be scanned per pass. You
  924. * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
  925. * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
  926. * before requesting another scan.
  927. */
  928. u8 data[0];
  929. } __attribute__ ((packed));
  930. /* Can abort will notify by complete notification with abort status. */
  931. #define CAN_ABORT_STATUS cpu_to_le32(0x1)
  932. /* complete notification statuses */
  933. #define ABORT_STATUS 0x2
  934. /*
  935. * REPLY_SCAN_CMD = 0x80 (response)
  936. */
  937. struct iwl3945_scanreq_notification {
  938. __le32 status; /* 1: okay, 2: cannot fulfill request */
  939. } __attribute__ ((packed));
  940. /*
  941. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  942. */
  943. struct iwl3945_scanstart_notification {
  944. __le32 tsf_low;
  945. __le32 tsf_high;
  946. __le32 beacon_timer;
  947. u8 channel;
  948. u8 band;
  949. u8 reserved[2];
  950. __le32 status;
  951. } __attribute__ ((packed));
  952. #define SCAN_OWNER_STATUS 0x1;
  953. #define MEASURE_OWNER_STATUS 0x2;
  954. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  955. /*
  956. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  957. */
  958. struct iwl3945_scanresults_notification {
  959. u8 channel;
  960. u8 band;
  961. u8 reserved[2];
  962. __le32 tsf_low;
  963. __le32 tsf_high;
  964. __le32 statistics[NUMBER_OF_STATISTICS];
  965. } __attribute__ ((packed));
  966. /*
  967. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  968. */
  969. struct iwl3945_scancomplete_notification {
  970. u8 scanned_channels;
  971. u8 status;
  972. u8 reserved;
  973. u8 last_channel;
  974. __le32 tsf_low;
  975. __le32 tsf_high;
  976. } __attribute__ ((packed));
  977. /******************************************************************************
  978. * (9)
  979. * IBSS/AP Commands and Notifications:
  980. *
  981. *****************************************************************************/
  982. /*
  983. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  984. */
  985. struct iwl3945_beacon_notif {
  986. struct iwl3945_tx_resp beacon_notify_hdr;
  987. __le32 low_tsf;
  988. __le32 high_tsf;
  989. __le32 ibss_mgr_status;
  990. } __attribute__ ((packed));
  991. /*
  992. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  993. */
  994. struct iwl3945_tx_beacon_cmd {
  995. struct iwl3945_tx_cmd tx;
  996. __le16 tim_idx;
  997. u8 tim_size;
  998. u8 reserved1;
  999. struct ieee80211_hdr frame[0]; /* beacon frame */
  1000. } __attribute__ ((packed));
  1001. /******************************************************************************
  1002. * (10)
  1003. * Statistics Commands and Notifications:
  1004. *
  1005. *****************************************************************************/
  1006. struct iwl39_statistics_rx_phy {
  1007. __le32 ina_cnt;
  1008. __le32 fina_cnt;
  1009. __le32 plcp_err;
  1010. __le32 crc32_err;
  1011. __le32 overrun_err;
  1012. __le32 early_overrun_err;
  1013. __le32 crc32_good;
  1014. __le32 false_alarm_cnt;
  1015. __le32 fina_sync_err_cnt;
  1016. __le32 sfd_timeout;
  1017. __le32 fina_timeout;
  1018. __le32 unresponded_rts;
  1019. __le32 rxe_frame_limit_overrun;
  1020. __le32 sent_ack_cnt;
  1021. __le32 sent_cts_cnt;
  1022. } __attribute__ ((packed));
  1023. struct iwl39_statistics_rx_non_phy {
  1024. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1025. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1026. __le32 non_bssid_frames; /* number of frames with BSSID that
  1027. * doesn't belong to the STA BSSID */
  1028. __le32 filtered_frames; /* count frames that were dumped in the
  1029. * filtering process */
  1030. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1031. * our serving channel */
  1032. } __attribute__ ((packed));
  1033. struct iwl39_statistics_rx {
  1034. struct iwl39_statistics_rx_phy ofdm;
  1035. struct iwl39_statistics_rx_phy cck;
  1036. struct iwl39_statistics_rx_non_phy general;
  1037. } __attribute__ ((packed));
  1038. struct iwl39_statistics_tx {
  1039. __le32 preamble_cnt;
  1040. __le32 rx_detected_cnt;
  1041. __le32 bt_prio_defer_cnt;
  1042. __le32 bt_prio_kill_cnt;
  1043. __le32 few_bytes_cnt;
  1044. __le32 cts_timeout;
  1045. __le32 ack_timeout;
  1046. __le32 expected_ack_cnt;
  1047. __le32 actual_ack_cnt;
  1048. } __attribute__ ((packed));
  1049. struct iwl39_statistics_div {
  1050. __le32 tx_on_a;
  1051. __le32 tx_on_b;
  1052. __le32 exec_time;
  1053. __le32 probe_time;
  1054. } __attribute__ ((packed));
  1055. struct iwl39_statistics_general {
  1056. __le32 temperature;
  1057. struct statistics_dbg dbg;
  1058. __le32 sleep_time;
  1059. __le32 slots_out;
  1060. __le32 slots_idle;
  1061. __le32 ttl_timestamp;
  1062. struct iwl39_statistics_div div;
  1063. } __attribute__ ((packed));
  1064. /*
  1065. * REPLY_STATISTICS_CMD = 0x9c,
  1066. * 3945 and 4965 identical.
  1067. *
  1068. * This command triggers an immediate response containing uCode statistics.
  1069. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1070. *
  1071. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1072. * internal copy of the statistics (counters) after issuing the response.
  1073. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1074. *
  1075. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1076. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1077. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1078. */
  1079. #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
  1080. #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
  1081. struct iwl3945_statistics_cmd {
  1082. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1083. } __attribute__ ((packed));
  1084. /*
  1085. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1086. *
  1087. * By default, uCode issues this notification after receiving a beacon
  1088. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1089. * REPLY_STATISTICS_CMD 0x9c, above.
  1090. *
  1091. * Statistics counters continue to increment beacon after beacon, but are
  1092. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1093. * 0x9c with CLEAR_STATS bit set (see above).
  1094. *
  1095. * uCode also issues this notification during scans. uCode clears statistics
  1096. * appropriately so that each notification contains statistics for only the
  1097. * one channel that has just been scanned.
  1098. */
  1099. #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
  1100. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8)
  1101. struct iwl3945_notif_statistics {
  1102. __le32 flag;
  1103. struct statistics_rx rx;
  1104. struct statistics_tx tx;
  1105. struct statistics_general general;
  1106. } __attribute__ ((packed));
  1107. /*
  1108. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1109. */
  1110. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1111. * then this notification will be sent. */
  1112. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1113. struct iwl3945_missed_beacon_notif {
  1114. __le32 consequtive_missed_beacons;
  1115. __le32 total_missed_becons;
  1116. __le32 num_expected_beacons;
  1117. __le32 num_recvd_beacons;
  1118. } __attribute__ ((packed));
  1119. /******************************************************************************
  1120. * (11)
  1121. * Rx Calibration Commands:
  1122. *
  1123. *****************************************************************************/
  1124. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1125. #define HD_TABLE_SIZE (11)
  1126. struct iwl3945_sensitivity_cmd {
  1127. __le16 control;
  1128. __le16 table[HD_TABLE_SIZE];
  1129. } __attribute__ ((packed));
  1130. struct iwl3945_calibration_cmd {
  1131. u8 opCode;
  1132. u8 flags;
  1133. __le16 reserved;
  1134. s8 diff_gain_a;
  1135. s8 diff_gain_b;
  1136. s8 diff_gain_c;
  1137. u8 reserved1;
  1138. } __attribute__ ((packed));
  1139. /******************************************************************************
  1140. * (12)
  1141. * Miscellaneous Commands:
  1142. *
  1143. *****************************************************************************/
  1144. /*
  1145. * LEDs Command & Response
  1146. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1147. *
  1148. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1149. * this command turns it on or off, or sets up a periodic blinking cycle.
  1150. */
  1151. struct iwl3945_led_cmd {
  1152. __le32 interval; /* "interval" in uSec */
  1153. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1154. u8 off; /* # intervals off while blinking;
  1155. * "0", with >0 "on" value, turns LED on */
  1156. u8 on; /* # intervals on while blinking;
  1157. * "0", regardless of "off", turns LED off */
  1158. u8 reserved;
  1159. } __attribute__ ((packed));
  1160. /******************************************************************************
  1161. * (13)
  1162. * Union of all expected notifications/responses:
  1163. *
  1164. *****************************************************************************/
  1165. struct iwl3945_rx_packet {
  1166. __le32 len;
  1167. struct iwl3945_cmd_header hdr;
  1168. union {
  1169. struct iwl3945_alive_resp alive_frame;
  1170. struct iwl3945_rx_frame rx_frame;
  1171. struct iwl3945_tx_resp tx_resp;
  1172. struct iwl_spectrum_notification spectrum_notif;
  1173. struct iwl_csa_notification csa_notif;
  1174. struct iwl3945_error_resp err_resp;
  1175. struct iwl_card_state_notif card_state_notif;
  1176. struct iwl3945_beacon_notif beacon_status;
  1177. struct iwl3945_add_sta_resp add_sta;
  1178. struct iwl_sleep_notification sleep_notif;
  1179. struct iwl_spectrum_resp spectrum;
  1180. struct iwl3945_notif_statistics stats;
  1181. __le32 status;
  1182. u8 raw[0];
  1183. } u;
  1184. } __attribute__ ((packed));
  1185. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
  1186. #endif /* __iwl3945_3945_commands_h__ */