blob: 8e4d11ec0c55fd7cda5b90a1751a48031d7abb41 [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
Shahar Levi00d20102010-11-08 11:20:10 +000025#ifndef __CMD_H__
26#define __CMD_H__
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027
Shahar Levi00d20102010-11-08 11:20:10 +000028#include "wl12xx.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030029
30struct acx_header;
31
Juuso Oikarinenfa867e72009-11-02 20:22:13 +020032int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
33 size_t res_len);
Luciano Coelho98b5dd52009-11-23 23:22:17 +020034int wl1271_cmd_general_parms(struct wl1271 *wl);
Shahar Levi49d750ca2011-03-06 16:32:09 +020035int wl128x_cmd_general_parms(struct wl1271 *wl);
Luciano Coelho98b5dd52009-11-23 23:22:17 +020036int wl1271_cmd_radio_parms(struct wl1271 *wl);
Shahar Levi49d750ca2011-03-06 16:32:09 +020037int wl128x_cmd_radio_parms(struct wl1271 *wl);
Juuso Oikarinen644a4862010-10-05 13:11:56 +020038int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
Eliad Pellerc690ec82011-08-14 13:17:07 +030039int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 role_type, u8 *role_id);
40int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
41int wl12xx_cmd_role_start_dev(struct wl1271 *wl);
42int wl12xx_cmd_role_stop_dev(struct wl1271 *wl);
43int wl12xx_cmd_role_start_sta(struct wl1271 *wl);
44int wl12xx_cmd_role_stop_sta(struct wl1271 *wl);
45int wl12xx_cmd_role_start_ap(struct wl1271 *wl);
46int wl12xx_cmd_role_stop_ap(struct wl1271 *wl);
Eliad Peller31cd3ae2011-08-14 13:17:25 +030047int wl12xx_cmd_role_start_ibss(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030048int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
49int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
50int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
Luciano Coelho94210892009-12-11 15:40:55 +020051int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
Eliad Pellerc8bde242011-02-02 09:59:35 +020052int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode);
Juuso Oikarinen65cddbf2010-08-24 06:28:03 +030053int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
54 size_t len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030055int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030056 void *buf, size_t buf_len, int index, u32 rates);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030057int wl1271_cmd_build_null_data(struct wl1271 *wl);
58int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid);
Kalle Valo818e3062010-03-18 12:26:35 +020059int wl1271_cmd_build_probe_req(struct wl1271 *wl,
60 const u8 *ssid, size_t ssid_len,
61 const u8 *ie, size_t ie_len, u8 band);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020062struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
63 struct sk_buff *skb);
Eliad Pellerc5312772010-12-09 11:31:27 +020064int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr);
Kalle Valo023e0822010-03-18 12:26:36 +020065int wl1271_build_qos_null_data(struct wl1271 *wl);
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020066int wl1271_cmd_build_klv_null_data(struct wl1271 *wl);
Eliad Pellerc690ec82011-08-14 13:17:07 +030067int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020068int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
69 u8 key_size, const u8 *key, const u8 *addr,
70 u32 tx_seq_32, u16 tx_seq_16);
71int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
72 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
73 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030074int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller251c1772011-08-14 13:17:17 +030075int wl12xx_roc(struct wl1271 *wl, u8 role_id);
76int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030077int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
78int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030079int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
80int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
81int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030082
83enum wl1271_commands {
84 CMD_INTERROGATE = 1, /*use this to read information elements*/
85 CMD_CONFIGURE = 2, /*use this to write information elements*/
86 CMD_ENABLE_RX = 3,
87 CMD_ENABLE_TX = 4,
88 CMD_DISABLE_RX = 5,
89 CMD_DISABLE_TX = 6,
90 CMD_SCAN = 8,
91 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030092 CMD_SET_KEYS = 12,
93 CMD_READ_MEMORY = 13,
94 CMD_WRITE_MEMORY = 14,
95 CMD_SET_TEMPLATE = 19,
96 CMD_TEST = 23,
97 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +030098 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030099 CMD_SET_BCN_MODE = 33,
100 CMD_MEASUREMENT = 34,
101 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300102 CMD_SET_PS_MODE = 37,
103 CMD_CHANNEL_SWITCH = 38,
104 CMD_STOP_CHANNEL_SWICTH = 39,
105 CMD_AP_DISCOVERY = 40,
106 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300107 CMD_HEALTH_CHECK = 45,
108 CMD_DEBUG = 46,
109 CMD_TRIGGER_SCAN_TO = 47,
110 CMD_CONNECTION_SCAN_CFG = 48,
111 CMD_CONNECTION_SCAN_SSID_CFG = 49,
112 CMD_START_PERIODIC_SCAN = 50,
113 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300114 CMD_SET_PEER_STATE = 52,
115 CMD_REMAIN_ON_CHANNEL = 53,
116 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300117
Eliad Pellerc690ec82011-08-14 13:17:07 +0300118 CMD_CONFIG_FWLOGGER = 55,
119 CMD_START_FWLOGGER = 56,
120 CMD_STOP_FWLOGGER = 57,
121
122 /* AP commands */
123 CMD_ADD_PEER = 62,
124 CMD_REMOVE_PEER = 63,
125
126 /* Role API */
127 CMD_ROLE_ENABLE = 70,
128 CMD_ROLE_DISABLE = 71,
129 CMD_ROLE_START = 72,
130 CMD_ROLE_STOP = 73,
131
132 /* WIFI Direct */
133 CMD_WFD_START_DISCOVERY = 80,
134 CMD_WFD_STOP_DISCOVERY = 81,
135 CMD_WFD_ATTRIBUTE_CONFIG = 82,
136
137 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200138
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300139 NUM_COMMANDS,
140 MAX_COMMAND_ID = 0xFFFF,
141};
142
143#define MAX_CMD_PARAMS 572
144
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200145enum {
146 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
147 CMD_TEMPL_KLV_IDX_MAX = 4
148};
149
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300150enum cmd_templ {
151 CMD_TEMPL_NULL_DATA = 0,
152 CMD_TEMPL_BEACON,
153 CMD_TEMPL_CFG_PROBE_REQ_2_4,
154 CMD_TEMPL_CFG_PROBE_REQ_5,
155 CMD_TEMPL_PROBE_RESPONSE,
156 CMD_TEMPL_QOS_NULL_DATA,
157 CMD_TEMPL_PS_POLL,
158 CMD_TEMPL_KLV,
159 CMD_TEMPL_DISCONNECT,
160 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
161 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
162 CMD_TEMPL_BAR, /* for firmware internal use only */
163 CMD_TEMPL_CTS, /*
164 * For CTS-to-self (FastCTS) mechanism
165 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300166 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200167 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300168 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200169 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300170 CMD_TEMPL_TEMPORARY,
171 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200172
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300173 CMD_TEMPL_MAX = 0xff
174};
175
176/* unit ms */
177#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300178#define WL1271_CMD_TEMPL_DFLT_SIZE 252
179#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300180#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300181
182struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300183 __le16 id;
184 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300185 /* payload */
186 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000187} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300188
189#define WL1271_CMD_MAX_PARAMS 572
190
191struct wl1271_command {
192 struct wl1271_cmd_header header;
193 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000194} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300195
196enum {
197 CMD_MAILBOX_IDLE = 0,
198 CMD_STATUS_SUCCESS = 1,
199 CMD_STATUS_UNKNOWN_CMD = 2,
200 CMD_STATUS_UNKNOWN_IE = 3,
201 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
202 CMD_STATUS_RX_BUSY = 13,
203 CMD_STATUS_INVALID_PARAM = 14,
204 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
205 CMD_STATUS_OUT_OF_MEMORY = 16,
206 CMD_STATUS_STA_TABLE_FULL = 17,
207 CMD_STATUS_RADIO_ERROR = 18,
208 CMD_STATUS_WRONG_NESTING = 19,
209 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
210 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300211 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300212 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300213 MAX_COMMAND_STATUS = 0xff
214};
215
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300216#define CMDMBOX_HEADER_LEN 4
217#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
218
219enum {
220 BSS_TYPE_IBSS = 0,
221 BSS_TYPE_STA_BSS = 2,
222 BSS_TYPE_AP_BSS = 3,
223 MAX_BSS_TYPE = 0xFF
224};
225
226#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
227#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300228#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300229
Eliad Pellerc690ec82011-08-14 13:17:07 +0300230struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300231 struct wl1271_cmd_header header;
232
Eliad Pellerc690ec82011-08-14 13:17:07 +0300233 u8 role_id;
234 u8 role_type;
235 u8 mac_address[ETH_ALEN];
236} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300237
Eliad Pellerc690ec82011-08-14 13:17:07 +0300238struct wl12xx_cmd_role_disable {
239 struct wl1271_cmd_header header;
240
241 u8 role_id;
242 u8 padding[3];
243} __packed;
244
245enum wl12xx_band {
246 WL12XX_BAND_2_4GHZ = 0,
247 WL12XX_BAND_5GHZ = 1,
248 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
249 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
250 WL12XX_BAND_INVALID = 0x7E,
251 WL12XX_BAND_MAX_RADIO = 0x7F,
252};
253
254struct wl12xx_cmd_role_start {
255 struct wl1271_cmd_header header;
256
257 u8 role_id;
258 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300259 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300260 u8 padding;
261
262 union {
263 struct {
264 u8 hlid;
265 u8 session;
266 u8 padding_1[54];
267 } __packed device;
268 /* sta & p2p_cli use the same struct */
269 struct {
270 u8 bssid[ETH_ALEN];
271 u8 hlid; /* data hlid */
272 u8 session;
273 __le32 remote_rates; /* remote supported rates */
274
275 /*
276 * The target uses this field to determine the rate at
277 * which to transmit control frame responses (such as
278 * ACK or CTS frames).
279 */
280 __le32 basic_rate_set;
281 __le32 local_rates; /* local supported rates */
282
283 u8 ssid_type;
284 u8 ssid_len;
285 u8 ssid[IEEE80211_MAX_SSID_LEN];
286
287 __le16 beacon_interval; /* in TBTTs */
288 } __packed sta;
289 struct {
290 u8 bssid[ETH_ALEN];
291 u8 hlid; /* data hlid */
292 u8 dtim_interval;
293 __le32 remote_rates; /* remote supported rates */
294
295 __le32 basic_rate_set;
296 __le32 local_rates; /* local supported rates */
297
298 u8 ssid_type;
299 u8 ssid_len;
300 u8 ssid[IEEE80211_MAX_SSID_LEN];
301
302 __le16 beacon_interval; /* in TBTTs */
303
304 u8 padding_1[4];
305 } __packed ibss;
306 /* ap & p2p_go use the same struct */
307 struct {
308 __le16 aging_period; /* in secs */
309 u8 beacon_expiry; /* in ms */
310 u8 bss_index;
311 /* The host link id for the AP's global queue */
312 u8 global_hlid;
313 /* The host link id for the AP's broadcast queue */
314 u8 broadcast_hlid;
315
316 __le16 beacon_interval; /* in TBTTs */
317
318 __le32 basic_rate_set;
319 __le32 local_rates; /* local supported rates */
320
321 u8 dtim_interval;
322
323 u8 ssid_type;
324 u8 ssid_len;
325 u8 ssid[IEEE80211_MAX_SSID_LEN];
326
327 u8 padding_1[5];
328 } __packed ap;
329 };
330} __packed;
331
332struct wl12xx_cmd_role_stop {
333 struct wl1271_cmd_header header;
334
335 u8 role_id;
336 u8 disc_type; /* only STA and P2P_CLI */
337 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000338} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300339
340struct cmd_enabledisable_path {
341 struct wl1271_cmd_header header;
342
343 u8 channel;
344 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000345} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300346
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300347#define WL1271_RATE_AUTOMATIC 0
348
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300349struct wl1271_cmd_template_set {
350 struct wl1271_cmd_header header;
351
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300352 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300353 u8 template_type;
354 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300355 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300356 u8 short_retry_limit;
357 u8 long_retry_limit;
358 u8 aflags;
359 u8 reserved;
360 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000361} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300362
363#define TIM_ELE_ID 5
364#define PARTIAL_VBM_MAX 251
365
366struct wl1271_tim {
367 u8 identity;
368 u8 length;
369 u8 dtim_count;
370 u8 dtim_period;
371 u8 bitmap_ctrl;
372 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000373} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300374
375enum wl1271_cmd_ps_mode {
376 STATION_ACTIVE_MODE,
377 STATION_POWER_SAVE_MODE
378};
379
380struct wl1271_cmd_ps_params {
381 struct wl1271_cmd_header header;
382
Eliad Pellerc690ec82011-08-14 13:17:07 +0300383 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300384 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300385 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000386} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300387
388/* HW encryption keys */
389#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300390
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300391enum wl1271_cmd_key_action {
392 KEY_ADD_OR_REPLACE = 1,
393 KEY_REMOVE = 2,
394 KEY_SET_ID = 3,
395 MAX_KEY_ACTION = 0xffff,
396};
397
Eliad Pellerc690ec82011-08-14 13:17:07 +0300398enum wl1271_cmd_lid_key_type {
399 UNICAST_LID_TYPE = 0,
400 BROADCAST_LID_TYPE = 1,
401 WEP_DEFAULT_LID_TYPE = 2
402};
403
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300404enum wl1271_cmd_key_type {
405 KEY_NONE = 0,
406 KEY_WEP = 1,
407 KEY_TKIP = 2,
408 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200409 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300410};
411
Eliad Pellerc690ec82011-08-14 13:17:07 +0300412struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200413 struct wl1271_cmd_header header;
414
415 /*
416 * Indicates whether the HLID is a unicast key set
417 * or broadcast key set. A special value 0xFF is
418 * used to indicate that the HLID is on WEP-default
419 * (multi-hlids). of type wl1271_cmd_lid_key_type.
420 */
421 u8 hlid;
422
423 /*
424 * In WEP-default network (hlid == 0xFF) used to
425 * indicate which network STA/IBSS/AP role should be
426 * changed
427 */
428 u8 lid_key_type;
429
430 /*
431 * Key ID - For TKIP and AES key types, this field
432 * indicates the value that should be inserted into
433 * the KeyID field of frames transmitted using this
434 * key entry. For broadcast keys the index use as a
435 * marker for TX/RX key.
436 * For WEP default network (HLID=0xFF), this field
437 * indicates the ID of the key to add or remove.
438 */
439 u8 key_id;
440 u8 reserved_1;
441
442 /* key_action_e */
443 __le16 key_action;
444
445 /* key size in bytes */
446 u8 key_size;
447
448 /* key_type_e */
449 u8 key_type;
450
451 /* This field holds the security key data to add to the STA table */
452 u8 key[MAX_KEY_SIZE];
453 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
454 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
455} __packed;
456
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300457struct wl1271_cmd_test_header {
458 u8 id;
459 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000460} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300461
462enum wl1271_channel_tune_bands {
463 WL1271_CHANNEL_TUNE_BAND_2_4,
464 WL1271_CHANNEL_TUNE_BAND_5,
465 WL1271_CHANNEL_TUNE_BAND_4_9
466};
467
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200468#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300469
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200470#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
471#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
472#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200473
474struct wl1271_general_parms_cmd {
475 struct wl1271_cmd_header header;
476
477 struct wl1271_cmd_test_header test;
478
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300479 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200480
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300481 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
482 u8 sr_sen_n_p;
483 u8 sr_sen_n_p_gain;
484 u8 sr_sen_nrn;
485 u8 sr_sen_prn;
486 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700487} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200488
Shahar Levi49d750ca2011-03-06 16:32:09 +0200489struct wl128x_general_parms_cmd {
490 struct wl1271_cmd_header header;
491
492 struct wl1271_cmd_test_header test;
493
494 struct wl128x_ini_general_params general_params;
495
496 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
497 u8 sr_sen_n_p;
498 u8 sr_sen_n_p_gain;
499 u8 sr_sen_nrn;
500 u8 sr_sen_prn;
501 u8 padding[3];
502} __packed;
503
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200504struct wl1271_radio_parms_cmd {
505 struct wl1271_cmd_header header;
506
507 struct wl1271_cmd_test_header test;
508
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300509 /* Static radio parameters */
510 struct wl1271_ini_band_params_2 static_params_2;
511 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200512
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300513 /* Dynamic radio parameters */
514 struct wl1271_ini_fem_params_2 dyn_params_2;
515 u8 padding2;
516 struct wl1271_ini_fem_params_5 dyn_params_5;
517 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000518} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300519
Shahar Levi49d750ca2011-03-06 16:32:09 +0200520struct wl128x_radio_parms_cmd {
521 struct wl1271_cmd_header header;
522
523 struct wl1271_cmd_test_header test;
524
525 /* Static radio parameters */
526 struct wl128x_ini_band_params_2 static_params_2;
527 struct wl128x_ini_band_params_5 static_params_5;
528
529 u8 fem_vendor_and_options;
530
531 /* Dynamic radio parameters */
532 struct wl128x_ini_fem_params_2 dyn_params_2;
533 u8 padding2;
534 struct wl128x_ini_fem_params_5 dyn_params_5;
535} __packed;
536
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200537struct wl1271_ext_radio_parms_cmd {
538 struct wl1271_cmd_header header;
539
540 struct wl1271_cmd_test_header test;
541
542 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
543 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
544 u8 padding[3];
545} __packed;
546
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300547/*
548 * There are three types of disconnections:
549 *
550 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
551 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
552 * we have passed
553 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
554 * we have passed
555 */
556enum wl1271_disconnect_type {
557 DISCONNECT_IMMEDIATE,
558 DISCONNECT_DEAUTH,
559 DISCONNECT_DISASSOC
560};
561
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300562#define WL1271_CMD_STA_STATE_CONNECTED 1
563
Eliad Pellerc690ec82011-08-14 13:17:07 +0300564struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300565 struct wl1271_cmd_header header;
566
Eliad Pellerc690ec82011-08-14 13:17:07 +0300567 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300568 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300569 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300570} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300571
Eliad Pellera7cba382011-08-14 13:17:16 +0300572struct wl12xx_cmd_roc {
573 struct wl1271_cmd_header header;
574
575 u8 role_id;
576 u8 channel;
577 u8 band;
578 u8 padding;
579};
580
581struct wl12xx_cmd_croc {
582 struct wl1271_cmd_header header;
583
584 u8 role_id;
585 u8 padding[3];
586};
587
Eliad Pellerc690ec82011-08-14 13:17:07 +0300588enum wl12xx_ssid_type {
589 WL12XX_SSID_TYPE_PUBLIC = 0,
590 WL12XX_SSID_TYPE_HIDDEN = 1,
591 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200592};
593
Eliad Peller1ec23f72011-08-25 14:26:54 +0300594enum wl1271_psd_type {
595 WL1271_PSD_LEGACY = 0,
596 WL1271_PSD_UPSD_TRIGGER = 1,
597 WL1271_PSD_LEGACY_PSPOLL = 2,
598 WL1271_PSD_SAPSD = 3
599};
600
Eliad Pellerc690ec82011-08-14 13:17:07 +0300601struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200602 struct wl1271_cmd_header header;
603
604 u8 addr[ETH_ALEN];
605 u8 hlid;
606 u8 aid;
607 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
608 __le32 supported_rates;
609 u8 bss_index;
610 u8 sp_len;
611 u8 wmm;
612 u8 padding1;
613} __packed;
614
Eliad Pellerc690ec82011-08-14 13:17:07 +0300615struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200616 struct wl1271_cmd_header header;
617
618 u8 hlid;
619 u8 reason_opcode;
620 u8 send_deauth_flag;
621 u8 padding1;
622} __packed;
623
Ido Yariv95dac04f2011-06-06 14:57:06 +0300624/*
625 * Continuous mode - packets are transferred to the host periodically
626 * via the data path.
627 * On demand - Log messages are stored in a cyclic buffer in the
628 * firmware, and only transferred to the host when explicitly requested
629 */
630enum wl12xx_fwlogger_log_mode {
631 WL12XX_FWLOG_CONTINUOUS,
632 WL12XX_FWLOG_ON_DEMAND
633};
634
635/* Include/exclude timestamps from the log messages */
636enum wl12xx_fwlogger_timestamp {
637 WL12XX_FWLOG_TIMESTAMP_DISABLED,
638 WL12XX_FWLOG_TIMESTAMP_ENABLED
639};
640
641/*
642 * Logs can be routed to the debug pinouts (where available), to the host bus
643 * (SDIO/SPI), or dropped
644 */
645enum wl12xx_fwlogger_output {
646 WL12XX_FWLOG_OUTPUT_NONE,
647 WL12XX_FWLOG_OUTPUT_DBG_PINS,
648 WL12XX_FWLOG_OUTPUT_HOST,
649};
650
651struct wl12xx_cmd_config_fwlog {
652 struct wl1271_cmd_header header;
653
654 /* See enum wl12xx_fwlogger_log_mode */
655 u8 logger_mode;
656
657 /* Minimum log level threshold */
658 u8 log_severity;
659
660 /* Include/exclude timestamps from the log messages */
661 u8 timestamp;
662
663 /* See enum wl1271_fwlogger_output */
664 u8 output;
665
666 /* Regulates the frequency of log messages */
667 u8 threshold;
668
669 u8 padding[3];
670} __packed;
671
672struct wl12xx_cmd_start_fwlog {
673 struct wl1271_cmd_header header;
674} __packed;
675
676struct wl12xx_cmd_stop_fwlog {
677 struct wl1271_cmd_header header;
678} __packed;
679
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300680#endif /* __WL1271_CMD_H__ */