1 //------------------------------------------------------------------------------
2 // Copyright (c) 2004-2010 Atheros Communications Inc.
3 // All rights reserved.
7 // Permission to use, copy, modify, and/or distribute this software for any
8 // purpose with or without fee is hereby granted, provided that the above
9 // copyright notice and this permission notice appear in all copies.
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.
21 // Author(s): ="Atheros"
22 //------------------------------------------------------------------------------
27 #include <linux/init.h>
28 #include <linux/sched.h>
29 #include <linux/spinlock.h>
30 #include <linux/if_ether.h>
31 #include <linux/etherdevice.h>
32 #include <net/iw_handler.h>
33 #include <linux/if_arp.h>
35 #include <linux/wireless.h>
36 #ifdef ATH6K_CONFIG_CFG80211
37 #include <net/cfg80211.h>
38 #endif /* ATH6K_CONFIG_CFG80211 */
39 #include <linux/module.h>
50 #include <ieee80211.h>
51 #include <ieee80211_ioctl.h>
57 #include "aggr_recv_api.h"
58 #include <host_version.h>
59 #include <linux/rtnetlink.h>
60 #include <linux/init.h>
61 #include <linux/moduleparam.h>
62 #include "ar6000_api.h"
63 #ifdef CONFIG_HOST_TCMD_SUPPORT
66 #include <linux/firmware.h>
68 #include "targaddrs.h"
69 #include "dbglog_api.h"
70 #include "ar6000_diag.h"
71 #include "common_drv.h"
73 #include "hci_transport_api.h"
74 #define ATH_MODULE_NAME driver
76 #include "hw/apb_map.h"
77 #include "hw/rtc_reg.h"
78 #include "hw/mbox_reg.h"
79 #include "hw/gpio_reg.h"
81 #define ATH_DEBUG_DBG_LOG ATH_DEBUG_MAKE_MODULE_MASK(0)
82 #define ATH_DEBUG_WLAN_CONNECT ATH_DEBUG_MAKE_MODULE_MASK(1)
83 #define ATH_DEBUG_WLAN_SCAN ATH_DEBUG_MAKE_MODULE_MASK(2)
84 #define ATH_DEBUG_WLAN_TX ATH_DEBUG_MAKE_MODULE_MASK(3)
85 #define ATH_DEBUG_WLAN_RX ATH_DEBUG_MAKE_MODULE_MASK(4)
86 #define ATH_DEBUG_HTC_RAW ATH_DEBUG_MAKE_MODULE_MASK(5)
87 #define ATH_DEBUG_HCI_BRIDGE ATH_DEBUG_MAKE_MODULE_MASK(6)
88 #define ATH_DEBUG_HCI_RECV ATH_DEBUG_MAKE_MODULE_MASK(7)
89 #define ATH_DEBUG_HCI_SEND ATH_DEBUG_MAKE_MODULE_MASK(8)
90 #define ATH_DEBUG_HCI_DUMP ATH_DEBUG_MAKE_MODULE_MASK(9)
93 #define __dev_put(dev) dev_put(dev)
99 #define USER_SAVEDKEYS_STAT_INIT 0
100 #define USER_SAVEDKEYS_STAT_RUN 1
102 // TODO this needs to move into the AR_SOFTC struct
103 struct USER_SAVEDKEYS {
104 struct ieee80211req_key ucast_ik;
105 struct ieee80211req_key bcast_ik;
111 #define DBG_INFO 0x00000001
112 #define DBG_ERROR 0x00000002
113 #define DBG_WARNING 0x00000004
114 #define DBG_SDIO 0x00000008
115 #define DBG_HIF 0x00000010
116 #define DBG_HTC 0x00000020
117 #define DBG_WMI 0x00000040
118 #define DBG_WMI2 0x00000080
119 #define DBG_DRIVER 0x00000100
121 #define DBG_DEFAULTS (DBG_ERROR|DBG_WARNING)
124 int ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
125 int ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
132 #define AR6000_MAX_RX_BUFFERS 16
133 #define AR6000_BUFFER_SIZE 1664
134 #define AR6000_MAX_AMSDU_RX_BUFFERS 4
135 #define AR6000_AMSDU_REFILL_THRESHOLD 3
136 #define AR6000_AMSDU_BUFFER_SIZE (WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH + 128)
137 #define AR6000_MAX_RX_MESSAGE_SIZE (max(WMI_MAX_NORMAL_RX_DATA_FRAME_LENGTH,WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH))
139 #define AR6000_TX_TIMEOUT 10
140 #define AR6000_ETH_ADDR_LEN 6
141 #define AR6000_MAX_ENDPOINTS 4
142 #define MAX_NODE_NUM 15
143 /* MAX_HI_COOKIE_NUM are reserved for high priority traffic */
144 #define MAX_DEF_COOKIE_NUM 180
145 #define MAX_HI_COOKIE_NUM 18 /* 10% of MAX_COOKIE_NUM */
146 #define MAX_COOKIE_NUM (MAX_DEF_COOKIE_NUM + MAX_HI_COOKIE_NUM)
148 /* MAX_DEFAULT_SEND_QUEUE_DEPTH is used to set the default queue depth for the
149 * WMM send queues. If a queue exceeds this depth htc will query back to the
150 * OS specific layer by calling EpSendFull(). This gives the OS layer the
151 * opportunity to drop the packet if desired. Therefore changing
152 * MAX_DEFAULT_SEND_QUEUE_DEPTH does not affect resource utilization but
153 * does impact the threshold used to identify if a packet should be
155 #define MAX_DEFAULT_SEND_QUEUE_DEPTH (MAX_DEF_COOKIE_NUM / WMM_NUM_AC)
157 #define AR6000_HB_CHALLENGE_RESP_FREQ_DEFAULT 1
158 #define AR6000_HB_CHALLENGE_RESP_MISS_THRES_DEFAULT 1
159 #define A_DISCONNECT_TIMER_INTERVAL 10 * 1000
160 #define A_DEFAULT_LISTEN_INTERVAL 100
161 #define A_MAX_WOW_LISTEN_INTERVAL 1000
164 DRV_HB_CHALLENGE = 0,
169 WLAN_INIT_MODE_NONE = 0,
175 /* Suspend - configuration */
177 WLAN_SUSPEND_CUT_PWR = 0,
178 WLAN_SUSPEND_DEEP_SLEEP,
180 WLAN_SUSPEND_CUT_PWR_IF_BT_OFF
183 /* WiFi OFF - configuration */
185 WLAN_OFF_CUT_PWR = 0,
189 /* WLAN low power state */
191 WLAN_POWER_STATE_ON = 0,
192 WLAN_POWER_STATE_CUT_PWR = 1,
193 WLAN_POWER_STATE_DEEP_SLEEP,
199 WLAN_WOW_STATE_NONE = 0,
200 WLAN_WOW_STATE_SUSPENDED,
201 WLAN_WOW_STATE_SUSPENDING
205 typedef enum _AR6K_BIN_FILE {
209 AR6K_BOARD_DATA_FILE,
212 #ifdef SETUPHCI_ENABLED
213 #define SETUPHCI_DEFAULT 1
215 #define SETUPHCI_DEFAULT 0
216 #endif /* SETUPHCI_ENABLED */
218 #ifdef SETUPHCIPAL_ENABLED
219 #define SETUPHCIPAL_DEFAULT 1
221 #define SETUPHCIPAL_DEFAULT 0
222 #endif /* SETUPHCIPAL_ENABLED */
224 #ifdef SETUPBTDEV_ENABLED
225 #define SETUPBTDEV_DEFAULT 1
227 #define SETUPBTDEV_DEFAULT 0
228 #endif /* SETUPBTDEV_ENABLED */
231 #define BMIENABLE_DEFAULT 1
233 #define BMIENABLE_DEFAULT 0
234 #endif /* BMIENABLE_SET */
236 #ifdef ENABLEUARTPRINT_SET
237 #define ENABLEUARTPRINT_DEFAULT 1
239 #define ENABLEUARTPRINT_DEFAULT 0
240 #endif /* ENABLEARTPRINT_SET */
242 #ifdef ATH6K_CONFIG_HIF_VIRTUAL_SCATTER
243 #define NOHIFSCATTERSUPPORT_DEFAULT 1
244 #else /* ATH6K_CONFIG_HIF_VIRTUAL_SCATTER */
245 #define NOHIFSCATTERSUPPORT_DEFAULT 0
246 #endif /* ATH6K_CONFIG_HIF_VIRTUAL_SCATTER */
248 #ifdef AR600x_BT_AR3001
249 #define AR3KHCIBAUD_DEFAULT 3000000
250 #define HCIUARTSCALE_DEFAULT 1
251 #define HCIUARTSTEP_DEFAULT 8937
253 #define AR3KHCIBAUD_DEFAULT 0
254 #define HCIUARTSCALE_DEFAULT 0
255 #define HCIUARTSTEP_DEFAULT 0
256 #endif /* AR600x_BT_AR3001 */
258 #ifdef INIT_MODE_DRV_ENABLED
259 #define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_DRV
261 #define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_USR
262 #endif /* INIT_MODE_DRV_ENABLED */
264 #define AR6K_PATCH_DOWNLOAD_ADDRESS(_param, _ver) do { \
265 if ((_ver) == AR6003_REV1_VERSION) { \
266 (_param) = AR6003_REV1_PATCH_DOWNLOAD_ADDRESS; \
267 } else if ((_ver) == AR6003_REV2_VERSION) { \
268 (_param) = AR6003_REV2_PATCH_DOWNLOAD_ADDRESS; \
270 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \
275 #define AR6K_DATA_DOWNLOAD_ADDRESS(_param, _ver) do { \
276 if ((_ver) == AR6003_REV1_VERSION) { \
277 (_param) = AR6003_REV1_DATA_DOWNLOAD_ADDRESS; \
278 } else if ((_ver) == AR6003_REV2_VERSION) { \
279 (_param) = AR6003_REV2_DATA_DOWNLOAD_ADDRESS; \
281 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \
286 #define AR6K_APP_START_OVERRIDE_ADDRESS(_param, _ver) do { \
287 if ((_ver) == AR6003_REV1_VERSION) { \
288 (_param) = AR6003_REV1_APP_START_OVERRIDE; \
289 } else if ((_ver) == AR6003_REV2_VERSION) { \
290 (_param) = AR6003_REV2_APP_START_OVERRIDE; \
292 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \
297 /* AR6003 1.0 definitions */
298 #define AR6003_REV1_VERSION 0x300002ba
299 #define AR6003_REV1_DATA_DOWNLOAD_ADDRESS AR6003_REV1_OTP_DATA_ADDRESS
300 #define AR6003_REV1_PATCH_DOWNLOAD_ADDRESS 0x57ea6c
301 #define AR6003_REV1_OTP_FILE "ath6k/AR6003/hw1.0/otp.bin.z77"
302 #define AR6003_REV1_FIRMWARE_FILE "ath6k/AR6003/hw1.0/athwlan.bin.z77"
303 #define AR6003_REV1_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw1.0/athtcmd_ram.bin"
304 #define AR6003_REV1_ART_FIRMWARE_FILE "ath6k/AR6003/hw1.0/device.bin"
305 #define AR6003_REV1_PATCH_FILE "ath6k/AR6003/hw1.0/data.patch.bin"
306 #define AR6003_REV1_EPPING_FIRMWARE_FILE "ath6k/AR6003/hw1.0/endpointping.bin"
307 #ifdef AR600x_SD31_XXX
308 #define AR6003_REV1_BOARD_DATA_FILE "ath6k/AR6003/hw1.0/bdata.SD31.bin"
309 #elif defined(AR600x_SD32_XXX)
310 #define AR6003_REV1_BOARD_DATA_FILE "ath6k/AR6003/hw1.0/bdata.SD32.bin"
311 #elif defined(AR600x_WB31_XXX)
312 #define AR6003_REV1_BOARD_DATA_FILE "ath6k/AR6003/hw1.0/bdata.WB31.bin"
314 #define AR6003_REV1_BOARD_DATA_FILE "ath6k/AR6003/hw1.0/bdata.CUSTOM.bin"
315 #endif /* Board Data File */
317 /* AR6003 2.0 definitions */
318 #define AR6003_REV2_VERSION 0x30000384
319 #define AR6003_REV2_DATA_DOWNLOAD_ADDRESS AR6003_REV2_OTP_DATA_ADDRESS
320 #define AR6003_REV2_PATCH_DOWNLOAD_ADDRESS 0x57e910
321 #define AR6003_REV2_OTP_FILE "ath6k/AR6003/hw2.0/otp.bin.z77"
322 #define AR6003_REV2_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athwlan.bin.z77"
323 #define AR6003_REV2_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athtcmd_ram.bin"
324 #define AR6003_REV2_ART_FIRMWARE_FILE "ath6k/AR6003/hw2.0/device.bin"
325 #define AR6003_REV2_PATCH_FILE "ath6k/AR6003/hw2.0/data.patch.bin"
326 #define AR6003_REV2_EPPING_FIRMWARE_FILE "ath6k/AR6003/hw2.0/endpointping.bin"
327 #ifdef AR600x_SD31_XXX
328 #define AR6003_REV2_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.SD31.bin"
329 #elif defined(AR600x_SD32_XXX)
330 #define AR6003_REV2_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.SD32.bin"
331 #elif defined(AR600x_WB31_XXX)
332 #define AR6003_REV2_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.WB31.bin"
334 #define AR6003_REV2_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.CUSTOM.bin"
335 #endif /* Board Data File */
339 WLAN_PWR_CTRL_UP = 0,
340 WLAN_PWR_CTRL_CUT_PWR,
341 WLAN_PWR_CTRL_DEEP_SLEEP,
343 WLAN_PWR_CTRL_DEEP_SLEEP_DISABLED
346 /* HTC RAW streams */
347 typedef enum _HTC_RAW_STREAM_ID {
348 HTC_RAW_STREAM_NOT_MAPPED = -1,
349 HTC_RAW_STREAM_0 = 0,
350 HTC_RAW_STREAM_1 = 1,
351 HTC_RAW_STREAM_2 = 2,
352 HTC_RAW_STREAM_3 = 3,
353 HTC_RAW_STREAM_NUM_MAX
356 #define RAW_HTC_READ_BUFFERS_NUM 4
357 #define RAW_HTC_WRITE_BUFFERS_NUM 4
359 #define HTC_RAW_BUFFER_SIZE 1664
364 unsigned char data[HTC_RAW_BUFFER_SIZE];
365 HTC_PACKET HTCPacket;
368 #ifdef CONFIG_HOST_TCMD_SUPPORT
370 * add TCMD_MODE besides wmi and bypasswmi
371 * in TCMD_MODE, only few TCMD releated wmi commands
380 #endif /* CONFIG_HOST_TCMD_SUPPORT */
388 #ifdef ATH6K_CONFIG_CFG80211
390 A_UINT8 key[WLAN_MAX_KEY_LEN];
392 A_UINT8 seq[IW_ENCODE_SEQ_MAX_SIZE];
396 #endif /* ATH6K_CONFIG_CFG80211 */
399 struct ar_node_mapping {
400 A_UINT8 macAddress[6];
406 unsigned long arc_bp[2]; /* Must be first field */
407 HTC_PACKET HtcPkt; /* HTC packet wrapper */
408 struct ar_cookie *arc_list_next;
411 struct ar_hb_chlng_resp {
420 /* Per STA data, used in AP mode */
421 /*TODO: All this should move to OS independent dir */
423 #define STA_PWR_MGMT_MASK 0x1
424 #define STA_PWR_MGMT_SHIFT 0x0
425 #define STA_PWR_MGMT_AWAKE 0x0
426 #define STA_PWR_MGMT_SLEEP 0x1
428 #define STA_SET_PWR_SLEEP(sta) (sta->flags |= (STA_PWR_MGMT_MASK << STA_PWR_MGMT_SHIFT))
429 #define STA_CLR_PWR_SLEEP(sta) (sta->flags &= ~(STA_PWR_MGMT_MASK << STA_PWR_MGMT_SHIFT))
430 #define STA_IS_PWR_SLEEP(sta) ((sta->flags >> STA_PWR_MGMT_SHIFT) & STA_PWR_MGMT_MASK)
432 #define STA_PS_POLLED_MASK 0x1
433 #define STA_PS_POLLED_SHIFT 0x1
434 #define STA_SET_PS_POLLED(sta) (sta->flags |= (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
435 #define STA_CLR_PS_POLLED(sta) (sta->flags &= ~(STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
436 #define STA_IS_PS_POLLED(sta) (sta->flags & (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
440 A_UINT8 mac[ATH_MAC_LEN];
445 A_UINT8 wpa_ie[IEEE80211_MAX_IE];
446 A_NETBUF_QUEUE_T psq; /* power save q */
450 typedef struct ar6_raw_htc {
451 HTC_ENDPOINT_ID arRaw2EpMapping[HTC_RAW_STREAM_NUM_MAX];
452 HTC_RAW_STREAM_ID arEp2RawMapping[ENDPOINT_MAX];
453 struct semaphore raw_htc_read_sem[HTC_RAW_STREAM_NUM_MAX];
454 struct semaphore raw_htc_write_sem[HTC_RAW_STREAM_NUM_MAX];
455 wait_queue_head_t raw_htc_read_queue[HTC_RAW_STREAM_NUM_MAX];
456 wait_queue_head_t raw_htc_write_queue[HTC_RAW_STREAM_NUM_MAX];
457 raw_htc_buffer raw_htc_read_buffer[HTC_RAW_STREAM_NUM_MAX][RAW_HTC_READ_BUFFERS_NUM];
458 raw_htc_buffer raw_htc_write_buffer[HTC_RAW_STREAM_NUM_MAX][RAW_HTC_WRITE_BUFFERS_NUM];
459 A_BOOL write_buffer_available[HTC_RAW_STREAM_NUM_MAX];
460 A_BOOL read_buffer_available[HTC_RAW_STREAM_NUM_MAX];
463 typedef struct ar6_softc {
464 struct net_device *arNetDev; /* net_device pointer */
466 int arTxPending[ENDPOINT_MAX];
467 int arTotalTxDataPending;
468 A_UINT8 arNumDataEndPts;
472 HTC_HANDLE arHtcTarget;
475 struct semaphore arSem;
479 A_UINT8 arNetworkType;
480 A_UINT8 arDot11AuthMode;
482 A_UINT8 arPairwiseCrypto;
483 A_UINT8 arPairwiseCryptoLen;
484 A_UINT8 arGroupCrypto;
485 A_UINT8 arGroupCryptoLen;
486 A_UINT8 arDefTxKeyIndex;
487 struct ar_wep_key arWepKeyList[WMI_MAX_KEY_INDEX + 1];
489 A_UINT8 arReqBssid[6];
490 A_UINT16 arChannelHint;
491 A_UINT16 arBssChannel;
492 A_UINT16 arListenIntervalB;
493 A_UINT16 arListenIntervalT;
494 struct ar6000_version arVersion;
495 A_UINT32 arTargetType;
500 struct net_device_stats arNetStats;
501 struct iw_statistics arIwStats;
502 A_INT8 arNumChannels;
503 A_UINT16 arChannelList[32];
505 A_BOOL statsUpdatePending;
506 TARGET_STATS arTargetStats;
508 A_UINT8 arPhyCapability;
509 #ifdef CONFIG_HOST_TCMD_SUPPORT
510 A_UINT8 tcmdRxReport;
511 A_UINT32 tcmdRxTotalPkt;
514 A_UINT32 arTargetMode;
515 A_UINT32 tcmdRxcrcErrPkt;
516 A_UINT32 tcmdRxsecErrPkt;
517 A_UINT16 tcmdRateCnt[TCMD_MAX_RATES];
518 A_UINT16 tcmdRateCntShortGuard[TCMD_MAX_RATES];
520 AR6000_WLAN_STATE arWlanState;
521 struct ar_node_mapping arNodeMap[MAX_NODE_NUM];
522 A_UINT8 arIbssPsEnable;
525 struct ar_cookie *arCookieList;
526 A_UINT32 arCookieCount;
529 A_UINT16 arBeaconInterval;
530 A_BOOL arConnectPending;
532 struct ar_hb_chlng_resp arHBChallengeResp;
533 A_UINT8 arKeepaliveConfigured;
534 A_UINT32 arMgmtFilter;
535 HTC_ENDPOINT_ID arAc2EpMapping[WMM_NUM_AC];
536 A_BOOL arAcStreamActive[WMM_NUM_AC];
537 A_UINT8 arAcStreamPriMap[WMM_NUM_AC];
538 A_UINT8 arHiAcStreamActivePri;
539 A_UINT8 arEp2AcMapping[ENDPOINT_MAX];
540 HTC_ENDPOINT_ID arControlEp;
541 #ifdef HTC_RAW_INTERFACE
542 AR_RAW_HTC_T *arRawHtc;
544 A_BOOL arNetQueueStopped;
547 COMMON_CREDIT_STATE_INFO arCreditStateInfo;
548 A_BOOL arWMIControlEpFull;
549 A_BOOL dbgLogFetchInProgress;
550 A_UCHAR log_buffer[DBGLOG_HOST_LOG_BUFFER_SIZE];
552 A_UINT32 dbglog_init_done;
553 A_UINT32 arConnectCtrlFlags;
555 A_INT32 user_savedkeys_stat;
556 A_UINT32 user_key_ctrl;
557 struct USER_SAVEDKEYS user_saved_keys;
559 USER_RSSI_THOLD rssi_map[12];
560 A_UINT8 arUserBssFilter;
561 A_UINT16 ap_profile_flag; /* AP mode */
562 WMI_AP_ACL g_acl; /* AP mode */
563 sta_t sta_list[AP_MAX_NUM_STA]; /* AP mode */
564 A_UINT8 sta_list_index; /* AP mode */
565 struct ieee80211req_key ap_mode_bkey; /* AP mode */
566 A_NETBUF_QUEUE_T mcastpsq; /* power save q for Mcast frames */
567 A_MUTEX_T mcastpsqLock;
568 A_BOOL DTIMExpired; /* flag to indicate DTIM expired */
569 A_UINT8 intra_bss; /* enable/disable intra bss data forward */
571 #ifndef EXPORT_HCI_BRIDGE_INTERFACE
575 WMI_AP_MODE_STAT arAPStats;
576 A_UINT8 ap_hidden_ssid;
577 A_UINT8 ap_country_code[3];
579 A_UINT8 ap_dtim_period;
580 A_UINT16 ap_beacon_interval;
582 A_UINT16 arACS; /* AP mode - Auto Channel Selection */
583 HTC_PACKET_QUEUE amsdu_rx_buffer_queue;
584 A_BOOL bIsDestroyProgress; /* flag to indicate ar6k destroy is in progress */
585 A_TIMER disconnect_timer;
586 A_UINT8 rxMetaVersion;
588 A_UINT8 arWapiEnable;
590 WMI_BTCOEX_CONFIG_EVENT arBtcoexConfig;
591 WMI_BTCOEX_STATS_EVENT arBtcoexStats;
592 A_INT32 (*exitCallback)(void *config); /* generic callback at AR6K exit */
593 HIF_DEVICE_OS_DEVICE_INFO osDevInfo;
594 #ifdef ATH6K_CONFIG_CFG80211
595 struct wireless_dev *wdev;
596 struct cfg80211_scan_request *scan_request;
597 struct ar_key keys[WMI_MAX_KEY_INDEX + 1];
598 #endif /* ATH6K_CONFIG_CFG80211 */
599 A_UINT16 arWlanPowerState;
605 A_UINT16 arSuspendConfig;
606 A_UINT16 arWlanOffConfig;
607 A_UINT16 arWow2Config;
609 A_UINT8 scan_triggered;
610 WMI_SCAN_PARAMS_CMD scParams;
611 #define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
612 A_UINT8 mcast_filters[MAC_MAX_FILTERS_PER_LIST][AR_MCAST_FILTER_MAC_ADDR_SIZE];
614 A_BOOL scanSpecificSsid;
615 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
620 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
622 struct net_device *arNetDev; /* net_device pointer */
623 AR_SOFTC_T *arDev; /* ar device pointer */
624 struct net_device *arStaNetDev; /* net_device pointer */
625 } AR_VIRTUAL_INTERFACE_T;
626 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
628 #ifdef ATH6K_CONFIG_CFG80211
629 static inline void *ar6k_priv(struct net_device *dev)
631 return (wdev_priv(dev->ieee80211_ptr));
634 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
635 static inline void *ar6k_priv(struct net_device *dev)
637 extern struct net_device *arApNetDev;
639 if (arApNetDev == dev) {
640 /* return arDev saved in virtual interface context */
641 AR_VIRTUAL_INTERFACE_T *arVirDev;
642 arVirDev = netdev_priv(dev);
643 return arVirDev->arDev;
645 return netdev_priv(dev);
649 #define ar6k_priv netdev_priv
650 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
651 #endif /* ATH6K_CONFIG_CFG80211 */
653 #define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) do { \
654 (pHciDev)->bus = (__bus); \
655 (pHciDev)->dev_type = (__type); \
658 #define GET_INODE_FROM_FILEP(filp) \
659 (filp)->f_path.dentry->d_inode
661 #define arAc2EndpointID(ar,ac) (ar)->arAc2EpMapping[(ac)]
662 #define arSetAc2EndpointIDMap(ar,ac,ep) \
663 { (ar)->arAc2EpMapping[(ac)] = (ep); \
664 (ar)->arEp2AcMapping[(ep)] = (ac); }
665 #define arEndpoint2Ac(ar,ep) (ar)->arEp2AcMapping[(ep)]
667 #define arRawIfEnabled(ar) (ar)->arRawIfInit
668 #define arRawStream2EndpointID(ar,raw) (ar)->arRawHtc->arRaw2EpMapping[(raw)]
669 #define arSetRawStream2EndpointIDMap(ar,raw,ep) \
670 { (ar)->arRawHtc->arRaw2EpMapping[(raw)] = (ep); \
671 (ar)->arRawHtc->arEp2RawMapping[(ep)] = (raw); }
672 #define arEndpoint2RawStreamID(ar,ep) (ar)->arRawHtc->arEp2RawMapping[(ep)]
674 struct ar_giwscan_param {
677 A_UINT32 bytes_needed;
678 struct iw_request_info *info;
681 #define AR6000_STAT_INC(ar, stat) (ar->arNetStats.stat++)
683 #define AR6000_SPIN_LOCK(lock, param) do { \
684 if (irqs_disabled()) { \
685 AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled:AR6000_LOCK\n")); \
687 spin_lock_bh(lock); \
690 #define AR6000_SPIN_UNLOCK(lock, param) do { \
691 if (irqs_disabled()) { \
692 AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled: AR6000_UNLOCK\n")); \
694 spin_unlock_bh(lock); \
697 int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
698 int ar6000_ioctl_dispatcher(struct net_device *dev, struct ifreq *rq, int cmd);
699 void ar6000_gpio_init(void);
700 void ar6000_init_profile_info(AR_SOFTC_T *ar);
701 void ar6000_install_static_wep_keys(AR_SOFTC_T *ar);
702 int ar6000_init(struct net_device *dev);
703 int ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar);
704 void ar6000_TxDataCleanup(AR_SOFTC_T *ar);
705 int ar6000_acl_data_tx(struct sk_buff *skb, struct net_device *dev);
706 void ar6000_restart_endpoint(struct net_device *dev);
707 void ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglogs);
709 #ifdef HTC_RAW_INTERFACE
715 int ar6000_htc_raw_open(AR_SOFTC_T *ar);
716 int ar6000_htc_raw_close(AR_SOFTC_T *ar);
717 ssize_t ar6000_htc_raw_read(AR_SOFTC_T *ar,
718 HTC_RAW_STREAM_ID StreamID,
719 char __user *buffer, size_t count);
720 ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar,
721 HTC_RAW_STREAM_ID StreamID,
722 char __user *buffer, size_t count);
724 #endif /* HTC_RAW_INTERFACE */
727 /*TODO: These routines should be moved to a file that is common across OS */
729 ieee80211_find_conn(AR_SOFTC_T *ar, A_UINT8 *node_addr);
732 ieee80211_find_conn_for_aid(AR_SOFTC_T *ar, A_UINT8 aid);
735 remove_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 reason);
739 #ifndef EXPORT_HCI_BRIDGE_INTERFACE
740 int ar6000_setup_hci(AR_SOFTC_T *ar);
741 void ar6000_cleanup_hci(AR_SOFTC_T *ar);
742 void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig);
744 /* HCI bridge testing */
745 int hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb);
748 ATH_DEBUG_DECLARE_EXTERN(htc);
749 ATH_DEBUG_DECLARE_EXTERN(wmi);
750 ATH_DEBUG_DECLARE_EXTERN(bmi);
751 ATH_DEBUG_DECLARE_EXTERN(hif);
752 ATH_DEBUG_DECLARE_EXTERN(wlan);
753 ATH_DEBUG_DECLARE_EXTERN(misc);
755 extern A_UINT8 bcast_mac[];
756 extern A_UINT8 null_mac[];
762 #endif /* _AR6000_H_ */