2
* Copyright (c) 2008-2011 Atheros Communications Inc.
4
* Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
5
* Original from Linux kernel 3.0.1
7
* Permission to use, copy, modify, and/or distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
FILE_LICENCE ( BSD2 );
25
#define HAL_PROCESS_ANI 0x00000001
27
#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI) && ah->curchan)
29
#define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
31
/* units are errors per second */
32
#define ATH9K_ANI_OFDM_TRIG_HIGH_OLD 500
33
#define ATH9K_ANI_OFDM_TRIG_HIGH_NEW 1000
35
/* units are errors per second */
36
#define ATH9K_ANI_OFDM_TRIG_LOW_OLD 200
37
#define ATH9K_ANI_OFDM_TRIG_LOW_NEW 400
39
/* units are errors per second */
40
#define ATH9K_ANI_CCK_TRIG_HIGH_OLD 200
41
#define ATH9K_ANI_CCK_TRIG_HIGH_NEW 600
43
/* units are errors per second */
44
#define ATH9K_ANI_CCK_TRIG_LOW_OLD 100
45
#define ATH9K_ANI_CCK_TRIG_LOW_NEW 300
47
#define ATH9K_ANI_NOISE_IMMUNE_LVL 4
48
#define ATH9K_ANI_USE_OFDM_WEAK_SIG 1
49
#define ATH9K_ANI_CCK_WEAK_SIG_THR 0
51
#define ATH9K_ANI_SPUR_IMMUNE_LVL_OLD 7
52
#define ATH9K_ANI_SPUR_IMMUNE_LVL_NEW 3
54
#define ATH9K_ANI_FIRSTEP_LVL_OLD 0
55
#define ATH9K_ANI_FIRSTEP_LVL_NEW 2
57
#define ATH9K_ANI_RSSI_THR_HIGH 40
58
#define ATH9K_ANI_RSSI_THR_LOW 7
60
#define ATH9K_ANI_PERIOD_OLD 100
61
#define ATH9K_ANI_PERIOD_NEW 1000
64
#define ATH9K_ANI_POLLINTERVAL_OLD 100
65
#define ATH9K_ANI_POLLINTERVAL_NEW 1000
67
#define HAL_NOISE_IMMUNE_MAX 4
68
#define HAL_SPUR_IMMUNE_MAX 7
69
#define HAL_FIRST_STEP_MAX 2
71
#define ATH9K_SIG_FIRSTEP_SETTING_MIN 0
72
#define ATH9K_SIG_FIRSTEP_SETTING_MAX 20
73
#define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0
74
#define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22
76
#define ATH9K_ANI_ENABLE_MRC_CCK 1
78
/* values here are relative to the INI */
81
ATH9K_ANI_PRESENT = 0x1,
82
ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
83
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
84
ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
85
ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
86
ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
87
ATH9K_ANI_MODE = 0x40,
88
ATH9K_ANI_PHYERR_RESET = 0x80,
89
ATH9K_ANI_MRC_CCK = 0x100,
93
struct ath9k_mib_stats {
101
/* INI default values for ANI registers */
102
struct ath9k_ani_default {
119
struct ar5416AniState {
120
struct ath9k_channel *c;
121
u8 noiseImmunityLevel;
122
u8 ofdmNoiseImmunityLevel;
123
u8 cckNoiseImmunityLevel;
126
u8 spurImmunityLevel;
128
u8 ofdmWeakSigDetect;
129
u8 cckWeakSigThreshold;
137
int16_t ofdmErrRssi[2];
138
int16_t cckErrRssi[2];
139
struct ath9k_ani_default iniDef;
146
u32 ast_ani_spurdown;
152
u32 ast_ani_stepdown;
153
u32 ast_ani_ofdmerrs;
159
struct ath9k_mib_stats ast_mibstats;
161
#define ah_mibStats stats.ast_mibstats
163
void ath9k_enable_mib_counters(struct ath_hw *ah);
164
void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
165
void ath9k_hw_ani_setup(struct ath_hw *ah);
166
void ath9k_hw_ani_init(struct ath_hw *ah);
167
int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah,
168
struct ath9k_channel *chan);