gk110.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. const struct gf100_gr_init
  32. gk110_gr_init_fe_0[] = {
  33. { 0x40415c, 1, 0x04, 0x00000000 },
  34. { 0x404170, 1, 0x04, 0x00000000 },
  35. { 0x4041b4, 1, 0x04, 0x00000000 },
  36. {}
  37. };
  38. const struct gf100_gr_init
  39. gk110_gr_init_ds_0[] = {
  40. { 0x405844, 1, 0x04, 0x00ffffff },
  41. { 0x405850, 1, 0x04, 0x00000000 },
  42. { 0x405900, 1, 0x04, 0x0000ff00 },
  43. { 0x405908, 1, 0x04, 0x00000000 },
  44. { 0x405928, 2, 0x04, 0x00000000 },
  45. {}
  46. };
  47. const struct gf100_gr_init
  48. gk110_gr_init_sked_0[] = {
  49. { 0x407010, 1, 0x04, 0x00000000 },
  50. { 0x407040, 1, 0x04, 0x80440424 },
  51. { 0x407048, 1, 0x04, 0x0000000a },
  52. {}
  53. };
  54. const struct gf100_gr_init
  55. gk110_gr_init_cwd_0[] = {
  56. { 0x405b44, 1, 0x04, 0x00000000 },
  57. { 0x405b50, 1, 0x04, 0x00000000 },
  58. {}
  59. };
  60. const struct gf100_gr_init
  61. gk110_gr_init_gpc_unk_1[] = {
  62. { 0x418d00, 1, 0x04, 0x00000000 },
  63. { 0x418d28, 2, 0x04, 0x00000000 },
  64. { 0x418f00, 1, 0x04, 0x00000400 },
  65. { 0x418f08, 1, 0x04, 0x00000000 },
  66. { 0x418f20, 2, 0x04, 0x00000000 },
  67. { 0x418e00, 1, 0x04, 0x00000000 },
  68. { 0x418e08, 1, 0x04, 0x00000000 },
  69. { 0x418e1c, 2, 0x04, 0x00000000 },
  70. {}
  71. };
  72. const struct gf100_gr_init
  73. gk110_gr_init_tex_0[] = {
  74. { 0x419ab0, 1, 0x04, 0x00000000 },
  75. { 0x419ac8, 1, 0x04, 0x00000000 },
  76. { 0x419ab8, 1, 0x04, 0x000000e7 },
  77. { 0x419aec, 1, 0x04, 0x00000000 },
  78. { 0x419abc, 2, 0x04, 0x00000000 },
  79. { 0x419ab4, 1, 0x04, 0x00000000 },
  80. { 0x419aa8, 2, 0x04, 0x00000000 },
  81. {}
  82. };
  83. static const struct gf100_gr_init
  84. gk110_gr_init_l1c_0[] = {
  85. { 0x419c98, 1, 0x04, 0x00000000 },
  86. { 0x419ca8, 1, 0x04, 0x00000000 },
  87. { 0x419cb0, 1, 0x04, 0x01000000 },
  88. { 0x419cb4, 1, 0x04, 0x00000000 },
  89. { 0x419cb8, 1, 0x04, 0x00b08bea },
  90. { 0x419c84, 1, 0x04, 0x00010384 },
  91. { 0x419cbc, 1, 0x04, 0x281b3646 },
  92. { 0x419cc0, 2, 0x04, 0x00000000 },
  93. { 0x419c80, 1, 0x04, 0x00020230 },
  94. { 0x419ccc, 2, 0x04, 0x00000000 },
  95. {}
  96. };
  97. const struct gf100_gr_init
  98. gk110_gr_init_sm_0[] = {
  99. { 0x419e00, 1, 0x04, 0x00000080 },
  100. { 0x419ea0, 1, 0x04, 0x00000000 },
  101. { 0x419ee4, 1, 0x04, 0x00000000 },
  102. { 0x419ea4, 1, 0x04, 0x00000100 },
  103. { 0x419ea8, 1, 0x04, 0x00000000 },
  104. { 0x419eb4, 1, 0x04, 0x00000000 },
  105. { 0x419ebc, 2, 0x04, 0x00000000 },
  106. { 0x419edc, 1, 0x04, 0x00000000 },
  107. { 0x419f00, 1, 0x04, 0x00000000 },
  108. { 0x419ed0, 1, 0x04, 0x00003234 },
  109. { 0x419f74, 1, 0x04, 0x00015555 },
  110. { 0x419f80, 4, 0x04, 0x00000000 },
  111. {}
  112. };
  113. static const struct gf100_gr_pack
  114. gk110_gr_pack_mmio[] = {
  115. { gk104_gr_init_main_0 },
  116. { gk110_gr_init_fe_0 },
  117. { gf100_gr_init_pri_0 },
  118. { gf100_gr_init_rstr2d_0 },
  119. { gf119_gr_init_pd_0 },
  120. { gk110_gr_init_ds_0 },
  121. { gf100_gr_init_scc_0 },
  122. { gk110_gr_init_sked_0 },
  123. { gk110_gr_init_cwd_0 },
  124. { gf119_gr_init_prop_0 },
  125. { gf108_gr_init_gpc_unk_0 },
  126. { gf100_gr_init_setup_0 },
  127. { gf100_gr_init_crstr_0 },
  128. { gf108_gr_init_setup_1 },
  129. { gf100_gr_init_zcull_0 },
  130. { gf119_gr_init_gpm_0 },
  131. { gk110_gr_init_gpc_unk_1 },
  132. { gf100_gr_init_gcc_0 },
  133. { gk104_gr_init_tpccs_0 },
  134. { gk110_gr_init_tex_0 },
  135. { gk104_gr_init_pe_0 },
  136. { gk110_gr_init_l1c_0 },
  137. { gf100_gr_init_mpc_0 },
  138. { gk110_gr_init_sm_0 },
  139. { gf117_gr_init_pes_0 },
  140. { gf117_gr_init_wwdx_0 },
  141. { gf117_gr_init_cbm_0 },
  142. { gk104_gr_init_be_0 },
  143. { gf100_gr_init_fe_1 },
  144. {}
  145. };
  146. /*******************************************************************************
  147. * PGRAPH engine/subdev functions
  148. ******************************************************************************/
  149. #include "fuc/hubgk110.fuc3.h"
  150. struct gf100_gr_ucode
  151. gk110_gr_fecs_ucode = {
  152. .code.data = gk110_grhub_code,
  153. .code.size = sizeof(gk110_grhub_code),
  154. .data.data = gk110_grhub_data,
  155. .data.size = sizeof(gk110_grhub_data),
  156. };
  157. #include "fuc/gpcgk110.fuc3.h"
  158. struct gf100_gr_ucode
  159. gk110_gr_gpccs_ucode = {
  160. .code.data = gk110_grgpc_code,
  161. .code.size = sizeof(gk110_grgpc_code),
  162. .data.data = gk110_grgpc_data,
  163. .data.size = sizeof(gk110_grgpc_data),
  164. };
  165. static const struct gf100_gr_func
  166. gk110_gr = {
  167. .init = gk104_gr_init,
  168. .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
  169. .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
  170. .mmio = gk110_gr_pack_mmio,
  171. .fecs.ucode = &gk110_gr_fecs_ucode,
  172. .gpccs.ucode = &gk110_gr_gpccs_ucode,
  173. .rops = gf100_gr_rops,
  174. .ppc_nr = 2,
  175. .grctx = &gk110_grctx,
  176. .sclass = {
  177. { -1, -1, FERMI_TWOD_A },
  178. { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
  179. { -1, -1, KEPLER_B, &gf100_fermi },
  180. { -1, -1, KEPLER_COMPUTE_B },
  181. {}
  182. }
  183. };
  184. int
  185. gk110_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
  186. {
  187. return gf100_gr_new_(&gk110_gr, device, index, pgr);
  188. }