rlm_domain.c 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rlm_domain.c#2
  3. */
  4. /*! \file "rlm_domain.c"
  5. \brief
  6. */
  7. /*
  8. ** Log: rlm_domain.c
  9. **
  10. ** 01 23 2013 eason.tsai
  11. ** [BORA00002255] [MT6630 Wi-Fi][Driver] develop
  12. ** Rollback //BORA/DEV/MT6630WIFI_DRV/mgmt/rlm_domain.c to revision 1
  13. **
  14. ** 09 17 2012 cm.chang
  15. ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
  16. ** Duplicate source from MT6620 v2.3 driver branch
  17. ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
  18. *
  19. * 11 10 2011 cm.chang
  20. * NULL
  21. * Modify debug message for XLOG
  22. *
  23. * 09 29 2011 cm.chang
  24. * NULL
  25. * Change the function prototype of rlmDomainGetChnlList()
  26. *
  27. * 09 23 2011 cm.chang
  28. * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
  29. * Let channel number to zero if band is illegal
  30. *
  31. * 09 22 2011 cm.chang
  32. * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
  33. * Exclude channel list with illegal band
  34. *
  35. * 09 15 2011 cm.chang
  36. * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
  37. * Use defined country group to have a change to add new group
  38. *
  39. * 09 08 2011 cm.chang
  40. * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
  41. * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM
  42. *
  43. * 08 31 2011 cm.chang
  44. * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
  45. * .
  46. *
  47. * 06 01 2011 cm.chang
  48. * [WCXRP00000756] [MT6620 Wi-Fi][Driver] 1. AIS follow channel of BOW 2. Provide legal channel function
  49. * Provide legal channel function based on domain
  50. *
  51. * 03 19 2011 yuche.tsai
  52. * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
  53. * Add beacon timeout support for WiFi Direct Network.
  54. *
  55. * 03 02 2011 terry.wu
  56. * [WCXRP00000505] [MT6620 Wi-Fi][Driver/FW] WiFi Direct Integration
  57. * Export rlmDomainGetDomainInfo for p2p driver.
  58. *
  59. * 01 12 2011 cm.chang
  60. * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
  61. * User-defined bandwidth is for 2.4G and 5G individually
  62. *
  63. * 12 07 2010 cm.chang
  64. * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
  65. * 1. Country code is from NVRAM or supplicant
  66. * 2. Change band definition in CMD/EVENT.
  67. *
  68. * 07 08 2010 cp.wu
  69. *
  70. * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
  71. *
  72. * 07 08 2010 cm.chang
  73. * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
  74. * Check draft RLM code for HT cap
  75. *
  76. * 03 25 2010 cm.chang
  77. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  78. * Filter out not supported RF freq when reporting available chnl list
  79. *
  80. * 01 22 2010 cm.chang
  81. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  82. * Support protection and bandwidth switch
  83. *
  84. * 01 13 2010 cm.chang
  85. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  86. * Provide query function about full channel list.
  87. *
  88. * Dec 1 2009 mtk01104
  89. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  90. *
  91. *
  92. **
  93. */
  94. /*******************************************************************************
  95. * C O M P I L E R F L A G S
  96. ********************************************************************************
  97. */
  98. /*******************************************************************************
  99. * E X T E R N A L R E F E R E N C E S
  100. ********************************************************************************
  101. */
  102. #include "precomp.h"
  103. #include "rlm_txpwr_init.h"
  104. /*******************************************************************************
  105. * C O N S T A N T S
  106. ********************************************************************************
  107. */
  108. /*******************************************************************************
  109. * D A T A T Y P E S
  110. ********************************************************************************
  111. */
  112. /*******************************************************************************
  113. * P U B L I C D A T A
  114. ********************************************************************************
  115. */
  116. /* The following country or domain shall be set from host driver.
  117. * And host driver should pass specified DOMAIN_INFO_ENTRY to MT6620 as
  118. * the channel list of being a STA to do scanning/searching AP or being an
  119. * AP to choose an adequate channel if auto-channel is set.
  120. */
  121. /* Define mapping tables between country code and its channel set
  122. */
  123. static const UINT_16 g_u2CountryGroup0[] = {
  124. COUNTRY_CODE_AO, COUNTRY_CODE_BZ, COUNTRY_CODE_BJ, COUNTRY_CODE_BT,
  125. COUNTRY_CODE_BO, COUNTRY_CODE_BI, COUNTRY_CODE_CM, COUNTRY_CODE_CF,
  126. COUNTRY_CODE_TD, COUNTRY_CODE_KM, COUNTRY_CODE_CD, COUNTRY_CODE_CG,
  127. COUNTRY_CODE_CI, COUNTRY_CODE_DJ, COUNTRY_CODE_GQ, COUNTRY_CODE_ER,
  128. COUNTRY_CODE_FJ, COUNTRY_CODE_GA, COUNTRY_CODE_GM, COUNTRY_CODE_GN,
  129. COUNTRY_CODE_GW, COUNTRY_CODE_RKS, COUNTRY_CODE_KG, COUNTRY_CODE_LY,
  130. COUNTRY_CODE_MG, COUNTRY_CODE_ML, COUNTRY_CODE_NR, COUNTRY_CODE_NC,
  131. COUNTRY_CODE_ST, COUNTRY_CODE_SC, COUNTRY_CODE_SL, COUNTRY_CODE_SB,
  132. COUNTRY_CODE_SO, COUNTRY_CODE_SR, COUNTRY_CODE_SZ, COUNTRY_CODE_TJ,
  133. COUNTRY_CODE_TG, COUNTRY_CODE_TO, COUNTRY_CODE_TM, COUNTRY_CODE_TV,
  134. COUNTRY_CODE_VU, COUNTRY_CODE_YE
  135. };
  136. static const UINT_16 g_u2CountryGroup1[] = {
  137. COUNTRY_CODE_AS, COUNTRY_CODE_AI, COUNTRY_CODE_BM, COUNTRY_CODE_CA,
  138. COUNTRY_CODE_KY, COUNTRY_CODE_GU, COUNTRY_CODE_FM, COUNTRY_CODE_PR,
  139. COUNTRY_CODE_US, COUNTRY_CODE_VI
  140. };
  141. static const UINT_16 g_u2CountryGroup2[] = {
  142. COUNTRY_CODE_AR, COUNTRY_CODE_AU, COUNTRY_CODE_AZ, COUNTRY_CODE_BW,
  143. COUNTRY_CODE_KH, COUNTRY_CODE_CX, COUNTRY_CODE_CO, COUNTRY_CODE_CR,
  144. COUNTRY_CODE_EC, COUNTRY_CODE_GD, COUNTRY_CODE_GT, COUNTRY_CODE_HK,
  145. COUNTRY_CODE_KI, COUNTRY_CODE_LB, COUNTRY_CODE_LR, COUNTRY_CODE_MN,
  146. COUNTRY_CODE_AN, COUNTRY_CODE_NZ, COUNTRY_CODE_NI, COUNTRY_CODE_PW,
  147. COUNTRY_CODE_PY, COUNTRY_CODE_PE, COUNTRY_CODE_PH, COUNTRY_CODE_WS,
  148. COUNTRY_CODE_SG, COUNTRY_CODE_LK, COUNTRY_CODE_TH, COUNTRY_CODE_TT,
  149. COUNTRY_CODE_UY, COUNTRY_CODE_VN
  150. };
  151. static const UINT_16 g_u2CountryGroup3[] = {
  152. COUNTRY_CODE_AW, COUNTRY_CODE_LA, COUNTRY_CODE_SA, COUNTRY_CODE_AE,
  153. COUNTRY_CODE_UG
  154. };
  155. static const UINT_16 g_u2CountryGroup4[] = { COUNTRY_CODE_MM };
  156. static const UINT_16 g_u2CountryGroup5[] = {
  157. COUNTRY_CODE_AL, COUNTRY_CODE_DZ, COUNTRY_CODE_AD, COUNTRY_CODE_AT,
  158. COUNTRY_CODE_BY, COUNTRY_CODE_BE, COUNTRY_CODE_BA, COUNTRY_CODE_VG,
  159. COUNTRY_CODE_BG, COUNTRY_CODE_CV, COUNTRY_CODE_HR, COUNTRY_CODE_CY,
  160. COUNTRY_CODE_CZ, COUNTRY_CODE_DK, COUNTRY_CODE_EE, COUNTRY_CODE_ET,
  161. COUNTRY_CODE_FI, COUNTRY_CODE_FR, COUNTRY_CODE_GF, COUNTRY_CODE_PF,
  162. COUNTRY_CODE_TF, COUNTRY_CODE_GE, COUNTRY_CODE_DE, COUNTRY_CODE_GH,
  163. COUNTRY_CODE_GR, COUNTRY_CODE_GP, COUNTRY_CODE_HU, COUNTRY_CODE_IS,
  164. COUNTRY_CODE_IQ, COUNTRY_CODE_IE, COUNTRY_CODE_IT, COUNTRY_CODE_KE,
  165. COUNTRY_CODE_LV, COUNTRY_CODE_LS, COUNTRY_CODE_LI, COUNTRY_CODE_LT,
  166. COUNTRY_CODE_LU, COUNTRY_CODE_MK, COUNTRY_CODE_MT, COUNTRY_CODE_MQ,
  167. COUNTRY_CODE_MR, COUNTRY_CODE_MU, COUNTRY_CODE_YT, COUNTRY_CODE_MD,
  168. COUNTRY_CODE_MC, COUNTRY_CODE_ME, COUNTRY_CODE_MS, COUNTRY_CODE_NL,
  169. COUNTRY_CODE_NO, COUNTRY_CODE_OM, COUNTRY_CODE_PL, COUNTRY_CODE_PT,
  170. COUNTRY_CODE_RE, COUNTRY_CODE_RO, COUNTRY_CODE_MF, COUNTRY_CODE_SM,
  171. COUNTRY_CODE_SN, COUNTRY_CODE_RS, COUNTRY_CODE_SK, COUNTRY_CODE_SI,
  172. COUNTRY_CODE_ZA, COUNTRY_CODE_ES, COUNTRY_CODE_SE, COUNTRY_CODE_CH,
  173. COUNTRY_CODE_TR, COUNTRY_CODE_TC, COUNTRY_CODE_GB, COUNTRY_CODE_VA,
  174. COUNTRY_CODE_EU
  175. };
  176. static const UINT_16 g_u2CountryGroup6[] = { COUNTRY_CODE_JP };
  177. static const UINT_16 g_u2CountryGroup7[] = {
  178. COUNTRY_CODE_AM, COUNTRY_CODE_IL, COUNTRY_CODE_KW, COUNTRY_CODE_MA,
  179. COUNTRY_CODE_NE, COUNTRY_CODE_TN, COUNTRY_CODE_MA
  180. };
  181. static const UINT_16 g_u2CountryGroup8[] = { COUNTRY_CODE_NP };
  182. static const UINT_16 g_u2CountryGroup9[] = { COUNTRY_CODE_AF };
  183. static const UINT_16 g_u2CountryGroup10[] = {
  184. COUNTRY_CODE_AG, COUNTRY_CODE_BS, COUNTRY_CODE_BH, COUNTRY_CODE_BB,
  185. COUNTRY_CODE_BN, COUNTRY_CODE_CL, COUNTRY_CODE_CN, COUNTRY_CODE_EG,
  186. COUNTRY_CODE_SV, COUNTRY_CODE_IN, COUNTRY_CODE_MY, COUNTRY_CODE_MV,
  187. COUNTRY_CODE_PA, COUNTRY_CODE_VE, COUNTRY_CODE_ZM
  188. };
  189. static const UINT_16 g_u2CountryGroup11[] = { COUNTRY_CODE_JO, COUNTRY_CODE_PG };
  190. static const UINT_16 g_u2CountryGroup12[] = {
  191. COUNTRY_CODE_BF, COUNTRY_CODE_GY, COUNTRY_CODE_HT, COUNTRY_CODE_HN,
  192. COUNTRY_CODE_JM, COUNTRY_CODE_MO, COUNTRY_CODE_MW, COUNTRY_CODE_PK,
  193. COUNTRY_CODE_QA, COUNTRY_CODE_RW, COUNTRY_CODE_KN, COUNTRY_CODE_TZ
  194. };
  195. static const UINT_16 g_u2CountryGroup13[] = { COUNTRY_CODE_ID };
  196. static const UINT_16 g_u2CountryGroup14[] = { COUNTRY_CODE_KR };
  197. static const UINT_16 g_u2CountryGroup15[] = { COUNTRY_CODE_NG };
  198. static const UINT_16 g_u2CountryGroup16[] = {
  199. COUNTRY_CODE_BD, COUNTRY_CODE_BR, COUNTRY_CODE_DM, COUNTRY_CODE_DO,
  200. COUNTRY_CODE_FK, COUNTRY_CODE_KZ, COUNTRY_CODE_MX, COUNTRY_CODE_MZ,
  201. COUNTRY_CODE_NA, COUNTRY_CODE_RU, COUNTRY_CODE_LC, COUNTRY_CODE_VC,
  202. COUNTRY_CODE_UA, COUNTRY_CODE_UZ, COUNTRY_CODE_ZW
  203. };
  204. static const UINT_16 g_u2CountryGroup17[] = { COUNTRY_CODE_MP };
  205. static const UINT_16 g_u2CountryGroup18[] = { COUNTRY_CODE_TW };
  206. static const UINT_16 g_u2CountryGroup19[] = {
  207. COUNTRY_CODE_CK, COUNTRY_CODE_CU, COUNTRY_CODE_TL, COUNTRY_CODE_FO,
  208. COUNTRY_CODE_GI, COUNTRY_CODE_GG, COUNTRY_CODE_IR, COUNTRY_CODE_IM,
  209. COUNTRY_CODE_JE, COUNTRY_CODE_KP, COUNTRY_CODE_MH, COUNTRY_CODE_NU,
  210. COUNTRY_CODE_NF, COUNTRY_CODE_PS, COUNTRY_CODE_PN, COUNTRY_CODE_PM,
  211. COUNTRY_CODE_SS, COUNTRY_CODE_SD, COUNTRY_CODE_SY
  212. };
  213. static const UINT_16 g_u2CountryGroup20[] = {
  214. COUNTRY_CODE_DF
  215. /* When country code is not found and no matched NVRAM setting,
  216. * this domain info will be used.
  217. */
  218. };
  219. DOMAIN_INFO_ENTRY arSupportedRegDomains[] = {
  220. {
  221. (PUINT_16) g_u2CountryGroup0, sizeof(g_u2CountryGroup0) / 2,
  222. {
  223. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  224. , /* CH_SET_2G4_1_13 */
  225. {115, BAND_NULL, 0, 0, 0, FALSE}
  226. , /* CH_SET_UNII_LOW_NA */
  227. {118, BAND_NULL, 0, 0, 0, FALSE}
  228. , /* CH_SET_UNII_MID_NA */
  229. {121, BAND_NULL, 0, 0, 0, FALSE}
  230. , /* CH_SET_UNII_WW_NA */
  231. {125, BAND_NULL, 0, 0, 0, FALSE}
  232. , /* CH_SET_UNII_UPPER_NA */
  233. {0, BAND_NULL, 0, 0, 0, FALSE}
  234. }
  235. }
  236. ,
  237. {
  238. (PUINT_16) g_u2CountryGroup1, sizeof(g_u2CountryGroup1) / 2,
  239. {
  240. {81, BAND_2G4, CHNL_SPAN_5, 1, 11, FALSE}
  241. , /* CH_SET_2G4_1_11 */
  242. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  243. , /* CH_SET_UNII_LOW_36_48 */
  244. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  245. , /* CH_SET_UNII_MID_52_64 */
  246. {121, BAND_5G, CHNL_SPAN_20, 100, 12, TRUE}
  247. , /* CH_SET_UNII_WW_100_144 */
  248. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  249. , /* CH_SET_UNII_UPPER_149_165 */
  250. {0, BAND_NULL, 0, 0, 0, FALSE}
  251. }
  252. }
  253. ,
  254. {
  255. (PUINT_16) g_u2CountryGroup2, sizeof(g_u2CountryGroup2) / 2,
  256. {
  257. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  258. , /* CH_SET_2G4_1_13 */
  259. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  260. , /* CH_SET_UNII_LOW_36_48 */
  261. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  262. , /* CH_SET_UNII_MID_52_64 */
  263. {121, BAND_5G, CHNL_SPAN_20, 100, 12, TRUE}
  264. , /* CH_SET_UNII_WW_100_144 */
  265. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  266. , /* CH_SET_UNII_UPPER_149_165 */
  267. {0, BAND_NULL, 0, 0, 0, FALSE}
  268. }
  269. }
  270. ,
  271. {
  272. (PUINT_16) g_u2CountryGroup3, sizeof(g_u2CountryGroup3) / 2,
  273. {
  274. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  275. , /* CH_SET_2G4_1_13 */
  276. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  277. , /* CH_SET_UNII_LOW_36_48 */
  278. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  279. , /* CH_SET_UNII_MID_52_64 */
  280. {121, BAND_5G, CHNL_SPAN_20, 100, 12, TRUE}
  281. , /* CH_SET_UNII_WW_100_144 */
  282. {125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE}
  283. , /* CH_SET_UNII_UPPER_149_161 */
  284. {0, BAND_NULL, 0, 0, 0, FALSE}
  285. }
  286. }
  287. ,
  288. {
  289. (PUINT_16) g_u2CountryGroup4, sizeof(g_u2CountryGroup4) / 2,
  290. {
  291. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  292. , /* CH_SET_2G4_1_13 */
  293. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  294. , /* CH_SET_UNII_LOW_36_48 */
  295. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  296. , /* CH_SET_UNII_MID_52_64 */
  297. {121, BAND_5G, CHNL_SPAN_20, 100, 12, TRUE}
  298. , /* CH_SET_UNII_WW_100_144 */
  299. {125, BAND_NULL, 0, 0, 0, FALSE}
  300. , /* CH_SET_UNII_UPPER_NA */
  301. {0, BAND_NULL, 0, 0, 0, FALSE}
  302. }
  303. }
  304. ,
  305. {
  306. (PUINT_16) g_u2CountryGroup5, sizeof(g_u2CountryGroup5) / 2,
  307. {
  308. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  309. , /* CH_SET_2G4_1_13 */
  310. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  311. , /* CH_SET_UNII_LOW_36_48 */
  312. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  313. , /* CH_SET_UNII_MID_52_64 */
  314. {121, BAND_5G, CHNL_SPAN_20, 100, 11, TRUE}
  315. , /* CH_SET_UNII_WW_100_140 */
  316. {125, BAND_NULL, 0, 0, 0, FALSE}
  317. , /* CH_SET_UNII_UPPER_NA */
  318. {0, BAND_NULL, 0, 0, 0, FALSE}
  319. }
  320. }
  321. ,
  322. {
  323. (PUINT_16) g_u2CountryGroup6, sizeof(g_u2CountryGroup6) / 2,
  324. {
  325. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  326. , /* CH_SET_2G4_1_13 */
  327. {82, BAND_2G4, CHNL_SPAN_5, 14, 1, FALSE}
  328. , /* CH_SET_2G4_14_14 */
  329. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  330. , /* CH_SET_UNII_LOW_36_48 */
  331. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  332. , /* CH_SET_UNII_MID_52_64 */
  333. {121, BAND_5G, CHNL_SPAN_20, 100, 11, TRUE}
  334. , /* CH_SET_UNII_WW_100_140 */
  335. {125, BAND_NULL, 0, 0, 0, FALSE}
  336. , /* CH_SET_UNII_UPPER_NA */
  337. }
  338. }
  339. ,
  340. {
  341. (PUINT_16) g_u2CountryGroup7, sizeof(g_u2CountryGroup7) / 2,
  342. {
  343. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  344. , /* CH_SET_2G4_1_13 */
  345. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  346. , /* CH_SET_UNII_LOW_36_48 */
  347. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  348. , /* CH_SET_UNII_MID_52_64 */
  349. {121, BAND_NULL, 0, 0, 0, FALSE}
  350. , /* CH_SET_UNII_WW_NA */
  351. {125, BAND_NULL, 0, 0, 0, FALSE}
  352. , /* CH_SET_UNII_UPPER_NA */
  353. {0, BAND_NULL, 0, 0, 0, FALSE}
  354. }
  355. }
  356. ,
  357. {
  358. (PUINT_16) g_u2CountryGroup8, sizeof(g_u2CountryGroup8) / 2,
  359. {
  360. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  361. , /* CH_SET_2G4_1_13 */
  362. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  363. , /* CH_SET_UNII_LOW_36_48 */
  364. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  365. , /* CH_SET_UNII_MID_52_64 */
  366. {121, BAND_NULL, 0, 0, 0, FALSE}
  367. , /* CH_SET_UNII_WW_NA */
  368. {125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE}
  369. , /* CH_SET_UNII_UPPER_149_161 */
  370. {0, BAND_NULL, 0, 0, 0, FALSE}
  371. }
  372. }
  373. ,
  374. {
  375. (PUINT_16) g_u2CountryGroup9, sizeof(g_u2CountryGroup9) / 2,
  376. {
  377. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  378. , /* CH_SET_2G4_1_13 */
  379. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  380. , /* CH_SET_UNII_LOW_36_48 */
  381. {118, BAND_NULL, 0, 0, 0, FALSE}
  382. , /* CH_SET_UNII_MID_NA */
  383. {121, BAND_NULL, 0, 0, 0, FALSE}
  384. , /* CH_SET_UNII_WW_NA */
  385. {125, BAND_NULL, 0, 0, 0, FALSE}
  386. , /* CH_SET_UNII_UPPER_NA */
  387. {0, BAND_NULL, 0, 0, 0, FALSE}
  388. }
  389. }
  390. ,
  391. {
  392. (PUINT_16) g_u2CountryGroup10, sizeof(g_u2CountryGroup10) / 2,
  393. {
  394. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  395. , /* CH_SET_2G4_1_13 */
  396. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  397. , /* CH_SET_UNII_LOW_36_48 */
  398. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  399. , /* CH_SET_UNII_MID_52_64 */
  400. {121, BAND_NULL, 0, 0, 0, FALSE}
  401. , /* CH_SET_UNII_WW_NA */
  402. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  403. , /* CH_SET_UNII_UPPER_149_165 */
  404. {0, BAND_NULL, 0, 0, 0, FALSE}
  405. }
  406. }
  407. ,
  408. {
  409. (PUINT_16) g_u2CountryGroup11, sizeof(g_u2CountryGroup11) / 2,
  410. {
  411. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  412. , /* CH_SET_2G4_1_13 */
  413. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  414. , /* CH_SET_UNII_LOW_36_48 */
  415. {118, BAND_NULL, 0, 0, 0, FALSE}
  416. , /* CH_SET_UNII_MID_NA */
  417. {121, BAND_NULL, 0, 0, 0, FALSE}
  418. , /* CH_SET_UNII_WW_NA */
  419. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  420. , /* CH_SET_UNII_UPPER_149_165 */
  421. {0, BAND_NULL, 0, 0, 0, FALSE}
  422. }
  423. }
  424. ,
  425. {
  426. (PUINT_16) g_u2CountryGroup12, sizeof(g_u2CountryGroup12) / 2,
  427. {
  428. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  429. , /* CH_SET_2G4_1_13 */
  430. {115, BAND_NULL, 0, 0, 0, FALSE}
  431. , /* CH_SET_UNII_LOW_NA */
  432. {118, BAND_NULL, 0, 0, 0, FALSE}
  433. , /* CH_SET_UNII_MID_NA */
  434. {121, BAND_NULL, 0, 0, 0, FALSE}
  435. , /* CH_SET_UNII_WW_NA */
  436. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  437. , /* CH_SET_UNII_UPPER_149_165 */
  438. {0, BAND_NULL, 0, 0, 0, FALSE}
  439. }
  440. }
  441. ,
  442. {
  443. (PUINT_16) g_u2CountryGroup13, sizeof(g_u2CountryGroup13) / 2,
  444. {
  445. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  446. , /* CH_SET_2G4_1_13 */
  447. {115, BAND_NULL, 0, 0, 0, FALSE}
  448. , /* CH_SET_UNII_LOW_NA */
  449. {118, BAND_NULL, 0, 0, 0, FALSE}
  450. , /* CH_SET_UNII_MID_NA */
  451. {121, BAND_NULL, 0, 0, 0, FALSE}
  452. , /* CH_SET_UNII_WW_NA */
  453. {125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE}
  454. , /* CH_SET_UNII_UPPER_149_161 */
  455. {0, BAND_NULL, 0, 0, 0, FALSE}
  456. }
  457. }
  458. ,
  459. {
  460. (PUINT_16) g_u2CountryGroup14, sizeof(g_u2CountryGroup14) / 2,
  461. {
  462. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  463. , /* CH_SET_2G4_1_13 */
  464. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  465. , /* CH_SET_UNII_LOW_36_48 */
  466. {118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE}
  467. , /* CH_SET_UNII_MID_52_64 */
  468. {121, BAND_5G, CHNL_SPAN_20, 100, 8, FALSE}
  469. , /* CH_SET_UNII_WW_100_128 */
  470. {125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE}
  471. , /* CH_SET_UNII_UPPER_149_161 */
  472. {0, BAND_NULL, 0, 0, 0, FALSE}
  473. }
  474. }
  475. ,
  476. {
  477. (PUINT_16) g_u2CountryGroup15, sizeof(g_u2CountryGroup15) / 2,
  478. {
  479. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  480. , /* CH_SET_2G4_1_13 */
  481. {115, BAND_NULL, 0, 0, 0, FALSE}
  482. , /* CH_SET_UNII_LOW_36_48 */
  483. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  484. , /* CH_SET_UNII_MID_52_64 */
  485. {121, BAND_5G, CHNL_SPAN_20, 100, 11, TRUE}
  486. , /* CH_SET_UNII_WW_100_140 */
  487. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  488. , /* CH_SET_UNII_UPPER_149_165 */
  489. {0, BAND_NULL, 0, 0, 0, FALSE}
  490. }
  491. }
  492. ,
  493. {
  494. (PUINT_16) g_u2CountryGroup16, sizeof(g_u2CountryGroup16) / 2,
  495. {
  496. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  497. , /* CH_SET_2G4_1_13 */
  498. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  499. , /* CH_SET_UNII_LOW_36_48 */
  500. {118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE}
  501. , /* CH_SET_UNII_MID_52_64 */
  502. {121, BAND_5G, CHNL_SPAN_20, 100, 11, TRUE}
  503. , /* CH_SET_UNII_WW_100_140 */
  504. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  505. , /* CH_SET_UNII_UPPER_149_165 */
  506. {0, BAND_NULL, 0, 0, 0, FALSE}
  507. }
  508. }
  509. ,
  510. {
  511. (PUINT_16) g_u2CountryGroup17, sizeof(g_u2CountryGroup17) / 2,
  512. {
  513. {81, BAND_2G4, CHNL_SPAN_5, 1, 11, FALSE}
  514. , /* CH_SET_2G4_1_11 */
  515. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  516. , /* CH_SET_UNII_LOW_36_48 */
  517. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  518. , /* CH_SET_UNII_MID_52_64 */
  519. {121, BAND_5G, CHNL_SPAN_20, 100, 11, TRUE}
  520. , /* CH_SET_UNII_WW_100_140 */
  521. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  522. , /* CH_SET_UNII_UPPER_149_165 */
  523. {0, BAND_NULL, 0, 0, 0, FALSE}
  524. }
  525. }
  526. ,
  527. {
  528. (PUINT_16) g_u2CountryGroup18, sizeof(g_u2CountryGroup18) / 2,
  529. {
  530. {81, BAND_2G4, CHNL_SPAN_5, 1, 11, FALSE}
  531. , /* CH_SET_2G4_1_11 */
  532. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  533. , /* CH_SET_UNII_LOW_36_48 */
  534. {118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE}
  535. , /* CH_SET_UNII_MID_52_64 */
  536. {121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE}
  537. , /* CH_SET_UNII_WW_100_140 */
  538. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  539. , /* CH_SET_UNII_UPPER_149_165 */
  540. {0, BAND_NULL, 0, 0, 0, FALSE}
  541. }
  542. }
  543. ,
  544. {
  545. (PUINT_16) g_u2CountryGroup19, sizeof(g_u2CountryGroup19) / 2,
  546. {
  547. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  548. , /* CH_SET_2G4_1_13 */
  549. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  550. , /* CH_SET_UNII_LOW_36_48 */
  551. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  552. , /* CH_SET_UNII_MID_52_64 */
  553. {121, BAND_5G, CHNL_SPAN_20, 100, 12, TRUE}
  554. , /* CH_SET_UNII_WW_100_144 */
  555. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  556. , /* CH_SET_UNII_UPPER_149_165 */
  557. {0, BAND_NULL, 0, 0, 0, FALSE}
  558. }
  559. }
  560. ,
  561. {
  562. /* Note: Default group if no matched country code */
  563. (PUINT_16) g_u2CountryGroup20, sizeof(g_u2CountryGroup20) / 2,
  564. {
  565. {81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE}
  566. , /* CH_SET_2G4_1_13 */
  567. {115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE}
  568. , /* CH_SET_UNII_LOW_36_48 */
  569. {118, BAND_5G, CHNL_SPAN_20, 52, 4, TRUE}
  570. , /* CH_SET_UNII_MID_52_64 */
  571. {121, BAND_5G, CHNL_SPAN_20, 100, 12, TRUE}
  572. , /* CH_SET_UNII_WW_100_144 */
  573. {125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE}
  574. , /* CH_SET_UNII_UPPER_149_165 */
  575. {0, BAND_NULL, 0, 0, 0, FALSE}
  576. }
  577. }
  578. };
  579. static const UINT_16 g_u2CountryGroup0_Passive[] = {
  580. COUNTRY_CODE_TW
  581. };
  582. DOMAIN_INFO_ENTRY arSupportedRegDomains_Passive[] = {
  583. {
  584. (PUINT_16) g_u2CountryGroup0_Passive, sizeof(g_u2CountryGroup0_Passive) / 2,
  585. {
  586. {81, BAND_2G4, CHNL_SPAN_5, 1, 0, 0}
  587. , /* CH_SET_2G4_1_14_NA */
  588. {82, BAND_2G4, CHNL_SPAN_5, 14, 0, 0}
  589. ,
  590. {115, BAND_5G, CHNL_SPAN_20, 36, 4, 0}
  591. , /* CH_SET_UNII_LOW_36_48 */
  592. {118, BAND_5G, CHNL_SPAN_20, 52, 4, 0}
  593. , /* CH_SET_UNII_MID_52_64 */
  594. {121, BAND_5G, CHNL_SPAN_20, 100, 11, 0}
  595. , /* CH_SET_UNII_WW_100_140 */
  596. {125, BAND_5G, CHNL_SPAN_20, 149, 0, 0}
  597. , /* CH_SET_UNII_UPPER_NA */
  598. }
  599. }
  600. ,
  601. {
  602. /* Default passive channel table is empty */
  603. COUNTRY_CODE_NULL, 0,
  604. {
  605. {81, BAND_2G4, CHNL_SPAN_5, 1, 0, 0}
  606. , /* CH_SET_2G4_1_14_NA */
  607. {82, BAND_2G4, CHNL_SPAN_5, 14, 0, 0}
  608. ,
  609. {115, BAND_5G, CHNL_SPAN_20, 36, 0, 0}
  610. , /* CH_SET_UNII_LOW_NA */
  611. {118, BAND_5G, CHNL_SPAN_20, 52, 4, 0}
  612. , /* CH_SET_UNII_MID_52_64 */
  613. {121, BAND_5G, CHNL_SPAN_20, 100, 12, 0}
  614. , /* CH_SET_UNII_WW_100_144 */
  615. {125, BAND_5G, CHNL_SPAN_20, 149, 0, 0}
  616. , /* CH_SET_UNII_UPPER_NA */
  617. }
  618. }
  619. };
  620. SUBBAND_CHANNEL_T g_rRlmSubBand[] = {
  621. {BAND_2G4_LOWER_BOUND, BAND_2G4_UPPER_BOUND, 1, 0}
  622. , /* 2.4G */
  623. {UNII1_LOWER_BOUND, UNII1_UPPER_BOUND, 2, 0}
  624. , /* ch36,38,40,..,48 */
  625. {UNII2A_LOWER_BOUND, UNII2A_UPPER_BOUND, 2, 0}
  626. , /* ch52,54,56,..,64 */
  627. {UNII2C_LOWER_BOUND, UNII2C_UPPER_BOUND, 2, 0}
  628. , /* ch100,102,104,...,144 */
  629. {UNII3_LOWER_BOUND, UNII3_UPPER_BOUND, 2, 0}
  630. /* ch149,151,153,....,173 */
  631. };
  632. /*******************************************************************************
  633. * P R I V A T E D A T A
  634. ********************************************************************************
  635. */
  636. /*******************************************************************************
  637. * M A C R O S
  638. ********************************************************************************
  639. */
  640. /*******************************************************************************
  641. * F U N C T I O N D E C L A R A T I O N S
  642. ********************************************************************************
  643. */
  644. /*******************************************************************************
  645. * F U N C T I O N S
  646. ********************************************************************************
  647. */
  648. /*----------------------------------------------------------------------------*/
  649. /*!
  650. * \brief
  651. *
  652. * \param[in/out]
  653. *
  654. * \return none
  655. */
  656. /*----------------------------------------------------------------------------*/
  657. P_DOMAIN_INFO_ENTRY rlmDomainGetDomainInfo(P_ADAPTER_T prAdapter)
  658. {
  659. #define REG_DOMAIN_DEF_IDX 20 /* Default country domain */
  660. #define REG_DOMAIN_GROUP_NUM \
  661. (sizeof(arSupportedRegDomains) / sizeof(DOMAIN_INFO_ENTRY))
  662. P_DOMAIN_INFO_ENTRY prDomainInfo;
  663. P_REG_INFO_T prRegInfo;
  664. UINT_16 u2TargetCountryCode;
  665. UINT_16 i, j;
  666. ASSERT(prAdapter);
  667. if (prAdapter->prDomainInfo)
  668. return prAdapter->prDomainInfo;
  669. prRegInfo = &prAdapter->prGlueInfo->rRegInfo;
  670. DBGLOG(RLM, TRACE, "eRegChannelListMap=%d, u2CountryCode=0x%04x\n",
  671. prRegInfo->eRegChannelListMap,
  672. prAdapter->rWifiVar.rConnSettings.u2CountryCode);
  673. /*
  674. * Domain info can be specified by given idx of arSupportedRegDomains table,
  675. * customized, or searched by country code,
  676. * only one is set among these three methods in NVRAM.
  677. */
  678. if (prRegInfo->eRegChannelListMap == REG_CH_MAP_TBL_IDX &&
  679. prRegInfo->ucRegChannelListIndex < REG_DOMAIN_GROUP_NUM) {
  680. /* by given table idx */
  681. DBGLOG(RLM, TRACE, "ucRegChannelListIndex=%d\n", prRegInfo->ucRegChannelListIndex);
  682. prDomainInfo = &arSupportedRegDomains[prRegInfo->ucRegChannelListIndex];
  683. } else if (prRegInfo->eRegChannelListMap == REG_CH_MAP_CUSTOMIZED) {
  684. /* by customized */
  685. prDomainInfo = &prRegInfo->rDomainInfo;
  686. } else {
  687. /* by country code */
  688. u2TargetCountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
  689. for (i = 0; i < REG_DOMAIN_GROUP_NUM; i++) {
  690. prDomainInfo = &arSupportedRegDomains[i];
  691. if ((prDomainInfo->u4CountryNum && prDomainInfo->pu2CountryGroup) ||
  692. prDomainInfo->u4CountryNum == 0) {
  693. for (j = 0; j < prDomainInfo->u4CountryNum; j++) {
  694. if (prDomainInfo->pu2CountryGroup[j] == u2TargetCountryCode)
  695. break;
  696. }
  697. if (j < prDomainInfo->u4CountryNum)
  698. break; /* Found */
  699. }
  700. }
  701. /* If no matched country code, use the default country domain */
  702. if (i >= REG_DOMAIN_GROUP_NUM) {
  703. DBGLOG(RLM, INFO, "No matched country code, use the default country domain\n");
  704. prDomainInfo = &arSupportedRegDomains[REG_DOMAIN_DEF_IDX];
  705. }
  706. }
  707. prAdapter->prDomainInfo = prDomainInfo;
  708. return prDomainInfo;
  709. }
  710. /*----------------------------------------------------------------------------*/
  711. /*!
  712. * \brief
  713. *
  714. * \param[in/out] The input variable pointed by pucNumOfChannel is the max
  715. * arrary size. The return value indciates meaning list size.
  716. *
  717. * \return none
  718. */
  719. /*----------------------------------------------------------------------------*/
  720. VOID
  721. rlmDomainGetChnlList(P_ADAPTER_T prAdapter,
  722. ENUM_BAND_T eSpecificBand, BOOLEAN fgNoDfs,
  723. UINT_8 ucMaxChannelNum, PUINT_8 pucNumOfChannel, P_RF_CHANNEL_INFO_T paucChannelList)
  724. {
  725. UINT_8 i, j, ucNum;
  726. P_DOMAIN_SUBBAND_INFO prSubband;
  727. P_DOMAIN_INFO_ENTRY prDomainInfo;
  728. ASSERT(prAdapter);
  729. ASSERT(paucChannelList);
  730. ASSERT(pucNumOfChannel);
  731. prDomainInfo = rlmDomainGetDomainInfo(prAdapter);
  732. ASSERT(prDomainInfo);
  733. ucNum = 0;
  734. for (i = 0; i < MAX_SUBBAND_NUM; i++) {
  735. prSubband = &prDomainInfo->rSubBand[i];
  736. if (prSubband->ucBand == BAND_NULL || prSubband->ucBand >= BAND_NUM ||
  737. (prSubband->ucBand == BAND_5G && !prAdapter->fgEnable5GBand))
  738. continue;
  739. if (fgNoDfs == TRUE && prSubband->fgDfs == TRUE)
  740. continue;
  741. if (eSpecificBand == BAND_NULL || prSubband->ucBand == eSpecificBand) {
  742. for (j = 0; j < prSubband->ucNumChannels; j++) {
  743. if (ucNum >= ucMaxChannelNum)
  744. break;
  745. paucChannelList[ucNum].eBand = prSubband->ucBand;
  746. paucChannelList[ucNum].ucChannelNum =
  747. prSubband->ucFirstChannelNum + j * prSubband->ucChannelSpan;
  748. ucNum++;
  749. }
  750. }
  751. }
  752. *pucNumOfChannel = ucNum;
  753. }
  754. /*----------------------------------------------------------------------------*/
  755. /*!
  756. * @brief
  757. *
  758. * @param[in]
  759. *
  760. * @return (none)
  761. */
  762. /*----------------------------------------------------------------------------*/
  763. VOID rlmDomainSendCmd(P_ADAPTER_T prAdapter, BOOLEAN fgIsOid)
  764. {
  765. rlmDomainSendPassiveScanInfoCmd(prAdapter, fgIsOid);
  766. rlmDomainSendDomainInfoCmd(prAdapter, fgIsOid);
  767. #if CFG_SUPPORT_PWR_LIMIT_COUNTRY
  768. rlmDomainSendPwrLimitCmd(prAdapter);
  769. #endif
  770. }
  771. /*----------------------------------------------------------------------------*/
  772. /*!
  773. * @brief
  774. *
  775. * @param[in]
  776. *
  777. * @return (none)
  778. */
  779. /*----------------------------------------------------------------------------*/
  780. VOID rlmDomainSendDomainInfoCmd(P_ADAPTER_T prAdapter, BOOLEAN fgIsOid)
  781. {
  782. P_DOMAIN_INFO_ENTRY prDomainInfo;
  783. P_CMD_SET_DOMAIN_INFO_T prCmd;
  784. P_DOMAIN_SUBBAND_INFO prSubBand;
  785. UINT_8 i;
  786. prDomainInfo = rlmDomainGetDomainInfo(prAdapter);
  787. ASSERT(prDomainInfo);
  788. prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_DOMAIN_INFO_T));
  789. if (!prCmd) {
  790. DBGLOG(RLM, ERROR, "Alloc cmd buffer failed\n");
  791. return;
  792. }
  793. kalMemZero(prCmd, sizeof(CMD_SET_DOMAIN_INFO_T));
  794. prCmd->u2CountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
  795. prCmd->u2IsSetPassiveScan = 0;
  796. prCmd->uc2G4Bandwidth = prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode;
  797. prCmd->uc5GBandwidth = prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode;
  798. prCmd->aucReserved[0] = 0;
  799. prCmd->aucReserved[1] = 0;
  800. for (i = 0; i < MAX_SUBBAND_NUM; i++) {
  801. prSubBand = &prDomainInfo->rSubBand[i];
  802. prCmd->rSubBand[i].ucRegClass = prSubBand->ucRegClass;
  803. prCmd->rSubBand[i].ucBand = prSubBand->ucBand;
  804. if (prSubBand->ucBand != BAND_NULL && prSubBand->ucBand < BAND_NUM) {
  805. prCmd->rSubBand[i].ucChannelSpan = prSubBand->ucChannelSpan;
  806. prCmd->rSubBand[i].ucFirstChannelNum = prSubBand->ucFirstChannelNum;
  807. prCmd->rSubBand[i].ucNumChannels = prSubBand->ucNumChannels;
  808. }
  809. }
  810. /* Set domain info to chip */
  811. wlanSendSetQueryCmd(prAdapter, /* prAdapter */
  812. CMD_ID_SET_DOMAIN_INFO, /* ucCID */
  813. TRUE, /* fgSetQuery */
  814. FALSE, /* fgNeedResp */
  815. fgIsOid, /* fgIsOid */
  816. NULL, /* pfCmdDoneHandler */
  817. NULL, /* pfCmdTimeoutHandler */
  818. sizeof(CMD_SET_DOMAIN_INFO_T), /* u4SetQueryInfoLen */
  819. (PUINT_8) prCmd, /* pucInfoBuffer */
  820. NULL, /* pvSetQueryBuffer */
  821. 0 /* u4SetQueryBufferLen */
  822. );
  823. cnmMemFree(prAdapter, prCmd);
  824. }
  825. /*----------------------------------------------------------------------------*/
  826. /*!
  827. * @brief
  828. *
  829. * @param[in]
  830. *
  831. * @return (none)
  832. */
  833. /*----------------------------------------------------------------------------*/
  834. VOID rlmDomainSendPassiveScanInfoCmd(P_ADAPTER_T prAdapter, BOOLEAN fgIsOid)
  835. {
  836. #define REG_DOMAIN_PASSIVE_DEF_IDX 1
  837. #define REG_DOMAIN_PASSIVE_GROUP_NUM \
  838. (sizeof(arSupportedRegDomains_Passive) / sizeof(DOMAIN_INFO_ENTRY))
  839. P_DOMAIN_INFO_ENTRY prDomainInfo;
  840. P_CMD_SET_DOMAIN_INFO_T prCmd;
  841. P_DOMAIN_SUBBAND_INFO prSubBand;
  842. UINT_16 u2TargetCountryCode;
  843. UINT_8 i, j;
  844. prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_DOMAIN_INFO_T));
  845. if (!prCmd) {
  846. DBGLOG(RLM, ERROR, "Alloc cmd buffer failed\n");
  847. return;
  848. }
  849. kalMemZero(prCmd, sizeof(CMD_SET_DOMAIN_INFO_T));
  850. prCmd->u2CountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
  851. prCmd->u2IsSetPassiveScan = 1;
  852. prCmd->uc2G4Bandwidth = prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode;
  853. prCmd->uc5GBandwidth = prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode;
  854. prCmd->aucReserved[0] = 0;
  855. prCmd->aucReserved[1] = 0;
  856. DBGLOG(RLM, TRACE, "u2CountryCode=0x%04x\n", prAdapter->rWifiVar.rConnSettings.u2CountryCode);
  857. u2TargetCountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
  858. for (i = 0; i < REG_DOMAIN_PASSIVE_GROUP_NUM; i++) {
  859. prDomainInfo = &arSupportedRegDomains_Passive[i];
  860. for (j = 0; j < prDomainInfo->u4CountryNum; j++) {
  861. if (prDomainInfo->pu2CountryGroup[j] == u2TargetCountryCode)
  862. break;
  863. }
  864. if (j < prDomainInfo->u4CountryNum)
  865. break; /* Found */
  866. }
  867. if (i >= REG_DOMAIN_PASSIVE_GROUP_NUM)
  868. prDomainInfo = &arSupportedRegDomains_Passive[REG_DOMAIN_PASSIVE_DEF_IDX];
  869. for (i = 0; i < MAX_SUBBAND_NUM; i++) {
  870. prSubBand = &prDomainInfo->rSubBand[i];
  871. prCmd->rSubBand[i].ucRegClass = prSubBand->ucRegClass;
  872. prCmd->rSubBand[i].ucBand = prSubBand->ucBand;
  873. if (prSubBand->ucBand != BAND_NULL && prSubBand->ucBand < BAND_NUM) {
  874. prCmd->rSubBand[i].ucChannelSpan = prSubBand->ucChannelSpan;
  875. prCmd->rSubBand[i].ucFirstChannelNum = prSubBand->ucFirstChannelNum;
  876. prCmd->rSubBand[i].ucNumChannels = prSubBand->ucNumChannels;
  877. }
  878. }
  879. /* Set passive scan channel info to chip */
  880. wlanSendSetQueryCmd(prAdapter, /* prAdapter */
  881. CMD_ID_SET_DOMAIN_INFO, /* ucCID */
  882. TRUE, /* fgSetQuery */
  883. FALSE, /* fgNeedResp */
  884. fgIsOid, /* fgIsOid */
  885. NULL, /* pfCmdDoneHandler */
  886. NULL, /* pfCmdTimeoutHandler */
  887. sizeof(CMD_SET_DOMAIN_INFO_T), /* u4SetQueryInfoLen */
  888. (PUINT_8) prCmd, /* pucInfoBuffer */
  889. NULL, /* pvSetQueryBuffer */
  890. 0 /* u4SetQueryBufferLen */
  891. );
  892. cnmMemFree(prAdapter, prCmd);
  893. }
  894. /*----------------------------------------------------------------------------*/
  895. /*!
  896. * \brief
  897. *
  898. * \param[in/out]
  899. *
  900. * \return TRUE Legal channel
  901. * FALSE Illegal channel for current regulatory domain
  902. */
  903. /*----------------------------------------------------------------------------*/
  904. BOOLEAN rlmDomainIsLegalChannel(P_ADAPTER_T prAdapter, ENUM_BAND_T eBand, UINT_8 ucChannel)
  905. {
  906. UINT_8 i, j;
  907. P_DOMAIN_SUBBAND_INFO prSubband;
  908. P_DOMAIN_INFO_ENTRY prDomainInfo;
  909. prDomainInfo = rlmDomainGetDomainInfo(prAdapter);
  910. ASSERT(prDomainInfo);
  911. for (i = 0; i < MAX_SUBBAND_NUM; i++) {
  912. prSubband = &prDomainInfo->rSubBand[i];
  913. if (prSubband->ucBand == BAND_5G && !prAdapter->fgEnable5GBand)
  914. continue;
  915. if (prSubband->ucBand == eBand) {
  916. for (j = 0; j < prSubband->ucNumChannels; j++) {
  917. if ((prSubband->ucFirstChannelNum + j * prSubband->ucChannelSpan)
  918. == ucChannel) {
  919. return TRUE;
  920. }
  921. }
  922. }
  923. }
  924. return FALSE;
  925. }
  926. /*----------------------------------------------------------------------------*/
  927. /*!
  928. * \brief
  929. *
  930. * \param[in/out]
  931. *
  932. * \return none
  933. */
  934. /*----------------------------------------------------------------------------*/
  935. UINT_32 rlmDomainSupOperatingClassIeFill(PUINT_8 pBuf)
  936. {
  937. /*
  938. The Country element should only be included for Status Code 0 (Successful).
  939. */
  940. UINT_32 u4IeLen;
  941. UINT_8 aucClass[12] = { 0x01, 0x02, 0x03, 0x05, 0x16, 0x17, 0x19, 0x1b,
  942. 0x1c, 0x1e, 0x20, 0x21
  943. };
  944. /*
  945. The Supported Operating Classes element is used by a STA to advertise the
  946. operating classes that it is capable of operating with in this country.
  947. The Country element (see 8.4.2.10) allows a STA to configure its PHY and MAC
  948. for operation when the operating triplet of Operating Extension Identifier,
  949. Operating Class, and Coverage Class fields is present.
  950. */
  951. SUP_OPERATING_CLASS_IE(pBuf)->ucId = ELEM_ID_SUP_OPERATING_CLASS;
  952. SUP_OPERATING_CLASS_IE(pBuf)->ucLength = 1 + sizeof(aucClass);
  953. SUP_OPERATING_CLASS_IE(pBuf)->ucCur = 0x0c; /* 0x51 */
  954. kalMemCopy(SUP_OPERATING_CLASS_IE(pBuf)->ucSup, aucClass, sizeof(aucClass));
  955. u4IeLen = (SUP_OPERATING_CLASS_IE(pBuf)->ucLength + 2);
  956. pBuf += u4IeLen;
  957. COUNTRY_IE(pBuf)->ucId = ELEM_ID_COUNTRY_INFO;
  958. COUNTRY_IE(pBuf)->ucLength = 6;
  959. COUNTRY_IE(pBuf)->aucCountryStr[0] = 0x55;
  960. COUNTRY_IE(pBuf)->aucCountryStr[1] = 0x53;
  961. COUNTRY_IE(pBuf)->aucCountryStr[2] = 0x20;
  962. COUNTRY_IE(pBuf)->arCountryStr[0].ucFirstChnlNum = 1;
  963. COUNTRY_IE(pBuf)->arCountryStr[0].ucNumOfChnl = 11;
  964. COUNTRY_IE(pBuf)->arCountryStr[0].cMaxTxPwrLv = 0x1e;
  965. u4IeLen += (COUNTRY_IE(pBuf)->ucLength + 2);
  966. return u4IeLen;
  967. }
  968. /*----------------------------------------------------------------------------*/
  969. /*!
  970. * @brief
  971. *
  972. * @param[in]
  973. *
  974. * @return (fgValid) : 0 -> inValid, 1 -> Valid
  975. */
  976. /*----------------------------------------------------------------------------*/
  977. BOOLEAN rlmDomainCheckChannelEntryValid(P_ADAPTER_T prAdapter, UINT_8 ucCentralCh)
  978. {
  979. BOOLEAN fgValid = FALSE;
  980. UINT_8 ucTemp = 0;
  981. UINT_8 i;
  982. /*Check Power limit table channel efficient or not */
  983. for (i = POWER_LIMIT_2G4; i < POWER_LIMIT_SUBAND_NUM; i++) {
  984. if ((ucCentralCh >= g_rRlmSubBand[i].ucStartCh) && (ucCentralCh <= g_rRlmSubBand[i].ucEndCh))
  985. ucTemp = (ucCentralCh - g_rRlmSubBand[i].ucStartCh) % g_rRlmSubBand[i].ucInterval;
  986. }
  987. #if 0
  988. /*2.4G, ex 1, 2, 3 */
  989. if (ucCentralCh >= BAND_2G4_LOWER_BOUND && ucCentralCh <= BAND_2G4_UPPER_BOUND)
  990. ucTemp = 0;
  991. /*FCC- Spec : Band UNII-1, ex 36, 38, 40.... */
  992. else if (ucCentralCh >= UNII1_LOWER_BOUND && ucCentralCh <= UNII1_UPPER_BOUND)
  993. ucTemp = (ucCentralCh - UNII1_LOWER_BOUND) % 2;
  994. /*FCC- Spec : Band UNII-2A, ex 52, 54, 56.... */
  995. else if (ucCentralCh >= UNII2A_LOWER_BOUND && ucCentralCh <= UNII2A_UPPER_BOUND)
  996. ucTemp = (ucCentralCh - UNII2A_LOWER_BOUND) % 2;
  997. /*FCC- Spec : Band UNII-2C, ex 100, 102, 104.... */
  998. else if (ucCentralCh >= UNII2C_LOWER_BOUND && ucCentralCh <= UNII2C_UPPER_BOUND)
  999. ucTemp = (ucCentralCh - UNII2C_LOWER_BOUND) % 2;
  1000. /*FCC- Spec : Band UNII-3, ex 149, 151, 153... */
  1001. else if (ucCentralCh >= UNII3_LOWER_BOUND && ucCentralCh <= UNII3_UPPER_BOUND)
  1002. ucTemp = (ucCentralCh - UNII3_LOWER_BOUND) % 2;
  1003. #endif
  1004. if (ucTemp == 0)
  1005. fgValid = TRUE;
  1006. return fgValid;
  1007. }
  1008. /*----------------------------------------------------------------------------*/
  1009. /*!
  1010. * \brief
  1011. *
  1012. * \param[in]
  1013. *
  1014. * \return
  1015. */
  1016. /*----------------------------------------------------------------------------*/
  1017. UINT_8 rlmDomainGetCenterChannel(ENUM_BAND_T eBand, UINT_8 ucPriChannel, ENUM_CHNL_EXT_T eExtend)
  1018. {
  1019. UINT_8 ucCenterChannel;
  1020. if (eExtend == CHNL_EXT_SCA)
  1021. ucCenterChannel = ucPriChannel + 2;
  1022. else if (eExtend == CHNL_EXT_SCB)
  1023. ucCenterChannel = ucPriChannel - 2;
  1024. else
  1025. ucCenterChannel = ucPriChannel;
  1026. return ucCenterChannel;
  1027. }
  1028. /*----------------------------------------------------------------------------*/
  1029. /*!
  1030. * \brief
  1031. *
  1032. * \param[in]
  1033. *
  1034. * \return
  1035. */
  1036. /*----------------------------------------------------------------------------*/
  1037. BOOLEAN
  1038. rlmDomainIsValidRfSetting(P_ADAPTER_T prAdapter,
  1039. ENUM_BAND_T eBand,
  1040. UINT_8 ucPriChannel,
  1041. ENUM_CHNL_EXT_T eExtend,
  1042. ENUM_CHANNEL_WIDTH_T eChannelWidth, UINT_8 ucChannelS1, UINT_8 ucChannelS2)
  1043. {
  1044. UINT_8 ucCenterChannel;
  1045. UINT_8 ucUpperChannel;
  1046. UINT_8 ucLowerChannel;
  1047. BOOLEAN fgValidChannel = TRUE;
  1048. BOOLEAN fgUpperChannel = TRUE;
  1049. BOOLEAN fgLowerChannel = TRUE;
  1050. BOOLEAN fgValidBW = TRUE;
  1051. BOOLEAN fgValidRfSetting = TRUE;
  1052. UINT_32 u4PrimaryOffset = 0;
  1053. /*DBG msg for Channel InValid */
  1054. if (eChannelWidth == CW_20_40MHZ) {
  1055. ucCenterChannel = rlmDomainGetCenterChannel(eBand, ucPriChannel, eExtend);
  1056. /* Check Central Channel Valid or Not */
  1057. fgValidChannel = rlmDomainCheckChannelEntryValid(prAdapter, ucCenterChannel);
  1058. /* Check Upper Channel and Lower Channel*/
  1059. switch (eExtend) {
  1060. case CHNL_EXT_SCA:
  1061. ucUpperChannel = ucPriChannel + 4;
  1062. ucLowerChannel = ucPriChannel;
  1063. break;
  1064. case CHNL_EXT_SCB:
  1065. ucUpperChannel = ucPriChannel;
  1066. ucLowerChannel = ucPriChannel - 4;
  1067. break;
  1068. default:
  1069. ucUpperChannel = ucPriChannel;
  1070. ucLowerChannel = ucPriChannel;
  1071. break;
  1072. }
  1073. fgUpperChannel = rlmDomainCheckChannelEntryValid(prAdapter, ucUpperChannel);
  1074. fgLowerChannel = rlmDomainCheckChannelEntryValid(prAdapter, ucLowerChannel);
  1075. } else if (eChannelWidth == CW_80MHZ) {
  1076. ucCenterChannel = ucChannelS1;
  1077. /* Check Central Channel Valid or Not */
  1078. fgValidChannel = rlmDomainCheckChannelEntryValid(prAdapter, ucCenterChannel);
  1079. if (fgValidChannel == FALSE)
  1080. DBGLOG(RLM, WARN, "Rf: CentralCh=%d\n", ucCenterChannel);
  1081. } else if (eChannelWidth == CW_160MHZ) {
  1082. ucCenterChannel = ucChannelS2;
  1083. /* Check Central Channel Valid or Not */
  1084. /*TODo */
  1085. }
  1086. /* Check BW Setting Correct or Not */
  1087. if (eBand == BAND_2G4) {
  1088. if (eChannelWidth != CW_20_40MHZ)
  1089. fgValidBW = FALSE;
  1090. } else {
  1091. if (eChannelWidth == CW_80MHZ) {
  1092. u4PrimaryOffset = CAL_CH_OFFSET_80M(ucPriChannel, ucCenterChannel);
  1093. if (u4PrimaryOffset > 4)
  1094. fgValidBW = FALSE;
  1095. } else if (eChannelWidth == CW_160MHZ) {
  1096. u4PrimaryOffset = CAL_CH_OFFSET_160M(ucPriChannel, ucCenterChannel);
  1097. if (u4PrimaryOffset > 8)
  1098. fgValidBW = FALSE;
  1099. } else if (eChannelWidth > CW_80P80MHZ)
  1100. fgValidBW = FALSE;
  1101. }
  1102. if (!fgValidBW || !fgValidChannel || !fgUpperChannel || !fgLowerChannel) {
  1103. DBGLOG(RLM, WARN,
  1104. "Rf: ValidBw=%d, ValidChnl=%d, UpChnl=%d, LowerChnl=%d, B=%d, W=%d, offset=%d\n",
  1105. fgValidBW, fgValidChannel, fgUpperChannel,
  1106. fgLowerChannel, eBand, eChannelWidth, u4PrimaryOffset);
  1107. fgValidRfSetting = FALSE;
  1108. }
  1109. return fgValidRfSetting;
  1110. }
  1111. #if CFG_SUPPORT_PWR_LIMIT_COUNTRY
  1112. /*----------------------------------------------------------------------------*/
  1113. /*!
  1114. * @brief
  1115. *
  1116. * @param[in]
  1117. *
  1118. * @return (fgValid) : 0 -> inValid, 1 -> Valid
  1119. */
  1120. /*----------------------------------------------------------------------------*/
  1121. BOOLEAN
  1122. rlmDomainCheckPowerLimitValid(P_ADAPTER_T prAdapter,
  1123. COUNTRY_POWER_LIMIT_TABLE_CONFIGURATION rPowerLimitTableConfiguration,
  1124. UINT_8 ucPwrLimitNum)
  1125. {
  1126. UINT_8 i;
  1127. BOOLEAN fgValid = TRUE;
  1128. PINT_8 prPwrLimit;
  1129. prPwrLimit = &rPowerLimitTableConfiguration.aucPwrLimit[0];
  1130. for (i = 0; i < ucPwrLimitNum; i++, prPwrLimit++) {
  1131. if (*prPwrLimit > MAX_TX_POWER || *prPwrLimit < MIN_TX_POWER) {
  1132. fgValid = FALSE;
  1133. break; /*Find out Wrong Power limit */
  1134. }
  1135. }
  1136. return fgValid;
  1137. }
  1138. /*----------------------------------------------------------------------------*/
  1139. /*!
  1140. * @brief
  1141. *
  1142. * @param[in]
  1143. *
  1144. * @return (none)
  1145. */
  1146. /*----------------------------------------------------------------------------*/
  1147. VOID rlmDomainCheckCountryPowerLimitTable(P_ADAPTER_T prAdapter)
  1148. {
  1149. UINT_8 i, j;
  1150. UINT_16 u2CountryCodeTable, u2CountryCodeCheck;
  1151. BOOLEAN fgChannelValid = FALSE;
  1152. BOOLEAN fgPowerLimitValid = FALSE;
  1153. BOOLEAN fgEntryRepetetion = FALSE;
  1154. BOOLEAN fgTableValid = TRUE;
  1155. /*Configuration Table Check */
  1156. for (i = 0; i < sizeof(g_rRlmPowerLimitConfiguration) / sizeof(COUNTRY_POWER_LIMIT_TABLE_CONFIGURATION); i++) {
  1157. /*Table Country Code */
  1158. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitConfiguration[i].aucCountryCode[0], &u2CountryCodeTable);
  1159. /*Repetition Entry Check */
  1160. for (j = i + 1;
  1161. j < sizeof(g_rRlmPowerLimitConfiguration) / sizeof(COUNTRY_POWER_LIMIT_TABLE_CONFIGURATION);
  1162. j++) {
  1163. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitConfiguration[j].aucCountryCode[0], &u2CountryCodeCheck);
  1164. if (((g_rRlmPowerLimitConfiguration[i].ucCentralCh) ==
  1165. g_rRlmPowerLimitConfiguration[j].ucCentralCh)
  1166. && (u2CountryCodeTable == u2CountryCodeCheck)) {
  1167. fgEntryRepetetion = TRUE;
  1168. DBGLOG(RLM, LOUD, "Domain: Configuration Repetition CC=%c%c, Ch=%d\n",
  1169. g_rRlmPowerLimitConfiguration[i].aucCountryCode[0],
  1170. g_rRlmPowerLimitConfiguration[i].aucCountryCode[1],
  1171. g_rRlmPowerLimitConfiguration[i].ucCentralCh);
  1172. }
  1173. }
  1174. /*Channel Number Check */
  1175. fgChannelValid =
  1176. rlmDomainCheckChannelEntryValid(prAdapter, g_rRlmPowerLimitConfiguration[i].ucCentralCh);
  1177. /*Power Limit Check */
  1178. fgPowerLimitValid =
  1179. rlmDomainCheckPowerLimitValid(prAdapter, g_rRlmPowerLimitConfiguration[i], PWR_LIMIT_NUM);
  1180. if (fgChannelValid == FALSE || fgPowerLimitValid == FALSE) {
  1181. fgTableValid = FALSE;
  1182. DBGLOG(RLM, LOUD, "Domain: CC=%c%c, Ch=%d, Limit: %d,%d,%d,%d,%d\n",
  1183. g_rRlmPowerLimitConfiguration[i].aucCountryCode[0],
  1184. g_rRlmPowerLimitConfiguration[i].aucCountryCode[1],
  1185. g_rRlmPowerLimitConfiguration[i].ucCentralCh,
  1186. g_rRlmPowerLimitConfiguration[i].aucPwrLimit[PWR_LIMIT_CCK],
  1187. g_rRlmPowerLimitConfiguration[i].aucPwrLimit[PWR_LIMIT_20M],
  1188. g_rRlmPowerLimitConfiguration[i].aucPwrLimit[PWR_LIMIT_40M],
  1189. g_rRlmPowerLimitConfiguration[i].aucPwrLimit[PWR_LIMIT_80M],
  1190. g_rRlmPowerLimitConfiguration[i].aucPwrLimit[PWR_LIMIT_160M]);
  1191. }
  1192. if (u2CountryCodeTable == COUNTRY_CODE_NULL) {
  1193. DBGLOG(RLM, LOUD, "Domain: Full search down\n");
  1194. break; /*End of country table entry */
  1195. }
  1196. }
  1197. if (fgEntryRepetetion == FALSE)
  1198. DBGLOG(RLM, TRACE, "Domain: Configuration Table no Repetiton.\n");
  1199. /*Configuration Table no error */
  1200. if (fgTableValid == TRUE)
  1201. prAdapter->fgIsPowerLimitTableValid = TRUE;
  1202. else
  1203. prAdapter->fgIsPowerLimitTableValid = FALSE;
  1204. /*Default Table Check */
  1205. fgEntryRepetetion = FALSE;
  1206. for (i = 0; i < sizeof(g_rRlmPowerLimitDefault) / sizeof(COUNTRY_POWER_LIMIT_TABLE_DEFAULT); i++) {
  1207. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitDefault[i].aucCountryCode[0], &u2CountryCodeTable);
  1208. for (j = i + 1; j < sizeof(g_rRlmPowerLimitDefault) / sizeof(COUNTRY_POWER_LIMIT_TABLE_DEFAULT); j++) {
  1209. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitDefault[j].aucCountryCode[0], &u2CountryCodeCheck);
  1210. if (u2CountryCodeTable == u2CountryCodeCheck) {
  1211. fgEntryRepetetion = TRUE;
  1212. DBGLOG(RLM, LOUD,
  1213. "Domain: Default Repetition CC=%c%c\n",
  1214. g_rRlmPowerLimitDefault[j].aucCountryCode[0],
  1215. g_rRlmPowerLimitDefault[j].aucCountryCode[1]);
  1216. }
  1217. }
  1218. }
  1219. if (fgEntryRepetetion == FALSE)
  1220. DBGLOG(RLM, TRACE, "Domain: Default Table no Repetiton.\n");
  1221. }
  1222. /*----------------------------------------------------------------------------*/
  1223. /*!
  1224. * @brief
  1225. *
  1226. * @param[in]
  1227. *
  1228. * @return (u2TableIndex) : if 0xFFFF -> No Table Match
  1229. */
  1230. /*----------------------------------------------------------------------------*/
  1231. UINT_16 rlmDomainPwrLimitDefaultTableDecision(P_ADAPTER_T prAdapter, UINT_16 u2CountryCode)
  1232. {
  1233. UINT_16 i;
  1234. UINT_16 u2CountryCodeTable = COUNTRY_CODE_NULL;
  1235. UINT_16 u2TableIndex = POWER_LIMIT_TABLE_NULL; /* No Table Match */
  1236. /*Default Table Index */
  1237. for (i = 0; i < sizeof(g_rRlmPowerLimitDefault) / sizeof(COUNTRY_POWER_LIMIT_TABLE_DEFAULT); i++) {
  1238. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitDefault[i].aucCountryCode[0], &u2CountryCodeTable);
  1239. if (u2CountryCodeTable == u2CountryCode) {
  1240. u2TableIndex = i;
  1241. break; /*match country code */
  1242. } else if (u2CountryCodeTable == COUNTRY_CODE_NULL) {
  1243. u2TableIndex = i;
  1244. break; /*find last one country- Default */
  1245. }
  1246. }
  1247. DBGLOG(RLM, TRACE, "Domain: Default Table Index = %d\n", u2TableIndex);
  1248. return u2TableIndex;
  1249. }
  1250. /*----------------------------------------------------------------------------*/
  1251. /*!
  1252. * @brief
  1253. *
  1254. * @param[in]
  1255. *
  1256. * @return (none)
  1257. */
  1258. /*----------------------------------------------------------------------------*/
  1259. VOID rlmDomainBuildCmdByDefaultTable(P_CMD_SET_COUNTRY_CHANNEL_POWER_LIMIT_T prCmd, UINT_16 u2DefaultTableIndex)
  1260. {
  1261. UINT_8 i, k;
  1262. P_COUNTRY_POWER_LIMIT_TABLE_DEFAULT prPwrLimitSubBand;
  1263. P_CMD_CHANNEL_POWER_LIMIT prCmdPwrLimit;
  1264. prCmdPwrLimit = &prCmd->rChannelPowerLimit[0];
  1265. prPwrLimitSubBand = &g_rRlmPowerLimitDefault[u2DefaultTableIndex];
  1266. /*Build power limit cmd by default table information */
  1267. for (i = POWER_LIMIT_2G4; i < POWER_LIMIT_SUBAND_NUM; i++) {
  1268. if (prPwrLimitSubBand->aucPwrLimitSubBand[i] < MAX_TX_POWER) {
  1269. for (k = g_rRlmSubBand[i].ucStartCh; k <= g_rRlmSubBand[i].ucEndCh;
  1270. k += g_rRlmSubBand[i].ucInterval) {
  1271. if ((prPwrLimitSubBand->ucPwrUnit & BIT(i)) == 0) {
  1272. prCmdPwrLimit->ucCentralCh = k;
  1273. kalMemSet(&prCmdPwrLimit->cPwrLimitCCK,
  1274. prPwrLimitSubBand->aucPwrLimitSubBand[i], PWR_LIMIT_NUM);
  1275. prCmdPwrLimit++;
  1276. prCmd->ucNum++;
  1277. } else {
  1278. /* ex: 40MHz power limit(mW\MHz) = 20MHz power limit(mW\MHz) * 2
  1279. * ---> 40MHz power limit(dBm) = 20MHz power limit(dBm) + 6; */
  1280. prCmdPwrLimit->ucCentralCh = k;
  1281. prCmdPwrLimit->cPwrLimitCCK = prPwrLimitSubBand->aucPwrLimitSubBand[i];
  1282. prCmdPwrLimit->cPwrLimit20 = prPwrLimitSubBand->aucPwrLimitSubBand[i];
  1283. prCmdPwrLimit->cPwrLimit40 = prPwrLimitSubBand->aucPwrLimitSubBand[i] + 6;
  1284. if (prCmdPwrLimit->cPwrLimit40 > MAX_TX_POWER)
  1285. prCmdPwrLimit->cPwrLimit40 = MAX_TX_POWER;
  1286. prCmdPwrLimit->cPwrLimit80 = prPwrLimitSubBand->aucPwrLimitSubBand[i] + 12;
  1287. if (prCmdPwrLimit->cPwrLimit80 > MAX_TX_POWER)
  1288. prCmdPwrLimit->cPwrLimit80 = MAX_TX_POWER;
  1289. prCmdPwrLimit->cPwrLimit160 = prPwrLimitSubBand->aucPwrLimitSubBand[i] + 18;
  1290. if (prCmdPwrLimit->cPwrLimit160 > MAX_TX_POWER)
  1291. prCmdPwrLimit->cPwrLimit160 = MAX_TX_POWER;
  1292. prCmdPwrLimit++;
  1293. prCmd->ucNum++;
  1294. }
  1295. }
  1296. }
  1297. }
  1298. #if 0
  1299. if (prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_2G4] < MAX_TX_POWER) {
  1300. for (i = BAND_2G4_LOWER_BOUND; i <= BAND_2G4_UPPER_BOUND; i++) {
  1301. prCmdPwrLimit->ucCentralCh = i;
  1302. kalMemSet(&prCmdPwrLimit->cPwrLimitCCK, prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_2G4],
  1303. PWR_LIMIT_NUM);
  1304. prCmdPwrLimit++;
  1305. prCmd->ucNum++;
  1306. }
  1307. }
  1308. if (prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII1] < MAX_TX_POWER) {
  1309. if (prCmd->u2CountryCode != COUNTRY_CODE_KR) {
  1310. for (i = UNII1_LOWER_BOUND; i <= UNII1_UPPER_BOUND; i += 2) {
  1311. prCmdPwrLimit->ucCentralCh = i;
  1312. kalMemSet(&prCmdPwrLimit->cPwrLimitCCK,
  1313. prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII1], PWR_LIMIT_NUM);
  1314. prCmdPwrLimit++;
  1315. prCmd->ucNum++;
  1316. }
  1317. } else {
  1318. for (i = UNII1_LOWER_BOUND; i <= UNII1_UPPER_BOUND; i += 2) {
  1319. /* ex: 40MHz power limit(mW\MHz) = 20MHz power limit(mW\MHz) * 2
  1320. * ---> 40MHz power limit(dBm) = 20MHz power limit(dBm) + 6; */
  1321. prCmdPwrLimit->ucCentralCh = i;
  1322. prCmdPwrLimit->cPwrLimitCCK =
  1323. g_rRlmPowerLimitDefault[u2DefaultTableIndex].cPwrLimitUnii1;
  1324. prCmdPwrLimit->cPwrLimit20 =
  1325. g_rRlmPowerLimitDefault[u2DefaultTableIndex].cPwrLimitUnii1;
  1326. prCmdPwrLimit->cPwrLimit40 =
  1327. g_rRlmPowerLimitDefault[u2DefaultTableIndex].cPwrLimitUnii1 + 6;
  1328. prCmdPwrLimit->cPwrLimit80 =
  1329. g_rRlmPowerLimitDefault[u2DefaultTableIndex].cPwrLimitUnii1 + 12;
  1330. prCmdPwrLimit->cPwrLimit160 =
  1331. g_rRlmPowerLimitDefault[u2DefaultTableIndex].cPwrLimitUnii1 + 18;
  1332. prCmdPwrLimit++;
  1333. prCmd->ucNum++;
  1334. }
  1335. }
  1336. }
  1337. if (prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII2A] < MAX_TX_POWER) {
  1338. for (i = UNII2A_LOWER_BOUND; i <= UNII2A_UPPER_BOUND; i += 2) {
  1339. prCmdPwrLimit->ucCentralCh = i;
  1340. kalMemSet(&prCmdPwrLimit->cPwrLimitCCK,
  1341. prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII2A], PWR_LIMIT_NUM);
  1342. prCmdPwrLimit++;
  1343. prCmd->ucNum++;
  1344. }
  1345. }
  1346. if (prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII2C] < MAX_TX_POWER) {
  1347. for (i = UNII2C_LOWER_BOUND; i <= UNII2C_UPPER_BOUND; i += 2) {
  1348. prCmdPwrLimit->ucCentralCh = i;
  1349. kalMemSet(&prCmdPwrLimit->cPwrLimitCCK,
  1350. prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII2C], PWR_LIMIT_NUM);
  1351. prCmdPwrLimit++;
  1352. prCmd->ucNum++;
  1353. }
  1354. }
  1355. if (prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII3] < MAX_TX_POWER) {
  1356. for (i = UNII3_LOWER_BOUND; i <= UNII3_UPPER_BOUND; i += 2) {
  1357. prCmdPwrLimit->ucCentralCh = i;
  1358. kalMemSet(&prCmdPwrLimit->cPwrLimitCCK,
  1359. prPwrLimitSubBand->aucPwrLimitSubBand[POWER_LIMIT_UNII3], PWR_LIMIT_NUM);
  1360. prCmdPwrLimit++;
  1361. prCmd->ucNum++;
  1362. }
  1363. }
  1364. #endif
  1365. }
  1366. /*----------------------------------------------------------------------------*/
  1367. /*!
  1368. * @brief
  1369. *
  1370. * @param[in]
  1371. *
  1372. * @return (none)
  1373. */
  1374. /*----------------------------------------------------------------------------*/
  1375. VOID rlmDomainBuildCmdByConfigTable(P_ADAPTER_T prAdapter, P_CMD_SET_COUNTRY_CHANNEL_POWER_LIMIT_T prCmd)
  1376. {
  1377. UINT_8 i, k;
  1378. UINT_16 u2CountryCodeTable = COUNTRY_CODE_NULL;
  1379. P_CMD_CHANNEL_POWER_LIMIT prCmdPwrLimit;
  1380. BOOLEAN fgChannelValid;
  1381. /*Build power limit cmd by configuration table information */
  1382. for (i = 0; i < sizeof(g_rRlmPowerLimitConfiguration) / sizeof(COUNTRY_POWER_LIMIT_TABLE_CONFIGURATION); i++) {
  1383. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitConfiguration[i].aucCountryCode[0], &u2CountryCodeTable);
  1384. fgChannelValid =
  1385. rlmDomainCheckChannelEntryValid(prAdapter, g_rRlmPowerLimitConfiguration[i].ucCentralCh);
  1386. if (u2CountryCodeTable == COUNTRY_CODE_NULL) {
  1387. DBGLOG(RLM, TRACE, "Domain: full search configuration table done.\n");
  1388. break; /*end of configuration table */
  1389. } else if ((u2CountryCodeTable == prCmd->u2CountryCode) && (fgChannelValid == TRUE)) {
  1390. prCmdPwrLimit = &prCmd->rChannelPowerLimit[0];
  1391. if (prCmd->ucNum != 0) {
  1392. for (k = 0; k < prCmd->ucNum; k++) {
  1393. if (prCmdPwrLimit->ucCentralCh ==
  1394. g_rRlmPowerLimitConfiguration[i].ucCentralCh) {
  1395. /*Cmd setting (Default table information) and
  1396. Configuration table has repetition channel entry,
  1397. ex : Default table (ex: 2.4G, limit = 20dBm) --> ch1~14 limit =20dBm,
  1398. Configuration table (ex: ch1, limit = 22dBm) --> ch 1 = 22 dBm
  1399. Cmd final setting --> ch1 = 22dBm, ch12~14 = 20dBm
  1400. */
  1401. kalMemCopy(&prCmdPwrLimit->cPwrLimitCCK,
  1402. &g_rRlmPowerLimitConfiguration[i].aucPwrLimit,
  1403. PWR_LIMIT_NUM);
  1404. DBGLOG(RLM, LOUD,
  1405. "Domain: CC=%c%c,ConfigCh=%d,Limit=%d,%d,%d,%d,%d,Fg=%d\n",
  1406. ((prCmd->u2CountryCode & 0xff00) >> 8),
  1407. (prCmd->u2CountryCode & 0x00ff), prCmdPwrLimit->ucCentralCh,
  1408. prCmdPwrLimit->cPwrLimitCCK, prCmdPwrLimit->cPwrLimit20,
  1409. prCmdPwrLimit->cPwrLimit40, prCmdPwrLimit->cPwrLimit80,
  1410. prCmdPwrLimit->cPwrLimit160, prCmdPwrLimit->ucFlag);
  1411. break;
  1412. }
  1413. prCmdPwrLimit++;
  1414. }
  1415. if (k == prCmd->ucNum) {
  1416. /*Full search cmd (Default table setting) no match channey,
  1417. ex : Default table (ex: 2.4G, limit = 20dBm) --> ch1~14 limit =20dBm,
  1418. Configuration table (ex: ch36, limit = 22dBm) --> ch 36 = 22 dBm
  1419. Cmd final setting --> ch1~14 = 20dBm, ch36= 22dBm
  1420. */
  1421. kalMemCopy(&prCmdPwrLimit->cPwrLimitCCK,
  1422. &g_rRlmPowerLimitConfiguration[i].aucPwrLimit, PWR_LIMIT_NUM);
  1423. prCmd->ucNum++;
  1424. DBGLOG(RLM, LOUD,
  1425. "Domain: Full CC=%c%c,ConfigCh=%d,Limit=%d,%d,%d,%d,%d,Fg=%d\n",
  1426. ((prCmd->u2CountryCode & 0xff00) >> 8), (prCmd->u2CountryCode & 0x00ff),
  1427. prCmdPwrLimit->ucCentralCh, prCmdPwrLimit->cPwrLimitCCK,
  1428. prCmdPwrLimit->cPwrLimit20, prCmdPwrLimit->cPwrLimit40,
  1429. prCmdPwrLimit->cPwrLimit80, prCmdPwrLimit->cPwrLimit160,
  1430. prCmdPwrLimit->ucFlag);
  1431. }
  1432. } else {
  1433. /*Default table power limit value are 63--> cmd table no channel entry
  1434. ex : Default table (ex: 2.4G, limit = 63Bm) --> no channel entry in cmd,
  1435. Configuration table (ex: ch36, limit = 22dBm) --> ch 36 = 22 dBm
  1436. Cmd final setting --> ch36= 22dBm
  1437. */
  1438. prCmdPwrLimit->ucCentralCh = g_rRlmPowerLimitConfiguration[i].ucCentralCh;
  1439. kalMemCopy(&prCmdPwrLimit->cPwrLimitCCK, &g_rRlmPowerLimitConfiguration[i].aucPwrLimit,
  1440. PWR_LIMIT_NUM);
  1441. prCmd->ucNum++;
  1442. DBGLOG(RLM, LOUD, "Domain: Default table power limit value are 63.\n");
  1443. DBGLOG(RLM, LOUD, "Domain: CC=%c%c,ConfigCh=%d,Limit=%d,%d,%d,%d,%d,Fg=%d\n",
  1444. ((prCmd->u2CountryCode & 0xff00) >> 8),
  1445. (prCmd->u2CountryCode & 0x00ff), prCmdPwrLimit->ucCentralCh,
  1446. prCmdPwrLimit->cPwrLimitCCK, prCmdPwrLimit->cPwrLimit20,
  1447. prCmdPwrLimit->cPwrLimit40, prCmdPwrLimit->cPwrLimit80,
  1448. prCmdPwrLimit->cPwrLimit160, prCmdPwrLimit->ucFlag);
  1449. }
  1450. }
  1451. }
  1452. }
  1453. /*----------------------------------------------------------------------------*/
  1454. /*!
  1455. * @brief
  1456. *
  1457. * @param[in]
  1458. *
  1459. * @return (none)
  1460. */
  1461. /*----------------------------------------------------------------------------*/
  1462. VOID rlmDomainSendPwrLimitCmd(P_ADAPTER_T prAdapter)
  1463. {
  1464. P_CMD_SET_COUNTRY_CHANNEL_POWER_LIMIT_T prCmd;
  1465. UINT_8 i;
  1466. UINT_16 u2DefaultTableIndex;
  1467. UINT_32 u4SetCmdTableMaxSize;
  1468. UINT_32 u4SetQueryInfoLen;
  1469. P_CMD_CHANNEL_POWER_LIMIT prCmdPwrLimit; /* for print usage */
  1470. u4SetCmdTableMaxSize =
  1471. sizeof(CMD_SET_COUNTRY_CHANNEL_POWER_LIMIT_T) +
  1472. MAX_CMD_SUPPORT_CHANNEL_NUM * sizeof(CMD_CHANNEL_POWER_LIMIT);
  1473. prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, u4SetCmdTableMaxSize);
  1474. if (!prCmd) {
  1475. DBGLOG(RLM, ERROR, "Domain: no buf to send cmd\n");
  1476. return;
  1477. }
  1478. kalMemZero(prCmd, u4SetCmdTableMaxSize);
  1479. u2DefaultTableIndex =
  1480. rlmDomainPwrLimitDefaultTableDecision(prAdapter, prAdapter->rWifiVar.rConnSettings.u2CountryCode);
  1481. if (u2DefaultTableIndex != POWER_LIMIT_TABLE_NULL) {
  1482. WLAN_GET_FIELD_BE16(&g_rRlmPowerLimitDefault[u2DefaultTableIndex].aucCountryCode[0],
  1483. &prCmd->u2CountryCode);
  1484. prCmd->ucNum = 0;
  1485. if (prCmd->u2CountryCode != COUNTRY_CODE_NULL) {
  1486. /*Command - default table information */
  1487. rlmDomainBuildCmdByDefaultTable(prCmd, u2DefaultTableIndex);
  1488. /*Command - configuration table information */
  1489. rlmDomainBuildCmdByConfigTable(prAdapter, prCmd);
  1490. }
  1491. }
  1492. #if 0
  1493. u4SetCmdTableMaxSize =
  1494. sizeof(CMD_SET_COUNTRY_CHANNEL_POWER_LIMIT_T) +
  1495. MAX_CMD_SUPPORT_CHANNEL_NUM * sizeof(CMD_CHANNEL_POWER_LIMIT);
  1496. prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, u4SetCmdTableMaxSize);
  1497. ASSERT(prCmd);
  1498. /* To do: exception handle */
  1499. if (!prCmd) {
  1500. DBGLOG(RLM, ERROR, "Domain: no buf to send cmd\n");
  1501. return;
  1502. }
  1503. kalMemZero(prCmd, u4SetCmdTableMaxSize); /* TODO memzero */
  1504. if (u2TableIndex != POWER_LIMIT_TABLE_NULL && u2TableIndex < MAX_DEFAULT_TABLE_COUNTRY_NUM) {
  1505. prCmd->u2CountryCode = (((UINT_16) g_rRlmCountryPowerLimitTable[u2TableIndex].aucCountryCode[0]) << 8) |
  1506. (((UINT_16) g_rRlmCountryPowerLimitTable[u2TableIndex].aucCountryCode[1]) & BITS(0, 7));
  1507. prChPwrLimit = &g_rRlmCountryPowerLimitTable[u2TableIndex].rChannelPowerLimit[0];
  1508. prCmdPwrLimit = &prCmd->rChannelPowerLimit[0];
  1509. prCmd->ucNum = 0;
  1510. for (i = 0; i < MAX_CMD_SUPPORT_CHANNEL_NUM; i++) {
  1511. if (prChPwrLimit->ucCentralCh != ENDCH) {
  1512. /*Check Power limit table channel efficient or not */
  1513. fgChannelValid = rlmDomainCheckChannelEntryValid(prAdapter, prChPwrLimit->ucCentralCh);
  1514. /*Cmd set up */
  1515. if (fgChannelValid) {
  1516. kalMemCopy(prCmdPwrLimit, prChPwrLimit, sizeof(CMD_CHANNEL_POWER_LIMIT));
  1517. DBGLOG(RLM, INFO,
  1518. "Domain: ValidCh=%d,Limit=%d,%d,%d,%d,%d,Fg=%d\n",
  1519. prCmdPwrLimit->ucCentralCh, prCmdPwrLimit->cPwrLimitCCK,
  1520. prCmdPwrLimit->cPwrLimit20, prCmdPwrLimit->cPwrLimit40,
  1521. prCmdPwrLimit->cPwrLimit80, prCmdPwrLimit->cPwrLimit160,
  1522. prCmdPwrLimit->ucFlag);
  1523. prCmd->ucNum++;
  1524. prCmdPwrLimit++;
  1525. } else {
  1526. DBGLOG(RLM, INFO,
  1527. "Domain: Non-Ch=%d,Limit=%d,%d,%d,%d,%d,Fg=%d\n",
  1528. prChPwrLimit->ucCentralCh, prChPwrLimit->cPwrLimitCCK,
  1529. prChPwrLimit->cPwrLimit20, prChPwrLimit->cPwrLimit40,
  1530. prChPwrLimit->cPwrLimit80, prChPwrLimit->cPwrLimit160,
  1531. prChPwrLimit->ucFlag);
  1532. }
  1533. prChPwrLimit++;
  1534. } else {
  1535. /*End of the chanel entry */
  1536. break;
  1537. }
  1538. };
  1539. }
  1540. #endif
  1541. if (prCmd->u2CountryCode != 0) {
  1542. DBGLOG(RLM, INFO,
  1543. "Domain: ValidCC =%c%c, ChNum=%d\n", ((prCmd->u2CountryCode & 0xff00) >> 8),
  1544. (prCmd->u2CountryCode & 0x00ff), prCmd->ucNum);
  1545. } else {
  1546. DBGLOG(RLM, INFO, "Domain: ValidCC =0x%04x, ucNum=%d\n", prCmd->u2CountryCode, prCmd->ucNum);
  1547. }
  1548. prCmdPwrLimit = &prCmd->rChannelPowerLimit[0];
  1549. for (i = 0; i < prCmd->ucNum; i++) {
  1550. DBGLOG(RLM, TRACE, "Domain: Ch=%d,Limit=%d,%d,%d,%d,%d,Fg=%d\n", prCmdPwrLimit->ucCentralCh,
  1551. prCmdPwrLimit->cPwrLimitCCK, prCmdPwrLimit->cPwrLimit20, prCmdPwrLimit->cPwrLimit40,
  1552. prCmdPwrLimit->cPwrLimit80, prCmdPwrLimit->cPwrLimit160, prCmdPwrLimit->ucFlag);
  1553. prCmdPwrLimit++;
  1554. }
  1555. u4SetQueryInfoLen =
  1556. (sizeof(CMD_SET_COUNTRY_CHANNEL_POWER_LIMIT_T) + (prCmd->ucNum) * sizeof(CMD_CHANNEL_POWER_LIMIT));
  1557. /* Update domain info to chip */
  1558. if (prCmd->ucNum <= MAX_CMD_SUPPORT_CHANNEL_NUM) {
  1559. wlanSendSetQueryCmd(prAdapter, /* prAdapter */
  1560. CMD_ID_SET_COUNTRY_POWER_LIMIT, /* ucCID */
  1561. TRUE, /* fgSetQuery */
  1562. FALSE, /* fgNeedResp */
  1563. FALSE, /* fgIsOid */
  1564. NULL, /* pfCmdDoneHandler */
  1565. NULL, /* pfCmdTimeoutHandler */
  1566. u4SetQueryInfoLen, /* u4SetQueryInfoLen */
  1567. (PUINT_8) prCmd, /* pucInfoBuffer */
  1568. NULL, /* pvSetQueryBuffer */
  1569. 0 /* u4SetQueryBufferLen */
  1570. );
  1571. } else
  1572. DBGLOG(RLM, ERROR, "Domain: illegal power limit table");
  1573. cnmMemFree(prAdapter, prCmd);
  1574. }
  1575. #endif