gm20b.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. /* Bypass MMU check for non-secure boot */
  32. if (!device->secboot) {
  33. nvkm_wr32(device, 0x100ce4, 0xffffffff);
  34. if (nvkm_rd32(device, 0x100ce4) != 0xffffffff)
  35. nvdev_warn(device,
  36. "cannot bypass secure boot - expect failure soon!\n");
  37. }
  38. val = nvkm_rd32(device, 0x100c80);
  39. val &= 0xf000187f;
  40. nvkm_wr32(device, 0x418880, val);
  41. nvkm_wr32(device, 0x418890, 0);
  42. nvkm_wr32(device, 0x418894, 0);
  43. nvkm_wr32(device, 0x4188b0, nvkm_rd32(device, 0x100cc4));
  44. nvkm_wr32(device, 0x4188b4, nvkm_rd32(device, 0x100cc8));
  45. nvkm_wr32(device, 0x4188b8, nvkm_rd32(device, 0x100ccc));
  46. nvkm_wr32(device, 0x4188ac, nvkm_rd32(device, 0x100800));
  47. }
  48. static void
  49. gm20b_gr_set_hww_esr_report_mask(struct gf100_gr *gr)
  50. {
  51. struct nvkm_device *device = gr->base.engine.subdev.device;
  52. nvkm_wr32(device, 0x419e44, 0xdffffe);
  53. nvkm_wr32(device, 0x419e4c, 0x5);
  54. }
  55. static const struct gf100_gr_func
  56. gm20b_gr = {
  57. .init = gk20a_gr_init,
  58. .init_gpc_mmu = gm20b_gr_init_gpc_mmu,
  59. .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
  60. .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask,
  61. .rops = gm200_gr_rops,
  62. .ppc_nr = 1,
  63. .grctx = &gm20b_grctx,
  64. .sclass = {
  65. { -1, -1, FERMI_TWOD_A },
  66. { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
  67. { -1, -1, MAXWELL_B, &gf100_fermi },
  68. { -1, -1, MAXWELL_COMPUTE_B },
  69. {}
  70. }
  71. };
  72. int
  73. gm20b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
  74. {
  75. return gm200_gr_new_(&gm20b_gr, device, index, pgr);
  76. }