iwl-3945-commands.h 57 KB

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