1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407
#ifndef DMUB_CMD_H
#define DMUB_CMD_H
#include <asm/byteorder.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/delay.h>
#include "atomfirmware.h"
#ifdef __forceinline
#undef __forceinline
#endif
#define __forceinline inline
#define SET_ABM_PIPE_GRADUALLY_DISABLE 0
#define SET_ABM_PIPE_IMMEDIATELY_DISABLE 255
#define SET_ABM_PIPE_IMMEDIATE_KEEP_GAIN_DISABLE 254
#define SET_ABM_PIPE_NORMAL 1
#define NUM_AMBI_LEVEL 5
#define NUM_AGGR_LEVEL 4
#define NUM_POWER_FN_SEGS 8
#define NUM_BL_CURVE_SEGS 16
#define ABM_MAX_NUM_OF_ACE_SEGMENTS 64
#define ABM_MAX_NUM_OF_HG_BINS 64
#define SET_CACP_PIPE_GRADUALLY_DISABLE 0
#define SET_CACP_PIPE_IMMEDIATELY_DISABLE 255
#define SET_CACP_PIPE_IMMEDIATE_KEEP_GAIN_DISABLE 254
#define SET_CACP_PIPE_IMMEDIATE_ON_NEXT_DISABLE 253
#define SET_CACP_PIPE_NORMAL 1
#define DMUB_MAX_SUBVP_STREAMS 2
#define DMUB_MAX_FPO_STREAMS 4
#define COMMON_STREAM_STATIC_SUB_STATE \
struct dmub_fams2_cmd_legacy_stream_static_state legacy; \
struct dmub_fams2_cmd_subvp_stream_static_state subvp; \
struct dmub_fams2_cmd_drr_stream_static_state drr;
#define DMUB_MAX_STREAMS 6
#define DMUB_MAX_PLANES 6
#define DMUB_MAX_PHANTOM_PLANES ((DMUB_MAX_PLANES) / 2)
#define TRACE_BUFFER_ENTRY_OFFSET 16
#define DMUB_MAX_DIRTY_RECTS 3
#define DMUB_CMD_PSR_CONTROL_VERSION_UNKNOWN 0x0
#define DMUB_CMD_PSR_CONTROL_VERSION_1 0x1
#define DMUB_CMD_DIRTY_RECTS_VERSION_UNKNOWN 0x0
#define DMUB_CMD_DIRTY_RECTS_VERSION_1 0x1
#define DMUB_CMD_DIRTY_RECTS_VERSION_2 0x2
#define DMUB_CMD_CURSOR_UPDATE_VERSION_UNKNOWN 0x0
#define DMUB_CMD_CURSOR_UPDATE_VERSION_1 0x1
#define DMUB_CMD_CURSOR_UPDATE_VERSION_2 0x2
#define DMUB_CMD_ABM_CONTROL_VERSION_UNKNOWN 0x0
#define DMUB_CMD_ABM_CONTROL_VERSION_1 0x1
#define DMUB_CMD_CACP_CONTROL_VERSION_UNKNOWN 0x0
#define DMUB_CMD_CACP_CONTROL_VERSION_1 0x1
#define DMUB_CMD_CACP_CONTROL_MODE_0 0x0
#define DMUB_CMD_CACP_CONTROL_MODE_1 0x1
#ifndef PHYSICAL_ADDRESS_LOC
#define PHYSICAL_ADDRESS_LOC union large_integer
#endif
#ifndef dmub_memcpy
#define dmub_memcpy(dest, source, bytes) ((void)memcpy((dest), (source), (bytes)))
#endif
#ifndef dmub_memset
#define dmub_memset(dest, val, bytes) ((void)memset((dest), (val), (bytes)))
#endif
#ifndef dmub_memcmp
#define dmub_memcmp(lhs, rhs, bytes) memcmp((lhs), (rhs), (bytes))
#endif
#ifndef dmub_udelay
#define dmub_udelay(microseconds) udelay(microseconds)
#endif
#pragma pack(push, 1)
#define ABM_NUM_OF_ACE_SEGMENTS 5
#define DMUB_DEBUG_FW_STATE_OFFSET 0x300
union abm_flags {
struct {
unsigned int abm_enabled : 1;
unsigned int disable_abm_requested : 1;
unsigned int disable_abm_immediately : 1;
unsigned int disable_abm_immediate_keep_gain : 1;
unsigned int fractional_pwm : 1;
unsigned int abm_gradual_bl_change : 1;
unsigned int abm_new_frame : 1;
unsigned int vb_scaling_enabled : 1;
} bitfields;
unsigned int u32All;
};
struct abm_save_restore {
union abm_flags flags;
uint32_t pause;
uint32_t next_ace_slope[ABM_NUM_OF_ACE_SEGMENTS];
uint32_t next_ace_thresh[ABM_NUM_OF_ACE_SEGMENTS];
uint32_t next_ace_offset[ABM_NUM_OF_ACE_SEGMENTS];
uint32_t knee_threshold;
uint32_t current_gain;
uint16_t curr_bl_level;
uint16_t curr_user_bl_level;
};
union dmub_addr {
struct {
uint32_t low_part;
uint32_t high_part;
} u;
uint64_t quad_part;
};
struct dmub_soc_bb_params {
uint32_t dram_clk_change_blackout_ns;
uint32_t dram_clk_change_read_only_ns;
uint32_t dram_clk_change_write_only_ns;
uint32_t fclk_change_blackout_ns;
uint32_t g7_ppt_blackout_ns;
uint32_t stutter_enter_plus_exit_latency_ns;
uint32_t stutter_exit_latency_ns;
uint32_t z8_stutter_enter_plus_exit_latency_ns;
uint32_t z8_stutter_exit_latency_ns;
uint32_t z8_min_idle_time_ns;
uint32_t type_b_dram_clk_change_blackout_ns;
uint32_t type_b_ppt_blackout_ns;
uint32_t vmin_limit_dispclk_khz;
uint32_t vmin_limit_dcfclk_khz;
uint32_t g7_temperature_read_blackout_ns;
};
#pragma pack(pop)
struct dmub_rect {
uint32_t x;
uint32_t y;
uint32_t width;
uint32_t height;
};
union dmub_psr_debug_flags {
struct {
uint32_t visual_confirm : 1;
uint32_t force_full_frame_update : 1;
uint32_t use_hw_lock_mgr : 1;
uint32_t force_wakeup_by_tps3 : 1;
uint32_t back_to_back_flip : 1;
uint32_t enable_ips_visual_confirm : 1;
} bitfields;
uint32_t u32All;
};
union replay_debug_flags {
struct {
uint32_t visual_confirm : 1;
uint32_t skip_crc : 1;
uint32_t force_link_power_on : 1;
uint32_t force_phy_power_on : 1;
uint32_t timing_resync_disabled : 1;
uint32_t skip_crtc_disabled : 1;
uint32_t force_defer_one_frame_update : 1;
uint32_t disable_delay_alpm_on : 1;
uint32_t disable_desync_error_check : 1;
uint32_t force_self_update_when_abm_non_steady : 1;
uint32_t enable_ips_visual_confirm : 1;
uint32_t enable_ips_residency_profiling : 1;
uint32_t enable_coasting_vtotal_check : 1;
uint32_t enable_visual_confirm_debug : 1;
uint32_t debug_log_enabled : 1;
uint32_t enable_sub_feature_visual_confirm : 1;
uint32_t enable_oem_visual_confirm : 1;
uint32_t reserved : 15;
} bitfields;
uint32_t u32All;
};
union replay_visual_confirm_error_state_flags {
struct {
uint32_t desync_error : 1;
uint32_t state_transition_error : 1;
uint32_t crc_error : 1;
uint32_t reserved_3 : 1;
uint32_t incorrect_vtotal_in_static_screen : 1;
uint32_t no_double_rr : 1;
uint32_t reserved_6_7 : 2;
uint32_t reserved_9_31 : 24;
} bitfields;
uint32_t u32All;
};
union replay_hw_flags {
struct {
uint32_t allow_alpm_fw_standby_mode : 1;
uint32_t dsc_enable_status : 1;
uint32_t fec_enable_status : 1;
uint32_t smu_optimizations_en : 1;
uint32_t phy_power_state : 1;
uint32_t link_power_state : 1;
uint32_t force_wakeup_by_tps3 : 1;
uint32_t is_alpm_initialized : 1;
uint32_t alpm_mode : 2;
} bitfields;
uint32_t u32All;
};
union pr_debug_flags {
struct {
uint32_t visual_confirm : 1;
uint32_t skip_crc : 1;
uint32_t force_link_power_on : 1;
uint32_t force_phy_power_on : 1;
uint32_t visual_confirm_rate_control : 1;
uint32_t force_full_frame_update : 1;
uint32_t force_dpg_on : 1;
uint32_t force_hubp_on : 1;
uint32_t enable_oem_visual_confirm : 1;
uint32_t reserved : 23;
} bitfields;
uint32_t u32All;
};
union pr_hw_flags {
struct {
uint32_t allow_alpm_fw_standby_mode : 1;
uint32_t dsc_enable_status : 1;
uint32_t fec_enable_status : 1;
uint32_t smu_optimizations_en : 1;
uint32_t link_power_state : 1;
uint32_t force_wakeup_by_tps3 : 1;
uint32_t is_alpm_initialized : 1;
uint32_t alpm_mode : 2;
uint32_t reserved : 23;
} bitfields;
uint32_t u32All;
};
enum pr_ml_activity_option {
OPTION_DEFAULT = 0x00,
OPTION_1A = 0x01,
OPTION_1B = 0x02,
OPTION_1C = 0x03,
};
union fw_assisted_mclk_switch_version {
struct {
uint8_t minor : 5;
uint8_t major : 3;
};
uint8_t ver;
};
struct dmub_feature_caps {
uint8_t psr;
uint8_t fw_assisted_mclk_switch_ver;
uint8_t reserved[4];
uint8_t subvp_psr_support;
uint8_t gecc_enable;
uint8_t replay_supported;
uint8_t replay_reserved[3];
uint8_t abm_aux_backlight_support;
uint8_t lsdma_support_in_dmu;
};
struct dmub_visual_confirm_color {
uint16_t color_r_cr;
uint16_t color_g_y;
uint16_t color_b_cb;
uint16_t panel_inst;
};
struct dmub_cursor_offload_pipe_data_dcn30_v1 {
uint32_t CURSOR0_0_CURSOR_SURFACE_ADDRESS;
uint32_t CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH;
uint32_t CURSOR0_0_CURSOR_SIZE__CURSOR_WIDTH : 16;
uint32_t CURSOR0_0_CURSOR_SIZE__CURSOR_HEIGHT : 16;
uint32_t CURSOR0_0_CURSOR_POSITION__CURSOR_X_POSITION : 16;
uint32_t CURSOR0_0_CURSOR_POSITION__CURSOR_Y_POSITION : 16;
uint32_t CURSOR0_0_CURSOR_HOT_SPOT__CURSOR_HOT_SPOT_X : 16;
uint32_t CURSOR0_0_CURSOR_HOT_SPOT__CURSOR_HOT_SPOT_Y : 16;
uint32_t CURSOR0_0_CURSOR_DST_OFFSET__CURSOR_DST_X_OFFSET : 13;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_ENABLE : 1;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_MODE : 3;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY : 1;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_PITCH : 2;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_LINES_PER_CHUNK : 5;
uint32_t reserved0[4];
uint32_t CNVC_CUR0_CURSOR0_CONTROL__CUR0_ENABLE : 1;
uint32_t CNVC_CUR0_CURSOR0_CONTROL__CUR0_MODE : 3;
uint32_t CNVC_CUR0_CURSOR0_CONTROL__CUR0_EXPANSION_MODE : 1;
uint32_t CNVC_CUR0_CURSOR0_CONTROL__CUR0_ROM_EN : 1;
uint32_t CNVC_CUR0_CURSOR0_COLOR0__CUR0_COLOR0 : 24;
uint32_t CNVC_CUR0_CURSOR0_COLOR1__CUR0_COLOR1 : 24;
uint32_t CNVC_CUR0_CURSOR0_FP_SCALE_BIAS__CUR0_FP_BIAS : 16;
uint32_t CNVC_CUR0_CURSOR0_FP_SCALE_BIAS__CUR0_FP_SCALE, : 16;
uint32_t reserved1[5];
uint32_t HUBPREQ0_CURSOR_SETTINGS__CURSOR0_DST_Y_OFFSET : 8;
uint32_t HUBPREQ0_CURSOR_SETTINGS__CURSOR0_CHUNK_HDL_ADJUST : 8;
uint32_t reserved2[3];
};
struct dmub_cursor_offload_pipe_data_dcn401_v1 {
uint32_t CURSOR0_0_CURSOR_SURFACE_ADDRESS;
uint32_t CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH;
uint32_t CURSOR0_0_CURSOR_SIZE__CURSOR_WIDTH : 16;
uint32_t CURSOR0_0_CURSOR_SIZE__CURSOR_HEIGHT : 16;
uint32_t CURSOR0_0_CURSOR_POSITION__CURSOR_X_POSITION : 16;
uint32_t CURSOR0_0_CURSOR_POSITION__CURSOR_Y_POSITION : 16;
uint32_t CURSOR0_0_CURSOR_HOT_SPOT__CURSOR_HOT_SPOT_X : 16;
uint32_t CURSOR0_0_CURSOR_HOT_SPOT__CURSOR_HOT_SPOT_Y : 16;
uint32_t CURSOR0_0_CURSOR_DST_OFFSET__CURSOR_DST_X_OFFSET : 13;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_ENABLE : 1;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_MODE : 3;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY : 1;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_PITCH : 2;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_LINES_PER_CHUNK : 5;
uint32_t reserved0[4];
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_ENABLE : 1;
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_MODE : 3;
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_EXPANSION_MODE : 1;
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_ROM_EN : 1;
uint32_t CM_CUR0_CURSOR0_COLOR0__CUR0_COLOR0 : 24;
uint32_t CM_CUR0_CURSOR0_COLOR1__CUR0_COLOR1 : 24;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_G_Y__CUR0_FP_BIAS_G_Y : 16;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_G_Y__CUR0_FP_SCALE_G_Y, : 16;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_RB_CRCB__CUR0_FP_BIAS_RB_CRCB : 16;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_RB_CRCB__CUR0_FP_SCALE_RB_CRCB : 16;
uint32_t reserved1[4];
uint32_t HUBPREQ0_CURSOR_SETTINGS__CURSOR0_DST_Y_OFFSET : 8;
uint32_t HUBPREQ0_CURSOR_SETTINGS__CURSOR0_CHUNK_HDL_ADJUST : 8;
uint32_t HUBP0_DCHUBP_MALL_CONFIG__USE_MALL_FOR_CURSOR : 1;
uint32_t reserved2[3];
};
struct dmub_cursor_offload_pipe_data_dcn60_v1 {
uint32_t CURSOR0_0_CURSOR_SURFACE_ADDRESS;
uint32_t CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH;
uint32_t CURSOR0_0_CURSOR_SIZE__CURSOR_WIDTH : 16;
uint32_t CURSOR0_0_CURSOR_SIZE__CURSOR_HEIGHT : 16;
uint32_t CURSOR0_0_CURSOR_POSITION__CURSOR_X_POSITION : 16;
uint32_t CURSOR0_0_CURSOR_POSITION__CURSOR_Y_POSITION : 16;
uint32_t CURSOR0_0_CURSOR_HOT_SPOT__CURSOR_HOT_SPOT_X : 16;
uint32_t CURSOR0_0_CURSOR_HOT_SPOT__CURSOR_HOT_SPOT_Y : 16;
uint32_t CURSOR0_0_CURSOR_DST_OFFSET__CURSOR_DST_X_OFFSET : 13;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_ENABLE : 1;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_MODE : 3;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY : 1;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_PITCH : 2;
uint32_t CURSOR0_0_CURSOR_CONTROL__CURSOR_LINES_PER_CHUNK : 5;
uint32_t reserved0[4];
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_ENABLE : 1;
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_MODE : 3;
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_EXPANSION_MODE : 1;
uint32_t CM_CUR0_CURSOR0_CONTROL__CUR0_ROM_EN : 1;
uint32_t CM_CUR0_CURSOR0_COLOR0__CUR0_COLOR0 : 24;
uint32_t CM_CUR0_CURSOR0_COLOR1__CUR0_COLOR1 : 24;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_G_Y__CUR0_FP_BIAS_G_Y : 16;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_G_Y__CUR0_FP_SCALE_G_Y, : 16;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_RB_CRCB__CUR0_FP_BIAS_RB_CRCB : 16;
uint32_t CM_CUR0_CURSOR0_FP_SCALE_BIAS_RB_CRCB__CUR0_FP_SCALE_RB_CRCB : 16;
uint32_t reserved1[4];
uint32_t HUBPREQ0_CURSOR_SETTINGS__CURSOR0_DST_Y_OFFSET : 8;
uint32_t HUBPREQ0_CURSOR_SETTINGS__CURSOR0_CHUNK_HDL_ADJUST : 8;
uint32_t HUBPREQ0_CURSOR_SETTINGS__FORCE_CURSOR_TO_DISP_PREF : 1;
uint32_t reserved2[3];
};
struct dmub_cursor_offload_pipe_data_v1 {
union {
struct dmub_cursor_offload_pipe_data_dcn30_v1 dcn30;
struct dmub_cursor_offload_pipe_data_dcn401_v1 dcn401;
struct dmub_cursor_offload_pipe_data_dcn60_v1 dcn60;
uint8_t payload[96];
};
};
struct dmub_cursor_offload_payload_data_v1 {
uint32_t write_idx_start;
uint32_t write_idx_finish;
uint32_t pipe_mask;
uint32_t reserved;
struct dmub_cursor_offload_pipe_data_v1 pipe_data[6];
};
struct dmub_cursor_offload_stream_v1 {
struct dmub_cursor_offload_payload_data_v1 payloads[4];
uint32_t write_idx;
};
struct dmub_cursor_offload_v1 {
struct dmub_cursor_offload_stream_v1 offload_streams[6];
};
#pragma pack(push, 1)
#define DMUB_FW_META_MAGIC 0x444D5542
#define DMUB_FW_META_OFFSET 0x24
union dmub_fw_meta_feature_bits {
struct {
uint32_t shared_state_link_detection : 1;
uint32_t cursor_offload_v1_support: 1;
uint32_t inbox0_lock_support: 1;
uint32_t inbox0_lock_split: 1;
uint32_t reserved : 28;
} bits;
uint32_t all;
};
struct dmub_fw_meta_info {
uint32_t magic_value;
uint32_t fw_region_size;
uint32_t trace_buffer_size;
uint32_t fw_version;
uint8_t dal_fw;
uint8_t reserved[3];
uint32_t shared_state_size;
uint16_t shared_state_features;
uint16_t reserved2;
union dmub_fw_meta_feature_bits feature_bits;
};
union dmub_fw_meta {
struct dmub_fw_meta_info info;
uint8_t reserved[64];
};
#pragma pack(pop)
#if !defined(TENSILICA) && !defined(DMUB_TRACE_ENTRY_DEFINED)
typedef uint32_t dmub_trace_code_t;
struct dmcub_trace_buf_entry {
dmub_trace_code_t trace_code;
uint32_t tick_count;
uint32_t param0;
uint32_t param1;
};
#endif
union dmub_fw_boot_status {
struct {
uint32_t dal_fw : 1;
uint32_t mailbox_rdy : 1;
uint32_t optimized_init_done : 1;
uint32_t restore_required : 1;
uint32_t defer_load : 1;
uint32_t fams_enabled : 1;
uint32_t detection_required: 1;
uint32_t hw_power_init_done: 1;
uint32_t ono_regions_enabled: 1;
} bits;
uint32_t all;
};
enum dmub_fw_boot_status_bit {
DMUB_FW_BOOT_STATUS_BIT_DAL_FIRMWARE = (1 << 0),
DMUB_FW_BOOT_STATUS_BIT_MAILBOX_READY = (1 << 1),
DMUB_FW_BOOT_STATUS_BIT_OPTIMIZED_INIT_DONE = (1 << 2),
DMUB_FW_BOOT_STATUS_BIT_RESTORE_REQUIRED = (1 << 3),
DMUB_FW_BOOT_STATUS_BIT_DEFERRED_LOADED = (1 << 4),
DMUB_FW_BOOT_STATUS_BIT_FAMS_ENABLED = (1 << 5),
DMUB_FW_BOOT_STATUS_BIT_DETECTION_REQUIRED = (1 << 6),
DMUB_FW_BOOT_STATUS_BIT_HW_POWER_INIT_DONE = (1 << 7),
DMUB_FW_BOOT_STATUS_BIT_ONO_REGIONS_ENABLED = (1 << 8),
};
union dmub_lvtma_status {
struct {
uint32_t psp_ok : 1;
uint32_t edp_on : 1;
uint32_t reserved : 30;
} bits;
uint32_t all;
};
enum dmub_lvtma_status_bit {
DMUB_LVTMA_STATUS_BIT_PSP_OK = (1 << 0),
DMUB_LVTMA_STATUS_BIT_EDP_ON = (1 << 1),
};
enum dmub_ips_disable_type {
DMUB_IPS_ENABLE = 0,
DMUB_IPS_DISABLE_ALL = 1,
DMUB_IPS_DISABLE_IPS1 = 2,
DMUB_IPS_DISABLE_IPS2 = 3,
DMUB_IPS_DISABLE_IPS2_Z10 = 4,
DMUB_IPS_DISABLE_DYNAMIC = 5,
DMUB_IPS_RCG_IN_ACTIVE_IPS2_IN_OFF = 6,
DMUB_IPS_DISABLE_Z8_RETENTION = 7,
};
enum dmub_ips_rcg_disable_type {
DMUB_IPS_RCG_ENABLE = 0,
DMUB_IPS0_RCG_DISABLE = 1,
DMUB_IPS1_RCG_DISABLE = 2,
DMUB_IPS_RCG_DISABLE = 3
};
enum dmub_ips_in_vpb_disable_type {
DMUB_IPS_VPB_RCG_ONLY = 0,
DMUB_IPS_VPB_DISABLE_ALL = 1,
DMUB_IPS_VPB_ENABLE_IPS1_AND_RCG = 2,
DMUB_IPS_VPB_ENABLE_ALL = 3
};
#define DMUB_IPS1_ALLOW_MASK 0x00000001
#define DMUB_IPS2_ALLOW_MASK 0x00000002
#define DMUB_IPS1_COMMIT_MASK 0x00000004
#define DMUB_IPS2_COMMIT_MASK 0x00000008
enum dmub_ips_comand_type {
DMUB_CMD__IPS_RESIDENCY_CNTL = 0,
DMUB_CMD__IPS_QUERY_RESIDENCY_INFO = 1,
};
enum dmub_dc_bls_command_type {
DMUB_CMD__DC_BLS_DCHVM_INIT = 0,
};
enum dmub_cursor_offload_comand_type {
DMUB_CMD__CURSOR_OFFLOAD_INIT = 0,
DMUB_CMD__CURSOR_OFFLOAD_STREAM_ENABLE = 1,
DMUB_CMD__CURSOR_OFFLOAD_STREAM_DISABLE = 2,
DMUB_CMD__CURSOR_OFFLOAD_STREAM_PROGRAM = 3,
};
union dmub_fw_boot_options {
struct {
uint32_t pemu_env : 1;
uint32_t fpga_env : 1;
uint32_t optimized_init : 1;
uint32_t skip_phy_access : 1;
uint32_t disable_clk_gate: 1;
uint32_t skip_phy_init_panel_sequence: 1;
uint32_t z10_disable: 1;
uint32_t enable_dpia: 1;
uint32_t invalid_vbios_data: 1;
uint32_t dpia_supported: 1;
uint32_t sel_mux_phy_c_d_phy_f_g: 1;
uint32_t power_optimization: 1;
uint32_t diag_env: 1;
uint32_t gpint_scratch8: 1;
uint32_t usb4_cm_version: 1;
uint32_t dpia_hpd_int_enable_supported: 1;
uint32_t enable_non_transparent_setconfig: 1;
uint32_t disable_clk_ds: 1;
uint32_t disable_timeout_recovery : 1;
uint32_t ips_pg_disable: 1;
uint32_t ips_disable: 3;
uint32_t ips_sequential_ono: 1;
uint32_t disable_sldo_opt: 1;
uint32_t lower_hbr3_phy_ssc: 1;
uint32_t override_hbr3_pll_vco: 1;
uint32_t disable_dpia_bw_allocation: 1;
uint32_t bootcrc_en_at_preos: 1;
uint32_t bootcrc_en_at_S0i3: 1;
uint32_t bootcrc_boot_mode: 1;
uint32_t reserved : 1;
} bits;
uint32_t all;
};
enum dmub_fw_boot_options_bit {
DMUB_FW_BOOT_OPTION_BIT_PEMU_ENV = (1 << 0),
DMUB_FW_BOOT_OPTION_BIT_FPGA_ENV = (1 << 1),
DMUB_FW_BOOT_OPTION_BIT_OPTIMIZED_INIT_DONE = (1 << 2),
};
enum dmub_shared_state_feature_id {
DMUB_SHARED_SHARE_FEATURE__INVALID = 0,
DMUB_SHARED_SHARE_FEATURE__IPS_FW = 1,
DMUB_SHARED_SHARE_FEATURE__IPS_DRIVER = 2,
DMUB_SHARED_SHARE_FEATURE__DEBUG_SETUP = 3,
DMUB_SHARED_STATE_FEATURE__CURSOR_OFFLOAD_V1 = 4,
DMUB_SHARED_STATE_FEATURE__LAST,
};
union dmub_shared_state_ips_fw_signals {
struct {
uint32_t ips1_commit : 1;
uint32_t ips2_commit : 1;
uint32_t in_idle : 1;
uint32_t detection_required : 1;
uint32_t ips1z8_commit: 1;
uint32_t reserved_bits : 27;
} bits;
uint32_t all;
};
union dmub_shared_state_ips_driver_signals {
struct {
uint32_t allow_pg : 1;
uint32_t allow_ips1 : 1;
uint32_t allow_ips2 : 1;
uint32_t allow_z10 : 1;
uint32_t allow_idle: 1;
uint32_t allow_ips0_rcg : 1;
uint32_t allow_ips1_rcg : 1;
uint32_t allow_ips1z8 : 1;
uint32_t allow_dynamic_ips1 : 1;
uint32_t allow_dynamic_ips1_z8: 1;
uint32_t reserved_bits : 22;
} bits;
uint32_t all;
};
#define DMUB_SHARED_STATE__IPS_FW_VERSION 1
struct dmub_shared_state_debug_setup {
union {
struct {
uint32_t exclude_points[62];
} profile_mode;
};
};
struct dmub_shared_state_ips_fw {
union dmub_shared_state_ips_fw_signals signals;
uint32_t rcg_entry_count;
uint32_t rcg_exit_count;
uint32_t ips1_entry_count;
uint32_t ips1_exit_count;
uint32_t ips2_entry_count;
uint32_t ips2_exit_count;
uint32_t ips1_z8ret_entry_count;
uint32_t ips1_z8ret_exit_count;
uint32_t reserved[53];
};
#define DMUB_SHARED_STATE__IPS_DRIVER_VERSION 1
struct dmub_shared_state_ips_driver {
union dmub_shared_state_ips_driver_signals signals;
uint32_t reserved[61];
};
struct dmub_shared_state_cursor_offload_stream_v1 {
uint32_t last_write_idx;
uint8_t reserved[28];
};
struct dmub_shared_state_cursor_offload_v1 {
struct dmub_shared_state_cursor_offload_stream_v1 offload_streams[6];
uint8_t reserved[56];
};
struct dmub_shared_state_feature_common {
uint32_t padding[62];
};
struct dmub_shared_state_feature_header {
uint16_t id;
uint16_t version;
uint32_t reserved;
};
struct dmub_shared_state_feature_block {
struct dmub_shared_state_feature_header header;
union dmub_shared_feature_state_union {
struct dmub_shared_state_feature_common common;
struct dmub_shared_state_ips_fw ips_fw;
struct dmub_shared_state_ips_driver ips_driver;
struct dmub_shared_state_debug_setup debug_setup;
struct dmub_shared_state_cursor_offload_v1 cursor_offload_v1;
} data;
};
#define DMUB_FW_HEADER_SHARED_STATE_SIZE \
((DMUB_SHARED_STATE_FEATURE__LAST + 1) * sizeof(struct dmub_shared_state_feature_block))
enum dmub_cmd_vbios_type {
DMUB_CMD__VBIOS_DIGX_ENCODER_CONTROL = 0,
DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL = 1,
DMUB_CMD__VBIOS_SET_PIXEL_CLOCK = 2,
DMUB_CMD__VBIOS_ENABLE_DISP_POWER_GATING = 3,
DMUB_CMD__VBIOS_LVTMA_CONTROL = 15,
DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT = 26,
DMUB_CMD__VBIOS_TRANSMITTER_SET_PHY_FSM = 29,
DMUB_CMD__VBIOS_DOMAIN_CONTROL = 28,
};
#define DMUB_GPINT_DATA_PARAM_MASK 0xFFFF
#define DMUB_GPINT_DATA_PARAM_SHIFT 0
#define DMUB_GPINT_DATA_COMMAND_CODE_MASK 0xFFF
#define DMUB_GPINT_DATA_COMMAND_CODE_SHIFT 16
#define DMUB_GPINT_DATA_STATUS_MASK 0xF
#define DMUB_GPINT_DATA_STATUS_SHIFT 28
#define DMUB_GPINT__STOP_FW_RESPONSE 0xDEADDEAD
union dmub_gpint_data_register {
struct {
uint32_t param : 16;
uint32_t command_code : 12;
uint32_t status : 4;
} bits;
uint32_t all;
};
enum dmub_gpint_command {
DMUB_GPINT__INVALID_COMMAND = 0,
DMUB_GPINT__GET_FW_VERSION = 1,
DMUB_GPINT__STOP_FW = 2,
DMUB_GPINT__GET_PSR_STATE = 7,
DMUB_GPINT__IDLE_OPT_NOTIFY_STREAM_MASK = 8,
DMUB_GPINT__PSR_RESIDENCY = 9,
DMUB_GPINT__NOTIFY_DETECTION_DONE = 12,
DMUB_GPINT__GET_REPLAY_STATE = 13,
DMUB_GPINT__REPLAY_RESIDENCY = 14,
DMUB_GPINT__TRIGGER_CACP = 18,
DMUB_GPINT__BB_COPY = 96,
DMUB_GPINT__SET_BB_ADDR_WORD3 = 97,
DMUB_GPINT__SET_BB_ADDR_WORD2 = 98,
DMUB_GPINT__SET_BB_ADDR_WORD1 = 99,
DMUB_GPINT__SET_BB_ADDR_WORD0 = 100,
DMUB_GPINT__UPDATE_TRACE_BUFFER_MASK = 101,
DMUB_GPINT__SET_TRACE_BUFFER_MASK_WORD0 = 102,
DMUB_GPINT__SET_TRACE_BUFFER_MASK_WORD1 = 103,
DMUB_GPINT__SET_TRACE_BUFFER_MASK_WORD2 = 114,
DMUB_GPINT__SET_TRACE_BUFFER_MASK_WORD3 = 115,
DMUB_GPINT__GET_TRACE_BUFFER_MASK_WORD0 = 116,
DMUB_GPINT__GET_TRACE_BUFFER_MASK_WORD1 = 117,
DMUB_GPINT__GET_TRACE_BUFFER_MASK_WORD2 = 118,
DMUB_GPINT__GET_TRACE_BUFFER_MASK_WORD3 = 119,
DMUB_GPINT__IPS_RESIDENCY = 121,
DMUB_GPINT__TRACE_DMUB_WAKE_ACTIVITY = 123,
DMUB_GPINT__GET_IPS_RESIDENCY_DURATION_US_LO = 124,
DMUB_GPINT__GET_IPS1_HISTOGRAM_COUNTER = 125,
DMUB_GPINT__GET_IPS2_HISTOGRAM_COUNTER = 126,
DMUB_GPINT__GET_IPS_RESIDENCY_PERCENT = 127,
DMUB_GPINT__GET_IPS0_RCG_HISTOGRAM_COUNTER = 128,
DMUB_GPINT__GET_IPS1_ONO2_ON_HISTOGRAM_COUNTER = 129,
DMUB_GPINT__GET_IPS_RESIDENCY_ENTRY_COUNTER = 130,
DMUB_GPINT__GET_IPS_INACTIVE_RESIDENCY_DURATION_US_LO = 131,
DMUB_GPINT__GET_IPS_INACTIVE_RESIDENCY_DURATION_US_HI = 132,
DMUB_GPINT__GET_IPS_RESIDENCY_DURATION_US_HI = 133,
DMUB_GPINT__SETUP_DEBUG_MODE = 136,
DMUB_GPINT__IPS_DEBUG_WAKE = 137,
DMUB_GPINT__PANEL_POWER_OFF_SEQ = 138,
DMUB_GPINT__PANEL_POLARITY_GET_BIAS = 139,
DMUB_GPINT__PANEL_POLARITY_DEBUG_ENABLE = 140,
DMUB_GPINT__REPLAY_RESET_CUMULATIVE_RESIDENCY = 141,
DMUB_GPINT__REPLAY_GET_CUMULATIVE_RESIDENCY_US_LO = 142,
DMUB_GPINT__REPLAY_GET_CUMULATIVE_RESIDENCY_US_HI = 143,
DMUB_GPINT__REPLAY_SNAPSHOT_CUMULATIVE_RESIDENCY = 144,
};
union dmub_inbox0_cmd_common {
struct {
uint32_t command_code: 8;
uint32_t param: 24;
} bits;
uint32_t all;
};
union dmub_inbox0_cmd_lock_hw {
struct {
uint32_t command_code: 8;
uint32_t hw_lock_client: 2;
uint32_t otg_inst: 3;
uint32_t opp_inst: 3;
uint32_t dig_inst: 3;
uint32_t lock_pipe: 1;
uint32_t lock_cursor: 1;
uint32_t lock_dig: 1;
uint32_t triple_buffer_lock: 1;
uint32_t lock: 1;
uint32_t should_release: 1;
uint32_t reserved: 7;
} bits;
uint32_t all;
};
union dmub_inbox0_data_register {
union dmub_inbox0_cmd_common inbox0_cmd_common;
union dmub_inbox0_cmd_lock_hw inbox0_cmd_lock_hw;
};
enum dmub_inbox0_command {
DMUB_INBOX0_CMD__INVALID_COMMAND = 0,
DMUB_INBOX0_CMD__HW_LOCK = 1,
};
#define DMUB_RB_CMD_SIZE 64
#define DMUB_RB_MAX_ENTRY 128
#define DMUB_RB_SIZE (DMUB_RB_CMD_SIZE * DMUB_RB_MAX_ENTRY)
#define DMUB_REG_INBOX0_RB_MAX_ENTRY 16
#define DMUB_REG_INBOX0_RB_SIZE (DMUB_RB_CMD_SIZE * DMUB_REG_INBOX0_RB_MAX_ENTRY)
#define REG_SET_MASK 0xFFFF
enum dmub_cmd_type {
DMUB_CMD__NULL = 0,
DMUB_CMD__PLAT_54186_WA = 5,
DMUB_CMD__QUERY_FEATURE_CAPS = 6,
DMUB_CMD__GET_VISUAL_CONFIRM_COLOR = 8,
DMUB_CMD__PSR = 64,
DMUB_CMD__MALL = 65,
DMUB_CMD__ABM = 66,
DMUB_CMD__UPDATE_DIRTY_RECT = 67,
DMUB_CMD__UPDATE_CURSOR_INFO = 68,
DMUB_CMD__HW_LOCK = 69,
DMUB_CMD__DP_AUX_ACCESS = 70,
DMUB_CMD__OUTBOX1_ENABLE = 71,
DMUB_CMD__IDLE_OPT = 72,
DMUB_CMD__CLK_MGR = 73,
DMUB_CMD__PANEL_CNTL = 74,
DMUB_CMD__CAB_FOR_SS = 75,
DMUB_CMD__FW_ASSISTED_MCLK_SWITCH = 76,
DMUB_CMD__DPIA = 77,
DMUB_CMD_GET_USBC_CABLE_ID = 81,
DMUB_CMD__QUERY_HPD_STATE = 82,
DMUB_CMD__REPLAY = 83,
DMUB_CMD__SECURE_DISPLAY = 85,
DMUB_CMD__DPIA_HPD_INT_ENABLE = 86,
DMUB_CMD__CACP = 87,
DMUB_CMD__PSP = 88,
DMUB_CMD__FUSED_IO = 89,
DMUB_CMD__LSDMA = 90,
DMUB_CMD__IPS = 91,
DMUB_CMD__CURSOR_OFFLOAD = 92,
DMUB_CMD__SMART_POWER_OLED = 93,
DMUB_CMD__PR = 94,
DMUB_CMD__IHC = 95,
DMUB_CMD__BOOT_TIME_CRC = 96,
DMUB_CMD__PANEL_POLARITY = 97,
DMUB_CMD__DC_BLS = 98,
DMUB_CMD__NBIF_AZ_PME_RESTORE = 99,
DMUB_CMD__VBIOS = 128,
};
enum dmub_out_cmd_type {
DMUB_OUT_CMD__NULL = 0,
DMUB_OUT_CMD__DP_AUX_REPLY = 1,
DMUB_OUT_CMD__DP_HPD_NOTIFY = 2,
DMUB_OUT_CMD__SET_CONFIG_REPLY = 3,
DMUB_OUT_CMD__DPIA_NOTIFICATION = 5,
DMUB_OUT_CMD__HPD_SENSE_NOTIFY = 6,
DMUB_OUT_CMD__FUSED_IO = 7,
};
enum dmub_cmd_dpia_type {
DMUB_CMD__DPIA_DIG1_DPIA_CONTROL = 0,
DMUB_CMD__DPIA_SET_CONFIG_ACCESS = 1,
DMUB_CMD__DPIA_MST_ALLOC_SLOTS = 2,
DMUB_CMD__DPIA_SET_TPS_NOTIFICATION = 3,
DMUB_CMD__DPIA_SET_CONFIG_REQUEST = 4,
};
enum dmub_cmd_dpia_notification_type {
DPIA_NOTIFY__BW_ALLOCATION = 0,
};
#pragma pack(push, 1)
struct dmub_cmd_header {
unsigned int type : 8;
unsigned int sub_type : 8;
unsigned int ret_status : 1;
unsigned int multi_cmd_pending : 1;
unsigned int is_reg_based : 1;
unsigned int reserved0 : 5;
unsigned int payload_bytes : 6;
unsigned int reserved1 : 2;
};
struct dmub_rb_cmd_common {
struct dmub_cmd_header header;
uint8_t cmd_buffer[DMUB_RB_CMD_SIZE - sizeof(struct dmub_cmd_header)];
};
struct dmub_cmd_PLAT_54186_wa {
uint32_t DCSURF_SURFACE_CONTROL;
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH;
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS;
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C;
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_C;
struct {
uint32_t hubp_inst : 4;
uint32_t tmz_surface : 1;
uint32_t immediate :1;
uint32_t vmid : 4;
uint32_t grph_stereo : 1;
uint32_t reserved : 21;
} flip_params;
uint32_t reserved[9];
};
struct dmub_rb_cmd_PLAT_54186_wa {
struct dmub_cmd_header header;
struct dmub_cmd_PLAT_54186_wa flip;
};
enum dmub_cmd_mall_type {
DMUB_CMD__MALL_ACTION_ALLOW = 0,
DMUB_CMD__MALL_ACTION_DISALLOW = 1,
DMUB_CMD__MALL_ACTION_COPY_CURSOR = 2,
DMUB_CMD__MALL_ACTION_NO_DF_REQ = 3,
};
struct dmub_rb_cmd_mall {
struct dmub_cmd_header header;
union dmub_addr cursor_copy_src;
union dmub_addr cursor_copy_dst;
uint32_t tmr_delay;
uint32_t tmr_scale;
uint16_t cursor_width;
uint16_t cursor_pitch;
uint16_t cursor_height;
uint8_t cursor_bpp;
uint8_t debug_bits;
uint8_t reserved1;
uint8_t reserved2;
};
enum dmub_cmd_cab_type {
DMUB_CMD__CAB_NO_IDLE_OPTIMIZATION = 0,
DMUB_CMD__CAB_NO_DCN_REQ = 1,
DMUB_CMD__CAB_DCN_SS_FIT_IN_CAB = 2,
DMUB_CMD__CAB_DCN_SS_NOT_FIT_IN_CAB = 3,
};
struct dmub_rb_cmd_cab_for_ss {
struct dmub_cmd_header header;
uint8_t cab_alloc_ways;
uint8_t debug_bits;
};
enum mclk_switch_mode {
NONE = 0,
FPO = 1,
SUBVP = 2,
VBLANK = 3,
};
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 {
union {
struct {
uint32_t pix_clk_100hz;
uint16_t main_vblank_start;
uint16_t main_vblank_end;
uint16_t mall_region_lines;
uint16_t prefetch_lines;
uint16_t prefetch_to_mall_start_lines;
uint16_t processing_delay_lines;
uint16_t htotal;
uint16_t vtotal;
uint8_t main_pipe_index;
uint8_t phantom_pipe_index;
uint8_t scale_factor_numerator;
uint8_t scale_factor_denominator;
uint8_t is_drr;
uint8_t main_split_pipe_index;
uint8_t phantom_split_pipe_index;
} subvp_data;
struct {
uint32_t pix_clk_100hz;
uint16_t vblank_start;
uint16_t vblank_end;
uint16_t vstartup_start;
uint16_t vtotal;
uint16_t htotal;
uint8_t vblank_pipe_index;
uint8_t padding[1];
struct {
uint8_t drr_in_use;
uint8_t drr_window_size_ms;
uint16_t min_vtotal_supported;
uint16_t max_vtotal_supported;
uint8_t use_ramping;
uint8_t drr_vblank_start_margin;
} drr_info;
} vblank_data;
} pipe_config;
uint8_t mode;
};
struct dmub_cmd_fw_assisted_mclk_switch_config_v2 {
uint16_t watermark_a_cache;
uint8_t vertical_int_margin_us;
uint8_t pstate_allow_width_us;
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 pipe_data[DMUB_MAX_SUBVP_STREAMS];
};
struct dmub_rb_cmd_fw_assisted_mclk_switch_v2 {
struct dmub_cmd_header header;
struct dmub_cmd_fw_assisted_mclk_switch_config_v2 config_data;
};
struct dmub_flip_addr_info {
uint32_t surf_addr_lo;
uint32_t surf_addr_c_lo;
uint32_t meta_addr_lo;
uint32_t meta_addr_c_lo;
uint16_t surf_addr_hi;
uint16_t surf_addr_c_hi;
uint16_t meta_addr_hi;
uint16_t meta_addr_c_hi;
};
struct dmub_fams2_flip_info {
union {
struct {
uint8_t is_immediate: 1;
} bits;
uint8_t all;
} config;
uint8_t otg_inst;
uint8_t pipe_mask;
uint8_t pad;
struct dmub_flip_addr_info addr_info;
};
struct dmub_rb_cmd_fams2_flip {
struct dmub_cmd_header header;
struct dmub_fams2_flip_info flip_info;
};
struct dmub_cmd_lsdma_data {
union {
struct lsdma_init_data {
union dmub_addr gpu_addr_base;
uint32_t ring_size;
} init_data;
struct lsdma_tiled_copy_data {
uint32_t src_addr_lo;
uint32_t src_addr_hi;
uint32_t dst_addr_lo;
uint32_t dst_addr_hi;
uint32_t src_x : 16;
uint32_t src_y : 16;
uint32_t dst_x : 16;
uint32_t dst_y : 16;
uint32_t src_width : 16;
uint32_t src_height : 16;
uint32_t dst_width : 16;
uint32_t dst_height : 16;
uint32_t rect_x : 16;
uint32_t rect_y : 16;
uint32_t src_swizzle_mode : 5;
uint32_t src_mip_max : 5;
uint32_t src_mip_id : 5;
uint32_t dst_mip_max : 5;
uint32_t dst_swizzle_mode : 5;
uint32_t dst_mip_id : 5;
uint32_t dcc : 1;
uint32_t padding1 : 1;
uint32_t data_format : 6;
uint32_t tmz : 4;
uint32_t dst_element_size : 3;
uint32_t num_type : 3;
uint32_t src_element_size : 3;
uint32_t write_compress : 2;
uint32_t cache_policy_dst : 3;
uint32_t cache_policy_src : 3;
uint32_t read_compress : 2;
uint32_t max_com : 2;
uint32_t max_uncom : 1;
uint32_t dst_dim : 2;
uint32_t src_dim : 2;
uint32_t padding : 28;
} tiled_copy_data;
struct lsdma_linear_copy_data {
uint32_t src_lo;
uint32_t src_hi;
uint32_t dst_lo;
uint32_t dst_hi;
uint32_t count : 30;
uint32_t pad0 : 2;
uint32_t tmz : 4;
uint32_t cache_policy_src : 3;
uint32_t cache_policy_dst : 3;
uint32_t data_format : 6;
uint32_t num_type : 3;
uint32_t read_compress : 2;
uint32_t write_compress : 2;
uint32_t max_com : 2;
uint32_t max_uncom : 1;
uint32_t pad1 : 6;
} linear_copy_data;
struct lsdma_linear_sub_window_copy_data {
uint32_t src_lo;
uint32_t src_hi;
uint32_t dst_lo;
uint32_t dst_hi;
uint32_t src_x : 16;
uint32_t src_y : 16;
uint32_t dst_x : 16;
uint32_t dst_y : 16;
uint32_t rect_x : 16;
uint32_t rect_y : 16;
uint32_t src_pitch : 16;
uint32_t dst_pitch : 16;
uint32_t src_slice_pitch;
uint32_t dst_slice_pitch;
uint32_t tmz : 4;
uint32_t element_size : 3;
uint32_t src_cache_policy : 3;
uint32_t dst_cache_policy : 3;
uint32_t data_format : 6;
uint32_t num_type : 3;
uint32_t read_compress : 2;
uint32_t write_compress : 2;
uint32_t max_com : 2;
uint32_t max_uncom : 1;
uint32_t reserved0 : 3;
} linear_sub_window_copy_data;
struct lsdma_reg_write_data {
uint32_t reg_addr;
uint32_t reg_data;
} reg_write_data;
struct lsdma_pio_copy_data {
uint32_t src_lo;
uint32_t src_hi;
uint32_t dst_lo;
uint32_t dst_hi;
union {
struct {
uint32_t byte_count : 26;
uint32_t src_loc : 1;
uint32_t dst_loc : 1;
uint32_t src_addr_inc : 1;
uint32_t dst_addr_inc : 1;
uint32_t overlap_disable : 1;
uint32_t constant_fill : 1;
} fields;
uint32_t raw;
} packet;
} pio_copy_data;
struct lsdma_pio_constfill_data {
uint32_t dst_lo;
uint32_t dst_hi;
union {
struct {
uint32_t byte_count : 26;
uint32_t src_loc : 1;
uint32_t dst_loc : 1;
uint32_t src_addr_inc : 1;
uint32_t dst_addr_inc : 1;
uint32_t overlap_disable : 1;
uint32_t constant_fill : 1;
} fields;
uint32_t raw;
} packet;
uint32_t data;
} pio_constfill_data;
uint32_t all[14];
} u;
};
struct dmub_rb_cmd_lsdma {
struct dmub_cmd_header header;
struct dmub_cmd_lsdma_data lsdma_data;
};
struct dmub_optc_state_v2 {
uint32_t v_total_min;
uint32_t v_total_max;
uint32_t v_total_mid;
uint32_t v_total_mid_frame_num;
uint8_t program_manual_trigger;
uint8_t tg_inst;
uint8_t pad[2];
};
struct dmub_optc_position {
uint32_t vpos;
uint32_t hpos;
uint32_t frame;
};
struct dmub_rb_cmd_fams2_drr_update {
struct dmub_cmd_header header;
struct dmub_optc_state_v2 dmub_optc_state_req;
};
enum fams2_stream_type {
FAMS2_STREAM_TYPE_NONE = 0,
FAMS2_STREAM_TYPE_VBLANK = 1,
FAMS2_STREAM_TYPE_VACTIVE = 2,
FAMS2_STREAM_TYPE_DRR = 3,
FAMS2_STREAM_TYPE_SUBVP = 4,
FAMS2_STREAM_TYPE_ALTERNATE = 5,
};
struct dmub_rect16 {
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;
};
struct plane_pipe_rect {
struct dmub_rect16 luma;
struct dmub_rect16 chroma;
};
struct lsdma_outputs {
uint16_t src_x[2][4];
uint16_t src_y[2][4];
uint16_t dst_x[2][4];
uint16_t dst_y[2][4];
uint16_t width[2][4];
uint16_t height[2][4];
uint16_t dst_pitch[4];
};
struct dmub_fams2_alternate_stream_dynamic_state {
uint64_t earliest_init_tick;
uint32_t otg_frame_pending_clear[3];
uint8_t flip_pending_clear_order[3];
uint8_t num_pending_flips;
uint32_t prefetch_start_line_x1000[3];
uint16_t prefetch_end_line[3];
uint16_t recout_y[3];
uint8_t flip_pending[3];
uint8_t copy_from_earliest[3];
uint16_t lsdma_bandwidth_mbps;
uint16_t vstartup_line;
uint16_t vready_line;
uint8_t cursor_size[3];
uint8_t pad;
uint16_t subvp_start_line_a[3];
uint16_t subvp_height_a[3];
uint16_t subvp_next_start_line_a[3];
uint16_t subvp_next_height_a[3];
uint16_t subvp_start_line_b[3];
uint16_t subvp_height_b[3];
uint16_t subvp_next_start_line_b[3];
uint16_t subvp_next_height_b[3];
uint16_t subvp_c_start_line_a[3];
uint16_t subvp_c_height_a[3];
uint16_t subvp_c_next_start_line_a[3];
uint16_t subvp_c_next_height_a[3];
uint16_t subvp_c_start_line_b[3];
uint16_t subvp_c_height_b[3];
uint16_t subvp_c_next_start_line_b[3];
uint16_t subvp_c_next_height_b[3];
uint8_t subvp_position[3];
uint8_t pad1[1];
uint32_t program_go_line;
uint32_t program_go_frame_count;
uint16_t svp0_start_dst_line;
uint16_t svp0_end_dst_line;
uint16_t svp1_start_dst_line;
uint16_t svp1_end_dst_line;
struct lsdma_outputs lsdma[2];
struct lsdma_outputs lsdma_c[2];
};
struct dmub_fams2_cmd_alternate_stream_static_state {
uint32_t total_bytes_to_copy;
uint16_t svp0_dst_lines;
uint16_t svp1_dst_lines;
uint16_t min_lead_dst_lines;
uint16_t svp_req_limit;
uint16_t fw_delays;
uint16_t vstartup_start;
uint16_t rec_height[3];
uint16_t viewport_start[3];
uint16_t viewport_size[3];
uint16_t viewport_start_c[3];
uint16_t viewport_size_c[3];
uint16_t surface_pitch[3];
uint16_t surface_pitch_c[3];
uint16_t surface_height[3];
uint16_t surface_height_c[3];
uint8_t element_size[3];
uint8_t element_size_c[3];
uint8_t swizzle_mode[3];
uint8_t vready_offset_lines;
uint16_t dst_y_prefetch_x1000[3];
uint16_t total_swaths[3];
uint16_t total_swaths_c[3];
uint8_t prefetch_swaths[3];
uint8_t prefetch_swaths_c[3];
uint8_t swath_height[3];
uint8_t swath_height_c[3];
uint16_t block_256b_width[3];
uint16_t block_256b_height[3];
uint16_t block_256b_width_c[3];
uint16_t block_256b_height_c[3];
uint16_t macro_tile_width[3];
uint16_t macro_tile_width_c[3];
union {
struct {
uint8_t is_multi_planar : 1;
uint8_t is_yuv420 : 1;
uint8_t prefetch_relative_vblank : 1;
uint8_t vertical_access : 1;
uint8_t access_direction : 1;
uint8_t dcc : 1;
uint8_t tmz : 1;
} bits;
uint8_t all;
} config[3];
uint8_t max_cursor_size;
uint16_t pre_hdl_delta_x1000[3];
uint16_t pre_hdl_delta_c_x1000[3];
uint16_t rec_hdl_delta_x1000[3];
uint16_t rec_hdl_delta_c_x1000[3];
uint16_t dst_y_per_vm_vblank_x1000[3];
uint16_t dst_y_per_row_vblank_x1000[3];
uint16_t dst_y_after_scaler[3];
uint16_t vinit_prefill[3];
uint16_t vinit_prefill_c[3];
uint16_t vratio_x1000[3];
uint16_t vratio_c_x1000[3];
struct plane_pipe_rect pipe_viewports[4];
uint32_t pipe_copy_offset[2][4];
uint32_t pipe_copy_offset_c[2][4];
uint32_t pipe_copy_addr_47_16[2][4];
uint32_t pipe_copy_addr_47_16_c[2][4];
uint32_t pipe_copy_max_size[2][4];
uint32_t pipe_copy_max_size_c[2][4];
};
struct dmub_fams2_legacy_stream_static_state {
uint8_t vactive_det_fill_delay_otg_vlines;
uint8_t programming_delay_otg_vlines;
};
struct dmub_fams2_subvp_stream_static_state {
uint16_t vratio_numerator;
uint16_t vratio_denominator;
uint16_t phantom_vtotal;
uint16_t phantom_vactive;
union {
struct {
uint8_t is_multi_planar : 1;
uint8_t is_yuv420 : 1;
} bits;
uint8_t all;
} config;
uint8_t programming_delay_otg_vlines;
uint8_t prefetch_to_mall_otg_vlines;
uint8_t phantom_otg_inst;
uint8_t phantom_pipe_mask;
uint8_t phantom_plane_pipe_masks[DMUB_MAX_PHANTOM_PLANES];
};
struct dmub_fams2_drr_stream_static_state {
uint16_t nom_stretched_vtotal;
uint8_t programming_delay_otg_vlines;
uint8_t only_stretch_if_required;
uint8_t pad[2];
};
struct dmub_fams2_cmd_legacy_stream_static_state {
uint16_t vactive_det_fill_delay_otg_vlines;
uint16_t programming_delay_otg_vlines;
uint32_t disallow_time_us;
};
struct dmub_fams2_cmd_subvp_stream_static_state {
uint16_t vratio_numerator;
uint16_t vratio_denominator;
uint16_t phantom_vtotal;
uint16_t phantom_vactive;
uint16_t programming_delay_otg_vlines;
uint16_t prefetch_to_mall_otg_vlines;
union {
struct {
uint8_t is_multi_planar : 1;
uint8_t is_yuv420 : 1;
} bits;
uint8_t all;
} config;
uint8_t phantom_otg_inst;
uint8_t phantom_pipe_mask;
uint8_t pad0;
uint8_t phantom_plane_pipe_masks[DMUB_MAX_PHANTOM_PLANES];
uint8_t pad1[4 - (DMUB_MAX_PHANTOM_PLANES % 4)];
};
struct dmub_fams2_cmd_drr_stream_static_state {
uint16_t nom_stretched_vtotal;
uint16_t programming_delay_otg_vlines;
uint8_t only_stretch_if_required;
uint8_t pad[3];
};
union dmub_fams2_stream_static_sub_state {
struct dmub_fams2_legacy_stream_static_state legacy;
struct dmub_fams2_subvp_stream_static_state subvp;
struct dmub_fams2_drr_stream_static_state drr;
};
union dmub_fams2_cmd_stream_static_sub_state {
COMMON_STREAM_STATIC_SUB_STATE
};
union dmub_fams2_stream_static_sub_state_v2 {
COMMON_STREAM_STATIC_SUB_STATE
struct dmub_fams2_cmd_alternate_stream_static_state alternate;
};
struct dmub_fams2_stream_static_state {
enum fams2_stream_type type;
uint32_t otg_vline_time_ns;
uint32_t otg_vline_time_ticks;
uint16_t htotal;
uint16_t vtotal;
uint16_t vblank_start;
uint16_t vblank_end;
uint16_t max_vtotal;
uint16_t allow_start_otg_vline;
uint16_t allow_end_otg_vline;
uint16_t drr_keepout_otg_vline;
uint8_t scheduling_delay_otg_vlines;
uint8_t contention_delay_otg_vlines;
uint8_t vline_int_ack_delay_otg_vlines;
uint8_t allow_to_target_delay_otg_vlines;
union {
struct {
uint8_t is_drr : 1;
uint8_t clamp_vtotal_min : 1;
uint8_t min_ttu_vblank_usable : 1;
uint8_t imm_restore_drr : 1;
} bits;
uint8_t all;
} config;
uint8_t otg_inst;
uint8_t pipe_mask;
uint8_t num_planes;
uint8_t plane_pipe_masks[DMUB_MAX_PLANES];
uint8_t pad[4 - (DMUB_MAX_PLANES % 4)];
union dmub_fams2_stream_static_sub_state sub_state;
};
struct dmub_fams2_cmd_stream_static_base_state {
enum fams2_stream_type type;
uint32_t otg_vline_time_ns;
uint32_t otg_vline_time_ticks;
uint16_t htotal;
uint16_t vtotal;
uint16_t vblank_start;
uint16_t vblank_end;
uint16_t max_vtotal;
uint16_t allow_start_otg_vline;
uint16_t allow_end_otg_vline;
uint16_t drr_keepout_otg_vline;
uint16_t scheduling_delay_otg_vlines;
uint16_t contention_delay_otg_vlines;
uint16_t vline_int_ack_delay_otg_vlines;
uint16_t allow_to_target_delay_otg_vlines;
union {
struct {
uint8_t is_drr : 1;
uint8_t clamp_vtotal_min : 1;
uint8_t min_ttu_vblank_usable : 1;
uint8_t imm_restore_drr : 1;
} bits;
uint8_t all;
} config;
uint8_t otg_inst;
uint8_t pipe_mask;
uint8_t num_planes;
uint8_t plane_pipe_masks[DMUB_MAX_PLANES];
uint8_t pad[4 - (DMUB_MAX_PLANES % 4)];
};
struct dmub_fams2_stream_static_state_v1 {
struct dmub_fams2_cmd_stream_static_base_state base;
union dmub_fams2_stream_static_sub_state_v2 sub_state;
};
enum dmub_fams2_allow_delay_check_mode {
FAMS2_ALLOW_DELAY_CHECK_NONE = 0,
FAMS2_ALLOW_DELAY_CHECK_FROM_START = 1,
FAMS2_ALLOW_DELAY_CHECK_FROM_PREPARE = 2,
};
union dmub_fams2_global_feature_config {
struct {
uint32_t enable: 1;
uint32_t enable_ppt_check: 1;
uint32_t enable_stall_recovery: 1;
uint32_t enable_debug: 1;
uint32_t enable_offload_flip: 1;
uint32_t enable_visual_confirm: 1;
uint32_t allow_delay_check_mode: 2;
uint32_t legacy_method_no_fams2 : 1;
uint32_t alternate_channel_workaround : 1;
uint32_t reserved: 22;
} bits;
uint32_t all;
};
struct dmub_cmd_fams2_global_config {
uint32_t max_allow_delay_us;
uint32_t lock_wait_time_us;
uint32_t num_streams;
union dmub_fams2_global_feature_config features;
uint32_t recovery_timeout_us;
uint32_t hwfq_flip_programming_delay_us;
uint32_t max_allow_to_target_delta_us;
};
union dmub_cmd_fams2_config {
struct dmub_cmd_fams2_global_config global;
struct dmub_fams2_stream_static_state stream;
union {
struct dmub_fams2_cmd_stream_static_base_state base;
union dmub_fams2_cmd_stream_static_sub_state sub_state;
} stream_v1;
};
struct dmub_fams2_config_v2 {
struct dmub_cmd_fams2_global_config global;
struct dmub_fams2_stream_static_state_v1 stream_v1[DMUB_MAX_STREAMS];
};
struct dmub_rb_cmd_fams2 {
struct dmub_cmd_header header;
union dmub_cmd_fams2_config config;
};
struct dmub_ib_data {
union dmub_addr src;
uint16_t size;
};
struct dmub_rb_cmd_ib {
struct dmub_cmd_header header;
struct dmub_ib_data ib_data;
};
enum dmub_cmd_idle_opt_type {
DMUB_CMD__IDLE_OPT_DCN_RESTORE = 0,
DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT = 1,
DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE = 2,
DMUB_CMD__IDLE_OPT_SET_DC_POWER_STATE = 3,
DMUB_CMD__IDLE_OPT_RELEASE_HW = 4,
};
struct dmub_rb_cmd_idle_opt_dcn_restore {
struct dmub_cmd_header header;
};
struct dmub_dcn_notify_idle_cntl_data {
uint8_t driver_idle;
uint8_t skip_otg_disable;
uint8_t reserved[58];
};
struct dmub_rb_cmd_idle_opt_dcn_notify_idle {
struct dmub_cmd_header header;
struct dmub_dcn_notify_idle_cntl_data cntl_data;
};
enum dmub_idle_opt_dc_power_state {
DMUB_IDLE_OPT_DC_POWER_STATE_UNKNOWN = 0,
DMUB_IDLE_OPT_DC_POWER_STATE_D0 = 1,
DMUB_IDLE_OPT_DC_POWER_STATE_D1 = 2,
DMUB_IDLE_OPT_DC_POWER_STATE_D2 = 4,
DMUB_IDLE_OPT_DC_POWER_STATE_D3 = 8,
};
struct dmub_idle_opt_set_dc_power_state_data {
uint8_t power_state;
uint8_t pad[3];
};
struct dmub_rb_cmd_idle_opt_set_dc_power_state {
struct dmub_cmd_header header;
struct dmub_idle_opt_set_dc_power_state_data data;
};
struct dmub_clocks {
uint32_t dispclk_khz;
uint32_t dppclk_khz;
uint32_t dcfclk_khz;
uint32_t dcfclk_deep_sleep_khz;
uint32_t dpm0_dispclk_khz;
uint32_t dpm0_dppclk_khz;
uint32_t max_bypass_clk_khz;
};
enum dmub_cmd_clk_mgr_type {
DMUB_CMD__CLK_MGR_NOTIFY_CLOCKS = 0,
};
struct dmub_rb_cmd_clk_mgr_notify_clocks {
struct dmub_cmd_header header;
struct dmub_clocks clocks;
};
struct dmub_cmd_digx_encoder_control_data {
union dig_encoder_control_parameters_v1_5 dig;
};
struct dmub_rb_cmd_digx_encoder_control {
struct dmub_cmd_header header;
struct dmub_cmd_digx_encoder_control_data encoder_control;
};
struct dmub_cmd_set_pixel_clock_data {
struct set_pixel_clock_parameter_v1_7 clk;
};
struct dmub_rb_cmd_set_pixel_clock {
struct dmub_cmd_header header;
struct dmub_cmd_set_pixel_clock_data pixel_clock;
};
struct dmub_cmd_enable_disp_power_gating_data {
struct enable_disp_power_gating_parameters_v2_1 pwr;
};
struct dmub_rb_cmd_enable_disp_power_gating {
struct dmub_cmd_header header;
struct dmub_cmd_enable_disp_power_gating_data power_gating;
};
struct dmub_dig_transmitter_control_data_v1_7 {
uint8_t phyid;
uint8_t action;
union {
uint8_t digmode;
uint8_t dplaneset;
uint8_t txffe;
} mode_laneset;
uint8_t lanenum;
union {
uint32_t symclk_10khz;
uint32_t symclk_Hz;
} symclk_units;
uint8_t hpdsel;
uint8_t digfe_sel;
uint8_t connobj_id;
uint8_t HPO_instance;
uint8_t TxFFELaneSel;
uint8_t skip_phy_ssc_reduction;
uint8_t reserved2[2];
uint32_t reserved3[11];
};
union dmub_cmd_dig1_transmitter_control_data {
struct dig_transmitter_control_parameters_v1_6 dig;
struct dmub_dig_transmitter_control_data_v1_7 dig_v1_7;
};
struct dmub_rb_cmd_dig1_transmitter_control {
struct dmub_cmd_header header;
union dmub_cmd_dig1_transmitter_control_data transmitter_control;
};
struct dmub_rb_cmd_domain_control_data {
uint8_t inst : 6;
uint8_t power_gate : 1;
uint8_t reserved[3];
};
struct dmub_rb_cmd_domain_control {
struct dmub_cmd_header header;
struct dmub_rb_cmd_domain_control_data data;
};
struct dmub_cmd_dig_dpia_control_data {
uint8_t enc_id;
uint8_t action;
union {
uint8_t digmode;
uint8_t dplaneset;
} mode_laneset;
uint8_t lanenum;
uint32_t symclk_10khz;
uint8_t hpdsel;
uint8_t digfe_sel;
uint8_t dpia_id;
uint8_t fec_rdy : 1;
uint8_t reserved : 7;
uint32_t reserved1;
};
struct dmub_rb_cmd_dig1_dpia_control {
struct dmub_cmd_header header;
struct dmub_cmd_dig_dpia_control_data dpia_control;
};
struct set_config_cmd_payload {
uint8_t msg_type;
uint8_t msg_data;
};
struct dmub_cmd_set_config_control_data {
struct set_config_cmd_payload cmd_pkt;
uint8_t instance;
uint8_t immed_status;
};
struct set_config_request_cmd_payload {
uint8_t instance;
uint8_t immed_status;
uint8_t msg_type;
uint8_t reserved;
uint32_t msg_data;
};
struct dmub_rb_cmd_set_config_access {
struct dmub_cmd_header header;
struct dmub_cmd_set_config_control_data set_config_control;
};
struct dmub_rb_cmd_set_config_request {
struct dmub_cmd_header header;
struct set_config_request_cmd_payload payload;
};
struct dmub_cmd_mst_alloc_slots_control_data {
uint8_t mst_alloc_slots;
uint8_t instance;
uint8_t immed_status;
uint8_t mst_slots_in_use;
};
struct dmub_rb_cmd_set_mst_alloc_slots {
struct dmub_cmd_header header;
struct dmub_cmd_mst_alloc_slots_control_data mst_slots_control;
};
struct dmub_cmd_tps_notification_data {
uint8_t instance;
uint8_t tps;
uint8_t reserved1;
uint8_t reserved2;
};
struct dmub_rb_cmd_set_tps_notification {
struct dmub_cmd_header header;
struct dmub_cmd_tps_notification_data tps_notification;
};
struct dmub_rb_cmd_dpia_hpd_int_enable {
struct dmub_cmd_header header;
uint32_t enable;
};
struct dmub_rb_cmd_dpphy_init {
struct dmub_cmd_header header;
uint8_t reserved[60];
};
enum dp_aux_request_action {
DP_AUX_REQ_ACTION_I2C_WRITE = 0x00,
DP_AUX_REQ_ACTION_I2C_READ = 0x10,
DP_AUX_REQ_ACTION_I2C_STATUS_REQ = 0x20,
DP_AUX_REQ_ACTION_I2C_WRITE_MOT = 0x40,
DP_AUX_REQ_ACTION_I2C_READ_MOT = 0x50,
DP_AUX_REQ_ACTION_I2C_STATUS_REQ_MOT = 0x60,
DP_AUX_REQ_ACTION_DPCD_WRITE = 0x80,
DP_AUX_REQ_ACTION_DPCD_READ = 0x90
};
enum aux_return_code_type {
AUX_RET_SUCCESS = 0,
AUX_RET_ERROR_UNKNOWN,
AUX_RET_ERROR_INVALID_REPLY,
AUX_RET_ERROR_TIMEOUT,
AUX_RET_ERROR_HPD_DISCON,
AUX_RET_ERROR_ENGINE_ACQUIRE,
AUX_RET_ERROR_INVALID_OPERATION,
AUX_RET_ERROR_PROTOCOL_ERROR,
};
enum aux_channel_type {
AUX_CHANNEL_LEGACY_DDC,
AUX_CHANNEL_DPIA
};
struct aux_transaction_parameters {
uint8_t is_i2c_over_aux;
uint8_t action;
uint8_t length;
uint8_t reserved;
uint32_t address;
uint8_t data[16];
};
struct dmub_cmd_dp_aux_control_data {
uint8_t instance;
uint8_t manual_acq_rel_enable;
uint8_t sw_crc_enabled;
uint8_t reserved0;
uint16_t timeout;
uint16_t reserved1;
enum aux_channel_type type;
struct aux_transaction_parameters dpaux;
};
struct dmub_rb_cmd_dp_aux_access {
struct dmub_cmd_header header;
struct dmub_cmd_dp_aux_control_data aux_control;
};
struct dmub_rb_cmd_outbox1_enable {
struct dmub_cmd_header header;
uint32_t enable;
};
struct aux_reply_data {
uint8_t command;
uint8_t length;
uint8_t pad[2];
uint8_t data[16];
};
struct aux_reply_control_data {
uint32_t handle;
uint8_t instance;
uint8_t result;
uint16_t pad;
};
struct dmub_rb_cmd_dp_aux_reply {
struct dmub_cmd_header header;
struct aux_reply_control_data control;
struct aux_reply_data reply_data;
};
enum dp_hpd_type {
DP_HPD = 0,
DP_IRQ = 1,
DP_NONE_HPD = 2
};
enum dp_hpd_status {
DP_HPD_UNPLUG = 0,
DP_HPD_PLUG
};
struct dp_hpd_data {
uint8_t instance;
uint8_t hpd_type;
uint8_t hpd_status;
uint8_t pad;
};
struct dmub_rb_cmd_dp_hpd_notify {
struct dmub_cmd_header header;
struct dp_hpd_data hpd_data;
};
enum set_config_status {
SET_CONFIG_PENDING = 0,
SET_CONFIG_ACK_RECEIVED,
SET_CONFIG_RX_TIMEOUT,
SET_CONFIG_UNKNOWN_ERROR,
};
struct set_config_reply_control_data {
uint8_t instance;
uint8_t status;
uint16_t pad;
};
struct dmub_rb_cmd_dp_set_config_reply {
struct dmub_cmd_header header;
struct set_config_reply_control_data set_config_reply_control;
};
struct dpia_notification_header {
uint8_t instance;
uint8_t reserved[3];
enum dmub_cmd_dpia_notification_type type;
};
struct dpia_notification_common {
uint8_t cmd_buffer[DMUB_RB_CMD_SIZE - sizeof(struct dmub_cmd_header)
- sizeof(struct dpia_notification_header)];
};
struct dpia_bw_allocation_notify_data {
union {
struct {
uint16_t cm_bw_alloc_support: 1;
uint16_t bw_request_failed: 1;
uint16_t bw_request_succeeded: 1;
uint16_t est_bw_changed: 1;
uint16_t bw_alloc_cap_changed: 1;
uint16_t reserved: 11;
} bits;
uint16_t flags;
};
uint8_t cm_id;
uint8_t group_id;
uint8_t granularity;
uint8_t estimated_bw;
uint8_t allocated_bw;
uint8_t reserved;
};
union dpia_notification_data {
struct dpia_notification_common common_data;
struct dpia_bw_allocation_notify_data dpia_bw_alloc;
};
struct dpia_notification_payload {
struct dpia_notification_header header;
union dpia_notification_data data;
};
struct dmub_rb_cmd_dpia_notification {
struct dmub_cmd_header header;
struct dpia_notification_payload payload;
};
struct dmub_cmd_hpd_state_query_data {
uint8_t instance;
uint8_t result;
uint16_t pad;
enum aux_channel_type ch_type;
enum aux_return_code_type status;
};
struct dmub_rb_cmd_query_hpd_state {
struct dmub_cmd_header header;
struct dmub_cmd_hpd_state_query_data data;
};
struct dmub_cmd_nbif_az_pme_restore_data {
uint8_t az_inst;
uint8_t pad[3];
};
struct dmub_rb_cmd_nbif_az_pme_restore {
struct dmub_cmd_header header;
struct dmub_cmd_nbif_az_pme_restore_data data;
};
struct dmub_rb_cmd_hpd_sense_notify_data {
uint32_t old_hpd_sense_mask;
uint32_t new_hpd_sense_mask;
};
struct dmub_rb_cmd_hpd_sense_notify {
struct dmub_cmd_header header;
struct dmub_rb_cmd_hpd_sense_notify_data data;
};
enum dmub_cmd_psr_type {
DMUB_CMD__PSR_SET_VERSION = 0,
DMUB_CMD__PSR_COPY_SETTINGS = 1,
DMUB_CMD__PSR_ENABLE = 2,
DMUB_CMD__PSR_DISABLE = 3,
DMUB_CMD__PSR_SET_LEVEL = 4,
DMUB_CMD__PSR_FORCE_STATIC = 5,
DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE = 6,
DMUB_CMD__SET_PSR_POWER_OPT = 7,
};
enum psr_residency_mode {
PSR_RESIDENCY_MODE_PHY = 0,
PSR_RESIDENCY_MODE_ALPM,
PSR_RESIDENCY_MODE_ENABLEMENT_PERIOD,
PSR_RESIDENCY_MODE_LAST_ELEMENT,
};
enum dmub_cmd_fams_type {
DMUB_CMD__FAMS_SETUP_FW_CTRL = 0,
DMUB_CMD__FAMS_DRR_UPDATE = 1,
DMUB_CMD__HANDLE_SUBVP_CMD = 2,
DMUB_CMD__FAMS_SET_MANUAL_TRIGGER = 3,
DMUB_CMD__FAMS2_CONFIG = 4,
DMUB_CMD__FAMS2_DRR_UPDATE = 5,
DMUB_CMD__FAMS2_FLIP = 6,
DMUB_CMD__FAMS2_IB_CONFIG = 7,
DMUB_CMD__FAMS2_IB_DEBUG_META = 8,
};
enum psr_version {
PSR_VERSION_1 = 0,
PSR_VERSION_SU_1 = 1,
PSR_VERSION_UNSUPPORTED = 0xFF,
};
enum phy_link_rate {
PHY_RATE_UNKNOWN = 0,
PHY_RATE_162 = 1,
PHY_RATE_216 = 2,
PHY_RATE_243 = 3,
PHY_RATE_270 = 4,
PHY_RATE_324 = 5,
PHY_RATE_432 = 6,
PHY_RATE_540 = 7,
PHY_RATE_810 = 8,
PHY_RATE_1000 = 9,
PHY_RATE_1350 = 10,
PHY_RATE_2000 = 11,
PHY_RATE_675 = 12,
};
enum dmub_phy_fsm_state {
DMUB_PHY_FSM_POWER_UP_DEFAULT = 0,
DMUB_PHY_FSM_RESET,
DMUB_PHY_FSM_RESET_RELEASED,
DMUB_PHY_FSM_SRAM_LOAD_DONE,
DMUB_PHY_FSM_INITIALIZED,
DMUB_PHY_FSM_CALIBRATED,
DMUB_PHY_FSM_CALIBRATED_LP,
DMUB_PHY_FSM_CALIBRATED_PG,
DMUB_PHY_FSM_POWER_DOWN,
DMUB_PHY_FSM_PLL_EN,
DMUB_PHY_FSM_TX_EN,
DMUB_PHY_FSM_TX_EN_TEST_MODE,
DMUB_PHY_FSM_FAST_LP,
DMUB_PHY_FSM_P2_PLL_OFF_CPM,
DMUB_PHY_FSM_P2_PLL_OFF_PG,
DMUB_PHY_FSM_P2_PLL_OFF,
DMUB_PHY_FSM_P2_PLL_ON,
};
struct dmub_cmd_psr_copy_settings_data {
union dmub_psr_debug_flags debug;
uint16_t psr_level;
uint8_t dpp_inst;
uint8_t mpcc_inst;
uint8_t opp_inst;
uint8_t otg_inst;
uint8_t digfe_inst;
uint8_t digbe_inst;
uint8_t dpphy_inst;
uint8_t aux_inst;
uint8_t smu_optimizations_en;
uint8_t frame_delay;
uint8_t frame_cap_ind;
uint8_t su_y_granularity;
uint8_t line_capture_indication;
uint8_t multi_disp_optimizations_en;
uint16_t init_sdp_deadline;
uint8_t rate_control_caps;
uint8_t force_ffu_mode;
uint32_t line_time_in_us;
uint8_t fec_enable_status;
uint8_t fec_enable_delay_in100us;
uint8_t cmd_version;
uint8_t panel_inst;
uint8_t dsc_enable_status;
uint8_t use_phy_fsm;
uint8_t relock_delay_frame_cnt;
uint8_t esd_recovery;
uint16_t dsc_slice_height;
uint16_t poweroff_before_vertical_line;
uint8_t power_down_phy_before_disable_stream;
};
struct dmub_rb_cmd_psr_copy_settings {
struct dmub_cmd_header header;
struct dmub_cmd_psr_copy_settings_data psr_copy_settings_data;
};
struct dmub_cmd_psr_set_level_data {
uint16_t psr_level;
uint8_t cmd_version;
uint8_t panel_inst;
};
struct dmub_rb_cmd_psr_set_level {
struct dmub_cmd_header header;
struct dmub_cmd_psr_set_level_data psr_set_level_data;
};
struct dmub_rb_cmd_psr_enable_data {
uint8_t cmd_version;
uint8_t panel_inst;
uint8_t phy_fsm_state;
uint8_t phy_rate;
};
struct dmub_rb_cmd_psr_enable {
struct dmub_cmd_header header;
struct dmub_rb_cmd_psr_enable_data data;
};
struct dmub_cmd_psr_set_version_data {
enum psr_version version;
uint8_t cmd_version;
uint8_t panel_inst;
uint8_t pad[2];
};
struct dmub_rb_cmd_psr_set_version {
struct dmub_cmd_header header;
struct dmub_cmd_psr_set_version_data psr_set_version_data;
};
struct dmub_cmd_psr_force_static_data {
uint8_t cmd_version;
uint8_t panel_inst;
uint8_t pad[2];
};
struct dmub_rb_cmd_psr_force_static {
struct dmub_cmd_header header;
struct dmub_cmd_psr_force_static_data psr_force_static_data;
};
union dmub_psr_su_debug_flags {
struct {
uint8_t update_dirty_rect_only : 1;
uint8_t reset_state : 1;
} bitfields;
uint32_t u32All;
};
struct dmub_cmd_update_dirty_rect_data {
struct dmub_rect src_dirty_rects[DMUB_MAX_DIRTY_RECTS];
union dmub_psr_su_debug_flags debug_flags;
uint8_t pipe_idx;
uint8_t dirty_rect_count;
uint8_t cmd_version;
uint8_t panel_inst;
uint8_t otg_inst;
uint8_t padding[3];
};
struct dmub_rb_cmd_update_dirty_rect {
struct dmub_cmd_header header;
struct dmub_cmd_update_dirty_rect_data update_dirty_rect_data;
};
union dmub_reg_cursor_control_cfg {
struct {
uint32_t cur_enable: 1;
uint32_t reser0: 3;
uint32_t cur_2x_magnify: 1;
uint32_t reser1: 3;
uint32_t mode: 3;
uint32_t reser2: 5;
uint32_t pitch: 2;
uint32_t reser3: 6;
uint32_t line_per_chunk: 5;
uint32_t reser4: 3;
} bits;
uint32_t raw;
};
struct dmub_cursor_position_cache_hubp {
union dmub_reg_cursor_control_cfg cur_ctl;
union dmub_reg_position_cfg {
struct {
uint32_t cur_x_pos: 16;
uint32_t cur_y_pos: 16;
} bits;
uint32_t raw;
} position;
union dmub_reg_hot_spot_cfg {
struct {
uint32_t hot_x: 16;
uint32_t hot_y: 16;
} bits;
uint32_t raw;
} hot_spot;
union dmub_reg_dst_offset_cfg {
struct {
uint32_t dst_x_offset: 13;
uint32_t reserved: 19;
} bits;
uint32_t raw;
} dst_offset;
};
union dmub_reg_cur0_control_cfg {
struct {
uint32_t cur0_enable: 1;
uint32_t expansion_mode: 1;
uint32_t reser0: 1;
uint32_t cur0_rom_en: 1;
uint32_t mode: 3;
uint32_t reserved: 25;
} bits;
uint32_t raw;
};
struct dmub_cursor_position_cache_dpp {
union dmub_reg_cur0_control_cfg cur0_ctl;
};
struct dmub_cursor_position_cfg {
struct dmub_cursor_position_cache_hubp pHubp;
struct dmub_cursor_position_cache_dpp pDpp;
uint8_t pipe_idx;
uint8_t padding[3];
};
struct dmub_cursor_attribute_cache_hubp {
uint32_t SURFACE_ADDR_HIGH;
uint32_t SURFACE_ADDR;
union dmub_reg_cursor_control_cfg cur_ctl;
union dmub_reg_cursor_size_cfg {
struct {
uint32_t width: 16;
uint32_t height: 16;
} bits;
uint32_t raw;
} size;
union dmub_reg_cursor_settings_cfg {
struct {
uint32_t dst_y_offset: 8;
uint32_t chunk_hdl_adjust: 2;
uint32_t reserved: 22;
} bits;
uint32_t raw;
} settings;
};
struct dmub_cursor_attribute_cache_dpp {
union dmub_reg_cur0_control_cfg cur0_ctl;
};
struct dmub_cursor_attributes_cfg {
struct dmub_cursor_attribute_cache_hubp aHubp;
struct dmub_cursor_attribute_cache_dpp aDpp;
};
struct dmub_cmd_update_cursor_payload0 {
struct dmub_rect cursor_rect;
union dmub_psr_su_debug_flags debug_flags;
uint8_t enable;
uint8_t pipe_idx;
uint8_t cmd_version;
uint8_t panel_inst;
struct dmub_cursor_position_cfg position_cfg;
uint8_t otg_inst;
uint8_t padding[3];
};
struct dmub_cmd_update_cursor_payload1 {
struct dmub_cursor_attributes_cfg attribute_cfg;
};
union dmub_cmd_update_cursor_info_data {
struct dmub_cmd_update_cursor_payload0 payload0;
struct dmub_cmd_update_cursor_payload1 payload1;
};
struct dmub_rb_cmd_update_cursor_info {
struct dmub_cmd_header header;
union dmub_cmd_update_cursor_info_data update_cursor_info_data;
};
struct dmub_cmd_psr_set_vtotal_data {
uint16_t psr_vtotal_idle;
uint8_t cmd_version;
uint8_t panel_inst;
uint16_t psr_vtotal_su;
uint8_t pad2[2];
};
struct dmub_rb_cmd_psr_set_vtotal {
struct dmub_cmd_header header;
struct dmub_cmd_psr_set_vtotal_data psr_set_vtotal_data;
};
struct dmub_cmd_psr_set_power_opt_data {
uint8_t cmd_version;
uint8_t panel_inst;
uint8_t pad[2];
uint32_t power_opt;
};
struct dmub_rb_cmd_psr_set_power_opt {
struct dmub_cmd_header header;
struct dmub_cmd_psr_set_power_opt_data psr_set_power_opt_data;
};
enum dmub_alpm_mode {
ALPM_AUXWAKE = 0,
ALPM_AUXLESS = 1,
ALPM_UNSUPPORTED = 2,
};
enum pr_residency_mode {
PR_RESIDENCY_MODE_PHY = 0x0,
PR_RESIDENCY_MODE_ALPM,
PR_RESIDENCY_MODE_IPS2,
PR_RESIDENCY_MODE_FRAME_CNT,
PR_RESIDENCY_MODE_ENABLEMENT_PERIOD,
};
#define REPLAY_RESIDENCY_MODE_SHIFT (0)
#define REPLAY_RESIDENCY_ENABLE_SHIFT (1)
#define REPLAY_RESIDENCY_REVISION_SHIFT (2)
#define REPLAY_RESIDENCY_MODE2_SHIFT (4)
#define REPLAY_RESIDENCY_MODE_MASK (0x1 << REPLAY_RESIDENCY_MODE_SHIFT)
# define REPLAY_RESIDENCY_FIELD_MODE_PHY (0x0 << REPLAY_RESIDENCY_MODE_SHIFT)
# define REPLAY_RESIDENCY_FIELD_MODE_ALPM (0x1 << REPLAY_RESIDENCY_MODE_SHIFT)
#define REPLAY_RESIDENCY_MODE2_MASK (0xF << REPLAY_RESIDENCY_MODE2_SHIFT)
# define REPLAY_RESIDENCY_FIELD_MODE2_IPS (0x1 << REPLAY_RESIDENCY_MODE2_SHIFT)
# define REPLAY_RESIDENCY_FIELD_MODE2_FRAME_CNT (0x2 << REPLAY_RESIDENCY_MODE2_SHIFT)
# define REPLAY_RESIDENCY_FIELD_MODE2_EN_PERIOD (0x3 << REPLAY_RESIDENCY_MODE2_SHIFT)
#define REPLAY_RESIDENCY_ENABLE_MASK (0x1 << REPLAY_RESIDENCY_ENABLE_SHIFT)
# define REPLAY_RESIDENCY_DISABLE (0x0 << REPLAY_RESIDENCY_ENABLE_SHIFT)
# define REPLAY_RESIDENCY_ENABLE (0x1 << REPLAY_RESIDENCY_ENABLE_SHIFT)
#define REPLAY_RESIDENCY_REVISION_MASK (0x3 << REPLAY_RESIDENCY_REVISION_SHIFT)
# define REPLAY_RESIDENCY_REVISION_0 (0x0 << REPLAY_RESIDENCY_REVISION_SHIFT)
# define REPLAY_RESIDENCY_REVISION_1 (0x1 << REPLAY_RESIDENCY_REVISION_SHIFT)
enum replay_state {
REPLAY_STATE_0 = 0x0,
REPLAY_STATE_1 = 0x10,
REPLAY_STATE_1A = 0x11,
REPLAY_STATE_2 = 0x20,
REPLAY_STATE_2A = 0x21,
REPLAY_STATE_3 = 0x30,
REPLAY_STATE_3INIT = 0x31,
REPLAY_STATE_4 = 0x40,
REPLAY_STATE_4A = 0x41,
REPLAY_STATE_4B = 0x42,
REPLAY_STATE_4C = 0x43,
REPLAY_STATE_4D = 0x44,
REPLAY_STATE_4E = 0x45,
REPLAY_STATE_4B_LOCKED = 0x4A,
REPLAY_STATE_4C_UNLOCKED = 0x4B,
REPLAY_STATE_5 = 0x50,
REPLAY_STATE_5A = 0x51,
REPLAY_STATE_5B = 0x52,
REPLAY_STATE_5A_LOCKED = 0x5A,
REPLAY_STATE_5B_UNLOCKED = 0x5B,
REPLAY_STATE_6 = 0x60,
REPLAY_STATE_6A = 0x61,
REPLAY_STATE_6B = 0x62,
REPLAY_STATE_INVALID = 0xFF,
};
enum pr_state {
PR_STATE_0 = 0x00,
PR_STATE_0_PENDING_SDP_AND_UNLOCK = 0x01,
PR_STATE_1 = 0x10,
PR_STATE_2 = 0x20,
PR_STATE_2_PENDING_FRAME_TRANSMISSION = 0x30,
PR_STATE_2_POWERED = 0x31,
PR_STATE_2_PENDING_HUBP_BLANK = 0x32,
PR_STATE_2_PENDING_POWER_UP = 0x33,
PR_STATE_2_PENDING_LOCK = 0x34,
PR_STATE_2_PENDING_SDP_AND_UNLOCK = 0x35,
PR_STATE_2_PENDING_AS_SDP = 0x36,
PR_STATE_INVALID = 0xFF,
};
enum dmub_cmd_replay_type {
DMUB_CMD__REPLAY_COPY_SETTINGS = 0,
DMUB_CMD__REPLAY_ENABLE = 1,
DMUB_CMD__SET_REPLAY_POWER_OPT = 2,
DMUB_CMD__REPLAY_SET_COASTING_VTOTAL = 3,
DMUB_CMD__REPLAY_SET_POWER_OPT_AND_COASTING_VTOTAL = 4,
DMUB_CMD__REPLAY_SET_TIMING_SYNC_SUPPORTED = 5,
DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER = 6,
DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL = 7,
DMUB_CMD__REPLAY_DISABLED_ADAPTIVE_SYNC_SDP = 8,
DMUB_CMD__REPLAY_SET_GENERAL_CMD = 16,
};
enum dmub_cmd_panel_polarity_type {
DMUB_CMD__PANEL_POLARITY_ENABLE = 0,
DMUB_CMD__PANEL_POLARITY_GET_BIAS = 1,
DMUB_CMD__PANEL_POLARITY_RESET = 2,
};
enum dmub_cmd_panel_replay_type {
DMUB_CMD__PR_ENABLE = 0,
DMUB_CMD__PR_COPY_SETTINGS = 1,
DMUB_CMD__PR_UPDATE_STATE = 2,
DMUB_CMD__PR_GENERAL_CMD = 3,
};
enum dmub_cmd_panel_replay_state_update_subtype {
PR_STATE_UPDATE_COASTING_VTOTAL = 0x1,
PR_STATE_UPDATE_SYNC_MODE = 0x2,
PR_STATE_UPDATE_RUNTIME_FLAGS = 0x3,
PR_STATE_UPDATE_PSEUDO_VTOTAL = 0x4,
};
enum dmub_cmd_panel_replay_general_subtype {
PR_GENERAL_CMD_DEBUG_OPTION = 0x1,
};
enum dmub_cmd_replay_general_subtype {
REPLAY_GENERAL_CMD_NOT_SUPPORTED = -1,
REPLAY_GENERAL_CMD_DISABLED_ADAPTIVE_SYNC_SDP,
REPLAY_GENERAL_CMD_DISABLED_DESYNC_ERROR_DETECTION,
REPLAY_GENERAL_CMD_UPDATE_ERROR_STATUS,
REPLAY_GENERAL_CMD_SET_LOW_RR_ACTIVATE,
REPLAY_GENERAL_CMD_VIDEO_CONFERENCING,
REPLAY_GENERAL_CMD_SET_CONTINUOUSLY_RESYNC,
REPLAY_GENERAL_CMD_SET_COASTING_VTOTAL_WITHOUT_FRAME_UPDATE,
REPLAY_GENERAL_CMD_LIVE_CAPTURE_WITH_CVT,
};
struct dmub_alpm_auxless_data {
uint16_t lfps_setup_ns;
uint16_t lfps_period_ns;
uint16_t lfps_silence_ns;
uint16_t lfps_t1_t2_override_us;
short lfps_t1_t2_offset_us;
uint8_t lttpr_count;
uint8_t pad[1];
};
struct dmub_cmd_replay_copy_settings_data {
union replay_debug_flags debug;
union replay_hw_flags flags;
uint8_t dpp_inst;
uint8_t otg_inst;
uint8_t digfe_inst;
uint8_t digbe_inst;
uint8_t aux_inst;
uint8_t panel_inst;
uint8_t pixel_deviation_per_line;
uint8_t max_deviation_line;
uint32_t line_time_in_ns;
uint8_t dpphy_inst;
uint8_t smu_optimizations_en;
uint8_t replay_timing_sync_supported;
uint8_t use_phy_fsm;
struct dmub_alpm_auxless_data auxless_alpm_data;
uint8_t hpo_stream_enc_inst;
uint8_t hpo_link_enc_inst;
uint8_t replay_support_fast_resync_in_ultra_sleep_mode;
uint8_t pad[1];
};
enum replay_version {
REPLAY_VERSION_FREESYNC_REPLAY = 0,
REPLAY_VERSION_PANEL_REPLAY = 1,
REPLAY_VERSION_UNSUPPORTED = 0xFF,
};
struct dmub_rb_cmd_replay_copy_settings {
struct dmub_cmd_header header;
struct dmub_cmd_replay_copy_settings_data replay_copy_settings_data;
};
enum replay_enable {
REPLAY_DISABLE = 0,
REPLAY_ENABLE = 1,
};
struct dmub_rb_cmd_smart_power_oled_enable_data {
uint8_t enable;
uint8_t panel_inst;
uint16_t peak_nits;
uint8_t otg_inst;
uint8_t digfe_inst;
uint8_t digbe_inst;
uint8_t debugcontrol;
uint32_t triggerline;
uint16_t fixed_max_cll;
uint8_t pad[2];
};
struct dmub_rb_cmd_replay_enable_data {
uint8_t enable;
uint8_t panel_inst;
uint8_t phy_fsm_state;
uint8_t phy_rate;
uint8_t hpo_stream_enc_inst;
uint8_t hpo_link_enc_inst;
uint8_t pad[2];
};
struct dmub_rb_cmd_replay_enable {
struct dmub_cmd_header header;
struct dmub_rb_cmd_replay_enable_data data;
};
struct dmub_cmd_replay_set_power_opt_data {
uint8_t panel_inst;
uint8_t pad[3];
uint32_t power_opt;
};
struct dmub_cmd_replay_set_timing_sync_data {
uint8_t panel_inst;
uint8_t timing_sync_supported;
uint8_t pad[2];
};
struct dmub_cmd_replay_set_pseudo_vtotal {
uint8_t panel_inst;
uint16_t vtotal;
uint8_t pad;
};
struct dmub_cmd_replay_disabled_adaptive_sync_sdp_data {
uint8_t panel_inst;
uint8_t force_disabled;
uint8_t pad[2];
};
struct dmub_cmd_replay_set_general_cmd_data {
uint8_t panel_inst;
uint8_t subtype;
uint8_t pad[2];
uint32_t param1;
uint32_t param2;
};
struct dmub_rb_cmd_replay_set_power_opt {
struct dmub_cmd_header header;
struct dmub_cmd_replay_set_power_opt_data replay_set_power_opt_data;
};
struct dmub_cmd_replay_set_coasting_vtotal_data {
uint16_t coasting_vtotal;
uint8_t cmd_version;
uint8_t panel_inst;
uint16_t coasting_vtotal_high;
uint16_t frame_skip_number;
};
struct dmub_rb_cmd_replay_set_coasting_vtotal {
struct dmub_cmd_header header;
struct dmub_cmd_replay_set_coasting_vtotal_data replay_set_coasting_vtotal_data;
};
struct dmub_rb_cmd_replay_set_power_opt_and_coasting_vtotal {
struct dmub_cmd_header header;
struct dmub_cmd_replay_set_power_opt_data replay_set_power_opt_data;
struct dmub_cmd_replay_set_coasting_vtotal_data replay_set_coasting_vtotal_data;
};
struct dmub_rb_cmd_replay_set_timing_sync {
struct dmub_cmd_header header;
struct dmub_cmd_replay_set_timing_sync_data replay_set_timing_sync_data;
};
struct dmub_rb_cmd_replay_set_pseudo_vtotal {
struct dmub_cmd_header header;
struct dmub_cmd_replay_set_pseudo_vtotal data;
};
struct dmub_rb_cmd_replay_disabled_adaptive_sync_sdp {
struct dmub_cmd_header header;
struct dmub_cmd_replay_disabled_adaptive_sync_sdp_data data;
};
struct dmub_rb_cmd_replay_set_general_cmd {
struct dmub_cmd_header header;
struct dmub_cmd_replay_set_general_cmd_data data;
};
struct dmub_cmd_replay_frameupdate_timer_data {
uint8_t panel_inst;
uint8_t enable;
uint16_t frameupdate_count;
};
struct dmub_rb_cmd_replay_set_frameupdate_timer {
struct dmub_cmd_header header;
struct dmub_cmd_replay_frameupdate_timer_data data;
};
union dmub_replay_cmd_set {
uint8_t panel_inst;
struct dmub_cmd_replay_set_timing_sync_data sync_data;
struct dmub_cmd_replay_frameupdate_timer_data timer_data;
struct dmub_cmd_replay_set_pseudo_vtotal pseudo_vtotal_data;
struct dmub_cmd_replay_disabled_adaptive_sync_sdp_data disabled_adaptive_sync_sdp_data;
struct dmub_cmd_replay_set_general_cmd_data set_general_cmd_data;
};
enum dmub_cmd_ihc_type {
DMUB_CMD__IHC_SET_DIG_HDCP_INTERRUPT_DEST = 0,
};
struct dmub_cmd_ihc_data {
uint8_t dig_id;
uint8_t to_dmu : 1;
uint8_t reserved : 7;
uint8_t pad[2];
};
struct dmub_rb_cmd_ihc {
struct dmub_cmd_header header;
struct dmub_cmd_ihc_data data;
};
enum dmub_cmd_smart_power_oled_type {
DMUB_CMD__SMART_POWER_OLED_ENABLE = 1,
DMUB_CMD__SMART_POWER_OLED_GETMAXCLL = 2,
};
struct dmub_rb_cmd_smart_power_oled_enable {
struct dmub_cmd_header header;
struct dmub_rb_cmd_smart_power_oled_enable_data data;
};
struct dmub_cmd_smart_power_oled_getmaxcll_input {
uint8_t panel_inst;
uint8_t pad[3];
};
struct dmub_cmd_smart_power_oled_getmaxcll_output {
uint16_t current_max_cll;
uint8_t pad[2];
};
struct dmub_rb_cmd_smart_power_oled_getmaxcll {
struct dmub_cmd_header header;
union dmub_cmd_smart_power_oled_getmaxcll_data {
struct dmub_cmd_smart_power_oled_getmaxcll_input input;
struct dmub_cmd_smart_power_oled_getmaxcll_output output;
uint32_t output_raw;
} data;
};
union dmub_hw_lock_flags {
struct {
uint8_t lock_pipe : 1;
uint8_t lock_cursor : 1;
uint8_t lock_dig : 1;
uint8_t triple_buffer_lock : 1;
} bits;
uint8_t u8All;
};
struct dmub_hw_lock_inst_flags {
uint8_t otg_inst;
uint8_t opp_inst;
uint8_t dig_inst;
uint8_t pad;
};
enum hw_lock_client {
HW_LOCK_CLIENT_DRIVER = 0,
HW_LOCK_CLIENT_PSR_SU = 1,
HW_LOCK_CLIENT_SUBVP = 3,
HW_LOCK_CLIENT_REPLAY = 4,
HW_LOCK_CLIENT_FAMS2 = 5,
HW_LOCK_CLIENT_CURSOR_OFFLOAD = 6,
HW_LOCK_CLIENT_INVALID = 0xFFFFFFFF,
};
struct dmub_cmd_lock_hw_data {
enum hw_lock_client client;
struct dmub_hw_lock_inst_flags inst_flags;
union dmub_hw_lock_flags hw_locks;
uint8_t lock;
uint8_t should_release;
uint8_t pad;
};
struct dmub_rb_cmd_lock_hw {
struct dmub_cmd_header header;
struct dmub_cmd_lock_hw_data lock_hw_data;
};
enum dmub_cmd_abm_type {
DMUB_CMD__ABM_INIT_CONFIG = 0,
DMUB_CMD__ABM_SET_PIPE = 1,
DMUB_CMD__ABM_SET_BACKLIGHT = 2,
DMUB_CMD__ABM_SET_LEVEL = 3,
DMUB_CMD__ABM_SET_AMBIENT_LEVEL = 4,
DMUB_CMD__ABM_SET_PWM_FRAC = 5,
DMUB_CMD__ABM_PAUSE = 6,
DMUB_CMD__ABM_SAVE_RESTORE = 7,
DMUB_CMD__ABM_QUERY_CAPS = 8,
DMUB_CMD__ABM_SET_EVENT = 9,
DMUB_CMD__ABM_GET_ACE_CURVE = 10,
DMUB_CMD__ABM_GET_HISTOGRAM_DATA = 11,
};
enum dmub_cmd_lsdma_type {
DMUB_CMD__LSDMA_INIT_CONFIG = 0,
DMUB_CMD__LSDMA_LINEAR_COPY = 1,
DMUB_CMD__LSDMA_LINEAR_SUB_WINDOW_COPY = 2,
DMUB_CMD__LSDMA_TILED_TO_TILED_COPY = 3,
DMUB_CMD__LSDMA_POLL_REG_WRITE = 4,
DMUB_CMD__LSDMA_PIO_COPY = 5,
DMUB_CMD__LSDMA_PIO_CONSTFILL = 6,
};
struct abm_ace_curve {
uint32_t offsets[ABM_MAX_NUM_OF_ACE_SEGMENTS];
uint32_t thresholds[ABM_MAX_NUM_OF_ACE_SEGMENTS];
uint32_t slopes[ABM_MAX_NUM_OF_ACE_SEGMENTS];
};
struct fixed_pt_format {
bool sign_bit;
uint8_t num_int_bits;
uint8_t num_frac_bits;
uint8_t pad;
};
struct abm_caps {
uint8_t num_hg_bins;
uint8_t num_ace_segments;
uint8_t pad[2];
struct fixed_pt_format ace_thresholds_format;
struct fixed_pt_format ace_offsets_format;
struct fixed_pt_format ace_slopes_format;
};
struct abm_config_table {
uint16_t crgb_thresh[NUM_POWER_FN_SEGS];
uint16_t crgb_offset[NUM_POWER_FN_SEGS];
uint16_t crgb_slope[NUM_POWER_FN_SEGS];
uint16_t backlight_thresholds[NUM_BL_CURVE_SEGS];
uint16_t backlight_offsets[NUM_BL_CURVE_SEGS];
uint16_t ambient_thresholds_lux[NUM_AMBI_LEVEL];
uint16_t min_abm_backlight;
uint8_t min_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL];
uint8_t max_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL];
uint8_t bright_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL];
uint8_t dark_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL];
uint8_t hybrid_factor[NUM_AGGR_LEVEL];
uint8_t contrast_factor[NUM_AGGR_LEVEL];
uint8_t deviation_gain[NUM_AGGR_LEVEL];
uint8_t min_knee[NUM_AGGR_LEVEL];
uint8_t max_knee[NUM_AGGR_LEVEL];
uint8_t iir_curve[NUM_AMBI_LEVEL];
uint8_t pad3[3];
uint16_t blRampReduction[NUM_AGGR_LEVEL];
uint16_t blRampStart[NUM_AGGR_LEVEL];
};
struct dmub_cmd_abm_set_pipe_data {
uint8_t otg_inst;
uint8_t panel_inst;
uint8_t set_pipe_option;
uint8_t ramping_boundary;
uint8_t pwrseq_inst;
uint8_t pad[3];
};
struct dmub_rb_cmd_abm_set_pipe {
struct dmub_cmd_header header;
struct dmub_cmd_abm_set_pipe_data abm_set_pipe_data;
};
enum dmub_backlight_control_type {
DMU_BACKLIGHT_CONTROL_PWM = 0,
DMU_BACKLIGHT_CONTROL_VESA_AUX = 1,
DMU_BACKLIGHT_CONTROL_AMD_AUX = 2,
};
struct dmub_cmd_abm_set_backlight_data {
uint32_t frame_ramp;
uint32_t backlight_user_level;
uint8_t version;
uint8_t panel_mask;
uint8_t aux_inst;
uint8_t pad[1];
enum dmub_backlight_control_type backlight_control_type;
uint32_t min_luminance;
uint32_t max_luminance;
uint32_t min_backlight_pwm;
uint32_t max_backlight_pwm;
};
struct dmub_rb_cmd_abm_set_backlight {
struct dmub_cmd_header header;
struct dmub_cmd_abm_set_backlight_data abm_set_backlight_data;
};
struct dmub_cmd_abm_set_level_data {
uint32_t level;
uint8_t version;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_abm_set_level {
struct dmub_cmd_header header;
struct dmub_cmd_abm_set_level_data abm_set_level_data;
};
struct dmub_cmd_abm_set_ambient_level_data {
uint32_t ambient_lux;
uint8_t version;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_abm_set_ambient_level {
struct dmub_cmd_header header;
struct dmub_cmd_abm_set_ambient_level_data abm_set_ambient_level_data;
};
struct dmub_cmd_abm_set_pwm_frac_data {
uint32_t fractional_pwm;
uint8_t version;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_abm_set_pwm_frac {
struct dmub_cmd_header header;
struct dmub_cmd_abm_set_pwm_frac_data abm_set_pwm_frac_data;
};
struct dmub_cmd_abm_init_config_data {
union dmub_addr src;
uint16_t bytes;
uint8_t version;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_abm_init_config {
struct dmub_cmd_header header;
struct dmub_cmd_abm_init_config_data abm_init_config_data;
};
struct dmub_cmd_abm_pause_data {
uint8_t panel_mask;
uint8_t otg_inst;
uint8_t enable;
uint8_t pad[1];
};
struct dmub_rb_cmd_abm_pause {
struct dmub_cmd_header header;
struct dmub_cmd_abm_pause_data abm_pause_data;
};
struct dmub_cmd_abm_query_caps_in {
uint8_t panel_inst;
uint8_t pad[3];
};
struct dmub_cmd_abm_query_caps_out {
struct abm_caps sw_caps;
struct abm_caps hw_caps;
};
struct dmub_rb_cmd_abm_query_caps {
struct dmub_cmd_header header;
union {
struct dmub_cmd_abm_query_caps_in abm_query_caps_in;
struct dmub_cmd_abm_query_caps_out abm_query_caps_out;
} data;
};
enum dmub_abm_ace_curve_type {
ABM_ACE_CURVE_TYPE__SW = 0,
ABM_ACE_CURVE_TYPE__SW_IF = 1,
};
enum dmub_abm_histogram_type {
ABM_HISTOGRAM_TYPE__SW = 0,
ABM_HISTOGRAM_TYPE__SW_IF = 1,
};
struct dmub_rb_cmd_abm_get_ace_curve {
struct dmub_cmd_header header;
union dmub_addr dest;
enum dmub_abm_ace_curve_type ace_type;
uint16_t bytes;
uint8_t panel_inst;
uint8_t pad;
};
struct dmub_rb_cmd_abm_get_histogram {
struct dmub_cmd_header header;
union dmub_addr dest;
enum dmub_abm_histogram_type histogram_type;
uint16_t bytes;
uint8_t panel_inst;
uint8_t pad;
};
struct dmub_rb_cmd_abm_save_restore {
struct dmub_cmd_header header;
uint8_t otg_inst;
uint8_t freeze;
uint8_t debug;
struct dmub_cmd_abm_init_config_data abm_init_config_data;
};
struct dmub_cmd_abm_set_event_data {
uint32_t vb_scaling_strength_mapping;
uint8_t vb_scaling_enable;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_abm_set_event {
struct dmub_cmd_header header;
struct dmub_cmd_abm_set_event_data abm_set_event_data;
};
enum dmub_cmd_cacp_type {
DMUB_CMD__CACP_INIT_CONFIG = 0,
DMUB_CMD__CACP_SET_PIPE = 1,
DMUB_CMD__CACP_SET_LEVEL = 2,
DMUB_CMD__CACP_SET_EVENT = 3,
DMUB_CMD__CACP_PAUSE = 4,
DMUB_CMD__CACP_SET_BACKLIGHT = 5,
DMUB_CMD__CACP_SET_PWM_FRAC = 6,
DMUB_CMD__CACP_GET_HISTOGRAM = 7,
DMUB_CMD__CACP_GET_ACE_CURVE_AREA = 8,
};
struct dmub_cmd_cacp_set_pipe_data {
uint8_t otg_inst;
uint8_t panel_inst;
uint8_t set_pipe_option;
uint8_t pwrseq_inst;
};
struct dmub_rb_cmd_cacp_set_pipe {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_set_pipe_data cacp_set_pipe_data;
};
struct dmub_cmd_cacp_set_level_data {
uint32_t level;
uint8_t version;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_cacp_set_level {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_set_level_data cacp_set_level_data;
};
struct dmub_cmd_cacp_set_event_data {
uint8_t full_screen_mode;
uint8_t vb_scaling_enable;
uint8_t hdr_mode;
uint8_t panel_mask;
uint32_t trans_info;
};
struct dmub_rb_cmd_cacp_set_event {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_set_event_data cacp_set_event_data;
};
struct dmub_cmd_cacp_init_config_data {
union dmub_addr src;
uint16_t bytes;
uint8_t mode;
uint8_t panel_mask;
uint32_t visual_confirm;
uint8_t strscl_valid;
uint8_t pad[3];
uint8_t strscl_sdr[4];
uint8_t strscl_hdr[4];
};
struct dmub_rb_cmd_cacp_init_config {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_init_config_data cacp_init_config_data;
};
struct dmub_cmd_cacp_pause_data {
uint8_t panel_mask;
uint8_t otg_inst;
uint8_t enable;
uint8_t pad;
};
struct dmub_rb_cmd_cacp_pause {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_pause_data cacp_pause_data;
};
struct dmub_cmd_cacp_set_backlight_data {
uint32_t frame_ramp;
uint32_t backlight_user_level;
uint8_t version;
uint8_t panel_mask;
uint8_t aux_inst;
uint8_t pad[1];
enum dmub_backlight_control_type backlight_control_type;
uint32_t min_luminance;
uint32_t max_luminance;
uint32_t min_backlight_pwm;
uint32_t max_backlight_pwm;
};
struct dmub_rb_cmd_cacp_set_backlight {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_set_backlight_data cacp_set_backlight_data;
};
struct dmub_cmd_cacp_set_pwm_frac_data {
uint32_t fractional_pwm;
uint8_t version;
uint8_t panel_mask;
uint8_t pad[2];
};
struct dmub_rb_cmd_cacp_set_pwm_frac {
struct dmub_cmd_header header;
struct dmub_cmd_cacp_set_pwm_frac_data cacp_set_pwm_frac_data;
};
struct dmub_rb_cmd_cacp_get_histogram {
struct dmub_cmd_header header;
union dmub_addr dest;
enum dmub_abm_histogram_type histogram_type;
uint16_t bytes;
uint8_t panel_inst;
uint8_t pad;
};
struct dmub_cmd_cacp_get_ace_curve_area_in {
uint8_t panel_inst;
uint8_t pad[3];
};
struct dmub_cmd_cacp_get_ace_curve_area_out {
uint32_t area;
};
struct dmub_rb_cmd_cacp_get_ace_curve_area {
struct dmub_cmd_header header;
union {
struct dmub_cmd_cacp_get_ace_curve_area_in in;
struct dmub_cmd_cacp_get_ace_curve_area_out out;
} data;
};
struct dmub_cmd_query_feature_caps_data {
struct dmub_feature_caps feature_caps;
};
struct dmub_rb_cmd_query_feature_caps {
struct dmub_cmd_header header;
struct dmub_cmd_query_feature_caps_data query_feature_caps_data;
};
struct dmub_cmd_visual_confirm_color_data {
struct dmub_visual_confirm_color visual_confirm_color;
};
struct dmub_rb_cmd_get_visual_confirm_color {
struct dmub_cmd_header header;
struct dmub_cmd_visual_confirm_color_data visual_confirm_color_data;
};
enum dmub_cmd_panel_cntl_type {
DMUB_CMD__PANEL_CNTL_HW_INIT = 0,
DMUB_CMD__PANEL_CNTL_QUERY_BACKLIGHT_INFO = 1,
DMUB_CMD__PANEL_DEBUG_PWM_FREQ = 2,
};
struct dmub_cmd_panel_cntl_data {
uint32_t pwrseq_inst;
uint32_t current_backlight;
uint32_t bl_pwm_cntl;
uint32_t bl_pwm_period_cntl;
uint32_t bl_pwm_ref_div1;
uint8_t is_backlight_on : 1;
uint8_t is_powered_on : 1;
uint8_t padding[3];
uint32_t bl_pwm_ref_div2;
uint8_t reserved[4];
};
struct dmub_rb_cmd_panel_cntl {
struct dmub_cmd_header header;
struct dmub_cmd_panel_cntl_data data;
};
struct dmub_optc_state {
uint32_t v_total_max;
uint32_t v_total_min;
uint32_t tg_inst;
};
struct dmub_rb_cmd_drr_update {
struct dmub_cmd_header header;
struct dmub_optc_state dmub_optc_state_req;
};
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data {
uint32_t pix_clk_100hz;
uint8_t max_ramp_step;
uint8_t pipes;
uint8_t min_refresh_in_hz;
uint8_t pipe_count;
uint8_t pipe_index[4];
};
struct dmub_cmd_fw_assisted_mclk_switch_config {
uint8_t fams_enabled;
uint8_t visual_confirm_enabled;
uint16_t vactive_stretch_margin_us;
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data pipe_data[DMUB_MAX_FPO_STREAMS];
};
struct dmub_rb_cmd_fw_assisted_mclk_switch {
struct dmub_cmd_header header;
struct dmub_cmd_fw_assisted_mclk_switch_config config_data;
};
struct dmub_cmd_lvtma_control_data {
uint8_t uc_pwr_action;
uint8_t bypass_panel_control_wait;
uint8_t reserved_0[2];
uint8_t pwrseq_inst;
uint8_t reserved_1[3];
};
struct dmub_rb_cmd_lvtma_control {
struct dmub_cmd_header header;
struct dmub_cmd_lvtma_control_data data;
};
struct dmub_rb_cmd_transmitter_query_dp_alt_data {
uint8_t phy_id;
uint8_t is_usb;
uint8_t is_dp_alt_disable;
uint8_t is_dp4;
};
struct dmub_rb_cmd_transmitter_query_dp_alt {
struct dmub_cmd_header header;
struct dmub_rb_cmd_transmitter_query_dp_alt_data data;
};
struct phy_test_mode {
uint8_t mode;
uint8_t pat0;
uint8_t pad[2];
};
struct dmub_rb_cmd_transmitter_set_phy_fsm_data {
uint8_t phy_id;
uint8_t mode;
uint8_t lane_num;
uint32_t symclk_100Hz;
struct phy_test_mode test_mode;
enum dmub_phy_fsm_state state;
uint32_t status;
uint8_t pad;
};
struct dmub_rb_cmd_transmitter_set_phy_fsm {
struct dmub_cmd_header header;
struct dmub_rb_cmd_transmitter_set_phy_fsm_data data;
};
struct dmub_cmd_cable_id_input {
uint8_t phy_inst;
};
struct dmub_cmd_cable_id_output {
uint8_t UHBR10_20_CAPABILITY :2;
uint8_t UHBR13_5_CAPABILITY :1;
uint8_t CABLE_TYPE :3;
uint8_t RESERVED :2;
};
struct dmub_rb_cmd_get_usbc_cable_id {
struct dmub_cmd_header header;
union dmub_cmd_cable_id_data {
struct dmub_cmd_cable_id_input input;
struct dmub_cmd_cable_id_output output;
uint8_t output_raw;
} data;
};
enum dmub_cmd_fused_io_sub_type {
DMUB_CMD__FUSED_IO_EXECUTE = 0,
DMUB_CMD__FUSED_IO_ABORT = 1,
};
enum dmub_cmd_fused_request_type {
FUSED_REQUEST_READ,
FUSED_REQUEST_WRITE,
FUSED_REQUEST_POLL,
};
enum dmub_cmd_fused_request_status {
FUSED_REQUEST_STATUS_SUCCESS,
FUSED_REQUEST_STATUS_BEGIN,
FUSED_REQUEST_STATUS_SUBMIT,
FUSED_REQUEST_STATUS_REPLY,
FUSED_REQUEST_STATUS_POLL,
FUSED_REQUEST_STATUS_ABORTED,
FUSED_REQUEST_STATUS_FAILED = 0x80,
FUSED_REQUEST_STATUS_INVALID,
FUSED_REQUEST_STATUS_BUSY,
FUSED_REQUEST_STATUS_TIMEOUT,
FUSED_REQUEST_STATUS_POLL_TIMEOUT,
};
struct dmub_cmd_fused_request {
uint8_t status;
uint8_t type : 2;
uint8_t _reserved0 : 3;
uint8_t poll_mask_msb : 3;
uint8_t identifier;
uint8_t _reserved1;
uint32_t timeout_us;
union dmub_cmd_fused_request_location {
struct dmub_cmd_fused_request_location_i2c {
uint8_t is_aux : 1;
uint8_t ddc_line : 3;
uint8_t over_aux : 1;
uint8_t _reserved0 : 3;
uint8_t address;
uint8_t offset;
uint8_t length;
} i2c;
struct dmub_cmd_fused_request_location_aux {
uint32_t is_aux : 1;
uint32_t ddc_line : 3;
uint32_t address : 20;
uint32_t length : 8;
} aux;
} u;
uint8_t buffer[0x30];
};
struct dmub_rb_cmd_fused_io {
struct dmub_cmd_header header;
struct dmub_cmd_fused_request request;
};
enum dmub_cmd_secure_display_type {
DMUB_CMD__SECURE_DISPLAY_TEST_CMD = 0,
DMUB_CMD__SECURE_DISPLAY_CRC_STOP_UPDATE,
DMUB_CMD__SECURE_DISPLAY_CRC_WIN_NOTIFY,
DMUB_CMD__SECURE_DISPLAY_MULTIPLE_CRC_STOP_UPDATE,
DMUB_CMD__SECURE_DISPLAY_MULTIPLE_CRC_WIN_NOTIFY
};
#define MAX_ROI_NUM 2
struct dmub_cmd_roi_info {
uint16_t x_start;
uint16_t x_end;
uint16_t y_start;
uint16_t y_end;
uint8_t otg_id;
uint8_t phy_id;
};
struct dmub_cmd_roi_window_ctl {
uint16_t x_start;
uint16_t x_end;
uint16_t y_start;
uint16_t y_end;
bool enable;
};
struct dmub_cmd_roi_ctl_info {
uint8_t otg_id;
uint8_t phy_id;
struct dmub_cmd_roi_window_ctl roi_ctl[MAX_ROI_NUM];
};
struct dmub_rb_cmd_secure_display {
struct dmub_cmd_header header;
struct dmub_cmd_roi_info roi_info;
struct dmub_cmd_roi_ctl_info mul_roi_ctl;
};
enum dmub_cmd_psp_type {
DMUB_CMD__PSP_ASSR_ENABLE = 0
};
struct dmub_cmd_assr_enable_data {
uint8_t enable;
uint8_t phy_port_type;
uint8_t phy_port_id;
uint8_t link_enc_index;
uint8_t hpo_mode;
uint8_t reserved[7];
};
struct dmub_rb_cmd_assr_enable {
struct dmub_cmd_header header;
struct dmub_cmd_assr_enable_data assr_data;
uint32_t reserved[3];
};
enum ips_residency_mode {
IPS_RESIDENCY__IPS1_MAX,
IPS_RESIDENCY__IPS2,
IPS_RESIDENCY__IPS1_RCG,
IPS_RESIDENCY__IPS1_ONO2_ON,
IPS_RESIDENCY__IPS1_Z8_RETENTION,
IPS_RESIDENCY__PG_ONO_LAST_SEEN_IN_IPS,
IPS_RESIDENCY__PG_ONO_CURRENT_STATE
};
#define NUM_IPS_HISTOGRAM_BUCKETS 16
struct dmub_ips_residency_info {
uint32_t residency_millipercent;
uint32_t entry_counter;
uint32_t histogram[NUM_IPS_HISTOGRAM_BUCKETS];
uint64_t total_time_us;
uint64_t total_inactive_time_us;
uint32_t ono_pg_state_at_collection;
uint32_t ono_pg_state_last_seen_in_ips;
};
struct dmub_cmd_ips_residency_cntl_data {
uint8_t panel_inst;
uint8_t start_measurement;
uint8_t padding[2];
};
struct dmub_rb_cmd_ips_residency_cntl {
struct dmub_cmd_header header;
struct dmub_cmd_ips_residency_cntl_data cntl_data;
};
struct dmub_cmd_dc_bls_dchvm_init_data {
uint32_t riommu_pctrl_val;
};
struct dmub_rb_cmd_dc_bls_dchvm_init {
struct dmub_cmd_header header;
struct dmub_cmd_dc_bls_dchvm_init_data data;
};
struct dmub_cmd_ips_query_residency_info_data {
union dmub_addr dest;
uint32_t size;
uint32_t ips_mode;
uint8_t panel_inst;
uint8_t padding[3];
};
struct dmub_rb_cmd_ips_query_residency_info {
struct dmub_cmd_header header;
struct dmub_cmd_ips_query_residency_info_data info_data;
};
struct dmub_cmd_cursor_offload_init_data {
union dmub_addr state_addr;
uint32_t state_size;
};
struct dmub_rb_cmd_cursor_offload_init {
struct dmub_cmd_header header;
struct dmub_cmd_cursor_offload_init_data init_data;
};
struct dmub_cmd_cursor_offload_stream_data {
uint32_t otg_inst: 4;
uint32_t reserved: 28;
uint32_t line_time_in_ns;
uint32_t v_total_max;
};
struct dmub_rb_cmd_cursor_offload_stream_cntl {
struct dmub_cmd_header header;
struct dmub_cmd_cursor_offload_stream_data data;
};
struct dmub_cmd_pr_enable_data {
uint8_t enable;
uint8_t panel_inst;
uint8_t phy_fsm_state;
uint8_t phy_rate;
uint8_t hpo_stream_enc_inst;
uint8_t hpo_link_enc_inst;
uint8_t pad[2];
};
struct dmub_cmd_panel_polarity_enable_data {
uint8_t enable;
uint8_t otg_inst;
uint8_t pad[2];
};
struct dmub_cmd_panel_polarity_reset_data {
uint8_t otg_inst;
uint8_t pad[3];
};
struct dmub_cmd_panel_polarity_get_bias_input {
uint8_t otg_inst;
uint8_t pad[3];
};
struct dmub_cmd_panel_polarity_get_bias_output {
int32_t accumulated_bias;
};
struct dmub_rb_cmd_panel_polarity_enable {
struct dmub_cmd_header header;
struct dmub_cmd_panel_polarity_enable_data data;
};
struct dmub_rb_cmd_panel_polarity_get_bias {
struct dmub_cmd_header header;
union dmub_cmd_panel_polarity_get_bias_data {
struct dmub_cmd_panel_polarity_get_bias_input input;
struct dmub_cmd_panel_polarity_get_bias_output output;
uint32_t output_raw;
} data;
};
struct dmub_rb_cmd_panel_polarity_reset {
struct dmub_cmd_header header;
struct dmub_cmd_panel_polarity_reset_data data;
};
struct dmub_rb_cmd_pr_enable {
struct dmub_cmd_header header;
struct dmub_cmd_pr_enable_data data;
};
struct dmub_cmd_pr_copy_settings_data {
union pr_debug_flags debug;
union pr_hw_flags flags;
uint8_t dpp_inst;
uint8_t otg_inst;
uint8_t digfe_inst;
uint8_t digbe_inst;
uint8_t aux_inst;
uint8_t panel_inst;
uint8_t dpphy_inst;
uint8_t smu_optimizations_en;
uint32_t line_time_in_ns;
uint32_t pix_clk_100hz;
uint32_t sink_pix_clk_100hz;
struct dmub_alpm_auxless_data auxless_alpm_data;
uint16_t dsc_slice_height;
uint8_t use_phy_fsm;
uint8_t hpo_stream_enc_inst;
uint8_t hpo_link_enc_inst;
uint8_t su_granularity_needed;
uint16_t su_x_granularity;
uint16_t su_y_granularity_extended_caps;
uint8_t su_y_granularity;
uint8_t main_link_activity_option;
};
struct dmub_rb_cmd_pr_copy_settings {
struct dmub_cmd_header header;
struct dmub_cmd_pr_copy_settings_data data;
};
union dmub_pr_runtime_flags {
struct {
uint32_t disable_abm_optimization : 1;
uint32_t abm_periodic_ffu_allowed : 1;
} bitfields;
uint32_t u32All;
};
struct dmub_cmd_pr_update_state_data {
uint8_t panel_inst;
uint8_t pad[3];
uint32_t update_flag;
uint32_t coasting_vtotal;
uint32_t sync_mode;
uint32_t pseudo_vtotal;
union dmub_pr_runtime_flags pr_runtime_flags;
};
struct dmub_cmd_pr_general_cmd_data {
uint8_t panel_inst;
uint8_t subtype;
uint8_t pad[2];
union {
uint32_t u32All;
} data;
};
struct dmub_rb_cmd_pr_update_state {
struct dmub_cmd_header header;
struct dmub_cmd_pr_update_state_data data;
};
struct dmub_rb_cmd_pr_general_cmd {
struct dmub_cmd_header header;
struct dmub_cmd_pr_general_cmd_data data;
};
enum dmub_cmd_boot_time_crc_type {
DMUB_CMD__BOOT_TIME_CRC_INIT_MEM = 0
};
struct dmub_cmd_boot_time_crc_init_data {
union dmub_addr buffer_addr;
uint32_t buffer_size;
};
struct dmub_rb_cmd_boot_time_crc_init {
struct dmub_cmd_header header;
struct dmub_cmd_boot_time_crc_init_data data;
};
union dmub_rb_cmd {
struct dmub_rb_cmd_common cmd_common;
struct dmub_rb_cmd_digx_encoder_control digx_encoder_control;
struct dmub_rb_cmd_set_pixel_clock set_pixel_clock;
struct dmub_rb_cmd_enable_disp_power_gating enable_disp_power_gating;
struct dmub_rb_cmd_dpphy_init dpphy_init;
struct dmub_rb_cmd_dig1_transmitter_control dig1_transmitter_control;
struct dmub_rb_cmd_domain_control domain_control;
struct dmub_rb_cmd_psr_set_version psr_set_version;
struct dmub_rb_cmd_psr_copy_settings psr_copy_settings;
struct dmub_rb_cmd_psr_enable psr_enable;
struct dmub_rb_cmd_psr_set_level psr_set_level;
struct dmub_rb_cmd_psr_force_static psr_force_static;
struct dmub_rb_cmd_update_dirty_rect update_dirty_rect;
struct dmub_rb_cmd_update_cursor_info update_cursor_info;
struct dmub_rb_cmd_lock_hw lock_hw;
struct dmub_rb_cmd_psr_set_vtotal psr_set_vtotal;
struct dmub_rb_cmd_psr_set_power_opt psr_set_power_opt;
struct dmub_rb_cmd_PLAT_54186_wa PLAT_54186_wa;
struct dmub_rb_cmd_mall mall;
struct dmub_rb_cmd_cab_for_ss cab;
struct dmub_rb_cmd_fw_assisted_mclk_switch_v2 fw_assisted_mclk_switch_v2;
struct dmub_rb_cmd_idle_opt_dcn_restore dcn_restore;
struct dmub_rb_cmd_clk_mgr_notify_clocks notify_clocks;
struct dmub_rb_cmd_panel_cntl panel_cntl;
struct dmub_rb_cmd_abm_set_pipe abm_set_pipe;
struct dmub_rb_cmd_abm_set_backlight abm_set_backlight;
struct dmub_rb_cmd_abm_set_level abm_set_level;
struct dmub_rb_cmd_abm_set_ambient_level abm_set_ambient_level;
struct dmub_rb_cmd_abm_set_pwm_frac abm_set_pwm_frac;
struct dmub_rb_cmd_abm_init_config abm_init_config;
struct dmub_rb_cmd_abm_pause abm_pause;
struct dmub_rb_cmd_abm_save_restore abm_save_restore;
struct dmub_rb_cmd_abm_query_caps abm_query_caps;
struct dmub_rb_cmd_abm_get_ace_curve abm_get_ace_curve;
struct dmub_rb_cmd_abm_get_histogram abm_get_histogram;
struct dmub_rb_cmd_abm_set_event abm_set_event;
struct dmub_rb_cmd_dp_aux_access dp_aux_access;
struct dmub_rb_cmd_outbox1_enable outbox1_enable;
struct dmub_rb_cmd_query_feature_caps query_feature_caps;
struct dmub_rb_cmd_get_visual_confirm_color visual_confirm_color;
struct dmub_rb_cmd_drr_update drr_update;
struct dmub_rb_cmd_fw_assisted_mclk_switch fw_assisted_mclk_switch;
struct dmub_rb_cmd_lvtma_control lvtma_control;
struct dmub_rb_cmd_transmitter_query_dp_alt query_dp_alt;
struct dmub_rb_cmd_transmitter_set_phy_fsm set_phy_fsm;
struct dmub_rb_cmd_dig1_dpia_control dig1_dpia_control;
struct dmub_rb_cmd_set_config_access set_config_access;
struct dmub_rb_cmd_set_config_request set_config_request;
struct dmub_rb_cmd_set_mst_alloc_slots set_mst_alloc_slots;
struct dmub_rb_cmd_set_tps_notification set_tps_notification;
struct dmub_rb_cmd_get_usbc_cable_id cable_id;
struct dmub_rb_cmd_query_hpd_state query_hpd;
struct dmub_rb_cmd_nbif_az_pme_restore nbif_az_pme_restore;
struct dmub_rb_cmd_secure_display secure_display;
struct dmub_rb_cmd_dpia_hpd_int_enable dpia_hpd_int_enable;
struct dmub_rb_cmd_cacp_set_pipe cacp_set_pipe;
struct dmub_rb_cmd_cacp_set_level cacp_set_level;
struct dmub_rb_cmd_cacp_set_event cacp_set_event;
struct dmub_rb_cmd_cacp_init_config cacp_init_config;
struct dmub_rb_cmd_cacp_pause cacp_pause;
struct dmub_rb_cmd_cacp_set_backlight cacp_set_backlight;
struct dmub_rb_cmd_cacp_set_pwm_frac cacp_set_pwm_frac;
struct dmub_rb_cmd_cacp_get_histogram cacp_get_histogram;
struct dmub_rb_cmd_cacp_get_ace_curve_area cacp_get_ace_curve_area;
struct dmub_rb_cmd_idle_opt_dcn_notify_idle idle_opt_notify_idle;
struct dmub_rb_cmd_idle_opt_set_dc_power_state idle_opt_set_dc_power_state;
struct dmub_rb_cmd_replay_copy_settings replay_copy_settings;
struct dmub_rb_cmd_replay_enable replay_enable;
struct dmub_rb_cmd_replay_set_power_opt replay_set_power_opt;
struct dmub_rb_cmd_replay_set_coasting_vtotal replay_set_coasting_vtotal;
struct dmub_rb_cmd_replay_set_power_opt_and_coasting_vtotal replay_set_power_opt_and_coasting_vtotal;
struct dmub_rb_cmd_replay_set_timing_sync replay_set_timing_sync;
struct dmub_rb_cmd_replay_set_frameupdate_timer replay_set_frameupdate_timer;
struct dmub_rb_cmd_replay_set_pseudo_vtotal replay_set_pseudo_vtotal;
struct dmub_rb_cmd_replay_disabled_adaptive_sync_sdp replay_disabled_adaptive_sync_sdp;
struct dmub_rb_cmd_replay_set_general_cmd replay_set_general_cmd;
struct dmub_rb_cmd_assr_enable assr_enable;
struct dmub_rb_cmd_fams2 fams2_config;
struct dmub_rb_cmd_ib ib_fams2_config;
struct dmub_rb_cmd_ib ib_fams2_debug_meta;
struct dmub_rb_cmd_fams2_drr_update fams2_drr_update;
struct dmub_rb_cmd_fams2_flip fams2_flip;
struct dmub_rb_cmd_fused_io fused_io;
struct dmub_rb_cmd_lsdma lsdma;
struct dmub_rb_cmd_ips_residency_cntl ips_residency_cntl;
struct dmub_rb_cmd_ips_query_residency_info ips_query_residency_info;
struct dmub_rb_cmd_cursor_offload_init cursor_offload_init;
struct dmub_rb_cmd_cursor_offload_stream_cntl cursor_offload_stream_ctnl;
struct dmub_rb_cmd_smart_power_oled_enable smart_power_oled_enable;
struct dmub_rb_cmd_smart_power_oled_getmaxcll smart_power_oled_getmaxcll;
struct dmub_rb_cmd_pr_copy_settings pr_copy_settings;
struct dmub_rb_cmd_pr_enable pr_enable;
struct dmub_rb_cmd_pr_update_state pr_update_state;
struct dmub_rb_cmd_pr_general_cmd pr_general_cmd;
struct dmub_rb_cmd_ihc ihc;
struct dmub_rb_cmd_boot_time_crc_init boot_time_crc_init;
struct dmub_rb_cmd_panel_polarity_enable panel_polarity_enable;
struct dmub_rb_cmd_panel_polarity_get_bias panel_polarity_get_bias;
struct dmub_rb_cmd_panel_polarity_reset panel_polarity_reset;
struct dmub_rb_cmd_dc_bls_dchvm_init dc_bls_dchvm_init;
};
union dmub_rb_out_cmd {
struct dmub_rb_cmd_common cmd_common;
struct dmub_rb_cmd_dp_aux_reply dp_aux_reply;
struct dmub_rb_cmd_dp_hpd_notify dp_hpd_notify;
struct dmub_rb_cmd_dp_set_config_reply set_config_reply;
struct dmub_rb_cmd_dpia_notification dpia_notification;
struct dmub_rb_cmd_hpd_sense_notify hpd_sense_notify;
struct dmub_rb_cmd_fused_io fused_io;
};
#pragma pack(pop)
struct dmub_rb_init_params {
void *ctx;
void *base_address;
uint32_t capacity;
uint32_t read_ptr;
uint32_t write_ptr;
};
struct dmub_rb {
void *base_address;
uint32_t rptr;
uint32_t wrpt;
uint32_t capacity;
void *ctx;
void *dmub;
};
static inline bool dmub_rb_empty(struct dmub_rb *rb)
{
return (rb->wrpt == rb->rptr);
}
static inline uint32_t dmub_rb_num_outstanding(struct dmub_rb *rb)
{
uint32_t data_count;
if (rb->wrpt >= rb->rptr)
data_count = rb->wrpt - rb->rptr;
else
data_count = rb->capacity - (rb->rptr - rb->wrpt);
return data_count / DMUB_RB_CMD_SIZE;
}
static inline uint32_t dmub_rb_num_free(struct dmub_rb *rb)
{
uint32_t data_count;
if (rb->wrpt >= rb->rptr)
data_count = rb->wrpt - rb->rptr;
else
data_count = rb->capacity - (rb->rptr - rb->wrpt);
data_count += DMUB_RB_CMD_SIZE;
return (rb->capacity - data_count) / DMUB_RB_CMD_SIZE;
}
static inline bool dmub_rb_full(struct dmub_rb *rb)
{
uint32_t data_count;
if (rb->wrpt >= rb->rptr)
data_count = rb->wrpt - rb->rptr;
else
data_count = rb->capacity - (rb->rptr - rb->wrpt);
return (data_count == (rb->capacity - DMUB_RB_CMD_SIZE));
}
static inline bool dmub_rb_push_front(struct dmub_rb *rb,
const union dmub_rb_cmd *cmd)
{
uint8_t *dst = (uint8_t *)(rb->base_address) + rb->wrpt;
const uint8_t *src = (const uint8_t *)cmd;
uint8_t i;
if (rb->capacity == 0)
return false;
if (dmub_rb_full(rb))
return false;
for (i = 0; i < DMUB_RB_CMD_SIZE; i++)
*dst++ = *src++;
rb->wrpt += DMUB_RB_CMD_SIZE;
if (rb->wrpt >= rb->capacity)
rb->wrpt %= rb->capacity;
return true;
}
static inline bool dmub_rb_out_push_front(struct dmub_rb *rb,
const union dmub_rb_out_cmd *cmd)
{
uint8_t *dst = (uint8_t *)(rb->base_address) + rb->wrpt;
const uint8_t *src = (const uint8_t *)cmd;
if (rb->capacity == 0)
return false;
if (dmub_rb_full(rb))
return false;
dmub_memcpy(dst, src, DMUB_RB_CMD_SIZE);
rb->wrpt += DMUB_RB_CMD_SIZE;
if (rb->wrpt >= rb->capacity)
rb->wrpt %= rb->capacity;
return true;
}
static inline bool dmub_rb_front(struct dmub_rb *rb,
union dmub_rb_cmd **cmd)
{
uint8_t *rb_cmd = (uint8_t *)(rb->base_address) + rb->rptr;
if (dmub_rb_empty(rb))
return false;
*cmd = (union dmub_rb_cmd *)rb_cmd;
return true;
}
static inline void dmub_rb_get_rptr_with_offset(struct dmub_rb *rb,
uint32_t num_cmds,
uint32_t *next_rptr)
{
if (rb->capacity == 0)
return;
*next_rptr = rb->rptr + DMUB_RB_CMD_SIZE * num_cmds;
if (*next_rptr >= rb->capacity)
*next_rptr %= rb->capacity;
}
static inline bool dmub_rb_peek_offset(struct dmub_rb *rb,
union dmub_rb_cmd **cmd,
uint32_t rptr)
{
uint8_t *rb_cmd = (uint8_t *)(rb->base_address) + rptr;
if (dmub_rb_empty(rb))
return false;
*cmd = (union dmub_rb_cmd *)rb_cmd;
return true;
}
static inline bool dmub_rb_out_front(struct dmub_rb *rb,
union dmub_rb_out_cmd *cmd)
{
const uint64_t volatile *src = (const uint64_t volatile *)((uint8_t *)(rb->base_address) + rb->rptr);
uint64_t *dst = (uint64_t *)cmd;
uint8_t i;
if (dmub_rb_empty(rb))
return false;
for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
*dst++ = *src++;
return true;
}
static inline bool dmub_rb_pop_front(struct dmub_rb *rb)
{
if (rb->capacity == 0)
return false;
if (dmub_rb_empty(rb))
return false;
rb->rptr += DMUB_RB_CMD_SIZE;
if (rb->rptr >= rb->capacity)
rb->rptr %= rb->capacity;
return true;
}
static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
{
uint32_t rptr = rb->rptr;
uint32_t wptr = rb->wrpt;
if (rb->capacity == 0)
return;
while (rptr != wptr) {
uint64_t *data = (uint64_t *)((uint8_t *)(rb->base_address) + rptr);
uint8_t i;
for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
(void)READ_ONCE(*data++);
rptr += DMUB_RB_CMD_SIZE;
if (rptr >= rb->capacity)
rptr %= rb->capacity;
}
}
static inline void dmub_rb_init(struct dmub_rb *rb,
struct dmub_rb_init_params *init_params)
{
rb->base_address = init_params->base_address;
rb->capacity = init_params->capacity;
rb->rptr = init_params->read_ptr;
rb->wrpt = init_params->write_ptr;
}
static inline void dmub_rb_get_return_data(struct dmub_rb *rb,
union dmub_rb_cmd *cmd)
{
uint8_t *rd_ptr = (rb->rptr == 0) ?
(uint8_t *)rb->base_address + rb->capacity - DMUB_RB_CMD_SIZE :
(uint8_t *)rb->base_address + rb->rptr - DMUB_RB_CMD_SIZE;
dmub_memcpy(cmd, rd_ptr, DMUB_RB_CMD_SIZE);
}
#endif /* _DMUB_CMD_H_ */