rtw_mp_ioctl.c 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #define _RTW_MP_IOCTL_C_
  21. #include <drv_types.h>
  22. #include <rtw_mp_ioctl.h>
  23. #include "../hal/OUTSRC/odm_precomp.h"
  24. //**************** oid_rtl_seg_81_85 section start ****************
  25. NDIS_STATUS oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
  26. {
  27. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  28. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  29. _func_enter_;
  30. if (poid_par_priv->information_buf_len < sizeof(u8))
  31. return NDIS_STATUS_INVALID_LENGTH;
  32. if (poid_par_priv->type_of_oid == SET_OID) {
  33. Adapter->registrypriv.wireless_mode = *(u8*)poid_par_priv->information_buf;
  34. } else if (poid_par_priv->type_of_oid == QUERY_OID) {
  35. *(u8*)poid_par_priv->information_buf = Adapter->registrypriv.wireless_mode;
  36. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  37. RT_TRACE(_module_mp_, _drv_info_, ("-query Wireless Mode=%d\n", Adapter->registrypriv.wireless_mode));
  38. } else {
  39. status = NDIS_STATUS_NOT_ACCEPTED;
  40. }
  41. _func_exit_;
  42. return status;
  43. }
  44. //**************** oid_rtl_seg_81_87_80 section start ****************
  45. NDIS_STATUS oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv)
  46. {
  47. #ifdef PLATFORM_OS_XP
  48. _irqL oldirql;
  49. #endif
  50. struct bb_reg_param *pbbreg;
  51. u16 offset;
  52. u32 value;
  53. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  54. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  55. _func_enter_;
  56. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_write_bb_reg_hdl\n"));
  57. if (poid_par_priv->type_of_oid != SET_OID)
  58. return NDIS_STATUS_NOT_ACCEPTED;
  59. if (poid_par_priv->information_buf_len < sizeof(struct bb_reg_param))
  60. return NDIS_STATUS_INVALID_LENGTH;
  61. pbbreg = (struct bb_reg_param *)(poid_par_priv->information_buf);
  62. offset = (u16)(pbbreg->offset) & 0xFFF; //0ffset :0x800~0xfff
  63. if (offset < BB_REG_BASE_ADDR) offset |= BB_REG_BASE_ADDR;
  64. value = pbbreg->value;
  65. RT_TRACE(_module_mp_, _drv_notice_,
  66. ("oid_rt_pro_write_bb_reg_hdl: offset=0x%03X value=0x%08X\n",
  67. offset, value));
  68. _irqlevel_changed_(&oldirql, LOWER);
  69. write_bbreg(Adapter, offset, 0xFFFFFFFF, value);
  70. _irqlevel_changed_(&oldirql, RAISE);
  71. _func_exit_;
  72. return status;
  73. }
  74. //------------------------------------------------------------------------------
  75. NDIS_STATUS oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv)
  76. {
  77. #ifdef PLATFORM_OS_XP
  78. _irqL oldirql;
  79. #endif
  80. struct bb_reg_param *pbbreg;
  81. u16 offset;
  82. u32 value;
  83. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  84. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  85. _func_enter_;
  86. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_read_bb_reg_hdl\n"));
  87. if (poid_par_priv->type_of_oid != QUERY_OID)
  88. return NDIS_STATUS_NOT_ACCEPTED;
  89. if (poid_par_priv->information_buf_len < sizeof(struct bb_reg_param))
  90. return NDIS_STATUS_INVALID_LENGTH;
  91. pbbreg = (struct bb_reg_param *)(poid_par_priv->information_buf);
  92. offset = (u16)(pbbreg->offset) & 0xFFF; //0ffset :0x800~0xfff
  93. if (offset < BB_REG_BASE_ADDR) offset |= BB_REG_BASE_ADDR;
  94. _irqlevel_changed_(&oldirql, LOWER);
  95. value = read_bbreg(Adapter, offset, 0xFFFFFFFF);
  96. _irqlevel_changed_(&oldirql, RAISE);
  97. pbbreg->value = value;
  98. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  99. RT_TRACE(_module_mp_, _drv_notice_,
  100. ("-oid_rt_pro_read_bb_reg_hdl: offset=0x%03X value:0x%08X\n",
  101. offset, value));
  102. _func_exit_;
  103. return status;
  104. }
  105. //------------------------------------------------------------------------------
  106. NDIS_STATUS oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv)
  107. {
  108. #ifdef PLATFORM_OS_XP
  109. _irqL oldirql;
  110. #endif
  111. struct rf_reg_param *pbbreg;
  112. u8 path;
  113. u8 offset;
  114. u32 value;
  115. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  116. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  117. _func_enter_;
  118. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_write_rf_reg_hdl\n"));
  119. if (poid_par_priv->type_of_oid != SET_OID)
  120. return NDIS_STATUS_NOT_ACCEPTED;
  121. if (poid_par_priv->information_buf_len < sizeof(struct rf_reg_param))
  122. return NDIS_STATUS_INVALID_LENGTH;
  123. pbbreg = (struct rf_reg_param *)(poid_par_priv->information_buf);
  124. if (pbbreg->path >= MAX_RF_PATH_NUMS)
  125. return NDIS_STATUS_NOT_ACCEPTED;
  126. if (pbbreg->offset > 0xFF)
  127. return NDIS_STATUS_NOT_ACCEPTED;
  128. if (pbbreg->value > 0xFFFFF)
  129. return NDIS_STATUS_NOT_ACCEPTED;
  130. path = (u8)pbbreg->path;
  131. offset = (u8)pbbreg->offset;
  132. value = pbbreg->value;
  133. RT_TRACE(_module_mp_, _drv_notice_,
  134. ("oid_rt_pro_write_rf_reg_hdl: path=%d offset=0x%02X value=0x%05X\n",
  135. path, offset, value));
  136. _irqlevel_changed_(&oldirql, LOWER);
  137. write_rfreg(Adapter, path, offset, value);
  138. _irqlevel_changed_(&oldirql, RAISE);
  139. _func_exit_;
  140. return status;
  141. }
  142. //------------------------------------------------------------------------------
  143. NDIS_STATUS oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv)
  144. {
  145. #ifdef PLATFORM_OS_XP
  146. _irqL oldirql;
  147. #endif
  148. struct rf_reg_param *pbbreg;
  149. u8 path;
  150. u8 offset;
  151. u32 value;
  152. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  153. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  154. _func_enter_;
  155. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_read_rf_reg_hdl\n"));
  156. if (poid_par_priv->type_of_oid != QUERY_OID)
  157. return NDIS_STATUS_NOT_ACCEPTED;
  158. if (poid_par_priv->information_buf_len < sizeof(struct rf_reg_param))
  159. return NDIS_STATUS_INVALID_LENGTH;
  160. pbbreg = (struct rf_reg_param *)(poid_par_priv->information_buf);
  161. if (pbbreg->path >= MAX_RF_PATH_NUMS)
  162. return NDIS_STATUS_NOT_ACCEPTED;
  163. if (pbbreg->offset > 0xFF)
  164. return NDIS_STATUS_NOT_ACCEPTED;
  165. path = (u8)pbbreg->path;
  166. offset = (u8)pbbreg->offset;
  167. _irqlevel_changed_(&oldirql, LOWER);
  168. value = read_rfreg(Adapter, path, offset);
  169. _irqlevel_changed_(&oldirql, RAISE);
  170. pbbreg->value = value;
  171. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  172. RT_TRACE(_module_mp_, _drv_notice_,
  173. ("-oid_rt_pro_read_rf_reg_hdl: path=%d offset=0x%02X value=0x%05X\n",
  174. path, offset, value));
  175. _func_exit_;
  176. return status;
  177. }
  178. //**************** oid_rtl_seg_81_87_00 section end****************
  179. //------------------------------------------------------------------------------
  180. //**************** oid_rtl_seg_81_80_00 section start ****************
  181. //------------------------------------------------------------------------------
  182. NDIS_STATUS oid_rt_pro_set_data_rate_hdl(struct oid_par_priv *poid_par_priv)
  183. {
  184. #ifdef PLATFORM_OS_XP
  185. _irqL oldirql;
  186. #endif
  187. u32 ratevalue;//4
  188. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  189. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  190. _func_enter_;
  191. RT_TRACE(_module_mp_, _drv_notice_,
  192. ("+oid_rt_pro_set_data_rate_hdl\n"));
  193. if (poid_par_priv->type_of_oid != SET_OID)
  194. return NDIS_STATUS_NOT_ACCEPTED;
  195. if (poid_par_priv->information_buf_len != sizeof(u32))
  196. return NDIS_STATUS_INVALID_LENGTH;
  197. ratevalue = *((u32*)poid_par_priv->information_buf);//4
  198. RT_TRACE(_module_mp_, _drv_notice_,
  199. ("oid_rt_pro_set_data_rate_hdl: data rate idx=%d\n", ratevalue));
  200. if (ratevalue >= MPT_RATE_LAST)
  201. return NDIS_STATUS_INVALID_DATA;
  202. Adapter->mppriv.rateidx = ratevalue;
  203. _irqlevel_changed_(&oldirql, LOWER);
  204. SetDataRate(Adapter);
  205. _irqlevel_changed_(&oldirql, RAISE);
  206. _func_exit_;
  207. return status;
  208. }
  209. //------------------------------------------------------------------------------
  210. NDIS_STATUS oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv)
  211. {
  212. #ifdef PLATFORM_OS_XP
  213. _irqL oldirql;
  214. #endif
  215. u32 mode;
  216. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  217. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  218. _func_enter_;
  219. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_start_test_hdl\n"));
  220. if (Adapter->registrypriv.mp_mode == 0)
  221. return NDIS_STATUS_NOT_ACCEPTED;
  222. if (poid_par_priv->type_of_oid != SET_OID)
  223. return NDIS_STATUS_NOT_ACCEPTED;
  224. _irqlevel_changed_(&oldirql, LOWER);
  225. //IQCalibrateBcut(Adapter);
  226. mode = *((u32*)poid_par_priv->information_buf);
  227. Adapter->mppriv.mode = mode;// 1 for loopback
  228. if (mp_start_test(Adapter) == _FAIL) {
  229. status = NDIS_STATUS_NOT_ACCEPTED;
  230. goto exit;
  231. }
  232. exit:
  233. _irqlevel_changed_(&oldirql, RAISE);
  234. RT_TRACE(_module_mp_, _drv_notice_, ("-oid_rt_pro_start_test_hdl: mp_mode=%d\n", Adapter->mppriv.mode));
  235. _func_exit_;
  236. return status;
  237. }
  238. //------------------------------------------------------------------------------
  239. NDIS_STATUS oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv)
  240. {
  241. #ifdef PLATFORM_OS_XP
  242. _irqL oldirql;
  243. #endif
  244. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  245. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  246. _func_enter_;
  247. RT_TRACE(_module_mp_, _drv_notice_, ("+Set OID_RT_PRO_STOP_TEST\n"));
  248. if (poid_par_priv->type_of_oid != SET_OID)
  249. return NDIS_STATUS_NOT_ACCEPTED;
  250. _irqlevel_changed_(&oldirql, LOWER);
  251. mp_stop_test(Adapter);
  252. _irqlevel_changed_(&oldirql, RAISE);
  253. RT_TRACE(_module_mp_, _drv_notice_, ("-Set OID_RT_PRO_STOP_TEST\n"));
  254. _func_exit_;
  255. return status;
  256. }
  257. //------------------------------------------------------------------------------
  258. NDIS_STATUS oid_rt_pro_set_channel_direct_call_hdl(struct oid_par_priv *poid_par_priv)
  259. {
  260. #ifdef PLATFORM_OS_XP
  261. _irqL oldirql;
  262. #endif
  263. u32 Channel;
  264. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  265. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  266. _func_enter_;
  267. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_set_channel_direct_call_hdl\n"));
  268. if (poid_par_priv->information_buf_len != sizeof(u32))
  269. return NDIS_STATUS_INVALID_LENGTH;
  270. if (poid_par_priv->type_of_oid == QUERY_OID) {
  271. *((u32*)poid_par_priv->information_buf) = Adapter->mppriv.channel;
  272. return NDIS_STATUS_SUCCESS;
  273. }
  274. if (poid_par_priv->type_of_oid != SET_OID)
  275. return NDIS_STATUS_NOT_ACCEPTED;
  276. Channel = *((u32*)poid_par_priv->information_buf);
  277. RT_TRACE(_module_mp_, _drv_notice_, ("oid_rt_pro_set_channel_direct_call_hdl: Channel=%d\n", Channel));
  278. if (Channel > 14)
  279. return NDIS_STATUS_NOT_ACCEPTED;
  280. Adapter->mppriv.channel = Channel;
  281. _irqlevel_changed_(&oldirql, LOWER);
  282. SetChannel(Adapter);
  283. _irqlevel_changed_(&oldirql, RAISE);
  284. _func_exit_;
  285. return status;
  286. }
  287. //------------------------------------------------------------------------------
  288. NDIS_STATUS oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv)
  289. {
  290. #ifdef PLATFORM_OS_XP
  291. _irqL oldirql;
  292. #endif
  293. u16 bandwidth;
  294. u16 channel_offset;
  295. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  296. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  297. _func_enter_;
  298. RT_TRACE(_module_mp_, _drv_info_,
  299. ("+oid_rt_set_bandwidth_hdl\n"));
  300. if (poid_par_priv->type_of_oid != SET_OID)
  301. return NDIS_STATUS_NOT_ACCEPTED;
  302. if (poid_par_priv->information_buf_len < sizeof(u32))
  303. return NDIS_STATUS_INVALID_LENGTH;
  304. bandwidth = *((u32*)poid_par_priv->information_buf);//4
  305. channel_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
  306. if (bandwidth != CHANNEL_WIDTH_40)
  307. bandwidth = CHANNEL_WIDTH_20;
  308. padapter->mppriv.bandwidth = (u8)bandwidth;
  309. padapter->mppriv.prime_channel_offset = (u8)channel_offset;
  310. _irqlevel_changed_(&oldirql, LOWER);
  311. SetBandwidth(padapter);
  312. _irqlevel_changed_(&oldirql, RAISE);
  313. RT_TRACE(_module_mp_, _drv_notice_,
  314. ("-oid_rt_set_bandwidth_hdl: bandwidth=%d channel_offset=%d\n",
  315. bandwidth, channel_offset));
  316. _func_exit_;
  317. return status;
  318. }
  319. //------------------------------------------------------------------------------
  320. NDIS_STATUS oid_rt_pro_set_antenna_bb_hdl(struct oid_par_priv *poid_par_priv)
  321. {
  322. #ifdef PLATFORM_OS_XP
  323. _irqL oldirql;
  324. #endif
  325. u32 antenna;
  326. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  327. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  328. _func_enter_;
  329. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_set_antenna_bb_hdl\n"));
  330. if (poid_par_priv->information_buf_len != sizeof(u32))
  331. return NDIS_STATUS_INVALID_LENGTH;
  332. if (poid_par_priv->type_of_oid == SET_OID)
  333. {
  334. antenna = *(u32*)poid_par_priv->information_buf;
  335. Adapter->mppriv.antenna_tx = (u16)((antenna & 0xFFFF0000) >> 16);
  336. Adapter->mppriv.antenna_rx = (u16)(antenna & 0x0000FFFF);
  337. RT_TRACE(_module_mp_, _drv_notice_,
  338. ("oid_rt_pro_set_antenna_bb_hdl: tx_ant=0x%04x rx_ant=0x%04x\n",
  339. Adapter->mppriv.antenna_tx, Adapter->mppriv.antenna_rx));
  340. _irqlevel_changed_(&oldirql, LOWER);
  341. SetAntenna(Adapter);
  342. _irqlevel_changed_(&oldirql, RAISE);
  343. } else {
  344. antenna = (Adapter->mppriv.antenna_tx << 16)|Adapter->mppriv.antenna_rx;
  345. *(u32*)poid_par_priv->information_buf = antenna;
  346. }
  347. _func_exit_;
  348. return status;
  349. }
  350. NDIS_STATUS oid_rt_pro_set_tx_power_control_hdl(struct oid_par_priv *poid_par_priv)
  351. {
  352. #ifdef PLATFORM_OS_XP
  353. _irqL oldirql;
  354. #endif
  355. u32 tx_pwr_idx;
  356. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  357. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  358. _func_enter_;
  359. RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_pro_set_tx_power_control_hdl\n"));
  360. if (poid_par_priv->type_of_oid != SET_OID)
  361. return NDIS_STATUS_NOT_ACCEPTED;
  362. if (poid_par_priv->information_buf_len != sizeof(u32))
  363. return NDIS_STATUS_INVALID_LENGTH;
  364. tx_pwr_idx = *((u32*)poid_par_priv->information_buf);
  365. if (tx_pwr_idx > MAX_TX_PWR_INDEX_N_MODE)
  366. return NDIS_STATUS_NOT_ACCEPTED;
  367. Adapter->mppriv.txpoweridx = (u8)tx_pwr_idx;
  368. RT_TRACE(_module_mp_, _drv_notice_,
  369. ("oid_rt_pro_set_tx_power_control_hdl: idx=0x%2x\n",
  370. Adapter->mppriv.txpoweridx));
  371. _irqlevel_changed_(&oldirql, LOWER);
  372. SetTxPower(Adapter);
  373. _irqlevel_changed_(&oldirql, RAISE);
  374. _func_exit_;
  375. return status;
  376. }
  377. //------------------------------------------------------------------------------
  378. //**************** oid_rtl_seg_81_80_20 section start ****************
  379. //------------------------------------------------------------------------------
  380. NDIS_STATUS oid_rt_pro_query_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv)
  381. {
  382. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  383. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  384. _func_enter_;
  385. if (poid_par_priv->type_of_oid !=QUERY_OID) {
  386. status = NDIS_STATUS_NOT_ACCEPTED;
  387. return status;
  388. }
  389. if (poid_par_priv->information_buf_len == sizeof(ULONG)) {
  390. *(ULONG*)poid_par_priv->information_buf = Adapter->mppriv.tx_pktcount;
  391. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  392. } else {
  393. status = NDIS_STATUS_INVALID_LENGTH;
  394. }
  395. _func_exit_;
  396. return status;
  397. }
  398. //------------------------------------------------------------------------------
  399. NDIS_STATUS oid_rt_pro_query_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv)
  400. {
  401. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  402. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  403. _func_enter_;
  404. if (poid_par_priv->type_of_oid != QUERY_OID) {
  405. status = NDIS_STATUS_NOT_ACCEPTED;
  406. return status;
  407. }
  408. RT_TRACE(_module_mp_, _drv_alert_, ("===> oid_rt_pro_query_rx_packet_received_hdl.\n"));
  409. if (poid_par_priv->information_buf_len == sizeof(ULONG)) {
  410. *(ULONG*)poid_par_priv->information_buf = Adapter->mppriv.rx_pktcount;
  411. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  412. RT_TRACE(_module_mp_, _drv_alert_, ("recv_ok:%d \n",Adapter->mppriv.rx_pktcount));
  413. } else {
  414. status = NDIS_STATUS_INVALID_LENGTH;
  415. }
  416. _func_exit_;
  417. return status;
  418. }
  419. //------------------------------------------------------------------------------
  420. NDIS_STATUS oid_rt_pro_query_rx_packet_crc32_error_hdl(struct oid_par_priv *poid_par_priv)
  421. {
  422. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  423. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  424. _func_enter_;
  425. if (poid_par_priv->type_of_oid != QUERY_OID) {
  426. status = NDIS_STATUS_NOT_ACCEPTED;
  427. return status;
  428. }
  429. RT_TRACE(_module_mp_, _drv_alert_, ("===> oid_rt_pro_query_rx_packet_crc32_error_hdl.\n"));
  430. if (poid_par_priv->information_buf_len == sizeof(ULONG)) {
  431. *(ULONG*)poid_par_priv->information_buf = Adapter->mppriv.rx_crcerrpktcount;
  432. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  433. RT_TRACE(_module_mp_, _drv_alert_, ("recv_err:%d \n",Adapter->mppriv.rx_crcerrpktcount));
  434. } else {
  435. status = NDIS_STATUS_INVALID_LENGTH;
  436. }
  437. _func_exit_;
  438. return status;
  439. }
  440. //------------------------------------------------------------------------------
  441. NDIS_STATUS oid_rt_pro_reset_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv)
  442. {
  443. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  444. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  445. _func_enter_;
  446. if (poid_par_priv->type_of_oid != SET_OID) {
  447. status = NDIS_STATUS_NOT_ACCEPTED;
  448. return status;
  449. }
  450. RT_TRACE(_module_mp_, _drv_alert_, ("===> oid_rt_pro_reset_tx_packet_sent_hdl.\n"));
  451. Adapter->mppriv.tx_pktcount = 0;
  452. _func_exit_;
  453. return status;
  454. }
  455. //------------------------------------------------------------------------------
  456. NDIS_STATUS oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv)
  457. {
  458. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  459. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  460. _func_enter_;
  461. if (poid_par_priv->type_of_oid != SET_OID)
  462. {
  463. status = NDIS_STATUS_NOT_ACCEPTED;
  464. return status;
  465. }
  466. if (poid_par_priv->information_buf_len == sizeof(ULONG)) {
  467. Adapter->mppriv.rx_pktcount = 0;
  468. Adapter->mppriv.rx_crcerrpktcount = 0;
  469. } else {
  470. status = NDIS_STATUS_INVALID_LENGTH;
  471. }
  472. _func_exit_;
  473. return status;
  474. }
  475. //------------------------------------------------------------------------------
  476. NDIS_STATUS oid_rt_reset_phy_rx_packet_count_hdl(struct oid_par_priv *poid_par_priv)
  477. {
  478. #ifdef PLATFORM_OS_XP
  479. _irqL oldirql;
  480. #endif
  481. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  482. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  483. _func_enter_;
  484. if (poid_par_priv->type_of_oid != SET_OID) {
  485. status = NDIS_STATUS_NOT_ACCEPTED;
  486. return status;
  487. }
  488. _irqlevel_changed_(&oldirql, LOWER);
  489. ResetPhyRxPktCount(Adapter);
  490. _irqlevel_changed_(&oldirql, RAISE);
  491. _func_exit_;
  492. return status;
  493. }
  494. //------------------------------------------------------------------------------
  495. NDIS_STATUS oid_rt_get_phy_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv)
  496. {
  497. #ifdef PLATFORM_OS_XP
  498. _irqL oldirql;
  499. #endif
  500. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  501. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  502. _func_enter_;
  503. RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_get_phy_rx_packet_received_hdl\n"));
  504. if (poid_par_priv->type_of_oid != QUERY_OID)
  505. return NDIS_STATUS_NOT_ACCEPTED;
  506. if (poid_par_priv->information_buf_len != sizeof(ULONG))
  507. return NDIS_STATUS_INVALID_LENGTH;
  508. _irqlevel_changed_(&oldirql, LOWER);
  509. *(ULONG*)poid_par_priv->information_buf = GetPhyRxPktReceived(Adapter);
  510. _irqlevel_changed_(&oldirql, RAISE);
  511. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  512. RT_TRACE(_module_mp_, _drv_notice_, ("-oid_rt_get_phy_rx_packet_received_hdl: recv_ok=%d\n", *(ULONG*)poid_par_priv->information_buf));
  513. _func_exit_;
  514. return status;
  515. }
  516. //------------------------------------------------------------------------------
  517. NDIS_STATUS oid_rt_get_phy_rx_packet_crc32_error_hdl(struct oid_par_priv *poid_par_priv)
  518. {
  519. #ifdef PLATFORM_OS_XP
  520. _irqL oldirql;
  521. #endif
  522. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  523. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  524. _func_enter_;
  525. RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_get_phy_rx_packet_crc32_error_hdl\n"));
  526. if (poid_par_priv->type_of_oid != QUERY_OID)
  527. return NDIS_STATUS_NOT_ACCEPTED;
  528. if (poid_par_priv->information_buf_len != sizeof(ULONG))
  529. return NDIS_STATUS_INVALID_LENGTH;
  530. _irqlevel_changed_(&oldirql, LOWER);
  531. *(ULONG*)poid_par_priv->information_buf = GetPhyRxPktCRC32Error(Adapter);
  532. _irqlevel_changed_(&oldirql, RAISE);
  533. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  534. RT_TRACE(_module_mp_, _drv_info_, ("-oid_rt_get_phy_rx_packet_crc32_error_hdl: recv_err=%d\n", *(ULONG*)poid_par_priv->information_buf));
  535. _func_exit_;
  536. return status;
  537. }
  538. //**************** oid_rtl_seg_81_80_20 section end ****************
  539. NDIS_STATUS oid_rt_pro_set_continuous_tx_hdl(struct oid_par_priv *poid_par_priv)
  540. {
  541. #ifdef PLATFORM_OS_XP
  542. _irqL oldirql;
  543. #endif
  544. u32 bStartTest;
  545. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  546. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  547. _func_enter_;
  548. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_set_continuous_tx_hdl\n"));
  549. if (poid_par_priv->type_of_oid != SET_OID)
  550. return NDIS_STATUS_NOT_ACCEPTED;
  551. bStartTest = *((u32*)poid_par_priv->information_buf);
  552. _irqlevel_changed_(&oldirql, LOWER);
  553. SetContinuousTx(Adapter,(u8)bStartTest);
  554. if (bStartTest) {
  555. struct mp_priv *pmp_priv = &Adapter->mppriv;
  556. if (pmp_priv->tx.stop == 0) {
  557. pmp_priv->tx.stop = 1;
  558. DBG_871X("%s: pkt tx is running...\n", __func__);
  559. rtw_msleep_os(5);
  560. }
  561. pmp_priv->tx.stop = 0;
  562. pmp_priv->tx.count = 1;
  563. SetPacketTx(Adapter);
  564. }
  565. _irqlevel_changed_(&oldirql, RAISE);
  566. _func_exit_;
  567. return status;
  568. }
  569. NDIS_STATUS oid_rt_pro_set_single_carrier_tx_hdl(struct oid_par_priv *poid_par_priv)
  570. {
  571. #ifdef PLATFORM_OS_XP
  572. _irqL oldirql;
  573. #endif
  574. u32 bStartTest;
  575. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  576. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  577. _func_enter_;
  578. RT_TRACE(_module_mp_, _drv_alert_, ("+oid_rt_pro_set_single_carrier_tx_hdl\n"));
  579. if (poid_par_priv->type_of_oid != SET_OID)
  580. return NDIS_STATUS_NOT_ACCEPTED;
  581. bStartTest = *((u32*)poid_par_priv->information_buf);
  582. _irqlevel_changed_(&oldirql, LOWER);
  583. SetSingleCarrierTx(Adapter, (u8)bStartTest);
  584. if (bStartTest) {
  585. struct mp_priv *pmp_priv = &Adapter->mppriv;
  586. if (pmp_priv->tx.stop == 0) {
  587. pmp_priv->tx.stop = 1;
  588. DBG_871X("%s: pkt tx is running...\n", __func__);
  589. rtw_msleep_os(5);
  590. }
  591. pmp_priv->tx.stop = 0;
  592. pmp_priv->tx.count = 1;
  593. SetPacketTx(Adapter);
  594. }
  595. _irqlevel_changed_(&oldirql, RAISE);
  596. _func_exit_;
  597. return status;
  598. }
  599. NDIS_STATUS oid_rt_pro_set_carrier_suppression_tx_hdl(struct oid_par_priv *poid_par_priv)
  600. {
  601. #ifdef PLATFORM_OS_XP
  602. _irqL oldirql;
  603. #endif
  604. u32 bStartTest;
  605. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  606. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  607. _func_enter_;
  608. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_set_carrier_suppression_tx_hdl\n"));
  609. if (poid_par_priv->type_of_oid != SET_OID)
  610. return NDIS_STATUS_NOT_ACCEPTED;
  611. bStartTest = *((u32*)poid_par_priv->information_buf);
  612. _irqlevel_changed_(&oldirql, LOWER);
  613. SetCarrierSuppressionTx(Adapter, (u8)bStartTest);
  614. if (bStartTest) {
  615. struct mp_priv *pmp_priv = &Adapter->mppriv;
  616. if (pmp_priv->tx.stop == 0) {
  617. pmp_priv->tx.stop = 1;
  618. DBG_871X("%s: pkt tx is running...\n", __func__);
  619. rtw_msleep_os(5);
  620. }
  621. pmp_priv->tx.stop = 0;
  622. pmp_priv->tx.count = 1;
  623. SetPacketTx(Adapter);
  624. }
  625. _irqlevel_changed_(&oldirql, RAISE);
  626. _func_exit_;
  627. return status;
  628. }
  629. NDIS_STATUS oid_rt_pro_set_single_tone_tx_hdl(struct oid_par_priv *poid_par_priv)
  630. {
  631. #ifdef PLATFORM_OS_XP
  632. _irqL oldirql;
  633. #endif
  634. u32 bStartTest;
  635. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  636. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  637. _func_enter_;
  638. RT_TRACE(_module_mp_, _drv_alert_, ("+oid_rt_pro_set_single_tone_tx_hdl\n"));
  639. if (poid_par_priv->type_of_oid != SET_OID)
  640. return NDIS_STATUS_NOT_ACCEPTED;
  641. bStartTest = *((u32*)poid_par_priv->information_buf);
  642. _irqlevel_changed_(&oldirql, LOWER);
  643. SetSingleToneTx(Adapter,(u8)bStartTest);
  644. _irqlevel_changed_(&oldirql, RAISE);
  645. _func_exit_;
  646. return status;
  647. }
  648. NDIS_STATUS oid_rt_pro_set_modulation_hdl(struct oid_par_priv* poid_par_priv)
  649. {
  650. return 0;
  651. }
  652. NDIS_STATUS oid_rt_pro_trigger_gpio_hdl(struct oid_par_priv *poid_par_priv)
  653. {
  654. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  655. #ifdef PLATFORM_OS_XP
  656. _irqL oldirql;
  657. #endif
  658. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  659. _func_enter_;
  660. if (poid_par_priv->type_of_oid != SET_OID)
  661. return NDIS_STATUS_NOT_ACCEPTED;
  662. _irqlevel_changed_(&oldirql, LOWER);
  663. rtw_hal_set_hwreg(Adapter, HW_VAR_TRIGGER_GPIO_0, 0);
  664. _irqlevel_changed_(&oldirql, RAISE);
  665. _func_exit_;
  666. return status;
  667. }
  668. //**************** oid_rtl_seg_81_80_00 section end ****************
  669. //------------------------------------------------------------------------------
  670. NDIS_STATUS oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv)
  671. {
  672. #if 0
  673. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  674. #ifdef PLATFORM_OS_XP
  675. _irqL oldirql;
  676. #endif
  677. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  678. PNDIS_802_11_SSID pssid;
  679. _func_enter_;
  680. if (poid_par_priv->type_of_oid != SET_OID)
  681. return NDIS_STATUS_NOT_ACCEPTED;
  682. *poid_par_priv->bytes_needed = (u32)sizeof(NDIS_802_11_SSID);
  683. *poid_par_priv->bytes_rw = 0;
  684. if (poid_par_priv->information_buf_len < *poid_par_priv->bytes_needed)
  685. return NDIS_STATUS_INVALID_LENGTH;
  686. pssid = (PNDIS_802_11_SSID)poid_par_priv->information_buf;
  687. _irqlevel_changed_(&oldirql, LOWER);
  688. if (mp_start_joinbss(Adapter, pssid) == _FAIL)
  689. status = NDIS_STATUS_NOT_ACCEPTED;
  690. _irqlevel_changed_(&oldirql, RAISE);
  691. *poid_par_priv->bytes_rw = sizeof(NDIS_802_11_SSID);
  692. _func_exit_;
  693. return status;
  694. #else
  695. return 0;
  696. #endif
  697. }
  698. //------------------------------------------------------------------------------
  699. NDIS_STATUS oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv)
  700. {
  701. #ifdef PLATFORM_OS_XP
  702. _irqL oldirql;
  703. #endif
  704. pRW_Reg RegRWStruct;
  705. u32 offset, width;
  706. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  707. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  708. _func_enter_;
  709. RT_TRACE(_module_mp_, _drv_info_,
  710. ("+oid_rt_pro_read_register_hdl\n"));
  711. if (poid_par_priv->type_of_oid != QUERY_OID)
  712. return NDIS_STATUS_NOT_ACCEPTED;
  713. RegRWStruct = (pRW_Reg)poid_par_priv->information_buf;
  714. offset = RegRWStruct->offset;
  715. width = RegRWStruct->width;
  716. if (offset > 0xFFF)
  717. return NDIS_STATUS_NOT_ACCEPTED;
  718. _irqlevel_changed_(&oldirql, LOWER);
  719. switch (width) {
  720. case 1:
  721. RegRWStruct->value = rtw_read8(Adapter, offset);
  722. break;
  723. case 2:
  724. RegRWStruct->value = rtw_read16(Adapter, offset);
  725. break;
  726. default:
  727. width = 4;
  728. RegRWStruct->value = rtw_read32(Adapter, offset);
  729. break;
  730. }
  731. RT_TRACE(_module_mp_, _drv_notice_,
  732. ("oid_rt_pro_read_register_hdl: offset:0x%04X value:0x%X\n",
  733. offset, RegRWStruct->value));
  734. _irqlevel_changed_(&oldirql, RAISE);
  735. *poid_par_priv->bytes_rw = width;
  736. _func_exit_;
  737. return status;
  738. }
  739. //------------------------------------------------------------------------------
  740. NDIS_STATUS oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv)
  741. {
  742. #ifdef PLATFORM_OS_XP
  743. _irqL oldirql;
  744. #endif
  745. pRW_Reg RegRWStruct;
  746. u32 offset, width, value;
  747. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  748. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  749. _func_enter_;
  750. RT_TRACE(_module_mp_, _drv_info_,
  751. ("+oid_rt_pro_write_register_hdl\n"));
  752. if (poid_par_priv->type_of_oid != SET_OID)
  753. return NDIS_STATUS_NOT_ACCEPTED;
  754. RegRWStruct = (pRW_Reg)poid_par_priv->information_buf;
  755. offset = RegRWStruct->offset;
  756. width = RegRWStruct->width;
  757. value = RegRWStruct->value;
  758. if (offset > 0xFFF)
  759. return NDIS_STATUS_NOT_ACCEPTED;
  760. _irqlevel_changed_(&oldirql, LOWER);
  761. switch (RegRWStruct->width)
  762. {
  763. case 1:
  764. if (value > 0xFF) {
  765. status = NDIS_STATUS_NOT_ACCEPTED;
  766. break;
  767. }
  768. rtw_write8(padapter, offset, (u8)value);
  769. break;
  770. case 2:
  771. if (value > 0xFFFF) {
  772. status = NDIS_STATUS_NOT_ACCEPTED;
  773. break;
  774. }
  775. rtw_write16(padapter, offset, (u16)value);
  776. break;
  777. case 4:
  778. rtw_write32(padapter, offset, value);
  779. break;
  780. default:
  781. status = NDIS_STATUS_NOT_ACCEPTED;
  782. break;
  783. }
  784. _irqlevel_changed_(&oldirql, RAISE);
  785. RT_TRACE(_module_mp_, _drv_info_,
  786. ("-oid_rt_pro_write_register_hdl: offset=0x%08X width=%d value=0x%X\n",
  787. offset, width, value));
  788. _func_exit_;
  789. return status;
  790. }
  791. //------------------------------------------------------------------------------
  792. NDIS_STATUS oid_rt_pro_burst_read_register_hdl(struct oid_par_priv *poid_par_priv)
  793. {
  794. #if 0
  795. #ifdef PLATFORM_OS_XP
  796. _irqL oldirql;
  797. #endif
  798. pBurst_RW_Reg pBstRwReg;
  799. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  800. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  801. _func_enter_;
  802. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_burst_read_register_hdl\n"));
  803. if (poid_par_priv->type_of_oid != QUERY_OID)
  804. return NDIS_STATUS_NOT_ACCEPTED;
  805. pBstRwReg = (pBurst_RW_Reg)poid_par_priv->information_buf;
  806. _irqlevel_changed_(&oldirql, LOWER);
  807. rtw_read_mem(padapter, pBstRwReg->offset, (u32)pBstRwReg->len, pBstRwReg->Data);
  808. _irqlevel_changed_(&oldirql, RAISE);
  809. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  810. RT_TRACE(_module_mp_, _drv_info_, ("-oid_rt_pro_burst_read_register_hdl\n"));
  811. _func_exit_;
  812. return status;
  813. #else
  814. return 0;
  815. #endif
  816. }
  817. //------------------------------------------------------------------------------
  818. NDIS_STATUS oid_rt_pro_burst_write_register_hdl(struct oid_par_priv *poid_par_priv)
  819. {
  820. #if 0
  821. #ifdef PLATFORM_OS_XP
  822. _irqL oldirql;
  823. #endif
  824. pBurst_RW_Reg pBstRwReg;
  825. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  826. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  827. _func_enter_;
  828. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_burst_write_register_hdl\n"));
  829. if (poid_par_priv->type_of_oid != SET_OID)
  830. return NDIS_STATUS_NOT_ACCEPTED;
  831. pBstRwReg = (pBurst_RW_Reg)poid_par_priv->information_buf;
  832. _irqlevel_changed_(&oldirql, LOWER);
  833. rtw_write_mem(padapter, pBstRwReg->offset, (u32)pBstRwReg->len, pBstRwReg->Data);
  834. _irqlevel_changed_(&oldirql, RAISE);
  835. RT_TRACE(_module_mp_, _drv_info_, ("-oid_rt_pro_burst_write_register_hdl\n"));
  836. _func_exit_;
  837. return status;
  838. #else
  839. return 0;
  840. #endif
  841. }
  842. //------------------------------------------------------------------------------
  843. NDIS_STATUS oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv)
  844. {
  845. #if 0
  846. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  847. PADAPTER Adapter = (PADAPTER)( poid_par_priv->adapter_context);
  848. #ifdef PLATFORM_OS_XP
  849. _irqL oldirql;
  850. #endif
  851. TX_CMD_Desc *TxCmd_Info;
  852. _func_enter_;
  853. if (poid_par_priv->type_of_oid != SET_OID)
  854. return NDIS_STATUS_NOT_ACCEPTED;
  855. RT_TRACE(_module_mp_, _drv_info_, ("+Set OID_RT_PRO_WRITE_TXCMD\n"));
  856. TxCmd_Info=(TX_CMD_Desc*)poid_par_priv->information_buf;
  857. RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:Addr=%.8X\n", TxCmd_Info->offset));
  858. RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:1.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[0]));
  859. RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:2.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[1]));
  860. RT_TRACE(_module_mp_, _drv_info_, (("WRITE_TXCMD:3.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[2]));
  861. RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:4.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[3]));
  862. _irqlevel_changed_(&oldirql, LOWER);
  863. rtw_write32(Adapter, TxCmd_Info->offset + 0, (unsigned int)TxCmd_Info->TxCMD.value[0]);
  864. rtw_write32(Adapter, TxCmd_Info->offset + 4, (unsigned int)TxCmd_Info->TxCMD.value[1]);
  865. _irqlevel_changed_(&oldirql, RAISE);
  866. RT_TRACE(_module_mp_, _drv_notice_,
  867. ("-Set OID_RT_PRO_WRITE_TXCMD: status=0x%08X\n", status));
  868. _func_exit_;
  869. return status;
  870. #else
  871. return 0;
  872. #endif
  873. }
  874. //------------------------------------------------------------------------------
  875. NDIS_STATUS oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv)
  876. {
  877. #if 0
  878. #ifdef PLATFORM_OS_XP
  879. _irqL oldirql;
  880. #endif
  881. pEEPROM_RWParam pEEPROM;
  882. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  883. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  884. _func_enter_;
  885. RT_TRACE(_module_mp_, _drv_info_, ("+Query OID_RT_PRO_READ16_EEPROM\n"));
  886. if (poid_par_priv->type_of_oid != QUERY_OID)
  887. return NDIS_STATUS_NOT_ACCEPTED;
  888. pEEPROM = (pEEPROM_RWParam)poid_par_priv->information_buf;
  889. _irqlevel_changed_(&oldirql, LOWER);
  890. pEEPROM->value = eeprom_read16(padapter, (u16)(pEEPROM->offset >> 1));
  891. _irqlevel_changed_(&oldirql, RAISE);
  892. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  893. RT_TRACE(_module_mp_, _drv_notice_,
  894. ("-Query OID_RT_PRO_READ16_EEPROM: offset=0x%x value=0x%x\n",
  895. pEEPROM->offset, pEEPROM->value));
  896. _func_exit_;
  897. return status;
  898. #else
  899. return 0;
  900. #endif
  901. }
  902. //------------------------------------------------------------------------------
  903. NDIS_STATUS oid_rt_pro_write16_eeprom_hdl (struct oid_par_priv *poid_par_priv)
  904. {
  905. #if 0
  906. #ifdef PLATFORM_OS_XP
  907. _irqL oldirql;
  908. #endif
  909. pEEPROM_RWParam pEEPROM;
  910. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  911. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  912. _func_enter_;
  913. RT_TRACE(_module_mp_, _drv_notice_, ("+Set OID_RT_PRO_WRITE16_EEPROM\n"));
  914. if (poid_par_priv->type_of_oid != SET_OID)
  915. return NDIS_STATUS_NOT_ACCEPTED;
  916. pEEPROM = (pEEPROM_RWParam)poid_par_priv->information_buf;
  917. _irqlevel_changed_(&oldirql, LOWER);
  918. eeprom_write16(padapter, (u16)(pEEPROM->offset >> 1), pEEPROM->value);
  919. _irqlevel_changed_(&oldirql, RAISE);
  920. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  921. _func_exit_;
  922. return status;
  923. #else
  924. return 0;
  925. #endif
  926. }
  927. //------------------------------------------------------------------------------
  928. NDIS_STATUS oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv)
  929. {
  930. #if 0
  931. PADAPTER Adapter = (PADAPTER)( poid_par_priv->adapter_context);
  932. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  933. struct mp_wiparam *pwi_param;
  934. _func_enter_;
  935. if (poid_par_priv->type_of_oid != QUERY_OID)
  936. return NDIS_STATUS_NOT_ACCEPTED;
  937. if (poid_par_priv->information_buf_len < sizeof(struct mp_wiparam))
  938. return NDIS_STATUS_INVALID_LENGTH;
  939. if (Adapter->mppriv.workparam.bcompleted == _FALSE)
  940. return NDIS_STATUS_NOT_ACCEPTED;
  941. pwi_param = (struct mp_wiparam *)poid_par_priv->information_buf;
  942. _rtw_memcpy(pwi_param, &Adapter->mppriv.workparam, sizeof(struct mp_wiparam));
  943. Adapter->mppriv.act_in_progress = _FALSE;
  944. // RT_TRACE(_module_mp_, _drv_info_, ("rf:%x\n", pwiparam->IoValue));
  945. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  946. _func_exit_;
  947. return status;
  948. #else
  949. return 0;
  950. #endif
  951. }
  952. //------------------------------------------------------------------------------
  953. NDIS_STATUS oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv)
  954. {
  955. #if 0
  956. PADAPTER Adapter = (PADAPTER)( poid_par_priv->adapter_context);
  957. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  958. _func_enter_;
  959. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro8711_pkt_loss_hdl\n"));
  960. if (poid_par_priv->type_of_oid != QUERY_OID)
  961. return NDIS_STATUS_NOT_ACCEPTED;
  962. if (poid_par_priv->information_buf_len < sizeof(uint)*2) {
  963. RT_TRACE(_module_mp_, _drv_err_, ("-oid_rt_pro8711_pkt_loss_hdl: buf_len=%d\n", (int)poid_par_priv->information_buf_len));
  964. return NDIS_STATUS_INVALID_LENGTH;
  965. }
  966. if (*(uint*)poid_par_priv->information_buf == 1)//init==1
  967. Adapter->mppriv.rx_pktloss = 0;
  968. *((uint*)poid_par_priv->information_buf+1) = Adapter->mppriv.rx_pktloss;
  969. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  970. _func_exit_;
  971. return status;
  972. #else
  973. return 0;
  974. #endif
  975. }
  976. //------------------------------------------------------------------------------
  977. NDIS_STATUS oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv)
  978. {
  979. #if 0
  980. PADAPTER Adapter = (PADAPTER)( poid_par_priv->adapter_context);
  981. struct io_queue *pio_queue = (struct io_queue *)Adapter->pio_queue;
  982. struct intf_hdl *pintfhdl = &pio_queue->intf;
  983. #ifdef PLATFORM_OS_XP
  984. _irqL oldirql;
  985. #endif
  986. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  987. #ifdef CONFIG_SDIO_HCI
  988. void (*_attrib_read)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
  989. #endif
  990. _func_enter_;
  991. RT_TRACE(_module_mp_, _drv_notice_, ("+Query OID_RT_RD_ATTRIB_MEM\n"));
  992. if (poid_par_priv->type_of_oid != QUERY_OID)
  993. return NDIS_STATUS_NOT_ACCEPTED;
  994. #ifdef CONFIG_SDIO_HCI
  995. _irqlevel_changed_(&oldirql, LOWER);
  996. {
  997. u32 *plmem = (u32*)poid_par_priv->information_buf+2;
  998. _attrib_read = pintfhdl->io_ops._attrib_read;
  999. _attrib_read(pintfhdl, *((u32*)poid_par_priv->information_buf),
  1000. *((u32*)poid_par_priv->information_buf+1), (u8*)plmem);
  1001. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1002. }
  1003. _irqlevel_changed_(&oldirql, RAISE);
  1004. #endif
  1005. _func_exit_;
  1006. return status;
  1007. #else
  1008. return 0;
  1009. #endif
  1010. }
  1011. //------------------------------------------------------------------------------
  1012. NDIS_STATUS oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv)
  1013. {
  1014. #if 0
  1015. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1016. struct io_queue *pio_queue = (struct io_queue *)Adapter->pio_queue;
  1017. struct intf_hdl *pintfhdl = &pio_queue->intf;
  1018. #ifdef PLATFORM_OS_XP
  1019. _irqL oldirql;
  1020. #endif
  1021. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1022. #ifdef CONFIG_SDIO_HCI
  1023. void (*_attrib_write)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
  1024. #endif
  1025. _func_enter_;
  1026. if (poid_par_priv->type_of_oid != SET_OID)
  1027. return NDIS_STATUS_NOT_ACCEPTED;
  1028. #ifdef CONFIG_SDIO_HCI
  1029. _irqlevel_changed_(&oldirql, LOWER);
  1030. {
  1031. u32 *plmem = (u32*)poid_par_priv->information_buf + 2;
  1032. _attrib_write = pintfhdl->io_ops._attrib_write;
  1033. _attrib_write(pintfhdl, *(u32*)poid_par_priv->information_buf,
  1034. *((u32*)poid_par_priv->information_buf+1), (u8*)plmem);
  1035. }
  1036. _irqlevel_changed_(&oldirql, RAISE);
  1037. #endif
  1038. _func_exit_;
  1039. return status;
  1040. #else
  1041. return 0;
  1042. #endif
  1043. }
  1044. //------------------------------------------------------------------------------
  1045. NDIS_STATUS oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv)
  1046. {
  1047. #if 0
  1048. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1049. #ifdef PLATFORM_OS_XP
  1050. _irqL oldirql;
  1051. #endif
  1052. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1053. _func_enter_;
  1054. RT_TRACE(_module_mp_, _drv_notice_, ("+OID_RT_PRO_SET_RF_INTFS\n"));
  1055. if (poid_par_priv->type_of_oid != SET_OID)
  1056. return NDIS_STATUS_NOT_ACCEPTED;
  1057. _irqlevel_changed_(&oldirql, LOWER);
  1058. if (rtw_setrfintfs_cmd(Adapter, *(unsigned char*)poid_par_priv->information_buf) == _FAIL)
  1059. status = NDIS_STATUS_NOT_ACCEPTED;
  1060. _irqlevel_changed_(&oldirql, RAISE);
  1061. _func_exit_;
  1062. return status;
  1063. #else
  1064. return 0;
  1065. #endif
  1066. }
  1067. //------------------------------------------------------------------------------
  1068. NDIS_STATUS oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv)
  1069. {
  1070. #if 0
  1071. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1072. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1073. _func_enter_;
  1074. if (poid_par_priv->type_of_oid != QUERY_OID)
  1075. return NDIS_STATUS_NOT_ACCEPTED;
  1076. _rtw_memcpy(poid_par_priv->information_buf, (unsigned char*)&Adapter->mppriv.rxstat, sizeof(struct recv_stat));
  1077. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1078. _func_exit_;
  1079. return status;
  1080. #else
  1081. return 0;
  1082. #endif
  1083. }
  1084. //------------------------------------------------------------------------------
  1085. NDIS_STATUS oid_rt_pro_cfg_debug_message_hdl(struct oid_par_priv *poid_par_priv)
  1086. {
  1087. #if 0
  1088. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1089. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1090. PCFG_DBG_MSG_STRUCT pdbg_msg;
  1091. _func_enter_;
  1092. // RT_TRACE(0xffffffffff,_drv_alert_,("===> oid_rt_pro_cfg_debug_message_hdl.\n"));
  1093. #if 0//#ifdef CONFIG_DEBUG_RTL871X
  1094. pdbg_msg = (PCFG_DBG_MSG_STRUCT)(poid_par_priv->information_buf);
  1095. if (poid_par_priv->type_of_oid == SET_OID) {
  1096. RT_TRACE(0xffffffffff, _drv_alert_,
  1097. ("===>Set level :0x%08x, H32:0x%08x L32:0x%08x\n",
  1098. pdbg_msg->DebugLevel, pdbg_msg->DebugComponent_H32, pdbg_msg->DebugComponent_L32));
  1099. GlobalDebugLevel = pdbg_msg->DebugLevel;
  1100. GlobalDebugComponents = (pdbg_msg->DebugComponent_H32 << 32) | pdbg_msg->DebugComponent_L32;
  1101. RT_TRACE(0xffffffffff, _drv_alert_,
  1102. ("===> Set level :0x%08x, component:0x%016x\n",
  1103. GlobalDebugLevel, (u32)GlobalDebugComponents));
  1104. } else {
  1105. pdbg_msg->DebugLevel = GlobalDebugLevel;
  1106. pdbg_msg->DebugComponent_H32 = (u32)(GlobalDebugComponents >> 32);
  1107. pdbg_msg->DebugComponent_L32 = (u32)GlobalDebugComponents;
  1108. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1109. RT_TRACE(0xffffffffff, _drv_alert_,
  1110. ("===>Query level:0x%08x H32:0x%08x L32:0x%08x\n",
  1111. (u32)pdbg_msg->DebugLevel, (u32)pdbg_msg->DebugComponent_H32, (u32)pdbg_msg->DebugComponent_L32));
  1112. }
  1113. #endif
  1114. _func_exit_;
  1115. return status;
  1116. #else
  1117. return 0;
  1118. #endif
  1119. }
  1120. //------------------------------------------------------------------------------
  1121. NDIS_STATUS oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv)
  1122. {
  1123. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1124. #ifdef PLATFORM_OS_XP
  1125. _irqL oldirql;
  1126. #endif
  1127. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1128. _func_enter_;
  1129. RT_TRACE(_module_mp_, _drv_notice_, ("+OID_RT_PRO_SET_DATA_RATE_EX\n"));
  1130. if (poid_par_priv->type_of_oid != SET_OID)
  1131. return NDIS_STATUS_NOT_ACCEPTED;
  1132. _irqlevel_changed_(&oldirql, LOWER);
  1133. if (rtw_setdatarate_cmd(Adapter, poid_par_priv->information_buf) !=_SUCCESS)
  1134. status = NDIS_STATUS_NOT_ACCEPTED;
  1135. _irqlevel_changed_(&oldirql, RAISE);
  1136. _func_exit_;
  1137. return status;
  1138. }
  1139. //-----------------------------------------------------------------------------
  1140. NDIS_STATUS oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv)
  1141. {
  1142. #ifdef PLATFORM_OS_XP
  1143. _irqL oldirql;
  1144. #endif
  1145. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1146. u8 thermal = 0;
  1147. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1148. _func_enter_;
  1149. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_get_thermal_meter_hdl\n"));
  1150. if (poid_par_priv->type_of_oid != QUERY_OID)
  1151. return NDIS_STATUS_NOT_ACCEPTED;
  1152. if (poid_par_priv->information_buf_len < sizeof(u32))
  1153. return NDIS_STATUS_INVALID_LENGTH;
  1154. _irqlevel_changed_(&oldirql, LOWER);
  1155. GetThermalMeter(Adapter, &thermal);
  1156. _irqlevel_changed_(&oldirql, RAISE);
  1157. *(u32*)poid_par_priv->information_buf = (u32)thermal;
  1158. *poid_par_priv->bytes_rw = sizeof(u32);
  1159. _func_exit_;
  1160. return status;
  1161. }
  1162. //-----------------------------------------------------------------------------
  1163. NDIS_STATUS oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv)
  1164. {
  1165. #if 0
  1166. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1167. #ifdef PLATFORM_OS_XP
  1168. _irqL oldirql;
  1169. #endif
  1170. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1171. _func_enter_;
  1172. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_read_tssi_hdl\n"));
  1173. if (poid_par_priv->type_of_oid != SET_OID)
  1174. return NDIS_STATUS_NOT_ACCEPTED;
  1175. if (Adapter->mppriv.act_in_progress == _TRUE)
  1176. return NDIS_STATUS_NOT_ACCEPTED;
  1177. if (poid_par_priv->information_buf_len < sizeof(u8))
  1178. return NDIS_STATUS_INVALID_LENGTH;
  1179. //init workparam
  1180. Adapter->mppriv.act_in_progress = _TRUE;
  1181. Adapter->mppriv.workparam.bcompleted = _FALSE;
  1182. Adapter->mppriv.workparam.act_type = MPT_READ_TSSI;
  1183. Adapter->mppriv.workparam.io_offset = 0;
  1184. Adapter->mppriv.workparam.io_value = 0xFFFFFFFF;
  1185. _irqlevel_changed_(&oldirql, LOWER);
  1186. if (!rtw_gettssi_cmd(Adapter,0, (u8*)&Adapter->mppriv.workparam.io_value))
  1187. status = NDIS_STATUS_NOT_ACCEPTED;
  1188. _irqlevel_changed_(&oldirql, RAISE);
  1189. _func_exit_;
  1190. return status;
  1191. #else
  1192. return 0;
  1193. #endif
  1194. }
  1195. //------------------------------------------------------------------------------
  1196. NDIS_STATUS oid_rt_pro_set_power_tracking_hdl(struct oid_par_priv *poid_par_priv)
  1197. {
  1198. #ifdef PLATFORM_OS_XP
  1199. _irqL oldirql;
  1200. #endif
  1201. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1202. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1203. _func_enter_;
  1204. // if (poid_par_priv->type_of_oid != SET_OID)
  1205. // return NDIS_STATUS_NOT_ACCEPTED;
  1206. if (poid_par_priv->information_buf_len < sizeof(u8))
  1207. return NDIS_STATUS_INVALID_LENGTH;
  1208. _irqlevel_changed_(&oldirql, LOWER);
  1209. if (poid_par_priv->type_of_oid == SET_OID) {
  1210. u8 enable;
  1211. enable = *(u8*)poid_par_priv->information_buf;
  1212. RT_TRACE(_module_mp_, _drv_notice_,
  1213. ("+oid_rt_pro_set_power_tracking_hdl: enable=%d\n", enable));
  1214. SetPowerTracking(Adapter, enable);
  1215. } else {
  1216. GetPowerTracking(Adapter, (u8*)poid_par_priv->information_buf);
  1217. }
  1218. _irqlevel_changed_(&oldirql, RAISE);
  1219. _func_exit_;
  1220. return status;
  1221. }
  1222. //-----------------------------------------------------------------------------
  1223. NDIS_STATUS oid_rt_pro_set_basic_rate_hdl(struct oid_par_priv *poid_par_priv)
  1224. {
  1225. #if 0
  1226. #ifdef PLATFORM_OS_XP
  1227. _irqL oldirql;
  1228. #endif
  1229. u32 ratevalue;
  1230. u8 datarates[NumRates];
  1231. int i;
  1232. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1233. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  1234. _func_enter_;
  1235. RT_TRACE(_module_mp_, _drv_info_, ("+OID_RT_PRO_SET_BASIC_RATE\n"));
  1236. if (poid_par_priv->type_of_oid != SET_OID)
  1237. return NDIS_STATUS_NOT_ACCEPTED;
  1238. #if 0
  1239. ratevalue = *((u32*)poid_par_priv->information_buf);
  1240. for (i = 0; i < NumRates; i++) {
  1241. if (ratevalue == mpdatarate[i])
  1242. datarates[i] = mpdatarate[i];
  1243. else
  1244. datarates[i] = 0xff;
  1245. RT_TRACE(_module_rtl871x_ioctl_c_, _drv_info_, ("basicrate_inx=%d\n", datarates[i]));
  1246. }
  1247. _irqlevel_changed_(&oldirql, LOWER);
  1248. if (rtw_setbasicrate_cmd(padapter, datarates) != _SUCCESS)
  1249. status = NDIS_STATUS_NOT_ACCEPTED;
  1250. _irqlevel_changed_(&oldirql, RAISE);
  1251. #endif
  1252. RT_TRACE(_module_mp_, _drv_notice_,
  1253. ("-OID_RT_PRO_SET_BASIC_RATE: status=0x%08X\n", status));
  1254. _func_exit_;
  1255. return status;
  1256. #else
  1257. return 0;
  1258. #endif
  1259. }
  1260. //------------------------------------------------------------------------------
  1261. NDIS_STATUS oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv)
  1262. {
  1263. #if 0
  1264. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1265. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1266. _func_enter_;
  1267. if (poid_par_priv->type_of_oid != QUERY_OID)
  1268. return NDIS_STATUS_NOT_ACCEPTED;
  1269. if (poid_par_priv->information_buf_len < 8)
  1270. return NDIS_STATUS_INVALID_LENGTH;
  1271. *poid_par_priv->bytes_rw = 8;
  1272. _rtw_memcpy(poid_par_priv->information_buf, &(Adapter->pwrctrlpriv.pwr_mode), 8);
  1273. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1274. RT_TRACE(_module_mp_, _drv_notice_,
  1275. ("-oid_rt_pro_qry_pwrstate_hdl: pwr_mode=%d smart_ps=%d\n",
  1276. Adapter->pwrctrlpriv.pwr_mode, Adapter->pwrctrlpriv.smart_ps));
  1277. _func_exit_;
  1278. return status;
  1279. #else
  1280. return 0;
  1281. #endif
  1282. }
  1283. //------------------------------------------------------------------------------
  1284. NDIS_STATUS oid_rt_pro_set_pwrstate_hdl(struct oid_par_priv *poid_par_priv)
  1285. {
  1286. #if 0
  1287. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1288. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1289. uint pwr_mode, smart_ps;
  1290. _func_enter_;
  1291. RT_TRACE(_module_mp_, _drv_notice_, ("+Set OID_RT_PRO_SET_PWRSTATE\n"));
  1292. if (poid_par_priv->type_of_oid != SET_OID)
  1293. return NDIS_STATUS_NOT_ACCEPTED;
  1294. *poid_par_priv->bytes_rw = 0;
  1295. *poid_par_priv->bytes_needed = 8;
  1296. if (poid_par_priv->information_buf_len < 8)
  1297. return NDIS_STATUS_INVALID_LENGTH;
  1298. pwr_mode = *(uint *)(poid_par_priv->information_buf);
  1299. smart_ps = *(uint *)((int)poid_par_priv->information_buf + 4);
  1300. *poid_par_priv->bytes_rw = 8;
  1301. _func_exit_;
  1302. return status;
  1303. #else
  1304. return 0;
  1305. #endif
  1306. }
  1307. //------------------------------------------------------------------------------
  1308. NDIS_STATUS oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv)
  1309. {
  1310. #if 0
  1311. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1312. #ifdef PLATFORM_OS_XP
  1313. _irqL oldirql;
  1314. #endif
  1315. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1316. struct setratable_parm *prate_table;
  1317. u8 res;
  1318. _func_enter_;
  1319. if (poid_par_priv->type_of_oid != SET_OID)
  1320. return NDIS_STATUS_NOT_ACCEPTED;
  1321. *poid_par_priv->bytes_needed = sizeof(struct setratable_parm);
  1322. if (poid_par_priv->information_buf_len < sizeof(struct setratable_parm))
  1323. return NDIS_STATUS_INVALID_LENGTH;
  1324. prate_table = (struct setratable_parm*)poid_par_priv->information_buf;
  1325. _irqlevel_changed_(&oldirql, LOWER);
  1326. res = rtw_setrttbl_cmd(Adapter, prate_table);
  1327. _irqlevel_changed_(&oldirql, RAISE);
  1328. if (res == _FAIL)
  1329. status = NDIS_STATUS_FAILURE;
  1330. _func_exit_;
  1331. return status;
  1332. #else
  1333. return 0;
  1334. #endif
  1335. }
  1336. //------------------------------------------------------------------------------
  1337. NDIS_STATUS oid_rt_pro_h2c_get_rate_table_hdl(struct oid_par_priv *poid_par_priv)
  1338. {
  1339. #if 0
  1340. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1341. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1342. _func_enter_;
  1343. if (poid_par_priv->type_of_oid != QUERY_OID)
  1344. return NDIS_STATUS_NOT_ACCEPTED;
  1345. #if 0
  1346. struct mp_wi_cntx *pmp_wi_cntx=&(Adapter->mppriv.wi_cntx);
  1347. u8 res=_SUCCESS;
  1348. DEBUG_INFO(("===> Set OID_RT_PRO_H2C_GET_RATE_TABLE.\n"));
  1349. if(pmp_wi_cntx->bmp_wi_progress ==_TRUE){
  1350. DEBUG_ERR(("\n mp workitem is progressing, not allow to set another workitem right now!!!\n"));
  1351. Status = NDIS_STATUS_NOT_ACCEPTED;
  1352. break;
  1353. }
  1354. else{
  1355. pmp_wi_cntx->bmp_wi_progress=_TRUE;
  1356. pmp_wi_cntx->param.bcompleted=_FALSE;
  1357. pmp_wi_cntx->param.act_type=MPT_GET_RATE_TABLE;
  1358. pmp_wi_cntx->param.io_offset=0x0;
  1359. pmp_wi_cntx->param.bytes_cnt=sizeof(struct getratable_rsp);
  1360. pmp_wi_cntx->param.io_value=0xffffffff;
  1361. res=rtw_getrttbl_cmd(Adapter,(struct getratable_rsp *)pmp_wi_cntx->param.data);
  1362. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1363. if(res != _SUCCESS)
  1364. {
  1365. Status = NDIS_STATUS_NOT_ACCEPTED;
  1366. }
  1367. }
  1368. DEBUG_INFO(("\n <=== Set OID_RT_PRO_H2C_GET_RATE_TABLE.\n"));
  1369. #endif
  1370. _func_exit_;
  1371. return status;
  1372. #else
  1373. return 0;
  1374. #endif
  1375. }
  1376. //**************** oid_rtl_seg_87_12_00 section start ****************
  1377. NDIS_STATUS oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv)
  1378. {
  1379. #if 0
  1380. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1381. struct security_priv *psecuritypriv = &Adapter->securitypriv;
  1382. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1383. ENCRY_CTRL_STATE encry_mode;
  1384. *poid_par_priv->bytes_needed = sizeof(u8);
  1385. if (poid_par_priv->information_buf_len < *poid_par_priv->bytes_needed)
  1386. return NDIS_STATUS_INVALID_LENGTH;
  1387. if (poid_par_priv->type_of_oid == SET_OID)
  1388. {
  1389. encry_mode = *((u8*)poid_par_priv->information_buf);
  1390. switch (encry_mode)
  1391. {
  1392. case HW_CONTROL:
  1393. #if 0
  1394. Adapter->registrypriv.software_decrypt=_FALSE;
  1395. Adapter->registrypriv.software_encrypt=_FALSE;
  1396. #else
  1397. psecuritypriv->sw_decrypt = _FALSE;
  1398. psecuritypriv->sw_encrypt = _FALSE;
  1399. #endif
  1400. break;
  1401. case SW_CONTROL:
  1402. #if 0
  1403. Adapter->registrypriv.software_decrypt=_TRUE;
  1404. Adapter->registrypriv.software_encrypt=_TRUE;
  1405. #else
  1406. psecuritypriv->sw_decrypt = _TRUE;
  1407. psecuritypriv->sw_encrypt = _TRUE;
  1408. #endif
  1409. break;
  1410. case HW_ENCRY_SW_DECRY:
  1411. #if 0
  1412. Adapter->registrypriv.software_decrypt=_TRUE;
  1413. Adapter->registrypriv.software_encrypt=_FALSE;
  1414. #else
  1415. psecuritypriv->sw_decrypt = _TRUE;
  1416. psecuritypriv->sw_encrypt = _FALSE;
  1417. #endif
  1418. break;
  1419. case SW_ENCRY_HW_DECRY:
  1420. #if 0
  1421. Adapter->registrypriv.software_decrypt=_FALSE;
  1422. Adapter->registrypriv.software_encrypt=_TRUE;
  1423. #else
  1424. psecuritypriv->sw_decrypt = _FALSE;
  1425. psecuritypriv->sw_encrypt = _TRUE;
  1426. #endif
  1427. break;
  1428. }
  1429. RT_TRACE(_module_rtl871x_ioctl_c_, _drv_notice_,
  1430. ("-oid_rt_pro_encryption_ctrl_hdl: SET encry_mode=0x%x sw_encrypt=0x%x sw_decrypt=0x%x\n",
  1431. encry_mode, psecuritypriv->sw_encrypt, psecuritypriv->sw_decrypt));
  1432. }
  1433. else {
  1434. #if 0
  1435. if (Adapter->registrypriv.software_encrypt == _FALSE) {
  1436. if (Adapter->registrypriv.software_decrypt == _FALSE)
  1437. encry_mode = HW_CONTROL;
  1438. else
  1439. encry_mode = HW_ENCRY_SW_DECRY;
  1440. }
  1441. else {
  1442. if (Adapter->registrypriv.software_decrypt == _FALSE)
  1443. encry_mode = SW_ENCRY_HW_DECRY;
  1444. else
  1445. encry_mode = SW_CONTROL;
  1446. }
  1447. #else
  1448. if ((psecuritypriv->sw_encrypt == _FALSE) && (psecuritypriv->sw_decrypt == _FALSE))
  1449. encry_mode = HW_CONTROL;
  1450. else if ((psecuritypriv->sw_encrypt == _FALSE) && (psecuritypriv->sw_decrypt == _TRUE))
  1451. encry_mode = HW_ENCRY_SW_DECRY;
  1452. else if ((psecuritypriv->sw_encrypt == _TRUE) && (psecuritypriv->sw_decrypt == _FALSE))
  1453. encry_mode = SW_ENCRY_HW_DECRY;
  1454. else if ((psecuritypriv->sw_encrypt == _TRUE) && (psecuritypriv->sw_decrypt == _TRUE))
  1455. encry_mode = SW_CONTROL;
  1456. #endif
  1457. *(u8*)poid_par_priv->information_buf = encry_mode;
  1458. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1459. RT_TRACE(_module_mp_, _drv_notice_,
  1460. ("-oid_rt_pro_encryption_ctrl_hdl: QUERY encry_mode=0x%x\n",
  1461. encry_mode));
  1462. }
  1463. return status;
  1464. #else
  1465. return 0;
  1466. #endif
  1467. }
  1468. //------------------------------------------------------------------------------
  1469. NDIS_STATUS oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv)
  1470. {
  1471. #if 0
  1472. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1473. #ifdef PLATFORM_OS_XP
  1474. _irqL oldirql;
  1475. #endif
  1476. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1477. struct sta_info *psta = NULL;
  1478. UCHAR *macaddr;
  1479. if (poid_par_priv->type_of_oid != SET_OID)
  1480. return NDIS_STATUS_NOT_ACCEPTED;
  1481. *poid_par_priv->bytes_needed = ETH_ALEN;
  1482. if (poid_par_priv->information_buf_len < *poid_par_priv->bytes_needed)
  1483. return NDIS_STATUS_INVALID_LENGTH;
  1484. macaddr = (UCHAR *) poid_par_priv->information_buf ;
  1485. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_notice_,
  1486. ("OID_RT_PRO_ADD_STA_INFO: addr="MAC_FMT"\n", MAC_ARG(macaddr) ));
  1487. _irqlevel_changed_(&oldirql, LOWER);
  1488. psta = rtw_get_stainfo(&Adapter->stapriv, macaddr);
  1489. if (psta == NULL) { // the sta have been in sta_info_queue => do nothing
  1490. psta = rtw_alloc_stainfo(&Adapter->stapriv, macaddr);
  1491. if (psta == NULL) {
  1492. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_err_,("Can't alloc sta_info when OID_RT_PRO_ADD_STA_INFO\n"));
  1493. status = NDIS_STATUS_FAILURE;
  1494. }
  1495. } else { //(between drv has received this event before and fw have not yet to set key to CAM_ENTRY)
  1496. RT_TRACE(_module_rtl871x_ioctl_c_, _drv_err_,
  1497. ("Error: OID_RT_PRO_ADD_STA_INFO: sta has been in sta_hash_queue \n"));
  1498. }
  1499. _irqlevel_changed_(&oldirql, RAISE);
  1500. return status;
  1501. #else
  1502. return 0;
  1503. #endif
  1504. }
  1505. //------------------------------------------------------------------------------
  1506. NDIS_STATUS oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv)
  1507. {
  1508. #if 0
  1509. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1510. #ifdef PLATFORM_OS_XP
  1511. _irqL oldirql;
  1512. #endif
  1513. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1514. struct sta_info *psta = NULL;
  1515. UCHAR *macaddr;
  1516. if (poid_par_priv->type_of_oid != SET_OID)
  1517. return NDIS_STATUS_NOT_ACCEPTED;
  1518. *poid_par_priv->bytes_needed = ETH_ALEN;
  1519. if (poid_par_priv->information_buf_len < *poid_par_priv->bytes_needed)
  1520. return NDIS_STATUS_INVALID_LENGTH;
  1521. macaddr = (UCHAR *) poid_par_priv->information_buf ;
  1522. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_notice_,
  1523. ("+OID_RT_PRO_ADD_STA_INFO: addr="MAC_FMT"\n", MAC_ARG(macaddr) ));
  1524. psta = rtw_get_stainfo(&Adapter->stapriv, macaddr);
  1525. if (psta != NULL) {
  1526. _enter_critical(&(Adapter->stapriv.sta_hash_lock), &irqL);
  1527. rtw_free_stainfo(Adapter, psta);
  1528. _exit_critical(&(Adapter->stapriv.sta_hash_lock), &irqL);
  1529. }
  1530. return status;
  1531. #else
  1532. return 0;
  1533. #endif
  1534. }
  1535. //------------------------------------------------------------------------------
  1536. #if 0
  1537. static u32 mp_query_drv_var(_adapter *padapter, u8 offset, u32 var)
  1538. {
  1539. #ifdef CONFIG_SDIO_HCI
  1540. if (offset == 1) {
  1541. u16 tmp_blk_num;
  1542. tmp_blk_num = rtw_read16(padapter, SDIO_RX0_RDYBLK_NUM);
  1543. RT_TRACE(_module_mp_, _drv_err_, ("Query Information, mp_query_drv_var SDIO_RX0_RDYBLK_NUM=0x%x dvobj.rxblknum=0x%x\n", tmp_blk_num, adapter_to_dvobj(padapter)->rxblknum));
  1544. if (adapter_to_dvobj(padapter)->rxblknum != tmp_blk_num) {
  1545. RT_TRACE(_module_mp_,_drv_err_, ("Query Information, mp_query_drv_var call recv rx\n"));
  1546. // sd_recv_rxfifo(padapter);
  1547. }
  1548. }
  1549. #if 0
  1550. if(offset <=100){ //For setting data rate and query data rate
  1551. if(offset==100){ //For query data rate
  1552. RT_TRACE(_module_mp_, _drv_emerg_, ("\n mp_query_drv_var: offset(%d): query rate=0x%.2x \n",offset,padapter->registrypriv.tx_rate));
  1553. var=padapter->registrypriv.tx_rate;
  1554. }
  1555. else if(offset<0x1d){ //For setting data rate
  1556. padapter->registrypriv.tx_rate=offset;
  1557. var=padapter->registrypriv.tx_rate;
  1558. padapter->registrypriv.use_rate=_TRUE;
  1559. RT_TRACE(_module_mp_, _drv_emerg_, ("\n mp_query_drv_var: offset(%d): set rate=0x%.2x \n",offset,padapter->registrypriv.tx_rate));
  1560. }
  1561. else{ //not use the data rate
  1562. padapter->registrypriv.use_rate=_FALSE;
  1563. RT_TRACE(_module_mp_, _drv_emerg_, ("\n mp_query_drv_var: offset(%d) out of rate range\n",offset));
  1564. }
  1565. }
  1566. else if (offset<=110){ //for setting debug level
  1567. RT_TRACE(_module_mp_, _drv_emerg_, (" mp_query_drv_var: offset(%d) for set debug level\n",offset));
  1568. if(offset==110){ //For query data rate
  1569. RT_TRACE(_module_mp_, _drv_emerg_, (" mp_query_drv_var: offset(%d): query dbg level=0x%.2x \n",offset,padapter->registrypriv.dbg_level));
  1570. padapter->registrypriv.dbg_level=GlobalDebugLevel;
  1571. var=padapter->registrypriv.dbg_level;
  1572. }
  1573. else if(offset<110 && offset>100){
  1574. RT_TRACE(_module_mp_, _drv_emerg_, (" mp_query_drv_var: offset(%d): set dbg level=0x%.2x \n",offset,offset-100));
  1575. padapter->registrypriv.dbg_level=GlobalDebugLevel=offset-100;
  1576. var=padapter->registrypriv.dbg_level;
  1577. RT_TRACE(_module_mp_, _drv_emerg_, (" mp_query_drv_var(_drv_emerg_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1578. RT_TRACE(_module_mp_, _drv_alert_, (" mp_query_drv_var(_drv_alert_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1579. RT_TRACE(_module_mp_, _drv_crit_, (" mp_query_drv_var(_drv_crit_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1580. RT_TRACE(_module_mp_, _drv_err_, (" mp_query_drv_var(_drv_err_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1581. RT_TRACE(_module_mp_, _drv_warning_, (" mp_query_drv_var(_drv_warning_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1582. RT_TRACE(_module_mp_, _drv_notice_, (" mp_query_drv_var(_drv_notice_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1583. RT_TRACE(_module_mp_, _drv_info_, (" mp_query_drv_var(_drv_info_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1584. RT_TRACE(_module_mp_, _drv_debug_, (" mp_query_drv_var(_drv_debug_): offset(%d): set dbg level=0x%.2x \n",offset,GlobalDebugLevel));
  1585. }
  1586. }
  1587. else if(offset >110 &&offset <116){
  1588. if(115==offset){
  1589. RT_TRACE(_module_mp_, _drv_emerg_, (" mp_query_drv_var(_drv_emerg_): offset(%d): query TRX access type: [tx_block_mode=%x,rx_block_mode=%x]\n",\
  1590. offset, adapter_to_dvobj(padapter)->tx_block_mode, adapter_to_dvobj(padapter)->rx_block_mode));
  1591. }
  1592. else {
  1593. switch(offset){
  1594. case 111:
  1595. adapter_to_dvobj(padapter)->tx_block_mode=1;
  1596. adapter_to_dvobj(padapter)->rx_block_mode=1;
  1597. RT_TRACE(_module_mp_, _drv_emerg_, \
  1598. (" mp_query_drv_var(_drv_emerg_): offset(%d): SET TRX access type:(TX block/RX block) [tx_block_mode=%x,rx_block_mode=%x]\n",\
  1599. offset, adapter_to_dvobj(padapter)->tx_block_mode, adapter_to_dvobj(padapter)->rx_block_mode));
  1600. break;
  1601. case 112:
  1602. adapter_to_dvobj(padapter)->tx_block_mode=1;
  1603. adapter_to_dvobj(padapter)->rx_block_mode=0;
  1604. RT_TRACE(_module_mp_, _drv_emerg_, \
  1605. (" mp_query_drv_var(_drv_emerg_): offset(%d): SET TRX access type:(TX block/RX byte) [tx_block_mode=%x,rx_block_mode=%x]\n",\
  1606. offset, adapter_to_dvobj(padapter)->tx_block_mode, adapter_to_dvobj(padapter)->rx_block_mode));
  1607. break;
  1608. case 113:
  1609. adapter_to_dvobj(padapter)->tx_block_mode=0;
  1610. adapter_to_dvobj(padapter)->rx_block_mode=1;
  1611. RT_TRACE(_module_mp_, _drv_emerg_, \
  1612. (" mp_query_drv_var(_drv_emerg_): offset(%d): SET TRX access type:(TX byte/RX block) [tx_block_mode=%x,rx_block_mode=%x]\n",\
  1613. offset, adapter_to_dvobj(padapter)->tx_block_mode, adapter_to_dvobj(padapter)->rx_block_mode));
  1614. break;
  1615. case 114:
  1616. adapter_to_dvobj(padapter)->tx_block_mode=0;
  1617. adapter_to_dvobj(padapter)->rx_block_mode=0;
  1618. RT_TRACE(_module_mp_, _drv_emerg_, \
  1619. (" mp_query_drv_var(_drv_emerg_): offset(%d): SET TRX access type:(TX byte/RX byte) [tx_block_mode=%x,rx_block_mode=%x]\n",\
  1620. offset, adapter_to_dvobj(padapter)->tx_block_mode, adapter_to_dvobj(padapter)->rx_block_mode));
  1621. break;
  1622. default :
  1623. break;
  1624. }
  1625. }
  1626. }
  1627. else if(offset>=127){
  1628. u64 prnt_dbg_comp;
  1629. u8 chg_idx;
  1630. u64 tmp_dbg_comp;
  1631. chg_idx=offset-0x80;
  1632. tmp_dbg_comp=BIT(chg_idx);
  1633. prnt_dbg_comp=padapter->registrypriv.dbg_component= GlobalDebugComponents;
  1634. RT_TRACE(_module_mp_, _drv_emerg_, (" 1: mp_query_drv_var: offset(%d;0x%x):for dbg conpoment prnt_dbg_comp=0x%.16x GlobalDebugComponents=0x%.16x padapter->registrypriv.dbg_component=0x%.16x\n",offset,offset,prnt_dbg_comp,GlobalDebugComponents,padapter->registrypriv.dbg_component));
  1635. if(offset==127){
  1636. // prnt_dbg_comp=padapter->registrypriv.dbg_component= GlobalDebugComponents;
  1637. var=(u32)(padapter->registrypriv.dbg_component);
  1638. RT_TRACE(0xffffffff, _drv_emerg_, ("2: mp_query_drv_var: offset(%d;0x%x):for query dbg conpoment=0x%x(l) 0x%x(h) GlobalDebugComponents=0x%x(l) 0x%x(h) \n",offset,offset,padapter->registrypriv.dbg_component,prnt_dbg_comp));
  1639. prnt_dbg_comp=GlobalDebugComponents;
  1640. RT_TRACE(0xffffffff, _drv_emerg_, ("2-1: mp_query_drv_var: offset(%d;0x%x):for query dbg conpoment=0x%x(l) 0x%x(h) GlobalDebugComponents=0x%x(l) 0x%x(h)\n",offset,offset,padapter->registrypriv.dbg_component,prnt_dbg_comp));
  1641. prnt_dbg_comp=GlobalDebugComponents=padapter->registrypriv.dbg_component;
  1642. RT_TRACE(0xffffffff, _drv_emerg_, ("2-2: mp_query_drv_var: offset(%d;0x%x):for query dbg conpoment=0x%x(l) 0x%x(h) GlobalDebugComponents=0x%x(l) 0x%x(h)\n",offset,offset,padapter->registrypriv.dbg_component,prnt_dbg_comp));
  1643. }
  1644. else{
  1645. RT_TRACE(0xffffffff, _drv_emerg_, ("3: mp_query_drv_var: offset(%d;0x%x):for query dbg conpoment=0x%x(l) 0x%x(h) GlobalDebugComponents=0x%x(l) 0x%x(h) chg_idx=%d\n",offset,offset,padapter->registrypriv.dbg_component,prnt_dbg_comp,chg_idx));
  1646. prnt_dbg_comp=GlobalDebugComponents;
  1647. RT_TRACE(0xffffffff, _drv_emerg_,("3-1: mp_query_drv_var: offset(%d;0x%x):for query dbg conpoment=0x%x(l) 0x%x(h) GlobalDebugComponents=0x%x(l) 0x%x(h) chg_idx=%d\n",offset,offset,padapter->registrypriv.dbg_component,prnt_dbg_comp,chg_idx));// ("3-1: mp_query_drv_var: offset(%d;0x%x):before set dbg conpoment=0x%x chg_idx=%d or0x%x BIT(chg_idx[%d]=0x%x)\n",offset,offset,prnt_dbg_comp,chg_idx,chg_idx,(chg_idx),tmp_dbg_comp)
  1648. prnt_dbg_comp=GlobalDebugComponents=padapter->registrypriv.dbg_component;
  1649. RT_TRACE(0xffffffff, _drv_emerg_, ("3-2: mp_query_drv_var: offset(%d;0x%x):for query dbg conpoment=0x%x(l) 0x%x(h) GlobalDebugComponents=0x%x(l) 0x%x(h)\n",offset,offset,padapter->registrypriv.dbg_component,prnt_dbg_comp));
  1650. if(GlobalDebugComponents&tmp_dbg_comp){
  1651. //this bit is already set, now clear it
  1652. GlobalDebugComponents=GlobalDebugComponents&(~tmp_dbg_comp);
  1653. }
  1654. else{
  1655. //this bit is not set, now set it.
  1656. GlobalDebugComponents =GlobalDebugComponents|tmp_dbg_comp;
  1657. }
  1658. RT_TRACE(0xffffffff, _drv_emerg_, ("4: mp_query_drv_var: offset(%d;0x%x):before set dbg conpoment tmp_dbg_comp=0x%x GlobalDebugComponents=0x%x(l) 0x%x(h)",offset,offset,tmp_dbg_comp,prnt_dbg_comp));
  1659. prnt_dbg_comp=GlobalDebugComponents;
  1660. RT_TRACE(0xffffffff, _drv_emerg_, ("4-1: mp_query_drv_var: offset(%d;0x%x):before set dbg conpoment tmp_dbg_comp=0x%x GlobalDebugComponents=0x%x(l) 0x%x(h)",offset,offset,tmp_dbg_comp,prnt_dbg_comp));
  1661. RT_TRACE(_module_rtl871x_xmit_c_, _drv_emerg_, ("0: mp_query_drv_var(_module_rtl871x_xmit_c_:0): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,prnt_dbg_comp));
  1662. RT_TRACE(_module_xmit_osdep_c_, _drv_emerg_, ("1: mp_query_drv_var(_module_xmit_osdep_c_:1): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1663. RT_TRACE(_module_rtl871x_recv_c_, _drv_emerg_, ("2: mp_query_drv_var(_module_rtl871x_recv_c_:2): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1664. RT_TRACE(_module_recv_osdep_c_, _drv_emerg_, ("3: mp_query_drv_var(_module_recv_osdep_c_:3): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1665. RT_TRACE(_module_rtl871x_mlme_c_, _drv_emerg_, ("4: mp_query_drv_var(_module_rtl871x_mlme_c_:4): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1666. RT_TRACE(_module_mlme_osdep_c_, _drv_emerg_, (" 5:mp_query_drv_var(_module_mlme_osdep_c_:5): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1667. RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_emerg_, ("6: mp_query_drv_var(_module_rtl871x_sta_mgt_c_:6): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1668. RT_TRACE(_module_rtl871x_cmd_c_, _drv_emerg_, ("7: mp_query_drv_var(_module_rtl871x_cmd_c_:7): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1669. RT_TRACE(_module_cmd_osdep_c_, _drv_emerg_, ("8: mp_query_drv_var(_module_cmd_osdep_c_:8): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1670. RT_TRACE(_module_rtl871x_io_c_, _drv_emerg_, ("9: mp_query_drv_var(_module_rtl871x_io_c_:9): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1671. RT_TRACE(_module_io_osdep_c_, _drv_emerg_, ("10: mp_query_drv_var(_module_io_osdep_c_:10): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1672. RT_TRACE(_module_os_intfs_c_, _drv_emerg_, ("11: mp_query_drv_var(_module_os_intfs_c_:11): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1673. RT_TRACE(_module_rtl871x_security_c_, _drv_emerg_, ("12: mp_query_drv_var(_module_rtl871x_security_c_:12): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1674. RT_TRACE(_module_rtl871x_eeprom_c_, _drv_emerg_, ("13: mp_query_drv_var(_module_rtl871x_eeprom_c_:13): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1675. RT_TRACE(_module_hal_init_c_, _drv_emerg_, ("14: mp_query_drv_var(_module_hal_init_c_:14): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1676. RT_TRACE(_module_hci_hal_init_c_, _drv_emerg_, ("15: mp_query_drv_var(_module_hci_hal_init_c_:15): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1677. RT_TRACE(_module_rtl871x_ioctl_c_, _drv_emerg_, ("16: mp_query_drv_var(_module_rtl871x_ioctl_c_:16): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1678. RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_emerg_, ("17: mp_query_drv_var(_module_rtl871x_ioctl_set_c_:17): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1679. RT_TRACE(_module_rtl871x_ioctl_query_c_, _drv_emerg_, ("18: mp_query_drv_var(_module_rtl871x_ioctl_query_c_:18): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1680. RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_emerg_, ("19: mp_query_drv_var(_module_rtl871x_pwrctrl_c_:19): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1681. RT_TRACE(_module_hci_intfs_c_, _drv_emerg_, ("20: mp_query_drv_var(_module_hci_intfs_c_:20): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1682. RT_TRACE(_module_hci_ops_c_, _drv_emerg_, ("21: mp_query_drv_var(_module_hci_ops_c_:21): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1683. RT_TRACE(_module_osdep_service_c_, _drv_emerg_, ("22: mp_query_drv_var(_module_osdep_service_c_:22): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1684. RT_TRACE(_module_mp_, _drv_emerg_, ("23: mp_query_drv_var(_module_mp_:23): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1685. RT_TRACE(_module_hci_ops_os_c_, _drv_emerg_, ("24: mp_query_drv_var(_module_hci_ops_os_c_:24): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1686. var=(u32)(GlobalDebugComponents);
  1687. //GlobalDebugComponents=padapter->registrypriv.dbg_component;
  1688. RT_TRACE(0xffffffff, _drv_emerg_, (" ==mp_query_drv_var(_module_mp_): offset(%d;0x%x):before set dbg conpoment=0x%x(l) 0x%x(h)\n",offset,offset,GlobalDebugComponents));
  1689. }
  1690. }
  1691. else{
  1692. RT_TRACE(_module_mp_, _drv_emerg_, ("\n mp_query_drv_var: offset(%d) >110\n",offset));
  1693. }
  1694. #endif
  1695. #endif
  1696. return var;
  1697. }
  1698. #endif
  1699. NDIS_STATUS oid_rt_pro_query_dr_variable_hdl(struct oid_par_priv *poid_par_priv)
  1700. {
  1701. #if 0
  1702. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1703. #ifdef PLATFORM_OS_XP
  1704. _irqL oldirql;
  1705. #endif
  1706. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1707. DR_VARIABLE_STRUCT *pdrv_var;
  1708. if (poid_par_priv->type_of_oid != QUERY_OID)
  1709. return NDIS_STATUS_NOT_ACCEPTED;
  1710. *poid_par_priv->bytes_needed = sizeof(DR_VARIABLE_STRUCT);
  1711. if (poid_par_priv->information_buf_len < *poid_par_priv->bytes_needed)
  1712. return NDIS_STATUS_INVALID_LENGTH;
  1713. RT_TRACE(_module_mp_, _drv_notice_, ("+Query Information, OID_RT_PRO_QUERY_DR_VARIABLE\n"));
  1714. pdrv_var = (struct _DR_VARIABLE_STRUCT_ *)poid_par_priv->information_buf;
  1715. _irqlevel_changed_(&oldirql, LOWER);
  1716. pdrv_var->variable = mp_query_drv_var(Adapter, pdrv_var->offset, pdrv_var->variable);
  1717. _irqlevel_changed_(&oldirql, RAISE);
  1718. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1719. RT_TRACE(_module_mp_, _drv_notice_,
  1720. ("-oid_rt_pro_query_dr_variable_hdl: offset=0x%x valule=0x%x\n",
  1721. pdrv_var->offset, pdrv_var->variable));
  1722. return status;
  1723. #else
  1724. return 0;
  1725. #endif
  1726. }
  1727. //------------------------------------------------------------------------------
  1728. NDIS_STATUS oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv)
  1729. {
  1730. #if 0
  1731. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1732. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1733. RT_TRACE(_module_mp_, _drv_err_, ("oid_rt_pro_rx_packet_type_hdl...................\n"));
  1734. if (poid_par_priv->information_buf_len < sizeof (UCHAR)) {
  1735. status = NDIS_STATUS_INVALID_LENGTH;
  1736. *poid_par_priv->bytes_needed = sizeof(UCHAR);
  1737. return status;
  1738. }
  1739. if (poid_par_priv->type_of_oid == SET_OID) {
  1740. Adapter->mppriv.rx_with_status = *(UCHAR *) poid_par_priv->information_buf;
  1741. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_err_, ("Query Information, OID_RT_PRO_RX_PACKET_TYPE:%d \n",\
  1742. Adapter->mppriv.rx_with_status));
  1743. //*(u32 *)&Adapter->eeprompriv.mac_addr[0]=rtw_read32(Adapter, 0x10250050);
  1744. //*(u16 *)&Adapter->eeprompriv.mac_addr[4]=rtw_read16(Adapter, 0x10250054);
  1745. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_err_,("MAC addr=0x%x:0x%x:0x%x:0x%x:0x%x:0x%x \n",
  1746. Adapter->eeprompriv.mac_addr[0],Adapter->eeprompriv.mac_addr[1],Adapter->eeprompriv.mac_addr[2],\
  1747. Adapter->eeprompriv.mac_addr[3],Adapter->eeprompriv.mac_addr[4],Adapter->eeprompriv.mac_addr[5]));
  1748. }
  1749. else {
  1750. *(UCHAR *) poid_par_priv->information_buf = Adapter->mppriv.rx_with_status;
  1751. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1752. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_err_, ("Query Information, OID_RT_PRO_RX_PACKET_TYPE:%d \n", \
  1753. Adapter->mppriv.rx_with_status));
  1754. //*(u32 *)&Adapter->eeprompriv.mac_addr[0]=rtw_read32(Adapter, 0x10250050);
  1755. //*(u16 *)&Adapter->eeprompriv.mac_addr[4]=rtw_read16(Adapter, 0x10250054);
  1756. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_err_,("MAC addr=0x%x:0x%x:0x%x:0x%x:0x%x:0x%x \n",
  1757. Adapter->eeprompriv.mac_addr[0],Adapter->eeprompriv.mac_addr[1],Adapter->eeprompriv.mac_addr[2],\
  1758. Adapter->eeprompriv.mac_addr[3],Adapter->eeprompriv.mac_addr[4],Adapter->eeprompriv.mac_addr[5]));
  1759. }
  1760. #endif
  1761. return NDIS_STATUS_SUCCESS;
  1762. }
  1763. //------------------------------------------------------------------------------
  1764. NDIS_STATUS oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv)
  1765. {
  1766. #ifdef PLATFORM_OS_XP
  1767. _irqL oldirql;
  1768. #endif
  1769. PEFUSE_ACCESS_STRUCT pefuse;
  1770. u8 *data;
  1771. u16 addr = 0, cnts = 0, max_available_size = 0;
  1772. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1773. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1774. _func_enter_;
  1775. if (poid_par_priv->type_of_oid != QUERY_OID)
  1776. return NDIS_STATUS_NOT_ACCEPTED;
  1777. if (poid_par_priv->information_buf_len < sizeof(EFUSE_ACCESS_STRUCT))
  1778. return NDIS_STATUS_INVALID_LENGTH;
  1779. pefuse = (PEFUSE_ACCESS_STRUCT)poid_par_priv->information_buf;
  1780. addr = pefuse->start_addr;
  1781. cnts = pefuse->cnts;
  1782. data = pefuse->data;
  1783. RT_TRACE(_module_mp_, _drv_notice_,
  1784. ("+oid_rt_pro_read_efuse_hd: buf_len=%d addr=%d cnts=%d\n",
  1785. poid_par_priv->information_buf_len, addr, cnts));
  1786. EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
  1787. if ((addr + cnts) > max_available_size) {
  1788. RT_TRACE(_module_mp_, _drv_err_, ("!oid_rt_pro_read_efuse_hdl: parameter error!\n"));
  1789. return NDIS_STATUS_NOT_ACCEPTED;
  1790. }
  1791. _irqlevel_changed_(&oldirql, LOWER);
  1792. if (rtw_efuse_access(Adapter, _FALSE, addr, cnts, data) == _FAIL) {
  1793. RT_TRACE(_module_mp_, _drv_err_, ("!oid_rt_pro_read_efuse_hdl: rtw_efuse_access FAIL!\n"));
  1794. status = NDIS_STATUS_FAILURE;
  1795. } else
  1796. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1797. _irqlevel_changed_(&oldirql, RAISE);
  1798. _func_exit_;
  1799. return status;
  1800. }
  1801. //------------------------------------------------------------------------------
  1802. NDIS_STATUS oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv)
  1803. {
  1804. #ifdef PLATFORM_OS_XP
  1805. _irqL oldirql;
  1806. #endif
  1807. PEFUSE_ACCESS_STRUCT pefuse;
  1808. u8 *data;
  1809. u16 addr = 0, cnts = 0, max_available_size = 0;
  1810. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1811. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1812. _func_enter_;
  1813. if (poid_par_priv->type_of_oid != SET_OID)
  1814. return NDIS_STATUS_NOT_ACCEPTED;
  1815. pefuse = (PEFUSE_ACCESS_STRUCT)poid_par_priv->information_buf;
  1816. addr = pefuse->start_addr;
  1817. cnts = pefuse->cnts;
  1818. data = pefuse->data;
  1819. RT_TRACE(_module_mp_, _drv_notice_,
  1820. ("+oid_rt_pro_write_efuse_hdl: buf_len=%d addr=0x%04x cnts=%d\n",
  1821. poid_par_priv->information_buf_len, addr, cnts));
  1822. EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
  1823. if ((addr + cnts) > max_available_size) {
  1824. RT_TRACE(_module_mp_, _drv_err_, ("!oid_rt_pro_write_efuse_hdl: parameter error"));
  1825. return NDIS_STATUS_NOT_ACCEPTED;
  1826. }
  1827. _irqlevel_changed_(&oldirql, LOWER);
  1828. if (rtw_efuse_access(Adapter, _TRUE, addr, cnts, data) == _FAIL)
  1829. status = NDIS_STATUS_FAILURE;
  1830. _irqlevel_changed_(&oldirql, RAISE);
  1831. _func_exit_;
  1832. return status;
  1833. }
  1834. //------------------------------------------------------------------------------
  1835. NDIS_STATUS oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv)
  1836. {
  1837. #ifdef PLATFORM_OS_XP
  1838. _irqL oldirql;
  1839. #endif
  1840. PPGPKT_STRUCT ppgpkt;
  1841. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1842. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1843. _func_enter_;
  1844. // RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_pro_rw_efuse_pgpkt_hdl\n"));
  1845. *poid_par_priv->bytes_rw = 0;
  1846. if (poid_par_priv->information_buf_len < sizeof(PGPKT_STRUCT))
  1847. return NDIS_STATUS_INVALID_LENGTH;
  1848. ppgpkt = (PPGPKT_STRUCT)poid_par_priv->information_buf;
  1849. _irqlevel_changed_(&oldirql, LOWER);
  1850. if (poid_par_priv->type_of_oid == QUERY_OID)
  1851. {
  1852. RT_TRACE(_module_mp_, _drv_notice_,
  1853. ("oid_rt_pro_rw_efuse_pgpkt_hdl: Read offset=0x%x\n",\
  1854. ppgpkt->offset));
  1855. Efuse_PowerSwitch(Adapter, _FALSE, _TRUE);
  1856. if (Efuse_PgPacketRead(Adapter, ppgpkt->offset, ppgpkt->data, _FALSE) == _TRUE)
  1857. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1858. else
  1859. status = NDIS_STATUS_FAILURE;
  1860. Efuse_PowerSwitch(Adapter, _FALSE, _FALSE);
  1861. } else {
  1862. RT_TRACE(_module_mp_, _drv_notice_,
  1863. ("oid_rt_pro_rw_efuse_pgpkt_hdl: Write offset=0x%x word_en=0x%x\n",\
  1864. ppgpkt->offset, ppgpkt->word_en));
  1865. Efuse_PowerSwitch(Adapter, _TRUE, _TRUE);
  1866. if (Efuse_PgPacketWrite(Adapter, ppgpkt->offset, ppgpkt->word_en, ppgpkt->data, _FALSE) == _TRUE)
  1867. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1868. else
  1869. status = NDIS_STATUS_FAILURE;
  1870. Efuse_PowerSwitch(Adapter, _TRUE, _FALSE);
  1871. }
  1872. _irqlevel_changed_(&oldirql, RAISE);
  1873. RT_TRACE(_module_mp_, _drv_info_,
  1874. ("-oid_rt_pro_rw_efuse_pgpkt_hdl: status=0x%08X\n", status));
  1875. _func_exit_;
  1876. return status;
  1877. }
  1878. //------------------------------------------------------------------------------
  1879. NDIS_STATUS oid_rt_get_efuse_current_size_hdl(struct oid_par_priv *poid_par_priv)
  1880. {
  1881. #ifdef PLATFORM_OS_XP
  1882. _irqL oldirql;
  1883. #endif
  1884. u16 size;
  1885. u8 ret;
  1886. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1887. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1888. _func_enter_;
  1889. if (poid_par_priv->type_of_oid != QUERY_OID)
  1890. return NDIS_STATUS_NOT_ACCEPTED;
  1891. if (poid_par_priv->information_buf_len <sizeof(u32))
  1892. return NDIS_STATUS_INVALID_LENGTH;
  1893. _irqlevel_changed_(&oldirql, LOWER);
  1894. ret = efuse_GetCurrentSize(Adapter, &size);
  1895. _irqlevel_changed_(&oldirql, RAISE);
  1896. if (ret == _SUCCESS) {
  1897. *(u32*)poid_par_priv->information_buf = size;
  1898. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1899. } else
  1900. status = NDIS_STATUS_FAILURE;
  1901. _func_exit_;
  1902. return status;
  1903. }
  1904. //------------------------------------------------------------------------------
  1905. NDIS_STATUS oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv)
  1906. {
  1907. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1908. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1909. _func_enter_;
  1910. if (poid_par_priv->type_of_oid != QUERY_OID)
  1911. return NDIS_STATUS_NOT_ACCEPTED;
  1912. if (poid_par_priv->information_buf_len < sizeof(u32))
  1913. return NDIS_STATUS_INVALID_LENGTH;
  1914. *(u32*)poid_par_priv->information_buf = efuse_GetMaxSize(Adapter);
  1915. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  1916. RT_TRACE(_module_mp_, _drv_info_,
  1917. ("-oid_rt_get_efuse_max_size_hdl: size=%d status=0x%08X\n",
  1918. *(int*)poid_par_priv->information_buf, status));
  1919. _func_exit_;
  1920. return status;
  1921. }
  1922. //------------------------------------------------------------------------------
  1923. NDIS_STATUS oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv)
  1924. {
  1925. NDIS_STATUS status;
  1926. _func_enter_;
  1927. RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_pro_efuse_hdl\n"));
  1928. if (poid_par_priv->type_of_oid == QUERY_OID)
  1929. status = oid_rt_pro_read_efuse_hdl(poid_par_priv);
  1930. else
  1931. status = oid_rt_pro_write_efuse_hdl(poid_par_priv);
  1932. RT_TRACE(_module_mp_, _drv_info_, ("-oid_rt_pro_efuse_hdl: status=0x%08X\n", status));
  1933. _func_exit_;
  1934. return status;
  1935. }
  1936. //------------------------------------------------------------------------------
  1937. NDIS_STATUS oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv)
  1938. {
  1939. #ifdef PLATFORM_OS_XP
  1940. _irqL oldirql;
  1941. #endif
  1942. u8 *data;
  1943. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1944. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1945. u16 mapLen=0;
  1946. _func_enter_;
  1947. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_pro_efuse_map_hdl\n"));
  1948. EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
  1949. *poid_par_priv->bytes_rw = 0;
  1950. if (poid_par_priv->information_buf_len < mapLen)
  1951. return NDIS_STATUS_INVALID_LENGTH;
  1952. data = (u8*)poid_par_priv->information_buf;
  1953. _irqlevel_changed_(&oldirql, LOWER);
  1954. if (poid_par_priv->type_of_oid == QUERY_OID)
  1955. {
  1956. RT_TRACE(_module_mp_, _drv_info_,
  1957. ("oid_rt_pro_efuse_map_hdl: READ\n"));
  1958. if (rtw_efuse_map_read(Adapter, 0, mapLen, data) == _SUCCESS)
  1959. *poid_par_priv->bytes_rw = mapLen;
  1960. else {
  1961. RT_TRACE(_module_mp_, _drv_err_,
  1962. ("oid_rt_pro_efuse_map_hdl: READ fail\n"));
  1963. status = NDIS_STATUS_FAILURE;
  1964. }
  1965. } else {
  1966. // SET_OID
  1967. RT_TRACE(_module_mp_, _drv_info_,
  1968. ("oid_rt_pro_efuse_map_hdl: WRITE\n"));
  1969. if (rtw_efuse_map_write(Adapter, 0, mapLen, data) == _SUCCESS)
  1970. *poid_par_priv->bytes_rw = mapLen;
  1971. else {
  1972. RT_TRACE(_module_mp_, _drv_err_,
  1973. ("oid_rt_pro_efuse_map_hdl: WRITE fail\n"));
  1974. status = NDIS_STATUS_FAILURE;
  1975. }
  1976. }
  1977. _irqlevel_changed_(&oldirql, RAISE);
  1978. RT_TRACE(_module_mp_, _drv_info_,
  1979. ("-oid_rt_pro_efuse_map_hdl: status=0x%08X\n", status));
  1980. _func_exit_;
  1981. return status;
  1982. }
  1983. NDIS_STATUS oid_rt_set_crystal_cap_hdl(struct oid_par_priv *poid_par_priv)
  1984. {
  1985. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  1986. #if 0
  1987. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  1988. #ifdef PLATFORM_OS_XP
  1989. _irqL oldirql;
  1990. #endif
  1991. u32 crystal_cap = 0;
  1992. _func_enter_;
  1993. if (poid_par_priv->type_of_oid != SET_OID)
  1994. return NDIS_STATUS_NOT_ACCEPTED;
  1995. if (poid_par_priv->information_buf_len <sizeof(u32))
  1996. return NDIS_STATUS_INVALID_LENGTH;
  1997. crystal_cap = *((u32*)poid_par_priv->information_buf);//4
  1998. if (crystal_cap > 0xf)
  1999. return NDIS_STATUS_NOT_ACCEPTED;
  2000. Adapter->mppriv.curr_crystalcap = crystal_cap;
  2001. _irqlevel_changed_(&oldirql,LOWER);
  2002. SetCrystalCap(Adapter);
  2003. _irqlevel_changed_(&oldirql,RAISE);
  2004. _func_exit_;
  2005. #endif
  2006. return status;
  2007. }
  2008. NDIS_STATUS oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv)
  2009. {
  2010. #ifdef PLATFORM_OS_XP
  2011. _irqL oldirql;
  2012. #endif
  2013. u8 rx_pkt_type;
  2014. // u32 rcr_val32;
  2015. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  2016. // PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  2017. _func_enter_;
  2018. RT_TRACE(_module_mp_, _drv_notice_, ("+oid_rt_set_rx_packet_type_hdl\n"));
  2019. if (poid_par_priv->type_of_oid != SET_OID)
  2020. return NDIS_STATUS_NOT_ACCEPTED;
  2021. if (poid_par_priv->information_buf_len < sizeof(u8))
  2022. return NDIS_STATUS_INVALID_LENGTH;
  2023. rx_pkt_type = *((u8*)poid_par_priv->information_buf);//4
  2024. RT_TRACE(_module_mp_, _drv_info_, ("rx_pkt_type: %x\n",rx_pkt_type ));
  2025. #if 0
  2026. _irqlevel_changed_(&oldirql, LOWER);
  2027. #if 0
  2028. rcr_val8 = rtw_read8(Adapter, 0x10250048);//RCR
  2029. rcr_val8 &= ~(RCR_AB|RCR_AM|RCR_APM|RCR_AAP);
  2030. if(rx_pkt_type == RX_PKT_BROADCAST){
  2031. rcr_val8 |= (RCR_AB | RCR_ACRC32 );
  2032. }
  2033. else if(rx_pkt_type == RX_PKT_DEST_ADDR){
  2034. rcr_val8 |= (RCR_AAP| RCR_AM |RCR_ACRC32);
  2035. }
  2036. else if(rx_pkt_type == RX_PKT_PHY_MATCH){
  2037. rcr_val8 |= (RCR_APM|RCR_ACRC32);
  2038. }
  2039. else{
  2040. rcr_val8 &= ~(RCR_AAP|RCR_APM|RCR_AM|RCR_AB|RCR_ACRC32);
  2041. }
  2042. rtw_write8(padapter, 0x10250048,rcr_val8);
  2043. #else
  2044. rcr_val32 = rtw_read32(padapter, RCR);//RCR = 0x10250048
  2045. rcr_val32 &= ~(RCR_CBSSID|RCR_AB|RCR_AM|RCR_APM|RCR_AAP);
  2046. #if 0
  2047. if(rx_pkt_type == RX_PKT_BROADCAST){
  2048. rcr_val32 |= (RCR_AB|RCR_AM|RCR_APM|RCR_AAP|RCR_ACRC32);
  2049. }
  2050. else if(rx_pkt_type == RX_PKT_DEST_ADDR){
  2051. //rcr_val32 |= (RCR_CBSSID|RCR_AAP|RCR_AM|RCR_ACRC32);
  2052. rcr_val32 |= (RCR_CBSSID|RCR_APM|RCR_ACRC32);
  2053. }
  2054. else if(rx_pkt_type == RX_PKT_PHY_MATCH){
  2055. rcr_val32 |= (RCR_APM|RCR_ACRC32);
  2056. //rcr_val32 |= (RCR_AAP|RCR_ACRC32);
  2057. }
  2058. else{
  2059. rcr_val32 &= ~(RCR_AAP|RCR_APM|RCR_AM|RCR_AB|RCR_ACRC32);
  2060. }
  2061. #else
  2062. switch (rx_pkt_type)
  2063. {
  2064. case RX_PKT_BROADCAST :
  2065. rcr_val32 |= (RCR_AB|RCR_AM|RCR_APM|RCR_AAP|RCR_ACRC32);
  2066. break;
  2067. case RX_PKT_DEST_ADDR :
  2068. rcr_val32 |= (RCR_AB|RCR_AM|RCR_APM|RCR_AAP|RCR_ACRC32);
  2069. break;
  2070. case RX_PKT_PHY_MATCH:
  2071. rcr_val32 |= (RCR_APM|RCR_ACRC32);
  2072. break;
  2073. default:
  2074. rcr_val32 &= ~(RCR_AAP|RCR_APM|RCR_AM|RCR_AB|RCR_ACRC32);
  2075. break;
  2076. }
  2077. if (rx_pkt_type == RX_PKT_DEST_ADDR) {
  2078. padapter->mppriv.check_mp_pkt = 1;
  2079. } else {
  2080. padapter->mppriv.check_mp_pkt = 0;
  2081. }
  2082. #endif
  2083. rtw_write32(padapter, RCR, rcr_val32);
  2084. #endif
  2085. _irqlevel_changed_(&oldirql, RAISE);
  2086. #endif
  2087. _func_exit_;
  2088. return status;
  2089. }
  2090. NDIS_STATUS oid_rt_pro_set_tx_agc_offset_hdl(struct oid_par_priv *poid_par_priv)
  2091. {
  2092. #if 0
  2093. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  2094. #ifdef PLATFORM_OS_XP
  2095. _irqL oldirql;
  2096. #endif
  2097. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  2098. u32 txagc;
  2099. _func_enter_;
  2100. if (poid_par_priv->type_of_oid != SET_OID)
  2101. return NDIS_STATUS_NOT_ACCEPTED;
  2102. if (poid_par_priv->information_buf_len < sizeof(u32))
  2103. return NDIS_STATUS_INVALID_LENGTH;
  2104. txagc = *(u32*)poid_par_priv->information_buf;
  2105. RT_TRACE(_module_mp_, _drv_info_,
  2106. ("oid_rt_pro_set_tx_agc_offset_hdl: 0x%08x\n", txagc));
  2107. _irqlevel_changed_(&oldirql, LOWER);
  2108. SetTxAGCOffset(Adapter, txagc);
  2109. _irqlevel_changed_(&oldirql, RAISE);
  2110. _func_exit_;
  2111. return status;
  2112. #else
  2113. return 0;
  2114. #endif
  2115. }
  2116. NDIS_STATUS oid_rt_pro_set_pkt_test_mode_hdl(struct oid_par_priv *poid_par_priv)
  2117. {
  2118. #if 0
  2119. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  2120. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  2121. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  2122. struct mp_priv *pmppriv = &Adapter->mppriv;
  2123. u32 type;
  2124. _func_enter_;
  2125. if (poid_par_priv->type_of_oid != SET_OID)
  2126. return NDIS_STATUS_NOT_ACCEPTED;
  2127. if (poid_par_priv->information_buf_len <sizeof(u32))
  2128. return NDIS_STATUS_INVALID_LENGTH;
  2129. type = *(u32*)poid_par_priv->information_buf;
  2130. if (_LOOPBOOK_MODE_ == type) {
  2131. pmppriv->mode = type;
  2132. set_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE); //append txdesc
  2133. RT_TRACE(_module_mp_, _drv_info_, ("test mode change to loopback mode:0x%08x.\n", get_fwstate(pmlmepriv)));
  2134. } else if (_2MAC_MODE_ == type){
  2135. pmppriv->mode = type;
  2136. _clr_fwstate_(pmlmepriv, WIFI_MP_LPBK_STATE);
  2137. RT_TRACE(_module_mp_, _drv_info_, ("test mode change to 2mac mode:0x%08x.\n", get_fwstate(pmlmepriv)));
  2138. } else
  2139. status = NDIS_STATUS_NOT_ACCEPTED;
  2140. _func_exit_;
  2141. return status;
  2142. #else
  2143. return 0;
  2144. #endif
  2145. }
  2146. unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv)
  2147. {
  2148. PMP_XMIT_PARM pparm;
  2149. PADAPTER padapter;
  2150. struct mp_priv *pmp_priv;
  2151. struct pkt_attrib *pattrib;
  2152. RT_TRACE(_module_mp_, _drv_notice_, ("+%s\n", __func__));
  2153. pparm = (PMP_XMIT_PARM)poid_par_priv->information_buf;
  2154. padapter = (PADAPTER)poid_par_priv->adapter_context;
  2155. pmp_priv = &padapter->mppriv;
  2156. if (poid_par_priv->type_of_oid == QUERY_OID) {
  2157. pparm->enable = !pmp_priv->tx.stop;
  2158. pparm->count = pmp_priv->tx.sended;
  2159. } else {
  2160. if (pparm->enable == 0) {
  2161. pmp_priv->tx.stop = 1;
  2162. } else if (pmp_priv->tx.stop == 1) {
  2163. pmp_priv->tx.stop = 0;
  2164. pmp_priv->tx.count = pparm->count;
  2165. pmp_priv->tx.payload = pparm->payload_type;
  2166. pattrib = &pmp_priv->tx.attrib;
  2167. pattrib->pktlen = pparm->length;
  2168. _rtw_memcpy(pattrib->dst, pparm->da, ETH_ALEN);
  2169. SetPacketTx(padapter);
  2170. } else
  2171. return NDIS_STATUS_FAILURE;
  2172. }
  2173. return NDIS_STATUS_SUCCESS;
  2174. }
  2175. #if 0
  2176. unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv)
  2177. {
  2178. unsigned char *pframe, *pmp_pkt;
  2179. struct ethhdr *pethhdr;
  2180. struct pkt_attrib *pattrib;
  2181. struct rtw_ieee80211_hdr *pwlanhdr;
  2182. unsigned short *fctrl;
  2183. int llc_sz, payload_len;
  2184. struct mp_xmit_frame *pxframe= NULL;
  2185. struct mp_xmit_packet *pmp_xmitpkt = (struct mp_xmit_packet*)param;
  2186. u8 addr3[] = {0x02, 0xE0, 0x4C, 0x87, 0x66, 0x55};
  2187. // DBG_871X("+mp_ioctl_xmit_packet_hdl\n");
  2188. pxframe = alloc_mp_xmitframe(&padapter->mppriv);
  2189. if (pxframe == NULL)
  2190. {
  2191. DEBUG_ERR(("Can't alloc pmpframe %d:%s\n", __LINE__, __FILE__));
  2192. return -1;
  2193. }
  2194. //mp_xmit_pkt
  2195. payload_len = pmp_xmitpkt->len - 14;
  2196. pmp_pkt = (unsigned char*)pmp_xmitpkt->mem;
  2197. pethhdr = (struct ethhdr *)pmp_pkt;
  2198. //DBG_871X("payload_len=%d, pkt_mem=0x%x\n", pmp_xmitpkt->len, (void*)pmp_xmitpkt->mem);
  2199. //DBG_871X("pxframe=0x%x\n", (void*)pxframe);
  2200. //DBG_871X("pxframe->mem=0x%x\n", (void*)pxframe->mem);
  2201. //update attribute
  2202. pattrib = &pxframe->attrib;
  2203. memset((u8 *)(pattrib), 0, sizeof (struct pkt_attrib));
  2204. pattrib->pktlen = pmp_xmitpkt->len;
  2205. pattrib->ether_type = ntohs(pethhdr->h_proto);
  2206. pattrib->hdrlen = 24;
  2207. pattrib->nr_frags = 1;
  2208. pattrib->priority = 0;
  2209. #ifndef CONFIG_MP_LINUX
  2210. if(IS_MCAST(pethhdr->h_dest))
  2211. pattrib->mac_id = 4;
  2212. else
  2213. pattrib->mac_id = 5;
  2214. #else
  2215. pattrib->mac_id = 5;
  2216. #endif
  2217. //
  2218. memset(pxframe->mem, 0 , WLANHDR_OFFSET);
  2219. pframe = (u8 *)(pxframe->mem) + WLANHDR_OFFSET;
  2220. pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
  2221. fctrl = &(pwlanhdr->frame_ctl);
  2222. *(fctrl) = 0;
  2223. SetFrameSubType(pframe, WIFI_DATA);
  2224. _rtw_memcpy(pwlanhdr->addr1, pethhdr->h_dest, ETH_ALEN);
  2225. _rtw_memcpy(pwlanhdr->addr2, pethhdr->h_source, ETH_ALEN);
  2226. _rtw_memcpy(pwlanhdr->addr3, addr3, ETH_ALEN);
  2227. pwlanhdr->seq_ctl = 0;
  2228. pframe += pattrib->hdrlen;
  2229. llc_sz= rtw_put_snap(pframe, pattrib->ether_type);
  2230. pframe += llc_sz;
  2231. _rtw_memcpy(pframe, (void*)(pmp_pkt+14), payload_len);
  2232. pattrib->last_txcmdsz = pattrib->hdrlen + llc_sz + payload_len;
  2233. DEBUG_INFO(("issuing mp_xmit_frame, tx_len=%d, ether_type=0x%x\n", pattrib->last_txcmdsz, pattrib->ether_type));
  2234. xmit_mp_frame(padapter, pxframe);
  2235. return _SUCCESS;
  2236. }
  2237. #endif
  2238. //------------------------------------------------------------------------------
  2239. NDIS_STATUS oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv)
  2240. {
  2241. #ifdef PLATFORM_OS_XP
  2242. _irqL oldirql;
  2243. #endif
  2244. u8 bpwrup;
  2245. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  2246. #ifdef PLATFORM_LINUX
  2247. #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
  2248. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  2249. #endif
  2250. #endif
  2251. _func_enter_;
  2252. if (poid_par_priv->type_of_oid != SET_OID) {
  2253. status = NDIS_STATUS_NOT_ACCEPTED;
  2254. return status;
  2255. }
  2256. RT_TRACE(_module_mp_, _drv_info_,
  2257. ("\n ===> Setoid_rt_set_power_down_hdl.\n"));
  2258. _irqlevel_changed_(&oldirql, LOWER);
  2259. bpwrup = *(u8 *)poid_par_priv->information_buf;
  2260. //CALL the power_down function
  2261. #ifdef PLATFORM_LINUX
  2262. #if defined(CONFIG_RTL8712) //Linux MP insmod unknown symbol
  2263. dev_power_down(padapter,bpwrup);
  2264. #endif
  2265. #endif
  2266. _irqlevel_changed_(&oldirql, RAISE);
  2267. //DEBUG_ERR(("\n <=== Query OID_RT_PRO_READ_REGISTER.
  2268. // Add:0x%08x Width:%d Value:0x%08x\n",RegRWStruct->offset,RegRWStruct->width,RegRWStruct->value));
  2269. _func_exit_;
  2270. return status;
  2271. }
  2272. //------------------------------------------------------------------------------
  2273. NDIS_STATUS oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv)
  2274. {
  2275. #if 0
  2276. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  2277. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  2278. //#ifdef PLATFORM_OS_XP
  2279. // _irqL oldirql;
  2280. //#endif
  2281. _func_enter_;
  2282. if (poid_par_priv->type_of_oid != QUERY_OID) {
  2283. status = NDIS_STATUS_NOT_ACCEPTED;
  2284. return status;
  2285. }
  2286. if (poid_par_priv->information_buf_len < sizeof(u32)) {
  2287. status = NDIS_STATUS_INVALID_LENGTH;
  2288. return status;
  2289. }
  2290. RT_TRACE(_module_mp_, _drv_info_,
  2291. ("\n ===> oid_rt_get_power_mode_hdl.\n"));
  2292. // _irqlevel_changed_(&oldirql, LOWER);
  2293. *(int*)poid_par_priv->information_buf = Adapter->registrypriv.low_power ? POWER_LOW : POWER_NORMAL;
  2294. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  2295. // _irqlevel_changed_(&oldirql, RAISE);
  2296. _func_exit_;
  2297. return status;
  2298. #else
  2299. return 0;
  2300. #endif
  2301. }