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