-
Notifications
You must be signed in to change notification settings - Fork 10
/
dhd_ccode.c
276 lines (259 loc) · 6.35 KB
/
dhd_ccode.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#ifdef CCODE_LIST
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif /* COMFIG_COMPAT */
#include <typedefs.h>
#include <dhd_config.h>
#ifdef BCMSDIO
#define CCODE_43438
#define CCODE_43436
#define CCODE_43455C0
#endif
#if defined(BCMSDIO) || defined(BCMPCIE)
#define CCODE_4356A2
#define CCODE_4359C0
#endif
#if defined(BCMPCIE)
//#define CCODE_4375B4
#endif
#ifdef BCMDBUS
#define CCODE_4358U
#endif
#ifdef BCMSDIO
#ifdef CCODE_43438
const char ccode_43438[] = "RU/13";
#else
const char ccode_43438[] = "";
#endif
#ifdef CCODE_43436
const char ccode_43436[] = \
"AE/1 AR/1 AT/1 AU/2 "\
"BE/1 BG/1 BN/1 "\
"CA/2 CH/1 CN/38 CY/1 CZ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5 TN/1 TR/7 TT/3 TW/65 "\
"UA/16 US/140 UY/10 "\
"VE/3 VN/4 "\
"XZ/11 "\
"ZA/19";
#else
const char ccode_4375b4[] = "";
#endif
#ifdef CCODE_4358U
const char ccode_4358u[] = \
"BE/4 BR/4 "\
"CA/2 CH/4 CN/38 CY/4 "\
"DE/7 DK/4 "\
"ES/4 "\
"FI/4 FR/5 "\
"GB/6 GR/4 "\
"HK/2 HU/4 "\
"IE/5 IL/7 IS/4 IT/4 "\
"JP/72 "\
"KE/0 KR/4 "\
"MY/3 "\
"NL/4 "\
"PT/4 "\
"SA/5 SE/4 SG/0 SZ/0 "\
"TH/5 TR/7 TW/230 "\
"US/0 "\
"VN/4";
#else
const char ccode_4358u[] = "";
#endif
typedef struct ccode_list_map_t {
uint chip;
uint chiprev;
const char *ccode_list;
const char *ccode_ww;
} ccode_list_map_t;
extern const char ccode_43438[];
extern const char ccode_43455c0[];
extern const char ccode_4356a2[];
extern const char ccode_4359c0[];
extern const char ccode_4358u[];
const ccode_list_map_t ccode_list_map[] = {
/* ChipID Chiprev ccode */
#ifdef BCMSDIO
{BCM43430_CHIP_ID, 0, ccode_43438, ""},
{BCM43430_CHIP_ID, 1, ccode_43438, ""},
{BCM43430_CHIP_ID, 2, ccode_43436, ""},
{BCM4345_CHIP_ID, 6, ccode_43455c0, "XZ/11"},
{BCM43454_CHIP_ID, 6, ccode_43455c0, "XZ/11"},
{BCM4345_CHIP_ID, 9, ccode_43455c0, "XZ/11"},
{BCM43454_CHIP_ID, 9, ccode_43455c0, "XZ/11"},
{BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4371_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"},
#endif
#ifdef BCMPCIE
{BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"},
{BCM4375_CHIP_ID, 5, ccode_4375b4, ""},
#endif
#ifdef BCMDBUS
{BCM43569_CHIP_ID, 2, ccode_4358u, "XW/0"},
#endif
};
int
dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec)
{
int bcmerror = -1, i;
uint chip = dhd->conf->chip, chiprev = dhd->conf->chiprev;
const char *ccode_list = NULL, *ccode_ww = NULL;
char *pch;
for (i=0; i<sizeof(ccode_list_map)/sizeof(ccode_list_map[0]); i++) {
const ccode_list_map_t* row = &ccode_list_map[i];
if (row->chip == chip && row->chiprev == chiprev) {
ccode_list = row->ccode_list;
ccode_ww = row->ccode_ww;
break;
}
}
if (ccode_list) {
pch = strstr(ccode_list, cspec->ccode);
if (pch) {
cspec->rev = (int)simple_strtol(pch+strlen(cspec->ccode)+1, NULL, 0);
bcmerror = 0;
}
}
if (dhd->op_mode != DHD_FLAG_MFG_MODE) {
if (bcmerror && ccode_ww && strlen(ccode_ww)>=4) {
memcpy(cspec->ccode, ccode_ww, 2);
cspec->rev = (int)simple_strtol(ccode_ww+3, NULL, 0);
}
}
return bcmerror;
}
#endif