iwmc3200wifi: CT kill support
[pandora-kernel.git] / drivers / net / wireless / iwmc3200wifi / commands.h
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
39 #ifndef __IWM_COMMANDS_H__
40 #define __IWM_COMMANDS_H__
41
42 #include <linux/ieee80211.h>
43
44 #define IWM_BARKER_REBOOT_NOTIFICATION  0xF
45 #define IWM_ACK_BARKER_NOTIFICATION     0x10
46
47 /* UMAC commands */
48 #define UMAC_RST_CTRL_FLG_LARC_CLK_EN   0x0001
49 #define UMAC_RST_CTRL_FLG_LARC_RESET    0x0002
50 #define UMAC_RST_CTRL_FLG_FUNC_RESET    0x0004
51 #define UMAC_RST_CTRL_FLG_DEV_RESET     0x0008
52 #define UMAC_RST_CTRL_FLG_WIFI_CORE_EN  0x0010
53 #define UMAC_RST_CTRL_FLG_WIFI_LINK_EN  0x0040
54 #define UMAC_RST_CTRL_FLG_WIFI_MLME_EN  0x0080
55 #define UMAC_RST_CTRL_FLG_NVM_RELOAD    0x0100
56
57 struct iwm_umac_cmd_reset {
58         __le32 flags;
59 } __attribute__ ((packed));
60
61 #define UMAC_PARAM_TBL_ORD_FIX    0x0
62 #define UMAC_PARAM_TBL_ORD_VAR    0x1
63 #define UMAC_PARAM_TBL_CFG_FIX    0x2
64 #define UMAC_PARAM_TBL_CFG_VAR    0x3
65 #define UMAC_PARAM_TBL_BSS_TRK    0x4
66 #define UMAC_PARAM_TBL_FA_CFG_FIX 0x5
67 #define UMAC_PARAM_TBL_STA        0x6
68 #define UMAC_PARAM_TBL_CHN        0x7
69 #define UMAC_PARAM_TBL_STATISTICS 0x8
70
71 /* fast access table */
72 enum {
73         CFG_FRAG_THRESHOLD = 0,
74         CFG_FRAME_RETRY_LIMIT,
75         CFG_OS_QUEUE_UTIL_TH,
76         CFG_RX_FILTER,
77         /* <-- LAST --> */
78         FAST_ACCESS_CFG_TBL_FIX_LAST
79 };
80
81 /* fixed size table */
82 enum {
83         CFG_POWER_INDEX = 0,
84         CFG_PM_LEGACY_RX_TIMEOUT,
85         CFG_PM_LEGACY_TX_TIMEOUT,
86         CFG_PM_CTRL_FLAGS,
87         CFG_PM_KEEP_ALIVE_IN_BEACONS,
88         CFG_BT_ON_THRESHOLD,
89         CFG_RTS_THRESHOLD,
90         CFG_CTS_TO_SELF,
91         CFG_COEX_MODE,
92         CFG_WIRELESS_MODE,
93         CFG_ASSOCIATION_TIMEOUT,
94         CFG_ROAM_TIMEOUT,
95         CFG_CAPABILITY_SUPPORTED_RATES,
96         CFG_SCAN_ALLOWED_UNASSOC_FLAGS,
97         CFG_SCAN_ALLOWED_MAIN_ASSOC_FLAGS,
98         CFG_SCAN_ALLOWED_PAN_ASSOC_FLAGS,
99         CFG_SCAN_INTERNAL_PERIODIC_ENABLED,
100         CFG_SCAN_IMM_INTERNAL_PERIODIC_SCAN_ON_INIT,
101         CFG_SCAN_DEFAULT_PERIODIC_FREQ_SEC,
102         CFG_SCAN_NUM_PASSIVE_CHAN_PER_PARTIAL_SCAN,
103         CFG_TLC_SUPPORTED_TX_HT_RATES,
104         CFG_TLC_SUPPORTED_TX_RATES,
105         CFG_TLC_VALID_ANTENNA,
106         CFG_TLC_SPATIAL_STREAM_SUPPORTED,
107         CFG_TLC_RETRY_PER_RATE,
108         CFG_TLC_RETRY_PER_HT_RATE,
109         CFG_TLC_FIXED_MCS,
110         CFG_TLC_CONTROL_FLAGS,
111         CFG_TLC_SR_MIN_FAIL,
112         CFG_TLC_SR_MIN_PASS,
113         CFG_TLC_HT_STAY_IN_COL_PASS_THRESH,
114         CFG_TLC_HT_STAY_IN_COL_FAIL_THRESH,
115         CFG_TLC_LEGACY_STAY_IN_COL_PASS_THRESH,
116         CFG_TLC_LEGACY_STAY_IN_COL_FAIL_THRESH,
117         CFG_TLC_HT_FLUSH_STATS_PACKETS,
118         CFG_TLC_LEGACY_FLUSH_STATS_PACKETS,
119         CFG_TLC_LEGACY_FLUSH_STATS_MS,
120         CFG_TLC_HT_FLUSH_STATS_MS,
121         CFG_TLC_STAY_IN_COL_TIME_OUT,
122         CFG_TLC_AGG_SHORT_LIM,
123         CFG_TLC_AGG_LONG_LIM,
124         CFG_TLC_HT_SR_NO_DECREASE,
125         CFG_TLC_LEGACY_SR_NO_DECREASE,
126         CFG_TLC_SR_FORCE_DECREASE,
127         CFG_TLC_SR_ALLOW_INCREASE,
128         CFG_TLC_AGG_SET_LONG,
129         CFG_TLC_AUTO_AGGREGATION,
130         CFG_TLC_AGG_THRESHOLD,
131         CFG_TLC_TID_LOAD_THRESHOLD,
132         CFG_TLC_BLOCK_ACK_TIMEOUT,
133         CFG_TLC_NO_BA_COUNTED_AS_ONE,
134         CFG_TLC_NUM_BA_STREAMS_ALLOWED,
135         CFG_TLC_NUM_BA_STREAMS_PRESENT,
136         CFG_TLC_RENEW_ADDBA_DELAY,
137         CFG_TLC_NUM_OF_MULTISEC_TO_COUN_LOAD,
138         CFG_TLC_IS_STABLE_IN_HT,
139         CFG_RLC_CHAIN_CTRL,
140         CFG_TRK_TABLE_OP_MODE,
141         CFG_TRK_TABLE_RSSI_THRESHOLD,
142         CFG_TX_PWR_TARGET, /* Used By xVT */
143         CFG_TX_PWR_LIMIT_USR,
144         CFG_TX_PWR_LIMIT_BSS, /* 11d limit */
145         CFG_TX_PWR_LIMIT_BSS_CONSTRAINT, /* 11h constraint */
146         CFG_TX_PWR_MODE,
147         CFG_MLME_DBG_NOTIF_BLOCK,
148         CFG_BT_OFF_BECONS_INTERVALS,
149         CFG_BT_FRAG_DURATION,
150
151         /* <-- LAST --> */
152         CFG_TBL_FIX_LAST
153 };
154
155 /* variable size table */
156 enum {
157         CFG_NET_ADDR = 0,
158         CFG_PROFILE,
159         /* <-- LAST --> */
160         CFG_TBL_VAR_LAST
161 };
162
163 struct iwm_umac_cmd_set_param_fix {
164         __le16 tbl;
165         __le16 key;
166         __le32 value;
167 } __attribute__ ((packed));
168
169 struct iwm_umac_cmd_set_param_var {
170         __le16 tbl;
171         __le16 key;
172         __le16 len;
173         __le16 reserved;
174 } __attribute__ ((packed));
175
176 struct iwm_umac_cmd_get_param {
177         __le16 tbl;
178         __le16 key;
179 } __attribute__ ((packed));
180
181 struct iwm_umac_cmd_get_param_resp {
182         __le16 tbl;
183         __le16 key;
184         __le16 len;
185         __le16 reserved;
186 } __attribute__ ((packed));
187
188 struct iwm_umac_cmd_eeprom_proxy_hdr {
189         __le32 type;
190         __le32 offset;
191         __le32 len;
192 } __attribute__ ((packed));
193
194 struct iwm_umac_cmd_eeprom_proxy {
195         struct iwm_umac_cmd_eeprom_proxy_hdr hdr;
196         u8 buf[0];
197 } __attribute__ ((packed));
198
199 #define IWM_UMAC_CMD_EEPROM_TYPE_READ       0x1
200 #define IWM_UMAC_CMD_EEPROM_TYPE_WRITE      0x2
201
202 #define UMAC_CHANNEL_FLAG_VALID         BIT(0)
203 #define UMAC_CHANNEL_FLAG_IBSS          BIT(1)
204 #define UMAC_CHANNEL_FLAG_ACTIVE        BIT(3)
205 #define UMAC_CHANNEL_FLAG_RADAR         BIT(4)
206 #define UMAC_CHANNEL_FLAG_DFS           BIT(7)
207
208 struct iwm_umac_channel_info {
209         u8 band;
210         u8 type;
211         u8 reserved;
212         u8 flags;
213         __le32 channels_mask;
214 } __attribute__ ((packed));
215
216 struct iwm_umac_cmd_get_channel_list {
217         __le16 count;
218         __le16 reserved;
219         struct iwm_umac_channel_info ch[0];
220 } __attribute__ ((packed));
221
222
223 /* UMAC WiFi interface commands */
224
225 /* Coexistence mode */
226 #define COEX_MODE_SA  0x1
227 #define COEX_MODE_XOR 0x2
228 #define COEX_MODE_CM  0x3
229 #define COEX_MODE_MAX 0x4
230
231 /* Wireless mode */
232 #define WIRELESS_MODE_11A  0x1
233 #define WIRELESS_MODE_11G  0x2
234 #define WIRELESS_MODE_11N  0x4
235
236 #define UMAC_PROFILE_EX_IE_REQUIRED     0x1
237 #define UMAC_PROFILE_QOS_ALLOWED        0x2
238
239 /* Scanning */
240 #define UMAC_WIFI_IF_PROBE_OPTION_MAX        10
241
242 #define UMAC_WIFI_IF_SCAN_TYPE_USER          0x0
243 #define UMAC_WIFI_IF_SCAN_TYPE_UMAC_RESERVED 0x1
244 #define UMAC_WIFI_IF_SCAN_TYPE_HOST_PERIODIC 0x2
245 #define UMAC_WIFI_IF_SCAN_TYPE_MAX           0x3
246
247 struct iwm_umac_ssid {
248         u8 ssid_len;
249         u8 ssid[IEEE80211_MAX_SSID_LEN];
250         u8 reserved[3];
251 } __attribute__ ((packed));
252
253 struct iwm_umac_cmd_scan_request {
254         struct iwm_umac_wifi_if hdr;
255         __le32 type; /* UMAC_WIFI_IF_SCAN_TYPE_* */
256         u8 ssid_num;
257         u8 seq_num;
258         u8 timeout; /* In seconds */
259         u8 reserved;
260         struct iwm_umac_ssid ssids[UMAC_WIFI_IF_PROBE_OPTION_MAX];
261 } __attribute__ ((packed));
262
263 #define UMAC_CIPHER_TYPE_NONE           0xFF
264 #define UMAC_CIPHER_TYPE_USE_GROUPCAST  0x00
265 #define UMAC_CIPHER_TYPE_WEP_40         0x01
266 #define UMAC_CIPHER_TYPE_WEP_104        0x02
267 #define UMAC_CIPHER_TYPE_TKIP           0x04
268 #define UMAC_CIPHER_TYPE_CCMP           0x08
269
270 /* Supported authentication types - bitmap */
271 #define UMAC_AUTH_TYPE_OPEN             0x00
272 #define UMAC_AUTH_TYPE_LEGACY_PSK       0x01
273 #define UMAC_AUTH_TYPE_8021X            0x02
274 #define UMAC_AUTH_TYPE_RSNA_PSK         0x04
275
276 /* iwm_umac_security.flag is WPA supported -- bits[0:0] */
277 #define UMAC_SEC_FLG_WPA_ON_POS         0
278 #define UMAC_SEC_FLG_WPA_ON_SEED        1
279 #define UMAC_SEC_FLG_WPA_ON_MSK (UMAC_SEC_FLG_WPA_ON_SEED << \
280                                  UMAC_SEC_FLG_WPA_ON_POS)
281
282 /* iwm_umac_security.flag is WPA2 supported -- bits [1:1] */
283 #define UMAC_SEC_FLG_RSNA_ON_POS        1
284 #define UMAC_SEC_FLG_RSNA_ON_SEED       1
285 #define UMAC_SEC_FLG_RSNA_ON_MSK        (UMAC_SEC_FLG_RSNA_ON_SEED << \
286                                          UMAC_SEC_FLG_RSNA_ON_POS)
287
288 /* iwm_umac_security.flag is WSC mode on -- bits [2:2] */
289 #define UMAC_SEC_FLG_WSC_ON_POS         2
290 #define UMAC_SEC_FLG_WSC_ON_SEED        1
291 #define UMAC_SEC_FLG_WSC_ON_MSK         (UMAC_SEC_FLG_WSC_ON_SEED << \
292                                          UMAC_SEC_FLG_WSC_ON_POS)
293
294
295 /* Legacy profile can use only WEP40 and WEP104 for encryption and
296  * OPEN or PSK for authentication */
297 #define UMAC_SEC_FLG_LEGACY_PROFILE     0
298
299 struct iwm_umac_security {
300         u8 auth_type;
301         u8 ucast_cipher;
302         u8 mcast_cipher;
303         u8 flags;
304 } __attribute__ ((packed));
305
306 struct iwm_umac_ibss {
307         u8 beacon_interval;     /* in millisecond */
308         u8 atim;                /* in millisecond */
309         s8 join_only;
310         u8 band;
311         u8 channel;
312         u8 reserved[3];
313 } __attribute__ ((packed));
314
315 #define UMAC_MODE_BSS   0
316 #define UMAC_MODE_IBSS  1
317
318 #define UMAC_BSSID_MAX  4
319
320 struct iwm_umac_profile {
321         struct iwm_umac_wifi_if hdr;
322         __le32 mode;
323         struct iwm_umac_ssid ssid;
324         u8 bssid[UMAC_BSSID_MAX][ETH_ALEN];
325         struct iwm_umac_security sec;
326         struct iwm_umac_ibss ibss;
327         __le32 channel_2ghz;
328         __le32 channel_5ghz;
329         __le16 flags;
330         u8 wireless_mode;
331         u8 bss_num;
332 } __attribute__ ((packed));
333
334 struct iwm_umac_invalidate_profile {
335         struct iwm_umac_wifi_if hdr;
336         u8 reason;
337         u8 reserved[3];
338 } __attribute__ ((packed));
339
340 /* Encryption key commands */
341 struct iwm_umac_key_wep40 {
342         struct iwm_umac_wifi_if hdr;
343         struct iwm_umac_key_hdr key_hdr;
344         u8 key[WLAN_KEY_LEN_WEP40];
345         u8 static_key;
346         u8 reserved[2];
347 } __attribute__ ((packed));
348
349 struct iwm_umac_key_wep104 {
350         struct iwm_umac_wifi_if hdr;
351         struct iwm_umac_key_hdr key_hdr;
352         u8 key[WLAN_KEY_LEN_WEP104];
353         u8 static_key;
354         u8 reserved[2];
355 } __attribute__ ((packed));
356
357 #define IWM_TKIP_KEY_SIZE 16
358 #define IWM_TKIP_MIC_SIZE 8
359 struct iwm_umac_key_tkip {
360         struct iwm_umac_wifi_if hdr;
361         struct iwm_umac_key_hdr key_hdr;
362         u8 iv_count[6];
363         u8 reserved[2];
364         u8 tkip_key[IWM_TKIP_KEY_SIZE];
365         u8 mic_rx_key[IWM_TKIP_MIC_SIZE];
366         u8 mic_tx_key[IWM_TKIP_MIC_SIZE];
367 } __attribute__ ((packed));
368
369 struct iwm_umac_key_ccmp {
370         struct iwm_umac_wifi_if hdr;
371         struct iwm_umac_key_hdr key_hdr;
372         u8 iv_count[6];
373         u8 reserved[2];
374         u8 key[WLAN_KEY_LEN_CCMP];
375 } __attribute__ ((packed));
376
377 struct iwm_umac_key_remove {
378         struct iwm_umac_wifi_if hdr;
379         struct iwm_umac_key_hdr key_hdr;
380 } __attribute__ ((packed));
381
382 struct iwm_umac_tx_key_id {
383         struct iwm_umac_wifi_if hdr;
384         u8 key_idx;
385         u8 reserved[3];
386 } __attribute__ ((packed));
387
388 struct iwm_umac_cmd_stats_req {
389         __le32 flags;
390 } __attribute__ ((packed));
391
392 /* LMAC commands */
393 int iwm_read_mac(struct iwm_priv *iwm, u8 *mac);
394 int iwm_send_prio_table(struct iwm_priv *iwm);
395 int iwm_send_init_calib_cfg(struct iwm_priv *iwm, u8 calib_requested);
396 int iwm_send_periodic_calib_cfg(struct iwm_priv *iwm, u8 calib_requested);
397 int iwm_send_calib_results(struct iwm_priv *iwm);
398 int iwm_store_rxiq_calib_result(struct iwm_priv *iwm);
399 int iwm_send_ct_kill_cfg(struct iwm_priv *iwm, u8 entry, u8 exit);
400
401 /* UMAC commands */
402 int iwm_send_wifi_if_cmd(struct iwm_priv *iwm, void *payload, u16 payload_size,
403                          bool resp);
404 int iwm_send_umac_reset(struct iwm_priv *iwm, __le32 reset_flags, bool resp);
405 int iwm_umac_set_config_fix(struct iwm_priv *iwm, u16 tbl, u16 key, u32 value);
406 int iwm_umac_set_config_var(struct iwm_priv *iwm, u16 key,
407                             void *payload, u16 payload_size);
408 int iwm_send_umac_config(struct iwm_priv *iwm, __le32 reset_flags);
409 int iwm_send_mlme_profile(struct iwm_priv *iwm);
410 int iwm_invalidate_mlme_profile(struct iwm_priv *iwm);
411 int iwm_send_packet(struct iwm_priv *iwm, struct sk_buff *skb, int pool_id);
412 int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx);
413 int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key);
414 int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags);
415 int iwm_send_umac_channel_list(struct iwm_priv *iwm);
416 int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids,
417                    int ssid_num);
418 int iwm_scan_one_ssid(struct iwm_priv *iwm, u8 *ssid, int ssid_len);
419
420 /* UDMA commands */
421 int iwm_target_reset(struct iwm_priv *iwm);
422 #endif