summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath/ath_hal
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ath/ath_hal')
-rw-r--r--sys/dev/ath/ath_hal/ah.c52
-rw-r--r--sys/dev/ath/ath_hal/ah.h64
-rw-r--r--sys/dev/ath/ath_hal/ah_decode.h3
-rw-r--r--sys/dev/ath/ath_hal/ah_devid.h1
-rw-r--r--sys/dev/ath/ath_hal/ah_internal.h28
-rw-r--r--sys/dev/ath/ath_hal/ah_regdomain.c5
-rw-r--r--sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regenum.h1
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_misc.c1
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_power.c12
-rw-r--r--sys/dev/ath/ath_hal/ar5210/ar5210_reset.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211.h1
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_power.c12
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212.h11
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_ani.c13
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_misc.c18
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_power.c10
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_reset.c3
-rw-r--r--sys/dev/ath/ath_hal/ar5312/ar5312_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5312/ar5312_power.c5
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_ani.c13
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_attach.c7
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c26
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_cal.c3
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c3
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_power.c13
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_reset.c3
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416reg.h4
-rw-r--r--sys/dev/ath/ath_hal/ar9001/ar9130_attach.c4
-rw-r--r--sys/dev/ath/ath_hal/ar9001/ar9160_attach.c1
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9280_attach.c1
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_attach.c1
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9287_attach.c1
36 files changed, 261 insertions, 76 deletions
diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c
index 7187d57..4eb7fb6 100644
--- a/sys/dev/ath/ath_hal/ah.c
+++ b/sys/dev/ath/ath_hal/ah.c
@@ -55,7 +55,9 @@ ath_hal_probe(uint16_t vendorid, uint16_t devid)
*/
struct ath_hal*
ath_hal_attach(uint16_t devid, HAL_SOFTC sc,
- HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata, HAL_STATUS *error)
+ HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config,
+ HAL_STATUS *error)
{
struct ath_hal_chip * const *pchip;
@@ -66,7 +68,8 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC sc,
/* XXX don't have vendorid, assume atheros one works */
if (chip->probe(ATHEROS_VENDOR_ID, devid) == AH_NULL)
continue;
- ah = chip->attach(devid, sc, st, sh, eepromdata, error);
+ ah = chip->attach(devid, sc, st, sh, eepromdata, ah_config,
+ error);
if (ah != AH_NULL) {
/* copy back private state to public area */
ah->ah_devid = AH_PRIVATE(ah)->ah_devid;
@@ -786,6 +789,8 @@ ath_hal_getcapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
return HAL_OK;
case HAL_CAP_RX_LNA_MIXING: /* Hardware uses an RX LNA mixer to map 2 antennas to a 1 stream receiver */
return pCap->halRxUsingLnaMixing ? HAL_OK : HAL_ENOTSUPP;
+ case HAL_CAP_DO_MYBEACON: /* Hardware supports filtering my-beacons */
+ return pCap->halRxDoMyBeacon ? HAL_OK : HAL_ENOTSUPP;
default:
return HAL_EINVAL;
}
@@ -848,10 +853,11 @@ ath_hal_getregdump(struct ath_hal *ah, const HAL_REGRANGE *regs,
int i;
for (i = 0; space >= 2*sizeof(uint32_t); i++) {
- u_int r = regs[i].start;
- u_int e = regs[i].end;
- *dp++ = (r<<16) | e;
- space -= sizeof(uint32_t);
+ uint32_t r = regs[i].start;
+ uint32_t e = regs[i].end;
+ *dp++ = r;
+ *dp++ = e;
+ space -= 2*sizeof(uint32_t);
do {
*dp++ = OS_REG_READ(ah, r);
r += sizeof(uint32_t);
@@ -875,6 +881,7 @@ ath_hal_getdiagstate(struct ath_hal *ah, int request,
const void *args, uint32_t argsize,
void **result, uint32_t *resultsize)
{
+
switch (request) {
case HAL_DIAG_REVS:
*result = &AH_PRIVATE(ah)->ah_devid;
@@ -932,6 +939,10 @@ ath_hal_getdiagstate(struct ath_hal *ah, int request,
} else
return AH_FALSE;
return AH_TRUE;
+ case HAL_DIAG_CHANSURVEY:
+ *result = &AH_PRIVATE(ah)->ah_chansurvey;
+ *resultsize = sizeof(HAL_CHANNEL_SURVEY);
+ return AH_TRUE;
}
return AH_FALSE;
}
@@ -1427,3 +1438,32 @@ ath_hal_mhz2ieee_2ghz(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *ichan)
else
return 15 + ((ichan->channel - 2512) / 20);
}
+
+/*
+ * Clear the current survey data.
+ *
+ * This should be done during a channel change.
+ */
+void
+ath_hal_survey_clear(struct ath_hal *ah)
+{
+
+ OS_MEMZERO(&AH_PRIVATE(ah)->ah_chansurvey,
+ sizeof(AH_PRIVATE(ah)->ah_chansurvey));
+}
+
+/*
+ * Add a sample to the channel survey.
+ */
+void
+ath_hal_survey_add_sample(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hs)
+{
+ HAL_CHANNEL_SURVEY *cs;
+
+ cs = &AH_PRIVATE(ah)->ah_chansurvey;
+
+ OS_MEMCPY(&cs->samples[cs->cur_sample], hs, sizeof(*hs));
+ cs->samples[cs->cur_sample].seq_num = cs->cur_seq;
+ cs->cur_sample = (cs->cur_sample + 1) % CHANNEL_SURVEY_SAMPLE_COUNT;
+ cs->cur_seq++;
+}
diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h
index 2480803..facfceb1 100644
--- a/sys/dev/ath/ath_hal/ah.h
+++ b/sys/dev/ath/ath_hal/ah.h
@@ -199,6 +199,7 @@ typedef enum {
HAL_CAP_SERIALISE_WAR = 245, /* serialise register access on PCI */
HAL_CAP_ENFORCE_TXOP = 246, /* Enforce TXOP if supported */
HAL_CAP_RX_LNA_MIXING = 247, /* RX hardware uses LNA mixing */
+ HAL_CAP_DO_MYBEACON = 248, /* Supports HAL_RX_FILTER_MYBEACON */
} HAL_CAPABILITY_TYPE;
/*
@@ -404,6 +405,7 @@ typedef enum {
HAL_RX_FILTER_PROM = 0x00000020, /* Promiscuous mode */
HAL_RX_FILTER_PROBEREQ = 0x00000080, /* Allow probe request frames */
HAL_RX_FILTER_PHYERR = 0x00000100, /* Allow phy errors */
+ HAL_RX_FILTER_MYBEACON = 0x00000200, /* Filter beacons other than mine */
HAL_RX_FILTER_COMPBAR = 0x00000400, /* Allow compressed BAR */
HAL_RX_FILTER_COMP_BA = 0x00000800, /* Allow compressed blockack */
HAL_RX_FILTER_PHYRADAR = 0x00002000, /* Allow phy radar errors */
@@ -538,6 +540,7 @@ typedef enum {
typedef struct {
u_int32_t cyclecnt_diff; /* delta cycle count */
u_int32_t rxclr_cnt; /* rx clear count */
+ u_int32_t extrxclr_cnt; /* ext chan rx clear count */
u_int32_t txframecnt_diff; /* delta tx frame count */
u_int32_t rxframecnt_diff; /* delta rx frame count */
u_int32_t listen_time; /* listen time in msec - time for which ch is free */
@@ -847,6 +850,48 @@ typedef struct {
#define HAL_RSSI_EP_MULTIPLIER (1<<7) /* pow2 to optimize out * and / */
+/*
+ * This is the ANI state and MIB stats.
+ *
+ * It's used by the HAL modules to keep state /and/ by the debug ioctl
+ * to fetch ANI information.
+ */
+typedef struct {
+ uint32_t ast_ani_niup; /* ANI increased noise immunity */
+ uint32_t ast_ani_nidown; /* ANI decreased noise immunity */
+ uint32_t ast_ani_spurup; /* ANI increased spur immunity */
+ uint32_t ast_ani_spurdown;/* ANI descreased spur immunity */
+ uint32_t ast_ani_ofdmon; /* ANI OFDM weak signal detect on */
+ uint32_t ast_ani_ofdmoff;/* ANI OFDM weak signal detect off */
+ uint32_t ast_ani_cckhigh;/* ANI CCK weak signal threshold high */
+ uint32_t ast_ani_ccklow; /* ANI CCK weak signal threshold low */
+ uint32_t ast_ani_stepup; /* ANI increased first step level */
+ uint32_t ast_ani_stepdown;/* ANI decreased first step level */
+ uint32_t ast_ani_ofdmerrs;/* ANI cumulative ofdm phy err count */
+ uint32_t ast_ani_cckerrs;/* ANI cumulative cck phy err count */
+ uint32_t ast_ani_reset; /* ANI parameters zero'd for non-STA */
+ uint32_t ast_ani_lzero; /* ANI listen time forced to zero */
+ uint32_t ast_ani_lneg; /* ANI listen time calculated < 0 */
+ HAL_MIB_STATS ast_mibstats; /* MIB counter stats */
+ HAL_NODE_STATS ast_nodestats; /* Latest rssi stats from driver */
+} HAL_ANI_STATS;
+
+typedef struct {
+ uint8_t noiseImmunityLevel;
+ uint8_t spurImmunityLevel;
+ uint8_t firstepLevel;
+ uint8_t ofdmWeakSigDetectOff;
+ uint8_t cckWeakSigThreshold;
+ uint32_t listenTime;
+
+ /* NB: intentionally ordered so data exported to user space is first */
+ uint32_t txFrameCount; /* Last txFrameCount */
+ uint32_t rxFrameCount; /* Last rx Frame count */
+ uint32_t cycleCount; /* Last cycleCount
+ (to detect wrap-around) */
+ uint32_t ofdmPhyErrCount;/* OFDM err count since last reset */
+ uint32_t cckPhyErrCount; /* CCK err count since last reset */
+} HAL_ANI_STATE;
struct ath_desc;
struct ath_tx_status;
@@ -1262,6 +1307,7 @@ typedef struct
int ath_hal_show_bb_panic;
int ath_hal_ant_ctrl_comm2g_switch_enable;
int ath_hal_ext_atten_margin_cfg;
+ int ath_hal_min_gainidx;
int ath_hal_war70c;
uint32_t ath_hal_mci_config;
} HAL_OPS_CONFIG;
@@ -1297,6 +1343,9 @@ struct ath_hal {
uint32_t ah_intrstate[8]; /* last int state */
uint32_t ah_syncstate; /* last sync intr state */
+ /* Current powerstate from HAL calls */
+ HAL_POWER_MODE ah_powerMode;
+
HAL_OPS_CONFIG ah_config;
const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *,
u_int mode);
@@ -1583,6 +1632,18 @@ struct ath_hal {
void __ahdecl(*ah_btCoexDisable)(struct ath_hal *);
int __ahdecl(*ah_btCoexEnable)(struct ath_hal *);
+ /* Bluetooth MCI methods */
+ void __ahdecl(*ah_btMciSetup)(struct ath_hal *,
+ uint32_t, void *, uint16_t, uint32_t);
+ HAL_BOOL __ahdecl(*ah_btMciSendMessage)(struct ath_hal *,
+ uint8_t, uint32_t, uint32_t *, uint8_t,
+ HAL_BOOL, HAL_BOOL);
+ uint32_t __ahdecl(*ah_btMciGetInterrupt)(struct ath_hal *,
+ uint32_t *, uint32_t *);
+ uint32_t __ahdecl(*ah_btMciGetState)(struct ath_hal *,
+ uint32_t, uint32_t *);
+ void __ahdecl(*ah_btMciDetach)(struct ath_hal *);
+
/* LNA diversity configuration */
void __ahdecl(*ah_divLnaConfGet)(struct ath_hal *,
HAL_ANT_COMB_CONFIG *);
@@ -1611,7 +1672,8 @@ extern const char *__ahdecl ath_hal_probe(uint16_t vendorid, uint16_t devid);
* be returned if the status parameter is non-zero.
*/
extern struct ath_hal * __ahdecl ath_hal_attach(uint16_t devid, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, uint16_t *eepromdata, HAL_STATUS* status);
+ HAL_BUS_TAG, HAL_BUS_HANDLE, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config, HAL_STATUS* status);
extern const char *ath_hal_mac_name(struct ath_hal *);
extern const char *ath_hal_rf_name(struct ath_hal *);
diff --git a/sys/dev/ath/ath_hal/ah_decode.h b/sys/dev/ath/ath_hal/ah_decode.h
index 07c4ac7..3aca975 100644
--- a/sys/dev/ath/ath_hal/ah_decode.h
+++ b/sys/dev/ath/ath_hal/ah_decode.h
@@ -53,6 +53,8 @@ enum {
AH_MARK_ANI_POLL, /* ar*AniReset, listen time */
AH_MARK_ANI_CONTROL, /* ar*AniReset, cmd */
AH_MARK_RX_CTL, /* RX DMA control */
+ AH_MARK_CHIP_POWER, /* chip power control, mode */
+ AH_MARK_CHIP_POWER_DONE, /* chip power control done, status */
};
enum {
@@ -61,6 +63,7 @@ enum {
AH_MARK_RX_CTL_DMA_START,
AH_MARK_RX_CTL_DMA_STOP,
AH_MARK_RX_CTL_DMA_STOP_ERR,
+ AH_MARK_RX_CTL_DMA_STOP_OK,
};
#endif /* _ATH_AH_DECODE_H_ */
diff --git a/sys/dev/ath/ath_hal/ah_devid.h b/sys/dev/ath/ath_hal/ah_devid.h
index 43d994d..1e4d473 100644
--- a/sys/dev/ath/ath_hal/ah_devid.h
+++ b/sys/dev/ath/ath_hal/ah_devid.h
@@ -92,6 +92,7 @@
#define AR9300_DEVID_AR946X_PCIE 0x0034
#define AR9300_DEVID_AR9330 0x0035
#define AR9300_DEVID_QCA9565 0x0036
+#define AR9300_DEVID_AR1111_PCIE 0x0037
#define AR9300_DEVID_QCA955X 0x0039
#define AR_SUBVENDOR_ID_NOG 0x0e11 /* No 11G subvendor ID */
diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h
index 908f33e..0c855d4 100644
--- a/sys/dev/ath/ath_hal/ah_internal.h
+++ b/sys/dev/ath/ath_hal/ah_internal.h
@@ -50,8 +50,8 @@
#endif
typedef struct {
- uint16_t start; /* first register */
- uint16_t end; /* ending register or zero */
+ uint32_t start; /* first register */
+ uint32_t end; /* ending register or zero */
} HAL_REGRANGE;
typedef struct {
@@ -91,6 +91,7 @@ struct ath_hal_chip {
const char *(*probe)(uint16_t vendorid, uint16_t devid);
struct ath_hal *(*attach)(uint16_t devid, HAL_SOFTC,
HAL_BUS_TAG, HAL_BUS_HANDLE, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah,
HAL_STATUS *error);
};
#ifndef AH_CHIP
@@ -280,7 +281,9 @@ typedef struct {
halAntDivCombSupportOrg : 1,
halRadioRetentionSupport : 1,
halSpectralScanSupport : 1,
- halRxUsingLnaMixing : 1;
+ halRxUsingLnaMixing : 1,
+ halRxDoMyBeacon : 1,
+ halHwUapsdTrig : 1;
uint32_t halWirelessModes;
uint16_t halTotalQueues;
@@ -419,9 +422,13 @@ struct ath_hal_private {
uint32_t ah_fatalState[6]; /* AR_ISR+shadow regs */
int ah_rxornIsFatal; /* how to treat HAL_INT_RXORN */
-#ifndef ATH_NF_PER_CHAN
+ /* Only used if ATH_NF_PER_CHAN is defined */
HAL_NFCAL_HIST_FULL nf_cal_hist;
-#endif /* ! ATH_NF_PER_CHAN */
+
+ /*
+ * Channel survey history - current channel only.
+ */
+ HAL_CHANNEL_SURVEY ah_chansurvey; /* channel survey */
};
#define AH_PRIVATE(_ah) ((struct ath_hal_private *)(_ah))
@@ -1026,4 +1033,15 @@ ath_hal_getantennaallowed(struct ath_hal *ah,
*/
extern int ath_hal_mhz2ieee_2ghz(struct ath_hal *, HAL_CHANNEL_INTERNAL *);
+/*
+ * Clear the channel survey data.
+ */
+extern void ath_hal_survey_clear(struct ath_hal *ah);
+
+/*
+ * Add a sample to the channel survey data.
+ */
+extern void ath_hal_survey_add_sample(struct ath_hal *ah,
+ HAL_SURVEY_SAMPLE *hs);
+
#endif /* _ATH_AH_INTERAL_H_ */
diff --git a/sys/dev/ath/ath_hal/ah_regdomain.c b/sys/dev/ath/ath_hal/ah_regdomain.c
index 807db44..fb0c841 100644
--- a/sys/dev/ath/ath_hal/ah_regdomain.c
+++ b/sys/dev/ath/ath_hal/ah_regdomain.c
@@ -169,6 +169,11 @@ isEepromValid(struct ath_hal *ah)
if (regDomainPairs[i].regDmnEnum == rd)
return AH_TRUE;
}
+
+ if (rd == FCC_UBNT) {
+ return AH_TRUE;
+ }
+
HALDEBUG(ah, HAL_DEBUG_REGDOMAIN,
"%s: invalid regulatory domain/country code 0x%x\n", __func__, rd);
return AH_FALSE;
diff --git a/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regenum.h b/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regenum.h
index bc569cb..d8d211e 100644
--- a/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regenum.h
+++ b/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regenum.h
@@ -51,6 +51,7 @@ enum {
FCC2_FCCA = 0x20, /* Canada */
FCC2_WORLD = 0x21, /* Australia & HK */
FCC2_ETSIC = 0x22,
+ FCC_UBNT = 0x2A, /* Ubiquity PicoStation M2HP */
FRANCE_RES = 0x31, /* Legacy France for OEM */
FCC3_FCCA = 0x3A, /* USA & Canada w/5470 band, 11h, DFS enabled */
FCC3_WORLD = 0x3B, /* USA & Canada w/5470 band, 11h, DFS enabled */
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210.h b/sys/dev/ath/ath_hal/ar5210/ar5210.h
index 48ccc20..3e372f7 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210.h
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210.h
@@ -108,7 +108,6 @@ struct ath_hal_5210 {
uint32_t ah_txDescInterruptMask;
uint32_t ah_txEolInterruptMask;
uint32_t ah_txUrnInterruptMask;
- HAL_POWER_MODE ah_powerMode;
uint8_t ah_bssid[IEEE80211_ADDR_LEN];
HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES]; /* beacon+cab+data */
/*
@@ -121,6 +120,8 @@ struct ath_hal_5210 {
u_int ah_slottime; /* user-specified slot time */
u_int ah_acktimeout; /* user-specified ack timeout */
u_int ah_ctstimeout; /* user-specified cts timeout */
+
+ uint16_t ah_associd; /* association id */
};
#define AH5210(ah) ((struct ath_hal_5210 *)(ah))
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c b/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
index 3c0ed71..ceafa99 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
@@ -183,7 +183,7 @@ static HAL_BOOL ar5210FillCapabilityInfo(struct ath_hal *ah);
*/
static struct ath_hal *
ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
- uint16_t *eepromdata, HAL_STATUS *status)
+ uint16_t *eepromdata, HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
{
#define N(a) (sizeof(a)/sizeof(a[0]))
struct ath_hal_5210 *ahp;
@@ -219,7 +219,7 @@ ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
AH_PRIVATE(ah)->ah_powerLimit = AR5210_MAX_RATE_POWER;
AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
- ahp->ah_powerMode = HAL_PM_UNDEFINED;
+ ah->ah_powerMode = HAL_PM_UNDEFINED;
ahp->ah_staId1Defaults = 0;
ahp->ah_rssiThr = INIT_RSSI_THR;
ahp->ah_sifstime = (u_int) -1;
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c b/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
index 8170880..5eaa18e 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
@@ -315,6 +315,7 @@ ar5210WriteAssocid(struct ath_hal *ah, const uint8_t *bssid, uint16_t assocId)
/* XXX save bssid for possible re-use on reset */
OS_MEMCPY(ahp->ah_bssid, bssid, IEEE80211_ADDR_LEN);
+ ahp->ah_associd = assocId;
OS_REG_WRITE(ah, AR_BSS_ID0, LE_READ_4(ahp->ah_bssid));
OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid+4) |
((assocId & 0x3fff)<<AR_BSS_ID1_AID_S));
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_power.c b/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
index 1c6909b..ec5e75d 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
@@ -93,7 +93,6 @@ ar5210SetPowerModeSleep(struct ath_hal *ah, int setChip)
HAL_BOOL
ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
{
- struct ath_hal_5210 *ahp = AH5210(ah);
#ifdef AH_DEBUG
static const char* modes[] = {
"AWAKE",
@@ -105,25 +104,30 @@ ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
int status = AH_TRUE;
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
- modes[ahp->ah_powerMode], modes[mode],
+ modes[ah->ah_powerMode], modes[mode],
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
+ if (setChip)
+ ah->ah_powerMode = mode;
status = ar5210SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5210SetPowerModeSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5210SetPowerModeAuto(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",
__func__, mode);
return AH_FALSE;
}
- ahp->ah_powerMode = mode;
- return status;
+ return status;
}
HAL_POWER_MODE
diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c b/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
index 1d50f99..1dba729 100644
--- a/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
+++ b/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
@@ -152,8 +152,12 @@ ar5210Reset(struct ath_hal *ah, HAL_OPMODE opmode,
/* Restore previous led state */
OS_REG_WRITE(ah, AR_PCICFG, OS_REG_READ(ah, AR_PCICFG) | ledstate);
+#if 0
OS_REG_WRITE(ah, AR_BSS_ID0, LE_READ_4(ahp->ah_bssid));
OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid + 4));
+#endif
+ /* BSSID, association id, ps-poll */
+ ar5210WriteAssocid(ah, ahp->ah_bssid, ahp->ah_associd);
OS_REG_WRITE(ah, AR_TXDP0, 0);
OS_REG_WRITE(ah, AR_TXDP1, 0);
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211.h b/sys/dev/ath/ath_hal/ar5211/ar5211.h
index c50531e..6f04624 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211.h
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211.h
@@ -119,7 +119,6 @@ struct ath_hal_5211 {
uint32_t ah_txEolInterruptMask;
uint32_t ah_txUrnInterruptMask;
HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES];
- HAL_POWER_MODE ah_powerMode;
HAL_ANT_SETTING ah_diversityControl; /* antenna setting */
uint32_t ah_calibrationTime;
HAL_BOOL ah_bIQCalibration;
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c b/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
index 4549295..3416dc0 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
@@ -203,7 +203,7 @@ ar5211GetRadioRev(struct ath_hal *ah)
static struct ath_hal *
ar5211Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
- HAL_STATUS *status)
+ HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
{
#define N(a) (sizeof(a)/sizeof(a[0]))
struct ath_hal_5211 *ahp;
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_power.c b/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
index 776cfb3..e646d90 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
@@ -95,7 +95,6 @@ ar5211SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
HAL_BOOL
ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
{
- struct ath_hal_5211 *ahp = AH5211(ah);
#ifdef AH_DEBUG
static const char* modes[] = {
"AWAKE",
@@ -107,25 +106,30 @@ ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
int status = AH_TRUE;
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
- modes[ahp->ah_powerMode], modes[mode],
+ modes[ah->ah_powerMode], modes[mode],
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
+ if (setChip)
+ ah->ah_powerMode = mode;
status = ar5211SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5211SetPowerModeSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5211SetPowerModeNetworkSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",
__func__, mode);
return AH_FALSE;
}
- ahp->ah_powerMode = mode;
- return status;
+ return status;
}
HAL_POWER_MODE
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h
index 6d38d65..938a68c 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212.h
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h
@@ -200,6 +200,7 @@ struct ar5212AniState {
#define HAL_ANI_ENA 0x00000001 /* ANI operation enabled */
#define HAL_RSSI_ANI_ENA 0x00000002 /* rssi-based processing ena'd*/
+#if 0
struct ar5212Stats {
uint32_t ast_ani_niup; /* ANI increased noise immunity */
uint32_t ast_ani_nidown; /* ANI decreased noise immunity */
@@ -219,6 +220,7 @@ struct ar5212Stats {
HAL_MIB_STATS ast_mibstats; /* MIB counter stats */
HAL_NODE_STATS ast_nodestats; /* Latest rssi stats from driver */
};
+#endif
/*
* NF Cal history buffer
@@ -258,7 +260,7 @@ struct ath_hal_5212 {
* Runtime state.
*/
uint32_t ah_maskReg; /* copy of AR_IMR */
- struct ar5212Stats ah_stats; /* various statistics */
+ HAL_ANI_STATS ah_stats; /* various statistics */
RF_HAL_FUNCS *ah_rfHal;
uint32_t ah_txDescMask; /* mask for TXDESC */
uint32_t ah_txOkInterruptMask;
@@ -270,7 +272,6 @@ struct ath_hal_5212 {
uint32_t ah_intrTxqs; /* tx q interrupt state */
/* decomp mask array */
uint8_t ah_decompMask[HAL_DECOMP_MASK_SIZE];
- HAL_POWER_MODE ah_powerMode;
HAL_ANT_SETTING ah_antControl; /* antenna setting */
HAL_BOOL ah_diversity; /* fast diversity setting */
enum {
@@ -320,7 +321,6 @@ struct ath_hal_5212 {
struct ar5212AniParams ah_aniParams5; /* 5GHz parameters */
struct ar5212AniState *ah_curani; /* cached last reference */
struct ar5212AniState ah_ani[AH_MAXCHAN]; /* per-channel state */
- HAL_CHANNEL_SURVEY ah_chansurvey; /* channel survey */
/* AR5416 uses some of the AR5212 ANI code; these are the ANI methods */
HAL_BOOL (*ah_aniControl) (struct ath_hal *, HAL_ANI_CMD cmd, int param);
@@ -345,6 +345,9 @@ struct ath_hal_5212 {
uint32_t ah_txBusy;
uint32_t ah_rx_chainmask;
uint32_t ah_tx_chainmask;
+
+ /* Used to return ANI statistics to the diagnostic API */
+ HAL_ANI_STATS ext_ani_stats;
};
#define AH5212(_ah) ((struct ath_hal_5212 *)(_ah))
@@ -627,7 +630,7 @@ extern void ar5212AniAttach(struct ath_hal *, const struct ar5212AniParams *,
const struct ar5212AniParams *, HAL_BOOL ena);
extern void ar5212AniDetach(struct ath_hal *);
extern struct ar5212AniState *ar5212AniGetCurrentState(struct ath_hal *);
-extern struct ar5212Stats *ar5212AniGetCurrentStats(struct ath_hal *);
+extern HAL_ANI_STATS *ar5212AniGetCurrentStats(struct ath_hal *);
extern HAL_BOOL ar5212AniControl(struct ath_hal *, HAL_ANI_CMD cmd, int param);
extern HAL_BOOL ar5212AniSetParams(struct ath_hal *,
const struct ar5212AniParams *, const struct ar5212AniParams *);
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c b/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
index 8e87a2f..c7b5932 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
@@ -110,7 +110,7 @@ ar5212AniGetCurrentState(struct ath_hal *ah)
/*
* Return the current statistics.
*/
-struct ar5212Stats *
+HAL_ANI_STATS *
ar5212AniGetCurrentStats(struct ath_hal *ah)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -869,7 +869,6 @@ ar5212AniGetListenTime(struct ath_hal *ah)
int32_t listenTime = 0;
int good;
HAL_SURVEY_SAMPLE hs;
- HAL_CHANNEL_SURVEY *cs = AH_NULL;
/*
* We shouldn't see ah_curchan be NULL, but just in case..
@@ -879,21 +878,13 @@ ar5212AniGetListenTime(struct ath_hal *ah)
return (0);
}
- cs = &ahp->ah_chansurvey;
-
/*
* Fetch the current statistics, squirrel away the current
* sample, bump the sequence/sample counter.
*/
OS_MEMZERO(&hs, sizeof(hs));
good = ar5212GetMibCycleCounts(ah, &hs);
- if (cs != AH_NULL) {
- OS_MEMCPY(&cs->samples[cs->cur_sample], &hs, sizeof(hs));
- cs->samples[cs->cur_sample].seq_num = cs->cur_seq;
- cs->cur_sample =
- (cs->cur_sample + 1) % CHANNEL_SURVEY_SAMPLE_COUNT;
- cs->cur_seq++;
- }
+ ath_hal_survey_add_sample(ah, &hs);
if (ANI_ENA(ah))
aniState = ahp->ah_curani;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
index e0af27c..a95f244 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
@@ -317,7 +317,7 @@ ar5212IsMacSupported(uint8_t macVersion, uint8_t macRev)
static struct ath_hal *
ar5212Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
- HAL_STATUS *status)
+ HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
{
#define AH_EEPROM_PROTECT(ah) \
(AH_PRIVATE(ah)->ah_ispcie)? AR_EEPROM_PROTECT_PCIE : AR_EEPROM_PROTECT)
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
index 71ee845..e2f1eb7 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
@@ -1052,6 +1052,7 @@ ar5212GetDiagState(struct ath_hal *ah, int request,
void **result, uint32_t *resultsize)
{
struct ath_hal_5212 *ahp = AH5212(ah);
+ HAL_ANI_STATS *astats;
(void) ahp;
if (ath_hal_getdiagstate(ah, request, args, argsize, result, resultsize))
@@ -1083,9 +1084,16 @@ ar5212GetDiagState(struct ath_hal *ah, int request,
0 : sizeof(struct ar5212AniState);
return AH_TRUE;
case HAL_DIAG_ANI_STATS:
- *result = ar5212AniGetCurrentStats(ah);
- *resultsize = (*result == AH_NULL) ?
- 0 : sizeof(struct ar5212Stats);
+ OS_MEMZERO(&ahp->ext_ani_stats, sizeof(ahp->ext_ani_stats));
+ astats = ar5212AniGetCurrentStats(ah);
+ if (astats == NULL) {
+ *result = NULL;
+ *resultsize = 0;
+ } else {
+ OS_MEMCPY(&ahp->ext_ani_stats, astats, sizeof(HAL_ANI_STATS));
+ *result = &ahp->ext_ani_stats;
+ *resultsize = sizeof(ahp->ext_ani_stats);
+ }
return AH_TRUE;
case HAL_DIAG_ANI_CMD:
if (argsize != 2*sizeof(uint32_t))
@@ -1113,10 +1121,6 @@ ar5212GetDiagState(struct ath_hal *ah, int request,
return ar5212AniSetParams(ah, args, args);
}
break;
- case HAL_DIAG_CHANSURVEY:
- *result = &ahp->ah_chansurvey;
- *resultsize = sizeof(HAL_CHANNEL_SURVEY);
- return AH_TRUE;
}
return AH_FALSE;
}
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_power.c b/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
index 3f755bd..3068510 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
@@ -119,7 +119,6 @@ ar5212SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
HAL_BOOL
ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
{
- struct ath_hal_5212 *ahp = AH5212(ah);
#ifdef AH_DEBUG
static const char* modes[] = {
"AWAKE",
@@ -131,24 +130,29 @@ ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
int status = AH_TRUE;
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
- modes[ahp->ah_powerMode], modes[mode],
+ modes[ah->ah_powerMode], modes[mode],
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
+ if (setChip)
+ ah->ah_powerMode = mode;
status = ar5212SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5212SetPowerModeSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5212SetPowerModeNetworkSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",
__func__, mode);
return AH_FALSE;
}
- ahp->ah_powerMode = mode;
return status;
}
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
index ccdccb6..fd3b473 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
@@ -197,7 +197,8 @@ ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode,
saveFrameSeqCount = 0; /* NB: silence compiler */
/* Blank the channel survey statistics */
- OS_MEMZERO(&ahp->ah_chansurvey, sizeof(ahp->ah_chansurvey));
+ ath_hal_survey_clear(ah);
+
#if 0
/*
* XXX disable for now; this appears to sometimes cause OFDM
diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c b/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
index 4ca1a4d..5c84eb8 100644
--- a/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
+++ b/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
@@ -62,7 +62,7 @@ ar5312AniSetup(struct ath_hal *ah)
static struct ath_hal *
ar5312Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
- HAL_STATUS *status)
+ HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH_NULL;
struct ath_hal *ah;
diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312_power.c b/sys/dev/ath/ath_hal/ar5312/ar5312_power.c
index 94a0f1c..7db6d80 100644
--- a/sys/dev/ath/ath_hal/ar5312/ar5312_power.c
+++ b/sys/dev/ath/ath_hal/ar5312/ar5312_power.c
@@ -71,7 +71,6 @@ ar5312SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
HAL_BOOL
ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
{
- struct ath_hal_5212 *ahp = AH5212(ah);
#ifdef AH_DEBUG
static const char* modes[] = {
"AWAKE",
@@ -83,7 +82,7 @@ ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
int status = AH_TRUE;
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
- modes[ahp->ah_powerMode], modes[mode],
+ modes[ah->ah_powerMode], modes[mode],
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
@@ -100,7 +99,7 @@ ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
__func__, mode);
return AH_FALSE;
}
- ahp->ah_powerMode = mode;
+ ah->ah_powerMode = mode;
return status;
}
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c b/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
index 3f9bc69..fadd5ad 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
@@ -818,7 +818,6 @@ ar5416AniGetListenTime(struct ath_hal *ah)
int32_t listenTime = 0;
int good;
HAL_SURVEY_SAMPLE hs;
- HAL_CHANNEL_SURVEY *cs = AH_NULL;
/*
* We shouldn't see ah_curchan be NULL, but just in case..
@@ -828,21 +827,13 @@ ar5416AniGetListenTime(struct ath_hal *ah)
return (0);
}
- cs = &ahp->ah_chansurvey;
-
/*
* Fetch the current statistics, squirrel away the current
- * sample, bump the sequence/sample counter.
+ * sample.
*/
OS_MEMZERO(&hs, sizeof(hs));
good = ar5416GetMibCycleCounts(ah, &hs);
- if (cs != AH_NULL) {
- OS_MEMCPY(&cs->samples[cs->cur_sample], &hs, sizeof(hs));
- cs->samples[cs->cur_sample].seq_num = cs->cur_seq;
- cs->cur_sample =
- (cs->cur_sample + 1) % CHANNEL_SURVEY_SAMPLE_COUNT;
- cs->cur_seq++;
- }
+ ath_hal_survey_add_sample(ah, &hs);
if (ANI_ENA(ah))
aniState = ahp->ah_curani;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
index 99bab06..a20499a 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
@@ -297,7 +297,7 @@ ar5416GetRadioRev(struct ath_hal *ah)
static struct ath_hal *
ar5416Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
- HAL_STATUS *status)
+ HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
{
struct ath_hal_5416 *ahp5416;
struct ath_hal_5212 *ahp;
@@ -1059,6 +1059,11 @@ ar5416FillCapabilityInfo(struct ath_hal *ah)
if (! AH_PRIVATE(ah)->ah_ispcie)
pCap->halSerialiseRegWar = 1;
+ /*
+ * AR5416 and later NICs support MYBEACON filtering.
+ */
+ pCap->halRxDoMyBeacon = AH_TRUE;
+
return AH_TRUE;
}
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c b/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
index e2bf6c7..6691c11 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
@@ -197,6 +197,25 @@ ar5416SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs)
* beacon jitter; cab timeout is max time to wait for cab
* after seeing the last DTIM or MORE CAB bit
*/
+
+/*
+ * I've bumped these to 30TU for now.
+ *
+ * Some APs (AR933x/AR934x?) in 2GHz especially seem to not always
+ * transmit beacon frames at exactly the right times and with it set
+ * to 10TU, the NIC starts not waking up at the right times to hear
+ * these slightly-larger-jitering beacons. It also never recovers
+ * from that (it doesn't resync? I'm not sure.)
+ *
+ * So for now bump this to 30TU. Ideally we'd cap this based on
+ * the beacon interval so the sum of CAB+BEACON timeouts never
+ * exceeded the beacon interval.
+ *
+ * Now, since we're doing all the math in the ath(4) driver in TU
+ * rather than TSF, we may be seeing the result of dumb rounding
+ * errors causing the jitter to actually be a much bigger problem.
+ * I'll have to investigate that with a fine tooth comb.
+ */
#define CAB_TIMEOUT_VAL 10 /* in TU */
#define BEACON_TIMEOUT_VAL 10 /* in TU */
#define SLEEP_SLOP 3 /* in TU */
@@ -248,6 +267,13 @@ ar5416SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs)
OS_REG_SET_BIT(ah, AR_TIMER_MODE,
AR_TIMER_MODE_TBTT | AR_TIMER_MODE_TIM | AR_TIMER_MODE_DTIM);
+
+#define HAL_TSFOOR_THRESHOLD 0x00004240 /* TSF OOR threshold (16k us) */
+
+ /* TSF out of range threshold */
+// OS_REG_WRITE(ah, AR_TSFOOR_THRESHOLD, bs->bs_tsfoor_threshold);
+ OS_REG_WRITE(ah, AR_TSFOOR_THRESHOLD, HAL_TSFOOR_THRESHOLD);
+
HALDEBUG(ah, HAL_DEBUG_BEACON, "%s: next DTIM %d\n",
__func__, bs->bs_nextdtim);
HALDEBUG(ah, HAL_DEBUG_BEACON, "%s: next beacon %d\n",
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
index d51417f4..35bb8d4 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
@@ -663,7 +663,7 @@ ar5416LoadNF(struct ath_hal *ah, const struct ieee80211_channel *chan)
* by the median we just loaded. This will be initial (and max) value
* of next noise floor calibration the baseband does.
*/
- for (i = 0; i < AR5416_NUM_NF_READINGS; i ++)
+ for (i = 0; i < AR5416_NUM_NF_READINGS; i ++) {
/* Don't write to EXT radio CCA registers unless in HT/40 mode */
/* XXX this check should really be cleaner! */
@@ -676,6 +676,7 @@ ar5416LoadNF(struct ath_hal *ah, const struct ieee80211_channel *chan)
val |= (((uint32_t)(-50) << 1) & 0x1ff);
OS_REG_WRITE(ah, ar5416_cca_regs[i], val);
}
+ }
}
/*
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c b/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
index 631ca2f..32ce2ed 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
@@ -337,6 +337,9 @@ ar5416SetInterrupts(struct ath_hal *ah, HAL_INT ints)
/* Write the new IMR and store off our SW copy. */
HALDEBUG(ah, HAL_DEBUG_INTERRUPT, "%s: new IMR 0x%x\n", __func__, mask);
OS_REG_WRITE(ah, AR_IMR, mask);
+ /* Flush write */
+ (void) OS_REG_READ(ah, AR_IMR);
+
mask = OS_REG_READ(ah, AR_IMR_S2) & ~(AR_IMR_S2_TIM |
AR_IMR_S2_DTIM |
AR_IMR_S2_DTIMSYNC |
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_power.c b/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
index 43a9241..dff9a85 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
@@ -124,7 +124,6 @@ ar5416SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
HAL_BOOL
ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
{
- struct ath_hal_5212 *ahp = AH5212(ah);
#ifdef AH_DEBUG
static const char* modes[] = {
"AWAKE",
@@ -134,27 +133,35 @@ ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
};
#endif
int status = AH_TRUE;
+
+#if 0
if (!setChip)
return AH_TRUE;
+#endif
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
- modes[ahp->ah_powerMode], modes[mode], setChip ? "set chip " : "");
+ modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
+ if (setChip)
+ ah->ah_powerMode = mode;
status = ar5416SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5416SetPowerModeSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5416SetPowerModeNetworkSleep(ah, setChip);
+ if (setChip)
+ ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode 0x%x\n",
__func__, mode);
return AH_FALSE;
}
- ahp->ah_powerMode = mode;
return status;
}
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
index eb31f08..baf0ccc 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
@@ -120,9 +120,10 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
HALASSERT(AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER14_1);
/* Blank the channel survey statistics */
- OS_MEMZERO(&ahp->ah_chansurvey, sizeof(ahp->ah_chansurvey));
+ ath_hal_survey_clear(ah);
/* XXX Turn on fast channel change for 5416 */
+
/*
* Preserve the bmiss rssi threshold and count threshold
* across resets
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
index 435599c..0ee1e70 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
@@ -476,10 +476,10 @@
/* Sleep control */
#define AR5416_SLEEP1_ASSUME_DTIM 0x00080000
#define AR5416_SLEEP1_CAB_TIMEOUT 0xFFE00000 /* Cab timeout (TU) */
-#define AR5416_SLEEP1_CAB_TIMEOUT_S 22
+#define AR5416_SLEEP1_CAB_TIMEOUT_S 21
#define AR5416_SLEEP2_BEACON_TIMEOUT 0xFFE00000 /* Beacon timeout (TU)*/
-#define AR5416_SLEEP2_BEACON_TIMEOUT_S 22
+#define AR5416_SLEEP2_BEACON_TIMEOUT_S 21
/* Sleep Registers */
#define AR_SLP32_HALFCLK_LATENCY 0x000FFFFF /* rising <-> falling edge */
diff --git a/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
index 4f478c0..c270bab 100644
--- a/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
+++ b/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
@@ -69,7 +69,9 @@ static HAL_BOOL ar9130FillCapabilityInfo(struct ath_hal *ah);
*/
static struct ath_hal *
ar9130Attach(uint16_t devid, HAL_SOFTC sc,
- HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata, HAL_STATUS *status)
+ HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config,
+ HAL_STATUS *status)
{
struct ath_hal_5416 *ahp5416;
struct ath_hal_5212 *ahp;
diff --git a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
index 979ba1a..5bda519 100644
--- a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
+++ b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
@@ -114,6 +114,7 @@ ar9160InitPLL(struct ath_hal *ah, const struct ieee80211_channel *chan)
static struct ath_hal *
ar9160Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config,
HAL_STATUS *status)
{
struct ath_hal_5416 *ahp5416;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
index 2a67fe5..3be3e35 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
@@ -148,6 +148,7 @@ ar9280InitPLL(struct ath_hal *ah, const struct ieee80211_channel *chan)
static struct ath_hal *
ar9280Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config,
HAL_STATUS *status)
{
struct ath_hal_9280 *ahp9280;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
index edb6f26..eb3490a 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
@@ -133,6 +133,7 @@ ar9285_eeprom_print_diversity_settings(struct ath_hal *ah)
static struct ath_hal *
ar9285Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config,
HAL_STATUS *status)
{
struct ath_hal_9285 *ahp9285;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
index 010e2c3..0ea565c 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
@@ -111,6 +111,7 @@ ar9287AniSetup(struct ath_hal *ah)
static struct ath_hal *
ar9287Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+ HAL_OPS_CONFIG *ah_config,
HAL_STATUS *status)
{
struct ath_hal_9287 *ahp9287;
OpenPOWER on IntegriCloud