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.
20 #include <brcmu_wifi.h>
24 #define BRCMS_NUMRATES 16 /* max # of rates in a rateset */
25 #define MAXMULTILIST 32 /* max # multicast addresses */
26 #define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */
29 #define PHY_TYPE_A 0 /* Phy type A */
30 #define PHY_TYPE_G 2 /* Phy type G */
31 #define PHY_TYPE_N 4 /* Phy type N */
32 #define PHY_TYPE_LP 5 /* Phy type Low Power A/B/G */
33 #define PHY_TYPE_SSN 6 /* Phy type Single Stream N */
34 #define PHY_TYPE_LCN 8 /* Phy type Single Stream N */
35 #define PHY_TYPE_LCNXN 9 /* Phy type 2-stream N */
36 #define PHY_TYPE_HT 7 /* Phy type 3-Stream N */
39 #define BRCMS_10_MHZ 10 /* 10Mhz nphy channel bandwidth */
40 #define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */
41 #define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */
43 #define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? BRCMS_40_MHZ : \
44 CHSPEC_IS20(chanspec) ? BRCMS_20_MHZ : \
47 #define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
48 #define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
49 #define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
50 #define BRCMS_RSSI_LOW -70 /* Low quality cutoffs */
51 #define BRCMS_RSSI_GOOD -68 /* Good quality cutoffs */
52 #define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
53 #define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
55 /* macro to perform PHY -> D11 PHY TYPE, currently 1:1 */
56 #define BRCMS_PHYTYPE(_x) (_x)
58 #define MA_WINDOW_SZ 8 /* moving average window size */
60 #define BRCMS_SNR_INVALID 0 /* invalid SNR value */
62 /* a large TX Power as an init value to factor out of min() calculations,
63 * keep low enough to fit in an s8, units are .25 dBm
65 #define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */
67 /* rate related definitions */
68 #define BRCMS_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */
69 #define BRCMS_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */
71 /* legacy rx Antenna diversity for SISO rates */
72 #define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */
73 #define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */
74 #define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */
75 #define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */
76 #define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */
77 /* default antdiv setting */
78 #define ANT_RX_DIV_DEF ANT_RX_DIV_START_0
80 /* legacy rx Antenna diversity for SISO rates */
81 /* Tx on antenna 0, "legacy term Main" */
82 #define ANT_TX_FORCE_0 0
83 /* Tx on antenna 1, "legacy term Aux" */
84 #define ANT_TX_FORCE_1 1
85 /* Tx on phy's last good Rx antenna */
86 #define ANT_TX_LAST_RX 3
87 /* driver's default tx antenna setting */
90 /* use all available core for transmit */
91 #define TXCORE_POLICY_ALL 0x1
94 /* def bitmap of txchain */
95 #define TXCHAIN_DEF 0x1
96 /* default bitmap of tx chains for nphy */
97 #define TXCHAIN_DEF_NPHY 0x3
98 /* default bitmap of tx chains for nphy */
99 #define TXCHAIN_DEF_HTPHY 0x7
100 /* def bitmap of rxchain */
101 #define RXCHAIN_DEF 0x1
102 /* default bitmap of rx chains for nphy */
103 #define RXCHAIN_DEF_NPHY 0x3
104 /* default bitmap of rx chains for nphy */
105 #define RXCHAIN_DEF_HTPHY 0x7
106 /* no antenna switch */
107 #define ANTSWITCH_NONE 0
108 /* antenna switch on 4321CB2, 2of3 */
109 #define ANTSWITCH_TYPE_1 1
110 /* antenna switch on 4321MPCI, 2of3 */
111 #define ANTSWITCH_TYPE_2 2
112 /* antenna switch on 4322, 2of3 */
113 #define ANTSWITCH_TYPE_3 3
115 #define RXBUFSZ PKTBUFSZ
117 /* aid bitmap size in bytes */
118 #define AIDMAPSZ (roundup(MAXSCB, NBBY)/NBBY)
119 #endif /* AIDMAPSZ */
121 #define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */
123 #define WL_SPURAVOID_OFF 0
124 #define WL_SPURAVOID_ON1 1
125 #define WL_SPURAVOID_ON2 2
127 struct brcms_tunables
{
128 int ntxd
; /* size of tx descriptor table */
129 int nrxd
; /* size of rx descriptor table */
130 int rxbufsz
; /* size of rx buffers to post */
131 int nrxbufpost
; /* # of rx buffers to post */
132 int maxscb
; /* # of SCBs supported */
133 int ampdunummpdu
; /* max number of mpdu in an ampdu */
134 int maxpktcb
; /* max # of packet callbacks */
135 int maxucodebss
;/* max # of BSS handled in ucode bcn/prb */
136 int maxucodebss4
; /* max # of BSS handled in sw bcn/prb */
137 int maxbss
; /* max # of bss info elements in scan list */
138 int datahiwat
; /* data msg txq hiwat mark */
139 int ampdudatahiwat
; /* AMPDU msg txq hiwat mark */
140 int rxbnd
; /* max # rx bufs to process before deferring to dpc */
141 int txsbnd
; /* max # tx status to process in wlc_txstatus() */
142 int memreserved
;/* memory reserved for BMAC's USB dma rx */
145 struct brcms_c_rateset
{
146 uint count
; /* number of rates in rates[] */
147 /* rates in 500kbps units w/hi bit set if basic */
148 u8 rates
[BRCMS_NUMRATES
];
149 u8 htphy_membership
; /* HT PHY Membership */
150 u8 mcs
[MCSSET_LEN
]; /* supported mcs index bit map */
154 u8 flags
; /* misc booleans (e.g., supported) */
155 u8 multicast
; /* multicast cipher */
156 u8 ucount
; /* count of unicast ciphers */
157 u8 unicast
[4]; /* unicast ciphers */
158 u8 acount
; /* count of auth modes */
159 u8 auth
[4]; /* Authentication modes */
160 u8 PAD
[4]; /* padding for future growth */
164 * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
166 #define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)
168 #define RSN_FLAGS_SUPPORTED 0x1 /* Flag for rsn_params */
169 #define RSN_FLAGS_PREAUTH 0x2 /* Flag for WPA2 rsn_params */
171 /* All the HT-specific default advertised capabilities (including AMPDU)
172 * should be grouped here at one place
174 #define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */
176 /* defaults for the HT (MIMO) bss */
177 #define HT_CAP (IEEE80211_HT_CAP_SM_PS |\
178 IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\
179 IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40)
181 /* wlc internal bss_info */
182 struct brcms_bss_info
{
183 u8 BSSID
[ETH_ALEN
]; /* network BSSID */
184 u16 flags
; /* flags for internal attributes */
185 u8 SSID_len
; /* the length of SSID */
186 u8 SSID
[32]; /* SSID string */
187 s16 RSSI
; /* receive signal strength (in dBm) */
188 s16 SNR
; /* receive signal SNR in dB */
189 u16 beacon_period
; /* units are Kusec */
190 u16 atim_window
; /* units are Kusec */
191 u16 chanspec
; /* Channel num, bw, ctrl_sb and band */
192 s8 infra
; /* 0=IBSS, 1=infrastructure, 2=unknown */
193 struct brcms_c_rateset rateset
; /* supported rates */
194 u8 dtim_period
; /* DTIM period */
195 s8 phy_noise
; /* noise right after tx (in dBm) */
196 u16 capability
; /* Capability information */
197 u8 wme_qosinfo
; /* QoS Info from WME IE; valid if BSS_WME flag set */
198 struct rsn_parms wpa
;
199 struct rsn_parms wpa2
;
200 u16 qbss_load_aac
; /* qbss load available admission capacity */
201 /* qbss_load_chan_free <- (0xff - chan utilization of qbss_load_ie_t) */
202 u8 qbss_load_chan_free
; /* indicates how free the channel is */
203 u8 mcipher
; /* multicast cipher */
204 u8 wpacfg
; /* wpa config index */
207 /* IOVar flags for common error checks */
208 #define IOVF_MFG (1<<3) /* flag for mfgtest iovars */
209 #define IOVF_WHL (1<<4) /* value must be whole (0-max) */
210 #define IOVF_NTRL (1<<5) /* value must be natural (1-max) */
212 #define IOVF_SET_UP (1<<6) /* set requires driver be up */
213 #define IOVF_SET_DOWN (1<<7) /* set requires driver be down */
214 #define IOVF_SET_CLK (1<<8) /* set requires core clock */
215 #define IOVF_SET_BAND (1<<9) /* set requires fixed band */
217 #define IOVF_GET_UP (1<<10) /* get requires driver be up */
218 #define IOVF_GET_DOWN (1<<11) /* get requires driver be down */
219 #define IOVF_GET_CLK (1<<12) /* get requires core clock */
220 #define IOVF_GET_BAND (1<<13) /* get requires fixed band */
221 #define IOVF_OPEN_ALLOW (1<<14) /* set allowed iovar for opensrc */
223 #define MAC80211_PROMISC_BCNS (1 << 0)
224 #define MAC80211_SCAN (1 << 1)
227 * Public portion of common driver state structure.
228 * The wlc handle points at this.
231 struct brcms_c_info
*wlc
;
232 struct ieee80211_hw
*ieee_hw
;
233 struct scb
*global_scb
;
234 struct scb_ampdu
*global_ampdu
;
236 uint unit
; /* device instance number */
237 uint corerev
; /* core revision */
238 struct si_pub
*sih
; /* SI handle (cookie for siutils calls) */
239 char *vars
; /* "environment" name=value */
240 bool up
; /* interface up and running */
241 bool hw_off
; /* HW is off */
242 /* tunables: ntxd, nrxd, maxscb, etc. */
243 struct brcms_tunables
*tunables
;
244 bool hw_up
; /* one time hw up/down */
245 bool _piomode
; /* true if pio mode */
246 uint _nbands
; /* # bands supported */
247 uint now
; /* # elapsed seconds */
249 bool promisc
; /* promiscuous destination address */
250 bool delayed_down
; /* down delayed */
251 bool _ap
; /* AP mode enabled */
252 bool _apsta
; /* simultaneous AP/STA mode enabled */
253 bool _assoc_recreate
; /* association recreation on up transitions */
254 int _wme
; /* WME QoS mode */
255 u8 _mbss
; /* MBSS mode on */
256 bool allmulti
; /* enable all multicasts */
257 bool associated
; /* true:part of [I]BSS, false: not */
258 /* (union of stas_associated, aps_associated) */
259 bool phytest_on
; /* whether a PHY test is running */
260 bool bf_preempt_4306
; /* True to enable 'darwin' mode */
261 bool _ampdu
; /* ampdu enabled or not */
262 bool _cac
; /* 802.11e CAC enabled */
263 u8 _n_enab
; /* bitmap of 11N + HT support */
264 bool _n_reqd
; /* N support required for clients */
266 s8 _coex
; /* 20/40 MHz BSS Management AUTO, ENAB, DISABLE */
267 bool _priofc
; /* Priority-based flowcontrol */
269 u8 cur_etheraddr
[ETH_ALEN
]; /* our local ethernet address */
271 u8
*multicast
; /* ptr to list of multicast addresses */
272 uint nmulticast
; /* # enabled multicast addresses */
274 u32 wlfeatureflag
; /* Flags to control sw features from registry */
275 int psq_pkts_total
; /* total num of ps pkts */
277 u16 txmaxpkts
; /* max number of large pkts allowed to be pending */
279 /* s/w decryption counters */
280 u32 swdecrypt
; /* s/w decrypt attempts */
282 int bcmerror
; /* last bcm error */
284 u32 radio_disabled
; /* bit vector for radio disabled reasons */
285 bool radio_active
; /* radio on/off state */
286 u16 roam_time_thresh
; /* Max. # secs. of not hearing beacons
289 bool align_wd_tbtt
; /* Align watchdog with tbtt indication
290 * handling. This flag is cleared by default
291 * and is set by per port code explicitly and
292 * you need to make sure the OSL_SYSUPTIME()
293 * is implemented properly in osl of that port
294 * when it enables this Power Save feature.
297 u16 boardrev
; /* version # of particular board */
298 u8 sromrev
; /* version # of the srom */
299 char srom_ccode
[BRCM_CNTRY_BUF_SZ
]; /* Country Code in SROM */
300 u32 boardflags
; /* Board specific flags from srom */
301 u32 boardflags2
; /* More board flags if sromrev >= 4 */
302 bool tempsense_disable
; /* disable periodic tempsense check */
303 bool phy_11ncapable
; /* the PHY/HW is capable of 802.11N */
304 bool _ampdumac
; /* mac assist ampdu enabled or not */
306 struct wl_cnt
*_cnt
; /* low-level counters in driver */
309 /* wl_monitor rx status per packet */
311 uint pkterror
; /* error flags per pkt */
312 uint phytype
; /* 802.11 A/B/G ... */
313 uint channel
; /* channel */
314 uint datarate
; /* rate in 500kbps */
315 uint antenna
; /* antenna pkts received on */
316 uint pktlength
; /* pkt length minus bcm phy hdr */
317 u32 mactime
; /* time stamp from mac, count per 1us */
318 uint sq
; /* signal quality */
319 s32 signal
; /* in dbm */
320 s32 noise
; /* in dbm */
321 uint preamble
; /* Unknown, short, long */
322 uint encoding
; /* Unknown, CCK, PBCC, OFDM */
323 uint nfrmtype
; /* special 802.11n frames(AMPDU, AMSDU) */
324 struct brcms_if
*wlif
; /* wl interface */
331 IOV_BCN_LI_BCN
/* Beacon listen interval in # of beacons */
334 /***********************************************
335 * Feature-related macros to optimize out code *
336 * *********************************************
339 /* AP Support (versus STA) */
340 #define AP_ENAB(pub) (0)
342 /* Macro to check if APSTA mode enabled */
343 #define APSTA_ENAB(pub) (0)
345 /* Some useful combinations */
346 #define STA_ONLY(pub) (!AP_ENAB(pub))
347 #define AP_ONLY(pub) (AP_ENAB(pub) && !APSTA_ENAB(pub))
349 #define ENAB_1x1 0x01
350 #define ENAB_2x2 0x02
351 #define ENAB_3x3 0x04
352 #define ENAB_4x4 0x08
353 #define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
354 #define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
356 #if ((defined(NCONF) && (NCONF != 0)) || \
357 (defined(LCNCONF) && (LCNCONF != 0)) || \
358 (defined(HTCONF) && (HTCONF != 0)) || \
359 (defined(SSLPNCONF) && (SSLPNCONF != 0)))
360 #define N_ENAB(pub) ((pub)->_n_enab & SUPPORT_11N)
361 #define N_REQD(pub) ((pub)->_n_reqd)
363 #define N_ENAB(pub) 0
364 #define N_REQD(pub) 0
367 #if (defined(HTCONF) && (HTCONF != 0))
368 #define HT_ENAB(pub) (((pub)->_n_enab & SUPPORT_HT) == SUPPORT_HT)
370 #define HT_ENAB(pub) 0
373 #define AMPDU_AGG_HOST 1
374 #define AMPDU_ENAB(pub) ((pub)->_ampdu)
376 #define EDCF_ENAB(pub) (WME_ENAB(pub))
377 #define QOS_ENAB(pub) (WME_ENAB(pub) || N_ENAB(pub))
379 #define MONITOR_ENAB(wlc) ((wlc)->monitor)
381 #define PROMISC_ENAB(wlc) ((wlc)->promisc)
383 #define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
385 /* pri is priority encoded in the packet. This maps the Packet priority to
386 * enqueue precedence as defined in wlc_prec_map
388 extern const u8 wlc_prio2prec_map
[];
389 #define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]
392 * This maps priority to one precedence higher - Used by PS-Poll response
393 * packets to simulate enqueue-at-head operation, but still maintain the
396 #define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
397 BRCMS_PREC_COUNT - 1)
399 extern const u8 wme_fifo2ac
[];
400 #define WME_PRIO2AC(prio) wme_fifo2ac[prio2fifo[(prio)]]
402 /* Mask to describe all precedence levels */
403 #define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
405 /* Define a bitmap of precedences comprised by each AC */
406 #define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \
407 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
408 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \
409 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE)))
410 #define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \
411 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \
412 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \
413 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE)))
414 #define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \
415 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \
416 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \
417 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI)))
418 #define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \
419 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \
420 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \
421 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC)))
424 #define WME_ENAB(pub) ((pub)->_wme != OFF)
425 #define WME_AUTO(wlc) ((wlc)->pub->_wme == AUTO)
427 /* invalid core flags, use the saved coreflags */
428 #define BRCMS_USE_COREFLAGS 0xffffffff
431 /* network protection config */
432 #define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
433 #define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
434 #define BRCMS_PROT_G_USER 3 /* gmode specified by user */
435 #define BRCMS_PROT_OVERLAP 4 /* overlap */
436 #define BRCMS_PROT_N_USER 10 /* nmode specified by user */
437 #define BRCMS_PROT_N_CFG 11 /* n protection */
438 #define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */
439 #define BRCMS_PROT_N_NONGF 13 /* non-GF protection */
440 #define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */
441 #define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */
442 #define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */
445 * 54g modes (basic bits may still be overridden)
448 * Rateset: 1b, 2b, 5.5, 11
452 * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
453 * Extended Rateset: 6, 9, 12, 48
457 * Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
458 * Extended Rateset: 6b, 9, 12b, 48
459 * Preamble: Short required
462 * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
463 * Extended Rateset: 6, 9, 12, 48
467 * Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
468 * Preamble: Short required
469 * Shortslot: On and required
471 * Rateset: 1b, 2b, 5.5b, 11b
472 * Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
476 #define GMODE_LEGACY_B 0
479 #define GMODE_B_DEFERRED 3
480 #define GMODE_PERFORMANCE 4
484 /* values for PLCPHdr_override */
485 #define BRCMS_PLCP_AUTO -1
486 #define BRCMS_PLCP_SHORT 0
487 #define BRCMS_PLCP_LONG 1
489 /* values for g_protection_override and n_protection_override */
490 #define BRCMS_PROTECTION_AUTO -1
491 #define BRCMS_PROTECTION_OFF 0
492 #define BRCMS_PROTECTION_ON 1
493 #define BRCMS_PROTECTION_MMHDR_ONLY 2
494 #define BRCMS_PROTECTION_CTS_ONLY 3
496 /* values for g_protection_control and n_protection_control */
497 #define BRCMS_PROTECTION_CTL_OFF 0
498 #define BRCMS_PROTECTION_CTL_LOCAL 1
499 #define BRCMS_PROTECTION_CTL_OVERLAP 2
501 /* values for n_protection */
502 #define BRCMS_N_PROTECTION_OFF 0
503 #define BRCMS_N_PROTECTION_OPTIONAL 1
504 #define BRCMS_N_PROTECTION_20IN40 2
505 #define BRCMS_N_PROTECTION_MIXEDMODE 3
507 /* values for band specific 40MHz capabilities */
508 #define BRCMS_N_BW_20ALL 0
509 #define BRCMS_N_BW_40ALL 1
510 #define BRCMS_N_BW_20IN2G_40IN5G 2
512 /* bitflags for SGI support (sgi_rx iovar) */
513 #define BRCMS_N_SGI_20 0x01
514 #define BRCMS_N_SGI_40 0x02
516 /* defines used by the nrate iovar */
517 /* MSC in use,indicates b0-6 holds an mcs */
518 #define NRATE_MCS_INUSE 0x00000080
520 #define NRATE_RATE_MASK 0x0000007f
521 /* stf mode mask: siso, cdd, stbc, sdm */
522 #define NRATE_STF_MASK 0x0000ff00
524 #define NRATE_STF_SHIFT 8
525 /* bit indicates override both rate & mode */
526 #define NRATE_OVERRIDE 0x80000000
527 /* bit indicate to override mcs only */
528 #define NRATE_OVERRIDE_MCS_ONLY 0x40000000
529 #define NRATE_SGI_MASK 0x00800000 /* sgi mode */
530 #define NRATE_SGI_SHIFT 23 /* sgi mode */
531 #define NRATE_LDPC_CODING 0x00400000 /* bit indicates adv coding in use */
532 #define NRATE_LDPC_SHIFT 22 /* ldpc shift */
534 #define NRATE_STF_SISO 0 /* stf mode SISO */
535 #define NRATE_STF_CDD 1 /* stf mode CDD */
536 #define NRATE_STF_STBC 2 /* stf mode STBC */
537 #define NRATE_STF_SDM 3 /* stf mode SDM */
539 /* max number of antenna configurations */
540 #define ANT_SELCFG_MAX 4
542 /* MCS values greater than this enable multiple streams */
543 #define HIGHEST_SINGLE_STREAM_MCS 7
545 struct brcms_antselcfg
{
546 u8 ant_config
[ANT_SELCFG_MAX
]; /* antenna configuration */
547 u8 num_antcfg
; /* number of available antenna configurations */
550 /* common functions for every port */
551 struct brcms_c_info
*
552 brcms_c_attach(struct brcms_info
*wl
, u16 vendor
, u16 device
, uint unit
,
553 bool piomode
, void *regsva
, struct pci_dev
*btparam
, uint
*perr
);
554 extern uint
brcms_c_detach(struct brcms_c_info
*wlc
);
555 extern int brcms_c_up(struct brcms_c_info
*wlc
);
556 extern uint
brcms_c_down(struct brcms_c_info
*wlc
);
558 extern int brcms_c_set(struct brcms_c_info
*wlc
, int cmd
, int arg
);
559 extern int brcms_c_get(struct brcms_c_info
*wlc
, int cmd
, int *arg
);
560 extern bool brcms_c_chipmatch(u16 vendor
, u16 device
);
561 extern void brcms_c_init(struct brcms_c_info
*wlc
);
562 extern void brcms_c_reset(struct brcms_c_info
*wlc
);
564 extern void brcms_c_intrson(struct brcms_c_info
*wlc
);
565 extern u32
brcms_c_intrsoff(struct brcms_c_info
*wlc
);
566 extern void brcms_c_intrsrestore(struct brcms_c_info
*wlc
, u32 macintmask
);
567 extern bool brcms_c_intrsupd(struct brcms_c_info
*wlc
);
568 extern bool brcms_c_isr(struct brcms_c_info
*wlc
, bool *wantdpc
);
569 extern bool brcms_c_dpc(struct brcms_c_info
*wlc
, bool bounded
);
570 extern bool brcms_c_sendpkt_mac80211(struct brcms_c_info
*wlc
,
572 struct ieee80211_hw
*hw
);
573 extern int brcms_c_ioctl(struct brcms_c_info
*wlc
, int cmd
, void *arg
, int len
,
574 struct brcms_c_if
*wlcif
);
575 extern bool brcms_c_aggregatable(struct brcms_c_info
*wlc
, u8 tid
);
577 /* helper functions */
578 extern void brcms_c_statsupd(struct brcms_c_info
*wlc
);
579 extern void brcms_c_protection_upd(struct brcms_c_info
*wlc
, uint idx
,
581 extern int brcms_c_get_header_len(void);
582 extern void brcms_c_mac_bcn_promisc_change(struct brcms_c_info
*wlc
,
584 extern void brcms_c_set_addrmatch(struct brcms_c_info
*wlc
,
585 int match_reg_offset
,
587 extern void brcms_c_wme_setparams(struct brcms_c_info
*wlc
, u16 aci
,
588 const struct ieee80211_tx_queue_params
*arg
,
590 extern struct brcms_pub
*brcms_c_pub(struct brcms_c_info
*wlc
);
592 /* common functions for every port */
593 extern void brcms_c_mhf(struct brcms_c_info
*wlc
, u8 idx
, u16 mask
, u16 val
,
595 extern void brcms_c_rate_lookup_init(struct brcms_c_info
*wlc
,
596 struct brcms_c_rateset
*rateset
);
597 extern void brcms_default_rateset(struct brcms_c_info
*wlc
,
598 struct brcms_c_rateset
*rs
);
600 extern void brcms_c_ampdu_flush(struct brcms_c_info
*wlc
,
601 struct ieee80211_sta
*sta
, u16 tid
);
602 extern void brcms_c_ampdu_tx_operational(struct brcms_c_info
*wlc
, u8 tid
,
603 u8 ba_wsize
, uint max_rx_ampdu_bytes
);
604 extern int brcms_c_set_par(struct brcms_c_info
*wlc
, enum wlc_par_id par_id
,
606 extern int brcms_c_get_par(struct brcms_c_info
*wlc
, enum wlc_par_id par_id
,
608 extern char *getvar(char *vars
, const char *name
);
609 extern int getintvar(char *vars
, const char *name
);
611 /* wlc_phy.c helper functions */
612 extern void brcms_c_set_ps_ctrl(struct brcms_c_info
*wlc
);
613 extern void brcms_c_mctrl(struct brcms_c_info
*wlc
, u32 mask
, u32 val
);
615 extern int brcms_c_module_register(struct brcms_pub
*pub
,
616 const char *name
, struct brcms_info
*hdl
,
617 int (*down_fn
)(void *handle
));
618 extern int brcms_c_module_unregister(struct brcms_pub
*pub
, const char *name
,
619 struct brcms_info
*hdl
);
620 extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info
*wlc
);
621 extern void brcms_c_enable_mac(struct brcms_c_info
*wlc
);
622 extern void brcms_c_associate_upd(struct brcms_c_info
*wlc
, bool state
);
623 extern void brcms_c_scan_start(struct brcms_c_info
*wlc
);
624 extern void brcms_c_scan_stop(struct brcms_c_info
*wlc
);
625 extern int brcms_c_get_curband(struct brcms_c_info
*wlc
);
626 extern void brcms_c_wait_for_tx_completion(struct brcms_c_info
*wlc
,
629 /* helper functions */
630 extern bool brcms_c_check_radio_disabled(struct brcms_c_info
*wlc
);
631 extern bool brcms_c_radio_monitor_stop(struct brcms_c_info
*wlc
);
633 #define MAXBANDS 2 /* Maximum #of bands */
634 /* bandstate array indices */
635 #define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */
636 #define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */
638 #define BAND_2G_NAME "2.4G"
639 #define BAND_5G_NAME "5G"
641 #endif /* _BRCM_PUB_H_ */