Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: chromeos/drivers/ath6kl/os/linux/ar6000_drv.c

Issue 3579004: ath6kl: Bringing in the upstream version (Closed) Base URL: http://git.chromium.org/git/kernel.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 //------------------------------------------------------------------------------
2 * 2 // Copyright (c) 2004-2010 Atheros Communications Inc.
3 * Copyright (c) 2004-2010 Atheros Communications Inc. 3 // All rights reserved.
4 * All rights reserved.
5 *
6 *
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2 as
9 // published by the Free Software Foundation;
10 // 4 //
11 // Software distributed under the License is distributed on an "AS 5 //
12 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 6 //
13 // implied. See the License for the specific language governing 7 // Permission to use, copy, modify, and/or distribute this software for any
14 // rights and limitations under the License. 8 // purpose with or without fee is hereby granted, provided that the above
9 // copyright notice and this permission notice appear in all copies.
10 //
11 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 // 18 //
16 // 19 //
17 * 20 //
18 */ 21 // Author(s): ="Atheros"
22 //------------------------------------------------------------------------------
19 23
20 /* 24 /*
21 * This driver is a pseudo ethernet driver to access the Atheros AR6000 25 * This driver is a pseudo ethernet driver to access the Atheros AR6000
22 * WLAN Device 26 * WLAN Device
23 */ 27 */
24 28
25 #include "ar6000_drv.h" 29 #include "ar6000_drv.h"
26 #ifdef ATH6K_CONFIG_CFG80211 30 #ifdef ATH6K_CONFIG_CFG80211
27 #include "cfg80211.h" 31 #include "cfg80211.h"
28 #endif /* ATH6K_CONFIG_CFG80211 */ 32 #endif /* ATH6K_CONFIG_CFG80211 */
29 #include "htc.h" 33 #include "htc.h"
30 #include "wmi_filter_linux.h" 34 #include "wmi_filter_linux.h"
31 #include "epping_test.h" 35 #include "epping_test.h"
32 #include "wlan_config.h" 36 #include "wlan_config.h"
33 #include "ar3kconfig.h" 37 #include "ar3kconfig.h"
38 #include "ar6k_pal.h"
39 #include "AR6002/addrs.h"
34 40
35 41
36 /* LINUX_HACK_FUDGE_FACTOR -- this is used to provide a workaround for linux beh avior. When 42 /* LINUX_HACK_FUDGE_FACTOR -- this is used to provide a workaround for linux beh avior. When
37 * the meta data was added to the header it was found that linux did not correc tly provide 43 * the meta data was added to the header it was found that linux did not correc tly provide
38 * enough headroom. However when more headroom was requested beyond what was t ruly needed 44 * enough headroom. However when more headroom was requested beyond what was t ruly needed
39 * Linux gave the requested headroom. Therefore to get the necessary headroom f rom Linux 45 * Linux gave the requested headroom. Therefore to get the necessary headroom f rom Linux
40 * the driver requests more than is needed by the amount = LINUX_HACK_FUDGE_FAC TOR */ 46 * the driver requests more than is needed by the amount = LINUX_HACK_FUDGE_FAC TOR */
41 #define LINUX_HACK_FUDGE_FACTOR 16 47 #define LINUX_HACK_FUDGE_FACTOR 16
42 #define BDATA_BDADDR_OFFSET 28 48 #define BDATA_BDADDR_OFFSET 28
43 49
(...skipping 12 matching lines...) Expand all
56 62
57 static ATH_DEBUG_MASK_DESCRIPTION driver_debug_desc[] = { 63 static ATH_DEBUG_MASK_DESCRIPTION driver_debug_desc[] = {
58 { ATH_DEBUG_DBG_LOG , "Target Debug Logs"}, 64 { ATH_DEBUG_DBG_LOG , "Target Debug Logs"},
59 { ATH_DEBUG_WLAN_CONNECT , "WLAN connect"}, 65 { ATH_DEBUG_WLAN_CONNECT , "WLAN connect"},
60 { ATH_DEBUG_WLAN_SCAN , "WLAN scan"}, 66 { ATH_DEBUG_WLAN_SCAN , "WLAN scan"},
61 { ATH_DEBUG_WLAN_TX , "WLAN Tx"}, 67 { ATH_DEBUG_WLAN_TX , "WLAN Tx"},
62 { ATH_DEBUG_WLAN_RX , "WLAN Rx"}, 68 { ATH_DEBUG_WLAN_RX , "WLAN Rx"},
63 { ATH_DEBUG_HTC_RAW , "HTC Raw IF tracing"}, 69 { ATH_DEBUG_HTC_RAW , "HTC Raw IF tracing"},
64 { ATH_DEBUG_HCI_BRIDGE , "HCI Bridge Setup"}, 70 { ATH_DEBUG_HCI_BRIDGE , "HCI Bridge Setup"},
65 { ATH_DEBUG_HCI_RECV , "HCI Recv tracing"}, 71 { ATH_DEBUG_HCI_RECV , "HCI Recv tracing"},
66 { ATH_DEBUG_HCI_SEND , "HCI Send tracing"},
67 { ATH_DEBUG_HCI_DUMP , "HCI Packet dumps"}, 72 { ATH_DEBUG_HCI_DUMP , "HCI Packet dumps"},
68 }; 73 };
69 74
70 ATH_DEBUG_INSTANTIATE_MODULE_VAR(driver, 75 ATH_DEBUG_INSTANTIATE_MODULE_VAR(driver,
71 "driver", 76 "driver",
72 "Linux Driver Interface", 77 "Linux Driver Interface",
73 ATH_DEBUG_MASK_DEFAULTS | ATH_DEBUG_WLAN_SCAN | 78 ATH_DEBUG_MASK_DEFAULTS | ATH_DEBUG_WLAN_SCAN |
74 ATH_DEBUG_HCI_BRIDGE, 79 ATH_DEBUG_HCI_BRIDGE,
75 ATH_DEBUG_DESCRIPTION_COUNT(driver_debug_desc), 80 ATH_DEBUG_DESCRIPTION_COUNT(driver_debug_desc),
76 driver_debug_desc); 81 driver_debug_desc);
77 82
78 #endif 83 #endif
79 84
80 85
81 #define IS_MAC_NULL(mac) (mac[0]==0 && mac[1]==0 && mac[2]==0 && mac[3]==0 && ma c[4]==0 && mac[5]==0) 86 #define IS_MAC_NULL(mac) (mac[0]==0 && mac[1]==0 && mac[2]==0 && mac[3]==0 && ma c[4]==0 && mac[5]==0)
82 #define IS_MAC_BCAST(mac) (*mac==0xff) 87 #define IS_MAC_BCAST(mac) (*mac==0xff)
83 88
84 #define DESCRIPTION "Driver to access the Atheros AR600x Device, version " __str ingify(__VER_MAJOR_) "." __stringify(__VER_MINOR_) "." __stringify(__VER_PATCH_) "." __stringify(__BUILD_NUMBER_) 89 #define DESCRIPTION "Driver to access the Atheros AR600x Device, version " __str ingify(__VER_MAJOR_) "." __stringify(__VER_MINOR_) "." __stringify(__VER_PATCH_) "." __stringify(__BUILD_NUMBER_)
85 90
86 MODULE_AUTHOR("Atheros Communications, Inc."); 91 MODULE_AUTHOR("Atheros Communications, Inc.");
87 MODULE_DESCRIPTION(DESCRIPTION); 92 MODULE_DESCRIPTION(DESCRIPTION);
88 MODULE_LICENSE("GPL and additional rights"); 93 MODULE_LICENSE("Dual BSD/GPL");
89 94
90 #ifndef REORG_APTC_HEURISTICS 95 #ifndef REORG_APTC_HEURISTICS
91 #undef ADAPTIVE_POWER_THROUGHPUT_CONTROL 96 #undef ADAPTIVE_POWER_THROUGHPUT_CONTROL
92 #endif /* REORG_APTC_HEURISTICS */ 97 #endif /* REORG_APTC_HEURISTICS */
93 98
94 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL 99 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
95 #define APTC_TRAFFIC_SAMPLING_INTERVAL 100 /* msec */ 100 #define APTC_TRAFFIC_SAMPLING_INTERVAL 100 /* msec */
96 #define APTC_UPPER_THROUGHPUT_THRESHOLD 3000 /* Kbps */ 101 #define APTC_UPPER_THROUGHPUT_THRESHOLD 3000 /* Kbps */
97 #define APTC_LOWER_THROUGHPUT_THRESHOLD 2000 /* Kbps */ 102 #define APTC_LOWER_THROUGHPUT_THRESHOLD 2000 /* Kbps */
98 103
99 typedef struct aptc_traffic_record { 104 typedef struct aptc_traffic_record {
100 A_BOOL timerScheduled; 105 A_BOOL timerScheduled;
101 struct timeval samplingTS; 106 struct timeval samplingTS;
102 unsigned long bytesReceived; 107 unsigned long bytesReceived;
103 unsigned long bytesTransmitted; 108 unsigned long bytesTransmitted;
104 } APTC_TRAFFIC_RECORD; 109 } APTC_TRAFFIC_RECORD;
105 110
106 A_TIMER aptcTimer; 111 A_TIMER aptcTimer;
107 APTC_TRAFFIC_RECORD aptcTR; 112 APTC_TRAFFIC_RECORD aptcTR;
108 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ 113 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */
109 114
110 #ifdef EXPORT_HCI_BRIDGE_INTERFACE 115 #ifdef EXPORT_HCI_BRIDGE_INTERFACE
111 // callbacks registered by HCI transport driver 116 // callbacks registered by HCI transport driver
112 HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks = { NULL }; 117 HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks = { NULL };
113 #endif 118 #endif
114 119
115 unsigned int processDot11Hdr = 0; 120 unsigned int processDot11Hdr = 0;
116 int bmienable = BMIENABLE_DEFAULT; 121 int bmienable = BMIENABLE_DEFAULT;
117 122
118 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
119 char ifname[IFNAMSIZ] = {0,}; 123 char ifname[IFNAMSIZ] = {0,};
120 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
121 124
122 int wlaninitmode = WLAN_INIT_MODE_DEFAULT; 125 int wlaninitmode = WLAN_INIT_MODE_DEFAULT;
123 unsigned int bypasswmi = 0; 126 unsigned int bypasswmi = 0;
124 unsigned int debuglevel = 0; 127 unsigned int debuglevel = 0;
125 int tspecCompliance = ATHEROS_COMPLIANCE; 128 int tspecCompliance = ATHEROS_COMPLIANCE;
126 unsigned int busspeedlow = 0; 129 unsigned int busspeedlow = 0;
127 unsigned int onebitmode = 0; 130 unsigned int onebitmode = 0;
128 unsigned int skipflash = 0; 131 unsigned int skipflash = 0;
129 unsigned int wmitimeout = 2; 132 unsigned int wmitimeout = 2;
130 unsigned int wlanNodeCaching = 1; 133 unsigned int wlanNodeCaching = 1;
131 unsigned int enableuartprint = ENABLEUARTPRINT_DEFAULT; 134 unsigned int enableuartprint = ENABLEUARTPRINT_DEFAULT;
132 unsigned int logWmiRawMsgs = 0; 135 unsigned int logWmiRawMsgs = 0;
133 unsigned int enabletimerwar = 0; 136 unsigned int enabletimerwar = 0;
134 unsigned int fwmode = 1; 137 unsigned int fwmode = 1;
135 unsigned int mbox_yield_limit = 99; 138 unsigned int mbox_yield_limit = 99;
136 unsigned int enablerssicompensation = 0; 139 unsigned int enablerssicompensation = 0;
137 int reduce_credit_dribble = 1 + HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF; 140 int reduce_credit_dribble = 1 + HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF;
138 int allow_trace_signal = 0; 141 int allow_trace_signal = 0;
139 #ifdef CONFIG_HOST_TCMD_SUPPORT 142 #ifdef CONFIG_HOST_TCMD_SUPPORT
140 unsigned int testmode =0; 143 unsigned int testmode =0;
141 #endif 144 #endif
142 145
143 unsigned int irqprocmode = HIF_DEVICE_IRQ_SYNC_ONLY;//HIF_DEVICE_IRQ_ASYNC_SYNC; 146 unsigned int irqprocmode = HIF_DEVICE_IRQ_SYNC_ONLY;//HIF_DEVICE_IRQ_ASYNC_SYNC;
144 unsigned int panic_on_assert = 1; 147 unsigned int panic_on_assert = 1;
145 unsigned int nohifscattersupport = NOHIFSCATTERSUPPORT_DEFAULT; 148 unsigned int nohifscattersupport = NOHIFSCATTERSUPPORT_DEFAULT;
146 149
147 unsigned int setuphci = SETUPHCI_DEFAULT; 150 unsigned int setuphci = SETUPHCI_DEFAULT;
151 unsigned int setuphcipal = SETUPHCIPAL_DEFAULT;
148 unsigned int loghci = 0; 152 unsigned int loghci = 0;
149 unsigned int setupbtdev = SETUPBTDEV_DEFAULT; 153 unsigned int setupbtdev = SETUPBTDEV_DEFAULT;
150 #ifndef EXPORT_HCI_BRIDGE_INTERFACE 154 #ifndef EXPORT_HCI_BRIDGE_INTERFACE
151 unsigned int ar3khcibaud = AR3KHCIBAUD_DEFAULT; 155 unsigned int ar3khcibaud = AR3KHCIBAUD_DEFAULT;
152 unsigned int hciuartscale = HCIUARTSCALE_DEFAULT; 156 unsigned int hciuartscale = HCIUARTSCALE_DEFAULT;
153 unsigned int hciuartstep = HCIUARTSTEP_DEFAULT; 157 unsigned int hciuartstep = HCIUARTSTEP_DEFAULT;
154 #endif 158 #endif
155 #ifdef CONFIG_CHECKSUM_OFFLOAD 159 #ifdef CONFIG_CHECKSUM_OFFLOAD
156 unsigned int csumOffload=0; 160 unsigned int csumOffload=0;
157 unsigned int csumOffloadTest=0; 161 unsigned int csumOffloadTest=0;
158 #endif 162 #endif
159 unsigned int eppingtest=0; 163 unsigned int eppingtest=0;
160 164
161 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
162 module_param_string(ifname, ifname, sizeof(ifname), 0644); 165 module_param_string(ifname, ifname, sizeof(ifname), 0644);
163 module_param(wlaninitmode, int, 0644); 166 module_param(wlaninitmode, int, 0644);
164 module_param(bmienable, int, 0644); 167 module_param(bmienable, int, 0644);
165 module_param(bypasswmi, uint, 0644); 168 module_param(bypasswmi, uint, 0644);
166 module_param(debuglevel, uint, 0644); 169 module_param(debuglevel, uint, 0644);
167 module_param(tspecCompliance, int, 0644); 170 module_param(tspecCompliance, int, 0644);
168 module_param(onebitmode, uint, 0644); 171 module_param(onebitmode, uint, 0644);
169 module_param(busspeedlow, uint, 0644); 172 module_param(busspeedlow, uint, 0644);
170 module_param(skipflash, uint, 0644); 173 module_param(skipflash, uint, 0644);
171 module_param(wmitimeout, uint, 0644); 174 module_param(wmitimeout, uint, 0644);
(...skipping 10 matching lines...) Expand all
182 #ifdef CONFIG_CHECKSUM_OFFLOAD 185 #ifdef CONFIG_CHECKSUM_OFFLOAD
183 module_param(csumOffload, uint, 0644); 186 module_param(csumOffload, uint, 0644);
184 #endif 187 #endif
185 #ifdef CONFIG_HOST_TCMD_SUPPORT 188 #ifdef CONFIG_HOST_TCMD_SUPPORT
186 module_param(testmode, uint, 0644); 189 module_param(testmode, uint, 0644);
187 #endif 190 #endif
188 module_param(irqprocmode, uint, 0644); 191 module_param(irqprocmode, uint, 0644);
189 module_param(nohifscattersupport, uint, 0644); 192 module_param(nohifscattersupport, uint, 0644);
190 module_param(panic_on_assert, uint, 0644); 193 module_param(panic_on_assert, uint, 0644);
191 module_param(setuphci, uint, 0644); 194 module_param(setuphci, uint, 0644);
195 module_param(setuphcipal, uint, 0644);
192 module_param(loghci, uint, 0644); 196 module_param(loghci, uint, 0644);
193 module_param(setupbtdev, uint, 0644); 197 module_param(setupbtdev, uint, 0644);
194 #ifndef EXPORT_HCI_BRIDGE_INTERFACE 198 #ifndef EXPORT_HCI_BRIDGE_INTERFACE
195 module_param(ar3khcibaud, uint, 0644); 199 module_param(ar3khcibaud, uint, 0644);
196 module_param(hciuartscale, uint, 0644); 200 module_param(hciuartscale, uint, 0644);
197 module_param(hciuartstep, uint, 0644); 201 module_param(hciuartstep, uint, 0644);
198 #endif 202 #endif
199 module_param(eppingtest, uint, 0644); 203 module_param(eppingtest, uint, 0644);
200 #else
201 204
202 #define __user
203 /* for linux 2.4 and lower */
204 MODULE_PARM(bmienable,"i");
205 MODULE_PARM(wlaninitmode,"i");
206 MODULE_PARM(bypasswmi,"i");
207 MODULE_PARM(debuglevel, "i");
208 MODULE_PARM(onebitmode,"i");
209 MODULE_PARM(busspeedlow, "i");
210 MODULE_PARM(skipflash, "i");
211 MODULE_PARM(wmitimeout, "i");
212 MODULE_PARM(wlanNodeCaching, "i");
213 MODULE_PARM(enableuartprint,"i");
214 MODULE_PARM(logWmiRawMsgs, "i");
215 MODULE_PARM(enabletimerwar,"i");
216 MODULE_PARM(fwmode,"i");
217 MODULE_PARM(mbox_yield_limit,"i");
218 MODULE_PARM(reduce_credit_dribble,"i");
219 MODULE_PARM(allow_trace_signal,"i");
220 MODULE_PARM(enablerssicompensation,"i");
221 MODULE_PARM(processDot11Hdr,"i");
222 #ifdef CONFIG_CHECKSUM_OFFLOAD
223 MODULE_PARM(csumOffload,"i");
224 #endif
225 #ifdef CONFIG_HOST_TCMD_SUPPORT
226 MODULE_PARM(testmode, "i");
227 #endif
228 MODULE_PARM(irqprocmode, "i");
229 MODULE_PARM(nohifscattersupport, "i");
230 MODULE_PARM(panic_on_assert, "i");
231 MODULE_PARM(setuphci, "i");
232 MODULE_PARM(loghci, "i");
233 #endif
234
235 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
236 /* in 2.6.10 and later this is now a pointer to a uint */ 205 /* in 2.6.10 and later this is now a pointer to a uint */
237 unsigned int _mboxnum = HTC_MAILBOX_NUM_MAX; 206 unsigned int _mboxnum = HTC_MAILBOX_NUM_MAX;
238 #define mboxnum &_mboxnum 207 #define mboxnum &_mboxnum
239 #else
240 unsigned int mboxnum = HTC_MAILBOX_NUM_MAX;
241 #endif
242 208
243 #ifdef DEBUG 209 #ifdef DEBUG
244 A_UINT32 g_dbg_flags = DBG_DEFAULTS; 210 A_UINT32 g_dbg_flags = DBG_DEFAULTS;
245 unsigned int debugflags = 0; 211 unsigned int debugflags = 0;
246 int debugdriver = 0; 212 int debugdriver = 0;
247 unsigned int debughtc = 0; 213 unsigned int debughtc = 0;
248 unsigned int debugbmi = 0; 214 unsigned int debugbmi = 0;
249 unsigned int debughif = 0; 215 unsigned int debughif = 0;
250 unsigned int txcreditsavailable[HTC_MAILBOX_NUM_MAX] = {0}; 216 unsigned int txcreditsavailable[HTC_MAILBOX_NUM_MAX] = {0};
251 unsigned int txcreditsconsumed[HTC_MAILBOX_NUM_MAX] = {0}; 217 unsigned int txcreditsconsumed[HTC_MAILBOX_NUM_MAX] = {0};
252 unsigned int txcreditintrenable[HTC_MAILBOX_NUM_MAX] = {0}; 218 unsigned int txcreditintrenable[HTC_MAILBOX_NUM_MAX] = {0};
253 unsigned int txcreditintrenableaggregate[HTC_MAILBOX_NUM_MAX] = {0}; 219 unsigned int txcreditintrenableaggregate[HTC_MAILBOX_NUM_MAX] = {0};
254 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
255 module_param(debugflags, uint, 0644); 220 module_param(debugflags, uint, 0644);
256 module_param(debugdriver, int, 0644); 221 module_param(debugdriver, int, 0644);
257 module_param(debughtc, uint, 0644); 222 module_param(debughtc, uint, 0644);
258 module_param(debugbmi, uint, 0644); 223 module_param(debugbmi, uint, 0644);
259 module_param(debughif, uint, 0644); 224 module_param(debughif, uint, 0644);
260 module_param_array(txcreditsavailable, uint, mboxnum, 0644); 225 module_param_array(txcreditsavailable, uint, mboxnum, 0644);
261 module_param_array(txcreditsconsumed, uint, mboxnum, 0644); 226 module_param_array(txcreditsconsumed, uint, mboxnum, 0644);
262 module_param_array(txcreditintrenable, uint, mboxnum, 0644); 227 module_param_array(txcreditintrenable, uint, mboxnum, 0644);
263 module_param_array(txcreditintrenableaggregate, uint, mboxnum, 0644); 228 module_param_array(txcreditintrenableaggregate, uint, mboxnum, 0644);
264 #else
265 /* linux 2.4 and lower */
266 MODULE_PARM(debugflags,"i");
267 MODULE_PARM(debugdriver, "i");
268 MODULE_PARM(debughtc, "i");
269 MODULE_PARM(debugbmi, "i");
270 MODULE_PARM(debughif, "i");
271 MODULE_PARM(txcreditsavailable, "0-3i");
272 MODULE_PARM(txcreditsconsumed, "0-3i");
273 MODULE_PARM(txcreditintrenable, "0-3i");
274 MODULE_PARM(txcreditintrenableaggregate, "0-3i");
275 #endif
276 229
277 #endif /* DEBUG */ 230 #endif /* DEBUG */
278 231
279 unsigned int resetok = 1; 232 unsigned int resetok = 1;
280 unsigned int tx_attempt[HTC_MAILBOX_NUM_MAX] = {0}; 233 unsigned int tx_attempt[HTC_MAILBOX_NUM_MAX] = {0};
281 unsigned int tx_post[HTC_MAILBOX_NUM_MAX] = {0}; 234 unsigned int tx_post[HTC_MAILBOX_NUM_MAX] = {0};
282 unsigned int tx_complete[HTC_MAILBOX_NUM_MAX] = {0}; 235 unsigned int tx_complete[HTC_MAILBOX_NUM_MAX] = {0};
283 unsigned int hifBusRequestNumMax = 40; 236 unsigned int hifBusRequestNumMax = 40;
284 unsigned int war23838_disabled = 0; 237 unsigned int war23838_disabled = 0;
285 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL 238 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
286 unsigned int enableAPTCHeuristics = 1; 239 unsigned int enableAPTCHeuristics = 1;
287 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ 240 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */
288 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
289 module_param_array(tx_attempt, uint, mboxnum, 0644); 241 module_param_array(tx_attempt, uint, mboxnum, 0644);
290 module_param_array(tx_post, uint, mboxnum, 0644); 242 module_param_array(tx_post, uint, mboxnum, 0644);
291 module_param_array(tx_complete, uint, mboxnum, 0644); 243 module_param_array(tx_complete, uint, mboxnum, 0644);
292 module_param(hifBusRequestNumMax, uint, 0644); 244 module_param(hifBusRequestNumMax, uint, 0644);
293 module_param(war23838_disabled, uint, 0644); 245 module_param(war23838_disabled, uint, 0644);
294 module_param(resetok, uint, 0644); 246 module_param(resetok, uint, 0644);
295 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL 247 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
296 module_param(enableAPTCHeuristics, uint, 0644); 248 module_param(enableAPTCHeuristics, uint, 0644);
297 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ 249 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */
298 #else
299 MODULE_PARM(tx_attempt, "0-3i");
300 MODULE_PARM(tx_post, "0-3i");
301 MODULE_PARM(tx_complete, "0-3i");
302 MODULE_PARM(hifBusRequestNumMax, "i");
303 MODULE_PARM(war23838_disabled, "i");
304 MODULE_PARM(resetok, "i");
305 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
306 MODULE_PARM(enableAPTCHeuristics, "i");
307 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */
308 #endif
309 250
310 #ifdef BLOCK_TX_PATH_FLAG 251 #ifdef BLOCK_TX_PATH_FLAG
311 int blocktx = 0; 252 int blocktx = 0;
312 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
313 module_param(blocktx, int, 0644); 253 module_param(blocktx, int, 0644);
314 #else
315 MODULE_PARM(blocktx, "i");
316 #endif
317 #endif /* BLOCK_TX_PATH_FLAG */ 254 #endif /* BLOCK_TX_PATH_FLAG */
318 255
319 typedef struct user_rssi_compensation_t { 256 typedef struct user_rssi_compensation_t {
320 A_UINT16 customerID; 257 A_UINT16 customerID;
321 union { 258 union {
322 A_UINT16 a_enable; 259 A_UINT16 a_enable;
323 A_UINT16 bg_enable; 260 A_UINT16 bg_enable;
324 A_UINT16 enable; 261 A_UINT16 enable;
325 }; 262 };
326 A_INT16 bg_param_a; 263 A_INT16 bg_param_a;
327 A_INT16 bg_param_b; 264 A_INT16 bg_param_b;
328 A_INT16 a_param_a; 265 A_INT16 a_param_a;
329 A_INT16 a_param_b; 266 A_INT16 a_param_b;
330 A_UINT32 reserved; 267 A_UINT32 reserved;
331 } USER_RSSI_CPENSATION; 268 } USER_RSSI_CPENSATION;
332 269
333 static USER_RSSI_CPENSATION rssi_compensation_param; 270 static USER_RSSI_CPENSATION rssi_compensation_param;
334 271
335 static A_INT16 rssi_compensation_table[96]; 272 static A_INT16 rssi_compensation_table[96];
336 273
337 int reconnect_flag = 0; 274 int reconnect_flag = 0;
275 static ar6k_pal_config_t ar6k_pal_config_g;
338 276
339 /* Function declarations */ 277 /* Function declarations */
340 static int ar6000_init_module(void); 278 static int ar6000_init_module(void);
341 static void ar6000_cleanup_module(void); 279 static void ar6000_cleanup_module(void);
342 280
343 int ar6000_init(struct net_device *dev); 281 int ar6000_init(struct net_device *dev);
344 static int ar6000_open(struct net_device *dev); 282 static int ar6000_open(struct net_device *dev);
345 static int ar6000_close(struct net_device *dev); 283 static int ar6000_close(struct net_device *dev);
346 static void ar6000_init_control_info(AR_SOFTC_T *ar); 284 static void ar6000_init_control_info(AR_SOFTC_T *ar);
347 static int ar6000_data_tx(struct sk_buff *skb, struct net_device *dev); 285 static int ar6000_data_tx(struct sk_buff *skb, struct net_device *dev);
348 286
349 void ar6000_destroy(struct net_device *dev, unsigned int unregister); 287 void ar6000_destroy(struct net_device *dev, unsigned int unregister);
350 static void ar6000_detect_error(unsigned long ptr); 288 static void ar6000_detect_error(unsigned long ptr);
351 static void ar6000_set_multicast_list(struct net_device *dev); 289 static void ar6000_set_multicast_list(struct net_device *dev);
352 static struct net_device_stats *ar6000_get_stats(struct net_device *dev); 290 static struct net_device_stats *ar6000_get_stats(struct net_device *dev);
353 static struct iw_statistics *ar6000_get_iwstats(struct net_device * dev); 291 static struct iw_statistics *ar6000_get_iwstats(struct net_device * dev);
354 292
355 static void disconnect_timer_handler(unsigned long ptr); 293 static void disconnect_timer_handler(unsigned long ptr);
356 294
357 void read_rssi_compensation_param(AR_SOFTC_T *ar); 295 void read_rssi_compensation_param(AR_SOFTC_T *ar);
358 296
359 /* for android builds we call external APIs that handle firmware download an d configuration */ 297 /* for android builds we call external APIs that handle firmware download an d configuration */
360 #ifdef ANDROID_ENV 298 #ifdef ANDROID_ENV
361 /* !!!! Interim android support to make it easier to patch the default driver fo r 299 /* !!!! Interim android support to make it easier to patch the default driver fo r
362 * android use. You must define an external source file ar6000_android.c that ha ndles the following 300 * android use. You must define an external source file ar6000_android.c that ha ndles the following
363 * APIs */ 301 * APIs */
364 extern A_STATUS android_ar6k_start(AR_SOFTC_T *ar);
365 extern void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks); 302 extern void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks);
366 extern void android_module_exit(void); 303 extern void android_module_exit(void);
367 extern A_BOOL android_ar6k_endpoint_is_stop(AR_SOFTC_T *ar);
368 extern void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A _BOOL isEvent);
369 #endif 304 #endif
370 /* 305 /*
371 * HTC service connection handlers 306 * HTC service connection handlers
372 */ 307 */
373 static A_STATUS ar6000_avail_ev(void *context, void *hif_handle); 308 static A_STATUS ar6000_avail_ev(void *context, void *hif_handle);
374 309
375 static A_STATUS ar6000_unavail_ev(void *context, void *hif_handle); 310 static A_STATUS ar6000_unavail_ev(void *context, void *hif_handle);
376 311
377 A_STATUS ar6000_configure_target(AR_SOFTC_T *ar); 312 A_STATUS ar6000_configure_target(AR_SOFTC_T *ar);
378 313
379 void ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile);
380
381 static void ar6000_target_failure(void *Instance, A_STATUS Status); 314 static void ar6000_target_failure(void *Instance, A_STATUS Status);
382 315
383 static void ar6000_rx(void *Context, HTC_PACKET *pPacket); 316 static void ar6000_rx(void *Context, HTC_PACKET *pPacket);
384 317
385 static void ar6000_rx_refill(void *Context,HTC_ENDPOINT_ID Endpoint); 318 static void ar6000_rx_refill(void *Context,HTC_ENDPOINT_ID Endpoint);
386 319
387 static void ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPackets); 320 static void ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPackets);
388 321
389 static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac ket); 322 static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac ket);
390 323
391 #ifdef ATH_AR6K_11N_SUPPORT 324 #ifdef ATH_AR6K_11N_SUPPORT
392 static void ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, A_UINT16 num); 325 static void ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, A_UINT16 num);
393 #endif 326 #endif
394 static void ar6000_deliver_frames_to_nw_stack(void * dev, void *osbuf); 327 static void ar6000_deliver_frames_to_nw_stack(void * dev, void *osbuf);
395 //static void ar6000_deliver_frames_to_bt_stack(void * dev, void *osbuf); 328 //static void ar6000_deliver_frames_to_bt_stack(void * dev, void *osbuf);
396 329
397 static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpo int, int Length); 330 static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpo int, int Length);
398 331
399 static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count); 332 static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count);
400 333
401 static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar); 334 static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar);
402 335
403 static ssize_t 336 static ssize_t
404 ar6000_sysfs_bmi_read(struct kobject *kobj, struct bin_attribute *bin_attr, 337 ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj,
338 struct bin_attribute *bin_attr,
405 char *buf, loff_t pos, size_t count); 339 char *buf, loff_t pos, size_t count);
406 340
407 static ssize_t 341 static ssize_t
408 ar6000_sysfs_bmi_write(struct kobject *kobj, struct bin_attribute *bin_attr, 342 ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj,
343 struct bin_attribute *bin_attr,
409 char *buf, loff_t pos, size_t count); 344 char *buf, loff_t pos, size_t count);
410 345
411 static A_STATUS 346 static A_STATUS
412 ar6000_sysfs_bmi_init(AR_SOFTC_T *ar); 347 ar6000_sysfs_bmi_init(AR_SOFTC_T *ar);
413 348
349 /* HCI PAL callback function declarations */
350 A_STATUS ar6k_setup_hci_pal(AR_SOFTC_T *ar);
351 void ar6k_cleanup_hci_pal(AR_SOFTC_T *ar);
352
414 static void 353 static void
415 ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar); 354 ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar);
416 355
417 A_STATUS 356 A_STATUS
418 ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode); 357 ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode);
419 358
420 /* 359 /*
421 * Static variables 360 * Static variables
422 */ 361 */
423 362
424 struct net_device *ar6000_devices[MAX_AR6000]; 363 struct net_device *ar6000_devices[MAX_AR6000];
364 static int is_netdev_registered;
425 extern struct iw_handler_def ath_iw_handler_def; 365 extern struct iw_handler_def ath_iw_handler_def;
426 DECLARE_WAIT_QUEUE_HEAD(arEvent); 366 DECLARE_WAIT_QUEUE_HEAD(arEvent);
427 static void ar6000_cookie_init(AR_SOFTC_T *ar); 367 static void ar6000_cookie_init(AR_SOFTC_T *ar);
428 static void ar6000_cookie_cleanup(AR_SOFTC_T *ar); 368 static void ar6000_cookie_cleanup(AR_SOFTC_T *ar);
429 static void ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie); 369 static void ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie);
430 static struct ar_cookie *ar6000_alloc_cookie(AR_SOFTC_T *ar); 370 static struct ar_cookie *ar6000_alloc_cookie(AR_SOFTC_T *ar);
431 371
432 #ifdef USER_KEYS 372 #ifdef USER_KEYS
433 static A_STATUS ar6000_reinstall_keys(AR_SOFTC_T *ar,A_UINT8 key_op_ctrl); 373 static A_STATUS ar6000_reinstall_keys(AR_SOFTC_T *ar,A_UINT8 key_op_ctrl);
434 #endif 374 #endif
435 375
376 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
377 struct net_device *arApNetDev;
378 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
436 379
437 static struct ar_cookie s_ar_cookie_mem[MAX_COOKIE_NUM]; 380 static struct ar_cookie s_ar_cookie_mem[MAX_COOKIE_NUM];
438 381
439 #define HOST_INTEREST_ITEM_ADDRESS(ar, item) \ 382 #define HOST_INTEREST_ITEM_ADDRESS(ar, item) \
440 (((ar)->arTargetType == TARGET_TYPE_AR6001) ? AR6001_HOST_INTEREST_ITEM_ ADDRESS(item) : \
441 (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ ADDRESS(item) : \ 383 (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ ADDRESS(item) : \
442 (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ ADDRESS(item) : 0))) 384 (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ ADDRESS(item) : 0))
443 385
444 386
445 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
446 static struct net_device_ops ar6000_netdev_ops = { 387 static struct net_device_ops ar6000_netdev_ops = {
447 .ndo_init = NULL, 388 .ndo_init = NULL,
448 .ndo_open = ar6000_open, 389 .ndo_open = ar6000_open,
449 .ndo_stop = ar6000_close, 390 .ndo_stop = ar6000_close,
450 .ndo_get_stats = ar6000_get_stats, 391 .ndo_get_stats = ar6000_get_stats,
451 .ndo_do_ioctl = ar6000_ioctl, 392 .ndo_do_ioctl = ar6000_ioctl,
452 .ndo_start_xmit = ar6000_data_tx, 393 .ndo_start_xmit = ar6000_data_tx,
453 .ndo_set_multicast_list = ar6000_set_multicast_list, 394 .ndo_set_multicast_list = ar6000_set_multicast_list,
454 }; 395 };
455 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) */
456 396
457 /* Debug log support */ 397 /* Debug log support */
458 398
459 /* 399 /*
460 * Flag to govern whether the debug logs should be parsed in the kernel 400 * Flag to govern whether the debug logs should be parsed in the kernel
461 * or reported to the application. 401 * or reported to the application.
462 */ 402 */
463 #define REPORT_DEBUG_LOGS_TO_APP 403 #define REPORT_DEBUG_LOGS_TO_APP
464 404
465 A_STATUS 405 A_STATUS
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 default: 515 default:
576 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid args: %d\n", numargs)); 516 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid args: %d\n", numargs));
577 } 517 }
578 count += numargs + 1; 518 count += numargs + 1;
579 } 519 }
580 } 520 }
581 521
582 int 522 int
583 ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) 523 ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar)
584 { 524 {
585 struct dbglog_hdr_s debug_hdr; 525 A_UINT32 data[8]; /* Should be able to accomodate struct dbglog_buf_s */
586 struct dbglog_buf_s debug_buf;
587 A_UINT32 address; 526 A_UINT32 address;
588 A_UINT32 length; 527 A_UINT32 length;
589 A_UINT32 dropped; 528 A_UINT32 dropped;
590 A_UINT32 firstbuf; 529 A_UINT32 firstbuf;
591 A_UINT32 debug_hdr_ptr; 530 A_UINT32 debug_hdr_ptr;
592 531
593 if (!ar->dbglog_init_done) return A_ERROR; 532 if (!ar->dbglog_init_done) return A_ERROR;
594 533
595 534
596 AR6000_SPIN_LOCK(&ar->arLock, 0); 535 AR6000_SPIN_LOCK(&ar->arLock, 0);
597 536
598 if (ar->dbgLogFetchInProgress) { 537 if (ar->dbgLogFetchInProgress) {
599 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 538 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
600 return A_EBUSY; 539 return A_EBUSY;
601 } 540 }
602 541
603 /* block out others */ 542 /* block out others */
604 ar->dbgLogFetchInProgress = TRUE; 543 ar->dbgLogFetchInProgress = TRUE;
605 544
606 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 545 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
607 546
608 debug_hdr_ptr = dbglog_get_debug_hdr_ptr(ar); 547 debug_hdr_ptr = dbglog_get_debug_hdr_ptr(ar);
609 printk("debug_hdr_ptr: 0x%x\n", debug_hdr_ptr); 548 printk("debug_hdr_ptr: 0x%x\n", debug_hdr_ptr);
610 549
611 /* Get the contents of the ring buffer */ 550 /* Get the contents of the ring buffer */
612 if (debug_hdr_ptr) { 551 if (debug_hdr_ptr) {
613 address = TARG_VTOP(ar->arTargetType, debug_hdr_ptr); 552 address = TARG_VTOP(ar->arTargetType, debug_hdr_ptr);
614 length = sizeof(struct dbglog_hdr_s); 553 length = 4 /* sizeof(dbuf) */ + 4 /* sizeof(dropped) */;
615 ar6000_ReadDataDiag(ar->arHifDevice, address, 554 A_MEMZERO(data, sizeof(data));
616 (A_UCHAR *)&debug_hdr, length); 555 ar6000_ReadDataDiag(ar->arHifDevice, address, (A_UCHAR *)data, length);
617 address = TARG_VTOP(ar->arTargetType, (A_UINT32)debug_hdr.dbuf); 556 address = TARG_VTOP(ar->arTargetType, data[0] /* dbuf */);
618 firstbuf = address; 557 firstbuf = address;
619 dropped = debug_hdr.dropped; 558 dropped = data[1]; /* dropped */
620 length = sizeof(struct dbglog_buf_s); 559 length = 4 /* sizeof(next) */ + 4 /* sizeof(buffer) */ + 4 /* sizeof(buf size) */ + 4 /* sizeof(length) */ + 4 /* sizeof(count) */ + 4 /* sizeof(free) */ ;
621 ar6000_ReadDataDiag(ar->arHifDevice, address, 560 A_MEMZERO(data, sizeof(data));
622 (A_UCHAR *)&debug_buf, length); 561 ar6000_ReadDataDiag(ar->arHifDevice, address, (A_UCHAR *)&data, length);
623 562
624 do { 563 do {
625 address = TARG_VTOP(ar->arTargetType, (A_UINT32)debug_buf.buffer); 564 address = TARG_VTOP(ar->arTargetType, data[1] /* buffer*/);
626 length = debug_buf.length; 565 length = data[3]; /* length */
627 if ((length) && (debug_buf.length <= debug_buf.bufsize)) { 566 if ((length) && (length <= data[2] /* bufsize*/)) {
628 /* Rewind the index if it is about to overrun the buffer */ 567 /* Rewind the index if it is about to overrun the buffer */
629 if (ar->log_cnt > (DBGLOG_HOST_LOG_BUFFER_SIZE - length)) { 568 if (ar->log_cnt > (DBGLOG_HOST_LOG_BUFFER_SIZE - length)) {
630 ar->log_cnt = 0; 569 ar->log_cnt = 0;
631 } 570 }
632 if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address, 571 if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address,
633 (A_UCHAR *)&ar->log_buffer[ar->log_cnt], len gth)) 572 (A_UCHAR *)&ar->log_buffer[ar->log_cnt], len gth))
634 { 573 {
635 break; 574 break;
636 } 575 }
637 ar6000_dbglog_event(ar, dropped, (A_INT8*)&ar->log_buffer[ar->lo g_cnt], length); 576 ar6000_dbglog_event(ar, dropped, (A_INT8*)&ar->log_buffer[ar->lo g_cnt], length);
638 ar->log_cnt += length; 577 ar->log_cnt += length;
639 } else { 578 } else {
640 AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("Length: %d (Total size: %d)\ n", 579 AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("Length: %d (Total size: %d)\ n",
641 debug_buf.length, debug_buf.bufsize)); 580 data[3], data[2]));
642 } 581 }
643 582
644 address = TARG_VTOP(ar->arTargetType, (A_UINT32)debug_buf.next); 583 address = TARG_VTOP(ar->arTargetType, data[0] /* next */);
645 length = sizeof(struct dbglog_buf_s); 584 length = 4 /* sizeof(next) */ + 4 /* sizeof(buffer) */ + 4 /* sizeof (bufsize) */ + 4 /* sizeof(length) */ + 4 /* sizeof(count) */ + 4 /* sizeof(free ) */;
585 A_MEMZERO(data, sizeof(data));
646 if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address, 586 if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address,
647 (A_UCHAR *)&debug_buf, length)) 587 (A_UCHAR *)&data, length))
648 { 588 {
649 break; 589 break;
650 } 590 }
651 591
652 } while (address != firstbuf); 592 } while (address != firstbuf);
653 } 593 }
654 594
655 ar->dbgLogFetchInProgress = FALSE; 595 ar->dbgLogFetchInProgress = FALSE;
656 596
657 return A_OK; 597 return A_OK;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 ATH_DEBUG_SET_DEBUG_MASK(driver,debugdriver); 653 ATH_DEBUG_SET_DEBUG_MASK(driver,debugdriver);
714 } 654 }
715 655
716 #endif 656 #endif
717 657
718 A_REGISTER_MODULE_DEBUG_INFO(driver); 658 A_REGISTER_MODULE_DEBUG_INFO(driver);
719 659
720 A_MEMZERO(&osdrvCallbacks,sizeof(osdrvCallbacks)); 660 A_MEMZERO(&osdrvCallbacks,sizeof(osdrvCallbacks));
721 osdrvCallbacks.deviceInsertedHandler = ar6000_avail_ev; 661 osdrvCallbacks.deviceInsertedHandler = ar6000_avail_ev;
722 osdrvCallbacks.deviceRemovedHandler = ar6000_unavail_ev; 662 osdrvCallbacks.deviceRemovedHandler = ar6000_unavail_ev;
663 #ifdef CONFIG_PM
664 osdrvCallbacks.deviceSuspendHandler = ar6000_suspend_ev;
665 osdrvCallbacks.deviceResumeHandler = ar6000_resume_ev;
666 osdrvCallbacks.devicePowerChangeHandler = ar6000_power_change_ev;
667 #endif
668
669 ar6000_pm_init();
723 670
724 #ifdef ANDROID_ENV 671 #ifdef ANDROID_ENV
725 android_module_init(&osdrvCallbacks); 672 android_module_init(&osdrvCallbacks);
726 #endif 673 #endif
727 674
728 #ifdef DEBUG 675 #ifdef DEBUG
729 /* Set the debug flags if specified at load time */ 676 /* Set the debug flags if specified at load time */
730 if(debugflags != 0) 677 if(debugflags != 0)
731 { 678 {
732 g_dbg_flags = debugflags; 679 g_dbg_flags = debugflags;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 ar6000_netdev = ar6000_devices[i]; 718 ar6000_netdev = ar6000_devices[i];
772 ar6000_devices[i] = NULL; 719 ar6000_devices[i] = NULL;
773 ar6000_destroy(ar6000_netdev, 1); 720 ar6000_destroy(ar6000_netdev, 1);
774 } 721 }
775 } 722 }
776 723
777 HIFShutDownDevice(NULL); 724 HIFShutDownDevice(NULL);
778 725
779 a_module_debug_support_cleanup(); 726 a_module_debug_support_cleanup();
780 727
728 ar6000_pm_exit();
729
781 #ifdef ANDROID_ENV 730 #ifdef ANDROID_ENV
782 android_module_exit(); 731 android_module_exit();
783 #endif 732 #endif
784 733
785 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_cleanup: success\n")); 734 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_cleanup: success\n"));
786 } 735 }
787 736
788 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL 737 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
789 void 738 void
790 aptcTimerHandler(unsigned long arg) 739 aptcTimerHandler(unsigned long arg)
791 { 740 {
792 A_UINT32 numbytes; 741 A_UINT32 numbytes;
793 A_UINT32 throughput; 742 A_UINT32 throughput;
794 AR_SOFTC_T *ar; 743 AR_SOFTC_T *ar;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 } 792 }
844 #endif 793 #endif
845 794
846 static struct bin_attribute bmi_attr = { 795 static struct bin_attribute bmi_attr = {
847 .attr = {.name = "bmi", .mode = 0600}, 796 .attr = {.name = "bmi", .mode = 0600},
848 .read = ar6000_sysfs_bmi_read, 797 .read = ar6000_sysfs_bmi_read,
849 .write = ar6000_sysfs_bmi_write, 798 .write = ar6000_sysfs_bmi_write,
850 }; 799 };
851 800
852 static ssize_t 801 static ssize_t
853 ar6000_sysfs_bmi_read(struct kobject *kobj, struct bin_attribute *bin_attr, 802 ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj,
803 struct bin_attribute *bin_attr,
854 char *buf, loff_t pos, size_t count) 804 char *buf, loff_t pos, size_t count)
855 { 805 {
856 int index; 806 int index;
857 AR_SOFTC_T *ar; 807 AR_SOFTC_T *ar;
858 HIF_DEVICE_OS_DEVICE_INFO *osDevInfo; 808 HIF_DEVICE_OS_DEVICE_INFO *osDevInfo;
859 809
860 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Read %d bytes\n", count)); 810 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Read %d bytes\n", (A_UINT32)count));
861 for (index=0; index < MAX_AR6000; index++) { 811 for (index=0; index < MAX_AR6000; index++) {
862 ar = (AR_SOFTC_T *)ar6k_priv(ar6000_devices[index]); 812 ar = (AR_SOFTC_T *)ar6k_priv(ar6000_devices[index]);
863 osDevInfo = &ar->osDevInfo; 813 osDevInfo = &ar->osDevInfo;
864 if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { 814 if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) {
865 break; 815 break;
866 } 816 }
867 } 817 }
868 818
869 if (index == MAX_AR6000) return 0; 819 if (index == MAX_AR6000) return 0;
870 820
871 if ((BMIRawRead(ar->arHifDevice, (A_UCHAR*)buf, count, TRUE)) != A_OK) { 821 if ((BMIRawRead(ar->arHifDevice, (A_UCHAR*)buf, count, TRUE)) != A_OK) {
872 return 0; 822 return 0;
873 } 823 }
874 824
875 return count; 825 return count;
876 } 826 }
877 827
878 static ssize_t 828 static ssize_t
879 ar6000_sysfs_bmi_write(struct kobject *kobj, struct bin_attribute *bin_attr, 829 ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj,
830 struct bin_attribute *bin_attr,
880 char *buf, loff_t pos, size_t count) 831 char *buf, loff_t pos, size_t count)
881 { 832 {
882 int index; 833 int index;
883 AR_SOFTC_T *ar; 834 AR_SOFTC_T *ar;
884 HIF_DEVICE_OS_DEVICE_INFO *osDevInfo; 835 HIF_DEVICE_OS_DEVICE_INFO *osDevInfo;
885 836
886 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Write %d bytes\n", count)); 837 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Write %d bytes\n", (A_UINT32)count));
887 for (index=0; index < MAX_AR6000; index++) { 838 for (index=0; index < MAX_AR6000; index++) {
888 ar = (AR_SOFTC_T *)ar6k_priv(ar6000_devices[index]); 839 ar = (AR_SOFTC_T *)ar6k_priv(ar6000_devices[index]);
889 osDevInfo = &ar->osDevInfo; 840 osDevInfo = &ar->osDevInfo;
890 if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { 841 if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) {
891 break; 842 break;
892 } 843 }
893 } 844 }
894 845
895 if (index == MAX_AR6000) return 0; 846 if (index == MAX_AR6000) return 0;
896 847
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 #define bmifn(fn) do { \ 892 #define bmifn(fn) do { \
942 if ((fn) < A_OK) { \ 893 if ((fn) < A_OK) { \
943 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)) ; \ 894 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)) ; \
944 return A_ERROR; \ 895 return A_ERROR; \
945 } \ 896 } \
946 } while(0) 897 } while(0)
947 898
948 #ifdef INIT_MODE_DRV_ENABLED 899 #ifdef INIT_MODE_DRV_ENABLED
949 900
950 #ifdef SOFTMAC_FILE_USED 901 #ifdef SOFTMAC_FILE_USED
951 #define AR6001_MAC_ADDRESS_OFFSET 0x06
952 #define AR6002_MAC_ADDRESS_OFFSET 0x0A 902 #define AR6002_MAC_ADDRESS_OFFSET 0x0A
953 #define AR6003_MAC_ADDRESS_OFFSET 0x16 903 #define AR6003_MAC_ADDRESS_OFFSET 0x16
954 static 904 static
955 void calculate_crc(A_UINT32 TargetType, A_UCHAR *eeprom_data) 905 void calculate_crc(A_UINT32 TargetType, A_UCHAR *eeprom_data)
956 { 906 {
957 A_UINT16 *ptr_crc; 907 A_UINT16 *ptr_crc;
958 A_UINT16 *ptr16_eeprom; 908 A_UINT16 *ptr16_eeprom;
959 A_UINT16 checksum; 909 A_UINT16 checksum;
960 A_UINT32 i; 910 A_UINT32 i;
961 A_UINT32 eeprom_size; 911 A_UINT32 eeprom_size;
(...skipping 30 matching lines...) Expand all
992 *ptr_crc = checksum; 942 *ptr_crc = checksum;
993 } 943 }
994 944
995 static void 945 static void
996 ar6000_softmac_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t size) 946 ar6000_softmac_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t size)
997 { 947 {
998 const char *source = "random generated"; 948 const char *source = "random generated";
999 const struct firmware *softmac_entry; 949 const struct firmware *softmac_entry;
1000 A_UCHAR *ptr_mac; 950 A_UCHAR *ptr_mac;
1001 switch (ar->arTargetType) { 951 switch (ar->arTargetType) {
1002 case TARGET_TYPE_AR6001:
1003 ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6001_MAC_ADDRESS_OFFSET );
1004 break;
1005 case TARGET_TYPE_AR6002: 952 case TARGET_TYPE_AR6002:
1006 ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6002_MAC_ADDRESS_OFFSET ); 953 ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6002_MAC_ADDRESS_OFFSET );
1007 break; 954 break;
1008 case TARGET_TYPE_AR6003: 955 case TARGET_TYPE_AR6003:
1009 ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6003_MAC_ADDRESS_OFFSET ); 956 ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6003_MAC_ADDRESS_OFFSET );
1010 break; 957 break;
1011 default: 958 default:
1012 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Target Type \n")); 959 » AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Invalid Target Type\n"));
1013 return; 960 return;
1014 } 961 }
1015 printk("MAC from EEPROM %02X:%02X:%02X:%02X:%02X:%02X\n", 962 » printk(KERN_DEBUG "MAC from EEPROM %pM\n", ptr_mac);
1016 ptr_mac[0], ptr_mac[1], ptr_mac[2],
1017 ptr_mac[3], ptr_mac[4], ptr_mac[5]);
1018 963
1019 /* create a random MAC in case we cannot read file from system */ 964 /* create a random MAC in case we cannot read file from system */
1020 ptr_mac[0] = 0; 965 ptr_mac[0] = 0;
1021 ptr_mac[1] = 0x03; 966 ptr_mac[1] = 0x03;
1022 ptr_mac[2] = 0x7F; 967 ptr_mac[2] = 0x7F;
1023 ptr_mac[3] = random32() & 0xff; 968 ptr_mac[3] = random32() & 0xff;
1024 ptr_mac[4] = random32() & 0xff; 969 ptr_mac[4] = random32() & 0xff;
1025 ptr_mac[5] = random32() & 0xff; 970 ptr_mac[5] = random32() & 0xff;
1026 if ((A_REQUEST_FIRMWARE(&softmac_entry, "softmac", ((struct device *)ar->osD evInfo.pOSDevice))) == 0) 971 if ((A_REQUEST_FIRMWARE(&softmac_entry, "softmac", ((struct device *)ar->osD evInfo.pOSDevice))) == 0)
1027 { 972 {
1028 A_CHAR *macbuf = A_MALLOC_NOWAIT(softmac_entry->size+1); 973 A_CHAR *macbuf = A_MALLOC_NOWAIT(softmac_entry->size+1);
1029 if (macbuf) { 974 if (macbuf) {
1030 unsigned int softmac[6]; 975 unsigned int softmac[6];
1031 memcpy(macbuf, softmac_entry->data, softmac_entry->size); 976 memcpy(macbuf, softmac_entry->data, softmac_entry->size);
1032 macbuf[softmac_entry->size] = '\0'; 977 macbuf[softmac_entry->size] = '\0';
1033 if (sscanf(macbuf, "%02x:%02x:%02x:%02x:%02x:%02x", 978 if (sscanf(macbuf, "%02x:%02x:%02x:%02x:%02x:%02x",
1034 &softmac[0], &softmac[1], &softmac[2], 979 &softmac[0], &softmac[1], &softmac[2],
1035 &softmac[3], &softmac[4], &softmac[5])==6) { 980 &softmac[3], &softmac[4], &softmac[5])==6) {
1036 int i; 981 int i;
1037 for (i=0; i<6; ++i) { 982 for (i=0; i<6; ++i) {
1038 ptr_mac[i] = softmac[i] & 0xff; 983 ptr_mac[i] = softmac[i] & 0xff;
1039 } 984 }
1040 source = "softmac file"; 985 source = "softmac file";
1041 } 986 }
1042 A_FREE(macbuf); 987 A_FREE(macbuf);
1043 } 988 }
1044 A_RELEASE_FIRMWARE(softmac_entry); 989 A_RELEASE_FIRMWARE(softmac_entry);
1045 } 990 }
1046 printk("MAC from %s %02X:%02X:%02X:%02X:%02X:%02X\n", source, 991 » printk(KERN_DEBUG "MAC from %s %pM\n", source, ptr_mac);
1047 ptr_mac[0], ptr_mac[1], ptr_mac[2],
1048 ptr_mac[3], ptr_mac[4], ptr_mac[5]);
1049 calculate_crc(ar->arTargetType, eeprom_data); 992 calculate_crc(ar->arTargetType, eeprom_data);
1050 } 993 }
1051 #endif /* SOFTMAC_FILE_USED */ 994 #endif /* SOFTMAC_FILE_USED */
1052 995
1053 static A_STATUS 996 static A_STATUS
1054 ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A _BOOL compressed) 997 ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A _BOOL compressed)
1055 { 998 {
1056 A_STATUS status; 999 A_STATUS status;
1057 const char *filename; 1000 const char *filename;
1058 const struct firmware *fw_entry; 1001 const struct firmware *fw_entry;
1002 A_UINT32 fw_entry_size;
1059 1003
1060 switch (file) { 1004 switch (file) {
1061 case AR6K_OTP_FILE: 1005 case AR6K_OTP_FILE:
1062 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { 1006 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
1063 filename = AR6003_REV1_OTP_FILE; 1007 filename = AR6003_REV1_OTP_FILE;
1064 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { 1008 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
1065 filename = AR6003_REV2_OTP_FILE; 1009 filename = AR6003_REV2_OTP_FILE;
1066 } else { 1010 } else {
1067 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n ", ar->arVersion.target_ver)); 1011 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n ", ar->arVersion.target_ver));
1068 return A_ERROR; 1012 return A_ERROR;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); 1096 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename));
1153 return A_ENOENT; 1097 return A_ENOENT;
1154 } 1098 }
1155 1099
1156 #ifdef SOFTMAC_FILE_USED 1100 #ifdef SOFTMAC_FILE_USED
1157 if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) { 1101 if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) {
1158 ar6000_softmac_update(ar, (A_UCHAR *)fw_entry->data, fw_entry->size); 1102 ar6000_softmac_update(ar, (A_UCHAR *)fw_entry->data, fw_entry->size);
1159 } 1103 }
1160 #endif 1104 #endif
1161 1105
1106
1107 fw_entry_size = fw_entry->size;
1108
1109 /* Load extended board data for AR6003 */
1110 if ((file==AR6K_BOARD_DATA_FILE) && (fw_entry->data)) {
1111 A_UINT32 board_ext_address;
1112 A_UINT32 board_ext_data_size;
1113 A_UINT32 board_data_size;
1114
1115 board_ext_data_size = (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR60 02_BOARD_EXT_DATA_SZ : \
1116 (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6 003_BOARD_EXT_DATA_SZ : 0));
1117
1118 board_data_size = (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_B OARD_DATA_SZ : \
1119 (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_B OARD_DATA_SZ : 0));
1120
1121 /* Determine where in Target RAM to write Board Data */
1122 bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_b oard_ext_data), (A_UCHAR *)&board_ext_address, 4));
1123 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address));
1124
1125 /* check whether the target has allocated memory for extended board data and file contains extended board data */
1126 if ((board_ext_address) && (fw_entry->size == (board_data_size + board_e xt_data_size))) {
1127 A_UINT32 param;
1128
1129 status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (A_UCHAR *)(((A_UINT32)fw_entry->data) + board_data_size), board_ext_data_size);
1130
1131 if (status != A_OK) {
1132 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __ LINE__));
1133 A_RELEASE_FIRMWARE(fw_entry);
1134 return A_ERROR;
1135 }
1136
1137 /* Record the fact that extended board Data IS initialized */
1138 param = 1;
1139 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data_initialized), (A_UCHAR *)&param, 4));
1140 }
1141 fw_entry_size = board_data_size;
1142 }
1143
1162 if (compressed) { 1144 if (compressed) {
1163 status = BMIFastDownload(ar->arHifDevice, address, (A_UCHAR *)fw_entry-> data, fw_entry->size); 1145 status = BMIFastDownload(ar->arHifDevice, address, (A_UCHAR *)fw_entry-> data, fw_entry_size);
1164 } else { 1146 } else {
1165 status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->d ata, fw_entry->size); 1147 status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->d ata, fw_entry_size);
1166 } 1148 }
1167 1149
1168 if (status != A_OK) { 1150 if (status != A_OK) {
1169 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)) ; 1151 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)) ;
1170 A_RELEASE_FIRMWARE(fw_entry); 1152 A_RELEASE_FIRMWARE(fw_entry);
1171 return A_ERROR; 1153 return A_ERROR;
1172 } 1154 }
1173 A_RELEASE_FIRMWARE(fw_entry); 1155 A_RELEASE_FIRMWARE(fw_entry);
1174 return A_OK; 1156 return A_OK;
1175 } 1157 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); 1216 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param));
1235 1217
1236 address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS; 1218 address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS;
1237 bmifn(BMIReadSOCRegister(ar->arHifDevice, address, &param)); 1219 bmifn(BMIReadSOCRegister(ar->arHifDevice, address, &param));
1238 sleep = param; 1220 sleep = param;
1239 param |= WLAN_SYSTEM_SLEEP_DISABLE_SET(1); 1221 param |= WLAN_SYSTEM_SLEEP_DISABLE_SET(1);
1240 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); 1222 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param));
1241 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("old options: %d, old sleep: %d\n", opt ions, sleep)); 1223 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("old options: %d, old sleep: %d\n", opt ions, sleep));
1242 1224
1243 if (ar->arTargetType == TARGET_TYPE_AR6003) { 1225 if (ar->arTargetType == TARGET_TYPE_AR6003) {
1226 /* Program analog PLL register */
1227 bmifn(BMIWriteSOCRegister(ar->arHifDevice, ANALOG_INTF_BASE_ADDRESS + 0x284, 0xF9104001));
1244 /* Run at 80/88MHz by default */ 1228 /* Run at 80/88MHz by default */
1245 param = CPU_CLOCK_STANDARD_SET(1); 1229 param = CPU_CLOCK_STANDARD_SET(1);
1246 } else { 1230 } else {
1247 /* Run at 40/44MHz by default */ 1231 /* Run at 40/44MHz by default */
1248 param = CPU_CLOCK_STANDARD_SET(0); 1232 param = CPU_CLOCK_STANDARD_SET(0);
1249 } 1233 }
1250 address = RTC_BASE_ADDRESS + CPU_CLOCK_ADDRESS; 1234 address = RTC_BASE_ADDRESS + CPU_CLOCK_ADDRESS;
1251 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); 1235 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param));
1252 1236
1253 param = 0; 1237 param = 0;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1327 }
1344 1328
1345 param = address; 1329 param = address;
1346 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_ dset_list_head), (A_UCHAR *)&param, 4)); 1330 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_ dset_list_head), (A_UCHAR *)&param, 4));
1347 1331
1348 if (ar->arTargetType == TARGET_TYPE_AR6003) { 1332 if (ar->arTargetType == TARGET_TYPE_AR6003) {
1349 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { 1333 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
1350 /* Reserve 5.5K of RAM */ 1334 /* Reserve 5.5K of RAM */
1351 param = 5632; 1335 param = 5632;
1352 } else { /* AR6003_REV2_VERSION */ 1336 } else { /* AR6003_REV2_VERSION */
1353 /* Reserve 6K of RAM */ 1337 /* Reserve 6.5K of RAM */
1354 param = 6144; 1338 param = 6656;
1355 } 1339 }
1356 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_end_RAM_reserve_sz), (A_UCHAR *)&param, 4)); 1340 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_end_RAM_reserve_sz), (A_UCHAR *)&param, 4));
1357 } 1341 }
1358 1342
1359 /* Restore system sleep */ 1343 /* Restore system sleep */
1360 address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS; 1344 address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS;
1361 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, sleep)); 1345 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, sleep));
1362 1346
1363 address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS; 1347 address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS;
1364 param = options | 0x20; 1348 param = options | 0x20;
1365 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); 1349 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param));
1366 /* Get the device address for BT if enabled */
1367 ar6000_update_bdaddr(ar);
1368 1350
1369 if (ar->arTargetType == TARGET_TYPE_AR6003) { 1351 if (ar->arTargetType == TARGET_TYPE_AR6003) {
1370 /* Configure GPIO AR6003 UART */ 1352 /* Configure GPIO AR6003 UART */
1371 #ifndef CONFIG_AR600x_DEBUG_UART_TX_PIN 1353 #ifndef CONFIG_AR600x_DEBUG_UART_TX_PIN
1372 #define CONFIG_AR600x_DEBUG_UART_TX_PIN 8 1354 #define CONFIG_AR600x_DEBUG_UART_TX_PIN 8
1373 #endif 1355 #endif
1374 param = CONFIG_AR600x_DEBUG_UART_TX_PIN; 1356 param = CONFIG_AR600x_DEBUG_UART_TX_PIN;
1375 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dbg_uart_txpin), (A_UCHAR *)&param, 4)); 1357 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dbg_uart_txpin), (A_UCHAR *)&param, 4));
1376 1358
1377 #if (CONFIG_AR600x_DEBUG_UART_TX_PIN == 23) 1359 #if (CONFIG_AR600x_DEBUG_UART_TX_PIN == 23)
1378 { 1360 {
1379 address = GPIO_BASE_ADDRESS + CLOCK_GPIO_ADDRESS; 1361 address = GPIO_BASE_ADDRESS + CLOCK_GPIO_ADDRESS;
1380 bmifn(BMIReadSOCRegister(ar->arHifDevice, address, &param)); 1362 bmifn(BMIReadSOCRegister(ar->arHifDevice, address, &param));
1381 param |= CLOCK_GPIO_BT_CLK_OUT_EN_SET(1); 1363 param |= CLOCK_GPIO_BT_CLK_OUT_EN_SET(1);
1382 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); 1364 bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param));
1383 } 1365 }
1384 #endif 1366 #endif
1385 1367
1386 /* Configure GPIO for BT Reset */ 1368 /* Configure GPIO for BT Reset */
1387 #ifdef ATH6KL_CONFIG_GPIO_BT_RESET 1369 #ifdef ATH6KL_CONFIG_GPIO_BT_RESET
1370 #define CONFIG_AR600x_BT_RESET_PIN 0x16
1388 param = CONFIG_AR600x_BT_RESET_PIN; 1371 param = CONFIG_AR600x_BT_RESET_PIN;
1389 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_support_pins), (A_UCHAR *)&param, 4)); 1372 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_support_pins), (A_UCHAR *)&param, 4));
1390 #endif /* ATH6KL_CONFIG_GPIO_BT_RESET */ 1373 #endif /* ATH6KL_CONFIG_GPIO_BT_RESET */
1374
1375 /* Configure UART flow control polarity */
1376 #ifndef CONFIG_ATH6KL_BT_UART_FC_POLARITY
1377 #define CONFIG_ATH6KL_BT_UART_FC_POLARITY 0
1378 #endif
1379
1380 #if (CONFIG_ATH6KL_BT_UART_FC_POLARITY == 1)
1381 if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
1382 param = ((CONFIG_ATH6KL_BT_UART_FC_POLARITY << 1) & 0x2);
1383 bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS (ar, hi_hci_uart_pwr_mgmt_params), (A_UCHAR *)&param, 4));
1384 }
1385 #endif /* CONFIG_ATH6KL_BT_UART_FC_POLARITY */
1391 } 1386 }
1387
1392 #ifdef HTC_RAW_INTERFACE 1388 #ifdef HTC_RAW_INTERFACE
1393 if (!eppingtest && bypasswmi) { 1389 if (!eppingtest && bypasswmi) {
1394 /* Don't run BMIDone for ART mode and force resetok=0 */ 1390 /* Don't run BMIDone for ART mode and force resetok=0 */
1395 resetok = 0; 1391 resetok = 0;
1396 msleep(1000); 1392 msleep(1000);
1397 return A_OK;
1398 } 1393 }
1399 #endif /* HTC_RAW_INTERFACE */ 1394 #endif /* HTC_RAW_INTERFACE */
1400 /* Tell Target to execute loaded firmware */ 1395
1401 bmifn(BMIDone(ar->arHifDevice));
1402 #endif /* INIT_MODE_DRV_ENABLED */ 1396 #endif /* INIT_MODE_DRV_ENABLED */
1403 } 1397 }
1404 1398
1405 return A_OK; 1399 return A_OK;
1406 } 1400 }
1407 1401
1408 A_STATUS 1402 A_STATUS
1409 ar6000_configure_target(AR_SOFTC_T *ar) 1403 ar6000_configure_target(AR_SOFTC_T *ar)
1410 { 1404 {
1411 A_UINT32 param; 1405 A_UINT32 param;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 if (BMIWriteMemory(ar->arHifDevice, 1477 if (BMIWriteMemory(ar->arHifDevice,
1484 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), 1478 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag),
1485 (A_UCHAR *)&param, 1479 (A_UCHAR *)&param,
1486 4) != A_OK) 1480 4) != A_OK)
1487 { 1481 {
1488 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for setting fwmode fa iled \n")); 1482 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for setting fwmode fa iled \n"));
1489 return A_ERROR; 1483 return A_ERROR;
1490 } 1484 }
1491 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Firmware mode set\n")); 1485 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Firmware mode set\n"));
1492 } 1486 }
1493 #if 0 /* HOST_INTEREST is no longer used to configure dot11 processing rule */
1494 if (processDot11Hdr) {
1495 A_UINT32 param;
1496
1497 if (BMIReadMemory(ar->arHifDevice,
1498 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag),
1499 (A_UCHAR *)&param,
1500 4)!= A_OK)
1501 {
1502 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for processDot11Hdr fa iled \n"));
1503 return A_ERROR;
1504 }
1505
1506 param |= HI_OPTION_RELAY_DOT11_HDR;
1507
1508 if (BMIWriteMemory(ar->arHifDevice,
1509 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag),
1510 (A_UCHAR *)&param,
1511 4) != A_OK)
1512 {
1513 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for processDot11Hdr f ailed \n"));
1514 return A_ERROR;
1515 }
1516 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("processDot11Hdr enabled\n"));
1517 }
1518 #endif
1519 1487
1520 #ifdef ATH6KL_DISABLE_TARGET_DBGLOGS 1488 #ifdef ATH6KL_DISABLE_TARGET_DBGLOGS
1521 { 1489 {
1522 A_UINT32 param; 1490 A_UINT32 param;
1523 1491
1524 if (BMIReadMemory(ar->arHifDevice, 1492 if (BMIReadMemory(ar->arHifDevice,
1525 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), 1493 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag),
1526 (A_UCHAR *)&param, 1494 (A_UCHAR *)&param,
1527 4)!= A_OK) 1495 4)!= A_OK)
1528 { 1496 {
1529 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for disabling debug lo gs failed\n")); 1497 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for disabling debug lo gs failed\n"));
1530 return A_ERROR; 1498 return A_ERROR;
1531 } 1499 }
1532 1500
1533 param |= HI_OPTION_DISABLE_DBGLOG; 1501 param |= HI_OPTION_DISABLE_DBGLOG;
1534 1502
1535 if (BMIWriteMemory(ar->arHifDevice, 1503 if (BMIWriteMemory(ar->arHifDevice,
1536 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), 1504 HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag),
1537 (A_UCHAR *)&param, 1505 (A_UCHAR *)&param,
1538 4) != A_OK) 1506 4) != A_OK)
1539 { 1507 {
1540 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for HI_OPTION_DISABLE _DBGLOG\n")); 1508 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for HI_OPTION_DISABLE _DBGLOG\n"));
1541 return A_ERROR; 1509 return A_ERROR;
1542 } 1510 }
1543 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Firmware mode set\n")); 1511 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Firmware mode set\n"));
1544 } 1512 }
1545 #endif /* ATH6KL_DISABLE_TARGET_DBGLOGS */ 1513 #endif /* ATH6KL_DISABLE_TARGET_DBGLOGS */
1546 1514
1547 // No need to reserve RAM space for patch as AR6001 is flash based 1515 /*
1548 if (ar->arTargetType == TARGET_TYPE_AR6001) { 1516 * Hardcode the address use for the extended board data
1549 param = 0; 1517 * Ideally this should be pre-allocate by the OS at boot time
1518 * But since it is a new feature and board data is loaded
1519 * at init time, we have to workaround this from host.
1520 * It is difficult to patch the firmware boot code,
1521 * but possible in theory.
1522 */
1523 if (ar->arTargetType == TARGET_TYPE_AR6003) {
1524 param = AR6003_BOARD_EXT_DATA_ADDRESS;
1550 if (BMIWriteMemory(ar->arHifDevice, 1525 if (BMIWriteMemory(ar->arHifDevice,
1551 HOST_INTEREST_ITEM_ADDRESS(ar, hi_end_RAM_reserve_sz), 1526 HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data),
1552 (A_UCHAR *)&param, 1527 (A_UCHAR *)&param,
1553 4) != A_OK) 1528 4) != A_OK)
1554 { 1529 {
1555 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for hi_end_RAM_reserv e_sz failed \n")); 1530 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for hi_board_ext_data failed \n"));
1556 return A_ERROR; 1531 return A_ERROR;
1557 } 1532 }
1558 } 1533 }
1559 1534
1560 1535
1561 /* since BMIInit is called in the driver layer, we have to set the block 1536 /* since BMIInit is called in the driver layer, we have to set the block
1562 * size here for the target */ 1537 * size here for the target */
1563 1538
1564 if (A_FAILED(ar6000_set_htc_params(ar->arHifDevice, 1539 if (A_FAILED(ar6000_set_htc_params(ar->arHifDevice,
1565 ar->arTargetType, 1540 ar->arTargetType,
1566 mbox_yield_limit, 1541 mbox_yield_limit,
1567 0 /* use default number of control buffer s */ 1542 0 /* use default number of control buffer s */
1568 ))) { 1543 ))) {
1569 return A_ERROR; 1544 return A_ERROR;
1570 } 1545 }
1571 1546
1572 if (setupbtdev != 0) { 1547 if (setupbtdev != 0) {
1573 if (A_FAILED(ar6000_set_hci_bridge_flags(ar->arHifDevice, 1548 if (A_FAILED(ar6000_set_hci_bridge_flags(ar->arHifDevice,
1574 ar->arTargetType, 1549 ar->arTargetType,
1575 setupbtdev))) { 1550 setupbtdev))) {
1576 return A_ERROR; 1551 return A_ERROR;
1577 } 1552 }
1578 } 1553 }
1579 return A_OK; 1554 return A_OK;
1580 } 1555 }
1581 1556
1557 static void
1558 init_netdev(struct net_device *dev, char *name)
1559 {
1560 dev->netdev_ops = &ar6000_netdev_ops;
1561 dev->watchdog_timeo = AR6000_TX_TIMEOUT;
1562 dev->wireless_handlers = &ath_iw_handler_def;
1563
1564 ath_iw_handler_def.get_wireless_stats = ar6000_get_iwstats; /*Displayed via proc fs */
1565
1566 /*
1567 * We need the OS to provide us with more headroom in order to
1568 * perform dix to 802.3, WMI header encap, and the HTC header
1569 */
1570 if (processDot11Hdr) {
1571 dev->hard_header_len = sizeof(struct ieee80211_qosframe) + sizeof(ATH_LL C_SNAP_HDR) + sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX _HACK_FUDGE_FACTOR;
1572 } else {
1573 dev->hard_header_len = ETH_HLEN + sizeof(ATH_LLC_SNAP_HDR) +
1574 sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX_H ACK_FUDGE_FACTOR;
1575 }
1576
1577 if (name[0])
1578 {
1579 strcpy(dev->name, name);
1580 }
1581
1582 #ifdef SET_MODULE_OWNER
1583 SET_MODULE_OWNER(dev);
1584 #endif
1585
1586 #ifdef CONFIG_CHECKSUM_OFFLOAD
1587 if(csumOffload){
1588 dev->features |= NETIF_F_IP_CSUM; /*advertise kernel capability to do TC P/UDP CSUM offload for IPV4*/
1589 }
1590 #endif
1591
1592 return;
1593 }
1594
1582 /* 1595 /*
1583 * HTC Event handlers 1596 * HTC Event handlers
1584 */ 1597 */
1585 static A_STATUS 1598 static A_STATUS
1586 ar6000_avail_ev(void *context, void *hif_handle) 1599 ar6000_avail_ev(void *context, void *hif_handle)
1587 { 1600 {
1588 int i; 1601 int i;
1589 struct net_device *dev; 1602 struct net_device *dev;
1590 void *ar_netif; 1603 void *ar_netif;
1591 AR_SOFTC_T *ar; 1604 AR_SOFTC_T *ar;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 ar6k_cfg80211_deinit(ar); 1661 ar6k_cfg80211_deinit(ar);
1649 return A_ERROR; 1662 return A_ERROR;
1650 } 1663 }
1651 1664
1652 dev->ieee80211_ptr = wdev; 1665 dev->ieee80211_ptr = wdev;
1653 SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); 1666 SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy));
1654 wdev->netdev = dev; 1667 wdev->netdev = dev;
1655 ar->arNetworkType = INFRA_NETWORK; 1668 ar->arNetworkType = INFRA_NETWORK;
1656 #endif /* ATH6K_CONFIG_CFG80211 */ 1669 #endif /* ATH6K_CONFIG_CFG80211 */
1657 1670
1658 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 1671 init_netdev(dev, ifname);
1659 if (ifname[0])
1660 {
1661 strcpy(dev->name, ifname);
1662 }
1663 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
1664
1665 #ifdef SET_MODULE_OWNER
1666 SET_MODULE_OWNER(dev);
1667 #endif
1668 1672
1669 #ifdef SET_NETDEV_DEV 1673 #ifdef SET_NETDEV_DEV
1670 if (ar_netif) { 1674 if (ar_netif) {
1671 HIF_DEVICE_OS_DEVICE_INFO osDevInfo; 1675 HIF_DEVICE_OS_DEVICE_INFO osDevInfo;
1672 A_MEMZERO(&osDevInfo, sizeof(osDevInfo)); 1676 A_MEMZERO(&osDevInfo, sizeof(osDevInfo));
1673 if ( A_SUCCESS( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, 1677 if ( A_SUCCESS( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE,
1674 &osDevInfo, sizeof(osDevInfo))) ) { 1678 &osDevInfo, sizeof(osDevInfo))) ) {
1675 SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); 1679 SET_NETDEV_DEV(dev, osDevInfo.pOSDevice);
1676 } 1680 }
1677 } 1681 }
1678 #endif 1682 #endif
1679 1683
1680 ar->arNetDev = dev; 1684 ar->arNetDev = dev;
1681 ar->arHifDevice = hif_handle; 1685 ar->arHifDevice = hif_handle;
1682 ar->arWlanState = WLAN_ENABLED; 1686 ar->arWlanState = WLAN_ENABLED;
1683 ar->arDeviceIndex = device_index; 1687 ar->arDeviceIndex = device_index;
1684 1688
1689 ar->arWlanPowerState = WLAN_POWER_STATE_ON;
1690 ar->arWlanOff = FALSE; /* We are in ON state */
1691 #ifdef CONFIG_PM
1692 ar->arWowState = WLAN_WOW_STATE_NONE;
1693 ar->arBTOff = TRUE; /* BT chip assumed to be OFF */
1694 ar->arBTSharing = WLAN_CONFIG_BT_SHARING;
1695 ar->arWlanOffConfig = WLAN_CONFIG_WLAN_OFF;
1696 ar->arSuspendConfig = WLAN_CONFIG_PM_SUSPEND;
1697 ar->arWow2Config = WLAN_CONFIG_PM_WOW2;
1698 #endif /* CONFIG_PM */
1699
1685 A_INIT_TIMER(&ar->arHBChallengeResp.timer, ar6000_detect_error, dev); 1700 A_INIT_TIMER(&ar->arHBChallengeResp.timer, ar6000_detect_error, dev);
1686 ar->arHBChallengeResp.seqNum = 0; 1701 ar->arHBChallengeResp.seqNum = 0;
1687 ar->arHBChallengeResp.outstanding = FALSE; 1702 ar->arHBChallengeResp.outstanding = FALSE;
1688 ar->arHBChallengeResp.missCnt = 0; 1703 ar->arHBChallengeResp.missCnt = 0;
1689 ar->arHBChallengeResp.frequency = AR6000_HB_CHALLENGE_RESP_FREQ_DEFAULT; 1704 ar->arHBChallengeResp.frequency = AR6000_HB_CHALLENGE_RESP_FREQ_DEFAULT;
1690 ar->arHBChallengeResp.missThres = AR6000_HB_CHALLENGE_RESP_MISS_THRES_DEFAUL T; 1705 ar->arHBChallengeResp.missThres = AR6000_HB_CHALLENGE_RESP_MISS_THRES_DEFAUL T;
1691 1706
1692 ar6000_init_control_info(ar); 1707 ar6000_init_control_info(ar);
1693 init_waitqueue_head(&arEvent); 1708 init_waitqueue_head(&arEvent);
1694 sema_init(&ar->arSem, 1); 1709 sema_init(&ar->arSem, 1);
1695 ar->bIsDestroyProgress = FALSE; 1710 ar->bIsDestroyProgress = FALSE;
1696 1711
1697 INIT_HTC_PACKET_QUEUE(&ar->amsdu_rx_buffer_queue); 1712 INIT_HTC_PACKET_QUEUE(&ar->amsdu_rx_buffer_queue);
1698 1713
1699 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL 1714 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
1700 A_INIT_TIMER(&aptcTimer, aptcTimerHandler, ar); 1715 A_INIT_TIMER(&aptcTimer, aptcTimerHandler, ar);
1701 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ 1716 #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */
1702 1717
1703 A_INIT_TIMER(&ar->disconnect_timer, disconnect_timer_handler, dev); 1718 A_INIT_TIMER(&ar->disconnect_timer, disconnect_timer_handler, dev);
1704 1719
1705 /*
1706 * If requested, perform some magic which requires no cooperation from
1707 * the Target. It causes the Target to ignore flash and execute to the
1708 * OS from ROM.
1709 *
1710 * This is intended to support recovery from a corrupted flash on Targets
1711 * that support flash.
1712 */
1713 if (skipflash)
1714 {
1715 //ar6000_reset_device_skipflash(ar->arHifDevice);
1716 }
1717
1718 BMIInit(); 1720 BMIInit();
1719 1721
1720 if (bmienable) { 1722 if (bmienable) {
1721 ar6000_sysfs_bmi_init(ar); 1723 ar6000_sysfs_bmi_init(ar);
1722 } 1724 }
1723 1725
1724 { 1726 {
1725 struct bmi_target_info targ_info; 1727 struct bmi_target_info targ_info;
1726 1728
1727 if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != A_OK) { 1729 if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != A_OK) {
(...skipping 29 matching lines...) Expand all
1757 init_status = A_ERROR; 1759 init_status = A_ERROR;
1758 goto avail_ev_failed; 1760 goto avail_ev_failed;
1759 } 1761 }
1760 1762
1761 spin_lock_init(&ar->arLock); 1763 spin_lock_init(&ar->arLock);
1762 1764
1763 #ifdef WAPI_ENABLE 1765 #ifdef WAPI_ENABLE
1764 ar->arWapiEnable = 0; 1766 ar->arWapiEnable = 0;
1765 #endif 1767 #endif
1766 1768
1767 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
1768 dev->open = &ar6000_open;
1769 dev->stop = &ar6000_close;
1770 dev->hard_start_xmit = &ar6000_data_tx;
1771 dev->get_stats = &ar6000_get_stats;
1772 1769
1773 /* dev->tx_timeout = ar6000_tx_timeout; */
1774 dev->do_ioctl = &ar6000_ioctl;
1775 dev->set_multicast_list = &ar6000_set_multicast_list;
1776 #else
1777 dev->netdev_ops = &ar6000_netdev_ops;
1778 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
1779 dev->watchdog_timeo = AR6000_TX_TIMEOUT;
1780 dev->wireless_handlers = &ath_iw_handler_def;
1781
1782 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
1783 dev->get_wireless_stats = ar6000_get_iwstats; /*Displayed via proc fs */
1784 #else
1785 ath_iw_handler_def.get_wireless_stats = ar6000_get_iwstats; /*Displayed via proc fs */
1786 #endif
1787 #ifdef CONFIG_CHECKSUM_OFFLOAD 1770 #ifdef CONFIG_CHECKSUM_OFFLOAD
1788 if(csumOffload){ 1771 if(csumOffload){
1789 1772 /*if external frame work is also needed, change and use an extended rxMe taVerion*/
1790 dev->features |= NETIF_F_IP_CSUM;/*advertise kernel capability 1773 ar->rxMetaVersion=WMI_META_VERSION_2;
1791 to do TCP/UDP CSUM offload for IPV4 */
1792 ar->rxMetaVersion=WMI_META_VERSION_2;/*if external frame work is also ne eded, change and use an extended rxMetaVerion*/
1793 } 1774 }
1794 #endif 1775 #endif
1795 if (processDot11Hdr) {
1796 dev->hard_header_len = sizeof(struct ieee80211_qosframe) + sizeof(ATH_LL C_SNAP_HDR) + sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX _HACK_FUDGE_FACTOR;
1797 } else {
1798 /*
1799 * We need the OS to provide us with more headroom in order to
1800 * perform dix to 802.3, WMI header encap, and the HTC header
1801 */
1802 dev->hard_header_len = ETH_HLEN + sizeof(ATH_LLC_SNAP_HDR) +
1803 sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX_H ACK_FUDGE_FACTOR;
1804 }
1805 1776
1806 #ifdef ATH_AR6K_11N_SUPPORT 1777 #ifdef ATH_AR6K_11N_SUPPORT
1807 if((ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs)) == NULL) { 1778 if((ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs)) == NULL) {
1808 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize aggr.\n", __func__)); 1779 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize aggr.\n", __func__));
1809 init_status = A_ERROR; 1780 init_status = A_ERROR;
1810 goto avail_ev_failed; 1781 goto avail_ev_failed;
1811 } 1782 }
1812 1783
1813 aggr_register_rx_dispatcher(ar->aggr_cntxt, (void *)dev, ar6000_deliver_fram es_to_nw_stack); 1784 aggr_register_rx_dispatcher(ar->aggr_cntxt, (void *)dev, ar6000_deliver_fram es_to_nw_stack);
1814 #endif 1785 #endif
1815 1786
1816 HIFClaimDevice(ar->arHifDevice, ar); 1787 HIFClaimDevice(ar->arHifDevice, ar);
1817 1788
1818 /* We only register the device in the global list if we succeed. */ 1789 /* We only register the device in the global list if we succeed. */
1819 /* If the device is in the global list, it will be destroyed */ 1790 /* If the device is in the global list, it will be destroyed */
1820 /* when the module is unloaded. */ 1791 /* when the module is unloaded. */
1821 ar6000_devices[device_index] = dev; 1792 ar6000_devices[device_index] = dev;
1822 1793
1823 /* Don't install the init function if BMI is requested */ 1794 /* Don't install the init function if BMI is requested */
1824 if (!bmienable) { 1795 if (!bmienable) {
1825 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
1826 dev->init = ar6000_init;
1827 #else
1828 ar6000_netdev_ops.ndo_init = ar6000_init; 1796 ar6000_netdev_ops.ndo_init = ar6000_init;
1829 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
1830 } else { 1797 } else {
1831 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); 1798 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
1832 if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || 1799 if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
1833 (wlaninitmode == WLAN_INIT_MODE_DRV)) 1800 (wlaninitmode == WLAN_INIT_MODE_DRV))
1834 { 1801 {
1835 A_STATUS status = A_OK; 1802 A_STATUS status = A_OK;
1836 do { 1803 do {
1837 if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK) 1804 if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK)
1838 { 1805 {
1839 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_b mi_get_config failed\n")); 1806 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_b mi_get_config failed\n"));
1840 break; 1807 break;
1841 } 1808 }
1842 #ifdef HTC_RAW_INTERFACE 1809 #ifdef HTC_RAW_INTERFACE
1843 if (bypasswmi) { 1810 break; /* Don't call ar6000_init for ART */
1844 A_UINT32 param = 1;
1845 status = BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ ADDRESS(ar, hi_board_data_initialized),
1846 (A_UCHAR *)&param, 4);
1847 break;
1848 }
1849 #endif 1811 #endif
1850 rtnl_lock(); 1812 rtnl_lock();
1851 status = (ar6000_init(dev)==0) ? A_OK : A_ERROR; 1813 status = (ar6000_init(dev)==0) ? A_OK : A_ERROR;
1852 rtnl_unlock(); 1814 rtnl_unlock();
1853 if (status != A_OK) { 1815 if (status != A_OK) {
1854 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n" )); 1816 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n" ));
1855 } 1817 }
1856 } while (FALSE); 1818 } while (FALSE);
1857 1819
1858 if (status != A_OK) { 1820 if (status != A_OK) {
1859 init_status = status; 1821 init_status = status;
1860 goto avail_ev_failed; 1822 goto avail_ev_failed;
1861 } 1823 }
1862 } 1824 }
1863 } 1825 }
1864 1826
1865 /* This runs the init function if registered */ 1827 /* This runs the init function if registered */
1866 if (register_netdev(dev)) { 1828 if (register_netdev(dev)) {
1867 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n") ); 1829 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n") );
1868 ar6000_destroy(dev, 0); 1830 ar6000_destroy(dev, 0);
1869 return A_ERROR; 1831 return A_ERROR;
1870 } 1832 }
1871 1833
1872 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_avail: name=%s hifdevice=0x%x, dev=0 x%x (%d), ar=0x%x\n", 1834 » is_netdev_registered = 1;
1873 dev->name, (A_UINT32)ar->arHifDevice, (A_UINT32)dev, device_ index, 1835
1874 (A_UINT32)ar)); 1836 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
1837 arApNetDev = NULL;
1838 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
1839 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_avail: name=%s hifdevice=0x%lx, dev= 0x%lx (%d), ar=0x%lx\n",
1840 dev->name, (unsigned long)ar->arHifDevice, (unsigned long)de v, device_index,
1841 (unsigned long)ar));
1875 1842
1876 avail_ev_failed : 1843 avail_ev_failed :
1877 if (A_FAILED(init_status)) { 1844 if (A_FAILED(init_status)) {
1878 if (bmienable) { 1845 if (bmienable) {
1879 ar6000_sysfs_bmi_deinit(ar); 1846 ar6000_sysfs_bmi_deinit(ar);
1880 } 1847 }
1881 } 1848 }
1882 1849
1883 return init_status; 1850 return init_status;
1884 } 1851 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 { 1890 {
1924 AR_SOFTC_T *ar = (AR_SOFTC_T *)context; 1891 AR_SOFTC_T *ar = (AR_SOFTC_T *)context;
1925 /* NULL out it's entry in the global list */ 1892 /* NULL out it's entry in the global list */
1926 ar6000_devices[ar->arDeviceIndex] = NULL; 1893 ar6000_devices[ar->arDeviceIndex] = NULL;
1927 ar6000_destroy(ar->arNetDev, 1); 1894 ar6000_destroy(ar->arNetDev, 1);
1928 1895
1929 return A_OK; 1896 return A_OK;
1930 } 1897 }
1931 1898
1932 void 1899 void
1933 ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile) 1900 ar6000_restart_endpoint(struct net_device *dev)
1901 {
1902 A_STATUS status = A_OK;
1903 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
1904
1905 BMIInit();
1906 do {
1907 if ( (status=ar6000_configure_target(ar))!=A_OK)
1908 break;
1909 if ( (status=ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK)
1910 {
1911 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_c onfig failed\n"));
1912 break;
1913 }
1914 rtnl_lock();
1915 status = (ar6000_init(dev)==0) ? A_OK : A_ERROR;
1916 rtnl_unlock();
1917
1918 if (status!=A_OK) {
1919 break;
1920 }
1921 if (ar->arSsidLen && ar->arWlanState == WLAN_ENABLED) {
1922 ar6000_connect_to_ap(ar);
1923 }
1924 } while (0);
1925
1926 if (status==A_OK) {
1927 return;
1928 }
1929
1930 ar6000_devices[ar->arDeviceIndex] = NULL;
1931 ar6000_destroy(ar->arNetDev, 1);
1932 }
1933
1934 void
1935 ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo gs)
1934 { 1936 {
1935 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 1937 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
1936 1938
1937 /* Stop the transmit queues */ 1939 /* Stop the transmit queues */
1938 netif_stop_queue(dev); 1940 netif_stop_queue(dev);
1939 1941
1940 /* Disable the target and the interrupts associated with it */ 1942 /* Disable the target and the interrupts associated with it */
1941 if (ar->arWmiReady == TRUE) 1943 if (ar->arWmiReady == TRUE)
1942 { 1944 {
1943 if (!bypasswmi) 1945 if (!bypasswmi)
1944 { 1946 {
1945 if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) 1947 if (ar->arConnected == TRUE || ar->arConnectPending == TRUE)
1946 { 1948 {
1947 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Disconnect\n", __func__)) ; 1949 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Disconnect\n", __func__)) ;
1948 #ifdef ANDROID_ENV 1950 if (!keepprofile) {
1949 if (keepprofile) {
1950 wmi_disconnect_cmd(ar->arWmi);
1951 } else
1952 #endif /* ANDROID_ENV */
1953 {
1954 AR6000_SPIN_LOCK(&ar->arLock, 0); 1951 AR6000_SPIN_LOCK(&ar->arLock, 0);
1955 ar6000_init_profile_info(ar); 1952 ar6000_init_profile_info(ar);
1956 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 1953 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
1957 wmi_disconnect_cmd(ar->arWmi);
1958 } 1954 }
1955 wmi_disconnect_cmd(ar->arWmi);
1959 } 1956 }
1957
1960 A_UNTIMEOUT(&ar->disconnect_timer); 1958 A_UNTIMEOUT(&ar->disconnect_timer);
1959
1960 if (getdbglogs) {
1961 ar6000_dbglog_get_debug_logs(ar);
1962 }
1963
1961 ar->arWmiReady = FALSE; 1964 ar->arWmiReady = FALSE;
1962 ar->arConnected = FALSE;
1963 ar->arConnectPending = FALSE;
1964 wmi_shutdown(ar->arWmi); 1965 wmi_shutdown(ar->arWmi);
1965 ar->arWmiEnabled = FALSE; 1966 ar->arWmiEnabled = FALSE;
1966 ar->arWmi = NULL; 1967 ar->arWmi = NULL;
1967 #ifdef ANDROID_ENV 1968 /*
1968 if (!keepprofile) { 1969 * After wmi_shudown all WMI events will be dropped.
1969 ar->arWlanState = WLAN_ENABLED; 1970 * We need to cleanup the buffers allocated in AP mode
1971 * and give disconnect notification to stack, which usually
1972 * happens in the disconnect_event.
1973 * Simulate the disconnect_event by calling the function directly.
1974 * Sometimes disconnect_event will be received when the debug logs
1975 * are collected.
1976 */
1977 if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) {
1978 if(ar->arNetworkType & AP_NETWORK) {
1979 ar6000_disconnect_event(ar, DISCONNECT_CMD, bcast_mac, 0, NU LL, 0);
1980 } else {
1981 ar6000_disconnect_event(ar, DISCONNECT_CMD, ar->arBssid, 0, NULL, 0);
1982 }
1983 ar->arConnected = FALSE;
1984 ar->arConnectPending = FALSE;
1970 } 1985 }
1971 #else
1972 ar->arWlanState = WLAN_ENABLED;
1973 #endif /* ANDROID_ENV */
1974 #ifdef USER_KEYS 1986 #ifdef USER_KEYS
1975 ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; 1987 ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT;
1976 ar->user_key_ctrl = 0; 1988 ar->user_key_ctrl = 0;
1977 #endif 1989 #endif
1978 } 1990 }
1979 1991
1980 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI stopped\n", __func__)); 1992 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI stopped\n", __func__));
1981 } 1993 }
1982 else 1994 else
1983 { 1995 {
1984 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI not ready 0x%08x 0x%08x\n", 1996 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI not ready 0x%lx 0x%lx\n",
1985 __func__, (unsigned int) ar, (unsigned int) ar->arWmi)); 1997 __func__, (unsigned long) ar, (unsigned long) ar->arWmi));
1986 1998
1987 /* Shut down WMI if we have started it */ 1999 /* Shut down WMI if we have started it */
1988 if(ar->arWmiEnabled == TRUE) 2000 if(ar->arWmiEnabled == TRUE)
1989 { 2001 {
1990 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Shut down WMI\n", __func__)); 2002 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Shut down WMI\n", __func__));
1991 wmi_shutdown(ar->arWmi); 2003 wmi_shutdown(ar->arWmi);
1992 ar->arWmiEnabled = FALSE; 2004 ar->arWmiEnabled = FALSE;
1993 ar->arWmi = NULL; 2005 ar->arWmi = NULL;
1994 } 2006 }
1995 } 2007 }
(...skipping 10 matching lines...) Expand all
2006 A_STATUS status; 2018 A_STATUS status;
2007 2019
2008 A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig)); 2020 A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig));
2009 ar6000_set_default_ar3kconfig(ar, (void *)&ar3kconfig); 2021 ar6000_set_default_ar3kconfig(ar, (void *)&ar3kconfig);
2010 status = ar->exitCallback(&ar3kconfig); 2022 status = ar->exitCallback(&ar3kconfig);
2011 if (A_OK != status) { 2023 if (A_OK != status) {
2012 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to reset AR3K baud rate! \n")); 2024 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to reset AR3K baud rate! \n"));
2013 } 2025 }
2014 } 2026 }
2015 // END workaround 2027 // END workaround
2016 ar6000_cleanup_hci(ar); 2028 if (setuphci)
2029 » ar6000_cleanup_hci(ar);
2030 #endif
2031 #ifdef EXPORT_HCI_PAL_INTERFACE
2032 if (setuphcipal && (NULL != ar6kHciPalCallbacks_g.cleanupTransport)) {
2033 ar6kHciPalCallbacks_g.cleanupTransport(ar);
2034 }
2035 #else
2036 » » » » /* cleanup hci pal driver data structures */
2037 if(setuphcipal)
2038 ar6k_cleanup_hci_pal(ar);
2017 #endif 2039 #endif
2018 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Shutting down HTC .... \n")); 2040 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Shutting down HTC .... \n"));
2019 /* stop HTC */ 2041 /* stop HTC */
2020 HTCStop(ar->arHtcTarget); 2042 HTCStop(ar->arHtcTarget);
2021 } 2043 }
2022 2044
2023 if (resetok) { 2045 if (resetok) {
2024 /* try to reset the device if we can 2046 /* try to reset the device if we can
2025 * The driver may have been configure NOT to reset the target during 2047 * The driver may have been configure NOT to reset the target during
2026 * a debug session */ 2048 * a debug session */
2027 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Attempting to reset target on instance destroy.... \n")); 2049 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Attempting to reset target on instance destroy.... \n"));
2028 if (ar->arHifDevice != NULL) { 2050 if (ar->arHifDevice != NULL) {
2029 A_BOOL coldReset = FALSE; 2051 A_BOOL coldReset = (ar->arTargetType == TARGET_TYPE_AR6003) ? TRUE: FALSE;
2030 #ifdef CONFIG_MMC_SDHCI_S3C
2031 coldReset = TRUE;
2032 #endif
2033 ar6000_reset_device(ar->arHifDevice, ar->arTargetType, TRUE, coldRes et); 2052 ar6000_reset_device(ar->arHifDevice, ar->arTargetType, TRUE, coldRes et);
2034 } 2053 }
2035 } else { 2054 } else {
2036 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Host does not want target reset. \n")) ; 2055 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Host does not want target reset. \n")) ;
2037 } 2056 }
2038 /* Done with cookies */ 2057 /* Done with cookies */
2039 ar6000_cookie_cleanup(ar); 2058 ar6000_cookie_cleanup(ar);
2040 } 2059 }
2041 /* 2060 /*
2042 * We need to differentiate between the surprise and planned removal of the 2061 * We need to differentiate between the surprise and planned removal of the
2043 * device because of the following consideration: 2062 * device because of the following consideration:
2044 * - In case of surprise removal, the hcd already frees up the pending 2063 * - In case of surprise removal, the hcd already frees up the pending
2045 * for the device and hence there is no need to unregister the function 2064 * for the device and hence there is no need to unregister the function
2046 * driver inorder to get these requests. For planned removal, the function 2065 * driver inorder to get these requests. For planned removal, the function
2047 * driver has to explictly unregister itself to have the hcd return all the 2066 * driver has to explictly unregister itself to have the hcd return all the
2048 * pending requests before the data structures for the devices are freed up. 2067 * pending requests before the data structures for the devices are freed up.
2049 * Note that as per the current implementation, the function driver will 2068 * Note that as per the current implementation, the function driver will
2050 * end up releasing all the devices since there is no API to selectively 2069 * end up releasing all the devices since there is no API to selectively
2051 * release a particular device. 2070 * release a particular device.
2052 * - Certain commands issued to the target can be skipped for surprise 2071 * - Certain commands issued to the target can be skipped for surprise
2053 * removal since they will anyway not go through. 2072 * removal since they will anyway not go through.
2054 */ 2073 */
2055 void 2074 void
2056 ar6000_destroy(struct net_device *dev, unsigned int unregister) 2075 ar6000_destroy(struct net_device *dev, unsigned int unregister)
2057 { 2076 {
2058 AR_SOFTC_T *ar; 2077 AR_SOFTC_T *ar;
2059 2078
2060 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("+ar6000_destroy \n")); 2079 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("+ar6000_destroy \n"));
2061 2080
2062 if((dev == NULL) || ((ar = ar6k_priv(dev)) == NULL)) 2081 if((dev == NULL) || ((ar = ar6k_priv(dev)) == NULL))
2063 { 2082 {
2064 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): Failed to get device structure.\n" , __func__)); 2083 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): Failed to get device structure.\n" , __func__));
2065 return; 2084 return;
2066 } 2085 }
2067 2086
2068 ar->bIsDestroyProgress = TRUE; 2087 ar->bIsDestroyProgress = TRUE;
2069 2088
2070 if (down_interruptible(&ar->arSem)) { 2089 if (down_interruptible(&ar->arSem)) {
2071 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): down_interruptible failed \n", __f unc__)); 2090 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): down_interruptible failed \n", __f unc__));
2072 return; 2091 return;
2073 } 2092 }
2074 if (ar->arWmiReady && !bypasswmi) { 2093
2075 ar6000_dbglog_get_debug_logs(ar); 2094 if (ar->arWlanPowerState != WLAN_POWER_STATE_CUT_PWR) {
2095 /* only stop endpoint if we are not stop it in suspend_ev */
2096 ar6000_stop_endpoint(dev, FALSE, TRUE);
2097 } else {
2098 /* clear up the platform power state before rmmod */
2099 plat_setup_power(1,0);
2076 } 2100 }
2077 #ifdef ANDROID_ENV 2101
2078 if (!android_ar6k_endpoint_is_stop(ar)) { 2102 ar->arWlanState = WLAN_DISABLED;
2079 #else
2080 if (1) {
2081 #endif
2082 /* only stop endpoint if we are not stop it in suspend_ev */
2083 ar6000_stop_endpoint(dev, FALSE);
2084 }
2085 if (ar->arHtcTarget != NULL) { 2103 if (ar->arHtcTarget != NULL) {
2086 /* destroy HTC */ 2104 /* destroy HTC */
2087 HTCDestroy(ar->arHtcTarget); 2105 HTCDestroy(ar->arHtcTarget);
2088 } 2106 }
2089 if (ar->arHifDevice != NULL) { 2107 if (ar->arHifDevice != NULL) {
2090 /*release the device so we do not get called back on remove incase we 2108 /*release the device so we do not get called back on remove incase we
2091 * we're explicity destroyed by module unload */ 2109 * we're explicity destroyed by module unload */
2092 HIFReleaseDevice(ar->arHifDevice); 2110 HIFReleaseDevice(ar->arHifDevice);
2093 HIFShutDownDevice(ar->arHifDevice); 2111 HIFShutDownDevice(ar->arHifDevice);
2094 } 2112 }
2095 #ifdef ATH_AR6K_11N_SUPPORT 2113 #ifdef ATH_AR6K_11N_SUPPORT
2096 aggr_module_destroy(ar->aggr_cntxt); 2114 aggr_module_destroy(ar->aggr_cntxt);
2097 #endif 2115 #endif
2098 2116
2099 /* Done with cookies */ 2117 /* Done with cookies */
2100 ar6000_cookie_cleanup(ar); 2118 ar6000_cookie_cleanup(ar);
2101 2119
2102 /* cleanup any allocated AMSDU buffers */ 2120 /* cleanup any allocated AMSDU buffers */
2103 ar6000_cleanup_amsdu_rxbufs(ar); 2121 ar6000_cleanup_amsdu_rxbufs(ar);
2104 2122
2105 if (bmienable) { 2123 if (bmienable) {
2106 ar6000_sysfs_bmi_deinit(ar); 2124 ar6000_sysfs_bmi_deinit(ar);
2107 } 2125 }
2108 2126
2109 /* Cleanup BMI */ 2127 /* Cleanup BMI */
2110 BMIInit(); 2128 BMICleanup();
2111 2129
2112 /* Clear the tx counters */ 2130 /* Clear the tx counters */
2113 memset(tx_attempt, 0, sizeof(tx_attempt)); 2131 memset(tx_attempt, 0, sizeof(tx_attempt));
2114 memset(tx_post, 0, sizeof(tx_post)); 2132 memset(tx_post, 0, sizeof(tx_post));
2115 memset(tx_complete, 0, sizeof(tx_complete)); 2133 memset(tx_complete, 0, sizeof(tx_complete));
2116 2134
2117 #ifdef HTC_RAW_INTERFACE 2135 #ifdef HTC_RAW_INTERFACE
2118 if (ar->arRawHtc) { 2136 if (ar->arRawHtc) {
2119 A_FREE(ar->arRawHtc); 2137 A_FREE(ar->arRawHtc);
2120 ar->arRawHtc = NULL; 2138 ar->arRawHtc = NULL;
2121 } 2139 }
2122 #endif 2140 #endif
2123 /* Free up the device data structure */ 2141 /* Free up the device data structure */
2124 if( unregister ) 2142 if (unregister && is_netdev_registered) {» »
2125 unregister_netdev(dev); 2143 unregister_netdev(dev);
2144 is_netdev_registered = 0;
2145 }
2126 #ifndef free_netdev 2146 #ifndef free_netdev
2127 kfree(dev); 2147 kfree(dev);
2128 #else 2148 #else
2129 free_netdev(dev); 2149 free_netdev(dev);
2130 #endif 2150 #endif
2131 2151
2132 #ifdef ATH6K_CONFIG_CFG80211 2152 #ifdef ATH6K_CONFIG_CFG80211
2133 ar6k_cfg80211_deinit(ar); 2153 ar6k_cfg80211_deinit(ar);
2134 #endif /* ATH6K_CONFIG_CFG80211 */ 2154 #endif /* ATH6K_CONFIG_CFG80211 */
2135 2155
2156 #ifdef CONFIG_AP_VIRTUL_ADAPTER_SUPPORT
2157 ar6000_remove_ap_interface();
2158 #endif /*CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
2159
2136 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n")); 2160 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n"));
2137 } 2161 }
2138 2162
2139 static void disconnect_timer_handler(unsigned long ptr) 2163 static void disconnect_timer_handler(unsigned long ptr)
2140 { 2164 {
2141 struct net_device *dev = (struct net_device *)ptr; 2165 struct net_device *dev = (struct net_device *)ptr;
2142 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 2166 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
2143 2167
2144 A_UNTIMEOUT(&ar->disconnect_timer); 2168 A_UNTIMEOUT(&ar->disconnect_timer);
2145 2169
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 } 2293 }
2270 2294
2271 static int 2295 static int
2272 ar6000_open(struct net_device *dev) 2296 ar6000_open(struct net_device *dev)
2273 { 2297 {
2274 unsigned long flags; 2298 unsigned long flags;
2275 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 2299 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
2276 2300
2277 spin_lock_irqsave(&ar->arLock, flags); 2301 spin_lock_irqsave(&ar->arLock, flags);
2278 2302
2279 #ifndef ANDROID_ENV 2303 #ifdef ATH6K_CONFIG_CFG80211
2280 if(ar->arWlanState == WLAN_DISABLED) { 2304 if(ar->arWlanState == WLAN_DISABLED) {
2281 ar->arWlanState = WLAN_ENABLED; 2305 ar->arWlanState = WLAN_ENABLED;
2282 } 2306 }
2283 #endif 2307 #endif /* ATH6K_CONFIG_CFG80211 */
2284 2308
2285 if( ar->arConnected || bypasswmi) { 2309 if( ar->arConnected || bypasswmi) {
2286 netif_carrier_on(dev); 2310 netif_carrier_on(dev);
2287 /* Wake up the queues */ 2311 /* Wake up the queues */
2288 netif_wake_queue(dev); 2312 netif_wake_queue(dev);
2289 } 2313 }
2290 else 2314 else
2291 netif_carrier_off(dev); 2315 netif_carrier_off(dev);
2292 2316
2293 spin_unlock_irqrestore(&ar->arLock, flags); 2317 spin_unlock_irqrestore(&ar->arLock, flags);
2294 return 0; 2318 return 0;
2295 } 2319 }
2296 2320
2297 static int 2321 static int
2298 ar6000_close(struct net_device *dev) 2322 ar6000_close(struct net_device *dev)
2299 { 2323 {
2324 #ifdef ATH6K_CONFIG_CFG80211
2300 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 2325 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
2326 #endif /* ATH6K_CONFIG_CFG80211 */
2301 netif_stop_queue(dev); 2327 netif_stop_queue(dev);
2302 2328
2303 #ifdef ANDROID_ENV 2329 #ifdef ATH6K_CONFIG_CFG80211
2304 (void)ar; /* do nothing. Android SDK will handle it */
2305 #else
2306 AR6000_SPIN_LOCK(&ar->arLock, 0); 2330 AR6000_SPIN_LOCK(&ar->arLock, 0);
2307 if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) { 2331 if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) {
2308 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 2332 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
2309 wmi_disconnect_cmd(ar->arWmi); 2333 wmi_disconnect_cmd(ar->arWmi);
2310 } else { 2334 } else {
2311 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 2335 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
2312 } 2336 }
2313 2337
2314 if(ar->arWmiReady == TRUE) { 2338 if(ar->arWmiReady == TRUE) {
2315 if (wmi_scanparams_cmd(ar->arWmi, 0xFFFF, 0, 2339 if (wmi_scanparams_cmd(ar->arWmi, 0xFFFF, 0,
2316 0, 0, 0, 0, 0, 0, 0, 0) != A_OK) { 2340 0, 0, 0, 0, 0, 0, 0, 0) != A_OK) {
2317 return -EIO; 2341 return -EIO;
2318 } 2342 }
2319 ar->arWlanState = WLAN_DISABLED; 2343 ar->arWlanState = WLAN_DISABLED;
2320 } 2344 }
2321 #endif 2345 #endif /* ATH6K_CONFIG_CFG80211 */
2346
2322 return 0; 2347 return 0;
2323 } 2348 }
2324 2349
2325 /* connect to a service */ 2350 /* connect to a service */
2326 static A_STATUS ar6000_connectservice(AR_SOFTC_T *ar, 2351 static A_STATUS ar6000_connectservice(AR_SOFTC_T *ar,
2327 HTC_SERVICE_CONNECT_REQ *pConnect, 2352 HTC_SERVICE_CONNECT_REQ *pConnect,
2328 char *pDesc) 2353 char *pDesc)
2329 { 2354 {
2330 A_STATUS status; 2355 A_STATUS status;
2331 HTC_SERVICE_CONNECT_RESP response; 2356 HTC_SERVICE_CONNECT_RESP response;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 A_INT32 timeleft; 2441 A_INT32 timeleft;
2417 A_INT16 i; 2442 A_INT16 i;
2418 int ret = 0; 2443 int ret = 0;
2419 #if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE) 2444 #if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE)
2420 WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd; 2445 WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd;
2421 WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd; 2446 WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd;
2422 #endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */ 2447 #endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */
2423 2448
2424 if((ar = ar6k_priv(dev)) == NULL) 2449 if((ar = ar6k_priv(dev)) == NULL)
2425 { 2450 {
2426 ret = -EIO; 2451 return -EIO;
2427 goto ar6000_init_done;
2428 } 2452 }
2429 2453
2430 if (wlaninitmode == WLAN_INIT_MODE_USR) 2454 if (wlaninitmode == WLAN_INIT_MODE_USR || wlaninitmode == WLAN_INIT_MODE_DRV ) {
2455
2431 ar6000_update_bdaddr(ar); 2456 ar6000_update_bdaddr(ar);
2432 2457
2458 if (enablerssicompensation) {
2459 ar6000_copy_cust_data_from_target(ar->arHifDevice, ar->arTargetType) ;
2460 read_rssi_compensation_param(ar);
2461 for (i=-95; i<=0; i++) {
2462 rssi_compensation_table[0-i] = rssi_compensation_calc(ar,i);
2463 }
2464 }
2465 }
2466
2433 dev_hold(dev); 2467 dev_hold(dev);
2434 rtnl_unlock(); 2468 rtnl_unlock();
2435 2469
2436 if (enablerssicompensation) {
2437 ar6000_copy_cust_data_from_target(ar->arHifDevice, ar->arTargetType);
2438 read_rssi_compensation_param(ar);
2439 for (i=-95; i<=0; i++) {
2440 rssi_compensation_table[0-i] = rssi_compensation_calc(ar,i);
2441 }
2442 }
2443
2444 /* Do we need to finish the BMI phase */ 2470 /* Do we need to finish the BMI phase */
2445 if ((wlaninitmode == WLAN_INIT_MODE_USR) && (BMIDone(ar->arHifDevice) != A_O K)) 2471 if ((wlaninitmode == WLAN_INIT_MODE_USR || wlaninitmode == WLAN_INIT_MODE_DR V) &&
2472 (BMIDone(ar->arHifDevice) != A_OK))
2446 { 2473 {
2447 ret = -EIO; 2474 ret = -EIO;
2448 goto ar6000_init_done; 2475 goto ar6000_init_done;
2449 } 2476 }
2450 2477
2451 if (!bypasswmi) 2478 if (!bypasswmi)
2452 { 2479 {
2453 #if 0 /* TBDXXX */ 2480 #if 0 /* TBDXXX */
2454 if (ar->arVersion.host_ver != ar->arVersion.target_ver) { 2481 if (ar->arVersion.host_ver != ar->arVersion.target_ver) {
2455 A_PRINTF("WARNING: Host version 0x%x does not match Target " 2482 A_PRINTF("WARNING: Host version 0x%x does not match Target "
2456 " version 0x%x!\n", 2483 " version 0x%x!\n",
2457 ar->arVersion.host_ver, ar->arVersion.target_ver); 2484 ar->arVersion.host_ver, ar->arVersion.target_ver);
2458 } 2485 }
2459 #endif 2486 #endif
2460 2487
2461 /* Indicate that WMI is enabled (although not ready yet) */ 2488 /* Indicate that WMI is enabled (although not ready yet) */
2462 ar->arWmiEnabled = TRUE; 2489 ar->arWmiEnabled = TRUE;
2463 if ((ar->arWmi = wmi_init((void *) ar)) == NULL) 2490 if ((ar->arWmi = wmi_init((void *) ar)) == NULL)
2464 { 2491 {
2465 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize WMI.\n", _ _func__)); 2492 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize WMI.\n", _ _func__));
2466 ret = -EIO; 2493 ret = -EIO;
2467 goto ar6000_init_done; 2494 goto ar6000_init_done;
2468 } 2495 }
2469 2496
2470 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Got WMI @ 0x%08x.\n", __func__, 2497 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Got WMI @ 0x%lx.\n", __func__,
2471 (unsigned int) ar->arWmi)); 2498 (unsigned long) ar->arWmi));
2472 } 2499 }
2473 2500
2474 do { 2501 do {
2475 HTC_SERVICE_CONNECT_REQ connect; 2502 HTC_SERVICE_CONNECT_REQ connect;
2476 2503
2477 /* the reason we have to wait for the target here is that the driver layer 2504 /* the reason we have to wait for the target here is that the driver layer
2478 * has to init BMI in order to set the host block size, 2505 * has to init BMI in order to set the host block size,
2479 */ 2506 */
2480 status = HTCWaitTarget(ar->arHtcTarget); 2507 status = HTCWaitTarget(ar->arHtcTarget);
2481 2508
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 hciHandles.hifDevice = ar->arHifDevice; 2623 hciHandles.hifDevice = ar->arHifDevice;
2597 hciHandles.htcHandle = ar->arHtcTarget; 2624 hciHandles.htcHandle = ar->arHtcTarget;
2598 status = (A_STATUS)(ar6kHciTransCallbacks.setupTransport(&hciHandles )); 2625 status = (A_STATUS)(ar6kHciTransCallbacks.setupTransport(&hciHandles ));
2599 } 2626 }
2600 #else 2627 #else
2601 if (setuphci) { 2628 if (setuphci) {
2602 /* setup HCI */ 2629 /* setup HCI */
2603 status = ar6000_setup_hci(ar); 2630 status = ar6000_setup_hci(ar);
2604 } 2631 }
2605 #endif 2632 #endif
2633 #ifdef EXPORT_HCI_PAL_INTERFACE
2634 if (setuphcipal && (NULL != ar6kHciPalCallbacks_g.setupTransport))
2635 status = ar6kHciPalCallbacks_g.setupTransport(ar);
2636 #else
2637 if(setuphcipal)
2638 status = ar6k_setup_hci_pal(ar);
2639 #endif
2606 2640
2607 } while (FALSE); 2641 } while (FALSE);
2608 2642
2609 if (A_FAILED(status)) { 2643 if (A_FAILED(status)) {
2610 ret = -EIO; 2644 ret = -EIO;
2611 goto ar6000_init_done; 2645 goto ar6000_init_done;
2612 } 2646 }
2613 2647
2614 /* 2648 /*
2615 * give our connected endpoints some buffers 2649 * give our connected endpoints some buffers
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 /* for tests like endpoint ping, the MAC address needs to be non-zer o otherwise 2760 /* for tests like endpoint ping, the MAC address needs to be non-zer o otherwise
2727 * the data path through a raw socket is disabled */ 2761 * the data path through a raw socket is disabled */
2728 dev->dev_addr[0] = 0x00; 2762 dev->dev_addr[0] = 0x00;
2729 dev->dev_addr[1] = 0x01; 2763 dev->dev_addr[1] = 0x01;
2730 dev->dev_addr[2] = 0x02; 2764 dev->dev_addr[2] = 0x02;
2731 dev->dev_addr[3] = 0xAA; 2765 dev->dev_addr[3] = 0xAA;
2732 dev->dev_addr[4] = 0xBB; 2766 dev->dev_addr[4] = 0xBB;
2733 dev->dev_addr[5] = 0xCC; 2767 dev->dev_addr[5] = 0xCC;
2734 } 2768 }
2735 2769
2736 #ifdef ANDROID_ENV
2737 android_ar6k_start(ar);
2738 #endif
2739
2740 ar6000_init_done: 2770 ar6000_init_done:
2741 rtnl_lock(); 2771 rtnl_lock();
2742 dev_put(dev); 2772 dev_put(dev);
2743 2773
2744 return ret; 2774 return ret;
2745 } 2775 }
2746 2776
2747 2777
2748 void 2778 void
2749 ar6000_bitrate_rx(void *devt, A_INT32 rateKbps) 2779 ar6000_bitrate_rx(void *devt, A_INT32 rateKbps)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 ar->arNodeMap[eptMap].txPending ++; 2869 ar->arNodeMap[eptMap].txPending ++;
2840 2870
2841 return ar->arNodeMap[eptMap].epId; 2871 return ar->arNodeMap[eptMap].epId;
2842 } 2872 }
2843 2873
2844 #ifdef DEBUG 2874 #ifdef DEBUG
2845 static void ar6000_dump_skb(struct sk_buff *skb) 2875 static void ar6000_dump_skb(struct sk_buff *skb)
2846 { 2876 {
2847 u_char *ch; 2877 u_char *ch;
2848 for (ch = A_NETBUF_DATA(skb); 2878 for (ch = A_NETBUF_DATA(skb);
2849 (A_UINT32)ch < ((A_UINT32)A_NETBUF_DATA(skb) + 2879 (unsigned long)ch < ((unsigned long)A_NETBUF_DATA(skb) +
2850 A_NETBUF_LEN(skb)); ch++) 2880 A_NETBUF_LEN(skb)); ch++)
2851 { 2881 {
2852 AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("%2.2x ", *ch)); 2882 AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("%2.2x ", *ch));
2853 } 2883 }
2854 AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("\n")); 2884 AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("\n"));
2855 } 2885 }
2856 #endif 2886 #endif
2857 2887
2858 #ifdef HTC_TEST_SEND_PKTS 2888 #ifdef HTC_TEST_SEND_PKTS
2859 static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, st ruct sk_buff *skb); 2889 static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, st ruct sk_buff *skb);
2860 #endif 2890 #endif
2861 2891
2862 static int 2892 static int
2863 ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) 2893 ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)
2864 { 2894 {
2865 #define AC_NOT_MAPPED 99 2895 #define AC_NOT_MAPPED 99
2866 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 2896 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
2867 A_UINT8 ac = AC_NOT_MAPPED; 2897 A_UINT8 ac = AC_NOT_MAPPED;
2868 HTC_ENDPOINT_ID eid = ENDPOINT_UNUSED; 2898 HTC_ENDPOINT_ID eid = ENDPOINT_UNUSED;
2869 A_UINT32 mapNo = 0; 2899 A_UINT32 mapNo = 0;
2870 int len; 2900 int len;
2871 struct ar_cookie *cookie; 2901 struct ar_cookie *cookie;
2872 A_BOOL checkAdHocPsMapping = FALSE,bMoreData = FALSE; 2902 A_BOOL checkAdHocPsMapping = FALSE,bMoreData = FALSE;
2873 HTC_TX_TAG htc_tag = AR6K_DATA_PKT_TAG; 2903 HTC_TX_TAG htc_tag = AR6K_DATA_PKT_TAG;
2874 A_UINT8 dot11Hdr = processDot11Hdr; 2904 A_UINT8 dot11Hdr = processDot11Hdr;
2875 #ifdef CONFIG_PM 2905 #ifdef CONFIG_PM
2876 if (ar->arWowState) { 2906 if (ar->arWowState != WLAN_WOW_STATE_NONE) {
2877 A_NETBUF_FREE(skb); 2907 A_NETBUF_FREE(skb);
2878 return 0; 2908 return 0;
2879 } 2909 }
2880 #endif /* CONFIG_PM */ 2910 #endif /* CONFIG_PM */
2881 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)
2882 skb->list = NULL;
2883 #endif
2884 2911
2885 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar6000_data_tx start - skb=0x%x, data=0x %x, len=0x%x\n", 2912 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar6000_data_tx start - skb=0x%lx, data=0 x%lx, len=0x%x\n",
2886 (A_UINT32)skb, (A_UINT32)A_NETBUF_DATA(skb), 2913 (unsigned long)skb, (unsigned long)A_NETBUF_DATA(skb),
2887 A_NETBUF_LEN(skb))); 2914 A_NETBUF_LEN(skb)));
2888 2915
2889 /* If target is not associated */ 2916 /* If target is not associated */
2890 if( (!ar->arConnected && !bypasswmi) 2917 if( (!ar->arConnected && !bypasswmi)
2891 #ifdef CONFIG_HOST_TCMD_SUPPORT 2918 #ifdef CONFIG_HOST_TCMD_SUPPORT
2892 /* TCMD doesnt support any data, free the buf and return */ 2919 /* TCMD doesnt support any data, free the buf and return */
2893 || (ar->arTargetMode == AR6000_TCMD_MODE) 2920 || (ar->arTargetMode == AR6000_TCMD_MODE)
2894 #endif 2921 #endif
2895 ) { 2922 ) {
2896 A_NETBUF_FREE(skb); 2923 A_NETBUF_FREE(skb);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 /* update counts while the lock is held */ 3174 /* update counts while the lock is held */
3148 ar->arTxPending[eid]++; 3175 ar->arTxPending[eid]++;
3149 ar->arTotalTxDataPending++; 3176 ar->arTotalTxDataPending++;
3150 } 3177 }
3151 3178
3152 } while (FALSE); 3179 } while (FALSE);
3153 3180
3154 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 3181 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
3155 3182
3156 if (cookie != NULL) { 3183 if (cookie != NULL) {
3157 cookie->arc_bp[0] = (A_UINT32)skb; 3184 cookie->arc_bp[0] = (unsigned long)skb;
3158 cookie->arc_bp[1] = mapNo; 3185 cookie->arc_bp[1] = mapNo;
3159 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, 3186 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt,
3160 cookie, 3187 cookie,
3161 A_NETBUF_DATA(skb), 3188 A_NETBUF_DATA(skb),
3162 A_NETBUF_LEN(skb), 3189 A_NETBUF_LEN(skb),
3163 eid, 3190 eid,
3164 htc_tag); 3191 htc_tag);
3165 3192
3166 #ifdef DEBUG 3193 #ifdef DEBUG
3167 if (debugdriver >= 3) { 3194 if (debugdriver >= 3) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 if (cookie != NULL) { 3229 if (cookie != NULL) {
3203 /* update counts while the lock is held */ 3230 /* update counts while the lock is held */
3204 ar->arTxPending[eid]++; 3231 ar->arTxPending[eid]++;
3205 ar->arTotalTxDataPending++; 3232 ar->arTotalTxDataPending++;
3206 } 3233 }
3207 3234
3208 3235
3209 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 3236 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
3210 3237
3211 if (cookie != NULL) { 3238 if (cookie != NULL) {
3212 cookie->arc_bp[0] = (A_UINT32)skb; 3239 cookie->arc_bp[0] = (unsigned long)skb;
3213 cookie->arc_bp[1] = 0; 3240 cookie->arc_bp[1] = 0;
3214 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, 3241 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt,
3215 cookie, 3242 cookie,
3216 A_NETBUF_DATA(skb), 3243 A_NETBUF_DATA(skb),
3217 A_NETBUF_LEN(skb), 3244 A_NETBUF_LEN(skb),
3218 eid, 3245 eid,
3219 AR6K_DATA_PKT_TAG); 3246 AR6K_DATA_PKT_TAG);
3220 3247
3221 /* HTC interface is asynchronous, if this fails, cleanup will happen in 3248 /* HTC interface is asynchronous, if this fails, cleanup will happen in
3222 * the ar6000_tx_complete callback */ 3249 * the ar6000_tx_complete callback */
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3401 A_ASSERT(pktSkb); 3428 A_ASSERT(pktSkb);
3402 A_ASSERT(pPacket->pBuffer == A_NETBUF_DATA(pktSkb)); 3429 A_ASSERT(pPacket->pBuffer == A_NETBUF_DATA(pktSkb));
3403 3430
3404 /* add this to the list, use faster non-lock API */ 3431 /* add this to the list, use faster non-lock API */
3405 __skb_queue_tail(&skb_queue,pktSkb); 3432 __skb_queue_tail(&skb_queue,pktSkb);
3406 3433
3407 if (A_SUCCESS(status)) { 3434 if (A_SUCCESS(status)) {
3408 A_ASSERT(pPacket->ActualLength == A_NETBUF_LEN(pktSkb)); 3435 A_ASSERT(pPacket->ActualLength == A_NETBUF_LEN(pktSkb));
3409 } 3436 }
3410 3437
3411 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar6000_tx_complete skb=0x%x data=0x% x len=0x%x eid=%d ", 3438 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar6000_tx_complete skb=0x%lx data=0x %lx len=0x%x eid=%d ",
3412 (A_UINT32)pktSkb, (A_UINT32)pPacket->pBuffer, 3439 (unsigned long)pktSkb, (unsigned long)pPacket->pBuffer,
3413 pPacket->ActualLength, 3440 pPacket->ActualLength,
3414 eid)); 3441 eid));
3415 3442
3416 ar->arTxPending[eid]--; 3443 ar->arTxPending[eid]--;
3417 3444
3418 if ((eid != ar->arControlEp) || bypasswmi) { 3445 if ((eid != ar->arControlEp) || bypasswmi) {
3419 ar->arTotalTxDataPending--; 3446 ar->arTotalTxDataPending--;
3420 } 3447 }
3421 3448
3422 if (eid == ar->arControlEp) 3449 if (eid == ar->arControlEp)
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; 3580 AR_SOFTC_T *ar = (AR_SOFTC_T *)Context;
3554 struct sk_buff *skb = (struct sk_buff *)pPacket->pPktContext; 3581 struct sk_buff *skb = (struct sk_buff *)pPacket->pPktContext;
3555 int minHdrLen; 3582 int minHdrLen;
3556 A_UINT8 containsDot11Hdr = 0; 3583 A_UINT8 containsDot11Hdr = 0;
3557 A_STATUS status = pPacket->Status; 3584 A_STATUS status = pPacket->Status;
3558 HTC_ENDPOINT_ID ept = pPacket->Endpoint; 3585 HTC_ENDPOINT_ID ept = pPacket->Endpoint;
3559 3586
3560 A_ASSERT((status != A_OK) || 3587 A_ASSERT((status != A_OK) ||
3561 (pPacket->pBuffer == (A_NETBUF_DATA(skb) + HTC_HEADER_LEN))); 3588 (pPacket->pBuffer == (A_NETBUF_DATA(skb) + HTC_HEADER_LEN)));
3562 3589
3563 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_rx ar=0x%x eid=%d, skb=0x%x, data =0x%x, len=0x%x status:%d", 3590 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_rx ar=0x%lx eid=%d, skb=0x%lx, da ta=0x%lx, len=0x%x status:%d",
3564 (A_UINT32)ar, ept, (A_UINT32)skb, (A_UINT32)pPacket->pBuffer , 3591 (unsigned long)ar, ept, (unsigned long)skb, (unsigned long)p Packet->pBuffer,
3565 pPacket->ActualLength, status)); 3592 pPacket->ActualLength, status));
3566 if (status != A_OK) { 3593 if (status != A_OK) {
3567 if (status != A_ECANCELED) { 3594 if (status != A_ECANCELED) {
3568 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("RX ERR (%d) \n",status)); 3595 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("RX ERR (%d) \n",status));
3569 } 3596 }
3570 } 3597 }
3571 3598
3572 /* take lock to protect buffer counts 3599 /* take lock to protect buffer counts
3573 * and adaptive power throughput state */ 3600 * and adaptive power throughput state */
3574 AR6000_SPIN_LOCK(&ar->arLock, 0); 3601 AR6000_SPIN_LOCK(&ar->arLock, 0);
(...skipping 20 matching lines...) Expand all
3595 3622
3596 skb->dev = ar->arNetDev; 3623 skb->dev = ar->arNetDev;
3597 if (status != A_OK) { 3624 if (status != A_OK) {
3598 AR6000_STAT_INC(ar, rx_errors); 3625 AR6000_STAT_INC(ar, rx_errors);
3599 A_NETBUF_FREE(skb); 3626 A_NETBUF_FREE(skb);
3600 } else if (ar->arWmiEnabled == TRUE) { 3627 } else if (ar->arWmiEnabled == TRUE) {
3601 if (ept == ar->arControlEp) { 3628 if (ept == ar->arControlEp) {
3602 /* 3629 /*
3603 * this is a wmi control msg 3630 * this is a wmi control msg
3604 */ 3631 */
3605 #ifdef ANDROID_ENV 3632 #ifdef CONFIG_PM
3606 android_ar6k_check_wow_status(ar, skb, TRUE); 3633 ar6000_check_wow_status(ar, skb, TRUE);
3607 #endif /* ANDROID_ENV */ 3634 #endif /* CONFIG_PM */
3608 wmi_control_rx(ar->arWmi, skb); 3635 wmi_control_rx(ar->arWmi, skb);
3609 } else { 3636 } else {
3610 WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(skb); 3637 WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(skb);
3611 A_UINT8 is_amsdu, tid, is_acl_data_frame; 3638 A_UINT8 is_amsdu, tid, is_acl_data_frame;
3612 is_acl_data_frame = WMI_DATA_HDR_GET_DATA_TYPE(dhdr) == WMI_DATA _HDR_DATA_TYPE_ACL; 3639 is_acl_data_frame = WMI_DATA_HDR_GET_DATA_TYPE(dhdr) == WMI_DATA _HDR_DATA_TYPE_ACL;
3613 #ifdef ANDROID_ENV 3640 #ifdef CONFIG_PM
3614 android_ar6k_check_wow_status(ar, NULL, FALSE); 3641 ar6000_check_wow_status(ar, NULL, FALSE);
3615 #endif /* ANDROID_ENV */ 3642 #endif /* CONFIG_PM */
3616 /* 3643 /*
3617 * this is a wmi data packet 3644 * this is a wmi data packet
3618 */ 3645 */
3619 // NWF 3646 // NWF
3620 3647
3621 if (processDot11Hdr) { 3648 if (processDot11Hdr) {
3622 minHdrLen = sizeof(WMI_DATA_HDR) + sizeof(struct ieee80211_f rame) + sizeof(ATH_LLC_SNAP_HDR); 3649 minHdrLen = sizeof(WMI_DATA_HDR) + sizeof(struct ieee80211_f rame) + sizeof(ATH_LLC_SNAP_HDR);
3623 } else { 3650 } else {
3624 minHdrLen = sizeof (WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + 3651 minHdrLen = sizeof (WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) +
3625 sizeof(ATH_LLC_SNAP_HDR); 3652 sizeof(ATH_LLC_SNAP_HDR);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3772 3799
3773 if (status != A_OK) { 3800 if (status != A_OK) {
3774 /* Drop frames that could not be processed (lack of memo ry, etc.) */ 3801 /* Drop frames that could not be processed (lack of memo ry, etc.) */
3775 A_NETBUF_FREE(skb); 3802 A_NETBUF_FREE(skb);
3776 goto rx_done; 3803 goto rx_done;
3777 } 3804 }
3778 3805
3779 if (is_acl_data_frame) { 3806 if (is_acl_data_frame) {
3780 A_NETBUF_PUSH(skb, sizeof(int)); 3807 A_NETBUF_PUSH(skb, sizeof(int));
3781 *((short *)A_NETBUF_DATA(skb)) = WMI_ACL_DATA_EVENTID; 3808 *((short *)A_NETBUF_DATA(skb)) = WMI_ACL_DATA_EVENTID;
3809 /* send the data packet to PAL driver */
3810 if(ar6k_pal_config_g.fpar6k_pal_recv_pkt) {
3811 if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar-> hcipal_info, skb) == TRUE)
3812 goto rx_done;
3813 }
3782 } 3814 }
3783 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 3815
3784 /*
3785 * extra push and memcpy, for eth_type_trans() of 2.4 kernel
3786 * will pull out hard_header_len bytes of the skb.
3787 */
3788 A_NETBUF_PUSH(skb, sizeof(WMI_DATA_HDR) + sizeof(ATH_LLC_SNA P_HDR) + HTC_HEADER_LEN);
3789 A_MEMCPY(A_NETBUF_DATA(skb), A_NETBUF_DATA(skb) + sizeof(WMI _DATA_HDR) +
3790 sizeof(ATH_LLC_SNAP_HDR) + HTC_HEADER_LEN, sizeof(A TH_MAC_HDR));
3791 #endif
3792 if ((ar->arNetDev->flags & IFF_UP) == IFF_UP) { 3816 if ((ar->arNetDev->flags & IFF_UP) == IFF_UP) {
3793 if (ar->arNetworkType == AP_NETWORK) { 3817 if (ar->arNetworkType == AP_NETWORK) {
3794 struct sk_buff *skb1 = NULL; 3818 struct sk_buff *skb1 = NULL;
3795 ATH_MAC_HDR *datap; 3819 ATH_MAC_HDR *datap;
3796 3820
3797 datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb); 3821 datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb);
3798 if (IEEE80211_IS_MULTICAST(datap->dstMac)) { 3822 if (IEEE80211_IS_MULTICAST(datap->dstMac)) {
3799 /* Bcast/Mcast frames should be sent to the OS 3823 /* Bcast/Mcast frames should be sent to the OS
3800 * stack as well as on the air. 3824 * stack as well as on the air.
3801 */ 3825 */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3841 } 3865 }
3842 3866
3843 static void 3867 static void
3844 ar6000_deliver_frames_to_nw_stack(void *dev, void *osbuf) 3868 ar6000_deliver_frames_to_nw_stack(void *dev, void *osbuf)
3845 { 3869 {
3846 struct sk_buff *skb = (struct sk_buff *)osbuf; 3870 struct sk_buff *skb = (struct sk_buff *)osbuf;
3847 3871
3848 if(skb) { 3872 if(skb) {
3849 skb->dev = dev; 3873 skb->dev = dev;
3850 if ((skb->dev->flags & IFF_UP) == IFF_UP) { 3874 if ((skb->dev->flags & IFF_UP) == IFF_UP) {
3851 #ifdef ANDROID_ENV 3875 #ifdef CONFIG_PM
3852 android_ar6k_check_wow_status((AR_SOFTC_T *)ar6k_priv(dev), skb, FAL SE); 3876 ar6000_check_wow_status((AR_SOFTC_T *)ar6k_priv(dev), skb, FALSE);
3853 #endif 3877 #endif /* CONFIG_PM */
3854 skb->protocol = eth_type_trans(skb, skb->dev); 3878 skb->protocol = eth_type_trans(skb, skb->dev);
3855 /* 3879 /*
3856 * If this routine is called on a ISR (Hard IRQ) or DSR (Soft IRQ) 3880 * If this routine is called on a ISR (Hard IRQ) or DSR (Soft IRQ)
3857 * or tasklet use the netif_rx to deliver the packet to the stack 3881 * or tasklet use the netif_rx to deliver the packet to the stack
3858 * netif_rx will queue the packet onto the receive queue and mark 3882 * netif_rx will queue the packet onto the receive queue and mark
3859 * the softirq thread has a pending action to complete. Kernel will 3883 * the softirq thread has a pending action to complete. Kernel will
3860 * schedule the softIrq kernel thread after processing the DSR. 3884 * schedule the softIrq kernel thread after processing the DSR.
3861 * 3885 *
3862 * If this routine is called on a process context, use netif_rx_ni 3886 * If this routine is called on a process context, use netif_rx_ni
3863 * which will schedle the softIrq kernel thread after queuing the packet . 3887 * which will schedle the softIrq kernel thread after queuing the packet .
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 if (refillCount >= AR6000_AMSDU_REFILL_THRESHOLD) { 4060 if (refillCount >= AR6000_AMSDU_REFILL_THRESHOLD) {
4037 ar6000_refill_amsdu_rxbufs(ar,refillCount); 4061 ar6000_refill_amsdu_rxbufs(ar,refillCount);
4038 } 4062 }
4039 4063
4040 return pPacket; 4064 return pPacket;
4041 } 4065 }
4042 4066
4043 static void 4067 static void
4044 ar6000_set_multicast_list(struct net_device *dev) 4068 ar6000_set_multicast_list(struct net_device *dev)
4045 { 4069 {
4046 int i; 4070 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000: Multicast filter not supported\n"));
4047 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
4048 if (ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED)
4049 return;
4050
4051 for (i=0; i<MAC_MAX_FILTERS_PER_LIST; ++i) {
4052 A_UINT8 *filter = ar->mcast_filters[i];
4053 if (filter[0] || filter[1] || filter[2] || filter[3] ) {
4054 wmi_del_mcast_filter_cmd(ar->arWmi, filter[0], filter[1], filter[2], filter[3]);
4055 }
4056 }
4057 A_MEMZERO(ar->mcast_filters, sizeof(ar->mcast_filters));
4058
4059 if ((dev->flags & IFF_PROMISC) ||
4060 (dev->flags & IFF_ALLMULTI) || dev->mc_count > MAC_MAX_FILTERS_PER_L IST) {
4061 wmi_mcast_filter_cmd(ar->arWmi, TRUE);
4062 return;
4063 }
4064
4065 if (dev->flags & IFF_MULTICAST && dev->mc_count > 0) {
4066 struct dev_mc_list *mc;
4067 for (mc = dev->mc_list, i=0; mc; mc = mc->next, ++i) {
4068 u8 *mac = mc->dmi_addr;
4069 if (mac[2] || mac[3] || mac[4] || mac[5]) {
4070 A_MEMCPY(ar->mcast_filters[i], &mac[2], sizeof(ar->mcast_filters [i]));
4071 wmi_set_mcast_filter_cmd(ar->arWmi, mac[2], mac[3], mac[4] , mac [5]);
4072 }
4073 }
4074 wmi_mcast_filter_cmd(ar->arWmi, TRUE);
4075 } else {
4076 /* target drop multicast packets if fitler disable and fitler list is ze ro */
4077 wmi_mcast_filter_cmd(ar->arWmi, FALSE);
4078 }
4079 } 4071 }
4080 4072
4081 static struct net_device_stats * 4073 static struct net_device_stats *
4082 ar6000_get_stats(struct net_device *dev) 4074 ar6000_get_stats(struct net_device *dev)
4083 { 4075 {
4084 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 4076 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
4085 return &ar->arNetStats; 4077 return &ar->arNetStats;
4086 } 4078 }
4087 4079
4088 static struct iw_statistics * 4080 static struct iw_statistics *
4089 ar6000_get_iwstats(struct net_device * dev) 4081 ar6000_get_iwstats(struct net_device * dev)
4090 { 4082 {
4091 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); 4083 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
4092 TARGET_STATS *pStats = &ar->arTargetStats; 4084 TARGET_STATS *pStats = &ar->arTargetStats;
4093 struct iw_statistics * pIwStats = &ar->arIwStats; 4085 struct iw_statistics * pIwStats = &ar->arIwStats;
4094 int rtnllocked; 4086 int rtnllocked;
4095 4087
4096 if (ar->bIsDestroyProgress || ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED) 4088 if (ar->bIsDestroyProgress || ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED)
4097 { 4089 {
4098 pIwStats->status = 0; 4090 pIwStats->status = 0;
4099 pIwStats->qual.qual = 0; 4091 pIwStats->qual.qual = 0;
4100 pIwStats->qual.level =0; 4092 pIwStats->qual.level =0;
4101 pIwStats->qual.noise = 0; 4093 pIwStats->qual.noise = 0;
4102 pIwStats->discard.code =0; 4094 pIwStats->discard.code =0;
4103 pIwStats->discard.retries=0; 4095 pIwStats->discard.retries=0;
4104 pIwStats->miss.beacon =0; 4096 pIwStats->miss.beacon =0;
4105 return pIwStats; 4097 return pIwStats;
4106 } 4098 }
4107 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 4099
4108 /* 4100 /*
4109 * The in_atomic function is used to determine if the scheduling is 4101 * The in_atomic function is used to determine if the scheduling is
4110 * allowed in the current context or not. This was introduced in 2.6 4102 * allowed in the current context or not. This was introduced in 2.6
4111 * From what I have read on the differences between 2.4 and 2.6, the 4103 * From what I have read on the differences between 2.4 and 2.6, the
4112 * 2.4 kernel did not support preemption and so this check might not 4104 * 2.4 kernel did not support preemption and so this check might not
4113 * be required for 2.4 kernels. 4105 * be required for 2.4 kernels.
4114 */ 4106 */
4115 if (in_atomic()) 4107 if (in_atomic())
4116 { 4108 {
4117 wmi_get_stats_cmd(ar->arWmi); 4109 wmi_get_stats_cmd(ar->arWmi);
4118 4110
4119 pIwStats->status = 1 ; 4111 pIwStats->status = 1 ;
4120 pIwStats->qual.qual = pStats->cs_aveBeacon_rssi - 161; 4112 pIwStats->qual.qual = pStats->cs_aveBeacon_rssi - 161;
4121 pIwStats->qual.level =pStats->cs_aveBeacon_rssi; /* noise is -95 dBm */ 4113 pIwStats->qual.level =pStats->cs_aveBeacon_rssi; /* noise is -95 dBm */
4122 pIwStats->qual.noise = pStats->noise_floor_calibation; 4114 pIwStats->qual.noise = pStats->noise_floor_calibation;
4123 pIwStats->discard.code = pStats->rx_decrypt_err; 4115 pIwStats->discard.code = pStats->rx_decrypt_err;
4124 pIwStats->discard.retries = pStats->tx_retry_cnt; 4116 pIwStats->discard.retries = pStats->tx_retry_cnt;
4125 pIwStats->miss.beacon = pStats->cs_bmiss_cnt; 4117 pIwStats->miss.beacon = pStats->cs_bmiss_cnt;
4126 return pIwStats; 4118 return pIwStats;
4127 } 4119 }
4128 #endif /* LINUX_VERSION_CODE */ 4120
4129 dev_hold(dev); 4121 dev_hold(dev);
4130 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
4131 rtnllocked = rtnl_is_locked(); 4122 rtnllocked = rtnl_is_locked();
4132 #else
4133 rtnllocked = TRUE;
4134 #endif
4135 if (rtnllocked) { 4123 if (rtnllocked) {
4136 rtnl_unlock(); 4124 rtnl_unlock();
4137 } 4125 }
4138 pIwStats->status = 0; 4126 pIwStats->status = 0;
4139 4127
4140 if (down_interruptible(&ar->arSem)) { 4128 if (down_interruptible(&ar->arSem)) {
4141 goto err_exit; 4129 goto err_exit;
4142 } 4130 }
4143 4131
4144 do { 4132 do {
(...skipping 30 matching lines...) Expand all
4175 dev_put(dev); 4163 dev_put(dev);
4176 return pIwStats; 4164 return pIwStats;
4177 } 4165 }
4178 4166
4179 void 4167 void
4180 ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver, A_UINT32 abi_ver) 4168 ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver, A_UINT32 abi_ver)
4181 { 4169 {
4182 AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; 4170 AR_SOFTC_T *ar = (AR_SOFTC_T *)devt;
4183 struct net_device *dev = ar->arNetDev; 4171 struct net_device *dev = ar->arNetDev;
4184 4172
4185 ar->arWmiReady = TRUE;
4186 wake_up(&arEvent);
4187 A_MEMCPY(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN); 4173 A_MEMCPY(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN);
4188 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("mac address = %2.2x:%2.2x:%2.2x:%2.2x:%2.2x :%2.2x\n", 4174 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("mac address = %2.2x:%2.2x:%2.2x:%2.2x:%2.2x :%2.2x\n",
4189 dev->dev_addr[0], dev->dev_addr[1], 4175 dev->dev_addr[0], dev->dev_addr[1],
4190 dev->dev_addr[2], dev->dev_addr[3], 4176 dev->dev_addr[2], dev->dev_addr[3],
4191 dev->dev_addr[4], dev->dev_addr[5])); 4177 dev->dev_addr[4], dev->dev_addr[5]));
4192 4178
4193 ar->arPhyCapability = phyCap; 4179 ar->arPhyCapability = phyCap;
4194 ar->arVersion.wlan_ver = sw_ver; 4180 ar->arVersion.wlan_ver = sw_ver;
4195 ar->arVersion.abi_ver = abi_ver; 4181 ar->arVersion.abi_ver = abi_ver;
4196 4182
4183 /* Indicate to the waiting thread that the ready event was received */
4184 ar->arWmiReady = TRUE;
4185 wake_up(&arEvent);
4186
4197 #if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN 4187 #if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
4198 wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURI NG_SCAN); 4188 wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURI NG_SCAN);
4199 #endif 4189 #endif
4200 #if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP 4190 #if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP
4201 wmi_set_lpreamble_cmd(ar->arWmi, 0, WMI_DONOT_IGNORE_BARKER_IN_ERP); 4191 wmi_set_lpreamble_cmd(ar->arWmi, 0, WMI_DONOT_IGNORE_BARKER_IN_ERP);
4202 #endif 4192 #endif
4203 wmi_set_keepalive_cmd(ar->arWmi, WLAN_CONFIG_KEEP_ALIVE_INTERVAL); 4193 wmi_set_keepalive_cmd(ar->arWmi, WLAN_CONFIG_KEEP_ALIVE_INTERVAL);
4194 #if WLAN_CONFIG_DISABLE_11N
4195 {
4196 WMI_SET_HT_CAP_CMD htCap;
4197
4198 A_MEMZERO(&htCap, sizeof(WMI_SET_HT_CAP_CMD));
4199 htCap.band = 0;
4200 wmi_set_ht_cap_cmd(ar->arWmi, &htCap);
4201
4202 htCap.band = 1;
4203 wmi_set_ht_cap_cmd(ar->arWmi, &htCap);
4204 }
4205 #endif /* WLAN_CONFIG_DISABLE_11N */
4206
4207 #ifdef ATH6K_CONFIG_OTA_MODE
4208 wmi_powermode_cmd(ar->arWmi, MAX_PERF_POWER);
4209 #endif
4210 wmi_disctimeout_cmd(ar->arWmi, WLAN_CONFIG_DISCONNECT_TIMEOUT);
4204 } 4211 }
4205 4212
4206 A_UINT8 4213 void
4207 add_new_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 aid, A_UINT8 *wpaie, 4214 add_new_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 aid, A_UINT8 *wpaie,
4208 A_UINT8 ielen, A_UINT8 keymgmt, A_UINT8 ucipher, A_UINT8 auth) 4215 A_UINT8 ielen, A_UINT8 keymgmt, A_UINT8 ucipher, A_UINT8 auth)
4209 { 4216 {
4210 A_INT8 free_slot=-1, i; 4217 A_UINT8 free_slot=aid-1;
4211 4218
4212 for(i=0; i < AP_MAX_NUM_STA; i++) {
4213 if(A_MEMCMP(ar->sta_list[i].mac, mac, ATH_MAC_LEN)==0) {
4214 /* it is already available */
4215 return 0;
4216 }
4217
4218 if(!((1 << i) & ar->sta_list_index)) {
4219 free_slot = i;
4220 break;
4221 }
4222 }
4223
4224 if(free_slot >= 0) {
4225 A_MEMCPY(ar->sta_list[free_slot].mac, mac, ATH_MAC_LEN); 4219 A_MEMCPY(ar->sta_list[free_slot].mac, mac, ATH_MAC_LEN);
4226 A_MEMCPY(ar->sta_list[free_slot].wpa_ie, wpaie, ielen); 4220 A_MEMCPY(ar->sta_list[free_slot].wpa_ie, wpaie, ielen);
4227 ar->sta_list[free_slot].aid = aid; 4221 ar->sta_list[free_slot].aid = aid;
4228 ar->sta_list[free_slot].keymgmt = keymgmt; 4222 ar->sta_list[free_slot].keymgmt = keymgmt;
4229 ar->sta_list[free_slot].ucipher = ucipher; 4223 ar->sta_list[free_slot].ucipher = ucipher;
4230 ar->sta_list[free_slot].auth = auth; 4224 ar->sta_list[free_slot].auth = auth;
4231 ar->sta_list_index = ar->sta_list_index | (1 << free_slot); 4225 ar->sta_list_index = ar->sta_list_index | (1 << free_slot);
4232 ar->arAPStats.sta[aid-1].aid = aid; 4226 ar->arAPStats.sta[free_slot].aid = aid;
4233 return 1;
4234 }
4235 return 0; /* not added */
4236 } 4227 }
4237 4228
4238 void 4229 void
4239 ar6000_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, A_UINT8 *bssid, 4230 ar6000_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, A_UINT8 *bssid,
4240 A_UINT16 listenInterval, A_UINT16 beaconInterval, 4231 A_UINT16 listenInterval, A_UINT16 beaconInterval,
4241 NETWORK_TYPE networkType, A_UINT8 beaconIeLen, 4232 NETWORK_TYPE networkType, A_UINT8 beaconIeLen,
4242 A_UINT8 assocReqLen, A_UINT8 assocRespLen, 4233 A_UINT8 assocReqLen, A_UINT8 assocRespLen,
4243 A_UINT8 *assocInfo) 4234 A_UINT8 *assocInfo)
4244 { 4235 {
4245 union iwreq_data wrqu; 4236 union iwreq_data wrqu;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 key_op_ctrl &= ~KEY_OP_INIT_RSC; 4461 key_op_ctrl &= ~KEY_OP_INIT_RSC;
4471 } else { 4462 } else {
4472 key_op_ctrl |= KEY_OP_INIT_RSC; 4463 key_op_ctrl |= KEY_OP_INIT_RSC;
4473 } 4464 }
4474 ar6000_reinstall_keys(ar, key_op_ctrl); 4465 ar6000_reinstall_keys(ar, key_op_ctrl);
4475 } 4466 }
4476 #endif /* USER_KEYS */ 4467 #endif /* USER_KEYS */
4477 4468
4478 netif_wake_queue(ar->arNetDev); 4469 netif_wake_queue(ar->arNetDev);
4479 4470
4471 /* For CFG80211 the key configuration and the default key comes in after con nect so no point in plumbing invalid keys */
4472 #ifndef ATH6K_CONFIG_CFG80211
4480 if ((networkType & ADHOC_NETWORK) && 4473 if ((networkType & ADHOC_NETWORK) &&
4481 (OPEN_AUTH == ar->arDot11AuthMode) && 4474 (OPEN_AUTH == ar->arDot11AuthMode) &&
4482 (NONE_AUTH == ar->arAuthMode) && 4475 (NONE_AUTH == ar->arAuthMode) &&
4483 (WEP_CRYPT == ar->arPairwiseCrypto)) 4476 (WEP_CRYPT == ar->arPairwiseCrypto))
4484 { 4477 {
4485 if (!ar->arConnected) { 4478 if (!ar->arConnected) {
4486 wmi_addKey_cmd(ar->arWmi, 4479 wmi_addKey_cmd(ar->arWmi,
4487 ar->arDefTxKeyIndex, 4480 ar->arDefTxKeyIndex,
4488 WEP_CRYPT, 4481 WEP_CRYPT,
4489 GROUP_USAGE | TX_USAGE, 4482 GROUP_USAGE | TX_USAGE,
4490 ar->arWepKeyList[ar->arDefTxKeyIndex].arKeyLen, 4483 ar->arWepKeyList[ar->arDefTxKeyIndex].arKeyLen,
4491 NULL, 4484 NULL,
4492 ar->arWepKeyList[ar->arDefTxKeyIndex].arKey, KEY_OP_I NIT_VAL, NULL, 4485 ar->arWepKeyList[ar->arDefTxKeyIndex].arKey, KEY_OP_I NIT_VAL, NULL,
4493 NO_SYNC_WMIFLAG); 4486 NO_SYNC_WMIFLAG);
4494 } 4487 }
4495 } 4488 }
4489 #endif /* ATH6K_CONFIG_CFG80211 */
4496 4490
4497 /* Update connect & link status atomically */ 4491 /* Update connect & link status atomically */
4498 spin_lock_irqsave(&ar->arLock, flags); 4492 spin_lock_irqsave(&ar->arLock, flags);
4499 ar->arConnected = TRUE; 4493 ar->arConnected = TRUE;
4500 ar->arConnectPending = FALSE; 4494 ar->arConnectPending = FALSE;
4501 netif_carrier_on(ar->arNetDev); 4495 netif_carrier_on(ar->arNetDev);
4502 spin_unlock_irqrestore(&ar->arLock, flags); 4496 spin_unlock_irqrestore(&ar->arLock, flags);
4503 /* reset the rx aggr state */ 4497 /* reset the rx aggr state */
4504 aggr_reset_state(ar->aggr_cntxt); 4498 aggr_reset_state(ar->aggr_cntxt);
4505 reconnect_flag = 0; 4499 reconnect_flag = 0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
4581 } 4575 }
4582 return removed; 4576 return removed;
4583 } 4577 }
4584 4578
4585 void 4579 void
4586 ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, 4580 ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid,
4587 A_UINT8 assocRespLen, A_UINT8 *assocInfo, A_UINT16 proto colReasonStatus) 4581 A_UINT8 assocRespLen, A_UINT8 *assocInfo, A_UINT16 proto colReasonStatus)
4588 { 4582 {
4589 A_UINT8 i; 4583 A_UINT8 i;
4590 unsigned long flags; 4584 unsigned long flags;
4585 union iwreq_data wrqu;
4591 4586
4592 if(ar->arNetworkType & AP_NETWORK) { 4587 if(ar->arNetworkType & AP_NETWORK) {
4593 union iwreq_data wrqu; 4588 union iwreq_data wrqu;
4594 struct sk_buff *skb; 4589 struct sk_buff *skb;
4595 4590
4596 if(!remove_sta(ar, bssid, protocolReasonStatus)) { 4591 if(!remove_sta(ar, bssid, protocolReasonStatus)) {
4597 return; 4592 return;
4598 } 4593 }
4599 4594
4600 /* If there are no more associated STAs, empty the mcast PS q */ 4595 /* If there are no more associated STAs, empty the mcast PS q */
4601 if (ar->sta_list_index == 0) { 4596 if (ar->sta_list_index == 0) {
4602 A_MUTEX_LOCK(&ar->mcastpsqLock); 4597 A_MUTEX_LOCK(&ar->mcastpsqLock);
4603 while (!A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq)) { 4598 while (!A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq)) {
4604 skb = A_NETBUF_DEQUEUE(&ar->mcastpsq); 4599 skb = A_NETBUF_DEQUEUE(&ar->mcastpsq);
4605 A_NETBUF_FREE(skb); 4600 A_NETBUF_FREE(skb);
4606 } 4601 }
4607 A_MUTEX_UNLOCK(&ar->mcastpsqLock); 4602 A_MUTEX_UNLOCK(&ar->mcastpsqLock);
4608 4603
4609 /* Clear the LSB of the BitMapCtl field of the TIM IE */ 4604 /* Clear the LSB of the BitMapCtl field of the TIM IE */
4610 wmi_set_pvb_cmd(ar->arWmi, MCAST_AID, 0); 4605 if (ar->arWmiReady) {
4606 wmi_set_pvb_cmd(ar->arWmi, MCAST_AID, 0);
4607 }
4611 } 4608 }
4612 4609
4613 if(!IS_MAC_BCAST(bssid)) { 4610 if(!IS_MAC_BCAST(bssid)) {
4614 /* Send event to application */ 4611 /* Send event to application */
4615 A_MEMZERO(&wrqu, sizeof(wrqu)); 4612 A_MEMZERO(&wrqu, sizeof(wrqu));
4616 A_MEMCPY(wrqu.addr.sa_data, bssid, ATH_MAC_LEN); 4613 A_MEMCPY(wrqu.addr.sa_data, bssid, ATH_MAC_LEN);
4617 wireless_send_event(ar->arNetDev, IWEVEXPIRED, &wrqu, NULL); 4614 wireless_send_event(ar->arNetDev, IWEVEXPIRED, &wrqu, NULL);
4618 } 4615 }
4619 return; 4616 return;
4620 } 4617 }
4621 4618
4622 #ifdef ATH6K_CONFIG_CFG80211 4619 #ifdef ATH6K_CONFIG_CFG80211
4623 ar6k_cfg80211_disconnect_event(ar, reason, bssid, 4620 ar6k_cfg80211_disconnect_event(ar, reason, bssid,
4624 assocRespLen, assocInfo, 4621 assocRespLen, assocInfo,
4625 protocolReasonStatus); 4622 protocolReasonStatus);
4626 #endif /* ATH6K_CONFIG_CFG80211 */ 4623 #endif /* ATH6K_CONFIG_CFG80211 */
4627 4624
4628 if (NO_NETWORK_AVAIL != reason) 4625 /* Send disconnect event to supplicant */
4629 { 4626 A_MEMZERO(&wrqu, sizeof(wrqu));
4630 union iwreq_data wrqu; 4627 wrqu.addr.sa_family = ARPHRD_ETHER;
4631 A_MEMZERO(&wrqu, sizeof(wrqu)); 4628 wireless_send_event(ar->arNetDev, SIOCGIWAP, &wrqu, NULL);
4632 wrqu.addr.sa_family = ARPHRD_ETHER;
4633 4629
4634 /* Send disconnect event to supplicant */
4635 wireless_send_event(ar->arNetDev, SIOCGIWAP, &wrqu, NULL);
4636 }
4637 /* it is necessary to clear the host-side rx aggregation state */ 4630 /* it is necessary to clear the host-side rx aggregation state */
4638
4639 aggr_reset_state(ar->aggr_cntxt); 4631 aggr_reset_state(ar->aggr_cntxt);
4640 4632
4641 A_UNTIMEOUT(&ar->disconnect_timer); 4633 A_UNTIMEOUT(&ar->disconnect_timer);
4642 4634
4643 A_PRINTF("AR6000 disconnected"); 4635 A_PRINTF("AR6000 disconnected");
4644 if (bssid[0] || bssid[1] || bssid[2] || bssid[3] || bssid[4] || bssid[5]) { 4636 if (bssid[0] || bssid[1] || bssid[2] || bssid[3] || bssid[4] || bssid[5]) {
4645 A_PRINTF(" from %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", 4637 A_PRINTF(" from %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ",
4646 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); 4638 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
4647 } 4639 }
4648 4640
(...skipping 10 matching lines...) Expand all
4659 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n")); 4651 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n"));
4660 /* 4652 /*
4661 * If the event is due to disconnect cmd from the host, only they the target 4653 * If the event is due to disconnect cmd from the host, only they the target
4662 * would stop trying to connect. Under any other condition, target would 4654 * would stop trying to connect. Under any other condition, target would
4663 * keep trying to connect. 4655 * keep trying to connect.
4664 * 4656 *
4665 */ 4657 */
4666 if( reason == DISCONNECT_CMD) 4658 if( reason == DISCONNECT_CMD)
4667 { 4659 {
4668 ar->arConnectPending = FALSE; 4660 ar->arConnectPending = FALSE;
4669 if (!ar->arUserBssFilter) { 4661 if ((!ar->arUserBssFilter) && (ar->arWmiReady)) {
4670 wmi_bssfilter_cmd(ar->arWmi, NONE_BSS_FILTER, 0); 4662 wmi_bssfilter_cmd(ar->arWmi, NONE_BSS_FILTER, 0);
4671 } 4663 }
4672 } else { 4664 } else {
4673 ar->arConnectPending = TRUE; 4665 ar->arConnectPending = TRUE;
4674 if (((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x11)) || 4666 if (((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x11)) ||
4675 ((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x0) && (recon nect_flag == 1))) { 4667 ((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x0) && (recon nect_flag == 1))) {
4676 ar->arConnected = TRUE; 4668 ar->arConnected = TRUE;
4677 return; 4669 return;
4678 } 4670 }
4679 } 4671 }
4680 4672
4681 if (reason == NO_NETWORK_AVAIL) 4673 if ((reason == NO_NETWORK_AVAIL) && (ar->arWmiReady))
4682 { 4674 {
4683 bss_t *pWmiSsidnode = NULL; 4675 bss_t *pWmiSsidnode = NULL;
4684 4676
4685 /* remove the current associated bssid node */ 4677 /* remove the current associated bssid node */
4686 wmi_free_node (ar->arWmi, bssid); 4678 wmi_free_node (ar->arWmi, bssid);
4687 4679
4688 /* 4680 /*
4689 * In case any other same SSID nodes are present 4681 * In case any other same SSID nodes are present
4690 * remove it, since those nodes also not available now 4682 * remove it, since those nodes also not available now
4691 */ 4683 */
4692 do 4684 do
4693 { 4685 {
4694 /* 4686 /*
4695 * Find the nodes based on SSID and remove it 4687 * Find the nodes based on SSID and remove it
4696 * NOTE :: This case will not work out for Hidden-SSID 4688 * NOTE :: This case will not work out for Hidden-SSID
4697 */ 4689 */
4698 pWmiSsidnode = wmi_find_Ssidnode (ar->arWmi, ar->arSsid, ar->arSsidL en, FALSE, TRUE); 4690 pWmiSsidnode = wmi_find_Ssidnode (ar->arWmi, ar->arSsid, ar->arSsidL en, FALSE, TRUE);
4699 4691
4700 if (pWmiSsidnode) 4692 if (pWmiSsidnode)
4701 { 4693 {
4702 wmi_free_node (ar->arWmi, pWmiSsidnode->ni_macaddr); 4694 wmi_free_node (ar->arWmi, pWmiSsidnode->ni_macaddr);
4703 } 4695 }
4704 4696
4705 }while (pWmiSsidnode); 4697 } while (pWmiSsidnode);
4706
4707 #if 0
4708 /*
4709 * Issuing a disconnect cmd prevent the firmware from
4710 * continuing the scan and connect to the AP, if the AP
4711 * cannot be found in 10 seconds. The user has to issue
4712 * the iwconfig command again to connect to the AP.
4713 * This change came in CL#575412 (EV# 59469) has to
4714 * be fixed in a different way
4715 */
4716 ar6000_init_profile_info(ar);
4717 wmi_disconnect_cmd(ar->arWmi);
4718 #else
4719 { /* FIXME, This code is necessary if don't invoke
4720 * wmi_disconnect_cmd. FIXME if you has fixed above
4721 * EV# 59469
4722 */
4723 union iwreq_data wrqu;
4724 A_MEMZERO(&wrqu, sizeof(wrqu));
4725 wrqu.addr.sa_family = ARPHRD_ETHER;
4726
4727 /* Send disconnect event to supplicant */
4728 wireless_send_event(ar->arNetDev, SIOCGIWAP, &wrqu, NULL);
4729 }
4730
4731 #endif
4732 } 4698 }
4733 4699
4734 /* Update connect & link status atomically */ 4700 /* Update connect & link status atomically */
4735 spin_lock_irqsave(&ar->arLock, flags); 4701 spin_lock_irqsave(&ar->arLock, flags);
4736 ar->arConnected = FALSE; 4702 ar->arConnected = FALSE;
4737 netif_carrier_off(ar->arNetDev); 4703 netif_carrier_off(ar->arNetDev);
4738 spin_unlock_irqrestore(&ar->arLock, flags); 4704 spin_unlock_irqrestore(&ar->arLock, flags);
4739 4705
4740 if( (reason != CSERV_DISCONNECT) || (reconnect_flag != 1) ) { 4706 if( (reason != CSERV_DISCONNECT) || (reconnect_flag != 1) ) {
4741 reconnect_flag = 0; 4707 reconnect_flag = 0;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4781 } 4747 }
4782 } 4748 }
4783 4749
4784 void 4750 void
4785 ar6000_aggr_rcv_delba_req_evt(AR_SOFTC_T *ar, WMI_DELBA_EVENT *evt) 4751 ar6000_aggr_rcv_delba_req_evt(AR_SOFTC_T *ar, WMI_DELBA_EVENT *evt)
4786 { 4752 {
4787 aggr_recv_delba_req_evt(ar->aggr_cntxt, evt->tid); 4753 aggr_recv_delba_req_evt(ar->aggr_cntxt, evt->tid);
4788 } 4754 }
4789 #endif 4755 #endif
4790 4756
4757 void register_pal_cb(ar6k_pal_config_t *palConfig_p)
4758 {
4759 ar6k_pal_config_g = *palConfig_p;
4760 }
4761
4791 void 4762 void
4792 ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd) 4763 ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd)
4793 { 4764 {
4794 void *osbuf = NULL; 4765 void *osbuf = NULL;
4795 A_INT8 i; 4766 A_INT8 i;
4796 A_UINT8 size, *buf; 4767 A_UINT8 size, *buf;
4797 A_STATUS ret = A_OK; 4768 A_STATUS ret = A_OK;
4798 4769
4799 size = cmd->evt_buf_sz + 4; 4770 size = cmd->evt_buf_sz + 4;
4800 osbuf = A_NETBUF_ALLOC(size); 4771 osbuf = A_NETBUF_ALLOC(size);
4801 if (osbuf == NULL) { 4772 if (osbuf == NULL) {
4802 ret = A_NO_MEMORY; 4773 ret = A_NO_MEMORY;
4803 A_PRINTF("Error in allocating netbuf \n"); 4774 A_PRINTF("Error in allocating netbuf \n");
4804 return; 4775 return;
4805 } 4776 }
4806 4777
4807 A_NETBUF_PUT(osbuf, size); 4778 A_NETBUF_PUT(osbuf, size);
4808 buf = (A_UINT8 *)A_NETBUF_DATA(osbuf); 4779 buf = (A_UINT8 *)A_NETBUF_DATA(osbuf);
4809 /* First 2-bytes carry HCI event/ACL data type 4780 /* First 2-bytes carry HCI event/ACL data type
4810 * the next 2 are free 4781 * the next 2 are free
4811 */ 4782 */
4812 *((short *)buf) = WMI_HCI_EVENT_EVENTID; 4783 *((short *)buf) = WMI_HCI_EVENT_EVENTID;
4813 buf += sizeof(int); 4784 buf += sizeof(int);
4814 A_MEMCPY(buf, cmd->buf, cmd->evt_buf_sz); 4785 A_MEMCPY(buf, cmd->buf, cmd->evt_buf_sz);
4815 4786
4787 if(ar6k_pal_config_g.fpar6k_pal_recv_pkt)
4788 {
4789 /* pass the cmd packet to PAL driver */
4790 if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, osbuf) == TRU E)
4791 return;
4792 }
4816 ar6000_deliver_frames_to_nw_stack(ar->arNetDev, osbuf); 4793 ar6000_deliver_frames_to_nw_stack(ar->arNetDev, osbuf);
4817 if(loghci) { 4794 if(loghci) {
4818 A_PRINTF_LOG("HCI Event From PAL <-- \n"); 4795 A_PRINTF_LOG("HCI Event From PAL <-- \n");
4819 for(i = 0; i < cmd->evt_buf_sz; i++) { 4796 for(i = 0; i < cmd->evt_buf_sz; i++) {
4820 A_PRINTF_LOG("0x%02x ", cmd->buf[i]); 4797 A_PRINTF_LOG("0x%02x ", cmd->buf[i]);
4821 if((i % 10) == 0) { 4798 if((i % 10) == 0) {
4822 A_PRINTF_LOG("\n"); 4799 A_PRINTF_LOG("\n");
4823 } 4800 }
4824 } 4801 }
4825 A_PRINTF_LOG("\n"); 4802 A_PRINTF_LOG("\n");
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
5093 if (cookie == ar->arHBChallengeResp.seqNum) { 5070 if (cookie == ar->arHBChallengeResp.seqNum) {
5094 ar->arHBChallengeResp.outstanding = FALSE; 5071 ar->arHBChallengeResp.outstanding = FALSE;
5095 } 5072 }
5096 } 5073 }
5097 } 5074 }
5098 5075
5099 5076
5100 void 5077 void
5101 ar6000_reportError_event(AR_SOFTC_T *ar, WMI_TARGET_ERROR_VAL errorVal) 5078 ar6000_reportError_event(AR_SOFTC_T *ar, WMI_TARGET_ERROR_VAL errorVal)
5102 { 5079 {
5103 char *errString[] = { 5080 » static const char * const errString[] = {
5104 [WMI_TARGET_PM_ERR_FAIL] "WMI_TARGET_PM_ERR_FAIL", 5081 » » [WMI_TARGET_PM_ERR_FAIL] "WMI_TARGET_PM_ERR_FAIL",
5105 [WMI_TARGET_KEY_NOT_FOUND] "WMI_TARGET_KEY_NOT_FOUND", 5082 » » [WMI_TARGET_KEY_NOT_FOUND] "WMI_TARGET_KEY_NOT_FOUND",
5106 [WMI_TARGET_DECRYPTION_ERR] "WMI_TARGET_DECRYPTION_ERR", 5083 » » [WMI_TARGET_DECRYPTION_ERR] "WMI_TARGET_DECRYPTION_ERR",
5107 [WMI_TARGET_BMISS] "WMI_TARGET_BMISS", 5084 » » [WMI_TARGET_BMISS] "WMI_TARGET_BMISS",
5108 [WMI_PSDISABLE_NODE_JOIN] "WMI_PSDISABLE_NODE_JOIN" 5085 » » [WMI_PSDISABLE_NODE_JOIN] "WMI_PSDISABLE_NODE_JOIN"
5109 }; 5086 » };
5110 5087
5111 A_PRINTF("AR6000 Error on Target. Error = 0x%x\n", errorVal); 5088 A_PRINTF("AR6000 Error on Target. Error = 0x%x\n", errorVal);
5112 5089
5113 /* One error is reported at a time, and errorval is a bitmask */ 5090 /* One error is reported at a time, and errorval is a bitmask */
5114 if(errorVal & (errorVal - 1)) 5091 if(errorVal & (errorVal - 1))
5115 return; 5092 return;
5116 5093
5117 A_PRINTF("AR6000 Error type = "); 5094 A_PRINTF("AR6000 Error type = ");
5118 switch(errorVal) 5095 switch(errorVal)
5119 { 5096 {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
5276 (bih->frameType != PROBERESP_FTYPE))) 5253 (bih->frameType != PROBERESP_FTYPE)))
5277 { 5254 {
5278 return; 5255 return;
5279 } 5256 }
5280 5257
5281 if ((skb = A_NETBUF_ALLOC_RAW(len)) != NULL) { 5258 if ((skb = A_NETBUF_ALLOC_RAW(len)) != NULL) {
5282 5259
5283 A_NETBUF_PUT(skb, len); 5260 A_NETBUF_PUT(skb, len);
5284 A_MEMCPY(A_NETBUF_DATA(skb), datap, len); 5261 A_MEMCPY(A_NETBUF_DATA(skb), datap, len);
5285 skb->dev = ar->arNetDev; 5262 skb->dev = ar->arNetDev;
5286 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
5287 A_MEMCPY(skb_mac_header(skb), A_NETBUF_DATA(skb), 6); 5263 A_MEMCPY(skb_mac_header(skb), A_NETBUF_DATA(skb), 6);
5288 #else
5289 skb->mac.raw = A_NETBUF_DATA(skb);
5290 #endif
5291 skb->ip_summed = CHECKSUM_NONE; 5264 skb->ip_summed = CHECKSUM_NONE;
5292 skb->pkt_type = PACKET_OTHERHOST; 5265 skb->pkt_type = PACKET_OTHERHOST;
5293 skb->protocol = __constant_htons(0x0019); 5266 skb->protocol = __constant_htons(0x0019);
5294 netif_rx(skb); 5267 netif_rx(skb);
5295 } 5268 }
5296 } 5269 }
5297 5270
5298 A_UINT32 wmiSendCmdNum; 5271 A_UINT32 wmiSendCmdNum;
5299 5272
5300 A_STATUS 5273 A_STATUS
5301 ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid) 5274 ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid)
5302 { 5275 {
5303 AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; 5276 AR_SOFTC_T *ar = (AR_SOFTC_T *)devt;
5304 A_STATUS status = A_OK; 5277 A_STATUS status = A_OK;
5305 struct ar_cookie *cookie = NULL; 5278 struct ar_cookie *cookie = NULL;
5306 int i; 5279 int i;
5307 #ifdef CONFIG_PM 5280 #ifdef CONFIG_PM
5308 if (ar->arWowState) { 5281 if (ar->arWowState != WLAN_WOW_STATE_NONE) {
5309 A_NETBUF_FREE(osbuf); 5282 A_NETBUF_FREE(osbuf);
5310 return A_EACCES; 5283 return A_EACCES;
5311 } 5284 }
5312 #endif /* CONFIG_PM */ 5285 #endif /* CONFIG_PM */
5313 /* take lock to protect ar6000_alloc_cookie() */ 5286 /* take lock to protect ar6000_alloc_cookie() */
5314 AR6000_SPIN_LOCK(&ar->arLock, 0); 5287 AR6000_SPIN_LOCK(&ar->arLock, 0);
5315 5288
5316 do { 5289 do {
5317 5290
5318 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar_contrstatus = ol_tx: skb=0x%x, le n=0x%x eid =%d\n", 5291 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar_contrstatus = ol_tx: skb=0x%lx, l en=0x%x eid =%d\n",
5319 (A_UINT32)osbuf, A_NETBUF_LEN(osbuf), eid)); 5292 (unsigned long)osbuf, A_NETBUF_LEN(osbuf), eid));
5320 5293
5321 if (ar->arWMIControlEpFull && (eid == ar->arControlEp)) { 5294 if (ar->arWMIControlEpFull && (eid == ar->arControlEp)) {
5322 /* control endpoint is full, don't allocate resources, we 5295 /* control endpoint is full, don't allocate resources, we
5323 * are just going to drop this packet */ 5296 * are just going to drop this packet */
5324 cookie = NULL; 5297 cookie = NULL;
5325 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" WMI Control EP full, dropping packe t : 0x%X, len:%d \n", 5298 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" WMI Control EP full, dropping packe t : 0x%lX, len:%d \n",
5326 (A_UINT32)osbuf, A_NETBUF_LEN(osbuf))); 5299 (unsigned long)osbuf, A_NETBUF_LEN(osbuf)));
5327 } else { 5300 } else {
5328 cookie = ar6000_alloc_cookie(ar); 5301 cookie = ar6000_alloc_cookie(ar);
5329 } 5302 }
5330 5303
5331 if (cookie == NULL) { 5304 if (cookie == NULL) {
5332 status = A_NO_MEMORY; 5305 status = A_NO_MEMORY;
5333 break; 5306 break;
5334 } 5307 }
5335 5308
5336 if(logWmiRawMsgs) { 5309 if(logWmiRawMsgs) {
(...skipping 12 matching lines...) Expand all
5349 ar->arTxPending[eid]++; 5322 ar->arTxPending[eid]++;
5350 5323
5351 if (eid != ar->arControlEp) { 5324 if (eid != ar->arControlEp) {
5352 ar->arTotalTxDataPending++; 5325 ar->arTotalTxDataPending++;
5353 } 5326 }
5354 } 5327 }
5355 5328
5356 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 5329 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
5357 5330
5358 if (cookie != NULL) { 5331 if (cookie != NULL) {
5359 cookie->arc_bp[0] = (A_UINT32)osbuf; 5332 cookie->arc_bp[0] = (unsigned long)osbuf;
5360 cookie->arc_bp[1] = 0; 5333 cookie->arc_bp[1] = 0;
5361 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, 5334 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt,
5362 cookie, 5335 cookie,
5363 A_NETBUF_DATA(osbuf), 5336 A_NETBUF_DATA(osbuf),
5364 A_NETBUF_LEN(osbuf), 5337 A_NETBUF_LEN(osbuf),
5365 eid, 5338 eid,
5366 AR6K_CONTROL_PKT_TAG); 5339 AR6K_CONTROL_PKT_TAG);
5367 /* this interface is asynchronous, if there is an error, cleanup wil l happen in the 5340 /* this interface is asynchronous, if there is an error, cleanup wil l happen in the
5368 * TX completion callback */ 5341 * TX completion callback */
5369 HTCSendPkt(ar->arHtcTarget, &cookie->HtcPkt); 5342 HTCSendPkt(ar->arHtcTarget, &cookie->HtcPkt);
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
6125 6098
6126 wmi_ap_profile_commit(ar->arWmi, &p); 6099 wmi_ap_profile_commit(ar->arWmi, &p);
6127 spin_lock_irqsave(&ar->arLock, flags); 6100 spin_lock_irqsave(&ar->arLock, flags);
6128 ar->arConnected = TRUE; 6101 ar->arConnected = TRUE;
6129 netif_carrier_on(ar->arNetDev); 6102 netif_carrier_on(ar->arNetDev);
6130 spin_unlock_irqrestore(&ar->arLock, flags); 6103 spin_unlock_irqrestore(&ar->arLock, flags);
6131 ar->ap_profile_flag = 0; 6104 ar->ap_profile_flag = 0;
6132 return 0; 6105 return 0;
6133 } 6106 }
6134 6107
6135
6136 A_STATUS 6108 A_STATUS
6137 ar6000_connect_to_ap(struct ar6_softc *ar) 6109 ar6000_connect_to_ap(struct ar6_softc *ar)
6138 { 6110 {
6139 /* The ssid length check prevents second "essid off" from the user, 6111 /* The ssid length check prevents second "essid off" from the user,
6140 to be treated as a connect cmd. The second "essid off" is ignored. 6112 to be treated as a connect cmd. The second "essid off" is ignored.
6141 */ 6113 */
6142 if((ar->arWmiReady == TRUE) && (ar->arSsidLen > 0) && ar->arNetworkType!=AP_ NETWORK) 6114 if((ar->arWmiReady == TRUE) && (ar->arSsidLen > 0) && ar->arNetworkType!=AP_ NETWORK)
6143 { 6115 {
6144 A_STATUS status; 6116 A_STATUS status;
6145 if((ADHOC_NETWORK != ar->arNetworkType) && 6117 if((ADHOC_NETWORK != ar->arNetworkType) &&
(...skipping 17 matching lines...) Expand all
6163 ar->arConnectCtrlFlags |= CONNECT_IGNORE_WPAx_GROUP_CIPHER; 6135 ar->arConnectCtrlFlags |= CONNECT_IGNORE_WPAx_GROUP_CIPHER;
6164 } 6136 }
6165 #endif 6137 #endif
6166 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("Connect called with authmode %d dot11 auth %d"\ 6138 AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("Connect called with authmode %d dot11 auth %d"\
6167 " PW crypto %d PW crypto Len %d GRP crypto %d"\ 6139 " PW crypto %d PW crypto Len %d GRP crypto %d"\
6168 " GRP crypto Len %d\n", 6140 " GRP crypto Len %d\n",
6169 ar->arAuthMode, ar->arDot11AuthMode, 6141 ar->arAuthMode, ar->arDot11AuthMode,
6170 ar->arPairwiseCrypto, ar->arPairwiseCryptoLen, 6142 ar->arPairwiseCrypto, ar->arPairwiseCryptoLen,
6171 ar->arGroupCrypto, ar->arGroupCryptoLen)); 6143 ar->arGroupCrypto, ar->arGroupCryptoLen));
6172 reconnect_flag = 0; 6144 reconnect_flag = 0;
6173 /* Set the listen interval into 1000TUs. This value will be indicated to Ap in the conn. 6145 /* Set the listen interval into 1000TUs or more. This value will be indi cated to Ap in the conn.
6174 later set it back locally at the STA to 100/1000 TUs depending on the power mode */ 6146 later set it back locally at the STA to 100/1000 TUs depending on the power mode */
6175 if ((ar->arNetworkType == INFRA_NETWORK)) { 6147 if ((ar->arNetworkType == INFRA_NETWORK)) {
6176 wmi_listeninterval_cmd(ar->arWmi, A_MAX_WOW_LISTEN_INTERVAL, 0); 6148 wmi_listeninterval_cmd(ar->arWmi, max(ar->arListenIntervalT, (A_UINT 16)A_MAX_WOW_LISTEN_INTERVAL), 0);
6177 } 6149 }
6178 status = wmi_connect_cmd(ar->arWmi, ar->arNetworkType, 6150 status = wmi_connect_cmd(ar->arWmi, ar->arNetworkType,
6179 ar->arDot11AuthMode, ar->arAuthMode, 6151 ar->arDot11AuthMode, ar->arAuthMode,
6180 ar->arPairwiseCrypto, ar->arPairwiseCryptoLen, 6152 ar->arPairwiseCrypto, ar->arPairwiseCryptoLen,
6181 ar->arGroupCrypto,ar->arGroupCryptoLen, 6153 ar->arGroupCrypto,ar->arGroupCryptoLen,
6182 ar->arSsidLen, ar->arSsid, 6154 ar->arSsidLen, ar->arSsid,
6183 ar->arReqBssid, ar->arChannelHint, 6155 ar->arReqBssid, ar->arChannelHint,
6184 ar->arConnectCtrlFlags); 6156 ar->arConnectCtrlFlags);
6185 if (status != A_OK) { 6157 if (status != A_OK) {
6186 wmi_listeninterval_cmd(ar->arWmi, ar->arListenIntervalT, ar->arListe nIntervalB); 6158 wmi_listeninterval_cmd(ar->arWmi, ar->arListenIntervalT, ar->arListe nIntervalB);
(...skipping 10 matching lines...) Expand all
6197 } 6169 }
6198 6170
6199 ar->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD; 6171 ar->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD;
6200 6172
6201 ar->arConnectPending = TRUE; 6173 ar->arConnectPending = TRUE;
6202 return status; 6174 return status;
6203 } 6175 }
6204 return A_ERROR; 6176 return A_ERROR;
6205 } 6177 }
6206 6178
6207 A_STATUS
6208 ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
6209 {
6210 A_STATUS status = A_OK;
6211 AR6000_WLAN_STATE oldstate = ar->arWlanState;
6212 if (ar->arWmiReady == FALSE ||
6213 (state!=WLAN_DISABLED && state!=WLAN_ENABLED)) {
6214 return A_ERROR;
6215 }
6216 if (state == ar->arWlanState) {
6217 return A_OK;
6218 }
6219
6220 if (down_interruptible(&ar->arSem)) {
6221 return -ERESTARTSYS;
6222 }
6223
6224 if (ar->bIsDestroyProgress) {
6225 up(&ar->arSem);
6226 return -EBUSY;
6227 }
6228
6229 ar->arWlanState = state;
6230 do {
6231 if (ar->arWlanState == WLAN_ENABLED) {
6232 A_UINT16 fg_start_period = (ar->scParams.fg_start_period==0) ? 1 : a r->scParams.fg_start_period;
6233 WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = { TRUE, FALSE};
6234 WMI_REPORT_SLEEP_STATE_EVENT wmiSleepEvent ;
6235
6236 wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE;
6237 if ((status=wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode)) != A_OK) {
6238 break;
6239 }
6240 ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT 8*)&wmiSleepEvent,
6241 sizeof(WMI_REPORT_SLEEP_STATE_EVENTID));
6242 /* Enable foreground scanning */
6243 if ((status=wmi_scanparams_cmd(ar->arWmi, fg_start_period,
6244 ar->scParams.fg_end_period,
6245 ar->scParams.bg_period,
6246 ar->scParams.minact_chdwell_time,
6247 ar->scParams.maxact_chdwell_time,
6248 ar->scParams.pas_chdwell_time,
6249 ar->scParams.shortScanRatio,
6250 ar->scParams.scanCtrlFlags,
6251 ar->scParams.max_dfsch_act_time,
6252 ar->scParams.maxact_scan_per_ssid)) != A_OK) {
6253 break;
6254 }
6255 if (ar->arSsidLen) {
6256 if (ar6000_connect_to_ap(ar) != A_OK) {
6257 /* no need to report error if connection failed */
6258 break;
6259 }
6260 }
6261 } else {
6262 WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = FALSE };
6263
6264 WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode;
6265 WMI_REPORT_SLEEP_STATE_EVENT wmiSleepEvent;
6266
6267 wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP;
6268 /* make sure we disable wow for deep sleep */
6269 if ((status=wmi_set_wow_mode_cmd(ar->arWmi, &wowMode))!=A_OK) {
6270 break;
6271 }
6272
6273 ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT 8*)&wmiSleepEvent,
6274 sizeof(WMI_REPORT_SLEEP_STATE_EVENTID));
6275
6276 /* Disconnect from the AP and disable foreground scanning */
6277 AR6000_SPIN_LOCK(&ar->arLock, 0);
6278 if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) {
6279 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
6280 wmi_disconnect_cmd(ar->arWmi);
6281 } else {
6282 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
6283 }
6284
6285 ar->scan_triggered = 0;
6286
6287 if ((status=wmi_scanparams_cmd(ar->arWmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0, 0, 0)) != A_OK) {
6288 break;
6289 }
6290 ar6000_TxDataCleanup(ar);
6291 #ifndef ATH6K_CONFIG_OTA_MODE
6292 wmi_powermode_cmd(ar->arWmi, REC_POWER);
6293 #endif
6294 hostSleepMode.awake = FALSE;
6295 hostSleepMode.asleep = TRUE;
6296 if ((status=wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode))! =A_OK) {
6297 break;
6298 }
6299 if (ar->arTxPending[ar->arControlEp]) {
6300 long timeleft = wait_event_interruptible_timeout(arEvent,
6301 ar->arTxPending[ar->arControlEp] == 0, wmiti meout * HZ);
6302 if (!timeleft || signal_pending(current)) {
6303 status = A_ERROR;
6304 break;
6305 }
6306 }
6307 }
6308 } while (0);
6309 if (status!=A_OK) {
6310 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup WLAN state %d\n", ar->arWl anState));
6311 ar->arWlanState = oldstate;
6312 }
6313 up(&ar->arSem);
6314
6315 return status;
6316 }
6317
6318 A_STATUS 6179 A_STATUS
6319 ar6000_ap_mode_get_wpa_ie(struct ar6_softc *ar, struct ieee80211req_wpaie *wpaie ) 6180 ar6000_ap_mode_get_wpa_ie(struct ar6_softc *ar, struct ieee80211req_wpaie *wpaie )
6320 { 6181 {
6321 sta_t *conn = NULL; 6182 sta_t *conn = NULL;
6322 conn = ieee80211_find_conn(ar, wpaie->wpa_macaddr); 6183 conn = ieee80211_find_conn(ar, wpaie->wpa_macaddr);
6323 6184
6324 A_MEMZERO(wpaie->wpa_ie, IEEE80211_MAX_IE); 6185 A_MEMZERO(wpaie->wpa_ie, IEEE80211_MAX_IE);
6325 A_MEMZERO(wpaie->rsn_ie, IEEE80211_MAX_IE); 6186 A_MEMZERO(wpaie->rsn_ie, IEEE80211_MAX_IE);
6326 6187
6327 if(conn) { 6188 if(conn) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
6437 new_skb = A_NETBUF_ALLOC(A_NETBUF_LEN(dupskb)); 6298 new_skb = A_NETBUF_ALLOC(A_NETBUF_LEN(dupskb));
6438 6299
6439 if (new_skb == NULL) { 6300 if (new_skb == NULL) {
6440 AR6000_SPIN_LOCK(&ar->arLock, 0); 6301 AR6000_SPIN_LOCK(&ar->arLock, 0);
6441 ar6000_free_cookie(ar,cookie); 6302 ar6000_free_cookie(ar,cookie);
6442 AR6000_SPIN_UNLOCK(&ar->arLock, 0); 6303 AR6000_SPIN_UNLOCK(&ar->arLock, 0);
6443 break; 6304 break;
6444 } 6305 }
6445 6306
6446 A_NETBUF_PUT_DATA(new_skb, A_NETBUF_DATA(dupskb), A_NETBUF_LEN(dupskb)); 6307 A_NETBUF_PUT_DATA(new_skb, A_NETBUF_DATA(dupskb), A_NETBUF_LEN(dupskb));
6447 cookie->arc_bp[0] = (A_UINT32)new_skb; 6308 cookie->arc_bp[0] = (unsigned long)new_skb;
6448 cookie->arc_bp[1] = MapNo; 6309 cookie->arc_bp[1] = MapNo;
6449 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, 6310 SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt,
6450 cookie, 6311 cookie,
6451 A_NETBUF_DATA(new_skb), 6312 A_NETBUF_DATA(new_skb),
6452 A_NETBUF_LEN(new_skb), 6313 A_NETBUF_LEN(new_skb),
6453 eid, 6314 eid,
6454 AR6K_DATA_PKT_TAG); 6315 AR6K_DATA_PKT_TAG);
6455 6316
6456 cookieArray[i] = cookie; 6317 cookieArray[i] = cookie;
6457 6318
6458 { 6319 {
6459 EPPING_HEADER *pHdr = (EPPING_HEADER *)A_NETBUF_DATA(new_skb); 6320 EPPING_HEADER *pHdr = (EPPING_HEADER *)A_NETBUF_DATA(new_skb);
6460 pHdr->Cmd_h = EPPING_CMD_NO_ECHO; /* do not echo the packet */ 6321 pHdr->Cmd_h = EPPING_CMD_NO_ECHO; /* do not echo the packet */
6461 } 6322 }
6462 } 6323 }
6463 6324
6464 if (pkts == 0) { 6325 if (pkts == 0) {
6465 return; 6326 return;
6466 } 6327 }
6467 6328
6468 INIT_HTC_PACKET_QUEUE(&pktQueue); 6329 INIT_HTC_PACKET_QUEUE(&pktQueue);
6469 6330
6470 for (i = 0; i < pkts; i++) { 6331 for (i = 0; i < pkts; i++) {
6471 HTC_PACKET_ENQUEUE(&pktQueue,&cookieArray[i]->HtcPkt); 6332 HTC_PACKET_ENQUEUE(&pktQueue,&cookieArray[i]->HtcPkt);
6472 } 6333 }
6473 6334
6474 HTCSendPktsMultiple(ar->arHtcTarget, &pktQueue); 6335 HTCSendPktsMultiple(ar->arHtcTarget, &pktQueue);
6475 6336
6476 } 6337 }
6338 #endif
6477 6339
6340 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
6341 /*
6342 * Add support for adding and removing a virtual adapter for soft AP.
6343 * Some OS requires different adapters names for station and soft AP mode.
6344 * To support these requirement, create and destory a netdevice instance
6345 * when the AP mode is operational. A full fledged support for virual device
6346 * is not implemented. Rather a virtual interface is created and is linked
6347 * with the existing physical device instance during the operation of the
6348 * AP mode.
6349 */
6350
6351 A_STATUS ar6000_start_ap_interface(AR_SOFTC_T *ar)
6352 {
6353 AR_VIRTUAL_INTERFACE_T *arApDev;
6354
6355 /* Change net_device to point to AP instance */
6356 arApDev = (AR_VIRTUAL_INTERFACE_T *)ar->arApDev;
6357 ar->arNetDev = arApDev->arNetDev;
6358
6359 return A_OK;
6360 }
6361
6362 A_STATUS ar6000_stop_ap_interface(AR_SOFTC_T *ar)
6363 {
6364 AR_VIRTUAL_INTERFACE_T *arApDev;
6365
6366 /* Change net_device to point to sta instance */
6367 arApDev = (AR_VIRTUAL_INTERFACE_T *)ar->arApDev;
6368 if (arApDev) {
6369 ar->arNetDev = arApDev->arStaNetDev;
6370 }
6371
6372 return A_OK;
6373 }
6374
6375
6376 A_STATUS ar6000_create_ap_interface(AR_SOFTC_T *ar, char *ap_ifname)
6377 {
6378 struct net_device *dev;
6379 AR_VIRTUAL_INTERFACE_T *arApDev;
6380
6381 dev = alloc_etherdev(sizeof(AR_VIRTUAL_INTERFACE_T));
6382 if (dev == NULL) {
6383 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_create_ap_interface: can't alloc etherdev\n"));
6384 return A_ERROR;
6385 }
6386
6387 ether_setup(dev);
6388 init_netdev(dev, ap_ifname);
6389
6390 if (register_netdev(dev)) {
6391 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_create_ap_interface: register_net dev failed\n"));
6392 return A_ERROR;
6393 }
6394
6395 arApDev = netdev_priv(dev);
6396 arApDev->arDev = ar;
6397 arApDev->arNetDev = dev;
6398 arApDev->arStaNetDev = ar->arNetDev;
6399
6400 ar->arApDev = arApDev;
6401 arApNetDev = dev;
6402
6403 /* Copy the MAC address */
6404 A_MEMCPY(dev->dev_addr, ar->arNetDev->dev_addr, AR6000_ETH_ADDR_LEN);
6405
6406 return A_OK;
6407 }
6408
6409 A_STATUS ar6000_add_ap_interface(AR_SOFTC_T *ar, char *ap_ifname)
6410 {
6411 /* Interface already added, need not proceed further */
6412 if (ar->arApDev != NULL) {
6413 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_add_ap_interface: interface alrea dy present \n"));
6414 return A_OK;
6415 }
6416
6417 if (ar6000_create_ap_interface(ar, ap_ifname) != A_OK) {
6418 return A_ERROR;
6419 }
6420
6421 A_PRINTF("Add AP interface %s \n",ap_ifname);
6422
6423 return ar6000_start_ap_interface(ar);
6424 }
6425
6426 A_STATUS ar6000_remove_ap_interface(AR_SOFTC_T *ar)
6427 {
6428 if (arApNetDev) {
6429 ar6000_stop_ap_interface(ar);
6430
6431 unregister_netdev(arApNetDev);
6432 #ifndef free_netdev
6433 kfree(arApNetDev);
6434 #else
6435 free_netdev(apApNetDev);
6478 #endif 6436 #endif
6479 6437
6438 A_PRINTF("Remove AP interface\n");
6439 }
6440 ar->arApDev = NULL;
6441 arApNetDev = NULL;
6442
6443
6444 return A_OK;
6445 }
6446 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
6447
6448
6480 #ifdef EXPORT_HCI_BRIDGE_INTERFACE 6449 #ifdef EXPORT_HCI_BRIDGE_INTERFACE
6481 EXPORT_SYMBOL(setupbtdev); 6450 EXPORT_SYMBOL(setupbtdev);
6482 #endif 6451 #endif
OLDNEW
« no previous file with comments | « chromeos/drivers/ath6kl/os/linux/ar6000_android.c ('k') | chromeos/drivers/ath6kl/os/linux/ar6000_pm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698