iwl-3945-commands.h 55 KB

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