iwl-4965-commands.h 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654
  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. #ifndef __iwl4965_commands_h__
  64. #define __iwl4965_commands_h__
  65. enum {
  66. REPLY_ALIVE = 0x1,
  67. REPLY_ERROR = 0x2,
  68. /* RXON and QOS commands */
  69. REPLY_RXON = 0x10,
  70. REPLY_RXON_ASSOC = 0x11,
  71. REPLY_QOS_PARAM = 0x13,
  72. REPLY_RXON_TIMING = 0x14,
  73. /* Multi-Station support */
  74. REPLY_ADD_STA = 0x18,
  75. REPLY_REMOVE_STA = 0x19, /* not used */
  76. REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
  77. /* RX, TX, LEDs */
  78. REPLY_TX = 0x1c,
  79. REPLY_RATE_SCALE = 0x47, /* 3945 only */
  80. REPLY_LEDS_CMD = 0x48,
  81. REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
  82. /* 802.11h related */
  83. RADAR_NOTIFICATION = 0x70, /* not used */
  84. REPLY_QUIET_CMD = 0x71, /* not used */
  85. REPLY_CHANNEL_SWITCH = 0x72,
  86. CHANNEL_SWITCH_NOTIFICATION = 0x73,
  87. REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
  88. SPECTRUM_MEASURE_NOTIFICATION = 0x75,
  89. /* Power Management */
  90. POWER_TABLE_CMD = 0x77,
  91. PM_SLEEP_NOTIFICATION = 0x7A,
  92. PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
  93. /* Scan commands and notifications */
  94. REPLY_SCAN_CMD = 0x80,
  95. REPLY_SCAN_ABORT_CMD = 0x81,
  96. SCAN_START_NOTIFICATION = 0x82,
  97. SCAN_RESULTS_NOTIFICATION = 0x83,
  98. SCAN_COMPLETE_NOTIFICATION = 0x84,
  99. /* IBSS/AP commands */
  100. BEACON_NOTIFICATION = 0x90,
  101. REPLY_TX_BEACON = 0x91,
  102. WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
  103. /* Miscellaneous commands */
  104. QUIET_NOTIFICATION = 0x96, /* not used */
  105. REPLY_TX_PWR_TABLE_CMD = 0x97,
  106. MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
  107. /* BT config command */
  108. REPLY_BT_CONFIG = 0x9b,
  109. /* 4965 Statistics */
  110. REPLY_STATISTICS_CMD = 0x9c,
  111. STATISTICS_NOTIFICATION = 0x9d,
  112. /* RF-KILL commands and notifications */
  113. REPLY_CARD_STATE_CMD = 0xa0,
  114. CARD_STATE_NOTIFICATION = 0xa1,
  115. /* Missed beacons notification */
  116. MISSED_BEACONS_NOTIFICATION = 0xa2,
  117. REPLY_CT_KILL_CONFIG_CMD = 0xa4,
  118. SENSITIVITY_CMD = 0xa8,
  119. REPLY_PHY_CALIBRATION_CMD = 0xb0,
  120. REPLY_RX_PHY_CMD = 0xc0,
  121. REPLY_RX_MPDU_CMD = 0xc1,
  122. REPLY_4965_RX = 0xc3,
  123. REPLY_COMPRESSED_BA = 0xc5,
  124. REPLY_MAX = 0xff
  125. };
  126. /******************************************************************************
  127. * (0)
  128. * Commonly used structures and definitions:
  129. * Command header, rate_n_flags
  130. *
  131. *****************************************************************************/
  132. #define IWL_CMD_FAILED_MSK 0x40
  133. struct iwl4965_cmd_header {
  134. u8 cmd;
  135. u8 flags;
  136. /* We have 15 LSB to use as we please (MSB indicates
  137. * a frame Rx'd from the HW). We encode the following
  138. * information into the sequence field:
  139. *
  140. * 0:7 index in fifo
  141. * 8:13 fifo selection
  142. * 14:14 bit indicating if this packet references the 'extra'
  143. * storage at the end of the memory queue
  144. * 15:15 (Rx indication)
  145. *
  146. */
  147. __le16 sequence;
  148. /* command data follows immediately */
  149. u8 data[0];
  150. } __attribute__ ((packed));
  151. /**
  152. * 4965 rate_n_flags bit fields
  153. *
  154. * rate_n_flags format is used in following 4965 commands:
  155. * REPLY_4965_RX (response only)
  156. * REPLY_TX (both command and response)
  157. * REPLY_TX_LINK_QUALITY_CMD
  158. *
  159. * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
  160. * 2-0: 0) 6 Mbps
  161. * 1) 12 Mbps
  162. * 2) 18 Mbps
  163. * 3) 24 Mbps
  164. * 4) 36 Mbps
  165. * 5) 48 Mbps
  166. * 6) 54 Mbps
  167. * 7) 60 Mbps
  168. *
  169. * 3: 0) Single stream (SISO)
  170. * 1) Dual stream (MIMO)
  171. *
  172. * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps FAT duplicate data
  173. *
  174. * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
  175. * 3-0: 0xD) 6 Mbps
  176. * 0xF) 9 Mbps
  177. * 0x5) 12 Mbps
  178. * 0x7) 18 Mbps
  179. * 0x9) 24 Mbps
  180. * 0xB) 36 Mbps
  181. * 0x1) 48 Mbps
  182. * 0x3) 54 Mbps
  183. *
  184. * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
  185. * 3-0: 10) 1 Mbps
  186. * 20) 2 Mbps
  187. * 55) 5.5 Mbps
  188. * 110) 11 Mbps
  189. */
  190. #define RATE_MCS_CODE_MSK 0x7
  191. #define RATE_MCS_MIMO_POS 3
  192. #define RATE_MCS_MIMO_MSK 0x8
  193. #define RATE_MCS_HT_DUP_POS 5
  194. #define RATE_MCS_HT_DUP_MSK 0x20
  195. /* (1) HT format, (0) legacy format in bits 7:0 */
  196. #define RATE_MCS_FLAGS_POS 8
  197. #define RATE_MCS_HT_POS 8
  198. #define RATE_MCS_HT_MSK 0x100
  199. /* (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
  200. #define RATE_MCS_CCK_POS 9
  201. #define RATE_MCS_CCK_MSK 0x200
  202. /* (1) Use Green Field preamble */
  203. #define RATE_MCS_GF_POS 10
  204. #define RATE_MCS_GF_MSK 0x400
  205. /* (1) Use 40Mhz FAT channel width, (0) use 20 MHz legacy channel width */
  206. #define RATE_MCS_FAT_POS 11
  207. #define RATE_MCS_FAT_MSK 0x800
  208. /* (1) Duplicate data on both 20MHz channels. FAT (bit 11) must be set. */
  209. #define RATE_MCS_DUP_POS 12
  210. #define RATE_MCS_DUP_MSK 0x1000
  211. /* (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
  212. #define RATE_MCS_SGI_POS 13
  213. #define RATE_MCS_SGI_MSK 0x2000
  214. /**
  215. * rate_n_flags Tx antenna masks (4965 has 2 transmitters):
  216. * bit14:15 01 B inactive, A active
  217. * 10 B active, A inactive
  218. * 11 Both active
  219. */
  220. #define RATE_MCS_ANT_A_POS 14
  221. #define RATE_MCS_ANT_B_POS 15
  222. #define RATE_MCS_ANT_A_MSK 0x4000
  223. #define RATE_MCS_ANT_B_MSK 0x8000
  224. #define RATE_MCS_ANT_AB_MSK 0xc000
  225. /******************************************************************************
  226. * (0a)
  227. * Alive and Error Commands & Responses:
  228. *
  229. *****************************************************************************/
  230. #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
  231. #define INITIALIZE_SUBTYPE (9)
  232. /*
  233. * REPLY_ALIVE = 0x1 (response only, not a command)
  234. */
  235. struct iwl4965_alive_resp {
  236. u8 ucode_minor;
  237. u8 ucode_major;
  238. __le16 reserved1;
  239. u8 sw_rev[8];
  240. u8 ver_type;
  241. u8 ver_subtype;
  242. __le16 reserved2;
  243. __le32 log_event_table_ptr;
  244. __le32 error_event_table_ptr;
  245. __le32 timestamp;
  246. __le32 is_valid;
  247. } __attribute__ ((packed));
  248. struct iwl4965_init_alive_resp {
  249. u8 ucode_minor;
  250. u8 ucode_major;
  251. __le16 reserved1;
  252. u8 sw_rev[8];
  253. u8 ver_type;
  254. u8 ver_subtype;
  255. __le16 reserved2;
  256. __le32 log_event_table_ptr;
  257. __le32 error_event_table_ptr;
  258. __le32 timestamp;
  259. __le32 is_valid;
  260. /* calibration values from "initialize" uCode */
  261. __le32 voltage; /* signed */
  262. __le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */
  263. __le32 therm_r2[2]; /* signed */
  264. __le32 therm_r3[2]; /* signed */
  265. __le32 therm_r4[2]; /* signed */
  266. __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
  267. * 2 Tx chains */
  268. } __attribute__ ((packed));
  269. union tsf {
  270. u8 byte[8];
  271. __le16 word[4];
  272. __le32 dw[2];
  273. };
  274. /*
  275. * REPLY_ERROR = 0x2 (response only, not a command)
  276. */
  277. struct iwl4965_error_resp {
  278. __le32 error_type;
  279. u8 cmd_id;
  280. u8 reserved1;
  281. __le16 bad_cmd_seq_num;
  282. __le32 error_info;
  283. union tsf timestamp;
  284. } __attribute__ ((packed));
  285. /******************************************************************************
  286. * (1)
  287. * RXON Commands & Responses:
  288. *
  289. *****************************************************************************/
  290. /*
  291. * Rx config defines & structure
  292. */
  293. /* rx_config device types */
  294. enum {
  295. RXON_DEV_TYPE_AP = 1,
  296. RXON_DEV_TYPE_ESS = 3,
  297. RXON_DEV_TYPE_IBSS = 4,
  298. RXON_DEV_TYPE_SNIFFER = 6,
  299. };
  300. /* rx_config flags */
  301. /* band & modulation selection */
  302. #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
  303. #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
  304. /* auto detection enable */
  305. #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
  306. /* TGg protection when tx */
  307. #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
  308. /* cck short slot & preamble */
  309. #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
  310. #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
  311. /* antenna selection */
  312. #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
  313. #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
  314. #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  315. #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  316. /* radar detection enable */
  317. #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
  318. #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
  319. /* rx response to host with 8-byte TSF
  320. * (according to ON_AIR deassertion) */
  321. #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
  322. /* rx_config filter flags */
  323. /* accept all data frames */
  324. #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
  325. /* pass control & management to host */
  326. #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
  327. /* accept multi-cast */
  328. #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
  329. /* don't decrypt uni-cast frames */
  330. #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
  331. /* don't decrypt multi-cast frames */
  332. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
  333. /* STA is associated */
  334. #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
  335. /* transfer to host non bssid beacons in associated state */
  336. #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
  337. /*
  338. * REPLY_RXON = 0x10 (command, has simple generic response)
  339. */
  340. struct iwl4965_rxon_cmd {
  341. u8 node_addr[6];
  342. __le16 reserved1;
  343. u8 bssid_addr[6];
  344. __le16 reserved2;
  345. u8 wlap_bssid_addr[6];
  346. __le16 reserved3;
  347. u8 dev_type;
  348. u8 air_propagation;
  349. __le16 rx_chain;
  350. u8 ofdm_basic_rates;
  351. u8 cck_basic_rates;
  352. __le16 assoc_id;
  353. __le32 flags;
  354. __le32 filter_flags;
  355. __le16 channel;
  356. u8 ofdm_ht_single_stream_basic_rates;
  357. u8 ofdm_ht_dual_stream_basic_rates;
  358. } __attribute__ ((packed));
  359. /*
  360. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  361. */
  362. struct iwl4965_rxon_assoc_cmd {
  363. __le32 flags;
  364. __le32 filter_flags;
  365. u8 ofdm_basic_rates;
  366. u8 cck_basic_rates;
  367. u8 ofdm_ht_single_stream_basic_rates;
  368. u8 ofdm_ht_dual_stream_basic_rates;
  369. __le16 rx_chain_select_flags;
  370. __le16 reserved;
  371. } __attribute__ ((packed));
  372. /*
  373. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  374. */
  375. struct iwl4965_rxon_time_cmd {
  376. union tsf timestamp;
  377. __le16 beacon_interval;
  378. __le16 atim_window;
  379. __le32 beacon_init_val;
  380. __le16 listen_interval;
  381. __le16 reserved;
  382. } __attribute__ ((packed));
  383. struct iwl4965_tx_power {
  384. u8 tx_gain; /* gain for analog radio */
  385. u8 dsp_atten; /* gain for DSP */
  386. } __attribute__ ((packed));
  387. #define POWER_TABLE_NUM_ENTRIES 33
  388. #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
  389. #define POWER_TABLE_CCK_ENTRY 32
  390. struct tx_power_dual_stream {
  391. __le32 dw;
  392. } __attribute__ ((packed));
  393. struct iwl4965_tx_power_db {
  394. struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
  395. } __attribute__ ((packed));
  396. /*
  397. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  398. */
  399. struct iwl4965_channel_switch_cmd {
  400. u8 band;
  401. u8 expect_beacon;
  402. __le16 channel;
  403. __le32 rxon_flags;
  404. __le32 rxon_filter_flags;
  405. __le32 switch_time;
  406. struct iwl4965_tx_power_db tx_power;
  407. } __attribute__ ((packed));
  408. /*
  409. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  410. */
  411. struct iwl4965_csa_notification {
  412. __le16 band;
  413. __le16 channel;
  414. __le32 status; /* 0 - OK, 1 - fail */
  415. } __attribute__ ((packed));
  416. /******************************************************************************
  417. * (2)
  418. * Quality-of-Service (QOS) Commands & Responses:
  419. *
  420. *****************************************************************************/
  421. struct iwl4965_ac_qos {
  422. __le16 cw_min;
  423. __le16 cw_max;
  424. u8 aifsn;
  425. u8 reserved1;
  426. __le16 edca_txop;
  427. } __attribute__ ((packed));
  428. /* QoS flags defines */
  429. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
  430. #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
  431. #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
  432. /*
  433. * TXFIFO Queue number defines
  434. */
  435. /* number of Access categories (AC) (EDCA), queues 0..3 */
  436. #define AC_NUM 4
  437. /*
  438. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  439. */
  440. struct iwl4965_qosparam_cmd {
  441. __le32 qos_flags;
  442. struct iwl4965_ac_qos ac[AC_NUM];
  443. } __attribute__ ((packed));
  444. /******************************************************************************
  445. * (3)
  446. * Add/Modify Stations Commands & Responses:
  447. *
  448. *****************************************************************************/
  449. /*
  450. * Multi station support
  451. */
  452. #define IWL_AP_ID 0
  453. #define IWL_MULTICAST_ID 1
  454. #define IWL_STA_ID 2
  455. #define IWL3945_BROADCAST_ID 24
  456. #define IWL3945_STATION_COUNT 25
  457. #define IWL4965_BROADCAST_ID 31
  458. #define IWL4965_STATION_COUNT 32
  459. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  460. #define IWL_INVALID_STATION 255
  461. #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
  462. #define STA_CONTROL_MODIFY_MSK 0x01
  463. /* key flags __le16*/
  464. #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
  465. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
  466. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
  467. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
  468. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
  469. #define STA_KEY_FLG_KEYID_POS 8
  470. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  471. /* modify flags */
  472. #define STA_MODIFY_KEY_MASK 0x01
  473. #define STA_MODIFY_TID_DISABLE_TX 0x02
  474. #define STA_MODIFY_TX_RATE_MSK 0x04
  475. #define STA_MODIFY_ADDBA_TID_MSK 0x08
  476. #define STA_MODIFY_DELBA_TID_MSK 0x10
  477. #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
  478. struct iwl4965_keyinfo {
  479. __le16 key_flags;
  480. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  481. u8 reserved1;
  482. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  483. __le16 reserved2;
  484. u8 key[16]; /* 16-byte unicast decryption key */
  485. } __attribute__ ((packed));
  486. struct sta_id_modify {
  487. u8 addr[ETH_ALEN];
  488. __le16 reserved1;
  489. u8 sta_id;
  490. u8 modify_mask;
  491. __le16 reserved2;
  492. } __attribute__ ((packed));
  493. /*
  494. * REPLY_ADD_STA = 0x18 (command)
  495. */
  496. struct iwl4965_addsta_cmd {
  497. u8 mode;
  498. u8 reserved[3];
  499. struct sta_id_modify sta;
  500. struct iwl4965_keyinfo key;
  501. __le32 station_flags;
  502. __le32 station_flags_msk;
  503. __le16 tid_disable_tx;
  504. __le16 reserved1;
  505. u8 add_immediate_ba_tid;
  506. u8 remove_immediate_ba_tid;
  507. __le16 add_immediate_ba_ssn;
  508. __le32 reserved2;
  509. } __attribute__ ((packed));
  510. /*
  511. * REPLY_ADD_STA = 0x18 (response)
  512. */
  513. struct iwl4965_add_sta_resp {
  514. u8 status;
  515. } __attribute__ ((packed));
  516. #define ADD_STA_SUCCESS_MSK 0x1
  517. /******************************************************************************
  518. * (4)
  519. * Rx Responses:
  520. *
  521. *****************************************************************************/
  522. struct iwl4965_rx_frame_stats {
  523. u8 phy_count;
  524. u8 id;
  525. u8 rssi;
  526. u8 agc;
  527. __le16 sig_avg;
  528. __le16 noise_diff;
  529. u8 payload[0];
  530. } __attribute__ ((packed));
  531. struct iwl4965_rx_frame_hdr {
  532. __le16 channel;
  533. __le16 phy_flags;
  534. u8 reserved1;
  535. u8 rate;
  536. __le16 len;
  537. u8 payload[0];
  538. } __attribute__ ((packed));
  539. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  540. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  541. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  542. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  543. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  544. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  545. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  546. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  547. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  548. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  549. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  550. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  551. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  552. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  553. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  554. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  555. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  556. struct iwl4965_rx_frame_end {
  557. __le32 status;
  558. __le64 timestamp;
  559. __le32 beacon_timestamp;
  560. } __attribute__ ((packed));
  561. /*
  562. * REPLY_3945_RX = 0x1b (response only, not a command)
  563. *
  564. * NOTE: DO NOT dereference from casts to this structure
  565. * It is provided only for calculating minimum data set size.
  566. * The actual offsets of the hdr and end are dynamic based on
  567. * stats.phy_count
  568. */
  569. struct iwl4965_rx_frame {
  570. struct iwl4965_rx_frame_stats stats;
  571. struct iwl4965_rx_frame_hdr hdr;
  572. struct iwl4965_rx_frame_end end;
  573. } __attribute__ ((packed));
  574. /* Fixed (non-configurable) rx data from phy */
  575. #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
  576. #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
  577. #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
  578. #define IWL_AGC_DB_POS (7)
  579. struct iwl4965_rx_non_cfg_phy {
  580. __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
  581. __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
  582. u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
  583. u8 pad[0];
  584. } __attribute__ ((packed));
  585. /*
  586. * REPLY_4965_RX = 0xc3 (response only, not a command)
  587. * Used only for legacy (non 11n) frames.
  588. */
  589. #define RX_RES_PHY_CNT 14
  590. struct iwl4965_rx_phy_res {
  591. u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
  592. u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
  593. u8 stat_id; /* configurable DSP phy data set ID */
  594. u8 reserved1;
  595. __le64 timestamp; /* TSF at on air rise */
  596. __le32 beacon_time_stamp; /* beacon at on-air rise */
  597. __le16 phy_flags; /* general phy flags: band, modulation, ... */
  598. __le16 channel; /* channel number */
  599. __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
  600. __le32 reserved2;
  601. __le32 rate_n_flags;
  602. __le16 byte_count; /* frame's byte-count */
  603. __le16 reserved3;
  604. } __attribute__ ((packed));
  605. struct iwl4965_rx_mpdu_res_start {
  606. __le16 byte_count;
  607. __le16 reserved;
  608. } __attribute__ ((packed));
  609. /******************************************************************************
  610. * (5)
  611. * Tx Commands & Responses:
  612. *
  613. *****************************************************************************/
  614. /* Tx flags */
  615. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  616. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  617. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  618. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  619. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  620. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  621. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  622. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  623. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  624. /* ucode ignores BT priority for this frame */
  625. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  626. /* ucode overrides sequence control */
  627. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  628. /* signal that this frame is non-last MPDU */
  629. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  630. /* calculate TSF in outgoing frame */
  631. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  632. /* activate TX calibration. */
  633. #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
  634. /* signals that 2 bytes pad was inserted
  635. after the MAC header */
  636. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  637. /* HCCA-AP - disable duration overwriting. */
  638. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  639. /*
  640. * TX command security control
  641. */
  642. #define TX_CMD_SEC_WEP 0x01
  643. #define TX_CMD_SEC_CCM 0x02
  644. #define TX_CMD_SEC_TKIP 0x03
  645. #define TX_CMD_SEC_MSK 0x03
  646. #define TX_CMD_SEC_SHIFT 6
  647. #define TX_CMD_SEC_KEY128 0x08
  648. /*
  649. * TX command Frame life time
  650. */
  651. struct iwl4965_dram_scratch {
  652. u8 try_cnt;
  653. u8 bt_kill_cnt;
  654. __le16 reserved;
  655. } __attribute__ ((packed));
  656. /*
  657. * REPLY_TX = 0x1c (command)
  658. */
  659. struct iwl4965_tx_cmd {
  660. __le16 len;
  661. __le16 next_frame_len;
  662. __le32 tx_flags;
  663. struct iwl4965_dram_scratch scratch;
  664. __le32 rate_n_flags;
  665. u8 sta_id;
  666. u8 sec_ctl;
  667. u8 initial_rate_index;
  668. u8 reserved;
  669. u8 key[16];
  670. __le16 next_frame_flags;
  671. __le16 reserved2;
  672. union {
  673. __le32 life_time;
  674. __le32 attempt;
  675. } stop_time;
  676. __le32 dram_lsb_ptr;
  677. u8 dram_msb_ptr;
  678. u8 rts_retry_limit; /*byte 50 */
  679. u8 data_retry_limit; /*byte 51 */
  680. u8 tid_tspec;
  681. union {
  682. __le16 pm_frame_timeout;
  683. __le16 attempt_duration;
  684. } timeout;
  685. __le16 driver_txop;
  686. u8 payload[0];
  687. struct ieee80211_hdr hdr[0];
  688. } __attribute__ ((packed));
  689. /* TX command response is sent after *all* transmission attempts.
  690. *
  691. * NOTES:
  692. *
  693. * TX_STATUS_FAIL_NEXT_FRAG
  694. *
  695. * If the fragment flag in the MAC header for the frame being transmitted
  696. * is set and there is insufficient time to transmit the next frame, the
  697. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  698. *
  699. * TX_STATUS_FIFO_UNDERRUN
  700. *
  701. * Indicates the host did not provide bytes to the FIFO fast enough while
  702. * a TX was in progress.
  703. *
  704. * TX_STATUS_FAIL_MGMNT_ABORT
  705. *
  706. * This status is only possible if the ABORT ON MGMT RX parameter was
  707. * set to true with the TX command.
  708. *
  709. * If the MSB of the status parameter is set then an abort sequence is
  710. * required. This sequence consists of the host activating the TX Abort
  711. * control line, and then waiting for the TX Abort command response. This
  712. * indicates that a the device is no longer in a transmit state, and that the
  713. * command FIFO has been cleared. The host must then deactivate the TX Abort
  714. * control line. Receiving is still allowed in this case.
  715. */
  716. enum {
  717. TX_STATUS_SUCCESS = 0x01,
  718. TX_STATUS_DIRECT_DONE = 0x02,
  719. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  720. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  721. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  722. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  723. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  724. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  725. TX_STATUS_FAIL_DEST_PS = 0x88,
  726. TX_STATUS_FAIL_ABORTED = 0x89,
  727. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  728. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  729. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  730. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  731. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  732. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  733. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  734. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  735. };
  736. #define TX_PACKET_MODE_REGULAR 0x0000
  737. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  738. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  739. enum {
  740. TX_POWER_PA_NOT_ACTIVE = 0x0,
  741. };
  742. enum {
  743. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  744. TX_STATUS_DELAY_MSK = 0x00000040,
  745. TX_STATUS_ABORT_MSK = 0x00000080,
  746. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  747. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  748. TX_RESERVED = 0x00780000, /* bits 19:22 */
  749. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  750. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  751. };
  752. /* *******************************
  753. * TX aggregation state
  754. ******************************* */
  755. enum {
  756. AGG_TX_STATE_TRANSMITTED = 0x00,
  757. AGG_TX_STATE_UNDERRUN_MSK = 0x01,
  758. AGG_TX_STATE_BT_PRIO_MSK = 0x02,
  759. AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
  760. AGG_TX_STATE_ABORT_MSK = 0x08,
  761. AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
  762. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
  763. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
  764. AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
  765. AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
  766. AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
  767. AGG_TX_STATE_DUMP_TX_MSK = 0x200,
  768. AGG_TX_STATE_DELAY_TX_MSK = 0x400
  769. };
  770. #define AGG_TX_STATE_LAST_SENT_MSK \
  771. (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
  772. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
  773. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
  774. #define AGG_TX_STATE_TRY_CNT_POS 12
  775. #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
  776. #define AGG_TX_STATE_SEQ_NUM_POS 16
  777. #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
  778. /*
  779. * REPLY_TX = 0x1c (response)
  780. */
  781. struct iwl4965_tx_resp {
  782. u8 frame_count; /* 1 no aggregation, >1 aggregation */
  783. u8 bt_kill_count;
  784. u8 failure_rts;
  785. u8 failure_frame;
  786. __le32 rate_n_flags;
  787. __le16 wireless_media_time;
  788. __le16 reserved;
  789. __le32 pa_power1;
  790. __le32 pa_power2;
  791. __le32 status; /* TX status (for aggregation status of 1st frame) */
  792. } __attribute__ ((packed));
  793. /*
  794. * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  795. */
  796. struct iwl4965_compressed_ba_resp {
  797. __le32 sta_addr_lo32;
  798. __le16 sta_addr_hi16;
  799. __le16 reserved;
  800. u8 sta_id;
  801. u8 tid;
  802. __le16 ba_seq_ctl;
  803. __le32 ba_bitmap0;
  804. __le32 ba_bitmap1;
  805. __le16 scd_flow;
  806. __le16 scd_ssn;
  807. } __attribute__ ((packed));
  808. /*
  809. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  810. */
  811. struct iwl4965_txpowertable_cmd {
  812. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  813. u8 reserved;
  814. __le16 channel;
  815. struct iwl4965_tx_power_db tx_power;
  816. } __attribute__ ((packed));
  817. /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
  818. #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0)
  819. #define LINK_QUAL_AC_NUM AC_NUM
  820. #define LINK_QUAL_MAX_RETRY_NUM 16
  821. #define LINK_QUAL_ANT_A_MSK (1<<0)
  822. #define LINK_QUAL_ANT_B_MSK (1<<1)
  823. #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
  824. struct iwl4965_link_qual_general_params {
  825. u8 flags;
  826. u8 mimo_delimiter;
  827. u8 single_stream_ant_msk;
  828. u8 dual_stream_ant_msk;
  829. u8 start_rate_index[LINK_QUAL_AC_NUM];
  830. } __attribute__ ((packed));
  831. struct iwl4965_link_qual_agg_params {
  832. __le16 agg_time_limit;
  833. u8 agg_dis_start_th;
  834. u8 agg_frame_cnt_limit;
  835. __le32 reserved;
  836. } __attribute__ ((packed));
  837. /*
  838. * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
  839. */
  840. struct iwl4965_link_quality_cmd {
  841. u8 sta_id;
  842. u8 reserved1;
  843. __le16 control;
  844. struct iwl4965_link_qual_general_params general_params;
  845. struct iwl4965_link_qual_agg_params agg_params;
  846. struct {
  847. __le32 rate_n_flags;
  848. } rs_table[LINK_QUAL_MAX_RETRY_NUM];
  849. __le32 reserved2;
  850. } __attribute__ ((packed));
  851. /*
  852. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  853. */
  854. struct iwl4965_bt_cmd {
  855. u8 flags;
  856. u8 lead_time;
  857. u8 max_kill;
  858. u8 reserved;
  859. __le32 kill_ack_mask;
  860. __le32 kill_cts_mask;
  861. } __attribute__ ((packed));
  862. /******************************************************************************
  863. * (6)
  864. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  865. *
  866. *****************************************************************************/
  867. /*
  868. * Spectrum Management
  869. */
  870. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  871. RXON_FILTER_CTL2HOST_MSK | \
  872. RXON_FILTER_ACCEPT_GRP_MSK | \
  873. RXON_FILTER_DIS_DECRYPT_MSK | \
  874. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  875. RXON_FILTER_ASSOC_MSK | \
  876. RXON_FILTER_BCON_AWARE_MSK)
  877. struct iwl4965_measure_channel {
  878. __le32 duration; /* measurement duration in extended beacon
  879. * format */
  880. u8 channel; /* channel to measure */
  881. u8 type; /* see enum iwl4965_measure_type */
  882. __le16 reserved;
  883. } __attribute__ ((packed));
  884. /*
  885. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  886. */
  887. struct iwl4965_spectrum_cmd {
  888. __le16 len; /* number of bytes starting from token */
  889. u8 token; /* token id */
  890. u8 id; /* measurement id -- 0 or 1 */
  891. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  892. u8 periodic; /* 1 = periodic */
  893. __le16 path_loss_timeout;
  894. __le32 start_time; /* start time in extended beacon format */
  895. __le32 reserved2;
  896. __le32 flags; /* rxon flags */
  897. __le32 filter_flags; /* rxon filter flags */
  898. __le16 channel_count; /* minimum 1, maximum 10 */
  899. __le16 reserved3;
  900. struct iwl4965_measure_channel channels[10];
  901. } __attribute__ ((packed));
  902. /*
  903. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  904. */
  905. struct iwl4965_spectrum_resp {
  906. u8 token;
  907. u8 id; /* id of the prior command replaced, or 0xff */
  908. __le16 status; /* 0 - command will be handled
  909. * 1 - cannot handle (conflicts with another
  910. * measurement) */
  911. } __attribute__ ((packed));
  912. enum iwl4965_measurement_state {
  913. IWL_MEASUREMENT_START = 0,
  914. IWL_MEASUREMENT_STOP = 1,
  915. };
  916. enum iwl4965_measurement_status {
  917. IWL_MEASUREMENT_OK = 0,
  918. IWL_MEASUREMENT_CONCURRENT = 1,
  919. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  920. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  921. /* 4-5 reserved */
  922. IWL_MEASUREMENT_STOPPED = 6,
  923. IWL_MEASUREMENT_TIMEOUT = 7,
  924. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  925. };
  926. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  927. struct iwl4965_measurement_histogram {
  928. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  929. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  930. } __attribute__ ((packed));
  931. /* clear channel availability counters */
  932. struct iwl4965_measurement_cca_counters {
  933. __le32 ofdm;
  934. __le32 cck;
  935. } __attribute__ ((packed));
  936. enum iwl4965_measure_type {
  937. IWL_MEASURE_BASIC = (1 << 0),
  938. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  939. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  940. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  941. IWL_MEASURE_FRAME = (1 << 4),
  942. /* bits 5:6 are reserved */
  943. IWL_MEASURE_IDLE = (1 << 7),
  944. };
  945. /*
  946. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  947. */
  948. struct iwl4965_spectrum_notification {
  949. u8 id; /* measurement id -- 0 or 1 */
  950. u8 token;
  951. u8 channel_index; /* index in measurement channel list */
  952. u8 state; /* 0 - start, 1 - stop */
  953. __le32 start_time; /* lower 32-bits of TSF */
  954. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  955. u8 channel;
  956. u8 type; /* see enum iwl4965_measurement_type */
  957. u8 reserved1;
  958. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  959. * valid if applicable for measurement type requested. */
  960. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  961. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  962. __le32 cca_time; /* channel load time in usecs */
  963. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  964. * unidentified */
  965. u8 reserved2[3];
  966. struct iwl4965_measurement_histogram histogram;
  967. __le32 stop_time; /* lower 32-bits of TSF */
  968. __le32 status; /* see iwl4965_measurement_status */
  969. } __attribute__ ((packed));
  970. /******************************************************************************
  971. * (7)
  972. * Power Management Commands, Responses, Notifications:
  973. *
  974. *****************************************************************************/
  975. /**
  976. * struct iwl4965_powertable_cmd - Power Table Command
  977. * @flags: See below:
  978. *
  979. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  980. *
  981. * PM allow:
  982. * bit 0 - '0' Driver not allow power management
  983. * '1' Driver allow PM (use rest of parameters)
  984. * uCode send sleep notifications:
  985. * bit 1 - '0' Don't send sleep notification
  986. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  987. * Sleep over DTIM
  988. * bit 2 - '0' PM have to walk up every DTIM
  989. * '1' PM could sleep over DTIM till listen Interval.
  990. * PCI power managed
  991. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  992. * '1' !(PCI_LINK_CTRL & 0x1)
  993. * Force sleep Modes
  994. * bit 31/30- '00' use both mac/xtal sleeps
  995. * '01' force Mac sleep
  996. * '10' force xtal sleep
  997. * '11' Illegal set
  998. *
  999. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  1000. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  1001. * for every DTIM.
  1002. */
  1003. #define IWL_POWER_VEC_SIZE 5
  1004. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0)
  1005. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
  1006. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
  1007. struct iwl4965_powertable_cmd {
  1008. __le16 flags;
  1009. u8 keep_alive_seconds;
  1010. u8 debug_flags;
  1011. __le32 rx_data_timeout;
  1012. __le32 tx_data_timeout;
  1013. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  1014. __le32 keep_alive_beacons;
  1015. } __attribute__ ((packed));
  1016. /*
  1017. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  1018. * 3945 and 4965 identical.
  1019. */
  1020. struct iwl4965_sleep_notification {
  1021. u8 pm_sleep_mode;
  1022. u8 pm_wakeup_src;
  1023. __le16 reserved;
  1024. __le32 sleep_time;
  1025. __le32 tsf_low;
  1026. __le32 bcon_timer;
  1027. } __attribute__ ((packed));
  1028. /* Sleep states. 3945 and 4965 identical. */
  1029. enum {
  1030. IWL_PM_NO_SLEEP = 0,
  1031. IWL_PM_SLP_MAC = 1,
  1032. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  1033. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  1034. IWL_PM_SLP_PHY = 4,
  1035. IWL_PM_SLP_REPENT = 5,
  1036. IWL_PM_WAKEUP_BY_TIMER = 6,
  1037. IWL_PM_WAKEUP_BY_DRIVER = 7,
  1038. IWL_PM_WAKEUP_BY_RFKILL = 8,
  1039. /* 3 reserved */
  1040. IWL_PM_NUM_OF_MODES = 12,
  1041. };
  1042. /*
  1043. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  1044. */
  1045. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  1046. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  1047. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  1048. struct iwl4965_card_state_cmd {
  1049. __le32 status; /* CARD_STATE_CMD_* request new power state */
  1050. } __attribute__ ((packed));
  1051. /*
  1052. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  1053. */
  1054. struct iwl4965_card_state_notif {
  1055. __le32 flags;
  1056. } __attribute__ ((packed));
  1057. #define HW_CARD_DISABLED 0x01
  1058. #define SW_CARD_DISABLED 0x02
  1059. #define RF_CARD_DISABLED 0x04
  1060. #define RXON_CARD_DISABLED 0x10
  1061. struct iwl4965_ct_kill_config {
  1062. __le32 reserved;
  1063. __le32 critical_temperature_M;
  1064. __le32 critical_temperature_R;
  1065. } __attribute__ ((packed));
  1066. /******************************************************************************
  1067. * (8)
  1068. * Scan Commands, Responses, Notifications:
  1069. *
  1070. *****************************************************************************/
  1071. struct iwl4965_scan_channel {
  1072. /* type is defined as:
  1073. * 0:0 active (0 - passive)
  1074. * 1:4 SSID direct
  1075. * If 1 is set then corresponding SSID IE is transmitted in probe
  1076. * 5:7 reserved
  1077. */
  1078. u8 type;
  1079. u8 channel;
  1080. struct iwl4965_tx_power tpc;
  1081. __le16 active_dwell;
  1082. __le16 passive_dwell;
  1083. } __attribute__ ((packed));
  1084. struct iwl4965_ssid_ie {
  1085. u8 id;
  1086. u8 len;
  1087. u8 ssid[32];
  1088. } __attribute__ ((packed));
  1089. #define PROBE_OPTION_MAX 0x4
  1090. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  1091. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  1092. #define IWL_MAX_SCAN_SIZE 1024
  1093. /*
  1094. * REPLY_SCAN_CMD = 0x80 (command)
  1095. */
  1096. struct iwl4965_scan_cmd {
  1097. __le16 len;
  1098. u8 reserved0;
  1099. u8 channel_count;
  1100. __le16 quiet_time; /* dwell only this long on quiet chnl
  1101. * (active scan) */
  1102. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1103. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1104. __le16 rx_chain;
  1105. __le32 max_out_time; /* max usec to be out of associated (service)
  1106. * chnl */
  1107. __le32 suspend_time; /* pause scan this long when returning to svc
  1108. * chnl.
  1109. * 3945 -- 31:24 # beacons, 19:0 additional usec,
  1110. * 4965 -- 31:22 # beacons, 21:0 additional usec.
  1111. */
  1112. __le32 flags;
  1113. __le32 filter_flags;
  1114. struct iwl4965_tx_cmd tx_cmd;
  1115. struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1116. u8 data[0];
  1117. /*
  1118. * The channels start after the probe request payload and are of type:
  1119. *
  1120. * struct iwl4965_scan_channel channels[0];
  1121. *
  1122. * NOTE: Only one band of channels can be scanned per pass. You
  1123. * can not mix 2.4GHz channels and 5.2GHz channels and must
  1124. * request a scan multiple times (not concurrently)
  1125. *
  1126. */
  1127. } __attribute__ ((packed));
  1128. /* Can abort will notify by complete notification with abort status. */
  1129. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1130. /* complete notification statuses */
  1131. #define ABORT_STATUS 0x2
  1132. /*
  1133. * REPLY_SCAN_CMD = 0x80 (response)
  1134. */
  1135. struct iwl4965_scanreq_notification {
  1136. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1137. } __attribute__ ((packed));
  1138. /*
  1139. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1140. */
  1141. struct iwl4965_scanstart_notification {
  1142. __le32 tsf_low;
  1143. __le32 tsf_high;
  1144. __le32 beacon_timer;
  1145. u8 channel;
  1146. u8 band;
  1147. u8 reserved[2];
  1148. __le32 status;
  1149. } __attribute__ ((packed));
  1150. #define SCAN_OWNER_STATUS 0x1;
  1151. #define MEASURE_OWNER_STATUS 0x2;
  1152. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1153. /*
  1154. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1155. */
  1156. struct iwl4965_scanresults_notification {
  1157. u8 channel;
  1158. u8 band;
  1159. u8 reserved[2];
  1160. __le32 tsf_low;
  1161. __le32 tsf_high;
  1162. __le32 statistics[NUMBER_OF_STATISTICS];
  1163. } __attribute__ ((packed));
  1164. /*
  1165. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1166. */
  1167. struct iwl4965_scancomplete_notification {
  1168. u8 scanned_channels;
  1169. u8 status;
  1170. u8 reserved;
  1171. u8 last_channel;
  1172. __le32 tsf_low;
  1173. __le32 tsf_high;
  1174. } __attribute__ ((packed));
  1175. /******************************************************************************
  1176. * (9)
  1177. * IBSS/AP Commands and Notifications:
  1178. *
  1179. *****************************************************************************/
  1180. /*
  1181. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1182. */
  1183. struct iwl4965_beacon_notif {
  1184. struct iwl4965_tx_resp beacon_notify_hdr;
  1185. __le32 low_tsf;
  1186. __le32 high_tsf;
  1187. __le32 ibss_mgr_status;
  1188. } __attribute__ ((packed));
  1189. /*
  1190. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1191. */
  1192. struct iwl4965_tx_beacon_cmd {
  1193. struct iwl4965_tx_cmd tx;
  1194. __le16 tim_idx;
  1195. u8 tim_size;
  1196. u8 reserved1;
  1197. struct ieee80211_hdr frame[0]; /* beacon frame */
  1198. } __attribute__ ((packed));
  1199. /******************************************************************************
  1200. * (10)
  1201. * Statistics Commands and Notifications:
  1202. *
  1203. *****************************************************************************/
  1204. #define IWL_TEMP_CONVERT 260
  1205. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1206. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1207. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1208. /* Used for passing to driver number of successes and failures per rate */
  1209. struct rate_histogram {
  1210. union {
  1211. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1212. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1213. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1214. } success;
  1215. union {
  1216. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1217. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1218. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1219. } failed;
  1220. } __attribute__ ((packed));
  1221. /* statistics command response */
  1222. struct statistics_rx_phy {
  1223. __le32 ina_cnt;
  1224. __le32 fina_cnt;
  1225. __le32 plcp_err;
  1226. __le32 crc32_err;
  1227. __le32 overrun_err;
  1228. __le32 early_overrun_err;
  1229. __le32 crc32_good;
  1230. __le32 false_alarm_cnt;
  1231. __le32 fina_sync_err_cnt;
  1232. __le32 sfd_timeout;
  1233. __le32 fina_timeout;
  1234. __le32 unresponded_rts;
  1235. __le32 rxe_frame_limit_overrun;
  1236. __le32 sent_ack_cnt;
  1237. __le32 sent_cts_cnt;
  1238. __le32 sent_ba_rsp_cnt;
  1239. __le32 dsp_self_kill;
  1240. __le32 mh_format_err;
  1241. __le32 re_acq_main_rssi_sum;
  1242. __le32 reserved3;
  1243. } __attribute__ ((packed));
  1244. struct statistics_rx_ht_phy {
  1245. __le32 plcp_err;
  1246. __le32 overrun_err;
  1247. __le32 early_overrun_err;
  1248. __le32 crc32_good;
  1249. __le32 crc32_err;
  1250. __le32 mh_format_err;
  1251. __le32 agg_crc32_good;
  1252. __le32 agg_mpdu_cnt;
  1253. __le32 agg_cnt;
  1254. __le32 reserved2;
  1255. } __attribute__ ((packed));
  1256. struct statistics_rx_non_phy {
  1257. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1258. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1259. __le32 non_bssid_frames; /* number of frames with BSSID that
  1260. * doesn't belong to the STA BSSID */
  1261. __le32 filtered_frames; /* count frames that were dumped in the
  1262. * filtering process */
  1263. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1264. * our serving channel */
  1265. __le32 channel_beacons; /* beacons with our bss id and in our
  1266. * serving channel */
  1267. __le32 num_missed_bcon; /* number of missed beacons */
  1268. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  1269. * ADC was in saturation */
  1270. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  1271. * for INA */
  1272. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  1273. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  1274. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  1275. __le32 interference_data_flag; /* flag for interference data
  1276. * availability. 1 when data is
  1277. * available. */
  1278. __le32 channel_load; /* counts RX Enable time */
  1279. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  1280. * and CCK) counter */
  1281. __le32 beacon_rssi_a;
  1282. __le32 beacon_rssi_b;
  1283. __le32 beacon_rssi_c;
  1284. __le32 beacon_energy_a;
  1285. __le32 beacon_energy_b;
  1286. __le32 beacon_energy_c;
  1287. } __attribute__ ((packed));
  1288. struct statistics_rx {
  1289. struct statistics_rx_phy ofdm;
  1290. struct statistics_rx_phy cck;
  1291. struct statistics_rx_non_phy general;
  1292. struct statistics_rx_ht_phy ofdm_ht;
  1293. } __attribute__ ((packed));
  1294. struct statistics_tx_non_phy_agg {
  1295. __le32 ba_timeout;
  1296. __le32 ba_reschedule_frames;
  1297. __le32 scd_query_agg_frame_cnt;
  1298. __le32 scd_query_no_agg;
  1299. __le32 scd_query_agg;
  1300. __le32 scd_query_mismatch;
  1301. __le32 frame_not_ready;
  1302. __le32 underrun;
  1303. __le32 bt_prio_kill;
  1304. __le32 rx_ba_rsp_cnt;
  1305. __le32 reserved2;
  1306. __le32 reserved3;
  1307. } __attribute__ ((packed));
  1308. struct statistics_tx {
  1309. __le32 preamble_cnt;
  1310. __le32 rx_detected_cnt;
  1311. __le32 bt_prio_defer_cnt;
  1312. __le32 bt_prio_kill_cnt;
  1313. __le32 few_bytes_cnt;
  1314. __le32 cts_timeout;
  1315. __le32 ack_timeout;
  1316. __le32 expected_ack_cnt;
  1317. __le32 actual_ack_cnt;
  1318. __le32 dump_msdu_cnt;
  1319. __le32 burst_abort_next_frame_mismatch_cnt;
  1320. __le32 burst_abort_missing_next_frame_cnt;
  1321. __le32 cts_timeout_collision;
  1322. __le32 ack_or_ba_timeout_collision;
  1323. struct statistics_tx_non_phy_agg agg;
  1324. } __attribute__ ((packed));
  1325. struct statistics_dbg {
  1326. __le32 burst_check;
  1327. __le32 burst_count;
  1328. __le32 reserved[4];
  1329. } __attribute__ ((packed));
  1330. struct statistics_div {
  1331. __le32 tx_on_a;
  1332. __le32 tx_on_b;
  1333. __le32 exec_time;
  1334. __le32 probe_time;
  1335. __le32 reserved1;
  1336. __le32 reserved2;
  1337. } __attribute__ ((packed));
  1338. struct statistics_general {
  1339. __le32 temperature;
  1340. __le32 temperature_m;
  1341. struct statistics_dbg dbg;
  1342. __le32 sleep_time;
  1343. __le32 slots_out;
  1344. __le32 slots_idle;
  1345. __le32 ttl_timestamp;
  1346. struct statistics_div div;
  1347. __le32 rx_enable_counter;
  1348. __le32 reserved1;
  1349. __le32 reserved2;
  1350. __le32 reserved3;
  1351. } __attribute__ ((packed));
  1352. /*
  1353. * REPLY_STATISTICS_CMD = 0x9c,
  1354. * 3945 and 4965 identical.
  1355. *
  1356. * This command triggers an immediate response containing uCode statistics.
  1357. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1358. *
  1359. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1360. * internal copy of the statistics (counters) after issuing the response.
  1361. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1362. *
  1363. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1364. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1365. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1366. */
  1367. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1368. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1369. struct iwl4965_statistics_cmd {
  1370. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1371. } __attribute__ ((packed));
  1372. /*
  1373. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1374. *
  1375. * By default, uCode issues this notification after receiving a beacon
  1376. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1377. * REPLY_STATISTICS_CMD 0x9c, above.
  1378. *
  1379. * Statistics counters continue to increment beacon after beacon, but are
  1380. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1381. * 0x9c with CLEAR_STATS bit set (see above).
  1382. *
  1383. * uCode also issues this notification during scans. uCode clears statistics
  1384. * appropriately so that each notification contains statistics for only the
  1385. * one channel that has just been scanned.
  1386. */
  1387. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1388. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1389. struct iwl4965_notif_statistics {
  1390. __le32 flag;
  1391. struct statistics_rx rx;
  1392. struct statistics_tx tx;
  1393. struct statistics_general general;
  1394. } __attribute__ ((packed));
  1395. /*
  1396. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1397. */
  1398. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1399. * then this notification will be sent. */
  1400. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1401. struct iwl4965_missed_beacon_notif {
  1402. __le32 consequtive_missed_beacons;
  1403. __le32 total_missed_becons;
  1404. __le32 num_expected_beacons;
  1405. __le32 num_recvd_beacons;
  1406. } __attribute__ ((packed));
  1407. /******************************************************************************
  1408. * (11)
  1409. * Rx Calibration Commands:
  1410. *
  1411. *****************************************************************************/
  1412. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1413. #define HD_TABLE_SIZE (11)
  1414. struct iwl4965_sensitivity_cmd {
  1415. __le16 control;
  1416. __le16 table[HD_TABLE_SIZE];
  1417. } __attribute__ ((packed));
  1418. struct iwl4965_calibration_cmd {
  1419. u8 opCode;
  1420. u8 flags;
  1421. __le16 reserved;
  1422. s8 diff_gain_a;
  1423. s8 diff_gain_b;
  1424. s8 diff_gain_c;
  1425. u8 reserved1;
  1426. } __attribute__ ((packed));
  1427. /******************************************************************************
  1428. * (12)
  1429. * Miscellaneous Commands:
  1430. *
  1431. *****************************************************************************/
  1432. /*
  1433. * LEDs Command & Response
  1434. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1435. *
  1436. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1437. * this command turns it on or off, or sets up a periodic blinking cycle.
  1438. */
  1439. struct iwl4965_led_cmd {
  1440. __le32 interval; /* "interval" in uSec */
  1441. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1442. u8 off; /* # intervals off while blinking;
  1443. * "0", with >0 "on" value, turns LED on */
  1444. u8 on; /* # intervals on while blinking;
  1445. * "0", regardless of "off", turns LED off */
  1446. u8 reserved;
  1447. } __attribute__ ((packed));
  1448. /******************************************************************************
  1449. * (13)
  1450. * Union of all expected notifications/responses:
  1451. *
  1452. *****************************************************************************/
  1453. struct iwl4965_rx_packet {
  1454. __le32 len;
  1455. struct iwl4965_cmd_header hdr;
  1456. union {
  1457. struct iwl4965_alive_resp alive_frame;
  1458. struct iwl4965_rx_frame rx_frame;
  1459. struct iwl4965_tx_resp tx_resp;
  1460. struct iwl4965_spectrum_notification spectrum_notif;
  1461. struct iwl4965_csa_notification csa_notif;
  1462. struct iwl4965_error_resp err_resp;
  1463. struct iwl4965_card_state_notif card_state_notif;
  1464. struct iwl4965_beacon_notif beacon_status;
  1465. struct iwl4965_add_sta_resp add_sta;
  1466. struct iwl4965_sleep_notification sleep_notif;
  1467. struct iwl4965_spectrum_resp spectrum;
  1468. struct iwl4965_notif_statistics stats;
  1469. struct iwl4965_compressed_ba_resp compressed_ba;
  1470. struct iwl4965_missed_beacon_notif missed_beacon;
  1471. __le32 status;
  1472. u8 raw[0];
  1473. } u;
  1474. } __attribute__ ((packed));
  1475. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame))
  1476. #endif /* __iwl4965_commands_h__ */