i915_reg.h 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945
  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. * The Bridge device's PCI config space has information about the
  28. * fb aperture size and the amount of pre-reserved memory.
  29. */
  30. #define INTEL_GMCH_CTRL 0x52
  31. #define INTEL_GMCH_VGA_DISABLE (1 << 1)
  32. #define INTEL_GMCH_ENABLED 0x4
  33. #define INTEL_GMCH_MEM_MASK 0x1
  34. #define INTEL_GMCH_MEM_64M 0x1
  35. #define INTEL_GMCH_MEM_128M 0
  36. #define INTEL_GMCH_GMS_MASK (0xf << 4)
  37. #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
  38. #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4)
  39. #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4)
  40. #define INTEL_855_GMCH_GMS_STOLEN_8M (0x3 << 4)
  41. #define INTEL_855_GMCH_GMS_STOLEN_16M (0x4 << 4)
  42. #define INTEL_855_GMCH_GMS_STOLEN_32M (0x5 << 4)
  43. #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
  44. #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
  45. #define INTEL_GMCH_GMS_STOLEN_128M (0x8 << 4)
  46. #define INTEL_GMCH_GMS_STOLEN_256M (0x9 << 4)
  47. #define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4)
  48. #define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4)
  49. #define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
  50. #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
  51. #define SNB_GMCH_CTRL 0x50
  52. #define SNB_GMCH_GMS_STOLEN_MASK 0xF8
  53. #define SNB_GMCH_GMS_STOLEN_32M (1 << 3)
  54. #define SNB_GMCH_GMS_STOLEN_64M (2 << 3)
  55. #define SNB_GMCH_GMS_STOLEN_96M (3 << 3)
  56. #define SNB_GMCH_GMS_STOLEN_128M (4 << 3)
  57. #define SNB_GMCH_GMS_STOLEN_160M (5 << 3)
  58. #define SNB_GMCH_GMS_STOLEN_192M (6 << 3)
  59. #define SNB_GMCH_GMS_STOLEN_224M (7 << 3)
  60. #define SNB_GMCH_GMS_STOLEN_256M (8 << 3)
  61. #define SNB_GMCH_GMS_STOLEN_288M (9 << 3)
  62. #define SNB_GMCH_GMS_STOLEN_320M (0xa << 3)
  63. #define SNB_GMCH_GMS_STOLEN_352M (0xb << 3)
  64. #define SNB_GMCH_GMS_STOLEN_384M (0xc << 3)
  65. #define SNB_GMCH_GMS_STOLEN_416M (0xd << 3)
  66. #define SNB_GMCH_GMS_STOLEN_448M (0xe << 3)
  67. #define SNB_GMCH_GMS_STOLEN_480M (0xf << 3)
  68. #define SNB_GMCH_GMS_STOLEN_512M (0x10 << 3)
  69. /* PCI config space */
  70. #define HPLLCC 0xc0 /* 855 only */
  71. #define GC_CLOCK_CONTROL_MASK (0xf << 0)
  72. #define GC_CLOCK_133_200 (0 << 0)
  73. #define GC_CLOCK_100_200 (1 << 0)
  74. #define GC_CLOCK_100_133 (2 << 0)
  75. #define GC_CLOCK_166_250 (3 << 0)
  76. #define GCFGC2 0xda
  77. #define GCFGC 0xf0 /* 915+ only */
  78. #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
  79. #define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
  80. #define GC_DISPLAY_CLOCK_333_MHZ (4 << 4)
  81. #define GC_DISPLAY_CLOCK_MASK (7 << 4)
  82. #define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
  83. #define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)
  84. #define GM45_GC_RENDER_CLOCK_320_MHZ (9 << 0)
  85. #define GM45_GC_RENDER_CLOCK_400_MHZ (0xb << 0)
  86. #define GM45_GC_RENDER_CLOCK_533_MHZ (0xc << 0)
  87. #define I965_GC_RENDER_CLOCK_MASK (0xf << 0)
  88. #define I965_GC_RENDER_CLOCK_267_MHZ (2 << 0)
  89. #define I965_GC_RENDER_CLOCK_333_MHZ (3 << 0)
  90. #define I965_GC_RENDER_CLOCK_444_MHZ (4 << 0)
  91. #define I965_GC_RENDER_CLOCK_533_MHZ (5 << 0)
  92. #define I945_GC_RENDER_CLOCK_MASK (7 << 0)
  93. #define I945_GC_RENDER_CLOCK_166_MHZ (0 << 0)
  94. #define I945_GC_RENDER_CLOCK_200_MHZ (1 << 0)
  95. #define I945_GC_RENDER_CLOCK_250_MHZ (3 << 0)
  96. #define I945_GC_RENDER_CLOCK_400_MHZ (5 << 0)
  97. #define I915_GC_RENDER_CLOCK_MASK (7 << 0)
  98. #define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
  99. #define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
  100. #define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
  101. #define LBB 0xf4
  102. #define GDRST 0xc0
  103. #define GDRST_FULL (0<<2)
  104. #define GDRST_RENDER (1<<2)
  105. #define GDRST_MEDIA (3<<2)
  106. /* VGA stuff */
  107. #define VGA_ST01_MDA 0x3ba
  108. #define VGA_ST01_CGA 0x3da
  109. #define VGA_MSR_WRITE 0x3c2
  110. #define VGA_MSR_READ 0x3cc
  111. #define VGA_MSR_MEM_EN (1<<1)
  112. #define VGA_MSR_CGA_MODE (1<<0)
  113. #define VGA_SR_INDEX 0x3c4
  114. #define VGA_SR_DATA 0x3c5
  115. #define VGA_AR_INDEX 0x3c0
  116. #define VGA_AR_VID_EN (1<<5)
  117. #define VGA_AR_DATA_WRITE 0x3c0
  118. #define VGA_AR_DATA_READ 0x3c1
  119. #define VGA_GR_INDEX 0x3ce
  120. #define VGA_GR_DATA 0x3cf
  121. /* GR05 */
  122. #define VGA_GR_MEM_READ_MODE_SHIFT 3
  123. #define VGA_GR_MEM_READ_MODE_PLANE 1
  124. /* GR06 */
  125. #define VGA_GR_MEM_MODE_MASK 0xc
  126. #define VGA_GR_MEM_MODE_SHIFT 2
  127. #define VGA_GR_MEM_A0000_AFFFF 0
  128. #define VGA_GR_MEM_A0000_BFFFF 1
  129. #define VGA_GR_MEM_B0000_B7FFF 2
  130. #define VGA_GR_MEM_B0000_BFFFF 3
  131. #define VGA_DACMASK 0x3c6
  132. #define VGA_DACRX 0x3c7
  133. #define VGA_DACWX 0x3c8
  134. #define VGA_DACDATA 0x3c9
  135. #define VGA_CR_INDEX_MDA 0x3b4
  136. #define VGA_CR_DATA_MDA 0x3b5
  137. #define VGA_CR_INDEX_CGA 0x3d4
  138. #define VGA_CR_DATA_CGA 0x3d5
  139. /*
  140. * Memory interface instructions used by the kernel
  141. */
  142. #define MI_INSTR(opcode, flags) (((opcode) << 23) | (flags))
  143. #define MI_NOOP MI_INSTR(0, 0)
  144. #define MI_USER_INTERRUPT MI_INSTR(0x02, 0)
  145. #define MI_WAIT_FOR_EVENT MI_INSTR(0x03, 0)
  146. #define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
  147. #define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
  148. #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
  149. #define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
  150. #define MI_FLUSH MI_INSTR(0x04, 0)
  151. #define MI_READ_FLUSH (1 << 0)
  152. #define MI_EXE_FLUSH (1 << 1)
  153. #define MI_NO_WRITE_FLUSH (1 << 2)
  154. #define MI_SCENE_COUNT (1 << 3) /* just increment scene count */
  155. #define MI_END_SCENE (1 << 4) /* flush binner and incr scene count */
  156. #define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)
  157. #define MI_REPORT_HEAD MI_INSTR(0x07, 0)
  158. #define MI_OVERLAY_FLIP MI_INSTR(0x11,0)
  159. #define MI_OVERLAY_CONTINUE (0x0<<21)
  160. #define MI_OVERLAY_ON (0x1<<21)
  161. #define MI_OVERLAY_OFF (0x2<<21)
  162. #define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0)
  163. #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2)
  164. #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1)
  165. #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20)
  166. #define MI_STORE_DWORD_IMM MI_INSTR(0x20, 1)
  167. #define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */
  168. #define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
  169. #define MI_STORE_DWORD_INDEX_SHIFT 2
  170. #define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 1)
  171. #define MI_BATCH_BUFFER MI_INSTR(0x30, 1)
  172. #define MI_BATCH_NON_SECURE (1)
  173. #define MI_BATCH_NON_SECURE_I965 (1<<8)
  174. #define MI_BATCH_BUFFER_START MI_INSTR(0x31, 0)
  175. /*
  176. * 3D instructions used by the kernel
  177. */
  178. #define GFX_INSTR(opcode, flags) ((0x3 << 29) | ((opcode) << 24) | (flags))
  179. #define GFX_OP_RASTER_RULES ((0x3<<29)|(0x7<<24))
  180. #define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
  181. #define SC_UPDATE_SCISSOR (0x1<<1)
  182. #define SC_ENABLE_MASK (0x1<<0)
  183. #define SC_ENABLE (0x1<<0)
  184. #define GFX_OP_LOAD_INDIRECT ((0x3<<29)|(0x1d<<24)|(0x7<<16))
  185. #define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
  186. #define SCI_YMIN_MASK (0xffff<<16)
  187. #define SCI_XMIN_MASK (0xffff<<0)
  188. #define SCI_YMAX_MASK (0xffff<<16)
  189. #define SCI_XMAX_MASK (0xffff<<0)
  190. #define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19))
  191. #define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
  192. #define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
  193. #define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
  194. #define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4)
  195. #define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
  196. #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1)
  197. #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
  198. #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2)
  199. #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4)
  200. #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
  201. #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5)
  202. #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
  203. #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
  204. #define BLT_DEPTH_8 (0<<24)
  205. #define BLT_DEPTH_16_565 (1<<24)
  206. #define BLT_DEPTH_16_1555 (2<<24)
  207. #define BLT_DEPTH_32 (3<<24)
  208. #define BLT_ROP_GXCOPY (0xcc<<16)
  209. #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */
  210. #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */
  211. #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
  212. #define ASYNC_FLIP (1<<22)
  213. #define DISPLAY_PLANE_A (0<<20)
  214. #define DISPLAY_PLANE_B (1<<20)
  215. #define GFX_OP_PIPE_CONTROL ((0x3<<29)|(0x3<<27)|(0x2<<24)|2)
  216. #define PIPE_CONTROL_QW_WRITE (1<<14)
  217. #define PIPE_CONTROL_DEPTH_STALL (1<<13)
  218. #define PIPE_CONTROL_WC_FLUSH (1<<12)
  219. #define PIPE_CONTROL_IS_FLUSH (1<<11) /* MBZ on Ironlake */
  220. #define PIPE_CONTROL_TC_FLUSH (1<<10) /* GM45+ only */
  221. #define PIPE_CONTROL_ISP_DIS (1<<9)
  222. #define PIPE_CONTROL_NOTIFY (1<<8)
  223. #define PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
  224. #define PIPE_CONTROL_STALL_EN (1<<1) /* in addr word, Ironlake+ only */
  225. /*
  226. * Fence registers
  227. */
  228. #define FENCE_REG_830_0 0x2000
  229. #define FENCE_REG_945_8 0x3000
  230. #define I830_FENCE_START_MASK 0x07f80000
  231. #define I830_FENCE_TILING_Y_SHIFT 12
  232. #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
  233. #define I830_FENCE_PITCH_SHIFT 4
  234. #define I830_FENCE_REG_VALID (1<<0)
  235. #define I915_FENCE_MAX_PITCH_VAL 4
  236. #define I830_FENCE_MAX_PITCH_VAL 6
  237. #define I830_FENCE_MAX_SIZE_VAL (1<<8)
  238. #define I915_FENCE_START_MASK 0x0ff00000
  239. #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
  240. #define FENCE_REG_965_0 0x03000
  241. #define I965_FENCE_PITCH_SHIFT 2
  242. #define I965_FENCE_TILING_Y_SHIFT 1
  243. #define I965_FENCE_REG_VALID (1<<0)
  244. #define I965_FENCE_MAX_PITCH_VAL 0x0400
  245. #define FENCE_REG_SANDYBRIDGE_0 0x100000
  246. #define SANDYBRIDGE_FENCE_PITCH_SHIFT 32
  247. /*
  248. * Instruction and interrupt control regs
  249. */
  250. #define PGTBL_ER 0x02024
  251. #define PRB0_TAIL 0x02030
  252. #define PRB0_HEAD 0x02034
  253. #define PRB0_START 0x02038
  254. #define PRB0_CTL 0x0203c
  255. #define TAIL_ADDR 0x001FFFF8
  256. #define HEAD_WRAP_COUNT 0xFFE00000
  257. #define HEAD_WRAP_ONE 0x00200000
  258. #define HEAD_ADDR 0x001FFFFC
  259. #define RING_NR_PAGES 0x001FF000
  260. #define RING_REPORT_MASK 0x00000006
  261. #define RING_REPORT_64K 0x00000002
  262. #define RING_REPORT_128K 0x00000004
  263. #define RING_NO_REPORT 0x00000000
  264. #define RING_VALID_MASK 0x00000001
  265. #define RING_VALID 0x00000001
  266. #define RING_INVALID 0x00000000
  267. #define PRB1_TAIL 0x02040 /* 915+ only */
  268. #define PRB1_HEAD 0x02044 /* 915+ only */
  269. #define PRB1_START 0x02048 /* 915+ only */
  270. #define PRB1_CTL 0x0204c /* 915+ only */
  271. #define IPEIR_I965 0x02064
  272. #define IPEHR_I965 0x02068
  273. #define INSTDONE_I965 0x0206c
  274. #define INSTPS 0x02070 /* 965+ only */
  275. #define INSTDONE1 0x0207c /* 965+ only */
  276. #define ACTHD_I965 0x02074
  277. #define HWS_PGA 0x02080
  278. #define HWS_PGA_GEN6 0x04080
  279. #define HWS_ADDRESS_MASK 0xfffff000
  280. #define HWS_START_ADDRESS_SHIFT 4
  281. #define PWRCTXA 0x2088 /* 965GM+ only */
  282. #define PWRCTX_EN (1<<0)
  283. #define IPEIR 0x02088
  284. #define IPEHR 0x0208c
  285. #define INSTDONE 0x02090
  286. #define NOPID 0x02094
  287. #define HWSTAM 0x02098
  288. #define MI_MODE 0x0209c
  289. # define VS_TIMER_DISPATCH (1 << 6)
  290. #define SCPD0 0x0209c /* 915+ only */
  291. #define IER 0x020a0
  292. #define IIR 0x020a4
  293. #define IMR 0x020a8
  294. #define ISR 0x020ac
  295. #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18)
  296. #define I915_DISPLAY_PORT_INTERRUPT (1<<17)
  297. #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15)
  298. #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14) /* p-state */
  299. #define I915_HWB_OOM_INTERRUPT (1<<13)
  300. #define I915_SYNC_STATUS_INTERRUPT (1<<12)
  301. #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
  302. #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
  303. #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9)
  304. #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
  305. #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7)
  306. #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
  307. #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
  308. #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
  309. #define I915_DEBUG_INTERRUPT (1<<2)
  310. #define I915_USER_INTERRUPT (1<<1)
  311. #define I915_ASLE_INTERRUPT (1<<0)
  312. #define I915_BSD_USER_INTERRUPT (1<<25)
  313. #define EIR 0x020b0
  314. #define EMR 0x020b4
  315. #define ESR 0x020b8
  316. #define GM45_ERROR_PAGE_TABLE (1<<5)
  317. #define GM45_ERROR_MEM_PRIV (1<<4)
  318. #define I915_ERROR_PAGE_TABLE (1<<4)
  319. #define GM45_ERROR_CP_PRIV (1<<3)
  320. #define I915_ERROR_MEMORY_REFRESH (1<<1)
  321. #define I915_ERROR_INSTRUCTION (1<<0)
  322. #define INSTPM 0x020c0
  323. #define INSTPM_SELF_EN (1<<12) /* 915GM only */
  324. #define ACTHD 0x020c8
  325. #define FW_BLC 0x020d8
  326. #define FW_BLC2 0x020dc
  327. #define FW_BLC_SELF 0x020e0 /* 915+ only */
  328. #define FW_BLC_SELF_EN_MASK (1<<31)
  329. #define FW_BLC_SELF_FIFO_MASK (1<<16) /* 945 only */
  330. #define FW_BLC_SELF_EN (1<<15) /* 945 only */
  331. #define MM_BURST_LENGTH 0x00700000
  332. #define MM_FIFO_WATERMARK 0x0001F000
  333. #define LM_BURST_LENGTH 0x00000700
  334. #define LM_FIFO_WATERMARK 0x0000001F
  335. #define MI_ARB_STATE 0x020e4 /* 915+ only */
  336. #define MI_ARB_MASK_SHIFT 16 /* shift for enable bits */
  337. /* Make render/texture TLB fetches lower priorty than associated data
  338. * fetches. This is not turned on by default
  339. */
  340. #define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15)
  341. /* Isoch request wait on GTT enable (Display A/B/C streams).
  342. * Make isoch requests stall on the TLB update. May cause
  343. * display underruns (test mode only)
  344. */
  345. #define MI_ARB_ISOCH_WAIT_GTT (1 << 14)
  346. /* Block grant count for isoch requests when block count is
  347. * set to a finite value.
  348. */
  349. #define MI_ARB_BLOCK_GRANT_MASK (3 << 12)
  350. #define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */
  351. #define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */
  352. #define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */
  353. #define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */
  354. /* Enable render writes to complete in C2/C3/C4 power states.
  355. * If this isn't enabled, render writes are prevented in low
  356. * power states. That seems bad to me.
  357. */
  358. #define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11)
  359. /* This acknowledges an async flip immediately instead
  360. * of waiting for 2TLB fetches.
  361. */
  362. #define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10)
  363. /* Enables non-sequential data reads through arbiter
  364. */
  365. #define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9)
  366. /* Disable FSB snooping of cacheable write cycles from binner/render
  367. * command stream
  368. */
  369. #define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8)
  370. /* Arbiter time slice for non-isoch streams */
  371. #define MI_ARB_TIME_SLICE_MASK (7 << 5)
  372. #define MI_ARB_TIME_SLICE_1 (0 << 5)
  373. #define MI_ARB_TIME_SLICE_2 (1 << 5)
  374. #define MI_ARB_TIME_SLICE_4 (2 << 5)
  375. #define MI_ARB_TIME_SLICE_6 (3 << 5)
  376. #define MI_ARB_TIME_SLICE_8 (4 << 5)
  377. #define MI_ARB_TIME_SLICE_10 (5 << 5)
  378. #define MI_ARB_TIME_SLICE_14 (6 << 5)
  379. #define MI_ARB_TIME_SLICE_16 (7 << 5)
  380. /* Low priority grace period page size */
  381. #define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */
  382. #define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4)
  383. /* Disable display A/B trickle feed */
  384. #define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2)
  385. /* Set display plane priority */
  386. #define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
  387. #define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
  388. #define CACHE_MODE_0 0x02120 /* 915+ only */
  389. #define CM0_MASK_SHIFT 16
  390. #define CM0_IZ_OPT_DISABLE (1<<6)
  391. #define CM0_ZR_OPT_DISABLE (1<<5)
  392. #define CM0_DEPTH_EVICT_DISABLE (1<<4)
  393. #define CM0_COLOR_EVICT_DISABLE (1<<3)
  394. #define CM0_DEPTH_WRITE_DISABLE (1<<1)
  395. #define CM0_RC_OP_FLUSH_DISABLE (1<<0)
  396. #define BB_ADDR 0x02140 /* 8 bytes */
  397. #define GFX_FLSH_CNTL 0x02170 /* 915+ only */
  398. #define ECOSKPD 0x021d0
  399. #define ECO_GATING_CX_ONLY (1<<3)
  400. #define ECO_FLIP_DONE (1<<0)
  401. /* GEN6 interrupt control */
  402. #define GEN6_RENDER_HWSTAM 0x2098
  403. #define GEN6_RENDER_IMR 0x20a8
  404. #define GEN6_RENDER_CONTEXT_SWITCH_INTERRUPT (1 << 8)
  405. #define GEN6_RENDER_PPGTT_PAGE_FAULT (1 << 7)
  406. #define GEN6_RENDER TIMEOUT_COUNTER_EXPIRED (1 << 6)
  407. #define GEN6_RENDER_L3_PARITY_ERROR (1 << 5)
  408. #define GEN6_RENDER_PIPE_CONTROL_NOTIFY_INTERRUPT (1 << 4)
  409. #define GEN6_RENDER_COMMAND_PARSER_MASTER_ERROR (1 << 3)
  410. #define GEN6_RENDER_SYNC_STATUS (1 << 2)
  411. #define GEN6_RENDER_DEBUG_INTERRUPT (1 << 1)
  412. #define GEN6_RENDER_USER_INTERRUPT (1 << 0)
  413. #define GEN6_BLITTER_HWSTAM 0x22098
  414. #define GEN6_BLITTER_IMR 0x220a8
  415. #define GEN6_BLITTER_MI_FLUSH_DW_NOTIFY_INTERRUPT (1 << 26)
  416. #define GEN6_BLITTER_COMMAND_PARSER_MASTER_ERROR (1 << 25)
  417. #define GEN6_BLITTER_SYNC_STATUS (1 << 24)
  418. #define GEN6_BLITTER_USER_INTERRUPT (1 << 22)
  419. /*
  420. * BSD (bit stream decoder instruction and interrupt control register defines
  421. * (G4X and Ironlake only)
  422. */
  423. #define BSD_RING_TAIL 0x04030
  424. #define BSD_RING_HEAD 0x04034
  425. #define BSD_RING_START 0x04038
  426. #define BSD_RING_CTL 0x0403c
  427. #define BSD_RING_ACTHD 0x04074
  428. #define BSD_HWS_PGA 0x04080
  429. /*
  430. * Framebuffer compression (915+ only)
  431. */
  432. #define FBC_CFB_BASE 0x03200 /* 4k page aligned */
  433. #define FBC_LL_BASE 0x03204 /* 4k page aligned */
  434. #define FBC_CONTROL 0x03208
  435. #define FBC_CTL_EN (1<<31)
  436. #define FBC_CTL_PERIODIC (1<<30)
  437. #define FBC_CTL_INTERVAL_SHIFT (16)
  438. #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
  439. #define FBC_CTL_C3_IDLE (1<<13)
  440. #define FBC_CTL_STRIDE_SHIFT (5)
  441. #define FBC_CTL_FENCENO (1<<0)
  442. #define FBC_COMMAND 0x0320c
  443. #define FBC_CMD_COMPRESS (1<<0)
  444. #define FBC_STATUS 0x03210
  445. #define FBC_STAT_COMPRESSING (1<<31)
  446. #define FBC_STAT_COMPRESSED (1<<30)
  447. #define FBC_STAT_MODIFIED (1<<29)
  448. #define FBC_STAT_CURRENT_LINE (1<<0)
  449. #define FBC_CONTROL2 0x03214
  450. #define FBC_CTL_FENCE_DBL (0<<4)
  451. #define FBC_CTL_IDLE_IMM (0<<2)
  452. #define FBC_CTL_IDLE_FULL (1<<2)
  453. #define FBC_CTL_IDLE_LINE (2<<2)
  454. #define FBC_CTL_IDLE_DEBUG (3<<2)
  455. #define FBC_CTL_CPU_FENCE (1<<1)
  456. #define FBC_CTL_PLANEA (0<<0)
  457. #define FBC_CTL_PLANEB (1<<0)
  458. #define FBC_FENCE_OFF 0x0321b
  459. #define FBC_TAG 0x03300
  460. #define FBC_LL_SIZE (1536)
  461. /* Framebuffer compression for GM45+ */
  462. #define DPFC_CB_BASE 0x3200
  463. #define DPFC_CONTROL 0x3208
  464. #define DPFC_CTL_EN (1<<31)
  465. #define DPFC_CTL_PLANEA (0<<30)
  466. #define DPFC_CTL_PLANEB (1<<30)
  467. #define DPFC_CTL_FENCE_EN (1<<29)
  468. #define DPFC_SR_EN (1<<10)
  469. #define DPFC_CTL_LIMIT_1X (0<<6)
  470. #define DPFC_CTL_LIMIT_2X (1<<6)
  471. #define DPFC_CTL_LIMIT_4X (2<<6)
  472. #define DPFC_RECOMP_CTL 0x320c
  473. #define DPFC_RECOMP_STALL_EN (1<<27)
  474. #define DPFC_RECOMP_STALL_WM_SHIFT (16)
  475. #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
  476. #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
  477. #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
  478. #define DPFC_STATUS 0x3210
  479. #define DPFC_INVAL_SEG_SHIFT (16)
  480. #define DPFC_INVAL_SEG_MASK (0x07ff0000)
  481. #define DPFC_COMP_SEG_SHIFT (0)
  482. #define DPFC_COMP_SEG_MASK (0x000003ff)
  483. #define DPFC_STATUS2 0x3214
  484. #define DPFC_FENCE_YOFF 0x3218
  485. #define DPFC_CHICKEN 0x3224
  486. #define DPFC_HT_MODIFY (1<<31)
  487. /*
  488. * GPIO regs
  489. */
  490. #define GPIOA 0x5010
  491. #define GPIOB 0x5014
  492. #define GPIOC 0x5018
  493. #define GPIOD 0x501c
  494. #define GPIOE 0x5020
  495. #define GPIOF 0x5024
  496. #define GPIOG 0x5028
  497. #define GPIOH 0x502c
  498. # define GPIO_CLOCK_DIR_MASK (1 << 0)
  499. # define GPIO_CLOCK_DIR_IN (0 << 1)
  500. # define GPIO_CLOCK_DIR_OUT (1 << 1)
  501. # define GPIO_CLOCK_VAL_MASK (1 << 2)
  502. # define GPIO_CLOCK_VAL_OUT (1 << 3)
  503. # define GPIO_CLOCK_VAL_IN (1 << 4)
  504. # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
  505. # define GPIO_DATA_DIR_MASK (1 << 8)
  506. # define GPIO_DATA_DIR_IN (0 << 9)
  507. # define GPIO_DATA_DIR_OUT (1 << 9)
  508. # define GPIO_DATA_VAL_MASK (1 << 10)
  509. # define GPIO_DATA_VAL_OUT (1 << 11)
  510. # define GPIO_DATA_VAL_IN (1 << 12)
  511. # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
  512. #define GMBUS0 0x5100
  513. #define GMBUS1 0x5104
  514. #define GMBUS2 0x5108
  515. #define GMBUS3 0x510c
  516. #define GMBUS4 0x5110
  517. #define GMBUS5 0x5120
  518. /*
  519. * Clock control & power management
  520. */
  521. #define VGA0 0x6000
  522. #define VGA1 0x6004
  523. #define VGA_PD 0x6010
  524. #define VGA0_PD_P2_DIV_4 (1 << 7)
  525. #define VGA0_PD_P1_DIV_2 (1 << 5)
  526. #define VGA0_PD_P1_SHIFT 0
  527. #define VGA0_PD_P1_MASK (0x1f << 0)
  528. #define VGA1_PD_P2_DIV_4 (1 << 15)
  529. #define VGA1_PD_P1_DIV_2 (1 << 13)
  530. #define VGA1_PD_P1_SHIFT 8
  531. #define VGA1_PD_P1_MASK (0x1f << 8)
  532. #define DPLL_A 0x06014
  533. #define DPLL_B 0x06018
  534. #define DPLL_VCO_ENABLE (1 << 31)
  535. #define DPLL_DVO_HIGH_SPEED (1 << 30)
  536. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  537. #define DPLL_VGA_MODE_DIS (1 << 28)
  538. #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
  539. #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
  540. #define DPLL_MODE_MASK (3 << 26)
  541. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
  542. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
  543. #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
  544. #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
  545. #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
  546. #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
  547. #define DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW 0x00ff8000 /* Pineview */
  548. #define I915_FIFO_UNDERRUN_STATUS (1UL<<31)
  549. #define I915_CRC_ERROR_ENABLE (1UL<<29)
  550. #define I915_CRC_DONE_ENABLE (1UL<<28)
  551. #define I915_GMBUS_EVENT_ENABLE (1UL<<27)
  552. #define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25)
  553. #define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
  554. #define I915_DPST_EVENT_ENABLE (1UL<<23)
  555. #define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
  556. #define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
  557. #define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
  558. #define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
  559. #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
  560. #define I915_OVERLAY_UPDATED_ENABLE (1UL<<16)
  561. #define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
  562. #define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
  563. #define I915_GMBUS_INTERRUPT_STATUS (1UL<<11)
  564. #define I915_VSYNC_INTERRUPT_STATUS (1UL<<9)
  565. #define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
  566. #define I915_DPST_EVENT_STATUS (1UL<<7)
  567. #define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6)
  568. #define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
  569. #define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
  570. #define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
  571. #define I915_VBLANK_INTERRUPT_STATUS (1UL<<1)
  572. #define I915_OVERLAY_UPDATED_STATUS (1UL<<0)
  573. #define SRX_INDEX 0x3c4
  574. #define SRX_DATA 0x3c5
  575. #define SR01 1
  576. #define SR01_SCREEN_OFF (1<<5)
  577. #define PPCR 0x61204
  578. #define PPCR_ON (1<<0)
  579. #define DVOB 0x61140
  580. #define DVOB_ON (1<<31)
  581. #define DVOC 0x61160
  582. #define DVOC_ON (1<<31)
  583. #define LVDS 0x61180
  584. #define LVDS_ON (1<<31)
  585. #define ADPA 0x61100
  586. #define ADPA_DPMS_MASK (~(3<<10))
  587. #define ADPA_DPMS_ON (0<<10)
  588. #define ADPA_DPMS_SUSPEND (1<<10)
  589. #define ADPA_DPMS_STANDBY (2<<10)
  590. #define ADPA_DPMS_OFF (3<<10)
  591. #define RING_TAIL 0x00
  592. #define TAIL_ADDR 0x001FFFF8
  593. #define RING_HEAD 0x04
  594. #define HEAD_WRAP_COUNT 0xFFE00000
  595. #define HEAD_WRAP_ONE 0x00200000
  596. #define HEAD_ADDR 0x001FFFFC
  597. #define RING_START 0x08
  598. #define START_ADDR 0xFFFFF000
  599. #define RING_LEN 0x0C
  600. #define RING_NR_PAGES 0x001FF000
  601. #define RING_REPORT_MASK 0x00000006
  602. #define RING_REPORT_64K 0x00000002
  603. #define RING_REPORT_128K 0x00000004
  604. #define RING_NO_REPORT 0x00000000
  605. #define RING_VALID_MASK 0x00000001
  606. #define RING_VALID 0x00000001
  607. #define RING_INVALID 0x00000000
  608. /* Scratch pad debug 0 reg:
  609. */
  610. #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
  611. /*
  612. * The i830 generation, in LVDS mode, defines P1 as the bit number set within
  613. * this field (only one bit may be set).
  614. */
  615. #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
  616. #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
  617. #define DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW 15
  618. /* i830, required in DVO non-gang */
  619. #define PLL_P2_DIVIDE_BY_4 (1 << 23)
  620. #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
  621. #define PLL_REF_INPUT_DREFCLK (0 << 13)
  622. #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
  623. #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
  624. #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
  625. #define PLL_REF_INPUT_MASK (3 << 13)
  626. #define PLL_LOAD_PULSE_PHASE_SHIFT 9
  627. /* Ironlake */
  628. # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
  629. # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
  630. # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1) << 9)
  631. # define DPLL_FPA1_P1_POST_DIV_SHIFT 0
  632. # define DPLL_FPA1_P1_POST_DIV_MASK 0xff
  633. /*
  634. * Parallel to Serial Load Pulse phase selection.
  635. * Selects the phase for the 10X DPLL clock for the PCIe
  636. * digital display port. The range is 4 to 13; 10 or more
  637. * is just a flip delay. The default is 6
  638. */
  639. #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
  640. #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
  641. /*
  642. * SDVO multiplier for 945G/GM. Not used on 965.
  643. */
  644. #define SDVO_MULTIPLIER_MASK 0x000000ff
  645. #define SDVO_MULTIPLIER_SHIFT_HIRES 4
  646. #define SDVO_MULTIPLIER_SHIFT_VGA 0
  647. #define DPLL_A_MD 0x0601c /* 965+ only */
  648. /*
  649. * UDI pixel divider, controlling how many pixels are stuffed into a packet.
  650. *
  651. * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
  652. */
  653. #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
  654. #define DPLL_MD_UDI_DIVIDER_SHIFT 24
  655. /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
  656. #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
  657. #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
  658. /*
  659. * SDVO/UDI pixel multiplier.
  660. *
  661. * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
  662. * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
  663. * modes, the bus rate would be below the limits, so SDVO allows for stuffing
  664. * dummy bytes in the datastream at an increased clock rate, with both sides of
  665. * the link knowing how many bytes are fill.
  666. *
  667. * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
  668. * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
  669. * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
  670. * through an SDVO command.
  671. *
  672. * This register field has values of multiplication factor minus 1, with
  673. * a maximum multiplier of 5 for SDVO.
  674. */
  675. #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
  676. #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
  677. /*
  678. * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
  679. * This best be set to the default value (3) or the CRT won't work. No,
  680. * I don't entirely understand what this does...
  681. */
  682. #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
  683. #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
  684. #define DPLL_B_MD 0x06020 /* 965+ only */
  685. #define FPA0 0x06040
  686. #define FPA1 0x06044
  687. #define FPB0 0x06048
  688. #define FPB1 0x0604c
  689. #define FP_N_DIV_MASK 0x003f0000
  690. #define FP_N_PINEVIEW_DIV_MASK 0x00ff0000
  691. #define FP_N_DIV_SHIFT 16
  692. #define FP_M1_DIV_MASK 0x00003f00
  693. #define FP_M1_DIV_SHIFT 8
  694. #define FP_M2_DIV_MASK 0x0000003f
  695. #define FP_M2_PINEVIEW_DIV_MASK 0x000000ff
  696. #define FP_M2_DIV_SHIFT 0
  697. #define DPLL_TEST 0x606c
  698. #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
  699. #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
  700. #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
  701. #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
  702. #define DPLLB_TEST_N_BYPASS (1 << 19)
  703. #define DPLLB_TEST_M_BYPASS (1 << 18)
  704. #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
  705. #define DPLLA_TEST_N_BYPASS (1 << 3)
  706. #define DPLLA_TEST_M_BYPASS (1 << 2)
  707. #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
  708. #define D_STATE 0x6104
  709. #define DSTATE_PLL_D3_OFF (1<<3)
  710. #define DSTATE_GFX_CLOCK_GATING (1<<1)
  711. #define DSTATE_DOT_CLOCK_GATING (1<<0)
  712. #define DSPCLK_GATE_D 0x6200
  713. # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
  714. # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
  715. # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
  716. # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
  717. # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
  718. # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
  719. # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
  720. # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
  721. # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
  722. # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
  723. # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
  724. # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
  725. # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
  726. # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
  727. # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
  728. # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
  729. # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
  730. # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
  731. # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
  732. # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
  733. # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
  734. # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
  735. # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
  736. # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
  737. # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
  738. # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
  739. # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
  740. # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
  741. /**
  742. * This bit must be set on the 830 to prevent hangs when turning off the
  743. * overlay scaler.
  744. */
  745. # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
  746. # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
  747. # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
  748. # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
  749. # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
  750. #define RENCLK_GATE_D1 0x6204
  751. # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
  752. # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
  753. # define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
  754. # define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
  755. # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
  756. # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
  757. # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
  758. # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
  759. # define MAG_CLOCK_GATE_DISABLE (1 << 5)
  760. /** This bit must be unset on 855,865 */
  761. # define MECI_CLOCK_GATE_DISABLE (1 << 4)
  762. # define DCMP_CLOCK_GATE_DISABLE (1 << 3)
  763. # define MEC_CLOCK_GATE_DISABLE (1 << 2)
  764. # define MECO_CLOCK_GATE_DISABLE (1 << 1)
  765. /** This bit must be set on 855,865. */
  766. # define SV_CLOCK_GATE_DISABLE (1 << 0)
  767. # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
  768. # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
  769. # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
  770. # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
  771. # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
  772. # define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
  773. # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
  774. # define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
  775. # define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
  776. # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
  777. # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
  778. # define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
  779. # define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
  780. # define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
  781. # define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
  782. # define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
  783. # define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
  784. # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
  785. /** This bit must always be set on 965G/965GM */
  786. # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
  787. # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
  788. # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
  789. # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
  790. # define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
  791. # define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
  792. /** This bit must always be set on 965G */
  793. # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
  794. # define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
  795. # define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
  796. # define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
  797. # define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
  798. # define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
  799. # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
  800. # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
  801. # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
  802. # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
  803. # define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
  804. # define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
  805. # define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
  806. # define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
  807. # define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
  808. # define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
  809. # define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
  810. # define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
  811. # define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
  812. #define RENCLK_GATE_D2 0x6208
  813. #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
  814. #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
  815. #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
  816. #define RAMCLK_GATE_D 0x6210 /* CRL only */
  817. #define DEUC 0x6214 /* CRL only */
  818. /*
  819. * Palette regs
  820. */
  821. #define PALETTE_A 0x0a000
  822. #define PALETTE_B 0x0a800
  823. /* MCH MMIO space */
  824. /*
  825. * MCHBAR mirror.
  826. *
  827. * This mirrors the MCHBAR MMIO space whose location is determined by
  828. * device 0 function 0's pci config register 0x44 or 0x48 and matches it in
  829. * every way. It is not accessible from the CP register read instructions.
  830. *
  831. */
  832. #define MCHBAR_MIRROR_BASE 0x10000
  833. /** 915-945 and GM965 MCH register controlling DRAM channel access */
  834. #define DCC 0x10200
  835. #define DCC_ADDRESSING_MODE_SINGLE_CHANNEL (0 << 0)
  836. #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_ASYMMETRIC (1 << 0)
  837. #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_INTERLEAVED (2 << 0)
  838. #define DCC_ADDRESSING_MODE_MASK (3 << 0)
  839. #define DCC_CHANNEL_XOR_DISABLE (1 << 10)
  840. #define DCC_CHANNEL_XOR_BIT_17 (1 << 9)
  841. /** Pineview MCH register contains DDR3 setting */
  842. #define CSHRDDR3CTL 0x101a8
  843. #define CSHRDDR3CTL_DDR3 (1 << 2)
  844. /** 965 MCH register controlling DRAM channel configuration */
  845. #define C0DRB3 0x10206
  846. #define C1DRB3 0x10606
  847. /* Clocking configuration register */
  848. #define CLKCFG 0x10c00
  849. #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */
  850. #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
  851. #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
  852. #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */
  853. #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */
  854. #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */
  855. /* Note, below two are guess */
  856. #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */
  857. #define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */
  858. #define CLKCFG_FSB_MASK (7 << 0)
  859. #define CLKCFG_MEM_533 (1 << 4)
  860. #define CLKCFG_MEM_667 (2 << 4)
  861. #define CLKCFG_MEM_800 (3 << 4)
  862. #define CLKCFG_MEM_MASK (7 << 4)
  863. #define TR1 0x11006
  864. #define TSFS 0x11020
  865. #define TSFS_SLOPE_MASK 0x0000ff00
  866. #define TSFS_SLOPE_SHIFT 8
  867. #define TSFS_INTR_MASK 0x000000ff
  868. #define CRSTANDVID 0x11100
  869. #define PXVFREQ_BASE 0x11110 /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
  870. #define PXVFREQ_PX_MASK 0x7f000000
  871. #define PXVFREQ_PX_SHIFT 24
  872. #define VIDFREQ_BASE 0x11110
  873. #define VIDFREQ1 0x11110 /* VIDFREQ1-4 (0x1111c) (Cantiga) */
  874. #define VIDFREQ2 0x11114
  875. #define VIDFREQ3 0x11118
  876. #define VIDFREQ4 0x1111c
  877. #define VIDFREQ_P0_MASK 0x1f000000
  878. #define VIDFREQ_P0_SHIFT 24
  879. #define VIDFREQ_P0_CSCLK_MASK 0x00f00000
  880. #define VIDFREQ_P0_CSCLK_SHIFT 20
  881. #define VIDFREQ_P0_CRCLK_MASK 0x000f0000
  882. #define VIDFREQ_P0_CRCLK_SHIFT 16
  883. #define VIDFREQ_P1_MASK 0x00001f00
  884. #define VIDFREQ_P1_SHIFT 8
  885. #define VIDFREQ_P1_CSCLK_MASK 0x000000f0
  886. #define VIDFREQ_P1_CSCLK_SHIFT 4
  887. #define VIDFREQ_P1_CRCLK_MASK 0x0000000f
  888. #define INTTOEXT_BASE_ILK 0x11300
  889. #define INTTOEXT_BASE 0x11120 /* INTTOEXT1-8 (0x1113c) */
  890. #define INTTOEXT_MAP3_SHIFT 24
  891. #define INTTOEXT_MAP3_MASK (0x1f << INTTOEXT_MAP3_SHIFT)
  892. #define INTTOEXT_MAP2_SHIFT 16
  893. #define INTTOEXT_MAP2_MASK (0x1f << INTTOEXT_MAP2_SHIFT)
  894. #define INTTOEXT_MAP1_SHIFT 8
  895. #define INTTOEXT_MAP1_MASK (0x1f << INTTOEXT_MAP1_SHIFT)
  896. #define INTTOEXT_MAP0_SHIFT 0
  897. #define INTTOEXT_MAP0_MASK (0x1f << INTTOEXT_MAP0_SHIFT)
  898. #define MEMSWCTL 0x11170 /* Ironlake only */
  899. #define MEMCTL_CMD_MASK 0xe000
  900. #define MEMCTL_CMD_SHIFT 13
  901. #define MEMCTL_CMD_RCLK_OFF 0
  902. #define MEMCTL_CMD_RCLK_ON 1
  903. #define MEMCTL_CMD_CHFREQ 2
  904. #define MEMCTL_CMD_CHVID 3
  905. #define MEMCTL_CMD_VMMOFF 4
  906. #define MEMCTL_CMD_VMMON 5
  907. #define MEMCTL_CMD_STS (1<<12) /* write 1 triggers command, clears
  908. when command complete */
  909. #define MEMCTL_FREQ_MASK 0x0f00 /* jitter, from 0-15 */
  910. #define MEMCTL_FREQ_SHIFT 8
  911. #define MEMCTL_SFCAVM (1<<7)
  912. #define MEMCTL_TGT_VID_MASK 0x007f
  913. #define MEMIHYST 0x1117c
  914. #define MEMINTREN 0x11180 /* 16 bits */
  915. #define MEMINT_RSEXIT_EN (1<<8)
  916. #define MEMINT_CX_SUPR_EN (1<<7)
  917. #define MEMINT_CONT_BUSY_EN (1<<6)
  918. #define MEMINT_AVG_BUSY_EN (1<<5)
  919. #define MEMINT_EVAL_CHG_EN (1<<4)
  920. #define MEMINT_MON_IDLE_EN (1<<3)
  921. #define MEMINT_UP_EVAL_EN (1<<2)
  922. #define MEMINT_DOWN_EVAL_EN (1<<1)
  923. #define MEMINT_SW_CMD_EN (1<<0)
  924. #define MEMINTRSTR 0x11182 /* 16 bits */
  925. #define MEM_RSEXIT_MASK 0xc000
  926. #define MEM_RSEXIT_SHIFT 14
  927. #define MEM_CONT_BUSY_MASK 0x3000
  928. #define MEM_CONT_BUSY_SHIFT 12
  929. #define MEM_AVG_BUSY_MASK 0x0c00
  930. #define MEM_AVG_BUSY_SHIFT 10
  931. #define MEM_EVAL_CHG_MASK 0x0300
  932. #define MEM_EVAL_BUSY_SHIFT 8
  933. #define MEM_MON_IDLE_MASK 0x00c0
  934. #define MEM_MON_IDLE_SHIFT 6
  935. #define MEM_UP_EVAL_MASK 0x0030
  936. #define MEM_UP_EVAL_SHIFT 4
  937. #define MEM_DOWN_EVAL_MASK 0x000c
  938. #define MEM_DOWN_EVAL_SHIFT 2
  939. #define MEM_SW_CMD_MASK 0x0003
  940. #define MEM_INT_STEER_GFX 0
  941. #define MEM_INT_STEER_CMR 1
  942. #define MEM_INT_STEER_SMI 2
  943. #define MEM_INT_STEER_SCI 3
  944. #define MEMINTRSTS 0x11184
  945. #define MEMINT_RSEXIT (1<<7)
  946. #define MEMINT_CONT_BUSY (1<<6)
  947. #define MEMINT_AVG_BUSY (1<<5)
  948. #define MEMINT_EVAL_CHG (1<<4)
  949. #define MEMINT_MON_IDLE (1<<3)
  950. #define MEMINT_UP_EVAL (1<<2)
  951. #define MEMINT_DOWN_EVAL (1<<1)
  952. #define MEMINT_SW_CMD (1<<0)
  953. #define MEMMODECTL 0x11190
  954. #define MEMMODE_BOOST_EN (1<<31)
  955. #define MEMMODE_BOOST_FREQ_MASK 0x0f000000 /* jitter for boost, 0-15 */
  956. #define MEMMODE_BOOST_FREQ_SHIFT 24
  957. #define MEMMODE_IDLE_MODE_MASK 0x00030000
  958. #define MEMMODE_IDLE_MODE_SHIFT 16
  959. #define MEMMODE_IDLE_MODE_EVAL 0
  960. #define MEMMODE_IDLE_MODE_CONT 1
  961. #define MEMMODE_HWIDLE_EN (1<<15)
  962. #define MEMMODE_SWMODE_EN (1<<14)
  963. #define MEMMODE_RCLK_GATE (1<<13)
  964. #define MEMMODE_HW_UPDATE (1<<12)
  965. #define MEMMODE_FSTART_MASK 0x00000f00 /* starting jitter, 0-15 */
  966. #define MEMMODE_FSTART_SHIFT 8
  967. #define MEMMODE_FMAX_MASK 0x000000f0 /* max jitter, 0-15 */
  968. #define MEMMODE_FMAX_SHIFT 4
  969. #define MEMMODE_FMIN_MASK 0x0000000f /* min jitter, 0-15 */
  970. #define RCBMAXAVG 0x1119c
  971. #define MEMSWCTL2 0x1119e /* Cantiga only */
  972. #define SWMEMCMD_RENDER_OFF (0 << 13)
  973. #define SWMEMCMD_RENDER_ON (1 << 13)
  974. #define SWMEMCMD_SWFREQ (2 << 13)
  975. #define SWMEMCMD_TARVID (3 << 13)
  976. #define SWMEMCMD_VRM_OFF (4 << 13)
  977. #define SWMEMCMD_VRM_ON (5 << 13)
  978. #define CMDSTS (1<<12)
  979. #define SFCAVM (1<<11)
  980. #define SWFREQ_MASK 0x0380 /* P0-7 */
  981. #define SWFREQ_SHIFT 7
  982. #define TARVID_MASK 0x001f
  983. #define MEMSTAT_CTG 0x111a0
  984. #define RCBMINAVG 0x111a0
  985. #define RCUPEI 0x111b0
  986. #define RCDNEI 0x111b4
  987. #define MCHBAR_RENDER_STANDBY 0x111b8
  988. #define RCX_SW_EXIT (1<<23)
  989. #define RSX_STATUS_MASK 0x00700000
  990. #define VIDCTL 0x111c0
  991. #define VIDSTS 0x111c8
  992. #define VIDSTART 0x111cc /* 8 bits */
  993. #define MEMSTAT_ILK 0x111f8
  994. #define MEMSTAT_VID_MASK 0x7f00
  995. #define MEMSTAT_VID_SHIFT 8
  996. #define MEMSTAT_PSTATE_MASK 0x00f8
  997. #define MEMSTAT_PSTATE_SHIFT 3
  998. #define MEMSTAT_MON_ACTV (1<<2)
  999. #define MEMSTAT_SRC_CTL_MASK 0x0003
  1000. #define MEMSTAT_SRC_CTL_CORE 0
  1001. #define MEMSTAT_SRC_CTL_TRB 1
  1002. #define MEMSTAT_SRC_CTL_THM 2
  1003. #define MEMSTAT_SRC_CTL_STDBY 3
  1004. #define RCPREVBSYTUPAVG 0x113b8
  1005. #define RCPREVBSYTDNAVG 0x113bc
  1006. #define SDEW 0x1124c
  1007. #define CSIEW0 0x11250
  1008. #define CSIEW1 0x11254
  1009. #define CSIEW2 0x11258
  1010. #define PEW 0x1125c
  1011. #define DEW 0x11270
  1012. #define MCHAFE 0x112c0
  1013. #define CSIEC 0x112e0
  1014. #define DMIEC 0x112e4
  1015. #define DDREC 0x112e8
  1016. #define PEG0EC 0x112ec
  1017. #define PEG1EC 0x112f0
  1018. #define GFXEC 0x112f4
  1019. #define RPPREVBSYTUPAVG 0x113b8
  1020. #define RPPREVBSYTDNAVG 0x113bc
  1021. #define ECR 0x11600
  1022. #define ECR_GPFE (1<<31)
  1023. #define ECR_IMONE (1<<30)
  1024. #define ECR_CAP_MASK 0x0000001f /* Event range, 0-31 */
  1025. #define OGW0 0x11608
  1026. #define OGW1 0x1160c
  1027. #define EG0 0x11610
  1028. #define EG1 0x11614
  1029. #define EG2 0x11618
  1030. #define EG3 0x1161c
  1031. #define EG4 0x11620
  1032. #define EG5 0x11624
  1033. #define EG6 0x11628
  1034. #define EG7 0x1162c
  1035. #define PXW 0x11664
  1036. #define PXWL 0x11680
  1037. #define LCFUSE02 0x116c0
  1038. #define LCFUSE_HIV_MASK 0x000000ff
  1039. #define CSIPLL0 0x12c10
  1040. #define DDRMPLL1 0X12c20
  1041. #define PEG_BAND_GAP_DATA 0x14d68
  1042. /*
  1043. * Overlay regs
  1044. */
  1045. #define OVADD 0x30000
  1046. #define DOVSTA 0x30008
  1047. #define OC_BUF (0x3<<20)
  1048. #define OGAMC5 0x30010
  1049. #define OGAMC4 0x30014
  1050. #define OGAMC3 0x30018
  1051. #define OGAMC2 0x3001c
  1052. #define OGAMC1 0x30020
  1053. #define OGAMC0 0x30024
  1054. /*
  1055. * Display engine regs
  1056. */
  1057. /* Pipe A timing regs */
  1058. #define HTOTAL_A 0x60000
  1059. #define HBLANK_A 0x60004
  1060. #define HSYNC_A 0x60008
  1061. #define VTOTAL_A 0x6000c
  1062. #define VBLANK_A 0x60010
  1063. #define VSYNC_A 0x60014
  1064. #define PIPEASRC 0x6001c
  1065. #define BCLRPAT_A 0x60020
  1066. /* Pipe B timing regs */
  1067. #define HTOTAL_B 0x61000
  1068. #define HBLANK_B 0x61004
  1069. #define HSYNC_B 0x61008
  1070. #define VTOTAL_B 0x6100c
  1071. #define VBLANK_B 0x61010
  1072. #define VSYNC_B 0x61014
  1073. #define PIPEBSRC 0x6101c
  1074. #define BCLRPAT_B 0x61020
  1075. /* VGA port control */
  1076. #define ADPA 0x61100
  1077. #define ADPA_DAC_ENABLE (1<<31)
  1078. #define ADPA_DAC_DISABLE 0
  1079. #define ADPA_PIPE_SELECT_MASK (1<<30)
  1080. #define ADPA_PIPE_A_SELECT 0
  1081. #define ADPA_PIPE_B_SELECT (1<<30)
  1082. #define ADPA_USE_VGA_HVPOLARITY (1<<15)
  1083. #define ADPA_SETS_HVPOLARITY 0
  1084. #define ADPA_VSYNC_CNTL_DISABLE (1<<11)
  1085. #define ADPA_VSYNC_CNTL_ENABLE 0
  1086. #define ADPA_HSYNC_CNTL_DISABLE (1<<10)
  1087. #define ADPA_HSYNC_CNTL_ENABLE 0
  1088. #define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
  1089. #define ADPA_VSYNC_ACTIVE_LOW 0
  1090. #define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
  1091. #define ADPA_HSYNC_ACTIVE_LOW 0
  1092. #define ADPA_DPMS_MASK (~(3<<10))
  1093. #define ADPA_DPMS_ON (0<<10)
  1094. #define ADPA_DPMS_SUSPEND (1<<10)
  1095. #define ADPA_DPMS_STANDBY (2<<10)
  1096. #define ADPA_DPMS_OFF (3<<10)
  1097. /* Hotplug control (945+ only) */
  1098. #define PORT_HOTPLUG_EN 0x61110
  1099. #define HDMIB_HOTPLUG_INT_EN (1 << 29)
  1100. #define DPB_HOTPLUG_INT_EN (1 << 29)
  1101. #define HDMIC_HOTPLUG_INT_EN (1 << 28)
  1102. #define DPC_HOTPLUG_INT_EN (1 << 28)
  1103. #define HDMID_HOTPLUG_INT_EN (1 << 27)
  1104. #define DPD_HOTPLUG_INT_EN (1 << 27)
  1105. #define SDVOB_HOTPLUG_INT_EN (1 << 26)
  1106. #define SDVOC_HOTPLUG_INT_EN (1 << 25)
  1107. #define TV_HOTPLUG_INT_EN (1 << 18)
  1108. #define CRT_HOTPLUG_INT_EN (1 << 9)
  1109. #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
  1110. #define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
  1111. /* must use period 64 on GM45 according to docs */
  1112. #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
  1113. #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
  1114. #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
  1115. #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
  1116. #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
  1117. #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
  1118. #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
  1119. #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
  1120. #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
  1121. #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
  1122. #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
  1123. #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
  1124. #define PORT_HOTPLUG_STAT 0x61114
  1125. #define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
  1126. #define DPB_HOTPLUG_INT_STATUS (1 << 29)
  1127. #define HDMIC_HOTPLUG_INT_STATUS (1 << 28)
  1128. #define DPC_HOTPLUG_INT_STATUS (1 << 28)
  1129. #define HDMID_HOTPLUG_INT_STATUS (1 << 27)
  1130. #define DPD_HOTPLUG_INT_STATUS (1 << 27)
  1131. #define CRT_HOTPLUG_INT_STATUS (1 << 11)
  1132. #define TV_HOTPLUG_INT_STATUS (1 << 10)
  1133. #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
  1134. #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
  1135. #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
  1136. #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
  1137. #define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
  1138. #define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
  1139. /* SDVO port control */
  1140. #define SDVOB 0x61140
  1141. #define SDVOC 0x61160
  1142. #define SDVO_ENABLE (1 << 31)
  1143. #define SDVO_PIPE_B_SELECT (1 << 30)
  1144. #define SDVO_STALL_SELECT (1 << 29)
  1145. #define SDVO_INTERRUPT_ENABLE (1 << 26)
  1146. /**
  1147. * 915G/GM SDVO pixel multiplier.
  1148. *
  1149. * Programmed value is multiplier - 1, up to 5x.
  1150. *
  1151. * \sa DPLL_MD_UDI_MULTIPLIER_MASK
  1152. */
  1153. #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
  1154. #define SDVO_PORT_MULTIPLY_SHIFT 23
  1155. #define SDVO_PHASE_SELECT_MASK (15 << 19)
  1156. #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
  1157. #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
  1158. #define SDVOC_GANG_MODE (1 << 16)
  1159. #define SDVO_ENCODING_SDVO (0x0 << 10)
  1160. #define SDVO_ENCODING_HDMI (0x2 << 10)
  1161. /** Requird for HDMI operation */
  1162. #define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
  1163. #define SDVO_BORDER_ENABLE (1 << 7)
  1164. #define SDVO_AUDIO_ENABLE (1 << 6)
  1165. /** New with 965, default is to be set */
  1166. #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
  1167. /** New with 965, default is to be set */
  1168. #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
  1169. #define SDVOB_PCIE_CONCURRENCY (1 << 3)
  1170. #define SDVO_DETECTED (1 << 2)
  1171. /* Bits to be preserved when writing */
  1172. #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | (1 << 26))
  1173. #define SDVOC_PRESERVE_MASK ((1 << 17) | (1 << 26))
  1174. /* DVO port control */
  1175. #define DVOA 0x61120
  1176. #define DVOB 0x61140
  1177. #define DVOC 0x61160
  1178. #define DVO_ENABLE (1 << 31)
  1179. #define DVO_PIPE_B_SELECT (1 << 30)
  1180. #define DVO_PIPE_STALL_UNUSED (0 << 28)
  1181. #define DVO_PIPE_STALL (1 << 28)
  1182. #define DVO_PIPE_STALL_TV (2 << 28)
  1183. #define DVO_PIPE_STALL_MASK (3 << 28)
  1184. #define DVO_USE_VGA_SYNC (1 << 15)
  1185. #define DVO_DATA_ORDER_I740 (0 << 14)
  1186. #define DVO_DATA_ORDER_FP (1 << 14)
  1187. #define DVO_VSYNC_DISABLE (1 << 11)
  1188. #define DVO_HSYNC_DISABLE (1 << 10)
  1189. #define DVO_VSYNC_TRISTATE (1 << 9)
  1190. #define DVO_HSYNC_TRISTATE (1 << 8)
  1191. #define DVO_BORDER_ENABLE (1 << 7)
  1192. #define DVO_DATA_ORDER_GBRG (1 << 6)
  1193. #define DVO_DATA_ORDER_RGGB (0 << 6)
  1194. #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
  1195. #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
  1196. #define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
  1197. #define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
  1198. #define DVO_BLANK_ACTIVE_HIGH (1 << 2)
  1199. #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
  1200. #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
  1201. #define DVO_PRESERVE_MASK (0x7<<24)
  1202. #define DVOA_SRCDIM 0x61124
  1203. #define DVOB_SRCDIM 0x61144
  1204. #define DVOC_SRCDIM 0x61164
  1205. #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
  1206. #define DVO_SRCDIM_VERTICAL_SHIFT 0
  1207. /* LVDS port control */
  1208. #define LVDS 0x61180
  1209. /*
  1210. * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
  1211. * the DPLL semantics change when the LVDS is assigned to that pipe.
  1212. */
  1213. #define LVDS_PORT_EN (1 << 31)
  1214. /* Selects pipe B for LVDS data. Must be set on pre-965. */
  1215. #define LVDS_PIPEB_SELECT (1 << 30)
  1216. /* LVDS dithering flag on 965/g4x platform */
  1217. #define LVDS_ENABLE_DITHER (1 << 25)
  1218. /* Enable border for unscaled (or aspect-scaled) display */
  1219. #define LVDS_BORDER_ENABLE (1 << 15)
  1220. /*
  1221. * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
  1222. * pixel.
  1223. */
  1224. #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
  1225. #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
  1226. #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
  1227. /*
  1228. * Controls the A3 data pair, which contains the additional LSBs for 24 bit
  1229. * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
  1230. * on.
  1231. */
  1232. #define LVDS_A3_POWER_MASK (3 << 6)
  1233. #define LVDS_A3_POWER_DOWN (0 << 6)
  1234. #define LVDS_A3_POWER_UP (3 << 6)
  1235. /*
  1236. * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
  1237. * is set.
  1238. */
  1239. #define LVDS_CLKB_POWER_MASK (3 << 4)
  1240. #define LVDS_CLKB_POWER_DOWN (0 << 4)
  1241. #define LVDS_CLKB_POWER_UP (3 << 4)
  1242. /*
  1243. * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
  1244. * setting for whether we are in dual-channel mode. The B3 pair will
  1245. * additionally only be powered up when LVDS_A3_POWER_UP is set.
  1246. */
  1247. #define LVDS_B0B3_POWER_MASK (3 << 2)
  1248. #define LVDS_B0B3_POWER_DOWN (0 << 2)
  1249. #define LVDS_B0B3_POWER_UP (3 << 2)
  1250. /* Panel power sequencing */
  1251. #define PP_STATUS 0x61200
  1252. #define PP_ON (1 << 31)
  1253. /*
  1254. * Indicates that all dependencies of the panel are on:
  1255. *
  1256. * - PLL enabled
  1257. * - pipe enabled
  1258. * - LVDS/DVOB/DVOC on
  1259. */
  1260. #define PP_READY (1 << 30)
  1261. #define PP_SEQUENCE_NONE (0 << 28)
  1262. #define PP_SEQUENCE_ON (1 << 28)
  1263. #define PP_SEQUENCE_OFF (2 << 28)
  1264. #define PP_SEQUENCE_MASK 0x30000000
  1265. #define PP_CONTROL 0x61204
  1266. #define POWER_TARGET_ON (1 << 0)
  1267. #define PP_ON_DELAYS 0x61208
  1268. #define PP_OFF_DELAYS 0x6120c
  1269. #define PP_DIVISOR 0x61210
  1270. /* Panel fitting */
  1271. #define PFIT_CONTROL 0x61230
  1272. #define PFIT_ENABLE (1 << 31)
  1273. #define PFIT_PIPE_MASK (3 << 29)
  1274. #define PFIT_PIPE_SHIFT 29
  1275. #define VERT_INTERP_DISABLE (0 << 10)
  1276. #define VERT_INTERP_BILINEAR (1 << 10)
  1277. #define VERT_INTERP_MASK (3 << 10)
  1278. #define VERT_AUTO_SCALE (1 << 9)
  1279. #define HORIZ_INTERP_DISABLE (0 << 6)
  1280. #define HORIZ_INTERP_BILINEAR (1 << 6)
  1281. #define HORIZ_INTERP_MASK (3 << 6)
  1282. #define HORIZ_AUTO_SCALE (1 << 5)
  1283. #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
  1284. #define PFIT_FILTER_FUZZY (0 << 24)
  1285. #define PFIT_SCALING_AUTO (0 << 26)
  1286. #define PFIT_SCALING_PROGRAMMED (1 << 26)
  1287. #define PFIT_SCALING_PILLAR (2 << 26)
  1288. #define PFIT_SCALING_LETTER (3 << 26)
  1289. #define PFIT_PGM_RATIOS 0x61234
  1290. #define PFIT_VERT_SCALE_MASK 0xfff00000
  1291. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  1292. /* Pre-965 */
  1293. #define PFIT_VERT_SCALE_SHIFT 20
  1294. #define PFIT_VERT_SCALE_MASK 0xfff00000
  1295. #define PFIT_HORIZ_SCALE_SHIFT 4
  1296. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  1297. /* 965+ */
  1298. #define PFIT_VERT_SCALE_SHIFT_965 16
  1299. #define PFIT_VERT_SCALE_MASK_965 0x1fff0000
  1300. #define PFIT_HORIZ_SCALE_SHIFT_965 0
  1301. #define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
  1302. #define PFIT_AUTO_RATIOS 0x61238
  1303. /* Backlight control */
  1304. #define BLC_PWM_CTL 0x61254
  1305. #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
  1306. #define BLC_PWM_CTL2 0x61250 /* 965+ only */
  1307. #define BLM_COMBINATION_MODE (1 << 30)
  1308. /*
  1309. * This is the most significant 15 bits of the number of backlight cycles in a
  1310. * complete cycle of the modulated backlight control.
  1311. *
  1312. * The actual value is this field multiplied by two.
  1313. */
  1314. #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
  1315. #define BLM_LEGACY_MODE (1 << 16)
  1316. /*
  1317. * This is the number of cycles out of the backlight modulation cycle for which
  1318. * the backlight is on.
  1319. *
  1320. * This field must be no greater than the number of cycles in the complete
  1321. * backlight modulation cycle.
  1322. */
  1323. #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
  1324. #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
  1325. #define BLC_HIST_CTL 0x61260
  1326. /* TV port control */
  1327. #define TV_CTL 0x68000
  1328. /** Enables the TV encoder */
  1329. # define TV_ENC_ENABLE (1 << 31)
  1330. /** Sources the TV encoder input from pipe B instead of A. */
  1331. # define TV_ENC_PIPEB_SELECT (1 << 30)
  1332. /** Outputs composite video (DAC A only) */
  1333. # define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
  1334. /** Outputs SVideo video (DAC B/C) */
  1335. # define TV_ENC_OUTPUT_SVIDEO (1 << 28)
  1336. /** Outputs Component video (DAC A/B/C) */
  1337. # define TV_ENC_OUTPUT_COMPONENT (2 << 28)
  1338. /** Outputs Composite and SVideo (DAC A/B/C) */
  1339. # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
  1340. # define TV_TRILEVEL_SYNC (1 << 21)
  1341. /** Enables slow sync generation (945GM only) */
  1342. # define TV_SLOW_SYNC (1 << 20)
  1343. /** Selects 4x oversampling for 480i and 576p */
  1344. # define TV_OVERSAMPLE_4X (0 << 18)
  1345. /** Selects 2x oversampling for 720p and 1080i */
  1346. # define TV_OVERSAMPLE_2X (1 << 18)
  1347. /** Selects no oversampling for 1080p */
  1348. # define TV_OVERSAMPLE_NONE (2 << 18)
  1349. /** Selects 8x oversampling */
  1350. # define TV_OVERSAMPLE_8X (3 << 18)
  1351. /** Selects progressive mode rather than interlaced */
  1352. # define TV_PROGRESSIVE (1 << 17)
  1353. /** Sets the colorburst to PAL mode. Required for non-M PAL modes. */
  1354. # define TV_PAL_BURST (1 << 16)
  1355. /** Field for setting delay of Y compared to C */
  1356. # define TV_YC_SKEW_MASK (7 << 12)
  1357. /** Enables a fix for 480p/576p standard definition modes on the 915GM only */
  1358. # define TV_ENC_SDP_FIX (1 << 11)
  1359. /**
  1360. * Enables a fix for the 915GM only.
  1361. *
  1362. * Not sure what it does.
  1363. */
  1364. # define TV_ENC_C0_FIX (1 << 10)
  1365. /** Bits that must be preserved by software */
  1366. # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
  1367. # define TV_FUSE_STATE_MASK (3 << 4)
  1368. /** Read-only state that reports all features enabled */
  1369. # define TV_FUSE_STATE_ENABLED (0 << 4)
  1370. /** Read-only state that reports that Macrovision is disabled in hardware*/
  1371. # define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
  1372. /** Read-only state that reports that TV-out is disabled in hardware. */
  1373. # define TV_FUSE_STATE_DISABLED (2 << 4)
  1374. /** Normal operation */
  1375. # define TV_TEST_MODE_NORMAL (0 << 0)
  1376. /** Encoder test pattern 1 - combo pattern */
  1377. # define TV_TEST_MODE_PATTERN_1 (1 << 0)
  1378. /** Encoder test pattern 2 - full screen vertical 75% color bars */
  1379. # define TV_TEST_MODE_PATTERN_2 (2 << 0)
  1380. /** Encoder test pattern 3 - full screen horizontal 75% color bars */
  1381. # define TV_TEST_MODE_PATTERN_3 (3 << 0)
  1382. /** Encoder test pattern 4 - random noise */
  1383. # define TV_TEST_MODE_PATTERN_4 (4 << 0)
  1384. /** Encoder test pattern 5 - linear color ramps */
  1385. # define TV_TEST_MODE_PATTERN_5 (5 << 0)
  1386. /**
  1387. * This test mode forces the DACs to 50% of full output.
  1388. *
  1389. * This is used for load detection in combination with TVDAC_SENSE_MASK
  1390. */
  1391. # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
  1392. # define TV_TEST_MODE_MASK (7 << 0)
  1393. #define TV_DAC 0x68004
  1394. /**
  1395. * Reports that DAC state change logic has reported change (RO).
  1396. *
  1397. * This gets cleared when TV_DAC_STATE_EN is cleared
  1398. */
  1399. # define TVDAC_STATE_CHG (1 << 31)
  1400. # define TVDAC_SENSE_MASK (7 << 28)
  1401. /** Reports that DAC A voltage is above the detect threshold */
  1402. # define TVDAC_A_SENSE (1 << 30)
  1403. /** Reports that DAC B voltage is above the detect threshold */
  1404. # define TVDAC_B_SENSE (1 << 29)
  1405. /** Reports that DAC C voltage is above the detect threshold */
  1406. # define TVDAC_C_SENSE (1 << 28)
  1407. /**
  1408. * Enables DAC state detection logic, for load-based TV detection.
  1409. *
  1410. * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
  1411. * to off, for load detection to work.
  1412. */
  1413. # define TVDAC_STATE_CHG_EN (1 << 27)
  1414. /** Sets the DAC A sense value to high */
  1415. # define TVDAC_A_SENSE_CTL (1 << 26)
  1416. /** Sets the DAC B sense value to high */
  1417. # define TVDAC_B_SENSE_CTL (1 << 25)
  1418. /** Sets the DAC C sense value to high */
  1419. # define TVDAC_C_SENSE_CTL (1 << 24)
  1420. /** Overrides the ENC_ENABLE and DAC voltage levels */
  1421. # define DAC_CTL_OVERRIDE (1 << 7)
  1422. /** Sets the slew rate. Must be preserved in software */
  1423. # define ENC_TVDAC_SLEW_FAST (1 << 6)
  1424. # define DAC_A_1_3_V (0 << 4)
  1425. # define DAC_A_1_1_V (1 << 4)
  1426. # define DAC_A_0_7_V (2 << 4)
  1427. # define DAC_A_MASK (3 << 4)
  1428. # define DAC_B_1_3_V (0 << 2)
  1429. # define DAC_B_1_1_V (1 << 2)
  1430. # define DAC_B_0_7_V (2 << 2)
  1431. # define DAC_B_MASK (3 << 2)
  1432. # define DAC_C_1_3_V (0 << 0)
  1433. # define DAC_C_1_1_V (1 << 0)
  1434. # define DAC_C_0_7_V (2 << 0)
  1435. # define DAC_C_MASK (3 << 0)
  1436. /**
  1437. * CSC coefficients are stored in a floating point format with 9 bits of
  1438. * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
  1439. * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
  1440. * -1 (0x3) being the only legal negative value.
  1441. */
  1442. #define TV_CSC_Y 0x68010
  1443. # define TV_RY_MASK 0x07ff0000
  1444. # define TV_RY_SHIFT 16
  1445. # define TV_GY_MASK 0x00000fff
  1446. # define TV_GY_SHIFT 0
  1447. #define TV_CSC_Y2 0x68014
  1448. # define TV_BY_MASK 0x07ff0000
  1449. # define TV_BY_SHIFT 16
  1450. /**
  1451. * Y attenuation for component video.
  1452. *
  1453. * Stored in 1.9 fixed point.
  1454. */
  1455. # define TV_AY_MASK 0x000003ff
  1456. # define TV_AY_SHIFT 0
  1457. #define TV_CSC_U 0x68018
  1458. # define TV_RU_MASK 0x07ff0000
  1459. # define TV_RU_SHIFT 16
  1460. # define TV_GU_MASK 0x000007ff
  1461. # define TV_GU_SHIFT 0
  1462. #define TV_CSC_U2 0x6801c
  1463. # define TV_BU_MASK 0x07ff0000
  1464. # define TV_BU_SHIFT 16
  1465. /**
  1466. * U attenuation for component video.
  1467. *
  1468. * Stored in 1.9 fixed point.
  1469. */
  1470. # define TV_AU_MASK 0x000003ff
  1471. # define TV_AU_SHIFT 0
  1472. #define TV_CSC_V 0x68020
  1473. # define TV_RV_MASK 0x0fff0000
  1474. # define TV_RV_SHIFT 16
  1475. # define TV_GV_MASK 0x000007ff
  1476. # define TV_GV_SHIFT 0
  1477. #define TV_CSC_V2 0x68024
  1478. # define TV_BV_MASK 0x07ff0000
  1479. # define TV_BV_SHIFT 16
  1480. /**
  1481. * V attenuation for component video.
  1482. *
  1483. * Stored in 1.9 fixed point.
  1484. */
  1485. # define TV_AV_MASK 0x000007ff
  1486. # define TV_AV_SHIFT 0
  1487. #define TV_CLR_KNOBS 0x68028
  1488. /** 2s-complement brightness adjustment */
  1489. # define TV_BRIGHTNESS_MASK 0xff000000
  1490. # define TV_BRIGHTNESS_SHIFT 24
  1491. /** Contrast adjustment, as a 2.6 unsigned floating point number */
  1492. # define TV_CONTRAST_MASK 0x00ff0000
  1493. # define TV_CONTRAST_SHIFT 16
  1494. /** Saturation adjustment, as a 2.6 unsigned floating point number */
  1495. # define TV_SATURATION_MASK 0x0000ff00
  1496. # define TV_SATURATION_SHIFT 8
  1497. /** Hue adjustment, as an integer phase angle in degrees */
  1498. # define TV_HUE_MASK 0x000000ff
  1499. # define TV_HUE_SHIFT 0
  1500. #define TV_CLR_LEVEL 0x6802c
  1501. /** Controls the DAC level for black */
  1502. # define TV_BLACK_LEVEL_MASK 0x01ff0000
  1503. # define TV_BLACK_LEVEL_SHIFT 16
  1504. /** Controls the DAC level for blanking */
  1505. # define TV_BLANK_LEVEL_MASK 0x000001ff
  1506. # define TV_BLANK_LEVEL_SHIFT 0
  1507. #define TV_H_CTL_1 0x68030
  1508. /** Number of pixels in the hsync. */
  1509. # define TV_HSYNC_END_MASK 0x1fff0000
  1510. # define TV_HSYNC_END_SHIFT 16
  1511. /** Total number of pixels minus one in the line (display and blanking). */
  1512. # define TV_HTOTAL_MASK 0x00001fff
  1513. # define TV_HTOTAL_SHIFT 0
  1514. #define TV_H_CTL_2 0x68034
  1515. /** Enables the colorburst (needed for non-component color) */
  1516. # define TV_BURST_ENA (1 << 31)
  1517. /** Offset of the colorburst from the start of hsync, in pixels minus one. */
  1518. # define TV_HBURST_START_SHIFT 16
  1519. # define TV_HBURST_START_MASK 0x1fff0000
  1520. /** Length of the colorburst */
  1521. # define TV_HBURST_LEN_SHIFT 0
  1522. # define TV_HBURST_LEN_MASK 0x0001fff
  1523. #define TV_H_CTL_3 0x68038
  1524. /** End of hblank, measured in pixels minus one from start of hsync */
  1525. # define TV_HBLANK_END_SHIFT 16
  1526. # define TV_HBLANK_END_MASK 0x1fff0000
  1527. /** Start of hblank, measured in pixels minus one from start of hsync */
  1528. # define TV_HBLANK_START_SHIFT 0
  1529. # define TV_HBLANK_START_MASK 0x0001fff
  1530. #define TV_V_CTL_1 0x6803c
  1531. /** XXX */
  1532. # define TV_NBR_END_SHIFT 16
  1533. # define TV_NBR_END_MASK 0x07ff0000
  1534. /** XXX */
  1535. # define TV_VI_END_F1_SHIFT 8
  1536. # define TV_VI_END_F1_MASK 0x00003f00
  1537. /** XXX */
  1538. # define TV_VI_END_F2_SHIFT 0
  1539. # define TV_VI_END_F2_MASK 0x0000003f
  1540. #define TV_V_CTL_2 0x68040
  1541. /** Length of vsync, in half lines */
  1542. # define TV_VSYNC_LEN_MASK 0x07ff0000
  1543. # define TV_VSYNC_LEN_SHIFT 16
  1544. /** Offset of the start of vsync in field 1, measured in one less than the
  1545. * number of half lines.
  1546. */
  1547. # define TV_VSYNC_START_F1_MASK 0x00007f00
  1548. # define TV_VSYNC_START_F1_SHIFT 8
  1549. /**
  1550. * Offset of the start of vsync in field 2, measured in one less than the
  1551. * number of half lines.
  1552. */
  1553. # define TV_VSYNC_START_F2_MASK 0x0000007f
  1554. # define TV_VSYNC_START_F2_SHIFT 0
  1555. #define TV_V_CTL_3 0x68044
  1556. /** Enables generation of the equalization signal */
  1557. # define TV_EQUAL_ENA (1 << 31)
  1558. /** Length of vsync, in half lines */
  1559. # define TV_VEQ_LEN_MASK 0x007f0000
  1560. # define TV_VEQ_LEN_SHIFT 16
  1561. /** Offset of the start of equalization in field 1, measured in one less than
  1562. * the number of half lines.
  1563. */
  1564. # define TV_VEQ_START_F1_MASK 0x0007f00
  1565. # define TV_VEQ_START_F1_SHIFT 8
  1566. /**
  1567. * Offset of the start of equalization in field 2, measured in one less than
  1568. * the number of half lines.
  1569. */
  1570. # define TV_VEQ_START_F2_MASK 0x000007f
  1571. # define TV_VEQ_START_F2_SHIFT 0
  1572. #define TV_V_CTL_4 0x68048
  1573. /**
  1574. * Offset to start of vertical colorburst, measured in one less than the
  1575. * number of lines from vertical start.
  1576. */
  1577. # define TV_VBURST_START_F1_MASK 0x003f0000
  1578. # define TV_VBURST_START_F1_SHIFT 16
  1579. /**
  1580. * Offset to the end of vertical colorburst, measured in one less than the
  1581. * number of lines from the start of NBR.
  1582. */
  1583. # define TV_VBURST_END_F1_MASK 0x000000ff
  1584. # define TV_VBURST_END_F1_SHIFT 0
  1585. #define TV_V_CTL_5 0x6804c
  1586. /**
  1587. * Offset to start of vertical colorburst, measured in one less than the
  1588. * number of lines from vertical start.
  1589. */
  1590. # define TV_VBURST_START_F2_MASK 0x003f0000
  1591. # define TV_VBURST_START_F2_SHIFT 16
  1592. /**
  1593. * Offset to the end of vertical colorburst, measured in one less than the
  1594. * number of lines from the start of NBR.
  1595. */
  1596. # define TV_VBURST_END_F2_MASK 0x000000ff
  1597. # define TV_VBURST_END_F2_SHIFT 0
  1598. #define TV_V_CTL_6 0x68050
  1599. /**
  1600. * Offset to start of vertical colorburst, measured in one less than the
  1601. * number of lines from vertical start.
  1602. */
  1603. # define TV_VBURST_START_F3_MASK 0x003f0000
  1604. # define TV_VBURST_START_F3_SHIFT 16
  1605. /**
  1606. * Offset to the end of vertical colorburst, measured in one less than the
  1607. * number of lines from the start of NBR.
  1608. */
  1609. # define TV_VBURST_END_F3_MASK 0x000000ff
  1610. # define TV_VBURST_END_F3_SHIFT 0
  1611. #define TV_V_CTL_7 0x68054
  1612. /**
  1613. * Offset to start of vertical colorburst, measured in one less than the
  1614. * number of lines from vertical start.
  1615. */
  1616. # define TV_VBURST_START_F4_MASK 0x003f0000
  1617. # define TV_VBURST_START_F4_SHIFT 16
  1618. /**
  1619. * Offset to the end of vertical colorburst, measured in one less than the
  1620. * number of lines from the start of NBR.
  1621. */
  1622. # define TV_VBURST_END_F4_MASK 0x000000ff
  1623. # define TV_VBURST_END_F4_SHIFT 0
  1624. #define TV_SC_CTL_1 0x68060
  1625. /** Turns on the first subcarrier phase generation DDA */
  1626. # define TV_SC_DDA1_EN (1 << 31)
  1627. /** Turns on the first subcarrier phase generation DDA */
  1628. # define TV_SC_DDA2_EN (1 << 30)
  1629. /** Turns on the first subcarrier phase generation DDA */
  1630. # define TV_SC_DDA3_EN (1 << 29)
  1631. /** Sets the subcarrier DDA to reset frequency every other field */
  1632. # define TV_SC_RESET_EVERY_2 (0 << 24)
  1633. /** Sets the subcarrier DDA to reset frequency every fourth field */
  1634. # define TV_SC_RESET_EVERY_4 (1 << 24)
  1635. /** Sets the subcarrier DDA to reset frequency every eighth field */
  1636. # define TV_SC_RESET_EVERY_8 (2 << 24)
  1637. /** Sets the subcarrier DDA to never reset the frequency */
  1638. # define TV_SC_RESET_NEVER (3 << 24)
  1639. /** Sets the peak amplitude of the colorburst.*/
  1640. # define TV_BURST_LEVEL_MASK 0x00ff0000
  1641. # define TV_BURST_LEVEL_SHIFT 16
  1642. /** Sets the increment of the first subcarrier phase generation DDA */
  1643. # define TV_SCDDA1_INC_MASK 0x00000fff
  1644. # define TV_SCDDA1_INC_SHIFT 0
  1645. #define TV_SC_CTL_2 0x68064
  1646. /** Sets the rollover for the second subcarrier phase generation DDA */
  1647. # define TV_SCDDA2_SIZE_MASK 0x7fff0000
  1648. # define TV_SCDDA2_SIZE_SHIFT 16
  1649. /** Sets the increent of the second subcarrier phase generation DDA */
  1650. # define TV_SCDDA2_INC_MASK 0x00007fff
  1651. # define TV_SCDDA2_INC_SHIFT 0
  1652. #define TV_SC_CTL_3 0x68068
  1653. /** Sets the rollover for the third subcarrier phase generation DDA */
  1654. # define TV_SCDDA3_SIZE_MASK 0x7fff0000
  1655. # define TV_SCDDA3_SIZE_SHIFT 16
  1656. /** Sets the increent of the third subcarrier phase generation DDA */
  1657. # define TV_SCDDA3_INC_MASK 0x00007fff
  1658. # define TV_SCDDA3_INC_SHIFT 0
  1659. #define TV_WIN_POS 0x68070
  1660. /** X coordinate of the display from the start of horizontal active */
  1661. # define TV_XPOS_MASK 0x1fff0000
  1662. # define TV_XPOS_SHIFT 16
  1663. /** Y coordinate of the display from the start of vertical active (NBR) */
  1664. # define TV_YPOS_MASK 0x00000fff
  1665. # define TV_YPOS_SHIFT 0
  1666. #define TV_WIN_SIZE 0x68074
  1667. /** Horizontal size of the display window, measured in pixels*/
  1668. # define TV_XSIZE_MASK 0x1fff0000
  1669. # define TV_XSIZE_SHIFT 16
  1670. /**
  1671. * Vertical size of the display window, measured in pixels.
  1672. *
  1673. * Must be even for interlaced modes.
  1674. */
  1675. # define TV_YSIZE_MASK 0x00000fff
  1676. # define TV_YSIZE_SHIFT 0
  1677. #define TV_FILTER_CTL_1 0x68080
  1678. /**
  1679. * Enables automatic scaling calculation.
  1680. *
  1681. * If set, the rest of the registers are ignored, and the calculated values can
  1682. * be read back from the register.
  1683. */
  1684. # define TV_AUTO_SCALE (1 << 31)
  1685. /**
  1686. * Disables the vertical filter.
  1687. *
  1688. * This is required on modes more than 1024 pixels wide */
  1689. # define TV_V_FILTER_BYPASS (1 << 29)
  1690. /** Enables adaptive vertical filtering */
  1691. # define TV_VADAPT (1 << 28)
  1692. # define TV_VADAPT_MODE_MASK (3 << 26)
  1693. /** Selects the least adaptive vertical filtering mode */
  1694. # define TV_VADAPT_MODE_LEAST (0 << 26)
  1695. /** Selects the moderately adaptive vertical filtering mode */
  1696. # define TV_VADAPT_MODE_MODERATE (1 << 26)
  1697. /** Selects the most adaptive vertical filtering mode */
  1698. # define TV_VADAPT_MODE_MOST (3 << 26)
  1699. /**
  1700. * Sets the horizontal scaling factor.
  1701. *
  1702. * This should be the fractional part of the horizontal scaling factor divided
  1703. * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
  1704. *
  1705. * (src width - 1) / ((oversample * dest width) - 1)
  1706. */
  1707. # define TV_HSCALE_FRAC_MASK 0x00003fff
  1708. # define TV_HSCALE_FRAC_SHIFT 0
  1709. #define TV_FILTER_CTL_2 0x68084
  1710. /**
  1711. * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
  1712. *
  1713. * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
  1714. */
  1715. # define TV_VSCALE_INT_MASK 0x00038000
  1716. # define TV_VSCALE_INT_SHIFT 15
  1717. /**
  1718. * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
  1719. *
  1720. * \sa TV_VSCALE_INT_MASK
  1721. */
  1722. # define TV_VSCALE_FRAC_MASK 0x00007fff
  1723. # define TV_VSCALE_FRAC_SHIFT 0
  1724. #define TV_FILTER_CTL_3 0x68088
  1725. /**
  1726. * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
  1727. *
  1728. * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
  1729. *
  1730. * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
  1731. */
  1732. # define TV_VSCALE_IP_INT_MASK 0x00038000
  1733. # define TV_VSCALE_IP_INT_SHIFT 15
  1734. /**
  1735. * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
  1736. *
  1737. * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
  1738. *
  1739. * \sa TV_VSCALE_IP_INT_MASK
  1740. */
  1741. # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
  1742. # define TV_VSCALE_IP_FRAC_SHIFT 0
  1743. #define TV_CC_CONTROL 0x68090
  1744. # define TV_CC_ENABLE (1 << 31)
  1745. /**
  1746. * Specifies which field to send the CC data in.
  1747. *
  1748. * CC data is usually sent in field 0.
  1749. */
  1750. # define TV_CC_FID_MASK (1 << 27)
  1751. # define TV_CC_FID_SHIFT 27
  1752. /** Sets the horizontal position of the CC data. Usually 135. */
  1753. # define TV_CC_HOFF_MASK 0x03ff0000
  1754. # define TV_CC_HOFF_SHIFT 16
  1755. /** Sets the vertical position of the CC data. Usually 21 */
  1756. # define TV_CC_LINE_MASK 0x0000003f
  1757. # define TV_CC_LINE_SHIFT 0
  1758. #define TV_CC_DATA 0x68094
  1759. # define TV_CC_RDY (1 << 31)
  1760. /** Second word of CC data to be transmitted. */
  1761. # define TV_CC_DATA_2_MASK 0x007f0000
  1762. # define TV_CC_DATA_2_SHIFT 16
  1763. /** First word of CC data to be transmitted. */
  1764. # define TV_CC_DATA_1_MASK 0x0000007f
  1765. # define TV_CC_DATA_1_SHIFT 0
  1766. #define TV_H_LUMA_0 0x68100
  1767. #define TV_H_LUMA_59 0x681ec
  1768. #define TV_H_CHROMA_0 0x68200
  1769. #define TV_H_CHROMA_59 0x682ec
  1770. #define TV_V_LUMA_0 0x68300
  1771. #define TV_V_LUMA_42 0x683a8
  1772. #define TV_V_CHROMA_0 0x68400
  1773. #define TV_V_CHROMA_42 0x684a8
  1774. /* Display Port */
  1775. #define DP_A 0x64000 /* eDP */
  1776. #define DP_B 0x64100
  1777. #define DP_C 0x64200
  1778. #define DP_D 0x64300
  1779. #define DP_PORT_EN (1 << 31)
  1780. #define DP_PIPEB_SELECT (1 << 30)
  1781. /* Link training mode - select a suitable mode for each stage */
  1782. #define DP_LINK_TRAIN_PAT_1 (0 << 28)
  1783. #define DP_LINK_TRAIN_PAT_2 (1 << 28)
  1784. #define DP_LINK_TRAIN_PAT_IDLE (2 << 28)
  1785. #define DP_LINK_TRAIN_OFF (3 << 28)
  1786. #define DP_LINK_TRAIN_MASK (3 << 28)
  1787. #define DP_LINK_TRAIN_SHIFT 28
  1788. /* CPT Link training mode */
  1789. #define DP_LINK_TRAIN_PAT_1_CPT (0 << 8)
  1790. #define DP_LINK_TRAIN_PAT_2_CPT (1 << 8)
  1791. #define DP_LINK_TRAIN_PAT_IDLE_CPT (2 << 8)
  1792. #define DP_LINK_TRAIN_OFF_CPT (3 << 8)
  1793. #define DP_LINK_TRAIN_MASK_CPT (7 << 8)
  1794. #define DP_LINK_TRAIN_SHIFT_CPT 8
  1795. /* Signal voltages. These are mostly controlled by the other end */
  1796. #define DP_VOLTAGE_0_4 (0 << 25)
  1797. #define DP_VOLTAGE_0_6 (1 << 25)
  1798. #define DP_VOLTAGE_0_8 (2 << 25)
  1799. #define DP_VOLTAGE_1_2 (3 << 25)
  1800. #define DP_VOLTAGE_MASK (7 << 25)
  1801. #define DP_VOLTAGE_SHIFT 25
  1802. /* Signal pre-emphasis levels, like voltages, the other end tells us what
  1803. * they want
  1804. */
  1805. #define DP_PRE_EMPHASIS_0 (0 << 22)
  1806. #define DP_PRE_EMPHASIS_3_5 (1 << 22)
  1807. #define DP_PRE_EMPHASIS_6 (2 << 22)
  1808. #define DP_PRE_EMPHASIS_9_5 (3 << 22)
  1809. #define DP_PRE_EMPHASIS_MASK (7 << 22)
  1810. #define DP_PRE_EMPHASIS_SHIFT 22
  1811. /* How many wires to use. I guess 3 was too hard */
  1812. #define DP_PORT_WIDTH_1 (0 << 19)
  1813. #define DP_PORT_WIDTH_2 (1 << 19)
  1814. #define DP_PORT_WIDTH_4 (3 << 19)
  1815. #define DP_PORT_WIDTH_MASK (7 << 19)
  1816. /* Mystic DPCD version 1.1 special mode */
  1817. #define DP_ENHANCED_FRAMING (1 << 18)
  1818. /* eDP */
  1819. #define DP_PLL_FREQ_270MHZ (0 << 16)
  1820. #define DP_PLL_FREQ_160MHZ (1 << 16)
  1821. #define DP_PLL_FREQ_MASK (3 << 16)
  1822. /** locked once port is enabled */
  1823. #define DP_PORT_REVERSAL (1 << 15)
  1824. /* eDP */
  1825. #define DP_PLL_ENABLE (1 << 14)
  1826. /** sends the clock on lane 15 of the PEG for debug */
  1827. #define DP_CLOCK_OUTPUT_ENABLE (1 << 13)
  1828. #define DP_SCRAMBLING_DISABLE (1 << 12)
  1829. #define DP_SCRAMBLING_DISABLE_IRONLAKE (1 << 7)
  1830. /** limit RGB values to avoid confusing TVs */
  1831. #define DP_COLOR_RANGE_16_235 (1 << 8)
  1832. /** Turn on the audio link */
  1833. #define DP_AUDIO_OUTPUT_ENABLE (1 << 6)
  1834. /** vs and hs sync polarity */
  1835. #define DP_SYNC_VS_HIGH (1 << 4)
  1836. #define DP_SYNC_HS_HIGH (1 << 3)
  1837. /** A fantasy */
  1838. #define DP_DETECTED (1 << 2)
  1839. /** The aux channel provides a way to talk to the
  1840. * signal sink for DDC etc. Max packet size supported
  1841. * is 20 bytes in each direction, hence the 5 fixed
  1842. * data registers
  1843. */
  1844. #define DPA_AUX_CH_CTL 0x64010
  1845. #define DPA_AUX_CH_DATA1 0x64014
  1846. #define DPA_AUX_CH_DATA2 0x64018
  1847. #define DPA_AUX_CH_DATA3 0x6401c
  1848. #define DPA_AUX_CH_DATA4 0x64020
  1849. #define DPA_AUX_CH_DATA5 0x64024
  1850. #define DPB_AUX_CH_CTL 0x64110
  1851. #define DPB_AUX_CH_DATA1 0x64114
  1852. #define DPB_AUX_CH_DATA2 0x64118
  1853. #define DPB_AUX_CH_DATA3 0x6411c
  1854. #define DPB_AUX_CH_DATA4 0x64120
  1855. #define DPB_AUX_CH_DATA5 0x64124
  1856. #define DPC_AUX_CH_CTL 0x64210
  1857. #define DPC_AUX_CH_DATA1 0x64214
  1858. #define DPC_AUX_CH_DATA2 0x64218
  1859. #define DPC_AUX_CH_DATA3 0x6421c
  1860. #define DPC_AUX_CH_DATA4 0x64220
  1861. #define DPC_AUX_CH_DATA5 0x64224
  1862. #define DPD_AUX_CH_CTL 0x64310
  1863. #define DPD_AUX_CH_DATA1 0x64314
  1864. #define DPD_AUX_CH_DATA2 0x64318
  1865. #define DPD_AUX_CH_DATA3 0x6431c
  1866. #define DPD_AUX_CH_DATA4 0x64320
  1867. #define DPD_AUX_CH_DATA5 0x64324
  1868. #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
  1869. #define DP_AUX_CH_CTL_DONE (1 << 30)
  1870. #define DP_AUX_CH_CTL_INTERRUPT (1 << 29)
  1871. #define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28)
  1872. #define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26)
  1873. #define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26)
  1874. #define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26)
  1875. #define DP_AUX_CH_CTL_TIME_OUT_1600us (3 << 26)
  1876. #define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26)
  1877. #define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25)
  1878. #define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
  1879. #define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20
  1880. #define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16)
  1881. #define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16
  1882. #define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15)
  1883. #define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14)
  1884. #define DP_AUX_CH_CTL_SYNC_TEST (1 << 13)
  1885. #define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12)
  1886. #define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)
  1887. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)
  1888. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0
  1889. /*
  1890. * Computing GMCH M and N values for the Display Port link
  1891. *
  1892. * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
  1893. *
  1894. * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
  1895. *
  1896. * The GMCH value is used internally
  1897. *
  1898. * bytes_per_pixel is the number of bytes coming out of the plane,
  1899. * which is after the LUTs, so we want the bytes for our color format.
  1900. * For our current usage, this is always 3, one byte for R, G and B.
  1901. */
  1902. #define PIPEA_GMCH_DATA_M 0x70050
  1903. #define PIPEB_GMCH_DATA_M 0x71050
  1904. /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
  1905. #define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
  1906. #define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
  1907. #define PIPE_GMCH_DATA_M_MASK (0xffffff)
  1908. #define PIPEA_GMCH_DATA_N 0x70054
  1909. #define PIPEB_GMCH_DATA_N 0x71054
  1910. #define PIPE_GMCH_DATA_N_MASK (0xffffff)
  1911. /*
  1912. * Computing Link M and N values for the Display Port link
  1913. *
  1914. * Link M / N = pixel_clock / ls_clk
  1915. *
  1916. * (the DP spec calls pixel_clock the 'strm_clk')
  1917. *
  1918. * The Link value is transmitted in the Main Stream
  1919. * Attributes and VB-ID.
  1920. */
  1921. #define PIPEA_DP_LINK_M 0x70060
  1922. #define PIPEB_DP_LINK_M 0x71060
  1923. #define PIPEA_DP_LINK_M_MASK (0xffffff)
  1924. #define PIPEA_DP_LINK_N 0x70064
  1925. #define PIPEB_DP_LINK_N 0x71064
  1926. #define PIPEA_DP_LINK_N_MASK (0xffffff)
  1927. /* Display & cursor control */
  1928. /* dithering flag on Ironlake */
  1929. #define PIPE_ENABLE_DITHER (1 << 4)
  1930. #define PIPE_DITHER_TYPE_MASK (3 << 2)
  1931. #define PIPE_DITHER_TYPE_SPATIAL (0 << 2)
  1932. #define PIPE_DITHER_TYPE_ST01 (1 << 2)
  1933. /* Pipe A */
  1934. #define PIPEADSL 0x70000
  1935. #define PIPEACONF 0x70008
  1936. #define PIPEACONF_ENABLE (1<<31)
  1937. #define PIPEACONF_DISABLE 0
  1938. #define PIPEACONF_DOUBLE_WIDE (1<<30)
  1939. #define I965_PIPECONF_ACTIVE (1<<30)
  1940. #define PIPEACONF_SINGLE_WIDE 0
  1941. #define PIPEACONF_PIPE_UNLOCKED 0
  1942. #define PIPEACONF_PIPE_LOCKED (1<<25)
  1943. #define PIPEACONF_PALETTE 0
  1944. #define PIPEACONF_GAMMA (1<<24)
  1945. #define PIPECONF_FORCE_BORDER (1<<25)
  1946. #define PIPECONF_PROGRESSIVE (0 << 21)
  1947. #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
  1948. #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
  1949. #define PIPECONF_CXSR_DOWNCLOCK (1<<16)
  1950. #define PIPEASTAT 0x70024
  1951. #define PIPE_FIFO_UNDERRUN_STATUS (1UL<<31)
  1952. #define PIPE_CRC_ERROR_ENABLE (1UL<<29)
  1953. #define PIPE_CRC_DONE_ENABLE (1UL<<28)
  1954. #define PIPE_GMBUS_EVENT_ENABLE (1UL<<27)
  1955. #define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL<<26)
  1956. #define PIPE_VSYNC_INTERRUPT_ENABLE (1UL<<25)
  1957. #define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
  1958. #define PIPE_DPST_EVENT_ENABLE (1UL<<23)
  1959. #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
  1960. #define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
  1961. #define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
  1962. #define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL<<18) /* pre-965 */
  1963. #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
  1964. #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL<<17)
  1965. #define PIPE_OVERLAY_UPDATED_ENABLE (1UL<<16)
  1966. #define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
  1967. #define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
  1968. #define PIPE_GMBUS_INTERRUPT_STATUS (1UL<<11)
  1969. #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL<<10)
  1970. #define PIPE_VSYNC_INTERRUPT_STATUS (1UL<<9)
  1971. #define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
  1972. #define PIPE_DPST_EVENT_STATUS (1UL<<7)
  1973. #define PIPE_LEGACY_BLC_EVENT_STATUS (1UL<<6)
  1974. #define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
  1975. #define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
  1976. #define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL<<2) /* pre-965 */
  1977. #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
  1978. #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
  1979. #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
  1980. #define PIPE_BPC_MASK (7 << 5) /* Ironlake */
  1981. #define PIPE_8BPC (0 << 5)
  1982. #define PIPE_10BPC (1 << 5)
  1983. #define PIPE_6BPC (2 << 5)
  1984. #define PIPE_12BPC (3 << 5)
  1985. #define DSPARB 0x70030
  1986. #define DSPARB_CSTART_MASK (0x7f << 7)
  1987. #define DSPARB_CSTART_SHIFT 7
  1988. #define DSPARB_BSTART_MASK (0x7f)
  1989. #define DSPARB_BSTART_SHIFT 0
  1990. #define DSPARB_BEND_SHIFT 9 /* on 855 */
  1991. #define DSPARB_AEND_SHIFT 0
  1992. #define DSPFW1 0x70034
  1993. #define DSPFW_SR_SHIFT 23
  1994. #define DSPFW_SR_MASK (0x1ff<<23)
  1995. #define DSPFW_CURSORB_SHIFT 16
  1996. #define DSPFW_CURSORB_MASK (0x3f<<16)
  1997. #define DSPFW_PLANEB_SHIFT 8
  1998. #define DSPFW_PLANEB_MASK (0x7f<<8)
  1999. #define DSPFW_PLANEA_MASK (0x7f)
  2000. #define DSPFW2 0x70038
  2001. #define DSPFW_CURSORA_MASK 0x00003f00
  2002. #define DSPFW_CURSORA_SHIFT 8
  2003. #define DSPFW_PLANEC_MASK (0x7f)
  2004. #define DSPFW3 0x7003c
  2005. #define DSPFW_HPLL_SR_EN (1<<31)
  2006. #define DSPFW_CURSOR_SR_SHIFT 24
  2007. #define PINEVIEW_SELF_REFRESH_EN (1<<30)
  2008. #define DSPFW_CURSOR_SR_MASK (0x3f<<24)
  2009. #define DSPFW_HPLL_CURSOR_SHIFT 16
  2010. #define DSPFW_HPLL_CURSOR_MASK (0x3f<<16)
  2011. #define DSPFW_HPLL_SR_MASK (0x1ff)
  2012. /* FIFO watermark sizes etc */
  2013. #define G4X_FIFO_LINE_SIZE 64
  2014. #define I915_FIFO_LINE_SIZE 64
  2015. #define I830_FIFO_LINE_SIZE 32
  2016. #define G4X_FIFO_SIZE 127
  2017. #define I945_FIFO_SIZE 127 /* 945 & 965 */
  2018. #define I915_FIFO_SIZE 95
  2019. #define I855GM_FIFO_SIZE 127 /* In cachelines */
  2020. #define I830_FIFO_SIZE 95
  2021. #define G4X_MAX_WM 0x3f
  2022. #define I915_MAX_WM 0x3f
  2023. #define PINEVIEW_DISPLAY_FIFO 512 /* in 64byte unit */
  2024. #define PINEVIEW_FIFO_LINE_SIZE 64
  2025. #define PINEVIEW_MAX_WM 0x1ff
  2026. #define PINEVIEW_DFT_WM 0x3f
  2027. #define PINEVIEW_DFT_HPLLOFF_WM 0
  2028. #define PINEVIEW_GUARD_WM 10
  2029. #define PINEVIEW_CURSOR_FIFO 64
  2030. #define PINEVIEW_CURSOR_MAX_WM 0x3f
  2031. #define PINEVIEW_CURSOR_DFT_WM 0
  2032. #define PINEVIEW_CURSOR_GUARD_WM 5
  2033. /* define the Watermark register on Ironlake */
  2034. #define WM0_PIPEA_ILK 0x45100
  2035. #define WM0_PIPE_PLANE_MASK (0x7f<<16)
  2036. #define WM0_PIPE_PLANE_SHIFT 16
  2037. #define WM0_PIPE_SPRITE_MASK (0x3f<<8)
  2038. #define WM0_PIPE_SPRITE_SHIFT 8
  2039. #define WM0_PIPE_CURSOR_MASK (0x1f)
  2040. #define WM0_PIPEB_ILK 0x45104
  2041. #define WM1_LP_ILK 0x45108
  2042. #define WM1_LP_SR_EN (1<<31)
  2043. #define WM1_LP_LATENCY_SHIFT 24
  2044. #define WM1_LP_LATENCY_MASK (0x7f<<24)
  2045. #define WM1_LP_SR_MASK (0x1ff<<8)
  2046. #define WM1_LP_SR_SHIFT 8
  2047. #define WM1_LP_CURSOR_MASK (0x3f)
  2048. /* Memory latency timer register */
  2049. #define MLTR_ILK 0x11222
  2050. /* the unit of memory self-refresh latency time is 0.5us */
  2051. #define ILK_SRLT_MASK 0x3f
  2052. /* define the fifo size on Ironlake */
  2053. #define ILK_DISPLAY_FIFO 128
  2054. #define ILK_DISPLAY_MAXWM 64
  2055. #define ILK_DISPLAY_DFTWM 8
  2056. #define ILK_DISPLAY_SR_FIFO 512
  2057. #define ILK_DISPLAY_MAX_SRWM 0x1ff
  2058. #define ILK_DISPLAY_DFT_SRWM 0x3f
  2059. #define ILK_CURSOR_SR_FIFO 64
  2060. #define ILK_CURSOR_MAX_SRWM 0x3f
  2061. #define ILK_CURSOR_DFT_SRWM 8
  2062. #define ILK_FIFO_LINE_SIZE 64
  2063. /*
  2064. * The two pipe frame counter registers are not synchronized, so
  2065. * reading a stable value is somewhat tricky. The following code
  2066. * should work:
  2067. *
  2068. * do {
  2069. * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
  2070. * PIPE_FRAME_HIGH_SHIFT;
  2071. * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
  2072. * PIPE_FRAME_LOW_SHIFT);
  2073. * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
  2074. * PIPE_FRAME_HIGH_SHIFT);
  2075. * } while (high1 != high2);
  2076. * frame = (high1 << 8) | low1;
  2077. */
  2078. #define PIPEAFRAMEHIGH 0x70040
  2079. #define PIPE_FRAME_HIGH_MASK 0x0000ffff
  2080. #define PIPE_FRAME_HIGH_SHIFT 0
  2081. #define PIPEAFRAMEPIXEL 0x70044
  2082. #define PIPE_FRAME_LOW_MASK 0xff000000
  2083. #define PIPE_FRAME_LOW_SHIFT 24
  2084. #define PIPE_PIXEL_MASK 0x00ffffff
  2085. #define PIPE_PIXEL_SHIFT 0
  2086. /* GM45+ just has to be different */
  2087. #define PIPEA_FRMCOUNT_GM45 0x70040
  2088. #define PIPEA_FLIPCOUNT_GM45 0x70044
  2089. /* Cursor A & B regs */
  2090. #define CURACNTR 0x70080
  2091. /* Old style CUR*CNTR flags (desktop 8xx) */
  2092. #define CURSOR_ENABLE 0x80000000
  2093. #define CURSOR_GAMMA_ENABLE 0x40000000
  2094. #define CURSOR_STRIDE_MASK 0x30000000
  2095. #define CURSOR_FORMAT_SHIFT 24
  2096. #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
  2097. #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
  2098. #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
  2099. #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
  2100. #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
  2101. #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
  2102. /* New style CUR*CNTR flags */
  2103. #define CURSOR_MODE 0x27
  2104. #define CURSOR_MODE_DISABLE 0x00
  2105. #define CURSOR_MODE_64_32B_AX 0x07
  2106. #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
  2107. #define MCURSOR_PIPE_SELECT (1 << 28)
  2108. #define MCURSOR_PIPE_A 0x00
  2109. #define MCURSOR_PIPE_B (1 << 28)
  2110. #define MCURSOR_GAMMA_ENABLE (1 << 26)
  2111. #define CURABASE 0x70084
  2112. #define CURAPOS 0x70088
  2113. #define CURSOR_POS_MASK 0x007FF
  2114. #define CURSOR_POS_SIGN 0x8000
  2115. #define CURSOR_X_SHIFT 0
  2116. #define CURSOR_Y_SHIFT 16
  2117. #define CURSIZE 0x700a0
  2118. #define CURBCNTR 0x700c0
  2119. #define CURBBASE 0x700c4
  2120. #define CURBPOS 0x700c8
  2121. /* Display A control */
  2122. #define DSPACNTR 0x70180
  2123. #define DISPLAY_PLANE_ENABLE (1<<31)
  2124. #define DISPLAY_PLANE_DISABLE 0
  2125. #define DISPPLANE_GAMMA_ENABLE (1<<30)
  2126. #define DISPPLANE_GAMMA_DISABLE 0
  2127. #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
  2128. #define DISPPLANE_8BPP (0x2<<26)
  2129. #define DISPPLANE_15_16BPP (0x4<<26)
  2130. #define DISPPLANE_16BPP (0x5<<26)
  2131. #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
  2132. #define DISPPLANE_32BPP (0x7<<26)
  2133. #define DISPPLANE_32BPP_30BIT_NO_ALPHA (0xa<<26)
  2134. #define DISPPLANE_STEREO_ENABLE (1<<25)
  2135. #define DISPPLANE_STEREO_DISABLE 0
  2136. #define DISPPLANE_SEL_PIPE_MASK (1<<24)
  2137. #define DISPPLANE_SEL_PIPE_A 0
  2138. #define DISPPLANE_SEL_PIPE_B (1<<24)
  2139. #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
  2140. #define DISPPLANE_SRC_KEY_DISABLE 0
  2141. #define DISPPLANE_LINE_DOUBLE (1<<20)
  2142. #define DISPPLANE_NO_LINE_DOUBLE 0
  2143. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  2144. #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
  2145. #define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* Ironlake */
  2146. #define DISPPLANE_TILED (1<<10)
  2147. #define DSPAADDR 0x70184
  2148. #define DSPASTRIDE 0x70188
  2149. #define DSPAPOS 0x7018C /* reserved */
  2150. #define DSPASIZE 0x70190
  2151. #define DSPASURF 0x7019C /* 965+ only */
  2152. #define DSPATILEOFF 0x701A4 /* 965+ only */
  2153. /* VBIOS flags */
  2154. #define SWF00 0x71410
  2155. #define SWF01 0x71414
  2156. #define SWF02 0x71418
  2157. #define SWF03 0x7141c
  2158. #define SWF04 0x71420
  2159. #define SWF05 0x71424
  2160. #define SWF06 0x71428
  2161. #define SWF10 0x70410
  2162. #define SWF11 0x70414
  2163. #define SWF14 0x71420
  2164. #define SWF30 0x72414
  2165. #define SWF31 0x72418
  2166. #define SWF32 0x7241c
  2167. /* Pipe B */
  2168. #define PIPEBDSL 0x71000
  2169. #define PIPEBCONF 0x71008
  2170. #define PIPEBSTAT 0x71024
  2171. #define PIPEBFRAMEHIGH 0x71040
  2172. #define PIPEBFRAMEPIXEL 0x71044
  2173. #define PIPEB_FRMCOUNT_GM45 0x71040
  2174. #define PIPEB_FLIPCOUNT_GM45 0x71044
  2175. /* Display B control */
  2176. #define DSPBCNTR 0x71180
  2177. #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
  2178. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  2179. #define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
  2180. #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
  2181. #define DSPBADDR 0x71184
  2182. #define DSPBSTRIDE 0x71188
  2183. #define DSPBPOS 0x7118C
  2184. #define DSPBSIZE 0x71190
  2185. #define DSPBSURF 0x7119C
  2186. #define DSPBTILEOFF 0x711A4
  2187. /* VBIOS regs */
  2188. #define VGACNTRL 0x71400
  2189. # define VGA_DISP_DISABLE (1 << 31)
  2190. # define VGA_2X_MODE (1 << 30)
  2191. # define VGA_PIPE_B_SELECT (1 << 29)
  2192. /* Ironlake */
  2193. #define CPU_VGACNTRL 0x41000
  2194. #define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030
  2195. #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
  2196. #define DIGITAL_PORTA_SHORT_PULSE_2MS (0 << 2)
  2197. #define DIGITAL_PORTA_SHORT_PULSE_4_5MS (1 << 2)
  2198. #define DIGITAL_PORTA_SHORT_PULSE_6MS (2 << 2)
  2199. #define DIGITAL_PORTA_SHORT_PULSE_100MS (3 << 2)
  2200. #define DIGITAL_PORTA_NO_DETECT (0 << 0)
  2201. #define DIGITAL_PORTA_LONG_PULSE_DETECT_MASK (1 << 1)
  2202. #define DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK (1 << 0)
  2203. /* refresh rate hardware control */
  2204. #define RR_HW_CTL 0x45300
  2205. #define RR_HW_LOW_POWER_FRAMES_MASK 0xff
  2206. #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
  2207. #define FDI_PLL_BIOS_0 0x46000
  2208. #define FDI_PLL_BIOS_1 0x46004
  2209. #define FDI_PLL_BIOS_2 0x46008
  2210. #define DISPLAY_PORT_PLL_BIOS_0 0x4600c
  2211. #define DISPLAY_PORT_PLL_BIOS_1 0x46010
  2212. #define DISPLAY_PORT_PLL_BIOS_2 0x46014
  2213. #define PCH_DSPCLK_GATE_D 0x42020
  2214. # define DPFDUNIT_CLOCK_GATE_DISABLE (1 << 7)
  2215. # define DPARBUNIT_CLOCK_GATE_DISABLE (1 << 5)
  2216. #define PCH_3DCGDIS0 0x46020
  2217. # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
  2218. # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
  2219. #define FDI_PLL_FREQ_CTL 0x46030
  2220. #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
  2221. #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
  2222. #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
  2223. #define PIPEA_DATA_M1 0x60030
  2224. #define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */
  2225. #define TU_SIZE_MASK 0x7e000000
  2226. #define PIPEA_DATA_M1_OFFSET 0
  2227. #define PIPEA_DATA_N1 0x60034
  2228. #define PIPEA_DATA_N1_OFFSET 0
  2229. #define PIPEA_DATA_M2 0x60038
  2230. #define PIPEA_DATA_M2_OFFSET 0
  2231. #define PIPEA_DATA_N2 0x6003c
  2232. #define PIPEA_DATA_N2_OFFSET 0
  2233. #define PIPEA_LINK_M1 0x60040
  2234. #define PIPEA_LINK_M1_OFFSET 0
  2235. #define PIPEA_LINK_N1 0x60044
  2236. #define PIPEA_LINK_N1_OFFSET 0
  2237. #define PIPEA_LINK_M2 0x60048
  2238. #define PIPEA_LINK_M2_OFFSET 0
  2239. #define PIPEA_LINK_N2 0x6004c
  2240. #define PIPEA_LINK_N2_OFFSET 0
  2241. /* PIPEB timing regs are same start from 0x61000 */
  2242. #define PIPEB_DATA_M1 0x61030
  2243. #define PIPEB_DATA_M1_OFFSET 0
  2244. #define PIPEB_DATA_N1 0x61034
  2245. #define PIPEB_DATA_N1_OFFSET 0
  2246. #define PIPEB_DATA_M2 0x61038
  2247. #define PIPEB_DATA_M2_OFFSET 0
  2248. #define PIPEB_DATA_N2 0x6103c
  2249. #define PIPEB_DATA_N2_OFFSET 0
  2250. #define PIPEB_LINK_M1 0x61040
  2251. #define PIPEB_LINK_M1_OFFSET 0
  2252. #define PIPEB_LINK_N1 0x61044
  2253. #define PIPEB_LINK_N1_OFFSET 0
  2254. #define PIPEB_LINK_M2 0x61048
  2255. #define PIPEB_LINK_M2_OFFSET 0
  2256. #define PIPEB_LINK_N2 0x6104c
  2257. #define PIPEB_LINK_N2_OFFSET 0
  2258. /* CPU panel fitter */
  2259. #define PFA_CTL_1 0x68080
  2260. #define PFB_CTL_1 0x68880
  2261. #define PF_ENABLE (1<<31)
  2262. #define PF_FILTER_MASK (3<<23)
  2263. #define PF_FILTER_PROGRAMMED (0<<23)
  2264. #define PF_FILTER_MED_3x3 (1<<23)
  2265. #define PF_FILTER_EDGE_ENHANCE (2<<23)
  2266. #define PF_FILTER_EDGE_SOFTEN (3<<23)
  2267. #define PFA_WIN_SZ 0x68074
  2268. #define PFB_WIN_SZ 0x68874
  2269. #define PFA_WIN_POS 0x68070
  2270. #define PFB_WIN_POS 0x68870
  2271. /* legacy palette */
  2272. #define LGC_PALETTE_A 0x4a000
  2273. #define LGC_PALETTE_B 0x4a800
  2274. /* interrupts */
  2275. #define DE_MASTER_IRQ_CONTROL (1 << 31)
  2276. #define DE_SPRITEB_FLIP_DONE (1 << 29)
  2277. #define DE_SPRITEA_FLIP_DONE (1 << 28)
  2278. #define DE_PLANEB_FLIP_DONE (1 << 27)
  2279. #define DE_PLANEA_FLIP_DONE (1 << 26)
  2280. #define DE_PCU_EVENT (1 << 25)
  2281. #define DE_GTT_FAULT (1 << 24)
  2282. #define DE_POISON (1 << 23)
  2283. #define DE_PERFORM_COUNTER (1 << 22)
  2284. #define DE_PCH_EVENT (1 << 21)
  2285. #define DE_AUX_CHANNEL_A (1 << 20)
  2286. #define DE_DP_A_HOTPLUG (1 << 19)
  2287. #define DE_GSE (1 << 18)
  2288. #define DE_PIPEB_VBLANK (1 << 15)
  2289. #define DE_PIPEB_EVEN_FIELD (1 << 14)
  2290. #define DE_PIPEB_ODD_FIELD (1 << 13)
  2291. #define DE_PIPEB_LINE_COMPARE (1 << 12)
  2292. #define DE_PIPEB_VSYNC (1 << 11)
  2293. #define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
  2294. #define DE_PIPEA_VBLANK (1 << 7)
  2295. #define DE_PIPEA_EVEN_FIELD (1 << 6)
  2296. #define DE_PIPEA_ODD_FIELD (1 << 5)
  2297. #define DE_PIPEA_LINE_COMPARE (1 << 4)
  2298. #define DE_PIPEA_VSYNC (1 << 3)
  2299. #define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
  2300. #define DEISR 0x44000
  2301. #define DEIMR 0x44004
  2302. #define DEIIR 0x44008
  2303. #define DEIER 0x4400c
  2304. /* GT interrupt */
  2305. #define GT_PIPE_NOTIFY (1 << 4)
  2306. #define GT_SYNC_STATUS (1 << 2)
  2307. #define GT_USER_INTERRUPT (1 << 0)
  2308. #define GT_BSD_USER_INTERRUPT (1 << 5)
  2309. #define GTISR 0x44010
  2310. #define GTIMR 0x44014
  2311. #define GTIIR 0x44018
  2312. #define GTIER 0x4401c
  2313. #define ILK_DISPLAY_CHICKEN2 0x42004
  2314. #define ILK_DPARB_GATE (1<<22)
  2315. #define ILK_VSDPFD_FULL (1<<21)
  2316. #define ILK_DSPCLK_GATE 0x42020
  2317. #define ILK_DPARB_CLK_GATE (1<<5)
  2318. #define DISP_ARB_CTL 0x45000
  2319. #define DISP_TILE_SURFACE_SWIZZLING (1<<13)
  2320. #define DISP_FBC_WM_DIS (1<<15)
  2321. /* PCH */
  2322. /* south display engine interrupt */
  2323. #define SDE_CRT_HOTPLUG (1 << 11)
  2324. #define SDE_PORTD_HOTPLUG (1 << 10)
  2325. #define SDE_PORTC_HOTPLUG (1 << 9)
  2326. #define SDE_PORTB_HOTPLUG (1 << 8)
  2327. #define SDE_SDVOB_HOTPLUG (1 << 6)
  2328. #define SDE_HOTPLUG_MASK (0xf << 8)
  2329. /* CPT */
  2330. #define SDE_CRT_HOTPLUG_CPT (1 << 19)
  2331. #define SDE_PORTD_HOTPLUG_CPT (1 << 23)
  2332. #define SDE_PORTC_HOTPLUG_CPT (1 << 22)
  2333. #define SDE_PORTB_HOTPLUG_CPT (1 << 21)
  2334. #define SDEISR 0xc4000
  2335. #define SDEIMR 0xc4004
  2336. #define SDEIIR 0xc4008
  2337. #define SDEIER 0xc400c
  2338. /* digital port hotplug */
  2339. #define PCH_PORT_HOTPLUG 0xc4030
  2340. #define PORTD_HOTPLUG_ENABLE (1 << 20)
  2341. #define PORTD_PULSE_DURATION_2ms (0)
  2342. #define PORTD_PULSE_DURATION_4_5ms (1 << 18)
  2343. #define PORTD_PULSE_DURATION_6ms (2 << 18)
  2344. #define PORTD_PULSE_DURATION_100ms (3 << 18)
  2345. #define PORTD_HOTPLUG_NO_DETECT (0)
  2346. #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
  2347. #define PORTD_HOTPLUG_LONG_DETECT (1 << 17)
  2348. #define PORTC_HOTPLUG_ENABLE (1 << 12)
  2349. #define PORTC_PULSE_DURATION_2ms (0)
  2350. #define PORTC_PULSE_DURATION_4_5ms (1 << 10)
  2351. #define PORTC_PULSE_DURATION_6ms (2 << 10)
  2352. #define PORTC_PULSE_DURATION_100ms (3 << 10)
  2353. #define PORTC_HOTPLUG_NO_DETECT (0)
  2354. #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
  2355. #define PORTC_HOTPLUG_LONG_DETECT (1 << 9)
  2356. #define PORTB_HOTPLUG_ENABLE (1 << 4)
  2357. #define PORTB_PULSE_DURATION_2ms (0)
  2358. #define PORTB_PULSE_DURATION_4_5ms (1 << 2)
  2359. #define PORTB_PULSE_DURATION_6ms (2 << 2)
  2360. #define PORTB_PULSE_DURATION_100ms (3 << 2)
  2361. #define PORTB_HOTPLUG_NO_DETECT (0)
  2362. #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
  2363. #define PORTB_HOTPLUG_LONG_DETECT (1 << 1)
  2364. #define PCH_GPIOA 0xc5010
  2365. #define PCH_GPIOB 0xc5014
  2366. #define PCH_GPIOC 0xc5018
  2367. #define PCH_GPIOD 0xc501c
  2368. #define PCH_GPIOE 0xc5020
  2369. #define PCH_GPIOF 0xc5024
  2370. #define PCH_GMBUS0 0xc5100
  2371. #define PCH_GMBUS1 0xc5104
  2372. #define PCH_GMBUS2 0xc5108
  2373. #define PCH_GMBUS3 0xc510c
  2374. #define PCH_GMBUS4 0xc5110
  2375. #define PCH_GMBUS5 0xc5120
  2376. #define PCH_DPLL_A 0xc6014
  2377. #define PCH_DPLL_B 0xc6018
  2378. #define PCH_FPA0 0xc6040
  2379. #define PCH_FPA1 0xc6044
  2380. #define PCH_FPB0 0xc6048
  2381. #define PCH_FPB1 0xc604c
  2382. #define PCH_DPLL_TEST 0xc606c
  2383. #define PCH_DREF_CONTROL 0xC6200
  2384. #define DREF_CONTROL_MASK 0x7fc3
  2385. #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
  2386. #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
  2387. #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13)
  2388. #define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13)
  2389. #define DREF_SSC_SOURCE_DISABLE (0<<11)
  2390. #define DREF_SSC_SOURCE_ENABLE (2<<11)
  2391. #define DREF_SSC_SOURCE_MASK (3<<11)
  2392. #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
  2393. #define DREF_NONSPREAD_CK505_ENABLE (1<<9)
  2394. #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
  2395. #define DREF_NONSPREAD_SOURCE_MASK (3<<9)
  2396. #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
  2397. #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
  2398. #define DREF_SSC4_DOWNSPREAD (0<<6)
  2399. #define DREF_SSC4_CENTERSPREAD (1<<6)
  2400. #define DREF_SSC1_DISABLE (0<<1)
  2401. #define DREF_SSC1_ENABLE (1<<1)
  2402. #define DREF_SSC4_DISABLE (0)
  2403. #define DREF_SSC4_ENABLE (1)
  2404. #define PCH_RAWCLK_FREQ 0xc6204
  2405. #define FDL_TP1_TIMER_SHIFT 12
  2406. #define FDL_TP1_TIMER_MASK (3<<12)
  2407. #define FDL_TP2_TIMER_SHIFT 10
  2408. #define FDL_TP2_TIMER_MASK (3<<10)
  2409. #define RAWCLK_FREQ_MASK 0x3ff
  2410. #define PCH_DPLL_TMR_CFG 0xc6208
  2411. #define PCH_SSC4_PARMS 0xc6210
  2412. #define PCH_SSC4_AUX_PARMS 0xc6214
  2413. #define PCH_DPLL_SEL 0xc7000
  2414. #define TRANSA_DPLL_ENABLE (1<<3)
  2415. #define TRANSA_DPLLB_SEL (1<<0)
  2416. #define TRANSA_DPLLA_SEL 0
  2417. #define TRANSB_DPLL_ENABLE (1<<7)
  2418. #define TRANSB_DPLLB_SEL (1<<4)
  2419. #define TRANSB_DPLLA_SEL (0)
  2420. #define TRANSC_DPLL_ENABLE (1<<11)
  2421. #define TRANSC_DPLLB_SEL (1<<8)
  2422. #define TRANSC_DPLLA_SEL (0)
  2423. /* transcoder */
  2424. #define TRANS_HTOTAL_A 0xe0000
  2425. #define TRANS_HTOTAL_SHIFT 16
  2426. #define TRANS_HACTIVE_SHIFT 0
  2427. #define TRANS_HBLANK_A 0xe0004
  2428. #define TRANS_HBLANK_END_SHIFT 16
  2429. #define TRANS_HBLANK_START_SHIFT 0
  2430. #define TRANS_HSYNC_A 0xe0008
  2431. #define TRANS_HSYNC_END_SHIFT 16
  2432. #define TRANS_HSYNC_START_SHIFT 0
  2433. #define TRANS_VTOTAL_A 0xe000c
  2434. #define TRANS_VTOTAL_SHIFT 16
  2435. #define TRANS_VACTIVE_SHIFT 0
  2436. #define TRANS_VBLANK_A 0xe0010
  2437. #define TRANS_VBLANK_END_SHIFT 16
  2438. #define TRANS_VBLANK_START_SHIFT 0
  2439. #define TRANS_VSYNC_A 0xe0014
  2440. #define TRANS_VSYNC_END_SHIFT 16
  2441. #define TRANS_VSYNC_START_SHIFT 0
  2442. #define TRANSA_DATA_M1 0xe0030
  2443. #define TRANSA_DATA_N1 0xe0034
  2444. #define TRANSA_DATA_M2 0xe0038
  2445. #define TRANSA_DATA_N2 0xe003c
  2446. #define TRANSA_DP_LINK_M1 0xe0040
  2447. #define TRANSA_DP_LINK_N1 0xe0044
  2448. #define TRANSA_DP_LINK_M2 0xe0048
  2449. #define TRANSA_DP_LINK_N2 0xe004c
  2450. #define TRANS_HTOTAL_B 0xe1000
  2451. #define TRANS_HBLANK_B 0xe1004
  2452. #define TRANS_HSYNC_B 0xe1008
  2453. #define TRANS_VTOTAL_B 0xe100c
  2454. #define TRANS_VBLANK_B 0xe1010
  2455. #define TRANS_VSYNC_B 0xe1014
  2456. #define TRANSB_DATA_M1 0xe1030
  2457. #define TRANSB_DATA_N1 0xe1034
  2458. #define TRANSB_DATA_M2 0xe1038
  2459. #define TRANSB_DATA_N2 0xe103c
  2460. #define TRANSB_DP_LINK_M1 0xe1040
  2461. #define TRANSB_DP_LINK_N1 0xe1044
  2462. #define TRANSB_DP_LINK_M2 0xe1048
  2463. #define TRANSB_DP_LINK_N2 0xe104c
  2464. #define TRANSACONF 0xf0008
  2465. #define TRANSBCONF 0xf1008
  2466. #define TRANS_DISABLE (0<<31)
  2467. #define TRANS_ENABLE (1<<31)
  2468. #define TRANS_STATE_MASK (1<<30)
  2469. #define TRANS_STATE_DISABLE (0<<30)
  2470. #define TRANS_STATE_ENABLE (1<<30)
  2471. #define TRANS_FSYNC_DELAY_HB1 (0<<27)
  2472. #define TRANS_FSYNC_DELAY_HB2 (1<<27)
  2473. #define TRANS_FSYNC_DELAY_HB3 (2<<27)
  2474. #define TRANS_FSYNC_DELAY_HB4 (3<<27)
  2475. #define TRANS_DP_AUDIO_ONLY (1<<26)
  2476. #define TRANS_DP_VIDEO_AUDIO (0<<26)
  2477. #define TRANS_PROGRESSIVE (0<<21)
  2478. #define TRANS_8BPC (0<<5)
  2479. #define TRANS_10BPC (1<<5)
  2480. #define TRANS_6BPC (2<<5)
  2481. #define TRANS_12BPC (3<<5)
  2482. #define FDI_RXA_CHICKEN 0xc200c
  2483. #define FDI_RXB_CHICKEN 0xc2010
  2484. #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
  2485. /* CPU: FDI_TX */
  2486. #define FDI_TXA_CTL 0x60100
  2487. #define FDI_TXB_CTL 0x61100
  2488. #define FDI_TX_DISABLE (0<<31)
  2489. #define FDI_TX_ENABLE (1<<31)
  2490. #define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
  2491. #define FDI_LINK_TRAIN_PATTERN_2 (1<<28)
  2492. #define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28)
  2493. #define FDI_LINK_TRAIN_NONE (3<<28)
  2494. #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25)
  2495. #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25)
  2496. #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25)
  2497. #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25)
  2498. #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)
  2499. #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)
  2500. #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22)
  2501. #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22)
  2502. /* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.
  2503. SNB has different settings. */
  2504. /* SNB A-stepping */
  2505. #define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
  2506. #define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
  2507. #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
  2508. #define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
  2509. /* SNB B-stepping */
  2510. #define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
  2511. #define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
  2512. #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
  2513. #define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
  2514. #define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f<<22)
  2515. #define FDI_DP_PORT_WIDTH_X1 (0<<19)
  2516. #define FDI_DP_PORT_WIDTH_X2 (1<<19)
  2517. #define FDI_DP_PORT_WIDTH_X3 (2<<19)
  2518. #define FDI_DP_PORT_WIDTH_X4 (3<<19)
  2519. #define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18)
  2520. /* Ironlake: hardwired to 1 */
  2521. #define FDI_TX_PLL_ENABLE (1<<14)
  2522. /* both Tx and Rx */
  2523. #define FDI_SCRAMBLING_ENABLE (0<<7)
  2524. #define FDI_SCRAMBLING_DISABLE (1<<7)
  2525. /* FDI_RX, FDI_X is hard-wired to Transcoder_X */
  2526. #define FDI_RXA_CTL 0xf000c
  2527. #define FDI_RXB_CTL 0xf100c
  2528. #define FDI_RX_ENABLE (1<<31)
  2529. #define FDI_RX_DISABLE (0<<31)
  2530. /* train, dp width same as FDI_TX */
  2531. #define FDI_DP_PORT_WIDTH_X8 (7<<19)
  2532. #define FDI_8BPC (0<<16)
  2533. #define FDI_10BPC (1<<16)
  2534. #define FDI_6BPC (2<<16)
  2535. #define FDI_12BPC (3<<16)
  2536. #define FDI_LINK_REVERSE_OVERWRITE (1<<15)
  2537. #define FDI_DMI_LINK_REVERSE_MASK (1<<14)
  2538. #define FDI_RX_PLL_ENABLE (1<<13)
  2539. #define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
  2540. #define FDI_FE_ERR_CORRECT_ENABLE (1<<10)
  2541. #define FDI_FS_ERR_REPORT_ENABLE (1<<9)
  2542. #define FDI_FE_ERR_REPORT_ENABLE (1<<8)
  2543. #define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6)
  2544. #define FDI_SEL_RAWCLK (0<<4)
  2545. #define FDI_SEL_PCDCLK (1<<4)
  2546. /* CPT */
  2547. #define FDI_AUTO_TRAINING (1<<10)
  2548. #define FDI_LINK_TRAIN_PATTERN_1_CPT (0<<8)
  2549. #define FDI_LINK_TRAIN_PATTERN_2_CPT (1<<8)
  2550. #define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2<<8)
  2551. #define FDI_LINK_TRAIN_NORMAL_CPT (3<<8)
  2552. #define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3<<8)
  2553. #define FDI_RXA_MISC 0xf0010
  2554. #define FDI_RXB_MISC 0xf1010
  2555. #define FDI_RXA_TUSIZE1 0xf0030
  2556. #define FDI_RXA_TUSIZE2 0xf0038
  2557. #define FDI_RXB_TUSIZE1 0xf1030
  2558. #define FDI_RXB_TUSIZE2 0xf1038
  2559. /* FDI_RX interrupt register format */
  2560. #define FDI_RX_INTER_LANE_ALIGN (1<<10)
  2561. #define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */
  2562. #define FDI_RX_BIT_LOCK (1<<8) /* train 1 */
  2563. #define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7)
  2564. #define FDI_RX_FS_CODE_ERR (1<<6)
  2565. #define FDI_RX_FE_CODE_ERR (1<<5)
  2566. #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4)
  2567. #define FDI_RX_HDCP_LINK_FAIL (1<<3)
  2568. #define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2)
  2569. #define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
  2570. #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
  2571. #define FDI_RXA_IIR 0xf0014
  2572. #define FDI_RXA_IMR 0xf0018
  2573. #define FDI_RXB_IIR 0xf1014
  2574. #define FDI_RXB_IMR 0xf1018
  2575. #define FDI_PLL_CTL_1 0xfe000
  2576. #define FDI_PLL_CTL_2 0xfe004
  2577. /* CRT */
  2578. #define PCH_ADPA 0xe1100
  2579. #define ADPA_TRANS_SELECT_MASK (1<<30)
  2580. #define ADPA_TRANS_A_SELECT 0
  2581. #define ADPA_TRANS_B_SELECT (1<<30)
  2582. #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
  2583. #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24)
  2584. #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24)
  2585. #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24)
  2586. #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24)
  2587. #define ADPA_CRT_HOTPLUG_ENABLE (1<<23)
  2588. #define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22)
  2589. #define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22)
  2590. #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21)
  2591. #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21)
  2592. #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20)
  2593. #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20)
  2594. #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18)
  2595. #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18)
  2596. #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18)
  2597. #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18)
  2598. #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17)
  2599. #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17)
  2600. #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
  2601. /* or SDVOB */
  2602. #define HDMIB 0xe1140
  2603. #define PORT_ENABLE (1 << 31)
  2604. #define TRANSCODER_A (0)
  2605. #define TRANSCODER_B (1 << 30)
  2606. #define COLOR_FORMAT_8bpc (0)
  2607. #define COLOR_FORMAT_12bpc (3 << 26)
  2608. #define SDVOB_HOTPLUG_ENABLE (1 << 23)
  2609. #define SDVO_ENCODING (0)
  2610. #define TMDS_ENCODING (2 << 10)
  2611. #define NULL_PACKET_VSYNC_ENABLE (1 << 9)
  2612. /* CPT */
  2613. #define HDMI_MODE_SELECT (1 << 9)
  2614. #define DVI_MODE_SELECT (0)
  2615. #define SDVOB_BORDER_ENABLE (1 << 7)
  2616. #define AUDIO_ENABLE (1 << 6)
  2617. #define VSYNC_ACTIVE_HIGH (1 << 4)
  2618. #define HSYNC_ACTIVE_HIGH (1 << 3)
  2619. #define PORT_DETECTED (1 << 2)
  2620. /* PCH SDVOB multiplex with HDMIB */
  2621. #define PCH_SDVOB HDMIB
  2622. #define HDMIC 0xe1150
  2623. #define HDMID 0xe1160
  2624. #define PCH_LVDS 0xe1180
  2625. #define LVDS_DETECTED (1 << 1)
  2626. #define BLC_PWM_CPU_CTL2 0x48250
  2627. #define PWM_ENABLE (1 << 31)
  2628. #define PWM_PIPE_A (0 << 29)
  2629. #define PWM_PIPE_B (1 << 29)
  2630. #define BLC_PWM_CPU_CTL 0x48254
  2631. #define BLC_PWM_PCH_CTL1 0xc8250
  2632. #define PWM_PCH_ENABLE (1 << 31)
  2633. #define PWM_POLARITY_ACTIVE_LOW (1 << 29)
  2634. #define PWM_POLARITY_ACTIVE_HIGH (0 << 29)
  2635. #define PWM_POLARITY_ACTIVE_LOW2 (1 << 28)
  2636. #define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
  2637. #define BLC_PWM_PCH_CTL2 0xc8254
  2638. #define PCH_PP_STATUS 0xc7200
  2639. #define PCH_PP_CONTROL 0xc7204
  2640. #define PANEL_UNLOCK_REGS (0xabcd << 16)
  2641. #define EDP_FORCE_VDD (1 << 3)
  2642. #define EDP_BLC_ENABLE (1 << 2)
  2643. #define PANEL_POWER_RESET (1 << 1)
  2644. #define PANEL_POWER_OFF (0 << 0)
  2645. #define PANEL_POWER_ON (1 << 0)
  2646. #define PCH_PP_ON_DELAYS 0xc7208
  2647. #define EDP_PANEL (1 << 30)
  2648. #define PCH_PP_OFF_DELAYS 0xc720c
  2649. #define PCH_PP_DIVISOR 0xc7210
  2650. #define PCH_DP_B 0xe4100
  2651. #define PCH_DPB_AUX_CH_CTL 0xe4110
  2652. #define PCH_DPB_AUX_CH_DATA1 0xe4114
  2653. #define PCH_DPB_AUX_CH_DATA2 0xe4118
  2654. #define PCH_DPB_AUX_CH_DATA3 0xe411c
  2655. #define PCH_DPB_AUX_CH_DATA4 0xe4120
  2656. #define PCH_DPB_AUX_CH_DATA5 0xe4124
  2657. #define PCH_DP_C 0xe4200
  2658. #define PCH_DPC_AUX_CH_CTL 0xe4210
  2659. #define PCH_DPC_AUX_CH_DATA1 0xe4214
  2660. #define PCH_DPC_AUX_CH_DATA2 0xe4218
  2661. #define PCH_DPC_AUX_CH_DATA3 0xe421c
  2662. #define PCH_DPC_AUX_CH_DATA4 0xe4220
  2663. #define PCH_DPC_AUX_CH_DATA5 0xe4224
  2664. #define PCH_DP_D 0xe4300
  2665. #define PCH_DPD_AUX_CH_CTL 0xe4310
  2666. #define PCH_DPD_AUX_CH_DATA1 0xe4314
  2667. #define PCH_DPD_AUX_CH_DATA2 0xe4318
  2668. #define PCH_DPD_AUX_CH_DATA3 0xe431c
  2669. #define PCH_DPD_AUX_CH_DATA4 0xe4320
  2670. #define PCH_DPD_AUX_CH_DATA5 0xe4324
  2671. /* CPT */
  2672. #define PORT_TRANS_A_SEL_CPT 0
  2673. #define PORT_TRANS_B_SEL_CPT (1<<29)
  2674. #define PORT_TRANS_C_SEL_CPT (2<<29)
  2675. #define PORT_TRANS_SEL_MASK (3<<29)
  2676. #define TRANS_DP_CTL_A 0xe0300
  2677. #define TRANS_DP_CTL_B 0xe1300
  2678. #define TRANS_DP_CTL_C 0xe2300
  2679. #define TRANS_DP_OUTPUT_ENABLE (1<<31)
  2680. #define TRANS_DP_PORT_SEL_B (0<<29)
  2681. #define TRANS_DP_PORT_SEL_C (1<<29)
  2682. #define TRANS_DP_PORT_SEL_D (2<<29)
  2683. #define TRANS_DP_PORT_SEL_MASK (3<<29)
  2684. #define TRANS_DP_AUDIO_ONLY (1<<26)
  2685. #define TRANS_DP_ENH_FRAMING (1<<18)
  2686. #define TRANS_DP_8BPC (0<<9)
  2687. #define TRANS_DP_10BPC (1<<9)
  2688. #define TRANS_DP_6BPC (2<<9)
  2689. #define TRANS_DP_12BPC (3<<9)
  2690. #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
  2691. #define TRANS_DP_VSYNC_ACTIVE_LOW 0
  2692. #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
  2693. #define TRANS_DP_HSYNC_ACTIVE_LOW 0
  2694. /* SNB eDP training params */
  2695. /* SNB A-stepping */
  2696. #define EDP_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
  2697. #define EDP_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
  2698. #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
  2699. #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
  2700. /* SNB B-stepping */
  2701. #define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
  2702. #define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
  2703. #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
  2704. #define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
  2705. #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22)
  2706. #endif /* _I915_REG_H_ */