]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/net/wireless/brcm80211/brcmsmac/main.h
fc5852f71f36026f19e61e96979cbf46b5445469
[mv-sheeva.git] / drivers / net / wireless / brcm80211 / brcmsmac / main.h
1 /*
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 _BRCM_MAIN_H_
18 #define _BRCM_MAIN_H_
19
20 #include <linux/etherdevice.h>
21
22 #include <brcmu_utils.h>
23 #include "types.h"
24 #include "d11.h"
25 #include "scb.h"
26
27 #define INVCHANNEL              255     /* invalid channel */
28
29 /* max # brcms_c_module_register() calls */
30 #define BRCMS_MAXMODULES        22
31
32 #define SEQNUM_SHIFT            4
33 #define SEQNUM_MAX              0x1000
34
35 #define NTXRATE                 64      /* # tx MPDUs rate is reported for */
36
37 /* Maximum wait time for a MAC suspend */
38 /* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */
39 #define BRCMS_MAX_MAC_SUSPEND   83000
40
41 /* responses for probe requests older that this are tossed, zero to disable */
42 #define BRCMS_PRB_RESP_TIMEOUT  0       /* Disable probe response timeout */
43
44 /* transmit buffer max headroom for protocol headers */
45 #define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN)
46
47 #define AC_COUNT                4
48
49 /* Macros for doing definition and get/set of bitfields
50  * Usage example, e.g. a three-bit field (bits 4-6):
51  *    #define <NAME>_M  BITFIELD_MASK(3)
52  *    #define <NAME>_S  4
53  * ...
54  *    regval = R_REG(osh, &regs->regfoo);
55  *    field = GFIELD(regval, <NAME>);
56  *    regval = SFIELD(regval, <NAME>, 1);
57  *    W_REG(osh, &regs->regfoo, regval);
58  */
59 #define BITFIELD_MASK(width) \
60                 (((unsigned)1 << (width)) - 1)
61 #define GFIELD(val, field) \
62                 (((val) >> field ## _S) & field ## _M)
63 #define SFIELD(val, field, bits) \
64                 (((val) & (~(field ## _M << field ## _S))) | \
65                  ((unsigned)(bits) << field ## _S))
66
67 #define SW_TIMER_MAC_STAT_UPD           30      /* periodic MAC stats update */
68
69 /* max # supported core revisions (0 .. MAXCOREREV - 1) */
70 #define MAXCOREREV              28
71
72 /* Double check that unsupported cores are not enabled */
73 #if CONF_MSK(D11CONF, 0x4f) || CONF_GE(D11CONF, MAXCOREREV)
74 #error "Configuration for D11CONF includes unsupported versions."
75 #endif                          /* Bad versions */
76
77 /* values for shortslot_override */
78 #define BRCMS_SHORTSLOT_AUTO    -1 /* Driver will manage Shortslot setting */
79 #define BRCMS_SHORTSLOT_OFF     0  /* Turn off short slot */
80 #define BRCMS_SHORTSLOT_ON      1  /* Turn on short slot */
81
82 /* value for short/long and mixmode/greenfield preamble */
83 #define BRCMS_LONG_PREAMBLE     (0)
84 #define BRCMS_SHORT_PREAMBLE    (1 << 0)
85 #define BRCMS_GF_PREAMBLE               (1 << 1)
86 #define BRCMS_MM_PREAMBLE               (1 << 2)
87 #define BRCMS_IS_MIMO_PREAMBLE(_pre) (((_pre) == BRCMS_GF_PREAMBLE) || \
88                                       ((_pre) == BRCMS_MM_PREAMBLE))
89
90 /* TxFrameID */
91 /* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */
92 /* rate epoch bits: TXFID_RATE_SHIFT, TXFID_RATE_MASK ((wlc_rate.c) */
93 #define TXFID_QUEUE_MASK        0x0007  /* Bits 0-2 */
94 #define TXFID_SEQ_MASK          0x7FE0  /* Bits 5-15 */
95 #define TXFID_SEQ_SHIFT         5       /* Number of bit shifts */
96 #define TXFID_RATE_PROBE_MASK   0x8000  /* Bit 15 for rate probe */
97 #define TXFID_RATE_MASK         0x0018  /* Mask for bits 3 and 4 */
98 #define TXFID_RATE_SHIFT        3       /* Shift 3 bits for rate mask */
99
100 /* promote boardrev */
101 #define BOARDREV_PROMOTABLE     0xFF    /* from */
102 #define BOARDREV_PROMOTED       1       /* to */
103
104 #define DATA_BLOCK_TX_SUPR      (1 << 4)
105
106 /* 802.1D Priority to TX FIFO number for wme */
107 extern const u8 prio2fifo[];
108
109 /* Ucode MCTL_WAKE override bits */
110 #define BRCMS_WAKE_OVERRIDE_CLKCTL      0x01
111 #define BRCMS_WAKE_OVERRIDE_PHYREG      0x02
112 #define BRCMS_WAKE_OVERRIDE_MACSUSPEND  0x04
113 #define BRCMS_WAKE_OVERRIDE_TXFIFO      0x08
114 #define BRCMS_WAKE_OVERRIDE_FORCEFAST   0x10
115
116 /* stuff pulled in from wlc.c */
117
118 /* Interrupt bit error summary.  Don't include I_RU: we refill DMA at other
119  * times; and if we run out, constant I_RU interrupts may cause lockup.  We
120  * will still get error counts from rx0ovfl.
121  */
122 #define I_ERRORS        (I_PC | I_PD | I_DE | I_RO | I_XU)
123 /* default software intmasks */
124 #define DEF_RXINTMASK   (I_RI)  /* enable rx int on rxfifo only */
125 #define DEF_MACINTMASK  (MI_TXSTOP | MI_TBTT | MI_ATIMWINEND | MI_PMQ | \
126                          MI_PHYTXERR | MI_DMAINT | MI_TFS | MI_BG_NOISE | \
127                          MI_CCA | MI_TO | MI_GP0 | MI_RFDISABLE | MI_PWRUP)
128
129 #define MAXTXPKTS               6       /* max # pkts pending */
130
131 /* frameburst */
132 #define MAXTXFRAMEBURST         8 /* vanilla xpress mode: max frames/burst */
133 #define MAXFRAMEBURST_TXOP      10000   /* Frameburst TXOP in usec */
134
135 #define NFIFO                   6       /* # tx/rx fifopairs */
136
137 /* PLL requests */
138
139 /* pll is shared on old chips */
140 #define BRCMS_PLLREQ_SHARED     0x1
141 /* hold pll for radio monitor register checking */
142 #define BRCMS_PLLREQ_RADIO_MON  0x2
143 /* hold/release pll for some short operation */
144 #define BRCMS_PLLREQ_FLIP               0x4
145
146 #define CHANNEL_BANDUNIT(wlc, ch) \
147         (((ch) <= CH_MAX_2G_CHANNEL) ? BAND_2G_INDEX : BAND_5G_INDEX)
148
149 #define OTHERBANDUNIT(wlc) \
150         ((uint)((wlc)->band->bandunit ? BAND_2G_INDEX : BAND_5G_INDEX))
151
152 /*
153  * 802.11 protection information
154  *
155  * _g: use g spec protection, driver internal.
156  * g_override: override for use of g spec protection.
157  * gmode_user: user config gmode, operating band->gmode is different.
158  * overlap: Overlap BSS/IBSS protection for both 11g and 11n.
159  * nmode_user: user config nmode, operating pub->nmode is different.
160  * n_cfg: use OFDM protection on MIMO frames.
161  * n_cfg_override: override for use of N protection.
162  * nongf: non-GF present protection.
163  * nongf_override: override for use of GF protection.
164  * n_pam_override: override for preamble: MM or GF.
165  * n_obss: indicated OBSS Non-HT STA present.
166 */
167 struct brcms_protection {
168         bool _g;
169         s8 g_override;
170         u8 gmode_user;
171         s8 overlap;
172         s8 nmode_user;
173         s8 n_cfg;
174         s8 n_cfg_override;
175         bool nongf;
176         s8 nongf_override;
177         s8 n_pam_override;
178         bool n_obss;
179 };
180
181 /*
182  * anything affecting the single/dual streams/antenna operation
183  *
184  * hw_txchain: HW txchain bitmap cfg.
185  * txchain: txchain bitmap being used.
186  * txstreams: number of txchains being used.
187  * hw_rxchain: HW rxchain bitmap cfg.
188  * rxchain: rxchain bitmap being used.
189  * rxstreams: number of rxchains being used.
190  * ant_rx_ovr: rx antenna override.
191  * txant: userTx antenna setting.
192  * phytxant: phyTx antenna setting in txheader.
193  * ss_opmode: singlestream Operational mode, 0:siso; 1:cdd.
194  * ss_algosel_auto: if true, use wlc->stf->ss_algo_channel;
195  *                      else use wlc->band->stf->ss_mode_band.
196  * ss_algo_channel: ss based on per-channel algo: 0: SISO, 1: CDD 2: STBC.
197  * rxchain_restore_delay: delay time to restore default rxchain.
198  * ldpc: AUTO/ON/OFF ldpc cap supported.
199  * txcore[MAX_STREAMS_SUPPORTED + 1]: bitmap of selected core for each Nsts.
200  * spatial_policy:
201  */
202 struct brcms_stf {
203         u8 hw_txchain;
204         u8 txchain;
205         u8 txstreams;
206         u8 hw_rxchain;
207         u8 rxchain;
208         u8 rxstreams;
209         u8 ant_rx_ovr;
210         s8 txant;
211         u16 phytxant;
212         u8 ss_opmode;
213         bool ss_algosel_auto;
214         u16 ss_algo_channel;
215         u8 rxchain_restore_delay;
216         s8 ldpc;
217         u8 txcore[MAX_STREAMS_SUPPORTED + 1];
218         s8 spatial_policy;
219 };
220
221 #define BRCMS_STF_SS_STBC_TX(wlc, scb) \
222         (((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) \
223          || (((scb)->flags & SCB_STBCCAP) && \
224              (wlc)->band->band_stf_stbc_tx == AUTO && \
225              isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC))))
226
227 #define BRCMS_STBC_CAP_PHY(wlc) (BRCMS_ISNPHY(wlc->band) && \
228                                  NREV_GE(wlc->band->phyrev, 3))
229
230 #define BRCMS_SGI_CAP_PHY(wlc) ((BRCMS_ISNPHY(wlc->band) && \
231                                  NREV_GE(wlc->band->phyrev, 3)) || \
232                                 BRCMS_ISLCNPHY(wlc->band))
233
234 #define BRCMS_CHAN_PHYTYPE(x)     (((x) & RXS_CHAN_PHYTYPE_MASK) \
235                                    >> RXS_CHAN_PHYTYPE_SHIFT)
236 #define BRCMS_CHAN_CHANNEL(x)     (((x) & RXS_CHAN_ID_MASK) \
237                                    >> RXS_CHAN_ID_SHIFT)
238
239 /*
240  * core state (mac)
241  */
242 struct brcms_core {
243         uint coreidx;           /* # sb enumerated core */
244
245         /* fifo */
246         uint *txavail[NFIFO];   /* # tx descriptors available */
247         s16 txpktpend[NFIFO];   /* tx admission control */
248
249         struct macstat *macstat_snapshot;       /* mac hw prev read values */
250 };
251
252 /*
253  * band state (phy+ana+radio)
254  */
255 struct brcms_band {
256         int bandtype;           /* BRCM_BAND_2G, BRCM_BAND_5G */
257         uint bandunit;          /* bandstate[] index */
258
259         u16 phytype;            /* phytype */
260         u16 phyrev;
261         u16 radioid;
262         u16 radiorev;
263         struct brcms_phy_pub *pi; /* pointer to phy specific information */
264         bool abgphy_encore;
265
266         u8 gmode;               /* currently active gmode */
267
268         struct scb *hwrs_scb;   /* permanent scb for hw rateset */
269
270         /* band-specific copy of default_bss.rateset */
271         struct brcms_c_rateset defrateset;
272
273         u8 band_stf_ss_mode;    /* Configured STF type, 0:siso; 1:cdd */
274         s8 band_stf_stbc_tx;    /* STBC TX 0:off; 1:force on; -1:auto */
275         /* rates supported by chip (phy-specific) */
276         struct brcms_c_rateset hw_rateset;
277         u8 basic_rate[BRCM_MAXRATE + 1]; /* basic rates indexed by rate */
278         bool mimo_cap_40;       /* 40 MHz cap enabled on this band */
279         s8 antgain;             /* antenna gain from srom */
280
281         u16 CWmin; /* minimum size of contention window, in unit of aSlotTime */
282         u16 CWmax; /* maximum size of contention window, in unit of aSlotTime */
283         struct ieee80211_supported_band band;
284 };
285
286 /* module control blocks */
287 struct modulecb {
288         /* module name : NULL indicates empty array member */
289         char name[32];
290         /* handle passed when handler 'doiovar' is called */
291         struct brcms_info *hdl;
292
293         int (*down_fn)(void *handle); /* down handler. Note: the int returned
294                                        * by the down function is a count of the
295                                        * number of timers that could not be
296                                        * freed.
297                                        */
298
299 };
300
301 struct brcms_hw_band {
302         int bandtype;           /* BRCM_BAND_2G, BRCM_BAND_5G */
303         uint bandunit;          /* bandstate[] index */
304         u16 mhfs[MHFMAX];       /* MHF array shadow */
305         u8 bandhw_stf_ss_mode;  /* HW configured STF type, 0:siso; 1:cdd */
306         u16 CWmin;
307         u16 CWmax;
308         u32 core_flags;
309
310         u16 phytype;            /* phytype */
311         u16 phyrev;
312         u16 radioid;
313         u16 radiorev;
314         struct brcms_phy_pub *pi; /* pointer to phy specific information */
315         bool abgphy_encore;
316 };
317
318 struct brcms_hardware {
319         bool _piomode;          /* true if pio mode */
320         struct brcms_c_info *wlc;
321
322         /* fifo */
323         struct dma_pub *di[NFIFO];      /* dma handles, per fifo */
324
325         uint unit;              /* device instance number */
326
327         /* version info */
328         u16 vendorid;   /* PCI vendor id */
329         u16 deviceid;   /* PCI device id */
330         uint corerev;           /* core revision */
331         u8 sromrev;             /* version # of the srom */
332         u16 boardrev;   /* version # of particular board */
333         u32 boardflags; /* Board specific flags from srom */
334         u32 boardflags2;        /* More board flags if sromrev >= 4 */
335         u32 machwcap;   /* MAC capabilities */
336         u32 machwcap_backup;    /* backup of machwcap */
337
338         struct si_pub *sih;     /* SI handle (cookie for siutils calls) */
339         struct d11regs __iomem *regs;   /* pointer to device registers */
340         struct phy_shim_info *physhim; /* phy shim layer handler */
341         struct shared_phy *phy_sh;      /* pointer to shared phy state */
342         struct brcms_hw_band *band;/* pointer to active per-band state */
343         /* band state per phy/radio */
344         struct brcms_hw_band *bandstate[MAXBANDS];
345         u16 bmac_phytxant;      /* cache of high phytxant state */
346         bool shortslot;         /* currently using 11g ShortSlot timing */
347         u16 SRL;                /* 802.11 dot11ShortRetryLimit */
348         u16 LRL;                /* 802.11 dot11LongRetryLimit */
349         u16 SFBL;               /* Short Frame Rate Fallback Limit */
350         u16 LFBL;               /* Long Frame Rate Fallback Limit */
351
352         bool up;                /* d11 hardware up and running */
353         uint now;               /* # elapsed seconds */
354         uint _nbands;           /* # bands supported */
355         u16 chanspec;   /* bmac chanspec shadow */
356
357         uint *txavail[NFIFO];   /* # tx descriptors available */
358         const u16 *xmtfifo_sz;  /* fifo size in 256B for each xmt fifo */
359
360         u32 pllreq;             /* pll requests to keep PLL on */
361
362         u8 suspended_fifos;     /* Which TX fifo to remain awake for */
363         u32 maccontrol; /* Cached value of maccontrol */
364         uint mac_suspend_depth; /* current depth of mac_suspend levels */
365         u32 wake_override;      /* bit flags to force MAC to WAKE mode */
366         u32 mute_override;      /* Prevent ucode from sending beacons */
367         u8 etheraddr[ETH_ALEN]; /* currently configured ethernet address */
368         bool noreset;           /* true= do not reset hw, used by WLC_OUT */
369         bool forcefastclk;      /* true if h/w is forcing to use fast clk */
370         bool clk;               /* core is out of reset and has clock */
371         bool sbclk;             /* sb has clock */
372         bool phyclk;            /* phy is out of reset and has clock */
373
374         bool ucode_loaded;      /* true after ucode downloaded */
375
376
377         u8 hw_stf_ss_opmode;    /* STF single stream operation mode */
378         u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic
379                                  * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board
380                                  */
381         u32 antsel_avail;       /*
382                                  * put struct antsel_info here if more info is
383                                  * needed
384                                  */
385 };
386
387 /* TX Queue information
388  *
389  * Each flow of traffic out of the device has a TX Queue with independent
390  * flow control. Several interfaces may be associated with a single TX Queue
391  * if they belong to the same flow of traffic from the device. For multi-channel
392  * operation there are independent TX Queues for each channel.
393  */
394 struct brcms_txq_info {
395         struct brcms_txq_info *next;
396         struct pktq q;
397         uint stopped;           /* tx flow control bits */
398 };
399
400 /*
401  * Principal common driver data structure.
402  *
403  * pub: pointer to driver public state.
404  * wl: pointer to specific private state.
405  * regs: pointer to device registers.
406  * hw: HW related state.
407  * clkreq_override: setting for clkreq for PCIE : Auto, 0, 1.
408  * fastpwrup_dly: time in us needed to bring up d11 fast clock.
409  * macintstatus: bit channel between isr and dpc.
410  * macintmask: sw runtime master macintmask value.
411  * defmacintmask: default "on" macintmask value.
412  * clk: core is out of reset and has clock.
413  * core: pointer to active io core.
414  * band: pointer to active per-band state.
415  * corestate: per-core state (one per hw core).
416  * bandstate: per-band state (one per phy/radio).
417  * qvalid: DirFrmQValid and BcMcFrmQValid.
418  * ampdu: ampdu module handler.
419  * asi: antsel module handler.
420  * cmi: channel manager module handler.
421  * vendorid: PCI vendor id.
422  * deviceid: PCI device id.
423  * ucode_rev: microcode revision.
424  * machwcap: MAC capabilities, BMAC shadow.
425  * perm_etheraddr: original sprom local ethernet address.
426  * bandlocked: disable auto multi-band switching.
427  * bandinit_pending: track band init in auto band.
428  * radio_monitor: radio timer is running.
429  * going_down: down path intermediate variable.
430  * mpc_delay_off: delay radio disable by # of watchdog cnt.
431  * wdtimer: timer for watchdog routine.
432  * radio_timer: timer for hw radio button monitor routine.
433  * monitor: monitor (MPDU sniffing) mode.
434  * bcnmisc_monitor: bcns promisc mode override for monitor.
435  * _rifs: enable per-packet rifs.
436  * bcn_li_bcn: beacon listen interval in # beacons.
437  * bcn_li_dtim: beacon listen interval in # dtims.
438  * WDarmed: watchdog timer is armed.
439  * WDlast: last time wlc_watchdog() was called.
440  * edcf_txop[AC_COUNT]: current txop for each ac.
441  * wme_retries: per-AC retry limits.
442  * tx_prec_map: Precedence map based on HW FIFO space.
443  * fifo2prec_map[NFIFO]: pointer to fifo2_prec map based on WME.
444  * bsscfg: set of BSS configurations, idx 0 is default and always valid.
445  * cfg: the primary bsscfg (can be AP or STA).
446  * tx_queues: common TX Queue list.
447  * modulecb:
448  * mimoft: SIGN or 11N.
449  * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode.
450  * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode.
451  * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode.
452  * default_bss: configured BSS parameters.
453  * mc_fid_counter: BC/MC FIFO frame ID counter.
454  * country_default: saved country for leaving 802.11d auto-country mode.
455  * autocountry_default: initial country for 802.11d auto-country mode.
456  * prb_resp_timeout: do not send prb resp if request older
457  *                   than this, 0 = disable.
458  * home_chanspec: shared home chanspec.
459  * chanspec: target operational channel.
460  * usr_fragthresh: user configured fragmentation threshold.
461  * fragthresh[NFIFO]: per-fifo fragmentation thresholds.
462  * RTSThresh: 802.11 dot11RTSThreshold.
463  * SRL: 802.11 dot11ShortRetryLimit.
464  * LRL: 802.11 dot11LongRetryLimit.
465  * SFBL: Short Frame Rate Fallback Limit.
466  * LFBL: Long Frame Rate Fallback Limit.
467  * shortslot: currently using 11g ShortSlot timing.
468  * shortslot_override: 11g ShortSlot override.
469  * include_legacy_erp: include Legacy ERP info elt ID 47 as well as g ID 42.
470  * PLCPHdr_override: 802.11b Preamble Type override.
471  * stf:
472  * bcn_rspec: save bcn ratespec purpose.
473  * tempsense_lasttime;
474  * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM.
475  * tx_duty_cycle_cck: maximum allowed duty cycle for CCK.
476  * pkt_queue: txq for transmit packets.
477  * wiphy:
478  * pri_scb: primary Station Control Block
479  */
480 struct brcms_c_info {
481         struct brcms_pub *pub;
482         struct brcms_info *wl;
483         struct d11regs __iomem *regs;
484         struct brcms_hardware *hw;
485
486         /* clock */
487         u16 fastpwrup_dly;
488
489         /* interrupt */
490         u32 macintstatus;
491         u32 macintmask;
492         u32 defmacintmask;
493
494         bool clk;
495
496         /* multiband */
497         struct brcms_core *core;
498         struct brcms_band *band;
499         struct brcms_core *corestate;
500         struct brcms_band *bandstate[MAXBANDS];
501
502         /* packet queue */
503         uint qvalid;
504
505         struct ampdu_info *ampdu;
506         struct antsel_info *asi;
507         struct brcms_cm_info *cmi;
508
509         u16 vendorid;
510         u16 deviceid;
511         uint ucode_rev;
512
513         u8 perm_etheraddr[ETH_ALEN];
514
515         bool bandlocked;
516         bool bandinit_pending;
517
518         bool radio_monitor;
519         bool going_down;
520
521         u8 mpc_delay_off;
522
523         struct brcms_timer *wdtimer;
524         struct brcms_timer *radio_timer;
525
526         /* promiscuous */
527         bool monitor;
528         bool bcnmisc_monitor;
529
530         /* driver feature */
531         bool _rifs;
532
533         /* AP-STA synchronization, power save */
534         u8 bcn_li_bcn;
535         u8 bcn_li_dtim;
536
537         bool WDarmed;
538         u32 WDlast;
539
540         /* WME */
541         u16 edcf_txop[AC_COUNT];
542
543         u16 wme_retries[AC_COUNT];
544         u16 tx_prec_map;
545         u16 fifo2prec_map[NFIFO];
546
547         struct brcms_bss_cfg *bsscfg;
548
549         /* tx queue */
550         struct brcms_txq_info *tx_queues;
551
552         struct modulecb *modulecb;
553
554         u8 mimoft;
555         s8 cck_40txbw;
556         s8 ofdm_40txbw;
557         s8 mimo_40txbw;
558
559         struct brcms_bss_info *default_bss;
560
561         u16 mc_fid_counter;
562
563         char country_default[BRCM_CNTRY_BUF_SZ];
564         char autocountry_default[BRCM_CNTRY_BUF_SZ];
565         u16 prb_resp_timeout;
566
567         u16 home_chanspec;
568
569         /* PHY parameters */
570         u16 chanspec;
571         u16 usr_fragthresh;
572         u16 fragthresh[NFIFO];
573         u16 RTSThresh;
574         u16 SRL;
575         u16 LRL;
576         u16 SFBL;
577         u16 LFBL;
578
579         /* network config */
580         bool shortslot;
581         s8 shortslot_override;
582         bool include_legacy_erp;
583
584         struct brcms_protection *protection;
585         s8 PLCPHdr_override;
586
587         struct brcms_stf *stf;
588
589         u32 bcn_rspec;
590
591         uint tempsense_lasttime;
592
593         u16 tx_duty_cycle_ofdm;
594         u16 tx_duty_cycle_cck;
595
596         struct brcms_txq_info *pkt_queue;
597         struct wiphy *wiphy;
598         struct scb pri_scb;
599 };
600
601 /* antsel module specific state */
602 struct antsel_info {
603         struct brcms_c_info *wlc;       /* pointer to main wlc structure */
604         struct brcms_pub *pub;          /* pointer to public fn */
605         u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic
606                                  * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board
607                                  */
608         u8 antsel_antswitch;    /* board level antenna switch type */
609         bool antsel_avail;      /* Ant selection availability (SROM based) */
610         struct brcms_antselcfg antcfg_11n; /* antenna configuration */
611         struct brcms_antselcfg antcfg_cur; /* current antenna config (auto) */
612 };
613
614 /*
615  * BSS configuration state
616  *
617  * wlc: wlc to which this bsscfg belongs to.
618  * up: is this configuration up operational
619  * enable: is this configuration enabled
620  * associated: is BSS in ASSOCIATED state
621  * BSS: infraustructure or adhoc
622  * SSID_len: the length of SSID
623  * SSID: SSID string
624  *
625  *
626  * BSSID: BSSID (associated)
627  * cur_etheraddr: h/w address
628  * flags: BSSCFG flags; see below
629  *
630  * current_bss: BSS parms in ASSOCIATED state
631  *
632  *
633  * ID: 'unique' ID of this bsscfg, assigned at bsscfg allocation
634  */
635 struct brcms_bss_cfg {
636         struct brcms_c_info *wlc;
637         bool up;
638         bool enable;
639         bool associated;
640         bool BSS;
641         u8 SSID_len;
642         u8 SSID[IEEE80211_MAX_SSID_LEN];
643         u8 BSSID[ETH_ALEN];
644         u8 cur_etheraddr[ETH_ALEN];
645         struct brcms_bss_info *current_bss;
646 };
647
648 extern void brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo,
649                            struct sk_buff *p,
650                            bool commit, s8 txpktpend);
651 extern void brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo,
652                                     s8 txpktpend);
653 extern void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
654                             struct sk_buff *sdu, uint prec);
655 extern void brcms_c_print_txstatus(struct tx_status *txs);
656 extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
657                    uint *blocks);
658
659 #if defined(BCMDBG)
660 extern void brcms_c_print_txdesc(struct d11txh *txh);
661 #else
662 #define brcms_c_print_txdesc(a)
663 #endif
664
665 extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config);
666 extern void brcms_c_mac_bcn_promisc_change(struct brcms_c_info *wlc,
667                                            bool promisc);
668 extern void brcms_c_send_q(struct brcms_c_info *wlc);
669 extern int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu,
670                             uint *fifo);
671 extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec,
672                                 uint mac_len);
673 extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc,
674                                              u32 rspec,
675                                              bool use_rspec, u16 mimo_ctlchbw);
676 extern u16 brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only,
677                                       u32 rts_rate,
678                                       u32 frame_rate,
679                                       u8 rts_preamble_type,
680                                       u8 frame_preamble_type, uint frame_len,
681                                       bool ba);
682 extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw,
683                                struct ieee80211_sta *sta,
684                                void (*dma_callback_fn));
685 extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
686 extern void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend);
687 extern int brcms_c_set_nmode(struct brcms_c_info *wlc);
688 extern void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc,
689                                           u32 bcn_rate);
690 extern void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw,
691                                      u8 antsel_type);
692 extern void brcms_b_set_chanspec(struct brcms_hardware *wlc_hw,
693                                   u16 chanspec,
694                                   bool mute, struct txpwr_limits *txpwr);
695 extern void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset,
696                               u16 v);
697 extern u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset);
698 extern void brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask,
699                         u16 val, int bands);
700 extern void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags);
701 extern void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val);
702 extern void brcms_b_phy_reset(struct brcms_hardware *wlc_hw);
703 extern void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw);
704 extern void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw);
705 extern void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw,
706                                         u32 override_bit);
707 extern void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw,
708                                           u32 override_bit);
709 extern void brcms_b_write_template_ram(struct brcms_hardware *wlc_hw,
710                                        int offset, int len, void *buf);
711 extern u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate);
712 extern void brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw,
713                                    uint offset, const void *buf, int len,
714                                    u32 sel);
715 extern void brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset,
716                                      void *buf, int len, u32 sel);
717 extern void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode);
718 extern u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw);
719 extern void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk);
720 extern void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk);
721 extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on);
722 extern void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant);
723 extern void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw,
724                                     u8 stf_mode);
725 extern void brcms_c_init_scb(struct scb *scb);
726
727 #endif                          /* _BRCM_MAIN_H_ */