2 * Copyright (c) 2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #define BMZERO {(u64) 0, (u64) 0}
25 #define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh, _fi, _fj, _fk, _fl) \
26 {((((_fa >= 0) && (_fa < 64)) ? \
27 (((u64) 1) << _fa) : (u64) 0) | \
28 (((_fb >= 0) && (_fb < 64)) ? \
29 (((u64) 1) << _fb) : (u64) 0) | \
30 (((_fc >= 0) && (_fc < 64)) ? \
31 (((u64) 1) << _fc) : (u64) 0) | \
32 (((_fd >= 0) && (_fd < 64)) ? \
33 (((u64) 1) << _fd) : (u64) 0) | \
34 (((_fe >= 0) && (_fe < 64)) ? \
35 (((u64) 1) << _fe) : (u64) 0) | \
36 (((_ff >= 0) && (_ff < 64)) ? \
37 (((u64) 1) << _ff) : (u64) 0) | \
38 (((_fg >= 0) && (_fg < 64)) ? \
39 (((u64) 1) << _fg) : (u64) 0) | \
40 (((_fh >= 0) && (_fh < 64)) ? \
41 (((u64) 1) << _fh) : (u64) 0) | \
42 (((_fi >= 0) && (_fi < 64)) ? \
43 (((u64) 1) << _fi) : (u64) 0) | \
44 (((_fj >= 0) && (_fj < 64)) ? \
45 (((u64) 1) << _fj) : (u64) 0) | \
46 (((_fk >= 0) && (_fk < 64)) ? \
47 (((u64) 1) << _fk) : (u64) 0) | \
48 (((_fl >= 0) && (_fl < 64)) ? \
49 (((u64) 1) << _fl) : (u64) 0) | \
50 ((((_fa > 63) && (_fa < 128)) ? \
51 (((u64) 1) << (_fa - 64)) : (u64) 0) | \
52 (((_fb > 63) && (_fb < 128)) ? \
53 (((u64) 1) << (_fb - 64)) : (u64) 0) | \
54 (((_fc > 63) && (_fc < 128)) ? \
55 (((u64) 1) << (_fc - 64)) : (u64) 0) | \
56 (((_fd > 63) && (_fd < 128)) ? \
57 (((u64) 1) << (_fd - 64)) : (u64) 0) | \
58 (((_fe > 63) && (_fe < 128)) ? \
59 (((u64) 1) << (_fe - 64)) : (u64) 0) | \
60 (((_ff > 63) && (_ff < 128)) ? \
61 (((u64) 1) << (_ff - 64)) : (u64) 0) | \
62 (((_fg > 63) && (_fg < 128)) ? \
63 (((u64) 1) << (_fg - 64)) : (u64) 0) | \
64 (((_fh > 63) && (_fh < 128)) ? \
65 (((u64) 1) << (_fh - 64)) : (u64) 0) | \
66 (((_fi > 63) && (_fi < 128)) ? \
67 (((u64) 1) << (_fi - 64)) : (u64) 0) | \
68 (((_fj > 63) && (_fj < 128)) ? \
69 (((u64) 1) << (_fj - 64)) : (u64) 0) | \
70 (((_fk > 63) && (_fk < 128)) ? \
71 (((u64) 1) << (_fk - 64)) : (u64) 0) | \
72 (((_fl > 63) && (_fl < 128)) ? \
73 (((u64) 1) << (_fl - 64)) : (u64) 0)))}
75 #define DEF_REGDMN FCC1_FCCA
76 #define DEF_DMN_5 FCC1
77 #define DEF_DMN_2 FCCA
78 #define COUNTRY_ERD_FLAG 0x8000
79 #define WORLDWIDE_ROAMING_FLAG 0x4000
80 #define SUPER_DOMAIN_MASK 0x0fff
81 #define COUNTRY_CODE_MASK 0x3fff
82 #define CF_INTERFERENCE (CHANNEL_CW_INT | CHANNEL_RADAR_INT)
83 #define CHANNEL_14 (2484)
84 #define IS_11G_CH14(_ch,_cf) \
85 (((_ch) == CHANNEL_14) && ((_cf) == CHANNEL_G))
87 #define NO_PSCAN 0x0ULL
88 #define PSCAN_FCC 0x0000000000000001ULL
89 #define PSCAN_FCC_T 0x0000000000000002ULL
90 #define PSCAN_ETSI 0x0000000000000004ULL
91 #define PSCAN_MKK1 0x0000000000000008ULL
92 #define PSCAN_MKK2 0x0000000000000010ULL
93 #define PSCAN_MKKA 0x0000000000000020ULL
94 #define PSCAN_MKKA_G 0x0000000000000040ULL
95 #define PSCAN_ETSIA 0x0000000000000080ULL
96 #define PSCAN_ETSIB 0x0000000000000100ULL
97 #define PSCAN_ETSIC 0x0000000000000200ULL
98 #define PSCAN_WWR 0x0000000000000400ULL
99 #define PSCAN_MKKA1 0x0000000000000800ULL
100 #define PSCAN_MKKA1_G 0x0000000000001000ULL
101 #define PSCAN_MKKA2 0x0000000000002000ULL
102 #define PSCAN_MKKA2_G 0x0000000000004000ULL
103 #define PSCAN_MKK3 0x0000000000008000ULL
104 #define PSCAN_DEFER 0x7FFFFFFFFFFFFFFFULL
105 #define IS_ECM_CHAN 0x8000000000000000ULL
107 #define isWwrSKU(_ah) \
108 (((ath9k_regd_get_eepromRD((_ah)) & WORLD_SKU_MASK) == \
109 WORLD_SKU_PREFIX) || \
110 (ath9k_regd_get_eepromRD(_ah) == WORLD))
112 #define isWwrSKU_NoMidband(_ah) \
113 ((ath9k_regd_get_eepromRD((_ah)) == WOR3_WORLD) || \
114 (ath9k_regd_get_eepromRD(_ah) == WOR4_WORLD) || \
115 (ath9k_regd_get_eepromRD(_ah) == WOR5_ETSIC))
117 #define isUNII1OddChan(ch) \
118 ((ch == 5170) || (ch == 5190) || (ch == 5210) || (ch == 5230))
120 #define IS_HT40_MODE(_mode) \
121 (((_mode == ATH9K_MODE_11NA_HT40PLUS || \
122 _mode == ATH9K_MODE_11NG_HT40PLUS || \
123 _mode == ATH9K_MODE_11NA_HT40MINUS || \
124 _mode == ATH9K_MODE_11NG_HT40MINUS) ? true : false))
126 #define CHAN_FLAGS (CHANNEL_ALL|CHANNEL_HALF|CHANNEL_QUARTER)
128 #define swap(_a, _b, _size) { \
140 #define HALF_MAXCHANBW 10
142 #define MULTI_DOMAIN_MASK 0xFF00
144 #define WORLD_SKU_MASK 0x00F0
145 #define WORLD_SKU_PREFIX 0x0060
147 #define CHANNEL_HALF_BW 10
148 #define CHANNEL_QUARTER_BW 5
150 typedef int ath_hal_cmp_t(const void *, const void *);
152 struct reg_dmn_pair_mapping {
167 struct country_code_to_enum_rd {
179 u16 outdoorChanStart;
182 struct RegDmnFreqBand {
196 u8 conformanceTestLimit;
201 u64 chan11a_turbo[BMLEN];
202 u64 chan11a_dyn_turbo[BMLEN];
205 u64 chan11g_turbo[BMLEN];
216 struct japan_bandcheck {
218 u32 eepromflagtocheck;
221 struct common_mode_power {
234 CTRY_AZERBAIJAN = 31,
240 CTRY_BOSNIA_HERZ = 70,
242 CTRY_BRUNEI_DARUSSALAM = 96,
248 CTRY_COSTA_RICA = 188,
253 CTRY_DOMINICAN_REPUBLIC = 214,
256 CTRY_EL_SALVADOR = 222,
258 CTRY_FAEROE_ISLANDS = 234,
264 CTRY_GUATEMALA = 320,
266 CTRY_HONG_KONG = 344,
270 CTRY_INDONESIA = 360,
279 CTRY_KAZAKHSTAN = 398,
281 CTRY_KOREA_NORTH = 408,
282 CTRY_KOREA_ROC = 410,
283 CTRY_KOREA_ROC2 = 411,
284 CTRY_KOREA_ROC3 = 412,
289 CTRY_LIECHTENSTEIN = 438,
290 CTRY_LITHUANIA = 440,
291 CTRY_LUXEMBOURG = 442,
293 CTRY_MACEDONIA = 807,
300 CTRY_NETHERLANDS = 528,
301 CTRY_NETHERLANDS_ANTILLES = 530,
302 CTRY_NEW_ZEALAND = 554,
303 CTRY_NICARAGUA = 558,
308 CTRY_PAPUA_NEW_GUINEA = 598,
311 CTRY_PHILIPPINES = 608,
314 CTRY_PUERTO_RICO = 630,
318 CTRY_SAUDI_ARABIA = 682,
319 CTRY_SERBIA_MONTENEGRO = 891,
320 CTRY_SINGAPORE = 702,
323 CTRY_SOUTH_AFRICA = 710,
325 CTRY_SRI_LANKA = 144,
327 CTRY_SWITZERLAND = 756,
331 CTRY_TRINIDAD_Y_TOBAGO = 780,
336 CTRY_UNITED_KINGDOM = 826,
337 CTRY_UNITED_STATES = 840,
338 CTRY_UNITED_STATES_FCC49 = 842,
340 CTRY_UZBEKISTAN = 860,
341 CTRY_VENEZUELA = 862,
404 CTRY_AUSTRALIA2 = 5000,
409 void ath9k_regd_get_current_country(struct ath_hal *ah,
410 struct ath9k_country_entry *ctry);