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