aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/Kconfig4
-rw-r--r--drivers/net/wireless/ath/Makefile3
-rw-r--r--drivers/net/wireless/ath/regd.c519
-rw-r--r--drivers/net/wireless/ath/regd.h272
-rw-r--r--drivers/net/wireless/ath/regd_common.h473
5 files changed, 1271 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
new file mode 100644
index 000000000000..c2873a24baae
--- /dev/null
+++ b/drivers/net/wireless/ath/Kconfig
@@ -0,0 +1,4 @@
1config ATH_COMMON
2 tristate "Atheros Wireless Cards Shared Support"
3 depends on ATH5K || ATH9K
4
diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile
new file mode 100644
index 000000000000..bc77646f90ad
--- /dev/null
+++ b/drivers/net/wireless/ath/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_ATH_COMMON) += ath.o
2ath-objs := regd.o
3
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
new file mode 100644
index 000000000000..4d3935b6fbdd
--- /dev/null
+++ b/drivers/net/wireless/ath/regd.c
@@ -0,0 +1,519 @@
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 *
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.
7 *
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.
15 */
16
17#include <linux/kernel.h>
18#include <linux/slab.h>
19#include <net/cfg80211.h>
20#include <net/mac80211.h>
21#include <net/wireless.h>
22#include "regd.h"
23#include "regd_common.h"
24
25/*
26 * This is a set of common rules used by our world regulatory domains.
27 * We have 12 world regulatory domains. To save space we consolidate
28 * the regulatory domains in 5 structures by frequency and change
29 * the flags on our reg_notifier() on a case by case basis.
30 */
31
32/* Only these channels all allow active scan on all world regulatory domains */
33#define ATH9K_2GHZ_CH01_11 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
34
35/* We enable active scan on these a case by case basis by regulatory domain */
36#define ATH9K_2GHZ_CH12_13 REG_RULE(2467-10, 2472+10, 40, 0, 20,\
37 NL80211_RRF_PASSIVE_SCAN)
38#define ATH9K_2GHZ_CH14 REG_RULE(2484-10, 2484+10, 40, 0, 20,\
39 NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM)
40
41/* We allow IBSS on these on a case by case basis by regulatory domain */
42#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 40, 0, 30,\
43 NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
44#define ATH9K_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 40, 0, 30,\
45 NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
46#define ATH9K_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 40, 0, 30,\
47 NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
48
49#define ATH9K_2GHZ_ALL ATH9K_2GHZ_CH01_11, \
50 ATH9K_2GHZ_CH12_13, \
51 ATH9K_2GHZ_CH14
52
53#define ATH9K_5GHZ_ALL ATH9K_5GHZ_5150_5350, \
54 ATH9K_5GHZ_5470_5850
55/* This one skips what we call "mid band" */
56#define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \
57 ATH9K_5GHZ_5725_5850
58
59/* Can be used for:
60 * 0x60, 0x61, 0x62 */
61static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = {
62 .n_reg_rules = 5,
63 .alpha2 = "99",
64 .reg_rules = {
65 ATH9K_2GHZ_ALL,
66 ATH9K_5GHZ_ALL,
67 }
68};
69
70/* Can be used by 0x63 and 0x65 */
71static const struct ieee80211_regdomain ath_world_regdom_63_65 = {
72 .n_reg_rules = 4,
73 .alpha2 = "99",
74 .reg_rules = {
75 ATH9K_2GHZ_CH01_11,
76 ATH9K_2GHZ_CH12_13,
77 ATH9K_5GHZ_NO_MIDBAND,
78 }
79};
80
81/* Can be used by 0x64 only */
82static const struct ieee80211_regdomain ath_world_regdom_64 = {
83 .n_reg_rules = 3,
84 .alpha2 = "99",
85 .reg_rules = {
86 ATH9K_2GHZ_CH01_11,
87 ATH9K_5GHZ_NO_MIDBAND,
88 }
89};
90
91/* Can be used by 0x66 and 0x69 */
92static const struct ieee80211_regdomain ath_world_regdom_66_69 = {
93 .n_reg_rules = 3,
94 .alpha2 = "99",
95 .reg_rules = {
96 ATH9K_2GHZ_CH01_11,
97 ATH9K_5GHZ_ALL,
98 }
99};
100
101/* Can be used by 0x67, 0x6A and 0x68 */
102static const struct ieee80211_regdomain ath_world_regdom_67_68_6A = {
103 .n_reg_rules = 4,
104 .alpha2 = "99",
105 .reg_rules = {
106 ATH9K_2GHZ_CH01_11,
107 ATH9K_2GHZ_CH12_13,
108 ATH9K_5GHZ_ALL,
109 }
110};
111
112static inline bool is_wwr_sku(u16 regd)
113{
114 return ((regd & WORLD_SKU_MASK) == WORLD_SKU_PREFIX) ||
115 (regd == WORLD);
116}
117
118static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg)
119{
120 return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG;
121}
122
123bool ath_is_world_regd(struct ath_regulatory *reg)
124{
125 return is_wwr_sku(ath_regd_get_eepromRD(reg));
126}
127EXPORT_SYMBOL(ath_is_world_regd);
128
129const struct ieee80211_regdomain *ath_default_world_regdomain(void)
130{
131 /* this is the most restrictive */
132 return &ath_world_regdom_64;
133}
134EXPORT_SYMBOL(ath_default_world_regdomain);
135
136const struct
137ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg)
138{
139 switch (reg->regpair->regDmnEnum) {
140 case 0x60:
141 case 0x61:
142 case 0x62:
143 return &ath_world_regdom_60_61_62;
144 case 0x63:
145 case 0x65:
146 return &ath_world_regdom_63_65;
147 case 0x64:
148 return &ath_world_regdom_64;
149 case 0x66:
150 case 0x69:
151 return &ath_world_regdom_66_69;
152 case 0x67:
153 case 0x68:
154 case 0x6A:
155 return &ath_world_regdom_67_68_6A;
156 default:
157 WARN_ON(1);
158 return ath_default_world_regdomain();
159 }
160}
161EXPORT_SYMBOL(ath_world_regdomain);
162
163/* Frequency is one where radar detection is required */
164static bool ath_is_radar_freq(u16 center_freq)
165{
166 return (center_freq >= 5260 && center_freq <= 5700);
167}
168
169/*
170 * N.B: These exception rules do not apply radar freqs.
171 *
172 * - We enable adhoc (or beaconing) if allowed by 11d
173 * - We enable active scan if the channel is allowed by 11d
174 * - If no country IE has been processed and a we determine we have
175 * received a beacon on a channel we can enable active scan and
176 * adhoc (or beaconing).
177 */
178static void ath_reg_apply_beaconing_flags(
179 struct wiphy *wiphy,
180 enum nl80211_reg_initiator initiator)
181{
182 enum ieee80211_band band;
183 struct ieee80211_supported_band *sband;
184 const struct ieee80211_reg_rule *reg_rule;
185 struct ieee80211_channel *ch;
186 unsigned int i;
187 u32 bandwidth = 0;
188 int r;
189
190 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
191
192 if (!wiphy->bands[band])
193 continue;
194
195 sband = wiphy->bands[band];
196
197 for (i = 0; i < sband->n_channels; i++) {
198
199 ch = &sband->channels[i];
200
201 if (ath_is_radar_freq(ch->center_freq) ||
202 (ch->flags & IEEE80211_CHAN_RADAR))
203 continue;
204
205 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) {
206 r = freq_reg_info(wiphy, ch->center_freq,
207 &bandwidth, &reg_rule);
208 if (r)
209 continue;
210 /*
211 * If 11d had a rule for this channel ensure
212 * we enable adhoc/beaconing if it allows us to
213 * use it. Note that we would have disabled it
214 * by applying our static world regdomain by
215 * default during init, prior to calling our
216 * regulatory_hint().
217 */
218 if (!(reg_rule->flags &
219 NL80211_RRF_NO_IBSS))
220 ch->flags &=
221 ~IEEE80211_CHAN_NO_IBSS;
222 if (!(reg_rule->flags &
223 NL80211_RRF_PASSIVE_SCAN))
224 ch->flags &=
225 ~IEEE80211_CHAN_PASSIVE_SCAN;
226 } else {
227 if (ch->beacon_found)
228 ch->flags &= ~(IEEE80211_CHAN_NO_IBSS |
229 IEEE80211_CHAN_PASSIVE_SCAN);
230 }
231 }
232 }
233
234}
235
236/* Allows active scan scan on Ch 12 and 13 */
237static void ath_reg_apply_active_scan_flags(
238 struct wiphy *wiphy,
239 enum nl80211_reg_initiator initiator)
240{
241 struct ieee80211_supported_band *sband;
242 struct ieee80211_channel *ch;
243 const struct ieee80211_reg_rule *reg_rule;
244 u32 bandwidth = 0;
245 int r;
246
247 sband = wiphy->bands[IEEE80211_BAND_2GHZ];
248
249 /*
250 * If no country IE has been received always enable active scan
251 * on these channels. This is only done for specific regulatory SKUs
252 */
253 if (initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) {
254 ch = &sband->channels[11]; /* CH 12 */
255 if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
256 ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
257 ch = &sband->channels[12]; /* CH 13 */
258 if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
259 ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
260 return;
261 }
262
263 /*
264 * If a country IE has been recieved check its rule for this
265 * channel first before enabling active scan. The passive scan
266 * would have been enforced by the initial processing of our
267 * custom regulatory domain.
268 */
269
270 ch = &sband->channels[11]; /* CH 12 */
271 r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
272 if (!r) {
273 if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
274 if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
275 ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
276 }
277
278 ch = &sband->channels[12]; /* CH 13 */
279 r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
280 if (!r) {
281 if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
282 if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
283 ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
284 }
285}
286
287/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */
288void ath_reg_apply_radar_flags(struct wiphy *wiphy)
289{
290 struct ieee80211_supported_band *sband;
291 struct ieee80211_channel *ch;
292 unsigned int i;
293
294 if (!wiphy->bands[IEEE80211_BAND_5GHZ])
295 return;
296
297 sband = wiphy->bands[IEEE80211_BAND_5GHZ];
298
299 for (i = 0; i < sband->n_channels; i++) {
300 ch = &sband->channels[i];
301 if (!ath_is_radar_freq(ch->center_freq))
302 continue;
303 /* We always enable radar detection/DFS on this
304 * frequency range. Additionally we also apply on
305 * this frequency range:
306 * - If STA mode does not yet have DFS supports disable
307 * active scanning
308 * - If adhoc mode does not support DFS yet then
309 * disable adhoc in the frequency.
310 * - If AP mode does not yet support radar detection/DFS
311 * do not allow AP mode
312 */
313 if (!(ch->flags & IEEE80211_CHAN_DISABLED))
314 ch->flags |= IEEE80211_CHAN_RADAR |
315 IEEE80211_CHAN_NO_IBSS |
316 IEEE80211_CHAN_PASSIVE_SCAN;
317 }
318}
319EXPORT_SYMBOL(ath_reg_apply_radar_flags);
320
321void ath_reg_apply_world_flags(struct wiphy *wiphy,
322 enum nl80211_reg_initiator initiator,
323 struct ath_regulatory *reg)
324{
325 switch (reg->regpair->regDmnEnum) {
326 case 0x60:
327 case 0x63:
328 case 0x66:
329 case 0x67:
330 ath_reg_apply_beaconing_flags(wiphy, initiator);
331 break;
332 case 0x68:
333 ath_reg_apply_beaconing_flags(wiphy, initiator);
334 ath_reg_apply_active_scan_flags(wiphy, initiator);
335 break;
336 }
337 return;
338}
339EXPORT_SYMBOL(ath_reg_apply_world_flags);
340
341int ath_reg_notifier_apply(struct wiphy *wiphy,
342 struct regulatory_request *request, struct ath_regulatory *reg)
343{
344 /* We always apply this */
345 ath_reg_apply_radar_flags(wiphy);
346
347 switch (request->initiator) {
348 case NL80211_REGDOM_SET_BY_DRIVER:
349 case NL80211_REGDOM_SET_BY_CORE:
350 case NL80211_REGDOM_SET_BY_USER:
351 break;
352 case NL80211_REGDOM_SET_BY_COUNTRY_IE:
353 if (ath_is_world_regd(reg))
354 ath_reg_apply_world_flags(wiphy, request->initiator,
355 reg);
356 break;
357 }
358
359 return 0;
360}
361EXPORT_SYMBOL(ath_reg_notifier_apply);
362
363bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
364{
365 u16 rd = ath_regd_get_eepromRD(reg);
366 int i;
367
368 if (rd & COUNTRY_ERD_FLAG) {
369 /* EEPROM value is a country code */
370 u16 cc = rd & ~COUNTRY_ERD_FLAG;
371 for (i = 0; i < ARRAY_SIZE(allCountries); i++)
372 if (allCountries[i].countryCode == cc)
373 return true;
374 } else {
375 /* EEPROM value is a regpair value */
376 for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
377 if (regDomainPairs[i].regDmnEnum == rd)
378 return true;
379 }
380 printk(KERN_DEBUG
381 "ath: invalid regulatory domain/country code 0x%x\n", rd);
382 return false;
383}
384EXPORT_SYMBOL(ath_regd_is_eeprom_valid);
385
386/* EEPROM country code to regpair mapping */
387static struct country_code_to_enum_rd*
388ath_regd_find_country(u16 countryCode)
389{
390 int i;
391
392 for (i = 0; i < ARRAY_SIZE(allCountries); i++) {
393 if (allCountries[i].countryCode == countryCode)
394 return &allCountries[i];
395 }
396 return NULL;
397}
398
399/* EEPROM rd code to regpair mapping */
400static struct country_code_to_enum_rd*
401ath_regd_find_country_by_rd(int regdmn)
402{
403 int i;
404
405 for (i = 0; i < ARRAY_SIZE(allCountries); i++) {
406 if (allCountries[i].regDmnEnum == regdmn)
407 return &allCountries[i];
408 }
409 return NULL;
410}
411
412/* Returns the map of the EEPROM set RD to a country code */
413static u16 ath_regd_get_default_country(u16 rd)
414{
415 if (rd & COUNTRY_ERD_FLAG) {
416 struct country_code_to_enum_rd *country = NULL;
417 u16 cc = rd & ~COUNTRY_ERD_FLAG;
418
419 country = ath_regd_find_country(cc);
420 if (country != NULL)
421 return cc;
422 }
423
424 return CTRY_DEFAULT;
425}
426
427static struct reg_dmn_pair_mapping*
428ath_get_regpair(int regdmn)
429{
430 int i;
431
432 if (regdmn == NO_ENUMRD)
433 return NULL;
434 for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) {
435 if (regDomainPairs[i].regDmnEnum == regdmn)
436 return &regDomainPairs[i];
437 }
438 return NULL;
439}
440
441int ath_regd_init(struct ath_regulatory *reg)
442{
443 struct country_code_to_enum_rd *country = NULL;
444 u16 regdmn;
445
446 if (!ath_regd_is_eeprom_valid(reg)) {
447 printk(KERN_DEBUG "ath: Invalid EEPROM contents\n");
448 return -EINVAL;
449 }
450
451 regdmn = ath_regd_get_eepromRD(reg);
452 reg->country_code = ath_regd_get_default_country(regdmn);
453
454 if (reg->country_code == CTRY_DEFAULT &&
455 regdmn == CTRY_DEFAULT)
456 reg->country_code = CTRY_UNITED_STATES;
457
458 if (reg->country_code == CTRY_DEFAULT) {
459 country = NULL;
460 } else {
461 country = ath_regd_find_country(reg->country_code);
462 if (country == NULL) {
463 printk(KERN_DEBUG
464 "ath: Country is NULL!!!!, cc= %d\n",
465 reg->country_code);
466 return -EINVAL;
467 } else
468 regdmn = country->regDmnEnum;
469 }
470
471 reg->regpair = ath_get_regpair(regdmn);
472
473 if (!reg->regpair) {
474 printk(KERN_DEBUG "ath: "
475 "No regulatory domain pair found, cannot continue\n");
476 return -EINVAL;
477 }
478
479 if (!country)
480 country = ath_regd_find_country_by_rd(regdmn);
481
482 if (country) {
483 reg->alpha2[0] = country->isoName[0];
484 reg->alpha2[1] = country->isoName[1];
485 } else {
486 reg->alpha2[0] = '0';
487 reg->alpha2[1] = '0';
488 }
489
490 printk(KERN_DEBUG "ath: Country alpha2 being used: %c%c\n",
491 reg->alpha2[0], reg->alpha2[1]);
492 printk(KERN_DEBUG "ath: Regpair detected: 0x%0x\n",
493 reg->regpair->regDmnEnum);
494
495 return 0;
496}
497EXPORT_SYMBOL(ath_regd_init);
498
499u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
500 enum ieee80211_band band)
501{
502 if (!reg->regpair ||
503 (reg->country_code == CTRY_DEFAULT &&
504 is_wwr_sku(ath_regd_get_eepromRD(reg)))) {
505 return SD_NO_CTL;
506 }
507
508 switch (band) {
509 case IEEE80211_BAND_2GHZ:
510 return reg->regpair->reg_2ghz_ctl;
511 case IEEE80211_BAND_5GHZ:
512 return reg->regpair->reg_5ghz_ctl;
513 default:
514 return NO_CTL;
515 }
516
517 return NO_CTL;
518}
519EXPORT_SYMBOL(ath_regd_get_band_ctl);
diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h
new file mode 100644
index 000000000000..981f5cf2bdb8
--- /dev/null
+++ b/drivers/net/wireless/ath/regd.h
@@ -0,0 +1,272 @@
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 *
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.
7 *
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.
15 */
16
17#ifndef REGD_H
18#define REGD_H
19
20#include <linux/nl80211.h>
21
22#include <net/cfg80211.h>
23#include <net/wireless.h>
24
25#define NO_CTL 0xff
26#define SD_NO_CTL 0xE0
27#define NO_CTL 0xff
28#define CTL_MODE_M 7
29#define CTL_11A 0
30#define CTL_11B 1
31#define CTL_11G 2
32#define CTL_2GHT20 5
33#define CTL_5GHT20 6
34#define CTL_2GHT40 7
35#define CTL_5GHT40 8
36
37#define CTRY_DEBUG 0x1ff
38#define CTRY_DEFAULT 0
39
40#define COUNTRY_ERD_FLAG 0x8000
41#define WORLDWIDE_ROAMING_FLAG 0x4000
42
43#define MULTI_DOMAIN_MASK 0xFF00
44
45#define WORLD_SKU_MASK 0x00F0
46#define WORLD_SKU_PREFIX 0x0060
47
48#define CHANNEL_HALF_BW 10
49#define CHANNEL_QUARTER_BW 5
50
51struct reg_dmn_pair_mapping {
52 u16 regDmnEnum;
53 u16 reg_5ghz_ctl;
54 u16 reg_2ghz_ctl;
55};
56
57struct country_code_to_enum_rd {
58 u16 countryCode;
59 u16 regDmnEnum;
60 const char *isoName;
61};
62
63struct ath_regulatory {
64 char alpha2[2];
65 u16 country_code;
66 u16 max_power_level;
67 u32 tp_scale;
68 u16 current_rd;
69 u16 current_rd_ext;
70 int16_t power_limit;
71 struct reg_dmn_pair_mapping *regpair;
72};
73
74enum CountryCode {
75 CTRY_ALBANIA = 8,
76 CTRY_ALGERIA = 12,
77 CTRY_ARGENTINA = 32,
78 CTRY_ARMENIA = 51,
79 CTRY_AUSTRALIA = 36,
80 CTRY_AUSTRIA = 40,
81 CTRY_AZERBAIJAN = 31,
82 CTRY_BAHRAIN = 48,
83 CTRY_BELARUS = 112,
84 CTRY_BELGIUM = 56,
85 CTRY_BELIZE = 84,
86 CTRY_BOLIVIA = 68,
87 CTRY_BOSNIA_HERZ = 70,
88 CTRY_BRAZIL = 76,
89 CTRY_BRUNEI_DARUSSALAM = 96,
90 CTRY_BULGARIA = 100,
91 CTRY_CANADA = 124,
92 CTRY_CHILE = 152,
93 CTRY_CHINA = 156,
94 CTRY_COLOMBIA = 170,
95 CTRY_COSTA_RICA = 188,
96 CTRY_CROATIA = 191,
97 CTRY_CYPRUS = 196,
98 CTRY_CZECH = 203,
99 CTRY_DENMARK = 208,
100 CTRY_DOMINICAN_REPUBLIC = 214,
101 CTRY_ECUADOR = 218,
102 CTRY_EGYPT = 818,
103 CTRY_EL_SALVADOR = 222,
104 CTRY_ESTONIA = 233,
105 CTRY_FAEROE_ISLANDS = 234,
106 CTRY_FINLAND = 246,
107 CTRY_FRANCE = 250,
108 CTRY_GEORGIA = 268,
109 CTRY_GERMANY = 276,
110 CTRY_GREECE = 300,
111 CTRY_GUATEMALA = 320,
112 CTRY_HONDURAS = 340,
113 CTRY_HONG_KONG = 344,
114 CTRY_HUNGARY = 348,
115 CTRY_ICELAND = 352,
116 CTRY_INDIA = 356,
117 CTRY_INDONESIA = 360,
118 CTRY_IRAN = 364,
119 CTRY_IRAQ = 368,
120 CTRY_IRELAND = 372,
121 CTRY_ISRAEL = 376,
122 CTRY_ITALY = 380,
123 CTRY_JAMAICA = 388,
124 CTRY_JAPAN = 392,
125 CTRY_JORDAN = 400,
126 CTRY_KAZAKHSTAN = 398,
127 CTRY_KENYA = 404,
128 CTRY_KOREA_NORTH = 408,
129 CTRY_KOREA_ROC = 410,
130 CTRY_KOREA_ROC2 = 411,
131 CTRY_KOREA_ROC3 = 412,
132 CTRY_KUWAIT = 414,
133 CTRY_LATVIA = 428,
134 CTRY_LEBANON = 422,
135 CTRY_LIBYA = 434,
136 CTRY_LIECHTENSTEIN = 438,
137 CTRY_LITHUANIA = 440,
138 CTRY_LUXEMBOURG = 442,
139 CTRY_MACAU = 446,
140 CTRY_MACEDONIA = 807,
141 CTRY_MALAYSIA = 458,
142 CTRY_MALTA = 470,
143 CTRY_MEXICO = 484,
144 CTRY_MONACO = 492,
145 CTRY_MOROCCO = 504,
146 CTRY_NEPAL = 524,
147 CTRY_NETHERLANDS = 528,
148 CTRY_NETHERLANDS_ANTILLES = 530,
149 CTRY_NEW_ZEALAND = 554,
150 CTRY_NICARAGUA = 558,
151 CTRY_NORWAY = 578,
152 CTRY_OMAN = 512,
153 CTRY_PAKISTAN = 586,
154 CTRY_PANAMA = 591,
155 CTRY_PAPUA_NEW_GUINEA = 598,
156 CTRY_PARAGUAY = 600,
157 CTRY_PERU = 604,
158 CTRY_PHILIPPINES = 608,
159 CTRY_POLAND = 616,
160 CTRY_PORTUGAL = 620,
161 CTRY_PUERTO_RICO = 630,
162 CTRY_QATAR = 634,
163 CTRY_ROMANIA = 642,
164 CTRY_RUSSIA = 643,
165 CTRY_SAUDI_ARABIA = 682,
166 CTRY_SERBIA_MONTENEGRO = 891,
167 CTRY_SINGAPORE = 702,
168 CTRY_SLOVAKIA = 703,
169 CTRY_SLOVENIA = 705,
170 CTRY_SOUTH_AFRICA = 710,
171 CTRY_SPAIN = 724,
172 CTRY_SRI_LANKA = 144,
173 CTRY_SWEDEN = 752,
174 CTRY_SWITZERLAND = 756,
175 CTRY_SYRIA = 760,
176 CTRY_TAIWAN = 158,
177 CTRY_THAILAND = 764,
178 CTRY_TRINIDAD_Y_TOBAGO = 780,
179 CTRY_TUNISIA = 788,
180 CTRY_TURKEY = 792,
181 CTRY_UAE = 784,
182 CTRY_UKRAINE = 804,
183 CTRY_UNITED_KINGDOM = 826,
184 CTRY_UNITED_STATES = 840,
185 CTRY_UNITED_STATES_FCC49 = 842,
186 CTRY_URUGUAY = 858,
187 CTRY_UZBEKISTAN = 860,
188 CTRY_VENEZUELA = 862,
189 CTRY_VIET_NAM = 704,
190 CTRY_YEMEN = 887,
191 CTRY_ZIMBABWE = 716,
192 CTRY_JAPAN1 = 393,
193 CTRY_JAPAN2 = 394,
194 CTRY_JAPAN3 = 395,
195 CTRY_JAPAN4 = 396,
196 CTRY_JAPAN5 = 397,
197 CTRY_JAPAN6 = 4006,
198 CTRY_JAPAN7 = 4007,
199 CTRY_JAPAN8 = 4008,
200 CTRY_JAPAN9 = 4009,
201 CTRY_JAPAN10 = 4010,
202 CTRY_JAPAN11 = 4011,
203 CTRY_JAPAN12 = 4012,
204 CTRY_JAPAN13 = 4013,
205 CTRY_JAPAN14 = 4014,
206 CTRY_JAPAN15 = 4015,
207 CTRY_JAPAN16 = 4016,
208 CTRY_JAPAN17 = 4017,
209 CTRY_JAPAN18 = 4018,
210 CTRY_JAPAN19 = 4019,
211 CTRY_JAPAN20 = 4020,
212 CTRY_JAPAN21 = 4021,
213 CTRY_JAPAN22 = 4022,
214 CTRY_JAPAN23 = 4023,
215 CTRY_JAPAN24 = 4024,
216 CTRY_JAPAN25 = 4025,
217 CTRY_JAPAN26 = 4026,
218 CTRY_JAPAN27 = 4027,
219 CTRY_JAPAN28 = 4028,
220 CTRY_JAPAN29 = 4029,
221 CTRY_JAPAN30 = 4030,
222 CTRY_JAPAN31 = 4031,
223 CTRY_JAPAN32 = 4032,
224 CTRY_JAPAN33 = 4033,
225 CTRY_JAPAN34 = 4034,
226 CTRY_JAPAN35 = 4035,
227 CTRY_JAPAN36 = 4036,
228 CTRY_JAPAN37 = 4037,
229 CTRY_JAPAN38 = 4038,
230 CTRY_JAPAN39 = 4039,
231 CTRY_JAPAN40 = 4040,
232 CTRY_JAPAN41 = 4041,
233 CTRY_JAPAN42 = 4042,
234 CTRY_JAPAN43 = 4043,
235 CTRY_JAPAN44 = 4044,
236 CTRY_JAPAN45 = 4045,
237 CTRY_JAPAN46 = 4046,
238 CTRY_JAPAN47 = 4047,
239 CTRY_JAPAN48 = 4048,
240 CTRY_JAPAN49 = 4049,
241 CTRY_JAPAN50 = 4050,
242 CTRY_JAPAN51 = 4051,
243 CTRY_JAPAN52 = 4052,
244 CTRY_JAPAN53 = 4053,
245 CTRY_JAPAN54 = 4054,
246 CTRY_JAPAN55 = 4055,
247 CTRY_JAPAN56 = 4056,
248 CTRY_JAPAN57 = 4057,
249 CTRY_JAPAN58 = 4058,
250 CTRY_JAPAN59 = 4059,
251 CTRY_AUSTRALIA2 = 5000,
252 CTRY_CANADA2 = 5001,
253 CTRY_BELGIUM2 = 5002
254};
255
256bool ath_is_world_regd(struct ath_regulatory *reg);
257const
258struct ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg);
259const struct ieee80211_regdomain *ath_default_world_regdomain(void);
260void ath_reg_apply_world_flags(struct wiphy *wiphy,
261 enum nl80211_reg_initiator,
262 struct ath_regulatory *reg);
263void ath_reg_apply_radar_flags(struct wiphy *wiphy);
264int ath_regd_init(struct ath_regulatory *reg);
265bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg);
266u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
267 enum ieee80211_band band);
268int ath_reg_notifier_apply(struct wiphy *wiphy,
269 struct regulatory_request *request,
270 struct ath_regulatory *reg);
271
272#endif
diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h
new file mode 100644
index 000000000000..4d0e298cd1c7
--- /dev/null
+++ b/drivers/net/wireless/ath/regd_common.h
@@ -0,0 +1,473 @@
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 *
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.
7 *
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.
15 */
16
17#ifndef REGD_COMMON_H
18#define REGD_COMMON_H
19
20enum EnumRd {
21 NO_ENUMRD = 0x00,
22 NULL1_WORLD = 0x03,
23 NULL1_ETSIB = 0x07,
24 NULL1_ETSIC = 0x08,
25 FCC1_FCCA = 0x10,
26 FCC1_WORLD = 0x11,
27 FCC4_FCCA = 0x12,
28 FCC5_FCCA = 0x13,
29 FCC6_FCCA = 0x14,
30
31 FCC2_FCCA = 0x20,
32 FCC2_WORLD = 0x21,
33 FCC2_ETSIC = 0x22,
34 FCC6_WORLD = 0x23,
35 FRANCE_RES = 0x31,
36 FCC3_FCCA = 0x3A,
37 FCC3_WORLD = 0x3B,
38
39 ETSI1_WORLD = 0x37,
40 ETSI3_ETSIA = 0x32,
41 ETSI2_WORLD = 0x35,
42 ETSI3_WORLD = 0x36,
43 ETSI4_WORLD = 0x30,
44 ETSI4_ETSIC = 0x38,
45 ETSI5_WORLD = 0x39,
46 ETSI6_WORLD = 0x34,
47 ETSI_RESERVED = 0x33,
48
49 MKK1_MKKA = 0x40,
50 MKK1_MKKB = 0x41,
51 APL4_WORLD = 0x42,
52 MKK2_MKKA = 0x43,
53 APL_RESERVED = 0x44,
54 APL2_WORLD = 0x45,
55 APL2_APLC = 0x46,
56 APL3_WORLD = 0x47,
57 MKK1_FCCA = 0x48,
58 APL2_APLD = 0x49,
59 MKK1_MKKA1 = 0x4A,
60 MKK1_MKKA2 = 0x4B,
61 MKK1_MKKC = 0x4C,
62
63 APL3_FCCA = 0x50,
64 APL1_WORLD = 0x52,
65 APL1_FCCA = 0x53,
66 APL1_APLA = 0x54,
67 APL1_ETSIC = 0x55,
68 APL2_ETSIC = 0x56,
69 APL5_WORLD = 0x58,
70 APL6_WORLD = 0x5B,
71 APL7_FCCA = 0x5C,
72 APL8_WORLD = 0x5D,
73 APL9_WORLD = 0x5E,
74
75 WOR0_WORLD = 0x60,
76 WOR1_WORLD = 0x61,
77 WOR2_WORLD = 0x62,
78 WOR3_WORLD = 0x63,
79 WOR4_WORLD = 0x64,
80 WOR5_ETSIC = 0x65,
81
82 WOR01_WORLD = 0x66,
83 WOR02_WORLD = 0x67,
84 EU1_WORLD = 0x68,
85
86 WOR9_WORLD = 0x69,
87 WORA_WORLD = 0x6A,
88 WORB_WORLD = 0x6B,
89
90 MKK3_MKKB = 0x80,
91 MKK3_MKKA2 = 0x81,
92 MKK3_MKKC = 0x82,
93
94 MKK4_MKKB = 0x83,
95 MKK4_MKKA2 = 0x84,
96 MKK4_MKKC = 0x85,
97
98 MKK5_MKKB = 0x86,
99 MKK5_MKKA2 = 0x87,
100 MKK5_MKKC = 0x88,
101
102 MKK6_MKKB = 0x89,
103 MKK6_MKKA2 = 0x8A,
104 MKK6_MKKC = 0x8B,
105
106 MKK7_MKKB = 0x8C,
107 MKK7_MKKA2 = 0x8D,
108 MKK7_MKKC = 0x8E,
109
110 MKK8_MKKB = 0x8F,
111 MKK8_MKKA2 = 0x90,
112 MKK8_MKKC = 0x91,
113
114 MKK14_MKKA1 = 0x92,
115 MKK15_MKKA1 = 0x93,
116
117 MKK10_FCCA = 0xD0,
118 MKK10_MKKA1 = 0xD1,
119 MKK10_MKKC = 0xD2,
120 MKK10_MKKA2 = 0xD3,
121
122 MKK11_MKKA = 0xD4,
123 MKK11_FCCA = 0xD5,
124 MKK11_MKKA1 = 0xD6,
125 MKK11_MKKC = 0xD7,
126 MKK11_MKKA2 = 0xD8,
127
128 MKK12_MKKA = 0xD9,
129 MKK12_FCCA = 0xDA,
130 MKK12_MKKA1 = 0xDB,
131 MKK12_MKKC = 0xDC,
132 MKK12_MKKA2 = 0xDD,
133
134 MKK13_MKKB = 0xDE,
135
136 MKK3_MKKA = 0xF0,
137 MKK3_MKKA1 = 0xF1,
138 MKK3_FCCA = 0xF2,
139 MKK4_MKKA = 0xF3,
140 MKK4_MKKA1 = 0xF4,
141 MKK4_FCCA = 0xF5,
142 MKK9_MKKA = 0xF6,
143 MKK10_MKKA = 0xF7,
144 MKK6_MKKA1 = 0xF8,
145 MKK6_FCCA = 0xF9,
146 MKK7_MKKA1 = 0xFA,
147 MKK7_FCCA = 0xFB,
148 MKK9_FCCA = 0xFC,
149 MKK9_MKKA1 = 0xFD,
150 MKK9_MKKC = 0xFE,
151 MKK9_MKKA2 = 0xFF,
152
153 WORLD = 0x0199,
154 DEBUG_REG_DMN = 0x01ff,
155};
156
157enum ctl_group {
158 CTL_FCC = 0x10,
159 CTL_MKK = 0x40,
160 CTL_ETSI = 0x30,
161};
162
163/* Regpair to CTL band mapping */
164static struct reg_dmn_pair_mapping regDomainPairs[] = {
165 /* regpair, 5 GHz CTL, 2 GHz CTL */
166 {NO_ENUMRD, DEBUG_REG_DMN, DEBUG_REG_DMN},
167 {NULL1_WORLD, NO_CTL, CTL_ETSI},
168 {NULL1_ETSIB, NO_CTL, CTL_ETSI},
169 {NULL1_ETSIC, NO_CTL, CTL_ETSI},
170
171 {FCC2_FCCA, CTL_FCC, CTL_FCC},
172 {FCC2_WORLD, CTL_FCC, CTL_ETSI},
173 {FCC2_ETSIC, CTL_FCC, CTL_ETSI},
174 {FCC3_FCCA, CTL_FCC, CTL_FCC},
175 {FCC3_WORLD, CTL_FCC, CTL_ETSI},
176 {FCC4_FCCA, CTL_FCC, CTL_FCC},
177 {FCC5_FCCA, CTL_FCC, CTL_FCC},
178 {FCC6_FCCA, CTL_FCC, CTL_FCC},
179 {FCC6_WORLD, CTL_FCC, CTL_ETSI},
180
181 {ETSI1_WORLD, CTL_ETSI, CTL_ETSI},
182 {ETSI2_WORLD, CTL_ETSI, CTL_ETSI},
183 {ETSI3_WORLD, CTL_ETSI, CTL_ETSI},
184 {ETSI4_WORLD, CTL_ETSI, CTL_ETSI},
185 {ETSI5_WORLD, CTL_ETSI, CTL_ETSI},
186 {ETSI6_WORLD, CTL_ETSI, CTL_ETSI},
187
188 /* XXX: For ETSI3_ETSIA, Was NO_CTL meant for the 2 GHz band ? */
189 {ETSI3_ETSIA, CTL_ETSI, CTL_ETSI},
190 {FRANCE_RES, CTL_ETSI, CTL_ETSI},
191
192 {FCC1_WORLD, CTL_FCC, CTL_ETSI},
193 {FCC1_FCCA, CTL_FCC, CTL_FCC},
194 {APL1_WORLD, CTL_FCC, CTL_ETSI},
195 {APL2_WORLD, CTL_FCC, CTL_ETSI},
196 {APL3_WORLD, CTL_FCC, CTL_ETSI},
197 {APL4_WORLD, CTL_FCC, CTL_ETSI},
198 {APL5_WORLD, CTL_FCC, CTL_ETSI},
199 {APL6_WORLD, CTL_ETSI, CTL_ETSI},
200 {APL8_WORLD, CTL_ETSI, CTL_ETSI},
201 {APL9_WORLD, CTL_ETSI, CTL_ETSI},
202
203 {APL3_FCCA, CTL_FCC, CTL_FCC},
204 {APL1_ETSIC, CTL_FCC, CTL_ETSI},
205 {APL2_ETSIC, CTL_FCC, CTL_ETSI},
206 {APL2_APLD, CTL_FCC, NO_CTL},
207
208 {MKK1_MKKA, CTL_MKK, CTL_MKK},
209 {MKK1_MKKB, CTL_MKK, CTL_MKK},
210 {MKK1_FCCA, CTL_MKK, CTL_FCC},
211 {MKK1_MKKA1, CTL_MKK, CTL_MKK},
212 {MKK1_MKKA2, CTL_MKK, CTL_MKK},
213 {MKK1_MKKC, CTL_MKK, CTL_MKK},
214
215 {MKK2_MKKA, CTL_MKK, CTL_MKK},
216 {MKK3_MKKA, CTL_MKK, CTL_MKK},
217 {MKK3_MKKB, CTL_MKK, CTL_MKK},
218 {MKK3_MKKA1, CTL_MKK, CTL_MKK},
219 {MKK3_MKKA2, CTL_MKK, CTL_MKK},
220 {MKK3_MKKC, CTL_MKK, CTL_MKK},
221 {MKK3_FCCA, CTL_MKK, CTL_FCC},
222
223 {MKK4_MKKA, CTL_MKK, CTL_MKK},
224 {MKK4_MKKB, CTL_MKK, CTL_MKK},
225 {MKK4_MKKA1, CTL_MKK, CTL_MKK},
226 {MKK4_MKKA2, CTL_MKK, CTL_MKK},
227 {MKK4_MKKC, CTL_MKK, CTL_MKK},
228 {MKK4_FCCA, CTL_MKK, CTL_FCC},
229
230 {MKK5_MKKB, CTL_MKK, CTL_MKK},
231 {MKK5_MKKA2, CTL_MKK, CTL_MKK},
232 {MKK5_MKKC, CTL_MKK, CTL_MKK},
233
234 {MKK6_MKKB, CTL_MKK, CTL_MKK},
235 {MKK6_MKKA1, CTL_MKK, CTL_MKK},
236 {MKK6_MKKA2, CTL_MKK, CTL_MKK},
237 {MKK6_MKKC, CTL_MKK, CTL_MKK},
238 {MKK6_FCCA, CTL_MKK, CTL_FCC},
239
240 {MKK7_MKKB, CTL_MKK, CTL_MKK},
241 {MKK7_MKKA1, CTL_MKK, CTL_MKK},
242 {MKK7_MKKA2, CTL_MKK, CTL_MKK},
243 {MKK7_MKKC, CTL_MKK, CTL_MKK},
244 {MKK7_FCCA, CTL_MKK, CTL_FCC},
245
246 {MKK8_MKKB, CTL_MKK, CTL_MKK},
247 {MKK8_MKKA2, CTL_MKK, CTL_MKK},
248 {MKK8_MKKC, CTL_MKK, CTL_MKK},
249
250 {MKK9_MKKA, CTL_MKK, CTL_MKK},
251 {MKK9_FCCA, CTL_MKK, CTL_FCC},
252 {MKK9_MKKA1, CTL_MKK, CTL_MKK},
253 {MKK9_MKKA2, CTL_MKK, CTL_MKK},
254 {MKK9_MKKC, CTL_MKK, CTL_MKK},
255
256 {MKK10_MKKA, CTL_MKK, CTL_MKK},
257 {MKK10_FCCA, CTL_MKK, CTL_FCC},
258 {MKK10_MKKA1, CTL_MKK, CTL_MKK},
259 {MKK10_MKKA2, CTL_MKK, CTL_MKK},
260 {MKK10_MKKC, CTL_MKK, CTL_MKK},
261
262 {MKK11_MKKA, CTL_MKK, CTL_MKK},
263 {MKK11_FCCA, CTL_MKK, CTL_FCC},
264 {MKK11_MKKA1, CTL_MKK, CTL_MKK},
265 {MKK11_MKKA2, CTL_MKK, CTL_MKK},
266 {MKK11_MKKC, CTL_MKK, CTL_MKK},
267
268 {MKK12_MKKA, CTL_MKK, CTL_MKK},
269 {MKK12_FCCA, CTL_MKK, CTL_FCC},
270 {MKK12_MKKA1, CTL_MKK, CTL_MKK},
271 {MKK12_MKKA2, CTL_MKK, CTL_MKK},
272 {MKK12_MKKC, CTL_MKK, CTL_MKK},
273
274 {MKK13_MKKB, CTL_MKK, CTL_MKK},
275 {MKK14_MKKA1, CTL_MKK, CTL_MKK},
276 {MKK15_MKKA1, CTL_MKK, CTL_MKK},
277
278 {WOR0_WORLD, NO_CTL, NO_CTL},
279 {WOR1_WORLD, NO_CTL, NO_CTL},
280 {WOR2_WORLD, NO_CTL, NO_CTL},
281 {WOR3_WORLD, NO_CTL, NO_CTL},
282 {WOR4_WORLD, NO_CTL, NO_CTL},
283 {WOR5_ETSIC, NO_CTL, NO_CTL},
284 {WOR01_WORLD, NO_CTL, NO_CTL},
285 {WOR02_WORLD, NO_CTL, NO_CTL},
286 {EU1_WORLD, NO_CTL, NO_CTL},
287 {WOR9_WORLD, NO_CTL, NO_CTL},
288 {WORA_WORLD, NO_CTL, NO_CTL},
289 {WORB_WORLD, NO_CTL, NO_CTL},
290};
291
292static struct country_code_to_enum_rd allCountries[] = {
293 {CTRY_DEBUG, NO_ENUMRD, "DB"},
294 {CTRY_DEFAULT, FCC1_FCCA, "CO"},
295 {CTRY_ALBANIA, NULL1_WORLD, "AL"},
296 {CTRY_ALGERIA, NULL1_WORLD, "DZ"},
297 {CTRY_ARGENTINA, APL3_WORLD, "AR"},
298 {CTRY_ARMENIA, ETSI4_WORLD, "AM"},
299 {CTRY_AUSTRALIA, FCC2_WORLD, "AU"},
300 {CTRY_AUSTRALIA2, FCC6_WORLD, "AU"},
301 {CTRY_AUSTRIA, ETSI1_WORLD, "AT"},
302 {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ"},
303 {CTRY_BAHRAIN, APL6_WORLD, "BH"},
304 {CTRY_BELARUS, ETSI1_WORLD, "BY"},
305 {CTRY_BELGIUM, ETSI1_WORLD, "BE"},
306 {CTRY_BELGIUM2, ETSI4_WORLD, "BL"},
307 {CTRY_BELIZE, APL1_ETSIC, "BZ"},
308 {CTRY_BOLIVIA, APL1_ETSIC, "BO"},
309 {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA"},
310 {CTRY_BRAZIL, FCC3_WORLD, "BR"},
311 {CTRY_BRUNEI_DARUSSALAM, APL1_WORLD, "BN"},
312 {CTRY_BULGARIA, ETSI6_WORLD, "BG"},
313 {CTRY_CANADA, FCC2_FCCA, "CA"},
314 {CTRY_CANADA2, FCC6_FCCA, "CA"},
315 {CTRY_CHILE, APL6_WORLD, "CL"},
316 {CTRY_CHINA, APL1_WORLD, "CN"},
317 {CTRY_COLOMBIA, FCC1_FCCA, "CO"},
318 {CTRY_COSTA_RICA, FCC1_WORLD, "CR"},
319 {CTRY_CROATIA, ETSI3_WORLD, "HR"},
320 {CTRY_CYPRUS, ETSI1_WORLD, "CY"},
321 {CTRY_CZECH, ETSI3_WORLD, "CZ"},
322 {CTRY_DENMARK, ETSI1_WORLD, "DK"},
323 {CTRY_DOMINICAN_REPUBLIC, FCC1_FCCA, "DO"},
324 {CTRY_ECUADOR, FCC1_WORLD, "EC"},
325 {CTRY_EGYPT, ETSI3_WORLD, "EG"},
326 {CTRY_EL_SALVADOR, FCC1_WORLD, "SV"},
327 {CTRY_ESTONIA, ETSI1_WORLD, "EE"},
328 {CTRY_FINLAND, ETSI1_WORLD, "FI"},
329 {CTRY_FRANCE, ETSI1_WORLD, "FR"},
330 {CTRY_GEORGIA, ETSI4_WORLD, "GE"},
331 {CTRY_GERMANY, ETSI1_WORLD, "DE"},
332 {CTRY_GREECE, ETSI1_WORLD, "GR"},
333 {CTRY_GUATEMALA, FCC1_FCCA, "GT"},
334 {CTRY_HONDURAS, NULL1_WORLD, "HN"},
335 {CTRY_HONG_KONG, FCC2_WORLD, "HK"},
336 {CTRY_HUNGARY, ETSI1_WORLD, "HU"},
337 {CTRY_ICELAND, ETSI1_WORLD, "IS"},
338 {CTRY_INDIA, APL6_WORLD, "IN"},
339 {CTRY_INDONESIA, APL1_WORLD, "ID"},
340 {CTRY_IRAN, APL1_WORLD, "IR"},
341 {CTRY_IRELAND, ETSI1_WORLD, "IE"},
342 {CTRY_ISRAEL, NULL1_WORLD, "IL"},
343 {CTRY_ITALY, ETSI1_WORLD, "IT"},
344 {CTRY_JAMAICA, ETSI1_WORLD, "JM"},
345
346 {CTRY_JAPAN, MKK1_MKKA, "JP"},
347 {CTRY_JAPAN1, MKK1_MKKB, "JP"},
348 {CTRY_JAPAN2, MKK1_FCCA, "JP"},
349 {CTRY_JAPAN3, MKK2_MKKA, "JP"},
350 {CTRY_JAPAN4, MKK1_MKKA1, "JP"},
351 {CTRY_JAPAN5, MKK1_MKKA2, "JP"},
352 {CTRY_JAPAN6, MKK1_MKKC, "JP"},
353 {CTRY_JAPAN7, MKK3_MKKB, "JP"},
354 {CTRY_JAPAN8, MKK3_MKKA2, "JP"},
355 {CTRY_JAPAN9, MKK3_MKKC, "JP"},
356 {CTRY_JAPAN10, MKK4_MKKB, "JP"},
357 {CTRY_JAPAN11, MKK4_MKKA2, "JP"},
358 {CTRY_JAPAN12, MKK4_MKKC, "JP"},
359 {CTRY_JAPAN13, MKK5_MKKB, "JP"},
360 {CTRY_JAPAN14, MKK5_MKKA2, "JP"},
361 {CTRY_JAPAN15, MKK5_MKKC, "JP"},
362 {CTRY_JAPAN16, MKK6_MKKB, "JP"},
363 {CTRY_JAPAN17, MKK6_MKKA2, "JP"},
364 {CTRY_JAPAN18, MKK6_MKKC, "JP"},
365 {CTRY_JAPAN19, MKK7_MKKB, "JP"},
366 {CTRY_JAPAN20, MKK7_MKKA2, "JP"},
367 {CTRY_JAPAN21, MKK7_MKKC, "JP"},
368 {CTRY_JAPAN22, MKK8_MKKB, "JP"},
369 {CTRY_JAPAN23, MKK8_MKKA2, "JP"},
370 {CTRY_JAPAN24, MKK8_MKKC, "JP"},
371 {CTRY_JAPAN25, MKK3_MKKA, "JP"},
372 {CTRY_JAPAN26, MKK3_MKKA1, "JP"},
373 {CTRY_JAPAN27, MKK3_FCCA, "JP"},
374 {CTRY_JAPAN28, MKK4_MKKA1, "JP"},
375 {CTRY_JAPAN29, MKK4_FCCA, "JP"},
376 {CTRY_JAPAN30, MKK6_MKKA1, "JP"},
377 {CTRY_JAPAN31, MKK6_FCCA, "JP"},
378 {CTRY_JAPAN32, MKK7_MKKA1, "JP"},
379 {CTRY_JAPAN33, MKK7_FCCA, "JP"},
380 {CTRY_JAPAN34, MKK9_MKKA, "JP"},
381 {CTRY_JAPAN35, MKK10_MKKA, "JP"},
382 {CTRY_JAPAN36, MKK4_MKKA, "JP"},
383 {CTRY_JAPAN37, MKK9_FCCA, "JP"},
384 {CTRY_JAPAN38, MKK9_MKKA1, "JP"},
385 {CTRY_JAPAN39, MKK9_MKKC, "JP"},
386 {CTRY_JAPAN40, MKK9_MKKA2, "JP"},
387 {CTRY_JAPAN41, MKK10_FCCA, "JP"},
388 {CTRY_JAPAN42, MKK10_MKKA1, "JP"},
389 {CTRY_JAPAN43, MKK10_MKKC, "JP"},
390 {CTRY_JAPAN44, MKK10_MKKA2, "JP"},
391 {CTRY_JAPAN45, MKK11_MKKA, "JP"},
392 {CTRY_JAPAN46, MKK11_FCCA, "JP"},
393 {CTRY_JAPAN47, MKK11_MKKA1, "JP"},
394 {CTRY_JAPAN48, MKK11_MKKC, "JP"},
395 {CTRY_JAPAN49, MKK11_MKKA2, "JP"},
396 {CTRY_JAPAN50, MKK12_MKKA, "JP"},
397 {CTRY_JAPAN51, MKK12_FCCA, "JP"},
398 {CTRY_JAPAN52, MKK12_MKKA1, "JP"},
399 {CTRY_JAPAN53, MKK12_MKKC, "JP"},
400 {CTRY_JAPAN54, MKK12_MKKA2, "JP"},
401 {CTRY_JAPAN57, MKK13_MKKB, "JP"},
402 {CTRY_JAPAN58, MKK14_MKKA1, "JP"},
403 {CTRY_JAPAN59, MKK15_MKKA1, "JP"},
404
405 {CTRY_JORDAN, ETSI2_WORLD, "JO"},
406 {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ"},
407 {CTRY_KOREA_NORTH, APL9_WORLD, "KP"},
408 {CTRY_KOREA_ROC, APL9_WORLD, "KR"},
409 {CTRY_KOREA_ROC2, APL2_WORLD, "K2"},
410 {CTRY_KOREA_ROC3, APL9_WORLD, "K3"},
411 {CTRY_KUWAIT, NULL1_WORLD, "KW"},
412 {CTRY_LATVIA, ETSI1_WORLD, "LV"},
413 {CTRY_LEBANON, NULL1_WORLD, "LB"},
414 {CTRY_LIECHTENSTEIN, ETSI1_WORLD, "LI"},
415 {CTRY_LITHUANIA, ETSI1_WORLD, "LT"},
416 {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU"},
417 {CTRY_MACAU, FCC2_WORLD, "MO"},
418 {CTRY_MACEDONIA, NULL1_WORLD, "MK"},
419 {CTRY_MALAYSIA, APL8_WORLD, "MY"},
420 {CTRY_MALTA, ETSI1_WORLD, "MT"},
421 {CTRY_MEXICO, FCC1_FCCA, "MX"},
422 {CTRY_MONACO, ETSI4_WORLD, "MC"},
423 {CTRY_MOROCCO, NULL1_WORLD, "MA"},
424 {CTRY_NEPAL, APL1_WORLD, "NP"},
425 {CTRY_NETHERLANDS, ETSI1_WORLD, "NL"},
426 {CTRY_NETHERLANDS_ANTILLES, ETSI1_WORLD, "AN"},
427 {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ"},
428 {CTRY_NORWAY, ETSI1_WORLD, "NO"},
429 {CTRY_OMAN, APL6_WORLD, "OM"},
430 {CTRY_PAKISTAN, NULL1_WORLD, "PK"},
431 {CTRY_PANAMA, FCC1_FCCA, "PA"},
432 {CTRY_PAPUA_NEW_GUINEA, FCC1_WORLD, "PG"},
433 {CTRY_PERU, APL1_WORLD, "PE"},
434 {CTRY_PHILIPPINES, APL1_WORLD, "PH"},
435 {CTRY_POLAND, ETSI1_WORLD, "PL"},
436 {CTRY_PORTUGAL, ETSI1_WORLD, "PT"},
437 {CTRY_PUERTO_RICO, FCC1_FCCA, "PR"},
438 {CTRY_QATAR, NULL1_WORLD, "QA"},
439 {CTRY_ROMANIA, NULL1_WORLD, "RO"},
440 {CTRY_RUSSIA, NULL1_WORLD, "RU"},
441 {CTRY_SAUDI_ARABIA, NULL1_WORLD, "SA"},
442 {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS"},
443 {CTRY_SINGAPORE, APL6_WORLD, "SG"},
444 {CTRY_SLOVAKIA, ETSI1_WORLD, "SK"},
445 {CTRY_SLOVENIA, ETSI1_WORLD, "SI"},
446 {CTRY_SOUTH_AFRICA, FCC3_WORLD, "ZA"},
447 {CTRY_SPAIN, ETSI1_WORLD, "ES"},
448 {CTRY_SRI_LANKA, FCC3_WORLD, "LK"},
449 {CTRY_SWEDEN, ETSI1_WORLD, "SE"},
450 {CTRY_SWITZERLAND, ETSI1_WORLD, "CH"},
451 {CTRY_SYRIA, NULL1_WORLD, "SY"},
452 {CTRY_TAIWAN, APL3_FCCA, "TW"},
453 {CTRY_THAILAND, NULL1_WORLD, "TH"},
454 {CTRY_TRINIDAD_Y_TOBAGO, ETSI4_WORLD, "TT"},
455 {CTRY_TUNISIA, ETSI3_WORLD, "TN"},
456 {CTRY_TURKEY, ETSI3_WORLD, "TR"},
457 {CTRY_UKRAINE, NULL1_WORLD, "UA"},
458 {CTRY_UAE, NULL1_WORLD, "AE"},
459 {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
460 {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
461 /* This "PS" is for US public safety actually... to support this we
462 * would need to assign new special alpha2 to CRDA db as with the world
463 * regdomain and use another alpha2 */
464 {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS"},
465 {CTRY_URUGUAY, APL2_WORLD, "UY"},
466 {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ"},
467 {CTRY_VENEZUELA, APL2_ETSIC, "VE"},
468 {CTRY_VIET_NAM, NULL1_WORLD, "VN"},
469 {CTRY_YEMEN, NULL1_WORLD, "YE"},
470 {CTRY_ZIMBABWE, NULL1_WORLD, "ZW"},
471};
472
473#endif