nv50_fb.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "drmP.h"
  2. #include "drm.h"
  3. #include "nouveau_drv.h"
  4. #include "nouveau_drm.h"
  5. int
  6. nv50_fb_init(struct drm_device *dev)
  7. {
  8. struct drm_nouveau_private *dev_priv = dev->dev_private;
  9. /* Not a clue what this is exactly. Without pointing it at a
  10. * scratch page, VRAM->GART blits with M2MF (as in DDX DFS)
  11. * cause IOMMU "read from address 0" errors (rh#561267)
  12. */
  13. nv_wr32(dev, 0x100c08, dev_priv->gart_info.sg_dummy_bus >> 8);
  14. /* This is needed to get meaningful information from 100c90
  15. * on traps. No idea what these values mean exactly. */
  16. switch (dev_priv->chipset) {
  17. case 0x50:
  18. nv_wr32(dev, 0x100c90, 0x0707ff);
  19. break;
  20. case 0xa3:
  21. case 0xa5:
  22. case 0xa8:
  23. nv_wr32(dev, 0x100c90, 0x0d0fff);
  24. break;
  25. default:
  26. nv_wr32(dev, 0x100c90, 0x1d07ff);
  27. break;
  28. }
  29. return 0;
  30. }
  31. void
  32. nv50_fb_takedown(struct drm_device *dev)
  33. {
  34. }
  35. void
  36. nv50_fb_vm_trap(struct drm_device *dev, int display, const char *name)
  37. {
  38. struct drm_nouveau_private *dev_priv = dev->dev_private;
  39. u32 trap[6], idx, chinst;
  40. int i, ch;
  41. idx = nv_rd32(dev, 0x100c90);
  42. if (!(idx & 0x80000000))
  43. return;
  44. idx &= 0x00ffffff;
  45. for (i = 0; i < 6; i++) {
  46. nv_wr32(dev, 0x100c90, idx | i << 24);
  47. trap[i] = nv_rd32(dev, 0x100c94);
  48. }
  49. nv_wr32(dev, 0x100c90, idx | 0x80000000);
  50. if (!display)
  51. return;
  52. chinst = (trap[2] << 16) | trap[1];
  53. for (ch = 0; ch < dev_priv->engine.fifo.channels; ch++) {
  54. struct nouveau_channel *chan = dev_priv->fifos[ch];
  55. if (!chan || !chan->ramin)
  56. continue;
  57. if (chinst == chan->ramin->vinst >> 12)
  58. break;
  59. }
  60. NV_INFO(dev, "%s - VM: Trapped %s at %02x%04x%04x status %08x "
  61. "channel %d (0x%08x)\n",
  62. name, (trap[5] & 0x100 ? "read" : "write"),
  63. trap[5] & 0xff, trap[4] & 0xffff, trap[3] & 0xffff,
  64. trap[0], ch, chinst);
  65. }