blob: e703d8bb94d6043dc6e491f2431be69ab27f944d [file] [log] [blame]
Henry Ptasinskia9533e72010-09-08 21:04:42 -07001/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _wl_mac80211_h_
18#define _wl_mac80211_h_
19
Henry Ptasinskia9533e72010-09-08 21:04:42 -070020/* BMAC Note: High-only driver is no longer working in softirq context as it needs to block and
21 * sleep so perimeter lock has to be a semaphore instead of spinlock. This requires timers to be
22 * submitted to workqueue instead of being on kernel timer
23 */
Arend van Spriel44bb83a2011-02-25 16:39:16 +010024struct wl_timer {
Henry Ptasinskia9533e72010-09-08 21:04:42 -070025 struct timer_list timer;
26 struct wl_info *wl;
27 void (*fn) (void *);
28 void *arg; /* argument to fn */
29 uint ms;
30 bool periodic;
31 bool set;
32 struct wl_timer *next;
33#ifdef BCMDBG
34 char *name; /* Description of the timer */
35#endif
Arend van Spriel44bb83a2011-02-25 16:39:16 +010036};
Henry Ptasinskia9533e72010-09-08 21:04:42 -070037
Henry Ptasinskia9533e72010-09-08 21:04:42 -070038struct wl_if {
39 uint subunit; /* WDS/BSS unit */
40 struct pci_dev *pci_dev;
41};
42
43#define WL_MAX_FW 4
44struct wl_firmware {
Greg Kroah-Hartman66cbd3a2010-10-08 11:05:47 -070045 u32 fw_cnt;
Henry Ptasinskia9533e72010-09-08 21:04:42 -070046 const struct firmware *fw_bin[WL_MAX_FW];
47 const struct firmware *fw_hdr[WL_MAX_FW];
Greg Kroah-Hartman66cbd3a2010-10-08 11:05:47 -070048 u32 hdr_num_entries[WL_MAX_FW];
Henry Ptasinskia9533e72010-09-08 21:04:42 -070049};
50
51struct wl_info {
Roland Vossen08db27d2010-12-07 17:45:46 +010052 struct wlc_pub *pub; /* pointer to public wlc state */
Henry Ptasinskia9533e72010-09-08 21:04:42 -070053 void *wlc; /* pointer to private common os-independent data */
Greg Kroah-Hartman66cbd3a2010-10-08 11:05:47 -070054 u32 magic;
Henry Ptasinskia9533e72010-09-08 21:04:42 -070055
56 int irq;
57
Henry Ptasinskia9533e72010-09-08 21:04:42 -070058 spinlock_t lock; /* per-device perimeter lock */
59 spinlock_t isr_lock; /* per-device ISR synchronization lock */
Henry Ptasinskia9533e72010-09-08 21:04:42 -070060 uint bcm_bustype; /* bus type */
61 bool piomode; /* set from insmod argument */
62 void *regsva; /* opaque chip registers virtual address */
63 atomic_t callbacks; /* # outstanding callback functions */
64 struct wl_timer *timers; /* timer cleanup queue */
65 struct tasklet_struct tasklet; /* dpc tasklet */
Henry Ptasinskia9533e72010-09-08 21:04:42 -070066 bool resched; /* dpc needs to be and is rescheduled */
67#ifdef LINUXSTA_PS
Greg Kroah-Hartman66cbd3a2010-10-08 11:05:47 -070068 u32 pci_psstate[16]; /* pci ps-state save/restore */
Henry Ptasinskia9533e72010-09-08 21:04:42 -070069#endif
Henry Ptasinskia9533e72010-09-08 21:04:42 -070070 struct wl_firmware fw;
Roland Vossen8c2c8212011-05-03 11:35:05 +020071 struct wiphy *wiphy;
Henry Ptasinskia9533e72010-09-08 21:04:42 -070072};
Henry Ptasinskia9533e72010-09-08 21:04:42 -070073
Henry Ptasinskia9533e72010-09-08 21:04:42 -070074#define WL_LOCK(wl) spin_lock_bh(&(wl)->lock)
75#define WL_UNLOCK(wl) spin_unlock_bh(&(wl)->lock)
76
77/* locking from inside wl_isr */
Jason Cooper914d69d2010-09-14 09:45:46 -040078#define WL_ISRLOCK(wl, flags) do {spin_lock(&(wl)->isr_lock); (void)(flags); } while (0)
79#define WL_ISRUNLOCK(wl, flags) do {spin_unlock(&(wl)->isr_lock); (void)(flags); } while (0)
Henry Ptasinskia9533e72010-09-08 21:04:42 -070080
81/* locking under WL_LOCK() to synchronize with wl_isr */
82#define INT_LOCK(wl, flags) spin_lock_irqsave(&(wl)->isr_lock, flags)
83#define INT_UNLOCK(wl, flags) spin_unlock_irqrestore(&(wl)->isr_lock, flags)
Henry Ptasinskia9533e72010-09-08 21:04:42 -070084
Henry Ptasinskia9533e72010-09-08 21:04:42 -070085#endif /* _wl_mac80211_h_ */