svn commit: r187620 - in user/sam/wifi/sys/dev/ath: . ath_hal
ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5312
ath_hal/ar5416
Sam Leffler
sam at FreeBSD.org
Thu Jan 22 23:00:34 PST 2009
Author: sam
Date: Fri Jan 23 07:00:33 2009
New Revision: 187620
URL: http://svn.freebsd.org/changeset/base/187620
Log:
Checkpoint gutting of HAL_CHANNEL:
o replace uses of HAL_CHANNEL by struct ieee80211_channel
o remove HAL_CHANNEL shadow state from HAL_CHANNEL_PRIVATE; instead users
are given an ieee80211_channel and if they need private state they use
ic_devdata to find the private channel (shrinks private chans by 12 bytes)
o pack the private channel array (one entry per frequency)
o mark 802.11 channels directly when interference is detected
o use ic_devdata to index into ani state cache; note this consolidates
state for enumerated channels so can change behaviour (e.g. for b/g
and turbo combinations)
o remove private mhz2->ieee conversion routines as we now get the ieee
channel number directly from ic_ieee
o setup 11g channels with correct channel flags (used to mark them pureg
and then futz the flags when constructing net80211 channels)
o remove conversion code in regulatory routines now that we don't do any
conversion to/from private/internal data structures
o de-inline ath_hal_getantennareduction
Note: HAL_CHANNEL_PRIVATE temporarily shadows the frequency to validate
lookups and facilitate noise floor processing; this will go away soon
Note: ath_hal_computetxtime needs take a channel to eliminate use of
ah_curchan (possibly other routines too)
Note: channel interference handling should be moved to a callback so we
can const'ify parameters and eliminate assumptions about when/how
detection is done
Note: private channel table can shrink and ani state table should be the
same size to avoid checking references
Note: ath_hal_checkchannel should be inlined when we stop validating lookups
Note: privFlags can go away if we move CHANNEL_IQVALID elsewhere but might
be worth keeping as removing it won't shrink HAL_CHANNEL_PRIVATE
Note: purge direct use of ic_flags (e.g. in switch statements)
Tested in sta mode on 5210, 5211, 5416, and a wide variety of 5212 cards
in normal modes; turbo modes need testing.
Modified:
user/sam/wifi/sys/dev/ath/ (props changed)
user/sam/wifi/sys/dev/ath/ath_hal/ah.c
user/sam/wifi/sys/dev/ath/ath_hal/ah.h
user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h
user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210.h
user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5211/ar5211.h
user/sam/wifi/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar2316.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar2317.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar2413.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar2425.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5111.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5112.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5212.h
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5212/ar5413.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5312/ar5312.h
user/sam/wifi/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5416/ar2133.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5416/ar5416.h
user/sam/wifi/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
user/sam/wifi/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h
user/sam/wifi/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
user/sam/wifi/sys/dev/ath/if_ath.c
user/sam/wifi/sys/dev/ath/if_athvar.h
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ah.c Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ah.c Fri Jan 23 07:00:33 2009 (r187620)
@@ -161,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:
@@ -196,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);
@@ -206,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);
@@ -272,15 +274,15 @@ typedef enum {
} WIRELESS_MODE;
static WIRELESS_MODE
-ath_hal_chan2wmode(struct ath_hal *ah, const HAL_CHANNEL_INTERNAL *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;
}
@@ -294,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_INTERNAL *c = 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];
@@ -314,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_INTERNAL *c = 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];
@@ -704,7 +706,7 @@ static const int16_t NOISE_FLOOR[] = { -
* implement the ah_getChanNoise method.
*/
int16_t
-ath_hal_getChanNoise(struct ath_hal *ah, const HAL_CHANNEL *chan)
+ath_hal_getChanNoise(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
HAL_CHANNEL_INTERNAL *ichan;
@@ -712,11 +714,11 @@ 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) {
- WIRELESS_MODE mode = ath_hal_chan2wmode(ah, ichan);
+ WIRELESS_MODE mode = ath_hal_chan2wmode(ah, chan);
HALASSERT(mode < WIRELESS_MODE_MAX);
return NOISE_FLOOR[mode] + ath_hal_getNfAdjust(ah, ichan);
@@ -751,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, 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)) {
@@ -778,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: user/sam/wifi/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ah.h Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ah.h Fri Jan 23 07:00:33 2009 (r187620)
@@ -367,54 +367,6 @@ typedef enum {
typedef uint16_t HAL_CTRY_CODE; /* country code */
typedef uint16_t HAL_REG_DOMAIN; /* regulatory domain code */
-typedef struct {
- uint32_t channelFlags;
- uint16_t channel; /* NB: must be first for casting */
- uint16_t devdata; /* XXX temp */
-} HAL_CHANNEL;
-
-/* channelFlags */
-#define CHANNEL_NFCREQUIRED 0x01 /* channel requires noise floor check */
-#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 */
-#define CHANNEL_DFS 0x80000 /* DFS required on channel */
-#define CHANNEL_4MS_LIMIT 0x00100000 /* 4msec packet limit on this channel */
-
-#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)
-
#define HAL_ANTENNA_MIN_MODE 0
#define HAL_ANTENNA_FIXED_A 1
#define HAL_ANTENNA_FIXED_B 2
@@ -616,6 +568,7 @@ typedef struct {
struct ath_desc;
struct ath_tx_status;
struct ath_rx_status;
+struct ieee80211_channel;
/*
* Hardware Access Layer (HAL) API.
@@ -651,18 +604,18 @@ struct ath_hal {
/* Reset functions */
HAL_BOOL __ahdecl(*ah_reset)(struct ath_hal *, HAL_OPMODE,
- HAL_CHANNEL *,
+ 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 *);
+ struct ieee80211_channel *, HAL_BOOL *);
HAL_BOOL __ahdecl(*ah_perCalibrationN)(struct ath_hal *,
- HAL_CHANNEL *, u_int chainMask,
+ struct ieee80211_channel *, u_int chainMask,
HAL_BOOL longCal, HAL_BOOL *isCalDone);
HAL_BOOL __ahdecl(*ah_resetCalValid)(struct ath_hal *,
- const HAL_CHANNEL *);
+ const struct ieee80211_channel *);
HAL_BOOL __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
/* Transmit functions */
@@ -724,7 +677,7 @@ struct ath_hal {
struct ath_rx_status *);
void __ahdecl(*ah_rxMonitor)(struct ath_hal *,
const HAL_NODE_STATS *,
- const HAL_CHANNEL *);
+ const struct ieee80211_channel *);
void __ahdecl(*ah_procMibEvent)(struct ath_hal *,
const HAL_NODE_STATS *);
@@ -794,7 +747,7 @@ 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 *,
- const HAL_CHANNEL *);
+ const struct ieee80211_channel *);
/* Beacon Management Functions */
void __ahdecl(*ah_setBeaconTimers)(struct ath_hal*,
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ah_internal.h Fri Jan 23 07:00:33 2009 (r187620)
@@ -27,6 +27,8 @@
#define AH_MIN(a,b) ((a)<(b)?(a):(b))
#define AH_MAX(a,b) ((a)>(b)?(a):(b))
+#include <net80211/_ieee80211.h>
+
#ifndef NBBY
#define NBBY 8 /* number of bits/byte */
#endif
@@ -112,30 +114,20 @@ struct ath_hal_rf *ath_hal_rfprobe(struc
* using ic_devdata in the ieee80211_channel.
*/
typedef struct {
- uint32_t channelFlags;
- uint16_t channel; /* NB: must be first for casting */
- uint16_t devdata; /* XXX temp */
- int8_t maxRegTxPower;
- int8_t maxTxPower;
- int8_t minTxPower;
- uint8_t antennaMax;
-
- uint8_t privFlags;
- uint8_t ctl; /* conformance test limit */
+ uint16_t channel;
+ uint8_t privFlags; /* XXX remove */
+#define CHANNEL_IQVALID 0x01 /* IQ calibration valid */
uint8_t calValid; /* bitmask of cal types */
int8_t iCoff;
int8_t qCoff;
- uint8_t pad; /* NB: hole */
int16_t rawNoiseFloor;
int16_t noiseFloorAdjust;
uint16_t mainSpur; /* cached spur value for this channel */
} HAL_CHANNEL_INTERNAL;
+#define CHANNEL_NFCREQUIRED 0x01 /* channel requires noise floor check */
+
/* privFlags */
-#define CHANNEL_INTERFERENCE 0x01 /* Software use: channel interference
- used for as AR as well as RADAR
- interference detection */
-#define CHANNEL_IQVALID 0x02 /* IQ calibration valid */
typedef struct {
uint32_t halChanSpreadSupport : 1,
@@ -233,7 +225,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_INTERNAL *);
+ struct ieee80211_channel *);
int16_t (*ah_getNfAdjust)(struct ath_hal *,
const HAL_CHANNEL_INTERNAL*);
void (*ah_getNoiseFloor)(struct ath_hal *,
@@ -261,7 +253,7 @@ struct ath_hal_private {
uint16_t ah_analog2GhzRev; /* 5GHz radio revision */
HAL_OPMODE ah_opmode; /* operating mode from reset */
- HAL_CHANNEL_INTERNAL *ah_curchan; /* operating channel */
+ 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 */
@@ -417,43 +409,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.
*/
@@ -499,25 +459,15 @@ isBigEndian(void)
/*
* Return the max allowed antenna gain and apply any regulatory
* domain specific changes.
- *
- * NOTE: a negative reduction is possible in RD's that only
- * measure radiated power (e.g., ETSI) which would increase
- * that actual conducted output power (though never beyond
- * the calibrated target power).
- */
-static OS_INLINE u_int
-ath_hal_getantennareduction(struct ath_hal *ah,
- const HAL_CHANNEL_INTERNAL *chan, u_int twiceGain)
-{
- int8_t antennaMax = twiceGain - chan->antennaMax*2;
- return (antennaMax < 0) ? 0 : antennaMax;
-}
+ */
+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 HAL_CHANNEL_INTERNAL *);
+u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *);
/*
* Map a public channel definition to the corresponding
@@ -525,8 +475,8 @@ u_int ath_hal_getctl(struct ath_hal *, c
* 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 *);
+HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *,
+ const struct ieee80211_channel *);
/* system-configurable parameters */
extern int ath_hal_dma_beacon_response_time; /* in TU's */
@@ -744,7 +694,7 @@ extern void ath_hal_setupratetable(struc
/*
* Common routine for implementing getChanNoise api.
*/
-extern int16_t ath_hal_getChanNoise(struct ath_hal *ah, const HAL_CHANNEL* );
+int16_t ath_hal_getChanNoise(struct ath_hal *, const struct ieee80211_channel *);
/*
* Initialization support.
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ah_regdomain.c Fri Jan 23 07:00:33 2009 (r187620)
@@ -1678,22 +1678,30 @@ struct cmode {
};
static const struct cmode modes[] = {
- { HAL_MODE_TURBO, CHANNEL_ST}, /* NB: 11a Static Turbo */
- { HAL_MODE_11A, CHANNEL_A},
- { HAL_MODE_11B, CHANNEL_B},
- { HAL_MODE_11G, CHANNEL_G},
- { HAL_MODE_11G_TURBO, CHANNEL_108G},
- { HAL_MODE_11A_TURBO, CHANNEL_108A},
- { HAL_MODE_11A_QUARTER_RATE, CHANNEL_A | CHANNEL_QUARTER},
- { HAL_MODE_11A_HALF_RATE, CHANNEL_A | CHANNEL_HALF},
- { HAL_MODE_11G_QUARTER_RATE, CHANNEL_G | CHANNEL_QUARTER},
- { HAL_MODE_11G_HALF_RATE, CHANNEL_G | CHANNEL_HALF},
- { HAL_MODE_11NG_HT20, CHANNEL_G_HT20},
- { HAL_MODE_11NG_HT40PLUS, CHANNEL_G_HT40PLUS},
- { HAL_MODE_11NG_HT40MINUS, CHANNEL_G_HT40MINUS},
- { HAL_MODE_11NA_HT20, CHANNEL_A_HT20},
- { HAL_MODE_11NA_HT40PLUS, CHANNEL_A_HT40PLUS},
- { HAL_MODE_11NA_HT40MINUS, CHANNEL_A_HT40MINUS},
+ { HAL_MODE_TURBO, IEEE80211_CHAN_ST },
+ { HAL_MODE_11A, IEEE80211_CHAN_A },
+ { HAL_MODE_11B, IEEE80211_CHAN_B },
+ { HAL_MODE_11G, IEEE80211_CHAN_G },
+ { HAL_MODE_11G_TURBO, IEEE80211_CHAN_108G },
+ { HAL_MODE_11A_TURBO, IEEE80211_CHAN_108A },
+ { HAL_MODE_11A_QUARTER_RATE,
+ IEEE80211_CHAN_A | IEEE80211_CHAN_QUARTER },
+ { HAL_MODE_11A_HALF_RATE,
+ IEEE80211_CHAN_A | IEEE80211_CHAN_HALF },
+ { HAL_MODE_11G_QUARTER_RATE,
+ IEEE80211_CHAN_G | IEEE80211_CHAN_QUARTER },
+ { HAL_MODE_11G_HALF_RATE,
+ IEEE80211_CHAN_G | IEEE80211_CHAN_HALF },
+ { HAL_MODE_11NG_HT20, IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT20 },
+ { HAL_MODE_11NG_HT40PLUS,
+ IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40U },
+ { HAL_MODE_11NG_HT40MINUS,
+ IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40D },
+ { HAL_MODE_11NA_HT20, IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT20 },
+ { HAL_MODE_11NA_HT40PLUS,
+ IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40U },
+ { HAL_MODE_11NA_HT40MINUS,
+ IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40D },
};
static OS_INLINE uint16_t
@@ -1917,10 +1925,8 @@ getregstate(struct ath_hal *ah, HAL_CTRY
}
if (pcountry != AH_NULL)
*pcountry = country;
- if (prd2GHz != AH_NULL)
- *prd2GHz = rd2GHz;
- if (prd5GHz != AH_NULL)
- *prd5GHz = rd5GHz;
+ *prd2GHz = rd2GHz;
+ *prd5GHz = rd5GHz;
return HAL_OK;
}
@@ -2111,19 +2117,17 @@ getchannels(struct ath_hal *ah,
ic->ic_freq = c;
ic->ic_flags = cm->flags;
ic->ic_maxregpower = fband->powerDfs;
+ ath_hal_getpowerlimits(ah, ic);
ic->ic_maxantgain = fband->antennaMax;
if (fband->usePassScan & pscan)
ic->ic_flags |= IEEE80211_CHAN_PASSIVE;
else
ic->ic_flags &= ~IEEE80211_CHAN_PASSIVE;
lastc = c;
- if (fband->useDfs & dfsMask) {
- /* DFS and HT40 don't mix */
- if (cm->mode == HAL_MODE_11NA_HT40PLUS ||
- cm->mode == HAL_MODE_11NA_HT40MINUS)
- continue;
+ /* NB: DFS and HT40 don't mix */
+ if ((fband->useDfs & dfsMask) &&
+ !IEEE80211_IS_CHAN_HT40(ic))
ic->ic_flags |= IEEE80211_CHAN_DFS;
- }
if (IEEE80211_IS_CHAN_5GHZ(ic) &&
(rdflags & DISALLOW_ADHOC_11A))
ic->ic_flags |= IEEE80211_CHAN_NOADHOC;
@@ -2137,54 +2141,75 @@ getchannels(struct ath_hal *ah,
if (rdflags & NEED_NFC)
ic->ic_flags |= CHANNEL_NFCREQUIRED;
- /* retrieve power limits */
- { HAL_CHANNEL_INTERNAL hc;
- hc.channel = ic->ic_freq;
- hc.channelFlags = ic->ic_flags;
- if (ath_hal_getpowerlimits(ah, &hc)) {
- ic->ic_maxpower = hc.maxTxPower;
- ic->ic_minpower = hc.minTxPower;
- }
- }
-
ic++, next++;
}
}
}
done:
*nchans = next;
+ /* NB: pcountry set above by getregstate */
+ if (prd2GHz != AH_NULL)
+ *prd2GHz = rd2GHz;
+ if (prd5GHz != AH_NULL)
+ *prd5GHz = rd5GHz;
return HAL_OK;
#undef HAL_MODE_11A_ALL
#undef CHANNEL_HALF_BW
#undef CHANNEL_QUARTER_BW
}
+/*
+ * Retrieve a channel list without affecting runtime state.
+ */
HAL_STATUS
ath_hal_getchannels(struct ath_hal *ah,
struct ieee80211_channel chans[], u_int maxchans, int *nchans,
u_int modeSelect, HAL_CTRY_CODE cc, HAL_REG_DOMAIN regDmn,
HAL_BOOL enableExtendedChannels)
{
- HAL_STATUS status;
- struct ieee80211_channel *c;
- int i;
-
- status = getchannels(ah, chans, maxchans, nchans, modeSelect,
+ return getchannels(ah, chans, maxchans, nchans, modeSelect,
cc, regDmn, enableExtendedChannels, AH_NULL, AH_NULL, AH_NULL);
- if (status == HAL_OK) {
- for (i = 0; i < *nchans; i++) {
- c = &chans[i];
- if (IEEE80211_IS_CHAN_PUREG(c)) {
- /*
- * Except for AR5211, PUREG means mixed
- * DSSS and OFDM; convert to "just G".
- */
- c->ic_flags &= ~IEEE80211_CHAN_PUREG;
- c->ic_flags |= IEEE80211_CHAN_G;
+}
+
+/*
+ * Setup the internal/private channel state given a table of
+ * net80211 channels. We collapse entries for the same frequency
+ * and record the frequency for doing noise floor processing
+ * where we don't have net80211 channel context.
+ */
+static HAL_BOOL
+assignPrivateChannels(struct ath_hal *ah,
+ struct ieee80211_channel chans[], int nchans)
+{
+ HAL_CHANNEL_INTERNAL *ic;
+ int i, j, next;
+
+ next = 0;
+ for (i = 0; i < nchans; i++) {
+ for (j = i-1; j >= 0; j--)
+ if (chans[j].ic_freq == chans[i].ic_freq) {
+ chans[i].ic_devdata = chans[j].ic_devdata;
+ break;
+ }
+ if (j < 0) {
+ /* new entry, assign a private channel entry */
+ if (next >= N(AH_PRIVATE(ah)->ah_channels)) {
+ HALDEBUG(ah, HAL_DEBUG_ANY,
+ "%s: too many channels, max %u\n",
+ __func__, N(AH_PRIVATE(ah)->ah_channels));
+ return AH_FALSE;
}
+ ic = &AH_PRIVATE(ah)->ah_channels[next];
+ OS_MEMZERO(ic, sizeof(*ic));
+ ic->channel = chans[i].ic_freq;
+ chans[i].ic_devdata = next;
+ next++;
}
}
- return status;
+ AH_PRIVATE(ah)->ah_nchan = next;
+ HALDEBUG(ah, HAL_DEBUG_ANY, "%s: %u public, %u private channels\n",
+ __func__, nchans, next);
+ return AH_TRUE;
}
/*
@@ -2199,55 +2224,19 @@ ath_hal_init_channels(struct ath_hal *ah
COUNTRY_CODE_TO_ENUM_RD *country;
REG_DOMAIN *rd5GHz, *rd2GHz;
HAL_STATUS status;
- struct ieee80211_channel *c;
- HAL_CHANNEL_INTERNAL *ic;
- int i;
- if (maxchans > N(AH_PRIVATE(ah)->ah_channels))
- maxchans = N(AH_PRIVATE(ah)->ah_channels);
status = getchannels(ah, chans, maxchans, nchans, modeSelect,
cc, regDmn, enableExtendedChannels, &country, &rd2GHz, &rd5GHz);
- if (status != HAL_OK)
- return status;
- for (i = 0; i < *nchans; i++) {
- c = &chans[i];
- ic = &AH_PRIVATE(ah)->ah_channels[i];
-
- OS_MEMZERO(ic, sizeof(*ic));
- ic->channel = c->ic_freq;
- ic->channelFlags = c->ic_flags;
- ic->devdata = i; /* XXX */
- ic->maxRegTxPower = c->ic_maxregpower;
- ic->maxTxPower = c->ic_maxpower;
- ic->minTxPower = c->ic_minpower;
- ic->antennaMax = c->ic_maxantgain;
-
- c->ic_devdata = i;
-
- if (IEEE80211_IS_CHAN_PUREG(c)) {
- /*
- * Except for AR5211, PUREG means mixed
- * DSSS and OFDM; convert to "just G".
- */
- c->ic_flags &= ~IEEE80211_CHAN_PUREG;
- c->ic_flags |= IEEE80211_CHAN_G;
- }
- HALDEBUG(ah, HAL_DEBUG_REGDOMAIN,
- "[%3u] freq %u/0x%x txpow reg/max/min %u/%u/%u"
- " antmax %u ctl 0x%x\n",
- i, c->ic_freq, c->ic_flags,
- c->ic_maxregpower, c->ic_maxpower, c->ic_minpower,
- c->ic_maxantgain, ic->ctl);
- }
- AH_PRIVATE(ah)->ah_nchan = *nchans;
- AH_PRIVATE(ah)->ah_rd2GHz = rd2GHz;
- AH_PRIVATE(ah)->ah_rd5GHz = rd5GHz;
-
- ah->ah_countryCode = country->countryCode;
- HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s: cc %u\n",
- __func__, ah->ah_countryCode);
-
- return HAL_OK;
+ if (status == HAL_OK && assignPrivateChannels(ah, chans, *nchans)) {
+ AH_PRIVATE(ah)->ah_rd2GHz = rd2GHz;
+ AH_PRIVATE(ah)->ah_rd5GHz = rd5GHz;
+
+ ah->ah_countryCode = country->countryCode;
+ HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s: cc %u\n",
+ __func__, ah->ah_countryCode);
+ } else
+ status = HAL_EINVAL;
+ return status;
}
/*
@@ -2260,77 +2249,45 @@ ath_hal_set_channels(struct ath_hal *ah,
{
COUNTRY_CODE_TO_ENUM_RD *country;
REG_DOMAIN *rd5GHz, *rd2GHz;
- struct ieee80211_channel *c;
- HAL_CHANNEL_INTERNAL *ic;
HAL_STATUS status;
- int i;
- if (nchans > N(AH_PRIVATE(ah)->ah_channels)) {
- HALDEBUG(ah, HAL_DEBUG_ANY, "%s: too many channels, %u > %u\n",
- __func__, nchans, N(AH_PRIVATE(ah)->ah_channels));
- return HAL_EINVAL;
- }
status = getregstate(ah, cc, regDmn, &country, &rd2GHz, &rd5GHz);
- if (status != HAL_OK)
- return status;
- for (i = 0; i < nchans; i++) {
- c = &chans[i];
- ic = &AH_PRIVATE(ah)->ah_channels[i];
-
- OS_MEMZERO(ic, sizeof(*ic));
- ic->channel = c->ic_freq;
- ic->channelFlags = c->ic_flags;
- ic->devdata = i; /* XXX */
- ic->maxRegTxPower = c->ic_maxregpower;
- ic->maxTxPower = c->ic_maxpower;
- ic->minTxPower = c->ic_minpower;
- ic->antennaMax = c->ic_maxantgain;
-
- c->ic_devdata = i;
-
- HALDEBUG(ah, HAL_DEBUG_REGDOMAIN,
- "[%3u] channel %u/0x%x txpow reg/max/min %u/%u/%u"
- " antmax %u ctl 0x%x\n",
- i, ic->channel, ic->channelFlags,
- ic->maxRegTxPower, ic->maxTxPower, ic->minTxPower,
- ic->antennaMax, ic->ctl);
- }
- AH_PRIVATE(ah)->ah_nchan = nchans;
- AH_PRIVATE(ah)->ah_rd2GHz = rd2GHz;
- AH_PRIVATE(ah)->ah_rd5GHz = rd5GHz;
-
- ah->ah_countryCode = country->countryCode;
- HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s: cc %u\n",
- __func__, ah->ah_countryCode);
-
- return HAL_OK;
+ if (status == HAL_OK && assignPrivateChannels(ah, chans, nchans)) {
+ AH_PRIVATE(ah)->ah_rd2GHz = rd2GHz;
+ AH_PRIVATE(ah)->ah_rd5GHz = rd5GHz;
+
+ ah->ah_countryCode = country->countryCode;
+ HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s: cc %u\n",
+ __func__, ah->ah_countryCode);
+ } else
+ status = HAL_EINVAL;
+ return status;
}
/*
* Return the internal channel corresponding to a public channel.
*/
HAL_CHANNEL_INTERNAL *
-ath_hal_checkchannel(struct ath_hal *ah, const HAL_CHANNEL *c)
+ath_hal_checkchannel(struct ath_hal *ah, const struct ieee80211_channel *c)
{
-#define CHAN_FLAGS (CHANNEL_ALL|CHANNEL_HALF|CHANNEL_QUARTER)
- HAL_CHANNEL_INTERNAL *cc;
- /* NB: be wary of user-specified channel flags */
- int flags = c->channelFlags & CHAN_FLAGS;
-
- if (c->devdata > N(AH_PRIVATE(ah)->ah_channels)) {
- /* XXX should not happen */
- HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mapping, devdata %u\n",
- __func__, c->devdata);
- return AH_NULL;
- }
- cc = &AH_PRIVATE(ah)->ah_channels[c->devdata];
- if (cc->channel == c->channel &&
- (cc->channelFlags & CHAN_FLAGS) == flags)
- return cc;
- HALDEBUG(ah, HAL_DEBUG_ANY, "%s: no match for %u/0x%x\n",
- __func__, c->channel, c->channelFlags);
+ /* XXX should not happen */
+ if (c->ic_devdata < AH_PRIVATE(ah)->ah_nchan) {
+ HAL_CHANNEL_INTERNAL *cc =
+ &AH_PRIVATE(ah)->ah_channels[c->ic_devdata];
+ if (c->ic_freq == cc->channel)
+ return cc;
+ }
+ if (c->ic_devdata >= AH_PRIVATE(ah)->ah_nchan) {
+ HALDEBUG(ah, HAL_DEBUG_ANY,
+ "%s: bad mapping, devdata %u nchans %u\n",
+ __func__, c->ic_devdata, AH_PRIVATE(ah)->ah_nchan);
+ } else {
+ HALDEBUG(ah, HAL_DEBUG_ANY,
+ "%s: no match for %u/0x%x devdata %u channel %u\n",
+ __func__, c->ic_freq, c->ic_flags, c->ic_devdata,
+ AH_PRIVATE(ah)->ah_channels[c->ic_devdata].channel);
+ }
return AH_NULL;
-#undef CHAN_FLAGS
}
#define isWwrSKU(_ah) \
@@ -2342,26 +2299,43 @@ ath_hal_checkchannel(struct ath_hal *ah,
* the current regulatory setup.
*/
u_int
-ath_hal_getctl(struct ath_hal *ah, const HAL_CHANNEL_INTERNAL *c)
+ath_hal_getctl(struct ath_hal *ah, const struct ieee80211_channel *c)
{
u_int ctl;
if (AH_PRIVATE(ah)->ah_rd2GHz == AH_PRIVATE(ah)->ah_rd5GHz ||
(ah->ah_countryCode == CTRY_DEFAULT && isWwrSKU(ah)))
ctl = SD_NO_CTL;
- else if (IS_CHAN_2GHZ(c))
+ else if (IEEE80211_IS_CHAN_2GHZ(c))
ctl = AH_PRIVATE(ah)->ah_rd2GHz->conformanceTestLimit;
else
ctl = AH_PRIVATE(ah)->ah_rd5GHz->conformanceTestLimit;
- if (IS_CHAN_B(c))
+ if (IEEE80211_IS_CHAN_B(c))
return ctl | CTL_11B;
- if (IS_CHAN_G(c))
+ if (IEEE80211_IS_CHAN_G(c))
return ctl | CTL_11G;
- if (IS_CHAN_108G(c))
+ if (IEEE80211_IS_CHAN_108G(c))
return ctl | CTL_108G;
- if (IS_CHAN_TURBO(c))
+ if (IEEE80211_IS_CHAN_TURBO(c))
return ctl | CTL_TURBO;
- if (IS_CHAN_A(c))
+ if (IEEE80211_IS_CHAN_A(c))
return ctl | CTL_11A;
return ctl;
}
+
+/*
+ * Return the max allowed antenna gain and apply any regulatory
+ * domain specific changes.
+ *
+ * NOTE: a negative reduction is possible in RD's that only
+ * measure radiated power (e.g., ETSI) which would increase
+ * that actual conducted output power (though never beyond
+ * the calibrated target power).
+ */
+u_int
+ath_hal_getantennareduction(struct ath_hal *ah,
+ const struct ieee80211_channel *chan, u_int twiceGain)
+{
+ int8_t antennaMax = twiceGain - chan->ic_maxantgain*2;
+ return (antennaMax < 0) ? 0 : antennaMax;
+}
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210.h
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210.h Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210.h Fri Jan 23 07:00:33 2009 (r187620)
@@ -128,20 +128,21 @@ struct ath_hal;
extern void ar5210Detach(struct ath_hal *ah);
extern HAL_BOOL ar5210Reset(struct ath_hal *, HAL_OPMODE,
- HAL_CHANNEL *, HAL_BOOL bChannelChange, HAL_STATUS *);
+ struct ieee80211_channel *, HAL_BOOL bChannelChange, HAL_STATUS *);
extern void ar5210SetPCUConfig(struct ath_hal *);
extern HAL_BOOL ar5210PhyDisable(struct ath_hal *);
extern HAL_BOOL ar5210Disable(struct ath_hal *);
-extern HAL_BOOL ar5210ChipReset(struct ath_hal *, HAL_CHANNEL *);
-extern HAL_BOOL ar5210PerCalibration(struct ath_hal *, HAL_CHANNEL *, HAL_BOOL *);
-extern HAL_BOOL ar5210PerCalibrationN(struct ath_hal *ah, HAL_CHANNEL *chan,
+extern HAL_BOOL ar5210ChipReset(struct ath_hal *, struct ieee80211_channel *);
+extern HAL_BOOL ar5210PerCalibration(struct ath_hal *, struct ieee80211_channel *, HAL_BOOL *);
+extern HAL_BOOL ar5210PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan,
u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone);
-extern HAL_BOOL ar5210ResetCalValid(struct ath_hal *ah, const HAL_CHANNEL *);
+extern HAL_BOOL ar5210ResetCalValid(struct ath_hal *ah, const struct ieee80211_channel *);
extern int16_t ar5210GetNoiseFloor(struct ath_hal *);
extern int16_t ar5210GetNfAdjust(struct ath_hal *,
const HAL_CHANNEL_INTERNAL *);
extern HAL_BOOL ar5210SetTxPowerLimit(struct ath_hal *, uint32_t limit);
-extern HAL_BOOL ar5210SetTransmitPower(struct ath_hal *, HAL_CHANNEL *);
+extern HAL_BOOL ar5210SetTransmitPower(struct ath_hal *,
+ const struct ieee80211_channel *);
extern HAL_BOOL ar5210CalNoiseFloor(struct ath_hal *, HAL_CHANNEL_INTERNAL *);
extern HAL_BOOL ar5210ResetDma(struct ath_hal *, HAL_OPMODE);
@@ -274,6 +275,6 @@ extern const HAL_RATE_TABLE *ar5210GetRa
extern HAL_BOOL ar5210AniControl(struct ath_hal *, HAL_ANI_CMD, int );
extern void ar5210AniPoll(struct ath_hal *, const HAL_NODE_STATS *,
- const HAL_CHANNEL *);
+ const struct ieee80211_channel *);
extern void ar5210MibEvent(struct ath_hal *, const HAL_NODE_STATS *);
#endif /* _ATH_AR5210_H_ */
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Fri Jan 23 07:00:33 2009 (r187620)
@@ -31,7 +31,7 @@
static HAL_BOOL ar5210GetChannelEdges(struct ath_hal *,
uint16_t flags, uint16_t *low, uint16_t *high);
static HAL_BOOL ar5210GetChipPowerLimits(struct ath_hal *ah,
- HAL_CHANNEL_INTERNAL *chan);
+ struct ieee80211_channel *chan);
static const struct ath_hal_private ar5210hal = {{
.ah_magic = AR5210_MAGIC,
@@ -302,7 +302,7 @@ static HAL_BOOL
ar5210GetChannelEdges(struct ath_hal *ah,
uint16_t flags, uint16_t *low, uint16_t *high)
{
- if (flags & CHANNEL_5GHZ) {
+ if (flags & IEEE80211_CHAN_5GHZ) {
*low = 5120;
*high = 5430;
return AH_TRUE;
@@ -312,14 +312,14 @@ ar5210GetChannelEdges(struct ath_hal *ah
}
static HAL_BOOL
-ar5210GetChipPowerLimits(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *chan)
+ar5210GetChipPowerLimits(struct ath_hal *ah, struct ieee80211_channel *chan)
{
/* XXX fill in, this is just a placeholder */
HALDEBUG(ah, HAL_DEBUG_ATTACH,
"%s: no min/max power for %u/0x%x\n",
- __func__, chan->channel, chan->channelFlags);
- chan->maxTxPower = AR5210_MAX_RATE_POWER;
- chan->minTxPower = 0;
+ __func__, chan->ic_freq, chan->ic_flags);
+ chan->ic_maxpower = AR5210_MAX_RATE_POWER;
+ chan->ic_minpower = 0;
return AH_TRUE;
}
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Fri Jan 23 07:00:33 2009 (r187620)
@@ -562,7 +562,7 @@ ar5210AniControl(struct ath_hal *ah, HAL
void
ar5210AniPoll(struct ath_hal *ah, const HAL_NODE_STATS *stats,
- const HAL_CHANNEL *chan)
+ const struct ieee80211_channel *chan)
{
}
Modified: user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
==============================================================================
--- user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c Fri Jan 23 06:33:39 2009 (r187619)
+++ user/sam/wifi/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c Fri Jan 23 07:00:33 2009 (r187620)
@@ -55,7 +55,7 @@ static const uint8_t ar5k0007_pwrSetting
static HAL_BOOL ar5210SetResetReg(struct ath_hal *,
uint32_t resetMask, u_int delay);
-static HAL_BOOL ar5210SetChannel(struct ath_hal *, HAL_CHANNEL_INTERNAL *);
+static HAL_BOOL ar5210SetChannel(struct ath_hal *, struct ieee80211_channel *);
static void ar5210SetOperatingMode(struct ath_hal *, int opmode);
/*
@@ -68,7 +68,8 @@ static void ar5210SetOperatingMode(struc
*/
HAL_BOOL
ar5210Reset(struct ath_hal *ah, HAL_OPMODE opmode,
- HAL_CHANNEL *chan, HAL_BOOL bChannelChange, HAL_STATUS *status)
+ struct ieee80211_channel *chan, HAL_BOOL bChannelChange,
+ HAL_STATUS *status)
{
#define N(a) (sizeof (a) /sizeof (a[0]))
#define FAIL(_code) do { ecode = _code; goto bad; } while (0)
@@ -81,10 +82,10 @@ ar5210Reset(struct ath_hal *ah, HAL_OPMO
HALDEBUG(ah, HAL_DEBUG_RESET,
"%s: opmode %u channel %u/0x%x %s channel\n", __func__,
- opmode, chan->channel, chan->channelFlags,
+ opmode, chan->ic_freq, chan->ic_flags,
bChannelChange ? "change" : "same");
- if ((chan->channelFlags & CHANNEL_5GHZ) == 0) {
+ if (!IEEE80211_IS_CHAN_5GHZ(chan)) {
/* Only 11a mode */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: channel not 5Ghz\n", __func__);
FAIL(HAL_EINVAL);
@@ -96,7 +97,7 @@ ar5210Reset(struct ath_hal *ah, HAL_OPMO
if (ichan == AH_NULL) {
HALDEBUG(ah, HAL_DEBUG_ANY,
"%s: invalid channel %u/0x%x; no mapping\n",
- __func__, chan->channel, chan->channelFlags);
+ __func__, chan->ic_freq, chan->ic_flags);
FAIL(HAL_EINVAL);
}
switch (opmode) {
@@ -232,15 +233,13 @@ ar5210Reset(struct ath_hal *ah, HAL_OPMO
(OS_REG_READ(ah, AR_PHY(68)) & 0xFFFFFFFC) |
(ee->ee_antenna & 0x3));
- if (!ar5210SetChannel(ah, ichan)) {
+ if (!ar5210SetChannel(ah, chan)) {
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unable to set channel\n",
__func__);
FAIL(HAL_EIO);
}
- if (bChannelChange) {
- if (!(ichan->channelFlags & CHANNEL_DFS))
- ichan->privFlags &= ~CHANNEL_INTERFERENCE;
- }
+ if (bChannelChange && !IEEE80211_IS_CHAN_DFS(chan))
+ chan->ic_state &= ~IEEE80211_CHANSTATE_CWINT;
/* Activate the PHY */
OS_REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ENABLE);
@@ -254,7 +253,7 @@ ar5210Reset(struct ath_hal *ah, HAL_OPMO
/* Perform noise floor calibration and set status */
if (!ar5210CalNoiseFloor(ah, ichan)) {
- chan->channelFlags |= CHANNEL_CW_INT;
+ chan->ic_state |= IEEE80211_CHANSTATE_CWINT;
HALDEBUG(ah, HAL_DEBUG_ANY,
"%s: noise floor calibration failed\n", __func__);
FAIL(HAL_EIO);
@@ -294,7 +293,7 @@ ar5210Reset(struct ath_hal *ah, HAL_OPMO
return AH_TRUE;
bad:
- if (*status)
+ if (status != AH_NULL)
*status = ecode;
return AH_FALSE;
#undef FAIL
@@ -383,19 +382,20 @@ ar5210Disable(struct ath_hal *ah)
* Places the hardware into reset and then pulls it out of reset
*/
HAL_BOOL
-ar5210ChipReset(struct ath_hal *ah, HAL_CHANNEL *chan)
+ar5210ChipReset(struct ath_hal *ah, struct ieee80211_channel *chan)
{
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list