fw.h 114 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2. /* Copyright(c) 2019-2020 Realtek Corporation
  3. */
  4. #ifndef __RTW89_FW_H__
  5. #define __RTW89_FW_H__
  6. #include "core.h"
  7. enum rtw89_fw_dl_status {
  8. RTW89_FWDL_INITIAL_STATE = 0,
  9. RTW89_FWDL_FWDL_ONGOING = 1,
  10. RTW89_FWDL_CHECKSUM_FAIL = 2,
  11. RTW89_FWDL_SECURITY_FAIL = 3,
  12. RTW89_FWDL_CV_NOT_MATCH = 4,
  13. RTW89_FWDL_RSVD0 = 5,
  14. RTW89_FWDL_WCPU_FWDL_RDY = 6,
  15. RTW89_FWDL_WCPU_FW_INIT_RDY = 7
  16. };
  17. struct rtw89_c2hreg_hdr {
  18. u32 w0;
  19. };
  20. #define RTW89_C2HREG_HDR_FUNC_MASK GENMASK(6, 0)
  21. #define RTW89_C2HREG_HDR_ACK BIT(7)
  22. #define RTW89_C2HREG_HDR_LEN_MASK GENMASK(11, 8)
  23. #define RTW89_C2HREG_HDR_SEQ_MASK GENMASK(15, 12)
  24. struct rtw89_c2hreg_phycap {
  25. u32 w0;
  26. u32 w1;
  27. u32 w2;
  28. u32 w3;
  29. } __packed;
  30. #define RTW89_C2HREG_PHYCAP_W0_FUNC GENMASK(6, 0)
  31. #define RTW89_C2HREG_PHYCAP_W0_ACK BIT(7)
  32. #define RTW89_C2HREG_PHYCAP_W0_LEN GENMASK(11, 8)
  33. #define RTW89_C2HREG_PHYCAP_W0_SEQ GENMASK(15, 12)
  34. #define RTW89_C2HREG_PHYCAP_W0_RX_NSS GENMASK(23, 16)
  35. #define RTW89_C2HREG_PHYCAP_W0_BW GENMASK(31, 24)
  36. #define RTW89_C2HREG_PHYCAP_W1_TX_NSS GENMASK(7, 0)
  37. #define RTW89_C2HREG_PHYCAP_W1_PROT GENMASK(15, 8)
  38. #define RTW89_C2HREG_PHYCAP_W1_NIC GENMASK(23, 16)
  39. #define RTW89_C2HREG_PHYCAP_W1_WL_FUNC GENMASK(31, 24)
  40. #define RTW89_C2HREG_PHYCAP_W2_HW_TYPE GENMASK(7, 0)
  41. #define RTW89_C2HREG_PHYCAP_W3_ANT_TX_NUM GENMASK(15, 8)
  42. #define RTW89_C2HREG_PHYCAP_W3_ANT_RX_NUM GENMASK(23, 16)
  43. struct rtw89_h2creg_hdr {
  44. u32 w0;
  45. };
  46. #define RTW89_H2CREG_HDR_FUNC_MASK GENMASK(6, 0)
  47. #define RTW89_H2CREG_HDR_LEN_MASK GENMASK(11, 8)
  48. struct rtw89_h2creg_sch_tx_en {
  49. u32 w0;
  50. u32 w1;
  51. } __packed;
  52. #define RTW89_H2CREG_SCH_TX_EN_W0_EN GENMASK(31, 16)
  53. #define RTW89_H2CREG_SCH_TX_EN_W1_MASK GENMASK(15, 0)
  54. #define RTW89_H2CREG_SCH_TX_EN_W1_BAND BIT(16)
  55. #define RTW89_H2CREG_MAX 4
  56. #define RTW89_C2HREG_MAX 4
  57. #define RTW89_C2HREG_HDR_LEN 2
  58. #define RTW89_H2CREG_HDR_LEN 2
  59. #define RTW89_C2H_TIMEOUT 1000000
  60. struct rtw89_mac_c2h_info {
  61. u8 id;
  62. u8 content_len;
  63. union {
  64. u32 c2hreg[RTW89_C2HREG_MAX];
  65. struct rtw89_c2hreg_hdr hdr;
  66. struct rtw89_c2hreg_phycap phycap;
  67. } u;
  68. };
  69. struct rtw89_mac_h2c_info {
  70. u8 id;
  71. u8 content_len;
  72. union {
  73. u32 h2creg[RTW89_H2CREG_MAX];
  74. struct rtw89_h2creg_hdr hdr;
  75. struct rtw89_h2creg_sch_tx_en sch_tx_en;
  76. } u;
  77. };
  78. enum rtw89_mac_h2c_type {
  79. RTW89_FWCMD_H2CREG_FUNC_H2CREG_LB = 0,
  80. RTW89_FWCMD_H2CREG_FUNC_CNSL_CMD,
  81. RTW89_FWCMD_H2CREG_FUNC_FWERR,
  82. RTW89_FWCMD_H2CREG_FUNC_GET_FEATURE,
  83. RTW89_FWCMD_H2CREG_FUNC_GETPKT_INFORM,
  84. RTW89_FWCMD_H2CREG_FUNC_SCH_TX_EN
  85. };
  86. enum rtw89_mac_c2h_type {
  87. RTW89_FWCMD_C2HREG_FUNC_C2HREG_LB = 0,
  88. RTW89_FWCMD_C2HREG_FUNC_ERR_RPT,
  89. RTW89_FWCMD_C2HREG_FUNC_ERR_MSG,
  90. RTW89_FWCMD_C2HREG_FUNC_PHY_CAP,
  91. RTW89_FWCMD_C2HREG_FUNC_TX_PAUSE_RPT,
  92. RTW89_FWCMD_C2HREG_FUNC_NULL = 0xFF
  93. };
  94. enum rtw89_fw_c2h_category {
  95. RTW89_C2H_CAT_TEST,
  96. RTW89_C2H_CAT_MAC,
  97. RTW89_C2H_CAT_OUTSRC,
  98. };
  99. enum rtw89_fw_log_level {
  100. RTW89_FW_LOG_LEVEL_OFF,
  101. RTW89_FW_LOG_LEVEL_CRT,
  102. RTW89_FW_LOG_LEVEL_SER,
  103. RTW89_FW_LOG_LEVEL_WARN,
  104. RTW89_FW_LOG_LEVEL_LOUD,
  105. RTW89_FW_LOG_LEVEL_TR,
  106. };
  107. enum rtw89_fw_log_path {
  108. RTW89_FW_LOG_LEVEL_UART,
  109. RTW89_FW_LOG_LEVEL_C2H,
  110. RTW89_FW_LOG_LEVEL_SNI,
  111. };
  112. enum rtw89_fw_log_comp {
  113. RTW89_FW_LOG_COMP_VER,
  114. RTW89_FW_LOG_COMP_INIT,
  115. RTW89_FW_LOG_COMP_TASK,
  116. RTW89_FW_LOG_COMP_CNS,
  117. RTW89_FW_LOG_COMP_H2C,
  118. RTW89_FW_LOG_COMP_C2H,
  119. RTW89_FW_LOG_COMP_TX,
  120. RTW89_FW_LOG_COMP_RX,
  121. RTW89_FW_LOG_COMP_IPSEC,
  122. RTW89_FW_LOG_COMP_TIMER,
  123. RTW89_FW_LOG_COMP_DBGPKT,
  124. RTW89_FW_LOG_COMP_PS,
  125. RTW89_FW_LOG_COMP_ERROR,
  126. RTW89_FW_LOG_COMP_WOWLAN,
  127. RTW89_FW_LOG_COMP_SECURE_BOOT,
  128. RTW89_FW_LOG_COMP_BTC,
  129. RTW89_FW_LOG_COMP_BB,
  130. RTW89_FW_LOG_COMP_TWT,
  131. RTW89_FW_LOG_COMP_RF,
  132. RTW89_FW_LOG_COMP_MCC = 20,
  133. };
  134. enum rtw89_pkt_offload_op {
  135. RTW89_PKT_OFLD_OP_ADD,
  136. RTW89_PKT_OFLD_OP_DEL,
  137. RTW89_PKT_OFLD_OP_READ,
  138. NUM_OF_RTW89_PKT_OFFLOAD_OP,
  139. };
  140. #define RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op) \
  141. ((pkt_id) * NUM_OF_RTW89_PKT_OFFLOAD_OP + (pkt_op))
  142. enum rtw89_scanofld_notify_reason {
  143. RTW89_SCAN_DWELL_NOTIFY,
  144. RTW89_SCAN_PRE_TX_NOTIFY,
  145. RTW89_SCAN_POST_TX_NOTIFY,
  146. RTW89_SCAN_ENTER_CH_NOTIFY,
  147. RTW89_SCAN_LEAVE_CH_NOTIFY,
  148. RTW89_SCAN_END_SCAN_NOTIFY,
  149. };
  150. enum rtw89_chan_type {
  151. RTW89_CHAN_OPERATE = 0,
  152. RTW89_CHAN_ACTIVE,
  153. RTW89_CHAN_DFS,
  154. };
  155. enum rtw89_p2pps_action {
  156. RTW89_P2P_ACT_INIT = 0,
  157. RTW89_P2P_ACT_UPDATE = 1,
  158. RTW89_P2P_ACT_REMOVE = 2,
  159. RTW89_P2P_ACT_TERMINATE = 3,
  160. };
  161. enum rtw89_bcn_fltr_offload_mode {
  162. RTW89_BCN_FLTR_OFFLOAD_MODE_0 = 0,
  163. RTW89_BCN_FLTR_OFFLOAD_MODE_1,
  164. RTW89_BCN_FLTR_OFFLOAD_MODE_2,
  165. RTW89_BCN_FLTR_OFFLOAD_MODE_3,
  166. RTW89_BCN_FLTR_OFFLOAD_MODE_DEFAULT = RTW89_BCN_FLTR_OFFLOAD_MODE_0,
  167. };
  168. enum rtw89_bcn_fltr_type {
  169. RTW89_BCN_FLTR_BEACON_LOSS,
  170. RTW89_BCN_FLTR_RSSI,
  171. RTW89_BCN_FLTR_NOTIFY,
  172. };
  173. enum rtw89_bcn_fltr_rssi_event {
  174. RTW89_BCN_FLTR_RSSI_NOT_CHANGED,
  175. RTW89_BCN_FLTR_RSSI_HIGH,
  176. RTW89_BCN_FLTR_RSSI_LOW,
  177. };
  178. #define FWDL_SECTION_MAX_NUM 10
  179. #define FWDL_SECTION_CHKSUM_LEN 8
  180. #define FWDL_SECTION_PER_PKT_LEN 2020
  181. struct rtw89_fw_hdr_section_info {
  182. u8 redl;
  183. const u8 *addr;
  184. u32 len;
  185. u32 dladdr;
  186. u32 mssc;
  187. u8 type;
  188. };
  189. struct rtw89_fw_bin_info {
  190. u8 section_num;
  191. u32 hdr_len;
  192. bool dynamic_hdr_en;
  193. u32 dynamic_hdr_len;
  194. struct rtw89_fw_hdr_section_info section_info[FWDL_SECTION_MAX_NUM];
  195. };
  196. struct rtw89_fw_macid_pause_grp {
  197. __le32 pause_grp[4];
  198. __le32 mask_grp[4];
  199. } __packed;
  200. #define RTW89_H2C_MAX_SIZE 2048
  201. #define RTW89_CHANNEL_TIME 45
  202. #define RTW89_CHANNEL_TIME_6G 20
  203. #define RTW89_DFS_CHAN_TIME 105
  204. #define RTW89_OFF_CHAN_TIME 100
  205. #define RTW89_DWELL_TIME 20
  206. #define RTW89_DWELL_TIME_6G 10
  207. #define RTW89_SCAN_WIDTH 0
  208. #define RTW89_SCANOFLD_MAX_SSID 8
  209. #define RTW89_SCANOFLD_MAX_IE_LEN 512
  210. #define RTW89_SCANOFLD_PKT_NONE 0xFF
  211. #define RTW89_SCANOFLD_DEBUG_MASK 0x1F
  212. #define RTW89_MAC_CHINFO_SIZE 28
  213. #define RTW89_SCAN_LIST_GUARD 4
  214. #define RTW89_SCAN_LIST_LIMIT \
  215. ((RTW89_H2C_MAX_SIZE / RTW89_MAC_CHINFO_SIZE) - RTW89_SCAN_LIST_GUARD)
  216. #define RTW89_BCN_LOSS_CNT 10
  217. struct rtw89_mac_chinfo {
  218. u8 period;
  219. u8 dwell_time;
  220. u8 central_ch;
  221. u8 pri_ch;
  222. u8 bw:3;
  223. u8 notify_action:5;
  224. u8 num_pkt:4;
  225. u8 tx_pkt:1;
  226. u8 pause_data:1;
  227. u8 ch_band:2;
  228. u8 probe_id;
  229. u8 dfs_ch:1;
  230. u8 tx_null:1;
  231. u8 rand_seq_num:1;
  232. u8 cfg_tx_pwr:1;
  233. u8 rsvd0: 4;
  234. u8 pkt_id[RTW89_SCANOFLD_MAX_SSID];
  235. u16 tx_pwr_idx;
  236. u8 rsvd1;
  237. struct list_head list;
  238. bool is_psc;
  239. };
  240. struct rtw89_scan_option {
  241. bool enable;
  242. bool target_ch_mode;
  243. };
  244. struct rtw89_pktofld_info {
  245. struct list_head list;
  246. u8 id;
  247. /* Below fields are for 6 GHz RNR use only */
  248. u8 ssid[IEEE80211_MAX_SSID_LEN];
  249. u8 ssid_len;
  250. u8 bssid[ETH_ALEN];
  251. u16 channel_6ghz;
  252. bool cancel;
  253. };
  254. struct rtw89_h2c_ra {
  255. __le32 w0;
  256. __le32 w1;
  257. __le32 w2;
  258. __le32 w3;
  259. } __packed;
  260. #define RTW89_H2C_RA_W0_IS_DIS BIT(0)
  261. #define RTW89_H2C_RA_W0_MODE GENMASK(5, 1)
  262. #define RTW89_H2C_RA_W0_BW_CAP GENMASK(7, 6)
  263. #define RTW89_H2C_RA_W0_MACID GENMASK(15, 8)
  264. #define RTW89_H2C_RA_W0_DCM BIT(16)
  265. #define RTW89_H2C_RA_W0_ER BIT(17)
  266. #define RTW89_H2C_RA_W0_INIT_RATE_LV GENMASK(19, 18)
  267. #define RTW89_H2C_RA_W0_UPD_ALL BIT(20)
  268. #define RTW89_H2C_RA_W0_SGI BIT(21)
  269. #define RTW89_H2C_RA_W0_LDPC BIT(22)
  270. #define RTW89_H2C_RA_W0_STBC BIT(23)
  271. #define RTW89_H2C_RA_W0_SS_NUM GENMASK(26, 24)
  272. #define RTW89_H2C_RA_W0_GILTF GENMASK(29, 27)
  273. #define RTW89_H2C_RA_W0_UPD_BW_NSS_MASK BIT(30)
  274. #define RTW89_H2C_RA_W0_UPD_MASK BIT(31)
  275. #define RTW89_H2C_RA_W1_RAMASK_LO32 GENMASK(31, 0)
  276. #define RTW89_H2C_RA_W2_RAMASK_HI32 GENMASK(30, 0)
  277. #define RTW89_H2C_RA_W2_BFEE_CSI_CTL BIT(31)
  278. #define RTW89_H2C_RA_W3_BAND_NUM GENMASK(7, 0)
  279. #define RTW89_H2C_RA_W3_RA_CSI_RATE_EN BIT(8)
  280. #define RTW89_H2C_RA_W3_FIXED_CSI_RATE_EN BIT(9)
  281. #define RTW89_H2C_RA_W3_CR_TBL_SEL BIT(10)
  282. #define RTW89_H2C_RA_W3_FIX_GILTF_EN BIT(11)
  283. #define RTW89_H2C_RA_W3_FIX_GILTF GENMASK(14, 12)
  284. #define RTW89_H2C_RA_W3_FIXED_CSI_MCS_SS_IDX GENMASK(23, 16)
  285. #define RTW89_H2C_RA_W3_FIXED_CSI_MODE GENMASK(25, 24)
  286. #define RTW89_H2C_RA_W3_FIXED_CSI_GI_LTF GENMASK(28, 26)
  287. #define RTW89_H2C_RA_W3_FIXED_CSI_BW GENMASK(31, 29)
  288. struct rtw89_h2c_ra_v1 {
  289. struct rtw89_h2c_ra v0;
  290. __le32 w4;
  291. __le32 w5;
  292. } __packed;
  293. #define RTW89_H2C_RA_V1_W4_MODE_EHT GENMASK(6, 0)
  294. #define RTW89_H2C_RA_V1_W4_BW_EHT GENMASK(10, 8)
  295. #define RTW89_H2C_RA_V1_W4_RAMASK_UHL16 GENMASK(31, 16)
  296. #define RTW89_H2C_RA_V1_W5_RAMASK_UHH16 GENMASK(15, 0)
  297. static inline void RTW89_SET_FWCMD_SEC_IDX(void *cmd, u32 val)
  298. {
  299. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(7, 0));
  300. }
  301. static inline void RTW89_SET_FWCMD_SEC_OFFSET(void *cmd, u32 val)
  302. {
  303. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(15, 8));
  304. }
  305. static inline void RTW89_SET_FWCMD_SEC_LEN(void *cmd, u32 val)
  306. {
  307. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(23, 16));
  308. }
  309. static inline void RTW89_SET_FWCMD_SEC_TYPE(void *cmd, u32 val)
  310. {
  311. le32p_replace_bits((__le32 *)(cmd) + 0x01, val, GENMASK(3, 0));
  312. }
  313. static inline void RTW89_SET_FWCMD_SEC_EXT_KEY(void *cmd, u32 val)
  314. {
  315. le32p_replace_bits((__le32 *)(cmd) + 0x01, val, BIT(4));
  316. }
  317. static inline void RTW89_SET_FWCMD_SEC_SPP_MODE(void *cmd, u32 val)
  318. {
  319. le32p_replace_bits((__le32 *)(cmd) + 0x01, val, BIT(5));
  320. }
  321. static inline void RTW89_SET_FWCMD_SEC_KEY0(void *cmd, u32 val)
  322. {
  323. le32p_replace_bits((__le32 *)(cmd) + 0x02, val, GENMASK(31, 0));
  324. }
  325. static inline void RTW89_SET_FWCMD_SEC_KEY1(void *cmd, u32 val)
  326. {
  327. le32p_replace_bits((__le32 *)(cmd) + 0x03, val, GENMASK(31, 0));
  328. }
  329. static inline void RTW89_SET_FWCMD_SEC_KEY2(void *cmd, u32 val)
  330. {
  331. le32p_replace_bits((__le32 *)(cmd) + 0x04, val, GENMASK(31, 0));
  332. }
  333. static inline void RTW89_SET_FWCMD_SEC_KEY3(void *cmd, u32 val)
  334. {
  335. le32p_replace_bits((__le32 *)(cmd) + 0x05, val, GENMASK(31, 0));
  336. }
  337. static inline void RTW89_SET_EDCA_SEL(void *cmd, u32 val)
  338. {
  339. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(1, 0));
  340. }
  341. static inline void RTW89_SET_EDCA_BAND(void *cmd, u32 val)
  342. {
  343. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, BIT(3));
  344. }
  345. static inline void RTW89_SET_EDCA_WMM(void *cmd, u32 val)
  346. {
  347. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, BIT(4));
  348. }
  349. static inline void RTW89_SET_EDCA_AC(void *cmd, u32 val)
  350. {
  351. le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(6, 5));
  352. }
  353. static inline void RTW89_SET_EDCA_PARAM(void *cmd, u32 val)
  354. {
  355. le32p_replace_bits((__le32 *)(cmd) + 0x01, val, GENMASK(31, 0));
  356. }
  357. #define FW_EDCA_PARAM_TXOPLMT_MSK GENMASK(26, 16)
  358. #define FW_EDCA_PARAM_CWMAX_MSK GENMASK(15, 12)
  359. #define FW_EDCA_PARAM_CWMIN_MSK GENMASK(11, 8)
  360. #define FW_EDCA_PARAM_AIFS_MSK GENMASK(7, 0)
  361. #define FWDL_SECURITY_SECTION_TYPE 9
  362. #define FWDL_SECURITY_SIGLEN 512
  363. struct rtw89_fw_dynhdr_sec {
  364. __le32 w0;
  365. u8 content[];
  366. } __packed;
  367. struct rtw89_fw_dynhdr_hdr {
  368. __le32 hdr_len;
  369. __le32 setcion_count;
  370. /* struct rtw89_fw_dynhdr_sec (nested flexible structures) */
  371. } __packed;
  372. struct rtw89_fw_hdr_section {
  373. __le32 w0;
  374. __le32 w1;
  375. __le32 w2;
  376. __le32 w3;
  377. } __packed;
  378. #define FWSECTION_HDR_W0_DL_ADDR GENMASK(31, 0)
  379. #define FWSECTION_HDR_W1_METADATA GENMASK(31, 24)
  380. #define FWSECTION_HDR_W1_SECTIONTYPE GENMASK(27, 24)
  381. #define FWSECTION_HDR_W1_SEC_SIZE GENMASK(23, 0)
  382. #define FWSECTION_HDR_W1_CHECKSUM BIT(28)
  383. #define FWSECTION_HDR_W1_REDL BIT(29)
  384. #define FWSECTION_HDR_W2_MSSC GENMASK(31, 0)
  385. struct rtw89_fw_hdr {
  386. __le32 w0;
  387. __le32 w1;
  388. __le32 w2;
  389. __le32 w3;
  390. __le32 w4;
  391. __le32 w5;
  392. __le32 w6;
  393. __le32 w7;
  394. struct rtw89_fw_hdr_section sections[];
  395. /* struct rtw89_fw_dynhdr_hdr (optional) */
  396. } __packed;
  397. #define FW_HDR_W1_MAJOR_VERSION GENMASK(7, 0)
  398. #define FW_HDR_W1_MINOR_VERSION GENMASK(15, 8)
  399. #define FW_HDR_W1_SUBVERSION GENMASK(23, 16)
  400. #define FW_HDR_W1_SUBINDEX GENMASK(31, 24)
  401. #define FW_HDR_W2_COMMITID GENMASK(31, 0)
  402. #define FW_HDR_W3_LEN GENMASK(23, 16)
  403. #define FW_HDR_W3_HDR_VER GENMASK(31, 24)
  404. #define FW_HDR_W4_MONTH GENMASK(7, 0)
  405. #define FW_HDR_W4_DATE GENMASK(15, 8)
  406. #define FW_HDR_W4_HOUR GENMASK(23, 16)
  407. #define FW_HDR_W4_MIN GENMASK(31, 24)
  408. #define FW_HDR_W5_YEAR GENMASK(31, 0)
  409. #define FW_HDR_W6_SEC_NUM GENMASK(15, 8)
  410. #define FW_HDR_W7_DYN_HDR BIT(16)
  411. #define FW_HDR_W7_CMD_VERSERION GENMASK(31, 24)
  412. struct rtw89_fw_hdr_section_v1 {
  413. __le32 w0;
  414. __le32 w1;
  415. __le32 w2;
  416. __le32 w3;
  417. } __packed;
  418. #define FWSECTION_HDR_V1_W0_DL_ADDR GENMASK(31, 0)
  419. #define FWSECTION_HDR_V1_W1_METADATA GENMASK(31, 24)
  420. #define FWSECTION_HDR_V1_W1_SECTIONTYPE GENMASK(27, 24)
  421. #define FWSECTION_HDR_V1_W1_SEC_SIZE GENMASK(23, 0)
  422. #define FWSECTION_HDR_V1_W1_CHECKSUM BIT(28)
  423. #define FWSECTION_HDR_V1_W1_REDL BIT(29)
  424. #define FWSECTION_HDR_V1_W2_MSSC GENMASK(7, 0)
  425. #define FWSECTION_HDR_V1_W2_BBMCU_IDX GENMASK(27, 24)
  426. struct rtw89_fw_hdr_v1 {
  427. __le32 w0;
  428. __le32 w1;
  429. __le32 w2;
  430. __le32 w3;
  431. __le32 w4;
  432. __le32 w5;
  433. __le32 w6;
  434. __le32 w7;
  435. __le32 w8;
  436. __le32 w9;
  437. __le32 w10;
  438. __le32 w11;
  439. struct rtw89_fw_hdr_section_v1 sections[];
  440. } __packed;
  441. #define FW_HDR_V1_W1_MAJOR_VERSION GENMASK(7, 0)
  442. #define FW_HDR_V1_W1_MINOR_VERSION GENMASK(15, 8)
  443. #define FW_HDR_V1_W1_SUBVERSION GENMASK(23, 16)
  444. #define FW_HDR_V1_W1_SUBINDEX GENMASK(31, 24)
  445. #define FW_HDR_V1_W2_COMMITID GENMASK(31, 0)
  446. #define FW_HDR_V1_W3_CMD_VERSERION GENMASK(23, 16)
  447. #define FW_HDR_V1_W3_HDR_VER GENMASK(31, 24)
  448. #define FW_HDR_V1_W4_MONTH GENMASK(7, 0)
  449. #define FW_HDR_V1_W4_DATE GENMASK(15, 8)
  450. #define FW_HDR_V1_W4_HOUR GENMASK(23, 16)
  451. #define FW_HDR_V1_W4_MIN GENMASK(31, 24)
  452. #define FW_HDR_V1_W5_YEAR GENMASK(15, 0)
  453. #define FW_HDR_V1_W5_HDR_SIZE GENMASK(31, 16)
  454. #define FW_HDR_V1_W6_SEC_NUM GENMASK(15, 8)
  455. #define FW_HDR_V1_W7_DYN_HDR BIT(16)
  456. static inline void SET_FW_HDR_PART_SIZE(void *fwhdr, u32 val)
  457. {
  458. le32p_replace_bits((__le32 *)fwhdr + 7, val, GENMASK(15, 0));
  459. }
  460. static inline void SET_CTRL_INFO_MACID(void *table, u32 val)
  461. {
  462. le32p_replace_bits((__le32 *)(table) + 0, val, GENMASK(6, 0));
  463. }
  464. static inline void SET_CTRL_INFO_OPERATION(void *table, u32 val)
  465. {
  466. le32p_replace_bits((__le32 *)(table) + 0, val, BIT(7));
  467. }
  468. #define SET_CMC_TBL_MASK_DATARATE GENMASK(8, 0)
  469. static inline void SET_CMC_TBL_DATARATE(void *table, u32 val)
  470. {
  471. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(8, 0));
  472. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATARATE,
  473. GENMASK(8, 0));
  474. }
  475. #define SET_CMC_TBL_MASK_FORCE_TXOP BIT(0)
  476. static inline void SET_CMC_TBL_FORCE_TXOP(void *table, u32 val)
  477. {
  478. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(9));
  479. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_FORCE_TXOP,
  480. BIT(9));
  481. }
  482. #define SET_CMC_TBL_MASK_DATA_BW GENMASK(1, 0)
  483. static inline void SET_CMC_TBL_DATA_BW(void *table, u32 val)
  484. {
  485. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(11, 10));
  486. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATA_BW,
  487. GENMASK(11, 10));
  488. }
  489. #define SET_CMC_TBL_MASK_DATA_GI_LTF GENMASK(2, 0)
  490. static inline void SET_CMC_TBL_DATA_GI_LTF(void *table, u32 val)
  491. {
  492. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(14, 12));
  493. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATA_GI_LTF,
  494. GENMASK(14, 12));
  495. }
  496. #define SET_CMC_TBL_MASK_DARF_TC_INDEX BIT(0)
  497. static inline void SET_CMC_TBL_DARF_TC_INDEX(void *table, u32 val)
  498. {
  499. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(15));
  500. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DARF_TC_INDEX,
  501. BIT(15));
  502. }
  503. #define SET_CMC_TBL_MASK_ARFR_CTRL GENMASK(3, 0)
  504. static inline void SET_CMC_TBL_ARFR_CTRL(void *table, u32 val)
  505. {
  506. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(19, 16));
  507. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ARFR_CTRL,
  508. GENMASK(19, 16));
  509. }
  510. #define SET_CMC_TBL_MASK_ACQ_RPT_EN BIT(0)
  511. static inline void SET_CMC_TBL_ACQ_RPT_EN(void *table, u32 val)
  512. {
  513. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(20));
  514. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ACQ_RPT_EN,
  515. BIT(20));
  516. }
  517. #define SET_CMC_TBL_MASK_MGQ_RPT_EN BIT(0)
  518. static inline void SET_CMC_TBL_MGQ_RPT_EN(void *table, u32 val)
  519. {
  520. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(21));
  521. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_MGQ_RPT_EN,
  522. BIT(21));
  523. }
  524. #define SET_CMC_TBL_MASK_ULQ_RPT_EN BIT(0)
  525. static inline void SET_CMC_TBL_ULQ_RPT_EN(void *table, u32 val)
  526. {
  527. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(22));
  528. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ULQ_RPT_EN,
  529. BIT(22));
  530. }
  531. #define SET_CMC_TBL_MASK_TWTQ_RPT_EN BIT(0)
  532. static inline void SET_CMC_TBL_TWTQ_RPT_EN(void *table, u32 val)
  533. {
  534. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(23));
  535. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_TWTQ_RPT_EN,
  536. BIT(23));
  537. }
  538. #define SET_CMC_TBL_MASK_DISRTSFB BIT(0)
  539. static inline void SET_CMC_TBL_DISRTSFB(void *table, u32 val)
  540. {
  541. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(25));
  542. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DISRTSFB,
  543. BIT(25));
  544. }
  545. #define SET_CMC_TBL_MASK_DISDATAFB BIT(0)
  546. static inline void SET_CMC_TBL_DISDATAFB(void *table, u32 val)
  547. {
  548. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(26));
  549. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DISDATAFB,
  550. BIT(26));
  551. }
  552. #define SET_CMC_TBL_MASK_TRYRATE BIT(0)
  553. static inline void SET_CMC_TBL_TRYRATE(void *table, u32 val)
  554. {
  555. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(27));
  556. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_TRYRATE,
  557. BIT(27));
  558. }
  559. #define SET_CMC_TBL_MASK_AMPDU_DENSITY GENMASK(3, 0)
  560. static inline void SET_CMC_TBL_AMPDU_DENSITY(void *table, u32 val)
  561. {
  562. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(31, 28));
  563. le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_AMPDU_DENSITY,
  564. GENMASK(31, 28));
  565. }
  566. #define SET_CMC_TBL_MASK_DATA_RTY_LOWEST_RATE GENMASK(8, 0)
  567. static inline void SET_CMC_TBL_DATA_RTY_LOWEST_RATE(void *table, u32 val)
  568. {
  569. le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(8, 0));
  570. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_DATA_RTY_LOWEST_RATE,
  571. GENMASK(8, 0));
  572. }
  573. #define SET_CMC_TBL_MASK_AMPDU_TIME_SEL BIT(0)
  574. static inline void SET_CMC_TBL_AMPDU_TIME_SEL(void *table, u32 val)
  575. {
  576. le32p_replace_bits((__le32 *)(table) + 2, val, BIT(9));
  577. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_AMPDU_TIME_SEL,
  578. BIT(9));
  579. }
  580. #define SET_CMC_TBL_MASK_AMPDU_LEN_SEL BIT(0)
  581. static inline void SET_CMC_TBL_AMPDU_LEN_SEL(void *table, u32 val)
  582. {
  583. le32p_replace_bits((__le32 *)(table) + 2, val, BIT(10));
  584. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_AMPDU_LEN_SEL,
  585. BIT(10));
  586. }
  587. #define SET_CMC_TBL_MASK_RTS_TXCNT_LMT_SEL BIT(0)
  588. static inline void SET_CMC_TBL_RTS_TXCNT_LMT_SEL(void *table, u32 val)
  589. {
  590. le32p_replace_bits((__le32 *)(table) + 2, val, BIT(11));
  591. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_TXCNT_LMT_SEL,
  592. BIT(11));
  593. }
  594. #define SET_CMC_TBL_MASK_RTS_TXCNT_LMT GENMASK(3, 0)
  595. static inline void SET_CMC_TBL_RTS_TXCNT_LMT(void *table, u32 val)
  596. {
  597. le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(15, 12));
  598. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_TXCNT_LMT,
  599. GENMASK(15, 12));
  600. }
  601. #define SET_CMC_TBL_MASK_RTSRATE GENMASK(8, 0)
  602. static inline void SET_CMC_TBL_RTSRATE(void *table, u32 val)
  603. {
  604. le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(24, 16));
  605. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTSRATE,
  606. GENMASK(24, 16));
  607. }
  608. #define SET_CMC_TBL_MASK_VCS_STBC BIT(0)
  609. static inline void SET_CMC_TBL_VCS_STBC(void *table, u32 val)
  610. {
  611. le32p_replace_bits((__le32 *)(table) + 2, val, BIT(27));
  612. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_VCS_STBC,
  613. BIT(27));
  614. }
  615. #define SET_CMC_TBL_MASK_RTS_RTY_LOWEST_RATE GENMASK(3, 0)
  616. static inline void SET_CMC_TBL_RTS_RTY_LOWEST_RATE(void *table, u32 val)
  617. {
  618. le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(31, 28));
  619. le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_RTY_LOWEST_RATE,
  620. GENMASK(31, 28));
  621. }
  622. #define SET_CMC_TBL_MASK_DATA_TX_CNT_LMT GENMASK(5, 0)
  623. static inline void SET_CMC_TBL_DATA_TX_CNT_LMT(void *table, u32 val)
  624. {
  625. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(5, 0));
  626. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_DATA_TX_CNT_LMT,
  627. GENMASK(5, 0));
  628. }
  629. #define SET_CMC_TBL_MASK_DATA_TXCNT_LMT_SEL BIT(0)
  630. static inline void SET_CMC_TBL_DATA_TXCNT_LMT_SEL(void *table, u32 val)
  631. {
  632. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(6));
  633. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_DATA_TXCNT_LMT_SEL,
  634. BIT(6));
  635. }
  636. #define SET_CMC_TBL_MASK_MAX_AGG_NUM_SEL BIT(0)
  637. static inline void SET_CMC_TBL_MAX_AGG_NUM_SEL(void *table, u32 val)
  638. {
  639. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(7));
  640. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_MAX_AGG_NUM_SEL,
  641. BIT(7));
  642. }
  643. #define SET_CMC_TBL_MASK_RTS_EN BIT(0)
  644. static inline void SET_CMC_TBL_RTS_EN(void *table, u32 val)
  645. {
  646. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(8));
  647. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_RTS_EN,
  648. BIT(8));
  649. }
  650. #define SET_CMC_TBL_MASK_CTS2SELF_EN BIT(0)
  651. static inline void SET_CMC_TBL_CTS2SELF_EN(void *table, u32 val)
  652. {
  653. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(9));
  654. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_CTS2SELF_EN,
  655. BIT(9));
  656. }
  657. #define SET_CMC_TBL_MASK_CCA_RTS GENMASK(1, 0)
  658. static inline void SET_CMC_TBL_CCA_RTS(void *table, u32 val)
  659. {
  660. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(11, 10));
  661. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_CCA_RTS,
  662. GENMASK(11, 10));
  663. }
  664. #define SET_CMC_TBL_MASK_HW_RTS_EN BIT(0)
  665. static inline void SET_CMC_TBL_HW_RTS_EN(void *table, u32 val)
  666. {
  667. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(12));
  668. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_HW_RTS_EN,
  669. BIT(12));
  670. }
  671. #define SET_CMC_TBL_MASK_RTS_DROP_DATA_MODE GENMASK(1, 0)
  672. static inline void SET_CMC_TBL_RTS_DROP_DATA_MODE(void *table, u32 val)
  673. {
  674. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(14, 13));
  675. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_RTS_DROP_DATA_MODE,
  676. GENMASK(14, 13));
  677. }
  678. #define SET_CMC_TBL_MASK_AMPDU_MAX_LEN GENMASK(10, 0)
  679. static inline void SET_CMC_TBL_AMPDU_MAX_LEN(void *table, u32 val)
  680. {
  681. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(26, 16));
  682. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_AMPDU_MAX_LEN,
  683. GENMASK(26, 16));
  684. }
  685. #define SET_CMC_TBL_MASK_UL_MU_DIS BIT(0)
  686. static inline void SET_CMC_TBL_UL_MU_DIS(void *table, u32 val)
  687. {
  688. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(27));
  689. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_UL_MU_DIS,
  690. BIT(27));
  691. }
  692. #define SET_CMC_TBL_MASK_AMPDU_MAX_TIME GENMASK(3, 0)
  693. static inline void SET_CMC_TBL_AMPDU_MAX_TIME(void *table, u32 val)
  694. {
  695. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(31, 28));
  696. le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_AMPDU_MAX_TIME,
  697. GENMASK(31, 28));
  698. }
  699. #define SET_CMC_TBL_MASK_MAX_AGG_NUM GENMASK(7, 0)
  700. static inline void SET_CMC_TBL_MAX_AGG_NUM(void *table, u32 val)
  701. {
  702. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(7, 0));
  703. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_MAX_AGG_NUM,
  704. GENMASK(7, 0));
  705. }
  706. #define SET_CMC_TBL_MASK_BA_BMAP GENMASK(1, 0)
  707. static inline void SET_CMC_TBL_BA_BMAP(void *table, u32 val)
  708. {
  709. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(9, 8));
  710. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BA_BMAP,
  711. GENMASK(9, 8));
  712. }
  713. #define SET_CMC_TBL_MASK_VO_LFTIME_SEL GENMASK(2, 0)
  714. static inline void SET_CMC_TBL_VO_LFTIME_SEL(void *table, u32 val)
  715. {
  716. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(18, 16));
  717. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_VO_LFTIME_SEL,
  718. GENMASK(18, 16));
  719. }
  720. #define SET_CMC_TBL_MASK_VI_LFTIME_SEL GENMASK(2, 0)
  721. static inline void SET_CMC_TBL_VI_LFTIME_SEL(void *table, u32 val)
  722. {
  723. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(21, 19));
  724. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_VI_LFTIME_SEL,
  725. GENMASK(21, 19));
  726. }
  727. #define SET_CMC_TBL_MASK_BE_LFTIME_SEL GENMASK(2, 0)
  728. static inline void SET_CMC_TBL_BE_LFTIME_SEL(void *table, u32 val)
  729. {
  730. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(24, 22));
  731. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BE_LFTIME_SEL,
  732. GENMASK(24, 22));
  733. }
  734. #define SET_CMC_TBL_MASK_BK_LFTIME_SEL GENMASK(2, 0)
  735. static inline void SET_CMC_TBL_BK_LFTIME_SEL(void *table, u32 val)
  736. {
  737. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(27, 25));
  738. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BK_LFTIME_SEL,
  739. GENMASK(27, 25));
  740. }
  741. #define SET_CMC_TBL_MASK_SECTYPE GENMASK(3, 0)
  742. static inline void SET_CMC_TBL_SECTYPE(void *table, u32 val)
  743. {
  744. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(31, 28));
  745. le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_SECTYPE,
  746. GENMASK(31, 28));
  747. }
  748. #define SET_CMC_TBL_MASK_MULTI_PORT_ID GENMASK(2, 0)
  749. static inline void SET_CMC_TBL_MULTI_PORT_ID(void *table, u32 val)
  750. {
  751. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(2, 0));
  752. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_MULTI_PORT_ID,
  753. GENMASK(2, 0));
  754. }
  755. #define SET_CMC_TBL_MASK_BMC BIT(0)
  756. static inline void SET_CMC_TBL_BMC(void *table, u32 val)
  757. {
  758. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(3));
  759. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_BMC,
  760. BIT(3));
  761. }
  762. #define SET_CMC_TBL_MASK_MBSSID GENMASK(3, 0)
  763. static inline void SET_CMC_TBL_MBSSID(void *table, u32 val)
  764. {
  765. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(7, 4));
  766. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_MBSSID,
  767. GENMASK(7, 4));
  768. }
  769. #define SET_CMC_TBL_MASK_NAVUSEHDR BIT(0)
  770. static inline void SET_CMC_TBL_NAVUSEHDR(void *table, u32 val)
  771. {
  772. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(8));
  773. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_NAVUSEHDR,
  774. BIT(8));
  775. }
  776. #define SET_CMC_TBL_MASK_TXPWR_MODE GENMASK(2, 0)
  777. static inline void SET_CMC_TBL_TXPWR_MODE(void *table, u32 val)
  778. {
  779. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(11, 9));
  780. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_TXPWR_MODE,
  781. GENMASK(11, 9));
  782. }
  783. #define SET_CMC_TBL_MASK_DATA_DCM BIT(0)
  784. static inline void SET_CMC_TBL_DATA_DCM(void *table, u32 val)
  785. {
  786. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(12));
  787. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_DCM,
  788. BIT(12));
  789. }
  790. #define SET_CMC_TBL_MASK_DATA_ER BIT(0)
  791. static inline void SET_CMC_TBL_DATA_ER(void *table, u32 val)
  792. {
  793. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(13));
  794. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_ER,
  795. BIT(13));
  796. }
  797. #define SET_CMC_TBL_MASK_DATA_LDPC BIT(0)
  798. static inline void SET_CMC_TBL_DATA_LDPC(void *table, u32 val)
  799. {
  800. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(14));
  801. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_LDPC,
  802. BIT(14));
  803. }
  804. #define SET_CMC_TBL_MASK_DATA_STBC BIT(0)
  805. static inline void SET_CMC_TBL_DATA_STBC(void *table, u32 val)
  806. {
  807. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(15));
  808. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_STBC,
  809. BIT(15));
  810. }
  811. #define SET_CMC_TBL_MASK_A_CTRL_BQR BIT(0)
  812. static inline void SET_CMC_TBL_A_CTRL_BQR(void *table, u32 val)
  813. {
  814. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(16));
  815. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_BQR,
  816. BIT(16));
  817. }
  818. #define SET_CMC_TBL_MASK_A_CTRL_UPH BIT(0)
  819. static inline void SET_CMC_TBL_A_CTRL_UPH(void *table, u32 val)
  820. {
  821. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(17));
  822. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_UPH,
  823. BIT(17));
  824. }
  825. #define SET_CMC_TBL_MASK_A_CTRL_BSR BIT(0)
  826. static inline void SET_CMC_TBL_A_CTRL_BSR(void *table, u32 val)
  827. {
  828. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(18));
  829. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_BSR,
  830. BIT(18));
  831. }
  832. #define SET_CMC_TBL_MASK_A_CTRL_CAS BIT(0)
  833. static inline void SET_CMC_TBL_A_CTRL_CAS(void *table, u32 val)
  834. {
  835. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(19));
  836. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_CAS,
  837. BIT(19));
  838. }
  839. #define SET_CMC_TBL_MASK_DATA_BW_ER BIT(0)
  840. static inline void SET_CMC_TBL_DATA_BW_ER(void *table, u32 val)
  841. {
  842. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(20));
  843. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_BW_ER,
  844. BIT(20));
  845. }
  846. #define SET_CMC_TBL_MASK_LSIG_TXOP_EN BIT(0)
  847. static inline void SET_CMC_TBL_LSIG_TXOP_EN(void *table, u32 val)
  848. {
  849. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(21));
  850. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_LSIG_TXOP_EN,
  851. BIT(21));
  852. }
  853. #define SET_CMC_TBL_MASK_CTRL_CNT_VLD BIT(0)
  854. static inline void SET_CMC_TBL_CTRL_CNT_VLD(void *table, u32 val)
  855. {
  856. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(27));
  857. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_CTRL_CNT_VLD,
  858. BIT(27));
  859. }
  860. #define SET_CMC_TBL_MASK_CTRL_CNT GENMASK(3, 0)
  861. static inline void SET_CMC_TBL_CTRL_CNT(void *table, u32 val)
  862. {
  863. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(31, 28));
  864. le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_CTRL_CNT,
  865. GENMASK(31, 28));
  866. }
  867. #define SET_CMC_TBL_MASK_RESP_REF_RATE GENMASK(8, 0)
  868. static inline void SET_CMC_TBL_RESP_REF_RATE(void *table, u32 val)
  869. {
  870. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(8, 0));
  871. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_RESP_REF_RATE,
  872. GENMASK(8, 0));
  873. }
  874. #define SET_CMC_TBL_MASK_ALL_ACK_SUPPORT BIT(0)
  875. static inline void SET_CMC_TBL_ALL_ACK_SUPPORT(void *table, u32 val)
  876. {
  877. le32p_replace_bits((__le32 *)(table) + 6, val, BIT(12));
  878. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ALL_ACK_SUPPORT,
  879. BIT(12));
  880. }
  881. #define SET_CMC_TBL_MASK_BSR_QUEUE_SIZE_FORMAT BIT(0)
  882. static inline void SET_CMC_TBL_BSR_QUEUE_SIZE_FORMAT(void *table, u32 val)
  883. {
  884. le32p_replace_bits((__le32 *)(table) + 6, val, BIT(13));
  885. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_BSR_QUEUE_SIZE_FORMAT,
  886. BIT(13));
  887. }
  888. #define SET_CMC_TBL_MASK_NTX_PATH_EN GENMASK(3, 0)
  889. static inline void SET_CMC_TBL_NTX_PATH_EN(void *table, u32 val)
  890. {
  891. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(19, 16));
  892. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_NTX_PATH_EN,
  893. GENMASK(19, 16));
  894. }
  895. #define SET_CMC_TBL_MASK_PATH_MAP_A GENMASK(1, 0)
  896. static inline void SET_CMC_TBL_PATH_MAP_A(void *table, u32 val)
  897. {
  898. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(21, 20));
  899. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_A,
  900. GENMASK(21, 20));
  901. }
  902. #define SET_CMC_TBL_MASK_PATH_MAP_B GENMASK(1, 0)
  903. static inline void SET_CMC_TBL_PATH_MAP_B(void *table, u32 val)
  904. {
  905. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(23, 22));
  906. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_B,
  907. GENMASK(23, 22));
  908. }
  909. #define SET_CMC_TBL_MASK_PATH_MAP_C GENMASK(1, 0)
  910. static inline void SET_CMC_TBL_PATH_MAP_C(void *table, u32 val)
  911. {
  912. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(25, 24));
  913. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_C,
  914. GENMASK(25, 24));
  915. }
  916. #define SET_CMC_TBL_MASK_PATH_MAP_D GENMASK(1, 0)
  917. static inline void SET_CMC_TBL_PATH_MAP_D(void *table, u32 val)
  918. {
  919. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(27, 26));
  920. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_D,
  921. GENMASK(27, 26));
  922. }
  923. #define SET_CMC_TBL_MASK_ANTSEL_A BIT(0)
  924. static inline void SET_CMC_TBL_ANTSEL_A(void *table, u32 val)
  925. {
  926. le32p_replace_bits((__le32 *)(table) + 6, val, BIT(28));
  927. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_A,
  928. BIT(28));
  929. }
  930. #define SET_CMC_TBL_MASK_ANTSEL_B BIT(0)
  931. static inline void SET_CMC_TBL_ANTSEL_B(void *table, u32 val)
  932. {
  933. le32p_replace_bits((__le32 *)(table) + 6, val, BIT(29));
  934. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_B,
  935. BIT(29));
  936. }
  937. #define SET_CMC_TBL_MASK_ANTSEL_C BIT(0)
  938. static inline void SET_CMC_TBL_ANTSEL_C(void *table, u32 val)
  939. {
  940. le32p_replace_bits((__le32 *)(table) + 6, val, BIT(30));
  941. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_C,
  942. BIT(30));
  943. }
  944. #define SET_CMC_TBL_MASK_ANTSEL_D BIT(0)
  945. static inline void SET_CMC_TBL_ANTSEL_D(void *table, u32 val)
  946. {
  947. le32p_replace_bits((__le32 *)(table) + 6, val, BIT(31));
  948. le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_D,
  949. BIT(31));
  950. }
  951. #define SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING GENMASK(1, 0)
  952. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING_V1(void *table, u32 val)
  953. {
  954. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(1, 0));
  955. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  956. GENMASK(1, 0));
  957. }
  958. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING40_V1(void *table, u32 val)
  959. {
  960. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(3, 2));
  961. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  962. GENMASK(3, 2));
  963. }
  964. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING80_V1(void *table, u32 val)
  965. {
  966. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(5, 4));
  967. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  968. GENMASK(5, 4));
  969. }
  970. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING160_V1(void *table, u32 val)
  971. {
  972. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(7, 6));
  973. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  974. GENMASK(7, 6));
  975. }
  976. #define SET_CMC_TBL_MASK_ADDR_CAM_INDEX GENMASK(7, 0)
  977. static inline void SET_CMC_TBL_ADDR_CAM_INDEX(void *table, u32 val)
  978. {
  979. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(7, 0));
  980. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_ADDR_CAM_INDEX,
  981. GENMASK(7, 0));
  982. }
  983. #define SET_CMC_TBL_MASK_PAID GENMASK(8, 0)
  984. static inline void SET_CMC_TBL_PAID(void *table, u32 val)
  985. {
  986. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(16, 8));
  987. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_PAID,
  988. GENMASK(16, 8));
  989. }
  990. #define SET_CMC_TBL_MASK_ULDL BIT(0)
  991. static inline void SET_CMC_TBL_ULDL(void *table, u32 val)
  992. {
  993. le32p_replace_bits((__le32 *)(table) + 7, val, BIT(17));
  994. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_ULDL,
  995. BIT(17));
  996. }
  997. #define SET_CMC_TBL_MASK_DOPPLER_CTRL GENMASK(1, 0)
  998. static inline void SET_CMC_TBL_DOPPLER_CTRL(void *table, u32 val)
  999. {
  1000. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(19, 18));
  1001. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_DOPPLER_CTRL,
  1002. GENMASK(19, 18));
  1003. }
  1004. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING(void *table, u32 val)
  1005. {
  1006. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(21, 20));
  1007. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  1008. GENMASK(21, 20));
  1009. }
  1010. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING40(void *table, u32 val)
  1011. {
  1012. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(23, 22));
  1013. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  1014. GENMASK(23, 22));
  1015. }
  1016. #define SET_CMC_TBL_MASK_TXPWR_TOLERENCE GENMASK(3, 0)
  1017. static inline void SET_CMC_TBL_TXPWR_TOLERENCE(void *table, u32 val)
  1018. {
  1019. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(27, 24));
  1020. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_TXPWR_TOLERENCE,
  1021. GENMASK(27, 24));
  1022. }
  1023. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING80(void *table, u32 val)
  1024. {
  1025. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(31, 30));
  1026. le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  1027. GENMASK(31, 30));
  1028. }
  1029. #define SET_CMC_TBL_MASK_NC GENMASK(2, 0)
  1030. static inline void SET_CMC_TBL_NC(void *table, u32 val)
  1031. {
  1032. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(2, 0));
  1033. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NC,
  1034. GENMASK(2, 0));
  1035. }
  1036. #define SET_CMC_TBL_MASK_NR GENMASK(2, 0)
  1037. static inline void SET_CMC_TBL_NR(void *table, u32 val)
  1038. {
  1039. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(5, 3));
  1040. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NR,
  1041. GENMASK(5, 3));
  1042. }
  1043. #define SET_CMC_TBL_MASK_NG GENMASK(1, 0)
  1044. static inline void SET_CMC_TBL_NG(void *table, u32 val)
  1045. {
  1046. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(7, 6));
  1047. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NG,
  1048. GENMASK(7, 6));
  1049. }
  1050. #define SET_CMC_TBL_MASK_CB GENMASK(1, 0)
  1051. static inline void SET_CMC_TBL_CB(void *table, u32 val)
  1052. {
  1053. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(9, 8));
  1054. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CB,
  1055. GENMASK(9, 8));
  1056. }
  1057. #define SET_CMC_TBL_MASK_CS GENMASK(1, 0)
  1058. static inline void SET_CMC_TBL_CS(void *table, u32 val)
  1059. {
  1060. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(11, 10));
  1061. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CS,
  1062. GENMASK(11, 10));
  1063. }
  1064. #define SET_CMC_TBL_MASK_CSI_TXBF_EN BIT(0)
  1065. static inline void SET_CMC_TBL_CSI_TXBF_EN(void *table, u32 val)
  1066. {
  1067. le32p_replace_bits((__le32 *)(table) + 8, val, BIT(12));
  1068. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_TXBF_EN,
  1069. BIT(12));
  1070. }
  1071. #define SET_CMC_TBL_MASK_CSI_STBC_EN BIT(0)
  1072. static inline void SET_CMC_TBL_CSI_STBC_EN(void *table, u32 val)
  1073. {
  1074. le32p_replace_bits((__le32 *)(table) + 8, val, BIT(13));
  1075. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_STBC_EN,
  1076. BIT(13));
  1077. }
  1078. #define SET_CMC_TBL_MASK_CSI_LDPC_EN BIT(0)
  1079. static inline void SET_CMC_TBL_CSI_LDPC_EN(void *table, u32 val)
  1080. {
  1081. le32p_replace_bits((__le32 *)(table) + 8, val, BIT(14));
  1082. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_LDPC_EN,
  1083. BIT(14));
  1084. }
  1085. #define SET_CMC_TBL_MASK_CSI_PARA_EN BIT(0)
  1086. static inline void SET_CMC_TBL_CSI_PARA_EN(void *table, u32 val)
  1087. {
  1088. le32p_replace_bits((__le32 *)(table) + 8, val, BIT(15));
  1089. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_PARA_EN,
  1090. BIT(15));
  1091. }
  1092. #define SET_CMC_TBL_MASK_CSI_FIX_RATE GENMASK(8, 0)
  1093. static inline void SET_CMC_TBL_CSI_FIX_RATE(void *table, u32 val)
  1094. {
  1095. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(24, 16));
  1096. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_FIX_RATE,
  1097. GENMASK(24, 16));
  1098. }
  1099. #define SET_CMC_TBL_MASK_CSI_GI_LTF GENMASK(2, 0)
  1100. static inline void SET_CMC_TBL_CSI_GI_LTF(void *table, u32 val)
  1101. {
  1102. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(27, 25));
  1103. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_GI_LTF,
  1104. GENMASK(27, 25));
  1105. }
  1106. static inline void SET_CMC_TBL_NOMINAL_PKT_PADDING160(void *table, u32 val)
  1107. {
  1108. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(29, 28));
  1109. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
  1110. GENMASK(29, 28));
  1111. }
  1112. #define SET_CMC_TBL_MASK_CSI_BW GENMASK(1, 0)
  1113. static inline void SET_CMC_TBL_CSI_BW(void *table, u32 val)
  1114. {
  1115. le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(31, 30));
  1116. le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_BW,
  1117. GENMASK(31, 30));
  1118. }
  1119. static inline void SET_DCTL_MACID_V1(void *table, u32 val)
  1120. {
  1121. le32p_replace_bits((__le32 *)(table) + 0, val, GENMASK(6, 0));
  1122. }
  1123. static inline void SET_DCTL_OPERATION_V1(void *table, u32 val)
  1124. {
  1125. le32p_replace_bits((__le32 *)(table) + 0, val, BIT(7));
  1126. }
  1127. #define SET_DCTL_MASK_QOS_FIELD_V1 GENMASK(7, 0)
  1128. static inline void SET_DCTL_QOS_FIELD_V1(void *table, u32 val)
  1129. {
  1130. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(7, 0));
  1131. le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_QOS_FIELD_V1,
  1132. GENMASK(7, 0));
  1133. }
  1134. #define SET_DCTL_MASK_SET_DCTL_HW_EXSEQ_MACID GENMASK(6, 0)
  1135. static inline void SET_DCTL_HW_EXSEQ_MACID_V1(void *table, u32 val)
  1136. {
  1137. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(14, 8));
  1138. le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_SET_DCTL_HW_EXSEQ_MACID,
  1139. GENMASK(14, 8));
  1140. }
  1141. #define SET_DCTL_MASK_QOS_DATA BIT(0)
  1142. static inline void SET_DCTL_QOS_DATA_V1(void *table, u32 val)
  1143. {
  1144. le32p_replace_bits((__le32 *)(table) + 1, val, BIT(15));
  1145. le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_QOS_DATA,
  1146. BIT(15));
  1147. }
  1148. #define SET_DCTL_MASK_AES_IV_L GENMASK(15, 0)
  1149. static inline void SET_DCTL_AES_IV_L_V1(void *table, u32 val)
  1150. {
  1151. le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(31, 16));
  1152. le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_AES_IV_L,
  1153. GENMASK(31, 16));
  1154. }
  1155. #define SET_DCTL_MASK_AES_IV_H GENMASK(31, 0)
  1156. static inline void SET_DCTL_AES_IV_H_V1(void *table, u32 val)
  1157. {
  1158. le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(31, 0));
  1159. le32p_replace_bits((__le32 *)(table) + 10, SET_DCTL_MASK_AES_IV_H,
  1160. GENMASK(31, 0));
  1161. }
  1162. #define SET_DCTL_MASK_SEQ0 GENMASK(11, 0)
  1163. static inline void SET_DCTL_SEQ0_V1(void *table, u32 val)
  1164. {
  1165. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(11, 0));
  1166. le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_SEQ0,
  1167. GENMASK(11, 0));
  1168. }
  1169. #define SET_DCTL_MASK_SEQ1 GENMASK(11, 0)
  1170. static inline void SET_DCTL_SEQ1_V1(void *table, u32 val)
  1171. {
  1172. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(23, 12));
  1173. le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_SEQ1,
  1174. GENMASK(23, 12));
  1175. }
  1176. #define SET_DCTL_MASK_AMSDU_MAX_LEN GENMASK(2, 0)
  1177. static inline void SET_DCTL_AMSDU_MAX_LEN_V1(void *table, u32 val)
  1178. {
  1179. le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(26, 24));
  1180. le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_AMSDU_MAX_LEN,
  1181. GENMASK(26, 24));
  1182. }
  1183. #define SET_DCTL_MASK_STA_AMSDU_EN BIT(0)
  1184. static inline void SET_DCTL_STA_AMSDU_EN_V1(void *table, u32 val)
  1185. {
  1186. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(27));
  1187. le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_STA_AMSDU_EN,
  1188. BIT(27));
  1189. }
  1190. #define SET_DCTL_MASK_CHKSUM_OFLD_EN BIT(0)
  1191. static inline void SET_DCTL_CHKSUM_OFLD_EN_V1(void *table, u32 val)
  1192. {
  1193. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(28));
  1194. le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_CHKSUM_OFLD_EN,
  1195. BIT(28));
  1196. }
  1197. #define SET_DCTL_MASK_WITH_LLC BIT(0)
  1198. static inline void SET_DCTL_WITH_LLC_V1(void *table, u32 val)
  1199. {
  1200. le32p_replace_bits((__le32 *)(table) + 3, val, BIT(29));
  1201. le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_WITH_LLC,
  1202. BIT(29));
  1203. }
  1204. #define SET_DCTL_MASK_SEQ2 GENMASK(11, 0)
  1205. static inline void SET_DCTL_SEQ2_V1(void *table, u32 val)
  1206. {
  1207. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(11, 0));
  1208. le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_SEQ2,
  1209. GENMASK(11, 0));
  1210. }
  1211. #define SET_DCTL_MASK_SEQ3 GENMASK(11, 0)
  1212. static inline void SET_DCTL_SEQ3_V1(void *table, u32 val)
  1213. {
  1214. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(23, 12));
  1215. le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_SEQ3,
  1216. GENMASK(23, 12));
  1217. }
  1218. #define SET_DCTL_MASK_TGT_IND GENMASK(3, 0)
  1219. static inline void SET_DCTL_TGT_IND_V1(void *table, u32 val)
  1220. {
  1221. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(27, 24));
  1222. le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_TGT_IND,
  1223. GENMASK(27, 24));
  1224. }
  1225. #define SET_DCTL_MASK_TGT_IND_EN BIT(0)
  1226. static inline void SET_DCTL_TGT_IND_EN_V1(void *table, u32 val)
  1227. {
  1228. le32p_replace_bits((__le32 *)(table) + 4, val, BIT(28));
  1229. le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_TGT_IND_EN,
  1230. BIT(28));
  1231. }
  1232. #define SET_DCTL_MASK_HTC_LB GENMASK(2, 0)
  1233. static inline void SET_DCTL_HTC_LB_V1(void *table, u32 val)
  1234. {
  1235. le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(31, 29));
  1236. le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_HTC_LB,
  1237. GENMASK(31, 29));
  1238. }
  1239. #define SET_DCTL_MASK_MHDR_LEN GENMASK(4, 0)
  1240. static inline void SET_DCTL_MHDR_LEN_V1(void *table, u32 val)
  1241. {
  1242. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(4, 0));
  1243. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_MHDR_LEN,
  1244. GENMASK(4, 0));
  1245. }
  1246. #define SET_DCTL_MASK_VLAN_TAG_VALID BIT(0)
  1247. static inline void SET_DCTL_VLAN_TAG_VALID_V1(void *table, u32 val)
  1248. {
  1249. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(5));
  1250. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_VLAN_TAG_VALID,
  1251. BIT(5));
  1252. }
  1253. #define SET_DCTL_MASK_VLAN_TAG_SEL GENMASK(1, 0)
  1254. static inline void SET_DCTL_VLAN_TAG_SEL_V1(void *table, u32 val)
  1255. {
  1256. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(7, 6));
  1257. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_VLAN_TAG_SEL,
  1258. GENMASK(7, 6));
  1259. }
  1260. #define SET_DCTL_MASK_HTC_ORDER BIT(0)
  1261. static inline void SET_DCTL_HTC_ORDER_V1(void *table, u32 val)
  1262. {
  1263. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(8));
  1264. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_HTC_ORDER,
  1265. BIT(8));
  1266. }
  1267. #define SET_DCTL_MASK_SEC_KEY_ID GENMASK(1, 0)
  1268. static inline void SET_DCTL_SEC_KEY_ID_V1(void *table, u32 val)
  1269. {
  1270. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(10, 9));
  1271. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_KEY_ID,
  1272. GENMASK(10, 9));
  1273. }
  1274. #define SET_DCTL_MASK_WAPI BIT(0)
  1275. static inline void SET_DCTL_WAPI_V1(void *table, u32 val)
  1276. {
  1277. le32p_replace_bits((__le32 *)(table) + 5, val, BIT(15));
  1278. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_WAPI,
  1279. BIT(15));
  1280. }
  1281. #define SET_DCTL_MASK_SEC_ENT_MODE GENMASK(1, 0)
  1282. static inline void SET_DCTL_SEC_ENT_MODE_V1(void *table, u32 val)
  1283. {
  1284. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(17, 16));
  1285. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENT_MODE,
  1286. GENMASK(17, 16));
  1287. }
  1288. #define SET_DCTL_MASK_SEC_ENTX_KEYID GENMASK(1, 0)
  1289. static inline void SET_DCTL_SEC_ENT0_KEYID_V1(void *table, u32 val)
  1290. {
  1291. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(19, 18));
  1292. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1293. GENMASK(19, 18));
  1294. }
  1295. static inline void SET_DCTL_SEC_ENT1_KEYID_V1(void *table, u32 val)
  1296. {
  1297. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(21, 20));
  1298. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1299. GENMASK(21, 20));
  1300. }
  1301. static inline void SET_DCTL_SEC_ENT2_KEYID_V1(void *table, u32 val)
  1302. {
  1303. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(23, 22));
  1304. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1305. GENMASK(23, 22));
  1306. }
  1307. static inline void SET_DCTL_SEC_ENT3_KEYID_V1(void *table, u32 val)
  1308. {
  1309. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(25, 24));
  1310. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1311. GENMASK(25, 24));
  1312. }
  1313. static inline void SET_DCTL_SEC_ENT4_KEYID_V1(void *table, u32 val)
  1314. {
  1315. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(27, 26));
  1316. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1317. GENMASK(27, 26));
  1318. }
  1319. static inline void SET_DCTL_SEC_ENT5_KEYID_V1(void *table, u32 val)
  1320. {
  1321. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(29, 28));
  1322. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1323. GENMASK(29, 28));
  1324. }
  1325. static inline void SET_DCTL_SEC_ENT6_KEYID_V1(void *table, u32 val)
  1326. {
  1327. le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(31, 30));
  1328. le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
  1329. GENMASK(31, 30));
  1330. }
  1331. #define SET_DCTL_MASK_SEC_ENT_VALID GENMASK(7, 0)
  1332. static inline void SET_DCTL_SEC_ENT_VALID_V1(void *table, u32 val)
  1333. {
  1334. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(7, 0));
  1335. le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENT_VALID,
  1336. GENMASK(7, 0));
  1337. }
  1338. #define SET_DCTL_MASK_SEC_ENTX GENMASK(7, 0)
  1339. static inline void SET_DCTL_SEC_ENT0_V1(void *table, u32 val)
  1340. {
  1341. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(15, 8));
  1342. le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENTX,
  1343. GENMASK(15, 8));
  1344. }
  1345. static inline void SET_DCTL_SEC_ENT1_V1(void *table, u32 val)
  1346. {
  1347. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(23, 16));
  1348. le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENTX,
  1349. GENMASK(23, 16));
  1350. }
  1351. static inline void SET_DCTL_SEC_ENT2_V1(void *table, u32 val)
  1352. {
  1353. le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(31, 24));
  1354. le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENTX,
  1355. GENMASK(31, 24));
  1356. }
  1357. static inline void SET_DCTL_SEC_ENT3_V1(void *table, u32 val)
  1358. {
  1359. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(7, 0));
  1360. le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
  1361. GENMASK(7, 0));
  1362. }
  1363. static inline void SET_DCTL_SEC_ENT4_V1(void *table, u32 val)
  1364. {
  1365. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(15, 8));
  1366. le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
  1367. GENMASK(15, 8));
  1368. }
  1369. static inline void SET_DCTL_SEC_ENT5_V1(void *table, u32 val)
  1370. {
  1371. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(23, 16));
  1372. le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
  1373. GENMASK(23, 16));
  1374. }
  1375. static inline void SET_DCTL_SEC_ENT6_V1(void *table, u32 val)
  1376. {
  1377. le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(31, 24));
  1378. le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
  1379. GENMASK(31, 24));
  1380. }
  1381. static inline void SET_BCN_UPD_PORT(void *h2c, u32 val)
  1382. {
  1383. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
  1384. }
  1385. static inline void SET_BCN_UPD_MBSSID(void *h2c, u32 val)
  1386. {
  1387. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1388. }
  1389. static inline void SET_BCN_UPD_BAND(void *h2c, u32 val)
  1390. {
  1391. le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
  1392. }
  1393. static inline void SET_BCN_UPD_GRP_IE_OFST(void *h2c, u32 val)
  1394. {
  1395. le32p_replace_bits((__le32 *)h2c, (val - 24) | BIT(7), GENMASK(31, 24));
  1396. }
  1397. static inline void SET_BCN_UPD_MACID(void *h2c, u32 val)
  1398. {
  1399. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
  1400. }
  1401. static inline void SET_BCN_UPD_SSN_SEL(void *h2c, u32 val)
  1402. {
  1403. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(9, 8));
  1404. }
  1405. static inline void SET_BCN_UPD_SSN_MODE(void *h2c, u32 val)
  1406. {
  1407. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(11, 10));
  1408. }
  1409. static inline void SET_BCN_UPD_RATE(void *h2c, u32 val)
  1410. {
  1411. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(20, 12));
  1412. }
  1413. static inline void SET_BCN_UPD_TXPWR(void *h2c, u32 val)
  1414. {
  1415. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(23, 21));
  1416. }
  1417. static inline void SET_BCN_UPD_TXINFO_CTRL_EN(void *h2c, u32 val)
  1418. {
  1419. le32p_replace_bits((__le32 *)(h2c) + 2, val, BIT(0));
  1420. }
  1421. static inline void SET_BCN_UPD_NTX_PATH_EN(void *h2c, u32 val)
  1422. {
  1423. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(4, 1));
  1424. }
  1425. static inline void SET_BCN_UPD_PATH_MAP_A(void *h2c, u32 val)
  1426. {
  1427. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(6, 5));
  1428. }
  1429. static inline void SET_BCN_UPD_PATH_MAP_B(void *h2c, u32 val)
  1430. {
  1431. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(8, 7));
  1432. }
  1433. static inline void SET_BCN_UPD_PATH_MAP_C(void *h2c, u32 val)
  1434. {
  1435. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(10, 9));
  1436. }
  1437. static inline void SET_BCN_UPD_PATH_MAP_D(void *h2c, u32 val)
  1438. {
  1439. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(12, 11));
  1440. }
  1441. static inline void SET_BCN_UPD_PATH_ANTSEL_A(void *h2c, u32 val)
  1442. {
  1443. le32p_replace_bits((__le32 *)(h2c) + 2, val, BIT(13));
  1444. }
  1445. static inline void SET_BCN_UPD_PATH_ANTSEL_B(void *h2c, u32 val)
  1446. {
  1447. le32p_replace_bits((__le32 *)(h2c) + 2, val, BIT(14));
  1448. }
  1449. static inline void SET_BCN_UPD_PATH_ANTSEL_C(void *h2c, u32 val)
  1450. {
  1451. le32p_replace_bits((__le32 *)(h2c) + 2, val, BIT(15));
  1452. }
  1453. static inline void SET_BCN_UPD_PATH_ANTSEL_D(void *h2c, u32 val)
  1454. {
  1455. le32p_replace_bits((__le32 *)(h2c) + 2, val, BIT(16));
  1456. }
  1457. static inline void SET_BCN_UPD_CSA_OFST(void *h2c, u32 val)
  1458. {
  1459. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(31, 17));
  1460. }
  1461. static inline void SET_FWROLE_MAINTAIN_MACID(void *h2c, u32 val)
  1462. {
  1463. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
  1464. }
  1465. static inline void SET_FWROLE_MAINTAIN_SELF_ROLE(void *h2c, u32 val)
  1466. {
  1467. le32p_replace_bits((__le32 *)h2c, val, GENMASK(9, 8));
  1468. }
  1469. static inline void SET_FWROLE_MAINTAIN_UPD_MODE(void *h2c, u32 val)
  1470. {
  1471. le32p_replace_bits((__le32 *)h2c, val, GENMASK(12, 10));
  1472. }
  1473. static inline void SET_FWROLE_MAINTAIN_WIFI_ROLE(void *h2c, u32 val)
  1474. {
  1475. le32p_replace_bits((__le32 *)h2c, val, GENMASK(16, 13));
  1476. }
  1477. static inline void SET_JOININFO_MACID(void *h2c, u32 val)
  1478. {
  1479. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
  1480. }
  1481. static inline void SET_JOININFO_OP(void *h2c, u32 val)
  1482. {
  1483. le32p_replace_bits((__le32 *)h2c, val, BIT(8));
  1484. }
  1485. static inline void SET_JOININFO_BAND(void *h2c, u32 val)
  1486. {
  1487. le32p_replace_bits((__le32 *)h2c, val, BIT(9));
  1488. }
  1489. static inline void SET_JOININFO_WMM(void *h2c, u32 val)
  1490. {
  1491. le32p_replace_bits((__le32 *)h2c, val, GENMASK(11, 10));
  1492. }
  1493. static inline void SET_JOININFO_TGR(void *h2c, u32 val)
  1494. {
  1495. le32p_replace_bits((__le32 *)h2c, val, BIT(12));
  1496. }
  1497. static inline void SET_JOININFO_ISHESTA(void *h2c, u32 val)
  1498. {
  1499. le32p_replace_bits((__le32 *)h2c, val, BIT(13));
  1500. }
  1501. static inline void SET_JOININFO_DLBW(void *h2c, u32 val)
  1502. {
  1503. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 14));
  1504. }
  1505. static inline void SET_JOININFO_TF_MAC_PAD(void *h2c, u32 val)
  1506. {
  1507. le32p_replace_bits((__le32 *)h2c, val, GENMASK(17, 16));
  1508. }
  1509. static inline void SET_JOININFO_DL_T_PE(void *h2c, u32 val)
  1510. {
  1511. le32p_replace_bits((__le32 *)h2c, val, GENMASK(20, 18));
  1512. }
  1513. static inline void SET_JOININFO_PORT_ID(void *h2c, u32 val)
  1514. {
  1515. le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 21));
  1516. }
  1517. static inline void SET_JOININFO_NET_TYPE(void *h2c, u32 val)
  1518. {
  1519. le32p_replace_bits((__le32 *)h2c, val, GENMASK(25, 24));
  1520. }
  1521. static inline void SET_JOININFO_WIFI_ROLE(void *h2c, u32 val)
  1522. {
  1523. le32p_replace_bits((__le32 *)h2c, val, GENMASK(29, 26));
  1524. }
  1525. static inline void SET_JOININFO_SELF_ROLE(void *h2c, u32 val)
  1526. {
  1527. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 30));
  1528. }
  1529. static inline void SET_GENERAL_PKT_MACID(void *h2c, u32 val)
  1530. {
  1531. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
  1532. }
  1533. static inline void SET_GENERAL_PKT_PROBRSP_ID(void *h2c, u32 val)
  1534. {
  1535. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1536. }
  1537. static inline void SET_GENERAL_PKT_PSPOLL_ID(void *h2c, u32 val)
  1538. {
  1539. le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
  1540. }
  1541. static inline void SET_GENERAL_PKT_NULL_ID(void *h2c, u32 val)
  1542. {
  1543. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
  1544. }
  1545. static inline void SET_GENERAL_PKT_QOS_NULL_ID(void *h2c, u32 val)
  1546. {
  1547. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
  1548. }
  1549. static inline void SET_GENERAL_PKT_CTS2SELF_ID(void *h2c, u32 val)
  1550. {
  1551. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(15, 8));
  1552. }
  1553. static inline void SET_LOG_CFG_LEVEL(void *h2c, u32 val)
  1554. {
  1555. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
  1556. }
  1557. static inline void SET_LOG_CFG_PATH(void *h2c, u32 val)
  1558. {
  1559. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1560. }
  1561. static inline void SET_LOG_CFG_COMP(void *h2c, u32 val)
  1562. {
  1563. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(31, 0));
  1564. }
  1565. static inline void SET_LOG_CFG_COMP_EXT(void *h2c, u32 val)
  1566. {
  1567. le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(31, 0));
  1568. }
  1569. static inline void SET_BA_CAM_VALID(void *h2c, u32 val)
  1570. {
  1571. le32p_replace_bits((__le32 *)h2c, val, BIT(0));
  1572. }
  1573. static inline void SET_BA_CAM_INIT_REQ(void *h2c, u32 val)
  1574. {
  1575. le32p_replace_bits((__le32 *)h2c, val, BIT(1));
  1576. }
  1577. static inline void SET_BA_CAM_ENTRY_IDX(void *h2c, u32 val)
  1578. {
  1579. le32p_replace_bits((__le32 *)h2c, val, GENMASK(3, 2));
  1580. }
  1581. static inline void SET_BA_CAM_TID(void *h2c, u32 val)
  1582. {
  1583. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 4));
  1584. }
  1585. static inline void SET_BA_CAM_MACID(void *h2c, u32 val)
  1586. {
  1587. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1588. }
  1589. static inline void SET_BA_CAM_BMAP_SIZE(void *h2c, u32 val)
  1590. {
  1591. le32p_replace_bits((__le32 *)h2c, val, GENMASK(19, 16));
  1592. }
  1593. static inline void SET_BA_CAM_SSN(void *h2c, u32 val)
  1594. {
  1595. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 20));
  1596. }
  1597. static inline void SET_BA_CAM_UID(void *h2c, u32 val)
  1598. {
  1599. le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(7, 0));
  1600. }
  1601. static inline void SET_BA_CAM_STD_EN(void *h2c, u32 val)
  1602. {
  1603. le32p_replace_bits((__le32 *)h2c + 1, val, BIT(8));
  1604. }
  1605. static inline void SET_BA_CAM_BAND(void *h2c, u32 val)
  1606. {
  1607. le32p_replace_bits((__le32 *)h2c + 1, val, BIT(9));
  1608. }
  1609. static inline void SET_BA_CAM_ENTRY_IDX_V1(void *h2c, u32 val)
  1610. {
  1611. le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(31, 28));
  1612. }
  1613. static inline void SET_LPS_PARM_MACID(void *h2c, u32 val)
  1614. {
  1615. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
  1616. }
  1617. static inline void SET_LPS_PARM_PSMODE(void *h2c, u32 val)
  1618. {
  1619. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1620. }
  1621. static inline void SET_LPS_PARM_RLBM(void *h2c, u32 val)
  1622. {
  1623. le32p_replace_bits((__le32 *)h2c, val, GENMASK(19, 16));
  1624. }
  1625. static inline void SET_LPS_PARM_SMARTPS(void *h2c, u32 val)
  1626. {
  1627. le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 20));
  1628. }
  1629. static inline void SET_LPS_PARM_AWAKEINTERVAL(void *h2c, u32 val)
  1630. {
  1631. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
  1632. }
  1633. static inline void SET_LPS_PARM_VOUAPSD(void *h2c, u32 val)
  1634. {
  1635. le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(0));
  1636. }
  1637. static inline void SET_LPS_PARM_VIUAPSD(void *h2c, u32 val)
  1638. {
  1639. le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(1));
  1640. }
  1641. static inline void SET_LPS_PARM_BEUAPSD(void *h2c, u32 val)
  1642. {
  1643. le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(2));
  1644. }
  1645. static inline void SET_LPS_PARM_BKUAPSD(void *h2c, u32 val)
  1646. {
  1647. le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(3));
  1648. }
  1649. static inline void SET_LPS_PARM_LASTRPWM(void *h2c, u32 val)
  1650. {
  1651. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(15, 8));
  1652. }
  1653. static inline void RTW89_SET_FWCMD_CPU_EXCEPTION_TYPE(void *cmd, u32 val)
  1654. {
  1655. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 0));
  1656. }
  1657. static inline void RTW89_SET_FWCMD_PKT_DROP_SEL(void *cmd, u32 val)
  1658. {
  1659. le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
  1660. }
  1661. static inline void RTW89_SET_FWCMD_PKT_DROP_MACID(void *cmd, u32 val)
  1662. {
  1663. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
  1664. }
  1665. static inline void RTW89_SET_FWCMD_PKT_DROP_BAND(void *cmd, u32 val)
  1666. {
  1667. le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
  1668. }
  1669. static inline void RTW89_SET_FWCMD_PKT_DROP_PORT(void *cmd, u32 val)
  1670. {
  1671. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
  1672. }
  1673. static inline void RTW89_SET_FWCMD_PKT_DROP_MBSSID(void *cmd, u32 val)
  1674. {
  1675. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(7, 0));
  1676. }
  1677. static inline void RTW89_SET_FWCMD_PKT_DROP_ROLE_A_INFO_TF_TRS(void *cmd, u32 val)
  1678. {
  1679. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(15, 8));
  1680. }
  1681. static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_0(void *cmd, u32 val)
  1682. {
  1683. le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
  1684. }
  1685. static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_1(void *cmd, u32 val)
  1686. {
  1687. le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(31, 0));
  1688. }
  1689. static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_2(void *cmd, u32 val)
  1690. {
  1691. le32p_replace_bits((__le32 *)cmd + 4, val, GENMASK(31, 0));
  1692. }
  1693. static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_3(void *cmd, u32 val)
  1694. {
  1695. le32p_replace_bits((__le32 *)cmd + 5, val, GENMASK(31, 0));
  1696. }
  1697. static inline void RTW89_SET_KEEP_ALIVE_ENABLE(void *h2c, u32 val)
  1698. {
  1699. le32p_replace_bits((__le32 *)h2c, val, GENMASK(1, 0));
  1700. }
  1701. static inline void RTW89_SET_KEEP_ALIVE_PKT_NULL_ID(void *h2c, u32 val)
  1702. {
  1703. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1704. }
  1705. static inline void RTW89_SET_KEEP_ALIVE_PERIOD(void *h2c, u32 val)
  1706. {
  1707. le32p_replace_bits((__le32 *)h2c, val, GENMASK(24, 16));
  1708. }
  1709. static inline void RTW89_SET_KEEP_ALIVE_MACID(void *h2c, u32 val)
  1710. {
  1711. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
  1712. }
  1713. static inline void RTW89_SET_DISCONNECT_DETECT_ENABLE(void *h2c, u32 val)
  1714. {
  1715. le32p_replace_bits((__le32 *)h2c, val, BIT(0));
  1716. }
  1717. static inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_EN(void *h2c, u32 val)
  1718. {
  1719. le32p_replace_bits((__le32 *)h2c, val, BIT(1));
  1720. }
  1721. static inline void RTW89_SET_DISCONNECT_DETECT_DISCONNECT(void *h2c, u32 val)
  1722. {
  1723. le32p_replace_bits((__le32 *)h2c, val, BIT(2));
  1724. }
  1725. static inline void RTW89_SET_DISCONNECT_DETECT_MAC_ID(void *h2c, u32 val)
  1726. {
  1727. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1728. }
  1729. static inline void RTW89_SET_DISCONNECT_DETECT_CHECK_PERIOD(void *h2c, u32 val)
  1730. {
  1731. le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
  1732. }
  1733. static inline void RTW89_SET_DISCONNECT_DETECT_TRY_PKT_COUNT(void *h2c, u32 val)
  1734. {
  1735. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
  1736. }
  1737. static inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_LIMIT(void *h2c, u32 val)
  1738. {
  1739. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
  1740. }
  1741. static inline void RTW89_SET_WOW_GLOBAL_ENABLE(void *h2c, u32 val)
  1742. {
  1743. le32p_replace_bits((__le32 *)h2c, val, BIT(0));
  1744. }
  1745. static inline void RTW89_SET_WOW_GLOBAL_DROP_ALL_PKT(void *h2c, u32 val)
  1746. {
  1747. le32p_replace_bits((__le32 *)h2c, val, BIT(1));
  1748. }
  1749. static inline void RTW89_SET_WOW_GLOBAL_RX_PARSE_AFTER_WAKE(void *h2c, u32 val)
  1750. {
  1751. le32p_replace_bits((__le32 *)h2c, val, BIT(2));
  1752. }
  1753. static inline void RTW89_SET_WOW_GLOBAL_WAKE_BAR_PULLED(void *h2c, u32 val)
  1754. {
  1755. le32p_replace_bits((__le32 *)h2c, val, BIT(3));
  1756. }
  1757. static inline void RTW89_SET_WOW_GLOBAL_MAC_ID(void *h2c, u32 val)
  1758. {
  1759. le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
  1760. }
  1761. static inline void RTW89_SET_WOW_GLOBAL_PAIRWISE_SEC_ALGO(void *h2c, u32 val)
  1762. {
  1763. le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
  1764. }
  1765. static inline void RTW89_SET_WOW_GLOBAL_GROUP_SEC_ALGO(void *h2c, u32 val)
  1766. {
  1767. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
  1768. }
  1769. static inline void RTW89_SET_WOW_GLOBAL_REMOTECTRL_INFO_CONTENT(void *h2c, u32 val)
  1770. {
  1771. le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(31, 0));
  1772. }
  1773. static inline void RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(void *h2c, u32 val)
  1774. {
  1775. le32p_replace_bits((__le32 *)h2c, val, BIT(0));
  1776. }
  1777. static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAGIC_ENABLE(void *h2c, u32 val)
  1778. {
  1779. le32p_replace_bits((__le32 *)h2c, val, BIT(1));
  1780. }
  1781. static inline void RTW89_SET_WOW_WAKEUP_CTRL_HW_UNICAST_ENABLE(void *h2c, u32 val)
  1782. {
  1783. le32p_replace_bits((__le32 *)h2c, val, BIT(2));
  1784. }
  1785. static inline void RTW89_SET_WOW_WAKEUP_CTRL_FW_UNICAST_ENABLE(void *h2c, u32 val)
  1786. {
  1787. le32p_replace_bits((__le32 *)h2c, val, BIT(3));
  1788. }
  1789. static inline void RTW89_SET_WOW_WAKEUP_CTRL_DEAUTH_ENABLE(void *h2c, u32 val)
  1790. {
  1791. le32p_replace_bits((__le32 *)h2c, val, BIT(4));
  1792. }
  1793. static inline void RTW89_SET_WOW_WAKEUP_CTRL_REKEYP_ENABLE(void *h2c, u32 val)
  1794. {
  1795. le32p_replace_bits((__le32 *)h2c, val, BIT(5));
  1796. }
  1797. static inline void RTW89_SET_WOW_WAKEUP_CTRL_EAP_ENABLE(void *h2c, u32 val)
  1798. {
  1799. le32p_replace_bits((__le32 *)h2c, val, BIT(6));
  1800. }
  1801. static inline void RTW89_SET_WOW_WAKEUP_CTRL_ALL_DATA_ENABLE(void *h2c, u32 val)
  1802. {
  1803. le32p_replace_bits((__le32 *)h2c, val, BIT(7));
  1804. }
  1805. static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(void *h2c, u32 val)
  1806. {
  1807. le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
  1808. }
  1809. static inline void RTW89_SET_WOW_CAM_UPD_R_W(void *h2c, u32 val)
  1810. {
  1811. le32p_replace_bits((__le32 *)h2c, val, BIT(0));
  1812. }
  1813. static inline void RTW89_SET_WOW_CAM_UPD_IDX(void *h2c, u32 val)
  1814. {
  1815. le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 1));
  1816. }
  1817. static inline void RTW89_SET_WOW_CAM_UPD_WKFM1(void *h2c, u32 val)
  1818. {
  1819. le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(31, 0));
  1820. }
  1821. static inline void RTW89_SET_WOW_CAM_UPD_WKFM2(void *h2c, u32 val)
  1822. {
  1823. le32p_replace_bits((__le32 *)h2c + 2, val, GENMASK(31, 0));
  1824. }
  1825. static inline void RTW89_SET_WOW_CAM_UPD_WKFM3(void *h2c, u32 val)
  1826. {
  1827. le32p_replace_bits((__le32 *)h2c + 3, val, GENMASK(31, 0));
  1828. }
  1829. static inline void RTW89_SET_WOW_CAM_UPD_WKFM4(void *h2c, u32 val)
  1830. {
  1831. le32p_replace_bits((__le32 *)h2c + 4, val, GENMASK(31, 0));
  1832. }
  1833. static inline void RTW89_SET_WOW_CAM_UPD_CRC(void *h2c, u32 val)
  1834. {
  1835. le32p_replace_bits((__le32 *)h2c + 5, val, GENMASK(15, 0));
  1836. }
  1837. static inline void RTW89_SET_WOW_CAM_UPD_NEGATIVE_PATTERN_MATCH(void *h2c, u32 val)
  1838. {
  1839. le32p_replace_bits((__le32 *)h2c + 5, val, BIT(22));
  1840. }
  1841. static inline void RTW89_SET_WOW_CAM_UPD_SKIP_MAC_HDR(void *h2c, u32 val)
  1842. {
  1843. le32p_replace_bits((__le32 *)h2c + 5, val, BIT(23));
  1844. }
  1845. static inline void RTW89_SET_WOW_CAM_UPD_UC(void *h2c, u32 val)
  1846. {
  1847. le32p_replace_bits((__le32 *)h2c + 5, val, BIT(24));
  1848. }
  1849. static inline void RTW89_SET_WOW_CAM_UPD_MC(void *h2c, u32 val)
  1850. {
  1851. le32p_replace_bits((__le32 *)h2c + 5, val, BIT(25));
  1852. }
  1853. static inline void RTW89_SET_WOW_CAM_UPD_BC(void *h2c, u32 val)
  1854. {
  1855. le32p_replace_bits((__le32 *)h2c + 5, val, BIT(26));
  1856. }
  1857. static inline void RTW89_SET_WOW_CAM_UPD_VALID(void *h2c, u32 val)
  1858. {
  1859. le32p_replace_bits((__le32 *)h2c + 5, val, BIT(31));
  1860. }
  1861. enum rtw89_btc_btf_h2c_class {
  1862. BTFC_SET = 0x10,
  1863. BTFC_GET = 0x11,
  1864. BTFC_FW_EVENT = 0x12,
  1865. };
  1866. enum rtw89_btc_btf_set {
  1867. SET_REPORT_EN = 0x0,
  1868. SET_SLOT_TABLE,
  1869. SET_MREG_TABLE,
  1870. SET_CX_POLICY,
  1871. SET_GPIO_DBG,
  1872. SET_DRV_INFO,
  1873. SET_DRV_EVENT,
  1874. SET_BT_WREG_ADDR,
  1875. SET_BT_WREG_VAL,
  1876. SET_BT_RREG_ADDR,
  1877. SET_BT_WL_CH_INFO,
  1878. SET_BT_INFO_REPORT,
  1879. SET_BT_IGNORE_WLAN_ACT,
  1880. SET_BT_TX_PWR,
  1881. SET_BT_LNA_CONSTRAIN,
  1882. SET_BT_GOLDEN_RX_RANGE,
  1883. SET_BT_PSD_REPORT,
  1884. SET_H2C_TEST,
  1885. SET_MAX1,
  1886. };
  1887. enum rtw89_btc_cxdrvinfo {
  1888. CXDRVINFO_INIT = 0,
  1889. CXDRVINFO_ROLE,
  1890. CXDRVINFO_DBCC,
  1891. CXDRVINFO_SMAP,
  1892. CXDRVINFO_RFK,
  1893. CXDRVINFO_RUN,
  1894. CXDRVINFO_CTRL,
  1895. CXDRVINFO_SCAN,
  1896. CXDRVINFO_TRX, /* WL traffic to WL fw */
  1897. CXDRVINFO_MAX,
  1898. };
  1899. enum rtw89_scan_mode {
  1900. RTW89_SCAN_IMMEDIATE,
  1901. };
  1902. enum rtw89_scan_type {
  1903. RTW89_SCAN_ONCE,
  1904. };
  1905. static inline void RTW89_SET_FWCMD_CXHDR_TYPE(void *cmd, u8 val)
  1906. {
  1907. u8p_replace_bits((u8 *)(cmd) + 0, val, GENMASK(7, 0));
  1908. }
  1909. static inline void RTW89_SET_FWCMD_CXHDR_LEN(void *cmd, u8 val)
  1910. {
  1911. u8p_replace_bits((u8 *)(cmd) + 1, val, GENMASK(7, 0));
  1912. }
  1913. struct rtw89_h2c_cxhdr {
  1914. u8 type;
  1915. u8 len;
  1916. } __packed;
  1917. #define H2C_LEN_CXDRVHDR sizeof(struct rtw89_h2c_cxhdr)
  1918. struct rtw89_h2c_cxinit {
  1919. struct rtw89_h2c_cxhdr hdr;
  1920. u8 ant_type;
  1921. u8 ant_num;
  1922. u8 ant_iso;
  1923. u8 ant_info;
  1924. u8 mod_rfe;
  1925. u8 mod_cv;
  1926. u8 mod_info;
  1927. u8 mod_adie_kt;
  1928. u8 wl_gch;
  1929. u8 info;
  1930. u8 rsvd;
  1931. u8 rsvd1;
  1932. } __packed;
  1933. #define RTW89_H2C_CXINIT_ANT_INFO_POS BIT(0)
  1934. #define RTW89_H2C_CXINIT_ANT_INFO_DIVERSITY BIT(1)
  1935. #define RTW89_H2C_CXINIT_ANT_INFO_BTG_POS GENMASK(3, 2)
  1936. #define RTW89_H2C_CXINIT_ANT_INFO_STREAM_CNT GENMASK(7, 4)
  1937. #define RTW89_H2C_CXINIT_MOD_INFO_BT_SOLO BIT(0)
  1938. #define RTW89_H2C_CXINIT_MOD_INFO_BT_POS BIT(1)
  1939. #define RTW89_H2C_CXINIT_MOD_INFO_SW_TYPE BIT(2)
  1940. #define RTW89_H2C_CXINIT_MOD_INFO_WA_TYPE GENMASK(5, 3)
  1941. #define RTW89_H2C_CXINIT_INFO_WL_ONLY BIT(0)
  1942. #define RTW89_H2C_CXINIT_INFO_WL_INITOK BIT(1)
  1943. #define RTW89_H2C_CXINIT_INFO_DBCC_EN BIT(2)
  1944. #define RTW89_H2C_CXINIT_INFO_CX_OTHER BIT(3)
  1945. #define RTW89_H2C_CXINIT_INFO_BT_ONLY BIT(4)
  1946. static inline void RTW89_SET_FWCMD_CXROLE_CONNECT_CNT(void *cmd, u8 val)
  1947. {
  1948. u8p_replace_bits((u8 *)(cmd) + 2, val, GENMASK(7, 0));
  1949. }
  1950. static inline void RTW89_SET_FWCMD_CXROLE_LINK_MODE(void *cmd, u8 val)
  1951. {
  1952. u8p_replace_bits((u8 *)(cmd) + 3, val, GENMASK(7, 0));
  1953. }
  1954. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_NONE(void *cmd, u16 val)
  1955. {
  1956. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(0));
  1957. }
  1958. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_STA(void *cmd, u16 val)
  1959. {
  1960. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(1));
  1961. }
  1962. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_AP(void *cmd, u16 val)
  1963. {
  1964. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(2));
  1965. }
  1966. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_VAP(void *cmd, u16 val)
  1967. {
  1968. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(3));
  1969. }
  1970. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_ADHOC(void *cmd, u16 val)
  1971. {
  1972. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(4));
  1973. }
  1974. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_ADHOC_MASTER(void *cmd, u16 val)
  1975. {
  1976. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(5));
  1977. }
  1978. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_MESH(void *cmd, u16 val)
  1979. {
  1980. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(6));
  1981. }
  1982. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_MONITOR(void *cmd, u16 val)
  1983. {
  1984. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(7));
  1985. }
  1986. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_P2P_DEV(void *cmd, u16 val)
  1987. {
  1988. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(8));
  1989. }
  1990. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_P2P_GC(void *cmd, u16 val)
  1991. {
  1992. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(9));
  1993. }
  1994. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_P2P_GO(void *cmd, u16 val)
  1995. {
  1996. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(10));
  1997. }
  1998. static inline void RTW89_SET_FWCMD_CXROLE_ROLE_NAN(void *cmd, u16 val)
  1999. {
  2000. le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(11));
  2001. }
  2002. static inline void RTW89_SET_FWCMD_CXROLE_ACT_CONNECTED(void *cmd, u8 val, int n, u8 offset)
  2003. {
  2004. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(0));
  2005. }
  2006. static inline void RTW89_SET_FWCMD_CXROLE_ACT_PID(void *cmd, u8 val, int n, u8 offset)
  2007. {
  2008. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(3, 1));
  2009. }
  2010. static inline void RTW89_SET_FWCMD_CXROLE_ACT_PHY(void *cmd, u8 val, int n, u8 offset)
  2011. {
  2012. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(4));
  2013. }
  2014. static inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA(void *cmd, u8 val, int n, u8 offset)
  2015. {
  2016. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(5));
  2017. }
  2018. static inline void RTW89_SET_FWCMD_CXROLE_ACT_BAND(void *cmd, u8 val, int n, u8 offset)
  2019. {
  2020. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(7, 6));
  2021. }
  2022. static inline void RTW89_SET_FWCMD_CXROLE_ACT_CLIENT_PS(void *cmd, u8 val, int n, u8 offset)
  2023. {
  2024. u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, BIT(0));
  2025. }
  2026. static inline void RTW89_SET_FWCMD_CXROLE_ACT_BW(void *cmd, u8 val, int n, u8 offset)
  2027. {
  2028. u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, GENMASK(7, 1));
  2029. }
  2030. static inline void RTW89_SET_FWCMD_CXROLE_ACT_ROLE(void *cmd, u8 val, int n, u8 offset)
  2031. {
  2032. u8p_replace_bits((u8 *)cmd + (8 + (12 + offset) * n), val, GENMASK(7, 0));
  2033. }
  2034. static inline void RTW89_SET_FWCMD_CXROLE_ACT_CH(void *cmd, u8 val, int n, u8 offset)
  2035. {
  2036. u8p_replace_bits((u8 *)cmd + (9 + (12 + offset) * n), val, GENMASK(7, 0));
  2037. }
  2038. static inline void RTW89_SET_FWCMD_CXROLE_ACT_TX_LVL(void *cmd, u16 val, int n, u8 offset)
  2039. {
  2040. le16p_replace_bits((__le16 *)((u8 *)cmd + (10 + (12 + offset) * n)), val, GENMASK(15, 0));
  2041. }
  2042. static inline void RTW89_SET_FWCMD_CXROLE_ACT_RX_LVL(void *cmd, u16 val, int n, u8 offset)
  2043. {
  2044. le16p_replace_bits((__le16 *)((u8 *)cmd + (12 + (12 + offset) * n)), val, GENMASK(15, 0));
  2045. }
  2046. static inline void RTW89_SET_FWCMD_CXROLE_ACT_TX_RATE(void *cmd, u16 val, int n, u8 offset)
  2047. {
  2048. le16p_replace_bits((__le16 *)((u8 *)cmd + (14 + (12 + offset) * n)), val, GENMASK(15, 0));
  2049. }
  2050. static inline void RTW89_SET_FWCMD_CXROLE_ACT_RX_RATE(void *cmd, u16 val, int n, u8 offset)
  2051. {
  2052. le16p_replace_bits((__le16 *)((u8 *)cmd + (16 + (12 + offset) * n)), val, GENMASK(15, 0));
  2053. }
  2054. static inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA_DUR(void *cmd, u32 val, int n, u8 offset)
  2055. {
  2056. le32p_replace_bits((__le32 *)((u8 *)cmd + (20 + (12 + offset) * n)), val, GENMASK(31, 0));
  2057. }
  2058. static inline void RTW89_SET_FWCMD_CXROLE_ACT_CONNECTED_V2(void *cmd, u8 val, int n, u8 offset)
  2059. {
  2060. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(0));
  2061. }
  2062. static inline void RTW89_SET_FWCMD_CXROLE_ACT_PID_V2(void *cmd, u8 val, int n, u8 offset)
  2063. {
  2064. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(3, 1));
  2065. }
  2066. static inline void RTW89_SET_FWCMD_CXROLE_ACT_PHY_V2(void *cmd, u8 val, int n, u8 offset)
  2067. {
  2068. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(4));
  2069. }
  2070. static inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA_V2(void *cmd, u8 val, int n, u8 offset)
  2071. {
  2072. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(5));
  2073. }
  2074. static inline void RTW89_SET_FWCMD_CXROLE_ACT_BAND_V2(void *cmd, u8 val, int n, u8 offset)
  2075. {
  2076. u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(7, 6));
  2077. }
  2078. static inline void RTW89_SET_FWCMD_CXROLE_ACT_CLIENT_PS_V2(void *cmd, u8 val, int n, u8 offset)
  2079. {
  2080. u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, BIT(0));
  2081. }
  2082. static inline void RTW89_SET_FWCMD_CXROLE_ACT_BW_V2(void *cmd, u8 val, int n, u8 offset)
  2083. {
  2084. u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, GENMASK(7, 1));
  2085. }
  2086. static inline void RTW89_SET_FWCMD_CXROLE_ACT_ROLE_V2(void *cmd, u8 val, int n, u8 offset)
  2087. {
  2088. u8p_replace_bits((u8 *)cmd + (8 + (12 + offset) * n), val, GENMASK(7, 0));
  2089. }
  2090. static inline void RTW89_SET_FWCMD_CXROLE_ACT_CH_V2(void *cmd, u8 val, int n, u8 offset)
  2091. {
  2092. u8p_replace_bits((u8 *)cmd + (9 + (12 + offset) * n), val, GENMASK(7, 0));
  2093. }
  2094. static inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA_DUR_V2(void *cmd, u32 val, int n, u8 offset)
  2095. {
  2096. le32p_replace_bits((__le32 *)((u8 *)cmd + (10 + (12 + offset) * n)), val, GENMASK(31, 0));
  2097. }
  2098. static inline void RTW89_SET_FWCMD_CXROLE_MROLE_TYPE(void *cmd, u32 val, u8 offset)
  2099. {
  2100. le32p_replace_bits((__le32 *)((u8 *)cmd + offset), val, GENMASK(31, 0));
  2101. }
  2102. static inline void RTW89_SET_FWCMD_CXROLE_MROLE_NOA(void *cmd, u32 val, u8 offset)
  2103. {
  2104. le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 4), val, GENMASK(31, 0));
  2105. }
  2106. static inline void RTW89_SET_FWCMD_CXROLE_DBCC_EN(void *cmd, u32 val, u8 offset)
  2107. {
  2108. le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, BIT(0));
  2109. }
  2110. static inline void RTW89_SET_FWCMD_CXROLE_DBCC_CHG(void *cmd, u32 val, u8 offset)
  2111. {
  2112. le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, BIT(1));
  2113. }
  2114. static inline void RTW89_SET_FWCMD_CXROLE_DBCC_2G_PHY(void *cmd, u32 val, u8 offset)
  2115. {
  2116. le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, GENMASK(3, 2));
  2117. }
  2118. static inline void RTW89_SET_FWCMD_CXROLE_LINK_MODE_CHG(void *cmd, u32 val, u8 offset)
  2119. {
  2120. le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, BIT(4));
  2121. }
  2122. static inline void RTW89_SET_FWCMD_CXCTRL_MANUAL(void *cmd, u32 val)
  2123. {
  2124. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, BIT(0));
  2125. }
  2126. static inline void RTW89_SET_FWCMD_CXCTRL_IGNORE_BT(void *cmd, u32 val)
  2127. {
  2128. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, BIT(1));
  2129. }
  2130. static inline void RTW89_SET_FWCMD_CXCTRL_ALWAYS_FREERUN(void *cmd, u32 val)
  2131. {
  2132. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, BIT(2));
  2133. }
  2134. static inline void RTW89_SET_FWCMD_CXCTRL_TRACE_STEP(void *cmd, u32 val)
  2135. {
  2136. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(18, 3));
  2137. }
  2138. static inline void RTW89_SET_FWCMD_CXTRX_TXLV(void *cmd, u8 val)
  2139. {
  2140. u8p_replace_bits((u8 *)cmd + 2, val, GENMASK(7, 0));
  2141. }
  2142. static inline void RTW89_SET_FWCMD_CXTRX_RXLV(void *cmd, u8 val)
  2143. {
  2144. u8p_replace_bits((u8 *)cmd + 3, val, GENMASK(7, 0));
  2145. }
  2146. static inline void RTW89_SET_FWCMD_CXTRX_WLRSSI(void *cmd, u8 val)
  2147. {
  2148. u8p_replace_bits((u8 *)cmd + 4, val, GENMASK(7, 0));
  2149. }
  2150. static inline void RTW89_SET_FWCMD_CXTRX_BTRSSI(void *cmd, u8 val)
  2151. {
  2152. u8p_replace_bits((u8 *)cmd + 5, val, GENMASK(7, 0));
  2153. }
  2154. static inline void RTW89_SET_FWCMD_CXTRX_TXPWR(void *cmd, s8 val)
  2155. {
  2156. u8p_replace_bits((u8 *)cmd + 6, val, GENMASK(7, 0));
  2157. }
  2158. static inline void RTW89_SET_FWCMD_CXTRX_RXGAIN(void *cmd, s8 val)
  2159. {
  2160. u8p_replace_bits((u8 *)cmd + 7, val, GENMASK(7, 0));
  2161. }
  2162. static inline void RTW89_SET_FWCMD_CXTRX_BTTXPWR(void *cmd, s8 val)
  2163. {
  2164. u8p_replace_bits((u8 *)cmd + 8, val, GENMASK(7, 0));
  2165. }
  2166. static inline void RTW89_SET_FWCMD_CXTRX_BTRXGAIN(void *cmd, s8 val)
  2167. {
  2168. u8p_replace_bits((u8 *)cmd + 9, val, GENMASK(7, 0));
  2169. }
  2170. static inline void RTW89_SET_FWCMD_CXTRX_CN(void *cmd, u8 val)
  2171. {
  2172. u8p_replace_bits((u8 *)cmd + 10, val, GENMASK(7, 0));
  2173. }
  2174. static inline void RTW89_SET_FWCMD_CXTRX_NHM(void *cmd, s8 val)
  2175. {
  2176. u8p_replace_bits((u8 *)cmd + 11, val, GENMASK(7, 0));
  2177. }
  2178. static inline void RTW89_SET_FWCMD_CXTRX_BTPROFILE(void *cmd, u8 val)
  2179. {
  2180. u8p_replace_bits((u8 *)cmd + 12, val, GENMASK(7, 0));
  2181. }
  2182. static inline void RTW89_SET_FWCMD_CXTRX_RSVD2(void *cmd, u8 val)
  2183. {
  2184. u8p_replace_bits((u8 *)cmd + 13, val, GENMASK(7, 0));
  2185. }
  2186. static inline void RTW89_SET_FWCMD_CXTRX_TXRATE(void *cmd, u16 val)
  2187. {
  2188. le16p_replace_bits((__le16 *)((u8 *)cmd + 14), val, GENMASK(15, 0));
  2189. }
  2190. static inline void RTW89_SET_FWCMD_CXTRX_RXRATE(void *cmd, u16 val)
  2191. {
  2192. le16p_replace_bits((__le16 *)((u8 *)cmd + 16), val, GENMASK(15, 0));
  2193. }
  2194. static inline void RTW89_SET_FWCMD_CXTRX_TXTP(void *cmd, u32 val)
  2195. {
  2196. le32p_replace_bits((__le32 *)((u8 *)cmd + 18), val, GENMASK(31, 0));
  2197. }
  2198. static inline void RTW89_SET_FWCMD_CXTRX_RXTP(void *cmd, u32 val)
  2199. {
  2200. le32p_replace_bits((__le32 *)((u8 *)cmd + 22), val, GENMASK(31, 0));
  2201. }
  2202. static inline void RTW89_SET_FWCMD_CXTRX_RXERRRA(void *cmd, u32 val)
  2203. {
  2204. le32p_replace_bits((__le32 *)((u8 *)cmd + 26), val, GENMASK(31, 0));
  2205. }
  2206. static inline void RTW89_SET_FWCMD_CXRFK_STATE(void *cmd, u32 val)
  2207. {
  2208. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(1, 0));
  2209. }
  2210. static inline void RTW89_SET_FWCMD_CXRFK_PATH_MAP(void *cmd, u32 val)
  2211. {
  2212. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(5, 2));
  2213. }
  2214. static inline void RTW89_SET_FWCMD_CXRFK_PHY_MAP(void *cmd, u32 val)
  2215. {
  2216. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(7, 6));
  2217. }
  2218. static inline void RTW89_SET_FWCMD_CXRFK_BAND(void *cmd, u32 val)
  2219. {
  2220. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(9, 8));
  2221. }
  2222. static inline void RTW89_SET_FWCMD_CXRFK_TYPE(void *cmd, u32 val)
  2223. {
  2224. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(17, 10));
  2225. }
  2226. static inline void RTW89_SET_FWCMD_PACKET_OFLD_PKT_IDX(void *cmd, u32 val)
  2227. {
  2228. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(7, 0));
  2229. }
  2230. static inline void RTW89_SET_FWCMD_PACKET_OFLD_PKT_OP(void *cmd, u32 val)
  2231. {
  2232. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(10, 8));
  2233. }
  2234. static inline void RTW89_SET_FWCMD_PACKET_OFLD_PKT_LENGTH(void *cmd, u32 val)
  2235. {
  2236. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(31, 16));
  2237. }
  2238. static inline void RTW89_SET_FWCMD_SCANOFLD_CH_NUM(void *cmd, u32 val)
  2239. {
  2240. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(7, 0));
  2241. }
  2242. static inline void RTW89_SET_FWCMD_SCANOFLD_CH_SIZE(void *cmd, u32 val)
  2243. {
  2244. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(15, 8));
  2245. }
  2246. static inline void RTW89_SET_FWCMD_CHINFO_PERIOD(void *cmd, u32 val)
  2247. {
  2248. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(7, 0));
  2249. }
  2250. static inline void RTW89_SET_FWCMD_CHINFO_DWELL(void *cmd, u32 val)
  2251. {
  2252. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(15, 8));
  2253. }
  2254. static inline void RTW89_SET_FWCMD_CHINFO_CENTER_CH(void *cmd, u32 val)
  2255. {
  2256. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(23, 16));
  2257. }
  2258. static inline void RTW89_SET_FWCMD_CHINFO_PRI_CH(void *cmd, u32 val)
  2259. {
  2260. le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(31, 24));
  2261. }
  2262. static inline void RTW89_SET_FWCMD_CHINFO_BW(void *cmd, u32 val)
  2263. {
  2264. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(2, 0));
  2265. }
  2266. static inline void RTW89_SET_FWCMD_CHINFO_ACTION(void *cmd, u32 val)
  2267. {
  2268. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(7, 3));
  2269. }
  2270. static inline void RTW89_SET_FWCMD_CHINFO_NUM_PKT(void *cmd, u32 val)
  2271. {
  2272. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(11, 8));
  2273. }
  2274. static inline void RTW89_SET_FWCMD_CHINFO_TX(void *cmd, u32 val)
  2275. {
  2276. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(12));
  2277. }
  2278. static inline void RTW89_SET_FWCMD_CHINFO_PAUSE_DATA(void *cmd, u32 val)
  2279. {
  2280. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(13));
  2281. }
  2282. static inline void RTW89_SET_FWCMD_CHINFO_BAND(void *cmd, u32 val)
  2283. {
  2284. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(15, 14));
  2285. }
  2286. static inline void RTW89_SET_FWCMD_CHINFO_PKT_ID(void *cmd, u32 val)
  2287. {
  2288. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(23, 16));
  2289. }
  2290. static inline void RTW89_SET_FWCMD_CHINFO_DFS(void *cmd, u32 val)
  2291. {
  2292. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(24));
  2293. }
  2294. static inline void RTW89_SET_FWCMD_CHINFO_TX_NULL(void *cmd, u32 val)
  2295. {
  2296. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(25));
  2297. }
  2298. static inline void RTW89_SET_FWCMD_CHINFO_RANDOM(void *cmd, u32 val)
  2299. {
  2300. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(26));
  2301. }
  2302. static inline void RTW89_SET_FWCMD_CHINFO_CFG_TX(void *cmd, u32 val)
  2303. {
  2304. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(27));
  2305. }
  2306. static inline void RTW89_SET_FWCMD_CHINFO_PKT0(void *cmd, u32 val)
  2307. {
  2308. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(7, 0));
  2309. }
  2310. static inline void RTW89_SET_FWCMD_CHINFO_PKT1(void *cmd, u32 val)
  2311. {
  2312. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(15, 8));
  2313. }
  2314. static inline void RTW89_SET_FWCMD_CHINFO_PKT2(void *cmd, u32 val)
  2315. {
  2316. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(23, 16));
  2317. }
  2318. static inline void RTW89_SET_FWCMD_CHINFO_PKT3(void *cmd, u32 val)
  2319. {
  2320. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(31, 24));
  2321. }
  2322. static inline void RTW89_SET_FWCMD_CHINFO_PKT4(void *cmd, u32 val)
  2323. {
  2324. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(7, 0));
  2325. }
  2326. static inline void RTW89_SET_FWCMD_CHINFO_PKT5(void *cmd, u32 val)
  2327. {
  2328. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(15, 8));
  2329. }
  2330. static inline void RTW89_SET_FWCMD_CHINFO_PKT6(void *cmd, u32 val)
  2331. {
  2332. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(23, 16));
  2333. }
  2334. static inline void RTW89_SET_FWCMD_CHINFO_PKT7(void *cmd, u32 val)
  2335. {
  2336. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(31, 24));
  2337. }
  2338. static inline void RTW89_SET_FWCMD_CHINFO_POWER_IDX(void *cmd, u32 val)
  2339. {
  2340. le32p_replace_bits((__le32 *)((u8 *)(cmd) + 16), val, GENMASK(15, 0));
  2341. }
  2342. struct rtw89_h2c_scanofld {
  2343. __le32 w0;
  2344. __le32 w1;
  2345. __le32 w2;
  2346. __le32 tsf_high;
  2347. __le32 tsf_low;
  2348. __le32 w5;
  2349. __le32 w6;
  2350. } __packed;
  2351. #define RTW89_H2C_SCANOFLD_W0_MACID GENMASK(7, 0)
  2352. #define RTW89_H2C_SCANOFLD_W0_NORM_CY GENMASK(15, 8)
  2353. #define RTW89_H2C_SCANOFLD_W0_PORT_ID GENMASK(18, 16)
  2354. #define RTW89_H2C_SCANOFLD_W0_BAND BIT(19)
  2355. #define RTW89_H2C_SCANOFLD_W0_OPERATION GENMASK(21, 20)
  2356. #define RTW89_H2C_SCANOFLD_W0_TARGET_CH_BAND GENMASK(23, 22)
  2357. #define RTW89_H2C_SCANOFLD_W1_NOTIFY_END BIT(0)
  2358. #define RTW89_H2C_SCANOFLD_W1_TARGET_CH_MODE BIT(1)
  2359. #define RTW89_H2C_SCANOFLD_W1_START_MODE BIT(2)
  2360. #define RTW89_H2C_SCANOFLD_W1_SCAN_TYPE GENMASK(4, 3)
  2361. #define RTW89_H2C_SCANOFLD_W1_TARGET_CH_BW GENMASK(7, 5)
  2362. #define RTW89_H2C_SCANOFLD_W1_TARGET_PRI_CH GENMASK(15, 8)
  2363. #define RTW89_H2C_SCANOFLD_W1_TARGET_CENTRAL_CH GENMASK(23, 16)
  2364. #define RTW89_H2C_SCANOFLD_W1_PROBE_REQ_PKT_ID GENMASK(31, 24)
  2365. #define RTW89_H2C_SCANOFLD_W2_NORM_PD GENMASK(15, 0)
  2366. #define RTW89_H2C_SCANOFLD_W2_SLOW_PD GENMASK(23, 16)
  2367. static inline void RTW89_SET_FWCMD_P2P_MACID(void *cmd, u32 val)
  2368. {
  2369. le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
  2370. }
  2371. static inline void RTW89_SET_FWCMD_P2P_P2PID(void *cmd, u32 val)
  2372. {
  2373. le32p_replace_bits((__le32 *)cmd, val, GENMASK(11, 8));
  2374. }
  2375. static inline void RTW89_SET_FWCMD_P2P_NOAID(void *cmd, u32 val)
  2376. {
  2377. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 12));
  2378. }
  2379. static inline void RTW89_SET_FWCMD_P2P_ACT(void *cmd, u32 val)
  2380. {
  2381. le32p_replace_bits((__le32 *)cmd, val, GENMASK(19, 16));
  2382. }
  2383. static inline void RTW89_SET_FWCMD_P2P_TYPE(void *cmd, u32 val)
  2384. {
  2385. le32p_replace_bits((__le32 *)cmd, val, BIT(20));
  2386. }
  2387. static inline void RTW89_SET_FWCMD_P2P_ALL_SLEP(void *cmd, u32 val)
  2388. {
  2389. le32p_replace_bits((__le32 *)cmd, val, BIT(21));
  2390. }
  2391. static inline void RTW89_SET_FWCMD_NOA_START_TIME(void *cmd, __le32 val)
  2392. {
  2393. *((__le32 *)cmd + 1) = val;
  2394. }
  2395. static inline void RTW89_SET_FWCMD_NOA_INTERVAL(void *cmd, __le32 val)
  2396. {
  2397. *((__le32 *)cmd + 2) = val;
  2398. }
  2399. static inline void RTW89_SET_FWCMD_NOA_DURATION(void *cmd, __le32 val)
  2400. {
  2401. *((__le32 *)cmd + 3) = val;
  2402. }
  2403. static inline void RTW89_SET_FWCMD_NOA_COUNT(void *cmd, u32 val)
  2404. {
  2405. le32p_replace_bits((__le32 *)(cmd) + 4, val, GENMASK(7, 0));
  2406. }
  2407. static inline void RTW89_SET_FWCMD_NOA_CTWINDOW(void *cmd, u32 val)
  2408. {
  2409. u8 ctwnd;
  2410. if (!(val & IEEE80211_P2P_OPPPS_ENABLE_BIT))
  2411. return;
  2412. ctwnd = FIELD_GET(IEEE80211_P2P_OPPPS_CTWINDOW_MASK, val);
  2413. le32p_replace_bits((__le32 *)(cmd) + 4, ctwnd, GENMASK(23, 8));
  2414. }
  2415. static inline void RTW89_SET_FWCMD_TSF32_TOGL_BAND(void *cmd, u32 val)
  2416. {
  2417. le32p_replace_bits((__le32 *)cmd, val, BIT(0));
  2418. }
  2419. static inline void RTW89_SET_FWCMD_TSF32_TOGL_EN(void *cmd, u32 val)
  2420. {
  2421. le32p_replace_bits((__le32 *)cmd, val, BIT(1));
  2422. }
  2423. static inline void RTW89_SET_FWCMD_TSF32_TOGL_PORT(void *cmd, u32 val)
  2424. {
  2425. le32p_replace_bits((__le32 *)cmd, val, GENMASK(4, 2));
  2426. }
  2427. static inline void RTW89_SET_FWCMD_TSF32_TOGL_EARLY(void *cmd, u32 val)
  2428. {
  2429. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 16));
  2430. }
  2431. enum rtw89_fw_mcc_c2h_rpt_cfg {
  2432. RTW89_FW_MCC_C2H_RPT_OFF = 0,
  2433. RTW89_FW_MCC_C2H_RPT_FAIL_ONLY = 1,
  2434. RTW89_FW_MCC_C2H_RPT_ALL = 2,
  2435. };
  2436. struct rtw89_fw_mcc_add_req {
  2437. u8 macid;
  2438. u8 central_ch_seg0;
  2439. u8 central_ch_seg1;
  2440. u8 primary_ch;
  2441. enum rtw89_bandwidth bandwidth: 4;
  2442. u32 group: 2;
  2443. u32 c2h_rpt: 2;
  2444. u32 dis_tx_null: 1;
  2445. u32 dis_sw_retry: 1;
  2446. u32 in_curr_ch: 1;
  2447. u32 sw_retry_count: 3;
  2448. u32 tx_null_early: 4;
  2449. u32 btc_in_2g: 1;
  2450. u32 pta_en: 1;
  2451. u32 rfk_by_pass: 1;
  2452. u32 ch_band_type: 2;
  2453. u32 rsvd0: 9;
  2454. u32 duration;
  2455. u8 courtesy_en;
  2456. u8 courtesy_num;
  2457. u8 courtesy_target;
  2458. u8 rsvd1;
  2459. };
  2460. static inline void RTW89_SET_FWCMD_ADD_MCC_MACID(void *cmd, u32 val)
  2461. {
  2462. le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
  2463. }
  2464. static inline void RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG0(void *cmd, u32 val)
  2465. {
  2466. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
  2467. }
  2468. static inline void RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG1(void *cmd, u32 val)
  2469. {
  2470. le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
  2471. }
  2472. static inline void RTW89_SET_FWCMD_ADD_MCC_PRIMARY_CH(void *cmd, u32 val)
  2473. {
  2474. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
  2475. }
  2476. static inline void RTW89_SET_FWCMD_ADD_MCC_BANDWIDTH(void *cmd, u32 val)
  2477. {
  2478. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(3, 0));
  2479. }
  2480. static inline void RTW89_SET_FWCMD_ADD_MCC_GROUP(void *cmd, u32 val)
  2481. {
  2482. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(5, 4));
  2483. }
  2484. static inline void RTW89_SET_FWCMD_ADD_MCC_C2H_RPT(void *cmd, u32 val)
  2485. {
  2486. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(7, 6));
  2487. }
  2488. static inline void RTW89_SET_FWCMD_ADD_MCC_DIS_TX_NULL(void *cmd, u32 val)
  2489. {
  2490. le32p_replace_bits((__le32 *)cmd + 1, val, BIT(8));
  2491. }
  2492. static inline void RTW89_SET_FWCMD_ADD_MCC_DIS_SW_RETRY(void *cmd, u32 val)
  2493. {
  2494. le32p_replace_bits((__le32 *)cmd + 1, val, BIT(9));
  2495. }
  2496. static inline void RTW89_SET_FWCMD_ADD_MCC_IN_CURR_CH(void *cmd, u32 val)
  2497. {
  2498. le32p_replace_bits((__le32 *)cmd + 1, val, BIT(10));
  2499. }
  2500. static inline void RTW89_SET_FWCMD_ADD_MCC_SW_RETRY_COUNT(void *cmd, u32 val)
  2501. {
  2502. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(13, 11));
  2503. }
  2504. static inline void RTW89_SET_FWCMD_ADD_MCC_TX_NULL_EARLY(void *cmd, u32 val)
  2505. {
  2506. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(17, 14));
  2507. }
  2508. static inline void RTW89_SET_FWCMD_ADD_MCC_BTC_IN_2G(void *cmd, u32 val)
  2509. {
  2510. le32p_replace_bits((__le32 *)cmd + 1, val, BIT(18));
  2511. }
  2512. static inline void RTW89_SET_FWCMD_ADD_MCC_PTA_EN(void *cmd, u32 val)
  2513. {
  2514. le32p_replace_bits((__le32 *)cmd + 1, val, BIT(19));
  2515. }
  2516. static inline void RTW89_SET_FWCMD_ADD_MCC_RFK_BY_PASS(void *cmd, u32 val)
  2517. {
  2518. le32p_replace_bits((__le32 *)cmd + 1, val, BIT(20));
  2519. }
  2520. static inline void RTW89_SET_FWCMD_ADD_MCC_CH_BAND_TYPE(void *cmd, u32 val)
  2521. {
  2522. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(22, 21));
  2523. }
  2524. static inline void RTW89_SET_FWCMD_ADD_MCC_DURATION(void *cmd, u32 val)
  2525. {
  2526. le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
  2527. }
  2528. static inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_EN(void *cmd, u32 val)
  2529. {
  2530. le32p_replace_bits((__le32 *)cmd + 3, val, BIT(0));
  2531. }
  2532. static inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_NUM(void *cmd, u32 val)
  2533. {
  2534. le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(15, 8));
  2535. }
  2536. static inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_TARGET(void *cmd, u32 val)
  2537. {
  2538. le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(23, 16));
  2539. }
  2540. enum rtw89_fw_mcc_old_group_actions {
  2541. RTW89_FW_MCC_OLD_GROUP_ACT_NONE = 0,
  2542. RTW89_FW_MCC_OLD_GROUP_ACT_REPLACE = 1,
  2543. };
  2544. struct rtw89_fw_mcc_start_req {
  2545. u32 group: 2;
  2546. u32 btc_in_group: 1;
  2547. u32 old_group_action: 2;
  2548. u32 old_group: 2;
  2549. u32 rsvd0: 9;
  2550. u32 notify_cnt: 3;
  2551. u32 rsvd1: 2;
  2552. u32 notify_rxdbg_en: 1;
  2553. u32 rsvd2: 2;
  2554. u32 macid: 8;
  2555. u32 tsf_low;
  2556. u32 tsf_high;
  2557. };
  2558. static inline void RTW89_SET_FWCMD_START_MCC_GROUP(void *cmd, u32 val)
  2559. {
  2560. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2561. }
  2562. static inline void RTW89_SET_FWCMD_START_MCC_BTC_IN_GROUP(void *cmd, u32 val)
  2563. {
  2564. le32p_replace_bits((__le32 *)cmd, val, BIT(2));
  2565. }
  2566. static inline void RTW89_SET_FWCMD_START_MCC_OLD_GROUP_ACTION(void *cmd, u32 val)
  2567. {
  2568. le32p_replace_bits((__le32 *)cmd, val, GENMASK(4, 3));
  2569. }
  2570. static inline void RTW89_SET_FWCMD_START_MCC_OLD_GROUP(void *cmd, u32 val)
  2571. {
  2572. le32p_replace_bits((__le32 *)cmd, val, GENMASK(6, 5));
  2573. }
  2574. static inline void RTW89_SET_FWCMD_START_MCC_NOTIFY_CNT(void *cmd, u32 val)
  2575. {
  2576. le32p_replace_bits((__le32 *)cmd, val, GENMASK(18, 16));
  2577. }
  2578. static inline void RTW89_SET_FWCMD_START_MCC_NOTIFY_RXDBG_EN(void *cmd, u32 val)
  2579. {
  2580. le32p_replace_bits((__le32 *)cmd, val, BIT(21));
  2581. }
  2582. static inline void RTW89_SET_FWCMD_START_MCC_MACID(void *cmd, u32 val)
  2583. {
  2584. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
  2585. }
  2586. static inline void RTW89_SET_FWCMD_START_MCC_TSF_LOW(void *cmd, u32 val)
  2587. {
  2588. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(31, 0));
  2589. }
  2590. static inline void RTW89_SET_FWCMD_START_MCC_TSF_HIGH(void *cmd, u32 val)
  2591. {
  2592. le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
  2593. }
  2594. static inline void RTW89_SET_FWCMD_STOP_MCC_MACID(void *cmd, u32 val)
  2595. {
  2596. le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
  2597. }
  2598. static inline void RTW89_SET_FWCMD_STOP_MCC_GROUP(void *cmd, u32 val)
  2599. {
  2600. le32p_replace_bits((__le32 *)cmd, val, GENMASK(9, 8));
  2601. }
  2602. static inline void RTW89_SET_FWCMD_STOP_MCC_PREV_GROUPS(void *cmd, u32 val)
  2603. {
  2604. le32p_replace_bits((__le32 *)cmd, val, BIT(10));
  2605. }
  2606. static inline void RTW89_SET_FWCMD_DEL_MCC_GROUP_GROUP(void *cmd, u32 val)
  2607. {
  2608. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2609. }
  2610. static inline void RTW89_SET_FWCMD_DEL_MCC_GROUP_PREV_GROUPS(void *cmd, u32 val)
  2611. {
  2612. le32p_replace_bits((__le32 *)cmd, val, BIT(2));
  2613. }
  2614. static inline void RTW89_SET_FWCMD_RESET_MCC_GROUP_GROUP(void *cmd, u32 val)
  2615. {
  2616. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2617. }
  2618. struct rtw89_fw_mcc_tsf_req {
  2619. u8 group: 2;
  2620. u8 rsvd0: 6;
  2621. u8 macid_x;
  2622. u8 macid_y;
  2623. u8 rsvd1;
  2624. };
  2625. static inline void RTW89_SET_FWCMD_MCC_REQ_TSF_GROUP(void *cmd, u32 val)
  2626. {
  2627. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2628. }
  2629. static inline void RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_X(void *cmd, u32 val)
  2630. {
  2631. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
  2632. }
  2633. static inline void RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_Y(void *cmd, u32 val)
  2634. {
  2635. le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
  2636. }
  2637. static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_GROUP(void *cmd, u32 val)
  2638. {
  2639. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2640. }
  2641. static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_MACID(void *cmd, u32 val)
  2642. {
  2643. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
  2644. }
  2645. static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP_LENGTH(void *cmd, u32 val)
  2646. {
  2647. le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
  2648. }
  2649. static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP(void *cmd,
  2650. u8 *bitmap, u8 len)
  2651. {
  2652. memcpy((__le32 *)cmd + 1, bitmap, len);
  2653. }
  2654. static inline void RTW89_SET_FWCMD_MCC_SYNC_GROUP(void *cmd, u32 val)
  2655. {
  2656. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2657. }
  2658. static inline void RTW89_SET_FWCMD_MCC_SYNC_MACID_SOURCE(void *cmd, u32 val)
  2659. {
  2660. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
  2661. }
  2662. static inline void RTW89_SET_FWCMD_MCC_SYNC_MACID_TARGET(void *cmd, u32 val)
  2663. {
  2664. le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
  2665. }
  2666. static inline void RTW89_SET_FWCMD_MCC_SYNC_SYNC_OFFSET(void *cmd, u32 val)
  2667. {
  2668. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
  2669. }
  2670. struct rtw89_fw_mcc_duration {
  2671. u32 group: 2;
  2672. u32 btc_in_group: 1;
  2673. u32 rsvd0: 5;
  2674. u32 start_macid: 8;
  2675. u32 macid_x: 8;
  2676. u32 macid_y: 8;
  2677. u32 start_tsf_low;
  2678. u32 start_tsf_high;
  2679. u32 duration_x;
  2680. u32 duration_y;
  2681. };
  2682. static inline void RTW89_SET_FWCMD_MCC_SET_DURATION_GROUP(void *cmd, u32 val)
  2683. {
  2684. le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
  2685. }
  2686. static
  2687. inline void RTW89_SET_FWCMD_MCC_SET_DURATION_BTC_IN_GROUP(void *cmd, u32 val)
  2688. {
  2689. le32p_replace_bits((__le32 *)cmd, val, BIT(2));
  2690. }
  2691. static
  2692. inline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_MACID(void *cmd, u32 val)
  2693. {
  2694. le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
  2695. }
  2696. static inline void RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_X(void *cmd, u32 val)
  2697. {
  2698. le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
  2699. }
  2700. static inline void RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_Y(void *cmd, u32 val)
  2701. {
  2702. le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
  2703. }
  2704. static
  2705. inline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_LOW(void *cmd, u32 val)
  2706. {
  2707. le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(31, 0));
  2708. }
  2709. static
  2710. inline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_HIGH(void *cmd, u32 val)
  2711. {
  2712. le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
  2713. }
  2714. static
  2715. inline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_X(void *cmd, u32 val)
  2716. {
  2717. le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(31, 0));
  2718. }
  2719. static
  2720. inline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_Y(void *cmd, u32 val)
  2721. {
  2722. le32p_replace_bits((__le32 *)cmd + 4, val, GENMASK(31, 0));
  2723. }
  2724. #define RTW89_C2H_HEADER_LEN 8
  2725. struct rtw89_c2h_hdr {
  2726. __le32 w0;
  2727. __le32 w1;
  2728. } __packed;
  2729. #define RTW89_C2H_HDR_W0_CATEGORY GENMASK(1, 0)
  2730. #define RTW89_C2H_HDR_W0_CLASS GENMASK(7, 2)
  2731. #define RTW89_C2H_HDR_W0_FUNC GENMASK(15, 8)
  2732. #define RTW89_C2H_HDR_W1_LEN GENMASK(13, 0)
  2733. struct rtw89_fw_c2h_attr {
  2734. u8 category;
  2735. u8 class;
  2736. u8 func;
  2737. u16 len;
  2738. };
  2739. static inline struct rtw89_fw_c2h_attr *RTW89_SKB_C2H_CB(struct sk_buff *skb)
  2740. {
  2741. static_assert(sizeof(skb->cb) >= sizeof(struct rtw89_fw_c2h_attr));
  2742. return (struct rtw89_fw_c2h_attr *)skb->cb;
  2743. }
  2744. struct rtw89_c2h_done_ack {
  2745. __le32 w0;
  2746. __le32 w1;
  2747. __le32 w2;
  2748. } __packed;
  2749. #define RTW89_C2H_DONE_ACK_W2_CAT GENMASK(1, 0)
  2750. #define RTW89_C2H_DONE_ACK_W2_CLASS GENMASK(7, 2)
  2751. #define RTW89_C2H_DONE_ACK_W2_FUNC GENMASK(15, 8)
  2752. #define RTW89_C2H_DONE_ACK_W2_H2C_RETURN GENMASK(23, 16)
  2753. #define RTW89_C2H_DONE_ACK_W2_H2C_SEQ GENMASK(31, 24)
  2754. #define RTW89_GET_MAC_C2H_REV_ACK_CAT(c2h) \
  2755. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
  2756. #define RTW89_GET_MAC_C2H_REV_ACK_CLASS(c2h) \
  2757. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 2))
  2758. #define RTW89_GET_MAC_C2H_REV_ACK_FUNC(c2h) \
  2759. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
  2760. #define RTW89_GET_MAC_C2H_REV_ACK_H2C_SEQ(c2h) \
  2761. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(23, 16))
  2762. struct rtw89_fw_c2h_log_fmt {
  2763. __le16 signature;
  2764. u8 feature;
  2765. u8 syntax;
  2766. __le32 fmt_id;
  2767. u8 file_num;
  2768. __le16 line_num;
  2769. u8 argc;
  2770. union {
  2771. #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
  2772. DECLARE_FLEX_ARRAY(u8, raw);
  2773. DECLARE_FLEX_ARRAY(__le32, argv);
  2774. #else
  2775. u8 raw[4];
  2776. __le32 argv[1];
  2777. #endif
  2778. } __packed u;
  2779. } __packed;
  2780. #define RTW89_C2H_FW_FORMATTED_LOG_MIN_LEN 11
  2781. #define RTW89_C2H_FW_LOG_FEATURE_PARA_INT BIT(2)
  2782. #define RTW89_C2H_FW_LOG_MAX_PARA_NUM 16
  2783. #define RTW89_C2H_FW_LOG_SIGNATURE 0xA5A5
  2784. #define RTW89_C2H_FW_LOG_STR_BUF_SIZE 512
  2785. struct rtw89_c2h_mac_bcnfltr_rpt {
  2786. __le32 w0;
  2787. __le32 w1;
  2788. __le32 w2;
  2789. } __packed;
  2790. #define RTW89_C2H_MAC_BCNFLTR_RPT_W2_MACID GENMASK(7, 0)
  2791. #define RTW89_C2H_MAC_BCNFLTR_RPT_W2_TYPE GENMASK(9, 8)
  2792. #define RTW89_C2H_MAC_BCNFLTR_RPT_W2_EVENT GENMASK(11, 10)
  2793. #define RTW89_C2H_MAC_BCNFLTR_RPT_W2_MA GENMASK(23, 16)
  2794. struct rtw89_c2h_ra_rpt {
  2795. struct rtw89_c2h_hdr hdr;
  2796. __le32 w2;
  2797. __le32 w3;
  2798. } __packed;
  2799. #define RTW89_C2H_RA_RPT_W2_MACID GENMASK(15, 0)
  2800. #define RTW89_C2H_RA_RPT_W2_RETRY_RATIO GENMASK(23, 16)
  2801. #define RTW89_C2H_RA_RPT_W2_MCSNSS_B7 BIT(31)
  2802. #define RTW89_C2H_RA_RPT_W3_MCSNSS GENMASK(6, 0)
  2803. #define RTW89_C2H_RA_RPT_W3_MD_SEL GENMASK(9, 8)
  2804. #define RTW89_C2H_RA_RPT_W3_GILTF GENMASK(12, 10)
  2805. #define RTW89_C2H_RA_RPT_W3_BW GENMASK(14, 13)
  2806. #define RTW89_C2H_RA_RPT_W3_MD_SEL_B2 BIT(15)
  2807. #define RTW89_C2H_RA_RPT_W3_BW_B2 BIT(16)
  2808. /* For WiFi 6 chips:
  2809. * VHT, HE, HT-old: [6:4]: NSS, [3:0]: MCS
  2810. * HT-new: [6:5]: NA, [4:0]: MCS
  2811. * For WiFi 7 chips (V1):
  2812. * HT, VHT, HE, EHT: [7:5]: NSS, [4:0]: MCS
  2813. */
  2814. #define RTW89_RA_RATE_MASK_NSS GENMASK(6, 4)
  2815. #define RTW89_RA_RATE_MASK_MCS GENMASK(3, 0)
  2816. #define RTW89_RA_RATE_MASK_NSS_V1 GENMASK(7, 5)
  2817. #define RTW89_RA_RATE_MASK_MCS_V1 GENMASK(4, 0)
  2818. #define RTW89_RA_RATE_MASK_HT_MCS GENMASK(4, 0)
  2819. #define RTW89_MK_HT_RATE(nss, mcs) (FIELD_PREP(GENMASK(4, 3), nss) | \
  2820. FIELD_PREP(GENMASK(2, 0), mcs))
  2821. #define RTW89_GET_MAC_C2H_PKTOFLD_ID(c2h) \
  2822. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 0))
  2823. #define RTW89_GET_MAC_C2H_PKTOFLD_OP(c2h) \
  2824. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(10, 8))
  2825. #define RTW89_GET_MAC_C2H_PKTOFLD_LEN(c2h) \
  2826. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 16))
  2827. #define RTW89_GET_MAC_C2H_SCANOFLD_PRI_CH(c2h) \
  2828. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 0))
  2829. #define RTW89_GET_MAC_C2H_SCANOFLD_RSP(c2h) \
  2830. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(19, 16))
  2831. #define RTW89_GET_MAC_C2H_SCANOFLD_STATUS(c2h) \
  2832. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(23, 20))
  2833. #define RTW89_GET_MAC_C2H_ACTUAL_PERIOD(c2h) \
  2834. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 24))
  2835. #define RTW89_GET_MAC_C2H_SCANOFLD_TX_FAIL(c2h) \
  2836. le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(3, 0))
  2837. #define RTW89_GET_MAC_C2H_SCANOFLD_AIR_DENSITY(c2h) \
  2838. le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(7, 4))
  2839. #define RTW89_GET_MAC_C2H_SCANOFLD_BAND(c2h) \
  2840. le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(25, 24))
  2841. #define RTW89_GET_MAC_C2H_MCC_RCV_ACK_GROUP(c2h) \
  2842. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
  2843. #define RTW89_GET_MAC_C2H_MCC_RCV_ACK_H2C_FUNC(c2h) \
  2844. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
  2845. #define RTW89_GET_MAC_C2H_MCC_REQ_ACK_GROUP(c2h) \
  2846. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
  2847. #define RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_RETURN(c2h) \
  2848. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 2))
  2849. #define RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_FUNC(c2h) \
  2850. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
  2851. struct rtw89_mac_mcc_tsf_rpt {
  2852. u32 macid_x;
  2853. u32 macid_y;
  2854. u32 tsf_x_low;
  2855. u32 tsf_x_high;
  2856. u32 tsf_y_low;
  2857. u32 tsf_y_high;
  2858. };
  2859. static_assert(sizeof(struct rtw89_mac_mcc_tsf_rpt) <= RTW89_COMPLETION_BUF_SIZE);
  2860. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_X(c2h) \
  2861. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 0))
  2862. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_Y(c2h) \
  2863. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
  2864. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_GROUP(c2h) \
  2865. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(17, 16))
  2866. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_X(c2h) \
  2867. le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(31, 0))
  2868. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_X(c2h) \
  2869. le32_get_bits(*((const __le32 *)(c2h) + 4), GENMASK(31, 0))
  2870. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_Y(c2h) \
  2871. le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(31, 0))
  2872. #define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_Y(c2h) \
  2873. le32_get_bits(*((const __le32 *)(c2h) + 6), GENMASK(31, 0))
  2874. #define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_STATUS(c2h) \
  2875. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(5, 0))
  2876. #define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_GROUP(c2h) \
  2877. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 6))
  2878. #define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_MACID(c2h) \
  2879. le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
  2880. #define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_LOW(c2h) \
  2881. le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(31, 0))
  2882. #define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_HIGH(c2h) \
  2883. le32_get_bits(*((const __le32 *)(c2h) + 4), GENMASK(31, 0))
  2884. struct rtw89_c2h_pkt_ofld_rsp {
  2885. __le32 w0;
  2886. __le32 w1;
  2887. __le32 w2;
  2888. } __packed;
  2889. #define RTW89_C2H_PKT_OFLD_RSP_W2_PTK_ID GENMASK(7, 0)
  2890. #define RTW89_C2H_PKT_OFLD_RSP_W2_PTK_OP GENMASK(10, 8)
  2891. #define RTW89_C2H_PKT_OFLD_RSP_W2_PTK_LEN GENMASK(31, 16)
  2892. struct rtw89_h2c_bcnfltr {
  2893. __le32 w0;
  2894. } __packed;
  2895. #define RTW89_H2C_BCNFLTR_W0_MON_RSSI BIT(0)
  2896. #define RTW89_H2C_BCNFLTR_W0_MON_BCN BIT(1)
  2897. #define RTW89_H2C_BCNFLTR_W0_MON_EN BIT(2)
  2898. #define RTW89_H2C_BCNFLTR_W0_MODE GENMASK(4, 3)
  2899. #define RTW89_H2C_BCNFLTR_W0_BCN_LOSS_CNT GENMASK(11, 8)
  2900. #define RTW89_H2C_BCNFLTR_W0_RSSI_HYST GENMASK(15, 12)
  2901. #define RTW89_H2C_BCNFLTR_W0_RSSI_THRESHOLD GENMASK(23, 16)
  2902. #define RTW89_H2C_BCNFLTR_W0_MAC_ID GENMASK(31, 24)
  2903. struct rtw89_h2c_ofld_rssi {
  2904. __le32 w0;
  2905. __le32 w1;
  2906. } __packed;
  2907. #define RTW89_H2C_OFLD_RSSI_W0_MACID GENMASK(7, 0)
  2908. #define RTW89_H2C_OFLD_RSSI_W0_NUM GENMASK(15, 8)
  2909. #define RTW89_H2C_OFLD_RSSI_W1_VAL GENMASK(7, 0)
  2910. struct rtw89_h2c_ofld {
  2911. __le32 w0;
  2912. } __packed;
  2913. #define RTW89_H2C_OFLD_W0_MAC_ID GENMASK(7, 0)
  2914. #define RTW89_H2C_OFLD_W0_TX_TP GENMASK(17, 8)
  2915. #define RTW89_H2C_OFLD_W0_RX_TP GENMASK(27, 18)
  2916. #define RTW89_MFW_SIG 0xFF
  2917. struct rtw89_mfw_info {
  2918. u8 cv;
  2919. u8 type; /* enum rtw89_fw_type */
  2920. u8 mp;
  2921. u8 rsvd;
  2922. __le32 shift;
  2923. __le32 size;
  2924. u8 rsvd2[4];
  2925. } __packed;
  2926. struct rtw89_mfw_hdr {
  2927. u8 sig; /* RTW89_MFW_SIG */
  2928. u8 fw_nr;
  2929. u8 rsvd0[2];
  2930. struct {
  2931. u8 major;
  2932. u8 minor;
  2933. u8 sub;
  2934. u8 idx;
  2935. } ver;
  2936. u8 rsvd1[8];
  2937. struct rtw89_mfw_info info[];
  2938. } __packed;
  2939. struct rtw89_fw_logsuit_hdr {
  2940. __le32 rsvd;
  2941. __le32 count;
  2942. __le32 ids[];
  2943. } __packed;
  2944. #define RTW89_FW_ELEMENT_ALIGN 16
  2945. enum rtw89_fw_element_id {
  2946. RTW89_FW_ELEMENT_ID_BBMCU0 = 0,
  2947. RTW89_FW_ELEMENT_ID_BBMCU1 = 1,
  2948. RTW89_FW_ELEMENT_ID_BB_REG = 2,
  2949. RTW89_FW_ELEMENT_ID_BB_GAIN = 3,
  2950. RTW89_FW_ELEMENT_ID_RADIO_A = 4,
  2951. RTW89_FW_ELEMENT_ID_RADIO_B = 5,
  2952. RTW89_FW_ELEMENT_ID_RADIO_C = 6,
  2953. RTW89_FW_ELEMENT_ID_RADIO_D = 7,
  2954. RTW89_FW_ELEMENT_ID_RF_NCTL = 8,
  2955. RTW89_FW_ELEMENT_ID_TXPWR_BYRATE = 9,
  2956. RTW89_FW_ELEMENT_ID_TXPWR_LMT_2GHZ = 10,
  2957. RTW89_FW_ELEMENT_ID_TXPWR_LMT_5GHZ = 11,
  2958. RTW89_FW_ELEMENT_ID_TXPWR_LMT_6GHZ = 12,
  2959. RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_2GHZ = 13,
  2960. RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_5GHZ = 14,
  2961. RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_6GHZ = 15,
  2962. RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT = 16,
  2963. RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT_RU = 17,
  2964. RTW89_FW_ELEMENT_ID_NUM,
  2965. };
  2966. #define BITS_OF_RTW89_TXPWR_FW_ELEMENTS \
  2967. (BIT(RTW89_FW_ELEMENT_ID_TXPWR_BYRATE) | \
  2968. BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_2GHZ) | \
  2969. BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_5GHZ) | \
  2970. BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_6GHZ) | \
  2971. BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_2GHZ) | \
  2972. BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_5GHZ) | \
  2973. BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_6GHZ) | \
  2974. BIT(RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT) | \
  2975. BIT(RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT_RU))
  2976. #define RTW89_BE_GEN_DEF_NEEDED_FW_ELEMENTS (BIT(RTW89_FW_ELEMENT_ID_BBMCU0) | \
  2977. BIT(RTW89_FW_ELEMENT_ID_BB_REG) | \
  2978. BIT(RTW89_FW_ELEMENT_ID_RADIO_A) | \
  2979. BIT(RTW89_FW_ELEMENT_ID_RADIO_B) | \
  2980. BIT(RTW89_FW_ELEMENT_ID_RF_NCTL) | \
  2981. BITS_OF_RTW89_TXPWR_FW_ELEMENTS)
  2982. struct __rtw89_fw_txpwr_element {
  2983. u8 rsvd0;
  2984. u8 rsvd1;
  2985. u8 rfe_type;
  2986. u8 ent_sz;
  2987. __le32 num_ents;
  2988. u8 content[];
  2989. } __packed;
  2990. struct rtw89_fw_element_hdr {
  2991. __le32 id; /* enum rtw89_fw_element_id */
  2992. __le32 size; /* exclude header size */
  2993. u8 ver[4];
  2994. __le32 rsvd0;
  2995. __le32 rsvd1;
  2996. __le32 rsvd2;
  2997. union {
  2998. struct {
  2999. u8 priv[8];
  3000. u8 contents[];
  3001. } __packed common;
  3002. struct {
  3003. u8 idx;
  3004. u8 rsvd[7];
  3005. struct {
  3006. __le32 addr;
  3007. __le32 data;
  3008. } __packed regs[];
  3009. } __packed reg2;
  3010. struct __rtw89_fw_txpwr_element txpwr;
  3011. } __packed u;
  3012. } __packed;
  3013. struct fwcmd_hdr {
  3014. __le32 hdr0;
  3015. __le32 hdr1;
  3016. };
  3017. union rtw89_compat_fw_hdr {
  3018. struct rtw89_mfw_hdr mfw_hdr;
  3019. struct rtw89_fw_hdr fw_hdr;
  3020. };
  3021. static inline u32 rtw89_compat_fw_hdr_ver_code(const void *fw_buf)
  3022. {
  3023. const union rtw89_compat_fw_hdr *compat = (typeof(compat))fw_buf;
  3024. if (compat->mfw_hdr.sig == RTW89_MFW_SIG)
  3025. return RTW89_MFW_HDR_VER_CODE(&compat->mfw_hdr);
  3026. else
  3027. return RTW89_FW_HDR_VER_CODE(&compat->fw_hdr);
  3028. }
  3029. static inline void rtw89_fw_get_filename(char *buf, size_t size,
  3030. const char *fw_basename, int fw_format)
  3031. {
  3032. if (fw_format <= 0)
  3033. snprintf(buf, size, "%s.bin", fw_basename);
  3034. else
  3035. snprintf(buf, size, "%s-%d.bin", fw_basename, fw_format);
  3036. }
  3037. #define RTW89_H2C_RF_PAGE_SIZE 500
  3038. #define RTW89_H2C_RF_PAGE_NUM 3
  3039. struct rtw89_fw_h2c_rf_reg_info {
  3040. enum rtw89_rf_path rf_path;
  3041. __le32 rtw89_phy_config_rf_h2c[RTW89_H2C_RF_PAGE_NUM][RTW89_H2C_RF_PAGE_SIZE];
  3042. u16 curr_idx;
  3043. };
  3044. #define H2C_SEC_CAM_LEN 24
  3045. #define H2C_HEADER_LEN 8
  3046. #define H2C_HDR_CAT GENMASK(1, 0)
  3047. #define H2C_HDR_CLASS GENMASK(7, 2)
  3048. #define H2C_HDR_FUNC GENMASK(15, 8)
  3049. #define H2C_HDR_DEL_TYPE GENMASK(19, 16)
  3050. #define H2C_HDR_H2C_SEQ GENMASK(31, 24)
  3051. #define H2C_HDR_TOTAL_LEN GENMASK(13, 0)
  3052. #define H2C_HDR_REC_ACK BIT(14)
  3053. #define H2C_HDR_DONE_ACK BIT(15)
  3054. #define FWCMD_TYPE_H2C 0
  3055. #define H2C_CAT_TEST 0x0
  3056. /* CLASS 5 - FW STATUS TEST */
  3057. #define H2C_CL_FW_STATUS_TEST 0x5
  3058. #define H2C_FUNC_CPU_EXCEPTION 0x1
  3059. #define H2C_CAT_MAC 0x1
  3060. /* CLASS 0 - FW INFO */
  3061. #define H2C_CL_FW_INFO 0x0
  3062. #define H2C_FUNC_LOG_CFG 0x0
  3063. #define H2C_FUNC_MAC_GENERAL_PKT 0x1
  3064. /* CLASS 1 - WOW */
  3065. #define H2C_CL_MAC_WOW 0x1
  3066. #define H2C_FUNC_KEEP_ALIVE 0x0
  3067. #define H2C_FUNC_DISCONNECT_DETECT 0x1
  3068. #define H2C_FUNC_WOW_GLOBAL 0x2
  3069. #define H2C_FUNC_WAKEUP_CTRL 0x8
  3070. #define H2C_FUNC_WOW_CAM_UPD 0xC
  3071. /* CLASS 2 - PS */
  3072. #define H2C_CL_MAC_PS 0x2
  3073. #define H2C_FUNC_MAC_LPS_PARM 0x0
  3074. #define H2C_FUNC_P2P_ACT 0x1
  3075. /* CLASS 3 - FW download */
  3076. #define H2C_CL_MAC_FWDL 0x3
  3077. #define H2C_FUNC_MAC_FWHDR_DL 0x0
  3078. /* CLASS 5 - Frame Exchange */
  3079. #define H2C_CL_MAC_FR_EXCHG 0x5
  3080. #define H2C_FUNC_MAC_CCTLINFO_UD 0x2
  3081. #define H2C_FUNC_MAC_BCN_UPD 0x5
  3082. #define H2C_FUNC_MAC_DCTLINFO_UD_V1 0x9
  3083. #define H2C_FUNC_MAC_CCTLINFO_UD_V1 0xa
  3084. /* CLASS 6 - Address CAM */
  3085. #define H2C_CL_MAC_ADDR_CAM_UPDATE 0x6
  3086. #define H2C_FUNC_MAC_ADDR_CAM_UPD 0x0
  3087. /* CLASS 8 - Media Status Report */
  3088. #define H2C_CL_MAC_MEDIA_RPT 0x8
  3089. #define H2C_FUNC_MAC_JOININFO 0x0
  3090. #define H2C_FUNC_MAC_FWROLE_MAINTAIN 0x4
  3091. /* CLASS 9 - FW offload */
  3092. #define H2C_CL_MAC_FW_OFLD 0x9
  3093. enum rtw89_fw_ofld_h2c_func {
  3094. H2C_FUNC_PACKET_OFLD = 0x1,
  3095. H2C_FUNC_MAC_MACID_PAUSE = 0x8,
  3096. H2C_FUNC_USR_EDCA = 0xF,
  3097. H2C_FUNC_TSF32_TOGL = 0x10,
  3098. H2C_FUNC_OFLD_CFG = 0x14,
  3099. H2C_FUNC_ADD_SCANOFLD_CH = 0x16,
  3100. H2C_FUNC_SCANOFLD = 0x17,
  3101. H2C_FUNC_PKT_DROP = 0x1b,
  3102. H2C_FUNC_CFG_BCNFLTR = 0x1e,
  3103. H2C_FUNC_OFLD_RSSI = 0x1f,
  3104. H2C_FUNC_OFLD_TP = 0x20,
  3105. NUM_OF_RTW89_FW_OFLD_H2C_FUNC,
  3106. };
  3107. #define RTW89_FW_OFLD_WAIT_COND(tag, func) \
  3108. ((tag) * NUM_OF_RTW89_FW_OFLD_H2C_FUNC + (func))
  3109. #define RTW89_FW_OFLD_WAIT_COND_PKT_OFLD(pkt_id, pkt_op) \
  3110. RTW89_FW_OFLD_WAIT_COND(RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op), \
  3111. H2C_FUNC_PACKET_OFLD)
  3112. /* CLASS 10 - Security CAM */
  3113. #define H2C_CL_MAC_SEC_CAM 0xa
  3114. #define H2C_FUNC_MAC_SEC_UPD 0x1
  3115. /* CLASS 12 - BA CAM */
  3116. #define H2C_CL_BA_CAM 0xc
  3117. #define H2C_FUNC_MAC_BA_CAM 0x0
  3118. /* CLASS 14 - MCC */
  3119. #define H2C_CL_MCC 0xe
  3120. enum rtw89_mcc_h2c_func {
  3121. H2C_FUNC_ADD_MCC = 0x0,
  3122. H2C_FUNC_START_MCC = 0x1,
  3123. H2C_FUNC_STOP_MCC = 0x2,
  3124. H2C_FUNC_DEL_MCC_GROUP = 0x3,
  3125. H2C_FUNC_RESET_MCC_GROUP = 0x4,
  3126. H2C_FUNC_MCC_REQ_TSF = 0x5,
  3127. H2C_FUNC_MCC_MACID_BITMAP = 0x6,
  3128. H2C_FUNC_MCC_SYNC = 0x7,
  3129. H2C_FUNC_MCC_SET_DURATION = 0x8,
  3130. NUM_OF_RTW89_MCC_H2C_FUNC,
  3131. };
  3132. #define RTW89_MCC_WAIT_COND(group, func) \
  3133. ((group) * NUM_OF_RTW89_MCC_H2C_FUNC + (func))
  3134. #define H2C_CAT_OUTSRC 0x2
  3135. #define H2C_CL_OUTSRC_RA 0x1
  3136. #define H2C_FUNC_OUTSRC_RA_MACIDCFG 0x0
  3137. #define H2C_CL_OUTSRC_RF_REG_A 0x8
  3138. #define H2C_CL_OUTSRC_RF_REG_B 0x9
  3139. #define H2C_CL_OUTSRC_RF_FW_NOTIFY 0xa
  3140. #define H2C_FUNC_OUTSRC_RF_GET_MCCCH 0x2
  3141. struct rtw89_fw_h2c_rf_get_mccch {
  3142. __le32 ch_0;
  3143. __le32 ch_1;
  3144. __le32 band_0;
  3145. __le32 band_1;
  3146. __le32 current_channel;
  3147. __le32 current_band_type;
  3148. } __packed;
  3149. #define RTW89_FW_RSVD_PLE_SIZE 0x800
  3150. #define RTW89_WCPU_BASE_MASK GENMASK(27, 0)
  3151. #define RTW89_FW_BACKTRACE_INFO_SIZE 8
  3152. #define RTW89_VALID_FW_BACKTRACE_SIZE(_size) \
  3153. ((_size) % RTW89_FW_BACKTRACE_INFO_SIZE == 0)
  3154. #define RTW89_FW_BACKTRACE_MAX_SIZE 512 /* 8 * 64 (entries) */
  3155. #define RTW89_FW_BACKTRACE_KEY 0xBACEBACE
  3156. #define FWDL_WAIT_CNT 400000
  3157. int rtw89_fw_check_rdy(struct rtw89_dev *rtwdev, enum rtw89_fwdl_check_type type);
  3158. int rtw89_fw_recognize(struct rtw89_dev *rtwdev);
  3159. int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev);
  3160. const struct firmware *
  3161. rtw89_early_fw_feature_recognize(struct device *device,
  3162. const struct rtw89_chip_info *chip,
  3163. struct rtw89_fw_info *early_fw,
  3164. int *used_fw_format);
  3165. int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,
  3166. bool include_bb);
  3167. void rtw89_load_firmware_work(struct work_struct *work);
  3168. void rtw89_unload_firmware(struct rtw89_dev *rtwdev);
  3169. int rtw89_wait_firmware_completion(struct rtw89_dev *rtwdev);
  3170. int rtw89_fw_log_prepare(struct rtw89_dev *rtwdev);
  3171. void rtw89_fw_log_dump(struct rtw89_dev *rtwdev, u8 *buf, u32 len);
  3172. void rtw89_h2c_pkt_set_hdr(struct rtw89_dev *rtwdev, struct sk_buff *skb,
  3173. u8 type, u8 cat, u8 class, u8 func,
  3174. bool rack, bool dack, u32 len);
  3175. int rtw89_fw_h2c_default_cmac_tbl(struct rtw89_dev *rtwdev,
  3176. struct rtw89_vif *rtwvif);
  3177. int rtw89_fw_h2c_assoc_cmac_tbl(struct rtw89_dev *rtwdev,
  3178. struct ieee80211_vif *vif,
  3179. struct ieee80211_sta *sta);
  3180. int rtw89_fw_h2c_txtime_cmac_tbl(struct rtw89_dev *rtwdev,
  3181. struct rtw89_sta *rtwsta);
  3182. int rtw89_fw_h2c_txpath_cmac_tbl(struct rtw89_dev *rtwdev,
  3183. struct rtw89_sta *rtwsta);
  3184. int rtw89_fw_h2c_update_beacon(struct rtw89_dev *rtwdev,
  3185. struct rtw89_vif *rtwvif);
  3186. int rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *vif,
  3187. struct rtw89_sta *rtwsta, const u8 *scan_mac_addr);
  3188. int rtw89_fw_h2c_dctl_sec_cam_v1(struct rtw89_dev *rtwdev,
  3189. struct rtw89_vif *rtwvif,
  3190. struct rtw89_sta *rtwsta);
  3191. void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h);
  3192. void rtw89_fw_c2h_work(struct work_struct *work);
  3193. int rtw89_fw_h2c_role_maintain(struct rtw89_dev *rtwdev,
  3194. struct rtw89_vif *rtwvif,
  3195. struct rtw89_sta *rtwsta,
  3196. enum rtw89_upd_mode upd_mode);
  3197. int rtw89_fw_h2c_join_info(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3198. struct rtw89_sta *rtwsta, bool dis_conn);
  3199. int rtw89_fw_h2c_macid_pause(struct rtw89_dev *rtwdev, u8 sh, u8 grp,
  3200. bool pause);
  3201. int rtw89_fw_h2c_set_edca(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3202. u8 ac, u32 val);
  3203. int rtw89_fw_h2c_set_ofld_cfg(struct rtw89_dev *rtwdev);
  3204. int rtw89_fw_h2c_set_bcn_fltr_cfg(struct rtw89_dev *rtwdev,
  3205. struct ieee80211_vif *vif,
  3206. bool connect);
  3207. int rtw89_fw_h2c_rssi_offload(struct rtw89_dev *rtwdev,
  3208. struct rtw89_rx_phy_ppdu *phy_ppdu);
  3209. int rtw89_fw_h2c_tp_offload(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
  3210. int rtw89_fw_h2c_ra(struct rtw89_dev *rtwdev, struct rtw89_ra_info *ra, bool csi);
  3211. int rtw89_fw_h2c_cxdrv_init(struct rtw89_dev *rtwdev);
  3212. int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev);
  3213. int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev);
  3214. int rtw89_fw_h2c_cxdrv_role_v2(struct rtw89_dev *rtwdev);
  3215. int rtw89_fw_h2c_cxdrv_ctrl(struct rtw89_dev *rtwdev);
  3216. int rtw89_fw_h2c_cxdrv_trx(struct rtw89_dev *rtwdev);
  3217. int rtw89_fw_h2c_cxdrv_rfk(struct rtw89_dev *rtwdev);
  3218. int rtw89_fw_h2c_del_pkt_offload(struct rtw89_dev *rtwdev, u8 id);
  3219. int rtw89_fw_h2c_add_pkt_offload(struct rtw89_dev *rtwdev, u8 *id,
  3220. struct sk_buff *skb_ofld);
  3221. int rtw89_fw_h2c_scan_list_offload(struct rtw89_dev *rtwdev, int len,
  3222. struct list_head *chan_list);
  3223. int rtw89_fw_h2c_scan_offload(struct rtw89_dev *rtwdev,
  3224. struct rtw89_scan_option *opt,
  3225. struct rtw89_vif *vif);
  3226. int rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev,
  3227. struct rtw89_fw_h2c_rf_reg_info *info,
  3228. u16 len, u8 page);
  3229. int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev);
  3230. int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
  3231. u8 h2c_class, u8 h2c_func, u8 *buf, u16 len,
  3232. bool rack, bool dack);
  3233. int rtw89_fw_h2c_raw(struct rtw89_dev *rtwdev, const u8 *buf, u16 len);
  3234. void rtw89_fw_send_all_early_h2c(struct rtw89_dev *rtwdev);
  3235. void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev);
  3236. int rtw89_fw_h2c_general_pkt(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3237. u8 macid);
  3238. void rtw89_fw_release_general_pkt_list_vif(struct rtw89_dev *rtwdev,
  3239. struct rtw89_vif *rtwvif, bool notify_fw);
  3240. void rtw89_fw_release_general_pkt_list(struct rtw89_dev *rtwdev, bool notify_fw);
  3241. int rtw89_fw_h2c_ba_cam(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
  3242. bool valid, struct ieee80211_ampdu_params *params);
  3243. void rtw89_fw_h2c_init_dynamic_ba_cam_v0_ext(struct rtw89_dev *rtwdev);
  3244. int rtw89_fw_h2c_lps_parm(struct rtw89_dev *rtwdev,
  3245. struct rtw89_lps_parm *lps_param);
  3246. struct sk_buff *rtw89_fw_h2c_alloc_skb_with_hdr(struct rtw89_dev *rtwdev, u32 len);
  3247. struct sk_buff *rtw89_fw_h2c_alloc_skb_no_hdr(struct rtw89_dev *rtwdev, u32 len);
  3248. int rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,
  3249. struct rtw89_mac_h2c_info *h2c_info,
  3250. struct rtw89_mac_c2h_info *c2h_info);
  3251. int rtw89_fw_h2c_fw_log(struct rtw89_dev *rtwdev, bool enable);
  3252. void rtw89_fw_st_dbg_dump(struct rtw89_dev *rtwdev);
  3253. void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
  3254. struct ieee80211_scan_request *req);
  3255. void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
  3256. bool aborted);
  3257. int rtw89_hw_scan_offload(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
  3258. bool enable);
  3259. void rtw89_hw_scan_abort(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif);
  3260. int rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev);
  3261. int rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,
  3262. const struct rtw89_pkt_drop_params *params);
  3263. int rtw89_fw_h2c_p2p_act(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
  3264. struct ieee80211_p2p_noa_desc *desc,
  3265. u8 act, u8 noa_id);
  3266. int rtw89_fw_h2c_tsf32_toggle(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3267. bool en);
  3268. int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3269. bool enable);
  3270. int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
  3271. struct rtw89_vif *rtwvif, bool enable);
  3272. int rtw89_fw_h2c_keep_alive(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3273. bool enable);
  3274. int rtw89_fw_h2c_disconnect_detect(struct rtw89_dev *rtwdev,
  3275. struct rtw89_vif *rtwvif, bool enable);
  3276. int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
  3277. bool enable);
  3278. int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
  3279. struct rtw89_vif *rtwvif, bool enable);
  3280. int rtw89_fw_wow_cam_update(struct rtw89_dev *rtwdev,
  3281. struct rtw89_wow_cam_info *cam_info);
  3282. int rtw89_fw_h2c_add_mcc(struct rtw89_dev *rtwdev,
  3283. const struct rtw89_fw_mcc_add_req *p);
  3284. int rtw89_fw_h2c_start_mcc(struct rtw89_dev *rtwdev,
  3285. const struct rtw89_fw_mcc_start_req *p);
  3286. int rtw89_fw_h2c_stop_mcc(struct rtw89_dev *rtwdev, u8 group, u8 macid,
  3287. bool prev_groups);
  3288. int rtw89_fw_h2c_del_mcc_group(struct rtw89_dev *rtwdev, u8 group,
  3289. bool prev_groups);
  3290. int rtw89_fw_h2c_reset_mcc_group(struct rtw89_dev *rtwdev, u8 group);
  3291. int rtw89_fw_h2c_mcc_req_tsf(struct rtw89_dev *rtwdev,
  3292. const struct rtw89_fw_mcc_tsf_req *req,
  3293. struct rtw89_mac_mcc_tsf_rpt *rpt);
  3294. int rtw89_fw_h2c_mcc_macid_bitmap(struct rtw89_dev *rtwdev, u8 group, u8 macid,
  3295. u8 *bitmap);
  3296. int rtw89_fw_h2c_mcc_sync(struct rtw89_dev *rtwdev, u8 group, u8 source,
  3297. u8 target, u8 offset);
  3298. int rtw89_fw_h2c_mcc_set_duration(struct rtw89_dev *rtwdev,
  3299. const struct rtw89_fw_mcc_duration *p);
  3300. static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
  3301. {
  3302. const struct rtw89_chip_info *chip = rtwdev->chip;
  3303. if (chip->bacam_ver == RTW89_BACAM_V0_EXT)
  3304. rtw89_fw_h2c_init_dynamic_ba_cam_v0_ext(rtwdev);
  3305. }
  3306. /* must consider compatibility; don't insert new in the mid */
  3307. struct rtw89_fw_txpwr_byrate_entry {
  3308. u8 band;
  3309. u8 nss;
  3310. u8 rs;
  3311. u8 shf;
  3312. u8 len;
  3313. __le32 data;
  3314. u8 bw;
  3315. u8 ofdma;
  3316. } __packed;
  3317. /* must consider compatibility; don't insert new in the mid */
  3318. struct rtw89_fw_txpwr_lmt_2ghz_entry {
  3319. u8 bw;
  3320. u8 nt;
  3321. u8 rs;
  3322. u8 bf;
  3323. u8 regd;
  3324. u8 ch_idx;
  3325. s8 v;
  3326. } __packed;
  3327. /* must consider compatibility; don't insert new in the mid */
  3328. struct rtw89_fw_txpwr_lmt_5ghz_entry {
  3329. u8 bw;
  3330. u8 nt;
  3331. u8 rs;
  3332. u8 bf;
  3333. u8 regd;
  3334. u8 ch_idx;
  3335. s8 v;
  3336. } __packed;
  3337. /* must consider compatibility; don't insert new in the mid */
  3338. struct rtw89_fw_txpwr_lmt_6ghz_entry {
  3339. u8 bw;
  3340. u8 nt;
  3341. u8 rs;
  3342. u8 bf;
  3343. u8 regd;
  3344. u8 reg_6ghz_power;
  3345. u8 ch_idx;
  3346. s8 v;
  3347. } __packed;
  3348. /* must consider compatibility; don't insert new in the mid */
  3349. struct rtw89_fw_txpwr_lmt_ru_2ghz_entry {
  3350. u8 ru;
  3351. u8 nt;
  3352. u8 regd;
  3353. u8 ch_idx;
  3354. s8 v;
  3355. } __packed;
  3356. /* must consider compatibility; don't insert new in the mid */
  3357. struct rtw89_fw_txpwr_lmt_ru_5ghz_entry {
  3358. u8 ru;
  3359. u8 nt;
  3360. u8 regd;
  3361. u8 ch_idx;
  3362. s8 v;
  3363. } __packed;
  3364. /* must consider compatibility; don't insert new in the mid */
  3365. struct rtw89_fw_txpwr_lmt_ru_6ghz_entry {
  3366. u8 ru;
  3367. u8 nt;
  3368. u8 regd;
  3369. u8 reg_6ghz_power;
  3370. u8 ch_idx;
  3371. s8 v;
  3372. } __packed;
  3373. /* must consider compatibility; don't insert new in the mid */
  3374. struct rtw89_fw_tx_shape_lmt_entry {
  3375. u8 band;
  3376. u8 tx_shape_rs;
  3377. u8 regd;
  3378. u8 v;
  3379. } __packed;
  3380. /* must consider compatibility; don't insert new in the mid */
  3381. struct rtw89_fw_tx_shape_lmt_ru_entry {
  3382. u8 band;
  3383. u8 regd;
  3384. u8 v;
  3385. } __packed;
  3386. const struct rtw89_rfe_parms *
  3387. rtw89_load_rfe_data_from_fw(struct rtw89_dev *rtwdev,
  3388. const struct rtw89_rfe_parms *init);
  3389. #endif