gk208.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * Copyright 2013 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 <bskeggs@redhat.com>
  23. */
  24. #include "gf100.h"
  25. #include "ctxgf100.h"
  26. #include <subdev/timer.h>
  27. #include <nvif/class.h>
  28. /*******************************************************************************
  29. * PGRAPH register lists
  30. ******************************************************************************/
  31. static const struct gf100_gr_init
  32. gk208_gr_init_main_0[] = {
  33. { 0x400080, 1, 0x04, 0x003083c2 },
  34. { 0x400088, 1, 0x04, 0x0001bfe7 },
  35. { 0x40008c, 1, 0x04, 0x00000000 },
  36. { 0x400090, 1, 0x04, 0x00000030 },
  37. { 0x40013c, 1, 0x04, 0x003901f7 },
  38. { 0x400140, 1, 0x04, 0x00000100 },
  39. { 0x400144, 1, 0x04, 0x00000000 },
  40. { 0x400148, 1, 0x04, 0x00000110 },
  41. { 0x400138, 1, 0x04, 0x00000000 },
  42. { 0x400130, 2, 0x04, 0x00000000 },
  43. { 0x400124, 1, 0x04, 0x00000002 },
  44. {}
  45. };
  46. static const struct gf100_gr_init
  47. gk208_gr_init_ds_0[] = {
  48. { 0x405844, 1, 0x04, 0x00ffffff },
  49. { 0x405850, 1, 0x04, 0x00000000 },
  50. { 0x405900, 1, 0x04, 0x00000000 },
  51. { 0x405908, 1, 0x04, 0x00000000 },
  52. { 0x405928, 2, 0x04, 0x00000000 },
  53. {}
  54. };
  55. const struct gf100_gr_init
  56. gk208_gr_init_gpc_unk_0[] = {
  57. { 0x418604, 1, 0x04, 0x00000000 },
  58. { 0x418680, 1, 0x04, 0x00000000 },
  59. { 0x418714, 1, 0x04, 0x00000000 },
  60. { 0x418384, 2, 0x04, 0x00000000 },
  61. {}
  62. };
  63. static const struct gf100_gr_init
  64. gk208_gr_init_setup_1[] = {
  65. { 0x4188c8, 2, 0x04, 0x00000000 },
  66. { 0x4188d0, 1, 0x04, 0x00010000 },
  67. { 0x4188d4, 1, 0x04, 0x00000201 },
  68. {}
  69. };
  70. static const struct gf100_gr_init
  71. gk208_gr_init_tex_0[] = {
  72. { 0x419ab0, 1, 0x04, 0x00000000 },
  73. { 0x419ac8, 1, 0x04, 0x00000000 },
  74. { 0x419ab8, 1, 0x04, 0x000000e7 },
  75. { 0x419abc, 2, 0x04, 0x00000000 },
  76. { 0x419ab4, 1, 0x04, 0x00000000 },
  77. { 0x419aa8, 2, 0x04, 0x00000000 },
  78. {}
  79. };
  80. static const struct gf100_gr_init
  81. gk208_gr_init_l1c_0[] = {
  82. { 0x419c98, 1, 0x04, 0x00000000 },
  83. { 0x419ca8, 1, 0x04, 0x00000000 },
  84. { 0x419cb0, 1, 0x04, 0x01000000 },
  85. { 0x419cb4, 1, 0x04, 0x00000000 },
  86. { 0x419cb8, 1, 0x04, 0x00b08bea },
  87. { 0x419c84, 1, 0x04, 0x00010384 },
  88. { 0x419cbc, 1, 0x04, 0x281b3646 },
  89. { 0x419cc0, 2, 0x04, 0x00000000 },
  90. { 0x419c80, 1, 0x04, 0x00000230 },
  91. { 0x419ccc, 2, 0x04, 0x00000000 },
  92. {}
  93. };
  94. static const struct gf100_gr_pack
  95. gk208_gr_pack_mmio[] = {
  96. { gk208_gr_init_main_0 },
  97. { gk110_gr_init_fe_0 },
  98. { gf100_gr_init_pri_0 },
  99. { gf100_gr_init_rstr2d_0 },
  100. { gf119_gr_init_pd_0 },
  101. { gk208_gr_init_ds_0 },
  102. { gf100_gr_init_scc_0 },
  103. { gk110_gr_init_sked_0 },
  104. { gk110_gr_init_cwd_0 },
  105. { gf119_gr_init_prop_0 },
  106. { gk208_gr_init_gpc_unk_0 },
  107. { gf100_gr_init_setup_0 },
  108. { gf100_gr_init_crstr_0 },
  109. { gk208_gr_init_setup_1 },
  110. { gf100_gr_init_zcull_0 },
  111. { gf119_gr_init_gpm_0 },
  112. { gk110_gr_init_gpc_unk_1 },
  113. { gf100_gr_init_gcc_0 },
  114. { gk104_gr_init_tpccs_0 },
  115. { gk208_gr_init_tex_0 },
  116. { gk104_gr_init_pe_0 },
  117. { gk208_gr_init_l1c_0 },
  118. { gf100_gr_init_mpc_0 },
  119. { gk110_gr_init_sm_0 },
  120. { gf117_gr_init_pes_0 },
  121. { gf117_gr_init_wwdx_0 },
  122. { gf117_gr_init_cbm_0 },
  123. { gk104_gr_init_be_0 },
  124. { gf100_gr_init_fe_1 },
  125. {}
  126. };
  127. /*******************************************************************************
  128. * PGRAPH engine/subdev functions
  129. ******************************************************************************/
  130. #include "fuc/hubgk208.fuc5.h"
  131. static struct gf100_gr_ucode
  132. gk208_gr_fecs_ucode = {
  133. .code.data = gk208_grhub_code,
  134. .code.size = sizeof(gk208_grhub_code),
  135. .data.data = gk208_grhub_data,
  136. .data.size = sizeof(gk208_grhub_data),
  137. };
  138. #include "fuc/gpcgk208.fuc5.h"
  139. static struct gf100_gr_ucode
  140. gk208_gr_gpccs_ucode = {
  141. .code.data = gk208_grgpc_code,
  142. .code.size = sizeof(gk208_grgpc_code),
  143. .data.data = gk208_grgpc_data,
  144. .data.size = sizeof(gk208_grgpc_data),
  145. };
  146. static const struct gf100_gr_func
  147. gk208_gr = {
  148. .init = gk104_gr_init,
  149. .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
  150. .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
  151. .mmio = gk208_gr_pack_mmio,
  152. .fecs.ucode = &gk208_gr_fecs_ucode,
  153. .gpccs.ucode = &gk208_gr_gpccs_ucode,
  154. .rops = gf100_gr_rops,
  155. .ppc_nr = 1,
  156. .grctx = &gk208_grctx,
  157. .sclass = {
  158. { -1, -1, FERMI_TWOD_A },
  159. { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
  160. { -1, -1, KEPLER_B, &gf100_fermi },
  161. { -1, -1, KEPLER_COMPUTE_B },
  162. {}
  163. }
  164. };
  165. int
  166. gk208_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
  167. {
  168. return gf100_gr_new_(&gk208_gr, device, index, pgr);
  169. }