iwl-3945-commands.h 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728
  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. /*
  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. enum {
  71. REPLY_ALIVE = 0x1,
  72. REPLY_ERROR = 0x2,
  73. /* RXON and QOS commands */
  74. REPLY_RXON = 0x10,
  75. REPLY_RXON_ASSOC = 0x11,
  76. REPLY_QOS_PARAM = 0x13,
  77. REPLY_RXON_TIMING = 0x14,
  78. /* Multi-Station support */
  79. REPLY_ADD_STA = 0x18,
  80. REPLY_REMOVE_STA = 0x19, /* not used */
  81. REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
  82. /* RX, TX, LEDs */
  83. REPLY_3945_RX = 0x1b, /* 3945 only */
  84. REPLY_TX = 0x1c,
  85. REPLY_RATE_SCALE = 0x47, /* 3945 only */
  86. REPLY_LEDS_CMD = 0x48,
  87. REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
  88. /* 802.11h related */
  89. RADAR_NOTIFICATION = 0x70, /* not used */
  90. REPLY_QUIET_CMD = 0x71, /* not used */
  91. REPLY_CHANNEL_SWITCH = 0x72,
  92. CHANNEL_SWITCH_NOTIFICATION = 0x73,
  93. REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
  94. SPECTRUM_MEASURE_NOTIFICATION = 0x75,
  95. /* Power Management */
  96. POWER_TABLE_CMD = 0x77,
  97. PM_SLEEP_NOTIFICATION = 0x7A,
  98. PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
  99. /* Scan commands and notifications */
  100. REPLY_SCAN_CMD = 0x80,
  101. REPLY_SCAN_ABORT_CMD = 0x81,
  102. SCAN_START_NOTIFICATION = 0x82,
  103. SCAN_RESULTS_NOTIFICATION = 0x83,
  104. SCAN_COMPLETE_NOTIFICATION = 0x84,
  105. /* IBSS/AP commands */
  106. BEACON_NOTIFICATION = 0x90,
  107. REPLY_TX_BEACON = 0x91,
  108. WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
  109. /* Miscellaneous commands */
  110. QUIET_NOTIFICATION = 0x96, /* not used */
  111. REPLY_TX_PWR_TABLE_CMD = 0x97,
  112. MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
  113. /* Bluetooth device coexistance config command */
  114. REPLY_BT_CONFIG = 0x9b,
  115. /* Statistics */
  116. REPLY_STATISTICS_CMD = 0x9c,
  117. STATISTICS_NOTIFICATION = 0x9d,
  118. /* RF-KILL commands and notifications */
  119. REPLY_CARD_STATE_CMD = 0xa0,
  120. CARD_STATE_NOTIFICATION = 0xa1,
  121. /* Missed beacons notification */
  122. MISSED_BEACONS_NOTIFICATION = 0xa2,
  123. REPLY_MAX = 0xff
  124. };
  125. /******************************************************************************
  126. * (0)
  127. * Commonly used structures and definitions:
  128. * Command header, txpower
  129. *
  130. *****************************************************************************/
  131. /* iwl3945_cmd_header flags value */
  132. #define IWL_CMD_FAILED_MSK 0x40
  133. /**
  134. * struct iwl3945_cmd_header
  135. *
  136. * This header format appears in the beginning of each command sent from the
  137. * driver, and each response/notification received from uCode.
  138. */
  139. struct iwl3945_cmd_header {
  140. u8 cmd; /* Command ID: REPLY_RXON, etc. */
  141. u8 flags; /* IWL_CMD_* */
  142. /*
  143. * The driver sets up the sequence number to values of its chosing.
  144. * uCode does not use this value, but passes it back to the driver
  145. * when sending the response to each driver-originated command, so
  146. * the driver can match the response to the command. Since the values
  147. * don't get used by uCode, the driver may set up an arbitrary format.
  148. *
  149. * There is one exception: uCode sets bit 15 when it originates
  150. * the response/notification, i.e. when the response/notification
  151. * is not a direct response to a command sent by the driver. For
  152. * example, uCode issues REPLY_3945_RX when it sends a received frame
  153. * to the driver; it is not a direct response to any driver command.
  154. *
  155. * The Linux driver uses the following format:
  156. *
  157. * 0:7 index/position within Tx queue
  158. * 8:13 Tx queue selection
  159. * 14:14 driver sets this to indicate command is in the 'huge'
  160. * storage at the end of the command buffers, i.e. scan cmd
  161. * 15:15 uCode sets this in uCode-originated response/notification
  162. */
  163. __le16 sequence;
  164. /* command or response/notification data follows immediately */
  165. u8 data[0];
  166. } __attribute__ ((packed));
  167. /**
  168. * struct iwl3945_tx_power
  169. *
  170. * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
  171. *
  172. * Each entry contains two values:
  173. * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
  174. * linear value that multiplies the output of the digital signal processor,
  175. * before being sent to the analog radio.
  176. * 2) Radio gain. This sets the analog gain of the radio Tx path.
  177. * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
  178. *
  179. * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
  180. */
  181. struct iwl3945_tx_power {
  182. u8 tx_gain; /* gain for analog radio */
  183. u8 dsp_atten; /* gain for DSP */
  184. } __attribute__ ((packed));
  185. /**
  186. * struct iwl3945_power_per_rate
  187. *
  188. * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
  189. */
  190. struct iwl3945_power_per_rate {
  191. u8 rate; /* plcp */
  192. struct iwl3945_tx_power tpc;
  193. u8 reserved;
  194. } __attribute__ ((packed));
  195. /******************************************************************************
  196. * (0a)
  197. * Alive and Error Commands & Responses:
  198. *
  199. *****************************************************************************/
  200. #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
  201. #define INITIALIZE_SUBTYPE (9)
  202. /*
  203. * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
  204. *
  205. * uCode issues this "initialize alive" notification once the initialization
  206. * uCode image has completed its work, and is ready to load the runtime image.
  207. * This is the *first* "alive" notification that the driver will receive after
  208. * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
  209. *
  210. * See comments documenting "BSM" (bootstrap state machine).
  211. */
  212. struct iwl3945_init_alive_resp {
  213. u8 ucode_minor;
  214. u8 ucode_major;
  215. __le16 reserved1;
  216. u8 sw_rev[8];
  217. u8 ver_type;
  218. u8 ver_subtype; /* "9" for initialize alive */
  219. __le16 reserved2;
  220. __le32 log_event_table_ptr;
  221. __le32 error_event_table_ptr;
  222. __le32 timestamp;
  223. __le32 is_valid;
  224. } __attribute__ ((packed));
  225. /**
  226. * REPLY_ALIVE = 0x1 (response only, not a command)
  227. *
  228. * uCode issues this "alive" notification once the runtime image is ready
  229. * to receive commands from the driver. This is the *second* "alive"
  230. * notification that the driver will receive after rebooting uCode;
  231. * this "alive" is indicated by subtype field != 9.
  232. *
  233. * See comments documenting "BSM" (bootstrap state machine).
  234. *
  235. * This response includes two pointers to structures within the device's
  236. * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
  237. *
  238. * 1) log_event_table_ptr indicates base of the event log. This traces
  239. * a 256-entry history of uCode execution within a circular buffer.
  240. *
  241. * 2) error_event_table_ptr indicates base of the error log. This contains
  242. * information about any uCode error that occurs.
  243. *
  244. * The Linux driver can print both logs to the system log when a uCode error
  245. * occurs.
  246. */
  247. struct iwl3945_alive_resp {
  248. u8 ucode_minor;
  249. u8 ucode_major;
  250. __le16 reserved1;
  251. u8 sw_rev[8];
  252. u8 ver_type;
  253. u8 ver_subtype; /* not "9" for runtime alive */
  254. __le16 reserved2;
  255. __le32 log_event_table_ptr; /* SRAM address for event log */
  256. __le32 error_event_table_ptr; /* SRAM address for error log */
  257. __le32 timestamp;
  258. __le32 is_valid;
  259. } __attribute__ ((packed));
  260. union tsf {
  261. u8 byte[8];
  262. __le16 word[4];
  263. __le32 dw[2];
  264. };
  265. /*
  266. * REPLY_ERROR = 0x2 (response only, not a command)
  267. */
  268. struct iwl3945_error_resp {
  269. __le32 error_type;
  270. u8 cmd_id;
  271. u8 reserved1;
  272. __le16 bad_cmd_seq_num;
  273. __le16 reserved2;
  274. __le32 error_info;
  275. union tsf timestamp;
  276. } __attribute__ ((packed));
  277. /******************************************************************************
  278. * (1)
  279. * RXON Commands & Responses:
  280. *
  281. *****************************************************************************/
  282. /*
  283. * Rx config defines & structure
  284. */
  285. /* rx_config device types */
  286. enum {
  287. RXON_DEV_TYPE_AP = 1,
  288. RXON_DEV_TYPE_ESS = 3,
  289. RXON_DEV_TYPE_IBSS = 4,
  290. RXON_DEV_TYPE_SNIFFER = 6,
  291. };
  292. /* rx_config flags */
  293. /* band & modulation selection */
  294. #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
  295. #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
  296. /* auto detection enable */
  297. #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
  298. /* TGg protection when tx */
  299. #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
  300. /* cck short slot & preamble */
  301. #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
  302. #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
  303. /* antenna selection */
  304. #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
  305. #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
  306. #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  307. #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  308. /* radar detection enable */
  309. #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
  310. #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
  311. /* rx response to host with 8-byte TSF
  312. * (according to ON_AIR deassertion) */
  313. #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
  314. /* rx_config filter flags */
  315. /* accept all data frames */
  316. #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
  317. /* pass control & management to host */
  318. #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
  319. /* accept multi-cast */
  320. #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
  321. /* don't decrypt uni-cast frames */
  322. #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
  323. /* don't decrypt multi-cast frames */
  324. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
  325. /* STA is associated */
  326. #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
  327. /* transfer to host non bssid beacons in associated state */
  328. #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
  329. /**
  330. * REPLY_RXON = 0x10 (command, has simple generic response)
  331. *
  332. * RXON tunes the radio tuner to a service channel, and sets up a number
  333. * of parameters that are used primarily for Rx, but also for Tx operations.
  334. *
  335. * NOTE: When tuning to a new channel, driver must set the
  336. * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
  337. * info within the device, including the station tables, tx retry
  338. * rate tables, and txpower tables. Driver must build a new station
  339. * table and txpower table before transmitting anything on the RXON
  340. * channel.
  341. *
  342. * NOTE: All RXONs wipe clean the internal txpower table. Driver must
  343. * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
  344. * regardless of whether RXON_FILTER_ASSOC_MSK is set.
  345. */
  346. struct iwl3945_rxon_cmd {
  347. u8 node_addr[6];
  348. __le16 reserved1;
  349. u8 bssid_addr[6];
  350. __le16 reserved2;
  351. u8 wlap_bssid_addr[6];
  352. __le16 reserved3;
  353. u8 dev_type;
  354. u8 air_propagation;
  355. __le16 reserved4;
  356. u8 ofdm_basic_rates;
  357. u8 cck_basic_rates;
  358. __le16 assoc_id;
  359. __le32 flags;
  360. __le32 filter_flags;
  361. __le16 channel;
  362. __le16 reserved5;
  363. } __attribute__ ((packed));
  364. /*
  365. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  366. */
  367. struct iwl3945_rxon_assoc_cmd {
  368. __le32 flags;
  369. __le32 filter_flags;
  370. u8 ofdm_basic_rates;
  371. u8 cck_basic_rates;
  372. __le16 reserved;
  373. } __attribute__ ((packed));
  374. /*
  375. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  376. */
  377. struct iwl3945_rxon_time_cmd {
  378. union tsf timestamp;
  379. __le16 beacon_interval;
  380. __le16 atim_window;
  381. __le32 beacon_init_val;
  382. __le16 listen_interval;
  383. __le16 reserved;
  384. } __attribute__ ((packed));
  385. /*
  386. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  387. */
  388. struct iwl3945_channel_switch_cmd {
  389. u8 band;
  390. u8 expect_beacon;
  391. __le16 channel;
  392. __le32 rxon_flags;
  393. __le32 rxon_filter_flags;
  394. __le32 switch_time;
  395. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  396. } __attribute__ ((packed));
  397. /*
  398. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  399. */
  400. struct iwl3945_csa_notification {
  401. __le16 band;
  402. __le16 channel;
  403. __le32 status; /* 0 - OK, 1 - fail */
  404. } __attribute__ ((packed));
  405. /******************************************************************************
  406. * (2)
  407. * Quality-of-Service (QOS) Commands & Responses:
  408. *
  409. *****************************************************************************/
  410. /**
  411. * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
  412. * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
  413. *
  414. * @cw_min: Contention window, start value in numbers of slots.
  415. * Should be a power-of-2, minus 1. Device's default is 0x0f.
  416. * @cw_max: Contention window, max value in numbers of slots.
  417. * Should be a power-of-2, minus 1. Device's default is 0x3f.
  418. * @aifsn: Number of slots in Arbitration Interframe Space (before
  419. * performing random backoff timing prior to Tx). Device default 1.
  420. * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
  421. *
  422. * Device will automatically increase contention window by (2*CW) + 1 for each
  423. * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
  424. * value, to cap the CW value.
  425. */
  426. struct iwl3945_ac_qos {
  427. __le16 cw_min;
  428. __le16 cw_max;
  429. u8 aifsn;
  430. u8 reserved1;
  431. __le16 edca_txop;
  432. } __attribute__ ((packed));
  433. /* QoS flags defines */
  434. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
  435. #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
  436. #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
  437. /* Number of Access Categories (AC) (EDCA), queues 0..3 */
  438. #define AC_NUM 4
  439. /*
  440. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  441. *
  442. * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
  443. * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
  444. */
  445. struct iwl3945_qosparam_cmd {
  446. __le32 qos_flags;
  447. struct iwl3945_ac_qos ac[AC_NUM];
  448. } __attribute__ ((packed));
  449. /******************************************************************************
  450. * (3)
  451. * Add/Modify Stations Commands & Responses:
  452. *
  453. *****************************************************************************/
  454. /*
  455. * Multi station support
  456. */
  457. /* Special, dedicated locations within device's station table */
  458. #define IWL_AP_ID 0
  459. #define IWL_MULTICAST_ID 1
  460. #define IWL_STA_ID 2
  461. #define IWL3945_BROADCAST_ID 24
  462. #define IWL3945_STATION_COUNT 25
  463. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  464. #define IWL_INVALID_STATION 255
  465. #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1 << 2);
  466. #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8);
  467. /* Use in mode field. 1: modify existing entry, 0: add new station entry */
  468. #define STA_CONTROL_MODIFY_MSK 0x01
  469. /* key flags __le16*/
  470. #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
  471. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
  472. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
  473. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
  474. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
  475. #define STA_KEY_FLG_KEYID_POS 8
  476. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  477. /* Flags indicate whether to modify vs. don't change various station params */
  478. #define STA_MODIFY_KEY_MASK 0x01
  479. #define STA_MODIFY_TID_DISABLE_TX 0x02
  480. #define STA_MODIFY_TX_RATE_MSK 0x04
  481. /*
  482. * Antenna masks:
  483. * bit14:15 01 B inactive, A active
  484. * 10 B active, A inactive
  485. * 11 Both active
  486. */
  487. #define RATE_MCS_ANT_A_POS 14
  488. #define RATE_MCS_ANT_B_POS 15
  489. #define RATE_MCS_ANT_A_MSK 0x4000
  490. #define RATE_MCS_ANT_B_MSK 0x8000
  491. #define RATE_MCS_ANT_AB_MSK 0xc000
  492. struct iwl3945_keyinfo {
  493. __le16 key_flags;
  494. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  495. u8 reserved1;
  496. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  497. __le16 reserved2;
  498. u8 key[16]; /* 16-byte unicast decryption key */
  499. } __attribute__ ((packed));
  500. /**
  501. * struct sta_id_modify
  502. * @addr[ETH_ALEN]: station's MAC address
  503. * @sta_id: index of station in uCode's station table
  504. * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
  505. *
  506. * Driver selects unused table index when adding new station,
  507. * or the index to a pre-existing station entry when modifying that station.
  508. * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
  509. *
  510. * modify_mask flags select which parameters to modify vs. leave alone.
  511. */
  512. struct sta_id_modify {
  513. u8 addr[ETH_ALEN];
  514. __le16 reserved1;
  515. u8 sta_id;
  516. u8 modify_mask;
  517. __le16 reserved2;
  518. } __attribute__ ((packed));
  519. /*
  520. * REPLY_ADD_STA = 0x18 (command)
  521. *
  522. * The device contains an internal table of per-station information,
  523. * with info on security keys, aggregation parameters, and Tx rates for
  524. * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
  525. * 3945 uses REPLY_RATE_SCALE to set up rate tables).
  526. *
  527. * REPLY_ADD_STA sets up the table entry for one station, either creating
  528. * a new entry, or modifying a pre-existing one.
  529. *
  530. * NOTE: RXON command (without "associated" bit set) wipes the station table
  531. * clean. Moving into RF_KILL state does this also. Driver must set up
  532. * new station table before transmitting anything on the RXON channel
  533. * (except active scans or active measurements; those commands carry
  534. * their own txpower/rate setup data).
  535. *
  536. * When getting started on a new channel, driver must set up the
  537. * IWL_BROADCAST_ID entry (last entry in the table). For a client
  538. * station in a BSS, once an AP is selected, driver sets up the AP STA
  539. * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
  540. * are all that are needed for a BSS client station. If the device is
  541. * used as AP, or in an IBSS network, driver must set up station table
  542. * entries for all STAs in network, starting with index IWL_STA_ID.
  543. */
  544. struct iwl3945_addsta_cmd {
  545. u8 mode; /* 1: modify existing, 0: add new station */
  546. u8 reserved[3];
  547. struct sta_id_modify sta;
  548. struct iwl3945_keyinfo key;
  549. __le32 station_flags; /* STA_FLG_* */
  550. __le32 station_flags_msk; /* STA_FLG_* */
  551. /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
  552. * corresponding to bit (e.g. bit 5 controls TID 5).
  553. * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
  554. __le16 tid_disable_tx;
  555. __le16 rate_n_flags;
  556. /* TID for which to add block-ack support.
  557. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  558. u8 add_immediate_ba_tid;
  559. /* TID for which to remove block-ack support.
  560. * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
  561. u8 remove_immediate_ba_tid;
  562. /* Starting Sequence Number for added block-ack support.
  563. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  564. __le16 add_immediate_ba_ssn;
  565. } __attribute__ ((packed));
  566. #define ADD_STA_SUCCESS_MSK 0x1
  567. #define ADD_STA_NO_ROOM_IN_TABLE 0x2
  568. #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
  569. /*
  570. * REPLY_ADD_STA = 0x18 (response)
  571. */
  572. struct iwl3945_add_sta_resp {
  573. u8 status; /* ADD_STA_* */
  574. } __attribute__ ((packed));
  575. /******************************************************************************
  576. * (4)
  577. * Rx Responses:
  578. *
  579. *****************************************************************************/
  580. struct iwl3945_rx_frame_stats {
  581. u8 phy_count;
  582. u8 id;
  583. u8 rssi;
  584. u8 agc;
  585. __le16 sig_avg;
  586. __le16 noise_diff;
  587. u8 payload[0];
  588. } __attribute__ ((packed));
  589. struct iwl3945_rx_frame_hdr {
  590. __le16 channel;
  591. __le16 phy_flags;
  592. u8 reserved1;
  593. u8 rate;
  594. __le16 len;
  595. u8 payload[0];
  596. } __attribute__ ((packed));
  597. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  598. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  599. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  600. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  601. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  602. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  603. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  604. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  605. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  606. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  607. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  608. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  609. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  610. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  611. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  612. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  613. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  614. struct iwl3945_rx_frame_end {
  615. __le32 status;
  616. __le64 timestamp;
  617. __le32 beacon_timestamp;
  618. } __attribute__ ((packed));
  619. /*
  620. * REPLY_3945_RX = 0x1b (response only, not a command)
  621. *
  622. * NOTE: DO NOT dereference from casts to this structure
  623. * It is provided only for calculating minimum data set size.
  624. * The actual offsets of the hdr and end are dynamic based on
  625. * stats.phy_count
  626. */
  627. struct iwl3945_rx_frame {
  628. struct iwl3945_rx_frame_stats stats;
  629. struct iwl3945_rx_frame_hdr hdr;
  630. struct iwl3945_rx_frame_end end;
  631. } __attribute__ ((packed));
  632. /* Fixed (non-configurable) rx data from phy */
  633. #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
  634. #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
  635. #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
  636. #define IWL_AGC_DB_POS (7)
  637. struct iwl4965_rx_non_cfg_phy {
  638. __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
  639. __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
  640. u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
  641. u8 pad[0];
  642. } __attribute__ ((packed));
  643. /*
  644. * REPLY_4965_RX = 0xc3 (response only, not a command)
  645. * Used only for legacy (non 11n) frames.
  646. */
  647. #define RX_RES_PHY_CNT 14
  648. struct iwl4965_rx_phy_res {
  649. u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
  650. u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
  651. u8 stat_id; /* configurable DSP phy data set ID */
  652. u8 reserved1;
  653. __le64 timestamp; /* TSF at on air rise */
  654. __le32 beacon_time_stamp; /* beacon at on-air rise */
  655. __le16 phy_flags; /* general phy flags: band, modulation, ... */
  656. __le16 channel; /* channel number */
  657. __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
  658. __le32 reserved2;
  659. __le32 rate_n_flags;
  660. __le16 byte_count; /* frame's byte-count */
  661. __le16 reserved3;
  662. } __attribute__ ((packed));
  663. struct iwl4965_rx_mpdu_res_start {
  664. __le16 byte_count;
  665. __le16 reserved;
  666. } __attribute__ ((packed));
  667. /******************************************************************************
  668. * (5)
  669. * Tx Commands & Responses:
  670. *
  671. * Driver must place each REPLY_TX command into one of the prioritized Tx
  672. * queues in host DRAM, shared between driver and device. When the device's
  673. * Tx scheduler and uCode are preparing to transmit, the device pulls the
  674. * Tx command over the PCI bus via one of the device's Tx DMA channels,
  675. * to fill an internal FIFO from which data will be transmitted.
  676. *
  677. * uCode handles all timing and protocol related to control frames
  678. * (RTS/CTS/ACK), based on flags in the Tx command.
  679. *
  680. * uCode handles retrying Tx when an ACK is expected but not received.
  681. * This includes trying lower data rates than the one requested in the Tx
  682. * command, as set up by the REPLY_RATE_SCALE (for 3945) or
  683. * REPLY_TX_LINK_QUALITY_CMD (4965).
  684. *
  685. * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
  686. * This command must be executed after every RXON command, before Tx can occur.
  687. *****************************************************************************/
  688. /* REPLY_TX Tx flags field */
  689. /* 1: Use Request-To-Send protocol before this frame.
  690. * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
  691. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  692. /* 1: Transmit Clear-To-Send to self before this frame.
  693. * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
  694. * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
  695. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  696. /* 1: Expect ACK from receiving station
  697. * 0: Don't expect ACK (MAC header's duration field s/b 0)
  698. * Set this for unicast frames, but not broadcast/multicast. */
  699. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  700. /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
  701. * Tx command's initial_rate_index indicates first rate to try;
  702. * uCode walks through table for additional Tx attempts.
  703. * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
  704. * This rate will be used for all Tx attempts; it will not be scaled. */
  705. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  706. /* 1: Expect immediate block-ack.
  707. * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
  708. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  709. /* 1: Frame requires full Tx-Op protection.
  710. * Set this if either RTS or CTS Tx Flag gets set. */
  711. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  712. /* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
  713. * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
  714. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  715. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  716. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  717. /* 1: Ignore Bluetooth priority for this frame.
  718. * 0: Delay Tx until Bluetooth device is done (normal usage). */
  719. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  720. /* 1: uCode overrides sequence control field in MAC header.
  721. * 0: Driver provides sequence control field in MAC header.
  722. * Set this for management frames, non-QOS data frames, non-unicast frames,
  723. * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
  724. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  725. /* 1: This frame is non-last MPDU; more fragments are coming.
  726. * 0: Last fragment, or not using fragmentation. */
  727. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  728. /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
  729. * 0: No TSF required in outgoing frame.
  730. * Set this for transmitting beacons and probe responses. */
  731. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  732. /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
  733. * alignment of frame's payload data field.
  734. * 0: No pad
  735. * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
  736. * field (but not both). Driver must align frame data (i.e. data following
  737. * MAC header) to DWORD boundary. */
  738. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  739. /* HCCA-AP - disable duration overwriting. */
  740. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  741. /*
  742. * TX command security control
  743. */
  744. #define TX_CMD_SEC_WEP 0x01
  745. #define TX_CMD_SEC_CCM 0x02
  746. #define TX_CMD_SEC_TKIP 0x03
  747. #define TX_CMD_SEC_MSK 0x03
  748. #define TX_CMD_SEC_SHIFT 6
  749. #define TX_CMD_SEC_KEY128 0x08
  750. /*
  751. * REPLY_TX = 0x1c (command)
  752. */
  753. struct iwl3945_tx_cmd {
  754. /*
  755. * MPDU byte count:
  756. * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
  757. * + 8 byte IV for CCM or TKIP (not used for WEP)
  758. * + Data payload
  759. * + 8-byte MIC (not used for CCM/WEP)
  760. * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
  761. * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
  762. * Range: 14-2342 bytes.
  763. */
  764. __le16 len;
  765. /*
  766. * MPDU or MSDU byte count for next frame.
  767. * Used for fragmentation and bursting, but not 11n aggregation.
  768. * Same as "len", but for next frame. Set to 0 if not applicable.
  769. */
  770. __le16 next_frame_len;
  771. __le32 tx_flags; /* TX_CMD_FLG_* */
  772. u8 rate;
  773. /* Index of recipient station in uCode's station table */
  774. u8 sta_id;
  775. u8 tid_tspec;
  776. u8 sec_ctl;
  777. u8 key[16];
  778. union {
  779. u8 byte[8];
  780. __le16 word[4];
  781. __le32 dw[2];
  782. } tkip_mic;
  783. __le32 next_frame_info;
  784. union {
  785. __le32 life_time;
  786. __le32 attempt;
  787. } stop_time;
  788. u8 supp_rates[2];
  789. u8 rts_retry_limit; /*byte 50 */
  790. u8 data_retry_limit; /*byte 51 */
  791. union {
  792. __le16 pm_frame_timeout;
  793. __le16 attempt_duration;
  794. } timeout;
  795. /*
  796. * Duration of EDCA burst Tx Opportunity, in 32-usec units.
  797. * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
  798. */
  799. __le16 driver_txop;
  800. /*
  801. * MAC header goes here, followed by 2 bytes padding if MAC header
  802. * length is 26 or 30 bytes, followed by payload data
  803. */
  804. u8 payload[0];
  805. struct ieee80211_hdr hdr[0];
  806. } __attribute__ ((packed));
  807. /* TX command response is sent after *all* transmission attempts.
  808. *
  809. * NOTES:
  810. *
  811. * TX_STATUS_FAIL_NEXT_FRAG
  812. *
  813. * If the fragment flag in the MAC header for the frame being transmitted
  814. * is set and there is insufficient time to transmit the next frame, the
  815. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  816. *
  817. * TX_STATUS_FIFO_UNDERRUN
  818. *
  819. * Indicates the host did not provide bytes to the FIFO fast enough while
  820. * a TX was in progress.
  821. *
  822. * TX_STATUS_FAIL_MGMNT_ABORT
  823. *
  824. * This status is only possible if the ABORT ON MGMT RX parameter was
  825. * set to true with the TX command.
  826. *
  827. * If the MSB of the status parameter is set then an abort sequence is
  828. * required. This sequence consists of the host activating the TX Abort
  829. * control line, and then waiting for the TX Abort command response. This
  830. * indicates that a the device is no longer in a transmit state, and that the
  831. * command FIFO has been cleared. The host must then deactivate the TX Abort
  832. * control line. Receiving is still allowed in this case.
  833. */
  834. enum {
  835. TX_STATUS_SUCCESS = 0x01,
  836. TX_STATUS_DIRECT_DONE = 0x02,
  837. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  838. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  839. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  840. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  841. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  842. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  843. TX_STATUS_FAIL_DEST_PS = 0x88,
  844. TX_STATUS_FAIL_ABORTED = 0x89,
  845. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  846. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  847. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  848. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  849. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  850. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  851. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  852. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  853. };
  854. #define TX_PACKET_MODE_REGULAR 0x0000
  855. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  856. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  857. enum {
  858. TX_POWER_PA_NOT_ACTIVE = 0x0,
  859. };
  860. enum {
  861. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  862. TX_STATUS_DELAY_MSK = 0x00000040,
  863. TX_STATUS_ABORT_MSK = 0x00000080,
  864. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  865. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  866. TX_RESERVED = 0x00780000, /* bits 19:22 */
  867. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  868. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  869. };
  870. /*
  871. * REPLY_TX = 0x1c (response)
  872. */
  873. struct iwl3945_tx_resp {
  874. u8 failure_rts;
  875. u8 failure_frame;
  876. u8 bt_kill_count;
  877. u8 rate;
  878. __le32 wireless_media_time;
  879. __le32 status; /* TX status */
  880. } __attribute__ ((packed));
  881. /*
  882. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  883. */
  884. struct iwl3945_txpowertable_cmd {
  885. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  886. u8 reserved;
  887. __le16 channel;
  888. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  889. } __attribute__ ((packed));
  890. struct iwl3945_rate_scaling_info {
  891. __le16 rate_n_flags;
  892. u8 try_cnt;
  893. u8 next_rate_index;
  894. } __attribute__ ((packed));
  895. /**
  896. * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
  897. *
  898. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  899. *
  900. * NOTE: The table of rates passed to the uCode via the
  901. * RATE_SCALE command sets up the corresponding order of
  902. * rates used for all related commands, including rate
  903. * masks, etc.
  904. *
  905. * For example, if you set 9MB (PLCP 0x0f) as the first
  906. * rate in the rate table, the bit mask for that rate
  907. * when passed through ofdm_basic_rates on the REPLY_RXON
  908. * command would be bit 0 (1 << 0)
  909. */
  910. struct iwl3945_rate_scaling_cmd {
  911. u8 table_id;
  912. u8 reserved[3];
  913. struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
  914. } __attribute__ ((packed));
  915. /*
  916. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  917. *
  918. * 3945 and 4965 support hardware handshake with Bluetooth device on
  919. * same platform. Bluetooth device alerts wireless device when it will Tx;
  920. * wireless device can delay or kill its own Tx to accomodate.
  921. */
  922. struct iwl3945_bt_cmd {
  923. u8 flags;
  924. u8 lead_time;
  925. u8 max_kill;
  926. u8 reserved;
  927. __le32 kill_ack_mask;
  928. __le32 kill_cts_mask;
  929. } __attribute__ ((packed));
  930. /******************************************************************************
  931. * (6)
  932. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  933. *
  934. *****************************************************************************/
  935. /*
  936. * Spectrum Management
  937. */
  938. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  939. RXON_FILTER_CTL2HOST_MSK | \
  940. RXON_FILTER_ACCEPT_GRP_MSK | \
  941. RXON_FILTER_DIS_DECRYPT_MSK | \
  942. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  943. RXON_FILTER_ASSOC_MSK | \
  944. RXON_FILTER_BCON_AWARE_MSK)
  945. struct iwl3945_measure_channel {
  946. __le32 duration; /* measurement duration in extended beacon
  947. * format */
  948. u8 channel; /* channel to measure */
  949. u8 type; /* see enum iwl3945_measure_type */
  950. __le16 reserved;
  951. } __attribute__ ((packed));
  952. /*
  953. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  954. */
  955. struct iwl3945_spectrum_cmd {
  956. __le16 len; /* number of bytes starting from token */
  957. u8 token; /* token id */
  958. u8 id; /* measurement id -- 0 or 1 */
  959. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  960. u8 periodic; /* 1 = periodic */
  961. __le16 path_loss_timeout;
  962. __le32 start_time; /* start time in extended beacon format */
  963. __le32 reserved2;
  964. __le32 flags; /* rxon flags */
  965. __le32 filter_flags; /* rxon filter flags */
  966. __le16 channel_count; /* minimum 1, maximum 10 */
  967. __le16 reserved3;
  968. struct iwl3945_measure_channel channels[10];
  969. } __attribute__ ((packed));
  970. /*
  971. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  972. */
  973. struct iwl3945_spectrum_resp {
  974. u8 token;
  975. u8 id; /* id of the prior command replaced, or 0xff */
  976. __le16 status; /* 0 - command will be handled
  977. * 1 - cannot handle (conflicts with another
  978. * measurement) */
  979. } __attribute__ ((packed));
  980. enum iwl3945_measurement_state {
  981. IWL_MEASUREMENT_START = 0,
  982. IWL_MEASUREMENT_STOP = 1,
  983. };
  984. enum iwl3945_measurement_status {
  985. IWL_MEASUREMENT_OK = 0,
  986. IWL_MEASUREMENT_CONCURRENT = 1,
  987. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  988. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  989. /* 4-5 reserved */
  990. IWL_MEASUREMENT_STOPPED = 6,
  991. IWL_MEASUREMENT_TIMEOUT = 7,
  992. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  993. };
  994. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  995. struct iwl3945_measurement_histogram {
  996. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  997. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  998. } __attribute__ ((packed));
  999. /* clear channel availability counters */
  1000. struct iwl3945_measurement_cca_counters {
  1001. __le32 ofdm;
  1002. __le32 cck;
  1003. } __attribute__ ((packed));
  1004. enum iwl3945_measure_type {
  1005. IWL_MEASURE_BASIC = (1 << 0),
  1006. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  1007. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  1008. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  1009. IWL_MEASURE_FRAME = (1 << 4),
  1010. /* bits 5:6 are reserved */
  1011. IWL_MEASURE_IDLE = (1 << 7),
  1012. };
  1013. /*
  1014. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  1015. */
  1016. struct iwl3945_spectrum_notification {
  1017. u8 id; /* measurement id -- 0 or 1 */
  1018. u8 token;
  1019. u8 channel_index; /* index in measurement channel list */
  1020. u8 state; /* 0 - start, 1 - stop */
  1021. __le32 start_time; /* lower 32-bits of TSF */
  1022. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  1023. u8 channel;
  1024. u8 type; /* see enum iwl3945_measurement_type */
  1025. u8 reserved1;
  1026. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  1027. * valid if applicable for measurement type requested. */
  1028. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  1029. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  1030. __le32 cca_time; /* channel load time in usecs */
  1031. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  1032. * unidentified */
  1033. u8 reserved2[3];
  1034. struct iwl3945_measurement_histogram histogram;
  1035. __le32 stop_time; /* lower 32-bits of TSF */
  1036. __le32 status; /* see iwl3945_measurement_status */
  1037. } __attribute__ ((packed));
  1038. /******************************************************************************
  1039. * (7)
  1040. * Power Management Commands, Responses, Notifications:
  1041. *
  1042. *****************************************************************************/
  1043. /**
  1044. * struct iwl3945_powertable_cmd - Power Table Command
  1045. * @flags: See below:
  1046. *
  1047. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  1048. *
  1049. * PM allow:
  1050. * bit 0 - '0' Driver not allow power management
  1051. * '1' Driver allow PM (use rest of parameters)
  1052. * uCode send sleep notifications:
  1053. * bit 1 - '0' Don't send sleep notification
  1054. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  1055. * Sleep over DTIM
  1056. * bit 2 - '0' PM have to walk up every DTIM
  1057. * '1' PM could sleep over DTIM till listen Interval.
  1058. * PCI power managed
  1059. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  1060. * '1' !(PCI_LINK_CTRL & 0x1)
  1061. * Force sleep Modes
  1062. * bit 31/30- '00' use both mac/xtal sleeps
  1063. * '01' force Mac sleep
  1064. * '10' force xtal sleep
  1065. * '11' Illegal set
  1066. *
  1067. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  1068. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  1069. * for every DTIM.
  1070. */
  1071. #define IWL_POWER_VEC_SIZE 5
  1072. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1 << 0)
  1073. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1 << 2)
  1074. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1 << 3)
  1075. struct iwl3945_powertable_cmd {
  1076. __le32 flags;
  1077. __le32 rx_data_timeout;
  1078. __le32 tx_data_timeout;
  1079. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  1080. } __attribute__((packed));
  1081. /*
  1082. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  1083. * 3945 and 4965 identical.
  1084. */
  1085. struct iwl3945_sleep_notification {
  1086. u8 pm_sleep_mode;
  1087. u8 pm_wakeup_src;
  1088. __le16 reserved;
  1089. __le32 sleep_time;
  1090. __le32 tsf_low;
  1091. __le32 bcon_timer;
  1092. } __attribute__ ((packed));
  1093. /* Sleep states. 3945 and 4965 identical. */
  1094. enum {
  1095. IWL_PM_NO_SLEEP = 0,
  1096. IWL_PM_SLP_MAC = 1,
  1097. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  1098. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  1099. IWL_PM_SLP_PHY = 4,
  1100. IWL_PM_SLP_REPENT = 5,
  1101. IWL_PM_WAKEUP_BY_TIMER = 6,
  1102. IWL_PM_WAKEUP_BY_DRIVER = 7,
  1103. IWL_PM_WAKEUP_BY_RFKILL = 8,
  1104. /* 3 reserved */
  1105. IWL_PM_NUM_OF_MODES = 12,
  1106. };
  1107. /*
  1108. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  1109. */
  1110. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  1111. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  1112. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  1113. struct iwl3945_card_state_cmd {
  1114. __le32 status; /* CARD_STATE_CMD_* request new power state */
  1115. } __attribute__ ((packed));
  1116. /*
  1117. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  1118. */
  1119. struct iwl3945_card_state_notif {
  1120. __le32 flags;
  1121. } __attribute__ ((packed));
  1122. #define HW_CARD_DISABLED 0x01
  1123. #define SW_CARD_DISABLED 0x02
  1124. #define RF_CARD_DISABLED 0x04
  1125. #define RXON_CARD_DISABLED 0x10
  1126. struct iwl3945_ct_kill_config {
  1127. __le32 reserved;
  1128. __le32 critical_temperature_M;
  1129. __le32 critical_temperature_R;
  1130. } __attribute__ ((packed));
  1131. /******************************************************************************
  1132. * (8)
  1133. * Scan Commands, Responses, Notifications:
  1134. *
  1135. *****************************************************************************/
  1136. /**
  1137. * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
  1138. *
  1139. * One for each channel in the scan list.
  1140. * Each channel can independently select:
  1141. * 1) SSID for directed active scans
  1142. * 2) Txpower setting (for rate specified within Tx command)
  1143. * 3) How long to stay on-channel (behavior may be modified by quiet_time,
  1144. * quiet_plcp_th, good_CRC_th)
  1145. *
  1146. * To avoid uCode errors, make sure the following are true (see comments
  1147. * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
  1148. * 1) If using passive_dwell (i.e. passive_dwell != 0):
  1149. * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
  1150. * 2) quiet_time <= active_dwell
  1151. * 3) If restricting off-channel time (i.e. max_out_time !=0):
  1152. * passive_dwell < max_out_time
  1153. * active_dwell < max_out_time
  1154. */
  1155. struct iwl3945_scan_channel {
  1156. /*
  1157. * type is defined as:
  1158. * 0:0 1 = active, 0 = passive
  1159. * 1:4 SSID direct bit map; if a bit is set, then corresponding
  1160. * SSID IE is transmitted in probe request.
  1161. * 5:7 reserved
  1162. */
  1163. u8 type;
  1164. u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
  1165. struct iwl3945_tx_power tpc;
  1166. __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
  1167. __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
  1168. } __attribute__ ((packed));
  1169. /**
  1170. * struct iwl3945_ssid_ie - directed scan network information element
  1171. *
  1172. * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
  1173. * in struct iwl3945_scan_channel; each channel may select different ssids from
  1174. * among the 4 entries. SSID IEs get transmitted in reverse order of entry.
  1175. */
  1176. struct iwl3945_ssid_ie {
  1177. u8 id;
  1178. u8 len;
  1179. u8 ssid[32];
  1180. } __attribute__ ((packed));
  1181. #define PROBE_OPTION_MAX 0x4
  1182. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  1183. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  1184. #define IWL_MAX_SCAN_SIZE 1024
  1185. /*
  1186. * REPLY_SCAN_CMD = 0x80 (command)
  1187. *
  1188. * The hardware scan command is very powerful; the driver can set it up to
  1189. * maintain (relatively) normal network traffic while doing a scan in the
  1190. * background. The max_out_time and suspend_time control the ratio of how
  1191. * long the device stays on an associated network channel ("service channel")
  1192. * vs. how long it's away from the service channel, tuned to other channels
  1193. * for scanning.
  1194. *
  1195. * max_out_time is the max time off-channel (in usec), and suspend_time
  1196. * is how long (in "extended beacon" format) that the scan is "suspended"
  1197. * after returning to the service channel. That is, suspend_time is the
  1198. * time that we stay on the service channel, doing normal work, between
  1199. * scan segments. The driver may set these parameters differently to support
  1200. * scanning when associated vs. not associated, and light vs. heavy traffic
  1201. * loads when associated.
  1202. *
  1203. * After receiving this command, the device's scan engine does the following;
  1204. *
  1205. * 1) Sends SCAN_START notification to driver
  1206. * 2) Checks to see if it has time to do scan for one channel
  1207. * 3) Sends NULL packet, with power-save (PS) bit set to 1,
  1208. * to tell AP that we're going off-channel
  1209. * 4) Tunes to first channel in scan list, does active or passive scan
  1210. * 5) Sends SCAN_RESULT notification to driver
  1211. * 6) Checks to see if it has time to do scan on *next* channel in list
  1212. * 7) Repeats 4-6 until it no longer has time to scan the next channel
  1213. * before max_out_time expires
  1214. * 8) Returns to service channel
  1215. * 9) Sends NULL packet with PS=0 to tell AP that we're back
  1216. * 10) Stays on service channel until suspend_time expires
  1217. * 11) Repeats entire process 2-10 until list is complete
  1218. * 12) Sends SCAN_COMPLETE notification
  1219. *
  1220. * For fast, efficient scans, the scan command also has support for staying on
  1221. * a channel for just a short time, if doing active scanning and getting no
  1222. * responses to the transmitted probe request. This time is controlled by
  1223. * quiet_time, and the number of received packets below which a channel is
  1224. * considered "quiet" is controlled by quiet_plcp_threshold.
  1225. *
  1226. * For active scanning on channels that have regulatory restrictions against
  1227. * blindly transmitting, the scan can listen before transmitting, to make sure
  1228. * that there is already legitimate activity on the channel. If enough
  1229. * packets are cleanly received on the channel (controlled by good_CRC_th,
  1230. * typical value 1), the scan engine starts transmitting probe requests.
  1231. *
  1232. * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
  1233. *
  1234. * To avoid uCode errors, see timing restrictions described under
  1235. * struct iwl3945_scan_channel.
  1236. */
  1237. struct iwl3945_scan_cmd {
  1238. __le16 len;
  1239. u8 reserved0;
  1240. u8 channel_count; /* # channels in channel list */
  1241. __le16 quiet_time; /* dwell only this # millisecs on quiet channel
  1242. * (only for active scan) */
  1243. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1244. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1245. __le16 reserved1;
  1246. __le32 max_out_time; /* max usec to be away from associated (service)
  1247. * channel */
  1248. __le32 suspend_time; /* pause scan this long (in "extended beacon
  1249. * format") when returning to service channel:
  1250. * 3945; 31:24 # beacons, 19:0 additional usec,
  1251. * 4965; 31:22 # beacons, 21:0 additional usec.
  1252. */
  1253. __le32 flags; /* RXON_FLG_* */
  1254. __le32 filter_flags; /* RXON_FILTER_* */
  1255. /* For active scans (set to all-0s for passive scans).
  1256. * Does not include payload. Must specify Tx rate; no rate scaling. */
  1257. struct iwl3945_tx_cmd tx_cmd;
  1258. /* For directed active scans (set to all-0s otherwise) */
  1259. struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1260. /*
  1261. * Probe request frame, followed by channel list.
  1262. *
  1263. * Size of probe request frame is specified by byte count in tx_cmd.
  1264. * Channel list follows immediately after probe request frame.
  1265. * Number of channels in list is specified by channel_count.
  1266. * Each channel in list is of type:
  1267. *
  1268. * struct iwl3945_scan_channel channels[0];
  1269. *
  1270. * NOTE: Only one band of channels can be scanned per pass. You
  1271. * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
  1272. * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
  1273. * before requesting another scan.
  1274. */
  1275. u8 data[0];
  1276. } __attribute__ ((packed));
  1277. /* Can abort will notify by complete notification with abort status. */
  1278. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1279. /* complete notification statuses */
  1280. #define ABORT_STATUS 0x2
  1281. /*
  1282. * REPLY_SCAN_CMD = 0x80 (response)
  1283. */
  1284. struct iwl3945_scanreq_notification {
  1285. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1286. } __attribute__ ((packed));
  1287. /*
  1288. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1289. */
  1290. struct iwl3945_scanstart_notification {
  1291. __le32 tsf_low;
  1292. __le32 tsf_high;
  1293. __le32 beacon_timer;
  1294. u8 channel;
  1295. u8 band;
  1296. u8 reserved[2];
  1297. __le32 status;
  1298. } __attribute__ ((packed));
  1299. #define SCAN_OWNER_STATUS 0x1;
  1300. #define MEASURE_OWNER_STATUS 0x2;
  1301. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1302. /*
  1303. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1304. */
  1305. struct iwl3945_scanresults_notification {
  1306. u8 channel;
  1307. u8 band;
  1308. u8 reserved[2];
  1309. __le32 tsf_low;
  1310. __le32 tsf_high;
  1311. __le32 statistics[NUMBER_OF_STATISTICS];
  1312. } __attribute__ ((packed));
  1313. /*
  1314. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1315. */
  1316. struct iwl3945_scancomplete_notification {
  1317. u8 scanned_channels;
  1318. u8 status;
  1319. u8 reserved;
  1320. u8 last_channel;
  1321. __le32 tsf_low;
  1322. __le32 tsf_high;
  1323. } __attribute__ ((packed));
  1324. /******************************************************************************
  1325. * (9)
  1326. * IBSS/AP Commands and Notifications:
  1327. *
  1328. *****************************************************************************/
  1329. /*
  1330. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1331. */
  1332. struct iwl3945_beacon_notif {
  1333. struct iwl3945_tx_resp beacon_notify_hdr;
  1334. __le32 low_tsf;
  1335. __le32 high_tsf;
  1336. __le32 ibss_mgr_status;
  1337. } __attribute__ ((packed));
  1338. /*
  1339. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1340. */
  1341. struct iwl3945_tx_beacon_cmd {
  1342. struct iwl3945_tx_cmd tx;
  1343. __le16 tim_idx;
  1344. u8 tim_size;
  1345. u8 reserved1;
  1346. struct ieee80211_hdr frame[0]; /* beacon frame */
  1347. } __attribute__ ((packed));
  1348. /******************************************************************************
  1349. * (10)
  1350. * Statistics Commands and Notifications:
  1351. *
  1352. *****************************************************************************/
  1353. #define IWL_TEMP_CONVERT 260
  1354. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1355. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1356. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1357. /* Used for passing to driver number of successes and failures per rate */
  1358. struct rate_histogram {
  1359. union {
  1360. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1361. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1362. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1363. } success;
  1364. union {
  1365. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1366. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1367. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1368. } failed;
  1369. } __attribute__ ((packed));
  1370. /* statistics command response */
  1371. struct statistics_rx_phy {
  1372. __le32 ina_cnt;
  1373. __le32 fina_cnt;
  1374. __le32 plcp_err;
  1375. __le32 crc32_err;
  1376. __le32 overrun_err;
  1377. __le32 early_overrun_err;
  1378. __le32 crc32_good;
  1379. __le32 false_alarm_cnt;
  1380. __le32 fina_sync_err_cnt;
  1381. __le32 sfd_timeout;
  1382. __le32 fina_timeout;
  1383. __le32 unresponded_rts;
  1384. __le32 rxe_frame_limit_overrun;
  1385. __le32 sent_ack_cnt;
  1386. __le32 sent_cts_cnt;
  1387. } __attribute__ ((packed));
  1388. struct statistics_rx_non_phy {
  1389. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1390. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1391. __le32 non_bssid_frames; /* number of frames with BSSID that
  1392. * doesn't belong to the STA BSSID */
  1393. __le32 filtered_frames; /* count frames that were dumped in the
  1394. * filtering process */
  1395. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1396. * our serving channel */
  1397. } __attribute__ ((packed));
  1398. struct statistics_rx {
  1399. struct statistics_rx_phy ofdm;
  1400. struct statistics_rx_phy cck;
  1401. struct statistics_rx_non_phy general;
  1402. } __attribute__ ((packed));
  1403. struct statistics_tx {
  1404. __le32 preamble_cnt;
  1405. __le32 rx_detected_cnt;
  1406. __le32 bt_prio_defer_cnt;
  1407. __le32 bt_prio_kill_cnt;
  1408. __le32 few_bytes_cnt;
  1409. __le32 cts_timeout;
  1410. __le32 ack_timeout;
  1411. __le32 expected_ack_cnt;
  1412. __le32 actual_ack_cnt;
  1413. } __attribute__ ((packed));
  1414. struct statistics_dbg {
  1415. __le32 burst_check;
  1416. __le32 burst_count;
  1417. __le32 reserved[4];
  1418. } __attribute__ ((packed));
  1419. struct statistics_div {
  1420. __le32 tx_on_a;
  1421. __le32 tx_on_b;
  1422. __le32 exec_time;
  1423. __le32 probe_time;
  1424. } __attribute__ ((packed));
  1425. struct statistics_general {
  1426. __le32 temperature;
  1427. struct statistics_dbg dbg;
  1428. __le32 sleep_time;
  1429. __le32 slots_out;
  1430. __le32 slots_idle;
  1431. __le32 ttl_timestamp;
  1432. struct statistics_div div;
  1433. } __attribute__ ((packed));
  1434. /*
  1435. * REPLY_STATISTICS_CMD = 0x9c,
  1436. * 3945 and 4965 identical.
  1437. *
  1438. * This command triggers an immediate response containing uCode statistics.
  1439. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1440. *
  1441. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1442. * internal copy of the statistics (counters) after issuing the response.
  1443. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1444. *
  1445. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1446. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1447. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1448. */
  1449. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1450. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1451. struct iwl3945_statistics_cmd {
  1452. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1453. } __attribute__ ((packed));
  1454. /*
  1455. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1456. *
  1457. * By default, uCode issues this notification after receiving a beacon
  1458. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1459. * REPLY_STATISTICS_CMD 0x9c, above.
  1460. *
  1461. * Statistics counters continue to increment beacon after beacon, but are
  1462. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1463. * 0x9c with CLEAR_STATS bit set (see above).
  1464. *
  1465. * uCode also issues this notification during scans. uCode clears statistics
  1466. * appropriately so that each notification contains statistics for only the
  1467. * one channel that has just been scanned.
  1468. */
  1469. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1470. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1471. struct iwl3945_notif_statistics {
  1472. __le32 flag;
  1473. struct statistics_rx rx;
  1474. struct statistics_tx tx;
  1475. struct statistics_general general;
  1476. } __attribute__ ((packed));
  1477. /*
  1478. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1479. */
  1480. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1481. * then this notification will be sent. */
  1482. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1483. struct iwl3945_missed_beacon_notif {
  1484. __le32 consequtive_missed_beacons;
  1485. __le32 total_missed_becons;
  1486. __le32 num_expected_beacons;
  1487. __le32 num_recvd_beacons;
  1488. } __attribute__ ((packed));
  1489. /******************************************************************************
  1490. * (11)
  1491. * Rx Calibration Commands:
  1492. *
  1493. *****************************************************************************/
  1494. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1495. #define HD_TABLE_SIZE (11)
  1496. struct iwl3945_sensitivity_cmd {
  1497. __le16 control;
  1498. __le16 table[HD_TABLE_SIZE];
  1499. } __attribute__ ((packed));
  1500. struct iwl3945_calibration_cmd {
  1501. u8 opCode;
  1502. u8 flags;
  1503. __le16 reserved;
  1504. s8 diff_gain_a;
  1505. s8 diff_gain_b;
  1506. s8 diff_gain_c;
  1507. u8 reserved1;
  1508. } __attribute__ ((packed));
  1509. /******************************************************************************
  1510. * (12)
  1511. * Miscellaneous Commands:
  1512. *
  1513. *****************************************************************************/
  1514. /*
  1515. * LEDs Command & Response
  1516. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1517. *
  1518. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1519. * this command turns it on or off, or sets up a periodic blinking cycle.
  1520. */
  1521. struct iwl3945_led_cmd {
  1522. __le32 interval; /* "interval" in uSec */
  1523. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1524. u8 off; /* # intervals off while blinking;
  1525. * "0", with >0 "on" value, turns LED on */
  1526. u8 on; /* # intervals on while blinking;
  1527. * "0", regardless of "off", turns LED off */
  1528. u8 reserved;
  1529. } __attribute__ ((packed));
  1530. /******************************************************************************
  1531. * (13)
  1532. * Union of all expected notifications/responses:
  1533. *
  1534. *****************************************************************************/
  1535. struct iwl3945_rx_packet {
  1536. __le32 len;
  1537. struct iwl3945_cmd_header hdr;
  1538. union {
  1539. struct iwl3945_alive_resp alive_frame;
  1540. struct iwl3945_rx_frame rx_frame;
  1541. struct iwl3945_tx_resp tx_resp;
  1542. struct iwl3945_spectrum_notification spectrum_notif;
  1543. struct iwl3945_csa_notification csa_notif;
  1544. struct iwl3945_error_resp err_resp;
  1545. struct iwl3945_card_state_notif card_state_notif;
  1546. struct iwl3945_beacon_notif beacon_status;
  1547. struct iwl3945_add_sta_resp add_sta;
  1548. struct iwl3945_sleep_notification sleep_notif;
  1549. struct iwl3945_spectrum_resp spectrum;
  1550. struct iwl3945_notif_statistics stats;
  1551. __le32 status;
  1552. u8 raw[0];
  1553. } u;
  1554. } __attribute__ ((packed));
  1555. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
  1556. #endif /* __iwl3945_3945_commands_h__ */