iwl-3945-commands.h 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * James P. Ketrenos <ipw2100-admin@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. /*
  64. * Please use this file (iwl-3945-commands.h) only for uCode API definitions.
  65. * Please use iwl-3945-hw.h for hardware-related definitions.
  66. * Please use iwl-3945.h for driver implementation definitions.
  67. */
  68. #ifndef __iwl_3945_commands_h__
  69. #define __iwl_3945_commands_h__
  70. enum {
  71. REPLY_ALIVE = 0x1,
  72. REPLY_ERROR = 0x2,
  73. /* RXON and QOS commands */
  74. REPLY_RXON = 0x10,
  75. REPLY_RXON_ASSOC = 0x11,
  76. REPLY_QOS_PARAM = 0x13,
  77. REPLY_RXON_TIMING = 0x14,
  78. /* Multi-Station support */
  79. REPLY_ADD_STA = 0x18,
  80. REPLY_REMOVE_STA = 0x19, /* not used */
  81. REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
  82. /* RX, TX, LEDs */
  83. REPLY_3945_RX = 0x1b, /* 3945 only */
  84. REPLY_TX = 0x1c,
  85. REPLY_RATE_SCALE = 0x47, /* 3945 only */
  86. REPLY_LEDS_CMD = 0x48,
  87. REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
  88. /* 802.11h related */
  89. RADAR_NOTIFICATION = 0x70, /* not used */
  90. REPLY_QUIET_CMD = 0x71, /* not used */
  91. REPLY_CHANNEL_SWITCH = 0x72,
  92. CHANNEL_SWITCH_NOTIFICATION = 0x73,
  93. REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
  94. SPECTRUM_MEASURE_NOTIFICATION = 0x75,
  95. /* Power Management */
  96. POWER_TABLE_CMD = 0x77,
  97. PM_SLEEP_NOTIFICATION = 0x7A,
  98. PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
  99. /* Scan commands and notifications */
  100. REPLY_SCAN_CMD = 0x80,
  101. REPLY_SCAN_ABORT_CMD = 0x81,
  102. SCAN_START_NOTIFICATION = 0x82,
  103. SCAN_RESULTS_NOTIFICATION = 0x83,
  104. SCAN_COMPLETE_NOTIFICATION = 0x84,
  105. /* IBSS/AP commands */
  106. BEACON_NOTIFICATION = 0x90,
  107. REPLY_TX_BEACON = 0x91,
  108. WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
  109. /* Miscellaneous commands */
  110. QUIET_NOTIFICATION = 0x96, /* not used */
  111. REPLY_TX_PWR_TABLE_CMD = 0x97,
  112. MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
  113. /* BT config command */
  114. REPLY_BT_CONFIG = 0x9b,
  115. /* 4965 Statistics */
  116. REPLY_STATISTICS_CMD = 0x9c,
  117. STATISTICS_NOTIFICATION = 0x9d,
  118. /* RF-KILL commands and notifications */
  119. REPLY_CARD_STATE_CMD = 0xa0,
  120. CARD_STATE_NOTIFICATION = 0xa1,
  121. /* Missed beacons notification */
  122. MISSED_BEACONS_NOTIFICATION = 0xa2,
  123. REPLY_MAX = 0xff
  124. };
  125. /******************************************************************************
  126. * (0)
  127. * Header
  128. *
  129. *****************************************************************************/
  130. #define IWL_CMD_FAILED_MSK 0x40
  131. struct iwl3945_cmd_header {
  132. u8 cmd;
  133. u8 flags;
  134. /* We have 15 LSB to use as we please (MSB indicates
  135. * a frame Rx'd from the HW). We encode the following
  136. * information into the sequence field:
  137. *
  138. * 0:7 index in fifo
  139. * 8:13 fifo selection
  140. * 14:14 bit indicating if this packet references the 'extra'
  141. * storage at the end of the memory queue
  142. * 15:15 (Rx indication)
  143. *
  144. */
  145. __le16 sequence;
  146. /* command data follows immediately */
  147. u8 data[0];
  148. } __attribute__ ((packed));
  149. /******************************************************************************
  150. * (0a)
  151. * Alive and Error Commands & Responses:
  152. *
  153. *****************************************************************************/
  154. #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
  155. #define INITIALIZE_SUBTYPE (9)
  156. /*
  157. * REPLY_ALIVE = 0x1 (response only, not a command)
  158. */
  159. struct iwl3945_alive_resp {
  160. u8 ucode_minor;
  161. u8 ucode_major;
  162. __le16 reserved1;
  163. u8 sw_rev[8];
  164. u8 ver_type;
  165. u8 ver_subtype;
  166. __le16 reserved2;
  167. __le32 log_event_table_ptr;
  168. __le32 error_event_table_ptr;
  169. __le32 timestamp;
  170. __le32 is_valid;
  171. } __attribute__ ((packed));
  172. struct iwl3945_init_alive_resp {
  173. u8 ucode_minor;
  174. u8 ucode_major;
  175. __le16 reserved1;
  176. u8 sw_rev[8];
  177. u8 ver_type;
  178. u8 ver_subtype;
  179. __le16 reserved2;
  180. __le32 log_event_table_ptr;
  181. __le32 error_event_table_ptr;
  182. __le32 timestamp;
  183. __le32 is_valid;
  184. } __attribute__ ((packed));
  185. union tsf {
  186. u8 byte[8];
  187. __le16 word[4];
  188. __le32 dw[2];
  189. };
  190. /*
  191. * REPLY_ERROR = 0x2 (response only, not a command)
  192. */
  193. struct iwl3945_error_resp {
  194. __le32 error_type;
  195. u8 cmd_id;
  196. u8 reserved1;
  197. __le16 bad_cmd_seq_num;
  198. __le16 reserved2;
  199. __le32 error_info;
  200. union tsf timestamp;
  201. } __attribute__ ((packed));
  202. /******************************************************************************
  203. * (1)
  204. * RXON Commands & Responses:
  205. *
  206. *****************************************************************************/
  207. /*
  208. * Rx config defines & structure
  209. */
  210. /* rx_config device types */
  211. enum {
  212. RXON_DEV_TYPE_AP = 1,
  213. RXON_DEV_TYPE_ESS = 3,
  214. RXON_DEV_TYPE_IBSS = 4,
  215. RXON_DEV_TYPE_SNIFFER = 6,
  216. };
  217. /* rx_config flags */
  218. /* band & modulation selection */
  219. #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
  220. #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
  221. /* auto detection enable */
  222. #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
  223. /* TGg protection when tx */
  224. #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
  225. /* cck short slot & preamble */
  226. #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
  227. #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
  228. /* antenna selection */
  229. #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
  230. #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
  231. #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  232. #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  233. /* radar detection enable */
  234. #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
  235. #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
  236. /* rx response to host with 8-byte TSF
  237. * (according to ON_AIR deassertion) */
  238. #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
  239. /* rx_config filter flags */
  240. /* accept all data frames */
  241. #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
  242. /* pass control & management to host */
  243. #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
  244. /* accept multi-cast */
  245. #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
  246. /* don't decrypt uni-cast frames */
  247. #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
  248. /* don't decrypt multi-cast frames */
  249. #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
  250. /* STA is associated */
  251. #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
  252. /* transfer to host non bssid beacons in associated state */
  253. #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
  254. /*
  255. * REPLY_RXON = 0x10 (command, has simple generic response)
  256. */
  257. struct iwl3945_rxon_cmd {
  258. u8 node_addr[6];
  259. __le16 reserved1;
  260. u8 bssid_addr[6];
  261. __le16 reserved2;
  262. u8 wlap_bssid_addr[6];
  263. __le16 reserved3;
  264. u8 dev_type;
  265. u8 air_propagation;
  266. __le16 reserved4;
  267. u8 ofdm_basic_rates;
  268. u8 cck_basic_rates;
  269. __le16 assoc_id;
  270. __le32 flags;
  271. __le32 filter_flags;
  272. __le16 channel;
  273. __le16 reserved5;
  274. } __attribute__ ((packed));
  275. /*
  276. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  277. */
  278. struct iwl3945_rxon_assoc_cmd {
  279. __le32 flags;
  280. __le32 filter_flags;
  281. u8 ofdm_basic_rates;
  282. u8 cck_basic_rates;
  283. __le16 reserved;
  284. } __attribute__ ((packed));
  285. /*
  286. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  287. */
  288. struct iwl3945_rxon_time_cmd {
  289. union tsf timestamp;
  290. __le16 beacon_interval;
  291. __le16 atim_window;
  292. __le32 beacon_init_val;
  293. __le16 listen_interval;
  294. __le16 reserved;
  295. } __attribute__ ((packed));
  296. struct iwl3945_tx_power {
  297. u8 tx_gain; /* gain for analog radio */
  298. u8 dsp_atten; /* gain for DSP */
  299. } __attribute__ ((packed));
  300. struct iwl3945_power_per_rate {
  301. u8 rate; /* plcp */
  302. struct iwl3945_tx_power tpc;
  303. u8 reserved;
  304. } __attribute__ ((packed));
  305. /*
  306. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  307. */
  308. struct iwl3945_channel_switch_cmd {
  309. u8 band;
  310. u8 expect_beacon;
  311. __le16 channel;
  312. __le32 rxon_flags;
  313. __le32 rxon_filter_flags;
  314. __le32 switch_time;
  315. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  316. } __attribute__ ((packed));
  317. /*
  318. * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  319. */
  320. struct iwl3945_csa_notification {
  321. __le16 band;
  322. __le16 channel;
  323. __le32 status; /* 0 - OK, 1 - fail */
  324. } __attribute__ ((packed));
  325. /******************************************************************************
  326. * (2)
  327. * Quality-of-Service (QOS) Commands & Responses:
  328. *
  329. *****************************************************************************/
  330. struct iwl3945_ac_qos {
  331. __le16 cw_min;
  332. __le16 cw_max;
  333. u8 aifsn;
  334. u8 reserved1;
  335. __le16 edca_txop;
  336. } __attribute__ ((packed));
  337. /* QoS flags defines */
  338. #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
  339. #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
  340. #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
  341. /*
  342. * TXFIFO Queue number defines
  343. */
  344. /* number of Access categories (AC) (EDCA), queues 0..3 */
  345. #define AC_NUM 4
  346. /*
  347. * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
  348. */
  349. struct iwl3945_qosparam_cmd {
  350. __le32 qos_flags;
  351. struct iwl3945_ac_qos ac[AC_NUM];
  352. } __attribute__ ((packed));
  353. /******************************************************************************
  354. * (3)
  355. * Add/Modify Stations Commands & Responses:
  356. *
  357. *****************************************************************************/
  358. /*
  359. * Multi station support
  360. */
  361. #define IWL_AP_ID 0
  362. #define IWL_MULTICAST_ID 1
  363. #define IWL_STA_ID 2
  364. #define IWL3945_BROADCAST_ID 24
  365. #define IWL3945_STATION_COUNT 25
  366. #define IWL4965_BROADCAST_ID 31
  367. #define IWL4965_STATION_COUNT 32
  368. #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
  369. #define IWL_INVALID_STATION 255
  370. #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);
  371. #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
  372. #define STA_CONTROL_MODIFY_MSK 0x01
  373. /* key flags __le16*/
  374. #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)
  375. #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)
  376. #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)
  377. #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)
  378. #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)
  379. #define STA_KEY_FLG_KEYID_POS 8
  380. #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
  381. /* modify flags */
  382. #define STA_MODIFY_KEY_MASK 0x01
  383. #define STA_MODIFY_TID_DISABLE_TX 0x02
  384. #define STA_MODIFY_TX_RATE_MSK 0x04
  385. #define STA_MODIFY_ADDBA_TID_MSK 0x08
  386. #define STA_MODIFY_DELBA_TID_MSK 0x10
  387. #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
  388. /*
  389. * Antenna masks:
  390. * bit14:15 01 B inactive, A active
  391. * 10 B active, A inactive
  392. * 11 Both active
  393. */
  394. #define RATE_MCS_ANT_A_POS 14
  395. #define RATE_MCS_ANT_B_POS 15
  396. #define RATE_MCS_ANT_A_MSK 0x4000
  397. #define RATE_MCS_ANT_B_MSK 0x8000
  398. #define RATE_MCS_ANT_AB_MSK 0xc000
  399. struct iwl3945_keyinfo {
  400. __le16 key_flags;
  401. u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
  402. u8 reserved1;
  403. __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
  404. __le16 reserved2;
  405. u8 key[16]; /* 16-byte unicast decryption key */
  406. } __attribute__ ((packed));
  407. struct sta_id_modify {
  408. u8 addr[ETH_ALEN];
  409. __le16 reserved1;
  410. u8 sta_id;
  411. u8 modify_mask;
  412. __le16 reserved2;
  413. } __attribute__ ((packed));
  414. /*
  415. * REPLY_ADD_STA = 0x18 (command)
  416. */
  417. struct iwl3945_addsta_cmd {
  418. u8 mode;
  419. u8 reserved[3];
  420. struct sta_id_modify sta;
  421. struct iwl3945_keyinfo key;
  422. __le32 station_flags;
  423. __le32 station_flags_msk;
  424. __le16 tid_disable_tx;
  425. __le16 rate_n_flags;
  426. u8 add_immediate_ba_tid;
  427. u8 remove_immediate_ba_tid;
  428. __le16 add_immediate_ba_ssn;
  429. } __attribute__ ((packed));
  430. /*
  431. * REPLY_ADD_STA = 0x18 (response)
  432. */
  433. struct iwl3945_add_sta_resp {
  434. u8 status;
  435. } __attribute__ ((packed));
  436. #define ADD_STA_SUCCESS_MSK 0x1
  437. /******************************************************************************
  438. * (4)
  439. * Rx Responses:
  440. *
  441. *****************************************************************************/
  442. struct iwl3945_rx_frame_stats {
  443. u8 phy_count;
  444. u8 id;
  445. u8 rssi;
  446. u8 agc;
  447. __le16 sig_avg;
  448. __le16 noise_diff;
  449. u8 payload[0];
  450. } __attribute__ ((packed));
  451. struct iwl3945_rx_frame_hdr {
  452. __le16 channel;
  453. __le16 phy_flags;
  454. u8 reserved1;
  455. u8 rate;
  456. __le16 len;
  457. u8 payload[0];
  458. } __attribute__ ((packed));
  459. #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
  460. #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
  461. #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
  462. #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
  463. #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
  464. #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
  465. #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
  466. #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
  467. #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
  468. #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
  469. #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
  470. #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
  471. #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
  472. #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
  473. #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
  474. #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
  475. #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
  476. struct iwl3945_rx_frame_end {
  477. __le32 status;
  478. __le64 timestamp;
  479. __le32 beacon_timestamp;
  480. } __attribute__ ((packed));
  481. /*
  482. * REPLY_3945_RX = 0x1b (response only, not a command)
  483. *
  484. * NOTE: DO NOT dereference from casts to this structure
  485. * It is provided only for calculating minimum data set size.
  486. * The actual offsets of the hdr and end are dynamic based on
  487. * stats.phy_count
  488. */
  489. struct iwl3945_rx_frame {
  490. struct iwl3945_rx_frame_stats stats;
  491. struct iwl3945_rx_frame_hdr hdr;
  492. struct iwl3945_rx_frame_end end;
  493. } __attribute__ ((packed));
  494. /* Fixed (non-configurable) rx data from phy */
  495. #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
  496. #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
  497. #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
  498. #define IWL_AGC_DB_POS (7)
  499. struct iwl4965_rx_non_cfg_phy {
  500. __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
  501. __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
  502. u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
  503. u8 pad[0];
  504. } __attribute__ ((packed));
  505. /*
  506. * REPLY_4965_RX = 0xc3 (response only, not a command)
  507. * Used only for legacy (non 11n) frames.
  508. */
  509. #define RX_RES_PHY_CNT 14
  510. struct iwl4965_rx_phy_res {
  511. u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
  512. u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
  513. u8 stat_id; /* configurable DSP phy data set ID */
  514. u8 reserved1;
  515. __le64 timestamp; /* TSF at on air rise */
  516. __le32 beacon_time_stamp; /* beacon at on-air rise */
  517. __le16 phy_flags; /* general phy flags: band, modulation, ... */
  518. __le16 channel; /* channel number */
  519. __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
  520. __le32 reserved2;
  521. __le32 rate_n_flags;
  522. __le16 byte_count; /* frame's byte-count */
  523. __le16 reserved3;
  524. } __attribute__ ((packed));
  525. struct iwl4965_rx_mpdu_res_start {
  526. __le16 byte_count;
  527. __le16 reserved;
  528. } __attribute__ ((packed));
  529. /******************************************************************************
  530. * (5)
  531. * Tx Commands & Responses:
  532. *
  533. *****************************************************************************/
  534. /* Tx flags */
  535. #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
  536. #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
  537. #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
  538. #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
  539. #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
  540. #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
  541. #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
  542. #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
  543. #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
  544. /* ucode ignores BT priority for this frame */
  545. #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
  546. /* ucode overrides sequence control */
  547. #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
  548. /* signal that this frame is non-last MPDU */
  549. #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
  550. /* calculate TSF in outgoing frame */
  551. #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
  552. /* activate TX calibration. */
  553. #define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)
  554. /* signals that 2 bytes pad was inserted
  555. after the MAC header */
  556. #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
  557. /* HCCA-AP - disable duration overwriting. */
  558. #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
  559. /*
  560. * TX command security control
  561. */
  562. #define TX_CMD_SEC_WEP 0x01
  563. #define TX_CMD_SEC_CCM 0x02
  564. #define TX_CMD_SEC_TKIP 0x03
  565. #define TX_CMD_SEC_MSK 0x03
  566. #define TX_CMD_SEC_SHIFT 6
  567. #define TX_CMD_SEC_KEY128 0x08
  568. /*
  569. * TX command Frame life time
  570. */
  571. struct iwl3945_dram_scratch {
  572. u8 try_cnt;
  573. u8 bt_kill_cnt;
  574. __le16 reserved;
  575. } __attribute__ ((packed));
  576. /*
  577. * REPLY_TX = 0x1c (command)
  578. */
  579. struct iwl3945_tx_cmd {
  580. __le16 len;
  581. __le16 next_frame_len;
  582. __le32 tx_flags;
  583. u8 rate;
  584. u8 sta_id;
  585. u8 tid_tspec;
  586. u8 sec_ctl;
  587. u8 key[16];
  588. union {
  589. u8 byte[8];
  590. __le16 word[4];
  591. __le32 dw[2];
  592. } tkip_mic;
  593. __le32 next_frame_info;
  594. union {
  595. __le32 life_time;
  596. __le32 attempt;
  597. } stop_time;
  598. u8 supp_rates[2];
  599. u8 rts_retry_limit; /*byte 50 */
  600. u8 data_retry_limit; /*byte 51 */
  601. union {
  602. __le16 pm_frame_timeout;
  603. __le16 attempt_duration;
  604. } timeout;
  605. __le16 driver_txop;
  606. u8 payload[0];
  607. struct ieee80211_hdr hdr[0];
  608. } __attribute__ ((packed));
  609. /* TX command response is sent after *all* transmission attempts.
  610. *
  611. * NOTES:
  612. *
  613. * TX_STATUS_FAIL_NEXT_FRAG
  614. *
  615. * If the fragment flag in the MAC header for the frame being transmitted
  616. * is set and there is insufficient time to transmit the next frame, the
  617. * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
  618. *
  619. * TX_STATUS_FIFO_UNDERRUN
  620. *
  621. * Indicates the host did not provide bytes to the FIFO fast enough while
  622. * a TX was in progress.
  623. *
  624. * TX_STATUS_FAIL_MGMNT_ABORT
  625. *
  626. * This status is only possible if the ABORT ON MGMT RX parameter was
  627. * set to true with the TX command.
  628. *
  629. * If the MSB of the status parameter is set then an abort sequence is
  630. * required. This sequence consists of the host activating the TX Abort
  631. * control line, and then waiting for the TX Abort command response. This
  632. * indicates that a the device is no longer in a transmit state, and that the
  633. * command FIFO has been cleared. The host must then deactivate the TX Abort
  634. * control line. Receiving is still allowed in this case.
  635. */
  636. enum {
  637. TX_STATUS_SUCCESS = 0x01,
  638. TX_STATUS_DIRECT_DONE = 0x02,
  639. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  640. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  641. TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
  642. TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
  643. TX_STATUS_FAIL_NEXT_FRAG = 0x86,
  644. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  645. TX_STATUS_FAIL_DEST_PS = 0x88,
  646. TX_STATUS_FAIL_ABORTED = 0x89,
  647. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  648. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  649. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  650. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  651. TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
  652. TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
  653. TX_STATUS_FAIL_TX_LOCKED = 0x90,
  654. TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
  655. };
  656. #define TX_PACKET_MODE_REGULAR 0x0000
  657. #define TX_PACKET_MODE_BURST_SEQ 0x0100
  658. #define TX_PACKET_MODE_BURST_FIRST 0x0200
  659. enum {
  660. TX_POWER_PA_NOT_ACTIVE = 0x0,
  661. };
  662. enum {
  663. TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
  664. TX_STATUS_DELAY_MSK = 0x00000040,
  665. TX_STATUS_ABORT_MSK = 0x00000080,
  666. TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
  667. TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
  668. TX_RESERVED = 0x00780000, /* bits 19:22 */
  669. TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
  670. TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
  671. };
  672. /* *******************************
  673. * TX aggregation state
  674. ******************************* */
  675. enum {
  676. AGG_TX_STATE_TRANSMITTED = 0x00,
  677. AGG_TX_STATE_UNDERRUN_MSK = 0x01,
  678. AGG_TX_STATE_BT_PRIO_MSK = 0x02,
  679. AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
  680. AGG_TX_STATE_ABORT_MSK = 0x08,
  681. AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
  682. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
  683. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
  684. AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
  685. AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
  686. AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
  687. AGG_TX_STATE_DUMP_TX_MSK = 0x200,
  688. AGG_TX_STATE_DELAY_TX_MSK = 0x400
  689. };
  690. #define AGG_TX_STATE_LAST_SENT_MSK \
  691. (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
  692. AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
  693. AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
  694. #define AGG_TX_STATE_TRY_CNT_POS 12
  695. #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
  696. #define AGG_TX_STATE_SEQ_NUM_POS 16
  697. #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
  698. /*
  699. * REPLY_TX = 0x1c (response)
  700. */
  701. struct iwl3945_tx_resp {
  702. u8 failure_rts;
  703. u8 failure_frame;
  704. u8 bt_kill_count;
  705. u8 rate;
  706. __le32 wireless_media_time;
  707. __le32 status; /* TX status (for aggregation status of 1st frame) */
  708. } __attribute__ ((packed));
  709. /*
  710. * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  711. */
  712. struct iwl3945_compressed_ba_resp {
  713. __le32 sta_addr_lo32;
  714. __le16 sta_addr_hi16;
  715. __le16 reserved;
  716. u8 sta_id;
  717. u8 tid;
  718. __le16 ba_seq_ctl;
  719. __le32 ba_bitmap0;
  720. __le32 ba_bitmap1;
  721. __le16 scd_flow;
  722. __le16 scd_ssn;
  723. } __attribute__ ((packed));
  724. /*
  725. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  726. */
  727. struct iwl3945_txpowertable_cmd {
  728. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  729. u8 reserved;
  730. __le16 channel;
  731. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  732. } __attribute__ ((packed));
  733. struct iwl3945_rate_scaling_info {
  734. __le16 rate_n_flags;
  735. u8 try_cnt;
  736. u8 next_rate_index;
  737. } __attribute__ ((packed));
  738. /**
  739. * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
  740. *
  741. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  742. *
  743. * NOTE: The table of rates passed to the uCode via the
  744. * RATE_SCALE command sets up the corresponding order of
  745. * rates used for all related commands, including rate
  746. * masks, etc.
  747. *
  748. * For example, if you set 9MB (PLCP 0x0f) as the first
  749. * rate in the rate table, the bit mask for that rate
  750. * when passed through ofdm_basic_rates on the REPLY_RXON
  751. * command would be bit 0 (1<<0)
  752. */
  753. struct iwl3945_rate_scaling_cmd {
  754. u8 table_id;
  755. u8 reserved[3];
  756. struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
  757. } __attribute__ ((packed));
  758. /*
  759. * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  760. */
  761. struct iwl3945_bt_cmd {
  762. u8 flags;
  763. u8 lead_time;
  764. u8 max_kill;
  765. u8 reserved;
  766. __le32 kill_ack_mask;
  767. __le32 kill_cts_mask;
  768. } __attribute__ ((packed));
  769. /******************************************************************************
  770. * (6)
  771. * Spectrum Management (802.11h) Commands, Responses, Notifications:
  772. *
  773. *****************************************************************************/
  774. /*
  775. * Spectrum Management
  776. */
  777. #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
  778. RXON_FILTER_CTL2HOST_MSK | \
  779. RXON_FILTER_ACCEPT_GRP_MSK | \
  780. RXON_FILTER_DIS_DECRYPT_MSK | \
  781. RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
  782. RXON_FILTER_ASSOC_MSK | \
  783. RXON_FILTER_BCON_AWARE_MSK)
  784. struct iwl3945_measure_channel {
  785. __le32 duration; /* measurement duration in extended beacon
  786. * format */
  787. u8 channel; /* channel to measure */
  788. u8 type; /* see enum iwl3945_measure_type */
  789. __le16 reserved;
  790. } __attribute__ ((packed));
  791. /*
  792. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
  793. */
  794. struct iwl3945_spectrum_cmd {
  795. __le16 len; /* number of bytes starting from token */
  796. u8 token; /* token id */
  797. u8 id; /* measurement id -- 0 or 1 */
  798. u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
  799. u8 periodic; /* 1 = periodic */
  800. __le16 path_loss_timeout;
  801. __le32 start_time; /* start time in extended beacon format */
  802. __le32 reserved2;
  803. __le32 flags; /* rxon flags */
  804. __le32 filter_flags; /* rxon filter flags */
  805. __le16 channel_count; /* minimum 1, maximum 10 */
  806. __le16 reserved3;
  807. struct iwl3945_measure_channel channels[10];
  808. } __attribute__ ((packed));
  809. /*
  810. * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
  811. */
  812. struct iwl3945_spectrum_resp {
  813. u8 token;
  814. u8 id; /* id of the prior command replaced, or 0xff */
  815. __le16 status; /* 0 - command will be handled
  816. * 1 - cannot handle (conflicts with another
  817. * measurement) */
  818. } __attribute__ ((packed));
  819. enum iwl3945_measurement_state {
  820. IWL_MEASUREMENT_START = 0,
  821. IWL_MEASUREMENT_STOP = 1,
  822. };
  823. enum iwl3945_measurement_status {
  824. IWL_MEASUREMENT_OK = 0,
  825. IWL_MEASUREMENT_CONCURRENT = 1,
  826. IWL_MEASUREMENT_CSA_CONFLICT = 2,
  827. IWL_MEASUREMENT_TGH_CONFLICT = 3,
  828. /* 4-5 reserved */
  829. IWL_MEASUREMENT_STOPPED = 6,
  830. IWL_MEASUREMENT_TIMEOUT = 7,
  831. IWL_MEASUREMENT_PERIODIC_FAILED = 8,
  832. };
  833. #define NUM_ELEMENTS_IN_HISTOGRAM 8
  834. struct iwl3945_measurement_histogram {
  835. __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
  836. __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
  837. } __attribute__ ((packed));
  838. /* clear channel availability counters */
  839. struct iwl3945_measurement_cca_counters {
  840. __le32 ofdm;
  841. __le32 cck;
  842. } __attribute__ ((packed));
  843. enum iwl3945_measure_type {
  844. IWL_MEASURE_BASIC = (1 << 0),
  845. IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
  846. IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
  847. IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
  848. IWL_MEASURE_FRAME = (1 << 4),
  849. /* bits 5:6 are reserved */
  850. IWL_MEASURE_IDLE = (1 << 7),
  851. };
  852. /*
  853. * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
  854. */
  855. struct iwl3945_spectrum_notification {
  856. u8 id; /* measurement id -- 0 or 1 */
  857. u8 token;
  858. u8 channel_index; /* index in measurement channel list */
  859. u8 state; /* 0 - start, 1 - stop */
  860. __le32 start_time; /* lower 32-bits of TSF */
  861. u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
  862. u8 channel;
  863. u8 type; /* see enum iwl3945_measurement_type */
  864. u8 reserved1;
  865. /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
  866. * valid if applicable for measurement type requested. */
  867. __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
  868. __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
  869. __le32 cca_time; /* channel load time in usecs */
  870. u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
  871. * unidentified */
  872. u8 reserved2[3];
  873. struct iwl3945_measurement_histogram histogram;
  874. __le32 stop_time; /* lower 32-bits of TSF */
  875. __le32 status; /* see iwl3945_measurement_status */
  876. } __attribute__ ((packed));
  877. /******************************************************************************
  878. * (7)
  879. * Power Management Commands, Responses, Notifications:
  880. *
  881. *****************************************************************************/
  882. /**
  883. * struct iwl3945_powertable_cmd - Power Table Command
  884. * @flags: See below:
  885. *
  886. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  887. *
  888. * PM allow:
  889. * bit 0 - '0' Driver not allow power management
  890. * '1' Driver allow PM (use rest of parameters)
  891. * uCode send sleep notifications:
  892. * bit 1 - '0' Don't send sleep notification
  893. * '1' send sleep notification (SEND_PM_NOTIFICATION)
  894. * Sleep over DTIM
  895. * bit 2 - '0' PM have to walk up every DTIM
  896. * '1' PM could sleep over DTIM till listen Interval.
  897. * PCI power managed
  898. * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
  899. * '1' !(PCI_LINK_CTRL & 0x1)
  900. * Force sleep Modes
  901. * bit 31/30- '00' use both mac/xtal sleeps
  902. * '01' force Mac sleep
  903. * '10' force xtal sleep
  904. * '11' Illegal set
  905. *
  906. * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
  907. * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  908. * for every DTIM.
  909. */
  910. #define IWL_POWER_VEC_SIZE 5
  911. #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
  912. #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
  913. #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
  914. struct iwl3945_powertable_cmd {
  915. __le32 flags;
  916. __le32 rx_data_timeout;
  917. __le32 tx_data_timeout;
  918. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  919. } __attribute__((packed));
  920. /*
  921. * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
  922. * 3945 and 4965 identical.
  923. */
  924. struct iwl3945_sleep_notification {
  925. u8 pm_sleep_mode;
  926. u8 pm_wakeup_src;
  927. __le16 reserved;
  928. __le32 sleep_time;
  929. __le32 tsf_low;
  930. __le32 bcon_timer;
  931. } __attribute__ ((packed));
  932. /* Sleep states. 3945 and 4965 identical. */
  933. enum {
  934. IWL_PM_NO_SLEEP = 0,
  935. IWL_PM_SLP_MAC = 1,
  936. IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
  937. IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
  938. IWL_PM_SLP_PHY = 4,
  939. IWL_PM_SLP_REPENT = 5,
  940. IWL_PM_WAKEUP_BY_TIMER = 6,
  941. IWL_PM_WAKEUP_BY_DRIVER = 7,
  942. IWL_PM_WAKEUP_BY_RFKILL = 8,
  943. /* 3 reserved */
  944. IWL_PM_NUM_OF_MODES = 12,
  945. };
  946. /*
  947. * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
  948. */
  949. #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
  950. #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
  951. #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
  952. struct iwl3945_card_state_cmd {
  953. __le32 status; /* CARD_STATE_CMD_* request new power state */
  954. } __attribute__ ((packed));
  955. /*
  956. * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  957. */
  958. struct iwl3945_card_state_notif {
  959. __le32 flags;
  960. } __attribute__ ((packed));
  961. #define HW_CARD_DISABLED 0x01
  962. #define SW_CARD_DISABLED 0x02
  963. #define RF_CARD_DISABLED 0x04
  964. #define RXON_CARD_DISABLED 0x10
  965. struct iwl3945_ct_kill_config {
  966. __le32 reserved;
  967. __le32 critical_temperature_M;
  968. __le32 critical_temperature_R;
  969. } __attribute__ ((packed));
  970. /******************************************************************************
  971. * (8)
  972. * Scan Commands, Responses, Notifications:
  973. *
  974. *****************************************************************************/
  975. struct iwl3945_scan_channel {
  976. /* type is defined as:
  977. * 0:0 active (0 - passive)
  978. * 1:4 SSID direct
  979. * If 1 is set then corresponding SSID IE is transmitted in probe
  980. * 5:7 reserved
  981. */
  982. u8 type;
  983. u8 channel;
  984. struct iwl3945_tx_power tpc;
  985. __le16 active_dwell;
  986. __le16 passive_dwell;
  987. } __attribute__ ((packed));
  988. struct iwl3945_ssid_ie {
  989. u8 id;
  990. u8 len;
  991. u8 ssid[32];
  992. } __attribute__ ((packed));
  993. #define PROBE_OPTION_MAX 0x4
  994. #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
  995. #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
  996. #define IWL_MAX_SCAN_SIZE 1024
  997. /*
  998. * REPLY_SCAN_CMD = 0x80 (command)
  999. */
  1000. struct iwl3945_scan_cmd {
  1001. __le16 len;
  1002. u8 reserved0;
  1003. u8 channel_count;
  1004. __le16 quiet_time; /* dwell only this long on quiet chnl
  1005. * (active scan) */
  1006. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  1007. __le16 good_CRC_th; /* passive -> active promotion threshold */
  1008. __le16 reserved1;
  1009. __le32 max_out_time; /* max usec to be out of associated (service)
  1010. * chnl */
  1011. __le32 suspend_time; /* pause scan this long when returning to svc
  1012. * chnl.
  1013. * 3945 -- 31:24 # beacons, 19:0 additional usec,
  1014. * 4965 -- 31:22 # beacons, 21:0 additional usec.
  1015. */
  1016. __le32 flags;
  1017. __le32 filter_flags;
  1018. struct iwl3945_tx_cmd tx_cmd;
  1019. struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
  1020. u8 data[0];
  1021. /*
  1022. * The channels start after the probe request payload and are of type:
  1023. *
  1024. * struct iwl3945_scan_channel channels[0];
  1025. *
  1026. * NOTE: Only one band of channels can be scanned per pass. You
  1027. * can not mix 2.4GHz channels and 5.2GHz channels and must
  1028. * request a scan multiple times (not concurrently)
  1029. *
  1030. */
  1031. } __attribute__ ((packed));
  1032. /* Can abort will notify by complete notification with abort status. */
  1033. #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
  1034. /* complete notification statuses */
  1035. #define ABORT_STATUS 0x2
  1036. /*
  1037. * REPLY_SCAN_CMD = 0x80 (response)
  1038. */
  1039. struct iwl3945_scanreq_notification {
  1040. __le32 status; /* 1: okay, 2: cannot fulfill request */
  1041. } __attribute__ ((packed));
  1042. /*
  1043. * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
  1044. */
  1045. struct iwl3945_scanstart_notification {
  1046. __le32 tsf_low;
  1047. __le32 tsf_high;
  1048. __le32 beacon_timer;
  1049. u8 channel;
  1050. u8 band;
  1051. u8 reserved[2];
  1052. __le32 status;
  1053. } __attribute__ ((packed));
  1054. #define SCAN_OWNER_STATUS 0x1;
  1055. #define MEASURE_OWNER_STATUS 0x2;
  1056. #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
  1057. /*
  1058. * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
  1059. */
  1060. struct iwl3945_scanresults_notification {
  1061. u8 channel;
  1062. u8 band;
  1063. u8 reserved[2];
  1064. __le32 tsf_low;
  1065. __le32 tsf_high;
  1066. __le32 statistics[NUMBER_OF_STATISTICS];
  1067. } __attribute__ ((packed));
  1068. /*
  1069. * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
  1070. */
  1071. struct iwl3945_scancomplete_notification {
  1072. u8 scanned_channels;
  1073. u8 status;
  1074. u8 reserved;
  1075. u8 last_channel;
  1076. __le32 tsf_low;
  1077. __le32 tsf_high;
  1078. } __attribute__ ((packed));
  1079. /******************************************************************************
  1080. * (9)
  1081. * IBSS/AP Commands and Notifications:
  1082. *
  1083. *****************************************************************************/
  1084. /*
  1085. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  1086. */
  1087. struct iwl3945_beacon_notif {
  1088. struct iwl3945_tx_resp beacon_notify_hdr;
  1089. __le32 low_tsf;
  1090. __le32 high_tsf;
  1091. __le32 ibss_mgr_status;
  1092. } __attribute__ ((packed));
  1093. /*
  1094. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  1095. */
  1096. struct iwl3945_tx_beacon_cmd {
  1097. struct iwl3945_tx_cmd tx;
  1098. __le16 tim_idx;
  1099. u8 tim_size;
  1100. u8 reserved1;
  1101. struct ieee80211_hdr frame[0]; /* beacon frame */
  1102. } __attribute__ ((packed));
  1103. /******************************************************************************
  1104. * (10)
  1105. * Statistics Commands and Notifications:
  1106. *
  1107. *****************************************************************************/
  1108. #define IWL_TEMP_CONVERT 260
  1109. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  1110. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  1111. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  1112. /* Used for passing to driver number of successes and failures per rate */
  1113. struct rate_histogram {
  1114. union {
  1115. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1116. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1117. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1118. } success;
  1119. union {
  1120. __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  1121. __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  1122. __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  1123. } failed;
  1124. } __attribute__ ((packed));
  1125. /* statistics command response */
  1126. struct statistics_rx_phy {
  1127. __le32 ina_cnt;
  1128. __le32 fina_cnt;
  1129. __le32 plcp_err;
  1130. __le32 crc32_err;
  1131. __le32 overrun_err;
  1132. __le32 early_overrun_err;
  1133. __le32 crc32_good;
  1134. __le32 false_alarm_cnt;
  1135. __le32 fina_sync_err_cnt;
  1136. __le32 sfd_timeout;
  1137. __le32 fina_timeout;
  1138. __le32 unresponded_rts;
  1139. __le32 rxe_frame_limit_overrun;
  1140. __le32 sent_ack_cnt;
  1141. __le32 sent_cts_cnt;
  1142. } __attribute__ ((packed));
  1143. struct statistics_rx_non_phy {
  1144. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1145. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1146. __le32 non_bssid_frames; /* number of frames with BSSID that
  1147. * doesn't belong to the STA BSSID */
  1148. __le32 filtered_frames; /* count frames that were dumped in the
  1149. * filtering process */
  1150. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1151. * our serving channel */
  1152. } __attribute__ ((packed));
  1153. struct statistics_rx {
  1154. struct statistics_rx_phy ofdm;
  1155. struct statistics_rx_phy cck;
  1156. struct statistics_rx_non_phy general;
  1157. } __attribute__ ((packed));
  1158. struct statistics_tx {
  1159. __le32 preamble_cnt;
  1160. __le32 rx_detected_cnt;
  1161. __le32 bt_prio_defer_cnt;
  1162. __le32 bt_prio_kill_cnt;
  1163. __le32 few_bytes_cnt;
  1164. __le32 cts_timeout;
  1165. __le32 ack_timeout;
  1166. __le32 expected_ack_cnt;
  1167. __le32 actual_ack_cnt;
  1168. } __attribute__ ((packed));
  1169. struct statistics_dbg {
  1170. __le32 burst_check;
  1171. __le32 burst_count;
  1172. __le32 reserved[4];
  1173. } __attribute__ ((packed));
  1174. struct statistics_div {
  1175. __le32 tx_on_a;
  1176. __le32 tx_on_b;
  1177. __le32 exec_time;
  1178. __le32 probe_time;
  1179. } __attribute__ ((packed));
  1180. struct statistics_general {
  1181. __le32 temperature;
  1182. struct statistics_dbg dbg;
  1183. __le32 sleep_time;
  1184. __le32 slots_out;
  1185. __le32 slots_idle;
  1186. __le32 ttl_timestamp;
  1187. struct statistics_div div;
  1188. } __attribute__ ((packed));
  1189. /*
  1190. * REPLY_STATISTICS_CMD = 0x9c,
  1191. * 3945 and 4965 identical.
  1192. *
  1193. * This command triggers an immediate response containing uCode statistics.
  1194. * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
  1195. *
  1196. * If the CLEAR_STATS configuration flag is set, uCode will clear its
  1197. * internal copy of the statistics (counters) after issuing the response.
  1198. * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
  1199. *
  1200. * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
  1201. * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
  1202. * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
  1203. */
  1204. #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
  1205. #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
  1206. struct iwl3945_statistics_cmd {
  1207. __le32 configuration_flags; /* IWL_STATS_CONF_* */
  1208. } __attribute__ ((packed));
  1209. /*
  1210. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1211. *
  1212. * By default, uCode issues this notification after receiving a beacon
  1213. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1214. * REPLY_STATISTICS_CMD 0x9c, above.
  1215. *
  1216. * Statistics counters continue to increment beacon after beacon, but are
  1217. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1218. * 0x9c with CLEAR_STATS bit set (see above).
  1219. *
  1220. * uCode also issues this notification during scans. uCode clears statistics
  1221. * appropriately so that each notification contains statistics for only the
  1222. * one channel that has just been scanned.
  1223. */
  1224. #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
  1225. #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
  1226. struct iwl3945_notif_statistics {
  1227. __le32 flag;
  1228. struct statistics_rx rx;
  1229. struct statistics_tx tx;
  1230. struct statistics_general general;
  1231. } __attribute__ ((packed));
  1232. /*
  1233. * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
  1234. */
  1235. /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
  1236. * then this notification will be sent. */
  1237. #define CONSECUTIVE_MISSED_BCONS_TH 20
  1238. struct iwl3945_missed_beacon_notif {
  1239. __le32 consequtive_missed_beacons;
  1240. __le32 total_missed_becons;
  1241. __le32 num_expected_beacons;
  1242. __le32 num_recvd_beacons;
  1243. } __attribute__ ((packed));
  1244. /******************************************************************************
  1245. * (11)
  1246. * Rx Calibration Commands:
  1247. *
  1248. *****************************************************************************/
  1249. #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
  1250. #define HD_TABLE_SIZE (11)
  1251. struct iwl3945_sensitivity_cmd {
  1252. __le16 control;
  1253. __le16 table[HD_TABLE_SIZE];
  1254. } __attribute__ ((packed));
  1255. struct iwl3945_calibration_cmd {
  1256. u8 opCode;
  1257. u8 flags;
  1258. __le16 reserved;
  1259. s8 diff_gain_a;
  1260. s8 diff_gain_b;
  1261. s8 diff_gain_c;
  1262. u8 reserved1;
  1263. } __attribute__ ((packed));
  1264. /******************************************************************************
  1265. * (12)
  1266. * Miscellaneous Commands:
  1267. *
  1268. *****************************************************************************/
  1269. /*
  1270. * LEDs Command & Response
  1271. * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
  1272. *
  1273. * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  1274. * this command turns it on or off, or sets up a periodic blinking cycle.
  1275. */
  1276. struct iwl3945_led_cmd {
  1277. __le32 interval; /* "interval" in uSec */
  1278. u8 id; /* 1: Activity, 2: Link, 3: Tech */
  1279. u8 off; /* # intervals off while blinking;
  1280. * "0", with >0 "on" value, turns LED on */
  1281. u8 on; /* # intervals on while blinking;
  1282. * "0", regardless of "off", turns LED off */
  1283. u8 reserved;
  1284. } __attribute__ ((packed));
  1285. /******************************************************************************
  1286. * (13)
  1287. * Union of all expected notifications/responses:
  1288. *
  1289. *****************************************************************************/
  1290. struct iwl3945_rx_packet {
  1291. __le32 len;
  1292. struct iwl3945_cmd_header hdr;
  1293. union {
  1294. struct iwl3945_alive_resp alive_frame;
  1295. struct iwl3945_rx_frame rx_frame;
  1296. struct iwl3945_tx_resp tx_resp;
  1297. struct iwl3945_spectrum_notification spectrum_notif;
  1298. struct iwl3945_csa_notification csa_notif;
  1299. struct iwl3945_error_resp err_resp;
  1300. struct iwl3945_card_state_notif card_state_notif;
  1301. struct iwl3945_beacon_notif beacon_status;
  1302. struct iwl3945_add_sta_resp add_sta;
  1303. struct iwl3945_sleep_notification sleep_notif;
  1304. struct iwl3945_spectrum_resp spectrum;
  1305. struct iwl3945_notif_statistics stats;
  1306. __le32 status;
  1307. u8 raw[0];
  1308. } u;
  1309. } __attribute__ ((packed));
  1310. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
  1311. #endif /* __iwl3945_3945_commands_h__ */