2 * Copyright (c) 2010 Broadcom Corporation
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.
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.
17 #ifndef _wl_mac80211_h_
18 #define _wl_mac80211_h_
20 #include <linux/interrupt.h>
22 /* BMAC Note: High-only driver is no longer working in softirq context as it needs to block and
23 * sleep so perimeter lock has to be a semaphore instead of spinlock. This requires timers to be
24 * submitted to workqueue instead of being on kernel timer
27 struct timer_list timer;
30 void *arg; /* argument to fn */
34 struct wl_timer *next;
36 char *name; /* Description of the timer */
41 uint subunit; /* WDS/BSS unit */
42 struct pci_dev *pci_dev;
48 const struct firmware *fw_bin[WL_MAX_FW];
49 const struct firmware *fw_hdr[WL_MAX_FW];
50 u32 hdr_num_entries[WL_MAX_FW];
54 struct wlc_pub *pub; /* pointer to public wlc state */
55 void *wlc; /* pointer to private common os-independent data */
60 spinlock_t lock; /* per-device perimeter lock */
61 spinlock_t isr_lock; /* per-device ISR synchronization lock */
62 uint bcm_bustype; /* bus type */
63 bool piomode; /* set from insmod argument */
64 void *regsva; /* opaque chip registers virtual address */
65 atomic_t callbacks; /* # outstanding callback functions */
66 struct wl_timer *timers; /* timer cleanup queue */
67 struct tasklet_struct tasklet; /* dpc tasklet */
68 bool resched; /* dpc needs to be and is rescheduled */
70 u32 pci_psstate[16]; /* pci ps-state save/restore */
72 struct wl_firmware fw;
76 #define WL_LOCK(wl) spin_lock_bh(&(wl)->lock)
77 #define WL_UNLOCK(wl) spin_unlock_bh(&(wl)->lock)
79 /* locking from inside wl_isr */
80 #define WL_ISRLOCK(wl, flags) do {spin_lock(&(wl)->isr_lock); (void)(flags); } while (0)
81 #define WL_ISRUNLOCK(wl, flags) do {spin_unlock(&(wl)->isr_lock); (void)(flags); } while (0)
83 /* locking under WL_LOCK() to synchronize with wl_isr */
84 #define INT_LOCK(wl, flags) spin_lock_irqsave(&(wl)->isr_lock, flags)
85 #define INT_UNLOCK(wl, flags) spin_unlock_irqrestore(&(wl)->isr_lock, flags)
87 #endif /* _wl_mac80211_h_ */