commands.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /*
  2. * Intel Wireless Multicomm 3200 WiFi driver
  3. *
  4. * Copyright (C) 2009 Intel Corporation. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. * * Neither the name of Intel Corporation nor the names of its
  17. * contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. *
  33. * Intel Corporation <ilw@linux.intel.com>
  34. * Samuel Ortiz <samuel.ortiz@intel.com>
  35. * Zhu Yi <yi.zhu@intel.com>
  36. *
  37. */
  38. #ifndef __IWM_COMMANDS_H__
  39. #define __IWM_COMMANDS_H__
  40. #include <linux/ieee80211.h>
  41. #define IWM_BARKER_REBOOT_NOTIFICATION 0xF
  42. #define IWM_ACK_BARKER_NOTIFICATION 0x10
  43. /* UMAC commands */
  44. #define UMAC_RST_CTRL_FLG_LARC_CLK_EN 0x0001
  45. #define UMAC_RST_CTRL_FLG_LARC_RESET 0x0002
  46. #define UMAC_RST_CTRL_FLG_FUNC_RESET 0x0004
  47. #define UMAC_RST_CTRL_FLG_DEV_RESET 0x0008
  48. #define UMAC_RST_CTRL_FLG_WIFI_CORE_EN 0x0010
  49. #define UMAC_RST_CTRL_FLG_WIFI_LINK_EN 0x0040
  50. #define UMAC_RST_CTRL_FLG_WIFI_MLME_EN 0x0080
  51. #define UMAC_RST_CTRL_FLG_NVM_RELOAD 0x0100
  52. struct iwm_umac_cmd_reset {
  53. __le32 flags;
  54. } __attribute__ ((packed));
  55. #define UMAC_PARAM_TBL_ORD_FIX 0x0
  56. #define UMAC_PARAM_TBL_ORD_VAR 0x1
  57. #define UMAC_PARAM_TBL_CFG_FIX 0x2
  58. #define UMAC_PARAM_TBL_CFG_VAR 0x3
  59. #define UMAC_PARAM_TBL_BSS_TRK 0x4
  60. #define UMAC_PARAM_TBL_FA_CFG_FIX 0x5
  61. #define UMAC_PARAM_TBL_STA 0x6
  62. #define UMAC_PARAM_TBL_CHN 0x7
  63. #define UMAC_PARAM_TBL_STATISTICS 0x8
  64. /* fast access table */
  65. enum {
  66. CFG_FRAG_THRESHOLD = 0,
  67. CFG_FRAME_RETRY_LIMIT,
  68. CFG_OS_QUEUE_UTIL_TH,
  69. CFG_RX_FILTER,
  70. /* <-- LAST --> */
  71. FAST_ACCESS_CFG_TBL_FIX_LAST
  72. };
  73. /* fixed size table */
  74. enum {
  75. CFG_POWER_INDEX = 0,
  76. CFG_PM_LEGACY_RX_TIMEOUT,
  77. CFG_PM_LEGACY_TX_TIMEOUT,
  78. CFG_PM_CTRL_FLAGS,
  79. CFG_PM_KEEP_ALIVE_IN_BEACONS,
  80. CFG_BT_ON_THRESHOLD,
  81. CFG_RTS_THRESHOLD,
  82. CFG_CTS_TO_SELF,
  83. CFG_COEX_MODE,
  84. CFG_WIRELESS_MODE,
  85. CFG_ASSOCIATION_TIMEOUT,
  86. CFG_ROAM_TIMEOUT,
  87. CFG_CAPABILITY_SUPPORTED_RATES,
  88. CFG_SCAN_ALLOWED_UNASSOC_FLAGS,
  89. CFG_SCAN_ALLOWED_MAIN_ASSOC_FLAGS,
  90. CFG_SCAN_ALLOWED_PAN_ASSOC_FLAGS,
  91. CFG_SCAN_INTERNAL_PERIODIC_ENABLED,
  92. CFG_SCAN_IMM_INTERNAL_PERIODIC_SCAN_ON_INIT,
  93. CFG_SCAN_DEFAULT_PERIODIC_FREQ_SEC,
  94. CFG_SCAN_NUM_PASSIVE_CHAN_PER_PARTIAL_SCAN,
  95. CFG_TLC_SUPPORTED_TX_HT_RATES,
  96. CFG_TLC_SUPPORTED_TX_RATES,
  97. CFG_TLC_VALID_ANTENNA,
  98. CFG_TLC_SPATIAL_STREAM_SUPPORTED,
  99. CFG_TLC_RETRY_PER_RATE,
  100. CFG_TLC_RETRY_PER_HT_RATE,
  101. CFG_TLC_FIXED_MCS,
  102. CFG_TLC_CONTROL_FLAGS,
  103. CFG_TLC_SR_MIN_FAIL,
  104. CFG_TLC_SR_MIN_PASS,
  105. CFG_TLC_HT_STAY_IN_COL_PASS_THRESH,
  106. CFG_TLC_HT_STAY_IN_COL_FAIL_THRESH,
  107. CFG_TLC_LEGACY_STAY_IN_COL_PASS_THRESH,
  108. CFG_TLC_LEGACY_STAY_IN_COL_FAIL_THRESH,
  109. CFG_TLC_HT_FLUSH_STATS_PACKETS,
  110. CFG_TLC_LEGACY_FLUSH_STATS_PACKETS,
  111. CFG_TLC_LEGACY_FLUSH_STATS_MS,
  112. CFG_TLC_HT_FLUSH_STATS_MS,
  113. CFG_TLC_STAY_IN_COL_TIME_OUT,
  114. CFG_TLC_AGG_SHORT_LIM,
  115. CFG_TLC_AGG_LONG_LIM,
  116. CFG_TLC_HT_SR_NO_DECREASE,
  117. CFG_TLC_LEGACY_SR_NO_DECREASE,
  118. CFG_TLC_SR_FORCE_DECREASE,
  119. CFG_TLC_SR_ALLOW_INCREASE,
  120. CFG_TLC_AGG_SET_LONG,
  121. CFG_TLC_AUTO_AGGREGATION,
  122. CFG_TLC_AGG_THRESHOLD,
  123. CFG_TLC_TID_LOAD_THRESHOLD,
  124. CFG_TLC_BLOCK_ACK_TIMEOUT,
  125. CFG_TLC_NO_BA_COUNTED_AS_ONE,
  126. CFG_TLC_NUM_BA_STREAMS_ALLOWED,
  127. CFG_TLC_NUM_BA_STREAMS_PRESENT,
  128. CFG_TLC_RENEW_ADDBA_DELAY,
  129. CFG_TLC_NUM_OF_MULTISEC_TO_COUN_LOAD,
  130. CFG_TLC_IS_STABLE_IN_HT,
  131. CFG_RLC_CHAIN_CTRL,
  132. CFG_TRK_TABLE_OP_MODE,
  133. CFG_TRK_TABLE_RSSI_THRESHOLD,
  134. CFG_TX_PWR_TARGET, /* Used By xVT */
  135. CFG_TX_PWR_LIMIT_USR,
  136. CFG_TX_PWR_LIMIT_BSS, /* 11d limit */
  137. CFG_TX_PWR_LIMIT_BSS_CONSTRAINT, /* 11h constraint */
  138. CFG_TX_PWR_MODE,
  139. CFG_MLME_DBG_NOTIF_BLOCK,
  140. CFG_BT_OFF_BECONS_INTERVALS,
  141. CFG_BT_FRAG_DURATION,
  142. /* <-- LAST --> */
  143. CFG_TBL_FIX_LAST
  144. };
  145. /* variable size table */
  146. enum {
  147. CFG_NET_ADDR = 0,
  148. CFG_PROFILE,
  149. /* <-- LAST --> */
  150. CFG_TBL_VAR_LAST
  151. };
  152. struct iwm_umac_cmd_set_param_fix {
  153. __le16 tbl;
  154. __le16 key;
  155. __le32 value;
  156. } __attribute__ ((packed));
  157. struct iwm_umac_cmd_set_param_var {
  158. __le16 tbl;
  159. __le16 key;
  160. __le16 len;
  161. __le16 reserved;
  162. } __attribute__ ((packed));
  163. struct iwm_umac_cmd_get_param {
  164. __le16 tbl;
  165. __le16 key;
  166. } __attribute__ ((packed));
  167. struct iwm_umac_cmd_get_param_resp {
  168. __le16 tbl;
  169. __le16 key;
  170. __le16 len;
  171. __le16 reserved;
  172. } __attribute__ ((packed));
  173. struct iwm_umac_cmd_eeprom_proxy_hdr {
  174. __le32 type;
  175. __le32 offset;
  176. __le32 len;
  177. } __attribute__ ((packed));
  178. struct iwm_umac_cmd_eeprom_proxy {
  179. struct iwm_umac_cmd_eeprom_proxy_hdr hdr;
  180. u8 buf[0];
  181. } __attribute__ ((packed));
  182. #define IWM_UMAC_CMD_EEPROM_TYPE_READ 0x1
  183. #define IWM_UMAC_CMD_EEPROM_TYPE_WRITE 0x2
  184. #define UMAC_CHANNEL_FLAG_VALID BIT(0)
  185. #define UMAC_CHANNEL_FLAG_IBSS BIT(1)
  186. #define UMAC_CHANNEL_FLAG_ACTIVE BIT(3)
  187. #define UMAC_CHANNEL_FLAG_RADAR BIT(4)
  188. #define UMAC_CHANNEL_FLAG_DFS BIT(7)
  189. struct iwm_umac_channel_info {
  190. u8 band;
  191. u8 type;
  192. u8 reserved;
  193. u8 flags;
  194. __le32 channels_mask;
  195. } __attribute__ ((packed));
  196. struct iwm_umac_cmd_get_channel_list {
  197. __le16 count;
  198. __le16 reserved;
  199. struct iwm_umac_channel_info ch[0];
  200. } __attribute__ ((packed));
  201. /* UMAC WiFi interface commands */
  202. /* Coexistence mode */
  203. #define COEX_MODE_SA 0x1
  204. #define COEX_MODE_XOR 0x2
  205. #define COEX_MODE_CM 0x3
  206. #define COEX_MODE_MAX 0x4
  207. /* Wireless mode */
  208. #define WIRELESS_MODE_11A 0x1
  209. #define WIRELESS_MODE_11G 0x2
  210. #define WIRELESS_MODE_11N 0x4
  211. #define UMAC_PROFILE_EX_IE_REQUIRED 0x1
  212. #define UMAC_PROFILE_QOS_ALLOWED 0x2
  213. /* Scanning */
  214. #define UMAC_WIFI_IF_PROBE_OPTION_MAX 10
  215. #define UMAC_WIFI_IF_SCAN_TYPE_USER 0x0
  216. #define UMAC_WIFI_IF_SCAN_TYPE_UMAC_RESERVED 0x1
  217. #define UMAC_WIFI_IF_SCAN_TYPE_HOST_PERIODIC 0x2
  218. #define UMAC_WIFI_IF_SCAN_TYPE_MAX 0x3
  219. struct iwm_umac_ssid {
  220. u8 ssid_len;
  221. u8 ssid[IEEE80211_MAX_SSID_LEN];
  222. u8 reserved[3];
  223. } __attribute__ ((packed));
  224. struct iwm_umac_cmd_scan_request {
  225. struct iwm_umac_wifi_if hdr;
  226. __le32 type; /* UMAC_WIFI_IF_SCAN_TYPE_* */
  227. u8 ssid_num;
  228. u8 seq_num;
  229. u8 timeout; /* In seconds */
  230. u8 reserved;
  231. struct iwm_umac_ssid ssids[UMAC_WIFI_IF_PROBE_OPTION_MAX];
  232. } __attribute__ ((packed));
  233. #define UMAC_CIPHER_TYPE_NONE 0xFF
  234. #define UMAC_CIPHER_TYPE_USE_GROUPCAST 0x00
  235. #define UMAC_CIPHER_TYPE_WEP_40 0x01
  236. #define UMAC_CIPHER_TYPE_WEP_104 0x02
  237. #define UMAC_CIPHER_TYPE_TKIP 0x04
  238. #define UMAC_CIPHER_TYPE_CCMP 0x08
  239. /* Supported authentication types - bitmap */
  240. #define UMAC_AUTH_TYPE_OPEN 0x00
  241. #define UMAC_AUTH_TYPE_LEGACY_PSK 0x01
  242. #define UMAC_AUTH_TYPE_8021X 0x02
  243. #define UMAC_AUTH_TYPE_RSNA_PSK 0x04
  244. /* iwm_umac_security.flag is WPA supported -- bits[0:0] */
  245. #define UMAC_SEC_FLG_WPA_ON_POS 0
  246. #define UMAC_SEC_FLG_WPA_ON_SEED 1
  247. #define UMAC_SEC_FLG_WPA_ON_MSK (UMAC_SEC_FLG_WPA_ON_SEED << \
  248. UMAC_SEC_FLG_WPA_ON_POS)
  249. /* iwm_umac_security.flag is WPA2 supported -- bits [1:1] */
  250. #define UMAC_SEC_FLG_RSNA_ON_POS 1
  251. #define UMAC_SEC_FLG_RSNA_ON_SEED 1
  252. #define UMAC_SEC_FLG_RSNA_ON_MSK (UMAC_SEC_FLG_RSNA_ON_SEED << \
  253. UMAC_SEC_FLG_RSNA_ON_POS)
  254. /* iwm_umac_security.flag is WSC mode on -- bits [2:2] */
  255. #define UMAC_SEC_FLG_WSC_ON_POS 2
  256. #define UMAC_SEC_FLG_WSC_ON_SEED 1
  257. /* Legacy profile can use only WEP40 and WEP104 for encryption and
  258. * OPEN or PSK for authentication */
  259. #define UMAC_SEC_FLG_LEGACY_PROFILE 0
  260. struct iwm_umac_security {
  261. u8 auth_type;
  262. u8 ucast_cipher;
  263. u8 mcast_cipher;
  264. u8 flags;
  265. } __attribute__ ((packed));
  266. struct iwm_umac_ibss {
  267. u8 beacon_interval; /* in millisecond */
  268. u8 atim; /* in millisecond */
  269. s8 join_only;
  270. u8 band;
  271. u8 channel;
  272. u8 reserved[3];
  273. } __attribute__ ((packed));
  274. #define UMAC_MODE_BSS 0
  275. #define UMAC_MODE_IBSS 1
  276. #define UMAC_BSSID_MAX 4
  277. struct iwm_umac_profile {
  278. struct iwm_umac_wifi_if hdr;
  279. __le32 mode;
  280. struct iwm_umac_ssid ssid;
  281. u8 bssid[UMAC_BSSID_MAX][ETH_ALEN];
  282. struct iwm_umac_security sec;
  283. struct iwm_umac_ibss ibss;
  284. __le32 channel_2ghz;
  285. __le32 channel_5ghz;
  286. __le16 flags;
  287. u8 wireless_mode;
  288. u8 bss_num;
  289. } __attribute__ ((packed));
  290. struct iwm_umac_invalidate_profile {
  291. struct iwm_umac_wifi_if hdr;
  292. u8 reason;
  293. u8 reserved[3];
  294. } __attribute__ ((packed));
  295. /* Encryption key commands */
  296. struct iwm_umac_key_wep40 {
  297. struct iwm_umac_wifi_if hdr;
  298. struct iwm_umac_key_hdr key_hdr;
  299. u8 key[WLAN_KEY_LEN_WEP40];
  300. u8 static_key;
  301. u8 reserved[2];
  302. } __attribute__ ((packed));
  303. struct iwm_umac_key_wep104 {
  304. struct iwm_umac_wifi_if hdr;
  305. struct iwm_umac_key_hdr key_hdr;
  306. u8 key[WLAN_KEY_LEN_WEP104];
  307. u8 static_key;
  308. u8 reserved[2];
  309. } __attribute__ ((packed));
  310. #define IWM_TKIP_KEY_SIZE 16
  311. #define IWM_TKIP_MIC_SIZE 8
  312. struct iwm_umac_key_tkip {
  313. struct iwm_umac_wifi_if hdr;
  314. struct iwm_umac_key_hdr key_hdr;
  315. u8 iv_count[6];
  316. u8 reserved[2];
  317. u8 tkip_key[IWM_TKIP_KEY_SIZE];
  318. u8 mic_rx_key[IWM_TKIP_MIC_SIZE];
  319. u8 mic_tx_key[IWM_TKIP_MIC_SIZE];
  320. } __attribute__ ((packed));
  321. struct iwm_umac_key_ccmp {
  322. struct iwm_umac_wifi_if hdr;
  323. struct iwm_umac_key_hdr key_hdr;
  324. u8 iv_count[6];
  325. u8 reserved[2];
  326. u8 key[WLAN_KEY_LEN_CCMP];
  327. } __attribute__ ((packed));
  328. struct iwm_umac_key_remove {
  329. struct iwm_umac_wifi_if hdr;
  330. struct iwm_umac_key_hdr key_hdr;
  331. } __attribute__ ((packed));
  332. struct iwm_umac_tx_key_id {
  333. struct iwm_umac_wifi_if hdr;
  334. u8 key_idx;
  335. u8 reserved[3];
  336. } __attribute__ ((packed));
  337. struct iwm_umac_cmd_stats_req {
  338. __le32 flags;
  339. } __attribute__ ((packed));
  340. /* LMAC commands */
  341. int iwm_read_mac(struct iwm_priv *iwm, u8 *mac);
  342. int iwm_send_prio_table(struct iwm_priv *iwm);
  343. int iwm_send_init_calib_cfg(struct iwm_priv *iwm, u8 calib_requested);
  344. int iwm_send_periodic_calib_cfg(struct iwm_priv *iwm, u8 calib_requested);
  345. int iwm_send_calib_results(struct iwm_priv *iwm);
  346. int iwm_store_rxiq_calib_result(struct iwm_priv *iwm);
  347. /* UMAC commands */
  348. int iwm_send_wifi_if_cmd(struct iwm_priv *iwm, void *payload, u16 payload_size,
  349. bool resp);
  350. int iwm_send_umac_reset(struct iwm_priv *iwm, __le32 reset_flags, bool resp);
  351. int iwm_umac_set_config_fix(struct iwm_priv *iwm, u16 tbl, u16 key, u32 value);
  352. int iwm_umac_set_config_var(struct iwm_priv *iwm, u16 key,
  353. void *payload, u16 payload_size);
  354. int iwm_send_umac_config(struct iwm_priv *iwm, __le32 reset_flags);
  355. int iwm_send_mlme_profile(struct iwm_priv *iwm);
  356. int iwm_invalidate_mlme_profile(struct iwm_priv *iwm);
  357. int iwm_send_packet(struct iwm_priv *iwm, struct sk_buff *skb, int pool_id);
  358. int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx);
  359. int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key);
  360. int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags);
  361. int iwm_send_umac_channel_list(struct iwm_priv *iwm);
  362. int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids,
  363. int ssid_num);
  364. int iwm_scan_one_ssid(struct iwm_priv *iwm, u8 *ssid, int ssid_len);
  365. /* UDMA commands */
  366. int iwm_target_reset(struct iwm_priv *iwm);
  367. #endif