iwl-4965-commands.h 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954
  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. #define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0)
  301. #define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1)
  302. #define RXON_RX_CHAIN_VALID_POS (1)
  303. #define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7<<4)
  304. #define RXON_RX_CHAIN_FORCE_SEL_POS (4)
  305. #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7<<7)
  306. #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  307. #define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3<<10)
  308. #define RXON_RX_CHAIN_CNT_POS (10)
  309. #define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3<<12)
  310. #define RXON_RX_CHAIN_MIMO_CNT_POS (12)
  311. #define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1<<14)
  312. #define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
  313. /* rx_config flags */
  314. /* band & modulation selection */
  315. #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
  316. #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
  317. /* auto detection enable */
  318. #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
  319. /* TGg protection when tx */
  320. #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
  321. /* cck short slot & preamble */
  322. #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
  323. #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
  324. /* antenna selection */
  325. #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
  326. #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
  327. #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  328. #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  329. /* radar detection enable */
  330. #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
  331. #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
  332. /* rx response to host with 8-byte TSF
  333. * (according to ON_AIR deassertion) */
  334. #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
  335. /* HT flags */
  336. #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
  337. #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK __constant_cpu_to_le32(0x1<<22)
  338. #define RXON_FLG_HT_OPERATING_MODE_POS (23)
  339. #define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1<<23)
  340. #define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2<<23)
  341. #define RXON_FLG_CHANNEL_MODE_POS (25)
  342. #define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3<<25)
  343. #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1<<25)
  344. #define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2<<25)
  345. /* rx_config filter flags */
  346. /* accept all data frames */
  347. #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
  348. /* pass control & management to host */
  349. #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
  350. /* accept multi-cast */
  351. #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
  352. /* don't decrypt uni-cast frames */
  353. #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
  354. /* don't decrypt multi-cast frames */
  355. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
  356. /* STA is associated */
  357. #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
  358. /* transfer to host non bssid beacons in associated state */
  359. #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
  360. /*
  361. * REPLY_RXON = 0x10 (command, has simple generic response)
  362. */
  363. struct iwl4965_rxon_cmd {
  364. u8 node_addr[6];
  365. __le16 reserved1;
  366. u8 bssid_addr[6];
  367. __le16 reserved2;
  368. u8 wlap_bssid_addr[6];
  369. __le16 reserved3;
  370. u8 dev_type;
  371. u8 air_propagation;
  372. __le16 rx_chain;
  373. u8 ofdm_basic_rates;
  374. u8 cck_basic_rates;
  375. __le16 assoc_id;
  376. __le32 flags;
  377. __le32 filter_flags;
  378. __le16 channel;
  379. u8 ofdm_ht_single_stream_basic_rates;
  380. u8 ofdm_ht_dual_stream_basic_rates;
  381. } __attribute__ ((packed));
  382. /*
  383. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  384. */
  385. struct iwl4965_rxon_assoc_cmd {
  386. __le32 flags;
  387. __le32 filter_flags;
  388. u8 ofdm_basic_rates;
  389. u8 cck_basic_rates;
  390. u8 ofdm_ht_single_stream_basic_rates;
  391. u8 ofdm_ht_dual_stream_basic_rates;
  392. __le16 rx_chain_select_flags;
  393. __le16 reserved;
  394. } __attribute__ ((packed));
  395. /*
  396. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  397. */
  398. struct iwl4965_rxon_time_cmd {
  399. union tsf timestamp;
  400. __le16 beacon_interval;
  401. __le16 atim_window;
  402. __le32 beacon_init_val;
  403. __le16 listen_interval;
  404. __le16 reserved;
  405. } __attribute__ ((packed));
  406. struct iwl4965_tx_power {
  407. u8 tx_gain; /* gain for analog radio */
  408. u8 dsp_atten; /* gain for DSP */
  409. } __attribute__ ((packed));
  410. #define POWER_TABLE_NUM_ENTRIES 33
  411. #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
  412. #define POWER_TABLE_CCK_ENTRY 32
  413. union iwl4965_tx_power_dual_stream {
  414. struct {
  415. u8 radio_tx_gain[2];
  416. u8 dsp_predis_atten[2];
  417. } s;
  418. u32 dw;
  419. };
  420. struct tx_power_dual_stream {
  421. __le32 dw;
  422. } __attribute__ ((packed));
  423. struct iwl4965_tx_power_db {
  424. struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
  425. } __attribute__ ((packed));
  426. /*
  427. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  428. */
  429. struct iwl4965_channel_switch_cmd {
  430. u8 band;
  431. u8 expect_beacon;
  432. __le16 channel;
  433. __le32 rxon_flags;
  434. __le32 rxon_filter_flags;
  435. __le32 switch_time;
  436. struct iwl4965_tx_power_db tx_power;
  437. } __attribute__ ((packed));
  438. /*
  439. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  440. */
  441. struct iwl4965_csa_notification {
  442. __le16 band;
  443. __le16 channel;
  444. __le32 status; /* 0 - OK, 1 - fail */
  445. } __attribute__ ((packed));
  446. /******************************************************************************
  447. * (2)
  448. * Quality-of-Service (QOS) Commands & Responses:
  449. *
  450. *****************************************************************************/
  451. struct iwl4965_ac_qos {
  452. __le16 cw_min;
  453. __le16 cw_max;
  454. u8 aifsn;
  455. u8 reserved1;
  456. __le16 edca_txop;
  457. } __attribute__ ((packed));
  458. /* QoS flags defines */
  459. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
  460. #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
  461. #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
  462. /*
  463. * TXFIFO Queue number defines
  464. */
  465. /* number of Access categories (AC) (EDCA), queues 0..3 */
  466. #define AC_NUM 4
  467. /*
  468. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  469. */
  470. struct iwl4965_qosparam_cmd {
  471. __le32 qos_flags;
  472. struct iwl4965_ac_qos ac[AC_NUM];
  473. } __attribute__ ((packed));
  474. /******************************************************************************
  475. * (3)
  476. * Add/Modify Stations Commands & Responses:
  477. *
  478. *****************************************************************************/
  479. /*
  480. * Multi station support
  481. */
  482. #define IWL_AP_ID 0
  483. #define IWL_MULTICAST_ID 1
  484. #define IWL_STA_ID 2
  485. #define IWL3945_BROADCAST_ID 24
  486. #define IWL3945_STATION_COUNT 25
  487. #define IWL4965_BROADCAST_ID 31
  488. #define IWL4965_STATION_COUNT 32
  489. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  490. #define IWL_INVALID_STATION 255
  491. #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
  492. #define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17)
  493. #define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18)
  494. #define STA_FLG_MAX_AGG_SIZE_POS (19)
  495. #define STA_FLG_MAX_AGG_SIZE_MSK __constant_cpu_to_le32(3 << 19)
  496. #define STA_FLG_FAT_EN_MSK __constant_cpu_to_le32(1 << 21)
  497. #define STA_FLG_MIMO_DIS_MSK __constant_cpu_to_le32(1 << 22)
  498. #define STA_FLG_AGG_MPDU_DENSITY_POS (23)
  499. #define STA_FLG_AGG_MPDU_DENSITY_MSK __constant_cpu_to_le32(7 << 23)
  500. #define STA_CONTROL_MODIFY_MSK 0x01
  501. /* key flags __le16*/
  502. #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
  503. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
  504. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
  505. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
  506. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
  507. #define STA_KEY_FLG_KEYID_POS 8
  508. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  509. /* modify flags */
  510. #define STA_MODIFY_KEY_MASK 0x01
  511. #define STA_MODIFY_TID_DISABLE_TX 0x02
  512. #define STA_MODIFY_TX_RATE_MSK 0x04
  513. #define STA_MODIFY_ADDBA_TID_MSK 0x08
  514. #define STA_MODIFY_DELBA_TID_MSK 0x10
  515. #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
  516. struct iwl4965_keyinfo {
  517. __le16 key_flags;
  518. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  519. u8 reserved1;
  520. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  521. __le16 reserved2;
  522. u8 key[16]; /* 16-byte unicast decryption key */
  523. } __attribute__ ((packed));
  524. struct sta_id_modify {
  525. u8 addr[ETH_ALEN];
  526. __le16 reserved1;
  527. u8 sta_id;
  528. u8 modify_mask;
  529. __le16 reserved2;
  530. } __attribute__ ((packed));
  531. /*
  532. * REPLY_ADD_STA = 0x18 (command)
  533. */
  534. struct iwl4965_addsta_cmd {
  535. u8 mode;
  536. u8 reserved[3];
  537. struct sta_id_modify sta;
  538. struct iwl4965_keyinfo key;
  539. __le32 station_flags;
  540. __le32 station_flags_msk;
  541. __le16 tid_disable_tx;
  542. __le16 reserved1;
  543. u8 add_immediate_ba_tid;
  544. u8 remove_immediate_ba_tid;
  545. __le16 add_immediate_ba_ssn;
  546. __le32 reserved2;
  547. } __attribute__ ((packed));
  548. /*
  549. * REPLY_ADD_STA = 0x18 (response)
  550. */
  551. struct iwl4965_add_sta_resp {
  552. u8 status;
  553. } __attribute__ ((packed));
  554. #define ADD_STA_SUCCESS_MSK 0x1
  555. /******************************************************************************
  556. * (4)
  557. * Rx Responses:
  558. *
  559. *****************************************************************************/
  560. struct iwl4965_rx_frame_stats {
  561. u8 phy_count;
  562. u8 id;
  563. u8 rssi;
  564. u8 agc;
  565. __le16 sig_avg;
  566. __le16 noise_diff;
  567. u8 payload[0];
  568. } __attribute__ ((packed));
  569. struct iwl4965_rx_frame_hdr {
  570. __le16 channel;
  571. __le16 phy_flags;
  572. u8 reserved1;
  573. u8 rate;
  574. __le16 len;
  575. u8 payload[0];
  576. } __attribute__ ((packed));
  577. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  578. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  579. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  580. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  581. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  582. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  583. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  584. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  585. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  586. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  587. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  588. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  589. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  590. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  591. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  592. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  593. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  594. struct iwl4965_rx_frame_end {
  595. __le32 status;
  596. __le64 timestamp;
  597. __le32 beacon_timestamp;
  598. } __attribute__ ((packed));
  599. /*
  600. * REPLY_3945_RX = 0x1b (response only, not a command)
  601. *
  602. * NOTE: DO NOT dereference from casts to this structure
  603. * It is provided only for calculating minimum data set size.
  604. * The actual offsets of the hdr and end are dynamic based on
  605. * stats.phy_count
  606. */
  607. struct iwl4965_rx_frame {
  608. struct iwl4965_rx_frame_stats stats;
  609. struct iwl4965_rx_frame_hdr hdr;
  610. struct iwl4965_rx_frame_end end;
  611. } __attribute__ ((packed));
  612. /* Fixed (non-configurable) rx data from phy */
  613. #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
  614. #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
  615. #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
  616. #define IWL_AGC_DB_POS (7)
  617. struct iwl4965_rx_non_cfg_phy {
  618. __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
  619. __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
  620. u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
  621. u8 pad[0];
  622. } __attribute__ ((packed));
  623. /*
  624. * REPLY_4965_RX = 0xc3 (response only, not a command)
  625. * Used only for legacy (non 11n) frames.
  626. */
  627. #define RX_RES_PHY_CNT 14
  628. struct iwl4965_rx_phy_res {
  629. u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
  630. u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
  631. u8 stat_id; /* configurable DSP phy data set ID */
  632. u8 reserved1;
  633. __le64 timestamp; /* TSF at on air rise */
  634. __le32 beacon_time_stamp; /* beacon at on-air rise */
  635. __le16 phy_flags; /* general phy flags: band, modulation, ... */
  636. __le16 channel; /* channel number */
  637. __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
  638. __le32 reserved2;
  639. __le32 rate_n_flags;
  640. __le16 byte_count; /* frame's byte-count */
  641. __le16 reserved3;
  642. } __attribute__ ((packed));
  643. struct iwl4965_rx_mpdu_res_start {
  644. __le16 byte_count;
  645. __le16 reserved;
  646. } __attribute__ ((packed));
  647. /******************************************************************************
  648. * (5)
  649. * Tx Commands & Responses:
  650. *
  651. *****************************************************************************/
  652. /* Tx flags */
  653. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  654. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  655. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  656. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  657. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  658. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  659. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  660. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  661. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  662. /* ucode ignores BT priority for this frame */
  663. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  664. /* ucode overrides sequence control */
  665. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  666. /* signal that this frame is non-last MPDU */
  667. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  668. /* calculate TSF in outgoing frame */
  669. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  670. /* activate TX calibration. */
  671. #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
  672. /* signals that 2 bytes pad was inserted
  673. after the MAC header */
  674. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  675. /* HCCA-AP - disable duration overwriting. */
  676. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  677. /*
  678. * TX command security control
  679. */
  680. #define TX_CMD_SEC_WEP 0x01
  681. #define TX_CMD_SEC_CCM 0x02
  682. #define TX_CMD_SEC_TKIP 0x03
  683. #define TX_CMD_SEC_MSK 0x03
  684. #define TX_CMD_SEC_SHIFT 6
  685. #define TX_CMD_SEC_KEY128 0x08
  686. /*
  687. * TX command Frame life time
  688. */
  689. struct iwl4965_dram_scratch {
  690. u8 try_cnt;
  691. u8 bt_kill_cnt;
  692. __le16 reserved;
  693. } __attribute__ ((packed));
  694. /*
  695. * REPLY_TX = 0x1c (command)
  696. */
  697. struct iwl4965_tx_cmd {
  698. __le16 len;
  699. __le16 next_frame_len;
  700. __le32 tx_flags;
  701. struct iwl4965_dram_scratch scratch;
  702. __le32 rate_n_flags;
  703. u8 sta_id;
  704. u8 sec_ctl;
  705. u8 initial_rate_index;
  706. u8 reserved;
  707. u8 key[16];
  708. __le16 next_frame_flags;
  709. __le16 reserved2;
  710. union {
  711. __le32 life_time;
  712. __le32 attempt;
  713. } stop_time;
  714. __le32 dram_lsb_ptr;
  715. u8 dram_msb_ptr;
  716. u8 rts_retry_limit; /*byte 50 */
  717. u8 data_retry_limit; /*byte 51 */
  718. u8 tid_tspec;
  719. union {
  720. __le16 pm_frame_timeout;
  721. __le16 attempt_duration;
  722. } timeout;
  723. __le16 driver_txop;
  724. u8 payload[0];
  725. struct ieee80211_hdr hdr[0];
  726. } __attribute__ ((packed));
  727. /* TX command response is sent after *all* transmission attempts.
  728. *
  729. * NOTES:
  730. *
  731. * TX_STATUS_FAIL_NEXT_FRAG
  732. *
  733. * If the fragment flag in the MAC header for the frame being transmitted
  734. * is set and there is insufficient time to transmit the next frame, the
  735. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  736. *
  737. * TX_STATUS_FIFO_UNDERRUN
  738. *
  739. * Indicates the host did not provide bytes to the FIFO fast enough while
  740. * a TX was in progress.
  741. *
  742. * TX_STATUS_FAIL_MGMNT_ABORT
  743. *
  744. * This status is only possible if the ABORT ON MGMT RX parameter was
  745. * set to true with the TX command.
  746. *
  747. * If the MSB of the status parameter is set then an abort sequence is
  748. * required. This sequence consists of the host activating the TX Abort
  749. * control line, and then waiting for the TX Abort command response. This
  750. * indicates that a the device is no longer in a transmit state, and that the
  751. * command FIFO has been cleared. The host must then deactivate the TX Abort
  752. * control line. Receiving is still allowed in this case.
  753. */
  754. enum {
  755. TX_STATUS_SUCCESS = 0x01,
  756. TX_STATUS_DIRECT_DONE = 0x02,
  757. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  758. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  759. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  760. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  761. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  762. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  763. TX_STATUS_FAIL_DEST_PS = 0x88,
  764. TX_STATUS_FAIL_ABORTED = 0x89,
  765. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  766. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  767. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  768. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  769. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  770. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  771. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  772. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  773. };
  774. #define TX_PACKET_MODE_REGULAR 0x0000
  775. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  776. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  777. enum {
  778. TX_POWER_PA_NOT_ACTIVE = 0x0,
  779. };
  780. enum {
  781. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  782. TX_STATUS_DELAY_MSK = 0x00000040,
  783. TX_STATUS_ABORT_MSK = 0x00000080,
  784. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  785. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  786. TX_RESERVED = 0x00780000, /* bits 19:22 */
  787. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  788. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  789. };
  790. /* *******************************
  791. * TX aggregation state
  792. ******************************* */
  793. enum {
  794. AGG_TX_STATE_TRANSMITTED = 0x00,
  795. AGG_TX_STATE_UNDERRUN_MSK = 0x01,
  796. AGG_TX_STATE_BT_PRIO_MSK = 0x02,
  797. AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
  798. AGG_TX_STATE_ABORT_MSK = 0x08,
  799. AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
  800. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
  801. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
  802. AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
  803. AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
  804. AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
  805. AGG_TX_STATE_DUMP_TX_MSK = 0x200,
  806. AGG_TX_STATE_DELAY_TX_MSK = 0x400
  807. };
  808. #define AGG_TX_STATE_LAST_SENT_MSK \
  809. (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
  810. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
  811. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
  812. #define AGG_TX_STATE_TRY_CNT_POS 12
  813. #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
  814. #define AGG_TX_STATE_SEQ_NUM_POS 16
  815. #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
  816. /*
  817. * REPLY_TX = 0x1c (response)
  818. */
  819. struct iwl4965_tx_resp {
  820. u8 frame_count; /* 1 no aggregation, >1 aggregation */
  821. u8 bt_kill_count;
  822. u8 failure_rts;
  823. u8 failure_frame;
  824. __le32 rate_n_flags;
  825. __le16 wireless_media_time;
  826. __le16 reserved;
  827. __le32 pa_power1;
  828. __le32 pa_power2;
  829. __le32 status; /* TX status (for aggregation status of 1st frame) */
  830. } __attribute__ ((packed));
  831. /*
  832. * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  833. */
  834. struct iwl4965_compressed_ba_resp {
  835. __le32 sta_addr_lo32;
  836. __le16 sta_addr_hi16;
  837. __le16 reserved;
  838. u8 sta_id;
  839. u8 tid;
  840. __le16 ba_seq_ctl;
  841. __le32 ba_bitmap0;
  842. __le32 ba_bitmap1;
  843. __le16 scd_flow;
  844. __le16 scd_ssn;
  845. } __attribute__ ((packed));
  846. /*
  847. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  848. */
  849. struct iwl4965_txpowertable_cmd {
  850. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  851. u8 reserved;
  852. __le16 channel;
  853. struct iwl4965_tx_power_db tx_power;
  854. } __attribute__ ((packed));
  855. /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
  856. #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0)
  857. #define LINK_QUAL_AC_NUM AC_NUM
  858. #define LINK_QUAL_MAX_RETRY_NUM 16
  859. #define LINK_QUAL_ANT_A_MSK (1<<0)
  860. #define LINK_QUAL_ANT_B_MSK (1<<1)
  861. #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
  862. struct iwl4965_link_qual_general_params {
  863. u8 flags;
  864. u8 mimo_delimiter;
  865. u8 single_stream_ant_msk;
  866. u8 dual_stream_ant_msk;
  867. u8 start_rate_index[LINK_QUAL_AC_NUM];
  868. } __attribute__ ((packed));
  869. struct iwl4965_link_qual_agg_params {
  870. __le16 agg_time_limit;
  871. u8 agg_dis_start_th;
  872. u8 agg_frame_cnt_limit;
  873. __le32 reserved;
  874. } __attribute__ ((packed));
  875. /*
  876. * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
  877. */
  878. struct iwl4965_link_quality_cmd {
  879. u8 sta_id;
  880. u8 reserved1;
  881. __le16 control;
  882. struct iwl4965_link_qual_general_params general_params;
  883. struct iwl4965_link_qual_agg_params agg_params;
  884. struct {
  885. __le32 rate_n_flags;
  886. } rs_table[LINK_QUAL_MAX_RETRY_NUM];
  887. __le32 reserved2;
  888. } __attribute__ ((packed));
  889. /*
  890. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  891. */
  892. struct iwl4965_bt_cmd {
  893. u8 flags;
  894. u8 lead_time;
  895. u8 max_kill;
  896. u8 reserved;
  897. __le32 kill_ack_mask;
  898. __le32 kill_cts_mask;
  899. } __attribute__ ((packed));
  900. /******************************************************************************
  901. * (6)
  902. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  903. *
  904. *****************************************************************************/
  905. /*
  906. * Spectrum Management
  907. */
  908. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  909. RXON_FILTER_CTL2HOST_MSK | \
  910. RXON_FILTER_ACCEPT_GRP_MSK | \
  911. RXON_FILTER_DIS_DECRYPT_MSK | \
  912. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  913. RXON_FILTER_ASSOC_MSK | \
  914. RXON_FILTER_BCON_AWARE_MSK)
  915. struct iwl4965_measure_channel {
  916. __le32 duration; /* measurement duration in extended beacon
  917. * format */
  918. u8 channel; /* channel to measure */
  919. u8 type; /* see enum iwl4965_measure_type */
  920. __le16 reserved;
  921. } __attribute__ ((packed));
  922. /*
  923. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  924. */
  925. struct iwl4965_spectrum_cmd {
  926. __le16 len; /* number of bytes starting from token */
  927. u8 token; /* token id */
  928. u8 id; /* measurement id -- 0 or 1 */
  929. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  930. u8 periodic; /* 1 = periodic */
  931. __le16 path_loss_timeout;
  932. __le32 start_time; /* start time in extended beacon format */
  933. __le32 reserved2;
  934. __le32 flags; /* rxon flags */
  935. __le32 filter_flags; /* rxon filter flags */
  936. __le16 channel_count; /* minimum 1, maximum 10 */
  937. __le16 reserved3;
  938. struct iwl4965_measure_channel channels[10];
  939. } __attribute__ ((packed));
  940. /*
  941. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  942. */
  943. struct iwl4965_spectrum_resp {
  944. u8 token;
  945. u8 id; /* id of the prior command replaced, or 0xff */
  946. __le16 status; /* 0 - command will be handled
  947. * 1 - cannot handle (conflicts with another
  948. * measurement) */
  949. } __attribute__ ((packed));
  950. enum iwl4965_measurement_state {
  951. IWL_MEASUREMENT_START = 0,
  952. IWL_MEASUREMENT_STOP = 1,
  953. };
  954. enum iwl4965_measurement_status {
  955. IWL_MEASUREMENT_OK = 0,
  956. IWL_MEASUREMENT_CONCURRENT = 1,
  957. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  958. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  959. /* 4-5 reserved */
  960. IWL_MEASUREMENT_STOPPED = 6,
  961. IWL_MEASUREMENT_TIMEOUT = 7,
  962. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  963. };
  964. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  965. struct iwl4965_measurement_histogram {
  966. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  967. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  968. } __attribute__ ((packed));
  969. /* clear channel availability counters */
  970. struct iwl4965_measurement_cca_counters {
  971. __le32 ofdm;
  972. __le32 cck;
  973. } __attribute__ ((packed));
  974. enum iwl4965_measure_type {
  975. IWL_MEASURE_BASIC = (1 << 0),
  976. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  977. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  978. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  979. IWL_MEASURE_FRAME = (1 << 4),
  980. /* bits 5:6 are reserved */
  981. IWL_MEASURE_IDLE = (1 << 7),
  982. };
  983. /*
  984. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  985. */
  986. struct iwl4965_spectrum_notification {
  987. u8 id; /* measurement id -- 0 or 1 */
  988. u8 token;
  989. u8 channel_index; /* index in measurement channel list */
  990. u8 state; /* 0 - start, 1 - stop */
  991. __le32 start_time; /* lower 32-bits of TSF */
  992. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  993. u8 channel;
  994. u8 type; /* see enum iwl4965_measurement_type */
  995. u8 reserved1;
  996. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  997. * valid if applicable for measurement type requested. */
  998. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  999. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  1000. __le32 cca_time; /* channel load time in usecs */
  1001. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  1002. * unidentified */
  1003. u8 reserved2[3];
  1004. struct iwl4965_measurement_histogram histogram;
  1005. __le32 stop_time; /* lower 32-bits of TSF */
  1006. __le32 status; /* see iwl4965_measurement_status */
  1007. } __attribute__ ((packed));
  1008. /******************************************************************************
  1009. * (7)
  1010. * Power Management Commands, Responses, Notifications:
  1011. *
  1012. *****************************************************************************/
  1013. /**
  1014. * struct iwl4965_powertable_cmd - Power Table Command
  1015. * @flags: See below:
  1016. *
  1017. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  1018. *
  1019. * PM allow:
  1020. * bit 0 - '0' Driver not allow power management
  1021. * '1' Driver allow PM (use rest of parameters)
  1022. * uCode send sleep notifications:
  1023. * bit 1 - '0' Don't send sleep notification
  1024. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  1025. * Sleep over DTIM
  1026. * bit 2 - '0' PM have to walk up every DTIM
  1027. * '1' PM could sleep over DTIM till listen Interval.
  1028. * PCI power managed
  1029. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  1030. * '1' !(PCI_LINK_CTRL & 0x1)
  1031. * Force sleep Modes
  1032. * bit 31/30- '00' use both mac/xtal sleeps
  1033. * '01' force Mac sleep
  1034. * '10' force xtal sleep
  1035. * '11' Illegal set
  1036. *
  1037. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  1038. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  1039. * for every DTIM.
  1040. */
  1041. #define IWL_POWER_VEC_SIZE 5
  1042. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0)
  1043. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
  1044. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
  1045. struct iwl4965_powertable_cmd {
  1046. __le16 flags;
  1047. u8 keep_alive_seconds;
  1048. u8 debug_flags;
  1049. __le32 rx_data_timeout;
  1050. __le32 tx_data_timeout;
  1051. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  1052. __le32 keep_alive_beacons;
  1053. } __attribute__ ((packed));
  1054. /*
  1055. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  1056. * 3945 and 4965 identical.
  1057. */
  1058. struct iwl4965_sleep_notification {
  1059. u8 pm_sleep_mode;
  1060. u8 pm_wakeup_src;
  1061. __le16 reserved;
  1062. __le32 sleep_time;
  1063. __le32 tsf_low;
  1064. __le32 bcon_timer;
  1065. } __attribute__ ((packed));
  1066. /* Sleep states. 3945 and 4965 identical. */
  1067. enum {
  1068. IWL_PM_NO_SLEEP = 0,
  1069. IWL_PM_SLP_MAC = 1,
  1070. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  1071. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  1072. IWL_PM_SLP_PHY = 4,
  1073. IWL_PM_SLP_REPENT = 5,
  1074. IWL_PM_WAKEUP_BY_TIMER = 6,
  1075. IWL_PM_WAKEUP_BY_DRIVER = 7,
  1076. IWL_PM_WAKEUP_BY_RFKILL = 8,
  1077. /* 3 reserved */
  1078. IWL_PM_NUM_OF_MODES = 12,
  1079. };
  1080. /*
  1081. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  1082. */
  1083. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  1084. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  1085. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  1086. struct iwl4965_card_state_cmd {
  1087. __le32 status; /* CARD_STATE_CMD_* request new power state */
  1088. } __attribute__ ((packed));
  1089. /*
  1090. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  1091. */
  1092. struct iwl4965_card_state_notif {
  1093. __le32 flags;
  1094. } __attribute__ ((packed));
  1095. #define HW_CARD_DISABLED 0x01
  1096. #define SW_CARD_DISABLED 0x02
  1097. #define RF_CARD_DISABLED 0x04
  1098. #define RXON_CARD_DISABLED 0x10
  1099. struct iwl4965_ct_kill_config {
  1100. __le32 reserved;
  1101. __le32 critical_temperature_M;
  1102. __le32 critical_temperature_R;
  1103. } __attribute__ ((packed));
  1104. /******************************************************************************
  1105. * (8)
  1106. * Scan Commands, Responses, Notifications:
  1107. *
  1108. *****************************************************************************/
  1109. struct iwl4965_scan_channel {
  1110. /* type is defined as:
  1111. * 0:0 active (0 - passive)
  1112. * 1:4 SSID direct
  1113. * If 1 is set then corresponding SSID IE is transmitted in probe
  1114. * 5:7 reserved
  1115. */
  1116. u8 type;
  1117. u8 channel;
  1118. struct iwl4965_tx_power tpc;
  1119. __le16 active_dwell;
  1120. __le16 passive_dwell;
  1121. } __attribute__ ((packed));
  1122. struct iwl4965_ssid_ie {
  1123. u8 id;
  1124. u8 len;
  1125. u8 ssid[32];
  1126. } __attribute__ ((packed));
  1127. #define PROBE_OPTION_MAX 0x4
  1128. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  1129. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  1130. #define IWL_MAX_SCAN_SIZE 1024
  1131. /*
  1132. * REPLY_SCAN_CMD = 0x80 (command)
  1133. */
  1134. struct iwl4965_scan_cmd {
  1135. __le16 len;
  1136. u8 reserved0;
  1137. u8 channel_count;
  1138. __le16 quiet_time; /* dwell only this long on quiet chnl
  1139. * (active scan) */
  1140. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1141. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1142. __le16 rx_chain;
  1143. __le32 max_out_time; /* max usec to be out of associated (service)
  1144. * chnl */
  1145. __le32 suspend_time; /* pause scan this long when returning to svc
  1146. * chnl.
  1147. * 3945 -- 31:24 # beacons, 19:0 additional usec,
  1148. * 4965 -- 31:22 # beacons, 21:0 additional usec.
  1149. */
  1150. __le32 flags;
  1151. __le32 filter_flags;
  1152. struct iwl4965_tx_cmd tx_cmd;
  1153. struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1154. u8 data[0];
  1155. /*
  1156. * The channels start after the probe request payload and are of type:
  1157. *
  1158. * struct iwl4965_scan_channel channels[0];
  1159. *
  1160. * NOTE: Only one band of channels can be scanned per pass. You
  1161. * can not mix 2.4GHz channels and 5.2GHz channels and must
  1162. * request a scan multiple times (not concurrently)
  1163. *
  1164. */
  1165. } __attribute__ ((packed));
  1166. /* Can abort will notify by complete notification with abort status. */
  1167. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1168. /* complete notification statuses */
  1169. #define ABORT_STATUS 0x2
  1170. /*
  1171. * REPLY_SCAN_CMD = 0x80 (response)
  1172. */
  1173. struct iwl4965_scanreq_notification {
  1174. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1175. } __attribute__ ((packed));
  1176. /*
  1177. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1178. */
  1179. struct iwl4965_scanstart_notification {
  1180. __le32 tsf_low;
  1181. __le32 tsf_high;
  1182. __le32 beacon_timer;
  1183. u8 channel;
  1184. u8 band;
  1185. u8 reserved[2];
  1186. __le32 status;
  1187. } __attribute__ ((packed));
  1188. #define SCAN_OWNER_STATUS 0x1;
  1189. #define MEASURE_OWNER_STATUS 0x2;
  1190. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1191. /*
  1192. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1193. */
  1194. struct iwl4965_scanresults_notification {
  1195. u8 channel;
  1196. u8 band;
  1197. u8 reserved[2];
  1198. __le32 tsf_low;
  1199. __le32 tsf_high;
  1200. __le32 statistics[NUMBER_OF_STATISTICS];
  1201. } __attribute__ ((packed));
  1202. /*
  1203. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1204. */
  1205. struct iwl4965_scancomplete_notification {
  1206. u8 scanned_channels;
  1207. u8 status;
  1208. u8 reserved;
  1209. u8 last_channel;
  1210. __le32 tsf_low;
  1211. __le32 tsf_high;
  1212. } __attribute__ ((packed));
  1213. /******************************************************************************
  1214. * (9)
  1215. * IBSS/AP Commands and Notifications:
  1216. *
  1217. *****************************************************************************/
  1218. /*
  1219. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1220. */
  1221. struct iwl4965_beacon_notif {
  1222. struct iwl4965_tx_resp beacon_notify_hdr;
  1223. __le32 low_tsf;
  1224. __le32 high_tsf;
  1225. __le32 ibss_mgr_status;
  1226. } __attribute__ ((packed));
  1227. /*
  1228. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1229. */
  1230. struct iwl4965_tx_beacon_cmd {
  1231. struct iwl4965_tx_cmd tx;
  1232. __le16 tim_idx;
  1233. u8 tim_size;
  1234. u8 reserved1;
  1235. struct ieee80211_hdr frame[0]; /* beacon frame */
  1236. } __attribute__ ((packed));
  1237. /******************************************************************************
  1238. * (10)
  1239. * Statistics Commands and Notifications:
  1240. *
  1241. *****************************************************************************/
  1242. #define IWL_TEMP_CONVERT 260
  1243. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1244. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1245. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1246. /* Used for passing to driver number of successes and failures per rate */
  1247. struct rate_histogram {
  1248. union {
  1249. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1250. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1251. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1252. } success;
  1253. union {
  1254. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1255. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1256. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1257. } failed;
  1258. } __attribute__ ((packed));
  1259. /* statistics command response */
  1260. struct statistics_rx_phy {
  1261. __le32 ina_cnt;
  1262. __le32 fina_cnt;
  1263. __le32 plcp_err;
  1264. __le32 crc32_err;
  1265. __le32 overrun_err;
  1266. __le32 early_overrun_err;
  1267. __le32 crc32_good;
  1268. __le32 false_alarm_cnt;
  1269. __le32 fina_sync_err_cnt;
  1270. __le32 sfd_timeout;
  1271. __le32 fina_timeout;
  1272. __le32 unresponded_rts;
  1273. __le32 rxe_frame_limit_overrun;
  1274. __le32 sent_ack_cnt;
  1275. __le32 sent_cts_cnt;
  1276. __le32 sent_ba_rsp_cnt;
  1277. __le32 dsp_self_kill;
  1278. __le32 mh_format_err;
  1279. __le32 re_acq_main_rssi_sum;
  1280. __le32 reserved3;
  1281. } __attribute__ ((packed));
  1282. struct statistics_rx_ht_phy {
  1283. __le32 plcp_err;
  1284. __le32 overrun_err;
  1285. __le32 early_overrun_err;
  1286. __le32 crc32_good;
  1287. __le32 crc32_err;
  1288. __le32 mh_format_err;
  1289. __le32 agg_crc32_good;
  1290. __le32 agg_mpdu_cnt;
  1291. __le32 agg_cnt;
  1292. __le32 reserved2;
  1293. } __attribute__ ((packed));
  1294. struct statistics_rx_non_phy {
  1295. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1296. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1297. __le32 non_bssid_frames; /* number of frames with BSSID that
  1298. * doesn't belong to the STA BSSID */
  1299. __le32 filtered_frames; /* count frames that were dumped in the
  1300. * filtering process */
  1301. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1302. * our serving channel */
  1303. __le32 channel_beacons; /* beacons with our bss id and in our
  1304. * serving channel */
  1305. __le32 num_missed_bcon; /* number of missed beacons */
  1306. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  1307. * ADC was in saturation */
  1308. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  1309. * for INA */
  1310. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  1311. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  1312. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  1313. __le32 interference_data_flag; /* flag for interference data
  1314. * availability. 1 when data is
  1315. * available. */
  1316. __le32 channel_load; /* counts RX Enable time */
  1317. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  1318. * and CCK) counter */
  1319. __le32 beacon_rssi_a;
  1320. __le32 beacon_rssi_b;
  1321. __le32 beacon_rssi_c;
  1322. __le32 beacon_energy_a;
  1323. __le32 beacon_energy_b;
  1324. __le32 beacon_energy_c;
  1325. } __attribute__ ((packed));
  1326. struct statistics_rx {
  1327. struct statistics_rx_phy ofdm;
  1328. struct statistics_rx_phy cck;
  1329. struct statistics_rx_non_phy general;
  1330. struct statistics_rx_ht_phy ofdm_ht;
  1331. } __attribute__ ((packed));
  1332. struct statistics_tx_non_phy_agg {
  1333. __le32 ba_timeout;
  1334. __le32 ba_reschedule_frames;
  1335. __le32 scd_query_agg_frame_cnt;
  1336. __le32 scd_query_no_agg;
  1337. __le32 scd_query_agg;
  1338. __le32 scd_query_mismatch;
  1339. __le32 frame_not_ready;
  1340. __le32 underrun;
  1341. __le32 bt_prio_kill;
  1342. __le32 rx_ba_rsp_cnt;
  1343. __le32 reserved2;
  1344. __le32 reserved3;
  1345. } __attribute__ ((packed));
  1346. struct statistics_tx {
  1347. __le32 preamble_cnt;
  1348. __le32 rx_detected_cnt;
  1349. __le32 bt_prio_defer_cnt;
  1350. __le32 bt_prio_kill_cnt;
  1351. __le32 few_bytes_cnt;
  1352. __le32 cts_timeout;
  1353. __le32 ack_timeout;
  1354. __le32 expected_ack_cnt;
  1355. __le32 actual_ack_cnt;
  1356. __le32 dump_msdu_cnt;
  1357. __le32 burst_abort_next_frame_mismatch_cnt;
  1358. __le32 burst_abort_missing_next_frame_cnt;
  1359. __le32 cts_timeout_collision;
  1360. __le32 ack_or_ba_timeout_collision;
  1361. struct statistics_tx_non_phy_agg agg;
  1362. } __attribute__ ((packed));
  1363. struct statistics_dbg {
  1364. __le32 burst_check;
  1365. __le32 burst_count;
  1366. __le32 reserved[4];
  1367. } __attribute__ ((packed));
  1368. struct statistics_div {
  1369. __le32 tx_on_a;
  1370. __le32 tx_on_b;
  1371. __le32 exec_time;
  1372. __le32 probe_time;
  1373. __le32 reserved1;
  1374. __le32 reserved2;
  1375. } __attribute__ ((packed));
  1376. struct statistics_general {
  1377. __le32 temperature;
  1378. __le32 temperature_m;
  1379. struct statistics_dbg dbg;
  1380. __le32 sleep_time;
  1381. __le32 slots_out;
  1382. __le32 slots_idle;
  1383. __le32 ttl_timestamp;
  1384. struct statistics_div div;
  1385. __le32 rx_enable_counter;
  1386. __le32 reserved1;
  1387. __le32 reserved2;
  1388. __le32 reserved3;
  1389. } __attribute__ ((packed));
  1390. /*
  1391. * REPLY_STATISTICS_CMD = 0x9c,
  1392. * 3945 and 4965 identical.
  1393. *
  1394. * This command triggers an immediate response containing uCode statistics.
  1395. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1396. *
  1397. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1398. * internal copy of the statistics (counters) after issuing the response.
  1399. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1400. *
  1401. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1402. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1403. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1404. */
  1405. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1406. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1407. struct iwl4965_statistics_cmd {
  1408. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1409. } __attribute__ ((packed));
  1410. /*
  1411. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1412. *
  1413. * By default, uCode issues this notification after receiving a beacon
  1414. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1415. * REPLY_STATISTICS_CMD 0x9c, above.
  1416. *
  1417. * Statistics counters continue to increment beacon after beacon, but are
  1418. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1419. * 0x9c with CLEAR_STATS bit set (see above).
  1420. *
  1421. * uCode also issues this notification during scans. uCode clears statistics
  1422. * appropriately so that each notification contains statistics for only the
  1423. * one channel that has just been scanned.
  1424. */
  1425. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1426. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1427. struct iwl4965_notif_statistics {
  1428. __le32 flag;
  1429. struct statistics_rx rx;
  1430. struct statistics_tx tx;
  1431. struct statistics_general general;
  1432. } __attribute__ ((packed));
  1433. /*
  1434. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1435. */
  1436. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1437. * then this notification will be sent. */
  1438. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1439. struct iwl4965_missed_beacon_notif {
  1440. __le32 consequtive_missed_beacons;
  1441. __le32 total_missed_becons;
  1442. __le32 num_expected_beacons;
  1443. __le32 num_recvd_beacons;
  1444. } __attribute__ ((packed));
  1445. /******************************************************************************
  1446. * (11)
  1447. * Rx Calibration Commands:
  1448. *
  1449. * With the uCode used for open source drivers, most Tx calibration (except
  1450. * for Tx Power) and most Rx calibration is done by uCode during the
  1451. * "initialize" phase of uCode boot. Driver must calibrate only:
  1452. *
  1453. * 1) Tx power (depends on temperature), described elsewhere
  1454. * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
  1455. * 3) Receiver sensitivity (to optimize signal detection)
  1456. *
  1457. *****************************************************************************/
  1458. /**
  1459. * SENSITIVITY_CMD = 0xa8 (command, has simple generic response)
  1460. *
  1461. * This command sets up the Rx signal detector for a sensitivity level that
  1462. * is high enough to lock onto all signals within the associated network,
  1463. * but low enough to ignore signals that are below a certain threshold, so as
  1464. * not to have too many "false alarms". False alarms are signals that the
  1465. * Rx DSP tries to lock onto, but then discards after determining that they
  1466. * are noise.
  1467. *
  1468. * The optimum number of false alarms is between 5 and 50 per 200 TUs
  1469. * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
  1470. * time listening, not transmitting). Driver must adjust sensitivity so that
  1471. * the ratio of actual false alarms to actual Rx time falls within this range.
  1472. *
  1473. * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each
  1474. * received beacon. These provide information to the driver to analyze the
  1475. * sensitivity. Don't analyze statistics that come in from scanning, or any
  1476. * other non-associated-network source. Pertinent statistics include:
  1477. *
  1478. * From "general" statistics (struct statistics_rx_non_phy):
  1479. *
  1480. * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
  1481. * Measure of energy of desired signal. Used for establishing a level
  1482. * below which the device does not detect signals.
  1483. *
  1484. * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
  1485. * Measure of background noise in silent period after beacon.
  1486. *
  1487. * channel_load
  1488. * uSecs of actual Rx time during beacon period (varies according to
  1489. * how much time was spent transmitting).
  1490. *
  1491. * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately:
  1492. *
  1493. * false_alarm_cnt
  1494. * Signal locks abandoned early (before phy-level header).
  1495. *
  1496. * plcp_err
  1497. * Signal locks abandoned late (during phy-level header).
  1498. *
  1499. * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
  1500. * beacon to beacon, i.e. each value is an accumulation of all errors
  1501. * before and including the latest beacon. Values will wrap around to 0
  1502. * after counting up to 2^32 - 1. Driver must differentiate vs.
  1503. * previous beacon's values to determine # false alarms in the current
  1504. * beacon period.
  1505. *
  1506. * Total number of false alarms = false_alarms + plcp_errs
  1507. *
  1508. * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd
  1509. * (notice that the start points for OFDM are at or close to settings for
  1510. * maximum sensitivity):
  1511. *
  1512. * START / MIN / MAX
  1513. * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120
  1514. * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210
  1515. * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140
  1516. * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270
  1517. *
  1518. * If actual rate of OFDM false alarms (+ plcp_errors) is too high
  1519. * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
  1520. * by *adding* 1 to all 4 of the table entries above, up to the max for
  1521. * each entry. Conversely, if false alarm rate is too low (less than 5
  1522. * for each 204.8 msecs listening), *subtract* 1 from each entry to
  1523. * increase sensitivity.
  1524. *
  1525. * For CCK sensitivity, keep track of the following:
  1526. *
  1527. * 1). 20-beacon history of maximum background noise, indicated by
  1528. * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
  1529. * 3 receivers. For any given beacon, the "silence reference" is
  1530. * the maximum of last 60 samples (20 beacons * 3 receivers).
  1531. *
  1532. * 2). 10-beacon history of strongest signal level, as indicated
  1533. * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
  1534. * i.e. the strength of the signal through the best receiver at the
  1535. * moment. These measurements are "upside down", with lower values
  1536. * for stronger signals, so max energy will be *minimum* value.
  1537. *
  1538. * Then for any given beacon, the driver must determine the *weakest*
  1539. * of the strongest signals; this is the minimum level that needs to be
  1540. * successfully detected, when using the best receiver at the moment.
  1541. * "Max cck energy" is the maximum (higher value means lower energy!)
  1542. * of the last 10 minima. Once this is determined, driver must add
  1543. * a little margin by adding "6" to it.
  1544. *
  1545. * 3). Number of consecutive beacon periods with too few false alarms.
  1546. * Reset this to 0 at the first beacon period that falls within the
  1547. * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
  1548. *
  1549. * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd
  1550. * (notice that the start points for CCK are at maximum sensitivity):
  1551. *
  1552. * START / MIN / MAX
  1553. * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200
  1554. * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400
  1555. * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100
  1556. *
  1557. * If actual rate of CCK false alarms (+ plcp_errors) is too high
  1558. * (greater than 50 for each 204.8 msecs listening), method for reducing
  1559. * sensitivity is:
  1560. *
  1561. * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
  1562. * up to max 400.
  1563. *
  1564. * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160,
  1565. * sensitivity has been reduced a significant amount; bring it up to
  1566. * a moderate 161. Otherwise, *add* 3, up to max 200.
  1567. *
  1568. * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160,
  1569. * sensitivity has been reduced only a moderate or small amount;
  1570. * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX,
  1571. * down to min 0. Otherwise (if gain has been significantly reduced),
  1572. * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value.
  1573. *
  1574. * b) Save a snapshot of the "silence reference".
  1575. *
  1576. * If actual rate of CCK false alarms (+ plcp_errors) is too low
  1577. * (less than 5 for each 204.8 msecs listening), method for increasing
  1578. * sensitivity is used only if:
  1579. *
  1580. * 1a) Previous beacon did not have too many false alarms
  1581. * 1b) AND difference between previous "silence reference" and current
  1582. * "silence reference" (prev - current) is 2 or more,
  1583. * OR 2) 100 or more consecutive beacon periods have had rate of
  1584. * less than 5 false alarms per 204.8 milliseconds rx time.
  1585. *
  1586. * Method for increasing sensitivity:
  1587. *
  1588. * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX,
  1589. * down to min 125.
  1590. *
  1591. * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
  1592. * down to min 200.
  1593. *
  1594. * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100.
  1595. *
  1596. * If actual rate of CCK false alarms (+ plcp_errors) is within good range
  1597. * (between 5 and 50 for each 204.8 msecs listening):
  1598. *
  1599. * 1) Save a snapshot of the silence reference.
  1600. *
  1601. * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
  1602. * give some extra margin to energy threshold by *subtracting* 8
  1603. * from value in HD_MIN_ENERGY_CCK_DET_INDEX.
  1604. *
  1605. * For all cases (too few, too many, good range), make sure that the CCK
  1606. * detection threshold (energy) is below the energy level for robust
  1607. * detection over the past 10 beacon periods, the "Max cck energy".
  1608. * Lower values mean higher energy; this means making sure that the value
  1609. * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
  1610. *
  1611. * Driver should set the following entries to fixed values:
  1612. *
  1613. * HD_MIN_ENERGY_OFDM_DET_INDEX 100
  1614. * HD_BARKER_CORR_TH_ADD_MIN_INDEX 190
  1615. * HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX 390
  1616. * HD_OFDM_ENERGY_TH_IN_INDEX 62
  1617. */
  1618. /*
  1619. * Table entries in SENSITIVITY_CMD (struct iwl4965_sensitivity_cmd)
  1620. */
  1621. #define HD_TABLE_SIZE (11) /* number of entries */
  1622. #define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */
  1623. #define HD_MIN_ENERGY_OFDM_DET_INDEX (1)
  1624. #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2)
  1625. #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3)
  1626. #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4)
  1627. #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5)
  1628. #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6)
  1629. #define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7)
  1630. #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8)
  1631. #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)
  1632. #define HD_OFDM_ENERGY_TH_IN_INDEX (10)
  1633. /* Control field in struct iwl4965_sensitivity_cmd */
  1634. #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE __constant_cpu_to_le16(0)
  1635. #define SENSITIVITY_CMD_CONTROL_WORK_TABLE __constant_cpu_to_le16(1)
  1636. /**
  1637. * struct iwl4965_sensitivity_cmd
  1638. * @control: (1) updates working table, (0) updates default table
  1639. * @table: energy threshold values, use HD_* as index into table
  1640. *
  1641. * Always use "1" in "control" to update uCode's working table and DSP.
  1642. */
  1643. struct iwl4965_sensitivity_cmd {
  1644. __le16 control; /* always use "1" */
  1645. __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */
  1646. } __attribute__ ((packed));
  1647. /**
  1648. * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response)
  1649. *
  1650. * This command sets the relative gains of 4965's 3 radio receiver chains.
  1651. *
  1652. * After the first association, driver should accumulate signal and noise
  1653. * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20
  1654. * beacons from the associated network (don't collect statistics that come
  1655. * in from scanning, or any other non-network source).
  1656. *
  1657. * DISCONNECTED ANTENNA:
  1658. *
  1659. * Driver should determine which antennas are actually connected, by comparing
  1660. * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
  1661. * following values over 20 beacons, one accumulator for each of the chains
  1662. * a/b/c, from struct statistics_rx_non_phy:
  1663. *
  1664. * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
  1665. *
  1666. * Find the strongest signal from among a/b/c. Compare the other two to the
  1667. * strongest. If any signal is more than 15 dB (times 20, unless you
  1668. * divide the accumulated values by 20) below the strongest, the driver
  1669. * considers that antenna to be disconnected, and should not try to use that
  1670. * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
  1671. * driver should declare the stronger one as connected, and attempt to use it
  1672. * (A and B are the only 2 Tx chains!).
  1673. *
  1674. *
  1675. * RX BALANCE:
  1676. *
  1677. * Driver should balance the 3 receivers (but just the ones that are connected
  1678. * to antennas, see above) for gain, by comparing the average signal levels
  1679. * detected during the silence after each beacon (background noise).
  1680. * Accumulate (add) the following values over 20 beacons, one accumulator for
  1681. * each of the chains a/b/c, from struct statistics_rx_non_phy:
  1682. *
  1683. * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
  1684. *
  1685. * Find the weakest background noise level from among a/b/c. This Rx chain
  1686. * will be the reference, with 0 gain adjustment. Attenuate other channels by
  1687. * finding noise difference:
  1688. *
  1689. * (accum_noise[i] - accum_noise[reference]) / 30
  1690. *
  1691. * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
  1692. * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the
  1693. * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
  1694. * and set bit 2 to indicate "reduce gain". The value for the reference
  1695. * (weakest) chain should be "0".
  1696. *
  1697. * diff_gain_[abc] bit fields:
  1698. * 2: (1) reduce gain, (0) increase gain
  1699. * 1-0: amount of gain, units of 1.5 dB
  1700. */
  1701. /* "Differential Gain" opcode used in REPLY_PHY_CALIBRATION_CMD. */
  1702. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1703. struct iwl4965_calibration_cmd {
  1704. u8 opCode; /* PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
  1705. u8 flags; /* not used */
  1706. __le16 reserved;
  1707. s8 diff_gain_a; /* see above */
  1708. s8 diff_gain_b;
  1709. s8 diff_gain_c;
  1710. u8 reserved1;
  1711. } __attribute__ ((packed));
  1712. /******************************************************************************
  1713. * (12)
  1714. * Miscellaneous Commands:
  1715. *
  1716. *****************************************************************************/
  1717. /*
  1718. * LEDs Command & Response
  1719. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1720. *
  1721. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1722. * this command turns it on or off, or sets up a periodic blinking cycle.
  1723. */
  1724. struct iwl4965_led_cmd {
  1725. __le32 interval; /* "interval" in uSec */
  1726. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1727. u8 off; /* # intervals off while blinking;
  1728. * "0", with >0 "on" value, turns LED on */
  1729. u8 on; /* # intervals on while blinking;
  1730. * "0", regardless of "off", turns LED off */
  1731. u8 reserved;
  1732. } __attribute__ ((packed));
  1733. /******************************************************************************
  1734. * (13)
  1735. * Union of all expected notifications/responses:
  1736. *
  1737. *****************************************************************************/
  1738. struct iwl4965_rx_packet {
  1739. __le32 len;
  1740. struct iwl4965_cmd_header hdr;
  1741. union {
  1742. struct iwl4965_alive_resp alive_frame;
  1743. struct iwl4965_rx_frame rx_frame;
  1744. struct iwl4965_tx_resp tx_resp;
  1745. struct iwl4965_spectrum_notification spectrum_notif;
  1746. struct iwl4965_csa_notification csa_notif;
  1747. struct iwl4965_error_resp err_resp;
  1748. struct iwl4965_card_state_notif card_state_notif;
  1749. struct iwl4965_beacon_notif beacon_status;
  1750. struct iwl4965_add_sta_resp add_sta;
  1751. struct iwl4965_sleep_notification sleep_notif;
  1752. struct iwl4965_spectrum_resp spectrum;
  1753. struct iwl4965_notif_statistics stats;
  1754. struct iwl4965_compressed_ba_resp compressed_ba;
  1755. struct iwl4965_missed_beacon_notif missed_beacon;
  1756. __le32 status;
  1757. u8 raw[0];
  1758. } u;
  1759. } __attribute__ ((packed));
  1760. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame))
  1761. #endif /* __iwl4965_commands_h__ */