debug_hw_1x06.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright (C) 2010 Google, Inc.
  3. * Author: Erik Gilling <konkers@android.com>
  4. *
  5. * Copyright (C) 2011-2017 NVIDIA Corporation
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #include "../dev.h"
  18. #include "../debug.h"
  19. #include "../cdma.h"
  20. #include "../channel.h"
  21. static void host1x_debug_show_channel_cdma(struct host1x *host,
  22. struct host1x_channel *ch,
  23. struct output *o)
  24. {
  25. struct host1x_cdma *cdma = &ch->cdma;
  26. u32 dmaput, dmaget, dmactrl;
  27. u32 offset, class;
  28. u32 ch_stat;
  29. dmaput = host1x_ch_readl(ch, HOST1X_CHANNEL_DMAPUT);
  30. dmaget = host1x_ch_readl(ch, HOST1X_CHANNEL_DMAGET);
  31. dmactrl = host1x_ch_readl(ch, HOST1X_CHANNEL_DMACTRL);
  32. offset = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDP_OFFSET);
  33. class = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDP_CLASS);
  34. ch_stat = host1x_ch_readl(ch, HOST1X_CHANNEL_CHANNELSTAT);
  35. host1x_debug_output(o, "%u-%s: ", ch->id, dev_name(ch->dev));
  36. if (dmactrl & HOST1X_CHANNEL_DMACTRL_DMASTOP ||
  37. !ch->cdma.push_buffer.mapped) {
  38. host1x_debug_output(o, "inactive\n\n");
  39. return;
  40. }
  41. if (class == HOST1X_CLASS_HOST1X && offset == HOST1X_UCLASS_WAIT_SYNCPT)
  42. host1x_debug_output(o, "waiting on syncpt\n");
  43. else
  44. host1x_debug_output(o, "active class %02x, offset %04x\n",
  45. class, offset);
  46. host1x_debug_output(o, "DMAPUT %08x, DMAGET %08x, DMACTL %08x\n",
  47. dmaput, dmaget, dmactrl);
  48. host1x_debug_output(o, "CHANNELSTAT %02x\n", ch_stat);
  49. show_channel_gathers(o, cdma);
  50. host1x_debug_output(o, "\n");
  51. }
  52. static void host1x_debug_show_channel_fifo(struct host1x *host,
  53. struct host1x_channel *ch,
  54. struct output *o)
  55. {
  56. u32 val, rd_ptr, wr_ptr, start, end;
  57. u32 payload = INVALID_PAYLOAD;
  58. unsigned int data_count = 0;
  59. host1x_debug_output(o, "%u: fifo:\n", ch->id);
  60. val = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDFIFO_STAT);
  61. host1x_debug_output(o, "CMDFIFO_STAT %08x\n", val);
  62. if (val & HOST1X_CHANNEL_CMDFIFO_STAT_EMPTY) {
  63. host1x_debug_output(o, "[empty]\n");
  64. return;
  65. }
  66. val = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDFIFO_RDATA);
  67. host1x_debug_output(o, "CMDFIFO_RDATA %08x\n", val);
  68. /* Peek pointer values are invalid during SLCG, so disable it */
  69. host1x_hypervisor_writel(host, 0x1, HOST1X_HV_ICG_EN_OVERRIDE);
  70. val = 0;
  71. val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_ENABLE;
  72. val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_CHANNEL(ch->id);
  73. host1x_hypervisor_writel(host, val, HOST1X_HV_CMDFIFO_PEEK_CTRL);
  74. val = host1x_hypervisor_readl(host, HOST1X_HV_CMDFIFO_PEEK_PTRS);
  75. rd_ptr = HOST1X_HV_CMDFIFO_PEEK_PTRS_RD_PTR_V(val);
  76. wr_ptr = HOST1X_HV_CMDFIFO_PEEK_PTRS_WR_PTR_V(val);
  77. val = host1x_hypervisor_readl(host, HOST1X_HV_CMDFIFO_SETUP(ch->id));
  78. start = HOST1X_HV_CMDFIFO_SETUP_BASE_V(val);
  79. end = HOST1X_HV_CMDFIFO_SETUP_LIMIT_V(val);
  80. do {
  81. val = 0;
  82. val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_ENABLE;
  83. val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_CHANNEL(ch->id);
  84. val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_ADDR(rd_ptr);
  85. host1x_hypervisor_writel(host, val,
  86. HOST1X_HV_CMDFIFO_PEEK_CTRL);
  87. val = host1x_hypervisor_readl(host,
  88. HOST1X_HV_CMDFIFO_PEEK_READ);
  89. if (!data_count) {
  90. host1x_debug_output(o, "%03x 0x%08x: ",
  91. rd_ptr - start, val);
  92. data_count = show_channel_command(o, val, &payload);
  93. } else {
  94. host1x_debug_cont(o, "%08x%s", val,
  95. data_count > 1 ? ", " : "])\n");
  96. data_count--;
  97. }
  98. if (rd_ptr == end)
  99. rd_ptr = start;
  100. else
  101. rd_ptr++;
  102. } while (rd_ptr != wr_ptr);
  103. if (data_count)
  104. host1x_debug_cont(o, ", ...])\n");
  105. host1x_debug_output(o, "\n");
  106. host1x_hypervisor_writel(host, 0x0, HOST1X_HV_CMDFIFO_PEEK_CTRL);
  107. host1x_hypervisor_writel(host, 0x0, HOST1X_HV_ICG_EN_OVERRIDE);
  108. }
  109. static void host1x_debug_show_mlocks(struct host1x *host, struct output *o)
  110. {
  111. /* TODO */
  112. }