iwl-3945-commands.h 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696
  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. * 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 - 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. 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(0x0007)
  471. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0000)
  472. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x0001)
  473. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x0002)
  474. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x0003)
  475. #define STA_KEY_FLG_KEYID_POS 8
  476. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  477. /* wep key is either from global key (0) or from station info array (1) */
  478. #define STA_KEY_FLG_WEP_KEY_MAP_MSK __constant_cpu_to_le16(0x0008)
  479. /* wep key in STA: 5-bytes (0) or 13-bytes (1) */
  480. #define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000)
  481. #define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000)
  482. /* Flags indicate whether to modify vs. don't change various station params */
  483. #define STA_MODIFY_KEY_MASK 0x01
  484. #define STA_MODIFY_TID_DISABLE_TX 0x02
  485. #define STA_MODIFY_TX_RATE_MSK 0x04
  486. /*
  487. * Antenna masks:
  488. * bit14:15 01 B inactive, A active
  489. * 10 B active, A inactive
  490. * 11 Both active
  491. */
  492. #define RATE_MCS_ANT_A_POS 14
  493. #define RATE_MCS_ANT_B_POS 15
  494. #define RATE_MCS_ANT_A_MSK 0x4000
  495. #define RATE_MCS_ANT_B_MSK 0x8000
  496. #define RATE_MCS_ANT_AB_MSK 0xc000
  497. struct iwl3945_keyinfo {
  498. __le16 key_flags;
  499. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  500. u8 reserved1;
  501. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  502. u8 key_offset;
  503. u8 reserved2;
  504. u8 key[16]; /* 16-byte unicast decryption key */
  505. } __attribute__ ((packed));
  506. /**
  507. * struct sta_id_modify
  508. * @addr[ETH_ALEN]: station's MAC address
  509. * @sta_id: index of station in uCode's station table
  510. * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
  511. *
  512. * Driver selects unused table index when adding new station,
  513. * or the index to a pre-existing station entry when modifying that station.
  514. * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
  515. *
  516. * modify_mask flags select which parameters to modify vs. leave alone.
  517. */
  518. struct sta_id_modify {
  519. u8 addr[ETH_ALEN];
  520. __le16 reserved1;
  521. u8 sta_id;
  522. u8 modify_mask;
  523. __le16 reserved2;
  524. } __attribute__ ((packed));
  525. /*
  526. * REPLY_ADD_STA = 0x18 (command)
  527. *
  528. * The device contains an internal table of per-station information,
  529. * with info on security keys, aggregation parameters, and Tx rates for
  530. * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
  531. * 3945 uses REPLY_RATE_SCALE to set up rate tables).
  532. *
  533. * REPLY_ADD_STA sets up the table entry for one station, either creating
  534. * a new entry, or modifying a pre-existing one.
  535. *
  536. * NOTE: RXON command (without "associated" bit set) wipes the station table
  537. * clean. Moving into RF_KILL state does this also. Driver must set up
  538. * new station table before transmitting anything on the RXON channel
  539. * (except active scans or active measurements; those commands carry
  540. * their own txpower/rate setup data).
  541. *
  542. * When getting started on a new channel, driver must set up the
  543. * IWL_BROADCAST_ID entry (last entry in the table). For a client
  544. * station in a BSS, once an AP is selected, driver sets up the AP STA
  545. * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
  546. * are all that are needed for a BSS client station. If the device is
  547. * used as AP, or in an IBSS network, driver must set up station table
  548. * entries for all STAs in network, starting with index IWL_STA_ID.
  549. */
  550. struct iwl3945_addsta_cmd {
  551. u8 mode; /* 1: modify existing, 0: add new station */
  552. u8 reserved[3];
  553. struct sta_id_modify sta;
  554. struct iwl3945_keyinfo key;
  555. __le32 station_flags; /* STA_FLG_* */
  556. __le32 station_flags_msk; /* STA_FLG_* */
  557. /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
  558. * corresponding to bit (e.g. bit 5 controls TID 5).
  559. * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
  560. __le16 tid_disable_tx;
  561. __le16 rate_n_flags;
  562. /* TID for which to add block-ack support.
  563. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  564. u8 add_immediate_ba_tid;
  565. /* TID for which to remove block-ack support.
  566. * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
  567. u8 remove_immediate_ba_tid;
  568. /* Starting Sequence Number for added block-ack support.
  569. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  570. __le16 add_immediate_ba_ssn;
  571. } __attribute__ ((packed));
  572. #define ADD_STA_SUCCESS_MSK 0x1
  573. #define ADD_STA_NO_ROOM_IN_TABLE 0x2
  574. #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
  575. /*
  576. * REPLY_ADD_STA = 0x18 (response)
  577. */
  578. struct iwl3945_add_sta_resp {
  579. u8 status; /* ADD_STA_* */
  580. } __attribute__ ((packed));
  581. /******************************************************************************
  582. * (4)
  583. * Rx Responses:
  584. *
  585. *****************************************************************************/
  586. struct iwl3945_rx_frame_stats {
  587. u8 phy_count;
  588. u8 id;
  589. u8 rssi;
  590. u8 agc;
  591. __le16 sig_avg;
  592. __le16 noise_diff;
  593. u8 payload[0];
  594. } __attribute__ ((packed));
  595. struct iwl3945_rx_frame_hdr {
  596. __le16 channel;
  597. __le16 phy_flags;
  598. u8 reserved1;
  599. u8 rate;
  600. __le16 len;
  601. u8 payload[0];
  602. } __attribute__ ((packed));
  603. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  604. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  605. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  606. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  607. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  608. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  609. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  610. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  611. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  612. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  613. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  614. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  615. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  616. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  617. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  618. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  619. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  620. struct iwl3945_rx_frame_end {
  621. __le32 status;
  622. __le64 timestamp;
  623. __le32 beacon_timestamp;
  624. } __attribute__ ((packed));
  625. /*
  626. * REPLY_3945_RX = 0x1b (response only, not a command)
  627. *
  628. * NOTE: DO NOT dereference from casts to this structure
  629. * It is provided only for calculating minimum data set size.
  630. * The actual offsets of the hdr and end are dynamic based on
  631. * stats.phy_count
  632. */
  633. struct iwl3945_rx_frame {
  634. struct iwl3945_rx_frame_stats stats;
  635. struct iwl3945_rx_frame_hdr hdr;
  636. struct iwl3945_rx_frame_end end;
  637. } __attribute__ ((packed));
  638. /******************************************************************************
  639. * (5)
  640. * Tx Commands & Responses:
  641. *
  642. * Driver must place each REPLY_TX command into one of the prioritized Tx
  643. * queues in host DRAM, shared between driver and device. When the device's
  644. * Tx scheduler and uCode are preparing to transmit, the device pulls the
  645. * Tx command over the PCI bus via one of the device's Tx DMA channels,
  646. * to fill an internal FIFO from which data will be transmitted.
  647. *
  648. * uCode handles all timing and protocol related to control frames
  649. * (RTS/CTS/ACK), based on flags in the Tx command.
  650. *
  651. * uCode handles retrying Tx when an ACK is expected but not received.
  652. * This includes trying lower data rates than the one requested in the Tx
  653. * command, as set up by the REPLY_RATE_SCALE (for 3945) or
  654. * REPLY_TX_LINK_QUALITY_CMD (4965).
  655. *
  656. * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
  657. * This command must be executed after every RXON command, before Tx can occur.
  658. *****************************************************************************/
  659. /* REPLY_TX Tx flags field */
  660. /* 1: Use Request-To-Send protocol before this frame.
  661. * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
  662. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  663. /* 1: Transmit Clear-To-Send to self before this frame.
  664. * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
  665. * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
  666. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  667. /* 1: Expect ACK from receiving station
  668. * 0: Don't expect ACK (MAC header's duration field s/b 0)
  669. * Set this for unicast frames, but not broadcast/multicast. */
  670. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  671. /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
  672. * Tx command's initial_rate_index indicates first rate to try;
  673. * uCode walks through table for additional Tx attempts.
  674. * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
  675. * This rate will be used for all Tx attempts; it will not be scaled. */
  676. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  677. /* 1: Expect immediate block-ack.
  678. * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
  679. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  680. /* 1: Frame requires full Tx-Op protection.
  681. * Set this if either RTS or CTS Tx Flag gets set. */
  682. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  683. /* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
  684. * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
  685. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  686. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  687. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  688. /* 1: Ignore Bluetooth priority for this frame.
  689. * 0: Delay Tx until Bluetooth device is done (normal usage). */
  690. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  691. /* 1: uCode overrides sequence control field in MAC header.
  692. * 0: Driver provides sequence control field in MAC header.
  693. * Set this for management frames, non-QOS data frames, non-unicast frames,
  694. * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
  695. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  696. /* 1: This frame is non-last MPDU; more fragments are coming.
  697. * 0: Last fragment, or not using fragmentation. */
  698. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  699. /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
  700. * 0: No TSF required in outgoing frame.
  701. * Set this for transmitting beacons and probe responses. */
  702. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  703. /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
  704. * alignment of frame's payload data field.
  705. * 0: No pad
  706. * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
  707. * field (but not both). Driver must align frame data (i.e. data following
  708. * MAC header) to DWORD boundary. */
  709. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  710. /* HCCA-AP - disable duration overwriting. */
  711. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  712. /*
  713. * TX command security control
  714. */
  715. #define TX_CMD_SEC_WEP 0x01
  716. #define TX_CMD_SEC_CCM 0x02
  717. #define TX_CMD_SEC_TKIP 0x03
  718. #define TX_CMD_SEC_MSK 0x03
  719. #define TX_CMD_SEC_SHIFT 6
  720. #define TX_CMD_SEC_KEY128 0x08
  721. /*
  722. * REPLY_TX = 0x1c (command)
  723. */
  724. struct iwl3945_tx_cmd {
  725. /*
  726. * MPDU byte count:
  727. * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
  728. * + 8 byte IV for CCM or TKIP (not used for WEP)
  729. * + Data payload
  730. * + 8-byte MIC (not used for CCM/WEP)
  731. * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
  732. * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
  733. * Range: 14-2342 bytes.
  734. */
  735. __le16 len;
  736. /*
  737. * MPDU or MSDU byte count for next frame.
  738. * Used for fragmentation and bursting, but not 11n aggregation.
  739. * Same as "len", but for next frame. Set to 0 if not applicable.
  740. */
  741. __le16 next_frame_len;
  742. __le32 tx_flags; /* TX_CMD_FLG_* */
  743. u8 rate;
  744. /* Index of recipient station in uCode's station table */
  745. u8 sta_id;
  746. u8 tid_tspec;
  747. u8 sec_ctl;
  748. u8 key[16];
  749. union {
  750. u8 byte[8];
  751. __le16 word[4];
  752. __le32 dw[2];
  753. } tkip_mic;
  754. __le32 next_frame_info;
  755. union {
  756. __le32 life_time;
  757. __le32 attempt;
  758. } stop_time;
  759. u8 supp_rates[2];
  760. u8 rts_retry_limit; /*byte 50 */
  761. u8 data_retry_limit; /*byte 51 */
  762. union {
  763. __le16 pm_frame_timeout;
  764. __le16 attempt_duration;
  765. } timeout;
  766. /*
  767. * Duration of EDCA burst Tx Opportunity, in 32-usec units.
  768. * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
  769. */
  770. __le16 driver_txop;
  771. /*
  772. * MAC header goes here, followed by 2 bytes padding if MAC header
  773. * length is 26 or 30 bytes, followed by payload data
  774. */
  775. u8 payload[0];
  776. struct ieee80211_hdr hdr[0];
  777. } __attribute__ ((packed));
  778. /* TX command response is sent after *all* transmission attempts.
  779. *
  780. * NOTES:
  781. *
  782. * TX_STATUS_FAIL_NEXT_FRAG
  783. *
  784. * If the fragment flag in the MAC header for the frame being transmitted
  785. * is set and there is insufficient time to transmit the next frame, the
  786. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  787. *
  788. * TX_STATUS_FIFO_UNDERRUN
  789. *
  790. * Indicates the host did not provide bytes to the FIFO fast enough while
  791. * a TX was in progress.
  792. *
  793. * TX_STATUS_FAIL_MGMNT_ABORT
  794. *
  795. * This status is only possible if the ABORT ON MGMT RX parameter was
  796. * set to true with the TX command.
  797. *
  798. * If the MSB of the status parameter is set then an abort sequence is
  799. * required. This sequence consists of the host activating the TX Abort
  800. * control line, and then waiting for the TX Abort command response. This
  801. * indicates that a the device is no longer in a transmit state, and that the
  802. * command FIFO has been cleared. The host must then deactivate the TX Abort
  803. * control line. Receiving is still allowed in this case.
  804. */
  805. enum {
  806. TX_STATUS_SUCCESS = 0x01,
  807. TX_STATUS_DIRECT_DONE = 0x02,
  808. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  809. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  810. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  811. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  812. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  813. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  814. TX_STATUS_FAIL_DEST_PS = 0x88,
  815. TX_STATUS_FAIL_ABORTED = 0x89,
  816. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  817. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  818. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  819. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  820. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  821. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  822. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  823. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  824. };
  825. #define TX_PACKET_MODE_REGULAR 0x0000
  826. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  827. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  828. enum {
  829. TX_POWER_PA_NOT_ACTIVE = 0x0,
  830. };
  831. enum {
  832. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  833. TX_STATUS_DELAY_MSK = 0x00000040,
  834. TX_STATUS_ABORT_MSK = 0x00000080,
  835. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  836. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  837. TX_RESERVED = 0x00780000, /* bits 19:22 */
  838. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  839. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  840. };
  841. /*
  842. * REPLY_TX = 0x1c (response)
  843. */
  844. struct iwl3945_tx_resp {
  845. u8 failure_rts;
  846. u8 failure_frame;
  847. u8 bt_kill_count;
  848. u8 rate;
  849. __le32 wireless_media_time;
  850. __le32 status; /* TX status */
  851. } __attribute__ ((packed));
  852. /*
  853. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  854. */
  855. struct iwl3945_txpowertable_cmd {
  856. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  857. u8 reserved;
  858. __le16 channel;
  859. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  860. } __attribute__ ((packed));
  861. struct iwl3945_rate_scaling_info {
  862. __le16 rate_n_flags;
  863. u8 try_cnt;
  864. u8 next_rate_index;
  865. } __attribute__ ((packed));
  866. /**
  867. * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
  868. *
  869. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  870. *
  871. * NOTE: The table of rates passed to the uCode via the
  872. * RATE_SCALE command sets up the corresponding order of
  873. * rates used for all related commands, including rate
  874. * masks, etc.
  875. *
  876. * For example, if you set 9MB (PLCP 0x0f) as the first
  877. * rate in the rate table, the bit mask for that rate
  878. * when passed through ofdm_basic_rates on the REPLY_RXON
  879. * command would be bit 0 (1 << 0)
  880. */
  881. struct iwl3945_rate_scaling_cmd {
  882. u8 table_id;
  883. u8 reserved[3];
  884. struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
  885. } __attribute__ ((packed));
  886. /*
  887. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  888. *
  889. * 3945 and 4965 support hardware handshake with Bluetooth device on
  890. * same platform. Bluetooth device alerts wireless device when it will Tx;
  891. * wireless device can delay or kill its own Tx to accomodate.
  892. */
  893. struct iwl3945_bt_cmd {
  894. u8 flags;
  895. u8 lead_time;
  896. u8 max_kill;
  897. u8 reserved;
  898. __le32 kill_ack_mask;
  899. __le32 kill_cts_mask;
  900. } __attribute__ ((packed));
  901. /******************************************************************************
  902. * (6)
  903. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  904. *
  905. *****************************************************************************/
  906. /*
  907. * Spectrum Management
  908. */
  909. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  910. RXON_FILTER_CTL2HOST_MSK | \
  911. RXON_FILTER_ACCEPT_GRP_MSK | \
  912. RXON_FILTER_DIS_DECRYPT_MSK | \
  913. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  914. RXON_FILTER_ASSOC_MSK | \
  915. RXON_FILTER_BCON_AWARE_MSK)
  916. struct iwl3945_measure_channel {
  917. __le32 duration; /* measurement duration in extended beacon
  918. * format */
  919. u8 channel; /* channel to measure */
  920. u8 type; /* see enum iwl3945_measure_type */
  921. __le16 reserved;
  922. } __attribute__ ((packed));
  923. /*
  924. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  925. */
  926. struct iwl3945_spectrum_cmd {
  927. __le16 len; /* number of bytes starting from token */
  928. u8 token; /* token id */
  929. u8 id; /* measurement id -- 0 or 1 */
  930. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  931. u8 periodic; /* 1 = periodic */
  932. __le16 path_loss_timeout;
  933. __le32 start_time; /* start time in extended beacon format */
  934. __le32 reserved2;
  935. __le32 flags; /* rxon flags */
  936. __le32 filter_flags; /* rxon filter flags */
  937. __le16 channel_count; /* minimum 1, maximum 10 */
  938. __le16 reserved3;
  939. struct iwl3945_measure_channel channels[10];
  940. } __attribute__ ((packed));
  941. /*
  942. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  943. */
  944. struct iwl3945_spectrum_resp {
  945. u8 token;
  946. u8 id; /* id of the prior command replaced, or 0xff */
  947. __le16 status; /* 0 - command will be handled
  948. * 1 - cannot handle (conflicts with another
  949. * measurement) */
  950. } __attribute__ ((packed));
  951. enum iwl3945_measurement_state {
  952. IWL_MEASUREMENT_START = 0,
  953. IWL_MEASUREMENT_STOP = 1,
  954. };
  955. enum iwl3945_measurement_status {
  956. IWL_MEASUREMENT_OK = 0,
  957. IWL_MEASUREMENT_CONCURRENT = 1,
  958. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  959. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  960. /* 4-5 reserved */
  961. IWL_MEASUREMENT_STOPPED = 6,
  962. IWL_MEASUREMENT_TIMEOUT = 7,
  963. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  964. };
  965. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  966. struct iwl3945_measurement_histogram {
  967. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  968. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  969. } __attribute__ ((packed));
  970. /* clear channel availability counters */
  971. struct iwl3945_measurement_cca_counters {
  972. __le32 ofdm;
  973. __le32 cck;
  974. } __attribute__ ((packed));
  975. enum iwl3945_measure_type {
  976. IWL_MEASURE_BASIC = (1 << 0),
  977. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  978. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  979. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  980. IWL_MEASURE_FRAME = (1 << 4),
  981. /* bits 5:6 are reserved */
  982. IWL_MEASURE_IDLE = (1 << 7),
  983. };
  984. /*
  985. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  986. */
  987. struct iwl3945_spectrum_notification {
  988. u8 id; /* measurement id -- 0 or 1 */
  989. u8 token;
  990. u8 channel_index; /* index in measurement channel list */
  991. u8 state; /* 0 - start, 1 - stop */
  992. __le32 start_time; /* lower 32-bits of TSF */
  993. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  994. u8 channel;
  995. u8 type; /* see enum iwl3945_measurement_type */
  996. u8 reserved1;
  997. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  998. * valid if applicable for measurement type requested. */
  999. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  1000. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  1001. __le32 cca_time; /* channel load time in usecs */
  1002. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  1003. * unidentified */
  1004. u8 reserved2[3];
  1005. struct iwl3945_measurement_histogram histogram;
  1006. __le32 stop_time; /* lower 32-bits of TSF */
  1007. __le32 status; /* see iwl3945_measurement_status */
  1008. } __attribute__ ((packed));
  1009. /******************************************************************************
  1010. * (7)
  1011. * Power Management Commands, Responses, Notifications:
  1012. *
  1013. *****************************************************************************/
  1014. /**
  1015. * struct iwl3945_powertable_cmd - Power Table Command
  1016. * @flags: See below:
  1017. *
  1018. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  1019. *
  1020. * PM allow:
  1021. * bit 0 - '0' Driver not allow power management
  1022. * '1' Driver allow PM (use rest of parameters)
  1023. * uCode send sleep notifications:
  1024. * bit 1 - '0' Don't send sleep notification
  1025. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  1026. * Sleep over DTIM
  1027. * bit 2 - '0' PM have to walk up every DTIM
  1028. * '1' PM could sleep over DTIM till listen Interval.
  1029. * PCI power managed
  1030. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  1031. * '1' !(PCI_LINK_CTRL & 0x1)
  1032. * Force sleep Modes
  1033. * bit 31/30- '00' use both mac/xtal sleeps
  1034. * '01' force Mac sleep
  1035. * '10' force xtal sleep
  1036. * '11' Illegal set
  1037. *
  1038. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  1039. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  1040. * for every DTIM.
  1041. */
  1042. #define IWL_POWER_VEC_SIZE 5
  1043. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1 << 0)
  1044. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1 << 2)
  1045. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1 << 3)
  1046. struct iwl3945_powertable_cmd {
  1047. __le32 flags;
  1048. __le32 rx_data_timeout;
  1049. __le32 tx_data_timeout;
  1050. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  1051. } __attribute__((packed));
  1052. /*
  1053. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  1054. * 3945 and 4965 identical.
  1055. */
  1056. struct iwl3945_sleep_notification {
  1057. u8 pm_sleep_mode;
  1058. u8 pm_wakeup_src;
  1059. __le16 reserved;
  1060. __le32 sleep_time;
  1061. __le32 tsf_low;
  1062. __le32 bcon_timer;
  1063. } __attribute__ ((packed));
  1064. /* Sleep states. 3945 and 4965 identical. */
  1065. enum {
  1066. IWL_PM_NO_SLEEP = 0,
  1067. IWL_PM_SLP_MAC = 1,
  1068. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  1069. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  1070. IWL_PM_SLP_PHY = 4,
  1071. IWL_PM_SLP_REPENT = 5,
  1072. IWL_PM_WAKEUP_BY_TIMER = 6,
  1073. IWL_PM_WAKEUP_BY_DRIVER = 7,
  1074. IWL_PM_WAKEUP_BY_RFKILL = 8,
  1075. /* 3 reserved */
  1076. IWL_PM_NUM_OF_MODES = 12,
  1077. };
  1078. /*
  1079. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  1080. */
  1081. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  1082. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  1083. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  1084. struct iwl3945_card_state_cmd {
  1085. __le32 status; /* CARD_STATE_CMD_* request new power state */
  1086. } __attribute__ ((packed));
  1087. /*
  1088. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  1089. */
  1090. struct iwl3945_card_state_notif {
  1091. __le32 flags;
  1092. } __attribute__ ((packed));
  1093. #define HW_CARD_DISABLED 0x01
  1094. #define SW_CARD_DISABLED 0x02
  1095. #define RF_CARD_DISABLED 0x04
  1096. #define RXON_CARD_DISABLED 0x10
  1097. struct iwl3945_ct_kill_config {
  1098. __le32 reserved;
  1099. __le32 critical_temperature_M;
  1100. __le32 critical_temperature_R;
  1101. } __attribute__ ((packed));
  1102. /******************************************************************************
  1103. * (8)
  1104. * Scan Commands, Responses, Notifications:
  1105. *
  1106. *****************************************************************************/
  1107. /**
  1108. * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
  1109. *
  1110. * One for each channel in the scan list.
  1111. * Each channel can independently select:
  1112. * 1) SSID for directed active scans
  1113. * 2) Txpower setting (for rate specified within Tx command)
  1114. * 3) How long to stay on-channel (behavior may be modified by quiet_time,
  1115. * quiet_plcp_th, good_CRC_th)
  1116. *
  1117. * To avoid uCode errors, make sure the following are true (see comments
  1118. * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
  1119. * 1) If using passive_dwell (i.e. passive_dwell != 0):
  1120. * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
  1121. * 2) quiet_time <= active_dwell
  1122. * 3) If restricting off-channel time (i.e. max_out_time !=0):
  1123. * passive_dwell < max_out_time
  1124. * active_dwell < max_out_time
  1125. */
  1126. struct iwl3945_scan_channel {
  1127. /*
  1128. * type is defined as:
  1129. * 0:0 1 = active, 0 = passive
  1130. * 1:4 SSID direct bit map; if a bit is set, then corresponding
  1131. * SSID IE is transmitted in probe request.
  1132. * 5:7 reserved
  1133. */
  1134. u8 type;
  1135. u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
  1136. struct iwl3945_tx_power tpc;
  1137. __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
  1138. __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
  1139. } __attribute__ ((packed));
  1140. /**
  1141. * struct iwl3945_ssid_ie - directed scan network information element
  1142. *
  1143. * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
  1144. * in struct iwl3945_scan_channel; each channel may select different ssids from
  1145. * among the 4 entries. SSID IEs get transmitted in reverse order of entry.
  1146. */
  1147. struct iwl3945_ssid_ie {
  1148. u8 id;
  1149. u8 len;
  1150. u8 ssid[32];
  1151. } __attribute__ ((packed));
  1152. #define PROBE_OPTION_MAX 0x4
  1153. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  1154. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  1155. #define IWL_MAX_SCAN_SIZE 1024
  1156. /*
  1157. * REPLY_SCAN_CMD = 0x80 (command)
  1158. *
  1159. * The hardware scan command is very powerful; the driver can set it up to
  1160. * maintain (relatively) normal network traffic while doing a scan in the
  1161. * background. The max_out_time and suspend_time control the ratio of how
  1162. * long the device stays on an associated network channel ("service channel")
  1163. * vs. how long it's away from the service channel, tuned to other channels
  1164. * for scanning.
  1165. *
  1166. * max_out_time is the max time off-channel (in usec), and suspend_time
  1167. * is how long (in "extended beacon" format) that the scan is "suspended"
  1168. * after returning to the service channel. That is, suspend_time is the
  1169. * time that we stay on the service channel, doing normal work, between
  1170. * scan segments. The driver may set these parameters differently to support
  1171. * scanning when associated vs. not associated, and light vs. heavy traffic
  1172. * loads when associated.
  1173. *
  1174. * After receiving this command, the device's scan engine does the following;
  1175. *
  1176. * 1) Sends SCAN_START notification to driver
  1177. * 2) Checks to see if it has time to do scan for one channel
  1178. * 3) Sends NULL packet, with power-save (PS) bit set to 1,
  1179. * to tell AP that we're going off-channel
  1180. * 4) Tunes to first channel in scan list, does active or passive scan
  1181. * 5) Sends SCAN_RESULT notification to driver
  1182. * 6) Checks to see if it has time to do scan on *next* channel in list
  1183. * 7) Repeats 4-6 until it no longer has time to scan the next channel
  1184. * before max_out_time expires
  1185. * 8) Returns to service channel
  1186. * 9) Sends NULL packet with PS=0 to tell AP that we're back
  1187. * 10) Stays on service channel until suspend_time expires
  1188. * 11) Repeats entire process 2-10 until list is complete
  1189. * 12) Sends SCAN_COMPLETE notification
  1190. *
  1191. * For fast, efficient scans, the scan command also has support for staying on
  1192. * a channel for just a short time, if doing active scanning and getting no
  1193. * responses to the transmitted probe request. This time is controlled by
  1194. * quiet_time, and the number of received packets below which a channel is
  1195. * considered "quiet" is controlled by quiet_plcp_threshold.
  1196. *
  1197. * For active scanning on channels that have regulatory restrictions against
  1198. * blindly transmitting, the scan can listen before transmitting, to make sure
  1199. * that there is already legitimate activity on the channel. If enough
  1200. * packets are cleanly received on the channel (controlled by good_CRC_th,
  1201. * typical value 1), the scan engine starts transmitting probe requests.
  1202. *
  1203. * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
  1204. *
  1205. * To avoid uCode errors, see timing restrictions described under
  1206. * struct iwl3945_scan_channel.
  1207. */
  1208. struct iwl3945_scan_cmd {
  1209. __le16 len;
  1210. u8 reserved0;
  1211. u8 channel_count; /* # channels in channel list */
  1212. __le16 quiet_time; /* dwell only this # millisecs on quiet channel
  1213. * (only for active scan) */
  1214. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1215. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1216. __le16 reserved1;
  1217. __le32 max_out_time; /* max usec to be away from associated (service)
  1218. * channel */
  1219. __le32 suspend_time; /* pause scan this long (in "extended beacon
  1220. * format") when returning to service channel:
  1221. * 3945; 31:24 # beacons, 19:0 additional usec,
  1222. * 4965; 31:22 # beacons, 21:0 additional usec.
  1223. */
  1224. __le32 flags; /* RXON_FLG_* */
  1225. __le32 filter_flags; /* RXON_FILTER_* */
  1226. /* For active scans (set to all-0s for passive scans).
  1227. * Does not include payload. Must specify Tx rate; no rate scaling. */
  1228. struct iwl3945_tx_cmd tx_cmd;
  1229. /* For directed active scans (set to all-0s otherwise) */
  1230. struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1231. /*
  1232. * Probe request frame, followed by channel list.
  1233. *
  1234. * Size of probe request frame is specified by byte count in tx_cmd.
  1235. * Channel list follows immediately after probe request frame.
  1236. * Number of channels in list is specified by channel_count.
  1237. * Each channel in list is of type:
  1238. *
  1239. * struct iwl3945_scan_channel channels[0];
  1240. *
  1241. * NOTE: Only one band of channels can be scanned per pass. You
  1242. * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
  1243. * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
  1244. * before requesting another scan.
  1245. */
  1246. u8 data[0];
  1247. } __attribute__ ((packed));
  1248. /* Can abort will notify by complete notification with abort status. */
  1249. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1250. /* complete notification statuses */
  1251. #define ABORT_STATUS 0x2
  1252. /*
  1253. * REPLY_SCAN_CMD = 0x80 (response)
  1254. */
  1255. struct iwl3945_scanreq_notification {
  1256. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1257. } __attribute__ ((packed));
  1258. /*
  1259. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1260. */
  1261. struct iwl3945_scanstart_notification {
  1262. __le32 tsf_low;
  1263. __le32 tsf_high;
  1264. __le32 beacon_timer;
  1265. u8 channel;
  1266. u8 band;
  1267. u8 reserved[2];
  1268. __le32 status;
  1269. } __attribute__ ((packed));
  1270. #define SCAN_OWNER_STATUS 0x1;
  1271. #define MEASURE_OWNER_STATUS 0x2;
  1272. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1273. /*
  1274. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1275. */
  1276. struct iwl3945_scanresults_notification {
  1277. u8 channel;
  1278. u8 band;
  1279. u8 reserved[2];
  1280. __le32 tsf_low;
  1281. __le32 tsf_high;
  1282. __le32 statistics[NUMBER_OF_STATISTICS];
  1283. } __attribute__ ((packed));
  1284. /*
  1285. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1286. */
  1287. struct iwl3945_scancomplete_notification {
  1288. u8 scanned_channels;
  1289. u8 status;
  1290. u8 reserved;
  1291. u8 last_channel;
  1292. __le32 tsf_low;
  1293. __le32 tsf_high;
  1294. } __attribute__ ((packed));
  1295. /******************************************************************************
  1296. * (9)
  1297. * IBSS/AP Commands and Notifications:
  1298. *
  1299. *****************************************************************************/
  1300. /*
  1301. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1302. */
  1303. struct iwl3945_beacon_notif {
  1304. struct iwl3945_tx_resp beacon_notify_hdr;
  1305. __le32 low_tsf;
  1306. __le32 high_tsf;
  1307. __le32 ibss_mgr_status;
  1308. } __attribute__ ((packed));
  1309. /*
  1310. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1311. */
  1312. struct iwl3945_tx_beacon_cmd {
  1313. struct iwl3945_tx_cmd tx;
  1314. __le16 tim_idx;
  1315. u8 tim_size;
  1316. u8 reserved1;
  1317. struct ieee80211_hdr frame[0]; /* beacon frame */
  1318. } __attribute__ ((packed));
  1319. /******************************************************************************
  1320. * (10)
  1321. * Statistics Commands and Notifications:
  1322. *
  1323. *****************************************************************************/
  1324. #define IWL_TEMP_CONVERT 260
  1325. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1326. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1327. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1328. /* Used for passing to driver number of successes and failures per rate */
  1329. struct rate_histogram {
  1330. union {
  1331. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1332. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1333. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1334. } success;
  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. } failed;
  1340. } __attribute__ ((packed));
  1341. /* statistics command response */
  1342. struct statistics_rx_phy {
  1343. __le32 ina_cnt;
  1344. __le32 fina_cnt;
  1345. __le32 plcp_err;
  1346. __le32 crc32_err;
  1347. __le32 overrun_err;
  1348. __le32 early_overrun_err;
  1349. __le32 crc32_good;
  1350. __le32 false_alarm_cnt;
  1351. __le32 fina_sync_err_cnt;
  1352. __le32 sfd_timeout;
  1353. __le32 fina_timeout;
  1354. __le32 unresponded_rts;
  1355. __le32 rxe_frame_limit_overrun;
  1356. __le32 sent_ack_cnt;
  1357. __le32 sent_cts_cnt;
  1358. } __attribute__ ((packed));
  1359. struct statistics_rx_non_phy {
  1360. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1361. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1362. __le32 non_bssid_frames; /* number of frames with BSSID that
  1363. * doesn't belong to the STA BSSID */
  1364. __le32 filtered_frames; /* count frames that were dumped in the
  1365. * filtering process */
  1366. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1367. * our serving channel */
  1368. } __attribute__ ((packed));
  1369. struct statistics_rx {
  1370. struct statistics_rx_phy ofdm;
  1371. struct statistics_rx_phy cck;
  1372. struct statistics_rx_non_phy general;
  1373. } __attribute__ ((packed));
  1374. struct statistics_tx {
  1375. __le32 preamble_cnt;
  1376. __le32 rx_detected_cnt;
  1377. __le32 bt_prio_defer_cnt;
  1378. __le32 bt_prio_kill_cnt;
  1379. __le32 few_bytes_cnt;
  1380. __le32 cts_timeout;
  1381. __le32 ack_timeout;
  1382. __le32 expected_ack_cnt;
  1383. __le32 actual_ack_cnt;
  1384. } __attribute__ ((packed));
  1385. struct statistics_dbg {
  1386. __le32 burst_check;
  1387. __le32 burst_count;
  1388. __le32 reserved[4];
  1389. } __attribute__ ((packed));
  1390. struct statistics_div {
  1391. __le32 tx_on_a;
  1392. __le32 tx_on_b;
  1393. __le32 exec_time;
  1394. __le32 probe_time;
  1395. } __attribute__ ((packed));
  1396. struct statistics_general {
  1397. __le32 temperature;
  1398. struct statistics_dbg dbg;
  1399. __le32 sleep_time;
  1400. __le32 slots_out;
  1401. __le32 slots_idle;
  1402. __le32 ttl_timestamp;
  1403. struct statistics_div div;
  1404. } __attribute__ ((packed));
  1405. /*
  1406. * REPLY_STATISTICS_CMD = 0x9c,
  1407. * 3945 and 4965 identical.
  1408. *
  1409. * This command triggers an immediate response containing uCode statistics.
  1410. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1411. *
  1412. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1413. * internal copy of the statistics (counters) after issuing the response.
  1414. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1415. *
  1416. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1417. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1418. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1419. */
  1420. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1421. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1422. struct iwl3945_statistics_cmd {
  1423. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1424. } __attribute__ ((packed));
  1425. /*
  1426. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1427. *
  1428. * By default, uCode issues this notification after receiving a beacon
  1429. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1430. * REPLY_STATISTICS_CMD 0x9c, above.
  1431. *
  1432. * Statistics counters continue to increment beacon after beacon, but are
  1433. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1434. * 0x9c with CLEAR_STATS bit set (see above).
  1435. *
  1436. * uCode also issues this notification during scans. uCode clears statistics
  1437. * appropriately so that each notification contains statistics for only the
  1438. * one channel that has just been scanned.
  1439. */
  1440. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1441. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1442. struct iwl3945_notif_statistics {
  1443. __le32 flag;
  1444. struct statistics_rx rx;
  1445. struct statistics_tx tx;
  1446. struct statistics_general general;
  1447. } __attribute__ ((packed));
  1448. /*
  1449. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1450. */
  1451. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1452. * then this notification will be sent. */
  1453. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1454. struct iwl3945_missed_beacon_notif {
  1455. __le32 consequtive_missed_beacons;
  1456. __le32 total_missed_becons;
  1457. __le32 num_expected_beacons;
  1458. __le32 num_recvd_beacons;
  1459. } __attribute__ ((packed));
  1460. /******************************************************************************
  1461. * (11)
  1462. * Rx Calibration Commands:
  1463. *
  1464. *****************************************************************************/
  1465. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1466. #define HD_TABLE_SIZE (11)
  1467. struct iwl3945_sensitivity_cmd {
  1468. __le16 control;
  1469. __le16 table[HD_TABLE_SIZE];
  1470. } __attribute__ ((packed));
  1471. struct iwl3945_calibration_cmd {
  1472. u8 opCode;
  1473. u8 flags;
  1474. __le16 reserved;
  1475. s8 diff_gain_a;
  1476. s8 diff_gain_b;
  1477. s8 diff_gain_c;
  1478. u8 reserved1;
  1479. } __attribute__ ((packed));
  1480. /******************************************************************************
  1481. * (12)
  1482. * Miscellaneous Commands:
  1483. *
  1484. *****************************************************************************/
  1485. /*
  1486. * LEDs Command & Response
  1487. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1488. *
  1489. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1490. * this command turns it on or off, or sets up a periodic blinking cycle.
  1491. */
  1492. struct iwl3945_led_cmd {
  1493. __le32 interval; /* "interval" in uSec */
  1494. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1495. u8 off; /* # intervals off while blinking;
  1496. * "0", with >0 "on" value, turns LED on */
  1497. u8 on; /* # intervals on while blinking;
  1498. * "0", regardless of "off", turns LED off */
  1499. u8 reserved;
  1500. } __attribute__ ((packed));
  1501. /******************************************************************************
  1502. * (13)
  1503. * Union of all expected notifications/responses:
  1504. *
  1505. *****************************************************************************/
  1506. struct iwl3945_rx_packet {
  1507. __le32 len;
  1508. struct iwl3945_cmd_header hdr;
  1509. union {
  1510. struct iwl3945_alive_resp alive_frame;
  1511. struct iwl3945_rx_frame rx_frame;
  1512. struct iwl3945_tx_resp tx_resp;
  1513. struct iwl3945_spectrum_notification spectrum_notif;
  1514. struct iwl3945_csa_notification csa_notif;
  1515. struct iwl3945_error_resp err_resp;
  1516. struct iwl3945_card_state_notif card_state_notif;
  1517. struct iwl3945_beacon_notif beacon_status;
  1518. struct iwl3945_add_sta_resp add_sta;
  1519. struct iwl3945_sleep_notification sleep_notif;
  1520. struct iwl3945_spectrum_resp spectrum;
  1521. struct iwl3945_notif_statistics stats;
  1522. __le32 status;
  1523. u8 raw[0];
  1524. } u;
  1525. } __attribute__ ((packed));
  1526. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
  1527. #endif /* __iwl3945_3945_commands_h__ */