From owner-svn-src-head@FreeBSD.ORG Wed Jan 28 18:00:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5964E106566C; Wed, 28 Jan 2009 18:00:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44A058FC0A; Wed, 28 Jan 2009 18:00:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0SI0NN4028009; Wed, 28 Jan 2009 18:00:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0SI0MuQ028003; Wed, 28 Jan 2009 18:00:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901281800.n0SI0MuQ028003@svn.freebsd.org> From: Sam Leffler Date: Wed, 28 Jan 2009 18:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187831 - in head/sys: conf dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 18:00:24 -0000 Author: sam Date: Wed Jan 28 18:00:22 2009 New Revision: 187831 URL: http://svn.freebsd.org/changeset/base/187831 Log: Overhaul regulatory support: o remove HAL_CHANNEL; convert the hal to use net80211 channels; this mostly involves mechanical changes to variable names and channel attribute macros o gut HAL_CHANNEL_PRIVATE as most of the contents are now redundant with the net80211 channel available o change api for ath_hal_init_channels: no more reglass id's, no more outdoor indication (was a noop), anM contents o add ath_hal_getchannels to have the hal construct a channel list without altering runtime state; this is used to retrieve the calibration list for the device in ath_getradiocaps o add ath_hal_set_channels to take a channel list and regulatory data from above and construct internal state to match (maps frequencies for 900MHz cards, setup for CTL lookups, etc) o compact the private channel table: we keep one private channel per frequency instead of one per HAL_CHANNEL; this gives a big space savings and potentially improves ani and calibration by sharing state (to be seen; didn't see anything in testing); a new config option AH_MAXCHAN controls the table size (default to 96 which was chosen to be ~3x the largest expected size) o shrink ani state and change to mirror private channel table (one entry per frequency indexed by ic_devdata) o move ani state flags to private channel state o remove country codes; use net80211 definitions instead o remove GSM regulatory support; it's no longer needed now that we pass in channel lists from above o consolidate ADHOC_NO_11A attribute with DISALLOW_ADHOC_11A o simplify initial channel list construction based on the EEPROM contents; we preserve country code support for now but may want to just fallback to a WWR sku and dispatch the discovered country code up to user space so the channel list can be constructed using the master regdomain tables o defer to net80211 for max antenna gain o eliminate sorting of internal channel table; now that we use ic_devdata as an index, table lookups are O(1) o remove internal copy of the country code; the public one is sufficient o remove AH_SUPPORT_11D conditional compilation; we always support 11d o remove ath_hal_ispublicsafetysku; not needed any more o remove ath_hal_isgsmsku; no more GSM stuff o move Conformance Test Limit (CTL) state from private channel to a lookup using per-band pointers cached in the private state block o remove regulatory class id support; was unused and belongs in net80211 o fix channel list construction to set IEEE80211_CHAN_NOADHOC, IEEE80211_CHAN_NOHOSTAP, and IEEE80211_CHAN_4MSXMIT o remove private channel flags CHANNEL_DFS and CHANNEL_4MS_LIMIT; these are now set in the constructed net80211 channel o store CHANNEL_NFCREQUIRED (Noise Floor Required) channel attribute in one of the driver-private flag bits of the net80211 channel o move 900MHz frequency mapping into the hal; the mapped frequency is stored in the private channel and used throughout the hal (no more mapping in the driver and/or net80211) o remove ath_hal_mhz2ieee; it's no longer needed as net80211 does the calculation and available in the net80211 channel o change noise floor calibration logic to work with compacted private channel table setup; this may require revisiting as we no longer can distinguish channel attributes (e.g. 11b vs 11g vs turbo) but since the data is used only to calculate status data we can live with it for now o change ah_getChipPowerLimits internal method to operate on a single channel instead of all channels in the private channel table o add ath_hal_gethwchannel to map a net80211 channel to a h/w frequency (always the same except for 900MHz channels) o add HAL_EEBADREG and HAL_EEBADCC status codes to better identify regulatory problems o remove CTRY_DEBUG and CTRY_DEFAULT enum's; these come from net80211 now o change ath_hal_getwirelessmodes to really return wireless modes supported by the hardware (was previously applying regulatory constraints) o return channel interference status with IEEE80211_CHANSTATE_CWINT (should change to a callback so hal api's can take const pointers) o remove some #define's no longer needed with the inclusion of Sponsored by: Carlson Wireless Modified: head/sys/conf/options head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ah_regdomain.c head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c head/sys/dev/ath/ath_hal/ar5212/ar2316.c head/sys/dev/ath/ath_hal/ar5212/ar2317.c head/sys/dev/ath/ath_hal/ar5212/ar2413.c head/sys/dev/ath/ath_hal/ar5212/ar2425.c head/sys/dev/ath/ath_hal/ar5212/ar5111.c head/sys/dev/ath/ath_hal/ar5212/ar5112.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c head/sys/dev/ath/ath_hal/ar5212/ar5413.c head/sys/dev/ath/ath_hal/ar5312/ar5312.h head/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c head/sys/dev/ath/ath_hal/ar5416/ar2133.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/conf/options Wed Jan 28 18:00:22 2009 (r187831) @@ -762,7 +762,7 @@ AH_WRITE_EEPROM opt_ah.h AH_PRIVATE_DIAG opt_ah.h AH_NEED_DESC_SWAP opt_ah.h AH_USE_INIPDGAIN opt_ah.h -AH_SUPPORT_11D opt_ah.h +AH_MAXCHAN opt_ah.h # options for the Marvell 8335 wireless driver MALO_DEBUG opt_malo.h Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah.c Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2002-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -78,6 +78,15 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC return AH_NULL; } +/* + * Return the mask of available modes based on the hardware capabilities. + */ +u_int +ath_hal_getwirelessmodes(struct ath_hal*ah) +{ + return ath_hal_getWirelessModes(ah); +} + /* linker set of registered RF backends */ OS_SET_DECLARE(ah_rfs, struct ath_hal_rf); @@ -152,8 +161,10 @@ ath_hal_computetxtime(struct ath_hal *ah kbps = rates->info[rateix].rateKbps; /* * index can be invalid duting dynamic Turbo transitions. + * XXX */ - if(kbps == 0) return 0; + if (kbps == 0) + return 0; switch (rates->info[rateix].phy) { case IEEE80211_T_CCK: @@ -187,8 +198,8 @@ ath_hal_computetxtime(struct ath_hal *ah #define OFDM_PLCP_BITS_QUARTER 22 #define OFDM_SYMBOL_TIME_QUARTER 16 - if (AH_PRIVATE(ah)->ah_curchan && - IS_CHAN_QUARTER_RATE(AH_PRIVATE(ah)->ah_curchan)) { + if (AH_PRIVATE(ah)->ah_curchan != AH_NULL && + IEEE80211_IS_CHAN_QUARTER(AH_PRIVATE(ah)->ah_curchan)) { bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000; HALASSERT(bitsPerSymbol != 0); @@ -197,8 +208,8 @@ ath_hal_computetxtime(struct ath_hal *ah txTime = OFDM_SIFS_TIME_QUARTER + OFDM_PREAMBLE_TIME_QUARTER + (numSymbols * OFDM_SYMBOL_TIME_QUARTER); - } else if (AH_PRIVATE(ah)->ah_curchan && - IS_CHAN_HALF_RATE(AH_PRIVATE(ah)->ah_curchan)) { + } else if (AH_PRIVATE(ah)->ah_curchan != AH_NULL && + IEEE80211_IS_CHAN_HALF(AH_PRIVATE(ah)->ah_curchan)) { bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000; HALASSERT(bitsPerSymbol != 0); @@ -252,71 +263,6 @@ ath_hal_computetxtime(struct ath_hal *ah return txTime; } -static __inline int -mapgsm(u_int freq, u_int flags) -{ - freq *= 10; - if (flags & CHANNEL_QUARTER) - freq += 5; - else if (flags & CHANNEL_HALF) - freq += 10; - else - freq += 20; - return (freq - 24220) / 5; -} - -static __inline int -mappsb(u_int freq, u_int flags) -{ - return ((freq * 10) + (((freq % 5) == 2) ? 5 : 0) - 49400) / 5; -} - -/* - * Convert GHz frequency to IEEE channel number. - */ -int -ath_hal_mhz2ieee(struct ath_hal *ah, u_int freq, u_int flags) -{ - if (flags & CHANNEL_2GHZ) { /* 2GHz band */ - if (freq == 2484) - return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); - return ((int)freq - 2407) / 5; - } else - return 15 + ((freq - 2512) / 20); - } else if (flags & CHANNEL_5GHZ) {/* 5Ghz band */ - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { - return mappsb(freq, flags); - } else if ((flags & CHANNEL_A) && (freq <= 5000)) { - return (freq - 4000) / 5; - } else { - return (freq - 5000) / 5; - } - } else { /* either, guess */ - if (freq == 2484) - return 14; - if (freq < 2484) { - if (ath_hal_isgsmsku(ah)) - return mapgsm(freq, flags); - return ((int)freq - 2407) / 5; - } - if (freq < 5000) { - if (ath_hal_ispublicsafetysku(ah) && - IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) { - return mappsb(freq, flags); - } else if (freq > 4900) { - return (freq - 4000) / 5; - } else { - return 15 + ((freq - 2512) / 20); - } - } - return (freq - 5000) / 5; - } -} - typedef enum { WIRELESS_MODE_11a = 0, WIRELESS_MODE_TURBO = 1, @@ -328,15 +274,15 @@ typedef enum { } WIRELESS_MODE; static WIRELESS_MODE -ath_hal_chan2wmode(struct ath_hal *ah, const HAL_CHANNEL *chan) +ath_hal_chan2wmode(struct ath_hal *ah, const struct ieee80211_channel *chan) { - if (IS_CHAN_CCK(chan)) + if (IEEE80211_IS_CHAN_B(chan)) return WIRELESS_MODE_11b; - if (IS_CHAN_G(chan)) + if (IEEE80211_IS_CHAN_G(chan)) return WIRELESS_MODE_11g; - if (IS_CHAN_108G(chan)) + if (IEEE80211_IS_CHAN_108G(chan)) return WIRELESS_MODE_108g; - if (IS_CHAN_TURBO(chan)) + if (IEEE80211_IS_CHAN_TURBO(chan)) return WIRELESS_MODE_TURBO; return WIRELESS_MODE_11a; } @@ -350,17 +296,17 @@ static const uint8_t CLOCK_RATE[] = { 4 u_int ath_hal_mac_clks(struct ath_hal *ah, u_int usecs) { - const HAL_CHANNEL *c = (const HAL_CHANNEL *) AH_PRIVATE(ah)->ah_curchan; + const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan; u_int clks; /* NB: ah_curchan may be null when called attach time */ if (c != AH_NULL) { clks = usecs * CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; - if (IS_CHAN_HT40(c)) + if (IEEE80211_IS_CHAN_HT40(c)) clks <<= 1; - else if (IS_CHAN_HALF_RATE(c)) + else if (IEEE80211_IS_CHAN_HALF(c)) clks >>= 1; - else if (IS_CHAN_QUARTER_RATE(c)) + else if (IEEE80211_IS_CHAN_QUARTER(c)) clks >>= 2; } else clks = usecs * CLOCK_RATE[WIRELESS_MODE_11b]; @@ -370,17 +316,17 @@ ath_hal_mac_clks(struct ath_hal *ah, u_i u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks) { - const HAL_CHANNEL *c = (const HAL_CHANNEL *) AH_PRIVATE(ah)->ah_curchan; + const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan; u_int usec; /* NB: ah_curchan may be null when called attach time */ if (c != AH_NULL) { usec = clks / CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; - if (IS_CHAN_HT40(c)) + if (IEEE80211_IS_CHAN_HT40(c)) usec >>= 1; - else if (IS_CHAN_HALF_RATE(c)) + else if (IEEE80211_IS_CHAN_HALF(c)) usec <<= 1; - else if (IS_CHAN_QUARTER_RATE(c)) + else if (IEEE80211_IS_CHAN_QUARTER(c)) usec <<= 2; } else usec = clks / CLOCK_RATE[WIRELESS_MODE_11b]; @@ -505,11 +451,7 @@ ath_hal_getcapability(struct ath_hal *ah } return HAL_ENOTSUPP; case HAL_CAP_11D: -#ifdef AH_SUPPORT_11D return HAL_OK; -#else - return HAL_ENOTSUPP; -#endif case HAL_CAP_RXORN_FATAL: /* HAL_INT_RXORN treated as fatal */ return AH_PRIVATE(ah)->ah_rxornIsFatal ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_HT: @@ -764,7 +706,7 @@ static const int16_t NOISE_FLOOR[] = { - * implement the ah_getChanNoise method. */ int16_t -ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan) +ath_hal_getChanNoise(struct ath_hal *ah, const struct ieee80211_channel *chan) { HAL_CHANNEL_INTERNAL *ichan; @@ -772,7 +714,7 @@ ath_hal_getChanNoise(struct ath_hal *ah, if (ichan == AH_NULL) { HALDEBUG(ah, HAL_DEBUG_NFCAL, "%s: invalid channel %u/0x%x; no mapping\n", - __func__, chan->channel, chan->channelFlags); + __func__, chan->ic_freq, chan->ic_flags); return 0; } if (ichan->rawNoiseFloor == 0) { @@ -811,8 +753,8 @@ ath_hal_process_noisefloor(struct ath_ha c = &AH_PRIVATE(ah)->ah_channels[i]; if (c->rawNoiseFloor >= 0) continue; - mode = ath_hal_chan2wmode(ah, (HAL_CHANNEL *) c); - HALASSERT(mode < WIRELESS_MODE_MAX); + /* XXX can't identify proper mode */ + mode = IS_CHAN_5GHZ(c) ? WIRELESS_MODE_11a : WIRELESS_MODE_11g; nf = c->rawNoiseFloor + NOISE_FLOOR[mode] + ath_hal_getNfAdjust(ah, c); if (IS_CHAN_5GHZ(c)) { @@ -838,9 +780,8 @@ ath_hal_process_noisefloor(struct ath_ha /* Apply correction factor */ c->noiseFloorAdjust = ath_hal_getNfAdjust(ah, c) + (IS_CHAN_5GHZ(c) ? correct5 : correct2); - HALDEBUG(ah, HAL_DEBUG_NFCAL, "%u/0x%x raw nf %d adjust %d\n", - c->channel, c->channelFlags, c->rawNoiseFloor, - c->noiseFloorAdjust); + HALDEBUG(ah, HAL_DEBUG_NFCAL, "%u raw nf %d adjust %d\n", + c->channel, c->rawNoiseFloor, c->noiseFloorAdjust); } } Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah.h Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2002-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ah.h,v 1.15 2008/11/15 03:43:50 sam Exp $ + * $FreeBSD$ */ #ifndef _ATH_AH_H_ @@ -63,6 +63,8 @@ typedef enum { HAL_ENOTSUPP = 13, /* Hardware revision not supported */ HAL_ESELFTEST = 14, /* Hardware self-test failed */ HAL_EINPROGRESS = 15, /* Operation incomplete */ + HAL_EEBADREG = 16, /* EEPROM invalid regulatory contents */ + HAL_EEBADCC = 17, /* EEPROM invalid country code */ } HAL_STATUS; typedef enum { @@ -362,64 +364,8 @@ typedef enum { HAL_RFGAIN_NEED_CHANGE = 2 } HAL_RFGAIN; -/* - * Channels are specified by frequency. - */ -typedef struct { - uint32_t channelFlags; /* see below */ - uint16_t channel; /* setting in Mhz */ - uint8_t privFlags; - int8_t maxRegTxPower; /* max regulatory tx power in dBm */ - int8_t maxTxPower; /* max true tx power in 0.5 dBm */ - int8_t minTxPower; /* min true tx power in 0.5 dBm */ -} HAL_CHANNEL; - -/* channelFlags */ -#define CHANNEL_CW_INT 0x00002 /* CW interference detected on channel */ -#define CHANNEL_TURBO 0x00010 /* Turbo Channel */ -#define CHANNEL_CCK 0x00020 /* CCK channel */ -#define CHANNEL_OFDM 0x00040 /* OFDM channel */ -#define CHANNEL_2GHZ 0x00080 /* 2 GHz spectrum channel */ -#define CHANNEL_5GHZ 0x00100 /* 5 GHz spectrum channel */ -#define CHANNEL_PASSIVE 0x00200 /* Only passive scan allowed in the channel */ -#define CHANNEL_DYN 0x00400 /* dynamic CCK-OFDM channel */ -#define CHANNEL_STURBO 0x02000 /* Static turbo, no 11a-only usage */ -#define CHANNEL_HALF 0x04000 /* Half rate channel */ -#define CHANNEL_QUARTER 0x08000 /* Quarter rate channel */ -#define CHANNEL_HT20 0x10000 /* 11n 20MHZ channel */ -#define CHANNEL_HT40PLUS 0x20000 /* 11n 40MHZ channel w/ ext chan above */ -#define CHANNEL_HT40MINUS 0x40000 /* 11n 40MHZ channel w/ ext chan below */ - -/* privFlags */ -#define CHANNEL_INTERFERENCE 0x01 /* Software use: channel interference - used for as AR as well as RADAR - interference detection */ -#define CHANNEL_DFS 0x02 /* DFS required on channel */ -#define CHANNEL_4MS_LIMIT 0x04 /* 4msec packet limit on this channel */ -#define CHANNEL_DFS_CLEAR 0x08 /* if channel has been checked for DFS */ - -#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) -#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) -#define CHANNEL_PUREG (CHANNEL_2GHZ|CHANNEL_OFDM) -#ifdef notdef -#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_DYN) -#else -#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) -#endif -#define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO) -#define CHANNEL_ST (CHANNEL_T|CHANNEL_STURBO) -#define CHANNEL_108G (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO) -#define CHANNEL_108A CHANNEL_T -#define CHANNEL_G_HT20 (CHANNEL_G|CHANNEL_HT20) -#define CHANNEL_A_HT20 (CHANNEL_A|CHANNEL_HT20) -#define CHANNEL_G_HT40PLUS (CHANNEL_G|CHANNEL_HT40PLUS) -#define CHANNEL_G_HT40MINUS (CHANNEL_G|CHANNEL_HT40MINUS) -#define CHANNEL_A_HT40PLUS (CHANNEL_A|CHANNEL_HT40PLUS) -#define CHANNEL_A_HT40MINUS (CHANNEL_A|CHANNEL_HT40MINUS) -#define CHANNEL_ALL \ - (CHANNEL_OFDM | CHANNEL_CCK| CHANNEL_2GHZ | CHANNEL_5GHZ | \ - CHANNEL_TURBO | CHANNEL_HT20 | CHANNEL_HT40PLUS | CHANNEL_HT40MINUS) -#define CHANNEL_ALL_NOTURBO (CHANNEL_ALL &~ CHANNEL_TURBO) +typedef uint16_t HAL_CTRY_CODE; /* country code */ +typedef uint16_t HAL_REG_DOMAIN; /* regulatory domain code */ #define HAL_ANTENNA_MIN_MODE 0 #define HAL_ANTENNA_FIXED_A 1 @@ -434,14 +380,6 @@ typedef struct { uint32_t beacons; } HAL_MIB_STATS; -typedef uint16_t HAL_CTRY_CODE; /* country code */ -typedef uint16_t HAL_REG_DOMAIN; /* regulatory domain code */ - -enum { - CTRY_DEBUG = 0x1ff, /* debug country code */ - CTRY_DEFAULT = 0 /* default country code */ -}; - enum { HAL_MODE_11A = 0x001, /* 11a channels */ HAL_MODE_TURBO = 0x002, /* 11a turbo-only channels */ @@ -630,6 +568,7 @@ typedef struct { struct ath_desc; struct ath_tx_status; struct ath_rx_status; +struct ieee80211_channel; /* * Hardware Access Layer (HAL) API. @@ -665,16 +604,18 @@ struct ath_hal { /* Reset functions */ HAL_BOOL __ahdecl(*ah_reset)(struct ath_hal *, HAL_OPMODE, - HAL_CHANNEL *, HAL_BOOL bChannelChange, - HAL_STATUS *status); + struct ieee80211_channel *, + HAL_BOOL bChannelChange, HAL_STATUS *status); HAL_BOOL __ahdecl(*ah_phyDisable)(struct ath_hal *); HAL_BOOL __ahdecl(*ah_disable)(struct ath_hal *); void __ahdecl(*ah_setPCUConfig)(struct ath_hal *); - HAL_BOOL __ahdecl(*ah_perCalibration)(struct ath_hal*, HAL_CHANNEL *, - HAL_BOOL *); - HAL_BOOL __ahdecl(*ah_perCalibrationN)(struct ath_hal *, HAL_CHANNEL *, - u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone); - HAL_BOOL __ahdecl(*ah_resetCalValid)(struct ath_hal *, HAL_CHANNEL *); + HAL_BOOL __ahdecl(*ah_perCalibration)(struct ath_hal*, + struct ieee80211_channel *, HAL_BOOL *); + HAL_BOOL __ahdecl(*ah_perCalibrationN)(struct ath_hal *, + struct ieee80211_channel *, u_int chainMask, + HAL_BOOL longCal, HAL_BOOL *isCalDone); + HAL_BOOL __ahdecl(*ah_resetCalValid)(struct ath_hal *, + const struct ieee80211_channel *); HAL_BOOL __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t); /* Transmit functions */ @@ -735,7 +676,8 @@ struct ath_hal { struct ath_desc *next, uint64_t tsf, struct ath_rx_status *); void __ahdecl(*ah_rxMonitor)(struct ath_hal *, - const HAL_NODE_STATS *, HAL_CHANNEL *); + const HAL_NODE_STATS *, + const struct ieee80211_channel *); void __ahdecl(*ah_procMibEvent)(struct ath_hal *, const HAL_NODE_STATS *); @@ -804,7 +746,8 @@ struct ath_hal { HAL_BOOL __ahdecl(*ah_setPowerMode)(struct ath_hal*, HAL_POWER_MODE mode, int setChip); HAL_POWER_MODE __ahdecl(*ah_getPowerMode)(struct ath_hal*); - int16_t __ahdecl(*ah_getChanNoise)(struct ath_hal *, HAL_CHANNEL *); + int16_t __ahdecl(*ah_getChanNoise)(struct ath_hal *, + const struct ieee80211_channel *); /* Beacon Management Functions */ void __ahdecl(*ah_setBeaconTimers)(struct ath_hal*, @@ -847,53 +790,64 @@ extern struct ath_hal * __ahdecl ath_hal HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS* status); /* - * Return a list of channels available for use with the hardware. - * The list is based on what the hardware is capable of, the specified - * country code, the modeSelect mask, and whether or not outdoor - * channels are to be permitted. + * Regulatory interfaces. Drivers should use ath_hal_init_channels to + * request a set of channels for a particular country code and/or + * regulatory domain. If CTRY_DEFAULT and SKU_NONE are specified then + * this list is constructed according to the contents of the EEPROM. + * ath_hal_getchannels acts similarly but does not alter the operating + * state; this can be used to collect information for a particular + * regulatory configuration. Finally ath_hal_set_channels installs a + * channel list constructed outside the driver. The HAL will adopt the + * channel list and setup internal state according to the specified + * regulatory configuration (e.g. conformance test limits). * - * The channel list is returned in the supplied array. maxchans - * defines the maximum size of this array. nchans contains the actual - * number of channels returned. If a problem occurred or there were - * no channels that met the criteria then AH_FALSE is returned. - */ -extern HAL_BOOL __ahdecl ath_hal_init_channels(struct ath_hal *, - HAL_CHANNEL *chans, u_int maxchans, u_int *nchans, - uint8_t *regclassids, u_int maxregids, u_int *nregids, - HAL_CTRY_CODE cc, u_int modeSelect, - HAL_BOOL enableOutdoor, HAL_BOOL enableExtendedChannels); + * For all interfaces the channel list is returned in the supplied array. + * maxchans defines the maximum size of this array. nchans contains the + * actual number of channels returned. If a problem occurred then a + * status code != HAL_OK is returned. + */ +struct ieee80211_channel; /* - * Calibrate noise floor data following a channel scan or similar. - * This must be called prior retrieving noise floor data. + * Return a list of channels according to the specified regulatory. */ -extern void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah); +extern HAL_STATUS __ahdecl ath_hal_getchannels(struct ath_hal *, + struct ieee80211_channel *chans, u_int maxchans, int *nchans, + u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn, + HAL_BOOL enableExtendedChannels); /* - * Return bit mask of wireless modes supported by the hardware. + * Return a list of channels and install it as the current operating + * regulatory list. */ -extern u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*, HAL_CTRY_CODE); +extern HAL_STATUS __ahdecl ath_hal_init_channels(struct ath_hal *, + struct ieee80211_channel *chans, u_int maxchans, int *nchans, + u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN rd, + HAL_BOOL enableExtendedChannels); /* - * Calculate the transmit duration of a frame. + * Install the list of channels as the current operating regulatory + * and setup related state according to the country code and sku. */ -extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, - const HAL_RATE_TABLE *rates, uint32_t frameLen, - uint16_t rateix, HAL_BOOL shortPreamble); +extern HAL_STATUS __ahdecl ath_hal_set_channels(struct ath_hal *, + struct ieee80211_channel *chans, int nchans, + HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn); /* - * Return if device is public safety. + * Calibrate noise floor data following a channel scan or similar. + * This must be called prior retrieving noise floor data. */ -extern HAL_BOOL __ahdecl ath_hal_ispublicsafetysku(struct ath_hal *); +extern void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah); /* - * Return if device is operating in 900 MHz band. + * Return bit mask of wireless modes supported by the hardware. */ -extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *); +extern u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*); /* - * Convert between IEEE channel number and channel frequency - * using the specified channel flags; e.g. CHANNEL_2GHZ. + * Calculate the transmit duration of a frame. */ -extern int __ahdecl ath_hal_mhz2ieee(struct ath_hal *, u_int mhz, u_int flags); +extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, + const HAL_RATE_TABLE *rates, uint32_t frameLen, + uint16_t rateix, HAL_BOOL shortPreamble); #endif /* _ATH_AH_H_ */ Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah_internal.h Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2002-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -27,6 +27,8 @@ #define AH_MIN(a,b) ((a)<(b)?(a):(b)) #define AH_MAX(a,b) ((a)>(b)?(a):(b)) +#include + #ifndef NBBY #define NBBY 8 /* number of bits/byte */ #endif @@ -108,32 +110,44 @@ OS_DATA_SET(ah_rfs, _name##_rf) struct ath_hal_rf *ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode); /* - * Internal form of a HAL_CHANNEL. Note that the structure - * must be defined such that you can cast references to a - * HAL_CHANNEL so don't shuffle the first two members. + * Maximum number of internal channels. Entries are per unique + * frequency so this might be need to be increased to handle all + * usage cases; typically no more than 32 are really needed but + * dynamically allocating the data structures is a bit painful + * right now. + */ +#ifndef AH_MAXCHAN +#define AH_MAXCHAN 96 +#endif + +/* + * Internal per-channel state. These are found + * using ic_devdata in the ieee80211_channel. */ typedef struct { - uint32_t channelFlags; - uint16_t channel; /* NB: must be first for casting */ + uint16_t channel; /* h/w frequency, NB: may be mapped */ uint8_t privFlags; - int8_t maxRegTxPower; - int8_t maxTxPower; - int8_t minTxPower; /* as above... */ - - HAL_BOOL bssSendHere; - uint8_t gainI; - HAL_BOOL iqCalValid; - uint8_t calValid; /* bitmask of cal types */ +#define CHANNEL_IQVALID 0x01 /* IQ calibration valid */ +#define CHANNEL_ANI_INIT 0x02 /* ANI state initialized */ +#define CHANNEL_ANI_SETUP 0x04 /* ANI state setup */ + uint8_t calValid; /* bitmask of cal types */ int8_t iCoff; int8_t qCoff; int16_t rawNoiseFloor; int16_t noiseFloorAdjust; - int8_t antennaMax; - uint32_t regDmnFlags; /* Flags for channel use in reg */ - uint32_t conformanceTestLimit; /* conformance test limit from reg domain */ - uint16_t mainSpur; /* cached spur value for this cahnnel */ + uint16_t mainSpur; /* cached spur value for this channel */ } HAL_CHANNEL_INTERNAL; +/* channel requires noise floor check */ +#define CHANNEL_NFCREQUIRED IEEE80211_CHAN_PRIV0 + +/* all full-width channels */ +#define IEEE80211_CHAN_ALLFULL \ + (IEEE80211_CHAN_ALL - (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) +#define IEEE80211_CHAN_ALLTURBOFULL \ + (IEEE80211_CHAN_ALLTURBO - \ + (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) + typedef struct { uint32_t halChanSpreadSupport : 1, halSleepAfterBeaconBroken : 1, @@ -189,6 +203,8 @@ typedef struct { uint8_t halNumAntCfg5GHz; } HAL_CAPABILITIES; +struct regDomain; + /* * The ``private area'' follows immediately after the ``public area'' * in the data structure returned by ath_hal_attach. Private data are @@ -228,7 +244,7 @@ struct ath_hal_private { uint32_t gpio, uint32_t val); void (*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t); HAL_BOOL (*ah_getChipPowerLimits)(struct ath_hal *, - HAL_CHANNEL *, uint32_t); + struct ieee80211_channel *); int16_t (*ah_getNfAdjust)(struct ath_hal *, const HAL_CHANNEL_INTERNAL*); void (*ah_getNoiseFloor)(struct ath_hal *, @@ -255,8 +271,8 @@ struct ath_hal_private { uint16_t ah_analog5GhzRev; /* 2GHz radio revision */ uint16_t ah_analog2GhzRev; /* 5GHz radio revision */ - HAL_OPMODE ah_opmode; /* operating mode from reset */ + const struct ieee80211_channel *ah_curchan;/* operating channel */ HAL_CAPABILITIES ah_caps; /* device capabilities */ uint32_t ah_diagreg; /* user-specified AR_DIAG_SW */ int16_t ah_powerLimit; /* tx power cap */ @@ -267,14 +283,13 @@ struct ath_hal_private { /* * State for regulatory domain handling. */ - HAL_REG_DOMAIN ah_currentRD; /* Current regulatory domain */ - HAL_CTRY_CODE ah_countryCode; /* current country code */ - HAL_CHANNEL_INTERNAL ah_channels[256]; /* calculated channel list */ - u_int ah_nchan; /* valid channels in list */ - HAL_CHANNEL_INTERNAL *ah_curchan; /* current channel */ + HAL_REG_DOMAIN ah_currentRD; /* EEPROM regulatory domain */ + HAL_CHANNEL_INTERNAL ah_channels[AH_MAXCHAN]; /* private chan state */ + u_int ah_nchan; /* valid items in ah_channels */ + const struct regDomain *ah_rd2GHz; /* reg state for 2G band */ + const struct regDomain *ah_rd5GHz; /* reg state for 5G band */ uint8_t ah_coverageClass; /* coverage class */ - HAL_BOOL ah_regdomainUpdate; /* regdomain is updated? */ /* * RF Silent handling; setup according to the EEPROM. */ @@ -307,8 +322,8 @@ struct ath_hal_private { AH_PRIVATE(_ah)->ah_gpioGet(_ah, _gpio, _val) #define ath_hal_gpioSetIntr(_ah, _gpio, _ilevel) \ AH_PRIVATE(_ah)->ah_gpioSetIntr(_ah, _gpio, _ilevel) -#define ath_hal_getpowerlimits(_ah, _chans, _nchan) \ - AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chans, _nchan) +#define ath_hal_getpowerlimits(_ah, _chan) \ + AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chan) #define ath_hal_getNfAdjust(_ah, _c) \ AH_PRIVATE(_ah)->ah_getNfAdjust(_ah, _c) #define ath_hal_getNoiseFloor(_ah, _nfArray) \ @@ -327,38 +342,22 @@ struct ath_hal_private { #define ath_hal_eepromDiag(_ah, _request, _a, _asize, _r, _rsize) \ AH_PRIVATE(_ah)->ah_eepromDiag(_ah, _request, _a, _asize, _r, _rsize) -#if !defined(_NET_IF_IEEE80211_H_) && !defined(_NET80211__IEEE80211_H_) +#ifndef _NET_IF_IEEE80211_H_ /* * Stuff that would naturally come from _ieee80211.h */ #define IEEE80211_ADDR_LEN 6 -#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ #define IEEE80211_WEP_IVLEN 3 /* 24bit */ #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ #define IEEE80211_CRC_LEN 4 -#define IEEE80211_MTU 1500 #define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) - -enum { - IEEE80211_T_DS, /* direct sequence spread spectrum */ - IEEE80211_T_FH, /* frequency hopping */ - IEEE80211_T_OFDM, /* frequency division multiplexing */ - IEEE80211_T_TURBO, /* high rate DS */ - IEEE80211_T_HT, /* HT - full GI */ -}; -#define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclatur */ #endif /* _NET_IF_IEEE80211_H_ */ -/* NB: these are defined privately until XR support is announced */ -enum { - ATHEROS_T_XR = IEEE80211_T_HT+1, /* extended range */ -}; - #define HAL_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001 #define INIT_AIFS 2 @@ -411,43 +410,11 @@ typedef enum { #define HAL_BIN_WIDTH_TURBO_100HZ 6250 #define HAL_MAX_BINS_ALLOWED 28 -/* - * A = 5GHZ|OFDM - * T = 5GHZ|OFDM|TURBO - * - * IS_CHAN_A(T) will return TRUE. This is probably - * not the default behavior we want. We should migrate to a better mask -- - * perhaps CHANNEL_ALL. - * - * For now, IS_CHAN_G() masks itself with CHANNEL_108G. - * - */ - -#define IS_CHAN_A(_c) (((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) -#define IS_CHAN_B(_c) (((_c)->channelFlags & CHANNEL_B) == CHANNEL_B) -#define IS_CHAN_G(_c) (((_c)->channelFlags & (CHANNEL_108G|CHANNEL_G)) == CHANNEL_G) -#define IS_CHAN_108G(_c)(((_c)->channelFlags & CHANNEL_108G) == CHANNEL_108G) -#define IS_CHAN_T(_c) (((_c)->channelFlags & CHANNEL_T) == CHANNEL_T) -#define IS_CHAN_PUREG(_c) \ - (((_c)->channelFlags & CHANNEL_PUREG) == CHANNEL_PUREG) - -#define IS_CHAN_TURBO(_c) (((_c)->channelFlags & CHANNEL_TURBO) != 0) -#define IS_CHAN_CCK(_c) (((_c)->channelFlags & CHANNEL_CCK) != 0) -#define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0) -#define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0) -#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0) -#define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0) -#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0) -#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0) +#define IS_CHAN_5GHZ(_c) ((_c)->channel > 4900) +#define IS_CHAN_2GHZ(_c) (!IS_CHAN_5GHZ(_c)) #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990) -#define CHANNEL_HT40 (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS) -#define CHANNEL_HT (CHANNEL_HT20 | CHANNEL_HT40) -#define IS_CHAN_HT(_c) (((_c)->channelFlags & CHANNEL_HT) != 0) -#define IS_CHAN_HT20(_c) (((_c)->channelFlags & CHANNEL_HT) == CHANNEL_HT20) -#define IS_CHAN_HT40(_c) (((_c)->channelFlags & CHANNEL_HT40) != 0) - /* * Deduce if the host cpu has big- or litt-endian byte order. */ @@ -486,37 +453,6 @@ isBigEndian(void) #define OS_REG_CLR_BIT(_a, _r, _f) \ OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) &~ (_f)) -/* - * Regulatory domain support. - */ - -/* - * Return the max allowed antenna gain based on the current - * regulatory domain. - */ -extern u_int ath_hal_getantennareduction(struct ath_hal *, - HAL_CHANNEL *, u_int twiceGain); -/* - * Return the test group for the specific channel based on - * the current regulator domain. - */ -extern u_int ath_hal_getctl(struct ath_hal *, HAL_CHANNEL *); -/* - * Return whether or not a noise floor check is required - * based on the current regulatory domain for the specified - * channel. - */ -extern u_int ath_hal_getnfcheckrequired(struct ath_hal *, HAL_CHANNEL *); - -/* - * Map a public channel definition to the corresponding - * internal data structure. This implicitly specifies - * whether or not the specified channel is ok to use - * based on the current regulatory domain constraints. - */ -extern HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *, - const HAL_CHANNEL *); - /* system-configurable parameters */ extern int ath_hal_dma_beacon_response_time; /* in TU's */ extern int ath_hal_sw_beacon_response_time; /* in TU's */ @@ -575,6 +511,57 @@ extern void ath_hal_assert_failed(const #define HALASSERT(_x) #endif /* AH_ASSERT */ +/* + * Regulatory domain support. + */ + +/* + * Return the max allowed antenna gain and apply any regulatory + * domain specific changes. + */ +u_int ath_hal_getantennareduction(struct ath_hal *ah, + const struct ieee80211_channel *chan, u_int twiceGain); + +/* + * Return the test group for the specific channel based on + * the current regulatory setup. + */ +u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *); + +/* + * Map a public channel definition to the corresponding + * internal data structure. This implicitly specifies + * whether or not the specified channel is ok to use + * based on the current regulatory domain constraints. + */ +#ifndef AH_DEBUG +static OS_INLINE HAL_CHANNEL_INTERNAL * +ath_hal_checkchannel(struct ath_hal *ah, const struct ieee80211_channel *c) +{ + HAL_CHANNEL_INTERNAL *cc; + + HALASSERT(c->ic_devdata < AH_PRIVATE(ah)->ah_nchan); + cc = &AH_PRIVATE(ah)->ah_channels[c->ic_devdata]; + HALASSERT(c->ic_freq == cc->channel || IEEE80211_IS_CHAN_GSM(c)); + return cc; +} +#else +/* NB: non-inline version that checks state */ +HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *, + const struct ieee80211_channel *); +#endif /* AH_DEBUG */ + +/* + * Return the h/w frequency for a channel. This may be + * different from ic_freq if this is a GSM device that + * takes 2.4GHz frequencies and down-converts them. + */ +static OS_INLINE uint16_t +ath_hal_gethwchannel(struct ath_hal *ah, const struct ieee80211_channel *c) +{ + return ath_hal_checkchannel(ah, c)->channel; +} + /* * Convert between microseconds and core system clocks. */ @@ -733,7 +720,7 @@ extern void ath_hal_setupratetable(struc /* * Common routine for implementing getChanNoise api. */ -extern int16_t ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan); +int16_t ath_hal_getChanNoise(struct ath_hal *, const struct ieee80211_channel *); /* * Initialization support. Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_regdomain.c Wed Jan 28 17:57:16 2009 (r187830) +++ head/sys/dev/ath/ath_hal/ah_regdomain.c Wed Jan 28 18:00:22 2009 (r187831) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * Copyright (c) 2005-2006 Atheros Communications, Inc. * All rights reserved. * @@ -20,6 +20,10 @@ #include "opt_ah.h" #include "ah.h" + +#include +#include + #include "ah_internal.h" #include "ah_eeprom.h" #include "ah_devid.h" @@ -34,10 +38,6 @@ #define HAL_MODE_11A_TURBO HAL_MODE_108A #define HAL_MODE_11G_TURBO HAL_MODE_108G -/* 10MHz is half the 11A bandwidth used to determine upper edge freq - of the outdoor channel */ -#define HALF_MAXCHANBW 10 - /* * BMLEN defines the size of the bitmask used to hold frequency * band specifications. Note this must agree with the BM macro @@ -76,160 +76,6 @@ typedef uint64_t chanbmask_t[BMLEN]; W1(_fg) | W1(_fh) } /* - * Country/Region Codes - * Numbering from ISO 3166 - */ -enum { - CTRY_ALBANIA = 8, /* Albania */ - CTRY_ALGERIA = 12, /* Algeria */ - CTRY_ARGENTINA = 32, /* Argentina */ - CTRY_ARMENIA = 51, /* Armenia */ - CTRY_AUSTRALIA = 36, /* Australia */ - CTRY_AUSTRIA = 40, /* Austria */ - CTRY_AZERBAIJAN = 31, /* Azerbaijan */ - CTRY_BAHRAIN = 48, /* Bahrain */ - CTRY_BELARUS = 112, /* Belarus */ - CTRY_BELGIUM = 56, /* Belgium */ - CTRY_BELIZE = 84, /* Belize */ - CTRY_BOLIVIA = 68, /* Bolivia */ - CTRY_BRAZIL = 76, /* Brazil */ - CTRY_BRUNEI_DARUSSALAM = 96, /* Brunei Darussalam */ - CTRY_BULGARIA = 100, /* Bulgaria */ - CTRY_CANADA = 124, /* Canada */ - CTRY_CHILE = 152, /* Chile */ - CTRY_CHINA = 156, /* People's Republic of China */ - CTRY_COLOMBIA = 170, /* Colombia */ - CTRY_COSTA_RICA = 188, /* Costa Rica */ - CTRY_CROATIA = 191, /* Croatia */ - CTRY_CYPRUS = 196, - CTRY_CZECH = 203, /* Czech Republic */ - CTRY_DENMARK = 208, /* Denmark */ - CTRY_DOMINICAN_REPUBLIC = 214, /* Dominican Republic */ - CTRY_ECUADOR = 218, /* Ecuador */ - CTRY_EGYPT = 818, /* Egypt */ - CTRY_EL_SALVADOR = 222, /* El Salvador */ - CTRY_ESTONIA = 233, /* Estonia */ - CTRY_FAEROE_ISLANDS = 234, /* Faeroe Islands */ - CTRY_FINLAND = 246, /* Finland */ - CTRY_FRANCE = 250, /* France */ - CTRY_FRANCE2 = 255, /* France2 */ - CTRY_GEORGIA = 268, /* Georgia */ - CTRY_GERMANY = 276, /* Germany */ - CTRY_GREECE = 300, /* Greece */ - CTRY_GUATEMALA = 320, /* Guatemala */ - CTRY_HONDURAS = 340, /* Honduras */ - CTRY_HONG_KONG = 344, /* Hong Kong S.A.R., P.R.C. */ - CTRY_HUNGARY = 348, /* Hungary */ - CTRY_ICELAND = 352, /* Iceland */ - CTRY_INDIA = 356, /* India */ - CTRY_INDONESIA = 360, /* Indonesia */ - CTRY_IRAN = 364, /* Iran */ - CTRY_IRAQ = 368, /* Iraq */ - CTRY_IRELAND = 372, /* Ireland */ - CTRY_ISRAEL = 376, /* Israel */ - CTRY_ITALY = 380, /* Italy */ - CTRY_JAMAICA = 388, /* Jamaica */ - CTRY_JAPAN = 392, /* Japan */ - CTRY_JAPAN1 = 393, /* Japan (JP1) */ - CTRY_JAPAN2 = 394, /* Japan (JP0) */ - CTRY_JAPAN3 = 395, /* Japan (JP1-1) */ - CTRY_JAPAN4 = 396, /* Japan (JE1) */ - CTRY_JAPAN5 = 397, /* Japan (JE2) */ - CTRY_JAPAN6 = 399, /* Japan (JP6) */ - - CTRY_JAPAN7 = 4007, /* Japan (J7) */ - CTRY_JAPAN8 = 4008, /* Japan (J8) */ - CTRY_JAPAN9 = 4009, /* Japan (J9) */ - - CTRY_JAPAN10 = 4010, /* Japan (J10) */ - CTRY_JAPAN11 = 4011, /* Japan (J11) */ - CTRY_JAPAN12 = 4012, /* Japan (J12) */ - - CTRY_JAPAN13 = 4013, /* Japan (J13) */ - CTRY_JAPAN14 = 4014, /* Japan (J14) */ - CTRY_JAPAN15 = 4015, /* Japan (J15) */ - - CTRY_JAPAN16 = 4016, /* Japan (J16) */ - CTRY_JAPAN17 = 4017, /* Japan (J17) */ - CTRY_JAPAN18 = 4018, /* Japan (J18) */ - - CTRY_JAPAN19 = 4019, /* Japan (J19) */ - CTRY_JAPAN20 = 4020, /* Japan (J20) */ - CTRY_JAPAN21 = 4021, /* Japan (J21) */ - - CTRY_JAPAN22 = 4022, /* Japan (J22) */ - CTRY_JAPAN23 = 4023, /* Japan (J23) */ - CTRY_JAPAN24 = 4024, /* Japan (J24) */ - - CTRY_JORDAN = 400, /* Jordan */ - CTRY_KAZAKHSTAN = 398, /* Kazakhstan */ - CTRY_KENYA = 404, /* Kenya */ - CTRY_KOREA_NORTH = 408, /* North Korea */ - CTRY_KOREA_ROC = 410, /* South Korea */ - CTRY_KOREA_ROC2 = 411, /* South Korea */ - CTRY_KOREA_ROC3 = 412, /* South Korea */ - CTRY_KUWAIT = 414, /* Kuwait */ - CTRY_LATVIA = 428, /* Latvia */ - CTRY_LEBANON = 422, /* Lebanon */ - CTRY_LIBYA = 434, /* Libya */ - CTRY_LIECHTENSTEIN = 438, /* Liechtenstein */ - CTRY_LITHUANIA = 440, /* Lithuania */ - CTRY_LUXEMBOURG = 442, /* Luxembourg */ - CTRY_MACAU = 446, /* Macau */ - CTRY_MACEDONIA = 807, /* the Former Yugoslav Republic of Macedonia */ - CTRY_MALAYSIA = 458, /* Malaysia */ - CTRY_MALTA = 470, /* Malta */ - CTRY_MEXICO = 484, /* Mexico */ - CTRY_MONACO = 492, /* Principality of Monaco */ - CTRY_MOROCCO = 504, /* Morocco */ - CTRY_NETHERLANDS = 528, /* Netherlands */ - CTRY_NEW_ZEALAND = 554, /* New Zealand */ - CTRY_NICARAGUA = 558, /* Nicaragua */ - CTRY_NORWAY = 578, /* Norway */ - CTRY_OMAN = 512, /* Oman */ - CTRY_PAKISTAN = 586, /* Islamic Republic of Pakistan */ - CTRY_PANAMA = 591, /* Panama */ - CTRY_PARAGUAY = 600, /* Paraguay */ - CTRY_PERU = 604, /* Peru */ - CTRY_PHILIPPINES = 608, /* Republic of the Philippines */ - CTRY_POLAND = 616, /* Poland */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***