i915_reg.h 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390
  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. /* PCI config space */
  52. #define HPLLCC 0xc0 /* 855 only */
  53. #define GC_CLOCK_CONTROL_MASK (0xf << 0)
  54. #define GC_CLOCK_133_200 (0 << 0)
  55. #define GC_CLOCK_100_200 (1 << 0)
  56. #define GC_CLOCK_100_133 (2 << 0)
  57. #define GC_CLOCK_166_250 (3 << 0)
  58. #define GCFGC 0xf0 /* 915+ only */
  59. #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
  60. #define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
  61. #define GC_DISPLAY_CLOCK_333_MHZ (4 << 4)
  62. #define GC_DISPLAY_CLOCK_MASK (7 << 4)
  63. #define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
  64. #define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)
  65. #define GM45_GC_RENDER_CLOCK_320_MHZ (9 << 0)
  66. #define GM45_GC_RENDER_CLOCK_400_MHZ (0xb << 0)
  67. #define GM45_GC_RENDER_CLOCK_533_MHZ (0xc << 0)
  68. #define I965_GC_RENDER_CLOCK_MASK (0xf << 0)
  69. #define I965_GC_RENDER_CLOCK_267_MHZ (2 << 0)
  70. #define I965_GC_RENDER_CLOCK_333_MHZ (3 << 0)
  71. #define I965_GC_RENDER_CLOCK_444_MHZ (4 << 0)
  72. #define I965_GC_RENDER_CLOCK_533_MHZ (5 << 0)
  73. #define I945_GC_RENDER_CLOCK_MASK (7 << 0)
  74. #define I945_GC_RENDER_CLOCK_166_MHZ (0 << 0)
  75. #define I945_GC_RENDER_CLOCK_200_MHZ (1 << 0)
  76. #define I945_GC_RENDER_CLOCK_250_MHZ (3 << 0)
  77. #define I945_GC_RENDER_CLOCK_400_MHZ (5 << 0)
  78. #define I915_GC_RENDER_CLOCK_MASK (7 << 0)
  79. #define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
  80. #define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
  81. #define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
  82. #define LBB 0xf4
  83. /* VGA stuff */
  84. #define VGA_ST01_MDA 0x3ba
  85. #define VGA_ST01_CGA 0x3da
  86. #define VGA_MSR_WRITE 0x3c2
  87. #define VGA_MSR_READ 0x3cc
  88. #define VGA_MSR_MEM_EN (1<<1)
  89. #define VGA_MSR_CGA_MODE (1<<0)
  90. #define VGA_SR_INDEX 0x3c4
  91. #define VGA_SR_DATA 0x3c5
  92. #define VGA_AR_INDEX 0x3c0
  93. #define VGA_AR_VID_EN (1<<5)
  94. #define VGA_AR_DATA_WRITE 0x3c0
  95. #define VGA_AR_DATA_READ 0x3c1
  96. #define VGA_GR_INDEX 0x3ce
  97. #define VGA_GR_DATA 0x3cf
  98. /* GR05 */
  99. #define VGA_GR_MEM_READ_MODE_SHIFT 3
  100. #define VGA_GR_MEM_READ_MODE_PLANE 1
  101. /* GR06 */
  102. #define VGA_GR_MEM_MODE_MASK 0xc
  103. #define VGA_GR_MEM_MODE_SHIFT 2
  104. #define VGA_GR_MEM_A0000_AFFFF 0
  105. #define VGA_GR_MEM_A0000_BFFFF 1
  106. #define VGA_GR_MEM_B0000_B7FFF 2
  107. #define VGA_GR_MEM_B0000_BFFFF 3
  108. #define VGA_DACMASK 0x3c6
  109. #define VGA_DACRX 0x3c7
  110. #define VGA_DACWX 0x3c8
  111. #define VGA_DACDATA 0x3c9
  112. #define VGA_CR_INDEX_MDA 0x3b4
  113. #define VGA_CR_DATA_MDA 0x3b5
  114. #define VGA_CR_INDEX_CGA 0x3d4
  115. #define VGA_CR_DATA_CGA 0x3d5
  116. /*
  117. * Memory interface instructions used by the kernel
  118. */
  119. #define MI_INSTR(opcode, flags) (((opcode) << 23) | (flags))
  120. #define MI_NOOP MI_INSTR(0, 0)
  121. #define MI_USER_INTERRUPT MI_INSTR(0x02, 0)
  122. #define MI_WAIT_FOR_EVENT MI_INSTR(0x03, 0)
  123. #define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
  124. #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
  125. #define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
  126. #define MI_FLUSH MI_INSTR(0x04, 0)
  127. #define MI_READ_FLUSH (1 << 0)
  128. #define MI_EXE_FLUSH (1 << 1)
  129. #define MI_NO_WRITE_FLUSH (1 << 2)
  130. #define MI_SCENE_COUNT (1 << 3) /* just increment scene count */
  131. #define MI_END_SCENE (1 << 4) /* flush binner and incr scene count */
  132. #define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)
  133. #define MI_REPORT_HEAD MI_INSTR(0x07, 0)
  134. #define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0)
  135. #define MI_STORE_DWORD_IMM MI_INSTR(0x20, 1)
  136. #define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */
  137. #define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
  138. #define MI_STORE_DWORD_INDEX_SHIFT 2
  139. #define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 1)
  140. #define MI_BATCH_BUFFER MI_INSTR(0x30, 1)
  141. #define MI_BATCH_NON_SECURE (1)
  142. #define MI_BATCH_NON_SECURE_I965 (1<<8)
  143. #define MI_BATCH_BUFFER_START MI_INSTR(0x31, 0)
  144. /*
  145. * 3D instructions used by the kernel
  146. */
  147. #define GFX_INSTR(opcode, flags) ((0x3 << 29) | ((opcode) << 24) | (flags))
  148. #define GFX_OP_RASTER_RULES ((0x3<<29)|(0x7<<24))
  149. #define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
  150. #define SC_UPDATE_SCISSOR (0x1<<1)
  151. #define SC_ENABLE_MASK (0x1<<0)
  152. #define SC_ENABLE (0x1<<0)
  153. #define GFX_OP_LOAD_INDIRECT ((0x3<<29)|(0x1d<<24)|(0x7<<16))
  154. #define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
  155. #define SCI_YMIN_MASK (0xffff<<16)
  156. #define SCI_XMIN_MASK (0xffff<<0)
  157. #define SCI_YMAX_MASK (0xffff<<16)
  158. #define SCI_XMAX_MASK (0xffff<<0)
  159. #define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19))
  160. #define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
  161. #define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
  162. #define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
  163. #define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4)
  164. #define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
  165. #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1)
  166. #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
  167. #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2)
  168. #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4)
  169. #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
  170. #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5)
  171. #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
  172. #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
  173. #define BLT_DEPTH_8 (0<<24)
  174. #define BLT_DEPTH_16_565 (1<<24)
  175. #define BLT_DEPTH_16_1555 (2<<24)
  176. #define BLT_DEPTH_32 (3<<24)
  177. #define BLT_ROP_GXCOPY (0xcc<<16)
  178. #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */
  179. #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */
  180. #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
  181. #define ASYNC_FLIP (1<<22)
  182. #define DISPLAY_PLANE_A (0<<20)
  183. #define DISPLAY_PLANE_B (1<<20)
  184. /*
  185. * Fence registers
  186. */
  187. #define FENCE_REG_830_0 0x2000
  188. #define FENCE_REG_945_8 0x3000
  189. #define I830_FENCE_START_MASK 0x07f80000
  190. #define I830_FENCE_TILING_Y_SHIFT 12
  191. #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
  192. #define I830_FENCE_PITCH_SHIFT 4
  193. #define I830_FENCE_REG_VALID (1<<0)
  194. #define I915_FENCE_MAX_PITCH_VAL 0x10
  195. #define I830_FENCE_MAX_PITCH_VAL 6
  196. #define I830_FENCE_MAX_SIZE_VAL (1<<8)
  197. #define I915_FENCE_START_MASK 0x0ff00000
  198. #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
  199. #define FENCE_REG_965_0 0x03000
  200. #define I965_FENCE_PITCH_SHIFT 2
  201. #define I965_FENCE_TILING_Y_SHIFT 1
  202. #define I965_FENCE_REG_VALID (1<<0)
  203. #define I965_FENCE_MAX_PITCH_VAL 0x0400
  204. /*
  205. * Instruction and interrupt control regs
  206. */
  207. #define PGTBL_ER 0x02024
  208. #define PRB0_TAIL 0x02030
  209. #define PRB0_HEAD 0x02034
  210. #define PRB0_START 0x02038
  211. #define PRB0_CTL 0x0203c
  212. #define TAIL_ADDR 0x001FFFF8
  213. #define HEAD_WRAP_COUNT 0xFFE00000
  214. #define HEAD_WRAP_ONE 0x00200000
  215. #define HEAD_ADDR 0x001FFFFC
  216. #define RING_NR_PAGES 0x001FF000
  217. #define RING_REPORT_MASK 0x00000006
  218. #define RING_REPORT_64K 0x00000002
  219. #define RING_REPORT_128K 0x00000004
  220. #define RING_NO_REPORT 0x00000000
  221. #define RING_VALID_MASK 0x00000001
  222. #define RING_VALID 0x00000001
  223. #define RING_INVALID 0x00000000
  224. #define PRB1_TAIL 0x02040 /* 915+ only */
  225. #define PRB1_HEAD 0x02044 /* 915+ only */
  226. #define PRB1_START 0x02048 /* 915+ only */
  227. #define PRB1_CTL 0x0204c /* 915+ only */
  228. #define IPEIR_I965 0x02064
  229. #define IPEHR_I965 0x02068
  230. #define INSTDONE_I965 0x0206c
  231. #define INSTPS 0x02070 /* 965+ only */
  232. #define INSTDONE1 0x0207c /* 965+ only */
  233. #define ACTHD_I965 0x02074
  234. #define HWS_PGA 0x02080
  235. #define HWS_ADDRESS_MASK 0xfffff000
  236. #define HWS_START_ADDRESS_SHIFT 4
  237. #define IPEIR 0x02088
  238. #define IPEHR 0x0208c
  239. #define INSTDONE 0x02090
  240. #define NOPID 0x02094
  241. #define HWSTAM 0x02098
  242. #define SCPD0 0x0209c /* 915+ only */
  243. #define IER 0x020a0
  244. #define IIR 0x020a4
  245. #define IMR 0x020a8
  246. #define ISR 0x020ac
  247. #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18)
  248. #define I915_DISPLAY_PORT_INTERRUPT (1<<17)
  249. #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15)
  250. #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14)
  251. #define I915_HWB_OOM_INTERRUPT (1<<13)
  252. #define I915_SYNC_STATUS_INTERRUPT (1<<12)
  253. #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
  254. #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
  255. #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9)
  256. #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
  257. #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7)
  258. #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
  259. #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
  260. #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
  261. #define I915_DEBUG_INTERRUPT (1<<2)
  262. #define I915_USER_INTERRUPT (1<<1)
  263. #define I915_ASLE_INTERRUPT (1<<0)
  264. #define EIR 0x020b0
  265. #define EMR 0x020b4
  266. #define ESR 0x020b8
  267. #define GM45_ERROR_PAGE_TABLE (1<<5)
  268. #define GM45_ERROR_MEM_PRIV (1<<4)
  269. #define I915_ERROR_PAGE_TABLE (1<<4)
  270. #define GM45_ERROR_CP_PRIV (1<<3)
  271. #define I915_ERROR_MEMORY_REFRESH (1<<1)
  272. #define I915_ERROR_INSTRUCTION (1<<0)
  273. #define INSTPM 0x020c0
  274. #define ACTHD 0x020c8
  275. #define FW_BLC 0x020d8
  276. #define FW_BLC2 0x020dc
  277. #define FW_BLC_SELF 0x020e0 /* 915+ only */
  278. #define FW_BLC_SELF_EN (1<<15)
  279. #define MM_BURST_LENGTH 0x00700000
  280. #define MM_FIFO_WATERMARK 0x0001F000
  281. #define LM_BURST_LENGTH 0x00000700
  282. #define LM_FIFO_WATERMARK 0x0000001F
  283. #define MI_ARB_STATE 0x020e4 /* 915+ only */
  284. #define CACHE_MODE_0 0x02120 /* 915+ only */
  285. #define CM0_MASK_SHIFT 16
  286. #define CM0_IZ_OPT_DISABLE (1<<6)
  287. #define CM0_ZR_OPT_DISABLE (1<<5)
  288. #define CM0_DEPTH_EVICT_DISABLE (1<<4)
  289. #define CM0_COLOR_EVICT_DISABLE (1<<3)
  290. #define CM0_DEPTH_WRITE_DISABLE (1<<1)
  291. #define CM0_RC_OP_FLUSH_DISABLE (1<<0)
  292. #define GFX_FLSH_CNTL 0x02170 /* 915+ only */
  293. /*
  294. * Framebuffer compression (915+ only)
  295. */
  296. #define FBC_CFB_BASE 0x03200 /* 4k page aligned */
  297. #define FBC_LL_BASE 0x03204 /* 4k page aligned */
  298. #define FBC_CONTROL 0x03208
  299. #define FBC_CTL_EN (1<<31)
  300. #define FBC_CTL_PERIODIC (1<<30)
  301. #define FBC_CTL_INTERVAL_SHIFT (16)
  302. #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
  303. #define FBC_CTL_STRIDE_SHIFT (5)
  304. #define FBC_CTL_FENCENO (1<<0)
  305. #define FBC_COMMAND 0x0320c
  306. #define FBC_CMD_COMPRESS (1<<0)
  307. #define FBC_STATUS 0x03210
  308. #define FBC_STAT_COMPRESSING (1<<31)
  309. #define FBC_STAT_COMPRESSED (1<<30)
  310. #define FBC_STAT_MODIFIED (1<<29)
  311. #define FBC_STAT_CURRENT_LINE (1<<0)
  312. #define FBC_CONTROL2 0x03214
  313. #define FBC_CTL_FENCE_DBL (0<<4)
  314. #define FBC_CTL_IDLE_IMM (0<<2)
  315. #define FBC_CTL_IDLE_FULL (1<<2)
  316. #define FBC_CTL_IDLE_LINE (2<<2)
  317. #define FBC_CTL_IDLE_DEBUG (3<<2)
  318. #define FBC_CTL_CPU_FENCE (1<<1)
  319. #define FBC_CTL_PLANEA (0<<0)
  320. #define FBC_CTL_PLANEB (1<<0)
  321. #define FBC_FENCE_OFF 0x0321b
  322. #define FBC_LL_SIZE (1536)
  323. /*
  324. * GPIO regs
  325. */
  326. #define GPIOA 0x5010
  327. #define GPIOB 0x5014
  328. #define GPIOC 0x5018
  329. #define GPIOD 0x501c
  330. #define GPIOE 0x5020
  331. #define GPIOF 0x5024
  332. #define GPIOG 0x5028
  333. #define GPIOH 0x502c
  334. # define GPIO_CLOCK_DIR_MASK (1 << 0)
  335. # define GPIO_CLOCK_DIR_IN (0 << 1)
  336. # define GPIO_CLOCK_DIR_OUT (1 << 1)
  337. # define GPIO_CLOCK_VAL_MASK (1 << 2)
  338. # define GPIO_CLOCK_VAL_OUT (1 << 3)
  339. # define GPIO_CLOCK_VAL_IN (1 << 4)
  340. # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
  341. # define GPIO_DATA_DIR_MASK (1 << 8)
  342. # define GPIO_DATA_DIR_IN (0 << 9)
  343. # define GPIO_DATA_DIR_OUT (1 << 9)
  344. # define GPIO_DATA_VAL_MASK (1 << 10)
  345. # define GPIO_DATA_VAL_OUT (1 << 11)
  346. # define GPIO_DATA_VAL_IN (1 << 12)
  347. # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
  348. /*
  349. * Clock control & power management
  350. */
  351. #define VGA0 0x6000
  352. #define VGA1 0x6004
  353. #define VGA_PD 0x6010
  354. #define VGA0_PD_P2_DIV_4 (1 << 7)
  355. #define VGA0_PD_P1_DIV_2 (1 << 5)
  356. #define VGA0_PD_P1_SHIFT 0
  357. #define VGA0_PD_P1_MASK (0x1f << 0)
  358. #define VGA1_PD_P2_DIV_4 (1 << 15)
  359. #define VGA1_PD_P1_DIV_2 (1 << 13)
  360. #define VGA1_PD_P1_SHIFT 8
  361. #define VGA1_PD_P1_MASK (0x1f << 8)
  362. #define DPLL_A 0x06014
  363. #define DPLL_B 0x06018
  364. #define DPLL_VCO_ENABLE (1 << 31)
  365. #define DPLL_DVO_HIGH_SPEED (1 << 30)
  366. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  367. #define DPLL_VGA_MODE_DIS (1 << 28)
  368. #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
  369. #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
  370. #define DPLL_MODE_MASK (3 << 26)
  371. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
  372. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
  373. #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
  374. #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
  375. #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
  376. #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
  377. #define DPLL_FPA01_P1_POST_DIV_MASK_IGD 0x00ff8000 /* IGD */
  378. #define I915_FIFO_UNDERRUN_STATUS (1UL<<31)
  379. #define I915_CRC_ERROR_ENABLE (1UL<<29)
  380. #define I915_CRC_DONE_ENABLE (1UL<<28)
  381. #define I915_GMBUS_EVENT_ENABLE (1UL<<27)
  382. #define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25)
  383. #define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
  384. #define I915_DPST_EVENT_ENABLE (1UL<<23)
  385. #define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
  386. #define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
  387. #define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
  388. #define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
  389. #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
  390. #define I915_OVERLAY_UPDATED_ENABLE (1UL<<16)
  391. #define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
  392. #define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
  393. #define I915_GMBUS_INTERRUPT_STATUS (1UL<<11)
  394. #define I915_VSYNC_INTERRUPT_STATUS (1UL<<9)
  395. #define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
  396. #define I915_DPST_EVENT_STATUS (1UL<<7)
  397. #define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6)
  398. #define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
  399. #define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
  400. #define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
  401. #define I915_VBLANK_INTERRUPT_STATUS (1UL<<1)
  402. #define I915_OVERLAY_UPDATED_STATUS (1UL<<0)
  403. #define SRX_INDEX 0x3c4
  404. #define SRX_DATA 0x3c5
  405. #define SR01 1
  406. #define SR01_SCREEN_OFF (1<<5)
  407. #define PPCR 0x61204
  408. #define PPCR_ON (1<<0)
  409. #define DVOB 0x61140
  410. #define DVOB_ON (1<<31)
  411. #define DVOC 0x61160
  412. #define DVOC_ON (1<<31)
  413. #define LVDS 0x61180
  414. #define LVDS_ON (1<<31)
  415. #define ADPA 0x61100
  416. #define ADPA_DPMS_MASK (~(3<<10))
  417. #define ADPA_DPMS_ON (0<<10)
  418. #define ADPA_DPMS_SUSPEND (1<<10)
  419. #define ADPA_DPMS_STANDBY (2<<10)
  420. #define ADPA_DPMS_OFF (3<<10)
  421. #define RING_TAIL 0x00
  422. #define TAIL_ADDR 0x001FFFF8
  423. #define RING_HEAD 0x04
  424. #define HEAD_WRAP_COUNT 0xFFE00000
  425. #define HEAD_WRAP_ONE 0x00200000
  426. #define HEAD_ADDR 0x001FFFFC
  427. #define RING_START 0x08
  428. #define START_ADDR 0xFFFFF000
  429. #define RING_LEN 0x0C
  430. #define RING_NR_PAGES 0x001FF000
  431. #define RING_REPORT_MASK 0x00000006
  432. #define RING_REPORT_64K 0x00000002
  433. #define RING_REPORT_128K 0x00000004
  434. #define RING_NO_REPORT 0x00000000
  435. #define RING_VALID_MASK 0x00000001
  436. #define RING_VALID 0x00000001
  437. #define RING_INVALID 0x00000000
  438. /* Scratch pad debug 0 reg:
  439. */
  440. #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
  441. /*
  442. * The i830 generation, in LVDS mode, defines P1 as the bit number set within
  443. * this field (only one bit may be set).
  444. */
  445. #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
  446. #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
  447. #define DPLL_FPA01_P1_POST_DIV_SHIFT_IGD 15
  448. /* i830, required in DVO non-gang */
  449. #define PLL_P2_DIVIDE_BY_4 (1 << 23)
  450. #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
  451. #define PLL_REF_INPUT_DREFCLK (0 << 13)
  452. #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
  453. #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
  454. #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
  455. #define PLL_REF_INPUT_MASK (3 << 13)
  456. #define PLL_LOAD_PULSE_PHASE_SHIFT 9
  457. /* IGDNG */
  458. # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
  459. # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
  460. # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1) << 9)
  461. # define DPLL_FPA1_P1_POST_DIV_SHIFT 0
  462. # define DPLL_FPA1_P1_POST_DIV_MASK 0xff
  463. /*
  464. * Parallel to Serial Load Pulse phase selection.
  465. * Selects the phase for the 10X DPLL clock for the PCIe
  466. * digital display port. The range is 4 to 13; 10 or more
  467. * is just a flip delay. The default is 6
  468. */
  469. #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
  470. #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
  471. /*
  472. * SDVO multiplier for 945G/GM. Not used on 965.
  473. */
  474. #define SDVO_MULTIPLIER_MASK 0x000000ff
  475. #define SDVO_MULTIPLIER_SHIFT_HIRES 4
  476. #define SDVO_MULTIPLIER_SHIFT_VGA 0
  477. #define DPLL_A_MD 0x0601c /* 965+ only */
  478. /*
  479. * UDI pixel divider, controlling how many pixels are stuffed into a packet.
  480. *
  481. * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
  482. */
  483. #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
  484. #define DPLL_MD_UDI_DIVIDER_SHIFT 24
  485. /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
  486. #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
  487. #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
  488. /*
  489. * SDVO/UDI pixel multiplier.
  490. *
  491. * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
  492. * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
  493. * modes, the bus rate would be below the limits, so SDVO allows for stuffing
  494. * dummy bytes in the datastream at an increased clock rate, with both sides of
  495. * the link knowing how many bytes are fill.
  496. *
  497. * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
  498. * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
  499. * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
  500. * through an SDVO command.
  501. *
  502. * This register field has values of multiplication factor minus 1, with
  503. * a maximum multiplier of 5 for SDVO.
  504. */
  505. #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
  506. #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
  507. /*
  508. * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
  509. * This best be set to the default value (3) or the CRT won't work. No,
  510. * I don't entirely understand what this does...
  511. */
  512. #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
  513. #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
  514. #define DPLL_B_MD 0x06020 /* 965+ only */
  515. #define FPA0 0x06040
  516. #define FPA1 0x06044
  517. #define FPB0 0x06048
  518. #define FPB1 0x0604c
  519. #define FP_N_DIV_MASK 0x003f0000
  520. #define FP_N_IGD_DIV_MASK 0x00ff0000
  521. #define FP_N_DIV_SHIFT 16
  522. #define FP_M1_DIV_MASK 0x00003f00
  523. #define FP_M1_DIV_SHIFT 8
  524. #define FP_M2_DIV_MASK 0x0000003f
  525. #define FP_M2_IGD_DIV_MASK 0x000000ff
  526. #define FP_M2_DIV_SHIFT 0
  527. #define DPLL_TEST 0x606c
  528. #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
  529. #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
  530. #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
  531. #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
  532. #define DPLLB_TEST_N_BYPASS (1 << 19)
  533. #define DPLLB_TEST_M_BYPASS (1 << 18)
  534. #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
  535. #define DPLLA_TEST_N_BYPASS (1 << 3)
  536. #define DPLLA_TEST_M_BYPASS (1 << 2)
  537. #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
  538. #define D_STATE 0x6104
  539. #define DSTATE_PLL_D3_OFF (1<<3)
  540. #define DSTATE_GFX_CLOCK_GATING (1<<1)
  541. #define DSTATE_DOT_CLOCK_GATING (1<<0)
  542. #define DSPCLK_GATE_D 0x6200
  543. # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
  544. # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
  545. # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
  546. # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
  547. # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
  548. # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
  549. # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
  550. # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
  551. # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
  552. # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
  553. # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
  554. # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
  555. # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
  556. # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
  557. # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
  558. # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
  559. # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
  560. # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
  561. # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
  562. # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
  563. # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
  564. # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
  565. # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
  566. # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
  567. # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
  568. # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
  569. # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
  570. # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
  571. /**
  572. * This bit must be set on the 830 to prevent hangs when turning off the
  573. * overlay scaler.
  574. */
  575. # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
  576. # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
  577. # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
  578. # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
  579. # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
  580. #define RENCLK_GATE_D1 0x6204
  581. # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
  582. # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
  583. # define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
  584. # define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
  585. # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
  586. # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
  587. # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
  588. # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
  589. # define MAG_CLOCK_GATE_DISABLE (1 << 5)
  590. /** This bit must be unset on 855,865 */
  591. # define MECI_CLOCK_GATE_DISABLE (1 << 4)
  592. # define DCMP_CLOCK_GATE_DISABLE (1 << 3)
  593. # define MEC_CLOCK_GATE_DISABLE (1 << 2)
  594. # define MECO_CLOCK_GATE_DISABLE (1 << 1)
  595. /** This bit must be set on 855,865. */
  596. # define SV_CLOCK_GATE_DISABLE (1 << 0)
  597. # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
  598. # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
  599. # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
  600. # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
  601. # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
  602. # define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
  603. # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
  604. # define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
  605. # define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
  606. # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
  607. # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
  608. # define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
  609. # define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
  610. # define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
  611. # define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
  612. # define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
  613. # define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
  614. # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
  615. /** This bit must always be set on 965G/965GM */
  616. # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
  617. # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
  618. # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
  619. # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
  620. # define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
  621. # define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
  622. /** This bit must always be set on 965G */
  623. # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
  624. # define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
  625. # define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
  626. # define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
  627. # define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
  628. # define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
  629. # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
  630. # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
  631. # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
  632. # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
  633. # define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
  634. # define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
  635. # define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
  636. # define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
  637. # define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
  638. # define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
  639. # define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
  640. # define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
  641. # define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
  642. #define RENCLK_GATE_D2 0x6208
  643. #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
  644. #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
  645. #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
  646. #define RAMCLK_GATE_D 0x6210 /* CRL only */
  647. #define DEUC 0x6214 /* CRL only */
  648. /*
  649. * Palette regs
  650. */
  651. #define PALETTE_A 0x0a000
  652. #define PALETTE_B 0x0a800
  653. /* MCH MMIO space */
  654. /*
  655. * MCHBAR mirror.
  656. *
  657. * This mirrors the MCHBAR MMIO space whose location is determined by
  658. * device 0 function 0's pci config register 0x44 or 0x48 and matches it in
  659. * every way. It is not accessible from the CP register read instructions.
  660. *
  661. */
  662. #define MCHBAR_MIRROR_BASE 0x10000
  663. /** 915-945 and GM965 MCH register controlling DRAM channel access */
  664. #define DCC 0x10200
  665. #define DCC_ADDRESSING_MODE_SINGLE_CHANNEL (0 << 0)
  666. #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_ASYMMETRIC (1 << 0)
  667. #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_INTERLEAVED (2 << 0)
  668. #define DCC_ADDRESSING_MODE_MASK (3 << 0)
  669. #define DCC_CHANNEL_XOR_DISABLE (1 << 10)
  670. #define DCC_CHANNEL_XOR_BIT_17 (1 << 9)
  671. /** 965 MCH register controlling DRAM channel configuration */
  672. #define C0DRB3 0x10206
  673. #define C1DRB3 0x10606
  674. /* Clocking configuration register */
  675. #define CLKCFG 0x10c00
  676. #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */
  677. #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
  678. #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
  679. #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */
  680. #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */
  681. #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */
  682. /* Note, below two are guess */
  683. #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */
  684. #define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */
  685. #define CLKCFG_FSB_MASK (7 << 0)
  686. #define CLKCFG_MEM_533 (1 << 4)
  687. #define CLKCFG_MEM_667 (2 << 4)
  688. #define CLKCFG_MEM_800 (3 << 4)
  689. #define CLKCFG_MEM_MASK (7 << 4)
  690. /** GM965 GM45 render standby register */
  691. #define MCHBAR_RENDER_STANDBY 0x111B8
  692. #define PEG_BAND_GAP_DATA 0x14d68
  693. /*
  694. * Overlay regs
  695. */
  696. #define OVADD 0x30000
  697. #define DOVSTA 0x30008
  698. #define OC_BUF (0x3<<20)
  699. #define OGAMC5 0x30010
  700. #define OGAMC4 0x30014
  701. #define OGAMC3 0x30018
  702. #define OGAMC2 0x3001c
  703. #define OGAMC1 0x30020
  704. #define OGAMC0 0x30024
  705. /*
  706. * Display engine regs
  707. */
  708. /* Pipe A timing regs */
  709. #define HTOTAL_A 0x60000
  710. #define HBLANK_A 0x60004
  711. #define HSYNC_A 0x60008
  712. #define VTOTAL_A 0x6000c
  713. #define VBLANK_A 0x60010
  714. #define VSYNC_A 0x60014
  715. #define PIPEASRC 0x6001c
  716. #define BCLRPAT_A 0x60020
  717. /* Pipe B timing regs */
  718. #define HTOTAL_B 0x61000
  719. #define HBLANK_B 0x61004
  720. #define HSYNC_B 0x61008
  721. #define VTOTAL_B 0x6100c
  722. #define VBLANK_B 0x61010
  723. #define VSYNC_B 0x61014
  724. #define PIPEBSRC 0x6101c
  725. #define BCLRPAT_B 0x61020
  726. /* VGA port control */
  727. #define ADPA 0x61100
  728. #define ADPA_DAC_ENABLE (1<<31)
  729. #define ADPA_DAC_DISABLE 0
  730. #define ADPA_PIPE_SELECT_MASK (1<<30)
  731. #define ADPA_PIPE_A_SELECT 0
  732. #define ADPA_PIPE_B_SELECT (1<<30)
  733. #define ADPA_USE_VGA_HVPOLARITY (1<<15)
  734. #define ADPA_SETS_HVPOLARITY 0
  735. #define ADPA_VSYNC_CNTL_DISABLE (1<<11)
  736. #define ADPA_VSYNC_CNTL_ENABLE 0
  737. #define ADPA_HSYNC_CNTL_DISABLE (1<<10)
  738. #define ADPA_HSYNC_CNTL_ENABLE 0
  739. #define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
  740. #define ADPA_VSYNC_ACTIVE_LOW 0
  741. #define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
  742. #define ADPA_HSYNC_ACTIVE_LOW 0
  743. #define ADPA_DPMS_MASK (~(3<<10))
  744. #define ADPA_DPMS_ON (0<<10)
  745. #define ADPA_DPMS_SUSPEND (1<<10)
  746. #define ADPA_DPMS_STANDBY (2<<10)
  747. #define ADPA_DPMS_OFF (3<<10)
  748. /* Hotplug control (945+ only) */
  749. #define PORT_HOTPLUG_EN 0x61110
  750. #define HDMIB_HOTPLUG_INT_EN (1 << 29)
  751. #define DPB_HOTPLUG_INT_EN (1 << 29)
  752. #define HDMIC_HOTPLUG_INT_EN (1 << 28)
  753. #define DPC_HOTPLUG_INT_EN (1 << 28)
  754. #define HDMID_HOTPLUG_INT_EN (1 << 27)
  755. #define DPD_HOTPLUG_INT_EN (1 << 27)
  756. #define SDVOB_HOTPLUG_INT_EN (1 << 26)
  757. #define SDVOC_HOTPLUG_INT_EN (1 << 25)
  758. #define TV_HOTPLUG_INT_EN (1 << 18)
  759. #define CRT_EOS_INT_EN (1 << 10)
  760. #define CRT_HOTPLUG_INT_EN (1 << 9)
  761. #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
  762. #define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
  763. /* must use period 64 on GM45 according to docs */
  764. #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
  765. #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
  766. #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
  767. #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
  768. #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
  769. #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
  770. #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
  771. #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
  772. #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
  773. #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
  774. #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
  775. #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
  776. #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */
  777. #define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f
  778. #define HOTPLUG_EN_MASK (HDMIB_HOTPLUG_INT_EN | \
  779. HDMIC_HOTPLUG_INT_EN | \
  780. HDMID_HOTPLUG_INT_EN | \
  781. SDVOB_HOTPLUG_INT_EN | \
  782. SDVOC_HOTPLUG_INT_EN | \
  783. TV_HOTPLUG_INT_EN | \
  784. CRT_HOTPLUG_INT_EN)
  785. #define PORT_HOTPLUG_STAT 0x61114
  786. #define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
  787. #define DPB_HOTPLUG_INT_STATUS (1 << 29)
  788. #define HDMIC_HOTPLUG_INT_STATUS (1 << 28)
  789. #define DPC_HOTPLUG_INT_STATUS (1 << 28)
  790. #define HDMID_HOTPLUG_INT_STATUS (1 << 27)
  791. #define DPD_HOTPLUG_INT_STATUS (1 << 27)
  792. #define CRT_EOS_INT_STATUS (1 << 12)
  793. #define CRT_HOTPLUG_INT_STATUS (1 << 11)
  794. #define TV_HOTPLUG_INT_STATUS (1 << 10)
  795. #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
  796. #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
  797. #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
  798. #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
  799. #define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
  800. #define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
  801. /* SDVO port control */
  802. #define SDVOB 0x61140
  803. #define SDVOC 0x61160
  804. #define SDVO_ENABLE (1 << 31)
  805. #define SDVO_PIPE_B_SELECT (1 << 30)
  806. #define SDVO_STALL_SELECT (1 << 29)
  807. #define SDVO_INTERRUPT_ENABLE (1 << 26)
  808. /**
  809. * 915G/GM SDVO pixel multiplier.
  810. *
  811. * Programmed value is multiplier - 1, up to 5x.
  812. *
  813. * \sa DPLL_MD_UDI_MULTIPLIER_MASK
  814. */
  815. #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
  816. #define SDVO_PORT_MULTIPLY_SHIFT 23
  817. #define SDVO_PHASE_SELECT_MASK (15 << 19)
  818. #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
  819. #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
  820. #define SDVOC_GANG_MODE (1 << 16)
  821. #define SDVO_ENCODING_SDVO (0x0 << 10)
  822. #define SDVO_ENCODING_HDMI (0x2 << 10)
  823. /** Requird for HDMI operation */
  824. #define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
  825. #define SDVO_BORDER_ENABLE (1 << 7)
  826. #define SDVO_AUDIO_ENABLE (1 << 6)
  827. /** New with 965, default is to be set */
  828. #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
  829. /** New with 965, default is to be set */
  830. #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
  831. #define SDVOB_PCIE_CONCURRENCY (1 << 3)
  832. #define SDVO_DETECTED (1 << 2)
  833. /* Bits to be preserved when writing */
  834. #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | (1 << 26))
  835. #define SDVOC_PRESERVE_MASK ((1 << 17) | (1 << 26))
  836. /* DVO port control */
  837. #define DVOA 0x61120
  838. #define DVOB 0x61140
  839. #define DVOC 0x61160
  840. #define DVO_ENABLE (1 << 31)
  841. #define DVO_PIPE_B_SELECT (1 << 30)
  842. #define DVO_PIPE_STALL_UNUSED (0 << 28)
  843. #define DVO_PIPE_STALL (1 << 28)
  844. #define DVO_PIPE_STALL_TV (2 << 28)
  845. #define DVO_PIPE_STALL_MASK (3 << 28)
  846. #define DVO_USE_VGA_SYNC (1 << 15)
  847. #define DVO_DATA_ORDER_I740 (0 << 14)
  848. #define DVO_DATA_ORDER_FP (1 << 14)
  849. #define DVO_VSYNC_DISABLE (1 << 11)
  850. #define DVO_HSYNC_DISABLE (1 << 10)
  851. #define DVO_VSYNC_TRISTATE (1 << 9)
  852. #define DVO_HSYNC_TRISTATE (1 << 8)
  853. #define DVO_BORDER_ENABLE (1 << 7)
  854. #define DVO_DATA_ORDER_GBRG (1 << 6)
  855. #define DVO_DATA_ORDER_RGGB (0 << 6)
  856. #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
  857. #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
  858. #define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
  859. #define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
  860. #define DVO_BLANK_ACTIVE_HIGH (1 << 2)
  861. #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
  862. #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
  863. #define DVO_PRESERVE_MASK (0x7<<24)
  864. #define DVOA_SRCDIM 0x61124
  865. #define DVOB_SRCDIM 0x61144
  866. #define DVOC_SRCDIM 0x61164
  867. #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
  868. #define DVO_SRCDIM_VERTICAL_SHIFT 0
  869. /* LVDS port control */
  870. #define LVDS 0x61180
  871. /*
  872. * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
  873. * the DPLL semantics change when the LVDS is assigned to that pipe.
  874. */
  875. #define LVDS_PORT_EN (1 << 31)
  876. /* Selects pipe B for LVDS data. Must be set on pre-965. */
  877. #define LVDS_PIPEB_SELECT (1 << 30)
  878. /*
  879. * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
  880. * pixel.
  881. */
  882. #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
  883. #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
  884. #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
  885. /*
  886. * Controls the A3 data pair, which contains the additional LSBs for 24 bit
  887. * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
  888. * on.
  889. */
  890. #define LVDS_A3_POWER_MASK (3 << 6)
  891. #define LVDS_A3_POWER_DOWN (0 << 6)
  892. #define LVDS_A3_POWER_UP (3 << 6)
  893. /*
  894. * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
  895. * is set.
  896. */
  897. #define LVDS_CLKB_POWER_MASK (3 << 4)
  898. #define LVDS_CLKB_POWER_DOWN (0 << 4)
  899. #define LVDS_CLKB_POWER_UP (3 << 4)
  900. /*
  901. * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
  902. * setting for whether we are in dual-channel mode. The B3 pair will
  903. * additionally only be powered up when LVDS_A3_POWER_UP is set.
  904. */
  905. #define LVDS_B0B3_POWER_MASK (3 << 2)
  906. #define LVDS_B0B3_POWER_DOWN (0 << 2)
  907. #define LVDS_B0B3_POWER_UP (3 << 2)
  908. /* Panel power sequencing */
  909. #define PP_STATUS 0x61200
  910. #define PP_ON (1 << 31)
  911. /*
  912. * Indicates that all dependencies of the panel are on:
  913. *
  914. * - PLL enabled
  915. * - pipe enabled
  916. * - LVDS/DVOB/DVOC on
  917. */
  918. #define PP_READY (1 << 30)
  919. #define PP_SEQUENCE_NONE (0 << 28)
  920. #define PP_SEQUENCE_ON (1 << 28)
  921. #define PP_SEQUENCE_OFF (2 << 28)
  922. #define PP_SEQUENCE_MASK 0x30000000
  923. #define PP_CONTROL 0x61204
  924. #define POWER_TARGET_ON (1 << 0)
  925. #define PP_ON_DELAYS 0x61208
  926. #define PP_OFF_DELAYS 0x6120c
  927. #define PP_DIVISOR 0x61210
  928. /* Panel fitting */
  929. #define PFIT_CONTROL 0x61230
  930. #define PFIT_ENABLE (1 << 31)
  931. #define PFIT_PIPE_MASK (3 << 29)
  932. #define PFIT_PIPE_SHIFT 29
  933. #define VERT_INTERP_DISABLE (0 << 10)
  934. #define VERT_INTERP_BILINEAR (1 << 10)
  935. #define VERT_INTERP_MASK (3 << 10)
  936. #define VERT_AUTO_SCALE (1 << 9)
  937. #define HORIZ_INTERP_DISABLE (0 << 6)
  938. #define HORIZ_INTERP_BILINEAR (1 << 6)
  939. #define HORIZ_INTERP_MASK (3 << 6)
  940. #define HORIZ_AUTO_SCALE (1 << 5)
  941. #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
  942. #define PFIT_FILTER_FUZZY (0 << 24)
  943. #define PFIT_SCALING_AUTO (0 << 26)
  944. #define PFIT_SCALING_PROGRAMMED (1 << 26)
  945. #define PFIT_SCALING_PILLAR (2 << 26)
  946. #define PFIT_SCALING_LETTER (3 << 26)
  947. #define PFIT_PGM_RATIOS 0x61234
  948. #define PFIT_VERT_SCALE_MASK 0xfff00000
  949. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  950. /* Pre-965 */
  951. #define PFIT_VERT_SCALE_SHIFT 20
  952. #define PFIT_VERT_SCALE_MASK 0xfff00000
  953. #define PFIT_HORIZ_SCALE_SHIFT 4
  954. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  955. /* 965+ */
  956. #define PFIT_VERT_SCALE_SHIFT_965 16
  957. #define PFIT_VERT_SCALE_MASK_965 0x1fff0000
  958. #define PFIT_HORIZ_SCALE_SHIFT_965 0
  959. #define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
  960. #define PFIT_AUTO_RATIOS 0x61238
  961. /* Backlight control */
  962. #define BLC_PWM_CTL 0x61254
  963. #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
  964. #define BLC_PWM_CTL2 0x61250 /* 965+ only */
  965. #define BLM_COMBINATION_MODE (1 << 30)
  966. /*
  967. * This is the most significant 15 bits of the number of backlight cycles in a
  968. * complete cycle of the modulated backlight control.
  969. *
  970. * The actual value is this field multiplied by two.
  971. */
  972. #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
  973. #define BLM_LEGACY_MODE (1 << 16)
  974. /*
  975. * This is the number of cycles out of the backlight modulation cycle for which
  976. * the backlight is on.
  977. *
  978. * This field must be no greater than the number of cycles in the complete
  979. * backlight modulation cycle.
  980. */
  981. #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
  982. #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
  983. /* TV port control */
  984. #define TV_CTL 0x68000
  985. /** Enables the TV encoder */
  986. # define TV_ENC_ENABLE (1 << 31)
  987. /** Sources the TV encoder input from pipe B instead of A. */
  988. # define TV_ENC_PIPEB_SELECT (1 << 30)
  989. /** Outputs composite video (DAC A only) */
  990. # define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
  991. /** Outputs SVideo video (DAC B/C) */
  992. # define TV_ENC_OUTPUT_SVIDEO (1 << 28)
  993. /** Outputs Component video (DAC A/B/C) */
  994. # define TV_ENC_OUTPUT_COMPONENT (2 << 28)
  995. /** Outputs Composite and SVideo (DAC A/B/C) */
  996. # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
  997. # define TV_TRILEVEL_SYNC (1 << 21)
  998. /** Enables slow sync generation (945GM only) */
  999. # define TV_SLOW_SYNC (1 << 20)
  1000. /** Selects 4x oversampling for 480i and 576p */
  1001. # define TV_OVERSAMPLE_4X (0 << 18)
  1002. /** Selects 2x oversampling for 720p and 1080i */
  1003. # define TV_OVERSAMPLE_2X (1 << 18)
  1004. /** Selects no oversampling for 1080p */
  1005. # define TV_OVERSAMPLE_NONE (2 << 18)
  1006. /** Selects 8x oversampling */
  1007. # define TV_OVERSAMPLE_8X (3 << 18)
  1008. /** Selects progressive mode rather than interlaced */
  1009. # define TV_PROGRESSIVE (1 << 17)
  1010. /** Sets the colorburst to PAL mode. Required for non-M PAL modes. */
  1011. # define TV_PAL_BURST (1 << 16)
  1012. /** Field for setting delay of Y compared to C */
  1013. # define TV_YC_SKEW_MASK (7 << 12)
  1014. /** Enables a fix for 480p/576p standard definition modes on the 915GM only */
  1015. # define TV_ENC_SDP_FIX (1 << 11)
  1016. /**
  1017. * Enables a fix for the 915GM only.
  1018. *
  1019. * Not sure what it does.
  1020. */
  1021. # define TV_ENC_C0_FIX (1 << 10)
  1022. /** Bits that must be preserved by software */
  1023. # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
  1024. # define TV_FUSE_STATE_MASK (3 << 4)
  1025. /** Read-only state that reports all features enabled */
  1026. # define TV_FUSE_STATE_ENABLED (0 << 4)
  1027. /** Read-only state that reports that Macrovision is disabled in hardware*/
  1028. # define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
  1029. /** Read-only state that reports that TV-out is disabled in hardware. */
  1030. # define TV_FUSE_STATE_DISABLED (2 << 4)
  1031. /** Normal operation */
  1032. # define TV_TEST_MODE_NORMAL (0 << 0)
  1033. /** Encoder test pattern 1 - combo pattern */
  1034. # define TV_TEST_MODE_PATTERN_1 (1 << 0)
  1035. /** Encoder test pattern 2 - full screen vertical 75% color bars */
  1036. # define TV_TEST_MODE_PATTERN_2 (2 << 0)
  1037. /** Encoder test pattern 3 - full screen horizontal 75% color bars */
  1038. # define TV_TEST_MODE_PATTERN_3 (3 << 0)
  1039. /** Encoder test pattern 4 - random noise */
  1040. # define TV_TEST_MODE_PATTERN_4 (4 << 0)
  1041. /** Encoder test pattern 5 - linear color ramps */
  1042. # define TV_TEST_MODE_PATTERN_5 (5 << 0)
  1043. /**
  1044. * This test mode forces the DACs to 50% of full output.
  1045. *
  1046. * This is used for load detection in combination with TVDAC_SENSE_MASK
  1047. */
  1048. # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
  1049. # define TV_TEST_MODE_MASK (7 << 0)
  1050. #define TV_DAC 0x68004
  1051. /**
  1052. * Reports that DAC state change logic has reported change (RO).
  1053. *
  1054. * This gets cleared when TV_DAC_STATE_EN is cleared
  1055. */
  1056. # define TVDAC_STATE_CHG (1 << 31)
  1057. # define TVDAC_SENSE_MASK (7 << 28)
  1058. /** Reports that DAC A voltage is above the detect threshold */
  1059. # define TVDAC_A_SENSE (1 << 30)
  1060. /** Reports that DAC B voltage is above the detect threshold */
  1061. # define TVDAC_B_SENSE (1 << 29)
  1062. /** Reports that DAC C voltage is above the detect threshold */
  1063. # define TVDAC_C_SENSE (1 << 28)
  1064. /**
  1065. * Enables DAC state detection logic, for load-based TV detection.
  1066. *
  1067. * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
  1068. * to off, for load detection to work.
  1069. */
  1070. # define TVDAC_STATE_CHG_EN (1 << 27)
  1071. /** Sets the DAC A sense value to high */
  1072. # define TVDAC_A_SENSE_CTL (1 << 26)
  1073. /** Sets the DAC B sense value to high */
  1074. # define TVDAC_B_SENSE_CTL (1 << 25)
  1075. /** Sets the DAC C sense value to high */
  1076. # define TVDAC_C_SENSE_CTL (1 << 24)
  1077. /** Overrides the ENC_ENABLE and DAC voltage levels */
  1078. # define DAC_CTL_OVERRIDE (1 << 7)
  1079. /** Sets the slew rate. Must be preserved in software */
  1080. # define ENC_TVDAC_SLEW_FAST (1 << 6)
  1081. # define DAC_A_1_3_V (0 << 4)
  1082. # define DAC_A_1_1_V (1 << 4)
  1083. # define DAC_A_0_7_V (2 << 4)
  1084. # define DAC_A_MASK (3 << 4)
  1085. # define DAC_B_1_3_V (0 << 2)
  1086. # define DAC_B_1_1_V (1 << 2)
  1087. # define DAC_B_0_7_V (2 << 2)
  1088. # define DAC_B_MASK (3 << 2)
  1089. # define DAC_C_1_3_V (0 << 0)
  1090. # define DAC_C_1_1_V (1 << 0)
  1091. # define DAC_C_0_7_V (2 << 0)
  1092. # define DAC_C_MASK (3 << 0)
  1093. /**
  1094. * CSC coefficients are stored in a floating point format with 9 bits of
  1095. * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
  1096. * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
  1097. * -1 (0x3) being the only legal negative value.
  1098. */
  1099. #define TV_CSC_Y 0x68010
  1100. # define TV_RY_MASK 0x07ff0000
  1101. # define TV_RY_SHIFT 16
  1102. # define TV_GY_MASK 0x00000fff
  1103. # define TV_GY_SHIFT 0
  1104. #define TV_CSC_Y2 0x68014
  1105. # define TV_BY_MASK 0x07ff0000
  1106. # define TV_BY_SHIFT 16
  1107. /**
  1108. * Y attenuation for component video.
  1109. *
  1110. * Stored in 1.9 fixed point.
  1111. */
  1112. # define TV_AY_MASK 0x000003ff
  1113. # define TV_AY_SHIFT 0
  1114. #define TV_CSC_U 0x68018
  1115. # define TV_RU_MASK 0x07ff0000
  1116. # define TV_RU_SHIFT 16
  1117. # define TV_GU_MASK 0x000007ff
  1118. # define TV_GU_SHIFT 0
  1119. #define TV_CSC_U2 0x6801c
  1120. # define TV_BU_MASK 0x07ff0000
  1121. # define TV_BU_SHIFT 16
  1122. /**
  1123. * U attenuation for component video.
  1124. *
  1125. * Stored in 1.9 fixed point.
  1126. */
  1127. # define TV_AU_MASK 0x000003ff
  1128. # define TV_AU_SHIFT 0
  1129. #define TV_CSC_V 0x68020
  1130. # define TV_RV_MASK 0x0fff0000
  1131. # define TV_RV_SHIFT 16
  1132. # define TV_GV_MASK 0x000007ff
  1133. # define TV_GV_SHIFT 0
  1134. #define TV_CSC_V2 0x68024
  1135. # define TV_BV_MASK 0x07ff0000
  1136. # define TV_BV_SHIFT 16
  1137. /**
  1138. * V attenuation for component video.
  1139. *
  1140. * Stored in 1.9 fixed point.
  1141. */
  1142. # define TV_AV_MASK 0x000007ff
  1143. # define TV_AV_SHIFT 0
  1144. #define TV_CLR_KNOBS 0x68028
  1145. /** 2s-complement brightness adjustment */
  1146. # define TV_BRIGHTNESS_MASK 0xff000000
  1147. # define TV_BRIGHTNESS_SHIFT 24
  1148. /** Contrast adjustment, as a 2.6 unsigned floating point number */
  1149. # define TV_CONTRAST_MASK 0x00ff0000
  1150. # define TV_CONTRAST_SHIFT 16
  1151. /** Saturation adjustment, as a 2.6 unsigned floating point number */
  1152. # define TV_SATURATION_MASK 0x0000ff00
  1153. # define TV_SATURATION_SHIFT 8
  1154. /** Hue adjustment, as an integer phase angle in degrees */
  1155. # define TV_HUE_MASK 0x000000ff
  1156. # define TV_HUE_SHIFT 0
  1157. #define TV_CLR_LEVEL 0x6802c
  1158. /** Controls the DAC level for black */
  1159. # define TV_BLACK_LEVEL_MASK 0x01ff0000
  1160. # define TV_BLACK_LEVEL_SHIFT 16
  1161. /** Controls the DAC level for blanking */
  1162. # define TV_BLANK_LEVEL_MASK 0x000001ff
  1163. # define TV_BLANK_LEVEL_SHIFT 0
  1164. #define TV_H_CTL_1 0x68030
  1165. /** Number of pixels in the hsync. */
  1166. # define TV_HSYNC_END_MASK 0x1fff0000
  1167. # define TV_HSYNC_END_SHIFT 16
  1168. /** Total number of pixels minus one in the line (display and blanking). */
  1169. # define TV_HTOTAL_MASK 0x00001fff
  1170. # define TV_HTOTAL_SHIFT 0
  1171. #define TV_H_CTL_2 0x68034
  1172. /** Enables the colorburst (needed for non-component color) */
  1173. # define TV_BURST_ENA (1 << 31)
  1174. /** Offset of the colorburst from the start of hsync, in pixels minus one. */
  1175. # define TV_HBURST_START_SHIFT 16
  1176. # define TV_HBURST_START_MASK 0x1fff0000
  1177. /** Length of the colorburst */
  1178. # define TV_HBURST_LEN_SHIFT 0
  1179. # define TV_HBURST_LEN_MASK 0x0001fff
  1180. #define TV_H_CTL_3 0x68038
  1181. /** End of hblank, measured in pixels minus one from start of hsync */
  1182. # define TV_HBLANK_END_SHIFT 16
  1183. # define TV_HBLANK_END_MASK 0x1fff0000
  1184. /** Start of hblank, measured in pixels minus one from start of hsync */
  1185. # define TV_HBLANK_START_SHIFT 0
  1186. # define TV_HBLANK_START_MASK 0x0001fff
  1187. #define TV_V_CTL_1 0x6803c
  1188. /** XXX */
  1189. # define TV_NBR_END_SHIFT 16
  1190. # define TV_NBR_END_MASK 0x07ff0000
  1191. /** XXX */
  1192. # define TV_VI_END_F1_SHIFT 8
  1193. # define TV_VI_END_F1_MASK 0x00003f00
  1194. /** XXX */
  1195. # define TV_VI_END_F2_SHIFT 0
  1196. # define TV_VI_END_F2_MASK 0x0000003f
  1197. #define TV_V_CTL_2 0x68040
  1198. /** Length of vsync, in half lines */
  1199. # define TV_VSYNC_LEN_MASK 0x07ff0000
  1200. # define TV_VSYNC_LEN_SHIFT 16
  1201. /** Offset of the start of vsync in field 1, measured in one less than the
  1202. * number of half lines.
  1203. */
  1204. # define TV_VSYNC_START_F1_MASK 0x00007f00
  1205. # define TV_VSYNC_START_F1_SHIFT 8
  1206. /**
  1207. * Offset of the start of vsync in field 2, measured in one less than the
  1208. * number of half lines.
  1209. */
  1210. # define TV_VSYNC_START_F2_MASK 0x0000007f
  1211. # define TV_VSYNC_START_F2_SHIFT 0
  1212. #define TV_V_CTL_3 0x68044
  1213. /** Enables generation of the equalization signal */
  1214. # define TV_EQUAL_ENA (1 << 31)
  1215. /** Length of vsync, in half lines */
  1216. # define TV_VEQ_LEN_MASK 0x007f0000
  1217. # define TV_VEQ_LEN_SHIFT 16
  1218. /** Offset of the start of equalization in field 1, measured in one less than
  1219. * the number of half lines.
  1220. */
  1221. # define TV_VEQ_START_F1_MASK 0x0007f00
  1222. # define TV_VEQ_START_F1_SHIFT 8
  1223. /**
  1224. * Offset of the start of equalization in field 2, measured in one less than
  1225. * the number of half lines.
  1226. */
  1227. # define TV_VEQ_START_F2_MASK 0x000007f
  1228. # define TV_VEQ_START_F2_SHIFT 0
  1229. #define TV_V_CTL_4 0x68048
  1230. /**
  1231. * Offset to start of vertical colorburst, measured in one less than the
  1232. * number of lines from vertical start.
  1233. */
  1234. # define TV_VBURST_START_F1_MASK 0x003f0000
  1235. # define TV_VBURST_START_F1_SHIFT 16
  1236. /**
  1237. * Offset to the end of vertical colorburst, measured in one less than the
  1238. * number of lines from the start of NBR.
  1239. */
  1240. # define TV_VBURST_END_F1_MASK 0x000000ff
  1241. # define TV_VBURST_END_F1_SHIFT 0
  1242. #define TV_V_CTL_5 0x6804c
  1243. /**
  1244. * Offset to start of vertical colorburst, measured in one less than the
  1245. * number of lines from vertical start.
  1246. */
  1247. # define TV_VBURST_START_F2_MASK 0x003f0000
  1248. # define TV_VBURST_START_F2_SHIFT 16
  1249. /**
  1250. * Offset to the end of vertical colorburst, measured in one less than the
  1251. * number of lines from the start of NBR.
  1252. */
  1253. # define TV_VBURST_END_F2_MASK 0x000000ff
  1254. # define TV_VBURST_END_F2_SHIFT 0
  1255. #define TV_V_CTL_6 0x68050
  1256. /**
  1257. * Offset to start of vertical colorburst, measured in one less than the
  1258. * number of lines from vertical start.
  1259. */
  1260. # define TV_VBURST_START_F3_MASK 0x003f0000
  1261. # define TV_VBURST_START_F3_SHIFT 16
  1262. /**
  1263. * Offset to the end of vertical colorburst, measured in one less than the
  1264. * number of lines from the start of NBR.
  1265. */
  1266. # define TV_VBURST_END_F3_MASK 0x000000ff
  1267. # define TV_VBURST_END_F3_SHIFT 0
  1268. #define TV_V_CTL_7 0x68054
  1269. /**
  1270. * Offset to start of vertical colorburst, measured in one less than the
  1271. * number of lines from vertical start.
  1272. */
  1273. # define TV_VBURST_START_F4_MASK 0x003f0000
  1274. # define TV_VBURST_START_F4_SHIFT 16
  1275. /**
  1276. * Offset to the end of vertical colorburst, measured in one less than the
  1277. * number of lines from the start of NBR.
  1278. */
  1279. # define TV_VBURST_END_F4_MASK 0x000000ff
  1280. # define TV_VBURST_END_F4_SHIFT 0
  1281. #define TV_SC_CTL_1 0x68060
  1282. /** Turns on the first subcarrier phase generation DDA */
  1283. # define TV_SC_DDA1_EN (1 << 31)
  1284. /** Turns on the first subcarrier phase generation DDA */
  1285. # define TV_SC_DDA2_EN (1 << 30)
  1286. /** Turns on the first subcarrier phase generation DDA */
  1287. # define TV_SC_DDA3_EN (1 << 29)
  1288. /** Sets the subcarrier DDA to reset frequency every other field */
  1289. # define TV_SC_RESET_EVERY_2 (0 << 24)
  1290. /** Sets the subcarrier DDA to reset frequency every fourth field */
  1291. # define TV_SC_RESET_EVERY_4 (1 << 24)
  1292. /** Sets the subcarrier DDA to reset frequency every eighth field */
  1293. # define TV_SC_RESET_EVERY_8 (2 << 24)
  1294. /** Sets the subcarrier DDA to never reset the frequency */
  1295. # define TV_SC_RESET_NEVER (3 << 24)
  1296. /** Sets the peak amplitude of the colorburst.*/
  1297. # define TV_BURST_LEVEL_MASK 0x00ff0000
  1298. # define TV_BURST_LEVEL_SHIFT 16
  1299. /** Sets the increment of the first subcarrier phase generation DDA */
  1300. # define TV_SCDDA1_INC_MASK 0x00000fff
  1301. # define TV_SCDDA1_INC_SHIFT 0
  1302. #define TV_SC_CTL_2 0x68064
  1303. /** Sets the rollover for the second subcarrier phase generation DDA */
  1304. # define TV_SCDDA2_SIZE_MASK 0x7fff0000
  1305. # define TV_SCDDA2_SIZE_SHIFT 16
  1306. /** Sets the increent of the second subcarrier phase generation DDA */
  1307. # define TV_SCDDA2_INC_MASK 0x00007fff
  1308. # define TV_SCDDA2_INC_SHIFT 0
  1309. #define TV_SC_CTL_3 0x68068
  1310. /** Sets the rollover for the third subcarrier phase generation DDA */
  1311. # define TV_SCDDA3_SIZE_MASK 0x7fff0000
  1312. # define TV_SCDDA3_SIZE_SHIFT 16
  1313. /** Sets the increent of the third subcarrier phase generation DDA */
  1314. # define TV_SCDDA3_INC_MASK 0x00007fff
  1315. # define TV_SCDDA3_INC_SHIFT 0
  1316. #define TV_WIN_POS 0x68070
  1317. /** X coordinate of the display from the start of horizontal active */
  1318. # define TV_XPOS_MASK 0x1fff0000
  1319. # define TV_XPOS_SHIFT 16
  1320. /** Y coordinate of the display from the start of vertical active (NBR) */
  1321. # define TV_YPOS_MASK 0x00000fff
  1322. # define TV_YPOS_SHIFT 0
  1323. #define TV_WIN_SIZE 0x68074
  1324. /** Horizontal size of the display window, measured in pixels*/
  1325. # define TV_XSIZE_MASK 0x1fff0000
  1326. # define TV_XSIZE_SHIFT 16
  1327. /**
  1328. * Vertical size of the display window, measured in pixels.
  1329. *
  1330. * Must be even for interlaced modes.
  1331. */
  1332. # define TV_YSIZE_MASK 0x00000fff
  1333. # define TV_YSIZE_SHIFT 0
  1334. #define TV_FILTER_CTL_1 0x68080
  1335. /**
  1336. * Enables automatic scaling calculation.
  1337. *
  1338. * If set, the rest of the registers are ignored, and the calculated values can
  1339. * be read back from the register.
  1340. */
  1341. # define TV_AUTO_SCALE (1 << 31)
  1342. /**
  1343. * Disables the vertical filter.
  1344. *
  1345. * This is required on modes more than 1024 pixels wide */
  1346. # define TV_V_FILTER_BYPASS (1 << 29)
  1347. /** Enables adaptive vertical filtering */
  1348. # define TV_VADAPT (1 << 28)
  1349. # define TV_VADAPT_MODE_MASK (3 << 26)
  1350. /** Selects the least adaptive vertical filtering mode */
  1351. # define TV_VADAPT_MODE_LEAST (0 << 26)
  1352. /** Selects the moderately adaptive vertical filtering mode */
  1353. # define TV_VADAPT_MODE_MODERATE (1 << 26)
  1354. /** Selects the most adaptive vertical filtering mode */
  1355. # define TV_VADAPT_MODE_MOST (3 << 26)
  1356. /**
  1357. * Sets the horizontal scaling factor.
  1358. *
  1359. * This should be the fractional part of the horizontal scaling factor divided
  1360. * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
  1361. *
  1362. * (src width - 1) / ((oversample * dest width) - 1)
  1363. */
  1364. # define TV_HSCALE_FRAC_MASK 0x00003fff
  1365. # define TV_HSCALE_FRAC_SHIFT 0
  1366. #define TV_FILTER_CTL_2 0x68084
  1367. /**
  1368. * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
  1369. *
  1370. * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
  1371. */
  1372. # define TV_VSCALE_INT_MASK 0x00038000
  1373. # define TV_VSCALE_INT_SHIFT 15
  1374. /**
  1375. * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
  1376. *
  1377. * \sa TV_VSCALE_INT_MASK
  1378. */
  1379. # define TV_VSCALE_FRAC_MASK 0x00007fff
  1380. # define TV_VSCALE_FRAC_SHIFT 0
  1381. #define TV_FILTER_CTL_3 0x68088
  1382. /**
  1383. * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
  1384. *
  1385. * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
  1386. *
  1387. * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
  1388. */
  1389. # define TV_VSCALE_IP_INT_MASK 0x00038000
  1390. # define TV_VSCALE_IP_INT_SHIFT 15
  1391. /**
  1392. * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
  1393. *
  1394. * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
  1395. *
  1396. * \sa TV_VSCALE_IP_INT_MASK
  1397. */
  1398. # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
  1399. # define TV_VSCALE_IP_FRAC_SHIFT 0
  1400. #define TV_CC_CONTROL 0x68090
  1401. # define TV_CC_ENABLE (1 << 31)
  1402. /**
  1403. * Specifies which field to send the CC data in.
  1404. *
  1405. * CC data is usually sent in field 0.
  1406. */
  1407. # define TV_CC_FID_MASK (1 << 27)
  1408. # define TV_CC_FID_SHIFT 27
  1409. /** Sets the horizontal position of the CC data. Usually 135. */
  1410. # define TV_CC_HOFF_MASK 0x03ff0000
  1411. # define TV_CC_HOFF_SHIFT 16
  1412. /** Sets the vertical position of the CC data. Usually 21 */
  1413. # define TV_CC_LINE_MASK 0x0000003f
  1414. # define TV_CC_LINE_SHIFT 0
  1415. #define TV_CC_DATA 0x68094
  1416. # define TV_CC_RDY (1 << 31)
  1417. /** Second word of CC data to be transmitted. */
  1418. # define TV_CC_DATA_2_MASK 0x007f0000
  1419. # define TV_CC_DATA_2_SHIFT 16
  1420. /** First word of CC data to be transmitted. */
  1421. # define TV_CC_DATA_1_MASK 0x0000007f
  1422. # define TV_CC_DATA_1_SHIFT 0
  1423. #define TV_H_LUMA_0 0x68100
  1424. #define TV_H_LUMA_59 0x681ec
  1425. #define TV_H_CHROMA_0 0x68200
  1426. #define TV_H_CHROMA_59 0x682ec
  1427. #define TV_V_LUMA_0 0x68300
  1428. #define TV_V_LUMA_42 0x683a8
  1429. #define TV_V_CHROMA_0 0x68400
  1430. #define TV_V_CHROMA_42 0x684a8
  1431. /* Display Port */
  1432. #define DP_A 0x64000 /* eDP */
  1433. #define DP_B 0x64100
  1434. #define DP_C 0x64200
  1435. #define DP_D 0x64300
  1436. #define DP_PORT_EN (1 << 31)
  1437. #define DP_PIPEB_SELECT (1 << 30)
  1438. /* Link training mode - select a suitable mode for each stage */
  1439. #define DP_LINK_TRAIN_PAT_1 (0 << 28)
  1440. #define DP_LINK_TRAIN_PAT_2 (1 << 28)
  1441. #define DP_LINK_TRAIN_PAT_IDLE (2 << 28)
  1442. #define DP_LINK_TRAIN_OFF (3 << 28)
  1443. #define DP_LINK_TRAIN_MASK (3 << 28)
  1444. #define DP_LINK_TRAIN_SHIFT 28
  1445. /* Signal voltages. These are mostly controlled by the other end */
  1446. #define DP_VOLTAGE_0_4 (0 << 25)
  1447. #define DP_VOLTAGE_0_6 (1 << 25)
  1448. #define DP_VOLTAGE_0_8 (2 << 25)
  1449. #define DP_VOLTAGE_1_2 (3 << 25)
  1450. #define DP_VOLTAGE_MASK (7 << 25)
  1451. #define DP_VOLTAGE_SHIFT 25
  1452. /* Signal pre-emphasis levels, like voltages, the other end tells us what
  1453. * they want
  1454. */
  1455. #define DP_PRE_EMPHASIS_0 (0 << 22)
  1456. #define DP_PRE_EMPHASIS_3_5 (1 << 22)
  1457. #define DP_PRE_EMPHASIS_6 (2 << 22)
  1458. #define DP_PRE_EMPHASIS_9_5 (3 << 22)
  1459. #define DP_PRE_EMPHASIS_MASK (7 << 22)
  1460. #define DP_PRE_EMPHASIS_SHIFT 22
  1461. /* How many wires to use. I guess 3 was too hard */
  1462. #define DP_PORT_WIDTH_1 (0 << 19)
  1463. #define DP_PORT_WIDTH_2 (1 << 19)
  1464. #define DP_PORT_WIDTH_4 (3 << 19)
  1465. #define DP_PORT_WIDTH_MASK (7 << 19)
  1466. /* Mystic DPCD version 1.1 special mode */
  1467. #define DP_ENHANCED_FRAMING (1 << 18)
  1468. /* eDP */
  1469. #define DP_PLL_FREQ_270MHZ (0 << 16)
  1470. #define DP_PLL_FREQ_160MHZ (1 << 16)
  1471. #define DP_PLL_FREQ_MASK (3 << 16)
  1472. /** locked once port is enabled */
  1473. #define DP_PORT_REVERSAL (1 << 15)
  1474. /* eDP */
  1475. #define DP_PLL_ENABLE (1 << 14)
  1476. /** sends the clock on lane 15 of the PEG for debug */
  1477. #define DP_CLOCK_OUTPUT_ENABLE (1 << 13)
  1478. #define DP_SCRAMBLING_DISABLE (1 << 12)
  1479. #define DP_SCRAMBLING_DISABLE_IGDNG (1 << 7)
  1480. /** limit RGB values to avoid confusing TVs */
  1481. #define DP_COLOR_RANGE_16_235 (1 << 8)
  1482. /** Turn on the audio link */
  1483. #define DP_AUDIO_OUTPUT_ENABLE (1 << 6)
  1484. /** vs and hs sync polarity */
  1485. #define DP_SYNC_VS_HIGH (1 << 4)
  1486. #define DP_SYNC_HS_HIGH (1 << 3)
  1487. /** A fantasy */
  1488. #define DP_DETECTED (1 << 2)
  1489. /** The aux channel provides a way to talk to the
  1490. * signal sink for DDC etc. Max packet size supported
  1491. * is 20 bytes in each direction, hence the 5 fixed
  1492. * data registers
  1493. */
  1494. #define DPA_AUX_CH_CTL 0x64010
  1495. #define DPA_AUX_CH_DATA1 0x64014
  1496. #define DPA_AUX_CH_DATA2 0x64018
  1497. #define DPA_AUX_CH_DATA3 0x6401c
  1498. #define DPA_AUX_CH_DATA4 0x64020
  1499. #define DPA_AUX_CH_DATA5 0x64024
  1500. #define DPB_AUX_CH_CTL 0x64110
  1501. #define DPB_AUX_CH_DATA1 0x64114
  1502. #define DPB_AUX_CH_DATA2 0x64118
  1503. #define DPB_AUX_CH_DATA3 0x6411c
  1504. #define DPB_AUX_CH_DATA4 0x64120
  1505. #define DPB_AUX_CH_DATA5 0x64124
  1506. #define DPC_AUX_CH_CTL 0x64210
  1507. #define DPC_AUX_CH_DATA1 0x64214
  1508. #define DPC_AUX_CH_DATA2 0x64218
  1509. #define DPC_AUX_CH_DATA3 0x6421c
  1510. #define DPC_AUX_CH_DATA4 0x64220
  1511. #define DPC_AUX_CH_DATA5 0x64224
  1512. #define DPD_AUX_CH_CTL 0x64310
  1513. #define DPD_AUX_CH_DATA1 0x64314
  1514. #define DPD_AUX_CH_DATA2 0x64318
  1515. #define DPD_AUX_CH_DATA3 0x6431c
  1516. #define DPD_AUX_CH_DATA4 0x64320
  1517. #define DPD_AUX_CH_DATA5 0x64324
  1518. #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
  1519. #define DP_AUX_CH_CTL_DONE (1 << 30)
  1520. #define DP_AUX_CH_CTL_INTERRUPT (1 << 29)
  1521. #define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28)
  1522. #define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26)
  1523. #define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26)
  1524. #define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26)
  1525. #define DP_AUX_CH_CTL_TIME_OUT_1600us (3 << 26)
  1526. #define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26)
  1527. #define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25)
  1528. #define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
  1529. #define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20
  1530. #define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16)
  1531. #define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16
  1532. #define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15)
  1533. #define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14)
  1534. #define DP_AUX_CH_CTL_SYNC_TEST (1 << 13)
  1535. #define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12)
  1536. #define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)
  1537. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)
  1538. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0
  1539. /*
  1540. * Computing GMCH M and N values for the Display Port link
  1541. *
  1542. * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
  1543. *
  1544. * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
  1545. *
  1546. * The GMCH value is used internally
  1547. *
  1548. * bytes_per_pixel is the number of bytes coming out of the plane,
  1549. * which is after the LUTs, so we want the bytes for our color format.
  1550. * For our current usage, this is always 3, one byte for R, G and B.
  1551. */
  1552. #define PIPEA_GMCH_DATA_M 0x70050
  1553. #define PIPEB_GMCH_DATA_M 0x71050
  1554. /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
  1555. #define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
  1556. #define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
  1557. #define PIPE_GMCH_DATA_M_MASK (0xffffff)
  1558. #define PIPEA_GMCH_DATA_N 0x70054
  1559. #define PIPEB_GMCH_DATA_N 0x71054
  1560. #define PIPE_GMCH_DATA_N_MASK (0xffffff)
  1561. /*
  1562. * Computing Link M and N values for the Display Port link
  1563. *
  1564. * Link M / N = pixel_clock / ls_clk
  1565. *
  1566. * (the DP spec calls pixel_clock the 'strm_clk')
  1567. *
  1568. * The Link value is transmitted in the Main Stream
  1569. * Attributes and VB-ID.
  1570. */
  1571. #define PIPEA_DP_LINK_M 0x70060
  1572. #define PIPEB_DP_LINK_M 0x71060
  1573. #define PIPEA_DP_LINK_M_MASK (0xffffff)
  1574. #define PIPEA_DP_LINK_N 0x70064
  1575. #define PIPEB_DP_LINK_N 0x71064
  1576. #define PIPEA_DP_LINK_N_MASK (0xffffff)
  1577. /* Display & cursor control */
  1578. /* Pipe A */
  1579. #define PIPEADSL 0x70000
  1580. #define PIPEACONF 0x70008
  1581. #define PIPEACONF_ENABLE (1<<31)
  1582. #define PIPEACONF_DISABLE 0
  1583. #define PIPEACONF_DOUBLE_WIDE (1<<30)
  1584. #define I965_PIPECONF_ACTIVE (1<<30)
  1585. #define PIPEACONF_SINGLE_WIDE 0
  1586. #define PIPEACONF_PIPE_UNLOCKED 0
  1587. #define PIPEACONF_PIPE_LOCKED (1<<25)
  1588. #define PIPEACONF_PALETTE 0
  1589. #define PIPEACONF_GAMMA (1<<24)
  1590. #define PIPECONF_FORCE_BORDER (1<<25)
  1591. #define PIPECONF_PROGRESSIVE (0 << 21)
  1592. #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
  1593. #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
  1594. #define PIPECONF_CXSR_DOWNCLOCK (1<<16)
  1595. #define PIPEASTAT 0x70024
  1596. #define PIPE_FIFO_UNDERRUN_STATUS (1UL<<31)
  1597. #define PIPE_CRC_ERROR_ENABLE (1UL<<29)
  1598. #define PIPE_CRC_DONE_ENABLE (1UL<<28)
  1599. #define PIPE_GMBUS_EVENT_ENABLE (1UL<<27)
  1600. #define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL<<26)
  1601. #define PIPE_VSYNC_INTERRUPT_ENABLE (1UL<<25)
  1602. #define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
  1603. #define PIPE_DPST_EVENT_ENABLE (1UL<<23)
  1604. #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
  1605. #define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
  1606. #define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
  1607. #define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL<<18) /* pre-965 */
  1608. #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
  1609. #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL<<17)
  1610. #define PIPE_OVERLAY_UPDATED_ENABLE (1UL<<16)
  1611. #define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
  1612. #define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
  1613. #define PIPE_GMBUS_INTERRUPT_STATUS (1UL<<11)
  1614. #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL<<10)
  1615. #define PIPE_VSYNC_INTERRUPT_STATUS (1UL<<9)
  1616. #define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
  1617. #define PIPE_DPST_EVENT_STATUS (1UL<<7)
  1618. #define PIPE_LEGACY_BLC_EVENT_STATUS (1UL<<6)
  1619. #define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
  1620. #define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
  1621. #define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL<<2) /* pre-965 */
  1622. #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
  1623. #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
  1624. #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
  1625. #define DSPARB 0x70030
  1626. #define DSPARB_CSTART_MASK (0x7f << 7)
  1627. #define DSPARB_CSTART_SHIFT 7
  1628. #define DSPARB_BSTART_MASK (0x7f)
  1629. #define DSPARB_BSTART_SHIFT 0
  1630. #define DSPARB_BEND_SHIFT 9 /* on 855 */
  1631. #define DSPARB_AEND_SHIFT 0
  1632. #define DSPFW1 0x70034
  1633. #define DSPFW2 0x70038
  1634. #define DSPFW3 0x7003c
  1635. #define IGD_SELF_REFRESH_EN (1<<30)
  1636. /* FIFO watermark sizes etc */
  1637. #define I915_FIFO_LINE_SIZE 64
  1638. #define I830_FIFO_LINE_SIZE 32
  1639. #define I945_FIFO_SIZE 127 /* 945 & 965 */
  1640. #define I915_FIFO_SIZE 95
  1641. #define I855GM_FIFO_SIZE 127 /* In cachelines */
  1642. #define I830_FIFO_SIZE 95
  1643. #define I915_MAX_WM 0x3f
  1644. #define IGD_DISPLAY_FIFO 512 /* in 64byte unit */
  1645. #define IGD_FIFO_LINE_SIZE 64
  1646. #define IGD_MAX_WM 0x1ff
  1647. #define IGD_DFT_WM 0x3f
  1648. #define IGD_DFT_HPLLOFF_WM 0
  1649. #define IGD_GUARD_WM 10
  1650. #define IGD_CURSOR_FIFO 64
  1651. #define IGD_CURSOR_MAX_WM 0x3f
  1652. #define IGD_CURSOR_DFT_WM 0
  1653. #define IGD_CURSOR_GUARD_WM 5
  1654. /*
  1655. * The two pipe frame counter registers are not synchronized, so
  1656. * reading a stable value is somewhat tricky. The following code
  1657. * should work:
  1658. *
  1659. * do {
  1660. * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
  1661. * PIPE_FRAME_HIGH_SHIFT;
  1662. * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
  1663. * PIPE_FRAME_LOW_SHIFT);
  1664. * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
  1665. * PIPE_FRAME_HIGH_SHIFT);
  1666. * } while (high1 != high2);
  1667. * frame = (high1 << 8) | low1;
  1668. */
  1669. #define PIPEAFRAMEHIGH 0x70040
  1670. #define PIPE_FRAME_HIGH_MASK 0x0000ffff
  1671. #define PIPE_FRAME_HIGH_SHIFT 0
  1672. #define PIPEAFRAMEPIXEL 0x70044
  1673. #define PIPE_FRAME_LOW_MASK 0xff000000
  1674. #define PIPE_FRAME_LOW_SHIFT 24
  1675. #define PIPE_PIXEL_MASK 0x00ffffff
  1676. #define PIPE_PIXEL_SHIFT 0
  1677. /* GM45+ just has to be different */
  1678. #define PIPEA_FRMCOUNT_GM45 0x70040
  1679. #define PIPEA_FLIPCOUNT_GM45 0x70044
  1680. /* Cursor A & B regs */
  1681. #define CURACNTR 0x70080
  1682. /* Old style CUR*CNTR flags (desktop 8xx) */
  1683. #define CURSOR_ENABLE 0x80000000
  1684. #define CURSOR_GAMMA_ENABLE 0x40000000
  1685. #define CURSOR_STRIDE_MASK 0x30000000
  1686. #define CURSOR_FORMAT_SHIFT 24
  1687. #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
  1688. #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
  1689. #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
  1690. #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
  1691. #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
  1692. #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
  1693. /* New style CUR*CNTR flags */
  1694. #define CURSOR_MODE 0x27
  1695. #define CURSOR_MODE_DISABLE 0x00
  1696. #define CURSOR_MODE_64_32B_AX 0x07
  1697. #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
  1698. #define MCURSOR_PIPE_SELECT (1 << 28)
  1699. #define MCURSOR_PIPE_A 0x00
  1700. #define MCURSOR_PIPE_B (1 << 28)
  1701. #define MCURSOR_GAMMA_ENABLE (1 << 26)
  1702. #define CURABASE 0x70084
  1703. #define CURAPOS 0x70088
  1704. #define CURSOR_POS_MASK 0x007FF
  1705. #define CURSOR_POS_SIGN 0x8000
  1706. #define CURSOR_X_SHIFT 0
  1707. #define CURSOR_Y_SHIFT 16
  1708. #define CURSIZE 0x700a0
  1709. #define CURBCNTR 0x700c0
  1710. #define CURBBASE 0x700c4
  1711. #define CURBPOS 0x700c8
  1712. /* Display A control */
  1713. #define DSPACNTR 0x70180
  1714. #define DISPLAY_PLANE_ENABLE (1<<31)
  1715. #define DISPLAY_PLANE_DISABLE 0
  1716. #define DISPPLANE_GAMMA_ENABLE (1<<30)
  1717. #define DISPPLANE_GAMMA_DISABLE 0
  1718. #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
  1719. #define DISPPLANE_8BPP (0x2<<26)
  1720. #define DISPPLANE_15_16BPP (0x4<<26)
  1721. #define DISPPLANE_16BPP (0x5<<26)
  1722. #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
  1723. #define DISPPLANE_32BPP (0x7<<26)
  1724. #define DISPPLANE_STEREO_ENABLE (1<<25)
  1725. #define DISPPLANE_STEREO_DISABLE 0
  1726. #define DISPPLANE_SEL_PIPE_MASK (1<<24)
  1727. #define DISPPLANE_SEL_PIPE_A 0
  1728. #define DISPPLANE_SEL_PIPE_B (1<<24)
  1729. #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
  1730. #define DISPPLANE_SRC_KEY_DISABLE 0
  1731. #define DISPPLANE_LINE_DOUBLE (1<<20)
  1732. #define DISPPLANE_NO_LINE_DOUBLE 0
  1733. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  1734. #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
  1735. #define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* IGDNG */
  1736. #define DISPPLANE_TILED (1<<10)
  1737. #define DSPAADDR 0x70184
  1738. #define DSPASTRIDE 0x70188
  1739. #define DSPAPOS 0x7018C /* reserved */
  1740. #define DSPASIZE 0x70190
  1741. #define DSPASURF 0x7019C /* 965+ only */
  1742. #define DSPATILEOFF 0x701A4 /* 965+ only */
  1743. /* VBIOS flags */
  1744. #define SWF00 0x71410
  1745. #define SWF01 0x71414
  1746. #define SWF02 0x71418
  1747. #define SWF03 0x7141c
  1748. #define SWF04 0x71420
  1749. #define SWF05 0x71424
  1750. #define SWF06 0x71428
  1751. #define SWF10 0x70410
  1752. #define SWF11 0x70414
  1753. #define SWF14 0x71420
  1754. #define SWF30 0x72414
  1755. #define SWF31 0x72418
  1756. #define SWF32 0x7241c
  1757. /* Pipe B */
  1758. #define PIPEBDSL 0x71000
  1759. #define PIPEBCONF 0x71008
  1760. #define PIPEBSTAT 0x71024
  1761. #define PIPEBFRAMEHIGH 0x71040
  1762. #define PIPEBFRAMEPIXEL 0x71044
  1763. #define PIPEB_FRMCOUNT_GM45 0x71040
  1764. #define PIPEB_FLIPCOUNT_GM45 0x71044
  1765. /* Display B control */
  1766. #define DSPBCNTR 0x71180
  1767. #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
  1768. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  1769. #define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
  1770. #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
  1771. #define DSPBADDR 0x71184
  1772. #define DSPBSTRIDE 0x71188
  1773. #define DSPBPOS 0x7118C
  1774. #define DSPBSIZE 0x71190
  1775. #define DSPBSURF 0x7119C
  1776. #define DSPBTILEOFF 0x711A4
  1777. /* VBIOS regs */
  1778. #define VGACNTRL 0x71400
  1779. # define VGA_DISP_DISABLE (1 << 31)
  1780. # define VGA_2X_MODE (1 << 30)
  1781. # define VGA_PIPE_B_SELECT (1 << 29)
  1782. /* IGDNG */
  1783. #define CPU_VGACNTRL 0x41000
  1784. #define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030
  1785. #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
  1786. #define DIGITAL_PORTA_SHORT_PULSE_2MS (0 << 2)
  1787. #define DIGITAL_PORTA_SHORT_PULSE_4_5MS (1 << 2)
  1788. #define DIGITAL_PORTA_SHORT_PULSE_6MS (2 << 2)
  1789. #define DIGITAL_PORTA_SHORT_PULSE_100MS (3 << 2)
  1790. #define DIGITAL_PORTA_NO_DETECT (0 << 0)
  1791. #define DIGITAL_PORTA_LONG_PULSE_DETECT_MASK (1 << 1)
  1792. #define DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK (1 << 0)
  1793. /* refresh rate hardware control */
  1794. #define RR_HW_CTL 0x45300
  1795. #define RR_HW_LOW_POWER_FRAMES_MASK 0xff
  1796. #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
  1797. #define FDI_PLL_BIOS_0 0x46000
  1798. #define FDI_PLL_BIOS_1 0x46004
  1799. #define FDI_PLL_BIOS_2 0x46008
  1800. #define DISPLAY_PORT_PLL_BIOS_0 0x4600c
  1801. #define DISPLAY_PORT_PLL_BIOS_1 0x46010
  1802. #define DISPLAY_PORT_PLL_BIOS_2 0x46014
  1803. #define FDI_PLL_FREQ_CTL 0x46030
  1804. #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
  1805. #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
  1806. #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
  1807. #define PIPEA_DATA_M1 0x60030
  1808. #define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */
  1809. #define TU_SIZE_MASK 0x7e000000
  1810. #define PIPEA_DATA_M1_OFFSET 0
  1811. #define PIPEA_DATA_N1 0x60034
  1812. #define PIPEA_DATA_N1_OFFSET 0
  1813. #define PIPEA_DATA_M2 0x60038
  1814. #define PIPEA_DATA_M2_OFFSET 0
  1815. #define PIPEA_DATA_N2 0x6003c
  1816. #define PIPEA_DATA_N2_OFFSET 0
  1817. #define PIPEA_LINK_M1 0x60040
  1818. #define PIPEA_LINK_M1_OFFSET 0
  1819. #define PIPEA_LINK_N1 0x60044
  1820. #define PIPEA_LINK_N1_OFFSET 0
  1821. #define PIPEA_LINK_M2 0x60048
  1822. #define PIPEA_LINK_M2_OFFSET 0
  1823. #define PIPEA_LINK_N2 0x6004c
  1824. #define PIPEA_LINK_N2_OFFSET 0
  1825. /* PIPEB timing regs are same start from 0x61000 */
  1826. #define PIPEB_DATA_M1 0x61030
  1827. #define PIPEB_DATA_M1_OFFSET 0
  1828. #define PIPEB_DATA_N1 0x61034
  1829. #define PIPEB_DATA_N1_OFFSET 0
  1830. #define PIPEB_DATA_M2 0x61038
  1831. #define PIPEB_DATA_M2_OFFSET 0
  1832. #define PIPEB_DATA_N2 0x6103c
  1833. #define PIPEB_DATA_N2_OFFSET 0
  1834. #define PIPEB_LINK_M1 0x61040
  1835. #define PIPEB_LINK_M1_OFFSET 0
  1836. #define PIPEB_LINK_N1 0x61044
  1837. #define PIPEB_LINK_N1_OFFSET 0
  1838. #define PIPEB_LINK_M2 0x61048
  1839. #define PIPEB_LINK_M2_OFFSET 0
  1840. #define PIPEB_LINK_N2 0x6104c
  1841. #define PIPEB_LINK_N2_OFFSET 0
  1842. /* CPU panel fitter */
  1843. #define PFA_CTL_1 0x68080
  1844. #define PFB_CTL_1 0x68880
  1845. #define PF_ENABLE (1<<31)
  1846. #define PFA_WIN_SZ 0x68074
  1847. #define PFB_WIN_SZ 0x68874
  1848. /* legacy palette */
  1849. #define LGC_PALETTE_A 0x4a000
  1850. #define LGC_PALETTE_B 0x4a800
  1851. /* interrupts */
  1852. #define DE_MASTER_IRQ_CONTROL (1 << 31)
  1853. #define DE_SPRITEB_FLIP_DONE (1 << 29)
  1854. #define DE_SPRITEA_FLIP_DONE (1 << 28)
  1855. #define DE_PLANEB_FLIP_DONE (1 << 27)
  1856. #define DE_PLANEA_FLIP_DONE (1 << 26)
  1857. #define DE_PCU_EVENT (1 << 25)
  1858. #define DE_GTT_FAULT (1 << 24)
  1859. #define DE_POISON (1 << 23)
  1860. #define DE_PERFORM_COUNTER (1 << 22)
  1861. #define DE_PCH_EVENT (1 << 21)
  1862. #define DE_AUX_CHANNEL_A (1 << 20)
  1863. #define DE_DP_A_HOTPLUG (1 << 19)
  1864. #define DE_GSE (1 << 18)
  1865. #define DE_PIPEB_VBLANK (1 << 15)
  1866. #define DE_PIPEB_EVEN_FIELD (1 << 14)
  1867. #define DE_PIPEB_ODD_FIELD (1 << 13)
  1868. #define DE_PIPEB_LINE_COMPARE (1 << 12)
  1869. #define DE_PIPEB_VSYNC (1 << 11)
  1870. #define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
  1871. #define DE_PIPEA_VBLANK (1 << 7)
  1872. #define DE_PIPEA_EVEN_FIELD (1 << 6)
  1873. #define DE_PIPEA_ODD_FIELD (1 << 5)
  1874. #define DE_PIPEA_LINE_COMPARE (1 << 4)
  1875. #define DE_PIPEA_VSYNC (1 << 3)
  1876. #define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
  1877. #define DEISR 0x44000
  1878. #define DEIMR 0x44004
  1879. #define DEIIR 0x44008
  1880. #define DEIER 0x4400c
  1881. /* GT interrupt */
  1882. #define GT_SYNC_STATUS (1 << 2)
  1883. #define GT_USER_INTERRUPT (1 << 0)
  1884. #define GTISR 0x44010
  1885. #define GTIMR 0x44014
  1886. #define GTIIR 0x44018
  1887. #define GTIER 0x4401c
  1888. #define DISP_ARB_CTL 0x45000
  1889. #define DISP_TILE_SURFACE_SWIZZLING (1<<13)
  1890. /* PCH */
  1891. /* south display engine interrupt */
  1892. #define SDE_CRT_HOTPLUG (1 << 11)
  1893. #define SDE_PORTD_HOTPLUG (1 << 10)
  1894. #define SDE_PORTC_HOTPLUG (1 << 9)
  1895. #define SDE_PORTB_HOTPLUG (1 << 8)
  1896. #define SDE_SDVOB_HOTPLUG (1 << 6)
  1897. #define SDEISR 0xc4000
  1898. #define SDEIMR 0xc4004
  1899. #define SDEIIR 0xc4008
  1900. #define SDEIER 0xc400c
  1901. /* digital port hotplug */
  1902. #define PCH_PORT_HOTPLUG 0xc4030
  1903. #define PORTD_HOTPLUG_ENABLE (1 << 20)
  1904. #define PORTD_PULSE_DURATION_2ms (0)
  1905. #define PORTD_PULSE_DURATION_4_5ms (1 << 18)
  1906. #define PORTD_PULSE_DURATION_6ms (2 << 18)
  1907. #define PORTD_PULSE_DURATION_100ms (3 << 18)
  1908. #define PORTD_HOTPLUG_NO_DETECT (0)
  1909. #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
  1910. #define PORTD_HOTPLUG_LONG_DETECT (1 << 17)
  1911. #define PORTC_HOTPLUG_ENABLE (1 << 12)
  1912. #define PORTC_PULSE_DURATION_2ms (0)
  1913. #define PORTC_PULSE_DURATION_4_5ms (1 << 10)
  1914. #define PORTC_PULSE_DURATION_6ms (2 << 10)
  1915. #define PORTC_PULSE_DURATION_100ms (3 << 10)
  1916. #define PORTC_HOTPLUG_NO_DETECT (0)
  1917. #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
  1918. #define PORTC_HOTPLUG_LONG_DETECT (1 << 9)
  1919. #define PORTB_HOTPLUG_ENABLE (1 << 4)
  1920. #define PORTB_PULSE_DURATION_2ms (0)
  1921. #define PORTB_PULSE_DURATION_4_5ms (1 << 2)
  1922. #define PORTB_PULSE_DURATION_6ms (2 << 2)
  1923. #define PORTB_PULSE_DURATION_100ms (3 << 2)
  1924. #define PORTB_HOTPLUG_NO_DETECT (0)
  1925. #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
  1926. #define PORTB_HOTPLUG_LONG_DETECT (1 << 1)
  1927. #define PCH_GPIOA 0xc5010
  1928. #define PCH_GPIOB 0xc5014
  1929. #define PCH_GPIOC 0xc5018
  1930. #define PCH_GPIOD 0xc501c
  1931. #define PCH_GPIOE 0xc5020
  1932. #define PCH_GPIOF 0xc5024
  1933. #define PCH_DPLL_A 0xc6014
  1934. #define PCH_DPLL_B 0xc6018
  1935. #define PCH_FPA0 0xc6040
  1936. #define PCH_FPA1 0xc6044
  1937. #define PCH_FPB0 0xc6048
  1938. #define PCH_FPB1 0xc604c
  1939. #define PCH_DPLL_TEST 0xc606c
  1940. #define PCH_DREF_CONTROL 0xC6200
  1941. #define DREF_CONTROL_MASK 0x7fc3
  1942. #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
  1943. #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
  1944. #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13)
  1945. #define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13)
  1946. #define DREF_SSC_SOURCE_DISABLE (0<<11)
  1947. #define DREF_SSC_SOURCE_ENABLE (2<<11)
  1948. #define DREF_SSC_SOURCE_MASK (2<<11)
  1949. #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
  1950. #define DREF_NONSPREAD_CK505_ENABLE (1<<9)
  1951. #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
  1952. #define DREF_NONSPREAD_SOURCE_MASK (2<<9)
  1953. #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
  1954. #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
  1955. #define DREF_SSC4_DOWNSPREAD (0<<6)
  1956. #define DREF_SSC4_CENTERSPREAD (1<<6)
  1957. #define DREF_SSC1_DISABLE (0<<1)
  1958. #define DREF_SSC1_ENABLE (1<<1)
  1959. #define DREF_SSC4_DISABLE (0)
  1960. #define DREF_SSC4_ENABLE (1)
  1961. #define PCH_RAWCLK_FREQ 0xc6204
  1962. #define FDL_TP1_TIMER_SHIFT 12
  1963. #define FDL_TP1_TIMER_MASK (3<<12)
  1964. #define FDL_TP2_TIMER_SHIFT 10
  1965. #define FDL_TP2_TIMER_MASK (3<<10)
  1966. #define RAWCLK_FREQ_MASK 0x3ff
  1967. #define PCH_DPLL_TMR_CFG 0xc6208
  1968. #define PCH_SSC4_PARMS 0xc6210
  1969. #define PCH_SSC4_AUX_PARMS 0xc6214
  1970. /* transcoder */
  1971. #define TRANS_HTOTAL_A 0xe0000
  1972. #define TRANS_HTOTAL_SHIFT 16
  1973. #define TRANS_HACTIVE_SHIFT 0
  1974. #define TRANS_HBLANK_A 0xe0004
  1975. #define TRANS_HBLANK_END_SHIFT 16
  1976. #define TRANS_HBLANK_START_SHIFT 0
  1977. #define TRANS_HSYNC_A 0xe0008
  1978. #define TRANS_HSYNC_END_SHIFT 16
  1979. #define TRANS_HSYNC_START_SHIFT 0
  1980. #define TRANS_VTOTAL_A 0xe000c
  1981. #define TRANS_VTOTAL_SHIFT 16
  1982. #define TRANS_VACTIVE_SHIFT 0
  1983. #define TRANS_VBLANK_A 0xe0010
  1984. #define TRANS_VBLANK_END_SHIFT 16
  1985. #define TRANS_VBLANK_START_SHIFT 0
  1986. #define TRANS_VSYNC_A 0xe0014
  1987. #define TRANS_VSYNC_END_SHIFT 16
  1988. #define TRANS_VSYNC_START_SHIFT 0
  1989. #define TRANSA_DATA_M1 0xe0030
  1990. #define TRANSA_DATA_N1 0xe0034
  1991. #define TRANSA_DATA_M2 0xe0038
  1992. #define TRANSA_DATA_N2 0xe003c
  1993. #define TRANSA_DP_LINK_M1 0xe0040
  1994. #define TRANSA_DP_LINK_N1 0xe0044
  1995. #define TRANSA_DP_LINK_M2 0xe0048
  1996. #define TRANSA_DP_LINK_N2 0xe004c
  1997. #define TRANS_HTOTAL_B 0xe1000
  1998. #define TRANS_HBLANK_B 0xe1004
  1999. #define TRANS_HSYNC_B 0xe1008
  2000. #define TRANS_VTOTAL_B 0xe100c
  2001. #define TRANS_VBLANK_B 0xe1010
  2002. #define TRANS_VSYNC_B 0xe1014
  2003. #define TRANSB_DATA_M1 0xe1030
  2004. #define TRANSB_DATA_N1 0xe1034
  2005. #define TRANSB_DATA_M2 0xe1038
  2006. #define TRANSB_DATA_N2 0xe103c
  2007. #define TRANSB_DP_LINK_M1 0xe1040
  2008. #define TRANSB_DP_LINK_N1 0xe1044
  2009. #define TRANSB_DP_LINK_M2 0xe1048
  2010. #define TRANSB_DP_LINK_N2 0xe104c
  2011. #define TRANSACONF 0xf0008
  2012. #define TRANSBCONF 0xf1008
  2013. #define TRANS_DISABLE (0<<31)
  2014. #define TRANS_ENABLE (1<<31)
  2015. #define TRANS_STATE_MASK (1<<30)
  2016. #define TRANS_STATE_DISABLE (0<<30)
  2017. #define TRANS_STATE_ENABLE (1<<30)
  2018. #define TRANS_FSYNC_DELAY_HB1 (0<<27)
  2019. #define TRANS_FSYNC_DELAY_HB2 (1<<27)
  2020. #define TRANS_FSYNC_DELAY_HB3 (2<<27)
  2021. #define TRANS_FSYNC_DELAY_HB4 (3<<27)
  2022. #define TRANS_DP_AUDIO_ONLY (1<<26)
  2023. #define TRANS_DP_VIDEO_AUDIO (0<<26)
  2024. #define TRANS_PROGRESSIVE (0<<21)
  2025. #define TRANS_8BPC (0<<5)
  2026. #define TRANS_10BPC (1<<5)
  2027. #define TRANS_6BPC (2<<5)
  2028. #define TRANS_12BPC (3<<5)
  2029. #define FDI_RXA_CHICKEN 0xc200c
  2030. #define FDI_RXB_CHICKEN 0xc2010
  2031. #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
  2032. /* CPU: FDI_TX */
  2033. #define FDI_TXA_CTL 0x60100
  2034. #define FDI_TXB_CTL 0x61100
  2035. #define FDI_TX_DISABLE (0<<31)
  2036. #define FDI_TX_ENABLE (1<<31)
  2037. #define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
  2038. #define FDI_LINK_TRAIN_PATTERN_2 (1<<28)
  2039. #define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28)
  2040. #define FDI_LINK_TRAIN_NONE (3<<28)
  2041. #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25)
  2042. #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25)
  2043. #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25)
  2044. #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25)
  2045. #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)
  2046. #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)
  2047. #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22)
  2048. #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22)
  2049. #define FDI_DP_PORT_WIDTH_X1 (0<<19)
  2050. #define FDI_DP_PORT_WIDTH_X2 (1<<19)
  2051. #define FDI_DP_PORT_WIDTH_X3 (2<<19)
  2052. #define FDI_DP_PORT_WIDTH_X4 (3<<19)
  2053. #define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18)
  2054. /* IGDNG: hardwired to 1 */
  2055. #define FDI_TX_PLL_ENABLE (1<<14)
  2056. /* both Tx and Rx */
  2057. #define FDI_SCRAMBLING_ENABLE (0<<7)
  2058. #define FDI_SCRAMBLING_DISABLE (1<<7)
  2059. /* FDI_RX, FDI_X is hard-wired to Transcoder_X */
  2060. #define FDI_RXA_CTL 0xf000c
  2061. #define FDI_RXB_CTL 0xf100c
  2062. #define FDI_RX_ENABLE (1<<31)
  2063. #define FDI_RX_DISABLE (0<<31)
  2064. /* train, dp width same as FDI_TX */
  2065. #define FDI_DP_PORT_WIDTH_X8 (7<<19)
  2066. #define FDI_8BPC (0<<16)
  2067. #define FDI_10BPC (1<<16)
  2068. #define FDI_6BPC (2<<16)
  2069. #define FDI_12BPC (3<<16)
  2070. #define FDI_LINK_REVERSE_OVERWRITE (1<<15)
  2071. #define FDI_DMI_LINK_REVERSE_MASK (1<<14)
  2072. #define FDI_RX_PLL_ENABLE (1<<13)
  2073. #define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
  2074. #define FDI_FE_ERR_CORRECT_ENABLE (1<<10)
  2075. #define FDI_FS_ERR_REPORT_ENABLE (1<<9)
  2076. #define FDI_FE_ERR_REPORT_ENABLE (1<<8)
  2077. #define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6)
  2078. #define FDI_SEL_RAWCLK (0<<4)
  2079. #define FDI_SEL_PCDCLK (1<<4)
  2080. #define FDI_RXA_MISC 0xf0010
  2081. #define FDI_RXB_MISC 0xf1010
  2082. #define FDI_RXA_TUSIZE1 0xf0030
  2083. #define FDI_RXA_TUSIZE2 0xf0038
  2084. #define FDI_RXB_TUSIZE1 0xf1030
  2085. #define FDI_RXB_TUSIZE2 0xf1038
  2086. /* FDI_RX interrupt register format */
  2087. #define FDI_RX_INTER_LANE_ALIGN (1<<10)
  2088. #define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */
  2089. #define FDI_RX_BIT_LOCK (1<<8) /* train 1 */
  2090. #define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7)
  2091. #define FDI_RX_FS_CODE_ERR (1<<6)
  2092. #define FDI_RX_FE_CODE_ERR (1<<5)
  2093. #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4)
  2094. #define FDI_RX_HDCP_LINK_FAIL (1<<3)
  2095. #define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2)
  2096. #define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
  2097. #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
  2098. #define FDI_RXA_IIR 0xf0014
  2099. #define FDI_RXA_IMR 0xf0018
  2100. #define FDI_RXB_IIR 0xf1014
  2101. #define FDI_RXB_IMR 0xf1018
  2102. #define FDI_PLL_CTL_1 0xfe000
  2103. #define FDI_PLL_CTL_2 0xfe004
  2104. /* CRT */
  2105. #define PCH_ADPA 0xe1100
  2106. #define ADPA_TRANS_SELECT_MASK (1<<30)
  2107. #define ADPA_TRANS_A_SELECT 0
  2108. #define ADPA_TRANS_B_SELECT (1<<30)
  2109. #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
  2110. #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24)
  2111. #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24)
  2112. #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24)
  2113. #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24)
  2114. #define ADPA_CRT_HOTPLUG_ENABLE (1<<23)
  2115. #define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22)
  2116. #define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22)
  2117. #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21)
  2118. #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21)
  2119. #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20)
  2120. #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20)
  2121. #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18)
  2122. #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18)
  2123. #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18)
  2124. #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18)
  2125. #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17)
  2126. #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17)
  2127. #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
  2128. /* or SDVOB */
  2129. #define HDMIB 0xe1140
  2130. #define PORT_ENABLE (1 << 31)
  2131. #define TRANSCODER_A (0)
  2132. #define TRANSCODER_B (1 << 30)
  2133. #define COLOR_FORMAT_8bpc (0)
  2134. #define COLOR_FORMAT_12bpc (3 << 26)
  2135. #define SDVOB_HOTPLUG_ENABLE (1 << 23)
  2136. #define SDVO_ENCODING (0)
  2137. #define TMDS_ENCODING (2 << 10)
  2138. #define NULL_PACKET_VSYNC_ENABLE (1 << 9)
  2139. #define SDVOB_BORDER_ENABLE (1 << 7)
  2140. #define AUDIO_ENABLE (1 << 6)
  2141. #define VSYNC_ACTIVE_HIGH (1 << 4)
  2142. #define HSYNC_ACTIVE_HIGH (1 << 3)
  2143. #define PORT_DETECTED (1 << 2)
  2144. #define HDMIC 0xe1150
  2145. #define HDMID 0xe1160
  2146. #define PCH_LVDS 0xe1180
  2147. #define LVDS_DETECTED (1 << 1)
  2148. #define BLC_PWM_CPU_CTL2 0x48250
  2149. #define PWM_ENABLE (1 << 31)
  2150. #define PWM_PIPE_A (0 << 29)
  2151. #define PWM_PIPE_B (1 << 29)
  2152. #define BLC_PWM_CPU_CTL 0x48254
  2153. #define BLC_PWM_PCH_CTL1 0xc8250
  2154. #define PWM_PCH_ENABLE (1 << 31)
  2155. #define PWM_POLARITY_ACTIVE_LOW (1 << 29)
  2156. #define PWM_POLARITY_ACTIVE_HIGH (0 << 29)
  2157. #define PWM_POLARITY_ACTIVE_LOW2 (1 << 28)
  2158. #define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
  2159. #define BLC_PWM_PCH_CTL2 0xc8254
  2160. #define PCH_PP_STATUS 0xc7200
  2161. #define PCH_PP_CONTROL 0xc7204
  2162. #define EDP_FORCE_VDD (1 << 3)
  2163. #define EDP_BLC_ENABLE (1 << 2)
  2164. #define PANEL_POWER_RESET (1 << 1)
  2165. #define PANEL_POWER_OFF (0 << 0)
  2166. #define PANEL_POWER_ON (1 << 0)
  2167. #define PCH_PP_ON_DELAYS 0xc7208
  2168. #define EDP_PANEL (1 << 30)
  2169. #define PCH_PP_OFF_DELAYS 0xc720c
  2170. #define PCH_PP_DIVISOR 0xc7210
  2171. #define PCH_DP_B 0xe4100
  2172. #define PCH_DPB_AUX_CH_CTL 0xe4110
  2173. #define PCH_DPB_AUX_CH_DATA1 0xe4114
  2174. #define PCH_DPB_AUX_CH_DATA2 0xe4118
  2175. #define PCH_DPB_AUX_CH_DATA3 0xe411c
  2176. #define PCH_DPB_AUX_CH_DATA4 0xe4120
  2177. #define PCH_DPB_AUX_CH_DATA5 0xe4124
  2178. #define PCH_DP_C 0xe4200
  2179. #define PCH_DPC_AUX_CH_CTL 0xe4210
  2180. #define PCH_DPC_AUX_CH_DATA1 0xe4214
  2181. #define PCH_DPC_AUX_CH_DATA2 0xe4218
  2182. #define PCH_DPC_AUX_CH_DATA3 0xe421c
  2183. #define PCH_DPC_AUX_CH_DATA4 0xe4220
  2184. #define PCH_DPC_AUX_CH_DATA5 0xe4224
  2185. #define PCH_DP_D 0xe4300
  2186. #define PCH_DPD_AUX_CH_CTL 0xe4310
  2187. #define PCH_DPD_AUX_CH_DATA1 0xe4314
  2188. #define PCH_DPD_AUX_CH_DATA2 0xe4318
  2189. #define PCH_DPD_AUX_CH_DATA3 0xe431c
  2190. #define PCH_DPD_AUX_CH_DATA4 0xe4320
  2191. #define PCH_DPD_AUX_CH_DATA5 0xe4324
  2192. #endif /* _I915_REG_H_ */