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
, u32
*address
, u32
*data
);
125 int ar6000_WriteRegDiag(HIF_DEVICE
*hifDevice
, u32
*address
, u32
*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 struct 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 u8 key
[WLAN_MAX_KEY_LEN
];
392 u8 seq
[IW_ENCODE_SEQ_MAX_SIZE
];
402 #endif /* ATH6K_CONFIG_CFG80211 */
405 struct ar_node_mapping
{
412 unsigned long arc_bp
[2]; /* Must be first field */
413 struct htc_packet HtcPkt
; /* HTC packet wrapper */
414 struct ar_cookie
*arc_list_next
;
417 struct ar_hb_chlng_resp
{
426 /* Per STA data, used in AP mode */
427 /*TODO: All this should move to OS independent dir */
429 #define STA_PWR_MGMT_MASK 0x1
430 #define STA_PWR_MGMT_SHIFT 0x0
431 #define STA_PWR_MGMT_AWAKE 0x0
432 #define STA_PWR_MGMT_SLEEP 0x1
434 #define STA_SET_PWR_SLEEP(sta) (sta->flags |= (STA_PWR_MGMT_MASK << STA_PWR_MGMT_SHIFT))
435 #define STA_CLR_PWR_SLEEP(sta) (sta->flags &= ~(STA_PWR_MGMT_MASK << STA_PWR_MGMT_SHIFT))
436 #define STA_IS_PWR_SLEEP(sta) ((sta->flags >> STA_PWR_MGMT_SHIFT) & STA_PWR_MGMT_MASK)
438 #define STA_PS_POLLED_MASK 0x1
439 #define STA_PS_POLLED_SHIFT 0x1
440 #define STA_SET_PS_POLLED(sta) (sta->flags |= (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
441 #define STA_CLR_PS_POLLED(sta) (sta->flags &= ~(STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
442 #define STA_IS_PS_POLLED(sta) (sta->flags & (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
451 u8 wpa_ie
[IEEE80211_MAX_IE
];
452 A_NETBUF_QUEUE_T psq
; /* power save q */
456 typedef struct ar6_raw_htc
{
457 HTC_ENDPOINT_ID arRaw2EpMapping
[HTC_RAW_STREAM_NUM_MAX
];
458 HTC_RAW_STREAM_ID arEp2RawMapping
[ENDPOINT_MAX
];
459 struct semaphore raw_htc_read_sem
[HTC_RAW_STREAM_NUM_MAX
];
460 struct semaphore raw_htc_write_sem
[HTC_RAW_STREAM_NUM_MAX
];
461 wait_queue_head_t raw_htc_read_queue
[HTC_RAW_STREAM_NUM_MAX
];
462 wait_queue_head_t raw_htc_write_queue
[HTC_RAW_STREAM_NUM_MAX
];
463 raw_htc_buffer raw_htc_read_buffer
[HTC_RAW_STREAM_NUM_MAX
][RAW_HTC_READ_BUFFERS_NUM
];
464 raw_htc_buffer raw_htc_write_buffer
[HTC_RAW_STREAM_NUM_MAX
][RAW_HTC_WRITE_BUFFERS_NUM
];
465 bool write_buffer_available
[HTC_RAW_STREAM_NUM_MAX
];
466 bool read_buffer_available
[HTC_RAW_STREAM_NUM_MAX
];
470 struct net_device
*arNetDev
; /* net_device pointer */
472 int arTxPending
[ENDPOINT_MAX
];
473 int arTotalTxDataPending
;
478 HTC_HANDLE arHtcTarget
;
481 struct semaphore arSem
;
489 u8 arPairwiseCryptoLen
;
493 struct ar_wep_key arWepKeyList
[WMI_MAX_KEY_INDEX
+ 1];
498 u16 arListenIntervalB
;
499 u16 arListenIntervalT
;
500 struct ar6000_version arVersion
;
506 struct net_device_stats arNetStats
;
507 struct iw_statistics arIwStats
;
509 u16 arChannelList
[32];
511 bool statsUpdatePending
;
512 TARGET_STATS arTargetStats
;
515 #ifdef CONFIG_HOST_TCMD_SUPPORT
523 u16 tcmdRateCnt
[TCMD_MAX_RATES
];
524 u16 tcmdRateCntShortGuard
[TCMD_MAX_RATES
];
526 AR6000_WLAN_STATE arWlanState
;
527 struct ar_node_mapping arNodeMap
[MAX_NODE_NUM
];
531 struct ar_cookie
*arCookieList
;
535 u16 arBeaconInterval
;
536 bool arConnectPending
;
538 struct ar_hb_chlng_resp arHBChallengeResp
;
539 u8 arKeepaliveConfigured
;
541 HTC_ENDPOINT_ID arAc2EpMapping
[WMM_NUM_AC
];
542 bool arAcStreamActive
[WMM_NUM_AC
];
543 u8 arAcStreamPriMap
[WMM_NUM_AC
];
544 u8 arHiAcStreamActivePri
;
545 u8 arEp2AcMapping
[ENDPOINT_MAX
];
546 HTC_ENDPOINT_ID arControlEp
;
547 #ifdef HTC_RAW_INTERFACE
548 AR_RAW_HTC_T
*arRawHtc
;
550 bool arNetQueueStopped
;
553 struct common_credit_state_info arCreditStateInfo
;
554 bool arWMIControlEpFull
;
555 bool dbgLogFetchInProgress
;
556 u8 log_buffer
[DBGLOG_HOST_LOG_BUFFER_SIZE
];
558 u32 dbglog_init_done
;
559 u32 arConnectCtrlFlags
;
561 s32 user_savedkeys_stat
;
563 struct USER_SAVEDKEYS user_saved_keys
;
565 USER_RSSI_THOLD rssi_map
[12];
567 u16 ap_profile_flag
; /* AP mode */
568 WMI_AP_ACL g_acl
; /* AP mode */
569 sta_t sta_list
[AP_MAX_NUM_STA
]; /* AP mode */
570 u8 sta_list_index
; /* AP mode */
571 struct ieee80211req_key ap_mode_bkey
; /* AP mode */
572 A_NETBUF_QUEUE_T mcastpsq
; /* power save q for Mcast frames */
573 A_MUTEX_T mcastpsqLock
;
574 bool DTIMExpired
; /* flag to indicate DTIM expired */
575 u8 intra_bss
; /* enable/disable intra bss data forward */
577 #ifndef EXPORT_HCI_BRIDGE_INTERFACE
581 WMI_AP_MODE_STAT arAPStats
;
583 u8 ap_country_code
[3];
586 u16 ap_beacon_interval
;
588 u16 arACS
; /* AP mode - Auto Channel Selection */
589 struct htc_packet_queue amsdu_rx_buffer_queue
;
590 bool bIsDestroyProgress
; /* flag to indicate ar6k destroy is in progress */
591 A_TIMER disconnect_timer
;
596 WMI_BTCOEX_CONFIG_EVENT arBtcoexConfig
;
597 WMI_BTCOEX_STATS_EVENT arBtcoexStats
;
598 s32 (*exitCallback
)(void *config
); /* generic callback at AR6K exit */
599 struct hif_device_os_device_info osDevInfo
;
600 #ifdef ATH6K_CONFIG_CFG80211
601 struct wireless_dev
*wdev
;
602 struct cfg80211_scan_request
*scan_request
;
603 struct ar_key keys
[WMI_MAX_KEY_INDEX
+ 1];
605 #endif /* ATH6K_CONFIG_CFG80211 */
606 u16 arWlanPowerState
;
617 WMI_SCAN_PARAMS_CMD scParams
;
618 #define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
619 u8 mcast_filters
[MAC_MAX_FILTERS_PER_LIST
][AR_MCAST_FILTER_MAC_ADDR_SIZE
];
621 bool scanSpecificSsid
;
622 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
627 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
628 struct ar_virtual_interface
{
629 struct net_device
*arNetDev
; /* net_device pointer */
630 struct ar6_softc
*arDev
; /* ar device pointer */
631 struct net_device
*arStaNetDev
; /* net_device pointer */
633 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
635 #ifdef ATH6K_CONFIG_CFG80211
636 static inline void *ar6k_priv(struct net_device
*dev
)
638 return (wdev_priv(dev
->ieee80211_ptr
));
641 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
642 static inline void *ar6k_priv(struct net_device
*dev
)
644 extern struct net_device
*arApNetDev
;
646 if (arApNetDev
== dev
) {
647 /* return arDev saved in virtual interface context */
648 struct ar_virtual_interface
*arVirDev
;
649 arVirDev
= netdev_priv(dev
);
650 return arVirDev
->arDev
;
652 return netdev_priv(dev
);
656 #define ar6k_priv netdev_priv
657 #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
658 #endif /* ATH6K_CONFIG_CFG80211 */
660 #define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) do { \
661 (pHciDev)->bus = (__bus); \
662 (pHciDev)->dev_type = (__type); \
665 #define GET_INODE_FROM_FILEP(filp) \
666 (filp)->f_path.dentry->d_inode
668 #define arAc2EndpointID(ar,ac) (ar)->arAc2EpMapping[(ac)]
669 #define arSetAc2EndpointIDMap(ar,ac,ep) \
670 { (ar)->arAc2EpMapping[(ac)] = (ep); \
671 (ar)->arEp2AcMapping[(ep)] = (ac); }
672 #define arEndpoint2Ac(ar,ep) (ar)->arEp2AcMapping[(ep)]
674 #define arRawIfEnabled(ar) (ar)->arRawIfInit
675 #define arRawStream2EndpointID(ar,raw) (ar)->arRawHtc->arRaw2EpMapping[(raw)]
676 #define arSetRawStream2EndpointIDMap(ar,raw,ep) \
677 { (ar)->arRawHtc->arRaw2EpMapping[(raw)] = (ep); \
678 (ar)->arRawHtc->arEp2RawMapping[(ep)] = (raw); }
679 #define arEndpoint2RawStreamID(ar,ep) (ar)->arRawHtc->arEp2RawMapping[(ep)]
681 struct ar_giwscan_param
{
685 struct iw_request_info
*info
;
688 #define AR6000_STAT_INC(ar, stat) (ar->arNetStats.stat++)
690 #define AR6000_SPIN_LOCK(lock, param) do { \
691 if (irqs_disabled()) { \
692 AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled:AR6000_LOCK\n")); \
694 spin_lock_bh(lock); \
697 #define AR6000_SPIN_UNLOCK(lock, param) do { \
698 if (irqs_disabled()) { \
699 AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled: AR6000_UNLOCK\n")); \
701 spin_unlock_bh(lock); \
704 int ar6000_ioctl(struct net_device
*dev
, struct ifreq
*rq
, int cmd
);
705 int ar6000_ioctl_dispatcher(struct net_device
*dev
, struct ifreq
*rq
, int cmd
);
706 void ar6000_gpio_init(void);
707 void ar6000_init_profile_info(struct ar6_softc
*ar
);
708 void ar6000_install_static_wep_keys(struct ar6_softc
*ar
);
709 int ar6000_init(struct net_device
*dev
);
710 int ar6000_dbglog_get_debug_logs(struct ar6_softc
*ar
);
711 void ar6000_TxDataCleanup(struct ar6_softc
*ar
);
712 int ar6000_acl_data_tx(struct sk_buff
*skb
, struct net_device
*dev
);
713 void ar6000_restart_endpoint(struct net_device
*dev
);
714 void ar6000_stop_endpoint(struct net_device
*dev
, bool keepprofile
, bool getdbglogs
);
716 #ifdef HTC_RAW_INTERFACE
722 int ar6000_htc_raw_open(struct ar6_softc
*ar
);
723 int ar6000_htc_raw_close(struct ar6_softc
*ar
);
724 ssize_t
ar6000_htc_raw_read(struct ar6_softc
*ar
,
725 HTC_RAW_STREAM_ID StreamID
,
726 char __user
*buffer
, size_t count
);
727 ssize_t
ar6000_htc_raw_write(struct ar6_softc
*ar
,
728 HTC_RAW_STREAM_ID StreamID
,
729 char __user
*buffer
, size_t count
);
731 #endif /* HTC_RAW_INTERFACE */
734 /*TODO: These routines should be moved to a file that is common across OS */
736 ieee80211_find_conn(struct ar6_softc
*ar
, u8
*node_addr
);
739 ieee80211_find_conn_for_aid(struct ar6_softc
*ar
, u8 aid
);
741 u8
remove_sta(struct ar6_softc
*ar
, u8
*mac
, u16 reason
);
745 #ifndef EXPORT_HCI_BRIDGE_INTERFACE
746 int ar6000_setup_hci(struct ar6_softc
*ar
);
747 void ar6000_cleanup_hci(struct ar6_softc
*ar
);
748 void ar6000_set_default_ar3kconfig(struct ar6_softc
*ar
, void *ar3kconfig
);
750 /* HCI bridge testing */
751 int hci_test_send(struct ar6_softc
*ar
, struct sk_buff
*skb
);
754 ATH_DEBUG_DECLARE_EXTERN(htc
);
755 ATH_DEBUG_DECLARE_EXTERN(wmi
);
756 ATH_DEBUG_DECLARE_EXTERN(bmi
);
757 ATH_DEBUG_DECLARE_EXTERN(hif
);
758 ATH_DEBUG_DECLARE_EXTERN(wlan
);
759 ATH_DEBUG_DECLARE_EXTERN(misc
);
761 extern u8 bcast_mac
[];
762 extern u8 null_mac
[];
768 #endif /* _AR6000_H_ */