1 /******************************************************************************
3 * Copyright(c) 2007 - 2018 Realtek Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 *****************************************************************************/
15 #define _RTW_CHPLAN_C_
17 #include <drv_types.h>
19 #define RTW_DOMAIN_MAP_VER "35e"
20 #define RTW_COUNTRY_MAP_VER "20"
22 #ifdef LEGACY_CHANNEL_PLAN_REF
23 /********************************************************
24 ChannelPlan definitions
25 *********************************************************/
26 static RT_CHANNEL_PLAN legacy_channel_plan[] = {
27 /* 0x00, RTW_CHPLAN_FCC */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165}, 32},
28 /* 0x01, RTW_CHPLAN_IC */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165}, 31},
29 /* 0x02, RTW_CHPLAN_ETSI */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}, 32},
30 /* 0x03, RTW_CHPLAN_SPAIN */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
31 /* 0x04, RTW_CHPLAN_FRANCE */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
32 /* 0x05, RTW_CHPLAN_MKK */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
33 /* 0x06, RTW_CHPLAN_MKK1 */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
34 /* 0x07, RTW_CHPLAN_ISRAEL */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},
35 /* 0x08, RTW_CHPLAN_TELEC */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22},
36 /* 0x09, RTW_CHPLAN_GLOBAL_DOAMIN */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14},
37 /* 0x0A, RTW_CHPLAN_WORLD_WIDE_13 */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
38 /* 0x0B, RTW_CHPLAN_TAIWAN */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165}, 26},
39 /* 0x0C, RTW_CHPLAN_CHINA */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 149, 153, 157, 161, 165}, 18},
40 /* 0x0D, RTW_CHPLAN_SINGAPORE_INDIA_MEXICO */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}, 24},
41 /* 0x0E, RTW_CHPLAN_KOREA */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, 165}, 31},
42 /* 0x0F, RTW_CHPLAN_TURKEY */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64}, 19},
43 /* 0x10, RTW_CHPLAN_JAPAN */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}, 32},
44 /* 0x11, RTW_CHPLAN_FCC_NO_DFS */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 149, 153, 157, 161, 165}, 20},
45 /* 0x12, RTW_CHPLAN_JAPAN_NO_DFS */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48}, 17},
46 /* 0x13, RTW_CHPLAN_WORLD_WIDE_5G */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165}, 37},
47 /* 0x14, RTW_CHPLAN_TAIWAN_NO_DFS */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 56, 60, 64, 149, 153, 157, 161, 165}, 19},
53 RTW_RD_2G_WORLD = 1, /* Worldwird 13 */
54 RTW_RD_2G_ETSI1 = 2, /* Europe */
55 RTW_RD_2G_FCC1 = 3, /* US */
56 RTW_RD_2G_MKK1 = 4, /* Japan */
57 RTW_RD_2G_ETSI2 = 5, /* France */
58 RTW_RD_2G_GLOBAL = 6, /* Global domain */
59 RTW_RD_2G_MKK2 = 7, /* Japan */
60 RTW_RD_2G_FCC2 = 8, /* US */
61 RTW_RD_2G_IC1 = 9, /* Canada */
62 RTW_RD_2G_WORLD1 = 10, /* Worldwide 11 */
63 RTW_RD_2G_KCC1 = 11, /* Korea */
69 RTW_RD_5G_NULL = 0, /* */
70 RTW_RD_5G_ETSI1 = 1, /* Europe */
71 RTW_RD_5G_ETSI2 = 2, /* Australia, New Zealand */
72 RTW_RD_5G_ETSI3 = 3, /* Russia */
73 RTW_RD_5G_FCC1 = 4, /* US */
74 RTW_RD_5G_FCC2 = 5, /* FCC w/o DFS Channels */
75 RTW_RD_5G_FCC3 = 6, /* Bolivia, Chile, El Salvador, Venezuela */
76 RTW_RD_5G_FCC4 = 7, /* Venezuela */
77 RTW_RD_5G_FCC5 = 8, /* China */
78 RTW_RD_5G_FCC6 = 9, /* */
79 RTW_RD_5G_FCC7 = 10, /* US(w/o Weather radar) */
80 RTW_RD_5G_IC1 = 11, /* Canada(w/o Weather radar) */
81 RTW_RD_5G_KCC1 = 12, /* Korea */
82 RTW_RD_5G_MKK1 = 13, /* Japan */
83 RTW_RD_5G_MKK2 = 14, /* Japan (W52, W53) */
84 RTW_RD_5G_MKK3 = 15, /* Japan (W56) */
85 RTW_RD_5G_NCC1 = 16, /* Taiwan, (w/o Weather radar) */
86 RTW_RD_5G_NCC2 = 17, /* Taiwan, Band2, Band4 */
87 RTW_RD_5G_NCC3 = 18, /* Taiwan w/o DFS, Band4 only */
88 RTW_RD_5G_ETSI4 = 19, /* Europe w/o DFS, Band1 only */
89 RTW_RD_5G_ETSI5 = 20, /* Australia, New Zealand(w/o Weather radar) */
90 RTW_RD_5G_FCC8 = 21, /* Latin America */
91 RTW_RD_5G_ETSI6 = 22, /* Israel, Bahrain, Egypt, India, China, Malaysia */
92 RTW_RD_5G_ETSI7 = 23, /* China */
93 RTW_RD_5G_ETSI8 = 24, /* Jordan */
94 RTW_RD_5G_ETSI9 = 25, /* Lebanon */
95 RTW_RD_5G_ETSI10 = 26, /* Qatar */
96 RTW_RD_5G_ETSI11 = 27, /* Russia */
97 RTW_RD_5G_NCC4 = 28, /* Taiwan, (w/o Weather radar) */
98 RTW_RD_5G_ETSI12 = 29, /* Indonesia */
99 RTW_RD_5G_FCC9 = 30, /* (w/o Weather radar) */
100 RTW_RD_5G_ETSI13 = 31, /* (w/o Weather radar) */
101 RTW_RD_5G_FCC10 = 32, /* Argentina(w/o Weather radar) */
102 RTW_RD_5G_MKK4 = 33, /* Japan (W52) */
103 RTW_RD_5G_ETSI14 = 34, /* Russia */
104 RTW_RD_5G_FCC11 = 35, /* US(include CH144) */
105 RTW_RD_5G_ETSI15 = 36, /* Malaysia */
106 RTW_RD_5G_MKK5 = 37, /* Japan */
107 RTW_RD_5G_ETSI16 = 38, /* Europe */
108 RTW_RD_5G_ETSI17 = 39, /* Europe */
109 RTW_RD_5G_FCC12 = 40, /* FCC */
110 RTW_RD_5G_FCC13 = 41, /* FCC */
111 RTW_RD_5G_FCC14 = 42, /* FCC w/o Weather radar(w/o 5600~5650MHz) */
112 RTW_RD_5G_FCC15 = 43, /* FCC w/o Band3 */
113 RTW_RD_5G_FCC16 = 44, /* FCC w/o Band3 */
114 RTW_RD_5G_ETSI18 = 45, /* ETSI w/o DFS Band2&3 */
115 RTW_RD_5G_ETSI19 = 46, /* Europe */
116 RTW_RD_5G_FCC17 = 47, /* FCC w/o Weather radar(w/o 5600~5650MHz) */
117 RTW_RD_5G_ETSI20 = 48, /* Europe */
118 RTW_RD_5G_IC2 = 49, /* Canada(w/o Weather radar), include ch144 */
119 RTW_RD_5G_ETSI21 = 50, /* Australia, New Zealand(w/o Weather radar) */
120 RTW_RD_5G_FCC18 = 51, /* */
121 RTW_RD_5G_WORLD = 52, /* Worldwide */
122 RTW_RD_5G_CHILE1 = 53, /* Chile */
123 RTW_RD_5G_ACMA1 = 54, /* Australia, New Zealand (w/o Weather radar) (w/o Ch120~Ch128) */
124 RTW_RD_5G_WORLD1 = 55, /* 5G Worldwide Band1&2 */
125 RTW_RD_5G_CHILE2 = 56, /* Chile (Band2,Band3) */
126 RTW_RD_5G_KCC2 = 57, /* Korea (New standard) */
128 /* === Below are driver defined for legacy channel plan compatible, DON'T assign index ==== */
140 #define CH_LIST_ENT(_len, arg...) \
141 {.len_ch = (u8[_len + 1]) {_len, ##arg}, }
143 #define CH_LIST_LEN(_ch_list) (_ch_list.len_ch[0])
144 #define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch[_i + 1])
146 struct chplan_ent_t {
148 #ifdef CONFIG_IEEE80211_BAND_5GHZ
151 u8 regd; /* value of REGULATION_TXPWR_LMT */
154 #ifdef CONFIG_IEEE80211_BAND_5GHZ
155 #define CHPLAN_ENT(i2g, i5g, regd) {i2g, i5g, regd}
157 #define CHPLAN_ENT(i2g, i5g, regd) {i2g, regd}
160 static struct ch_list_t RTW_ChannelPlan2G[] = {
161 /* 0, RTW_RD_2G_NULL */ CH_LIST_ENT(0),
162 /* 1, RTW_RD_2G_WORLD */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
163 /* 2, RTW_RD_2G_ETSI1 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
164 /* 3, RTW_RD_2G_FCC1 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),
165 /* 4, RTW_RD_2G_MKK1 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14),
166 /* 5, RTW_RD_2G_ETSI2 */ CH_LIST_ENT(4, 10, 11, 12, 13),
167 /* 6, RTW_RD_2G_GLOBAL */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14),
168 /* 7, RTW_RD_2G_MKK2 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
169 /* 8, RTW_RD_2G_FCC2 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
170 /* 9, RTW_RD_2G_IC1 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
171 /* 10, RTW_RD_2G_WORLD1 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),
172 /* 11, RTW_RD_2G_KCC1 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
175 #ifdef CONFIG_IEEE80211_BAND_5GHZ
176 static struct ch_list_t RTW_ChannelPlan5G[] = {
177 /* 0, RTW_RD_5G_NULL */ CH_LIST_ENT(0),
178 /* 1, RTW_RD_5G_ETSI1 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140),
179 /* 2, RTW_RD_5G_ETSI2 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
180 /* 3, RTW_RD_5G_ETSI3 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165),
181 /* 4, RTW_RD_5G_FCC1 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
182 /* 5, RTW_RD_5G_FCC2 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165),
183 /* 6, RTW_RD_5G_FCC3 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165),
184 /* 7, RTW_RD_5G_FCC4 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161),
185 /* 8, RTW_RD_5G_FCC5 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165),
186 /* 9, RTW_RD_5G_FCC6 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64),
187 /* 10, RTW_RD_5G_FCC7 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
188 /* 11, RTW_RD_5G_IC1 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
189 /* 12, RTW_RD_5G_KCC1 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161),
190 /* 13, RTW_RD_5G_MKK1 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140),
191 /* 14, RTW_RD_5G_MKK2 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64),
192 /* 15, RTW_RD_5G_MKK3 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140),
193 /* 16, RTW_RD_5G_NCC1 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
194 /* 17, RTW_RD_5G_NCC2 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165),
195 /* 18, RTW_RD_5G_NCC3 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165),
196 /* 19, RTW_RD_5G_ETSI4 */ CH_LIST_ENT(4, 36, 40, 44, 48),
197 /* 20, RTW_RD_5G_ETSI5 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
198 /* 21, RTW_RD_5G_FCC8 */ CH_LIST_ENT(4, 149, 153, 157, 161),
199 /* 22, RTW_RD_5G_ETSI6 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64),
200 /* 23, RTW_RD_5G_ETSI7 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165),
201 /* 24, RTW_RD_5G_ETSI8 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165),
202 /* 25, RTW_RD_5G_ETSI9 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140),
203 /* 26, RTW_RD_5G_ETSI10 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165),
204 /* 27, RTW_RD_5G_ETSI11 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165),
205 /* 28, RTW_RD_5G_NCC4 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
206 /* 29, RTW_RD_5G_ETSI12 */ CH_LIST_ENT(4, 149, 153, 157, 161),
207 /* 30, RTW_RD_5G_FCC9 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
208 /* 31, RTW_RD_5G_ETSI13 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140),
209 /* 32, RTW_RD_5G_FCC10 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161),
210 /* 33, RTW_RD_5G_MKK4 */ CH_LIST_ENT(4, 36, 40, 44, 48),
211 /* 34, RTW_RD_5G_ETSI14 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140),
212 /* 35, RTW_RD_5G_FCC11 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165),
213 /* 36, RTW_RD_5G_ETSI15 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165),
214 /* 37, RTW_RD_5G_MKK5 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
215 /* 38, RTW_RD_5G_ETSI16 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
216 /* 39, RTW_RD_5G_ETSI17 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
217 /* 40, RTW_RD_5G_FCC12*/ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
218 /* 41, RTW_RD_5G_FCC13 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
219 /* 42, RTW_RD_5G_FCC14 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
220 /* 43, RTW_RD_5G_FCC15 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165),
221 /* 44, RTW_RD_5G_FCC16 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165),
222 /* 45, RTW_RD_5G_ETSI18 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165),
223 /* 46, RTW_RD_5G_ETSI19 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
224 /* 47, RTW_RD_5G_FCC17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140),
225 /* 48, RTW_RD_5G_ETSI20 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165),
226 /* 49, RTW_RD_5G_IC2 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165),
227 /* 50, RTW_RD_5G_ETSI21 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
228 /* 51, RTW_RD_5G_FCC18 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140),
229 /* 52, RTW_RD_5G_WORLD */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165),
230 /* 53, RTW_RD_5G_CHILE1 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165),
231 /* 54, RTW_RD_5G_ACMA1 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165),
232 /* 55, RTW_RD_5G_WORLD1 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64),
233 /* 56, RTW_RD_5G_CHILE2 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144),
234 /* 57, RTW_RD_5G_KCC2 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165),
236 /* === Below are driver defined for legacy channel plan compatible, NO static index assigned ==== */
237 /* RTW_RD_5G_OLD_FCC1 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165),
238 /* RTW_RD_5G_OLD_NCC1 */ CH_LIST_ENT(15, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165),
239 /* RTW_RD_5G_OLD_KCC1 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, 165),
241 #endif /* CONFIG_IEEE80211_BAND_5GHZ */
243 static struct chplan_ent_t RTW_ChannelPlanMap[RTW_CHPLAN_MAX] = {
244 /* ===== 0x00 ~ 0x1F, legacy channel plan ===== */
245 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_KCC1, TXPWR_LMT_FCC), /* 0x00, RTW_CHPLAN_FCC */
246 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_OLD_FCC1, TXPWR_LMT_FCC), /* 0x01, RTW_CHPLAN_IC */
247 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI1, TXPWR_LMT_ETSI), /* 0x02, RTW_CHPLAN_ETSI */
248 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_NULL, TXPWR_LMT_ETSI), /* 0x03, RTW_CHPLAN_SPAIN */
249 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_NULL, TXPWR_LMT_ETSI), /* 0x04, RTW_CHPLAN_FRANCE */
250 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_NULL, TXPWR_LMT_MKK), /* 0x05, RTW_CHPLAN_MKK */
251 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_NULL, TXPWR_LMT_MKK), /* 0x06, RTW_CHPLAN_MKK1 */
252 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_FCC6, TXPWR_LMT_ETSI), /* 0x07, RTW_CHPLAN_ISRAEL */
253 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_FCC6, TXPWR_LMT_MKK), /* 0x08, RTW_CHPLAN_TELEC */
254 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x09, RTW_CHPLAN_GLOBAL_DOAMIN */
255 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x0A, RTW_CHPLAN_WORLD_WIDE_13 */
256 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_OLD_NCC1, TXPWR_LMT_FCC), /* 0x0B, RTW_CHPLAN_TAIWAN */
257 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_FCC5, TXPWR_LMT_ETSI), /* 0x0C, RTW_CHPLAN_CHINA */
258 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC3, TXPWR_LMT_WW), /* 0x0D, RTW_CHPLAN_SINGAPORE_INDIA_MEXICO */ /* ETSI:Singapore, India. FCC:Mexico => WW */
259 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_OLD_KCC1, TXPWR_LMT_ETSI), /* 0x0E, RTW_CHPLAN_KOREA */
260 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC6, TXPWR_LMT_ETSI), /* 0x0F, RTW_CHPLAN_TURKEY */
261 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI1, TXPWR_LMT_MKK), /* 0x10, RTW_CHPLAN_JAPAN */
262 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC2, TXPWR_LMT_FCC), /* 0x11, RTW_CHPLAN_FCC_NO_DFS */
263 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_FCC7, TXPWR_LMT_MKK), /* 0x12, RTW_CHPLAN_JAPAN_NO_DFS */
264 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC1, TXPWR_LMT_WW), /* 0x13, RTW_CHPLAN_WORLD_WIDE_5G */
265 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_NCC2, TXPWR_LMT_FCC), /* 0x14, RTW_CHPLAN_TAIWAN_NO_DFS */
266 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC7, TXPWR_LMT_ETSI), /* 0x15, RTW_CHPLAN_ETSI_NO_DFS */
267 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_NCC1, TXPWR_LMT_ETSI), /* 0x16, RTW_CHPLAN_KOREA_NO_DFS */
268 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_FCC7, TXPWR_LMT_MKK), /* 0x17, RTW_CHPLAN_JAPAN_NO_DFS */
269 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_FCC5, TXPWR_LMT_ETSI), /* 0x18, RTW_CHPLAN_PAKISTAN_NO_DFS */
270 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC5, TXPWR_LMT_FCC), /* 0x19, RTW_CHPLAN_TAIWAN2_NO_DFS */
271 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x1A, */
272 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x1B, */
273 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x1C, */
274 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x1D, */
275 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x1E, */
276 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_FCC1, TXPWR_LMT_WW), /* 0x1F, RTW_CHPLAN_WORLD_WIDE_ONLY_5G */
278 /* ===== 0x20 ~ 0x7F, new channel plan ===== */
279 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x20, RTW_CHPLAN_WORLD_NULL */
280 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_NULL, TXPWR_LMT_ETSI), /* 0x21, RTW_CHPLAN_ETSI1_NULL */
281 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_NULL, TXPWR_LMT_FCC), /* 0x22, RTW_CHPLAN_FCC1_NULL */
282 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_NULL, TXPWR_LMT_MKK), /* 0x23, RTW_CHPLAN_MKK1_NULL */
283 CHPLAN_ENT(RTW_RD_2G_ETSI2, RTW_RD_5G_NULL, TXPWR_LMT_ETSI), /* 0x24, RTW_CHPLAN_ETSI2_NULL */
284 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC1, TXPWR_LMT_FCC), /* 0x25, RTW_CHPLAN_FCC1_FCC1 */
285 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI1, TXPWR_LMT_ETSI), /* 0x26, RTW_CHPLAN_WORLD_ETSI1 */
286 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_MKK1, TXPWR_LMT_MKK), /* 0x27, RTW_CHPLAN_MKK1_MKK1 */
287 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_KCC1, TXPWR_LMT_KCC), /* 0x28, RTW_CHPLAN_WORLD_KCC1 */
288 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC2, TXPWR_LMT_FCC), /* 0x29, RTW_CHPLAN_WORLD_FCC2 */
289 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_NULL, TXPWR_LMT_FCC), /* 0x2A, RTW_CHPLAN_FCC2_NULL */
290 CHPLAN_ENT(RTW_RD_2G_IC1, RTW_RD_5G_IC2, TXPWR_LMT_IC), /* 0x2B, RTW_CHPLAN_IC1_IC2 */
291 CHPLAN_ENT(RTW_RD_2G_MKK2, RTW_RD_5G_NULL, TXPWR_LMT_MKK), /* 0x2C, RTW_CHPLAN_MKK2_NULL */
292 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_CHILE1, TXPWR_LMT_CHILE), /* 0x2D, RTW_CHPLAN_WORLD_CHILE1 */
293 CHPLAN_ENT(RTW_RD_2G_WORLD1, RTW_RD_5G_WORLD1, TXPWR_LMT_WW), /* 0x2E, RTW_CHPLAN_WORLD1_WORLD1 */
294 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_CHILE2, TXPWR_LMT_CHILE), /* 0x2F, RTW_CHPLAN_WORLD_CHILE2 */
295 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC3, TXPWR_LMT_FCC), /* 0x30, RTW_CHPLAN_WORLD_FCC3 */
296 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC4, TXPWR_LMT_FCC), /* 0x31, RTW_CHPLAN_WORLD_FCC4 */
297 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC5, TXPWR_LMT_FCC), /* 0x32, RTW_CHPLAN_WORLD_FCC5 */
298 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC6, TXPWR_LMT_FCC), /* 0x33, RTW_CHPLAN_WORLD_FCC6 */
299 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC7, TXPWR_LMT_FCC), /* 0x34, RTW_CHPLAN_FCC1_FCC7 */
300 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI2, TXPWR_LMT_ETSI), /* 0x35, RTW_CHPLAN_WORLD_ETSI2 */
301 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI3, TXPWR_LMT_ETSI), /* 0x36, RTW_CHPLAN_WORLD_ETSI3 */
302 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_MKK2, TXPWR_LMT_MKK), /* 0x37, RTW_CHPLAN_MKK1_MKK2 */
303 CHPLAN_ENT(RTW_RD_2G_MKK1, RTW_RD_5G_MKK3, TXPWR_LMT_MKK), /* 0x38, RTW_CHPLAN_MKK1_MKK3 */
304 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_NCC1, TXPWR_LMT_FCC), /* 0x39, RTW_CHPLAN_FCC1_NCC1 */
305 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI1, TXPWR_LMT_ETSI), /* 0x3A, RTW_CHPLAN_ETSI1_ETSI1 */
306 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ACMA1, TXPWR_LMT_ACMA), /* 0x3B, RTW_CHPLAN_ETSI1_ACMA1 */
307 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI6, TXPWR_LMT_ETSI), /* 0x3C, RTW_CHPLAN_ETSI1_ETSI6 */
308 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI12, TXPWR_LMT_ETSI), /* 0x3D, RTW_CHPLAN_ETSI1_ETSI12 */
309 CHPLAN_ENT(RTW_RD_2G_KCC1, RTW_RD_5G_KCC2, TXPWR_LMT_KCC), /* 0x3E, RTW_CHPLAN_KCC1_KCC2 */
310 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x3F, */
311 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_NCC2, TXPWR_LMT_FCC), /* 0x40, RTW_CHPLAN_FCC1_NCC2 */
312 CHPLAN_ENT(RTW_RD_2G_GLOBAL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x41, RTW_CHPLAN_GLOBAL_NULL */
313 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI4, TXPWR_LMT_ETSI), /* 0x42, RTW_CHPLAN_ETSI1_ETSI4 */
314 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC2, TXPWR_LMT_FCC), /* 0x43, RTW_CHPLAN_FCC1_FCC2 */
315 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_NCC3, TXPWR_LMT_FCC), /* 0x44, RTW_CHPLAN_FCC1_NCC3 */
316 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ACMA1, TXPWR_LMT_ACMA), /* 0x45, RTW_CHPLAN_WORLD_ACMA1 */
317 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC8, TXPWR_LMT_FCC), /* 0x46, RTW_CHPLAN_FCC1_FCC8 */
318 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI6, TXPWR_LMT_ETSI), /* 0x47, RTW_CHPLAN_WORLD_ETSI6 */
319 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI7, TXPWR_LMT_ETSI), /* 0x48, RTW_CHPLAN_WORLD_ETSI7 */
320 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI8, TXPWR_LMT_ETSI), /* 0x49, RTW_CHPLAN_WORLD_ETSI8 */
321 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x4A, */
322 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x4B, */
323 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x4C, */
324 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x4D, */
325 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x4E, */
326 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x4F, */
327 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI9, TXPWR_LMT_ETSI), /* 0x50, RTW_CHPLAN_WORLD_ETSI9 */
328 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI10, TXPWR_LMT_ETSI), /* 0x51, RTW_CHPLAN_WORLD_ETSI10 */
329 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI11, TXPWR_LMT_ETSI), /* 0x52, RTW_CHPLAN_WORLD_ETSI11 */
330 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_NCC4, TXPWR_LMT_FCC), /* 0x53, RTW_CHPLAN_FCC1_NCC4 */
331 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI12, TXPWR_LMT_ETSI), /* 0x54, RTW_CHPLAN_WORLD_ETSI12 */
332 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC9, TXPWR_LMT_FCC), /* 0x55, RTW_CHPLAN_FCC1_FCC9 */
333 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI13, TXPWR_LMT_ETSI), /* 0x56, RTW_CHPLAN_WORLD_ETSI13 */
334 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC10, TXPWR_LMT_FCC), /* 0x57, RTW_CHPLAN_FCC1_FCC10 */
335 CHPLAN_ENT(RTW_RD_2G_MKK2, RTW_RD_5G_MKK4, TXPWR_LMT_MKK), /* 0x58, RTW_CHPLAN_MKK2_MKK4 */
336 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI14, TXPWR_LMT_ETSI), /* 0x59, RTW_CHPLAN_WORLD_ETSI14 */
337 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x5A, */
338 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x5B, */
339 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x5C, */
340 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x5D, */
341 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x5E, */
342 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_NULL, TXPWR_LMT_WW), /* 0x5F, */
343 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC5, TXPWR_LMT_FCC), /* 0x60, RTW_CHPLAN_FCC1_FCC5 */
344 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC7, TXPWR_LMT_FCC), /* 0x61, RTW_CHPLAN_FCC2_FCC7 */
345 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC1, TXPWR_LMT_FCC), /* 0x62, RTW_CHPLAN_FCC2_FCC1 */
346 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI15, TXPWR_LMT_ETSI), /* 0x63, RTW_CHPLAN_WORLD_ETSI15 */
347 CHPLAN_ENT(RTW_RD_2G_MKK2, RTW_RD_5G_MKK5, TXPWR_LMT_MKK), /* 0x64, RTW_CHPLAN_MKK2_MKK5 */
348 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI16, TXPWR_LMT_ETSI), /* 0x65, RTW_CHPLAN_ETSI1_ETSI16 */
349 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC14, TXPWR_LMT_FCC), /* 0x66, RTW_CHPLAN_FCC1_FCC14 */
350 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC12, TXPWR_LMT_FCC), /* 0x67, RTW_CHPLAN_FCC1_FCC12 */
351 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC14, TXPWR_LMT_FCC), /* 0x68, RTW_CHPLAN_FCC2_FCC14 */
352 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC12, TXPWR_LMT_FCC), /* 0x69, RTW_CHPLAN_FCC2_FCC12 */
353 CHPLAN_ENT(RTW_RD_2G_ETSI1, RTW_RD_5G_ETSI17, TXPWR_LMT_ETSI), /* 0x6A, RTW_CHPLAN_ETSI1_ETSI17 */
354 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC16, TXPWR_LMT_FCC), /* 0x6B, RTW_CHPLAN_WORLD_FCC16 */
355 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC13, TXPWR_LMT_FCC), /* 0x6C, RTW_CHPLAN_WORLD_FCC13 */
356 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC15, TXPWR_LMT_FCC), /* 0x6D, RTW_CHPLAN_FCC2_FCC15 */
357 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC12, TXPWR_LMT_FCC), /* 0x6E, RTW_CHPLAN_WORLD_FCC12 */
358 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_ETSI8, TXPWR_LMT_ETSI), /* 0x6F, RTW_CHPLAN_NULL_ETSI8 */
359 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_ETSI18, TXPWR_LMT_ETSI), /* 0x70, RTW_CHPLAN_NULL_ETSI18 */
360 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_ETSI17, TXPWR_LMT_ETSI), /* 0x71, RTW_CHPLAN_NULL_ETSI17 */
361 CHPLAN_ENT(RTW_RD_2G_NULL, RTW_RD_5G_ETSI19, TXPWR_LMT_ETSI), /* 0x72, RTW_CHPLAN_NULL_ETSI19 */
362 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC7, TXPWR_LMT_FCC), /* 0x73, RTW_CHPLAN_WORLD_FCC7 */
363 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC17, TXPWR_LMT_FCC), /* 0x74, RTW_CHPLAN_FCC2_FCC17 */
364 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI20, TXPWR_LMT_ETSI), /* 0x75, RTW_CHPLAN_WORLD_ETSI20 */
365 CHPLAN_ENT(RTW_RD_2G_FCC2, RTW_RD_5G_FCC11, TXPWR_LMT_FCC), /* 0x76, RTW_CHPLAN_FCC2_FCC11 */
366 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_ETSI21, TXPWR_LMT_ETSI), /* 0x77, RTW_CHPLAN_WORLD_ETSI21 */
367 CHPLAN_ENT(RTW_RD_2G_FCC1, RTW_RD_5G_FCC18, TXPWR_LMT_FCC), /* 0x78, RTW_CHPLAN_FCC1_FCC18 */
368 CHPLAN_ENT(RTW_RD_2G_MKK2, RTW_RD_5G_MKK1, TXPWR_LMT_MKK), /* 0x79, RTW_CHPLAN_MKK2_MKK1 */
371 static struct chplan_ent_t RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE =
372 CHPLAN_ENT(RTW_RD_2G_WORLD, RTW_RD_5G_FCC1, TXPWR_LMT_FCC); /* 0x7F, Realtek Define */
374 u8 rtw_chplan_get_default_regd(u8 id)
378 if (id == RTW_CHPLAN_REALTEK_DEFINE)
379 regd = RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.regd;
381 regd = RTW_ChannelPlanMap[id].regd;
386 bool rtw_chplan_is_empty(u8 id)
388 struct chplan_ent_t *chplan_map;
390 if (id == RTW_CHPLAN_REALTEK_DEFINE)
391 chplan_map = &RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE;
393 chplan_map = &RTW_ChannelPlanMap[id];
395 if (chplan_map->rd_2g == RTW_RD_2G_NULL
396 #ifdef CONFIG_IEEE80211_BAND_5GHZ
397 && chplan_map->rd_5g == RTW_RD_5G_NULL
405 bool rtw_regsty_is_excl_chs(struct registry_priv *regsty, u8 ch)
409 for (i = 0; i < MAX_CHANNEL_NUM; i++) {
410 if (regsty->excl_chs[i] == 0)
412 if (regsty->excl_chs[i] == ch)
418 inline static u8 rtw_rd_5g_band1_passive(u8 rtw_rd_5g)
423 case RTW_RD_5G_FCC13:
424 case RTW_RD_5G_FCC16:
425 case RTW_RD_5G_ETSI18:
426 case RTW_RD_5G_ETSI19:
427 case RTW_RD_5G_WORLD:
428 case RTW_RD_5G_WORLD1:
435 inline static u8 rtw_rd_5g_band4_passive(u8 rtw_rd_5g)
441 case RTW_RD_5G_ETSI16:
442 case RTW_RD_5G_ETSI18:
443 case RTW_RD_5G_ETSI19:
444 case RTW_RD_5G_WORLD:
451 u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, RT_CHANNEL_INFO *channel_set)
453 struct registry_priv *regsty = adapter_to_regsty(padapter);
454 u8 index, chanset_size = 0;
455 u8 b5GBand = _FALSE, b2_4GBand = _FALSE;
456 u8 rd_2g = 0, rd_5g = 0;
457 #ifdef CONFIG_DFS_MASTER
461 if (!rtw_is_channel_plan_valid(ChannelPlan)) {
462 RTW_ERR("ChannelPlan ID 0x%02X error !!!!!\n", ChannelPlan);
466 _rtw_memset(channel_set, 0, sizeof(RT_CHANNEL_INFO) * MAX_CHANNEL_NUM);
468 if (IsSupported24G(regsty->wireless_mode) && hal_chk_band_cap(padapter, BAND_CAP_2G))
471 if (is_supported_5g(regsty->wireless_mode) && hal_chk_band_cap(padapter, BAND_CAP_5G))
474 if (b2_4GBand == _FALSE && b5GBand == _FALSE) {
475 RTW_WARN("HW band_cap has no intersection with SW wireless_mode setting\n");
480 if (ChannelPlan == RTW_CHPLAN_REALTEK_DEFINE)
481 rd_2g = RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.rd_2g;
483 rd_2g = RTW_ChannelPlanMap[ChannelPlan].rd_2g;
485 for (index = 0; index < CH_LIST_LEN(RTW_ChannelPlan2G[rd_2g]); index++) {
486 if (rtw_regsty_is_excl_chs(regsty, CH_LIST_CH(RTW_ChannelPlan2G[rd_2g], index)) == _TRUE)
489 if (chanset_size >= MAX_CHANNEL_NUM) {
490 RTW_WARN("chset size can't exceed MAX_CHANNEL_NUM(%u)\n", MAX_CHANNEL_NUM);
494 channel_set[chanset_size].ChannelNum = CH_LIST_CH(RTW_ChannelPlan2G[rd_2g], index);
496 if (ChannelPlan == RTW_CHPLAN_GLOBAL_DOAMIN
497 || rd_2g == RTW_RD_2G_GLOBAL
499 /* Channel 1~11 is active, and 12~14 is passive */
500 if (channel_set[chanset_size].ChannelNum >= 1 && channel_set[chanset_size].ChannelNum <= 11)
501 channel_set[chanset_size].ScanType = SCAN_ACTIVE;
502 else if ((channel_set[chanset_size].ChannelNum >= 12 && channel_set[chanset_size].ChannelNum <= 14))
503 channel_set[chanset_size].ScanType = SCAN_PASSIVE;
504 } else if (ChannelPlan == RTW_CHPLAN_WORLD_WIDE_13
505 || ChannelPlan == RTW_CHPLAN_WORLD_WIDE_5G
506 || rd_2g == RTW_RD_2G_WORLD
508 /* channel 12~13, passive scan */
509 if (channel_set[chanset_size].ChannelNum <= 11)
510 channel_set[chanset_size].ScanType = SCAN_ACTIVE;
512 channel_set[chanset_size].ScanType = SCAN_PASSIVE;
514 channel_set[chanset_size].ScanType = SCAN_ACTIVE;
520 #ifdef CONFIG_IEEE80211_BAND_5GHZ
522 if (ChannelPlan == RTW_CHPLAN_REALTEK_DEFINE)
523 rd_5g = RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.rd_5g;
525 rd_5g = RTW_ChannelPlanMap[ChannelPlan].rd_5g;
527 for (index = 0; index < CH_LIST_LEN(RTW_ChannelPlan5G[rd_5g]); index++) {
528 if (rtw_regsty_is_excl_chs(regsty, CH_LIST_CH(RTW_ChannelPlan5G[rd_5g], index)) == _TRUE)
531 if (rtw_is_dfs_ch(CH_LIST_CH(RTW_ChannelPlan5G[rd_5g], index)))
535 if (chanset_size >= MAX_CHANNEL_NUM) {
536 RTW_WARN("chset size can't exceed MAX_CHANNEL_NUM(%u)\n", MAX_CHANNEL_NUM);
540 channel_set[chanset_size].ChannelNum = CH_LIST_CH(RTW_ChannelPlan5G[rd_5g], index);
542 if ((ChannelPlan == RTW_CHPLAN_WORLD_WIDE_5G) /* all channels passive */
543 || (rtw_is_5g_band1(channel_set[chanset_size].ChannelNum)
544 && rtw_rd_5g_band1_passive(rd_5g)) /* band1 passive */
545 || (rtw_is_5g_band4(channel_set[chanset_size].ChannelNum)
546 && rtw_rd_5g_band4_passive(rd_5g)) /* band4 passive */
547 || (rtw_is_dfs_ch(channel_set[chanset_size].ChannelNum)) /* DFS channel(band2, 3) passive */
549 channel_set[chanset_size].ScanType = SCAN_PASSIVE;
551 channel_set[chanset_size].ScanType = SCAN_ACTIVE;
557 #ifdef CONFIG_DFS_MASTER
558 for (i = 0; i < chanset_size; i++)
559 channel_set[i].non_ocp_end_time = rtw_get_current_time();
561 #endif /* CONFIG_IEEE80211_BAND_5GHZ */
564 RTW_INFO(FUNC_ADPT_FMT" ChannelPlan ID:0x%02x, ch num:%d\n"
565 , FUNC_ADPT_ARG(padapter), ChannelPlan, chanset_size);
567 RTW_WARN(FUNC_ADPT_FMT" ChannelPlan ID:0x%02x, final chset has no channel\n"
568 , FUNC_ADPT_ARG(padapter), ChannelPlan);
573 #ifdef CONFIG_80211AC_VHT
574 #define COUNTRY_CHPLAN_ASSIGN_EN_11AC(_val) , .en_11ac = (_val)
576 #define COUNTRY_CHPLAN_ASSIGN_EN_11AC(_val)
579 #if RTW_DEF_MODULE_REGULATORY_CERT
580 #define COUNTRY_CHPLAN_ASSIGN_DEF_MODULE_FLAGS(_val) , .def_module_flags = (_val)
582 #define COUNTRY_CHPLAN_ASSIGN_DEF_MODULE_FLAGS(_val)
585 /* has def_module_flags specified, used by common map and HAL dfference map */
586 #define COUNTRY_CHPLAN_ENT(_alpha2, _chplan, _en_11ac, _def_module_flags) \
587 {.alpha2 = (_alpha2), .chplan = (_chplan) \
588 COUNTRY_CHPLAN_ASSIGN_EN_11AC(_en_11ac) \
589 COUNTRY_CHPLAN_ASSIGN_DEF_MODULE_FLAGS(_def_module_flags) \
592 #ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP
594 #include "../platform/custom_country_chplan.h"
596 #elif RTW_DEF_MODULE_REGULATORY_CERT
598 /* leave def_module_flags empty, def_module_flags check is done on country_chplan_map */
599 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821AE_HMC_M2) /* 2013 certify */
600 static const struct country_chplan RTL8821AE_HMC_M2_country_chplan_exc_map[] = {
601 COUNTRY_CHPLAN_ENT("CA", 0x34, 1, 0), /* Canada */
602 COUNTRY_CHPLAN_ENT("CL", 0x30, 1, 0), /* Chile */
603 COUNTRY_CHPLAN_ENT("CN", 0x51, 1, 0), /* China */
604 COUNTRY_CHPLAN_ENT("CO", 0x34, 1, 0), /* Colombia */
605 COUNTRY_CHPLAN_ENT("CR", 0x34, 1, 0), /* Costa Rica */
606 COUNTRY_CHPLAN_ENT("DO", 0x34, 1, 0), /* Dominican Republic */
607 COUNTRY_CHPLAN_ENT("EC", 0x34, 1, 0), /* Ecuador */
608 COUNTRY_CHPLAN_ENT("GT", 0x34, 1, 0), /* Guatemala */
609 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
610 COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
611 COUNTRY_CHPLAN_ENT("MY", 0x47, 1, 0), /* Malaysia */
612 COUNTRY_CHPLAN_ENT("NI", 0x34, 1, 0), /* Nicaragua */
613 COUNTRY_CHPLAN_ENT("PA", 0x34, 1, 0), /* Panama */
614 COUNTRY_CHPLAN_ENT("PE", 0x34, 1, 0), /* Peru */
615 COUNTRY_CHPLAN_ENT("PR", 0x34, 1, 0), /* Puerto Rico */
616 COUNTRY_CHPLAN_ENT("PY", 0x34, 1, 0), /* Paraguay */
617 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
618 COUNTRY_CHPLAN_ENT("UA", 0x36, 0, 0), /* Ukraine */
619 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
623 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821AU) /* 2014 certify */
624 static const struct country_chplan RTL8821AU_country_chplan_exc_map[] = {
625 COUNTRY_CHPLAN_ENT("CA", 0x34, 1, 0), /* Canada */
626 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
627 COUNTRY_CHPLAN_ENT("RU", 0x59, 0, 0), /* Russia(fac/gost), Kaliningrad */
628 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
629 COUNTRY_CHPLAN_ENT("UA", 0x36, 0, 0), /* Ukraine */
630 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
634 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8812AENF_NGFF) /* 2014 certify */
635 static const struct country_chplan RTL8812AENF_NGFF_country_chplan_exc_map[] = {
636 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
637 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
641 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8812AEBT_HMC) /* 2013 certify */
642 static const struct country_chplan RTL8812AEBT_HMC_country_chplan_exc_map[] = {
643 COUNTRY_CHPLAN_ENT("CA", 0x34, 1, 0), /* Canada */
644 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
645 COUNTRY_CHPLAN_ENT("RU", 0x59, 0, 0), /* Russia(fac/gost), Kaliningrad */
646 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
647 COUNTRY_CHPLAN_ENT("UA", 0x36, 0, 0), /* Ukraine */
648 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
652 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8188EE_HMC_M2) /* 2012 certify */
653 static const struct country_chplan RTL8188EE_HMC_M2_country_chplan_exc_map[] = {
654 COUNTRY_CHPLAN_ENT("AW", 0x34, 1, 0), /* Aruba */
655 COUNTRY_CHPLAN_ENT("BB", 0x34, 1, 0), /* Barbados */
656 COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
657 COUNTRY_CHPLAN_ENT("CO", 0x34, 1, 0), /* Colombia */
658 COUNTRY_CHPLAN_ENT("CR", 0x34, 1, 0), /* Costa Rica */
659 COUNTRY_CHPLAN_ENT("DO", 0x34, 1, 0), /* Dominican Republic */
660 COUNTRY_CHPLAN_ENT("EC", 0x34, 1, 0), /* Ecuador */
661 COUNTRY_CHPLAN_ENT("GT", 0x34, 1, 0), /* Guatemala */
662 COUNTRY_CHPLAN_ENT("HT", 0x34, 1, 0), /* Haiti */
663 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
664 COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
665 COUNTRY_CHPLAN_ENT("NI", 0x34, 1, 0), /* Nicaragua */
666 COUNTRY_CHPLAN_ENT("PA", 0x34, 1, 0), /* Panama */
667 COUNTRY_CHPLAN_ENT("PE", 0x34, 1, 0), /* Peru */
668 COUNTRY_CHPLAN_ENT("PR", 0x34, 1, 0), /* Puerto Rico */
669 COUNTRY_CHPLAN_ENT("PY", 0x34, 1, 0), /* Paraguay */
670 COUNTRY_CHPLAN_ENT("SC", 0x34, 1, 0), /* Seychelles */
671 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
672 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
673 COUNTRY_CHPLAN_ENT("VC", 0x34, 1, 0), /* Saint Vincent and the Grenadines */
677 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723BE_HMC_M2) /* 2013 certify */
678 static const struct country_chplan RTL8723BE_HMC_M2_country_chplan_exc_map[] = {
679 COUNTRY_CHPLAN_ENT("AW", 0x34, 1, 0), /* Aruba */
680 COUNTRY_CHPLAN_ENT("BS", 0x34, 1, 0), /* Bahamas */
681 COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
682 COUNTRY_CHPLAN_ENT("CO", 0x34, 1, 0), /* Colombia */
683 COUNTRY_CHPLAN_ENT("CR", 0x34, 1, 0), /* Costa Rica */
684 COUNTRY_CHPLAN_ENT("DO", 0x34, 1, 0), /* Dominican Republic */
685 COUNTRY_CHPLAN_ENT("EC", 0x34, 1, 0), /* Ecuador */
686 COUNTRY_CHPLAN_ENT("GT", 0x34, 1, 0), /* Guatemala */
687 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
688 COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
689 COUNTRY_CHPLAN_ENT("NI", 0x34, 1, 0), /* Nicaragua */
690 COUNTRY_CHPLAN_ENT("PA", 0x34, 1, 0), /* Panama */
691 COUNTRY_CHPLAN_ENT("PE", 0x34, 1, 0), /* Peru */
692 COUNTRY_CHPLAN_ENT("PR", 0x34, 1, 0), /* Puerto Rico */
693 COUNTRY_CHPLAN_ENT("PY", 0x34, 1, 0), /* Paraguay */
694 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
695 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
699 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723BS_NGFF1216) /* 2014 certify */
700 static const struct country_chplan RTL8723BS_NGFF1216_country_chplan_exc_map[] = {
701 COUNTRY_CHPLAN_ENT("BB", 0x34, 1, 0), /* Barbados */
702 COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
703 COUNTRY_CHPLAN_ENT("CO", 0x34, 1, 0), /* Colombia */
704 COUNTRY_CHPLAN_ENT("CR", 0x34, 1, 0), /* Costa Rica */
705 COUNTRY_CHPLAN_ENT("DO", 0x34, 1, 0), /* Dominican Republic */
706 COUNTRY_CHPLAN_ENT("EC", 0x34, 1, 0), /* Ecuador */
707 COUNTRY_CHPLAN_ENT("GT", 0x34, 1, 0), /* Guatemala */
708 COUNTRY_CHPLAN_ENT("HT", 0x34, 1, 0), /* Haiti */
709 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
710 COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
711 COUNTRY_CHPLAN_ENT("NI", 0x34, 1, 0), /* Nicaragua */
712 COUNTRY_CHPLAN_ENT("PA", 0x34, 1, 0), /* Panama */
713 COUNTRY_CHPLAN_ENT("PE", 0x34, 1, 0), /* Peru */
714 COUNTRY_CHPLAN_ENT("PR", 0x34, 1, 0), /* Puerto Rico */
715 COUNTRY_CHPLAN_ENT("PY", 0x34, 1, 0), /* Paraguay */
716 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
717 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
721 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8192EEBT_HMC_M2) /* 2013 certify */
722 static const struct country_chplan RTL8192EEBT_HMC_M2_country_chplan_exc_map[] = {
723 COUNTRY_CHPLAN_ENT("AW", 0x34, 1, 0), /* Aruba */
724 COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
725 COUNTRY_CHPLAN_ENT("CO", 0x34, 1, 0), /* Colombia */
726 COUNTRY_CHPLAN_ENT("CR", 0x34, 1, 0), /* Costa Rica */
727 COUNTRY_CHPLAN_ENT("DO", 0x34, 1, 0), /* Dominican Republic */
728 COUNTRY_CHPLAN_ENT("EC", 0x34, 1, 0), /* Ecuador */
729 COUNTRY_CHPLAN_ENT("GT", 0x34, 1, 0), /* Guatemala */
730 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
731 COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
732 COUNTRY_CHPLAN_ENT("NI", 0x34, 1, 0), /* Nicaragua */
733 COUNTRY_CHPLAN_ENT("PA", 0x34, 1, 0), /* Panama */
734 COUNTRY_CHPLAN_ENT("PE", 0x34, 1, 0), /* Peru */
735 COUNTRY_CHPLAN_ENT("PR", 0x34, 1, 0), /* Puerto Rico */
736 COUNTRY_CHPLAN_ENT("PY", 0x34, 1, 0), /* Paraguay */
737 COUNTRY_CHPLAN_ENT("SC", 0x34, 1, 0), /* Seychelles */
738 COUNTRY_CHPLAN_ENT("ST", 0x34, 1, 0), /* Sao Tome and Principe */
739 COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
740 COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
744 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723DE_NGFF1630) /* 2016 certify */
745 static const struct country_chplan RTL8723DE_NGFF1630_country_chplan_exc_map[] = {
746 COUNTRY_CHPLAN_ENT("CA", 0x2A, 1, 0), /* Canada */
747 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
748 COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
752 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8822BE) /* 2016 certify */
753 static const struct country_chplan RTL8822BE_country_chplan_exc_map[] = {
754 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
758 #if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821CE) /* 2016 certify */
759 static const struct country_chplan RTL8821CE_country_chplan_exc_map[] = {
760 COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0), /* South Korea */
765 * rtw_def_module_get_chplan_from_country -
766 * @country_code: string of country code
768 * Return NULL for case referring to common map
770 static const struct country_chplan *rtw_def_module_get_chplan_from_country(const char *country_code)
772 const struct country_chplan *ent = NULL;
773 const struct country_chplan *hal_map = NULL;
777 /* TODO: runtime selection for multi driver */
778 #if (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821AE_HMC_M2)
779 hal_map = RTL8821AE_HMC_M2_country_chplan_exc_map;
780 hal_map_sz = sizeof(RTL8821AE_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
781 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821AU)
782 hal_map = RTL8821AU_country_chplan_exc_map;
783 hal_map_sz = sizeof(RTL8821AU_country_chplan_exc_map) / sizeof(struct country_chplan);
784 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8812AENF_NGFF)
785 hal_map = RTL8812AENF_NGFF_country_chplan_exc_map;
786 hal_map_sz = sizeof(RTL8812AENF_NGFF_country_chplan_exc_map) / sizeof(struct country_chplan);
787 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8812AEBT_HMC)
788 hal_map = RTL8812AEBT_HMC_country_chplan_exc_map;
789 hal_map_sz = sizeof(RTL8812AEBT_HMC_country_chplan_exc_map) / sizeof(struct country_chplan);
790 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8188EE_HMC_M2)
791 hal_map = RTL8188EE_HMC_M2_country_chplan_exc_map;
792 hal_map_sz = sizeof(RTL8188EE_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
793 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723BE_HMC_M2)
794 hal_map = RTL8723BE_HMC_M2_country_chplan_exc_map;
795 hal_map_sz = sizeof(RTL8723BE_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
796 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723BS_NGFF1216)
797 hal_map = RTL8723BS_NGFF1216_country_chplan_exc_map;
798 hal_map_sz = sizeof(RTL8723BS_NGFF1216_country_chplan_exc_map) / sizeof(struct country_chplan);
799 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8192EEBT_HMC_M2)
800 hal_map = RTL8192EEBT_HMC_M2_country_chplan_exc_map;
801 hal_map_sz = sizeof(RTL8192EEBT_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
802 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723DE_NGFF1630)
803 hal_map = RTL8723DE_NGFF1630_country_chplan_exc_map;
804 hal_map_sz = sizeof(RTL8723DE_NGFF1630_country_chplan_exc_map) / sizeof(struct country_chplan);
805 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8822BE)
806 hal_map = RTL8822BE_country_chplan_exc_map;
807 hal_map_sz = sizeof(RTL8822BE_country_chplan_exc_map) / sizeof(struct country_chplan);
808 #elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821CE)
809 hal_map = RTL8821CE_country_chplan_exc_map;
810 hal_map_sz = sizeof(RTL8821CE_country_chplan_exc_map) / sizeof(struct country_chplan);
813 if (hal_map == NULL || hal_map_sz == 0)
816 for (i = 0; i < hal_map_sz; i++) {
817 if (strncmp(country_code, hal_map[i].alpha2, 2) == 0) {
826 #endif /* CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP or RTW_DEF_MODULE_REGULATORY_CERT */
828 static const struct country_chplan country_chplan_map[] = {
829 COUNTRY_CHPLAN_ENT("AD", 0x26, 1, 0x000), /* Andorra */
830 COUNTRY_CHPLAN_ENT("AE", 0x26, 1, 0x7FB), /* United Arab Emirates */
831 COUNTRY_CHPLAN_ENT("AF", 0x42, 1, 0x000), /* Afghanistan */
832 COUNTRY_CHPLAN_ENT("AG", 0x26, 1, 0x000), /* Antigua & Barbuda */
833 COUNTRY_CHPLAN_ENT("AI", 0x26, 1, 0x000), /* Anguilla(UK) */
834 COUNTRY_CHPLAN_ENT("AL", 0x26, 1, 0x7F1), /* Albania */
835 COUNTRY_CHPLAN_ENT("AM", 0x26, 1, 0x6B0), /* Armenia */
836 COUNTRY_CHPLAN_ENT("AN", 0x26, 1, 0x7F1), /* Netherlands Antilles */
837 COUNTRY_CHPLAN_ENT("AO", 0x47, 1, 0x6E0), /* Angola */
838 COUNTRY_CHPLAN_ENT("AQ", 0x26, 1, 0x000), /* Antarctica */
839 COUNTRY_CHPLAN_ENT("AR", 0x61, 1, 0x7F3), /* Argentina */
840 COUNTRY_CHPLAN_ENT("AS", 0x76, 1, 0x000), /* American Samoa */
841 COUNTRY_CHPLAN_ENT("AT", 0x26, 1, 0x7FB), /* Austria */
842 COUNTRY_CHPLAN_ENT("AU", 0x45, 1, 0x7FB), /* Australia */
843 COUNTRY_CHPLAN_ENT("AW", 0x76, 1, 0x0B0), /* Aruba */
844 COUNTRY_CHPLAN_ENT("AZ", 0x26, 1, 0x7F1), /* Azerbaijan */
845 COUNTRY_CHPLAN_ENT("BA", 0x26, 1, 0x7F1), /* Bosnia & Herzegovina */
846 COUNTRY_CHPLAN_ENT("BB", 0x76, 1, 0x650), /* Barbados */
847 COUNTRY_CHPLAN_ENT("BD", 0x26, 1, 0x7F1), /* Bangladesh */
848 COUNTRY_CHPLAN_ENT("BE", 0x26, 1, 0x7FB), /* Belgium */
849 COUNTRY_CHPLAN_ENT("BF", 0x26, 1, 0x6B0), /* Burkina Faso */
850 COUNTRY_CHPLAN_ENT("BG", 0x26, 1, 0x7F1), /* Bulgaria */
851 COUNTRY_CHPLAN_ENT("BH", 0x47, 1, 0x7F1), /* Bahrain */
852 COUNTRY_CHPLAN_ENT("BI", 0x26, 1, 0x6B0), /* Burundi */
853 COUNTRY_CHPLAN_ENT("BJ", 0x26, 1, 0x6B0), /* Benin */
854 COUNTRY_CHPLAN_ENT("BN", 0x47, 1, 0x610), /* Brunei */
855 COUNTRY_CHPLAN_ENT("BO", 0x73, 1, 0x7F1), /* Bolivia */
856 COUNTRY_CHPLAN_ENT("BR", 0x62, 1, 0x7F1), /* Brazil */
857 COUNTRY_CHPLAN_ENT("BS", 0x76, 1, 0x620), /* Bahamas */
858 COUNTRY_CHPLAN_ENT("BW", 0x26, 1, 0x6F1), /* Botswana */
859 COUNTRY_CHPLAN_ENT("BY", 0x26, 1, 0x7F1), /* Belarus */
860 COUNTRY_CHPLAN_ENT("BZ", 0x76, 1, 0x000), /* Belize */
861 COUNTRY_CHPLAN_ENT("CA", 0x2B, 1, 0x7FB), /* Canada */
862 COUNTRY_CHPLAN_ENT("CC", 0x26, 1, 0x000), /* Cocos (Keeling) Islands (Australia) */
863 COUNTRY_CHPLAN_ENT("CD", 0x26, 1, 0x6B0), /* Congo, Republic of the */
864 COUNTRY_CHPLAN_ENT("CF", 0x26, 1, 0x6B0), /* Central African Republic */
865 COUNTRY_CHPLAN_ENT("CG", 0x26, 1, 0x6B0), /* Congo, Democratic Republic of the. Zaire */
866 COUNTRY_CHPLAN_ENT("CH", 0x26, 1, 0x7FB), /* Switzerland */
867 COUNTRY_CHPLAN_ENT("CI", 0x26, 1, 0x7F1), /* Cote d'Ivoire */
868 COUNTRY_CHPLAN_ENT("CK", 0x26, 1, 0x000), /* Cook Islands */
869 COUNTRY_CHPLAN_ENT("CL", 0x2D, 1, 0x7F1), /* Chile */
870 COUNTRY_CHPLAN_ENT("CM", 0x26, 1, 0x6B0), /* Cameroon */
871 COUNTRY_CHPLAN_ENT("CN", 0x48, 1, 0x7FB), /* China */
872 COUNTRY_CHPLAN_ENT("CO", 0x76, 1, 0x7F1), /* Colombia */
873 COUNTRY_CHPLAN_ENT("CR", 0x76, 1, 0x7F1), /* Costa Rica */
874 COUNTRY_CHPLAN_ENT("CV", 0x26, 1, 0x6B0), /* Cape Verde */
875 COUNTRY_CHPLAN_ENT("CX", 0x45, 1, 0x000), /* Christmas Island (Australia) */
876 COUNTRY_CHPLAN_ENT("CY", 0x26, 1, 0x7FB), /* Cyprus */
877 COUNTRY_CHPLAN_ENT("CZ", 0x26, 1, 0x7FB), /* Czech Republic */
878 COUNTRY_CHPLAN_ENT("DE", 0x26, 1, 0x7FB), /* Germany */
879 COUNTRY_CHPLAN_ENT("DJ", 0x26, 1, 0x680), /* Djibouti */
880 COUNTRY_CHPLAN_ENT("DK", 0x26, 1, 0x7FB), /* Denmark */
881 COUNTRY_CHPLAN_ENT("DM", 0x76, 1, 0x000), /* Dominica */
882 COUNTRY_CHPLAN_ENT("DO", 0x76, 1, 0x7F1), /* Dominican Republic */
883 COUNTRY_CHPLAN_ENT("DZ", 0x26, 1, 0x7F1), /* Algeria */
884 COUNTRY_CHPLAN_ENT("EC", 0x76, 1, 0x7F1), /* Ecuador */
885 COUNTRY_CHPLAN_ENT("EE", 0x26, 1, 0x7FB), /* Estonia */
886 COUNTRY_CHPLAN_ENT("EG", 0x47, 1, 0x7F1), /* Egypt */
887 COUNTRY_CHPLAN_ENT("EH", 0x47, 1, 0x680), /* Western Sahara */
888 COUNTRY_CHPLAN_ENT("ER", 0x26, 1, 0x000), /* Eritrea */
889 COUNTRY_CHPLAN_ENT("ES", 0x26, 1, 0x7FB), /* Spain, Canary Islands, Ceuta, Melilla */
890 COUNTRY_CHPLAN_ENT("ET", 0x26, 1, 0x4B0), /* Ethiopia */
891 COUNTRY_CHPLAN_ENT("FI", 0x26, 1, 0x7FB), /* Finland */
892 COUNTRY_CHPLAN_ENT("FJ", 0x76, 1, 0x600), /* Fiji */
893 COUNTRY_CHPLAN_ENT("FK", 0x26, 1, 0x000), /* Falkland Islands (Islas Malvinas) (UK) */
894 COUNTRY_CHPLAN_ENT("FM", 0x76, 1, 0x000), /* Micronesia, Federated States of (USA) */
895 COUNTRY_CHPLAN_ENT("FO", 0x26, 1, 0x000), /* Faroe Islands (Denmark) */
896 COUNTRY_CHPLAN_ENT("FR", 0x26, 1, 0x7FB), /* France */
897 COUNTRY_CHPLAN_ENT("GA", 0x26, 1, 0x6B0), /* Gabon */
898 COUNTRY_CHPLAN_ENT("GB", 0x26, 1, 0x7FB), /* Great Britain (United Kingdom; England) */
899 COUNTRY_CHPLAN_ENT("GD", 0x34, 1, 0x0B0), /* Grenada */
900 COUNTRY_CHPLAN_ENT("GE", 0x26, 1, 0x600), /* Georgia */
901 COUNTRY_CHPLAN_ENT("GF", 0x26, 1, 0x080), /* French Guiana */
902 COUNTRY_CHPLAN_ENT("GG", 0x26, 1, 0x000), /* Guernsey (UK) */
903 COUNTRY_CHPLAN_ENT("GH", 0x26, 1, 0x7F1), /* Ghana */
904 COUNTRY_CHPLAN_ENT("GI", 0x26, 1, 0x600), /* Gibraltar (UK) */
905 COUNTRY_CHPLAN_ENT("GL", 0x26, 1, 0x600), /* Greenland (Denmark) */
906 COUNTRY_CHPLAN_ENT("GM", 0x26, 1, 0x6B0), /* Gambia */
907 COUNTRY_CHPLAN_ENT("GN", 0x26, 1, 0x610), /* Guinea */
908 COUNTRY_CHPLAN_ENT("GP", 0x26, 1, 0x600), /* Guadeloupe (France) */
909 COUNTRY_CHPLAN_ENT("GQ", 0x26, 1, 0x6B0), /* Equatorial Guinea */
910 COUNTRY_CHPLAN_ENT("GR", 0x26, 1, 0x7FB), /* Greece */
911 COUNTRY_CHPLAN_ENT("GS", 0x26, 1, 0x000), /* South Georgia and the Sandwich Islands (UK) */
912 COUNTRY_CHPLAN_ENT("GT", 0x61, 1, 0x7F1), /* Guatemala */
913 COUNTRY_CHPLAN_ENT("GU", 0x76, 1, 0x600), /* Guam (USA) */
914 COUNTRY_CHPLAN_ENT("GW", 0x26, 1, 0x6B0), /* Guinea-Bissau */
915 COUNTRY_CHPLAN_ENT("GY", 0x44, 1, 0x000), /* Guyana */
916 COUNTRY_CHPLAN_ENT("HK", 0x26, 1, 0x7FB), /* Hong Kong */
917 COUNTRY_CHPLAN_ENT("HM", 0x45, 1, 0x000), /* Heard and McDonald Islands (Australia) */
918 COUNTRY_CHPLAN_ENT("HN", 0x32, 1, 0x7F1), /* Honduras */
919 COUNTRY_CHPLAN_ENT("HR", 0x26, 1, 0x7F9), /* Croatia */
920 COUNTRY_CHPLAN_ENT("HT", 0x76, 1, 0x650), /* Haiti */
921 COUNTRY_CHPLAN_ENT("HU", 0x26, 1, 0x7FB), /* Hungary */
922 COUNTRY_CHPLAN_ENT("ID", 0x3D, 0, 0x7F3), /* Indonesia */
923 COUNTRY_CHPLAN_ENT("IE", 0x26, 1, 0x7FB), /* Ireland */
924 COUNTRY_CHPLAN_ENT("IL", 0x47, 1, 0x7F1), /* Israel */
925 COUNTRY_CHPLAN_ENT("IM", 0x26, 1, 0x000), /* Isle of Man (UK) */
926 COUNTRY_CHPLAN_ENT("IN", 0x48, 1, 0x7F1), /* India */
927 COUNTRY_CHPLAN_ENT("IQ", 0x26, 1, 0x000), /* Iraq */
928 COUNTRY_CHPLAN_ENT("IR", 0x26, 0, 0x000), /* Iran */
929 COUNTRY_CHPLAN_ENT("IS", 0x26, 1, 0x7FB), /* Iceland */
930 COUNTRY_CHPLAN_ENT("IT", 0x26, 1, 0x7FB), /* Italy */
931 COUNTRY_CHPLAN_ENT("JE", 0x26, 1, 0x000), /* Jersey (UK) */
932 COUNTRY_CHPLAN_ENT("JM", 0x51, 1, 0x7F1), /* Jamaica */
933 COUNTRY_CHPLAN_ENT("JO", 0x49, 1, 0x7FB), /* Jordan */
934 COUNTRY_CHPLAN_ENT("JP", 0x27, 1, 0x7FF), /* Japan- Telec */
935 COUNTRY_CHPLAN_ENT("KE", 0x47, 1, 0x7F9), /* Kenya */
936 COUNTRY_CHPLAN_ENT("KG", 0x26, 1, 0x7F1), /* Kyrgyzstan */
937 COUNTRY_CHPLAN_ENT("KH", 0x26, 1, 0x7F1), /* Cambodia */
938 COUNTRY_CHPLAN_ENT("KI", 0x26, 1, 0x000), /* Kiribati */
939 COUNTRY_CHPLAN_ENT("KN", 0x76, 1, 0x000), /* Saint Kitts and Nevis */
940 COUNTRY_CHPLAN_ENT("KR", 0x3E, 1, 0x7FB), /* South Korea */
941 COUNTRY_CHPLAN_ENT("KW", 0x47, 1, 0x7FB), /* Kuwait */
942 COUNTRY_CHPLAN_ENT("KY", 0x76, 1, 0x000), /* Cayman Islands (UK) */
943 COUNTRY_CHPLAN_ENT("KZ", 0x26, 1, 0x700), /* Kazakhstan */
944 COUNTRY_CHPLAN_ENT("LA", 0x26, 1, 0x000), /* Laos */
945 COUNTRY_CHPLAN_ENT("LB", 0x26, 1, 0x7F1), /* Lebanon */
946 COUNTRY_CHPLAN_ENT("LC", 0x76, 1, 0x000), /* Saint Lucia */
947 COUNTRY_CHPLAN_ENT("LI", 0x26, 1, 0x7FB), /* Liechtenstein */
948 COUNTRY_CHPLAN_ENT("LK", 0x26, 1, 0x7F1), /* Sri Lanka */
949 COUNTRY_CHPLAN_ENT("LR", 0x26, 1, 0x6B0), /* Liberia */
950 COUNTRY_CHPLAN_ENT("LS", 0x26, 1, 0x7F1), /* Lesotho */
951 COUNTRY_CHPLAN_ENT("LT", 0x26, 1, 0x7FB), /* Lithuania */
952 COUNTRY_CHPLAN_ENT("LU", 0x26, 1, 0x7FB), /* Luxembourg */
953 COUNTRY_CHPLAN_ENT("LV", 0x26, 1, 0x7FB), /* Latvia */
954 COUNTRY_CHPLAN_ENT("LY", 0x26, 1, 0x000), /* Libya */
955 COUNTRY_CHPLAN_ENT("MA", 0x47, 1, 0x7F1), /* Morocco */
956 COUNTRY_CHPLAN_ENT("MC", 0x26, 1, 0x7FB), /* Monaco */
957 COUNTRY_CHPLAN_ENT("MD", 0x26, 1, 0x7F1), /* Moldova */
958 COUNTRY_CHPLAN_ENT("ME", 0x26, 1, 0x7F1), /* Montenegro */
959 COUNTRY_CHPLAN_ENT("MF", 0x76, 1, 0x000), /* Saint Martin */
960 COUNTRY_CHPLAN_ENT("MG", 0x26, 1, 0x620), /* Madagascar */
961 COUNTRY_CHPLAN_ENT("MH", 0x76, 1, 0x000), /* Marshall Islands (USA) */
962 COUNTRY_CHPLAN_ENT("MK", 0x26, 1, 0x7F1), /* Republic of Macedonia (FYROM) */
963 COUNTRY_CHPLAN_ENT("ML", 0x26, 1, 0x6B0), /* Mali */
964 COUNTRY_CHPLAN_ENT("MM", 0x26, 1, 0x000), /* Burma (Myanmar) */
965 COUNTRY_CHPLAN_ENT("MN", 0x26, 1, 0x000), /* Mongolia */
966 COUNTRY_CHPLAN_ENT("MO", 0x26, 1, 0x600), /* Macau */
967 COUNTRY_CHPLAN_ENT("MP", 0x76, 1, 0x000), /* Northern Mariana Islands (USA) */
968 COUNTRY_CHPLAN_ENT("MQ", 0x26, 1, 0x640), /* Martinique (France) */
969 COUNTRY_CHPLAN_ENT("MR", 0x26, 1, 0x6A0), /* Mauritania */
970 COUNTRY_CHPLAN_ENT("MS", 0x26, 1, 0x000), /* Montserrat (UK) */
971 COUNTRY_CHPLAN_ENT("MT", 0x26, 1, 0x7FB), /* Malta */
972 COUNTRY_CHPLAN_ENT("MU", 0x26, 1, 0x6B0), /* Mauritius */
973 COUNTRY_CHPLAN_ENT("MV", 0x47, 1, 0x000), /* Maldives */
974 COUNTRY_CHPLAN_ENT("MW", 0x26, 1, 0x6B0), /* Malawi */
975 COUNTRY_CHPLAN_ENT("MX", 0x61, 1, 0x7F1), /* Mexico */
976 COUNTRY_CHPLAN_ENT("MY", 0x63, 1, 0x7F1), /* Malaysia */
977 COUNTRY_CHPLAN_ENT("MZ", 0x26, 1, 0x7F1), /* Mozambique */
978 COUNTRY_CHPLAN_ENT("NA", 0x26, 1, 0x700), /* Namibia */
979 COUNTRY_CHPLAN_ENT("NC", 0x26, 1, 0x000), /* New Caledonia */
980 COUNTRY_CHPLAN_ENT("NE", 0x26, 1, 0x6B0), /* Niger */
981 COUNTRY_CHPLAN_ENT("NF", 0x45, 1, 0x000), /* Norfolk Island (Australia) */
982 COUNTRY_CHPLAN_ENT("NG", 0x75, 1, 0x7F9), /* Nigeria */
983 COUNTRY_CHPLAN_ENT("NI", 0x76, 1, 0x7F1), /* Nicaragua */
984 COUNTRY_CHPLAN_ENT("NL", 0x26, 1, 0x7FB), /* Netherlands */
985 COUNTRY_CHPLAN_ENT("NO", 0x26, 1, 0x7FB), /* Norway */
986 COUNTRY_CHPLAN_ENT("NP", 0x47, 1, 0x6F0), /* Nepal */
987 COUNTRY_CHPLAN_ENT("NR", 0x26, 1, 0x000), /* Nauru */
988 COUNTRY_CHPLAN_ENT("NU", 0x45, 1, 0x000), /* Niue */
989 COUNTRY_CHPLAN_ENT("NZ", 0x45, 1, 0x7FB), /* New Zealand */
990 COUNTRY_CHPLAN_ENT("OM", 0x26, 1, 0x7F9), /* Oman */
991 COUNTRY_CHPLAN_ENT("PA", 0x76, 1, 0x7F1), /* Panama */
992 COUNTRY_CHPLAN_ENT("PE", 0x76, 1, 0x7F1), /* Peru */
993 COUNTRY_CHPLAN_ENT("PF", 0x26, 1, 0x000), /* French Polynesia (France) */
994 COUNTRY_CHPLAN_ENT("PG", 0x26, 1, 0x7F1), /* Papua New Guinea */
995 COUNTRY_CHPLAN_ENT("PH", 0x26, 1, 0x7F1), /* Philippines */
996 COUNTRY_CHPLAN_ENT("PK", 0x51, 1, 0x7F1), /* Pakistan */
997 COUNTRY_CHPLAN_ENT("PL", 0x26, 1, 0x7FB), /* Poland */
998 COUNTRY_CHPLAN_ENT("PM", 0x26, 1, 0x000), /* Saint Pierre and Miquelon (France) */
999 COUNTRY_CHPLAN_ENT("PR", 0x76, 1, 0x7F1), /* Puerto Rico */
1000 COUNTRY_CHPLAN_ENT("PT", 0x26, 1, 0x7FB), /* Portugal */
1001 COUNTRY_CHPLAN_ENT("PW", 0x76, 1, 0x000), /* Palau */
1002 COUNTRY_CHPLAN_ENT("PY", 0x76, 1, 0x7F1), /* Paraguay */
1003 COUNTRY_CHPLAN_ENT("QA", 0x51, 1, 0x7F9), /* Qatar */
1004 COUNTRY_CHPLAN_ENT("RE", 0x26, 1, 0x000), /* Reunion (France) */
1005 COUNTRY_CHPLAN_ENT("RO", 0x26, 1, 0x7F1), /* Romania */
1006 COUNTRY_CHPLAN_ENT("RS", 0x26, 1, 0x7F1), /* Serbia, Kosovo */
1007 COUNTRY_CHPLAN_ENT("RU", 0x59, 1, 0x7FB), /* Russia(fac/gost), Kaliningrad */
1008 COUNTRY_CHPLAN_ENT("RW", 0x26, 1, 0x0B0), /* Rwanda */
1009 COUNTRY_CHPLAN_ENT("SA", 0x26, 1, 0x7FB), /* Saudi Arabia */
1010 COUNTRY_CHPLAN_ENT("SB", 0x26, 1, 0x000), /* Solomon Islands */
1011 COUNTRY_CHPLAN_ENT("SC", 0x76, 1, 0x690), /* Seychelles */
1012 COUNTRY_CHPLAN_ENT("SE", 0x26, 1, 0x7FB), /* Sweden */
1013 COUNTRY_CHPLAN_ENT("SG", 0x35, 1, 0x7FB), /* Singapore */
1014 COUNTRY_CHPLAN_ENT("SH", 0x26, 1, 0x000), /* Saint Helena (UK) */
1015 COUNTRY_CHPLAN_ENT("SI", 0x26, 1, 0x7FB), /* Slovenia */
1016 COUNTRY_CHPLAN_ENT("SJ", 0x26, 1, 0x000), /* Svalbard (Norway) */
1017 COUNTRY_CHPLAN_ENT("SK", 0x26, 1, 0x7FB), /* Slovakia */
1018 COUNTRY_CHPLAN_ENT("SL", 0x26, 1, 0x6B0), /* Sierra Leone */
1019 COUNTRY_CHPLAN_ENT("SM", 0x26, 1, 0x000), /* San Marino */
1020 COUNTRY_CHPLAN_ENT("SN", 0x26, 1, 0x7F1), /* Senegal */
1021 COUNTRY_CHPLAN_ENT("SO", 0x26, 1, 0x000), /* Somalia */
1022 COUNTRY_CHPLAN_ENT("SR", 0x74, 1, 0x000), /* Suriname */
1023 COUNTRY_CHPLAN_ENT("ST", 0x76, 1, 0x680), /* Sao Tome and Principe */
1024 COUNTRY_CHPLAN_ENT("SV", 0x30, 1, 0x7F1), /* El Salvador */
1025 COUNTRY_CHPLAN_ENT("SX", 0x76, 1, 0x000), /* Sint Marteen */
1026 COUNTRY_CHPLAN_ENT("SZ", 0x26, 1, 0x020), /* Swaziland */
1027 COUNTRY_CHPLAN_ENT("TC", 0x26, 1, 0x000), /* Turks and Caicos Islands (UK) */
1028 COUNTRY_CHPLAN_ENT("TD", 0x26, 1, 0x6B0), /* Chad */
1029 COUNTRY_CHPLAN_ENT("TF", 0x26, 1, 0x680), /* French Southern and Antarctic Lands (FR Southern Territories) */
1030 COUNTRY_CHPLAN_ENT("TG", 0x26, 1, 0x6B0), /* Togo */
1031 COUNTRY_CHPLAN_ENT("TH", 0x26, 1, 0x7F1), /* Thailand */
1032 COUNTRY_CHPLAN_ENT("TJ", 0x26, 1, 0x640), /* Tajikistan */
1033 COUNTRY_CHPLAN_ENT("TK", 0x45, 1, 0x000), /* Tokelau */
1034 COUNTRY_CHPLAN_ENT("TM", 0x26, 1, 0x000), /* Turkmenistan */
1035 COUNTRY_CHPLAN_ENT("TN", 0x47, 1, 0x7F1), /* Tunisia */
1036 COUNTRY_CHPLAN_ENT("TO", 0x26, 1, 0x000), /* Tonga */
1037 COUNTRY_CHPLAN_ENT("TR", 0x26, 1, 0x7F1), /* Turkey, Northern Cyprus */
1038 COUNTRY_CHPLAN_ENT("TT", 0x42, 1, 0x3F1), /* Trinidad & Tobago */
1039 COUNTRY_CHPLAN_ENT("TW", 0x76, 1, 0x7FF), /* Taiwan */
1040 COUNTRY_CHPLAN_ENT("TZ", 0x26, 1, 0x6F0), /* Tanzania */
1041 COUNTRY_CHPLAN_ENT("UA", 0x36, 1, 0x7FB), /* Ukraine */
1042 COUNTRY_CHPLAN_ENT("UG", 0x26, 1, 0x6F1), /* Uganda */
1043 COUNTRY_CHPLAN_ENT("US", 0x76, 1, 0x7FF), /* United States of America (USA) */
1044 COUNTRY_CHPLAN_ENT("UY", 0x30, 1, 0x7F1), /* Uruguay */
1045 COUNTRY_CHPLAN_ENT("UZ", 0x47, 1, 0x6F0), /* Uzbekistan */
1046 COUNTRY_CHPLAN_ENT("VA", 0x26, 1, 0x000), /* Holy See (Vatican City) */
1047 COUNTRY_CHPLAN_ENT("VC", 0x76, 1, 0x010), /* Saint Vincent and the Grenadines */
1048 COUNTRY_CHPLAN_ENT("VE", 0x30, 1, 0x7F1), /* Venezuela */
1049 COUNTRY_CHPLAN_ENT("VI", 0x76, 1, 0x000), /* United States Virgin Islands (USA) */
1050 COUNTRY_CHPLAN_ENT("VN", 0x26, 1, 0x7F1), /* Vietnam */
1051 COUNTRY_CHPLAN_ENT("VU", 0x26, 1, 0x000), /* Vanuatu */
1052 COUNTRY_CHPLAN_ENT("WF", 0x26, 1, 0x000), /* Wallis and Futuna (France) */
1053 COUNTRY_CHPLAN_ENT("WS", 0x76, 1, 0x000), /* Samoa */
1054 COUNTRY_CHPLAN_ENT("YE", 0x26, 1, 0x040), /* Yemen */
1055 COUNTRY_CHPLAN_ENT("YT", 0x26, 1, 0x680), /* Mayotte (France) */
1056 COUNTRY_CHPLAN_ENT("ZA", 0x26, 1, 0x7F1), /* South Africa */
1057 COUNTRY_CHPLAN_ENT("ZM", 0x26, 1, 0x6B0), /* Zambia */
1058 COUNTRY_CHPLAN_ENT("ZW", 0x26, 1, 0x7F1), /* Zimbabwe */
1062 * rtw_get_chplan_from_country -
1063 * @country_code: string of country code
1065 * Return pointer of struct country_chplan entry or NULL when unsupported country_code is given
1067 const struct country_chplan *rtw_get_chplan_from_country(const char *country_code)
1069 #if RTW_DEF_MODULE_REGULATORY_CERT
1070 const struct country_chplan *exc_ent = NULL;
1072 const struct country_chplan *ent = NULL;
1073 const struct country_chplan *map = NULL;
1078 code[0] = alpha_to_upper(country_code[0]);
1079 code[1] = alpha_to_upper(country_code[1]);
1081 #ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP
1082 map = CUSTOMIZED_country_chplan_map;
1083 map_sz = sizeof(CUSTOMIZED_country_chplan_map) / sizeof(struct country_chplan);
1085 #if RTW_DEF_MODULE_REGULATORY_CERT
1086 exc_ent = rtw_def_module_get_chplan_from_country(code);
1088 map = country_chplan_map;
1089 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan);
1092 for (i = 0; i < map_sz; i++) {
1093 if (strncmp(code, map[i].alpha2, 2) == 0) {
1099 #if RTW_DEF_MODULE_REGULATORY_CERT
1100 if (!ent || !(COUNTRY_CHPLAN_DEF_MODULE_FALGS(ent) & RTW_DEF_MODULE_REGULATORY_CERT))
1101 exc_ent = ent = NULL;
1109 void dump_country_chplan(void *sel, const struct country_chplan *ent)
1111 RTW_PRINT_SEL(sel, "\"%c%c\", 0x%02X%s\n"
1112 , ent->alpha2[0], ent->alpha2[1], ent->chplan
1113 , COUNTRY_CHPLAN_EN_11AC(ent) ? " ac" : ""
1117 void dump_country_chplan_map(void *sel)
1119 const struct country_chplan *ent;
1122 #if RTW_DEF_MODULE_REGULATORY_CERT
1123 RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT:0x%x\n", RTW_DEF_MODULE_REGULATORY_CERT);
1125 #ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP
1126 RTW_PRINT_SEL(sel, "CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP\n");
1129 for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) {
1130 for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) {
1131 ent = rtw_get_chplan_from_country(code);
1135 dump_country_chplan(sel, ent);
1140 void dump_chplan_id_list(void *sel)
1145 for (i = 0; i < RTW_CHPLAN_MAX; i++) {
1146 if (!rtw_is_channel_plan_valid(i))
1150 RTW_PRINT_SEL(sel, "0x%02X ", i);
1153 _RTW_PRINT_SEL(sel, "0x%02X ", i);
1156 _RTW_PRINT_SEL(sel, "0x7F\n");
1159 void dump_chplan_test(void *sel)
1163 /* check invalid channel */
1164 for (i = 0; i < RTW_RD_2G_MAX; i++) {
1165 for (j = 0; j < CH_LIST_LEN(RTW_ChannelPlan2G[i]); j++) {
1166 if (rtw_ch2freq(CH_LIST_CH(RTW_ChannelPlan2G[i], j)) == 0)
1167 RTW_PRINT_SEL(sel, "invalid ch:%u at (%d,%d)\n", CH_LIST_CH(RTW_ChannelPlan2G[i], j), i, j);
1171 #ifdef CONFIG_IEEE80211_BAND_5GHZ
1172 for (i = 0; i < RTW_RD_5G_MAX; i++) {
1173 for (j = 0; j < CH_LIST_LEN(RTW_ChannelPlan5G[i]); j++) {
1174 if (rtw_ch2freq(CH_LIST_CH(RTW_ChannelPlan5G[i], j)) == 0)
1175 RTW_PRINT_SEL(sel, "invalid ch:%u at (%d,%d)\n", CH_LIST_CH(RTW_ChannelPlan5G[i], j), i, j);
1181 void dump_chplan_ver(void *sel)
1183 RTW_PRINT_SEL(sel, "%s-%s\n", RTW_DOMAIN_MAP_VER, RTW_COUNTRY_MAP_VER);