ctxgf100.c 43 KB

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