blob: 8e8035d3306875e34ba3362e550ea55ee9b9e8c8 [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 Peller784f6942011-10-05 11:55:39 +020039int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type,
40 u8 *role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030041int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
Eliad Peller87fbcb02011-10-05 11:55:41 +020042int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller0603d892011-10-05 11:55:51 +020043int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020044int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller0603d892011-10-05 11:55:51 +020045int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020046int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller679a6732011-10-11 11:55:44 +020047int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
48int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030049int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
50int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
51int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
Luciano Coelho94210892009-12-11 15:40:55 +020052int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
Eliad Peller0603d892011-10-05 11:55:51 +020053int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
54 u8 ps_mode);
Juuso Oikarinen65cddbf2010-08-24 06:28:03 +030055int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
56 size_t len);
Eliad Pellercdaac622012-01-31 11:57:16 +020057int wl1271_cmd_template_set(struct wl1271 *wl, u8 role_id,
58 u16 template_id, void *buf, size_t buf_len,
59 int index, u32 rates);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020060int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020061int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
62 u16 aid);
Eliad Pellercdaac622012-01-31 11:57:16 +020063int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
64 u8 role_id, u8 band,
Kalle Valo818e3062010-03-18 12:26:35 +020065 const u8 *ssid, size_t ssid_len,
Eliad Pellercdaac622012-01-31 11:57:16 +020066 const u8 *ie, size_t ie_len);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020067struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
Eliad Peller83587502011-10-10 10:12:53 +020068 struct wl12xx_vif *wlvif,
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020069 struct sk_buff *skb);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020070int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
71 __be32 ip_addr);
Eliad Peller784f6942011-10-05 11:55:39 +020072int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020073int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
74 struct wl12xx_vif *wlvif);
Eliad Pellerc690ec82011-08-14 13:17:07 +030075int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Eliad Pellera8ab39a2011-10-05 11:55:54 +020076int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
Eliad Peller154da672011-10-05 11:55:53 +020077 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020078 u8 key_size, const u8 *key, const u8 *addr,
79 u32 tx_seq_32, u16 tx_seq_16);
Eliad Pellera8ab39a2011-10-05 11:55:54 +020080int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
81 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020082 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
83 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030084int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller1b92f152011-10-10 10:13:09 +020085int wl12xx_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 role_id);
Eliad Peller251c1772011-08-14 13:17:17 +030086int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Peller1b92f152011-10-10 10:13:09 +020087int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
88 struct ieee80211_sta *sta, u8 hlid);
Eliad Pellerc690ec82011-08-14 13:17:07 +030089int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030090int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
91int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
92int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Shahar Levi6d158ff2011-09-08 13:01:33 +030093int wl12xx_cmd_channel_switch(struct wl1271 *wl,
94 struct ieee80211_channel_switch *ch_switch);
95int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl);
Eliad Pellerc7ffb902011-10-05 11:56:05 +020096int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif,
97 u8 *hlid);
98void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030099
100enum wl1271_commands {
101 CMD_INTERROGATE = 1, /*use this to read information elements*/
102 CMD_CONFIGURE = 2, /*use this to write information elements*/
103 CMD_ENABLE_RX = 3,
104 CMD_ENABLE_TX = 4,
105 CMD_DISABLE_RX = 5,
106 CMD_DISABLE_TX = 6,
107 CMD_SCAN = 8,
108 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300109 CMD_SET_KEYS = 12,
110 CMD_READ_MEMORY = 13,
111 CMD_WRITE_MEMORY = 14,
112 CMD_SET_TEMPLATE = 19,
113 CMD_TEST = 23,
114 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300115 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300116 CMD_SET_BCN_MODE = 33,
117 CMD_MEASUREMENT = 34,
118 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300119 CMD_SET_PS_MODE = 37,
120 CMD_CHANNEL_SWITCH = 38,
121 CMD_STOP_CHANNEL_SWICTH = 39,
122 CMD_AP_DISCOVERY = 40,
123 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300124 CMD_HEALTH_CHECK = 45,
125 CMD_DEBUG = 46,
126 CMD_TRIGGER_SCAN_TO = 47,
127 CMD_CONNECTION_SCAN_CFG = 48,
128 CMD_CONNECTION_SCAN_SSID_CFG = 49,
129 CMD_START_PERIODIC_SCAN = 50,
130 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300131 CMD_SET_PEER_STATE = 52,
132 CMD_REMAIN_ON_CHANNEL = 53,
133 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300134
Eliad Pellerc690ec82011-08-14 13:17:07 +0300135 CMD_CONFIG_FWLOGGER = 55,
136 CMD_START_FWLOGGER = 56,
137 CMD_STOP_FWLOGGER = 57,
138
139 /* AP commands */
140 CMD_ADD_PEER = 62,
141 CMD_REMOVE_PEER = 63,
142
143 /* Role API */
144 CMD_ROLE_ENABLE = 70,
145 CMD_ROLE_DISABLE = 71,
146 CMD_ROLE_START = 72,
147 CMD_ROLE_STOP = 73,
148
149 /* WIFI Direct */
150 CMD_WFD_START_DISCOVERY = 80,
151 CMD_WFD_STOP_DISCOVERY = 81,
152 CMD_WFD_ATTRIBUTE_CONFIG = 82,
153
154 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200155
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300156 NUM_COMMANDS,
157 MAX_COMMAND_ID = 0xFFFF,
158};
159
160#define MAX_CMD_PARAMS 572
161
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200162enum {
163 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
164 CMD_TEMPL_KLV_IDX_MAX = 4
165};
166
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300167enum cmd_templ {
168 CMD_TEMPL_NULL_DATA = 0,
169 CMD_TEMPL_BEACON,
170 CMD_TEMPL_CFG_PROBE_REQ_2_4,
171 CMD_TEMPL_CFG_PROBE_REQ_5,
172 CMD_TEMPL_PROBE_RESPONSE,
173 CMD_TEMPL_QOS_NULL_DATA,
174 CMD_TEMPL_PS_POLL,
175 CMD_TEMPL_KLV,
176 CMD_TEMPL_DISCONNECT,
177 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
178 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
179 CMD_TEMPL_BAR, /* for firmware internal use only */
180 CMD_TEMPL_CTS, /*
181 * For CTS-to-self (FastCTS) mechanism
182 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300183 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200184 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300185 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200186 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300187 CMD_TEMPL_TEMPORARY,
188 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200189
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300190 CMD_TEMPL_MAX = 0xff
191};
192
193/* unit ms */
194#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300195#define WL1271_CMD_TEMPL_DFLT_SIZE 252
Eliad Pellercdaac622012-01-31 11:57:16 +0200196#define WL1271_CMD_TEMPL_MAX_SIZE 512
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300197#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300198
199struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300200 __le16 id;
201 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300202 /* payload */
203 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000204} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300205
206#define WL1271_CMD_MAX_PARAMS 572
207
208struct wl1271_command {
209 struct wl1271_cmd_header header;
210 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000211} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300212
213enum {
214 CMD_MAILBOX_IDLE = 0,
215 CMD_STATUS_SUCCESS = 1,
216 CMD_STATUS_UNKNOWN_CMD = 2,
217 CMD_STATUS_UNKNOWN_IE = 3,
218 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
219 CMD_STATUS_RX_BUSY = 13,
220 CMD_STATUS_INVALID_PARAM = 14,
221 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
222 CMD_STATUS_OUT_OF_MEMORY = 16,
223 CMD_STATUS_STA_TABLE_FULL = 17,
224 CMD_STATUS_RADIO_ERROR = 18,
225 CMD_STATUS_WRONG_NESTING = 19,
226 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
227 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300228 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300229 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300230 MAX_COMMAND_STATUS = 0xff
231};
232
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300233#define CMDMBOX_HEADER_LEN 4
234#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
235
236enum {
237 BSS_TYPE_IBSS = 0,
238 BSS_TYPE_STA_BSS = 2,
239 BSS_TYPE_AP_BSS = 3,
240 MAX_BSS_TYPE = 0xFF
241};
242
243#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
244#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300245#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300246
Eliad Pellerc690ec82011-08-14 13:17:07 +0300247struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300248 struct wl1271_cmd_header header;
249
Eliad Pellerc690ec82011-08-14 13:17:07 +0300250 u8 role_id;
251 u8 role_type;
252 u8 mac_address[ETH_ALEN];
253} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300254
Eliad Pellerc690ec82011-08-14 13:17:07 +0300255struct wl12xx_cmd_role_disable {
256 struct wl1271_cmd_header header;
257
258 u8 role_id;
259 u8 padding[3];
260} __packed;
261
262enum wl12xx_band {
263 WL12XX_BAND_2_4GHZ = 0,
264 WL12XX_BAND_5GHZ = 1,
265 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
266 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
267 WL12XX_BAND_INVALID = 0x7E,
268 WL12XX_BAND_MAX_RADIO = 0x7F,
269};
270
271struct wl12xx_cmd_role_start {
272 struct wl1271_cmd_header header;
273
274 u8 role_id;
275 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300276 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300277 u8 padding;
278
279 union {
280 struct {
281 u8 hlid;
282 u8 session;
283 u8 padding_1[54];
284 } __packed device;
285 /* sta & p2p_cli use the same struct */
286 struct {
287 u8 bssid[ETH_ALEN];
288 u8 hlid; /* data hlid */
289 u8 session;
290 __le32 remote_rates; /* remote supported rates */
291
292 /*
293 * The target uses this field to determine the rate at
294 * which to transmit control frame responses (such as
295 * ACK or CTS frames).
296 */
297 __le32 basic_rate_set;
298 __le32 local_rates; /* local supported rates */
299
300 u8 ssid_type;
301 u8 ssid_len;
302 u8 ssid[IEEE80211_MAX_SSID_LEN];
303
304 __le16 beacon_interval; /* in TBTTs */
305 } __packed sta;
306 struct {
307 u8 bssid[ETH_ALEN];
308 u8 hlid; /* data hlid */
309 u8 dtim_interval;
310 __le32 remote_rates; /* remote supported rates */
311
312 __le32 basic_rate_set;
313 __le32 local_rates; /* local supported rates */
314
315 u8 ssid_type;
316 u8 ssid_len;
317 u8 ssid[IEEE80211_MAX_SSID_LEN];
318
319 __le16 beacon_interval; /* in TBTTs */
320
321 u8 padding_1[4];
322 } __packed ibss;
323 /* ap & p2p_go use the same struct */
324 struct {
325 __le16 aging_period; /* in secs */
326 u8 beacon_expiry; /* in ms */
327 u8 bss_index;
328 /* The host link id for the AP's global queue */
329 u8 global_hlid;
330 /* The host link id for the AP's broadcast queue */
331 u8 broadcast_hlid;
332
333 __le16 beacon_interval; /* in TBTTs */
334
335 __le32 basic_rate_set;
336 __le32 local_rates; /* local supported rates */
337
338 u8 dtim_interval;
339
340 u8 ssid_type;
341 u8 ssid_len;
342 u8 ssid[IEEE80211_MAX_SSID_LEN];
343
344 u8 padding_1[5];
345 } __packed ap;
346 };
347} __packed;
348
349struct wl12xx_cmd_role_stop {
350 struct wl1271_cmd_header header;
351
352 u8 role_id;
353 u8 disc_type; /* only STA and P2P_CLI */
354 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000355} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300356
357struct cmd_enabledisable_path {
358 struct wl1271_cmd_header header;
359
360 u8 channel;
361 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000362} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300363
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300364#define WL1271_RATE_AUTOMATIC 0
365
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300366struct wl1271_cmd_template_set {
367 struct wl1271_cmd_header header;
368
Eliad Pellercdaac622012-01-31 11:57:16 +0200369 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300370 u8 template_type;
Eliad Pellercdaac622012-01-31 11:57:16 +0200371 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300372 u8 index; /* relevant only for KLV_TEMPLATE type */
Eliad Pellercdaac622012-01-31 11:57:16 +0200373 u8 padding[3];
374
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300375 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300376 u8 short_retry_limit;
377 u8 long_retry_limit;
378 u8 aflags;
379 u8 reserved;
Eliad Pellercdaac622012-01-31 11:57:16 +0200380
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300381 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000382} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300383
384#define TIM_ELE_ID 5
385#define PARTIAL_VBM_MAX 251
386
387struct wl1271_tim {
388 u8 identity;
389 u8 length;
390 u8 dtim_count;
391 u8 dtim_period;
392 u8 bitmap_ctrl;
393 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000394} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300395
396enum wl1271_cmd_ps_mode {
397 STATION_ACTIVE_MODE,
398 STATION_POWER_SAVE_MODE
399};
400
401struct wl1271_cmd_ps_params {
402 struct wl1271_cmd_header header;
403
Eliad Pellerc690ec82011-08-14 13:17:07 +0300404 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300405 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300406 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000407} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300408
409/* HW encryption keys */
410#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300411
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300412enum wl1271_cmd_key_action {
413 KEY_ADD_OR_REPLACE = 1,
414 KEY_REMOVE = 2,
415 KEY_SET_ID = 3,
416 MAX_KEY_ACTION = 0xffff,
417};
418
Eliad Pellerc690ec82011-08-14 13:17:07 +0300419enum wl1271_cmd_lid_key_type {
420 UNICAST_LID_TYPE = 0,
421 BROADCAST_LID_TYPE = 1,
422 WEP_DEFAULT_LID_TYPE = 2
423};
424
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300425enum wl1271_cmd_key_type {
426 KEY_NONE = 0,
427 KEY_WEP = 1,
428 KEY_TKIP = 2,
429 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200430 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300431};
432
Eliad Pellerc690ec82011-08-14 13:17:07 +0300433struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200434 struct wl1271_cmd_header header;
435
436 /*
437 * Indicates whether the HLID is a unicast key set
438 * or broadcast key set. A special value 0xFF is
439 * used to indicate that the HLID is on WEP-default
440 * (multi-hlids). of type wl1271_cmd_lid_key_type.
441 */
442 u8 hlid;
443
444 /*
445 * In WEP-default network (hlid == 0xFF) used to
446 * indicate which network STA/IBSS/AP role should be
447 * changed
448 */
449 u8 lid_key_type;
450
451 /*
452 * Key ID - For TKIP and AES key types, this field
453 * indicates the value that should be inserted into
454 * the KeyID field of frames transmitted using this
455 * key entry. For broadcast keys the index use as a
456 * marker for TX/RX key.
457 * For WEP default network (HLID=0xFF), this field
458 * indicates the ID of the key to add or remove.
459 */
460 u8 key_id;
461 u8 reserved_1;
462
463 /* key_action_e */
464 __le16 key_action;
465
466 /* key size in bytes */
467 u8 key_size;
468
469 /* key_type_e */
470 u8 key_type;
471
472 /* This field holds the security key data to add to the STA table */
473 u8 key[MAX_KEY_SIZE];
474 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
475 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
476} __packed;
477
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300478struct wl1271_cmd_test_header {
479 u8 id;
480 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000481} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300482
483enum wl1271_channel_tune_bands {
484 WL1271_CHANNEL_TUNE_BAND_2_4,
485 WL1271_CHANNEL_TUNE_BAND_5,
486 WL1271_CHANNEL_TUNE_BAND_4_9
487};
488
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200489#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300490
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200491#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
492#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
493#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200494
495struct wl1271_general_parms_cmd {
496 struct wl1271_cmd_header header;
497
498 struct wl1271_cmd_test_header test;
499
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300500 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200501
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300502 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
503 u8 sr_sen_n_p;
504 u8 sr_sen_n_p_gain;
505 u8 sr_sen_nrn;
506 u8 sr_sen_prn;
507 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700508} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200509
Shahar Levi49d750ca2011-03-06 16:32:09 +0200510struct wl128x_general_parms_cmd {
511 struct wl1271_cmd_header header;
512
513 struct wl1271_cmd_test_header test;
514
515 struct wl128x_ini_general_params general_params;
516
517 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
518 u8 sr_sen_n_p;
519 u8 sr_sen_n_p_gain;
520 u8 sr_sen_nrn;
521 u8 sr_sen_prn;
522 u8 padding[3];
523} __packed;
524
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200525struct wl1271_radio_parms_cmd {
526 struct wl1271_cmd_header header;
527
528 struct wl1271_cmd_test_header test;
529
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300530 /* Static radio parameters */
531 struct wl1271_ini_band_params_2 static_params_2;
532 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200533
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300534 /* Dynamic radio parameters */
535 struct wl1271_ini_fem_params_2 dyn_params_2;
536 u8 padding2;
537 struct wl1271_ini_fem_params_5 dyn_params_5;
538 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000539} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300540
Shahar Levi49d750ca2011-03-06 16:32:09 +0200541struct wl128x_radio_parms_cmd {
542 struct wl1271_cmd_header header;
543
544 struct wl1271_cmd_test_header test;
545
546 /* Static radio parameters */
547 struct wl128x_ini_band_params_2 static_params_2;
548 struct wl128x_ini_band_params_5 static_params_5;
549
550 u8 fem_vendor_and_options;
551
552 /* Dynamic radio parameters */
553 struct wl128x_ini_fem_params_2 dyn_params_2;
554 u8 padding2;
555 struct wl128x_ini_fem_params_5 dyn_params_5;
556} __packed;
557
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200558struct wl1271_ext_radio_parms_cmd {
559 struct wl1271_cmd_header header;
560
561 struct wl1271_cmd_test_header test;
562
563 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
564 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
565 u8 padding[3];
566} __packed;
567
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300568/*
569 * There are three types of disconnections:
570 *
571 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
572 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
573 * we have passed
574 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
575 * we have passed
576 */
577enum wl1271_disconnect_type {
578 DISCONNECT_IMMEDIATE,
579 DISCONNECT_DEAUTH,
580 DISCONNECT_DISASSOC
581};
582
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300583#define WL1271_CMD_STA_STATE_CONNECTED 1
584
Eliad Pellerc690ec82011-08-14 13:17:07 +0300585struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300586 struct wl1271_cmd_header header;
587
Eliad Pellerc690ec82011-08-14 13:17:07 +0300588 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300589 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300590 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300591} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300592
Eliad Pellera7cba382011-08-14 13:17:16 +0300593struct wl12xx_cmd_roc {
594 struct wl1271_cmd_header header;
595
596 u8 role_id;
597 u8 channel;
598 u8 band;
599 u8 padding;
600};
601
602struct wl12xx_cmd_croc {
603 struct wl1271_cmd_header header;
604
605 u8 role_id;
606 u8 padding[3];
607};
608
Eliad Pellerc690ec82011-08-14 13:17:07 +0300609enum wl12xx_ssid_type {
610 WL12XX_SSID_TYPE_PUBLIC = 0,
611 WL12XX_SSID_TYPE_HIDDEN = 1,
612 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200613};
614
Eliad Peller1ec23f72011-08-25 14:26:54 +0300615enum wl1271_psd_type {
616 WL1271_PSD_LEGACY = 0,
617 WL1271_PSD_UPSD_TRIGGER = 1,
618 WL1271_PSD_LEGACY_PSPOLL = 2,
619 WL1271_PSD_SAPSD = 3
620};
621
Eliad Pellerc690ec82011-08-14 13:17:07 +0300622struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200623 struct wl1271_cmd_header header;
624
625 u8 addr[ETH_ALEN];
626 u8 hlid;
627 u8 aid;
628 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
629 __le32 supported_rates;
630 u8 bss_index;
631 u8 sp_len;
632 u8 wmm;
633 u8 padding1;
634} __packed;
635
Eliad Pellerc690ec82011-08-14 13:17:07 +0300636struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200637 struct wl1271_cmd_header header;
638
639 u8 hlid;
640 u8 reason_opcode;
641 u8 send_deauth_flag;
642 u8 padding1;
643} __packed;
644
Ido Yariv95dac04f2011-06-06 14:57:06 +0300645/*
646 * Continuous mode - packets are transferred to the host periodically
647 * via the data path.
648 * On demand - Log messages are stored in a cyclic buffer in the
649 * firmware, and only transferred to the host when explicitly requested
650 */
651enum wl12xx_fwlogger_log_mode {
652 WL12XX_FWLOG_CONTINUOUS,
653 WL12XX_FWLOG_ON_DEMAND
654};
655
656/* Include/exclude timestamps from the log messages */
657enum wl12xx_fwlogger_timestamp {
658 WL12XX_FWLOG_TIMESTAMP_DISABLED,
659 WL12XX_FWLOG_TIMESTAMP_ENABLED
660};
661
662/*
663 * Logs can be routed to the debug pinouts (where available), to the host bus
664 * (SDIO/SPI), or dropped
665 */
666enum wl12xx_fwlogger_output {
667 WL12XX_FWLOG_OUTPUT_NONE,
668 WL12XX_FWLOG_OUTPUT_DBG_PINS,
669 WL12XX_FWLOG_OUTPUT_HOST,
670};
671
672struct wl12xx_cmd_config_fwlog {
673 struct wl1271_cmd_header header;
674
675 /* See enum wl12xx_fwlogger_log_mode */
676 u8 logger_mode;
677
678 /* Minimum log level threshold */
679 u8 log_severity;
680
681 /* Include/exclude timestamps from the log messages */
682 u8 timestamp;
683
684 /* See enum wl1271_fwlogger_output */
685 u8 output;
686
687 /* Regulates the frequency of log messages */
688 u8 threshold;
689
690 u8 padding[3];
691} __packed;
692
693struct wl12xx_cmd_start_fwlog {
694 struct wl1271_cmd_header header;
695} __packed;
696
697struct wl12xx_cmd_stop_fwlog {
698 struct wl1271_cmd_header header;
699} __packed;
700
Shahar Levi6d158ff2011-09-08 13:01:33 +0300701struct wl12xx_cmd_channel_switch {
702 struct wl1271_cmd_header header;
703
704 /* The new serving channel */
705 u8 channel;
706 /* Relative time of the serving channel switch in TBTT units */
707 u8 switch_time;
708 /* 1: Suspend TX till switch time; 0: Do not suspend TX */
709 u8 tx_suspend;
710 /* 1: Flush TX at switch time; 0: Do not flush */
711 u8 flush;
712} __packed;
713
714struct wl12xx_cmd_stop_channel_switch {
715 struct wl1271_cmd_header header;
716} __packed;
717
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300718#endif /* __WL1271_CMD_H__ */