Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 1 | /* |
Sujith | cee075a | 2009-03-13 09:07:23 +0530 | [diff] [blame] | 2 | * Copyright (c) 2008-2009 Atheros Communications Inc. |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 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 | |
Bob Copeland | c02cf37 | 2009-03-30 22:30:28 -0400 | [diff] [blame] | 20 | #include <linux/nl80211.h> |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 21 | #include <net/cfg80211.h> |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 22 | |
Luis R. Rodriguez | 608b88c | 2009-08-17 18:07:23 -0700 | [diff] [blame] | 23 | #include "ath.h" |
| 24 | |
Joerg Albert | 7f42c37 | 2009-09-05 16:07:43 +0200 | [diff] [blame] | 25 | enum ctl_group { |
| 26 | CTL_FCC = 0x10, |
| 27 | CTL_MKK = 0x40, |
| 28 | CTL_ETSI = 0x30, |
| 29 | }; |
| 30 | |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 31 | #define NO_CTL 0xff |
| 32 | #define SD_NO_CTL 0xE0 |
| 33 | #define NO_CTL 0xff |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 34 | #define CTL_11A 0 |
| 35 | #define CTL_11B 1 |
| 36 | #define CTL_11G 2 |
| 37 | #define CTL_2GHT20 5 |
| 38 | #define CTL_5GHT20 6 |
| 39 | #define CTL_2GHT40 7 |
| 40 | #define CTL_5GHT40 8 |
| 41 | |
| 42 | #define CTRY_DEBUG 0x1ff |
| 43 | #define CTRY_DEFAULT 0 |
| 44 | |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 45 | #define COUNTRY_ERD_FLAG 0x8000 |
| 46 | #define WORLDWIDE_ROAMING_FLAG 0x4000 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 47 | |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 48 | #define MULTI_DOMAIN_MASK 0xFF00 |
| 49 | |
| 50 | #define WORLD_SKU_MASK 0x00F0 |
| 51 | #define WORLD_SKU_PREFIX 0x0060 |
| 52 | |
| 53 | #define CHANNEL_HALF_BW 10 |
| 54 | #define CHANNEL_QUARTER_BW 5 |
| 55 | |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 56 | struct country_code_to_enum_rd { |
| 57 | u16 countryCode; |
| 58 | u16 regDmnEnum; |
| 59 | const char *isoName; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | enum CountryCode { |
| 63 | CTRY_ALBANIA = 8, |
| 64 | CTRY_ALGERIA = 12, |
| 65 | CTRY_ARGENTINA = 32, |
| 66 | CTRY_ARMENIA = 51, |
Vivek Natarajan | bd6b444 | 2009-10-27 11:32:52 +0530 | [diff] [blame] | 67 | CTRY_ARUBA = 533, |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 68 | CTRY_AUSTRALIA = 36, |
| 69 | CTRY_AUSTRIA = 40, |
| 70 | CTRY_AZERBAIJAN = 31, |
| 71 | CTRY_BAHRAIN = 48, |
Vivek Natarajan | bd6b444 | 2009-10-27 11:32:52 +0530 | [diff] [blame] | 72 | CTRY_BANGLADESH = 50, |
| 73 | CTRY_BARBADOS = 52, |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 74 | CTRY_BELARUS = 112, |
| 75 | CTRY_BELGIUM = 56, |
| 76 | CTRY_BELIZE = 84, |
| 77 | CTRY_BOLIVIA = 68, |
| 78 | CTRY_BOSNIA_HERZ = 70, |
| 79 | CTRY_BRAZIL = 76, |
| 80 | CTRY_BRUNEI_DARUSSALAM = 96, |
| 81 | CTRY_BULGARIA = 100, |
Vivek Natarajan | bd6b444 | 2009-10-27 11:32:52 +0530 | [diff] [blame] | 82 | CTRY_CAMBODIA = 116, |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 83 | CTRY_CANADA = 124, |
| 84 | CTRY_CHILE = 152, |
| 85 | CTRY_CHINA = 156, |
| 86 | CTRY_COLOMBIA = 170, |
| 87 | CTRY_COSTA_RICA = 188, |
| 88 | CTRY_CROATIA = 191, |
| 89 | CTRY_CYPRUS = 196, |
| 90 | CTRY_CZECH = 203, |
| 91 | CTRY_DENMARK = 208, |
| 92 | CTRY_DOMINICAN_REPUBLIC = 214, |
| 93 | CTRY_ECUADOR = 218, |
| 94 | CTRY_EGYPT = 818, |
| 95 | CTRY_EL_SALVADOR = 222, |
| 96 | CTRY_ESTONIA = 233, |
| 97 | CTRY_FAEROE_ISLANDS = 234, |
| 98 | CTRY_FINLAND = 246, |
| 99 | CTRY_FRANCE = 250, |
| 100 | CTRY_GEORGIA = 268, |
| 101 | CTRY_GERMANY = 276, |
| 102 | CTRY_GREECE = 300, |
Vivek Natarajan | bd6b444 | 2009-10-27 11:32:52 +0530 | [diff] [blame] | 103 | CTRY_GREENLAND = 304, |
Pavel Roskin | d601d9c | 2011-07-26 22:26:52 -0400 | [diff] [blame] | 104 | CTRY_GRENADA = 308, |
Vivek Natarajan | bd6b444 | 2009-10-27 11:32:52 +0530 | [diff] [blame] | 105 | CTRY_GUAM = 316, |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 106 | CTRY_GUATEMALA = 320, |
Vivek Natarajan | bd6b444 | 2009-10-27 11:32:52 +0530 | [diff] [blame] | 107 | CTRY_HAITI = 332, |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 108 | CTRY_HONDURAS = 340, |
| 109 | CTRY_HONG_KONG = 344, |
| 110 | CTRY_HUNGARY = 348, |
| 111 | CTRY_ICELAND = 352, |
| 112 | CTRY_INDIA = 356, |
| 113 | CTRY_INDONESIA = 360, |
| 114 | CTRY_IRAN = 364, |
| 115 | CTRY_IRAQ = 368, |
| 116 | CTRY_IRELAND = 372, |
| 117 | CTRY_ISRAEL = 376, |
| 118 | CTRY_ITALY = 380, |
| 119 | CTRY_JAMAICA = 388, |
| 120 | CTRY_JAPAN = 392, |
| 121 | CTRY_JORDAN = 400, |
| 122 | CTRY_KAZAKHSTAN = 398, |
| 123 | CTRY_KENYA = 404, |
| 124 | CTRY_KOREA_NORTH = 408, |
| 125 | CTRY_KOREA_ROC = 410, |
| 126 | CTRY_KOREA_ROC2 = 411, |
| 127 | CTRY_KOREA_ROC3 = 412, |
| 128 | CTRY_KUWAIT = 414, |
| 129 | CTRY_LATVIA = 428, |
| 130 | CTRY_LEBANON = 422, |
| 131 | CTRY_LIBYA = 434, |
| 132 | CTRY_LIECHTENSTEIN = 438, |
| 133 | CTRY_LITHUANIA = 440, |
| 134 | CTRY_LUXEMBOURG = 442, |
| 135 | CTRY_MACAU = 446, |
| 136 | CTRY_MACEDONIA = 807, |
| 137 | CTRY_MALAYSIA = 458, |
| 138 | CTRY_MALTA = 470, |
| 139 | CTRY_MEXICO = 484, |
| 140 | CTRY_MONACO = 492, |
| 141 | CTRY_MOROCCO = 504, |
| 142 | CTRY_NEPAL = 524, |
| 143 | CTRY_NETHERLANDS = 528, |
| 144 | CTRY_NETHERLANDS_ANTILLES = 530, |
| 145 | CTRY_NEW_ZEALAND = 554, |
| 146 | CTRY_NICARAGUA = 558, |
| 147 | CTRY_NORWAY = 578, |
| 148 | CTRY_OMAN = 512, |
| 149 | CTRY_PAKISTAN = 586, |
| 150 | CTRY_PANAMA = 591, |
| 151 | CTRY_PAPUA_NEW_GUINEA = 598, |
| 152 | CTRY_PARAGUAY = 600, |
| 153 | CTRY_PERU = 604, |
| 154 | CTRY_PHILIPPINES = 608, |
| 155 | CTRY_POLAND = 616, |
| 156 | CTRY_PORTUGAL = 620, |
| 157 | CTRY_PUERTO_RICO = 630, |
| 158 | CTRY_QATAR = 634, |
| 159 | CTRY_ROMANIA = 642, |
| 160 | CTRY_RUSSIA = 643, |
| 161 | CTRY_SAUDI_ARABIA = 682, |
| 162 | CTRY_SERBIA_MONTENEGRO = 891, |
| 163 | CTRY_SINGAPORE = 702, |
| 164 | CTRY_SLOVAKIA = 703, |
| 165 | CTRY_SLOVENIA = 705, |
| 166 | CTRY_SOUTH_AFRICA = 710, |
| 167 | CTRY_SPAIN = 724, |
| 168 | CTRY_SRI_LANKA = 144, |
| 169 | CTRY_SWEDEN = 752, |
| 170 | CTRY_SWITZERLAND = 756, |
| 171 | CTRY_SYRIA = 760, |
| 172 | CTRY_TAIWAN = 158, |
| 173 | CTRY_THAILAND = 764, |
| 174 | CTRY_TRINIDAD_Y_TOBAGO = 780, |
| 175 | CTRY_TUNISIA = 788, |
| 176 | CTRY_TURKEY = 792, |
| 177 | CTRY_UAE = 784, |
| 178 | CTRY_UKRAINE = 804, |
| 179 | CTRY_UNITED_KINGDOM = 826, |
| 180 | CTRY_UNITED_STATES = 840, |
| 181 | CTRY_UNITED_STATES_FCC49 = 842, |
| 182 | CTRY_URUGUAY = 858, |
| 183 | CTRY_UZBEKISTAN = 860, |
| 184 | CTRY_VENEZUELA = 862, |
| 185 | CTRY_VIET_NAM = 704, |
| 186 | CTRY_YEMEN = 887, |
| 187 | CTRY_ZIMBABWE = 716, |
| 188 | CTRY_JAPAN1 = 393, |
| 189 | CTRY_JAPAN2 = 394, |
| 190 | CTRY_JAPAN3 = 395, |
| 191 | CTRY_JAPAN4 = 396, |
| 192 | CTRY_JAPAN5 = 397, |
| 193 | CTRY_JAPAN6 = 4006, |
| 194 | CTRY_JAPAN7 = 4007, |
| 195 | CTRY_JAPAN8 = 4008, |
| 196 | CTRY_JAPAN9 = 4009, |
| 197 | CTRY_JAPAN10 = 4010, |
| 198 | CTRY_JAPAN11 = 4011, |
| 199 | CTRY_JAPAN12 = 4012, |
| 200 | CTRY_JAPAN13 = 4013, |
| 201 | CTRY_JAPAN14 = 4014, |
| 202 | CTRY_JAPAN15 = 4015, |
| 203 | CTRY_JAPAN16 = 4016, |
| 204 | CTRY_JAPAN17 = 4017, |
| 205 | CTRY_JAPAN18 = 4018, |
| 206 | CTRY_JAPAN19 = 4019, |
| 207 | CTRY_JAPAN20 = 4020, |
| 208 | CTRY_JAPAN21 = 4021, |
| 209 | CTRY_JAPAN22 = 4022, |
| 210 | CTRY_JAPAN23 = 4023, |
| 211 | CTRY_JAPAN24 = 4024, |
| 212 | CTRY_JAPAN25 = 4025, |
| 213 | CTRY_JAPAN26 = 4026, |
| 214 | CTRY_JAPAN27 = 4027, |
| 215 | CTRY_JAPAN28 = 4028, |
| 216 | CTRY_JAPAN29 = 4029, |
| 217 | CTRY_JAPAN30 = 4030, |
| 218 | CTRY_JAPAN31 = 4031, |
| 219 | CTRY_JAPAN32 = 4032, |
| 220 | CTRY_JAPAN33 = 4033, |
| 221 | CTRY_JAPAN34 = 4034, |
| 222 | CTRY_JAPAN35 = 4035, |
| 223 | CTRY_JAPAN36 = 4036, |
| 224 | CTRY_JAPAN37 = 4037, |
| 225 | CTRY_JAPAN38 = 4038, |
| 226 | CTRY_JAPAN39 = 4039, |
| 227 | CTRY_JAPAN40 = 4040, |
| 228 | CTRY_JAPAN41 = 4041, |
| 229 | CTRY_JAPAN42 = 4042, |
| 230 | CTRY_JAPAN43 = 4043, |
| 231 | CTRY_JAPAN44 = 4044, |
| 232 | CTRY_JAPAN45 = 4045, |
| 233 | CTRY_JAPAN46 = 4046, |
| 234 | CTRY_JAPAN47 = 4047, |
| 235 | CTRY_JAPAN48 = 4048, |
| 236 | CTRY_JAPAN49 = 4049, |
| 237 | CTRY_JAPAN50 = 4050, |
| 238 | CTRY_JAPAN51 = 4051, |
| 239 | CTRY_JAPAN52 = 4052, |
| 240 | CTRY_JAPAN53 = 4053, |
| 241 | CTRY_JAPAN54 = 4054, |
| 242 | CTRY_JAPAN55 = 4055, |
| 243 | CTRY_JAPAN56 = 4056, |
| 244 | CTRY_JAPAN57 = 4057, |
| 245 | CTRY_JAPAN58 = 4058, |
| 246 | CTRY_JAPAN59 = 4059, |
| 247 | CTRY_AUSTRALIA2 = 5000, |
| 248 | CTRY_CANADA2 = 5001, |
| 249 | CTRY_BELGIUM2 = 5002 |
| 250 | }; |
| 251 | |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 252 | bool ath_is_world_regd(struct ath_regulatory *reg); |
Bruno Randolf | 5719efd | 2011-01-25 13:15:33 +0900 | [diff] [blame] | 253 | bool ath_is_49ghz_allowed(u16 redomain); |
Bob Copeland | e3bb249 | 2009-03-30 22:30:30 -0400 | [diff] [blame] | 254 | int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, |
Luis R. Rodriguez | 0c0280b | 2013-01-11 18:39:36 +0000 | [diff] [blame] | 255 | void (*reg_notifier)(struct wiphy *wiphy, |
| 256 | struct regulatory_request *request)); |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 257 | u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, |
| 258 | enum ieee80211_band band); |
Luis R. Rodriguez | 0c0280b | 2013-01-11 18:39:36 +0000 | [diff] [blame] | 259 | void ath_reg_notifier_apply(struct wiphy *wiphy, |
| 260 | struct regulatory_request *request, |
| 261 | struct ath_regulatory *reg); |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 262 | |
| 263 | #endif |