| /* |
| * Copyright (c) 2010 Broadcom Corporation |
| * |
| * Permission to use, copy, modify, and/or distribute this software for any |
| * purpose with or without fee is hereby granted, provided that the above |
| * copyright notice and this permission notice appear in all copies. |
| * |
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| */ |
| |
| #ifndef _wlc_cfg_h_ |
| #define _wlc_cfg_h_ |
| |
| #define NBANDS(wlc) ((wlc)->pub->_nbands) |
| #define NBANDS_PUB(pub) ((pub)->_nbands) |
| #define NBANDS_HW(hw) ((hw)->_nbands) |
| |
| #define IS_SINGLEBAND_5G(device) 0 |
| |
| /* **** Core type/rev defaults **** */ |
| #define D11_DEFAULT 0x0fffffb0 /* Supported D11 revs: 4, 5, 7-27 |
| * also need to update wlc.h MAXCOREREV |
| */ |
| |
| #define NPHY_DEFAULT 0x000001ff /* Supported nphy revs: |
| * 0 4321a0 |
| * 1 4321a1 |
| * 2 4321b0/b1/c0/c1 |
| * 3 4322a0 |
| * 4 4322a1 |
| * 5 4716a0 |
| * 6 43222a0, 43224a0 |
| * 7 43226a0 |
| * 8 5357a0, 43236a0 |
| */ |
| |
| #define LCNPHY_DEFAULT 0x00000007 /* Supported lcnphy revs: |
| * 0 4313a0, 4336a0, 4330a0 |
| * 1 |
| * 2 4330a0 |
| */ |
| |
| #define SSLPNPHY_DEFAULT 0x0000000f /* Supported sslpnphy revs: |
| * 0 4329a0/k0 |
| * 1 4329b0/4329C0 |
| * 2 4319a0 |
| * 3 5356a0 |
| */ |
| |
| |
| /* For undefined values, use defaults */ |
| #ifndef D11CONF |
| #define D11CONF D11_DEFAULT |
| #endif |
| #ifndef NCONF |
| #define NCONF NPHY_DEFAULT |
| #endif |
| #ifndef LCNCONF |
| #define LCNCONF LCNPHY_DEFAULT |
| #endif |
| |
| #ifndef SSLPNCONF |
| #define SSLPNCONF SSLPNPHY_DEFAULT |
| #endif |
| |
| /******************************************************************** |
| * Phy/Core Configuration. Defines macros to to check core phy/rev * |
| * compile-time configuration. Defines default core support. * |
| * ****************************************************************** |
| */ |
| |
| /* Basic macros to check a configuration bitmask */ |
| |
| #define CONF_HAS(config, val) ((config) & (1 << (val))) |
| #define CONF_MSK(config, mask) ((config) & (mask)) |
| #define MSK_RANGE(low, hi) ((1 << ((hi)+1)) - (1 << (low))) |
| #define CONF_RANGE(config, low, hi) (CONF_MSK(config, MSK_RANGE(low, high))) |
| |
| #define CONF_IS(config, val) ((config) == (1 << (val))) |
| #define CONF_GE(config, val) ((config) & (0-(1 << (val)))) |
| #define CONF_GT(config, val) ((config) & (0-2*(1 << (val)))) |
| #define CONF_LT(config, val) ((config) & ((1 << (val))-1)) |
| #define CONF_LE(config, val) ((config) & (2*(1 << (val))-1)) |
| |
| /* Wrappers for some of the above, specific to config constants */ |
| |
| #define NCONF_HAS(val) CONF_HAS(NCONF, val) |
| #define NCONF_MSK(mask) CONF_MSK(NCONF, mask) |
| #define NCONF_IS(val) CONF_IS(NCONF, val) |
| #define NCONF_GE(val) CONF_GE(NCONF, val) |
| #define NCONF_GT(val) CONF_GT(NCONF, val) |
| #define NCONF_LT(val) CONF_LT(NCONF, val) |
| #define NCONF_LE(val) CONF_LE(NCONF, val) |
| |
| #define LCNCONF_HAS(val) CONF_HAS(LCNCONF, val) |
| #define LCNCONF_MSK(mask) CONF_MSK(LCNCONF, mask) |
| #define LCNCONF_IS(val) CONF_IS(LCNCONF, val) |
| #define LCNCONF_GE(val) CONF_GE(LCNCONF, val) |
| #define LCNCONF_GT(val) CONF_GT(LCNCONF, val) |
| #define LCNCONF_LT(val) CONF_LT(LCNCONF, val) |
| #define LCNCONF_LE(val) CONF_LE(LCNCONF, val) |
| |
| #define D11CONF_HAS(val) CONF_HAS(D11CONF, val) |
| #define D11CONF_MSK(mask) CONF_MSK(D11CONF, mask) |
| #define D11CONF_IS(val) CONF_IS(D11CONF, val) |
| #define D11CONF_GE(val) CONF_GE(D11CONF, val) |
| #define D11CONF_GT(val) CONF_GT(D11CONF, val) |
| #define D11CONF_LT(val) CONF_LT(D11CONF, val) |
| #define D11CONF_LE(val) CONF_LE(D11CONF, val) |
| |
| #define PHYCONF_HAS(val) CONF_HAS(PHYTYPE, val) |
| #define PHYCONF_IS(val) CONF_IS(PHYTYPE, val) |
| |
| #define NREV_IS(var, val) (NCONF_HAS(val) && (NCONF_IS(val) || ((var) == (val)))) |
| #define NREV_GE(var, val) (NCONF_GE(val) && (!NCONF_LT(val) || ((var) >= (val)))) |
| #define NREV_GT(var, val) (NCONF_GT(val) && (!NCONF_LE(val) || ((var) > (val)))) |
| #define NREV_LT(var, val) (NCONF_LT(val) && (!NCONF_GE(val) || ((var) < (val)))) |
| #define NREV_LE(var, val) (NCONF_LE(val) && (!NCONF_GT(val) || ((var) <= (val)))) |
| |
| #define LCNREV_IS(var, val) (LCNCONF_HAS(val) && (LCNCONF_IS(val) || ((var) == (val)))) |
| #define LCNREV_GE(var, val) (LCNCONF_GE(val) && (!LCNCONF_LT(val) || ((var) >= (val)))) |
| #define LCNREV_GT(var, val) (LCNCONF_GT(val) && (!LCNCONF_LE(val) || ((var) > (val)))) |
| #define LCNREV_LT(var, val) (LCNCONF_LT(val) && (!LCNCONF_GE(val) || ((var) < (val)))) |
| #define LCNREV_LE(var, val) (LCNCONF_LE(val) && (!LCNCONF_GT(val) || ((var) <= (val)))) |
| |
| #define D11REV_IS(var, val) (D11CONF_HAS(val) && (D11CONF_IS(val) || ((var) == (val)))) |
| #define D11REV_GE(var, val) (D11CONF_GE(val) && (!D11CONF_LT(val) || ((var) >= (val)))) |
| #define D11REV_GT(var, val) (D11CONF_GT(val) && (!D11CONF_LE(val) || ((var) > (val)))) |
| #define D11REV_LT(var, val) (D11CONF_LT(val) && (!D11CONF_GE(val) || ((var) < (val)))) |
| #define D11REV_LE(var, val) (D11CONF_LE(val) && (!D11CONF_GT(val) || ((var) <= (val)))) |
| |
| #define PHYTYPE_IS(var, val) (PHYCONF_HAS(val) && (PHYCONF_IS(val) || ((var) == (val)))) |
| |
| /* Finally, early-exit from switch case if anyone wants it... */ |
| |
| #define CASECHECK(config, val) if (!(CONF_HAS(config, val))) break |
| #define CASEMSK(config, mask) if (!(CONF_MSK(config, mask))) break |
| |
| #if (D11CONF ^ (D11CONF & D11_DEFAULT)) |
| #error "Unsupported MAC revision configured" |
| #endif |
| #if (NCONF ^ (NCONF & NPHY_DEFAULT)) |
| #error "Unsupported NPHY revision configured" |
| #endif |
| #if (LCNCONF ^ (LCNCONF & LCNPHY_DEFAULT)) |
| #error "Unsupported LPPHY revision configured" |
| #endif |
| |
| /* *** Consistency checks *** */ |
| #if !D11CONF |
| #error "No MAC revisions configured!" |
| #endif |
| |
| #if !NCONF && !LCNCONF && !SSLPNCONF |
| #error "No PHY configured!" |
| #endif |
| |
| /* Set up PHYTYPE automatically: (depends on PHY_TYPE_X, from d11.h) */ |
| |
| #define _PHYCONF_N (1 << PHY_TYPE_N) |
| |
| #if LCNCONF |
| #define _PHYCONF_LCN (1 << PHY_TYPE_LCN) |
| #else |
| #define _PHYCONF_LCN 0 |
| #endif /* LCNCONF */ |
| |
| #if SSLPNCONF |
| #define _PHYCONF_SSLPN (1 << PHY_TYPE_SSN) |
| #else |
| #define _PHYCONF_SSLPN 0 |
| #endif /* SSLPNCONF */ |
| |
| #define PHYTYPE (_PHYCONF_N | _PHYCONF_LCN | _PHYCONF_SSLPN) |
| |
| /* Utility macro to identify 802.11n (HT) capable PHYs */ |
| #define PHYTYPE_11N_CAP(phytype) \ |
| (PHYTYPE_IS(phytype, PHY_TYPE_N) || \ |
| PHYTYPE_IS(phytype, PHY_TYPE_LCN) || \ |
| PHYTYPE_IS(phytype, PHY_TYPE_SSN)) |
| |
| /* Last but not least: shorter wlc-specific var checks */ |
| #define WLCISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N) |
| #define WLCISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN) |
| #define WLCISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN) |
| |
| #define WLC_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype) |
| |
| /********************************************************************** |
| * ------------- End of Core phy/rev configuration. ----------------- * |
| * ******************************************************************** |
| */ |
| |
| /************************************************* |
| * Defaults for tunables (e.g. sizing constants) |
| * |
| * For each new tunable, add a member to the end |
| * of wlc_tunables_t in wlc_pub.h to enable |
| * runtime checks of tunable values. (Directly |
| * using the macros in code invalidates ROM code) |
| * |
| * *********************************************** |
| */ |
| #ifndef NTXD |
| #define NTXD 256 /* Max # of entries in Tx FIFO based on 4kb page size */ |
| #endif /* NTXD */ |
| #ifndef NRXD |
| #define NRXD 256 /* Max # of entries in Rx FIFO based on 4kb page size */ |
| #endif /* NRXD */ |
| |
| #ifndef NRXBUFPOST |
| #define NRXBUFPOST 32 /* try to keep this # rbufs posted to the chip */ |
| #endif /* NRXBUFPOST */ |
| |
| #ifndef MAXSCB /* station control blocks in cache */ |
| #define MAXSCB 32 /* Maximum SCBs in cache for STA */ |
| #endif /* MAXSCB */ |
| |
| #ifndef AMPDU_NUM_MPDU |
| #define AMPDU_NUM_MPDU 16 /* max allowed number of mpdus in an ampdu (2 streams) */ |
| #endif /* AMPDU_NUM_MPDU */ |
| |
| #ifndef AMPDU_NUM_MPDU_3STREAMS |
| #define AMPDU_NUM_MPDU_3STREAMS 32 /* max allowed number of mpdus in an ampdu for 3+ streams */ |
| #endif /* AMPDU_NUM_MPDU_3STREAMS */ |
| |
| /* Count of packet callback structures. either of following |
| * 1. Set to the number of SCBs since a STA |
| * can queue up a rate callback for each IBSS STA it knows about, and an AP can |
| * queue up an "are you there?" Null Data callback for each associated STA |
| * 2. controlled by tunable config file |
| */ |
| #ifndef MAXPKTCB |
| #define MAXPKTCB MAXSCB /* Max number of packet callbacks */ |
| #endif /* MAXPKTCB */ |
| |
| #ifndef CTFPOOLSZ |
| #define CTFPOOLSZ 128 |
| #endif /* CTFPOOLSZ */ |
| |
| /* NetBSD also needs to keep track of this */ |
| #define WLC_MAX_UCODE_BSS (16) /* Number of BSS handled in ucode bcn/prb */ |
| #define WLC_MAX_UCODE_BSS4 (4) /* Number of BSS handled in sw bcn/prb */ |
| #ifndef WLC_MAXBSSCFG |
| #define WLC_MAXBSSCFG (1) /* max # BSS configs */ |
| #endif /* WLC_MAXBSSCFG */ |
| |
| #ifndef MAXBSS |
| #define MAXBSS 64 /* max # available networks */ |
| #endif /* MAXBSS */ |
| |
| #ifndef WLC_DATAHIWAT |
| #define WLC_DATAHIWAT 50 /* data msg txq hiwat mark */ |
| #endif /* WLC_DATAHIWAT */ |
| |
| #ifndef WLC_AMPDUDATAHIWAT |
| #define WLC_AMPDUDATAHIWAT 255 |
| #endif /* WLC_AMPDUDATAHIWAT */ |
| |
| /* bounded rx loops */ |
| #ifndef RXBND |
| #define RXBND 8 /* max # frames to process in wlc_recv() */ |
| #endif /* RXBND */ |
| #ifndef TXSBND |
| #define TXSBND 8 /* max # tx status to process in wlc_txstatus() */ |
| #endif /* TXSBND */ |
| |
| #define BAND_5G(bt) ((bt) == WLC_BAND_5G) |
| #define BAND_2G(bt) ((bt) == WLC_BAND_2G) |
| |
| #define WLBANDINITDATA(_data) _data |
| #define WLBANDINITFN(_fn) _fn |
| |
| #endif /* _wlc_cfg_h_ */ |