ipa_utils.c 267 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #include <net/ip.h>
  6. #include <linux/genalloc.h> /* gen_pool_alloc() */
  7. #include <linux/io.h>
  8. #include <linux/ratelimit.h>
  9. #include <linux/interconnect.h>
  10. #include <linux/msm_gsi.h>
  11. #include <linux/elf.h>
  12. #include "ipa_i.h"
  13. #include "ipahal/ipahal.h"
  14. #include "ipahal/ipahal_fltrt.h"
  15. #include "ipahal/ipahal_hw_stats.h"
  16. #include "../ipa_rm_i.h"
  17. /*
  18. * The following for adding code (ie. for EMULATION) not found on x86.
  19. */
  20. #if defined(CONFIG_IPA_EMULATION)
  21. # include "ipa_emulation_stubs.h"
  22. #endif
  23. #define IPA_V3_0_CLK_RATE_SVS2 (37.5 * 1000 * 1000UL)
  24. #define IPA_V3_0_CLK_RATE_SVS (75 * 1000 * 1000UL)
  25. #define IPA_V3_0_CLK_RATE_NOMINAL (150 * 1000 * 1000UL)
  26. #define IPA_V3_0_CLK_RATE_TURBO (200 * 1000 * 1000UL)
  27. #define IPA_V3_5_CLK_RATE_SVS2 (100 * 1000 * 1000UL)
  28. #define IPA_V3_5_CLK_RATE_SVS (200 * 1000 * 1000UL)
  29. #define IPA_V3_5_CLK_RATE_NOMINAL (400 * 1000 * 1000UL)
  30. #define IPA_V3_5_CLK_RATE_TURBO (42640 * 10 * 1000UL)
  31. #define IPA_V4_0_CLK_RATE_SVS2 (60 * 1000 * 1000UL)
  32. #define IPA_V4_0_CLK_RATE_SVS (125 * 1000 * 1000UL)
  33. #define IPA_V4_0_CLK_RATE_NOMINAL (220 * 1000 * 1000UL)
  34. #define IPA_V4_0_CLK_RATE_TURBO (250 * 1000 * 1000UL)
  35. #define IPA_MAX_HOLB_TMR_VAL (4294967296 - 1)
  36. #define IPA_V3_0_BW_THRESHOLD_TURBO_MBPS (1000)
  37. #define IPA_V3_0_BW_THRESHOLD_NOMINAL_MBPS (600)
  38. #define IPA_V3_0_BW_THRESHOLD_SVS_MBPS (310)
  39. #define IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_BMASK 0xFF0000
  40. #define IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_SHFT 0x10
  41. /* Max pipes + ICs for TAG process */
  42. #define IPA_TAG_MAX_DESC (IPA3_MAX_NUM_PIPES + 6)
  43. #define IPA_TAG_SLEEP_MIN_USEC (1000)
  44. #define IPA_TAG_SLEEP_MAX_USEC (2000)
  45. #define IPA_FORCE_CLOSE_TAG_PROCESS_TIMEOUT (10 * HZ)
  46. #define IPA_BCR_REG_VAL_v3_0 (0x00000001)
  47. #define IPA_BCR_REG_VAL_v3_5 (0x0000003B)
  48. #define IPA_BCR_REG_VAL_v4_0 (0x00000039)
  49. #define IPA_BCR_REG_VAL_v4_2 (0x00000000)
  50. #define IPA_AGGR_GRAN_MIN (1)
  51. #define IPA_AGGR_GRAN_MAX (32)
  52. #define IPA_EOT_COAL_GRAN_MIN (1)
  53. #define IPA_EOT_COAL_GRAN_MAX (16)
  54. #define IPA_FILT_ROUT_HASH_REG_VAL_v4_2 (0x00000000)
  55. #define IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC (15)
  56. #define IPA_COAL_CLOSE_FRAME_CMD_TIMEOUT_MSEC (500)
  57. #define IPA_AGGR_BYTE_LIMIT (\
  58. IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_BMSK >> \
  59. IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_SHFT)
  60. #define IPA_AGGR_PKT_LIMIT (\
  61. IPA_ENDP_INIT_AGGR_n_AGGR_PKT_LIMIT_BMSK >> \
  62. IPA_ENDP_INIT_AGGR_n_AGGR_PKT_LIMIT_SHFT)
  63. /* In IPAv3 only endpoints 0-3 can be configured to deaggregation */
  64. #define IPA_EP_SUPPORTS_DEAGGR(idx) ((idx) >= 0 && (idx) <= 3)
  65. #define IPA_TAG_TIMER_TIMESTAMP_SHFT (14) /* ~0.8msec */
  66. #define IPA_NAT_TIMER_TIMESTAMP_SHFT (24) /* ~0.8sec */
  67. /*
  68. * Units of time per a specific granularity
  69. * The limitation based on H/W HOLB/AGGR time limit field width
  70. */
  71. #define IPA_TIMER_SCALED_TIME_LIMIT 31
  72. /* HPS, DPS sequencers Types*/
  73. /* DMA Only */
  74. #define IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY 0x00000000
  75. /* DMA + decipher */
  76. #define IPA_DPS_HPS_SEQ_TYPE_DMA_DEC 0x00000011
  77. /* Packet Processing + no decipher + uCP (for Ethernet Bridging) */
  78. #define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP 0x00000002
  79. /* Packet Processing + decipher + uCP */
  80. #define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_DEC_UCP 0x00000013
  81. /* Packet Processing + no decipher + no uCP */
  82. #define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP 0x00000006
  83. /* Packet Processing + decipher + no uCP */
  84. #define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_DEC_NO_UCP 0x00000017
  85. /* 2 Packet Processing pass + no decipher + uCP */
  86. #define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP 0x00000004
  87. /* 2 Packet Processing pass + decipher + uCP */
  88. #define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP 0x00000015
  89. /* 2 Packet Processing pass + no decipher + uCP + HPS REP DMA Parser. */
  90. #define IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP 0x00000804
  91. /* Packet Processing + no decipher + no uCP + HPS REP DMA Parser.*/
  92. #define IPA_DPS_HPS_REP_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP_DMAP 0x00000806
  93. /* COMP/DECOMP */
  94. #define IPA_DPS_HPS_SEQ_TYPE_DMA_COMP_DECOMP 0x00000020
  95. /* 2 Packet Processing + no decipher + 2 uCP */
  96. #define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_2ND_UCP 0x0000000a
  97. /* 2 Packet Processing + decipher + 2 uCP */
  98. #define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_2ND_UCP 0x0000001b
  99. /* 3 Packet Processing + no decipher + 2 uCP */
  100. #define IPA_DPS_HPS_SEQ_TYPE_3RD_PKT_PROCESS_PASS_NO_DEC_2ND_UCP 0x0000000c
  101. /* 3 Packet Processing + decipher + 2 uCP */
  102. #define IPA_DPS_HPS_SEQ_TYPE_3RD_PKT_PROCESS_PASS_DEC_2ND_UCP 0x0000001d
  103. /* 2 Packet Processing + no decipher + 2 uCP + HPS REP DMA Parser */
  104. #define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_2ND_UCP_DMAP 0x0000080a
  105. /* 3 Packet Processing + no decipher + 2 uCP + HPS REP DMA Parser */
  106. #define IPA_DPS_HPS_SEQ_TYPE_3RD_PKT_PROCESS_PASS_NO_DEC_2ND_UCP_DMAP 0x0000080c
  107. /* Invalid sequencer type */
  108. #define IPA_DPS_HPS_SEQ_TYPE_INVALID 0xFFFFFFFF
  109. #define IPA_DPS_HPS_SEQ_TYPE_IS_DMA(seq_type) \
  110. (seq_type == IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY || \
  111. seq_type == IPA_DPS_HPS_SEQ_TYPE_DMA_DEC || \
  112. seq_type == IPA_DPS_HPS_SEQ_TYPE_DMA_COMP_DECOMP)
  113. /* Resource Group index*/
  114. #define IPA_v3_0_GROUP_UL (0)
  115. #define IPA_v3_0_GROUP_DL (1)
  116. #define IPA_v3_0_GROUP_DPL IPA_v3_0_GROUP_DL
  117. #define IPA_v3_0_GROUP_DIAG (2)
  118. #define IPA_v3_0_GROUP_DMA (3)
  119. #define IPA_v3_0_GROUP_IMM_CMD IPA_v3_0_GROUP_UL
  120. #define IPA_v3_0_GROUP_Q6ZIP (4)
  121. #define IPA_v3_0_GROUP_Q6ZIP_GENERAL IPA_v3_0_GROUP_Q6ZIP
  122. #define IPA_v3_0_GROUP_UC_RX_Q (5)
  123. #define IPA_v3_0_GROUP_Q6ZIP_ENGINE IPA_v3_0_GROUP_UC_RX_Q
  124. #define IPA_v3_0_GROUP_MAX (6)
  125. #define IPA_v3_5_GROUP_LWA_DL (0) /* currently not used */
  126. #define IPA_v3_5_MHI_GROUP_PCIE IPA_v3_5_GROUP_LWA_DL
  127. #define IPA_v3_5_GROUP_UL_DL (1)
  128. #define IPA_v3_5_MHI_GROUP_DDR IPA_v3_5_GROUP_UL_DL
  129. #define IPA_v3_5_MHI_GROUP_DMA (2)
  130. #define IPA_v3_5_GROUP_UC_RX_Q (3) /* currently not used */
  131. #define IPA_v3_5_SRC_GROUP_MAX (4)
  132. #define IPA_v3_5_DST_GROUP_MAX (3)
  133. #define IPA_v4_0_GROUP_LWA_DL (0)
  134. #define IPA_v4_0_MHI_GROUP_PCIE (0)
  135. #define IPA_v4_0_ETHERNET (0)
  136. #define IPA_v4_0_GROUP_UL_DL (1)
  137. #define IPA_v4_0_MHI_GROUP_DDR (1)
  138. #define IPA_v4_0_MHI_GROUP_DMA (2)
  139. #define IPA_v4_0_GROUP_UC_RX_Q (3)
  140. #define IPA_v4_0_SRC_GROUP_MAX (4)
  141. #define IPA_v4_0_DST_GROUP_MAX (4)
  142. #define IPA_v4_2_GROUP_UL_DL (0)
  143. #define IPA_v4_2_SRC_GROUP_MAX (1)
  144. #define IPA_v4_2_DST_GROUP_MAX (1)
  145. #define IPA_v4_5_MHI_GROUP_PCIE (0)
  146. #define IPA_v4_5_GROUP_UL_DL (1)
  147. #define IPA_v4_5_MHI_GROUP_DDR (1)
  148. #define IPA_v4_5_MHI_GROUP_DMA (2)
  149. #define IPA_v4_5_MHI_GROUP_QDSS (3)
  150. #define IPA_v4_5_GROUP_UC_RX_Q (4)
  151. #define IPA_v4_5_SRC_GROUP_MAX (5)
  152. #define IPA_v4_5_DST_GROUP_MAX (5)
  153. #define IPA_v4_7_GROUP_UL_DL (0)
  154. #define IPA_v4_7_SRC_GROUP_MAX (1)
  155. #define IPA_v4_7_DST_GROUP_MAX (1)
  156. #define IPA_v4_9_GROUP_UL_DL (0)
  157. #define IPA_v4_9_SRC_GROUP_MAX (1)
  158. #define IPA_v4_9_DST_GROUP_MAX (1)
  159. #define IPA_GROUP_MAX IPA_v3_0_GROUP_MAX
  160. enum ipa_rsrc_grp_type_src {
  161. IPA_v3_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS,
  162. IPA_v3_0_RSRC_GRP_TYPE_SRC_HDR_SECTORS,
  163. IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI1_BUFFER,
  164. IPA_v3_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS,
  165. IPA_v3_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF,
  166. IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI2_BUFFERS,
  167. IPA_v3_0_RSRC_GRP_TYPE_SRC_HPS_DMARS,
  168. IPA_v3_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES,
  169. IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX,
  170. IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS = 0,
  171. IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS,
  172. IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF,
  173. IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS,
  174. IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES,
  175. IPA_v3_5_RSRC_GRP_TYPE_SRC_MAX,
  176. IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS = 0,
  177. IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS,
  178. IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF,
  179. IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS,
  180. IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES,
  181. IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX
  182. };
  183. #define IPA_RSRC_GRP_TYPE_SRC_MAX IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX
  184. enum ipa_rsrc_grp_type_dst {
  185. IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTORS,
  186. IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTOR_LISTS,
  187. IPA_v3_0_RSRC_GRP_TYPE_DST_DPS_DMARS,
  188. IPA_v3_0_RSRC_GRP_TYPE_DST_MAX,
  189. IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS = 0,
  190. IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS,
  191. IPA_v3_5_RSRC_GRP_TYPE_DST_MAX,
  192. IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS = 0,
  193. IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS,
  194. IPA_v4_0_RSRC_GRP_TYPE_DST_MAX,
  195. };
  196. #define IPA_RSRC_GRP_TYPE_DST_MAX IPA_v3_0_RSRC_GRP_TYPE_DST_MAX
  197. enum ipa_rsrc_grp_type_rx {
  198. IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ,
  199. IPA_RSRC_GRP_TYPE_RX_MAX
  200. };
  201. enum ipa_rsrc_grp_rx_hps_weight_config {
  202. IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG,
  203. IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_MAX
  204. };
  205. struct rsrc_min_max {
  206. u32 min;
  207. u32 max;
  208. };
  209. enum ipa_ver {
  210. IPA_3_0,
  211. IPA_3_5,
  212. IPA_3_5_MHI,
  213. IPA_3_5_1,
  214. IPA_4_0,
  215. IPA_4_0_MHI,
  216. IPA_4_1,
  217. IPA_4_1_APQ,
  218. IPA_4_2,
  219. IPA_4_5,
  220. IPA_4_5_MHI,
  221. IPA_4_5_APQ,
  222. IPA_4_7,
  223. IPA_4_9,
  224. IPA_VER_MAX,
  225. };
  226. static const struct rsrc_min_max ipa3_rsrc_src_grp_config
  227. [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_SRC_MAX][IPA_GROUP_MAX] = {
  228. [IPA_3_0] = {
  229. /* UL DL DIAG DMA Not Used uC Rx */
  230. [IPA_v3_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  231. {3, 255}, {3, 255}, {1, 255}, {1, 255}, {1, 255}, {2, 255} },
  232. [IPA_v3_0_RSRC_GRP_TYPE_SRC_HDR_SECTORS] = {
  233. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
  234. [IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI1_BUFFER] = {
  235. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
  236. [IPA_v3_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  237. {14, 14}, {16, 16}, {5, 5}, {5, 5}, {0, 0}, {8, 8} },
  238. [IPA_v3_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  239. {19, 19}, {26, 26}, {3, 3}, {7, 7}, {0, 0}, {8, 8} },
  240. [IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI2_BUFFERS] = {
  241. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
  242. [IPA_v3_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  243. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
  244. [IPA_v3_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  245. {14, 14}, {16, 16}, {5, 5}, {5, 5}, {0, 0}, {8, 8} },
  246. },
  247. [IPA_3_5] = {
  248. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  249. [IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  250. {0, 0}, {1, 255}, {0, 0}, {1, 255}, {0, 0}, {0, 0} },
  251. [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  252. {0, 0}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  253. [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  254. {0, 0}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  255. [IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  256. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
  257. [IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  258. {0, 0}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
  259. },
  260. [IPA_3_5_MHI] = {
  261. /* PCIE DDR DMA unused, other are invalid */
  262. [IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  263. {4, 4}, {5, 5}, {1, 1}, {0, 0}, {0, 0}, {0, 0} },
  264. [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  265. {10, 10}, {10, 10}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
  266. [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  267. {12, 12}, {12, 12}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
  268. [IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  269. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
  270. [IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  271. {14, 14}, {14, 14}, {14, 14}, {0, 0}, {0, 0}, {0, 0} },
  272. },
  273. [IPA_3_5_1] = {
  274. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  275. [IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  276. {1, 255}, {1, 255}, {0, 0}, {1, 255}, {0, 0}, {0, 0} },
  277. [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  278. {10, 10}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  279. [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  280. {12, 12}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  281. [IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  282. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
  283. [IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  284. {14, 14}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
  285. },
  286. [IPA_4_0] = {
  287. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  288. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  289. {1, 255}, {1, 255}, {0, 0}, {1, 255}, {0, 0}, {0, 0} },
  290. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  291. {10, 10}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  292. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  293. {12, 12}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  294. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  295. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
  296. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  297. {14, 14}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
  298. },
  299. [IPA_4_0_MHI] = {
  300. /* PCIE DDR DMA unused, other are invalid */
  301. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  302. {4, 4}, {5, 5}, {1, 1}, {0, 0}, {0, 0}, {0, 0} },
  303. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  304. {10, 10}, {10, 10}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
  305. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  306. {12, 12}, {12, 12}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
  307. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  308. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
  309. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  310. {14, 14}, {14, 14}, {14, 14}, {0, 0}, {0, 0}, {0, 0} },
  311. },
  312. [IPA_4_1] = {
  313. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  314. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  315. {1, 63}, {1, 63}, {0, 0}, {1, 63}, {0, 0}, {0, 0} },
  316. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  317. {10, 10}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  318. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  319. {12, 12}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
  320. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  321. {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 0}, {0, 0} },
  322. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  323. {14, 14}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
  324. },
  325. [IPA_4_2] = {
  326. /* UL_DL other are invalid */
  327. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  328. {3, 63}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  329. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  330. {3, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  331. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  332. {10, 10}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  333. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  334. {1, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  335. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  336. {5, 5}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  337. },
  338. [IPA_4_5] = {
  339. /* unused UL_DL unused unused UC_RX_Q N/A */
  340. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  341. {0, 0}, {1, 11}, {0, 0}, {0, 0}, {1, 63}, {0, 0} },
  342. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  343. {0, 0}, {14, 14}, {0, 0}, {0, 0}, {3, 3}, {0, 0} },
  344. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  345. {0, 0}, {18, 18}, {0, 0}, {0, 0}, {8, 8}, {0, 0} },
  346. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  347. {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 0} },
  348. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  349. {0, 0}, {24, 24}, {0, 0}, {0, 0}, {8, 8}, {0, 0} },
  350. },
  351. [IPA_4_5_MHI] = {
  352. /* PCIE DDR DMA QDSS unused N/A */
  353. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  354. {3, 8}, {4, 11}, {1, 1}, {1, 1}, {0, 0}, {0, 0} },
  355. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  356. {9, 9}, {12, 12}, {2, 2}, {2, 2}, {0, 0}, {0, 0} },
  357. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  358. {9, 9}, {14, 14}, {4, 4}, {4, 4}, {0, 0}, {0, 0} },
  359. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  360. {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 0} },
  361. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  362. {22, 22}, {16, 16}, {6, 6}, {2, 2}, {0, 0}, {0, 0} },
  363. },
  364. [IPA_4_5_APQ] = {
  365. /* unused UL_DL unused unused UC_RX_Q N/A */
  366. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  367. {0, 0}, {1, 11}, {0, 0}, {0, 0}, {1, 63}, {0, 0} },
  368. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  369. {0, 0}, {14, 14}, {0, 0}, {0, 0}, {3, 3}, {0, 0} },
  370. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  371. {0, 0}, {18, 18}, {0, 0}, {0, 0}, {8, 8}, {0, 0} },
  372. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  373. {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 63}, {0, 0} },
  374. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  375. {0, 0}, {24, 24}, {0, 0}, {0, 0}, {8, 8}, {0, 0} },
  376. },
  377. [IPA_4_7] = {
  378. /* UL_DL other are invalid */
  379. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  380. {8, 8}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  381. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  382. {8, 8}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  383. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  384. {18, 18}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  385. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  386. {2, 2}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  387. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  388. {15, 15}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  389. },
  390. [IPA_4_9] = {
  391. /* UL_DL other are invalid */
  392. [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
  393. {1, 12}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  394. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
  395. {20, 20}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  396. [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
  397. {38, 38}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  398. [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
  399. {0, 4}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  400. [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
  401. {30, 30}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  402. },
  403. };
  404. static const struct rsrc_min_max ipa3_rsrc_dst_grp_config
  405. [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_DST_MAX][IPA_GROUP_MAX] = {
  406. [IPA_3_0] = {
  407. /* UL DL/DPL DIAG DMA Q6zip_gen Q6zip_eng */
  408. [IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  409. {2, 2}, {3, 3}, {0, 0}, {2, 2}, {3, 3}, {3, 3} },
  410. [IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTOR_LISTS] = {
  411. {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
  412. [IPA_v3_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  413. {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {0, 0} },
  414. },
  415. [IPA_3_5] = {
  416. /* unused UL/DL/DPL unused N/A N/A N/A */
  417. [IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  418. {4, 4}, {4, 4}, {3, 3}, {0, 0}, {0, 0}, {0, 0} },
  419. [IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  420. {2, 255}, {1, 255}, {1, 2}, {0, 0}, {0, 0}, {0, 0} },
  421. },
  422. [IPA_3_5_MHI] = {
  423. /* PCIE DDR DMA N/A N/A N/A */
  424. [IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  425. {4, 4}, {4, 4}, {3, 3}, {0, 0}, {0, 0}, {0, 0} },
  426. [IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  427. {2, 255}, {1, 255}, {1, 2}, {0, 0}, {0, 0}, {0, 0} },
  428. },
  429. [IPA_3_5_1] = {
  430. /* LWA_DL UL/DL/DPL unused N/A N/A N/A */
  431. [IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  432. {4, 4}, {4, 4}, {3, 3}, {0, 0}, {0, 0}, {0, 0} },
  433. [IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  434. {2, 255}, {1, 255}, {1, 2}, {0, 0}, {0, 0}, {0, 0} },
  435. },
  436. [IPA_4_0] = {
  437. /* LWA_DL UL/DL/DPL uC, other are invalid */
  438. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  439. {4, 4}, {4, 4}, {3, 3}, {2, 2}, {0, 0}, {0, 0} },
  440. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  441. {2, 255}, {1, 255}, {1, 2}, {0, 2}, {0, 0}, {0, 0} },
  442. },
  443. [IPA_4_0_MHI] = {
  444. /* LWA_DL UL/DL/DPL uC, other are invalid */
  445. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  446. {4, 4}, {4, 4}, {3, 3}, {2, 2}, {0, 0}, {0, 0} },
  447. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  448. {2, 255}, {1, 255}, {1, 2}, {0, 2}, {0, 0}, {0, 0} },
  449. },
  450. [IPA_4_1] = {
  451. /* LWA_DL UL/DL/DPL uC, other are invalid */
  452. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  453. {4, 4}, {4, 4}, {3, 3}, {2, 2}, {0, 0}, {0, 0} },
  454. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  455. {2, 63}, {1, 63}, {1, 2}, {0, 2}, {0, 0}, {0, 0} },
  456. },
  457. [IPA_4_2] = {
  458. /* UL/DL/DPL, other are invalid */
  459. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  460. {3, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  461. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  462. {1, 63}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  463. },
  464. [IPA_4_5] = {
  465. /* unused UL/DL/DPL unused unused uC N/A */
  466. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  467. {0, 0}, {16, 16}, {2, 2}, {2, 2}, {0, 0}, {0, 0} },
  468. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  469. {0, 0}, {2, 63}, {1, 2}, {1, 2}, {0, 2}, {0, 0} },
  470. },
  471. [IPA_4_5_MHI] = {
  472. /* PCIE/DPL DDR DMA/CV2X QDSS uC N/A */
  473. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  474. {16, 16}, {5, 5}, {2, 2}, {2, 2}, {0, 0}, {0, 0} },
  475. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  476. {2, 63}, {1, 63}, {1, 2}, {1, 2}, {0, 2}, {0, 0} },
  477. },
  478. [IPA_4_5_APQ] = {
  479. /* unused UL/DL/DPL unused unused uC N/A */
  480. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  481. {0, 0}, {16, 16}, {2, 2}, {2, 2}, {0, 0}, {0, 0} },
  482. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  483. {0, 0}, {2, 63}, {1, 2}, {1, 2}, {0, 2}, {0, 0} },
  484. },
  485. [IPA_4_7] = {
  486. /* UL/DL/DPL, other are invalid */
  487. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  488. {7, 7}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  489. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  490. {2, 2}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  491. },
  492. [IPA_4_9] = {
  493. /* UL/DL/DPL, other are invalid */
  494. [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
  495. {9, 9}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  496. [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
  497. {2, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  498. },
  499. };
  500. static const struct rsrc_min_max ipa3_rsrc_rx_grp_config
  501. [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_RX_MAX][IPA_GROUP_MAX] = {
  502. [IPA_3_0] = {
  503. /* UL DL DIAG DMA unused uC Rx */
  504. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  505. {16, 16}, {24, 24}, {8, 8}, {8, 8}, {0, 0}, {8, 8} },
  506. },
  507. [IPA_3_5] = {
  508. /* unused UL_DL unused UC_RX_Q N/A N/A */
  509. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  510. {0, 0}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
  511. },
  512. [IPA_3_5_MHI] = {
  513. /* PCIE DDR DMA unused N/A N/A */
  514. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  515. {3, 3}, {7, 7}, {2, 2}, {0, 0}, {0, 0}, {0, 0} },
  516. },
  517. [IPA_3_5_1] = {
  518. /* LWA_DL UL_DL unused UC_RX_Q N/A N/A */
  519. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  520. {3, 3}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
  521. },
  522. [IPA_4_0] = {
  523. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  524. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  525. {3, 3}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
  526. },
  527. [IPA_4_0_MHI] = {
  528. /* PCIE DDR DMA unused N/A N/A */
  529. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  530. {3, 3}, {7, 7}, {2, 2}, {0, 0}, {0, 0}, {0, 0} },
  531. },
  532. [IPA_4_1] = {
  533. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  534. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  535. {3, 3}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
  536. },
  537. [IPA_4_2] = {
  538. /* UL_DL, other are invalid */
  539. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  540. {4, 4}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  541. },
  542. [IPA_4_5] = {
  543. /* unused UL_DL unused unused UC_RX_Q N/A */
  544. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  545. {0, 0}, {3, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  546. },
  547. [IPA_4_5_MHI] = {
  548. /* PCIE DDR DMA QDSS unused N/A */
  549. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  550. {3, 3}, {3, 3}, {3, 3}, {3, 3}, {0, 0}, {0, 0} },
  551. },
  552. [IPA_4_5_APQ] = {
  553. /* unused UL_DL unused unused UC_RX_Q N/A */
  554. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  555. {0, 0}, {3, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  556. },
  557. [IPA_4_7] = {
  558. /* unused UL_DL unused unused UC_RX_Q N/A */
  559. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  560. {3, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  561. },
  562. [IPA_4_9] = {
  563. /* unused UL_DL unused unused UC_RX_Q N/A */
  564. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
  565. {3, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
  566. },
  567. };
  568. static const u32 ipa3_rsrc_rx_grp_hps_weight_config
  569. [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_MAX][IPA_GROUP_MAX] = {
  570. [IPA_3_0] = {
  571. /* UL DL DIAG DMA unused uC Rx */
  572. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 0, 0, 0, 0, 0, 0 },
  573. },
  574. [IPA_3_5] = {
  575. /* unused UL_DL unused UC_RX_Q N/A N/A */
  576. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
  577. },
  578. [IPA_3_5_MHI] = {
  579. /* PCIE DDR DMA unused N/A N/A */
  580. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 3, 5, 1, 1, 0, 0 },
  581. },
  582. [IPA_3_5_1] = {
  583. /* LWA_DL UL_DL unused UC_RX_Q N/A N/A */
  584. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
  585. },
  586. [IPA_4_0] = {
  587. /* LWA_DL UL_DL unused UC_RX_Q N/A */
  588. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
  589. },
  590. [IPA_4_0_MHI] = {
  591. /* PCIE DDR DMA unused N/A N/A */
  592. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 3, 5, 1, 1, 0, 0 },
  593. },
  594. [IPA_4_1] = {
  595. /* LWA_DL UL_DL unused UC_RX_Q, other are invalid */
  596. [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
  597. },
  598. };
  599. enum ipa_ees {
  600. IPA_EE_AP = 0,
  601. IPA_EE_Q6 = 1,
  602. IPA_EE_UC = 2,
  603. };
  604. enum ipa_qmb_instance_type {
  605. IPA_QMB_INSTANCE_DDR = 0,
  606. IPA_QMB_INSTANCE_PCIE = 1,
  607. IPA_QMB_INSTANCE_MAX
  608. };
  609. #define QMB_MASTER_SELECT_DDR IPA_QMB_INSTANCE_DDR
  610. #define QMB_MASTER_SELECT_PCIE IPA_QMB_INSTANCE_PCIE
  611. struct ipa_qmb_outstanding {
  612. u16 ot_reads;
  613. u16 ot_writes;
  614. u16 ot_read_beats;
  615. };
  616. /*TODO: Update correct values of max_read_beats for all targets*/
  617. static const struct ipa_qmb_outstanding ipa3_qmb_outstanding
  618. [IPA_VER_MAX][IPA_QMB_INSTANCE_MAX] = {
  619. [IPA_3_0][IPA_QMB_INSTANCE_DDR] = {8, 8, 0},
  620. [IPA_3_0][IPA_QMB_INSTANCE_PCIE] = {8, 2, 0},
  621. [IPA_3_5][IPA_QMB_INSTANCE_DDR] = {8, 8, 0},
  622. [IPA_3_5][IPA_QMB_INSTANCE_PCIE] = {12, 4, 0},
  623. [IPA_3_5_MHI][IPA_QMB_INSTANCE_DDR] = {8, 8, 0},
  624. [IPA_3_5_MHI][IPA_QMB_INSTANCE_PCIE] = {12, 4, 0},
  625. [IPA_3_5_1][IPA_QMB_INSTANCE_DDR] = {8, 8, 0},
  626. [IPA_3_5_1][IPA_QMB_INSTANCE_PCIE] = {12, 4, 0},
  627. [IPA_4_0][IPA_QMB_INSTANCE_DDR] = {12, 8, 120},
  628. [IPA_4_0][IPA_QMB_INSTANCE_PCIE] = {12, 4, 0},
  629. [IPA_4_0_MHI][IPA_QMB_INSTANCE_DDR] = {12, 8, 0},
  630. [IPA_4_0_MHI][IPA_QMB_INSTANCE_PCIE] = {12, 4, 0},
  631. [IPA_4_1][IPA_QMB_INSTANCE_DDR] = {12, 8, 120},
  632. [IPA_4_1][IPA_QMB_INSTANCE_PCIE] = {12, 4, 0},
  633. [IPA_4_2][IPA_QMB_INSTANCE_DDR] = {12, 8, 0},
  634. [IPA_4_5][IPA_QMB_INSTANCE_DDR] = {16, 8, 120},
  635. [IPA_4_5][IPA_QMB_INSTANCE_PCIE] = {12, 8, 0},
  636. [IPA_4_5_MHI][IPA_QMB_INSTANCE_DDR] = {16, 8, 120},
  637. [IPA_4_5_MHI][IPA_QMB_INSTANCE_PCIE] = {12, 8, 0},
  638. [IPA_4_5_APQ][IPA_QMB_INSTANCE_DDR] = {16, 8, 120},
  639. [IPA_4_5_APQ][IPA_QMB_INSTANCE_PCIE] = {12, 8, 0},
  640. [IPA_4_7][IPA_QMB_INSTANCE_DDR] = {13, 12, 120},
  641. [IPA_4_9][IPA_QMB_INSTANCE_DDR] = {16, 8, 120},
  642. };
  643. struct ipa_ep_configuration {
  644. bool valid;
  645. int group_num;
  646. bool support_flt;
  647. int sequencer_type;
  648. u8 qmb_master_sel;
  649. struct ipa_gsi_ep_config ipa_gsi_ep_info;
  650. };
  651. /* clients not included in the list below are considered as invalid */
  652. static const struct ipa_ep_configuration ipa3_ep_mapping
  653. [IPA_VER_MAX][IPA_CLIENT_MAX] = {
  654. [IPA_3_0][IPA_CLIENT_WLAN1_PROD] = {
  655. true, IPA_v3_0_GROUP_UL, true,
  656. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  657. QMB_MASTER_SELECT_DDR,
  658. { 10, 1, 8, 16, IPA_EE_UC } },
  659. [IPA_3_0][IPA_CLIENT_USB_PROD] = {
  660. true, IPA_v3_0_GROUP_UL, true,
  661. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  662. QMB_MASTER_SELECT_DDR,
  663. { 1, 3, 8, 16, IPA_EE_AP } },
  664. [IPA_3_0][IPA_CLIENT_APPS_LAN_PROD] = {
  665. true, IPA_v3_0_GROUP_DL, false,
  666. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  667. QMB_MASTER_SELECT_DDR,
  668. { 14, 11, 8, 16, IPA_EE_AP } },
  669. [IPA_3_0][IPA_CLIENT_APPS_WAN_PROD] = {
  670. true, IPA_v3_0_GROUP_UL, true,
  671. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  672. QMB_MASTER_SELECT_DDR,
  673. { 3, 5, 16, 32, IPA_EE_AP } },
  674. [IPA_3_0][IPA_CLIENT_APPS_CMD_PROD] = {
  675. true, IPA_v3_0_GROUP_IMM_CMD, false,
  676. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  677. QMB_MASTER_SELECT_DDR,
  678. { 22, 6, 18, 28, IPA_EE_AP } },
  679. [IPA_3_0][IPA_CLIENT_ODU_PROD] = {
  680. true, IPA_v3_0_GROUP_UL, true,
  681. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  682. QMB_MASTER_SELECT_DDR,
  683. { 12, 9, 8, 16, IPA_EE_AP } },
  684. [IPA_3_0][IPA_CLIENT_MHI_PROD] = {
  685. true, IPA_v3_0_GROUP_UL, true,
  686. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  687. QMB_MASTER_SELECT_PCIE,
  688. { 0, 0, 8, 16, IPA_EE_AP } },
  689. [IPA_3_0][IPA_CLIENT_Q6_LAN_PROD] = {
  690. true, IPA_v3_0_GROUP_UL, false,
  691. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  692. QMB_MASTER_SELECT_DDR,
  693. { 9, 4, 8, 12, IPA_EE_Q6 } },
  694. [IPA_3_0][IPA_CLIENT_Q6_WAN_PROD] = {
  695. true, IPA_v3_0_GROUP_DL, true,
  696. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  697. QMB_MASTER_SELECT_DDR,
  698. { 5, 0, 16, 32, IPA_EE_Q6 } },
  699. [IPA_3_0][IPA_CLIENT_Q6_CMD_PROD] = {
  700. true, IPA_v3_0_GROUP_IMM_CMD, false,
  701. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  702. QMB_MASTER_SELECT_DDR,
  703. { 6, 1, 18, 28, IPA_EE_Q6 } },
  704. [IPA_3_0][IPA_CLIENT_Q6_DECOMP_PROD] = {
  705. true, IPA_v3_0_GROUP_Q6ZIP,
  706. false, IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  707. QMB_MASTER_SELECT_DDR,
  708. { 7, 2, 0, 0, IPA_EE_Q6 } },
  709. [IPA_3_0][IPA_CLIENT_Q6_DECOMP2_PROD] = {
  710. true, IPA_v3_0_GROUP_Q6ZIP,
  711. false, IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  712. QMB_MASTER_SELECT_DDR,
  713. { 8, 3, 0, 0, IPA_EE_Q6 } },
  714. [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
  715. true, IPA_v3_0_GROUP_DMA, false,
  716. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  717. QMB_MASTER_SELECT_PCIE,
  718. { 12, 9, 8, 16, IPA_EE_AP } },
  719. [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
  720. true, IPA_v3_0_GROUP_DMA, false,
  721. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  722. QMB_MASTER_SELECT_PCIE,
  723. { 13, 10, 8, 16, IPA_EE_AP } },
  724. [IPA_3_0][IPA_CLIENT_ETHERNET_PROD] = {
  725. true, IPA_v3_0_GROUP_UL, true,
  726. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  727. QMB_MASTER_SELECT_DDR,
  728. {2, 0, 8, 16, IPA_EE_UC} },
  729. /* Only for test purpose */
  730. [IPA_3_0][IPA_CLIENT_TEST_PROD] = {
  731. true, IPA_v3_0_GROUP_UL, true,
  732. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  733. QMB_MASTER_SELECT_DDR,
  734. { 1, 3, 8, 16, IPA_EE_AP } },
  735. [IPA_3_0][IPA_CLIENT_TEST1_PROD] = {
  736. true, IPA_v3_0_GROUP_UL, true,
  737. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  738. QMB_MASTER_SELECT_DDR,
  739. { 1, 3, 8, 16, IPA_EE_AP } },
  740. [IPA_3_0][IPA_CLIENT_TEST2_PROD] = {
  741. true, IPA_v3_0_GROUP_UL, true,
  742. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  743. QMB_MASTER_SELECT_DDR,
  744. { 3, 5, 16, 32, IPA_EE_AP } },
  745. [IPA_3_0][IPA_CLIENT_TEST3_PROD] = {
  746. true, IPA_v3_0_GROUP_UL, true,
  747. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  748. QMB_MASTER_SELECT_DDR,
  749. { 12, 9, 8, 16, IPA_EE_AP } },
  750. [IPA_3_0][IPA_CLIENT_TEST4_PROD] = {
  751. true, IPA_v3_0_GROUP_UL, true,
  752. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  753. QMB_MASTER_SELECT_DDR,
  754. { 13, 10, 8, 16, IPA_EE_AP } },
  755. [IPA_3_0][IPA_CLIENT_WLAN1_CONS] = {
  756. true, IPA_v3_0_GROUP_DL, false,
  757. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  758. QMB_MASTER_SELECT_DDR,
  759. { 25, 4, 8, 8, IPA_EE_UC } },
  760. [IPA_3_0][IPA_CLIENT_WLAN2_CONS] = {
  761. true, IPA_v3_0_GROUP_DL, false,
  762. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  763. QMB_MASTER_SELECT_DDR,
  764. { 27, 4, 8, 8, IPA_EE_AP } },
  765. [IPA_3_0][IPA_CLIENT_WLAN3_CONS] = {
  766. true, IPA_v3_0_GROUP_DL, false,
  767. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  768. QMB_MASTER_SELECT_DDR,
  769. { 28, 13, 8, 8, IPA_EE_AP } },
  770. [IPA_3_0][IPA_CLIENT_WLAN4_CONS] = {
  771. true, IPA_v3_0_GROUP_DL, false,
  772. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  773. QMB_MASTER_SELECT_DDR,
  774. { 29, 14, 8, 8, IPA_EE_AP } },
  775. [IPA_3_0][IPA_CLIENT_USB_CONS] = {
  776. true, IPA_v3_0_GROUP_DL, false,
  777. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  778. QMB_MASTER_SELECT_DDR,
  779. { 26, 12, 8, 8, IPA_EE_AP } },
  780. [IPA_3_0][IPA_CLIENT_USB_DPL_CONS] = {
  781. true, IPA_v3_0_GROUP_DPL, false,
  782. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  783. QMB_MASTER_SELECT_DDR,
  784. { 17, 2, 8, 12, IPA_EE_AP } },
  785. [IPA_3_0][IPA_CLIENT_APPS_LAN_CONS] = {
  786. true, IPA_v3_0_GROUP_UL, false,
  787. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  788. QMB_MASTER_SELECT_DDR,
  789. { 15, 7, 8, 12, IPA_EE_AP } },
  790. [IPA_3_0][IPA_CLIENT_APPS_WAN_CONS] = {
  791. true, IPA_v3_0_GROUP_DL, false,
  792. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  793. QMB_MASTER_SELECT_DDR,
  794. { 16, 8, 8, 12, IPA_EE_AP } },
  795. [IPA_3_0][IPA_CLIENT_ODU_EMB_CONS] = {
  796. true, IPA_v3_0_GROUP_DL, false,
  797. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  798. QMB_MASTER_SELECT_DDR,
  799. { 23, 1, 8, 8, IPA_EE_AP } },
  800. [IPA_3_0][IPA_CLIENT_MHI_CONS] = {
  801. true, IPA_v3_0_GROUP_DL, false,
  802. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  803. QMB_MASTER_SELECT_PCIE,
  804. { 23, 1, 8, 8, IPA_EE_AP } },
  805. [IPA_3_0][IPA_CLIENT_Q6_LAN_CONS] = {
  806. true, IPA_v3_0_GROUP_DL, false,
  807. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  808. QMB_MASTER_SELECT_DDR,
  809. { 19, 6, 8, 12, IPA_EE_Q6 } },
  810. [IPA_3_0][IPA_CLIENT_Q6_WAN_CONS] = {
  811. true, IPA_v3_0_GROUP_UL, false,
  812. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  813. QMB_MASTER_SELECT_DDR,
  814. { 18, 5, 8, 12, IPA_EE_Q6 } },
  815. [IPA_3_0][IPA_CLIENT_Q6_DUN_CONS] = {
  816. true, IPA_v3_0_GROUP_DIAG, false,
  817. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  818. QMB_MASTER_SELECT_DDR,
  819. { 30, 7, 4, 4, IPA_EE_Q6 } },
  820. [IPA_3_0][IPA_CLIENT_Q6_DECOMP_CONS] = {
  821. true, IPA_v3_0_GROUP_Q6ZIP, false,
  822. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  823. QMB_MASTER_SELECT_DDR,
  824. { 21, 8, 4, 4, IPA_EE_Q6 } },
  825. [IPA_3_0][IPA_CLIENT_Q6_DECOMP2_CONS] = {
  826. true, IPA_v3_0_GROUP_Q6ZIP, false,
  827. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  828. QMB_MASTER_SELECT_DDR,
  829. { 4, 9, 4, 4, IPA_EE_Q6 } },
  830. [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
  831. true, IPA_v3_0_GROUP_DMA, false,
  832. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  833. QMB_MASTER_SELECT_PCIE,
  834. { 28, 13, 8, 8, IPA_EE_AP } },
  835. [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
  836. true, IPA_v3_0_GROUP_DMA, false,
  837. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  838. QMB_MASTER_SELECT_PCIE,
  839. { 29, 14, 8, 8, IPA_EE_AP } },
  840. [IPA_3_0][IPA_CLIENT_ETHERNET_CONS] = {
  841. true, IPA_v3_0_GROUP_DL, false,
  842. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  843. QMB_MASTER_SELECT_DDR,
  844. {24, 3, 8, 8, IPA_EE_UC} },
  845. /* Only for test purpose */
  846. [IPA_3_0][IPA_CLIENT_TEST_CONS] = {
  847. true, IPA_v3_0_GROUP_DL, false,
  848. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  849. QMB_MASTER_SELECT_DDR,
  850. { 26, 12, 8, 8, IPA_EE_AP } },
  851. [IPA_3_0][IPA_CLIENT_TEST1_CONS] = {
  852. true, IPA_v3_0_GROUP_DL, false,
  853. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  854. QMB_MASTER_SELECT_DDR,
  855. { 26, 12, 8, 8, IPA_EE_AP } },
  856. [IPA_3_0][IPA_CLIENT_TEST2_CONS] = {
  857. true, IPA_v3_0_GROUP_DL, false,
  858. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  859. QMB_MASTER_SELECT_DDR,
  860. { 27, 4, 8, 8, IPA_EE_AP } },
  861. [IPA_3_0][IPA_CLIENT_TEST3_CONS] = {
  862. true, IPA_v3_0_GROUP_DL, false,
  863. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  864. QMB_MASTER_SELECT_DDR,
  865. { 28, 13, 8, 8, IPA_EE_AP } },
  866. [IPA_3_0][IPA_CLIENT_TEST4_CONS] = {
  867. true, IPA_v3_0_GROUP_DL, false,
  868. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  869. QMB_MASTER_SELECT_DDR,
  870. { 29, 14, 8, 8, IPA_EE_AP } },
  871. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  872. [IPA_3_0][IPA_CLIENT_DUMMY_CONS] = {
  873. true, IPA_v3_0_GROUP_DL, false,
  874. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  875. QMB_MASTER_SELECT_DDR,
  876. { 31, 31, 8, 8, IPA_EE_AP } },
  877. /* IPA_3_5 */
  878. [IPA_3_5][IPA_CLIENT_WLAN1_PROD] = {
  879. true, IPA_v3_5_GROUP_UL_DL, true,
  880. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  881. QMB_MASTER_SELECT_DDR,
  882. { 6, 1, 8, 16, IPA_EE_UC } },
  883. [IPA_3_5][IPA_CLIENT_USB_PROD] = {
  884. true, IPA_v3_5_GROUP_UL_DL, true,
  885. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  886. QMB_MASTER_SELECT_DDR,
  887. { 0, 7, 8, 16, IPA_EE_AP } },
  888. [IPA_3_5][IPA_CLIENT_APPS_LAN_PROD] = {
  889. true, IPA_v3_5_GROUP_UL_DL, false,
  890. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  891. QMB_MASTER_SELECT_DDR,
  892. { 8, 9, 8, 16, IPA_EE_AP } },
  893. [IPA_3_5][IPA_CLIENT_APPS_WAN_PROD] = {
  894. true, IPA_v3_5_GROUP_UL_DL, true,
  895. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  896. QMB_MASTER_SELECT_DDR,
  897. { 2, 3, 16, 32, IPA_EE_AP } },
  898. [IPA_3_5][IPA_CLIENT_APPS_CMD_PROD] = {
  899. true, IPA_v3_5_GROUP_UL_DL, false,
  900. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  901. QMB_MASTER_SELECT_DDR,
  902. { 5, 4, 20, 23, IPA_EE_AP } },
  903. [IPA_3_5][IPA_CLIENT_ODU_PROD] = {
  904. true, IPA_v3_5_GROUP_UL_DL, true,
  905. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  906. QMB_MASTER_SELECT_DDR,
  907. { 1, 0, 8, 16, IPA_EE_UC } },
  908. [IPA_3_5][IPA_CLIENT_Q6_LAN_PROD] = {
  909. true, IPA_v3_5_GROUP_UL_DL, true,
  910. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  911. QMB_MASTER_SELECT_DDR,
  912. { 3, 0, 16, 32, IPA_EE_Q6 } },
  913. [IPA_3_5][IPA_CLIENT_Q6_CMD_PROD] = {
  914. true, IPA_v3_5_GROUP_UL_DL, false,
  915. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  916. QMB_MASTER_SELECT_DDR,
  917. { 4, 1, 20, 23, IPA_EE_Q6 } },
  918. /* Only for test purpose */
  919. [IPA_3_5][IPA_CLIENT_TEST_PROD] = {
  920. true, IPA_v3_5_GROUP_UL_DL, true,
  921. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  922. QMB_MASTER_SELECT_DDR,
  923. {0, 7, 8, 16, IPA_EE_AP } },
  924. [IPA_3_5][IPA_CLIENT_TEST1_PROD] = {
  925. true, IPA_v3_5_GROUP_UL_DL, true,
  926. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  927. QMB_MASTER_SELECT_DDR,
  928. {0, 7, 8, 16, IPA_EE_AP } },
  929. [IPA_3_5][IPA_CLIENT_TEST2_PROD] = {
  930. true, IPA_v3_5_GROUP_UL_DL, true,
  931. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  932. QMB_MASTER_SELECT_DDR,
  933. { 1, 0, 8, 16, IPA_EE_AP } },
  934. [IPA_3_5][IPA_CLIENT_TEST3_PROD] = {
  935. true, IPA_v3_5_GROUP_UL_DL, true,
  936. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  937. QMB_MASTER_SELECT_DDR,
  938. {7, 8, 8, 16, IPA_EE_AP } },
  939. [IPA_3_5][IPA_CLIENT_TEST4_PROD] = {
  940. true, IPA_v3_5_GROUP_UL_DL, true,
  941. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  942. QMB_MASTER_SELECT_DDR,
  943. { 8, 9, 8, 16, IPA_EE_AP } },
  944. [IPA_3_5][IPA_CLIENT_WLAN1_CONS] = {
  945. true, IPA_v3_5_GROUP_UL_DL, false,
  946. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  947. QMB_MASTER_SELECT_DDR,
  948. { 16, 3, 8, 8, IPA_EE_UC } },
  949. [IPA_3_5][IPA_CLIENT_WLAN2_CONS] = {
  950. true, IPA_v3_5_GROUP_UL_DL, false,
  951. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  952. QMB_MASTER_SELECT_DDR,
  953. { 18, 12, 8, 8, IPA_EE_AP } },
  954. [IPA_3_5][IPA_CLIENT_WLAN3_CONS] = {
  955. true, IPA_v3_5_GROUP_UL_DL, false,
  956. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  957. QMB_MASTER_SELECT_DDR,
  958. { 19, 13, 8, 8, IPA_EE_AP } },
  959. [IPA_3_5][IPA_CLIENT_USB_CONS] = {
  960. true, IPA_v3_5_GROUP_UL_DL, false,
  961. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  962. QMB_MASTER_SELECT_PCIE,
  963. { 17, 11, 8, 8, IPA_EE_AP } },
  964. [IPA_3_5][IPA_CLIENT_USB_DPL_CONS] = {
  965. true, IPA_v3_5_GROUP_UL_DL, false,
  966. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  967. QMB_MASTER_SELECT_DDR,
  968. { 14, 10, 4, 6, IPA_EE_AP } },
  969. [IPA_3_5][IPA_CLIENT_APPS_LAN_CONS] = {
  970. true, IPA_v3_5_GROUP_UL_DL, false,
  971. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  972. QMB_MASTER_SELECT_DDR,
  973. { 9, 5, 8, 12, IPA_EE_AP } },
  974. [IPA_3_5][IPA_CLIENT_APPS_WAN_CONS] = {
  975. true, IPA_v3_5_GROUP_UL_DL, false,
  976. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  977. QMB_MASTER_SELECT_DDR,
  978. { 10, 6, 8, 12, IPA_EE_AP } },
  979. [IPA_3_5][IPA_CLIENT_ODU_EMB_CONS] = {
  980. true, IPA_v3_5_GROUP_UL_DL, false,
  981. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  982. QMB_MASTER_SELECT_DDR,
  983. { 15, 1, 8, 8, IPA_EE_AP } },
  984. [IPA_3_5][IPA_CLIENT_Q6_LAN_CONS] = {
  985. true, IPA_v3_5_GROUP_UL_DL, false,
  986. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  987. QMB_MASTER_SELECT_DDR,
  988. { 13, 3, 8, 12, IPA_EE_Q6 } },
  989. [IPA_3_5][IPA_CLIENT_Q6_WAN_CONS] = {
  990. true, IPA_v3_5_GROUP_UL_DL, false,
  991. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  992. QMB_MASTER_SELECT_DDR,
  993. { 12, 2, 8, 12, IPA_EE_Q6 } },
  994. /* Only for test purpose */
  995. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  996. [IPA_3_5][IPA_CLIENT_TEST_CONS] = {
  997. true, IPA_v3_5_GROUP_UL_DL, false,
  998. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  999. QMB_MASTER_SELECT_PCIE,
  1000. { 15, 1, 8, 8, IPA_EE_AP } },
  1001. [IPA_3_5][IPA_CLIENT_TEST1_CONS] = {
  1002. true, IPA_v3_5_GROUP_UL_DL, false,
  1003. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1004. QMB_MASTER_SELECT_DDR,
  1005. { 15, 1, 8, 8, IPA_EE_AP } },
  1006. [IPA_3_5][IPA_CLIENT_TEST2_CONS] = {
  1007. true, IPA_v3_5_GROUP_UL_DL, false,
  1008. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1009. QMB_MASTER_SELECT_PCIE,
  1010. { 17, 11, 8, 8, IPA_EE_AP } },
  1011. [IPA_3_5][IPA_CLIENT_TEST3_CONS] = {
  1012. true, IPA_v3_5_GROUP_UL_DL, false,
  1013. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1014. QMB_MASTER_SELECT_DDR,
  1015. { 18, 12, 8, 8, IPA_EE_AP } },
  1016. [IPA_3_5][IPA_CLIENT_TEST4_CONS] = {
  1017. true, IPA_v3_5_GROUP_UL_DL, false,
  1018. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1019. QMB_MASTER_SELECT_PCIE,
  1020. { 19, 13, 8, 8, IPA_EE_AP } },
  1021. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  1022. [IPA_3_5][IPA_CLIENT_DUMMY_CONS] = {
  1023. true, IPA_v3_5_GROUP_UL_DL, false,
  1024. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1025. QMB_MASTER_SELECT_PCIE,
  1026. { 31, 31, 8, 8, IPA_EE_AP } },
  1027. /* IPA_3_5_MHI */
  1028. [IPA_3_5_MHI][IPA_CLIENT_USB_PROD] = {
  1029. false, IPA_EP_NOT_ALLOCATED, false,
  1030. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1031. QMB_MASTER_SELECT_DDR,
  1032. { -1, -1, -1, -1, -1 } },
  1033. [IPA_3_5_MHI][IPA_CLIENT_APPS_WAN_PROD] = {
  1034. true, IPA_v3_5_MHI_GROUP_DDR, true,
  1035. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1036. QMB_MASTER_SELECT_DDR,
  1037. { 2, 3, 16, 32, IPA_EE_AP } },
  1038. [IPA_3_5_MHI][IPA_CLIENT_APPS_CMD_PROD] = {
  1039. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1040. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1041. QMB_MASTER_SELECT_DDR,
  1042. { 5, 4, 20, 23, IPA_EE_AP } },
  1043. [IPA_3_5_MHI][IPA_CLIENT_MHI_PROD] = {
  1044. true, IPA_v3_5_MHI_GROUP_PCIE, true,
  1045. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1046. QMB_MASTER_SELECT_PCIE,
  1047. { 1, 0, 8, 16, IPA_EE_AP } },
  1048. [IPA_3_5_MHI][IPA_CLIENT_Q6_LAN_PROD] = {
  1049. true, IPA_v3_5_MHI_GROUP_DDR, true,
  1050. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1051. QMB_MASTER_SELECT_DDR,
  1052. { 3, 0, 16, 32, IPA_EE_Q6 } },
  1053. [IPA_3_5_MHI][IPA_CLIENT_Q6_WAN_PROD] = {
  1054. true, IPA_v3_5_MHI_GROUP_DDR, true,
  1055. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1056. QMB_MASTER_SELECT_DDR,
  1057. { 6, 4, 10, 30, IPA_EE_Q6 } },
  1058. [IPA_3_5_MHI][IPA_CLIENT_Q6_CMD_PROD] = {
  1059. true, IPA_v3_5_MHI_GROUP_PCIE, false,
  1060. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1061. QMB_MASTER_SELECT_DDR,
  1062. { 4, 1, 20, 23, IPA_EE_Q6 } },
  1063. [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
  1064. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1065. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1066. QMB_MASTER_SELECT_DDR,
  1067. { 7, 8, 8, 16, IPA_EE_AP } },
  1068. [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
  1069. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1070. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1071. QMB_MASTER_SELECT_DDR,
  1072. { 8, 9, 8, 16, IPA_EE_AP } },
  1073. /* Only for test purpose */
  1074. [IPA_3_5_MHI][IPA_CLIENT_TEST_PROD] = {
  1075. true, IPA_v3_5_MHI_GROUP_DDR, true,
  1076. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1077. QMB_MASTER_SELECT_DDR,
  1078. {0, 7, 8, 16, IPA_EE_AP } },
  1079. [IPA_3_5_MHI][IPA_CLIENT_TEST1_PROD] = {
  1080. 0, IPA_v3_5_MHI_GROUP_DDR, true,
  1081. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1082. QMB_MASTER_SELECT_DDR,
  1083. {0, 7, 8, 16, IPA_EE_AP } },
  1084. [IPA_3_5_MHI][IPA_CLIENT_TEST2_PROD] = {
  1085. true, IPA_v3_5_MHI_GROUP_PCIE, true,
  1086. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1087. QMB_MASTER_SELECT_PCIE,
  1088. { 1, 0, 8, 16, IPA_EE_AP } },
  1089. [IPA_3_5_MHI][IPA_CLIENT_TEST3_PROD] = {
  1090. true, IPA_v3_5_MHI_GROUP_DMA, true,
  1091. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1092. QMB_MASTER_SELECT_DDR,
  1093. { 7, 8, 8, 16, IPA_EE_AP } },
  1094. [IPA_3_5_MHI][IPA_CLIENT_TEST4_PROD] = {
  1095. true, IPA_v3_5_MHI_GROUP_DMA, true,
  1096. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1097. QMB_MASTER_SELECT_DDR,
  1098. { 8, 9, 8, 16, IPA_EE_AP } },
  1099. [IPA_3_5_MHI][IPA_CLIENT_WLAN1_CONS] = {
  1100. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1101. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1102. QMB_MASTER_SELECT_DDR,
  1103. { 16, 3, 8, 8, IPA_EE_UC } },
  1104. [IPA_3_5_MHI][IPA_CLIENT_USB_CONS] = {
  1105. false, IPA_EP_NOT_ALLOCATED, false,
  1106. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1107. QMB_MASTER_SELECT_DDR,
  1108. { -1, -1, -1, -1, -1 } },
  1109. [IPA_3_5_MHI][IPA_CLIENT_USB_DPL_CONS] = {
  1110. false, IPA_EP_NOT_ALLOCATED, false,
  1111. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1112. QMB_MASTER_SELECT_DDR,
  1113. { -1, -1, -1, -1, -1 } },
  1114. [IPA_3_5_MHI][IPA_CLIENT_APPS_LAN_CONS] = {
  1115. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1116. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1117. QMB_MASTER_SELECT_DDR,
  1118. { 9, 5, 8, 12, IPA_EE_AP } },
  1119. [IPA_3_5_MHI][IPA_CLIENT_APPS_WAN_CONS] = {
  1120. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1121. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1122. QMB_MASTER_SELECT_DDR,
  1123. { 10, 6, 8, 12, IPA_EE_AP } },
  1124. [IPA_3_5_MHI][IPA_CLIENT_MHI_CONS] = {
  1125. true, IPA_v3_5_MHI_GROUP_PCIE, false,
  1126. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1127. QMB_MASTER_SELECT_PCIE,
  1128. { 15, 1, 8, 8, IPA_EE_AP } },
  1129. [IPA_3_5_MHI][IPA_CLIENT_Q6_LAN_CONS] = {
  1130. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1131. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1132. QMB_MASTER_SELECT_DDR,
  1133. { 13, 3, 8, 12, IPA_EE_Q6 } },
  1134. [IPA_3_5_MHI][IPA_CLIENT_Q6_WAN_CONS] = {
  1135. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1136. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1137. QMB_MASTER_SELECT_DDR,
  1138. { 12, 2, 8, 12, IPA_EE_Q6 } },
  1139. [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
  1140. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1141. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1142. QMB_MASTER_SELECT_PCIE,
  1143. { 18, 12, 8, 8, IPA_EE_AP } },
  1144. [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
  1145. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1146. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1147. QMB_MASTER_SELECT_PCIE,
  1148. { 19, 13, 8, 8, IPA_EE_AP } },
  1149. /* Only for test purpose */
  1150. [IPA_3_5_MHI][IPA_CLIENT_TEST_CONS] = {
  1151. true, IPA_v3_5_MHI_GROUP_PCIE, false,
  1152. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1153. QMB_MASTER_SELECT_PCIE,
  1154. { 15, 1, 8, 8, IPA_EE_AP } },
  1155. [IPA_3_5_MHI][IPA_CLIENT_TEST1_CONS] = {
  1156. true, IPA_v3_5_MHI_GROUP_PCIE, false,
  1157. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1158. QMB_MASTER_SELECT_PCIE,
  1159. { 15, 1, 8, 8, IPA_EE_AP } },
  1160. [IPA_3_5_MHI][IPA_CLIENT_TEST2_CONS] = {
  1161. true, IPA_v3_5_MHI_GROUP_DDR, false,
  1162. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1163. QMB_MASTER_SELECT_DDR,
  1164. { 17, 11, 8, 8, IPA_EE_AP } },
  1165. [IPA_3_5_MHI][IPA_CLIENT_TEST3_CONS] = {
  1166. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1167. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1168. QMB_MASTER_SELECT_PCIE,
  1169. { 18, 12, 8, 8, IPA_EE_AP } },
  1170. [IPA_3_5_MHI][IPA_CLIENT_TEST4_CONS] = {
  1171. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1172. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1173. QMB_MASTER_SELECT_PCIE,
  1174. { 19, 13, 8, 8, IPA_EE_AP } },
  1175. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  1176. [IPA_3_5_MHI][IPA_CLIENT_DUMMY_CONS] = {
  1177. true, IPA_v3_5_MHI_GROUP_DMA, false,
  1178. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1179. QMB_MASTER_SELECT_PCIE,
  1180. { 31, 31, 8, 8, IPA_EE_AP } },
  1181. /* IPA_3_5_1 */
  1182. [IPA_3_5_1][IPA_CLIENT_WLAN1_PROD] = {
  1183. true, IPA_v3_5_GROUP_UL_DL, true,
  1184. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1185. QMB_MASTER_SELECT_DDR,
  1186. { 7, 1, 8, 16, IPA_EE_UC } },
  1187. [IPA_3_5_1][IPA_CLIENT_USB_PROD] = {
  1188. true, IPA_v3_5_GROUP_UL_DL, true,
  1189. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1190. QMB_MASTER_SELECT_DDR,
  1191. { 0, 0, 8, 16, IPA_EE_AP } },
  1192. [IPA_3_5_1][IPA_CLIENT_APPS_LAN_PROD] = {
  1193. true, IPA_v3_5_GROUP_UL_DL, false,
  1194. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1195. QMB_MASTER_SELECT_DDR,
  1196. { 8, 7, 8, 16, IPA_EE_AP } },
  1197. [IPA_3_5_1][IPA_CLIENT_APPS_WAN_PROD] = {
  1198. true, IPA_v3_5_GROUP_UL_DL, true,
  1199. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1200. QMB_MASTER_SELECT_DDR,
  1201. { 2, 3, 16, 32, IPA_EE_AP } },
  1202. [IPA_3_5_1][IPA_CLIENT_APPS_CMD_PROD] = {
  1203. true, IPA_v3_5_GROUP_UL_DL, false,
  1204. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1205. QMB_MASTER_SELECT_DDR,
  1206. { 5, 4, 20, 23, IPA_EE_AP } },
  1207. [IPA_3_5_1][IPA_CLIENT_Q6_LAN_PROD] = {
  1208. true, IPA_v3_5_GROUP_UL_DL, true,
  1209. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1210. QMB_MASTER_SELECT_DDR,
  1211. { 3, 0, 16, 32, IPA_EE_Q6 } },
  1212. [IPA_3_5_1][IPA_CLIENT_Q6_WAN_PROD] = {
  1213. true, IPA_v3_5_GROUP_UL_DL, true,
  1214. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1215. QMB_MASTER_SELECT_DDR,
  1216. { 6, 4, 12, 30, IPA_EE_Q6 } },
  1217. [IPA_3_5_1][IPA_CLIENT_Q6_CMD_PROD] = {
  1218. true, IPA_v3_5_GROUP_UL_DL, false,
  1219. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1220. QMB_MASTER_SELECT_DDR,
  1221. { 4, 1, 20, 23, IPA_EE_Q6 } },
  1222. /* Only for test purpose */
  1223. [IPA_3_5_1][IPA_CLIENT_TEST_PROD] = {
  1224. true, IPA_v3_5_GROUP_UL_DL, true,
  1225. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1226. QMB_MASTER_SELECT_DDR,
  1227. { 0, 0, 8, 16, IPA_EE_AP } },
  1228. [IPA_3_5_1][IPA_CLIENT_TEST1_PROD] = {
  1229. true, IPA_v3_5_GROUP_UL_DL, true,
  1230. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1231. QMB_MASTER_SELECT_DDR,
  1232. { 0, 0, 8, 16, IPA_EE_AP } },
  1233. [IPA_3_5_1][IPA_CLIENT_TEST2_PROD] = {
  1234. true, IPA_v3_5_GROUP_UL_DL, true,
  1235. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1236. QMB_MASTER_SELECT_DDR,
  1237. { 2, 3, 16, 32, IPA_EE_AP } },
  1238. [IPA_3_5_1][IPA_CLIENT_TEST3_PROD] = {
  1239. true, IPA_v3_5_GROUP_UL_DL, true,
  1240. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1241. QMB_MASTER_SELECT_DDR,
  1242. { 4, 1, 20, 23, IPA_EE_Q6 } },
  1243. [IPA_3_5_1][IPA_CLIENT_TEST4_PROD] = {
  1244. true, IPA_v3_5_GROUP_UL_DL, true,
  1245. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1246. QMB_MASTER_SELECT_DDR,
  1247. { 1, 0, 8, 16, IPA_EE_UC } },
  1248. [IPA_3_5_1][IPA_CLIENT_WLAN1_CONS] = {
  1249. true, IPA_v3_5_GROUP_UL_DL, false,
  1250. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1251. QMB_MASTER_SELECT_DDR,
  1252. { 16, 11, 8, 8, IPA_EE_UC } },
  1253. [IPA_3_5_1][IPA_CLIENT_WLAN2_CONS] = {
  1254. true, IPA_v3_5_GROUP_UL_DL, false,
  1255. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1256. QMB_MASTER_SELECT_DDR,
  1257. { 18, 9, 8, 8, IPA_EE_AP } },
  1258. [IPA_3_5_1][IPA_CLIENT_WLAN3_CONS] = {
  1259. true, IPA_v3_5_GROUP_UL_DL, false,
  1260. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1261. QMB_MASTER_SELECT_DDR,
  1262. { 19, 10, 8, 8, IPA_EE_AP } },
  1263. [IPA_3_5_1][IPA_CLIENT_USB_CONS] = {
  1264. true, IPA_v3_5_GROUP_UL_DL, false,
  1265. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1266. QMB_MASTER_SELECT_DDR,
  1267. { 17, 8, 8, 8, IPA_EE_AP } },
  1268. [IPA_3_5_1][IPA_CLIENT_USB_DPL_CONS] = {
  1269. true, IPA_v3_5_GROUP_UL_DL, false,
  1270. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1271. QMB_MASTER_SELECT_DDR,
  1272. { 11, 2, 4, 6, IPA_EE_AP } },
  1273. [IPA_3_5_1][IPA_CLIENT_APPS_LAN_CONS] = {
  1274. true, IPA_v3_5_GROUP_UL_DL, false,
  1275. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1276. QMB_MASTER_SELECT_DDR,
  1277. { 9, 5, 8, 12, IPA_EE_AP } },
  1278. [IPA_3_5_1][IPA_CLIENT_APPS_WAN_CONS] = {
  1279. true, IPA_v3_5_GROUP_UL_DL, false,
  1280. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1281. QMB_MASTER_SELECT_DDR,
  1282. { 10, 6, 8, 12, IPA_EE_AP } },
  1283. [IPA_3_5_1][IPA_CLIENT_Q6_LAN_CONS] = {
  1284. true, IPA_v3_5_GROUP_UL_DL, false,
  1285. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1286. QMB_MASTER_SELECT_DDR,
  1287. { 13, 3, 8, 12, IPA_EE_Q6 } },
  1288. [IPA_3_5_1][IPA_CLIENT_Q6_WAN_CONS] = {
  1289. true, IPA_v3_5_GROUP_UL_DL, false,
  1290. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1291. QMB_MASTER_SELECT_DDR,
  1292. { 12, 2, 8, 12, IPA_EE_Q6 } },
  1293. /* Only for test purpose */
  1294. [IPA_3_5_1][IPA_CLIENT_TEST_CONS] = {
  1295. true, IPA_v3_5_GROUP_UL_DL,
  1296. false,
  1297. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1298. QMB_MASTER_SELECT_DDR,
  1299. { 17, 8, 8, 8, IPA_EE_AP } },
  1300. [IPA_3_5_1][IPA_CLIENT_TEST1_CONS] = {
  1301. true, IPA_v3_5_GROUP_UL_DL,
  1302. false,
  1303. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1304. QMB_MASTER_SELECT_DDR,
  1305. { 17, 8, 8, 8, IPA_EE_AP } },
  1306. [IPA_3_5_1][IPA_CLIENT_TEST2_CONS] = {
  1307. true, IPA_v3_5_GROUP_UL_DL,
  1308. false,
  1309. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1310. QMB_MASTER_SELECT_DDR,
  1311. { 18, 9, 8, 8, IPA_EE_AP } },
  1312. [IPA_3_5_1][IPA_CLIENT_TEST3_CONS] = {
  1313. true, IPA_v3_5_GROUP_UL_DL,
  1314. false,
  1315. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1316. QMB_MASTER_SELECT_DDR,
  1317. { 19, 10, 8, 8, IPA_EE_AP } },
  1318. [IPA_3_5_1][IPA_CLIENT_TEST4_CONS] = {
  1319. true, IPA_v3_5_GROUP_UL_DL,
  1320. false,
  1321. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1322. QMB_MASTER_SELECT_DDR,
  1323. { 11, 2, 4, 6, IPA_EE_AP } },
  1324. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  1325. [IPA_3_5_1][IPA_CLIENT_DUMMY_CONS] = {
  1326. true, IPA_v3_5_GROUP_UL_DL,
  1327. false,
  1328. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1329. QMB_MASTER_SELECT_DDR,
  1330. { 31, 31, 8, 8, IPA_EE_AP } },
  1331. /* IPA_4_0 */
  1332. [IPA_4_0][IPA_CLIENT_WLAN1_PROD] = {
  1333. true, IPA_v4_0_GROUP_UL_DL,
  1334. true,
  1335. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1336. QMB_MASTER_SELECT_DDR,
  1337. { 6, 2, 8, 16, IPA_EE_UC } },
  1338. [IPA_4_0][IPA_CLIENT_USB_PROD] = {
  1339. true, IPA_v4_0_GROUP_UL_DL,
  1340. true,
  1341. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1342. QMB_MASTER_SELECT_DDR,
  1343. { 0, 8, 8, 16, IPA_EE_AP } },
  1344. [IPA_4_0][IPA_CLIENT_APPS_LAN_PROD] = {
  1345. true, IPA_v4_0_GROUP_UL_DL,
  1346. false,
  1347. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1348. QMB_MASTER_SELECT_DDR,
  1349. { 8, 10, 8, 16, IPA_EE_AP } },
  1350. [IPA_4_0][IPA_CLIENT_APPS_WAN_PROD] = {
  1351. true, IPA_v4_0_GROUP_UL_DL,
  1352. true,
  1353. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1354. QMB_MASTER_SELECT_DDR,
  1355. { 2, 3, 16, 32, IPA_EE_AP } },
  1356. [IPA_4_0][IPA_CLIENT_APPS_CMD_PROD] = {
  1357. true, IPA_v4_0_GROUP_UL_DL,
  1358. false,
  1359. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1360. QMB_MASTER_SELECT_DDR,
  1361. { 5, 4, 20, 24, IPA_EE_AP } },
  1362. [IPA_4_0][IPA_CLIENT_ODU_PROD] = {
  1363. true, IPA_v4_0_GROUP_UL_DL,
  1364. true,
  1365. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1366. QMB_MASTER_SELECT_DDR,
  1367. { 1, 0, 8, 16, IPA_EE_AP } },
  1368. [IPA_4_0][IPA_CLIENT_ETHERNET_PROD] = {
  1369. true, IPA_v4_0_GROUP_UL_DL,
  1370. true,
  1371. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1372. QMB_MASTER_SELECT_DDR,
  1373. { 9, 0, 8, 16, IPA_EE_UC } },
  1374. [IPA_4_0][IPA_CLIENT_Q6_WAN_PROD] = {
  1375. true, IPA_v4_0_GROUP_UL_DL,
  1376. true,
  1377. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1378. QMB_MASTER_SELECT_DDR,
  1379. { 3, 0, 16, 32, IPA_EE_Q6 } },
  1380. [IPA_4_0][IPA_CLIENT_Q6_CMD_PROD] = {
  1381. true, IPA_v4_0_GROUP_UL_DL,
  1382. false,
  1383. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1384. QMB_MASTER_SELECT_DDR,
  1385. { 4, 1, 20, 24, IPA_EE_Q6 } },
  1386. /* Only for test purpose */
  1387. [IPA_4_0][IPA_CLIENT_TEST_PROD] = {
  1388. true, IPA_v4_0_GROUP_UL_DL,
  1389. true,
  1390. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1391. QMB_MASTER_SELECT_DDR,
  1392. {0, 8, 8, 16, IPA_EE_AP } },
  1393. [IPA_4_0][IPA_CLIENT_TEST1_PROD] = {
  1394. true, IPA_v4_0_GROUP_UL_DL,
  1395. true,
  1396. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1397. QMB_MASTER_SELECT_DDR,
  1398. {0, 8, 8, 16, IPA_EE_AP } },
  1399. [IPA_4_0][IPA_CLIENT_TEST2_PROD] = {
  1400. true, IPA_v4_0_GROUP_UL_DL,
  1401. true,
  1402. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1403. QMB_MASTER_SELECT_DDR,
  1404. { 1, 0, 8, 16, IPA_EE_AP } },
  1405. [IPA_4_0][IPA_CLIENT_TEST3_PROD] = {
  1406. true, IPA_v4_0_GROUP_UL_DL,
  1407. true,
  1408. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1409. QMB_MASTER_SELECT_DDR,
  1410. { 7, 9, 8, 16, IPA_EE_AP } },
  1411. [IPA_4_0][IPA_CLIENT_TEST4_PROD] = {
  1412. true, IPA_v4_0_GROUP_UL_DL,
  1413. true,
  1414. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1415. QMB_MASTER_SELECT_DDR,
  1416. {8, 10, 8, 16, IPA_EE_AP } },
  1417. [IPA_4_0][IPA_CLIENT_WLAN1_CONS] = {
  1418. true, IPA_v4_0_GROUP_UL_DL,
  1419. false,
  1420. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1421. QMB_MASTER_SELECT_DDR,
  1422. { 18, 3, 6, 9, IPA_EE_UC } },
  1423. [IPA_4_0][IPA_CLIENT_WLAN2_CONS] = {
  1424. true, IPA_v4_0_GROUP_UL_DL,
  1425. false,
  1426. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1427. QMB_MASTER_SELECT_DDR,
  1428. { 20, 13, 9, 9, IPA_EE_AP } },
  1429. [IPA_4_0][IPA_CLIENT_WLAN3_CONS] = {
  1430. true, IPA_v4_0_GROUP_UL_DL,
  1431. false,
  1432. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1433. QMB_MASTER_SELECT_DDR,
  1434. { 21, 14, 9, 9, IPA_EE_AP } },
  1435. [IPA_4_0][IPA_CLIENT_USB_CONS] = {
  1436. true, IPA_v4_0_GROUP_UL_DL,
  1437. false,
  1438. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1439. QMB_MASTER_SELECT_DDR,
  1440. { 19, 12, 9, 9, IPA_EE_AP } },
  1441. [IPA_4_0][IPA_CLIENT_USB_DPL_CONS] = {
  1442. true, IPA_v4_0_GROUP_UL_DL,
  1443. false,
  1444. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1445. QMB_MASTER_SELECT_DDR,
  1446. { 15, 7, 5, 5, IPA_EE_AP } },
  1447. [IPA_4_0][IPA_CLIENT_APPS_LAN_CONS] = {
  1448. true, IPA_v4_0_GROUP_UL_DL,
  1449. false,
  1450. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1451. QMB_MASTER_SELECT_DDR,
  1452. { 10, 5, 9, 9, IPA_EE_AP } },
  1453. [IPA_4_0][IPA_CLIENT_APPS_WAN_CONS] = {
  1454. true, IPA_v4_0_GROUP_UL_DL,
  1455. false,
  1456. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1457. QMB_MASTER_SELECT_DDR,
  1458. { 11, 6, 9, 9, IPA_EE_AP } },
  1459. [IPA_4_0][IPA_CLIENT_ODU_EMB_CONS] = {
  1460. true, IPA_v4_0_GROUP_UL_DL,
  1461. false,
  1462. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1463. QMB_MASTER_SELECT_DDR,
  1464. { 17, 1, 17, 17, IPA_EE_AP } },
  1465. [IPA_4_0][IPA_CLIENT_ETHERNET_CONS] = {
  1466. true, IPA_v4_0_GROUP_UL_DL,
  1467. false,
  1468. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1469. QMB_MASTER_SELECT_DDR,
  1470. { 22, 1, 17, 17, IPA_EE_UC } },
  1471. [IPA_4_0][IPA_CLIENT_Q6_LAN_CONS] = {
  1472. true, IPA_v4_0_GROUP_UL_DL,
  1473. false,
  1474. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1475. QMB_MASTER_SELECT_DDR,
  1476. { 14, 4, 9, 9, IPA_EE_Q6 } },
  1477. [IPA_4_0][IPA_CLIENT_Q6_WAN_CONS] = {
  1478. true, IPA_v4_0_GROUP_UL_DL,
  1479. false,
  1480. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1481. QMB_MASTER_SELECT_DDR,
  1482. { 13, 3, 9, 9, IPA_EE_Q6 } },
  1483. [IPA_4_0][IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS] = {
  1484. true, IPA_v4_0_GROUP_UL_DL,
  1485. false,
  1486. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1487. QMB_MASTER_SELECT_DDR,
  1488. { 16, 5, 9, 9, IPA_EE_Q6 } },
  1489. /* Only for test purpose */
  1490. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  1491. [IPA_4_0][IPA_CLIENT_TEST_CONS] = {
  1492. true, IPA_v4_0_GROUP_UL_DL,
  1493. false,
  1494. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1495. QMB_MASTER_SELECT_DDR,
  1496. { 11, 6, 9, 9, IPA_EE_AP } },
  1497. [IPA_4_0][IPA_CLIENT_TEST1_CONS] = {
  1498. true, IPA_v4_0_GROUP_UL_DL,
  1499. false,
  1500. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1501. QMB_MASTER_SELECT_DDR,
  1502. { 11, 6, 9, 9, IPA_EE_AP } },
  1503. [IPA_4_0][IPA_CLIENT_TEST2_CONS] = {
  1504. true, IPA_v4_0_GROUP_UL_DL,
  1505. false,
  1506. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1507. QMB_MASTER_SELECT_DDR,
  1508. { 12, 2, 5, 5, IPA_EE_AP } },
  1509. [IPA_4_0][IPA_CLIENT_TEST3_CONS] = {
  1510. true, IPA_v4_0_GROUP_UL_DL,
  1511. false,
  1512. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1513. QMB_MASTER_SELECT_DDR,
  1514. { 19, 12, 9, 9, IPA_EE_AP } },
  1515. [IPA_4_0][IPA_CLIENT_TEST4_CONS] = {
  1516. true, IPA_v4_0_GROUP_UL_DL,
  1517. false,
  1518. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1519. QMB_MASTER_SELECT_DDR,
  1520. { 21, 14, 9, 9, IPA_EE_AP } },
  1521. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  1522. [IPA_4_0][IPA_CLIENT_DUMMY_CONS] = {
  1523. true, IPA_v4_0_GROUP_UL_DL,
  1524. false,
  1525. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1526. QMB_MASTER_SELECT_DDR,
  1527. { 31, 31, 8, 8, IPA_EE_AP } },
  1528. /* IPA_4_0_MHI */
  1529. [IPA_4_0_MHI][IPA_CLIENT_APPS_WAN_PROD] = {
  1530. true, IPA_v4_0_MHI_GROUP_DDR,
  1531. true,
  1532. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1533. QMB_MASTER_SELECT_DDR,
  1534. { 2, 3, 16, 32, IPA_EE_AP } },
  1535. [IPA_4_0_MHI][IPA_CLIENT_APPS_CMD_PROD] = {
  1536. true, IPA_v4_0_MHI_GROUP_DDR,
  1537. false,
  1538. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1539. QMB_MASTER_SELECT_DDR,
  1540. { 5, 4, 20, 24, IPA_EE_AP } },
  1541. [IPA_4_0_MHI][IPA_CLIENT_MHI_PROD] = {
  1542. true, IPA_v4_0_MHI_GROUP_PCIE,
  1543. true,
  1544. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1545. QMB_MASTER_SELECT_PCIE,
  1546. { 1, 0, 8, 16, IPA_EE_AP } },
  1547. [IPA_4_0_MHI][IPA_CLIENT_Q6_WAN_PROD] = {
  1548. true, IPA_v4_0_GROUP_UL_DL,
  1549. true,
  1550. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1551. QMB_MASTER_SELECT_DDR,
  1552. { 3, 0, 16, 32, IPA_EE_Q6 } },
  1553. [IPA_4_0_MHI][IPA_CLIENT_Q6_CMD_PROD] = {
  1554. true, IPA_v4_0_MHI_GROUP_PCIE,
  1555. false,
  1556. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1557. QMB_MASTER_SELECT_DDR,
  1558. { 4, 1, 20, 24, IPA_EE_Q6 } },
  1559. [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
  1560. true, IPA_v4_0_MHI_GROUP_DMA,
  1561. false,
  1562. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1563. QMB_MASTER_SELECT_DDR,
  1564. { 7, 9, 8, 16, IPA_EE_AP } },
  1565. [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
  1566. true, IPA_v4_0_MHI_GROUP_DMA,
  1567. false,
  1568. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1569. QMB_MASTER_SELECT_DDR,
  1570. { 8, 10, 8, 16, IPA_EE_AP } },
  1571. /* Only for test purpose */
  1572. [IPA_4_0_MHI][IPA_CLIENT_TEST_PROD] = {
  1573. true, IPA_v4_0_GROUP_UL_DL,
  1574. true,
  1575. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1576. QMB_MASTER_SELECT_DDR,
  1577. {0, 8, 8, 16, IPA_EE_AP } },
  1578. [IPA_4_0][IPA_CLIENT_TEST1_PROD] = {
  1579. true, IPA_v4_0_GROUP_UL_DL,
  1580. true,
  1581. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1582. QMB_MASTER_SELECT_DDR,
  1583. {0, 8, 8, 16, IPA_EE_AP } },
  1584. [IPA_4_0_MHI][IPA_CLIENT_TEST2_PROD] = {
  1585. true, IPA_v4_0_GROUP_UL_DL,
  1586. true,
  1587. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1588. QMB_MASTER_SELECT_DDR,
  1589. { 1, 0, 8, 16, IPA_EE_AP } },
  1590. [IPA_4_0_MHI][IPA_CLIENT_TEST3_PROD] = {
  1591. true, IPA_v4_0_GROUP_UL_DL,
  1592. true,
  1593. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1594. QMB_MASTER_SELECT_DDR,
  1595. { 7, 9, 8, 16, IPA_EE_AP } },
  1596. [IPA_4_0_MHI][IPA_CLIENT_TEST4_PROD] = {
  1597. true, IPA_v4_0_GROUP_UL_DL,
  1598. true,
  1599. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1600. QMB_MASTER_SELECT_DDR,
  1601. { 8, 10, 8, 16, IPA_EE_AP } },
  1602. [IPA_4_0_MHI][IPA_CLIENT_APPS_LAN_CONS] = {
  1603. true, IPA_v4_0_MHI_GROUP_DDR,
  1604. false,
  1605. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1606. QMB_MASTER_SELECT_DDR,
  1607. { 10, 5, 9, 9, IPA_EE_AP } },
  1608. [IPA_4_0_MHI][IPA_CLIENT_APPS_WAN_CONS] = {
  1609. true, IPA_v4_0_MHI_GROUP_DDR,
  1610. false,
  1611. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1612. QMB_MASTER_SELECT_DDR,
  1613. { 11, 6, 9, 9, IPA_EE_AP } },
  1614. [IPA_4_0_MHI][IPA_CLIENT_MHI_CONS] = {
  1615. true, IPA_v4_0_MHI_GROUP_PCIE,
  1616. false,
  1617. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1618. QMB_MASTER_SELECT_PCIE,
  1619. { 17, 1, 17, 17, IPA_EE_AP } },
  1620. [IPA_4_0_MHI][IPA_CLIENT_Q6_LAN_CONS] = {
  1621. true, IPA_v4_0_MHI_GROUP_DDR,
  1622. false,
  1623. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1624. QMB_MASTER_SELECT_DDR,
  1625. { 14, 4, 9, 9, IPA_EE_Q6 } },
  1626. [IPA_4_0_MHI][IPA_CLIENT_Q6_WAN_CONS] = {
  1627. true, IPA_v4_0_MHI_GROUP_DDR,
  1628. false,
  1629. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1630. QMB_MASTER_SELECT_DDR,
  1631. { 13, 3, 9, 9, IPA_EE_Q6 } },
  1632. [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
  1633. true, IPA_v4_0_MHI_GROUP_DMA,
  1634. false,
  1635. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1636. QMB_MASTER_SELECT_PCIE,
  1637. { 20, 13, 9, 9, IPA_EE_AP } },
  1638. [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
  1639. true, IPA_v4_0_MHI_GROUP_DMA,
  1640. false,
  1641. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1642. QMB_MASTER_SELECT_PCIE,
  1643. { 21, 14, 9, 9, IPA_EE_AP } },
  1644. [IPA_4_0_MHI][IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS] = {
  1645. true, IPA_v4_0_GROUP_UL_DL,
  1646. false,
  1647. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1648. QMB_MASTER_SELECT_DDR,
  1649. { 16, 5, 9, 9, IPA_EE_Q6 } },
  1650. [IPA_4_0_MHI][IPA_CLIENT_USB_DPL_CONS] = {
  1651. true, IPA_v4_0_MHI_GROUP_DDR,
  1652. false,
  1653. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1654. QMB_MASTER_SELECT_DDR,
  1655. { 15, 7, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY } },
  1656. [IPA_4_0_MHI][IPA_CLIENT_MHI_DPL_CONS] = {
  1657. true, IPA_v4_0_MHI_GROUP_PCIE,
  1658. false,
  1659. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1660. QMB_MASTER_SELECT_PCIE,
  1661. { 12, 2, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY } },
  1662. /* Only for test purpose */
  1663. [IPA_4_0_MHI][IPA_CLIENT_TEST_CONS] = {
  1664. true, IPA_v4_0_GROUP_UL_DL,
  1665. false,
  1666. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1667. QMB_MASTER_SELECT_PCIE,
  1668. { 11, 6, 9, 9, IPA_EE_AP } },
  1669. [IPA_4_0_MHI][IPA_CLIENT_TEST1_CONS] = {
  1670. true, IPA_v4_0_GROUP_UL_DL,
  1671. false,
  1672. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1673. QMB_MASTER_SELECT_PCIE,
  1674. { 11, 6, 9, 9, IPA_EE_AP } },
  1675. [IPA_4_0_MHI][IPA_CLIENT_TEST2_CONS] = {
  1676. true, IPA_v4_0_GROUP_UL_DL,
  1677. false,
  1678. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1679. QMB_MASTER_SELECT_DDR,
  1680. { 12, 2, 5, 5, IPA_EE_AP } },
  1681. [IPA_4_0_MHI][IPA_CLIENT_TEST3_CONS] = {
  1682. true, IPA_v4_0_GROUP_UL_DL,
  1683. false,
  1684. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1685. QMB_MASTER_SELECT_PCIE,
  1686. { 19, 12, 9, 9, IPA_EE_AP } },
  1687. [IPA_4_0_MHI][IPA_CLIENT_TEST4_CONS] = {
  1688. true, IPA_v4_0_GROUP_UL_DL,
  1689. false,
  1690. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1691. QMB_MASTER_SELECT_PCIE,
  1692. { 21, 14, 9, 9, IPA_EE_AP } },
  1693. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  1694. [IPA_4_0_MHI][IPA_CLIENT_DUMMY_CONS] = {
  1695. true, IPA_v4_0_GROUP_UL_DL,
  1696. false,
  1697. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1698. QMB_MASTER_SELECT_DDR,
  1699. { 31, 31, 8, 8, IPA_EE_AP } },
  1700. /* IPA_4_1 */
  1701. [IPA_4_1][IPA_CLIENT_WLAN1_PROD] = {
  1702. true, IPA_v4_0_GROUP_UL_DL,
  1703. true,
  1704. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1705. QMB_MASTER_SELECT_DDR,
  1706. { 6, 2, 8, 16, IPA_EE_UC } },
  1707. [IPA_4_1][IPA_CLIENT_WLAN2_PROD] = {
  1708. true, IPA_v4_0_GROUP_UL_DL,
  1709. true,
  1710. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1711. QMB_MASTER_SELECT_DDR,
  1712. { 7, 9, 8, 16, IPA_EE_AP } },
  1713. [IPA_4_1][IPA_CLIENT_USB_PROD] = {
  1714. true, IPA_v4_0_GROUP_UL_DL,
  1715. true,
  1716. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1717. QMB_MASTER_SELECT_DDR,
  1718. { 0, 8, 8, 16, IPA_EE_AP } },
  1719. [IPA_4_1][IPA_CLIENT_APPS_LAN_PROD] = {
  1720. true, IPA_v4_0_GROUP_UL_DL,
  1721. false,
  1722. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1723. QMB_MASTER_SELECT_DDR,
  1724. { 8, 10, 8, 16, IPA_EE_AP } },
  1725. [IPA_4_1][IPA_CLIENT_APPS_WAN_PROD] = {
  1726. true, IPA_v4_0_GROUP_UL_DL,
  1727. true,
  1728. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1729. QMB_MASTER_SELECT_DDR,
  1730. { 2, 3, 16, 32, IPA_EE_AP } },
  1731. [IPA_4_1][IPA_CLIENT_APPS_CMD_PROD] = {
  1732. true, IPA_v4_0_GROUP_UL_DL,
  1733. false,
  1734. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1735. QMB_MASTER_SELECT_DDR,
  1736. { 5, 4, 20, 24, IPA_EE_AP } },
  1737. [IPA_4_1][IPA_CLIENT_ODU_PROD] = {
  1738. true, IPA_v4_0_GROUP_UL_DL,
  1739. true,
  1740. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1741. QMB_MASTER_SELECT_DDR,
  1742. { 1, 0, 8, 16, IPA_EE_AP } },
  1743. [IPA_4_1][IPA_CLIENT_ETHERNET_PROD] = {
  1744. true, IPA_v4_0_GROUP_UL_DL,
  1745. true,
  1746. IPA_DPS_HPS_REP_SEQ_TYPE_2PKT_PROC_PASS_NO_DEC_UCP_DMAP,
  1747. QMB_MASTER_SELECT_DDR,
  1748. { 9, 0, 8, 16, IPA_EE_UC } },
  1749. [IPA_4_1][IPA_CLIENT_Q6_WAN_PROD] = {
  1750. true, IPA_v4_0_GROUP_UL_DL,
  1751. true,
  1752. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1753. QMB_MASTER_SELECT_DDR,
  1754. { 3, 0, 16, 32, IPA_EE_Q6 } },
  1755. [IPA_4_1][IPA_CLIENT_Q6_CMD_PROD] = {
  1756. true, IPA_v4_0_GROUP_UL_DL,
  1757. false,
  1758. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  1759. QMB_MASTER_SELECT_DDR,
  1760. { 4, 1, 20, 24, IPA_EE_Q6 } },
  1761. /* Only for test purpose */
  1762. [IPA_4_1][IPA_CLIENT_TEST_PROD] = {
  1763. true, IPA_v4_0_GROUP_UL_DL,
  1764. true,
  1765. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1766. QMB_MASTER_SELECT_DDR,
  1767. {0, 8, 8, 16, IPA_EE_AP } },
  1768. [IPA_4_1][IPA_CLIENT_TEST1_PROD] = {
  1769. true, IPA_v4_0_GROUP_UL_DL,
  1770. true,
  1771. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1772. QMB_MASTER_SELECT_DDR,
  1773. { 0, 8, 8, 16, IPA_EE_AP } },
  1774. [IPA_4_1][IPA_CLIENT_TEST2_PROD] = {
  1775. true, IPA_v4_0_GROUP_UL_DL,
  1776. true,
  1777. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1778. QMB_MASTER_SELECT_DDR,
  1779. { 1, 0, 8, 16, IPA_EE_AP } },
  1780. [IPA_4_1][IPA_CLIENT_TEST3_PROD] = {
  1781. true, IPA_v4_0_GROUP_UL_DL,
  1782. true,
  1783. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1784. QMB_MASTER_SELECT_DDR,
  1785. {7, 9, 8, 16, IPA_EE_AP } },
  1786. [IPA_4_1][IPA_CLIENT_TEST4_PROD] = {
  1787. true, IPA_v4_0_GROUP_UL_DL,
  1788. true,
  1789. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1790. QMB_MASTER_SELECT_DDR,
  1791. { 8, 10, 8, 16, IPA_EE_AP } },
  1792. [IPA_4_1][IPA_CLIENT_WLAN1_CONS] = {
  1793. true, IPA_v4_0_GROUP_UL_DL,
  1794. false,
  1795. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1796. QMB_MASTER_SELECT_DDR,
  1797. { 18, 3, 9, 9, IPA_EE_UC } },
  1798. [IPA_4_1][IPA_CLIENT_WLAN2_CONS] = {
  1799. true, IPA_v4_0_GROUP_UL_DL,
  1800. false,
  1801. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1802. QMB_MASTER_SELECT_DDR,
  1803. { 17, 1, 8, 13, IPA_EE_AP } },
  1804. [IPA_4_1][IPA_CLIENT_WLAN3_CONS] = {
  1805. true, IPA_v4_0_GROUP_UL_DL,
  1806. false,
  1807. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1808. QMB_MASTER_SELECT_DDR,
  1809. { 21, 14, 9, 9, IPA_EE_AP } },
  1810. [IPA_4_1][IPA_CLIENT_USB_CONS] = {
  1811. true, IPA_v4_0_GROUP_UL_DL,
  1812. false,
  1813. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1814. QMB_MASTER_SELECT_DDR,
  1815. { 19, 12, 9, 9, IPA_EE_AP } },
  1816. [IPA_4_1][IPA_CLIENT_USB_DPL_CONS] = {
  1817. true, IPA_v4_0_GROUP_UL_DL,
  1818. false,
  1819. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1820. QMB_MASTER_SELECT_DDR,
  1821. { 15, 7, 5, 5, IPA_EE_AP } },
  1822. [IPA_4_1][IPA_CLIENT_APPS_LAN_CONS] = {
  1823. true, IPA_v4_0_GROUP_UL_DL,
  1824. false,
  1825. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1826. QMB_MASTER_SELECT_DDR,
  1827. { 10, 5, 9, 9, IPA_EE_AP } },
  1828. [IPA_4_1][IPA_CLIENT_APPS_WAN_CONS] = {
  1829. true, IPA_v4_0_GROUP_UL_DL,
  1830. false,
  1831. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1832. QMB_MASTER_SELECT_DDR,
  1833. { 11, 6, 9, 9, IPA_EE_AP } },
  1834. [IPA_4_1][IPA_CLIENT_ODL_DPL_CONS] = {
  1835. true, IPA_v4_0_GROUP_UL_DL,
  1836. false,
  1837. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1838. QMB_MASTER_SELECT_DDR,
  1839. { 12, 2, 9, 9, IPA_EE_AP } },
  1840. [IPA_4_1][IPA_CLIENT_ETHERNET_CONS] = {
  1841. true, IPA_v4_0_GROUP_UL_DL,
  1842. false,
  1843. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1844. QMB_MASTER_SELECT_DDR,
  1845. { 22, 1, 9, 9, IPA_EE_UC } },
  1846. [IPA_4_1][IPA_CLIENT_Q6_LAN_CONS] = {
  1847. true, IPA_v4_0_GROUP_UL_DL,
  1848. false,
  1849. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1850. QMB_MASTER_SELECT_DDR,
  1851. { 14, 4, 9, 9, IPA_EE_Q6 } },
  1852. [IPA_4_1][IPA_CLIENT_Q6_WAN_CONS] = {
  1853. true, IPA_v4_0_GROUP_UL_DL,
  1854. false,
  1855. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1856. QMB_MASTER_SELECT_DDR,
  1857. { 13, 3, 9, 9, IPA_EE_Q6 } },
  1858. [IPA_4_1][IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS] = {
  1859. true, IPA_v4_0_GROUP_UL_DL,
  1860. false,
  1861. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1862. QMB_MASTER_SELECT_DDR,
  1863. { 16, 5, 9, 9, IPA_EE_Q6 } },
  1864. /* Only for test purpose */
  1865. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  1866. [IPA_4_1][IPA_CLIENT_TEST_CONS] = {
  1867. true, IPA_v4_0_GROUP_UL_DL,
  1868. false,
  1869. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1870. QMB_MASTER_SELECT_DDR,
  1871. { 11, 6, 9, 9, IPA_EE_AP } },
  1872. [IPA_4_1][IPA_CLIENT_TEST1_CONS] = {
  1873. true, IPA_v4_0_GROUP_UL_DL,
  1874. false,
  1875. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1876. QMB_MASTER_SELECT_DDR,
  1877. { 11, 6, 9, 9, IPA_EE_AP } },
  1878. [IPA_4_1][IPA_CLIENT_TEST2_CONS] = {
  1879. true, IPA_v4_0_GROUP_UL_DL,
  1880. false,
  1881. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1882. QMB_MASTER_SELECT_DDR,
  1883. { 12, 2, 9, 9, IPA_EE_AP } },
  1884. [IPA_4_1][IPA_CLIENT_TEST3_CONS] = {
  1885. true, IPA_v4_0_GROUP_UL_DL,
  1886. false,
  1887. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1888. QMB_MASTER_SELECT_DDR,
  1889. { 19, 12, 9, 9, IPA_EE_AP } },
  1890. [IPA_4_1][IPA_CLIENT_TEST4_CONS] = {
  1891. true, IPA_v4_0_GROUP_UL_DL,
  1892. false,
  1893. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1894. QMB_MASTER_SELECT_DDR,
  1895. { 21, 14, 9, 9, IPA_EE_AP } },
  1896. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  1897. [IPA_4_1][IPA_CLIENT_DUMMY_CONS] = {
  1898. true, IPA_v4_0_GROUP_UL_DL,
  1899. false,
  1900. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1901. QMB_MASTER_SELECT_DDR,
  1902. { 31, 31, 8, 8, IPA_EE_AP } },
  1903. /* MHI PRIME PIPES - Client producer / IPA Consumer pipes */
  1904. [IPA_4_1_APQ][IPA_CLIENT_MHI_PRIME_DPL_PROD] = {
  1905. true, IPA_v4_0_GROUP_UL_DL,
  1906. true,
  1907. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1908. QMB_MASTER_SELECT_DDR,
  1909. {7, 9, 8, 16, IPA_EE_AP } },
  1910. [IPA_4_1_APQ][IPA_CLIENT_MHI_PRIME_TETH_PROD] = {
  1911. true, IPA_v4_0_GROUP_UL_DL,
  1912. true,
  1913. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  1914. QMB_MASTER_SELECT_DDR,
  1915. { 1, 0, 8, 16, IPA_EE_AP } },
  1916. [IPA_4_1_APQ][IPA_CLIENT_MHI_PRIME_RMNET_PROD] = {
  1917. true, IPA_v4_0_GROUP_UL_DL,
  1918. true,
  1919. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1920. QMB_MASTER_SELECT_DDR,
  1921. { 2, 3, 16, 32, IPA_EE_AP } },
  1922. /* MHI PRIME PIPES - Client Consumer / IPA Producer pipes */
  1923. [IPA_4_1_APQ][IPA_CLIENT_MHI_PRIME_TETH_CONS] = {
  1924. true, IPA_v4_0_GROUP_UL_DL,
  1925. false,
  1926. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1927. QMB_MASTER_SELECT_DDR,
  1928. { 20, 13, 9, 9, IPA_EE_AP } },
  1929. [IPA_4_1_APQ][IPA_CLIENT_MHI_PRIME_RMNET_CONS] = {
  1930. true, IPA_v4_0_GROUP_UL_DL,
  1931. false,
  1932. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  1933. QMB_MASTER_SELECT_DDR,
  1934. { 17, 14, 9, 9, IPA_EE_AP } },
  1935. /* IPA_4_2 */
  1936. [IPA_4_2][IPA_CLIENT_WLAN1_PROD] = {
  1937. true, IPA_v4_2_GROUP_UL_DL,
  1938. true,
  1939. IPA_DPS_HPS_REP_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP_DMAP,
  1940. QMB_MASTER_SELECT_DDR,
  1941. { 3, 7, 6, 7, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  1942. [IPA_4_2][IPA_CLIENT_USB_PROD] = {
  1943. true, IPA_v4_2_GROUP_UL_DL,
  1944. true,
  1945. IPA_DPS_HPS_REP_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP_DMAP,
  1946. QMB_MASTER_SELECT_DDR,
  1947. { 0, 5, 8, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  1948. [IPA_4_2][IPA_CLIENT_APPS_LAN_PROD] = {
  1949. true, IPA_v4_2_GROUP_UL_DL,
  1950. false,
  1951. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  1952. QMB_MASTER_SELECT_DDR,
  1953. { 2, 6, 8, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  1954. [IPA_4_2][IPA_CLIENT_APPS_WAN_PROD] = {
  1955. true, IPA_v4_2_GROUP_UL_DL,
  1956. true,
  1957. IPA_DPS_HPS_REP_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP_DMAP,
  1958. QMB_MASTER_SELECT_DDR,
  1959. { 1, 0, 8, 12, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  1960. [IPA_4_2][IPA_CLIENT_APPS_CMD_PROD] = {
  1961. true, IPA_v4_2_GROUP_UL_DL,
  1962. false,
  1963. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  1964. QMB_MASTER_SELECT_DDR,
  1965. { 6, 1, 20, 20, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  1966. [IPA_4_2][IPA_CLIENT_Q6_WAN_PROD] = {
  1967. true, IPA_v4_2_GROUP_UL_DL,
  1968. true,
  1969. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  1970. QMB_MASTER_SELECT_DDR,
  1971. { 4, 0, 8, 12, IPA_EE_Q6, GSI_USE_PREFETCH_BUFS} },
  1972. [IPA_4_2][IPA_CLIENT_Q6_CMD_PROD] = {
  1973. true, IPA_v4_2_GROUP_UL_DL,
  1974. false,
  1975. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  1976. QMB_MASTER_SELECT_DDR,
  1977. { 5, 1, 20, 20, IPA_EE_Q6, GSI_USE_PREFETCH_BUFS} },
  1978. [IPA_4_2][IPA_CLIENT_ETHERNET_PROD] = {
  1979. true, IPA_v4_2_GROUP_UL_DL,
  1980. true,
  1981. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  1982. QMB_MASTER_SELECT_DDR,
  1983. { 7, 0, 8, 10, IPA_EE_UC, GSI_USE_PREFETCH_BUFS} },
  1984. /* Only for test purpose */
  1985. [IPA_4_2][IPA_CLIENT_TEST_PROD] = {
  1986. true, IPA_v4_2_GROUP_UL_DL,
  1987. true,
  1988. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  1989. QMB_MASTER_SELECT_DDR,
  1990. {0, 5, 8, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  1991. [IPA_4_2][IPA_CLIENT_TEST1_PROD] = {
  1992. true, IPA_v4_2_GROUP_UL_DL,
  1993. true,
  1994. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  1995. QMB_MASTER_SELECT_DDR,
  1996. { 0, 5, 8, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  1997. [IPA_4_2][IPA_CLIENT_TEST2_PROD] = {
  1998. true, IPA_v4_2_GROUP_UL_DL,
  1999. true,
  2000. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  2001. QMB_MASTER_SELECT_DDR,
  2002. { 3, 7, 6, 7, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  2003. [IPA_4_2][IPA_CLIENT_TEST3_PROD] = {
  2004. true, IPA_v4_2_GROUP_UL_DL,
  2005. true,
  2006. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  2007. QMB_MASTER_SELECT_DDR,
  2008. {1, 0, 8, 12, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2009. [IPA_4_2][IPA_CLIENT_TEST4_PROD] = {
  2010. true, IPA_v4_2_GROUP_UL_DL,
  2011. true,
  2012. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP,
  2013. QMB_MASTER_SELECT_DDR,
  2014. { 7, 0, 8, 10, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  2015. [IPA_4_2][IPA_CLIENT_WLAN1_CONS] = {
  2016. true, IPA_v4_2_GROUP_UL_DL,
  2017. false,
  2018. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2019. QMB_MASTER_SELECT_DDR,
  2020. { 14, 8, 6, 9, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  2021. [IPA_4_2][IPA_CLIENT_USB_CONS] = {
  2022. true, IPA_v4_2_GROUP_UL_DL,
  2023. false,
  2024. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2025. QMB_MASTER_SELECT_DDR,
  2026. { 15, 9, 6, 6, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2027. [IPA_4_2][IPA_CLIENT_USB_DPL_CONS] = {
  2028. true, IPA_v4_2_GROUP_UL_DL,
  2029. false,
  2030. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2031. QMB_MASTER_SELECT_DDR,
  2032. { 12, 4, 4, 4, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2033. [IPA_4_2][IPA_CLIENT_APPS_LAN_CONS] = {
  2034. true, IPA_v4_2_GROUP_UL_DL,
  2035. false,
  2036. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2037. QMB_MASTER_SELECT_DDR,
  2038. { 8, 2, 6, 6, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2039. [IPA_4_2][IPA_CLIENT_APPS_WAN_CONS] = {
  2040. true, IPA_v4_2_GROUP_UL_DL,
  2041. false,
  2042. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2043. QMB_MASTER_SELECT_DDR,
  2044. { 9, 3, 6, 6, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2045. [IPA_4_2][IPA_CLIENT_Q6_LAN_CONS] = {
  2046. true, IPA_v4_2_GROUP_UL_DL,
  2047. false,
  2048. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2049. QMB_MASTER_SELECT_DDR,
  2050. { 11, 3, 6, 6, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY} },
  2051. [IPA_4_2][IPA_CLIENT_Q6_WAN_CONS] = {
  2052. true, IPA_v4_2_GROUP_UL_DL,
  2053. false,
  2054. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2055. QMB_MASTER_SELECT_DDR,
  2056. { 10, 2, 6, 6, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY} },
  2057. [IPA_4_2][IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS] = {
  2058. true, IPA_v4_2_GROUP_UL_DL,
  2059. false,
  2060. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2061. QMB_MASTER_SELECT_DDR,
  2062. { 13, 4, 6, 6, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY} },
  2063. [IPA_4_2][IPA_CLIENT_ETHERNET_CONS] = {
  2064. true, IPA_v4_2_GROUP_UL_DL,
  2065. false,
  2066. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2067. QMB_MASTER_SELECT_DDR,
  2068. { 16, 1, 6, 6, IPA_EE_UC, GSI_USE_PREFETCH_BUFS} },
  2069. /* Only for test purpose */
  2070. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  2071. [IPA_4_2][IPA_CLIENT_TEST_CONS] = {
  2072. true, IPA_v4_2_GROUP_UL_DL,
  2073. false,
  2074. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2075. QMB_MASTER_SELECT_DDR,
  2076. { 15, 9, 6, 6, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2077. [IPA_4_2][IPA_CLIENT_TEST1_CONS] = {
  2078. true, IPA_v4_2_GROUP_UL_DL,
  2079. false,
  2080. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2081. QMB_MASTER_SELECT_DDR,
  2082. { 15, 9, 6, 6, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2083. [IPA_4_2][IPA_CLIENT_TEST2_CONS] = {
  2084. true, IPA_v4_2_GROUP_UL_DL,
  2085. false,
  2086. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2087. QMB_MASTER_SELECT_DDR,
  2088. { 12, 4, 4, 4, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2089. [IPA_4_2][IPA_CLIENT_TEST3_CONS] = {
  2090. true, IPA_v4_2_GROUP_UL_DL,
  2091. false,
  2092. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2093. QMB_MASTER_SELECT_DDR,
  2094. { 14, 8, 6, 9, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  2095. [IPA_4_2][IPA_CLIENT_TEST4_CONS] = {
  2096. true, IPA_v4_2_GROUP_UL_DL,
  2097. false,
  2098. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2099. QMB_MASTER_SELECT_DDR,
  2100. { 9, 3, 6, 6, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY} },
  2101. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  2102. [IPA_4_2][IPA_CLIENT_DUMMY_CONS] = {
  2103. true, IPA_v4_2_GROUP_UL_DL,
  2104. false,
  2105. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2106. QMB_MASTER_SELECT_DDR,
  2107. { 31, 31, 8, 8, IPA_EE_AP, GSI_USE_PREFETCH_BUFS} },
  2108. /* IPA_4_5 */
  2109. [IPA_4_5][IPA_CLIENT_WLAN2_PROD] = {
  2110. true, IPA_v4_5_GROUP_UL_DL,
  2111. true,
  2112. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2113. QMB_MASTER_SELECT_DDR,
  2114. { 9, 12, 8, 16, IPA_EE_AP, GSI_FREE_PRE_FETCH, 2 } },
  2115. [IPA_4_5][IPA_CLIENT_USB_PROD] = {
  2116. true, IPA_v4_5_GROUP_UL_DL,
  2117. true,
  2118. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2119. QMB_MASTER_SELECT_DDR,
  2120. { 1, 0, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2121. [IPA_4_5][IPA_CLIENT_APPS_LAN_PROD] = {
  2122. true, IPA_v4_5_GROUP_UL_DL,
  2123. false,
  2124. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2125. QMB_MASTER_SELECT_DDR,
  2126. { 11, 14, 10, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 2 } },
  2127. [IPA_4_5][IPA_CLIENT_APPS_WAN_PROD] = {
  2128. true, IPA_v4_5_GROUP_UL_DL,
  2129. true,
  2130. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2131. QMB_MASTER_SELECT_DDR,
  2132. { 2, 7, 16, 32, IPA_EE_AP, GSI_SMART_PRE_FETCH, 7 } },
  2133. [IPA_4_5][IPA_CLIENT_APPS_CMD_PROD] = {
  2134. true, IPA_v4_5_GROUP_UL_DL,
  2135. false,
  2136. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2137. QMB_MASTER_SELECT_DDR,
  2138. { 7, 9, 20, 24, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2139. [IPA_4_5][IPA_CLIENT_ODU_PROD] = {
  2140. true, IPA_v4_5_GROUP_UL_DL,
  2141. true,
  2142. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2143. QMB_MASTER_SELECT_DDR,
  2144. { 3, 5, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2145. [IPA_4_5][IPA_CLIENT_ETHERNET_PROD] = {
  2146. true, IPA_v4_5_GROUP_UL_DL,
  2147. true,
  2148. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2149. QMB_MASTER_SELECT_DDR,
  2150. { 12, 0, 8, 16, IPA_EE_UC, GSI_SMART_PRE_FETCH, 3 } },
  2151. [IPA_4_5][IPA_CLIENT_Q6_WAN_PROD] = {
  2152. true, IPA_v4_5_GROUP_UL_DL,
  2153. true,
  2154. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2155. QMB_MASTER_SELECT_DDR,
  2156. { 5, 0, 16, 28, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2157. [IPA_4_5][IPA_CLIENT_Q6_CMD_PROD] = {
  2158. true, IPA_v4_5_GROUP_UL_DL,
  2159. false,
  2160. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  2161. QMB_MASTER_SELECT_DDR,
  2162. { 6, 1, 20, 24, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2163. [IPA_4_5][IPA_CLIENT_Q6_DL_NLO_DATA_PROD] = {
  2164. true, IPA_v4_5_GROUP_UL_DL,
  2165. true,
  2166. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2167. QMB_MASTER_SELECT_DDR,
  2168. { 8, 2, 27, 32, IPA_EE_Q6, GSI_FREE_PRE_FETCH, 3 } },
  2169. /* Only for test purpose */
  2170. [IPA_4_5][IPA_CLIENT_TEST_PROD] = {
  2171. true, IPA_v4_5_GROUP_UL_DL,
  2172. true,
  2173. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2174. QMB_MASTER_SELECT_DDR,
  2175. { 1, 0, 8, 16, IPA_EE_AP } },
  2176. [IPA_4_5][IPA_CLIENT_TEST1_PROD] = {
  2177. true, IPA_v4_5_GROUP_UL_DL,
  2178. true,
  2179. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2180. QMB_MASTER_SELECT_DDR,
  2181. { 1, 0, 8, 16, IPA_EE_AP } },
  2182. [IPA_4_5][IPA_CLIENT_TEST2_PROD] = {
  2183. true, IPA_v4_5_GROUP_UL_DL,
  2184. true,
  2185. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2186. QMB_MASTER_SELECT_DDR,
  2187. { 3, 5, 8, 16, IPA_EE_AP } },
  2188. [IPA_4_5][IPA_CLIENT_TEST3_PROD] = {
  2189. true, IPA_v4_5_GROUP_UL_DL,
  2190. true,
  2191. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2192. QMB_MASTER_SELECT_DDR,
  2193. { 9, 12, 8, 16, IPA_EE_AP } },
  2194. [IPA_4_5][IPA_CLIENT_TEST4_PROD] = {
  2195. true, IPA_v4_5_GROUP_UL_DL,
  2196. true,
  2197. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2198. QMB_MASTER_SELECT_DDR,
  2199. { 11, 14, 8, 16, IPA_EE_AP } },
  2200. [IPA_4_5][IPA_CLIENT_WLAN2_CONS] = {
  2201. true, IPA_v4_5_GROUP_UL_DL,
  2202. false,
  2203. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2204. QMB_MASTER_SELECT_DDR,
  2205. { 24, 3, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2206. [IPA_4_5][IPA_CLIENT_USB_CONS] = {
  2207. true, IPA_v4_5_GROUP_UL_DL,
  2208. false,
  2209. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2210. QMB_MASTER_SELECT_DDR,
  2211. { 26, 17, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2212. [IPA_4_5][IPA_CLIENT_USB_DPL_CONS] = {
  2213. true, IPA_v4_5_GROUP_UL_DL,
  2214. false,
  2215. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2216. QMB_MASTER_SELECT_DDR,
  2217. { 15, 15, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2218. [IPA_4_5][IPA_CLIENT_ODL_DPL_CONS] = {
  2219. true, IPA_v4_5_GROUP_UL_DL,
  2220. false,
  2221. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2222. QMB_MASTER_SELECT_DDR,
  2223. { 22, 2, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2224. [IPA_4_5][IPA_CLIENT_APPS_LAN_CONS] = {
  2225. true, IPA_v4_5_GROUP_UL_DL,
  2226. false,
  2227. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2228. QMB_MASTER_SELECT_DDR,
  2229. { 16, 10, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2230. [IPA_4_5][IPA_CLIENT_APPS_WAN_COAL_CONS] = {
  2231. true, IPA_v4_5_GROUP_UL_DL,
  2232. false,
  2233. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2234. QMB_MASTER_SELECT_DDR,
  2235. { 13, 4, 8, 11, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2236. [IPA_4_5][IPA_CLIENT_APPS_WAN_CONS] = {
  2237. true, IPA_v4_5_GROUP_UL_DL,
  2238. false,
  2239. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2240. QMB_MASTER_SELECT_DDR,
  2241. { 14, 1, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2242. [IPA_4_5][IPA_CLIENT_ODU_EMB_CONS] = {
  2243. true, IPA_v4_5_GROUP_UL_DL,
  2244. false,
  2245. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2246. QMB_MASTER_SELECT_DDR,
  2247. { 30, 6, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 4 } },
  2248. [IPA_4_5][IPA_CLIENT_ETHERNET_CONS] = {
  2249. true, IPA_v4_5_GROUP_UL_DL,
  2250. false,
  2251. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2252. QMB_MASTER_SELECT_DDR,
  2253. { 28, 1, 9, 9, IPA_EE_UC, GSI_SMART_PRE_FETCH, 4 } },
  2254. [IPA_4_5][IPA_CLIENT_Q6_LAN_CONS] = {
  2255. true, IPA_v4_5_GROUP_UL_DL,
  2256. false,
  2257. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2258. QMB_MASTER_SELECT_DDR,
  2259. { 17, 3, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2260. [IPA_4_5][IPA_CLIENT_Q6_WAN_CONS] = {
  2261. true, IPA_v4_5_GROUP_UL_DL,
  2262. false,
  2263. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2264. QMB_MASTER_SELECT_DDR,
  2265. { 21, 7, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2266. [IPA_4_5][IPA_CLIENT_Q6_UL_NLO_DATA_CONS] = {
  2267. true, IPA_v4_5_GROUP_UL_DL,
  2268. false,
  2269. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2270. QMB_MASTER_SELECT_DDR,
  2271. { 19, 5, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2272. [IPA_4_5][IPA_CLIENT_Q6_UL_NLO_ACK_CONS] = {
  2273. true, IPA_v4_5_GROUP_UL_DL,
  2274. false,
  2275. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2276. QMB_MASTER_SELECT_DDR,
  2277. { 20, 6, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2278. [IPA_4_5][IPA_CLIENT_Q6_QBAP_STATUS_CONS] = {
  2279. true, IPA_v4_5_GROUP_UL_DL,
  2280. false,
  2281. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2282. QMB_MASTER_SELECT_DDR,
  2283. { 18, 4, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2284. /* Only for test purpose */
  2285. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  2286. [IPA_4_5][IPA_CLIENT_TEST_CONS] = {
  2287. true, IPA_v4_5_GROUP_UL_DL,
  2288. false,
  2289. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2290. QMB_MASTER_SELECT_DDR,
  2291. { 14, 1, 9, 9, IPA_EE_AP } },
  2292. [IPA_4_5][IPA_CLIENT_TEST1_CONS] = {
  2293. true, IPA_v4_5_GROUP_UL_DL,
  2294. false,
  2295. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2296. QMB_MASTER_SELECT_DDR,
  2297. { 14, 1, 9, 9, IPA_EE_AP } },
  2298. [IPA_4_5][IPA_CLIENT_TEST2_CONS] = {
  2299. true, IPA_v4_5_GROUP_UL_DL,
  2300. false,
  2301. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2302. QMB_MASTER_SELECT_DDR,
  2303. { 24, 3, 8, 14, IPA_EE_AP } },
  2304. [IPA_4_5][IPA_CLIENT_TEST3_CONS] = {
  2305. true, IPA_v4_5_GROUP_UL_DL,
  2306. false,
  2307. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2308. QMB_MASTER_SELECT_DDR,
  2309. { 26, 17, 9, 9, IPA_EE_AP } },
  2310. [IPA_4_5][IPA_CLIENT_TEST4_CONS] = {
  2311. true, IPA_v4_5_GROUP_UL_DL,
  2312. false,
  2313. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2314. QMB_MASTER_SELECT_DDR,
  2315. { 27, 18, 9, 9, IPA_EE_AP } },
  2316. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  2317. [IPA_4_5][IPA_CLIENT_DUMMY_CONS] = {
  2318. true, IPA_v4_5_GROUP_UL_DL,
  2319. false,
  2320. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2321. QMB_MASTER_SELECT_DDR,
  2322. { 31, 31, 8, 8, IPA_EE_AP } },
  2323. /* IPA_4_5_MHI */
  2324. [IPA_4_5_MHI][IPA_CLIENT_APPS_CMD_PROD] = {
  2325. true, IPA_v4_5_MHI_GROUP_DDR,
  2326. false,
  2327. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2328. QMB_MASTER_SELECT_DDR,
  2329. { 7, 9, 20, 24, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2330. [IPA_4_5_MHI][IPA_CLIENT_Q6_WAN_PROD] = {
  2331. true, IPA_v4_5_MHI_GROUP_DDR,
  2332. true,
  2333. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2334. QMB_MASTER_SELECT_DDR,
  2335. { 5, 0, 16, 28, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2336. [IPA_4_5_MHI][IPA_CLIENT_Q6_CMD_PROD] = {
  2337. true, IPA_v4_5_MHI_GROUP_PCIE,
  2338. false,
  2339. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  2340. QMB_MASTER_SELECT_DDR,
  2341. { 6, 1, 20, 24, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2342. [IPA_4_5_MHI][IPA_CLIENT_Q6_DL_NLO_DATA_PROD] = {
  2343. true, IPA_v4_5_MHI_GROUP_DDR,
  2344. true,
  2345. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2346. QMB_MASTER_SELECT_DDR,
  2347. { 8, 2, 27, 32, IPA_EE_Q6, GSI_FREE_PRE_FETCH, 3 } },
  2348. [IPA_4_5_MHI][IPA_CLIENT_Q6_AUDIO_DMA_MHI_PROD] = {
  2349. true, IPA_v4_5_MHI_GROUP_DMA,
  2350. false,
  2351. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2352. QMB_MASTER_SELECT_DDR,
  2353. { 4, 8, 8, 16, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 3 } },
  2354. [IPA_4_5_MHI][IPA_CLIENT_MHI_PROD] = {
  2355. true, IPA_v4_5_MHI_GROUP_PCIE,
  2356. true,
  2357. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2358. QMB_MASTER_SELECT_PCIE,
  2359. { 1, 0, 16, 20, IPA_EE_AP, GSI_SMART_PRE_FETCH, 7 } },
  2360. [IPA_4_5_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
  2361. true, IPA_v4_5_MHI_GROUP_DMA,
  2362. false,
  2363. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2364. QMB_MASTER_SELECT_DDR,
  2365. { 9, 12, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2366. [IPA_4_5_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
  2367. true, IPA_v4_5_MHI_GROUP_DMA,
  2368. false,
  2369. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2370. QMB_MASTER_SELECT_DDR,
  2371. { 10, 13, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2372. /* Only for test purpose */
  2373. [IPA_4_5_MHI][IPA_CLIENT_TEST_PROD] = {
  2374. true, QMB_MASTER_SELECT_DDR,
  2375. true,
  2376. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2377. QMB_MASTER_SELECT_DDR,
  2378. { 1, 0, 8, 16, IPA_EE_AP } },
  2379. [IPA_4_5_MHI][IPA_CLIENT_APPS_LAN_CONS] = {
  2380. true, IPA_v4_5_MHI_GROUP_DDR,
  2381. false,
  2382. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2383. QMB_MASTER_SELECT_DDR,
  2384. { 16, 10, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2385. [IPA_4_5_MHI][IPA_CLIENT_USB_DPL_CONS] = {
  2386. true, IPA_v4_5_MHI_GROUP_DDR,
  2387. false,
  2388. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2389. QMB_MASTER_SELECT_DDR,
  2390. { 15, 15, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2391. [IPA_4_5_MHI][IPA_CLIENT_Q6_LAN_CONS] = {
  2392. true, IPA_v4_5_MHI_GROUP_DDR,
  2393. false,
  2394. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2395. QMB_MASTER_SELECT_DDR,
  2396. { 17, 3, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2397. [IPA_4_5_MHI][IPA_CLIENT_Q6_WAN_CONS] = {
  2398. true, IPA_v4_5_MHI_GROUP_DDR,
  2399. false,
  2400. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2401. QMB_MASTER_SELECT_DDR,
  2402. { 21, 7, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2403. [IPA_4_5_MHI][IPA_CLIENT_Q6_UL_NLO_DATA_CONS] = {
  2404. true, IPA_v4_5_MHI_GROUP_DDR,
  2405. false,
  2406. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2407. QMB_MASTER_SELECT_DDR,
  2408. { 19, 5, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2409. [IPA_4_5_MHI][IPA_CLIENT_Q6_UL_NLO_ACK_CONS] = {
  2410. true, IPA_v4_5_MHI_GROUP_DDR,
  2411. false,
  2412. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2413. QMB_MASTER_SELECT_DDR,
  2414. { 20, 6, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2415. [IPA_4_5_MHI][IPA_CLIENT_Q6_QBAP_STATUS_CONS] = {
  2416. true, IPA_v4_5_MHI_GROUP_DDR,
  2417. false,
  2418. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2419. QMB_MASTER_SELECT_DDR,
  2420. { 18, 4, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2421. [IPA_4_5_MHI][IPA_CLIENT_Q6_AUDIO_DMA_MHI_CONS] = {
  2422. true, IPA_v4_5_MHI_GROUP_DMA,
  2423. false,
  2424. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2425. QMB_MASTER_SELECT_PCIE,
  2426. { 29, 9, 9, 9, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 4 } },
  2427. [IPA_4_5_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
  2428. true, IPA_v4_5_MHI_GROUP_DMA,
  2429. false,
  2430. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2431. QMB_MASTER_SELECT_PCIE,
  2432. { 26, 17, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2433. [IPA_4_5_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
  2434. true, IPA_v4_5_MHI_GROUP_DMA,
  2435. false,
  2436. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2437. QMB_MASTER_SELECT_PCIE,
  2438. { 27, 18, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2439. [IPA_4_5_MHI][IPA_CLIENT_MHI_CONS] = {
  2440. true, IPA_v4_5_MHI_GROUP_PCIE,
  2441. false,
  2442. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2443. QMB_MASTER_SELECT_PCIE,
  2444. { 14, 1, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 4 } },
  2445. [IPA_4_5_MHI][IPA_CLIENT_MHI_DPL_CONS] = {
  2446. true, IPA_v4_5_MHI_GROUP_PCIE,
  2447. false,
  2448. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2449. QMB_MASTER_SELECT_PCIE,
  2450. { 22, 2, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2451. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  2452. [IPA_4_5_MHI][IPA_CLIENT_DUMMY_CONS] = {
  2453. true, QMB_MASTER_SELECT_DDR,
  2454. false,
  2455. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2456. QMB_MASTER_SELECT_DDR,
  2457. { 31, 31, 8, 8, IPA_EE_AP } },
  2458. /* IPA_4_5 APQ */
  2459. [IPA_4_5_APQ][IPA_CLIENT_WLAN2_PROD] = {
  2460. true, IPA_v4_5_GROUP_UL_DL,
  2461. true,
  2462. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2463. QMB_MASTER_SELECT_DDR,
  2464. { 9, 3, 8, 16, IPA_EE_AP, GSI_FREE_PRE_FETCH, 2 } },
  2465. [IPA_4_5_APQ][IPA_CLIENT_WIGIG_PROD] = {
  2466. true, IPA_v4_5_GROUP_UL_DL,
  2467. true,
  2468. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2469. QMB_MASTER_SELECT_DDR,
  2470. { 1, 1, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2471. [IPA_4_5_APQ][IPA_CLIENT_USB_PROD] = {
  2472. true, IPA_v4_5_GROUP_UL_DL,
  2473. true,
  2474. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2475. QMB_MASTER_SELECT_DDR,
  2476. { 0, 0, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2477. [IPA_4_5_APQ][IPA_CLIENT_APPS_LAN_PROD] = {
  2478. true, IPA_v4_5_GROUP_UL_DL,
  2479. false,
  2480. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2481. QMB_MASTER_SELECT_DDR,
  2482. { 11, 4, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2483. [IPA_4_5_APQ][IPA_CLIENT_APPS_CMD_PROD] = {
  2484. true, IPA_v4_5_GROUP_UL_DL,
  2485. false,
  2486. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2487. QMB_MASTER_SELECT_DDR,
  2488. { 7, 12, 20, 24, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2489. /* MHI PRIME PIPES - Client producer / IPA Consumer pipes */
  2490. [IPA_4_5_APQ][IPA_CLIENT_MHI_PRIME_DPL_PROD] = {
  2491. true, IPA_v4_5_GROUP_UL_DL,
  2492. true,
  2493. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2494. QMB_MASTER_SELECT_DDR,
  2495. {3, 2, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2496. [IPA_4_5_APQ][IPA_CLIENT_MHI_PRIME_TETH_PROD] = {
  2497. true, IPA_v4_5_GROUP_UL_DL,
  2498. true,
  2499. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2500. QMB_MASTER_SELECT_DDR,
  2501. { 2, 7, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2502. [IPA_4_5_APQ][IPA_CLIENT_MHI_PRIME_RMNET_PROD] = {
  2503. true, IPA_v4_5_GROUP_UL_DL,
  2504. true,
  2505. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2506. QMB_MASTER_SELECT_DDR,
  2507. { 4, 11, 16, 32, IPA_EE_AP, GSI_SMART_PRE_FETCH, 7 } },
  2508. /* Only for test purpose */
  2509. [IPA_4_5_APQ][IPA_CLIENT_TEST_PROD] = {
  2510. true, IPA_v4_5_GROUP_UL_DL,
  2511. true,
  2512. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2513. QMB_MASTER_SELECT_DDR,
  2514. { 0, 0, 8, 16, IPA_EE_AP } },
  2515. [IPA_4_5_APQ][IPA_CLIENT_TEST1_PROD] = {
  2516. true, IPA_v4_5_GROUP_UL_DL,
  2517. true,
  2518. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2519. QMB_MASTER_SELECT_DDR,
  2520. { 0, 0, 8, 16, IPA_EE_AP } },
  2521. [IPA_4_5_APQ][IPA_CLIENT_TEST2_PROD] = {
  2522. true, IPA_v4_5_GROUP_UL_DL,
  2523. true,
  2524. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2525. QMB_MASTER_SELECT_DDR,
  2526. { 1, 1, 8, 16, IPA_EE_AP } },
  2527. [IPA_4_5_APQ][IPA_CLIENT_TEST3_PROD] = {
  2528. true, IPA_v4_5_GROUP_UL_DL,
  2529. true,
  2530. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2531. QMB_MASTER_SELECT_DDR,
  2532. { 9, 3, 8, 16, IPA_EE_AP } },
  2533. [IPA_4_5_APQ][IPA_CLIENT_TEST4_PROD] = {
  2534. true, IPA_v4_5_GROUP_UL_DL,
  2535. true,
  2536. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2537. QMB_MASTER_SELECT_DDR,
  2538. { 10, 10, 8, 16, IPA_EE_AP } },
  2539. [IPA_4_5_APQ][IPA_CLIENT_WLAN2_CONS] = {
  2540. true, IPA_v4_5_GROUP_UL_DL,
  2541. false,
  2542. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2543. QMB_MASTER_SELECT_DDR,
  2544. { 23, 8, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2545. [IPA_4_5_APQ][IPA_CLIENT_WIGIG1_CONS] = {
  2546. true, IPA_v4_5_GROUP_UL_DL,
  2547. false,
  2548. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2549. QMB_MASTER_SELECT_DDR,
  2550. { 14, 14, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2551. [IPA_4_5_APQ][IPA_CLIENT_WIGIG2_CONS] = {
  2552. true, IPA_v4_5_GROUP_UL_DL,
  2553. false,
  2554. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2555. QMB_MASTER_SELECT_DDR,
  2556. { 20, 18, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2557. [IPA_4_5_APQ][IPA_CLIENT_WIGIG3_CONS] = {
  2558. true, IPA_v4_5_GROUP_UL_DL,
  2559. false,
  2560. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2561. QMB_MASTER_SELECT_DDR,
  2562. { 22, 5, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2563. [IPA_4_5_APQ][IPA_CLIENT_WIGIG4_CONS] = {
  2564. true, IPA_v4_5_GROUP_UL_DL,
  2565. false,
  2566. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2567. QMB_MASTER_SELECT_DDR,
  2568. { 29, 10, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2569. [IPA_4_5_APQ][IPA_CLIENT_USB_CONS] = {
  2570. true, IPA_v4_5_GROUP_UL_DL,
  2571. false,
  2572. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2573. QMB_MASTER_SELECT_DDR,
  2574. { 24, 9, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2575. [IPA_4_5_APQ][IPA_CLIENT_USB_DPL_CONS] = {
  2576. true, IPA_v4_5_GROUP_UL_DL,
  2577. false,
  2578. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2579. QMB_MASTER_SELECT_DDR,
  2580. { 16, 16, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2581. [IPA_4_5_APQ][IPA_CLIENT_APPS_LAN_CONS] = {
  2582. true, IPA_v4_5_GROUP_UL_DL,
  2583. false,
  2584. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2585. QMB_MASTER_SELECT_DDR,
  2586. { 13, 13, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2587. [IPA_4_5_APQ][IPA_CLIENT_ODL_DPL_CONS] = {
  2588. true, IPA_v4_5_GROUP_UL_DL,
  2589. false,
  2590. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2591. QMB_MASTER_SELECT_DDR,
  2592. { 21, 19, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2593. /* MHI PRIME PIPES - Client Consumer / IPA Producer pipes */
  2594. [IPA_4_5_APQ][IPA_CLIENT_MHI_PRIME_TETH_CONS] = {
  2595. true, IPA_v4_5_GROUP_UL_DL,
  2596. false,
  2597. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2598. QMB_MASTER_SELECT_DDR,
  2599. { 28, 6, 8, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2600. [IPA_4_5_APQ][IPA_CLIENT_MHI_PRIME_RMNET_CONS] = {
  2601. true, IPA_v4_5_GROUP_UL_DL,
  2602. false,
  2603. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2604. QMB_MASTER_SELECT_DDR,
  2605. { 17, 17, 8, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 4 } },
  2606. /* Only for test purpose */
  2607. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  2608. [IPA_4_5_APQ][IPA_CLIENT_TEST_CONS] = {
  2609. true, IPA_v4_5_GROUP_UL_DL,
  2610. false,
  2611. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2612. QMB_MASTER_SELECT_DDR,
  2613. { 16, 16, 5, 5, IPA_EE_AP } },
  2614. [IPA_4_5_APQ][IPA_CLIENT_TEST1_CONS] = {
  2615. true, IPA_v4_5_GROUP_UL_DL,
  2616. false,
  2617. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2618. QMB_MASTER_SELECT_DDR,
  2619. { 16, 16, 5, 5, IPA_EE_AP } },
  2620. [IPA_4_5_APQ][IPA_CLIENT_TEST2_CONS] = {
  2621. true, IPA_v4_5_GROUP_UL_DL,
  2622. false,
  2623. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2624. QMB_MASTER_SELECT_DDR,
  2625. { 22, 5, 9, 9, IPA_EE_AP } },
  2626. [IPA_4_5_APQ][IPA_CLIENT_TEST3_CONS] = {
  2627. true, IPA_v4_5_GROUP_UL_DL,
  2628. false,
  2629. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2630. QMB_MASTER_SELECT_DDR,
  2631. { 24, 9, 9, 9, IPA_EE_AP } },
  2632. [IPA_4_5_APQ][IPA_CLIENT_TEST4_CONS] = {
  2633. true, IPA_v4_5_GROUP_UL_DL,
  2634. false,
  2635. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2636. QMB_MASTER_SELECT_DDR,
  2637. { 23, 8, 8, 13, IPA_EE_AP } },
  2638. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  2639. [IPA_4_5_APQ][IPA_CLIENT_DUMMY_CONS] = {
  2640. true, IPA_v4_5_GROUP_UL_DL,
  2641. false,
  2642. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2643. QMB_MASTER_SELECT_DDR,
  2644. { 31, 31, 8, 8, IPA_EE_AP } },
  2645. /* IPA_4_7 */
  2646. [IPA_4_7][IPA_CLIENT_WLAN1_PROD] = {
  2647. true, IPA_v4_7_GROUP_UL_DL,
  2648. true,
  2649. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2650. QMB_MASTER_SELECT_DDR,
  2651. { 3, 3, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2652. [IPA_4_7][IPA_CLIENT_USB_PROD] = {
  2653. true, IPA_v4_7_GROUP_UL_DL,
  2654. true,
  2655. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2656. QMB_MASTER_SELECT_DDR,
  2657. { 0, 0, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2658. [IPA_4_7][IPA_CLIENT_APPS_LAN_PROD] = {
  2659. true, IPA_v4_7_GROUP_UL_DL,
  2660. false,
  2661. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2662. QMB_MASTER_SELECT_DDR,
  2663. { 4, 4, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2664. [IPA_4_7][IPA_CLIENT_APPS_WAN_PROD] = {
  2665. true, IPA_v4_7_GROUP_UL_DL,
  2666. true,
  2667. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2668. QMB_MASTER_SELECT_DDR,
  2669. { 2, 2, 16, 32, IPA_EE_AP, GSI_SMART_PRE_FETCH, 7 } },
  2670. [IPA_4_7][IPA_CLIENT_APPS_CMD_PROD] = {
  2671. true, IPA_v4_7_GROUP_UL_DL,
  2672. false,
  2673. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2674. QMB_MASTER_SELECT_DDR,
  2675. { 7, 5, 20, 24, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 8 } },
  2676. [IPA_4_7][IPA_CLIENT_Q6_WAN_PROD] = {
  2677. true, IPA_v4_7_GROUP_UL_DL,
  2678. true,
  2679. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2680. QMB_MASTER_SELECT_DDR,
  2681. { 5, 0, 16, 28, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2682. [IPA_4_7][IPA_CLIENT_Q6_CMD_PROD] = {
  2683. true, IPA_v4_7_GROUP_UL_DL,
  2684. false,
  2685. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  2686. QMB_MASTER_SELECT_DDR,
  2687. { 6, 1, 20, 24, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 8 } },
  2688. [IPA_4_7][IPA_CLIENT_Q6_DL_NLO_DATA_PROD] = {
  2689. true, IPA_v4_7_GROUP_UL_DL,
  2690. true,
  2691. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2692. QMB_MASTER_SELECT_DDR,
  2693. { 8, 2, 27, 32, IPA_EE_Q6, GSI_FREE_PRE_FETCH, 3 } },
  2694. /* Only for test purpose */
  2695. [IPA_4_7][IPA_CLIENT_TEST_PROD] = {
  2696. true, IPA_v4_7_GROUP_UL_DL,
  2697. true,
  2698. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2699. QMB_MASTER_SELECT_DDR,
  2700. { 0, 0, 8, 16, IPA_EE_AP } },
  2701. [IPA_4_7][IPA_CLIENT_TEST1_PROD] = {
  2702. true, IPA_v4_7_GROUP_UL_DL,
  2703. true,
  2704. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2705. QMB_MASTER_SELECT_DDR,
  2706. { 0, 0, 8, 16, IPA_EE_AP } },
  2707. [IPA_4_7][IPA_CLIENT_TEST2_PROD] = {
  2708. true, IPA_v4_7_GROUP_UL_DL,
  2709. true,
  2710. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2711. QMB_MASTER_SELECT_DDR,
  2712. { 1, 1, 8, 16, IPA_EE_AP } },
  2713. [IPA_4_7][IPA_CLIENT_TEST3_PROD] = {
  2714. true, IPA_v4_7_GROUP_UL_DL,
  2715. true,
  2716. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2717. QMB_MASTER_SELECT_DDR,
  2718. { 2, 2, 16, 32, IPA_EE_AP } },
  2719. [IPA_4_7][IPA_CLIENT_TEST4_PROD] = {
  2720. true, IPA_v4_7_GROUP_UL_DL,
  2721. true,
  2722. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2723. QMB_MASTER_SELECT_DDR,
  2724. { 1, 1, 8, 16, IPA_EE_AP } },
  2725. [IPA_4_7][IPA_CLIENT_WLAN1_CONS] = {
  2726. true, IPA_v4_7_GROUP_UL_DL,
  2727. false,
  2728. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2729. QMB_MASTER_SELECT_DDR,
  2730. { 18, 9, 8, 13, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2731. [IPA_4_7][IPA_CLIENT_USB_CONS] = {
  2732. true, IPA_v4_7_GROUP_UL_DL,
  2733. false,
  2734. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2735. QMB_MASTER_SELECT_DDR,
  2736. { 19, 10, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2737. [IPA_4_7][IPA_CLIENT_USB_DPL_CONS] = {
  2738. true, IPA_v4_7_GROUP_UL_DL,
  2739. false,
  2740. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2741. QMB_MASTER_SELECT_DDR,
  2742. { 17, 8, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2743. [IPA_4_7][IPA_CLIENT_ODL_DPL_CONS] = {
  2744. true, IPA_v4_7_GROUP_UL_DL,
  2745. false,
  2746. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2747. QMB_MASTER_SELECT_DDR,
  2748. { 22, 13, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2749. [IPA_4_7][IPA_CLIENT_APPS_LAN_CONS] = {
  2750. true, IPA_v4_7_GROUP_UL_DL,
  2751. false,
  2752. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2753. QMB_MASTER_SELECT_DDR,
  2754. { 9, 14, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2755. [IPA_4_7][IPA_CLIENT_APPS_WAN_CONS] = {
  2756. true, IPA_v4_7_GROUP_UL_DL,
  2757. false,
  2758. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2759. QMB_MASTER_SELECT_DDR,
  2760. { 16, 7, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2761. [IPA_4_7][IPA_CLIENT_APPS_WAN_COAL_CONS] = {
  2762. true, IPA_v4_7_GROUP_UL_DL,
  2763. false,
  2764. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2765. QMB_MASTER_SELECT_DDR,
  2766. { 15, 6, 8, 11, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2767. [IPA_4_7][IPA_CLIENT_Q6_LAN_CONS] = {
  2768. true, IPA_v4_7_GROUP_UL_DL,
  2769. false,
  2770. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2771. QMB_MASTER_SELECT_DDR,
  2772. { 10, 3, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2773. [IPA_4_7][IPA_CLIENT_Q6_WAN_CONS] = {
  2774. true, IPA_v4_7_GROUP_UL_DL,
  2775. false,
  2776. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2777. QMB_MASTER_SELECT_DDR,
  2778. { 14, 7, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2779. [IPA_4_7][IPA_CLIENT_Q6_UL_NLO_DATA_CONS] = {
  2780. true, IPA_v4_7_GROUP_UL_DL,
  2781. false,
  2782. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2783. QMB_MASTER_SELECT_DDR,
  2784. { 12, 5, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2785. [IPA_4_7][IPA_CLIENT_Q6_UL_NLO_ACK_CONS] = {
  2786. true, IPA_v4_7_GROUP_UL_DL,
  2787. false,
  2788. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2789. QMB_MASTER_SELECT_DDR,
  2790. { 13, 6, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2791. [IPA_4_7][IPA_CLIENT_Q6_QBAP_STATUS_CONS] = {
  2792. true, IPA_v4_7_GROUP_UL_DL,
  2793. false,
  2794. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2795. QMB_MASTER_SELECT_DDR,
  2796. { 11, 4, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2797. /* Only for test purpose */
  2798. /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
  2799. [IPA_4_7][IPA_CLIENT_TEST_CONS] = {
  2800. true, IPA_v4_7_GROUP_UL_DL,
  2801. false,
  2802. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2803. QMB_MASTER_SELECT_DDR,
  2804. { 16, 7, 9, 9, IPA_EE_AP } },
  2805. [IPA_4_7][IPA_CLIENT_TEST1_CONS] = {
  2806. true, IPA_v4_7_GROUP_UL_DL,
  2807. false,
  2808. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2809. QMB_MASTER_SELECT_DDR,
  2810. { 16, 7, 9, 9, IPA_EE_AP } },
  2811. [IPA_4_7][IPA_CLIENT_TEST2_CONS] = {
  2812. true, IPA_v4_7_GROUP_UL_DL,
  2813. false,
  2814. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2815. QMB_MASTER_SELECT_DDR,
  2816. { 21, 12, 9, 9, IPA_EE_AP } },
  2817. [IPA_4_7][IPA_CLIENT_TEST3_CONS] = {
  2818. true, IPA_v4_7_GROUP_UL_DL,
  2819. false,
  2820. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2821. QMB_MASTER_SELECT_DDR,
  2822. { 19, 10, 9, 9, IPA_EE_AP } },
  2823. [IPA_4_7][IPA_CLIENT_TEST4_CONS] = {
  2824. true, IPA_v4_7_GROUP_UL_DL,
  2825. false,
  2826. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2827. QMB_MASTER_SELECT_DDR,
  2828. { 20, 11, 9, 9, IPA_EE_AP } },
  2829. /* Dummy consumer (pipe 31) is used in L2TP rt rule */
  2830. [IPA_4_7][IPA_CLIENT_DUMMY_CONS] = {
  2831. true, IPA_v4_7_GROUP_UL_DL,
  2832. false,
  2833. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2834. QMB_MASTER_SELECT_DDR,
  2835. { 31, 31, 8, 8, IPA_EE_AP } },
  2836. /* IPA_4_9 */
  2837. [IPA_4_9][IPA_CLIENT_USB_PROD] = {
  2838. true, IPA_v4_9_GROUP_UL_DL,
  2839. true,
  2840. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2841. QMB_MASTER_SELECT_DDR,
  2842. { 0, 0, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2843. [IPA_4_9][IPA_CLIENT_APPS_WAN_PROD] = {
  2844. true, IPA_v4_9_GROUP_UL_DL,
  2845. true,
  2846. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2847. QMB_MASTER_SELECT_DDR,
  2848. { 2, 2, 16, 32, IPA_EE_AP, GSI_SMART_PRE_FETCH, 8 } },
  2849. [IPA_4_9][IPA_CLIENT_WLAN1_PROD] = {
  2850. true, IPA_v4_9_GROUP_UL_DL,
  2851. true,
  2852. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2853. QMB_MASTER_SELECT_DDR,
  2854. { 3, 3, 8, 16, IPA_EE_AP, GSI_FREE_PRE_FETCH, 2 } },
  2855. [IPA_4_9][IPA_CLIENT_APPS_LAN_PROD] = {
  2856. true, IPA_v4_9_GROUP_UL_DL,
  2857. false,
  2858. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2859. QMB_MASTER_SELECT_DDR,
  2860. { 4, 4, 10, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 2 } },
  2861. [IPA_4_9][IPA_CLIENT_WIGIG_PROD] = {
  2862. true, IPA_v4_9_GROUP_UL_DL,
  2863. true,
  2864. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
  2865. QMB_MASTER_SELECT_DDR,
  2866. { 9, 5, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2867. [IPA_4_9][IPA_CLIENT_APPS_CMD_PROD] = {
  2868. true, IPA_v4_9_GROUP_UL_DL,
  2869. false,
  2870. IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
  2871. QMB_MASTER_SELECT_DDR,
  2872. { 7, 6, 20, 24, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2873. [IPA_4_9][IPA_CLIENT_Q6_WAN_PROD] = {
  2874. true, IPA_v4_9_GROUP_UL_DL,
  2875. true,
  2876. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2877. QMB_MASTER_SELECT_DDR,
  2878. { 5, 0, 16, 28, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2879. [IPA_4_9][IPA_CLIENT_Q6_CMD_PROD] = {
  2880. true, IPA_v4_9_GROUP_UL_DL,
  2881. false,
  2882. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
  2883. QMB_MASTER_SELECT_DDR,
  2884. { 6, 1, 20, 24, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2885. [IPA_4_9][IPA_CLIENT_Q6_DL_NLO_DATA_PROD] = {
  2886. true, IPA_v4_9_GROUP_UL_DL,
  2887. true,
  2888. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP,
  2889. QMB_MASTER_SELECT_DDR,
  2890. { 8, 2, 27, 32, IPA_EE_Q6, GSI_FREE_PRE_FETCH, 3 } },
  2891. [IPA_4_9][IPA_CLIENT_APPS_WAN_COAL_CONS] = {
  2892. true, IPA_v4_9_GROUP_UL_DL,
  2893. false,
  2894. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2895. QMB_MASTER_SELECT_DDR,
  2896. { 19, 11, 8, 11, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2897. [IPA_4_9][IPA_CLIENT_APPS_WAN_CONS] = {
  2898. true, IPA_v4_9_GROUP_UL_DL,
  2899. false,
  2900. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2901. QMB_MASTER_SELECT_DDR,
  2902. { 20, 12, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2903. [IPA_4_9][IPA_CLIENT_USB_DPL_CONS] = {
  2904. true, IPA_v4_9_GROUP_UL_DL,
  2905. false,
  2906. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2907. QMB_MASTER_SELECT_DDR,
  2908. { 21, 13, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2909. [IPA_4_9][IPA_CLIENT_ODL_DPL_CONS] = {
  2910. true, IPA_v4_9_GROUP_UL_DL,
  2911. false,
  2912. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2913. QMB_MASTER_SELECT_DDR,
  2914. { 22, 14, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2915. [IPA_4_9][IPA_CLIENT_WIGIG1_CONS] = {
  2916. true, IPA_v4_9_GROUP_UL_DL,
  2917. false,
  2918. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2919. QMB_MASTER_SELECT_DDR,
  2920. { 23, 15, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 2 } },
  2921. [IPA_4_9][IPA_CLIENT_WLAN1_CONS] = {
  2922. true, IPA_v4_9_GROUP_UL_DL,
  2923. false,
  2924. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2925. QMB_MASTER_SELECT_DDR,
  2926. { 24, 16, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 } },
  2927. [IPA_4_9][IPA_CLIENT_USB_CONS] = {
  2928. true, IPA_v4_9_GROUP_UL_DL,
  2929. false,
  2930. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2931. QMB_MASTER_SELECT_DDR,
  2932. { 25, 17, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2933. [IPA_4_9][IPA_CLIENT_WIGIG2_CONS] = {
  2934. true, IPA_v4_9_GROUP_UL_DL,
  2935. false,
  2936. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2937. QMB_MASTER_SELECT_DDR,
  2938. { 26, 18, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 2 } },
  2939. [IPA_4_9][IPA_CLIENT_WIGIG3_CONS] = {
  2940. true, IPA_v4_9_GROUP_UL_DL,
  2941. false,
  2942. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2943. QMB_MASTER_SELECT_DDR,
  2944. { 27, 19, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 2 } },
  2945. [IPA_4_9][IPA_CLIENT_WIGIG4_CONS] = {
  2946. true, IPA_v4_9_GROUP_UL_DL,
  2947. false,
  2948. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2949. QMB_MASTER_SELECT_DDR,
  2950. { 28, 20, 8, 14, IPA_EE_AP, GSI_SMART_PRE_FETCH, 2 } },
  2951. [IPA_4_9][IPA_CLIENT_APPS_LAN_CONS] = {
  2952. true, IPA_v4_9_GROUP_UL_DL,
  2953. false,
  2954. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2955. QMB_MASTER_SELECT_DDR,
  2956. { 11, 7, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 } },
  2957. [IPA_4_9][IPA_CLIENT_Q6_LAN_CONS] = {
  2958. true, IPA_v4_9_GROUP_UL_DL,
  2959. false,
  2960. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2961. QMB_MASTER_SELECT_DDR,
  2962. { 12, 3, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2963. [IPA_4_9][IPA_CLIENT_Q6_QBAP_STATUS_CONS] = {
  2964. true, IPA_v4_9_GROUP_UL_DL,
  2965. false,
  2966. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2967. QMB_MASTER_SELECT_DDR,
  2968. { 13, 4, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2969. [IPA_4_9][IPA_CLIENT_Q6_UL_NLO_DATA_CONS] = {
  2970. true, IPA_v4_9_GROUP_UL_DL,
  2971. false,
  2972. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2973. QMB_MASTER_SELECT_DDR,
  2974. { 14, 5, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2975. [IPA_4_9][IPA_CLIENT_Q6_UL_NLO_ACK_CONS] = {
  2976. true, IPA_v4_9_GROUP_UL_DL,
  2977. false,
  2978. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2979. QMB_MASTER_SELECT_DDR,
  2980. { 15, 6, 5, 5, IPA_EE_Q6, GSI_SMART_PRE_FETCH, 2 } },
  2981. [IPA_4_9][IPA_CLIENT_Q6_WAN_CONS] = {
  2982. true, IPA_v4_9_GROUP_UL_DL,
  2983. false,
  2984. IPA_DPS_HPS_SEQ_TYPE_INVALID,
  2985. QMB_MASTER_SELECT_DDR,
  2986. { 16, 7, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 } },
  2987. };
  2988. static struct ipa3_mem_partition ipa_4_1_mem_part = {
  2989. .ofst_start = 0x280,
  2990. .v4_flt_hash_ofst = 0x288,
  2991. .v4_flt_hash_size = 0x78,
  2992. .v4_flt_hash_size_ddr = 0x4000,
  2993. .v4_flt_nhash_ofst = 0x308,
  2994. .v4_flt_nhash_size = 0x78,
  2995. .v4_flt_nhash_size_ddr = 0x4000,
  2996. .v6_flt_hash_ofst = 0x388,
  2997. .v6_flt_hash_size = 0x78,
  2998. .v6_flt_hash_size_ddr = 0x4000,
  2999. .v6_flt_nhash_ofst = 0x408,
  3000. .v6_flt_nhash_size = 0x78,
  3001. .v6_flt_nhash_size_ddr = 0x4000,
  3002. .v4_rt_num_index = 0xf,
  3003. .v4_modem_rt_index_lo = 0x0,
  3004. .v4_modem_rt_index_hi = 0x7,
  3005. .v4_apps_rt_index_lo = 0x8,
  3006. .v4_apps_rt_index_hi = 0xe,
  3007. .v4_rt_hash_ofst = 0x488,
  3008. .v4_rt_hash_size = 0x78,
  3009. .v4_rt_hash_size_ddr = 0x4000,
  3010. .v4_rt_nhash_ofst = 0x508,
  3011. .v4_rt_nhash_size = 0x78,
  3012. .v4_rt_nhash_size_ddr = 0x4000,
  3013. .v6_rt_num_index = 0xf,
  3014. .v6_modem_rt_index_lo = 0x0,
  3015. .v6_modem_rt_index_hi = 0x7,
  3016. .v6_apps_rt_index_lo = 0x8,
  3017. .v6_apps_rt_index_hi = 0xe,
  3018. .v6_rt_hash_ofst = 0x588,
  3019. .v6_rt_hash_size = 0x78,
  3020. .v6_rt_hash_size_ddr = 0x4000,
  3021. .v6_rt_nhash_ofst = 0x608,
  3022. .v6_rt_nhash_size = 0x78,
  3023. .v6_rt_nhash_size_ddr = 0x4000,
  3024. .modem_hdr_ofst = 0x688,
  3025. .modem_hdr_size = 0x140,
  3026. .apps_hdr_ofst = 0x7c8,
  3027. .apps_hdr_size = 0x0,
  3028. .apps_hdr_size_ddr = 0x800,
  3029. .modem_hdr_proc_ctx_ofst = 0x7d0,
  3030. .modem_hdr_proc_ctx_size = 0x200,
  3031. .apps_hdr_proc_ctx_ofst = 0x9d0,
  3032. .apps_hdr_proc_ctx_size = 0x200,
  3033. .apps_hdr_proc_ctx_size_ddr = 0x0,
  3034. .modem_comp_decomp_ofst = 0x0,
  3035. .modem_comp_decomp_size = 0x0,
  3036. .modem_ofst = 0x13f0,
  3037. .modem_size = 0x100c,
  3038. .apps_v4_flt_hash_ofst = 0x23fc,
  3039. .apps_v4_flt_hash_size = 0x0,
  3040. .apps_v4_flt_nhash_ofst = 0x23fc,
  3041. .apps_v4_flt_nhash_size = 0x0,
  3042. .apps_v6_flt_hash_ofst = 0x23fc,
  3043. .apps_v6_flt_hash_size = 0x0,
  3044. .apps_v6_flt_nhash_ofst = 0x23fc,
  3045. .apps_v6_flt_nhash_size = 0x0,
  3046. .uc_info_ofst = 0x80,
  3047. .uc_info_size = 0x200,
  3048. .end_ofst = 0x2800,
  3049. .apps_v4_rt_hash_ofst = 0x23fc,
  3050. .apps_v4_rt_hash_size = 0x0,
  3051. .apps_v4_rt_nhash_ofst = 0x23fc,
  3052. .apps_v4_rt_nhash_size = 0x0,
  3053. .apps_v6_rt_hash_ofst = 0x23fc,
  3054. .apps_v6_rt_hash_size = 0x0,
  3055. .apps_v6_rt_nhash_ofst = 0x23fc,
  3056. .apps_v6_rt_nhash_size = 0x0,
  3057. .uc_descriptor_ram_ofst = 0x2400,
  3058. .uc_descriptor_ram_size = 0x400,
  3059. .pdn_config_ofst = 0xbd8,
  3060. .pdn_config_size = 0x50,
  3061. .stats_quota_ofst = 0xc30,
  3062. .stats_quota_size = 0x60,
  3063. .stats_tethering_ofst = 0xc90,
  3064. .stats_tethering_size = 0x140,
  3065. .stats_flt_v4_ofst = 0xdd0,
  3066. .stats_flt_v4_size = 0x180,
  3067. .stats_flt_v6_ofst = 0xf50,
  3068. .stats_flt_v6_size = 0x180,
  3069. .stats_rt_v4_ofst = 0x10d0,
  3070. .stats_rt_v4_size = 0x180,
  3071. .stats_rt_v6_ofst = 0x1250,
  3072. .stats_rt_v6_size = 0x180,
  3073. .stats_drop_ofst = 0x13d0,
  3074. .stats_drop_size = 0x20,
  3075. };
  3076. static struct ipa3_mem_partition ipa_4_2_mem_part = {
  3077. .ofst_start = 0x280,
  3078. .v4_flt_hash_ofst = 0x288,
  3079. .v4_flt_hash_size = 0x0,
  3080. .v4_flt_hash_size_ddr = 0x0,
  3081. .v4_flt_nhash_ofst = 0x290,
  3082. .v4_flt_nhash_size = 0x78,
  3083. .v4_flt_nhash_size_ddr = 0x4000,
  3084. .v6_flt_hash_ofst = 0x310,
  3085. .v6_flt_hash_size = 0x0,
  3086. .v6_flt_hash_size_ddr = 0x0,
  3087. .v6_flt_nhash_ofst = 0x318,
  3088. .v6_flt_nhash_size = 0x78,
  3089. .v6_flt_nhash_size_ddr = 0x4000,
  3090. .v4_rt_num_index = 0xf,
  3091. .v4_modem_rt_index_lo = 0x0,
  3092. .v4_modem_rt_index_hi = 0x7,
  3093. .v4_apps_rt_index_lo = 0x8,
  3094. .v4_apps_rt_index_hi = 0xe,
  3095. .v4_rt_hash_ofst = 0x398,
  3096. .v4_rt_hash_size = 0x0,
  3097. .v4_rt_hash_size_ddr = 0x0,
  3098. .v4_rt_nhash_ofst = 0x3A0,
  3099. .v4_rt_nhash_size = 0x78,
  3100. .v4_rt_nhash_size_ddr = 0x4000,
  3101. .v6_rt_num_index = 0xf,
  3102. .v6_modem_rt_index_lo = 0x0,
  3103. .v6_modem_rt_index_hi = 0x7,
  3104. .v6_apps_rt_index_lo = 0x8,
  3105. .v6_apps_rt_index_hi = 0xe,
  3106. .v6_rt_hash_ofst = 0x420,
  3107. .v6_rt_hash_size = 0x0,
  3108. .v6_rt_hash_size_ddr = 0x0,
  3109. .v6_rt_nhash_ofst = 0x428,
  3110. .v6_rt_nhash_size = 0x78,
  3111. .v6_rt_nhash_size_ddr = 0x4000,
  3112. .modem_hdr_ofst = 0x4A8,
  3113. .modem_hdr_size = 0x140,
  3114. .apps_hdr_ofst = 0x5E8,
  3115. .apps_hdr_size = 0x0,
  3116. .apps_hdr_size_ddr = 0x800,
  3117. .modem_hdr_proc_ctx_ofst = 0x5F0,
  3118. .modem_hdr_proc_ctx_size = 0x200,
  3119. .apps_hdr_proc_ctx_ofst = 0x7F0,
  3120. .apps_hdr_proc_ctx_size = 0x200,
  3121. .apps_hdr_proc_ctx_size_ddr = 0x0,
  3122. .modem_comp_decomp_ofst = 0x0,
  3123. .modem_comp_decomp_size = 0x0,
  3124. .modem_ofst = 0xbf0,
  3125. .modem_size = 0x140c,
  3126. .apps_v4_flt_hash_ofst = 0x1bfc,
  3127. .apps_v4_flt_hash_size = 0x0,
  3128. .apps_v4_flt_nhash_ofst = 0x1bfc,
  3129. .apps_v4_flt_nhash_size = 0x0,
  3130. .apps_v6_flt_hash_ofst = 0x1bfc,
  3131. .apps_v6_flt_hash_size = 0x0,
  3132. .apps_v6_flt_nhash_ofst = 0x1bfc,
  3133. .apps_v6_flt_nhash_size = 0x0,
  3134. .uc_info_ofst = 0x80,
  3135. .uc_info_size = 0x200,
  3136. .end_ofst = 0x2000,
  3137. .apps_v4_rt_hash_ofst = 0x1bfc,
  3138. .apps_v4_rt_hash_size = 0x0,
  3139. .apps_v4_rt_nhash_ofst = 0x1bfc,
  3140. .apps_v4_rt_nhash_size = 0x0,
  3141. .apps_v6_rt_hash_ofst = 0x1bfc,
  3142. .apps_v6_rt_hash_size = 0x0,
  3143. .apps_v6_rt_nhash_ofst = 0x1bfc,
  3144. .apps_v6_rt_nhash_size = 0x0,
  3145. .uc_descriptor_ram_ofst = 0x2000,
  3146. .uc_descriptor_ram_size = 0x0,
  3147. .pdn_config_ofst = 0x9F8,
  3148. .pdn_config_size = 0x50,
  3149. .stats_quota_ofst = 0xa50,
  3150. .stats_quota_size = 0x60,
  3151. .stats_tethering_ofst = 0xab0,
  3152. .stats_tethering_size = 0x140,
  3153. .stats_flt_v4_ofst = 0xbf0,
  3154. .stats_flt_v4_size = 0x0,
  3155. .stats_flt_v6_ofst = 0xbf0,
  3156. .stats_flt_v6_size = 0x0,
  3157. .stats_rt_v4_ofst = 0xbf0,
  3158. .stats_rt_v4_size = 0x0,
  3159. .stats_rt_v6_ofst = 0xbf0,
  3160. .stats_rt_v6_size = 0x0,
  3161. .stats_drop_ofst = 0xbf0,
  3162. .stats_drop_size = 0x0,
  3163. };
  3164. static struct ipa3_mem_partition ipa_4_5_mem_part = {
  3165. .uc_info_ofst = 0x80,
  3166. .uc_info_size = 0x200,
  3167. .ofst_start = 0x280,
  3168. .v4_flt_hash_ofst = 0x288,
  3169. .v4_flt_hash_size = 0x78,
  3170. .v4_flt_hash_size_ddr = 0x4000,
  3171. .v4_flt_nhash_ofst = 0x308,
  3172. .v4_flt_nhash_size = 0x78,
  3173. .v4_flt_nhash_size_ddr = 0x4000,
  3174. .v6_flt_hash_ofst = 0x388,
  3175. .v6_flt_hash_size = 0x78,
  3176. .v6_flt_hash_size_ddr = 0x4000,
  3177. .v6_flt_nhash_ofst = 0x408,
  3178. .v6_flt_nhash_size = 0x78,
  3179. .v6_flt_nhash_size_ddr = 0x4000,
  3180. .v4_rt_num_index = 0xf,
  3181. .v4_modem_rt_index_lo = 0x0,
  3182. .v4_modem_rt_index_hi = 0x7,
  3183. .v4_apps_rt_index_lo = 0x8,
  3184. .v4_apps_rt_index_hi = 0xe,
  3185. .v4_rt_hash_ofst = 0x488,
  3186. .v4_rt_hash_size = 0x78,
  3187. .v4_rt_hash_size_ddr = 0x4000,
  3188. .v4_rt_nhash_ofst = 0x508,
  3189. .v4_rt_nhash_size = 0x78,
  3190. .v4_rt_nhash_size_ddr = 0x4000,
  3191. .v6_rt_num_index = 0xf,
  3192. .v6_modem_rt_index_lo = 0x0,
  3193. .v6_modem_rt_index_hi = 0x7,
  3194. .v6_apps_rt_index_lo = 0x8,
  3195. .v6_apps_rt_index_hi = 0xe,
  3196. .v6_rt_hash_ofst = 0x588,
  3197. .v6_rt_hash_size = 0x78,
  3198. .v6_rt_hash_size_ddr = 0x4000,
  3199. .v6_rt_nhash_ofst = 0x608,
  3200. .v6_rt_nhash_size = 0x78,
  3201. .v6_rt_nhash_size_ddr = 0x4000,
  3202. .modem_hdr_ofst = 0x688,
  3203. .modem_hdr_size = 0x240,
  3204. .apps_hdr_ofst = 0x8c8,
  3205. .apps_hdr_size = 0x200,
  3206. .apps_hdr_size_ddr = 0x800,
  3207. .modem_hdr_proc_ctx_ofst = 0xad0,
  3208. .modem_hdr_proc_ctx_size = 0xb20,
  3209. .apps_hdr_proc_ctx_ofst = 0x15f0,
  3210. .apps_hdr_proc_ctx_size = 0x200,
  3211. .apps_hdr_proc_ctx_size_ddr = 0x0,
  3212. .nat_tbl_ofst = 0x1800,
  3213. .nat_tbl_size = 0xd00,
  3214. .stats_quota_ofst = 0x2510,
  3215. .stats_quota_size = 0x78,
  3216. .stats_tethering_ofst = 0x2588,
  3217. .stats_tethering_size = 0x238,
  3218. .stats_flt_v4_ofst = 0,
  3219. .stats_flt_v4_size = 0,
  3220. .stats_flt_v6_ofst = 0,
  3221. .stats_flt_v6_size = 0,
  3222. .stats_rt_v4_ofst = 0,
  3223. .stats_rt_v4_size = 0,
  3224. .stats_rt_v6_ofst = 0,
  3225. .stats_rt_v6_size = 0,
  3226. .stats_fnr_ofst = 0x27c0,
  3227. .stats_fnr_size = 0x800,
  3228. .stats_drop_ofst = 0x2fc0,
  3229. .stats_drop_size = 0x20,
  3230. .modem_comp_decomp_ofst = 0x0,
  3231. .modem_comp_decomp_size = 0x0,
  3232. .modem_ofst = 0x2fe8,
  3233. .modem_size = 0x800,
  3234. .apps_v4_flt_hash_ofst = 0x2718,
  3235. .apps_v4_flt_hash_size = 0x0,
  3236. .apps_v4_flt_nhash_ofst = 0x2718,
  3237. .apps_v4_flt_nhash_size = 0x0,
  3238. .apps_v6_flt_hash_ofst = 0x2718,
  3239. .apps_v6_flt_hash_size = 0x0,
  3240. .apps_v6_flt_nhash_ofst = 0x2718,
  3241. .apps_v6_flt_nhash_size = 0x0,
  3242. .apps_v4_rt_hash_ofst = 0x2718,
  3243. .apps_v4_rt_hash_size = 0x0,
  3244. .apps_v4_rt_nhash_ofst = 0x2718,
  3245. .apps_v4_rt_nhash_size = 0x0,
  3246. .apps_v6_rt_hash_ofst = 0x2718,
  3247. .apps_v6_rt_hash_size = 0x0,
  3248. .apps_v6_rt_nhash_ofst = 0x2718,
  3249. .apps_v6_rt_nhash_size = 0x0,
  3250. .uc_descriptor_ram_ofst = 0x3800,
  3251. .uc_descriptor_ram_size = 0x1000,
  3252. .pdn_config_ofst = 0x4800,
  3253. .pdn_config_size = 0x50,
  3254. .end_ofst = 0x4850,
  3255. };
  3256. static struct ipa3_mem_partition ipa_4_7_mem_part = {
  3257. .uc_info_ofst = 0x80,
  3258. .uc_info_size = 0x200,
  3259. .ofst_start = 0x280,
  3260. .v4_flt_hash_ofst = 0x288,
  3261. .v4_flt_hash_size = 0x78,
  3262. .v4_flt_hash_size_ddr = 0x4000,
  3263. .v4_flt_nhash_ofst = 0x308,
  3264. .v4_flt_nhash_size = 0x78,
  3265. .v4_flt_nhash_size_ddr = 0x4000,
  3266. .v6_flt_hash_ofst = 0x388,
  3267. .v6_flt_hash_size = 0x78,
  3268. .v6_flt_hash_size_ddr = 0x4000,
  3269. .v6_flt_nhash_ofst = 0x408,
  3270. .v6_flt_nhash_size = 0x78,
  3271. .v6_flt_nhash_size_ddr = 0x4000,
  3272. .v4_rt_num_index = 0xf,
  3273. .v4_modem_rt_index_lo = 0x0,
  3274. .v4_modem_rt_index_hi = 0x7,
  3275. .v4_apps_rt_index_lo = 0x8,
  3276. .v4_apps_rt_index_hi = 0xe,
  3277. .v4_rt_hash_ofst = 0x488,
  3278. .v4_rt_hash_size = 0x78,
  3279. .v4_rt_hash_size_ddr = 0x4000,
  3280. .v4_rt_nhash_ofst = 0x508,
  3281. .v4_rt_nhash_size = 0x78,
  3282. .v4_rt_nhash_size_ddr = 0x4000,
  3283. .v6_rt_num_index = 0xf,
  3284. .v6_modem_rt_index_lo = 0x0,
  3285. .v6_modem_rt_index_hi = 0x7,
  3286. .v6_apps_rt_index_lo = 0x8,
  3287. .v6_apps_rt_index_hi = 0xe,
  3288. .v6_rt_hash_ofst = 0x588,
  3289. .v6_rt_hash_size = 0x78,
  3290. .v6_rt_hash_size_ddr = 0x4000,
  3291. .v6_rt_nhash_ofst = 0x608,
  3292. .v6_rt_nhash_size = 0x78,
  3293. .v6_rt_nhash_size_ddr = 0x4000,
  3294. .modem_hdr_ofst = 0x688,
  3295. .modem_hdr_size = 0x240,
  3296. .apps_hdr_ofst = 0x8c8,
  3297. .apps_hdr_size = 0x200,
  3298. .apps_hdr_size_ddr = 0x800,
  3299. .modem_hdr_proc_ctx_ofst = 0xad0,
  3300. .modem_hdr_proc_ctx_size = 0x200,
  3301. .apps_hdr_proc_ctx_ofst = 0xcd0,
  3302. .apps_hdr_proc_ctx_size = 0x200,
  3303. .apps_hdr_proc_ctx_size_ddr = 0x0,
  3304. .nat_tbl_ofst = 0xee0,
  3305. .nat_tbl_size = 0xd00,
  3306. .pdn_config_ofst = 0x1be8,
  3307. .pdn_config_size = 0x50,
  3308. .stats_quota_ofst = 0x1c40,
  3309. .stats_quota_size = 0x78,
  3310. .stats_tethering_ofst = 0x1cb8,
  3311. .stats_tethering_size = 0x238,
  3312. .stats_flt_v4_ofst = 0,
  3313. .stats_flt_v4_size = 0,
  3314. .stats_flt_v6_ofst = 0,
  3315. .stats_flt_v6_size = 0,
  3316. .stats_rt_v4_ofst = 0,
  3317. .stats_rt_v4_size = 0,
  3318. .stats_rt_v6_ofst = 0,
  3319. .stats_rt_v6_size = 0,
  3320. .stats_fnr_ofst = 0x1ef0,
  3321. .stats_fnr_size = 0x0,
  3322. .stats_drop_ofst = 0x1ef0,
  3323. .stats_drop_size = 0x20,
  3324. .modem_comp_decomp_ofst = 0x0,
  3325. .modem_comp_decomp_size = 0x0,
  3326. .modem_ofst = 0x1f18,
  3327. .modem_size = 0x100c,
  3328. .apps_v4_flt_hash_ofst = 0x1f18,
  3329. .apps_v4_flt_hash_size = 0x0,
  3330. .apps_v4_flt_nhash_ofst = 0x1f18,
  3331. .apps_v4_flt_nhash_size = 0x0,
  3332. .apps_v6_flt_hash_ofst = 0x1f18,
  3333. .apps_v6_flt_hash_size = 0x0,
  3334. .apps_v6_flt_nhash_ofst = 0x1f18,
  3335. .apps_v6_flt_nhash_size = 0x0,
  3336. .apps_v4_rt_hash_ofst = 0x1f18,
  3337. .apps_v4_rt_hash_size = 0x0,
  3338. .apps_v4_rt_nhash_ofst = 0x1f18,
  3339. .apps_v4_rt_nhash_size = 0x0,
  3340. .apps_v6_rt_hash_ofst = 0x1f18,
  3341. .apps_v6_rt_hash_size = 0x0,
  3342. .apps_v6_rt_nhash_ofst = 0x1f18,
  3343. .apps_v6_rt_nhash_size = 0x0,
  3344. .uc_descriptor_ram_ofst = 0x3000,
  3345. .uc_descriptor_ram_size = 0x0000,
  3346. .end_ofst = 0x3000,
  3347. };
  3348. static struct ipa3_mem_partition ipa_4_9_mem_part = {
  3349. .uc_info_ofst = 0x80,
  3350. .uc_info_size = 0x200,
  3351. .ofst_start = 0x280,
  3352. .v4_flt_hash_ofst = 0x288,
  3353. .v4_flt_hash_size = 0x78,
  3354. .v4_flt_hash_size_ddr = 0x4000,
  3355. .v4_flt_nhash_ofst = 0x308,
  3356. .v4_flt_nhash_size = 0x78,
  3357. .v4_flt_nhash_size_ddr = 0x4000,
  3358. .v6_flt_hash_ofst = 0x388,
  3359. .v6_flt_hash_size = 0x78,
  3360. .v6_flt_hash_size_ddr = 0x4000,
  3361. .v6_flt_nhash_ofst = 0x408,
  3362. .v6_flt_nhash_size = 0x78,
  3363. .v6_flt_nhash_size_ddr = 0x4000,
  3364. .v4_rt_num_index = 0xf,
  3365. .v4_modem_rt_index_lo = 0x0,
  3366. .v4_modem_rt_index_hi = 0x7,
  3367. .v4_apps_rt_index_lo = 0x8,
  3368. .v4_apps_rt_index_hi = 0xe,
  3369. .v4_rt_hash_ofst = 0x488,
  3370. .v4_rt_hash_size = 0x78,
  3371. .v4_rt_hash_size_ddr = 0x4000,
  3372. .v4_rt_nhash_ofst = 0x508,
  3373. .v4_rt_nhash_size = 0x78,
  3374. .v4_rt_nhash_size_ddr = 0x4000,
  3375. .v6_rt_num_index = 0xf,
  3376. .v6_modem_rt_index_lo = 0x0,
  3377. .v6_modem_rt_index_hi = 0x7,
  3378. .v6_apps_rt_index_lo = 0x8,
  3379. .v6_apps_rt_index_hi = 0xe,
  3380. .v6_rt_hash_ofst = 0x588,
  3381. .v6_rt_hash_size = 0x78,
  3382. .v6_rt_hash_size_ddr = 0x4000,
  3383. .v6_rt_nhash_ofst = 0x608,
  3384. .v6_rt_nhash_size = 0x78,
  3385. .v6_rt_nhash_size_ddr = 0x4000,
  3386. .modem_hdr_ofst = 0x688,
  3387. .modem_hdr_size = 0x240,
  3388. .apps_hdr_ofst = 0x8c8,
  3389. .apps_hdr_size = 0x200,
  3390. .apps_hdr_size_ddr = 0x800,
  3391. .modem_hdr_proc_ctx_ofst = 0xad0,
  3392. .modem_hdr_proc_ctx_size = 0xb20,
  3393. .apps_hdr_proc_ctx_ofst = 0x15f0,
  3394. .apps_hdr_proc_ctx_size = 0x200,
  3395. .apps_hdr_proc_ctx_size_ddr = 0x0,
  3396. .nat_tbl_ofst = 0x1800,
  3397. .nat_tbl_size = 0xd00,
  3398. .stats_quota_ofst = 0x2510,
  3399. .stats_quota_size = 0x78,
  3400. .stats_tethering_ofst = 0x2588,
  3401. .stats_tethering_size = 0x238,
  3402. .stats_flt_v4_ofst = 0,
  3403. .stats_flt_v4_size = 0,
  3404. .stats_flt_v6_ofst = 0,
  3405. .stats_flt_v6_size = 0,
  3406. .stats_rt_v4_ofst = 0,
  3407. .stats_rt_v4_size = 0,
  3408. .stats_rt_v6_ofst = 0,
  3409. .stats_rt_v6_size = 0,
  3410. .stats_fnr_ofst = 0x27c0,
  3411. .stats_fnr_size = 0x800,
  3412. .stats_drop_ofst = 0x2fc0,
  3413. .stats_drop_size = 0x20,
  3414. .modem_comp_decomp_ofst = 0x0,
  3415. .modem_comp_decomp_size = 0x0,
  3416. .modem_ofst = 0x2fe8,
  3417. .modem_size = 0x800,
  3418. .apps_v4_flt_hash_ofst = 0x2718,
  3419. .apps_v4_flt_hash_size = 0x0,
  3420. .apps_v4_flt_nhash_ofst = 0x2718,
  3421. .apps_v4_flt_nhash_size = 0x0,
  3422. .apps_v6_flt_hash_ofst = 0x2718,
  3423. .apps_v6_flt_hash_size = 0x0,
  3424. .apps_v6_flt_nhash_ofst = 0x2718,
  3425. .apps_v6_flt_nhash_size = 0x0,
  3426. .apps_v4_rt_hash_ofst = 0x2718,
  3427. .apps_v4_rt_hash_size = 0x0,
  3428. .apps_v4_rt_nhash_ofst = 0x2718,
  3429. .apps_v4_rt_nhash_size = 0x0,
  3430. .apps_v6_rt_hash_ofst = 0x2718,
  3431. .apps_v6_rt_hash_size = 0x0,
  3432. .apps_v6_rt_nhash_ofst = 0x2718,
  3433. .apps_v6_rt_nhash_size = 0x0,
  3434. .uc_descriptor_ram_ofst = 0x3800,
  3435. .uc_descriptor_ram_size = 0x1000,
  3436. .pdn_config_ofst = 0x4800,
  3437. .pdn_config_size = 0x50,
  3438. .end_ofst = 0x4850,
  3439. };
  3440. /**
  3441. * ipa3_get_clients_from_rm_resource() - get IPA clients which are related to an
  3442. * IPA_RM resource
  3443. *
  3444. * @resource: [IN] IPA Resource Manager resource
  3445. * @clients: [OUT] Empty array which will contain the list of clients. The
  3446. * caller must initialize this array.
  3447. *
  3448. * Return codes: 0 on success, negative on failure.
  3449. */
  3450. int ipa3_get_clients_from_rm_resource(
  3451. enum ipa_rm_resource_name resource,
  3452. struct ipa3_client_names *clients)
  3453. {
  3454. int i = 0;
  3455. if (resource < 0 ||
  3456. resource >= IPA_RM_RESOURCE_MAX ||
  3457. !clients) {
  3458. IPAERR("Bad parameters\n");
  3459. return -EINVAL;
  3460. }
  3461. switch (resource) {
  3462. case IPA_RM_RESOURCE_USB_CONS:
  3463. if (ipa3_get_ep_mapping(IPA_CLIENT_USB_CONS) != -1)
  3464. clients->names[i++] = IPA_CLIENT_USB_CONS;
  3465. break;
  3466. case IPA_RM_RESOURCE_USB_DPL_CONS:
  3467. if (ipa3_get_ep_mapping(IPA_CLIENT_USB_DPL_CONS) != -1)
  3468. clients->names[i++] = IPA_CLIENT_USB_DPL_CONS;
  3469. break;
  3470. case IPA_RM_RESOURCE_HSIC_CONS:
  3471. clients->names[i++] = IPA_CLIENT_HSIC1_CONS;
  3472. break;
  3473. case IPA_RM_RESOURCE_WLAN_CONS:
  3474. clients->names[i++] = IPA_CLIENT_WLAN1_CONS;
  3475. clients->names[i++] = IPA_CLIENT_WLAN2_CONS;
  3476. clients->names[i++] = IPA_CLIENT_WLAN3_CONS;
  3477. break;
  3478. case IPA_RM_RESOURCE_MHI_CONS:
  3479. clients->names[i++] = IPA_CLIENT_MHI_CONS;
  3480. break;
  3481. case IPA_RM_RESOURCE_ODU_ADAPT_CONS:
  3482. clients->names[i++] = IPA_CLIENT_ODU_EMB_CONS;
  3483. clients->names[i++] = IPA_CLIENT_ODU_TETH_CONS;
  3484. break;
  3485. case IPA_RM_RESOURCE_ETHERNET_CONS:
  3486. clients->names[i++] = IPA_CLIENT_ETHERNET_CONS;
  3487. break;
  3488. case IPA_RM_RESOURCE_USB_PROD:
  3489. if (ipa3_get_ep_mapping(IPA_CLIENT_USB_PROD) != -1)
  3490. clients->names[i++] = IPA_CLIENT_USB_PROD;
  3491. break;
  3492. case IPA_RM_RESOURCE_HSIC_PROD:
  3493. clients->names[i++] = IPA_CLIENT_HSIC1_PROD;
  3494. break;
  3495. case IPA_RM_RESOURCE_MHI_PROD:
  3496. clients->names[i++] = IPA_CLIENT_MHI_PROD;
  3497. break;
  3498. case IPA_RM_RESOURCE_ODU_ADAPT_PROD:
  3499. clients->names[i++] = IPA_CLIENT_ODU_PROD;
  3500. break;
  3501. case IPA_RM_RESOURCE_ETHERNET_PROD:
  3502. clients->names[i++] = IPA_CLIENT_ETHERNET_PROD;
  3503. break;
  3504. default:
  3505. break;
  3506. }
  3507. clients->length = i;
  3508. return 0;
  3509. }
  3510. /**
  3511. * ipa3_should_pipe_be_suspended() - returns true when the client's pipe should
  3512. * be suspended during a power save scenario. False otherwise.
  3513. *
  3514. * @client: [IN] IPA client
  3515. */
  3516. bool ipa3_should_pipe_be_suspended(enum ipa_client_type client)
  3517. {
  3518. struct ipa3_ep_context *ep;
  3519. int ipa_ep_idx;
  3520. ipa_ep_idx = ipa3_get_ep_mapping(client);
  3521. if (ipa_ep_idx == -1) {
  3522. IPAERR("Invalid client.\n");
  3523. WARN_ON(1);
  3524. return false;
  3525. }
  3526. ep = &ipa3_ctx->ep[ipa_ep_idx];
  3527. /*
  3528. * starting IPA 4.0 pipe no longer can be suspended. Instead,
  3529. * the corresponding GSI channel should be stopped. Usually client
  3530. * driver will take care of stopping the channel. For client drivers
  3531. * that are not stopping the channel, IPA RM will do that based on
  3532. * ipa3_should_pipe_channel_be_stopped().
  3533. */
  3534. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
  3535. return false;
  3536. if (ep->keep_ipa_awake)
  3537. return false;
  3538. if (client == IPA_CLIENT_USB_CONS ||
  3539. client == IPA_CLIENT_USB_DPL_CONS ||
  3540. client == IPA_CLIENT_MHI_CONS ||
  3541. client == IPA_CLIENT_MHI_DPL_CONS ||
  3542. client == IPA_CLIENT_HSIC1_CONS ||
  3543. client == IPA_CLIENT_WLAN1_CONS ||
  3544. client == IPA_CLIENT_WLAN2_CONS ||
  3545. client == IPA_CLIENT_WLAN3_CONS ||
  3546. client == IPA_CLIENT_WLAN4_CONS ||
  3547. client == IPA_CLIENT_ODU_EMB_CONS ||
  3548. client == IPA_CLIENT_ODU_TETH_CONS ||
  3549. client == IPA_CLIENT_ETHERNET_CONS)
  3550. return true;
  3551. return false;
  3552. }
  3553. /**
  3554. * ipa3_should_pipe_channel_be_stopped() - returns true when the client's
  3555. * channel should be stopped during a power save scenario. False otherwise.
  3556. * Most client already stops the GSI channel on suspend, and are not included
  3557. * in the list below.
  3558. *
  3559. * @client: [IN] IPA client
  3560. */
  3561. static bool ipa3_should_pipe_channel_be_stopped(enum ipa_client_type client)
  3562. {
  3563. struct ipa3_ep_context *ep;
  3564. int ipa_ep_idx;
  3565. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0)
  3566. return false;
  3567. ipa_ep_idx = ipa3_get_ep_mapping(client);
  3568. if (ipa_ep_idx == -1) {
  3569. IPAERR("Invalid client.\n");
  3570. WARN_ON(1);
  3571. return false;
  3572. }
  3573. ep = &ipa3_ctx->ep[ipa_ep_idx];
  3574. if (ep->keep_ipa_awake)
  3575. return false;
  3576. if (client == IPA_CLIENT_ODU_EMB_CONS ||
  3577. client == IPA_CLIENT_ODU_TETH_CONS)
  3578. return true;
  3579. return false;
  3580. }
  3581. /**
  3582. * ipa3_suspend_resource_sync() - suspend client endpoints related to the IPA_RM
  3583. * resource and decrement active clients counter, which may result in clock
  3584. * gating of IPA clocks.
  3585. *
  3586. * @resource: [IN] IPA Resource Manager resource
  3587. *
  3588. * Return codes: 0 on success, negative on failure.
  3589. */
  3590. int ipa3_suspend_resource_sync(enum ipa_rm_resource_name resource)
  3591. {
  3592. struct ipa3_client_names clients;
  3593. int res;
  3594. int index;
  3595. struct ipa_ep_cfg_ctrl suspend;
  3596. enum ipa_client_type client;
  3597. int ipa_ep_idx;
  3598. bool pipe_suspended = false;
  3599. memset(&clients, 0, sizeof(clients));
  3600. res = ipa3_get_clients_from_rm_resource(resource, &clients);
  3601. if (res) {
  3602. IPAERR("Bad params.\n");
  3603. return res;
  3604. }
  3605. for (index = 0; index < clients.length; index++) {
  3606. client = clients.names[index];
  3607. ipa_ep_idx = ipa3_get_ep_mapping(client);
  3608. if (ipa_ep_idx == -1) {
  3609. IPAERR("Invalid client.\n");
  3610. res = -EINVAL;
  3611. continue;
  3612. }
  3613. ipa3_ctx->resume_on_connect[client] = false;
  3614. if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
  3615. ipa3_should_pipe_be_suspended(client)) {
  3616. if (ipa3_ctx->ep[ipa_ep_idx].valid) {
  3617. /* suspend endpoint */
  3618. memset(&suspend, 0, sizeof(suspend));
  3619. suspend.ipa_ep_suspend = true;
  3620. ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
  3621. pipe_suspended = true;
  3622. }
  3623. }
  3624. if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
  3625. ipa3_should_pipe_channel_be_stopped(client)) {
  3626. if (ipa3_ctx->ep[ipa_ep_idx].valid) {
  3627. /* Stop GSI channel */
  3628. res = ipa3_stop_gsi_channel(ipa_ep_idx);
  3629. if (res) {
  3630. IPAERR("failed stop gsi ch %lu\n",
  3631. ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
  3632. return res;
  3633. }
  3634. }
  3635. }
  3636. }
  3637. /* Sleep ~1 msec */
  3638. if (pipe_suspended)
  3639. usleep_range(1000, 2000);
  3640. /* before gating IPA clocks do TAG process */
  3641. ipa3_ctx->tag_process_before_gating = true;
  3642. IPA_ACTIVE_CLIENTS_DEC_RESOURCE(ipa_rm_resource_str(resource));
  3643. return 0;
  3644. }
  3645. /**
  3646. * ipa3_suspend_resource_no_block() - suspend client endpoints related to the
  3647. * IPA_RM resource and decrement active clients counter. This function is
  3648. * guaranteed to avoid sleeping.
  3649. *
  3650. * @resource: [IN] IPA Resource Manager resource
  3651. *
  3652. * Return codes: 0 on success, negative on failure.
  3653. */
  3654. int ipa3_suspend_resource_no_block(enum ipa_rm_resource_name resource)
  3655. {
  3656. int res;
  3657. struct ipa3_client_names clients;
  3658. int index;
  3659. enum ipa_client_type client;
  3660. struct ipa_ep_cfg_ctrl suspend;
  3661. int ipa_ep_idx;
  3662. struct ipa_active_client_logging_info log_info;
  3663. memset(&clients, 0, sizeof(clients));
  3664. res = ipa3_get_clients_from_rm_resource(resource, &clients);
  3665. if (res) {
  3666. IPAERR(
  3667. "ipa3_get_clients_from_rm_resource() failed, name = %d.\n",
  3668. resource);
  3669. goto bail;
  3670. }
  3671. for (index = 0; index < clients.length; index++) {
  3672. client = clients.names[index];
  3673. ipa_ep_idx = ipa3_get_ep_mapping(client);
  3674. if (ipa_ep_idx == -1) {
  3675. IPAERR("Invalid client.\n");
  3676. res = -EINVAL;
  3677. continue;
  3678. }
  3679. ipa3_ctx->resume_on_connect[client] = false;
  3680. if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
  3681. ipa3_should_pipe_be_suspended(client)) {
  3682. if (ipa3_ctx->ep[ipa_ep_idx].valid) {
  3683. /* suspend endpoint */
  3684. memset(&suspend, 0, sizeof(suspend));
  3685. suspend.ipa_ep_suspend = true;
  3686. ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
  3687. }
  3688. }
  3689. if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
  3690. ipa3_should_pipe_channel_be_stopped(client)) {
  3691. res = -EPERM;
  3692. goto bail;
  3693. }
  3694. }
  3695. if (res == 0) {
  3696. IPA_ACTIVE_CLIENTS_PREP_RESOURCE(log_info,
  3697. ipa_rm_resource_str(resource));
  3698. /* before gating IPA clocks do TAG process */
  3699. ipa3_ctx->tag_process_before_gating = true;
  3700. ipa3_dec_client_disable_clks_no_block(&log_info);
  3701. }
  3702. bail:
  3703. return res;
  3704. }
  3705. /**
  3706. * ipa3_resume_resource() - resume client endpoints related to the IPA_RM
  3707. * resource.
  3708. *
  3709. * @resource: [IN] IPA Resource Manager resource
  3710. *
  3711. * Return codes: 0 on success, negative on failure.
  3712. */
  3713. int ipa3_resume_resource(enum ipa_rm_resource_name resource)
  3714. {
  3715. struct ipa3_client_names clients;
  3716. int res;
  3717. int index;
  3718. struct ipa_ep_cfg_ctrl suspend;
  3719. enum ipa_client_type client;
  3720. int ipa_ep_idx;
  3721. memset(&clients, 0, sizeof(clients));
  3722. res = ipa3_get_clients_from_rm_resource(resource, &clients);
  3723. if (res) {
  3724. IPAERR("ipa3_get_clients_from_rm_resource() failed.\n");
  3725. return res;
  3726. }
  3727. for (index = 0; index < clients.length; index++) {
  3728. client = clients.names[index];
  3729. ipa_ep_idx = ipa3_get_ep_mapping(client);
  3730. if (ipa_ep_idx == -1) {
  3731. IPAERR("Invalid client.\n");
  3732. res = -EINVAL;
  3733. continue;
  3734. }
  3735. /*
  3736. * The related ep, will be resumed on connect
  3737. * while its resource is granted
  3738. */
  3739. ipa3_ctx->resume_on_connect[client] = true;
  3740. IPADBG("%d will be resumed on connect.\n", client);
  3741. if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
  3742. ipa3_should_pipe_be_suspended(client)) {
  3743. if (ipa3_ctx->ep[ipa_ep_idx].valid) {
  3744. memset(&suspend, 0, sizeof(suspend));
  3745. suspend.ipa_ep_suspend = false;
  3746. ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
  3747. }
  3748. }
  3749. if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
  3750. ipa3_should_pipe_channel_be_stopped(client)) {
  3751. if (ipa3_ctx->ep[ipa_ep_idx].valid) {
  3752. res = gsi_start_channel(
  3753. ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
  3754. if (res) {
  3755. IPAERR("failed to start gsi ch %lu\n",
  3756. ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
  3757. return res;
  3758. }
  3759. }
  3760. }
  3761. }
  3762. return res;
  3763. }
  3764. /**
  3765. * ipa3_get_hw_type_index() - Get HW type index which is used as the entry index
  3766. * for ep\resource groups related arrays .
  3767. *
  3768. * Return value: HW type index
  3769. */
  3770. static u8 ipa3_get_hw_type_index(void)
  3771. {
  3772. u8 hw_type_index;
  3773. switch (ipa3_ctx->ipa_hw_type) {
  3774. case IPA_HW_v3_0:
  3775. case IPA_HW_v3_1:
  3776. hw_type_index = IPA_3_0;
  3777. break;
  3778. case IPA_HW_v3_5:
  3779. hw_type_index = IPA_3_5;
  3780. /*
  3781. *this flag is initialized only after fw load trigger from
  3782. * user space (ipa3_write)
  3783. */
  3784. if (ipa3_ctx->ipa_config_is_mhi)
  3785. hw_type_index = IPA_3_5_MHI;
  3786. break;
  3787. case IPA_HW_v3_5_1:
  3788. hw_type_index = IPA_3_5_1;
  3789. break;
  3790. case IPA_HW_v4_0:
  3791. hw_type_index = IPA_4_0;
  3792. /*
  3793. *this flag is initialized only after fw load trigger from
  3794. * user space (ipa3_write)
  3795. */
  3796. if (ipa3_ctx->ipa_config_is_mhi)
  3797. hw_type_index = IPA_4_0_MHI;
  3798. break;
  3799. case IPA_HW_v4_1:
  3800. hw_type_index = IPA_4_1;
  3801. break;
  3802. case IPA_HW_v4_2:
  3803. hw_type_index = IPA_4_2;
  3804. break;
  3805. case IPA_HW_v4_5:
  3806. hw_type_index = IPA_4_5;
  3807. if (ipa3_ctx->ipa_config_is_mhi)
  3808. hw_type_index = IPA_4_5_MHI;
  3809. if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
  3810. hw_type_index = IPA_4_5_APQ;
  3811. break;
  3812. case IPA_HW_v4_7:
  3813. hw_type_index = IPA_4_7;
  3814. break;
  3815. case IPA_HW_v4_9:
  3816. hw_type_index = IPA_4_9;
  3817. break;
  3818. default:
  3819. IPAERR("Incorrect IPA version %d\n", ipa3_ctx->ipa_hw_type);
  3820. hw_type_index = IPA_3_0;
  3821. break;
  3822. }
  3823. return hw_type_index;
  3824. }
  3825. /**
  3826. * _ipa_sram_settings_read_v3_0() - Read SRAM settings from HW
  3827. *
  3828. * Returns: None
  3829. */
  3830. void _ipa_sram_settings_read_v3_0(void)
  3831. {
  3832. struct ipahal_reg_shared_mem_size smem_sz;
  3833. memset(&smem_sz, 0, sizeof(smem_sz));
  3834. ipahal_read_reg_fields(IPA_SHARED_MEM_SIZE, &smem_sz);
  3835. ipa3_ctx->smem_restricted_bytes = smem_sz.shared_mem_baddr;
  3836. ipa3_ctx->smem_sz = smem_sz.shared_mem_sz;
  3837. /* reg fields are in 8B units */
  3838. ipa3_ctx->smem_restricted_bytes *= 8;
  3839. ipa3_ctx->smem_sz *= 8;
  3840. ipa3_ctx->smem_reqd_sz = IPA_MEM_PART(end_ofst);
  3841. ipa3_ctx->hdr_tbl_lcl = false;
  3842. ipa3_ctx->hdr_proc_ctx_tbl_lcl = true;
  3843. /*
  3844. * when proc ctx table is located in internal memory,
  3845. * modem entries resides first.
  3846. */
  3847. if (ipa3_ctx->hdr_proc_ctx_tbl_lcl) {
  3848. ipa3_ctx->hdr_proc_ctx_tbl.start_offset =
  3849. IPA_MEM_PART(modem_hdr_proc_ctx_size);
  3850. }
  3851. ipa3_ctx->ip4_rt_tbl_hash_lcl = false;
  3852. ipa3_ctx->ip4_rt_tbl_nhash_lcl = false;
  3853. ipa3_ctx->ip6_rt_tbl_hash_lcl = false;
  3854. ipa3_ctx->ip6_rt_tbl_nhash_lcl = false;
  3855. ipa3_ctx->ip4_flt_tbl_hash_lcl = false;
  3856. ipa3_ctx->ip4_flt_tbl_nhash_lcl = false;
  3857. ipa3_ctx->ip6_flt_tbl_hash_lcl = false;
  3858. ipa3_ctx->ip6_flt_tbl_nhash_lcl = false;
  3859. }
  3860. /**
  3861. * ipa3_cfg_route() - configure IPA route
  3862. * @route: IPA route
  3863. *
  3864. * Return codes:
  3865. * 0: success
  3866. */
  3867. int ipa3_cfg_route(struct ipahal_reg_route *route)
  3868. {
  3869. IPADBG("disable_route_block=%d, default_pipe=%d, default_hdr_tbl=%d\n",
  3870. route->route_dis,
  3871. route->route_def_pipe,
  3872. route->route_def_hdr_table);
  3873. IPADBG("default_hdr_ofst=%d, default_frag_pipe=%d\n",
  3874. route->route_def_hdr_ofst,
  3875. route->route_frag_def_pipe);
  3876. IPADBG("default_retain_hdr=%d\n",
  3877. route->route_def_retain_hdr);
  3878. if (route->route_dis) {
  3879. IPAERR("Route disable is not supported!\n");
  3880. return -EPERM;
  3881. }
  3882. IPA_ACTIVE_CLIENTS_INC_SIMPLE();
  3883. ipahal_write_reg_fields(IPA_ROUTE, route);
  3884. IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
  3885. return 0;
  3886. }
  3887. /**
  3888. * ipa3_cfg_filter() - configure filter
  3889. * @disable: disable value
  3890. *
  3891. * Return codes:
  3892. * 0: success
  3893. */
  3894. int ipa3_cfg_filter(u32 disable)
  3895. {
  3896. IPAERR_RL("Filter disable is not supported!\n");
  3897. return -EPERM;
  3898. }
  3899. /**
  3900. * ipa_disable_hashing_rt_flt_v4_2() - Disable filer and route hashing.
  3901. *
  3902. * Return codes: 0 for success, negative value for failure
  3903. */
  3904. static int ipa_disable_hashing_rt_flt_v4_2(void)
  3905. {
  3906. IPADBG("Disable hashing for filter and route table in IPA 4.2 HW\n");
  3907. ipahal_write_reg(IPA_FILT_ROUT_HASH_EN,
  3908. IPA_FILT_ROUT_HASH_REG_VAL_v4_2);
  3909. return 0;
  3910. }
  3911. /**
  3912. * ipa_comp_cfg() - Configure QMB/Master port selection
  3913. *
  3914. * Returns: None
  3915. */
  3916. static void ipa_comp_cfg(void)
  3917. {
  3918. struct ipahal_reg_comp_cfg comp_cfg;
  3919. /* IPAv4 specific, on NON-MHI config*/
  3920. if ((ipa3_ctx->ipa_hw_type == IPA_HW_v4_0) &&
  3921. (!ipa3_ctx->ipa_config_is_mhi)) {
  3922. ipahal_read_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3923. IPADBG("Before comp config\n");
  3924. IPADBG("ipa_qmb_select_by_address_global_en = %d\n",
  3925. comp_cfg.ipa_qmb_select_by_address_global_en);
  3926. IPADBG("ipa_qmb_select_by_address_prod_en = %d\n",
  3927. comp_cfg.ipa_qmb_select_by_address_prod_en);
  3928. IPADBG("ipa_qmb_select_by_address_cons_en = %d\n",
  3929. comp_cfg.ipa_qmb_select_by_address_cons_en);
  3930. comp_cfg.ipa_qmb_select_by_address_global_en = false;
  3931. comp_cfg.ipa_qmb_select_by_address_prod_en = false;
  3932. comp_cfg.ipa_qmb_select_by_address_cons_en = false;
  3933. ipahal_write_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3934. ipahal_read_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3935. IPADBG("After comp config\n");
  3936. IPADBG("ipa_qmb_select_by_address_global_en = %d\n",
  3937. comp_cfg.ipa_qmb_select_by_address_global_en);
  3938. IPADBG("ipa_qmb_select_by_address_prod_en = %d\n",
  3939. comp_cfg.ipa_qmb_select_by_address_prod_en);
  3940. IPADBG("ipa_qmb_select_by_address_cons_en = %d\n",
  3941. comp_cfg.ipa_qmb_select_by_address_cons_en);
  3942. }
  3943. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
  3944. ipahal_read_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3945. IPADBG("Before comp config\n");
  3946. IPADBG("gsi_multi_inorder_rd_dis = %d\n",
  3947. comp_cfg.gsi_multi_inorder_rd_dis);
  3948. IPADBG("gsi_multi_inorder_wr_dis = %d\n",
  3949. comp_cfg.gsi_multi_inorder_wr_dis);
  3950. comp_cfg.gsi_multi_inorder_rd_dis = true;
  3951. comp_cfg.gsi_multi_inorder_wr_dis = true;
  3952. ipahal_write_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3953. ipahal_read_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3954. IPADBG("After comp config\n");
  3955. IPADBG("gsi_multi_inorder_rd_dis = %d\n",
  3956. comp_cfg.gsi_multi_inorder_rd_dis);
  3957. IPADBG("gsi_multi_inorder_wr_dis = %d\n",
  3958. comp_cfg.gsi_multi_inorder_wr_dis);
  3959. }
  3960. /* set GSI_MULTI_AXI_MASTERS_DIS = true after HW.4.1 */
  3961. if ((ipa3_ctx->ipa_hw_type == IPA_HW_v4_1) ||
  3962. (ipa3_ctx->ipa_hw_type == IPA_HW_v4_2)) {
  3963. ipahal_read_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3964. IPADBG("Before comp config\n");
  3965. IPADBG("gsi_multi_axi_masters_dis = %d\n",
  3966. comp_cfg.gsi_multi_axi_masters_dis);
  3967. comp_cfg.gsi_multi_axi_masters_dis = true;
  3968. ipahal_write_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3969. ipahal_read_reg_fields(IPA_COMP_CFG, &comp_cfg);
  3970. IPADBG("After comp config\n");
  3971. IPADBG("gsi_multi_axi_masters_dis = %d\n",
  3972. comp_cfg.gsi_multi_axi_masters_dis);
  3973. }
  3974. }
  3975. /**
  3976. * ipa3_cfg_qsb() - Configure IPA QSB maximal reads and writes
  3977. *
  3978. * Returns: None
  3979. */
  3980. static void ipa3_cfg_qsb(void)
  3981. {
  3982. u8 hw_type_idx;
  3983. const struct ipa_qmb_outstanding *qmb_ot;
  3984. struct ipahal_reg_qsb_max_reads max_reads = { 0 };
  3985. struct ipahal_reg_qsb_max_writes max_writes = { 0 };
  3986. hw_type_idx = ipa3_get_hw_type_index();
  3987. /*
  3988. * Read the register values before writing to them to ensure
  3989. * other values are not overwritten
  3990. */
  3991. ipahal_read_reg_fields(IPA_QSB_MAX_WRITES, &max_writes);
  3992. ipahal_read_reg_fields(IPA_QSB_MAX_READS, &max_reads);
  3993. qmb_ot = &(ipa3_qmb_outstanding[hw_type_idx][IPA_QMB_INSTANCE_DDR]);
  3994. max_reads.qmb_0_max_reads = qmb_ot->ot_reads;
  3995. max_writes.qmb_0_max_writes = qmb_ot->ot_writes;
  3996. max_reads.qmb_0_max_read_beats = qmb_ot->ot_read_beats;
  3997. qmb_ot = &(ipa3_qmb_outstanding[hw_type_idx][IPA_QMB_INSTANCE_PCIE]);
  3998. max_reads.qmb_1_max_reads = qmb_ot->ot_reads;
  3999. max_writes.qmb_1_max_writes = qmb_ot->ot_writes;
  4000. ipahal_write_reg_fields(IPA_QSB_MAX_WRITES, &max_writes);
  4001. ipahal_write_reg_fields(IPA_QSB_MAX_READS, &max_reads);
  4002. }
  4003. /* relevant starting IPA4.5 */
  4004. static void ipa_cfg_qtime(void)
  4005. {
  4006. struct ipahal_reg_qtime_timestamp_cfg ts_cfg;
  4007. struct ipahal_reg_timers_pulse_gran_cfg gran_cfg;
  4008. struct ipahal_reg_timers_xo_clk_div_cfg div_cfg;
  4009. u32 val;
  4010. /* Configure timestamp resolution */
  4011. memset(&ts_cfg, 0, sizeof(ts_cfg));
  4012. ts_cfg.dpl_timestamp_lsb = IPA_TAG_TIMER_TIMESTAMP_SHFT;
  4013. ts_cfg.dpl_timestamp_sel = true;
  4014. ts_cfg.tag_timestamp_lsb = IPA_TAG_TIMER_TIMESTAMP_SHFT;
  4015. ts_cfg.nat_timestamp_lsb = IPA_NAT_TIMER_TIMESTAMP_SHFT;
  4016. val = ipahal_read_reg(IPA_QTIME_TIMESTAMP_CFG);
  4017. IPADBG("qtime timestamp before cfg: 0x%x\n", val);
  4018. ipahal_write_reg_fields(IPA_QTIME_TIMESTAMP_CFG, &ts_cfg);
  4019. val = ipahal_read_reg(IPA_QTIME_TIMESTAMP_CFG);
  4020. IPADBG("qtime timestamp after cfg: 0x%x\n", val);
  4021. /* Configure timers pulse generators granularity */
  4022. memset(&gran_cfg, 0, sizeof(gran_cfg));
  4023. gran_cfg.gran_0 = IPA_TIMERS_TIME_GRAN_100_USEC;
  4024. gran_cfg.gran_1 = IPA_TIMERS_TIME_GRAN_1_MSEC;
  4025. gran_cfg.gran_2 = IPA_TIMERS_TIME_GRAN_1_MSEC;
  4026. val = ipahal_read_reg(IPA_TIMERS_PULSE_GRAN_CFG);
  4027. IPADBG("timer pulse granularity before cfg: 0x%x\n", val);
  4028. ipahal_write_reg_fields(IPA_TIMERS_PULSE_GRAN_CFG, &gran_cfg);
  4029. val = ipahal_read_reg(IPA_TIMERS_PULSE_GRAN_CFG);
  4030. IPADBG("timer pulse granularity after cfg: 0x%x\n", val);
  4031. /* Configure timers XO Clock divider */
  4032. memset(&div_cfg, 0, sizeof(div_cfg));
  4033. ipahal_read_reg_fields(IPA_TIMERS_XO_CLK_DIV_CFG, &div_cfg);
  4034. IPADBG("timer XO clk divider before cfg: enabled=%d divider=%u\n",
  4035. div_cfg.enable, div_cfg.value);
  4036. /* Make sure divider is disabled */
  4037. if (div_cfg.enable) {
  4038. div_cfg.enable = false;
  4039. ipahal_write_reg_fields(IPA_TIMERS_XO_CLK_DIV_CFG, &div_cfg);
  4040. }
  4041. /* At emulation systems XO clock is lower than on real target.
  4042. * (e.g. 19.2Mhz compared to 96Khz)
  4043. * Use lowest possible divider.
  4044. */
  4045. if (ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_VIRTUAL ||
  4046. ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_EMULATION) {
  4047. div_cfg.value = 0;
  4048. }
  4049. div_cfg.enable = true; /* Enable the divider */
  4050. ipahal_write_reg_fields(IPA_TIMERS_XO_CLK_DIV_CFG, &div_cfg);
  4051. ipahal_read_reg_fields(IPA_TIMERS_XO_CLK_DIV_CFG, &div_cfg);
  4052. IPADBG("timer XO clk divider after cfg: enabled=%d divider=%u\n",
  4053. div_cfg.enable, div_cfg.value);
  4054. }
  4055. /**
  4056. * ipa3_init_hw() - initialize HW
  4057. *
  4058. * Return codes:
  4059. * 0: success
  4060. */
  4061. int ipa3_init_hw(void)
  4062. {
  4063. u32 ipa_version = 0;
  4064. struct ipahal_reg_counter_cfg cnt_cfg;
  4065. /* Read IPA version and make sure we have access to the registers */
  4066. ipa_version = ipahal_read_reg(IPA_VERSION);
  4067. IPADBG("IPA_VERSION=%u\n", ipa_version);
  4068. if (ipa_version == 0)
  4069. return -EFAULT;
  4070. switch (ipa3_ctx->ipa_hw_type) {
  4071. case IPA_HW_v3_0:
  4072. case IPA_HW_v3_1:
  4073. ipahal_write_reg(IPA_BCR, IPA_BCR_REG_VAL_v3_0);
  4074. break;
  4075. case IPA_HW_v3_5:
  4076. case IPA_HW_v3_5_1:
  4077. ipahal_write_reg(IPA_BCR, IPA_BCR_REG_VAL_v3_5);
  4078. break;
  4079. case IPA_HW_v4_0:
  4080. case IPA_HW_v4_1:
  4081. ipahal_write_reg(IPA_BCR, IPA_BCR_REG_VAL_v4_0);
  4082. break;
  4083. case IPA_HW_v4_2:
  4084. ipahal_write_reg(IPA_BCR, IPA_BCR_REG_VAL_v4_2);
  4085. break;
  4086. default:
  4087. IPADBG("Do not update BCR - hw_type=%d\n",
  4088. ipa3_ctx->ipa_hw_type);
  4089. break;
  4090. }
  4091. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0 &&
  4092. ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) {
  4093. struct ipahal_reg_clkon_cfg clkon_cfg;
  4094. struct ipahal_reg_tx_cfg tx_cfg;
  4095. memset(&clkon_cfg, 0, sizeof(clkon_cfg));
  4096. /*enable open global clocks*/
  4097. clkon_cfg.open_global_2x_clk = true;
  4098. clkon_cfg.open_global = true;
  4099. ipahal_write_reg_fields(IPA_CLKON_CFG, &clkon_cfg);
  4100. ipahal_read_reg_fields(IPA_TX_CFG, &tx_cfg);
  4101. /* disable PA_MASK_EN to allow holb drop */
  4102. tx_cfg.pa_mask_en = 0;
  4103. ipahal_write_reg_fields(IPA_TX_CFG, &tx_cfg);
  4104. }
  4105. ipa3_cfg_qsb();
  4106. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) {
  4107. /* set aggr granularity for 0.5 msec*/
  4108. cnt_cfg.aggr_granularity = GRAN_VALUE_500_USEC;
  4109. ipahal_write_reg_fields(IPA_COUNTER_CFG, &cnt_cfg);
  4110. } else {
  4111. ipa_cfg_qtime();
  4112. }
  4113. ipa_comp_cfg();
  4114. /*
  4115. * In IPA 4.2 filter and routing hashing not supported
  4116. * disabling hash enable register.
  4117. */
  4118. if (ipa3_ctx->ipa_fltrt_not_hashable)
  4119. ipa_disable_hashing_rt_flt_v4_2();
  4120. return 0;
  4121. }
  4122. /**
  4123. * ipa3_get_ep_mapping() - provide endpoint mapping
  4124. * @client: client type
  4125. *
  4126. * Return value: endpoint mapping
  4127. */
  4128. int ipa3_get_ep_mapping(enum ipa_client_type client)
  4129. {
  4130. int ipa_ep_idx;
  4131. u8 hw_idx = ipa3_get_hw_type_index();
  4132. if (client >= IPA_CLIENT_MAX || client < 0) {
  4133. IPAERR_RL("Bad client number! client =%d\n", client);
  4134. return IPA_EP_NOT_ALLOCATED;
  4135. }
  4136. if (!ipa3_ep_mapping[hw_idx][client].valid)
  4137. return IPA_EP_NOT_ALLOCATED;
  4138. ipa_ep_idx =
  4139. ipa3_ep_mapping[hw_idx][client].ipa_gsi_ep_info.ipa_ep_num;
  4140. if (ipa_ep_idx < 0 || (ipa_ep_idx >= IPA3_MAX_NUM_PIPES
  4141. && client != IPA_CLIENT_DUMMY_CONS))
  4142. return IPA_EP_NOT_ALLOCATED;
  4143. return ipa_ep_idx;
  4144. }
  4145. /**
  4146. * ipa3_get_gsi_ep_info() - provide gsi ep information
  4147. * @client: IPA client value
  4148. *
  4149. * Return value: pointer to ipa_gsi_ep_info
  4150. */
  4151. const struct ipa_gsi_ep_config *ipa3_get_gsi_ep_info
  4152. (enum ipa_client_type client)
  4153. {
  4154. int ep_idx;
  4155. ep_idx = ipa3_get_ep_mapping(client);
  4156. if (ep_idx == IPA_EP_NOT_ALLOCATED)
  4157. return NULL;
  4158. if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
  4159. return NULL;
  4160. return &(ipa3_ep_mapping[ipa3_get_hw_type_index()]
  4161. [client].ipa_gsi_ep_info);
  4162. }
  4163. /**
  4164. * ipa_get_ep_group() - provide endpoint group by client
  4165. * @client: client type
  4166. *
  4167. * Return value: endpoint group
  4168. */
  4169. int ipa_get_ep_group(enum ipa_client_type client)
  4170. {
  4171. if (client >= IPA_CLIENT_MAX || client < 0) {
  4172. IPAERR("Bad client number! client =%d\n", client);
  4173. return -EINVAL;
  4174. }
  4175. if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
  4176. return -EINVAL;
  4177. return ipa3_ep_mapping[ipa3_get_hw_type_index()][client].group_num;
  4178. }
  4179. /**
  4180. * ipa3_get_qmb_master_sel() - provide QMB master selection for the client
  4181. * @client: client type
  4182. *
  4183. * Return value: QMB master index
  4184. */
  4185. u8 ipa3_get_qmb_master_sel(enum ipa_client_type client)
  4186. {
  4187. if (client >= IPA_CLIENT_MAX || client < 0) {
  4188. IPAERR("Bad client number! client =%d\n", client);
  4189. return -EINVAL;
  4190. }
  4191. if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
  4192. return -EINVAL;
  4193. return ipa3_ep_mapping[ipa3_get_hw_type_index()]
  4194. [client].qmb_master_sel;
  4195. }
  4196. /**
  4197. * ipa3_set_client() - provide client mapping
  4198. * @client: client type
  4199. *
  4200. * Return value: none
  4201. */
  4202. void ipa3_set_client(int index, enum ipacm_client_enum client, bool uplink)
  4203. {
  4204. if (client > IPACM_CLIENT_MAX || client < IPACM_CLIENT_USB) {
  4205. IPAERR("Bad client number! client =%d\n", client);
  4206. } else if (index >= IPA3_MAX_NUM_PIPES || index < 0) {
  4207. IPAERR("Bad pipe index! index =%d\n", index);
  4208. } else {
  4209. ipa3_ctx->ipacm_client[index].client_enum = client;
  4210. ipa3_ctx->ipacm_client[index].uplink = uplink;
  4211. }
  4212. }
  4213. /**
  4214. * ipa3_get_wlan_stats() - get ipa wifi stats
  4215. *
  4216. * Return value: success or failure
  4217. */
  4218. int ipa3_get_wlan_stats(struct ipa_get_wdi_sap_stats *wdi_sap_stats)
  4219. {
  4220. if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
  4221. ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_GET_WDI_SAP_STATS,
  4222. wdi_sap_stats);
  4223. } else {
  4224. IPAERR_RL("uc_wdi_ctx.stats_notify NULL\n");
  4225. return -EFAULT;
  4226. }
  4227. return 0;
  4228. }
  4229. /**
  4230. * ipa3_set_wlan_quota() - set ipa wifi quota
  4231. * @wdi_quota: quota requirement
  4232. *
  4233. * Return value: success or failure
  4234. */
  4235. int ipa3_set_wlan_quota(struct ipa_set_wifi_quota *wdi_quota)
  4236. {
  4237. if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
  4238. ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_SET_WIFI_QUOTA,
  4239. wdi_quota);
  4240. } else {
  4241. IPAERR("uc_wdi_ctx.stats_notify NULL\n");
  4242. return -EFAULT;
  4243. }
  4244. return 0;
  4245. }
  4246. /**
  4247. * ipa3_inform_wlan_bw() - inform wlan bw-index
  4248. *
  4249. * Return value: success or failure
  4250. */
  4251. int ipa3_inform_wlan_bw(struct ipa_inform_wlan_bw *wdi_bw)
  4252. {
  4253. if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
  4254. ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_INFORM_WLAN_BW,
  4255. wdi_bw);
  4256. } else {
  4257. IPAERR("uc_wdi_ctx.stats_notify NULL\n");
  4258. return -EFAULT;
  4259. }
  4260. return 0;
  4261. }
  4262. /**
  4263. * ipa3_get_client() - provide client mapping
  4264. * @client: client type
  4265. *
  4266. * Return value: client mapping enum
  4267. */
  4268. enum ipacm_client_enum ipa3_get_client(int pipe_idx)
  4269. {
  4270. if (pipe_idx >= IPA3_MAX_NUM_PIPES || pipe_idx < 0) {
  4271. IPAERR("Bad pipe index! pipe_idx =%d\n", pipe_idx);
  4272. return IPACM_CLIENT_MAX;
  4273. } else {
  4274. return ipa3_ctx->ipacm_client[pipe_idx].client_enum;
  4275. }
  4276. }
  4277. /**
  4278. * ipa2_get_client_uplink() - provide client mapping
  4279. * @client: client type
  4280. *
  4281. * Return value: none
  4282. */
  4283. bool ipa3_get_client_uplink(int pipe_idx)
  4284. {
  4285. if (pipe_idx < 0 || pipe_idx >= IPA3_MAX_NUM_PIPES) {
  4286. IPAERR("invalid pipe idx %d\n", pipe_idx);
  4287. return false;
  4288. }
  4289. return ipa3_ctx->ipacm_client[pipe_idx].uplink;
  4290. }
  4291. /**
  4292. * ipa3_get_client_mapping() - provide client mapping
  4293. * @pipe_idx: IPA end-point number
  4294. *
  4295. * Return value: client mapping
  4296. */
  4297. enum ipa_client_type ipa3_get_client_mapping(int pipe_idx)
  4298. {
  4299. if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
  4300. IPAERR("Bad pipe index!\n");
  4301. WARN_ON(1);
  4302. return -EINVAL;
  4303. }
  4304. return ipa3_ctx->ep[pipe_idx].client;
  4305. }
  4306. /**
  4307. * ipa3_get_client_by_pipe() - return client type relative to pipe
  4308. * index
  4309. * @pipe_idx: IPA end-point number
  4310. *
  4311. * Return value: client type
  4312. */
  4313. enum ipa_client_type ipa3_get_client_by_pipe(int pipe_idx)
  4314. {
  4315. int j = 0;
  4316. for (j = 0; j < IPA_CLIENT_MAX; j++) {
  4317. const struct ipa_ep_configuration *iec_ptr =
  4318. &(ipa3_ep_mapping[ipa3_get_hw_type_index()][j]);
  4319. if (iec_ptr->valid &&
  4320. iec_ptr->ipa_gsi_ep_info.ipa_ep_num == pipe_idx)
  4321. break;
  4322. }
  4323. if (j == IPA_CLIENT_MAX)
  4324. IPADBG("Got to IPA_CLIENT_MAX (%d) while searching for (%d)\n",
  4325. j, pipe_idx);
  4326. return j;
  4327. }
  4328. /**
  4329. * ipa_init_ep_flt_bitmap() - Initialize the bitmap
  4330. * that represents the End-points that supports filtering
  4331. */
  4332. void ipa_init_ep_flt_bitmap(void)
  4333. {
  4334. enum ipa_client_type cl;
  4335. u8 hw_idx = ipa3_get_hw_type_index();
  4336. u32 bitmap;
  4337. u32 pipe_num;
  4338. const struct ipa_gsi_ep_config *gsi_ep_ptr;
  4339. bitmap = 0;
  4340. if (ipa3_ctx->ep_flt_bitmap) {
  4341. WARN_ON(1);
  4342. return;
  4343. }
  4344. for (cl = 0; cl < IPA_CLIENT_MAX ; cl++) {
  4345. if (ipa3_ep_mapping[hw_idx][cl].support_flt) {
  4346. gsi_ep_ptr =
  4347. &ipa3_ep_mapping[hw_idx][cl].ipa_gsi_ep_info;
  4348. pipe_num =
  4349. gsi_ep_ptr->ipa_ep_num;
  4350. bitmap |= (1U << pipe_num);
  4351. if (bitmap != ipa3_ctx->ep_flt_bitmap) {
  4352. ipa3_ctx->ep_flt_bitmap = bitmap;
  4353. ipa3_ctx->ep_flt_num++;
  4354. }
  4355. }
  4356. }
  4357. }
  4358. /**
  4359. * ipa_is_ep_support_flt() - Given an End-point check
  4360. * whether it supports filtering or not.
  4361. *
  4362. * @pipe_idx:
  4363. *
  4364. * Return values:
  4365. * true if supports and false if not
  4366. */
  4367. bool ipa_is_ep_support_flt(int pipe_idx)
  4368. {
  4369. if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
  4370. IPAERR("Bad pipe index!\n");
  4371. return false;
  4372. }
  4373. return ipa3_ctx->ep_flt_bitmap & (1U<<pipe_idx);
  4374. }
  4375. /**
  4376. * ipa3_cfg_ep_seq() - IPA end-point HPS/DPS sequencer type configuration
  4377. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4378. *
  4379. * Returns: 0 on success, negative on failure
  4380. *
  4381. * Note: Should not be called from atomic context
  4382. */
  4383. int ipa3_cfg_ep_seq(u32 clnt_hdl, const struct ipa_ep_cfg_seq *seq_cfg)
  4384. {
  4385. int type;
  4386. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4387. ipa3_ctx->ep[clnt_hdl].valid == 0) {
  4388. IPAERR("bad param, clnt_hdl = %d", clnt_hdl);
  4389. return -EINVAL;
  4390. }
  4391. if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
  4392. IPAERR("SEQ does not apply to IPA consumer EP %d\n", clnt_hdl);
  4393. return -EINVAL;
  4394. }
  4395. /*
  4396. * Skip Configure sequencers type for test clients.
  4397. * These are configured dynamically in ipa3_cfg_ep_mode
  4398. */
  4399. if (IPA_CLIENT_IS_TEST(ipa3_ctx->ep[clnt_hdl].client)) {
  4400. IPADBG("Skip sequencers configuration for test clients\n");
  4401. return 0;
  4402. }
  4403. if (seq_cfg->set_dynamic)
  4404. type = seq_cfg->seq_type;
  4405. else
  4406. type = ipa3_ep_mapping[ipa3_get_hw_type_index()]
  4407. [ipa3_ctx->ep[clnt_hdl].client].sequencer_type;
  4408. if (type != IPA_DPS_HPS_SEQ_TYPE_INVALID) {
  4409. if (ipa3_ctx->ep[clnt_hdl].cfg.mode.mode == IPA_DMA &&
  4410. !IPA_DPS_HPS_SEQ_TYPE_IS_DMA(type)) {
  4411. IPAERR("Configuring non-DMA SEQ type to DMA pipe\n");
  4412. WARN_ON(1);
  4413. return -EINVAL;
  4414. }
  4415. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4416. /* Configure sequencers type*/
  4417. IPADBG("set sequencers to sequence 0x%x, ep = %d\n", type,
  4418. clnt_hdl);
  4419. ipahal_write_reg_n(IPA_ENDP_INIT_SEQ_n, clnt_hdl, type);
  4420. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4421. } else {
  4422. IPADBG("should not set sequencer type of ep = %d\n", clnt_hdl);
  4423. }
  4424. return 0;
  4425. }
  4426. /**
  4427. * ipa3_cfg_ep - IPA end-point configuration
  4428. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4429. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4430. *
  4431. * This includes nat, IPv6CT, header, mode, aggregation and route settings and
  4432. * is a one shot API to configure the IPA end-point fully
  4433. *
  4434. * Returns: 0 on success, negative on failure
  4435. *
  4436. * Note: Should not be called from atomic context
  4437. */
  4438. int ipa3_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg)
  4439. {
  4440. int result = -EINVAL;
  4441. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4442. ipa3_ctx->ep[clnt_hdl].valid == 0 || ipa_ep_cfg == NULL) {
  4443. IPAERR("bad parm.\n");
  4444. return -EINVAL;
  4445. }
  4446. result = ipa3_cfg_ep_hdr(clnt_hdl, &ipa_ep_cfg->hdr);
  4447. if (result)
  4448. return result;
  4449. result = ipa3_cfg_ep_hdr_ext(clnt_hdl, &ipa_ep_cfg->hdr_ext);
  4450. if (result)
  4451. return result;
  4452. result = ipa3_cfg_ep_aggr(clnt_hdl, &ipa_ep_cfg->aggr);
  4453. if (result)
  4454. return result;
  4455. result = ipa3_cfg_ep_cfg(clnt_hdl, &ipa_ep_cfg->cfg);
  4456. if (result)
  4457. return result;
  4458. if (IPA_CLIENT_IS_PROD(ipa3_ctx->ep[clnt_hdl].client)) {
  4459. result = ipa3_cfg_ep_nat(clnt_hdl, &ipa_ep_cfg->nat);
  4460. if (result)
  4461. return result;
  4462. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
  4463. result = ipa3_cfg_ep_conn_track(clnt_hdl,
  4464. &ipa_ep_cfg->conn_track);
  4465. if (result)
  4466. return result;
  4467. }
  4468. result = ipa3_cfg_ep_mode(clnt_hdl, &ipa_ep_cfg->mode);
  4469. if (result)
  4470. return result;
  4471. result = ipa3_cfg_ep_seq(clnt_hdl, &ipa_ep_cfg->seq);
  4472. if (result)
  4473. return result;
  4474. result = ipa3_cfg_ep_route(clnt_hdl, &ipa_ep_cfg->route);
  4475. if (result)
  4476. return result;
  4477. result = ipa3_cfg_ep_deaggr(clnt_hdl, &ipa_ep_cfg->deaggr);
  4478. if (result)
  4479. return result;
  4480. } else {
  4481. result = ipa3_cfg_ep_metadata_mask(clnt_hdl,
  4482. &ipa_ep_cfg->metadata_mask);
  4483. if (result)
  4484. return result;
  4485. }
  4486. return 0;
  4487. }
  4488. static const char *ipa3_get_nat_en_str(enum ipa_nat_en_type nat_en)
  4489. {
  4490. switch (nat_en) {
  4491. case (IPA_BYPASS_NAT):
  4492. return "NAT disabled";
  4493. case (IPA_SRC_NAT):
  4494. return "Source NAT";
  4495. case (IPA_DST_NAT):
  4496. return "Dst NAT";
  4497. }
  4498. return "undefined";
  4499. }
  4500. static const char *ipa3_get_ipv6ct_en_str(enum ipa_ipv6ct_en_type ipv6ct_en)
  4501. {
  4502. switch (ipv6ct_en) {
  4503. case (IPA_BYPASS_IPV6CT):
  4504. return "ipv6ct disabled";
  4505. case (IPA_ENABLE_IPV6CT):
  4506. return "ipv6ct enabled";
  4507. }
  4508. return "undefined";
  4509. }
  4510. /**
  4511. * ipa3_cfg_ep_nat() - IPA end-point NAT configuration
  4512. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4513. * @ep_nat: [in] IPA NAT end-point configuration params
  4514. *
  4515. * Returns: 0 on success, negative on failure
  4516. *
  4517. * Note: Should not be called from atomic context
  4518. */
  4519. int ipa3_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ep_nat)
  4520. {
  4521. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4522. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_nat == NULL) {
  4523. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4524. clnt_hdl,
  4525. ipa3_ctx->ep[clnt_hdl].valid);
  4526. return -EINVAL;
  4527. }
  4528. if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
  4529. IPAERR("NAT does not apply to IPA out EP %d\n", clnt_hdl);
  4530. return -EINVAL;
  4531. }
  4532. IPADBG("pipe=%d, nat_en=%d(%s)\n",
  4533. clnt_hdl,
  4534. ep_nat->nat_en,
  4535. ipa3_get_nat_en_str(ep_nat->nat_en));
  4536. /* copy over EP cfg */
  4537. ipa3_ctx->ep[clnt_hdl].cfg.nat = *ep_nat;
  4538. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4539. ipahal_write_reg_n_fields(IPA_ENDP_INIT_NAT_n, clnt_hdl, ep_nat);
  4540. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4541. return 0;
  4542. }
  4543. /**
  4544. * ipa3_cfg_ep_conn_track() - IPA end-point IPv6CT configuration
  4545. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4546. * @ep_conn_track: [in] IPA IPv6CT end-point configuration params
  4547. *
  4548. * Returns: 0 on success, negative on failure
  4549. *
  4550. * Note: Should not be called from atomic context
  4551. */
  4552. int ipa3_cfg_ep_conn_track(u32 clnt_hdl,
  4553. const struct ipa_ep_cfg_conn_track *ep_conn_track)
  4554. {
  4555. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4556. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_conn_track == NULL) {
  4557. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4558. clnt_hdl,
  4559. ipa3_ctx->ep[clnt_hdl].valid);
  4560. return -EINVAL;
  4561. }
  4562. if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
  4563. IPAERR("IPv6CT does not apply to IPA out EP %d\n", clnt_hdl);
  4564. return -EINVAL;
  4565. }
  4566. IPADBG("pipe=%d, conn_track_en=%d(%s)\n",
  4567. clnt_hdl,
  4568. ep_conn_track->conn_track_en,
  4569. ipa3_get_ipv6ct_en_str(ep_conn_track->conn_track_en));
  4570. /* copy over EP cfg */
  4571. ipa3_ctx->ep[clnt_hdl].cfg.conn_track = *ep_conn_track;
  4572. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4573. ipahal_write_reg_n_fields(IPA_ENDP_INIT_CONN_TRACK_n, clnt_hdl,
  4574. ep_conn_track);
  4575. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4576. return 0;
  4577. }
  4578. /**
  4579. * ipa3_cfg_ep_status() - IPA end-point status configuration
  4580. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4581. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4582. *
  4583. * Returns: 0 on success, negative on failure
  4584. *
  4585. * Note: Should not be called from atomic context
  4586. */
  4587. int ipa3_cfg_ep_status(u32 clnt_hdl,
  4588. const struct ipahal_reg_ep_cfg_status *ep_status)
  4589. {
  4590. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4591. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_status == NULL) {
  4592. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4593. clnt_hdl,
  4594. ipa3_ctx->ep[clnt_hdl].valid);
  4595. return -EINVAL;
  4596. }
  4597. IPADBG("pipe=%d, status_en=%d status_ep=%d status_location=%d\n",
  4598. clnt_hdl,
  4599. ep_status->status_en,
  4600. ep_status->status_ep,
  4601. ep_status->status_location);
  4602. /* copy over EP cfg */
  4603. ipa3_ctx->ep[clnt_hdl].status = *ep_status;
  4604. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4605. ipahal_write_reg_n_fields(IPA_ENDP_STATUS_n, clnt_hdl, ep_status);
  4606. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4607. return 0;
  4608. }
  4609. /**
  4610. * ipa3_cfg_ep_cfg() - IPA end-point cfg configuration
  4611. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4612. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4613. *
  4614. * Returns: 0 on success, negative on failure
  4615. *
  4616. * Note: Should not be called from atomic context
  4617. */
  4618. int ipa3_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *cfg)
  4619. {
  4620. u8 qmb_master_sel;
  4621. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4622. ipa3_ctx->ep[clnt_hdl].valid == 0 || cfg == NULL) {
  4623. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4624. clnt_hdl,
  4625. ipa3_ctx->ep[clnt_hdl].valid);
  4626. return -EINVAL;
  4627. }
  4628. /* copy over EP cfg */
  4629. ipa3_ctx->ep[clnt_hdl].cfg.cfg = *cfg;
  4630. /* Override QMB master selection */
  4631. qmb_master_sel = ipa3_get_qmb_master_sel(ipa3_ctx->ep[clnt_hdl].client);
  4632. ipa3_ctx->ep[clnt_hdl].cfg.cfg.gen_qmb_master_sel = qmb_master_sel;
  4633. IPADBG(
  4634. "pipe=%d, frag_ofld_en=%d cs_ofld_en=%d mdata_hdr_ofst=%d gen_qmb_master_sel=%d\n",
  4635. clnt_hdl,
  4636. ipa3_ctx->ep[clnt_hdl].cfg.cfg.frag_offload_en,
  4637. ipa3_ctx->ep[clnt_hdl].cfg.cfg.cs_offload_en,
  4638. ipa3_ctx->ep[clnt_hdl].cfg.cfg.cs_metadata_hdr_offset,
  4639. ipa3_ctx->ep[clnt_hdl].cfg.cfg.gen_qmb_master_sel);
  4640. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4641. ipahal_write_reg_n_fields(IPA_ENDP_INIT_CFG_n, clnt_hdl,
  4642. &ipa3_ctx->ep[clnt_hdl].cfg.cfg);
  4643. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4644. return 0;
  4645. }
  4646. /**
  4647. * ipa3_cfg_ep_metadata_mask() - IPA end-point meta-data mask configuration
  4648. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4649. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4650. *
  4651. * Returns: 0 on success, negative on failure
  4652. *
  4653. * Note: Should not be called from atomic context
  4654. */
  4655. int ipa3_cfg_ep_metadata_mask(u32 clnt_hdl,
  4656. const struct ipa_ep_cfg_metadata_mask
  4657. *metadata_mask)
  4658. {
  4659. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4660. ipa3_ctx->ep[clnt_hdl].valid == 0 || metadata_mask == NULL) {
  4661. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4662. clnt_hdl,
  4663. ipa3_ctx->ep[clnt_hdl].valid);
  4664. return -EINVAL;
  4665. }
  4666. IPADBG("pipe=%d, metadata_mask=0x%x\n",
  4667. clnt_hdl,
  4668. metadata_mask->metadata_mask);
  4669. /* copy over EP cfg */
  4670. ipa3_ctx->ep[clnt_hdl].cfg.metadata_mask = *metadata_mask;
  4671. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4672. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_METADATA_MASK_n,
  4673. clnt_hdl, metadata_mask);
  4674. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4675. return 0;
  4676. }
  4677. /**
  4678. * ipa3_cfg_ep_hdr() - IPA end-point header configuration
  4679. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4680. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4681. *
  4682. * Returns: 0 on success, negative on failure
  4683. *
  4684. * Note: Should not be called from atomic context
  4685. */
  4686. int ipa3_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ep_hdr)
  4687. {
  4688. struct ipa3_ep_context *ep;
  4689. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4690. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_hdr == NULL) {
  4691. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4692. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
  4693. return -EINVAL;
  4694. }
  4695. IPADBG("pipe=%d metadata_reg_valid=%d\n",
  4696. clnt_hdl,
  4697. ep_hdr->hdr_metadata_reg_valid);
  4698. IPADBG("remove_additional=%d, a5_mux=%d, ofst_pkt_size=0x%x\n",
  4699. ep_hdr->hdr_remove_additional,
  4700. ep_hdr->hdr_a5_mux,
  4701. ep_hdr->hdr_ofst_pkt_size);
  4702. IPADBG("ofst_pkt_size_valid=%d, additional_const_len=0x%x\n",
  4703. ep_hdr->hdr_ofst_pkt_size_valid,
  4704. ep_hdr->hdr_additional_const_len);
  4705. IPADBG("ofst_metadata=0x%x, ofst_metadata_valid=%d, len=0x%x\n",
  4706. ep_hdr->hdr_ofst_metadata,
  4707. ep_hdr->hdr_ofst_metadata_valid,
  4708. ep_hdr->hdr_len);
  4709. ep = &ipa3_ctx->ep[clnt_hdl];
  4710. /* copy over EP cfg */
  4711. ep->cfg.hdr = *ep_hdr;
  4712. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4713. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_n, clnt_hdl, &ep->cfg.hdr);
  4714. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4715. return 0;
  4716. }
  4717. /**
  4718. * ipa3_cfg_ep_hdr_ext() - IPA end-point extended header configuration
  4719. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4720. * @ep_hdr_ext: [in] IPA end-point configuration params
  4721. *
  4722. * Returns: 0 on success, negative on failure
  4723. *
  4724. * Note: Should not be called from atomic context
  4725. */
  4726. int ipa3_cfg_ep_hdr_ext(u32 clnt_hdl,
  4727. const struct ipa_ep_cfg_hdr_ext *ep_hdr_ext)
  4728. {
  4729. struct ipa3_ep_context *ep;
  4730. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4731. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_hdr_ext == NULL) {
  4732. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4733. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
  4734. return -EINVAL;
  4735. }
  4736. IPADBG("pipe=%d hdr_pad_to_alignment=%d\n",
  4737. clnt_hdl,
  4738. ep_hdr_ext->hdr_pad_to_alignment);
  4739. IPADBG("hdr_total_len_or_pad_offset=%d\n",
  4740. ep_hdr_ext->hdr_total_len_or_pad_offset);
  4741. IPADBG("hdr_payload_len_inc_padding=%d hdr_total_len_or_pad=%d\n",
  4742. ep_hdr_ext->hdr_payload_len_inc_padding,
  4743. ep_hdr_ext->hdr_total_len_or_pad);
  4744. IPADBG("hdr_total_len_or_pad_valid=%d hdr_little_endian=%d\n",
  4745. ep_hdr_ext->hdr_total_len_or_pad_valid,
  4746. ep_hdr_ext->hdr_little_endian);
  4747. ep = &ipa3_ctx->ep[clnt_hdl];
  4748. /* copy over EP cfg */
  4749. ep->cfg.hdr_ext = *ep_hdr_ext;
  4750. ep->cfg.hdr_ext.hdr = &ep->cfg.hdr;
  4751. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4752. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_EXT_n, clnt_hdl,
  4753. &ep->cfg.hdr_ext);
  4754. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4755. return 0;
  4756. }
  4757. /**
  4758. * ipa3_cfg_ep_ctrl() - IPA end-point Control configuration
  4759. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4760. * @ipa_ep_cfg_ctrl: [in] IPA end-point configuration params
  4761. *
  4762. * Returns: 0 on success, negative on failure
  4763. */
  4764. int ipa3_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl)
  4765. {
  4766. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes || ep_ctrl == NULL) {
  4767. IPAERR("bad parm, clnt_hdl = %d\n", clnt_hdl);
  4768. return -EINVAL;
  4769. }
  4770. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0 && ep_ctrl->ipa_ep_suspend) {
  4771. IPAERR("pipe suspend is not supported\n");
  4772. WARN_ON(1);
  4773. return -EPERM;
  4774. }
  4775. if (ipa3_ctx->ipa_endp_delay_wa) {
  4776. IPAERR("pipe setting delay is not supported\n");
  4777. return 0;
  4778. }
  4779. IPADBG("pipe=%d ep_suspend=%d, ep_delay=%d\n",
  4780. clnt_hdl,
  4781. ep_ctrl->ipa_ep_suspend,
  4782. ep_ctrl->ipa_ep_delay);
  4783. ipahal_write_reg_n_fields(IPA_ENDP_INIT_CTRL_n, clnt_hdl, ep_ctrl);
  4784. if (ep_ctrl->ipa_ep_suspend == true &&
  4785. IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client))
  4786. ipa3_suspend_active_aggr_wa(clnt_hdl);
  4787. return 0;
  4788. }
  4789. const char *ipa3_get_mode_type_str(enum ipa_mode_type mode)
  4790. {
  4791. switch (mode) {
  4792. case (IPA_BASIC):
  4793. return "Basic";
  4794. case (IPA_ENABLE_FRAMING_HDLC):
  4795. return "HDLC framing";
  4796. case (IPA_ENABLE_DEFRAMING_HDLC):
  4797. return "HDLC de-framing";
  4798. case (IPA_DMA):
  4799. return "DMA";
  4800. }
  4801. return "undefined";
  4802. }
  4803. /**
  4804. * ipa3_cfg_ep_mode() - IPA end-point mode configuration
  4805. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4806. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4807. *
  4808. * Returns: 0 on success, negative on failure
  4809. *
  4810. * Note: Should not be called from atomic context
  4811. */
  4812. int ipa3_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ep_mode)
  4813. {
  4814. int ep;
  4815. int type;
  4816. struct ipahal_reg_endp_init_mode init_mode;
  4817. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4818. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_mode == NULL) {
  4819. IPAERR("bad params clnt_hdl=%d , ep_valid=%d ep_mode=%pK\n",
  4820. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid,
  4821. ep_mode);
  4822. return -EINVAL;
  4823. }
  4824. if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
  4825. IPAERR("MODE does not apply to IPA out EP %d\n", clnt_hdl);
  4826. return -EINVAL;
  4827. }
  4828. ep = ipa3_get_ep_mapping(ep_mode->dst);
  4829. if (ep == -1 && ep_mode->mode == IPA_DMA) {
  4830. IPAERR("dst %d does not exist in DMA mode\n", ep_mode->dst);
  4831. return -EINVAL;
  4832. }
  4833. WARN_ON(ep_mode->mode == IPA_DMA && IPA_CLIENT_IS_PROD(ep_mode->dst));
  4834. if (!IPA_CLIENT_IS_CONS(ep_mode->dst))
  4835. ep = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
  4836. IPADBG("pipe=%d mode=%d(%s), dst_client_number=%d\n",
  4837. clnt_hdl,
  4838. ep_mode->mode,
  4839. ipa3_get_mode_type_str(ep_mode->mode),
  4840. ep_mode->dst);
  4841. /* copy over EP cfg */
  4842. ipa3_ctx->ep[clnt_hdl].cfg.mode = *ep_mode;
  4843. ipa3_ctx->ep[clnt_hdl].dst_pipe_index = ep;
  4844. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  4845. init_mode.dst_pipe_number = ipa3_ctx->ep[clnt_hdl].dst_pipe_index;
  4846. init_mode.ep_mode = *ep_mode;
  4847. ipahal_write_reg_n_fields(IPA_ENDP_INIT_MODE_n, clnt_hdl, &init_mode);
  4848. /* Configure sequencers type for test clients*/
  4849. if (IPA_CLIENT_IS_TEST(ipa3_ctx->ep[clnt_hdl].client)) {
  4850. if (ep_mode->mode == IPA_DMA)
  4851. type = IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY;
  4852. else
  4853. /* In IPA4.2 only single pass only supported*/
  4854. if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_2)
  4855. type =
  4856. IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP;
  4857. else
  4858. type =
  4859. IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP;
  4860. IPADBG(" set sequencers to sequance 0x%x, ep = %d\n", type,
  4861. clnt_hdl);
  4862. ipahal_write_reg_n(IPA_ENDP_INIT_SEQ_n, clnt_hdl, type);
  4863. }
  4864. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  4865. return 0;
  4866. }
  4867. const char *ipa3_get_aggr_enable_str(enum ipa_aggr_en_type aggr_en)
  4868. {
  4869. switch (aggr_en) {
  4870. case (IPA_BYPASS_AGGR):
  4871. return "no aggregation";
  4872. case (IPA_ENABLE_AGGR):
  4873. return "aggregation enabled";
  4874. case (IPA_ENABLE_DEAGGR):
  4875. return "de-aggregation enabled";
  4876. }
  4877. return "undefined";
  4878. }
  4879. const char *ipa3_get_aggr_type_str(enum ipa_aggr_type aggr_type)
  4880. {
  4881. switch (aggr_type) {
  4882. case (IPA_MBIM_16):
  4883. return "MBIM_16";
  4884. case (IPA_HDLC):
  4885. return "HDLC";
  4886. case (IPA_TLP):
  4887. return "TLP";
  4888. case (IPA_RNDIS):
  4889. return "RNDIS";
  4890. case (IPA_GENERIC):
  4891. return "GENERIC";
  4892. case (IPA_QCMAP):
  4893. return "QCMAP";
  4894. case (IPA_COALESCE):
  4895. return "COALESCE";
  4896. }
  4897. return "undefined";
  4898. }
  4899. static u32 ipa3_time_gran_usec_step(enum ipa_timers_time_gran_type gran)
  4900. {
  4901. switch (gran) {
  4902. case IPA_TIMERS_TIME_GRAN_10_USEC: return 10;
  4903. case IPA_TIMERS_TIME_GRAN_20_USEC: return 20;
  4904. case IPA_TIMERS_TIME_GRAN_50_USEC: return 50;
  4905. case IPA_TIMERS_TIME_GRAN_100_USEC: return 100;
  4906. case IPA_TIMERS_TIME_GRAN_1_MSEC: return 1000;
  4907. case IPA_TIMERS_TIME_GRAN_10_MSEC: return 10000;
  4908. case IPA_TIMERS_TIME_GRAN_100_MSEC: return 100000;
  4909. case IPA_TIMERS_TIME_GRAN_NEAR_HALF_SEC: return 655350;
  4910. default:
  4911. IPAERR("Invalid granularity time unit %d\n", gran);
  4912. ipa_assert();
  4913. break;
  4914. }
  4915. return 100;
  4916. }
  4917. /*
  4918. * ipa3_process_timer_cfg() - Check and produce timer config
  4919. *
  4920. * Relevant for IPA 4.5 and above
  4921. *
  4922. * Assumes clocks are voted
  4923. */
  4924. static int ipa3_process_timer_cfg(u32 time_us,
  4925. u8 *pulse_gen, u8 *time_units)
  4926. {
  4927. struct ipahal_reg_timers_pulse_gran_cfg gran_cfg;
  4928. u32 gran0_step, gran1_step;
  4929. IPADBG("time in usec=%u\n", time_us);
  4930. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) {
  4931. IPAERR("Invalid IPA version %d\n", ipa3_ctx->ipa_hw_type);
  4932. return -EPERM;
  4933. }
  4934. if (!time_us) {
  4935. *pulse_gen = 0;
  4936. *time_units = 0;
  4937. return 0;
  4938. }
  4939. ipahal_read_reg_fields(IPA_TIMERS_PULSE_GRAN_CFG, &gran_cfg);
  4940. gran0_step = ipa3_time_gran_usec_step(gran_cfg.gran_0);
  4941. gran1_step = ipa3_time_gran_usec_step(gran_cfg.gran_1);
  4942. /* gran_2 is not used by AP */
  4943. IPADBG("gran0 usec step=%u gran1 usec step=%u\n",
  4944. gran0_step, gran1_step);
  4945. /* Lets try pulse generator #0 granularity */
  4946. if (!(time_us % gran0_step)) {
  4947. if ((time_us / gran0_step) <= IPA_TIMER_SCALED_TIME_LIMIT) {
  4948. *pulse_gen = 0;
  4949. *time_units = time_us / gran0_step;
  4950. IPADBG("Matched: generator=0, units=%u\n",
  4951. *time_units);
  4952. return 0;
  4953. }
  4954. IPADBG("gran0 cannot be used due to range limit\n");
  4955. }
  4956. /* Lets try pulse generator #1 granularity */
  4957. if (!(time_us % gran1_step)) {
  4958. if ((time_us / gran1_step) <= IPA_TIMER_SCALED_TIME_LIMIT) {
  4959. *pulse_gen = 1;
  4960. *time_units = time_us / gran1_step;
  4961. IPADBG("Matched: generator=1, units=%u\n",
  4962. *time_units);
  4963. return 0;
  4964. }
  4965. IPADBG("gran1 cannot be used due to range limit\n");
  4966. }
  4967. IPAERR("Cannot match requested time to configured granularities\n");
  4968. return -EPERM;
  4969. }
  4970. /**
  4971. * ipa3_cfg_ep_aggr() - IPA end-point aggregation configuration
  4972. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  4973. * @ipa_ep_cfg: [in] IPA end-point configuration params
  4974. *
  4975. * Returns: 0 on success, negative on failure
  4976. *
  4977. * Note: Should not be called from atomic context
  4978. */
  4979. int ipa3_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ep_aggr)
  4980. {
  4981. int res = 0;
  4982. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  4983. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_aggr == NULL) {
  4984. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  4985. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
  4986. return -EINVAL;
  4987. }
  4988. if (ep_aggr->aggr_en == IPA_ENABLE_DEAGGR &&
  4989. !IPA_EP_SUPPORTS_DEAGGR(clnt_hdl)) {
  4990. IPAERR("pipe=%d cannot be configured to DEAGGR\n", clnt_hdl);
  4991. WARN_ON(1);
  4992. return -EINVAL;
  4993. }
  4994. IPADBG("pipe=%d en=%d(%s), type=%d(%s), byte_limit=%d, time_limit=%d\n",
  4995. clnt_hdl,
  4996. ep_aggr->aggr_en,
  4997. ipa3_get_aggr_enable_str(ep_aggr->aggr_en),
  4998. ep_aggr->aggr,
  4999. ipa3_get_aggr_type_str(ep_aggr->aggr),
  5000. ep_aggr->aggr_byte_limit,
  5001. ep_aggr->aggr_time_limit);
  5002. IPADBG("hard_byte_limit_en=%d aggr_sw_eof_active=%d\n",
  5003. ep_aggr->aggr_hard_byte_limit_en,
  5004. ep_aggr->aggr_sw_eof_active);
  5005. /* copy over EP cfg */
  5006. ipa3_ctx->ep[clnt_hdl].cfg.aggr = *ep_aggr;
  5007. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  5008. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) {
  5009. res = ipa3_process_timer_cfg(ep_aggr->aggr_time_limit,
  5010. &ipa3_ctx->ep[clnt_hdl].cfg.aggr.pulse_generator,
  5011. &ipa3_ctx->ep[clnt_hdl].cfg.aggr.scaled_time);
  5012. if (res) {
  5013. IPAERR("failed to process AGGR timer tmr=%u\n",
  5014. ep_aggr->aggr_time_limit);
  5015. ipa_assert();
  5016. res = -EINVAL;
  5017. goto complete;
  5018. }
  5019. /*
  5020. * HW bug on IPA4.5 where gran is used from pipe 0 instead of
  5021. * coal pipe. Add this check to make sure that RSC pipe will use
  5022. * gran 0 per the requested time needed; pipe 0 will use always
  5023. * gran 0 as gran 0 is the POR value of it and s/w never change
  5024. * it.
  5025. */
  5026. if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_5 &&
  5027. ipa3_get_client_mapping(clnt_hdl) ==
  5028. IPA_CLIENT_APPS_WAN_COAL_CONS &&
  5029. ipa3_ctx->ep[clnt_hdl].cfg.aggr.pulse_generator != 0) {
  5030. IPAERR("coal pipe using GRAN_SEL = %d\n",
  5031. ipa3_ctx->ep[clnt_hdl].cfg.aggr.pulse_generator);
  5032. ipa_assert();
  5033. }
  5034. } else {
  5035. /*
  5036. * Global aggregation granularity is 0.5msec.
  5037. * So if H/W programmed with 1msec, it will be
  5038. * 0.5msec defacto.
  5039. * So finest granularity is 0.5msec
  5040. */
  5041. if (ep_aggr->aggr_time_limit % 500) {
  5042. IPAERR("given time limit %u is not in 0.5msec\n",
  5043. ep_aggr->aggr_time_limit);
  5044. WARN_ON(1);
  5045. res = -EINVAL;
  5046. goto complete;
  5047. }
  5048. /* Due to described above global granularity */
  5049. ipa3_ctx->ep[clnt_hdl].cfg.aggr.aggr_time_limit *= 2;
  5050. }
  5051. ipahal_write_reg_n_fields(IPA_ENDP_INIT_AGGR_n, clnt_hdl,
  5052. &ipa3_ctx->ep[clnt_hdl].cfg.aggr);
  5053. complete:
  5054. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  5055. return res;
  5056. }
  5057. /**
  5058. * ipa3_cfg_ep_route() - IPA end-point routing configuration
  5059. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  5060. * @ipa_ep_cfg: [in] IPA end-point configuration params
  5061. *
  5062. * Returns: 0 on success, negative on failure
  5063. *
  5064. * Note: Should not be called from atomic context
  5065. */
  5066. int ipa3_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ep_route)
  5067. {
  5068. struct ipahal_reg_endp_init_route init_rt;
  5069. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  5070. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_route == NULL) {
  5071. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  5072. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
  5073. return -EINVAL;
  5074. }
  5075. if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
  5076. IPAERR("ROUTE does not apply to IPA out EP %d\n",
  5077. clnt_hdl);
  5078. return -EINVAL;
  5079. }
  5080. /*
  5081. * if DMA mode was configured previously for this EP, return with
  5082. * success
  5083. */
  5084. if (ipa3_ctx->ep[clnt_hdl].cfg.mode.mode == IPA_DMA) {
  5085. IPADBG("DMA enabled for ep %d, dst pipe is part of DMA\n",
  5086. clnt_hdl);
  5087. return 0;
  5088. }
  5089. if (ep_route->rt_tbl_hdl)
  5090. IPAERR("client specified non-zero RT TBL hdl - ignore it\n");
  5091. IPADBG("pipe=%d, rt_tbl_hdl=%d\n",
  5092. clnt_hdl,
  5093. ep_route->rt_tbl_hdl);
  5094. /* always use "default" routing table when programming EP ROUTE reg */
  5095. ipa3_ctx->ep[clnt_hdl].rt_tbl_idx =
  5096. IPA_MEM_PART(v4_apps_rt_index_lo);
  5097. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0) {
  5098. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  5099. init_rt.route_table_index = ipa3_ctx->ep[clnt_hdl].rt_tbl_idx;
  5100. ipahal_write_reg_n_fields(IPA_ENDP_INIT_ROUTE_n,
  5101. clnt_hdl, &init_rt);
  5102. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  5103. }
  5104. return 0;
  5105. }
  5106. #define MAX_ALLOWED_BASE_VAL 0x1f
  5107. #define MAX_ALLOWED_SCALE_VAL 0x1f
  5108. /**
  5109. * ipa3_cal_ep_holb_scale_base_val - calculate base and scale value from tmr_val
  5110. *
  5111. * In IPA4.2 HW version need configure base and scale value in HOL timer reg
  5112. * @tmr_val: [in] timer value for HOL timer
  5113. * @ipa_ep_cfg: [out] Fill IPA end-point configuration base and scale value
  5114. * and return
  5115. */
  5116. void ipa3_cal_ep_holb_scale_base_val(u32 tmr_val,
  5117. struct ipa_ep_cfg_holb *ep_holb)
  5118. {
  5119. u32 base_val, scale, scale_val = 1, base = 2;
  5120. for (scale = 0; scale <= MAX_ALLOWED_SCALE_VAL; scale++) {
  5121. base_val = tmr_val/scale_val;
  5122. if (scale != 0)
  5123. scale_val *= base;
  5124. if (base_val <= MAX_ALLOWED_BASE_VAL)
  5125. break;
  5126. }
  5127. ep_holb->base_val = base_val;
  5128. ep_holb->scale = scale_val;
  5129. }
  5130. /**
  5131. * ipa3_cfg_ep_holb() - IPA end-point holb configuration
  5132. *
  5133. * If an IPA producer pipe is full, IPA HW by default will block
  5134. * indefinitely till space opens up. During this time no packets
  5135. * including those from unrelated pipes will be processed. Enabling
  5136. * HOLB means IPA HW will be allowed to drop packets as/when needed
  5137. * and indefinite blocking is avoided.
  5138. *
  5139. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  5140. * @ipa_ep_cfg: [in] IPA end-point configuration params
  5141. *
  5142. * Returns: 0 on success, negative on failure
  5143. */
  5144. int ipa3_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb)
  5145. {
  5146. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  5147. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_holb == NULL ||
  5148. ep_holb->tmr_val > ipa3_ctx->ctrl->max_holb_tmr_val ||
  5149. ep_holb->en > 1) {
  5150. IPAERR("bad parm.\n");
  5151. return -EINVAL;
  5152. }
  5153. if (IPA_CLIENT_IS_PROD(ipa3_ctx->ep[clnt_hdl].client)) {
  5154. IPAERR("HOLB does not apply to IPA in EP %d\n", clnt_hdl);
  5155. return -EINVAL;
  5156. }
  5157. ipa3_ctx->ep[clnt_hdl].holb = *ep_holb;
  5158. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  5159. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, clnt_hdl,
  5160. ep_holb);
  5161. /* IPA4.5 issue requires HOLB_EN to be written twice */
  5162. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5)
  5163. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n,
  5164. clnt_hdl, ep_holb);
  5165. /* Configure timer */
  5166. if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_2) {
  5167. ipa3_cal_ep_holb_scale_base_val(ep_holb->tmr_val,
  5168. &ipa3_ctx->ep[clnt_hdl].holb);
  5169. goto success;
  5170. }
  5171. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) {
  5172. int res;
  5173. res = ipa3_process_timer_cfg(ep_holb->tmr_val * 1000,
  5174. &ipa3_ctx->ep[clnt_hdl].holb.pulse_generator,
  5175. &ipa3_ctx->ep[clnt_hdl].holb.scaled_time);
  5176. if (res) {
  5177. IPAERR("failed to process HOLB timer tmr=%u\n",
  5178. ep_holb->tmr_val);
  5179. ipa_assert();
  5180. return res;
  5181. }
  5182. }
  5183. success:
  5184. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_TIMER_n,
  5185. clnt_hdl, &ipa3_ctx->ep[clnt_hdl].holb);
  5186. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  5187. IPADBG("cfg holb %u ep=%d tmr=%d\n", ep_holb->en, clnt_hdl,
  5188. ep_holb->tmr_val);
  5189. return 0;
  5190. }
  5191. /**
  5192. * ipa3_cfg_ep_holb_by_client() - IPA end-point holb configuration
  5193. *
  5194. * Wrapper function for ipa3_cfg_ep_holb() with client name instead of
  5195. * client handle. This function is used for clients that does not have
  5196. * client handle.
  5197. *
  5198. * @client: [in] client name
  5199. * @ipa_ep_cfg: [in] IPA end-point configuration params
  5200. *
  5201. * Returns: 0 on success, negative on failure
  5202. */
  5203. int ipa3_cfg_ep_holb_by_client(enum ipa_client_type client,
  5204. const struct ipa_ep_cfg_holb *ep_holb)
  5205. {
  5206. return ipa3_cfg_ep_holb(ipa3_get_ep_mapping(client), ep_holb);
  5207. }
  5208. /**
  5209. * ipa3_cfg_ep_deaggr() - IPA end-point deaggregation configuration
  5210. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  5211. * @ep_deaggr: [in] IPA end-point configuration params
  5212. *
  5213. * Returns: 0 on success, negative on failure
  5214. *
  5215. * Note: Should not be called from atomic context
  5216. */
  5217. int ipa3_cfg_ep_deaggr(u32 clnt_hdl,
  5218. const struct ipa_ep_cfg_deaggr *ep_deaggr)
  5219. {
  5220. struct ipa3_ep_context *ep;
  5221. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  5222. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_deaggr == NULL) {
  5223. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  5224. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
  5225. return -EINVAL;
  5226. }
  5227. IPADBG("pipe=%d deaggr_hdr_len=%d\n",
  5228. clnt_hdl,
  5229. ep_deaggr->deaggr_hdr_len);
  5230. IPADBG("packet_offset_valid=%d\n",
  5231. ep_deaggr->packet_offset_valid);
  5232. IPADBG("packet_offset_location=%d max_packet_len=%d\n",
  5233. ep_deaggr->packet_offset_location,
  5234. ep_deaggr->max_packet_len);
  5235. ep = &ipa3_ctx->ep[clnt_hdl];
  5236. /* copy over EP cfg */
  5237. ep->cfg.deaggr = *ep_deaggr;
  5238. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  5239. ipahal_write_reg_n_fields(IPA_ENDP_INIT_DEAGGR_n, clnt_hdl,
  5240. &ep->cfg.deaggr);
  5241. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  5242. return 0;
  5243. }
  5244. /**
  5245. * ipa3_cfg_ep_metadata() - IPA end-point metadata configuration
  5246. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  5247. * @ipa_ep_cfg: [in] IPA end-point configuration params
  5248. *
  5249. * Returns: 0 on success, negative on failure
  5250. *
  5251. * Note: Should not be called from atomic context
  5252. */
  5253. int ipa3_cfg_ep_metadata(u32 clnt_hdl, const struct ipa_ep_cfg_metadata *ep_md)
  5254. {
  5255. u32 qmap_id = 0;
  5256. struct ipa_ep_cfg_metadata ep_md_reg_wrt;
  5257. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  5258. ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_md == NULL) {
  5259. IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
  5260. clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
  5261. return -EINVAL;
  5262. }
  5263. IPADBG("pipe=%d, mux id=%d\n", clnt_hdl, ep_md->qmap_id);
  5264. /* copy over EP cfg */
  5265. ipa3_ctx->ep[clnt_hdl].cfg.meta = *ep_md;
  5266. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  5267. ep_md_reg_wrt = *ep_md;
  5268. qmap_id = (ep_md->qmap_id <<
  5269. IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_SHFT) &
  5270. IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_BMASK;
  5271. /* mark tethering bit for remote modem */
  5272. if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_1)
  5273. qmap_id |= IPA_QMAP_TETH_BIT;
  5274. ep_md_reg_wrt.qmap_id = qmap_id;
  5275. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_METADATA_n, clnt_hdl,
  5276. &ep_md_reg_wrt);
  5277. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) {
  5278. ipa3_ctx->ep[clnt_hdl].cfg.hdr.hdr_metadata_reg_valid = 1;
  5279. ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_n, clnt_hdl,
  5280. &ipa3_ctx->ep[clnt_hdl].cfg.hdr);
  5281. }
  5282. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  5283. return 0;
  5284. }
  5285. int ipa3_write_qmap_id(struct ipa_ioc_write_qmapid *param_in)
  5286. {
  5287. struct ipa_ep_cfg_metadata meta;
  5288. struct ipa3_ep_context *ep;
  5289. int ipa_ep_idx;
  5290. int result = -EINVAL;
  5291. if (param_in->client >= IPA_CLIENT_MAX) {
  5292. IPAERR_RL("bad parm client:%d\n", param_in->client);
  5293. goto fail;
  5294. }
  5295. ipa_ep_idx = ipa3_get_ep_mapping(param_in->client);
  5296. if (ipa_ep_idx == -1) {
  5297. IPAERR_RL("Invalid client.\n");
  5298. goto fail;
  5299. }
  5300. ep = &ipa3_ctx->ep[ipa_ep_idx];
  5301. if (!ep->valid) {
  5302. IPAERR_RL("EP not allocated.\n");
  5303. goto fail;
  5304. }
  5305. meta.qmap_id = param_in->qmap_id;
  5306. if (param_in->client == IPA_CLIENT_USB_PROD ||
  5307. param_in->client == IPA_CLIENT_HSIC1_PROD ||
  5308. param_in->client == IPA_CLIENT_ODU_PROD ||
  5309. param_in->client == IPA_CLIENT_ETHERNET_PROD ||
  5310. param_in->client == IPA_CLIENT_WIGIG_PROD) {
  5311. result = ipa3_cfg_ep_metadata(ipa_ep_idx, &meta);
  5312. } else if (param_in->client == IPA_CLIENT_WLAN1_PROD ||
  5313. param_in->client == IPA_CLIENT_WLAN2_PROD) {
  5314. ipa3_ctx->ep[ipa_ep_idx].cfg.meta = meta;
  5315. if (param_in->client == IPA_CLIENT_WLAN2_PROD)
  5316. result = ipa3_write_qmapid_wdi3_gsi_pipe(
  5317. ipa_ep_idx, meta.qmap_id);
  5318. else
  5319. result = ipa3_write_qmapid_wdi_pipe(
  5320. ipa_ep_idx, meta.qmap_id);
  5321. if (result)
  5322. IPAERR_RL("qmap_id %d write failed on ep=%d\n",
  5323. meta.qmap_id, ipa_ep_idx);
  5324. result = 0;
  5325. }
  5326. fail:
  5327. return result;
  5328. }
  5329. /**
  5330. * ipa3_dump_buff_internal() - dumps buffer for debug purposes
  5331. * @base: buffer base address
  5332. * @phy_base: buffer physical base address
  5333. * @size: size of the buffer
  5334. */
  5335. void ipa3_dump_buff_internal(void *base, dma_addr_t phy_base, u32 size)
  5336. {
  5337. int i;
  5338. u32 *cur = (u32 *)base;
  5339. u8 *byt;
  5340. IPADBG("system phys addr=%pa len=%u\n", &phy_base, size);
  5341. for (i = 0; i < size / 4; i++) {
  5342. byt = (u8 *)(cur + i);
  5343. IPADBG("%2d %08x %02x %02x %02x %02x\n", i, *(cur + i),
  5344. byt[0], byt[1], byt[2], byt[3]);
  5345. }
  5346. IPADBG("END\n");
  5347. }
  5348. /**
  5349. * ipa3_set_aggr_mode() - Set the aggregation mode which is a global setting
  5350. * @mode: [in] the desired aggregation mode for e.g. straight MBIM, QCNCM,
  5351. * etc
  5352. *
  5353. * Returns: 0 on success
  5354. */
  5355. int ipa3_set_aggr_mode(enum ipa_aggr_mode mode)
  5356. {
  5357. struct ipahal_reg_qcncm qcncm;
  5358. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
  5359. if (mode != IPA_MBIM_AGGR) {
  5360. IPAERR("Only MBIM mode is supported staring 4.0\n");
  5361. return -EPERM;
  5362. }
  5363. } else {
  5364. IPA_ACTIVE_CLIENTS_INC_SIMPLE();
  5365. ipahal_read_reg_fields(IPA_QCNCM, &qcncm);
  5366. qcncm.mode_en = mode;
  5367. ipahal_write_reg_fields(IPA_QCNCM, &qcncm);
  5368. IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
  5369. }
  5370. return 0;
  5371. }
  5372. /**
  5373. * ipa3_set_qcncm_ndp_sig() - Set the NDP signature used for QCNCM aggregation
  5374. * mode
  5375. * @sig: [in] the first 3 bytes of QCNCM NDP signature (expected to be
  5376. * "QND")
  5377. *
  5378. * Set the NDP signature used for QCNCM aggregation mode. The fourth byte
  5379. * (expected to be 'P') needs to be set using the header addition mechanism
  5380. *
  5381. * Returns: 0 on success, negative on failure
  5382. */
  5383. int ipa3_set_qcncm_ndp_sig(char sig[3])
  5384. {
  5385. struct ipahal_reg_qcncm qcncm;
  5386. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
  5387. IPAERR("QCNCM mode is not supported staring 4.0\n");
  5388. return -EPERM;
  5389. }
  5390. if (sig == NULL) {
  5391. IPAERR("bad argument\n");
  5392. return -EINVAL;
  5393. }
  5394. IPA_ACTIVE_CLIENTS_INC_SIMPLE();
  5395. ipahal_read_reg_fields(IPA_QCNCM, &qcncm);
  5396. qcncm.mode_val = ((sig[0] << 16) | (sig[1] << 8) | sig[2]);
  5397. ipahal_write_reg_fields(IPA_QCNCM, &qcncm);
  5398. IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
  5399. return 0;
  5400. }
  5401. /**
  5402. * ipa3_set_single_ndp_per_mbim() - Enable/disable single NDP per MBIM frame
  5403. * configuration
  5404. * @enable: [in] true for single NDP/MBIM; false otherwise
  5405. *
  5406. * Returns: 0 on success
  5407. */
  5408. int ipa3_set_single_ndp_per_mbim(bool enable)
  5409. {
  5410. struct ipahal_reg_single_ndp_mode mode;
  5411. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
  5412. IPAERR("QCNCM mode is not supported staring 4.0\n");
  5413. return -EPERM;
  5414. }
  5415. IPA_ACTIVE_CLIENTS_INC_SIMPLE();
  5416. ipahal_read_reg_fields(IPA_SINGLE_NDP_MODE, &mode);
  5417. mode.single_ndp_en = enable;
  5418. ipahal_write_reg_fields(IPA_SINGLE_NDP_MODE, &mode);
  5419. IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
  5420. return 0;
  5421. }
  5422. /**
  5423. * ipa3_straddle_boundary() - Checks whether a memory buffer straddles a
  5424. * boundary
  5425. * @start: start address of the memory buffer
  5426. * @end: end address of the memory buffer
  5427. * @boundary: boundary
  5428. *
  5429. * Return value:
  5430. * 1: if the interval [start, end] straddles boundary
  5431. * 0: otherwise
  5432. */
  5433. int ipa3_straddle_boundary(u32 start, u32 end, u32 boundary)
  5434. {
  5435. u32 next_start;
  5436. u32 prev_end;
  5437. IPADBG("start=%u end=%u boundary=%u\n", start, end, boundary);
  5438. next_start = (start + (boundary - 1)) & ~(boundary - 1);
  5439. prev_end = ((end + (boundary - 1)) & ~(boundary - 1)) - boundary;
  5440. while (next_start < prev_end)
  5441. next_start += boundary;
  5442. if (next_start == prev_end)
  5443. return 1;
  5444. else
  5445. return 0;
  5446. }
  5447. /**
  5448. * ipa3_init_mem_partition() - Assigns the static memory partition
  5449. * based on the IPA version
  5450. *
  5451. * Returns: 0 on success
  5452. */
  5453. int ipa3_init_mem_partition(enum ipa_hw_type type)
  5454. {
  5455. switch (type) {
  5456. case IPA_HW_v4_1:
  5457. ipa3_ctx->ctrl->mem_partition = &ipa_4_1_mem_part;
  5458. break;
  5459. case IPA_HW_v4_2:
  5460. ipa3_ctx->ctrl->mem_partition = &ipa_4_2_mem_part;
  5461. break;
  5462. case IPA_HW_v4_5:
  5463. ipa3_ctx->ctrl->mem_partition = &ipa_4_5_mem_part;
  5464. break;
  5465. case IPA_HW_v4_7:
  5466. ipa3_ctx->ctrl->mem_partition = &ipa_4_7_mem_part;
  5467. break;
  5468. case IPA_HW_v4_9:
  5469. ipa3_ctx->ctrl->mem_partition = &ipa_4_9_mem_part;
  5470. break;
  5471. case IPA_HW_None:
  5472. case IPA_HW_v1_0:
  5473. case IPA_HW_v1_1:
  5474. case IPA_HW_v2_0:
  5475. case IPA_HW_v2_1:
  5476. case IPA_HW_v2_5:
  5477. case IPA_HW_v2_6L:
  5478. case IPA_HW_v3_0:
  5479. case IPA_HW_v3_1:
  5480. case IPA_HW_v3_5:
  5481. case IPA_HW_v3_5_1:
  5482. case IPA_HW_v4_0:
  5483. IPAERR("unsupported version %d\n", type);
  5484. return -EPERM;
  5485. }
  5486. if (IPA_MEM_PART(uc_info_ofst) & 3) {
  5487. IPAERR("UC INFO OFST 0x%x is unaligned\n",
  5488. IPA_MEM_PART(uc_info_ofst));
  5489. return -ENODEV;
  5490. }
  5491. IPADBG("UC INFO OFST 0x%x SIZE 0x%x\n",
  5492. IPA_MEM_PART(uc_info_ofst), IPA_MEM_PART(uc_info_size));
  5493. IPADBG("RAM OFST 0x%x\n", IPA_MEM_PART(ofst_start));
  5494. if (IPA_MEM_PART(v4_flt_hash_ofst) & 7) {
  5495. IPAERR("V4 FLT HASHABLE OFST 0x%x is unaligned\n",
  5496. IPA_MEM_PART(v4_flt_hash_ofst));
  5497. return -ENODEV;
  5498. }
  5499. IPADBG("V4 FLT HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
  5500. IPA_MEM_PART(v4_flt_hash_ofst),
  5501. IPA_MEM_PART(v4_flt_hash_size),
  5502. IPA_MEM_PART(v4_flt_hash_size_ddr));
  5503. if (IPA_MEM_PART(v4_flt_nhash_ofst) & 7) {
  5504. IPAERR("V4 FLT NON-HASHABLE OFST 0x%x is unaligned\n",
  5505. IPA_MEM_PART(v4_flt_nhash_ofst));
  5506. return -ENODEV;
  5507. }
  5508. IPADBG("V4 FLT NON-HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
  5509. IPA_MEM_PART(v4_flt_nhash_ofst),
  5510. IPA_MEM_PART(v4_flt_nhash_size),
  5511. IPA_MEM_PART(v4_flt_nhash_size_ddr));
  5512. if (IPA_MEM_PART(v6_flt_hash_ofst) & 7) {
  5513. IPAERR("V6 FLT HASHABLE OFST 0x%x is unaligned\n",
  5514. IPA_MEM_PART(v6_flt_hash_ofst));
  5515. return -ENODEV;
  5516. }
  5517. IPADBG("V6 FLT HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
  5518. IPA_MEM_PART(v6_flt_hash_ofst), IPA_MEM_PART(v6_flt_hash_size),
  5519. IPA_MEM_PART(v6_flt_hash_size_ddr));
  5520. if (IPA_MEM_PART(v6_flt_nhash_ofst) & 7) {
  5521. IPAERR("V6 FLT NON-HASHABLE OFST 0x%x is unaligned\n",
  5522. IPA_MEM_PART(v6_flt_nhash_ofst));
  5523. return -ENODEV;
  5524. }
  5525. IPADBG("V6 FLT NON-HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
  5526. IPA_MEM_PART(v6_flt_nhash_ofst),
  5527. IPA_MEM_PART(v6_flt_nhash_size),
  5528. IPA_MEM_PART(v6_flt_nhash_size_ddr));
  5529. IPADBG("V4 RT NUM INDEX 0x%x\n", IPA_MEM_PART(v4_rt_num_index));
  5530. IPADBG("V4 RT MODEM INDEXES 0x%x - 0x%x\n",
  5531. IPA_MEM_PART(v4_modem_rt_index_lo),
  5532. IPA_MEM_PART(v4_modem_rt_index_hi));
  5533. IPADBG("V4 RT APPS INDEXES 0x%x - 0x%x\n",
  5534. IPA_MEM_PART(v4_apps_rt_index_lo),
  5535. IPA_MEM_PART(v4_apps_rt_index_hi));
  5536. if (IPA_MEM_PART(v4_rt_hash_ofst) & 7) {
  5537. IPAERR("V4 RT HASHABLE OFST 0x%x is unaligned\n",
  5538. IPA_MEM_PART(v4_rt_hash_ofst));
  5539. return -ENODEV;
  5540. }
  5541. IPADBG("V4 RT HASHABLE OFST 0x%x\n", IPA_MEM_PART(v4_rt_hash_ofst));
  5542. IPADBG("V4 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
  5543. IPA_MEM_PART(v4_rt_hash_size),
  5544. IPA_MEM_PART(v4_rt_hash_size_ddr));
  5545. if (IPA_MEM_PART(v4_rt_nhash_ofst) & 7) {
  5546. IPAERR("V4 RT NON-HASHABLE OFST 0x%x is unaligned\n",
  5547. IPA_MEM_PART(v4_rt_nhash_ofst));
  5548. return -ENODEV;
  5549. }
  5550. IPADBG("V4 RT NON-HASHABLE OFST 0x%x\n",
  5551. IPA_MEM_PART(v4_rt_nhash_ofst));
  5552. IPADBG("V4 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
  5553. IPA_MEM_PART(v4_rt_nhash_size),
  5554. IPA_MEM_PART(v4_rt_nhash_size_ddr));
  5555. IPADBG("V6 RT NUM INDEX 0x%x\n", IPA_MEM_PART(v6_rt_num_index));
  5556. IPADBG("V6 RT MODEM INDEXES 0x%x - 0x%x\n",
  5557. IPA_MEM_PART(v6_modem_rt_index_lo),
  5558. IPA_MEM_PART(v6_modem_rt_index_hi));
  5559. IPADBG("V6 RT APPS INDEXES 0x%x - 0x%x\n",
  5560. IPA_MEM_PART(v6_apps_rt_index_lo),
  5561. IPA_MEM_PART(v6_apps_rt_index_hi));
  5562. if (IPA_MEM_PART(v6_rt_hash_ofst) & 7) {
  5563. IPAERR("V6 RT HASHABLE OFST 0x%x is unaligned\n",
  5564. IPA_MEM_PART(v6_rt_hash_ofst));
  5565. return -ENODEV;
  5566. }
  5567. IPADBG("V6 RT HASHABLE OFST 0x%x\n", IPA_MEM_PART(v6_rt_hash_ofst));
  5568. IPADBG("V6 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
  5569. IPA_MEM_PART(v6_rt_hash_size),
  5570. IPA_MEM_PART(v6_rt_hash_size_ddr));
  5571. if (IPA_MEM_PART(v6_rt_nhash_ofst) & 7) {
  5572. IPAERR("V6 RT NON-HASHABLE OFST 0x%x is unaligned\n",
  5573. IPA_MEM_PART(v6_rt_nhash_ofst));
  5574. return -ENODEV;
  5575. }
  5576. IPADBG("V6 RT NON-HASHABLE OFST 0x%x\n",
  5577. IPA_MEM_PART(v6_rt_nhash_ofst));
  5578. IPADBG("V6 RT NON-HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
  5579. IPA_MEM_PART(v6_rt_nhash_size),
  5580. IPA_MEM_PART(v6_rt_nhash_size_ddr));
  5581. if (IPA_MEM_PART(modem_hdr_ofst) & 7) {
  5582. IPAERR("MODEM HDR OFST 0x%x is unaligned\n",
  5583. IPA_MEM_PART(modem_hdr_ofst));
  5584. return -ENODEV;
  5585. }
  5586. IPADBG("MODEM HDR OFST 0x%x SIZE 0x%x\n",
  5587. IPA_MEM_PART(modem_hdr_ofst), IPA_MEM_PART(modem_hdr_size));
  5588. if (IPA_MEM_PART(apps_hdr_ofst) & 7) {
  5589. IPAERR("APPS HDR OFST 0x%x is unaligned\n",
  5590. IPA_MEM_PART(apps_hdr_ofst));
  5591. return -ENODEV;
  5592. }
  5593. IPADBG("APPS HDR OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
  5594. IPA_MEM_PART(apps_hdr_ofst), IPA_MEM_PART(apps_hdr_size),
  5595. IPA_MEM_PART(apps_hdr_size_ddr));
  5596. if (IPA_MEM_PART(modem_hdr_proc_ctx_ofst) & 7) {
  5597. IPAERR("MODEM HDR PROC CTX OFST 0x%x is unaligned\n",
  5598. IPA_MEM_PART(modem_hdr_proc_ctx_ofst));
  5599. return -ENODEV;
  5600. }
  5601. IPADBG("MODEM HDR PROC CTX OFST 0x%x SIZE 0x%x\n",
  5602. IPA_MEM_PART(modem_hdr_proc_ctx_ofst),
  5603. IPA_MEM_PART(modem_hdr_proc_ctx_size));
  5604. if (IPA_MEM_PART(apps_hdr_proc_ctx_ofst) & 7) {
  5605. IPAERR("APPS HDR PROC CTX OFST 0x%x is unaligned\n",
  5606. IPA_MEM_PART(apps_hdr_proc_ctx_ofst));
  5607. return -ENODEV;
  5608. }
  5609. IPADBG("APPS HDR PROC CTX OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
  5610. IPA_MEM_PART(apps_hdr_proc_ctx_ofst),
  5611. IPA_MEM_PART(apps_hdr_proc_ctx_size),
  5612. IPA_MEM_PART(apps_hdr_proc_ctx_size_ddr));
  5613. if (IPA_MEM_PART(pdn_config_ofst) & 7) {
  5614. IPAERR("PDN CONFIG OFST 0x%x is unaligned\n",
  5615. IPA_MEM_PART(pdn_config_ofst));
  5616. return -ENODEV;
  5617. }
  5618. /*
  5619. * Routing rules points to hdr_proc_ctx in 32byte offsets from base.
  5620. * Base is modem hdr_proc_ctx first address.
  5621. * AP driver install APPS hdr_proc_ctx starting at the beginning of
  5622. * apps hdr_proc_ctx part.
  5623. * So first apps hdr_proc_ctx offset at some routing
  5624. * rule will be modem_hdr_proc_ctx_size >> 5 (32B).
  5625. */
  5626. if (IPA_MEM_PART(modem_hdr_proc_ctx_size) & 31) {
  5627. IPAERR("MODEM HDR PROC CTX SIZE 0x%x is not 32B aligned\n",
  5628. IPA_MEM_PART(modem_hdr_proc_ctx_size));
  5629. return -ENODEV;
  5630. }
  5631. /*
  5632. * AP driver when installing routing rule, it calcs the hdr_proc_ctx
  5633. * offset by local offset (from base of apps part) +
  5634. * modem_hdr_proc_ctx_size. This is to get offset from modem part base.
  5635. * Thus apps part must be adjacent to modem part
  5636. */
  5637. if (IPA_MEM_PART(apps_hdr_proc_ctx_ofst) !=
  5638. IPA_MEM_PART(modem_hdr_proc_ctx_ofst) +
  5639. IPA_MEM_PART(modem_hdr_proc_ctx_size)) {
  5640. IPAERR("APPS HDR PROC CTX SIZE not adjacent to MODEM one!\n");
  5641. return -ENODEV;
  5642. }
  5643. IPADBG("NAT TBL OFST 0x%x SIZE 0x%x\n",
  5644. IPA_MEM_PART(nat_tbl_ofst),
  5645. IPA_MEM_PART(nat_tbl_size));
  5646. if (IPA_MEM_PART(nat_tbl_ofst) & 31) {
  5647. IPAERR("NAT TBL OFST 0x%x is not aligned properly\n",
  5648. IPA_MEM_PART(nat_tbl_ofst));
  5649. return -ENODEV;
  5650. }
  5651. IPADBG("PDN CONFIG OFST 0x%x SIZE 0x%x\n",
  5652. IPA_MEM_PART(pdn_config_ofst),
  5653. IPA_MEM_PART(pdn_config_size));
  5654. if (IPA_MEM_PART(pdn_config_ofst) & 7) {
  5655. IPAERR("PDN CONFIG OFST 0x%x is unaligned\n",
  5656. IPA_MEM_PART(pdn_config_ofst));
  5657. return -ENODEV;
  5658. }
  5659. IPADBG("QUOTA STATS OFST 0x%x SIZE 0x%x\n",
  5660. IPA_MEM_PART(stats_quota_ofst),
  5661. IPA_MEM_PART(stats_quota_size));
  5662. if (IPA_MEM_PART(stats_quota_ofst) & 7) {
  5663. IPAERR("QUOTA STATS OFST 0x%x is unaligned\n",
  5664. IPA_MEM_PART(stats_quota_ofst));
  5665. return -ENODEV;
  5666. }
  5667. IPADBG("TETHERING STATS OFST 0x%x SIZE 0x%x\n",
  5668. IPA_MEM_PART(stats_tethering_ofst),
  5669. IPA_MEM_PART(stats_tethering_size));
  5670. if (IPA_MEM_PART(stats_tethering_ofst) & 7) {
  5671. IPAERR("TETHERING STATS OFST 0x%x is unaligned\n",
  5672. IPA_MEM_PART(stats_tethering_ofst));
  5673. return -ENODEV;
  5674. }
  5675. IPADBG("FILTER AND ROUTING STATS OFST 0x%x SIZE 0x%x\n",
  5676. IPA_MEM_PART(stats_fnr_ofst),
  5677. IPA_MEM_PART(stats_fnr_size));
  5678. if (IPA_MEM_PART(stats_fnr_ofst) & 7) {
  5679. IPAERR("FILTER AND ROUTING STATS OFST 0x%x is unaligned\n",
  5680. IPA_MEM_PART(stats_fnr_ofst));
  5681. return -ENODEV;
  5682. }
  5683. IPADBG("DROP STATS OFST 0x%x SIZE 0x%x\n",
  5684. IPA_MEM_PART(stats_drop_ofst),
  5685. IPA_MEM_PART(stats_drop_size));
  5686. if (IPA_MEM_PART(stats_drop_ofst) & 7) {
  5687. IPAERR("DROP STATS OFST 0x%x is unaligned\n",
  5688. IPA_MEM_PART(stats_drop_ofst));
  5689. return -ENODEV;
  5690. }
  5691. IPADBG("V4 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
  5692. IPA_MEM_PART(apps_v4_flt_hash_ofst),
  5693. IPA_MEM_PART(apps_v4_flt_hash_size));
  5694. IPADBG("V4 APPS NON-HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
  5695. IPA_MEM_PART(apps_v4_flt_nhash_ofst),
  5696. IPA_MEM_PART(apps_v4_flt_nhash_size));
  5697. IPADBG("V6 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
  5698. IPA_MEM_PART(apps_v6_flt_hash_ofst),
  5699. IPA_MEM_PART(apps_v6_flt_hash_size));
  5700. IPADBG("V6 APPS NON-HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
  5701. IPA_MEM_PART(apps_v6_flt_nhash_ofst),
  5702. IPA_MEM_PART(apps_v6_flt_nhash_size));
  5703. IPADBG("RAM END OFST 0x%x\n",
  5704. IPA_MEM_PART(end_ofst));
  5705. IPADBG("V4 APPS HASHABLE RT OFST 0x%x SIZE 0x%x\n",
  5706. IPA_MEM_PART(apps_v4_rt_hash_ofst),
  5707. IPA_MEM_PART(apps_v4_rt_hash_size));
  5708. IPADBG("V4 APPS NON-HASHABLE RT OFST 0x%x SIZE 0x%x\n",
  5709. IPA_MEM_PART(apps_v4_rt_nhash_ofst),
  5710. IPA_MEM_PART(apps_v4_rt_nhash_size));
  5711. IPADBG("V6 APPS HASHABLE RT OFST 0x%x SIZE 0x%x\n",
  5712. IPA_MEM_PART(apps_v6_rt_hash_ofst),
  5713. IPA_MEM_PART(apps_v6_rt_hash_size));
  5714. IPADBG("V6 APPS NON-HASHABLE RT OFST 0x%x SIZE 0x%x\n",
  5715. IPA_MEM_PART(apps_v6_rt_nhash_ofst),
  5716. IPA_MEM_PART(apps_v6_rt_nhash_size));
  5717. if (IPA_MEM_PART(modem_ofst) & 7) {
  5718. IPAERR("MODEM OFST 0x%x is unaligned\n",
  5719. IPA_MEM_PART(modem_ofst));
  5720. return -ENODEV;
  5721. }
  5722. IPADBG("MODEM OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(modem_ofst),
  5723. IPA_MEM_PART(modem_size));
  5724. if (IPA_MEM_PART(uc_descriptor_ram_ofst) & 1023) {
  5725. IPAERR("UC DESCRIPTOR RAM OFST 0x%x is unaligned\n",
  5726. IPA_MEM_PART(uc_descriptor_ram_ofst));
  5727. return -ENODEV;
  5728. }
  5729. IPADBG("UC DESCRIPTOR RAM OFST 0x%x SIZE 0x%x\n",
  5730. IPA_MEM_PART(uc_descriptor_ram_ofst),
  5731. IPA_MEM_PART(uc_descriptor_ram_size));
  5732. return 0;
  5733. }
  5734. /**
  5735. * ipa_ctrl_static_bind() - set the appropriate methods for
  5736. * IPA Driver based on the HW version
  5737. *
  5738. * @ctrl: data structure which holds the function pointers
  5739. * @hw_type: the HW type in use
  5740. *
  5741. * This function can avoid the runtime assignment by using C99 special
  5742. * struct initialization - hard decision... time.vs.mem
  5743. */
  5744. int ipa3_controller_static_bind(struct ipa3_controller *ctrl,
  5745. enum ipa_hw_type hw_type)
  5746. {
  5747. if (hw_type >= IPA_HW_v4_0) {
  5748. ctrl->ipa_clk_rate_turbo = IPA_V4_0_CLK_RATE_TURBO;
  5749. ctrl->ipa_clk_rate_nominal = IPA_V4_0_CLK_RATE_NOMINAL;
  5750. ctrl->ipa_clk_rate_svs = IPA_V4_0_CLK_RATE_SVS;
  5751. ctrl->ipa_clk_rate_svs2 = IPA_V4_0_CLK_RATE_SVS2;
  5752. } else if (hw_type >= IPA_HW_v3_5) {
  5753. ctrl->ipa_clk_rate_turbo = IPA_V3_5_CLK_RATE_TURBO;
  5754. ctrl->ipa_clk_rate_nominal = IPA_V3_5_CLK_RATE_NOMINAL;
  5755. ctrl->ipa_clk_rate_svs = IPA_V3_5_CLK_RATE_SVS;
  5756. ctrl->ipa_clk_rate_svs2 = IPA_V3_5_CLK_RATE_SVS2;
  5757. } else {
  5758. ctrl->ipa_clk_rate_turbo = IPA_V3_0_CLK_RATE_TURBO;
  5759. ctrl->ipa_clk_rate_nominal = IPA_V3_0_CLK_RATE_NOMINAL;
  5760. ctrl->ipa_clk_rate_svs = IPA_V3_0_CLK_RATE_SVS;
  5761. ctrl->ipa_clk_rate_svs2 = IPA_V3_0_CLK_RATE_SVS2;
  5762. }
  5763. ctrl->ipa_init_rt4 = _ipa_init_rt4_v3;
  5764. ctrl->ipa_init_rt6 = _ipa_init_rt6_v3;
  5765. ctrl->ipa_init_flt4 = _ipa_init_flt4_v3;
  5766. ctrl->ipa_init_flt6 = _ipa_init_flt6_v3;
  5767. ctrl->ipa3_read_ep_reg = _ipa_read_ep_reg_v3_0;
  5768. ctrl->ipa3_commit_flt = __ipa_commit_flt_v3;
  5769. ctrl->ipa3_commit_rt = __ipa_commit_rt_v3;
  5770. ctrl->ipa3_commit_hdr = __ipa_commit_hdr_v3_0;
  5771. ctrl->ipa3_enable_clks = _ipa_enable_clks_v3_0;
  5772. ctrl->ipa3_disable_clks = _ipa_disable_clks_v3_0;
  5773. ctrl->clock_scaling_bw_threshold_svs =
  5774. IPA_V3_0_BW_THRESHOLD_SVS_MBPS;
  5775. ctrl->clock_scaling_bw_threshold_nominal =
  5776. IPA_V3_0_BW_THRESHOLD_NOMINAL_MBPS;
  5777. ctrl->clock_scaling_bw_threshold_turbo =
  5778. IPA_V3_0_BW_THRESHOLD_TURBO_MBPS;
  5779. ctrl->ipa_reg_base_ofst = ipahal_get_reg_base();
  5780. ctrl->ipa_init_sram = _ipa_init_sram_v3;
  5781. ctrl->ipa_sram_read_settings = _ipa_sram_settings_read_v3_0;
  5782. ctrl->ipa_init_hdr = _ipa_init_hdr_v3_0;
  5783. ctrl->max_holb_tmr_val = IPA_MAX_HOLB_TMR_VAL;
  5784. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
  5785. ctrl->ipa3_read_ep_reg = _ipa_read_ep_reg_v4_0;
  5786. return 0;
  5787. }
  5788. void ipa3_skb_recycle(struct sk_buff *skb)
  5789. {
  5790. struct skb_shared_info *shinfo;
  5791. shinfo = skb_shinfo(skb);
  5792. memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
  5793. atomic_set(&shinfo->dataref, 1);
  5794. memset(skb, 0, offsetof(struct sk_buff, tail));
  5795. skb->data = skb->head + NET_SKB_PAD;
  5796. skb_reset_tail_pointer(skb);
  5797. }
  5798. int ipa3_alloc_rule_id(struct idr *rule_ids)
  5799. {
  5800. /* There is two groups of rule-Ids, Modem ones and Apps ones.
  5801. * Distinction by high bit: Modem Ids are high bit asserted.
  5802. */
  5803. return idr_alloc(rule_ids, NULL,
  5804. ipahal_get_low_rule_id(),
  5805. ipahal_get_rule_id_hi_bit(),
  5806. GFP_KERNEL);
  5807. }
  5808. static int __ipa3_alloc_counter_hdl
  5809. (struct ipa_ioc_flt_rt_counter_alloc *counter)
  5810. {
  5811. int id;
  5812. /* assign a handle using idr to this counter block */
  5813. id = idr_alloc(&ipa3_ctx->flt_rt_counters.hdl, counter,
  5814. ipahal_get_low_hdl_id(), ipahal_get_high_hdl_id(),
  5815. GFP_ATOMIC);
  5816. return id;
  5817. }
  5818. int ipa3_alloc_counter_id(struct ipa_ioc_flt_rt_counter_alloc *counter)
  5819. {
  5820. int i, unused_cnt, unused_max, unused_start_id;
  5821. idr_preload(GFP_KERNEL);
  5822. spin_lock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  5823. /* allocate hw counters */
  5824. counter->hw_counter.start_id = 0;
  5825. counter->hw_counter.end_id = 0;
  5826. unused_cnt = 0;
  5827. unused_max = 0;
  5828. unused_start_id = 0;
  5829. if (counter->hw_counter.num_counters == 0)
  5830. goto sw_counter_alloc;
  5831. /* find the start id which can be used for the block */
  5832. for (i = 0; i < IPA_FLT_RT_HW_COUNTER; i++) {
  5833. if (!ipa3_ctx->flt_rt_counters.used_hw[i])
  5834. unused_cnt++;
  5835. else {
  5836. /* tracking max unused block in case allow less */
  5837. if (unused_cnt > unused_max) {
  5838. unused_start_id = i - unused_cnt + 2;
  5839. unused_max = unused_cnt;
  5840. }
  5841. unused_cnt = 0;
  5842. }
  5843. /* find it, break and use this 1st possible block */
  5844. if (unused_cnt == counter->hw_counter.num_counters) {
  5845. counter->hw_counter.start_id = i - unused_cnt + 2;
  5846. counter->hw_counter.end_id = i + 1;
  5847. break;
  5848. }
  5849. }
  5850. if (counter->hw_counter.start_id == 0) {
  5851. /* if not able to find such a block but allow less */
  5852. if (counter->hw_counter.allow_less && unused_max) {
  5853. /* give the max possible unused blocks */
  5854. counter->hw_counter.num_counters = unused_max;
  5855. counter->hw_counter.start_id = unused_start_id;
  5856. counter->hw_counter.end_id =
  5857. unused_start_id + unused_max - 1;
  5858. } else {
  5859. /* not able to find such a block */
  5860. counter->hw_counter.num_counters = 0;
  5861. counter->hw_counter.start_id = 0;
  5862. counter->hw_counter.end_id = 0;
  5863. goto err;
  5864. }
  5865. }
  5866. sw_counter_alloc:
  5867. /* allocate sw counters */
  5868. counter->sw_counter.start_id = 0;
  5869. counter->sw_counter.end_id = 0;
  5870. unused_cnt = 0;
  5871. unused_max = 0;
  5872. unused_start_id = 0;
  5873. if (counter->sw_counter.num_counters == 0)
  5874. goto mark_hw_cnt;
  5875. /* find the start id which can be used for the block */
  5876. for (i = 0; i < IPA_FLT_RT_SW_COUNTER; i++) {
  5877. if (!ipa3_ctx->flt_rt_counters.used_sw[i])
  5878. unused_cnt++;
  5879. else {
  5880. /* tracking max unused block in case allow less */
  5881. if (unused_cnt > unused_max) {
  5882. unused_start_id = i - unused_cnt +
  5883. 2 + IPA_FLT_RT_HW_COUNTER;
  5884. unused_max = unused_cnt;
  5885. }
  5886. unused_cnt = 0;
  5887. }
  5888. /* find it, break and use this 1st possible block */
  5889. if (unused_cnt == counter->sw_counter.num_counters) {
  5890. counter->sw_counter.start_id = i - unused_cnt +
  5891. 2 + IPA_FLT_RT_HW_COUNTER;
  5892. counter->sw_counter.end_id =
  5893. i + 1 + IPA_FLT_RT_HW_COUNTER;
  5894. break;
  5895. }
  5896. }
  5897. if (counter->sw_counter.start_id == 0) {
  5898. /* if not able to find such a block but allow less */
  5899. if (counter->sw_counter.allow_less && unused_max) {
  5900. /* give the max possible unused blocks */
  5901. counter->sw_counter.num_counters = unused_max;
  5902. counter->sw_counter.start_id = unused_start_id;
  5903. counter->sw_counter.end_id =
  5904. unused_start_id + unused_max - 1;
  5905. } else {
  5906. /* not able to find such a block */
  5907. counter->sw_counter.num_counters = 0;
  5908. counter->sw_counter.start_id = 0;
  5909. counter->sw_counter.end_id = 0;
  5910. goto err;
  5911. }
  5912. }
  5913. mark_hw_cnt:
  5914. /* add hw counters, set used to 1 */
  5915. if (counter->hw_counter.num_counters == 0)
  5916. goto mark_sw_cnt;
  5917. unused_start_id = counter->hw_counter.start_id;
  5918. if (unused_start_id < 1 ||
  5919. unused_start_id > IPA_FLT_RT_HW_COUNTER) {
  5920. IPAERR("unexpected hw_counter start id %d\n",
  5921. unused_start_id);
  5922. goto err;
  5923. }
  5924. for (i = 0; i < counter->hw_counter.num_counters; i++)
  5925. ipa3_ctx->flt_rt_counters.used_hw[unused_start_id + i - 1]
  5926. = true;
  5927. mark_sw_cnt:
  5928. /* add sw counters, set used to 1 */
  5929. if (counter->sw_counter.num_counters == 0)
  5930. goto done;
  5931. unused_start_id = counter->sw_counter.start_id
  5932. - IPA_FLT_RT_HW_COUNTER;
  5933. if (unused_start_id < 1 ||
  5934. unused_start_id > IPA_FLT_RT_SW_COUNTER) {
  5935. IPAERR("unexpected sw_counter start id %d\n",
  5936. unused_start_id);
  5937. goto err;
  5938. }
  5939. for (i = 0; i < counter->sw_counter.num_counters; i++)
  5940. ipa3_ctx->flt_rt_counters.used_sw[unused_start_id + i - 1]
  5941. = true;
  5942. done:
  5943. /* get a handle from idr for dealloc */
  5944. counter->hdl = __ipa3_alloc_counter_hdl(counter);
  5945. spin_unlock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  5946. idr_preload_end();
  5947. return 0;
  5948. err:
  5949. counter->hdl = -1;
  5950. spin_unlock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  5951. idr_preload_end();
  5952. return -ENOMEM;
  5953. }
  5954. void ipa3_counter_remove_hdl(int hdl)
  5955. {
  5956. struct ipa_ioc_flt_rt_counter_alloc *counter;
  5957. int offset = 0;
  5958. spin_lock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  5959. counter = idr_find(&ipa3_ctx->flt_rt_counters.hdl, hdl);
  5960. if (counter == NULL) {
  5961. IPAERR("unexpected hdl %d\n", hdl);
  5962. goto err;
  5963. }
  5964. /* remove counters belong to this hdl, set used back to 0 */
  5965. offset = counter->hw_counter.start_id - 1;
  5966. if (offset >= 0 && offset + counter->hw_counter.num_counters
  5967. < IPA_FLT_RT_HW_COUNTER) {
  5968. memset(&ipa3_ctx->flt_rt_counters.used_hw + offset,
  5969. 0, counter->hw_counter.num_counters * sizeof(bool));
  5970. } else {
  5971. IPAERR("unexpected hdl %d\n", hdl);
  5972. goto err;
  5973. }
  5974. offset = counter->sw_counter.start_id - 1 - IPA_FLT_RT_HW_COUNTER;
  5975. if (offset >= 0 && offset + counter->sw_counter.num_counters
  5976. < IPA_FLT_RT_SW_COUNTER) {
  5977. memset(&ipa3_ctx->flt_rt_counters.used_sw + offset,
  5978. 0, counter->sw_counter.num_counters * sizeof(bool));
  5979. } else {
  5980. IPAERR("unexpected hdl %d\n", hdl);
  5981. goto err;
  5982. }
  5983. /* remove the handle */
  5984. idr_remove(&ipa3_ctx->flt_rt_counters.hdl, hdl);
  5985. err:
  5986. spin_unlock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  5987. }
  5988. void ipa3_counter_id_remove_all(void)
  5989. {
  5990. struct ipa_ioc_flt_rt_counter_alloc *counter;
  5991. int hdl;
  5992. spin_lock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  5993. /* remove all counters, set used back to 0 */
  5994. memset(&ipa3_ctx->flt_rt_counters.used_hw, 0,
  5995. sizeof(ipa3_ctx->flt_rt_counters.used_hw));
  5996. memset(&ipa3_ctx->flt_rt_counters.used_sw, 0,
  5997. sizeof(ipa3_ctx->flt_rt_counters.used_sw));
  5998. /* remove all handles */
  5999. idr_for_each_entry(&ipa3_ctx->flt_rt_counters.hdl, counter, hdl)
  6000. idr_remove(&ipa3_ctx->flt_rt_counters.hdl, hdl);
  6001. spin_unlock(&ipa3_ctx->flt_rt_counters.hdl_lock);
  6002. }
  6003. int ipa3_id_alloc(void *ptr)
  6004. {
  6005. int id;
  6006. idr_preload(GFP_KERNEL);
  6007. spin_lock(&ipa3_ctx->idr_lock);
  6008. id = idr_alloc(&ipa3_ctx->ipa_idr, ptr, 0, 0, GFP_NOWAIT);
  6009. spin_unlock(&ipa3_ctx->idr_lock);
  6010. idr_preload_end();
  6011. return id;
  6012. }
  6013. void *ipa3_id_find(u32 id)
  6014. {
  6015. void *ptr;
  6016. spin_lock(&ipa3_ctx->idr_lock);
  6017. ptr = idr_find(&ipa3_ctx->ipa_idr, id);
  6018. spin_unlock(&ipa3_ctx->idr_lock);
  6019. return ptr;
  6020. }
  6021. bool ipa3_check_idr_if_freed(void *ptr)
  6022. {
  6023. int id;
  6024. void *iter_ptr;
  6025. spin_lock(&ipa3_ctx->idr_lock);
  6026. idr_for_each_entry(&ipa3_ctx->ipa_idr, iter_ptr, id) {
  6027. if ((uintptr_t)ptr == (uintptr_t)iter_ptr) {
  6028. spin_unlock(&ipa3_ctx->idr_lock);
  6029. return false;
  6030. }
  6031. }
  6032. spin_unlock(&ipa3_ctx->idr_lock);
  6033. return true;
  6034. }
  6035. void ipa3_id_remove(u32 id)
  6036. {
  6037. spin_lock(&ipa3_ctx->idr_lock);
  6038. idr_remove(&ipa3_ctx->ipa_idr, id);
  6039. spin_unlock(&ipa3_ctx->idr_lock);
  6040. }
  6041. void ipa3_tag_destroy_imm(void *user1, int user2)
  6042. {
  6043. ipahal_destroy_imm_cmd(user1);
  6044. }
  6045. static void ipa3_tag_free_skb(void *user1, int user2)
  6046. {
  6047. dev_kfree_skb_any((struct sk_buff *)user1);
  6048. }
  6049. #define REQUIRED_TAG_PROCESS_DESCRIPTORS 4
  6050. #define MAX_RETRY_ALLOC 10
  6051. #define ALLOC_MIN_SLEEP_RX 100000
  6052. #define ALLOC_MAX_SLEEP_RX 200000
  6053. /* ipa3_tag_process() - Initiates a tag process. Incorporates the input
  6054. * descriptors
  6055. *
  6056. * @desc: descriptors with commands for IC
  6057. * @desc_size: amount of descriptors in the above variable
  6058. *
  6059. * Note: The descriptors are copied (if there's room), the client needs to
  6060. * free his descriptors afterwards
  6061. *
  6062. * Return: 0 or negative in case of failure
  6063. */
  6064. int ipa3_tag_process(struct ipa3_desc desc[],
  6065. int descs_num,
  6066. unsigned long timeout)
  6067. {
  6068. struct ipa3_sys_context *sys;
  6069. struct ipa3_desc *tag_desc;
  6070. int desc_idx = 0;
  6071. struct ipahal_imm_cmd_ip_packet_init pktinit_cmd;
  6072. struct ipahal_imm_cmd_pyld *cmd_pyld = NULL;
  6073. struct ipahal_imm_cmd_ip_packet_tag_status status;
  6074. int i;
  6075. struct sk_buff *dummy_skb;
  6076. int res = 0;
  6077. struct ipa3_tag_completion *comp;
  6078. int ep_idx;
  6079. u32 retry_cnt = 0;
  6080. struct ipahal_reg_valmask valmask;
  6081. struct ipahal_imm_cmd_register_write reg_write_coal_close;
  6082. /* Not enough room for the required descriptors for the tag process */
  6083. if (IPA_TAG_MAX_DESC - descs_num < REQUIRED_TAG_PROCESS_DESCRIPTORS) {
  6084. IPAERR("up to %d descriptors are allowed (received %d)\n",
  6085. IPA_TAG_MAX_DESC - REQUIRED_TAG_PROCESS_DESCRIPTORS,
  6086. descs_num);
  6087. return -ENOMEM;
  6088. }
  6089. ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_CMD_PROD);
  6090. if (-1 == ep_idx) {
  6091. IPAERR("Client %u is not mapped\n",
  6092. IPA_CLIENT_APPS_CMD_PROD);
  6093. return -EFAULT;
  6094. }
  6095. sys = ipa3_ctx->ep[ep_idx].sys;
  6096. tag_desc = kzalloc(sizeof(*tag_desc) * IPA_TAG_MAX_DESC, GFP_KERNEL);
  6097. if (!tag_desc) {
  6098. IPAERR("failed to allocate memory\n");
  6099. return -ENOMEM;
  6100. }
  6101. /* Copy the required descriptors from the client now */
  6102. if (desc) {
  6103. memcpy(&(tag_desc[0]), desc, descs_num *
  6104. sizeof(tag_desc[0]));
  6105. desc_idx += descs_num;
  6106. } else {
  6107. res = -EFAULT;
  6108. IPAERR("desc is NULL\n");
  6109. goto fail_free_tag_desc;
  6110. }
  6111. /* IC to close the coal frame before HPS Clear if coal is enabled */
  6112. if (ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS) != -1) {
  6113. ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS);
  6114. reg_write_coal_close.skip_pipeline_clear = false;
  6115. reg_write_coal_close.pipeline_clear_options = IPAHAL_HPS_CLEAR;
  6116. reg_write_coal_close.offset = ipahal_get_reg_ofst(
  6117. IPA_AGGR_FORCE_CLOSE);
  6118. ipahal_get_aggr_force_close_valmask(ep_idx, &valmask);
  6119. reg_write_coal_close.value = valmask.val;
  6120. reg_write_coal_close.value_mask = valmask.mask;
  6121. cmd_pyld = ipahal_construct_imm_cmd(
  6122. IPA_IMM_CMD_REGISTER_WRITE,
  6123. &reg_write_coal_close, false);
  6124. if (!cmd_pyld) {
  6125. IPAERR("failed to construct coal close IC\n");
  6126. res = -ENOMEM;
  6127. goto fail_free_tag_desc;
  6128. }
  6129. ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
  6130. desc[desc_idx].callback = ipa3_tag_destroy_imm;
  6131. desc[desc_idx].user1 = cmd_pyld;
  6132. ++desc_idx;
  6133. }
  6134. /* NO-OP IC for ensuring that IPA pipeline is empty */
  6135. cmd_pyld = ipahal_construct_nop_imm_cmd(
  6136. false, IPAHAL_FULL_PIPELINE_CLEAR, false);
  6137. if (!cmd_pyld) {
  6138. IPAERR("failed to construct NOP imm cmd\n");
  6139. res = -ENOMEM;
  6140. goto fail_free_desc;
  6141. }
  6142. ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
  6143. tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
  6144. tag_desc[desc_idx].user1 = cmd_pyld;
  6145. ++desc_idx;
  6146. /* IP_PACKET_INIT IC for tag status to be sent to apps */
  6147. pktinit_cmd.destination_pipe_index =
  6148. ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
  6149. cmd_pyld = ipahal_construct_imm_cmd(
  6150. IPA_IMM_CMD_IP_PACKET_INIT, &pktinit_cmd, false);
  6151. if (!cmd_pyld) {
  6152. IPAERR("failed to construct ip_packet_init imm cmd\n");
  6153. res = -ENOMEM;
  6154. goto fail_free_desc;
  6155. }
  6156. ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
  6157. tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
  6158. tag_desc[desc_idx].user1 = cmd_pyld;
  6159. ++desc_idx;
  6160. /* status IC */
  6161. status.tag = IPA_COOKIE;
  6162. cmd_pyld = ipahal_construct_imm_cmd(
  6163. IPA_IMM_CMD_IP_PACKET_TAG_STATUS, &status, false);
  6164. if (!cmd_pyld) {
  6165. IPAERR("failed to construct ip_packet_tag_status imm cmd\n");
  6166. res = -ENOMEM;
  6167. goto fail_free_desc;
  6168. }
  6169. ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
  6170. tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
  6171. tag_desc[desc_idx].user1 = cmd_pyld;
  6172. ++desc_idx;
  6173. comp = kzalloc(sizeof(*comp), GFP_KERNEL);
  6174. if (!comp) {
  6175. IPAERR("no mem\n");
  6176. res = -ENOMEM;
  6177. goto fail_free_desc;
  6178. }
  6179. init_completion(&comp->comp);
  6180. /* completion needs to be released from both here and rx handler */
  6181. atomic_set(&comp->cnt, 2);
  6182. /* dummy packet to send to IPA. packet payload is a completion object */
  6183. dummy_skb = alloc_skb(sizeof(comp), GFP_KERNEL);
  6184. if (!dummy_skb) {
  6185. IPAERR("failed to allocate memory\n");
  6186. res = -ENOMEM;
  6187. goto fail_free_comp;
  6188. }
  6189. memcpy(skb_put(dummy_skb, sizeof(comp)), &comp, sizeof(comp));
  6190. if (desc_idx >= IPA_TAG_MAX_DESC) {
  6191. IPAERR("number of commands is out of range\n");
  6192. res = -ENOBUFS;
  6193. goto fail_free_skb;
  6194. }
  6195. tag_desc[desc_idx].pyld = dummy_skb->data;
  6196. tag_desc[desc_idx].len = dummy_skb->len;
  6197. tag_desc[desc_idx].type = IPA_DATA_DESC_SKB;
  6198. tag_desc[desc_idx].callback = ipa3_tag_free_skb;
  6199. tag_desc[desc_idx].user1 = dummy_skb;
  6200. desc_idx++;
  6201. retry_alloc:
  6202. /* send all descriptors to IPA with single EOT */
  6203. res = ipa3_send(sys, desc_idx, tag_desc, true);
  6204. if (res) {
  6205. if (res == -ENOMEM) {
  6206. if (retry_cnt < MAX_RETRY_ALLOC) {
  6207. IPADBG(
  6208. "failed to alloc memory retry cnt = %d\n",
  6209. retry_cnt);
  6210. retry_cnt++;
  6211. usleep_range(ALLOC_MIN_SLEEP_RX,
  6212. ALLOC_MAX_SLEEP_RX);
  6213. goto retry_alloc;
  6214. }
  6215. }
  6216. IPAERR("failed to send TAG packets %d\n", res);
  6217. res = -ENOMEM;
  6218. goto fail_free_skb;
  6219. }
  6220. kfree(tag_desc);
  6221. tag_desc = NULL;
  6222. ipa3_ctx->tag_process_before_gating = false;
  6223. IPADBG("waiting for TAG response\n");
  6224. res = wait_for_completion_timeout(&comp->comp, timeout);
  6225. if (res == 0) {
  6226. IPAERR("timeout (%lu msec) on waiting for TAG response\n",
  6227. timeout);
  6228. WARN_ON(1);
  6229. if (atomic_dec_return(&comp->cnt) == 0)
  6230. kfree(comp);
  6231. return -ETIME;
  6232. }
  6233. IPADBG("TAG response arrived!\n");
  6234. if (atomic_dec_return(&comp->cnt) == 0)
  6235. kfree(comp);
  6236. /*
  6237. * sleep for short period to ensure IPA wrote all packets to
  6238. * the transport
  6239. */
  6240. usleep_range(IPA_TAG_SLEEP_MIN_USEC, IPA_TAG_SLEEP_MAX_USEC);
  6241. return 0;
  6242. fail_free_skb:
  6243. kfree_skb(dummy_skb);
  6244. fail_free_comp:
  6245. kfree(comp);
  6246. fail_free_desc:
  6247. /*
  6248. * Free only the first descriptors allocated here.
  6249. * [nop, pkt_init, status, dummy_skb]
  6250. * The user is responsible to free his allocations
  6251. * in case of failure.
  6252. * The min is required because we may fail during
  6253. * of the initial allocations above
  6254. */
  6255. for (i = descs_num;
  6256. i < min(REQUIRED_TAG_PROCESS_DESCRIPTORS, desc_idx); i++)
  6257. if (tag_desc[i].callback)
  6258. tag_desc[i].callback(tag_desc[i].user1,
  6259. tag_desc[i].user2);
  6260. fail_free_tag_desc:
  6261. kfree(tag_desc);
  6262. return res;
  6263. }
  6264. /**
  6265. * ipa3_tag_generate_force_close_desc() - generate descriptors for force close
  6266. * immediate command
  6267. *
  6268. * @desc: descriptors for IC
  6269. * @desc_size: desc array size
  6270. * @start_pipe: first pipe to close aggregation
  6271. * @end_pipe: last (non-inclusive) pipe to close aggregation
  6272. *
  6273. * Return: number of descriptors written or negative in case of failure
  6274. */
  6275. static int ipa3_tag_generate_force_close_desc(struct ipa3_desc desc[],
  6276. int desc_size, int start_pipe, int end_pipe)
  6277. {
  6278. int i;
  6279. struct ipa_ep_cfg_aggr ep_aggr;
  6280. int desc_idx = 0;
  6281. int res;
  6282. struct ipahal_imm_cmd_register_write reg_write_agg_close;
  6283. struct ipahal_imm_cmd_pyld *cmd_pyld;
  6284. struct ipahal_reg_valmask valmask;
  6285. for (i = start_pipe; i < end_pipe; i++) {
  6286. ipahal_read_reg_n_fields(IPA_ENDP_INIT_AGGR_n, i, &ep_aggr);
  6287. if (!ep_aggr.aggr_en)
  6288. continue;
  6289. IPADBG("Force close ep: %d\n", i);
  6290. if (desc_idx + 1 > desc_size) {
  6291. IPAERR("Internal error - no descriptors\n");
  6292. res = -EFAULT;
  6293. goto fail_no_desc;
  6294. }
  6295. reg_write_agg_close.skip_pipeline_clear = false;
  6296. reg_write_agg_close.pipeline_clear_options =
  6297. IPAHAL_FULL_PIPELINE_CLEAR;
  6298. reg_write_agg_close.offset =
  6299. ipahal_get_reg_ofst(IPA_AGGR_FORCE_CLOSE);
  6300. ipahal_get_aggr_force_close_valmask(i, &valmask);
  6301. reg_write_agg_close.value = valmask.val;
  6302. reg_write_agg_close.value_mask = valmask.mask;
  6303. cmd_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_REGISTER_WRITE,
  6304. &reg_write_agg_close, false);
  6305. if (!cmd_pyld) {
  6306. IPAERR("failed to construct register_write imm cmd\n");
  6307. res = -ENOMEM;
  6308. goto fail_alloc_reg_write_agg_close;
  6309. }
  6310. ipa3_init_imm_cmd_desc(&desc[desc_idx], cmd_pyld);
  6311. desc[desc_idx].callback = ipa3_tag_destroy_imm;
  6312. desc[desc_idx].user1 = cmd_pyld;
  6313. ++desc_idx;
  6314. }
  6315. return desc_idx;
  6316. fail_alloc_reg_write_agg_close:
  6317. for (i = 0; i < desc_idx; ++i)
  6318. if (desc[desc_idx].callback)
  6319. desc[desc_idx].callback(desc[desc_idx].user1,
  6320. desc[desc_idx].user2);
  6321. fail_no_desc:
  6322. return res;
  6323. }
  6324. /**
  6325. * ipa3_tag_aggr_force_close() - Force close aggregation
  6326. *
  6327. * @pipe_num: pipe number or -1 for all pipes
  6328. */
  6329. int ipa3_tag_aggr_force_close(int pipe_num)
  6330. {
  6331. struct ipa3_desc *desc;
  6332. int res = -1;
  6333. int start_pipe;
  6334. int end_pipe;
  6335. int num_descs;
  6336. int num_aggr_descs;
  6337. if (pipe_num < -1 || pipe_num >= (int)ipa3_ctx->ipa_num_pipes) {
  6338. IPAERR("Invalid pipe number %d\n", pipe_num);
  6339. return -EINVAL;
  6340. }
  6341. if (pipe_num == -1) {
  6342. start_pipe = 0;
  6343. end_pipe = ipa3_ctx->ipa_num_pipes;
  6344. } else {
  6345. start_pipe = pipe_num;
  6346. end_pipe = pipe_num + 1;
  6347. }
  6348. num_descs = end_pipe - start_pipe;
  6349. desc = kcalloc(num_descs, sizeof(*desc), GFP_KERNEL);
  6350. if (!desc) {
  6351. IPAERR("no mem\n");
  6352. return -ENOMEM;
  6353. }
  6354. /* Force close aggregation on all valid pipes with aggregation */
  6355. num_aggr_descs = ipa3_tag_generate_force_close_desc(desc, num_descs,
  6356. start_pipe, end_pipe);
  6357. if (num_aggr_descs < 0) {
  6358. IPAERR("ipa3_tag_generate_force_close_desc failed %d\n",
  6359. num_aggr_descs);
  6360. goto fail_free_desc;
  6361. }
  6362. res = ipa3_tag_process(desc, num_aggr_descs,
  6363. IPA_FORCE_CLOSE_TAG_PROCESS_TIMEOUT);
  6364. fail_free_desc:
  6365. kfree(desc);
  6366. return res;
  6367. }
  6368. /**
  6369. * ipa3_is_ready() - check if IPA module was initialized
  6370. * successfully
  6371. *
  6372. * Return value: true for yes; false for no
  6373. */
  6374. bool ipa3_is_ready(void)
  6375. {
  6376. bool complete;
  6377. if (ipa3_ctx == NULL)
  6378. return false;
  6379. mutex_lock(&ipa3_ctx->lock);
  6380. complete = ipa3_ctx->ipa_initialization_complete;
  6381. mutex_unlock(&ipa3_ctx->lock);
  6382. return complete;
  6383. }
  6384. /**
  6385. * ipa3_is_client_handle_valid() - check if IPA client handle is valid handle
  6386. *
  6387. * Return value: true for yes; false for no
  6388. */
  6389. bool ipa3_is_client_handle_valid(u32 clnt_hdl)
  6390. {
  6391. if (clnt_hdl >= 0 && clnt_hdl < ipa3_ctx->ipa_num_pipes)
  6392. return true;
  6393. return false;
  6394. }
  6395. /**
  6396. * ipa3_proxy_clk_unvote() - called to remove IPA clock proxy vote
  6397. *
  6398. * Return value: none
  6399. */
  6400. void ipa3_proxy_clk_unvote(void)
  6401. {
  6402. if (ipa3_ctx == NULL)
  6403. return;
  6404. mutex_lock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
  6405. if (ipa3_ctx->q6_proxy_clk_vote_valid) {
  6406. IPA_ACTIVE_CLIENTS_DEC_SPECIAL("PROXY_CLK_VOTE");
  6407. ipa3_ctx->q6_proxy_clk_vote_cnt--;
  6408. if (ipa3_ctx->q6_proxy_clk_vote_cnt == 0)
  6409. ipa3_ctx->q6_proxy_clk_vote_valid = false;
  6410. }
  6411. mutex_unlock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
  6412. }
  6413. /**
  6414. * ipa3_proxy_clk_vote() - called to add IPA clock proxy vote
  6415. *
  6416. * Return value: none
  6417. */
  6418. void ipa3_proxy_clk_vote(void)
  6419. {
  6420. if (ipa3_ctx == NULL)
  6421. return;
  6422. mutex_lock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
  6423. if (!ipa3_ctx->q6_proxy_clk_vote_valid ||
  6424. (ipa3_ctx->q6_proxy_clk_vote_cnt > 0)) {
  6425. IPA_ACTIVE_CLIENTS_INC_SPECIAL("PROXY_CLK_VOTE");
  6426. ipa3_ctx->q6_proxy_clk_vote_cnt++;
  6427. ipa3_ctx->q6_proxy_clk_vote_valid = true;
  6428. }
  6429. mutex_unlock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
  6430. }
  6431. /**
  6432. * ipa3_get_smem_restr_bytes()- Return IPA smem restricted bytes
  6433. *
  6434. * Return value: u16 - number of IPA smem restricted bytes
  6435. */
  6436. u16 ipa3_get_smem_restr_bytes(void)
  6437. {
  6438. if (ipa3_ctx)
  6439. return ipa3_ctx->smem_restricted_bytes;
  6440. IPAERR("IPA Driver not initialized\n");
  6441. return 0;
  6442. }
  6443. /**
  6444. * ipa3_get_modem_cfg_emb_pipe_flt()- Return ipa3_ctx->modem_cfg_emb_pipe_flt
  6445. *
  6446. * Return value: true if modem configures embedded pipe flt, false otherwise
  6447. */
  6448. bool ipa3_get_modem_cfg_emb_pipe_flt(void)
  6449. {
  6450. if (ipa3_ctx)
  6451. return ipa3_ctx->modem_cfg_emb_pipe_flt;
  6452. IPAERR("IPA driver has not been initialized\n");
  6453. return false;
  6454. }
  6455. /**
  6456. * ipa3_get_transport_type()
  6457. *
  6458. * Return value: enum ipa_transport_type
  6459. */
  6460. enum ipa_transport_type ipa3_get_transport_type(void)
  6461. {
  6462. return IPA_TRANSPORT_TYPE_GSI;
  6463. }
  6464. u32 ipa3_get_num_pipes(void)
  6465. {
  6466. return ipahal_read_reg(IPA_ENABLED_PIPES);
  6467. }
  6468. /**
  6469. * ipa3_disable_apps_wan_cons_deaggr()-
  6470. * set ipa_ctx->ipa_client_apps_wan_cons_agg_gro
  6471. *
  6472. * Return value: 0 or negative in case of failure
  6473. */
  6474. int ipa3_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
  6475. {
  6476. int res = -1;
  6477. /* ipahal will adjust limits based on HW capabilities */
  6478. if (ipa3_ctx) {
  6479. ipa3_ctx->ipa_client_apps_wan_cons_agg_gro = true;
  6480. return 0;
  6481. }
  6482. return res;
  6483. }
  6484. static void *ipa3_get_ipc_logbuf(void)
  6485. {
  6486. if (ipa3_ctx)
  6487. return ipa3_ctx->logbuf;
  6488. return NULL;
  6489. }
  6490. static void *ipa3_get_ipc_logbuf_low(void)
  6491. {
  6492. if (ipa3_ctx)
  6493. return ipa3_ctx->logbuf_low;
  6494. return NULL;
  6495. }
  6496. static void ipa3_get_holb(int ep_idx, struct ipa_ep_cfg_holb *holb)
  6497. {
  6498. *holb = ipa3_ctx->ep[ep_idx].holb;
  6499. }
  6500. static void ipa3_set_tag_process_before_gating(bool val)
  6501. {
  6502. ipa3_ctx->tag_process_before_gating = val;
  6503. }
  6504. /**
  6505. * ipa3_is_vlan_mode - check if a LAN driver should load in VLAN mode
  6506. * @iface - type of vlan capable device
  6507. * @res - query result: true for vlan mode, false for non vlan mode
  6508. *
  6509. * API must be called after ipa_is_ready() returns true, otherwise it will fail
  6510. *
  6511. * Returns: 0 on success, negative on failure
  6512. */
  6513. int ipa3_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
  6514. {
  6515. if (!res) {
  6516. IPAERR("NULL out param\n");
  6517. return -EINVAL;
  6518. }
  6519. if (iface < 0 || iface >= IPA_VLAN_IF_MAX) {
  6520. IPAERR("invalid iface %d\n", iface);
  6521. return -EINVAL;
  6522. }
  6523. if (!ipa3_is_ready()) {
  6524. IPAERR("IPA is not ready yet\n");
  6525. return -ENODEV;
  6526. }
  6527. *res = ipa3_ctx->vlan_mode_iface[iface];
  6528. IPADBG("Driver %d vlan mode is %d\n", iface, *res);
  6529. return 0;
  6530. }
  6531. int ipa3_bind_api_controller(enum ipa_hw_type ipa_hw_type,
  6532. struct ipa_api_controller *api_ctrl)
  6533. {
  6534. if (ipa_hw_type < IPA_HW_v3_0) {
  6535. IPAERR("Unsupported IPA HW version %d\n", ipa_hw_type);
  6536. WARN_ON(1);
  6537. return -EPERM;
  6538. }
  6539. api_ctrl->ipa_reset_endpoint = NULL;
  6540. api_ctrl->ipa_clear_endpoint_delay = ipa3_clear_endpoint_delay;
  6541. api_ctrl->ipa_disable_endpoint = NULL;
  6542. api_ctrl->ipa_cfg_ep = ipa3_cfg_ep;
  6543. api_ctrl->ipa_cfg_ep_nat = ipa3_cfg_ep_nat;
  6544. api_ctrl->ipa_cfg_ep_conn_track = ipa3_cfg_ep_conn_track;
  6545. api_ctrl->ipa_cfg_ep_hdr = ipa3_cfg_ep_hdr;
  6546. api_ctrl->ipa_cfg_ep_hdr_ext = ipa3_cfg_ep_hdr_ext;
  6547. api_ctrl->ipa_cfg_ep_mode = ipa3_cfg_ep_mode;
  6548. api_ctrl->ipa_cfg_ep_aggr = ipa3_cfg_ep_aggr;
  6549. api_ctrl->ipa_cfg_ep_deaggr = ipa3_cfg_ep_deaggr;
  6550. api_ctrl->ipa_cfg_ep_route = ipa3_cfg_ep_route;
  6551. api_ctrl->ipa_cfg_ep_holb = ipa3_cfg_ep_holb;
  6552. api_ctrl->ipa_get_holb = ipa3_get_holb;
  6553. api_ctrl->ipa_set_tag_process_before_gating =
  6554. ipa3_set_tag_process_before_gating;
  6555. api_ctrl->ipa_cfg_ep_cfg = ipa3_cfg_ep_cfg;
  6556. api_ctrl->ipa_cfg_ep_metadata_mask = ipa3_cfg_ep_metadata_mask;
  6557. api_ctrl->ipa_cfg_ep_holb_by_client = ipa3_cfg_ep_holb_by_client;
  6558. api_ctrl->ipa_cfg_ep_ctrl = ipa3_cfg_ep_ctrl;
  6559. api_ctrl->ipa_add_hdr = ipa3_add_hdr;
  6560. api_ctrl->ipa_add_hdr_usr = ipa3_add_hdr_usr;
  6561. api_ctrl->ipa_del_hdr = ipa3_del_hdr;
  6562. api_ctrl->ipa_commit_hdr = ipa3_commit_hdr;
  6563. api_ctrl->ipa_reset_hdr = ipa3_reset_hdr;
  6564. api_ctrl->ipa_get_hdr = ipa3_get_hdr;
  6565. api_ctrl->ipa_put_hdr = ipa3_put_hdr;
  6566. api_ctrl->ipa_copy_hdr = ipa3_copy_hdr;
  6567. api_ctrl->ipa_add_hdr_proc_ctx = ipa3_add_hdr_proc_ctx;
  6568. api_ctrl->ipa_del_hdr_proc_ctx = ipa3_del_hdr_proc_ctx;
  6569. api_ctrl->ipa_add_rt_rule = ipa3_add_rt_rule;
  6570. api_ctrl->ipa_add_rt_rule_v2 = ipa3_add_rt_rule_v2;
  6571. api_ctrl->ipa_add_rt_rule_usr = ipa3_add_rt_rule_usr;
  6572. api_ctrl->ipa_add_rt_rule_usr_v2 = ipa3_add_rt_rule_usr_v2;
  6573. api_ctrl->ipa_del_rt_rule = ipa3_del_rt_rule;
  6574. api_ctrl->ipa_commit_rt = ipa3_commit_rt;
  6575. api_ctrl->ipa_reset_rt = ipa3_reset_rt;
  6576. api_ctrl->ipa_get_rt_tbl = ipa3_get_rt_tbl;
  6577. api_ctrl->ipa_put_rt_tbl = ipa3_put_rt_tbl;
  6578. api_ctrl->ipa_query_rt_index = ipa3_query_rt_index;
  6579. api_ctrl->ipa_mdfy_rt_rule = ipa3_mdfy_rt_rule;
  6580. api_ctrl->ipa_mdfy_rt_rule_v2 = ipa3_mdfy_rt_rule_v2;
  6581. api_ctrl->ipa_add_flt_rule = ipa3_add_flt_rule;
  6582. api_ctrl->ipa_add_flt_rule_v2 = ipa3_add_flt_rule_v2;
  6583. api_ctrl->ipa_add_flt_rule_usr = ipa3_add_flt_rule_usr;
  6584. api_ctrl->ipa_add_flt_rule_usr_v2 = ipa3_add_flt_rule_usr_v2;
  6585. api_ctrl->ipa_del_flt_rule = ipa3_del_flt_rule;
  6586. api_ctrl->ipa_mdfy_flt_rule = ipa3_mdfy_flt_rule;
  6587. api_ctrl->ipa_mdfy_flt_rule_v2 = ipa3_mdfy_flt_rule_v2;
  6588. api_ctrl->ipa_commit_flt = ipa3_commit_flt;
  6589. api_ctrl->ipa_reset_flt = ipa3_reset_flt;
  6590. api_ctrl->ipa_allocate_nat_device = ipa3_allocate_nat_device;
  6591. api_ctrl->ipa_allocate_nat_table = ipa3_allocate_nat_table;
  6592. api_ctrl->ipa_allocate_ipv6ct_table = ipa3_allocate_ipv6ct_table;
  6593. api_ctrl->ipa_nat_init_cmd = ipa3_nat_init_cmd;
  6594. api_ctrl->ipa_ipv6ct_init_cmd = ipa3_ipv6ct_init_cmd;
  6595. api_ctrl->ipa_nat_dma_cmd = ipa3_nat_dma_cmd;
  6596. api_ctrl->ipa_table_dma_cmd = ipa3_table_dma_cmd;
  6597. api_ctrl->ipa_nat_del_cmd = ipa3_nat_del_cmd;
  6598. api_ctrl->ipa_del_nat_table = ipa3_del_nat_table;
  6599. api_ctrl->ipa_del_ipv6ct_table = ipa3_del_ipv6ct_table;
  6600. api_ctrl->ipa_nat_mdfy_pdn = ipa3_nat_mdfy_pdn;
  6601. api_ctrl->ipa_send_msg = ipa3_send_msg;
  6602. api_ctrl->ipa_register_pull_msg = ipa3_register_pull_msg;
  6603. api_ctrl->ipa_deregister_pull_msg = ipa3_deregister_pull_msg;
  6604. api_ctrl->ipa_register_intf = ipa3_register_intf;
  6605. api_ctrl->ipa_register_intf_ext = ipa3_register_intf_ext;
  6606. api_ctrl->ipa_deregister_intf = ipa3_deregister_intf;
  6607. api_ctrl->ipa_set_aggr_mode = ipa3_set_aggr_mode;
  6608. api_ctrl->ipa_set_qcncm_ndp_sig = ipa3_set_qcncm_ndp_sig;
  6609. api_ctrl->ipa_set_single_ndp_per_mbim = ipa3_set_single_ndp_per_mbim;
  6610. api_ctrl->ipa_tx_dp = ipa3_tx_dp;
  6611. api_ctrl->ipa_tx_dp_mul = ipa3_tx_dp_mul;
  6612. api_ctrl->ipa_free_skb = ipa3_free_skb;
  6613. api_ctrl->ipa_setup_sys_pipe = ipa3_setup_sys_pipe;
  6614. api_ctrl->ipa_teardown_sys_pipe = ipa3_teardown_sys_pipe;
  6615. api_ctrl->ipa_sys_setup = ipa3_sys_setup;
  6616. api_ctrl->ipa_sys_teardown = ipa3_sys_teardown;
  6617. api_ctrl->ipa_sys_update_gsi_hdls = ipa3_sys_update_gsi_hdls;
  6618. api_ctrl->ipa_connect_wdi_pipe = ipa3_connect_wdi_pipe;
  6619. api_ctrl->ipa_disconnect_wdi_pipe = ipa3_disconnect_wdi_pipe;
  6620. api_ctrl->ipa_enable_wdi_pipe = ipa3_enable_wdi_pipe;
  6621. api_ctrl->ipa_disable_wdi_pipe = ipa3_disable_wdi_pipe;
  6622. api_ctrl->ipa_resume_wdi_pipe = ipa3_resume_wdi_pipe;
  6623. api_ctrl->ipa_suspend_wdi_pipe = ipa3_suspend_wdi_pipe;
  6624. api_ctrl->ipa_get_wdi_stats = ipa3_get_wdi_stats;
  6625. api_ctrl->ipa_uc_bw_monitor = ipa3_uc_bw_monitor;
  6626. api_ctrl->ipa_set_wlan_tx_info = ipa3_set_wlan_tx_info;
  6627. api_ctrl->ipa_get_smem_restr_bytes = ipa3_get_smem_restr_bytes;
  6628. api_ctrl->ipa_broadcast_wdi_quota_reach_ind =
  6629. ipa3_broadcast_wdi_quota_reach_ind;
  6630. api_ctrl->ipa_uc_wdi_get_dbpa = ipa3_uc_wdi_get_dbpa;
  6631. api_ctrl->ipa_uc_reg_rdyCB = ipa3_uc_reg_rdyCB;
  6632. api_ctrl->ipa_uc_dereg_rdyCB = ipa3_uc_dereg_rdyCB;
  6633. api_ctrl->teth_bridge_init = ipa3_teth_bridge_init;
  6634. api_ctrl->teth_bridge_disconnect = ipa3_teth_bridge_disconnect;
  6635. api_ctrl->teth_bridge_connect = ipa3_teth_bridge_connect;
  6636. api_ctrl->ipa_set_client = ipa3_set_client;
  6637. api_ctrl->ipa_get_client = ipa3_get_client;
  6638. api_ctrl->ipa_get_client_uplink = ipa3_get_client_uplink;
  6639. api_ctrl->ipa_dma_init = ipa3_dma_init;
  6640. api_ctrl->ipa_dma_enable = ipa3_dma_enable;
  6641. api_ctrl->ipa_dma_disable = ipa3_dma_disable;
  6642. api_ctrl->ipa_dma_sync_memcpy = ipa3_dma_sync_memcpy;
  6643. api_ctrl->ipa_dma_async_memcpy = ipa3_dma_async_memcpy;
  6644. api_ctrl->ipa_dma_uc_memcpy = ipa3_dma_uc_memcpy;
  6645. api_ctrl->ipa_dma_destroy = ipa3_dma_destroy;
  6646. api_ctrl->ipa_mhi_init_engine = ipa3_mhi_init_engine;
  6647. api_ctrl->ipa_connect_mhi_pipe = ipa3_connect_mhi_pipe;
  6648. api_ctrl->ipa_disconnect_mhi_pipe = ipa3_disconnect_mhi_pipe;
  6649. api_ctrl->ipa_mhi_stop_gsi_channel = ipa3_mhi_stop_gsi_channel;
  6650. api_ctrl->ipa_uc_mhi_reset_channel = ipa3_uc_mhi_reset_channel;
  6651. api_ctrl->ipa_qmi_enable_force_clear_datapath_send =
  6652. ipa3_qmi_enable_force_clear_datapath_send;
  6653. api_ctrl->ipa_qmi_disable_force_clear_datapath_send =
  6654. ipa3_qmi_disable_force_clear_datapath_send;
  6655. api_ctrl->ipa_mhi_reset_channel_internal =
  6656. ipa3_mhi_reset_channel_internal;
  6657. api_ctrl->ipa_mhi_start_channel_internal =
  6658. ipa3_mhi_start_channel_internal;
  6659. api_ctrl->ipa_mhi_query_ch_info = ipa3_mhi_query_ch_info;
  6660. api_ctrl->ipa_mhi_resume_channels_internal =
  6661. ipa3_mhi_resume_channels_internal;
  6662. api_ctrl->ipa_has_open_aggr_frame = ipa3_has_open_aggr_frame;
  6663. api_ctrl->ipa_mhi_destroy_channel = ipa3_mhi_destroy_channel;
  6664. api_ctrl->ipa_uc_mhi_send_dl_ul_sync_info =
  6665. ipa3_uc_mhi_send_dl_ul_sync_info;
  6666. api_ctrl->ipa_uc_mhi_init = ipa3_uc_mhi_init;
  6667. api_ctrl->ipa_uc_mhi_suspend_channel = ipa3_uc_mhi_suspend_channel;
  6668. api_ctrl->ipa_uc_mhi_stop_event_update_channel =
  6669. ipa3_uc_mhi_stop_event_update_channel;
  6670. api_ctrl->ipa_uc_mhi_cleanup = ipa3_uc_mhi_cleanup;
  6671. api_ctrl->ipa_uc_state_check = ipa3_uc_state_check;
  6672. api_ctrl->ipa_write_qmap_id = ipa3_write_qmap_id;
  6673. api_ctrl->ipa_add_interrupt_handler = ipa3_add_interrupt_handler;
  6674. api_ctrl->ipa_remove_interrupt_handler = ipa3_remove_interrupt_handler;
  6675. api_ctrl->ipa_restore_suspend_handler = ipa3_restore_suspend_handler;
  6676. api_ctrl->ipa_bam_reg_dump = NULL;
  6677. api_ctrl->ipa_get_ep_mapping = ipa3_get_ep_mapping;
  6678. api_ctrl->ipa_is_ready = ipa3_is_ready;
  6679. api_ctrl->ipa_proxy_clk_vote = ipa3_proxy_clk_vote;
  6680. api_ctrl->ipa_proxy_clk_unvote = ipa3_proxy_clk_unvote;
  6681. api_ctrl->ipa_is_client_handle_valid = ipa3_is_client_handle_valid;
  6682. api_ctrl->ipa_get_client_mapping = ipa3_get_client_mapping;
  6683. api_ctrl->ipa_get_modem_cfg_emb_pipe_flt =
  6684. ipa3_get_modem_cfg_emb_pipe_flt;
  6685. api_ctrl->ipa_get_transport_type = ipa3_get_transport_type;
  6686. api_ctrl->ipa_ap_suspend = ipa3_ap_suspend;
  6687. api_ctrl->ipa_ap_resume = ipa3_ap_resume;
  6688. api_ctrl->ipa_get_smmu_domain = ipa3_get_smmu_domain;
  6689. api_ctrl->ipa_disable_apps_wan_cons_deaggr =
  6690. ipa3_disable_apps_wan_cons_deaggr;
  6691. api_ctrl->ipa_get_dma_dev = ipa3_get_dma_dev;
  6692. api_ctrl->ipa_release_wdi_mapping = ipa3_release_wdi_mapping;
  6693. api_ctrl->ipa_create_wdi_mapping = ipa3_create_wdi_mapping;
  6694. api_ctrl->ipa_get_gsi_ep_info = ipa3_get_gsi_ep_info;
  6695. api_ctrl->ipa_stop_gsi_channel = ipa3_stop_gsi_channel;
  6696. api_ctrl->ipa_start_gsi_channel = ipa3_start_gsi_channel;
  6697. api_ctrl->ipa_register_ipa_ready_cb = ipa3_register_ipa_ready_cb;
  6698. api_ctrl->ipa_inc_client_enable_clks = ipa3_inc_client_enable_clks;
  6699. api_ctrl->ipa_dec_client_disable_clks = ipa3_dec_client_disable_clks;
  6700. api_ctrl->ipa_inc_client_enable_clks_no_block =
  6701. ipa3_inc_client_enable_clks_no_block;
  6702. api_ctrl->ipa_suspend_resource_no_block =
  6703. ipa3_suspend_resource_no_block;
  6704. api_ctrl->ipa_resume_resource = ipa3_resume_resource;
  6705. api_ctrl->ipa_suspend_resource_sync = ipa3_suspend_resource_sync;
  6706. api_ctrl->ipa_set_required_perf_profile =
  6707. ipa3_set_required_perf_profile;
  6708. api_ctrl->ipa_get_ipc_logbuf = ipa3_get_ipc_logbuf;
  6709. api_ctrl->ipa_get_ipc_logbuf_low = ipa3_get_ipc_logbuf_low;
  6710. api_ctrl->ipa_rx_poll = ipa3_rx_poll;
  6711. api_ctrl->ipa_setup_uc_ntn_pipes = ipa3_setup_uc_ntn_pipes;
  6712. api_ctrl->ipa_tear_down_uc_offload_pipes =
  6713. ipa3_tear_down_uc_offload_pipes;
  6714. api_ctrl->ipa_get_pdev = ipa3_get_pdev;
  6715. api_ctrl->ipa_ntn_uc_reg_rdyCB = ipa3_ntn_uc_reg_rdyCB;
  6716. api_ctrl->ipa_ntn_uc_dereg_rdyCB = ipa3_ntn_uc_dereg_rdyCB;
  6717. api_ctrl->ipa_conn_wdi_pipes = ipa3_conn_wdi3_pipes;
  6718. api_ctrl->ipa_disconn_wdi_pipes = ipa3_disconn_wdi3_pipes;
  6719. api_ctrl->ipa_enable_wdi_pipes = ipa3_enable_wdi3_pipes;
  6720. api_ctrl->ipa_disable_wdi_pipes = ipa3_disable_wdi3_pipes;
  6721. api_ctrl->ipa_tz_unlock_reg = ipa3_tz_unlock_reg;
  6722. api_ctrl->ipa_get_smmu_params = ipa3_get_smmu_params;
  6723. api_ctrl->ipa_is_vlan_mode = ipa3_is_vlan_mode;
  6724. api_ctrl->ipa_wigig_internal_init = ipa3_wigig_internal_init;
  6725. api_ctrl->ipa_conn_wigig_rx_pipe_i = ipa3_conn_wigig_rx_pipe_i;
  6726. api_ctrl->ipa_conn_wigig_client_i = ipa3_conn_wigig_client_i;
  6727. api_ctrl->ipa_disconn_wigig_pipe_i = ipa3_disconn_wigig_pipe_i;
  6728. api_ctrl->ipa_wigig_uc_msi_init = ipa3_wigig_uc_msi_init;
  6729. api_ctrl->ipa_enable_wigig_pipe_i = ipa3_enable_wigig_pipe_i;
  6730. api_ctrl->ipa_disable_wigig_pipe_i = ipa3_disable_wigig_pipe_i;
  6731. api_ctrl->ipa_register_client_callback =
  6732. ipa3_register_client_callback;
  6733. api_ctrl->ipa_deregister_client_callback =
  6734. ipa3_deregister_client_callback;
  6735. api_ctrl->ipa_get_lan_rx_napi = ipa3_get_lan_rx_napi;
  6736. api_ctrl->ipa_uc_debug_stats_alloc =
  6737. ipa3_uc_debug_stats_alloc;
  6738. api_ctrl->ipa_uc_debug_stats_dealloc =
  6739. ipa3_uc_debug_stats_dealloc;
  6740. api_ctrl->ipa_get_gsi_stats =
  6741. ipa3_get_gsi_stats;
  6742. api_ctrl->ipa_get_prot_id =
  6743. ipa3_get_prot_id;
  6744. return 0;
  6745. }
  6746. /**
  6747. * ipa_is_modem_pipe()- Checks if pipe is owned by the modem
  6748. *
  6749. * @pipe_idx: pipe number
  6750. * Return value: true if owned by modem, false otherwize
  6751. */
  6752. bool ipa_is_modem_pipe(int pipe_idx)
  6753. {
  6754. int client_idx;
  6755. if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
  6756. IPAERR("Bad pipe index!\n");
  6757. return false;
  6758. }
  6759. for (client_idx = 0; client_idx < IPA_CLIENT_MAX; client_idx++) {
  6760. if (!IPA_CLIENT_IS_Q6_CONS(client_idx) &&
  6761. !IPA_CLIENT_IS_Q6_PROD(client_idx))
  6762. continue;
  6763. if (ipa3_get_ep_mapping(client_idx) == pipe_idx)
  6764. return true;
  6765. }
  6766. return false;
  6767. }
  6768. static void ipa3_write_rsrc_grp_type_reg(int group_index,
  6769. enum ipa_rsrc_grp_type_src n, bool src,
  6770. struct ipahal_reg_rsrc_grp_cfg *val)
  6771. {
  6772. u8 hw_type_idx;
  6773. hw_type_idx = ipa3_get_hw_type_index();
  6774. switch (hw_type_idx) {
  6775. case IPA_3_0:
  6776. if (src) {
  6777. switch (group_index) {
  6778. case IPA_v3_0_GROUP_UL:
  6779. case IPA_v3_0_GROUP_DL:
  6780. ipahal_write_reg_n_fields(
  6781. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  6782. n, val);
  6783. break;
  6784. case IPA_v3_0_GROUP_DIAG:
  6785. case IPA_v3_0_GROUP_DMA:
  6786. ipahal_write_reg_n_fields(
  6787. IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
  6788. n, val);
  6789. break;
  6790. case IPA_v3_0_GROUP_Q6ZIP:
  6791. case IPA_v3_0_GROUP_UC_RX_Q:
  6792. ipahal_write_reg_n_fields(
  6793. IPA_SRC_RSRC_GRP_45_RSRC_TYPE_n,
  6794. n, val);
  6795. break;
  6796. default:
  6797. IPAERR(
  6798. " Invalid source resource group,index #%d\n",
  6799. group_index);
  6800. break;
  6801. }
  6802. } else {
  6803. switch (group_index) {
  6804. case IPA_v3_0_GROUP_UL:
  6805. case IPA_v3_0_GROUP_DL:
  6806. ipahal_write_reg_n_fields(
  6807. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  6808. n, val);
  6809. break;
  6810. case IPA_v3_0_GROUP_DIAG:
  6811. case IPA_v3_0_GROUP_DMA:
  6812. ipahal_write_reg_n_fields(
  6813. IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
  6814. n, val);
  6815. break;
  6816. case IPA_v3_0_GROUP_Q6ZIP_GENERAL:
  6817. case IPA_v3_0_GROUP_Q6ZIP_ENGINE:
  6818. ipahal_write_reg_n_fields(
  6819. IPA_DST_RSRC_GRP_45_RSRC_TYPE_n,
  6820. n, val);
  6821. break;
  6822. default:
  6823. IPAERR(
  6824. " Invalid destination resource group,index #%d\n",
  6825. group_index);
  6826. break;
  6827. }
  6828. }
  6829. break;
  6830. case IPA_3_5:
  6831. case IPA_3_5_MHI:
  6832. case IPA_3_5_1:
  6833. if (src) {
  6834. switch (group_index) {
  6835. case IPA_v3_5_GROUP_LWA_DL:
  6836. case IPA_v3_5_GROUP_UL_DL:
  6837. ipahal_write_reg_n_fields(
  6838. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  6839. n, val);
  6840. break;
  6841. case IPA_v3_5_MHI_GROUP_DMA:
  6842. case IPA_v3_5_GROUP_UC_RX_Q:
  6843. ipahal_write_reg_n_fields(
  6844. IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
  6845. n, val);
  6846. break;
  6847. default:
  6848. IPAERR(
  6849. " Invalid source resource group,index #%d\n",
  6850. group_index);
  6851. break;
  6852. }
  6853. } else {
  6854. switch (group_index) {
  6855. case IPA_v3_5_GROUP_LWA_DL:
  6856. case IPA_v3_5_GROUP_UL_DL:
  6857. ipahal_write_reg_n_fields(
  6858. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  6859. n, val);
  6860. break;
  6861. case IPA_v3_5_MHI_GROUP_DMA:
  6862. ipahal_write_reg_n_fields(
  6863. IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
  6864. n, val);
  6865. break;
  6866. default:
  6867. IPAERR(
  6868. " Invalid destination resource group,index #%d\n",
  6869. group_index);
  6870. break;
  6871. }
  6872. }
  6873. break;
  6874. case IPA_4_0:
  6875. case IPA_4_0_MHI:
  6876. case IPA_4_1:
  6877. if (src) {
  6878. switch (group_index) {
  6879. case IPA_v4_0_GROUP_LWA_DL:
  6880. case IPA_v4_0_GROUP_UL_DL:
  6881. ipahal_write_reg_n_fields(
  6882. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  6883. n, val);
  6884. break;
  6885. case IPA_v4_0_MHI_GROUP_DMA:
  6886. case IPA_v4_0_GROUP_UC_RX_Q:
  6887. ipahal_write_reg_n_fields(
  6888. IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
  6889. n, val);
  6890. break;
  6891. default:
  6892. IPAERR(
  6893. " Invalid source resource group,index #%d\n",
  6894. group_index);
  6895. break;
  6896. }
  6897. } else {
  6898. switch (group_index) {
  6899. case IPA_v4_0_GROUP_LWA_DL:
  6900. case IPA_v4_0_GROUP_UL_DL:
  6901. ipahal_write_reg_n_fields(
  6902. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  6903. n, val);
  6904. break;
  6905. case IPA_v4_0_MHI_GROUP_DMA:
  6906. ipahal_write_reg_n_fields(
  6907. IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
  6908. n, val);
  6909. break;
  6910. default:
  6911. IPAERR(
  6912. " Invalid destination resource group,index #%d\n",
  6913. group_index);
  6914. break;
  6915. }
  6916. }
  6917. break;
  6918. case IPA_4_2:
  6919. if (src) {
  6920. switch (group_index) {
  6921. case IPA_v4_2_GROUP_UL_DL:
  6922. ipahal_write_reg_n_fields(
  6923. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  6924. n, val);
  6925. break;
  6926. default:
  6927. IPAERR(
  6928. " Invalid source resource group,index #%d\n",
  6929. group_index);
  6930. break;
  6931. }
  6932. } else {
  6933. switch (group_index) {
  6934. case IPA_v4_2_GROUP_UL_DL:
  6935. ipahal_write_reg_n_fields(
  6936. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  6937. n, val);
  6938. break;
  6939. default:
  6940. IPAERR(
  6941. " Invalid destination resource group,index #%d\n",
  6942. group_index);
  6943. break;
  6944. }
  6945. }
  6946. break;
  6947. case IPA_4_5:
  6948. case IPA_4_5_MHI:
  6949. case IPA_4_5_APQ:
  6950. if (src) {
  6951. switch (group_index) {
  6952. case IPA_v4_5_MHI_GROUP_PCIE:
  6953. case IPA_v4_5_GROUP_UL_DL:
  6954. ipahal_write_reg_n_fields(
  6955. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  6956. n, val);
  6957. break;
  6958. case IPA_v4_5_MHI_GROUP_DMA:
  6959. case IPA_v4_5_MHI_GROUP_QDSS:
  6960. ipahal_write_reg_n_fields(
  6961. IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
  6962. n, val);
  6963. break;
  6964. case IPA_v4_5_GROUP_UC_RX_Q:
  6965. ipahal_write_reg_n_fields(
  6966. IPA_SRC_RSRC_GRP_45_RSRC_TYPE_n,
  6967. n, val);
  6968. break;
  6969. default:
  6970. IPAERR(
  6971. " Invalid source resource group,index #%d\n",
  6972. group_index);
  6973. break;
  6974. }
  6975. } else {
  6976. switch (group_index) {
  6977. case IPA_v4_5_MHI_GROUP_PCIE:
  6978. case IPA_v4_5_GROUP_UL_DL:
  6979. ipahal_write_reg_n_fields(
  6980. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  6981. n, val);
  6982. break;
  6983. case IPA_v4_5_MHI_GROUP_DMA:
  6984. case IPA_v4_5_MHI_GROUP_QDSS:
  6985. ipahal_write_reg_n_fields(
  6986. IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
  6987. n, val);
  6988. break;
  6989. case IPA_v4_5_GROUP_UC_RX_Q:
  6990. ipahal_write_reg_n_fields(
  6991. IPA_DST_RSRC_GRP_45_RSRC_TYPE_n,
  6992. n, val);
  6993. break;
  6994. default:
  6995. IPAERR(
  6996. " Invalid destination resource group,index #%d\n",
  6997. group_index);
  6998. break;
  6999. }
  7000. }
  7001. break;
  7002. case IPA_4_7:
  7003. if (src) {
  7004. switch (group_index) {
  7005. case IPA_v4_7_GROUP_UL_DL:
  7006. ipahal_write_reg_n_fields(
  7007. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  7008. n, val);
  7009. break;
  7010. default:
  7011. IPAERR(
  7012. " Invalid source resource group,index #%d\n",
  7013. group_index);
  7014. break;
  7015. }
  7016. } else {
  7017. switch (group_index) {
  7018. case IPA_v4_7_GROUP_UL_DL:
  7019. ipahal_write_reg_n_fields(
  7020. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  7021. n, val);
  7022. break;
  7023. default:
  7024. IPAERR(
  7025. " Invalid destination resource group,index #%d\n",
  7026. group_index);
  7027. break;
  7028. }
  7029. }
  7030. break;
  7031. case IPA_4_9:
  7032. if (src) {
  7033. switch (group_index) {
  7034. case IPA_v4_9_GROUP_UL_DL:
  7035. ipahal_write_reg_n_fields(
  7036. IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
  7037. n, val);
  7038. break;
  7039. default:
  7040. IPAERR(
  7041. " Invalid source resource group,index #%d\n",
  7042. group_index);
  7043. break;
  7044. }
  7045. } else {
  7046. switch (group_index) {
  7047. case IPA_v4_9_GROUP_UL_DL:
  7048. ipahal_write_reg_n_fields(
  7049. IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
  7050. n, val);
  7051. break;
  7052. default:
  7053. IPAERR(
  7054. " Invalid destination resource group,index #%d\n",
  7055. group_index);
  7056. break;
  7057. }
  7058. }
  7059. break;
  7060. default:
  7061. IPAERR("invalid hw type\n");
  7062. WARN_ON(1);
  7063. return;
  7064. }
  7065. }
  7066. static void ipa3_configure_rx_hps_clients(int depth,
  7067. int max_clnt_in_depth, int base_index, bool min)
  7068. {
  7069. int i;
  7070. struct ipahal_reg_rx_hps_clients val;
  7071. u8 hw_type_idx;
  7072. hw_type_idx = ipa3_get_hw_type_index();
  7073. for (i = 0 ; i < max_clnt_in_depth ; i++) {
  7074. if (min)
  7075. val.client_minmax[i] =
  7076. ipa3_rsrc_rx_grp_config
  7077. [hw_type_idx]
  7078. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ]
  7079. [i + base_index].min;
  7080. else
  7081. val.client_minmax[i] =
  7082. ipa3_rsrc_rx_grp_config
  7083. [hw_type_idx]
  7084. [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ]
  7085. [i + base_index].max;
  7086. }
  7087. if (depth) {
  7088. ipahal_write_reg_fields(min ? IPA_RX_HPS_CLIENTS_MIN_DEPTH_1 :
  7089. IPA_RX_HPS_CLIENTS_MAX_DEPTH_1,
  7090. &val);
  7091. } else {
  7092. ipahal_write_reg_fields(min ? IPA_RX_HPS_CLIENTS_MIN_DEPTH_0 :
  7093. IPA_RX_HPS_CLIENTS_MAX_DEPTH_0,
  7094. &val);
  7095. }
  7096. }
  7097. static void ipa3_configure_rx_hps_weight(void)
  7098. {
  7099. struct ipahal_reg_rx_hps_weights val;
  7100. u8 hw_type_idx;
  7101. hw_type_idx = ipa3_get_hw_type_index();
  7102. val.hps_queue_weight_0 =
  7103. ipa3_rsrc_rx_grp_hps_weight_config
  7104. [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
  7105. [0];
  7106. val.hps_queue_weight_1 =
  7107. ipa3_rsrc_rx_grp_hps_weight_config
  7108. [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
  7109. [1];
  7110. val.hps_queue_weight_2 =
  7111. ipa3_rsrc_rx_grp_hps_weight_config
  7112. [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
  7113. [2];
  7114. val.hps_queue_weight_3 =
  7115. ipa3_rsrc_rx_grp_hps_weight_config
  7116. [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
  7117. [3];
  7118. ipahal_write_reg_fields(IPA_HPS_FTCH_ARB_QUEUE_WEIGHT, &val);
  7119. }
  7120. static void ipa3_configure_rx_hps(void)
  7121. {
  7122. int rx_hps_max_clnt_in_depth0;
  7123. IPADBG("Assign RX_HPS CMDQ rsrc groups min-max limits\n");
  7124. /* Starting IPA4.5 we have 5 RX_HPS_CMDQ */
  7125. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5)
  7126. rx_hps_max_clnt_in_depth0 = 4;
  7127. else
  7128. rx_hps_max_clnt_in_depth0 = 5;
  7129. ipa3_configure_rx_hps_clients(0, rx_hps_max_clnt_in_depth0, 0, true);
  7130. ipa3_configure_rx_hps_clients(0, rx_hps_max_clnt_in_depth0, 0, false);
  7131. /*
  7132. * IPA 3.0/3.1 uses 6 RX_HPS_CMDQ and needs depths1 for that
  7133. * which has two clients
  7134. */
  7135. if (ipa3_ctx->ipa_hw_type <= IPA_HW_v3_1) {
  7136. ipa3_configure_rx_hps_clients(1, 2, rx_hps_max_clnt_in_depth0,
  7137. true);
  7138. ipa3_configure_rx_hps_clients(1, 2, rx_hps_max_clnt_in_depth0,
  7139. false);
  7140. }
  7141. /* Starting IPA4.2 no support to HPS weight config */
  7142. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5 &&
  7143. (ipa3_ctx->ipa_hw_type < IPA_HW_v4_2))
  7144. ipa3_configure_rx_hps_weight();
  7145. }
  7146. void ipa3_set_resorce_groups_min_max_limits(void)
  7147. {
  7148. int i;
  7149. int j;
  7150. int src_rsrc_type_max;
  7151. int dst_rsrc_type_max;
  7152. int src_grp_idx_max;
  7153. int dst_grp_idx_max;
  7154. struct ipahal_reg_rsrc_grp_cfg val;
  7155. u8 hw_type_idx;
  7156. IPADBG("ENTER\n");
  7157. hw_type_idx = ipa3_get_hw_type_index();
  7158. switch (hw_type_idx) {
  7159. case IPA_3_0:
  7160. src_rsrc_type_max = IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX;
  7161. dst_rsrc_type_max = IPA_v3_0_RSRC_GRP_TYPE_DST_MAX;
  7162. src_grp_idx_max = IPA_v3_0_GROUP_MAX;
  7163. dst_grp_idx_max = IPA_v3_0_GROUP_MAX;
  7164. break;
  7165. case IPA_3_5:
  7166. case IPA_3_5_MHI:
  7167. case IPA_3_5_1:
  7168. src_rsrc_type_max = IPA_v3_5_RSRC_GRP_TYPE_SRC_MAX;
  7169. dst_rsrc_type_max = IPA_v3_5_RSRC_GRP_TYPE_DST_MAX;
  7170. src_grp_idx_max = IPA_v3_5_SRC_GROUP_MAX;
  7171. dst_grp_idx_max = IPA_v3_5_DST_GROUP_MAX;
  7172. break;
  7173. case IPA_4_0:
  7174. case IPA_4_0_MHI:
  7175. case IPA_4_1:
  7176. src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
  7177. dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
  7178. src_grp_idx_max = IPA_v4_0_SRC_GROUP_MAX;
  7179. dst_grp_idx_max = IPA_v4_0_DST_GROUP_MAX;
  7180. break;
  7181. case IPA_4_2:
  7182. src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
  7183. dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
  7184. src_grp_idx_max = IPA_v4_2_SRC_GROUP_MAX;
  7185. dst_grp_idx_max = IPA_v4_2_DST_GROUP_MAX;
  7186. break;
  7187. case IPA_4_5:
  7188. case IPA_4_5_MHI:
  7189. case IPA_4_5_APQ:
  7190. src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
  7191. dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
  7192. src_grp_idx_max = IPA_v4_5_SRC_GROUP_MAX;
  7193. dst_grp_idx_max = IPA_v4_5_DST_GROUP_MAX;
  7194. break;
  7195. case IPA_4_7:
  7196. src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
  7197. dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
  7198. src_grp_idx_max = IPA_v4_7_SRC_GROUP_MAX;
  7199. dst_grp_idx_max = IPA_v4_7_DST_GROUP_MAX;
  7200. break;
  7201. case IPA_4_9:
  7202. src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
  7203. dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
  7204. src_grp_idx_max = IPA_v4_9_SRC_GROUP_MAX;
  7205. dst_grp_idx_max = IPA_v4_9_DST_GROUP_MAX;
  7206. break;
  7207. default:
  7208. IPAERR("invalid hw type index\n");
  7209. WARN_ON(1);
  7210. return;
  7211. }
  7212. IPADBG("Assign source rsrc groups min-max limits\n");
  7213. for (i = 0; i < src_rsrc_type_max; i++) {
  7214. for (j = 0; j < src_grp_idx_max; j = j + 2) {
  7215. val.x_min =
  7216. ipa3_rsrc_src_grp_config[hw_type_idx][i][j].min;
  7217. val.x_max =
  7218. ipa3_rsrc_src_grp_config[hw_type_idx][i][j].max;
  7219. val.y_min =
  7220. ipa3_rsrc_src_grp_config[hw_type_idx][i][j + 1].min;
  7221. val.y_max =
  7222. ipa3_rsrc_src_grp_config[hw_type_idx][i][j + 1].max;
  7223. ipa3_write_rsrc_grp_type_reg(j, i, true, &val);
  7224. }
  7225. }
  7226. IPADBG("Assign destination rsrc groups min-max limits\n");
  7227. for (i = 0; i < dst_rsrc_type_max; i++) {
  7228. for (j = 0; j < dst_grp_idx_max; j = j + 2) {
  7229. val.x_min =
  7230. ipa3_rsrc_dst_grp_config[hw_type_idx][i][j].min;
  7231. val.x_max =
  7232. ipa3_rsrc_dst_grp_config[hw_type_idx][i][j].max;
  7233. val.y_min =
  7234. ipa3_rsrc_dst_grp_config[hw_type_idx][i][j + 1].min;
  7235. val.y_max =
  7236. ipa3_rsrc_dst_grp_config[hw_type_idx][i][j + 1].max;
  7237. ipa3_write_rsrc_grp_type_reg(j, i, false, &val);
  7238. }
  7239. }
  7240. /* move rx_hps resource group configuration from HLOS to TZ
  7241. * on real platform with IPA 3.1 or later
  7242. */
  7243. if (ipa3_ctx->ipa_hw_type < IPA_HW_v3_1 ||
  7244. ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_VIRTUAL ||
  7245. ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_EMULATION) {
  7246. ipa3_configure_rx_hps();
  7247. }
  7248. IPADBG("EXIT\n");
  7249. }
  7250. static bool ipa3_gsi_channel_is_quite(struct ipa3_ep_context *ep)
  7251. {
  7252. bool empty;
  7253. gsi_is_channel_empty(ep->gsi_chan_hdl, &empty);
  7254. if (!empty) {
  7255. IPADBG("ch %ld not empty\n", ep->gsi_chan_hdl);
  7256. /* queue a work to start polling if don't have one */
  7257. atomic_set(&ipa3_ctx->transport_pm.eot_activity, 1);
  7258. if (!atomic_read(&ep->sys->curr_polling_state))
  7259. __ipa_gsi_irq_rx_scedule_poll(ep->sys);
  7260. }
  7261. return empty;
  7262. }
  7263. static int __ipa3_stop_gsi_channel(u32 clnt_hdl)
  7264. {
  7265. struct ipa_mem_buffer mem;
  7266. int res = 0;
  7267. int i;
  7268. struct ipa3_ep_context *ep;
  7269. enum ipa_client_type client_type;
  7270. struct IpaHwOffloadStatsAllocCmdData_t *gsi_info;
  7271. if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
  7272. ipa3_ctx->ep[clnt_hdl].valid == 0) {
  7273. IPAERR("bad parm.\n");
  7274. return -EINVAL;
  7275. }
  7276. ep = &ipa3_ctx->ep[clnt_hdl];
  7277. client_type = ipa3_get_client_mapping(clnt_hdl);
  7278. memset(&mem, 0, sizeof(mem));
  7279. /* stop uC gsi dbg stats monitor */
  7280. if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5 &&
  7281. ipa3_ctx->ipa_hw_type != IPA_HW_v4_7) {
  7282. switch (client_type) {
  7283. case IPA_CLIENT_MHI_PRIME_TETH_PROD:
  7284. gsi_info = &ipa3_ctx->gsi_info[IPA_HW_PROTOCOL_MHIP];
  7285. gsi_info->ch_id_info[0].ch_id = 0xff;
  7286. gsi_info->ch_id_info[0].dir = DIR_PRODUCER;
  7287. ipa3_uc_debug_stats_alloc(*gsi_info);
  7288. break;
  7289. case IPA_CLIENT_MHI_PRIME_TETH_CONS:
  7290. gsi_info = &ipa3_ctx->gsi_info[IPA_HW_PROTOCOL_MHIP];
  7291. gsi_info->ch_id_info[1].ch_id = 0xff;
  7292. gsi_info->ch_id_info[1].dir = DIR_CONSUMER;
  7293. ipa3_uc_debug_stats_alloc(*gsi_info);
  7294. break;
  7295. case IPA_CLIENT_MHI_PRIME_RMNET_PROD:
  7296. gsi_info = &ipa3_ctx->gsi_info[IPA_HW_PROTOCOL_MHIP];
  7297. gsi_info->ch_id_info[2].ch_id = 0xff;
  7298. gsi_info->ch_id_info[2].dir = DIR_PRODUCER;
  7299. ipa3_uc_debug_stats_alloc(*gsi_info);
  7300. break;
  7301. case IPA_CLIENT_MHI_PRIME_RMNET_CONS:
  7302. gsi_info = &ipa3_ctx->gsi_info[IPA_HW_PROTOCOL_MHIP];
  7303. gsi_info->ch_id_info[3].ch_id = 0xff;
  7304. gsi_info->ch_id_info[3].dir = DIR_CONSUMER;
  7305. ipa3_uc_debug_stats_alloc(*gsi_info);
  7306. break;
  7307. case IPA_CLIENT_USB_PROD:
  7308. gsi_info = &ipa3_ctx->gsi_info[IPA_HW_PROTOCOL_USB];
  7309. gsi_info->ch_id_info[0].ch_id = 0xff;
  7310. gsi_info->ch_id_info[0].dir = DIR_PRODUCER;
  7311. ipa3_uc_debug_stats_alloc(*gsi_info);
  7312. break;
  7313. case IPA_CLIENT_USB_CONS:
  7314. gsi_info = &ipa3_ctx->gsi_info[IPA_HW_PROTOCOL_USB];
  7315. gsi_info->ch_id_info[1].ch_id = 0xff;
  7316. gsi_info->ch_id_info[1].dir = DIR_CONSUMER;
  7317. ipa3_uc_debug_stats_alloc(*gsi_info);
  7318. break;
  7319. default:
  7320. IPADBG("client_type %d not supported\n",
  7321. client_type);
  7322. }
  7323. }
  7324. /*
  7325. * Apply the GSI stop retry logic if GSI returns err code to retry.
  7326. * Apply the retry logic for ipa_client_prod as well as ipa_client_cons.
  7327. */
  7328. for (i = 0; i < IPA_GSI_CHANNEL_STOP_MAX_RETRY; i++) {
  7329. IPADBG("Calling gsi_stop_channel ch:%lu\n",
  7330. ep->gsi_chan_hdl);
  7331. res = gsi_stop_channel(ep->gsi_chan_hdl);
  7332. IPADBG("gsi_stop_channel ch: %lu returned %d\n",
  7333. ep->gsi_chan_hdl, res);
  7334. if (res != -GSI_STATUS_AGAIN && res != -GSI_STATUS_TIMED_OUT)
  7335. return res;
  7336. /*
  7337. * From >=IPA4.0 version not required to send dma send command,
  7338. * this issue was fixed in latest versions.
  7339. */
  7340. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0) {
  7341. IPADBG("Inject a DMA_TASK with 1B packet to IPA\n");
  7342. /* Send a 1B packet DMA_TASK to IPA and try again */
  7343. res = ipa3_inject_dma_task_for_gsi();
  7344. if (res) {
  7345. IPAERR("Failed to inject DMA TASk for GSI\n");
  7346. return res;
  7347. }
  7348. }
  7349. /* sleep for short period to flush IPA */
  7350. usleep_range(IPA_GSI_CHANNEL_STOP_SLEEP_MIN_USEC,
  7351. IPA_GSI_CHANNEL_STOP_SLEEP_MAX_USEC);
  7352. }
  7353. IPAERR("Failed to stop GSI channel with retries\n");
  7354. return -EFAULT;
  7355. }
  7356. /**
  7357. * ipa3_stop_gsi_channel()- Stops a GSI channel in IPA
  7358. * @chan_hdl: GSI channel handle
  7359. *
  7360. * This function implements the sequence to stop a GSI channel
  7361. * in IPA. This function returns when the channel is in STOP state.
  7362. *
  7363. * Return value: 0 on success, negative otherwise
  7364. */
  7365. int ipa3_stop_gsi_channel(u32 clnt_hdl)
  7366. {
  7367. int res;
  7368. IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
  7369. res = __ipa3_stop_gsi_channel(clnt_hdl);
  7370. IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
  7371. return res;
  7372. }
  7373. EXPORT_SYMBOL(ipa3_stop_gsi_channel);
  7374. static int _ipa_suspend_resume_pipe(enum ipa_client_type client, bool suspend)
  7375. {
  7376. int ipa_ep_idx, coal_ep_idx;
  7377. struct ipa3_ep_context *ep;
  7378. int res;
  7379. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0) {
  7380. IPAERR("not supported\n");
  7381. return -EPERM;
  7382. }
  7383. ipa_ep_idx = ipa3_get_ep_mapping(client);
  7384. if (ipa_ep_idx < 0) {
  7385. IPADBG("client %d not configured\n", client);
  7386. return 0;
  7387. }
  7388. ep = &ipa3_ctx->ep[ipa_ep_idx];
  7389. if (!ep->valid)
  7390. return 0;
  7391. coal_ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS);
  7392. IPADBG("%s pipe %d\n", suspend ? "suspend" : "unsuspend", ipa_ep_idx);
  7393. /*
  7394. * Configure the callback mode only one time after starting the channel
  7395. * otherwise observing IEOB interrupt received before configure callmode
  7396. * second time. It was leading race condition in updating current
  7397. * polling state.
  7398. */
  7399. if (suspend) {
  7400. res = __ipa3_stop_gsi_channel(ipa_ep_idx);
  7401. if (res) {
  7402. IPAERR("failed to stop LAN channel\n");
  7403. ipa_assert();
  7404. }
  7405. } else {
  7406. res = gsi_start_channel(ep->gsi_chan_hdl);
  7407. if (res) {
  7408. IPAERR("failed to start LAN channel\n");
  7409. ipa_assert();
  7410. }
  7411. }
  7412. /* Apps prod pipes use common event ring so cannot configure mode*/
  7413. /*
  7414. * Skipping to configure mode for default wan pipe,
  7415. * as both pipes using commong event ring. if both pipes
  7416. * configure same event ring observing race condition in
  7417. * updating current polling state.
  7418. */
  7419. if (IPA_CLIENT_IS_APPS_PROD(client) ||
  7420. (client == IPA_CLIENT_APPS_WAN_CONS &&
  7421. coal_ep_idx != IPA_EP_NOT_ALLOCATED))
  7422. return 0;
  7423. if (suspend) {
  7424. IPADBG("switch ch %ld to poll\n", ep->gsi_chan_hdl);
  7425. gsi_config_channel_mode(ep->gsi_chan_hdl, GSI_CHAN_MODE_POLL);
  7426. if (!ipa3_gsi_channel_is_quite(ep))
  7427. return -EAGAIN;
  7428. } else if (!atomic_read(&ep->sys->curr_polling_state)) {
  7429. IPADBG("switch ch %ld to callback\n", ep->gsi_chan_hdl);
  7430. gsi_config_channel_mode(ep->gsi_chan_hdl,
  7431. GSI_CHAN_MODE_CALLBACK);
  7432. }
  7433. return 0;
  7434. }
  7435. void ipa3_force_close_coal(void)
  7436. {
  7437. struct ipa3_desc desc;
  7438. int ep_idx;
  7439. ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS);
  7440. if (ep_idx == IPA_EP_NOT_ALLOCATED || (!ipa3_ctx->ep[ep_idx].valid))
  7441. return;
  7442. ipa3_init_imm_cmd_desc(&desc, ipa3_ctx->coal_cmd_pyld);
  7443. IPADBG("Sending 1 descriptor for coal force close\n");
  7444. if (ipa3_send_cmd(1, &desc))
  7445. IPADBG("ipa3_send_cmd timedout\n");
  7446. }
  7447. int ipa3_suspend_apps_pipes(bool suspend)
  7448. {
  7449. int res;
  7450. /* As per HPG first need start/stop coalescing channel
  7451. * then default one. Coalescing client number was greater then
  7452. * default one so starting the last client.
  7453. */
  7454. res = _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_COAL_CONS, suspend);
  7455. if (res == -EAGAIN)
  7456. goto undo_coal_cons;
  7457. res = _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_CONS, suspend);
  7458. if (res == -EAGAIN)
  7459. goto undo_wan_cons;
  7460. res = _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_LAN_CONS, suspend);
  7461. if (res == -EAGAIN)
  7462. goto undo_lan_cons;
  7463. res = _ipa_suspend_resume_pipe(IPA_CLIENT_ODL_DPL_CONS, suspend);
  7464. if (res == -EAGAIN)
  7465. goto undo_odl_cons;
  7466. if (suspend) {
  7467. struct ipahal_reg_tx_wrapper tx;
  7468. int ep_idx;
  7469. ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS);
  7470. if (ep_idx == IPA_EP_NOT_ALLOCATED ||
  7471. (!ipa3_ctx->ep[ep_idx].valid))
  7472. goto do_prod;
  7473. ipahal_read_reg_fields(IPA_STATE_TX_WRAPPER, &tx);
  7474. if (tx.coal_slave_open_frame != 0) {
  7475. IPADBG("COAL frame is open 0x%x\n",
  7476. tx.coal_slave_open_frame);
  7477. res = -EAGAIN;
  7478. goto undo_odl_cons;
  7479. }
  7480. usleep_range(IPA_TAG_SLEEP_MIN_USEC, IPA_TAG_SLEEP_MAX_USEC);
  7481. res = ipahal_read_reg_n(IPA_SUSPEND_IRQ_INFO_EE_n,
  7482. ipa3_ctx->ee);
  7483. if (res) {
  7484. IPADBG("suspend irq is pending 0x%x\n", res);
  7485. goto undo_odl_cons;
  7486. }
  7487. }
  7488. do_prod:
  7489. res = _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_LAN_PROD, suspend);
  7490. if (res == -EAGAIN)
  7491. goto undo_lan_prod;
  7492. res = _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_PROD, suspend);
  7493. if (res == -EAGAIN)
  7494. goto undo_wan_prod;
  7495. return 0;
  7496. undo_wan_prod:
  7497. _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_PROD, !suspend);
  7498. undo_lan_prod:
  7499. _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_LAN_PROD, !suspend);
  7500. undo_odl_cons:
  7501. _ipa_suspend_resume_pipe(IPA_CLIENT_ODL_DPL_CONS, !suspend);
  7502. undo_lan_cons:
  7503. _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_LAN_CONS, !suspend);
  7504. undo_wan_cons:
  7505. _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_COAL_CONS, !suspend);
  7506. _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_CONS, !suspend);
  7507. return res;
  7508. undo_coal_cons:
  7509. _ipa_suspend_resume_pipe(IPA_CLIENT_APPS_WAN_COAL_CONS, !suspend);
  7510. return res;
  7511. }
  7512. int ipa3_allocate_dma_task_for_gsi(void)
  7513. {
  7514. struct ipahal_imm_cmd_dma_task_32b_addr cmd = { 0 };
  7515. IPADBG("Allocate mem\n");
  7516. ipa3_ctx->dma_task_info.mem.size = IPA_GSI_CHANNEL_STOP_PKT_SIZE;
  7517. ipa3_ctx->dma_task_info.mem.base = dma_alloc_coherent(ipa3_ctx->pdev,
  7518. ipa3_ctx->dma_task_info.mem.size,
  7519. &ipa3_ctx->dma_task_info.mem.phys_base,
  7520. GFP_KERNEL);
  7521. if (!ipa3_ctx->dma_task_info.mem.base) {
  7522. IPAERR("no mem\n");
  7523. return -EFAULT;
  7524. }
  7525. cmd.flsh = true;
  7526. cmd.size1 = ipa3_ctx->dma_task_info.mem.size;
  7527. cmd.addr1 = ipa3_ctx->dma_task_info.mem.phys_base;
  7528. cmd.packet_size = ipa3_ctx->dma_task_info.mem.size;
  7529. ipa3_ctx->dma_task_info.cmd_pyld = ipahal_construct_imm_cmd(
  7530. IPA_IMM_CMD_DMA_TASK_32B_ADDR, &cmd, false);
  7531. if (!ipa3_ctx->dma_task_info.cmd_pyld) {
  7532. IPAERR("failed to construct dma_task_32b_addr cmd\n");
  7533. dma_free_coherent(ipa3_ctx->pdev,
  7534. ipa3_ctx->dma_task_info.mem.size,
  7535. ipa3_ctx->dma_task_info.mem.base,
  7536. ipa3_ctx->dma_task_info.mem.phys_base);
  7537. memset(&ipa3_ctx->dma_task_info, 0,
  7538. sizeof(ipa3_ctx->dma_task_info));
  7539. return -EFAULT;
  7540. }
  7541. return 0;
  7542. }
  7543. void ipa3_free_dma_task_for_gsi(void)
  7544. {
  7545. dma_free_coherent(ipa3_ctx->pdev,
  7546. ipa3_ctx->dma_task_info.mem.size,
  7547. ipa3_ctx->dma_task_info.mem.base,
  7548. ipa3_ctx->dma_task_info.mem.phys_base);
  7549. ipahal_destroy_imm_cmd(ipa3_ctx->dma_task_info.cmd_pyld);
  7550. memset(&ipa3_ctx->dma_task_info, 0, sizeof(ipa3_ctx->dma_task_info));
  7551. }
  7552. int ipa3_allocate_coal_close_frame(void)
  7553. {
  7554. struct ipahal_imm_cmd_register_write reg_write_cmd = { 0 };
  7555. struct ipahal_reg_valmask valmask;
  7556. int ep_idx;
  7557. ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS);
  7558. if (ep_idx == IPA_EP_NOT_ALLOCATED)
  7559. return 0;
  7560. IPADBG("Allocate coal close frame cmd\n");
  7561. reg_write_cmd.skip_pipeline_clear = false;
  7562. reg_write_cmd.pipeline_clear_options = IPAHAL_HPS_CLEAR;
  7563. reg_write_cmd.offset = ipahal_get_reg_ofst(IPA_AGGR_FORCE_CLOSE);
  7564. ipahal_get_aggr_force_close_valmask(ep_idx, &valmask);
  7565. reg_write_cmd.value = valmask.val;
  7566. reg_write_cmd.value_mask = valmask.mask;
  7567. ipa3_ctx->coal_cmd_pyld =
  7568. ipahal_construct_imm_cmd(IPA_IMM_CMD_REGISTER_WRITE,
  7569. &reg_write_cmd, false);
  7570. if (!ipa3_ctx->coal_cmd_pyld) {
  7571. IPAERR("fail construct register_write imm cmd\n");
  7572. ipa_assert();
  7573. return 0;
  7574. }
  7575. return 0;
  7576. }
  7577. void ipa3_free_coal_close_frame(void)
  7578. {
  7579. if (ipa3_ctx->coal_cmd_pyld)
  7580. ipahal_destroy_imm_cmd(ipa3_ctx->coal_cmd_pyld);
  7581. }
  7582. /**
  7583. * ipa3_inject_dma_task_for_gsi()- Send DMA_TASK to IPA for GSI stop channel
  7584. *
  7585. * Send a DMA_TASK of 1B to IPA to unblock GSI channel in STOP_IN_PROG.
  7586. * Return value: 0 on success, negative otherwise
  7587. */
  7588. int ipa3_inject_dma_task_for_gsi(void)
  7589. {
  7590. struct ipa3_desc desc;
  7591. ipa3_init_imm_cmd_desc(&desc, ipa3_ctx->dma_task_info.cmd_pyld);
  7592. IPADBG("sending 1B packet to IPA\n");
  7593. if (ipa3_send_cmd_timeout(1, &desc,
  7594. IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC)) {
  7595. IPAERR("ipa3_send_cmd failed\n");
  7596. return -EFAULT;
  7597. }
  7598. return 0;
  7599. }
  7600. static int ipa3_load_single_fw(const struct firmware *firmware,
  7601. const struct elf32_phdr *phdr)
  7602. {
  7603. uint32_t *fw_mem_base;
  7604. int index;
  7605. const uint32_t *elf_data_ptr;
  7606. if (phdr->p_offset > firmware->size) {
  7607. IPAERR("Invalid ELF: offset=%u is beyond elf_size=%zu\n",
  7608. phdr->p_offset, firmware->size);
  7609. return -EINVAL;
  7610. }
  7611. if ((firmware->size - phdr->p_offset) < phdr->p_filesz) {
  7612. IPAERR("Invalid ELF: offset=%u filesz=%u elf_size=%zu\n",
  7613. phdr->p_offset, phdr->p_filesz, firmware->size);
  7614. return -EINVAL;
  7615. }
  7616. if (phdr->p_memsz % sizeof(uint32_t)) {
  7617. IPAERR("FW mem size %u doesn't align to 32bit\n",
  7618. phdr->p_memsz);
  7619. return -EFAULT;
  7620. }
  7621. if (phdr->p_filesz > phdr->p_memsz) {
  7622. IPAERR("FW image too big src_size=%u dst_size=%u\n",
  7623. phdr->p_filesz, phdr->p_memsz);
  7624. return -EFAULT;
  7625. }
  7626. fw_mem_base = ioremap(phdr->p_vaddr, phdr->p_memsz);
  7627. if (!fw_mem_base) {
  7628. IPAERR("Failed to map 0x%x for the size of %u\n",
  7629. phdr->p_vaddr, phdr->p_memsz);
  7630. return -ENOMEM;
  7631. }
  7632. /* Set the entire region to 0s */
  7633. memset(fw_mem_base, 0, phdr->p_memsz);
  7634. elf_data_ptr = (uint32_t *)(firmware->data + phdr->p_offset);
  7635. /* Write the FW */
  7636. for (index = 0; index < phdr->p_filesz/sizeof(uint32_t); index++) {
  7637. writel_relaxed(*elf_data_ptr, &fw_mem_base[index]);
  7638. elf_data_ptr++;
  7639. }
  7640. iounmap(fw_mem_base);
  7641. return 0;
  7642. }
  7643. struct ipa3_hps_dps_areas_info {
  7644. u32 dps_abs_addr;
  7645. u32 dps_sz;
  7646. u32 hps_abs_addr;
  7647. u32 hps_sz;
  7648. };
  7649. static void ipa3_get_hps_dps_areas_absolute_addr_and_sz(
  7650. struct ipa3_hps_dps_areas_info *info)
  7651. {
  7652. u32 dps_area_start;
  7653. u32 dps_area_end;
  7654. u32 hps_area_start;
  7655. u32 hps_area_end;
  7656. if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) {
  7657. dps_area_start = ipahal_get_reg_ofst(IPA_DPS_SEQUENCER_FIRST);
  7658. dps_area_end = ipahal_get_reg_ofst(IPA_DPS_SEQUENCER_LAST);
  7659. hps_area_start = ipahal_get_reg_ofst(IPA_HPS_SEQUENCER_FIRST);
  7660. hps_area_end = ipahal_get_reg_ofst(IPA_HPS_SEQUENCER_LAST);
  7661. info->dps_abs_addr = ipa3_ctx->ipa_wrapper_base +
  7662. ipahal_get_reg_base() + dps_area_start;
  7663. info->hps_abs_addr = ipa3_ctx->ipa_wrapper_base +
  7664. ipahal_get_reg_base() + hps_area_start;
  7665. } else {
  7666. dps_area_start = ipahal_read_reg(IPA_DPS_SEQUENCER_FIRST);
  7667. dps_area_end = ipahal_read_reg(IPA_DPS_SEQUENCER_LAST);
  7668. hps_area_start = ipahal_read_reg(IPA_HPS_SEQUENCER_FIRST);
  7669. hps_area_end = ipahal_read_reg(IPA_HPS_SEQUENCER_LAST);
  7670. info->dps_abs_addr = ipa3_ctx->ipa_wrapper_base +
  7671. dps_area_start;
  7672. info->hps_abs_addr = ipa3_ctx->ipa_wrapper_base +
  7673. hps_area_start;
  7674. }
  7675. info->dps_sz = dps_area_end - dps_area_start + sizeof(u32);
  7676. info->hps_sz = hps_area_end - hps_area_start + sizeof(u32);
  7677. IPADBG("dps area: start offset=0x%x end offset=0x%x\n",
  7678. dps_area_start, dps_area_end);
  7679. IPADBG("hps area: start offset=0x%x end offset=0x%x\n",
  7680. hps_area_start, hps_area_end);
  7681. }
  7682. /**
  7683. * emulator_load_single_fw() - load firmware into emulator's memory
  7684. *
  7685. * @firmware: Structure which contains the FW data from the user space.
  7686. * @phdr: ELF program header
  7687. * @loc_to_map: physical location to map into virtual space
  7688. * @size_to_map: the size of memory to map into virtual space
  7689. *
  7690. * Return value: 0 on success, negative otherwise
  7691. */
  7692. static int emulator_load_single_fw(
  7693. const struct firmware *firmware,
  7694. const struct elf32_phdr *phdr,
  7695. u32 loc_to_map,
  7696. u32 size_to_map)
  7697. {
  7698. int index;
  7699. uint32_t ofb;
  7700. const uint32_t *elf_data_ptr;
  7701. void __iomem *fw_base;
  7702. IPADBG("firmware(%pK) phdr(%pK) loc_to_map(0x%X) size_to_map(%u)\n",
  7703. firmware, phdr, loc_to_map, size_to_map);
  7704. if (phdr->p_offset > firmware->size) {
  7705. IPAERR("Invalid ELF: offset=%u is beyond elf_size=%zu\n",
  7706. phdr->p_offset, firmware->size);
  7707. return -EINVAL;
  7708. }
  7709. if ((firmware->size - phdr->p_offset) < phdr->p_filesz) {
  7710. IPAERR("Invalid ELF: offset=%u filesz=%u elf_size=%zu\n",
  7711. phdr->p_offset, phdr->p_filesz, firmware->size);
  7712. return -EINVAL;
  7713. }
  7714. if (phdr->p_memsz % sizeof(uint32_t)) {
  7715. IPAERR("FW mem size %u doesn't align to 32bit\n",
  7716. phdr->p_memsz);
  7717. return -EFAULT;
  7718. }
  7719. if (phdr->p_filesz > phdr->p_memsz) {
  7720. IPAERR("FW image too big src_size=%u dst_size=%u\n",
  7721. phdr->p_filesz, phdr->p_memsz);
  7722. return -EFAULT;
  7723. }
  7724. IPADBG("ELF: p_memsz(0x%x) p_filesz(0x%x) p_filesz/4(0x%x)\n",
  7725. (uint32_t) phdr->p_memsz,
  7726. (uint32_t) phdr->p_filesz,
  7727. (uint32_t) (phdr->p_filesz/sizeof(uint32_t)));
  7728. fw_base = ioremap(loc_to_map, size_to_map);
  7729. if (!fw_base) {
  7730. IPAERR("Failed to map 0x%X for the size of %u\n",
  7731. loc_to_map, size_to_map);
  7732. return -ENOMEM;
  7733. }
  7734. IPADBG("Physical base(0x%X) mapped to virtual (%pK) with len (%u)\n",
  7735. loc_to_map,
  7736. fw_base,
  7737. size_to_map);
  7738. /* Set the entire region to 0s */
  7739. ofb = 0;
  7740. for (index = 0; index < phdr->p_memsz/sizeof(uint32_t); index++) {
  7741. writel_relaxed(0, fw_base + ofb);
  7742. ofb += sizeof(uint32_t);
  7743. }
  7744. elf_data_ptr = (uint32_t *)(firmware->data + phdr->p_offset);
  7745. /* Write the FW */
  7746. ofb = 0;
  7747. for (index = 0; index < phdr->p_filesz/sizeof(uint32_t); index++) {
  7748. writel_relaxed(*elf_data_ptr, fw_base + ofb);
  7749. elf_data_ptr++;
  7750. ofb += sizeof(uint32_t);
  7751. }
  7752. iounmap(fw_base);
  7753. return 0;
  7754. }
  7755. /**
  7756. * ipa3_load_fws() - Load the IPAv3 FWs into IPA&GSI SRAM.
  7757. *
  7758. * @firmware: Structure which contains the FW data from the user space.
  7759. * @gsi_mem_base: GSI base address
  7760. * @gsi_ver: GSI Version
  7761. *
  7762. * Return value: 0 on success, negative otherwise
  7763. *
  7764. */
  7765. int ipa3_load_fws(const struct firmware *firmware, phys_addr_t gsi_mem_base,
  7766. enum gsi_ver gsi_ver)
  7767. {
  7768. const struct elf32_hdr *ehdr;
  7769. const struct elf32_phdr *phdr;
  7770. unsigned long gsi_iram_ofst;
  7771. unsigned long gsi_iram_size;
  7772. int rc;
  7773. struct ipa3_hps_dps_areas_info dps_hps_info;
  7774. if (gsi_ver == GSI_VER_ERR) {
  7775. IPAERR("Invalid GSI Version\n");
  7776. return -EINVAL;
  7777. }
  7778. if (!gsi_mem_base) {
  7779. IPAERR("Invalid GSI base address\n");
  7780. return -EINVAL;
  7781. }
  7782. ipa_assert_on(!firmware);
  7783. /* One program header per FW image: GSI, DPS and HPS */
  7784. if (firmware->size < (sizeof(*ehdr) + 3 * sizeof(*phdr))) {
  7785. IPAERR("Missing ELF and Program headers firmware size=%zu\n",
  7786. firmware->size);
  7787. return -EINVAL;
  7788. }
  7789. ehdr = (struct elf32_hdr *) firmware->data;
  7790. ipa_assert_on(!ehdr);
  7791. if (ehdr->e_phnum != 3) {
  7792. IPAERR("Unexpected number of ELF program headers\n");
  7793. return -EINVAL;
  7794. }
  7795. phdr = (struct elf32_phdr *)(firmware->data + sizeof(*ehdr));
  7796. /*
  7797. * Each ELF program header represents a FW image and contains:
  7798. * p_vaddr : The starting address to which the FW needs to loaded.
  7799. * p_memsz : The size of the IRAM (where the image loaded)
  7800. * p_filesz: The size of the FW image embedded inside the ELF
  7801. * p_offset: Absolute offset to the image from the head of the ELF
  7802. */
  7803. /* Load GSI FW image */
  7804. gsi_get_inst_ram_offset_and_size(&gsi_iram_ofst, &gsi_iram_size,
  7805. gsi_ver);
  7806. if (phdr->p_vaddr != (gsi_mem_base + gsi_iram_ofst)) {
  7807. IPAERR(
  7808. "Invalid GSI FW img load addr vaddr=0x%x gsi_mem_base=%pa gsi_iram_ofst=0x%lx\n"
  7809. , phdr->p_vaddr, &gsi_mem_base, gsi_iram_ofst);
  7810. return -EINVAL;
  7811. }
  7812. if (phdr->p_memsz > gsi_iram_size) {
  7813. IPAERR("Invalid GSI FW img size memsz=%d gsi_iram_size=%lu\n",
  7814. phdr->p_memsz, gsi_iram_size);
  7815. return -EINVAL;
  7816. }
  7817. rc = ipa3_load_single_fw(firmware, phdr);
  7818. if (rc)
  7819. return rc;
  7820. phdr++;
  7821. ipa3_get_hps_dps_areas_absolute_addr_and_sz(&dps_hps_info);
  7822. /* Load IPA DPS FW image */
  7823. if (phdr->p_vaddr != dps_hps_info.dps_abs_addr) {
  7824. IPAERR(
  7825. "Invalid IPA DPS img load addr vaddr=0x%x dps_abs_addr=0x%x\n"
  7826. , phdr->p_vaddr, dps_hps_info.dps_abs_addr);
  7827. return -EINVAL;
  7828. }
  7829. if (phdr->p_memsz > dps_hps_info.dps_sz) {
  7830. IPAERR("Invalid IPA DPS img size memsz=%d dps_area_size=%u\n",
  7831. phdr->p_memsz, dps_hps_info.dps_sz);
  7832. return -EINVAL;
  7833. }
  7834. rc = ipa3_load_single_fw(firmware, phdr);
  7835. if (rc)
  7836. return rc;
  7837. phdr++;
  7838. /* Load IPA HPS FW image */
  7839. if (phdr->p_vaddr != dps_hps_info.hps_abs_addr) {
  7840. IPAERR(
  7841. "Invalid IPA HPS img load addr vaddr=0x%x hps_abs_addr=0x%x\n"
  7842. , phdr->p_vaddr, dps_hps_info.hps_abs_addr);
  7843. return -EINVAL;
  7844. }
  7845. if (phdr->p_memsz > dps_hps_info.hps_sz) {
  7846. IPAERR("Invalid IPA HPS img size memsz=%d hps_area_size=%u\n",
  7847. phdr->p_memsz, dps_hps_info.hps_sz);
  7848. return -EINVAL;
  7849. }
  7850. rc = ipa3_load_single_fw(firmware, phdr);
  7851. if (rc)
  7852. return rc;
  7853. IPADBG("IPA FWs (GSI FW, DPS and HPS) loaded successfully\n");
  7854. return 0;
  7855. }
  7856. /*
  7857. * The following needed for the EMULATION system. On a non-emulation
  7858. * system (ie. the real UE), this functionality is done in the
  7859. * TZ...
  7860. */
  7861. static void ipa_gsi_setup_reg(void)
  7862. {
  7863. u32 reg_val, start;
  7864. int i;
  7865. const struct ipa_gsi_ep_config *gsi_ep_info_cfg;
  7866. enum ipa_client_type type;
  7867. IPADBG("Setting up registers in preparation for firmware download\n");
  7868. /* setup IPA_ENDP_GSI_CFG_TLV_n reg */
  7869. start = 0;
  7870. ipa3_ctx->ipa_num_pipes = ipa3_get_num_pipes();
  7871. IPADBG("ipa_num_pipes=%u\n", ipa3_ctx->ipa_num_pipes);
  7872. for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
  7873. type = ipa3_get_client_by_pipe(i);
  7874. gsi_ep_info_cfg = ipa3_get_gsi_ep_info(type);
  7875. IPAERR("for ep %d client is %d gsi_ep_info_cfg=%pK\n",
  7876. i, type, gsi_ep_info_cfg);
  7877. if (!gsi_ep_info_cfg)
  7878. continue;
  7879. reg_val = ((gsi_ep_info_cfg->ipa_if_tlv << 16) & 0x00FF0000);
  7880. reg_val += (start & 0xFFFF);
  7881. start += gsi_ep_info_cfg->ipa_if_tlv;
  7882. ipahal_write_reg_n(IPA_ENDP_GSI_CFG_TLV_n, i, reg_val);
  7883. }
  7884. /* setup IPA_ENDP_GSI_CFG_AOS_n reg */
  7885. for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
  7886. type = ipa3_get_client_by_pipe(i);
  7887. gsi_ep_info_cfg = ipa3_get_gsi_ep_info(type);
  7888. if (!gsi_ep_info_cfg)
  7889. continue;
  7890. reg_val = ((gsi_ep_info_cfg->ipa_if_aos << 16) & 0x00FF0000);
  7891. reg_val += (start & 0xFFFF);
  7892. start += gsi_ep_info_cfg->ipa_if_aos;
  7893. ipahal_write_reg_n(IPA_ENDP_GSI_CFG_AOS_n, i, reg_val);
  7894. }
  7895. /* setup GSI_MAP_EE_n_CH_k_VP_TABLE reg */
  7896. for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
  7897. type = ipa3_get_client_by_pipe(i);
  7898. gsi_ep_info_cfg = ipa3_get_gsi_ep_info(type);
  7899. if (!gsi_ep_info_cfg)
  7900. continue;
  7901. reg_val = i & 0x1F;
  7902. gsi_map_virtual_ch_to_per_ep(
  7903. gsi_ep_info_cfg->ee,
  7904. gsi_ep_info_cfg->ipa_gsi_chan_num,
  7905. reg_val);
  7906. }
  7907. /* setup IPA_ENDP_GSI_CFG1_n reg */
  7908. for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
  7909. type = ipa3_get_client_by_pipe(i);
  7910. gsi_ep_info_cfg = ipa3_get_gsi_ep_info(type);
  7911. if (!gsi_ep_info_cfg)
  7912. continue;
  7913. reg_val = (1 << 31) + (1 << 16);
  7914. ipahal_write_reg_n(IPA_ENDP_GSI_CFG1_n, i, 1<<16);
  7915. ipahal_write_reg_n(IPA_ENDP_GSI_CFG1_n, i, reg_val);
  7916. ipahal_write_reg_n(IPA_ENDP_GSI_CFG1_n, i, 1<<16);
  7917. }
  7918. }
  7919. /**
  7920. * emulator_load_fws() - Load the IPAv3 FWs into IPA&GSI SRAM.
  7921. *
  7922. * @firmware: Structure which contains the FW data from the user space.
  7923. * @transport_mem_base: Where to load
  7924. * @transport_mem_size: Space available to load into
  7925. * @gsi_ver: Version of the gsi
  7926. *
  7927. * Return value: 0 on success, negative otherwise
  7928. */
  7929. int emulator_load_fws(
  7930. const struct firmware *firmware,
  7931. u32 transport_mem_base,
  7932. u32 transport_mem_size,
  7933. enum gsi_ver gsi_ver)
  7934. {
  7935. const struct elf32_hdr *ehdr;
  7936. const struct elf32_phdr *phdr;
  7937. unsigned long gsi_offset, gsi_ram_size;
  7938. struct ipa3_hps_dps_areas_info dps_hps_info;
  7939. int rc;
  7940. IPADBG("Loading firmware(%pK)\n", firmware);
  7941. if (!firmware) {
  7942. IPAERR("firmware pointer passed to function is NULL\n");
  7943. return -EINVAL;
  7944. }
  7945. /* One program header per FW image: GSI, DPS and HPS */
  7946. if (firmware->size < (sizeof(*ehdr) + 3 * sizeof(*phdr))) {
  7947. IPAERR(
  7948. "Missing ELF and Program headers firmware size=%zu\n",
  7949. firmware->size);
  7950. return -EINVAL;
  7951. }
  7952. ehdr = (struct elf32_hdr *) firmware->data;
  7953. ipa_assert_on(!ehdr);
  7954. if (ehdr->e_phnum != 3) {
  7955. IPAERR("Unexpected number of ELF program headers\n");
  7956. return -EINVAL;
  7957. }
  7958. ipa3_get_hps_dps_areas_absolute_addr_and_sz(&dps_hps_info);
  7959. /*
  7960. * Each ELF program header represents a FW image and contains:
  7961. * p_vaddr : The starting address to which the FW needs to loaded.
  7962. * p_memsz : The size of the IRAM (where the image loaded)
  7963. * p_filesz: The size of the FW image embedded inside the ELF
  7964. * p_offset: Absolute offset to the image from the head of the ELF
  7965. *
  7966. * NOTE WELL: On the emulation platform, the p_vaddr address
  7967. * is not relevant and is unused. This is because
  7968. * on the emulation platform, the registers'
  7969. * address location is mutable, since it's mapped
  7970. * in via a PCIe probe. Given this, it is the
  7971. * mapped address info that's used while p_vaddr is
  7972. * ignored.
  7973. */
  7974. phdr = (struct elf32_phdr *)(firmware->data + sizeof(*ehdr));
  7975. phdr += 2;
  7976. /*
  7977. * Attempt to load IPA HPS FW image
  7978. */
  7979. if (phdr->p_memsz > dps_hps_info.hps_sz) {
  7980. IPAERR("Invalid IPA HPS img size memsz=%d hps_size=%u\n",
  7981. phdr->p_memsz, dps_hps_info.hps_sz);
  7982. return -EINVAL;
  7983. }
  7984. IPADBG("Loading HPS FW\n");
  7985. rc = emulator_load_single_fw(
  7986. firmware, phdr,
  7987. dps_hps_info.hps_abs_addr, dps_hps_info.hps_sz);
  7988. if (rc)
  7989. return rc;
  7990. IPADBG("Loading HPS FW complete\n");
  7991. --phdr;
  7992. /*
  7993. * Attempt to load IPA DPS FW image
  7994. */
  7995. if (phdr->p_memsz > dps_hps_info.dps_sz) {
  7996. IPAERR("Invalid IPA DPS img size memsz=%d dps_size=%u\n",
  7997. phdr->p_memsz, dps_hps_info.dps_sz);
  7998. return -EINVAL;
  7999. }
  8000. IPADBG("Loading DPS FW\n");
  8001. rc = emulator_load_single_fw(
  8002. firmware, phdr,
  8003. dps_hps_info.dps_abs_addr, dps_hps_info.dps_sz);
  8004. if (rc)
  8005. return rc;
  8006. IPADBG("Loading DPS FW complete\n");
  8007. /*
  8008. * Run gsi register setup which is normally done in TZ on
  8009. * non-EMULATION systems...
  8010. */
  8011. ipa_gsi_setup_reg();
  8012. --phdr;
  8013. gsi_get_inst_ram_offset_and_size(&gsi_offset, &gsi_ram_size, gsi_ver);
  8014. /*
  8015. * Attempt to load GSI FW image
  8016. */
  8017. if (phdr->p_memsz > gsi_ram_size) {
  8018. IPAERR(
  8019. "Invalid GSI FW img size memsz=%d gsi_ram_size=%lu\n",
  8020. phdr->p_memsz, gsi_ram_size);
  8021. return -EINVAL;
  8022. }
  8023. IPADBG("Loading GSI FW\n");
  8024. rc = emulator_load_single_fw(
  8025. firmware, phdr,
  8026. transport_mem_base + (u32) gsi_offset, gsi_ram_size);
  8027. if (rc)
  8028. return rc;
  8029. IPADBG("Loading GSI FW complete\n");
  8030. IPADBG("IPA FWs (GSI FW, DPS and HPS) loaded successfully\n");
  8031. return 0;
  8032. }
  8033. /**
  8034. * ipa3_is_apq() - indicate apq platform or not
  8035. *
  8036. * Return value: true if apq, false if not apq platform
  8037. *
  8038. */
  8039. bool ipa3_is_apq(void)
  8040. {
  8041. if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
  8042. return true;
  8043. else
  8044. return false;
  8045. }
  8046. /**
  8047. * ipa_get_fnr_info() - get fnr_info
  8048. *
  8049. * Return value: true if set, false if not set
  8050. *
  8051. */
  8052. bool ipa_get_fnr_info(struct ipacm_fnr_info *fnr_info)
  8053. {
  8054. bool res = false;
  8055. if (ipa3_ctx->fnr_info.valid) {
  8056. fnr_info->valid = ipa3_ctx->fnr_info.valid;
  8057. fnr_info->hw_counter_offset =
  8058. ipa3_ctx->fnr_info.hw_counter_offset;
  8059. fnr_info->sw_counter_offset =
  8060. ipa3_ctx->fnr_info.sw_counter_offset;
  8061. res = true;
  8062. } else {
  8063. IPAERR("fnr_info not valid!\n");
  8064. res = false;
  8065. }
  8066. return res;
  8067. }
  8068. /**
  8069. * ipa3_disable_prefetch() - disable\enable tx prefetch
  8070. *
  8071. * @client: the client which is related to the TX where prefetch will be
  8072. * disabled
  8073. *
  8074. * Return value: Non applicable
  8075. *
  8076. */
  8077. void ipa3_disable_prefetch(enum ipa_client_type client)
  8078. {
  8079. struct ipahal_reg_tx_cfg cfg;
  8080. u8 qmb;
  8081. qmb = ipa3_get_qmb_master_sel(client);
  8082. IPADBG("disabling prefetch for qmb %d\n", (int)qmb);
  8083. ipahal_read_reg_fields(IPA_TX_CFG, &cfg);
  8084. /* QMB0 (DDR) correlates with TX0, QMB1(PCIE) correlates with TX1 */
  8085. if (qmb == QMB_MASTER_SELECT_DDR)
  8086. cfg.tx0_prefetch_disable = true;
  8087. else
  8088. cfg.tx1_prefetch_disable = true;
  8089. ipahal_write_reg_fields(IPA_TX_CFG, &cfg);
  8090. }
  8091. /**
  8092. * ipa3_get_pdev() - return a pointer to IPA dev struct
  8093. *
  8094. * Return value: a pointer to IPA dev struct
  8095. *
  8096. */
  8097. struct device *ipa3_get_pdev(void)
  8098. {
  8099. if (!ipa3_ctx)
  8100. return NULL;
  8101. return ipa3_ctx->pdev;
  8102. }
  8103. /**
  8104. * ipa3_enable_dcd() - enable dynamic clock division on IPA
  8105. *
  8106. * Return value: Non applicable
  8107. *
  8108. */
  8109. void ipa3_enable_dcd(void)
  8110. {
  8111. struct ipahal_reg_idle_indication_cfg idle_indication_cfg;
  8112. /* recommended values for IPA 3.5 according to IPA HPG */
  8113. idle_indication_cfg.const_non_idle_enable = false;
  8114. idle_indication_cfg.enter_idle_debounce_thresh = 256;
  8115. ipahal_write_reg_fields(IPA_IDLE_INDICATION_CFG,
  8116. &idle_indication_cfg);
  8117. }
  8118. void ipa3_init_imm_cmd_desc(struct ipa3_desc *desc,
  8119. struct ipahal_imm_cmd_pyld *cmd_pyld)
  8120. {
  8121. memset(desc, 0, sizeof(*desc));
  8122. desc->opcode = cmd_pyld->opcode;
  8123. desc->pyld = cmd_pyld->data;
  8124. desc->len = cmd_pyld->len;
  8125. desc->type = IPA_IMM_CMD_DESC;
  8126. }
  8127. u32 ipa3_get_r_rev_version(void)
  8128. {
  8129. static u32 r_rev;
  8130. if (r_rev != 0)
  8131. return r_rev;
  8132. IPA_ACTIVE_CLIENTS_INC_SIMPLE();
  8133. r_rev = ipahal_read_reg(IPA_VERSION);
  8134. IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
  8135. return r_rev;
  8136. }
  8137. EXPORT_SYMBOL(ipa3_get_r_rev_version);
  8138. /**
  8139. * ipa3_ctx_get_type() - to get platform type, hw type
  8140. * and hw mode
  8141. *
  8142. * Return value: enumerated types of platform and ipa hw
  8143. *
  8144. */
  8145. int ipa3_ctx_get_type(enum ipa_type_mode type)
  8146. {
  8147. switch (type) {
  8148. case IPA_HW_TYPE:
  8149. return ipa3_ctx->ipa_hw_type;
  8150. case PLATFORM_TYPE:
  8151. return ipa3_ctx->platform_type;
  8152. case IPA3_HW_MODE:
  8153. return ipa3_ctx->ipa3_hw_mode;
  8154. default:
  8155. IPAERR("cannot read ipa3_ctx types\n");
  8156. return 0;
  8157. }
  8158. }
  8159. /**
  8160. * ipa3_get_gsi_stats() - Query gsi stats from uc
  8161. * @prot_id: IPA_HW_FEATURE_OFFLOAD protocol id
  8162. * @stats: [inout] stats blob from client populated by driver
  8163. *
  8164. * @note Cannot be called from atomic context
  8165. *
  8166. */
  8167. void ipa3_get_gsi_stats(int prot_id,
  8168. struct ipa_uc_dbg_ring_stats *stats)
  8169. {
  8170. switch (prot_id) {
  8171. case IPA_HW_PROTOCOL_AQC:
  8172. stats->num_ch = MAX_AQC_CHANNELS;
  8173. ipa3_get_aqc_gsi_stats(stats);
  8174. break;
  8175. case IPA_HW_PROTOCOL_11ad:
  8176. break;
  8177. case IPA_HW_PROTOCOL_WDI:
  8178. stats->num_ch = MAX_WDI2_CHANNELS;
  8179. ipa3_get_wdi_gsi_stats(stats);
  8180. break;
  8181. case IPA_HW_PROTOCOL_WDI3:
  8182. stats->num_ch = MAX_WDI3_CHANNELS;
  8183. ipa3_get_wdi3_gsi_stats(stats);
  8184. break;
  8185. case IPA_HW_PROTOCOL_ETH:
  8186. break;
  8187. case IPA_HW_PROTOCOL_MHIP:
  8188. stats->num_ch = MAX_MHIP_CHANNELS;
  8189. ipa3_get_mhip_gsi_stats(stats);
  8190. break;
  8191. case IPA_HW_PROTOCOL_USB:
  8192. stats->num_ch = MAX_USB_CHANNELS;
  8193. ipa3_get_usb_gsi_stats(stats);
  8194. break;
  8195. default:
  8196. IPAERR("unsupported HW feature %d\n", prot_id);
  8197. }
  8198. }
  8199. /**
  8200. * ipa3_ctx_get_flag() - to read some ipa3_ctx_flags
  8201. *
  8202. * Return value: true/false based on read value
  8203. *
  8204. */
  8205. bool ipa3_ctx_get_flag(enum ipa_flag flag)
  8206. {
  8207. switch (flag) {
  8208. case IPA_ENDP_DELAY_WA_EN:
  8209. return ipa3_ctx->ipa_endp_delay_wa;
  8210. case IPA_HW_STATS_EN:
  8211. return ipa3_ctx->hw_stats.enabled;
  8212. case IPA_MHI_EN:
  8213. return ipa3_ctx->ipa_config_is_mhi;
  8214. case IPA_FLTRT_NOT_HASHABLE_EN:
  8215. return ipa3_ctx->ipa_fltrt_not_hashable;
  8216. default:
  8217. IPAERR("cannot read ipa3_ctx flags\n");
  8218. return false;
  8219. }
  8220. }
  8221. /**
  8222. * ipa3_ctx_get_num_pipes() - to read pipe number from ipa3_ctx
  8223. *
  8224. * Return value: unsigned number
  8225. *
  8226. */
  8227. u32 ipa3_ctx_get_num_pipes(void)
  8228. {
  8229. return ipa3_ctx->ipa_num_pipes;
  8230. }
  8231. int ipa3_app_clk_vote(
  8232. enum ipa_app_clock_vote_type vote_type)
  8233. {
  8234. const char *str_ptr = "APP_VOTE";
  8235. int ret = 0;
  8236. IPADBG("In\n");
  8237. mutex_lock(&ipa3_ctx->app_clock_vote.mutex);
  8238. switch (vote_type) {
  8239. case IPA_APP_CLK_VOTE:
  8240. if ((ipa3_ctx->app_clock_vote.cnt + 1) <= IPA_APP_VOTE_MAX) {
  8241. ipa3_ctx->app_clock_vote.cnt++;
  8242. IPA_ACTIVE_CLIENTS_INC_SPECIAL(str_ptr);
  8243. } else {
  8244. IPAERR_RL("App vote count max hit\n");
  8245. ret = -EPERM;
  8246. break;
  8247. }
  8248. break;
  8249. case IPA_APP_CLK_DEVOTE:
  8250. if (ipa3_ctx->app_clock_vote.cnt) {
  8251. ipa3_ctx->app_clock_vote.cnt--;
  8252. IPA_ACTIVE_CLIENTS_DEC_SPECIAL(str_ptr);
  8253. }
  8254. break;
  8255. case IPA_APP_CLK_RESET_VOTE:
  8256. while (ipa3_ctx->app_clock_vote.cnt > 0) {
  8257. IPA_ACTIVE_CLIENTS_DEC_SPECIAL(str_ptr);
  8258. ipa3_ctx->app_clock_vote.cnt--;
  8259. }
  8260. break;
  8261. default:
  8262. IPAERR_RL("Unknown vote_type(%u)\n", vote_type);
  8263. ret = -EPERM;
  8264. break;
  8265. }
  8266. mutex_unlock(&ipa3_ctx->app_clock_vote.mutex);
  8267. IPADBG("Out\n");
  8268. return ret;
  8269. }
  8270. /*
  8271. * ipa3_get_prot_id() - Query gsi protocol id
  8272. * @client: ipa_client_type
  8273. *
  8274. * return the prot_id based on the client type,
  8275. * return -EINVAL when no such mapping exists.
  8276. */
  8277. int ipa3_get_prot_id(enum ipa_client_type client)
  8278. {
  8279. int prot_id = -EINVAL;
  8280. switch (client) {
  8281. case IPA_CLIENT_AQC_ETHERNET_CONS:
  8282. case IPA_CLIENT_AQC_ETHERNET_PROD:
  8283. prot_id = IPA_HW_PROTOCOL_AQC;
  8284. break;
  8285. case IPA_CLIENT_MHI_PRIME_TETH_PROD:
  8286. case IPA_CLIENT_MHI_PRIME_TETH_CONS:
  8287. case IPA_CLIENT_MHI_PRIME_RMNET_PROD:
  8288. case IPA_CLIENT_MHI_PRIME_RMNET_CONS:
  8289. prot_id = IPA_HW_PROTOCOL_MHIP;
  8290. break;
  8291. case IPA_CLIENT_WLAN1_PROD:
  8292. case IPA_CLIENT_WLAN1_CONS:
  8293. prot_id = IPA_HW_PROTOCOL_WDI;
  8294. break;
  8295. case IPA_CLIENT_WLAN2_PROD:
  8296. case IPA_CLIENT_WLAN2_CONS:
  8297. prot_id = IPA_HW_PROTOCOL_WDI3;
  8298. break;
  8299. case IPA_CLIENT_USB_PROD:
  8300. case IPA_CLIENT_USB_CONS:
  8301. prot_id = IPA_HW_PROTOCOL_USB;
  8302. break;
  8303. case IPA_CLIENT_ETHERNET_PROD:
  8304. case IPA_CLIENT_ETHERNET_CONS:
  8305. prot_id = IPA_HW_PROTOCOL_ETH;
  8306. break;
  8307. case IPA_CLIENT_WIGIG_PROD:
  8308. case IPA_CLIENT_WIGIG1_CONS:
  8309. case IPA_CLIENT_WIGIG2_CONS:
  8310. case IPA_CLIENT_WIGIG3_CONS:
  8311. case IPA_CLIENT_WIGIG4_CONS:
  8312. prot_id = IPA_HW_PROTOCOL_11ad;
  8313. break;
  8314. default:
  8315. IPAERR("unknown prot_id for client %d\n",
  8316. client);
  8317. }
  8318. return prot_id;
  8319. }