1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  *
6  * Permission to use, copy, modify, and/or distribute this software for
7  * any purpose with or without fee is hereby granted, provided that the
8  * above copyright notice and this permission notice appear in all
9  * copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18  * PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 /**
22  * DOC: reg_db.h
23  * This file contains regulatory component data structures
24  */
25 
26 #ifndef __REG_DB_H
27 #define __REG_DB_H
28 
29 /*
30  * If COMPILE_REGDB_6G and CONFIG_BAND_6GHZ are defined, then
31  * reg_6ghz_super_dmn_id and max_bw_6g are part of the
32  * country_code_to_reg_domain table for a country
33  * entry. If COMPILE_REGDB_6G and CONFIG_BAND_6GHZ are not defined, then they
34  * are absent.
35  *
36  * COMPILE_REGDB_6G is not defined for the Partial offload platform.
37  *
38  * CE:- country entry
39  */
40 #if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
41 #define CE(country_code, reg_dmn_pair_id, reg_6ghz_super_dmn_id,         \
42 	   alpha2, max_bw_2g, max_bw_5g, max_bw_6g, phymode_bitmap)      \
43 	{CTRY_ ## country_code, reg_dmn_pair_id, reg_6ghz_super_dmn_id,  \
44 	 #alpha2, max_bw_2g, max_bw_5g, max_bw_6g, phymode_bitmap}
45 #else
46 #define CE(country_code, reg_dmn_pair_id, reg_6ghz_super_dmn_id, alpha2, \
47 	   max_bw_2g, max_bw_5g, max_bw_6g, phymode_bitmap)              \
48 	{CTRY_ ## country_code, reg_dmn_pair_id, #alpha2, max_bw_2g,     \
49 	 max_bw_5g, phymode_bitmap}
50 #endif
51 
52 /* Alpha2 code for world reg domain */
53 #define REG_WORLD_ALPHA2 "00"
54 
55 enum reg_domain {
56 	NO_ENUMRD = 0x00,
57 	NULL1_WORLD = 0x03,
58 	NULL1_ETSIB = 0x07,
59 	NULL1_ETSIC = 0x08,
60 
61 	FCC1_FCCA = 0x10,
62 	FCC1_WORLD = 0x11,
63 	FCC2_FCCA = 0x20,
64 	FCC2_WORLD = 0x21,
65 	FCC2_ETSIC = 0x22,
66 	FCC3_FCCA = 0x3A,
67 	FCC3_WORLD = 0x3B,
68 	FCC3_ETSIC = 0x3F,
69 	FCC4_FCCA = 0x12,
70 	FCC5_FCCA = 0x13,
71 	FCC6_WORLD = 0x23,
72 	FCC6_FCCA = 0x14,
73 	FCC7_FCCA = 0x15,
74 	FCC8_FCCA = 0x16,
75 	FCC8_WORLD = 0x09,
76 	FCC9_FCCA = 0x17,
77 	FCC10_FCCA = 0x18,
78 	FCC11_WORLD = 0x19,
79 	FCC13_WORLD = 0xE4,
80 	FCC14_FCCB = 0xE6,
81 	FCC14_WORLD = 0xD1,
82 	FCC15_FCCA = 0xEA,
83 	FCC16_FCCA = 0xE8,
84 	FCC17_FCCA = 0xE9,
85 	FCC17_WORLD = 0xEB,
86 	FCC17_ETSIC = 0xEC,
87 	FCC18_ETSIC = 0xED,
88 	FCC20_FCCA = 0xEF,
89 	FCC21_ETSIC = 0xD2,
90 
91 	ETSI1_WORLD = 0x37,
92 	ETSI2_WORLD = 0x35,
93 	ETSI3_WORLD = 0x36,
94 	ETSI3_ETSIA = 0x32,
95 	ETSI4_WORLD = 0x30,
96 	ETSI4_ETSIC = 0x38,
97 	ETSI5_WORLD = 0x39,
98 	ETSI6_WORLD = 0x34,
99 	ETSI7_WORLD = 0x3C,
100 	ETSI8_WORLD = 0x3D,
101 	ETSI9_WORLD = 0x3E,
102 	ETSI10_WORLD = 0x24,
103 	ETSI10_FCCA = 0x25,
104 	ETSI11_WORLD = 0x26,
105 	ETSI12_WORLD = 0x28,
106 	ETSI13_WORLD = 0x27,
107 	ETSI14_WORLD = 0x29,
108 	ETSI15_WORLD = 0x31,
109 	ETSI15_ETSIC = 0x7A,
110 	ETSI16_WORLD = 0x4A,
111 	ETSI17_WORLD = 0x4B,
112 	ETSI18_WORLD = 0x6E,
113 	ETSI19_WORLD = 0x7B,
114 	ETSI20_WORLD = 0x7C,
115 	ETSI21_WORLD = 0x7D,
116 
117 	APL1_WORLD = 0x52,
118 	APL1_ETSIC = 0x55,
119 	APL2_WORLD = 0x45,
120 	APL2_ETSIC = 0x56,
121 	APL2_ETSID = 0x41,
122 	APL2_FCCA = 0x4D,
123 	APL4_WORLD = 0x42,
124 	APL6_WORLD = 0x5B,
125 	APL7_FCCA = 0x5C,
126 	APL8_WORLD = 0x5D,
127 	APL9_WORLD = 0x5E,
128 	APL9_MKKC  = 0x48,
129 	APL9_KRRA  = 0x43,
130 	APL10_WORLD = 0x5F,
131 	APL11_FCCA = 0x4F,
132 	APL12_WORLD = 0x51,
133 	APL13_WORLD = 0x5A,
134 	APL14_WORLD = 0x57,
135 	APL14_CHNA = 0x74,
136 	APL15_WORLD = 0x59,
137 	APL16_WORLD = 0x70,
138 	APL16_ETSIC = 0x6D,
139 	APL17_ETSIC = 0xE7,
140 	APL17_ETSID = 0xE0,
141 	APL19_ETSIC = 0x71,
142 	APL20_WORLD = 0xE5,
143 	APL23_WORLD = 0xE3,
144 	APL24_ETSIC = 0xE2,
145 	APL25_ETSIC = 0x75,
146 	APL26_ETSIC = 0x72,
147 	APL27_FCCA = 0x73,
148 	APL28_ETSIC = 0x76,
149 	APL29_ETSIC = 0x77,
150 
151 	WOR0_WORLD = 0x60,
152 	WOR1_WORLD = 0x61,
153 	WOR2_WORLD = 0x62,
154 	WOR3_WORLD = 0x63,
155 	WOR4_FCCA = 0x64,
156 	WOR5_ETSIC = 0x65,
157 	WOR01_WORLD = 0x66,
158 	WOR02_WORLD = 0x67,
159 	EU1_WORLD = 0x68,
160 	WOR9_WORLD = 0x69,
161 	WORA_WORLD = 0x6A,
162 	WORB_WORLD = 0x6B,
163 	WORC_WORLD = 0x6C,
164 
165 	MKK3_MKKB = 0x80,
166 	MKK3_MKKA2 = 0x81,
167 	MKK3_MKKC = 0x82,
168 	MKK4_MKKB = 0x83,
169 	MKK4_MKKA2 = 0x84,
170 	MKK4_MKKC = 0x85,
171 	MKK5_MKKA = 0x99,
172 	MKK5_FCCA = 0x9A,
173 	MKK5_MKKB = 0x86,
174 	MKK5_MKKA2 = 0x87,
175 	MKK5_MKKC = 0x88,
176 	MKK3_MKKA = 0xF0,
177 	MKK3_MKKA1 = 0xF1,
178 	MKK3_FCCA = 0xF2,
179 	MKK4_MKKA = 0xF3,
180 	MKK4_MKKA1 = 0xF4,
181 	MKK4_FCCA = 0xF5,
182 	MKK9_MKKA = 0xF6,
183 	MKK9_FCCA = 0xFC,
184 	MKK9_MKKA1 = 0xFD,
185 	MKK9_MKKC = 0xFE,
186 	MKK9_MKKA2 = 0xFF,
187 	MKK10_MKKA = 0xF7,
188 	MKK10_FCCA = 0xD0,
189 	MKK10_MKKA1 = 0xD1,
190 	MKK10_MKKC = 0xD2,
191 	MKK10_MKKA2 = 0xD3,
192 	MKK11_MKKA = 0xD4,
193 	MKK11_FCCA = 0xD5,
194 	MKK11_MKKA1 = 0xD6,
195 	MKK11_MKKC = 0xD7,
196 	MKK11_MKKA2 = 0xD8,
197 	MKK16_MKKC = 0xDF,
198 	MKK17_MKKC = 0xE1,
199 	MKK18_MKKC = 0xEE,
200 
201 	WORLD_60 = 0x60,
202 	WORLD_61 = 0x61,
203 	WORLD_62 = 0x62,
204 	WORLD_63 = 0x63,
205 	WORLD_65 = 0x65,
206 	WORLD_64 = 0x64,
207 	WORLD_66 = 0x66,
208 	WORLD_69 = 0x69,
209 	WORLD_67 = 0x67,
210 	WORLD_68 = 0x68,
211 	WORLD_6A = 0x6A,
212 	WORLD_6C = 0x6C,
213 };
214 
215 enum reg_domains_5g {
216 	NULL1,
217 
218 	FCC1,
219 	FCC2,
220 	FCC3,
221 	FCC4,
222 	FCC5,
223 	FCC6,
224 	FCC7,
225 	FCC8,
226 	FCC9,
227 	FCC10,
228 	FCC11,
229 	FCC13,
230 	FCC14,
231 	FCC15,
232 	FCC16,
233 	FCC17,
234 	FCC18,
235 	FCC20,
236 	FCC21,
237 
238 	ETSI1,
239 	ETSI2,
240 	ETSI3,
241 	ETSI4,
242 	ETSI5,
243 	ETSI6,
244 	ETSI8,
245 	ETSI9,
246 	ETSI10,
247 	ETSI11,
248 	ETSI12,
249 	ETSI13,
250 	ETSI14,
251 	ETSI15,
252 	ETSI16,
253 	ETSI17,
254 	ETSI18,
255 	ETSI19,
256 	ETSI20,
257 	ETSI21,
258 
259 	APL1,
260 	APL2,
261 	APL3,
262 	APL4,
263 	APL5,
264 	APL6,
265 	APL7,
266 	APL8,
267 	APL9,
268 	APL10,
269 	APL11,
270 	APL12,
271 	APL13,
272 	APL14,
273 	APL15,
274 	APL16,
275 	APL17,
276 	APL19,
277 	APL23,
278 	APL20,
279 	APL24,
280 	APL25,
281 	APL26,
282 	APL27,
283 	APL28,
284 	APL29,
285 
286 	MKK3,
287 	MKK5,
288 	MKK11,
289 	MKK16,
290 	MKK17,
291 	MKK18,
292 	MKK4,
293 	MKK9,
294 	MKK10,
295 
296 	WORLD_5G_1,
297 	WORLD_5G_2,
298 
299 	REG_DOMAINS_5G_MAX,
300 };
301 
302 enum reg_domains_2g {
303 	FCCA,
304 	MKKA,
305 	MKKC,
306 	KRRA,
307 	CHNA,
308 	FCCB,
309 	ETSIC,
310 	WORLD,
311 	ETSID,
312 	WORLD_2G_1,
313 	WORLD_2G_2,
314 	WORLD_2G_3,
315 
316 	REG_DOMAINS_2G_MAX,
317 };
318 
319 enum country_code {
320 	CTRY_AFGHANISTAN = 4,
321 	CTRY_ALAND_ISLANDS = 248,
322 	CTRY_ALBANIA = 8,
323 	CTRY_ALGERIA = 12,
324 	CTRY_AMERICAN_SAMOA = 16,
325 	CTRY_ANDORRA = 20,
326 	CTRY_ANGUILLA = 660,
327 	CTRY_ANTIGUA_AND_BARBUDA = 28,
328 	CTRY_ARGENTINA = 32,
329 	CTRY_ARMENIA = 51,
330 	CTRY_MYANMAR = 104,
331 	CTRY_ARUBA = 533,
332 	CTRY_AUSTRALIA = 36,
333 	CTRY_AUSTRIA = 40,
334 	CTRY_AZERBAIJAN = 31,
335 	CTRY_BAHAMAS = 44,
336 	CTRY_BAHRAIN = 48,
337 	CTRY_BANGLADESH = 50,
338 	CTRY_BARBADOS = 52,
339 	CTRY_BELARUS = 112,
340 	CTRY_BELGIUM = 56,
341 	CTRY_BELIZE = 84,
342 	CTRY_BERMUDA = 60,
343 	CTRY_BHUTAN = 64,
344 	CTRY_BOLIVIA = 68,
345 	CTRY_BOSNIA_HERZ = 70,
346 	CTRY_BOTSWANA = 72,
347 	CTRY_BRAZIL = 76,
348 	CTRY_BRUNEI_DARUSSALAM = 96,
349 	CTRY_BULGARIA = 100,
350 	CTRY_BURUNDI = 108,
351 	CTRY_BURKINA_FASO = 854,
352 	CTRY_CAMBODIA = 116,
353 	CTRY_CAMEROON = 120,
354 	CTRY_CANADA = 124,
355 	CTRY_CAYMAN_ISLANDS = 136,
356 	CTRY_CENTRAL_AFRICA_REPUBLIC = 140,
357 	CTRY_CHAD = 148,
358 	CTRY_CHILE = 152,
359 	CTRY_CHINA = 156,
360 	CTRY_CHRISTMAS_ISLAND = 162,
361 	CTRY_COLOMBIA = 170,
362 	CTRY_CONGO = 178,
363 	CTRY_CONGO_DEMOCRATIC_REPUBLIC = 180,
364 	CTRY_COOK_ISLANDS = 184,
365 	CTRY_COSTA_RICA = 188,
366 	CTRY_COTE_DIVOIRE = 384,
367 	CTRY_CROATIA = 191,
368 	CTRY_CURACAO = 531,
369 	CTRY_CYPRUS = 196,
370 	CTRY_CZECH = 203,
371 	CTRY_DENMARK = 208,
372 	CTRY_DOMINICA = 212,
373 	CTRY_DOMINICAN_REPUBLIC = 214,
374 	CTRY_ECUADOR = 218,
375 	CTRY_EGYPT = 818,
376 	CTRY_EL_SALVADOR = 222,
377 	CTRY_ESTONIA = 233,
378 	CTRY_ETHIOPIA = 231,
379 	CTRY_FALKLAND_ISLANDS = 238,
380 	CTRY_FAROE_ISLANDS = 234,
381 	CTRY_FIJI = 242,
382 	CTRY_FINLAND = 246,
383 	CTRY_FRANCE = 250,
384 	CTRY_FRENCH_GUIANA = 254,
385 	CTRY_FRENCH_POLYNESIA = 258,
386 	CTRY_FRENCH_SOUTHERN_TERRITORIES = 260,
387 	CTRY_GABON = 266,
388 	CTRY_GEORGIA = 268,
389 	CTRY_GERMANY = 276,
390 	CTRY_GHANA = 288,
391 	CTRY_GIBRALTAR = 292,
392 	CTRY_GREECE = 300,
393 	CTRY_GREENLAND = 304,
394 	CTRY_GRENADA = 308,
395 	CTRY_GUADELOUPE = 312,
396 	CTRY_GUAM = 316,
397 	CTRY_GUATEMALA = 320,
398 	CTRY_GUERNSEY = 831,
399 	CTRY_GUYANA = 328,
400 	CTRY_HAITI = 332,
401 	CTRY_HEARD_ISLAND_AND_MCDONALD_ISLANDS = 334,
402 	CTRY_HOLY_SEE = 336,
403 	CTRY_HONDURAS = 340,
404 	CTRY_HONG_KONG = 344,
405 	CTRY_HUNGARY = 348,
406 	CTRY_ICELAND = 352,
407 	CTRY_INDIA = 356,
408 	CTRY_INDONESIA = 360,
409 	CTRY_IRAQ = 368,
410 	CTRY_IRELAND = 372,
411 	CTRY_ISLE_OF_MAN = 833,
412 	CTRY_ISRAEL = 376,
413 	CTRY_ITALY = 380,
414 	CTRY_JAMAICA = 388,
415 	CTRY_JAPAN = 392,
416 	CTRY_JAPAN15 = 4015,
417 	CTRY_JERSEY = 832,
418 	CTRY_JORDAN = 400,
419 	CTRY_KAZAKHSTAN = 398,
420 	CTRY_KENYA = 404,
421 	CTRY_KOREA_ROC = 410,
422 	CTRY_KUWAIT = 414,
423 	CTRY_LAO_PEOPLES_DEMOCRATIC_REPUBLIC = 418,
424 	CTRY_LATVIA = 428,
425 	CTRY_LEBANON = 422,
426 	CTRY_LESOTHO = 426,
427 	CTRY_LIBYA = 434,
428 	CTRY_LIECHTENSTEIN = 438,
429 	CTRY_LITHUANIA = 440,
430 	CTRY_LUXEMBOURG = 442,
431 	CTRY_MACAU = 446,
432 	CTRY_MACEDONIA = 807,
433 	CTRY_MALAWI = 454,
434 	CTRY_MALAYSIA = 458,
435 	CTRY_MALDIVES = 462,
436 	CTRY_MALTA = 470,
437 	CTRY_MARSHALL_ISLANDS = 584,
438 	CTRY_MARTINIQUE = 474,
439 	CTRY_MAURITANIA = 478,
440 	CTRY_MAURITIUS = 480,
441 	CTRY_MAYOTTE = 175,
442 	CTRY_MEXICO = 484,
443 	CTRY_MICRONESIA = 583,
444 	CTRY_MOLDOVA = 498,
445 	CTRY_MONACO = 492,
446 	CTRY_MONGOLIA = 496,
447 	CTRY_MONTENEGRO = 499,
448 	CTRY_MONTSERRAT = 500,
449 	CTRY_MOROCCO = 504,
450 	CTRY_NAMIBIA = 516,
451 	CTRY_NEPAL = 524,
452 	CTRY_NETHERLANDS = 528,
453 	CTRY_NETHERLANDS_ANTILLES = 530,
454 	CTRY_NEW_CALEDONIA = 540,
455 	CTRY_NEW_ZEALAND = 554,
456 	CTRY_NIGERIA = 566,
457 	CTRY_NORTHERN_MARIANA_ISLANDS = 580,
458 	CTRY_NICARAGUA = 558,
459 	CTRY_NIUE = 570,
460 	CTRY_NORFOLK_ISLAND = 574,
461 	CTRY_NORWAY = 578,
462 	CTRY_OMAN = 512,
463 	CTRY_PAKISTAN = 586,
464 	CTRY_PALAU = 585,
465 	CTRY_PANAMA = 591,
466 	CTRY_PAPUA_NEW_GUINEA = 598,
467 	CTRY_PARAGUAY = 600,
468 	CTRY_PERU = 604,
469 	CTRY_PHILIPPINES = 608,
470 	CTRY_POLAND = 616,
471 	CTRY_PORTUGAL = 620,
472 	CTRY_PUERTO_RICO = 630,
473 	CTRY_QATAR = 634,
474 	CTRY_REUNION = 638,
475 	CTRY_ROMANIA = 642,
476 	CTRY_RUSSIA = 643,
477 	CTRY_RWANDA = 646,
478 	CTRY_SAINT_BARTHELEMY = 652,
479 	CTRY_SAINT_HELENA_ASCENSION_AND_TRISTAN_DA_CUNHA = 654,
480 	CTRY_SAINT_KITTS_AND_NEVIS = 659,
481 	CTRY_SAINT_LUCIA = 662,
482 	CTRY_SAINT_MARTIN = 663,
483 	CTRY_SAINT_PIERRE_AND_MIQUELON = 666,
484 	CTRY_SAINT_VINCENT_AND_THE_GRENADIENS = 670,
485 	CTRY_SAMOA = 882,
486 	CTRY_SAN_MARINO = 674,
487 	CTRY_SAO_TOME_AND_PRINCIPE = 678,
488 	CTRY_SAUDI_ARABIA = 682,
489 	CTRY_SENEGAL = 686,
490 	CTRY_SERBIA = 688,
491 	CTRY_SINGAPORE = 702,
492 	CTRY_SINT_MAARTEN = 534,
493 	CTRY_SLOVAKIA = 703,
494 	CTRY_SLOVENIA = 705,
495 	CTRY_SOUTH_AFRICA = 710,
496 	CTRY_SPAIN = 724,
497 	CTRY_SURINAME = 740,
498 	CTRY_SRI_LANKA = 144,
499 	CTRY_SVALBARD_AND_JAN_MAYEN = 744,
500 	CTRY_SWEDEN = 752,
501 	CTRY_SWITZERLAND = 756,
502 	CTRY_TAIWAN = 158,
503 	CTRY_TANZANIA = 834,
504 	CTRY_THAILAND = 764,
505 	CTRY_TOGO = 768,
506 	CTRY_TRINIDAD_Y_TOBAGO = 780,
507 	CTRY_TUNISIA = 788,
508 	CTRY_TURKEY = 792,
509 	CTRY_TURKS_AND_CAICOS = 796,
510 	CTRY_UGANDA = 800,
511 	CTRY_UKRAINE = 804,
512 	CTRY_UAE = 784,
513 	CTRY_UNITED_KINGDOM = 826,
514 	CTRY_UNITED_STATES = 840,
515 	CTRY_UNITED_STATES_MINOR_OUTLYING_ISLANDS = 581,
516 	CTRY_URUGUAY = 858,
517 	CTRY_UZBEKISTAN = 860,
518 	CTRY_VANUATU = 548,
519 	CTRY_VENEZUELA = 862,
520 	CTRY_VIET_NAM = 704,
521 	CTRY_VIRGIN_ISLANDS = 850,
522 	CTRY_VIRGIN_ISLANDS_BRITISH = 92,
523 	CTRY_WALLIS_AND_FUTUNA = 876,
524 	CTRY_XA = 4100,   /* Used by Linux Client for legacy MKK domain */
525 	CTRY_YEMEN = 887,
526 	CTRY_ZIMBABWE = 716,
527 	CTRY_ZAMBIA = 884,
528 };
529 
530 /**
531  * struct regulatory_rule
532  * @start_freq: start frequency
533  * @end_freq: end frequency
534  * @max_bw: maximum bandwidth
535  * @reg_power: regulatory power
536  * @flags: regulatory flags
537  */
538 struct regulatory_rule {
539 	uint16_t start_freq;
540 	uint16_t end_freq;
541 	uint16_t max_bw;
542 	uint8_t reg_power;
543 	uint16_t flags;
544 };
545 
546 #if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
547 /**
548  * struct regulatory_rule_ext
549  * @start_freq: start frequency in MHz
550  * @end_freq: end frequency in MHz
551  * @max_bw: maximum bandwidth in MHz
552  * @eirp_power: EIRP power in dBm
553  * @psd_power: Max PSD power in dBm per MHz
554  * @flags: regulatory flags
555  */
556 struct regulatory_rule_ext {
557 	uint16_t start_freq;
558 	uint16_t end_freq;
559 	uint16_t max_bw;
560 	uint8_t eirp_power;
561 	int8_t psd_power;
562 	uint16_t flags;
563 };
564 #endif
565 
566 /**
567  * struct regdomain
568  * @ctl_val: CTL value
569  * @dfs_region: dfs region
570  * @min_bw: minimum bandwidth
571  * @max_bw: maximum bandwidth
572  * @ant_gain: antenna gain
573  * @num_reg_rules: number of regulatory rules
574  * @reg_rule_id: regulatory rule index
575  */
576 struct regdomain   {
577 	uint8_t ctl_val;
578 	enum dfs_reg dfs_region;
579 	uint16_t min_bw;
580 	uint16_t max_bw;
581 	uint8_t ant_gain;
582 	uint8_t num_reg_rules;
583 	uint8_t reg_rule_id[MAX_REG_RULES];
584 };
585 
586 #if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
587 #define REG_MAX_PSD (0x7F) /* 127=63.5 dBm/MHz */
588 
589 /**
590  * struct sub_6g_regdomain
591  * @min_bw: Minimum bandwidth in MHz
592  * @max_bw: Maximum bandwidth in MHz
593  * @num_reg_rules: number of regulatory rules
594  * @reg_rules_id: regulatory rule index
595  * @sixg_reg_rule_id: Rule identifier array of 6 GHz rules
596  */
597 struct sub_6g_regdomain   {
598 	uint16_t min_bw;
599 	uint16_t max_bw;
600 	uint8_t num_reg_rules;
601 	uint8_t sixg_reg_rule_id[MAX_REG_RULES];
602 };
603 #endif
604 
605 /**
606  * struct country_code_to_reg_domain
607  * @country_code: country code
608  * @reg_dmn_pair_id: reg domainpair id
609  * @reg_6ghz_super_dmn_id: 6GHz super domain id
610  * @alpha2: iso-3166 alpha2
611  * @max_bw_2g: maximum 2g bandwidth in MHz
612  * @max_bw_5g: maximum 5g bandwidth in MHz
613  * @max_bw_6g: maximum 6g bandwidth in MHz
614  * @phymode_bitmap: phymodes not supported
615  */
616 struct country_code_to_reg_domain   {
617 	uint16_t country_code;
618 	uint16_t reg_dmn_pair_id;
619 #if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
620 	uint16_t reg_6ghz_super_dmn_id;
621 #endif
622 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
623 	uint16_t max_bw_2g;
624 	uint16_t max_bw_5g;
625 #if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
626 	uint16_t max_bw_6g;
627 #endif
628 	uint16_t phymode_bitmap;
629 };
630 
631 /**
632  * struct reg_domain_pair
633  * @reg_dmn_pair_id: reg domainpiar value
634  * @dmn_id_5g: 5g reg domain value
635  * @dmn_id_2g: 2g regdomain value
636  */
637 struct reg_domain_pair {
638 	uint16_t reg_dmn_pair_id;
639 	uint8_t dmn_id_5g;
640 	uint8_t dmn_id_2g;
641 };
642 
643 #if defined(CONFIG_BAND_6GHZ)
644 /**
645  * enum reg_super_domain_6g - 6G Super Domain enumeration
646  * @FCC1_6G_01: Super domain FCC1_6G_01 for US
647  * @ETSI1_6G_02: Super domain ETSI1_6G_02 for EU
648  * @ETSI2_6G_03: Super domain ETSI2_6G_03 for UK
649  * @APL1_6G_04: Super domain APL1_6G_04 for Korea
650  * @FCC1_6G_05: Super domain FCC1_6G_05 for Chile
651  * @APL2_6G_06: Super domain APL2_6G_06 for Guatemala
652  * @FCC1_6G_07: Super domain FCC1_6G_07 for Brazil
653  * @APL3_6G_08: Super domain APL3_6G_08 for UAE
654  * @FCC1_6G_09: Super domain FCC1_6G_09 for US AFC Testing
655  * @APL6_6G_0A: Super domain APL6_6G_0A for Saudi Arabia LPI STA and AP
656  * @MKK1_6G_0B: Super domain MKK1_6G_0B for Japan LPI and VLP
657  * @ETSI2_6G_0C: Super domain ETSI2_6G_0C for Australia LPI and VLP
658  * @ETSI1_6G_0D: Super domain ETSI1_6G_0D for ISRAEL LPI
659  * @ETSI2_6G_0E: Super domain ETSI2_6G_0E for NEW ZEALAND LPI and VLP
660  * @FCC2_6G_10: Super domain FCC1_6G_10 for Canada LPI &
661  *		SP(VLP to be added later)
662  * @APL4_6G_11: Super domain APL3_6G_11 for Costa Rica LPI and VLP
663  * @APL5_6G_12: Super domain for future purpose
664  * @APL7_6G_13: Super domain APL7_6G_13 for CHILE
665  * @FCC1_6G_14: Super domain FCC1_6G_14 for DOMINICAN REPUBLIC
666  */
667 enum reg_super_domain_6g {
668 	FCC1_6G_01 = 0x01,
669 	ETSI1_6G_02 = 0x02,
670 	ETSI2_6G_03 = 0x03,
671 	APL1_6G_04 = 0x04,
672 	FCC1_6G_05 = 0x05,
673 	APL2_6G_06 = 0x06,
674 	FCC1_6G_07 = 0x07,
675 	APL3_6G_08 = 0x08,
676 	FCC1_6G_09 = 0x09,
677 	APL6_6G_0A = 0x0A,
678 	MKK1_6G_0B = 0x0B,
679 	ETSI2_6G_0C = 0x0C,
680 	ETSI1_6G_0D = 0x0D,
681 	ETSI2_6G_0E = 0x0E,
682 	FCC2_6G_10 = 0x10,
683 	APL4_6G_11 = 0x11,
684 	APL5_6G_12 = 0x12,
685 	APL7_6G_13 = 0x13,
686 	FCC1_6G_14 = 0x14,
687 };
688 
689 #if defined(COMPILE_REGDB_6G)
690 /**
691  * struct sixghz_super_to_subdomains
692  * @reg_6ghz_super_dmn_id: 6G super domain id.
693  * @reg_domain_6g_id_ap_lpi: 6G domain id for LPI AP.
694  * @reg_domain_6g_id_ap_sp: 6G domain id for SP AP.
695  * @reg_domain_6g_id_ap_vlp: 6G domain id for VLP AP.
696  * @reg_domain_6g_id_client_lpi: 6G domain id for clients of the LPI AP.
697  * @reg_domain_6g_id_client_sp: 6G domain id for clients of the SP AP.
698  * @reg_domain_6g_id_client_vlp: 6G domain id for clients of the VLP AP.
699  */
700 struct sixghz_super_to_subdomains {
701 	uint16_t reg_6ghz_super_dmn_id;
702 	uint8_t reg_domain_6g_id_ap_lpi;
703 	uint8_t reg_domain_6g_id_ap_sp;
704 	uint8_t reg_domain_6g_id_ap_vlp;
705 	uint8_t reg_domain_6g_id_client_lpi[REG_MAX_CLIENT_TYPE];
706 	uint8_t reg_domain_6g_id_client_sp[REG_MAX_CLIENT_TYPE];
707 	uint8_t reg_domain_6g_id_client_vlp[REG_MAX_CLIENT_TYPE];
708 };
709 #endif
710 #endif
711 
712 QDF_STATUS reg_get_num_countries(int *num_countries);
713 
714 QDF_STATUS reg_get_num_reg_dmn_pairs(int *num_reg_dmn);
715 
716 /**
717  * reg_etsi_regdmn () - Check if the reg domain is ETSI13/ETSI18/ETSI20 or not
718  * @reg_dmn: reg domain
719  *
720  * Return: true or false
721  */
722 bool reg_etsi_regdmn(uint8_t reg_dmn);
723 
724 /**
725  * reg_fcc_regdmn () - Checks if the reg domain is FCC3/FCC8/FCC15/FCC16 or not
726  * @reg_dmn: reg domain
727  *
728  * Return: true or false
729  */
730 bool reg_fcc_regdmn(uint8_t reg_dmn);
731 
732 #ifdef WLAN_REG_PARTIAL_OFFLOAD
733 QDF_STATUS reg_get_default_country(uint16_t *default_country);
734 
735 /**
736  * reg_en302_502_regdmn() - Check if the reg domain is en302_502 applicable.
737  * @reg_dmn: Regulatory domain pair ID.
738  *
739  * Return: True if EN302_502 applicable, else false.
740  */
741 bool reg_en302_502_regdmn(uint16_t reg_dmn);
742 #endif
743 #endif
744