ipa_utils.c 249 KB

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