2 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2011-2017 NVIDIA Corporation
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.
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.
21 #include "../channel.h"
23 static void host1x_debug_show_channel_cdma(struct host1x *host,
24 struct host1x_channel *ch,
27 struct host1x_cdma *cdma = &ch->cdma;
28 u32 dmaput, dmaget, dmactrl;
32 dmaput = host1x_ch_readl(ch, HOST1X_CHANNEL_DMAPUT);
33 dmaget = host1x_ch_readl(ch, HOST1X_CHANNEL_DMAGET);
34 dmactrl = host1x_ch_readl(ch, HOST1X_CHANNEL_DMACTRL);
35 offset = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDP_OFFSET);
36 class = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDP_CLASS);
37 ch_stat = host1x_ch_readl(ch, HOST1X_CHANNEL_CHANNELSTAT);
39 host1x_debug_output(o, "%u-%s: ", ch->id, dev_name(ch->dev));
41 if (dmactrl & HOST1X_CHANNEL_DMACTRL_DMASTOP ||
42 !ch->cdma.push_buffer.mapped) {
43 host1x_debug_output(o, "inactive\n\n");
47 if (class == HOST1X_CLASS_HOST1X && offset == HOST1X_UCLASS_WAIT_SYNCPT)
48 host1x_debug_output(o, "waiting on syncpt\n");
50 host1x_debug_output(o, "active class %02x, offset %04x\n",
53 host1x_debug_output(o, "DMAPUT %08x, DMAGET %08x, DMACTL %08x\n",
54 dmaput, dmaget, dmactrl);
55 host1x_debug_output(o, "CHANNELSTAT %02x\n", ch_stat);
57 show_channel_gathers(o, cdma);
58 host1x_debug_output(o, "\n");
61 static void host1x_debug_show_channel_fifo(struct host1x *host,
62 struct host1x_channel *ch,
66 u32 rd_ptr, wr_ptr, start, end;
67 u32 payload = INVALID_PAYLOAD;
68 unsigned int data_count = 0;
72 host1x_debug_output(o, "%u: fifo:\n", ch->id);
74 val = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDFIFO_STAT);
75 host1x_debug_output(o, "CMDFIFO_STAT %08x\n", val);
76 if (val & HOST1X_CHANNEL_CMDFIFO_STAT_EMPTY) {
77 host1x_debug_output(o, "[empty]\n");
81 val = host1x_ch_readl(ch, HOST1X_CHANNEL_CMDFIFO_RDATA);
82 host1x_debug_output(o, "CMDFIFO_RDATA %08x\n", val);
85 /* Peek pointer values are invalid during SLCG, so disable it */
86 host1x_hypervisor_writel(host, 0x1, HOST1X_HV_ICG_EN_OVERRIDE);
89 val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_ENABLE;
90 val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_CHANNEL(ch->id);
91 host1x_hypervisor_writel(host, val, HOST1X_HV_CMDFIFO_PEEK_CTRL);
93 val = host1x_hypervisor_readl(host, HOST1X_HV_CMDFIFO_PEEK_PTRS);
94 rd_ptr = HOST1X_HV_CMDFIFO_PEEK_PTRS_RD_PTR_V(val);
95 wr_ptr = HOST1X_HV_CMDFIFO_PEEK_PTRS_WR_PTR_V(val);
97 val = host1x_hypervisor_readl(host, HOST1X_HV_CMDFIFO_SETUP(ch->id));
98 start = HOST1X_HV_CMDFIFO_SETUP_BASE_V(val);
99 end = HOST1X_HV_CMDFIFO_SETUP_LIMIT_V(val);
103 val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_ENABLE;
104 val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_CHANNEL(ch->id);
105 val |= HOST1X_HV_CMDFIFO_PEEK_CTRL_ADDR(rd_ptr);
106 host1x_hypervisor_writel(host, val,
107 HOST1X_HV_CMDFIFO_PEEK_CTRL);
109 val = host1x_hypervisor_readl(host,
110 HOST1X_HV_CMDFIFO_PEEK_READ);
113 host1x_debug_output(o, "%03x 0x%08x: ",
114 rd_ptr - start, val);
115 data_count = show_channel_command(o, val, &payload);
117 host1x_debug_cont(o, "%08x%s", val,
118 data_count > 1 ? ", " : "])\n");
126 } while (rd_ptr != wr_ptr);
129 host1x_debug_cont(o, ", ...])\n");
130 host1x_debug_output(o, "\n");
132 host1x_hypervisor_writel(host, 0x0, HOST1X_HV_CMDFIFO_PEEK_CTRL);
133 host1x_hypervisor_writel(host, 0x0, HOST1X_HV_ICG_EN_OVERRIDE);
137 static void host1x_debug_show_mlocks(struct host1x *host, struct output *o)