1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947 |
- /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
- /* Copyright(c) 2019-2020 Realtek Corporation
- */
- #ifndef __RTW89_CORE_H__
- #define __RTW89_CORE_H__
- #include <linux/average.h>
- #include <linux/bitfield.h>
- #include <linux/firmware.h>
- #include <linux/iopoll.h>
- #include <linux/workqueue.h>
- #include <net/mac80211.h>
- #include <linux/version.h>
- struct rtw89_dev;
- struct rtw89_pci_info;
- struct rtw89_mac_gen_def;
- struct rtw89_phy_gen_def;
- extern const struct ieee80211_ops rtw89_ops;
- #define MASKBYTE0 0xff
- #define MASKBYTE1 0xff00
- #define MASKBYTE2 0xff0000
- #define MASKBYTE3 0xff000000
- #define MASKBYTE4 0xff00000000ULL
- #define MASKHWORD 0xffff0000
- #define MASKLWORD 0x0000ffff
- #define MASKDWORD 0xffffffff
- #define RFREG_MASK 0xfffff
- #define INV_RF_DATA 0xffffffff
- #define RTW89_TRACK_WORK_PERIOD round_jiffies_relative(HZ * 2)
- #define RTW89_FORBID_BA_TIMER round_jiffies_relative(HZ * 4)
- #define CFO_TRACK_MAX_USER 64
- #define MAX_RSSI 110
- #define RSSI_FACTOR 1
- #define RTW89_RSSI_RAW_TO_DBM(rssi) ((s8)((rssi) >> RSSI_FACTOR) - MAX_RSSI)
- #define RTW89_TX_DIV_RSSI_RAW_TH (2 << RSSI_FACTOR)
- #define RTW89_RADIOTAP_ROOM ALIGN(sizeof(struct ieee80211_radiotap_he), 64)
- #define RTW89_HTC_MASK_VARIANT GENMASK(1, 0)
- #define RTW89_HTC_VARIANT_HE 3
- #define RTW89_HTC_MASK_CTL_ID GENMASK(5, 2)
- #define RTW89_HTC_VARIANT_HE_CID_OM 1
- #define RTW89_HTC_VARIANT_HE_CID_CAS 6
- #define RTW89_HTC_MASK_CTL_INFO GENMASK(31, 6)
- #define RTW89_HTC_MASK_HTC_OM_RX_NSS GENMASK(8, 6)
- enum htc_om_channel_width {
- HTC_OM_CHANNEL_WIDTH_20 = 0,
- HTC_OM_CHANNEL_WIDTH_40 = 1,
- HTC_OM_CHANNEL_WIDTH_80 = 2,
- HTC_OM_CHANNEL_WIDTH_160_OR_80_80 = 3,
- };
- #define RTW89_HTC_MASK_HTC_OM_CH_WIDTH GENMASK(10, 9)
- #define RTW89_HTC_MASK_HTC_OM_UL_MU_DIS BIT(11)
- #define RTW89_HTC_MASK_HTC_OM_TX_NSTS GENMASK(14, 12)
- #define RTW89_HTC_MASK_HTC_OM_ER_SU_DIS BIT(15)
- #define RTW89_HTC_MASK_HTC_OM_DL_MU_MIMO_RR BIT(16)
- #define RTW89_HTC_MASK_HTC_OM_UL_MU_DATA_DIS BIT(17)
- #define RTW89_TF_PAD GENMASK(11, 0)
- #define RTW89_TF_BASIC_USER_INFO_SZ 6
- #define RTW89_GET_TF_USER_INFO_AID12(data) \
- le32_get_bits(*((const __le32 *)(data)), GENMASK(11, 0))
- #define RTW89_GET_TF_USER_INFO_RUA(data) \
- le32_get_bits(*((const __le32 *)(data)), GENMASK(19, 12))
- #define RTW89_GET_TF_USER_INFO_UL_MCS(data) \
- le32_get_bits(*((const __le32 *)(data)), GENMASK(24, 21))
- enum rtw89_subband {
- RTW89_CH_2G = 0,
- RTW89_CH_5G_BAND_1 = 1,
- /* RTW89_CH_5G_BAND_2 = 2, unused */
- RTW89_CH_5G_BAND_3 = 3,
- RTW89_CH_5G_BAND_4 = 4,
- RTW89_CH_6G_BAND_IDX0, /* Low */
- RTW89_CH_6G_BAND_IDX1, /* Low */
- RTW89_CH_6G_BAND_IDX2, /* Mid */
- RTW89_CH_6G_BAND_IDX3, /* Mid */
- RTW89_CH_6G_BAND_IDX4, /* High */
- RTW89_CH_6G_BAND_IDX5, /* High */
- RTW89_CH_6G_BAND_IDX6, /* Ultra-high */
- RTW89_CH_6G_BAND_IDX7, /* Ultra-high */
- RTW89_SUBBAND_NR,
- RTW89_SUBBAND_2GHZ_5GHZ_NR = RTW89_CH_5G_BAND_4 + 1,
- };
- enum rtw89_gain_offset {
- RTW89_GAIN_OFFSET_2G_CCK,
- RTW89_GAIN_OFFSET_2G_OFDM,
- RTW89_GAIN_OFFSET_5G_LOW,
- RTW89_GAIN_OFFSET_5G_MID,
- RTW89_GAIN_OFFSET_5G_HIGH,
- RTW89_GAIN_OFFSET_NR,
- };
- enum rtw89_hci_type {
- RTW89_HCI_TYPE_PCIE,
- RTW89_HCI_TYPE_USB,
- RTW89_HCI_TYPE_SDIO,
- };
- enum rtw89_core_chip_id {
- RTL8852A,
- RTL8852B,
- RTL8852C,
- RTL8851B,
- RTL8922A,
- };
- enum rtw89_chip_gen {
- RTW89_CHIP_AX,
- RTW89_CHIP_BE,
- RTW89_CHIP_GEN_NUM,
- };
- enum rtw89_cv {
- CHIP_CAV,
- CHIP_CBV,
- CHIP_CCV,
- CHIP_CDV,
- CHIP_CEV,
- CHIP_CFV,
- CHIP_CV_MAX,
- CHIP_CV_INVALID = CHIP_CV_MAX,
- };
- enum rtw89_bacam_ver {
- RTW89_BACAM_V0,
- RTW89_BACAM_V1,
- RTW89_BACAM_V0_EXT = 99,
- };
- enum rtw89_core_tx_type {
- RTW89_CORE_TX_TYPE_DATA,
- RTW89_CORE_TX_TYPE_MGMT,
- RTW89_CORE_TX_TYPE_FWCMD,
- };
- enum rtw89_core_rx_type {
- RTW89_CORE_RX_TYPE_WIFI = 0,
- RTW89_CORE_RX_TYPE_PPDU_STAT = 1,
- RTW89_CORE_RX_TYPE_CHAN_INFO = 2,
- RTW89_CORE_RX_TYPE_BB_SCOPE = 3,
- RTW89_CORE_RX_TYPE_F2P_TXCMD = 4,
- RTW89_CORE_RX_TYPE_SS2FW = 5,
- RTW89_CORE_RX_TYPE_TX_REPORT = 6,
- RTW89_CORE_RX_TYPE_TX_REL_HOST = 7,
- RTW89_CORE_RX_TYPE_DFS_REPORT = 8,
- RTW89_CORE_RX_TYPE_TX_REL_CPU = 9,
- RTW89_CORE_RX_TYPE_C2H = 10,
- RTW89_CORE_RX_TYPE_CSI = 11,
- RTW89_CORE_RX_TYPE_CQI = 12,
- RTW89_CORE_RX_TYPE_H2C = 13,
- RTW89_CORE_RX_TYPE_FWDL = 14,
- };
- enum rtw89_txq_flags {
- RTW89_TXQ_F_AMPDU = 0,
- RTW89_TXQ_F_BLOCK_BA = 1,
- RTW89_TXQ_F_FORBID_BA = 2,
- };
- enum rtw89_net_type {
- RTW89_NET_TYPE_NO_LINK = 0,
- RTW89_NET_TYPE_AD_HOC = 1,
- RTW89_NET_TYPE_INFRA = 2,
- RTW89_NET_TYPE_AP_MODE = 3,
- };
- enum rtw89_wifi_role {
- RTW89_WIFI_ROLE_NONE,
- RTW89_WIFI_ROLE_STATION,
- RTW89_WIFI_ROLE_AP,
- RTW89_WIFI_ROLE_AP_VLAN,
- RTW89_WIFI_ROLE_ADHOC,
- RTW89_WIFI_ROLE_ADHOC_MASTER,
- RTW89_WIFI_ROLE_MESH_POINT,
- RTW89_WIFI_ROLE_MONITOR,
- RTW89_WIFI_ROLE_P2P_DEVICE,
- RTW89_WIFI_ROLE_P2P_CLIENT,
- RTW89_WIFI_ROLE_P2P_GO,
- RTW89_WIFI_ROLE_NAN,
- RTW89_WIFI_ROLE_MLME_MAX
- };
- enum rtw89_upd_mode {
- RTW89_ROLE_CREATE,
- RTW89_ROLE_REMOVE,
- RTW89_ROLE_TYPE_CHANGE,
- RTW89_ROLE_INFO_CHANGE,
- RTW89_ROLE_CON_DISCONN,
- RTW89_ROLE_BAND_SW,
- RTW89_ROLE_FW_RESTORE,
- };
- enum rtw89_self_role {
- RTW89_SELF_ROLE_CLIENT,
- RTW89_SELF_ROLE_AP,
- RTW89_SELF_ROLE_AP_CLIENT
- };
- enum rtw89_msk_sO_el {
- RTW89_NO_MSK,
- RTW89_SMA,
- RTW89_TMA,
- RTW89_BSSID
- };
- enum rtw89_sch_tx_sel {
- RTW89_SCH_TX_SEL_ALL,
- RTW89_SCH_TX_SEL_HIQ,
- RTW89_SCH_TX_SEL_MG0,
- RTW89_SCH_TX_SEL_MACID,
- };
- /* RTW89_ADDR_CAM_SEC_NONE : not enabled
- * RTW89_ADDR_CAM_SEC_ALL_UNI : 0 - 6 unicast
- * RTW89_ADDR_CAM_SEC_NORMAL : 0 - 1 unicast, 2 - 4 group, 5 - 6 BIP
- * RTW89_ADDR_CAM_SEC_4GROUP : 0 - 1 unicast, 2 - 5 group, 6 BIP
- */
- enum rtw89_add_cam_sec_mode {
- RTW89_ADDR_CAM_SEC_NONE = 0,
- RTW89_ADDR_CAM_SEC_ALL_UNI = 1,
- RTW89_ADDR_CAM_SEC_NORMAL = 2,
- RTW89_ADDR_CAM_SEC_4GROUP = 3,
- };
- enum rtw89_sec_key_type {
- RTW89_SEC_KEY_TYPE_NONE = 0,
- RTW89_SEC_KEY_TYPE_WEP40 = 1,
- RTW89_SEC_KEY_TYPE_WEP104 = 2,
- RTW89_SEC_KEY_TYPE_TKIP = 3,
- RTW89_SEC_KEY_TYPE_WAPI = 4,
- RTW89_SEC_KEY_TYPE_GCMSMS4 = 5,
- RTW89_SEC_KEY_TYPE_CCMP128 = 6,
- RTW89_SEC_KEY_TYPE_CCMP256 = 7,
- RTW89_SEC_KEY_TYPE_GCMP128 = 8,
- RTW89_SEC_KEY_TYPE_GCMP256 = 9,
- RTW89_SEC_KEY_TYPE_BIP_CCMP128 = 10,
- };
- enum rtw89_port {
- RTW89_PORT_0 = 0,
- RTW89_PORT_1 = 1,
- RTW89_PORT_2 = 2,
- RTW89_PORT_3 = 3,
- RTW89_PORT_4 = 4,
- RTW89_PORT_NUM
- };
- enum rtw89_band {
- RTW89_BAND_2G = 0,
- RTW89_BAND_5G = 1,
- RTW89_BAND_6G = 2,
- RTW89_BAND_NUM,
- };
- enum rtw89_hw_rate {
- RTW89_HW_RATE_CCK1 = 0x0,
- RTW89_HW_RATE_CCK2 = 0x1,
- RTW89_HW_RATE_CCK5_5 = 0x2,
- RTW89_HW_RATE_CCK11 = 0x3,
- RTW89_HW_RATE_OFDM6 = 0x4,
- RTW89_HW_RATE_OFDM9 = 0x5,
- RTW89_HW_RATE_OFDM12 = 0x6,
- RTW89_HW_RATE_OFDM18 = 0x7,
- RTW89_HW_RATE_OFDM24 = 0x8,
- RTW89_HW_RATE_OFDM36 = 0x9,
- RTW89_HW_RATE_OFDM48 = 0xA,
- RTW89_HW_RATE_OFDM54 = 0xB,
- RTW89_HW_RATE_MCS0 = 0x80,
- RTW89_HW_RATE_MCS1 = 0x81,
- RTW89_HW_RATE_MCS2 = 0x82,
- RTW89_HW_RATE_MCS3 = 0x83,
- RTW89_HW_RATE_MCS4 = 0x84,
- RTW89_HW_RATE_MCS5 = 0x85,
- RTW89_HW_RATE_MCS6 = 0x86,
- RTW89_HW_RATE_MCS7 = 0x87,
- RTW89_HW_RATE_MCS8 = 0x88,
- RTW89_HW_RATE_MCS9 = 0x89,
- RTW89_HW_RATE_MCS10 = 0x8A,
- RTW89_HW_RATE_MCS11 = 0x8B,
- RTW89_HW_RATE_MCS12 = 0x8C,
- RTW89_HW_RATE_MCS13 = 0x8D,
- RTW89_HW_RATE_MCS14 = 0x8E,
- RTW89_HW_RATE_MCS15 = 0x8F,
- RTW89_HW_RATE_MCS16 = 0x90,
- RTW89_HW_RATE_MCS17 = 0x91,
- RTW89_HW_RATE_MCS18 = 0x92,
- RTW89_HW_RATE_MCS19 = 0x93,
- RTW89_HW_RATE_MCS20 = 0x94,
- RTW89_HW_RATE_MCS21 = 0x95,
- RTW89_HW_RATE_MCS22 = 0x96,
- RTW89_HW_RATE_MCS23 = 0x97,
- RTW89_HW_RATE_MCS24 = 0x98,
- RTW89_HW_RATE_MCS25 = 0x99,
- RTW89_HW_RATE_MCS26 = 0x9A,
- RTW89_HW_RATE_MCS27 = 0x9B,
- RTW89_HW_RATE_MCS28 = 0x9C,
- RTW89_HW_RATE_MCS29 = 0x9D,
- RTW89_HW_RATE_MCS30 = 0x9E,
- RTW89_HW_RATE_MCS31 = 0x9F,
- RTW89_HW_RATE_VHT_NSS1_MCS0 = 0x100,
- RTW89_HW_RATE_VHT_NSS1_MCS1 = 0x101,
- RTW89_HW_RATE_VHT_NSS1_MCS2 = 0x102,
- RTW89_HW_RATE_VHT_NSS1_MCS3 = 0x103,
- RTW89_HW_RATE_VHT_NSS1_MCS4 = 0x104,
- RTW89_HW_RATE_VHT_NSS1_MCS5 = 0x105,
- RTW89_HW_RATE_VHT_NSS1_MCS6 = 0x106,
- RTW89_HW_RATE_VHT_NSS1_MCS7 = 0x107,
- RTW89_HW_RATE_VHT_NSS1_MCS8 = 0x108,
- RTW89_HW_RATE_VHT_NSS1_MCS9 = 0x109,
- RTW89_HW_RATE_VHT_NSS2_MCS0 = 0x110,
- RTW89_HW_RATE_VHT_NSS2_MCS1 = 0x111,
- RTW89_HW_RATE_VHT_NSS2_MCS2 = 0x112,
- RTW89_HW_RATE_VHT_NSS2_MCS3 = 0x113,
- RTW89_HW_RATE_VHT_NSS2_MCS4 = 0x114,
- RTW89_HW_RATE_VHT_NSS2_MCS5 = 0x115,
- RTW89_HW_RATE_VHT_NSS2_MCS6 = 0x116,
- RTW89_HW_RATE_VHT_NSS2_MCS7 = 0x117,
- RTW89_HW_RATE_VHT_NSS2_MCS8 = 0x118,
- RTW89_HW_RATE_VHT_NSS2_MCS9 = 0x119,
- RTW89_HW_RATE_VHT_NSS3_MCS0 = 0x120,
- RTW89_HW_RATE_VHT_NSS3_MCS1 = 0x121,
- RTW89_HW_RATE_VHT_NSS3_MCS2 = 0x122,
- RTW89_HW_RATE_VHT_NSS3_MCS3 = 0x123,
- RTW89_HW_RATE_VHT_NSS3_MCS4 = 0x124,
- RTW89_HW_RATE_VHT_NSS3_MCS5 = 0x125,
- RTW89_HW_RATE_VHT_NSS3_MCS6 = 0x126,
- RTW89_HW_RATE_VHT_NSS3_MCS7 = 0x127,
- RTW89_HW_RATE_VHT_NSS3_MCS8 = 0x128,
- RTW89_HW_RATE_VHT_NSS3_MCS9 = 0x129,
- RTW89_HW_RATE_VHT_NSS4_MCS0 = 0x130,
- RTW89_HW_RATE_VHT_NSS4_MCS1 = 0x131,
- RTW89_HW_RATE_VHT_NSS4_MCS2 = 0x132,
- RTW89_HW_RATE_VHT_NSS4_MCS3 = 0x133,
- RTW89_HW_RATE_VHT_NSS4_MCS4 = 0x134,
- RTW89_HW_RATE_VHT_NSS4_MCS5 = 0x135,
- RTW89_HW_RATE_VHT_NSS4_MCS6 = 0x136,
- RTW89_HW_RATE_VHT_NSS4_MCS7 = 0x137,
- RTW89_HW_RATE_VHT_NSS4_MCS8 = 0x138,
- RTW89_HW_RATE_VHT_NSS4_MCS9 = 0x139,
- RTW89_HW_RATE_HE_NSS1_MCS0 = 0x180,
- RTW89_HW_RATE_HE_NSS1_MCS1 = 0x181,
- RTW89_HW_RATE_HE_NSS1_MCS2 = 0x182,
- RTW89_HW_RATE_HE_NSS1_MCS3 = 0x183,
- RTW89_HW_RATE_HE_NSS1_MCS4 = 0x184,
- RTW89_HW_RATE_HE_NSS1_MCS5 = 0x185,
- RTW89_HW_RATE_HE_NSS1_MCS6 = 0x186,
- RTW89_HW_RATE_HE_NSS1_MCS7 = 0x187,
- RTW89_HW_RATE_HE_NSS1_MCS8 = 0x188,
- RTW89_HW_RATE_HE_NSS1_MCS9 = 0x189,
- RTW89_HW_RATE_HE_NSS1_MCS10 = 0x18A,
- RTW89_HW_RATE_HE_NSS1_MCS11 = 0x18B,
- RTW89_HW_RATE_HE_NSS2_MCS0 = 0x190,
- RTW89_HW_RATE_HE_NSS2_MCS1 = 0x191,
- RTW89_HW_RATE_HE_NSS2_MCS2 = 0x192,
- RTW89_HW_RATE_HE_NSS2_MCS3 = 0x193,
- RTW89_HW_RATE_HE_NSS2_MCS4 = 0x194,
- RTW89_HW_RATE_HE_NSS2_MCS5 = 0x195,
- RTW89_HW_RATE_HE_NSS2_MCS6 = 0x196,
- RTW89_HW_RATE_HE_NSS2_MCS7 = 0x197,
- RTW89_HW_RATE_HE_NSS2_MCS8 = 0x198,
- RTW89_HW_RATE_HE_NSS2_MCS9 = 0x199,
- RTW89_HW_RATE_HE_NSS2_MCS10 = 0x19A,
- RTW89_HW_RATE_HE_NSS2_MCS11 = 0x19B,
- RTW89_HW_RATE_HE_NSS3_MCS0 = 0x1A0,
- RTW89_HW_RATE_HE_NSS3_MCS1 = 0x1A1,
- RTW89_HW_RATE_HE_NSS3_MCS2 = 0x1A2,
- RTW89_HW_RATE_HE_NSS3_MCS3 = 0x1A3,
- RTW89_HW_RATE_HE_NSS3_MCS4 = 0x1A4,
- RTW89_HW_RATE_HE_NSS3_MCS5 = 0x1A5,
- RTW89_HW_RATE_HE_NSS3_MCS6 = 0x1A6,
- RTW89_HW_RATE_HE_NSS3_MCS7 = 0x1A7,
- RTW89_HW_RATE_HE_NSS3_MCS8 = 0x1A8,
- RTW89_HW_RATE_HE_NSS3_MCS9 = 0x1A9,
- RTW89_HW_RATE_HE_NSS3_MCS10 = 0x1AA,
- RTW89_HW_RATE_HE_NSS3_MCS11 = 0x1AB,
- RTW89_HW_RATE_HE_NSS4_MCS0 = 0x1B0,
- RTW89_HW_RATE_HE_NSS4_MCS1 = 0x1B1,
- RTW89_HW_RATE_HE_NSS4_MCS2 = 0x1B2,
- RTW89_HW_RATE_HE_NSS4_MCS3 = 0x1B3,
- RTW89_HW_RATE_HE_NSS4_MCS4 = 0x1B4,
- RTW89_HW_RATE_HE_NSS4_MCS5 = 0x1B5,
- RTW89_HW_RATE_HE_NSS4_MCS6 = 0x1B6,
- RTW89_HW_RATE_HE_NSS4_MCS7 = 0x1B7,
- RTW89_HW_RATE_HE_NSS4_MCS8 = 0x1B8,
- RTW89_HW_RATE_HE_NSS4_MCS9 = 0x1B9,
- RTW89_HW_RATE_HE_NSS4_MCS10 = 0x1BA,
- RTW89_HW_RATE_HE_NSS4_MCS11 = 0x1BB,
- RTW89_HW_RATE_V1_MCS0 = 0x100,
- RTW89_HW_RATE_V1_MCS1 = 0x101,
- RTW89_HW_RATE_V1_MCS2 = 0x102,
- RTW89_HW_RATE_V1_MCS3 = 0x103,
- RTW89_HW_RATE_V1_MCS4 = 0x104,
- RTW89_HW_RATE_V1_MCS5 = 0x105,
- RTW89_HW_RATE_V1_MCS6 = 0x106,
- RTW89_HW_RATE_V1_MCS7 = 0x107,
- RTW89_HW_RATE_V1_MCS8 = 0x108,
- RTW89_HW_RATE_V1_MCS9 = 0x109,
- RTW89_HW_RATE_V1_MCS10 = 0x10A,
- RTW89_HW_RATE_V1_MCS11 = 0x10B,
- RTW89_HW_RATE_V1_MCS12 = 0x10C,
- RTW89_HW_RATE_V1_MCS13 = 0x10D,
- RTW89_HW_RATE_V1_MCS14 = 0x10E,
- RTW89_HW_RATE_V1_MCS15 = 0x10F,
- RTW89_HW_RATE_V1_MCS16 = 0x110,
- RTW89_HW_RATE_V1_MCS17 = 0x111,
- RTW89_HW_RATE_V1_MCS18 = 0x112,
- RTW89_HW_RATE_V1_MCS19 = 0x113,
- RTW89_HW_RATE_V1_MCS20 = 0x114,
- RTW89_HW_RATE_V1_MCS21 = 0x115,
- RTW89_HW_RATE_V1_MCS22 = 0x116,
- RTW89_HW_RATE_V1_MCS23 = 0x117,
- RTW89_HW_RATE_V1_MCS24 = 0x118,
- RTW89_HW_RATE_V1_MCS25 = 0x119,
- RTW89_HW_RATE_V1_MCS26 = 0x11A,
- RTW89_HW_RATE_V1_MCS27 = 0x11B,
- RTW89_HW_RATE_V1_MCS28 = 0x11C,
- RTW89_HW_RATE_V1_MCS29 = 0x11D,
- RTW89_HW_RATE_V1_MCS30 = 0x11E,
- RTW89_HW_RATE_V1_MCS31 = 0x11F,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS0 = 0x200,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS1 = 0x201,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS2 = 0x202,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS3 = 0x203,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS4 = 0x204,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS5 = 0x205,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS6 = 0x206,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS7 = 0x207,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS8 = 0x208,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS9 = 0x209,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS10 = 0x20A,
- RTW89_HW_RATE_V1_VHT_NSS1_MCS11 = 0x20B,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS0 = 0x220,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS1 = 0x221,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS2 = 0x222,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS3 = 0x223,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS4 = 0x224,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS5 = 0x225,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS6 = 0x226,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS7 = 0x227,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS8 = 0x228,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS9 = 0x229,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS10 = 0x22A,
- RTW89_HW_RATE_V1_VHT_NSS2_MCS11 = 0x22B,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS0 = 0x240,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS1 = 0x241,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS2 = 0x242,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS3 = 0x243,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS4 = 0x244,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS5 = 0x245,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS6 = 0x246,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS7 = 0x247,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS8 = 0x248,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS9 = 0x249,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS10 = 0x24A,
- RTW89_HW_RATE_V1_VHT_NSS3_MCS11 = 0x24B,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS0 = 0x260,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS1 = 0x261,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS2 = 0x262,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS3 = 0x263,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS4 = 0x264,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS5 = 0x265,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS6 = 0x266,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS7 = 0x267,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS8 = 0x268,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS9 = 0x269,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS10 = 0x26A,
- RTW89_HW_RATE_V1_VHT_NSS4_MCS11 = 0x26B,
- RTW89_HW_RATE_V1_HE_NSS1_MCS0 = 0x300,
- RTW89_HW_RATE_V1_HE_NSS1_MCS1 = 0x301,
- RTW89_HW_RATE_V1_HE_NSS1_MCS2 = 0x302,
- RTW89_HW_RATE_V1_HE_NSS1_MCS3 = 0x303,
- RTW89_HW_RATE_V1_HE_NSS1_MCS4 = 0x304,
- RTW89_HW_RATE_V1_HE_NSS1_MCS5 = 0x305,
- RTW89_HW_RATE_V1_HE_NSS1_MCS6 = 0x306,
- RTW89_HW_RATE_V1_HE_NSS1_MCS7 = 0x307,
- RTW89_HW_RATE_V1_HE_NSS1_MCS8 = 0x308,
- RTW89_HW_RATE_V1_HE_NSS1_MCS9 = 0x309,
- RTW89_HW_RATE_V1_HE_NSS1_MCS10 = 0x30A,
- RTW89_HW_RATE_V1_HE_NSS1_MCS11 = 0x30B,
- RTW89_HW_RATE_V1_HE_NSS2_MCS0 = 0x320,
- RTW89_HW_RATE_V1_HE_NSS2_MCS1 = 0x321,
- RTW89_HW_RATE_V1_HE_NSS2_MCS2 = 0x322,
- RTW89_HW_RATE_V1_HE_NSS2_MCS3 = 0x323,
- RTW89_HW_RATE_V1_HE_NSS2_MCS4 = 0x324,
- RTW89_HW_RATE_V1_HE_NSS2_MCS5 = 0x325,
- RTW89_HW_RATE_V1_HE_NSS2_MCS6 = 0x326,
- RTW89_HW_RATE_V1_HE_NSS2_MCS7 = 0x327,
- RTW89_HW_RATE_V1_HE_NSS2_MCS8 = 0x328,
- RTW89_HW_RATE_V1_HE_NSS2_MCS9 = 0x329,
- RTW89_HW_RATE_V1_HE_NSS2_MCS10 = 0x32A,
- RTW89_HW_RATE_V1_HE_NSS2_MCS11 = 0x32B,
- RTW89_HW_RATE_V1_HE_NSS3_MCS0 = 0x340,
- RTW89_HW_RATE_V1_HE_NSS3_MCS1 = 0x341,
- RTW89_HW_RATE_V1_HE_NSS3_MCS2 = 0x342,
- RTW89_HW_RATE_V1_HE_NSS3_MCS3 = 0x343,
- RTW89_HW_RATE_V1_HE_NSS3_MCS4 = 0x344,
- RTW89_HW_RATE_V1_HE_NSS3_MCS5 = 0x345,
- RTW89_HW_RATE_V1_HE_NSS3_MCS6 = 0x346,
- RTW89_HW_RATE_V1_HE_NSS3_MCS7 = 0x347,
- RTW89_HW_RATE_V1_HE_NSS3_MCS8 = 0x348,
- RTW89_HW_RATE_V1_HE_NSS3_MCS9 = 0x349,
- RTW89_HW_RATE_V1_HE_NSS3_MCS10 = 0x34A,
- RTW89_HW_RATE_V1_HE_NSS3_MCS11 = 0x34B,
- RTW89_HW_RATE_V1_HE_NSS4_MCS0 = 0x360,
- RTW89_HW_RATE_V1_HE_NSS4_MCS1 = 0x361,
- RTW89_HW_RATE_V1_HE_NSS4_MCS2 = 0x362,
- RTW89_HW_RATE_V1_HE_NSS4_MCS3 = 0x363,
- RTW89_HW_RATE_V1_HE_NSS4_MCS4 = 0x364,
- RTW89_HW_RATE_V1_HE_NSS4_MCS5 = 0x365,
- RTW89_HW_RATE_V1_HE_NSS4_MCS6 = 0x366,
- RTW89_HW_RATE_V1_HE_NSS4_MCS7 = 0x367,
- RTW89_HW_RATE_V1_HE_NSS4_MCS8 = 0x368,
- RTW89_HW_RATE_V1_HE_NSS4_MCS9 = 0x369,
- RTW89_HW_RATE_V1_HE_NSS4_MCS10 = 0x36A,
- RTW89_HW_RATE_V1_HE_NSS4_MCS11 = 0x36B,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS0 = 0x400,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS1 = 0x401,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS2 = 0x402,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS3 = 0x403,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS4 = 0x404,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS5 = 0x405,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS6 = 0x406,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS7 = 0x407,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS8 = 0x408,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS9 = 0x409,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS10 = 0x40A,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS11 = 0x40B,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS12 = 0x40C,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS13 = 0x40D,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS14 = 0x40E,
- RTW89_HW_RATE_V1_EHT_NSS1_MCS15 = 0x40F,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS0 = 0x420,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS1 = 0x421,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS2 = 0x422,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS3 = 0x423,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS4 = 0x424,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS5 = 0x425,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS6 = 0x426,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS7 = 0x427,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS8 = 0x428,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS9 = 0x429,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS10 = 0x42A,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS11 = 0x42B,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS12 = 0x42C,
- RTW89_HW_RATE_V1_EHT_NSS2_MCS13 = 0x42D,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS0 = 0x440,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS1 = 0x441,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS2 = 0x442,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS3 = 0x443,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS4 = 0x444,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS5 = 0x445,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS6 = 0x446,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS7 = 0x447,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS8 = 0x448,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS9 = 0x449,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS10 = 0x44A,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS11 = 0x44B,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS12 = 0x44C,
- RTW89_HW_RATE_V1_EHT_NSS3_MCS13 = 0x44D,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS0 = 0x460,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS1 = 0x461,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS2 = 0x462,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS3 = 0x463,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS4 = 0x464,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS5 = 0x465,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS6 = 0x466,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS7 = 0x467,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS8 = 0x468,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS9 = 0x469,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS10 = 0x46A,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS11 = 0x46B,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS12 = 0x46C,
- RTW89_HW_RATE_V1_EHT_NSS4_MCS13 = 0x46D,
- RTW89_HW_RATE_NR,
- RTW89_HW_RATE_INVAL,
- RTW89_HW_RATE_MASK_MOD = GENMASK(8, 7),
- RTW89_HW_RATE_MASK_VAL = GENMASK(6, 0),
- RTW89_HW_RATE_V1_MASK_MOD = GENMASK(10, 8),
- RTW89_HW_RATE_V1_MASK_VAL = GENMASK(7, 0),
- };
- /* 2G channels,
- * 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
- */
- #define RTW89_2G_CH_NUM 14
- /* 5G channels,
- * 36, 38, 40, 42, 44, 46, 48, 50,
- * 52, 54, 56, 58, 60, 62, 64,
- * 100, 102, 104, 106, 108, 110, 112, 114,
- * 116, 118, 120, 122, 124, 126, 128, 130,
- * 132, 134, 136, 138, 140, 142, 144,
- * 149, 151, 153, 155, 157, 159, 161, 163,
- * 165, 167, 169, 171, 173, 175, 177
- */
- #define RTW89_5G_CH_NUM 53
- /* 6G channels,
- * 1, 3, 5, 7, 9, 11, 13, 15,
- * 17, 19, 21, 23, 25, 27, 29, 33,
- * 35, 37, 39, 41, 43, 45, 47, 49,
- * 51, 53, 55, 57, 59, 61, 65, 67,
- * 69, 71, 73, 75, 77, 79, 81, 83,
- * 85, 87, 89, 91, 93, 97, 99, 101,
- * 103, 105, 107, 109, 111, 113, 115, 117,
- * 119, 121, 123, 125, 129, 131, 133, 135,
- * 137, 139, 141, 143, 145, 147, 149, 151,
- * 153, 155, 157, 161, 163, 165, 167, 169,
- * 171, 173, 175, 177, 179, 181, 183, 185,
- * 187, 189, 193, 195, 197, 199, 201, 203,
- * 205, 207, 209, 211, 213, 215, 217, 219,
- * 221, 225, 227, 229, 231, 233, 235, 237,
- * 239, 241, 243, 245, 247, 249, 251, 253,
- */
- #define RTW89_6G_CH_NUM 120
- enum rtw89_rate_section {
- RTW89_RS_CCK,
- RTW89_RS_OFDM,
- RTW89_RS_MCS, /* for HT/VHT/HE */
- RTW89_RS_HEDCM,
- RTW89_RS_OFFSET,
- RTW89_RS_NUM,
- RTW89_RS_LMT_NUM = RTW89_RS_MCS + 1,
- RTW89_RS_TX_SHAPE_NUM = RTW89_RS_OFDM + 1,
- };
- enum rtw89_rate_offset_indexes {
- RTW89_RATE_OFFSET_HE,
- RTW89_RATE_OFFSET_VHT,
- RTW89_RATE_OFFSET_HT,
- RTW89_RATE_OFFSET_OFDM,
- RTW89_RATE_OFFSET_CCK,
- RTW89_RATE_OFFSET_DLRU_EHT,
- RTW89_RATE_OFFSET_DLRU_HE,
- RTW89_RATE_OFFSET_EHT,
- __RTW89_RATE_OFFSET_NUM,
- RTW89_RATE_OFFSET_NUM_AX = RTW89_RATE_OFFSET_CCK + 1,
- RTW89_RATE_OFFSET_NUM_BE = RTW89_RATE_OFFSET_EHT + 1,
- };
- enum rtw89_rate_num {
- RTW89_RATE_CCK_NUM = 4,
- RTW89_RATE_OFDM_NUM = 8,
- RTW89_RATE_HEDCM_NUM = 4, /* for HEDCM MCS0/1/3/4 */
- RTW89_RATE_MCS_NUM_AX = 12,
- RTW89_RATE_MCS_NUM_BE = 16,
- __RTW89_RATE_MCS_NUM = 16,
- };
- enum rtw89_nss {
- RTW89_NSS_1 = 0,
- RTW89_NSS_2 = 1,
- /* HE DCM only support 1ss and 2ss */
- RTW89_NSS_HEDCM_NUM = RTW89_NSS_2 + 1,
- RTW89_NSS_3 = 2,
- RTW89_NSS_4 = 3,
- RTW89_NSS_NUM,
- };
- enum rtw89_ntx {
- RTW89_1TX = 0,
- RTW89_2TX = 1,
- RTW89_NTX_NUM,
- };
- enum rtw89_beamforming_type {
- RTW89_NONBF = 0,
- RTW89_BF = 1,
- RTW89_BF_NUM,
- };
- enum rtw89_ofdma_type {
- RTW89_NON_OFDMA = 0,
- RTW89_OFDMA = 1,
- RTW89_OFDMA_NUM,
- };
- enum rtw89_regulation_type {
- RTW89_WW = 0,
- RTW89_ETSI = 1,
- RTW89_FCC = 2,
- RTW89_MKK = 3,
- RTW89_NA = 4,
- RTW89_IC = 5,
- RTW89_KCC = 6,
- RTW89_ACMA = 7,
- RTW89_NCC = 8,
- RTW89_MEXICO = 9,
- RTW89_CHILE = 10,
- RTW89_UKRAINE = 11,
- RTW89_CN = 12,
- RTW89_QATAR = 13,
- RTW89_UK = 14,
- RTW89_THAILAND = 15,
- RTW89_REGD_NUM,
- };
- enum rtw89_reg_6ghz_power {
- RTW89_REG_6GHZ_POWER_VLP = 0,
- RTW89_REG_6GHZ_POWER_LPI = 1,
- RTW89_REG_6GHZ_POWER_STD = 2,
- NUM_OF_RTW89_REG_6GHZ_POWER,
- RTW89_REG_6GHZ_POWER_DFLT = RTW89_REG_6GHZ_POWER_VLP,
- };
- enum rtw89_fw_pkt_ofld_type {
- RTW89_PKT_OFLD_TYPE_PROBE_RSP = 0,
- RTW89_PKT_OFLD_TYPE_PS_POLL = 1,
- RTW89_PKT_OFLD_TYPE_NULL_DATA = 2,
- RTW89_PKT_OFLD_TYPE_QOS_NULL = 3,
- RTW89_PKT_OFLD_TYPE_CTS2SELF = 4,
- RTW89_PKT_OFLD_TYPE_ARP_RSP = 5,
- RTW89_PKT_OFLD_TYPE_NDP = 6,
- RTW89_PKT_OFLD_TYPE_EAPOL_KEY = 7,
- RTW89_PKT_OFLD_TYPE_SA_QUERY = 8,
- RTW89_PKT_OFLD_TYPE_PROBE_REQ = 12,
- RTW89_PKT_OFLD_TYPE_NUM,
- };
- struct rtw89_txpwr_byrate {
- s8 cck[RTW89_RATE_CCK_NUM];
- s8 ofdm[RTW89_RATE_OFDM_NUM];
- s8 mcs[RTW89_OFDMA_NUM][RTW89_NSS_NUM][__RTW89_RATE_MCS_NUM];
- s8 hedcm[RTW89_OFDMA_NUM][RTW89_NSS_HEDCM_NUM][RTW89_RATE_HEDCM_NUM];
- s8 offset[__RTW89_RATE_OFFSET_NUM];
- s8 trap;
- };
- enum rtw89_bandwidth_section_num {
- RTW89_BW20_SEC_NUM = 8,
- RTW89_BW40_SEC_NUM = 4,
- RTW89_BW80_SEC_NUM = 2,
- };
- #define RTW89_TXPWR_LMT_PAGE_SIZE 40
- struct rtw89_txpwr_limit {
- s8 cck_20m[RTW89_BF_NUM];
- s8 cck_40m[RTW89_BF_NUM];
- s8 ofdm[RTW89_BF_NUM];
- s8 mcs_20m[RTW89_BW20_SEC_NUM][RTW89_BF_NUM];
- s8 mcs_40m[RTW89_BW40_SEC_NUM][RTW89_BF_NUM];
- s8 mcs_80m[RTW89_BW80_SEC_NUM][RTW89_BF_NUM];
- s8 mcs_160m[RTW89_BF_NUM];
- s8 mcs_40m_0p5[RTW89_BF_NUM];
- s8 mcs_40m_2p5[RTW89_BF_NUM];
- };
- #define RTW89_RU_SEC_NUM 8
- #define RTW89_TXPWR_LMT_RU_PAGE_SIZE 24
- struct rtw89_txpwr_limit_ru {
- s8 ru26[RTW89_RU_SEC_NUM];
- s8 ru52[RTW89_RU_SEC_NUM];
- s8 ru106[RTW89_RU_SEC_NUM];
- };
- struct rtw89_rate_desc {
- enum rtw89_nss nss;
- enum rtw89_rate_section rs;
- enum rtw89_ofdma_type ofdma;
- u8 idx;
- };
- #define PHY_STS_HDR_LEN 8
- #define RF_PATH_MAX 4
- #define RTW89_MAX_PPDU_CNT 8
- struct rtw89_rx_phy_ppdu {
- void *buf;
- u32 len;
- u8 rssi_avg;
- u8 rssi[RF_PATH_MAX];
- u8 mac_id;
- u8 chan_idx;
- u8 ie;
- u16 rate;
- struct {
- bool has;
- u8 avg_snr;
- u8 evm_max;
- u8 evm_min;
- } ofdm;
- bool to_self;
- bool valid;
- };
- enum rtw89_mac_idx {
- RTW89_MAC_0 = 0,
- RTW89_MAC_1 = 1,
- };
- enum rtw89_phy_idx {
- RTW89_PHY_0 = 0,
- RTW89_PHY_1 = 1,
- RTW89_PHY_MAX
- };
- enum rtw89_sub_entity_idx {
- RTW89_SUB_ENTITY_0 = 0,
- RTW89_SUB_ENTITY_1 = 1,
- NUM_OF_RTW89_SUB_ENTITY,
- RTW89_SUB_ENTITY_IDLE = NUM_OF_RTW89_SUB_ENTITY,
- };
- enum rtw89_rf_path {
- RF_PATH_A = 0,
- RF_PATH_B = 1,
- RF_PATH_C = 2,
- RF_PATH_D = 3,
- RF_PATH_AB,
- RF_PATH_AC,
- RF_PATH_AD,
- RF_PATH_BC,
- RF_PATH_BD,
- RF_PATH_CD,
- RF_PATH_ABC,
- RF_PATH_ABD,
- RF_PATH_ACD,
- RF_PATH_BCD,
- RF_PATH_ABCD,
- };
- enum rtw89_rf_path_bit {
- RF_A = BIT(0),
- RF_B = BIT(1),
- RF_C = BIT(2),
- RF_D = BIT(3),
- RF_AB = (RF_A | RF_B),
- RF_AC = (RF_A | RF_C),
- RF_AD = (RF_A | RF_D),
- RF_BC = (RF_B | RF_C),
- RF_BD = (RF_B | RF_D),
- RF_CD = (RF_C | RF_D),
- RF_ABC = (RF_A | RF_B | RF_C),
- RF_ABD = (RF_A | RF_B | RF_D),
- RF_ACD = (RF_A | RF_C | RF_D),
- RF_BCD = (RF_B | RF_C | RF_D),
- RF_ABCD = (RF_A | RF_B | RF_C | RF_D),
- };
- enum rtw89_bandwidth {
- RTW89_CHANNEL_WIDTH_20 = 0,
- RTW89_CHANNEL_WIDTH_40 = 1,
- RTW89_CHANNEL_WIDTH_80 = 2,
- RTW89_CHANNEL_WIDTH_160 = 3,
- RTW89_CHANNEL_WIDTH_320 = 4,
- /* keep index order above */
- RTW89_CHANNEL_WIDTH_ORDINARY_NUM = 5,
- RTW89_CHANNEL_WIDTH_80_80 = 5,
- RTW89_CHANNEL_WIDTH_5 = 6,
- RTW89_CHANNEL_WIDTH_10 = 7,
- };
- enum rtw89_ps_mode {
- RTW89_PS_MODE_NONE = 0,
- RTW89_PS_MODE_RFOFF = 1,
- RTW89_PS_MODE_CLK_GATED = 2,
- RTW89_PS_MODE_PWR_GATED = 3,
- };
- #define RTW89_2G_BW_NUM (RTW89_CHANNEL_WIDTH_40 + 1)
- #define RTW89_5G_BW_NUM (RTW89_CHANNEL_WIDTH_160 + 1)
- #define RTW89_6G_BW_NUM (RTW89_CHANNEL_WIDTH_320 + 1)
- #define RTW89_BYR_BW_NUM (RTW89_CHANNEL_WIDTH_320 + 1)
- #define RTW89_PPE_BW_NUM (RTW89_CHANNEL_WIDTH_160 + 1)
- enum rtw89_ru_bandwidth {
- RTW89_RU26 = 0,
- RTW89_RU52 = 1,
- RTW89_RU106 = 2,
- RTW89_RU52_26 = 3,
- RTW89_RU106_26 = 4,
- RTW89_RU_NUM,
- };
- enum rtw89_sc_offset {
- RTW89_SC_DONT_CARE = 0,
- RTW89_SC_20_UPPER = 1,
- RTW89_SC_20_LOWER = 2,
- RTW89_SC_20_UPMOST = 3,
- RTW89_SC_20_LOWEST = 4,
- RTW89_SC_20_UP2X = 5,
- RTW89_SC_20_LOW2X = 6,
- RTW89_SC_20_UP3X = 7,
- RTW89_SC_20_LOW3X = 8,
- RTW89_SC_40_UPPER = 9,
- RTW89_SC_40_LOWER = 10,
- };
- enum rtw89_wow_flags {
- RTW89_WOW_FLAG_EN_MAGIC_PKT,
- RTW89_WOW_FLAG_EN_REKEY_PKT,
- RTW89_WOW_FLAG_EN_DISCONNECT,
- RTW89_WOW_FLAG_NUM,
- };
- struct rtw89_chan {
- u8 channel;
- u8 primary_channel;
- enum rtw89_band band_type;
- enum rtw89_bandwidth band_width;
- /* The follow-up are derived from the above. We must ensure that it
- * is assigned correctly in rtw89_chan_create() if new one is added.
- */
- u32 freq;
- enum rtw89_subband subband_type;
- enum rtw89_sc_offset pri_ch_idx;
- u8 pri_sb_idx;
- };
- struct rtw89_chan_rcd {
- u8 prev_primary_channel;
- enum rtw89_band prev_band_type;
- bool band_changed;
- };
- struct rtw89_channel_help_params {
- u32 tx_en;
- };
- struct rtw89_port_reg {
- u32 port_cfg;
- u32 tbtt_prohib;
- u32 bcn_area;
- u32 bcn_early;
- u32 tbtt_early;
- u32 tbtt_agg;
- u32 bcn_space;
- u32 bcn_forcetx;
- u32 bcn_err_cnt;
- u32 bcn_err_flag;
- u32 dtim_ctrl;
- u32 tbtt_shift;
- u32 bcn_cnt_tmr;
- u32 tsftr_l;
- u32 tsftr_h;
- u32 md_tsft;
- u32 bss_color;
- u32 mbssid;
- u32 mbssid_drop;
- u32 tsf_sync;
- u32 hiq_win[RTW89_PORT_NUM];
- };
- struct rtw89_txwd_body {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- } __packed;
- struct rtw89_txwd_body_v1 {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- __le32 dword6;
- __le32 dword7;
- } __packed;
- struct rtw89_txwd_body_v2 {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- __le32 dword6;
- __le32 dword7;
- } __packed;
- struct rtw89_txwd_info {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- } __packed;
- struct rtw89_txwd_info_v2 {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- __le32 dword6;
- __le32 dword7;
- } __packed;
- struct rtw89_rx_desc_info {
- u16 pkt_size;
- u8 pkt_type;
- u8 drv_info_size;
- u8 phy_rpt_size;
- u8 hdr_cnv_size;
- u8 shift;
- u8 wl_hd_iv_len;
- bool long_rxdesc;
- bool bb_sel;
- bool mac_info_valid;
- u16 data_rate;
- u8 gi_ltf;
- u8 bw;
- u32 free_run_cnt;
- u8 user_id;
- bool sr_en;
- u8 ppdu_cnt;
- u8 ppdu_type;
- bool icv_err;
- bool crc32_err;
- bool hw_dec;
- bool sw_dec;
- bool addr1_match;
- u8 frag;
- u16 seq;
- u8 frame_type;
- u8 rx_pl_id;
- bool addr_cam_valid;
- u8 addr_cam_id;
- u8 sec_cam_id;
- u8 mac_id;
- u16 offset;
- u16 rxd_len;
- bool ready;
- };
- struct rtw89_rxdesc_short {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- } __packed;
- struct rtw89_rxdesc_short_v2 {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- } __packed;
- struct rtw89_rxdesc_long {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- __le32 dword6;
- __le32 dword7;
- } __packed;
- struct rtw89_rxdesc_long_v2 {
- __le32 dword0;
- __le32 dword1;
- __le32 dword2;
- __le32 dword3;
- __le32 dword4;
- __le32 dword5;
- __le32 dword6;
- __le32 dword7;
- __le32 dword8;
- __le32 dword9;
- } __packed;
- struct rtw89_tx_desc_info {
- u16 pkt_size;
- u8 wp_offset;
- u8 mac_id;
- u8 qsel;
- u8 ch_dma;
- u8 hdr_llc_len;
- bool is_bmc;
- bool en_wd_info;
- bool wd_page;
- bool use_rate;
- bool dis_data_fb;
- bool tid_indicate;
- bool agg_en;
- bool bk;
- u8 ampdu_density;
- u8 ampdu_num;
- bool sec_en;
- u8 addr_info_nr;
- u8 sec_keyid;
- u8 sec_type;
- u8 sec_cam_idx;
- u8 sec_seq[6];
- u16 data_rate;
- u16 data_retry_lowest_rate;
- bool fw_dl;
- u16 seq;
- bool a_ctrl_bsr;
- u8 hw_ssn_sel;
- #define RTW89_MGMT_HW_SSN_SEL 1
- u8 hw_seq_mode;
- #define RTW89_MGMT_HW_SEQ_MODE 1
- bool hiq;
- u8 port;
- bool er_cap;
- };
- struct rtw89_core_tx_request {
- enum rtw89_core_tx_type tx_type;
- struct sk_buff *skb;
- struct ieee80211_vif *vif;
- struct ieee80211_sta *sta;
- struct rtw89_tx_desc_info desc_info;
- };
- struct rtw89_txq {
- struct list_head list;
- unsigned long flags;
- int wait_cnt;
- };
- struct rtw89_mac_ax_gnt {
- u8 gnt_bt_sw_en;
- u8 gnt_bt;
- u8 gnt_wl_sw_en;
- u8 gnt_wl;
- } __packed;
- #define RTW89_MAC_AX_COEX_GNT_NR 2
- struct rtw89_mac_ax_coex_gnt {
- struct rtw89_mac_ax_gnt band[RTW89_MAC_AX_COEX_GNT_NR];
- };
- enum rtw89_btc_ncnt {
- BTC_NCNT_POWER_ON = 0x0,
- BTC_NCNT_POWER_OFF,
- BTC_NCNT_INIT_COEX,
- BTC_NCNT_SCAN_START,
- BTC_NCNT_SCAN_FINISH,
- BTC_NCNT_SPECIAL_PACKET,
- BTC_NCNT_SWITCH_BAND,
- BTC_NCNT_RFK_TIMEOUT,
- BTC_NCNT_SHOW_COEX_INFO,
- BTC_NCNT_ROLE_INFO,
- BTC_NCNT_CONTROL,
- BTC_NCNT_RADIO_STATE,
- BTC_NCNT_CUSTOMERIZE,
- BTC_NCNT_WL_RFK,
- BTC_NCNT_WL_STA,
- BTC_NCNT_FWINFO,
- BTC_NCNT_TIMER,
- BTC_NCNT_NUM
- };
- enum rtw89_btc_btinfo {
- BTC_BTINFO_L0 = 0,
- BTC_BTINFO_L1,
- BTC_BTINFO_L2,
- BTC_BTINFO_L3,
- BTC_BTINFO_H0,
- BTC_BTINFO_H1,
- BTC_BTINFO_H2,
- BTC_BTINFO_H3,
- BTC_BTINFO_MAX
- };
- enum rtw89_btc_dcnt {
- BTC_DCNT_RUN = 0x0,
- BTC_DCNT_CX_RUNINFO,
- BTC_DCNT_RPT,
- BTC_DCNT_RPT_HANG,
- BTC_DCNT_CYCLE,
- BTC_DCNT_CYCLE_HANG,
- BTC_DCNT_W1,
- BTC_DCNT_W1_HANG,
- BTC_DCNT_B1,
- BTC_DCNT_B1_HANG,
- BTC_DCNT_TDMA_NONSYNC,
- BTC_DCNT_SLOT_NONSYNC,
- BTC_DCNT_BTCNT_HANG,
- BTC_DCNT_WL_SLOT_DRIFT,
- BTC_DCNT_WL_STA_LAST,
- BTC_DCNT_BT_SLOT_DRIFT,
- BTC_DCNT_BT_SLOT_FLOOD,
- BTC_DCNT_FDDT_TRIG,
- BTC_DCNT_E2G,
- BTC_DCNT_E2G_HANG,
- BTC_DCNT_NUM
- };
- enum rtw89_btc_wl_state_cnt {
- BTC_WCNT_SCANAP = 0x0,
- BTC_WCNT_DHCP,
- BTC_WCNT_EAPOL,
- BTC_WCNT_ARP,
- BTC_WCNT_SCBDUPDATE,
- BTC_WCNT_RFK_REQ,
- BTC_WCNT_RFK_GO,
- BTC_WCNT_RFK_REJECT,
- BTC_WCNT_RFK_TIMEOUT,
- BTC_WCNT_CH_UPDATE,
- BTC_WCNT_NUM
- };
- enum rtw89_btc_bt_state_cnt {
- BTC_BCNT_RETRY = 0x0,
- BTC_BCNT_REINIT,
- BTC_BCNT_REENABLE,
- BTC_BCNT_SCBDREAD,
- BTC_BCNT_RELINK,
- BTC_BCNT_IGNOWL,
- BTC_BCNT_INQPAG,
- BTC_BCNT_INQ,
- BTC_BCNT_PAGE,
- BTC_BCNT_ROLESW,
- BTC_BCNT_AFH,
- BTC_BCNT_INFOUPDATE,
- BTC_BCNT_INFOSAME,
- BTC_BCNT_SCBDUPDATE,
- BTC_BCNT_HIPRI_TX,
- BTC_BCNT_HIPRI_RX,
- BTC_BCNT_LOPRI_TX,
- BTC_BCNT_LOPRI_RX,
- BTC_BCNT_POLUT,
- BTC_BCNT_RATECHG,
- BTC_BCNT_NUM
- };
- enum rtw89_btc_bt_profile {
- BTC_BT_NOPROFILE = 0,
- BTC_BT_HFP = BIT(0),
- BTC_BT_HID = BIT(1),
- BTC_BT_A2DP = BIT(2),
- BTC_BT_PAN = BIT(3),
- BTC_PROFILE_MAX = 4,
- };
- struct rtw89_btc_ant_info {
- u8 type; /* shared, dedicated */
- u8 num;
- u8 isolation;
- u8 single_pos: 1;/* Single antenna at S0 or S1 */
- u8 diversity: 1;
- u8 btg_pos: 2;
- u8 stream_cnt: 4;
- };
- enum rtw89_tfc_dir {
- RTW89_TFC_UL,
- RTW89_TFC_DL,
- };
- struct rtw89_btc_wl_smap {
- u32 busy: 1;
- u32 scan: 1;
- u32 connecting: 1;
- u32 roaming: 1;
- u32 _4way: 1;
- u32 rf_off: 1;
- u32 lps: 2;
- u32 ips: 1;
- u32 init_ok: 1;
- u32 traffic_dir : 2;
- u32 rf_off_pre: 1;
- u32 lps_pre: 2;
- };
- enum rtw89_tfc_lv {
- RTW89_TFC_IDLE,
- RTW89_TFC_ULTRA_LOW,
- RTW89_TFC_LOW,
- RTW89_TFC_MID,
- RTW89_TFC_HIGH,
- };
- #define RTW89_TP_SHIFT 18 /* bytes/2s --> Mbps */
- DECLARE_EWMA(tp, 10, 2);
- struct rtw89_traffic_stats {
- /* units in bytes */
- u64 tx_unicast;
- u64 rx_unicast;
- u32 tx_avg_len;
- u32 rx_avg_len;
- /* count for packets */
- u64 tx_cnt;
- u64 rx_cnt;
- /* units in Mbps */
- u32 tx_throughput;
- u32 rx_throughput;
- u32 tx_throughput_raw;
- u32 rx_throughput_raw;
- u32 rx_tf_acc;
- u32 rx_tf_periodic;
- enum rtw89_tfc_lv tx_tfc_lv;
- enum rtw89_tfc_lv rx_tfc_lv;
- struct ewma_tp tx_ewma_tp;
- struct ewma_tp rx_ewma_tp;
- u16 tx_rate;
- u16 rx_rate;
- };
- struct rtw89_btc_statistic {
- u8 rssi; /* 0%~110% (dBm = rssi -110) */
- struct rtw89_traffic_stats traffic;
- };
- #define BTC_WL_RSSI_THMAX 4
- struct rtw89_btc_wl_link_info {
- struct rtw89_btc_statistic stat;
- enum rtw89_tfc_dir dir;
- u8 rssi_state[BTC_WL_RSSI_THMAX];
- u8 mac_addr[ETH_ALEN];
- u8 busy;
- u8 ch;
- u8 bw;
- u8 band;
- u8 role;
- u8 pid;
- u8 phy;
- u8 dtim_period;
- u8 mode;
- u8 mac_id;
- u8 tx_retry;
- u32 bcn_period;
- u32 busy_t;
- u32 tx_time;
- u32 client_cnt;
- u32 rx_rate_drop_cnt;
- u32 active: 1;
- u32 noa: 1;
- u32 client_ps: 1;
- u32 connected: 2;
- };
- union rtw89_btc_wl_state_map {
- u32 val;
- struct rtw89_btc_wl_smap map;
- };
- struct rtw89_btc_bt_hfp_desc {
- u32 exist: 1;
- u32 type: 2;
- u32 rsvd: 29;
- };
- struct rtw89_btc_bt_hid_desc {
- u32 exist: 1;
- u32 slot_info: 2;
- u32 pair_cnt: 2;
- u32 type: 8;
- u32 rsvd: 19;
- };
- struct rtw89_btc_bt_a2dp_desc {
- u8 exist: 1;
- u8 exist_last: 1;
- u8 play_latency: 1;
- u8 type: 3;
- u8 active: 1;
- u8 sink: 1;
- u8 bitpool;
- u16 vendor_id;
- u32 device_name;
- u32 flush_time;
- };
- struct rtw89_btc_bt_pan_desc {
- u32 exist: 1;
- u32 type: 1;
- u32 active: 1;
- u32 rsvd: 29;
- };
- struct rtw89_btc_bt_rfk_info {
- u32 run: 1;
- u32 req: 1;
- u32 timeout: 1;
- u32 rsvd: 29;
- };
- union rtw89_btc_bt_rfk_info_map {
- u32 val;
- struct rtw89_btc_bt_rfk_info map;
- };
- struct rtw89_btc_bt_ver_info {
- u32 fw_coex; /* match with which coex_ver */
- u32 fw;
- };
- struct rtw89_btc_bool_sta_chg {
- u32 now: 1;
- u32 last: 1;
- u32 remain: 1;
- u32 srvd: 29;
- };
- struct rtw89_btc_u8_sta_chg {
- u8 now;
- u8 last;
- u8 remain;
- u8 rsvd;
- };
- struct rtw89_btc_wl_scan_info {
- u8 band[RTW89_PHY_MAX];
- u8 phy_map;
- u8 rsvd;
- };
- struct rtw89_btc_wl_dbcc_info {
- u8 op_band[RTW89_PHY_MAX]; /* op band in each phy */
- u8 scan_band[RTW89_PHY_MAX]; /* scan band in each phy */
- u8 real_band[RTW89_PHY_MAX];
- u8 role[RTW89_PHY_MAX]; /* role in each phy */
- };
- struct rtw89_btc_wl_active_role {
- u8 connected: 1;
- u8 pid: 3;
- u8 phy: 1;
- u8 noa: 1;
- u8 band: 2;
- u8 client_ps: 1;
- u8 bw: 7;
- u8 role;
- u8 ch;
- u16 tx_lvl;
- u16 rx_lvl;
- u16 tx_rate;
- u16 rx_rate;
- };
- struct rtw89_btc_wl_active_role_v1 {
- u8 connected: 1;
- u8 pid: 3;
- u8 phy: 1;
- u8 noa: 1;
- u8 band: 2;
- u8 client_ps: 1;
- u8 bw: 7;
- u8 role;
- u8 ch;
- u16 tx_lvl;
- u16 rx_lvl;
- u16 tx_rate;
- u16 rx_rate;
- u32 noa_duration; /* ms */
- };
- struct rtw89_btc_wl_active_role_v2 {
- u8 connected: 1;
- u8 pid: 3;
- u8 phy: 1;
- u8 noa: 1;
- u8 band: 2;
- u8 client_ps: 1;
- u8 bw: 7;
- u8 role;
- u8 ch;
- u32 noa_duration; /* ms */
- };
- struct rtw89_btc_wl_role_info_bpos {
- u16 none: 1;
- u16 station: 1;
- u16 ap: 1;
- u16 vap: 1;
- u16 adhoc: 1;
- u16 adhoc_master: 1;
- u16 mesh: 1;
- u16 moniter: 1;
- u16 p2p_device: 1;
- u16 p2p_gc: 1;
- u16 p2p_go: 1;
- u16 nan: 1;
- };
- struct rtw89_btc_wl_scc_ctrl {
- u8 null_role1;
- u8 null_role2;
- u8 ebt_null; /* if tx null at EBT slot */
- };
- union rtw89_btc_wl_role_info_map {
- u16 val;
- struct rtw89_btc_wl_role_info_bpos role;
- };
- struct rtw89_btc_wl_role_info { /* struct size must be n*4 bytes */
- u8 connect_cnt;
- u8 link_mode;
- union rtw89_btc_wl_role_info_map role_map;
- struct rtw89_btc_wl_active_role active_role[RTW89_PORT_NUM];
- };
- struct rtw89_btc_wl_role_info_v1 { /* struct size must be n*4 bytes */
- u8 connect_cnt;
- u8 link_mode;
- union rtw89_btc_wl_role_info_map role_map;
- struct rtw89_btc_wl_active_role_v1 active_role_v1[RTW89_PORT_NUM];
- u32 mrole_type; /* btc_wl_mrole_type */
- u32 mrole_noa_duration; /* ms */
- u32 dbcc_en: 1;
- u32 dbcc_chg: 1;
- u32 dbcc_2g_phy: 2; /* which phy operate in 2G, HW_PHY_0 or HW_PHY_1 */
- u32 link_mode_chg: 1;
- u32 rsvd: 27;
- };
- struct rtw89_btc_wl_role_info_v2 { /* struct size must be n*4 bytes */
- u8 connect_cnt;
- u8 link_mode;
- union rtw89_btc_wl_role_info_map role_map;
- struct rtw89_btc_wl_active_role_v2 active_role_v2[RTW89_PORT_NUM];
- u32 mrole_type; /* btc_wl_mrole_type */
- u32 mrole_noa_duration; /* ms */
- u32 dbcc_en: 1;
- u32 dbcc_chg: 1;
- u32 dbcc_2g_phy: 2; /* which phy operate in 2G, HW_PHY_0 or HW_PHY_1 */
- u32 link_mode_chg: 1;
- u32 rsvd: 27;
- };
- struct rtw89_btc_wl_ver_info {
- u32 fw_coex; /* match with which coex_ver */
- u32 fw;
- u32 mac;
- u32 bb;
- u32 rf;
- };
- struct rtw89_btc_wl_afh_info {
- u8 en;
- u8 ch;
- u8 bw;
- u8 rsvd;
- } __packed;
- struct rtw89_btc_wl_rfk_info {
- u32 state: 2;
- u32 path_map: 4;
- u32 phy_map: 2;
- u32 band: 2;
- u32 type: 8;
- u32 rsvd: 14;
- };
- struct rtw89_btc_bt_smap {
- u32 connect: 1;
- u32 ble_connect: 1;
- u32 acl_busy: 1;
- u32 sco_busy: 1;
- u32 mesh_busy: 1;
- u32 inq_pag: 1;
- };
- union rtw89_btc_bt_state_map {
- u32 val;
- struct rtw89_btc_bt_smap map;
- };
- #define BTC_BT_RSSI_THMAX 4
- #define BTC_BT_AFH_GROUP 12
- #define BTC_BT_AFH_LE_GROUP 5
- struct rtw89_btc_bt_link_info {
- struct rtw89_btc_u8_sta_chg profile_cnt;
- struct rtw89_btc_bool_sta_chg multi_link;
- struct rtw89_btc_bool_sta_chg relink;
- struct rtw89_btc_bt_hfp_desc hfp_desc;
- struct rtw89_btc_bt_hid_desc hid_desc;
- struct rtw89_btc_bt_a2dp_desc a2dp_desc;
- struct rtw89_btc_bt_pan_desc pan_desc;
- union rtw89_btc_bt_state_map status;
- u8 sut_pwr_level[BTC_PROFILE_MAX];
- u8 golden_rx_shift[BTC_PROFILE_MAX];
- u8 rssi_state[BTC_BT_RSSI_THMAX];
- u8 afh_map[BTC_BT_AFH_GROUP];
- u8 afh_map_le[BTC_BT_AFH_LE_GROUP];
- u32 role_sw: 1;
- u32 slave_role: 1;
- u32 afh_update: 1;
- u32 cqddr: 1;
- u32 rssi: 8;
- u32 tx_3m: 1;
- u32 rsvd: 19;
- };
- struct rtw89_btc_3rdcx_info {
- u8 type; /* 0: none, 1:zigbee, 2:LTE */
- u8 hw_coex;
- u16 rsvd;
- };
- struct rtw89_btc_dm_emap {
- u32 init: 1;
- u32 pta_owner: 1;
- u32 wl_rfk_timeout: 1;
- u32 bt_rfk_timeout: 1;
- u32 wl_fw_hang: 1;
- u32 cycle_hang: 1;
- u32 w1_hang: 1;
- u32 b1_hang: 1;
- u32 tdma_no_sync: 1;
- u32 slot_no_sync: 1;
- u32 wl_slot_drift: 1;
- u32 bt_slot_drift: 1;
- u32 role_num_mismatch: 1;
- u32 null1_tx_late: 1;
- u32 bt_afh_conflict: 1;
- u32 bt_leafh_conflict: 1;
- u32 bt_slot_flood: 1;
- u32 wl_e2g_hang: 1;
- u32 wl_ver_mismatch: 1;
- u32 bt_ver_mismatch: 1;
- };
- union rtw89_btc_dm_error_map {
- u32 val;
- struct rtw89_btc_dm_emap map;
- };
- struct rtw89_btc_rf_para {
- u32 tx_pwr_freerun;
- u32 rx_gain_freerun;
- u32 tx_pwr_perpkt;
- u32 rx_gain_perpkt;
- };
- struct rtw89_btc_wl_nhm {
- u8 instant_wl_nhm_dbm;
- u8 instant_wl_nhm_per_mhz;
- u16 valid_record_times;
- s8 record_pwr[16];
- u8 record_ratio[16];
- s8 pwr; /* dbm_per_MHz */
- u8 ratio;
- u8 current_status;
- u8 refresh;
- bool start_flag;
- s8 pwr_max;
- s8 pwr_min;
- };
- struct rtw89_btc_wl_info {
- struct rtw89_btc_wl_link_info link_info[RTW89_PORT_NUM];
- struct rtw89_btc_wl_rfk_info rfk_info;
- struct rtw89_btc_wl_ver_info ver_info;
- struct rtw89_btc_wl_afh_info afh_info;
- struct rtw89_btc_wl_role_info role_info;
- struct rtw89_btc_wl_role_info_v1 role_info_v1;
- struct rtw89_btc_wl_role_info_v2 role_info_v2;
- struct rtw89_btc_wl_scan_info scan_info;
- struct rtw89_btc_wl_dbcc_info dbcc_info;
- struct rtw89_btc_rf_para rf_para;
- struct rtw89_btc_wl_nhm nhm;
- union rtw89_btc_wl_state_map status;
- u8 port_id[RTW89_WIFI_ROLE_MLME_MAX];
- u8 rssi_level;
- u8 cn_report;
- bool scbd_change;
- u32 scbd;
- };
- struct rtw89_btc_module {
- struct rtw89_btc_ant_info ant;
- u8 rfe_type;
- u8 cv;
- u8 bt_solo: 1;
- u8 bt_pos: 1;
- u8 switch_type: 1;
- u8 wa_type: 3;
- u8 kt_ver_adie;
- };
- #define RTW89_BTC_DM_MAXSTEP 30
- #define RTW89_BTC_DM_CNT_MAX (RTW89_BTC_DM_MAXSTEP * 8)
- struct rtw89_btc_dm_step {
- u16 step[RTW89_BTC_DM_MAXSTEP];
- u8 step_pos;
- bool step_ov;
- };
- struct rtw89_btc_init_info {
- struct rtw89_btc_module module;
- u8 wl_guard_ch;
- u8 wl_only: 1;
- u8 wl_init_ok: 1;
- u8 dbcc_en: 1;
- u8 cx_other: 1;
- u8 bt_only: 1;
- u16 rsvd;
- };
- struct rtw89_btc_wl_tx_limit_para {
- u16 enable;
- u32 tx_time; /* unit: us */
- u16 tx_retry;
- };
- enum rtw89_btc_bt_scan_type {
- BTC_SCAN_INQ = 0,
- BTC_SCAN_PAGE,
- BTC_SCAN_BLE,
- BTC_SCAN_INIT,
- BTC_SCAN_TV,
- BTC_SCAN_ADV,
- BTC_SCAN_MAX1,
- };
- enum rtw89_btc_ble_scan_type {
- CXSCAN_BG = 0,
- CXSCAN_INIT,
- CXSCAN_LE,
- CXSCAN_MAX
- };
- #define RTW89_BTC_BTC_SCAN_V1_FLAG_ENABLE BIT(0)
- #define RTW89_BTC_BTC_SCAN_V1_FLAG_INTERLACE BIT(1)
- struct rtw89_btc_bt_scan_info_v1 {
- __le16 win;
- __le16 intvl;
- __le32 flags;
- } __packed;
- struct rtw89_btc_bt_scan_info_v2 {
- __le16 win;
- __le16 intvl;
- } __packed;
- struct rtw89_btc_fbtc_btscan_v1 {
- u8 fver; /* btc_ver::fcxbtscan */
- u8 rsvd;
- __le16 rsvd2;
- struct rtw89_btc_bt_scan_info_v1 scan[BTC_SCAN_MAX1];
- } __packed;
- struct rtw89_btc_fbtc_btscan_v2 {
- u8 fver; /* btc_ver::fcxbtscan */
- u8 type;
- __le16 rsvd2;
- struct rtw89_btc_bt_scan_info_v2 para[CXSCAN_MAX];
- } __packed;
- union rtw89_btc_fbtc_btscan {
- struct rtw89_btc_fbtc_btscan_v1 v1;
- struct rtw89_btc_fbtc_btscan_v2 v2;
- };
- struct rtw89_btc_bt_info {
- struct rtw89_btc_bt_link_info link_info;
- struct rtw89_btc_bt_scan_info_v1 scan_info_v1[BTC_SCAN_MAX1];
- struct rtw89_btc_bt_scan_info_v2 scan_info_v2[CXSCAN_MAX];
- struct rtw89_btc_bt_ver_info ver_info;
- struct rtw89_btc_bool_sta_chg enable;
- struct rtw89_btc_bool_sta_chg inq_pag;
- struct rtw89_btc_rf_para rf_para;
- union rtw89_btc_bt_rfk_info_map rfk_info;
- u8 raw_info[BTC_BTINFO_MAX]; /* raw bt info from mailbox */
- u32 scbd;
- u32 feature;
- u32 mbx_avl: 1;
- u32 whql_test: 1;
- u32 igno_wl: 1;
- u32 reinit: 1;
- u32 ble_scan_en: 1;
- u32 btg_type: 1;
- u32 inq: 1;
- u32 pag: 1;
- u32 run_patch_code: 1;
- u32 hi_lna_rx: 1;
- u32 scan_rx_low_pri: 1;
- u32 scan_info_update: 1;
- u32 rsvd: 20;
- };
- struct rtw89_btc_cx {
- struct rtw89_btc_wl_info wl;
- struct rtw89_btc_bt_info bt;
- struct rtw89_btc_3rdcx_info other;
- u32 state_map;
- u32 cnt_bt[BTC_BCNT_NUM];
- u32 cnt_wl[BTC_WCNT_NUM];
- };
- struct rtw89_btc_fbtc_tdma {
- u8 type; /* btc_ver::fcxtdma */
- u8 rxflctrl;
- u8 txpause;
- u8 wtgle_n;
- u8 leak_n;
- u8 ext_ctrl;
- u8 rxflctrl_role;
- u8 option_ctrl;
- } __packed;
- struct rtw89_btc_fbtc_tdma_v3 {
- u8 fver; /* btc_ver::fcxtdma */
- u8 rsvd;
- __le16 rsvd1;
- struct rtw89_btc_fbtc_tdma tdma;
- } __packed;
- union rtw89_btc_fbtc_tdma_le32 {
- struct rtw89_btc_fbtc_tdma v1;
- struct rtw89_btc_fbtc_tdma_v3 v3;
- };
- #define CXMREG_MAX 30
- #define CXMREG_MAX_V2 20
- #define FCXMAX_STEP 255 /*STEP trace record cnt, Max:65535, default:255*/
- #define BTC_CYCLE_SLOT_MAX 48 /* must be even number, non-zero */
- enum rtw89_btc_bt_sta_counter {
- BTC_BCNT_RFK_REQ = 0,
- BTC_BCNT_RFK_GO = 1,
- BTC_BCNT_RFK_REJECT = 2,
- BTC_BCNT_RFK_FAIL = 3,
- BTC_BCNT_RFK_TIMEOUT = 4,
- BTC_BCNT_HI_TX = 5,
- BTC_BCNT_HI_RX = 6,
- BTC_BCNT_LO_TX = 7,
- BTC_BCNT_LO_RX = 8,
- BTC_BCNT_POLLUTED = 9,
- BTC_BCNT_STA_MAX
- };
- enum rtw89_btc_bt_sta_counter_v105 {
- BTC_BCNT_RFK_REQ_V105 = 0,
- BTC_BCNT_HI_TX_V105 = 1,
- BTC_BCNT_HI_RX_V105 = 2,
- BTC_BCNT_LO_TX_V105 = 3,
- BTC_BCNT_LO_RX_V105 = 4,
- BTC_BCNT_POLLUTED_V105 = 5,
- BTC_BCNT_STA_MAX_V105
- };
- struct rtw89_btc_fbtc_rpt_ctrl_v1 {
- u16 fver; /* btc_ver::fcxbtcrpt */
- u16 rpt_cnt; /* tmr counters */
- u32 wl_fw_coex_ver; /* match which driver's coex version */
- u32 wl_fw_cx_offload;
- u32 wl_fw_ver;
- u32 rpt_enable;
- u32 rpt_para; /* ms */
- u32 mb_send_fail_cnt; /* fw send mailbox fail counter */
- u32 mb_send_ok_cnt; /* fw send mailbox ok counter */
- u32 mb_recv_cnt; /* fw recv mailbox counter */
- u32 mb_a2dp_empty_cnt; /* a2dp empty count */
- u32 mb_a2dp_flct_cnt; /* a2dp empty flow control counter */
- u32 mb_a2dp_full_cnt; /* a2dp empty full counter */
- u32 bt_rfk_cnt[BTC_BCNT_HI_TX];
- u32 c2h_cnt; /* fw send c2h counter */
- u32 h2c_cnt; /* fw recv h2c counter */
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_info {
- __le32 cnt; /* fw report counter */
- __le32 en; /* report map */
- __le32 para; /* not used */
- __le32 cnt_c2h; /* fw send c2h counter */
- __le32 cnt_h2c; /* fw recv h2c counter */
- __le32 len_c2h; /* The total length of the last C2H */
- __le32 cnt_aoac_rf_on; /* rf-on counter for aoac switch notify */
- __le32 cnt_aoac_rf_off; /* rf-off counter for aoac switch notify */
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_info_v5 {
- __le32 cx_ver; /* match which driver's coex version */
- __le32 fw_ver;
- __le32 en; /* report map */
- __le16 cnt; /* fw report counter */
- __le16 cnt_c2h; /* fw send c2h counter */
- __le16 cnt_h2c; /* fw recv h2c counter */
- __le16 len_c2h; /* The total length of the last C2H */
- __le16 cnt_aoac_rf_on; /* rf-on counter for aoac switch notify */
- __le16 cnt_aoac_rf_off; /* rf-off counter for aoac switch notify */
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_wl_fw_info {
- __le32 cx_ver; /* match which driver's coex version */
- __le32 cx_offload;
- __le32 fw_ver;
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_a2dp_empty {
- __le32 cnt_empty; /* a2dp empty count */
- __le32 cnt_flowctrl; /* a2dp empty flow control counter */
- __le32 cnt_tx;
- __le32 cnt_ack;
- __le32 cnt_nack;
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox {
- __le32 cnt_send_ok; /* fw send mailbox ok counter */
- __le32 cnt_send_fail; /* fw send mailbox fail counter */
- __le32 cnt_recv; /* fw recv mailbox counter */
- struct rtw89_btc_fbtc_rpt_ctrl_a2dp_empty a2dp;
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_v4 {
- u8 fver;
- u8 rsvd;
- __le16 rsvd1;
- struct rtw89_btc_fbtc_rpt_ctrl_info rpt_info;
- struct rtw89_btc_fbtc_rpt_ctrl_wl_fw_info wl_fw_info;
- struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
- __le32 bt_cnt[BTC_BCNT_STA_MAX];
- struct rtw89_mac_ax_gnt gnt_val[RTW89_PHY_MAX];
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_v5 {
- u8 fver;
- u8 rsvd;
- __le16 rsvd1;
- u8 gnt_val[RTW89_PHY_MAX][4];
- __le16 bt_cnt[BTC_BCNT_STA_MAX];
- struct rtw89_btc_fbtc_rpt_ctrl_info_v5 rpt_info;
- struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
- } __packed;
- struct rtw89_btc_fbtc_rpt_ctrl_v105 {
- u8 fver;
- u8 rsvd;
- __le16 rsvd1;
- u8 gnt_val[RTW89_PHY_MAX][4];
- __le16 bt_cnt[BTC_BCNT_STA_MAX_V105];
- struct rtw89_btc_fbtc_rpt_ctrl_info_v5 rpt_info;
- struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
- } __packed;
- union rtw89_btc_fbtc_rpt_ctrl_ver_info {
- struct rtw89_btc_fbtc_rpt_ctrl_v1 v1;
- struct rtw89_btc_fbtc_rpt_ctrl_v4 v4;
- struct rtw89_btc_fbtc_rpt_ctrl_v5 v5;
- struct rtw89_btc_fbtc_rpt_ctrl_v105 v105;
- };
- enum rtw89_fbtc_ext_ctrl_type {
- CXECTL_OFF = 0x0, /* tdma off */
- CXECTL_B2 = 0x1, /* allow B2 (beacon-early) */
- CXECTL_EXT = 0x2,
- CXECTL_MAX
- };
- union rtw89_btc_fbtc_rxflct {
- u8 val;
- u8 type: 3;
- u8 tgln_n: 5;
- };
- enum rtw89_btc_cxst_state {
- CXST_OFF = 0x0,
- CXST_B2W = 0x1,
- CXST_W1 = 0x2,
- CXST_W2 = 0x3,
- CXST_W2B = 0x4,
- CXST_B1 = 0x5,
- CXST_B2 = 0x6,
- CXST_B3 = 0x7,
- CXST_B4 = 0x8,
- CXST_LK = 0x9,
- CXST_BLK = 0xa,
- CXST_E2G = 0xb,
- CXST_E5G = 0xc,
- CXST_EBT = 0xd,
- CXST_ENULL = 0xe,
- CXST_WLK = 0xf,
- CXST_W1FDD = 0x10,
- CXST_B1FDD = 0x11,
- CXST_MAX = 0x12,
- };
- enum rtw89_btc_cxevnt {
- CXEVNT_TDMA_ENTRY = 0x0,
- CXEVNT_WL_TMR,
- CXEVNT_B1_TMR,
- CXEVNT_B2_TMR,
- CXEVNT_B3_TMR,
- CXEVNT_B4_TMR,
- CXEVNT_W2B_TMR,
- CXEVNT_B2W_TMR,
- CXEVNT_BCN_EARLY,
- CXEVNT_A2DP_EMPTY,
- CXEVNT_LK_END,
- CXEVNT_RX_ISR,
- CXEVNT_RX_FC0,
- CXEVNT_RX_FC1,
- CXEVNT_BT_RELINK,
- CXEVNT_BT_RETRY,
- CXEVNT_E2G,
- CXEVNT_E5G,
- CXEVNT_EBT,
- CXEVNT_ENULL,
- CXEVNT_DRV_WLK,
- CXEVNT_BCN_OK,
- CXEVNT_BT_CHANGE,
- CXEVNT_EBT_EXTEND,
- CXEVNT_E2G_NULL1,
- CXEVNT_B1FDD_TMR,
- CXEVNT_MAX
- };
- enum {
- CXBCN_ALL = 0x0,
- CXBCN_ALL_OK,
- CXBCN_BT_SLOT,
- CXBCN_BT_OK,
- CXBCN_MAX
- };
- enum btc_slot_type {
- SLOT_MIX = 0x0, /* accept BT Lower-Pri Tx/Rx request 0x778 = 1 */
- SLOT_ISO = 0x1, /* no accept BT Lower-Pri Tx/Rx request 0x778 = d*/
- CXSTYPE_NUM,
- };
- enum { /* TIME */
- CXT_BT = 0x0,
- CXT_WL = 0x1,
- CXT_MAX
- };
- enum { /* TIME-A2DP */
- CXT_FLCTRL_OFF = 0x0,
- CXT_FLCTRL_ON = 0x1,
- CXT_FLCTRL_MAX
- };
- enum { /* STEP TYPE */
- CXSTEP_NONE = 0x0,
- CXSTEP_EVNT = 0x1,
- CXSTEP_SLOT = 0x2,
- CXSTEP_MAX,
- };
- enum rtw89_btc_afh_map_type { /*AFH MAP TYPE */
- RPT_BT_AFH_SEQ_LEGACY = 0x10,
- RPT_BT_AFH_SEQ_LE = 0x20
- };
- #define BTC_DBG_MAX1 32
- struct rtw89_btc_fbtc_gpio_dbg {
- u8 fver; /* btc_ver::fcxgpiodbg */
- u8 rsvd;
- u16 rsvd2;
- u32 en_map; /* which debug signal (see btc_wl_gpio_debug) is enable */
- u32 pre_state; /* the debug signal is 1 or 0 */
- u8 gpio_map[BTC_DBG_MAX1]; /*the debug signals to GPIO-Position */
- } __packed;
- struct rtw89_btc_fbtc_mreg_val_v1 {
- u8 fver; /* btc_ver::fcxmreg */
- u8 reg_num;
- __le16 rsvd;
- __le32 mreg_val[CXMREG_MAX];
- } __packed;
- struct rtw89_btc_fbtc_mreg_val_v2 {
- u8 fver; /* btc_ver::fcxmreg */
- u8 reg_num;
- __le16 rsvd;
- __le32 mreg_val[CXMREG_MAX_V2];
- } __packed;
- union rtw89_btc_fbtc_mreg_val {
- struct rtw89_btc_fbtc_mreg_val_v1 v1;
- struct rtw89_btc_fbtc_mreg_val_v2 v2;
- };
- #define RTW89_DEF_FBTC_MREG(__type, __bytes, __offset) \
- { .type = cpu_to_le16(__type), .bytes = cpu_to_le16(__bytes), \
- .offset = cpu_to_le32(__offset), }
- struct rtw89_btc_fbtc_mreg {
- __le16 type;
- __le16 bytes;
- __le32 offset;
- } __packed;
- struct rtw89_btc_fbtc_slot {
- __le16 dur;
- __le32 cxtbl;
- __le16 cxtype;
- } __packed;
- struct rtw89_btc_fbtc_slots {
- u8 fver; /* btc_ver::fcxslots */
- u8 tbl_num;
- __le16 rsvd;
- __le32 update_map;
- struct rtw89_btc_fbtc_slot slot[CXST_MAX];
- } __packed;
- struct rtw89_btc_fbtc_step {
- u8 type;
- u8 val;
- __le16 difft;
- } __packed;
- struct rtw89_btc_fbtc_steps_v2 {
- u8 fver; /* btc_ver::fcxstep */
- u8 rsvd;
- __le16 cnt;
- __le16 pos_old;
- __le16 pos_new;
- struct rtw89_btc_fbtc_step step[FCXMAX_STEP];
- } __packed;
- struct rtw89_btc_fbtc_steps_v3 {
- u8 fver;
- u8 en;
- __le16 rsvd;
- __le32 cnt;
- struct rtw89_btc_fbtc_step step[FCXMAX_STEP];
- } __packed;
- union rtw89_btc_fbtc_steps_info {
- struct rtw89_btc_fbtc_steps_v2 v2;
- struct rtw89_btc_fbtc_steps_v3 v3;
- };
- struct rtw89_btc_fbtc_cysta_v2 { /* statistics for cycles */
- u8 fver; /* btc_ver::fcxcysta */
- u8 rsvd;
- __le16 cycles; /* total cycle number */
- __le16 cycles_a2dp[CXT_FLCTRL_MAX];
- __le16 a2dpept; /* a2dp empty cnt */
- __le16 a2dpeptto; /* a2dp empty timeout cnt*/
- __le16 tavg_cycle[CXT_MAX]; /* avg wl/bt cycle time */
- __le16 tmax_cycle[CXT_MAX]; /* max wl/bt cycle time */
- __le16 tmaxdiff_cycle[CXT_MAX]; /* max wl-wl bt-bt cycle diff time */
- __le16 tavg_a2dp[CXT_FLCTRL_MAX]; /* avg a2dp PSTDMA/TDMA time */
- __le16 tmax_a2dp[CXT_FLCTRL_MAX]; /* max a2dp PSTDMA/TDMA time */
- __le16 tavg_a2dpept; /* avg a2dp empty time */
- __le16 tmax_a2dpept; /* max a2dp empty time */
- __le16 tavg_lk; /* avg leak-slot time */
- __le16 tmax_lk; /* max leak-slot time */
- __le32 slot_cnt[CXST_MAX]; /* slot count */
- __le32 bcn_cnt[CXBCN_MAX];
- __le32 leakrx_cnt; /* the rximr occur at leak slot */
- __le32 collision_cnt; /* counter for event/timer occur at same time */
- __le32 skip_cnt;
- __le32 exception;
- __le32 except_cnt;
- __le16 tslot_cycle[BTC_CYCLE_SLOT_MAX];
- } __packed;
- struct rtw89_btc_fbtc_fdd_try_info {
- __le16 cycles[CXT_FLCTRL_MAX];
- __le16 tavg[CXT_FLCTRL_MAX]; /* avg try BT-Slot-TDD/BT-slot-FDD time */
- __le16 tmax[CXT_FLCTRL_MAX]; /* max try BT-Slot-TDD/BT-slot-FDD time */
- } __packed;
- struct rtw89_btc_fbtc_cycle_time_info {
- __le16 tavg[CXT_MAX]; /* avg wl/bt cycle time */
- __le16 tmax[CXT_MAX]; /* max wl/bt cycle time */
- __le16 tmaxdiff[CXT_MAX]; /* max wl-wl bt-bt cycle diff time */
- } __packed;
- struct rtw89_btc_fbtc_cycle_time_info_v5 {
- __le16 tavg[CXT_MAX]; /* avg wl/bt cycle time */
- __le16 tmax[CXT_MAX]; /* max wl/bt cycle time */
- } __packed;
- struct rtw89_btc_fbtc_a2dp_trx_stat {
- u8 empty_cnt;
- u8 retry_cnt;
- u8 tx_rate;
- u8 tx_cnt;
- u8 ack_cnt;
- u8 nack_cnt;
- u8 rsvd1;
- u8 rsvd2;
- } __packed;
- struct rtw89_btc_fbtc_a2dp_trx_stat_v4 {
- u8 empty_cnt;
- u8 retry_cnt;
- u8 tx_rate;
- u8 tx_cnt;
- u8 ack_cnt;
- u8 nack_cnt;
- u8 no_empty_cnt;
- u8 rsvd;
- } __packed;
- struct rtw89_btc_fbtc_cycle_a2dp_empty_info {
- __le16 cnt; /* a2dp empty cnt */
- __le16 cnt_timeout; /* a2dp empty timeout cnt*/
- __le16 tavg; /* avg a2dp empty time */
- __le16 tmax; /* max a2dp empty time */
- } __packed;
- struct rtw89_btc_fbtc_cycle_leak_info {
- __le32 cnt_rximr; /* the rximr occur at leak slot */
- __le16 tavg; /* avg leak-slot time */
- __le16 tmax; /* max leak-slot time */
- } __packed;
- #define RTW89_BTC_FDDT_PHASE_CYCLE GENMASK(9, 0)
- #define RTW89_BTC_FDDT_TRAIN_STEP GENMASK(15, 10)
- struct rtw89_btc_fbtc_cycle_fddt_info {
- __le16 train_cycle;
- __le16 tp;
- s8 tx_power; /* absolute Tx power (dBm), 0xff-> no BTC control */
- s8 bt_tx_power; /* decrease Tx power (dB) */
- s8 bt_rx_gain; /* LNA constrain level */
- u8 no_empty_cnt;
- u8 rssi; /* [7:4] -> bt_rssi_level, [3:0]-> wl_rssi_level */
- u8 cn; /* condition_num */
- u8 train_status; /* [7:4]-> train-state, [3:0]-> train-phase */
- u8 train_result; /* refer to enum btc_fddt_check_map */
- } __packed;
- #define RTW89_BTC_FDDT_CELL_TRAIN_STATE GENMASK(3, 0)
- #define RTW89_BTC_FDDT_CELL_TRAIN_PHASE GENMASK(7, 4)
- struct rtw89_btc_fbtc_cycle_fddt_info_v5 {
- __le16 train_cycle;
- __le16 tp;
- s8 tx_power; /* absolute Tx power (dBm), 0xff-> no BTC control */
- s8 bt_tx_power; /* decrease Tx power (dB) */
- s8 bt_rx_gain; /* LNA constrain level */
- u8 no_empty_cnt;
- u8 rssi; /* [7:4] -> bt_rssi_level, [3:0]-> wl_rssi_level */
- u8 cn; /* condition_num */
- u8 train_status; /* [7:4]-> train-state, [3:0]-> train-phase */
- u8 train_result; /* refer to enum btc_fddt_check_map */
- } __packed;
- struct rtw89_btc_fbtc_fddt_cell_status {
- s8 wl_tx_pwr;
- s8 bt_tx_pwr;
- s8 bt_rx_gain;
- u8 state_phase; /* [0:3] train state, [4:7] train phase */
- } __packed;
- struct rtw89_btc_fbtc_fddt_cell_status_v5 {
- s8 wl_tx_pwr;
- s8 bt_tx_pwr;
- s8 bt_rx_gain;
- } __packed;
- struct rtw89_btc_fbtc_cysta_v3 { /* statistics for cycles */
- u8 fver;
- u8 rsvd;
- __le16 cycles; /* total cycle number */
- __le16 slot_step_time[BTC_CYCLE_SLOT_MAX];
- struct rtw89_btc_fbtc_cycle_time_info cycle_time;
- struct rtw89_btc_fbtc_fdd_try_info fdd_try;
- struct rtw89_btc_fbtc_cycle_a2dp_empty_info a2dp_ept;
- struct rtw89_btc_fbtc_a2dp_trx_stat a2dp_trx[BTC_CYCLE_SLOT_MAX];
- struct rtw89_btc_fbtc_cycle_leak_info leak_slot;
- __le32 slot_cnt[CXST_MAX]; /* slot count */
- __le32 bcn_cnt[CXBCN_MAX];
- __le32 collision_cnt; /* counter for event/timer occur at the same time */
- __le32 skip_cnt;
- __le32 except_cnt;
- __le32 except_map;
- } __packed;
- #define FDD_TRAIN_WL_DIRECTION 2
- #define FDD_TRAIN_WL_RSSI_LEVEL 5
- #define FDD_TRAIN_BT_RSSI_LEVEL 5
- struct rtw89_btc_fbtc_cysta_v4 { /* statistics for cycles */
- u8 fver;
- u8 rsvd;
- u8 collision_cnt; /* counter for event/timer occur at the same time */
- u8 except_cnt;
- __le16 skip_cnt;
- __le16 cycles; /* total cycle number */
- __le16 slot_step_time[BTC_CYCLE_SLOT_MAX]; /* record the wl/bt slot time */
- __le16 slot_cnt[CXST_MAX]; /* slot count */
- __le16 bcn_cnt[CXBCN_MAX];
- struct rtw89_btc_fbtc_cycle_time_info cycle_time;
- struct rtw89_btc_fbtc_cycle_leak_info leak_slot;
- struct rtw89_btc_fbtc_cycle_a2dp_empty_info a2dp_ept;
- struct rtw89_btc_fbtc_a2dp_trx_stat_v4 a2dp_trx[BTC_CYCLE_SLOT_MAX];
- struct rtw89_btc_fbtc_cycle_fddt_info fddt_trx[BTC_CYCLE_SLOT_MAX];
- struct rtw89_btc_fbtc_fddt_cell_status fddt_cells[FDD_TRAIN_WL_DIRECTION]
- [FDD_TRAIN_WL_RSSI_LEVEL]
- [FDD_TRAIN_BT_RSSI_LEVEL];
- __le32 except_map;
- } __packed;
- struct rtw89_btc_fbtc_cysta_v5 { /* statistics for cycles */
- u8 fver;
- u8 rsvd;
- u8 collision_cnt; /* counter for event/timer occur at the same time */
- u8 except_cnt;
- u8 wl_rx_err_ratio[BTC_CYCLE_SLOT_MAX];
- __le16 skip_cnt;
- __le16 cycles; /* total cycle number */
- __le16 slot_step_time[BTC_CYCLE_SLOT_MAX]; /* record the wl/bt slot time */
- __le16 slot_cnt[CXST_MAX]; /* slot count */
- __le16 bcn_cnt[CXBCN_MAX];
- struct rtw89_btc_fbtc_cycle_time_info_v5 cycle_time;
- struct rtw89_btc_fbtc_cycle_leak_info leak_slot;
- struct rtw89_btc_fbtc_cycle_a2dp_empty_info a2dp_ept;
- struct rtw89_btc_fbtc_a2dp_trx_stat_v4 a2dp_trx[BTC_CYCLE_SLOT_MAX];
- struct rtw89_btc_fbtc_cycle_fddt_info_v5 fddt_trx[BTC_CYCLE_SLOT_MAX];
- struct rtw89_btc_fbtc_fddt_cell_status_v5 fddt_cells[FDD_TRAIN_WL_DIRECTION]
- [FDD_TRAIN_WL_RSSI_LEVEL]
- [FDD_TRAIN_BT_RSSI_LEVEL];
- __le32 except_map;
- } __packed;
- union rtw89_btc_fbtc_cysta_info {
- struct rtw89_btc_fbtc_cysta_v2 v2;
- struct rtw89_btc_fbtc_cysta_v3 v3;
- struct rtw89_btc_fbtc_cysta_v4 v4;
- struct rtw89_btc_fbtc_cysta_v5 v5;
- };
- struct rtw89_btc_fbtc_cynullsta_v1 { /* cycle null statistics */
- u8 fver; /* btc_ver::fcxnullsta */
- u8 rsvd;
- __le16 rsvd2;
- __le32 max_t[2]; /* max_t for 0:null0/1:null1 */
- __le32 avg_t[2]; /* avg_t for 0:null0/1:null1 */
- __le32 result[2][4]; /* 0:fail, 1:ok, 2:on_time, 3:retry */
- } __packed;
- struct rtw89_btc_fbtc_cynullsta_v2 { /* cycle null statistics */
- u8 fver; /* btc_ver::fcxnullsta */
- u8 rsvd;
- __le16 rsvd2;
- __le32 max_t[2]; /* max_t for 0:null0/1:null1 */
- __le32 avg_t[2]; /* avg_t for 0:null0/1:null1 */
- __le32 result[2][5]; /* 0:fail, 1:ok, 2:on_time, 3:retry, 4:tx */
- } __packed;
- union rtw89_btc_fbtc_cynullsta_info {
- struct rtw89_btc_fbtc_cynullsta_v1 v1; /* info from fw */
- struct rtw89_btc_fbtc_cynullsta_v2 v2;
- };
- struct rtw89_btc_fbtc_btver {
- u8 fver; /* btc_ver::fcxbtver */
- u8 rsvd;
- __le16 rsvd2;
- __le32 coex_ver; /*bit[15:8]->shared, bit[7:0]->non-shared */
- __le32 fw_ver;
- __le32 feature;
- } __packed;
- struct rtw89_btc_fbtc_btafh {
- u8 fver; /* btc_ver::fcxbtafh */
- u8 rsvd;
- __le16 rsvd2;
- u8 afh_l[4]; /*bit0:2402, bit1: 2403.... bit31:2433 */
- u8 afh_m[4]; /*bit0:2434, bit1: 2435.... bit31:2465 */
- u8 afh_h[4]; /*bit0:2466, bit1:2467......bit14:2480 */
- } __packed;
- struct rtw89_btc_fbtc_btafh_v2 {
- u8 fver; /* btc_ver::fcxbtafh */
- u8 rsvd;
- u8 rsvd2;
- u8 map_type;
- u8 afh_l[4];
- u8 afh_m[4];
- u8 afh_h[4];
- u8 afh_le_a[4];
- u8 afh_le_b[4];
- } __packed;
- struct rtw89_btc_fbtc_btdevinfo {
- u8 fver; /* btc_ver::fcxbtdevinfo */
- u8 rsvd;
- __le16 vendor_id;
- __le32 dev_name; /* only 24 bits valid */
- __le32 flush_time;
- } __packed;
- #define RTW89_BTC_WL_DEF_TX_PWR GENMASK(7, 0)
- struct rtw89_btc_rf_trx_para {
- u32 wl_tx_power; /* absolute Tx power (dBm), 0xff-> no BTC control */
- u32 wl_rx_gain; /* rx gain table index (TBD.) */
- u8 bt_tx_power; /* decrease Tx power (dB) */
- u8 bt_rx_gain; /* LNA constrain level */
- };
- struct rtw89_btc_trx_info {
- u8 tx_lvl;
- u8 rx_lvl;
- u8 wl_rssi;
- u8 bt_rssi;
- s8 tx_power; /* absolute Tx power (dBm), 0xff-> no BTC control */
- s8 rx_gain; /* rx gain table index (TBD.) */
- s8 bt_tx_power; /* decrease Tx power (dB) */
- s8 bt_rx_gain; /* LNA constrain level */
- u8 cn; /* condition_num */
- s8 nhm;
- u8 bt_profile;
- u8 rsvd2;
- u16 tx_rate;
- u16 rx_rate;
- u32 tx_tp;
- u32 rx_tp;
- u32 rx_err_ratio;
- };
- struct rtw89_btc_dm {
- struct rtw89_btc_fbtc_slot slot[CXST_MAX];
- struct rtw89_btc_fbtc_slot slot_now[CXST_MAX];
- struct rtw89_btc_fbtc_tdma tdma;
- struct rtw89_btc_fbtc_tdma tdma_now;
- struct rtw89_mac_ax_coex_gnt gnt;
- struct rtw89_btc_init_info init_info; /* pass to wl_fw if offload */
- struct rtw89_btc_rf_trx_para rf_trx_para;
- struct rtw89_btc_wl_tx_limit_para wl_tx_limit;
- struct rtw89_btc_dm_step dm_step;
- struct rtw89_btc_wl_scc_ctrl wl_scc;
- struct rtw89_btc_trx_info trx_info;
- union rtw89_btc_dm_error_map error;
- u32 cnt_dm[BTC_DCNT_NUM];
- u32 cnt_notify[BTC_NCNT_NUM];
- u32 update_slot_map;
- u32 set_ant_path;
- u32 wl_only: 1;
- u32 wl_fw_cx_offload: 1;
- u32 freerun: 1;
- u32 fddt_train: 1;
- u32 wl_ps_ctrl: 2;
- u32 wl_mimo_ps: 1;
- u32 leak_ap: 1;
- u32 noisy_level: 3;
- u32 coex_info_map: 8;
- u32 bt_only: 1;
- u32 wl_btg_rx: 1;
- u32 trx_para_level: 8;
- u32 wl_stb_chg: 1;
- u32 pta_owner: 1;
- u32 tdma_instant_excute: 1;
- u16 slot_dur[CXST_MAX];
- u8 run_reason;
- u8 run_action;
- u8 wl_lna2: 1;
- };
- struct rtw89_btc_ctrl {
- u32 manual: 1;
- u32 igno_bt: 1;
- u32 always_freerun: 1;
- u32 trace_step: 16;
- u32 rsvd: 12;
- };
- struct rtw89_btc_dbg {
- /* cmd "rb" */
- bool rb_done;
- u32 rb_val;
- };
- enum rtw89_btc_btf_fw_event {
- BTF_EVNT_RPT = 0,
- BTF_EVNT_BT_INFO = 1,
- BTF_EVNT_BT_SCBD = 2,
- BTF_EVNT_BT_REG = 3,
- BTF_EVNT_CX_RUNINFO = 4,
- BTF_EVNT_BT_PSD = 5,
- BTF_EVNT_BUF_OVERFLOW,
- BTF_EVNT_C2H_LOOPBACK,
- BTF_EVNT_MAX,
- };
- enum btf_fw_event_report {
- BTC_RPT_TYPE_CTRL = 0x0,
- BTC_RPT_TYPE_TDMA,
- BTC_RPT_TYPE_SLOT,
- BTC_RPT_TYPE_CYSTA,
- BTC_RPT_TYPE_STEP,
- BTC_RPT_TYPE_NULLSTA,
- BTC_RPT_TYPE_MREG,
- BTC_RPT_TYPE_GPIO_DBG,
- BTC_RPT_TYPE_BT_VER,
- BTC_RPT_TYPE_BT_SCAN,
- BTC_RPT_TYPE_BT_AFH,
- BTC_RPT_TYPE_BT_DEVICE,
- BTC_RPT_TYPE_TEST,
- BTC_RPT_TYPE_MAX = 31
- };
- enum rtw_btc_btf_reg_type {
- REG_MAC = 0x0,
- REG_BB = 0x1,
- REG_RF = 0x2,
- REG_BT_RF = 0x3,
- REG_BT_MODEM = 0x4,
- REG_BT_BLUEWIZE = 0x5,
- REG_BT_VENDOR = 0x6,
- REG_BT_LE = 0x7,
- REG_MAX_TYPE,
- };
- struct rtw89_btc_rpt_cmn_info {
- u32 rx_cnt;
- u32 rx_len;
- u32 req_len; /* expected rsp len */
- u8 req_fver; /* expected rsp fver */
- u8 rsp_fver; /* fver from fw */
- u8 valid;
- } __packed;
- union rtw89_btc_fbtc_btafh_info {
- struct rtw89_btc_fbtc_btafh v1;
- struct rtw89_btc_fbtc_btafh_v2 v2;
- };
- struct rtw89_btc_report_ctrl_state {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_rpt_ctrl_ver_info finfo;
- };
- struct rtw89_btc_rpt_fbtc_tdma {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_tdma_le32 finfo;
- };
- struct rtw89_btc_rpt_fbtc_slots {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- struct rtw89_btc_fbtc_slots finfo; /* info from fw */
- };
- struct rtw89_btc_rpt_fbtc_cysta {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_cysta_info finfo;
- };
- struct rtw89_btc_rpt_fbtc_step {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_steps_info finfo; /* info from fw */
- };
- struct rtw89_btc_rpt_fbtc_nullsta {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_cynullsta_info finfo;
- };
- struct rtw89_btc_rpt_fbtc_mreg {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_mreg_val finfo; /* info from fw */
- };
- struct rtw89_btc_rpt_fbtc_gpio_dbg {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- struct rtw89_btc_fbtc_gpio_dbg finfo; /* info from fw */
- };
- struct rtw89_btc_rpt_fbtc_btver {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- struct rtw89_btc_fbtc_btver finfo; /* info from fw */
- };
- struct rtw89_btc_rpt_fbtc_btscan {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_btscan finfo; /* info from fw */
- };
- struct rtw89_btc_rpt_fbtc_btafh {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- union rtw89_btc_fbtc_btafh_info finfo;
- };
- struct rtw89_btc_rpt_fbtc_btdev {
- struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
- struct rtw89_btc_fbtc_btdevinfo finfo; /* info from fw */
- };
- enum rtw89_btc_btfre_type {
- BTFRE_INVALID_INPUT = 0x0, /* invalid input parameters */
- BTFRE_UNDEF_TYPE,
- BTFRE_EXCEPTION,
- BTFRE_MAX,
- };
- struct rtw89_btc_btf_fwinfo {
- u32 cnt_c2h;
- u32 cnt_h2c;
- u32 cnt_h2c_fail;
- u32 event[BTF_EVNT_MAX];
- u32 err[BTFRE_MAX];
- u32 len_mismch;
- u32 fver_mismch;
- u32 rpt_en_map;
- struct rtw89_btc_report_ctrl_state rpt_ctrl;
- struct rtw89_btc_rpt_fbtc_tdma rpt_fbtc_tdma;
- struct rtw89_btc_rpt_fbtc_slots rpt_fbtc_slots;
- struct rtw89_btc_rpt_fbtc_cysta rpt_fbtc_cysta;
- struct rtw89_btc_rpt_fbtc_step rpt_fbtc_step;
- struct rtw89_btc_rpt_fbtc_nullsta rpt_fbtc_nullsta;
- struct rtw89_btc_rpt_fbtc_mreg rpt_fbtc_mregval;
- struct rtw89_btc_rpt_fbtc_gpio_dbg rpt_fbtc_gpio_dbg;
- struct rtw89_btc_rpt_fbtc_btver rpt_fbtc_btver;
- struct rtw89_btc_rpt_fbtc_btscan rpt_fbtc_btscan;
- struct rtw89_btc_rpt_fbtc_btafh rpt_fbtc_btafh;
- struct rtw89_btc_rpt_fbtc_btdev rpt_fbtc_btdev;
- };
- struct rtw89_btc_ver {
- enum rtw89_core_chip_id chip_id;
- u32 fw_ver_code;
- u8 fcxbtcrpt;
- u8 fcxtdma;
- u8 fcxslots;
- u8 fcxcysta;
- u8 fcxstep;
- u8 fcxnullsta;
- u8 fcxmreg;
- u8 fcxgpiodbg;
- u8 fcxbtver;
- u8 fcxbtscan;
- u8 fcxbtafh;
- u8 fcxbtdevinfo;
- u8 fwlrole;
- u8 frptmap;
- u8 fcxctrl;
- u16 info_buf;
- u8 max_role_num;
- };
- #define RTW89_BTC_POLICY_MAXLEN 512
- struct rtw89_btc {
- const struct rtw89_btc_ver *ver;
- struct rtw89_btc_cx cx;
- struct rtw89_btc_dm dm;
- struct rtw89_btc_ctrl ctrl;
- struct rtw89_btc_module mdinfo;
- struct rtw89_btc_btf_fwinfo fwinfo;
- struct rtw89_btc_dbg dbg;
- struct work_struct eapol_notify_work;
- struct work_struct arp_notify_work;
- struct work_struct dhcp_notify_work;
- struct work_struct icmp_notify_work;
- u32 bt_req_len;
- u8 policy[RTW89_BTC_POLICY_MAXLEN];
- u16 policy_len;
- u16 policy_type;
- bool bt_req_en;
- bool update_policy_force;
- bool lps;
- };
- enum rtw89_btc_hmsg {
- RTW89_BTC_HMSG_TMR_EN = 0x0,
- RTW89_BTC_HMSG_BT_REG_READBACK = 0x1,
- RTW89_BTC_HMSG_SET_BT_REQ_SLOT = 0x2,
- RTW89_BTC_HMSG_FW_EV = 0x3,
- RTW89_BTC_HMSG_BT_LINK_CHG = 0x4,
- RTW89_BTC_HMSG_SET_BT_REQ_STBC = 0x5,
- NUM_OF_RTW89_BTC_HMSG,
- };
- enum rtw89_ra_mode {
- RTW89_RA_MODE_CCK = BIT(0),
- RTW89_RA_MODE_OFDM = BIT(1),
- RTW89_RA_MODE_HT = BIT(2),
- RTW89_RA_MODE_VHT = BIT(3),
- RTW89_RA_MODE_HE = BIT(4),
- };
- enum rtw89_ra_report_mode {
- RTW89_RA_RPT_MODE_LEGACY,
- RTW89_RA_RPT_MODE_HT,
- RTW89_RA_RPT_MODE_VHT,
- RTW89_RA_RPT_MODE_HE,
- };
- enum rtw89_dig_noisy_level {
- RTW89_DIG_NOISY_LEVEL0 = -1,
- RTW89_DIG_NOISY_LEVEL1 = 0,
- RTW89_DIG_NOISY_LEVEL2 = 1,
- RTW89_DIG_NOISY_LEVEL3 = 2,
- RTW89_DIG_NOISY_LEVEL_MAX = 3,
- };
- enum rtw89_gi_ltf {
- RTW89_GILTF_LGI_4XHE32 = 0,
- RTW89_GILTF_SGI_4XHE08 = 1,
- RTW89_GILTF_2XHE16 = 2,
- RTW89_GILTF_2XHE08 = 3,
- RTW89_GILTF_1XHE16 = 4,
- RTW89_GILTF_1XHE08 = 5,
- RTW89_GILTF_MAX
- };
- enum rtw89_rx_frame_type {
- RTW89_RX_TYPE_MGNT = 0,
- RTW89_RX_TYPE_CTRL = 1,
- RTW89_RX_TYPE_DATA = 2,
- RTW89_RX_TYPE_RSVD = 3,
- };
- struct rtw89_ra_info {
- u8 is_dis_ra:1;
- /* Bit0 : CCK
- * Bit1 : OFDM
- * Bit2 : HT
- * Bit3 : VHT
- * Bit4 : HE
- * Bit5 : EHT
- */
- u8 mode_ctrl:6;
- u8 bw_cap:3; /* enum rtw89_bandwidth */
- u8 macid;
- u8 dcm_cap:1;
- u8 er_cap:1;
- u8 init_rate_lv:2;
- u8 upd_all:1;
- u8 en_sgi:1;
- u8 ldpc_cap:1;
- u8 stbc_cap:1;
- u8 ss_num:3;
- u8 giltf:3;
- u8 upd_bw_nss_mask:1;
- u8 upd_mask:1;
- u64 ra_mask; /* 63 bits ra_mask + 1 bit CSI ctrl */
- /* BFee CSI */
- u8 band_num;
- u8 ra_csi_rate_en:1;
- u8 fixed_csi_rate_en:1;
- u8 cr_tbl_sel:1;
- u8 fix_giltf_en:1;
- u8 fix_giltf:3;
- u8 rsvd2:1;
- u8 csi_mcs_ss_idx;
- u8 csi_mode:2;
- u8 csi_gi_ltf:3;
- u8 csi_bw:3;
- };
- #define RTW89_PPDU_MAX_USR 4
- #define RTW89_PPDU_MAC_INFO_USR_SIZE 4
- #define RTW89_PPDU_MAC_INFO_SIZE 8
- #define RTW89_PPDU_MAC_RX_CNT_SIZE 96
- #define RTW89_MAX_RX_AGG_NUM 64
- #define RTW89_MAX_TX_AGG_NUM 128
- struct rtw89_ampdu_params {
- u16 agg_num;
- bool amsdu;
- };
- struct rtw89_ra_report {
- struct rate_info txrate;
- u32 bit_rate;
- u16 hw_rate;
- bool might_fallback_legacy;
- };
- DECLARE_EWMA(rssi, 10, 16);
- DECLARE_EWMA(evm, 10, 16);
- DECLARE_EWMA(snr, 10, 16);
- struct rtw89_ba_cam_entry {
- struct list_head list;
- u8 tid;
- };
- #define RTW89_MAX_ADDR_CAM_NUM 128
- #define RTW89_MAX_BSSID_CAM_NUM 20
- #define RTW89_MAX_SEC_CAM_NUM 128
- #define RTW89_MAX_BA_CAM_NUM 8
- #define RTW89_SEC_CAM_IN_ADDR_CAM 7
- struct rtw89_addr_cam_entry {
- u8 addr_cam_idx;
- u8 offset;
- u8 len;
- u8 valid : 1;
- u8 addr_mask : 6;
- u8 wapi : 1;
- u8 mask_sel : 2;
- u8 bssid_cam_idx: 6;
- u8 sec_ent_mode;
- DECLARE_BITMAP(sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM);
- u8 sec_ent_keyid[RTW89_SEC_CAM_IN_ADDR_CAM];
- u8 sec_ent[RTW89_SEC_CAM_IN_ADDR_CAM];
- struct rtw89_sec_cam_entry *sec_entries[RTW89_SEC_CAM_IN_ADDR_CAM];
- };
- struct rtw89_bssid_cam_entry {
- u8 bssid[ETH_ALEN];
- u8 phy_idx;
- u8 bssid_cam_idx;
- u8 offset;
- u8 len;
- u8 valid : 1;
- u8 num;
- };
- struct rtw89_sec_cam_entry {
- u8 sec_cam_idx;
- u8 offset;
- u8 len;
- u8 type : 4;
- u8 ext_key : 1;
- u8 spp_mode : 1;
- /* 256 bits */
- u8 key[32];
- };
- struct rtw89_sta {
- u8 mac_id;
- bool disassoc;
- bool er_cap;
- struct rtw89_dev *rtwdev;
- struct rtw89_vif *rtwvif;
- struct rtw89_ra_info ra;
- struct rtw89_ra_report ra_report;
- int max_agg_wait;
- u8 prev_rssi;
- struct ewma_rssi avg_rssi;
- struct ewma_rssi rssi[RF_PATH_MAX];
- struct ewma_snr avg_snr;
- struct ewma_evm evm_min[RF_PATH_MAX];
- struct ewma_evm evm_max[RF_PATH_MAX];
- struct rtw89_ampdu_params ampdu_params[IEEE80211_NUM_TIDS];
- struct ieee80211_rx_status rx_status;
- u16 rx_hw_rate;
- __le32 htc_template;
- struct rtw89_addr_cam_entry addr_cam; /* AP mode or TDLS peer only */
- struct rtw89_bssid_cam_entry bssid_cam; /* TDLS peer only */
- struct list_head ba_cam_list;
- struct sk_buff_head roc_queue;
- bool use_cfg_mask;
- struct cfg80211_bitrate_mask mask;
- bool cctl_tx_time;
- u32 ampdu_max_time:4;
- bool cctl_tx_retry_limit;
- u32 data_tx_cnt_lmt:6;
- };
- struct rtw89_efuse {
- bool valid;
- bool power_k_valid;
- u8 xtal_cap;
- u8 addr[ETH_ALEN];
- u8 rfe_type;
- char country_code[2];
- };
- struct rtw89_phy_rate_pattern {
- u64 ra_mask;
- u16 rate;
- u8 ra_mode;
- bool enable;
- };
- struct rtw89_tx_wait_info {
- struct rcu_head rcu_head;
- struct completion completion;
- bool tx_done;
- };
- struct rtw89_tx_skb_data {
- struct rtw89_tx_wait_info __rcu *wait;
- u8 hci_priv[];
- };
- #define RTW89_ROC_IDLE_TIMEOUT 500
- #define RTW89_ROC_TX_TIMEOUT 30
- enum rtw89_roc_state {
- RTW89_ROC_IDLE,
- RTW89_ROC_NORMAL,
- RTW89_ROC_MGMT,
- };
- struct rtw89_roc {
- struct ieee80211_channel chan;
- struct delayed_work roc_work;
- enum ieee80211_roc_type type;
- enum rtw89_roc_state state;
- int duration;
- };
- #define RTW89_P2P_MAX_NOA_NUM 2
- struct rtw89_p2p_ie_head {
- u8 eid;
- u8 ie_len;
- u8 oui[3];
- u8 oui_type;
- } __packed;
- struct rtw89_noa_attr_head {
- u8 attr_type;
- __le16 attr_len;
- u8 index;
- u8 oppps_ctwindow;
- } __packed;
- struct rtw89_p2p_noa_ie {
- struct rtw89_p2p_ie_head p2p_head;
- struct rtw89_noa_attr_head noa_head;
- struct ieee80211_p2p_noa_desc noa_desc[RTW89_P2P_MAX_NOA_NUM];
- } __packed;
- struct rtw89_p2p_noa_setter {
- struct rtw89_p2p_noa_ie ie;
- u8 noa_count;
- u8 noa_index;
- };
- struct rtw89_vif {
- struct list_head list;
- struct rtw89_dev *rtwdev;
- struct rtw89_roc roc;
- bool chanctx_assigned; /* only valid when running with chanctx_ops */
- enum rtw89_sub_entity_idx sub_entity_idx;
- enum rtw89_reg_6ghz_power reg_6ghz_power;
- u8 mac_id;
- u8 port;
- u8 mac_addr[ETH_ALEN];
- u8 bssid[ETH_ALEN];
- u8 phy_idx;
- u8 mac_idx;
- u8 net_type;
- u8 wifi_role;
- u8 self_role;
- u8 wmm;
- u8 bcn_hit_cond;
- u8 hit_rule;
- u8 last_noa_nr;
- bool offchan;
- bool trigger;
- bool lsig_txop;
- u8 tgt_ind;
- u8 frm_tgt_ind;
- bool wowlan_pattern;
- bool wowlan_uc;
- bool wowlan_magic;
- bool is_hesta;
- bool last_a_ctrl;
- bool dyn_tb_bedge_en;
- bool pre_pwr_diff_en;
- bool pwr_diff_en;
- u8 def_tri_idx;
- u32 tdls_peer;
- struct work_struct update_beacon_work;
- struct rtw89_addr_cam_entry addr_cam;
- struct rtw89_bssid_cam_entry bssid_cam;
- struct ieee80211_tx_queue_params tx_params[IEEE80211_NUM_ACS];
- struct rtw89_traffic_stats stats;
- struct rtw89_phy_rate_pattern rate_pattern;
- struct cfg80211_scan_request *scan_req;
- struct ieee80211_scan_ies *scan_ies;
- struct list_head general_pkt_list;
- struct rtw89_p2p_noa_setter p2p_noa;
- };
- enum rtw89_lv1_rcvy_step {
- RTW89_LV1_RCVY_STEP_1,
- RTW89_LV1_RCVY_STEP_2,
- };
- struct rtw89_hci_ops {
- int (*tx_write)(struct rtw89_dev *rtwdev, struct rtw89_core_tx_request *tx_req);
- void (*tx_kick_off)(struct rtw89_dev *rtwdev, u8 txch);
- void (*flush_queues)(struct rtw89_dev *rtwdev, u32 queues, bool drop);
- void (*reset)(struct rtw89_dev *rtwdev);
- int (*start)(struct rtw89_dev *rtwdev);
- void (*stop)(struct rtw89_dev *rtwdev);
- void (*pause)(struct rtw89_dev *rtwdev, bool pause);
- void (*switch_mode)(struct rtw89_dev *rtwdev, bool low_power);
- void (*recalc_int_mit)(struct rtw89_dev *rtwdev);
- u8 (*read8)(struct rtw89_dev *rtwdev, u32 addr);
- u16 (*read16)(struct rtw89_dev *rtwdev, u32 addr);
- u32 (*read32)(struct rtw89_dev *rtwdev, u32 addr);
- void (*write8)(struct rtw89_dev *rtwdev, u32 addr, u8 data);
- void (*write16)(struct rtw89_dev *rtwdev, u32 addr, u16 data);
- void (*write32)(struct rtw89_dev *rtwdev, u32 addr, u32 data);
- int (*mac_pre_init)(struct rtw89_dev *rtwdev);
- int (*mac_post_init)(struct rtw89_dev *rtwdev);
- int (*deinit)(struct rtw89_dev *rtwdev);
- u32 (*check_and_reclaim_tx_resource)(struct rtw89_dev *rtwdev, u8 txch);
- int (*mac_lv1_rcvy)(struct rtw89_dev *rtwdev, enum rtw89_lv1_rcvy_step step);
- void (*dump_err_status)(struct rtw89_dev *rtwdev);
- int (*napi_poll)(struct napi_struct *napi, int budget);
- /* Deal with locks inside recovery_start and recovery_complete callbacks
- * by hci instance, and handle things which need to consider under SER.
- * e.g. turn on/off interrupts except for the one for halt notification.
- */
- void (*recovery_start)(struct rtw89_dev *rtwdev);
- void (*recovery_complete)(struct rtw89_dev *rtwdev);
- void (*ctrl_txdma_ch)(struct rtw89_dev *rtwdev, bool enable);
- void (*ctrl_txdma_fw_ch)(struct rtw89_dev *rtwdev, bool enable);
- void (*ctrl_trxhci)(struct rtw89_dev *rtwdev, bool enable);
- int (*poll_txdma_ch)(struct rtw89_dev *rtwdev);
- void (*clr_idx_all)(struct rtw89_dev *rtwdev);
- void (*clear)(struct rtw89_dev *rtwdev, struct pci_dev *pdev);
- void (*disable_intr)(struct rtw89_dev *rtwdev);
- void (*enable_intr)(struct rtw89_dev *rtwdev);
- int (*rst_bdram)(struct rtw89_dev *rtwdev);
- };
- struct rtw89_hci_info {
- const struct rtw89_hci_ops *ops;
- enum rtw89_hci_type type;
- u32 rpwm_addr;
- u32 cpwm_addr;
- bool paused;
- };
- struct rtw89_chip_ops {
- int (*enable_bb_rf)(struct rtw89_dev *rtwdev);
- int (*disable_bb_rf)(struct rtw89_dev *rtwdev);
- void (*bb_preinit)(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
- void (*bb_reset)(struct rtw89_dev *rtwdev,
- enum rtw89_phy_idx phy_idx);
- void (*bb_sethw)(struct rtw89_dev *rtwdev);
- u32 (*read_rf)(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
- u32 addr, u32 mask);
- bool (*write_rf)(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
- u32 addr, u32 mask, u32 data);
- void (*set_channel)(struct rtw89_dev *rtwdev,
- const struct rtw89_chan *chan,
- enum rtw89_mac_idx mac_idx,
- enum rtw89_phy_idx phy_idx);
- void (*set_channel_help)(struct rtw89_dev *rtwdev, bool enter,
- struct rtw89_channel_help_params *p,
- const struct rtw89_chan *chan,
- enum rtw89_mac_idx mac_idx,
- enum rtw89_phy_idx phy_idx);
- int (*read_efuse)(struct rtw89_dev *rtwdev, u8 *log_map);
- int (*read_phycap)(struct rtw89_dev *rtwdev, u8 *phycap_map);
- void (*fem_setup)(struct rtw89_dev *rtwdev);
- void (*rfe_gpio)(struct rtw89_dev *rtwdev);
- void (*rfk_init)(struct rtw89_dev *rtwdev);
- void (*rfk_channel)(struct rtw89_dev *rtwdev);
- void (*rfk_band_changed)(struct rtw89_dev *rtwdev,
- enum rtw89_phy_idx phy_idx);
- void (*rfk_scan)(struct rtw89_dev *rtwdev, bool start);
- void (*rfk_track)(struct rtw89_dev *rtwdev);
- void (*power_trim)(struct rtw89_dev *rtwdev);
- void (*set_txpwr)(struct rtw89_dev *rtwdev,
- const struct rtw89_chan *chan,
- enum rtw89_phy_idx phy_idx);
- void (*set_txpwr_ctrl)(struct rtw89_dev *rtwdev,
- enum rtw89_phy_idx phy_idx);
- int (*init_txpwr_unit)(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
- u8 (*get_thermal)(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path);
- void (*ctrl_btg)(struct rtw89_dev *rtwdev, bool btg);
- void (*query_ppdu)(struct rtw89_dev *rtwdev,
- struct rtw89_rx_phy_ppdu *phy_ppdu,
- struct ieee80211_rx_status *status);
- void (*bb_ctrl_btc_preagc)(struct rtw89_dev *rtwdev, bool bt_en);
- void (*cfg_txrx_path)(struct rtw89_dev *rtwdev);
- void (*set_txpwr_ul_tb_offset)(struct rtw89_dev *rtwdev,
- s8 pw_ofst, enum rtw89_mac_idx mac_idx);
- int (*pwr_on_func)(struct rtw89_dev *rtwdev);
- int (*pwr_off_func)(struct rtw89_dev *rtwdev);
- void (*query_rxdesc)(struct rtw89_dev *rtwdev,
- struct rtw89_rx_desc_info *desc_info,
- u8 *data, u32 data_offset);
- void (*fill_txdesc)(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- void (*fill_txdesc_fwcmd)(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- int (*cfg_ctrl_path)(struct rtw89_dev *rtwdev, bool wl);
- int (*mac_cfg_gnt)(struct rtw89_dev *rtwdev,
- const struct rtw89_mac_ax_coex_gnt *gnt_cfg);
- int (*stop_sch_tx)(struct rtw89_dev *rtwdev, u8 mac_idx,
- u32 *tx_en, enum rtw89_sch_tx_sel sel);
- int (*resume_sch_tx)(struct rtw89_dev *rtwdev, u8 mac_idx, u32 tx_en);
- int (*h2c_dctl_sec_cam)(struct rtw89_dev *rtwdev,
- struct rtw89_vif *rtwvif,
- struct rtw89_sta *rtwsta);
- void (*btc_set_rfe)(struct rtw89_dev *rtwdev);
- void (*btc_init_cfg)(struct rtw89_dev *rtwdev);
- void (*btc_set_wl_pri)(struct rtw89_dev *rtwdev, u8 map, bool state);
- void (*btc_set_wl_txpwr_ctrl)(struct rtw89_dev *rtwdev, u32 txpwr_val);
- s8 (*btc_get_bt_rssi)(struct rtw89_dev *rtwdev, s8 val);
- void (*btc_update_bt_cnt)(struct rtw89_dev *rtwdev);
- void (*btc_wl_s1_standby)(struct rtw89_dev *rtwdev, bool state);
- void (*btc_set_policy)(struct rtw89_dev *rtwdev, u16 policy_type);
- void (*btc_set_wl_rx_gain)(struct rtw89_dev *rtwdev, u32 level);
- };
- enum rtw89_dma_ch {
- RTW89_DMA_ACH0 = 0,
- RTW89_DMA_ACH1 = 1,
- RTW89_DMA_ACH2 = 2,
- RTW89_DMA_ACH3 = 3,
- RTW89_DMA_ACH4 = 4,
- RTW89_DMA_ACH5 = 5,
- RTW89_DMA_ACH6 = 6,
- RTW89_DMA_ACH7 = 7,
- RTW89_DMA_B0MG = 8,
- RTW89_DMA_B0HI = 9,
- RTW89_DMA_B1MG = 10,
- RTW89_DMA_B1HI = 11,
- RTW89_DMA_H2C = 12,
- RTW89_DMA_CH_NUM = 13
- };
- enum rtw89_qta_mode {
- RTW89_QTA_SCC,
- RTW89_QTA_DLFW,
- RTW89_QTA_WOW,
- /* keep last */
- RTW89_QTA_INVALID,
- };
- struct rtw89_hfc_ch_cfg {
- u16 min;
- u16 max;
- #define grp_0 0
- #define grp_1 1
- #define grp_num 2
- u8 grp;
- };
- struct rtw89_hfc_ch_info {
- u16 aval;
- u16 used;
- };
- struct rtw89_hfc_pub_cfg {
- u16 grp0;
- u16 grp1;
- u16 pub_max;
- u16 wp_thrd;
- };
- struct rtw89_hfc_pub_info {
- u16 g0_used;
- u16 g1_used;
- u16 g0_aval;
- u16 g1_aval;
- u16 pub_aval;
- u16 wp_aval;
- };
- struct rtw89_hfc_prec_cfg {
- u16 ch011_prec;
- u16 h2c_prec;
- u16 wp_ch07_prec;
- u16 wp_ch811_prec;
- u8 ch011_full_cond;
- u8 h2c_full_cond;
- u8 wp_ch07_full_cond;
- u8 wp_ch811_full_cond;
- };
- struct rtw89_hfc_param {
- bool en;
- bool h2c_en;
- u8 mode;
- const struct rtw89_hfc_ch_cfg *ch_cfg;
- struct rtw89_hfc_ch_info ch_info[RTW89_DMA_CH_NUM];
- struct rtw89_hfc_pub_cfg pub_cfg;
- struct rtw89_hfc_pub_info pub_info;
- struct rtw89_hfc_prec_cfg prec_cfg;
- };
- struct rtw89_hfc_param_ini {
- const struct rtw89_hfc_ch_cfg *ch_cfg;
- const struct rtw89_hfc_pub_cfg *pub_cfg;
- const struct rtw89_hfc_prec_cfg *prec_cfg;
- u8 mode;
- };
- struct rtw89_dle_size {
- u16 pge_size;
- u16 lnk_pge_num;
- u16 unlnk_pge_num;
- };
- struct rtw89_wde_quota {
- u16 hif;
- u16 wcpu;
- u16 pkt_in;
- u16 cpu_io;
- };
- struct rtw89_ple_quota {
- u16 cma0_tx;
- u16 cma1_tx;
- u16 c2h;
- u16 h2c;
- u16 wcpu;
- u16 mpdu_proc;
- u16 cma0_dma;
- u16 cma1_dma;
- u16 bb_rpt;
- u16 wd_rel;
- u16 cpu_io;
- u16 tx_rpt;
- };
- struct rtw89_dle_mem {
- enum rtw89_qta_mode mode;
- const struct rtw89_dle_size *wde_size;
- const struct rtw89_dle_size *ple_size;
- const struct rtw89_wde_quota *wde_min_qt;
- const struct rtw89_wde_quota *wde_max_qt;
- const struct rtw89_ple_quota *ple_min_qt;
- const struct rtw89_ple_quota *ple_max_qt;
- };
- struct rtw89_reg_def {
- u32 addr;
- u32 mask;
- };
- struct rtw89_reg2_def {
- u32 addr;
- u32 data;
- };
- struct rtw89_reg3_def {
- u32 addr;
- u32 mask;
- u32 data;
- };
- struct rtw89_reg5_def {
- u8 flag; /* recognized by parsers */
- u8 path;
- u32 addr;
- u32 mask;
- u32 data;
- };
- struct rtw89_phy_table {
- const struct rtw89_reg2_def *regs;
- u32 n_regs;
- enum rtw89_rf_path rf_path;
- void (*config)(struct rtw89_dev *rtwdev, const struct rtw89_reg2_def *reg,
- enum rtw89_rf_path rf_path, void *data);
- };
- struct rtw89_txpwr_table {
- const void *data;
- u32 size;
- void (*load)(struct rtw89_dev *rtwdev,
- const struct rtw89_txpwr_table *tbl);
- };
- struct rtw89_txpwr_rule_2ghz {
- const s8 (*lmt)[RTW89_2G_BW_NUM][RTW89_NTX_NUM]
- [RTW89_RS_LMT_NUM][RTW89_BF_NUM]
- [RTW89_REGD_NUM][RTW89_2G_CH_NUM];
- const s8 (*lmt_ru)[RTW89_RU_NUM][RTW89_NTX_NUM]
- [RTW89_REGD_NUM][RTW89_2G_CH_NUM];
- };
- struct rtw89_txpwr_rule_5ghz {
- const s8 (*lmt)[RTW89_5G_BW_NUM][RTW89_NTX_NUM]
- [RTW89_RS_LMT_NUM][RTW89_BF_NUM]
- [RTW89_REGD_NUM][RTW89_5G_CH_NUM];
- const s8 (*lmt_ru)[RTW89_RU_NUM][RTW89_NTX_NUM]
- [RTW89_REGD_NUM][RTW89_5G_CH_NUM];
- };
- struct rtw89_txpwr_rule_6ghz {
- const s8 (*lmt)[RTW89_6G_BW_NUM][RTW89_NTX_NUM]
- [RTW89_RS_LMT_NUM][RTW89_BF_NUM]
- [RTW89_REGD_NUM][NUM_OF_RTW89_REG_6GHZ_POWER]
- [RTW89_6G_CH_NUM];
- const s8 (*lmt_ru)[RTW89_RU_NUM][RTW89_NTX_NUM]
- [RTW89_REGD_NUM][NUM_OF_RTW89_REG_6GHZ_POWER]
- [RTW89_6G_CH_NUM];
- };
- struct rtw89_tx_shape {
- const u8 (*lmt)[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM];
- const u8 (*lmt_ru)[RTW89_BAND_NUM][RTW89_REGD_NUM];
- };
- struct rtw89_rfe_parms {
- const struct rtw89_txpwr_table *byr_tbl;
- struct rtw89_txpwr_rule_2ghz rule_2ghz;
- struct rtw89_txpwr_rule_5ghz rule_5ghz;
- struct rtw89_txpwr_rule_6ghz rule_6ghz;
- struct rtw89_tx_shape tx_shape;
- };
- struct rtw89_rfe_parms_conf {
- const struct rtw89_rfe_parms *rfe_parms;
- u8 rfe_type;
- };
- #define RTW89_TXPWR_CONF_DFLT_RFE_TYPE 0x0
- struct rtw89_txpwr_conf {
- u8 rfe_type;
- u8 ent_sz;
- u32 num_ents;
- const void *data;
- };
- #define rtw89_txpwr_conf_valid(conf) (!!(conf)->data)
- #define rtw89_for_each_in_txpwr_conf(entry, cursor, conf) \
- for (typecheck(const void *, cursor), (cursor) = (conf)->data, \
- memcpy(&(entry), cursor, \
- min_t(u8, sizeof(entry), (conf)->ent_sz)); \
- (cursor) < (conf)->data + (conf)->num_ents * (conf)->ent_sz; \
- (cursor) += (conf)->ent_sz, \
- memcpy(&(entry), cursor, \
- min_t(u8, sizeof(entry), (conf)->ent_sz)))
- struct rtw89_txpwr_byrate_data {
- struct rtw89_txpwr_conf conf;
- struct rtw89_txpwr_table tbl;
- };
- struct rtw89_txpwr_lmt_2ghz_data {
- struct rtw89_txpwr_conf conf;
- s8 v[RTW89_2G_BW_NUM][RTW89_NTX_NUM]
- [RTW89_RS_LMT_NUM][RTW89_BF_NUM]
- [RTW89_REGD_NUM][RTW89_2G_CH_NUM];
- };
- struct rtw89_txpwr_lmt_5ghz_data {
- struct rtw89_txpwr_conf conf;
- s8 v[RTW89_5G_BW_NUM][RTW89_NTX_NUM]
- [RTW89_RS_LMT_NUM][RTW89_BF_NUM]
- [RTW89_REGD_NUM][RTW89_5G_CH_NUM];
- };
- struct rtw89_txpwr_lmt_6ghz_data {
- struct rtw89_txpwr_conf conf;
- s8 v[RTW89_6G_BW_NUM][RTW89_NTX_NUM]
- [RTW89_RS_LMT_NUM][RTW89_BF_NUM]
- [RTW89_REGD_NUM][NUM_OF_RTW89_REG_6GHZ_POWER]
- [RTW89_6G_CH_NUM];
- };
- struct rtw89_txpwr_lmt_ru_2ghz_data {
- struct rtw89_txpwr_conf conf;
- s8 v[RTW89_RU_NUM][RTW89_NTX_NUM]
- [RTW89_REGD_NUM][RTW89_2G_CH_NUM];
- };
- struct rtw89_txpwr_lmt_ru_5ghz_data {
- struct rtw89_txpwr_conf conf;
- s8 v[RTW89_RU_NUM][RTW89_NTX_NUM]
- [RTW89_REGD_NUM][RTW89_5G_CH_NUM];
- };
- struct rtw89_txpwr_lmt_ru_6ghz_data {
- struct rtw89_txpwr_conf conf;
- s8 v[RTW89_RU_NUM][RTW89_NTX_NUM]
- [RTW89_REGD_NUM][NUM_OF_RTW89_REG_6GHZ_POWER]
- [RTW89_6G_CH_NUM];
- };
- struct rtw89_tx_shape_lmt_data {
- struct rtw89_txpwr_conf conf;
- u8 v[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM];
- };
- struct rtw89_tx_shape_lmt_ru_data {
- struct rtw89_txpwr_conf conf;
- u8 v[RTW89_BAND_NUM][RTW89_REGD_NUM];
- };
- struct rtw89_rfe_data {
- struct rtw89_txpwr_byrate_data byrate;
- struct rtw89_txpwr_lmt_2ghz_data lmt_2ghz;
- struct rtw89_txpwr_lmt_5ghz_data lmt_5ghz;
- struct rtw89_txpwr_lmt_6ghz_data lmt_6ghz;
- struct rtw89_txpwr_lmt_ru_2ghz_data lmt_ru_2ghz;
- struct rtw89_txpwr_lmt_ru_5ghz_data lmt_ru_5ghz;
- struct rtw89_txpwr_lmt_ru_6ghz_data lmt_ru_6ghz;
- struct rtw89_tx_shape_lmt_data tx_shape_lmt;
- struct rtw89_tx_shape_lmt_ru_data tx_shape_lmt_ru;
- struct rtw89_rfe_parms rfe_parms;
- };
- struct rtw89_page_regs {
- u32 hci_fc_ctrl;
- u32 ch_page_ctrl;
- u32 ach_page_ctrl;
- u32 ach_page_info;
- u32 pub_page_info3;
- u32 pub_page_ctrl1;
- u32 pub_page_ctrl2;
- u32 pub_page_info1;
- u32 pub_page_info2;
- u32 wp_page_ctrl1;
- u32 wp_page_ctrl2;
- u32 wp_page_info1;
- };
- struct rtw89_imr_info {
- u32 wdrls_imr_set;
- u32 wsec_imr_reg;
- u32 wsec_imr_set;
- u32 mpdu_tx_imr_set;
- u32 mpdu_rx_imr_set;
- u32 sta_sch_imr_set;
- u32 txpktctl_imr_b0_reg;
- u32 txpktctl_imr_b0_clr;
- u32 txpktctl_imr_b0_set;
- u32 txpktctl_imr_b1_reg;
- u32 txpktctl_imr_b1_clr;
- u32 txpktctl_imr_b1_set;
- u32 wde_imr_clr;
- u32 wde_imr_set;
- u32 ple_imr_clr;
- u32 ple_imr_set;
- u32 host_disp_imr_clr;
- u32 host_disp_imr_set;
- u32 cpu_disp_imr_clr;
- u32 cpu_disp_imr_set;
- u32 other_disp_imr_clr;
- u32 other_disp_imr_set;
- u32 bbrpt_com_err_imr_reg;
- u32 bbrpt_chinfo_err_imr_reg;
- u32 bbrpt_err_imr_set;
- u32 bbrpt_dfs_err_imr_reg;
- u32 ptcl_imr_clr;
- u32 ptcl_imr_set;
- u32 cdma_imr_0_reg;
- u32 cdma_imr_0_clr;
- u32 cdma_imr_0_set;
- u32 cdma_imr_1_reg;
- u32 cdma_imr_1_clr;
- u32 cdma_imr_1_set;
- u32 phy_intf_imr_reg;
- u32 phy_intf_imr_clr;
- u32 phy_intf_imr_set;
- u32 rmac_imr_reg;
- u32 rmac_imr_clr;
- u32 rmac_imr_set;
- u32 tmac_imr_reg;
- u32 tmac_imr_clr;
- u32 tmac_imr_set;
- };
- struct rtw89_xtal_info {
- u32 xcap_reg;
- u32 sc_xo_mask;
- u32 sc_xi_mask;
- };
- struct rtw89_rrsr_cfgs {
- struct rtw89_reg3_def ref_rate;
- struct rtw89_reg3_def rsc;
- };
- struct rtw89_dig_regs {
- u32 seg0_pd_reg;
- u32 pd_lower_bound_mask;
- u32 pd_spatial_reuse_en;
- u32 bmode_pd_reg;
- u32 bmode_cca_rssi_limit_en;
- u32 bmode_pd_lower_bound_reg;
- u32 bmode_rssi_nocca_low_th_mask;
- struct rtw89_reg_def p0_lna_init;
- struct rtw89_reg_def p1_lna_init;
- struct rtw89_reg_def p0_tia_init;
- struct rtw89_reg_def p1_tia_init;
- struct rtw89_reg_def p0_rxb_init;
- struct rtw89_reg_def p1_rxb_init;
- struct rtw89_reg_def p0_p20_pagcugc_en;
- struct rtw89_reg_def p0_s20_pagcugc_en;
- struct rtw89_reg_def p1_p20_pagcugc_en;
- struct rtw89_reg_def p1_s20_pagcugc_en;
- };
- struct rtw89_phy_ul_tb_info {
- bool dyn_tb_tri_en;
- u8 def_if_bandedge;
- };
- struct rtw89_antdiv_stats {
- struct ewma_rssi cck_rssi_avg;
- struct ewma_rssi ofdm_rssi_avg;
- struct ewma_rssi non_legacy_rssi_avg;
- u16 pkt_cnt_cck;
- u16 pkt_cnt_ofdm;
- u16 pkt_cnt_non_legacy;
- u32 evm;
- };
- struct rtw89_antdiv_info {
- struct rtw89_antdiv_stats target_stats;
- struct rtw89_antdiv_stats main_stats;
- struct rtw89_antdiv_stats aux_stats;
- u8 training_count;
- u8 rssi_pre;
- bool get_stats;
- };
- enum rtw89_chanctx_state {
- RTW89_CHANCTX_STATE_MCC_START,
- RTW89_CHANCTX_STATE_MCC_STOP,
- };
- enum rtw89_chanctx_callbacks {
- RTW89_CHANCTX_CALLBACK_PLACEHOLDER,
- RTW89_CHANCTX_CALLBACK_RFK,
- NUM_OF_RTW89_CHANCTX_CALLBACKS,
- };
- struct rtw89_chanctx_listener {
- void (*callbacks[NUM_OF_RTW89_CHANCTX_CALLBACKS])
- (struct rtw89_dev *rtwdev, enum rtw89_chanctx_state state);
- };
- struct rtw89_chip_info {
- enum rtw89_core_chip_id chip_id;
- enum rtw89_chip_gen chip_gen;
- const struct rtw89_chip_ops *ops;
- const struct rtw89_mac_gen_def *mac_def;
- const struct rtw89_phy_gen_def *phy_def;
- const char *fw_basename;
- u8 fw_format_max;
- bool try_ce_fw;
- u8 bbmcu_nr;
- u32 needed_fw_elms;
- u32 fifo_size;
- bool small_fifo_size;
- u32 dle_scc_rsvd_size;
- u16 max_amsdu_limit;
- bool dis_2g_40m_ul_ofdma;
- u32 rsvd_ple_ofst;
- const struct rtw89_hfc_param_ini *hfc_param_ini;
- const struct rtw89_dle_mem *dle_mem;
- u8 wde_qempty_acq_num;
- u8 wde_qempty_mgq_sel;
- u32 rf_base_addr[2];
- u8 support_chanctx_num;
- u8 support_bands;
- bool support_bw160;
- bool support_unii4;
- bool ul_tb_waveform_ctrl;
- bool ul_tb_pwr_diff;
- bool hw_sec_hdr;
- u8 rf_path_num;
- u8 tx_nss;
- u8 rx_nss;
- u8 acam_num;
- u8 bcam_num;
- u8 scam_num;
- u8 bacam_num;
- u8 bacam_dynamic_num;
- enum rtw89_bacam_ver bacam_ver;
- u8 sec_ctrl_efuse_size;
- u32 physical_efuse_size;
- u32 logical_efuse_size;
- u32 limit_efuse_size;
- u32 dav_phy_efuse_size;
- u32 dav_log_efuse_size;
- u32 phycap_addr;
- u32 phycap_size;
- const struct rtw89_pwr_cfg * const *pwr_on_seq;
- const struct rtw89_pwr_cfg * const *pwr_off_seq;
- const struct rtw89_phy_table *bb_table;
- const struct rtw89_phy_table *bb_gain_table;
- const struct rtw89_phy_table *rf_table[RF_PATH_MAX];
- const struct rtw89_phy_table *nctl_table;
- const struct rtw89_rfk_tbl *nctl_post_table;
- const struct rtw89_phy_dig_gain_table *dig_table;
- const struct rtw89_dig_regs *dig_regs;
- const struct rtw89_phy_tssi_dbw_table *tssi_dbw_table;
- /* NULL if no rfe-specific, or a null-terminated array by rfe_parms */
- const struct rtw89_rfe_parms_conf *rfe_parms_conf;
- const struct rtw89_rfe_parms *dflt_parms;
- const struct rtw89_chanctx_listener *chanctx_listener;
- u8 txpwr_factor_rf;
- u8 txpwr_factor_mac;
- u32 para_ver;
- u32 wlcx_desired;
- u8 btcx_desired;
- u8 scbd;
- u8 mailbox;
- u8 afh_guard_ch;
- const u8 *wl_rssi_thres;
- const u8 *bt_rssi_thres;
- u8 rssi_tol;
- u8 mon_reg_num;
- const struct rtw89_btc_fbtc_mreg *mon_reg;
- u8 rf_para_ulink_num;
- const struct rtw89_btc_rf_trx_para *rf_para_ulink;
- u8 rf_para_dlink_num;
- const struct rtw89_btc_rf_trx_para *rf_para_dlink;
- u8 ps_mode_supported;
- u8 low_power_hci_modes;
- u32 h2c_cctl_func_id;
- u32 hci_func_en_addr;
- u32 h2c_desc_size;
- u32 txwd_body_size;
- u32 txwd_info_size;
- u32 h2c_ctrl_reg;
- const u32 *h2c_regs;
- struct rtw89_reg_def h2c_counter_reg;
- u32 c2h_ctrl_reg;
- const u32 *c2h_regs;
- struct rtw89_reg_def c2h_counter_reg;
- const struct rtw89_page_regs *page_regs;
- bool cfo_src_fd;
- bool cfo_hw_comp;
- const struct rtw89_reg_def *dcfo_comp;
- u8 dcfo_comp_sft;
- const struct rtw89_imr_info *imr_info;
- const struct rtw89_rrsr_cfgs *rrsr_cfgs;
- u32 bss_clr_map_reg;
- u32 dma_ch_mask;
- u32 edcca_lvl_reg;
- const struct wiphy_wowlan_support *wowlan_stub;
- const struct rtw89_xtal_info *xtal_info;
- };
- union rtw89_bus_info {
- const struct rtw89_pci_info *pci;
- };
- struct rtw89_driver_info {
- const struct rtw89_chip_info *chip;
- union rtw89_bus_info bus;
- };
- enum rtw89_hcifc_mode {
- RTW89_HCIFC_POH = 0,
- RTW89_HCIFC_STF = 1,
- RTW89_HCIFC_SDIO = 2,
- /* keep last */
- RTW89_HCIFC_MODE_INVALID,
- };
- struct rtw89_dle_info {
- enum rtw89_qta_mode qta_mode;
- u16 ple_pg_size;
- u16 c0_rx_qta;
- u16 c1_rx_qta;
- };
- enum rtw89_host_rpr_mode {
- RTW89_RPR_MODE_POH = 0,
- RTW89_RPR_MODE_STF
- };
- #define RTW89_COMPLETION_BUF_SIZE 24
- #define RTW89_WAIT_COND_IDLE UINT_MAX
- struct rtw89_completion_data {
- bool err;
- u8 buf[RTW89_COMPLETION_BUF_SIZE];
- };
- struct rtw89_wait_info {
- atomic_t cond;
- struct completion completion;
- struct rtw89_completion_data data;
- };
- #define RTW89_WAIT_FOR_COND_TIMEOUT msecs_to_jiffies(100)
- static inline void rtw89_init_wait(struct rtw89_wait_info *wait)
- {
- init_completion(&wait->completion);
- atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
- }
- struct rtw89_mac_info {
- struct rtw89_dle_info dle_info;
- struct rtw89_hfc_param hfc_param;
- enum rtw89_qta_mode qta_mode;
- u8 rpwm_seq_num;
- u8 cpwm_seq_num;
- /* see RTW89_FW_OFLD_WAIT_COND series for wait condition */
- struct rtw89_wait_info fw_ofld_wait;
- };
- enum rtw89_fwdl_check_type {
- RTW89_FWDL_CHECK_FREERTOS_DONE,
- RTW89_FWDL_CHECK_WCPU_FWDL_DONE,
- RTW89_FWDL_CHECK_DCPU_FWDL_DONE,
- RTW89_FWDL_CHECK_BB0_FWDL_DONE,
- RTW89_FWDL_CHECK_BB1_FWDL_DONE,
- };
- enum rtw89_fw_type {
- RTW89_FW_NORMAL = 1,
- RTW89_FW_WOWLAN = 3,
- RTW89_FW_NORMAL_CE = 5,
- RTW89_FW_BBMCU0 = 64,
- RTW89_FW_BBMCU1 = 65,
- RTW89_FW_LOGFMT = 255,
- };
- enum rtw89_fw_feature {
- RTW89_FW_FEATURE_OLD_HT_RA_FORMAT,
- RTW89_FW_FEATURE_SCAN_OFFLOAD,
- RTW89_FW_FEATURE_TX_WAKE,
- RTW89_FW_FEATURE_CRASH_TRIGGER,
- RTW89_FW_FEATURE_NO_PACKET_DROP,
- RTW89_FW_FEATURE_NO_DEEP_PS,
- RTW89_FW_FEATURE_NO_LPS_PG,
- RTW89_FW_FEATURE_BEACON_FILTER,
- };
- struct rtw89_fw_suit {
- enum rtw89_fw_type type;
- const u8 *data;
- u32 size;
- u8 major_ver;
- u8 minor_ver;
- u8 sub_ver;
- u8 sub_idex;
- u16 build_year;
- u16 build_mon;
- u16 build_date;
- u16 build_hour;
- u16 build_min;
- u8 cmd_ver;
- u8 hdr_ver;
- u32 commitid;
- };
- #define RTW89_FW_VER_CODE(major, minor, sub, idx) \
- (((major) << 24) | ((minor) << 16) | ((sub) << 8) | (idx))
- #define RTW89_FW_SUIT_VER_CODE(s) \
- RTW89_FW_VER_CODE((s)->major_ver, (s)->minor_ver, (s)->sub_ver, (s)->sub_idex)
- #define RTW89_MFW_HDR_VER_CODE(mfw_hdr) \
- RTW89_FW_VER_CODE((mfw_hdr)->ver.major, \
- (mfw_hdr)->ver.minor, \
- (mfw_hdr)->ver.sub, \
- (mfw_hdr)->ver.idx)
- #define RTW89_FW_HDR_VER_CODE(fw_hdr) \
- RTW89_FW_VER_CODE(le32_get_bits((fw_hdr)->w1, FW_HDR_W1_MAJOR_VERSION), \
- le32_get_bits((fw_hdr)->w1, FW_HDR_W1_MINOR_VERSION), \
- le32_get_bits((fw_hdr)->w1, FW_HDR_W1_SUBVERSION), \
- le32_get_bits((fw_hdr)->w1, FW_HDR_W1_SUBINDEX))
- struct rtw89_fw_req_info {
- const struct firmware *firmware;
- struct completion completion;
- };
- struct rtw89_fw_log {
- struct rtw89_fw_suit suit;
- bool enable;
- u32 last_fmt_id;
- u32 fmt_count;
- const __le32 *fmt_ids;
- const char *(*fmts)[];
- };
- struct rtw89_fw_elm_info {
- struct rtw89_phy_table *bb_tbl;
- struct rtw89_phy_table *bb_gain;
- struct rtw89_phy_table *rf_radio[RF_PATH_MAX];
- struct rtw89_phy_table *rf_nctl;
- };
- struct rtw89_fw_info {
- struct rtw89_fw_req_info req;
- int fw_format;
- u8 h2c_seq;
- u8 rec_seq;
- u8 h2c_counter;
- u8 c2h_counter;
- struct rtw89_fw_suit normal;
- struct rtw89_fw_suit wowlan;
- struct rtw89_fw_suit bbmcu0;
- struct rtw89_fw_suit bbmcu1;
- struct rtw89_fw_log log;
- u32 feature_map;
- struct rtw89_fw_elm_info elm_info;
- };
- #define RTW89_CHK_FW_FEATURE(_feat, _fw) \
- (!!((_fw)->feature_map & BIT(RTW89_FW_FEATURE_ ## _feat)))
- #define RTW89_SET_FW_FEATURE(_fw_feature, _fw) \
- ((_fw)->feature_map |= BIT(_fw_feature))
- struct rtw89_cam_info {
- DECLARE_BITMAP(addr_cam_map, RTW89_MAX_ADDR_CAM_NUM);
- DECLARE_BITMAP(bssid_cam_map, RTW89_MAX_BSSID_CAM_NUM);
- DECLARE_BITMAP(sec_cam_map, RTW89_MAX_SEC_CAM_NUM);
- DECLARE_BITMAP(ba_cam_map, RTW89_MAX_BA_CAM_NUM);
- struct rtw89_ba_cam_entry ba_cam_entry[RTW89_MAX_BA_CAM_NUM];
- };
- enum rtw89_sar_sources {
- RTW89_SAR_SOURCE_NONE,
- RTW89_SAR_SOURCE_COMMON,
- RTW89_SAR_SOURCE_NR,
- };
- enum rtw89_sar_subband {
- RTW89_SAR_2GHZ_SUBBAND,
- RTW89_SAR_5GHZ_SUBBAND_1_2, /* U-NII-1 and U-NII-2 */
- RTW89_SAR_5GHZ_SUBBAND_2_E, /* U-NII-2-Extended */
- RTW89_SAR_5GHZ_SUBBAND_3, /* U-NII-3 */
- RTW89_SAR_6GHZ_SUBBAND_5_L, /* U-NII-5 lower part */
- RTW89_SAR_6GHZ_SUBBAND_5_H, /* U-NII-5 higher part */
- RTW89_SAR_6GHZ_SUBBAND_6, /* U-NII-6 */
- RTW89_SAR_6GHZ_SUBBAND_7_L, /* U-NII-7 lower part */
- RTW89_SAR_6GHZ_SUBBAND_7_H, /* U-NII-7 higher part */
- RTW89_SAR_6GHZ_SUBBAND_8, /* U-NII-8 */
- RTW89_SAR_SUBBAND_NR,
- };
- struct rtw89_sar_cfg_common {
- bool set[RTW89_SAR_SUBBAND_NR];
- s32 cfg[RTW89_SAR_SUBBAND_NR];
- };
- struct rtw89_sar_info {
- /* used to decide how to acces SAR cfg union */
- enum rtw89_sar_sources src;
- /* reserved for different knids of SAR cfg struct.
- * supposed that a single cfg struct cannot handle various SAR sources.
- */
- union {
- struct rtw89_sar_cfg_common cfg_common;
- };
- };
- enum rtw89_tas_state {
- RTW89_TAS_STATE_DPR_OFF,
- RTW89_TAS_STATE_DPR_ON,
- RTW89_TAS_STATE_DPR_FORBID,
- };
- #define RTW89_TAS_MAX_WINDOW 50
- struct rtw89_tas_info {
- s16 txpwr_history[RTW89_TAS_MAX_WINDOW];
- s32 total_txpwr;
- u8 cur_idx;
- s8 dpr_gap;
- s8 delta;
- enum rtw89_tas_state state;
- bool enable;
- };
- struct rtw89_chanctx_cfg {
- enum rtw89_sub_entity_idx idx;
- };
- enum rtw89_chanctx_changes {
- RTW89_CHANCTX_REMOTE_STA_CHANGE,
- RTW89_CHANCTX_BCN_OFFSET_CHANGE,
- RTW89_CHANCTX_P2P_PS_CHANGE,
- RTW89_CHANCTX_BT_SLOT_CHANGE,
- RTW89_CHANCTX_TSF32_TOGGLE_CHANGE,
- NUM_OF_RTW89_CHANCTX_CHANGES,
- RTW89_CHANCTX_CHANGE_DFLT = NUM_OF_RTW89_CHANCTX_CHANGES,
- };
- enum rtw89_entity_mode {
- RTW89_ENTITY_MODE_SCC,
- RTW89_ENTITY_MODE_MCC_PREPARE,
- RTW89_ENTITY_MODE_MCC,
- NUM_OF_RTW89_ENTITY_MODE,
- RTW89_ENTITY_MODE_INVALID = NUM_OF_RTW89_ENTITY_MODE,
- };
- struct rtw89_sub_entity {
- struct cfg80211_chan_def chandef;
- struct rtw89_chan chan;
- struct rtw89_chan_rcd rcd;
- struct rtw89_chanctx_cfg *cfg;
- };
- struct rtw89_hal {
- u32 rx_fltr;
- u8 cv;
- u8 acv;
- u32 antenna_tx;
- u32 antenna_rx;
- u8 tx_nss;
- u8 rx_nss;
- bool tx_path_diversity;
- bool ant_diversity;
- bool ant_diversity_fixed;
- bool support_cckpd;
- bool support_igi;
- atomic_t roc_entity_idx;
- DECLARE_BITMAP(changes, NUM_OF_RTW89_CHANCTX_CHANGES);
- DECLARE_BITMAP(entity_map, NUM_OF_RTW89_SUB_ENTITY);
- struct rtw89_sub_entity sub[NUM_OF_RTW89_SUB_ENTITY];
- struct cfg80211_chan_def roc_chandef;
- bool entity_active;
- bool entity_pause;
- enum rtw89_entity_mode entity_mode;
- u32 edcca_bak;
- };
- #define RTW89_MAX_MAC_ID_NUM 128
- #define RTW89_MAX_PKT_OFLD_NUM 255
- enum rtw89_flags {
- RTW89_FLAG_POWERON,
- RTW89_FLAG_FW_RDY,
- RTW89_FLAG_RUNNING,
- RTW89_FLAG_BFEE_MON,
- RTW89_FLAG_BFEE_EN,
- RTW89_FLAG_BFEE_TIMER_KEEP,
- RTW89_FLAG_NAPI_RUNNING,
- RTW89_FLAG_LEISURE_PS,
- RTW89_FLAG_LOW_POWER_MODE,
- RTW89_FLAG_INACTIVE_PS,
- RTW89_FLAG_CRASH_SIMULATING,
- RTW89_FLAG_SER_HANDLING,
- RTW89_FLAG_WOWLAN,
- RTW89_FLAG_FORBIDDEN_TRACK_WROK,
- RTW89_FLAG_CHANGING_INTERFACE,
- NUM_OF_RTW89_FLAGS,
- };
- enum rtw89_pkt_drop_sel {
- RTW89_PKT_DROP_SEL_MACID_BE_ONCE,
- RTW89_PKT_DROP_SEL_MACID_BK_ONCE,
- RTW89_PKT_DROP_SEL_MACID_VI_ONCE,
- RTW89_PKT_DROP_SEL_MACID_VO_ONCE,
- RTW89_PKT_DROP_SEL_MACID_ALL,
- RTW89_PKT_DROP_SEL_MG0_ONCE,
- RTW89_PKT_DROP_SEL_HIQ_ONCE,
- RTW89_PKT_DROP_SEL_HIQ_PORT,
- RTW89_PKT_DROP_SEL_HIQ_MBSSID,
- RTW89_PKT_DROP_SEL_BAND,
- RTW89_PKT_DROP_SEL_BAND_ONCE,
- RTW89_PKT_DROP_SEL_REL_MACID,
- RTW89_PKT_DROP_SEL_REL_HIQ_PORT,
- RTW89_PKT_DROP_SEL_REL_HIQ_MBSSID,
- };
- struct rtw89_pkt_drop_params {
- enum rtw89_pkt_drop_sel sel;
- enum rtw89_mac_idx mac_band;
- u8 macid;
- u8 port;
- u8 mbssid;
- bool tf_trs;
- u32 macid_band_sel[4];
- };
- struct rtw89_pkt_stat {
- u16 beacon_nr;
- u32 rx_rate_cnt[RTW89_HW_RATE_NR];
- };
- DECLARE_EWMA(thermal, 4, 4);
- struct rtw89_phy_stat {
- struct ewma_thermal avg_thermal[RF_PATH_MAX];
- struct rtw89_pkt_stat cur_pkt_stat;
- struct rtw89_pkt_stat last_pkt_stat;
- };
- #define RTW89_DACK_PATH_NR 2
- #define RTW89_DACK_IDX_NR 2
- #define RTW89_DACK_MSBK_NR 16
- struct rtw89_dack_info {
- bool dack_done;
- u8 msbk_d[RTW89_DACK_PATH_NR][RTW89_DACK_IDX_NR][RTW89_DACK_MSBK_NR];
- u8 dadck_d[RTW89_DACK_PATH_NR][RTW89_DACK_IDX_NR];
- u16 addck_d[RTW89_DACK_PATH_NR][RTW89_DACK_IDX_NR];
- u16 biask_d[RTW89_DACK_PATH_NR][RTW89_DACK_IDX_NR];
- u32 dack_cnt;
- bool addck_timeout[RTW89_DACK_PATH_NR];
- bool dadck_timeout[RTW89_DACK_PATH_NR];
- bool msbk_timeout[RTW89_DACK_PATH_NR];
- };
- #define RTW89_IQK_CHS_NR 2
- #define RTW89_IQK_PATH_NR 4
- struct rtw89_rfk_mcc_info {
- u8 ch[RTW89_IQK_CHS_NR];
- u8 band[RTW89_IQK_CHS_NR];
- u8 table_idx;
- };
- struct rtw89_lck_info {
- u8 thermal[RF_PATH_MAX];
- };
- struct rtw89_rx_dck_info {
- u8 thermal[RF_PATH_MAX];
- };
- struct rtw89_iqk_info {
- bool lok_cor_fail[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- bool lok_fin_fail[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- bool lok_fail[RTW89_IQK_PATH_NR];
- bool iqk_tx_fail[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- bool iqk_rx_fail[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- u32 iqk_fail_cnt;
- bool is_iqk_init;
- u32 iqk_channel[RTW89_IQK_CHS_NR];
- u8 iqk_band[RTW89_IQK_PATH_NR];
- u8 iqk_ch[RTW89_IQK_PATH_NR];
- u8 iqk_bw[RTW89_IQK_PATH_NR];
- u8 iqk_times;
- u8 version;
- u32 nb_txcfir[RTW89_IQK_PATH_NR];
- u32 nb_rxcfir[RTW89_IQK_PATH_NR];
- u32 bp_txkresult[RTW89_IQK_PATH_NR];
- u32 bp_rxkresult[RTW89_IQK_PATH_NR];
- u32 bp_iqkenable[RTW89_IQK_PATH_NR];
- bool is_wb_txiqk[RTW89_IQK_PATH_NR];
- bool is_wb_rxiqk[RTW89_IQK_PATH_NR];
- bool is_nbiqk;
- bool iqk_fft_en;
- bool iqk_xym_en;
- bool iqk_sram_en;
- bool iqk_cfir_en;
- u32 syn1to2;
- u8 iqk_mcc_ch[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- u8 iqk_table_idx[RTW89_IQK_PATH_NR];
- u32 lok_idac[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- u32 lok_vbuf[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
- };
- #define RTW89_DPK_RF_PATH 2
- #define RTW89_DPK_AVG_THERMAL_NUM 8
- #define RTW89_DPK_BKUP_NUM 2
- struct rtw89_dpk_bkup_para {
- enum rtw89_band band;
- enum rtw89_bandwidth bw;
- u8 ch;
- bool path_ok;
- u8 mdpd_en;
- u8 txagc_dpk;
- u8 ther_dpk;
- u8 gs;
- u16 pwsf;
- };
- struct rtw89_dpk_info {
- bool is_dpk_enable;
- bool is_dpk_reload_en;
- u8 dpk_gs[RTW89_PHY_MAX];
- u16 dc_i[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
- u16 dc_q[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
- u8 corr_val[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
- u8 corr_idx[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
- u8 cur_idx[RTW89_DPK_RF_PATH];
- u8 cur_k_set;
- struct rtw89_dpk_bkup_para bp[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
- };
- struct rtw89_fem_info {
- bool elna_2g;
- bool elna_5g;
- bool epa_2g;
- bool epa_5g;
- bool epa_6g;
- };
- struct rtw89_phy_ch_info {
- u8 rssi_min;
- u16 rssi_min_macid;
- u8 pre_rssi_min;
- u8 rssi_max;
- u16 rssi_max_macid;
- u8 rxsc_160;
- u8 rxsc_80;
- u8 rxsc_40;
- u8 rxsc_20;
- u8 rxsc_l;
- u8 is_noisy;
- };
- struct rtw89_agc_gaincode_set {
- u8 lna_idx;
- u8 tia_idx;
- u8 rxb_idx;
- };
- #define IGI_RSSI_TH_NUM 5
- #define FA_TH_NUM 4
- #define LNA_GAIN_NUM 7
- #define TIA_GAIN_NUM 2
- struct rtw89_dig_info {
- struct rtw89_agc_gaincode_set cur_gaincode;
- bool force_gaincode_idx_en;
- struct rtw89_agc_gaincode_set force_gaincode;
- u8 igi_rssi_th[IGI_RSSI_TH_NUM];
- u16 fa_th[FA_TH_NUM];
- u8 igi_rssi;
- u8 igi_fa_rssi;
- u8 fa_rssi_ofst;
- u8 dyn_igi_max;
- u8 dyn_igi_min;
- bool dyn_pd_th_en;
- u8 dyn_pd_th_max;
- u8 pd_low_th_ofst;
- u8 ib_pbk;
- s8 ib_pkpwr;
- s8 lna_gain_a[LNA_GAIN_NUM];
- s8 lna_gain_g[LNA_GAIN_NUM];
- s8 *lna_gain;
- s8 tia_gain_a[TIA_GAIN_NUM];
- s8 tia_gain_g[TIA_GAIN_NUM];
- s8 *tia_gain;
- bool is_linked_pre;
- bool bypass_dig;
- };
- enum rtw89_multi_cfo_mode {
- RTW89_PKT_BASED_AVG_MODE = 0,
- RTW89_ENTRY_BASED_AVG_MODE = 1,
- RTW89_TP_BASED_AVG_MODE = 2,
- };
- enum rtw89_phy_cfo_status {
- RTW89_PHY_DCFO_STATE_NORMAL = 0,
- RTW89_PHY_DCFO_STATE_ENHANCE = 1,
- RTW89_PHY_DCFO_STATE_HOLD = 2,
- RTW89_PHY_DCFO_STATE_MAX
- };
- enum rtw89_phy_cfo_ul_ofdma_acc_mode {
- RTW89_CFO_UL_OFDMA_ACC_DISABLE = 0,
- RTW89_CFO_UL_OFDMA_ACC_ENABLE = 1
- };
- struct rtw89_cfo_tracking_info {
- u16 cfo_timer_ms;
- bool cfo_trig_by_timer_en;
- enum rtw89_phy_cfo_status phy_cfo_status;
- enum rtw89_phy_cfo_ul_ofdma_acc_mode cfo_ul_ofdma_acc_mode;
- u8 phy_cfo_trk_cnt;
- bool is_adjust;
- enum rtw89_multi_cfo_mode rtw89_multi_cfo_mode;
- bool apply_compensation;
- u8 crystal_cap;
- u8 crystal_cap_default;
- u8 def_x_cap;
- s8 x_cap_ofst;
- u32 sta_cfo_tolerance;
- s32 cfo_tail[CFO_TRACK_MAX_USER];
- u16 cfo_cnt[CFO_TRACK_MAX_USER];
- s32 cfo_avg_pre;
- s32 cfo_avg[CFO_TRACK_MAX_USER];
- s32 pre_cfo_avg[CFO_TRACK_MAX_USER];
- s32 dcfo_avg;
- s32 dcfo_avg_pre;
- u32 packet_count;
- u32 packet_count_pre;
- s32 residual_cfo_acc;
- u8 phy_cfotrk_state;
- u8 phy_cfotrk_cnt;
- bool divergence_lock_en;
- u8 x_cap_lb;
- u8 x_cap_ub;
- u8 lock_cnt;
- };
- enum rtw89_tssi_alimk_band {
- TSSI_ALIMK_2G = 0,
- TSSI_ALIMK_5GL,
- TSSI_ALIMK_5GM,
- TSSI_ALIMK_5GH,
- TSSI_ALIMK_MAX
- };
- /* 2GL, 2GH, 5GL1, 5GH1, 5GM1, 5GM2, 5GH1, 5GH2 */
- #define TSSI_TRIM_CH_GROUP_NUM 8
- #define TSSI_TRIM_CH_GROUP_NUM_6G 16
- #define TSSI_CCK_CH_GROUP_NUM 6
- #define TSSI_MCS_2G_CH_GROUP_NUM 5
- #define TSSI_MCS_5G_CH_GROUP_NUM 14
- #define TSSI_MCS_6G_CH_GROUP_NUM 32
- #define TSSI_MCS_CH_GROUP_NUM \
- (TSSI_MCS_2G_CH_GROUP_NUM + TSSI_MCS_5G_CH_GROUP_NUM)
- #define TSSI_MAX_CH_NUM 67
- #define TSSI_ALIMK_VALUE_NUM 8
- struct rtw89_tssi_info {
- u8 thermal[RF_PATH_MAX];
- s8 tssi_trim[RF_PATH_MAX][TSSI_TRIM_CH_GROUP_NUM];
- s8 tssi_trim_6g[RF_PATH_MAX][TSSI_TRIM_CH_GROUP_NUM_6G];
- s8 tssi_cck[RF_PATH_MAX][TSSI_CCK_CH_GROUP_NUM];
- s8 tssi_mcs[RF_PATH_MAX][TSSI_MCS_CH_GROUP_NUM];
- s8 tssi_6g_mcs[RF_PATH_MAX][TSSI_MCS_6G_CH_GROUP_NUM];
- s8 extra_ofst[RF_PATH_MAX];
- bool tssi_tracking_check[RF_PATH_MAX];
- u8 default_txagc_offset[RF_PATH_MAX];
- u32 base_thermal[RF_PATH_MAX];
- bool check_backup_aligmk[RF_PATH_MAX][TSSI_MAX_CH_NUM];
- u32 alignment_backup_by_ch[RF_PATH_MAX][TSSI_MAX_CH_NUM][TSSI_ALIMK_VALUE_NUM];
- u32 alignment_value[RF_PATH_MAX][TSSI_ALIMK_MAX][TSSI_ALIMK_VALUE_NUM];
- bool alignment_done[RF_PATH_MAX][TSSI_ALIMK_MAX];
- u32 tssi_alimk_time;
- };
- struct rtw89_power_trim_info {
- bool pg_thermal_trim;
- bool pg_pa_bias_trim;
- u8 thermal_trim[RF_PATH_MAX];
- u8 pa_bias_trim[RF_PATH_MAX];
- };
- struct rtw89_regd {
- char alpha2[3];
- u8 txpwr_regd[RTW89_BAND_NUM];
- };
- struct rtw89_regulatory_info {
- const struct rtw89_regd *regd;
- enum rtw89_reg_6ghz_power reg_6ghz_power;
- };
- enum rtw89_ifs_clm_application {
- RTW89_IFS_CLM_INIT = 0,
- RTW89_IFS_CLM_BACKGROUND = 1,
- RTW89_IFS_CLM_ACS = 2,
- RTW89_IFS_CLM_DIG = 3,
- RTW89_IFS_CLM_TDMA_DIG = 4,
- RTW89_IFS_CLM_DBG = 5,
- RTW89_IFS_CLM_DBG_MANUAL = 6
- };
- enum rtw89_env_racing_lv {
- RTW89_RAC_RELEASE = 0,
- RTW89_RAC_LV_1 = 1,
- RTW89_RAC_LV_2 = 2,
- RTW89_RAC_LV_3 = 3,
- RTW89_RAC_LV_4 = 4,
- RTW89_RAC_MAX_NUM = 5
- };
- struct rtw89_ccx_para_info {
- enum rtw89_env_racing_lv rac_lv;
- u16 mntr_time;
- u8 nhm_manual_th_ofst;
- u8 nhm_manual_th0;
- enum rtw89_ifs_clm_application ifs_clm_app;
- u32 ifs_clm_manual_th_times;
- u32 ifs_clm_manual_th0;
- u8 fahm_manual_th_ofst;
- u8 fahm_manual_th0;
- u8 fahm_numer_opt;
- u8 fahm_denom_opt;
- };
- enum rtw89_ccx_edcca_opt_sc_idx {
- RTW89_CCX_EDCCA_SEG0_P0 = 0,
- RTW89_CCX_EDCCA_SEG0_S1 = 1,
- RTW89_CCX_EDCCA_SEG0_S2 = 2,
- RTW89_CCX_EDCCA_SEG0_S3 = 3,
- RTW89_CCX_EDCCA_SEG1_P0 = 4,
- RTW89_CCX_EDCCA_SEG1_S1 = 5,
- RTW89_CCX_EDCCA_SEG1_S2 = 6,
- RTW89_CCX_EDCCA_SEG1_S3 = 7
- };
- enum rtw89_ccx_edcca_opt_bw_idx {
- RTW89_CCX_EDCCA_BW20_0 = 0,
- RTW89_CCX_EDCCA_BW20_1 = 1,
- RTW89_CCX_EDCCA_BW20_2 = 2,
- RTW89_CCX_EDCCA_BW20_3 = 3,
- RTW89_CCX_EDCCA_BW20_4 = 4,
- RTW89_CCX_EDCCA_BW20_5 = 5,
- RTW89_CCX_EDCCA_BW20_6 = 6,
- RTW89_CCX_EDCCA_BW20_7 = 7
- };
- #define RTW89_NHM_TH_NUM 11
- #define RTW89_FAHM_TH_NUM 11
- #define RTW89_NHM_RPT_NUM 12
- #define RTW89_FAHM_RPT_NUM 12
- #define RTW89_IFS_CLM_NUM 4
- struct rtw89_env_monitor_info {
- u8 ccx_watchdog_result;
- bool ccx_ongoing;
- u8 ccx_rac_lv;
- bool ccx_manual_ctrl;
- u16 ifs_clm_mntr_time;
- enum rtw89_ifs_clm_application ifs_clm_app;
- u16 ccx_period;
- u8 ccx_unit_idx;
- u16 ifs_clm_th_l[RTW89_IFS_CLM_NUM];
- u16 ifs_clm_th_h[RTW89_IFS_CLM_NUM];
- u16 ifs_clm_tx;
- u16 ifs_clm_edcca_excl_cca;
- u16 ifs_clm_ofdmfa;
- u16 ifs_clm_ofdmcca_excl_fa;
- u16 ifs_clm_cckfa;
- u16 ifs_clm_cckcca_excl_fa;
- u16 ifs_clm_total_ifs;
- u8 ifs_clm_his[RTW89_IFS_CLM_NUM];
- u16 ifs_clm_avg[RTW89_IFS_CLM_NUM];
- u16 ifs_clm_cca[RTW89_IFS_CLM_NUM];
- u8 ifs_clm_tx_ratio;
- u8 ifs_clm_edcca_excl_cca_ratio;
- u8 ifs_clm_cck_fa_ratio;
- u8 ifs_clm_ofdm_fa_ratio;
- u8 ifs_clm_cck_cca_excl_fa_ratio;
- u8 ifs_clm_ofdm_cca_excl_fa_ratio;
- u16 ifs_clm_cck_fa_permil;
- u16 ifs_clm_ofdm_fa_permil;
- u32 ifs_clm_ifs_avg[RTW89_IFS_CLM_NUM];
- u32 ifs_clm_cca_avg[RTW89_IFS_CLM_NUM];
- };
- enum rtw89_ser_rcvy_step {
- RTW89_SER_DRV_STOP_TX,
- RTW89_SER_DRV_STOP_RX,
- RTW89_SER_DRV_STOP_RUN,
- RTW89_SER_HAL_STOP_DMA,
- RTW89_SER_SUPPRESS_LOG,
- RTW89_NUM_OF_SER_FLAGS
- };
- struct rtw89_ser {
- u8 state;
- u8 alarm_event;
- bool prehandle_l1;
- struct work_struct ser_hdl_work;
- struct delayed_work ser_alarm_work;
- const struct state_ent *st_tbl;
- const struct event_ent *ev_tbl;
- struct list_head msg_q;
- spinlock_t msg_q_lock; /* lock when read/write ser msg */
- DECLARE_BITMAP(flags, RTW89_NUM_OF_SER_FLAGS);
- };
- enum rtw89_mac_ax_ps_mode {
- RTW89_MAC_AX_PS_MODE_ACTIVE = 0,
- RTW89_MAC_AX_PS_MODE_LEGACY = 1,
- RTW89_MAC_AX_PS_MODE_WMMPS = 2,
- RTW89_MAC_AX_PS_MODE_MAX = 3,
- };
- enum rtw89_last_rpwm_mode {
- RTW89_LAST_RPWM_PS = 0x0,
- RTW89_LAST_RPWM_ACTIVE = 0x6,
- };
- struct rtw89_lps_parm {
- u8 macid;
- u8 psmode; /* enum rtw89_mac_ax_ps_mode */
- u8 lastrpwm; /* enum rtw89_last_rpwm_mode */
- };
- struct rtw89_ppdu_sts_info {
- struct sk_buff_head rx_queue[RTW89_PHY_MAX];
- u8 curr_rx_ppdu_cnt[RTW89_PHY_MAX];
- };
- struct rtw89_early_h2c {
- struct list_head list;
- u8 *h2c;
- u16 h2c_len;
- };
- struct rtw89_hw_scan_info {
- struct ieee80211_vif *scanning_vif;
- struct list_head pkt_list[NUM_NL80211_BANDS];
- struct rtw89_chan op_chan;
- u32 last_chan_idx;
- };
- enum rtw89_phy_bb_gain_band {
- RTW89_BB_GAIN_BAND_2G = 0,
- RTW89_BB_GAIN_BAND_5G_L = 1,
- RTW89_BB_GAIN_BAND_5G_M = 2,
- RTW89_BB_GAIN_BAND_5G_H = 3,
- RTW89_BB_GAIN_BAND_6G_L = 4,
- RTW89_BB_GAIN_BAND_6G_M = 5,
- RTW89_BB_GAIN_BAND_6G_H = 6,
- RTW89_BB_GAIN_BAND_6G_UH = 7,
- RTW89_BB_GAIN_BAND_NR,
- };
- enum rtw89_phy_bb_rxsc_num {
- RTW89_BB_RXSC_NUM_40 = 9, /* SC: 0, 1~8 */
- RTW89_BB_RXSC_NUM_80 = 13, /* SC: 0, 1~8, 9~12 */
- RTW89_BB_RXSC_NUM_160 = 15, /* SC: 0, 1~8, 9~12, 13~14 */
- };
- struct rtw89_phy_bb_gain_info {
- s8 lna_gain[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX][LNA_GAIN_NUM];
- s8 tia_gain[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX][TIA_GAIN_NUM];
- s8 lna_gain_bypass[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX][LNA_GAIN_NUM];
- s8 lna_op1db[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX][LNA_GAIN_NUM];
- s8 tia_lna_op1db[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX]
- [LNA_GAIN_NUM + 1]; /* TIA0_LNA0~6 + TIA1_LNA6 */
- s8 rpl_ofst_20[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX];
- s8 rpl_ofst_40[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX]
- [RTW89_BB_RXSC_NUM_40];
- s8 rpl_ofst_80[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX]
- [RTW89_BB_RXSC_NUM_80];
- s8 rpl_ofst_160[RTW89_BB_GAIN_BAND_NR][RF_PATH_MAX]
- [RTW89_BB_RXSC_NUM_160];
- };
- struct rtw89_phy_efuse_gain {
- bool offset_valid;
- bool comp_valid;
- s8 offset[RF_PATH_MAX][RTW89_GAIN_OFFSET_NR]; /* S(8, 0) */
- s8 offset_base[RTW89_PHY_MAX]; /* S(8, 4) */
- s8 rssi_base[RTW89_PHY_MAX]; /* S(8, 4) */
- s8 comp[RF_PATH_MAX][RTW89_SUBBAND_NR]; /* S(8, 0) */
- };
- #define RTW89_MAX_PATTERN_NUM 18
- #define RTW89_MAX_PATTERN_MASK_SIZE 4
- #define RTW89_MAX_PATTERN_SIZE 128
- struct rtw89_wow_cam_info {
- bool r_w;
- u8 idx;
- u32 mask[RTW89_MAX_PATTERN_MASK_SIZE];
- u16 crc;
- bool negative_pattern_match;
- bool skip_mac_hdr;
- bool uc;
- bool mc;
- bool bc;
- bool valid;
- };
- struct rtw89_wow_param {
- struct ieee80211_vif *wow_vif;
- DECLARE_BITMAP(flags, RTW89_WOW_FLAG_NUM);
- struct rtw89_wow_cam_info patterns[RTW89_MAX_PATTERN_NUM];
- u8 pattern_cnt;
- };
- struct rtw89_mcc_limit {
- bool enable;
- u16 max_tob; /* TU; max time offset behind */
- u16 max_toa; /* TU; max time offset ahead */
- u16 max_dur; /* TU */
- };
- struct rtw89_mcc_policy {
- u8 c2h_rpt;
- u8 tx_null_early;
- u8 dis_tx_null;
- u8 in_curr_ch;
- u8 dis_sw_retry;
- u8 sw_retry_count;
- };
- struct rtw89_mcc_role {
- struct rtw89_vif *rtwvif;
- struct rtw89_mcc_policy policy;
- struct rtw89_mcc_limit limit;
- /* byte-array in LE order for FW */
- u8 macid_bitmap[BITS_TO_BYTES(RTW89_MAX_MAC_ID_NUM)];
- u16 duration; /* TU */
- u16 beacon_interval; /* TU */
- bool is_2ghz;
- bool is_go;
- bool is_gc;
- };
- struct rtw89_mcc_bt_role {
- u16 duration; /* TU */
- };
- struct rtw89_mcc_courtesy {
- bool enable;
- u8 slot_num;
- u8 macid_src;
- u8 macid_tgt;
- };
- enum rtw89_mcc_plan {
- RTW89_MCC_PLAN_TAIL_BT,
- RTW89_MCC_PLAN_MID_BT,
- RTW89_MCC_PLAN_NO_BT,
- NUM_OF_RTW89_MCC_PLAN,
- };
- struct rtw89_mcc_pattern {
- s16 tob_ref; /* TU; time offset behind of reference role */
- s16 toa_ref; /* TU; time offset ahead of reference role */
- s16 tob_aux; /* TU; time offset behind of auxiliary role */
- s16 toa_aux; /* TU; time offset ahead of auxiliary role */
- enum rtw89_mcc_plan plan;
- struct rtw89_mcc_courtesy courtesy;
- };
- struct rtw89_mcc_sync {
- bool enable;
- u16 offset; /* TU */
- u8 macid_src;
- u8 macid_tgt;
- };
- struct rtw89_mcc_config {
- struct rtw89_mcc_pattern pattern;
- struct rtw89_mcc_sync sync;
- u64 start_tsf;
- u16 mcc_interval; /* TU */
- u16 beacon_offset; /* TU */
- };
- enum rtw89_mcc_mode {
- RTW89_MCC_MODE_GO_STA,
- RTW89_MCC_MODE_GC_STA,
- };
- struct rtw89_mcc_info {
- struct rtw89_wait_info wait;
- u8 group;
- enum rtw89_mcc_mode mode;
- struct rtw89_mcc_role role_ref; /* reference role */
- struct rtw89_mcc_role role_aux; /* auxiliary role */
- struct rtw89_mcc_bt_role bt_role;
- struct rtw89_mcc_config config;
- };
- struct rtw89_dev {
- struct ieee80211_hw *hw;
- struct device *dev;
- const struct ieee80211_ops *ops;
- bool dbcc_en;
- struct rtw89_hw_scan_info scan_info;
- const struct rtw89_chip_info *chip;
- const struct rtw89_pci_info *pci_info;
- const struct rtw89_rfe_parms *rfe_parms;
- struct rtw89_hal hal;
- struct rtw89_mcc_info mcc;
- struct rtw89_mac_info mac;
- struct rtw89_fw_info fw;
- struct rtw89_hci_info hci;
- struct rtw89_efuse efuse;
- struct rtw89_traffic_stats stats;
- struct rtw89_rfe_data *rfe_data;
- /* ensures exclusive access from mac80211 callbacks */
- struct mutex mutex;
- struct list_head rtwvifs_list;
- /* used to protect rf read write */
- struct mutex rf_mutex;
- struct workqueue_struct *txq_wq;
- struct work_struct txq_work;
- struct delayed_work txq_reinvoke_work;
- /* used to protect ba_list and forbid_ba_list */
- spinlock_t ba_lock;
- /* txqs to setup ba session */
- struct list_head ba_list;
- /* txqs to forbid ba session */
- struct list_head forbid_ba_list;
- struct work_struct ba_work;
- /* used to protect rpwm */
- spinlock_t rpwm_lock;
- struct rtw89_cam_info cam_info;
- struct sk_buff_head c2h_queue;
- struct work_struct c2h_work;
- struct work_struct ips_work;
- struct work_struct load_firmware_work;
- struct work_struct cancel_6ghz_probe_work;
- struct list_head early_h2c_list;
- struct rtw89_ser ser;
- DECLARE_BITMAP(hw_port, RTW89_PORT_NUM);
- DECLARE_BITMAP(mac_id_map, RTW89_MAX_MAC_ID_NUM);
- DECLARE_BITMAP(flags, NUM_OF_RTW89_FLAGS);
- DECLARE_BITMAP(pkt_offload, RTW89_MAX_PKT_OFLD_NUM);
- struct rtw89_phy_stat phystat;
- struct rtw89_dack_info dack;
- struct rtw89_iqk_info iqk;
- struct rtw89_dpk_info dpk;
- struct rtw89_rfk_mcc_info rfk_mcc;
- struct rtw89_lck_info lck;
- struct rtw89_rx_dck_info rx_dck;
- bool is_tssi_mode[RF_PATH_MAX];
- bool is_bt_iqk_timeout;
- struct rtw89_fem_info fem;
- struct rtw89_txpwr_byrate byr[RTW89_BAND_NUM][RTW89_BYR_BW_NUM];
- struct rtw89_tssi_info tssi;
- struct rtw89_power_trim_info pwr_trim;
- struct rtw89_cfo_tracking_info cfo_tracking;
- struct rtw89_env_monitor_info env_monitor;
- struct rtw89_dig_info dig;
- struct rtw89_phy_ch_info ch_info;
- struct rtw89_phy_bb_gain_info bb_gain;
- struct rtw89_phy_efuse_gain efuse_gain;
- struct rtw89_phy_ul_tb_info ul_tb_info;
- struct rtw89_antdiv_info antdiv;
- struct delayed_work track_work;
- struct delayed_work chanctx_work;
- struct delayed_work coex_act1_work;
- struct delayed_work coex_bt_devinfo_work;
- struct delayed_work coex_rfk_chk_work;
- struct delayed_work cfo_track_work;
- struct delayed_work forbid_ba_work;
- struct delayed_work roc_work;
- struct delayed_work antdiv_work;
- struct rtw89_ppdu_sts_info ppdu_sts;
- u8 total_sta_assoc;
- bool scanning;
- struct rtw89_regulatory_info regulatory;
- struct rtw89_sar_info sar;
- struct rtw89_tas_info tas;
- struct rtw89_btc btc;
- enum rtw89_ps_mode ps_mode;
- bool lps_enabled;
- struct rtw89_wow_param wow;
- /* napi structure */
- struct net_device netdev;
- struct napi_struct napi;
- int napi_budget_countdown;
- /* HCI related data, keep last */
- u8 priv[] __aligned(sizeof(void *));
- };
- static inline int rtw89_hci_tx_write(struct rtw89_dev *rtwdev,
- struct rtw89_core_tx_request *tx_req)
- {
- return rtwdev->hci.ops->tx_write(rtwdev, tx_req);
- }
- static inline void rtw89_hci_reset(struct rtw89_dev *rtwdev)
- {
- rtwdev->hci.ops->reset(rtwdev);
- }
- static inline int rtw89_hci_start(struct rtw89_dev *rtwdev)
- {
- return rtwdev->hci.ops->start(rtwdev);
- }
- static inline void rtw89_hci_stop(struct rtw89_dev *rtwdev)
- {
- rtwdev->hci.ops->stop(rtwdev);
- }
- static inline int rtw89_hci_deinit(struct rtw89_dev *rtwdev)
- {
- return rtwdev->hci.ops->deinit(rtwdev);
- }
- static inline void rtw89_hci_pause(struct rtw89_dev *rtwdev, bool pause)
- {
- rtwdev->hci.ops->pause(rtwdev, pause);
- }
- static inline void rtw89_hci_switch_mode(struct rtw89_dev *rtwdev, bool low_power)
- {
- rtwdev->hci.ops->switch_mode(rtwdev, low_power);
- }
- static inline void rtw89_hci_recalc_int_mit(struct rtw89_dev *rtwdev)
- {
- rtwdev->hci.ops->recalc_int_mit(rtwdev);
- }
- static inline u32 rtw89_hci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev, u8 txch)
- {
- return rtwdev->hci.ops->check_and_reclaim_tx_resource(rtwdev, txch);
- }
- static inline void rtw89_hci_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch)
- {
- return rtwdev->hci.ops->tx_kick_off(rtwdev, txch);
- }
- static inline void rtw89_hci_flush_queues(struct rtw89_dev *rtwdev, u32 queues,
- bool drop)
- {
- if (!test_bit(RTW89_FLAG_POWERON, rtwdev->flags))
- return;
- if (rtwdev->hci.ops->flush_queues)
- return rtwdev->hci.ops->flush_queues(rtwdev, queues, drop);
- }
- static inline void rtw89_hci_recovery_start(struct rtw89_dev *rtwdev)
- {
- if (rtwdev->hci.ops->recovery_start)
- rtwdev->hci.ops->recovery_start(rtwdev);
- }
- static inline void rtw89_hci_recovery_complete(struct rtw89_dev *rtwdev)
- {
- if (rtwdev->hci.ops->recovery_complete)
- rtwdev->hci.ops->recovery_complete(rtwdev);
- }
- static inline void rtw89_hci_enable_intr(struct rtw89_dev *rtwdev)
- {
- if (rtwdev->hci.ops->enable_intr)
- rtwdev->hci.ops->enable_intr(rtwdev);
- }
- static inline void rtw89_hci_disable_intr(struct rtw89_dev *rtwdev)
- {
- if (rtwdev->hci.ops->disable_intr)
- rtwdev->hci.ops->disable_intr(rtwdev);
- }
- static inline void rtw89_hci_ctrl_txdma_ch(struct rtw89_dev *rtwdev, bool enable)
- {
- if (rtwdev->hci.ops->ctrl_txdma_ch)
- rtwdev->hci.ops->ctrl_txdma_ch(rtwdev, enable);
- }
- static inline void rtw89_hci_ctrl_txdma_fw_ch(struct rtw89_dev *rtwdev, bool enable)
- {
- if (rtwdev->hci.ops->ctrl_txdma_fw_ch)
- rtwdev->hci.ops->ctrl_txdma_fw_ch(rtwdev, enable);
- }
- static inline void rtw89_hci_ctrl_trxhci(struct rtw89_dev *rtwdev, bool enable)
- {
- if (rtwdev->hci.ops->ctrl_trxhci)
- rtwdev->hci.ops->ctrl_trxhci(rtwdev, enable);
- }
- static inline int rtw89_hci_poll_txdma_ch(struct rtw89_dev *rtwdev)
- {
- int ret = 0;
- if (rtwdev->hci.ops->poll_txdma_ch)
- ret = rtwdev->hci.ops->poll_txdma_ch(rtwdev);
- return ret;
- }
- static inline void rtw89_hci_clr_idx_all(struct rtw89_dev *rtwdev)
- {
- if (rtwdev->hci.ops->clr_idx_all)
- rtwdev->hci.ops->clr_idx_all(rtwdev);
- }
- static inline int rtw89_hci_rst_bdram(struct rtw89_dev *rtwdev)
- {
- int ret = 0;
- if (rtwdev->hci.ops->rst_bdram)
- ret = rtwdev->hci.ops->rst_bdram(rtwdev);
- return ret;
- }
- static inline void rtw89_hci_clear(struct rtw89_dev *rtwdev, struct pci_dev *pdev)
- {
- if (rtwdev->hci.ops->clear)
- rtwdev->hci.ops->clear(rtwdev, pdev);
- }
- static inline
- struct rtw89_tx_skb_data *RTW89_TX_SKB_CB(struct sk_buff *skb)
- {
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- return (struct rtw89_tx_skb_data *)info->status.status_driver_data;
- }
- static inline u8 rtw89_read8(struct rtw89_dev *rtwdev, u32 addr)
- {
- return rtwdev->hci.ops->read8(rtwdev, addr);
- }
- static inline u16 rtw89_read16(struct rtw89_dev *rtwdev, u32 addr)
- {
- return rtwdev->hci.ops->read16(rtwdev, addr);
- }
- static inline u32 rtw89_read32(struct rtw89_dev *rtwdev, u32 addr)
- {
- return rtwdev->hci.ops->read32(rtwdev, addr);
- }
- static inline void rtw89_write8(struct rtw89_dev *rtwdev, u32 addr, u8 data)
- {
- rtwdev->hci.ops->write8(rtwdev, addr, data);
- }
- static inline void rtw89_write16(struct rtw89_dev *rtwdev, u32 addr, u16 data)
- {
- rtwdev->hci.ops->write16(rtwdev, addr, data);
- }
- static inline void rtw89_write32(struct rtw89_dev *rtwdev, u32 addr, u32 data)
- {
- rtwdev->hci.ops->write32(rtwdev, addr, data);
- }
- static inline void
- rtw89_write8_set(struct rtw89_dev *rtwdev, u32 addr, u8 bit)
- {
- u8 val;
- val = rtw89_read8(rtwdev, addr);
- rtw89_write8(rtwdev, addr, val | bit);
- }
- static inline void
- rtw89_write16_set(struct rtw89_dev *rtwdev, u32 addr, u16 bit)
- {
- u16 val;
- val = rtw89_read16(rtwdev, addr);
- rtw89_write16(rtwdev, addr, val | bit);
- }
- static inline void
- rtw89_write32_set(struct rtw89_dev *rtwdev, u32 addr, u32 bit)
- {
- u32 val;
- val = rtw89_read32(rtwdev, addr);
- rtw89_write32(rtwdev, addr, val | bit);
- }
- static inline void
- rtw89_write8_clr(struct rtw89_dev *rtwdev, u32 addr, u8 bit)
- {
- u8 val;
- val = rtw89_read8(rtwdev, addr);
- rtw89_write8(rtwdev, addr, val & ~bit);
- }
- static inline void
- rtw89_write16_clr(struct rtw89_dev *rtwdev, u32 addr, u16 bit)
- {
- u16 val;
- val = rtw89_read16(rtwdev, addr);
- rtw89_write16(rtwdev, addr, val & ~bit);
- }
- static inline void
- rtw89_write32_clr(struct rtw89_dev *rtwdev, u32 addr, u32 bit)
- {
- u32 val;
- val = rtw89_read32(rtwdev, addr);
- rtw89_write32(rtwdev, addr, val & ~bit);
- }
- static inline u32
- rtw89_read32_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask)
- {
- u32 shift = __ffs(mask);
- u32 orig;
- u32 ret;
- orig = rtw89_read32(rtwdev, addr);
- ret = (orig & mask) >> shift;
- return ret;
- }
- static inline u16
- rtw89_read16_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask)
- {
- u32 shift = __ffs(mask);
- u32 orig;
- u32 ret;
- orig = rtw89_read16(rtwdev, addr);
- ret = (orig & mask) >> shift;
- return ret;
- }
- static inline u8
- rtw89_read8_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask)
- {
- u32 shift = __ffs(mask);
- u32 orig;
- u32 ret;
- orig = rtw89_read8(rtwdev, addr);
- ret = (orig & mask) >> shift;
- return ret;
- }
- static inline void
- rtw89_write32_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask, u32 data)
- {
- u32 shift = __ffs(mask);
- u32 orig;
- u32 set;
- WARN(addr & 0x3, "should be 4-byte aligned, addr = 0x%08x\n", addr);
- orig = rtw89_read32(rtwdev, addr);
- set = (orig & ~mask) | ((data << shift) & mask);
- rtw89_write32(rtwdev, addr, set);
- }
- static inline void
- rtw89_write16_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask, u16 data)
- {
- u32 shift;
- u16 orig, set;
- mask &= 0xffff;
- shift = __ffs(mask);
- orig = rtw89_read16(rtwdev, addr);
- set = (orig & ~mask) | ((data << shift) & mask);
- rtw89_write16(rtwdev, addr, set);
- }
- static inline void
- rtw89_write8_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask, u8 data)
- {
- u32 shift;
- u8 orig, set;
- mask &= 0xff;
- shift = __ffs(mask);
- orig = rtw89_read8(rtwdev, addr);
- set = (orig & ~mask) | ((data << shift) & mask);
- rtw89_write8(rtwdev, addr, set);
- }
- static inline u32
- rtw89_read_rf(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
- u32 addr, u32 mask)
- {
- u32 val;
- mutex_lock(&rtwdev->rf_mutex);
- val = rtwdev->chip->ops->read_rf(rtwdev, rf_path, addr, mask);
- mutex_unlock(&rtwdev->rf_mutex);
- return val;
- }
- static inline void
- rtw89_write_rf(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
- u32 addr, u32 mask, u32 data)
- {
- mutex_lock(&rtwdev->rf_mutex);
- rtwdev->chip->ops->write_rf(rtwdev, rf_path, addr, mask, data);
- mutex_unlock(&rtwdev->rf_mutex);
- }
- static inline struct ieee80211_txq *rtw89_txq_to_txq(struct rtw89_txq *rtwtxq)
- {
- void *p = rtwtxq;
- return container_of(p, struct ieee80211_txq, drv_priv);
- }
- static inline void rtw89_core_txq_init(struct rtw89_dev *rtwdev,
- struct ieee80211_txq *txq)
- {
- struct rtw89_txq *rtwtxq;
- if (!txq)
- return;
- rtwtxq = (struct rtw89_txq *)txq->drv_priv;
- INIT_LIST_HEAD(&rtwtxq->list);
- }
- static inline struct ieee80211_vif *rtwvif_to_vif(struct rtw89_vif *rtwvif)
- {
- void *p = rtwvif;
- return container_of(p, struct ieee80211_vif, drv_priv);
- }
- static inline struct ieee80211_vif *rtwvif_to_vif_safe(struct rtw89_vif *rtwvif)
- {
- return rtwvif ? rtwvif_to_vif(rtwvif) : NULL;
- }
- static inline struct rtw89_vif *vif_to_rtwvif_safe(struct ieee80211_vif *vif)
- {
- return vif ? (struct rtw89_vif *)vif->drv_priv : NULL;
- }
- static inline struct ieee80211_sta *rtwsta_to_sta(struct rtw89_sta *rtwsta)
- {
- void *p = rtwsta;
- return container_of(p, struct ieee80211_sta, drv_priv);
- }
- static inline struct ieee80211_sta *rtwsta_to_sta_safe(struct rtw89_sta *rtwsta)
- {
- return rtwsta ? rtwsta_to_sta(rtwsta) : NULL;
- }
- static inline struct rtw89_sta *sta_to_rtwsta_safe(struct ieee80211_sta *sta)
- {
- return sta ? (struct rtw89_sta *)sta->drv_priv : NULL;
- }
- static inline u8 rtw89_hw_to_rate_info_bw(enum rtw89_bandwidth hw_bw)
- {
- if (hw_bw == RTW89_CHANNEL_WIDTH_160)
- return RATE_INFO_BW_160;
- else if (hw_bw == RTW89_CHANNEL_WIDTH_80)
- return RATE_INFO_BW_80;
- else if (hw_bw == RTW89_CHANNEL_WIDTH_40)
- return RATE_INFO_BW_40;
- else
- return RATE_INFO_BW_20;
- }
- static inline
- enum nl80211_band rtw89_hw_to_nl80211_band(enum rtw89_band hw_band)
- {
- switch (hw_band) {
- default:
- case RTW89_BAND_2G:
- return NL80211_BAND_2GHZ;
- case RTW89_BAND_5G:
- return NL80211_BAND_5GHZ;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
- case RTW89_BAND_6G:
- return NL80211_BAND_6GHZ;
- #endif
- }
- }
- static inline
- enum rtw89_band rtw89_nl80211_to_hw_band(enum nl80211_band nl_band)
- {
- switch (nl_band) {
- default:
- case NL80211_BAND_2GHZ:
- return RTW89_BAND_2G;
- case NL80211_BAND_5GHZ:
- return RTW89_BAND_5G;
- case NL80211_BAND_6GHZ:
- return RTW89_BAND_6G;
- }
- }
- static inline
- enum rtw89_bandwidth nl_to_rtw89_bandwidth(enum nl80211_chan_width width)
- {
- switch (width) {
- default:
- WARN(1, "Not support bandwidth %d\n", width);
- fallthrough;
- case NL80211_CHAN_WIDTH_20_NOHT:
- case NL80211_CHAN_WIDTH_20:
- return RTW89_CHANNEL_WIDTH_20;
- case NL80211_CHAN_WIDTH_40:
- return RTW89_CHANNEL_WIDTH_40;
- case NL80211_CHAN_WIDTH_80:
- return RTW89_CHANNEL_WIDTH_80;
- case NL80211_CHAN_WIDTH_160:
- return RTW89_CHANNEL_WIDTH_160;
- }
- }
- static inline
- enum nl80211_he_ru_alloc rtw89_he_rua_to_ru_alloc(u16 rua)
- {
- switch (rua) {
- default:
- WARN(1, "Invalid RU allocation: %d\n", rua);
- fallthrough;
- case 0 ... 36:
- return NL80211_RATE_INFO_HE_RU_ALLOC_26;
- case 37 ... 52:
- return NL80211_RATE_INFO_HE_RU_ALLOC_52;
- case 53 ... 60:
- return NL80211_RATE_INFO_HE_RU_ALLOC_106;
- case 61 ... 64:
- return NL80211_RATE_INFO_HE_RU_ALLOC_242;
- case 65 ... 66:
- return NL80211_RATE_INFO_HE_RU_ALLOC_484;
- case 67:
- return NL80211_RATE_INFO_HE_RU_ALLOC_996;
- case 68:
- return NL80211_RATE_INFO_HE_RU_ALLOC_2x996;
- }
- }
- static inline
- struct rtw89_addr_cam_entry *rtw89_get_addr_cam_of(struct rtw89_vif *rtwvif,
- struct rtw89_sta *rtwsta)
- {
- if (rtwsta) {
- struct ieee80211_sta *sta = rtwsta_to_sta(rtwsta);
- if (rtwvif->net_type == RTW89_NET_TYPE_AP_MODE || sta->tdls)
- return &rtwsta->addr_cam;
- }
- return &rtwvif->addr_cam;
- }
- static inline
- struct rtw89_bssid_cam_entry *rtw89_get_bssid_cam_of(struct rtw89_vif *rtwvif,
- struct rtw89_sta *rtwsta)
- {
- if (rtwsta) {
- struct ieee80211_sta *sta = rtwsta_to_sta(rtwsta);
- if (sta->tdls)
- return &rtwsta->bssid_cam;
- }
- return &rtwvif->bssid_cam;
- }
- static inline
- void rtw89_chip_set_channel_prepare(struct rtw89_dev *rtwdev,
- struct rtw89_channel_help_params *p,
- const struct rtw89_chan *chan,
- enum rtw89_mac_idx mac_idx,
- enum rtw89_phy_idx phy_idx)
- {
- rtwdev->chip->ops->set_channel_help(rtwdev, true, p, chan,
- mac_idx, phy_idx);
- }
- static inline
- void rtw89_chip_set_channel_done(struct rtw89_dev *rtwdev,
- struct rtw89_channel_help_params *p,
- const struct rtw89_chan *chan,
- enum rtw89_mac_idx mac_idx,
- enum rtw89_phy_idx phy_idx)
- {
- rtwdev->chip->ops->set_channel_help(rtwdev, false, p, chan,
- mac_idx, phy_idx);
- }
- static inline
- const struct cfg80211_chan_def *rtw89_chandef_get(struct rtw89_dev *rtwdev,
- enum rtw89_sub_entity_idx idx)
- {
- struct rtw89_hal *hal = &rtwdev->hal;
- enum rtw89_sub_entity_idx roc_idx = atomic_read(&hal->roc_entity_idx);
- if (roc_idx == idx)
- return &hal->roc_chandef;
- return &hal->sub[idx].chandef;
- }
- static inline
- const struct rtw89_chan *rtw89_chan_get(struct rtw89_dev *rtwdev,
- enum rtw89_sub_entity_idx idx)
- {
- struct rtw89_hal *hal = &rtwdev->hal;
- return &hal->sub[idx].chan;
- }
- static inline
- const struct rtw89_chan_rcd *rtw89_chan_rcd_get(struct rtw89_dev *rtwdev,
- enum rtw89_sub_entity_idx idx)
- {
- struct rtw89_hal *hal = &rtwdev->hal;
- return &hal->sub[idx].rcd;
- }
- static inline
- const struct rtw89_chan *rtw89_scan_chan_get(struct rtw89_dev *rtwdev)
- {
- struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif;
- struct rtw89_vif *rtwvif = vif_to_rtwvif_safe(vif);
- if (rtwvif)
- return rtw89_chan_get(rtwdev, rtwvif->sub_entity_idx);
- else
- return rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
- }
- static inline void rtw89_chip_fem_setup(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->fem_setup)
- chip->ops->fem_setup(rtwdev);
- }
- static inline void rtw89_chip_rfe_gpio(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->rfe_gpio)
- chip->ops->rfe_gpio(rtwdev);
- }
- static inline
- void rtw89_chip_bb_preinit(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->bb_preinit)
- chip->ops->bb_preinit(rtwdev, phy_idx);
- }
- static inline void rtw89_chip_bb_sethw(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->bb_sethw)
- chip->ops->bb_sethw(rtwdev);
- }
- static inline void rtw89_chip_rfk_init(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->rfk_init)
- chip->ops->rfk_init(rtwdev);
- }
- static inline void rtw89_chip_rfk_channel(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->rfk_channel)
- chip->ops->rfk_channel(rtwdev);
- }
- static inline void rtw89_chip_rfk_band_changed(struct rtw89_dev *rtwdev,
- enum rtw89_phy_idx phy_idx)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->rfk_band_changed)
- chip->ops->rfk_band_changed(rtwdev, phy_idx);
- }
- static inline void rtw89_chip_rfk_scan(struct rtw89_dev *rtwdev, bool start)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->rfk_scan)
- chip->ops->rfk_scan(rtwdev, start);
- }
- static inline void rtw89_chip_rfk_track(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->rfk_track)
- chip->ops->rfk_track(rtwdev);
- }
- static inline void rtw89_chip_set_txpwr_ctrl(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->set_txpwr_ctrl)
- chip->ops->set_txpwr_ctrl(rtwdev, RTW89_PHY_0);
- }
- static inline void rtw89_chip_power_trim(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->power_trim)
- chip->ops->power_trim(rtwdev);
- }
- static inline void rtw89_chip_init_txpwr_unit(struct rtw89_dev *rtwdev,
- enum rtw89_phy_idx phy_idx)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->init_txpwr_unit)
- chip->ops->init_txpwr_unit(rtwdev, phy_idx);
- }
- static inline u8 rtw89_chip_get_thermal(struct rtw89_dev *rtwdev,
- enum rtw89_rf_path rf_path)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (!chip->ops->get_thermal)
- return 0x10;
- return chip->ops->get_thermal(rtwdev, rf_path);
- }
- static inline void rtw89_chip_query_ppdu(struct rtw89_dev *rtwdev,
- struct rtw89_rx_phy_ppdu *phy_ppdu,
- struct ieee80211_rx_status *status)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->query_ppdu)
- chip->ops->query_ppdu(rtwdev, phy_ppdu, status);
- }
- static inline void rtw89_chip_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev,
- bool bt_en)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->bb_ctrl_btc_preagc)
- chip->ops->bb_ctrl_btc_preagc(rtwdev, bt_en);
- }
- static inline void rtw89_chip_cfg_txrx_path(struct rtw89_dev *rtwdev)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->cfg_txrx_path)
- chip->ops->cfg_txrx_path(rtwdev);
- }
- static inline
- void rtw89_chip_cfg_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif)
- {
- struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
- const struct rtw89_chip_info *chip = rtwdev->chip;
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0))
- if (!vif->bss_conf.he_support || !vif->cfg.assoc)
- #else
- if (!vif->bss_conf.he_support || !vif->bss_conf.assoc)
- #endif
- return;
- if (chip->ops->set_txpwr_ul_tb_offset)
- chip->ops->set_txpwr_ul_tb_offset(rtwdev, 0, rtwvif->mac_idx);
- }
- static inline void rtw89_load_txpwr_table(struct rtw89_dev *rtwdev,
- const struct rtw89_txpwr_table *tbl)
- {
- tbl->load(rtwdev, tbl);
- }
- static inline u8 rtw89_regd_get(struct rtw89_dev *rtwdev, u8 band)
- {
- const struct rtw89_regd *regd = rtwdev->regulatory.regd;
- return regd->txpwr_regd[band];
- }
- static inline void rtw89_ctrl_btg(struct rtw89_dev *rtwdev, bool btg)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (chip->ops->ctrl_btg)
- chip->ops->ctrl_btg(rtwdev, btg);
- }
- static inline
- void rtw89_chip_query_rxdesc(struct rtw89_dev *rtwdev,
- struct rtw89_rx_desc_info *desc_info,
- u8 *data, u32 data_offset)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- chip->ops->query_rxdesc(rtwdev, desc_info, data, data_offset);
- }
- static inline
- void rtw89_chip_fill_txdesc(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- chip->ops->fill_txdesc(rtwdev, desc_info, txdesc);
- }
- static inline
- void rtw89_chip_fill_txdesc_fwcmd(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- chip->ops->fill_txdesc_fwcmd(rtwdev, desc_info, txdesc);
- }
- static inline
- void rtw89_chip_mac_cfg_gnt(struct rtw89_dev *rtwdev,
- const struct rtw89_mac_ax_coex_gnt *gnt_cfg)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- chip->ops->mac_cfg_gnt(rtwdev, gnt_cfg);
- }
- static inline void rtw89_chip_cfg_ctrl_path(struct rtw89_dev *rtwdev, bool wl)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- chip->ops->cfg_ctrl_path(rtwdev, wl);
- }
- static inline
- int rtw89_chip_stop_sch_tx(struct rtw89_dev *rtwdev, u8 mac_idx,
- u32 *tx_en, enum rtw89_sch_tx_sel sel)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- return chip->ops->stop_sch_tx(rtwdev, mac_idx, tx_en, sel);
- }
- static inline
- int rtw89_chip_resume_sch_tx(struct rtw89_dev *rtwdev, u8 mac_idx, u32 tx_en)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- return chip->ops->resume_sch_tx(rtwdev, mac_idx, tx_en);
- }
- static inline
- int rtw89_chip_h2c_dctl_sec_cam(struct rtw89_dev *rtwdev,
- struct rtw89_vif *rtwvif,
- struct rtw89_sta *rtwsta)
- {
- const struct rtw89_chip_info *chip = rtwdev->chip;
- if (!chip->ops->h2c_dctl_sec_cam)
- return 0;
- return chip->ops->h2c_dctl_sec_cam(rtwdev, rtwvif, rtwsta);
- }
- static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr)
- {
- __le16 fc = hdr->frame_control;
- if (ieee80211_has_tods(fc))
- return hdr->addr1;
- else if (ieee80211_has_fromds(fc))
- return hdr->addr2;
- else
- return hdr->addr3;
- }
- static inline bool rtw89_sta_has_beamformer_cap(struct ieee80211_sta *sta)
- {
- #if LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0)
- if ((sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) ||
- (sta->vht_cap.cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) ||
- (sta->he_cap.he_cap_elem.phy_cap_info[3] & IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER) ||
- (sta->he_cap.he_cap_elem.phy_cap_info[4] & IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER))
- return true;
- #else
- if ((sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) ||
- (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) ||
- (sta->deflink.he_cap.he_cap_elem.phy_cap_info[3] &
- IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER) ||
- (sta->deflink.he_cap.he_cap_elem.phy_cap_info[4] &
- IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER))
- return true;
- #endif
- return false;
- }
- static inline struct rtw89_fw_suit *rtw89_fw_suit_get(struct rtw89_dev *rtwdev,
- enum rtw89_fw_type type)
- {
- struct rtw89_fw_info *fw_info = &rtwdev->fw;
- switch (type) {
- case RTW89_FW_WOWLAN:
- return &fw_info->wowlan;
- case RTW89_FW_LOGFMT:
- return &fw_info->log.suit;
- case RTW89_FW_BBMCU0:
- return &fw_info->bbmcu0;
- case RTW89_FW_BBMCU1:
- return &fw_info->bbmcu1;
- default:
- break;
- }
- return &fw_info->normal;
- }
- static inline struct sk_buff *rtw89_alloc_skb_for_rx(struct rtw89_dev *rtwdev,
- unsigned int length)
- {
- struct sk_buff *skb;
- if (rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR) {
- skb = dev_alloc_skb(length + RTW89_RADIOTAP_ROOM);
- if (!skb)
- return NULL;
- skb_reserve(skb, RTW89_RADIOTAP_ROOM);
- return skb;
- }
- return dev_alloc_skb(length);
- }
- static inline void rtw89_core_tx_wait_complete(struct rtw89_dev *rtwdev,
- struct rtw89_tx_skb_data *skb_data,
- bool tx_done)
- {
- struct rtw89_tx_wait_info *wait;
- rcu_read_lock();
- wait = rcu_dereference(skb_data->wait);
- if (!wait)
- goto out;
- wait->tx_done = tx_done;
- complete(&wait->completion);
- out:
- rcu_read_unlock();
- }
- int rtw89_core_tx_write(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, struct sk_buff *skb, int *qsel);
- int rtw89_h2c_tx(struct rtw89_dev *rtwdev,
- struct sk_buff *skb, bool fwdl);
- void rtw89_core_tx_kick_off(struct rtw89_dev *rtwdev, u8 qsel);
- int rtw89_core_tx_kick_off_and_wait(struct rtw89_dev *rtwdev, struct sk_buff *skb,
- int qsel, unsigned int timeout);
- void rtw89_core_fill_txdesc(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- void rtw89_core_fill_txdesc_v1(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- void rtw89_core_fill_txdesc_v2(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- void rtw89_core_fill_txdesc_fwcmd_v1(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- void rtw89_core_fill_txdesc_fwcmd_v2(struct rtw89_dev *rtwdev,
- struct rtw89_tx_desc_info *desc_info,
- void *txdesc);
- void rtw89_core_rx(struct rtw89_dev *rtwdev,
- struct rtw89_rx_desc_info *desc_info,
- struct sk_buff *skb);
- void rtw89_core_query_rxdesc(struct rtw89_dev *rtwdev,
- struct rtw89_rx_desc_info *desc_info,
- u8 *data, u32 data_offset);
- void rtw89_core_query_rxdesc_v2(struct rtw89_dev *rtwdev,
- struct rtw89_rx_desc_info *desc_info,
- u8 *data, u32 data_offset);
- void rtw89_core_napi_start(struct rtw89_dev *rtwdev);
- void rtw89_core_napi_stop(struct rtw89_dev *rtwdev);
- void rtw89_core_napi_init(struct rtw89_dev *rtwdev);
- void rtw89_core_napi_deinit(struct rtw89_dev *rtwdev);
- int rtw89_core_sta_add(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- int rtw89_core_sta_disassoc(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- int rtw89_core_sta_disconnect(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- int rtw89_core_sta_remove(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- void rtw89_core_set_tid_config(struct rtw89_dev *rtwdev,
- struct ieee80211_sta *sta,
- struct cfg80211_tid_config *tid_config);
- int rtw89_core_init(struct rtw89_dev *rtwdev);
- void rtw89_core_deinit(struct rtw89_dev *rtwdev);
- int rtw89_core_register(struct rtw89_dev *rtwdev);
- void rtw89_core_unregister(struct rtw89_dev *rtwdev);
- struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
- u32 bus_data_size,
- const struct rtw89_chip_info *chip);
- void rtw89_free_ieee80211_hw(struct rtw89_dev *rtwdev);
- void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev);
- void rtw89_get_default_chandef(struct cfg80211_chan_def *chandef);
- void rtw89_get_channel_params(const struct cfg80211_chan_def *chandef,
- struct rtw89_chan *chan);
- void rtw89_set_channel(struct rtw89_dev *rtwdev);
- void rtw89_get_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
- struct rtw89_chan *chan);
- u8 rtw89_core_acquire_bit_map(unsigned long *addr, unsigned long size);
- void rtw89_core_release_bit_map(unsigned long *addr, u8 bit);
- void rtw89_core_release_all_bits_map(unsigned long *addr, unsigned int nbits);
- int rtw89_core_acquire_sta_ba_entry(struct rtw89_dev *rtwdev,
- struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx);
- int rtw89_core_release_sta_ba_entry(struct rtw89_dev *rtwdev,
- struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx);
- void rtw89_vif_type_mapping(struct ieee80211_vif *vif, bool assoc);
- int rtw89_chip_info_setup(struct rtw89_dev *rtwdev);
- bool rtw89_ra_report_to_bitrate(struct rtw89_dev *rtwdev, u8 rpt_rate, u16 *bitrate);
- int rtw89_regd_setup(struct rtw89_dev *rtwdev);
- int rtw89_regd_init(struct rtw89_dev *rtwdev,
- void (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request *request));
- void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request);
- void rtw89_traffic_stats_init(struct rtw89_dev *rtwdev,
- struct rtw89_traffic_stats *stats);
- int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond);
- void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
- const struct rtw89_completion_data *data);
- int rtw89_core_start(struct rtw89_dev *rtwdev);
- void rtw89_core_stop(struct rtw89_dev *rtwdev);
- #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
- /**
- * read_poll_timeout_atomic - Periodically poll an address until a condition is
- * met or a timeout occurs
- * @op: accessor function (takes @args as its arguments)
- * @val: Variable to read the value into
- * @cond: Break condition (usually involving @val)
- * @delay_us: Time to udelay between reads in us (0 tight-loops). Should
- * be less than ~10us since udelay is used (see
- * Documentation/timers/timers-howto.rst).
- * @timeout_us: Timeout in us, 0 means never timeout
- * @delay_before_read: if it is true, delay @delay_us before read.
- * @args: arguments for @op poll
- *
- * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
- * case, the last read value at @args is stored in @val.
- *
- * When available, you'll probably want to use one of the specialized
- * macros defined below rather than this macro directly.
- */
- #define read_poll_timeout_atomic(op, val, cond, delay_us, timeout_us, \
- delay_before_read, args...) \
- ({ \
- u64 __timeout_us = (timeout_us); \
- unsigned long __delay_us = (delay_us); \
- ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
- if (delay_before_read && __delay_us) \
- udelay(__delay_us); \
- for (;;) { \
- (val) = op(args); \
- if (cond) \
- break; \
- if (__timeout_us && \
- ktime_compare(ktime_get(), __timeout) > 0) { \
- (val) = op(args); \
- break; \
- } \
- if (__delay_us) \
- udelay(__delay_us); \
- } \
- (cond) ? 0 : -ETIMEDOUT; \
- })
- #if defined(CONFIG_SUSE_VERSION)
- #if CONFIG_SUSE_PATCHLEVEL && CONFIG_SUSE_VERSION == 15 && CONFIG_SUSE_PATCHLEVEL == 3
- #define SUSE 1
- #else
- #define SUSE 0
- #endif
- #else
- #define SUSE 0
- #endif
- #endif
- #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
- /* see Documentation/timers/timers-howto.rst for the thresholds */
- static inline void fsleep(unsigned long usecs)
- {
- if (usecs <= 10)
- udelay(usecs);
- else if (usecs <= 20000)
- usleep_range(usecs, 2 * usecs);
- else
- msleep(DIV_ROUND_UP(usecs, 1000));
- }
- #endif
- #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) && (SUSE == 0)
- static inline struct sk_buff *ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw,
- struct ieee80211_txq *txq)
- {
- struct sk_buff *skb;
- local_bh_disable();
- skb = ieee80211_tx_dequeue(hw, txq);
- local_bh_enable();
- return skb;
- }
- #endif
- #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0)
- /**
- * read_poll_timeout_atomic - Periodically poll an address until a condition is
- * met or a timeout occurs
- * @op: accessor function (takes @args as its arguments)
- * @val: Variable to read the value into
- * @cond: Break condition (usually involving @val)
- * @delay_us: Time to udelay between reads in us (0 tight-loops). Should
- * be less than ~10us since udelay is used (see
- * Documentation/timers/timers-howto.rst).
- * @timeout_us: Timeout in us, 0 means never timeout
- * @delay_before_read: if it is true, delay @delay_us before read.
- * @args: arguments for @op poll
- *
- * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
- * case, the last read value at @args is stored in @val.
- *
- * When available, you'll probably want to use one of the specialized
- * macros defined below rather than this macro directly.
- */
- #define read_poll_timeout_atomic(op, val, cond, delay_us, timeout_us, \
- delay_before_read, args...) \
- ({ \
- u64 __timeout_us = (timeout_us); \
- unsigned long __delay_us = (delay_us); \
- ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
- if (delay_before_read && __delay_us) \
- udelay(__delay_us); \
- for (;;) { \
- (val) = op(args); \
- if (cond) \
- break; \
- if (__timeout_us && \
- ktime_compare(ktime_get(), __timeout) > 0) { \
- (val) = op(args); \
- break; \
- } \
- if (__delay_us) \
- udelay(__delay_us); \
- } \
- (cond) ? 0 : -ETIMEDOUT; \
- })
- /**
- * read_poll_timeout - Periodically poll an address until a condition is
- * met or a timeout occurs
- * @op: accessor function (takes @args as its arguments)
- * @val: Variable to read the value into
- * @cond: Break condition (usually involving @val)
- * @sleep_us: Maximum time to sleep between reads in us (0
- * tight-loops). Should be less than ~20ms since usleep_range
- * is used (see Documentation/timers/timers-howto.rst).
- * @timeout_us: Timeout in us, 0 means never timeout
- * @sleep_before_read: if it is true, sleep @sleep_us before read.
- * @args: arguments for @op poll
- *
- * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
- * case, the last read value at @args is stored in @val. Must not
- * be called from atomic context if sleep_us or timeout_us are used.
- *
- * When available, you'll probably want to use one of the specialized
- * macros defined below rather than this macro directly.
- */
- #define read_poll_timeout(op, val, cond, sleep_us, timeout_us, \
- sleep_before_read, args...) \
- ({ \
- u64 __timeout_us = (timeout_us); \
- unsigned long __sleep_us = (sleep_us); \
- ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
- might_sleep_if((__sleep_us) != 0); \
- if (sleep_before_read && __sleep_us) \
- usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
- for (;;) { \
- (val) = op(args); \
- if (cond) \
- break; \
- if (__timeout_us && \
- ktime_compare(ktime_get(), __timeout) > 0) { \
- (val) = op(args); \
- break; \
- } \
- if (__sleep_us) \
- usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
- } \
- (cond) ? 0 : -ETIMEDOUT; \
- })
- #define BSS_CHANGED_HE_BSS_COLOR 1<<29
- #endif
- void rtw89_core_update_beacon_work(struct work_struct *work);
- void rtw89_roc_work(struct work_struct *work);
- void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
- void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
- void rtw89_core_scan_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
- const u8 *mac_addr, bool hw_scan);
- void rtw89_core_scan_complete(struct rtw89_dev *rtwdev,
- struct ieee80211_vif *vif, bool hw_scan);
- void rtw89_reg_6ghz_power_recalc(struct rtw89_dev *rtwdev,
- struct rtw89_vif *rtwvif, bool active);
- void rtw89_core_update_p2p_ps(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif);
- void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev, enum rtw89_btc_hmsg event);
- #endif
|