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