ath9k: convert isWwrSKU macro into C code
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / net / wireless / ath9k / regd.h
blob8f0bfcc907b5556fdd7feb4fd1304836e3937539
1 /*
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.
17 #ifndef REGD_H
18 #define REGD_H
20 #define COUNTRY_ERD_FLAG 0x8000
21 #define WORLDWIDE_ROAMING_FLAG 0x4000
23 #define MULTI_DOMAIN_MASK 0xFF00
25 #define WORLD_SKU_MASK 0x00F0
26 #define WORLD_SKU_PREFIX 0x0060
28 #define CHANNEL_HALF_BW 10
29 #define CHANNEL_QUARTER_BW 5
31 struct reg_dmn_pair_mapping {
32 u16 regDmnEnum;
33 u16 reg_5ghz_ctl;
34 u16 reg_2ghz_ctl;
37 struct country_code_to_enum_rd {
38 u16 countryCode;
39 u16 regDmnEnum;
40 const char *isoName;
43 struct ath9k_regulatory {
44 char alpha2[2];
45 u16 country_code;
46 u16 max_power_level;
47 u32 tp_scale;
48 u16 current_rd;
49 u16 current_rd_ext;
50 int16_t power_limit;
51 struct reg_dmn_pair_mapping *regpair;
54 enum CountryCode {
55 CTRY_ALBANIA = 8,
56 CTRY_ALGERIA = 12,
57 CTRY_ARGENTINA = 32,
58 CTRY_ARMENIA = 51,
59 CTRY_AUSTRALIA = 36,
60 CTRY_AUSTRIA = 40,
61 CTRY_AZERBAIJAN = 31,
62 CTRY_BAHRAIN = 48,
63 CTRY_BELARUS = 112,
64 CTRY_BELGIUM = 56,
65 CTRY_BELIZE = 84,
66 CTRY_BOLIVIA = 68,
67 CTRY_BOSNIA_HERZ = 70,
68 CTRY_BRAZIL = 76,
69 CTRY_BRUNEI_DARUSSALAM = 96,
70 CTRY_BULGARIA = 100,
71 CTRY_CANADA = 124,
72 CTRY_CHILE = 152,
73 CTRY_CHINA = 156,
74 CTRY_COLOMBIA = 170,
75 CTRY_COSTA_RICA = 188,
76 CTRY_CROATIA = 191,
77 CTRY_CYPRUS = 196,
78 CTRY_CZECH = 203,
79 CTRY_DENMARK = 208,
80 CTRY_DOMINICAN_REPUBLIC = 214,
81 CTRY_ECUADOR = 218,
82 CTRY_EGYPT = 818,
83 CTRY_EL_SALVADOR = 222,
84 CTRY_ESTONIA = 233,
85 CTRY_FAEROE_ISLANDS = 234,
86 CTRY_FINLAND = 246,
87 CTRY_FRANCE = 250,
88 CTRY_GEORGIA = 268,
89 CTRY_GERMANY = 276,
90 CTRY_GREECE = 300,
91 CTRY_GUATEMALA = 320,
92 CTRY_HONDURAS = 340,
93 CTRY_HONG_KONG = 344,
94 CTRY_HUNGARY = 348,
95 CTRY_ICELAND = 352,
96 CTRY_INDIA = 356,
97 CTRY_INDONESIA = 360,
98 CTRY_IRAN = 364,
99 CTRY_IRAQ = 368,
100 CTRY_IRELAND = 372,
101 CTRY_ISRAEL = 376,
102 CTRY_ITALY = 380,
103 CTRY_JAMAICA = 388,
104 CTRY_JAPAN = 392,
105 CTRY_JORDAN = 400,
106 CTRY_KAZAKHSTAN = 398,
107 CTRY_KENYA = 404,
108 CTRY_KOREA_NORTH = 408,
109 CTRY_KOREA_ROC = 410,
110 CTRY_KOREA_ROC2 = 411,
111 CTRY_KOREA_ROC3 = 412,
112 CTRY_KUWAIT = 414,
113 CTRY_LATVIA = 428,
114 CTRY_LEBANON = 422,
115 CTRY_LIBYA = 434,
116 CTRY_LIECHTENSTEIN = 438,
117 CTRY_LITHUANIA = 440,
118 CTRY_LUXEMBOURG = 442,
119 CTRY_MACAU = 446,
120 CTRY_MACEDONIA = 807,
121 CTRY_MALAYSIA = 458,
122 CTRY_MALTA = 470,
123 CTRY_MEXICO = 484,
124 CTRY_MONACO = 492,
125 CTRY_MOROCCO = 504,
126 CTRY_NEPAL = 524,
127 CTRY_NETHERLANDS = 528,
128 CTRY_NETHERLANDS_ANTILLES = 530,
129 CTRY_NEW_ZEALAND = 554,
130 CTRY_NICARAGUA = 558,
131 CTRY_NORWAY = 578,
132 CTRY_OMAN = 512,
133 CTRY_PAKISTAN = 586,
134 CTRY_PANAMA = 591,
135 CTRY_PAPUA_NEW_GUINEA = 598,
136 CTRY_PARAGUAY = 600,
137 CTRY_PERU = 604,
138 CTRY_PHILIPPINES = 608,
139 CTRY_POLAND = 616,
140 CTRY_PORTUGAL = 620,
141 CTRY_PUERTO_RICO = 630,
142 CTRY_QATAR = 634,
143 CTRY_ROMANIA = 642,
144 CTRY_RUSSIA = 643,
145 CTRY_SAUDI_ARABIA = 682,
146 CTRY_SERBIA_MONTENEGRO = 891,
147 CTRY_SINGAPORE = 702,
148 CTRY_SLOVAKIA = 703,
149 CTRY_SLOVENIA = 705,
150 CTRY_SOUTH_AFRICA = 710,
151 CTRY_SPAIN = 724,
152 CTRY_SRI_LANKA = 144,
153 CTRY_SWEDEN = 752,
154 CTRY_SWITZERLAND = 756,
155 CTRY_SYRIA = 760,
156 CTRY_TAIWAN = 158,
157 CTRY_THAILAND = 764,
158 CTRY_TRINIDAD_Y_TOBAGO = 780,
159 CTRY_TUNISIA = 788,
160 CTRY_TURKEY = 792,
161 CTRY_UAE = 784,
162 CTRY_UKRAINE = 804,
163 CTRY_UNITED_KINGDOM = 826,
164 CTRY_UNITED_STATES = 840,
165 CTRY_UNITED_STATES_FCC49 = 842,
166 CTRY_URUGUAY = 858,
167 CTRY_UZBEKISTAN = 860,
168 CTRY_VENEZUELA = 862,
169 CTRY_VIET_NAM = 704,
170 CTRY_YEMEN = 887,
171 CTRY_ZIMBABWE = 716,
172 CTRY_JAPAN1 = 393,
173 CTRY_JAPAN2 = 394,
174 CTRY_JAPAN3 = 395,
175 CTRY_JAPAN4 = 396,
176 CTRY_JAPAN5 = 397,
177 CTRY_JAPAN6 = 4006,
178 CTRY_JAPAN7 = 4007,
179 CTRY_JAPAN8 = 4008,
180 CTRY_JAPAN9 = 4009,
181 CTRY_JAPAN10 = 4010,
182 CTRY_JAPAN11 = 4011,
183 CTRY_JAPAN12 = 4012,
184 CTRY_JAPAN13 = 4013,
185 CTRY_JAPAN14 = 4014,
186 CTRY_JAPAN15 = 4015,
187 CTRY_JAPAN16 = 4016,
188 CTRY_JAPAN17 = 4017,
189 CTRY_JAPAN18 = 4018,
190 CTRY_JAPAN19 = 4019,
191 CTRY_JAPAN20 = 4020,
192 CTRY_JAPAN21 = 4021,
193 CTRY_JAPAN22 = 4022,
194 CTRY_JAPAN23 = 4023,
195 CTRY_JAPAN24 = 4024,
196 CTRY_JAPAN25 = 4025,
197 CTRY_JAPAN26 = 4026,
198 CTRY_JAPAN27 = 4027,
199 CTRY_JAPAN28 = 4028,
200 CTRY_JAPAN29 = 4029,
201 CTRY_JAPAN30 = 4030,
202 CTRY_JAPAN31 = 4031,
203 CTRY_JAPAN32 = 4032,
204 CTRY_JAPAN33 = 4033,
205 CTRY_JAPAN34 = 4034,
206 CTRY_JAPAN35 = 4035,
207 CTRY_JAPAN36 = 4036,
208 CTRY_JAPAN37 = 4037,
209 CTRY_JAPAN38 = 4038,
210 CTRY_JAPAN39 = 4039,
211 CTRY_JAPAN40 = 4040,
212 CTRY_JAPAN41 = 4041,
213 CTRY_JAPAN42 = 4042,
214 CTRY_JAPAN43 = 4043,
215 CTRY_JAPAN44 = 4044,
216 CTRY_JAPAN45 = 4045,
217 CTRY_JAPAN46 = 4046,
218 CTRY_JAPAN47 = 4047,
219 CTRY_JAPAN48 = 4048,
220 CTRY_JAPAN49 = 4049,
221 CTRY_JAPAN50 = 4050,
222 CTRY_JAPAN51 = 4051,
223 CTRY_JAPAN52 = 4052,
224 CTRY_JAPAN53 = 4053,
225 CTRY_JAPAN54 = 4054,
226 CTRY_JAPAN55 = 4055,
227 CTRY_JAPAN56 = 4056,
228 CTRY_JAPAN57 = 4057,
229 CTRY_JAPAN58 = 4058,
230 CTRY_JAPAN59 = 4059,
231 CTRY_AUSTRALIA2 = 5000,
232 CTRY_CANADA2 = 5001,
233 CTRY_BELGIUM2 = 5002
236 u16 ath9k_regd_get_rd(struct ath_hw *ah);
237 bool ath9k_is_world_regd(struct ath_hw *ah);
238 const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hw *ah);
239 const struct ieee80211_regdomain *ath9k_default_world_regdomain(void);
240 void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby);
241 void ath9k_reg_apply_radar_flags(struct wiphy *wiphy);
242 int ath9k_regd_init(struct ath_hw *ah);
243 bool ath9k_regd_is_eeprom_valid(struct ath_hw *ah);
244 u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan);
245 int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
246 void ath9k_regd_get_current_country(struct ath_hw *ah,
247 struct ath9k_country_entry *ctry);
249 #endif