summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/ah_osdep.c25
-rw-r--r--sys/dev/ath/ath_hal/ah.h12
-rw-r--r--sys/dev/ath/ath_hal/ah_eeprom_9287.h2
-rw-r--r--sys/dev/ath/ath_hal/ah_internal.h31
-rw-r--r--sys/dev/ath/ath_hal/ah_regdomain.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c5
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5112.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c6
-rw-r--r--sys/dev/ath/ath_hal/ar5312/ar5312_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar2133.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_misc.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c6
-rw-r--r--sys/dev/ath/ath_hal/ar9001/ar9130_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar9001/ar9160_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9280_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9287_attach.c5
-rw-r--r--sys/dev/ath/if_ath.c35
-rw-r--r--sys/dev/ath/if_ath_sysctl.c40
-rw-r--r--sys/dev/ath/if_ath_sysctl.h2
28 files changed, 159 insertions, 72 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index b14bba0..cceb9a4 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -81,29 +81,10 @@ SYSCTL_NODE(_hw_ath, OID_AUTO, hal, CTLFLAG_RD, 0, "Atheros HAL parameters");
#ifdef AH_DEBUG
int ath_hal_debug = 0;
SYSCTL_INT(_hw_ath_hal, OID_AUTO, debug, CTLFLAG_RW, &ath_hal_debug,
- 0, "Atheros HAL debugging printfs");
+ 0, "Atheros HAL debugging printfs");
TUNABLE_INT("hw.ath.hal.debug", &ath_hal_debug);
#endif /* AH_DEBUG */
-int ath_hal_ar5416_biasadj = 0;
-SYSCTL_INT(_hw_ath_hal, OID_AUTO, ar5416_biasadj, CTLFLAG_RW,
- &ath_hal_ar5416_biasadj, 0, "Enable 2ghz AR5416 direction sensitivity"
- " bias adjust");
-
-/* NB: these are deprecated; they exist for now for compatibility */
-int ath_hal_dma_beacon_response_time = 2; /* in TU's */
-SYSCTL_INT(_hw_ath_hal, OID_AUTO, dma_brt, CTLFLAG_RW,
- &ath_hal_dma_beacon_response_time, 0,
- "Atheros HAL DMA beacon response time");
-int ath_hal_sw_beacon_response_time = 10; /* in TU's */
-SYSCTL_INT(_hw_ath_hal, OID_AUTO, sw_brt, CTLFLAG_RW,
- &ath_hal_sw_beacon_response_time, 0,
- "Atheros HAL software beacon response time");
-int ath_hal_additional_swba_backoff = 0; /* in TU's */
-SYSCTL_INT(_hw_ath_hal, OID_AUTO, swba_backoff, CTLFLAG_RW,
- &ath_hal_additional_swba_backoff, 0,
- "Atheros HAL additional SWBA backoff time");
-
MALLOC_DEFINE(M_ATH_HAL, "ath_hal", "ath hal data");
void*
@@ -146,7 +127,9 @@ ath_hal_ether_sprintf(const u_int8_t *mac)
void
DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
{
- if ((mask == HAL_DEBUG_UNMASKABLE) || (ath_hal_debug & mask)) {
+ if ((mask == HAL_DEBUG_UNMASKABLE) ||
+ (ah->ah_config.ah_debug & mask) ||
+ (ath_hal_debug & mask)) {
__va_list ap;
va_start(ap, fmt);
ath_hal_vprintf(ah, fmt, ap);
diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h
index 7a01be3..f81e6aa 100644
--- a/sys/dev/ath/ath_hal/ah.h
+++ b/sys/dev/ath/ath_hal/ah.h
@@ -756,6 +756,17 @@ struct dfs_event {
};
typedef struct dfs_event HAL_DFS_EVENT;
+typedef struct
+{
+ int ah_debug; /* only used if AH_DEBUG is defined */
+ int ah_ar5416_biasadj; /* enable AR2133 radio specific bias fiddling */
+
+ /* NB: these are deprecated; they exist for now for compatibility */
+ int ah_dma_beacon_response_time;/* in TU's */
+ int ah_sw_beacon_response_time; /* in TU's */
+ int ah_additional_swba_backoff; /* in TU's */
+}HAL_OPS_CONFIG;
+
/*
* Hardware Access Layer (HAL) API.
*
@@ -784,6 +795,7 @@ struct ath_hal {
uint16_t *ah_eepromdata; /* eeprom buffer, if needed */
+ HAL_OPS_CONFIG ah_config;
const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *,
u_int mode);
void __ahdecl(*ah_detach)(struct ath_hal*);
diff --git a/sys/dev/ath/ath_hal/ah_eeprom_9287.h b/sys/dev/ath/ath_hal/ah_eeprom_9287.h
index d429c39..ff8080a 100644
--- a/sys/dev/ath/ath_hal/ah_eeprom_9287.h
+++ b/sys/dev/ath/ath_hal/ah_eeprom_9287.h
@@ -31,6 +31,8 @@
#define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER
#define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1
+#define AR9287_RDEXT_DEFAULT 0x1F
+
#define AR9287_EEP_START_LOC 128
#define AR9287_HTC_EEP_START_LOC 256
#define AR9287_NUM_2G_CAL_PIERS 3
diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h
index d66c9d8..120620c 100644
--- a/sys/dev/ath/ath_hal/ah_internal.h
+++ b/sys/dev/ath/ath_hal/ah_internal.h
@@ -475,12 +475,6 @@ isBigEndian(void)
#define OS_A_REG_RMW_FIELD(_a, _r, _f, _v) \
do { OS_REG_WRITE(_a, _r, (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) ; OS_DELAY(100); } while (0)
-/* 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 */
-extern int ath_hal_additional_swba_backoff; /* in TU's */
-extern int ath_hal_ar5416_biasadj; /* 1 or 0 */
-
/* wait for the register contents to have the specified value */
extern HAL_BOOL ath_hal_wait(struct ath_hal *, u_int reg,
uint32_t mask, uint32_t val);
@@ -504,11 +498,29 @@ extern void ath_hal_free(void *);
/* common debugging interfaces */
#ifdef AH_DEBUG
#include "ah_debug.h"
-extern int ath_hal_debug;
+extern int ath_hal_debug; /* Global debug flags */
+
+/*
+ * This is used for global debugging, when ahp doesn't yet have the
+ * related debugging state. For example, during probe/attach.
+ */
+#define HALDEBUG_G(_ah, __m, ...) \
+ do { \
+ if ((__m) == HAL_DEBUG_UNMASKABLE || \
+ ath_hal_debug & (__m)) { \
+ DO_HALDEBUG((_ah), (__m), __VA_ARGS__); \
+ } \
+ } while (0);
+
+/*
+ * This is used for local debugging, when ahp isn't NULL and
+ * thus may have debug flags set.
+ */
#define HALDEBUG(_ah, __m, ...) \
do { \
if ((__m) == HAL_DEBUG_UNMASKABLE || \
- (ath_hal_debug & (__m))) { \
+ ath_hal_debug & (__m) || \
+ (_ah)->ah_config.ah_debug & (__m)) { \
DO_HALDEBUG((_ah), (__m), __VA_ARGS__); \
} \
} while(0);
@@ -516,7 +528,8 @@ extern int ath_hal_debug;
extern void DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
__printflike(3,4);
#else
-#define HALDEBUG(_ah, __m, _fmt, ...)
+#define HALDEBUG(_ah, __m, ...)
+#define HALDEBUG_G(_ah, __m, ...)
#endif /* AH_DEBUG */
/*
diff --git a/sys/dev/ath/ath_hal/ah_regdomain.c b/sys/dev/ath/ath_hal/ah_regdomain.c
index c17d0f6..9aae332 100644
--- a/sys/dev/ath/ath_hal/ah_regdomain.c
+++ b/sys/dev/ath/ath_hal/ah_regdomain.c
@@ -167,7 +167,7 @@ isEepromValid(struct ath_hal *ah)
if (regDomainPairs[i].regDmnEnum == rd)
return AH_TRUE;
}
- HALDEBUG(ah, HAL_DEBUG_REGDOMAIN,
+ HALDEBUG_G(ah, HAL_DEBUG_REGDOMAIN,
"%s: invalid regulatory domain/country code 0x%x\n", __func__, rd);
return AH_FALSE;
}
@@ -609,7 +609,7 @@ ath_hal_mapgsm(int sku, int freq)
return 1544 + freq;
if (sku == SKU_SR9)
return 3344 - freq;
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot map freq %u unknown gsm sku %u\n",
__func__, freq, sku);
return freq;
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c b/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
index 2068733..41d957a 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
@@ -181,14 +181,14 @@ ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
HAL_STATUS ecode;
int i;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH,
"%s: devid 0x%x sc %p st %p sh %p\n", __func__, devid,
sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp = ath_hal_malloc(sizeof (struct ath_hal_5210));
if (ahp == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: no memory for state block\n", __func__);
ecode = HAL_ENOMEM;
goto bad;
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c b/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c
index dbd059e..a613c9c 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c
@@ -56,9 +56,9 @@ ar5210BeaconInit(struct ath_hal *ah,
if (AH_PRIVATE(ah)->ah_opmode != HAL_M_STA) {
bt.bt_nextdba = (next_beacon -
- ath_hal_dma_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_dma_beacon_response_time) << 3; /* 1/8 TU */
bt.bt_nextswba = (next_beacon -
- ath_hal_sw_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_sw_beacon_response_time) << 3; /* 1/8 TU */
/*
* The SWBA interrupt is not used for beacons in ad hoc mode
* as we don't yet support ATIMs. So since the beacon never
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c b/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
index 308ecc9..14daa0b 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
@@ -200,13 +200,13 @@ ar5211Attach(uint16_t devid, HAL_SOFTC sc,
uint16_t eeval;
HAL_STATUS ecode;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp = ath_hal_malloc(sizeof (struct ath_hal_5211));
if (ahp == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
ecode = HAL_ENOMEM;
goto bad;
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c b/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c
index 669b8f6..31e9c5d 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c
@@ -71,9 +71,9 @@ ar5211BeaconInit(struct ath_hal *ah,
case HAL_M_IBSS:
case HAL_M_HOSTAP:
bt.bt_nextdba = (next_beacon -
- ath_hal_dma_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_dma_beacon_response_time) << 3; /* 1/8 TU */
bt.bt_nextswba = (next_beacon -
- ath_hal_sw_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_sw_beacon_response_time) << 3; /* 1/8 TU */
break;
}
/*
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c b/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
index 3af314f..e1e7f73 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
@@ -345,8 +345,9 @@ ar5211ResetTxQueue(struct ath_hal *ah, u_int q)
| AR_Q_MISC_CBR_INCR_DIS0 | AR_Q_MISC_RDYTIME_EXP_POLICY);
value = (ahp->ah_beaconInterval
- - (ath_hal_sw_beacon_response_time - ath_hal_dma_beacon_response_time)
- - ath_hal_additional_swba_backoff) * 1024;
+ - (ah->ah_config.ah_sw_beacon_response_time
+ - ah->ah_config.ah_dma_beacon_response_time)
+ - ah->ah_config.ah_additional_swba_backoff) * 1024;
OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), value | AR_Q_RDYTIMECFG_EN);
/* Configure DCU for CAB */
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5112.c b/sys/dev/ath/ath_hal/ar5212/ar5112.c
index c1920b9..1003068 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5112.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5112.c
@@ -611,7 +611,7 @@ getFullPwrTable(uint16_t numPcdacs, uint16_t *pcdacs, int16_t *power, int16_t ma
uint16_t idxR = 1;
if (numPcdacs < 2) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: at least 2 pcdac values needed [%d]\n",
__func__, numPcdacs);
return AH_FALSE;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
index 8e7f3cb..01c0e2c 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
@@ -317,13 +317,13 @@ ar5212Attach(uint16_t devid, HAL_SOFTC sc,
uint16_t eeval;
HAL_STATUS ecode;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp = ath_hal_malloc(sizeof (struct ath_hal_5212));
if (ahp == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c b/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c
index 538f8b8..bf0b38a 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c
@@ -84,9 +84,9 @@ ar5212BeaconInit(struct ath_hal *ah,
case HAL_M_HOSTAP:
case HAL_M_IBSS:
bt.bt_nextdba = (next_beacon -
- ath_hal_dma_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_dma_beacon_response_time) << 3; /* 1/8 TU */
bt.bt_nextswba = (next_beacon -
- ath_hal_sw_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_sw_beacon_response_time) << 3; /* 1/8 TU */
break;
}
/*
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c b/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
index 4fbce31..3c6ddc0 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
@@ -416,9 +416,9 @@ ar5212ResetTxQueue(struct ath_hal *ah, u_int q)
* here solely for backwards compatibility.
*/
value = (ahp->ah_beaconInterval
- - (ath_hal_sw_beacon_response_time -
- ath_hal_dma_beacon_response_time)
- - ath_hal_additional_swba_backoff) * 1024;
+ - (ah->ah_config.ah_sw_beacon_response_time -
+ ah->ah_config.ah_dma_beacon_response_time)
+ - ah->ah_config.ah_additional_swba_backoff) * 1024;
OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), value | AR_Q_RDYTIMECFG_ENA);
}
dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL,
diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c b/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
index 4ca1a4d..d1689d5 100644
--- a/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
+++ b/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
@@ -71,13 +71,13 @@ ar5312Attach(uint16_t devid, HAL_SOFTC sc,
uint16_t eeval;
HAL_STATUS ecode;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, st, (void*) sh);
/* NB: memory is returned zero'd */
ahp = ath_hal_malloc(sizeof (struct ath_hal_5212));
if (ahp == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar2133.c b/sys/dev/ath/ath_hal/ar5416/ar2133.c
index f92ea00..f25c108 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar2133.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar2133.c
@@ -185,7 +185,7 @@ ar2133SetChannel(struct ath_hal *ah, const struct ieee80211_channel *chan)
}
/* Workaround for hw bug - AR5416 specific */
- if (AR_SREV_OWL(ah) && ath_hal_ar5416_biasadj)
+ if (AR_SREV_OWL(ah) && ah->ah_config.ah_ar5416_biasadj)
ar2133ForceBias(ah, freq);
reg32 = (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) |
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
index e636325..607f97a 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
@@ -241,7 +241,7 @@ ar5416Attach(uint16_t devid, HAL_SOFTC sc,
HAL_STATUS ecode;
HAL_BOOL rfStatus;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
@@ -250,7 +250,7 @@ ar5416Attach(uint16_t devid, HAL_SOFTC sc,
sizeof(ar5416Addac)
);
if (ahp5416 == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c b/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
index 358a0ee..66b5053 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
@@ -93,9 +93,9 @@ ar5416BeaconInit(struct ath_hal *ah,
/* fall thru... */
case HAL_M_HOSTAP:
bt.bt_nextdba = (next_beacon -
- ath_hal_dma_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_dma_beacon_response_time) << 3; /* 1/8 TU */
bt.bt_nextswba = (next_beacon -
- ath_hal_sw_beacon_response_time) << 3; /* 1/8 TU */
+ ah->ah_config.ah_sw_beacon_response_time) << 3; /* 1/8 TU */
bt.bt_flags |= AR_TIMER_MODE_TBTT
| AR_TIMER_MODE_DBA
| AR_TIMER_MODE_SWBA;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
index 2332656..6266b58 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
@@ -288,7 +288,7 @@ ar5416SetQuiet(struct ath_hal *ah, uint32_t period, uint32_t duration,
nextStart_us += OS_REG_READ(ah, AR_TSF_L32);
}
if (flag & HAL_QUIET_ADD_SWBA_RESP_TIME) {
- nextStart_us += ath_hal_sw_beacon_response_time;
+ nextStart_us += ah->ah_config.ah_sw_beacon_response_time;
}
OS_REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1);
OS_REG_WRITE(ah, AR_QUIET2, SM(duration, AR_QUIET2_QUIET_DUR));
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
index 48956c5..20791e8 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
@@ -1035,9 +1035,9 @@ ar5416ResetTxQueue(struct ath_hal *ah, u_int q)
* here solely for backwards compatibility.
*/
value = (ahp->ah_beaconInterval
- - (ath_hal_sw_beacon_response_time -
- ath_hal_dma_beacon_response_time)
- - ath_hal_additional_swba_backoff) * 1024;
+ - (ah->ah_config.ah_sw_beacon_response_time -
+ ah->ah_config.ah_dma_beacon_response_time)
+ - ah->ah_config.ah_additional_swba_backoff) * 1024;
OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), value | AR_Q_RDYTIMECFG_ENA);
}
dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL,
diff --git a/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
index 2a3f3f0..518ed85 100644
--- a/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
+++ b/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
@@ -78,13 +78,13 @@ ar9130Attach(uint16_t devid, HAL_SOFTC sc,
HAL_STATUS ecode;
HAL_BOOL rfStatus;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp5416 = ath_hal_malloc(sizeof (struct ath_hal_5416));
if (ahp5416 == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
index 44a549d..a87d1ad 100644
--- a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
+++ b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
@@ -101,13 +101,13 @@ ar9160Attach(uint16_t devid, HAL_SOFTC sc,
HAL_STATUS ecode;
HAL_BOOL rfStatus;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp5416 = ath_hal_malloc(sizeof (struct ath_hal_5416));
if (ahp5416 == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
index ebe3be1..3743c21 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
@@ -120,13 +120,13 @@ ar9280Attach(uint16_t devid, HAL_SOFTC sc,
int8_t pwr_table_offset;
uint8_t pwr;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp9280 = ath_hal_malloc(sizeof (struct ath_hal_9280));
if (ahp9280 == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
index 9120313..2547148 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
@@ -118,13 +118,13 @@ ar9285Attach(uint16_t devid, HAL_SOFTC sc,
HAL_STATUS ecode;
HAL_BOOL rfStatus;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp9285 = ath_hal_malloc(sizeof (struct ath_hal_9285));
if (ahp9285 == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
index 9cbe0a5..ed9feb8 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
@@ -119,13 +119,13 @@ ar9287Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BOOL rfStatus;
int8_t pwr_table_offset;
- HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
/* NB: memory is returned zero'd */
ahp9287 = ath_hal_malloc(sizeof (struct ath_hal_9287));
if (ahp9287 == AH_NULL) {
- HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+ HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
"%s: cannot allocate memory for state block\n", __func__);
*status = HAL_ENOMEM;
return AH_NULL;
@@ -320,6 +320,7 @@ ar9287Attach(uint16_t devid, HAL_SOFTC sc,
/* Read Reg Domain */
AH_PRIVATE(ah)->ah_currentRD =
ath_hal_eepromGet(ah, AR_EEP_REGDMN_0, AH_NULL);
+ AH_PRIVATE(ah)->ah_currentRDext = AR9287_RDEXT_DEFAULT;
/*
* ah_miscMode is populated by ar5416FillCapabilityInfo()
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 6c7b0e7..35592d9 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -528,6 +528,9 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
| IEEE80211_C_WPA /* capable of WPA1+WPA2 */
| IEEE80211_C_BGSCAN /* capable of bg scanning */
| IEEE80211_C_TXFRAG /* handle tx frags */
+#ifdef ATH_ENABLE_DFS
+ | IEEE80211_C_DFS /* Enable DFS radar detection */
+#endif
;
/*
* Query the hal to figure out h/w crypto support.
@@ -738,6 +741,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
*/
ath_sysctlattach(sc);
ath_sysctl_stats_attach(sc);
+ ath_sysctl_hal_attach(sc);
if (bootverbose)
ieee80211_announce(ic);
@@ -1286,6 +1290,8 @@ ath_resume(struct ath_softc *sc)
HAL_GPIO_MUX_MAC_NETWORK_LED);
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
}
+
+ /* XXX beacons ? */
}
void
@@ -1588,6 +1594,12 @@ ath_init(void *arg)
sc->sc_lastani = 0;
sc->sc_lastshortcal = 0;
sc->sc_doresetcal = AH_FALSE;
+ /*
+ * Beacon timers were cleared here; give ath_newstate()
+ * a hint that the beacon timers should be poked when
+ * things transition to the RUN state.
+ */
+ sc->sc_beacons = 0;
/*
* Setup the hardware after reset: the key cache
@@ -4464,6 +4476,19 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
ath_chan_change(sc, chan);
/*
+ * Reset clears the beacon timers; reset them
+ * here if needed.
+ */
+ if (sc->sc_beacons) { /* restart beacons */
+#ifdef IEEE80211_SUPPORT_TDMA
+ if (sc->sc_tdma)
+ ath_tdma_config(sc, NULL);
+ else
+#endif
+ ath_beacon_config(sc, NULL);
+ }
+
+ /*
* Re-enable interrupts.
*/
ath_hal_intrset(ah, sc->sc_imask);
@@ -4668,6 +4693,7 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
struct ieee80211_node *ni = NULL;
int i, error, stamode;
u_int32_t rfilt;
+ int csa_run_transition = 0;
static const HAL_LED_STATE leds[] = {
HAL_LED_INIT, /* IEEE80211_S_INIT */
HAL_LED_SCAN, /* IEEE80211_S_SCAN */
@@ -4683,6 +4709,9 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
ieee80211_state_name[vap->iv_state],
ieee80211_state_name[nstate]);
+ if (vap->iv_state == IEEE80211_S_CSA && nstate == IEEE80211_S_RUN)
+ csa_run_transition = 1;
+
callout_drain(&sc->sc_cal_ch);
ath_hal_setledstate(ah, leds[nstate]); /* set LED */
@@ -4789,8 +4818,14 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
* Defer beacon timer configuration to the next
* beacon frame so we have a current TSF to use
* (any TSF collected when scanning is likely old).
+ * However if it's due to a CSA -> RUN transition,
+ * force a beacon update so we pick up a lack of
+ * beacons from an AP in CAC and thus force a
+ * scan.
*/
sc->sc_syncbeacon = 1;
+ if (csa_run_transition)
+ ath_beacon_config(sc, vap);
break;
case IEEE80211_M_MONITOR:
/*
diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c
index 6c1a6b2..e3c9966 100644
--- a/sys/dev/ath/if_ath_sysctl.c
+++ b/sys/dev/ath/if_ath_sysctl.c
@@ -719,3 +719,43 @@ ath_sysctl_stats_attach(struct ath_softc *sc)
/* Attach the RX phy error array */
ath_sysctl_stats_attach_rxphyerr(sc, child);
}
+
+/*
+ * This doesn't necessarily belong here (because it's HAL related, not
+ * driver related).
+ */
+void
+ath_sysctl_hal_attach(struct ath_softc *sc)
+{
+ struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
+ struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+ struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
+
+ tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "hal", CTLFLAG_RD,
+ NULL, "Atheros HAL parameters");
+ child = SYSCTL_CHILDREN(tree);
+
+ sc->sc_ah->ah_config.ah_debug = 0;
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "debug", CTLFLAG_RW,
+ &sc->sc_ah->ah_config.ah_debug, 0, "Atheros HAL debugging printfs");
+
+ sc->sc_ah->ah_config.ah_ar5416_biasadj = 0;
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "ar5416_biasadj", CTLFLAG_RW,
+ &sc->sc_ah->ah_config.ah_ar5416_biasadj, 0,
+ "Enable 2ghz AR5416 direction sensitivity bias adjust");
+
+ sc->sc_ah->ah_config.ah_dma_beacon_response_time = 2;
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "dma_brt", CTLFLAG_RW,
+ &sc->sc_ah->ah_config.ah_dma_beacon_response_time, 0,
+ "Atheros HAL DMA beacon response time");
+
+ sc->sc_ah->ah_config.ah_sw_beacon_response_time = 10;
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "sw_brt", CTLFLAG_RW,
+ &sc->sc_ah->ah_config.ah_sw_beacon_response_time, 0,
+ "Atheros HAL software beacon response time");
+
+ sc->sc_ah->ah_config.ah_additional_swba_backoff = 0;
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "swba_backoff", CTLFLAG_RW,
+ &sc->sc_ah->ah_config.ah_additional_swba_backoff, 0,
+ "Atheros HAL additional SWBA backoff time");
+}
diff --git a/sys/dev/ath/if_ath_sysctl.h b/sys/dev/ath/if_ath_sysctl.h
index f96a73e..1fef2be 100644
--- a/sys/dev/ath/if_ath_sysctl.h
+++ b/sys/dev/ath/if_ath_sysctl.h
@@ -34,5 +34,5 @@
extern void ath_sysctlattach(struct ath_softc *);
extern void ath_sysctl_stats_attach(struct ath_softc *sc);
-
+extern void ath_sysctl_hal_attach(struct ath_softc *sc);
#endif
OpenPOWER on IntegriCloud