regd.h 6.3 KB

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