blob: 8182cf1b48616aba122c80ed249bad67e2e92f38 [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 Oikarinen65cddbf2010-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);
Eliad Peller83587502011-10-10 10:12:53 +020062int wl1271_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
Kalle Valo818e3062010-03-18 12:26:35 +020063 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,
Eliad Peller83587502011-10-10 10:12:53 +020066 struct wl12xx_vif *wlvif,
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020067 struct sk_buff *skb);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020068int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
69 __be32 ip_addr);
Eliad Peller784f6942011-10-05 11:55:39 +020070int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020071int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
72 struct wl12xx_vif *wlvif);
Eliad Pellerc690ec82011-08-14 13:17:07 +030073int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Eliad Pellera8ab39a2011-10-05 11:55:54 +020074int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
Eliad Peller154da672011-10-05 11:55:53 +020075 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020076 u8 key_size, const u8 *key, const u8 *addr,
77 u32 tx_seq_32, u16 tx_seq_16);
Eliad Pellera8ab39a2011-10-05 11:55:54 +020078int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
79 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020080 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
81 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030082int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller251c1772011-08-14 13:17:17 +030083int wl12xx_roc(struct wl1271 *wl, u8 role_id);
84int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030085int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
86int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030087int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
88int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
89int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Shahar Levi6d158ff2011-09-08 13:01:33 +030090int wl12xx_cmd_channel_switch(struct wl1271 *wl,
91 struct ieee80211_channel_switch *ch_switch);
92int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl);
Eliad Pellerc7ffb902011-10-05 11:56:05 +020093int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif,
94 u8 *hlid);
95void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030096
97enum wl1271_commands {
98 CMD_INTERROGATE = 1, /*use this to read information elements*/
99 CMD_CONFIGURE = 2, /*use this to write information elements*/
100 CMD_ENABLE_RX = 3,
101 CMD_ENABLE_TX = 4,
102 CMD_DISABLE_RX = 5,
103 CMD_DISABLE_TX = 6,
104 CMD_SCAN = 8,
105 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300106 CMD_SET_KEYS = 12,
107 CMD_READ_MEMORY = 13,
108 CMD_WRITE_MEMORY = 14,
109 CMD_SET_TEMPLATE = 19,
110 CMD_TEST = 23,
111 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300112 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300113 CMD_SET_BCN_MODE = 33,
114 CMD_MEASUREMENT = 34,
115 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300116 CMD_SET_PS_MODE = 37,
117 CMD_CHANNEL_SWITCH = 38,
118 CMD_STOP_CHANNEL_SWICTH = 39,
119 CMD_AP_DISCOVERY = 40,
120 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300121 CMD_HEALTH_CHECK = 45,
122 CMD_DEBUG = 46,
123 CMD_TRIGGER_SCAN_TO = 47,
124 CMD_CONNECTION_SCAN_CFG = 48,
125 CMD_CONNECTION_SCAN_SSID_CFG = 49,
126 CMD_START_PERIODIC_SCAN = 50,
127 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300128 CMD_SET_PEER_STATE = 52,
129 CMD_REMAIN_ON_CHANNEL = 53,
130 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300131
Eliad Pellerc690ec82011-08-14 13:17:07 +0300132 CMD_CONFIG_FWLOGGER = 55,
133 CMD_START_FWLOGGER = 56,
134 CMD_STOP_FWLOGGER = 57,
135
136 /* AP commands */
137 CMD_ADD_PEER = 62,
138 CMD_REMOVE_PEER = 63,
139
140 /* Role API */
141 CMD_ROLE_ENABLE = 70,
142 CMD_ROLE_DISABLE = 71,
143 CMD_ROLE_START = 72,
144 CMD_ROLE_STOP = 73,
145
146 /* WIFI Direct */
147 CMD_WFD_START_DISCOVERY = 80,
148 CMD_WFD_STOP_DISCOVERY = 81,
149 CMD_WFD_ATTRIBUTE_CONFIG = 82,
150
151 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200152
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300153 NUM_COMMANDS,
154 MAX_COMMAND_ID = 0xFFFF,
155};
156
157#define MAX_CMD_PARAMS 572
158
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200159enum {
160 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
161 CMD_TEMPL_KLV_IDX_MAX = 4
162};
163
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300164enum cmd_templ {
165 CMD_TEMPL_NULL_DATA = 0,
166 CMD_TEMPL_BEACON,
167 CMD_TEMPL_CFG_PROBE_REQ_2_4,
168 CMD_TEMPL_CFG_PROBE_REQ_5,
169 CMD_TEMPL_PROBE_RESPONSE,
170 CMD_TEMPL_QOS_NULL_DATA,
171 CMD_TEMPL_PS_POLL,
172 CMD_TEMPL_KLV,
173 CMD_TEMPL_DISCONNECT,
174 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
175 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
176 CMD_TEMPL_BAR, /* for firmware internal use only */
177 CMD_TEMPL_CTS, /*
178 * For CTS-to-self (FastCTS) mechanism
179 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300180 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200181 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300182 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200183 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300184 CMD_TEMPL_TEMPORARY,
185 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200186
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300187 CMD_TEMPL_MAX = 0xff
188};
189
190/* unit ms */
191#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300192#define WL1271_CMD_TEMPL_DFLT_SIZE 252
193#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300194#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300195
196struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300197 __le16 id;
198 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300199 /* payload */
200 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000201} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300202
203#define WL1271_CMD_MAX_PARAMS 572
204
205struct wl1271_command {
206 struct wl1271_cmd_header header;
207 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000208} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300209
210enum {
211 CMD_MAILBOX_IDLE = 0,
212 CMD_STATUS_SUCCESS = 1,
213 CMD_STATUS_UNKNOWN_CMD = 2,
214 CMD_STATUS_UNKNOWN_IE = 3,
215 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
216 CMD_STATUS_RX_BUSY = 13,
217 CMD_STATUS_INVALID_PARAM = 14,
218 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
219 CMD_STATUS_OUT_OF_MEMORY = 16,
220 CMD_STATUS_STA_TABLE_FULL = 17,
221 CMD_STATUS_RADIO_ERROR = 18,
222 CMD_STATUS_WRONG_NESTING = 19,
223 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
224 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300225 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300226 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300227 MAX_COMMAND_STATUS = 0xff
228};
229
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300230#define CMDMBOX_HEADER_LEN 4
231#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
232
233enum {
234 BSS_TYPE_IBSS = 0,
235 BSS_TYPE_STA_BSS = 2,
236 BSS_TYPE_AP_BSS = 3,
237 MAX_BSS_TYPE = 0xFF
238};
239
240#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
241#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300242#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300243
Eliad Pellerc690ec82011-08-14 13:17:07 +0300244struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300245 struct wl1271_cmd_header header;
246
Eliad Pellerc690ec82011-08-14 13:17:07 +0300247 u8 role_id;
248 u8 role_type;
249 u8 mac_address[ETH_ALEN];
250} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300251
Eliad Pellerc690ec82011-08-14 13:17:07 +0300252struct wl12xx_cmd_role_disable {
253 struct wl1271_cmd_header header;
254
255 u8 role_id;
256 u8 padding[3];
257} __packed;
258
259enum wl12xx_band {
260 WL12XX_BAND_2_4GHZ = 0,
261 WL12XX_BAND_5GHZ = 1,
262 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
263 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
264 WL12XX_BAND_INVALID = 0x7E,
265 WL12XX_BAND_MAX_RADIO = 0x7F,
266};
267
268struct wl12xx_cmd_role_start {
269 struct wl1271_cmd_header header;
270
271 u8 role_id;
272 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300273 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300274 u8 padding;
275
276 union {
277 struct {
278 u8 hlid;
279 u8 session;
280 u8 padding_1[54];
281 } __packed device;
282 /* sta & p2p_cli use the same struct */
283 struct {
284 u8 bssid[ETH_ALEN];
285 u8 hlid; /* data hlid */
286 u8 session;
287 __le32 remote_rates; /* remote supported rates */
288
289 /*
290 * The target uses this field to determine the rate at
291 * which to transmit control frame responses (such as
292 * ACK or CTS frames).
293 */
294 __le32 basic_rate_set;
295 __le32 local_rates; /* local supported rates */
296
297 u8 ssid_type;
298 u8 ssid_len;
299 u8 ssid[IEEE80211_MAX_SSID_LEN];
300
301 __le16 beacon_interval; /* in TBTTs */
302 } __packed sta;
303 struct {
304 u8 bssid[ETH_ALEN];
305 u8 hlid; /* data hlid */
306 u8 dtim_interval;
307 __le32 remote_rates; /* remote supported rates */
308
309 __le32 basic_rate_set;
310 __le32 local_rates; /* local supported rates */
311
312 u8 ssid_type;
313 u8 ssid_len;
314 u8 ssid[IEEE80211_MAX_SSID_LEN];
315
316 __le16 beacon_interval; /* in TBTTs */
317
318 u8 padding_1[4];
319 } __packed ibss;
320 /* ap & p2p_go use the same struct */
321 struct {
322 __le16 aging_period; /* in secs */
323 u8 beacon_expiry; /* in ms */
324 u8 bss_index;
325 /* The host link id for the AP's global queue */
326 u8 global_hlid;
327 /* The host link id for the AP's broadcast queue */
328 u8 broadcast_hlid;
329
330 __le16 beacon_interval; /* in TBTTs */
331
332 __le32 basic_rate_set;
333 __le32 local_rates; /* local supported rates */
334
335 u8 dtim_interval;
336
337 u8 ssid_type;
338 u8 ssid_len;
339 u8 ssid[IEEE80211_MAX_SSID_LEN];
340
341 u8 padding_1[5];
342 } __packed ap;
343 };
344} __packed;
345
346struct wl12xx_cmd_role_stop {
347 struct wl1271_cmd_header header;
348
349 u8 role_id;
350 u8 disc_type; /* only STA and P2P_CLI */
351 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000352} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300353
354struct cmd_enabledisable_path {
355 struct wl1271_cmd_header header;
356
357 u8 channel;
358 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000359} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300360
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300361#define WL1271_RATE_AUTOMATIC 0
362
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300363struct wl1271_cmd_template_set {
364 struct wl1271_cmd_header header;
365
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300366 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300367 u8 template_type;
368 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300369 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300370 u8 short_retry_limit;
371 u8 long_retry_limit;
372 u8 aflags;
373 u8 reserved;
374 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000375} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300376
377#define TIM_ELE_ID 5
378#define PARTIAL_VBM_MAX 251
379
380struct wl1271_tim {
381 u8 identity;
382 u8 length;
383 u8 dtim_count;
384 u8 dtim_period;
385 u8 bitmap_ctrl;
386 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000387} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300388
389enum wl1271_cmd_ps_mode {
390 STATION_ACTIVE_MODE,
391 STATION_POWER_SAVE_MODE
392};
393
394struct wl1271_cmd_ps_params {
395 struct wl1271_cmd_header header;
396
Eliad Pellerc690ec82011-08-14 13:17:07 +0300397 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300398 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300399 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000400} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300401
402/* HW encryption keys */
403#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300404
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300405enum wl1271_cmd_key_action {
406 KEY_ADD_OR_REPLACE = 1,
407 KEY_REMOVE = 2,
408 KEY_SET_ID = 3,
409 MAX_KEY_ACTION = 0xffff,
410};
411
Eliad Pellerc690ec82011-08-14 13:17:07 +0300412enum wl1271_cmd_lid_key_type {
413 UNICAST_LID_TYPE = 0,
414 BROADCAST_LID_TYPE = 1,
415 WEP_DEFAULT_LID_TYPE = 2
416};
417
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300418enum wl1271_cmd_key_type {
419 KEY_NONE = 0,
420 KEY_WEP = 1,
421 KEY_TKIP = 2,
422 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200423 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300424};
425
Eliad Pellerc690ec82011-08-14 13:17:07 +0300426struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200427 struct wl1271_cmd_header header;
428
429 /*
430 * Indicates whether the HLID is a unicast key set
431 * or broadcast key set. A special value 0xFF is
432 * used to indicate that the HLID is on WEP-default
433 * (multi-hlids). of type wl1271_cmd_lid_key_type.
434 */
435 u8 hlid;
436
437 /*
438 * In WEP-default network (hlid == 0xFF) used to
439 * indicate which network STA/IBSS/AP role should be
440 * changed
441 */
442 u8 lid_key_type;
443
444 /*
445 * Key ID - For TKIP and AES key types, this field
446 * indicates the value that should be inserted into
447 * the KeyID field of frames transmitted using this
448 * key entry. For broadcast keys the index use as a
449 * marker for TX/RX key.
450 * For WEP default network (HLID=0xFF), this field
451 * indicates the ID of the key to add or remove.
452 */
453 u8 key_id;
454 u8 reserved_1;
455
456 /* key_action_e */
457 __le16 key_action;
458
459 /* key size in bytes */
460 u8 key_size;
461
462 /* key_type_e */
463 u8 key_type;
464
465 /* This field holds the security key data to add to the STA table */
466 u8 key[MAX_KEY_SIZE];
467 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
468 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
469} __packed;
470
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300471struct wl1271_cmd_test_header {
472 u8 id;
473 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000474} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300475
476enum wl1271_channel_tune_bands {
477 WL1271_CHANNEL_TUNE_BAND_2_4,
478 WL1271_CHANNEL_TUNE_BAND_5,
479 WL1271_CHANNEL_TUNE_BAND_4_9
480};
481
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200482#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300483
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200484#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
485#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
486#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200487
488struct wl1271_general_parms_cmd {
489 struct wl1271_cmd_header header;
490
491 struct wl1271_cmd_test_header test;
492
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300493 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200494
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300495 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
496 u8 sr_sen_n_p;
497 u8 sr_sen_n_p_gain;
498 u8 sr_sen_nrn;
499 u8 sr_sen_prn;
500 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700501} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200502
Shahar Levi49d750ca2011-03-06 16:32:09 +0200503struct wl128x_general_parms_cmd {
504 struct wl1271_cmd_header header;
505
506 struct wl1271_cmd_test_header test;
507
508 struct wl128x_ini_general_params general_params;
509
510 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
511 u8 sr_sen_n_p;
512 u8 sr_sen_n_p_gain;
513 u8 sr_sen_nrn;
514 u8 sr_sen_prn;
515 u8 padding[3];
516} __packed;
517
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200518struct wl1271_radio_parms_cmd {
519 struct wl1271_cmd_header header;
520
521 struct wl1271_cmd_test_header test;
522
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300523 /* Static radio parameters */
524 struct wl1271_ini_band_params_2 static_params_2;
525 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200526
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300527 /* Dynamic radio parameters */
528 struct wl1271_ini_fem_params_2 dyn_params_2;
529 u8 padding2;
530 struct wl1271_ini_fem_params_5 dyn_params_5;
531 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000532} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300533
Shahar Levi49d750ca2011-03-06 16:32:09 +0200534struct wl128x_radio_parms_cmd {
535 struct wl1271_cmd_header header;
536
537 struct wl1271_cmd_test_header test;
538
539 /* Static radio parameters */
540 struct wl128x_ini_band_params_2 static_params_2;
541 struct wl128x_ini_band_params_5 static_params_5;
542
543 u8 fem_vendor_and_options;
544
545 /* Dynamic radio parameters */
546 struct wl128x_ini_fem_params_2 dyn_params_2;
547 u8 padding2;
548 struct wl128x_ini_fem_params_5 dyn_params_5;
549} __packed;
550
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200551struct wl1271_ext_radio_parms_cmd {
552 struct wl1271_cmd_header header;
553
554 struct wl1271_cmd_test_header test;
555
556 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
557 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
558 u8 padding[3];
559} __packed;
560
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300561/*
562 * There are three types of disconnections:
563 *
564 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
565 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
566 * we have passed
567 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
568 * we have passed
569 */
570enum wl1271_disconnect_type {
571 DISCONNECT_IMMEDIATE,
572 DISCONNECT_DEAUTH,
573 DISCONNECT_DISASSOC
574};
575
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300576#define WL1271_CMD_STA_STATE_CONNECTED 1
577
Eliad Pellerc690ec82011-08-14 13:17:07 +0300578struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300579 struct wl1271_cmd_header header;
580
Eliad Pellerc690ec82011-08-14 13:17:07 +0300581 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300582 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300583 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300584} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300585
Eliad Pellera7cba382011-08-14 13:17:16 +0300586struct wl12xx_cmd_roc {
587 struct wl1271_cmd_header header;
588
589 u8 role_id;
590 u8 channel;
591 u8 band;
592 u8 padding;
593};
594
595struct wl12xx_cmd_croc {
596 struct wl1271_cmd_header header;
597
598 u8 role_id;
599 u8 padding[3];
600};
601
Eliad Pellerc690ec82011-08-14 13:17:07 +0300602enum wl12xx_ssid_type {
603 WL12XX_SSID_TYPE_PUBLIC = 0,
604 WL12XX_SSID_TYPE_HIDDEN = 1,
605 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200606};
607
Eliad Peller1ec23f72011-08-25 14:26:54 +0300608enum wl1271_psd_type {
609 WL1271_PSD_LEGACY = 0,
610 WL1271_PSD_UPSD_TRIGGER = 1,
611 WL1271_PSD_LEGACY_PSPOLL = 2,
612 WL1271_PSD_SAPSD = 3
613};
614
Eliad Pellerc690ec82011-08-14 13:17:07 +0300615struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200616 struct wl1271_cmd_header header;
617
618 u8 addr[ETH_ALEN];
619 u8 hlid;
620 u8 aid;
621 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
622 __le32 supported_rates;
623 u8 bss_index;
624 u8 sp_len;
625 u8 wmm;
626 u8 padding1;
627} __packed;
628
Eliad Pellerc690ec82011-08-14 13:17:07 +0300629struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200630 struct wl1271_cmd_header header;
631
632 u8 hlid;
633 u8 reason_opcode;
634 u8 send_deauth_flag;
635 u8 padding1;
636} __packed;
637
Ido Yariv95dac04f2011-06-06 14:57:06 +0300638/*
639 * Continuous mode - packets are transferred to the host periodically
640 * via the data path.
641 * On demand - Log messages are stored in a cyclic buffer in the
642 * firmware, and only transferred to the host when explicitly requested
643 */
644enum wl12xx_fwlogger_log_mode {
645 WL12XX_FWLOG_CONTINUOUS,
646 WL12XX_FWLOG_ON_DEMAND
647};
648
649/* Include/exclude timestamps from the log messages */
650enum wl12xx_fwlogger_timestamp {
651 WL12XX_FWLOG_TIMESTAMP_DISABLED,
652 WL12XX_FWLOG_TIMESTAMP_ENABLED
653};
654
655/*
656 * Logs can be routed to the debug pinouts (where available), to the host bus
657 * (SDIO/SPI), or dropped
658 */
659enum wl12xx_fwlogger_output {
660 WL12XX_FWLOG_OUTPUT_NONE,
661 WL12XX_FWLOG_OUTPUT_DBG_PINS,
662 WL12XX_FWLOG_OUTPUT_HOST,
663};
664
665struct wl12xx_cmd_config_fwlog {
666 struct wl1271_cmd_header header;
667
668 /* See enum wl12xx_fwlogger_log_mode */
669 u8 logger_mode;
670
671 /* Minimum log level threshold */
672 u8 log_severity;
673
674 /* Include/exclude timestamps from the log messages */
675 u8 timestamp;
676
677 /* See enum wl1271_fwlogger_output */
678 u8 output;
679
680 /* Regulates the frequency of log messages */
681 u8 threshold;
682
683 u8 padding[3];
684} __packed;
685
686struct wl12xx_cmd_start_fwlog {
687 struct wl1271_cmd_header header;
688} __packed;
689
690struct wl12xx_cmd_stop_fwlog {
691 struct wl1271_cmd_header header;
692} __packed;
693
Shahar Levi6d158ff2011-09-08 13:01:33 +0300694struct wl12xx_cmd_channel_switch {
695 struct wl1271_cmd_header header;
696
697 /* The new serving channel */
698 u8 channel;
699 /* Relative time of the serving channel switch in TBTT units */
700 u8 switch_time;
701 /* 1: Suspend TX till switch time; 0: Do not suspend TX */
702 u8 tx_suspend;
703 /* 1: Flush TX at switch time; 0: Do not flush */
704 u8 flush;
705} __packed;
706
707struct wl12xx_cmd_stop_channel_switch {
708 struct wl1271_cmd_header header;
709} __packed;
710
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300711#endif /* __WL1271_CMD_H__ */