blob: 5cf92e256641ffb352c513fc06e67e22f7f4a9d0 [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);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030047int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
48int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
49int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
Luciano Coelho94210892009-12-11 15:40:55 +020050int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
Eliad Pellerc8bde242011-02-02 09:59:35 +020051int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode);
Juuso Oikarinen65cddbf2010-08-24 06:28:03 +030052int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
53 size_t len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030054int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030055 void *buf, size_t buf_len, int index, u32 rates);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030056int wl1271_cmd_build_null_data(struct wl1271 *wl);
57int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid);
Kalle Valo818e3062010-03-18 12:26:35 +020058int wl1271_cmd_build_probe_req(struct wl1271 *wl,
59 const u8 *ssid, size_t ssid_len,
60 const u8 *ie, size_t ie_len, u8 band);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020061struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
62 struct sk_buff *skb);
Eliad Pellerc5312772010-12-09 11:31:27 +020063int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr);
Kalle Valo023e0822010-03-18 12:26:36 +020064int wl1271_build_qos_null_data(struct wl1271 *wl);
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020065int wl1271_cmd_build_klv_null_data(struct wl1271 *wl);
Eliad Pellerc690ec82011-08-14 13:17:07 +030066int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020067int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
68 u8 key_size, const u8 *key, const u8 *addr,
69 u32 tx_seq_32, u16 tx_seq_16);
70int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
71 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
72 u16 tx_seq_16);
Eliad Pellerc690ec82011-08-14 13:17:07 +030073int wl12xx_cmd_set_peer_state(struct wl1271 *wl);
Eliad Peller251c1772011-08-14 13:17:17 +030074int wl12xx_roc(struct wl1271 *wl, u8 role_id);
75int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030076int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
77int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030078int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
79int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
80int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030081
82enum wl1271_commands {
83 CMD_INTERROGATE = 1, /*use this to read information elements*/
84 CMD_CONFIGURE = 2, /*use this to write information elements*/
85 CMD_ENABLE_RX = 3,
86 CMD_ENABLE_TX = 4,
87 CMD_DISABLE_RX = 5,
88 CMD_DISABLE_TX = 6,
89 CMD_SCAN = 8,
90 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030091 CMD_SET_KEYS = 12,
92 CMD_READ_MEMORY = 13,
93 CMD_WRITE_MEMORY = 14,
94 CMD_SET_TEMPLATE = 19,
95 CMD_TEST = 23,
96 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +030097 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030098 CMD_SET_BCN_MODE = 33,
99 CMD_MEASUREMENT = 34,
100 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300101 CMD_SET_PS_MODE = 37,
102 CMD_CHANNEL_SWITCH = 38,
103 CMD_STOP_CHANNEL_SWICTH = 39,
104 CMD_AP_DISCOVERY = 40,
105 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300106 CMD_HEALTH_CHECK = 45,
107 CMD_DEBUG = 46,
108 CMD_TRIGGER_SCAN_TO = 47,
109 CMD_CONNECTION_SCAN_CFG = 48,
110 CMD_CONNECTION_SCAN_SSID_CFG = 49,
111 CMD_START_PERIODIC_SCAN = 50,
112 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300113 CMD_SET_PEER_STATE = 52,
114 CMD_REMAIN_ON_CHANNEL = 53,
115 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300116
Eliad Pellerc690ec82011-08-14 13:17:07 +0300117 CMD_CONFIG_FWLOGGER = 55,
118 CMD_START_FWLOGGER = 56,
119 CMD_STOP_FWLOGGER = 57,
120
121 /* AP commands */
122 CMD_ADD_PEER = 62,
123 CMD_REMOVE_PEER = 63,
124
125 /* Role API */
126 CMD_ROLE_ENABLE = 70,
127 CMD_ROLE_DISABLE = 71,
128 CMD_ROLE_START = 72,
129 CMD_ROLE_STOP = 73,
130
131 /* WIFI Direct */
132 CMD_WFD_START_DISCOVERY = 80,
133 CMD_WFD_STOP_DISCOVERY = 81,
134 CMD_WFD_ATTRIBUTE_CONFIG = 82,
135
136 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200137
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300138 NUM_COMMANDS,
139 MAX_COMMAND_ID = 0xFFFF,
140};
141
142#define MAX_CMD_PARAMS 572
143
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200144enum {
145 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
146 CMD_TEMPL_KLV_IDX_MAX = 4
147};
148
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300149enum cmd_templ {
150 CMD_TEMPL_NULL_DATA = 0,
151 CMD_TEMPL_BEACON,
152 CMD_TEMPL_CFG_PROBE_REQ_2_4,
153 CMD_TEMPL_CFG_PROBE_REQ_5,
154 CMD_TEMPL_PROBE_RESPONSE,
155 CMD_TEMPL_QOS_NULL_DATA,
156 CMD_TEMPL_PS_POLL,
157 CMD_TEMPL_KLV,
158 CMD_TEMPL_DISCONNECT,
159 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
160 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
161 CMD_TEMPL_BAR, /* for firmware internal use only */
162 CMD_TEMPL_CTS, /*
163 * For CTS-to-self (FastCTS) mechanism
164 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300165 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200166 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300167 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200168 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300169 CMD_TEMPL_TEMPORARY,
170 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200171
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300172 CMD_TEMPL_MAX = 0xff
173};
174
175/* unit ms */
176#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300177#define WL1271_CMD_TEMPL_DFLT_SIZE 252
178#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300179#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300180
181struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300182 __le16 id;
183 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300184 /* payload */
185 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000186} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300187
188#define WL1271_CMD_MAX_PARAMS 572
189
190struct wl1271_command {
191 struct wl1271_cmd_header header;
192 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000193} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300194
195enum {
196 CMD_MAILBOX_IDLE = 0,
197 CMD_STATUS_SUCCESS = 1,
198 CMD_STATUS_UNKNOWN_CMD = 2,
199 CMD_STATUS_UNKNOWN_IE = 3,
200 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
201 CMD_STATUS_RX_BUSY = 13,
202 CMD_STATUS_INVALID_PARAM = 14,
203 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
204 CMD_STATUS_OUT_OF_MEMORY = 16,
205 CMD_STATUS_STA_TABLE_FULL = 17,
206 CMD_STATUS_RADIO_ERROR = 18,
207 CMD_STATUS_WRONG_NESTING = 19,
208 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
209 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300210 CMD_STATUS_TEMPLATE_OOM = 23,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300211 MAX_COMMAND_STATUS = 0xff
212};
213
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300214#define CMDMBOX_HEADER_LEN 4
215#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
216
217enum {
218 BSS_TYPE_IBSS = 0,
219 BSS_TYPE_STA_BSS = 2,
220 BSS_TYPE_AP_BSS = 3,
221 MAX_BSS_TYPE = 0xFF
222};
223
224#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
225#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300226#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300227
Eliad Pellerc690ec82011-08-14 13:17:07 +0300228struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300229 struct wl1271_cmd_header header;
230
Eliad Pellerc690ec82011-08-14 13:17:07 +0300231 u8 role_id;
232 u8 role_type;
233 u8 mac_address[ETH_ALEN];
234} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300235
Eliad Pellerc690ec82011-08-14 13:17:07 +0300236struct wl12xx_cmd_role_disable {
237 struct wl1271_cmd_header header;
238
239 u8 role_id;
240 u8 padding[3];
241} __packed;
242
243enum wl12xx_band {
244 WL12XX_BAND_2_4GHZ = 0,
245 WL12XX_BAND_5GHZ = 1,
246 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
247 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
248 WL12XX_BAND_INVALID = 0x7E,
249 WL12XX_BAND_MAX_RADIO = 0x7F,
250};
251
252struct wl12xx_cmd_role_start {
253 struct wl1271_cmd_header header;
254
255 u8 role_id;
256 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300257 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300258 u8 padding;
259
260 union {
261 struct {
262 u8 hlid;
263 u8 session;
264 u8 padding_1[54];
265 } __packed device;
266 /* sta & p2p_cli use the same struct */
267 struct {
268 u8 bssid[ETH_ALEN];
269 u8 hlid; /* data hlid */
270 u8 session;
271 __le32 remote_rates; /* remote supported rates */
272
273 /*
274 * The target uses this field to determine the rate at
275 * which to transmit control frame responses (such as
276 * ACK or CTS frames).
277 */
278 __le32 basic_rate_set;
279 __le32 local_rates; /* local supported rates */
280
281 u8 ssid_type;
282 u8 ssid_len;
283 u8 ssid[IEEE80211_MAX_SSID_LEN];
284
285 __le16 beacon_interval; /* in TBTTs */
286 } __packed sta;
287 struct {
288 u8 bssid[ETH_ALEN];
289 u8 hlid; /* data hlid */
290 u8 dtim_interval;
291 __le32 remote_rates; /* remote supported rates */
292
293 __le32 basic_rate_set;
294 __le32 local_rates; /* local supported rates */
295
296 u8 ssid_type;
297 u8 ssid_len;
298 u8 ssid[IEEE80211_MAX_SSID_LEN];
299
300 __le16 beacon_interval; /* in TBTTs */
301
302 u8 padding_1[4];
303 } __packed ibss;
304 /* ap & p2p_go use the same struct */
305 struct {
306 __le16 aging_period; /* in secs */
307 u8 beacon_expiry; /* in ms */
308 u8 bss_index;
309 /* The host link id for the AP's global queue */
310 u8 global_hlid;
311 /* The host link id for the AP's broadcast queue */
312 u8 broadcast_hlid;
313
314 __le16 beacon_interval; /* in TBTTs */
315
316 __le32 basic_rate_set;
317 __le32 local_rates; /* local supported rates */
318
319 u8 dtim_interval;
320
321 u8 ssid_type;
322 u8 ssid_len;
323 u8 ssid[IEEE80211_MAX_SSID_LEN];
324
325 u8 padding_1[5];
326 } __packed ap;
327 };
328} __packed;
329
330struct wl12xx_cmd_role_stop {
331 struct wl1271_cmd_header header;
332
333 u8 role_id;
334 u8 disc_type; /* only STA and P2P_CLI */
335 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000336} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300337
338struct cmd_enabledisable_path {
339 struct wl1271_cmd_header header;
340
341 u8 channel;
342 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000343} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300344
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300345#define WL1271_RATE_AUTOMATIC 0
346
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300347struct wl1271_cmd_template_set {
348 struct wl1271_cmd_header header;
349
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300350 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300351 u8 template_type;
352 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300353 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300354 u8 short_retry_limit;
355 u8 long_retry_limit;
356 u8 aflags;
357 u8 reserved;
358 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000359} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300360
361#define TIM_ELE_ID 5
362#define PARTIAL_VBM_MAX 251
363
364struct wl1271_tim {
365 u8 identity;
366 u8 length;
367 u8 dtim_count;
368 u8 dtim_period;
369 u8 bitmap_ctrl;
370 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000371} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300372
373enum wl1271_cmd_ps_mode {
374 STATION_ACTIVE_MODE,
375 STATION_POWER_SAVE_MODE
376};
377
378struct wl1271_cmd_ps_params {
379 struct wl1271_cmd_header header;
380
Eliad Pellerc690ec82011-08-14 13:17:07 +0300381 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300382 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300383 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000384} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300385
386/* HW encryption keys */
387#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300388
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300389enum wl1271_cmd_key_action {
390 KEY_ADD_OR_REPLACE = 1,
391 KEY_REMOVE = 2,
392 KEY_SET_ID = 3,
393 MAX_KEY_ACTION = 0xffff,
394};
395
Eliad Pellerc690ec82011-08-14 13:17:07 +0300396enum wl1271_cmd_lid_key_type {
397 UNICAST_LID_TYPE = 0,
398 BROADCAST_LID_TYPE = 1,
399 WEP_DEFAULT_LID_TYPE = 2
400};
401
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300402enum wl1271_cmd_key_type {
403 KEY_NONE = 0,
404 KEY_WEP = 1,
405 KEY_TKIP = 2,
406 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200407 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300408};
409
Eliad Pellerc690ec82011-08-14 13:17:07 +0300410struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200411 struct wl1271_cmd_header header;
412
413 /*
414 * Indicates whether the HLID is a unicast key set
415 * or broadcast key set. A special value 0xFF is
416 * used to indicate that the HLID is on WEP-default
417 * (multi-hlids). of type wl1271_cmd_lid_key_type.
418 */
419 u8 hlid;
420
421 /*
422 * In WEP-default network (hlid == 0xFF) used to
423 * indicate which network STA/IBSS/AP role should be
424 * changed
425 */
426 u8 lid_key_type;
427
428 /*
429 * Key ID - For TKIP and AES key types, this field
430 * indicates the value that should be inserted into
431 * the KeyID field of frames transmitted using this
432 * key entry. For broadcast keys the index use as a
433 * marker for TX/RX key.
434 * For WEP default network (HLID=0xFF), this field
435 * indicates the ID of the key to add or remove.
436 */
437 u8 key_id;
438 u8 reserved_1;
439
440 /* key_action_e */
441 __le16 key_action;
442
443 /* key size in bytes */
444 u8 key_size;
445
446 /* key_type_e */
447 u8 key_type;
448
449 /* This field holds the security key data to add to the STA table */
450 u8 key[MAX_KEY_SIZE];
451 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
452 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
453} __packed;
454
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300455struct wl1271_cmd_test_header {
456 u8 id;
457 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000458} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300459
460enum wl1271_channel_tune_bands {
461 WL1271_CHANNEL_TUNE_BAND_2_4,
462 WL1271_CHANNEL_TUNE_BAND_5,
463 WL1271_CHANNEL_TUNE_BAND_4_9
464};
465
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200466#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300467
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200468#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
469#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
470#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200471
472struct wl1271_general_parms_cmd {
473 struct wl1271_cmd_header header;
474
475 struct wl1271_cmd_test_header test;
476
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300477 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200478
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300479 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
480 u8 sr_sen_n_p;
481 u8 sr_sen_n_p_gain;
482 u8 sr_sen_nrn;
483 u8 sr_sen_prn;
484 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700485} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200486
Shahar Levi49d750ca2011-03-06 16:32:09 +0200487struct wl128x_general_parms_cmd {
488 struct wl1271_cmd_header header;
489
490 struct wl1271_cmd_test_header test;
491
492 struct wl128x_ini_general_params general_params;
493
494 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
495 u8 sr_sen_n_p;
496 u8 sr_sen_n_p_gain;
497 u8 sr_sen_nrn;
498 u8 sr_sen_prn;
499 u8 padding[3];
500} __packed;
501
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200502struct wl1271_radio_parms_cmd {
503 struct wl1271_cmd_header header;
504
505 struct wl1271_cmd_test_header test;
506
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300507 /* Static radio parameters */
508 struct wl1271_ini_band_params_2 static_params_2;
509 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200510
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300511 /* Dynamic radio parameters */
512 struct wl1271_ini_fem_params_2 dyn_params_2;
513 u8 padding2;
514 struct wl1271_ini_fem_params_5 dyn_params_5;
515 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000516} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300517
Shahar Levi49d750ca2011-03-06 16:32:09 +0200518struct wl128x_radio_parms_cmd {
519 struct wl1271_cmd_header header;
520
521 struct wl1271_cmd_test_header test;
522
523 /* Static radio parameters */
524 struct wl128x_ini_band_params_2 static_params_2;
525 struct wl128x_ini_band_params_5 static_params_5;
526
527 u8 fem_vendor_and_options;
528
529 /* Dynamic radio parameters */
530 struct wl128x_ini_fem_params_2 dyn_params_2;
531 u8 padding2;
532 struct wl128x_ini_fem_params_5 dyn_params_5;
533} __packed;
534
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200535struct wl1271_ext_radio_parms_cmd {
536 struct wl1271_cmd_header header;
537
538 struct wl1271_cmd_test_header test;
539
540 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
541 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
542 u8 padding[3];
543} __packed;
544
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300545/*
546 * There are three types of disconnections:
547 *
548 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
549 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
550 * we have passed
551 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
552 * we have passed
553 */
554enum wl1271_disconnect_type {
555 DISCONNECT_IMMEDIATE,
556 DISCONNECT_DEAUTH,
557 DISCONNECT_DISASSOC
558};
559
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300560#define WL1271_CMD_STA_STATE_CONNECTED 1
561
Eliad Pellerc690ec82011-08-14 13:17:07 +0300562struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300563 struct wl1271_cmd_header header;
564
Eliad Pellerc690ec82011-08-14 13:17:07 +0300565 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300566 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300567 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300568} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300569
Eliad Pellera7cba382011-08-14 13:17:16 +0300570struct wl12xx_cmd_roc {
571 struct wl1271_cmd_header header;
572
573 u8 role_id;
574 u8 channel;
575 u8 band;
576 u8 padding;
577};
578
579struct wl12xx_cmd_croc {
580 struct wl1271_cmd_header header;
581
582 u8 role_id;
583 u8 padding[3];
584};
585
Eliad Pellerc690ec82011-08-14 13:17:07 +0300586enum wl12xx_ssid_type {
587 WL12XX_SSID_TYPE_PUBLIC = 0,
588 WL12XX_SSID_TYPE_HIDDEN = 1,
589 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200590};
591
Eliad Pellerc690ec82011-08-14 13:17:07 +0300592struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200593 struct wl1271_cmd_header header;
594
595 u8 addr[ETH_ALEN];
596 u8 hlid;
597 u8 aid;
598 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
599 __le32 supported_rates;
600 u8 bss_index;
601 u8 sp_len;
602 u8 wmm;
603 u8 padding1;
604} __packed;
605
Eliad Pellerc690ec82011-08-14 13:17:07 +0300606struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200607 struct wl1271_cmd_header header;
608
609 u8 hlid;
610 u8 reason_opcode;
611 u8 send_deauth_flag;
612 u8 padding1;
613} __packed;
614
Ido Yariv95dac04f2011-06-06 14:57:06 +0300615/*
616 * Continuous mode - packets are transferred to the host periodically
617 * via the data path.
618 * On demand - Log messages are stored in a cyclic buffer in the
619 * firmware, and only transferred to the host when explicitly requested
620 */
621enum wl12xx_fwlogger_log_mode {
622 WL12XX_FWLOG_CONTINUOUS,
623 WL12XX_FWLOG_ON_DEMAND
624};
625
626/* Include/exclude timestamps from the log messages */
627enum wl12xx_fwlogger_timestamp {
628 WL12XX_FWLOG_TIMESTAMP_DISABLED,
629 WL12XX_FWLOG_TIMESTAMP_ENABLED
630};
631
632/*
633 * Logs can be routed to the debug pinouts (where available), to the host bus
634 * (SDIO/SPI), or dropped
635 */
636enum wl12xx_fwlogger_output {
637 WL12XX_FWLOG_OUTPUT_NONE,
638 WL12XX_FWLOG_OUTPUT_DBG_PINS,
639 WL12XX_FWLOG_OUTPUT_HOST,
640};
641
642struct wl12xx_cmd_config_fwlog {
643 struct wl1271_cmd_header header;
644
645 /* See enum wl12xx_fwlogger_log_mode */
646 u8 logger_mode;
647
648 /* Minimum log level threshold */
649 u8 log_severity;
650
651 /* Include/exclude timestamps from the log messages */
652 u8 timestamp;
653
654 /* See enum wl1271_fwlogger_output */
655 u8 output;
656
657 /* Regulates the frequency of log messages */
658 u8 threshold;
659
660 u8 padding[3];
661} __packed;
662
663struct wl12xx_cmd_start_fwlog {
664 struct wl1271_cmd_header header;
665} __packed;
666
667struct wl12xx_cmd_stop_fwlog {
668 struct wl1271_cmd_header header;
669} __packed;
670
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300671#endif /* __WL1271_CMD_H__ */