blob: d2670d379b756993c7bf28abf1b65bd740d54d6d [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 Peller7edebf52011-10-05 11:55:52 +020042int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
43int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020044int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller0603d892011-10-05 11:55:51 +020045int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020046int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller0603d892011-10-05 11:55:51 +020047int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020048int wl12xx_cmd_role_start_ibss(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 Oikarinen65cddbf12010-08-24 06:28:03 +030055int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
56 size_t len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030057int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030058 void *buf, size_t buf_len, int index, u32 rates);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020059int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020060int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
61 u16 aid);
Kalle Valo818e3062010-03-18 12:26:35 +020062int wl1271_cmd_build_probe_req(struct wl1271 *wl,
63 const u8 *ssid, size_t ssid_len,
64 const u8 *ie, size_t ie_len, u8 band);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020065struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
66 struct sk_buff *skb);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020067int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
68 __be32 ip_addr);
Eliad Peller784f6942011-10-05 11:55:39 +020069int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020070int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
71 struct wl12xx_vif *wlvif);
Eliad Pellerc690ec82011-08-14 13:17:07 +030072int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Eliad Pellera8ab39a2011-10-05 11:55:54 +020073int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
Eliad Peller154da672011-10-05 11:55:53 +020074 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020075 u8 key_size, const u8 *key, const u8 *addr,
76 u32 tx_seq_32, u16 tx_seq_16);
Eliad Pellera8ab39a2011-10-05 11:55:54 +020077int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
78 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020079 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
80 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030081int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller251c1772011-08-14 13:17:17 +030082int wl12xx_roc(struct wl1271 *wl, u8 role_id);
83int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030084int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
85int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030086int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
87int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
88int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Shahar Levi6d158ff2011-09-08 13:01:33 +030089int wl12xx_cmd_channel_switch(struct wl1271 *wl,
90 struct ieee80211_channel_switch *ch_switch);
91int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl);
Eliad Pellerc7ffb902011-10-05 11:56:05 +020092int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif,
93 u8 *hlid);
94void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030095
96enum wl1271_commands {
97 CMD_INTERROGATE = 1, /*use this to read information elements*/
98 CMD_CONFIGURE = 2, /*use this to write information elements*/
99 CMD_ENABLE_RX = 3,
100 CMD_ENABLE_TX = 4,
101 CMD_DISABLE_RX = 5,
102 CMD_DISABLE_TX = 6,
103 CMD_SCAN = 8,
104 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300105 CMD_SET_KEYS = 12,
106 CMD_READ_MEMORY = 13,
107 CMD_WRITE_MEMORY = 14,
108 CMD_SET_TEMPLATE = 19,
109 CMD_TEST = 23,
110 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300111 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300112 CMD_SET_BCN_MODE = 33,
113 CMD_MEASUREMENT = 34,
114 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300115 CMD_SET_PS_MODE = 37,
116 CMD_CHANNEL_SWITCH = 38,
117 CMD_STOP_CHANNEL_SWICTH = 39,
118 CMD_AP_DISCOVERY = 40,
119 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300120 CMD_HEALTH_CHECK = 45,
121 CMD_DEBUG = 46,
122 CMD_TRIGGER_SCAN_TO = 47,
123 CMD_CONNECTION_SCAN_CFG = 48,
124 CMD_CONNECTION_SCAN_SSID_CFG = 49,
125 CMD_START_PERIODIC_SCAN = 50,
126 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300127 CMD_SET_PEER_STATE = 52,
128 CMD_REMAIN_ON_CHANNEL = 53,
129 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300130
Eliad Pellerc690ec82011-08-14 13:17:07 +0300131 CMD_CONFIG_FWLOGGER = 55,
132 CMD_START_FWLOGGER = 56,
133 CMD_STOP_FWLOGGER = 57,
134
135 /* AP commands */
136 CMD_ADD_PEER = 62,
137 CMD_REMOVE_PEER = 63,
138
139 /* Role API */
140 CMD_ROLE_ENABLE = 70,
141 CMD_ROLE_DISABLE = 71,
142 CMD_ROLE_START = 72,
143 CMD_ROLE_STOP = 73,
144
145 /* WIFI Direct */
146 CMD_WFD_START_DISCOVERY = 80,
147 CMD_WFD_STOP_DISCOVERY = 81,
148 CMD_WFD_ATTRIBUTE_CONFIG = 82,
149
150 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200151
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300152 NUM_COMMANDS,
153 MAX_COMMAND_ID = 0xFFFF,
154};
155
156#define MAX_CMD_PARAMS 572
157
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200158enum {
159 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
160 CMD_TEMPL_KLV_IDX_MAX = 4
161};
162
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300163enum cmd_templ {
164 CMD_TEMPL_NULL_DATA = 0,
165 CMD_TEMPL_BEACON,
166 CMD_TEMPL_CFG_PROBE_REQ_2_4,
167 CMD_TEMPL_CFG_PROBE_REQ_5,
168 CMD_TEMPL_PROBE_RESPONSE,
169 CMD_TEMPL_QOS_NULL_DATA,
170 CMD_TEMPL_PS_POLL,
171 CMD_TEMPL_KLV,
172 CMD_TEMPL_DISCONNECT,
173 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
174 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
175 CMD_TEMPL_BAR, /* for firmware internal use only */
176 CMD_TEMPL_CTS, /*
177 * For CTS-to-self (FastCTS) mechanism
178 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300179 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200180 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300181 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200182 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300183 CMD_TEMPL_TEMPORARY,
184 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200185
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300186 CMD_TEMPL_MAX = 0xff
187};
188
189/* unit ms */
190#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300191#define WL1271_CMD_TEMPL_DFLT_SIZE 252
192#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300193#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300194
195struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300196 __le16 id;
197 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300198 /* payload */
199 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000200} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300201
202#define WL1271_CMD_MAX_PARAMS 572
203
204struct wl1271_command {
205 struct wl1271_cmd_header header;
206 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000207} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300208
209enum {
210 CMD_MAILBOX_IDLE = 0,
211 CMD_STATUS_SUCCESS = 1,
212 CMD_STATUS_UNKNOWN_CMD = 2,
213 CMD_STATUS_UNKNOWN_IE = 3,
214 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
215 CMD_STATUS_RX_BUSY = 13,
216 CMD_STATUS_INVALID_PARAM = 14,
217 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
218 CMD_STATUS_OUT_OF_MEMORY = 16,
219 CMD_STATUS_STA_TABLE_FULL = 17,
220 CMD_STATUS_RADIO_ERROR = 18,
221 CMD_STATUS_WRONG_NESTING = 19,
222 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
223 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300224 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300225 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300226 MAX_COMMAND_STATUS = 0xff
227};
228
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300229#define CMDMBOX_HEADER_LEN 4
230#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
231
232enum {
233 BSS_TYPE_IBSS = 0,
234 BSS_TYPE_STA_BSS = 2,
235 BSS_TYPE_AP_BSS = 3,
236 MAX_BSS_TYPE = 0xFF
237};
238
239#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
240#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300241#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300242
Eliad Pellerc690ec82011-08-14 13:17:07 +0300243struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300244 struct wl1271_cmd_header header;
245
Eliad Pellerc690ec82011-08-14 13:17:07 +0300246 u8 role_id;
247 u8 role_type;
248 u8 mac_address[ETH_ALEN];
249} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300250
Eliad Pellerc690ec82011-08-14 13:17:07 +0300251struct wl12xx_cmd_role_disable {
252 struct wl1271_cmd_header header;
253
254 u8 role_id;
255 u8 padding[3];
256} __packed;
257
258enum wl12xx_band {
259 WL12XX_BAND_2_4GHZ = 0,
260 WL12XX_BAND_5GHZ = 1,
261 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
262 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
263 WL12XX_BAND_INVALID = 0x7E,
264 WL12XX_BAND_MAX_RADIO = 0x7F,
265};
266
267struct wl12xx_cmd_role_start {
268 struct wl1271_cmd_header header;
269
270 u8 role_id;
271 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300272 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300273 u8 padding;
274
275 union {
276 struct {
277 u8 hlid;
278 u8 session;
279 u8 padding_1[54];
280 } __packed device;
281 /* sta & p2p_cli use the same struct */
282 struct {
283 u8 bssid[ETH_ALEN];
284 u8 hlid; /* data hlid */
285 u8 session;
286 __le32 remote_rates; /* remote supported rates */
287
288 /*
289 * The target uses this field to determine the rate at
290 * which to transmit control frame responses (such as
291 * ACK or CTS frames).
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 } __packed sta;
302 struct {
303 u8 bssid[ETH_ALEN];
304 u8 hlid; /* data hlid */
305 u8 dtim_interval;
306 __le32 remote_rates; /* remote supported rates */
307
308 __le32 basic_rate_set;
309 __le32 local_rates; /* local supported rates */
310
311 u8 ssid_type;
312 u8 ssid_len;
313 u8 ssid[IEEE80211_MAX_SSID_LEN];
314
315 __le16 beacon_interval; /* in TBTTs */
316
317 u8 padding_1[4];
318 } __packed ibss;
319 /* ap & p2p_go use the same struct */
320 struct {
321 __le16 aging_period; /* in secs */
322 u8 beacon_expiry; /* in ms */
323 u8 bss_index;
324 /* The host link id for the AP's global queue */
325 u8 global_hlid;
326 /* The host link id for the AP's broadcast queue */
327 u8 broadcast_hlid;
328
329 __le16 beacon_interval; /* in TBTTs */
330
331 __le32 basic_rate_set;
332 __le32 local_rates; /* local supported rates */
333
334 u8 dtim_interval;
335
336 u8 ssid_type;
337 u8 ssid_len;
338 u8 ssid[IEEE80211_MAX_SSID_LEN];
339
340 u8 padding_1[5];
341 } __packed ap;
342 };
343} __packed;
344
345struct wl12xx_cmd_role_stop {
346 struct wl1271_cmd_header header;
347
348 u8 role_id;
349 u8 disc_type; /* only STA and P2P_CLI */
350 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000351} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300352
353struct cmd_enabledisable_path {
354 struct wl1271_cmd_header header;
355
356 u8 channel;
357 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000358} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300359
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300360#define WL1271_RATE_AUTOMATIC 0
361
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300362struct wl1271_cmd_template_set {
363 struct wl1271_cmd_header header;
364
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300365 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300366 u8 template_type;
367 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300368 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300369 u8 short_retry_limit;
370 u8 long_retry_limit;
371 u8 aflags;
372 u8 reserved;
373 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000374} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300375
376#define TIM_ELE_ID 5
377#define PARTIAL_VBM_MAX 251
378
379struct wl1271_tim {
380 u8 identity;
381 u8 length;
382 u8 dtim_count;
383 u8 dtim_period;
384 u8 bitmap_ctrl;
385 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000386} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300387
388enum wl1271_cmd_ps_mode {
389 STATION_ACTIVE_MODE,
390 STATION_POWER_SAVE_MODE
391};
392
393struct wl1271_cmd_ps_params {
394 struct wl1271_cmd_header header;
395
Eliad Pellerc690ec82011-08-14 13:17:07 +0300396 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300397 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300398 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000399} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300400
401/* HW encryption keys */
402#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300403
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300404enum wl1271_cmd_key_action {
405 KEY_ADD_OR_REPLACE = 1,
406 KEY_REMOVE = 2,
407 KEY_SET_ID = 3,
408 MAX_KEY_ACTION = 0xffff,
409};
410
Eliad Pellerc690ec82011-08-14 13:17:07 +0300411enum wl1271_cmd_lid_key_type {
412 UNICAST_LID_TYPE = 0,
413 BROADCAST_LID_TYPE = 1,
414 WEP_DEFAULT_LID_TYPE = 2
415};
416
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300417enum wl1271_cmd_key_type {
418 KEY_NONE = 0,
419 KEY_WEP = 1,
420 KEY_TKIP = 2,
421 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200422 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300423};
424
Eliad Pellerc690ec82011-08-14 13:17:07 +0300425struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200426 struct wl1271_cmd_header header;
427
428 /*
429 * Indicates whether the HLID is a unicast key set
430 * or broadcast key set. A special value 0xFF is
431 * used to indicate that the HLID is on WEP-default
432 * (multi-hlids). of type wl1271_cmd_lid_key_type.
433 */
434 u8 hlid;
435
436 /*
437 * In WEP-default network (hlid == 0xFF) used to
438 * indicate which network STA/IBSS/AP role should be
439 * changed
440 */
441 u8 lid_key_type;
442
443 /*
444 * Key ID - For TKIP and AES key types, this field
445 * indicates the value that should be inserted into
446 * the KeyID field of frames transmitted using this
447 * key entry. For broadcast keys the index use as a
448 * marker for TX/RX key.
449 * For WEP default network (HLID=0xFF), this field
450 * indicates the ID of the key to add or remove.
451 */
452 u8 key_id;
453 u8 reserved_1;
454
455 /* key_action_e */
456 __le16 key_action;
457
458 /* key size in bytes */
459 u8 key_size;
460
461 /* key_type_e */
462 u8 key_type;
463
464 /* This field holds the security key data to add to the STA table */
465 u8 key[MAX_KEY_SIZE];
466 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
467 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
468} __packed;
469
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300470struct wl1271_cmd_test_header {
471 u8 id;
472 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000473} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300474
475enum wl1271_channel_tune_bands {
476 WL1271_CHANNEL_TUNE_BAND_2_4,
477 WL1271_CHANNEL_TUNE_BAND_5,
478 WL1271_CHANNEL_TUNE_BAND_4_9
479};
480
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200481#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300482
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200483#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
484#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
485#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200486
487struct wl1271_general_parms_cmd {
488 struct wl1271_cmd_header header;
489
490 struct wl1271_cmd_test_header test;
491
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300492 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200493
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300494 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];
David S. Miller14599f12010-06-11 11:34:06 -0700500} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200501
Shahar Levi49d750ca2011-03-06 16:32:09 +0200502struct wl128x_general_parms_cmd {
503 struct wl1271_cmd_header header;
504
505 struct wl1271_cmd_test_header test;
506
507 struct wl128x_ini_general_params general_params;
508
509 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
510 u8 sr_sen_n_p;
511 u8 sr_sen_n_p_gain;
512 u8 sr_sen_nrn;
513 u8 sr_sen_prn;
514 u8 padding[3];
515} __packed;
516
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200517struct wl1271_radio_parms_cmd {
518 struct wl1271_cmd_header header;
519
520 struct wl1271_cmd_test_header test;
521
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300522 /* Static radio parameters */
523 struct wl1271_ini_band_params_2 static_params_2;
524 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200525
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300526 /* Dynamic radio parameters */
527 struct wl1271_ini_fem_params_2 dyn_params_2;
528 u8 padding2;
529 struct wl1271_ini_fem_params_5 dyn_params_5;
530 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000531} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300532
Shahar Levi49d750ca2011-03-06 16:32:09 +0200533struct wl128x_radio_parms_cmd {
534 struct wl1271_cmd_header header;
535
536 struct wl1271_cmd_test_header test;
537
538 /* Static radio parameters */
539 struct wl128x_ini_band_params_2 static_params_2;
540 struct wl128x_ini_band_params_5 static_params_5;
541
542 u8 fem_vendor_and_options;
543
544 /* Dynamic radio parameters */
545 struct wl128x_ini_fem_params_2 dyn_params_2;
546 u8 padding2;
547 struct wl128x_ini_fem_params_5 dyn_params_5;
548} __packed;
549
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200550struct wl1271_ext_radio_parms_cmd {
551 struct wl1271_cmd_header header;
552
553 struct wl1271_cmd_test_header test;
554
555 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
556 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
557 u8 padding[3];
558} __packed;
559
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300560/*
561 * There are three types of disconnections:
562 *
563 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
564 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
565 * we have passed
566 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
567 * we have passed
568 */
569enum wl1271_disconnect_type {
570 DISCONNECT_IMMEDIATE,
571 DISCONNECT_DEAUTH,
572 DISCONNECT_DISASSOC
573};
574
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300575#define WL1271_CMD_STA_STATE_CONNECTED 1
576
Eliad Pellerc690ec82011-08-14 13:17:07 +0300577struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300578 struct wl1271_cmd_header header;
579
Eliad Pellerc690ec82011-08-14 13:17:07 +0300580 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300581 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300582 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300583} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300584
Eliad Pellera7cba382011-08-14 13:17:16 +0300585struct wl12xx_cmd_roc {
586 struct wl1271_cmd_header header;
587
588 u8 role_id;
589 u8 channel;
590 u8 band;
591 u8 padding;
592};
593
594struct wl12xx_cmd_croc {
595 struct wl1271_cmd_header header;
596
597 u8 role_id;
598 u8 padding[3];
599};
600
Eliad Pellerc690ec82011-08-14 13:17:07 +0300601enum wl12xx_ssid_type {
602 WL12XX_SSID_TYPE_PUBLIC = 0,
603 WL12XX_SSID_TYPE_HIDDEN = 1,
604 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200605};
606
Eliad Peller1ec23f72011-08-25 14:26:54 +0300607enum wl1271_psd_type {
608 WL1271_PSD_LEGACY = 0,
609 WL1271_PSD_UPSD_TRIGGER = 1,
610 WL1271_PSD_LEGACY_PSPOLL = 2,
611 WL1271_PSD_SAPSD = 3
612};
613
Eliad Pellerc690ec82011-08-14 13:17:07 +0300614struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200615 struct wl1271_cmd_header header;
616
617 u8 addr[ETH_ALEN];
618 u8 hlid;
619 u8 aid;
620 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
621 __le32 supported_rates;
622 u8 bss_index;
623 u8 sp_len;
624 u8 wmm;
625 u8 padding1;
626} __packed;
627
Eliad Pellerc690ec82011-08-14 13:17:07 +0300628struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200629 struct wl1271_cmd_header header;
630
631 u8 hlid;
632 u8 reason_opcode;
633 u8 send_deauth_flag;
634 u8 padding1;
635} __packed;
636
Ido Yariv95dac04f2011-06-06 14:57:06 +0300637/*
638 * Continuous mode - packets are transferred to the host periodically
639 * via the data path.
640 * On demand - Log messages are stored in a cyclic buffer in the
641 * firmware, and only transferred to the host when explicitly requested
642 */
643enum wl12xx_fwlogger_log_mode {
644 WL12XX_FWLOG_CONTINUOUS,
645 WL12XX_FWLOG_ON_DEMAND
646};
647
648/* Include/exclude timestamps from the log messages */
649enum wl12xx_fwlogger_timestamp {
650 WL12XX_FWLOG_TIMESTAMP_DISABLED,
651 WL12XX_FWLOG_TIMESTAMP_ENABLED
652};
653
654/*
655 * Logs can be routed to the debug pinouts (where available), to the host bus
656 * (SDIO/SPI), or dropped
657 */
658enum wl12xx_fwlogger_output {
659 WL12XX_FWLOG_OUTPUT_NONE,
660 WL12XX_FWLOG_OUTPUT_DBG_PINS,
661 WL12XX_FWLOG_OUTPUT_HOST,
662};
663
664struct wl12xx_cmd_config_fwlog {
665 struct wl1271_cmd_header header;
666
667 /* See enum wl12xx_fwlogger_log_mode */
668 u8 logger_mode;
669
670 /* Minimum log level threshold */
671 u8 log_severity;
672
673 /* Include/exclude timestamps from the log messages */
674 u8 timestamp;
675
676 /* See enum wl1271_fwlogger_output */
677 u8 output;
678
679 /* Regulates the frequency of log messages */
680 u8 threshold;
681
682 u8 padding[3];
683} __packed;
684
685struct wl12xx_cmd_start_fwlog {
686 struct wl1271_cmd_header header;
687} __packed;
688
689struct wl12xx_cmd_stop_fwlog {
690 struct wl1271_cmd_header header;
691} __packed;
692
Shahar Levi6d158ff2011-09-08 13:01:33 +0300693struct wl12xx_cmd_channel_switch {
694 struct wl1271_cmd_header header;
695
696 /* The new serving channel */
697 u8 channel;
698 /* Relative time of the serving channel switch in TBTT units */
699 u8 switch_time;
700 /* 1: Suspend TX till switch time; 0: Do not suspend TX */
701 u8 tx_suspend;
702 /* 1: Flush TX at switch time; 0: Do not flush */
703 u8 flush;
704} __packed;
705
706struct wl12xx_cmd_stop_channel_switch {
707 struct wl1271_cmd_header header;
708} __packed;
709
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300710#endif /* __WL1271_CMD_H__ */