nv50_fifo.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. /*
  2. * Copyright (C) 2007 Ben Skeggs.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial
  15. * portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. */
  26. #include "drmP.h"
  27. #include "drm.h"
  28. #include "nouveau_drv.h"
  29. #include "nouveau_ramht.h"
  30. static void
  31. nv50_fifo_playlist_update(struct drm_device *dev)
  32. {
  33. struct drm_nouveau_private *dev_priv = dev->dev_private;
  34. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  35. struct nouveau_gpuobj *cur;
  36. int i, nr;
  37. NV_DEBUG(dev, "\n");
  38. cur = pfifo->playlist[pfifo->cur_playlist];
  39. pfifo->cur_playlist = !pfifo->cur_playlist;
  40. /* We never schedule channel 0 or 127 */
  41. for (i = 1, nr = 0; i < 127; i++) {
  42. if (dev_priv->channels.ptr[i] &&
  43. dev_priv->channels.ptr[i]->ramfc) {
  44. nv_wo32(cur, (nr * 4), i);
  45. nr++;
  46. }
  47. }
  48. dev_priv->engine.instmem.flush(dev);
  49. nv_wr32(dev, 0x32f4, cur->vinst >> 12);
  50. nv_wr32(dev, 0x32ec, nr);
  51. nv_wr32(dev, 0x2500, 0x101);
  52. }
  53. static void
  54. nv50_fifo_channel_enable(struct drm_device *dev, int channel)
  55. {
  56. struct drm_nouveau_private *dev_priv = dev->dev_private;
  57. struct nouveau_channel *chan = dev_priv->channels.ptr[channel];
  58. uint32_t inst;
  59. NV_DEBUG(dev, "ch%d\n", channel);
  60. if (dev_priv->chipset == 0x50)
  61. inst = chan->ramfc->vinst >> 12;
  62. else
  63. inst = chan->ramfc->vinst >> 8;
  64. nv_wr32(dev, NV50_PFIFO_CTX_TABLE(channel), inst |
  65. NV50_PFIFO_CTX_TABLE_CHANNEL_ENABLED);
  66. }
  67. static void
  68. nv50_fifo_channel_disable(struct drm_device *dev, int channel)
  69. {
  70. struct drm_nouveau_private *dev_priv = dev->dev_private;
  71. uint32_t inst;
  72. NV_DEBUG(dev, "ch%d\n", channel);
  73. if (dev_priv->chipset == 0x50)
  74. inst = NV50_PFIFO_CTX_TABLE_INSTANCE_MASK_G80;
  75. else
  76. inst = NV50_PFIFO_CTX_TABLE_INSTANCE_MASK_G84;
  77. nv_wr32(dev, NV50_PFIFO_CTX_TABLE(channel), inst);
  78. }
  79. static void
  80. nv50_fifo_init_reset(struct drm_device *dev)
  81. {
  82. uint32_t pmc_e = NV_PMC_ENABLE_PFIFO;
  83. NV_DEBUG(dev, "\n");
  84. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & ~pmc_e);
  85. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | pmc_e);
  86. }
  87. static void
  88. nv50_fifo_init_intr(struct drm_device *dev)
  89. {
  90. NV_DEBUG(dev, "\n");
  91. nouveau_irq_register(dev, 8, nv04_fifo_isr);
  92. nv_wr32(dev, NV03_PFIFO_INTR_0, 0xFFFFFFFF);
  93. nv_wr32(dev, NV03_PFIFO_INTR_EN_0, 0xFFFFFFFF);
  94. }
  95. static void
  96. nv50_fifo_init_context_table(struct drm_device *dev)
  97. {
  98. struct drm_nouveau_private *dev_priv = dev->dev_private;
  99. int i;
  100. NV_DEBUG(dev, "\n");
  101. for (i = 0; i < NV50_PFIFO_CTX_TABLE__SIZE; i++) {
  102. if (dev_priv->channels.ptr[i])
  103. nv50_fifo_channel_enable(dev, i);
  104. else
  105. nv50_fifo_channel_disable(dev, i);
  106. }
  107. nv50_fifo_playlist_update(dev);
  108. }
  109. static void
  110. nv50_fifo_init_regs__nv(struct drm_device *dev)
  111. {
  112. NV_DEBUG(dev, "\n");
  113. nv_wr32(dev, 0x250c, 0x6f3cfc34);
  114. }
  115. static void
  116. nv50_fifo_init_regs(struct drm_device *dev)
  117. {
  118. NV_DEBUG(dev, "\n");
  119. nv_wr32(dev, 0x2500, 0);
  120. nv_wr32(dev, 0x3250, 0);
  121. nv_wr32(dev, 0x3220, 0);
  122. nv_wr32(dev, 0x3204, 0);
  123. nv_wr32(dev, 0x3210, 0);
  124. nv_wr32(dev, 0x3270, 0);
  125. /* Enable dummy channels setup by nv50_instmem.c */
  126. nv50_fifo_channel_enable(dev, 0);
  127. nv50_fifo_channel_enable(dev, 127);
  128. }
  129. int
  130. nv50_fifo_init(struct drm_device *dev)
  131. {
  132. struct drm_nouveau_private *dev_priv = dev->dev_private;
  133. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  134. int ret;
  135. NV_DEBUG(dev, "\n");
  136. if (pfifo->playlist[0]) {
  137. pfifo->cur_playlist = !pfifo->cur_playlist;
  138. goto just_reset;
  139. }
  140. ret = nouveau_gpuobj_new(dev, NULL, 128*4, 0x1000,
  141. NVOBJ_FLAG_ZERO_ALLOC,
  142. &pfifo->playlist[0]);
  143. if (ret) {
  144. NV_ERROR(dev, "error creating playlist 0: %d\n", ret);
  145. return ret;
  146. }
  147. ret = nouveau_gpuobj_new(dev, NULL, 128*4, 0x1000,
  148. NVOBJ_FLAG_ZERO_ALLOC,
  149. &pfifo->playlist[1]);
  150. if (ret) {
  151. nouveau_gpuobj_ref(NULL, &pfifo->playlist[0]);
  152. NV_ERROR(dev, "error creating playlist 1: %d\n", ret);
  153. return ret;
  154. }
  155. just_reset:
  156. nv50_fifo_init_reset(dev);
  157. nv50_fifo_init_intr(dev);
  158. nv50_fifo_init_context_table(dev);
  159. nv50_fifo_init_regs__nv(dev);
  160. nv50_fifo_init_regs(dev);
  161. dev_priv->engine.fifo.enable(dev);
  162. dev_priv->engine.fifo.reassign(dev, true);
  163. return 0;
  164. }
  165. void
  166. nv50_fifo_takedown(struct drm_device *dev)
  167. {
  168. struct drm_nouveau_private *dev_priv = dev->dev_private;
  169. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  170. NV_DEBUG(dev, "\n");
  171. if (!pfifo->playlist[0])
  172. return;
  173. nv_wr32(dev, 0x2140, 0x00000000);
  174. nouveau_irq_unregister(dev, 8);
  175. nouveau_gpuobj_ref(NULL, &pfifo->playlist[0]);
  176. nouveau_gpuobj_ref(NULL, &pfifo->playlist[1]);
  177. }
  178. int
  179. nv50_fifo_channel_id(struct drm_device *dev)
  180. {
  181. return nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) &
  182. NV50_PFIFO_CACHE1_PUSH1_CHID_MASK;
  183. }
  184. int
  185. nv50_fifo_create_context(struct nouveau_channel *chan)
  186. {
  187. struct drm_device *dev = chan->dev;
  188. struct drm_nouveau_private *dev_priv = dev->dev_private;
  189. struct nouveau_gpuobj *ramfc = NULL;
  190. unsigned long flags;
  191. int ret;
  192. NV_DEBUG(dev, "ch%d\n", chan->id);
  193. if (dev_priv->chipset == 0x50) {
  194. ret = nouveau_gpuobj_new_fake(dev, chan->ramin->pinst,
  195. chan->ramin->vinst, 0x100,
  196. NVOBJ_FLAG_ZERO_ALLOC |
  197. NVOBJ_FLAG_ZERO_FREE,
  198. &chan->ramfc);
  199. if (ret)
  200. return ret;
  201. ret = nouveau_gpuobj_new_fake(dev, chan->ramin->pinst + 0x0400,
  202. chan->ramin->vinst + 0x0400,
  203. 4096, 0, &chan->cache);
  204. if (ret)
  205. return ret;
  206. } else {
  207. ret = nouveau_gpuobj_new(dev, chan, 0x100, 256,
  208. NVOBJ_FLAG_ZERO_ALLOC |
  209. NVOBJ_FLAG_ZERO_FREE, &chan->ramfc);
  210. if (ret)
  211. return ret;
  212. ret = nouveau_gpuobj_new(dev, chan, 4096, 1024,
  213. 0, &chan->cache);
  214. if (ret)
  215. return ret;
  216. }
  217. ramfc = chan->ramfc;
  218. chan->user = ioremap(pci_resource_start(dev->pdev, 0) +
  219. NV50_USER(chan->id), PAGE_SIZE);
  220. if (!chan->user)
  221. return -ENOMEM;
  222. spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
  223. nv_wo32(ramfc, 0x48, chan->pushbuf->cinst >> 4);
  224. nv_wo32(ramfc, 0x80, ((chan->ramht->bits - 9) << 27) |
  225. (4 << 24) /* SEARCH_FULL */ |
  226. (chan->ramht->gpuobj->cinst >> 4));
  227. nv_wo32(ramfc, 0x44, 0x2101ffff);
  228. nv_wo32(ramfc, 0x60, 0x7fffffff);
  229. nv_wo32(ramfc, 0x40, 0x00000000);
  230. nv_wo32(ramfc, 0x7c, 0x30000001);
  231. nv_wo32(ramfc, 0x78, 0x00000000);
  232. nv_wo32(ramfc, 0x3c, 0x403f6078);
  233. nv_wo32(ramfc, 0x50, chan->pushbuf_base + chan->dma.ib_base * 4);
  234. nv_wo32(ramfc, 0x54, drm_order(chan->dma.ib_max + 1) << 16);
  235. if (dev_priv->chipset != 0x50) {
  236. nv_wo32(chan->ramin, 0, chan->id);
  237. nv_wo32(chan->ramin, 4, chan->ramfc->vinst >> 8);
  238. nv_wo32(ramfc, 0x88, chan->cache->vinst >> 10);
  239. nv_wo32(ramfc, 0x98, chan->ramin->vinst >> 12);
  240. }
  241. dev_priv->engine.instmem.flush(dev);
  242. nv50_fifo_channel_enable(dev, chan->id);
  243. nv50_fifo_playlist_update(dev);
  244. spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
  245. return 0;
  246. }
  247. void
  248. nv50_fifo_destroy_context(struct nouveau_channel *chan)
  249. {
  250. struct drm_device *dev = chan->dev;
  251. struct drm_nouveau_private *dev_priv = dev->dev_private;
  252. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  253. struct nouveau_gpuobj *ramfc = NULL;
  254. unsigned long flags;
  255. NV_DEBUG(dev, "ch%d\n", chan->id);
  256. spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
  257. pfifo->reassign(dev, false);
  258. /* Unload the context if it's the currently active one */
  259. if (pfifo->channel_id(dev) == chan->id) {
  260. pfifo->disable(dev);
  261. pfifo->unload_context(dev);
  262. pfifo->enable(dev);
  263. }
  264. /* This will ensure the channel is seen as disabled. */
  265. nouveau_gpuobj_ref(chan->ramfc, &ramfc);
  266. nouveau_gpuobj_ref(NULL, &chan->ramfc);
  267. nv50_fifo_channel_disable(dev, chan->id);
  268. /* Dummy channel, also used on ch 127 */
  269. if (chan->id == 0)
  270. nv50_fifo_channel_disable(dev, 127);
  271. nv50_fifo_playlist_update(dev);
  272. pfifo->reassign(dev, true);
  273. spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
  274. /* Free the channel resources */
  275. if (chan->user) {
  276. iounmap(chan->user);
  277. chan->user = NULL;
  278. }
  279. nouveau_gpuobj_ref(NULL, &ramfc);
  280. nouveau_gpuobj_ref(NULL, &chan->cache);
  281. }
  282. int
  283. nv50_fifo_load_context(struct nouveau_channel *chan)
  284. {
  285. struct drm_device *dev = chan->dev;
  286. struct drm_nouveau_private *dev_priv = dev->dev_private;
  287. struct nouveau_gpuobj *ramfc = chan->ramfc;
  288. struct nouveau_gpuobj *cache = chan->cache;
  289. int ptr, cnt;
  290. NV_DEBUG(dev, "ch%d\n", chan->id);
  291. nv_wr32(dev, 0x3330, nv_ro32(ramfc, 0x00));
  292. nv_wr32(dev, 0x3334, nv_ro32(ramfc, 0x04));
  293. nv_wr32(dev, 0x3240, nv_ro32(ramfc, 0x08));
  294. nv_wr32(dev, 0x3320, nv_ro32(ramfc, 0x0c));
  295. nv_wr32(dev, 0x3244, nv_ro32(ramfc, 0x10));
  296. nv_wr32(dev, 0x3328, nv_ro32(ramfc, 0x14));
  297. nv_wr32(dev, 0x3368, nv_ro32(ramfc, 0x18));
  298. nv_wr32(dev, 0x336c, nv_ro32(ramfc, 0x1c));
  299. nv_wr32(dev, 0x3370, nv_ro32(ramfc, 0x20));
  300. nv_wr32(dev, 0x3374, nv_ro32(ramfc, 0x24));
  301. nv_wr32(dev, 0x3378, nv_ro32(ramfc, 0x28));
  302. nv_wr32(dev, 0x337c, nv_ro32(ramfc, 0x2c));
  303. nv_wr32(dev, 0x3228, nv_ro32(ramfc, 0x30));
  304. nv_wr32(dev, 0x3364, nv_ro32(ramfc, 0x34));
  305. nv_wr32(dev, 0x32a0, nv_ro32(ramfc, 0x38));
  306. nv_wr32(dev, 0x3224, nv_ro32(ramfc, 0x3c));
  307. nv_wr32(dev, 0x324c, nv_ro32(ramfc, 0x40));
  308. nv_wr32(dev, 0x2044, nv_ro32(ramfc, 0x44));
  309. nv_wr32(dev, 0x322c, nv_ro32(ramfc, 0x48));
  310. nv_wr32(dev, 0x3234, nv_ro32(ramfc, 0x4c));
  311. nv_wr32(dev, 0x3340, nv_ro32(ramfc, 0x50));
  312. nv_wr32(dev, 0x3344, nv_ro32(ramfc, 0x54));
  313. nv_wr32(dev, 0x3280, nv_ro32(ramfc, 0x58));
  314. nv_wr32(dev, 0x3254, nv_ro32(ramfc, 0x5c));
  315. nv_wr32(dev, 0x3260, nv_ro32(ramfc, 0x60));
  316. nv_wr32(dev, 0x3264, nv_ro32(ramfc, 0x64));
  317. nv_wr32(dev, 0x3268, nv_ro32(ramfc, 0x68));
  318. nv_wr32(dev, 0x326c, nv_ro32(ramfc, 0x6c));
  319. nv_wr32(dev, 0x32e4, nv_ro32(ramfc, 0x70));
  320. nv_wr32(dev, 0x3248, nv_ro32(ramfc, 0x74));
  321. nv_wr32(dev, 0x2088, nv_ro32(ramfc, 0x78));
  322. nv_wr32(dev, 0x2058, nv_ro32(ramfc, 0x7c));
  323. nv_wr32(dev, 0x2210, nv_ro32(ramfc, 0x80));
  324. cnt = nv_ro32(ramfc, 0x84);
  325. for (ptr = 0; ptr < cnt; ptr++) {
  326. nv_wr32(dev, NV40_PFIFO_CACHE1_METHOD(ptr),
  327. nv_ro32(cache, (ptr * 8) + 0));
  328. nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr),
  329. nv_ro32(cache, (ptr * 8) + 4));
  330. }
  331. nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2);
  332. nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0);
  333. /* guessing that all the 0x34xx regs aren't on NV50 */
  334. if (dev_priv->chipset != 0x50) {
  335. nv_wr32(dev, 0x340c, nv_ro32(ramfc, 0x88));
  336. nv_wr32(dev, 0x3400, nv_ro32(ramfc, 0x8c));
  337. nv_wr32(dev, 0x3404, nv_ro32(ramfc, 0x90));
  338. nv_wr32(dev, 0x3408, nv_ro32(ramfc, 0x94));
  339. nv_wr32(dev, 0x3410, nv_ro32(ramfc, 0x98));
  340. }
  341. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16));
  342. return 0;
  343. }
  344. int
  345. nv50_fifo_unload_context(struct drm_device *dev)
  346. {
  347. struct drm_nouveau_private *dev_priv = dev->dev_private;
  348. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  349. struct nouveau_gpuobj *ramfc, *cache;
  350. struct nouveau_channel *chan = NULL;
  351. int chid, get, put, ptr;
  352. NV_DEBUG(dev, "\n");
  353. chid = pfifo->channel_id(dev);
  354. if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1)
  355. return 0;
  356. chan = dev_priv->channels.ptr[chid];
  357. if (!chan) {
  358. NV_ERROR(dev, "Inactive channel on PFIFO: %d\n", chid);
  359. return -EINVAL;
  360. }
  361. NV_DEBUG(dev, "ch%d\n", chan->id);
  362. ramfc = chan->ramfc;
  363. cache = chan->cache;
  364. nv_wo32(ramfc, 0x00, nv_rd32(dev, 0x3330));
  365. nv_wo32(ramfc, 0x04, nv_rd32(dev, 0x3334));
  366. nv_wo32(ramfc, 0x08, nv_rd32(dev, 0x3240));
  367. nv_wo32(ramfc, 0x0c, nv_rd32(dev, 0x3320));
  368. nv_wo32(ramfc, 0x10, nv_rd32(dev, 0x3244));
  369. nv_wo32(ramfc, 0x14, nv_rd32(dev, 0x3328));
  370. nv_wo32(ramfc, 0x18, nv_rd32(dev, 0x3368));
  371. nv_wo32(ramfc, 0x1c, nv_rd32(dev, 0x336c));
  372. nv_wo32(ramfc, 0x20, nv_rd32(dev, 0x3370));
  373. nv_wo32(ramfc, 0x24, nv_rd32(dev, 0x3374));
  374. nv_wo32(ramfc, 0x28, nv_rd32(dev, 0x3378));
  375. nv_wo32(ramfc, 0x2c, nv_rd32(dev, 0x337c));
  376. nv_wo32(ramfc, 0x30, nv_rd32(dev, 0x3228));
  377. nv_wo32(ramfc, 0x34, nv_rd32(dev, 0x3364));
  378. nv_wo32(ramfc, 0x38, nv_rd32(dev, 0x32a0));
  379. nv_wo32(ramfc, 0x3c, nv_rd32(dev, 0x3224));
  380. nv_wo32(ramfc, 0x40, nv_rd32(dev, 0x324c));
  381. nv_wo32(ramfc, 0x44, nv_rd32(dev, 0x2044));
  382. nv_wo32(ramfc, 0x48, nv_rd32(dev, 0x322c));
  383. nv_wo32(ramfc, 0x4c, nv_rd32(dev, 0x3234));
  384. nv_wo32(ramfc, 0x50, nv_rd32(dev, 0x3340));
  385. nv_wo32(ramfc, 0x54, nv_rd32(dev, 0x3344));
  386. nv_wo32(ramfc, 0x58, nv_rd32(dev, 0x3280));
  387. nv_wo32(ramfc, 0x5c, nv_rd32(dev, 0x3254));
  388. nv_wo32(ramfc, 0x60, nv_rd32(dev, 0x3260));
  389. nv_wo32(ramfc, 0x64, nv_rd32(dev, 0x3264));
  390. nv_wo32(ramfc, 0x68, nv_rd32(dev, 0x3268));
  391. nv_wo32(ramfc, 0x6c, nv_rd32(dev, 0x326c));
  392. nv_wo32(ramfc, 0x70, nv_rd32(dev, 0x32e4));
  393. nv_wo32(ramfc, 0x74, nv_rd32(dev, 0x3248));
  394. nv_wo32(ramfc, 0x78, nv_rd32(dev, 0x2088));
  395. nv_wo32(ramfc, 0x7c, nv_rd32(dev, 0x2058));
  396. nv_wo32(ramfc, 0x80, nv_rd32(dev, 0x2210));
  397. put = (nv_rd32(dev, NV03_PFIFO_CACHE1_PUT) & 0x7ff) >> 2;
  398. get = (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) & 0x7ff) >> 2;
  399. ptr = 0;
  400. while (put != get) {
  401. nv_wo32(cache, ptr + 0,
  402. nv_rd32(dev, NV40_PFIFO_CACHE1_METHOD(get)));
  403. nv_wo32(cache, ptr + 4,
  404. nv_rd32(dev, NV40_PFIFO_CACHE1_DATA(get)));
  405. get = (get + 1) & 0x1ff;
  406. ptr += 8;
  407. }
  408. /* guessing that all the 0x34xx regs aren't on NV50 */
  409. if (dev_priv->chipset != 0x50) {
  410. nv_wo32(ramfc, 0x84, ptr >> 3);
  411. nv_wo32(ramfc, 0x88, nv_rd32(dev, 0x340c));
  412. nv_wo32(ramfc, 0x8c, nv_rd32(dev, 0x3400));
  413. nv_wo32(ramfc, 0x90, nv_rd32(dev, 0x3404));
  414. nv_wo32(ramfc, 0x94, nv_rd32(dev, 0x3408));
  415. nv_wo32(ramfc, 0x98, nv_rd32(dev, 0x3410));
  416. }
  417. dev_priv->engine.instmem.flush(dev);
  418. /*XXX: probably reload ch127 (NULL) state back too */
  419. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, 127);
  420. return 0;
  421. }
  422. void
  423. nv50_fifo_tlb_flush(struct drm_device *dev)
  424. {
  425. nv50_vm_flush(dev, 5);
  426. }