i915_reg.h 386 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930
  1. /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  2. * All Rights Reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the
  6. * "Software"), to deal in the Software without restriction, including
  7. * without limitation the rights to use, copy, modify, merge, publish,
  8. * distribute, sub license, and/or sell copies of the Software, and to
  9. * permit persons to whom the Software is furnished to do so, subject to
  10. * the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the
  13. * next paragraph) shall be included in all copies or substantial portions
  14. * of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  19. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
  20. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24. #ifndef _I915_REG_H_
  25. #define _I915_REG_H_
  26. /**
  27. * DOC: The i915 register macro definition style guide
  28. *
  29. * Follow the style described here for new macros, and while changing existing
  30. * macros. Do **not** mass change existing definitions just to update the style.
  31. *
  32. * Layout
  33. * ''''''
  34. *
  35. * Keep helper macros near the top. For example, _PIPE() and friends.
  36. *
  37. * Prefix macros that generally should not be used outside of this file with
  38. * underscore '_'. For example, _PIPE() and friends, single instances of
  39. * registers that are defined solely for the use by function-like macros.
  40. *
  41. * Avoid using the underscore prefixed macros outside of this file. There are
  42. * exceptions, but keep them to a minimum.
  43. *
  44. * There are two basic types of register definitions: Single registers and
  45. * register groups. Register groups are registers which have two or more
  46. * instances, for example one per pipe, port, transcoder, etc. Register groups
  47. * should be defined using function-like macros.
  48. *
  49. * For single registers, define the register offset first, followed by register
  50. * contents.
  51. *
  52. * For register groups, define the register instance offsets first, prefixed
  53. * with underscore, followed by a function-like macro choosing the right
  54. * instance based on the parameter, followed by register contents.
  55. *
  56. * Define the register contents (i.e. bit and bit field macros) from most
  57. * significant to least significant bit. Indent the register content macros
  58. * using two extra spaces between ``#define`` and the macro name.
  59. *
  60. * For bit fields, define a ``_MASK`` and a ``_SHIFT`` macro. Define bit field
  61. * contents so that they are already shifted in place, and can be directly
  62. * OR'd. For convenience, function-like macros may be used to define bit fields,
  63. * but do note that the macros may be needed to read as well as write the
  64. * register contents.
  65. *
  66. * Define bits using ``(1 << N)`` instead of ``BIT(N)``. We may change this in
  67. * the future, but this is the prevailing style. Do **not** add ``_BIT`` suffix
  68. * to the name.
  69. *
  70. * Group the register and its contents together without blank lines, separate
  71. * from other registers and their contents with one blank line.
  72. *
  73. * Indent macro values from macro names using TABs. Align values vertically. Use
  74. * braces in macro values as needed to avoid unintended precedence after macro
  75. * substitution. Use spaces in macro values according to kernel coding
  76. * style. Use lower case in hexadecimal values.
  77. *
  78. * Naming
  79. * ''''''
  80. *
  81. * Try to name registers according to the specs. If the register name changes in
  82. * the specs from platform to another, stick to the original name.
  83. *
  84. * Try to re-use existing register macro definitions. Only add new macros for
  85. * new register offsets, or when the register contents have changed enough to
  86. * warrant a full redefinition.
  87. *
  88. * When a register macro changes for a new platform, prefix the new macro using
  89. * the platform acronym or generation. For example, ``SKL_`` or ``GEN8_``. The
  90. * prefix signifies the start platform/generation using the register.
  91. *
  92. * When a bit (field) macro changes or gets added for a new platform, while
  93. * retaining the existing register macro, add a platform acronym or generation
  94. * suffix to the name. For example, ``_SKL`` or ``_GEN8``.
  95. *
  96. * Examples
  97. * ''''''''
  98. *
  99. * (Note that the values in the example are indented using spaces instead of
  100. * TABs to avoid misalignment in generated documentation. Use TABs in the
  101. * definitions.)::
  102. *
  103. * #define _FOO_A 0xf000
  104. * #define _FOO_B 0xf001
  105. * #define FOO(pipe) _MMIO_PIPE(pipe, _FOO_A, _FOO_B)
  106. * #define FOO_ENABLE (1 << 31)
  107. * #define FOO_MODE_MASK (0xf << 16)
  108. * #define FOO_MODE_SHIFT 16
  109. * #define FOO_MODE_BAR (0 << 16)
  110. * #define FOO_MODE_BAZ (1 << 16)
  111. * #define FOO_MODE_QUX_SNB (2 << 16)
  112. *
  113. * #define BAR _MMIO(0xb000)
  114. * #define GEN8_BAR _MMIO(0xb888)
  115. */
  116. typedef struct {
  117. uint32_t reg;
  118. } i915_reg_t;
  119. #define _MMIO(r) ((const i915_reg_t){ .reg = (r) })
  120. #define INVALID_MMIO_REG _MMIO(0)
  121. static inline uint32_t i915_mmio_reg_offset(i915_reg_t reg)
  122. {
  123. return reg.reg;
  124. }
  125. static inline bool i915_mmio_reg_equal(i915_reg_t a, i915_reg_t b)
  126. {
  127. return i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b);
  128. }
  129. static inline bool i915_mmio_reg_valid(i915_reg_t reg)
  130. {
  131. return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
  132. }
  133. #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
  134. #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
  135. #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
  136. #define _PLANE(plane, a, b) _PIPE(plane, a, b)
  137. #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
  138. #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
  139. #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
  140. #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
  141. #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
  142. #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
  143. #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
  144. #define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
  145. #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
  146. #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
  147. #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
  148. #define _MASKED_FIELD(mask, value) ({ \
  149. if (__builtin_constant_p(mask)) \
  150. BUILD_BUG_ON_MSG(((mask) & 0xffff0000), "Incorrect mask"); \
  151. if (__builtin_constant_p(value)) \
  152. BUILD_BUG_ON_MSG((value) & 0xffff0000, "Incorrect value"); \
  153. if (__builtin_constant_p(mask) && __builtin_constant_p(value)) \
  154. BUILD_BUG_ON_MSG((value) & ~(mask), \
  155. "Incorrect value for mask"); \
  156. (mask) << 16 | (value); })
  157. #define _MASKED_BIT_ENABLE(a) ({ typeof(a) _a = (a); _MASKED_FIELD(_a, _a); })
  158. #define _MASKED_BIT_DISABLE(a) (_MASKED_FIELD((a), 0))
  159. /* Engine ID */
  160. #define RCS_HW 0
  161. #define VCS_HW 1
  162. #define BCS_HW 2
  163. #define VECS_HW 3
  164. #define VCS2_HW 4
  165. #define VCS3_HW 6
  166. #define VCS4_HW 7
  167. #define VECS2_HW 12
  168. /* Engine class */
  169. #define RENDER_CLASS 0
  170. #define VIDEO_DECODE_CLASS 1
  171. #define VIDEO_ENHANCEMENT_CLASS 2
  172. #define COPY_ENGINE_CLASS 3
  173. #define OTHER_CLASS 4
  174. #define MAX_ENGINE_CLASS 4
  175. #define OTHER_GTPM_INSTANCE 1
  176. #define MAX_ENGINE_INSTANCE 3
  177. /* PCI config space */
  178. #define MCHBAR_I915 0x44
  179. #define MCHBAR_I965 0x48
  180. #define MCHBAR_SIZE (4 * 4096)
  181. #define DEVEN 0x54
  182. #define DEVEN_MCHBAR_EN (1 << 28)
  183. /* BSM in include/drm/i915_drm.h */
  184. #define HPLLCC 0xc0 /* 85x only */
  185. #define GC_CLOCK_CONTROL_MASK (0x7 << 0)
  186. #define GC_CLOCK_133_200 (0 << 0)
  187. #define GC_CLOCK_100_200 (1 << 0)
  188. #define GC_CLOCK_100_133 (2 << 0)
  189. #define GC_CLOCK_133_266 (3 << 0)
  190. #define GC_CLOCK_133_200_2 (4 << 0)
  191. #define GC_CLOCK_133_266_2 (5 << 0)
  192. #define GC_CLOCK_166_266 (6 << 0)
  193. #define GC_CLOCK_166_250 (7 << 0)
  194. #define I915_GDRST 0xc0 /* PCI config register */
  195. #define GRDOM_FULL (0 << 2)
  196. #define GRDOM_RENDER (1 << 2)
  197. #define GRDOM_MEDIA (3 << 2)
  198. #define GRDOM_MASK (3 << 2)
  199. #define GRDOM_RESET_STATUS (1 << 1)
  200. #define GRDOM_RESET_ENABLE (1 << 0)
  201. /* BSpec only has register offset, PCI device and bit found empirically */
  202. #define I830_CLOCK_GATE 0xc8 /* device 0 */
  203. #define I830_L2_CACHE_CLOCK_GATE_DISABLE (1 << 2)
  204. #define GCDGMBUS 0xcc
  205. #define GCFGC2 0xda
  206. #define GCFGC 0xf0 /* 915+ only */
  207. #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
  208. #define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
  209. #define GC_DISPLAY_CLOCK_333_320_MHZ (4 << 4)
  210. #define GC_DISPLAY_CLOCK_267_MHZ_PNV (0 << 4)
  211. #define GC_DISPLAY_CLOCK_333_MHZ_PNV (1 << 4)
  212. #define GC_DISPLAY_CLOCK_444_MHZ_PNV (2 << 4)
  213. #define GC_DISPLAY_CLOCK_200_MHZ_PNV (5 << 4)
  214. #define GC_DISPLAY_CLOCK_133_MHZ_PNV (6 << 4)
  215. #define GC_DISPLAY_CLOCK_167_MHZ_PNV (7 << 4)
  216. #define GC_DISPLAY_CLOCK_MASK (7 << 4)
  217. #define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
  218. #define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)
  219. #define GM45_GC_RENDER_CLOCK_320_MHZ (9 << 0)
  220. #define GM45_GC_RENDER_CLOCK_400_MHZ (0xb << 0)
  221. #define GM45_GC_RENDER_CLOCK_533_MHZ (0xc << 0)
  222. #define I965_GC_RENDER_CLOCK_MASK (0xf << 0)
  223. #define I965_GC_RENDER_CLOCK_267_MHZ (2 << 0)
  224. #define I965_GC_RENDER_CLOCK_333_MHZ (3 << 0)
  225. #define I965_GC_RENDER_CLOCK_444_MHZ (4 << 0)
  226. #define I965_GC_RENDER_CLOCK_533_MHZ (5 << 0)
  227. #define I945_GC_RENDER_CLOCK_MASK (7 << 0)
  228. #define I945_GC_RENDER_CLOCK_166_MHZ (0 << 0)
  229. #define I945_GC_RENDER_CLOCK_200_MHZ (1 << 0)
  230. #define I945_GC_RENDER_CLOCK_250_MHZ (3 << 0)
  231. #define I945_GC_RENDER_CLOCK_400_MHZ (5 << 0)
  232. #define I915_GC_RENDER_CLOCK_MASK (7 << 0)
  233. #define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
  234. #define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
  235. #define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
  236. #define ASLE 0xe4
  237. #define ASLS 0xfc
  238. #define SWSCI 0xe8
  239. #define SWSCI_SCISEL (1 << 15)
  240. #define SWSCI_GSSCIE (1 << 0)
  241. #define LBPC 0xf4 /* legacy/combination backlight modes, also called LBB */
  242. #define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)
  243. #define ILK_GRDOM_FULL (0<<1)
  244. #define ILK_GRDOM_RENDER (1<<1)
  245. #define ILK_GRDOM_MEDIA (3<<1)
  246. #define ILK_GRDOM_MASK (3<<1)
  247. #define ILK_GRDOM_RESET_ENABLE (1<<0)
  248. #define GEN6_MBCUNIT_SNPCR _MMIO(0x900c) /* for LLC config */
  249. #define GEN6_MBC_SNPCR_SHIFT 21
  250. #define GEN6_MBC_SNPCR_MASK (3<<21)
  251. #define GEN6_MBC_SNPCR_MAX (0<<21)
  252. #define GEN6_MBC_SNPCR_MED (1<<21)
  253. #define GEN6_MBC_SNPCR_LOW (2<<21)
  254. #define GEN6_MBC_SNPCR_MIN (3<<21) /* only 1/16th of the cache is shared */
  255. #define VLV_G3DCTL _MMIO(0x9024)
  256. #define VLV_GSCKGCTL _MMIO(0x9028)
  257. #define GEN6_MBCTL _MMIO(0x0907c)
  258. #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4)
  259. #define GEN6_MBCTL_CTX_FETCH_NEEDED (1 << 3)
  260. #define GEN6_MBCTL_BME_UPDATE_ENABLE (1 << 2)
  261. #define GEN6_MBCTL_MAE_UPDATE_ENABLE (1 << 1)
  262. #define GEN6_MBCTL_BOOT_FETCH_MECH (1 << 0)
  263. #define GEN6_GDRST _MMIO(0x941c)
  264. #define GEN6_GRDOM_FULL (1 << 0)
  265. #define GEN6_GRDOM_RENDER (1 << 1)
  266. #define GEN6_GRDOM_MEDIA (1 << 2)
  267. #define GEN6_GRDOM_BLT (1 << 3)
  268. #define GEN6_GRDOM_VECS (1 << 4)
  269. #define GEN9_GRDOM_GUC (1 << 5)
  270. #define GEN8_GRDOM_MEDIA2 (1 << 7)
  271. /* GEN11 changed all bit defs except for FULL & RENDER */
  272. #define GEN11_GRDOM_FULL GEN6_GRDOM_FULL
  273. #define GEN11_GRDOM_RENDER GEN6_GRDOM_RENDER
  274. #define GEN11_GRDOM_BLT (1 << 2)
  275. #define GEN11_GRDOM_GUC (1 << 3)
  276. #define GEN11_GRDOM_MEDIA (1 << 5)
  277. #define GEN11_GRDOM_MEDIA2 (1 << 6)
  278. #define GEN11_GRDOM_MEDIA3 (1 << 7)
  279. #define GEN11_GRDOM_MEDIA4 (1 << 8)
  280. #define GEN11_GRDOM_VECS (1 << 13)
  281. #define GEN11_GRDOM_VECS2 (1 << 14)
  282. #define RING_PP_DIR_BASE(engine) _MMIO((engine)->mmio_base+0x228)
  283. #define RING_PP_DIR_BASE_READ(engine) _MMIO((engine)->mmio_base+0x518)
  284. #define RING_PP_DIR_DCLV(engine) _MMIO((engine)->mmio_base+0x220)
  285. #define PP_DIR_DCLV_2G 0xffffffff
  286. #define GEN8_RING_PDP_UDW(engine, n) _MMIO((engine)->mmio_base+0x270 + (n) * 8 + 4)
  287. #define GEN8_RING_PDP_LDW(engine, n) _MMIO((engine)->mmio_base+0x270 + (n) * 8)
  288. #define GEN8_R_PWR_CLK_STATE _MMIO(0x20C8)
  289. #define GEN8_RPCS_ENABLE (1 << 31)
  290. #define GEN8_RPCS_S_CNT_ENABLE (1 << 18)
  291. #define GEN8_RPCS_S_CNT_SHIFT 15
  292. #define GEN8_RPCS_S_CNT_MASK (0x7 << GEN8_RPCS_S_CNT_SHIFT)
  293. #define GEN8_RPCS_SS_CNT_ENABLE (1 << 11)
  294. #define GEN8_RPCS_SS_CNT_SHIFT 8
  295. #define GEN8_RPCS_SS_CNT_MASK (0x7 << GEN8_RPCS_SS_CNT_SHIFT)
  296. #define GEN8_RPCS_EU_MAX_SHIFT 4
  297. #define GEN8_RPCS_EU_MAX_MASK (0xf << GEN8_RPCS_EU_MAX_SHIFT)
  298. #define GEN8_RPCS_EU_MIN_SHIFT 0
  299. #define GEN8_RPCS_EU_MIN_MASK (0xf << GEN8_RPCS_EU_MIN_SHIFT)
  300. #define WAIT_FOR_RC6_EXIT _MMIO(0x20CC)
  301. /* HSW only */
  302. #define HSW_SELECTIVE_READ_ADDRESSING_SHIFT 2
  303. #define HSW_SELECTIVE_READ_ADDRESSING_MASK (0x3 << HSW_SLECTIVE_READ_ADDRESSING_SHIFT)
  304. #define HSW_SELECTIVE_WRITE_ADDRESS_SHIFT 4
  305. #define HSW_SELECTIVE_WRITE_ADDRESS_MASK (0x7 << HSW_SELECTIVE_WRITE_ADDRESS_SHIFT)
  306. /* HSW+ */
  307. #define HSW_WAIT_FOR_RC6_EXIT_ENABLE (1 << 0)
  308. #define HSW_RCS_CONTEXT_ENABLE (1 << 7)
  309. #define HSW_RCS_INHIBIT (1 << 8)
  310. /* Gen8 */
  311. #define GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT 4
  312. #define GEN8_SELECTIVE_WRITE_ADDRESS_MASK (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
  313. #define GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT 4
  314. #define GEN8_SELECTIVE_WRITE_ADDRESS_MASK (0x3 << GEN8_SELECTIVE_WRITE_ADDRESS_SHIFT)
  315. #define GEN8_SELECTIVE_WRITE_ADDRESSING_ENABLE (1 << 6)
  316. #define GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT 9
  317. #define GEN8_SELECTIVE_READ_SUBSLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SUBSLICE_SELECT_SHIFT)
  318. #define GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT 11
  319. #define GEN8_SELECTIVE_READ_SLICE_SELECT_MASK (0x3 << GEN8_SELECTIVE_READ_SLICE_SELECT_SHIFT)
  320. #define GEN8_SELECTIVE_READ_ADDRESSING_ENABLE (1 << 13)
  321. #define GAM_ECOCHK _MMIO(0x4090)
  322. #define BDW_DISABLE_HDC_INVALIDATION (1<<25)
  323. #define ECOCHK_SNB_BIT (1<<10)
  324. #define ECOCHK_DIS_TLB (1<<8)
  325. #define HSW_ECOCHK_ARB_PRIO_SOL (1<<6)
  326. #define ECOCHK_PPGTT_CACHE64B (0x3<<3)
  327. #define ECOCHK_PPGTT_CACHE4B (0x0<<3)
  328. #define ECOCHK_PPGTT_GFDT_IVB (0x1<<4)
  329. #define ECOCHK_PPGTT_LLC_IVB (0x1<<3)
  330. #define ECOCHK_PPGTT_UC_HSW (0x1<<3)
  331. #define ECOCHK_PPGTT_WT_HSW (0x2<<3)
  332. #define ECOCHK_PPGTT_WB_HSW (0x3<<3)
  333. #define GAC_ECO_BITS _MMIO(0x14090)
  334. #define ECOBITS_SNB_BIT (1<<13)
  335. #define ECOBITS_PPGTT_CACHE64B (3<<8)
  336. #define ECOBITS_PPGTT_CACHE4B (0<<8)
  337. #define GAB_CTL _MMIO(0x24000)
  338. #define GAB_CTL_CONT_AFTER_PAGEFAULT (1<<8)
  339. #define GEN6_STOLEN_RESERVED _MMIO(0x1082C0)
  340. #define GEN6_STOLEN_RESERVED_ADDR_MASK (0xFFF << 20)
  341. #define GEN7_STOLEN_RESERVED_ADDR_MASK (0x3FFF << 18)
  342. #define GEN6_STOLEN_RESERVED_SIZE_MASK (3 << 4)
  343. #define GEN6_STOLEN_RESERVED_1M (0 << 4)
  344. #define GEN6_STOLEN_RESERVED_512K (1 << 4)
  345. #define GEN6_STOLEN_RESERVED_256K (2 << 4)
  346. #define GEN6_STOLEN_RESERVED_128K (3 << 4)
  347. #define GEN7_STOLEN_RESERVED_SIZE_MASK (1 << 5)
  348. #define GEN7_STOLEN_RESERVED_1M (0 << 5)
  349. #define GEN7_STOLEN_RESERVED_256K (1 << 5)
  350. #define GEN8_STOLEN_RESERVED_SIZE_MASK (3 << 7)
  351. #define GEN8_STOLEN_RESERVED_1M (0 << 7)
  352. #define GEN8_STOLEN_RESERVED_2M (1 << 7)
  353. #define GEN8_STOLEN_RESERVED_4M (2 << 7)
  354. #define GEN8_STOLEN_RESERVED_8M (3 << 7)
  355. #define GEN6_STOLEN_RESERVED_ENABLE (1 << 0)
  356. /* VGA stuff */
  357. #define VGA_ST01_MDA 0x3ba
  358. #define VGA_ST01_CGA 0x3da
  359. #define _VGA_MSR_WRITE _MMIO(0x3c2)
  360. #define VGA_MSR_WRITE 0x3c2
  361. #define VGA_MSR_READ 0x3cc
  362. #define VGA_MSR_MEM_EN (1<<1)
  363. #define VGA_MSR_CGA_MODE (1<<0)
  364. #define VGA_SR_INDEX 0x3c4
  365. #define SR01 1
  366. #define VGA_SR_DATA 0x3c5
  367. #define VGA_AR_INDEX 0x3c0
  368. #define VGA_AR_VID_EN (1<<5)
  369. #define VGA_AR_DATA_WRITE 0x3c0
  370. #define VGA_AR_DATA_READ 0x3c1
  371. #define VGA_GR_INDEX 0x3ce
  372. #define VGA_GR_DATA 0x3cf
  373. /* GR05 */
  374. #define VGA_GR_MEM_READ_MODE_SHIFT 3
  375. #define VGA_GR_MEM_READ_MODE_PLANE 1
  376. /* GR06 */
  377. #define VGA_GR_MEM_MODE_MASK 0xc
  378. #define VGA_GR_MEM_MODE_SHIFT 2
  379. #define VGA_GR_MEM_A0000_AFFFF 0
  380. #define VGA_GR_MEM_A0000_BFFFF 1
  381. #define VGA_GR_MEM_B0000_B7FFF 2
  382. #define VGA_GR_MEM_B0000_BFFFF 3
  383. #define VGA_DACMASK 0x3c6
  384. #define VGA_DACRX 0x3c7
  385. #define VGA_DACWX 0x3c8
  386. #define VGA_DACDATA 0x3c9
  387. #define VGA_CR_INDEX_MDA 0x3b4
  388. #define VGA_CR_DATA_MDA 0x3b5
  389. #define VGA_CR_INDEX_CGA 0x3d4
  390. #define VGA_CR_DATA_CGA 0x3d5
  391. #define MI_PREDICATE_SRC0 _MMIO(0x2400)
  392. #define MI_PREDICATE_SRC0_UDW _MMIO(0x2400 + 4)
  393. #define MI_PREDICATE_SRC1 _MMIO(0x2408)
  394. #define MI_PREDICATE_SRC1_UDW _MMIO(0x2408 + 4)
  395. #define MI_PREDICATE_RESULT_2 _MMIO(0x2214)
  396. #define LOWER_SLICE_ENABLED (1<<0)
  397. #define LOWER_SLICE_DISABLED (0<<0)
  398. /*
  399. * Registers used only by the command parser
  400. */
  401. #define BCS_SWCTRL _MMIO(0x22200)
  402. #define GPGPU_THREADS_DISPATCHED _MMIO(0x2290)
  403. #define GPGPU_THREADS_DISPATCHED_UDW _MMIO(0x2290 + 4)
  404. #define HS_INVOCATION_COUNT _MMIO(0x2300)
  405. #define HS_INVOCATION_COUNT_UDW _MMIO(0x2300 + 4)
  406. #define DS_INVOCATION_COUNT _MMIO(0x2308)
  407. #define DS_INVOCATION_COUNT_UDW _MMIO(0x2308 + 4)
  408. #define IA_VERTICES_COUNT _MMIO(0x2310)
  409. #define IA_VERTICES_COUNT_UDW _MMIO(0x2310 + 4)
  410. #define IA_PRIMITIVES_COUNT _MMIO(0x2318)
  411. #define IA_PRIMITIVES_COUNT_UDW _MMIO(0x2318 + 4)
  412. #define VS_INVOCATION_COUNT _MMIO(0x2320)
  413. #define VS_INVOCATION_COUNT_UDW _MMIO(0x2320 + 4)
  414. #define GS_INVOCATION_COUNT _MMIO(0x2328)
  415. #define GS_INVOCATION_COUNT_UDW _MMIO(0x2328 + 4)
  416. #define GS_PRIMITIVES_COUNT _MMIO(0x2330)
  417. #define GS_PRIMITIVES_COUNT_UDW _MMIO(0x2330 + 4)
  418. #define CL_INVOCATION_COUNT _MMIO(0x2338)
  419. #define CL_INVOCATION_COUNT_UDW _MMIO(0x2338 + 4)
  420. #define CL_PRIMITIVES_COUNT _MMIO(0x2340)
  421. #define CL_PRIMITIVES_COUNT_UDW _MMIO(0x2340 + 4)
  422. #define PS_INVOCATION_COUNT _MMIO(0x2348)
  423. #define PS_INVOCATION_COUNT_UDW _MMIO(0x2348 + 4)
  424. #define PS_DEPTH_COUNT _MMIO(0x2350)
  425. #define PS_DEPTH_COUNT_UDW _MMIO(0x2350 + 4)
  426. /* There are the 4 64-bit counter registers, one for each stream output */
  427. #define GEN7_SO_NUM_PRIMS_WRITTEN(n) _MMIO(0x5200 + (n) * 8)
  428. #define GEN7_SO_NUM_PRIMS_WRITTEN_UDW(n) _MMIO(0x5200 + (n) * 8 + 4)
  429. #define GEN7_SO_PRIM_STORAGE_NEEDED(n) _MMIO(0x5240 + (n) * 8)
  430. #define GEN7_SO_PRIM_STORAGE_NEEDED_UDW(n) _MMIO(0x5240 + (n) * 8 + 4)
  431. #define GEN7_3DPRIM_END_OFFSET _MMIO(0x2420)
  432. #define GEN7_3DPRIM_START_VERTEX _MMIO(0x2430)
  433. #define GEN7_3DPRIM_VERTEX_COUNT _MMIO(0x2434)
  434. #define GEN7_3DPRIM_INSTANCE_COUNT _MMIO(0x2438)
  435. #define GEN7_3DPRIM_START_INSTANCE _MMIO(0x243C)
  436. #define GEN7_3DPRIM_BASE_VERTEX _MMIO(0x2440)
  437. #define GEN7_GPGPU_DISPATCHDIMX _MMIO(0x2500)
  438. #define GEN7_GPGPU_DISPATCHDIMY _MMIO(0x2504)
  439. #define GEN7_GPGPU_DISPATCHDIMZ _MMIO(0x2508)
  440. /* There are the 16 64-bit CS General Purpose Registers */
  441. #define HSW_CS_GPR(n) _MMIO(0x2600 + (n) * 8)
  442. #define HSW_CS_GPR_UDW(n) _MMIO(0x2600 + (n) * 8 + 4)
  443. #define GEN7_OACONTROL _MMIO(0x2360)
  444. #define GEN7_OACONTROL_CTX_MASK 0xFFFFF000
  445. #define GEN7_OACONTROL_TIMER_PERIOD_MASK 0x3F
  446. #define GEN7_OACONTROL_TIMER_PERIOD_SHIFT 6
  447. #define GEN7_OACONTROL_TIMER_ENABLE (1<<5)
  448. #define GEN7_OACONTROL_FORMAT_A13 (0<<2)
  449. #define GEN7_OACONTROL_FORMAT_A29 (1<<2)
  450. #define GEN7_OACONTROL_FORMAT_A13_B8_C8 (2<<2)
  451. #define GEN7_OACONTROL_FORMAT_A29_B8_C8 (3<<2)
  452. #define GEN7_OACONTROL_FORMAT_B4_C8 (4<<2)
  453. #define GEN7_OACONTROL_FORMAT_A45_B8_C8 (5<<2)
  454. #define GEN7_OACONTROL_FORMAT_B4_C8_A16 (6<<2)
  455. #define GEN7_OACONTROL_FORMAT_C4_B8 (7<<2)
  456. #define GEN7_OACONTROL_FORMAT_SHIFT 2
  457. #define GEN7_OACONTROL_PER_CTX_ENABLE (1<<1)
  458. #define GEN7_OACONTROL_ENABLE (1<<0)
  459. #define GEN8_OACTXID _MMIO(0x2364)
  460. #define GEN8_OA_DEBUG _MMIO(0x2B04)
  461. #define GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS (1<<5)
  462. #define GEN9_OA_DEBUG_INCLUDE_CLK_RATIO (1<<6)
  463. #define GEN9_OA_DEBUG_DISABLE_GO_1_0_REPORTS (1<<2)
  464. #define GEN9_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS (1<<1)
  465. #define GEN8_OACONTROL _MMIO(0x2B00)
  466. #define GEN8_OA_REPORT_FORMAT_A12 (0<<2)
  467. #define GEN8_OA_REPORT_FORMAT_A12_B8_C8 (2<<2)
  468. #define GEN8_OA_REPORT_FORMAT_A36_B8_C8 (5<<2)
  469. #define GEN8_OA_REPORT_FORMAT_C4_B8 (7<<2)
  470. #define GEN8_OA_REPORT_FORMAT_SHIFT 2
  471. #define GEN8_OA_SPECIFIC_CONTEXT_ENABLE (1<<1)
  472. #define GEN8_OA_COUNTER_ENABLE (1<<0)
  473. #define GEN8_OACTXCONTROL _MMIO(0x2360)
  474. #define GEN8_OA_TIMER_PERIOD_MASK 0x3F
  475. #define GEN8_OA_TIMER_PERIOD_SHIFT 2
  476. #define GEN8_OA_TIMER_ENABLE (1<<1)
  477. #define GEN8_OA_COUNTER_RESUME (1<<0)
  478. #define GEN7_OABUFFER _MMIO(0x23B0) /* R/W */
  479. #define GEN7_OABUFFER_OVERRUN_DISABLE (1<<3)
  480. #define GEN7_OABUFFER_EDGE_TRIGGER (1<<2)
  481. #define GEN7_OABUFFER_STOP_RESUME_ENABLE (1<<1)
  482. #define GEN7_OABUFFER_RESUME (1<<0)
  483. #define GEN8_OABUFFER_UDW _MMIO(0x23b4)
  484. #define GEN8_OABUFFER _MMIO(0x2b14)
  485. #define GEN8_OABUFFER_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
  486. #define GEN7_OASTATUS1 _MMIO(0x2364)
  487. #define GEN7_OASTATUS1_TAIL_MASK 0xffffffc0
  488. #define GEN7_OASTATUS1_COUNTER_OVERFLOW (1<<2)
  489. #define GEN7_OASTATUS1_OABUFFER_OVERFLOW (1<<1)
  490. #define GEN7_OASTATUS1_REPORT_LOST (1<<0)
  491. #define GEN7_OASTATUS2 _MMIO(0x2368)
  492. #define GEN7_OASTATUS2_HEAD_MASK 0xffffffc0
  493. #define GEN7_OASTATUS2_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
  494. #define GEN8_OASTATUS _MMIO(0x2b08)
  495. #define GEN8_OASTATUS_OVERRUN_STATUS (1<<3)
  496. #define GEN8_OASTATUS_COUNTER_OVERFLOW (1<<2)
  497. #define GEN8_OASTATUS_OABUFFER_OVERFLOW (1<<1)
  498. #define GEN8_OASTATUS_REPORT_LOST (1<<0)
  499. #define GEN8_OAHEADPTR _MMIO(0x2B0C)
  500. #define GEN8_OAHEADPTR_MASK 0xffffffc0
  501. #define GEN8_OATAILPTR _MMIO(0x2B10)
  502. #define GEN8_OATAILPTR_MASK 0xffffffc0
  503. #define OABUFFER_SIZE_128K (0<<3)
  504. #define OABUFFER_SIZE_256K (1<<3)
  505. #define OABUFFER_SIZE_512K (2<<3)
  506. #define OABUFFER_SIZE_1M (3<<3)
  507. #define OABUFFER_SIZE_2M (4<<3)
  508. #define OABUFFER_SIZE_4M (5<<3)
  509. #define OABUFFER_SIZE_8M (6<<3)
  510. #define OABUFFER_SIZE_16M (7<<3)
  511. /*
  512. * Flexible, Aggregate EU Counter Registers.
  513. * Note: these aren't contiguous
  514. */
  515. #define EU_PERF_CNTL0 _MMIO(0xe458)
  516. #define EU_PERF_CNTL1 _MMIO(0xe558)
  517. #define EU_PERF_CNTL2 _MMIO(0xe658)
  518. #define EU_PERF_CNTL3 _MMIO(0xe758)
  519. #define EU_PERF_CNTL4 _MMIO(0xe45c)
  520. #define EU_PERF_CNTL5 _MMIO(0xe55c)
  521. #define EU_PERF_CNTL6 _MMIO(0xe65c)
  522. /*
  523. * OA Boolean state
  524. */
  525. #define OASTARTTRIG1 _MMIO(0x2710)
  526. #define OASTARTTRIG1_THRESHOLD_COUNT_MASK_MBZ 0xffff0000
  527. #define OASTARTTRIG1_THRESHOLD_MASK 0xffff
  528. #define OASTARTTRIG2 _MMIO(0x2714)
  529. #define OASTARTTRIG2_INVERT_A_0 (1<<0)
  530. #define OASTARTTRIG2_INVERT_A_1 (1<<1)
  531. #define OASTARTTRIG2_INVERT_A_2 (1<<2)
  532. #define OASTARTTRIG2_INVERT_A_3 (1<<3)
  533. #define OASTARTTRIG2_INVERT_A_4 (1<<4)
  534. #define OASTARTTRIG2_INVERT_A_5 (1<<5)
  535. #define OASTARTTRIG2_INVERT_A_6 (1<<6)
  536. #define OASTARTTRIG2_INVERT_A_7 (1<<7)
  537. #define OASTARTTRIG2_INVERT_A_8 (1<<8)
  538. #define OASTARTTRIG2_INVERT_A_9 (1<<9)
  539. #define OASTARTTRIG2_INVERT_A_10 (1<<10)
  540. #define OASTARTTRIG2_INVERT_A_11 (1<<11)
  541. #define OASTARTTRIG2_INVERT_A_12 (1<<12)
  542. #define OASTARTTRIG2_INVERT_A_13 (1<<13)
  543. #define OASTARTTRIG2_INVERT_A_14 (1<<14)
  544. #define OASTARTTRIG2_INVERT_A_15 (1<<15)
  545. #define OASTARTTRIG2_INVERT_B_0 (1<<16)
  546. #define OASTARTTRIG2_INVERT_B_1 (1<<17)
  547. #define OASTARTTRIG2_INVERT_B_2 (1<<18)
  548. #define OASTARTTRIG2_INVERT_B_3 (1<<19)
  549. #define OASTARTTRIG2_INVERT_C_0 (1<<20)
  550. #define OASTARTTRIG2_INVERT_C_1 (1<<21)
  551. #define OASTARTTRIG2_INVERT_D_0 (1<<22)
  552. #define OASTARTTRIG2_THRESHOLD_ENABLE (1<<23)
  553. #define OASTARTTRIG2_START_TRIG_FLAG_MBZ (1<<24)
  554. #define OASTARTTRIG2_EVENT_SELECT_0 (1<<28)
  555. #define OASTARTTRIG2_EVENT_SELECT_1 (1<<29)
  556. #define OASTARTTRIG2_EVENT_SELECT_2 (1<<30)
  557. #define OASTARTTRIG2_EVENT_SELECT_3 (1<<31)
  558. #define OASTARTTRIG3 _MMIO(0x2718)
  559. #define OASTARTTRIG3_NOA_SELECT_MASK 0xf
  560. #define OASTARTTRIG3_NOA_SELECT_8_SHIFT 0
  561. #define OASTARTTRIG3_NOA_SELECT_9_SHIFT 4
  562. #define OASTARTTRIG3_NOA_SELECT_10_SHIFT 8
  563. #define OASTARTTRIG3_NOA_SELECT_11_SHIFT 12
  564. #define OASTARTTRIG3_NOA_SELECT_12_SHIFT 16
  565. #define OASTARTTRIG3_NOA_SELECT_13_SHIFT 20
  566. #define OASTARTTRIG3_NOA_SELECT_14_SHIFT 24
  567. #define OASTARTTRIG3_NOA_SELECT_15_SHIFT 28
  568. #define OASTARTTRIG4 _MMIO(0x271c)
  569. #define OASTARTTRIG4_NOA_SELECT_MASK 0xf
  570. #define OASTARTTRIG4_NOA_SELECT_0_SHIFT 0
  571. #define OASTARTTRIG4_NOA_SELECT_1_SHIFT 4
  572. #define OASTARTTRIG4_NOA_SELECT_2_SHIFT 8
  573. #define OASTARTTRIG4_NOA_SELECT_3_SHIFT 12
  574. #define OASTARTTRIG4_NOA_SELECT_4_SHIFT 16
  575. #define OASTARTTRIG4_NOA_SELECT_5_SHIFT 20
  576. #define OASTARTTRIG4_NOA_SELECT_6_SHIFT 24
  577. #define OASTARTTRIG4_NOA_SELECT_7_SHIFT 28
  578. #define OASTARTTRIG5 _MMIO(0x2720)
  579. #define OASTARTTRIG5_THRESHOLD_COUNT_MASK_MBZ 0xffff0000
  580. #define OASTARTTRIG5_THRESHOLD_MASK 0xffff
  581. #define OASTARTTRIG6 _MMIO(0x2724)
  582. #define OASTARTTRIG6_INVERT_A_0 (1<<0)
  583. #define OASTARTTRIG6_INVERT_A_1 (1<<1)
  584. #define OASTARTTRIG6_INVERT_A_2 (1<<2)
  585. #define OASTARTTRIG6_INVERT_A_3 (1<<3)
  586. #define OASTARTTRIG6_INVERT_A_4 (1<<4)
  587. #define OASTARTTRIG6_INVERT_A_5 (1<<5)
  588. #define OASTARTTRIG6_INVERT_A_6 (1<<6)
  589. #define OASTARTTRIG6_INVERT_A_7 (1<<7)
  590. #define OASTARTTRIG6_INVERT_A_8 (1<<8)
  591. #define OASTARTTRIG6_INVERT_A_9 (1<<9)
  592. #define OASTARTTRIG6_INVERT_A_10 (1<<10)
  593. #define OASTARTTRIG6_INVERT_A_11 (1<<11)
  594. #define OASTARTTRIG6_INVERT_A_12 (1<<12)
  595. #define OASTARTTRIG6_INVERT_A_13 (1<<13)
  596. #define OASTARTTRIG6_INVERT_A_14 (1<<14)
  597. #define OASTARTTRIG6_INVERT_A_15 (1<<15)
  598. #define OASTARTTRIG6_INVERT_B_0 (1<<16)
  599. #define OASTARTTRIG6_INVERT_B_1 (1<<17)
  600. #define OASTARTTRIG6_INVERT_B_2 (1<<18)
  601. #define OASTARTTRIG6_INVERT_B_3 (1<<19)
  602. #define OASTARTTRIG6_INVERT_C_0 (1<<20)
  603. #define OASTARTTRIG6_INVERT_C_1 (1<<21)
  604. #define OASTARTTRIG6_INVERT_D_0 (1<<22)
  605. #define OASTARTTRIG6_THRESHOLD_ENABLE (1<<23)
  606. #define OASTARTTRIG6_START_TRIG_FLAG_MBZ (1<<24)
  607. #define OASTARTTRIG6_EVENT_SELECT_4 (1<<28)
  608. #define OASTARTTRIG6_EVENT_SELECT_5 (1<<29)
  609. #define OASTARTTRIG6_EVENT_SELECT_6 (1<<30)
  610. #define OASTARTTRIG6_EVENT_SELECT_7 (1<<31)
  611. #define OASTARTTRIG7 _MMIO(0x2728)
  612. #define OASTARTTRIG7_NOA_SELECT_MASK 0xf
  613. #define OASTARTTRIG7_NOA_SELECT_8_SHIFT 0
  614. #define OASTARTTRIG7_NOA_SELECT_9_SHIFT 4
  615. #define OASTARTTRIG7_NOA_SELECT_10_SHIFT 8
  616. #define OASTARTTRIG7_NOA_SELECT_11_SHIFT 12
  617. #define OASTARTTRIG7_NOA_SELECT_12_SHIFT 16
  618. #define OASTARTTRIG7_NOA_SELECT_13_SHIFT 20
  619. #define OASTARTTRIG7_NOA_SELECT_14_SHIFT 24
  620. #define OASTARTTRIG7_NOA_SELECT_15_SHIFT 28
  621. #define OASTARTTRIG8 _MMIO(0x272c)
  622. #define OASTARTTRIG8_NOA_SELECT_MASK 0xf
  623. #define OASTARTTRIG8_NOA_SELECT_0_SHIFT 0
  624. #define OASTARTTRIG8_NOA_SELECT_1_SHIFT 4
  625. #define OASTARTTRIG8_NOA_SELECT_2_SHIFT 8
  626. #define OASTARTTRIG8_NOA_SELECT_3_SHIFT 12
  627. #define OASTARTTRIG8_NOA_SELECT_4_SHIFT 16
  628. #define OASTARTTRIG8_NOA_SELECT_5_SHIFT 20
  629. #define OASTARTTRIG8_NOA_SELECT_6_SHIFT 24
  630. #define OASTARTTRIG8_NOA_SELECT_7_SHIFT 28
  631. #define OAREPORTTRIG1 _MMIO(0x2740)
  632. #define OAREPORTTRIG1_THRESHOLD_MASK 0xffff
  633. #define OAREPORTTRIG1_EDGE_LEVEL_TRIGER_SELECT_MASK 0xffff0000 /* 0=level */
  634. #define OAREPORTTRIG2 _MMIO(0x2744)
  635. #define OAREPORTTRIG2_INVERT_A_0 (1<<0)
  636. #define OAREPORTTRIG2_INVERT_A_1 (1<<1)
  637. #define OAREPORTTRIG2_INVERT_A_2 (1<<2)
  638. #define OAREPORTTRIG2_INVERT_A_3 (1<<3)
  639. #define OAREPORTTRIG2_INVERT_A_4 (1<<4)
  640. #define OAREPORTTRIG2_INVERT_A_5 (1<<5)
  641. #define OAREPORTTRIG2_INVERT_A_6 (1<<6)
  642. #define OAREPORTTRIG2_INVERT_A_7 (1<<7)
  643. #define OAREPORTTRIG2_INVERT_A_8 (1<<8)
  644. #define OAREPORTTRIG2_INVERT_A_9 (1<<9)
  645. #define OAREPORTTRIG2_INVERT_A_10 (1<<10)
  646. #define OAREPORTTRIG2_INVERT_A_11 (1<<11)
  647. #define OAREPORTTRIG2_INVERT_A_12 (1<<12)
  648. #define OAREPORTTRIG2_INVERT_A_13 (1<<13)
  649. #define OAREPORTTRIG2_INVERT_A_14 (1<<14)
  650. #define OAREPORTTRIG2_INVERT_A_15 (1<<15)
  651. #define OAREPORTTRIG2_INVERT_B_0 (1<<16)
  652. #define OAREPORTTRIG2_INVERT_B_1 (1<<17)
  653. #define OAREPORTTRIG2_INVERT_B_2 (1<<18)
  654. #define OAREPORTTRIG2_INVERT_B_3 (1<<19)
  655. #define OAREPORTTRIG2_INVERT_C_0 (1<<20)
  656. #define OAREPORTTRIG2_INVERT_C_1 (1<<21)
  657. #define OAREPORTTRIG2_INVERT_D_0 (1<<22)
  658. #define OAREPORTTRIG2_THRESHOLD_ENABLE (1<<23)
  659. #define OAREPORTTRIG2_REPORT_TRIGGER_ENABLE (1<<31)
  660. #define OAREPORTTRIG3 _MMIO(0x2748)
  661. #define OAREPORTTRIG3_NOA_SELECT_MASK 0xf
  662. #define OAREPORTTRIG3_NOA_SELECT_8_SHIFT 0
  663. #define OAREPORTTRIG3_NOA_SELECT_9_SHIFT 4
  664. #define OAREPORTTRIG3_NOA_SELECT_10_SHIFT 8
  665. #define OAREPORTTRIG3_NOA_SELECT_11_SHIFT 12
  666. #define OAREPORTTRIG3_NOA_SELECT_12_SHIFT 16
  667. #define OAREPORTTRIG3_NOA_SELECT_13_SHIFT 20
  668. #define OAREPORTTRIG3_NOA_SELECT_14_SHIFT 24
  669. #define OAREPORTTRIG3_NOA_SELECT_15_SHIFT 28
  670. #define OAREPORTTRIG4 _MMIO(0x274c)
  671. #define OAREPORTTRIG4_NOA_SELECT_MASK 0xf
  672. #define OAREPORTTRIG4_NOA_SELECT_0_SHIFT 0
  673. #define OAREPORTTRIG4_NOA_SELECT_1_SHIFT 4
  674. #define OAREPORTTRIG4_NOA_SELECT_2_SHIFT 8
  675. #define OAREPORTTRIG4_NOA_SELECT_3_SHIFT 12
  676. #define OAREPORTTRIG4_NOA_SELECT_4_SHIFT 16
  677. #define OAREPORTTRIG4_NOA_SELECT_5_SHIFT 20
  678. #define OAREPORTTRIG4_NOA_SELECT_6_SHIFT 24
  679. #define OAREPORTTRIG4_NOA_SELECT_7_SHIFT 28
  680. #define OAREPORTTRIG5 _MMIO(0x2750)
  681. #define OAREPORTTRIG5_THRESHOLD_MASK 0xffff
  682. #define OAREPORTTRIG5_EDGE_LEVEL_TRIGER_SELECT_MASK 0xffff0000 /* 0=level */
  683. #define OAREPORTTRIG6 _MMIO(0x2754)
  684. #define OAREPORTTRIG6_INVERT_A_0 (1<<0)
  685. #define OAREPORTTRIG6_INVERT_A_1 (1<<1)
  686. #define OAREPORTTRIG6_INVERT_A_2 (1<<2)
  687. #define OAREPORTTRIG6_INVERT_A_3 (1<<3)
  688. #define OAREPORTTRIG6_INVERT_A_4 (1<<4)
  689. #define OAREPORTTRIG6_INVERT_A_5 (1<<5)
  690. #define OAREPORTTRIG6_INVERT_A_6 (1<<6)
  691. #define OAREPORTTRIG6_INVERT_A_7 (1<<7)
  692. #define OAREPORTTRIG6_INVERT_A_8 (1<<8)
  693. #define OAREPORTTRIG6_INVERT_A_9 (1<<9)
  694. #define OAREPORTTRIG6_INVERT_A_10 (1<<10)
  695. #define OAREPORTTRIG6_INVERT_A_11 (1<<11)
  696. #define OAREPORTTRIG6_INVERT_A_12 (1<<12)
  697. #define OAREPORTTRIG6_INVERT_A_13 (1<<13)
  698. #define OAREPORTTRIG6_INVERT_A_14 (1<<14)
  699. #define OAREPORTTRIG6_INVERT_A_15 (1<<15)
  700. #define OAREPORTTRIG6_INVERT_B_0 (1<<16)
  701. #define OAREPORTTRIG6_INVERT_B_1 (1<<17)
  702. #define OAREPORTTRIG6_INVERT_B_2 (1<<18)
  703. #define OAREPORTTRIG6_INVERT_B_3 (1<<19)
  704. #define OAREPORTTRIG6_INVERT_C_0 (1<<20)
  705. #define OAREPORTTRIG6_INVERT_C_1 (1<<21)
  706. #define OAREPORTTRIG6_INVERT_D_0 (1<<22)
  707. #define OAREPORTTRIG6_THRESHOLD_ENABLE (1<<23)
  708. #define OAREPORTTRIG6_REPORT_TRIGGER_ENABLE (1<<31)
  709. #define OAREPORTTRIG7 _MMIO(0x2758)
  710. #define OAREPORTTRIG7_NOA_SELECT_MASK 0xf
  711. #define OAREPORTTRIG7_NOA_SELECT_8_SHIFT 0
  712. #define OAREPORTTRIG7_NOA_SELECT_9_SHIFT 4
  713. #define OAREPORTTRIG7_NOA_SELECT_10_SHIFT 8
  714. #define OAREPORTTRIG7_NOA_SELECT_11_SHIFT 12
  715. #define OAREPORTTRIG7_NOA_SELECT_12_SHIFT 16
  716. #define OAREPORTTRIG7_NOA_SELECT_13_SHIFT 20
  717. #define OAREPORTTRIG7_NOA_SELECT_14_SHIFT 24
  718. #define OAREPORTTRIG7_NOA_SELECT_15_SHIFT 28
  719. #define OAREPORTTRIG8 _MMIO(0x275c)
  720. #define OAREPORTTRIG8_NOA_SELECT_MASK 0xf
  721. #define OAREPORTTRIG8_NOA_SELECT_0_SHIFT 0
  722. #define OAREPORTTRIG8_NOA_SELECT_1_SHIFT 4
  723. #define OAREPORTTRIG8_NOA_SELECT_2_SHIFT 8
  724. #define OAREPORTTRIG8_NOA_SELECT_3_SHIFT 12
  725. #define OAREPORTTRIG8_NOA_SELECT_4_SHIFT 16
  726. #define OAREPORTTRIG8_NOA_SELECT_5_SHIFT 20
  727. #define OAREPORTTRIG8_NOA_SELECT_6_SHIFT 24
  728. #define OAREPORTTRIG8_NOA_SELECT_7_SHIFT 28
  729. /* CECX_0 */
  730. #define OACEC_COMPARE_LESS_OR_EQUAL 6
  731. #define OACEC_COMPARE_NOT_EQUAL 5
  732. #define OACEC_COMPARE_LESS_THAN 4
  733. #define OACEC_COMPARE_GREATER_OR_EQUAL 3
  734. #define OACEC_COMPARE_EQUAL 2
  735. #define OACEC_COMPARE_GREATER_THAN 1
  736. #define OACEC_COMPARE_ANY_EQUAL 0
  737. #define OACEC_COMPARE_VALUE_MASK 0xffff
  738. #define OACEC_COMPARE_VALUE_SHIFT 3
  739. #define OACEC_SELECT_NOA (0<<19)
  740. #define OACEC_SELECT_PREV (1<<19)
  741. #define OACEC_SELECT_BOOLEAN (2<<19)
  742. /* CECX_1 */
  743. #define OACEC_MASK_MASK 0xffff
  744. #define OACEC_CONSIDERATIONS_MASK 0xffff
  745. #define OACEC_CONSIDERATIONS_SHIFT 16
  746. #define OACEC0_0 _MMIO(0x2770)
  747. #define OACEC0_1 _MMIO(0x2774)
  748. #define OACEC1_0 _MMIO(0x2778)
  749. #define OACEC1_1 _MMIO(0x277c)
  750. #define OACEC2_0 _MMIO(0x2780)
  751. #define OACEC2_1 _MMIO(0x2784)
  752. #define OACEC3_0 _MMIO(0x2788)
  753. #define OACEC3_1 _MMIO(0x278c)
  754. #define OACEC4_0 _MMIO(0x2790)
  755. #define OACEC4_1 _MMIO(0x2794)
  756. #define OACEC5_0 _MMIO(0x2798)
  757. #define OACEC5_1 _MMIO(0x279c)
  758. #define OACEC6_0 _MMIO(0x27a0)
  759. #define OACEC6_1 _MMIO(0x27a4)
  760. #define OACEC7_0 _MMIO(0x27a8)
  761. #define OACEC7_1 _MMIO(0x27ac)
  762. /* OA perf counters */
  763. #define OA_PERFCNT1_LO _MMIO(0x91B8)
  764. #define OA_PERFCNT1_HI _MMIO(0x91BC)
  765. #define OA_PERFCNT2_LO _MMIO(0x91C0)
  766. #define OA_PERFCNT2_HI _MMIO(0x91C4)
  767. #define OA_PERFCNT3_LO _MMIO(0x91C8)
  768. #define OA_PERFCNT3_HI _MMIO(0x91CC)
  769. #define OA_PERFCNT4_LO _MMIO(0x91D8)
  770. #define OA_PERFCNT4_HI _MMIO(0x91DC)
  771. #define OA_PERFMATRIX_LO _MMIO(0x91C8)
  772. #define OA_PERFMATRIX_HI _MMIO(0x91CC)
  773. /* RPM unit config (Gen8+) */
  774. #define RPM_CONFIG0 _MMIO(0x0D00)
  775. #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
  776. #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (1 << GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
  777. #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 0
  778. #define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 1
  779. #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
  780. #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
  781. #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 0
  782. #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 1
  783. #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ 2
  784. #define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ 3
  785. #define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT 1
  786. #define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK (0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT)
  787. #define RPM_CONFIG1 _MMIO(0x0D04)
  788. #define GEN10_GT_NOA_ENABLE (1 << 9)
  789. /* GPM unit config (Gen9+) */
  790. #define CTC_MODE _MMIO(0xA26C)
  791. #define CTC_SOURCE_PARAMETER_MASK 1
  792. #define CTC_SOURCE_CRYSTAL_CLOCK 0
  793. #define CTC_SOURCE_DIVIDE_LOGIC 1
  794. #define CTC_SHIFT_PARAMETER_SHIFT 1
  795. #define CTC_SHIFT_PARAMETER_MASK (0x3 << CTC_SHIFT_PARAMETER_SHIFT)
  796. /* RCP unit config (Gen8+) */
  797. #define RCP_CONFIG _MMIO(0x0D08)
  798. /* NOA (HSW) */
  799. #define HSW_MBVID2_NOA0 _MMIO(0x9E80)
  800. #define HSW_MBVID2_NOA1 _MMIO(0x9E84)
  801. #define HSW_MBVID2_NOA2 _MMIO(0x9E88)
  802. #define HSW_MBVID2_NOA3 _MMIO(0x9E8C)
  803. #define HSW_MBVID2_NOA4 _MMIO(0x9E90)
  804. #define HSW_MBVID2_NOA5 _MMIO(0x9E94)
  805. #define HSW_MBVID2_NOA6 _MMIO(0x9E98)
  806. #define HSW_MBVID2_NOA7 _MMIO(0x9E9C)
  807. #define HSW_MBVID2_NOA8 _MMIO(0x9EA0)
  808. #define HSW_MBVID2_NOA9 _MMIO(0x9EA4)
  809. #define HSW_MBVID2_MISR0 _MMIO(0x9EC0)
  810. /* NOA (Gen8+) */
  811. #define NOA_CONFIG(i) _MMIO(0x0D0C + (i) * 4)
  812. #define MICRO_BP0_0 _MMIO(0x9800)
  813. #define MICRO_BP0_2 _MMIO(0x9804)
  814. #define MICRO_BP0_1 _MMIO(0x9808)
  815. #define MICRO_BP1_0 _MMIO(0x980C)
  816. #define MICRO_BP1_2 _MMIO(0x9810)
  817. #define MICRO_BP1_1 _MMIO(0x9814)
  818. #define MICRO_BP2_0 _MMIO(0x9818)
  819. #define MICRO_BP2_2 _MMIO(0x981C)
  820. #define MICRO_BP2_1 _MMIO(0x9820)
  821. #define MICRO_BP3_0 _MMIO(0x9824)
  822. #define MICRO_BP3_2 _MMIO(0x9828)
  823. #define MICRO_BP3_1 _MMIO(0x982C)
  824. #define MICRO_BP_TRIGGER _MMIO(0x9830)
  825. #define MICRO_BP3_COUNT_STATUS01 _MMIO(0x9834)
  826. #define MICRO_BP3_COUNT_STATUS23 _MMIO(0x9838)
  827. #define MICRO_BP_FIRED_ARMED _MMIO(0x983C)
  828. #define GDT_CHICKEN_BITS _MMIO(0x9840)
  829. #define GT_NOA_ENABLE 0x00000080
  830. #define NOA_DATA _MMIO(0x986C)
  831. #define NOA_WRITE _MMIO(0x9888)
  832. #define _GEN7_PIPEA_DE_LOAD_SL 0x70068
  833. #define _GEN7_PIPEB_DE_LOAD_SL 0x71068
  834. #define GEN7_PIPE_DE_LOAD_SL(pipe) _MMIO_PIPE(pipe, _GEN7_PIPEA_DE_LOAD_SL, _GEN7_PIPEB_DE_LOAD_SL)
  835. /*
  836. * Reset registers
  837. */
  838. #define DEBUG_RESET_I830 _MMIO(0x6070)
  839. #define DEBUG_RESET_FULL (1<<7)
  840. #define DEBUG_RESET_RENDER (1<<8)
  841. #define DEBUG_RESET_DISPLAY (1<<9)
  842. /*
  843. * IOSF sideband
  844. */
  845. #define VLV_IOSF_DOORBELL_REQ _MMIO(VLV_DISPLAY_BASE + 0x2100)
  846. #define IOSF_DEVFN_SHIFT 24
  847. #define IOSF_OPCODE_SHIFT 16
  848. #define IOSF_PORT_SHIFT 8
  849. #define IOSF_BYTE_ENABLES_SHIFT 4
  850. #define IOSF_BAR_SHIFT 1
  851. #define IOSF_SB_BUSY (1<<0)
  852. #define IOSF_PORT_BUNIT 0x03
  853. #define IOSF_PORT_PUNIT 0x04
  854. #define IOSF_PORT_NC 0x11
  855. #define IOSF_PORT_DPIO 0x12
  856. #define IOSF_PORT_GPIO_NC 0x13
  857. #define IOSF_PORT_CCK 0x14
  858. #define IOSF_PORT_DPIO_2 0x1a
  859. #define IOSF_PORT_FLISDSI 0x1b
  860. #define IOSF_PORT_GPIO_SC 0x48
  861. #define IOSF_PORT_GPIO_SUS 0xa8
  862. #define IOSF_PORT_CCU 0xa9
  863. #define CHV_IOSF_PORT_GPIO_N 0x13
  864. #define CHV_IOSF_PORT_GPIO_SE 0x48
  865. #define CHV_IOSF_PORT_GPIO_E 0xa8
  866. #define CHV_IOSF_PORT_GPIO_SW 0xb2
  867. #define VLV_IOSF_DATA _MMIO(VLV_DISPLAY_BASE + 0x2104)
  868. #define VLV_IOSF_ADDR _MMIO(VLV_DISPLAY_BASE + 0x2108)
  869. /* See configdb bunit SB addr map */
  870. #define BUNIT_REG_BISOC 0x11
  871. #define PUNIT_REG_DSPFREQ 0x36
  872. #define DSPFREQSTAT_SHIFT_CHV 24
  873. #define DSPFREQSTAT_MASK_CHV (0x1f << DSPFREQSTAT_SHIFT_CHV)
  874. #define DSPFREQGUAR_SHIFT_CHV 8
  875. #define DSPFREQGUAR_MASK_CHV (0x1f << DSPFREQGUAR_SHIFT_CHV)
  876. #define DSPFREQSTAT_SHIFT 30
  877. #define DSPFREQSTAT_MASK (0x3 << DSPFREQSTAT_SHIFT)
  878. #define DSPFREQGUAR_SHIFT 14
  879. #define DSPFREQGUAR_MASK (0x3 << DSPFREQGUAR_SHIFT)
  880. #define DSP_MAXFIFO_PM5_STATUS (1 << 22) /* chv */
  881. #define DSP_AUTO_CDCLK_GATE_DISABLE (1 << 7) /* chv */
  882. #define DSP_MAXFIFO_PM5_ENABLE (1 << 6) /* chv */
  883. #define _DP_SSC(val, pipe) ((val) << (2 * (pipe)))
  884. #define DP_SSC_MASK(pipe) _DP_SSC(0x3, (pipe))
  885. #define DP_SSC_PWR_ON(pipe) _DP_SSC(0x0, (pipe))
  886. #define DP_SSC_CLK_GATE(pipe) _DP_SSC(0x1, (pipe))
  887. #define DP_SSC_RESET(pipe) _DP_SSC(0x2, (pipe))
  888. #define DP_SSC_PWR_GATE(pipe) _DP_SSC(0x3, (pipe))
  889. #define _DP_SSS(val, pipe) ((val) << (2 * (pipe) + 16))
  890. #define DP_SSS_MASK(pipe) _DP_SSS(0x3, (pipe))
  891. #define DP_SSS_PWR_ON(pipe) _DP_SSS(0x0, (pipe))
  892. #define DP_SSS_CLK_GATE(pipe) _DP_SSS(0x1, (pipe))
  893. #define DP_SSS_RESET(pipe) _DP_SSS(0x2, (pipe))
  894. #define DP_SSS_PWR_GATE(pipe) _DP_SSS(0x3, (pipe))
  895. /*
  896. * i915_power_well_id:
  897. *
  898. * Platform specific IDs used to look up power wells and - except for custom
  899. * power wells - to define request/status register flag bit positions. As such
  900. * the set of IDs on a given platform must be unique and except for custom
  901. * power wells their value must stay fixed.
  902. */
  903. enum i915_power_well_id {
  904. /*
  905. * I830
  906. * - custom power well
  907. */
  908. I830_DISP_PW_PIPES = 0,
  909. /*
  910. * VLV/CHV
  911. * - PUNIT_REG_PWRGT_CTRL (bit: id*2),
  912. * PUNIT_REG_PWRGT_STATUS (bit: id*2) (PUNIT HAS v0.8)
  913. */
  914. PUNIT_POWER_WELL_RENDER = 0,
  915. PUNIT_POWER_WELL_MEDIA = 1,
  916. PUNIT_POWER_WELL_DISP2D = 3,
  917. PUNIT_POWER_WELL_DPIO_CMN_BC = 5,
  918. PUNIT_POWER_WELL_DPIO_TX_B_LANES_01 = 6,
  919. PUNIT_POWER_WELL_DPIO_TX_B_LANES_23 = 7,
  920. PUNIT_POWER_WELL_DPIO_TX_C_LANES_01 = 8,
  921. PUNIT_POWER_WELL_DPIO_TX_C_LANES_23 = 9,
  922. PUNIT_POWER_WELL_DPIO_RX0 = 10,
  923. PUNIT_POWER_WELL_DPIO_RX1 = 11,
  924. PUNIT_POWER_WELL_DPIO_CMN_D = 12,
  925. /* - custom power well */
  926. CHV_DISP_PW_PIPE_A, /* 13 */
  927. /*
  928. * HSW/BDW
  929. * - HSW_PWR_WELL_CTL_DRIVER(0) (status bit: id*2, req bit: id*2+1)
  930. */
  931. HSW_DISP_PW_GLOBAL = 15,
  932. /*
  933. * GEN9+
  934. * - HSW_PWR_WELL_CTL_DRIVER(0) (status bit: id*2, req bit: id*2+1)
  935. */
  936. SKL_DISP_PW_MISC_IO = 0,
  937. SKL_DISP_PW_DDI_A_E,
  938. GLK_DISP_PW_DDI_A = SKL_DISP_PW_DDI_A_E,
  939. CNL_DISP_PW_DDI_A = SKL_DISP_PW_DDI_A_E,
  940. SKL_DISP_PW_DDI_B,
  941. SKL_DISP_PW_DDI_C,
  942. SKL_DISP_PW_DDI_D,
  943. CNL_DISP_PW_DDI_F = 6,
  944. GLK_DISP_PW_AUX_A = 8,
  945. GLK_DISP_PW_AUX_B,
  946. GLK_DISP_PW_AUX_C,
  947. CNL_DISP_PW_AUX_A = GLK_DISP_PW_AUX_A,
  948. CNL_DISP_PW_AUX_B = GLK_DISP_PW_AUX_B,
  949. CNL_DISP_PW_AUX_C = GLK_DISP_PW_AUX_C,
  950. CNL_DISP_PW_AUX_D,
  951. CNL_DISP_PW_AUX_F,
  952. SKL_DISP_PW_1 = 14,
  953. SKL_DISP_PW_2,
  954. /* - custom power wells */
  955. SKL_DISP_PW_DC_OFF,
  956. BXT_DPIO_CMN_A,
  957. BXT_DPIO_CMN_BC,
  958. GLK_DPIO_CMN_C, /* 19 */
  959. /*
  960. * Multiple platforms.
  961. * Must start following the highest ID of any platform.
  962. * - custom power wells
  963. */
  964. I915_DISP_PW_ALWAYS_ON = 20,
  965. };
  966. #define PUNIT_REG_PWRGT_CTRL 0x60
  967. #define PUNIT_REG_PWRGT_STATUS 0x61
  968. #define PUNIT_PWRGT_MASK(power_well) (3 << ((power_well) * 2))
  969. #define PUNIT_PWRGT_PWR_ON(power_well) (0 << ((power_well) * 2))
  970. #define PUNIT_PWRGT_CLK_GATE(power_well) (1 << ((power_well) * 2))
  971. #define PUNIT_PWRGT_RESET(power_well) (2 << ((power_well) * 2))
  972. #define PUNIT_PWRGT_PWR_GATE(power_well) (3 << ((power_well) * 2))
  973. #define PUNIT_REG_GPU_LFM 0xd3
  974. #define PUNIT_REG_GPU_FREQ_REQ 0xd4
  975. #define PUNIT_REG_GPU_FREQ_STS 0xd8
  976. #define GPLLENABLE (1<<4)
  977. #define GENFREQSTATUS (1<<0)
  978. #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ 0xdc
  979. #define PUNIT_REG_CZ_TIMESTAMP 0xce
  980. #define PUNIT_FUSE_BUS2 0xf6 /* bits 47:40 */
  981. #define PUNIT_FUSE_BUS1 0xf5 /* bits 55:48 */
  982. #define FB_GFX_FMAX_AT_VMAX_FUSE 0x136
  983. #define FB_GFX_FREQ_FUSE_MASK 0xff
  984. #define FB_GFX_FMAX_AT_VMAX_2SS4EU_FUSE_SHIFT 24
  985. #define FB_GFX_FMAX_AT_VMAX_2SS6EU_FUSE_SHIFT 16
  986. #define FB_GFX_FMAX_AT_VMAX_2SS8EU_FUSE_SHIFT 8
  987. #define FB_GFX_FMIN_AT_VMIN_FUSE 0x137
  988. #define FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT 8
  989. #define PUNIT_REG_DDR_SETUP2 0x139
  990. #define FORCE_DDR_FREQ_REQ_ACK (1 << 8)
  991. #define FORCE_DDR_LOW_FREQ (1 << 1)
  992. #define FORCE_DDR_HIGH_FREQ (1 << 0)
  993. #define PUNIT_GPU_STATUS_REG 0xdb
  994. #define PUNIT_GPU_STATUS_MAX_FREQ_SHIFT 16
  995. #define PUNIT_GPU_STATUS_MAX_FREQ_MASK 0xff
  996. #define PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT 8
  997. #define PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK 0xff
  998. #define PUNIT_GPU_DUTYCYCLE_REG 0xdf
  999. #define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_SHIFT 8
  1000. #define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_MASK 0xff
  1001. #define IOSF_NC_FB_GFX_FREQ_FUSE 0x1c
  1002. #define FB_GFX_MAX_FREQ_FUSE_SHIFT 3
  1003. #define FB_GFX_MAX_FREQ_FUSE_MASK 0x000007f8
  1004. #define FB_GFX_FGUARANTEED_FREQ_FUSE_SHIFT 11
  1005. #define FB_GFX_FGUARANTEED_FREQ_FUSE_MASK 0x0007f800
  1006. #define IOSF_NC_FB_GFX_FMAX_FUSE_HI 0x34
  1007. #define FB_FMAX_VMIN_FREQ_HI_MASK 0x00000007
  1008. #define IOSF_NC_FB_GFX_FMAX_FUSE_LO 0x30
  1009. #define FB_FMAX_VMIN_FREQ_LO_SHIFT 27
  1010. #define FB_FMAX_VMIN_FREQ_LO_MASK 0xf8000000
  1011. #define VLV_TURBO_SOC_OVERRIDE 0x04
  1012. #define VLV_OVERRIDE_EN 1
  1013. #define VLV_SOC_TDP_EN (1 << 1)
  1014. #define VLV_BIAS_CPU_125_SOC_875 (6 << 2)
  1015. #define CHV_BIAS_CPU_50_SOC_50 (3 << 2)
  1016. /* vlv2 north clock has */
  1017. #define CCK_FUSE_REG 0x8
  1018. #define CCK_FUSE_HPLL_FREQ_MASK 0x3
  1019. #define CCK_REG_DSI_PLL_FUSE 0x44
  1020. #define CCK_REG_DSI_PLL_CONTROL 0x48
  1021. #define DSI_PLL_VCO_EN (1 << 31)
  1022. #define DSI_PLL_LDO_GATE (1 << 30)
  1023. #define DSI_PLL_P1_POST_DIV_SHIFT 17
  1024. #define DSI_PLL_P1_POST_DIV_MASK (0x1ff << 17)
  1025. #define DSI_PLL_P2_MUX_DSI0_DIV2 (1 << 13)
  1026. #define DSI_PLL_P3_MUX_DSI1_DIV2 (1 << 12)
  1027. #define DSI_PLL_MUX_MASK (3 << 9)
  1028. #define DSI_PLL_MUX_DSI0_DSIPLL (0 << 10)
  1029. #define DSI_PLL_MUX_DSI0_CCK (1 << 10)
  1030. #define DSI_PLL_MUX_DSI1_DSIPLL (0 << 9)
  1031. #define DSI_PLL_MUX_DSI1_CCK (1 << 9)
  1032. #define DSI_PLL_CLK_GATE_MASK (0xf << 5)
  1033. #define DSI_PLL_CLK_GATE_DSI0_DSIPLL (1 << 8)
  1034. #define DSI_PLL_CLK_GATE_DSI1_DSIPLL (1 << 7)
  1035. #define DSI_PLL_CLK_GATE_DSI0_CCK (1 << 6)
  1036. #define DSI_PLL_CLK_GATE_DSI1_CCK (1 << 5)
  1037. #define DSI_PLL_LOCK (1 << 0)
  1038. #define CCK_REG_DSI_PLL_DIVIDER 0x4c
  1039. #define DSI_PLL_LFSR (1 << 31)
  1040. #define DSI_PLL_FRACTION_EN (1 << 30)
  1041. #define DSI_PLL_FRAC_COUNTER_SHIFT 27
  1042. #define DSI_PLL_FRAC_COUNTER_MASK (7 << 27)
  1043. #define DSI_PLL_USYNC_CNT_SHIFT 18
  1044. #define DSI_PLL_USYNC_CNT_MASK (0x1ff << 18)
  1045. #define DSI_PLL_N1_DIV_SHIFT 16
  1046. #define DSI_PLL_N1_DIV_MASK (3 << 16)
  1047. #define DSI_PLL_M1_DIV_SHIFT 0
  1048. #define DSI_PLL_M1_DIV_MASK (0x1ff << 0)
  1049. #define CCK_CZ_CLOCK_CONTROL 0x62
  1050. #define CCK_GPLL_CLOCK_CONTROL 0x67
  1051. #define CCK_DISPLAY_CLOCK_CONTROL 0x6b
  1052. #define CCK_DISPLAY_REF_CLOCK_CONTROL 0x6c
  1053. #define CCK_TRUNK_FORCE_ON (1 << 17)
  1054. #define CCK_TRUNK_FORCE_OFF (1 << 16)
  1055. #define CCK_FREQUENCY_STATUS (0x1f << 8)
  1056. #define CCK_FREQUENCY_STATUS_SHIFT 8
  1057. #define CCK_FREQUENCY_VALUES (0x1f << 0)
  1058. /* DPIO registers */
  1059. #define DPIO_DEVFN 0
  1060. #define DPIO_CTL _MMIO(VLV_DISPLAY_BASE + 0x2110)
  1061. #define DPIO_MODSEL1 (1<<3) /* if ref clk b == 27 */
  1062. #define DPIO_MODSEL0 (1<<2) /* if ref clk a == 27 */
  1063. #define DPIO_SFR_BYPASS (1<<1)
  1064. #define DPIO_CMNRST (1<<0)
  1065. #define DPIO_PHY(pipe) ((pipe) >> 1)
  1066. #define DPIO_PHY_IOSF_PORT(phy) (dev_priv->dpio_phy_iosf_port[phy])
  1067. /*
  1068. * Per pipe/PLL DPIO regs
  1069. */
  1070. #define _VLV_PLL_DW3_CH0 0x800c
  1071. #define DPIO_POST_DIV_SHIFT (28) /* 3 bits */
  1072. #define DPIO_POST_DIV_DAC 0
  1073. #define DPIO_POST_DIV_HDMIDP 1 /* DAC 225-400M rate */
  1074. #define DPIO_POST_DIV_LVDS1 2
  1075. #define DPIO_POST_DIV_LVDS2 3
  1076. #define DPIO_K_SHIFT (24) /* 4 bits */
  1077. #define DPIO_P1_SHIFT (21) /* 3 bits */
  1078. #define DPIO_P2_SHIFT (16) /* 5 bits */
  1079. #define DPIO_N_SHIFT (12) /* 4 bits */
  1080. #define DPIO_ENABLE_CALIBRATION (1<<11)
  1081. #define DPIO_M1DIV_SHIFT (8) /* 3 bits */
  1082. #define DPIO_M2DIV_MASK 0xff
  1083. #define _VLV_PLL_DW3_CH1 0x802c
  1084. #define VLV_PLL_DW3(ch) _PIPE(ch, _VLV_PLL_DW3_CH0, _VLV_PLL_DW3_CH1)
  1085. #define _VLV_PLL_DW5_CH0 0x8014
  1086. #define DPIO_REFSEL_OVERRIDE 27
  1087. #define DPIO_PLL_MODESEL_SHIFT 24 /* 3 bits */
  1088. #define DPIO_BIAS_CURRENT_CTL_SHIFT 21 /* 3 bits, always 0x7 */
  1089. #define DPIO_PLL_REFCLK_SEL_SHIFT 16 /* 2 bits */
  1090. #define DPIO_PLL_REFCLK_SEL_MASK 3
  1091. #define DPIO_DRIVER_CTL_SHIFT 12 /* always set to 0x8 */
  1092. #define DPIO_CLK_BIAS_CTL_SHIFT 8 /* always set to 0x5 */
  1093. #define _VLV_PLL_DW5_CH1 0x8034
  1094. #define VLV_PLL_DW5(ch) _PIPE(ch, _VLV_PLL_DW5_CH0, _VLV_PLL_DW5_CH1)
  1095. #define _VLV_PLL_DW7_CH0 0x801c
  1096. #define _VLV_PLL_DW7_CH1 0x803c
  1097. #define VLV_PLL_DW7(ch) _PIPE(ch, _VLV_PLL_DW7_CH0, _VLV_PLL_DW7_CH1)
  1098. #define _VLV_PLL_DW8_CH0 0x8040
  1099. #define _VLV_PLL_DW8_CH1 0x8060
  1100. #define VLV_PLL_DW8(ch) _PIPE(ch, _VLV_PLL_DW8_CH0, _VLV_PLL_DW8_CH1)
  1101. #define VLV_PLL_DW9_BCAST 0xc044
  1102. #define _VLV_PLL_DW9_CH0 0x8044
  1103. #define _VLV_PLL_DW9_CH1 0x8064
  1104. #define VLV_PLL_DW9(ch) _PIPE(ch, _VLV_PLL_DW9_CH0, _VLV_PLL_DW9_CH1)
  1105. #define _VLV_PLL_DW10_CH0 0x8048
  1106. #define _VLV_PLL_DW10_CH1 0x8068
  1107. #define VLV_PLL_DW10(ch) _PIPE(ch, _VLV_PLL_DW10_CH0, _VLV_PLL_DW10_CH1)
  1108. #define _VLV_PLL_DW11_CH0 0x804c
  1109. #define _VLV_PLL_DW11_CH1 0x806c
  1110. #define VLV_PLL_DW11(ch) _PIPE(ch, _VLV_PLL_DW11_CH0, _VLV_PLL_DW11_CH1)
  1111. /* Spec for ref block start counts at DW10 */
  1112. #define VLV_REF_DW13 0x80ac
  1113. #define VLV_CMN_DW0 0x8100
  1114. /*
  1115. * Per DDI channel DPIO regs
  1116. */
  1117. #define _VLV_PCS_DW0_CH0 0x8200
  1118. #define _VLV_PCS_DW0_CH1 0x8400
  1119. #define DPIO_PCS_TX_LANE2_RESET (1<<16)
  1120. #define DPIO_PCS_TX_LANE1_RESET (1<<7)
  1121. #define DPIO_LEFT_TXFIFO_RST_MASTER2 (1<<4)
  1122. #define DPIO_RIGHT_TXFIFO_RST_MASTER2 (1<<3)
  1123. #define VLV_PCS_DW0(ch) _PORT(ch, _VLV_PCS_DW0_CH0, _VLV_PCS_DW0_CH1)
  1124. #define _VLV_PCS01_DW0_CH0 0x200
  1125. #define _VLV_PCS23_DW0_CH0 0x400
  1126. #define _VLV_PCS01_DW0_CH1 0x2600
  1127. #define _VLV_PCS23_DW0_CH1 0x2800
  1128. #define VLV_PCS01_DW0(ch) _PORT(ch, _VLV_PCS01_DW0_CH0, _VLV_PCS01_DW0_CH1)
  1129. #define VLV_PCS23_DW0(ch) _PORT(ch, _VLV_PCS23_DW0_CH0, _VLV_PCS23_DW0_CH1)
  1130. #define _VLV_PCS_DW1_CH0 0x8204
  1131. #define _VLV_PCS_DW1_CH1 0x8404
  1132. #define CHV_PCS_REQ_SOFTRESET_EN (1<<23)
  1133. #define DPIO_PCS_CLK_CRI_RXEB_EIOS_EN (1<<22)
  1134. #define DPIO_PCS_CLK_CRI_RXDIGFILTSG_EN (1<<21)
  1135. #define DPIO_PCS_CLK_DATAWIDTH_SHIFT (6)
  1136. #define DPIO_PCS_CLK_SOFT_RESET (1<<5)
  1137. #define VLV_PCS_DW1(ch) _PORT(ch, _VLV_PCS_DW1_CH0, _VLV_PCS_DW1_CH1)
  1138. #define _VLV_PCS01_DW1_CH0 0x204
  1139. #define _VLV_PCS23_DW1_CH0 0x404
  1140. #define _VLV_PCS01_DW1_CH1 0x2604
  1141. #define _VLV_PCS23_DW1_CH1 0x2804
  1142. #define VLV_PCS01_DW1(ch) _PORT(ch, _VLV_PCS01_DW1_CH0, _VLV_PCS01_DW1_CH1)
  1143. #define VLV_PCS23_DW1(ch) _PORT(ch, _VLV_PCS23_DW1_CH0, _VLV_PCS23_DW1_CH1)
  1144. #define _VLV_PCS_DW8_CH0 0x8220
  1145. #define _VLV_PCS_DW8_CH1 0x8420
  1146. #define CHV_PCS_USEDCLKCHANNEL_OVRRIDE (1 << 20)
  1147. #define CHV_PCS_USEDCLKCHANNEL (1 << 21)
  1148. #define VLV_PCS_DW8(ch) _PORT(ch, _VLV_PCS_DW8_CH0, _VLV_PCS_DW8_CH1)
  1149. #define _VLV_PCS01_DW8_CH0 0x0220
  1150. #define _VLV_PCS23_DW8_CH0 0x0420
  1151. #define _VLV_PCS01_DW8_CH1 0x2620
  1152. #define _VLV_PCS23_DW8_CH1 0x2820
  1153. #define VLV_PCS01_DW8(port) _PORT(port, _VLV_PCS01_DW8_CH0, _VLV_PCS01_DW8_CH1)
  1154. #define VLV_PCS23_DW8(port) _PORT(port, _VLV_PCS23_DW8_CH0, _VLV_PCS23_DW8_CH1)
  1155. #define _VLV_PCS_DW9_CH0 0x8224
  1156. #define _VLV_PCS_DW9_CH1 0x8424
  1157. #define DPIO_PCS_TX2MARGIN_MASK (0x7<<13)
  1158. #define DPIO_PCS_TX2MARGIN_000 (0<<13)
  1159. #define DPIO_PCS_TX2MARGIN_101 (1<<13)
  1160. #define DPIO_PCS_TX1MARGIN_MASK (0x7<<10)
  1161. #define DPIO_PCS_TX1MARGIN_000 (0<<10)
  1162. #define DPIO_PCS_TX1MARGIN_101 (1<<10)
  1163. #define VLV_PCS_DW9(ch) _PORT(ch, _VLV_PCS_DW9_CH0, _VLV_PCS_DW9_CH1)
  1164. #define _VLV_PCS01_DW9_CH0 0x224
  1165. #define _VLV_PCS23_DW9_CH0 0x424
  1166. #define _VLV_PCS01_DW9_CH1 0x2624
  1167. #define _VLV_PCS23_DW9_CH1 0x2824
  1168. #define VLV_PCS01_DW9(ch) _PORT(ch, _VLV_PCS01_DW9_CH0, _VLV_PCS01_DW9_CH1)
  1169. #define VLV_PCS23_DW9(ch) _PORT(ch, _VLV_PCS23_DW9_CH0, _VLV_PCS23_DW9_CH1)
  1170. #define _CHV_PCS_DW10_CH0 0x8228
  1171. #define _CHV_PCS_DW10_CH1 0x8428
  1172. #define DPIO_PCS_SWING_CALC_TX0_TX2 (1<<30)
  1173. #define DPIO_PCS_SWING_CALC_TX1_TX3 (1<<31)
  1174. #define DPIO_PCS_TX2DEEMP_MASK (0xf<<24)
  1175. #define DPIO_PCS_TX2DEEMP_9P5 (0<<24)
  1176. #define DPIO_PCS_TX2DEEMP_6P0 (2<<24)
  1177. #define DPIO_PCS_TX1DEEMP_MASK (0xf<<16)
  1178. #define DPIO_PCS_TX1DEEMP_9P5 (0<<16)
  1179. #define DPIO_PCS_TX1DEEMP_6P0 (2<<16)
  1180. #define CHV_PCS_DW10(ch) _PORT(ch, _CHV_PCS_DW10_CH0, _CHV_PCS_DW10_CH1)
  1181. #define _VLV_PCS01_DW10_CH0 0x0228
  1182. #define _VLV_PCS23_DW10_CH0 0x0428
  1183. #define _VLV_PCS01_DW10_CH1 0x2628
  1184. #define _VLV_PCS23_DW10_CH1 0x2828
  1185. #define VLV_PCS01_DW10(port) _PORT(port, _VLV_PCS01_DW10_CH0, _VLV_PCS01_DW10_CH1)
  1186. #define VLV_PCS23_DW10(port) _PORT(port, _VLV_PCS23_DW10_CH0, _VLV_PCS23_DW10_CH1)
  1187. #define _VLV_PCS_DW11_CH0 0x822c
  1188. #define _VLV_PCS_DW11_CH1 0x842c
  1189. #define DPIO_TX2_STAGGER_MASK(x) ((x)<<24)
  1190. #define DPIO_LANEDESKEW_STRAP_OVRD (1<<3)
  1191. #define DPIO_LEFT_TXFIFO_RST_MASTER (1<<1)
  1192. #define DPIO_RIGHT_TXFIFO_RST_MASTER (1<<0)
  1193. #define VLV_PCS_DW11(ch) _PORT(ch, _VLV_PCS_DW11_CH0, _VLV_PCS_DW11_CH1)
  1194. #define _VLV_PCS01_DW11_CH0 0x022c
  1195. #define _VLV_PCS23_DW11_CH0 0x042c
  1196. #define _VLV_PCS01_DW11_CH1 0x262c
  1197. #define _VLV_PCS23_DW11_CH1 0x282c
  1198. #define VLV_PCS01_DW11(ch) _PORT(ch, _VLV_PCS01_DW11_CH0, _VLV_PCS01_DW11_CH1)
  1199. #define VLV_PCS23_DW11(ch) _PORT(ch, _VLV_PCS23_DW11_CH0, _VLV_PCS23_DW11_CH1)
  1200. #define _VLV_PCS01_DW12_CH0 0x0230
  1201. #define _VLV_PCS23_DW12_CH0 0x0430
  1202. #define _VLV_PCS01_DW12_CH1 0x2630
  1203. #define _VLV_PCS23_DW12_CH1 0x2830
  1204. #define VLV_PCS01_DW12(ch) _PORT(ch, _VLV_PCS01_DW12_CH0, _VLV_PCS01_DW12_CH1)
  1205. #define VLV_PCS23_DW12(ch) _PORT(ch, _VLV_PCS23_DW12_CH0, _VLV_PCS23_DW12_CH1)
  1206. #define _VLV_PCS_DW12_CH0 0x8230
  1207. #define _VLV_PCS_DW12_CH1 0x8430
  1208. #define DPIO_TX2_STAGGER_MULT(x) ((x)<<20)
  1209. #define DPIO_TX1_STAGGER_MULT(x) ((x)<<16)
  1210. #define DPIO_TX1_STAGGER_MASK(x) ((x)<<8)
  1211. #define DPIO_LANESTAGGER_STRAP_OVRD (1<<6)
  1212. #define DPIO_LANESTAGGER_STRAP(x) ((x)<<0)
  1213. #define VLV_PCS_DW12(ch) _PORT(ch, _VLV_PCS_DW12_CH0, _VLV_PCS_DW12_CH1)
  1214. #define _VLV_PCS_DW14_CH0 0x8238
  1215. #define _VLV_PCS_DW14_CH1 0x8438
  1216. #define VLV_PCS_DW14(ch) _PORT(ch, _VLV_PCS_DW14_CH0, _VLV_PCS_DW14_CH1)
  1217. #define _VLV_PCS_DW23_CH0 0x825c
  1218. #define _VLV_PCS_DW23_CH1 0x845c
  1219. #define VLV_PCS_DW23(ch) _PORT(ch, _VLV_PCS_DW23_CH0, _VLV_PCS_DW23_CH1)
  1220. #define _VLV_TX_DW2_CH0 0x8288
  1221. #define _VLV_TX_DW2_CH1 0x8488
  1222. #define DPIO_SWING_MARGIN000_SHIFT 16
  1223. #define DPIO_SWING_MARGIN000_MASK (0xff << DPIO_SWING_MARGIN000_SHIFT)
  1224. #define DPIO_UNIQ_TRANS_SCALE_SHIFT 8
  1225. #define VLV_TX_DW2(ch) _PORT(ch, _VLV_TX_DW2_CH0, _VLV_TX_DW2_CH1)
  1226. #define _VLV_TX_DW3_CH0 0x828c
  1227. #define _VLV_TX_DW3_CH1 0x848c
  1228. /* The following bit for CHV phy */
  1229. #define DPIO_TX_UNIQ_TRANS_SCALE_EN (1<<27)
  1230. #define DPIO_SWING_MARGIN101_SHIFT 16
  1231. #define DPIO_SWING_MARGIN101_MASK (0xff << DPIO_SWING_MARGIN101_SHIFT)
  1232. #define VLV_TX_DW3(ch) _PORT(ch, _VLV_TX_DW3_CH0, _VLV_TX_DW3_CH1)
  1233. #define _VLV_TX_DW4_CH0 0x8290
  1234. #define _VLV_TX_DW4_CH1 0x8490
  1235. #define DPIO_SWING_DEEMPH9P5_SHIFT 24
  1236. #define DPIO_SWING_DEEMPH9P5_MASK (0xff << DPIO_SWING_DEEMPH9P5_SHIFT)
  1237. #define DPIO_SWING_DEEMPH6P0_SHIFT 16
  1238. #define DPIO_SWING_DEEMPH6P0_MASK (0xff << DPIO_SWING_DEEMPH6P0_SHIFT)
  1239. #define VLV_TX_DW4(ch) _PORT(ch, _VLV_TX_DW4_CH0, _VLV_TX_DW4_CH1)
  1240. #define _VLV_TX3_DW4_CH0 0x690
  1241. #define _VLV_TX3_DW4_CH1 0x2a90
  1242. #define VLV_TX3_DW4(ch) _PORT(ch, _VLV_TX3_DW4_CH0, _VLV_TX3_DW4_CH1)
  1243. #define _VLV_TX_DW5_CH0 0x8294
  1244. #define _VLV_TX_DW5_CH1 0x8494
  1245. #define DPIO_TX_OCALINIT_EN (1<<31)
  1246. #define VLV_TX_DW5(ch) _PORT(ch, _VLV_TX_DW5_CH0, _VLV_TX_DW5_CH1)
  1247. #define _VLV_TX_DW11_CH0 0x82ac
  1248. #define _VLV_TX_DW11_CH1 0x84ac
  1249. #define VLV_TX_DW11(ch) _PORT(ch, _VLV_TX_DW11_CH0, _VLV_TX_DW11_CH1)
  1250. #define _VLV_TX_DW14_CH0 0x82b8
  1251. #define _VLV_TX_DW14_CH1 0x84b8
  1252. #define VLV_TX_DW14(ch) _PORT(ch, _VLV_TX_DW14_CH0, _VLV_TX_DW14_CH1)
  1253. /* CHV dpPhy registers */
  1254. #define _CHV_PLL_DW0_CH0 0x8000
  1255. #define _CHV_PLL_DW0_CH1 0x8180
  1256. #define CHV_PLL_DW0(ch) _PIPE(ch, _CHV_PLL_DW0_CH0, _CHV_PLL_DW0_CH1)
  1257. #define _CHV_PLL_DW1_CH0 0x8004
  1258. #define _CHV_PLL_DW1_CH1 0x8184
  1259. #define DPIO_CHV_N_DIV_SHIFT 8
  1260. #define DPIO_CHV_M1_DIV_BY_2 (0 << 0)
  1261. #define CHV_PLL_DW1(ch) _PIPE(ch, _CHV_PLL_DW1_CH0, _CHV_PLL_DW1_CH1)
  1262. #define _CHV_PLL_DW2_CH0 0x8008
  1263. #define _CHV_PLL_DW2_CH1 0x8188
  1264. #define CHV_PLL_DW2(ch) _PIPE(ch, _CHV_PLL_DW2_CH0, _CHV_PLL_DW2_CH1)
  1265. #define _CHV_PLL_DW3_CH0 0x800c
  1266. #define _CHV_PLL_DW3_CH1 0x818c
  1267. #define DPIO_CHV_FRAC_DIV_EN (1 << 16)
  1268. #define DPIO_CHV_FIRST_MOD (0 << 8)
  1269. #define DPIO_CHV_SECOND_MOD (1 << 8)
  1270. #define DPIO_CHV_FEEDFWD_GAIN_SHIFT 0
  1271. #define DPIO_CHV_FEEDFWD_GAIN_MASK (0xF << 0)
  1272. #define CHV_PLL_DW3(ch) _PIPE(ch, _CHV_PLL_DW3_CH0, _CHV_PLL_DW3_CH1)
  1273. #define _CHV_PLL_DW6_CH0 0x8018
  1274. #define _CHV_PLL_DW6_CH1 0x8198
  1275. #define DPIO_CHV_GAIN_CTRL_SHIFT 16
  1276. #define DPIO_CHV_INT_COEFF_SHIFT 8
  1277. #define DPIO_CHV_PROP_COEFF_SHIFT 0
  1278. #define CHV_PLL_DW6(ch) _PIPE(ch, _CHV_PLL_DW6_CH0, _CHV_PLL_DW6_CH1)
  1279. #define _CHV_PLL_DW8_CH0 0x8020
  1280. #define _CHV_PLL_DW8_CH1 0x81A0
  1281. #define DPIO_CHV_TDC_TARGET_CNT_SHIFT 0
  1282. #define DPIO_CHV_TDC_TARGET_CNT_MASK (0x3FF << 0)
  1283. #define CHV_PLL_DW8(ch) _PIPE(ch, _CHV_PLL_DW8_CH0, _CHV_PLL_DW8_CH1)
  1284. #define _CHV_PLL_DW9_CH0 0x8024
  1285. #define _CHV_PLL_DW9_CH1 0x81A4
  1286. #define DPIO_CHV_INT_LOCK_THRESHOLD_SHIFT 1 /* 3 bits */
  1287. #define DPIO_CHV_INT_LOCK_THRESHOLD_MASK (7 << 1)
  1288. #define DPIO_CHV_INT_LOCK_THRESHOLD_SEL_COARSE 1 /* 1: coarse & 0 : fine */
  1289. #define CHV_PLL_DW9(ch) _PIPE(ch, _CHV_PLL_DW9_CH0, _CHV_PLL_DW9_CH1)
  1290. #define _CHV_CMN_DW0_CH0 0x8100
  1291. #define DPIO_ALLDL_POWERDOWN_SHIFT_CH0 19
  1292. #define DPIO_ANYDL_POWERDOWN_SHIFT_CH0 18
  1293. #define DPIO_ALLDL_POWERDOWN (1 << 1)
  1294. #define DPIO_ANYDL_POWERDOWN (1 << 0)
  1295. #define _CHV_CMN_DW5_CH0 0x8114
  1296. #define CHV_BUFRIGHTENA1_DISABLE (0 << 20)
  1297. #define CHV_BUFRIGHTENA1_NORMAL (1 << 20)
  1298. #define CHV_BUFRIGHTENA1_FORCE (3 << 20)
  1299. #define CHV_BUFRIGHTENA1_MASK (3 << 20)
  1300. #define CHV_BUFLEFTENA1_DISABLE (0 << 22)
  1301. #define CHV_BUFLEFTENA1_NORMAL (1 << 22)
  1302. #define CHV_BUFLEFTENA1_FORCE (3 << 22)
  1303. #define CHV_BUFLEFTENA1_MASK (3 << 22)
  1304. #define _CHV_CMN_DW13_CH0 0x8134
  1305. #define _CHV_CMN_DW0_CH1 0x8080
  1306. #define DPIO_CHV_S1_DIV_SHIFT 21
  1307. #define DPIO_CHV_P1_DIV_SHIFT 13 /* 3 bits */
  1308. #define DPIO_CHV_P2_DIV_SHIFT 8 /* 5 bits */
  1309. #define DPIO_CHV_K_DIV_SHIFT 4
  1310. #define DPIO_PLL_FREQLOCK (1 << 1)
  1311. #define DPIO_PLL_LOCK (1 << 0)
  1312. #define CHV_CMN_DW13(ch) _PIPE(ch, _CHV_CMN_DW13_CH0, _CHV_CMN_DW0_CH1)
  1313. #define _CHV_CMN_DW14_CH0 0x8138
  1314. #define _CHV_CMN_DW1_CH1 0x8084
  1315. #define DPIO_AFC_RECAL (1 << 14)
  1316. #define DPIO_DCLKP_EN (1 << 13)
  1317. #define CHV_BUFLEFTENA2_DISABLE (0 << 17) /* CL2 DW1 only */
  1318. #define CHV_BUFLEFTENA2_NORMAL (1 << 17) /* CL2 DW1 only */
  1319. #define CHV_BUFLEFTENA2_FORCE (3 << 17) /* CL2 DW1 only */
  1320. #define CHV_BUFLEFTENA2_MASK (3 << 17) /* CL2 DW1 only */
  1321. #define CHV_BUFRIGHTENA2_DISABLE (0 << 19) /* CL2 DW1 only */
  1322. #define CHV_BUFRIGHTENA2_NORMAL (1 << 19) /* CL2 DW1 only */
  1323. #define CHV_BUFRIGHTENA2_FORCE (3 << 19) /* CL2 DW1 only */
  1324. #define CHV_BUFRIGHTENA2_MASK (3 << 19) /* CL2 DW1 only */
  1325. #define CHV_CMN_DW14(ch) _PIPE(ch, _CHV_CMN_DW14_CH0, _CHV_CMN_DW1_CH1)
  1326. #define _CHV_CMN_DW19_CH0 0x814c
  1327. #define _CHV_CMN_DW6_CH1 0x8098
  1328. #define DPIO_ALLDL_POWERDOWN_SHIFT_CH1 30 /* CL2 DW6 only */
  1329. #define DPIO_ANYDL_POWERDOWN_SHIFT_CH1 29 /* CL2 DW6 only */
  1330. #define DPIO_DYNPWRDOWNEN_CH1 (1 << 28) /* CL2 DW6 only */
  1331. #define CHV_CMN_USEDCLKCHANNEL (1 << 13)
  1332. #define CHV_CMN_DW19(ch) _PIPE(ch, _CHV_CMN_DW19_CH0, _CHV_CMN_DW6_CH1)
  1333. #define CHV_CMN_DW28 0x8170
  1334. #define DPIO_CL1POWERDOWNEN (1 << 23)
  1335. #define DPIO_DYNPWRDOWNEN_CH0 (1 << 22)
  1336. #define DPIO_SUS_CLK_CONFIG_ON (0 << 0)
  1337. #define DPIO_SUS_CLK_CONFIG_CLKREQ (1 << 0)
  1338. #define DPIO_SUS_CLK_CONFIG_GATE (2 << 0)
  1339. #define DPIO_SUS_CLK_CONFIG_GATE_CLKREQ (3 << 0)
  1340. #define CHV_CMN_DW30 0x8178
  1341. #define DPIO_CL2_LDOFUSE_PWRENB (1 << 6)
  1342. #define DPIO_LRC_BYPASS (1 << 3)
  1343. #define _TXLANE(ch, lane, offset) ((ch ? 0x2400 : 0) + \
  1344. (lane) * 0x200 + (offset))
  1345. #define CHV_TX_DW0(ch, lane) _TXLANE(ch, lane, 0x80)
  1346. #define CHV_TX_DW1(ch, lane) _TXLANE(ch, lane, 0x84)
  1347. #define CHV_TX_DW2(ch, lane) _TXLANE(ch, lane, 0x88)
  1348. #define CHV_TX_DW3(ch, lane) _TXLANE(ch, lane, 0x8c)
  1349. #define CHV_TX_DW4(ch, lane) _TXLANE(ch, lane, 0x90)
  1350. #define CHV_TX_DW5(ch, lane) _TXLANE(ch, lane, 0x94)
  1351. #define CHV_TX_DW6(ch, lane) _TXLANE(ch, lane, 0x98)
  1352. #define CHV_TX_DW7(ch, lane) _TXLANE(ch, lane, 0x9c)
  1353. #define CHV_TX_DW8(ch, lane) _TXLANE(ch, lane, 0xa0)
  1354. #define CHV_TX_DW9(ch, lane) _TXLANE(ch, lane, 0xa4)
  1355. #define CHV_TX_DW10(ch, lane) _TXLANE(ch, lane, 0xa8)
  1356. #define CHV_TX_DW11(ch, lane) _TXLANE(ch, lane, 0xac)
  1357. #define DPIO_FRC_LATENCY_SHFIT 8
  1358. #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
  1359. #define DPIO_UPAR_SHIFT 30
  1360. /* BXT PHY registers */
  1361. #define _BXT_PHY0_BASE 0x6C000
  1362. #define _BXT_PHY1_BASE 0x162000
  1363. #define _BXT_PHY2_BASE 0x163000
  1364. #define BXT_PHY_BASE(phy) _PHY3((phy), _BXT_PHY0_BASE, \
  1365. _BXT_PHY1_BASE, \
  1366. _BXT_PHY2_BASE)
  1367. #define _BXT_PHY(phy, reg) \
  1368. _MMIO(BXT_PHY_BASE(phy) - _BXT_PHY0_BASE + (reg))
  1369. #define _BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \
  1370. (BXT_PHY_BASE(phy) + _PIPE((ch), (reg_ch0) - _BXT_PHY0_BASE, \
  1371. (reg_ch1) - _BXT_PHY0_BASE))
  1372. #define _MMIO_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1) \
  1373. _MMIO(_BXT_PHY_CH(phy, ch, reg_ch0, reg_ch1))
  1374. #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)
  1375. #define MIPIO_RST_CTRL (1 << 2)
  1376. #define _BXT_PHY_CTL_DDI_A 0x64C00
  1377. #define _BXT_PHY_CTL_DDI_B 0x64C10
  1378. #define _BXT_PHY_CTL_DDI_C 0x64C20
  1379. #define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10)
  1380. #define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9)
  1381. #define BXT_PHY_LANE_ENABLED (1 << 8)
  1382. #define BXT_PHY_CTL(port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
  1383. _BXT_PHY_CTL_DDI_B)
  1384. #define _PHY_CTL_FAMILY_EDP 0x64C80
  1385. #define _PHY_CTL_FAMILY_DDI 0x64C90
  1386. #define _PHY_CTL_FAMILY_DDI_C 0x64CA0
  1387. #define COMMON_RESET_DIS (1 << 31)
  1388. #define BXT_PHY_CTL_FAMILY(phy) _MMIO_PHY3((phy), _PHY_CTL_FAMILY_DDI, \
  1389. _PHY_CTL_FAMILY_EDP, \
  1390. _PHY_CTL_FAMILY_DDI_C)
  1391. /* BXT PHY PLL registers */
  1392. #define _PORT_PLL_A 0x46074
  1393. #define _PORT_PLL_B 0x46078
  1394. #define _PORT_PLL_C 0x4607c
  1395. #define PORT_PLL_ENABLE (1 << 31)
  1396. #define PORT_PLL_LOCK (1 << 30)
  1397. #define PORT_PLL_REF_SEL (1 << 27)
  1398. #define PORT_PLL_POWER_ENABLE (1 << 26)
  1399. #define PORT_PLL_POWER_STATE (1 << 25)
  1400. #define BXT_PORT_PLL_ENABLE(port) _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
  1401. #define _PORT_PLL_EBB_0_A 0x162034
  1402. #define _PORT_PLL_EBB_0_B 0x6C034
  1403. #define _PORT_PLL_EBB_0_C 0x6C340
  1404. #define PORT_PLL_P1_SHIFT 13
  1405. #define PORT_PLL_P1_MASK (0x07 << PORT_PLL_P1_SHIFT)
  1406. #define PORT_PLL_P1(x) ((x) << PORT_PLL_P1_SHIFT)
  1407. #define PORT_PLL_P2_SHIFT 8
  1408. #define PORT_PLL_P2_MASK (0x1f << PORT_PLL_P2_SHIFT)
  1409. #define PORT_PLL_P2(x) ((x) << PORT_PLL_P2_SHIFT)
  1410. #define BXT_PORT_PLL_EBB_0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1411. _PORT_PLL_EBB_0_B, \
  1412. _PORT_PLL_EBB_0_C)
  1413. #define _PORT_PLL_EBB_4_A 0x162038
  1414. #define _PORT_PLL_EBB_4_B 0x6C038
  1415. #define _PORT_PLL_EBB_4_C 0x6C344
  1416. #define PORT_PLL_10BIT_CLK_ENABLE (1 << 13)
  1417. #define PORT_PLL_RECALIBRATE (1 << 14)
  1418. #define BXT_PORT_PLL_EBB_4(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1419. _PORT_PLL_EBB_4_B, \
  1420. _PORT_PLL_EBB_4_C)
  1421. #define _PORT_PLL_0_A 0x162100
  1422. #define _PORT_PLL_0_B 0x6C100
  1423. #define _PORT_PLL_0_C 0x6C380
  1424. /* PORT_PLL_0_A */
  1425. #define PORT_PLL_M2_MASK 0xFF
  1426. /* PORT_PLL_1_A */
  1427. #define PORT_PLL_N_SHIFT 8
  1428. #define PORT_PLL_N_MASK (0x0F << PORT_PLL_N_SHIFT)
  1429. #define PORT_PLL_N(x) ((x) << PORT_PLL_N_SHIFT)
  1430. /* PORT_PLL_2_A */
  1431. #define PORT_PLL_M2_FRAC_MASK 0x3FFFFF
  1432. /* PORT_PLL_3_A */
  1433. #define PORT_PLL_M2_FRAC_ENABLE (1 << 16)
  1434. /* PORT_PLL_6_A */
  1435. #define PORT_PLL_PROP_COEFF_MASK 0xF
  1436. #define PORT_PLL_INT_COEFF_MASK (0x1F << 8)
  1437. #define PORT_PLL_INT_COEFF(x) ((x) << 8)
  1438. #define PORT_PLL_GAIN_CTL_MASK (0x07 << 16)
  1439. #define PORT_PLL_GAIN_CTL(x) ((x) << 16)
  1440. /* PORT_PLL_8_A */
  1441. #define PORT_PLL_TARGET_CNT_MASK 0x3FF
  1442. /* PORT_PLL_9_A */
  1443. #define PORT_PLL_LOCK_THRESHOLD_SHIFT 1
  1444. #define PORT_PLL_LOCK_THRESHOLD_MASK (0x7 << PORT_PLL_LOCK_THRESHOLD_SHIFT)
  1445. /* PORT_PLL_10_A */
  1446. #define PORT_PLL_DCO_AMP_OVR_EN_H (1<<27)
  1447. #define PORT_PLL_DCO_AMP_DEFAULT 15
  1448. #define PORT_PLL_DCO_AMP_MASK 0x3c00
  1449. #define PORT_PLL_DCO_AMP(x) ((x)<<10)
  1450. #define _PORT_PLL_BASE(phy, ch) _BXT_PHY_CH(phy, ch, \
  1451. _PORT_PLL_0_B, \
  1452. _PORT_PLL_0_C)
  1453. #define BXT_PORT_PLL(phy, ch, idx) _MMIO(_PORT_PLL_BASE(phy, ch) + \
  1454. (idx) * 4)
  1455. /* BXT PHY common lane registers */
  1456. #define _PORT_CL1CM_DW0_A 0x162000
  1457. #define _PORT_CL1CM_DW0_BC 0x6C000
  1458. #define PHY_POWER_GOOD (1 << 16)
  1459. #define PHY_RESERVED (1 << 7)
  1460. #define BXT_PORT_CL1CM_DW0(phy) _BXT_PHY((phy), _PORT_CL1CM_DW0_BC)
  1461. #define CNL_PORT_CL1CM_DW5 _MMIO(0x162014)
  1462. #define CL_POWER_DOWN_ENABLE (1 << 4)
  1463. #define SUS_CLOCK_CONFIG (3 << 0)
  1464. #define _ICL_PORT_CL_DW5_A 0x162014
  1465. #define _ICL_PORT_CL_DW5_B 0x6C014
  1466. #define ICL_PORT_CL_DW5(port) _MMIO_PORT(port, _ICL_PORT_CL_DW5_A, \
  1467. _ICL_PORT_CL_DW5_B)
  1468. #define _PORT_CL1CM_DW9_A 0x162024
  1469. #define _PORT_CL1CM_DW9_BC 0x6C024
  1470. #define IREF0RC_OFFSET_SHIFT 8
  1471. #define IREF0RC_OFFSET_MASK (0xFF << IREF0RC_OFFSET_SHIFT)
  1472. #define BXT_PORT_CL1CM_DW9(phy) _BXT_PHY((phy), _PORT_CL1CM_DW9_BC)
  1473. #define _PORT_CL1CM_DW10_A 0x162028
  1474. #define _PORT_CL1CM_DW10_BC 0x6C028
  1475. #define IREF1RC_OFFSET_SHIFT 8
  1476. #define IREF1RC_OFFSET_MASK (0xFF << IREF1RC_OFFSET_SHIFT)
  1477. #define BXT_PORT_CL1CM_DW10(phy) _BXT_PHY((phy), _PORT_CL1CM_DW10_BC)
  1478. #define _PORT_CL1CM_DW28_A 0x162070
  1479. #define _PORT_CL1CM_DW28_BC 0x6C070
  1480. #define OCL1_POWER_DOWN_EN (1 << 23)
  1481. #define DW28_OLDO_DYN_PWR_DOWN_EN (1 << 22)
  1482. #define SUS_CLK_CONFIG 0x3
  1483. #define BXT_PORT_CL1CM_DW28(phy) _BXT_PHY((phy), _PORT_CL1CM_DW28_BC)
  1484. #define _PORT_CL1CM_DW30_A 0x162078
  1485. #define _PORT_CL1CM_DW30_BC 0x6C078
  1486. #define OCL2_LDOFUSE_PWR_DIS (1 << 6)
  1487. #define BXT_PORT_CL1CM_DW30(phy) _BXT_PHY((phy), _PORT_CL1CM_DW30_BC)
  1488. #define _CNL_PORT_PCS_DW1_GRP_AE 0x162304
  1489. #define _CNL_PORT_PCS_DW1_GRP_B 0x162384
  1490. #define _CNL_PORT_PCS_DW1_GRP_C 0x162B04
  1491. #define _CNL_PORT_PCS_DW1_GRP_D 0x162B84
  1492. #define _CNL_PORT_PCS_DW1_GRP_F 0x162A04
  1493. #define _CNL_PORT_PCS_DW1_LN0_AE 0x162404
  1494. #define _CNL_PORT_PCS_DW1_LN0_B 0x162604
  1495. #define _CNL_PORT_PCS_DW1_LN0_C 0x162C04
  1496. #define _CNL_PORT_PCS_DW1_LN0_D 0x162E04
  1497. #define _CNL_PORT_PCS_DW1_LN0_F 0x162804
  1498. #define CNL_PORT_PCS_DW1_GRP(port) _MMIO(_PICK(port, \
  1499. _CNL_PORT_PCS_DW1_GRP_AE, \
  1500. _CNL_PORT_PCS_DW1_GRP_B, \
  1501. _CNL_PORT_PCS_DW1_GRP_C, \
  1502. _CNL_PORT_PCS_DW1_GRP_D, \
  1503. _CNL_PORT_PCS_DW1_GRP_AE, \
  1504. _CNL_PORT_PCS_DW1_GRP_F))
  1505. #define CNL_PORT_PCS_DW1_LN0(port) _MMIO(_PICK(port, \
  1506. _CNL_PORT_PCS_DW1_LN0_AE, \
  1507. _CNL_PORT_PCS_DW1_LN0_B, \
  1508. _CNL_PORT_PCS_DW1_LN0_C, \
  1509. _CNL_PORT_PCS_DW1_LN0_D, \
  1510. _CNL_PORT_PCS_DW1_LN0_AE, \
  1511. _CNL_PORT_PCS_DW1_LN0_F))
  1512. #define _ICL_PORT_PCS_DW1_GRP_A 0x162604
  1513. #define _ICL_PORT_PCS_DW1_GRP_B 0x6C604
  1514. #define _ICL_PORT_PCS_DW1_LN0_A 0x162804
  1515. #define _ICL_PORT_PCS_DW1_LN0_B 0x6C804
  1516. #define ICL_PORT_PCS_DW1_GRP(port) _MMIO_PORT(port,\
  1517. _ICL_PORT_PCS_DW1_GRP_A, \
  1518. _ICL_PORT_PCS_DW1_GRP_B)
  1519. #define ICL_PORT_PCS_DW1_LN0(port) _MMIO_PORT(port, \
  1520. _ICL_PORT_PCS_DW1_LN0_A, \
  1521. _ICL_PORT_PCS_DW1_LN0_B)
  1522. #define COMMON_KEEPER_EN (1 << 26)
  1523. /* CNL Port TX registers */
  1524. #define _CNL_PORT_TX_AE_GRP_OFFSET 0x162340
  1525. #define _CNL_PORT_TX_B_GRP_OFFSET 0x1623C0
  1526. #define _CNL_PORT_TX_C_GRP_OFFSET 0x162B40
  1527. #define _CNL_PORT_TX_D_GRP_OFFSET 0x162BC0
  1528. #define _CNL_PORT_TX_F_GRP_OFFSET 0x162A40
  1529. #define _CNL_PORT_TX_AE_LN0_OFFSET 0x162440
  1530. #define _CNL_PORT_TX_B_LN0_OFFSET 0x162640
  1531. #define _CNL_PORT_TX_C_LN0_OFFSET 0x162C40
  1532. #define _CNL_PORT_TX_D_LN0_OFFSET 0x162E40
  1533. #define _CNL_PORT_TX_F_LN0_OFFSET 0x162840
  1534. #define _CNL_PORT_TX_DW_GRP(port, dw) (_PICK((port), \
  1535. _CNL_PORT_TX_AE_GRP_OFFSET, \
  1536. _CNL_PORT_TX_B_GRP_OFFSET, \
  1537. _CNL_PORT_TX_B_GRP_OFFSET, \
  1538. _CNL_PORT_TX_D_GRP_OFFSET, \
  1539. _CNL_PORT_TX_AE_GRP_OFFSET, \
  1540. _CNL_PORT_TX_F_GRP_OFFSET) + \
  1541. 4*(dw))
  1542. #define _CNL_PORT_TX_DW_LN0(port, dw) (_PICK((port), \
  1543. _CNL_PORT_TX_AE_LN0_OFFSET, \
  1544. _CNL_PORT_TX_B_LN0_OFFSET, \
  1545. _CNL_PORT_TX_B_LN0_OFFSET, \
  1546. _CNL_PORT_TX_D_LN0_OFFSET, \
  1547. _CNL_PORT_TX_AE_LN0_OFFSET, \
  1548. _CNL_PORT_TX_F_LN0_OFFSET) + \
  1549. 4*(dw))
  1550. #define CNL_PORT_TX_DW2_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 2))
  1551. #define CNL_PORT_TX_DW2_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 2))
  1552. #define _ICL_PORT_TX_DW2_GRP_A 0x162688
  1553. #define _ICL_PORT_TX_DW2_GRP_B 0x6C688
  1554. #define _ICL_PORT_TX_DW2_LN0_A 0x162888
  1555. #define _ICL_PORT_TX_DW2_LN0_B 0x6C888
  1556. #define ICL_PORT_TX_DW2_GRP(port) _MMIO_PORT(port, \
  1557. _ICL_PORT_TX_DW2_GRP_A, \
  1558. _ICL_PORT_TX_DW2_GRP_B)
  1559. #define ICL_PORT_TX_DW2_LN0(port) _MMIO_PORT(port, \
  1560. _ICL_PORT_TX_DW2_LN0_A, \
  1561. _ICL_PORT_TX_DW2_LN0_B)
  1562. #define SWING_SEL_UPPER(x) (((x) >> 3) << 15)
  1563. #define SWING_SEL_UPPER_MASK (1 << 15)
  1564. #define SWING_SEL_LOWER(x) (((x) & 0x7) << 11)
  1565. #define SWING_SEL_LOWER_MASK (0x7 << 11)
  1566. #define RCOMP_SCALAR(x) ((x) << 0)
  1567. #define RCOMP_SCALAR_MASK (0xFF << 0)
  1568. #define _CNL_PORT_TX_DW4_LN0_AE 0x162450
  1569. #define _CNL_PORT_TX_DW4_LN1_AE 0x1624D0
  1570. #define CNL_PORT_TX_DW4_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 4))
  1571. #define CNL_PORT_TX_DW4_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4))
  1572. #define CNL_PORT_TX_DW4_LN(port, ln) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4) + \
  1573. (ln * (_CNL_PORT_TX_DW4_LN1_AE - \
  1574. _CNL_PORT_TX_DW4_LN0_AE)))
  1575. #define _ICL_PORT_TX_DW4_GRP_A 0x162690
  1576. #define _ICL_PORT_TX_DW4_GRP_B 0x6C690
  1577. #define _ICL_PORT_TX_DW4_LN0_A 0x162890
  1578. #define _ICL_PORT_TX_DW4_LN1_A 0x162990
  1579. #define _ICL_PORT_TX_DW4_LN0_B 0x6C890
  1580. #define ICL_PORT_TX_DW4_GRP(port) _MMIO_PORT(port, \
  1581. _ICL_PORT_TX_DW4_GRP_A, \
  1582. _ICL_PORT_TX_DW4_GRP_B)
  1583. #define ICL_PORT_TX_DW4_LN(port, ln) _MMIO(_PORT(port, \
  1584. _ICL_PORT_TX_DW4_LN0_A, \
  1585. _ICL_PORT_TX_DW4_LN0_B) + \
  1586. (ln * (_ICL_PORT_TX_DW4_LN1_A - \
  1587. _ICL_PORT_TX_DW4_LN0_A)))
  1588. #define LOADGEN_SELECT (1 << 31)
  1589. #define POST_CURSOR_1(x) ((x) << 12)
  1590. #define POST_CURSOR_1_MASK (0x3F << 12)
  1591. #define POST_CURSOR_2(x) ((x) << 6)
  1592. #define POST_CURSOR_2_MASK (0x3F << 6)
  1593. #define CURSOR_COEFF(x) ((x) << 0)
  1594. #define CURSOR_COEFF_MASK (0x3F << 0)
  1595. #define CNL_PORT_TX_DW5_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 5))
  1596. #define CNL_PORT_TX_DW5_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 5))
  1597. #define _ICL_PORT_TX_DW5_GRP_A 0x162694
  1598. #define _ICL_PORT_TX_DW5_GRP_B 0x6C694
  1599. #define _ICL_PORT_TX_DW5_LN0_A 0x162894
  1600. #define _ICL_PORT_TX_DW5_LN0_B 0x6C894
  1601. #define ICL_PORT_TX_DW5_GRP(port) _MMIO_PORT(port, \
  1602. _ICL_PORT_TX_DW5_GRP_A, \
  1603. _ICL_PORT_TX_DW5_GRP_B)
  1604. #define ICL_PORT_TX_DW5_LN0(port) _MMIO_PORT(port, \
  1605. _ICL_PORT_TX_DW5_LN0_A, \
  1606. _ICL_PORT_TX_DW5_LN0_B)
  1607. #define TX_TRAINING_EN (1 << 31)
  1608. #define TAP2_DISABLE (1 << 30)
  1609. #define TAP3_DISABLE (1 << 29)
  1610. #define SCALING_MODE_SEL(x) ((x) << 18)
  1611. #define SCALING_MODE_SEL_MASK (0x7 << 18)
  1612. #define RTERM_SELECT(x) ((x) << 3)
  1613. #define RTERM_SELECT_MASK (0x7 << 3)
  1614. #define CNL_PORT_TX_DW7_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 7))
  1615. #define CNL_PORT_TX_DW7_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 7))
  1616. #define N_SCALAR(x) ((x) << 24)
  1617. #define N_SCALAR_MASK (0x7F << 24)
  1618. #define _ICL_MG_PHY_PORT_LN(port, ln, ln0p1, ln0p2, ln1p1) \
  1619. _MMIO(_PORT((port) - PORT_C, ln0p1, ln0p2) + (ln) * ((ln1p1) - (ln0p1)))
  1620. #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT1 0x16812C
  1621. #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT1 0x16852C
  1622. #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT2 0x16912C
  1623. #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT2 0x16952C
  1624. #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT3 0x16A12C
  1625. #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT3 0x16A52C
  1626. #define _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT4 0x16B12C
  1627. #define _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT4 0x16B52C
  1628. #define ICL_PORT_MG_TX1_LINK_PARAMS(port, ln) \
  1629. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT1, \
  1630. _ICL_MG_TX_LINK_PARAMS_TX1LN0_PORT2, \
  1631. _ICL_MG_TX_LINK_PARAMS_TX1LN1_PORT1)
  1632. #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT1 0x1680AC
  1633. #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT1 0x1684AC
  1634. #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT2 0x1690AC
  1635. #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT2 0x1694AC
  1636. #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT3 0x16A0AC
  1637. #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT3 0x16A4AC
  1638. #define _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT4 0x16B0AC
  1639. #define _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT4 0x16B4AC
  1640. #define ICL_PORT_MG_TX2_LINK_PARAMS(port, ln) \
  1641. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT1, \
  1642. _ICL_MG_TX_LINK_PARAMS_TX2LN0_PORT2, \
  1643. _ICL_MG_TX_LINK_PARAMS_TX2LN1_PORT1)
  1644. #define CRI_USE_FS32 (1 << 5)
  1645. #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT1 0x16814C
  1646. #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT1 0x16854C
  1647. #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT2 0x16914C
  1648. #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT2 0x16954C
  1649. #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT3 0x16A14C
  1650. #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT3 0x16A54C
  1651. #define _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT4 0x16B14C
  1652. #define _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT4 0x16B54C
  1653. #define ICL_PORT_MG_TX1_PISO_READLOAD(port, ln) \
  1654. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT1, \
  1655. _ICL_MG_TX_PISO_READLOAD_TX1LN0_PORT2, \
  1656. _ICL_MG_TX_PISO_READLOAD_TX1LN1_PORT1)
  1657. #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT1 0x1680CC
  1658. #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT1 0x1684CC
  1659. #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT2 0x1690CC
  1660. #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT2 0x1694CC
  1661. #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT3 0x16A0CC
  1662. #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT3 0x16A4CC
  1663. #define _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT4 0x16B0CC
  1664. #define _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT4 0x16B4CC
  1665. #define ICL_PORT_MG_TX2_PISO_READLOAD(port, ln) \
  1666. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT1, \
  1667. _ICL_MG_TX_PISO_READLOAD_TX2LN0_PORT2, \
  1668. _ICL_MG_TX_PISO_READLOAD_TX2LN1_PORT1)
  1669. #define CRI_CALCINIT (1 << 1)
  1670. #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT1 0x168148
  1671. #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT1 0x168548
  1672. #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT2 0x169148
  1673. #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT2 0x169548
  1674. #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT3 0x16A148
  1675. #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT3 0x16A548
  1676. #define _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT4 0x16B148
  1677. #define _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT4 0x16B548
  1678. #define ICL_PORT_MG_TX1_SWINGCTRL(port, ln) \
  1679. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT1, \
  1680. _ICL_MG_TX_SWINGCTRL_TX1LN0_PORT2, \
  1681. _ICL_MG_TX_SWINGCTRL_TX1LN1_PORT1)
  1682. #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT1 0x1680C8
  1683. #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT1 0x1684C8
  1684. #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT2 0x1690C8
  1685. #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT2 0x1694C8
  1686. #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT3 0x16A0C8
  1687. #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT3 0x16A4C8
  1688. #define _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT4 0x16B0C8
  1689. #define _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT4 0x16B4C8
  1690. #define ICL_PORT_MG_TX2_SWINGCTRL(port, ln) \
  1691. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT1, \
  1692. _ICL_MG_TX_SWINGCTRL_TX2LN0_PORT2, \
  1693. _ICL_MG_TX_SWINGCTRL_TX2LN1_PORT1)
  1694. #define CRI_TXDEEMPH_OVERRIDE_17_12(x) ((x) << 0)
  1695. #define CRI_TXDEEMPH_OVERRIDE_17_12_MASK (0x3F << 0)
  1696. #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT1 0x168144
  1697. #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT1 0x168544
  1698. #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT2 0x169144
  1699. #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT2 0x169544
  1700. #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT3 0x16A144
  1701. #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT3 0x16A544
  1702. #define _ICL_MG_TX_DRVCTRL_TX1LN0_PORT4 0x16B144
  1703. #define _ICL_MG_TX_DRVCTRL_TX1LN1_PORT4 0x16B544
  1704. #define ICL_PORT_MG_TX1_DRVCTRL(port, ln) \
  1705. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_DRVCTRL_TX1LN0_PORT1, \
  1706. _ICL_MG_TX_DRVCTRL_TX1LN0_PORT2, \
  1707. _ICL_MG_TX_DRVCTRL_TX1LN1_PORT1)
  1708. #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT1 0x1680C4
  1709. #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT1 0x1684C4
  1710. #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT2 0x1690C4
  1711. #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT2 0x1694C4
  1712. #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT3 0x16A0C4
  1713. #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT3 0x16A4C4
  1714. #define _ICL_MG_TX_DRVCTRL_TX2LN0_PORT4 0x16B0C4
  1715. #define _ICL_MG_TX_DRVCTRL_TX2LN1_PORT4 0x16B4C4
  1716. #define ICL_PORT_MG_TX2_DRVCTRL(port, ln) \
  1717. _ICL_MG_PHY_PORT_LN(port, ln, _ICL_MG_TX_DRVCTRL_TX2LN0_PORT1, \
  1718. _ICL_MG_TX_DRVCTRL_TX2LN0_PORT2, \
  1719. _ICL_MG_TX_DRVCTRL_TX2LN1_PORT1)
  1720. #define CRI_TXDEEMPH_OVERRIDE_11_6(x) ((x) << 24)
  1721. #define CRI_TXDEEMPH_OVERRIDE_11_6_MASK (0x3F << 24)
  1722. #define CRI_TXDEEMPH_OVERRIDE_EN (1 << 22)
  1723. #define CRI_TXDEEMPH_OVERRIDE_5_0(x) ((x) << 16)
  1724. #define CRI_TXDEEMPH_OVERRIDE_5_0_MASK (0x3F << 16)
  1725. /* The spec defines this only for BXT PHY0, but lets assume that this
  1726. * would exist for PHY1 too if it had a second channel.
  1727. */
  1728. #define _PORT_CL2CM_DW6_A 0x162358
  1729. #define _PORT_CL2CM_DW6_BC 0x6C358
  1730. #define BXT_PORT_CL2CM_DW6(phy) _BXT_PHY((phy), _PORT_CL2CM_DW6_BC)
  1731. #define DW6_OLDO_DYN_PWR_DOWN_EN (1 << 28)
  1732. #define CNL_PORT_COMP_DW0 _MMIO(0x162100)
  1733. #define COMP_INIT (1 << 31)
  1734. #define CNL_PORT_COMP_DW1 _MMIO(0x162104)
  1735. #define CNL_PORT_COMP_DW3 _MMIO(0x16210c)
  1736. #define PROCESS_INFO_DOT_0 (0 << 26)
  1737. #define PROCESS_INFO_DOT_1 (1 << 26)
  1738. #define PROCESS_INFO_DOT_4 (2 << 26)
  1739. #define PROCESS_INFO_MASK (7 << 26)
  1740. #define PROCESS_INFO_SHIFT 26
  1741. #define VOLTAGE_INFO_0_85V (0 << 24)
  1742. #define VOLTAGE_INFO_0_95V (1 << 24)
  1743. #define VOLTAGE_INFO_1_05V (2 << 24)
  1744. #define VOLTAGE_INFO_MASK (3 << 24)
  1745. #define VOLTAGE_INFO_SHIFT 24
  1746. #define CNL_PORT_COMP_DW9 _MMIO(0x162124)
  1747. #define CNL_PORT_COMP_DW10 _MMIO(0x162128)
  1748. #define _ICL_PORT_COMP_DW0_A 0x162100
  1749. #define _ICL_PORT_COMP_DW0_B 0x6C100
  1750. #define ICL_PORT_COMP_DW0(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW0_A, \
  1751. _ICL_PORT_COMP_DW0_B)
  1752. #define _ICL_PORT_COMP_DW1_A 0x162104
  1753. #define _ICL_PORT_COMP_DW1_B 0x6C104
  1754. #define ICL_PORT_COMP_DW1(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW1_A, \
  1755. _ICL_PORT_COMP_DW1_B)
  1756. #define _ICL_PORT_COMP_DW3_A 0x16210C
  1757. #define _ICL_PORT_COMP_DW3_B 0x6C10C
  1758. #define ICL_PORT_COMP_DW3(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW3_A, \
  1759. _ICL_PORT_COMP_DW3_B)
  1760. #define _ICL_PORT_COMP_DW9_A 0x162124
  1761. #define _ICL_PORT_COMP_DW9_B 0x6C124
  1762. #define ICL_PORT_COMP_DW9(port) _MMIO_PORT(port, _ICL_PORT_COMP_DW9_A, \
  1763. _ICL_PORT_COMP_DW9_B)
  1764. #define _ICL_PORT_COMP_DW10_A 0x162128
  1765. #define _ICL_PORT_COMP_DW10_B 0x6C128
  1766. #define ICL_PORT_COMP_DW10(port) _MMIO_PORT(port, \
  1767. _ICL_PORT_COMP_DW10_A, \
  1768. _ICL_PORT_COMP_DW10_B)
  1769. /* BXT PHY Ref registers */
  1770. #define _PORT_REF_DW3_A 0x16218C
  1771. #define _PORT_REF_DW3_BC 0x6C18C
  1772. #define GRC_DONE (1 << 22)
  1773. #define BXT_PORT_REF_DW3(phy) _BXT_PHY((phy), _PORT_REF_DW3_BC)
  1774. #define _PORT_REF_DW6_A 0x162198
  1775. #define _PORT_REF_DW6_BC 0x6C198
  1776. #define GRC_CODE_SHIFT 24
  1777. #define GRC_CODE_MASK (0xFF << GRC_CODE_SHIFT)
  1778. #define GRC_CODE_FAST_SHIFT 16
  1779. #define GRC_CODE_FAST_MASK (0xFF << GRC_CODE_FAST_SHIFT)
  1780. #define GRC_CODE_SLOW_SHIFT 8
  1781. #define GRC_CODE_SLOW_MASK (0xFF << GRC_CODE_SLOW_SHIFT)
  1782. #define GRC_CODE_NOM_MASK 0xFF
  1783. #define BXT_PORT_REF_DW6(phy) _BXT_PHY((phy), _PORT_REF_DW6_BC)
  1784. #define _PORT_REF_DW8_A 0x1621A0
  1785. #define _PORT_REF_DW8_BC 0x6C1A0
  1786. #define GRC_DIS (1 << 15)
  1787. #define GRC_RDY_OVRD (1 << 1)
  1788. #define BXT_PORT_REF_DW8(phy) _BXT_PHY((phy), _PORT_REF_DW8_BC)
  1789. /* BXT PHY PCS registers */
  1790. #define _PORT_PCS_DW10_LN01_A 0x162428
  1791. #define _PORT_PCS_DW10_LN01_B 0x6C428
  1792. #define _PORT_PCS_DW10_LN01_C 0x6C828
  1793. #define _PORT_PCS_DW10_GRP_A 0x162C28
  1794. #define _PORT_PCS_DW10_GRP_B 0x6CC28
  1795. #define _PORT_PCS_DW10_GRP_C 0x6CE28
  1796. #define BXT_PORT_PCS_DW10_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1797. _PORT_PCS_DW10_LN01_B, \
  1798. _PORT_PCS_DW10_LN01_C)
  1799. #define BXT_PORT_PCS_DW10_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1800. _PORT_PCS_DW10_GRP_B, \
  1801. _PORT_PCS_DW10_GRP_C)
  1802. #define TX2_SWING_CALC_INIT (1 << 31)
  1803. #define TX1_SWING_CALC_INIT (1 << 30)
  1804. #define _PORT_PCS_DW12_LN01_A 0x162430
  1805. #define _PORT_PCS_DW12_LN01_B 0x6C430
  1806. #define _PORT_PCS_DW12_LN01_C 0x6C830
  1807. #define _PORT_PCS_DW12_LN23_A 0x162630
  1808. #define _PORT_PCS_DW12_LN23_B 0x6C630
  1809. #define _PORT_PCS_DW12_LN23_C 0x6CA30
  1810. #define _PORT_PCS_DW12_GRP_A 0x162c30
  1811. #define _PORT_PCS_DW12_GRP_B 0x6CC30
  1812. #define _PORT_PCS_DW12_GRP_C 0x6CE30
  1813. #define LANESTAGGER_STRAP_OVRD (1 << 6)
  1814. #define LANE_STAGGER_MASK 0x1F
  1815. #define BXT_PORT_PCS_DW12_LN01(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1816. _PORT_PCS_DW12_LN01_B, \
  1817. _PORT_PCS_DW12_LN01_C)
  1818. #define BXT_PORT_PCS_DW12_LN23(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1819. _PORT_PCS_DW12_LN23_B, \
  1820. _PORT_PCS_DW12_LN23_C)
  1821. #define BXT_PORT_PCS_DW12_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1822. _PORT_PCS_DW12_GRP_B, \
  1823. _PORT_PCS_DW12_GRP_C)
  1824. /* BXT PHY TX registers */
  1825. #define _BXT_LANE_OFFSET(lane) (((lane) >> 1) * 0x200 + \
  1826. ((lane) & 1) * 0x80)
  1827. #define _PORT_TX_DW2_LN0_A 0x162508
  1828. #define _PORT_TX_DW2_LN0_B 0x6C508
  1829. #define _PORT_TX_DW2_LN0_C 0x6C908
  1830. #define _PORT_TX_DW2_GRP_A 0x162D08
  1831. #define _PORT_TX_DW2_GRP_B 0x6CD08
  1832. #define _PORT_TX_DW2_GRP_C 0x6CF08
  1833. #define BXT_PORT_TX_DW2_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1834. _PORT_TX_DW2_LN0_B, \
  1835. _PORT_TX_DW2_LN0_C)
  1836. #define BXT_PORT_TX_DW2_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1837. _PORT_TX_DW2_GRP_B, \
  1838. _PORT_TX_DW2_GRP_C)
  1839. #define MARGIN_000_SHIFT 16
  1840. #define MARGIN_000 (0xFF << MARGIN_000_SHIFT)
  1841. #define UNIQ_TRANS_SCALE_SHIFT 8
  1842. #define UNIQ_TRANS_SCALE (0xFF << UNIQ_TRANS_SCALE_SHIFT)
  1843. #define _PORT_TX_DW3_LN0_A 0x16250C
  1844. #define _PORT_TX_DW3_LN0_B 0x6C50C
  1845. #define _PORT_TX_DW3_LN0_C 0x6C90C
  1846. #define _PORT_TX_DW3_GRP_A 0x162D0C
  1847. #define _PORT_TX_DW3_GRP_B 0x6CD0C
  1848. #define _PORT_TX_DW3_GRP_C 0x6CF0C
  1849. #define BXT_PORT_TX_DW3_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1850. _PORT_TX_DW3_LN0_B, \
  1851. _PORT_TX_DW3_LN0_C)
  1852. #define BXT_PORT_TX_DW3_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1853. _PORT_TX_DW3_GRP_B, \
  1854. _PORT_TX_DW3_GRP_C)
  1855. #define SCALE_DCOMP_METHOD (1 << 26)
  1856. #define UNIQUE_TRANGE_EN_METHOD (1 << 27)
  1857. #define _PORT_TX_DW4_LN0_A 0x162510
  1858. #define _PORT_TX_DW4_LN0_B 0x6C510
  1859. #define _PORT_TX_DW4_LN0_C 0x6C910
  1860. #define _PORT_TX_DW4_GRP_A 0x162D10
  1861. #define _PORT_TX_DW4_GRP_B 0x6CD10
  1862. #define _PORT_TX_DW4_GRP_C 0x6CF10
  1863. #define BXT_PORT_TX_DW4_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1864. _PORT_TX_DW4_LN0_B, \
  1865. _PORT_TX_DW4_LN0_C)
  1866. #define BXT_PORT_TX_DW4_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1867. _PORT_TX_DW4_GRP_B, \
  1868. _PORT_TX_DW4_GRP_C)
  1869. #define DEEMPH_SHIFT 24
  1870. #define DE_EMPHASIS (0xFF << DEEMPH_SHIFT)
  1871. #define _PORT_TX_DW5_LN0_A 0x162514
  1872. #define _PORT_TX_DW5_LN0_B 0x6C514
  1873. #define _PORT_TX_DW5_LN0_C 0x6C914
  1874. #define _PORT_TX_DW5_GRP_A 0x162D14
  1875. #define _PORT_TX_DW5_GRP_B 0x6CD14
  1876. #define _PORT_TX_DW5_GRP_C 0x6CF14
  1877. #define BXT_PORT_TX_DW5_LN0(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1878. _PORT_TX_DW5_LN0_B, \
  1879. _PORT_TX_DW5_LN0_C)
  1880. #define BXT_PORT_TX_DW5_GRP(phy, ch) _MMIO_BXT_PHY_CH(phy, ch, \
  1881. _PORT_TX_DW5_GRP_B, \
  1882. _PORT_TX_DW5_GRP_C)
  1883. #define DCC_DELAY_RANGE_1 (1 << 9)
  1884. #define DCC_DELAY_RANGE_2 (1 << 8)
  1885. #define _PORT_TX_DW14_LN0_A 0x162538
  1886. #define _PORT_TX_DW14_LN0_B 0x6C538
  1887. #define _PORT_TX_DW14_LN0_C 0x6C938
  1888. #define LATENCY_OPTIM_SHIFT 30
  1889. #define LATENCY_OPTIM (1 << LATENCY_OPTIM_SHIFT)
  1890. #define BXT_PORT_TX_DW14_LN(phy, ch, lane) \
  1891. _MMIO(_BXT_PHY_CH(phy, ch, _PORT_TX_DW14_LN0_B, \
  1892. _PORT_TX_DW14_LN0_C) + \
  1893. _BXT_LANE_OFFSET(lane))
  1894. /* UAIMI scratch pad register 1 */
  1895. #define UAIMI_SPR1 _MMIO(0x4F074)
  1896. /* SKL VccIO mask */
  1897. #define SKL_VCCIO_MASK 0x1
  1898. /* SKL balance leg register */
  1899. #define DISPIO_CR_TX_BMU_CR0 _MMIO(0x6C00C)
  1900. /* I_boost values */
  1901. #define BALANCE_LEG_SHIFT(port) (8+3*(port))
  1902. #define BALANCE_LEG_MASK(port) (7<<(8+3*(port)))
  1903. /* Balance leg disable bits */
  1904. #define BALANCE_LEG_DISABLE_SHIFT 23
  1905. #define BALANCE_LEG_DISABLE(port) (1 << (23 + (port)))
  1906. /*
  1907. * Fence registers
  1908. * [0-7] @ 0x2000 gen2,gen3
  1909. * [8-15] @ 0x3000 945,g33,pnv
  1910. *
  1911. * [0-15] @ 0x3000 gen4,gen5
  1912. *
  1913. * [0-15] @ 0x100000 gen6,vlv,chv
  1914. * [0-31] @ 0x100000 gen7+
  1915. */
  1916. #define FENCE_REG(i) _MMIO(0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4)
  1917. #define I830_FENCE_START_MASK 0x07f80000
  1918. #define I830_FENCE_TILING_Y_SHIFT 12
  1919. #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
  1920. #define I830_FENCE_PITCH_SHIFT 4
  1921. #define I830_FENCE_REG_VALID (1<<0)
  1922. #define I915_FENCE_MAX_PITCH_VAL 4
  1923. #define I830_FENCE_MAX_PITCH_VAL 6
  1924. #define I830_FENCE_MAX_SIZE_VAL (1<<8)
  1925. #define I915_FENCE_START_MASK 0x0ff00000
  1926. #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
  1927. #define FENCE_REG_965_LO(i) _MMIO(0x03000 + (i) * 8)
  1928. #define FENCE_REG_965_HI(i) _MMIO(0x03000 + (i) * 8 + 4)
  1929. #define I965_FENCE_PITCH_SHIFT 2
  1930. #define I965_FENCE_TILING_Y_SHIFT 1
  1931. #define I965_FENCE_REG_VALID (1<<0)
  1932. #define I965_FENCE_MAX_PITCH_VAL 0x0400
  1933. #define FENCE_REG_GEN6_LO(i) _MMIO(0x100000 + (i) * 8)
  1934. #define FENCE_REG_GEN6_HI(i) _MMIO(0x100000 + (i) * 8 + 4)
  1935. #define GEN6_FENCE_PITCH_SHIFT 32
  1936. #define GEN7_FENCE_MAX_PITCH_VAL 0x0800
  1937. /* control register for cpu gtt access */
  1938. #define TILECTL _MMIO(0x101000)
  1939. #define TILECTL_SWZCTL (1 << 0)
  1940. #define TILECTL_TLBPF (1 << 1)
  1941. #define TILECTL_TLB_PREFETCH_DIS (1 << 2)
  1942. #define TILECTL_BACKSNOOP_DIS (1 << 3)
  1943. /*
  1944. * Instruction and interrupt control regs
  1945. */
  1946. #define PGTBL_CTL _MMIO(0x02020)
  1947. #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */
  1948. #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */
  1949. #define PGTBL_ER _MMIO(0x02024)
  1950. #define PRB0_BASE (0x2030-0x30)
  1951. #define PRB1_BASE (0x2040-0x30) /* 830,gen3 */
  1952. #define PRB2_BASE (0x2050-0x30) /* gen3 */
  1953. #define SRB0_BASE (0x2100-0x30) /* gen2 */
  1954. #define SRB1_BASE (0x2110-0x30) /* gen2 */
  1955. #define SRB2_BASE (0x2120-0x30) /* 830 */
  1956. #define SRB3_BASE (0x2130-0x30) /* 830 */
  1957. #define RENDER_RING_BASE 0x02000
  1958. #define BSD_RING_BASE 0x04000
  1959. #define GEN6_BSD_RING_BASE 0x12000
  1960. #define GEN8_BSD2_RING_BASE 0x1c000
  1961. #define GEN11_BSD_RING_BASE 0x1c0000
  1962. #define GEN11_BSD2_RING_BASE 0x1c4000
  1963. #define GEN11_BSD3_RING_BASE 0x1d0000
  1964. #define GEN11_BSD4_RING_BASE 0x1d4000
  1965. #define VEBOX_RING_BASE 0x1a000
  1966. #define GEN11_VEBOX_RING_BASE 0x1c8000
  1967. #define GEN11_VEBOX2_RING_BASE 0x1d8000
  1968. #define BLT_RING_BASE 0x22000
  1969. #define RING_TAIL(base) _MMIO((base)+0x30)
  1970. #define RING_HEAD(base) _MMIO((base)+0x34)
  1971. #define RING_START(base) _MMIO((base)+0x38)
  1972. #define RING_CTL(base) _MMIO((base)+0x3c)
  1973. #define RING_CTL_SIZE(size) ((size) - PAGE_SIZE) /* in bytes -> pages */
  1974. #define RING_SYNC_0(base) _MMIO((base)+0x40)
  1975. #define RING_SYNC_1(base) _MMIO((base)+0x44)
  1976. #define RING_SYNC_2(base) _MMIO((base)+0x48)
  1977. #define GEN6_RVSYNC (RING_SYNC_0(RENDER_RING_BASE))
  1978. #define GEN6_RBSYNC (RING_SYNC_1(RENDER_RING_BASE))
  1979. #define GEN6_RVESYNC (RING_SYNC_2(RENDER_RING_BASE))
  1980. #define GEN6_VBSYNC (RING_SYNC_0(GEN6_BSD_RING_BASE))
  1981. #define GEN6_VRSYNC (RING_SYNC_1(GEN6_BSD_RING_BASE))
  1982. #define GEN6_VVESYNC (RING_SYNC_2(GEN6_BSD_RING_BASE))
  1983. #define GEN6_BRSYNC (RING_SYNC_0(BLT_RING_BASE))
  1984. #define GEN6_BVSYNC (RING_SYNC_1(BLT_RING_BASE))
  1985. #define GEN6_BVESYNC (RING_SYNC_2(BLT_RING_BASE))
  1986. #define GEN6_VEBSYNC (RING_SYNC_0(VEBOX_RING_BASE))
  1987. #define GEN6_VERSYNC (RING_SYNC_1(VEBOX_RING_BASE))
  1988. #define GEN6_VEVSYNC (RING_SYNC_2(VEBOX_RING_BASE))
  1989. #define GEN6_NOSYNC INVALID_MMIO_REG
  1990. #define RING_PSMI_CTL(base) _MMIO((base)+0x50)
  1991. #define RING_MAX_IDLE(base) _MMIO((base)+0x54)
  1992. #define RING_HWS_PGA(base) _MMIO((base)+0x80)
  1993. #define RING_HWS_PGA_GEN6(base) _MMIO((base)+0x2080)
  1994. #define RING_RESET_CTL(base) _MMIO((base)+0xd0)
  1995. #define RESET_CTL_REQUEST_RESET (1 << 0)
  1996. #define RESET_CTL_READY_TO_RESET (1 << 1)
  1997. #define HSW_GTT_CACHE_EN _MMIO(0x4024)
  1998. #define GTT_CACHE_EN_ALL 0xF0007FFF
  1999. #define GEN7_WR_WATERMARK _MMIO(0x4028)
  2000. #define GEN7_GFX_PRIO_CTRL _MMIO(0x402C)
  2001. #define ARB_MODE _MMIO(0x4030)
  2002. #define ARB_MODE_SWIZZLE_SNB (1<<4)
  2003. #define ARB_MODE_SWIZZLE_IVB (1<<5)
  2004. #define GEN7_GFX_PEND_TLB0 _MMIO(0x4034)
  2005. #define GEN7_GFX_PEND_TLB1 _MMIO(0x4038)
  2006. /* L3, CVS, ZTLB, RCC, CASC LRA min, max values */
  2007. #define GEN7_LRA_LIMITS(i) _MMIO(0x403C + (i) * 4)
  2008. #define GEN7_LRA_LIMITS_REG_NUM 13
  2009. #define GEN7_MEDIA_MAX_REQ_COUNT _MMIO(0x4070)
  2010. #define GEN7_GFX_MAX_REQ_COUNT _MMIO(0x4074)
  2011. #define GAMTARBMODE _MMIO(0x04a08)
  2012. #define ARB_MODE_BWGTLB_DISABLE (1<<9)
  2013. #define ARB_MODE_SWIZZLE_BDW (1<<1)
  2014. #define RENDER_HWS_PGA_GEN7 _MMIO(0x04080)
  2015. #define RING_FAULT_REG(engine) _MMIO(0x4094 + 0x100*(engine)->hw_id)
  2016. #define GEN8_RING_FAULT_REG _MMIO(0x4094)
  2017. #define GEN8_RING_FAULT_ENGINE_ID(x) (((x) >> 12) & 0x7)
  2018. #define RING_FAULT_GTTSEL_MASK (1<<11)
  2019. #define RING_FAULT_SRCID(x) (((x) >> 3) & 0xff)
  2020. #define RING_FAULT_FAULT_TYPE(x) (((x) >> 1) & 0x3)
  2021. #define RING_FAULT_VALID (1<<0)
  2022. #define DONE_REG _MMIO(0x40b0)
  2023. #define GEN8_PRIVATE_PAT_LO _MMIO(0x40e0)
  2024. #define GEN8_PRIVATE_PAT_HI _MMIO(0x40e0 + 4)
  2025. #define GEN10_PAT_INDEX(index) _MMIO(0x40e0 + (index)*4)
  2026. #define BSD_HWS_PGA_GEN7 _MMIO(0x04180)
  2027. #define BLT_HWS_PGA_GEN7 _MMIO(0x04280)
  2028. #define VEBOX_HWS_PGA_GEN7 _MMIO(0x04380)
  2029. #define RING_ACTHD(base) _MMIO((base)+0x74)
  2030. #define RING_ACTHD_UDW(base) _MMIO((base)+0x5c)
  2031. #define RING_NOPID(base) _MMIO((base)+0x94)
  2032. #define RING_IMR(base) _MMIO((base)+0xa8)
  2033. #define RING_HWSTAM(base) _MMIO((base)+0x98)
  2034. #define RING_TIMESTAMP(base) _MMIO((base)+0x358)
  2035. #define RING_TIMESTAMP_UDW(base) _MMIO((base)+0x358 + 4)
  2036. #define TAIL_ADDR 0x001FFFF8
  2037. #define HEAD_WRAP_COUNT 0xFFE00000
  2038. #define HEAD_WRAP_ONE 0x00200000
  2039. #define HEAD_ADDR 0x001FFFFC
  2040. #define RING_NR_PAGES 0x001FF000
  2041. #define RING_REPORT_MASK 0x00000006
  2042. #define RING_REPORT_64K 0x00000002
  2043. #define RING_REPORT_128K 0x00000004
  2044. #define RING_NO_REPORT 0x00000000
  2045. #define RING_VALID_MASK 0x00000001
  2046. #define RING_VALID 0x00000001
  2047. #define RING_INVALID 0x00000000
  2048. #define RING_WAIT_I8XX (1<<0) /* gen2, PRBx_HEAD */
  2049. #define RING_WAIT (1<<11) /* gen3+, PRBx_CTL */
  2050. #define RING_WAIT_SEMAPHORE (1<<10) /* gen6+ */
  2051. #define RING_FORCE_TO_NONPRIV(base, i) _MMIO(((base)+0x4D0) + (i)*4)
  2052. #define RING_MAX_NONPRIV_SLOTS 12
  2053. #define GEN7_TLB_RD_ADDR _MMIO(0x4700)
  2054. #define GEN9_GAMT_ECO_REG_RW_IA _MMIO(0x4ab0)
  2055. #define GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS (1<<18)
  2056. #define GEN8_GAMW_ECO_DEV_RW_IA _MMIO(0x4080)
  2057. #define GAMW_ECO_ENABLE_64K_IPS_FIELD 0xF
  2058. #define GAMT_CHKN_BIT_REG _MMIO(0x4ab8)
  2059. #define GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING (1<<28)
  2060. #define GAMT_CHKN_DISABLE_I2M_CYCLE_ON_WR_PORT (1<<24)
  2061. #if 0
  2062. #define PRB0_TAIL _MMIO(0x2030)
  2063. #define PRB0_HEAD _MMIO(0x2034)
  2064. #define PRB0_START _MMIO(0x2038)
  2065. #define PRB0_CTL _MMIO(0x203c)
  2066. #define PRB1_TAIL _MMIO(0x2040) /* 915+ only */
  2067. #define PRB1_HEAD _MMIO(0x2044) /* 915+ only */
  2068. #define PRB1_START _MMIO(0x2048) /* 915+ only */
  2069. #define PRB1_CTL _MMIO(0x204c) /* 915+ only */
  2070. #endif
  2071. #define IPEIR_I965 _MMIO(0x2064)
  2072. #define IPEHR_I965 _MMIO(0x2068)
  2073. #define GEN7_SC_INSTDONE _MMIO(0x7100)
  2074. #define GEN7_SAMPLER_INSTDONE _MMIO(0xe160)
  2075. #define GEN7_ROW_INSTDONE _MMIO(0xe164)
  2076. #define GEN8_MCR_SELECTOR _MMIO(0xfdc)
  2077. #define GEN8_MCR_SLICE(slice) (((slice) & 3) << 26)
  2078. #define GEN8_MCR_SLICE_MASK GEN8_MCR_SLICE(3)
  2079. #define GEN8_MCR_SUBSLICE(subslice) (((subslice) & 3) << 24)
  2080. #define GEN8_MCR_SUBSLICE_MASK GEN8_MCR_SUBSLICE(3)
  2081. #define GEN11_MCR_SLICE(slice) (((slice) & 0xf) << 27)
  2082. #define GEN11_MCR_SLICE_MASK GEN11_MCR_SLICE(0xf)
  2083. #define GEN11_MCR_SUBSLICE(subslice) (((subslice) & 0x7) << 24)
  2084. #define GEN11_MCR_SUBSLICE_MASK GEN11_MCR_SUBSLICE(0x7)
  2085. #define RING_IPEIR(base) _MMIO((base)+0x64)
  2086. #define RING_IPEHR(base) _MMIO((base)+0x68)
  2087. /*
  2088. * On GEN4, only the render ring INSTDONE exists and has a different
  2089. * layout than the GEN7+ version.
  2090. * The GEN2 counterpart of this register is GEN2_INSTDONE.
  2091. */
  2092. #define RING_INSTDONE(base) _MMIO((base)+0x6c)
  2093. #define RING_INSTPS(base) _MMIO((base)+0x70)
  2094. #define RING_DMA_FADD(base) _MMIO((base)+0x78)
  2095. #define RING_DMA_FADD_UDW(base) _MMIO((base)+0x60) /* gen8+ */
  2096. #define RING_INSTPM(base) _MMIO((base)+0xc0)
  2097. #define RING_MI_MODE(base) _MMIO((base)+0x9c)
  2098. #define INSTPS _MMIO(0x2070) /* 965+ only */
  2099. #define GEN4_INSTDONE1 _MMIO(0x207c) /* 965+ only, aka INSTDONE_2 on SNB */
  2100. #define ACTHD_I965 _MMIO(0x2074)
  2101. #define HWS_PGA _MMIO(0x2080)
  2102. #define HWS_ADDRESS_MASK 0xfffff000
  2103. #define HWS_START_ADDRESS_SHIFT 4
  2104. #define PWRCTXA _MMIO(0x2088) /* 965GM+ only */
  2105. #define PWRCTX_EN (1<<0)
  2106. #define IPEIR _MMIO(0x2088)
  2107. #define IPEHR _MMIO(0x208c)
  2108. #define GEN2_INSTDONE _MMIO(0x2090)
  2109. #define NOPID _MMIO(0x2094)
  2110. #define HWSTAM _MMIO(0x2098)
  2111. #define DMA_FADD_I8XX _MMIO(0x20d0)
  2112. #define RING_BBSTATE(base) _MMIO((base)+0x110)
  2113. #define RING_BB_PPGTT (1 << 5)
  2114. #define RING_SBBADDR(base) _MMIO((base)+0x114) /* hsw+ */
  2115. #define RING_SBBSTATE(base) _MMIO((base)+0x118) /* hsw+ */
  2116. #define RING_SBBADDR_UDW(base) _MMIO((base)+0x11c) /* gen8+ */
  2117. #define RING_BBADDR(base) _MMIO((base)+0x140)
  2118. #define RING_BBADDR_UDW(base) _MMIO((base)+0x168) /* gen8+ */
  2119. #define RING_BB_PER_CTX_PTR(base) _MMIO((base)+0x1c0) /* gen8+ */
  2120. #define RING_INDIRECT_CTX(base) _MMIO((base)+0x1c4) /* gen8+ */
  2121. #define RING_INDIRECT_CTX_OFFSET(base) _MMIO((base)+0x1c8) /* gen8+ */
  2122. #define RING_CTX_TIMESTAMP(base) _MMIO((base)+0x3a8) /* gen8+ */
  2123. #define ERROR_GEN6 _MMIO(0x40a0)
  2124. #define GEN7_ERR_INT _MMIO(0x44040)
  2125. #define ERR_INT_POISON (1<<31)
  2126. #define ERR_INT_MMIO_UNCLAIMED (1<<13)
  2127. #define ERR_INT_PIPE_CRC_DONE_C (1<<8)
  2128. #define ERR_INT_FIFO_UNDERRUN_C (1<<6)
  2129. #define ERR_INT_PIPE_CRC_DONE_B (1<<5)
  2130. #define ERR_INT_FIFO_UNDERRUN_B (1<<3)
  2131. #define ERR_INT_PIPE_CRC_DONE_A (1<<2)
  2132. #define ERR_INT_PIPE_CRC_DONE(pipe) (1<<(2 + (pipe)*3))
  2133. #define ERR_INT_FIFO_UNDERRUN_A (1<<0)
  2134. #define ERR_INT_FIFO_UNDERRUN(pipe) (1<<((pipe)*3))
  2135. #define GEN8_FAULT_TLB_DATA0 _MMIO(0x4b10)
  2136. #define GEN8_FAULT_TLB_DATA1 _MMIO(0x4b14)
  2137. #define FAULT_VA_HIGH_BITS (0xf << 0)
  2138. #define FAULT_GTT_SEL (1 << 4)
  2139. #define FPGA_DBG _MMIO(0x42300)
  2140. #define FPGA_DBG_RM_NOCLAIM (1<<31)
  2141. #define CLAIM_ER _MMIO(VLV_DISPLAY_BASE + 0x2028)
  2142. #define CLAIM_ER_CLR (1 << 31)
  2143. #define CLAIM_ER_OVERFLOW (1 << 16)
  2144. #define CLAIM_ER_CTR_MASK 0xffff
  2145. #define DERRMR _MMIO(0x44050)
  2146. /* Note that HBLANK events are reserved on bdw+ */
  2147. #define DERRMR_PIPEA_SCANLINE (1<<0)
  2148. #define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1)
  2149. #define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2)
  2150. #define DERRMR_PIPEA_VBLANK (1<<3)
  2151. #define DERRMR_PIPEA_HBLANK (1<<5)
  2152. #define DERRMR_PIPEB_SCANLINE (1<<8)
  2153. #define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9)
  2154. #define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10)
  2155. #define DERRMR_PIPEB_VBLANK (1<<11)
  2156. #define DERRMR_PIPEB_HBLANK (1<<13)
  2157. /* Note that PIPEC is not a simple translation of PIPEA/PIPEB */
  2158. #define DERRMR_PIPEC_SCANLINE (1<<14)
  2159. #define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15)
  2160. #define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20)
  2161. #define DERRMR_PIPEC_VBLANK (1<<21)
  2162. #define DERRMR_PIPEC_HBLANK (1<<22)
  2163. /* GM45+ chicken bits -- debug workaround bits that may be required
  2164. * for various sorts of correct behavior. The top 16 bits of each are
  2165. * the enables for writing to the corresponding low bit.
  2166. */
  2167. #define _3D_CHICKEN _MMIO(0x2084)
  2168. #define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
  2169. #define _3D_CHICKEN2 _MMIO(0x208c)
  2170. #define FF_SLICE_CHICKEN _MMIO(0x2088)
  2171. #define FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX (1 << 1)
  2172. /* Disables pipelining of read flushes past the SF-WIZ interface.
  2173. * Required on all Ironlake steppings according to the B-Spec, but the
  2174. * particular danger of not doing so is not specified.
  2175. */
  2176. # define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14)
  2177. #define _3D_CHICKEN3 _MMIO(0x2090)
  2178. #define _3D_CHICKEN_SF_PROVOKING_VERTEX_FIX (1 << 12)
  2179. #define _3D_CHICKEN_SF_DISABLE_OBJEND_CULL (1 << 10)
  2180. #define _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE (1 << 5)
  2181. #define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5)
  2182. #define _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x) ((x)<<1) /* gen8+ */
  2183. #define _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH (1 << 1) /* gen6 */
  2184. #define MI_MODE _MMIO(0x209c)
  2185. # define VS_TIMER_DISPATCH (1 << 6)
  2186. # define MI_FLUSH_ENABLE (1 << 12)
  2187. # define ASYNC_FLIP_PERF_DISABLE (1 << 14)
  2188. # define MODE_IDLE (1 << 9)
  2189. # define STOP_RING (1 << 8)
  2190. #define GEN6_GT_MODE _MMIO(0x20d0)
  2191. #define GEN7_GT_MODE _MMIO(0x7008)
  2192. #define GEN6_WIZ_HASHING(hi, lo) (((hi) << 9) | ((lo) << 7))
  2193. #define GEN6_WIZ_HASHING_8x8 GEN6_WIZ_HASHING(0, 0)
  2194. #define GEN6_WIZ_HASHING_8x4 GEN6_WIZ_HASHING(0, 1)
  2195. #define GEN6_WIZ_HASHING_16x4 GEN6_WIZ_HASHING(1, 0)
  2196. #define GEN6_WIZ_HASHING_MASK GEN6_WIZ_HASHING(1, 1)
  2197. #define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
  2198. #define GEN9_IZ_HASHING_MASK(slice) (0x3 << ((slice) * 2))
  2199. #define GEN9_IZ_HASHING(slice, val) ((val) << ((slice) * 2))
  2200. /* chicken reg for WaConextSwitchWithConcurrentTLBInvalidate */
  2201. #define GEN9_CSFE_CHICKEN1_RCS _MMIO(0x20D4)
  2202. #define GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE (1 << 2)
  2203. /* WaClearTdlStateAckDirtyBits */
  2204. #define GEN8_STATE_ACK _MMIO(0x20F0)
  2205. #define GEN9_STATE_ACK_SLICE1 _MMIO(0x20F8)
  2206. #define GEN9_STATE_ACK_SLICE2 _MMIO(0x2100)
  2207. #define GEN9_STATE_ACK_TDL0 (1 << 12)
  2208. #define GEN9_STATE_ACK_TDL1 (1 << 13)
  2209. #define GEN9_STATE_ACK_TDL2 (1 << 14)
  2210. #define GEN9_STATE_ACK_TDL3 (1 << 15)
  2211. #define GEN9_SUBSLICE_TDL_ACK_BITS \
  2212. (GEN9_STATE_ACK_TDL3 | GEN9_STATE_ACK_TDL2 | \
  2213. GEN9_STATE_ACK_TDL1 | GEN9_STATE_ACK_TDL0)
  2214. #define GFX_MODE _MMIO(0x2520)
  2215. #define GFX_MODE_GEN7 _MMIO(0x229c)
  2216. #define RING_MODE_GEN7(engine) _MMIO((engine)->mmio_base+0x29c)
  2217. #define GFX_RUN_LIST_ENABLE (1<<15)
  2218. #define GFX_INTERRUPT_STEERING (1<<14)
  2219. #define GFX_TLB_INVALIDATE_EXPLICIT (1<<13)
  2220. #define GFX_SURFACE_FAULT_ENABLE (1<<12)
  2221. #define GFX_REPLAY_MODE (1<<11)
  2222. #define GFX_PSMI_GRANULARITY (1<<10)
  2223. #define GFX_PPGTT_ENABLE (1<<9)
  2224. #define GEN8_GFX_PPGTT_48B (1<<7)
  2225. #define GFX_FORWARD_VBLANK_MASK (3<<5)
  2226. #define GFX_FORWARD_VBLANK_NEVER (0<<5)
  2227. #define GFX_FORWARD_VBLANK_ALWAYS (1<<5)
  2228. #define GFX_FORWARD_VBLANK_COND (2<<5)
  2229. #define GEN11_GFX_DISABLE_LEGACY_MODE (1<<3)
  2230. #define VLV_DISPLAY_BASE 0x180000
  2231. #define VLV_MIPI_BASE VLV_DISPLAY_BASE
  2232. #define BXT_MIPI_BASE 0x60000
  2233. #define VLV_GU_CTL0 _MMIO(VLV_DISPLAY_BASE + 0x2030)
  2234. #define VLV_GU_CTL1 _MMIO(VLV_DISPLAY_BASE + 0x2034)
  2235. #define SCPD0 _MMIO(0x209c) /* 915+ only */
  2236. #define IER _MMIO(0x20a0)
  2237. #define IIR _MMIO(0x20a4)
  2238. #define IMR _MMIO(0x20a8)
  2239. #define ISR _MMIO(0x20ac)
  2240. #define VLV_GUNIT_CLOCK_GATE _MMIO(VLV_DISPLAY_BASE + 0x2060)
  2241. #define GINT_DIS (1<<22)
  2242. #define GCFG_DIS (1<<8)
  2243. #define VLV_GUNIT_CLOCK_GATE2 _MMIO(VLV_DISPLAY_BASE + 0x2064)
  2244. #define VLV_IIR_RW _MMIO(VLV_DISPLAY_BASE + 0x2084)
  2245. #define VLV_IER _MMIO(VLV_DISPLAY_BASE + 0x20a0)
  2246. #define VLV_IIR _MMIO(VLV_DISPLAY_BASE + 0x20a4)
  2247. #define VLV_IMR _MMIO(VLV_DISPLAY_BASE + 0x20a8)
  2248. #define VLV_ISR _MMIO(VLV_DISPLAY_BASE + 0x20ac)
  2249. #define VLV_PCBR _MMIO(VLV_DISPLAY_BASE + 0x2120)
  2250. #define VLV_PCBR_ADDR_SHIFT 12
  2251. #define DISPLAY_PLANE_FLIP_PENDING(plane) (1<<(11-(plane))) /* A and B only */
  2252. #define EIR _MMIO(0x20b0)
  2253. #define EMR _MMIO(0x20b4)
  2254. #define ESR _MMIO(0x20b8)
  2255. #define GM45_ERROR_PAGE_TABLE (1<<5)
  2256. #define GM45_ERROR_MEM_PRIV (1<<4)
  2257. #define I915_ERROR_PAGE_TABLE (1<<4)
  2258. #define GM45_ERROR_CP_PRIV (1<<3)
  2259. #define I915_ERROR_MEMORY_REFRESH (1<<1)
  2260. #define I915_ERROR_INSTRUCTION (1<<0)
  2261. #define INSTPM _MMIO(0x20c0)
  2262. #define INSTPM_SELF_EN (1<<12) /* 915GM only */
  2263. #define INSTPM_AGPBUSY_INT_EN (1<<11) /* gen3: when disabled, pending interrupts
  2264. will not assert AGPBUSY# and will only
  2265. be delivered when out of C3. */
  2266. #define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */
  2267. #define INSTPM_TLB_INVALIDATE (1<<9)
  2268. #define INSTPM_SYNC_FLUSH (1<<5)
  2269. #define ACTHD _MMIO(0x20c8)
  2270. #define MEM_MODE _MMIO(0x20cc)
  2271. #define MEM_DISPLAY_B_TRICKLE_FEED_DISABLE (1<<3) /* 830 only */
  2272. #define MEM_DISPLAY_A_TRICKLE_FEED_DISABLE (1<<2) /* 830/845 only */
  2273. #define MEM_DISPLAY_TRICKLE_FEED_DISABLE (1<<2) /* 85x only */
  2274. #define FW_BLC _MMIO(0x20d8)
  2275. #define FW_BLC2 _MMIO(0x20dc)
  2276. #define FW_BLC_SELF _MMIO(0x20e0) /* 915+ only */
  2277. #define FW_BLC_SELF_EN_MASK (1<<31)
  2278. #define FW_BLC_SELF_FIFO_MASK (1<<16) /* 945 only */
  2279. #define FW_BLC_SELF_EN (1<<15) /* 945 only */
  2280. #define MM_BURST_LENGTH 0x00700000
  2281. #define MM_FIFO_WATERMARK 0x0001F000
  2282. #define LM_BURST_LENGTH 0x00000700
  2283. #define LM_FIFO_WATERMARK 0x0000001F
  2284. #define MI_ARB_STATE _MMIO(0x20e4) /* 915+ only */
  2285. #define MBUS_ABOX_CTL _MMIO(0x45038)
  2286. #define MBUS_ABOX_BW_CREDIT_MASK (3 << 20)
  2287. #define MBUS_ABOX_BW_CREDIT(x) ((x) << 20)
  2288. #define MBUS_ABOX_B_CREDIT_MASK (0xF << 16)
  2289. #define MBUS_ABOX_B_CREDIT(x) ((x) << 16)
  2290. #define MBUS_ABOX_BT_CREDIT_POOL2_MASK (0x1F << 8)
  2291. #define MBUS_ABOX_BT_CREDIT_POOL2(x) ((x) << 8)
  2292. #define MBUS_ABOX_BT_CREDIT_POOL1_MASK (0x1F << 0)
  2293. #define MBUS_ABOX_BT_CREDIT_POOL1(x) ((x) << 0)
  2294. #define _PIPEA_MBUS_DBOX_CTL 0x7003C
  2295. #define _PIPEB_MBUS_DBOX_CTL 0x7103C
  2296. #define PIPE_MBUS_DBOX_CTL(pipe) _MMIO_PIPE(pipe, _PIPEA_MBUS_DBOX_CTL, \
  2297. _PIPEB_MBUS_DBOX_CTL)
  2298. #define MBUS_DBOX_BW_CREDIT_MASK (3 << 14)
  2299. #define MBUS_DBOX_BW_CREDIT(x) ((x) << 14)
  2300. #define MBUS_DBOX_B_CREDIT_MASK (0x1F << 8)
  2301. #define MBUS_DBOX_B_CREDIT(x) ((x) << 8)
  2302. #define MBUS_DBOX_A_CREDIT_MASK (0xF << 0)
  2303. #define MBUS_DBOX_A_CREDIT(x) ((x) << 0)
  2304. #define MBUS_UBOX_CTL _MMIO(0x4503C)
  2305. #define MBUS_BBOX_CTL_S1 _MMIO(0x45040)
  2306. #define MBUS_BBOX_CTL_S2 _MMIO(0x45044)
  2307. /* Make render/texture TLB fetches lower priorty than associated data
  2308. * fetches. This is not turned on by default
  2309. */
  2310. #define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15)
  2311. /* Isoch request wait on GTT enable (Display A/B/C streams).
  2312. * Make isoch requests stall on the TLB update. May cause
  2313. * display underruns (test mode only)
  2314. */
  2315. #define MI_ARB_ISOCH_WAIT_GTT (1 << 14)
  2316. /* Block grant count for isoch requests when block count is
  2317. * set to a finite value.
  2318. */
  2319. #define MI_ARB_BLOCK_GRANT_MASK (3 << 12)
  2320. #define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */
  2321. #define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */
  2322. #define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */
  2323. #define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */
  2324. /* Enable render writes to complete in C2/C3/C4 power states.
  2325. * If this isn't enabled, render writes are prevented in low
  2326. * power states. That seems bad to me.
  2327. */
  2328. #define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11)
  2329. /* This acknowledges an async flip immediately instead
  2330. * of waiting for 2TLB fetches.
  2331. */
  2332. #define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10)
  2333. /* Enables non-sequential data reads through arbiter
  2334. */
  2335. #define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9)
  2336. /* Disable FSB snooping of cacheable write cycles from binner/render
  2337. * command stream
  2338. */
  2339. #define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8)
  2340. /* Arbiter time slice for non-isoch streams */
  2341. #define MI_ARB_TIME_SLICE_MASK (7 << 5)
  2342. #define MI_ARB_TIME_SLICE_1 (0 << 5)
  2343. #define MI_ARB_TIME_SLICE_2 (1 << 5)
  2344. #define MI_ARB_TIME_SLICE_4 (2 << 5)
  2345. #define MI_ARB_TIME_SLICE_6 (3 << 5)
  2346. #define MI_ARB_TIME_SLICE_8 (4 << 5)
  2347. #define MI_ARB_TIME_SLICE_10 (5 << 5)
  2348. #define MI_ARB_TIME_SLICE_14 (6 << 5)
  2349. #define MI_ARB_TIME_SLICE_16 (7 << 5)
  2350. /* Low priority grace period page size */
  2351. #define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */
  2352. #define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4)
  2353. /* Disable display A/B trickle feed */
  2354. #define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2)
  2355. /* Set display plane priority */
  2356. #define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
  2357. #define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
  2358. #define MI_STATE _MMIO(0x20e4) /* gen2 only */
  2359. #define MI_AGPBUSY_INT_EN (1 << 1) /* 85x only */
  2360. #define MI_AGPBUSY_830_MODE (1 << 0) /* 85x only */
  2361. #define CACHE_MODE_0 _MMIO(0x2120) /* 915+ only */
  2362. #define CM0_PIPELINED_RENDER_FLUSH_DISABLE (1<<8)
  2363. #define CM0_IZ_OPT_DISABLE (1<<6)
  2364. #define CM0_ZR_OPT_DISABLE (1<<5)
  2365. #define CM0_STC_EVICT_DISABLE_LRA_SNB (1<<5)
  2366. #define CM0_DEPTH_EVICT_DISABLE (1<<4)
  2367. #define CM0_COLOR_EVICT_DISABLE (1<<3)
  2368. #define CM0_DEPTH_WRITE_DISABLE (1<<1)
  2369. #define CM0_RC_OP_FLUSH_DISABLE (1<<0)
  2370. #define GFX_FLSH_CNTL _MMIO(0x2170) /* 915+ only */
  2371. #define GFX_FLSH_CNTL_GEN6 _MMIO(0x101008)
  2372. #define GFX_FLSH_CNTL_EN (1<<0)
  2373. #define ECOSKPD _MMIO(0x21d0)
  2374. #define ECO_GATING_CX_ONLY (1<<3)
  2375. #define ECO_FLIP_DONE (1<<0)
  2376. #define CACHE_MODE_0_GEN7 _MMIO(0x7000) /* IVB+ */
  2377. #define RC_OP_FLUSH_ENABLE (1<<0)
  2378. #define HIZ_RAW_STALL_OPT_DISABLE (1<<2)
  2379. #define CACHE_MODE_1 _MMIO(0x7004) /* IVB+ */
  2380. #define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1<<6)
  2381. #define GEN8_4x4_STC_OPTIMIZATION_DISABLE (1<<6)
  2382. #define GEN9_PARTIAL_RESOLVE_IN_VC_DISABLE (1<<1)
  2383. #define GEN6_BLITTER_ECOSKPD _MMIO(0x221d0)
  2384. #define GEN6_BLITTER_LOCK_SHIFT 16
  2385. #define GEN6_BLITTER_FBC_NOTIFY (1<<3)
  2386. #define GEN6_RC_SLEEP_PSMI_CONTROL _MMIO(0x2050)
  2387. #define GEN6_PSMI_SLEEP_MSG_DISABLE (1 << 0)
  2388. #define GEN8_RC_SEMA_IDLE_MSG_DISABLE (1 << 12)
  2389. #define GEN8_FF_DOP_CLOCK_GATE_DISABLE (1<<10)
  2390. #define GEN6_RCS_PWR_FSM _MMIO(0x22ac)
  2391. #define GEN9_RCS_FE_FSM2 _MMIO(0x22a4)
  2392. /* Fuse readout registers for GT */
  2393. #define HSW_PAVP_FUSE1 _MMIO(0x911C)
  2394. #define HSW_F1_EU_DIS_SHIFT 16
  2395. #define HSW_F1_EU_DIS_MASK (0x3 << HSW_F1_EU_DIS_SHIFT)
  2396. #define HSW_F1_EU_DIS_10EUS 0
  2397. #define HSW_F1_EU_DIS_8EUS 1
  2398. #define HSW_F1_EU_DIS_6EUS 2
  2399. #define CHV_FUSE_GT _MMIO(VLV_DISPLAY_BASE + 0x2168)
  2400. #define CHV_FGT_DISABLE_SS0 (1 << 10)
  2401. #define CHV_FGT_DISABLE_SS1 (1 << 11)
  2402. #define CHV_FGT_EU_DIS_SS0_R0_SHIFT 16
  2403. #define CHV_FGT_EU_DIS_SS0_R0_MASK (0xf << CHV_FGT_EU_DIS_SS0_R0_SHIFT)
  2404. #define CHV_FGT_EU_DIS_SS0_R1_SHIFT 20
  2405. #define CHV_FGT_EU_DIS_SS0_R1_MASK (0xf << CHV_FGT_EU_DIS_SS0_R1_SHIFT)
  2406. #define CHV_FGT_EU_DIS_SS1_R0_SHIFT 24
  2407. #define CHV_FGT_EU_DIS_SS1_R0_MASK (0xf << CHV_FGT_EU_DIS_SS1_R0_SHIFT)
  2408. #define CHV_FGT_EU_DIS_SS1_R1_SHIFT 28
  2409. #define CHV_FGT_EU_DIS_SS1_R1_MASK (0xf << CHV_FGT_EU_DIS_SS1_R1_SHIFT)
  2410. #define GEN8_FUSE2 _MMIO(0x9120)
  2411. #define GEN8_F2_SS_DIS_SHIFT 21
  2412. #define GEN8_F2_SS_DIS_MASK (0x7 << GEN8_F2_SS_DIS_SHIFT)
  2413. #define GEN8_F2_S_ENA_SHIFT 25
  2414. #define GEN8_F2_S_ENA_MASK (0x7 << GEN8_F2_S_ENA_SHIFT)
  2415. #define GEN9_F2_SS_DIS_SHIFT 20
  2416. #define GEN9_F2_SS_DIS_MASK (0xf << GEN9_F2_SS_DIS_SHIFT)
  2417. #define GEN10_F2_S_ENA_SHIFT 22
  2418. #define GEN10_F2_S_ENA_MASK (0x3f << GEN10_F2_S_ENA_SHIFT)
  2419. #define GEN10_F2_SS_DIS_SHIFT 18
  2420. #define GEN10_F2_SS_DIS_MASK (0xf << GEN10_F2_SS_DIS_SHIFT)
  2421. #define GEN8_EU_DISABLE0 _MMIO(0x9134)
  2422. #define GEN8_EU_DIS0_S0_MASK 0xffffff
  2423. #define GEN8_EU_DIS0_S1_SHIFT 24
  2424. #define GEN8_EU_DIS0_S1_MASK (0xff << GEN8_EU_DIS0_S1_SHIFT)
  2425. #define GEN8_EU_DISABLE1 _MMIO(0x9138)
  2426. #define GEN8_EU_DIS1_S1_MASK 0xffff
  2427. #define GEN8_EU_DIS1_S2_SHIFT 16
  2428. #define GEN8_EU_DIS1_S2_MASK (0xffff << GEN8_EU_DIS1_S2_SHIFT)
  2429. #define GEN8_EU_DISABLE2 _MMIO(0x913c)
  2430. #define GEN8_EU_DIS2_S2_MASK 0xff
  2431. #define GEN9_EU_DISABLE(slice) _MMIO(0x9134 + (slice)*0x4)
  2432. #define GEN10_EU_DISABLE3 _MMIO(0x9140)
  2433. #define GEN10_EU_DIS_SS_MASK 0xff
  2434. #define GEN11_GT_VEBOX_VDBOX_DISABLE _MMIO(0x9140)
  2435. #define GEN11_GT_VDBOX_DISABLE_MASK 0xff
  2436. #define GEN11_GT_VEBOX_DISABLE_SHIFT 16
  2437. #define GEN11_GT_VEBOX_DISABLE_MASK (0xff << GEN11_GT_VEBOX_DISABLE_SHIFT)
  2438. #define GEN11_EU_DISABLE _MMIO(0x9134)
  2439. #define GEN11_EU_DIS_MASK 0xFF
  2440. #define GEN11_GT_SLICE_ENABLE _MMIO(0x9138)
  2441. #define GEN11_GT_S_ENA_MASK 0xFF
  2442. #define GEN11_GT_SUBSLICE_DISABLE _MMIO(0x913C)
  2443. #define GEN6_BSD_SLEEP_PSMI_CONTROL _MMIO(0x12050)
  2444. #define GEN6_BSD_SLEEP_MSG_DISABLE (1 << 0)
  2445. #define GEN6_BSD_SLEEP_FLUSH_DISABLE (1 << 2)
  2446. #define GEN6_BSD_SLEEP_INDICATOR (1 << 3)
  2447. #define GEN6_BSD_GO_INDICATOR (1 << 4)
  2448. /* On modern GEN architectures interrupt control consists of two sets
  2449. * of registers. The first set pertains to the ring generating the
  2450. * interrupt. The second control is for the functional block generating the
  2451. * interrupt. These are PM, GT, DE, etc.
  2452. *
  2453. * Luckily *knocks on wood* all the ring interrupt bits match up with the
  2454. * GT interrupt bits, so we don't need to duplicate the defines.
  2455. *
  2456. * These defines should cover us well from SNB->HSW with minor exceptions
  2457. * it can also work on ILK.
  2458. */
  2459. #define GT_BLT_FLUSHDW_NOTIFY_INTERRUPT (1 << 26)
  2460. #define GT_BLT_CS_ERROR_INTERRUPT (1 << 25)
  2461. #define GT_BLT_USER_INTERRUPT (1 << 22)
  2462. #define GT_BSD_CS_ERROR_INTERRUPT (1 << 15)
  2463. #define GT_BSD_USER_INTERRUPT (1 << 12)
  2464. #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 (1 << 11) /* hsw+; rsvd on snb, ivb, vlv */
  2465. #define GT_CONTEXT_SWITCH_INTERRUPT (1 << 8)
  2466. #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT (1 << 5) /* !snb */
  2467. #define GT_RENDER_PIPECTL_NOTIFY_INTERRUPT (1 << 4)
  2468. #define GT_RENDER_CS_MASTER_ERROR_INTERRUPT (1 << 3)
  2469. #define GT_RENDER_SYNC_STATUS_INTERRUPT (1 << 2)
  2470. #define GT_RENDER_DEBUG_INTERRUPT (1 << 1)
  2471. #define GT_RENDER_USER_INTERRUPT (1 << 0)
  2472. #define PM_VEBOX_CS_ERROR_INTERRUPT (1 << 12) /* hsw+ */
  2473. #define PM_VEBOX_USER_INTERRUPT (1 << 10) /* hsw+ */
  2474. #define GT_PARITY_ERROR(dev_priv) \
  2475. (GT_RENDER_L3_PARITY_ERROR_INTERRUPT | \
  2476. (IS_HASWELL(dev_priv) ? GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 : 0))
  2477. /* These are all the "old" interrupts */
  2478. #define ILK_BSD_USER_INTERRUPT (1<<5)
  2479. #define I915_PM_INTERRUPT (1<<31)
  2480. #define I915_ISP_INTERRUPT (1<<22)
  2481. #define I915_LPE_PIPE_B_INTERRUPT (1<<21)
  2482. #define I915_LPE_PIPE_A_INTERRUPT (1<<20)
  2483. #define I915_MIPIC_INTERRUPT (1<<19)
  2484. #define I915_MIPIA_INTERRUPT (1<<18)
  2485. #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18)
  2486. #define I915_DISPLAY_PORT_INTERRUPT (1<<17)
  2487. #define I915_DISPLAY_PIPE_C_HBLANK_INTERRUPT (1<<16)
  2488. #define I915_MASTER_ERROR_INTERRUPT (1<<15)
  2489. #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15)
  2490. #define I915_DISPLAY_PIPE_B_HBLANK_INTERRUPT (1<<14)
  2491. #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14) /* p-state */
  2492. #define I915_DISPLAY_PIPE_A_HBLANK_INTERRUPT (1<<13)
  2493. #define I915_HWB_OOM_INTERRUPT (1<<13)
  2494. #define I915_LPE_PIPE_C_INTERRUPT (1<<12)
  2495. #define I915_SYNC_STATUS_INTERRUPT (1<<12)
  2496. #define I915_MISC_INTERRUPT (1<<11)
  2497. #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
  2498. #define I915_DISPLAY_PIPE_C_VBLANK_INTERRUPT (1<<10)
  2499. #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
  2500. #define I915_DISPLAY_PIPE_C_EVENT_INTERRUPT (1<<9)
  2501. #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9)
  2502. #define I915_DISPLAY_PIPE_C_DPBM_INTERRUPT (1<<8)
  2503. #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
  2504. #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7)
  2505. #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
  2506. #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
  2507. #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
  2508. #define I915_DISPLAY_PIPE_A_DPBM_INTERRUPT (1<<3)
  2509. #define I915_DISPLAY_PIPE_B_DPBM_INTERRUPT (1<<2)
  2510. #define I915_DEBUG_INTERRUPT (1<<2)
  2511. #define I915_WINVALID_INTERRUPT (1<<1)
  2512. #define I915_USER_INTERRUPT (1<<1)
  2513. #define I915_ASLE_INTERRUPT (1<<0)
  2514. #define I915_BSD_USER_INTERRUPT (1<<25)
  2515. #define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000)
  2516. #define I915_HDMI_LPE_AUDIO_SIZE 0x1000
  2517. /* DisplayPort Audio w/ LPE */
  2518. #define VLV_AUD_CHICKEN_BIT_REG _MMIO(VLV_DISPLAY_BASE + 0x62F38)
  2519. #define VLV_CHICKEN_BIT_DBG_ENABLE (1 << 0)
  2520. #define _VLV_AUD_PORT_EN_B_DBG (VLV_DISPLAY_BASE + 0x62F20)
  2521. #define _VLV_AUD_PORT_EN_C_DBG (VLV_DISPLAY_BASE + 0x62F30)
  2522. #define _VLV_AUD_PORT_EN_D_DBG (VLV_DISPLAY_BASE + 0x62F34)
  2523. #define VLV_AUD_PORT_EN_DBG(port) _MMIO_PORT3((port) - PORT_B, \
  2524. _VLV_AUD_PORT_EN_B_DBG, \
  2525. _VLV_AUD_PORT_EN_C_DBG, \
  2526. _VLV_AUD_PORT_EN_D_DBG)
  2527. #define VLV_AMP_MUTE (1 << 1)
  2528. #define GEN6_BSD_RNCID _MMIO(0x12198)
  2529. #define GEN7_FF_THREAD_MODE _MMIO(0x20a0)
  2530. #define GEN7_FF_SCHED_MASK 0x0077070
  2531. #define GEN8_FF_DS_REF_CNT_FFME (1 << 19)
  2532. #define GEN7_FF_TS_SCHED_HS1 (0x5<<16)
  2533. #define GEN7_FF_TS_SCHED_HS0 (0x3<<16)
  2534. #define GEN7_FF_TS_SCHED_LOAD_BALANCE (0x1<<16)
  2535. #define GEN7_FF_TS_SCHED_HW (0x0<<16) /* Default */
  2536. #define GEN7_FF_VS_REF_CNT_FFME (1 << 15)
  2537. #define GEN7_FF_VS_SCHED_HS1 (0x5<<12)
  2538. #define GEN7_FF_VS_SCHED_HS0 (0x3<<12)
  2539. #define GEN7_FF_VS_SCHED_LOAD_BALANCE (0x1<<12) /* Default */
  2540. #define GEN7_FF_VS_SCHED_HW (0x0<<12)
  2541. #define GEN7_FF_DS_SCHED_HS1 (0x5<<4)
  2542. #define GEN7_FF_DS_SCHED_HS0 (0x3<<4)
  2543. #define GEN7_FF_DS_SCHED_LOAD_BALANCE (0x1<<4) /* Default */
  2544. #define GEN7_FF_DS_SCHED_HW (0x0<<4)
  2545. /*
  2546. * Framebuffer compression (915+ only)
  2547. */
  2548. #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */
  2549. #define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */
  2550. #define FBC_CONTROL _MMIO(0x3208)
  2551. #define FBC_CTL_EN (1<<31)
  2552. #define FBC_CTL_PERIODIC (1<<30)
  2553. #define FBC_CTL_INTERVAL_SHIFT (16)
  2554. #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
  2555. #define FBC_CTL_C3_IDLE (1<<13)
  2556. #define FBC_CTL_STRIDE_SHIFT (5)
  2557. #define FBC_CTL_FENCENO_SHIFT (0)
  2558. #define FBC_COMMAND _MMIO(0x320c)
  2559. #define FBC_CMD_COMPRESS (1<<0)
  2560. #define FBC_STATUS _MMIO(0x3210)
  2561. #define FBC_STAT_COMPRESSING (1<<31)
  2562. #define FBC_STAT_COMPRESSED (1<<30)
  2563. #define FBC_STAT_MODIFIED (1<<29)
  2564. #define FBC_STAT_CURRENT_LINE_SHIFT (0)
  2565. #define FBC_CONTROL2 _MMIO(0x3214)
  2566. #define FBC_CTL_FENCE_DBL (0<<4)
  2567. #define FBC_CTL_IDLE_IMM (0<<2)
  2568. #define FBC_CTL_IDLE_FULL (1<<2)
  2569. #define FBC_CTL_IDLE_LINE (2<<2)
  2570. #define FBC_CTL_IDLE_DEBUG (3<<2)
  2571. #define FBC_CTL_CPU_FENCE (1<<1)
  2572. #define FBC_CTL_PLANE(plane) ((plane)<<0)
  2573. #define FBC_FENCE_OFF _MMIO(0x3218) /* BSpec typo has 321Bh */
  2574. #define FBC_TAG(i) _MMIO(0x3300 + (i) * 4)
  2575. #define FBC_LL_SIZE (1536)
  2576. #define FBC_LLC_READ_CTRL _MMIO(0x9044)
  2577. #define FBC_LLC_FULLY_OPEN (1<<30)
  2578. /* Framebuffer compression for GM45+ */
  2579. #define DPFC_CB_BASE _MMIO(0x3200)
  2580. #define DPFC_CONTROL _MMIO(0x3208)
  2581. #define DPFC_CTL_EN (1<<31)
  2582. #define DPFC_CTL_PLANE(plane) ((plane)<<30)
  2583. #define IVB_DPFC_CTL_PLANE(plane) ((plane)<<29)
  2584. #define DPFC_CTL_FENCE_EN (1<<29)
  2585. #define IVB_DPFC_CTL_FENCE_EN (1<<28)
  2586. #define DPFC_CTL_PERSISTENT_MODE (1<<25)
  2587. #define DPFC_SR_EN (1<<10)
  2588. #define DPFC_CTL_LIMIT_1X (0<<6)
  2589. #define DPFC_CTL_LIMIT_2X (1<<6)
  2590. #define DPFC_CTL_LIMIT_4X (2<<6)
  2591. #define DPFC_RECOMP_CTL _MMIO(0x320c)
  2592. #define DPFC_RECOMP_STALL_EN (1<<27)
  2593. #define DPFC_RECOMP_STALL_WM_SHIFT (16)
  2594. #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
  2595. #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
  2596. #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
  2597. #define DPFC_STATUS _MMIO(0x3210)
  2598. #define DPFC_INVAL_SEG_SHIFT (16)
  2599. #define DPFC_INVAL_SEG_MASK (0x07ff0000)
  2600. #define DPFC_COMP_SEG_SHIFT (0)
  2601. #define DPFC_COMP_SEG_MASK (0x000007ff)
  2602. #define DPFC_STATUS2 _MMIO(0x3214)
  2603. #define DPFC_FENCE_YOFF _MMIO(0x3218)
  2604. #define DPFC_CHICKEN _MMIO(0x3224)
  2605. #define DPFC_HT_MODIFY (1<<31)
  2606. /* Framebuffer compression for Ironlake */
  2607. #define ILK_DPFC_CB_BASE _MMIO(0x43200)
  2608. #define ILK_DPFC_CONTROL _MMIO(0x43208)
  2609. #define FBC_CTL_FALSE_COLOR (1<<10)
  2610. /* The bit 28-8 is reserved */
  2611. #define DPFC_RESERVED (0x1FFFFF00)
  2612. #define ILK_DPFC_RECOMP_CTL _MMIO(0x4320c)
  2613. #define ILK_DPFC_STATUS _MMIO(0x43210)
  2614. #define ILK_DPFC_COMP_SEG_MASK 0x7ff
  2615. #define IVB_FBC_STATUS2 _MMIO(0x43214)
  2616. #define IVB_FBC_COMP_SEG_MASK 0x7ff
  2617. #define BDW_FBC_COMP_SEG_MASK 0xfff
  2618. #define ILK_DPFC_FENCE_YOFF _MMIO(0x43218)
  2619. #define ILK_DPFC_CHICKEN _MMIO(0x43224)
  2620. #define ILK_DPFC_DISABLE_DUMMY0 (1<<8)
  2621. #define ILK_DPFC_NUKE_ON_ANY_MODIFICATION (1<<23)
  2622. #define ILK_FBC_RT_BASE _MMIO(0x2128)
  2623. #define ILK_FBC_RT_VALID (1<<0)
  2624. #define SNB_FBC_FRONT_BUFFER (1<<1)
  2625. #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
  2626. #define ILK_FBCQ_DIS (1<<22)
  2627. #define ILK_PABSTRETCH_DIS (1<<21)
  2628. /*
  2629. * Framebuffer compression for Sandybridge
  2630. *
  2631. * The following two registers are of type GTTMMADR
  2632. */
  2633. #define SNB_DPFC_CTL_SA _MMIO(0x100100)
  2634. #define SNB_CPU_FENCE_ENABLE (1<<29)
  2635. #define DPFC_CPU_FENCE_OFFSET _MMIO(0x100104)
  2636. /* Framebuffer compression for Ivybridge */
  2637. #define IVB_FBC_RT_BASE _MMIO(0x7020)
  2638. #define IPS_CTL _MMIO(0x43408)
  2639. #define IPS_ENABLE (1 << 31)
  2640. #define MSG_FBC_REND_STATE _MMIO(0x50380)
  2641. #define FBC_REND_NUKE (1<<2)
  2642. #define FBC_REND_CACHE_CLEAN (1<<1)
  2643. /*
  2644. * GPIO regs
  2645. */
  2646. #define GPIOA _MMIO(0x5010)
  2647. #define GPIOB _MMIO(0x5014)
  2648. #define GPIOC _MMIO(0x5018)
  2649. #define GPIOD _MMIO(0x501c)
  2650. #define GPIOE _MMIO(0x5020)
  2651. #define GPIOF _MMIO(0x5024)
  2652. #define GPIOG _MMIO(0x5028)
  2653. #define GPIOH _MMIO(0x502c)
  2654. # define GPIO_CLOCK_DIR_MASK (1 << 0)
  2655. # define GPIO_CLOCK_DIR_IN (0 << 1)
  2656. # define GPIO_CLOCK_DIR_OUT (1 << 1)
  2657. # define GPIO_CLOCK_VAL_MASK (1 << 2)
  2658. # define GPIO_CLOCK_VAL_OUT (1 << 3)
  2659. # define GPIO_CLOCK_VAL_IN (1 << 4)
  2660. # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
  2661. # define GPIO_DATA_DIR_MASK (1 << 8)
  2662. # define GPIO_DATA_DIR_IN (0 << 9)
  2663. # define GPIO_DATA_DIR_OUT (1 << 9)
  2664. # define GPIO_DATA_VAL_MASK (1 << 10)
  2665. # define GPIO_DATA_VAL_OUT (1 << 11)
  2666. # define GPIO_DATA_VAL_IN (1 << 12)
  2667. # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
  2668. #define GMBUS0 _MMIO(dev_priv->gpio_mmio_base + 0x5100) /* clock/port select */
  2669. #define GMBUS_AKSV_SELECT (1<<11)
  2670. #define GMBUS_RATE_100KHZ (0<<8)
  2671. #define GMBUS_RATE_50KHZ (1<<8)
  2672. #define GMBUS_RATE_400KHZ (2<<8) /* reserved on Pineview */
  2673. #define GMBUS_RATE_1MHZ (3<<8) /* reserved on Pineview */
  2674. #define GMBUS_HOLD_EXT (1<<7) /* 300ns hold time, rsvd on Pineview */
  2675. #define GMBUS_PIN_DISABLED 0
  2676. #define GMBUS_PIN_SSC 1
  2677. #define GMBUS_PIN_VGADDC 2
  2678. #define GMBUS_PIN_PANEL 3
  2679. #define GMBUS_PIN_DPD_CHV 3 /* HDMID_CHV */
  2680. #define GMBUS_PIN_DPC 4 /* HDMIC */
  2681. #define GMBUS_PIN_DPB 5 /* SDVO, HDMIB */
  2682. #define GMBUS_PIN_DPD 6 /* HDMID */
  2683. #define GMBUS_PIN_RESERVED 7 /* 7 reserved */
  2684. #define GMBUS_PIN_1_BXT 1 /* BXT+ (atom) and CNP+ (big core) */
  2685. #define GMBUS_PIN_2_BXT 2
  2686. #define GMBUS_PIN_3_BXT 3
  2687. #define GMBUS_PIN_4_CNP 4
  2688. #define GMBUS_PIN_9_TC1_ICP 9
  2689. #define GMBUS_PIN_10_TC2_ICP 10
  2690. #define GMBUS_PIN_11_TC3_ICP 11
  2691. #define GMBUS_PIN_12_TC4_ICP 12
  2692. #define GMBUS_NUM_PINS 13 /* including 0 */
  2693. #define GMBUS1 _MMIO(dev_priv->gpio_mmio_base + 0x5104) /* command/status */
  2694. #define GMBUS_SW_CLR_INT (1<<31)
  2695. #define GMBUS_SW_RDY (1<<30)
  2696. #define GMBUS_ENT (1<<29) /* enable timeout */
  2697. #define GMBUS_CYCLE_NONE (0<<25)
  2698. #define GMBUS_CYCLE_WAIT (1<<25)
  2699. #define GMBUS_CYCLE_INDEX (2<<25)
  2700. #define GMBUS_CYCLE_STOP (4<<25)
  2701. #define GMBUS_BYTE_COUNT_SHIFT 16
  2702. #define GMBUS_BYTE_COUNT_MAX 256U
  2703. #define GMBUS_SLAVE_INDEX_SHIFT 8
  2704. #define GMBUS_SLAVE_ADDR_SHIFT 1
  2705. #define GMBUS_SLAVE_READ (1<<0)
  2706. #define GMBUS_SLAVE_WRITE (0<<0)
  2707. #define GMBUS2 _MMIO(dev_priv->gpio_mmio_base + 0x5108) /* status */
  2708. #define GMBUS_INUSE (1<<15)
  2709. #define GMBUS_HW_WAIT_PHASE (1<<14)
  2710. #define GMBUS_STALL_TIMEOUT (1<<13)
  2711. #define GMBUS_INT (1<<12)
  2712. #define GMBUS_HW_RDY (1<<11)
  2713. #define GMBUS_SATOER (1<<10)
  2714. #define GMBUS_ACTIVE (1<<9)
  2715. #define GMBUS3 _MMIO(dev_priv->gpio_mmio_base + 0x510c) /* data buffer bytes 3-0 */
  2716. #define GMBUS4 _MMIO(dev_priv->gpio_mmio_base + 0x5110) /* interrupt mask (Pineview+) */
  2717. #define GMBUS_SLAVE_TIMEOUT_EN (1<<4)
  2718. #define GMBUS_NAK_EN (1<<3)
  2719. #define GMBUS_IDLE_EN (1<<2)
  2720. #define GMBUS_HW_WAIT_EN (1<<1)
  2721. #define GMBUS_HW_RDY_EN (1<<0)
  2722. #define GMBUS5 _MMIO(dev_priv->gpio_mmio_base + 0x5120) /* byte index */
  2723. #define GMBUS_2BYTE_INDEX_EN (1<<31)
  2724. /*
  2725. * Clock control & power management
  2726. */
  2727. #define _DPLL_A (dev_priv->info.display_mmio_offset + 0x6014)
  2728. #define _DPLL_B (dev_priv->info.display_mmio_offset + 0x6018)
  2729. #define _CHV_DPLL_C (dev_priv->info.display_mmio_offset + 0x6030)
  2730. #define DPLL(pipe) _MMIO_PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
  2731. #define VGA0 _MMIO(0x6000)
  2732. #define VGA1 _MMIO(0x6004)
  2733. #define VGA_PD _MMIO(0x6010)
  2734. #define VGA0_PD_P2_DIV_4 (1 << 7)
  2735. #define VGA0_PD_P1_DIV_2 (1 << 5)
  2736. #define VGA0_PD_P1_SHIFT 0
  2737. #define VGA0_PD_P1_MASK (0x1f << 0)
  2738. #define VGA1_PD_P2_DIV_4 (1 << 15)
  2739. #define VGA1_PD_P1_DIV_2 (1 << 13)
  2740. #define VGA1_PD_P1_SHIFT 8
  2741. #define VGA1_PD_P1_MASK (0x1f << 8)
  2742. #define DPLL_VCO_ENABLE (1 << 31)
  2743. #define DPLL_SDVO_HIGH_SPEED (1 << 30)
  2744. #define DPLL_DVO_2X_MODE (1 << 30)
  2745. #define DPLL_EXT_BUFFER_ENABLE_VLV (1 << 30)
  2746. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  2747. #define DPLL_REF_CLK_ENABLE_VLV (1 << 29)
  2748. #define DPLL_VGA_MODE_DIS (1 << 28)
  2749. #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
  2750. #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
  2751. #define DPLL_MODE_MASK (3 << 26)
  2752. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
  2753. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
  2754. #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
  2755. #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
  2756. #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
  2757. #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
  2758. #define DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW 0x00ff8000 /* Pineview */
  2759. #define DPLL_LOCK_VLV (1<<15)
  2760. #define DPLL_INTEGRATED_CRI_CLK_VLV (1<<14)
  2761. #define DPLL_INTEGRATED_REF_CLK_VLV (1<<13)
  2762. #define DPLL_SSC_REF_CLK_CHV (1<<13)
  2763. #define DPLL_PORTC_READY_MASK (0xf << 4)
  2764. #define DPLL_PORTB_READY_MASK (0xf)
  2765. #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
  2766. /* Additional CHV pll/phy registers */
  2767. #define DPIO_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x6240)
  2768. #define DPLL_PORTD_READY_MASK (0xf)
  2769. #define DISPLAY_PHY_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x60100)
  2770. #define PHY_CH_POWER_DOWN_OVRD_EN(phy, ch) (1 << (2*(phy)+(ch)+27))
  2771. #define PHY_LDO_DELAY_0NS 0x0
  2772. #define PHY_LDO_DELAY_200NS 0x1
  2773. #define PHY_LDO_DELAY_600NS 0x2
  2774. #define PHY_LDO_SEQ_DELAY(delay, phy) ((delay) << (2*(phy)+23))
  2775. #define PHY_CH_POWER_DOWN_OVRD(mask, phy, ch) ((mask) << (8*(phy)+4*(ch)+11))
  2776. #define PHY_CH_SU_PSR 0x1
  2777. #define PHY_CH_DEEP_PSR 0x7
  2778. #define PHY_CH_POWER_MODE(mode, phy, ch) ((mode) << (6*(phy)+3*(ch)+2))
  2779. #define PHY_COM_LANE_RESET_DEASSERT(phy) (1 << (phy))
  2780. #define DISPLAY_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x60104)
  2781. #define PHY_POWERGOOD(phy) (((phy) == DPIO_PHY0) ? (1<<31) : (1<<30))
  2782. #define PHY_STATUS_CMN_LDO(phy, ch) (1 << (6-(6*(phy)+3*(ch))))
  2783. #define PHY_STATUS_SPLINE_LDO(phy, ch, spline) (1 << (8-(6*(phy)+3*(ch)+(spline))))
  2784. /*
  2785. * The i830 generation, in LVDS mode, defines P1 as the bit number set within
  2786. * this field (only one bit may be set).
  2787. */
  2788. #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
  2789. #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
  2790. #define DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW 15
  2791. /* i830, required in DVO non-gang */
  2792. #define PLL_P2_DIVIDE_BY_4 (1 << 23)
  2793. #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
  2794. #define PLL_REF_INPUT_DREFCLK (0 << 13)
  2795. #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
  2796. #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
  2797. #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
  2798. #define PLL_REF_INPUT_MASK (3 << 13)
  2799. #define PLL_LOAD_PULSE_PHASE_SHIFT 9
  2800. /* Ironlake */
  2801. # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
  2802. # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
  2803. # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1) << 9)
  2804. # define DPLL_FPA1_P1_POST_DIV_SHIFT 0
  2805. # define DPLL_FPA1_P1_POST_DIV_MASK 0xff
  2806. /*
  2807. * Parallel to Serial Load Pulse phase selection.
  2808. * Selects the phase for the 10X DPLL clock for the PCIe
  2809. * digital display port. The range is 4 to 13; 10 or more
  2810. * is just a flip delay. The default is 6
  2811. */
  2812. #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
  2813. #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
  2814. /*
  2815. * SDVO multiplier for 945G/GM. Not used on 965.
  2816. */
  2817. #define SDVO_MULTIPLIER_MASK 0x000000ff
  2818. #define SDVO_MULTIPLIER_SHIFT_HIRES 4
  2819. #define SDVO_MULTIPLIER_SHIFT_VGA 0
  2820. #define _DPLL_A_MD (dev_priv->info.display_mmio_offset + 0x601c)
  2821. #define _DPLL_B_MD (dev_priv->info.display_mmio_offset + 0x6020)
  2822. #define _CHV_DPLL_C_MD (dev_priv->info.display_mmio_offset + 0x603c)
  2823. #define DPLL_MD(pipe) _MMIO_PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
  2824. /*
  2825. * UDI pixel divider, controlling how many pixels are stuffed into a packet.
  2826. *
  2827. * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
  2828. */
  2829. #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
  2830. #define DPLL_MD_UDI_DIVIDER_SHIFT 24
  2831. /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
  2832. #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
  2833. #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
  2834. /*
  2835. * SDVO/UDI pixel multiplier.
  2836. *
  2837. * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
  2838. * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
  2839. * modes, the bus rate would be below the limits, so SDVO allows for stuffing
  2840. * dummy bytes in the datastream at an increased clock rate, with both sides of
  2841. * the link knowing how many bytes are fill.
  2842. *
  2843. * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
  2844. * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
  2845. * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
  2846. * through an SDVO command.
  2847. *
  2848. * This register field has values of multiplication factor minus 1, with
  2849. * a maximum multiplier of 5 for SDVO.
  2850. */
  2851. #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
  2852. #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
  2853. /*
  2854. * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
  2855. * This best be set to the default value (3) or the CRT won't work. No,
  2856. * I don't entirely understand what this does...
  2857. */
  2858. #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
  2859. #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
  2860. #define RAWCLK_FREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6024)
  2861. #define _FPA0 0x6040
  2862. #define _FPA1 0x6044
  2863. #define _FPB0 0x6048
  2864. #define _FPB1 0x604c
  2865. #define FP0(pipe) _MMIO_PIPE(pipe, _FPA0, _FPB0)
  2866. #define FP1(pipe) _MMIO_PIPE(pipe, _FPA1, _FPB1)
  2867. #define FP_N_DIV_MASK 0x003f0000
  2868. #define FP_N_PINEVIEW_DIV_MASK 0x00ff0000
  2869. #define FP_N_DIV_SHIFT 16
  2870. #define FP_M1_DIV_MASK 0x00003f00
  2871. #define FP_M1_DIV_SHIFT 8
  2872. #define FP_M2_DIV_MASK 0x0000003f
  2873. #define FP_M2_PINEVIEW_DIV_MASK 0x000000ff
  2874. #define FP_M2_DIV_SHIFT 0
  2875. #define DPLL_TEST _MMIO(0x606c)
  2876. #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
  2877. #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
  2878. #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
  2879. #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
  2880. #define DPLLB_TEST_N_BYPASS (1 << 19)
  2881. #define DPLLB_TEST_M_BYPASS (1 << 18)
  2882. #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
  2883. #define DPLLA_TEST_N_BYPASS (1 << 3)
  2884. #define DPLLA_TEST_M_BYPASS (1 << 2)
  2885. #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
  2886. #define D_STATE _MMIO(0x6104)
  2887. #define DSTATE_GFX_RESET_I830 (1<<6)
  2888. #define DSTATE_PLL_D3_OFF (1<<3)
  2889. #define DSTATE_GFX_CLOCK_GATING (1<<1)
  2890. #define DSTATE_DOT_CLOCK_GATING (1<<0)
  2891. #define DSPCLK_GATE_D _MMIO(dev_priv->info.display_mmio_offset + 0x6200)
  2892. # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
  2893. # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
  2894. # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
  2895. # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
  2896. # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
  2897. # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
  2898. # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
  2899. # define PNV_GMBUSUNIT_CLOCK_GATE_DISABLE (1 << 24) /* pnv */
  2900. # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
  2901. # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
  2902. # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
  2903. # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
  2904. # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
  2905. # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
  2906. # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
  2907. # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
  2908. # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
  2909. # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
  2910. # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
  2911. # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
  2912. # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
  2913. # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
  2914. # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
  2915. # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
  2916. # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
  2917. # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
  2918. # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
  2919. # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
  2920. # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
  2921. /*
  2922. * This bit must be set on the 830 to prevent hangs when turning off the
  2923. * overlay scaler.
  2924. */
  2925. # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
  2926. # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
  2927. # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
  2928. # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
  2929. # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
  2930. #define RENCLK_GATE_D1 _MMIO(0x6204)
  2931. # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
  2932. # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
  2933. # define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
  2934. # define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
  2935. # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
  2936. # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
  2937. # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
  2938. # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
  2939. # define MAG_CLOCK_GATE_DISABLE (1 << 5)
  2940. /* This bit must be unset on 855,865 */
  2941. # define MECI_CLOCK_GATE_DISABLE (1 << 4)
  2942. # define DCMP_CLOCK_GATE_DISABLE (1 << 3)
  2943. # define MEC_CLOCK_GATE_DISABLE (1 << 2)
  2944. # define MECO_CLOCK_GATE_DISABLE (1 << 1)
  2945. /* This bit must be set on 855,865. */
  2946. # define SV_CLOCK_GATE_DISABLE (1 << 0)
  2947. # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
  2948. # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
  2949. # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
  2950. # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
  2951. # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
  2952. # define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
  2953. # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
  2954. # define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
  2955. # define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
  2956. # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
  2957. # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
  2958. # define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
  2959. # define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
  2960. # define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
  2961. # define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
  2962. # define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
  2963. # define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
  2964. # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
  2965. /* This bit must always be set on 965G/965GM */
  2966. # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
  2967. # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
  2968. # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
  2969. # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
  2970. # define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
  2971. # define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
  2972. /* This bit must always be set on 965G */
  2973. # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
  2974. # define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
  2975. # define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
  2976. # define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
  2977. # define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
  2978. # define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
  2979. # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
  2980. # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
  2981. # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
  2982. # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
  2983. # define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
  2984. # define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
  2985. # define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
  2986. # define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
  2987. # define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
  2988. # define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
  2989. # define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
  2990. # define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
  2991. # define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
  2992. #define RENCLK_GATE_D2 _MMIO(0x6208)
  2993. #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
  2994. #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
  2995. #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
  2996. #define VDECCLK_GATE_D _MMIO(0x620C) /* g4x only */
  2997. #define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4)
  2998. #define RAMCLK_GATE_D _MMIO(0x6210) /* CRL only */
  2999. #define DEUC _MMIO(0x6214) /* CRL only */
  3000. #define FW_BLC_SELF_VLV _MMIO(VLV_DISPLAY_BASE + 0x6500)
  3001. #define FW_CSPWRDWNEN (1<<15)
  3002. #define MI_ARB_VLV _MMIO(VLV_DISPLAY_BASE + 0x6504)
  3003. #define CZCLK_CDCLK_FREQ_RATIO _MMIO(VLV_DISPLAY_BASE + 0x6508)
  3004. #define CDCLK_FREQ_SHIFT 4
  3005. #define CDCLK_FREQ_MASK (0x1f << CDCLK_FREQ_SHIFT)
  3006. #define CZCLK_FREQ_MASK 0xf
  3007. #define GCI_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x650C)
  3008. #define PFI_CREDIT_63 (9 << 28) /* chv only */
  3009. #define PFI_CREDIT_31 (8 << 28) /* chv only */
  3010. #define PFI_CREDIT(x) (((x) - 8) << 28) /* 8-15 */
  3011. #define PFI_CREDIT_RESEND (1 << 27)
  3012. #define VGA_FAST_MODE_DISABLE (1 << 14)
  3013. #define GMBUSFREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6510)
  3014. /*
  3015. * Palette regs
  3016. */
  3017. #define PALETTE_A_OFFSET 0xa000
  3018. #define PALETTE_B_OFFSET 0xa800
  3019. #define CHV_PALETTE_C_OFFSET 0xc000
  3020. #define PALETTE(pipe, i) _MMIO(dev_priv->info.palette_offsets[pipe] + \
  3021. dev_priv->info.display_mmio_offset + (i) * 4)
  3022. /* MCH MMIO space */
  3023. /*
  3024. * MCHBAR mirror.
  3025. *
  3026. * This mirrors the MCHBAR MMIO space whose location is determined by
  3027. * device 0 function 0's pci config register 0x44 or 0x48 and matches it in
  3028. * every way. It is not accessible from the CP register read instructions.
  3029. *
  3030. * Starting from Haswell, you can't write registers using the MCHBAR mirror,
  3031. * just read.
  3032. */
  3033. #define MCHBAR_MIRROR_BASE 0x10000
  3034. #define MCHBAR_MIRROR_BASE_SNB 0x140000
  3035. #define CTG_STOLEN_RESERVED _MMIO(MCHBAR_MIRROR_BASE + 0x34)
  3036. #define ELK_STOLEN_RESERVED _MMIO(MCHBAR_MIRROR_BASE + 0x48)
  3037. #define G4X_STOLEN_RESERVED_ADDR1_MASK (0xFFFF << 16)
  3038. #define G4X_STOLEN_RESERVED_ADDR2_MASK (0xFFF << 4)
  3039. #define G4X_STOLEN_RESERVED_ENABLE (1 << 0)
  3040. /* Memory controller frequency in MCHBAR for Haswell (possible SNB+) */
  3041. #define DCLK _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5e04)
  3042. /* 915-945 and GM965 MCH register controlling DRAM channel access */
  3043. #define DCC _MMIO(MCHBAR_MIRROR_BASE + 0x200)
  3044. #define DCC_ADDRESSING_MODE_SINGLE_CHANNEL (0 << 0)
  3045. #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_ASYMMETRIC (1 << 0)
  3046. #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_INTERLEAVED (2 << 0)
  3047. #define DCC_ADDRESSING_MODE_MASK (3 << 0)
  3048. #define DCC_CHANNEL_XOR_DISABLE (1 << 10)
  3049. #define DCC_CHANNEL_XOR_BIT_17 (1 << 9)
  3050. #define DCC2 _MMIO(MCHBAR_MIRROR_BASE + 0x204)
  3051. #define DCC2_MODIFIED_ENHANCED_DISABLE (1 << 20)
  3052. /* Pineview MCH register contains DDR3 setting */
  3053. #define CSHRDDR3CTL _MMIO(MCHBAR_MIRROR_BASE + 0x1a8)
  3054. #define CSHRDDR3CTL_DDR3 (1 << 2)
  3055. /* 965 MCH register controlling DRAM channel configuration */
  3056. #define C0DRB3 _MMIO(MCHBAR_MIRROR_BASE + 0x206)
  3057. #define C1DRB3 _MMIO(MCHBAR_MIRROR_BASE + 0x606)
  3058. /* snb MCH registers for reading the DRAM channel configuration */
  3059. #define MAD_DIMM_C0 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5004)
  3060. #define MAD_DIMM_C1 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5008)
  3061. #define MAD_DIMM_C2 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x500C)
  3062. #define MAD_DIMM_ECC_MASK (0x3 << 24)
  3063. #define MAD_DIMM_ECC_OFF (0x0 << 24)
  3064. #define MAD_DIMM_ECC_IO_ON_LOGIC_OFF (0x1 << 24)
  3065. #define MAD_DIMM_ECC_IO_OFF_LOGIC_ON (0x2 << 24)
  3066. #define MAD_DIMM_ECC_ON (0x3 << 24)
  3067. #define MAD_DIMM_ENH_INTERLEAVE (0x1 << 22)
  3068. #define MAD_DIMM_RANK_INTERLEAVE (0x1 << 21)
  3069. #define MAD_DIMM_B_WIDTH_X16 (0x1 << 20) /* X8 chips if unset */
  3070. #define MAD_DIMM_A_WIDTH_X16 (0x1 << 19) /* X8 chips if unset */
  3071. #define MAD_DIMM_B_DUAL_RANK (0x1 << 18)
  3072. #define MAD_DIMM_A_DUAL_RANK (0x1 << 17)
  3073. #define MAD_DIMM_A_SELECT (0x1 << 16)
  3074. /* DIMM sizes are in multiples of 256mb. */
  3075. #define MAD_DIMM_B_SIZE_SHIFT 8
  3076. #define MAD_DIMM_B_SIZE_MASK (0xff << MAD_DIMM_B_SIZE_SHIFT)
  3077. #define MAD_DIMM_A_SIZE_SHIFT 0
  3078. #define MAD_DIMM_A_SIZE_MASK (0xff << MAD_DIMM_A_SIZE_SHIFT)
  3079. /* snb MCH registers for priority tuning */
  3080. #define MCH_SSKPD _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5d10)
  3081. #define MCH_SSKPD_WM0_MASK 0x3f
  3082. #define MCH_SSKPD_WM0_VAL 0xc
  3083. #define MCH_SECP_NRG_STTS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x592c)
  3084. /* Clocking configuration register */
  3085. #define CLKCFG _MMIO(MCHBAR_MIRROR_BASE + 0xc00)
  3086. #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */
  3087. #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
  3088. #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
  3089. #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */
  3090. #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */
  3091. #define CLKCFG_FSB_1067_ALT (0 << 0) /* hrawclk 266 */
  3092. #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */
  3093. /*
  3094. * Note that on at least on ELK the below value is reported for both
  3095. * 333 and 400 MHz BIOS FSB setting, but given that the gmch datasheet
  3096. * lists only 200/266/333 MHz FSB as supported let's decode it as 333 MHz.
  3097. */
  3098. #define CLKCFG_FSB_1333_ALT (4 << 0) /* hrawclk 333 */
  3099. #define CLKCFG_FSB_MASK (7 << 0)
  3100. #define CLKCFG_MEM_533 (1 << 4)
  3101. #define CLKCFG_MEM_667 (2 << 4)
  3102. #define CLKCFG_MEM_800 (3 << 4)
  3103. #define CLKCFG_MEM_MASK (7 << 4)
  3104. #define HPLLVCO _MMIO(MCHBAR_MIRROR_BASE + 0xc38)
  3105. #define HPLLVCO_MOBILE _MMIO(MCHBAR_MIRROR_BASE + 0xc0f)
  3106. #define TSC1 _MMIO(0x11001)
  3107. #define TSE (1<<0)
  3108. #define TR1 _MMIO(0x11006)
  3109. #define TSFS _MMIO(0x11020)
  3110. #define TSFS_SLOPE_MASK 0x0000ff00
  3111. #define TSFS_SLOPE_SHIFT 8
  3112. #define TSFS_INTR_MASK 0x000000ff
  3113. #define CRSTANDVID _MMIO(0x11100)
  3114. #define PXVFREQ(fstart) _MMIO(0x11110 + (fstart) * 4) /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
  3115. #define PXVFREQ_PX_MASK 0x7f000000
  3116. #define PXVFREQ_PX_SHIFT 24
  3117. #define VIDFREQ_BASE _MMIO(0x11110)
  3118. #define VIDFREQ1 _MMIO(0x11110) /* VIDFREQ1-4 (0x1111c) (Cantiga) */
  3119. #define VIDFREQ2 _MMIO(0x11114)
  3120. #define VIDFREQ3 _MMIO(0x11118)
  3121. #define VIDFREQ4 _MMIO(0x1111c)
  3122. #define VIDFREQ_P0_MASK 0x1f000000
  3123. #define VIDFREQ_P0_SHIFT 24
  3124. #define VIDFREQ_P0_CSCLK_MASK 0x00f00000
  3125. #define VIDFREQ_P0_CSCLK_SHIFT 20
  3126. #define VIDFREQ_P0_CRCLK_MASK 0x000f0000
  3127. #define VIDFREQ_P0_CRCLK_SHIFT 16
  3128. #define VIDFREQ_P1_MASK 0x00001f00
  3129. #define VIDFREQ_P1_SHIFT 8
  3130. #define VIDFREQ_P1_CSCLK_MASK 0x000000f0
  3131. #define VIDFREQ_P1_CSCLK_SHIFT 4
  3132. #define VIDFREQ_P1_CRCLK_MASK 0x0000000f
  3133. #define INTTOEXT_BASE_ILK _MMIO(0x11300)
  3134. #define INTTOEXT_BASE _MMIO(0x11120) /* INTTOEXT1-8 (0x1113c) */
  3135. #define INTTOEXT_MAP3_SHIFT 24
  3136. #define INTTOEXT_MAP3_MASK (0x1f << INTTOEXT_MAP3_SHIFT)
  3137. #define INTTOEXT_MAP2_SHIFT 16
  3138. #define INTTOEXT_MAP2_MASK (0x1f << INTTOEXT_MAP2_SHIFT)
  3139. #define INTTOEXT_MAP1_SHIFT 8
  3140. #define INTTOEXT_MAP1_MASK (0x1f << INTTOEXT_MAP1_SHIFT)
  3141. #define INTTOEXT_MAP0_SHIFT 0
  3142. #define INTTOEXT_MAP0_MASK (0x1f << INTTOEXT_MAP0_SHIFT)
  3143. #define MEMSWCTL _MMIO(0x11170) /* Ironlake only */
  3144. #define MEMCTL_CMD_MASK 0xe000
  3145. #define MEMCTL_CMD_SHIFT 13
  3146. #define MEMCTL_CMD_RCLK_OFF 0
  3147. #define MEMCTL_CMD_RCLK_ON 1
  3148. #define MEMCTL_CMD_CHFREQ 2
  3149. #define MEMCTL_CMD_CHVID 3
  3150. #define MEMCTL_CMD_VMMOFF 4
  3151. #define MEMCTL_CMD_VMMON 5
  3152. #define MEMCTL_CMD_STS (1<<12) /* write 1 triggers command, clears
  3153. when command complete */
  3154. #define MEMCTL_FREQ_MASK 0x0f00 /* jitter, from 0-15 */
  3155. #define MEMCTL_FREQ_SHIFT 8
  3156. #define MEMCTL_SFCAVM (1<<7)
  3157. #define MEMCTL_TGT_VID_MASK 0x007f
  3158. #define MEMIHYST _MMIO(0x1117c)
  3159. #define MEMINTREN _MMIO(0x11180) /* 16 bits */
  3160. #define MEMINT_RSEXIT_EN (1<<8)
  3161. #define MEMINT_CX_SUPR_EN (1<<7)
  3162. #define MEMINT_CONT_BUSY_EN (1<<6)
  3163. #define MEMINT_AVG_BUSY_EN (1<<5)
  3164. #define MEMINT_EVAL_CHG_EN (1<<4)
  3165. #define MEMINT_MON_IDLE_EN (1<<3)
  3166. #define MEMINT_UP_EVAL_EN (1<<2)
  3167. #define MEMINT_DOWN_EVAL_EN (1<<1)
  3168. #define MEMINT_SW_CMD_EN (1<<0)
  3169. #define MEMINTRSTR _MMIO(0x11182) /* 16 bits */
  3170. #define MEM_RSEXIT_MASK 0xc000
  3171. #define MEM_RSEXIT_SHIFT 14
  3172. #define MEM_CONT_BUSY_MASK 0x3000
  3173. #define MEM_CONT_BUSY_SHIFT 12
  3174. #define MEM_AVG_BUSY_MASK 0x0c00
  3175. #define MEM_AVG_BUSY_SHIFT 10
  3176. #define MEM_EVAL_CHG_MASK 0x0300
  3177. #define MEM_EVAL_BUSY_SHIFT 8
  3178. #define MEM_MON_IDLE_MASK 0x00c0
  3179. #define MEM_MON_IDLE_SHIFT 6
  3180. #define MEM_UP_EVAL_MASK 0x0030
  3181. #define MEM_UP_EVAL_SHIFT 4
  3182. #define MEM_DOWN_EVAL_MASK 0x000c
  3183. #define MEM_DOWN_EVAL_SHIFT 2
  3184. #define MEM_SW_CMD_MASK 0x0003
  3185. #define MEM_INT_STEER_GFX 0
  3186. #define MEM_INT_STEER_CMR 1
  3187. #define MEM_INT_STEER_SMI 2
  3188. #define MEM_INT_STEER_SCI 3
  3189. #define MEMINTRSTS _MMIO(0x11184)
  3190. #define MEMINT_RSEXIT (1<<7)
  3191. #define MEMINT_CONT_BUSY (1<<6)
  3192. #define MEMINT_AVG_BUSY (1<<5)
  3193. #define MEMINT_EVAL_CHG (1<<4)
  3194. #define MEMINT_MON_IDLE (1<<3)
  3195. #define MEMINT_UP_EVAL (1<<2)
  3196. #define MEMINT_DOWN_EVAL (1<<1)
  3197. #define MEMINT_SW_CMD (1<<0)
  3198. #define MEMMODECTL _MMIO(0x11190)
  3199. #define MEMMODE_BOOST_EN (1<<31)
  3200. #define MEMMODE_BOOST_FREQ_MASK 0x0f000000 /* jitter for boost, 0-15 */
  3201. #define MEMMODE_BOOST_FREQ_SHIFT 24
  3202. #define MEMMODE_IDLE_MODE_MASK 0x00030000
  3203. #define MEMMODE_IDLE_MODE_SHIFT 16
  3204. #define MEMMODE_IDLE_MODE_EVAL 0
  3205. #define MEMMODE_IDLE_MODE_CONT 1
  3206. #define MEMMODE_HWIDLE_EN (1<<15)
  3207. #define MEMMODE_SWMODE_EN (1<<14)
  3208. #define MEMMODE_RCLK_GATE (1<<13)
  3209. #define MEMMODE_HW_UPDATE (1<<12)
  3210. #define MEMMODE_FSTART_MASK 0x00000f00 /* starting jitter, 0-15 */
  3211. #define MEMMODE_FSTART_SHIFT 8
  3212. #define MEMMODE_FMAX_MASK 0x000000f0 /* max jitter, 0-15 */
  3213. #define MEMMODE_FMAX_SHIFT 4
  3214. #define MEMMODE_FMIN_MASK 0x0000000f /* min jitter, 0-15 */
  3215. #define RCBMAXAVG _MMIO(0x1119c)
  3216. #define MEMSWCTL2 _MMIO(0x1119e) /* Cantiga only */
  3217. #define SWMEMCMD_RENDER_OFF (0 << 13)
  3218. #define SWMEMCMD_RENDER_ON (1 << 13)
  3219. #define SWMEMCMD_SWFREQ (2 << 13)
  3220. #define SWMEMCMD_TARVID (3 << 13)
  3221. #define SWMEMCMD_VRM_OFF (4 << 13)
  3222. #define SWMEMCMD_VRM_ON (5 << 13)
  3223. #define CMDSTS (1<<12)
  3224. #define SFCAVM (1<<11)
  3225. #define SWFREQ_MASK 0x0380 /* P0-7 */
  3226. #define SWFREQ_SHIFT 7
  3227. #define TARVID_MASK 0x001f
  3228. #define MEMSTAT_CTG _MMIO(0x111a0)
  3229. #define RCBMINAVG _MMIO(0x111a0)
  3230. #define RCUPEI _MMIO(0x111b0)
  3231. #define RCDNEI _MMIO(0x111b4)
  3232. #define RSTDBYCTL _MMIO(0x111b8)
  3233. #define RS1EN (1<<31)
  3234. #define RS2EN (1<<30)
  3235. #define RS3EN (1<<29)
  3236. #define D3RS3EN (1<<28) /* Display D3 imlies RS3 */
  3237. #define SWPROMORSX (1<<27) /* RSx promotion timers ignored */
  3238. #define RCWAKERW (1<<26) /* Resetwarn from PCH causes wakeup */
  3239. #define DPRSLPVREN (1<<25) /* Fast voltage ramp enable */
  3240. #define GFXTGHYST (1<<24) /* Hysteresis to allow trunk gating */
  3241. #define RCX_SW_EXIT (1<<23) /* Leave RSx and prevent re-entry */
  3242. #define RSX_STATUS_MASK (7<<20)
  3243. #define RSX_STATUS_ON (0<<20)
  3244. #define RSX_STATUS_RC1 (1<<20)
  3245. #define RSX_STATUS_RC1E (2<<20)
  3246. #define RSX_STATUS_RS1 (3<<20)
  3247. #define RSX_STATUS_RS2 (4<<20) /* aka rc6 */
  3248. #define RSX_STATUS_RSVD (5<<20) /* deep rc6 unsupported on ilk */
  3249. #define RSX_STATUS_RS3 (6<<20) /* rs3 unsupported on ilk */
  3250. #define RSX_STATUS_RSVD2 (7<<20)
  3251. #define UWRCRSXE (1<<19) /* wake counter limit prevents rsx */
  3252. #define RSCRP (1<<18) /* rs requests control on rs1/2 reqs */
  3253. #define JRSC (1<<17) /* rsx coupled to cpu c-state */
  3254. #define RS2INC0 (1<<16) /* allow rs2 in cpu c0 */
  3255. #define RS1CONTSAV_MASK (3<<14)
  3256. #define RS1CONTSAV_NO_RS1 (0<<14) /* rs1 doesn't save/restore context */
  3257. #define RS1CONTSAV_RSVD (1<<14)
  3258. #define RS1CONTSAV_SAVE_RS1 (2<<14) /* rs1 saves context */
  3259. #define RS1CONTSAV_FULL_RS1 (3<<14) /* rs1 saves and restores context */
  3260. #define NORMSLEXLAT_MASK (3<<12)
  3261. #define SLOW_RS123 (0<<12)
  3262. #define SLOW_RS23 (1<<12)
  3263. #define SLOW_RS3 (2<<12)
  3264. #define NORMAL_RS123 (3<<12)
  3265. #define RCMODE_TIMEOUT (1<<11) /* 0 is eval interval method */
  3266. #define IMPROMOEN (1<<10) /* promo is immediate or delayed until next idle interval (only for timeout method above) */
  3267. #define RCENTSYNC (1<<9) /* rs coupled to cpu c-state (3/6/7) */
  3268. #define STATELOCK (1<<7) /* locked to rs_cstate if 0 */
  3269. #define RS_CSTATE_MASK (3<<4)
  3270. #define RS_CSTATE_C367_RS1 (0<<4)
  3271. #define RS_CSTATE_C36_RS1_C7_RS2 (1<<4)
  3272. #define RS_CSTATE_RSVD (2<<4)
  3273. #define RS_CSTATE_C367_RS2 (3<<4)
  3274. #define REDSAVES (1<<3) /* no context save if was idle during rs0 */
  3275. #define REDRESTORES (1<<2) /* no restore if was idle during rs0 */
  3276. #define VIDCTL _MMIO(0x111c0)
  3277. #define VIDSTS _MMIO(0x111c8)
  3278. #define VIDSTART _MMIO(0x111cc) /* 8 bits */
  3279. #define MEMSTAT_ILK _MMIO(0x111f8)
  3280. #define MEMSTAT_VID_MASK 0x7f00
  3281. #define MEMSTAT_VID_SHIFT 8
  3282. #define MEMSTAT_PSTATE_MASK 0x00f8
  3283. #define MEMSTAT_PSTATE_SHIFT 3
  3284. #define MEMSTAT_MON_ACTV (1<<2)
  3285. #define MEMSTAT_SRC_CTL_MASK 0x0003
  3286. #define MEMSTAT_SRC_CTL_CORE 0
  3287. #define MEMSTAT_SRC_CTL_TRB 1
  3288. #define MEMSTAT_SRC_CTL_THM 2
  3289. #define MEMSTAT_SRC_CTL_STDBY 3
  3290. #define RCPREVBSYTUPAVG _MMIO(0x113b8)
  3291. #define RCPREVBSYTDNAVG _MMIO(0x113bc)
  3292. #define PMMISC _MMIO(0x11214)
  3293. #define MCPPCE_EN (1<<0) /* enable PM_MSG from PCH->MPC */
  3294. #define SDEW _MMIO(0x1124c)
  3295. #define CSIEW0 _MMIO(0x11250)
  3296. #define CSIEW1 _MMIO(0x11254)
  3297. #define CSIEW2 _MMIO(0x11258)
  3298. #define PEW(i) _MMIO(0x1125c + (i) * 4) /* 5 registers */
  3299. #define DEW(i) _MMIO(0x11270 + (i) * 4) /* 3 registers */
  3300. #define MCHAFE _MMIO(0x112c0)
  3301. #define CSIEC _MMIO(0x112e0)
  3302. #define DMIEC _MMIO(0x112e4)
  3303. #define DDREC _MMIO(0x112e8)
  3304. #define PEG0EC _MMIO(0x112ec)
  3305. #define PEG1EC _MMIO(0x112f0)
  3306. #define GFXEC _MMIO(0x112f4)
  3307. #define RPPREVBSYTUPAVG _MMIO(0x113b8)
  3308. #define RPPREVBSYTDNAVG _MMIO(0x113bc)
  3309. #define ECR _MMIO(0x11600)
  3310. #define ECR_GPFE (1<<31)
  3311. #define ECR_IMONE (1<<30)
  3312. #define ECR_CAP_MASK 0x0000001f /* Event range, 0-31 */
  3313. #define OGW0 _MMIO(0x11608)
  3314. #define OGW1 _MMIO(0x1160c)
  3315. #define EG0 _MMIO(0x11610)
  3316. #define EG1 _MMIO(0x11614)
  3317. #define EG2 _MMIO(0x11618)
  3318. #define EG3 _MMIO(0x1161c)
  3319. #define EG4 _MMIO(0x11620)
  3320. #define EG5 _MMIO(0x11624)
  3321. #define EG6 _MMIO(0x11628)
  3322. #define EG7 _MMIO(0x1162c)
  3323. #define PXW(i) _MMIO(0x11664 + (i) * 4) /* 4 registers */
  3324. #define PXWL(i) _MMIO(0x11680 + (i) * 8) /* 8 registers */
  3325. #define LCFUSE02 _MMIO(0x116c0)
  3326. #define LCFUSE_HIV_MASK 0x000000ff
  3327. #define CSIPLL0 _MMIO(0x12c10)
  3328. #define DDRMPLL1 _MMIO(0X12c20)
  3329. #define PEG_BAND_GAP_DATA _MMIO(0x14d68)
  3330. #define GEN6_GT_THREAD_STATUS_REG _MMIO(0x13805c)
  3331. #define GEN6_GT_THREAD_STATUS_CORE_MASK 0x7
  3332. #define GEN6_GT_PERF_STATUS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5948)
  3333. #define BXT_GT_PERF_STATUS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x7070)
  3334. #define GEN6_RP_STATE_LIMITS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5994)
  3335. #define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
  3336. #define BXT_RP_STATE_CAP _MMIO(0x138170)
  3337. /*
  3338. * Make these a multiple of magic 25 to avoid SNB (eg. Dell XPS
  3339. * 8300) freezing up around GPU hangs. Looks as if even
  3340. * scheduling/timer interrupts start misbehaving if the RPS
  3341. * EI/thresholds are "bad", leading to a very sluggish or even
  3342. * frozen machine.
  3343. */
  3344. #define INTERVAL_1_28_US(us) roundup(((us) * 100) >> 7, 25)
  3345. #define INTERVAL_1_33_US(us) (((us) * 3) >> 2)
  3346. #define INTERVAL_0_833_US(us) (((us) * 6) / 5)
  3347. #define GT_INTERVAL_FROM_US(dev_priv, us) (INTEL_GEN(dev_priv) >= 9 ? \
  3348. (IS_GEN9_LP(dev_priv) ? \
  3349. INTERVAL_0_833_US(us) : \
  3350. INTERVAL_1_33_US(us)) : \
  3351. INTERVAL_1_28_US(us))
  3352. #define INTERVAL_1_28_TO_US(interval) (((interval) << 7) / 100)
  3353. #define INTERVAL_1_33_TO_US(interval) (((interval) << 2) / 3)
  3354. #define INTERVAL_0_833_TO_US(interval) (((interval) * 5) / 6)
  3355. #define GT_PM_INTERVAL_TO_US(dev_priv, interval) (INTEL_GEN(dev_priv) >= 9 ? \
  3356. (IS_GEN9_LP(dev_priv) ? \
  3357. INTERVAL_0_833_TO_US(interval) : \
  3358. INTERVAL_1_33_TO_US(interval)) : \
  3359. INTERVAL_1_28_TO_US(interval))
  3360. /*
  3361. * Logical Context regs
  3362. */
  3363. #define CCID _MMIO(0x2180)
  3364. #define CCID_EN BIT(0)
  3365. #define CCID_EXTENDED_STATE_RESTORE BIT(2)
  3366. #define CCID_EXTENDED_STATE_SAVE BIT(3)
  3367. /*
  3368. * Notes on SNB/IVB/VLV context size:
  3369. * - Power context is saved elsewhere (LLC or stolen)
  3370. * - Ring/execlist context is saved on SNB, not on IVB
  3371. * - Extended context size already includes render context size
  3372. * - We always need to follow the extended context size.
  3373. * SNB BSpec has comments indicating that we should use the
  3374. * render context size instead if execlists are disabled, but
  3375. * based on empirical testing that's just nonsense.
  3376. * - Pipelined/VF state is saved on SNB/IVB respectively
  3377. * - GT1 size just indicates how much of render context
  3378. * doesn't need saving on GT1
  3379. */
  3380. #define CXT_SIZE _MMIO(0x21a0)
  3381. #define GEN6_CXT_POWER_SIZE(cxt_reg) (((cxt_reg) >> 24) & 0x3f)
  3382. #define GEN6_CXT_RING_SIZE(cxt_reg) (((cxt_reg) >> 18) & 0x3f)
  3383. #define GEN6_CXT_RENDER_SIZE(cxt_reg) (((cxt_reg) >> 12) & 0x3f)
  3384. #define GEN6_CXT_EXTENDED_SIZE(cxt_reg) (((cxt_reg) >> 6) & 0x3f)
  3385. #define GEN6_CXT_PIPELINE_SIZE(cxt_reg) (((cxt_reg) >> 0) & 0x3f)
  3386. #define GEN6_CXT_TOTAL_SIZE(cxt_reg) (GEN6_CXT_RING_SIZE(cxt_reg) + \
  3387. GEN6_CXT_EXTENDED_SIZE(cxt_reg) + \
  3388. GEN6_CXT_PIPELINE_SIZE(cxt_reg))
  3389. #define GEN7_CXT_SIZE _MMIO(0x21a8)
  3390. #define GEN7_CXT_POWER_SIZE(ctx_reg) (((ctx_reg) >> 25) & 0x7f)
  3391. #define GEN7_CXT_RING_SIZE(ctx_reg) (((ctx_reg) >> 22) & 0x7)
  3392. #define GEN7_CXT_RENDER_SIZE(ctx_reg) (((ctx_reg) >> 16) & 0x3f)
  3393. #define GEN7_CXT_EXTENDED_SIZE(ctx_reg) (((ctx_reg) >> 9) & 0x7f)
  3394. #define GEN7_CXT_GT1_SIZE(ctx_reg) (((ctx_reg) >> 6) & 0x7)
  3395. #define GEN7_CXT_VFSTATE_SIZE(ctx_reg) (((ctx_reg) >> 0) & 0x3f)
  3396. #define GEN7_CXT_TOTAL_SIZE(ctx_reg) (GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \
  3397. GEN7_CXT_VFSTATE_SIZE(ctx_reg))
  3398. enum {
  3399. INTEL_ADVANCED_CONTEXT = 0,
  3400. INTEL_LEGACY_32B_CONTEXT,
  3401. INTEL_ADVANCED_AD_CONTEXT,
  3402. INTEL_LEGACY_64B_CONTEXT
  3403. };
  3404. enum {
  3405. FAULT_AND_HANG = 0,
  3406. FAULT_AND_HALT, /* Debug only */
  3407. FAULT_AND_STREAM,
  3408. FAULT_AND_CONTINUE /* Unsupported */
  3409. };
  3410. #define GEN8_CTX_VALID (1<<0)
  3411. #define GEN8_CTX_FORCE_PD_RESTORE (1<<1)
  3412. #define GEN8_CTX_FORCE_RESTORE (1<<2)
  3413. #define GEN8_CTX_L3LLC_COHERENT (1<<5)
  3414. #define GEN8_CTX_PRIVILEGE (1<<8)
  3415. #define GEN8_CTX_ADDRESSING_MODE_SHIFT 3
  3416. #define GEN8_CTX_ID_SHIFT 32
  3417. #define GEN8_CTX_ID_WIDTH 21
  3418. #define GEN11_SW_CTX_ID_SHIFT 37
  3419. #define GEN11_SW_CTX_ID_WIDTH 11
  3420. #define GEN11_ENGINE_CLASS_SHIFT 61
  3421. #define GEN11_ENGINE_CLASS_WIDTH 3
  3422. #define GEN11_ENGINE_INSTANCE_SHIFT 48
  3423. #define GEN11_ENGINE_INSTANCE_WIDTH 6
  3424. #define CHV_CLK_CTL1 _MMIO(0x101100)
  3425. #define VLV_CLK_CTL2 _MMIO(0x101104)
  3426. #define CLK_CTL2_CZCOUNT_30NS_SHIFT 28
  3427. /*
  3428. * Overlay regs
  3429. */
  3430. #define OVADD _MMIO(0x30000)
  3431. #define DOVSTA _MMIO(0x30008)
  3432. #define OC_BUF (0x3<<20)
  3433. #define OGAMC5 _MMIO(0x30010)
  3434. #define OGAMC4 _MMIO(0x30014)
  3435. #define OGAMC3 _MMIO(0x30018)
  3436. #define OGAMC2 _MMIO(0x3001c)
  3437. #define OGAMC1 _MMIO(0x30020)
  3438. #define OGAMC0 _MMIO(0x30024)
  3439. /*
  3440. * GEN9 clock gating regs
  3441. */
  3442. #define GEN9_CLKGATE_DIS_0 _MMIO(0x46530)
  3443. #define DARBF_GATING_DIS (1 << 27)
  3444. #define PWM2_GATING_DIS (1 << 14)
  3445. #define PWM1_GATING_DIS (1 << 13)
  3446. #define GEN9_CLKGATE_DIS_4 _MMIO(0x4653C)
  3447. #define BXT_GMBUS_GATING_DIS (1 << 14)
  3448. #define _CLKGATE_DIS_PSL_A 0x46520
  3449. #define _CLKGATE_DIS_PSL_B 0x46524
  3450. #define _CLKGATE_DIS_PSL_C 0x46528
  3451. #define DUPS1_GATING_DIS (1 << 15)
  3452. #define DUPS2_GATING_DIS (1 << 19)
  3453. #define DUPS3_GATING_DIS (1 << 23)
  3454. #define DPF_GATING_DIS (1 << 10)
  3455. #define DPF_RAM_GATING_DIS (1 << 9)
  3456. #define DPFR_GATING_DIS (1 << 8)
  3457. #define CLKGATE_DIS_PSL(pipe) \
  3458. _MMIO_PIPE(pipe, _CLKGATE_DIS_PSL_A, _CLKGATE_DIS_PSL_B)
  3459. /*
  3460. * GEN10 clock gating regs
  3461. */
  3462. #define SLICE_UNIT_LEVEL_CLKGATE _MMIO(0x94d4)
  3463. #define SARBUNIT_CLKGATE_DIS (1 << 5)
  3464. #define RCCUNIT_CLKGATE_DIS (1 << 7)
  3465. #define MSCUNIT_CLKGATE_DIS (1 << 10)
  3466. #define SUBSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9524)
  3467. #define GWUNIT_CLKGATE_DIS (1 << 16)
  3468. #define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434)
  3469. #define VFUNIT_CLKGATE_DIS (1 << 20)
  3470. #define INF_UNIT_LEVEL_CLKGATE _MMIO(0x9560)
  3471. #define CGPSF_CLKGATE_DIS (1 << 3)
  3472. /*
  3473. * Display engine regs
  3474. */
  3475. /* Pipe A CRC regs */
  3476. #define _PIPE_CRC_CTL_A 0x60050
  3477. #define PIPE_CRC_ENABLE (1 << 31)
  3478. /* ivb+ source selection */
  3479. #define PIPE_CRC_SOURCE_PRIMARY_IVB (0 << 29)
  3480. #define PIPE_CRC_SOURCE_SPRITE_IVB (1 << 29)
  3481. #define PIPE_CRC_SOURCE_PF_IVB (2 << 29)
  3482. /* ilk+ source selection */
  3483. #define PIPE_CRC_SOURCE_PRIMARY_ILK (0 << 28)
  3484. #define PIPE_CRC_SOURCE_SPRITE_ILK (1 << 28)
  3485. #define PIPE_CRC_SOURCE_PIPE_ILK (2 << 28)
  3486. /* embedded DP port on the north display block, reserved on ivb */
  3487. #define PIPE_CRC_SOURCE_PORT_A_ILK (4 << 28)
  3488. #define PIPE_CRC_SOURCE_FDI_ILK (5 << 28) /* reserved on ivb */
  3489. /* vlv source selection */
  3490. #define PIPE_CRC_SOURCE_PIPE_VLV (0 << 27)
  3491. #define PIPE_CRC_SOURCE_HDMIB_VLV (1 << 27)
  3492. #define PIPE_CRC_SOURCE_HDMIC_VLV (2 << 27)
  3493. /* with DP port the pipe source is invalid */
  3494. #define PIPE_CRC_SOURCE_DP_D_VLV (3 << 27)
  3495. #define PIPE_CRC_SOURCE_DP_B_VLV (6 << 27)
  3496. #define PIPE_CRC_SOURCE_DP_C_VLV (7 << 27)
  3497. /* gen3+ source selection */
  3498. #define PIPE_CRC_SOURCE_PIPE_I9XX (0 << 28)
  3499. #define PIPE_CRC_SOURCE_SDVOB_I9XX (1 << 28)
  3500. #define PIPE_CRC_SOURCE_SDVOC_I9XX (2 << 28)
  3501. /* with DP/TV port the pipe source is invalid */
  3502. #define PIPE_CRC_SOURCE_DP_D_G4X (3 << 28)
  3503. #define PIPE_CRC_SOURCE_TV_PRE (4 << 28)
  3504. #define PIPE_CRC_SOURCE_TV_POST (5 << 28)
  3505. #define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28)
  3506. #define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28)
  3507. /* gen2 doesn't have source selection bits */
  3508. #define PIPE_CRC_INCLUDE_BORDER_I8XX (1 << 30)
  3509. #define _PIPE_CRC_RES_1_A_IVB 0x60064
  3510. #define _PIPE_CRC_RES_2_A_IVB 0x60068
  3511. #define _PIPE_CRC_RES_3_A_IVB 0x6006c
  3512. #define _PIPE_CRC_RES_4_A_IVB 0x60070
  3513. #define _PIPE_CRC_RES_5_A_IVB 0x60074
  3514. #define _PIPE_CRC_RES_RED_A 0x60060
  3515. #define _PIPE_CRC_RES_GREEN_A 0x60064
  3516. #define _PIPE_CRC_RES_BLUE_A 0x60068
  3517. #define _PIPE_CRC_RES_RES1_A_I915 0x6006c
  3518. #define _PIPE_CRC_RES_RES2_A_G4X 0x60080
  3519. /* Pipe B CRC regs */
  3520. #define _PIPE_CRC_RES_1_B_IVB 0x61064
  3521. #define _PIPE_CRC_RES_2_B_IVB 0x61068
  3522. #define _PIPE_CRC_RES_3_B_IVB 0x6106c
  3523. #define _PIPE_CRC_RES_4_B_IVB 0x61070
  3524. #define _PIPE_CRC_RES_5_B_IVB 0x61074
  3525. #define PIPE_CRC_CTL(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_CTL_A)
  3526. #define PIPE_CRC_RES_1_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_1_A_IVB)
  3527. #define PIPE_CRC_RES_2_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_2_A_IVB)
  3528. #define PIPE_CRC_RES_3_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_3_A_IVB)
  3529. #define PIPE_CRC_RES_4_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_4_A_IVB)
  3530. #define PIPE_CRC_RES_5_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_5_A_IVB)
  3531. #define PIPE_CRC_RES_RED(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RED_A)
  3532. #define PIPE_CRC_RES_GREEN(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_GREEN_A)
  3533. #define PIPE_CRC_RES_BLUE(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_BLUE_A)
  3534. #define PIPE_CRC_RES_RES1_I915(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES1_A_I915)
  3535. #define PIPE_CRC_RES_RES2_G4X(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES2_A_G4X)
  3536. /* Pipe A timing regs */
  3537. #define _HTOTAL_A 0x60000
  3538. #define _HBLANK_A 0x60004
  3539. #define _HSYNC_A 0x60008
  3540. #define _VTOTAL_A 0x6000c
  3541. #define _VBLANK_A 0x60010
  3542. #define _VSYNC_A 0x60014
  3543. #define _PIPEASRC 0x6001c
  3544. #define _BCLRPAT_A 0x60020
  3545. #define _VSYNCSHIFT_A 0x60028
  3546. #define _PIPE_MULT_A 0x6002c
  3547. /* Pipe B timing regs */
  3548. #define _HTOTAL_B 0x61000
  3549. #define _HBLANK_B 0x61004
  3550. #define _HSYNC_B 0x61008
  3551. #define _VTOTAL_B 0x6100c
  3552. #define _VBLANK_B 0x61010
  3553. #define _VSYNC_B 0x61014
  3554. #define _PIPEBSRC 0x6101c
  3555. #define _BCLRPAT_B 0x61020
  3556. #define _VSYNCSHIFT_B 0x61028
  3557. #define _PIPE_MULT_B 0x6102c
  3558. #define TRANSCODER_A_OFFSET 0x60000
  3559. #define TRANSCODER_B_OFFSET 0x61000
  3560. #define TRANSCODER_C_OFFSET 0x62000
  3561. #define CHV_TRANSCODER_C_OFFSET 0x63000
  3562. #define TRANSCODER_EDP_OFFSET 0x6f000
  3563. #define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
  3564. dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
  3565. dev_priv->info.display_mmio_offset)
  3566. #define HTOTAL(trans) _MMIO_TRANS2(trans, _HTOTAL_A)
  3567. #define HBLANK(trans) _MMIO_TRANS2(trans, _HBLANK_A)
  3568. #define HSYNC(trans) _MMIO_TRANS2(trans, _HSYNC_A)
  3569. #define VTOTAL(trans) _MMIO_TRANS2(trans, _VTOTAL_A)
  3570. #define VBLANK(trans) _MMIO_TRANS2(trans, _VBLANK_A)
  3571. #define VSYNC(trans) _MMIO_TRANS2(trans, _VSYNC_A)
  3572. #define BCLRPAT(trans) _MMIO_TRANS2(trans, _BCLRPAT_A)
  3573. #define VSYNCSHIFT(trans) _MMIO_TRANS2(trans, _VSYNCSHIFT_A)
  3574. #define PIPESRC(trans) _MMIO_TRANS2(trans, _PIPEASRC)
  3575. #define PIPE_MULT(trans) _MMIO_TRANS2(trans, _PIPE_MULT_A)
  3576. /* VLV eDP PSR registers */
  3577. #define _PSRCTLA (VLV_DISPLAY_BASE + 0x60090)
  3578. #define _PSRCTLB (VLV_DISPLAY_BASE + 0x61090)
  3579. #define VLV_EDP_PSR_ENABLE (1<<0)
  3580. #define VLV_EDP_PSR_RESET (1<<1)
  3581. #define VLV_EDP_PSR_MODE_MASK (7<<2)
  3582. #define VLV_EDP_PSR_MODE_HW_TIMER (1<<3)
  3583. #define VLV_EDP_PSR_MODE_SW_TIMER (1<<2)
  3584. #define VLV_EDP_PSR_SINGLE_FRAME_UPDATE (1<<7)
  3585. #define VLV_EDP_PSR_ACTIVE_ENTRY (1<<8)
  3586. #define VLV_EDP_PSR_SRC_TRANSMITTER_STATE (1<<9)
  3587. #define VLV_EDP_PSR_DBL_FRAME (1<<10)
  3588. #define VLV_EDP_PSR_FRAME_COUNT_MASK (0xff<<16)
  3589. #define VLV_EDP_PSR_IDLE_FRAME_SHIFT 16
  3590. #define VLV_PSRCTL(pipe) _MMIO_PIPE(pipe, _PSRCTLA, _PSRCTLB)
  3591. #define _VSCSDPA (VLV_DISPLAY_BASE + 0x600a0)
  3592. #define _VSCSDPB (VLV_DISPLAY_BASE + 0x610a0)
  3593. #define VLV_EDP_PSR_SDP_FREQ_MASK (3<<30)
  3594. #define VLV_EDP_PSR_SDP_FREQ_ONCE (1<<31)
  3595. #define VLV_EDP_PSR_SDP_FREQ_EVFRAME (1<<30)
  3596. #define VLV_VSCSDP(pipe) _MMIO_PIPE(pipe, _VSCSDPA, _VSCSDPB)
  3597. #define _PSRSTATA (VLV_DISPLAY_BASE + 0x60094)
  3598. #define _PSRSTATB (VLV_DISPLAY_BASE + 0x61094)
  3599. #define VLV_EDP_PSR_LAST_STATE_MASK (7<<3)
  3600. #define VLV_EDP_PSR_CURR_STATE_MASK 7
  3601. #define VLV_EDP_PSR_DISABLED (0<<0)
  3602. #define VLV_EDP_PSR_INACTIVE (1<<0)
  3603. #define VLV_EDP_PSR_IN_TRANS_TO_ACTIVE (2<<0)
  3604. #define VLV_EDP_PSR_ACTIVE_NORFB_UP (3<<0)
  3605. #define VLV_EDP_PSR_ACTIVE_SF_UPDATE (4<<0)
  3606. #define VLV_EDP_PSR_EXIT (5<<0)
  3607. #define VLV_EDP_PSR_IN_TRANS (1<<7)
  3608. #define VLV_PSRSTAT(pipe) _MMIO_PIPE(pipe, _PSRSTATA, _PSRSTATB)
  3609. /* HSW+ eDP PSR registers */
  3610. #define HSW_EDP_PSR_BASE 0x64800
  3611. #define BDW_EDP_PSR_BASE 0x6f800
  3612. #define EDP_PSR_CTL _MMIO(dev_priv->psr_mmio_base + 0)
  3613. #define EDP_PSR_ENABLE (1<<31)
  3614. #define BDW_PSR_SINGLE_FRAME (1<<30)
  3615. #define EDP_PSR_RESTORE_PSR_ACTIVE_CTX_MASK (1<<29) /* SW can't modify */
  3616. #define EDP_PSR_LINK_STANDBY (1<<27)
  3617. #define EDP_PSR_MIN_LINK_ENTRY_TIME_MASK (3<<25)
  3618. #define EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES (0<<25)
  3619. #define EDP_PSR_MIN_LINK_ENTRY_TIME_4_LINES (1<<25)
  3620. #define EDP_PSR_MIN_LINK_ENTRY_TIME_2_LINES (2<<25)
  3621. #define EDP_PSR_MIN_LINK_ENTRY_TIME_0_LINES (3<<25)
  3622. #define EDP_PSR_MAX_SLEEP_TIME_SHIFT 20
  3623. #define EDP_PSR_SKIP_AUX_EXIT (1<<12)
  3624. #define EDP_PSR_TP1_TP2_SEL (0<<11)
  3625. #define EDP_PSR_TP1_TP3_SEL (1<<11)
  3626. #define EDP_PSR_TP2_TP3_TIME_500us (0<<8)
  3627. #define EDP_PSR_TP2_TP3_TIME_100us (1<<8)
  3628. #define EDP_PSR_TP2_TP3_TIME_2500us (2<<8)
  3629. #define EDP_PSR_TP2_TP3_TIME_0us (3<<8)
  3630. #define EDP_PSR_TP1_TIME_500us (0<<4)
  3631. #define EDP_PSR_TP1_TIME_100us (1<<4)
  3632. #define EDP_PSR_TP1_TIME_2500us (2<<4)
  3633. #define EDP_PSR_TP1_TIME_0us (3<<4)
  3634. #define EDP_PSR_IDLE_FRAME_SHIFT 0
  3635. /* Bspec claims those aren't shifted but stay at 0x64800 */
  3636. #define EDP_PSR_IMR _MMIO(0x64834)
  3637. #define EDP_PSR_IIR _MMIO(0x64838)
  3638. #define EDP_PSR_ERROR(trans) (1 << (((trans) * 8 + 10) & 31))
  3639. #define EDP_PSR_POST_EXIT(trans) (1 << (((trans) * 8 + 9) & 31))
  3640. #define EDP_PSR_PRE_ENTRY(trans) (1 << (((trans) * 8 + 8) & 31))
  3641. #define EDP_PSR_AUX_CTL _MMIO(dev_priv->psr_mmio_base + 0x10)
  3642. #define EDP_PSR_AUX_CTL_TIME_OUT_MASK (3 << 26)
  3643. #define EDP_PSR_AUX_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
  3644. #define EDP_PSR_AUX_CTL_PRECHARGE_2US_MASK (0xf << 16)
  3645. #define EDP_PSR_AUX_CTL_ERROR_INTERRUPT (1 << 11)
  3646. #define EDP_PSR_AUX_CTL_BIT_CLOCK_2X_MASK (0x7ff)
  3647. #define EDP_PSR_AUX_DATA(i) _MMIO(dev_priv->psr_mmio_base + 0x14 + (i) * 4) /* 5 registers */
  3648. #define EDP_PSR_STATUS _MMIO(dev_priv->psr_mmio_base + 0x40)
  3649. #define EDP_PSR_STATUS_STATE_MASK (7<<29)
  3650. #define EDP_PSR_STATUS_STATE_IDLE (0<<29)
  3651. #define EDP_PSR_STATUS_STATE_SRDONACK (1<<29)
  3652. #define EDP_PSR_STATUS_STATE_SRDENT (2<<29)
  3653. #define EDP_PSR_STATUS_STATE_BUFOFF (3<<29)
  3654. #define EDP_PSR_STATUS_STATE_BUFON (4<<29)
  3655. #define EDP_PSR_STATUS_STATE_AUXACK (5<<29)
  3656. #define EDP_PSR_STATUS_STATE_SRDOFFACK (6<<29)
  3657. #define EDP_PSR_STATUS_LINK_MASK (3<<26)
  3658. #define EDP_PSR_STATUS_LINK_FULL_OFF (0<<26)
  3659. #define EDP_PSR_STATUS_LINK_FULL_ON (1<<26)
  3660. #define EDP_PSR_STATUS_LINK_STANDBY (2<<26)
  3661. #define EDP_PSR_STATUS_MAX_SLEEP_TIMER_SHIFT 20
  3662. #define EDP_PSR_STATUS_MAX_SLEEP_TIMER_MASK 0x1f
  3663. #define EDP_PSR_STATUS_COUNT_SHIFT 16
  3664. #define EDP_PSR_STATUS_COUNT_MASK 0xf
  3665. #define EDP_PSR_STATUS_AUX_ERROR (1<<15)
  3666. #define EDP_PSR_STATUS_AUX_SENDING (1<<12)
  3667. #define EDP_PSR_STATUS_SENDING_IDLE (1<<9)
  3668. #define EDP_PSR_STATUS_SENDING_TP2_TP3 (1<<8)
  3669. #define EDP_PSR_STATUS_SENDING_TP1 (1<<4)
  3670. #define EDP_PSR_STATUS_IDLE_MASK 0xf
  3671. #define EDP_PSR_PERF_CNT _MMIO(dev_priv->psr_mmio_base + 0x44)
  3672. #define EDP_PSR_PERF_CNT_MASK 0xffffff
  3673. #define EDP_PSR_DEBUG _MMIO(dev_priv->psr_mmio_base + 0x60) /* PSR_MASK on SKL+ */
  3674. #define EDP_PSR_DEBUG_MASK_MAX_SLEEP (1<<28)
  3675. #define EDP_PSR_DEBUG_MASK_LPSP (1<<27)
  3676. #define EDP_PSR_DEBUG_MASK_MEMUP (1<<26)
  3677. #define EDP_PSR_DEBUG_MASK_HPD (1<<25)
  3678. #define EDP_PSR_DEBUG_MASK_DISP_REG_WRITE (1<<16)
  3679. #define EDP_PSR_DEBUG_EXIT_ON_PIXEL_UNDERRUN (1<<15) /* SKL+ */
  3680. #define EDP_PSR2_CTL _MMIO(0x6f900)
  3681. #define EDP_PSR2_ENABLE (1<<31)
  3682. #define EDP_SU_TRACK_ENABLE (1<<30)
  3683. #define EDP_Y_COORDINATE_VALID (1<<26) /* GLK and CNL+ */
  3684. #define EDP_Y_COORDINATE_ENABLE (1<<25) /* GLK and CNL+ */
  3685. #define EDP_MAX_SU_DISABLE_TIME(t) ((t)<<20)
  3686. #define EDP_MAX_SU_DISABLE_TIME_MASK (0x1f<<20)
  3687. #define EDP_PSR2_TP2_TIME_500 (0<<8)
  3688. #define EDP_PSR2_TP2_TIME_100 (1<<8)
  3689. #define EDP_PSR2_TP2_TIME_2500 (2<<8)
  3690. #define EDP_PSR2_TP2_TIME_50 (3<<8)
  3691. #define EDP_PSR2_TP2_TIME_MASK (3<<8)
  3692. #define EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  3693. #define EDP_PSR2_FRAME_BEFORE_SU_MASK (0xf<<4)
  3694. #define EDP_PSR2_FRAME_BEFORE_SU(a) ((a)<<4)
  3695. #define EDP_PSR2_IDLE_FRAME_MASK 0xf
  3696. #define EDP_PSR2_IDLE_FRAME_SHIFT 0
  3697. #define _PSR_EVENT_TRANS_A 0x60848
  3698. #define _PSR_EVENT_TRANS_B 0x61848
  3699. #define _PSR_EVENT_TRANS_C 0x62848
  3700. #define _PSR_EVENT_TRANS_D 0x63848
  3701. #define _PSR_EVENT_TRANS_EDP 0x6F848
  3702. #define PSR_EVENT(trans) _MMIO_TRANS2(trans, _PSR_EVENT_TRANS_A)
  3703. #define PSR_EVENT_PSR2_WD_TIMER_EXPIRE (1 << 17)
  3704. #define PSR_EVENT_PSR2_DISABLED (1 << 16)
  3705. #define PSR_EVENT_SU_DIRTY_FIFO_UNDERRUN (1 << 15)
  3706. #define PSR_EVENT_SU_CRC_FIFO_UNDERRUN (1 << 14)
  3707. #define PSR_EVENT_GRAPHICS_RESET (1 << 12)
  3708. #define PSR_EVENT_PCH_INTERRUPT (1 << 11)
  3709. #define PSR_EVENT_MEMORY_UP (1 << 10)
  3710. #define PSR_EVENT_FRONT_BUFFER_MODIFY (1 << 9)
  3711. #define PSR_EVENT_WD_TIMER_EXPIRE (1 << 8)
  3712. #define PSR_EVENT_PIPE_REGISTERS_UPDATE (1 << 6)
  3713. #define PSR_EVENT_REGISTER_UPDATE (1 << 5)
  3714. #define PSR_EVENT_HDCP_ENABLE (1 << 4)
  3715. #define PSR_EVENT_KVMR_SESSION_ENABLE (1 << 3)
  3716. #define PSR_EVENT_VBI_ENABLE (1 << 2)
  3717. #define PSR_EVENT_LPSP_MODE_EXIT (1 << 1)
  3718. #define PSR_EVENT_PSR_DISABLE (1 << 0)
  3719. #define EDP_PSR2_STATUS _MMIO(0x6f940)
  3720. #define EDP_PSR2_STATUS_STATE_MASK (0xf<<28)
  3721. #define EDP_PSR2_STATUS_STATE_SHIFT 28
  3722. /* VGA port control */
  3723. #define ADPA _MMIO(0x61100)
  3724. #define PCH_ADPA _MMIO(0xe1100)
  3725. #define VLV_ADPA _MMIO(VLV_DISPLAY_BASE + 0x61100)
  3726. #define ADPA_DAC_ENABLE (1<<31)
  3727. #define ADPA_DAC_DISABLE 0
  3728. #define ADPA_PIPE_SELECT_MASK (1<<30)
  3729. #define ADPA_PIPE_A_SELECT 0
  3730. #define ADPA_PIPE_B_SELECT (1<<30)
  3731. #define ADPA_PIPE_SELECT(pipe) ((pipe) << 30)
  3732. /* CPT uses bits 29:30 for pch transcoder select */
  3733. #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
  3734. #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24)
  3735. #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24)
  3736. #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24)
  3737. #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24)
  3738. #define ADPA_CRT_HOTPLUG_ENABLE (1<<23)
  3739. #define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22)
  3740. #define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22)
  3741. #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21)
  3742. #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21)
  3743. #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20)
  3744. #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20)
  3745. #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18)
  3746. #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18)
  3747. #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18)
  3748. #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18)
  3749. #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17)
  3750. #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17)
  3751. #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
  3752. #define ADPA_USE_VGA_HVPOLARITY (1<<15)
  3753. #define ADPA_SETS_HVPOLARITY 0
  3754. #define ADPA_VSYNC_CNTL_DISABLE (1<<10)
  3755. #define ADPA_VSYNC_CNTL_ENABLE 0
  3756. #define ADPA_HSYNC_CNTL_DISABLE (1<<11)
  3757. #define ADPA_HSYNC_CNTL_ENABLE 0
  3758. #define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
  3759. #define ADPA_VSYNC_ACTIVE_LOW 0
  3760. #define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
  3761. #define ADPA_HSYNC_ACTIVE_LOW 0
  3762. #define ADPA_DPMS_MASK (~(3<<10))
  3763. #define ADPA_DPMS_ON (0<<10)
  3764. #define ADPA_DPMS_SUSPEND (1<<10)
  3765. #define ADPA_DPMS_STANDBY (2<<10)
  3766. #define ADPA_DPMS_OFF (3<<10)
  3767. /* Hotplug control (945+ only) */
  3768. #define PORT_HOTPLUG_EN _MMIO(dev_priv->info.display_mmio_offset + 0x61110)
  3769. #define PORTB_HOTPLUG_INT_EN (1 << 29)
  3770. #define PORTC_HOTPLUG_INT_EN (1 << 28)
  3771. #define PORTD_HOTPLUG_INT_EN (1 << 27)
  3772. #define SDVOB_HOTPLUG_INT_EN (1 << 26)
  3773. #define SDVOC_HOTPLUG_INT_EN (1 << 25)
  3774. #define TV_HOTPLUG_INT_EN (1 << 18)
  3775. #define CRT_HOTPLUG_INT_EN (1 << 9)
  3776. #define HOTPLUG_INT_EN_MASK (PORTB_HOTPLUG_INT_EN | \
  3777. PORTC_HOTPLUG_INT_EN | \
  3778. PORTD_HOTPLUG_INT_EN | \
  3779. SDVOC_HOTPLUG_INT_EN | \
  3780. SDVOB_HOTPLUG_INT_EN | \
  3781. CRT_HOTPLUG_INT_EN)
  3782. #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
  3783. #define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
  3784. /* must use period 64 on GM45 according to docs */
  3785. #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
  3786. #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
  3787. #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
  3788. #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
  3789. #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
  3790. #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
  3791. #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
  3792. #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
  3793. #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
  3794. #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
  3795. #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
  3796. #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
  3797. #define PORT_HOTPLUG_STAT _MMIO(dev_priv->info.display_mmio_offset + 0x61114)
  3798. /*
  3799. * HDMI/DP bits are g4x+
  3800. *
  3801. * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused.
  3802. * Please check the detailed lore in the commit message for for experimental
  3803. * evidence.
  3804. */
  3805. /* Bspec says GM45 should match G4X/VLV/CHV, but reality disagrees */
  3806. #define PORTD_HOTPLUG_LIVE_STATUS_GM45 (1 << 29)
  3807. #define PORTC_HOTPLUG_LIVE_STATUS_GM45 (1 << 28)
  3808. #define PORTB_HOTPLUG_LIVE_STATUS_GM45 (1 << 27)
  3809. /* G4X/VLV/CHV DP/HDMI bits again match Bspec */
  3810. #define PORTD_HOTPLUG_LIVE_STATUS_G4X (1 << 27)
  3811. #define PORTC_HOTPLUG_LIVE_STATUS_G4X (1 << 28)
  3812. #define PORTB_HOTPLUG_LIVE_STATUS_G4X (1 << 29)
  3813. #define PORTD_HOTPLUG_INT_STATUS (3 << 21)
  3814. #define PORTD_HOTPLUG_INT_LONG_PULSE (2 << 21)
  3815. #define PORTD_HOTPLUG_INT_SHORT_PULSE (1 << 21)
  3816. #define PORTC_HOTPLUG_INT_STATUS (3 << 19)
  3817. #define PORTC_HOTPLUG_INT_LONG_PULSE (2 << 19)
  3818. #define PORTC_HOTPLUG_INT_SHORT_PULSE (1 << 19)
  3819. #define PORTB_HOTPLUG_INT_STATUS (3 << 17)
  3820. #define PORTB_HOTPLUG_INT_LONG_PULSE (2 << 17)
  3821. #define PORTB_HOTPLUG_INT_SHORT_PLUSE (1 << 17)
  3822. /* CRT/TV common between gen3+ */
  3823. #define CRT_HOTPLUG_INT_STATUS (1 << 11)
  3824. #define TV_HOTPLUG_INT_STATUS (1 << 10)
  3825. #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
  3826. #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
  3827. #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
  3828. #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
  3829. #define DP_AUX_CHANNEL_D_INT_STATUS_G4X (1 << 6)
  3830. #define DP_AUX_CHANNEL_C_INT_STATUS_G4X (1 << 5)
  3831. #define DP_AUX_CHANNEL_B_INT_STATUS_G4X (1 << 4)
  3832. #define DP_AUX_CHANNEL_MASK_INT_STATUS_G4X (7 << 4)
  3833. /* SDVO is different across gen3/4 */
  3834. #define SDVOC_HOTPLUG_INT_STATUS_G4X (1 << 3)
  3835. #define SDVOB_HOTPLUG_INT_STATUS_G4X (1 << 2)
  3836. /*
  3837. * Bspec seems to be seriously misleaded about the SDVO hpd bits on i965g/gm,
  3838. * since reality corrobates that they're the same as on gen3. But keep these
  3839. * bits here (and the comment!) to help any other lost wanderers back onto the
  3840. * right tracks.
  3841. */
  3842. #define SDVOC_HOTPLUG_INT_STATUS_I965 (3 << 4)
  3843. #define SDVOB_HOTPLUG_INT_STATUS_I965 (3 << 2)
  3844. #define SDVOC_HOTPLUG_INT_STATUS_I915 (1 << 7)
  3845. #define SDVOB_HOTPLUG_INT_STATUS_I915 (1 << 6)
  3846. #define HOTPLUG_INT_STATUS_G4X (CRT_HOTPLUG_INT_STATUS | \
  3847. SDVOB_HOTPLUG_INT_STATUS_G4X | \
  3848. SDVOC_HOTPLUG_INT_STATUS_G4X | \
  3849. PORTB_HOTPLUG_INT_STATUS | \
  3850. PORTC_HOTPLUG_INT_STATUS | \
  3851. PORTD_HOTPLUG_INT_STATUS)
  3852. #define HOTPLUG_INT_STATUS_I915 (CRT_HOTPLUG_INT_STATUS | \
  3853. SDVOB_HOTPLUG_INT_STATUS_I915 | \
  3854. SDVOC_HOTPLUG_INT_STATUS_I915 | \
  3855. PORTB_HOTPLUG_INT_STATUS | \
  3856. PORTC_HOTPLUG_INT_STATUS | \
  3857. PORTD_HOTPLUG_INT_STATUS)
  3858. /* SDVO and HDMI port control.
  3859. * The same register may be used for SDVO or HDMI */
  3860. #define _GEN3_SDVOB 0x61140
  3861. #define _GEN3_SDVOC 0x61160
  3862. #define GEN3_SDVOB _MMIO(_GEN3_SDVOB)
  3863. #define GEN3_SDVOC _MMIO(_GEN3_SDVOC)
  3864. #define GEN4_HDMIB GEN3_SDVOB
  3865. #define GEN4_HDMIC GEN3_SDVOC
  3866. #define VLV_HDMIB _MMIO(VLV_DISPLAY_BASE + 0x61140)
  3867. #define VLV_HDMIC _MMIO(VLV_DISPLAY_BASE + 0x61160)
  3868. #define CHV_HDMID _MMIO(VLV_DISPLAY_BASE + 0x6116C)
  3869. #define PCH_SDVOB _MMIO(0xe1140)
  3870. #define PCH_HDMIB PCH_SDVOB
  3871. #define PCH_HDMIC _MMIO(0xe1150)
  3872. #define PCH_HDMID _MMIO(0xe1160)
  3873. #define PORT_DFT_I9XX _MMIO(0x61150)
  3874. #define DC_BALANCE_RESET (1 << 25)
  3875. #define PORT_DFT2_G4X _MMIO(dev_priv->info.display_mmio_offset + 0x61154)
  3876. #define DC_BALANCE_RESET_VLV (1 << 31)
  3877. #define PIPE_SCRAMBLE_RESET_MASK ((1 << 14) | (0x3 << 0))
  3878. #define PIPE_C_SCRAMBLE_RESET (1 << 14) /* chv */
  3879. #define PIPE_B_SCRAMBLE_RESET (1 << 1)
  3880. #define PIPE_A_SCRAMBLE_RESET (1 << 0)
  3881. /* Gen 3 SDVO bits: */
  3882. #define SDVO_ENABLE (1 << 31)
  3883. #define SDVO_PIPE_SEL(pipe) ((pipe) << 30)
  3884. #define SDVO_PIPE_SEL_MASK (1 << 30)
  3885. #define SDVO_PIPE_B_SELECT (1 << 30)
  3886. #define SDVO_STALL_SELECT (1 << 29)
  3887. #define SDVO_INTERRUPT_ENABLE (1 << 26)
  3888. /*
  3889. * 915G/GM SDVO pixel multiplier.
  3890. * Programmed value is multiplier - 1, up to 5x.
  3891. * \sa DPLL_MD_UDI_MULTIPLIER_MASK
  3892. */
  3893. #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
  3894. #define SDVO_PORT_MULTIPLY_SHIFT 23
  3895. #define SDVO_PHASE_SELECT_MASK (15 << 19)
  3896. #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
  3897. #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
  3898. #define SDVOC_GANG_MODE (1 << 16) /* Port C only */
  3899. #define SDVO_BORDER_ENABLE (1 << 7) /* SDVO only */
  3900. #define SDVOB_PCIE_CONCURRENCY (1 << 3) /* Port B only */
  3901. #define SDVO_DETECTED (1 << 2)
  3902. /* Bits to be preserved when writing */
  3903. #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | \
  3904. SDVO_INTERRUPT_ENABLE)
  3905. #define SDVOC_PRESERVE_MASK ((1 << 17) | SDVO_INTERRUPT_ENABLE)
  3906. /* Gen 4 SDVO/HDMI bits: */
  3907. #define SDVO_COLOR_FORMAT_8bpc (0 << 26)
  3908. #define SDVO_COLOR_FORMAT_MASK (7 << 26)
  3909. #define SDVO_ENCODING_SDVO (0 << 10)
  3910. #define SDVO_ENCODING_HDMI (2 << 10)
  3911. #define HDMI_MODE_SELECT_HDMI (1 << 9) /* HDMI only */
  3912. #define HDMI_MODE_SELECT_DVI (0 << 9) /* HDMI only */
  3913. #define HDMI_COLOR_RANGE_16_235 (1 << 8) /* HDMI only */
  3914. #define SDVO_AUDIO_ENABLE (1 << 6)
  3915. /* VSYNC/HSYNC bits new with 965, default is to be set */
  3916. #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
  3917. #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
  3918. /* Gen 5 (IBX) SDVO/HDMI bits: */
  3919. #define HDMI_COLOR_FORMAT_12bpc (3 << 26) /* HDMI only */
  3920. #define SDVOB_HOTPLUG_ENABLE (1 << 23) /* SDVO only */
  3921. /* Gen 6 (CPT) SDVO/HDMI bits: */
  3922. #define SDVO_PIPE_SEL_CPT(pipe) ((pipe) << 29)
  3923. #define SDVO_PIPE_SEL_MASK_CPT (3 << 29)
  3924. /* CHV SDVO/HDMI bits: */
  3925. #define SDVO_PIPE_SEL_CHV(pipe) ((pipe) << 24)
  3926. #define SDVO_PIPE_SEL_MASK_CHV (3 << 24)
  3927. /* DVO port control */
  3928. #define _DVOA 0x61120
  3929. #define DVOA _MMIO(_DVOA)
  3930. #define _DVOB 0x61140
  3931. #define DVOB _MMIO(_DVOB)
  3932. #define _DVOC 0x61160
  3933. #define DVOC _MMIO(_DVOC)
  3934. #define DVO_ENABLE (1 << 31)
  3935. #define DVO_PIPE_B_SELECT (1 << 30)
  3936. #define DVO_PIPE_STALL_UNUSED (0 << 28)
  3937. #define DVO_PIPE_STALL (1 << 28)
  3938. #define DVO_PIPE_STALL_TV (2 << 28)
  3939. #define DVO_PIPE_STALL_MASK (3 << 28)
  3940. #define DVO_USE_VGA_SYNC (1 << 15)
  3941. #define DVO_DATA_ORDER_I740 (0 << 14)
  3942. #define DVO_DATA_ORDER_FP (1 << 14)
  3943. #define DVO_VSYNC_DISABLE (1 << 11)
  3944. #define DVO_HSYNC_DISABLE (1 << 10)
  3945. #define DVO_VSYNC_TRISTATE (1 << 9)
  3946. #define DVO_HSYNC_TRISTATE (1 << 8)
  3947. #define DVO_BORDER_ENABLE (1 << 7)
  3948. #define DVO_DATA_ORDER_GBRG (1 << 6)
  3949. #define DVO_DATA_ORDER_RGGB (0 << 6)
  3950. #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
  3951. #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
  3952. #define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
  3953. #define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
  3954. #define DVO_BLANK_ACTIVE_HIGH (1 << 2)
  3955. #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
  3956. #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
  3957. #define DVO_PRESERVE_MASK (0x7<<24)
  3958. #define DVOA_SRCDIM _MMIO(0x61124)
  3959. #define DVOB_SRCDIM _MMIO(0x61144)
  3960. #define DVOC_SRCDIM _MMIO(0x61164)
  3961. #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
  3962. #define DVO_SRCDIM_VERTICAL_SHIFT 0
  3963. /* LVDS port control */
  3964. #define LVDS _MMIO(0x61180)
  3965. /*
  3966. * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
  3967. * the DPLL semantics change when the LVDS is assigned to that pipe.
  3968. */
  3969. #define LVDS_PORT_EN (1 << 31)
  3970. /* Selects pipe B for LVDS data. Must be set on pre-965. */
  3971. #define LVDS_PIPEB_SELECT (1 << 30)
  3972. #define LVDS_PIPE_MASK (1 << 30)
  3973. #define LVDS_PIPE(pipe) ((pipe) << 30)
  3974. /* LVDS dithering flag on 965/g4x platform */
  3975. #define LVDS_ENABLE_DITHER (1 << 25)
  3976. /* LVDS sync polarity flags. Set to invert (i.e. negative) */
  3977. #define LVDS_VSYNC_POLARITY (1 << 21)
  3978. #define LVDS_HSYNC_POLARITY (1 << 20)
  3979. /* Enable border for unscaled (or aspect-scaled) display */
  3980. #define LVDS_BORDER_ENABLE (1 << 15)
  3981. /*
  3982. * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
  3983. * pixel.
  3984. */
  3985. #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
  3986. #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
  3987. #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
  3988. /*
  3989. * Controls the A3 data pair, which contains the additional LSBs for 24 bit
  3990. * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
  3991. * on.
  3992. */
  3993. #define LVDS_A3_POWER_MASK (3 << 6)
  3994. #define LVDS_A3_POWER_DOWN (0 << 6)
  3995. #define LVDS_A3_POWER_UP (3 << 6)
  3996. /*
  3997. * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
  3998. * is set.
  3999. */
  4000. #define LVDS_CLKB_POWER_MASK (3 << 4)
  4001. #define LVDS_CLKB_POWER_DOWN (0 << 4)
  4002. #define LVDS_CLKB_POWER_UP (3 << 4)
  4003. /*
  4004. * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
  4005. * setting for whether we are in dual-channel mode. The B3 pair will
  4006. * additionally only be powered up when LVDS_A3_POWER_UP is set.
  4007. */
  4008. #define LVDS_B0B3_POWER_MASK (3 << 2)
  4009. #define LVDS_B0B3_POWER_DOWN (0 << 2)
  4010. #define LVDS_B0B3_POWER_UP (3 << 2)
  4011. /* Video Data Island Packet control */
  4012. #define VIDEO_DIP_DATA _MMIO(0x61178)
  4013. /* Read the description of VIDEO_DIP_DATA (before Haswell) or VIDEO_DIP_ECC
  4014. * (Haswell and newer) to see which VIDEO_DIP_DATA byte corresponds to each byte
  4015. * of the infoframe structure specified by CEA-861. */
  4016. #define VIDEO_DIP_DATA_SIZE 32
  4017. #define VIDEO_DIP_VSC_DATA_SIZE 36
  4018. #define VIDEO_DIP_CTL _MMIO(0x61170)
  4019. /* Pre HSW: */
  4020. #define VIDEO_DIP_ENABLE (1 << 31)
  4021. #define VIDEO_DIP_PORT(port) ((port) << 29)
  4022. #define VIDEO_DIP_PORT_MASK (3 << 29)
  4023. #define VIDEO_DIP_ENABLE_GCP (1 << 25)
  4024. #define VIDEO_DIP_ENABLE_AVI (1 << 21)
  4025. #define VIDEO_DIP_ENABLE_VENDOR (2 << 21)
  4026. #define VIDEO_DIP_ENABLE_GAMUT (4 << 21)
  4027. #define VIDEO_DIP_ENABLE_SPD (8 << 21)
  4028. #define VIDEO_DIP_SELECT_AVI (0 << 19)
  4029. #define VIDEO_DIP_SELECT_VENDOR (1 << 19)
  4030. #define VIDEO_DIP_SELECT_SPD (3 << 19)
  4031. #define VIDEO_DIP_SELECT_MASK (3 << 19)
  4032. #define VIDEO_DIP_FREQ_ONCE (0 << 16)
  4033. #define VIDEO_DIP_FREQ_VSYNC (1 << 16)
  4034. #define VIDEO_DIP_FREQ_2VSYNC (2 << 16)
  4035. #define VIDEO_DIP_FREQ_MASK (3 << 16)
  4036. /* HSW and later: */
  4037. #define VIDEO_DIP_ENABLE_VSC_HSW (1 << 20)
  4038. #define VIDEO_DIP_ENABLE_GCP_HSW (1 << 16)
  4039. #define VIDEO_DIP_ENABLE_AVI_HSW (1 << 12)
  4040. #define VIDEO_DIP_ENABLE_VS_HSW (1 << 8)
  4041. #define VIDEO_DIP_ENABLE_GMP_HSW (1 << 4)
  4042. #define VIDEO_DIP_ENABLE_SPD_HSW (1 << 0)
  4043. /* Panel power sequencing */
  4044. #define PPS_BASE 0x61200
  4045. #define VLV_PPS_BASE (VLV_DISPLAY_BASE + PPS_BASE)
  4046. #define PCH_PPS_BASE 0xC7200
  4047. #define _MMIO_PPS(pps_idx, reg) _MMIO(dev_priv->pps_mmio_base - \
  4048. PPS_BASE + (reg) + \
  4049. (pps_idx) * 0x100)
  4050. #define _PP_STATUS 0x61200
  4051. #define PP_STATUS(pps_idx) _MMIO_PPS(pps_idx, _PP_STATUS)
  4052. #define PP_ON (1 << 31)
  4053. /*
  4054. * Indicates that all dependencies of the panel are on:
  4055. *
  4056. * - PLL enabled
  4057. * - pipe enabled
  4058. * - LVDS/DVOB/DVOC on
  4059. */
  4060. #define PP_READY (1 << 30)
  4061. #define PP_SEQUENCE_NONE (0 << 28)
  4062. #define PP_SEQUENCE_POWER_UP (1 << 28)
  4063. #define PP_SEQUENCE_POWER_DOWN (2 << 28)
  4064. #define PP_SEQUENCE_MASK (3 << 28)
  4065. #define PP_SEQUENCE_SHIFT 28
  4066. #define PP_CYCLE_DELAY_ACTIVE (1 << 27)
  4067. #define PP_SEQUENCE_STATE_MASK 0x0000000f
  4068. #define PP_SEQUENCE_STATE_OFF_IDLE (0x0 << 0)
  4069. #define PP_SEQUENCE_STATE_OFF_S0_1 (0x1 << 0)
  4070. #define PP_SEQUENCE_STATE_OFF_S0_2 (0x2 << 0)
  4071. #define PP_SEQUENCE_STATE_OFF_S0_3 (0x3 << 0)
  4072. #define PP_SEQUENCE_STATE_ON_IDLE (0x8 << 0)
  4073. #define PP_SEQUENCE_STATE_ON_S1_0 (0x9 << 0)
  4074. #define PP_SEQUENCE_STATE_ON_S1_2 (0xa << 0)
  4075. #define PP_SEQUENCE_STATE_ON_S1_3 (0xb << 0)
  4076. #define PP_SEQUENCE_STATE_RESET (0xf << 0)
  4077. #define _PP_CONTROL 0x61204
  4078. #define PP_CONTROL(pps_idx) _MMIO_PPS(pps_idx, _PP_CONTROL)
  4079. #define PANEL_UNLOCK_REGS (0xabcd << 16)
  4080. #define PANEL_UNLOCK_MASK (0xffff << 16)
  4081. #define BXT_POWER_CYCLE_DELAY_MASK 0x1f0
  4082. #define BXT_POWER_CYCLE_DELAY_SHIFT 4
  4083. #define EDP_FORCE_VDD (1 << 3)
  4084. #define EDP_BLC_ENABLE (1 << 2)
  4085. #define PANEL_POWER_RESET (1 << 1)
  4086. #define PANEL_POWER_OFF (0 << 0)
  4087. #define PANEL_POWER_ON (1 << 0)
  4088. #define _PP_ON_DELAYS 0x61208
  4089. #define PP_ON_DELAYS(pps_idx) _MMIO_PPS(pps_idx, _PP_ON_DELAYS)
  4090. #define PANEL_PORT_SELECT_SHIFT 30
  4091. #define PANEL_PORT_SELECT_MASK (3 << 30)
  4092. #define PANEL_PORT_SELECT_LVDS (0 << 30)
  4093. #define PANEL_PORT_SELECT_DPA (1 << 30)
  4094. #define PANEL_PORT_SELECT_DPC (2 << 30)
  4095. #define PANEL_PORT_SELECT_DPD (3 << 30)
  4096. #define PANEL_PORT_SELECT_VLV(port) ((port) << 30)
  4097. #define PANEL_POWER_UP_DELAY_MASK 0x1fff0000
  4098. #define PANEL_POWER_UP_DELAY_SHIFT 16
  4099. #define PANEL_LIGHT_ON_DELAY_MASK 0x1fff
  4100. #define PANEL_LIGHT_ON_DELAY_SHIFT 0
  4101. #define _PP_OFF_DELAYS 0x6120C
  4102. #define PP_OFF_DELAYS(pps_idx) _MMIO_PPS(pps_idx, _PP_OFF_DELAYS)
  4103. #define PANEL_POWER_DOWN_DELAY_MASK 0x1fff0000
  4104. #define PANEL_POWER_DOWN_DELAY_SHIFT 16
  4105. #define PANEL_LIGHT_OFF_DELAY_MASK 0x1fff
  4106. #define PANEL_LIGHT_OFF_DELAY_SHIFT 0
  4107. #define _PP_DIVISOR 0x61210
  4108. #define PP_DIVISOR(pps_idx) _MMIO_PPS(pps_idx, _PP_DIVISOR)
  4109. #define PP_REFERENCE_DIVIDER_MASK 0xffffff00
  4110. #define PP_REFERENCE_DIVIDER_SHIFT 8
  4111. #define PANEL_POWER_CYCLE_DELAY_MASK 0x1f
  4112. #define PANEL_POWER_CYCLE_DELAY_SHIFT 0
  4113. /* Panel fitting */
  4114. #define PFIT_CONTROL _MMIO(dev_priv->info.display_mmio_offset + 0x61230)
  4115. #define PFIT_ENABLE (1 << 31)
  4116. #define PFIT_PIPE_MASK (3 << 29)
  4117. #define PFIT_PIPE_SHIFT 29
  4118. #define VERT_INTERP_DISABLE (0 << 10)
  4119. #define VERT_INTERP_BILINEAR (1 << 10)
  4120. #define VERT_INTERP_MASK (3 << 10)
  4121. #define VERT_AUTO_SCALE (1 << 9)
  4122. #define HORIZ_INTERP_DISABLE (0 << 6)
  4123. #define HORIZ_INTERP_BILINEAR (1 << 6)
  4124. #define HORIZ_INTERP_MASK (3 << 6)
  4125. #define HORIZ_AUTO_SCALE (1 << 5)
  4126. #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
  4127. #define PFIT_FILTER_FUZZY (0 << 24)
  4128. #define PFIT_SCALING_AUTO (0 << 26)
  4129. #define PFIT_SCALING_PROGRAMMED (1 << 26)
  4130. #define PFIT_SCALING_PILLAR (2 << 26)
  4131. #define PFIT_SCALING_LETTER (3 << 26)
  4132. #define PFIT_PGM_RATIOS _MMIO(dev_priv->info.display_mmio_offset + 0x61234)
  4133. /* Pre-965 */
  4134. #define PFIT_VERT_SCALE_SHIFT 20
  4135. #define PFIT_VERT_SCALE_MASK 0xfff00000
  4136. #define PFIT_HORIZ_SCALE_SHIFT 4
  4137. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  4138. /* 965+ */
  4139. #define PFIT_VERT_SCALE_SHIFT_965 16
  4140. #define PFIT_VERT_SCALE_MASK_965 0x1fff0000
  4141. #define PFIT_HORIZ_SCALE_SHIFT_965 0
  4142. #define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
  4143. #define PFIT_AUTO_RATIOS _MMIO(dev_priv->info.display_mmio_offset + 0x61238)
  4144. #define _VLV_BLC_PWM_CTL2_A (dev_priv->info.display_mmio_offset + 0x61250)
  4145. #define _VLV_BLC_PWM_CTL2_B (dev_priv->info.display_mmio_offset + 0x61350)
  4146. #define VLV_BLC_PWM_CTL2(pipe) _MMIO_PIPE(pipe, _VLV_BLC_PWM_CTL2_A, \
  4147. _VLV_BLC_PWM_CTL2_B)
  4148. #define _VLV_BLC_PWM_CTL_A (dev_priv->info.display_mmio_offset + 0x61254)
  4149. #define _VLV_BLC_PWM_CTL_B (dev_priv->info.display_mmio_offset + 0x61354)
  4150. #define VLV_BLC_PWM_CTL(pipe) _MMIO_PIPE(pipe, _VLV_BLC_PWM_CTL_A, \
  4151. _VLV_BLC_PWM_CTL_B)
  4152. #define _VLV_BLC_HIST_CTL_A (dev_priv->info.display_mmio_offset + 0x61260)
  4153. #define _VLV_BLC_HIST_CTL_B (dev_priv->info.display_mmio_offset + 0x61360)
  4154. #define VLV_BLC_HIST_CTL(pipe) _MMIO_PIPE(pipe, _VLV_BLC_HIST_CTL_A, \
  4155. _VLV_BLC_HIST_CTL_B)
  4156. /* Backlight control */
  4157. #define BLC_PWM_CTL2 _MMIO(dev_priv->info.display_mmio_offset + 0x61250) /* 965+ only */
  4158. #define BLM_PWM_ENABLE (1 << 31)
  4159. #define BLM_COMBINATION_MODE (1 << 30) /* gen4 only */
  4160. #define BLM_PIPE_SELECT (1 << 29)
  4161. #define BLM_PIPE_SELECT_IVB (3 << 29)
  4162. #define BLM_PIPE_A (0 << 29)
  4163. #define BLM_PIPE_B (1 << 29)
  4164. #define BLM_PIPE_C (2 << 29) /* ivb + */
  4165. #define BLM_TRANSCODER_A BLM_PIPE_A /* hsw */
  4166. #define BLM_TRANSCODER_B BLM_PIPE_B
  4167. #define BLM_TRANSCODER_C BLM_PIPE_C
  4168. #define BLM_TRANSCODER_EDP (3 << 29)
  4169. #define BLM_PIPE(pipe) ((pipe) << 29)
  4170. #define BLM_POLARITY_I965 (1 << 28) /* gen4 only */
  4171. #define BLM_PHASE_IN_INTERUPT_STATUS (1 << 26)
  4172. #define BLM_PHASE_IN_ENABLE (1 << 25)
  4173. #define BLM_PHASE_IN_INTERUPT_ENABL (1 << 24)
  4174. #define BLM_PHASE_IN_TIME_BASE_SHIFT (16)
  4175. #define BLM_PHASE_IN_TIME_BASE_MASK (0xff << 16)
  4176. #define BLM_PHASE_IN_COUNT_SHIFT (8)
  4177. #define BLM_PHASE_IN_COUNT_MASK (0xff << 8)
  4178. #define BLM_PHASE_IN_INCR_SHIFT (0)
  4179. #define BLM_PHASE_IN_INCR_MASK (0xff << 0)
  4180. #define BLC_PWM_CTL _MMIO(dev_priv->info.display_mmio_offset + 0x61254)
  4181. /*
  4182. * This is the most significant 15 bits of the number of backlight cycles in a
  4183. * complete cycle of the modulated backlight control.
  4184. *
  4185. * The actual value is this field multiplied by two.
  4186. */
  4187. #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
  4188. #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
  4189. #define BLM_LEGACY_MODE (1 << 16) /* gen2 only */
  4190. /*
  4191. * This is the number of cycles out of the backlight modulation cycle for which
  4192. * the backlight is on.
  4193. *
  4194. * This field must be no greater than the number of cycles in the complete
  4195. * backlight modulation cycle.
  4196. */
  4197. #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
  4198. #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
  4199. #define BACKLIGHT_DUTY_CYCLE_MASK_PNV (0xfffe)
  4200. #define BLM_POLARITY_PNV (1 << 0) /* pnv only */
  4201. #define BLC_HIST_CTL _MMIO(dev_priv->info.display_mmio_offset + 0x61260)
  4202. #define BLM_HISTOGRAM_ENABLE (1 << 31)
  4203. /* New registers for PCH-split platforms. Safe where new bits show up, the
  4204. * register layout machtes with gen4 BLC_PWM_CTL[12]. */
  4205. #define BLC_PWM_CPU_CTL2 _MMIO(0x48250)
  4206. #define BLC_PWM_CPU_CTL _MMIO(0x48254)
  4207. #define HSW_BLC_PWM2_CTL _MMIO(0x48350)
  4208. /* PCH CTL1 is totally different, all but the below bits are reserved. CTL2 is
  4209. * like the normal CTL from gen4 and earlier. Hooray for confusing naming. */
  4210. #define BLC_PWM_PCH_CTL1 _MMIO(0xc8250)
  4211. #define BLM_PCH_PWM_ENABLE (1 << 31)
  4212. #define BLM_PCH_OVERRIDE_ENABLE (1 << 30)
  4213. #define BLM_PCH_POLARITY (1 << 29)
  4214. #define BLC_PWM_PCH_CTL2 _MMIO(0xc8254)
  4215. #define UTIL_PIN_CTL _MMIO(0x48400)
  4216. #define UTIL_PIN_ENABLE (1 << 31)
  4217. #define UTIL_PIN_PIPE(x) ((x) << 29)
  4218. #define UTIL_PIN_PIPE_MASK (3 << 29)
  4219. #define UTIL_PIN_MODE_PWM (1 << 24)
  4220. #define UTIL_PIN_MODE_MASK (0xf << 24)
  4221. #define UTIL_PIN_POLARITY (1 << 22)
  4222. /* BXT backlight register definition. */
  4223. #define _BXT_BLC_PWM_CTL1 0xC8250
  4224. #define BXT_BLC_PWM_ENABLE (1 << 31)
  4225. #define BXT_BLC_PWM_POLARITY (1 << 29)
  4226. #define _BXT_BLC_PWM_FREQ1 0xC8254
  4227. #define _BXT_BLC_PWM_DUTY1 0xC8258
  4228. #define _BXT_BLC_PWM_CTL2 0xC8350
  4229. #define _BXT_BLC_PWM_FREQ2 0xC8354
  4230. #define _BXT_BLC_PWM_DUTY2 0xC8358
  4231. #define BXT_BLC_PWM_CTL(controller) _MMIO_PIPE(controller, \
  4232. _BXT_BLC_PWM_CTL1, _BXT_BLC_PWM_CTL2)
  4233. #define BXT_BLC_PWM_FREQ(controller) _MMIO_PIPE(controller, \
  4234. _BXT_BLC_PWM_FREQ1, _BXT_BLC_PWM_FREQ2)
  4235. #define BXT_BLC_PWM_DUTY(controller) _MMIO_PIPE(controller, \
  4236. _BXT_BLC_PWM_DUTY1, _BXT_BLC_PWM_DUTY2)
  4237. #define PCH_GTC_CTL _MMIO(0xe7000)
  4238. #define PCH_GTC_ENABLE (1 << 31)
  4239. /* TV port control */
  4240. #define TV_CTL _MMIO(0x68000)
  4241. /* Enables the TV encoder */
  4242. # define TV_ENC_ENABLE (1 << 31)
  4243. /* Sources the TV encoder input from pipe B instead of A. */
  4244. # define TV_ENC_PIPEB_SELECT (1 << 30)
  4245. /* Outputs composite video (DAC A only) */
  4246. # define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
  4247. /* Outputs SVideo video (DAC B/C) */
  4248. # define TV_ENC_OUTPUT_SVIDEO (1 << 28)
  4249. /* Outputs Component video (DAC A/B/C) */
  4250. # define TV_ENC_OUTPUT_COMPONENT (2 << 28)
  4251. /* Outputs Composite and SVideo (DAC A/B/C) */
  4252. # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
  4253. # define TV_TRILEVEL_SYNC (1 << 21)
  4254. /* Enables slow sync generation (945GM only) */
  4255. # define TV_SLOW_SYNC (1 << 20)
  4256. /* Selects 4x oversampling for 480i and 576p */
  4257. # define TV_OVERSAMPLE_4X (0 << 18)
  4258. /* Selects 2x oversampling for 720p and 1080i */
  4259. # define TV_OVERSAMPLE_2X (1 << 18)
  4260. /* Selects no oversampling for 1080p */
  4261. # define TV_OVERSAMPLE_NONE (2 << 18)
  4262. /* Selects 8x oversampling */
  4263. # define TV_OVERSAMPLE_8X (3 << 18)
  4264. /* Selects progressive mode rather than interlaced */
  4265. # define TV_PROGRESSIVE (1 << 17)
  4266. /* Sets the colorburst to PAL mode. Required for non-M PAL modes. */
  4267. # define TV_PAL_BURST (1 << 16)
  4268. /* Field for setting delay of Y compared to C */
  4269. # define TV_YC_SKEW_MASK (7 << 12)
  4270. /* Enables a fix for 480p/576p standard definition modes on the 915GM only */
  4271. # define TV_ENC_SDP_FIX (1 << 11)
  4272. /*
  4273. * Enables a fix for the 915GM only.
  4274. *
  4275. * Not sure what it does.
  4276. */
  4277. # define TV_ENC_C0_FIX (1 << 10)
  4278. /* Bits that must be preserved by software */
  4279. # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
  4280. # define TV_FUSE_STATE_MASK (3 << 4)
  4281. /* Read-only state that reports all features enabled */
  4282. # define TV_FUSE_STATE_ENABLED (0 << 4)
  4283. /* Read-only state that reports that Macrovision is disabled in hardware*/
  4284. # define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
  4285. /* Read-only state that reports that TV-out is disabled in hardware. */
  4286. # define TV_FUSE_STATE_DISABLED (2 << 4)
  4287. /* Normal operation */
  4288. # define TV_TEST_MODE_NORMAL (0 << 0)
  4289. /* Encoder test pattern 1 - combo pattern */
  4290. # define TV_TEST_MODE_PATTERN_1 (1 << 0)
  4291. /* Encoder test pattern 2 - full screen vertical 75% color bars */
  4292. # define TV_TEST_MODE_PATTERN_2 (2 << 0)
  4293. /* Encoder test pattern 3 - full screen horizontal 75% color bars */
  4294. # define TV_TEST_MODE_PATTERN_3 (3 << 0)
  4295. /* Encoder test pattern 4 - random noise */
  4296. # define TV_TEST_MODE_PATTERN_4 (4 << 0)
  4297. /* Encoder test pattern 5 - linear color ramps */
  4298. # define TV_TEST_MODE_PATTERN_5 (5 << 0)
  4299. /*
  4300. * This test mode forces the DACs to 50% of full output.
  4301. *
  4302. * This is used for load detection in combination with TVDAC_SENSE_MASK
  4303. */
  4304. # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
  4305. # define TV_TEST_MODE_MASK (7 << 0)
  4306. #define TV_DAC _MMIO(0x68004)
  4307. # define TV_DAC_SAVE 0x00ffff00
  4308. /*
  4309. * Reports that DAC state change logic has reported change (RO).
  4310. *
  4311. * This gets cleared when TV_DAC_STATE_EN is cleared
  4312. */
  4313. # define TVDAC_STATE_CHG (1 << 31)
  4314. # define TVDAC_SENSE_MASK (7 << 28)
  4315. /* Reports that DAC A voltage is above the detect threshold */
  4316. # define TVDAC_A_SENSE (1 << 30)
  4317. /* Reports that DAC B voltage is above the detect threshold */
  4318. # define TVDAC_B_SENSE (1 << 29)
  4319. /* Reports that DAC C voltage is above the detect threshold */
  4320. # define TVDAC_C_SENSE (1 << 28)
  4321. /*
  4322. * Enables DAC state detection logic, for load-based TV detection.
  4323. *
  4324. * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
  4325. * to off, for load detection to work.
  4326. */
  4327. # define TVDAC_STATE_CHG_EN (1 << 27)
  4328. /* Sets the DAC A sense value to high */
  4329. # define TVDAC_A_SENSE_CTL (1 << 26)
  4330. /* Sets the DAC B sense value to high */
  4331. # define TVDAC_B_SENSE_CTL (1 << 25)
  4332. /* Sets the DAC C sense value to high */
  4333. # define TVDAC_C_SENSE_CTL (1 << 24)
  4334. /* Overrides the ENC_ENABLE and DAC voltage levels */
  4335. # define DAC_CTL_OVERRIDE (1 << 7)
  4336. /* Sets the slew rate. Must be preserved in software */
  4337. # define ENC_TVDAC_SLEW_FAST (1 << 6)
  4338. # define DAC_A_1_3_V (0 << 4)
  4339. # define DAC_A_1_1_V (1 << 4)
  4340. # define DAC_A_0_7_V (2 << 4)
  4341. # define DAC_A_MASK (3 << 4)
  4342. # define DAC_B_1_3_V (0 << 2)
  4343. # define DAC_B_1_1_V (1 << 2)
  4344. # define DAC_B_0_7_V (2 << 2)
  4345. # define DAC_B_MASK (3 << 2)
  4346. # define DAC_C_1_3_V (0 << 0)
  4347. # define DAC_C_1_1_V (1 << 0)
  4348. # define DAC_C_0_7_V (2 << 0)
  4349. # define DAC_C_MASK (3 << 0)
  4350. /*
  4351. * CSC coefficients are stored in a floating point format with 9 bits of
  4352. * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
  4353. * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
  4354. * -1 (0x3) being the only legal negative value.
  4355. */
  4356. #define TV_CSC_Y _MMIO(0x68010)
  4357. # define TV_RY_MASK 0x07ff0000
  4358. # define TV_RY_SHIFT 16
  4359. # define TV_GY_MASK 0x00000fff
  4360. # define TV_GY_SHIFT 0
  4361. #define TV_CSC_Y2 _MMIO(0x68014)
  4362. # define TV_BY_MASK 0x07ff0000
  4363. # define TV_BY_SHIFT 16
  4364. /*
  4365. * Y attenuation for component video.
  4366. *
  4367. * Stored in 1.9 fixed point.
  4368. */
  4369. # define TV_AY_MASK 0x000003ff
  4370. # define TV_AY_SHIFT 0
  4371. #define TV_CSC_U _MMIO(0x68018)
  4372. # define TV_RU_MASK 0x07ff0000
  4373. # define TV_RU_SHIFT 16
  4374. # define TV_GU_MASK 0x000007ff
  4375. # define TV_GU_SHIFT 0
  4376. #define TV_CSC_U2 _MMIO(0x6801c)
  4377. # define TV_BU_MASK 0x07ff0000
  4378. # define TV_BU_SHIFT 16
  4379. /*
  4380. * U attenuation for component video.
  4381. *
  4382. * Stored in 1.9 fixed point.
  4383. */
  4384. # define TV_AU_MASK 0x000003ff
  4385. # define TV_AU_SHIFT 0
  4386. #define TV_CSC_V _MMIO(0x68020)
  4387. # define TV_RV_MASK 0x0fff0000
  4388. # define TV_RV_SHIFT 16
  4389. # define TV_GV_MASK 0x000007ff
  4390. # define TV_GV_SHIFT 0
  4391. #define TV_CSC_V2 _MMIO(0x68024)
  4392. # define TV_BV_MASK 0x07ff0000
  4393. # define TV_BV_SHIFT 16
  4394. /*
  4395. * V attenuation for component video.
  4396. *
  4397. * Stored in 1.9 fixed point.
  4398. */
  4399. # define TV_AV_MASK 0x000007ff
  4400. # define TV_AV_SHIFT 0
  4401. #define TV_CLR_KNOBS _MMIO(0x68028)
  4402. /* 2s-complement brightness adjustment */
  4403. # define TV_BRIGHTNESS_MASK 0xff000000
  4404. # define TV_BRIGHTNESS_SHIFT 24
  4405. /* Contrast adjustment, as a 2.6 unsigned floating point number */
  4406. # define TV_CONTRAST_MASK 0x00ff0000
  4407. # define TV_CONTRAST_SHIFT 16
  4408. /* Saturation adjustment, as a 2.6 unsigned floating point number */
  4409. # define TV_SATURATION_MASK 0x0000ff00
  4410. # define TV_SATURATION_SHIFT 8
  4411. /* Hue adjustment, as an integer phase angle in degrees */
  4412. # define TV_HUE_MASK 0x000000ff
  4413. # define TV_HUE_SHIFT 0
  4414. #define TV_CLR_LEVEL _MMIO(0x6802c)
  4415. /* Controls the DAC level for black */
  4416. # define TV_BLACK_LEVEL_MASK 0x01ff0000
  4417. # define TV_BLACK_LEVEL_SHIFT 16
  4418. /* Controls the DAC level for blanking */
  4419. # define TV_BLANK_LEVEL_MASK 0x000001ff
  4420. # define TV_BLANK_LEVEL_SHIFT 0
  4421. #define TV_H_CTL_1 _MMIO(0x68030)
  4422. /* Number of pixels in the hsync. */
  4423. # define TV_HSYNC_END_MASK 0x1fff0000
  4424. # define TV_HSYNC_END_SHIFT 16
  4425. /* Total number of pixels minus one in the line (display and blanking). */
  4426. # define TV_HTOTAL_MASK 0x00001fff
  4427. # define TV_HTOTAL_SHIFT 0
  4428. #define TV_H_CTL_2 _MMIO(0x68034)
  4429. /* Enables the colorburst (needed for non-component color) */
  4430. # define TV_BURST_ENA (1 << 31)
  4431. /* Offset of the colorburst from the start of hsync, in pixels minus one. */
  4432. # define TV_HBURST_START_SHIFT 16
  4433. # define TV_HBURST_START_MASK 0x1fff0000
  4434. /* Length of the colorburst */
  4435. # define TV_HBURST_LEN_SHIFT 0
  4436. # define TV_HBURST_LEN_MASK 0x0001fff
  4437. #define TV_H_CTL_3 _MMIO(0x68038)
  4438. /* End of hblank, measured in pixels minus one from start of hsync */
  4439. # define TV_HBLANK_END_SHIFT 16
  4440. # define TV_HBLANK_END_MASK 0x1fff0000
  4441. /* Start of hblank, measured in pixels minus one from start of hsync */
  4442. # define TV_HBLANK_START_SHIFT 0
  4443. # define TV_HBLANK_START_MASK 0x0001fff
  4444. #define TV_V_CTL_1 _MMIO(0x6803c)
  4445. /* XXX */
  4446. # define TV_NBR_END_SHIFT 16
  4447. # define TV_NBR_END_MASK 0x07ff0000
  4448. /* XXX */
  4449. # define TV_VI_END_F1_SHIFT 8
  4450. # define TV_VI_END_F1_MASK 0x00003f00
  4451. /* XXX */
  4452. # define TV_VI_END_F2_SHIFT 0
  4453. # define TV_VI_END_F2_MASK 0x0000003f
  4454. #define TV_V_CTL_2 _MMIO(0x68040)
  4455. /* Length of vsync, in half lines */
  4456. # define TV_VSYNC_LEN_MASK 0x07ff0000
  4457. # define TV_VSYNC_LEN_SHIFT 16
  4458. /* Offset of the start of vsync in field 1, measured in one less than the
  4459. * number of half lines.
  4460. */
  4461. # define TV_VSYNC_START_F1_MASK 0x00007f00
  4462. # define TV_VSYNC_START_F1_SHIFT 8
  4463. /*
  4464. * Offset of the start of vsync in field 2, measured in one less than the
  4465. * number of half lines.
  4466. */
  4467. # define TV_VSYNC_START_F2_MASK 0x0000007f
  4468. # define TV_VSYNC_START_F2_SHIFT 0
  4469. #define TV_V_CTL_3 _MMIO(0x68044)
  4470. /* Enables generation of the equalization signal */
  4471. # define TV_EQUAL_ENA (1 << 31)
  4472. /* Length of vsync, in half lines */
  4473. # define TV_VEQ_LEN_MASK 0x007f0000
  4474. # define TV_VEQ_LEN_SHIFT 16
  4475. /* Offset of the start of equalization in field 1, measured in one less than
  4476. * the number of half lines.
  4477. */
  4478. # define TV_VEQ_START_F1_MASK 0x0007f00
  4479. # define TV_VEQ_START_F1_SHIFT 8
  4480. /*
  4481. * Offset of the start of equalization in field 2, measured in one less than
  4482. * the number of half lines.
  4483. */
  4484. # define TV_VEQ_START_F2_MASK 0x000007f
  4485. # define TV_VEQ_START_F2_SHIFT 0
  4486. #define TV_V_CTL_4 _MMIO(0x68048)
  4487. /*
  4488. * Offset to start of vertical colorburst, measured in one less than the
  4489. * number of lines from vertical start.
  4490. */
  4491. # define TV_VBURST_START_F1_MASK 0x003f0000
  4492. # define TV_VBURST_START_F1_SHIFT 16
  4493. /*
  4494. * Offset to the end of vertical colorburst, measured in one less than the
  4495. * number of lines from the start of NBR.
  4496. */
  4497. # define TV_VBURST_END_F1_MASK 0x000000ff
  4498. # define TV_VBURST_END_F1_SHIFT 0
  4499. #define TV_V_CTL_5 _MMIO(0x6804c)
  4500. /*
  4501. * Offset to start of vertical colorburst, measured in one less than the
  4502. * number of lines from vertical start.
  4503. */
  4504. # define TV_VBURST_START_F2_MASK 0x003f0000
  4505. # define TV_VBURST_START_F2_SHIFT 16
  4506. /*
  4507. * Offset to the end of vertical colorburst, measured in one less than the
  4508. * number of lines from the start of NBR.
  4509. */
  4510. # define TV_VBURST_END_F2_MASK 0x000000ff
  4511. # define TV_VBURST_END_F2_SHIFT 0
  4512. #define TV_V_CTL_6 _MMIO(0x68050)
  4513. /*
  4514. * Offset to start of vertical colorburst, measured in one less than the
  4515. * number of lines from vertical start.
  4516. */
  4517. # define TV_VBURST_START_F3_MASK 0x003f0000
  4518. # define TV_VBURST_START_F3_SHIFT 16
  4519. /*
  4520. * Offset to the end of vertical colorburst, measured in one less than the
  4521. * number of lines from the start of NBR.
  4522. */
  4523. # define TV_VBURST_END_F3_MASK 0x000000ff
  4524. # define TV_VBURST_END_F3_SHIFT 0
  4525. #define TV_V_CTL_7 _MMIO(0x68054)
  4526. /*
  4527. * Offset to start of vertical colorburst, measured in one less than the
  4528. * number of lines from vertical start.
  4529. */
  4530. # define TV_VBURST_START_F4_MASK 0x003f0000
  4531. # define TV_VBURST_START_F4_SHIFT 16
  4532. /*
  4533. * Offset to the end of vertical colorburst, measured in one less than the
  4534. * number of lines from the start of NBR.
  4535. */
  4536. # define TV_VBURST_END_F4_MASK 0x000000ff
  4537. # define TV_VBURST_END_F4_SHIFT 0
  4538. #define TV_SC_CTL_1 _MMIO(0x68060)
  4539. /* Turns on the first subcarrier phase generation DDA */
  4540. # define TV_SC_DDA1_EN (1 << 31)
  4541. /* Turns on the first subcarrier phase generation DDA */
  4542. # define TV_SC_DDA2_EN (1 << 30)
  4543. /* Turns on the first subcarrier phase generation DDA */
  4544. # define TV_SC_DDA3_EN (1 << 29)
  4545. /* Sets the subcarrier DDA to reset frequency every other field */
  4546. # define TV_SC_RESET_EVERY_2 (0 << 24)
  4547. /* Sets the subcarrier DDA to reset frequency every fourth field */
  4548. # define TV_SC_RESET_EVERY_4 (1 << 24)
  4549. /* Sets the subcarrier DDA to reset frequency every eighth field */
  4550. # define TV_SC_RESET_EVERY_8 (2 << 24)
  4551. /* Sets the subcarrier DDA to never reset the frequency */
  4552. # define TV_SC_RESET_NEVER (3 << 24)
  4553. /* Sets the peak amplitude of the colorburst.*/
  4554. # define TV_BURST_LEVEL_MASK 0x00ff0000
  4555. # define TV_BURST_LEVEL_SHIFT 16
  4556. /* Sets the increment of the first subcarrier phase generation DDA */
  4557. # define TV_SCDDA1_INC_MASK 0x00000fff
  4558. # define TV_SCDDA1_INC_SHIFT 0
  4559. #define TV_SC_CTL_2 _MMIO(0x68064)
  4560. /* Sets the rollover for the second subcarrier phase generation DDA */
  4561. # define TV_SCDDA2_SIZE_MASK 0x7fff0000
  4562. # define TV_SCDDA2_SIZE_SHIFT 16
  4563. /* Sets the increent of the second subcarrier phase generation DDA */
  4564. # define TV_SCDDA2_INC_MASK 0x00007fff
  4565. # define TV_SCDDA2_INC_SHIFT 0
  4566. #define TV_SC_CTL_3 _MMIO(0x68068)
  4567. /* Sets the rollover for the third subcarrier phase generation DDA */
  4568. # define TV_SCDDA3_SIZE_MASK 0x7fff0000
  4569. # define TV_SCDDA3_SIZE_SHIFT 16
  4570. /* Sets the increent of the third subcarrier phase generation DDA */
  4571. # define TV_SCDDA3_INC_MASK 0x00007fff
  4572. # define TV_SCDDA3_INC_SHIFT 0
  4573. #define TV_WIN_POS _MMIO(0x68070)
  4574. /* X coordinate of the display from the start of horizontal active */
  4575. # define TV_XPOS_MASK 0x1fff0000
  4576. # define TV_XPOS_SHIFT 16
  4577. /* Y coordinate of the display from the start of vertical active (NBR) */
  4578. # define TV_YPOS_MASK 0x00000fff
  4579. # define TV_YPOS_SHIFT 0
  4580. #define TV_WIN_SIZE _MMIO(0x68074)
  4581. /* Horizontal size of the display window, measured in pixels*/
  4582. # define TV_XSIZE_MASK 0x1fff0000
  4583. # define TV_XSIZE_SHIFT 16
  4584. /*
  4585. * Vertical size of the display window, measured in pixels.
  4586. *
  4587. * Must be even for interlaced modes.
  4588. */
  4589. # define TV_YSIZE_MASK 0x00000fff
  4590. # define TV_YSIZE_SHIFT 0
  4591. #define TV_FILTER_CTL_1 _MMIO(0x68080)
  4592. /*
  4593. * Enables automatic scaling calculation.
  4594. *
  4595. * If set, the rest of the registers are ignored, and the calculated values can
  4596. * be read back from the register.
  4597. */
  4598. # define TV_AUTO_SCALE (1 << 31)
  4599. /*
  4600. * Disables the vertical filter.
  4601. *
  4602. * This is required on modes more than 1024 pixels wide */
  4603. # define TV_V_FILTER_BYPASS (1 << 29)
  4604. /* Enables adaptive vertical filtering */
  4605. # define TV_VADAPT (1 << 28)
  4606. # define TV_VADAPT_MODE_MASK (3 << 26)
  4607. /* Selects the least adaptive vertical filtering mode */
  4608. # define TV_VADAPT_MODE_LEAST (0 << 26)
  4609. /* Selects the moderately adaptive vertical filtering mode */
  4610. # define TV_VADAPT_MODE_MODERATE (1 << 26)
  4611. /* Selects the most adaptive vertical filtering mode */
  4612. # define TV_VADAPT_MODE_MOST (3 << 26)
  4613. /*
  4614. * Sets the horizontal scaling factor.
  4615. *
  4616. * This should be the fractional part of the horizontal scaling factor divided
  4617. * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
  4618. *
  4619. * (src width - 1) / ((oversample * dest width) - 1)
  4620. */
  4621. # define TV_HSCALE_FRAC_MASK 0x00003fff
  4622. # define TV_HSCALE_FRAC_SHIFT 0
  4623. #define TV_FILTER_CTL_2 _MMIO(0x68084)
  4624. /*
  4625. * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
  4626. *
  4627. * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
  4628. */
  4629. # define TV_VSCALE_INT_MASK 0x00038000
  4630. # define TV_VSCALE_INT_SHIFT 15
  4631. /*
  4632. * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
  4633. *
  4634. * \sa TV_VSCALE_INT_MASK
  4635. */
  4636. # define TV_VSCALE_FRAC_MASK 0x00007fff
  4637. # define TV_VSCALE_FRAC_SHIFT 0
  4638. #define TV_FILTER_CTL_3 _MMIO(0x68088)
  4639. /*
  4640. * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
  4641. *
  4642. * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
  4643. *
  4644. * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
  4645. */
  4646. # define TV_VSCALE_IP_INT_MASK 0x00038000
  4647. # define TV_VSCALE_IP_INT_SHIFT 15
  4648. /*
  4649. * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
  4650. *
  4651. * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
  4652. *
  4653. * \sa TV_VSCALE_IP_INT_MASK
  4654. */
  4655. # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
  4656. # define TV_VSCALE_IP_FRAC_SHIFT 0
  4657. #define TV_CC_CONTROL _MMIO(0x68090)
  4658. # define TV_CC_ENABLE (1 << 31)
  4659. /*
  4660. * Specifies which field to send the CC data in.
  4661. *
  4662. * CC data is usually sent in field 0.
  4663. */
  4664. # define TV_CC_FID_MASK (1 << 27)
  4665. # define TV_CC_FID_SHIFT 27
  4666. /* Sets the horizontal position of the CC data. Usually 135. */
  4667. # define TV_CC_HOFF_MASK 0x03ff0000
  4668. # define TV_CC_HOFF_SHIFT 16
  4669. /* Sets the vertical position of the CC data. Usually 21 */
  4670. # define TV_CC_LINE_MASK 0x0000003f
  4671. # define TV_CC_LINE_SHIFT 0
  4672. #define TV_CC_DATA _MMIO(0x68094)
  4673. # define TV_CC_RDY (1 << 31)
  4674. /* Second word of CC data to be transmitted. */
  4675. # define TV_CC_DATA_2_MASK 0x007f0000
  4676. # define TV_CC_DATA_2_SHIFT 16
  4677. /* First word of CC data to be transmitted. */
  4678. # define TV_CC_DATA_1_MASK 0x0000007f
  4679. # define TV_CC_DATA_1_SHIFT 0
  4680. #define TV_H_LUMA(i) _MMIO(0x68100 + (i) * 4) /* 60 registers */
  4681. #define TV_H_CHROMA(i) _MMIO(0x68200 + (i) * 4) /* 60 registers */
  4682. #define TV_V_LUMA(i) _MMIO(0x68300 + (i) * 4) /* 43 registers */
  4683. #define TV_V_CHROMA(i) _MMIO(0x68400 + (i) * 4) /* 43 registers */
  4684. /* Display Port */
  4685. #define DP_A _MMIO(0x64000) /* eDP */
  4686. #define DP_B _MMIO(0x64100)
  4687. #define DP_C _MMIO(0x64200)
  4688. #define DP_D _MMIO(0x64300)
  4689. #define VLV_DP_B _MMIO(VLV_DISPLAY_BASE + 0x64100)
  4690. #define VLV_DP_C _MMIO(VLV_DISPLAY_BASE + 0x64200)
  4691. #define CHV_DP_D _MMIO(VLV_DISPLAY_BASE + 0x64300)
  4692. #define DP_PORT_EN (1 << 31)
  4693. #define DP_PIPEB_SELECT (1 << 30)
  4694. #define DP_PIPE_MASK (1 << 30)
  4695. #define DP_PIPE_SELECT_CHV(pipe) ((pipe) << 16)
  4696. #define DP_PIPE_MASK_CHV (3 << 16)
  4697. /* Link training mode - select a suitable mode for each stage */
  4698. #define DP_LINK_TRAIN_PAT_1 (0 << 28)
  4699. #define DP_LINK_TRAIN_PAT_2 (1 << 28)
  4700. #define DP_LINK_TRAIN_PAT_IDLE (2 << 28)
  4701. #define DP_LINK_TRAIN_OFF (3 << 28)
  4702. #define DP_LINK_TRAIN_MASK (3 << 28)
  4703. #define DP_LINK_TRAIN_SHIFT 28
  4704. /* CPT Link training mode */
  4705. #define DP_LINK_TRAIN_PAT_1_CPT (0 << 8)
  4706. #define DP_LINK_TRAIN_PAT_2_CPT (1 << 8)
  4707. #define DP_LINK_TRAIN_PAT_IDLE_CPT (2 << 8)
  4708. #define DP_LINK_TRAIN_OFF_CPT (3 << 8)
  4709. #define DP_LINK_TRAIN_MASK_CPT (7 << 8)
  4710. #define DP_LINK_TRAIN_SHIFT_CPT 8
  4711. /* Signal voltages. These are mostly controlled by the other end */
  4712. #define DP_VOLTAGE_0_4 (0 << 25)
  4713. #define DP_VOLTAGE_0_6 (1 << 25)
  4714. #define DP_VOLTAGE_0_8 (2 << 25)
  4715. #define DP_VOLTAGE_1_2 (3 << 25)
  4716. #define DP_VOLTAGE_MASK (7 << 25)
  4717. #define DP_VOLTAGE_SHIFT 25
  4718. /* Signal pre-emphasis levels, like voltages, the other end tells us what
  4719. * they want
  4720. */
  4721. #define DP_PRE_EMPHASIS_0 (0 << 22)
  4722. #define DP_PRE_EMPHASIS_3_5 (1 << 22)
  4723. #define DP_PRE_EMPHASIS_6 (2 << 22)
  4724. #define DP_PRE_EMPHASIS_9_5 (3 << 22)
  4725. #define DP_PRE_EMPHASIS_MASK (7 << 22)
  4726. #define DP_PRE_EMPHASIS_SHIFT 22
  4727. /* How many wires to use. I guess 3 was too hard */
  4728. #define DP_PORT_WIDTH(width) (((width) - 1) << 19)
  4729. #define DP_PORT_WIDTH_MASK (7 << 19)
  4730. #define DP_PORT_WIDTH_SHIFT 19
  4731. /* Mystic DPCD version 1.1 special mode */
  4732. #define DP_ENHANCED_FRAMING (1 << 18)
  4733. /* eDP */
  4734. #define DP_PLL_FREQ_270MHZ (0 << 16)
  4735. #define DP_PLL_FREQ_162MHZ (1 << 16)
  4736. #define DP_PLL_FREQ_MASK (3 << 16)
  4737. /* locked once port is enabled */
  4738. #define DP_PORT_REVERSAL (1 << 15)
  4739. /* eDP */
  4740. #define DP_PLL_ENABLE (1 << 14)
  4741. /* sends the clock on lane 15 of the PEG for debug */
  4742. #define DP_CLOCK_OUTPUT_ENABLE (1 << 13)
  4743. #define DP_SCRAMBLING_DISABLE (1 << 12)
  4744. #define DP_SCRAMBLING_DISABLE_IRONLAKE (1 << 7)
  4745. /* limit RGB values to avoid confusing TVs */
  4746. #define DP_COLOR_RANGE_16_235 (1 << 8)
  4747. /* Turn on the audio link */
  4748. #define DP_AUDIO_OUTPUT_ENABLE (1 << 6)
  4749. /* vs and hs sync polarity */
  4750. #define DP_SYNC_VS_HIGH (1 << 4)
  4751. #define DP_SYNC_HS_HIGH (1 << 3)
  4752. /* A fantasy */
  4753. #define DP_DETECTED (1 << 2)
  4754. /* The aux channel provides a way to talk to the
  4755. * signal sink for DDC etc. Max packet size supported
  4756. * is 20 bytes in each direction, hence the 5 fixed
  4757. * data registers
  4758. */
  4759. #define _DPA_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64010)
  4760. #define _DPA_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64014)
  4761. #define _DPA_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64018)
  4762. #define _DPA_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6401c)
  4763. #define _DPA_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64020)
  4764. #define _DPA_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64024)
  4765. #define _DPB_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64110)
  4766. #define _DPB_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64114)
  4767. #define _DPB_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64118)
  4768. #define _DPB_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6411c)
  4769. #define _DPB_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64120)
  4770. #define _DPB_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64124)
  4771. #define _DPC_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64210)
  4772. #define _DPC_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64214)
  4773. #define _DPC_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64218)
  4774. #define _DPC_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6421c)
  4775. #define _DPC_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64220)
  4776. #define _DPC_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64224)
  4777. #define _DPD_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64310)
  4778. #define _DPD_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64314)
  4779. #define _DPD_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64318)
  4780. #define _DPD_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6431c)
  4781. #define _DPD_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64320)
  4782. #define _DPD_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64324)
  4783. #define _DPF_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64510)
  4784. #define _DPF_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64514)
  4785. #define _DPF_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64518)
  4786. #define _DPF_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6451c)
  4787. #define _DPF_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64520)
  4788. #define _DPF_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64524)
  4789. #define DP_AUX_CH_CTL(aux_ch) _MMIO_PORT(aux_ch, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
  4790. #define DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT(aux_ch, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
  4791. #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
  4792. #define DP_AUX_CH_CTL_DONE (1 << 30)
  4793. #define DP_AUX_CH_CTL_INTERRUPT (1 << 29)
  4794. #define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28)
  4795. #define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26)
  4796. #define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26)
  4797. #define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26)
  4798. #define DP_AUX_CH_CTL_TIME_OUT_MAX (3 << 26) /* Varies per platform */
  4799. #define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26)
  4800. #define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25)
  4801. #define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
  4802. #define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20
  4803. #define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16)
  4804. #define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16
  4805. #define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15)
  4806. #define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14)
  4807. #define DP_AUX_CH_CTL_SYNC_TEST (1 << 13)
  4808. #define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12)
  4809. #define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)
  4810. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)
  4811. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0
  4812. #define DP_AUX_CH_CTL_PSR_DATA_AUX_REG_SKL (1 << 14)
  4813. #define DP_AUX_CH_CTL_FS_DATA_AUX_REG_SKL (1 << 13)
  4814. #define DP_AUX_CH_CTL_GTC_DATA_AUX_REG_SKL (1 << 12)
  4815. #define DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL_MASK (0x1f << 5)
  4816. #define DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(c) (((c) - 1) << 5)
  4817. #define DP_AUX_CH_CTL_SYNC_PULSE_SKL(c) ((c) - 1)
  4818. /*
  4819. * Computing GMCH M and N values for the Display Port link
  4820. *
  4821. * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
  4822. *
  4823. * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
  4824. *
  4825. * The GMCH value is used internally
  4826. *
  4827. * bytes_per_pixel is the number of bytes coming out of the plane,
  4828. * which is after the LUTs, so we want the bytes for our color format.
  4829. * For our current usage, this is always 3, one byte for R, G and B.
  4830. */
  4831. #define _PIPEA_DATA_M_G4X 0x70050
  4832. #define _PIPEB_DATA_M_G4X 0x71050
  4833. /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
  4834. #define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */
  4835. #define TU_SIZE_SHIFT 25
  4836. #define TU_SIZE_MASK (0x3f << 25)
  4837. #define DATA_LINK_M_N_MASK (0xffffff)
  4838. #define DATA_LINK_N_MAX (0x800000)
  4839. #define _PIPEA_DATA_N_G4X 0x70054
  4840. #define _PIPEB_DATA_N_G4X 0x71054
  4841. #define PIPE_GMCH_DATA_N_MASK (0xffffff)
  4842. /*
  4843. * Computing Link M and N values for the Display Port link
  4844. *
  4845. * Link M / N = pixel_clock / ls_clk
  4846. *
  4847. * (the DP spec calls pixel_clock the 'strm_clk')
  4848. *
  4849. * The Link value is transmitted in the Main Stream
  4850. * Attributes and VB-ID.
  4851. */
  4852. #define _PIPEA_LINK_M_G4X 0x70060
  4853. #define _PIPEB_LINK_M_G4X 0x71060
  4854. #define PIPEA_DP_LINK_M_MASK (0xffffff)
  4855. #define _PIPEA_LINK_N_G4X 0x70064
  4856. #define _PIPEB_LINK_N_G4X 0x71064
  4857. #define PIPEA_DP_LINK_N_MASK (0xffffff)
  4858. #define PIPE_DATA_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_M_G4X, _PIPEB_DATA_M_G4X)
  4859. #define PIPE_DATA_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_N_G4X, _PIPEB_DATA_N_G4X)
  4860. #define PIPE_LINK_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_M_G4X, _PIPEB_LINK_M_G4X)
  4861. #define PIPE_LINK_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_N_G4X, _PIPEB_LINK_N_G4X)
  4862. /* Display & cursor control */
  4863. /* Pipe A */
  4864. #define _PIPEADSL 0x70000
  4865. #define DSL_LINEMASK_GEN2 0x00000fff
  4866. #define DSL_LINEMASK_GEN3 0x00001fff
  4867. #define _PIPEACONF 0x70008
  4868. #define PIPECONF_ENABLE (1<<31)
  4869. #define PIPECONF_DISABLE 0
  4870. #define PIPECONF_DOUBLE_WIDE (1<<30)
  4871. #define I965_PIPECONF_ACTIVE (1<<30)
  4872. #define PIPECONF_DSI_PLL_LOCKED (1<<29) /* vlv & pipe A only */
  4873. #define PIPECONF_FRAME_START_DELAY_MASK (3<<27)
  4874. #define PIPECONF_SINGLE_WIDE 0
  4875. #define PIPECONF_PIPE_UNLOCKED 0
  4876. #define PIPECONF_PIPE_LOCKED (1<<25)
  4877. #define PIPECONF_PALETTE 0
  4878. #define PIPECONF_GAMMA (1<<24)
  4879. #define PIPECONF_FORCE_BORDER (1<<25)
  4880. #define PIPECONF_INTERLACE_MASK (7 << 21)
  4881. #define PIPECONF_INTERLACE_MASK_HSW (3 << 21)
  4882. /* Note that pre-gen3 does not support interlaced display directly. Panel
  4883. * fitting must be disabled on pre-ilk for interlaced. */
  4884. #define PIPECONF_PROGRESSIVE (0 << 21)
  4885. #define PIPECONF_INTERLACE_W_SYNC_SHIFT_PANEL (4 << 21) /* gen4 only */
  4886. #define PIPECONF_INTERLACE_W_SYNC_SHIFT (5 << 21) /* gen4 only */
  4887. #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
  4888. #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) /* gen3 only */
  4889. /* Ironlake and later have a complete new set of values for interlaced. PFIT
  4890. * means panel fitter required, PF means progressive fetch, DBL means power
  4891. * saving pixel doubling. */
  4892. #define PIPECONF_PFIT_PF_INTERLACED_ILK (1 << 21)
  4893. #define PIPECONF_INTERLACED_ILK (3 << 21)
  4894. #define PIPECONF_INTERLACED_DBL_ILK (4 << 21) /* ilk/snb only */
  4895. #define PIPECONF_PFIT_PF_INTERLACED_DBL_ILK (5 << 21) /* ilk/snb only */
  4896. #define PIPECONF_INTERLACE_MODE_MASK (7 << 21)
  4897. #define PIPECONF_EDP_RR_MODE_SWITCH (1 << 20)
  4898. #define PIPECONF_CXSR_DOWNCLOCK (1<<16)
  4899. #define PIPECONF_EDP_RR_MODE_SWITCH_VLV (1 << 14)
  4900. #define PIPECONF_COLOR_RANGE_SELECT (1 << 13)
  4901. #define PIPECONF_BPC_MASK (0x7 << 5)
  4902. #define PIPECONF_8BPC (0<<5)
  4903. #define PIPECONF_10BPC (1<<5)
  4904. #define PIPECONF_6BPC (2<<5)
  4905. #define PIPECONF_12BPC (3<<5)
  4906. #define PIPECONF_DITHER_EN (1<<4)
  4907. #define PIPECONF_DITHER_TYPE_MASK (0x0000000c)
  4908. #define PIPECONF_DITHER_TYPE_SP (0<<2)
  4909. #define PIPECONF_DITHER_TYPE_ST1 (1<<2)
  4910. #define PIPECONF_DITHER_TYPE_ST2 (2<<2)
  4911. #define PIPECONF_DITHER_TYPE_TEMP (3<<2)
  4912. #define _PIPEASTAT 0x70024
  4913. #define PIPE_FIFO_UNDERRUN_STATUS (1UL<<31)
  4914. #define SPRITE1_FLIP_DONE_INT_EN_VLV (1UL<<30)
  4915. #define PIPE_CRC_ERROR_ENABLE (1UL<<29)
  4916. #define PIPE_CRC_DONE_ENABLE (1UL<<28)
  4917. #define PERF_COUNTER2_INTERRUPT_EN (1UL<<27)
  4918. #define PIPE_GMBUS_EVENT_ENABLE (1UL<<27)
  4919. #define PLANE_FLIP_DONE_INT_EN_VLV (1UL<<26)
  4920. #define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL<<26)
  4921. #define PIPE_VSYNC_INTERRUPT_ENABLE (1UL<<25)
  4922. #define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
  4923. #define PIPE_DPST_EVENT_ENABLE (1UL<<23)
  4924. #define SPRITE0_FLIP_DONE_INT_EN_VLV (1UL<<22)
  4925. #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
  4926. #define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
  4927. #define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
  4928. #define PIPE_B_PSR_INTERRUPT_ENABLE_VLV (1UL<<19)
  4929. #define PERF_COUNTER_INTERRUPT_EN (1UL<<19)
  4930. #define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL<<18) /* pre-965 */
  4931. #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
  4932. #define PIPE_FRAMESTART_INTERRUPT_ENABLE (1UL<<17)
  4933. #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL<<17)
  4934. #define PIPEA_HBLANK_INT_EN_VLV (1UL<<16)
  4935. #define PIPE_OVERLAY_UPDATED_ENABLE (1UL<<16)
  4936. #define SPRITE1_FLIP_DONE_INT_STATUS_VLV (1UL<<15)
  4937. #define SPRITE0_FLIP_DONE_INT_STATUS_VLV (1UL<<14)
  4938. #define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
  4939. #define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
  4940. #define PERF_COUNTER2_INTERRUPT_STATUS (1UL<<11)
  4941. #define PIPE_GMBUS_INTERRUPT_STATUS (1UL<<11)
  4942. #define PLANE_FLIP_DONE_INT_STATUS_VLV (1UL<<10)
  4943. #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL<<10)
  4944. #define PIPE_VSYNC_INTERRUPT_STATUS (1UL<<9)
  4945. #define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
  4946. #define PIPE_DPST_EVENT_STATUS (1UL<<7)
  4947. #define PIPE_A_PSR_STATUS_VLV (1UL<<6)
  4948. #define PIPE_LEGACY_BLC_EVENT_STATUS (1UL<<6)
  4949. #define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
  4950. #define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
  4951. #define PIPE_B_PSR_STATUS_VLV (1UL<<3)
  4952. #define PERF_COUNTER_INTERRUPT_STATUS (1UL<<3)
  4953. #define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL<<2) /* pre-965 */
  4954. #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
  4955. #define PIPE_FRAMESTART_INTERRUPT_STATUS (1UL<<1)
  4956. #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
  4957. #define PIPE_HBLANK_INT_STATUS (1UL<<0)
  4958. #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
  4959. #define PIPESTAT_INT_ENABLE_MASK 0x7fff0000
  4960. #define PIPESTAT_INT_STATUS_MASK 0x0000ffff
  4961. #define PIPE_A_OFFSET 0x70000
  4962. #define PIPE_B_OFFSET 0x71000
  4963. #define PIPE_C_OFFSET 0x72000
  4964. #define CHV_PIPE_C_OFFSET 0x74000
  4965. /*
  4966. * There's actually no pipe EDP. Some pipe registers have
  4967. * simply shifted from the pipe to the transcoder, while
  4968. * keeping their original offset. Thus we need PIPE_EDP_OFFSET
  4969. * to access such registers in transcoder EDP.
  4970. */
  4971. #define PIPE_EDP_OFFSET 0x7f000
  4972. #define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
  4973. dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
  4974. dev_priv->info.display_mmio_offset)
  4975. #define PIPECONF(pipe) _MMIO_PIPE2(pipe, _PIPEACONF)
  4976. #define PIPEDSL(pipe) _MMIO_PIPE2(pipe, _PIPEADSL)
  4977. #define PIPEFRAME(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEHIGH)
  4978. #define PIPEFRAMEPIXEL(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEPIXEL)
  4979. #define PIPESTAT(pipe) _MMIO_PIPE2(pipe, _PIPEASTAT)
  4980. #define _PIPE_MISC_A 0x70030
  4981. #define _PIPE_MISC_B 0x71030
  4982. #define PIPEMISC_YUV420_ENABLE (1<<27)
  4983. #define PIPEMISC_YUV420_MODE_FULL_BLEND (1<<26)
  4984. #define PIPEMISC_OUTPUT_COLORSPACE_YUV (1<<11)
  4985. #define PIPEMISC_DITHER_BPC_MASK (7<<5)
  4986. #define PIPEMISC_DITHER_8_BPC (0<<5)
  4987. #define PIPEMISC_DITHER_10_BPC (1<<5)
  4988. #define PIPEMISC_DITHER_6_BPC (2<<5)
  4989. #define PIPEMISC_DITHER_12_BPC (3<<5)
  4990. #define PIPEMISC_DITHER_ENABLE (1<<4)
  4991. #define PIPEMISC_DITHER_TYPE_MASK (3<<2)
  4992. #define PIPEMISC_DITHER_TYPE_SP (0<<2)
  4993. #define PIPEMISC(pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A)
  4994. #define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)
  4995. #define PIPEB_LINE_COMPARE_INT_EN (1<<29)
  4996. #define PIPEB_HLINE_INT_EN (1<<28)
  4997. #define PIPEB_VBLANK_INT_EN (1<<27)
  4998. #define SPRITED_FLIP_DONE_INT_EN (1<<26)
  4999. #define SPRITEC_FLIP_DONE_INT_EN (1<<25)
  5000. #define PLANEB_FLIP_DONE_INT_EN (1<<24)
  5001. #define PIPE_PSR_INT_EN (1<<22)
  5002. #define PIPEA_LINE_COMPARE_INT_EN (1<<21)
  5003. #define PIPEA_HLINE_INT_EN (1<<20)
  5004. #define PIPEA_VBLANK_INT_EN (1<<19)
  5005. #define SPRITEB_FLIP_DONE_INT_EN (1<<18)
  5006. #define SPRITEA_FLIP_DONE_INT_EN (1<<17)
  5007. #define PLANEA_FLIPDONE_INT_EN (1<<16)
  5008. #define PIPEC_LINE_COMPARE_INT_EN (1<<13)
  5009. #define PIPEC_HLINE_INT_EN (1<<12)
  5010. #define PIPEC_VBLANK_INT_EN (1<<11)
  5011. #define SPRITEF_FLIPDONE_INT_EN (1<<10)
  5012. #define SPRITEE_FLIPDONE_INT_EN (1<<9)
  5013. #define PLANEC_FLIPDONE_INT_EN (1<<8)
  5014. #define DPINVGTT _MMIO(VLV_DISPLAY_BASE + 0x7002c) /* VLV/CHV only */
  5015. #define SPRITEF_INVALID_GTT_INT_EN (1<<27)
  5016. #define SPRITEE_INVALID_GTT_INT_EN (1<<26)
  5017. #define PLANEC_INVALID_GTT_INT_EN (1<<25)
  5018. #define CURSORC_INVALID_GTT_INT_EN (1<<24)
  5019. #define CURSORB_INVALID_GTT_INT_EN (1<<23)
  5020. #define CURSORA_INVALID_GTT_INT_EN (1<<22)
  5021. #define SPRITED_INVALID_GTT_INT_EN (1<<21)
  5022. #define SPRITEC_INVALID_GTT_INT_EN (1<<20)
  5023. #define PLANEB_INVALID_GTT_INT_EN (1<<19)
  5024. #define SPRITEB_INVALID_GTT_INT_EN (1<<18)
  5025. #define SPRITEA_INVALID_GTT_INT_EN (1<<17)
  5026. #define PLANEA_INVALID_GTT_INT_EN (1<<16)
  5027. #define DPINVGTT_EN_MASK 0xff0000
  5028. #define DPINVGTT_EN_MASK_CHV 0xfff0000
  5029. #define SPRITEF_INVALID_GTT_STATUS (1<<11)
  5030. #define SPRITEE_INVALID_GTT_STATUS (1<<10)
  5031. #define PLANEC_INVALID_GTT_STATUS (1<<9)
  5032. #define CURSORC_INVALID_GTT_STATUS (1<<8)
  5033. #define CURSORB_INVALID_GTT_STATUS (1<<7)
  5034. #define CURSORA_INVALID_GTT_STATUS (1<<6)
  5035. #define SPRITED_INVALID_GTT_STATUS (1<<5)
  5036. #define SPRITEC_INVALID_GTT_STATUS (1<<4)
  5037. #define PLANEB_INVALID_GTT_STATUS (1<<3)
  5038. #define SPRITEB_INVALID_GTT_STATUS (1<<2)
  5039. #define SPRITEA_INVALID_GTT_STATUS (1<<1)
  5040. #define PLANEA_INVALID_GTT_STATUS (1<<0)
  5041. #define DPINVGTT_STATUS_MASK 0xff
  5042. #define DPINVGTT_STATUS_MASK_CHV 0xfff
  5043. #define DSPARB _MMIO(dev_priv->info.display_mmio_offset + 0x70030)
  5044. #define DSPARB_CSTART_MASK (0x7f << 7)
  5045. #define DSPARB_CSTART_SHIFT 7
  5046. #define DSPARB_BSTART_MASK (0x7f)
  5047. #define DSPARB_BSTART_SHIFT 0
  5048. #define DSPARB_BEND_SHIFT 9 /* on 855 */
  5049. #define DSPARB_AEND_SHIFT 0
  5050. #define DSPARB_SPRITEA_SHIFT_VLV 0
  5051. #define DSPARB_SPRITEA_MASK_VLV (0xff << 0)
  5052. #define DSPARB_SPRITEB_SHIFT_VLV 8
  5053. #define DSPARB_SPRITEB_MASK_VLV (0xff << 8)
  5054. #define DSPARB_SPRITEC_SHIFT_VLV 16
  5055. #define DSPARB_SPRITEC_MASK_VLV (0xff << 16)
  5056. #define DSPARB_SPRITED_SHIFT_VLV 24
  5057. #define DSPARB_SPRITED_MASK_VLV (0xff << 24)
  5058. #define DSPARB2 _MMIO(VLV_DISPLAY_BASE + 0x70060) /* vlv/chv */
  5059. #define DSPARB_SPRITEA_HI_SHIFT_VLV 0
  5060. #define DSPARB_SPRITEA_HI_MASK_VLV (0x1 << 0)
  5061. #define DSPARB_SPRITEB_HI_SHIFT_VLV 4
  5062. #define DSPARB_SPRITEB_HI_MASK_VLV (0x1 << 4)
  5063. #define DSPARB_SPRITEC_HI_SHIFT_VLV 8
  5064. #define DSPARB_SPRITEC_HI_MASK_VLV (0x1 << 8)
  5065. #define DSPARB_SPRITED_HI_SHIFT_VLV 12
  5066. #define DSPARB_SPRITED_HI_MASK_VLV (0x1 << 12)
  5067. #define DSPARB_SPRITEE_HI_SHIFT_VLV 16
  5068. #define DSPARB_SPRITEE_HI_MASK_VLV (0x1 << 16)
  5069. #define DSPARB_SPRITEF_HI_SHIFT_VLV 20
  5070. #define DSPARB_SPRITEF_HI_MASK_VLV (0x1 << 20)
  5071. #define DSPARB3 _MMIO(VLV_DISPLAY_BASE + 0x7006c) /* chv */
  5072. #define DSPARB_SPRITEE_SHIFT_VLV 0
  5073. #define DSPARB_SPRITEE_MASK_VLV (0xff << 0)
  5074. #define DSPARB_SPRITEF_SHIFT_VLV 8
  5075. #define DSPARB_SPRITEF_MASK_VLV (0xff << 8)
  5076. /* pnv/gen4/g4x/vlv/chv */
  5077. #define DSPFW1 _MMIO(dev_priv->info.display_mmio_offset + 0x70034)
  5078. #define DSPFW_SR_SHIFT 23
  5079. #define DSPFW_SR_MASK (0x1ff<<23)
  5080. #define DSPFW_CURSORB_SHIFT 16
  5081. #define DSPFW_CURSORB_MASK (0x3f<<16)
  5082. #define DSPFW_PLANEB_SHIFT 8
  5083. #define DSPFW_PLANEB_MASK (0x7f<<8)
  5084. #define DSPFW_PLANEB_MASK_VLV (0xff<<8) /* vlv/chv */
  5085. #define DSPFW_PLANEA_SHIFT 0
  5086. #define DSPFW_PLANEA_MASK (0x7f<<0)
  5087. #define DSPFW_PLANEA_MASK_VLV (0xff<<0) /* vlv/chv */
  5088. #define DSPFW2 _MMIO(dev_priv->info.display_mmio_offset + 0x70038)
  5089. #define DSPFW_FBC_SR_EN (1<<31) /* g4x */
  5090. #define DSPFW_FBC_SR_SHIFT 28
  5091. #define DSPFW_FBC_SR_MASK (0x7<<28) /* g4x */
  5092. #define DSPFW_FBC_HPLL_SR_SHIFT 24
  5093. #define DSPFW_FBC_HPLL_SR_MASK (0xf<<24) /* g4x */
  5094. #define DSPFW_SPRITEB_SHIFT (16)
  5095. #define DSPFW_SPRITEB_MASK (0x7f<<16) /* g4x */
  5096. #define DSPFW_SPRITEB_MASK_VLV (0xff<<16) /* vlv/chv */
  5097. #define DSPFW_CURSORA_SHIFT 8
  5098. #define DSPFW_CURSORA_MASK (0x3f<<8)
  5099. #define DSPFW_PLANEC_OLD_SHIFT 0
  5100. #define DSPFW_PLANEC_OLD_MASK (0x7f<<0) /* pre-gen4 sprite C */
  5101. #define DSPFW_SPRITEA_SHIFT 0
  5102. #define DSPFW_SPRITEA_MASK (0x7f<<0) /* g4x */
  5103. #define DSPFW_SPRITEA_MASK_VLV (0xff<<0) /* vlv/chv */
  5104. #define DSPFW3 _MMIO(dev_priv->info.display_mmio_offset + 0x7003c)
  5105. #define DSPFW_HPLL_SR_EN (1<<31)
  5106. #define PINEVIEW_SELF_REFRESH_EN (1<<30)
  5107. #define DSPFW_CURSOR_SR_SHIFT 24
  5108. #define DSPFW_CURSOR_SR_MASK (0x3f<<24)
  5109. #define DSPFW_HPLL_CURSOR_SHIFT 16
  5110. #define DSPFW_HPLL_CURSOR_MASK (0x3f<<16)
  5111. #define DSPFW_HPLL_SR_SHIFT 0
  5112. #define DSPFW_HPLL_SR_MASK (0x1ff<<0)
  5113. /* vlv/chv */
  5114. #define DSPFW4 _MMIO(VLV_DISPLAY_BASE + 0x70070)
  5115. #define DSPFW_SPRITEB_WM1_SHIFT 16
  5116. #define DSPFW_SPRITEB_WM1_MASK (0xff<<16)
  5117. #define DSPFW_CURSORA_WM1_SHIFT 8
  5118. #define DSPFW_CURSORA_WM1_MASK (0x3f<<8)
  5119. #define DSPFW_SPRITEA_WM1_SHIFT 0
  5120. #define DSPFW_SPRITEA_WM1_MASK (0xff<<0)
  5121. #define DSPFW5 _MMIO(VLV_DISPLAY_BASE + 0x70074)
  5122. #define DSPFW_PLANEB_WM1_SHIFT 24
  5123. #define DSPFW_PLANEB_WM1_MASK (0xff<<24)
  5124. #define DSPFW_PLANEA_WM1_SHIFT 16
  5125. #define DSPFW_PLANEA_WM1_MASK (0xff<<16)
  5126. #define DSPFW_CURSORB_WM1_SHIFT 8
  5127. #define DSPFW_CURSORB_WM1_MASK (0x3f<<8)
  5128. #define DSPFW_CURSOR_SR_WM1_SHIFT 0
  5129. #define DSPFW_CURSOR_SR_WM1_MASK (0x3f<<0)
  5130. #define DSPFW6 _MMIO(VLV_DISPLAY_BASE + 0x70078)
  5131. #define DSPFW_SR_WM1_SHIFT 0
  5132. #define DSPFW_SR_WM1_MASK (0x1ff<<0)
  5133. #define DSPFW7 _MMIO(VLV_DISPLAY_BASE + 0x7007c)
  5134. #define DSPFW7_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b4) /* wtf #1? */
  5135. #define DSPFW_SPRITED_WM1_SHIFT 24
  5136. #define DSPFW_SPRITED_WM1_MASK (0xff<<24)
  5137. #define DSPFW_SPRITED_SHIFT 16
  5138. #define DSPFW_SPRITED_MASK_VLV (0xff<<16)
  5139. #define DSPFW_SPRITEC_WM1_SHIFT 8
  5140. #define DSPFW_SPRITEC_WM1_MASK (0xff<<8)
  5141. #define DSPFW_SPRITEC_SHIFT 0
  5142. #define DSPFW_SPRITEC_MASK_VLV (0xff<<0)
  5143. #define DSPFW8_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b8)
  5144. #define DSPFW_SPRITEF_WM1_SHIFT 24
  5145. #define DSPFW_SPRITEF_WM1_MASK (0xff<<24)
  5146. #define DSPFW_SPRITEF_SHIFT 16
  5147. #define DSPFW_SPRITEF_MASK_VLV (0xff<<16)
  5148. #define DSPFW_SPRITEE_WM1_SHIFT 8
  5149. #define DSPFW_SPRITEE_WM1_MASK (0xff<<8)
  5150. #define DSPFW_SPRITEE_SHIFT 0
  5151. #define DSPFW_SPRITEE_MASK_VLV (0xff<<0)
  5152. #define DSPFW9_CHV _MMIO(VLV_DISPLAY_BASE + 0x7007c) /* wtf #2? */
  5153. #define DSPFW_PLANEC_WM1_SHIFT 24
  5154. #define DSPFW_PLANEC_WM1_MASK (0xff<<24)
  5155. #define DSPFW_PLANEC_SHIFT 16
  5156. #define DSPFW_PLANEC_MASK_VLV (0xff<<16)
  5157. #define DSPFW_CURSORC_WM1_SHIFT 8
  5158. #define DSPFW_CURSORC_WM1_MASK (0x3f<<16)
  5159. #define DSPFW_CURSORC_SHIFT 0
  5160. #define DSPFW_CURSORC_MASK (0x3f<<0)
  5161. /* vlv/chv high order bits */
  5162. #define DSPHOWM _MMIO(VLV_DISPLAY_BASE + 0x70064)
  5163. #define DSPFW_SR_HI_SHIFT 24
  5164. #define DSPFW_SR_HI_MASK (3<<24) /* 2 bits for chv, 1 for vlv */
  5165. #define DSPFW_SPRITEF_HI_SHIFT 23
  5166. #define DSPFW_SPRITEF_HI_MASK (1<<23)
  5167. #define DSPFW_SPRITEE_HI_SHIFT 22
  5168. #define DSPFW_SPRITEE_HI_MASK (1<<22)
  5169. #define DSPFW_PLANEC_HI_SHIFT 21
  5170. #define DSPFW_PLANEC_HI_MASK (1<<21)
  5171. #define DSPFW_SPRITED_HI_SHIFT 20
  5172. #define DSPFW_SPRITED_HI_MASK (1<<20)
  5173. #define DSPFW_SPRITEC_HI_SHIFT 16
  5174. #define DSPFW_SPRITEC_HI_MASK (1<<16)
  5175. #define DSPFW_PLANEB_HI_SHIFT 12
  5176. #define DSPFW_PLANEB_HI_MASK (1<<12)
  5177. #define DSPFW_SPRITEB_HI_SHIFT 8
  5178. #define DSPFW_SPRITEB_HI_MASK (1<<8)
  5179. #define DSPFW_SPRITEA_HI_SHIFT 4
  5180. #define DSPFW_SPRITEA_HI_MASK (1<<4)
  5181. #define DSPFW_PLANEA_HI_SHIFT 0
  5182. #define DSPFW_PLANEA_HI_MASK (1<<0)
  5183. #define DSPHOWM1 _MMIO(VLV_DISPLAY_BASE + 0x70068)
  5184. #define DSPFW_SR_WM1_HI_SHIFT 24
  5185. #define DSPFW_SR_WM1_HI_MASK (3<<24) /* 2 bits for chv, 1 for vlv */
  5186. #define DSPFW_SPRITEF_WM1_HI_SHIFT 23
  5187. #define DSPFW_SPRITEF_WM1_HI_MASK (1<<23)
  5188. #define DSPFW_SPRITEE_WM1_HI_SHIFT 22
  5189. #define DSPFW_SPRITEE_WM1_HI_MASK (1<<22)
  5190. #define DSPFW_PLANEC_WM1_HI_SHIFT 21
  5191. #define DSPFW_PLANEC_WM1_HI_MASK (1<<21)
  5192. #define DSPFW_SPRITED_WM1_HI_SHIFT 20
  5193. #define DSPFW_SPRITED_WM1_HI_MASK (1<<20)
  5194. #define DSPFW_SPRITEC_WM1_HI_SHIFT 16
  5195. #define DSPFW_SPRITEC_WM1_HI_MASK (1<<16)
  5196. #define DSPFW_PLANEB_WM1_HI_SHIFT 12
  5197. #define DSPFW_PLANEB_WM1_HI_MASK (1<<12)
  5198. #define DSPFW_SPRITEB_WM1_HI_SHIFT 8
  5199. #define DSPFW_SPRITEB_WM1_HI_MASK (1<<8)
  5200. #define DSPFW_SPRITEA_WM1_HI_SHIFT 4
  5201. #define DSPFW_SPRITEA_WM1_HI_MASK (1<<4)
  5202. #define DSPFW_PLANEA_WM1_HI_SHIFT 0
  5203. #define DSPFW_PLANEA_WM1_HI_MASK (1<<0)
  5204. /* drain latency register values*/
  5205. #define VLV_DDL(pipe) _MMIO(VLV_DISPLAY_BASE + 0x70050 + 4 * (pipe))
  5206. #define DDL_CURSOR_SHIFT 24
  5207. #define DDL_SPRITE_SHIFT(sprite) (8+8*(sprite))
  5208. #define DDL_PLANE_SHIFT 0
  5209. #define DDL_PRECISION_HIGH (1<<7)
  5210. #define DDL_PRECISION_LOW (0<<7)
  5211. #define DRAIN_LATENCY_MASK 0x7f
  5212. #define CBR1_VLV _MMIO(VLV_DISPLAY_BASE + 0x70400)
  5213. #define CBR_PND_DEADLINE_DISABLE (1<<31)
  5214. #define CBR_PWM_CLOCK_MUX_SELECT (1<<30)
  5215. #define CBR4_VLV _MMIO(VLV_DISPLAY_BASE + 0x70450)
  5216. #define CBR_DPLLBMD_PIPE(pipe) (1<<(7+(pipe)*11)) /* pipes B and C */
  5217. /* FIFO watermark sizes etc */
  5218. #define G4X_FIFO_LINE_SIZE 64
  5219. #define I915_FIFO_LINE_SIZE 64
  5220. #define I830_FIFO_LINE_SIZE 32
  5221. #define VALLEYVIEW_FIFO_SIZE 255
  5222. #define G4X_FIFO_SIZE 127
  5223. #define I965_FIFO_SIZE 512
  5224. #define I945_FIFO_SIZE 127
  5225. #define I915_FIFO_SIZE 95
  5226. #define I855GM_FIFO_SIZE 127 /* In cachelines */
  5227. #define I830_FIFO_SIZE 95
  5228. #define VALLEYVIEW_MAX_WM 0xff
  5229. #define G4X_MAX_WM 0x3f
  5230. #define I915_MAX_WM 0x3f
  5231. #define PINEVIEW_DISPLAY_FIFO 512 /* in 64byte unit */
  5232. #define PINEVIEW_FIFO_LINE_SIZE 64
  5233. #define PINEVIEW_MAX_WM 0x1ff
  5234. #define PINEVIEW_DFT_WM 0x3f
  5235. #define PINEVIEW_DFT_HPLLOFF_WM 0
  5236. #define PINEVIEW_GUARD_WM 10
  5237. #define PINEVIEW_CURSOR_FIFO 64
  5238. #define PINEVIEW_CURSOR_MAX_WM 0x3f
  5239. #define PINEVIEW_CURSOR_DFT_WM 0
  5240. #define PINEVIEW_CURSOR_GUARD_WM 5
  5241. #define VALLEYVIEW_CURSOR_MAX_WM 64
  5242. #define I965_CURSOR_FIFO 64
  5243. #define I965_CURSOR_MAX_WM 32
  5244. #define I965_CURSOR_DFT_WM 8
  5245. /* Watermark register definitions for SKL */
  5246. #define _CUR_WM_A_0 0x70140
  5247. #define _CUR_WM_B_0 0x71140
  5248. #define _PLANE_WM_1_A_0 0x70240
  5249. #define _PLANE_WM_1_B_0 0x71240
  5250. #define _PLANE_WM_2_A_0 0x70340
  5251. #define _PLANE_WM_2_B_0 0x71340
  5252. #define _PLANE_WM_TRANS_1_A_0 0x70268
  5253. #define _PLANE_WM_TRANS_1_B_0 0x71268
  5254. #define _PLANE_WM_TRANS_2_A_0 0x70368
  5255. #define _PLANE_WM_TRANS_2_B_0 0x71368
  5256. #define _CUR_WM_TRANS_A_0 0x70168
  5257. #define _CUR_WM_TRANS_B_0 0x71168
  5258. #define PLANE_WM_EN (1 << 31)
  5259. #define PLANE_WM_LINES_SHIFT 14
  5260. #define PLANE_WM_LINES_MASK 0x1f
  5261. #define PLANE_WM_BLOCKS_MASK 0x3ff
  5262. #define _CUR_WM_0(pipe) _PIPE(pipe, _CUR_WM_A_0, _CUR_WM_B_0)
  5263. #define CUR_WM(pipe, level) _MMIO(_CUR_WM_0(pipe) + ((4) * (level)))
  5264. #define CUR_WM_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_TRANS_A_0, _CUR_WM_TRANS_B_0)
  5265. #define _PLANE_WM_1(pipe) _PIPE(pipe, _PLANE_WM_1_A_0, _PLANE_WM_1_B_0)
  5266. #define _PLANE_WM_2(pipe) _PIPE(pipe, _PLANE_WM_2_A_0, _PLANE_WM_2_B_0)
  5267. #define _PLANE_WM_BASE(pipe, plane) \
  5268. _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe))
  5269. #define PLANE_WM(pipe, plane, level) \
  5270. _MMIO(_PLANE_WM_BASE(pipe, plane) + ((4) * (level)))
  5271. #define _PLANE_WM_TRANS_1(pipe) \
  5272. _PIPE(pipe, _PLANE_WM_TRANS_1_A_0, _PLANE_WM_TRANS_1_B_0)
  5273. #define _PLANE_WM_TRANS_2(pipe) \
  5274. _PIPE(pipe, _PLANE_WM_TRANS_2_A_0, _PLANE_WM_TRANS_2_B_0)
  5275. #define PLANE_WM_TRANS(pipe, plane) \
  5276. _MMIO(_PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)))
  5277. /* define the Watermark register on Ironlake */
  5278. #define WM0_PIPEA_ILK _MMIO(0x45100)
  5279. #define WM0_PIPE_PLANE_MASK (0xffff<<16)
  5280. #define WM0_PIPE_PLANE_SHIFT 16
  5281. #define WM0_PIPE_SPRITE_MASK (0xff<<8)
  5282. #define WM0_PIPE_SPRITE_SHIFT 8
  5283. #define WM0_PIPE_CURSOR_MASK (0xff)
  5284. #define WM0_PIPEB_ILK _MMIO(0x45104)
  5285. #define WM0_PIPEC_IVB _MMIO(0x45200)
  5286. #define WM1_LP_ILK _MMIO(0x45108)
  5287. #define WM1_LP_SR_EN (1<<31)
  5288. #define WM1_LP_LATENCY_SHIFT 24
  5289. #define WM1_LP_LATENCY_MASK (0x7f<<24)
  5290. #define WM1_LP_FBC_MASK (0xf<<20)
  5291. #define WM1_LP_FBC_SHIFT 20
  5292. #define WM1_LP_FBC_SHIFT_BDW 19
  5293. #define WM1_LP_SR_MASK (0x7ff<<8)
  5294. #define WM1_LP_SR_SHIFT 8
  5295. #define WM1_LP_CURSOR_MASK (0xff)
  5296. #define WM2_LP_ILK _MMIO(0x4510c)
  5297. #define WM2_LP_EN (1<<31)
  5298. #define WM3_LP_ILK _MMIO(0x45110)
  5299. #define WM3_LP_EN (1<<31)
  5300. #define WM1S_LP_ILK _MMIO(0x45120)
  5301. #define WM2S_LP_IVB _MMIO(0x45124)
  5302. #define WM3S_LP_IVB _MMIO(0x45128)
  5303. #define WM1S_LP_EN (1<<31)
  5304. #define HSW_WM_LP_VAL(lat, fbc, pri, cur) \
  5305. (WM3_LP_EN | ((lat) << WM1_LP_LATENCY_SHIFT) | \
  5306. ((fbc) << WM1_LP_FBC_SHIFT) | ((pri) << WM1_LP_SR_SHIFT) | (cur))
  5307. /* Memory latency timer register */
  5308. #define MLTR_ILK _MMIO(0x11222)
  5309. #define MLTR_WM1_SHIFT 0
  5310. #define MLTR_WM2_SHIFT 8
  5311. /* the unit of memory self-refresh latency time is 0.5us */
  5312. #define ILK_SRLT_MASK 0x3f
  5313. /* the address where we get all kinds of latency value */
  5314. #define SSKPD _MMIO(0x5d10)
  5315. #define SSKPD_WM_MASK 0x3f
  5316. #define SSKPD_WM0_SHIFT 0
  5317. #define SSKPD_WM1_SHIFT 8
  5318. #define SSKPD_WM2_SHIFT 16
  5319. #define SSKPD_WM3_SHIFT 24
  5320. /*
  5321. * The two pipe frame counter registers are not synchronized, so
  5322. * reading a stable value is somewhat tricky. The following code
  5323. * should work:
  5324. *
  5325. * do {
  5326. * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
  5327. * PIPE_FRAME_HIGH_SHIFT;
  5328. * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
  5329. * PIPE_FRAME_LOW_SHIFT);
  5330. * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
  5331. * PIPE_FRAME_HIGH_SHIFT);
  5332. * } while (high1 != high2);
  5333. * frame = (high1 << 8) | low1;
  5334. */
  5335. #define _PIPEAFRAMEHIGH 0x70040
  5336. #define PIPE_FRAME_HIGH_MASK 0x0000ffff
  5337. #define PIPE_FRAME_HIGH_SHIFT 0
  5338. #define _PIPEAFRAMEPIXEL 0x70044
  5339. #define PIPE_FRAME_LOW_MASK 0xff000000
  5340. #define PIPE_FRAME_LOW_SHIFT 24
  5341. #define PIPE_PIXEL_MASK 0x00ffffff
  5342. #define PIPE_PIXEL_SHIFT 0
  5343. /* GM45+ just has to be different */
  5344. #define _PIPEA_FRMCOUNT_G4X 0x70040
  5345. #define _PIPEA_FLIPCOUNT_G4X 0x70044
  5346. #define PIPE_FRMCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FRMCOUNT_G4X)
  5347. #define PIPE_FLIPCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FLIPCOUNT_G4X)
  5348. /* Cursor A & B regs */
  5349. #define _CURACNTR 0x70080
  5350. /* Old style CUR*CNTR flags (desktop 8xx) */
  5351. #define CURSOR_ENABLE 0x80000000
  5352. #define CURSOR_GAMMA_ENABLE 0x40000000
  5353. #define CURSOR_STRIDE_SHIFT 28
  5354. #define CURSOR_STRIDE(x) ((ffs(x)-9) << CURSOR_STRIDE_SHIFT) /* 256,512,1k,2k */
  5355. #define CURSOR_PIPE_CSC_ENABLE (1<<24)
  5356. #define CURSOR_FORMAT_SHIFT 24
  5357. #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
  5358. #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
  5359. #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
  5360. #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
  5361. #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
  5362. #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
  5363. /* New style CUR*CNTR flags */
  5364. #define CURSOR_MODE 0x27
  5365. #define CURSOR_MODE_DISABLE 0x00
  5366. #define CURSOR_MODE_128_32B_AX 0x02
  5367. #define CURSOR_MODE_256_32B_AX 0x03
  5368. #define CURSOR_MODE_64_32B_AX 0x07
  5369. #define CURSOR_MODE_128_ARGB_AX ((1 << 5) | CURSOR_MODE_128_32B_AX)
  5370. #define CURSOR_MODE_256_ARGB_AX ((1 << 5) | CURSOR_MODE_256_32B_AX)
  5371. #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
  5372. #define MCURSOR_PIPE_SELECT(pipe) ((pipe) << 28)
  5373. #define MCURSOR_GAMMA_ENABLE (1 << 26)
  5374. #define CURSOR_ROTATE_180 (1<<15)
  5375. #define CURSOR_TRICKLE_FEED_DISABLE (1 << 14)
  5376. #define _CURABASE 0x70084
  5377. #define _CURAPOS 0x70088
  5378. #define CURSOR_POS_MASK 0x007FF
  5379. #define CURSOR_POS_SIGN 0x8000
  5380. #define CURSOR_X_SHIFT 0
  5381. #define CURSOR_Y_SHIFT 16
  5382. #define CURSIZE _MMIO(0x700a0) /* 845/865 */
  5383. #define _CUR_FBC_CTL_A 0x700a0 /* ivb+ */
  5384. #define CUR_FBC_CTL_EN (1 << 31)
  5385. #define _CURASURFLIVE 0x700ac /* g4x+ */
  5386. #define _CURBCNTR 0x700c0
  5387. #define _CURBBASE 0x700c4
  5388. #define _CURBPOS 0x700c8
  5389. #define _CURBCNTR_IVB 0x71080
  5390. #define _CURBBASE_IVB 0x71084
  5391. #define _CURBPOS_IVB 0x71088
  5392. #define _CURSOR2(pipe, reg) _MMIO(dev_priv->info.cursor_offsets[(pipe)] - \
  5393. dev_priv->info.cursor_offsets[PIPE_A] + (reg) + \
  5394. dev_priv->info.display_mmio_offset)
  5395. #define CURCNTR(pipe) _CURSOR2(pipe, _CURACNTR)
  5396. #define CURBASE(pipe) _CURSOR2(pipe, _CURABASE)
  5397. #define CURPOS(pipe) _CURSOR2(pipe, _CURAPOS)
  5398. #define CUR_FBC_CTL(pipe) _CURSOR2(pipe, _CUR_FBC_CTL_A)
  5399. #define CURSURFLIVE(pipe) _CURSOR2(pipe, _CURASURFLIVE)
  5400. #define CURSOR_A_OFFSET 0x70080
  5401. #define CURSOR_B_OFFSET 0x700c0
  5402. #define CHV_CURSOR_C_OFFSET 0x700e0
  5403. #define IVB_CURSOR_B_OFFSET 0x71080
  5404. #define IVB_CURSOR_C_OFFSET 0x72080
  5405. /* Display A control */
  5406. #define _DSPACNTR 0x70180
  5407. #define DISPLAY_PLANE_ENABLE (1<<31)
  5408. #define DISPLAY_PLANE_DISABLE 0
  5409. #define DISPPLANE_GAMMA_ENABLE (1<<30)
  5410. #define DISPPLANE_GAMMA_DISABLE 0
  5411. #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
  5412. #define DISPPLANE_YUV422 (0x0<<26)
  5413. #define DISPPLANE_8BPP (0x2<<26)
  5414. #define DISPPLANE_BGRA555 (0x3<<26)
  5415. #define DISPPLANE_BGRX555 (0x4<<26)
  5416. #define DISPPLANE_BGRX565 (0x5<<26)
  5417. #define DISPPLANE_BGRX888 (0x6<<26)
  5418. #define DISPPLANE_BGRA888 (0x7<<26)
  5419. #define DISPPLANE_RGBX101010 (0x8<<26)
  5420. #define DISPPLANE_RGBA101010 (0x9<<26)
  5421. #define DISPPLANE_BGRX101010 (0xa<<26)
  5422. #define DISPPLANE_RGBX161616 (0xc<<26)
  5423. #define DISPPLANE_RGBX888 (0xe<<26)
  5424. #define DISPPLANE_RGBA888 (0xf<<26)
  5425. #define DISPPLANE_STEREO_ENABLE (1<<25)
  5426. #define DISPPLANE_STEREO_DISABLE 0
  5427. #define DISPPLANE_PIPE_CSC_ENABLE (1<<24)
  5428. #define DISPPLANE_SEL_PIPE_SHIFT 24
  5429. #define DISPPLANE_SEL_PIPE_MASK (3<<DISPPLANE_SEL_PIPE_SHIFT)
  5430. #define DISPPLANE_SEL_PIPE(pipe) ((pipe)<<DISPPLANE_SEL_PIPE_SHIFT)
  5431. #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
  5432. #define DISPPLANE_SRC_KEY_DISABLE 0
  5433. #define DISPPLANE_LINE_DOUBLE (1<<20)
  5434. #define DISPPLANE_NO_LINE_DOUBLE 0
  5435. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  5436. #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
  5437. #define DISPPLANE_ALPHA_PREMULTIPLY (1<<16) /* CHV pipe B */
  5438. #define DISPPLANE_ROTATE_180 (1<<15)
  5439. #define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* Ironlake */
  5440. #define DISPPLANE_TILED (1<<10)
  5441. #define DISPPLANE_MIRROR (1<<8) /* CHV pipe B */
  5442. #define _DSPAADDR 0x70184
  5443. #define _DSPASTRIDE 0x70188
  5444. #define _DSPAPOS 0x7018C /* reserved */
  5445. #define _DSPASIZE 0x70190
  5446. #define _DSPASURF 0x7019C /* 965+ only */
  5447. #define _DSPATILEOFF 0x701A4 /* 965+ only */
  5448. #define _DSPAOFFSET 0x701A4 /* HSW */
  5449. #define _DSPASURFLIVE 0x701AC
  5450. #define DSPCNTR(plane) _MMIO_PIPE2(plane, _DSPACNTR)
  5451. #define DSPADDR(plane) _MMIO_PIPE2(plane, _DSPAADDR)
  5452. #define DSPSTRIDE(plane) _MMIO_PIPE2(plane, _DSPASTRIDE)
  5453. #define DSPPOS(plane) _MMIO_PIPE2(plane, _DSPAPOS)
  5454. #define DSPSIZE(plane) _MMIO_PIPE2(plane, _DSPASIZE)
  5455. #define DSPSURF(plane) _MMIO_PIPE2(plane, _DSPASURF)
  5456. #define DSPTILEOFF(plane) _MMIO_PIPE2(plane, _DSPATILEOFF)
  5457. #define DSPLINOFF(plane) DSPADDR(plane)
  5458. #define DSPOFFSET(plane) _MMIO_PIPE2(plane, _DSPAOFFSET)
  5459. #define DSPSURFLIVE(plane) _MMIO_PIPE2(plane, _DSPASURFLIVE)
  5460. /* CHV pipe B blender and primary plane */
  5461. #define _CHV_BLEND_A 0x60a00
  5462. #define CHV_BLEND_LEGACY (0<<30)
  5463. #define CHV_BLEND_ANDROID (1<<30)
  5464. #define CHV_BLEND_MPO (2<<30)
  5465. #define CHV_BLEND_MASK (3<<30)
  5466. #define _CHV_CANVAS_A 0x60a04
  5467. #define _PRIMPOS_A 0x60a08
  5468. #define _PRIMSIZE_A 0x60a0c
  5469. #define _PRIMCNSTALPHA_A 0x60a10
  5470. #define PRIM_CONST_ALPHA_ENABLE (1<<31)
  5471. #define CHV_BLEND(pipe) _MMIO_TRANS2(pipe, _CHV_BLEND_A)
  5472. #define CHV_CANVAS(pipe) _MMIO_TRANS2(pipe, _CHV_CANVAS_A)
  5473. #define PRIMPOS(plane) _MMIO_TRANS2(plane, _PRIMPOS_A)
  5474. #define PRIMSIZE(plane) _MMIO_TRANS2(plane, _PRIMSIZE_A)
  5475. #define PRIMCNSTALPHA(plane) _MMIO_TRANS2(plane, _PRIMCNSTALPHA_A)
  5476. /* Display/Sprite base address macros */
  5477. #define DISP_BASEADDR_MASK (0xfffff000)
  5478. #define I915_LO_DISPBASE(val) (val & ~DISP_BASEADDR_MASK)
  5479. #define I915_HI_DISPBASE(val) (val & DISP_BASEADDR_MASK)
  5480. /*
  5481. * VBIOS flags
  5482. * gen2:
  5483. * [00:06] alm,mgm
  5484. * [10:16] all
  5485. * [30:32] alm,mgm
  5486. * gen3+:
  5487. * [00:0f] all
  5488. * [10:1f] all
  5489. * [30:32] all
  5490. */
  5491. #define SWF0(i) _MMIO(dev_priv->info.display_mmio_offset + 0x70410 + (i) * 4)
  5492. #define SWF1(i) _MMIO(dev_priv->info.display_mmio_offset + 0x71410 + (i) * 4)
  5493. #define SWF3(i) _MMIO(dev_priv->info.display_mmio_offset + 0x72414 + (i) * 4)
  5494. #define SWF_ILK(i) _MMIO(0x4F000 + (i) * 4)
  5495. /* Pipe B */
  5496. #define _PIPEBDSL (dev_priv->info.display_mmio_offset + 0x71000)
  5497. #define _PIPEBCONF (dev_priv->info.display_mmio_offset + 0x71008)
  5498. #define _PIPEBSTAT (dev_priv->info.display_mmio_offset + 0x71024)
  5499. #define _PIPEBFRAMEHIGH 0x71040
  5500. #define _PIPEBFRAMEPIXEL 0x71044
  5501. #define _PIPEB_FRMCOUNT_G4X (dev_priv->info.display_mmio_offset + 0x71040)
  5502. #define _PIPEB_FLIPCOUNT_G4X (dev_priv->info.display_mmio_offset + 0x71044)
  5503. /* Display B control */
  5504. #define _DSPBCNTR (dev_priv->info.display_mmio_offset + 0x71180)
  5505. #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
  5506. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  5507. #define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
  5508. #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
  5509. #define _DSPBADDR (dev_priv->info.display_mmio_offset + 0x71184)
  5510. #define _DSPBSTRIDE (dev_priv->info.display_mmio_offset + 0x71188)
  5511. #define _DSPBPOS (dev_priv->info.display_mmio_offset + 0x7118C)
  5512. #define _DSPBSIZE (dev_priv->info.display_mmio_offset + 0x71190)
  5513. #define _DSPBSURF (dev_priv->info.display_mmio_offset + 0x7119C)
  5514. #define _DSPBTILEOFF (dev_priv->info.display_mmio_offset + 0x711A4)
  5515. #define _DSPBOFFSET (dev_priv->info.display_mmio_offset + 0x711A4)
  5516. #define _DSPBSURFLIVE (dev_priv->info.display_mmio_offset + 0x711AC)
  5517. /* Sprite A control */
  5518. #define _DVSACNTR 0x72180
  5519. #define DVS_ENABLE (1<<31)
  5520. #define DVS_GAMMA_ENABLE (1<<30)
  5521. #define DVS_YUV_RANGE_CORRECTION_DISABLE (1<<27)
  5522. #define DVS_PIXFORMAT_MASK (3<<25)
  5523. #define DVS_FORMAT_YUV422 (0<<25)
  5524. #define DVS_FORMAT_RGBX101010 (1<<25)
  5525. #define DVS_FORMAT_RGBX888 (2<<25)
  5526. #define DVS_FORMAT_RGBX161616 (3<<25)
  5527. #define DVS_PIPE_CSC_ENABLE (1<<24)
  5528. #define DVS_SOURCE_KEY (1<<22)
  5529. #define DVS_RGB_ORDER_XBGR (1<<20)
  5530. #define DVS_YUV_FORMAT_BT709 (1<<18)
  5531. #define DVS_YUV_BYTE_ORDER_MASK (3<<16)
  5532. #define DVS_YUV_ORDER_YUYV (0<<16)
  5533. #define DVS_YUV_ORDER_UYVY (1<<16)
  5534. #define DVS_YUV_ORDER_YVYU (2<<16)
  5535. #define DVS_YUV_ORDER_VYUY (3<<16)
  5536. #define DVS_ROTATE_180 (1<<15)
  5537. #define DVS_DEST_KEY (1<<2)
  5538. #define DVS_TRICKLE_FEED_DISABLE (1<<14)
  5539. #define DVS_TILED (1<<10)
  5540. #define _DVSALINOFF 0x72184
  5541. #define _DVSASTRIDE 0x72188
  5542. #define _DVSAPOS 0x7218c
  5543. #define _DVSASIZE 0x72190
  5544. #define _DVSAKEYVAL 0x72194
  5545. #define _DVSAKEYMSK 0x72198
  5546. #define _DVSASURF 0x7219c
  5547. #define _DVSAKEYMAXVAL 0x721a0
  5548. #define _DVSATILEOFF 0x721a4
  5549. #define _DVSASURFLIVE 0x721ac
  5550. #define _DVSASCALE 0x72204
  5551. #define DVS_SCALE_ENABLE (1<<31)
  5552. #define DVS_FILTER_MASK (3<<29)
  5553. #define DVS_FILTER_MEDIUM (0<<29)
  5554. #define DVS_FILTER_ENHANCING (1<<29)
  5555. #define DVS_FILTER_SOFTENING (2<<29)
  5556. #define DVS_VERTICAL_OFFSET_HALF (1<<28) /* must be enabled below */
  5557. #define DVS_VERTICAL_OFFSET_ENABLE (1<<27)
  5558. #define _DVSAGAMC 0x72300
  5559. #define _DVSBCNTR 0x73180
  5560. #define _DVSBLINOFF 0x73184
  5561. #define _DVSBSTRIDE 0x73188
  5562. #define _DVSBPOS 0x7318c
  5563. #define _DVSBSIZE 0x73190
  5564. #define _DVSBKEYVAL 0x73194
  5565. #define _DVSBKEYMSK 0x73198
  5566. #define _DVSBSURF 0x7319c
  5567. #define _DVSBKEYMAXVAL 0x731a0
  5568. #define _DVSBTILEOFF 0x731a4
  5569. #define _DVSBSURFLIVE 0x731ac
  5570. #define _DVSBSCALE 0x73204
  5571. #define _DVSBGAMC 0x73300
  5572. #define DVSCNTR(pipe) _MMIO_PIPE(pipe, _DVSACNTR, _DVSBCNTR)
  5573. #define DVSLINOFF(pipe) _MMIO_PIPE(pipe, _DVSALINOFF, _DVSBLINOFF)
  5574. #define DVSSTRIDE(pipe) _MMIO_PIPE(pipe, _DVSASTRIDE, _DVSBSTRIDE)
  5575. #define DVSPOS(pipe) _MMIO_PIPE(pipe, _DVSAPOS, _DVSBPOS)
  5576. #define DVSSURF(pipe) _MMIO_PIPE(pipe, _DVSASURF, _DVSBSURF)
  5577. #define DVSKEYMAX(pipe) _MMIO_PIPE(pipe, _DVSAKEYMAXVAL, _DVSBKEYMAXVAL)
  5578. #define DVSSIZE(pipe) _MMIO_PIPE(pipe, _DVSASIZE, _DVSBSIZE)
  5579. #define DVSSCALE(pipe) _MMIO_PIPE(pipe, _DVSASCALE, _DVSBSCALE)
  5580. #define DVSTILEOFF(pipe) _MMIO_PIPE(pipe, _DVSATILEOFF, _DVSBTILEOFF)
  5581. #define DVSKEYVAL(pipe) _MMIO_PIPE(pipe, _DVSAKEYVAL, _DVSBKEYVAL)
  5582. #define DVSKEYMSK(pipe) _MMIO_PIPE(pipe, _DVSAKEYMSK, _DVSBKEYMSK)
  5583. #define DVSSURFLIVE(pipe) _MMIO_PIPE(pipe, _DVSASURFLIVE, _DVSBSURFLIVE)
  5584. #define _SPRA_CTL 0x70280
  5585. #define SPRITE_ENABLE (1<<31)
  5586. #define SPRITE_GAMMA_ENABLE (1<<30)
  5587. #define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1<<28)
  5588. #define SPRITE_PIXFORMAT_MASK (7<<25)
  5589. #define SPRITE_FORMAT_YUV422 (0<<25)
  5590. #define SPRITE_FORMAT_RGBX101010 (1<<25)
  5591. #define SPRITE_FORMAT_RGBX888 (2<<25)
  5592. #define SPRITE_FORMAT_RGBX161616 (3<<25)
  5593. #define SPRITE_FORMAT_YUV444 (4<<25)
  5594. #define SPRITE_FORMAT_XR_BGR101010 (5<<25) /* Extended range */
  5595. #define SPRITE_PIPE_CSC_ENABLE (1<<24)
  5596. #define SPRITE_SOURCE_KEY (1<<22)
  5597. #define SPRITE_RGB_ORDER_RGBX (1<<20) /* only for 888 and 161616 */
  5598. #define SPRITE_YUV_TO_RGB_CSC_DISABLE (1<<19)
  5599. #define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1<<18) /* 0 is BT601 */
  5600. #define SPRITE_YUV_BYTE_ORDER_MASK (3<<16)
  5601. #define SPRITE_YUV_ORDER_YUYV (0<<16)
  5602. #define SPRITE_YUV_ORDER_UYVY (1<<16)
  5603. #define SPRITE_YUV_ORDER_YVYU (2<<16)
  5604. #define SPRITE_YUV_ORDER_VYUY (3<<16)
  5605. #define SPRITE_ROTATE_180 (1<<15)
  5606. #define SPRITE_TRICKLE_FEED_DISABLE (1<<14)
  5607. #define SPRITE_INT_GAMMA_ENABLE (1<<13)
  5608. #define SPRITE_TILED (1<<10)
  5609. #define SPRITE_DEST_KEY (1<<2)
  5610. #define _SPRA_LINOFF 0x70284
  5611. #define _SPRA_STRIDE 0x70288
  5612. #define _SPRA_POS 0x7028c
  5613. #define _SPRA_SIZE 0x70290
  5614. #define _SPRA_KEYVAL 0x70294
  5615. #define _SPRA_KEYMSK 0x70298
  5616. #define _SPRA_SURF 0x7029c
  5617. #define _SPRA_KEYMAX 0x702a0
  5618. #define _SPRA_TILEOFF 0x702a4
  5619. #define _SPRA_OFFSET 0x702a4
  5620. #define _SPRA_SURFLIVE 0x702ac
  5621. #define _SPRA_SCALE 0x70304
  5622. #define SPRITE_SCALE_ENABLE (1<<31)
  5623. #define SPRITE_FILTER_MASK (3<<29)
  5624. #define SPRITE_FILTER_MEDIUM (0<<29)
  5625. #define SPRITE_FILTER_ENHANCING (1<<29)
  5626. #define SPRITE_FILTER_SOFTENING (2<<29)
  5627. #define SPRITE_VERTICAL_OFFSET_HALF (1<<28) /* must be enabled below */
  5628. #define SPRITE_VERTICAL_OFFSET_ENABLE (1<<27)
  5629. #define _SPRA_GAMC 0x70400
  5630. #define _SPRB_CTL 0x71280
  5631. #define _SPRB_LINOFF 0x71284
  5632. #define _SPRB_STRIDE 0x71288
  5633. #define _SPRB_POS 0x7128c
  5634. #define _SPRB_SIZE 0x71290
  5635. #define _SPRB_KEYVAL 0x71294
  5636. #define _SPRB_KEYMSK 0x71298
  5637. #define _SPRB_SURF 0x7129c
  5638. #define _SPRB_KEYMAX 0x712a0
  5639. #define _SPRB_TILEOFF 0x712a4
  5640. #define _SPRB_OFFSET 0x712a4
  5641. #define _SPRB_SURFLIVE 0x712ac
  5642. #define _SPRB_SCALE 0x71304
  5643. #define _SPRB_GAMC 0x71400
  5644. #define SPRCTL(pipe) _MMIO_PIPE(pipe, _SPRA_CTL, _SPRB_CTL)
  5645. #define SPRLINOFF(pipe) _MMIO_PIPE(pipe, _SPRA_LINOFF, _SPRB_LINOFF)
  5646. #define SPRSTRIDE(pipe) _MMIO_PIPE(pipe, _SPRA_STRIDE, _SPRB_STRIDE)
  5647. #define SPRPOS(pipe) _MMIO_PIPE(pipe, _SPRA_POS, _SPRB_POS)
  5648. #define SPRSIZE(pipe) _MMIO_PIPE(pipe, _SPRA_SIZE, _SPRB_SIZE)
  5649. #define SPRKEYVAL(pipe) _MMIO_PIPE(pipe, _SPRA_KEYVAL, _SPRB_KEYVAL)
  5650. #define SPRKEYMSK(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMSK, _SPRB_KEYMSK)
  5651. #define SPRSURF(pipe) _MMIO_PIPE(pipe, _SPRA_SURF, _SPRB_SURF)
  5652. #define SPRKEYMAX(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMAX, _SPRB_KEYMAX)
  5653. #define SPRTILEOFF(pipe) _MMIO_PIPE(pipe, _SPRA_TILEOFF, _SPRB_TILEOFF)
  5654. #define SPROFFSET(pipe) _MMIO_PIPE(pipe, _SPRA_OFFSET, _SPRB_OFFSET)
  5655. #define SPRSCALE(pipe) _MMIO_PIPE(pipe, _SPRA_SCALE, _SPRB_SCALE)
  5656. #define SPRGAMC(pipe) _MMIO_PIPE(pipe, _SPRA_GAMC, _SPRB_GAMC)
  5657. #define SPRSURFLIVE(pipe) _MMIO_PIPE(pipe, _SPRA_SURFLIVE, _SPRB_SURFLIVE)
  5658. #define _SPACNTR (VLV_DISPLAY_BASE + 0x72180)
  5659. #define SP_ENABLE (1<<31)
  5660. #define SP_GAMMA_ENABLE (1<<30)
  5661. #define SP_PIXFORMAT_MASK (0xf<<26)
  5662. #define SP_FORMAT_YUV422 (0<<26)
  5663. #define SP_FORMAT_BGR565 (5<<26)
  5664. #define SP_FORMAT_BGRX8888 (6<<26)
  5665. #define SP_FORMAT_BGRA8888 (7<<26)
  5666. #define SP_FORMAT_RGBX1010102 (8<<26)
  5667. #define SP_FORMAT_RGBA1010102 (9<<26)
  5668. #define SP_FORMAT_RGBX8888 (0xe<<26)
  5669. #define SP_FORMAT_RGBA8888 (0xf<<26)
  5670. #define SP_ALPHA_PREMULTIPLY (1<<23) /* CHV pipe B */
  5671. #define SP_SOURCE_KEY (1<<22)
  5672. #define SP_YUV_FORMAT_BT709 (1<<18)
  5673. #define SP_YUV_BYTE_ORDER_MASK (3<<16)
  5674. #define SP_YUV_ORDER_YUYV (0<<16)
  5675. #define SP_YUV_ORDER_UYVY (1<<16)
  5676. #define SP_YUV_ORDER_YVYU (2<<16)
  5677. #define SP_YUV_ORDER_VYUY (3<<16)
  5678. #define SP_ROTATE_180 (1<<15)
  5679. #define SP_TILED (1<<10)
  5680. #define SP_MIRROR (1<<8) /* CHV pipe B */
  5681. #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184)
  5682. #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188)
  5683. #define _SPAPOS (VLV_DISPLAY_BASE + 0x7218c)
  5684. #define _SPASIZE (VLV_DISPLAY_BASE + 0x72190)
  5685. #define _SPAKEYMINVAL (VLV_DISPLAY_BASE + 0x72194)
  5686. #define _SPAKEYMSK (VLV_DISPLAY_BASE + 0x72198)
  5687. #define _SPASURF (VLV_DISPLAY_BASE + 0x7219c)
  5688. #define _SPAKEYMAXVAL (VLV_DISPLAY_BASE + 0x721a0)
  5689. #define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4)
  5690. #define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8)
  5691. #define SP_CONST_ALPHA_ENABLE (1<<31)
  5692. #define _SPACLRC0 (VLV_DISPLAY_BASE + 0x721d0)
  5693. #define SP_CONTRAST(x) ((x) << 18) /* u3.6 */
  5694. #define SP_BRIGHTNESS(x) ((x) & 0xff) /* s8 */
  5695. #define _SPACLRC1 (VLV_DISPLAY_BASE + 0x721d4)
  5696. #define SP_SH_SIN(x) (((x) & 0x7ff) << 16) /* s4.7 */
  5697. #define SP_SH_COS(x) (x) /* u3.7 */
  5698. #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721f4)
  5699. #define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280)
  5700. #define _SPBLINOFF (VLV_DISPLAY_BASE + 0x72284)
  5701. #define _SPBSTRIDE (VLV_DISPLAY_BASE + 0x72288)
  5702. #define _SPBPOS (VLV_DISPLAY_BASE + 0x7228c)
  5703. #define _SPBSIZE (VLV_DISPLAY_BASE + 0x72290)
  5704. #define _SPBKEYMINVAL (VLV_DISPLAY_BASE + 0x72294)
  5705. #define _SPBKEYMSK (VLV_DISPLAY_BASE + 0x72298)
  5706. #define _SPBSURF (VLV_DISPLAY_BASE + 0x7229c)
  5707. #define _SPBKEYMAXVAL (VLV_DISPLAY_BASE + 0x722a0)
  5708. #define _SPBTILEOFF (VLV_DISPLAY_BASE + 0x722a4)
  5709. #define _SPBCONSTALPHA (VLV_DISPLAY_BASE + 0x722a8)
  5710. #define _SPBCLRC0 (VLV_DISPLAY_BASE + 0x722d0)
  5711. #define _SPBCLRC1 (VLV_DISPLAY_BASE + 0x722d4)
  5712. #define _SPBGAMC (VLV_DISPLAY_BASE + 0x722f4)
  5713. #define _MMIO_VLV_SPR(pipe, plane_id, reg_a, reg_b) \
  5714. _MMIO_PIPE((pipe) * 2 + (plane_id) - PLANE_SPRITE0, (reg_a), (reg_b))
  5715. #define SPCNTR(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACNTR, _SPBCNTR)
  5716. #define SPLINOFF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPALINOFF, _SPBLINOFF)
  5717. #define SPSTRIDE(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASTRIDE, _SPBSTRIDE)
  5718. #define SPPOS(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAPOS, _SPBPOS)
  5719. #define SPSIZE(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASIZE, _SPBSIZE)
  5720. #define SPKEYMINVAL(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMINVAL, _SPBKEYMINVAL)
  5721. #define SPKEYMSK(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMSK, _SPBKEYMSK)
  5722. #define SPSURF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPASURF, _SPBSURF)
  5723. #define SPKEYMAXVAL(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMAXVAL, _SPBKEYMAXVAL)
  5724. #define SPTILEOFF(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPATILEOFF, _SPBTILEOFF)
  5725. #define SPCONSTALPHA(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACONSTALPHA, _SPBCONSTALPHA)
  5726. #define SPCLRC0(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC0, _SPBCLRC0)
  5727. #define SPCLRC1(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC1, _SPBCLRC1)
  5728. #define SPGAMC(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAGAMC, _SPBGAMC)
  5729. /*
  5730. * CHV pipe B sprite CSC
  5731. *
  5732. * |cr| |c0 c1 c2| |cr + cr_ioff| |cr_ooff|
  5733. * |yg| = |c3 c4 c5| x |yg + yg_ioff| + |yg_ooff|
  5734. * |cb| |c6 c7 c8| |cb + cr_ioff| |cb_ooff|
  5735. */
  5736. #define _MMIO_CHV_SPCSC(plane_id, reg) \
  5737. _MMIO(VLV_DISPLAY_BASE + ((plane_id) - PLANE_SPRITE0) * 0x1000 + (reg))
  5738. #define SPCSCYGOFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d900)
  5739. #define SPCSCCBOFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d904)
  5740. #define SPCSCCROFF(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d908)
  5741. #define SPCSC_OOFF(x) (((x) & 0x7ff) << 16) /* s11 */
  5742. #define SPCSC_IOFF(x) (((x) & 0x7ff) << 0) /* s11 */
  5743. #define SPCSCC01(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d90c)
  5744. #define SPCSCC23(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d910)
  5745. #define SPCSCC45(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d914)
  5746. #define SPCSCC67(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d918)
  5747. #define SPCSCC8(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d91c)
  5748. #define SPCSC_C1(x) (((x) & 0x7fff) << 16) /* s3.12 */
  5749. #define SPCSC_C0(x) (((x) & 0x7fff) << 0) /* s3.12 */
  5750. #define SPCSCYGICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d920)
  5751. #define SPCSCCBICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d924)
  5752. #define SPCSCCRICLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d928)
  5753. #define SPCSC_IMAX(x) (((x) & 0x7ff) << 16) /* s11 */
  5754. #define SPCSC_IMIN(x) (((x) & 0x7ff) << 0) /* s11 */
  5755. #define SPCSCYGOCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d92c)
  5756. #define SPCSCCBOCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d930)
  5757. #define SPCSCCROCLAMP(plane_id) _MMIO_CHV_SPCSC(plane_id, 0x6d934)
  5758. #define SPCSC_OMAX(x) ((x) << 16) /* u10 */
  5759. #define SPCSC_OMIN(x) ((x) << 0) /* u10 */
  5760. /* Skylake plane registers */
  5761. #define _PLANE_CTL_1_A 0x70180
  5762. #define _PLANE_CTL_2_A 0x70280
  5763. #define _PLANE_CTL_3_A 0x70380
  5764. #define PLANE_CTL_ENABLE (1 << 31)
  5765. #define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) /* Pre-GLK */
  5766. #define PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
  5767. /*
  5768. * ICL+ uses the same PLANE_CTL_FORMAT bits, but the field definition
  5769. * expanded to include bit 23 as well. However, the shift-24 based values
  5770. * correctly map to the same formats in ICL, as long as bit 23 is set to 0
  5771. */
  5772. #define PLANE_CTL_FORMAT_MASK (0xf << 24)
  5773. #define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)
  5774. #define PLANE_CTL_FORMAT_NV12 ( 1 << 24)
  5775. #define PLANE_CTL_FORMAT_XRGB_2101010 ( 2 << 24)
  5776. #define PLANE_CTL_FORMAT_XRGB_8888 ( 4 << 24)
  5777. #define PLANE_CTL_FORMAT_XRGB_16161616F ( 6 << 24)
  5778. #define PLANE_CTL_FORMAT_AYUV ( 8 << 24)
  5779. #define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)
  5780. #define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24)
  5781. #define ICL_PLANE_CTL_FORMAT_MASK (0x1f << 23)
  5782. #define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) /* Pre-GLK */
  5783. #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)
  5784. #define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)
  5785. #define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)
  5786. #define PLANE_CTL_ORDER_BGRX (0 << 20)
  5787. #define PLANE_CTL_ORDER_RGBX (1 << 20)
  5788. #define PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 (1 << 18)
  5789. #define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16)
  5790. #define PLANE_CTL_YUV422_YUYV ( 0 << 16)
  5791. #define PLANE_CTL_YUV422_UYVY ( 1 << 16)
  5792. #define PLANE_CTL_YUV422_YVYU ( 2 << 16)
  5793. #define PLANE_CTL_YUV422_VYUY ( 3 << 16)
  5794. #define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)
  5795. #define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14)
  5796. #define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) /* Pre-GLK */
  5797. #define PLANE_CTL_TILED_MASK (0x7 << 10)
  5798. #define PLANE_CTL_TILED_LINEAR ( 0 << 10)
  5799. #define PLANE_CTL_TILED_X ( 1 << 10)
  5800. #define PLANE_CTL_TILED_Y ( 4 << 10)
  5801. #define PLANE_CTL_TILED_YF ( 5 << 10)
  5802. #define PLANE_CTL_FLIP_HORIZONTAL ( 1 << 8)
  5803. #define PLANE_CTL_ALPHA_MASK (0x3 << 4) /* Pre-GLK */
  5804. #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)
  5805. #define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)
  5806. #define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)
  5807. #define PLANE_CTL_ROTATE_MASK 0x3
  5808. #define PLANE_CTL_ROTATE_0 0x0
  5809. #define PLANE_CTL_ROTATE_90 0x1
  5810. #define PLANE_CTL_ROTATE_180 0x2
  5811. #define PLANE_CTL_ROTATE_270 0x3
  5812. #define _PLANE_STRIDE_1_A 0x70188
  5813. #define _PLANE_STRIDE_2_A 0x70288
  5814. #define _PLANE_STRIDE_3_A 0x70388
  5815. #define _PLANE_POS_1_A 0x7018c
  5816. #define _PLANE_POS_2_A 0x7028c
  5817. #define _PLANE_POS_3_A 0x7038c
  5818. #define _PLANE_SIZE_1_A 0x70190
  5819. #define _PLANE_SIZE_2_A 0x70290
  5820. #define _PLANE_SIZE_3_A 0x70390
  5821. #define _PLANE_SURF_1_A 0x7019c
  5822. #define _PLANE_SURF_2_A 0x7029c
  5823. #define _PLANE_SURF_3_A 0x7039c
  5824. #define _PLANE_OFFSET_1_A 0x701a4
  5825. #define _PLANE_OFFSET_2_A 0x702a4
  5826. #define _PLANE_OFFSET_3_A 0x703a4
  5827. #define _PLANE_KEYVAL_1_A 0x70194
  5828. #define _PLANE_KEYVAL_2_A 0x70294
  5829. #define _PLANE_KEYMSK_1_A 0x70198
  5830. #define _PLANE_KEYMSK_2_A 0x70298
  5831. #define _PLANE_KEYMAX_1_A 0x701a0
  5832. #define _PLANE_KEYMAX_2_A 0x702a0
  5833. #define _PLANE_AUX_DIST_1_A 0x701c0
  5834. #define _PLANE_AUX_DIST_2_A 0x702c0
  5835. #define _PLANE_AUX_OFFSET_1_A 0x701c4
  5836. #define _PLANE_AUX_OFFSET_2_A 0x702c4
  5837. #define _PLANE_COLOR_CTL_1_A 0x701CC /* GLK+ */
  5838. #define _PLANE_COLOR_CTL_2_A 0x702CC /* GLK+ */
  5839. #define _PLANE_COLOR_CTL_3_A 0x703CC /* GLK+ */
  5840. #define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30) /* Pre-ICL */
  5841. #define PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
  5842. #define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23) /* Pre-ICL */
  5843. #define PLANE_COLOR_CSC_MODE_BYPASS (0 << 17)
  5844. #define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 (1 << 17)
  5845. #define PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 (2 << 17)
  5846. #define PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020 (3 << 17)
  5847. #define PLANE_COLOR_CSC_MODE_RGB709_TO_RGB2020 (4 << 17)
  5848. #define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13)
  5849. #define PLANE_COLOR_ALPHA_MASK (0x3 << 4)
  5850. #define PLANE_COLOR_ALPHA_DISABLE (0 << 4)
  5851. #define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4)
  5852. #define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)
  5853. #define _PLANE_BUF_CFG_1_A 0x7027c
  5854. #define _PLANE_BUF_CFG_2_A 0x7037c
  5855. #define _PLANE_NV12_BUF_CFG_1_A 0x70278
  5856. #define _PLANE_NV12_BUF_CFG_2_A 0x70378
  5857. #define _PLANE_CTL_1_B 0x71180
  5858. #define _PLANE_CTL_2_B 0x71280
  5859. #define _PLANE_CTL_3_B 0x71380
  5860. #define _PLANE_CTL_1(pipe) _PIPE(pipe, _PLANE_CTL_1_A, _PLANE_CTL_1_B)
  5861. #define _PLANE_CTL_2(pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B)
  5862. #define _PLANE_CTL_3(pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B)
  5863. #define PLANE_CTL(pipe, plane) \
  5864. _MMIO_PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe))
  5865. #define _PLANE_STRIDE_1_B 0x71188
  5866. #define _PLANE_STRIDE_2_B 0x71288
  5867. #define _PLANE_STRIDE_3_B 0x71388
  5868. #define _PLANE_STRIDE_1(pipe) \
  5869. _PIPE(pipe, _PLANE_STRIDE_1_A, _PLANE_STRIDE_1_B)
  5870. #define _PLANE_STRIDE_2(pipe) \
  5871. _PIPE(pipe, _PLANE_STRIDE_2_A, _PLANE_STRIDE_2_B)
  5872. #define _PLANE_STRIDE_3(pipe) \
  5873. _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B)
  5874. #define PLANE_STRIDE(pipe, plane) \
  5875. _MMIO_PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe))
  5876. #define _PLANE_POS_1_B 0x7118c
  5877. #define _PLANE_POS_2_B 0x7128c
  5878. #define _PLANE_POS_3_B 0x7138c
  5879. #define _PLANE_POS_1(pipe) _PIPE(pipe, _PLANE_POS_1_A, _PLANE_POS_1_B)
  5880. #define _PLANE_POS_2(pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B)
  5881. #define _PLANE_POS_3(pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B)
  5882. #define PLANE_POS(pipe, plane) \
  5883. _MMIO_PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe))
  5884. #define _PLANE_SIZE_1_B 0x71190
  5885. #define _PLANE_SIZE_2_B 0x71290
  5886. #define _PLANE_SIZE_3_B 0x71390
  5887. #define _PLANE_SIZE_1(pipe) _PIPE(pipe, _PLANE_SIZE_1_A, _PLANE_SIZE_1_B)
  5888. #define _PLANE_SIZE_2(pipe) _PIPE(pipe, _PLANE_SIZE_2_A, _PLANE_SIZE_2_B)
  5889. #define _PLANE_SIZE_3(pipe) _PIPE(pipe, _PLANE_SIZE_3_A, _PLANE_SIZE_3_B)
  5890. #define PLANE_SIZE(pipe, plane) \
  5891. _MMIO_PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe))
  5892. #define _PLANE_SURF_1_B 0x7119c
  5893. #define _PLANE_SURF_2_B 0x7129c
  5894. #define _PLANE_SURF_3_B 0x7139c
  5895. #define _PLANE_SURF_1(pipe) _PIPE(pipe, _PLANE_SURF_1_A, _PLANE_SURF_1_B)
  5896. #define _PLANE_SURF_2(pipe) _PIPE(pipe, _PLANE_SURF_2_A, _PLANE_SURF_2_B)
  5897. #define _PLANE_SURF_3(pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B)
  5898. #define PLANE_SURF(pipe, plane) \
  5899. _MMIO_PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe))
  5900. #define _PLANE_OFFSET_1_B 0x711a4
  5901. #define _PLANE_OFFSET_2_B 0x712a4
  5902. #define _PLANE_OFFSET_1(pipe) _PIPE(pipe, _PLANE_OFFSET_1_A, _PLANE_OFFSET_1_B)
  5903. #define _PLANE_OFFSET_2(pipe) _PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B)
  5904. #define PLANE_OFFSET(pipe, plane) \
  5905. _MMIO_PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe))
  5906. #define _PLANE_KEYVAL_1_B 0x71194
  5907. #define _PLANE_KEYVAL_2_B 0x71294
  5908. #define _PLANE_KEYVAL_1(pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B)
  5909. #define _PLANE_KEYVAL_2(pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B)
  5910. #define PLANE_KEYVAL(pipe, plane) \
  5911. _MMIO_PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe))
  5912. #define _PLANE_KEYMSK_1_B 0x71198
  5913. #define _PLANE_KEYMSK_2_B 0x71298
  5914. #define _PLANE_KEYMSK_1(pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B)
  5915. #define _PLANE_KEYMSK_2(pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A, _PLANE_KEYMSK_2_B)
  5916. #define PLANE_KEYMSK(pipe, plane) \
  5917. _MMIO_PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe))
  5918. #define _PLANE_KEYMAX_1_B 0x711a0
  5919. #define _PLANE_KEYMAX_2_B 0x712a0
  5920. #define _PLANE_KEYMAX_1(pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A, _PLANE_KEYMAX_1_B)
  5921. #define _PLANE_KEYMAX_2(pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B)
  5922. #define PLANE_KEYMAX(pipe, plane) \
  5923. _MMIO_PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe))
  5924. #define _PLANE_BUF_CFG_1_B 0x7127c
  5925. #define _PLANE_BUF_CFG_2_B 0x7137c
  5926. #define SKL_DDB_ENTRY_MASK 0x3FF
  5927. #define ICL_DDB_ENTRY_MASK 0x7FF
  5928. #define DDB_ENTRY_END_SHIFT 16
  5929. #define _PLANE_BUF_CFG_1(pipe) \
  5930. _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B)
  5931. #define _PLANE_BUF_CFG_2(pipe) \
  5932. _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B)
  5933. #define PLANE_BUF_CFG(pipe, plane) \
  5934. _MMIO_PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe))
  5935. #define _PLANE_NV12_BUF_CFG_1_B 0x71278
  5936. #define _PLANE_NV12_BUF_CFG_2_B 0x71378
  5937. #define _PLANE_NV12_BUF_CFG_1(pipe) \
  5938. _PIPE(pipe, _PLANE_NV12_BUF_CFG_1_A, _PLANE_NV12_BUF_CFG_1_B)
  5939. #define _PLANE_NV12_BUF_CFG_2(pipe) \
  5940. _PIPE(pipe, _PLANE_NV12_BUF_CFG_2_A, _PLANE_NV12_BUF_CFG_2_B)
  5941. #define PLANE_NV12_BUF_CFG(pipe, plane) \
  5942. _MMIO_PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), _PLANE_NV12_BUF_CFG_2(pipe))
  5943. #define _PLANE_AUX_DIST_1_B 0x711c0
  5944. #define _PLANE_AUX_DIST_2_B 0x712c0
  5945. #define _PLANE_AUX_DIST_1(pipe) \
  5946. _PIPE(pipe, _PLANE_AUX_DIST_1_A, _PLANE_AUX_DIST_1_B)
  5947. #define _PLANE_AUX_DIST_2(pipe) \
  5948. _PIPE(pipe, _PLANE_AUX_DIST_2_A, _PLANE_AUX_DIST_2_B)
  5949. #define PLANE_AUX_DIST(pipe, plane) \
  5950. _MMIO_PLANE(plane, _PLANE_AUX_DIST_1(pipe), _PLANE_AUX_DIST_2(pipe))
  5951. #define _PLANE_AUX_OFFSET_1_B 0x711c4
  5952. #define _PLANE_AUX_OFFSET_2_B 0x712c4
  5953. #define _PLANE_AUX_OFFSET_1(pipe) \
  5954. _PIPE(pipe, _PLANE_AUX_OFFSET_1_A, _PLANE_AUX_OFFSET_1_B)
  5955. #define _PLANE_AUX_OFFSET_2(pipe) \
  5956. _PIPE(pipe, _PLANE_AUX_OFFSET_2_A, _PLANE_AUX_OFFSET_2_B)
  5957. #define PLANE_AUX_OFFSET(pipe, plane) \
  5958. _MMIO_PLANE(plane, _PLANE_AUX_OFFSET_1(pipe), _PLANE_AUX_OFFSET_2(pipe))
  5959. #define _PLANE_COLOR_CTL_1_B 0x711CC
  5960. #define _PLANE_COLOR_CTL_2_B 0x712CC
  5961. #define _PLANE_COLOR_CTL_3_B 0x713CC
  5962. #define _PLANE_COLOR_CTL_1(pipe) \
  5963. _PIPE(pipe, _PLANE_COLOR_CTL_1_A, _PLANE_COLOR_CTL_1_B)
  5964. #define _PLANE_COLOR_CTL_2(pipe) \
  5965. _PIPE(pipe, _PLANE_COLOR_CTL_2_A, _PLANE_COLOR_CTL_2_B)
  5966. #define PLANE_COLOR_CTL(pipe, plane) \
  5967. _MMIO_PLANE(plane, _PLANE_COLOR_CTL_1(pipe), _PLANE_COLOR_CTL_2(pipe))
  5968. #/* SKL new cursor registers */
  5969. #define _CUR_BUF_CFG_A 0x7017c
  5970. #define _CUR_BUF_CFG_B 0x7117c
  5971. #define CUR_BUF_CFG(pipe) _MMIO_PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B)
  5972. /* VBIOS regs */
  5973. #define VGACNTRL _MMIO(0x71400)
  5974. # define VGA_DISP_DISABLE (1 << 31)
  5975. # define VGA_2X_MODE (1 << 30)
  5976. # define VGA_PIPE_B_SELECT (1 << 29)
  5977. #define VLV_VGACNTRL _MMIO(VLV_DISPLAY_BASE + 0x71400)
  5978. /* Ironlake */
  5979. #define CPU_VGACNTRL _MMIO(0x41000)
  5980. #define DIGITAL_PORT_HOTPLUG_CNTRL _MMIO(0x44030)
  5981. #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
  5982. #define DIGITAL_PORTA_PULSE_DURATION_2ms (0 << 2) /* pre-HSW */
  5983. #define DIGITAL_PORTA_PULSE_DURATION_4_5ms (1 << 2) /* pre-HSW */
  5984. #define DIGITAL_PORTA_PULSE_DURATION_6ms (2 << 2) /* pre-HSW */
  5985. #define DIGITAL_PORTA_PULSE_DURATION_100ms (3 << 2) /* pre-HSW */
  5986. #define DIGITAL_PORTA_PULSE_DURATION_MASK (3 << 2) /* pre-HSW */
  5987. #define DIGITAL_PORTA_HOTPLUG_STATUS_MASK (3 << 0)
  5988. #define DIGITAL_PORTA_HOTPLUG_NO_DETECT (0 << 0)
  5989. #define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0)
  5990. #define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0)
  5991. /* refresh rate hardware control */
  5992. #define RR_HW_CTL _MMIO(0x45300)
  5993. #define RR_HW_LOW_POWER_FRAMES_MASK 0xff
  5994. #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
  5995. #define FDI_PLL_BIOS_0 _MMIO(0x46000)
  5996. #define FDI_PLL_FB_CLOCK_MASK 0xff
  5997. #define FDI_PLL_BIOS_1 _MMIO(0x46004)
  5998. #define FDI_PLL_BIOS_2 _MMIO(0x46008)
  5999. #define DISPLAY_PORT_PLL_BIOS_0 _MMIO(0x4600c)
  6000. #define DISPLAY_PORT_PLL_BIOS_1 _MMIO(0x46010)
  6001. #define DISPLAY_PORT_PLL_BIOS_2 _MMIO(0x46014)
  6002. #define PCH_3DCGDIS0 _MMIO(0x46020)
  6003. # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
  6004. # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
  6005. #define PCH_3DCGDIS1 _MMIO(0x46024)
  6006. # define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11)
  6007. #define FDI_PLL_FREQ_CTL _MMIO(0x46030)
  6008. #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
  6009. #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
  6010. #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
  6011. #define _PIPEA_DATA_M1 0x60030
  6012. #define PIPE_DATA_M1_OFFSET 0
  6013. #define _PIPEA_DATA_N1 0x60034
  6014. #define PIPE_DATA_N1_OFFSET 0
  6015. #define _PIPEA_DATA_M2 0x60038
  6016. #define PIPE_DATA_M2_OFFSET 0
  6017. #define _PIPEA_DATA_N2 0x6003c
  6018. #define PIPE_DATA_N2_OFFSET 0
  6019. #define _PIPEA_LINK_M1 0x60040
  6020. #define PIPE_LINK_M1_OFFSET 0
  6021. #define _PIPEA_LINK_N1 0x60044
  6022. #define PIPE_LINK_N1_OFFSET 0
  6023. #define _PIPEA_LINK_M2 0x60048
  6024. #define PIPE_LINK_M2_OFFSET 0
  6025. #define _PIPEA_LINK_N2 0x6004c
  6026. #define PIPE_LINK_N2_OFFSET 0
  6027. /* PIPEB timing regs are same start from 0x61000 */
  6028. #define _PIPEB_DATA_M1 0x61030
  6029. #define _PIPEB_DATA_N1 0x61034
  6030. #define _PIPEB_DATA_M2 0x61038
  6031. #define _PIPEB_DATA_N2 0x6103c
  6032. #define _PIPEB_LINK_M1 0x61040
  6033. #define _PIPEB_LINK_N1 0x61044
  6034. #define _PIPEB_LINK_M2 0x61048
  6035. #define _PIPEB_LINK_N2 0x6104c
  6036. #define PIPE_DATA_M1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M1)
  6037. #define PIPE_DATA_N1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N1)
  6038. #define PIPE_DATA_M2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M2)
  6039. #define PIPE_DATA_N2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N2)
  6040. #define PIPE_LINK_M1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M1)
  6041. #define PIPE_LINK_N1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N1)
  6042. #define PIPE_LINK_M2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M2)
  6043. #define PIPE_LINK_N2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N2)
  6044. /* CPU panel fitter */
  6045. /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */
  6046. #define _PFA_CTL_1 0x68080
  6047. #define _PFB_CTL_1 0x68880
  6048. #define PF_ENABLE (1<<31)
  6049. #define PF_PIPE_SEL_MASK_IVB (3<<29)
  6050. #define PF_PIPE_SEL_IVB(pipe) ((pipe)<<29)
  6051. #define PF_FILTER_MASK (3<<23)
  6052. #define PF_FILTER_PROGRAMMED (0<<23)
  6053. #define PF_FILTER_MED_3x3 (1<<23)
  6054. #define PF_FILTER_EDGE_ENHANCE (2<<23)
  6055. #define PF_FILTER_EDGE_SOFTEN (3<<23)
  6056. #define _PFA_WIN_SZ 0x68074
  6057. #define _PFB_WIN_SZ 0x68874
  6058. #define _PFA_WIN_POS 0x68070
  6059. #define _PFB_WIN_POS 0x68870
  6060. #define _PFA_VSCALE 0x68084
  6061. #define _PFB_VSCALE 0x68884
  6062. #define _PFA_HSCALE 0x68090
  6063. #define _PFB_HSCALE 0x68890
  6064. #define PF_CTL(pipe) _MMIO_PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1)
  6065. #define PF_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ)
  6066. #define PF_WIN_POS(pipe) _MMIO_PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS)
  6067. #define PF_VSCALE(pipe) _MMIO_PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE)
  6068. #define PF_HSCALE(pipe) _MMIO_PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE)
  6069. #define _PSA_CTL 0x68180
  6070. #define _PSB_CTL 0x68980
  6071. #define PS_ENABLE (1<<31)
  6072. #define _PSA_WIN_SZ 0x68174
  6073. #define _PSB_WIN_SZ 0x68974
  6074. #define _PSA_WIN_POS 0x68170
  6075. #define _PSB_WIN_POS 0x68970
  6076. #define PS_CTL(pipe) _MMIO_PIPE(pipe, _PSA_CTL, _PSB_CTL)
  6077. #define PS_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PSA_WIN_SZ, _PSB_WIN_SZ)
  6078. #define PS_WIN_POS(pipe) _MMIO_PIPE(pipe, _PSA_WIN_POS, _PSB_WIN_POS)
  6079. /*
  6080. * Skylake scalers
  6081. */
  6082. #define _PS_1A_CTRL 0x68180
  6083. #define _PS_2A_CTRL 0x68280
  6084. #define _PS_1B_CTRL 0x68980
  6085. #define _PS_2B_CTRL 0x68A80
  6086. #define _PS_1C_CTRL 0x69180
  6087. #define PS_SCALER_EN (1 << 31)
  6088. #define PS_SCALER_MODE_MASK (3 << 28)
  6089. #define PS_SCALER_MODE_DYN (0 << 28)
  6090. #define PS_SCALER_MODE_HQ (1 << 28)
  6091. #define SKL_PS_SCALER_MODE_NV12 (2 << 28)
  6092. #define PS_SCALER_MODE_PLANAR (1 << 29)
  6093. #define PS_PLANE_SEL_MASK (7 << 25)
  6094. #define PS_PLANE_SEL(plane) (((plane) + 1) << 25)
  6095. #define PS_FILTER_MASK (3 << 23)
  6096. #define PS_FILTER_MEDIUM (0 << 23)
  6097. #define PS_FILTER_EDGE_ENHANCE (2 << 23)
  6098. #define PS_FILTER_BILINEAR (3 << 23)
  6099. #define PS_VERT3TAP (1 << 21)
  6100. #define PS_VERT_INT_INVERT_FIELD1 (0 << 20)
  6101. #define PS_VERT_INT_INVERT_FIELD0 (1 << 20)
  6102. #define PS_PWRUP_PROGRESS (1 << 17)
  6103. #define PS_V_FILTER_BYPASS (1 << 8)
  6104. #define PS_VADAPT_EN (1 << 7)
  6105. #define PS_VADAPT_MODE_MASK (3 << 5)
  6106. #define PS_VADAPT_MODE_LEAST_ADAPT (0 << 5)
  6107. #define PS_VADAPT_MODE_MOD_ADAPT (1 << 5)
  6108. #define PS_VADAPT_MODE_MOST_ADAPT (3 << 5)
  6109. #define _PS_PWR_GATE_1A 0x68160
  6110. #define _PS_PWR_GATE_2A 0x68260
  6111. #define _PS_PWR_GATE_1B 0x68960
  6112. #define _PS_PWR_GATE_2B 0x68A60
  6113. #define _PS_PWR_GATE_1C 0x69160
  6114. #define PS_PWR_GATE_DIS_OVERRIDE (1 << 31)
  6115. #define PS_PWR_GATE_SETTLING_TIME_32 (0 << 3)
  6116. #define PS_PWR_GATE_SETTLING_TIME_64 (1 << 3)
  6117. #define PS_PWR_GATE_SETTLING_TIME_96 (2 << 3)
  6118. #define PS_PWR_GATE_SETTLING_TIME_128 (3 << 3)
  6119. #define PS_PWR_GATE_SLPEN_8 0
  6120. #define PS_PWR_GATE_SLPEN_16 1
  6121. #define PS_PWR_GATE_SLPEN_24 2
  6122. #define PS_PWR_GATE_SLPEN_32 3
  6123. #define _PS_WIN_POS_1A 0x68170
  6124. #define _PS_WIN_POS_2A 0x68270
  6125. #define _PS_WIN_POS_1B 0x68970
  6126. #define _PS_WIN_POS_2B 0x68A70
  6127. #define _PS_WIN_POS_1C 0x69170
  6128. #define _PS_WIN_SZ_1A 0x68174
  6129. #define _PS_WIN_SZ_2A 0x68274
  6130. #define _PS_WIN_SZ_1B 0x68974
  6131. #define _PS_WIN_SZ_2B 0x68A74
  6132. #define _PS_WIN_SZ_1C 0x69174
  6133. #define _PS_VSCALE_1A 0x68184
  6134. #define _PS_VSCALE_2A 0x68284
  6135. #define _PS_VSCALE_1B 0x68984
  6136. #define _PS_VSCALE_2B 0x68A84
  6137. #define _PS_VSCALE_1C 0x69184
  6138. #define _PS_HSCALE_1A 0x68190
  6139. #define _PS_HSCALE_2A 0x68290
  6140. #define _PS_HSCALE_1B 0x68990
  6141. #define _PS_HSCALE_2B 0x68A90
  6142. #define _PS_HSCALE_1C 0x69190
  6143. #define _PS_VPHASE_1A 0x68188
  6144. #define _PS_VPHASE_2A 0x68288
  6145. #define _PS_VPHASE_1B 0x68988
  6146. #define _PS_VPHASE_2B 0x68A88
  6147. #define _PS_VPHASE_1C 0x69188
  6148. #define _PS_HPHASE_1A 0x68194
  6149. #define _PS_HPHASE_2A 0x68294
  6150. #define _PS_HPHASE_1B 0x68994
  6151. #define _PS_HPHASE_2B 0x68A94
  6152. #define _PS_HPHASE_1C 0x69194
  6153. #define _PS_ECC_STAT_1A 0x681D0
  6154. #define _PS_ECC_STAT_2A 0x682D0
  6155. #define _PS_ECC_STAT_1B 0x689D0
  6156. #define _PS_ECC_STAT_2B 0x68AD0
  6157. #define _PS_ECC_STAT_1C 0x691D0
  6158. #define _ID(id, a, b) ((a) + (id)*((b)-(a)))
  6159. #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe, \
  6160. _ID(id, _PS_1A_CTRL, _PS_2A_CTRL), \
  6161. _ID(id, _PS_1B_CTRL, _PS_2B_CTRL))
  6162. #define SKL_PS_PWR_GATE(pipe, id) _MMIO_PIPE(pipe, \
  6163. _ID(id, _PS_PWR_GATE_1A, _PS_PWR_GATE_2A), \
  6164. _ID(id, _PS_PWR_GATE_1B, _PS_PWR_GATE_2B))
  6165. #define SKL_PS_WIN_POS(pipe, id) _MMIO_PIPE(pipe, \
  6166. _ID(id, _PS_WIN_POS_1A, _PS_WIN_POS_2A), \
  6167. _ID(id, _PS_WIN_POS_1B, _PS_WIN_POS_2B))
  6168. #define SKL_PS_WIN_SZ(pipe, id) _MMIO_PIPE(pipe, \
  6169. _ID(id, _PS_WIN_SZ_1A, _PS_WIN_SZ_2A), \
  6170. _ID(id, _PS_WIN_SZ_1B, _PS_WIN_SZ_2B))
  6171. #define SKL_PS_VSCALE(pipe, id) _MMIO_PIPE(pipe, \
  6172. _ID(id, _PS_VSCALE_1A, _PS_VSCALE_2A), \
  6173. _ID(id, _PS_VSCALE_1B, _PS_VSCALE_2B))
  6174. #define SKL_PS_HSCALE(pipe, id) _MMIO_PIPE(pipe, \
  6175. _ID(id, _PS_HSCALE_1A, _PS_HSCALE_2A), \
  6176. _ID(id, _PS_HSCALE_1B, _PS_HSCALE_2B))
  6177. #define SKL_PS_VPHASE(pipe, id) _MMIO_PIPE(pipe, \
  6178. _ID(id, _PS_VPHASE_1A, _PS_VPHASE_2A), \
  6179. _ID(id, _PS_VPHASE_1B, _PS_VPHASE_2B))
  6180. #define SKL_PS_HPHASE(pipe, id) _MMIO_PIPE(pipe, \
  6181. _ID(id, _PS_HPHASE_1A, _PS_HPHASE_2A), \
  6182. _ID(id, _PS_HPHASE_1B, _PS_HPHASE_2B))
  6183. #define SKL_PS_ECC_STAT(pipe, id) _MMIO_PIPE(pipe, \
  6184. _ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A), \
  6185. _ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
  6186. /* legacy palette */
  6187. #define _LGC_PALETTE_A 0x4a000
  6188. #define _LGC_PALETTE_B 0x4a800
  6189. #define LGC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4)
  6190. #define _GAMMA_MODE_A 0x4a480
  6191. #define _GAMMA_MODE_B 0x4ac80
  6192. #define GAMMA_MODE(pipe) _MMIO_PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B)
  6193. #define GAMMA_MODE_MODE_MASK (3 << 0)
  6194. #define GAMMA_MODE_MODE_8BIT (0 << 0)
  6195. #define GAMMA_MODE_MODE_10BIT (1 << 0)
  6196. #define GAMMA_MODE_MODE_12BIT (2 << 0)
  6197. #define GAMMA_MODE_MODE_SPLIT (3 << 0)
  6198. /* DMC/CSR */
  6199. #define CSR_PROGRAM(i) _MMIO(0x80000 + (i) * 4)
  6200. #define CSR_SSP_BASE_ADDR_GEN9 0x00002FC0
  6201. #define CSR_HTP_ADDR_SKL 0x00500034
  6202. #define CSR_SSP_BASE _MMIO(0x8F074)
  6203. #define CSR_HTP_SKL _MMIO(0x8F004)
  6204. #define CSR_LAST_WRITE _MMIO(0x8F034)
  6205. #define CSR_LAST_WRITE_VALUE 0xc003b400
  6206. /* MMIO address range for CSR program (0x80000 - 0x82FFF) */
  6207. #define CSR_MMIO_START_RANGE 0x80000
  6208. #define CSR_MMIO_END_RANGE 0x8FFFF
  6209. #define SKL_CSR_DC3_DC5_COUNT _MMIO(0x80030)
  6210. #define SKL_CSR_DC5_DC6_COUNT _MMIO(0x8002C)
  6211. #define BXT_CSR_DC3_DC5_COUNT _MMIO(0x80038)
  6212. /* interrupts */
  6213. #define DE_MASTER_IRQ_CONTROL (1 << 31)
  6214. #define DE_SPRITEB_FLIP_DONE (1 << 29)
  6215. #define DE_SPRITEA_FLIP_DONE (1 << 28)
  6216. #define DE_PLANEB_FLIP_DONE (1 << 27)
  6217. #define DE_PLANEA_FLIP_DONE (1 << 26)
  6218. #define DE_PLANE_FLIP_DONE(plane) (1 << (26 + (plane)))
  6219. #define DE_PCU_EVENT (1 << 25)
  6220. #define DE_GTT_FAULT (1 << 24)
  6221. #define DE_POISON (1 << 23)
  6222. #define DE_PERFORM_COUNTER (1 << 22)
  6223. #define DE_PCH_EVENT (1 << 21)
  6224. #define DE_AUX_CHANNEL_A (1 << 20)
  6225. #define DE_DP_A_HOTPLUG (1 << 19)
  6226. #define DE_GSE (1 << 18)
  6227. #define DE_PIPEB_VBLANK (1 << 15)
  6228. #define DE_PIPEB_EVEN_FIELD (1 << 14)
  6229. #define DE_PIPEB_ODD_FIELD (1 << 13)
  6230. #define DE_PIPEB_LINE_COMPARE (1 << 12)
  6231. #define DE_PIPEB_VSYNC (1 << 11)
  6232. #define DE_PIPEB_CRC_DONE (1 << 10)
  6233. #define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
  6234. #define DE_PIPEA_VBLANK (1 << 7)
  6235. #define DE_PIPE_VBLANK(pipe) (1 << (7 + 8*(pipe)))
  6236. #define DE_PIPEA_EVEN_FIELD (1 << 6)
  6237. #define DE_PIPEA_ODD_FIELD (1 << 5)
  6238. #define DE_PIPEA_LINE_COMPARE (1 << 4)
  6239. #define DE_PIPEA_VSYNC (1 << 3)
  6240. #define DE_PIPEA_CRC_DONE (1 << 2)
  6241. #define DE_PIPE_CRC_DONE(pipe) (1 << (2 + 8*(pipe)))
  6242. #define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
  6243. #define DE_PIPE_FIFO_UNDERRUN(pipe) (1 << (8*(pipe)))
  6244. /* More Ivybridge lolz */
  6245. #define DE_ERR_INT_IVB (1<<30)
  6246. #define DE_GSE_IVB (1<<29)
  6247. #define DE_PCH_EVENT_IVB (1<<28)
  6248. #define DE_DP_A_HOTPLUG_IVB (1<<27)
  6249. #define DE_AUX_CHANNEL_A_IVB (1<<26)
  6250. #define DE_EDP_PSR_INT_HSW (1<<19)
  6251. #define DE_SPRITEC_FLIP_DONE_IVB (1<<14)
  6252. #define DE_PLANEC_FLIP_DONE_IVB (1<<13)
  6253. #define DE_PIPEC_VBLANK_IVB (1<<10)
  6254. #define DE_SPRITEB_FLIP_DONE_IVB (1<<9)
  6255. #define DE_PLANEB_FLIP_DONE_IVB (1<<8)
  6256. #define DE_PIPEB_VBLANK_IVB (1<<5)
  6257. #define DE_SPRITEA_FLIP_DONE_IVB (1<<4)
  6258. #define DE_PLANEA_FLIP_DONE_IVB (1<<3)
  6259. #define DE_PLANE_FLIP_DONE_IVB(plane) (1<< (3 + 5*(plane)))
  6260. #define DE_PIPEA_VBLANK_IVB (1<<0)
  6261. #define DE_PIPE_VBLANK_IVB(pipe) (1 << ((pipe) * 5))
  6262. #define VLV_MASTER_IER _MMIO(0x4400c) /* Gunit master IER */
  6263. #define MASTER_INTERRUPT_ENABLE (1<<31)
  6264. #define DEISR _MMIO(0x44000)
  6265. #define DEIMR _MMIO(0x44004)
  6266. #define DEIIR _MMIO(0x44008)
  6267. #define DEIER _MMIO(0x4400c)
  6268. #define GTISR _MMIO(0x44010)
  6269. #define GTIMR _MMIO(0x44014)
  6270. #define GTIIR _MMIO(0x44018)
  6271. #define GTIER _MMIO(0x4401c)
  6272. #define GEN8_MASTER_IRQ _MMIO(0x44200)
  6273. #define GEN8_MASTER_IRQ_CONTROL (1<<31)
  6274. #define GEN8_PCU_IRQ (1<<30)
  6275. #define GEN8_DE_PCH_IRQ (1<<23)
  6276. #define GEN8_DE_MISC_IRQ (1<<22)
  6277. #define GEN8_DE_PORT_IRQ (1<<20)
  6278. #define GEN8_DE_PIPE_C_IRQ (1<<18)
  6279. #define GEN8_DE_PIPE_B_IRQ (1<<17)
  6280. #define GEN8_DE_PIPE_A_IRQ (1<<16)
  6281. #define GEN8_DE_PIPE_IRQ(pipe) (1<<(16+(pipe)))
  6282. #define GEN8_GT_VECS_IRQ (1<<6)
  6283. #define GEN8_GT_GUC_IRQ (1<<5)
  6284. #define GEN8_GT_PM_IRQ (1<<4)
  6285. #define GEN8_GT_VCS2_IRQ (1<<3)
  6286. #define GEN8_GT_VCS1_IRQ (1<<2)
  6287. #define GEN8_GT_BCS_IRQ (1<<1)
  6288. #define GEN8_GT_RCS_IRQ (1<<0)
  6289. #define GEN8_GT_ISR(which) _MMIO(0x44300 + (0x10 * (which)))
  6290. #define GEN8_GT_IMR(which) _MMIO(0x44304 + (0x10 * (which)))
  6291. #define GEN8_GT_IIR(which) _MMIO(0x44308 + (0x10 * (which)))
  6292. #define GEN8_GT_IER(which) _MMIO(0x4430c + (0x10 * (which)))
  6293. #define GEN9_GUC_TO_HOST_INT_EVENT (1<<31)
  6294. #define GEN9_GUC_EXEC_ERROR_EVENT (1<<30)
  6295. #define GEN9_GUC_DISPLAY_EVENT (1<<29)
  6296. #define GEN9_GUC_SEMA_SIGNAL_EVENT (1<<28)
  6297. #define GEN9_GUC_IOMMU_MSG_EVENT (1<<27)
  6298. #define GEN9_GUC_DB_RING_EVENT (1<<26)
  6299. #define GEN9_GUC_DMA_DONE_EVENT (1<<25)
  6300. #define GEN9_GUC_FATAL_ERROR_EVENT (1<<24)
  6301. #define GEN9_GUC_NOTIFICATION_EVENT (1<<23)
  6302. #define GEN8_RCS_IRQ_SHIFT 0
  6303. #define GEN8_BCS_IRQ_SHIFT 16
  6304. #define GEN8_VCS1_IRQ_SHIFT 0
  6305. #define GEN8_VCS2_IRQ_SHIFT 16
  6306. #define GEN8_VECS_IRQ_SHIFT 0
  6307. #define GEN8_WD_IRQ_SHIFT 16
  6308. #define GEN8_DE_PIPE_ISR(pipe) _MMIO(0x44400 + (0x10 * (pipe)))
  6309. #define GEN8_DE_PIPE_IMR(pipe) _MMIO(0x44404 + (0x10 * (pipe)))
  6310. #define GEN8_DE_PIPE_IIR(pipe) _MMIO(0x44408 + (0x10 * (pipe)))
  6311. #define GEN8_DE_PIPE_IER(pipe) _MMIO(0x4440c + (0x10 * (pipe)))
  6312. #define GEN8_PIPE_FIFO_UNDERRUN (1 << 31)
  6313. #define GEN8_PIPE_CDCLK_CRC_ERROR (1 << 29)
  6314. #define GEN8_PIPE_CDCLK_CRC_DONE (1 << 28)
  6315. #define GEN8_PIPE_CURSOR_FAULT (1 << 10)
  6316. #define GEN8_PIPE_SPRITE_FAULT (1 << 9)
  6317. #define GEN8_PIPE_PRIMARY_FAULT (1 << 8)
  6318. #define GEN8_PIPE_SPRITE_FLIP_DONE (1 << 5)
  6319. #define GEN8_PIPE_PRIMARY_FLIP_DONE (1 << 4)
  6320. #define GEN8_PIPE_SCAN_LINE_EVENT (1 << 2)
  6321. #define GEN8_PIPE_VSYNC (1 << 1)
  6322. #define GEN8_PIPE_VBLANK (1 << 0)
  6323. #define GEN9_PIPE_CURSOR_FAULT (1 << 11)
  6324. #define GEN9_PIPE_PLANE4_FAULT (1 << 10)
  6325. #define GEN9_PIPE_PLANE3_FAULT (1 << 9)
  6326. #define GEN9_PIPE_PLANE2_FAULT (1 << 8)
  6327. #define GEN9_PIPE_PLANE1_FAULT (1 << 7)
  6328. #define GEN9_PIPE_PLANE4_FLIP_DONE (1 << 6)
  6329. #define GEN9_PIPE_PLANE3_FLIP_DONE (1 << 5)
  6330. #define GEN9_PIPE_PLANE2_FLIP_DONE (1 << 4)
  6331. #define GEN9_PIPE_PLANE1_FLIP_DONE (1 << 3)
  6332. #define GEN9_PIPE_PLANE_FLIP_DONE(p) (1 << (3 + (p)))
  6333. #define GEN8_DE_PIPE_IRQ_FAULT_ERRORS \
  6334. (GEN8_PIPE_CURSOR_FAULT | \
  6335. GEN8_PIPE_SPRITE_FAULT | \
  6336. GEN8_PIPE_PRIMARY_FAULT)
  6337. #define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \
  6338. (GEN9_PIPE_CURSOR_FAULT | \
  6339. GEN9_PIPE_PLANE4_FAULT | \
  6340. GEN9_PIPE_PLANE3_FAULT | \
  6341. GEN9_PIPE_PLANE2_FAULT | \
  6342. GEN9_PIPE_PLANE1_FAULT)
  6343. #define GEN8_DE_PORT_ISR _MMIO(0x44440)
  6344. #define GEN8_DE_PORT_IMR _MMIO(0x44444)
  6345. #define GEN8_DE_PORT_IIR _MMIO(0x44448)
  6346. #define GEN8_DE_PORT_IER _MMIO(0x4444c)
  6347. #define CNL_AUX_CHANNEL_F (1 << 28)
  6348. #define GEN9_AUX_CHANNEL_D (1 << 27)
  6349. #define GEN9_AUX_CHANNEL_C (1 << 26)
  6350. #define GEN9_AUX_CHANNEL_B (1 << 25)
  6351. #define BXT_DE_PORT_HP_DDIC (1 << 5)
  6352. #define BXT_DE_PORT_HP_DDIB (1 << 4)
  6353. #define BXT_DE_PORT_HP_DDIA (1 << 3)
  6354. #define BXT_DE_PORT_HOTPLUG_MASK (BXT_DE_PORT_HP_DDIA | \
  6355. BXT_DE_PORT_HP_DDIB | \
  6356. BXT_DE_PORT_HP_DDIC)
  6357. #define GEN8_PORT_DP_A_HOTPLUG (1 << 3)
  6358. #define BXT_DE_PORT_GMBUS (1 << 1)
  6359. #define GEN8_AUX_CHANNEL_A (1 << 0)
  6360. #define GEN8_DE_MISC_ISR _MMIO(0x44460)
  6361. #define GEN8_DE_MISC_IMR _MMIO(0x44464)
  6362. #define GEN8_DE_MISC_IIR _MMIO(0x44468)
  6363. #define GEN8_DE_MISC_IER _MMIO(0x4446c)
  6364. #define GEN8_DE_MISC_GSE (1 << 27)
  6365. #define GEN8_DE_EDP_PSR (1 << 19)
  6366. #define GEN8_PCU_ISR _MMIO(0x444e0)
  6367. #define GEN8_PCU_IMR _MMIO(0x444e4)
  6368. #define GEN8_PCU_IIR _MMIO(0x444e8)
  6369. #define GEN8_PCU_IER _MMIO(0x444ec)
  6370. #define GEN11_GFX_MSTR_IRQ _MMIO(0x190010)
  6371. #define GEN11_MASTER_IRQ (1 << 31)
  6372. #define GEN11_PCU_IRQ (1 << 30)
  6373. #define GEN11_DISPLAY_IRQ (1 << 16)
  6374. #define GEN11_GT_DW_IRQ(x) (1 << (x))
  6375. #define GEN11_GT_DW1_IRQ (1 << 1)
  6376. #define GEN11_GT_DW0_IRQ (1 << 0)
  6377. #define GEN11_DISPLAY_INT_CTL _MMIO(0x44200)
  6378. #define GEN11_DISPLAY_IRQ_ENABLE (1 << 31)
  6379. #define GEN11_AUDIO_CODEC_IRQ (1 << 24)
  6380. #define GEN11_DE_PCH_IRQ (1 << 23)
  6381. #define GEN11_DE_MISC_IRQ (1 << 22)
  6382. #define GEN11_DE_PORT_IRQ (1 << 20)
  6383. #define GEN11_DE_PIPE_C (1 << 18)
  6384. #define GEN11_DE_PIPE_B (1 << 17)
  6385. #define GEN11_DE_PIPE_A (1 << 16)
  6386. #define GEN11_GT_INTR_DW0 _MMIO(0x190018)
  6387. #define GEN11_CSME (31)
  6388. #define GEN11_GUNIT (28)
  6389. #define GEN11_GUC (25)
  6390. #define GEN11_WDPERF (20)
  6391. #define GEN11_KCR (19)
  6392. #define GEN11_GTPM (16)
  6393. #define GEN11_BCS (15)
  6394. #define GEN11_RCS0 (0)
  6395. #define GEN11_GT_INTR_DW1 _MMIO(0x19001c)
  6396. #define GEN11_VECS(x) (31 - (x))
  6397. #define GEN11_VCS(x) (x)
  6398. #define GEN11_GT_INTR_DW(x) _MMIO(0x190018 + (x * 4))
  6399. #define GEN11_INTR_IDENTITY_REG0 _MMIO(0x190060)
  6400. #define GEN11_INTR_IDENTITY_REG1 _MMIO(0x190064)
  6401. #define GEN11_INTR_DATA_VALID (1 << 31)
  6402. #define GEN11_INTR_ENGINE_CLASS(x) (((x) & GENMASK(18, 16)) >> 16)
  6403. #define GEN11_INTR_ENGINE_INSTANCE(x) (((x) & GENMASK(25, 20)) >> 20)
  6404. #define GEN11_INTR_ENGINE_INTR(x) ((x) & 0xffff)
  6405. #define GEN11_INTR_IDENTITY_REG(x) _MMIO(0x190060 + (x * 4))
  6406. #define GEN11_IIR_REG0_SELECTOR _MMIO(0x190070)
  6407. #define GEN11_IIR_REG1_SELECTOR _MMIO(0x190074)
  6408. #define GEN11_IIR_REG_SELECTOR(x) _MMIO(0x190070 + (x * 4))
  6409. #define GEN11_RENDER_COPY_INTR_ENABLE _MMIO(0x190030)
  6410. #define GEN11_VCS_VECS_INTR_ENABLE _MMIO(0x190034)
  6411. #define GEN11_GUC_SG_INTR_ENABLE _MMIO(0x190038)
  6412. #define GEN11_GPM_WGBOXPERF_INTR_ENABLE _MMIO(0x19003c)
  6413. #define GEN11_CRYPTO_RSVD_INTR_ENABLE _MMIO(0x190040)
  6414. #define GEN11_GUNIT_CSME_INTR_ENABLE _MMIO(0x190044)
  6415. #define GEN11_RCS0_RSVD_INTR_MASK _MMIO(0x190090)
  6416. #define GEN11_BCS_RSVD_INTR_MASK _MMIO(0x1900a0)
  6417. #define GEN11_VCS0_VCS1_INTR_MASK _MMIO(0x1900a8)
  6418. #define GEN11_VCS2_VCS3_INTR_MASK _MMIO(0x1900ac)
  6419. #define GEN11_VECS0_VECS1_INTR_MASK _MMIO(0x1900d0)
  6420. #define GEN11_GUC_SG_INTR_MASK _MMIO(0x1900e8)
  6421. #define GEN11_GPM_WGBOXPERF_INTR_MASK _MMIO(0x1900ec)
  6422. #define GEN11_CRYPTO_RSVD_INTR_MASK _MMIO(0x1900f0)
  6423. #define GEN11_GUNIT_CSME_INTR_MASK _MMIO(0x1900f4)
  6424. #define ILK_DISPLAY_CHICKEN2 _MMIO(0x42004)
  6425. /* Required on all Ironlake and Sandybridge according to the B-Spec. */
  6426. #define ILK_ELPIN_409_SELECT (1 << 25)
  6427. #define ILK_DPARB_GATE (1<<22)
  6428. #define ILK_VSDPFD_FULL (1<<21)
  6429. #define FUSE_STRAP _MMIO(0x42014)
  6430. #define ILK_INTERNAL_GRAPHICS_DISABLE (1 << 31)
  6431. #define ILK_INTERNAL_DISPLAY_DISABLE (1 << 30)
  6432. #define ILK_DISPLAY_DEBUG_DISABLE (1 << 29)
  6433. #define IVB_PIPE_C_DISABLE (1 << 28)
  6434. #define ILK_HDCP_DISABLE (1 << 25)
  6435. #define ILK_eDP_A_DISABLE (1 << 24)
  6436. #define HSW_CDCLK_LIMIT (1 << 24)
  6437. #define ILK_DESKTOP (1 << 23)
  6438. #define ILK_DSPCLK_GATE_D _MMIO(0x42020)
  6439. #define ILK_VRHUNIT_CLOCK_GATE_DISABLE (1 << 28)
  6440. #define ILK_DPFCUNIT_CLOCK_GATE_DISABLE (1 << 9)
  6441. #define ILK_DPFCRUNIT_CLOCK_GATE_DISABLE (1 << 8)
  6442. #define ILK_DPFDUNIT_CLOCK_GATE_ENABLE (1 << 7)
  6443. #define ILK_DPARBUNIT_CLOCK_GATE_ENABLE (1 << 5)
  6444. #define IVB_CHICKEN3 _MMIO(0x4200c)
  6445. # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE (1 << 5)
  6446. # define CHICKEN3_DGMG_DONE_FIX_DISABLE (1 << 2)
  6447. #define CHICKEN_PAR1_1 _MMIO(0x42080)
  6448. #define SKL_DE_COMPRESSED_HASH_MODE (1 << 15)
  6449. #define DPA_MASK_VBLANK_SRD (1 << 15)
  6450. #define FORCE_ARB_IDLE_PLANES (1 << 14)
  6451. #define SKL_EDP_PSR_FIX_RDWRAP (1 << 3)
  6452. #define CHICKEN_PAR2_1 _MMIO(0x42090)
  6453. #define KVM_CONFIG_CHANGE_NOTIFICATION_SELECT (1 << 14)
  6454. #define CHICKEN_MISC_2 _MMIO(0x42084)
  6455. #define CNL_COMP_PWR_DOWN (1 << 23)
  6456. #define GLK_CL2_PWR_DOWN (1 << 12)
  6457. #define GLK_CL1_PWR_DOWN (1 << 11)
  6458. #define GLK_CL0_PWR_DOWN (1 << 10)
  6459. #define CHICKEN_MISC_4 _MMIO(0x4208c)
  6460. #define FBC_STRIDE_OVERRIDE (1 << 13)
  6461. #define FBC_STRIDE_MASK 0x1FFF
  6462. #define _CHICKEN_PIPESL_1_A 0x420b0
  6463. #define _CHICKEN_PIPESL_1_B 0x420b4
  6464. #define HSW_FBCQ_DIS (1 << 22)
  6465. #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0)
  6466. #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B)
  6467. #define CHICKEN_TRANS_A 0x420c0
  6468. #define CHICKEN_TRANS_B 0x420c4
  6469. #define CHICKEN_TRANS(trans) _MMIO_TRANS(trans, CHICKEN_TRANS_A, CHICKEN_TRANS_B)
  6470. #define VSC_DATA_SEL_SOFTWARE_CONTROL (1<<25) /* GLK and CNL+ */
  6471. #define DDI_TRAINING_OVERRIDE_ENABLE (1<<19)
  6472. #define DDI_TRAINING_OVERRIDE_VALUE (1<<18)
  6473. #define DDIE_TRAINING_OVERRIDE_ENABLE (1<<17) /* CHICKEN_TRANS_A only */
  6474. #define DDIE_TRAINING_OVERRIDE_VALUE (1<<16) /* CHICKEN_TRANS_A only */
  6475. #define PSR2_ADD_VERTICAL_LINE_COUNT (1<<15)
  6476. #define PSR2_VSC_ENABLE_PROG_HEADER (1<<12)
  6477. #define DISP_ARB_CTL _MMIO(0x45000)
  6478. #define DISP_FBC_MEMORY_WAKE (1<<31)
  6479. #define DISP_TILE_SURFACE_SWIZZLING (1<<13)
  6480. #define DISP_FBC_WM_DIS (1<<15)
  6481. #define DISP_ARB_CTL2 _MMIO(0x45004)
  6482. #define DISP_DATA_PARTITION_5_6 (1<<6)
  6483. #define DISP_IPC_ENABLE (1<<3)
  6484. #define DBUF_CTL _MMIO(0x45008)
  6485. #define DBUF_CTL_S1 _MMIO(0x45008)
  6486. #define DBUF_CTL_S2 _MMIO(0x44FE8)
  6487. #define DBUF_POWER_REQUEST (1<<31)
  6488. #define DBUF_POWER_STATE (1<<30)
  6489. #define GEN7_MSG_CTL _MMIO(0x45010)
  6490. #define WAIT_FOR_PCH_RESET_ACK (1<<1)
  6491. #define WAIT_FOR_PCH_FLR_ACK (1<<0)
  6492. #define HSW_NDE_RSTWRN_OPT _MMIO(0x46408)
  6493. #define RESET_PCH_HANDSHAKE_ENABLE (1<<4)
  6494. #define GEN8_CHICKEN_DCPR_1 _MMIO(0x46430)
  6495. #define SKL_SELECT_ALTERNATE_DC_EXIT (1 << 30)
  6496. #define MASK_WAKEMEM (1 << 13)
  6497. #define CNL_DDI_CLOCK_REG_ACCESS_ON (1 << 7)
  6498. #define SKL_DFSM _MMIO(0x51000)
  6499. #define SKL_DFSM_CDCLK_LIMIT_MASK (3 << 23)
  6500. #define SKL_DFSM_CDCLK_LIMIT_675 (0 << 23)
  6501. #define SKL_DFSM_CDCLK_LIMIT_540 (1 << 23)
  6502. #define SKL_DFSM_CDCLK_LIMIT_450 (2 << 23)
  6503. #define SKL_DFSM_CDCLK_LIMIT_337_5 (3 << 23)
  6504. #define SKL_DFSM_PIPE_A_DISABLE (1 << 30)
  6505. #define SKL_DFSM_PIPE_B_DISABLE (1 << 21)
  6506. #define SKL_DFSM_PIPE_C_DISABLE (1 << 28)
  6507. #define SKL_DSSM _MMIO(0x51004)
  6508. #define CNL_DSSM_CDCLK_PLL_REFCLK_24MHz (1 << 31)
  6509. #define ICL_DSSM_CDCLK_PLL_REFCLK_MASK (7 << 29)
  6510. #define ICL_DSSM_CDCLK_PLL_REFCLK_24MHz (0 << 29)
  6511. #define ICL_DSSM_CDCLK_PLL_REFCLK_19_2MHz (1 << 29)
  6512. #define ICL_DSSM_CDCLK_PLL_REFCLK_38_4MHz (2 << 29)
  6513. #define GEN7_FF_SLICE_CS_CHICKEN1 _MMIO(0x20e0)
  6514. #define GEN9_FFSC_PERCTX_PREEMPT_CTRL (1<<14)
  6515. #define FF_SLICE_CS_CHICKEN2 _MMIO(0x20e4)
  6516. #define GEN9_TSG_BARRIER_ACK_DISABLE (1<<8)
  6517. #define GEN9_POOLED_EU_LOAD_BALANCING_FIX_DISABLE (1<<10)
  6518. #define GEN9_CS_DEBUG_MODE1 _MMIO(0x20ec)
  6519. #define GEN9_CTX_PREEMPT_REG _MMIO(0x2248)
  6520. #define GEN8_CS_CHICKEN1 _MMIO(0x2580)
  6521. #define GEN9_PREEMPT_3D_OBJECT_LEVEL (1<<0)
  6522. #define GEN9_PREEMPT_GPGPU_LEVEL(hi, lo) (((hi) << 2) | ((lo) << 1))
  6523. #define GEN9_PREEMPT_GPGPU_MID_THREAD_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 0)
  6524. #define GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 1)
  6525. #define GEN9_PREEMPT_GPGPU_COMMAND_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(1, 0)
  6526. #define GEN9_PREEMPT_GPGPU_LEVEL_MASK GEN9_PREEMPT_GPGPU_LEVEL(1, 1)
  6527. /* GEN7 chicken */
  6528. #define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010)
  6529. # define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC ((1<<10) | (1<<26))
  6530. # define GEN9_RHWO_OPTIMIZATION_DISABLE (1<<14)
  6531. #define COMMON_SLICE_CHICKEN2 _MMIO(0x7014)
  6532. # define GEN9_PBE_COMPRESSED_HASH_SELECTION (1<<13)
  6533. # define GEN9_DISABLE_GATHER_AT_SET_SHADER_COMMON_SLICE (1<<12)
  6534. # define GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION (1<<8)
  6535. # define GEN8_CSC2_SBE_VUE_CACHE_CONSERVATIVE (1<<0)
  6536. #define HIZ_CHICKEN _MMIO(0x7018)
  6537. # define CHV_HZ_8X8_MODE_IN_1X (1<<15)
  6538. # define BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE (1<<3)
  6539. #define GEN9_SLICE_COMMON_ECO_CHICKEN0 _MMIO(0x7308)
  6540. #define DISABLE_PIXEL_MASK_CAMMING (1<<14)
  6541. #define GEN9_SLICE_COMMON_ECO_CHICKEN1 _MMIO(0x731c)
  6542. #define GEN7_L3SQCREG1 _MMIO(0xB010)
  6543. #define VLV_B0_WA_L3SQCREG1_VALUE 0x00D30000
  6544. #define GEN8_L3SQCREG1 _MMIO(0xB100)
  6545. /*
  6546. * Note that on CHV the following has an off-by-one error wrt. to BSpec.
  6547. * Using the formula in BSpec leads to a hang, while the formula here works
  6548. * fine and matches the formulas for all other platforms. A BSpec change
  6549. * request has been filed to clarify this.
  6550. */
  6551. #define L3_GENERAL_PRIO_CREDITS(x) (((x) >> 1) << 19)
  6552. #define L3_HIGH_PRIO_CREDITS(x) (((x) >> 1) << 14)
  6553. #define L3_PRIO_CREDITS_MASK ((0x1f << 19) | (0x1f << 14))
  6554. #define GEN7_L3CNTLREG1 _MMIO(0xB01C)
  6555. #define GEN7_WA_FOR_GEN7_L3_CONTROL 0x3C47FF8C
  6556. #define GEN7_L3AGDIS (1<<19)
  6557. #define GEN7_L3CNTLREG2 _MMIO(0xB020)
  6558. #define GEN7_L3CNTLREG3 _MMIO(0xB024)
  6559. #define GEN7_L3_CHICKEN_MODE_REGISTER _MMIO(0xB030)
  6560. #define GEN7_WA_L3_CHICKEN_MODE 0x20000000
  6561. #define GEN10_L3_CHICKEN_MODE_REGISTER _MMIO(0xB114)
  6562. #define GEN11_I2M_WRITE_DISABLE (1 << 28)
  6563. #define GEN7_L3SQCREG4 _MMIO(0xb034)
  6564. #define L3SQ_URB_READ_CAM_MATCH_DISABLE (1<<27)
  6565. #define GEN8_L3SQCREG4 _MMIO(0xb118)
  6566. #define GEN11_LQSC_CLEAN_EVICT_DISABLE (1 << 6)
  6567. #define GEN8_LQSC_RO_PERF_DIS (1 << 27)
  6568. #define GEN8_LQSC_FLUSH_COHERENT_LINES (1 << 21)
  6569. /* GEN8 chicken */
  6570. #define HDC_CHICKEN0 _MMIO(0x7300)
  6571. #define CNL_HDC_CHICKEN0 _MMIO(0xE5F0)
  6572. #define ICL_HDC_MODE _MMIO(0xE5F4)
  6573. #define HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE (1<<15)
  6574. #define HDC_FENCE_DEST_SLM_DISABLE (1<<14)
  6575. #define HDC_DONOT_FETCH_MEM_WHEN_MASKED (1<<11)
  6576. #define HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT (1<<5)
  6577. #define HDC_FORCE_NON_COHERENT (1<<4)
  6578. #define HDC_BARRIER_PERFORMANCE_DISABLE (1<<10)
  6579. #define GEN8_HDC_CHICKEN1 _MMIO(0x7304)
  6580. /* GEN9 chicken */
  6581. #define SLICE_ECO_CHICKEN0 _MMIO(0x7308)
  6582. #define PIXEL_MASK_CAMMING_DISABLE (1 << 14)
  6583. #define GEN9_WM_CHICKEN3 _MMIO(0x5588)
  6584. #define GEN9_FACTOR_IN_CLR_VAL_HIZ (1 << 9)
  6585. /* WaCatErrorRejectionIssue */
  6586. #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG _MMIO(0x9030)
  6587. #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11)
  6588. #define HSW_SCRATCH1 _MMIO(0xb038)
  6589. #define HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE (1<<27)
  6590. #define BDW_SCRATCH1 _MMIO(0xb11c)
  6591. #define GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE (1<<2)
  6592. /* PCH */
  6593. /* south display engine interrupt: IBX */
  6594. #define SDE_AUDIO_POWER_D (1 << 27)
  6595. #define SDE_AUDIO_POWER_C (1 << 26)
  6596. #define SDE_AUDIO_POWER_B (1 << 25)
  6597. #define SDE_AUDIO_POWER_SHIFT (25)
  6598. #define SDE_AUDIO_POWER_MASK (7 << SDE_AUDIO_POWER_SHIFT)
  6599. #define SDE_GMBUS (1 << 24)
  6600. #define SDE_AUDIO_HDCP_TRANSB (1 << 23)
  6601. #define SDE_AUDIO_HDCP_TRANSA (1 << 22)
  6602. #define SDE_AUDIO_HDCP_MASK (3 << 22)
  6603. #define SDE_AUDIO_TRANSB (1 << 21)
  6604. #define SDE_AUDIO_TRANSA (1 << 20)
  6605. #define SDE_AUDIO_TRANS_MASK (3 << 20)
  6606. #define SDE_POISON (1 << 19)
  6607. /* 18 reserved */
  6608. #define SDE_FDI_RXB (1 << 17)
  6609. #define SDE_FDI_RXA (1 << 16)
  6610. #define SDE_FDI_MASK (3 << 16)
  6611. #define SDE_AUXD (1 << 15)
  6612. #define SDE_AUXC (1 << 14)
  6613. #define SDE_AUXB (1 << 13)
  6614. #define SDE_AUX_MASK (7 << 13)
  6615. /* 12 reserved */
  6616. #define SDE_CRT_HOTPLUG (1 << 11)
  6617. #define SDE_PORTD_HOTPLUG (1 << 10)
  6618. #define SDE_PORTC_HOTPLUG (1 << 9)
  6619. #define SDE_PORTB_HOTPLUG (1 << 8)
  6620. #define SDE_SDVOB_HOTPLUG (1 << 6)
  6621. #define SDE_HOTPLUG_MASK (SDE_CRT_HOTPLUG | \
  6622. SDE_SDVOB_HOTPLUG | \
  6623. SDE_PORTB_HOTPLUG | \
  6624. SDE_PORTC_HOTPLUG | \
  6625. SDE_PORTD_HOTPLUG)
  6626. #define SDE_TRANSB_CRC_DONE (1 << 5)
  6627. #define SDE_TRANSB_CRC_ERR (1 << 4)
  6628. #define SDE_TRANSB_FIFO_UNDER (1 << 3)
  6629. #define SDE_TRANSA_CRC_DONE (1 << 2)
  6630. #define SDE_TRANSA_CRC_ERR (1 << 1)
  6631. #define SDE_TRANSA_FIFO_UNDER (1 << 0)
  6632. #define SDE_TRANS_MASK (0x3f)
  6633. /* south display engine interrupt: CPT/PPT */
  6634. #define SDE_AUDIO_POWER_D_CPT (1 << 31)
  6635. #define SDE_AUDIO_POWER_C_CPT (1 << 30)
  6636. #define SDE_AUDIO_POWER_B_CPT (1 << 29)
  6637. #define SDE_AUDIO_POWER_SHIFT_CPT 29
  6638. #define SDE_AUDIO_POWER_MASK_CPT (7 << 29)
  6639. #define SDE_AUXD_CPT (1 << 27)
  6640. #define SDE_AUXC_CPT (1 << 26)
  6641. #define SDE_AUXB_CPT (1 << 25)
  6642. #define SDE_AUX_MASK_CPT (7 << 25)
  6643. #define SDE_PORTE_HOTPLUG_SPT (1 << 25)
  6644. #define SDE_PORTA_HOTPLUG_SPT (1 << 24)
  6645. #define SDE_PORTD_HOTPLUG_CPT (1 << 23)
  6646. #define SDE_PORTC_HOTPLUG_CPT (1 << 22)
  6647. #define SDE_PORTB_HOTPLUG_CPT (1 << 21)
  6648. #define SDE_CRT_HOTPLUG_CPT (1 << 19)
  6649. #define SDE_SDVOB_HOTPLUG_CPT (1 << 18)
  6650. #define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \
  6651. SDE_SDVOB_HOTPLUG_CPT | \
  6652. SDE_PORTD_HOTPLUG_CPT | \
  6653. SDE_PORTC_HOTPLUG_CPT | \
  6654. SDE_PORTB_HOTPLUG_CPT)
  6655. #define SDE_HOTPLUG_MASK_SPT (SDE_PORTE_HOTPLUG_SPT | \
  6656. SDE_PORTD_HOTPLUG_CPT | \
  6657. SDE_PORTC_HOTPLUG_CPT | \
  6658. SDE_PORTB_HOTPLUG_CPT | \
  6659. SDE_PORTA_HOTPLUG_SPT)
  6660. #define SDE_GMBUS_CPT (1 << 17)
  6661. #define SDE_ERROR_CPT (1 << 16)
  6662. #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10)
  6663. #define SDE_AUDIO_CP_CHG_C_CPT (1 << 9)
  6664. #define SDE_FDI_RXC_CPT (1 << 8)
  6665. #define SDE_AUDIO_CP_REQ_B_CPT (1 << 6)
  6666. #define SDE_AUDIO_CP_CHG_B_CPT (1 << 5)
  6667. #define SDE_FDI_RXB_CPT (1 << 4)
  6668. #define SDE_AUDIO_CP_REQ_A_CPT (1 << 2)
  6669. #define SDE_AUDIO_CP_CHG_A_CPT (1 << 1)
  6670. #define SDE_FDI_RXA_CPT (1 << 0)
  6671. #define SDE_AUDIO_CP_REQ_CPT (SDE_AUDIO_CP_REQ_C_CPT | \
  6672. SDE_AUDIO_CP_REQ_B_CPT | \
  6673. SDE_AUDIO_CP_REQ_A_CPT)
  6674. #define SDE_AUDIO_CP_CHG_CPT (SDE_AUDIO_CP_CHG_C_CPT | \
  6675. SDE_AUDIO_CP_CHG_B_CPT | \
  6676. SDE_AUDIO_CP_CHG_A_CPT)
  6677. #define SDE_FDI_MASK_CPT (SDE_FDI_RXC_CPT | \
  6678. SDE_FDI_RXB_CPT | \
  6679. SDE_FDI_RXA_CPT)
  6680. #define SDEISR _MMIO(0xc4000)
  6681. #define SDEIMR _MMIO(0xc4004)
  6682. #define SDEIIR _MMIO(0xc4008)
  6683. #define SDEIER _MMIO(0xc400c)
  6684. #define SERR_INT _MMIO(0xc4040)
  6685. #define SERR_INT_POISON (1<<31)
  6686. #define SERR_INT_TRANS_FIFO_UNDERRUN(pipe) (1<<((pipe)*3))
  6687. /* digital port hotplug */
  6688. #define PCH_PORT_HOTPLUG _MMIO(0xc4030) /* SHOTPLUG_CTL */
  6689. #define PORTA_HOTPLUG_ENABLE (1 << 28) /* LPT:LP+ & BXT */
  6690. #define BXT_DDIA_HPD_INVERT (1 << 27)
  6691. #define PORTA_HOTPLUG_STATUS_MASK (3 << 24) /* SPT+ & BXT */
  6692. #define PORTA_HOTPLUG_NO_DETECT (0 << 24) /* SPT+ & BXT */
  6693. #define PORTA_HOTPLUG_SHORT_DETECT (1 << 24) /* SPT+ & BXT */
  6694. #define PORTA_HOTPLUG_LONG_DETECT (2 << 24) /* SPT+ & BXT */
  6695. #define PORTD_HOTPLUG_ENABLE (1 << 20)
  6696. #define PORTD_PULSE_DURATION_2ms (0 << 18) /* pre-LPT */
  6697. #define PORTD_PULSE_DURATION_4_5ms (1 << 18) /* pre-LPT */
  6698. #define PORTD_PULSE_DURATION_6ms (2 << 18) /* pre-LPT */
  6699. #define PORTD_PULSE_DURATION_100ms (3 << 18) /* pre-LPT */
  6700. #define PORTD_PULSE_DURATION_MASK (3 << 18) /* pre-LPT */
  6701. #define PORTD_HOTPLUG_STATUS_MASK (3 << 16)
  6702. #define PORTD_HOTPLUG_NO_DETECT (0 << 16)
  6703. #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
  6704. #define PORTD_HOTPLUG_LONG_DETECT (2 << 16)
  6705. #define PORTC_HOTPLUG_ENABLE (1 << 12)
  6706. #define BXT_DDIC_HPD_INVERT (1 << 11)
  6707. #define PORTC_PULSE_DURATION_2ms (0 << 10) /* pre-LPT */
  6708. #define PORTC_PULSE_DURATION_4_5ms (1 << 10) /* pre-LPT */
  6709. #define PORTC_PULSE_DURATION_6ms (2 << 10) /* pre-LPT */
  6710. #define PORTC_PULSE_DURATION_100ms (3 << 10) /* pre-LPT */
  6711. #define PORTC_PULSE_DURATION_MASK (3 << 10) /* pre-LPT */
  6712. #define PORTC_HOTPLUG_STATUS_MASK (3 << 8)
  6713. #define PORTC_HOTPLUG_NO_DETECT (0 << 8)
  6714. #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
  6715. #define PORTC_HOTPLUG_LONG_DETECT (2 << 8)
  6716. #define PORTB_HOTPLUG_ENABLE (1 << 4)
  6717. #define BXT_DDIB_HPD_INVERT (1 << 3)
  6718. #define PORTB_PULSE_DURATION_2ms (0 << 2) /* pre-LPT */
  6719. #define PORTB_PULSE_DURATION_4_5ms (1 << 2) /* pre-LPT */
  6720. #define PORTB_PULSE_DURATION_6ms (2 << 2) /* pre-LPT */
  6721. #define PORTB_PULSE_DURATION_100ms (3 << 2) /* pre-LPT */
  6722. #define PORTB_PULSE_DURATION_MASK (3 << 2) /* pre-LPT */
  6723. #define PORTB_HOTPLUG_STATUS_MASK (3 << 0)
  6724. #define PORTB_HOTPLUG_NO_DETECT (0 << 0)
  6725. #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
  6726. #define PORTB_HOTPLUG_LONG_DETECT (2 << 0)
  6727. #define BXT_DDI_HPD_INVERT_MASK (BXT_DDIA_HPD_INVERT | \
  6728. BXT_DDIB_HPD_INVERT | \
  6729. BXT_DDIC_HPD_INVERT)
  6730. #define PCH_PORT_HOTPLUG2 _MMIO(0xc403C) /* SHOTPLUG_CTL2 SPT+ */
  6731. #define PORTE_HOTPLUG_ENABLE (1 << 4)
  6732. #define PORTE_HOTPLUG_STATUS_MASK (3 << 0)
  6733. #define PORTE_HOTPLUG_NO_DETECT (0 << 0)
  6734. #define PORTE_HOTPLUG_SHORT_DETECT (1 << 0)
  6735. #define PORTE_HOTPLUG_LONG_DETECT (2 << 0)
  6736. #define PCH_GPIOA _MMIO(0xc5010)
  6737. #define PCH_GPIOB _MMIO(0xc5014)
  6738. #define PCH_GPIOC _MMIO(0xc5018)
  6739. #define PCH_GPIOD _MMIO(0xc501c)
  6740. #define PCH_GPIOE _MMIO(0xc5020)
  6741. #define PCH_GPIOF _MMIO(0xc5024)
  6742. #define PCH_GMBUS0 _MMIO(0xc5100)
  6743. #define PCH_GMBUS1 _MMIO(0xc5104)
  6744. #define PCH_GMBUS2 _MMIO(0xc5108)
  6745. #define PCH_GMBUS3 _MMIO(0xc510c)
  6746. #define PCH_GMBUS4 _MMIO(0xc5110)
  6747. #define PCH_GMBUS5 _MMIO(0xc5120)
  6748. #define _PCH_DPLL_A 0xc6014
  6749. #define _PCH_DPLL_B 0xc6018
  6750. #define PCH_DPLL(pll) _MMIO(pll == 0 ? _PCH_DPLL_A : _PCH_DPLL_B)
  6751. #define _PCH_FPA0 0xc6040
  6752. #define FP_CB_TUNE (0x3<<22)
  6753. #define _PCH_FPA1 0xc6044
  6754. #define _PCH_FPB0 0xc6048
  6755. #define _PCH_FPB1 0xc604c
  6756. #define PCH_FP0(pll) _MMIO(pll == 0 ? _PCH_FPA0 : _PCH_FPB0)
  6757. #define PCH_FP1(pll) _MMIO(pll == 0 ? _PCH_FPA1 : _PCH_FPB1)
  6758. #define PCH_DPLL_TEST _MMIO(0xc606c)
  6759. #define PCH_DREF_CONTROL _MMIO(0xC6200)
  6760. #define DREF_CONTROL_MASK 0x7fc3
  6761. #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
  6762. #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
  6763. #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13)
  6764. #define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13)
  6765. #define DREF_SSC_SOURCE_DISABLE (0<<11)
  6766. #define DREF_SSC_SOURCE_ENABLE (2<<11)
  6767. #define DREF_SSC_SOURCE_MASK (3<<11)
  6768. #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
  6769. #define DREF_NONSPREAD_CK505_ENABLE (1<<9)
  6770. #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
  6771. #define DREF_NONSPREAD_SOURCE_MASK (3<<9)
  6772. #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
  6773. #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
  6774. #define DREF_SUPERSPREAD_SOURCE_MASK (3<<7)
  6775. #define DREF_SSC4_DOWNSPREAD (0<<6)
  6776. #define DREF_SSC4_CENTERSPREAD (1<<6)
  6777. #define DREF_SSC1_DISABLE (0<<1)
  6778. #define DREF_SSC1_ENABLE (1<<1)
  6779. #define DREF_SSC4_DISABLE (0)
  6780. #define DREF_SSC4_ENABLE (1)
  6781. #define PCH_RAWCLK_FREQ _MMIO(0xc6204)
  6782. #define FDL_TP1_TIMER_SHIFT 12
  6783. #define FDL_TP1_TIMER_MASK (3<<12)
  6784. #define FDL_TP2_TIMER_SHIFT 10
  6785. #define FDL_TP2_TIMER_MASK (3<<10)
  6786. #define RAWCLK_FREQ_MASK 0x3ff
  6787. #define CNP_RAWCLK_DIV_MASK (0x3ff << 16)
  6788. #define CNP_RAWCLK_DIV(div) ((div) << 16)
  6789. #define CNP_RAWCLK_FRAC_MASK (0xf << 26)
  6790. #define CNP_RAWCLK_FRAC(frac) ((frac) << 26)
  6791. #define ICP_RAWCLK_DEN(den) ((den) << 26)
  6792. #define ICP_RAWCLK_NUM(num) ((num) << 11)
  6793. #define PCH_DPLL_TMR_CFG _MMIO(0xc6208)
  6794. #define PCH_SSC4_PARMS _MMIO(0xc6210)
  6795. #define PCH_SSC4_AUX_PARMS _MMIO(0xc6214)
  6796. #define PCH_DPLL_SEL _MMIO(0xc7000)
  6797. #define TRANS_DPLLB_SEL(pipe) (1 << ((pipe) * 4))
  6798. #define TRANS_DPLLA_SEL(pipe) 0
  6799. #define TRANS_DPLL_ENABLE(pipe) (1 << ((pipe) * 4 + 3))
  6800. /* transcoder */
  6801. #define _PCH_TRANS_HTOTAL_A 0xe0000
  6802. #define TRANS_HTOTAL_SHIFT 16
  6803. #define TRANS_HACTIVE_SHIFT 0
  6804. #define _PCH_TRANS_HBLANK_A 0xe0004
  6805. #define TRANS_HBLANK_END_SHIFT 16
  6806. #define TRANS_HBLANK_START_SHIFT 0
  6807. #define _PCH_TRANS_HSYNC_A 0xe0008
  6808. #define TRANS_HSYNC_END_SHIFT 16
  6809. #define TRANS_HSYNC_START_SHIFT 0
  6810. #define _PCH_TRANS_VTOTAL_A 0xe000c
  6811. #define TRANS_VTOTAL_SHIFT 16
  6812. #define TRANS_VACTIVE_SHIFT 0
  6813. #define _PCH_TRANS_VBLANK_A 0xe0010
  6814. #define TRANS_VBLANK_END_SHIFT 16
  6815. #define TRANS_VBLANK_START_SHIFT 0
  6816. #define _PCH_TRANS_VSYNC_A 0xe0014
  6817. #define TRANS_VSYNC_END_SHIFT 16
  6818. #define TRANS_VSYNC_START_SHIFT 0
  6819. #define _PCH_TRANS_VSYNCSHIFT_A 0xe0028
  6820. #define _PCH_TRANSA_DATA_M1 0xe0030
  6821. #define _PCH_TRANSA_DATA_N1 0xe0034
  6822. #define _PCH_TRANSA_DATA_M2 0xe0038
  6823. #define _PCH_TRANSA_DATA_N2 0xe003c
  6824. #define _PCH_TRANSA_LINK_M1 0xe0040
  6825. #define _PCH_TRANSA_LINK_N1 0xe0044
  6826. #define _PCH_TRANSA_LINK_M2 0xe0048
  6827. #define _PCH_TRANSA_LINK_N2 0xe004c
  6828. /* Per-transcoder DIP controls (PCH) */
  6829. #define _VIDEO_DIP_CTL_A 0xe0200
  6830. #define _VIDEO_DIP_DATA_A 0xe0208
  6831. #define _VIDEO_DIP_GCP_A 0xe0210
  6832. #define GCP_COLOR_INDICATION (1 << 2)
  6833. #define GCP_DEFAULT_PHASE_ENABLE (1 << 1)
  6834. #define GCP_AV_MUTE (1 << 0)
  6835. #define _VIDEO_DIP_CTL_B 0xe1200
  6836. #define _VIDEO_DIP_DATA_B 0xe1208
  6837. #define _VIDEO_DIP_GCP_B 0xe1210
  6838. #define TVIDEO_DIP_CTL(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B)
  6839. #define TVIDEO_DIP_DATA(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B)
  6840. #define TVIDEO_DIP_GCP(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
  6841. /* Per-transcoder DIP controls (VLV) */
  6842. #define _VLV_VIDEO_DIP_CTL_A (VLV_DISPLAY_BASE + 0x60200)
  6843. #define _VLV_VIDEO_DIP_DATA_A (VLV_DISPLAY_BASE + 0x60208)
  6844. #define _VLV_VIDEO_DIP_GDCP_PAYLOAD_A (VLV_DISPLAY_BASE + 0x60210)
  6845. #define _VLV_VIDEO_DIP_CTL_B (VLV_DISPLAY_BASE + 0x61170)
  6846. #define _VLV_VIDEO_DIP_DATA_B (VLV_DISPLAY_BASE + 0x61174)
  6847. #define _VLV_VIDEO_DIP_GDCP_PAYLOAD_B (VLV_DISPLAY_BASE + 0x61178)
  6848. #define _CHV_VIDEO_DIP_CTL_C (VLV_DISPLAY_BASE + 0x611f0)
  6849. #define _CHV_VIDEO_DIP_DATA_C (VLV_DISPLAY_BASE + 0x611f4)
  6850. #define _CHV_VIDEO_DIP_GDCP_PAYLOAD_C (VLV_DISPLAY_BASE + 0x611f8)
  6851. #define VLV_TVIDEO_DIP_CTL(pipe) \
  6852. _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_CTL_A, \
  6853. _VLV_VIDEO_DIP_CTL_B, _CHV_VIDEO_DIP_CTL_C)
  6854. #define VLV_TVIDEO_DIP_DATA(pipe) \
  6855. _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_DATA_A, \
  6856. _VLV_VIDEO_DIP_DATA_B, _CHV_VIDEO_DIP_DATA_C)
  6857. #define VLV_TVIDEO_DIP_GCP(pipe) \
  6858. _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
  6859. _VLV_VIDEO_DIP_GDCP_PAYLOAD_B, _CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
  6860. /* Haswell DIP controls */
  6861. #define _HSW_VIDEO_DIP_CTL_A 0x60200
  6862. #define _HSW_VIDEO_DIP_AVI_DATA_A 0x60220
  6863. #define _HSW_VIDEO_DIP_VS_DATA_A 0x60260
  6864. #define _HSW_VIDEO_DIP_SPD_DATA_A 0x602A0
  6865. #define _HSW_VIDEO_DIP_GMP_DATA_A 0x602E0
  6866. #define _HSW_VIDEO_DIP_VSC_DATA_A 0x60320
  6867. #define _HSW_VIDEO_DIP_AVI_ECC_A 0x60240
  6868. #define _HSW_VIDEO_DIP_VS_ECC_A 0x60280
  6869. #define _HSW_VIDEO_DIP_SPD_ECC_A 0x602C0
  6870. #define _HSW_VIDEO_DIP_GMP_ECC_A 0x60300
  6871. #define _HSW_VIDEO_DIP_VSC_ECC_A 0x60344
  6872. #define _HSW_VIDEO_DIP_GCP_A 0x60210
  6873. #define _HSW_VIDEO_DIP_CTL_B 0x61200
  6874. #define _HSW_VIDEO_DIP_AVI_DATA_B 0x61220
  6875. #define _HSW_VIDEO_DIP_VS_DATA_B 0x61260
  6876. #define _HSW_VIDEO_DIP_SPD_DATA_B 0x612A0
  6877. #define _HSW_VIDEO_DIP_GMP_DATA_B 0x612E0
  6878. #define _HSW_VIDEO_DIP_VSC_DATA_B 0x61320
  6879. #define _HSW_VIDEO_DIP_BVI_ECC_B 0x61240
  6880. #define _HSW_VIDEO_DIP_VS_ECC_B 0x61280
  6881. #define _HSW_VIDEO_DIP_SPD_ECC_B 0x612C0
  6882. #define _HSW_VIDEO_DIP_GMP_ECC_B 0x61300
  6883. #define _HSW_VIDEO_DIP_VSC_ECC_B 0x61344
  6884. #define _HSW_VIDEO_DIP_GCP_B 0x61210
  6885. #define HSW_TVIDEO_DIP_CTL(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_CTL_A)
  6886. #define HSW_TVIDEO_DIP_AVI_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_AVI_DATA_A + (i) * 4)
  6887. #define HSW_TVIDEO_DIP_VS_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VS_DATA_A + (i) * 4)
  6888. #define HSW_TVIDEO_DIP_SPD_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4)
  6889. #define HSW_TVIDEO_DIP_GCP(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GCP_A)
  6890. #define HSW_TVIDEO_DIP_VSC_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4)
  6891. #define _HSW_STEREO_3D_CTL_A 0x70020
  6892. #define S3D_ENABLE (1<<31)
  6893. #define _HSW_STEREO_3D_CTL_B 0x71020
  6894. #define HSW_STEREO_3D_CTL(trans) _MMIO_PIPE2(trans, _HSW_STEREO_3D_CTL_A)
  6895. #define _PCH_TRANS_HTOTAL_B 0xe1000
  6896. #define _PCH_TRANS_HBLANK_B 0xe1004
  6897. #define _PCH_TRANS_HSYNC_B 0xe1008
  6898. #define _PCH_TRANS_VTOTAL_B 0xe100c
  6899. #define _PCH_TRANS_VBLANK_B 0xe1010
  6900. #define _PCH_TRANS_VSYNC_B 0xe1014
  6901. #define _PCH_TRANS_VSYNCSHIFT_B 0xe1028
  6902. #define PCH_TRANS_HTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HTOTAL_A, _PCH_TRANS_HTOTAL_B)
  6903. #define PCH_TRANS_HBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HBLANK_A, _PCH_TRANS_HBLANK_B)
  6904. #define PCH_TRANS_HSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HSYNC_A, _PCH_TRANS_HSYNC_B)
  6905. #define PCH_TRANS_VTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VTOTAL_A, _PCH_TRANS_VTOTAL_B)
  6906. #define PCH_TRANS_VBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VBLANK_A, _PCH_TRANS_VBLANK_B)
  6907. #define PCH_TRANS_VSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNC_A, _PCH_TRANS_VSYNC_B)
  6908. #define PCH_TRANS_VSYNCSHIFT(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNCSHIFT_A, _PCH_TRANS_VSYNCSHIFT_B)
  6909. #define _PCH_TRANSB_DATA_M1 0xe1030
  6910. #define _PCH_TRANSB_DATA_N1 0xe1034
  6911. #define _PCH_TRANSB_DATA_M2 0xe1038
  6912. #define _PCH_TRANSB_DATA_N2 0xe103c
  6913. #define _PCH_TRANSB_LINK_M1 0xe1040
  6914. #define _PCH_TRANSB_LINK_N1 0xe1044
  6915. #define _PCH_TRANSB_LINK_M2 0xe1048
  6916. #define _PCH_TRANSB_LINK_N2 0xe104c
  6917. #define PCH_TRANS_DATA_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M1, _PCH_TRANSB_DATA_M1)
  6918. #define PCH_TRANS_DATA_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N1, _PCH_TRANSB_DATA_N1)
  6919. #define PCH_TRANS_DATA_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M2, _PCH_TRANSB_DATA_M2)
  6920. #define PCH_TRANS_DATA_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N2, _PCH_TRANSB_DATA_N2)
  6921. #define PCH_TRANS_LINK_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M1, _PCH_TRANSB_LINK_M1)
  6922. #define PCH_TRANS_LINK_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N1, _PCH_TRANSB_LINK_N1)
  6923. #define PCH_TRANS_LINK_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M2, _PCH_TRANSB_LINK_M2)
  6924. #define PCH_TRANS_LINK_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N2, _PCH_TRANSB_LINK_N2)
  6925. #define _PCH_TRANSACONF 0xf0008
  6926. #define _PCH_TRANSBCONF 0xf1008
  6927. #define PCH_TRANSCONF(pipe) _MMIO_PIPE(pipe, _PCH_TRANSACONF, _PCH_TRANSBCONF)
  6928. #define LPT_TRANSCONF PCH_TRANSCONF(PIPE_A) /* lpt has only one transcoder */
  6929. #define TRANS_DISABLE (0<<31)
  6930. #define TRANS_ENABLE (1<<31)
  6931. #define TRANS_STATE_MASK (1<<30)
  6932. #define TRANS_STATE_DISABLE (0<<30)
  6933. #define TRANS_STATE_ENABLE (1<<30)
  6934. #define TRANS_FSYNC_DELAY_HB1 (0<<27)
  6935. #define TRANS_FSYNC_DELAY_HB2 (1<<27)
  6936. #define TRANS_FSYNC_DELAY_HB3 (2<<27)
  6937. #define TRANS_FSYNC_DELAY_HB4 (3<<27)
  6938. #define TRANS_INTERLACE_MASK (7<<21)
  6939. #define TRANS_PROGRESSIVE (0<<21)
  6940. #define TRANS_INTERLACED (3<<21)
  6941. #define TRANS_LEGACY_INTERLACED_ILK (2<<21)
  6942. #define TRANS_8BPC (0<<5)
  6943. #define TRANS_10BPC (1<<5)
  6944. #define TRANS_6BPC (2<<5)
  6945. #define TRANS_12BPC (3<<5)
  6946. #define _TRANSA_CHICKEN1 0xf0060
  6947. #define _TRANSB_CHICKEN1 0xf1060
  6948. #define TRANS_CHICKEN1(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN1, _TRANSB_CHICKEN1)
  6949. #define TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE (1<<10)
  6950. #define TRANS_CHICKEN1_DP0UNIT_GC_DISABLE (1<<4)
  6951. #define _TRANSA_CHICKEN2 0xf0064
  6952. #define _TRANSB_CHICKEN2 0xf1064
  6953. #define TRANS_CHICKEN2(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2)
  6954. #define TRANS_CHICKEN2_TIMING_OVERRIDE (1<<31)
  6955. #define TRANS_CHICKEN2_FDI_POLARITY_REVERSED (1<<29)
  6956. #define TRANS_CHICKEN2_FRAME_START_DELAY_MASK (3<<27)
  6957. #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_COUNTER (1<<26)
  6958. #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_MODESWITCH (1<<25)
  6959. #define SOUTH_CHICKEN1 _MMIO(0xc2000)
  6960. #define FDIA_PHASE_SYNC_SHIFT_OVR 19
  6961. #define FDIA_PHASE_SYNC_SHIFT_EN 18
  6962. #define FDI_PHASE_SYNC_OVR(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2)))
  6963. #define FDI_PHASE_SYNC_EN(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2)))
  6964. #define FDI_BC_BIFURCATION_SELECT (1 << 12)
  6965. #define CHASSIS_CLK_REQ_DURATION_MASK (0xf << 8)
  6966. #define CHASSIS_CLK_REQ_DURATION(x) ((x) << 8)
  6967. #define SPT_PWM_GRANULARITY (1<<0)
  6968. #define SOUTH_CHICKEN2 _MMIO(0xc2004)
  6969. #define FDI_MPHY_IOSFSB_RESET_STATUS (1<<13)
  6970. #define FDI_MPHY_IOSFSB_RESET_CTL (1<<12)
  6971. #define LPT_PWM_GRANULARITY (1<<5)
  6972. #define DPLS_EDP_PPS_FIX_DIS (1<<0)
  6973. #define _FDI_RXA_CHICKEN 0xc200c
  6974. #define _FDI_RXB_CHICKEN 0xc2010
  6975. #define FDI_RX_PHASE_SYNC_POINTER_OVR (1<<1)
  6976. #define FDI_RX_PHASE_SYNC_POINTER_EN (1<<0)
  6977. #define FDI_RX_CHICKEN(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CHICKEN, _FDI_RXB_CHICKEN)
  6978. #define SOUTH_DSPCLK_GATE_D _MMIO(0xc2020)
  6979. #define PCH_GMBUSUNIT_CLOCK_GATE_DISABLE (1<<31)
  6980. #define PCH_DPLUNIT_CLOCK_GATE_DISABLE (1<<30)
  6981. #define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1<<29)
  6982. #define PCH_CPUNIT_CLOCK_GATE_DISABLE (1<<14)
  6983. #define CNP_PWM_CGE_GATING_DISABLE (1<<13)
  6984. #define PCH_LP_PARTITION_LEVEL_DISABLE (1<<12)
  6985. /* CPU: FDI_TX */
  6986. #define _FDI_TXA_CTL 0x60100
  6987. #define _FDI_TXB_CTL 0x61100
  6988. #define FDI_TX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_TXA_CTL, _FDI_TXB_CTL)
  6989. #define FDI_TX_DISABLE (0<<31)
  6990. #define FDI_TX_ENABLE (1<<31)
  6991. #define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
  6992. #define FDI_LINK_TRAIN_PATTERN_2 (1<<28)
  6993. #define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28)
  6994. #define FDI_LINK_TRAIN_NONE (3<<28)
  6995. #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25)
  6996. #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25)
  6997. #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25)
  6998. #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25)
  6999. #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)
  7000. #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)
  7001. #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22)
  7002. #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22)
  7003. /* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.
  7004. SNB has different settings. */
  7005. /* SNB A-stepping */
  7006. #define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
  7007. #define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
  7008. #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
  7009. #define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
  7010. /* SNB B-stepping */
  7011. #define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
  7012. #define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
  7013. #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
  7014. #define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
  7015. #define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f<<22)
  7016. #define FDI_DP_PORT_WIDTH_SHIFT 19
  7017. #define FDI_DP_PORT_WIDTH_MASK (7 << FDI_DP_PORT_WIDTH_SHIFT)
  7018. #define FDI_DP_PORT_WIDTH(width) (((width) - 1) << FDI_DP_PORT_WIDTH_SHIFT)
  7019. #define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18)
  7020. /* Ironlake: hardwired to 1 */
  7021. #define FDI_TX_PLL_ENABLE (1<<14)
  7022. /* Ivybridge has different bits for lolz */
  7023. #define FDI_LINK_TRAIN_PATTERN_1_IVB (0<<8)
  7024. #define FDI_LINK_TRAIN_PATTERN_2_IVB (1<<8)
  7025. #define FDI_LINK_TRAIN_PATTERN_IDLE_IVB (2<<8)
  7026. #define FDI_LINK_TRAIN_NONE_IVB (3<<8)
  7027. /* both Tx and Rx */
  7028. #define FDI_COMPOSITE_SYNC (1<<11)
  7029. #define FDI_LINK_TRAIN_AUTO (1<<10)
  7030. #define FDI_SCRAMBLING_ENABLE (0<<7)
  7031. #define FDI_SCRAMBLING_DISABLE (1<<7)
  7032. /* FDI_RX, FDI_X is hard-wired to Transcoder_X */
  7033. #define _FDI_RXA_CTL 0xf000c
  7034. #define _FDI_RXB_CTL 0xf100c
  7035. #define FDI_RX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CTL, _FDI_RXB_CTL)
  7036. #define FDI_RX_ENABLE (1<<31)
  7037. /* train, dp width same as FDI_TX */
  7038. #define FDI_FS_ERRC_ENABLE (1<<27)
  7039. #define FDI_FE_ERRC_ENABLE (1<<26)
  7040. #define FDI_RX_POLARITY_REVERSED_LPT (1<<16)
  7041. #define FDI_8BPC (0<<16)
  7042. #define FDI_10BPC (1<<16)
  7043. #define FDI_6BPC (2<<16)
  7044. #define FDI_12BPC (3<<16)
  7045. #define FDI_RX_LINK_REVERSAL_OVERRIDE (1<<15)
  7046. #define FDI_DMI_LINK_REVERSE_MASK (1<<14)
  7047. #define FDI_RX_PLL_ENABLE (1<<13)
  7048. #define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
  7049. #define FDI_FE_ERR_CORRECT_ENABLE (1<<10)
  7050. #define FDI_FS_ERR_REPORT_ENABLE (1<<9)
  7051. #define FDI_FE_ERR_REPORT_ENABLE (1<<8)
  7052. #define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6)
  7053. #define FDI_PCDCLK (1<<4)
  7054. /* CPT */
  7055. #define FDI_AUTO_TRAINING (1<<10)
  7056. #define FDI_LINK_TRAIN_PATTERN_1_CPT (0<<8)
  7057. #define FDI_LINK_TRAIN_PATTERN_2_CPT (1<<8)
  7058. #define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2<<8)
  7059. #define FDI_LINK_TRAIN_NORMAL_CPT (3<<8)
  7060. #define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3<<8)
  7061. #define _FDI_RXA_MISC 0xf0010
  7062. #define _FDI_RXB_MISC 0xf1010
  7063. #define FDI_RX_PWRDN_LANE1_MASK (3<<26)
  7064. #define FDI_RX_PWRDN_LANE1_VAL(x) ((x)<<26)
  7065. #define FDI_RX_PWRDN_LANE0_MASK (3<<24)
  7066. #define FDI_RX_PWRDN_LANE0_VAL(x) ((x)<<24)
  7067. #define FDI_RX_TP1_TO_TP2_48 (2<<20)
  7068. #define FDI_RX_TP1_TO_TP2_64 (3<<20)
  7069. #define FDI_RX_FDI_DELAY_90 (0x90<<0)
  7070. #define FDI_RX_MISC(pipe) _MMIO_PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC)
  7071. #define _FDI_RXA_TUSIZE1 0xf0030
  7072. #define _FDI_RXA_TUSIZE2 0xf0038
  7073. #define _FDI_RXB_TUSIZE1 0xf1030
  7074. #define _FDI_RXB_TUSIZE2 0xf1038
  7075. #define FDI_RX_TUSIZE1(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1)
  7076. #define FDI_RX_TUSIZE2(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2)
  7077. /* FDI_RX interrupt register format */
  7078. #define FDI_RX_INTER_LANE_ALIGN (1<<10)
  7079. #define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */
  7080. #define FDI_RX_BIT_LOCK (1<<8) /* train 1 */
  7081. #define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7)
  7082. #define FDI_RX_FS_CODE_ERR (1<<6)
  7083. #define FDI_RX_FE_CODE_ERR (1<<5)
  7084. #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4)
  7085. #define FDI_RX_HDCP_LINK_FAIL (1<<3)
  7086. #define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2)
  7087. #define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
  7088. #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
  7089. #define _FDI_RXA_IIR 0xf0014
  7090. #define _FDI_RXA_IMR 0xf0018
  7091. #define _FDI_RXB_IIR 0xf1014
  7092. #define _FDI_RXB_IMR 0xf1018
  7093. #define FDI_RX_IIR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IIR, _FDI_RXB_IIR)
  7094. #define FDI_RX_IMR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IMR, _FDI_RXB_IMR)
  7095. #define FDI_PLL_CTL_1 _MMIO(0xfe000)
  7096. #define FDI_PLL_CTL_2 _MMIO(0xfe004)
  7097. #define PCH_LVDS _MMIO(0xe1180)
  7098. #define LVDS_DETECTED (1 << 1)
  7099. #define _PCH_DP_B 0xe4100
  7100. #define PCH_DP_B _MMIO(_PCH_DP_B)
  7101. #define _PCH_DPB_AUX_CH_CTL 0xe4110
  7102. #define _PCH_DPB_AUX_CH_DATA1 0xe4114
  7103. #define _PCH_DPB_AUX_CH_DATA2 0xe4118
  7104. #define _PCH_DPB_AUX_CH_DATA3 0xe411c
  7105. #define _PCH_DPB_AUX_CH_DATA4 0xe4120
  7106. #define _PCH_DPB_AUX_CH_DATA5 0xe4124
  7107. #define _PCH_DP_C 0xe4200
  7108. #define PCH_DP_C _MMIO(_PCH_DP_C)
  7109. #define _PCH_DPC_AUX_CH_CTL 0xe4210
  7110. #define _PCH_DPC_AUX_CH_DATA1 0xe4214
  7111. #define _PCH_DPC_AUX_CH_DATA2 0xe4218
  7112. #define _PCH_DPC_AUX_CH_DATA3 0xe421c
  7113. #define _PCH_DPC_AUX_CH_DATA4 0xe4220
  7114. #define _PCH_DPC_AUX_CH_DATA5 0xe4224
  7115. #define _PCH_DP_D 0xe4300
  7116. #define PCH_DP_D _MMIO(_PCH_DP_D)
  7117. #define _PCH_DPD_AUX_CH_CTL 0xe4310
  7118. #define _PCH_DPD_AUX_CH_DATA1 0xe4314
  7119. #define _PCH_DPD_AUX_CH_DATA2 0xe4318
  7120. #define _PCH_DPD_AUX_CH_DATA3 0xe431c
  7121. #define _PCH_DPD_AUX_CH_DATA4 0xe4320
  7122. #define _PCH_DPD_AUX_CH_DATA5 0xe4324
  7123. #define PCH_DP_AUX_CH_CTL(aux_ch) _MMIO_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
  7124. #define PCH_DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
  7125. /* CPT */
  7126. #define PORT_TRANS_A_SEL_CPT 0
  7127. #define PORT_TRANS_B_SEL_CPT (1<<29)
  7128. #define PORT_TRANS_C_SEL_CPT (2<<29)
  7129. #define PORT_TRANS_SEL_MASK (3<<29)
  7130. #define PORT_TRANS_SEL_CPT(pipe) ((pipe) << 29)
  7131. #define PORT_TO_PIPE(val) (((val) & (1<<30)) >> 30)
  7132. #define PORT_TO_PIPE_CPT(val) (((val) & PORT_TRANS_SEL_MASK) >> 29)
  7133. #define SDVO_PORT_TO_PIPE_CHV(val) (((val) & (3<<24)) >> 24)
  7134. #define DP_PORT_TO_PIPE_CHV(val) (((val) & (3<<16)) >> 16)
  7135. #define _TRANS_DP_CTL_A 0xe0300
  7136. #define _TRANS_DP_CTL_B 0xe1300
  7137. #define _TRANS_DP_CTL_C 0xe2300
  7138. #define TRANS_DP_CTL(pipe) _MMIO_PIPE(pipe, _TRANS_DP_CTL_A, _TRANS_DP_CTL_B)
  7139. #define TRANS_DP_OUTPUT_ENABLE (1<<31)
  7140. #define TRANS_DP_PORT_SEL_B (0<<29)
  7141. #define TRANS_DP_PORT_SEL_C (1<<29)
  7142. #define TRANS_DP_PORT_SEL_D (2<<29)
  7143. #define TRANS_DP_PORT_SEL_NONE (3<<29)
  7144. #define TRANS_DP_PORT_SEL_MASK (3<<29)
  7145. #define TRANS_DP_PIPE_TO_PORT(val) ((((val) & TRANS_DP_PORT_SEL_MASK) >> 29) + PORT_B)
  7146. #define TRANS_DP_AUDIO_ONLY (1<<26)
  7147. #define TRANS_DP_ENH_FRAMING (1<<18)
  7148. #define TRANS_DP_8BPC (0<<9)
  7149. #define TRANS_DP_10BPC (1<<9)
  7150. #define TRANS_DP_6BPC (2<<9)
  7151. #define TRANS_DP_12BPC (3<<9)
  7152. #define TRANS_DP_BPC_MASK (3<<9)
  7153. #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
  7154. #define TRANS_DP_VSYNC_ACTIVE_LOW 0
  7155. #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
  7156. #define TRANS_DP_HSYNC_ACTIVE_LOW 0
  7157. #define TRANS_DP_SYNC_MASK (3<<3)
  7158. /* SNB eDP training params */
  7159. /* SNB A-stepping */
  7160. #define EDP_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
  7161. #define EDP_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
  7162. #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
  7163. #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
  7164. /* SNB B-stepping */
  7165. #define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0<<22)
  7166. #define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1<<22)
  7167. #define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a<<22)
  7168. #define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39<<22)
  7169. #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22)
  7170. #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22)
  7171. /* IVB */
  7172. #define EDP_LINK_TRAIN_400MV_0DB_IVB (0x24 <<22)
  7173. #define EDP_LINK_TRAIN_400MV_3_5DB_IVB (0x2a <<22)
  7174. #define EDP_LINK_TRAIN_400MV_6DB_IVB (0x2f <<22)
  7175. #define EDP_LINK_TRAIN_600MV_0DB_IVB (0x30 <<22)
  7176. #define EDP_LINK_TRAIN_600MV_3_5DB_IVB (0x36 <<22)
  7177. #define EDP_LINK_TRAIN_800MV_0DB_IVB (0x38 <<22)
  7178. #define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x3e <<22)
  7179. /* legacy values */
  7180. #define EDP_LINK_TRAIN_500MV_0DB_IVB (0x00 <<22)
  7181. #define EDP_LINK_TRAIN_1000MV_0DB_IVB (0x20 <<22)
  7182. #define EDP_LINK_TRAIN_500MV_3_5DB_IVB (0x02 <<22)
  7183. #define EDP_LINK_TRAIN_1000MV_3_5DB_IVB (0x22 <<22)
  7184. #define EDP_LINK_TRAIN_1000MV_6DB_IVB (0x23 <<22)
  7185. #define EDP_LINK_TRAIN_VOL_EMP_MASK_IVB (0x3f<<22)
  7186. #define VLV_PMWGICZ _MMIO(0x1300a4)
  7187. #define RC6_LOCATION _MMIO(0xD40)
  7188. #define RC6_CTX_IN_DRAM (1 << 0)
  7189. #define RC6_CTX_BASE _MMIO(0xD48)
  7190. #define RC6_CTX_BASE_MASK 0xFFFFFFF0
  7191. #define PWRCTX_MAXCNT_RCSUNIT _MMIO(0x2054)
  7192. #define PWRCTX_MAXCNT_VCSUNIT0 _MMIO(0x12054)
  7193. #define PWRCTX_MAXCNT_BCSUNIT _MMIO(0x22054)
  7194. #define PWRCTX_MAXCNT_VECSUNIT _MMIO(0x1A054)
  7195. #define PWRCTX_MAXCNT_VCSUNIT1 _MMIO(0x1C054)
  7196. #define IDLE_TIME_MASK 0xFFFFF
  7197. #define FORCEWAKE _MMIO(0xA18C)
  7198. #define FORCEWAKE_VLV _MMIO(0x1300b0)
  7199. #define FORCEWAKE_ACK_VLV _MMIO(0x1300b4)
  7200. #define FORCEWAKE_MEDIA_VLV _MMIO(0x1300b8)
  7201. #define FORCEWAKE_ACK_MEDIA_VLV _MMIO(0x1300bc)
  7202. #define FORCEWAKE_ACK_HSW _MMIO(0x130044)
  7203. #define FORCEWAKE_ACK _MMIO(0x130090)
  7204. #define VLV_GTLC_WAKE_CTRL _MMIO(0x130090)
  7205. #define VLV_GTLC_RENDER_CTX_EXISTS (1 << 25)
  7206. #define VLV_GTLC_MEDIA_CTX_EXISTS (1 << 24)
  7207. #define VLV_GTLC_ALLOWWAKEREQ (1 << 0)
  7208. #define VLV_GTLC_PW_STATUS _MMIO(0x130094)
  7209. #define VLV_GTLC_ALLOWWAKEACK (1 << 0)
  7210. #define VLV_GTLC_ALLOWWAKEERR (1 << 1)
  7211. #define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5)
  7212. #define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7)
  7213. #define FORCEWAKE_MT _MMIO(0xa188) /* multi-threaded */
  7214. #define FORCEWAKE_MEDIA_GEN9 _MMIO(0xa270)
  7215. #define FORCEWAKE_MEDIA_VDBOX_GEN11(n) _MMIO(0xa540 + (n) * 4)
  7216. #define FORCEWAKE_MEDIA_VEBOX_GEN11(n) _MMIO(0xa560 + (n) * 4)
  7217. #define FORCEWAKE_RENDER_GEN9 _MMIO(0xa278)
  7218. #define FORCEWAKE_BLITTER_GEN9 _MMIO(0xa188)
  7219. #define FORCEWAKE_ACK_MEDIA_GEN9 _MMIO(0x0D88)
  7220. #define FORCEWAKE_ACK_MEDIA_VDBOX_GEN11(n) _MMIO(0x0D50 + (n) * 4)
  7221. #define FORCEWAKE_ACK_MEDIA_VEBOX_GEN11(n) _MMIO(0x0D70 + (n) * 4)
  7222. #define FORCEWAKE_ACK_RENDER_GEN9 _MMIO(0x0D84)
  7223. #define FORCEWAKE_ACK_BLITTER_GEN9 _MMIO(0x130044)
  7224. #define FORCEWAKE_KERNEL BIT(0)
  7225. #define FORCEWAKE_USER BIT(1)
  7226. #define FORCEWAKE_KERNEL_FALLBACK BIT(15)
  7227. #define FORCEWAKE_MT_ACK _MMIO(0x130040)
  7228. #define ECOBUS _MMIO(0xa180)
  7229. #define FORCEWAKE_MT_ENABLE (1<<5)
  7230. #define VLV_SPAREG2H _MMIO(0xA194)
  7231. #define GEN9_PWRGT_DOMAIN_STATUS _MMIO(0xA2A0)
  7232. #define GEN9_PWRGT_MEDIA_STATUS_MASK (1 << 0)
  7233. #define GEN9_PWRGT_RENDER_STATUS_MASK (1 << 1)
  7234. #define GTFIFODBG _MMIO(0x120000)
  7235. #define GT_FIFO_SBDEDICATE_FREE_ENTRY_CHV (0x1f << 20)
  7236. #define GT_FIFO_FREE_ENTRIES_CHV (0x7f << 13)
  7237. #define GT_FIFO_SBDROPERR (1<<6)
  7238. #define GT_FIFO_BLOBDROPERR (1<<5)
  7239. #define GT_FIFO_SB_READ_ABORTERR (1<<4)
  7240. #define GT_FIFO_DROPERR (1<<3)
  7241. #define GT_FIFO_OVFERR (1<<2)
  7242. #define GT_FIFO_IAWRERR (1<<1)
  7243. #define GT_FIFO_IARDERR (1<<0)
  7244. #define GTFIFOCTL _MMIO(0x120008)
  7245. #define GT_FIFO_FREE_ENTRIES_MASK 0x7f
  7246. #define GT_FIFO_NUM_RESERVED_ENTRIES 20
  7247. #define GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL (1 << 12)
  7248. #define GT_FIFO_CTL_RC6_POLICY_STALL (1 << 11)
  7249. #define HSW_IDICR _MMIO(0x9008)
  7250. #define IDIHASHMSK(x) (((x) & 0x3f) << 16)
  7251. #define HSW_EDRAM_CAP _MMIO(0x120010)
  7252. #define EDRAM_ENABLED 0x1
  7253. #define EDRAM_NUM_BANKS(cap) (((cap) >> 1) & 0xf)
  7254. #define EDRAM_WAYS_IDX(cap) (((cap) >> 5) & 0x7)
  7255. #define EDRAM_SETS_IDX(cap) (((cap) >> 8) & 0x3)
  7256. #define GEN6_UCGCTL1 _MMIO(0x9400)
  7257. # define GEN6_GAMUNIT_CLOCK_GATE_DISABLE (1 << 22)
  7258. # define GEN6_EU_TCUNIT_CLOCK_GATE_DISABLE (1 << 16)
  7259. # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE (1 << 5)
  7260. # define GEN6_CSUNIT_CLOCK_GATE_DISABLE (1 << 7)
  7261. #define GEN6_UCGCTL2 _MMIO(0x9404)
  7262. # define GEN6_VFUNIT_CLOCK_GATE_DISABLE (1 << 31)
  7263. # define GEN7_VDSUNIT_CLOCK_GATE_DISABLE (1 << 30)
  7264. # define GEN7_TDLUNIT_CLOCK_GATE_DISABLE (1 << 22)
  7265. # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13)
  7266. # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12)
  7267. # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11)
  7268. #define GEN6_UCGCTL3 _MMIO(0x9408)
  7269. # define GEN6_OACSUNIT_CLOCK_GATE_DISABLE (1 << 20)
  7270. #define GEN7_UCGCTL4 _MMIO(0x940c)
  7271. #define GEN7_L3BANK2X_CLOCK_GATE_DISABLE (1<<25)
  7272. #define GEN8_EU_GAUNIT_CLOCK_GATE_DISABLE (1<<14)
  7273. #define GEN6_RCGCTL1 _MMIO(0x9410)
  7274. #define GEN6_RCGCTL2 _MMIO(0x9414)
  7275. #define GEN6_RSTCTL _MMIO(0x9420)
  7276. #define GEN8_UCGCTL6 _MMIO(0x9430)
  7277. #define GEN8_GAPSUNIT_CLOCK_GATE_DISABLE (1<<24)
  7278. #define GEN8_SDEUNIT_CLOCK_GATE_DISABLE (1<<14)
  7279. #define GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
  7280. #define GEN6_GFXPAUSE _MMIO(0xA000)
  7281. #define GEN6_RPNSWREQ _MMIO(0xA008)
  7282. #define GEN6_TURBO_DISABLE (1<<31)
  7283. #define GEN6_FREQUENCY(x) ((x)<<25)
  7284. #define HSW_FREQUENCY(x) ((x)<<24)
  7285. #define GEN9_FREQUENCY(x) ((x)<<23)
  7286. #define GEN6_OFFSET(x) ((x)<<19)
  7287. #define GEN6_AGGRESSIVE_TURBO (0<<15)
  7288. #define GEN6_RC_VIDEO_FREQ _MMIO(0xA00C)
  7289. #define GEN6_RC_CONTROL _MMIO(0xA090)
  7290. #define GEN6_RC_CTL_RC6pp_ENABLE (1<<16)
  7291. #define GEN6_RC_CTL_RC6p_ENABLE (1<<17)
  7292. #define GEN6_RC_CTL_RC6_ENABLE (1<<18)
  7293. #define GEN6_RC_CTL_RC1e_ENABLE (1<<20)
  7294. #define GEN6_RC_CTL_RC7_ENABLE (1<<22)
  7295. #define VLV_RC_CTL_CTX_RST_PARALLEL (1<<24)
  7296. #define GEN7_RC_CTL_TO_MODE (1<<28)
  7297. #define GEN6_RC_CTL_EI_MODE(x) ((x)<<27)
  7298. #define GEN6_RC_CTL_HW_ENABLE (1<<31)
  7299. #define GEN6_RP_DOWN_TIMEOUT _MMIO(0xA010)
  7300. #define GEN6_RP_INTERRUPT_LIMITS _MMIO(0xA014)
  7301. #define GEN6_RPSTAT1 _MMIO(0xA01C)
  7302. #define GEN6_CAGF_SHIFT 8
  7303. #define HSW_CAGF_SHIFT 7
  7304. #define GEN9_CAGF_SHIFT 23
  7305. #define GEN6_CAGF_MASK (0x7f << GEN6_CAGF_SHIFT)
  7306. #define HSW_CAGF_MASK (0x7f << HSW_CAGF_SHIFT)
  7307. #define GEN9_CAGF_MASK (0x1ff << GEN9_CAGF_SHIFT)
  7308. #define GEN6_RP_CONTROL _MMIO(0xA024)
  7309. #define GEN6_RP_MEDIA_TURBO (1<<11)
  7310. #define GEN6_RP_MEDIA_MODE_MASK (3<<9)
  7311. #define GEN6_RP_MEDIA_HW_TURBO_MODE (3<<9)
  7312. #define GEN6_RP_MEDIA_HW_NORMAL_MODE (2<<9)
  7313. #define GEN6_RP_MEDIA_HW_MODE (1<<9)
  7314. #define GEN6_RP_MEDIA_SW_MODE (0<<9)
  7315. #define GEN6_RP_MEDIA_IS_GFX (1<<8)
  7316. #define GEN6_RP_ENABLE (1<<7)
  7317. #define GEN6_RP_UP_IDLE_MIN (0x1<<3)
  7318. #define GEN6_RP_UP_BUSY_AVG (0x2<<3)
  7319. #define GEN6_RP_UP_BUSY_CONT (0x4<<3)
  7320. #define GEN6_RP_DOWN_IDLE_AVG (0x2<<0)
  7321. #define GEN6_RP_DOWN_IDLE_CONT (0x1<<0)
  7322. #define GEN6_RP_UP_THRESHOLD _MMIO(0xA02C)
  7323. #define GEN6_RP_DOWN_THRESHOLD _MMIO(0xA030)
  7324. #define GEN6_RP_CUR_UP_EI _MMIO(0xA050)
  7325. #define GEN6_RP_EI_MASK 0xffffff
  7326. #define GEN6_CURICONT_MASK GEN6_RP_EI_MASK
  7327. #define GEN6_RP_CUR_UP _MMIO(0xA054)
  7328. #define GEN6_CURBSYTAVG_MASK GEN6_RP_EI_MASK
  7329. #define GEN6_RP_PREV_UP _MMIO(0xA058)
  7330. #define GEN6_RP_CUR_DOWN_EI _MMIO(0xA05C)
  7331. #define GEN6_CURIAVG_MASK GEN6_RP_EI_MASK
  7332. #define GEN6_RP_CUR_DOWN _MMIO(0xA060)
  7333. #define GEN6_RP_PREV_DOWN _MMIO(0xA064)
  7334. #define GEN6_RP_UP_EI _MMIO(0xA068)
  7335. #define GEN6_RP_DOWN_EI _MMIO(0xA06C)
  7336. #define GEN6_RP_IDLE_HYSTERSIS _MMIO(0xA070)
  7337. #define GEN6_RPDEUHWTC _MMIO(0xA080)
  7338. #define GEN6_RPDEUC _MMIO(0xA084)
  7339. #define GEN6_RPDEUCSW _MMIO(0xA088)
  7340. #define GEN6_RC_STATE _MMIO(0xA094)
  7341. #define RC_SW_TARGET_STATE_SHIFT 16
  7342. #define RC_SW_TARGET_STATE_MASK (7 << RC_SW_TARGET_STATE_SHIFT)
  7343. #define GEN6_RC1_WAKE_RATE_LIMIT _MMIO(0xA098)
  7344. #define GEN6_RC6_WAKE_RATE_LIMIT _MMIO(0xA09C)
  7345. #define GEN6_RC6pp_WAKE_RATE_LIMIT _MMIO(0xA0A0)
  7346. #define GEN10_MEDIA_WAKE_RATE_LIMIT _MMIO(0xA0A0)
  7347. #define GEN6_RC_EVALUATION_INTERVAL _MMIO(0xA0A8)
  7348. #define GEN6_RC_IDLE_HYSTERSIS _MMIO(0xA0AC)
  7349. #define GEN6_RC_SLEEP _MMIO(0xA0B0)
  7350. #define GEN6_RCUBMABDTMR _MMIO(0xA0B0)
  7351. #define GEN6_RC1e_THRESHOLD _MMIO(0xA0B4)
  7352. #define GEN6_RC6_THRESHOLD _MMIO(0xA0B8)
  7353. #define GEN6_RC6p_THRESHOLD _MMIO(0xA0BC)
  7354. #define VLV_RCEDATA _MMIO(0xA0BC)
  7355. #define GEN6_RC6pp_THRESHOLD _MMIO(0xA0C0)
  7356. #define GEN6_PMINTRMSK _MMIO(0xA168)
  7357. #define GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC (1<<31)
  7358. #define ARAT_EXPIRED_INTRMSK (1<<9)
  7359. #define GEN8_MISC_CTRL0 _MMIO(0xA180)
  7360. #define VLV_PWRDWNUPCTL _MMIO(0xA294)
  7361. #define GEN9_MEDIA_PG_IDLE_HYSTERESIS _MMIO(0xA0C4)
  7362. #define GEN9_RENDER_PG_IDLE_HYSTERESIS _MMIO(0xA0C8)
  7363. #define GEN9_PG_ENABLE _MMIO(0xA210)
  7364. #define GEN9_RENDER_PG_ENABLE (1<<0)
  7365. #define GEN9_MEDIA_PG_ENABLE (1<<1)
  7366. #define GEN8_PUSHBUS_CONTROL _MMIO(0xA248)
  7367. #define GEN8_PUSHBUS_ENABLE _MMIO(0xA250)
  7368. #define GEN8_PUSHBUS_SHIFT _MMIO(0xA25C)
  7369. #define VLV_CHICKEN_3 _MMIO(VLV_DISPLAY_BASE + 0x7040C)
  7370. #define PIXEL_OVERLAP_CNT_MASK (3 << 30)
  7371. #define PIXEL_OVERLAP_CNT_SHIFT 30
  7372. #define GEN6_PMISR _MMIO(0x44020)
  7373. #define GEN6_PMIMR _MMIO(0x44024) /* rps_lock */
  7374. #define GEN6_PMIIR _MMIO(0x44028)
  7375. #define GEN6_PMIER _MMIO(0x4402C)
  7376. #define GEN6_PM_MBOX_EVENT (1<<25)
  7377. #define GEN6_PM_THERMAL_EVENT (1<<24)
  7378. #define GEN6_PM_RP_DOWN_TIMEOUT (1<<6)
  7379. #define GEN6_PM_RP_UP_THRESHOLD (1<<5)
  7380. #define GEN6_PM_RP_DOWN_THRESHOLD (1<<4)
  7381. #define GEN6_PM_RP_UP_EI_EXPIRED (1<<2)
  7382. #define GEN6_PM_RP_DOWN_EI_EXPIRED (1<<1)
  7383. #define GEN6_PM_RPS_EVENTS (GEN6_PM_RP_UP_THRESHOLD | \
  7384. GEN6_PM_RP_DOWN_THRESHOLD | \
  7385. GEN6_PM_RP_DOWN_TIMEOUT)
  7386. #define GEN7_GT_SCRATCH(i) _MMIO(0x4F100 + (i) * 4)
  7387. #define GEN7_GT_SCRATCH_REG_NUM 8
  7388. #define VLV_GTLC_SURVIVABILITY_REG _MMIO(0x130098)
  7389. #define VLV_GFX_CLK_STATUS_BIT (1<<3)
  7390. #define VLV_GFX_CLK_FORCE_ON_BIT (1<<2)
  7391. #define GEN6_GT_GFX_RC6_LOCKED _MMIO(0x138104)
  7392. #define VLV_COUNTER_CONTROL _MMIO(0x138104)
  7393. #define VLV_COUNT_RANGE_HIGH (1<<15)
  7394. #define VLV_MEDIA_RC0_COUNT_EN (1<<5)
  7395. #define VLV_RENDER_RC0_COUNT_EN (1<<4)
  7396. #define VLV_MEDIA_RC6_COUNT_EN (1<<1)
  7397. #define VLV_RENDER_RC6_COUNT_EN (1<<0)
  7398. #define GEN6_GT_GFX_RC6 _MMIO(0x138108)
  7399. #define VLV_GT_RENDER_RC6 _MMIO(0x138108)
  7400. #define VLV_GT_MEDIA_RC6 _MMIO(0x13810C)
  7401. #define GEN6_GT_GFX_RC6p _MMIO(0x13810C)
  7402. #define GEN6_GT_GFX_RC6pp _MMIO(0x138110)
  7403. #define VLV_RENDER_C0_COUNT _MMIO(0x138118)
  7404. #define VLV_MEDIA_C0_COUNT _MMIO(0x13811C)
  7405. #define GEN6_PCODE_MAILBOX _MMIO(0x138124)
  7406. #define GEN6_PCODE_READY (1<<31)
  7407. #define GEN6_PCODE_ERROR_MASK 0xFF
  7408. #define GEN6_PCODE_SUCCESS 0x0
  7409. #define GEN6_PCODE_ILLEGAL_CMD 0x1
  7410. #define GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x2
  7411. #define GEN6_PCODE_TIMEOUT 0x3
  7412. #define GEN6_PCODE_UNIMPLEMENTED_CMD 0xFF
  7413. #define GEN7_PCODE_TIMEOUT 0x2
  7414. #define GEN7_PCODE_ILLEGAL_DATA 0x3
  7415. #define GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x10
  7416. #define GEN6_PCODE_WRITE_RC6VIDS 0x4
  7417. #define GEN6_PCODE_READ_RC6VIDS 0x5
  7418. #define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5)
  7419. #define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) + 245)
  7420. #define BDW_PCODE_DISPLAY_FREQ_CHANGE_REQ 0x18
  7421. #define GEN9_PCODE_READ_MEM_LATENCY 0x6
  7422. #define GEN9_MEM_LATENCY_LEVEL_MASK 0xFF
  7423. #define GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT 8
  7424. #define GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT 16
  7425. #define GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT 24
  7426. #define SKL_PCODE_LOAD_HDCP_KEYS 0x5
  7427. #define SKL_PCODE_CDCLK_CONTROL 0x7
  7428. #define SKL_CDCLK_PREPARE_FOR_CHANGE 0x3
  7429. #define SKL_CDCLK_READY_FOR_CHANGE 0x1
  7430. #define GEN6_PCODE_WRITE_MIN_FREQ_TABLE 0x8
  7431. #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9
  7432. #define GEN6_READ_OC_PARAMS 0xc
  7433. #define GEN6_PCODE_READ_D_COMP 0x10
  7434. #define GEN6_PCODE_WRITE_D_COMP 0x11
  7435. #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17
  7436. #define DISPLAY_IPS_CONTROL 0x19
  7437. /* See also IPS_CTL */
  7438. #define IPS_PCODE_CONTROL (1 << 30)
  7439. #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A
  7440. #define GEN9_PCODE_SAGV_CONTROL 0x21
  7441. #define GEN9_SAGV_DISABLE 0x0
  7442. #define GEN9_SAGV_IS_DISABLED 0x1
  7443. #define GEN9_SAGV_ENABLE 0x3
  7444. #define GEN6_PCODE_DATA _MMIO(0x138128)
  7445. #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
  7446. #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16
  7447. #define GEN6_PCODE_DATA1 _MMIO(0x13812C)
  7448. #define GEN6_GT_CORE_STATUS _MMIO(0x138060)
  7449. #define GEN6_CORE_CPD_STATE_MASK (7<<4)
  7450. #define GEN6_RCn_MASK 7
  7451. #define GEN6_RC0 0
  7452. #define GEN6_RC3 2
  7453. #define GEN6_RC6 3
  7454. #define GEN6_RC7 4
  7455. #define GEN8_GT_SLICE_INFO _MMIO(0x138064)
  7456. #define GEN8_LSLICESTAT_MASK 0x7
  7457. #define CHV_POWER_SS0_SIG1 _MMIO(0xa720)
  7458. #define CHV_POWER_SS1_SIG1 _MMIO(0xa728)
  7459. #define CHV_SS_PG_ENABLE (1<<1)
  7460. #define CHV_EU08_PG_ENABLE (1<<9)
  7461. #define CHV_EU19_PG_ENABLE (1<<17)
  7462. #define CHV_EU210_PG_ENABLE (1<<25)
  7463. #define CHV_POWER_SS0_SIG2 _MMIO(0xa724)
  7464. #define CHV_POWER_SS1_SIG2 _MMIO(0xa72c)
  7465. #define CHV_EU311_PG_ENABLE (1<<1)
  7466. #define GEN9_SLICE_PGCTL_ACK(slice) _MMIO(0x804c + (slice)*0x4)
  7467. #define GEN10_SLICE_PGCTL_ACK(slice) _MMIO(0x804c + ((slice) / 3) * 0x34 + \
  7468. ((slice) % 3) * 0x4)
  7469. #define GEN9_PGCTL_SLICE_ACK (1 << 0)
  7470. #define GEN9_PGCTL_SS_ACK(subslice) (1 << (2 + (subslice)*2))
  7471. #define GEN10_PGCTL_VALID_SS_MASK(slice) ((slice) == 0 ? 0x7F : 0x1F)
  7472. #define GEN9_SS01_EU_PGCTL_ACK(slice) _MMIO(0x805c + (slice)*0x8)
  7473. #define GEN10_SS01_EU_PGCTL_ACK(slice) _MMIO(0x805c + ((slice) / 3) * 0x30 + \
  7474. ((slice) % 3) * 0x8)
  7475. #define GEN9_SS23_EU_PGCTL_ACK(slice) _MMIO(0x8060 + (slice)*0x8)
  7476. #define GEN10_SS23_EU_PGCTL_ACK(slice) _MMIO(0x8060 + ((slice) / 3) * 0x30 + \
  7477. ((slice) % 3) * 0x8)
  7478. #define GEN9_PGCTL_SSA_EU08_ACK (1 << 0)
  7479. #define GEN9_PGCTL_SSA_EU19_ACK (1 << 2)
  7480. #define GEN9_PGCTL_SSA_EU210_ACK (1 << 4)
  7481. #define GEN9_PGCTL_SSA_EU311_ACK (1 << 6)
  7482. #define GEN9_PGCTL_SSB_EU08_ACK (1 << 8)
  7483. #define GEN9_PGCTL_SSB_EU19_ACK (1 << 10)
  7484. #define GEN9_PGCTL_SSB_EU210_ACK (1 << 12)
  7485. #define GEN9_PGCTL_SSB_EU311_ACK (1 << 14)
  7486. #define GEN7_MISCCPCTL _MMIO(0x9424)
  7487. #define GEN7_DOP_CLOCK_GATE_ENABLE (1<<0)
  7488. #define GEN8_DOP_CLOCK_GATE_CFCLK_ENABLE (1<<2)
  7489. #define GEN8_DOP_CLOCK_GATE_GUC_ENABLE (1<<4)
  7490. #define GEN8_DOP_CLOCK_GATE_MEDIA_ENABLE (1<<6)
  7491. #define GEN8_GARBCNTL _MMIO(0xB004)
  7492. #define GEN9_GAPS_TSV_CREDIT_DISABLE (1 << 7)
  7493. #define GEN11_ARBITRATION_PRIO_ORDER_MASK (0x3f << 22)
  7494. #define GEN11_HASH_CTRL_EXCL_MASK (0x7f << 0)
  7495. #define GEN11_HASH_CTRL_EXCL_BIT0 (1 << 0)
  7496. #define GEN11_GLBLINVL _MMIO(0xB404)
  7497. #define GEN11_BANK_HASH_ADDR_EXCL_MASK (0x7f << 5)
  7498. #define GEN11_BANK_HASH_ADDR_EXCL_BIT0 (1 << 5)
  7499. #define GEN10_DFR_RATIO_EN_AND_CHICKEN _MMIO(0x9550)
  7500. #define DFR_DISABLE (1 << 9)
  7501. #define GEN11_GACB_PERF_CTRL _MMIO(0x4B80)
  7502. #define GEN11_HASH_CTRL_MASK (0x3 << 12 | 0xf << 0)
  7503. #define GEN11_HASH_CTRL_BIT0 (1 << 0)
  7504. #define GEN11_HASH_CTRL_BIT4 (1 << 12)
  7505. #define GEN11_LSN_UNSLCVC _MMIO(0xB43C)
  7506. #define GEN11_LSN_UNSLCVC_GAFS_HALF_CL2_MAXALLOC (1 << 9)
  7507. #define GEN11_LSN_UNSLCVC_GAFS_HALF_SF_MAXALLOC (1 << 7)
  7508. #define GAMW_ECO_DEV_RW_IA_REG _MMIO(0x4080)
  7509. #define GAMW_ECO_DEV_CTX_RELOAD_DISABLE (1 << 7)
  7510. /* IVYBRIDGE DPF */
  7511. #define GEN7_L3CDERRST1(slice) _MMIO(0xB008 + (slice) * 0x200) /* L3CD Error Status 1 */
  7512. #define GEN7_L3CDERRST1_ROW_MASK (0x7ff<<14)
  7513. #define GEN7_PARITY_ERROR_VALID (1<<13)
  7514. #define GEN7_L3CDERRST1_BANK_MASK (3<<11)
  7515. #define GEN7_L3CDERRST1_SUBBANK_MASK (7<<8)
  7516. #define GEN7_PARITY_ERROR_ROW(reg) \
  7517. ((reg & GEN7_L3CDERRST1_ROW_MASK) >> 14)
  7518. #define GEN7_PARITY_ERROR_BANK(reg) \
  7519. ((reg & GEN7_L3CDERRST1_BANK_MASK) >> 11)
  7520. #define GEN7_PARITY_ERROR_SUBBANK(reg) \
  7521. ((reg & GEN7_L3CDERRST1_SUBBANK_MASK) >> 8)
  7522. #define GEN7_L3CDERRST1_ENABLE (1<<7)
  7523. #define GEN7_L3LOG(slice, i) _MMIO(0xB070 + (slice) * 0x200 + (i) * 4)
  7524. #define GEN7_L3LOG_SIZE 0x80
  7525. #define GEN7_HALF_SLICE_CHICKEN1 _MMIO(0xe100) /* IVB GT1 + VLV */
  7526. #define GEN7_HALF_SLICE_CHICKEN1_GT2 _MMIO(0xf100)
  7527. #define GEN7_MAX_PS_THREAD_DEP (8<<12)
  7528. #define GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE (1<<10)
  7529. #define GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE (1<<4)
  7530. #define GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE (1<<3)
  7531. #define GEN9_HALF_SLICE_CHICKEN5 _MMIO(0xe188)
  7532. #define GEN9_DG_MIRROR_FIX_ENABLE (1<<5)
  7533. #define GEN9_CCS_TLB_PREFETCH_ENABLE (1<<3)
  7534. #define GEN8_ROW_CHICKEN _MMIO(0xe4f0)
  7535. #define FLOW_CONTROL_ENABLE (1<<15)
  7536. #define PARTIAL_INSTRUCTION_SHOOTDOWN_DISABLE (1<<8)
  7537. #define STALL_DOP_GATING_DISABLE (1<<5)
  7538. #define THROTTLE_12_5 (7<<2)
  7539. #define DISABLE_EARLY_EOT (1<<1)
  7540. #define GEN7_ROW_CHICKEN2 _MMIO(0xe4f4)
  7541. #define GEN7_ROW_CHICKEN2_GT2 _MMIO(0xf4f4)
  7542. #define DOP_CLOCK_GATING_DISABLE (1<<0)
  7543. #define PUSH_CONSTANT_DEREF_DISABLE (1<<8)
  7544. #define HSW_ROW_CHICKEN3 _MMIO(0xe49c)
  7545. #define HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE (1 << 6)
  7546. #define HALF_SLICE_CHICKEN2 _MMIO(0xe180)
  7547. #define GEN8_ST_PO_DISABLE (1<<13)
  7548. #define HALF_SLICE_CHICKEN3 _MMIO(0xe184)
  7549. #define HSW_SAMPLE_C_PERFORMANCE (1<<9)
  7550. #define GEN8_CENTROID_PIXEL_OPT_DIS (1<<8)
  7551. #define GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC (1<<5)
  7552. #define CNL_FAST_ANISO_L1_BANKING_FIX (1<<4)
  7553. #define GEN8_SAMPLER_POWER_BYPASS_DIS (1<<1)
  7554. #define GEN9_HALF_SLICE_CHICKEN7 _MMIO(0xe194)
  7555. #define GEN9_SAMPLER_HASH_COMPRESSED_READ_ADDR (1<<8)
  7556. #define GEN9_ENABLE_YV12_BUGFIX (1<<4)
  7557. #define GEN9_ENABLE_GPGPU_PREEMPTION (1<<2)
  7558. /* Audio */
  7559. #define G4X_AUD_VID_DID _MMIO(dev_priv->info.display_mmio_offset + 0x62020)
  7560. #define INTEL_AUDIO_DEVCL 0x808629FB
  7561. #define INTEL_AUDIO_DEVBLC 0x80862801
  7562. #define INTEL_AUDIO_DEVCTG 0x80862802
  7563. #define G4X_AUD_CNTL_ST _MMIO(0x620B4)
  7564. #define G4X_ELDV_DEVCL_DEVBLC (1 << 13)
  7565. #define G4X_ELDV_DEVCTG (1 << 14)
  7566. #define G4X_ELD_ADDR_MASK (0xf << 5)
  7567. #define G4X_ELD_ACK (1 << 4)
  7568. #define G4X_HDMIW_HDMIEDID _MMIO(0x6210C)
  7569. #define _IBX_HDMIW_HDMIEDID_A 0xE2050
  7570. #define _IBX_HDMIW_HDMIEDID_B 0xE2150
  7571. #define IBX_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _IBX_HDMIW_HDMIEDID_A, \
  7572. _IBX_HDMIW_HDMIEDID_B)
  7573. #define _IBX_AUD_CNTL_ST_A 0xE20B4
  7574. #define _IBX_AUD_CNTL_ST_B 0xE21B4
  7575. #define IBX_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CNTL_ST_A, \
  7576. _IBX_AUD_CNTL_ST_B)
  7577. #define IBX_ELD_BUFFER_SIZE_MASK (0x1f << 10)
  7578. #define IBX_ELD_ADDRESS_MASK (0x1f << 5)
  7579. #define IBX_ELD_ACK (1 << 4)
  7580. #define IBX_AUD_CNTL_ST2 _MMIO(0xE20C0)
  7581. #define IBX_CP_READY(port) ((1 << 1) << (((port) - 1) * 4))
  7582. #define IBX_ELD_VALID(port) ((1 << 0) << (((port) - 1) * 4))
  7583. #define _CPT_HDMIW_HDMIEDID_A 0xE5050
  7584. #define _CPT_HDMIW_HDMIEDID_B 0xE5150
  7585. #define CPT_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _CPT_HDMIW_HDMIEDID_A, _CPT_HDMIW_HDMIEDID_B)
  7586. #define _CPT_AUD_CNTL_ST_A 0xE50B4
  7587. #define _CPT_AUD_CNTL_ST_B 0xE51B4
  7588. #define CPT_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CNTL_ST_A, _CPT_AUD_CNTL_ST_B)
  7589. #define CPT_AUD_CNTRL_ST2 _MMIO(0xE50C0)
  7590. #define _VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050)
  7591. #define _VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150)
  7592. #define VLV_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _VLV_HDMIW_HDMIEDID_A, _VLV_HDMIW_HDMIEDID_B)
  7593. #define _VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4)
  7594. #define _VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4)
  7595. #define VLV_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CNTL_ST_A, _VLV_AUD_CNTL_ST_B)
  7596. #define VLV_AUD_CNTL_ST2 _MMIO(VLV_DISPLAY_BASE + 0x620C0)
  7597. /* These are the 4 32-bit write offset registers for each stream
  7598. * output buffer. It determines the offset from the
  7599. * 3DSTATE_SO_BUFFERs that the next streamed vertex output goes to.
  7600. */
  7601. #define GEN7_SO_WRITE_OFFSET(n) _MMIO(0x5280 + (n) * 4)
  7602. #define _IBX_AUD_CONFIG_A 0xe2000
  7603. #define _IBX_AUD_CONFIG_B 0xe2100
  7604. #define IBX_AUD_CFG(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CONFIG_A, _IBX_AUD_CONFIG_B)
  7605. #define _CPT_AUD_CONFIG_A 0xe5000
  7606. #define _CPT_AUD_CONFIG_B 0xe5100
  7607. #define CPT_AUD_CFG(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CONFIG_A, _CPT_AUD_CONFIG_B)
  7608. #define _VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000)
  7609. #define _VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100)
  7610. #define VLV_AUD_CFG(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CONFIG_A, _VLV_AUD_CONFIG_B)
  7611. #define AUD_CONFIG_N_VALUE_INDEX (1 << 29)
  7612. #define AUD_CONFIG_N_PROG_ENABLE (1 << 28)
  7613. #define AUD_CONFIG_UPPER_N_SHIFT 20
  7614. #define AUD_CONFIG_UPPER_N_MASK (0xff << 20)
  7615. #define AUD_CONFIG_LOWER_N_SHIFT 4
  7616. #define AUD_CONFIG_LOWER_N_MASK (0xfff << 4)
  7617. #define AUD_CONFIG_N_MASK (AUD_CONFIG_UPPER_N_MASK | AUD_CONFIG_LOWER_N_MASK)
  7618. #define AUD_CONFIG_N(n) \
  7619. (((((n) >> 12) & 0xff) << AUD_CONFIG_UPPER_N_SHIFT) | \
  7620. (((n) & 0xfff) << AUD_CONFIG_LOWER_N_SHIFT))
  7621. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT 16
  7622. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK (0xf << 16)
  7623. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 (0 << 16)
  7624. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 (1 << 16)
  7625. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 (2 << 16)
  7626. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 (3 << 16)
  7627. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 (4 << 16)
  7628. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 (5 << 16)
  7629. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 (6 << 16)
  7630. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 (7 << 16)
  7631. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 (8 << 16)
  7632. #define AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 (9 << 16)
  7633. #define AUD_CONFIG_DISABLE_NCTS (1 << 3)
  7634. /* HSW Audio */
  7635. #define _HSW_AUD_CONFIG_A 0x65000
  7636. #define _HSW_AUD_CONFIG_B 0x65100
  7637. #define HSW_AUD_CFG(pipe) _MMIO_PIPE(pipe, _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
  7638. #define _HSW_AUD_MISC_CTRL_A 0x65010
  7639. #define _HSW_AUD_MISC_CTRL_B 0x65110
  7640. #define HSW_AUD_MISC_CTRL(pipe) _MMIO_PIPE(pipe, _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
  7641. #define _HSW_AUD_M_CTS_ENABLE_A 0x65028
  7642. #define _HSW_AUD_M_CTS_ENABLE_B 0x65128
  7643. #define HSW_AUD_M_CTS_ENABLE(pipe) _MMIO_PIPE(pipe, _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
  7644. #define AUD_M_CTS_M_VALUE_INDEX (1 << 21)
  7645. #define AUD_M_CTS_M_PROG_ENABLE (1 << 20)
  7646. #define AUD_CONFIG_M_MASK 0xfffff
  7647. #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4
  7648. #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4
  7649. #define HSW_AUD_DIP_ELD_CTRL(pipe) _MMIO_PIPE(pipe, _HSW_AUD_DIP_ELD_CTRL_ST_A, _HSW_AUD_DIP_ELD_CTRL_ST_B)
  7650. /* Audio Digital Converter */
  7651. #define _HSW_AUD_DIG_CNVT_1 0x65080
  7652. #define _HSW_AUD_DIG_CNVT_2 0x65180
  7653. #define AUD_DIG_CNVT(pipe) _MMIO_PIPE(pipe, _HSW_AUD_DIG_CNVT_1, _HSW_AUD_DIG_CNVT_2)
  7654. #define DIP_PORT_SEL_MASK 0x3
  7655. #define _HSW_AUD_EDID_DATA_A 0x65050
  7656. #define _HSW_AUD_EDID_DATA_B 0x65150
  7657. #define HSW_AUD_EDID_DATA(pipe) _MMIO_PIPE(pipe, _HSW_AUD_EDID_DATA_A, _HSW_AUD_EDID_DATA_B)
  7658. #define HSW_AUD_PIPE_CONV_CFG _MMIO(0x6507c)
  7659. #define HSW_AUD_PIN_ELD_CP_VLD _MMIO(0x650c0)
  7660. #define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4))
  7661. #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4))
  7662. #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4))
  7663. #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4))
  7664. #define HSW_AUD_CHICKENBIT _MMIO(0x65f10)
  7665. #define SKL_AUD_CODEC_WAKE_SIGNAL (1 << 15)
  7666. /* HSW Power Wells */
  7667. #define _HSW_PWR_WELL_CTL1 0x45400
  7668. #define _HSW_PWR_WELL_CTL2 0x45404
  7669. #define _HSW_PWR_WELL_CTL3 0x45408
  7670. #define _HSW_PWR_WELL_CTL4 0x4540C
  7671. /*
  7672. * Each power well control register contains up to 16 (request, status) HW
  7673. * flag tuples. The register index and HW flag shift is determined by the
  7674. * power well ID (see i915_power_well_id). There are 4 possible sources of
  7675. * power well requests each source having its own set of control registers:
  7676. * BIOS, DRIVER, KVMR, DEBUG.
  7677. */
  7678. #define _HSW_PW_REG_IDX(pw) ((pw) >> 4)
  7679. #define _HSW_PW_SHIFT(pw) (((pw) & 0xf) * 2)
  7680. /* TODO: Add all PWR_WELL_CTL registers below for new platforms */
  7681. #define HSW_PWR_WELL_CTL_BIOS(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \
  7682. _HSW_PWR_WELL_CTL1))
  7683. #define HSW_PWR_WELL_CTL_DRIVER(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \
  7684. _HSW_PWR_WELL_CTL2))
  7685. #define HSW_PWR_WELL_CTL_KVMR _MMIO(_HSW_PWR_WELL_CTL3)
  7686. #define HSW_PWR_WELL_CTL_DEBUG(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \
  7687. _HSW_PWR_WELL_CTL4))
  7688. #define HSW_PWR_WELL_CTL_REQ(pw) (1 << (_HSW_PW_SHIFT(pw) + 1))
  7689. #define HSW_PWR_WELL_CTL_STATE(pw) (1 << _HSW_PW_SHIFT(pw))
  7690. #define HSW_PWR_WELL_CTL5 _MMIO(0x45410)
  7691. #define HSW_PWR_WELL_ENABLE_SINGLE_STEP (1<<31)
  7692. #define HSW_PWR_WELL_PWR_GATE_OVERRIDE (1<<20)
  7693. #define HSW_PWR_WELL_FORCE_ON (1<<19)
  7694. #define HSW_PWR_WELL_CTL6 _MMIO(0x45414)
  7695. /* SKL Fuse Status */
  7696. enum skl_power_gate {
  7697. SKL_PG0,
  7698. SKL_PG1,
  7699. SKL_PG2,
  7700. };
  7701. #define SKL_FUSE_STATUS _MMIO(0x42000)
  7702. #define SKL_FUSE_DOWNLOAD_STATUS (1<<31)
  7703. /* PG0 (HW control->no power well ID), PG1..PG2 (SKL_DISP_PW1..SKL_DISP_PW2) */
  7704. #define SKL_PW_TO_PG(pw) ((pw) - SKL_DISP_PW_1 + SKL_PG1)
  7705. #define SKL_FUSE_PG_DIST_STATUS(pg) (1 << (27 - (pg)))
  7706. #define _CNL_AUX_REG_IDX(pw) ((pw) - 9)
  7707. #define _CNL_AUX_ANAOVRD1_B 0x162250
  7708. #define _CNL_AUX_ANAOVRD1_C 0x162210
  7709. #define _CNL_AUX_ANAOVRD1_D 0x1622D0
  7710. #define _CNL_AUX_ANAOVRD1_F 0x162A90
  7711. #define CNL_AUX_ANAOVRD1(pw) _MMIO(_PICK(_CNL_AUX_REG_IDX(pw), \
  7712. _CNL_AUX_ANAOVRD1_B, \
  7713. _CNL_AUX_ANAOVRD1_C, \
  7714. _CNL_AUX_ANAOVRD1_D, \
  7715. _CNL_AUX_ANAOVRD1_F))
  7716. #define CNL_AUX_ANAOVRD1_ENABLE (1<<16)
  7717. #define CNL_AUX_ANAOVRD1_LDO_BYPASS (1<<23)
  7718. /* HDCP Key Registers */
  7719. #define HDCP_KEY_CONF _MMIO(0x66c00)
  7720. #define HDCP_AKSV_SEND_TRIGGER BIT(31)
  7721. #define HDCP_CLEAR_KEYS_TRIGGER BIT(30)
  7722. #define HDCP_KEY_LOAD_TRIGGER BIT(8)
  7723. #define HDCP_KEY_STATUS _MMIO(0x66c04)
  7724. #define HDCP_FUSE_IN_PROGRESS BIT(7)
  7725. #define HDCP_FUSE_ERROR BIT(6)
  7726. #define HDCP_FUSE_DONE BIT(5)
  7727. #define HDCP_KEY_LOAD_STATUS BIT(1)
  7728. #define HDCP_KEY_LOAD_DONE BIT(0)
  7729. #define HDCP_AKSV_LO _MMIO(0x66c10)
  7730. #define HDCP_AKSV_HI _MMIO(0x66c14)
  7731. /* HDCP Repeater Registers */
  7732. #define HDCP_REP_CTL _MMIO(0x66d00)
  7733. #define HDCP_DDIB_REP_PRESENT BIT(30)
  7734. #define HDCP_DDIA_REP_PRESENT BIT(29)
  7735. #define HDCP_DDIC_REP_PRESENT BIT(28)
  7736. #define HDCP_DDID_REP_PRESENT BIT(27)
  7737. #define HDCP_DDIF_REP_PRESENT BIT(26)
  7738. #define HDCP_DDIE_REP_PRESENT BIT(25)
  7739. #define HDCP_DDIB_SHA1_M0 (1 << 20)
  7740. #define HDCP_DDIA_SHA1_M0 (2 << 20)
  7741. #define HDCP_DDIC_SHA1_M0 (3 << 20)
  7742. #define HDCP_DDID_SHA1_M0 (4 << 20)
  7743. #define HDCP_DDIF_SHA1_M0 (5 << 20)
  7744. #define HDCP_DDIE_SHA1_M0 (6 << 20) /* Bspec says 5? */
  7745. #define HDCP_SHA1_BUSY BIT(16)
  7746. #define HDCP_SHA1_READY BIT(17)
  7747. #define HDCP_SHA1_COMPLETE BIT(18)
  7748. #define HDCP_SHA1_V_MATCH BIT(19)
  7749. #define HDCP_SHA1_TEXT_32 (1 << 1)
  7750. #define HDCP_SHA1_COMPLETE_HASH (2 << 1)
  7751. #define HDCP_SHA1_TEXT_24 (4 << 1)
  7752. #define HDCP_SHA1_TEXT_16 (5 << 1)
  7753. #define HDCP_SHA1_TEXT_8 (6 << 1)
  7754. #define HDCP_SHA1_TEXT_0 (7 << 1)
  7755. #define HDCP_SHA_V_PRIME_H0 _MMIO(0x66d04)
  7756. #define HDCP_SHA_V_PRIME_H1 _MMIO(0x66d08)
  7757. #define HDCP_SHA_V_PRIME_H2 _MMIO(0x66d0C)
  7758. #define HDCP_SHA_V_PRIME_H3 _MMIO(0x66d10)
  7759. #define HDCP_SHA_V_PRIME_H4 _MMIO(0x66d14)
  7760. #define HDCP_SHA_V_PRIME(h) _MMIO((0x66d04 + h * 4))
  7761. #define HDCP_SHA_TEXT _MMIO(0x66d18)
  7762. /* HDCP Auth Registers */
  7763. #define _PORTA_HDCP_AUTHENC 0x66800
  7764. #define _PORTB_HDCP_AUTHENC 0x66500
  7765. #define _PORTC_HDCP_AUTHENC 0x66600
  7766. #define _PORTD_HDCP_AUTHENC 0x66700
  7767. #define _PORTE_HDCP_AUTHENC 0x66A00
  7768. #define _PORTF_HDCP_AUTHENC 0x66900
  7769. #define _PORT_HDCP_AUTHENC(port, x) _MMIO(_PICK(port, \
  7770. _PORTA_HDCP_AUTHENC, \
  7771. _PORTB_HDCP_AUTHENC, \
  7772. _PORTC_HDCP_AUTHENC, \
  7773. _PORTD_HDCP_AUTHENC, \
  7774. _PORTE_HDCP_AUTHENC, \
  7775. _PORTF_HDCP_AUTHENC) + x)
  7776. #define PORT_HDCP_CONF(port) _PORT_HDCP_AUTHENC(port, 0x0)
  7777. #define HDCP_CONF_CAPTURE_AN BIT(0)
  7778. #define HDCP_CONF_AUTH_AND_ENC (BIT(1) | BIT(0))
  7779. #define PORT_HDCP_ANINIT(port) _PORT_HDCP_AUTHENC(port, 0x4)
  7780. #define PORT_HDCP_ANLO(port) _PORT_HDCP_AUTHENC(port, 0x8)
  7781. #define PORT_HDCP_ANHI(port) _PORT_HDCP_AUTHENC(port, 0xC)
  7782. #define PORT_HDCP_BKSVLO(port) _PORT_HDCP_AUTHENC(port, 0x10)
  7783. #define PORT_HDCP_BKSVHI(port) _PORT_HDCP_AUTHENC(port, 0x14)
  7784. #define PORT_HDCP_RPRIME(port) _PORT_HDCP_AUTHENC(port, 0x18)
  7785. #define PORT_HDCP_STATUS(port) _PORT_HDCP_AUTHENC(port, 0x1C)
  7786. #define HDCP_STATUS_STREAM_A_ENC BIT(31)
  7787. #define HDCP_STATUS_STREAM_B_ENC BIT(30)
  7788. #define HDCP_STATUS_STREAM_C_ENC BIT(29)
  7789. #define HDCP_STATUS_STREAM_D_ENC BIT(28)
  7790. #define HDCP_STATUS_AUTH BIT(21)
  7791. #define HDCP_STATUS_ENC BIT(20)
  7792. #define HDCP_STATUS_RI_MATCH BIT(19)
  7793. #define HDCP_STATUS_R0_READY BIT(18)
  7794. #define HDCP_STATUS_AN_READY BIT(17)
  7795. #define HDCP_STATUS_CIPHER BIT(16)
  7796. #define HDCP_STATUS_FRAME_CNT(x) ((x >> 8) & 0xff)
  7797. /* Per-pipe DDI Function Control */
  7798. #define _TRANS_DDI_FUNC_CTL_A 0x60400
  7799. #define _TRANS_DDI_FUNC_CTL_B 0x61400
  7800. #define _TRANS_DDI_FUNC_CTL_C 0x62400
  7801. #define _TRANS_DDI_FUNC_CTL_EDP 0x6F400
  7802. #define TRANS_DDI_FUNC_CTL(tran) _MMIO_TRANS2(tran, _TRANS_DDI_FUNC_CTL_A)
  7803. #define TRANS_DDI_FUNC_ENABLE (1<<31)
  7804. /* Those bits are ignored by pipe EDP since it can only connect to DDI A */
  7805. #define TRANS_DDI_PORT_MASK (7<<28)
  7806. #define TRANS_DDI_PORT_SHIFT 28
  7807. #define TRANS_DDI_SELECT_PORT(x) ((x)<<28)
  7808. #define TRANS_DDI_PORT_NONE (0<<28)
  7809. #define TRANS_DDI_MODE_SELECT_MASK (7<<24)
  7810. #define TRANS_DDI_MODE_SELECT_HDMI (0<<24)
  7811. #define TRANS_DDI_MODE_SELECT_DVI (1<<24)
  7812. #define TRANS_DDI_MODE_SELECT_DP_SST (2<<24)
  7813. #define TRANS_DDI_MODE_SELECT_DP_MST (3<<24)
  7814. #define TRANS_DDI_MODE_SELECT_FDI (4<<24)
  7815. #define TRANS_DDI_BPC_MASK (7<<20)
  7816. #define TRANS_DDI_BPC_8 (0<<20)
  7817. #define TRANS_DDI_BPC_10 (1<<20)
  7818. #define TRANS_DDI_BPC_6 (2<<20)
  7819. #define TRANS_DDI_BPC_12 (3<<20)
  7820. #define TRANS_DDI_PVSYNC (1<<17)
  7821. #define TRANS_DDI_PHSYNC (1<<16)
  7822. #define TRANS_DDI_EDP_INPUT_MASK (7<<12)
  7823. #define TRANS_DDI_EDP_INPUT_A_ON (0<<12)
  7824. #define TRANS_DDI_EDP_INPUT_A_ONOFF (4<<12)
  7825. #define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)
  7826. #define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)
  7827. #define TRANS_DDI_HDCP_SIGNALLING (1<<9)
  7828. #define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8)
  7829. #define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
  7830. #define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
  7831. #define TRANS_DDI_BFI_ENABLE (1<<4)
  7832. #define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4)
  7833. #define TRANS_DDI_HDMI_SCRAMBLING (1<<0)
  7834. #define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
  7835. | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
  7836. | TRANS_DDI_HDMI_SCRAMBLING)
  7837. /* DisplayPort Transport Control */
  7838. #define _DP_TP_CTL_A 0x64040
  7839. #define _DP_TP_CTL_B 0x64140
  7840. #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
  7841. #define DP_TP_CTL_ENABLE (1<<31)
  7842. #define DP_TP_CTL_MODE_SST (0<<27)
  7843. #define DP_TP_CTL_MODE_MST (1<<27)
  7844. #define DP_TP_CTL_FORCE_ACT (1<<25)
  7845. #define DP_TP_CTL_ENHANCED_FRAME_ENABLE (1<<18)
  7846. #define DP_TP_CTL_FDI_AUTOTRAIN (1<<15)
  7847. #define DP_TP_CTL_LINK_TRAIN_MASK (7<<8)
  7848. #define DP_TP_CTL_LINK_TRAIN_PAT1 (0<<8)
  7849. #define DP_TP_CTL_LINK_TRAIN_PAT2 (1<<8)
  7850. #define DP_TP_CTL_LINK_TRAIN_PAT3 (4<<8)
  7851. #define DP_TP_CTL_LINK_TRAIN_IDLE (2<<8)
  7852. #define DP_TP_CTL_LINK_TRAIN_NORMAL (3<<8)
  7853. #define DP_TP_CTL_SCRAMBLE_DISABLE (1<<7)
  7854. /* DisplayPort Transport Status */
  7855. #define _DP_TP_STATUS_A 0x64044
  7856. #define _DP_TP_STATUS_B 0x64144
  7857. #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
  7858. #define DP_TP_STATUS_IDLE_DONE (1<<25)
  7859. #define DP_TP_STATUS_ACT_SENT (1<<24)
  7860. #define DP_TP_STATUS_MODE_STATUS_MST (1<<23)
  7861. #define DP_TP_STATUS_AUTOTRAIN_DONE (1<<12)
  7862. #define DP_TP_STATUS_PAYLOAD_MAPPING_VC2 (3 << 8)
  7863. #define DP_TP_STATUS_PAYLOAD_MAPPING_VC1 (3 << 4)
  7864. #define DP_TP_STATUS_PAYLOAD_MAPPING_VC0 (3 << 0)
  7865. /* DDI Buffer Control */
  7866. #define _DDI_BUF_CTL_A 0x64000
  7867. #define _DDI_BUF_CTL_B 0x64100
  7868. #define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
  7869. #define DDI_BUF_CTL_ENABLE (1<<31)
  7870. #define DDI_BUF_TRANS_SELECT(n) ((n) << 24)
  7871. #define DDI_BUF_EMP_MASK (0xf<<24)
  7872. #define DDI_BUF_PORT_REVERSAL (1<<16)
  7873. #define DDI_BUF_IS_IDLE (1<<7)
  7874. #define DDI_A_4_LANES (1<<4)
  7875. #define DDI_PORT_WIDTH(width) (((width) - 1) << 1)
  7876. #define DDI_PORT_WIDTH_MASK (7 << 1)
  7877. #define DDI_PORT_WIDTH_SHIFT 1
  7878. #define DDI_INIT_DISPLAY_DETECTED (1<<0)
  7879. /* DDI Buffer Translations */
  7880. #define _DDI_BUF_TRANS_A 0x64E00
  7881. #define _DDI_BUF_TRANS_B 0x64E60
  7882. #define DDI_BUF_TRANS_LO(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8)
  7883. #define DDI_BUF_BALANCE_LEG_ENABLE (1 << 31)
  7884. #define DDI_BUF_TRANS_HI(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8 + 4)
  7885. /* Sideband Interface (SBI) is programmed indirectly, via
  7886. * SBI_ADDR, which contains the register offset; and SBI_DATA,
  7887. * which contains the payload */
  7888. #define SBI_ADDR _MMIO(0xC6000)
  7889. #define SBI_DATA _MMIO(0xC6004)
  7890. #define SBI_CTL_STAT _MMIO(0xC6008)
  7891. #define SBI_CTL_DEST_ICLK (0x0<<16)
  7892. #define SBI_CTL_DEST_MPHY (0x1<<16)
  7893. #define SBI_CTL_OP_IORD (0x2<<8)
  7894. #define SBI_CTL_OP_IOWR (0x3<<8)
  7895. #define SBI_CTL_OP_CRRD (0x6<<8)
  7896. #define SBI_CTL_OP_CRWR (0x7<<8)
  7897. #define SBI_RESPONSE_FAIL (0x1<<1)
  7898. #define SBI_RESPONSE_SUCCESS (0x0<<1)
  7899. #define SBI_BUSY (0x1<<0)
  7900. #define SBI_READY (0x0<<0)
  7901. /* SBI offsets */
  7902. #define SBI_SSCDIVINTPHASE 0x0200
  7903. #define SBI_SSCDIVINTPHASE6 0x0600
  7904. #define SBI_SSCDIVINTPHASE_DIVSEL_SHIFT 1
  7905. #define SBI_SSCDIVINTPHASE_DIVSEL_MASK (0x7f<<1)
  7906. #define SBI_SSCDIVINTPHASE_DIVSEL(x) ((x)<<1)
  7907. #define SBI_SSCDIVINTPHASE_INCVAL_SHIFT 8
  7908. #define SBI_SSCDIVINTPHASE_INCVAL_MASK (0x7f<<8)
  7909. #define SBI_SSCDIVINTPHASE_INCVAL(x) ((x)<<8)
  7910. #define SBI_SSCDIVINTPHASE_DIR(x) ((x)<<15)
  7911. #define SBI_SSCDIVINTPHASE_PROPAGATE (1<<0)
  7912. #define SBI_SSCDITHPHASE 0x0204
  7913. #define SBI_SSCCTL 0x020c
  7914. #define SBI_SSCCTL6 0x060C
  7915. #define SBI_SSCCTL_PATHALT (1<<3)
  7916. #define SBI_SSCCTL_DISABLE (1<<0)
  7917. #define SBI_SSCAUXDIV6 0x0610
  7918. #define SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT 4
  7919. #define SBI_SSCAUXDIV_FINALDIV2SEL_MASK (1<<4)
  7920. #define SBI_SSCAUXDIV_FINALDIV2SEL(x) ((x)<<4)
  7921. #define SBI_DBUFF0 0x2a00
  7922. #define SBI_GEN0 0x1f00
  7923. #define SBI_GEN0_CFG_BUFFENABLE_DISABLE (1<<0)
  7924. /* LPT PIXCLK_GATE */
  7925. #define PIXCLK_GATE _MMIO(0xC6020)
  7926. #define PIXCLK_GATE_UNGATE (1<<0)
  7927. #define PIXCLK_GATE_GATE (0<<0)
  7928. /* SPLL */
  7929. #define SPLL_CTL _MMIO(0x46020)
  7930. #define SPLL_PLL_ENABLE (1<<31)
  7931. #define SPLL_PLL_SSC (1<<28)
  7932. #define SPLL_PLL_NON_SSC (2<<28)
  7933. #define SPLL_PLL_LCPLL (3<<28)
  7934. #define SPLL_PLL_REF_MASK (3<<28)
  7935. #define SPLL_PLL_FREQ_810MHz (0<<26)
  7936. #define SPLL_PLL_FREQ_1350MHz (1<<26)
  7937. #define SPLL_PLL_FREQ_2700MHz (2<<26)
  7938. #define SPLL_PLL_FREQ_MASK (3<<26)
  7939. /* WRPLL */
  7940. #define _WRPLL_CTL1 0x46040
  7941. #define _WRPLL_CTL2 0x46060
  7942. #define WRPLL_CTL(pll) _MMIO_PIPE(pll, _WRPLL_CTL1, _WRPLL_CTL2)
  7943. #define WRPLL_PLL_ENABLE (1<<31)
  7944. #define WRPLL_PLL_SSC (1<<28)
  7945. #define WRPLL_PLL_NON_SSC (2<<28)
  7946. #define WRPLL_PLL_LCPLL (3<<28)
  7947. #define WRPLL_PLL_REF_MASK (3<<28)
  7948. /* WRPLL divider programming */
  7949. #define WRPLL_DIVIDER_REFERENCE(x) ((x)<<0)
  7950. #define WRPLL_DIVIDER_REF_MASK (0xff)
  7951. #define WRPLL_DIVIDER_POST(x) ((x)<<8)
  7952. #define WRPLL_DIVIDER_POST_MASK (0x3f<<8)
  7953. #define WRPLL_DIVIDER_POST_SHIFT 8
  7954. #define WRPLL_DIVIDER_FEEDBACK(x) ((x)<<16)
  7955. #define WRPLL_DIVIDER_FB_SHIFT 16
  7956. #define WRPLL_DIVIDER_FB_MASK (0xff<<16)
  7957. /* Port clock selection */
  7958. #define _PORT_CLK_SEL_A 0x46100
  7959. #define _PORT_CLK_SEL_B 0x46104
  7960. #define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
  7961. #define PORT_CLK_SEL_LCPLL_2700 (0<<29)
  7962. #define PORT_CLK_SEL_LCPLL_1350 (1<<29)
  7963. #define PORT_CLK_SEL_LCPLL_810 (2<<29)
  7964. #define PORT_CLK_SEL_SPLL (3<<29)
  7965. #define PORT_CLK_SEL_WRPLL(pll) (((pll)+4)<<29)
  7966. #define PORT_CLK_SEL_WRPLL1 (4<<29)
  7967. #define PORT_CLK_SEL_WRPLL2 (5<<29)
  7968. #define PORT_CLK_SEL_NONE (7<<29)
  7969. #define PORT_CLK_SEL_MASK (7<<29)
  7970. /* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */
  7971. #define DDI_CLK_SEL(port) PORT_CLK_SEL(port)
  7972. #define DDI_CLK_SEL_NONE (0x0 << 28)
  7973. #define DDI_CLK_SEL_MG (0x8 << 28)
  7974. #define DDI_CLK_SEL_MASK (0xF << 28)
  7975. /* Transcoder clock selection */
  7976. #define _TRANS_CLK_SEL_A 0x46140
  7977. #define _TRANS_CLK_SEL_B 0x46144
  7978. #define TRANS_CLK_SEL(tran) _MMIO_TRANS(tran, _TRANS_CLK_SEL_A, _TRANS_CLK_SEL_B)
  7979. /* For each transcoder, we need to select the corresponding port clock */
  7980. #define TRANS_CLK_SEL_DISABLED (0x0<<29)
  7981. #define TRANS_CLK_SEL_PORT(x) (((x)+1)<<29)
  7982. #define CDCLK_FREQ _MMIO(0x46200)
  7983. #define _TRANSA_MSA_MISC 0x60410
  7984. #define _TRANSB_MSA_MISC 0x61410
  7985. #define _TRANSC_MSA_MISC 0x62410
  7986. #define _TRANS_EDP_MSA_MISC 0x6f410
  7987. #define TRANS_MSA_MISC(tran) _MMIO_TRANS2(tran, _TRANSA_MSA_MISC)
  7988. #define TRANS_MSA_SYNC_CLK (1<<0)
  7989. #define TRANS_MSA_6_BPC (0<<5)
  7990. #define TRANS_MSA_8_BPC (1<<5)
  7991. #define TRANS_MSA_10_BPC (2<<5)
  7992. #define TRANS_MSA_12_BPC (3<<5)
  7993. #define TRANS_MSA_16_BPC (4<<5)
  7994. /* LCPLL Control */
  7995. #define LCPLL_CTL _MMIO(0x130040)
  7996. #define LCPLL_PLL_DISABLE (1<<31)
  7997. #define LCPLL_PLL_LOCK (1<<30)
  7998. #define LCPLL_CLK_FREQ_MASK (3<<26)
  7999. #define LCPLL_CLK_FREQ_450 (0<<26)
  8000. #define LCPLL_CLK_FREQ_54O_BDW (1<<26)
  8001. #define LCPLL_CLK_FREQ_337_5_BDW (2<<26)
  8002. #define LCPLL_CLK_FREQ_675_BDW (3<<26)
  8003. #define LCPLL_CD_CLOCK_DISABLE (1<<25)
  8004. #define LCPLL_ROOT_CD_CLOCK_DISABLE (1<<24)
  8005. #define LCPLL_CD2X_CLOCK_DISABLE (1<<23)
  8006. #define LCPLL_POWER_DOWN_ALLOW (1<<22)
  8007. #define LCPLL_CD_SOURCE_FCLK (1<<21)
  8008. #define LCPLL_CD_SOURCE_FCLK_DONE (1<<19)
  8009. /*
  8010. * SKL Clocks
  8011. */
  8012. /* CDCLK_CTL */
  8013. #define CDCLK_CTL _MMIO(0x46000)
  8014. #define CDCLK_FREQ_SEL_MASK (3 << 26)
  8015. #define CDCLK_FREQ_450_432 (0 << 26)
  8016. #define CDCLK_FREQ_540 (1 << 26)
  8017. #define CDCLK_FREQ_337_308 (2 << 26)
  8018. #define CDCLK_FREQ_675_617 (3 << 26)
  8019. #define BXT_CDCLK_CD2X_DIV_SEL_MASK (3 << 22)
  8020. #define BXT_CDCLK_CD2X_DIV_SEL_1 (0 << 22)
  8021. #define BXT_CDCLK_CD2X_DIV_SEL_1_5 (1 << 22)
  8022. #define BXT_CDCLK_CD2X_DIV_SEL_2 (2 << 22)
  8023. #define BXT_CDCLK_CD2X_DIV_SEL_4 (3 << 22)
  8024. #define BXT_CDCLK_CD2X_PIPE(pipe) ((pipe) << 20)
  8025. #define CDCLK_DIVMUX_CD_OVERRIDE (1 << 19)
  8026. #define BXT_CDCLK_CD2X_PIPE_NONE BXT_CDCLK_CD2X_PIPE(3)
  8027. #define ICL_CDCLK_CD2X_PIPE_NONE (7 << 19)
  8028. #define BXT_CDCLK_SSA_PRECHARGE_ENABLE (1 << 16)
  8029. #define CDCLK_FREQ_DECIMAL_MASK (0x7ff)
  8030. /* LCPLL_CTL */
  8031. #define LCPLL1_CTL _MMIO(0x46010)
  8032. #define LCPLL2_CTL _MMIO(0x46014)
  8033. #define LCPLL_PLL_ENABLE (1<<31)
  8034. /* DPLL control1 */
  8035. #define DPLL_CTRL1 _MMIO(0x6C058)
  8036. #define DPLL_CTRL1_HDMI_MODE(id) (1<<((id)*6+5))
  8037. #define DPLL_CTRL1_SSC(id) (1<<((id)*6+4))
  8038. #define DPLL_CTRL1_LINK_RATE_MASK(id) (7<<((id)*6+1))
  8039. #define DPLL_CTRL1_LINK_RATE_SHIFT(id) ((id)*6+1)
  8040. #define DPLL_CTRL1_LINK_RATE(linkrate, id) ((linkrate)<<((id)*6+1))
  8041. #define DPLL_CTRL1_OVERRIDE(id) (1<<((id)*6))
  8042. #define DPLL_CTRL1_LINK_RATE_2700 0
  8043. #define DPLL_CTRL1_LINK_RATE_1350 1
  8044. #define DPLL_CTRL1_LINK_RATE_810 2
  8045. #define DPLL_CTRL1_LINK_RATE_1620 3
  8046. #define DPLL_CTRL1_LINK_RATE_1080 4
  8047. #define DPLL_CTRL1_LINK_RATE_2160 5
  8048. /* DPLL control2 */
  8049. #define DPLL_CTRL2 _MMIO(0x6C05C)
  8050. #define DPLL_CTRL2_DDI_CLK_OFF(port) (1<<((port)+15))
  8051. #define DPLL_CTRL2_DDI_CLK_SEL_MASK(port) (3<<((port)*3+1))
  8052. #define DPLL_CTRL2_DDI_CLK_SEL_SHIFT(port) ((port)*3+1)
  8053. #define DPLL_CTRL2_DDI_CLK_SEL(clk, port) ((clk)<<((port)*3+1))
  8054. #define DPLL_CTRL2_DDI_SEL_OVERRIDE(port) (1<<((port)*3))
  8055. /* DPLL Status */
  8056. #define DPLL_STATUS _MMIO(0x6C060)
  8057. #define DPLL_LOCK(id) (1<<((id)*8))
  8058. /* DPLL cfg */
  8059. #define _DPLL1_CFGCR1 0x6C040
  8060. #define _DPLL2_CFGCR1 0x6C048
  8061. #define _DPLL3_CFGCR1 0x6C050
  8062. #define DPLL_CFGCR1_FREQ_ENABLE (1<<31)
  8063. #define DPLL_CFGCR1_DCO_FRACTION_MASK (0x7fff<<9)
  8064. #define DPLL_CFGCR1_DCO_FRACTION(x) ((x)<<9)
  8065. #define DPLL_CFGCR1_DCO_INTEGER_MASK (0x1ff)
  8066. #define _DPLL1_CFGCR2 0x6C044
  8067. #define _DPLL2_CFGCR2 0x6C04C
  8068. #define _DPLL3_CFGCR2 0x6C054
  8069. #define DPLL_CFGCR2_QDIV_RATIO_MASK (0xff<<8)
  8070. #define DPLL_CFGCR2_QDIV_RATIO(x) ((x)<<8)
  8071. #define DPLL_CFGCR2_QDIV_MODE(x) ((x)<<7)
  8072. #define DPLL_CFGCR2_KDIV_MASK (3<<5)
  8073. #define DPLL_CFGCR2_KDIV(x) ((x)<<5)
  8074. #define DPLL_CFGCR2_KDIV_5 (0<<5)
  8075. #define DPLL_CFGCR2_KDIV_2 (1<<5)
  8076. #define DPLL_CFGCR2_KDIV_3 (2<<5)
  8077. #define DPLL_CFGCR2_KDIV_1 (3<<5)
  8078. #define DPLL_CFGCR2_PDIV_MASK (7<<2)
  8079. #define DPLL_CFGCR2_PDIV(x) ((x)<<2)
  8080. #define DPLL_CFGCR2_PDIV_1 (0<<2)
  8081. #define DPLL_CFGCR2_PDIV_2 (1<<2)
  8082. #define DPLL_CFGCR2_PDIV_3 (2<<2)
  8083. #define DPLL_CFGCR2_PDIV_7 (4<<2)
  8084. #define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3)
  8085. #define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR1)
  8086. #define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2)
  8087. /*
  8088. * CNL Clocks
  8089. */
  8090. #define DPCLKA_CFGCR0 _MMIO(0x6C200)
  8091. #define DPCLKA_CFGCR0_ICL _MMIO(0x164280)
  8092. #define DPCLKA_CFGCR0_DDI_CLK_OFF(port) (1 << ((port) == PORT_F ? 23 : \
  8093. (port)+10))
  8094. #define DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port) ((port) == PORT_F ? 21 : \
  8095. (port)*2)
  8096. #define DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port) (3 << DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port))
  8097. #define DPCLKA_CFGCR0_DDI_CLK_SEL(pll, port) ((pll) << DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port))
  8098. /* CNL PLL */
  8099. #define DPLL0_ENABLE 0x46010
  8100. #define DPLL1_ENABLE 0x46014
  8101. #define PLL_ENABLE (1 << 31)
  8102. #define PLL_LOCK (1 << 30)
  8103. #define PLL_POWER_ENABLE (1 << 27)
  8104. #define PLL_POWER_STATE (1 << 26)
  8105. #define CNL_DPLL_ENABLE(pll) _MMIO_PLL(pll, DPLL0_ENABLE, DPLL1_ENABLE)
  8106. #define _MG_PLL1_ENABLE 0x46030
  8107. #define _MG_PLL2_ENABLE 0x46034
  8108. #define _MG_PLL3_ENABLE 0x46038
  8109. #define _MG_PLL4_ENABLE 0x4603C
  8110. /* Bits are the same as DPLL0_ENABLE */
  8111. #define MG_PLL_ENABLE(port) _MMIO_PORT((port) - PORT_C, _MG_PLL1_ENABLE, \
  8112. _MG_PLL2_ENABLE)
  8113. #define _MG_REFCLKIN_CTL_PORT1 0x16892C
  8114. #define _MG_REFCLKIN_CTL_PORT2 0x16992C
  8115. #define _MG_REFCLKIN_CTL_PORT3 0x16A92C
  8116. #define _MG_REFCLKIN_CTL_PORT4 0x16B92C
  8117. #define MG_REFCLKIN_CTL_OD_2_MUX(x) ((x) << 8)
  8118. #define MG_REFCLKIN_CTL(port) _MMIO_PORT((port) - PORT_C, \
  8119. _MG_REFCLKIN_CTL_PORT1, \
  8120. _MG_REFCLKIN_CTL_PORT2)
  8121. #define _MG_CLKTOP2_CORECLKCTL1_PORT1 0x1688D8
  8122. #define _MG_CLKTOP2_CORECLKCTL1_PORT2 0x1698D8
  8123. #define _MG_CLKTOP2_CORECLKCTL1_PORT3 0x16A8D8
  8124. #define _MG_CLKTOP2_CORECLKCTL1_PORT4 0x16B8D8
  8125. #define MG_CLKTOP2_CORECLKCTL1_B_DIVRATIO(x) ((x) << 16)
  8126. #define MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO(x) ((x) << 8)
  8127. #define MG_CLKTOP2_CORECLKCTL1(port) _MMIO_PORT((port) - PORT_C, \
  8128. _MG_CLKTOP2_CORECLKCTL1_PORT1, \
  8129. _MG_CLKTOP2_CORECLKCTL1_PORT2)
  8130. #define _MG_CLKTOP2_HSCLKCTL_PORT1 0x1688D4
  8131. #define _MG_CLKTOP2_HSCLKCTL_PORT2 0x1698D4
  8132. #define _MG_CLKTOP2_HSCLKCTL_PORT3 0x16A8D4
  8133. #define _MG_CLKTOP2_HSCLKCTL_PORT4 0x16B8D4
  8134. #define MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL(x) ((x) << 16)
  8135. #define MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL(x) ((x) << 14)
  8136. #define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO(x) ((x) << 12)
  8137. #define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO(x) ((x) << 8)
  8138. #define MG_CLKTOP2_HSCLKCTL(port) _MMIO_PORT((port) - PORT_C, \
  8139. _MG_CLKTOP2_HSCLKCTL_PORT1, \
  8140. _MG_CLKTOP2_HSCLKCTL_PORT2)
  8141. #define _MG_PLL_DIV0_PORT1 0x168A00
  8142. #define _MG_PLL_DIV0_PORT2 0x169A00
  8143. #define _MG_PLL_DIV0_PORT3 0x16AA00
  8144. #define _MG_PLL_DIV0_PORT4 0x16BA00
  8145. #define MG_PLL_DIV0_FRACNEN_H (1 << 30)
  8146. #define MG_PLL_DIV0_FBDIV_FRAC(x) ((x) << 8)
  8147. #define MG_PLL_DIV0_FBDIV_INT(x) ((x) << 0)
  8148. #define MG_PLL_DIV0(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_DIV0_PORT1, \
  8149. _MG_PLL_DIV0_PORT2)
  8150. #define _MG_PLL_DIV1_PORT1 0x168A04
  8151. #define _MG_PLL_DIV1_PORT2 0x169A04
  8152. #define _MG_PLL_DIV1_PORT3 0x16AA04
  8153. #define _MG_PLL_DIV1_PORT4 0x16BA04
  8154. #define MG_PLL_DIV1_IREF_NDIVRATIO(x) ((x) << 16)
  8155. #define MG_PLL_DIV1_DITHER_DIV_1 (0 << 12)
  8156. #define MG_PLL_DIV1_DITHER_DIV_2 (1 << 12)
  8157. #define MG_PLL_DIV1_DITHER_DIV_4 (2 << 12)
  8158. #define MG_PLL_DIV1_DITHER_DIV_8 (3 << 12)
  8159. #define MG_PLL_DIV1_NDIVRATIO(x) ((x) << 4)
  8160. #define MG_PLL_DIV1_FBPREDIV(x) ((x) << 0)
  8161. #define MG_PLL_DIV1(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_DIV1_PORT1, \
  8162. _MG_PLL_DIV1_PORT2)
  8163. #define _MG_PLL_LF_PORT1 0x168A08
  8164. #define _MG_PLL_LF_PORT2 0x169A08
  8165. #define _MG_PLL_LF_PORT3 0x16AA08
  8166. #define _MG_PLL_LF_PORT4 0x16BA08
  8167. #define MG_PLL_LF_TDCTARGETCNT(x) ((x) << 24)
  8168. #define MG_PLL_LF_AFCCNTSEL_256 (0 << 20)
  8169. #define MG_PLL_LF_AFCCNTSEL_512 (1 << 20)
  8170. #define MG_PLL_LF_GAINCTRL(x) ((x) << 16)
  8171. #define MG_PLL_LF_INT_COEFF(x) ((x) << 8)
  8172. #define MG_PLL_LF_PROP_COEFF(x) ((x) << 0)
  8173. #define MG_PLL_LF(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_LF_PORT1, \
  8174. _MG_PLL_LF_PORT2)
  8175. #define _MG_PLL_FRAC_LOCK_PORT1 0x168A0C
  8176. #define _MG_PLL_FRAC_LOCK_PORT2 0x169A0C
  8177. #define _MG_PLL_FRAC_LOCK_PORT3 0x16AA0C
  8178. #define _MG_PLL_FRAC_LOCK_PORT4 0x16BA0C
  8179. #define MG_PLL_FRAC_LOCK_TRUELOCK_CRIT_32 (1 << 18)
  8180. #define MG_PLL_FRAC_LOCK_EARLYLOCK_CRIT_32 (1 << 16)
  8181. #define MG_PLL_FRAC_LOCK_LOCKTHRESH(x) ((x) << 11)
  8182. #define MG_PLL_FRAC_LOCK_DCODITHEREN (1 << 10)
  8183. #define MG_PLL_FRAC_LOCK_FEEDFWRDCAL_EN (1 << 8)
  8184. #define MG_PLL_FRAC_LOCK_FEEDFWRDGAIN(x) ((x) << 0)
  8185. #define MG_PLL_FRAC_LOCK(port) _MMIO_PORT((port) - PORT_C, \
  8186. _MG_PLL_FRAC_LOCK_PORT1, \
  8187. _MG_PLL_FRAC_LOCK_PORT2)
  8188. #define _MG_PLL_SSC_PORT1 0x168A10
  8189. #define _MG_PLL_SSC_PORT2 0x169A10
  8190. #define _MG_PLL_SSC_PORT3 0x16AA10
  8191. #define _MG_PLL_SSC_PORT4 0x16BA10
  8192. #define MG_PLL_SSC_EN (1 << 28)
  8193. #define MG_PLL_SSC_TYPE(x) ((x) << 26)
  8194. #define MG_PLL_SSC_STEPLENGTH(x) ((x) << 16)
  8195. #define MG_PLL_SSC_STEPNUM(x) ((x) << 10)
  8196. #define MG_PLL_SSC_FLLEN (1 << 9)
  8197. #define MG_PLL_SSC_STEPSIZE(x) ((x) << 0)
  8198. #define MG_PLL_SSC(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_SSC_PORT1, \
  8199. _MG_PLL_SSC_PORT2)
  8200. #define _MG_PLL_BIAS_PORT1 0x168A14
  8201. #define _MG_PLL_BIAS_PORT2 0x169A14
  8202. #define _MG_PLL_BIAS_PORT3 0x16AA14
  8203. #define _MG_PLL_BIAS_PORT4 0x16BA14
  8204. #define MG_PLL_BIAS_BIAS_GB_SEL(x) ((x) << 30)
  8205. #define MG_PLL_BIAS_INIT_DCOAMP(x) ((x) << 24)
  8206. #define MG_PLL_BIAS_BIAS_BONUS(x) ((x) << 16)
  8207. #define MG_PLL_BIAS_BIASCAL_EN (1 << 15)
  8208. #define MG_PLL_BIAS_CTRIM(x) ((x) << 8)
  8209. #define MG_PLL_BIAS_VREF_RDAC(x) ((x) << 5)
  8210. #define MG_PLL_BIAS_IREFTRIM(x) ((x) << 0)
  8211. #define MG_PLL_BIAS(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_BIAS_PORT1, \
  8212. _MG_PLL_BIAS_PORT2)
  8213. #define _MG_PLL_TDC_COLDST_BIAS_PORT1 0x168A18
  8214. #define _MG_PLL_TDC_COLDST_BIAS_PORT2 0x169A18
  8215. #define _MG_PLL_TDC_COLDST_BIAS_PORT3 0x16AA18
  8216. #define _MG_PLL_TDC_COLDST_BIAS_PORT4 0x16BA18
  8217. #define MG_PLL_TDC_COLDST_IREFINT_EN (1 << 27)
  8218. #define MG_PLL_TDC_COLDST_REFBIAS_START_PULSE_W(x) ((x) << 17)
  8219. #define MG_PLL_TDC_COLDST_COLDSTART (1 << 16)
  8220. #define MG_PLL_TDC_TDCOVCCORR_EN (1 << 2)
  8221. #define MG_PLL_TDC_TDCSEL(x) ((x) << 0)
  8222. #define MG_PLL_TDC_COLDST_BIAS(port) _MMIO_PORT((port) - PORT_C, \
  8223. _MG_PLL_TDC_COLDST_BIAS_PORT1, \
  8224. _MG_PLL_TDC_COLDST_BIAS_PORT2)
  8225. #define _CNL_DPLL0_CFGCR0 0x6C000
  8226. #define _CNL_DPLL1_CFGCR0 0x6C080
  8227. #define DPLL_CFGCR0_HDMI_MODE (1 << 30)
  8228. #define DPLL_CFGCR0_SSC_ENABLE (1 << 29)
  8229. #define DPLL_CFGCR0_SSC_ENABLE_ICL (1 << 25)
  8230. #define DPLL_CFGCR0_LINK_RATE_MASK (0xf << 25)
  8231. #define DPLL_CFGCR0_LINK_RATE_2700 (0 << 25)
  8232. #define DPLL_CFGCR0_LINK_RATE_1350 (1 << 25)
  8233. #define DPLL_CFGCR0_LINK_RATE_810 (2 << 25)
  8234. #define DPLL_CFGCR0_LINK_RATE_1620 (3 << 25)
  8235. #define DPLL_CFGCR0_LINK_RATE_1080 (4 << 25)
  8236. #define DPLL_CFGCR0_LINK_RATE_2160 (5 << 25)
  8237. #define DPLL_CFGCR0_LINK_RATE_3240 (6 << 25)
  8238. #define DPLL_CFGCR0_LINK_RATE_4050 (7 << 25)
  8239. #define DPLL_CFGCR0_DCO_FRACTION_MASK (0x7fff << 10)
  8240. #define DPLL_CFGCR0_DCO_FRACTION_SHIFT (10)
  8241. #define DPLL_CFGCR0_DCO_FRACTION(x) ((x) << 10)
  8242. #define DPLL_CFGCR0_DCO_INTEGER_MASK (0x3ff)
  8243. #define CNL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _CNL_DPLL0_CFGCR0, _CNL_DPLL1_CFGCR0)
  8244. #define _CNL_DPLL0_CFGCR1 0x6C004
  8245. #define _CNL_DPLL1_CFGCR1 0x6C084
  8246. #define DPLL_CFGCR1_QDIV_RATIO_MASK (0xff << 10)
  8247. #define DPLL_CFGCR1_QDIV_RATIO_SHIFT (10)
  8248. #define DPLL_CFGCR1_QDIV_RATIO(x) ((x) << 10)
  8249. #define DPLL_CFGCR1_QDIV_MODE(x) ((x) << 9)
  8250. #define DPLL_CFGCR1_KDIV_MASK (7 << 6)
  8251. #define DPLL_CFGCR1_KDIV(x) ((x) << 6)
  8252. #define DPLL_CFGCR1_KDIV_1 (1 << 6)
  8253. #define DPLL_CFGCR1_KDIV_2 (2 << 6)
  8254. #define DPLL_CFGCR1_KDIV_4 (4 << 6)
  8255. #define DPLL_CFGCR1_PDIV_MASK (0xf << 2)
  8256. #define DPLL_CFGCR1_PDIV(x) ((x) << 2)
  8257. #define DPLL_CFGCR1_PDIV_2 (1 << 2)
  8258. #define DPLL_CFGCR1_PDIV_3 (2 << 2)
  8259. #define DPLL_CFGCR1_PDIV_5 (4 << 2)
  8260. #define DPLL_CFGCR1_PDIV_7 (8 << 2)
  8261. #define DPLL_CFGCR1_CENTRAL_FREQ (3 << 0)
  8262. #define DPLL_CFGCR1_CENTRAL_FREQ_8400 (3 << 0)
  8263. #define CNL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _CNL_DPLL0_CFGCR1, _CNL_DPLL1_CFGCR1)
  8264. #define _ICL_DPLL0_CFGCR0 0x164000
  8265. #define _ICL_DPLL1_CFGCR0 0x164080
  8266. #define ICL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _ICL_DPLL0_CFGCR0, \
  8267. _ICL_DPLL1_CFGCR0)
  8268. #define _ICL_DPLL0_CFGCR1 0x164004
  8269. #define _ICL_DPLL1_CFGCR1 0x164084
  8270. #define ICL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _ICL_DPLL0_CFGCR1, \
  8271. _ICL_DPLL1_CFGCR1)
  8272. /* BXT display engine PLL */
  8273. #define BXT_DE_PLL_CTL _MMIO(0x6d000)
  8274. #define BXT_DE_PLL_RATIO(x) (x) /* {60,65,100} * 19.2MHz */
  8275. #define BXT_DE_PLL_RATIO_MASK 0xff
  8276. #define BXT_DE_PLL_ENABLE _MMIO(0x46070)
  8277. #define BXT_DE_PLL_PLL_ENABLE (1 << 31)
  8278. #define BXT_DE_PLL_LOCK (1 << 30)
  8279. #define CNL_CDCLK_PLL_RATIO(x) (x)
  8280. #define CNL_CDCLK_PLL_RATIO_MASK 0xff
  8281. /* GEN9 DC */
  8282. #define DC_STATE_EN _MMIO(0x45504)
  8283. #define DC_STATE_DISABLE 0
  8284. #define DC_STATE_EN_UPTO_DC5 (1<<0)
  8285. #define DC_STATE_EN_DC9 (1<<3)
  8286. #define DC_STATE_EN_UPTO_DC6 (2<<0)
  8287. #define DC_STATE_EN_UPTO_DC5_DC6_MASK 0x3
  8288. #define DC_STATE_DEBUG _MMIO(0x45520)
  8289. #define DC_STATE_DEBUG_MASK_CORES (1<<0)
  8290. #define DC_STATE_DEBUG_MASK_MEMORY_UP (1<<1)
  8291. /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  8292. * since on HSW we can't write to it using I915_WRITE. */
  8293. #define D_COMP_HSW _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
  8294. #define D_COMP_BDW _MMIO(0x138144)
  8295. #define D_COMP_RCOMP_IN_PROGRESS (1<<9)
  8296. #define D_COMP_COMP_FORCE (1<<8)
  8297. #define D_COMP_COMP_DISABLE (1<<0)
  8298. /* Pipe WM_LINETIME - watermark line time */
  8299. #define _PIPE_WM_LINETIME_A 0x45270
  8300. #define _PIPE_WM_LINETIME_B 0x45274
  8301. #define PIPE_WM_LINETIME(pipe) _MMIO_PIPE(pipe, _PIPE_WM_LINETIME_A, _PIPE_WM_LINETIME_B)
  8302. #define PIPE_WM_LINETIME_MASK (0x1ff)
  8303. #define PIPE_WM_LINETIME_TIME(x) ((x))
  8304. #define PIPE_WM_LINETIME_IPS_LINETIME_MASK (0x1ff<<16)
  8305. #define PIPE_WM_LINETIME_IPS_LINETIME(x) ((x)<<16)
  8306. /* SFUSE_STRAP */
  8307. #define SFUSE_STRAP _MMIO(0xc2014)
  8308. #define SFUSE_STRAP_FUSE_LOCK (1<<13)
  8309. #define SFUSE_STRAP_RAW_FREQUENCY (1<<8)
  8310. #define SFUSE_STRAP_DISPLAY_DISABLED (1<<7)
  8311. #define SFUSE_STRAP_CRT_DISABLED (1<<6)
  8312. #define SFUSE_STRAP_DDIF_DETECTED (1<<3)
  8313. #define SFUSE_STRAP_DDIB_DETECTED (1<<2)
  8314. #define SFUSE_STRAP_DDIC_DETECTED (1<<1)
  8315. #define SFUSE_STRAP_DDID_DETECTED (1<<0)
  8316. #define WM_MISC _MMIO(0x45260)
  8317. #define WM_MISC_DATA_PARTITION_5_6 (1 << 0)
  8318. #define WM_DBG _MMIO(0x45280)
  8319. #define WM_DBG_DISALLOW_MULTIPLE_LP (1<<0)
  8320. #define WM_DBG_DISALLOW_MAXFIFO (1<<1)
  8321. #define WM_DBG_DISALLOW_SPRITE (1<<2)
  8322. /* pipe CSC */
  8323. #define _PIPE_A_CSC_COEFF_RY_GY 0x49010
  8324. #define _PIPE_A_CSC_COEFF_BY 0x49014
  8325. #define _PIPE_A_CSC_COEFF_RU_GU 0x49018
  8326. #define _PIPE_A_CSC_COEFF_BU 0x4901c
  8327. #define _PIPE_A_CSC_COEFF_RV_GV 0x49020
  8328. #define _PIPE_A_CSC_COEFF_BV 0x49024
  8329. #define _PIPE_A_CSC_MODE 0x49028
  8330. #define CSC_BLACK_SCREEN_OFFSET (1 << 2)
  8331. #define CSC_POSITION_BEFORE_GAMMA (1 << 1)
  8332. #define CSC_MODE_YUV_TO_RGB (1 << 0)
  8333. #define _PIPE_A_CSC_PREOFF_HI 0x49030
  8334. #define _PIPE_A_CSC_PREOFF_ME 0x49034
  8335. #define _PIPE_A_CSC_PREOFF_LO 0x49038
  8336. #define _PIPE_A_CSC_POSTOFF_HI 0x49040
  8337. #define _PIPE_A_CSC_POSTOFF_ME 0x49044
  8338. #define _PIPE_A_CSC_POSTOFF_LO 0x49048
  8339. #define _PIPE_B_CSC_COEFF_RY_GY 0x49110
  8340. #define _PIPE_B_CSC_COEFF_BY 0x49114
  8341. #define _PIPE_B_CSC_COEFF_RU_GU 0x49118
  8342. #define _PIPE_B_CSC_COEFF_BU 0x4911c
  8343. #define _PIPE_B_CSC_COEFF_RV_GV 0x49120
  8344. #define _PIPE_B_CSC_COEFF_BV 0x49124
  8345. #define _PIPE_B_CSC_MODE 0x49128
  8346. #define _PIPE_B_CSC_PREOFF_HI 0x49130
  8347. #define _PIPE_B_CSC_PREOFF_ME 0x49134
  8348. #define _PIPE_B_CSC_PREOFF_LO 0x49138
  8349. #define _PIPE_B_CSC_POSTOFF_HI 0x49140
  8350. #define _PIPE_B_CSC_POSTOFF_ME 0x49144
  8351. #define _PIPE_B_CSC_POSTOFF_LO 0x49148
  8352. #define PIPE_CSC_COEFF_RY_GY(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RY_GY, _PIPE_B_CSC_COEFF_RY_GY)
  8353. #define PIPE_CSC_COEFF_BY(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BY, _PIPE_B_CSC_COEFF_BY)
  8354. #define PIPE_CSC_COEFF_RU_GU(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RU_GU, _PIPE_B_CSC_COEFF_RU_GU)
  8355. #define PIPE_CSC_COEFF_BU(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BU, _PIPE_B_CSC_COEFF_BU)
  8356. #define PIPE_CSC_COEFF_RV_GV(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_RV_GV, _PIPE_B_CSC_COEFF_RV_GV)
  8357. #define PIPE_CSC_COEFF_BV(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_COEFF_BV, _PIPE_B_CSC_COEFF_BV)
  8358. #define PIPE_CSC_MODE(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_MODE, _PIPE_B_CSC_MODE)
  8359. #define PIPE_CSC_PREOFF_HI(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_HI, _PIPE_B_CSC_PREOFF_HI)
  8360. #define PIPE_CSC_PREOFF_ME(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_ME, _PIPE_B_CSC_PREOFF_ME)
  8361. #define PIPE_CSC_PREOFF_LO(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_PREOFF_LO, _PIPE_B_CSC_PREOFF_LO)
  8362. #define PIPE_CSC_POSTOFF_HI(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_HI, _PIPE_B_CSC_POSTOFF_HI)
  8363. #define PIPE_CSC_POSTOFF_ME(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_ME, _PIPE_B_CSC_POSTOFF_ME)
  8364. #define PIPE_CSC_POSTOFF_LO(pipe) _MMIO_PIPE(pipe, _PIPE_A_CSC_POSTOFF_LO, _PIPE_B_CSC_POSTOFF_LO)
  8365. /* pipe degamma/gamma LUTs on IVB+ */
  8366. #define _PAL_PREC_INDEX_A 0x4A400
  8367. #define _PAL_PREC_INDEX_B 0x4AC00
  8368. #define _PAL_PREC_INDEX_C 0x4B400
  8369. #define PAL_PREC_10_12_BIT (0 << 31)
  8370. #define PAL_PREC_SPLIT_MODE (1 << 31)
  8371. #define PAL_PREC_AUTO_INCREMENT (1 << 15)
  8372. #define PAL_PREC_INDEX_VALUE_MASK (0x3ff << 0)
  8373. #define _PAL_PREC_DATA_A 0x4A404
  8374. #define _PAL_PREC_DATA_B 0x4AC04
  8375. #define _PAL_PREC_DATA_C 0x4B404
  8376. #define _PAL_PREC_GC_MAX_A 0x4A410
  8377. #define _PAL_PREC_GC_MAX_B 0x4AC10
  8378. #define _PAL_PREC_GC_MAX_C 0x4B410
  8379. #define _PAL_PREC_EXT_GC_MAX_A 0x4A420
  8380. #define _PAL_PREC_EXT_GC_MAX_B 0x4AC20
  8381. #define _PAL_PREC_EXT_GC_MAX_C 0x4B420
  8382. #define _PAL_PREC_EXT2_GC_MAX_A 0x4A430
  8383. #define _PAL_PREC_EXT2_GC_MAX_B 0x4AC30
  8384. #define _PAL_PREC_EXT2_GC_MAX_C 0x4B430
  8385. #define PREC_PAL_INDEX(pipe) _MMIO_PIPE(pipe, _PAL_PREC_INDEX_A, _PAL_PREC_INDEX_B)
  8386. #define PREC_PAL_DATA(pipe) _MMIO_PIPE(pipe, _PAL_PREC_DATA_A, _PAL_PREC_DATA_B)
  8387. #define PREC_PAL_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_GC_MAX_A, _PAL_PREC_GC_MAX_B) + (i) * 4)
  8388. #define PREC_PAL_EXT_GC_MAX(pipe, i) _MMIO(_PIPE(pipe, _PAL_PREC_EXT_GC_MAX_A, _PAL_PREC_EXT_GC_MAX_B) + (i) * 4)
  8389. #define _PRE_CSC_GAMC_INDEX_A 0x4A484
  8390. #define _PRE_CSC_GAMC_INDEX_B 0x4AC84
  8391. #define _PRE_CSC_GAMC_INDEX_C 0x4B484
  8392. #define PRE_CSC_GAMC_AUTO_INCREMENT (1 << 10)
  8393. #define _PRE_CSC_GAMC_DATA_A 0x4A488
  8394. #define _PRE_CSC_GAMC_DATA_B 0x4AC88
  8395. #define _PRE_CSC_GAMC_DATA_C 0x4B488
  8396. #define PRE_CSC_GAMC_INDEX(pipe) _MMIO_PIPE(pipe, _PRE_CSC_GAMC_INDEX_A, _PRE_CSC_GAMC_INDEX_B)
  8397. #define PRE_CSC_GAMC_DATA(pipe) _MMIO_PIPE(pipe, _PRE_CSC_GAMC_DATA_A, _PRE_CSC_GAMC_DATA_B)
  8398. /* pipe CSC & degamma/gamma LUTs on CHV */
  8399. #define _CGM_PIPE_A_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x67900)
  8400. #define _CGM_PIPE_A_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x67904)
  8401. #define _CGM_PIPE_A_CSC_COEFF45 (VLV_DISPLAY_BASE + 0x67908)
  8402. #define _CGM_PIPE_A_CSC_COEFF67 (VLV_DISPLAY_BASE + 0x6790C)
  8403. #define _CGM_PIPE_A_CSC_COEFF8 (VLV_DISPLAY_BASE + 0x67910)
  8404. #define _CGM_PIPE_A_DEGAMMA (VLV_DISPLAY_BASE + 0x66000)
  8405. #define _CGM_PIPE_A_GAMMA (VLV_DISPLAY_BASE + 0x67000)
  8406. #define _CGM_PIPE_A_MODE (VLV_DISPLAY_BASE + 0x67A00)
  8407. #define CGM_PIPE_MODE_GAMMA (1 << 2)
  8408. #define CGM_PIPE_MODE_CSC (1 << 1)
  8409. #define CGM_PIPE_MODE_DEGAMMA (1 << 0)
  8410. #define _CGM_PIPE_B_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x69900)
  8411. #define _CGM_PIPE_B_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x69904)
  8412. #define _CGM_PIPE_B_CSC_COEFF45 (VLV_DISPLAY_BASE + 0x69908)
  8413. #define _CGM_PIPE_B_CSC_COEFF67 (VLV_DISPLAY_BASE + 0x6990C)
  8414. #define _CGM_PIPE_B_CSC_COEFF8 (VLV_DISPLAY_BASE + 0x69910)
  8415. #define _CGM_PIPE_B_DEGAMMA (VLV_DISPLAY_BASE + 0x68000)
  8416. #define _CGM_PIPE_B_GAMMA (VLV_DISPLAY_BASE + 0x69000)
  8417. #define _CGM_PIPE_B_MODE (VLV_DISPLAY_BASE + 0x69A00)
  8418. #define CGM_PIPE_CSC_COEFF01(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF01, _CGM_PIPE_B_CSC_COEFF01)
  8419. #define CGM_PIPE_CSC_COEFF23(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF23, _CGM_PIPE_B_CSC_COEFF23)
  8420. #define CGM_PIPE_CSC_COEFF45(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF45, _CGM_PIPE_B_CSC_COEFF45)
  8421. #define CGM_PIPE_CSC_COEFF67(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF67, _CGM_PIPE_B_CSC_COEFF67)
  8422. #define CGM_PIPE_CSC_COEFF8(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_CSC_COEFF8, _CGM_PIPE_B_CSC_COEFF8)
  8423. #define CGM_PIPE_DEGAMMA(pipe, i, w) _MMIO(_PIPE(pipe, _CGM_PIPE_A_DEGAMMA, _CGM_PIPE_B_DEGAMMA) + (i) * 8 + (w) * 4)
  8424. #define CGM_PIPE_GAMMA(pipe, i, w) _MMIO(_PIPE(pipe, _CGM_PIPE_A_GAMMA, _CGM_PIPE_B_GAMMA) + (i) * 8 + (w) * 4)
  8425. #define CGM_PIPE_MODE(pipe) _MMIO_PIPE(pipe, _CGM_PIPE_A_MODE, _CGM_PIPE_B_MODE)
  8426. /* MIPI DSI registers */
  8427. #define _MIPI_PORT(port, a, c) (((port) == PORT_A) ? a : c) /* ports A and C only */
  8428. #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
  8429. #define MIPIO_TXESC_CLK_DIV1 _MMIO(0x160004)
  8430. #define GLK_TX_ESC_CLK_DIV1_MASK 0x3FF
  8431. #define MIPIO_TXESC_CLK_DIV2 _MMIO(0x160008)
  8432. #define GLK_TX_ESC_CLK_DIV2_MASK 0x3FF
  8433. /* Gen4+ Timestamp and Pipe Frame time stamp registers */
  8434. #define GEN4_TIMESTAMP _MMIO(0x2358)
  8435. #define ILK_TIMESTAMP_HI _MMIO(0x70070)
  8436. #define IVB_TIMESTAMP_CTR _MMIO(0x44070)
  8437. #define GEN9_TIMESTAMP_OVERRIDE _MMIO(0x44074)
  8438. #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT 0
  8439. #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK 0x3ff
  8440. #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT 12
  8441. #define GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK (0xf << 12)
  8442. #define _PIPE_FRMTMSTMP_A 0x70048
  8443. #define PIPE_FRMTMSTMP(pipe) \
  8444. _MMIO_PIPE2(pipe, _PIPE_FRMTMSTMP_A)
  8445. /* BXT MIPI clock controls */
  8446. #define BXT_MAX_VAR_OUTPUT_KHZ 39500
  8447. #define BXT_MIPI_CLOCK_CTL _MMIO(0x46090)
  8448. #define BXT_MIPI1_DIV_SHIFT 26
  8449. #define BXT_MIPI2_DIV_SHIFT 10
  8450. #define BXT_MIPI_DIV_SHIFT(port) \
  8451. _MIPI_PORT(port, BXT_MIPI1_DIV_SHIFT, \
  8452. BXT_MIPI2_DIV_SHIFT)
  8453. /* TX control divider to select actual TX clock output from (8x/var) */
  8454. #define BXT_MIPI1_TX_ESCLK_SHIFT 26
  8455. #define BXT_MIPI2_TX_ESCLK_SHIFT 10
  8456. #define BXT_MIPI_TX_ESCLK_SHIFT(port) \
  8457. _MIPI_PORT(port, BXT_MIPI1_TX_ESCLK_SHIFT, \
  8458. BXT_MIPI2_TX_ESCLK_SHIFT)
  8459. #define BXT_MIPI1_TX_ESCLK_FIXDIV_MASK (0x3F << 26)
  8460. #define BXT_MIPI2_TX_ESCLK_FIXDIV_MASK (0x3F << 10)
  8461. #define BXT_MIPI_TX_ESCLK_FIXDIV_MASK(port) \
  8462. _MIPI_PORT(port, BXT_MIPI1_TX_ESCLK_FIXDIV_MASK, \
  8463. BXT_MIPI2_TX_ESCLK_FIXDIV_MASK)
  8464. #define BXT_MIPI_TX_ESCLK_DIVIDER(port, val) \
  8465. ((val & 0x3F) << BXT_MIPI_TX_ESCLK_SHIFT(port))
  8466. /* RX upper control divider to select actual RX clock output from 8x */
  8467. #define BXT_MIPI1_RX_ESCLK_UPPER_SHIFT 21
  8468. #define BXT_MIPI2_RX_ESCLK_UPPER_SHIFT 5
  8469. #define BXT_MIPI_RX_ESCLK_UPPER_SHIFT(port) \
  8470. _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_UPPER_SHIFT, \
  8471. BXT_MIPI2_RX_ESCLK_UPPER_SHIFT)
  8472. #define BXT_MIPI1_RX_ESCLK_UPPER_FIXDIV_MASK (3 << 21)
  8473. #define BXT_MIPI2_RX_ESCLK_UPPER_FIXDIV_MASK (3 << 5)
  8474. #define BXT_MIPI_RX_ESCLK_UPPER_FIXDIV_MASK(port) \
  8475. _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_UPPER_FIXDIV_MASK, \
  8476. BXT_MIPI2_RX_ESCLK_UPPER_FIXDIV_MASK)
  8477. #define BXT_MIPI_RX_ESCLK_UPPER_DIVIDER(port, val) \
  8478. ((val & 3) << BXT_MIPI_RX_ESCLK_UPPER_SHIFT(port))
  8479. /* 8/3X divider to select the actual 8/3X clock output from 8x */
  8480. #define BXT_MIPI1_8X_BY3_SHIFT 19
  8481. #define BXT_MIPI2_8X_BY3_SHIFT 3
  8482. #define BXT_MIPI_8X_BY3_SHIFT(port) \
  8483. _MIPI_PORT(port, BXT_MIPI1_8X_BY3_SHIFT, \
  8484. BXT_MIPI2_8X_BY3_SHIFT)
  8485. #define BXT_MIPI1_8X_BY3_DIVIDER_MASK (3 << 19)
  8486. #define BXT_MIPI2_8X_BY3_DIVIDER_MASK (3 << 3)
  8487. #define BXT_MIPI_8X_BY3_DIVIDER_MASK(port) \
  8488. _MIPI_PORT(port, BXT_MIPI1_8X_BY3_DIVIDER_MASK, \
  8489. BXT_MIPI2_8X_BY3_DIVIDER_MASK)
  8490. #define BXT_MIPI_8X_BY3_DIVIDER(port, val) \
  8491. ((val & 3) << BXT_MIPI_8X_BY3_SHIFT(port))
  8492. /* RX lower control divider to select actual RX clock output from 8x */
  8493. #define BXT_MIPI1_RX_ESCLK_LOWER_SHIFT 16
  8494. #define BXT_MIPI2_RX_ESCLK_LOWER_SHIFT 0
  8495. #define BXT_MIPI_RX_ESCLK_LOWER_SHIFT(port) \
  8496. _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_LOWER_SHIFT, \
  8497. BXT_MIPI2_RX_ESCLK_LOWER_SHIFT)
  8498. #define BXT_MIPI1_RX_ESCLK_LOWER_FIXDIV_MASK (3 << 16)
  8499. #define BXT_MIPI2_RX_ESCLK_LOWER_FIXDIV_MASK (3 << 0)
  8500. #define BXT_MIPI_RX_ESCLK_LOWER_FIXDIV_MASK(port) \
  8501. _MIPI_PORT(port, BXT_MIPI1_RX_ESCLK_LOWER_FIXDIV_MASK, \
  8502. BXT_MIPI2_RX_ESCLK_LOWER_FIXDIV_MASK)
  8503. #define BXT_MIPI_RX_ESCLK_LOWER_DIVIDER(port, val) \
  8504. ((val & 3) << BXT_MIPI_RX_ESCLK_LOWER_SHIFT(port))
  8505. #define RX_DIVIDER_BIT_1_2 0x3
  8506. #define RX_DIVIDER_BIT_3_4 0xC
  8507. /* BXT MIPI mode configure */
  8508. #define _BXT_MIPIA_TRANS_HACTIVE 0x6B0F8
  8509. #define _BXT_MIPIC_TRANS_HACTIVE 0x6B8F8
  8510. #define BXT_MIPI_TRANS_HACTIVE(tc) _MMIO_MIPI(tc, \
  8511. _BXT_MIPIA_TRANS_HACTIVE, _BXT_MIPIC_TRANS_HACTIVE)
  8512. #define _BXT_MIPIA_TRANS_VACTIVE 0x6B0FC
  8513. #define _BXT_MIPIC_TRANS_VACTIVE 0x6B8FC
  8514. #define BXT_MIPI_TRANS_VACTIVE(tc) _MMIO_MIPI(tc, \
  8515. _BXT_MIPIA_TRANS_VACTIVE, _BXT_MIPIC_TRANS_VACTIVE)
  8516. #define _BXT_MIPIA_TRANS_VTOTAL 0x6B100
  8517. #define _BXT_MIPIC_TRANS_VTOTAL 0x6B900
  8518. #define BXT_MIPI_TRANS_VTOTAL(tc) _MMIO_MIPI(tc, \
  8519. _BXT_MIPIA_TRANS_VTOTAL, _BXT_MIPIC_TRANS_VTOTAL)
  8520. #define BXT_DSI_PLL_CTL _MMIO(0x161000)
  8521. #define BXT_DSI_PLL_PVD_RATIO_SHIFT 16
  8522. #define BXT_DSI_PLL_PVD_RATIO_MASK (3 << BXT_DSI_PLL_PVD_RATIO_SHIFT)
  8523. #define BXT_DSI_PLL_PVD_RATIO_1 (1 << BXT_DSI_PLL_PVD_RATIO_SHIFT)
  8524. #define BXT_DSIC_16X_BY1 (0 << 10)
  8525. #define BXT_DSIC_16X_BY2 (1 << 10)
  8526. #define BXT_DSIC_16X_BY3 (2 << 10)
  8527. #define BXT_DSIC_16X_BY4 (3 << 10)
  8528. #define BXT_DSIC_16X_MASK (3 << 10)
  8529. #define BXT_DSIA_16X_BY1 (0 << 8)
  8530. #define BXT_DSIA_16X_BY2 (1 << 8)
  8531. #define BXT_DSIA_16X_BY3 (2 << 8)
  8532. #define BXT_DSIA_16X_BY4 (3 << 8)
  8533. #define BXT_DSIA_16X_MASK (3 << 8)
  8534. #define BXT_DSI_FREQ_SEL_SHIFT 8
  8535. #define BXT_DSI_FREQ_SEL_MASK (0xF << BXT_DSI_FREQ_SEL_SHIFT)
  8536. #define BXT_DSI_PLL_RATIO_MAX 0x7D
  8537. #define BXT_DSI_PLL_RATIO_MIN 0x22
  8538. #define GLK_DSI_PLL_RATIO_MAX 0x6F
  8539. #define GLK_DSI_PLL_RATIO_MIN 0x22
  8540. #define BXT_DSI_PLL_RATIO_MASK 0xFF
  8541. #define BXT_REF_CLOCK_KHZ 19200
  8542. #define BXT_DSI_PLL_ENABLE _MMIO(0x46080)
  8543. #define BXT_DSI_PLL_DO_ENABLE (1 << 31)
  8544. #define BXT_DSI_PLL_LOCKED (1 << 30)
  8545. #define _MIPIA_PORT_CTRL (VLV_DISPLAY_BASE + 0x61190)
  8546. #define _MIPIC_PORT_CTRL (VLV_DISPLAY_BASE + 0x61700)
  8547. #define MIPI_PORT_CTRL(port) _MMIO_MIPI(port, _MIPIA_PORT_CTRL, _MIPIC_PORT_CTRL)
  8548. /* BXT port control */
  8549. #define _BXT_MIPIA_PORT_CTRL 0x6B0C0
  8550. #define _BXT_MIPIC_PORT_CTRL 0x6B8C0
  8551. #define BXT_MIPI_PORT_CTRL(tc) _MMIO_MIPI(tc, _BXT_MIPIA_PORT_CTRL, _BXT_MIPIC_PORT_CTRL)
  8552. #define BXT_P_DSI_REGULATOR_CFG _MMIO(0x160020)
  8553. #define STAP_SELECT (1 << 0)
  8554. #define BXT_P_DSI_REGULATOR_TX_CTRL _MMIO(0x160054)
  8555. #define HS_IO_CTRL_SELECT (1 << 0)
  8556. #define DPI_ENABLE (1 << 31) /* A + C */
  8557. #define MIPIA_MIPI4DPHY_DELAY_COUNT_SHIFT 27
  8558. #define MIPIA_MIPI4DPHY_DELAY_COUNT_MASK (0xf << 27)
  8559. #define DUAL_LINK_MODE_SHIFT 26
  8560. #define DUAL_LINK_MODE_MASK (1 << 26)
  8561. #define DUAL_LINK_MODE_FRONT_BACK (0 << 26)
  8562. #define DUAL_LINK_MODE_PIXEL_ALTERNATIVE (1 << 26)
  8563. #define DITHERING_ENABLE (1 << 25) /* A + C */
  8564. #define FLOPPED_HSTX (1 << 23)
  8565. #define DE_INVERT (1 << 19) /* XXX */
  8566. #define MIPIA_FLISDSI_DELAY_COUNT_SHIFT 18
  8567. #define MIPIA_FLISDSI_DELAY_COUNT_MASK (0xf << 18)
  8568. #define AFE_LATCHOUT (1 << 17)
  8569. #define LP_OUTPUT_HOLD (1 << 16)
  8570. #define MIPIC_FLISDSI_DELAY_COUNT_HIGH_SHIFT 15
  8571. #define MIPIC_FLISDSI_DELAY_COUNT_HIGH_MASK (1 << 15)
  8572. #define MIPIC_MIPI4DPHY_DELAY_COUNT_SHIFT 11
  8573. #define MIPIC_MIPI4DPHY_DELAY_COUNT_MASK (0xf << 11)
  8574. #define CSB_SHIFT 9
  8575. #define CSB_MASK (3 << 9)
  8576. #define CSB_20MHZ (0 << 9)
  8577. #define CSB_10MHZ (1 << 9)
  8578. #define CSB_40MHZ (2 << 9)
  8579. #define BANDGAP_MASK (1 << 8)
  8580. #define BANDGAP_PNW_CIRCUIT (0 << 8)
  8581. #define BANDGAP_LNC_CIRCUIT (1 << 8)
  8582. #define MIPIC_FLISDSI_DELAY_COUNT_LOW_SHIFT 5
  8583. #define MIPIC_FLISDSI_DELAY_COUNT_LOW_MASK (7 << 5)
  8584. #define TEARING_EFFECT_DELAY (1 << 4) /* A + C */
  8585. #define TEARING_EFFECT_SHIFT 2 /* A + C */
  8586. #define TEARING_EFFECT_MASK (3 << 2)
  8587. #define TEARING_EFFECT_OFF (0 << 2)
  8588. #define TEARING_EFFECT_DSI (1 << 2)
  8589. #define TEARING_EFFECT_GPIO (2 << 2)
  8590. #define LANE_CONFIGURATION_SHIFT 0
  8591. #define LANE_CONFIGURATION_MASK (3 << 0)
  8592. #define LANE_CONFIGURATION_4LANE (0 << 0)
  8593. #define LANE_CONFIGURATION_DUAL_LINK_A (1 << 0)
  8594. #define LANE_CONFIGURATION_DUAL_LINK_B (2 << 0)
  8595. #define _MIPIA_TEARING_CTRL (VLV_DISPLAY_BASE + 0x61194)
  8596. #define _MIPIC_TEARING_CTRL (VLV_DISPLAY_BASE + 0x61704)
  8597. #define MIPI_TEARING_CTRL(port) _MMIO_MIPI(port, _MIPIA_TEARING_CTRL, _MIPIC_TEARING_CTRL)
  8598. #define TEARING_EFFECT_DELAY_SHIFT 0
  8599. #define TEARING_EFFECT_DELAY_MASK (0xffff << 0)
  8600. /* XXX: all bits reserved */
  8601. #define _MIPIA_AUTOPWG (VLV_DISPLAY_BASE + 0x611a0)
  8602. /* MIPI DSI Controller and D-PHY registers */
  8603. #define _MIPIA_DEVICE_READY (dev_priv->mipi_mmio_base + 0xb000)
  8604. #define _MIPIC_DEVICE_READY (dev_priv->mipi_mmio_base + 0xb800)
  8605. #define MIPI_DEVICE_READY(port) _MMIO_MIPI(port, _MIPIA_DEVICE_READY, _MIPIC_DEVICE_READY)
  8606. #define BUS_POSSESSION (1 << 3) /* set to give bus to receiver */
  8607. #define ULPS_STATE_MASK (3 << 1)
  8608. #define ULPS_STATE_ENTER (2 << 1)
  8609. #define ULPS_STATE_EXIT (1 << 1)
  8610. #define ULPS_STATE_NORMAL_OPERATION (0 << 1)
  8611. #define DEVICE_READY (1 << 0)
  8612. #define _MIPIA_INTR_STAT (dev_priv->mipi_mmio_base + 0xb004)
  8613. #define _MIPIC_INTR_STAT (dev_priv->mipi_mmio_base + 0xb804)
  8614. #define MIPI_INTR_STAT(port) _MMIO_MIPI(port, _MIPIA_INTR_STAT, _MIPIC_INTR_STAT)
  8615. #define _MIPIA_INTR_EN (dev_priv->mipi_mmio_base + 0xb008)
  8616. #define _MIPIC_INTR_EN (dev_priv->mipi_mmio_base + 0xb808)
  8617. #define MIPI_INTR_EN(port) _MMIO_MIPI(port, _MIPIA_INTR_EN, _MIPIC_INTR_EN)
  8618. #define TEARING_EFFECT (1 << 31)
  8619. #define SPL_PKT_SENT_INTERRUPT (1 << 30)
  8620. #define GEN_READ_DATA_AVAIL (1 << 29)
  8621. #define LP_GENERIC_WR_FIFO_FULL (1 << 28)
  8622. #define HS_GENERIC_WR_FIFO_FULL (1 << 27)
  8623. #define RX_PROT_VIOLATION (1 << 26)
  8624. #define RX_INVALID_TX_LENGTH (1 << 25)
  8625. #define ACK_WITH_NO_ERROR (1 << 24)
  8626. #define TURN_AROUND_ACK_TIMEOUT (1 << 23)
  8627. #define LP_RX_TIMEOUT (1 << 22)
  8628. #define HS_TX_TIMEOUT (1 << 21)
  8629. #define DPI_FIFO_UNDERRUN (1 << 20)
  8630. #define LOW_CONTENTION (1 << 19)
  8631. #define HIGH_CONTENTION (1 << 18)
  8632. #define TXDSI_VC_ID_INVALID (1 << 17)
  8633. #define TXDSI_DATA_TYPE_NOT_RECOGNISED (1 << 16)
  8634. #define TXCHECKSUM_ERROR (1 << 15)
  8635. #define TXECC_MULTIBIT_ERROR (1 << 14)
  8636. #define TXECC_SINGLE_BIT_ERROR (1 << 13)
  8637. #define TXFALSE_CONTROL_ERROR (1 << 12)
  8638. #define RXDSI_VC_ID_INVALID (1 << 11)
  8639. #define RXDSI_DATA_TYPE_NOT_REGOGNISED (1 << 10)
  8640. #define RXCHECKSUM_ERROR (1 << 9)
  8641. #define RXECC_MULTIBIT_ERROR (1 << 8)
  8642. #define RXECC_SINGLE_BIT_ERROR (1 << 7)
  8643. #define RXFALSE_CONTROL_ERROR (1 << 6)
  8644. #define RXHS_RECEIVE_TIMEOUT_ERROR (1 << 5)
  8645. #define RX_LP_TX_SYNC_ERROR (1 << 4)
  8646. #define RXEXCAPE_MODE_ENTRY_ERROR (1 << 3)
  8647. #define RXEOT_SYNC_ERROR (1 << 2)
  8648. #define RXSOT_SYNC_ERROR (1 << 1)
  8649. #define RXSOT_ERROR (1 << 0)
  8650. #define _MIPIA_DSI_FUNC_PRG (dev_priv->mipi_mmio_base + 0xb00c)
  8651. #define _MIPIC_DSI_FUNC_PRG (dev_priv->mipi_mmio_base + 0xb80c)
  8652. #define MIPI_DSI_FUNC_PRG(port) _MMIO_MIPI(port, _MIPIA_DSI_FUNC_PRG, _MIPIC_DSI_FUNC_PRG)
  8653. #define CMD_MODE_DATA_WIDTH_MASK (7 << 13)
  8654. #define CMD_MODE_NOT_SUPPORTED (0 << 13)
  8655. #define CMD_MODE_DATA_WIDTH_16_BIT (1 << 13)
  8656. #define CMD_MODE_DATA_WIDTH_9_BIT (2 << 13)
  8657. #define CMD_MODE_DATA_WIDTH_8_BIT (3 << 13)
  8658. #define CMD_MODE_DATA_WIDTH_OPTION1 (4 << 13)
  8659. #define CMD_MODE_DATA_WIDTH_OPTION2 (5 << 13)
  8660. #define VID_MODE_FORMAT_MASK (0xf << 7)
  8661. #define VID_MODE_NOT_SUPPORTED (0 << 7)
  8662. #define VID_MODE_FORMAT_RGB565 (1 << 7)
  8663. #define VID_MODE_FORMAT_RGB666_PACKED (2 << 7)
  8664. #define VID_MODE_FORMAT_RGB666 (3 << 7)
  8665. #define VID_MODE_FORMAT_RGB888 (4 << 7)
  8666. #define CMD_MODE_CHANNEL_NUMBER_SHIFT 5
  8667. #define CMD_MODE_CHANNEL_NUMBER_MASK (3 << 5)
  8668. #define VID_MODE_CHANNEL_NUMBER_SHIFT 3
  8669. #define VID_MODE_CHANNEL_NUMBER_MASK (3 << 3)
  8670. #define DATA_LANES_PRG_REG_SHIFT 0
  8671. #define DATA_LANES_PRG_REG_MASK (7 << 0)
  8672. #define _MIPIA_HS_TX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb010)
  8673. #define _MIPIC_HS_TX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb810)
  8674. #define MIPI_HS_TX_TIMEOUT(port) _MMIO_MIPI(port, _MIPIA_HS_TX_TIMEOUT, _MIPIC_HS_TX_TIMEOUT)
  8675. #define HIGH_SPEED_TX_TIMEOUT_COUNTER_MASK 0xffffff
  8676. #define _MIPIA_LP_RX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb014)
  8677. #define _MIPIC_LP_RX_TIMEOUT (dev_priv->mipi_mmio_base + 0xb814)
  8678. #define MIPI_LP_RX_TIMEOUT(port) _MMIO_MIPI(port, _MIPIA_LP_RX_TIMEOUT, _MIPIC_LP_RX_TIMEOUT)
  8679. #define LOW_POWER_RX_TIMEOUT_COUNTER_MASK 0xffffff
  8680. #define _MIPIA_TURN_AROUND_TIMEOUT (dev_priv->mipi_mmio_base + 0xb018)
  8681. #define _MIPIC_TURN_AROUND_TIMEOUT (dev_priv->mipi_mmio_base + 0xb818)
  8682. #define MIPI_TURN_AROUND_TIMEOUT(port) _MMIO_MIPI(port, _MIPIA_TURN_AROUND_TIMEOUT, _MIPIC_TURN_AROUND_TIMEOUT)
  8683. #define TURN_AROUND_TIMEOUT_MASK 0x3f
  8684. #define _MIPIA_DEVICE_RESET_TIMER (dev_priv->mipi_mmio_base + 0xb01c)
  8685. #define _MIPIC_DEVICE_RESET_TIMER (dev_priv->mipi_mmio_base + 0xb81c)
  8686. #define MIPI_DEVICE_RESET_TIMER(port) _MMIO_MIPI(port, _MIPIA_DEVICE_RESET_TIMER, _MIPIC_DEVICE_RESET_TIMER)
  8687. #define DEVICE_RESET_TIMER_MASK 0xffff
  8688. #define _MIPIA_DPI_RESOLUTION (dev_priv->mipi_mmio_base + 0xb020)
  8689. #define _MIPIC_DPI_RESOLUTION (dev_priv->mipi_mmio_base + 0xb820)
  8690. #define MIPI_DPI_RESOLUTION(port) _MMIO_MIPI(port, _MIPIA_DPI_RESOLUTION, _MIPIC_DPI_RESOLUTION)
  8691. #define VERTICAL_ADDRESS_SHIFT 16
  8692. #define VERTICAL_ADDRESS_MASK (0xffff << 16)
  8693. #define HORIZONTAL_ADDRESS_SHIFT 0
  8694. #define HORIZONTAL_ADDRESS_MASK 0xffff
  8695. #define _MIPIA_DBI_FIFO_THROTTLE (dev_priv->mipi_mmio_base + 0xb024)
  8696. #define _MIPIC_DBI_FIFO_THROTTLE (dev_priv->mipi_mmio_base + 0xb824)
  8697. #define MIPI_DBI_FIFO_THROTTLE(port) _MMIO_MIPI(port, _MIPIA_DBI_FIFO_THROTTLE, _MIPIC_DBI_FIFO_THROTTLE)
  8698. #define DBI_FIFO_EMPTY_HALF (0 << 0)
  8699. #define DBI_FIFO_EMPTY_QUARTER (1 << 0)
  8700. #define DBI_FIFO_EMPTY_7_LOCATIONS (2 << 0)
  8701. /* regs below are bits 15:0 */
  8702. #define _MIPIA_HSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb028)
  8703. #define _MIPIC_HSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb828)
  8704. #define MIPI_HSYNC_PADDING_COUNT(port) _MMIO_MIPI(port, _MIPIA_HSYNC_PADDING_COUNT, _MIPIC_HSYNC_PADDING_COUNT)
  8705. #define _MIPIA_HBP_COUNT (dev_priv->mipi_mmio_base + 0xb02c)
  8706. #define _MIPIC_HBP_COUNT (dev_priv->mipi_mmio_base + 0xb82c)
  8707. #define MIPI_HBP_COUNT(port) _MMIO_MIPI(port, _MIPIA_HBP_COUNT, _MIPIC_HBP_COUNT)
  8708. #define _MIPIA_HFP_COUNT (dev_priv->mipi_mmio_base + 0xb030)
  8709. #define _MIPIC_HFP_COUNT (dev_priv->mipi_mmio_base + 0xb830)
  8710. #define MIPI_HFP_COUNT(port) _MMIO_MIPI(port, _MIPIA_HFP_COUNT, _MIPIC_HFP_COUNT)
  8711. #define _MIPIA_HACTIVE_AREA_COUNT (dev_priv->mipi_mmio_base + 0xb034)
  8712. #define _MIPIC_HACTIVE_AREA_COUNT (dev_priv->mipi_mmio_base + 0xb834)
  8713. #define MIPI_HACTIVE_AREA_COUNT(port) _MMIO_MIPI(port, _MIPIA_HACTIVE_AREA_COUNT, _MIPIC_HACTIVE_AREA_COUNT)
  8714. #define _MIPIA_VSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb038)
  8715. #define _MIPIC_VSYNC_PADDING_COUNT (dev_priv->mipi_mmio_base + 0xb838)
  8716. #define MIPI_VSYNC_PADDING_COUNT(port) _MMIO_MIPI(port, _MIPIA_VSYNC_PADDING_COUNT, _MIPIC_VSYNC_PADDING_COUNT)
  8717. #define _MIPIA_VBP_COUNT (dev_priv->mipi_mmio_base + 0xb03c)
  8718. #define _MIPIC_VBP_COUNT (dev_priv->mipi_mmio_base + 0xb83c)
  8719. #define MIPI_VBP_COUNT(port) _MMIO_MIPI(port, _MIPIA_VBP_COUNT, _MIPIC_VBP_COUNT)
  8720. #define _MIPIA_VFP_COUNT (dev_priv->mipi_mmio_base + 0xb040)
  8721. #define _MIPIC_VFP_COUNT (dev_priv->mipi_mmio_base + 0xb840)
  8722. #define MIPI_VFP_COUNT(port) _MMIO_MIPI(port, _MIPIA_VFP_COUNT, _MIPIC_VFP_COUNT)
  8723. #define _MIPIA_HIGH_LOW_SWITCH_COUNT (dev_priv->mipi_mmio_base + 0xb044)
  8724. #define _MIPIC_HIGH_LOW_SWITCH_COUNT (dev_priv->mipi_mmio_base + 0xb844)
  8725. #define MIPI_HIGH_LOW_SWITCH_COUNT(port) _MMIO_MIPI(port, _MIPIA_HIGH_LOW_SWITCH_COUNT, _MIPIC_HIGH_LOW_SWITCH_COUNT)
  8726. /* regs above are bits 15:0 */
  8727. #define _MIPIA_DPI_CONTROL (dev_priv->mipi_mmio_base + 0xb048)
  8728. #define _MIPIC_DPI_CONTROL (dev_priv->mipi_mmio_base + 0xb848)
  8729. #define MIPI_DPI_CONTROL(port) _MMIO_MIPI(port, _MIPIA_DPI_CONTROL, _MIPIC_DPI_CONTROL)
  8730. #define DPI_LP_MODE (1 << 6)
  8731. #define BACKLIGHT_OFF (1 << 5)
  8732. #define BACKLIGHT_ON (1 << 4)
  8733. #define COLOR_MODE_OFF (1 << 3)
  8734. #define COLOR_MODE_ON (1 << 2)
  8735. #define TURN_ON (1 << 1)
  8736. #define SHUTDOWN (1 << 0)
  8737. #define _MIPIA_DPI_DATA (dev_priv->mipi_mmio_base + 0xb04c)
  8738. #define _MIPIC_DPI_DATA (dev_priv->mipi_mmio_base + 0xb84c)
  8739. #define MIPI_DPI_DATA(port) _MMIO_MIPI(port, _MIPIA_DPI_DATA, _MIPIC_DPI_DATA)
  8740. #define COMMAND_BYTE_SHIFT 0
  8741. #define COMMAND_BYTE_MASK (0x3f << 0)
  8742. #define _MIPIA_INIT_COUNT (dev_priv->mipi_mmio_base + 0xb050)
  8743. #define _MIPIC_INIT_COUNT (dev_priv->mipi_mmio_base + 0xb850)
  8744. #define MIPI_INIT_COUNT(port) _MMIO_MIPI(port, _MIPIA_INIT_COUNT, _MIPIC_INIT_COUNT)
  8745. #define MASTER_INIT_TIMER_SHIFT 0
  8746. #define MASTER_INIT_TIMER_MASK (0xffff << 0)
  8747. #define _MIPIA_MAX_RETURN_PKT_SIZE (dev_priv->mipi_mmio_base + 0xb054)
  8748. #define _MIPIC_MAX_RETURN_PKT_SIZE (dev_priv->mipi_mmio_base + 0xb854)
  8749. #define MIPI_MAX_RETURN_PKT_SIZE(port) _MMIO_MIPI(port, \
  8750. _MIPIA_MAX_RETURN_PKT_SIZE, _MIPIC_MAX_RETURN_PKT_SIZE)
  8751. #define MAX_RETURN_PKT_SIZE_SHIFT 0
  8752. #define MAX_RETURN_PKT_SIZE_MASK (0x3ff << 0)
  8753. #define _MIPIA_VIDEO_MODE_FORMAT (dev_priv->mipi_mmio_base + 0xb058)
  8754. #define _MIPIC_VIDEO_MODE_FORMAT (dev_priv->mipi_mmio_base + 0xb858)
  8755. #define MIPI_VIDEO_MODE_FORMAT(port) _MMIO_MIPI(port, _MIPIA_VIDEO_MODE_FORMAT, _MIPIC_VIDEO_MODE_FORMAT)
  8756. #define RANDOM_DPI_DISPLAY_RESOLUTION (1 << 4)
  8757. #define DISABLE_VIDEO_BTA (1 << 3)
  8758. #define IP_TG_CONFIG (1 << 2)
  8759. #define VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE (1 << 0)
  8760. #define VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS (2 << 0)
  8761. #define VIDEO_MODE_BURST (3 << 0)
  8762. #define _MIPIA_EOT_DISABLE (dev_priv->mipi_mmio_base + 0xb05c)
  8763. #define _MIPIC_EOT_DISABLE (dev_priv->mipi_mmio_base + 0xb85c)
  8764. #define MIPI_EOT_DISABLE(port) _MMIO_MIPI(port, _MIPIA_EOT_DISABLE, _MIPIC_EOT_DISABLE)
  8765. #define BXT_DEFEATURE_DPI_FIFO_CTR (1 << 9)
  8766. #define BXT_DPHY_DEFEATURE_EN (1 << 8)
  8767. #define LP_RX_TIMEOUT_ERROR_RECOVERY_DISABLE (1 << 7)
  8768. #define HS_RX_TIMEOUT_ERROR_RECOVERY_DISABLE (1 << 6)
  8769. #define LOW_CONTENTION_RECOVERY_DISABLE (1 << 5)
  8770. #define HIGH_CONTENTION_RECOVERY_DISABLE (1 << 4)
  8771. #define TXDSI_TYPE_NOT_RECOGNISED_ERROR_RECOVERY_DISABLE (1 << 3)
  8772. #define TXECC_MULTIBIT_ERROR_RECOVERY_DISABLE (1 << 2)
  8773. #define CLOCKSTOP (1 << 1)
  8774. #define EOT_DISABLE (1 << 0)
  8775. #define _MIPIA_LP_BYTECLK (dev_priv->mipi_mmio_base + 0xb060)
  8776. #define _MIPIC_LP_BYTECLK (dev_priv->mipi_mmio_base + 0xb860)
  8777. #define MIPI_LP_BYTECLK(port) _MMIO_MIPI(port, _MIPIA_LP_BYTECLK, _MIPIC_LP_BYTECLK)
  8778. #define LP_BYTECLK_SHIFT 0
  8779. #define LP_BYTECLK_MASK (0xffff << 0)
  8780. #define _MIPIA_TLPX_TIME_COUNT (dev_priv->mipi_mmio_base + 0xb0a4)
  8781. #define _MIPIC_TLPX_TIME_COUNT (dev_priv->mipi_mmio_base + 0xb8a4)
  8782. #define MIPI_TLPX_TIME_COUNT(port) _MMIO_MIPI(port, _MIPIA_TLPX_TIME_COUNT, _MIPIC_TLPX_TIME_COUNT)
  8783. #define _MIPIA_CLK_LANE_TIMING (dev_priv->mipi_mmio_base + 0xb098)
  8784. #define _MIPIC_CLK_LANE_TIMING (dev_priv->mipi_mmio_base + 0xb898)
  8785. #define MIPI_CLK_LANE_TIMING(port) _MMIO_MIPI(port, _MIPIA_CLK_LANE_TIMING, _MIPIC_CLK_LANE_TIMING)
  8786. /* bits 31:0 */
  8787. #define _MIPIA_LP_GEN_DATA (dev_priv->mipi_mmio_base + 0xb064)
  8788. #define _MIPIC_LP_GEN_DATA (dev_priv->mipi_mmio_base + 0xb864)
  8789. #define MIPI_LP_GEN_DATA(port) _MMIO_MIPI(port, _MIPIA_LP_GEN_DATA, _MIPIC_LP_GEN_DATA)
  8790. /* bits 31:0 */
  8791. #define _MIPIA_HS_GEN_DATA (dev_priv->mipi_mmio_base + 0xb068)
  8792. #define _MIPIC_HS_GEN_DATA (dev_priv->mipi_mmio_base + 0xb868)
  8793. #define MIPI_HS_GEN_DATA(port) _MMIO_MIPI(port, _MIPIA_HS_GEN_DATA, _MIPIC_HS_GEN_DATA)
  8794. #define _MIPIA_LP_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb06c)
  8795. #define _MIPIC_LP_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb86c)
  8796. #define MIPI_LP_GEN_CTRL(port) _MMIO_MIPI(port, _MIPIA_LP_GEN_CTRL, _MIPIC_LP_GEN_CTRL)
  8797. #define _MIPIA_HS_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb070)
  8798. #define _MIPIC_HS_GEN_CTRL (dev_priv->mipi_mmio_base + 0xb870)
  8799. #define MIPI_HS_GEN_CTRL(port) _MMIO_MIPI(port, _MIPIA_HS_GEN_CTRL, _MIPIC_HS_GEN_CTRL)
  8800. #define LONG_PACKET_WORD_COUNT_SHIFT 8
  8801. #define LONG_PACKET_WORD_COUNT_MASK (0xffff << 8)
  8802. #define SHORT_PACKET_PARAM_SHIFT 8
  8803. #define SHORT_PACKET_PARAM_MASK (0xffff << 8)
  8804. #define VIRTUAL_CHANNEL_SHIFT 6
  8805. #define VIRTUAL_CHANNEL_MASK (3 << 6)
  8806. #define DATA_TYPE_SHIFT 0
  8807. #define DATA_TYPE_MASK (0x3f << 0)
  8808. /* data type values, see include/video/mipi_display.h */
  8809. #define _MIPIA_GEN_FIFO_STAT (dev_priv->mipi_mmio_base + 0xb074)
  8810. #define _MIPIC_GEN_FIFO_STAT (dev_priv->mipi_mmio_base + 0xb874)
  8811. #define MIPI_GEN_FIFO_STAT(port) _MMIO_MIPI(port, _MIPIA_GEN_FIFO_STAT, _MIPIC_GEN_FIFO_STAT)
  8812. #define DPI_FIFO_EMPTY (1 << 28)
  8813. #define DBI_FIFO_EMPTY (1 << 27)
  8814. #define LP_CTRL_FIFO_EMPTY (1 << 26)
  8815. #define LP_CTRL_FIFO_HALF_EMPTY (1 << 25)
  8816. #define LP_CTRL_FIFO_FULL (1 << 24)
  8817. #define HS_CTRL_FIFO_EMPTY (1 << 18)
  8818. #define HS_CTRL_FIFO_HALF_EMPTY (1 << 17)
  8819. #define HS_CTRL_FIFO_FULL (1 << 16)
  8820. #define LP_DATA_FIFO_EMPTY (1 << 10)
  8821. #define LP_DATA_FIFO_HALF_EMPTY (1 << 9)
  8822. #define LP_DATA_FIFO_FULL (1 << 8)
  8823. #define HS_DATA_FIFO_EMPTY (1 << 2)
  8824. #define HS_DATA_FIFO_HALF_EMPTY (1 << 1)
  8825. #define HS_DATA_FIFO_FULL (1 << 0)
  8826. #define _MIPIA_HS_LS_DBI_ENABLE (dev_priv->mipi_mmio_base + 0xb078)
  8827. #define _MIPIC_HS_LS_DBI_ENABLE (dev_priv->mipi_mmio_base + 0xb878)
  8828. #define MIPI_HS_LP_DBI_ENABLE(port) _MMIO_MIPI(port, _MIPIA_HS_LS_DBI_ENABLE, _MIPIC_HS_LS_DBI_ENABLE)
  8829. #define DBI_HS_LP_MODE_MASK (1 << 0)
  8830. #define DBI_LP_MODE (1 << 0)
  8831. #define DBI_HS_MODE (0 << 0)
  8832. #define _MIPIA_DPHY_PARAM (dev_priv->mipi_mmio_base + 0xb080)
  8833. #define _MIPIC_DPHY_PARAM (dev_priv->mipi_mmio_base + 0xb880)
  8834. #define MIPI_DPHY_PARAM(port) _MMIO_MIPI(port, _MIPIA_DPHY_PARAM, _MIPIC_DPHY_PARAM)
  8835. #define EXIT_ZERO_COUNT_SHIFT 24
  8836. #define EXIT_ZERO_COUNT_MASK (0x3f << 24)
  8837. #define TRAIL_COUNT_SHIFT 16
  8838. #define TRAIL_COUNT_MASK (0x1f << 16)
  8839. #define CLK_ZERO_COUNT_SHIFT 8
  8840. #define CLK_ZERO_COUNT_MASK (0xff << 8)
  8841. #define PREPARE_COUNT_SHIFT 0
  8842. #define PREPARE_COUNT_MASK (0x3f << 0)
  8843. /* bits 31:0 */
  8844. #define _MIPIA_DBI_BW_CTRL (dev_priv->mipi_mmio_base + 0xb084)
  8845. #define _MIPIC_DBI_BW_CTRL (dev_priv->mipi_mmio_base + 0xb884)
  8846. #define MIPI_DBI_BW_CTRL(port) _MMIO_MIPI(port, _MIPIA_DBI_BW_CTRL, _MIPIC_DBI_BW_CTRL)
  8847. #define _MIPIA_CLK_LANE_SWITCH_TIME_CNT (dev_priv->mipi_mmio_base + 0xb088)
  8848. #define _MIPIC_CLK_LANE_SWITCH_TIME_CNT (dev_priv->mipi_mmio_base + 0xb888)
  8849. #define MIPI_CLK_LANE_SWITCH_TIME_CNT(port) _MMIO_MIPI(port, _MIPIA_CLK_LANE_SWITCH_TIME_CNT, _MIPIC_CLK_LANE_SWITCH_TIME_CNT)
  8850. #define LP_HS_SSW_CNT_SHIFT 16
  8851. #define LP_HS_SSW_CNT_MASK (0xffff << 16)
  8852. #define HS_LP_PWR_SW_CNT_SHIFT 0
  8853. #define HS_LP_PWR_SW_CNT_MASK (0xffff << 0)
  8854. #define _MIPIA_STOP_STATE_STALL (dev_priv->mipi_mmio_base + 0xb08c)
  8855. #define _MIPIC_STOP_STATE_STALL (dev_priv->mipi_mmio_base + 0xb88c)
  8856. #define MIPI_STOP_STATE_STALL(port) _MMIO_MIPI(port, _MIPIA_STOP_STATE_STALL, _MIPIC_STOP_STATE_STALL)
  8857. #define STOP_STATE_STALL_COUNTER_SHIFT 0
  8858. #define STOP_STATE_STALL_COUNTER_MASK (0xff << 0)
  8859. #define _MIPIA_INTR_STAT_REG_1 (dev_priv->mipi_mmio_base + 0xb090)
  8860. #define _MIPIC_INTR_STAT_REG_1 (dev_priv->mipi_mmio_base + 0xb890)
  8861. #define MIPI_INTR_STAT_REG_1(port) _MMIO_MIPI(port, _MIPIA_INTR_STAT_REG_1, _MIPIC_INTR_STAT_REG_1)
  8862. #define _MIPIA_INTR_EN_REG_1 (dev_priv->mipi_mmio_base + 0xb094)
  8863. #define _MIPIC_INTR_EN_REG_1 (dev_priv->mipi_mmio_base + 0xb894)
  8864. #define MIPI_INTR_EN_REG_1(port) _MMIO_MIPI(port, _MIPIA_INTR_EN_REG_1, _MIPIC_INTR_EN_REG_1)
  8865. #define RX_CONTENTION_DETECTED (1 << 0)
  8866. /* XXX: only pipe A ?!? */
  8867. #define MIPIA_DBI_TYPEC_CTRL (dev_priv->mipi_mmio_base + 0xb100)
  8868. #define DBI_TYPEC_ENABLE (1 << 31)
  8869. #define DBI_TYPEC_WIP (1 << 30)
  8870. #define DBI_TYPEC_OPTION_SHIFT 28
  8871. #define DBI_TYPEC_OPTION_MASK (3 << 28)
  8872. #define DBI_TYPEC_FREQ_SHIFT 24
  8873. #define DBI_TYPEC_FREQ_MASK (0xf << 24)
  8874. #define DBI_TYPEC_OVERRIDE (1 << 8)
  8875. #define DBI_TYPEC_OVERRIDE_COUNTER_SHIFT 0
  8876. #define DBI_TYPEC_OVERRIDE_COUNTER_MASK (0xff << 0)
  8877. /* MIPI adapter registers */
  8878. #define _MIPIA_CTRL (dev_priv->mipi_mmio_base + 0xb104)
  8879. #define _MIPIC_CTRL (dev_priv->mipi_mmio_base + 0xb904)
  8880. #define MIPI_CTRL(port) _MMIO_MIPI(port, _MIPIA_CTRL, _MIPIC_CTRL)
  8881. #define ESCAPE_CLOCK_DIVIDER_SHIFT 5 /* A only */
  8882. #define ESCAPE_CLOCK_DIVIDER_MASK (3 << 5)
  8883. #define ESCAPE_CLOCK_DIVIDER_1 (0 << 5)
  8884. #define ESCAPE_CLOCK_DIVIDER_2 (1 << 5)
  8885. #define ESCAPE_CLOCK_DIVIDER_4 (2 << 5)
  8886. #define READ_REQUEST_PRIORITY_SHIFT 3
  8887. #define READ_REQUEST_PRIORITY_MASK (3 << 3)
  8888. #define READ_REQUEST_PRIORITY_LOW (0 << 3)
  8889. #define READ_REQUEST_PRIORITY_HIGH (3 << 3)
  8890. #define RGB_FLIP_TO_BGR (1 << 2)
  8891. #define BXT_PIPE_SELECT_SHIFT 7
  8892. #define BXT_PIPE_SELECT_MASK (7 << 7)
  8893. #define BXT_PIPE_SELECT(pipe) ((pipe) << 7)
  8894. #define GLK_PHY_STATUS_PORT_READY (1 << 31) /* RO */
  8895. #define GLK_ULPS_NOT_ACTIVE (1 << 30) /* RO */
  8896. #define GLK_MIPIIO_RESET_RELEASED (1 << 28)
  8897. #define GLK_CLOCK_LANE_STOP_STATE (1 << 27) /* RO */
  8898. #define GLK_DATA_LANE_STOP_STATE (1 << 26) /* RO */
  8899. #define GLK_LP_WAKE (1 << 22)
  8900. #define GLK_LP11_LOW_PWR_MODE (1 << 21)
  8901. #define GLK_LP00_LOW_PWR_MODE (1 << 20)
  8902. #define GLK_FIREWALL_ENABLE (1 << 16)
  8903. #define BXT_PIXEL_OVERLAP_CNT_MASK (0xf << 10)
  8904. #define BXT_PIXEL_OVERLAP_CNT_SHIFT 10
  8905. #define BXT_DSC_ENABLE (1 << 3)
  8906. #define BXT_RGB_FLIP (1 << 2)
  8907. #define GLK_MIPIIO_PORT_POWERED (1 << 1) /* RO */
  8908. #define GLK_MIPIIO_ENABLE (1 << 0)
  8909. #define _MIPIA_DATA_ADDRESS (dev_priv->mipi_mmio_base + 0xb108)
  8910. #define _MIPIC_DATA_ADDRESS (dev_priv->mipi_mmio_base + 0xb908)
  8911. #define MIPI_DATA_ADDRESS(port) _MMIO_MIPI(port, _MIPIA_DATA_ADDRESS, _MIPIC_DATA_ADDRESS)
  8912. #define DATA_MEM_ADDRESS_SHIFT 5
  8913. #define DATA_MEM_ADDRESS_MASK (0x7ffffff << 5)
  8914. #define DATA_VALID (1 << 0)
  8915. #define _MIPIA_DATA_LENGTH (dev_priv->mipi_mmio_base + 0xb10c)
  8916. #define _MIPIC_DATA_LENGTH (dev_priv->mipi_mmio_base + 0xb90c)
  8917. #define MIPI_DATA_LENGTH(port) _MMIO_MIPI(port, _MIPIA_DATA_LENGTH, _MIPIC_DATA_LENGTH)
  8918. #define DATA_LENGTH_SHIFT 0
  8919. #define DATA_LENGTH_MASK (0xfffff << 0)
  8920. #define _MIPIA_COMMAND_ADDRESS (dev_priv->mipi_mmio_base + 0xb110)
  8921. #define _MIPIC_COMMAND_ADDRESS (dev_priv->mipi_mmio_base + 0xb910)
  8922. #define MIPI_COMMAND_ADDRESS(port) _MMIO_MIPI(port, _MIPIA_COMMAND_ADDRESS, _MIPIC_COMMAND_ADDRESS)
  8923. #define COMMAND_MEM_ADDRESS_SHIFT 5
  8924. #define COMMAND_MEM_ADDRESS_MASK (0x7ffffff << 5)
  8925. #define AUTO_PWG_ENABLE (1 << 2)
  8926. #define MEMORY_WRITE_DATA_FROM_PIPE_RENDERING (1 << 1)
  8927. #define COMMAND_VALID (1 << 0)
  8928. #define _MIPIA_COMMAND_LENGTH (dev_priv->mipi_mmio_base + 0xb114)
  8929. #define _MIPIC_COMMAND_LENGTH (dev_priv->mipi_mmio_base + 0xb914)
  8930. #define MIPI_COMMAND_LENGTH(port) _MMIO_MIPI(port, _MIPIA_COMMAND_LENGTH, _MIPIC_COMMAND_LENGTH)
  8931. #define COMMAND_LENGTH_SHIFT(n) (8 * (n)) /* n: 0...3 */
  8932. #define COMMAND_LENGTH_MASK(n) (0xff << (8 * (n)))
  8933. #define _MIPIA_READ_DATA_RETURN0 (dev_priv->mipi_mmio_base + 0xb118)
  8934. #define _MIPIC_READ_DATA_RETURN0 (dev_priv->mipi_mmio_base + 0xb918)
  8935. #define MIPI_READ_DATA_RETURN(port, n) _MMIO(_MIPI(port, _MIPIA_READ_DATA_RETURN0, _MIPIC_READ_DATA_RETURN0) + 4 * (n)) /* n: 0...7 */
  8936. #define _MIPIA_READ_DATA_VALID (dev_priv->mipi_mmio_base + 0xb138)
  8937. #define _MIPIC_READ_DATA_VALID (dev_priv->mipi_mmio_base + 0xb938)
  8938. #define MIPI_READ_DATA_VALID(port) _MMIO_MIPI(port, _MIPIA_READ_DATA_VALID, _MIPIC_READ_DATA_VALID)
  8939. #define READ_DATA_VALID(n) (1 << (n))
  8940. /* For UMS only (deprecated): */
  8941. #define _PALETTE_A (dev_priv->info.display_mmio_offset + 0xa000)
  8942. #define _PALETTE_B (dev_priv->info.display_mmio_offset + 0xa800)
  8943. /* MOCS (Memory Object Control State) registers */
  8944. #define GEN9_LNCFCMOCS(i) _MMIO(0xb020 + (i) * 4) /* L3 Cache Control */
  8945. #define GEN9_GFX_MOCS(i) _MMIO(0xc800 + (i) * 4) /* Graphics MOCS registers */
  8946. #define GEN9_MFX0_MOCS(i) _MMIO(0xc900 + (i) * 4) /* Media 0 MOCS registers */
  8947. #define GEN9_MFX1_MOCS(i) _MMIO(0xca00 + (i) * 4) /* Media 1 MOCS registers */
  8948. #define GEN9_VEBOX_MOCS(i) _MMIO(0xcb00 + (i) * 4) /* Video MOCS registers */
  8949. #define GEN9_BLT_MOCS(i) _MMIO(0xcc00 + (i) * 4) /* Blitter MOCS registers */
  8950. /* Media decoder 2 MOCS registers */
  8951. #define GEN11_MFX2_MOCS(i) _MMIO(0x10000 + (i) * 4)
  8952. #define GEN10_SCRATCH_LNCF2 _MMIO(0xb0a0)
  8953. #define PMFLUSHDONE_LNICRSDROP (1 << 20)
  8954. #define PMFLUSH_GAPL3UNBLOCK (1 << 21)
  8955. #define PMFLUSHDONE_LNEBLK (1 << 22)
  8956. /* gamt regs */
  8957. #define GEN8_L3_LRA_1_GPGPU _MMIO(0x4dd4)
  8958. #define GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW 0x67F1427F /* max/min for LRA1/2 */
  8959. #define GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV 0x5FF101FF /* max/min for LRA1/2 */
  8960. #define GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL 0x67F1427F /* " " */
  8961. #define GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_BXT 0x5FF101FF /* " " */
  8962. #define MMCD_MISC_CTRL _MMIO(0x4ddc) /* skl+ */
  8963. #define MMCD_PCLA (1 << 31)
  8964. #define MMCD_HOTSPOT_EN (1 << 27)
  8965. #define _ICL_PHY_MISC_A 0x64C00
  8966. #define _ICL_PHY_MISC_B 0x64C04
  8967. #define ICL_PHY_MISC(port) _MMIO_PORT(port, _ICL_PHY_MISC_A, \
  8968. _ICL_PHY_MISC_B)
  8969. #define ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN (1 << 23)
  8970. #endif /* _I915_REG_H_ */