xref: /illumos-gate/usr/src/cmd/cxgbetool/cudbg_view.h (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2019 by Chelsio Communications, Inc.
14  */
15 
16 #ifndef __CUDBG_VIEW_H__
17 #define __CUDBG_VIEW_H__
18 
19 #include "t4_hw.h"
20 #include "cudbg_lib_common.h"
21 
22 #if defined(WIN32) || defined(__NT__) || defined(_WIN32) || defined(__WIN32__)
23 typedef boolean_t bool;
24 #endif
25 
26 #define DECLARE_VIEW_FUNC(FOO)				\
27 	int view_##FOO(char *, struct cudbg_entity_hdr *, \
28  		     struct cudbg_buffer *, enum chip_type);
29 DECLARE_VIEW_FUNC(cim_q);
30 DECLARE_VIEW_FUNC(cim_la);
31 DECLARE_VIEW_FUNC(reg_dump);
32 DECLARE_VIEW_FUNC(cim_qcfg);
33 DECLARE_VIEW_FUNC(mc0_data);
34 DECLARE_VIEW_FUNC(mc1_data);
35 DECLARE_VIEW_FUNC(fw_devlog);
36 DECLARE_VIEW_FUNC(cim_ma_la);
37 DECLARE_VIEW_FUNC(edc0_data);
38 DECLARE_VIEW_FUNC(edc1_data);
39 DECLARE_VIEW_FUNC(rss);
40 DECLARE_VIEW_FUNC(rss_pf_config);
41 DECLARE_VIEW_FUNC(rss_key);
42 DECLARE_VIEW_FUNC(rss_vf_config);
43 DECLARE_VIEW_FUNC(rss_config);
44 DECLARE_VIEW_FUNC(path_mtu);
45 DECLARE_VIEW_FUNC(sw_state);
46 DECLARE_VIEW_FUNC(wtp);
47 DECLARE_VIEW_FUNC(pm_stats);
48 DECLARE_VIEW_FUNC(tcp_stats);
49 DECLARE_VIEW_FUNC(hw_sched);
50 DECLARE_VIEW_FUNC(tp_err_stats_show);
51 DECLARE_VIEW_FUNC(fcoe_stats);
52 DECLARE_VIEW_FUNC(rdma_stats);
53 DECLARE_VIEW_FUNC(tp_indirect);
54 DECLARE_VIEW_FUNC(sge_indirect);
55 DECLARE_VIEW_FUNC(cpl_stats);
56 DECLARE_VIEW_FUNC(ddp_stats);
57 DECLARE_VIEW_FUNC(wc_stats);
58 DECLARE_VIEW_FUNC(ulprx_la);
59 DECLARE_VIEW_FUNC(lb_stats);
60 DECLARE_VIEW_FUNC(tp_la);
61 DECLARE_VIEW_FUNC(meminfo);
62 DECLARE_VIEW_FUNC(cim_pif_la);
63 DECLARE_VIEW_FUNC(clk_info);
64 DECLARE_VIEW_FUNC(macstats);
65 DECLARE_VIEW_FUNC(pcie_indirect);
66 DECLARE_VIEW_FUNC(pm_indirect);
67 DECLARE_VIEW_FUNC(full);
68 DECLARE_VIEW_FUNC(tx_rate);
69 DECLARE_VIEW_FUNC(tid);
70 DECLARE_VIEW_FUNC(pcie_config);
71 DECLARE_VIEW_FUNC(dump_context);
72 DECLARE_VIEW_FUNC(mps_tcam);
73 DECLARE_VIEW_FUNC(vpd_data);
74 DECLARE_VIEW_FUNC(le_tcam);
75 DECLARE_VIEW_FUNC(cctrl);
76 DECLARE_VIEW_FUNC(ma_indirect);
77 DECLARE_VIEW_FUNC(ulptx_la);
78 DECLARE_VIEW_FUNC(ext_entity);
79 DECLARE_VIEW_FUNC(up_cim_indirect);
80 DECLARE_VIEW_FUNC(pbt_tables);
81 DECLARE_VIEW_FUNC(mbox_log);
82 DECLARE_VIEW_FUNC(hma_indirect);
83 DECLARE_VIEW_FUNC(hma_data);
84 DECLARE_VIEW_FUNC(upload);
85 DECLARE_VIEW_FUNC(qdesc);
86 
87 static int (*view_entity[]) (char *, struct cudbg_entity_hdr *,
88 			     struct cudbg_buffer *, enum chip_type) = {
89 	view_reg_dump,
90 	view_fw_devlog,
91 	view_cim_la,
92 	view_cim_ma_la,
93 	view_cim_qcfg,
94 	view_cim_q,
95 	view_cim_q,
96 	view_cim_q,
97 	view_cim_q,
98 	view_cim_q,
99 	view_cim_q,
100 	view_cim_q,
101 	view_cim_q,
102 	view_cim_q,
103 	view_cim_q,
104 	view_cim_q,
105 	view_cim_q,
106 	view_edc0_data,
107 	view_edc1_data,
108 	view_mc0_data,
109 	view_mc1_data,
110 	view_rss,	    /*22*/
111 	view_rss_pf_config, /*23*/
112 	view_rss_key,	    /*24*/
113 	view_rss_vf_config,
114 	view_rss_config,
115 	view_path_mtu,
116 	view_sw_state,
117 	view_wtp,
118 	view_pm_stats,
119 	view_hw_sched,
120 	view_tcp_stats,
121 	view_tp_err_stats_show,
122 	view_fcoe_stats,
123 	view_rdma_stats,
124 	view_tp_indirect,
125 	view_sge_indirect,
126 	view_cpl_stats,
127 	view_ddp_stats,
128 	view_wc_stats,
129 	view_ulprx_la,
130 	view_lb_stats,
131 	view_tp_la,
132 	view_meminfo,
133 	view_cim_pif_la,
134 	view_clk_info,
135 	view_cim_q,
136 	view_cim_q,
137 	view_macstats,
138 	view_pcie_indirect,
139 	view_pm_indirect,
140 	view_full,
141 	view_tx_rate,
142 	view_tid,
143 	view_pcie_config,
144 	view_dump_context,
145 	view_mps_tcam,
146 	view_vpd_data,
147 	view_le_tcam,
148 	view_cctrl,
149 	view_ma_indirect,
150 	view_ulptx_la,
151 	view_ext_entity,
152 	view_up_cim_indirect,
153 	view_pbt_tables,
154 	view_mbox_log,
155 	view_hma_indirect,
156 	view_hma_data,
157 	view_upload,
158 	view_qdesc,
159 };
160 
161 struct reg_info {
162 	const char *name;
163 	uint32_t addr;
164 	uint32_t len;
165 };
166 
167 struct mod_regs {
168 	const char *name;
169 	const struct reg_info *ri;
170 	unsigned int offset;
171 };
172 
173 static const char *yesno(int);
174 void translate_fw_devlog(void *, u32, u32 *, u32 *);
175 #define BIT(n)	(1U << n)
176 
177 void cudbg_view_release_buff(char *pbuf, struct cudbg_buffer *dc_buff);
178 void cudbg_print_flash_header(void *pinbuf);
179 #endif
180