iwl-4965-commands.h 45 KB

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