ctxgf100.c 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  1. /*
  2. * Copyright 2010 Red Hat Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: Ben Skeggs
  23. */
  24. #include "ctxgf100.h"
  25. #include <subdev/bar.h>
  26. #include <subdev/fb.h>
  27. #include <subdev/mc.h>
  28. #include <subdev/timer.h>
  29. /*******************************************************************************
  30. * PGRAPH context register lists
  31. ******************************************************************************/
  32. static const struct gf100_gr_init
  33. gf100_grctx_init_icmd_0[] = {
  34. { 0x001000, 1, 0x01, 0x00000004 },
  35. { 0x0000a9, 1, 0x01, 0x0000ffff },
  36. { 0x000038, 1, 0x01, 0x0fac6881 },
  37. { 0x00003d, 1, 0x01, 0x00000001 },
  38. { 0x0000e8, 8, 0x01, 0x00000400 },
  39. { 0x000078, 8, 0x01, 0x00000300 },
  40. { 0x000050, 1, 0x01, 0x00000011 },
  41. { 0x000058, 8, 0x01, 0x00000008 },
  42. { 0x000208, 8, 0x01, 0x00000001 },
  43. { 0x000081, 1, 0x01, 0x00000001 },
  44. { 0x000085, 1, 0x01, 0x00000004 },
  45. { 0x000088, 1, 0x01, 0x00000400 },
  46. { 0x000090, 1, 0x01, 0x00000300 },
  47. { 0x000098, 1, 0x01, 0x00001001 },
  48. { 0x0000e3, 1, 0x01, 0x00000001 },
  49. { 0x0000da, 1, 0x01, 0x00000001 },
  50. { 0x0000f8, 1, 0x01, 0x00000003 },
  51. { 0x0000fa, 1, 0x01, 0x00000001 },
  52. { 0x00009f, 4, 0x01, 0x0000ffff },
  53. { 0x0000b1, 1, 0x01, 0x00000001 },
  54. { 0x0000b2, 40, 0x01, 0x00000000 },
  55. { 0x000210, 8, 0x01, 0x00000040 },
  56. { 0x000218, 8, 0x01, 0x0000c080 },
  57. { 0x0000ad, 1, 0x01, 0x0000013e },
  58. { 0x0000e1, 1, 0x01, 0x00000010 },
  59. { 0x000290, 16, 0x01, 0x00000000 },
  60. { 0x0003b0, 16, 0x01, 0x00000000 },
  61. { 0x0002a0, 16, 0x01, 0x00000000 },
  62. { 0x000420, 16, 0x01, 0x00000000 },
  63. { 0x0002b0, 16, 0x01, 0x00000000 },
  64. { 0x000430, 16, 0x01, 0x00000000 },
  65. { 0x0002c0, 16, 0x01, 0x00000000 },
  66. { 0x0004d0, 16, 0x01, 0x00000000 },
  67. { 0x000720, 16, 0x01, 0x00000000 },
  68. { 0x0008c0, 16, 0x01, 0x00000000 },
  69. { 0x000890, 16, 0x01, 0x00000000 },
  70. { 0x0008e0, 16, 0x01, 0x00000000 },
  71. { 0x0008a0, 16, 0x01, 0x00000000 },
  72. { 0x0008f0, 16, 0x01, 0x00000000 },
  73. { 0x00094c, 1, 0x01, 0x000000ff },
  74. { 0x00094d, 1, 0x01, 0xffffffff },
  75. { 0x00094e, 1, 0x01, 0x00000002 },
  76. { 0x0002ec, 1, 0x01, 0x00000001 },
  77. { 0x000303, 1, 0x01, 0x00000001 },
  78. { 0x0002e6, 1, 0x01, 0x00000001 },
  79. { 0x000466, 1, 0x01, 0x00000052 },
  80. { 0x000301, 1, 0x01, 0x3f800000 },
  81. { 0x000304, 1, 0x01, 0x30201000 },
  82. { 0x000305, 1, 0x01, 0x70605040 },
  83. { 0x000306, 1, 0x01, 0xb8a89888 },
  84. { 0x000307, 1, 0x01, 0xf8e8d8c8 },
  85. { 0x00030a, 1, 0x01, 0x00ffff00 },
  86. { 0x00030b, 1, 0x01, 0x0000001a },
  87. { 0x00030c, 1, 0x01, 0x00000001 },
  88. { 0x000318, 1, 0x01, 0x00000001 },
  89. { 0x000340, 1, 0x01, 0x00000000 },
  90. { 0x000375, 1, 0x01, 0x00000001 },
  91. { 0x000351, 1, 0x01, 0x00000100 },
  92. { 0x00037d, 1, 0x01, 0x00000006 },
  93. { 0x0003a0, 1, 0x01, 0x00000002 },
  94. { 0x0003aa, 1, 0x01, 0x00000001 },
  95. { 0x0003a9, 1, 0x01, 0x00000001 },
  96. { 0x000380, 1, 0x01, 0x00000001 },
  97. { 0x000360, 1, 0x01, 0x00000040 },
  98. { 0x000366, 2, 0x01, 0x00000000 },
  99. { 0x000368, 1, 0x01, 0x00001fff },
  100. { 0x000370, 2, 0x01, 0x00000000 },
  101. { 0x000372, 1, 0x01, 0x003fffff },
  102. { 0x00037a, 1, 0x01, 0x00000012 },
  103. { 0x0005e0, 5, 0x01, 0x00000022 },
  104. { 0x000619, 1, 0x01, 0x00000003 },
  105. { 0x000811, 1, 0x01, 0x00000003 },
  106. { 0x000812, 1, 0x01, 0x00000004 },
  107. { 0x000813, 1, 0x01, 0x00000006 },
  108. { 0x000814, 1, 0x01, 0x00000008 },
  109. { 0x000815, 1, 0x01, 0x0000000b },
  110. { 0x000800, 6, 0x01, 0x00000001 },
  111. { 0x000632, 1, 0x01, 0x00000001 },
  112. { 0x000633, 1, 0x01, 0x00000002 },
  113. { 0x000634, 1, 0x01, 0x00000003 },
  114. { 0x000635, 1, 0x01, 0x00000004 },
  115. { 0x000654, 1, 0x01, 0x3f800000 },
  116. { 0x000657, 1, 0x01, 0x3f800000 },
  117. { 0x000655, 2, 0x01, 0x3f800000 },
  118. { 0x0006cd, 1, 0x01, 0x3f800000 },
  119. { 0x0007f5, 1, 0x01, 0x3f800000 },
  120. { 0x0007dc, 1, 0x01, 0x39291909 },
  121. { 0x0007dd, 1, 0x01, 0x79695949 },
  122. { 0x0007de, 1, 0x01, 0xb9a99989 },
  123. { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
  124. { 0x0007e8, 1, 0x01, 0x00003210 },
  125. { 0x0007e9, 1, 0x01, 0x00007654 },
  126. { 0x0007ea, 1, 0x01, 0x00000098 },
  127. { 0x0007ec, 1, 0x01, 0x39291909 },
  128. { 0x0007ed, 1, 0x01, 0x79695949 },
  129. { 0x0007ee, 1, 0x01, 0xb9a99989 },
  130. { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
  131. { 0x0007f0, 1, 0x01, 0x00003210 },
  132. { 0x0007f1, 1, 0x01, 0x00007654 },
  133. { 0x0007f2, 1, 0x01, 0x00000098 },
  134. { 0x0005a5, 1, 0x01, 0x00000001 },
  135. { 0x000980, 128, 0x01, 0x00000000 },
  136. { 0x000468, 1, 0x01, 0x00000004 },
  137. { 0x00046c, 1, 0x01, 0x00000001 },
  138. { 0x000470, 96, 0x01, 0x00000000 },
  139. { 0x000510, 16, 0x01, 0x3f800000 },
  140. { 0x000520, 1, 0x01, 0x000002b6 },
  141. { 0x000529, 1, 0x01, 0x00000001 },
  142. { 0x000530, 16, 0x01, 0xffff0000 },
  143. { 0x000585, 1, 0x01, 0x0000003f },
  144. { 0x000576, 1, 0x01, 0x00000003 },
  145. { 0x000586, 1, 0x01, 0x00000040 },
  146. { 0x000582, 2, 0x01, 0x00000080 },
  147. { 0x0005c2, 1, 0x01, 0x00000001 },
  148. { 0x000638, 2, 0x01, 0x00000001 },
  149. { 0x00063a, 1, 0x01, 0x00000002 },
  150. { 0x00063b, 2, 0x01, 0x00000001 },
  151. { 0x00063d, 1, 0x01, 0x00000002 },
  152. { 0x00063e, 1, 0x01, 0x00000001 },
  153. { 0x0008b8, 8, 0x01, 0x00000001 },
  154. { 0x000900, 8, 0x01, 0x00000001 },
  155. { 0x000908, 8, 0x01, 0x00000002 },
  156. { 0x000910, 16, 0x01, 0x00000001 },
  157. { 0x000920, 8, 0x01, 0x00000002 },
  158. { 0x000928, 8, 0x01, 0x00000001 },
  159. { 0x000648, 9, 0x01, 0x00000001 },
  160. { 0x000658, 1, 0x01, 0x0000000f },
  161. { 0x0007ff, 1, 0x01, 0x0000000a },
  162. { 0x00066a, 1, 0x01, 0x40000000 },
  163. { 0x00066b, 1, 0x01, 0x10000000 },
  164. { 0x00066c, 2, 0x01, 0xffff0000 },
  165. { 0x0007af, 2, 0x01, 0x00000008 },
  166. { 0x0007f6, 1, 0x01, 0x00000001 },
  167. { 0x0006b2, 1, 0x01, 0x00000055 },
  168. { 0x0007ad, 1, 0x01, 0x00000003 },
  169. { 0x000937, 1, 0x01, 0x00000001 },
  170. { 0x000971, 1, 0x01, 0x00000008 },
  171. { 0x000972, 1, 0x01, 0x00000040 },
  172. { 0x000973, 1, 0x01, 0x0000012c },
  173. { 0x00097c, 1, 0x01, 0x00000040 },
  174. { 0x000979, 1, 0x01, 0x00000003 },
  175. { 0x000975, 1, 0x01, 0x00000020 },
  176. { 0x000976, 1, 0x01, 0x00000001 },
  177. { 0x000977, 1, 0x01, 0x00000020 },
  178. { 0x000978, 1, 0x01, 0x00000001 },
  179. { 0x000957, 1, 0x01, 0x00000003 },
  180. { 0x00095e, 1, 0x01, 0x20164010 },
  181. { 0x00095f, 1, 0x01, 0x00000020 },
  182. { 0x000683, 1, 0x01, 0x00000006 },
  183. { 0x000685, 1, 0x01, 0x003fffff },
  184. { 0x000687, 1, 0x01, 0x00000c48 },
  185. { 0x0006a0, 1, 0x01, 0x00000005 },
  186. { 0x000840, 1, 0x01, 0x00300008 },
  187. { 0x000841, 1, 0x01, 0x04000080 },
  188. { 0x000842, 1, 0x01, 0x00300008 },
  189. { 0x000843, 1, 0x01, 0x04000080 },
  190. { 0x000818, 8, 0x01, 0x00000000 },
  191. { 0x000848, 16, 0x01, 0x00000000 },
  192. { 0x000738, 1, 0x01, 0x00000000 },
  193. { 0x0006aa, 1, 0x01, 0x00000001 },
  194. { 0x0006ab, 1, 0x01, 0x00000002 },
  195. { 0x0006ac, 1, 0x01, 0x00000080 },
  196. { 0x0006ad, 2, 0x01, 0x00000100 },
  197. { 0x0006b1, 1, 0x01, 0x00000011 },
  198. { 0x0006bb, 1, 0x01, 0x000000cf },
  199. { 0x0006ce, 1, 0x01, 0x2a712488 },
  200. { 0x000739, 1, 0x01, 0x4085c000 },
  201. { 0x00073a, 1, 0x01, 0x00000080 },
  202. { 0x000786, 1, 0x01, 0x80000100 },
  203. { 0x00073c, 1, 0x01, 0x00010100 },
  204. { 0x00073d, 1, 0x01, 0x02800000 },
  205. { 0x000787, 1, 0x01, 0x000000cf },
  206. { 0x00078c, 1, 0x01, 0x00000008 },
  207. { 0x000792, 1, 0x01, 0x00000001 },
  208. { 0x000794, 3, 0x01, 0x00000001 },
  209. { 0x000797, 1, 0x01, 0x000000cf },
  210. { 0x000836, 1, 0x01, 0x00000001 },
  211. { 0x00079a, 1, 0x01, 0x00000002 },
  212. { 0x000833, 1, 0x01, 0x04444480 },
  213. { 0x0007a1, 1, 0x01, 0x00000001 },
  214. { 0x0007a3, 3, 0x01, 0x00000001 },
  215. { 0x000831, 1, 0x01, 0x00000004 },
  216. { 0x00080c, 1, 0x01, 0x00000002 },
  217. { 0x00080d, 2, 0x01, 0x00000100 },
  218. { 0x00080f, 1, 0x01, 0x00000001 },
  219. { 0x000823, 1, 0x01, 0x00000002 },
  220. { 0x000824, 2, 0x01, 0x00000100 },
  221. { 0x000826, 1, 0x01, 0x00000001 },
  222. { 0x00095d, 1, 0x01, 0x00000001 },
  223. { 0x00082b, 1, 0x01, 0x00000004 },
  224. { 0x000942, 1, 0x01, 0x00010001 },
  225. { 0x000943, 1, 0x01, 0x00000001 },
  226. { 0x000944, 1, 0x01, 0x00000022 },
  227. { 0x0007c5, 1, 0x01, 0x00010001 },
  228. { 0x000834, 1, 0x01, 0x00000001 },
  229. { 0x0007c7, 1, 0x01, 0x00000001 },
  230. { 0x00c1b0, 8, 0x01, 0x0000000f },
  231. { 0x00c1b8, 1, 0x01, 0x0fac6881 },
  232. { 0x00c1b9, 1, 0x01, 0x00fac688 },
  233. { 0x01e100, 1, 0x01, 0x00000001 },
  234. { 0x001000, 1, 0x01, 0x00000002 },
  235. { 0x0006aa, 1, 0x01, 0x00000001 },
  236. { 0x0006ad, 2, 0x01, 0x00000100 },
  237. { 0x0006b1, 1, 0x01, 0x00000011 },
  238. { 0x00078c, 1, 0x01, 0x00000008 },
  239. { 0x000792, 1, 0x01, 0x00000001 },
  240. { 0x000794, 3, 0x01, 0x00000001 },
  241. { 0x000797, 1, 0x01, 0x000000cf },
  242. { 0x00079a, 1, 0x01, 0x00000002 },
  243. { 0x000833, 1, 0x01, 0x04444480 },
  244. { 0x0007a1, 1, 0x01, 0x00000001 },
  245. { 0x0007a3, 3, 0x01, 0x00000001 },
  246. { 0x000831, 1, 0x01, 0x00000004 },
  247. { 0x01e100, 1, 0x01, 0x00000001 },
  248. { 0x001000, 1, 0x01, 0x00000014 },
  249. { 0x000351, 1, 0x01, 0x00000100 },
  250. { 0x000957, 1, 0x01, 0x00000003 },
  251. { 0x00095d, 1, 0x01, 0x00000001 },
  252. { 0x00082b, 1, 0x01, 0x00000004 },
  253. { 0x000942, 1, 0x01, 0x00010001 },
  254. { 0x000943, 1, 0x01, 0x00000001 },
  255. { 0x0007c5, 1, 0x01, 0x00010001 },
  256. { 0x000834, 1, 0x01, 0x00000001 },
  257. { 0x0007c7, 1, 0x01, 0x00000001 },
  258. { 0x01e100, 1, 0x01, 0x00000001 },
  259. { 0x001000, 1, 0x01, 0x00000001 },
  260. { 0x00080c, 1, 0x01, 0x00000002 },
  261. { 0x00080d, 2, 0x01, 0x00000100 },
  262. { 0x00080f, 1, 0x01, 0x00000001 },
  263. { 0x000823, 1, 0x01, 0x00000002 },
  264. { 0x000824, 2, 0x01, 0x00000100 },
  265. { 0x000826, 1, 0x01, 0x00000001 },
  266. { 0x01e100, 1, 0x01, 0x00000001 },
  267. {}
  268. };
  269. const struct gf100_gr_pack
  270. gf100_grctx_pack_icmd[] = {
  271. { gf100_grctx_init_icmd_0 },
  272. {}
  273. };
  274. static const struct gf100_gr_init
  275. gf100_grctx_init_9097_0[] = {
  276. { 0x000800, 8, 0x40, 0x00000000 },
  277. { 0x000804, 8, 0x40, 0x00000000 },
  278. { 0x000808, 8, 0x40, 0x00000400 },
  279. { 0x00080c, 8, 0x40, 0x00000300 },
  280. { 0x000810, 1, 0x04, 0x000000cf },
  281. { 0x000850, 7, 0x40, 0x00000000 },
  282. { 0x000814, 8, 0x40, 0x00000040 },
  283. { 0x000818, 8, 0x40, 0x00000001 },
  284. { 0x00081c, 8, 0x40, 0x00000000 },
  285. { 0x000820, 8, 0x40, 0x00000000 },
  286. { 0x002700, 8, 0x20, 0x00000000 },
  287. { 0x002704, 8, 0x20, 0x00000000 },
  288. { 0x002708, 8, 0x20, 0x00000000 },
  289. { 0x00270c, 8, 0x20, 0x00000000 },
  290. { 0x002710, 8, 0x20, 0x00014000 },
  291. { 0x002714, 8, 0x20, 0x00000040 },
  292. { 0x001c00, 16, 0x10, 0x00000000 },
  293. { 0x001c04, 16, 0x10, 0x00000000 },
  294. { 0x001c08, 16, 0x10, 0x00000000 },
  295. { 0x001c0c, 16, 0x10, 0x00000000 },
  296. { 0x001d00, 16, 0x10, 0x00000000 },
  297. { 0x001d04, 16, 0x10, 0x00000000 },
  298. { 0x001d08, 16, 0x10, 0x00000000 },
  299. { 0x001d0c, 16, 0x10, 0x00000000 },
  300. { 0x001f00, 16, 0x08, 0x00000000 },
  301. { 0x001f04, 16, 0x08, 0x00000000 },
  302. { 0x001f80, 16, 0x08, 0x00000000 },
  303. { 0x001f84, 16, 0x08, 0x00000000 },
  304. { 0x002200, 5, 0x10, 0x00000022 },
  305. { 0x002000, 1, 0x04, 0x00000000 },
  306. { 0x002040, 1, 0x04, 0x00000011 },
  307. { 0x002080, 1, 0x04, 0x00000020 },
  308. { 0x0020c0, 1, 0x04, 0x00000030 },
  309. { 0x002100, 1, 0x04, 0x00000040 },
  310. { 0x002140, 1, 0x04, 0x00000051 },
  311. { 0x00200c, 6, 0x40, 0x00000001 },
  312. { 0x002010, 1, 0x04, 0x00000000 },
  313. { 0x002050, 1, 0x04, 0x00000000 },
  314. { 0x002090, 1, 0x04, 0x00000001 },
  315. { 0x0020d0, 1, 0x04, 0x00000002 },
  316. { 0x002110, 1, 0x04, 0x00000003 },
  317. { 0x002150, 1, 0x04, 0x00000004 },
  318. { 0x000380, 4, 0x20, 0x00000000 },
  319. { 0x000384, 4, 0x20, 0x00000000 },
  320. { 0x000388, 4, 0x20, 0x00000000 },
  321. { 0x00038c, 4, 0x20, 0x00000000 },
  322. { 0x000700, 4, 0x10, 0x00000000 },
  323. { 0x000704, 4, 0x10, 0x00000000 },
  324. { 0x000708, 4, 0x10, 0x00000000 },
  325. { 0x002800, 128, 0x04, 0x00000000 },
  326. { 0x000a00, 16, 0x20, 0x00000000 },
  327. { 0x000a04, 16, 0x20, 0x00000000 },
  328. { 0x000a08, 16, 0x20, 0x00000000 },
  329. { 0x000a0c, 16, 0x20, 0x00000000 },
  330. { 0x000a10, 16, 0x20, 0x00000000 },
  331. { 0x000a14, 16, 0x20, 0x00000000 },
  332. { 0x000c00, 16, 0x10, 0x00000000 },
  333. { 0x000c04, 16, 0x10, 0x00000000 },
  334. { 0x000c08, 16, 0x10, 0x00000000 },
  335. { 0x000c0c, 16, 0x10, 0x3f800000 },
  336. { 0x000d00, 8, 0x08, 0xffff0000 },
  337. { 0x000d04, 8, 0x08, 0xffff0000 },
  338. { 0x000e00, 16, 0x10, 0x00000000 },
  339. { 0x000e04, 16, 0x10, 0xffff0000 },
  340. { 0x000e08, 16, 0x10, 0xffff0000 },
  341. { 0x000d40, 4, 0x08, 0x00000000 },
  342. { 0x000d44, 4, 0x08, 0x00000000 },
  343. { 0x001e00, 8, 0x20, 0x00000001 },
  344. { 0x001e04, 8, 0x20, 0x00000001 },
  345. { 0x001e08, 8, 0x20, 0x00000002 },
  346. { 0x001e0c, 8, 0x20, 0x00000001 },
  347. { 0x001e10, 8, 0x20, 0x00000001 },
  348. { 0x001e14, 8, 0x20, 0x00000002 },
  349. { 0x001e18, 8, 0x20, 0x00000001 },
  350. { 0x003400, 128, 0x04, 0x00000000 },
  351. { 0x00030c, 1, 0x04, 0x00000001 },
  352. { 0x001944, 1, 0x04, 0x00000000 },
  353. { 0x001514, 1, 0x04, 0x00000000 },
  354. { 0x000d68, 1, 0x04, 0x0000ffff },
  355. { 0x00121c, 1, 0x04, 0x0fac6881 },
  356. { 0x000fac, 1, 0x04, 0x00000001 },
  357. { 0x001538, 1, 0x04, 0x00000001 },
  358. { 0x000fe0, 2, 0x04, 0x00000000 },
  359. { 0x000fe8, 1, 0x04, 0x00000014 },
  360. { 0x000fec, 1, 0x04, 0x00000040 },
  361. { 0x000ff0, 1, 0x04, 0x00000000 },
  362. { 0x00179c, 1, 0x04, 0x00000000 },
  363. { 0x001228, 1, 0x04, 0x00000400 },
  364. { 0x00122c, 1, 0x04, 0x00000300 },
  365. { 0x001230, 1, 0x04, 0x00010001 },
  366. { 0x0007f8, 1, 0x04, 0x00000000 },
  367. { 0x0015b4, 1, 0x04, 0x00000001 },
  368. { 0x0015cc, 1, 0x04, 0x00000000 },
  369. { 0x001534, 1, 0x04, 0x00000000 },
  370. { 0x000fb0, 1, 0x04, 0x00000000 },
  371. { 0x0015d0, 1, 0x04, 0x00000000 },
  372. { 0x00153c, 1, 0x04, 0x00000000 },
  373. { 0x0016b4, 1, 0x04, 0x00000003 },
  374. { 0x000fbc, 4, 0x04, 0x0000ffff },
  375. { 0x000df8, 2, 0x04, 0x00000000 },
  376. { 0x001948, 1, 0x04, 0x00000000 },
  377. { 0x001970, 1, 0x04, 0x00000001 },
  378. { 0x00161c, 1, 0x04, 0x000009f0 },
  379. { 0x000dcc, 1, 0x04, 0x00000010 },
  380. { 0x00163c, 1, 0x04, 0x00000000 },
  381. { 0x0015e4, 1, 0x04, 0x00000000 },
  382. { 0x001160, 32, 0x04, 0x25e00040 },
  383. { 0x001880, 32, 0x04, 0x00000000 },
  384. { 0x000f84, 2, 0x04, 0x00000000 },
  385. { 0x0017c8, 2, 0x04, 0x00000000 },
  386. { 0x0017d0, 1, 0x04, 0x000000ff },
  387. { 0x0017d4, 1, 0x04, 0xffffffff },
  388. { 0x0017d8, 1, 0x04, 0x00000002 },
  389. { 0x0017dc, 1, 0x04, 0x00000000 },
  390. { 0x0015f4, 2, 0x04, 0x00000000 },
  391. { 0x001434, 2, 0x04, 0x00000000 },
  392. { 0x000d74, 1, 0x04, 0x00000000 },
  393. { 0x000dec, 1, 0x04, 0x00000001 },
  394. { 0x0013a4, 1, 0x04, 0x00000000 },
  395. { 0x001318, 1, 0x04, 0x00000001 },
  396. { 0x001644, 1, 0x04, 0x00000000 },
  397. { 0x000748, 1, 0x04, 0x00000000 },
  398. { 0x000de8, 1, 0x04, 0x00000000 },
  399. { 0x001648, 1, 0x04, 0x00000000 },
  400. { 0x0012a4, 1, 0x04, 0x00000000 },
  401. { 0x001120, 4, 0x04, 0x00000000 },
  402. { 0x001118, 1, 0x04, 0x00000000 },
  403. { 0x00164c, 1, 0x04, 0x00000000 },
  404. { 0x001658, 1, 0x04, 0x00000000 },
  405. { 0x001910, 1, 0x04, 0x00000290 },
  406. { 0x001518, 1, 0x04, 0x00000000 },
  407. { 0x00165c, 1, 0x04, 0x00000001 },
  408. { 0x001520, 1, 0x04, 0x00000000 },
  409. { 0x001604, 1, 0x04, 0x00000000 },
  410. { 0x001570, 1, 0x04, 0x00000000 },
  411. { 0x0013b0, 2, 0x04, 0x3f800000 },
  412. { 0x00020c, 1, 0x04, 0x00000000 },
  413. { 0x001670, 1, 0x04, 0x30201000 },
  414. { 0x001674, 1, 0x04, 0x70605040 },
  415. { 0x001678, 1, 0x04, 0xb8a89888 },
  416. { 0x00167c, 1, 0x04, 0xf8e8d8c8 },
  417. { 0x00166c, 1, 0x04, 0x00000000 },
  418. { 0x001680, 1, 0x04, 0x00ffff00 },
  419. { 0x0012d0, 1, 0x04, 0x00000003 },
  420. { 0x0012d4, 1, 0x04, 0x00000002 },
  421. { 0x001684, 2, 0x04, 0x00000000 },
  422. { 0x000dac, 2, 0x04, 0x00001b02 },
  423. { 0x000db4, 1, 0x04, 0x00000000 },
  424. { 0x00168c, 1, 0x04, 0x00000000 },
  425. { 0x0015bc, 1, 0x04, 0x00000000 },
  426. { 0x00156c, 1, 0x04, 0x00000000 },
  427. { 0x00187c, 1, 0x04, 0x00000000 },
  428. { 0x001110, 1, 0x04, 0x00000001 },
  429. { 0x000dc0, 3, 0x04, 0x00000000 },
  430. { 0x001234, 1, 0x04, 0x00000000 },
  431. { 0x001690, 1, 0x04, 0x00000000 },
  432. { 0x0012ac, 1, 0x04, 0x00000001 },
  433. { 0x0002c4, 1, 0x04, 0x00000000 },
  434. { 0x000790, 5, 0x04, 0x00000000 },
  435. { 0x00077c, 1, 0x04, 0x00000000 },
  436. { 0x001000, 1, 0x04, 0x00000010 },
  437. { 0x0010fc, 1, 0x04, 0x00000000 },
  438. { 0x001290, 1, 0x04, 0x00000000 },
  439. { 0x000218, 1, 0x04, 0x00000010 },
  440. { 0x0012d8, 1, 0x04, 0x00000000 },
  441. { 0x0012dc, 1, 0x04, 0x00000010 },
  442. { 0x000d94, 1, 0x04, 0x00000001 },
  443. { 0x00155c, 2, 0x04, 0x00000000 },
  444. { 0x001564, 1, 0x04, 0x00001fff },
  445. { 0x001574, 2, 0x04, 0x00000000 },
  446. { 0x00157c, 1, 0x04, 0x003fffff },
  447. { 0x001354, 1, 0x04, 0x00000000 },
  448. { 0x001664, 1, 0x04, 0x00000000 },
  449. { 0x001610, 1, 0x04, 0x00000012 },
  450. { 0x001608, 2, 0x04, 0x00000000 },
  451. { 0x00162c, 1, 0x04, 0x00000003 },
  452. { 0x000210, 1, 0x04, 0x00000000 },
  453. { 0x000320, 1, 0x04, 0x00000000 },
  454. { 0x000324, 6, 0x04, 0x3f800000 },
  455. { 0x000750, 1, 0x04, 0x00000000 },
  456. { 0x000760, 1, 0x04, 0x39291909 },
  457. { 0x000764, 1, 0x04, 0x79695949 },
  458. { 0x000768, 1, 0x04, 0xb9a99989 },
  459. { 0x00076c, 1, 0x04, 0xf9e9d9c9 },
  460. { 0x000770, 1, 0x04, 0x30201000 },
  461. { 0x000774, 1, 0x04, 0x70605040 },
  462. { 0x000778, 1, 0x04, 0x00009080 },
  463. { 0x000780, 1, 0x04, 0x39291909 },
  464. { 0x000784, 1, 0x04, 0x79695949 },
  465. { 0x000788, 1, 0x04, 0xb9a99989 },
  466. { 0x00078c, 1, 0x04, 0xf9e9d9c9 },
  467. { 0x0007d0, 1, 0x04, 0x30201000 },
  468. { 0x0007d4, 1, 0x04, 0x70605040 },
  469. { 0x0007d8, 1, 0x04, 0x00009080 },
  470. { 0x00037c, 1, 0x04, 0x00000001 },
  471. { 0x000740, 2, 0x04, 0x00000000 },
  472. { 0x002600, 1, 0x04, 0x00000000 },
  473. { 0x001918, 1, 0x04, 0x00000000 },
  474. { 0x00191c, 1, 0x04, 0x00000900 },
  475. { 0x001920, 1, 0x04, 0x00000405 },
  476. { 0x001308, 1, 0x04, 0x00000001 },
  477. { 0x001924, 1, 0x04, 0x00000000 },
  478. { 0x0013ac, 1, 0x04, 0x00000000 },
  479. { 0x00192c, 1, 0x04, 0x00000001 },
  480. { 0x00193c, 1, 0x04, 0x00002c1c },
  481. { 0x000d7c, 1, 0x04, 0x00000000 },
  482. { 0x000f8c, 1, 0x04, 0x00000000 },
  483. { 0x0002c0, 1, 0x04, 0x00000001 },
  484. { 0x001510, 1, 0x04, 0x00000000 },
  485. { 0x001940, 1, 0x04, 0x00000000 },
  486. { 0x000ff4, 2, 0x04, 0x00000000 },
  487. { 0x00194c, 2, 0x04, 0x00000000 },
  488. { 0x001968, 1, 0x04, 0x00000000 },
  489. { 0x001590, 1, 0x04, 0x0000003f },
  490. { 0x0007e8, 4, 0x04, 0x00000000 },
  491. { 0x00196c, 1, 0x04, 0x00000011 },
  492. { 0x00197c, 1, 0x04, 0x00000000 },
  493. { 0x000fcc, 2, 0x04, 0x00000000 },
  494. { 0x0002d8, 1, 0x04, 0x00000040 },
  495. { 0x001980, 1, 0x04, 0x00000080 },
  496. { 0x001504, 1, 0x04, 0x00000080 },
  497. { 0x001984, 1, 0x04, 0x00000000 },
  498. { 0x000300, 1, 0x04, 0x00000001 },
  499. { 0x0013a8, 1, 0x04, 0x00000000 },
  500. { 0x0012ec, 1, 0x04, 0x00000000 },
  501. { 0x001310, 1, 0x04, 0x00000000 },
  502. { 0x001314, 1, 0x04, 0x00000001 },
  503. { 0x001380, 1, 0x04, 0x00000000 },
  504. { 0x001384, 4, 0x04, 0x00000001 },
  505. { 0x001394, 1, 0x04, 0x00000000 },
  506. { 0x00139c, 1, 0x04, 0x00000000 },
  507. { 0x001398, 1, 0x04, 0x00000000 },
  508. { 0x001594, 1, 0x04, 0x00000000 },
  509. { 0x001598, 4, 0x04, 0x00000001 },
  510. { 0x000f54, 3, 0x04, 0x00000000 },
  511. { 0x0019bc, 1, 0x04, 0x00000000 },
  512. { 0x000f9c, 2, 0x04, 0x00000000 },
  513. { 0x0012cc, 1, 0x04, 0x00000000 },
  514. { 0x0012e8, 1, 0x04, 0x00000000 },
  515. { 0x00130c, 1, 0x04, 0x00000001 },
  516. { 0x001360, 8, 0x04, 0x00000000 },
  517. { 0x00133c, 2, 0x04, 0x00000001 },
  518. { 0x001344, 1, 0x04, 0x00000002 },
  519. { 0x001348, 2, 0x04, 0x00000001 },
  520. { 0x001350, 1, 0x04, 0x00000002 },
  521. { 0x001358, 1, 0x04, 0x00000001 },
  522. { 0x0012e4, 1, 0x04, 0x00000000 },
  523. { 0x00131c, 4, 0x04, 0x00000000 },
  524. { 0x0019c0, 1, 0x04, 0x00000000 },
  525. { 0x001140, 1, 0x04, 0x00000000 },
  526. { 0x0019c4, 1, 0x04, 0x00000000 },
  527. { 0x0019c8, 1, 0x04, 0x00001500 },
  528. { 0x00135c, 1, 0x04, 0x00000000 },
  529. { 0x000f90, 1, 0x04, 0x00000000 },
  530. { 0x0019e0, 8, 0x04, 0x00000001 },
  531. { 0x0019cc, 1, 0x04, 0x00000001 },
  532. { 0x0015b8, 1, 0x04, 0x00000000 },
  533. { 0x001a00, 1, 0x04, 0x00001111 },
  534. { 0x001a04, 7, 0x04, 0x00000000 },
  535. { 0x000d6c, 2, 0x04, 0xffff0000 },
  536. { 0x0010f8, 1, 0x04, 0x00001010 },
  537. { 0x000d80, 5, 0x04, 0x00000000 },
  538. { 0x000da0, 1, 0x04, 0x00000000 },
  539. { 0x001508, 1, 0x04, 0x80000000 },
  540. { 0x00150c, 1, 0x04, 0x40000000 },
  541. { 0x001668, 1, 0x04, 0x00000000 },
  542. { 0x000318, 2, 0x04, 0x00000008 },
  543. { 0x000d9c, 1, 0x04, 0x00000001 },
  544. { 0x0007dc, 1, 0x04, 0x00000000 },
  545. { 0x00074c, 1, 0x04, 0x00000055 },
  546. { 0x001420, 1, 0x04, 0x00000003 },
  547. { 0x0017bc, 2, 0x04, 0x00000000 },
  548. { 0x0017c4, 1, 0x04, 0x00000001 },
  549. { 0x001008, 1, 0x04, 0x00000008 },
  550. { 0x00100c, 1, 0x04, 0x00000040 },
  551. { 0x001010, 1, 0x04, 0x0000012c },
  552. { 0x000d60, 1, 0x04, 0x00000040 },
  553. { 0x00075c, 1, 0x04, 0x00000003 },
  554. { 0x001018, 1, 0x04, 0x00000020 },
  555. { 0x00101c, 1, 0x04, 0x00000001 },
  556. { 0x001020, 1, 0x04, 0x00000020 },
  557. { 0x001024, 1, 0x04, 0x00000001 },
  558. { 0x001444, 3, 0x04, 0x00000000 },
  559. { 0x000360, 1, 0x04, 0x20164010 },
  560. { 0x000364, 1, 0x04, 0x00000020 },
  561. { 0x000368, 1, 0x04, 0x00000000 },
  562. { 0x000de4, 1, 0x04, 0x00000000 },
  563. { 0x000204, 1, 0x04, 0x00000006 },
  564. { 0x000208, 1, 0x04, 0x00000000 },
  565. { 0x0002cc, 1, 0x04, 0x003fffff },
  566. { 0x0002d0, 1, 0x04, 0x00000c48 },
  567. { 0x001220, 1, 0x04, 0x00000005 },
  568. { 0x000fdc, 1, 0x04, 0x00000000 },
  569. { 0x000f98, 1, 0x04, 0x00300008 },
  570. { 0x001284, 1, 0x04, 0x04000080 },
  571. { 0x001450, 1, 0x04, 0x00300008 },
  572. { 0x001454, 1, 0x04, 0x04000080 },
  573. { 0x000214, 1, 0x04, 0x00000000 },
  574. {}
  575. };
  576. const struct gf100_gr_init
  577. gf100_grctx_init_902d_0[] = {
  578. { 0x000200, 1, 0x04, 0x000000cf },
  579. { 0x000204, 1, 0x04, 0x00000001 },
  580. { 0x000208, 1, 0x04, 0x00000020 },
  581. { 0x00020c, 1, 0x04, 0x00000001 },
  582. { 0x000210, 1, 0x04, 0x00000000 },
  583. { 0x000214, 1, 0x04, 0x00000080 },
  584. { 0x000218, 2, 0x04, 0x00000100 },
  585. { 0x000220, 2, 0x04, 0x00000000 },
  586. { 0x000230, 1, 0x04, 0x000000cf },
  587. { 0x000234, 1, 0x04, 0x00000001 },
  588. { 0x000238, 1, 0x04, 0x00000020 },
  589. { 0x00023c, 1, 0x04, 0x00000001 },
  590. { 0x000244, 1, 0x04, 0x00000080 },
  591. { 0x000248, 2, 0x04, 0x00000100 },
  592. {}
  593. };
  594. const struct gf100_gr_init
  595. gf100_grctx_init_9039_0[] = {
  596. { 0x00030c, 3, 0x04, 0x00000000 },
  597. { 0x000320, 1, 0x04, 0x00000000 },
  598. { 0x000238, 2, 0x04, 0x00000000 },
  599. { 0x000318, 2, 0x04, 0x00000000 },
  600. {}
  601. };
  602. const struct gf100_gr_init
  603. gf100_grctx_init_90c0_0[] = {
  604. { 0x00270c, 8, 0x20, 0x00000000 },
  605. { 0x00030c, 1, 0x04, 0x00000001 },
  606. { 0x001944, 1, 0x04, 0x00000000 },
  607. { 0x000758, 1, 0x04, 0x00000100 },
  608. { 0x0002c4, 1, 0x04, 0x00000000 },
  609. { 0x000790, 5, 0x04, 0x00000000 },
  610. { 0x00077c, 1, 0x04, 0x00000000 },
  611. { 0x000204, 3, 0x04, 0x00000000 },
  612. { 0x000214, 1, 0x04, 0x00000000 },
  613. { 0x00024c, 1, 0x04, 0x00000000 },
  614. { 0x000d94, 1, 0x04, 0x00000001 },
  615. { 0x001608, 2, 0x04, 0x00000000 },
  616. { 0x001664, 1, 0x04, 0x00000000 },
  617. {}
  618. };
  619. const struct gf100_gr_pack
  620. gf100_grctx_pack_mthd[] = {
  621. { gf100_grctx_init_9097_0, 0x9097 },
  622. { gf100_grctx_init_902d_0, 0x902d },
  623. { gf100_grctx_init_9039_0, 0x9039 },
  624. { gf100_grctx_init_90c0_0, 0x90c0 },
  625. {}
  626. };
  627. const struct gf100_gr_init
  628. gf100_grctx_init_main_0[] = {
  629. { 0x400204, 2, 0x04, 0x00000000 },
  630. {}
  631. };
  632. const struct gf100_gr_init
  633. gf100_grctx_init_fe_0[] = {
  634. { 0x404004, 11, 0x04, 0x00000000 },
  635. { 0x404044, 1, 0x04, 0x00000000 },
  636. { 0x404094, 13, 0x04, 0x00000000 },
  637. { 0x4040c8, 1, 0x04, 0xf0000087 },
  638. { 0x4040d0, 6, 0x04, 0x00000000 },
  639. { 0x4040e8, 1, 0x04, 0x00001000 },
  640. { 0x4040f8, 1, 0x04, 0x00000000 },
  641. { 0x404130, 2, 0x04, 0x00000000 },
  642. { 0x404138, 1, 0x04, 0x20000040 },
  643. { 0x404150, 1, 0x04, 0x0000002e },
  644. { 0x404154, 1, 0x04, 0x00000400 },
  645. { 0x404158, 1, 0x04, 0x00000200 },
  646. { 0x404164, 1, 0x04, 0x00000055 },
  647. { 0x404168, 1, 0x04, 0x00000000 },
  648. { 0x404174, 3, 0x04, 0x00000000 },
  649. { 0x404200, 8, 0x04, 0x00000000 },
  650. {}
  651. };
  652. const struct gf100_gr_init
  653. gf100_grctx_init_pri_0[] = {
  654. { 0x404404, 14, 0x04, 0x00000000 },
  655. { 0x404460, 2, 0x04, 0x00000000 },
  656. { 0x404468, 1, 0x04, 0x00ffffff },
  657. { 0x40446c, 1, 0x04, 0x00000000 },
  658. { 0x404480, 1, 0x04, 0x00000001 },
  659. { 0x404498, 1, 0x04, 0x00000001 },
  660. {}
  661. };
  662. const struct gf100_gr_init
  663. gf100_grctx_init_memfmt_0[] = {
  664. { 0x404604, 1, 0x04, 0x00000015 },
  665. { 0x404608, 1, 0x04, 0x00000000 },
  666. { 0x40460c, 1, 0x04, 0x00002e00 },
  667. { 0x404610, 1, 0x04, 0x00000100 },
  668. { 0x404618, 8, 0x04, 0x00000000 },
  669. { 0x404638, 1, 0x04, 0x00000004 },
  670. { 0x40463c, 8, 0x04, 0x00000000 },
  671. { 0x40465c, 1, 0x04, 0x007f0100 },
  672. { 0x404660, 7, 0x04, 0x00000000 },
  673. { 0x40467c, 1, 0x04, 0x00000002 },
  674. { 0x404680, 8, 0x04, 0x00000000 },
  675. { 0x4046a0, 1, 0x04, 0x007f0080 },
  676. { 0x4046a4, 18, 0x04, 0x00000000 },
  677. { 0x4046f0, 2, 0x04, 0x00000000 },
  678. { 0x404700, 13, 0x04, 0x00000000 },
  679. { 0x404734, 1, 0x04, 0x00000100 },
  680. { 0x404738, 8, 0x04, 0x00000000 },
  681. {}
  682. };
  683. static const struct gf100_gr_init
  684. gf100_grctx_init_ds_0[] = {
  685. { 0x405800, 1, 0x04, 0x078000bf },
  686. { 0x405830, 1, 0x04, 0x02180000 },
  687. { 0x405834, 2, 0x04, 0x00000000 },
  688. { 0x405854, 1, 0x04, 0x00000000 },
  689. { 0x405870, 4, 0x04, 0x00000001 },
  690. { 0x405a00, 2, 0x04, 0x00000000 },
  691. { 0x405a18, 1, 0x04, 0x00000000 },
  692. {}
  693. };
  694. static const struct gf100_gr_init
  695. gf100_grctx_init_pd_0[] = {
  696. { 0x406020, 1, 0x04, 0x000103c1 },
  697. { 0x406028, 4, 0x04, 0x00000001 },
  698. { 0x4064a8, 1, 0x04, 0x00000000 },
  699. { 0x4064ac, 1, 0x04, 0x00003fff },
  700. { 0x4064b4, 2, 0x04, 0x00000000 },
  701. {}
  702. };
  703. const struct gf100_gr_init
  704. gf100_grctx_init_rstr2d_0[] = {
  705. { 0x407804, 1, 0x04, 0x00000023 },
  706. { 0x40780c, 1, 0x04, 0x0a418820 },
  707. { 0x407810, 1, 0x04, 0x062080e6 },
  708. { 0x407814, 1, 0x04, 0x020398a4 },
  709. { 0x407818, 1, 0x04, 0x0e629062 },
  710. { 0x40781c, 1, 0x04, 0x0a418820 },
  711. { 0x407820, 1, 0x04, 0x000000e6 },
  712. { 0x4078bc, 1, 0x04, 0x00000103 },
  713. {}
  714. };
  715. const struct gf100_gr_init
  716. gf100_grctx_init_scc_0[] = {
  717. { 0x408000, 2, 0x04, 0x00000000 },
  718. { 0x408008, 1, 0x04, 0x00000018 },
  719. { 0x40800c, 2, 0x04, 0x00000000 },
  720. { 0x408014, 1, 0x04, 0x00000069 },
  721. { 0x408018, 1, 0x04, 0xe100e100 },
  722. { 0x408064, 1, 0x04, 0x00000000 },
  723. {}
  724. };
  725. static const struct gf100_gr_init
  726. gf100_grctx_init_be_0[] = {
  727. { 0x408800, 1, 0x04, 0x02802a3c },
  728. { 0x408804, 1, 0x04, 0x00000040 },
  729. { 0x408808, 1, 0x04, 0x0003e00d },
  730. { 0x408900, 1, 0x04, 0x3080b801 },
  731. { 0x408904, 1, 0x04, 0x02000001 },
  732. { 0x408908, 1, 0x04, 0x00c80929 },
  733. { 0x408980, 1, 0x04, 0x0000011d },
  734. {}
  735. };
  736. const struct gf100_gr_pack
  737. gf100_grctx_pack_hub[] = {
  738. { gf100_grctx_init_main_0 },
  739. { gf100_grctx_init_fe_0 },
  740. { gf100_grctx_init_pri_0 },
  741. { gf100_grctx_init_memfmt_0 },
  742. { gf100_grctx_init_ds_0 },
  743. { gf100_grctx_init_pd_0 },
  744. { gf100_grctx_init_rstr2d_0 },
  745. { gf100_grctx_init_scc_0 },
  746. { gf100_grctx_init_be_0 },
  747. {}
  748. };
  749. const struct gf100_gr_init
  750. gf100_grctx_init_gpc_unk_0[] = {
  751. { 0x418380, 1, 0x04, 0x00000016 },
  752. {}
  753. };
  754. const struct gf100_gr_init
  755. gf100_grctx_init_prop_0[] = {
  756. { 0x418400, 1, 0x04, 0x38004e00 },
  757. { 0x418404, 1, 0x04, 0x71e0ffff },
  758. { 0x418408, 1, 0x04, 0x00000000 },
  759. { 0x41840c, 1, 0x04, 0x00001008 },
  760. { 0x418410, 1, 0x04, 0x0fff0fff },
  761. { 0x418414, 1, 0x04, 0x00200fff },
  762. { 0x418450, 6, 0x04, 0x00000000 },
  763. { 0x418468, 1, 0x04, 0x00000001 },
  764. { 0x41846c, 2, 0x04, 0x00000000 },
  765. {}
  766. };
  767. const struct gf100_gr_init
  768. gf100_grctx_init_gpc_unk_1[] = {
  769. { 0x418600, 1, 0x04, 0x0000001f },
  770. { 0x418684, 1, 0x04, 0x0000000f },
  771. { 0x418700, 1, 0x04, 0x00000002 },
  772. { 0x418704, 1, 0x04, 0x00000080 },
  773. { 0x418708, 1, 0x04, 0x00000000 },
  774. { 0x41870c, 1, 0x04, 0x07c80000 },
  775. { 0x418710, 1, 0x04, 0x00000000 },
  776. {}
  777. };
  778. static const struct gf100_gr_init
  779. gf100_grctx_init_setup_0[] = {
  780. { 0x418800, 1, 0x04, 0x0006860a },
  781. { 0x418808, 3, 0x04, 0x00000000 },
  782. { 0x418828, 1, 0x04, 0x00008442 },
  783. { 0x418830, 1, 0x04, 0x00000001 },
  784. { 0x4188d8, 1, 0x04, 0x00000008 },
  785. { 0x4188e0, 1, 0x04, 0x01000000 },
  786. { 0x4188e8, 5, 0x04, 0x00000000 },
  787. { 0x4188fc, 1, 0x04, 0x00100000 },
  788. {}
  789. };
  790. const struct gf100_gr_init
  791. gf100_grctx_init_zcull_0[] = {
  792. { 0x41891c, 1, 0x04, 0x00ff00ff },
  793. { 0x418924, 1, 0x04, 0x00000000 },
  794. { 0x418928, 1, 0x04, 0x00ffff00 },
  795. { 0x41892c, 1, 0x04, 0x0000ff00 },
  796. {}
  797. };
  798. const struct gf100_gr_init
  799. gf100_grctx_init_crstr_0[] = {
  800. { 0x418b00, 1, 0x04, 0x00000000 },
  801. { 0x418b08, 1, 0x04, 0x0a418820 },
  802. { 0x418b0c, 1, 0x04, 0x062080e6 },
  803. { 0x418b10, 1, 0x04, 0x020398a4 },
  804. { 0x418b14, 1, 0x04, 0x0e629062 },
  805. { 0x418b18, 1, 0x04, 0x0a418820 },
  806. { 0x418b1c, 1, 0x04, 0x000000e6 },
  807. { 0x418bb8, 1, 0x04, 0x00000103 },
  808. {}
  809. };
  810. const struct gf100_gr_init
  811. gf100_grctx_init_gpm_0[] = {
  812. { 0x418c08, 1, 0x04, 0x00000001 },
  813. { 0x418c10, 8, 0x04, 0x00000000 },
  814. { 0x418c80, 1, 0x04, 0x20200004 },
  815. { 0x418c8c, 1, 0x04, 0x00000001 },
  816. {}
  817. };
  818. const struct gf100_gr_init
  819. gf100_grctx_init_gcc_0[] = {
  820. { 0x419000, 1, 0x04, 0x00000780 },
  821. { 0x419004, 2, 0x04, 0x00000000 },
  822. { 0x419014, 1, 0x04, 0x00000004 },
  823. {}
  824. };
  825. const struct gf100_gr_pack
  826. gf100_grctx_pack_gpc[] = {
  827. { gf100_grctx_init_gpc_unk_0 },
  828. { gf100_grctx_init_prop_0 },
  829. { gf100_grctx_init_gpc_unk_1 },
  830. { gf100_grctx_init_setup_0 },
  831. { gf100_grctx_init_zcull_0 },
  832. { gf100_grctx_init_crstr_0 },
  833. { gf100_grctx_init_gpm_0 },
  834. { gf100_grctx_init_gcc_0 },
  835. {}
  836. };
  837. static const struct gf100_gr_init
  838. gf100_grctx_init_zcullr_0[] = {
  839. { 0x418a00, 3, 0x04, 0x00000000 },
  840. { 0x418a0c, 1, 0x04, 0x00010000 },
  841. { 0x418a10, 3, 0x04, 0x00000000 },
  842. { 0x418a20, 3, 0x04, 0x00000000 },
  843. { 0x418a2c, 1, 0x04, 0x00010000 },
  844. { 0x418a30, 3, 0x04, 0x00000000 },
  845. { 0x418a40, 3, 0x04, 0x00000000 },
  846. { 0x418a4c, 1, 0x04, 0x00010000 },
  847. { 0x418a50, 3, 0x04, 0x00000000 },
  848. { 0x418a60, 3, 0x04, 0x00000000 },
  849. { 0x418a6c, 1, 0x04, 0x00010000 },
  850. { 0x418a70, 3, 0x04, 0x00000000 },
  851. { 0x418a80, 3, 0x04, 0x00000000 },
  852. { 0x418a8c, 1, 0x04, 0x00010000 },
  853. { 0x418a90, 3, 0x04, 0x00000000 },
  854. { 0x418aa0, 3, 0x04, 0x00000000 },
  855. { 0x418aac, 1, 0x04, 0x00010000 },
  856. { 0x418ab0, 3, 0x04, 0x00000000 },
  857. { 0x418ac0, 3, 0x04, 0x00000000 },
  858. { 0x418acc, 1, 0x04, 0x00010000 },
  859. { 0x418ad0, 3, 0x04, 0x00000000 },
  860. { 0x418ae0, 3, 0x04, 0x00000000 },
  861. { 0x418aec, 1, 0x04, 0x00010000 },
  862. { 0x418af0, 3, 0x04, 0x00000000 },
  863. {}
  864. };
  865. const struct gf100_gr_pack
  866. gf100_grctx_pack_zcull[] = {
  867. { gf100_grctx_init_zcullr_0 },
  868. {}
  869. };
  870. const struct gf100_gr_init
  871. gf100_grctx_init_pe_0[] = {
  872. { 0x419818, 1, 0x04, 0x00000000 },
  873. { 0x41983c, 1, 0x04, 0x00038bc7 },
  874. { 0x419848, 1, 0x04, 0x00000000 },
  875. { 0x419864, 1, 0x04, 0x0000012a },
  876. { 0x419888, 1, 0x04, 0x00000000 },
  877. {}
  878. };
  879. static const struct gf100_gr_init
  880. gf100_grctx_init_tex_0[] = {
  881. { 0x419a00, 1, 0x04, 0x000001f0 },
  882. { 0x419a04, 1, 0x04, 0x00000001 },
  883. { 0x419a08, 1, 0x04, 0x00000023 },
  884. { 0x419a0c, 1, 0x04, 0x00020000 },
  885. { 0x419a10, 1, 0x04, 0x00000000 },
  886. { 0x419a14, 1, 0x04, 0x00000200 },
  887. {}
  888. };
  889. const struct gf100_gr_init
  890. gf100_grctx_init_wwdx_0[] = {
  891. { 0x419b00, 1, 0x04, 0x0a418820 },
  892. { 0x419b04, 1, 0x04, 0x062080e6 },
  893. { 0x419b08, 1, 0x04, 0x020398a4 },
  894. { 0x419b0c, 1, 0x04, 0x0e629062 },
  895. { 0x419b10, 1, 0x04, 0x0a418820 },
  896. { 0x419b14, 1, 0x04, 0x000000e6 },
  897. { 0x419bd0, 1, 0x04, 0x00900103 },
  898. { 0x419be0, 1, 0x04, 0x00000001 },
  899. { 0x419be4, 1, 0x04, 0x00000000 },
  900. {}
  901. };
  902. const struct gf100_gr_init
  903. gf100_grctx_init_mpc_0[] = {
  904. { 0x419c00, 1, 0x04, 0x00000002 },
  905. { 0x419c04, 1, 0x04, 0x00000006 },
  906. { 0x419c08, 1, 0x04, 0x00000002 },
  907. { 0x419c20, 1, 0x04, 0x00000000 },
  908. {}
  909. };
  910. static const struct gf100_gr_init
  911. gf100_grctx_init_l1c_0[] = {
  912. { 0x419cb0, 1, 0x04, 0x00060048 },
  913. { 0x419ce8, 1, 0x04, 0x00000000 },
  914. { 0x419cf4, 1, 0x04, 0x00000183 },
  915. {}
  916. };
  917. const struct gf100_gr_init
  918. gf100_grctx_init_tpccs_0[] = {
  919. { 0x419d20, 1, 0x04, 0x02180000 },
  920. { 0x419d24, 1, 0x04, 0x00001fff },
  921. {}
  922. };
  923. static const struct gf100_gr_init
  924. gf100_grctx_init_sm_0[] = {
  925. { 0x419e04, 3, 0x04, 0x00000000 },
  926. { 0x419e10, 1, 0x04, 0x00000002 },
  927. { 0x419e44, 1, 0x04, 0x001beff2 },
  928. { 0x419e48, 1, 0x04, 0x00000000 },
  929. { 0x419e4c, 1, 0x04, 0x0000000f },
  930. { 0x419e50, 17, 0x04, 0x00000000 },
  931. { 0x419e98, 1, 0x04, 0x00000000 },
  932. { 0x419f50, 2, 0x04, 0x00000000 },
  933. {}
  934. };
  935. const struct gf100_gr_pack
  936. gf100_grctx_pack_tpc[] = {
  937. { gf100_grctx_init_pe_0 },
  938. { gf100_grctx_init_tex_0 },
  939. { gf100_grctx_init_wwdx_0 },
  940. { gf100_grctx_init_mpc_0 },
  941. { gf100_grctx_init_l1c_0 },
  942. { gf100_grctx_init_tpccs_0 },
  943. { gf100_grctx_init_sm_0 },
  944. {}
  945. };
  946. /*******************************************************************************
  947. * PGRAPH context implementation
  948. ******************************************************************************/
  949. int
  950. gf100_grctx_mmio_data(struct gf100_grctx *info, u32 size, u32 align, u32 access)
  951. {
  952. if (info->data) {
  953. info->buffer[info->buffer_nr] = round_up(info->addr, align);
  954. info->addr = info->buffer[info->buffer_nr] + size;
  955. info->data->size = size;
  956. info->data->align = align;
  957. info->data->access = access;
  958. info->data++;
  959. return info->buffer_nr++;
  960. }
  961. return -1;
  962. }
  963. void
  964. gf100_grctx_mmio_item(struct gf100_grctx *info, u32 addr, u32 data,
  965. int shift, int buffer)
  966. {
  967. if (info->data) {
  968. if (shift >= 0) {
  969. info->mmio->addr = addr;
  970. info->mmio->data = data;
  971. info->mmio->shift = shift;
  972. info->mmio->buffer = buffer;
  973. if (buffer >= 0)
  974. data |= info->buffer[buffer] >> shift;
  975. info->mmio++;
  976. } else
  977. return;
  978. } else {
  979. if (buffer >= 0)
  980. return;
  981. }
  982. nv_wr32(info->priv, addr, data);
  983. }
  984. void
  985. gf100_grctx_generate_bundle(struct gf100_grctx *info)
  986. {
  987. const struct gf100_grctx_oclass *impl = gf100_grctx_impl(info->priv);
  988. const u32 access = NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS;
  989. const int s = 8;
  990. const int b = mmio_vram(info, impl->bundle_size, (1 << s), access);
  991. mmio_refn(info, 0x408004, 0x00000000, s, b);
  992. mmio_wr32(info, 0x408008, 0x80000000 | (impl->bundle_size >> s));
  993. mmio_refn(info, 0x418808, 0x00000000, s, b);
  994. mmio_wr32(info, 0x41880c, 0x80000000 | (impl->bundle_size >> s));
  995. }
  996. void
  997. gf100_grctx_generate_pagepool(struct gf100_grctx *info)
  998. {
  999. const struct gf100_grctx_oclass *impl = gf100_grctx_impl(info->priv);
  1000. const u32 access = NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS;
  1001. const int s = 8;
  1002. const int b = mmio_vram(info, impl->pagepool_size, (1 << s), access);
  1003. mmio_refn(info, 0x40800c, 0x00000000, s, b);
  1004. mmio_wr32(info, 0x408010, 0x80000000);
  1005. mmio_refn(info, 0x419004, 0x00000000, s, b);
  1006. mmio_wr32(info, 0x419008, 0x00000000);
  1007. }
  1008. void
  1009. gf100_grctx_generate_attrib(struct gf100_grctx *info)
  1010. {
  1011. struct gf100_gr_priv *priv = info->priv;
  1012. const struct gf100_grctx_oclass *impl = gf100_grctx_impl(priv);
  1013. const u32 attrib = impl->attrib_nr;
  1014. const u32 size = 0x20 * (impl->attrib_nr_max + impl->alpha_nr_max);
  1015. const u32 access = NV_MEM_ACCESS_RW;
  1016. const int s = 12;
  1017. const int b = mmio_vram(info, size * priv->tpc_total, (1 << s), access);
  1018. int gpc, tpc;
  1019. u32 bo = 0;
  1020. mmio_refn(info, 0x418810, 0x80000000, s, b);
  1021. mmio_refn(info, 0x419848, 0x10000000, s, b);
  1022. mmio_wr32(info, 0x405830, (attrib << 16));
  1023. for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
  1024. for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
  1025. const u32 o = TPC_UNIT(gpc, tpc, 0x0520);
  1026. mmio_skip(info, o, (attrib << 16) | ++bo);
  1027. mmio_wr32(info, o, (attrib << 16) | --bo);
  1028. bo += impl->attrib_nr_max;
  1029. }
  1030. }
  1031. }
  1032. void
  1033. gf100_grctx_generate_unkn(struct gf100_gr_priv *priv)
  1034. {
  1035. }
  1036. void
  1037. gf100_grctx_generate_tpcid(struct gf100_gr_priv *priv)
  1038. {
  1039. int gpc, tpc, id;
  1040. for (tpc = 0, id = 0; tpc < 4; tpc++) {
  1041. for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
  1042. if (tpc < priv->tpc_nr[gpc]) {
  1043. nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x698), id);
  1044. nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x4e8), id);
  1045. nv_wr32(priv, GPC_UNIT(gpc, 0x0c10 + tpc * 4), id);
  1046. nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x088), id);
  1047. id++;
  1048. }
  1049. nv_wr32(priv, GPC_UNIT(gpc, 0x0c08), priv->tpc_nr[gpc]);
  1050. nv_wr32(priv, GPC_UNIT(gpc, 0x0c8c), priv->tpc_nr[gpc]);
  1051. }
  1052. }
  1053. }
  1054. void
  1055. gf100_grctx_generate_r406028(struct gf100_gr_priv *priv)
  1056. {
  1057. u32 tmp[GPC_MAX / 8] = {}, i = 0;
  1058. for (i = 0; i < priv->gpc_nr; i++)
  1059. tmp[i / 8] |= priv->tpc_nr[i] << ((i % 8) * 4);
  1060. for (i = 0; i < 4; i++) {
  1061. nv_wr32(priv, 0x406028 + (i * 4), tmp[i]);
  1062. nv_wr32(priv, 0x405870 + (i * 4), tmp[i]);
  1063. }
  1064. }
  1065. void
  1066. gf100_grctx_generate_r4060a8(struct gf100_gr_priv *priv)
  1067. {
  1068. u8 tpcnr[GPC_MAX], data[TPC_MAX];
  1069. int gpc, tpc, i;
  1070. memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
  1071. memset(data, 0x1f, sizeof(data));
  1072. gpc = -1;
  1073. for (tpc = 0; tpc < priv->tpc_total; tpc++) {
  1074. do {
  1075. gpc = (gpc + 1) % priv->gpc_nr;
  1076. } while (!tpcnr[gpc]);
  1077. tpcnr[gpc]--;
  1078. data[tpc] = gpc;
  1079. }
  1080. for (i = 0; i < 4; i++)
  1081. nv_wr32(priv, 0x4060a8 + (i * 4), ((u32 *)data)[i]);
  1082. }
  1083. void
  1084. gf100_grctx_generate_r418bb8(struct gf100_gr_priv *priv)
  1085. {
  1086. u32 data[6] = {}, data2[2] = {};
  1087. u8 tpcnr[GPC_MAX];
  1088. u8 shift, ntpcv;
  1089. int gpc, tpc, i;
  1090. /* calculate first set of magics */
  1091. memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
  1092. gpc = -1;
  1093. for (tpc = 0; tpc < priv->tpc_total; tpc++) {
  1094. do {
  1095. gpc = (gpc + 1) % priv->gpc_nr;
  1096. } while (!tpcnr[gpc]);
  1097. tpcnr[gpc]--;
  1098. data[tpc / 6] |= gpc << ((tpc % 6) * 5);
  1099. }
  1100. for (; tpc < 32; tpc++)
  1101. data[tpc / 6] |= 7 << ((tpc % 6) * 5);
  1102. /* and the second... */
  1103. shift = 0;
  1104. ntpcv = priv->tpc_total;
  1105. while (!(ntpcv & (1 << 4))) {
  1106. ntpcv <<= 1;
  1107. shift++;
  1108. }
  1109. data2[0] = (ntpcv << 16);
  1110. data2[0] |= (shift << 21);
  1111. data2[0] |= (((1 << (0 + 5)) % ntpcv) << 24);
  1112. for (i = 1; i < 7; i++)
  1113. data2[1] |= ((1 << (i + 5)) % ntpcv) << ((i - 1) * 5);
  1114. /* GPC_BROADCAST */
  1115. nv_wr32(priv, 0x418bb8, (priv->tpc_total << 8) |
  1116. priv->magic_not_rop_nr);
  1117. for (i = 0; i < 6; i++)
  1118. nv_wr32(priv, 0x418b08 + (i * 4), data[i]);
  1119. /* GPC_BROADCAST.TP_BROADCAST */
  1120. nv_wr32(priv, 0x419bd0, (priv->tpc_total << 8) |
  1121. priv->magic_not_rop_nr | data2[0]);
  1122. nv_wr32(priv, 0x419be4, data2[1]);
  1123. for (i = 0; i < 6; i++)
  1124. nv_wr32(priv, 0x419b00 + (i * 4), data[i]);
  1125. /* UNK78xx */
  1126. nv_wr32(priv, 0x4078bc, (priv->tpc_total << 8) |
  1127. priv->magic_not_rop_nr);
  1128. for (i = 0; i < 6; i++)
  1129. nv_wr32(priv, 0x40780c + (i * 4), data[i]);
  1130. }
  1131. void
  1132. gf100_grctx_generate_r406800(struct gf100_gr_priv *priv)
  1133. {
  1134. u64 tpc_mask = 0, tpc_set = 0;
  1135. u8 tpcnr[GPC_MAX];
  1136. int gpc, tpc;
  1137. int i, a, b;
  1138. memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
  1139. for (gpc = 0; gpc < priv->gpc_nr; gpc++)
  1140. tpc_mask |= ((1ULL << priv->tpc_nr[gpc]) - 1) << (gpc * 8);
  1141. for (i = 0, gpc = -1, b = -1; i < 32; i++) {
  1142. a = (i * (priv->tpc_total - 1)) / 32;
  1143. if (a != b) {
  1144. b = a;
  1145. do {
  1146. gpc = (gpc + 1) % priv->gpc_nr;
  1147. } while (!tpcnr[gpc]);
  1148. tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
  1149. tpc_set |= 1ULL << ((gpc * 8) + tpc);
  1150. }
  1151. nv_wr32(priv, 0x406800 + (i * 0x20), lower_32_bits(tpc_set));
  1152. nv_wr32(priv, 0x406c00 + (i * 0x20), lower_32_bits(tpc_set ^ tpc_mask));
  1153. if (priv->gpc_nr > 4) {
  1154. nv_wr32(priv, 0x406804 + (i * 0x20), upper_32_bits(tpc_set));
  1155. nv_wr32(priv, 0x406c04 + (i * 0x20), upper_32_bits(tpc_set ^ tpc_mask));
  1156. }
  1157. }
  1158. }
  1159. void
  1160. gf100_grctx_generate_main(struct gf100_gr_priv *priv, struct gf100_grctx *info)
  1161. {
  1162. struct gf100_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass;
  1163. nvkm_mc(priv)->unk260(nvkm_mc(priv), 0);
  1164. gf100_gr_mmio(priv, oclass->hub);
  1165. gf100_gr_mmio(priv, oclass->gpc);
  1166. gf100_gr_mmio(priv, oclass->zcull);
  1167. gf100_gr_mmio(priv, oclass->tpc);
  1168. gf100_gr_mmio(priv, oclass->ppc);
  1169. nv_wr32(priv, 0x404154, 0x00000000);
  1170. oclass->bundle(info);
  1171. oclass->pagepool(info);
  1172. oclass->attrib(info);
  1173. oclass->unkn(priv);
  1174. gf100_grctx_generate_tpcid(priv);
  1175. gf100_grctx_generate_r406028(priv);
  1176. gf100_grctx_generate_r4060a8(priv);
  1177. gf100_grctx_generate_r418bb8(priv);
  1178. gf100_grctx_generate_r406800(priv);
  1179. gf100_gr_icmd(priv, oclass->icmd);
  1180. nv_wr32(priv, 0x404154, 0x00000400);
  1181. gf100_gr_mthd(priv, oclass->mthd);
  1182. nvkm_mc(priv)->unk260(nvkm_mc(priv), 1);
  1183. }
  1184. int
  1185. gf100_grctx_generate(struct gf100_gr_priv *priv)
  1186. {
  1187. struct gf100_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass;
  1188. struct nvkm_bar *bar = nvkm_bar(priv);
  1189. struct nvkm_gpuobj *chan;
  1190. struct gf100_grctx info;
  1191. int ret, i;
  1192. /* allocate memory to for a "channel", which we'll use to generate
  1193. * the default context values
  1194. */
  1195. ret = nvkm_gpuobj_new(nv_object(priv), NULL, 0x80000 + priv->size,
  1196. 0x1000, NVOBJ_FLAG_ZERO_ALLOC, &chan);
  1197. if (ret) {
  1198. nv_error(priv, "failed to allocate channel memory, %d\n", ret);
  1199. return ret;
  1200. }
  1201. /* PGD pointer */
  1202. nv_wo32(chan, 0x0200, lower_32_bits(chan->addr + 0x1000));
  1203. nv_wo32(chan, 0x0204, upper_32_bits(chan->addr + 0x1000));
  1204. nv_wo32(chan, 0x0208, 0xffffffff);
  1205. nv_wo32(chan, 0x020c, 0x000000ff);
  1206. /* PGT[0] pointer */
  1207. nv_wo32(chan, 0x1000, 0x00000000);
  1208. nv_wo32(chan, 0x1004, 0x00000001 | (chan->addr + 0x2000) >> 8);
  1209. /* identity-map the whole "channel" into its own vm */
  1210. for (i = 0; i < chan->size / 4096; i++) {
  1211. u64 addr = ((chan->addr + (i * 4096)) >> 8) | 1;
  1212. nv_wo32(chan, 0x2000 + (i * 8), lower_32_bits(addr));
  1213. nv_wo32(chan, 0x2004 + (i * 8), upper_32_bits(addr));
  1214. }
  1215. /* context pointer (virt) */
  1216. nv_wo32(chan, 0x0210, 0x00080004);
  1217. nv_wo32(chan, 0x0214, 0x00000000);
  1218. bar->flush(bar);
  1219. nv_wr32(priv, 0x100cb8, (chan->addr + 0x1000) >> 8);
  1220. nv_wr32(priv, 0x100cbc, 0x80000001);
  1221. nv_wait(priv, 0x100c80, 0x00008000, 0x00008000);
  1222. /* setup default state for mmio list construction */
  1223. info.priv = priv;
  1224. info.data = priv->mmio_data;
  1225. info.mmio = priv->mmio_list;
  1226. info.addr = 0x2000 + (i * 8);
  1227. info.buffer_nr = 0;
  1228. /* make channel current */
  1229. if (priv->firmware) {
  1230. nv_wr32(priv, 0x409840, 0x00000030);
  1231. nv_wr32(priv, 0x409500, 0x80000000 | chan->addr >> 12);
  1232. nv_wr32(priv, 0x409504, 0x00000003);
  1233. if (!nv_wait(priv, 0x409800, 0x00000010, 0x00000010))
  1234. nv_error(priv, "load_ctx timeout\n");
  1235. nv_wo32(chan, 0x8001c, 1);
  1236. nv_wo32(chan, 0x80020, 0);
  1237. nv_wo32(chan, 0x80028, 0);
  1238. nv_wo32(chan, 0x8002c, 0);
  1239. bar->flush(bar);
  1240. } else {
  1241. nv_wr32(priv, 0x409840, 0x80000000);
  1242. nv_wr32(priv, 0x409500, 0x80000000 | chan->addr >> 12);
  1243. nv_wr32(priv, 0x409504, 0x00000001);
  1244. if (!nv_wait(priv, 0x409800, 0x80000000, 0x80000000))
  1245. nv_error(priv, "HUB_SET_CHAN timeout\n");
  1246. }
  1247. oclass->main(priv, &info);
  1248. /* trigger a context unload by unsetting the "next channel valid" bit
  1249. * and faking a context switch interrupt
  1250. */
  1251. nv_mask(priv, 0x409b04, 0x80000000, 0x00000000);
  1252. nv_wr32(priv, 0x409000, 0x00000100);
  1253. if (!nv_wait(priv, 0x409b00, 0x80000000, 0x00000000)) {
  1254. nv_error(priv, "grctx template channel unload timeout\n");
  1255. ret = -EBUSY;
  1256. goto done;
  1257. }
  1258. priv->data = kmalloc(priv->size, GFP_KERNEL);
  1259. if (priv->data) {
  1260. for (i = 0; i < priv->size; i += 4)
  1261. priv->data[i / 4] = nv_ro32(chan, 0x80000 + i);
  1262. ret = 0;
  1263. } else {
  1264. ret = -ENOMEM;
  1265. }
  1266. done:
  1267. nvkm_gpuobj_ref(NULL, &chan);
  1268. return ret;
  1269. }
  1270. struct nvkm_oclass *
  1271. gf100_grctx_oclass = &(struct gf100_grctx_oclass) {
  1272. .base.handle = NV_ENGCTX(GR, 0xc0),
  1273. .base.ofuncs = &(struct nvkm_ofuncs) {
  1274. .ctor = gf100_gr_context_ctor,
  1275. .dtor = gf100_gr_context_dtor,
  1276. .init = _nvkm_gr_context_init,
  1277. .fini = _nvkm_gr_context_fini,
  1278. .rd32 = _nvkm_gr_context_rd32,
  1279. .wr32 = _nvkm_gr_context_wr32,
  1280. },
  1281. .main = gf100_grctx_generate_main,
  1282. .unkn = gf100_grctx_generate_unkn,
  1283. .hub = gf100_grctx_pack_hub,
  1284. .gpc = gf100_grctx_pack_gpc,
  1285. .zcull = gf100_grctx_pack_zcull,
  1286. .tpc = gf100_grctx_pack_tpc,
  1287. .icmd = gf100_grctx_pack_icmd,
  1288. .mthd = gf100_grctx_pack_mthd,
  1289. .bundle = gf100_grctx_generate_bundle,
  1290. .bundle_size = 0x1800,
  1291. .pagepool = gf100_grctx_generate_pagepool,
  1292. .pagepool_size = 0x8000,
  1293. .attrib = gf100_grctx_generate_attrib,
  1294. .attrib_nr_max = 0x324,
  1295. .attrib_nr = 0x218,
  1296. }.base;