nv34.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #include "nv20.h"
  2. #include "regs.h"
  3. #include <core/gpuobj.h>
  4. #include <engine/fifo.h>
  5. #include <engine/fifo/chan.h>
  6. /*******************************************************************************
  7. * PGRAPH context
  8. ******************************************************************************/
  9. static const struct nvkm_object_func
  10. nv34_gr_chan = {
  11. .dtor = nv20_gr_chan_dtor,
  12. .init = nv20_gr_chan_init,
  13. .fini = nv20_gr_chan_fini,
  14. };
  15. static int
  16. nv34_gr_chan_new(struct nvkm_gr *base, struct nvkm_fifo_chan *fifoch,
  17. const struct nvkm_oclass *oclass, struct nvkm_object **pobject)
  18. {
  19. struct nv20_gr *gr = nv20_gr(base);
  20. struct nv20_gr_chan *chan;
  21. int ret, i;
  22. if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
  23. return -ENOMEM;
  24. nvkm_object_ctor(&nv34_gr_chan, oclass, &chan->object);
  25. chan->gr = gr;
  26. chan->chid = fifoch->chid;
  27. *pobject = &chan->object;
  28. ret = nvkm_memory_new(gr->base.engine.subdev.device,
  29. NVKM_MEM_TARGET_INST, 0x46dc, 16, true,
  30. &chan->inst);
  31. if (ret)
  32. return ret;
  33. nvkm_kmap(chan->inst);
  34. nvkm_wo32(chan->inst, 0x0028, 0x00000001 | (chan->chid << 24));
  35. nvkm_wo32(chan->inst, 0x040c, 0x01000101);
  36. nvkm_wo32(chan->inst, 0x0420, 0x00000111);
  37. nvkm_wo32(chan->inst, 0x0424, 0x00000060);
  38. nvkm_wo32(chan->inst, 0x0440, 0x00000080);
  39. nvkm_wo32(chan->inst, 0x0444, 0xffff0000);
  40. nvkm_wo32(chan->inst, 0x0448, 0x00000001);
  41. nvkm_wo32(chan->inst, 0x045c, 0x44400000);
  42. nvkm_wo32(chan->inst, 0x0480, 0xffff0000);
  43. for (i = 0x04d4; i < 0x04dc; i += 4)
  44. nvkm_wo32(chan->inst, i, 0x0fff0000);
  45. nvkm_wo32(chan->inst, 0x04e0, 0x00011100);
  46. for (i = 0x04fc; i < 0x053c; i += 4)
  47. nvkm_wo32(chan->inst, i, 0x07ff0000);
  48. nvkm_wo32(chan->inst, 0x0544, 0x4b7fffff);
  49. nvkm_wo32(chan->inst, 0x057c, 0x00000080);
  50. nvkm_wo32(chan->inst, 0x0580, 0x30201000);
  51. nvkm_wo32(chan->inst, 0x0584, 0x70605040);
  52. nvkm_wo32(chan->inst, 0x0588, 0xb8a89888);
  53. nvkm_wo32(chan->inst, 0x058c, 0xf8e8d8c8);
  54. nvkm_wo32(chan->inst, 0x05a0, 0xb0000000);
  55. for (i = 0x05f0; i < 0x0630; i += 4)
  56. nvkm_wo32(chan->inst, i, 0x00010588);
  57. for (i = 0x0630; i < 0x0670; i += 4)
  58. nvkm_wo32(chan->inst, i, 0x00030303);
  59. for (i = 0x06b0; i < 0x06f0; i += 4)
  60. nvkm_wo32(chan->inst, i, 0x0008aae4);
  61. for (i = 0x06f0; i < 0x0730; i += 4)
  62. nvkm_wo32(chan->inst, i, 0x01012000);
  63. for (i = 0x0730; i < 0x0770; i += 4)
  64. nvkm_wo32(chan->inst, i, 0x00080008);
  65. nvkm_wo32(chan->inst, 0x0850, 0x00040000);
  66. nvkm_wo32(chan->inst, 0x0854, 0x00010000);
  67. for (i = 0x0858; i < 0x0868; i += 4)
  68. nvkm_wo32(chan->inst, i, 0x00040004);
  69. for (i = 0x15ac; i <= 0x271c ; i += 16) {
  70. nvkm_wo32(chan->inst, i + 0, 0x10700ff9);
  71. nvkm_wo32(chan->inst, i + 4, 0x0436086c);
  72. nvkm_wo32(chan->inst, i + 8, 0x000c001b);
  73. }
  74. for (i = 0x274c; i < 0x275c; i += 4)
  75. nvkm_wo32(chan->inst, i, 0x0000ffff);
  76. nvkm_wo32(chan->inst, 0x2ae0, 0x3f800000);
  77. nvkm_wo32(chan->inst, 0x2e9c, 0x3f800000);
  78. nvkm_wo32(chan->inst, 0x2eb0, 0x3f800000);
  79. nvkm_wo32(chan->inst, 0x2edc, 0x40000000);
  80. nvkm_wo32(chan->inst, 0x2ee0, 0x3f800000);
  81. nvkm_wo32(chan->inst, 0x2ee4, 0x3f000000);
  82. nvkm_wo32(chan->inst, 0x2eec, 0x40000000);
  83. nvkm_wo32(chan->inst, 0x2ef0, 0x3f800000);
  84. nvkm_wo32(chan->inst, 0x2ef8, 0xbf800000);
  85. nvkm_wo32(chan->inst, 0x2f00, 0xbf800000);
  86. nvkm_done(chan->inst);
  87. return 0;
  88. }
  89. /*******************************************************************************
  90. * PGRAPH engine/subdev functions
  91. ******************************************************************************/
  92. static const struct nvkm_gr_func
  93. nv34_gr = {
  94. .dtor = nv20_gr_dtor,
  95. .oneinit = nv20_gr_oneinit,
  96. .init = nv30_gr_init,
  97. .intr = nv20_gr_intr,
  98. .tile = nv20_gr_tile,
  99. .chan_new = nv34_gr_chan_new,
  100. .sclass = {
  101. { -1, -1, 0x0012, &nv04_gr_object }, /* beta1 */
  102. { -1, -1, 0x0019, &nv04_gr_object }, /* clip */
  103. { -1, -1, 0x0030, &nv04_gr_object }, /* null */
  104. { -1, -1, 0x0039, &nv04_gr_object }, /* m2mf */
  105. { -1, -1, 0x0043, &nv04_gr_object }, /* rop */
  106. { -1, -1, 0x0044, &nv04_gr_object }, /* patt */
  107. { -1, -1, 0x004a, &nv04_gr_object }, /* gdi */
  108. { -1, -1, 0x0062, &nv04_gr_object }, /* surf2d */
  109. { -1, -1, 0x0072, &nv04_gr_object }, /* beta4 */
  110. { -1, -1, 0x0089, &nv04_gr_object }, /* sifm */
  111. { -1, -1, 0x008a, &nv04_gr_object }, /* ifc */
  112. { -1, -1, 0x009f, &nv04_gr_object }, /* imageblit */
  113. { -1, -1, 0x0362, &nv04_gr_object }, /* surf2d (nv30) */
  114. { -1, -1, 0x0389, &nv04_gr_object }, /* sifm (nv30) */
  115. { -1, -1, 0x038a, &nv04_gr_object }, /* ifc (nv30) */
  116. { -1, -1, 0x039e, &nv04_gr_object }, /* swzsurf (nv30) */
  117. { -1, -1, 0x0597, &nv04_gr_object }, /* kelvin */
  118. { -1, -1, 0x0697, &nv04_gr_object }, /* rankine */
  119. {}
  120. }
  121. };
  122. int
  123. nv34_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
  124. {
  125. return nv20_gr_new_(&nv34_gr, device, index, pgr);
  126. }