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 #define NBANDS(wlc) ((wlc)->pub->_nbands)
21 #define NBANDS_PUB(pub) ((pub)->_nbands)
22 #define NBANDS_HW(hw) ((hw)->_nbands)
24 #define IS_SINGLEBAND_5G(device) 0
26 /* **** Core type/rev defaults **** */
27 #define D11_DEFAULT 0x0fffffb0 /* Supported D11 revs: 4, 5, 7-27
28 * also need to update wlc.h MAXCOREREV
31 #define NPHY_DEFAULT 0x000001ff /* Supported nphy revs:
43 #define LCNPHY_DEFAULT 0x00000007 /* Supported lcnphy revs:
44 * 0 4313a0, 4336a0, 4330a0
49 #define SSLPNPHY_DEFAULT 0x0000000f /* Supported sslpnphy revs:
57 /* For undefined values, use defaults */
59 #define D11CONF D11_DEFAULT
62 #define NCONF NPHY_DEFAULT
65 #define LCNCONF LCNPHY_DEFAULT
69 #define SSLPNCONF SSLPNPHY_DEFAULT
72 /********************************************************************
73 * Phy/Core Configuration. Defines macros to to check core phy/rev *
74 * compile-time configuration. Defines default core support. *
75 * ******************************************************************
78 /* Basic macros to check a configuration bitmask */
80 #define CONF_HAS(config, val) ((config) & (1 << (val)))
81 #define CONF_MSK(config, mask) ((config) & (mask))
82 #define MSK_RANGE(low, hi) ((1 << ((hi)+1)) - (1 << (low)))
83 #define CONF_RANGE(config, low, hi) (CONF_MSK(config, MSK_RANGE(low, high)))
85 #define CONF_IS(config, val) ((config) == (1 << (val)))
86 #define CONF_GE(config, val) ((config) & (0-(1 << (val))))
87 #define CONF_GT(config, val) ((config) & (0-2*(1 << (val))))
88 #define CONF_LT(config, val) ((config) & ((1 << (val))-1))
89 #define CONF_LE(config, val) ((config) & (2*(1 << (val))-1))
91 /* Wrappers for some of the above, specific to config constants */
93 #define NCONF_HAS(val) CONF_HAS(NCONF, val)
94 #define NCONF_MSK(mask) CONF_MSK(NCONF, mask)
95 #define NCONF_IS(val) CONF_IS(NCONF, val)
96 #define NCONF_GE(val) CONF_GE(NCONF, val)
97 #define NCONF_GT(val) CONF_GT(NCONF, val)
98 #define NCONF_LT(val) CONF_LT(NCONF, val)
99 #define NCONF_LE(val) CONF_LE(NCONF, val)
101 #define LCNCONF_HAS(val) CONF_HAS(LCNCONF, val)
102 #define LCNCONF_MSK(mask) CONF_MSK(LCNCONF, mask)
103 #define LCNCONF_IS(val) CONF_IS(LCNCONF, val)
104 #define LCNCONF_GE(val) CONF_GE(LCNCONF, val)
105 #define LCNCONF_GT(val) CONF_GT(LCNCONF, val)
106 #define LCNCONF_LT(val) CONF_LT(LCNCONF, val)
107 #define LCNCONF_LE(val) CONF_LE(LCNCONF, val)
109 #define D11CONF_HAS(val) CONF_HAS(D11CONF, val)
110 #define D11CONF_MSK(mask) CONF_MSK(D11CONF, mask)
111 #define D11CONF_IS(val) CONF_IS(D11CONF, val)
112 #define D11CONF_GE(val) CONF_GE(D11CONF, val)
113 #define D11CONF_GT(val) CONF_GT(D11CONF, val)
114 #define D11CONF_LT(val) CONF_LT(D11CONF, val)
115 #define D11CONF_LE(val) CONF_LE(D11CONF, val)
117 #define PHYCONF_HAS(val) CONF_HAS(PHYTYPE, val)
118 #define PHYCONF_IS(val) CONF_IS(PHYTYPE, val)
120 #define NREV_IS(var, val) (NCONF_HAS(val) && (NCONF_IS(val) || ((var) == (val))))
121 #define NREV_GE(var, val) (NCONF_GE(val) && (!NCONF_LT(val) || ((var) >= (val))))
122 #define NREV_GT(var, val) (NCONF_GT(val) && (!NCONF_LE(val) || ((var) > (val))))
123 #define NREV_LT(var, val) (NCONF_LT(val) && (!NCONF_GE(val) || ((var) < (val))))
124 #define NREV_LE(var, val) (NCONF_LE(val) && (!NCONF_GT(val) || ((var) <= (val))))
126 #define LCNREV_IS(var, val) (LCNCONF_HAS(val) && (LCNCONF_IS(val) || ((var) == (val))))
127 #define LCNREV_GE(var, val) (LCNCONF_GE(val) && (!LCNCONF_LT(val) || ((var) >= (val))))
128 #define LCNREV_GT(var, val) (LCNCONF_GT(val) && (!LCNCONF_LE(val) || ((var) > (val))))
129 #define LCNREV_LT(var, val) (LCNCONF_LT(val) && (!LCNCONF_GE(val) || ((var) < (val))))
130 #define LCNREV_LE(var, val) (LCNCONF_LE(val) && (!LCNCONF_GT(val) || ((var) <= (val))))
132 #define D11REV_IS(var, val) (D11CONF_HAS(val) && (D11CONF_IS(val) || ((var) == (val))))
133 #define D11REV_GE(var, val) (D11CONF_GE(val) && (!D11CONF_LT(val) || ((var) >= (val))))
134 #define D11REV_GT(var, val) (D11CONF_GT(val) && (!D11CONF_LE(val) || ((var) > (val))))
135 #define D11REV_LT(var, val) (D11CONF_LT(val) && (!D11CONF_GE(val) || ((var) < (val))))
136 #define D11REV_LE(var, val) (D11CONF_LE(val) && (!D11CONF_GT(val) || ((var) <= (val))))
138 #define PHYTYPE_IS(var, val) (PHYCONF_HAS(val) && (PHYCONF_IS(val) || ((var) == (val))))
140 /* Finally, early-exit from switch case if anyone wants it... */
142 #define CASECHECK(config, val) if (!(CONF_HAS(config, val))) break
143 #define CASEMSK(config, mask) if (!(CONF_MSK(config, mask))) break
145 #if (D11CONF ^ (D11CONF & D11_DEFAULT))
146 #error "Unsupported MAC revision configured"
148 #if (NCONF ^ (NCONF & NPHY_DEFAULT))
149 #error "Unsupported NPHY revision configured"
151 #if (LCNCONF ^ (LCNCONF & LCNPHY_DEFAULT))
152 #error "Unsupported LPPHY revision configured"
155 /* *** Consistency checks *** */
157 #error "No MAC revisions configured!"
160 #if !NCONF && !LCNCONF && !SSLPNCONF
161 #error "No PHY configured!"
164 /* Set up PHYTYPE automatically: (depends on PHY_TYPE_X, from d11.h) */
166 #define _PHYCONF_N (1 << PHY_TYPE_N)
169 #define _PHYCONF_LCN (1 << PHY_TYPE_LCN)
171 #define _PHYCONF_LCN 0
175 #define _PHYCONF_SSLPN (1 << PHY_TYPE_SSN)
177 #define _PHYCONF_SSLPN 0
178 #endif /* SSLPNCONF */
180 #define PHYTYPE (_PHYCONF_N | _PHYCONF_LCN | _PHYCONF_SSLPN)
182 /* Utility macro to identify 802.11n (HT) capable PHYs */
183 #define PHYTYPE_11N_CAP(phytype) \
184 (PHYTYPE_IS(phytype, PHY_TYPE_N) || \
185 PHYTYPE_IS(phytype, PHY_TYPE_LCN) || \
186 PHYTYPE_IS(phytype, PHY_TYPE_SSN))
188 /* Last but not least: shorter wlc-specific var checks */
189 #define WLCISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N)
190 #define WLCISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN)
191 #define WLCISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN)
193 #define WLC_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype)
195 /**********************************************************************
196 * ------------- End of Core phy/rev configuration. ----------------- *
197 * ********************************************************************
200 /*************************************************
201 * Defaults for tunables (e.g. sizing constants)
203 * For each new tunable, add a member to the end
204 * of wlc_tunables_t in wlc_pub.h to enable
205 * runtime checks of tunable values. (Directly
206 * using the macros in code invalidates ROM code)
208 * ***********************************************
211 #define NTXD 256 /* Max # of entries in Tx FIFO based on 4kb page size */
214 #define NRXD 256 /* Max # of entries in Rx FIFO based on 4kb page size */
218 #define NRXBUFPOST 32 /* try to keep this # rbufs posted to the chip */
219 #endif /* NRXBUFPOST */
221 #ifndef MAXSCB /* station control blocks in cache */
222 #define MAXSCB 32 /* Maximum SCBs in cache for STA */
225 #ifndef AMPDU_NUM_MPDU
226 #define AMPDU_NUM_MPDU 16 /* max allowed number of mpdus in an ampdu (2 streams) */
227 #endif /* AMPDU_NUM_MPDU */
229 #ifndef AMPDU_NUM_MPDU_3STREAMS
230 #define AMPDU_NUM_MPDU_3STREAMS 32 /* max allowed number of mpdus in an ampdu for 3+ streams */
231 #endif /* AMPDU_NUM_MPDU_3STREAMS */
233 /* Count of packet callback structures. either of following
234 * 1. Set to the number of SCBs since a STA
235 * can queue up a rate callback for each IBSS STA it knows about, and an AP can
236 * queue up an "are you there?" Null Data callback for each associated STA
237 * 2. controlled by tunable config file
240 #define MAXPKTCB MAXSCB /* Max number of packet callbacks */
241 #endif /* MAXPKTCB */
244 #define CTFPOOLSZ 128
245 #endif /* CTFPOOLSZ */
247 /* NetBSD also needs to keep track of this */
248 #define WLC_MAX_UCODE_BSS (16) /* Number of BSS handled in ucode bcn/prb */
249 #define WLC_MAX_UCODE_BSS4 (4) /* Number of BSS handled in sw bcn/prb */
250 #ifndef WLC_MAXBSSCFG
251 #define WLC_MAXBSSCFG (1) /* max # BSS configs */
252 #endif /* WLC_MAXBSSCFG */
255 #define MAXBSS 64 /* max # available networks */
258 #ifndef WLC_DATAHIWAT
259 #define WLC_DATAHIWAT 50 /* data msg txq hiwat mark */
260 #endif /* WLC_DATAHIWAT */
262 #ifndef WLC_AMPDUDATAHIWAT
263 #define WLC_AMPDUDATAHIWAT 255
264 #endif /* WLC_AMPDUDATAHIWAT */
266 /* bounded rx loops */
268 #define RXBND 8 /* max # frames to process in wlc_recv() */
271 #define TXSBND 8 /* max # tx status to process in wlc_txstatus() */
274 #define BAND_5G(bt) ((bt) == WLC_BAND_5G)
275 #define BAND_2G(bt) ((bt) == WLC_BAND_2G)
277 #define WLBANDINITDATA(_data) _data
278 #define WLBANDINITFN(_fn) _fn
280 #endif /* _BRCM_CFG_H_ */