Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 1 | /* |
| 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 Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 25 | #ifndef __CMD_H__ |
| 26 | #define __CMD_H__ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 27 | |
Shahar Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 28 | #include "wl12xx.h" |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 29 | |
| 30 | struct acx_header; |
| 31 | |
Juuso Oikarinen | fa867e7 | 2009-11-02 20:22:13 +0200 | [diff] [blame] | 32 | int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, |
| 33 | size_t res_len); |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 34 | int wl1271_cmd_general_parms(struct wl1271 *wl); |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 35 | int wl128x_cmd_general_parms(struct wl1271 *wl); |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 36 | int wl1271_cmd_radio_parms(struct wl1271 *wl); |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 37 | int wl128x_cmd_radio_parms(struct wl1271 *wl); |
Juuso Oikarinen | 644a486 | 2010-10-05 13:11:56 +0200 | [diff] [blame] | 38 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 39 | int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 role_type, u8 *role_id); |
| 40 | int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id); |
| 41 | int wl12xx_cmd_role_start_dev(struct wl1271 *wl); |
| 42 | int wl12xx_cmd_role_stop_dev(struct wl1271 *wl); |
| 43 | int wl12xx_cmd_role_start_sta(struct wl1271 *wl); |
| 44 | int wl12xx_cmd_role_stop_sta(struct wl1271 *wl); |
| 45 | int wl12xx_cmd_role_start_ap(struct wl1271 *wl); |
| 46 | int wl12xx_cmd_role_stop_ap(struct wl1271 *wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 47 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); |
| 48 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); |
| 49 | int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); |
Luciano Coelho | 9421089 | 2009-12-11 15:40:55 +0200 | [diff] [blame] | 50 | int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); |
Eliad Peller | c8bde24 | 2011-02-02 09:59:35 +0200 | [diff] [blame] | 51 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode); |
Juuso Oikarinen | 65cddbf | 2010-08-24 06:28:03 +0300 | [diff] [blame] | 52 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, |
| 53 | size_t len); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 54 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 55 | void *buf, size_t buf_len, int index, u32 rates); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 56 | int wl1271_cmd_build_null_data(struct wl1271 *wl); |
| 57 | int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid); |
Kalle Valo | 818e306 | 2010-03-18 12:26:35 +0200 | [diff] [blame] | 58 | int 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 Oikarinen | 2f6724b | 2010-11-24 08:16:57 +0200 | [diff] [blame] | 61 | struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl, |
| 62 | struct sk_buff *skb); |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 63 | int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr); |
Kalle Valo | 023e082 | 2010-03-18 12:26:36 +0200 | [diff] [blame] | 64 | int wl1271_build_qos_null_data(struct wl1271 *wl); |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 65 | int wl1271_cmd_build_klv_null_data(struct wl1271 *wl); |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 66 | int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid); |
Arik Nemtsov | 98bdaab | 2010-10-16 18:08:58 +0200 | [diff] [blame] | 67 | int 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); |
| 70 | int 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 73 | int wl12xx_cmd_set_peer_state(struct wl1271 *wl); |
Eliad Peller | 251c177 | 2011-08-14 13:17:17 +0300 | [diff] [blame^] | 74 | int wl12xx_roc(struct wl1271 *wl, u8 role_id); |
| 75 | int wl12xx_croc(struct wl1271 *wl, u8 role_id); |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 76 | int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid); |
| 77 | int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid); |
Ido Yariv | 95dac04f | 2011-06-06 14:57:06 +0300 | [diff] [blame] | 78 | int wl12xx_cmd_config_fwlog(struct wl1271 *wl); |
| 79 | int wl12xx_cmd_start_fwlog(struct wl1271 *wl); |
| 80 | int wl12xx_cmd_stop_fwlog(struct wl1271 *wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 81 | |
| 82 | enum 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 Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 91 | 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 97 | CMD_QUIET_ELEMENT_SET_STATE = 29, |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 98 | CMD_SET_BCN_MODE = 33, |
| 99 | CMD_MEASUREMENT = 34, |
| 100 | CMD_STOP_MEASUREMENT = 35, |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 101 | 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 Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 106 | 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 113 | CMD_SET_PEER_STATE = 52, |
| 114 | CMD_REMAIN_ON_CHANNEL = 53, |
| 115 | CMD_CANCEL_REMAIN_ON_CHANNEL = 54, |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 116 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 117 | 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 Nemtsov | 98bdaab | 2010-10-16 18:08:58 +0200 | [diff] [blame] | 137 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 138 | NUM_COMMANDS, |
| 139 | MAX_COMMAND_ID = 0xFFFF, |
| 140 | }; |
| 141 | |
| 142 | #define MAX_CMD_PARAMS 572 |
| 143 | |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 144 | enum { |
| 145 | CMD_TEMPL_KLV_IDX_NULL_DATA = 0, |
| 146 | CMD_TEMPL_KLV_IDX_MAX = 4 |
| 147 | }; |
| 148 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 149 | enum 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 165 | CMD_TEMPL_AP_BEACON, |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 166 | CMD_TEMPL_AP_PROBE_RESPONSE, |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 167 | CMD_TEMPL_ARP_RSP, |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 168 | CMD_TEMPL_DEAUTH_AP, |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 169 | CMD_TEMPL_TEMPORARY, |
| 170 | CMD_TEMPL_LINK_MEASUREMENT_REPORT, |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 171 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 172 | CMD_TEMPL_MAX = 0xff |
| 173 | }; |
| 174 | |
| 175 | /* unit ms */ |
| 176 | #define WL1271_COMMAND_TIMEOUT 2000 |
Eliad Peller | 154037d | 2011-08-14 13:17:12 +0300 | [diff] [blame] | 177 | #define WL1271_CMD_TEMPL_DFLT_SIZE 252 |
| 178 | #define WL1271_CMD_TEMPL_MAX_SIZE 548 |
Teemu Paasikivi | 0cbb103 | 2010-05-07 11:39:01 +0300 | [diff] [blame] | 179 | #define WL1271_EVENT_TIMEOUT 750 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 180 | |
| 181 | struct wl1271_cmd_header { |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 182 | __le16 id; |
| 183 | __le16 status; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 184 | /* payload */ |
| 185 | u8 data[0]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 186 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 187 | |
| 188 | #define WL1271_CMD_MAX_PARAMS 572 |
| 189 | |
| 190 | struct wl1271_command { |
| 191 | struct wl1271_cmd_header header; |
| 192 | u8 parameters[WL1271_CMD_MAX_PARAMS]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 193 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 194 | |
| 195 | enum { |
| 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 210 | CMD_STATUS_TEMPLATE_OOM = 23, |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 211 | MAX_COMMAND_STATUS = 0xff |
| 212 | }; |
| 213 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 214 | #define CMDMBOX_HEADER_LEN 4 |
| 215 | #define CMDMBOX_INFO_ELEM_HEADER_LEN 4 |
| 216 | |
| 217 | enum { |
| 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 Paasikivi | a410264 | 2009-10-13 12:47:51 +0300 | [diff] [blame] | 226 | #define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 227 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 228 | struct wl12xx_cmd_role_enable { |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 229 | struct wl1271_cmd_header header; |
| 230 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 231 | u8 role_id; |
| 232 | u8 role_type; |
| 233 | u8 mac_address[ETH_ALEN]; |
| 234 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 235 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 236 | struct wl12xx_cmd_role_disable { |
| 237 | struct wl1271_cmd_header header; |
| 238 | |
| 239 | u8 role_id; |
| 240 | u8 padding[3]; |
| 241 | } __packed; |
| 242 | |
| 243 | enum 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 | |
| 252 | struct wl12xx_cmd_role_start { |
| 253 | struct wl1271_cmd_header header; |
| 254 | |
| 255 | u8 role_id; |
| 256 | u8 band; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 257 | u8 channel; |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 258 | 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 | |
| 330 | struct 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 Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 336 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 337 | |
| 338 | struct cmd_enabledisable_path { |
| 339 | struct wl1271_cmd_header header; |
| 340 | |
| 341 | u8 channel; |
| 342 | u8 padding[3]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 343 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 344 | |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 345 | #define WL1271_RATE_AUTOMATIC 0 |
| 346 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 347 | struct wl1271_cmd_template_set { |
| 348 | struct wl1271_cmd_header header; |
| 349 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 350 | __le16 len; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 351 | u8 template_type; |
| 352 | u8 index; /* relevant only for KLV_TEMPLATE type */ |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 353 | __le32 enabled_rates; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 354 | 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 Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 359 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 360 | |
| 361 | #define TIM_ELE_ID 5 |
| 362 | #define PARTIAL_VBM_MAX 251 |
| 363 | |
| 364 | struct 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 Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 371 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 372 | |
| 373 | enum wl1271_cmd_ps_mode { |
| 374 | STATION_ACTIVE_MODE, |
| 375 | STATION_POWER_SAVE_MODE |
| 376 | }; |
| 377 | |
| 378 | struct wl1271_cmd_ps_params { |
| 379 | struct wl1271_cmd_header header; |
| 380 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 381 | u8 role_id; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 382 | u8 ps_mode; /* STATION_* */ |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 383 | u8 padding[2]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 384 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 385 | |
| 386 | /* HW encryption keys */ |
| 387 | #define NUM_ACCESS_CATEGORIES_COPY 4 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 388 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 389 | enum 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 396 | enum wl1271_cmd_lid_key_type { |
| 397 | UNICAST_LID_TYPE = 0, |
| 398 | BROADCAST_LID_TYPE = 1, |
| 399 | WEP_DEFAULT_LID_TYPE = 2 |
| 400 | }; |
| 401 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 402 | enum wl1271_cmd_key_type { |
| 403 | KEY_NONE = 0, |
| 404 | KEY_WEP = 1, |
| 405 | KEY_TKIP = 2, |
| 406 | KEY_AES = 3, |
Juuso Oikarinen | 7a55724 | 2010-09-27 12:42:07 +0200 | [diff] [blame] | 407 | KEY_GEM = 4, |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 408 | }; |
| 409 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 410 | struct wl1271_cmd_set_keys { |
Arik Nemtsov | 98bdaab | 2010-10-16 18:08:58 +0200 | [diff] [blame] | 411 | 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 Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 455 | struct wl1271_cmd_test_header { |
| 456 | u8 id; |
| 457 | u8 padding[3]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 458 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 459 | |
| 460 | enum 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 Oikarinen | 644a486 | 2010-10-05 13:11:56 +0200 | [diff] [blame] | 466 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 467 | |
Juuso Oikarinen | 644a486 | 2010-10-05 13:11:56 +0200 | [diff] [blame] | 468 | #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 Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 471 | |
| 472 | struct wl1271_general_parms_cmd { |
| 473 | struct wl1271_cmd_header header; |
| 474 | |
| 475 | struct wl1271_cmd_test_header test; |
| 476 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 477 | struct wl1271_ini_general_params general_params; |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 478 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 479 | 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. Miller | 14599f1 | 2010-06-11 11:34:06 -0700 | [diff] [blame] | 485 | } __packed; |
Juuso Oikarinen | 152ee6e | 2010-02-18 13:25:42 +0200 | [diff] [blame] | 486 | |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 487 | struct 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 Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 502 | struct wl1271_radio_parms_cmd { |
| 503 | struct wl1271_cmd_header header; |
| 504 | |
| 505 | struct wl1271_cmd_test_header test; |
| 506 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 507 | /* Static radio parameters */ |
| 508 | struct wl1271_ini_band_params_2 static_params_2; |
| 509 | struct wl1271_ini_band_params_5 static_params_5; |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 510 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 511 | /* 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 Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 516 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 517 | |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 518 | struct 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 Oikarinen | 644a486 | 2010-10-05 13:11:56 +0200 | [diff] [blame] | 535 | struct 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 Coelho | 25a7dc6 | 2009-10-12 15:08:42 +0300 | [diff] [blame] | 545 | /* |
| 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 | */ |
| 554 | enum wl1271_disconnect_type { |
| 555 | DISCONNECT_IMMEDIATE, |
| 556 | DISCONNECT_DEAUTH, |
| 557 | DISCONNECT_DISASSOC |
| 558 | }; |
| 559 | |
Juuso Oikarinen | be86cbe | 2010-05-27 12:53:01 +0300 | [diff] [blame] | 560 | #define WL1271_CMD_STA_STATE_CONNECTED 1 |
| 561 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 562 | struct wl12xx_cmd_set_peer_state { |
Juuso Oikarinen | be86cbe | 2010-05-27 12:53:01 +0300 | [diff] [blame] | 563 | struct wl1271_cmd_header header; |
| 564 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 565 | u8 hlid; |
Juuso Oikarinen | be86cbe | 2010-05-27 12:53:01 +0300 | [diff] [blame] | 566 | u8 state; |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 567 | u8 padding[2]; |
Luciano Coelho | 5082b82 | 2010-10-05 14:58:49 +0300 | [diff] [blame] | 568 | } __packed; |
Juuso Oikarinen | be86cbe | 2010-05-27 12:53:01 +0300 | [diff] [blame] | 569 | |
Eliad Peller | a7cba38 | 2011-08-14 13:17:16 +0300 | [diff] [blame] | 570 | struct 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 | |
| 579 | struct wl12xx_cmd_croc { |
| 580 | struct wl1271_cmd_header header; |
| 581 | |
| 582 | u8 role_id; |
| 583 | u8 padding[3]; |
| 584 | }; |
| 585 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 586 | enum wl12xx_ssid_type { |
| 587 | WL12XX_SSID_TYPE_PUBLIC = 0, |
| 588 | WL12XX_SSID_TYPE_HIDDEN = 1, |
| 589 | WL12XX_SSID_TYPE_ANY = 2, |
Arik Nemtsov | 98bdaab | 2010-10-16 18:08:58 +0200 | [diff] [blame] | 590 | }; |
| 591 | |
Eliad Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 592 | struct wl12xx_cmd_add_peer { |
Arik Nemtsov | 98bdaab | 2010-10-16 18:08:58 +0200 | [diff] [blame] | 593 | 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 Peller | c690ec8 | 2011-08-14 13:17:07 +0300 | [diff] [blame] | 606 | struct wl12xx_cmd_remove_peer { |
Arik Nemtsov | 98bdaab | 2010-10-16 18:08:58 +0200 | [diff] [blame] | 607 | 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 Yariv | 95dac04f | 2011-06-06 14:57:06 +0300 | [diff] [blame] | 615 | /* |
| 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 | */ |
| 621 | enum wl12xx_fwlogger_log_mode { |
| 622 | WL12XX_FWLOG_CONTINUOUS, |
| 623 | WL12XX_FWLOG_ON_DEMAND |
| 624 | }; |
| 625 | |
| 626 | /* Include/exclude timestamps from the log messages */ |
| 627 | enum 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 | */ |
| 636 | enum wl12xx_fwlogger_output { |
| 637 | WL12XX_FWLOG_OUTPUT_NONE, |
| 638 | WL12XX_FWLOG_OUTPUT_DBG_PINS, |
| 639 | WL12XX_FWLOG_OUTPUT_HOST, |
| 640 | }; |
| 641 | |
| 642 | struct 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 | |
| 663 | struct wl12xx_cmd_start_fwlog { |
| 664 | struct wl1271_cmd_header header; |
| 665 | } __packed; |
| 666 | |
| 667 | struct wl12xx_cmd_stop_fwlog { |
| 668 | struct wl1271_cmd_header header; |
| 669 | } __packed; |
| 670 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 671 | #endif /* __WL1271_CMD_H__ */ |