aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/regd.h
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-03-30 22:30:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:37 -0400
commit3a702e49c03ba959e3f5bb2b74ec9921a81c8c98 (patch)
tree721e8a222648284660f5bf6c5edfba5a6e4d4527 /drivers/net/wireless/ath/regd.h
parentc02cf3738c9dbc446c160b9d49a001eb2be316c8 (diff)
atheros: introduce ath module containing common ath5k/ath9k/ar9170 code
This change creates a new module, ath.ko, which includes code that can be shared between ath5k, ath9k and ar9170. For now, extract most of the ath9k regulatory code so it can also be used in ath5k. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/regd.h')
-rw-r--r--drivers/net/wireless/ath/regd.h272
1 files changed, 272 insertions, 0 deletions
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