aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm4329/dhd.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/net/wireless/bcm4329/dhd.h
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'drivers/net/wireless/bcm4329/dhd.h')
-rw-r--r--drivers/net/wireless/bcm4329/dhd.h472
1 files changed, 472 insertions, 0 deletions
diff --git a/drivers/net/wireless/bcm4329/dhd.h b/drivers/net/wireless/bcm4329/dhd.h
new file mode 100644
index 00000000000..8f0910cfc46
--- /dev/null
+++ b/drivers/net/wireless/bcm4329/dhd.h
@@ -0,0 +1,472 @@
1/*
2 * Header file describing the internal (inter-module) DHD interfaces.
3 *
4 * Provides type definitions and function prototypes used to link the
5 * DHD OS, bus, and protocol modules.
6 *
7 * Copyright (C) 1999-2010, Broadcom Corporation
8 *
9 * Unless you and Broadcom execute a separate written software license
10 * agreement governing use of this software, this software is licensed to you
11 * under the terms of the GNU General Public License version 2 (the "GPL"),
12 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
13 * following added to such license:
14 *
15 * As a special exception, the copyright holders of this software give you
16 * permission to link this software with independent modules, and to copy and
17 * distribute the resulting executable under terms of your choice, provided that
18 * you also meet, for each linked independent module, the terms and conditions of
19 * the license of that module. An independent module is a module which is not
20 * derived from this software. The special exception does not apply to any
21 * modifications of the software.
22 *
23 * Notwithstanding the above, under no circumstances may you combine this
24 * software in any way with any other Broadcom software provided under a license
25 * other than the GPL, without Broadcom's express prior written consent.
26 *
27 * $Id: dhd.h,v 1.32.4.7.2.4.14.49.4.9 2011/01/14 22:40:45 Exp $
28 */
29
30/****************
31 * Common types *
32 */
33
34#ifndef _dhd_h_
35#define _dhd_h_
36
37#if defined(LINUX)
38#include <linux/init.h>
39#include <linux/kernel.h>
40#include <linux/slab.h>
41#include <linux/skbuff.h>
42#include <linux/netdevice.h>
43#include <linux/etherdevice.h>
44#include <linux/random.h>
45#include <linux/spinlock.h>
46#include <linux/ethtool.h>
47#include <linux/sched.h>
48#include <asm/uaccess.h>
49#include <asm/unaligned.h>
50
51#ifdef CONFIG_HAS_WAKELOCK
52#include <linux/wakelock.h>
53#endif
54
55/* The kernel threading is sdio-specific */
56#else /* LINUX */
57#define ENOMEM 1
58#define EFAULT 2
59#define EINVAL 3
60#define EIO 4
61#define ETIMEDOUT 5
62#define ERESTARTSYS 6
63#endif /* LINUX */
64
65#include <wlioctl.h>
66
67#ifdef DHD_DEBUG
68#ifndef DHD_DEBUG_TRAP
69#define DHD_DEBUG_TRAP
70#endif
71#endif
72
73/* Forward decls */
74struct dhd_bus;
75struct dhd_prot;
76struct dhd_info;
77
78/* The level of bus communication with the dongle */
79enum dhd_bus_state {
80 DHD_BUS_DOWN, /* Not ready for frame transfers */
81 DHD_BUS_LOAD, /* Download access only (CPU reset) */
82 DHD_BUS_DATA /* Ready for frame transfers */
83};
84
85enum dhd_bus_wake_state {
86 WAKE_LOCK_OFF,
87 WAKE_LOCK_PRIV,
88 WAKE_LOCK_DPC,
89 WAKE_LOCK_IOCTL,
90 WAKE_LOCK_DOWNLOAD,
91 WAKE_LOCK_TMOUT,
92 WAKE_LOCK_WATCHDOG,
93 WAKE_LOCK_LINK_DOWN_TMOUT,
94 WAKE_LOCK_PNO_FIND_TMOUT,
95 WAKE_LOCK_SOFTAP_SET,
96 WAKE_LOCK_SOFTAP_STOP,
97 WAKE_LOCK_SOFTAP_START,
98 WAKE_LOCK_SOFTAP_THREAD,
99 WAKE_LOCK_MAX
100};
101enum dhd_prealloc_index {
102 DHD_PREALLOC_PROT = 0,
103 DHD_PREALLOC_RXBUF,
104 DHD_PREALLOC_DATABUF,
105 DHD_PREALLOC_OSL_BUF
106};
107#ifdef DHD_USE_STATIC_BUF
108extern void * dhd_os_prealloc(int section, unsigned long size);
109#endif
110/* Common structure for module and instance linkage */
111typedef struct dhd_pub {
112 /* Linkage ponters */
113 osl_t *osh; /* OSL handle */
114 struct dhd_bus *bus; /* Bus module handle */
115 struct dhd_prot *prot; /* Protocol module handle */
116 struct dhd_info *info; /* Info module handle */
117
118 /* Internal dhd items */
119 bool up; /* Driver up/down (to OS) */
120 bool txoff; /* Transmit flow-controlled */
121 bool dongle_reset; /* TRUE = DEVRESET put dongle into reset */
122 enum dhd_bus_state busstate;
123 uint hdrlen; /* Total DHD header length (proto + bus) */
124 uint maxctl; /* Max size rxctl request from proto to bus */
125 uint rxsz; /* Rx buffer size bus module should use */
126 uint8 wme_dp; /* wme discard priority */
127
128 /* Dongle media info */
129 bool iswl; /* Dongle-resident driver is wl */
130 ulong drv_version; /* Version of dongle-resident driver */
131 struct ether_addr mac; /* MAC address obtained from dongle */
132 dngl_stats_t dstats; /* Stats for dongle-based data */
133
134 /* Additional stats for the bus level */
135 ulong tx_packets; /* Data packets sent to dongle */
136 ulong tx_multicast; /* Multicast data packets sent to dongle */
137 ulong tx_errors; /* Errors in sending data to dongle */
138 ulong tx_ctlpkts; /* Control packets sent to dongle */
139 ulong tx_ctlerrs; /* Errors sending control frames to dongle */
140 ulong rx_packets; /* Packets sent up the network interface */
141 ulong rx_multicast; /* Multicast packets sent up the network interface */
142 ulong rx_errors; /* Errors processing rx data packets */
143 ulong rx_ctlpkts; /* Control frames processed from dongle */
144 ulong rx_ctlerrs; /* Errors in processing rx control frames */
145 ulong rx_dropped; /* Packets dropped locally (no memory) */
146 ulong rx_flushed; /* Packets flushed due to unscheduled sendup thread */
147 ulong wd_dpc_sched; /* Number of times dhd dpc scheduled by watchdog timer */
148
149 ulong rx_readahead_cnt; /* Number of packets where header read-ahead was used. */
150 ulong tx_realloc; /* Number of tx packets we had to realloc for headroom */
151 ulong fc_packets; /* Number of flow control pkts recvd */
152
153 /* Last error return */
154 int bcmerror;
155 uint tickcnt;
156
157 /* Last error from dongle */
158 int dongle_error;
159
160 /* Suspend disable flag and "in suspend" flag */
161 int suspend_disable_flag; /* "1" to disable all extra powersaving during suspend */
162 int in_suspend; /* flag set to 1 when early suspend called */
163 int hang_was_sent; /* flag that message was send at least once */
164#ifdef PNO_SUPPORT
165 int pno_enable; /* pno status : "1" is pno enable */
166#endif /* PNO_SUPPORT */
167 int dtim_skip; /* dtim skip , default 0 means wake each dtim */
168
169 /* Pkt filter defination */
170 char * pktfilter[100];
171 int pktfilter_count;
172
173 wl_country_t dhd_cspec; /* Current Locale info */
174 char eventmask[WL_EVENTING_MASK_LEN];
175
176#ifdef CONFIG_HAS_WAKELOCK
177 struct wake_lock wow_wakelock;
178#endif
179} dhd_pub_t;
180
181#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
182
183 #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
184 #define _DHD_PM_RESUME_WAIT(a, b) do { \
185 int retry = 0; \
186 smp_mb(); \
187 while (dhd_mmc_suspend && retry++ != b) { \
188 wait_event_interruptible_timeout(a, FALSE, 3 * HZ); \
189 } \
190 } while (0)
191 #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 200)
192 #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)
193 #define DHD_PM_RESUME_RETURN_ERROR(a) do { if (dhd_mmc_suspend) return a; } while (0)
194 #define DHD_PM_RESUME_RETURN do { if (dhd_mmc_suspend) return; } while (0)
195
196 #define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
197 #define SPINWAIT_SLEEP(a, exp, us) do { \
198 uint countdown = (us) + 9999; \
199 while ((exp) && (countdown >= 10000)) { \
200 wait_event_interruptible_timeout(a, FALSE, HZ/100); \
201 countdown -= 10000; \
202 } \
203 } while (0)
204
205#else
206
207 #define DHD_PM_RESUME_WAIT_INIT(a)
208 #define DHD_PM_RESUME_WAIT(a)
209 #define DHD_PM_RESUME_WAIT_FOREVER(a)
210 #define DHD_PM_RESUME_RETURN_ERROR(a)
211 #define DHD_PM_RESUME_RETURN
212
213 #define DHD_SPINWAIT_SLEEP_INIT(a)
214 #define SPINWAIT_SLEEP(a, exp, us) do { \
215 uint countdown = (us) + 9; \
216 while ((exp) && (countdown >= 10)) { \
217 OSL_DELAY(10); \
218 countdown -= 10; \
219 } \
220 } while (0)
221
222#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
223
224#define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */
225
226inline static void NETIF_ADDR_LOCK(struct net_device *dev)
227{
228#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
229 netif_addr_lock_bh(dev);
230#endif
231}
232
233inline static void NETIF_ADDR_UNLOCK(struct net_device *dev)
234{
235#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
236 netif_addr_unlock_bh(dev);
237#endif
238}
239
240/* Wakelock Functions */
241extern int dhd_os_wake_lock(dhd_pub_t *pub);
242extern int dhd_os_wake_unlock(dhd_pub_t *pub);
243extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub);
244extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub);
245
246extern void dhd_os_start_lock(dhd_pub_t *pub);
247extern void dhd_os_start_unlock(dhd_pub_t *pub);
248extern unsigned long dhd_os_spin_lock(dhd_pub_t *pub);
249extern void dhd_os_spin_unlock(dhd_pub_t *pub, unsigned long flags);
250
251typedef struct dhd_if_event {
252 uint8 ifidx;
253 uint8 action;
254 uint8 flags;
255 uint8 bssidx;
256} dhd_if_event_t;
257
258/*
259 * Exported from dhd OS modules (dhd_linux/dhd_ndis)
260 */
261
262/* To allow osl_attach/detach calls from os-independent modules */
263osl_t *dhd_osl_attach(void *pdev, uint bustype);
264void dhd_osl_detach(osl_t *osh);
265
266/* Indication from bus module regarding presence/insertion of dongle.
267 * Return dhd_pub_t pointer, used as handle to OS module in later calls.
268 * Returned structure should have bus and prot pointers filled in.
269 * bus_hdrlen specifies required headroom for bus module header.
270 */
271extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen, void *dev);
272extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);
273
274/* Indication from bus module regarding removal/absence of dongle */
275extern void dhd_detach(dhd_pub_t *dhdp);
276
277/* Indication from bus module to change flow-control state */
278extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on);
279
280extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec);
281
282/* Receive frame for delivery to OS. Callee disposes of rxp. */
283extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *rxp, int numpkt);
284
285/* Return pointer to interface name */
286extern char *dhd_ifname(dhd_pub_t *dhdp, int idx);
287
288/* Request scheduling of the bus dpc */
289extern void dhd_sched_dpc(dhd_pub_t *dhdp);
290
291/* Notify tx completion */
292extern void dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success);
293
294/* Query ioctl */
295extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len);
296
297/* OS independent layer functions */
298extern int dhd_os_proto_block(dhd_pub_t * pub);
299extern int dhd_os_proto_unblock(dhd_pub_t * pub);
300extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition, bool * pending);
301extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub);
302extern unsigned int dhd_os_get_ioctl_resp_timeout(void);
303extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
304extern void * dhd_os_open_image(char * filename);
305extern int dhd_os_get_image_block(char * buf, int len, void * image);
306extern void dhd_os_close_image(void * image);
307extern void dhd_os_wd_timer(void *bus, uint wdtick);
308extern void dhd_os_sdlock(dhd_pub_t * pub);
309extern void dhd_os_sdunlock(dhd_pub_t * pub);
310extern void dhd_os_sdlock_txq(dhd_pub_t * pub);
311extern void dhd_os_sdunlock_txq(dhd_pub_t * pub);
312extern void dhd_os_sdlock_rxq(dhd_pub_t * pub);
313extern void dhd_os_sdunlock_rxq(dhd_pub_t * pub);
314extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t * pub);
315extern void dhd_customer_gpio_wlan_ctrl(int onoff);
316extern int dhd_custom_get_mac_address(unsigned char *buf);
317extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t * pub);
318extern void dhd_os_sdlock_eventq(dhd_pub_t * pub);
319extern void dhd_os_sdunlock_eventq(dhd_pub_t * pub);
320#ifdef DHD_DEBUG
321extern int write_to_file(dhd_pub_t *dhd, uint8 *buf, int size);
322#endif /* DHD_DEBUG */
323#if defined(OOB_INTR_ONLY)
324extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
325#endif /* defined(OOB_INTR_ONLY) */
326extern void dhd_os_sdtxlock(dhd_pub_t * pub);
327extern void dhd_os_sdtxunlock(dhd_pub_t * pub);
328
329int setScheduler(struct task_struct *p, int policy, struct sched_param *param);
330
331typedef struct {
332 uint32 limit; /* Expiration time (usec) */
333 uint32 increment; /* Current expiration increment (usec) */
334 uint32 elapsed; /* Current elapsed time (usec) */
335 uint32 tick; /* O/S tick time (usec) */
336} dhd_timeout_t;
337
338extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec);
339extern int dhd_timeout_expired(dhd_timeout_t *tmo);
340
341extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);
342extern uint8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx);
343extern int wl_host_event(struct dhd_info *dhd, int *idx, void *pktdata,
344 wl_event_msg_t *, void **data_ptr);
345extern void wl_event_to_host_order(wl_event_msg_t * evt);
346
347extern void dhd_common_init(void);
348
349extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle,
350 char *name, uint8 *mac_addr, uint32 flags, uint8 bssidx);
351extern void dhd_del_if(struct dhd_info *dhd, int ifidx);
352
353extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char * name);
354extern void dhd_vif_del(struct dhd_info *dhd, int ifidx);
355
356extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx);
357extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, uchar *cp, int len);
358
359
360/* Send packet to dongle via data channel */
361extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pkt);
362
363/* Send event to host */
364extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data);
365extern int dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag);
366extern uint dhd_bus_status(dhd_pub_t *dhdp);
367extern int dhd_bus_start(dhd_pub_t *dhdp);
368
369extern void print_buf(void *pbuf, int len, int bytes_per_line);
370
371
372typedef enum cust_gpio_modes {
373 WLAN_RESET_ON,
374 WLAN_RESET_OFF,
375 WLAN_POWER_ON,
376 WLAN_POWER_OFF
377} cust_gpio_modes_t;
378
379extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag);
380extern int wl_iw_send_priv_event(struct net_device *dev, char *flag);
381extern int net_os_send_hang_message(struct net_device *dev);
382
383/*
384 * Insmod parameters for debug/test
385 */
386
387/* Watchdog timer interval */
388extern uint dhd_watchdog_ms;
389
390#if defined(DHD_DEBUG)
391/* Console output poll interval */
392extern uint dhd_console_ms;
393#endif /* defined(DHD_DEBUG) */
394
395/* Use interrupts */
396extern uint dhd_intr;
397
398/* Use polling */
399extern uint dhd_poll;
400
401/* ARP offload agent mode */
402extern uint dhd_arp_mode;
403
404/* ARP offload enable */
405extern uint dhd_arp_enable;
406
407/* Pkt filte enable control */
408extern uint dhd_pkt_filter_enable;
409
410/* Pkt filter init setup */
411extern uint dhd_pkt_filter_init;
412
413/* Pkt filter mode control */
414extern uint dhd_master_mode;
415
416/* Roaming mode control */
417extern uint dhd_roam;
418
419/* Roaming mode control */
420extern uint dhd_radio_up;
421
422/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
423extern int dhd_idletime;
424#define DHD_IDLETIME_TICKS 1
425
426/* SDIO Drive Strength */
427extern uint dhd_sdiod_drive_strength;
428
429/* Override to force tx queueing all the time */
430extern uint dhd_force_tx_queueing;
431
432/* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */
433#define KEEP_ALIVE_PERIOD 55000
434#define NULL_PKT_STR "null_pkt"
435
436#ifdef SDTEST
437/* Echo packet generator (SDIO), pkts/s */
438extern uint dhd_pktgen;
439
440/* Echo packet len (0 => sawtooth, max 1800) */
441extern uint dhd_pktgen_len;
442#define MAX_PKTGEN_LEN 1800
443#endif
444
445
446/* optionally set by a module_param_string() */
447#define MOD_PARAM_PATHLEN 2048
448extern char fw_path[MOD_PARAM_PATHLEN];
449extern char nv_path[MOD_PARAM_PATHLEN];
450
451/* For supporting multiple interfaces */
452#define DHD_MAX_IFS 16
453#define DHD_DEL_IF -0xe
454#define DHD_BAD_IF -0xf
455
456
457extern void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar);
458extern void dhd_wait_event_wakeup(dhd_pub_t*dhd);
459
460/* dhd_commn arp offload wrapers */
461extern void dhd_arp_cleanup(dhd_pub_t *dhd);
462int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen);
463void dhd_arp_offload_add_ip(dhd_pub_t *dhd, u32 ipaddr);
464
465#define DHD_UNICAST_FILTER_NUM 0
466#define DHD_BROADCAST_FILTER_NUM 1
467#define DHD_MULTICAST4_FILTER_NUM 2
468#define DHD_MULTICAST6_FILTER_NUM 3
469extern int net_os_set_packet_filter(struct net_device *dev, int val);
470extern int net_os_rxfilter_add_remove(struct net_device *dev, int val, int num);
471
472#endif /* _dhd_h_ */