gm20b.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
  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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. #include "gf100.h"
  23. #include "ctxgf100.h"
  24. #include <subdev/timer.h>
  25. #include <nvif/class.h>
  26. static void
  27. gm20b_gr_init_gpc_mmu(struct gf100_gr *gr)
  28. {
  29. struct nvkm_device *device = gr->base.engine.subdev.device;
  30. u32 val;
  31. /* TODO this needs to be removed once secure boot works */
  32. if (1) {
  33. nvkm_wr32(device, 0x100ce4, 0xffffffff);
  34. }
  35. /* TODO update once secure boot works */
  36. val = nvkm_rd32(device, 0x100c80);
  37. val &= 0xf000087f;
  38. nvkm_wr32(device, 0x418880, val);
  39. nvkm_wr32(device, 0x418890, 0);
  40. nvkm_wr32(device, 0x418894, 0);
  41. nvkm_wr32(device, 0x4188b0, nvkm_rd32(device, 0x100cc4));
  42. nvkm_wr32(device, 0x4188b4, nvkm_rd32(device, 0x100cc8));
  43. nvkm_wr32(device, 0x4188b8, nvkm_rd32(device, 0x100ccc));
  44. nvkm_wr32(device, 0x4188ac, nvkm_rd32(device, 0x100800));
  45. }
  46. static void
  47. gm20b_gr_set_hww_esr_report_mask(struct gf100_gr *gr)
  48. {
  49. struct nvkm_device *device = gr->base.engine.subdev.device;
  50. nvkm_wr32(device, 0x419e44, 0xdffffe);
  51. nvkm_wr32(device, 0x419e4c, 0x5);
  52. }
  53. static const struct gf100_gr_func
  54. gm20b_gr = {
  55. .dtor = gk20a_gr_dtor,
  56. .init = gk20a_gr_init,
  57. .init_gpc_mmu = gm20b_gr_init_gpc_mmu,
  58. .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask,
  59. .ppc_nr = 1,
  60. .grctx = &gm20b_grctx,
  61. .sclass = {
  62. { -1, -1, FERMI_TWOD_A },
  63. { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
  64. { -1, -1, MAXWELL_B, &gf100_fermi },
  65. { -1, -1, MAXWELL_COMPUTE_B },
  66. {}
  67. }
  68. };
  69. int
  70. gm20b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
  71. {
  72. return gk20a_gr_new_(&gm20b_gr, device, index, pgr);
  73. }